aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs
diff options
context:
space:
mode:
authormcheshkov <mcheshkov@yandex-team.ru>2022-02-10 16:46:16 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:16 +0300
commit1312621288956f199a5bd5342b0133d4395fa725 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/libs
parente9d19cec64684c9c1e6b0c98297e5b895cf904fe (diff)
downloadydb-1312621288956f199a5bd5342b0133d4395fa725.tar.gz
Restoring authorship annotation for <mcheshkov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs')
-rw-r--r--contrib/libs/icu/APIChangeReport.html5186
-rw-r--r--contrib/libs/icu/LICENSE828
-rw-r--r--contrib/libs/icu/common/appendable.cpp4
-rw-r--r--contrib/libs/icu/common/bmpset.cpp136
-rw-r--r--contrib/libs/icu/common/bmpset.h20
-rw-r--r--contrib/libs/icu/common/brkeng.cpp72
-rw-r--r--contrib/libs/icu/common/brkeng.h28
-rw-r--r--contrib/libs/icu/common/brkiter.cpp94
-rw-r--r--contrib/libs/icu/common/bytesinkutil.cpp322
-rw-r--r--contrib/libs/icu/common/bytesinkutil.h166
-rw-r--r--contrib/libs/icu/common/bytestream.cpp14
-rw-r--r--contrib/libs/icu/common/bytestrie.cpp4
-rw-r--r--contrib/libs/icu/common/bytestriebuilder.cpp8
-rw-r--r--contrib/libs/icu/common/bytestrieiterator.cpp4
-rw-r--r--contrib/libs/icu/common/caniter.cpp8
-rw-r--r--contrib/libs/icu/common/capi_helper.h194
-rw-r--r--contrib/libs/icu/common/characterproperties.cpp766
-rw-r--r--contrib/libs/icu/common/chariter.cpp2
-rw-r--r--contrib/libs/icu/common/charstr.cpp96
-rw-r--r--contrib/libs/icu/common/charstr.h58
-rw-r--r--contrib/libs/icu/common/cmemory.cpp276
-rw-r--r--contrib/libs/icu/common/cmemory.h504
-rw-r--r--contrib/libs/icu/common/cpputils.h4
-rw-r--r--contrib/libs/icu/common/cstr.cpp2
-rw-r--r--contrib/libs/icu/common/cstr.h2
-rw-r--r--contrib/libs/icu/common/cstring.cpp682
-rw-r--r--contrib/libs/icu/common/cstring.h6
-rw-r--r--contrib/libs/icu/common/cwchar.cpp110
-rw-r--r--contrib/libs/icu/common/cwchar.h4
-rw-r--r--contrib/libs/icu/common/dictbe.cpp158
-rw-r--r--contrib/libs/icu/common/dictbe.h28
-rw-r--r--contrib/libs/icu/common/dictionarydata.cpp2
-rw-r--r--contrib/libs/icu/common/dictionarydata.h4
-rw-r--r--contrib/libs/icu/common/dtintrv.cpp2
-rw-r--r--contrib/libs/icu/common/edits.cpp1606
-rw-r--r--contrib/libs/icu/common/errorcode.cpp4
-rw-r--r--contrib/libs/icu/common/filteredbrk.cpp18
-rw-r--r--contrib/libs/icu/common/filterednormalizer2.cpp150
-rw-r--r--contrib/libs/icu/common/hash.h122
-rw-r--r--contrib/libs/icu/common/icudataver.cpp62
-rw-r--r--contrib/libs/icu/common/icuplug.cpp2
-rw-r--r--contrib/libs/icu/common/icuplugimp.h2
-rw-r--r--contrib/libs/icu/common/loadednormalizer2impl.cpp150
-rw-r--r--contrib/libs/icu/common/localebuilder.cpp936
-rw-r--r--contrib/libs/icu/common/localematcher.cpp1588
-rw-r--r--contrib/libs/icu/common/localeprioritylist.cpp478
-rw-r--r--contrib/libs/icu/common/localeprioritylist.h230
-rw-r--r--contrib/libs/icu/common/localsvc.h4
-rw-r--r--contrib/libs/icu/common/locavailable.cpp320
-rw-r--r--contrib/libs/icu/common/locbased.cpp2
-rw-r--r--contrib/libs/icu/common/locbased.h4
-rw-r--r--contrib/libs/icu/common/locdispnames.cpp70
-rw-r--r--contrib/libs/icu/common/locdistance.cpp830
-rw-r--r--contrib/libs/icu/common/locdistance.h302
-rw-r--r--contrib/libs/icu/common/locdspnm.cpp186
-rw-r--r--contrib/libs/icu/common/locid.cpp1320
-rw-r--r--contrib/libs/icu/common/loclikely.cpp682
-rw-r--r--contrib/libs/icu/common/loclikelysubtags.cpp1492
-rw-r--r--contrib/libs/icu/common/loclikelysubtags.h314
-rw-r--r--contrib/libs/icu/common/locmap.cpp2618
-rw-r--r--contrib/libs/icu/common/locmap.h8
-rw-r--r--contrib/libs/icu/common/locresdata.cpp28
-rw-r--r--contrib/libs/icu/common/locutil.cpp8
-rw-r--r--contrib/libs/icu/common/locutil.h2
-rw-r--r--contrib/libs/icu/common/lsr.cpp228
-rw-r--r--contrib/libs/icu/common/lsr.h164
-rw-r--r--contrib/libs/icu/common/messageimpl.h4
-rw-r--r--contrib/libs/icu/common/messagepattern.cpp4
-rw-r--r--contrib/libs/icu/common/msvcres.h2
-rw-r--r--contrib/libs/icu/common/mutex.h72
-rw-r--r--contrib/libs/icu/common/norm2_nfc_data.h2068
-rw-r--r--contrib/libs/icu/common/norm2allmodes.h82
-rw-r--r--contrib/libs/icu/common/normalizer2.cpp208
-rw-r--r--contrib/libs/icu/common/normalizer2impl.cpp2552
-rw-r--r--contrib/libs/icu/common/normalizer2impl.h556
-rw-r--r--contrib/libs/icu/common/normlzr.cpp18
-rw-r--r--contrib/libs/icu/common/parsepos.cpp2
-rw-r--r--contrib/libs/icu/common/patternprops.cpp24
-rw-r--r--contrib/libs/icu/common/patternprops.h18
-rw-r--r--contrib/libs/icu/common/pluralmap.cpp2
-rw-r--r--contrib/libs/icu/common/pluralmap.h2
-rw-r--r--contrib/libs/icu/common/propname.cpp2
-rw-r--r--contrib/libs/icu/common/propname.h2
-rw-r--r--contrib/libs/icu/common/propname_data.h2332
-rw-r--r--contrib/libs/icu/common/propsvec.cpp1058
-rw-r--r--contrib/libs/icu/common/propsvec.h4
-rw-r--r--contrib/libs/icu/common/punycode.cpp4
-rw-r--r--contrib/libs/icu/common/punycode.h4
-rw-r--r--contrib/libs/icu/common/putil.cpp640
-rw-r--r--contrib/libs/icu/common/putilimp.h178
-rw-r--r--contrib/libs/icu/common/rbbi.cpp704
-rw-r--r--contrib/libs/icu/common/rbbi_cache.cpp1306
-rw-r--r--contrib/libs/icu/common/rbbi_cache.h406
-rw-r--r--contrib/libs/icu/common/rbbidata.cpp56
-rw-r--r--contrib/libs/icu/common/rbbidata.h42
-rw-r--r--contrib/libs/icu/common/rbbinode.cpp2
-rw-r--r--contrib/libs/icu/common/rbbinode.h2
-rw-r--r--contrib/libs/icu/common/rbbirb.cpp220
-rw-r--r--contrib/libs/icu/common/rbbirb.h64
-rw-r--r--contrib/libs/icu/common/rbbirpt.h2
-rw-r--r--contrib/libs/icu/common/rbbiscan.cpp62
-rw-r--r--contrib/libs/icu/common/rbbiscan.h8
-rw-r--r--contrib/libs/icu/common/rbbisetb.cpp138
-rw-r--r--contrib/libs/icu/common/rbbisetb.h42
-rw-r--r--contrib/libs/icu/common/rbbistbl.cpp2
-rw-r--r--contrib/libs/icu/common/rbbitblb.cpp1056
-rw-r--r--contrib/libs/icu/common/rbbitblb.h202
-rw-r--r--contrib/libs/icu/common/resbund.cpp6
-rw-r--r--contrib/libs/icu/common/resbund_cnv.cpp4
-rw-r--r--contrib/libs/icu/common/resource.cpp2
-rw-r--r--contrib/libs/icu/common/resource.h40
-rw-r--r--contrib/libs/icu/common/restrace.cpp260
-rw-r--r--contrib/libs/icu/common/restrace.h294
-rw-r--r--contrib/libs/icu/common/ruleiter.cpp2
-rw-r--r--contrib/libs/icu/common/ruleiter.h2
-rw-r--r--contrib/libs/icu/common/schriter.cpp4
-rw-r--r--contrib/libs/icu/common/serv.cpp10
-rw-r--r--contrib/libs/icu/common/serv.h2
-rw-r--r--contrib/libs/icu/common/servlk.cpp2
-rw-r--r--contrib/libs/icu/common/servlkf.cpp2
-rw-r--r--contrib/libs/icu/common/servloc.h2
-rw-r--r--contrib/libs/icu/common/servls.cpp4
-rw-r--r--contrib/libs/icu/common/servnotf.cpp4
-rw-r--r--contrib/libs/icu/common/servnotf.h2
-rw-r--r--contrib/libs/icu/common/servrbf.cpp2
-rw-r--r--contrib/libs/icu/common/servslkf.cpp2
-rw-r--r--contrib/libs/icu/common/sharedobject.cpp46
-rw-r--r--contrib/libs/icu/common/sharedobject.h66
-rw-r--r--contrib/libs/icu/common/simpleformatter.cpp30
-rw-r--r--contrib/libs/icu/common/sprpimpl.h4
-rw-r--r--contrib/libs/icu/common/static_unicode_sets.cpp490
-rw-r--r--contrib/libs/icu/common/static_unicode_sets.h276
-rw-r--r--contrib/libs/icu/common/stringpiece.cpp84
-rw-r--r--contrib/libs/icu/common/stringtriebuilder.cpp6
-rw-r--r--contrib/libs/icu/common/uarrsort.cpp548
-rw-r--r--contrib/libs/icu/common/uarrsort.h4
-rw-r--r--contrib/libs/icu/common/uassert.h50
-rw-r--r--contrib/libs/icu/common/ubidi.cpp6072
-rw-r--r--contrib/libs/icu/common/ubidi_props.cpp508
-rw-r--r--contrib/libs/icu/common/ubidi_props.h26
-rw-r--r--contrib/libs/icu/common/ubidi_props_data.h1334
-rw-r--r--contrib/libs/icu/common/ubidiimp.h94
-rw-r--r--contrib/libs/icu/common/ubidiln.cpp2694
-rw-r--r--contrib/libs/icu/common/ubiditransform.cpp1044
-rw-r--r--contrib/libs/icu/common/ubidiwrt.cpp1300
-rw-r--r--contrib/libs/icu/common/ubrk.cpp118
-rw-r--r--contrib/libs/icu/common/ubrkimpl.h2
-rw-r--r--contrib/libs/icu/common/ucase.cpp830
-rw-r--r--contrib/libs/icu/common/ucase.h158
-rw-r--r--contrib/libs/icu/common/ucase_props_data.h1458
-rw-r--r--contrib/libs/icu/common/ucasemap.cpp1168
-rw-r--r--contrib/libs/icu/common/ucasemap_imp.h564
-rw-r--r--contrib/libs/icu/common/ucasemap_titlecase_brkiter.cpp164
-rw-r--r--contrib/libs/icu/common/ucat.cpp156
-rw-r--r--contrib/libs/icu/common/uchar.cpp1460
-rw-r--r--contrib/libs/icu/common/uchar_props_data.h6966
-rw-r--r--contrib/libs/icu/common/ucharstrie.cpp8
-rw-r--r--contrib/libs/icu/common/ucharstriebuilder.cpp6
-rw-r--r--contrib/libs/icu/common/ucharstrieiterator.cpp6
-rw-r--r--contrib/libs/icu/common/uchriter.cpp12
-rw-r--r--contrib/libs/icu/common/ucln.h4
-rw-r--r--contrib/libs/icu/common/ucln_cmn.cpp34
-rw-r--r--contrib/libs/icu/common/ucln_cmn.h16
-rw-r--r--contrib/libs/icu/common/ucln_imp.h8
-rw-r--r--contrib/libs/icu/common/ucmndata.cpp786
-rw-r--r--contrib/libs/icu/common/ucmndata.h12
-rw-r--r--contrib/libs/icu/common/ucnv.cpp5814
-rw-r--r--contrib/libs/icu/common/ucnv2022.cpp26
-rw-r--r--contrib/libs/icu/common/ucnv_bld.cpp24
-rw-r--r--contrib/libs/icu/common/ucnv_bld.h8
-rw-r--r--contrib/libs/icu/common/ucnv_cb.cpp522
-rw-r--r--contrib/libs/icu/common/ucnv_cnv.cpp364
-rw-r--r--contrib/libs/icu/common/ucnv_cnv.h2
-rw-r--r--contrib/libs/icu/common/ucnv_ct.cpp1292
-rw-r--r--contrib/libs/icu/common/ucnv_err.cpp966
-rw-r--r--contrib/libs/icu/common/ucnv_ext.cpp6
-rw-r--r--contrib/libs/icu/common/ucnv_ext.h4
-rw-r--r--contrib/libs/icu/common/ucnv_imp.h2
-rw-r--r--contrib/libs/icu/common/ucnv_io.cpp2
-rw-r--r--contrib/libs/icu/common/ucnv_io.h2
-rw-r--r--contrib/libs/icu/common/ucnv_lmb.cpp2748
-rw-r--r--contrib/libs/icu/common/ucnv_set.cpp140
-rw-r--r--contrib/libs/icu/common/ucnv_u16.cpp3154
-rw-r--r--contrib/libs/icu/common/ucnv_u32.cpp2506
-rw-r--r--contrib/libs/icu/common/ucnv_u7.cpp2982
-rw-r--r--contrib/libs/icu/common/ucnv_u8.cpp1886
-rw-r--r--contrib/libs/icu/common/ucnvbocu.cpp8
-rw-r--r--contrib/libs/icu/common/ucnvdisp.cpp176
-rw-r--r--contrib/libs/icu/common/ucnvhz.cpp1244
-rw-r--r--contrib/libs/icu/common/ucnvisci.cpp3270
-rw-r--r--contrib/libs/icu/common/ucnvlat1.cpp1512
-rw-r--r--contrib/libs/icu/common/ucnvmbcs.cpp184
-rw-r--r--contrib/libs/icu/common/ucnvmbcs.h4
-rw-r--r--contrib/libs/icu/common/ucnvscsu.cpp4090
-rw-r--r--contrib/libs/icu/common/ucnvsel.cpp50
-rw-r--r--contrib/libs/icu/common/ucol_data.h4
-rw-r--r--contrib/libs/icu/common/ucol_swp.cpp4
-rw-r--r--contrib/libs/icu/common/ucol_swp.h4
-rw-r--r--contrib/libs/icu/common/ucptrie.cpp1202
-rw-r--r--contrib/libs/icu/common/ucptrie_impl.h578
-rw-r--r--contrib/libs/icu/common/ucurr.cpp512
-rw-r--r--contrib/libs/icu/common/ucurrimp.h36
-rw-r--r--contrib/libs/icu/common/udata.cpp152
-rw-r--r--contrib/libs/icu/common/udatamem.cpp322
-rw-r--r--contrib/libs/icu/common/udatamem.h2
-rw-r--r--contrib/libs/icu/common/udataswp.cpp946
-rw-r--r--contrib/libs/icu/common/udataswp.h80
-rw-r--r--contrib/libs/icu/common/uelement.h4
-rw-r--r--contrib/libs/icu/common/uenum.cpp378
-rw-r--r--contrib/libs/icu/common/uenumimp.h4
-rw-r--r--contrib/libs/icu/common/uhash.cpp1982
-rw-r--r--contrib/libs/icu/common/uhash.h128
-rw-r--r--contrib/libs/icu/common/uhash_us.cpp2
-rw-r--r--contrib/libs/icu/common/uidna.cpp10
-rw-r--r--contrib/libs/icu/common/uinit.cpp4
-rw-r--r--contrib/libs/icu/common/uinvchar.cpp1254
-rw-r--r--contrib/libs/icu/common/uinvchar.h182
-rw-r--r--contrib/libs/icu/common/uiter.cpp4
-rw-r--r--contrib/libs/icu/common/ulayout_props.h92
-rw-r--r--contrib/libs/icu/common/ulist.cpp540
-rw-r--r--contrib/libs/icu/common/ulist.h2
-rw-r--r--contrib/libs/icu/common/uloc.cpp1172
-rw-r--r--contrib/libs/icu/common/uloc_keytype.cpp106
-rw-r--r--contrib/libs/icu/common/uloc_tag.cpp5754
-rw-r--r--contrib/libs/icu/common/ulocimp.h336
-rw-r--r--contrib/libs/icu/common/umapfile.cpp1058
-rw-r--r--contrib/libs/icu/common/umapfile.h4
-rw-r--r--contrib/libs/icu/common/umath.cpp52
-rw-r--r--contrib/libs/icu/common/umutablecptrie.cpp3704
-rw-r--r--contrib/libs/icu/common/umutex.cpp176
-rw-r--r--contrib/libs/icu/common/umutex.h214
-rw-r--r--contrib/libs/icu/common/unames.cpp88
-rw-r--r--contrib/libs/icu/common/unifiedcache.cpp336
-rw-r--r--contrib/libs/icu/common/unifiedcache.h370
-rw-r--r--contrib/libs/icu/common/unifilt.cpp2
-rw-r--r--contrib/libs/icu/common/unifunct.cpp2
-rw-r--r--contrib/libs/icu/common/uniset.cpp508
-rw-r--r--contrib/libs/icu/common/uniset_closure.cpp30
-rw-r--r--contrib/libs/icu/common/uniset_props.cpp140
-rw-r--r--contrib/libs/icu/common/unisetspan.cpp26
-rw-r--r--contrib/libs/icu/common/unisetspan.h4
-rw-r--r--contrib/libs/icu/common/unistr.cpp138
-rw-r--r--contrib/libs/icu/common/unistr_case.cpp216
-rw-r--r--contrib/libs/icu/common/unistr_case_locale.cpp24
-rw-r--r--contrib/libs/icu/common/unistr_cnv.cpp4
-rw-r--r--contrib/libs/icu/common/unistr_props.cpp4
-rw-r--r--contrib/libs/icu/common/unistr_titlecase_brkiter.cpp36
-rw-r--r--contrib/libs/icu/common/unistrappender.h2
-rw-r--r--contrib/libs/icu/common/unorm.cpp2
-rw-r--r--contrib/libs/icu/common/unormcmp.cpp8
-rw-r--r--contrib/libs/icu/common/unormimp.h4
-rw-r--r--contrib/libs/icu/common/uobject.cpp16
-rw-r--r--contrib/libs/icu/common/uposixdefs.h32
-rw-r--r--contrib/libs/icu/common/uprops.cpp404
-rw-r--r--contrib/libs/icu/common/uprops.h108
-rw-r--r--contrib/libs/icu/common/ures_cnv.cpp156
-rw-r--r--contrib/libs/icu/common/uresbund.cpp420
-rw-r--r--contrib/libs/icu/common/uresdata.cpp154
-rw-r--r--contrib/libs/icu/common/uresdata.h126
-rw-r--r--contrib/libs/icu/common/uresimp.h174
-rw-r--r--contrib/libs/icu/common/ureslocs.h2
-rw-r--r--contrib/libs/icu/common/usc_impl.cpp722
-rw-r--r--contrib/libs/icu/common/usc_impl.h2
-rw-r--r--contrib/libs/icu/common/uscript.cpp298
-rw-r--r--contrib/libs/icu/common/uscript_props.cpp54
-rw-r--r--contrib/libs/icu/common/uset.cpp6
-rw-r--r--contrib/libs/icu/common/uset_imp.h4
-rw-r--r--contrib/libs/icu/common/uset_props.cpp4
-rw-r--r--contrib/libs/icu/common/usetiter.cpp4
-rw-r--r--contrib/libs/icu/common/ushape.cpp10
-rw-r--r--contrib/libs/icu/common/usprep.cpp22
-rw-r--r--contrib/libs/icu/common/ustack.cpp2
-rw-r--r--contrib/libs/icu/common/ustr_cnv.cpp20
-rw-r--r--contrib/libs/icu/common/ustr_cnv.h4
-rw-r--r--contrib/libs/icu/common/ustr_imp.h158
-rw-r--r--contrib/libs/icu/common/ustr_titlecase_brkiter.cpp364
-rw-r--r--contrib/libs/icu/common/ustr_wcs.cpp10
-rw-r--r--contrib/libs/icu/common/ustrcase.cpp1034
-rw-r--r--contrib/libs/icu/common/ustrcase_locale.cpp92
-rw-r--r--contrib/libs/icu/common/ustrenum.cpp2
-rw-r--r--contrib/libs/icu/common/ustrenum.h2
-rw-r--r--contrib/libs/icu/common/ustrfmt.cpp118
-rw-r--r--contrib/libs/icu/common/ustrfmt.h2
-rw-r--r--contrib/libs/icu/common/ustring.cpp30
-rw-r--r--contrib/libs/icu/common/ustrtrns.cpp470
-rw-r--r--contrib/libs/icu/common/utext.cpp116
-rw-r--r--contrib/libs/icu/common/utf_impl.cpp658
-rw-r--r--contrib/libs/icu/common/util.cpp22
-rw-r--r--contrib/libs/icu/common/util.h40
-rw-r--r--contrib/libs/icu/common/util_props.cpp2
-rw-r--r--contrib/libs/icu/common/utrace.cpp1004
-rw-r--r--contrib/libs/icu/common/utracimp.h116
-rw-r--r--contrib/libs/icu/common/utrie.cpp4
-rw-r--r--contrib/libs/icu/common/utrie.h36
-rw-r--r--contrib/libs/icu/common/utrie2.cpp32
-rw-r--r--contrib/libs/icu/common/utrie2.h62
-rw-r--r--contrib/libs/icu/common/utrie2_builder.cpp154
-rw-r--r--contrib/libs/icu/common/utrie2_impl.h22
-rw-r--r--contrib/libs/icu/common/utrie_swap.cpp688
-rw-r--r--contrib/libs/icu/common/uts46.cpp56
-rw-r--r--contrib/libs/icu/common/utypeinfo.h4
-rw-r--r--contrib/libs/icu/common/utypes.cpp452
-rw-r--r--contrib/libs/icu/common/uvector.cpp2
-rw-r--r--contrib/libs/icu/common/uvector.h28
-rw-r--r--contrib/libs/icu/common/uvectr32.cpp2
-rw-r--r--contrib/libs/icu/common/uvectr32.h28
-rw-r--r--contrib/libs/icu/common/uvectr64.cpp2
-rw-r--r--contrib/libs/icu/common/uvectr64.h20
-rw-r--r--contrib/libs/icu/common/wintz.cpp248
-rw-r--r--contrib/libs/icu/common/wintz.h8
-rw-r--r--contrib/libs/icu/i18n/alphaindex.cpp24
-rw-r--r--contrib/libs/icu/i18n/anytrans.cpp28
-rw-r--r--contrib/libs/icu/i18n/anytrans.h4
-rw-r--r--contrib/libs/icu/i18n/astro.cpp4
-rw-r--r--contrib/libs/icu/i18n/astro.h2
-rw-r--r--contrib/libs/icu/i18n/basictz.cpp2
-rw-r--r--contrib/libs/icu/i18n/bocsu.cpp4
-rw-r--r--contrib/libs/icu/i18n/bocsu.h8
-rw-r--r--contrib/libs/icu/i18n/brktrans.cpp16
-rw-r--r--contrib/libs/icu/i18n/brktrans.h4
-rw-r--r--contrib/libs/icu/i18n/buddhcal.cpp6
-rw-r--r--contrib/libs/icu/i18n/buddhcal.h4
-rw-r--r--contrib/libs/icu/i18n/calendar.cpp312
-rw-r--r--contrib/libs/icu/i18n/casetrn.cpp12
-rw-r--r--contrib/libs/icu/i18n/casetrn.h6
-rw-r--r--contrib/libs/icu/i18n/cecal.cpp2
-rw-r--r--contrib/libs/icu/i18n/cecal.h2
-rw-r--r--contrib/libs/icu/i18n/chnsecal.cpp6
-rw-r--r--contrib/libs/icu/i18n/chnsecal.h4
-rw-r--r--contrib/libs/icu/i18n/choicfmt.cpp4
-rw-r--r--contrib/libs/icu/i18n/coleitr.cpp4
-rw-r--r--contrib/libs/icu/i18n/coll.cpp42
-rw-r--r--contrib/libs/icu/i18n/collation.cpp2
-rw-r--r--contrib/libs/icu/i18n/collation.h2
-rw-r--r--contrib/libs/icu/i18n/collationbuilder.cpp4
-rw-r--r--contrib/libs/icu/i18n/collationbuilder.h2
-rw-r--r--contrib/libs/icu/i18n/collationcompare.cpp2
-rw-r--r--contrib/libs/icu/i18n/collationcompare.h2
-rw-r--r--contrib/libs/icu/i18n/collationdata.cpp2
-rw-r--r--contrib/libs/icu/i18n/collationdata.h2
-rw-r--r--contrib/libs/icu/i18n/collationdatabuilder.cpp4
-rw-r--r--contrib/libs/icu/i18n/collationdatabuilder.h2
-rw-r--r--contrib/libs/icu/i18n/collationdatareader.cpp6
-rw-r--r--contrib/libs/icu/i18n/collationdatareader.h2
-rw-r--r--contrib/libs/icu/i18n/collationdatawriter.cpp4
-rw-r--r--contrib/libs/icu/i18n/collationdatawriter.h2
-rw-r--r--contrib/libs/icu/i18n/collationfastlatin.cpp2
-rw-r--r--contrib/libs/icu/i18n/collationfastlatin.h2
-rw-r--r--contrib/libs/icu/i18n/collationfastlatinbuilder.cpp4
-rw-r--r--contrib/libs/icu/i18n/collationfastlatinbuilder.h2
-rw-r--r--contrib/libs/icu/i18n/collationfcd.cpp116
-rw-r--r--contrib/libs/icu/i18n/collationfcd.h2
-rw-r--r--contrib/libs/icu/i18n/collationiterator.cpp6
-rw-r--r--contrib/libs/icu/i18n/collationiterator.h36
-rw-r--r--contrib/libs/icu/i18n/collationkeys.cpp14
-rw-r--r--contrib/libs/icu/i18n/collationkeys.h2
-rw-r--r--contrib/libs/icu/i18n/collationroot.cpp2
-rw-r--r--contrib/libs/icu/i18n/collationroot.h2
-rw-r--r--contrib/libs/icu/i18n/collationrootelements.cpp2
-rw-r--r--contrib/libs/icu/i18n/collationrootelements.h2
-rw-r--r--contrib/libs/icu/i18n/collationruleparser.cpp10
-rw-r--r--contrib/libs/icu/i18n/collationruleparser.h2
-rw-r--r--contrib/libs/icu/i18n/collationsets.cpp2
-rw-r--r--contrib/libs/icu/i18n/collationsets.h2
-rw-r--r--contrib/libs/icu/i18n/collationsettings.cpp2
-rw-r--r--contrib/libs/icu/i18n/collationsettings.h2
-rw-r--r--contrib/libs/icu/i18n/collationtailoring.cpp2
-rw-r--r--contrib/libs/icu/i18n/collationtailoring.h4
-rw-r--r--contrib/libs/icu/i18n/collationweights.cpp6
-rw-r--r--contrib/libs/icu/i18n/collationweights.h4
-rw-r--r--contrib/libs/icu/i18n/collunsafe.h2
-rw-r--r--contrib/libs/icu/i18n/compactdecimalformat.cpp80
-rw-r--r--contrib/libs/icu/i18n/coptccal.cpp4
-rw-r--r--contrib/libs/icu/i18n/coptccal.h4
-rw-r--r--contrib/libs/icu/i18n/cpdtrans.cpp4
-rw-r--r--contrib/libs/icu/i18n/cpdtrans.h4
-rw-r--r--contrib/libs/icu/i18n/csdetect.cpp8
-rw-r--r--contrib/libs/icu/i18n/csdetect.h2
-rw-r--r--contrib/libs/icu/i18n/csmatch.cpp2
-rw-r--r--contrib/libs/icu/i18n/csmatch.h2
-rw-r--r--contrib/libs/icu/i18n/csr2022.cpp2
-rw-r--r--contrib/libs/icu/i18n/csr2022.h2
-rw-r--r--contrib/libs/icu/i18n/csrecog.cpp2
-rw-r--r--contrib/libs/icu/i18n/csrecog.h2
-rw-r--r--contrib/libs/icu/i18n/csrmbcs.cpp4
-rw-r--r--contrib/libs/icu/i18n/csrmbcs.h2
-rw-r--r--contrib/libs/icu/i18n/csrsbcs.cpp2
-rw-r--r--contrib/libs/icu/i18n/csrsbcs.h2
-rw-r--r--contrib/libs/icu/i18n/csrucode.cpp2
-rw-r--r--contrib/libs/icu/i18n/csrucode.h2
-rw-r--r--contrib/libs/icu/i18n/csrutf8.cpp2
-rw-r--r--contrib/libs/icu/i18n/csrutf8.h2
-rw-r--r--contrib/libs/icu/i18n/curramt.cpp8
-rw-r--r--contrib/libs/icu/i18n/currfmt.cpp12
-rw-r--r--contrib/libs/icu/i18n/currfmt.h4
-rw-r--r--contrib/libs/icu/i18n/currpinf.cpp324
-rw-r--r--contrib/libs/icu/i18n/currunit.cpp158
-rw-r--r--contrib/libs/icu/i18n/dangical.cpp4
-rw-r--r--contrib/libs/icu/i18n/dangical.h4
-rw-r--r--contrib/libs/icu/i18n/datefmt.cpp26
-rw-r--r--contrib/libs/icu/i18n/dayperiodrules.cpp6
-rw-r--r--contrib/libs/icu/i18n/dayperiodrules.h2
-rw-r--r--contrib/libs/icu/i18n/dcfmtsym.cpp188
-rw-r--r--contrib/libs/icu/i18n/decContext.cpp864
-rw-r--r--contrib/libs/icu/i18n/decContext.h2
-rw-r--r--contrib/libs/icu/i18n/decNumber.cpp16380
-rw-r--r--contrib/libs/icu/i18n/decNumber.h2
-rw-r--r--contrib/libs/icu/i18n/decNumberLocal.h18
-rw-r--r--contrib/libs/icu/i18n/decimfmt.cpp3328
-rw-r--r--contrib/libs/icu/i18n/double-conversion-bignum-dtoa.cpp1318
-rw-r--r--contrib/libs/icu/i18n/double-conversion-bignum-dtoa.h204
-rw-r--r--contrib/libs/icu/i18n/double-conversion-bignum.cpp1628
-rw-r--r--contrib/libs/icu/i18n/double-conversion-bignum.h340
-rw-r--r--contrib/libs/icu/i18n/double-conversion-cached-powers.cpp386
-rw-r--r--contrib/libs/icu/i18n/double-conversion-cached-powers.h164
-rw-r--r--contrib/libs/icu/i18n/double-conversion-diy-fp.h310
-rw-r--r--contrib/libs/icu/i18n/double-conversion-double-to-string.cpp900
-rw-r--r--contrib/libs/icu/i18n/double-conversion-double-to-string.h838
-rw-r--r--contrib/libs/icu/i18n/double-conversion-fast-dtoa.cpp1366
-rw-r--r--contrib/libs/icu/i18n/double-conversion-fast-dtoa.h212
-rw-r--r--contrib/libs/icu/i18n/double-conversion-ieee.h880
-rw-r--r--contrib/libs/icu/i18n/double-conversion-string-to-double.cpp1578
-rw-r--r--contrib/libs/icu/i18n/double-conversion-string-to-double.h488
-rw-r--r--contrib/libs/icu/i18n/double-conversion-strtod.cpp1252
-rw-r--r--contrib/libs/icu/i18n/double-conversion-strtod.h136
-rw-r--r--contrib/libs/icu/i18n/double-conversion-utils.h778
-rw-r--r--contrib/libs/icu/i18n/double-conversion.h92
-rw-r--r--contrib/libs/icu/i18n/dt_impl.h2
-rw-r--r--contrib/libs/icu/i18n/dtfmtsym.cpp96
-rw-r--r--contrib/libs/icu/i18n/dtitv_impl.h4
-rw-r--r--contrib/libs/icu/i18n/dtitvfmt.cpp550
-rw-r--r--contrib/libs/icu/i18n/dtitvinf.cpp144
-rw-r--r--contrib/libs/icu/i18n/dtptngen.cpp1786
-rw-r--r--contrib/libs/icu/i18n/dtptngen_impl.h64
-rw-r--r--contrib/libs/icu/i18n/dtrule.cpp2
-rw-r--r--contrib/libs/icu/i18n/erarules.cpp652
-rw-r--r--contrib/libs/icu/i18n/erarules.h198
-rw-r--r--contrib/libs/icu/i18n/esctrn.cpp4
-rw-r--r--contrib/libs/icu/i18n/esctrn.h4
-rw-r--r--contrib/libs/icu/i18n/ethpccal.cpp4
-rw-r--r--contrib/libs/icu/i18n/ethpccal.h4
-rw-r--r--contrib/libs/icu/i18n/fmtable.cpp162
-rw-r--r--contrib/libs/icu/i18n/fmtable_cnv.cpp2
-rw-r--r--contrib/libs/icu/i18n/fmtableimp.h10
-rw-r--r--contrib/libs/icu/i18n/format.cpp2
-rw-r--r--contrib/libs/icu/i18n/formatted_string_builder.cpp884
-rw-r--r--contrib/libs/icu/i18n/formatted_string_builder.h542
-rw-r--r--contrib/libs/icu/i18n/formattedval_impl.h552
-rw-r--r--contrib/libs/icu/i18n/formattedval_iterimpl.cpp352
-rw-r--r--contrib/libs/icu/i18n/formattedval_sbimpl.cpp414
-rw-r--r--contrib/libs/icu/i18n/formattedvalue.cpp464
-rw-r--r--contrib/libs/icu/i18n/fphdlimp.cpp44
-rw-r--r--contrib/libs/icu/i18n/fphdlimp.h96
-rw-r--r--contrib/libs/icu/i18n/fpositer.cpp10
-rw-r--r--contrib/libs/icu/i18n/funcrepl.cpp4
-rw-r--r--contrib/libs/icu/i18n/funcrepl.h4
-rw-r--r--contrib/libs/icu/i18n/gender.cpp8
-rw-r--r--contrib/libs/icu/i18n/gregocal.cpp40
-rw-r--r--contrib/libs/icu/i18n/gregoimp.cpp12
-rw-r--r--contrib/libs/icu/i18n/gregoimp.h28
-rw-r--r--contrib/libs/icu/i18n/hebrwcal.cpp4
-rw-r--r--contrib/libs/icu/i18n/hebrwcal.h4
-rw-r--r--contrib/libs/icu/i18n/indiancal.cpp72
-rw-r--r--contrib/libs/icu/i18n/indiancal.h10
-rw-r--r--contrib/libs/icu/i18n/inputext.cpp2
-rw-r--r--contrib/libs/icu/i18n/inputext.h2
-rw-r--r--contrib/libs/icu/i18n/islamcal.cpp12
-rw-r--r--contrib/libs/icu/i18n/islamcal.h4
-rw-r--r--contrib/libs/icu/i18n/japancal.cpp266
-rw-r--r--contrib/libs/icu/i18n/japancal.h42
-rw-r--r--contrib/libs/icu/i18n/listformatter.cpp1616
-rw-r--r--contrib/libs/icu/i18n/measfmt.cpp376
-rw-r--r--contrib/libs/icu/i18n/measunit.cpp2510
-rw-r--r--contrib/libs/icu/i18n/measunit_extra.cpp1786
-rw-r--r--contrib/libs/icu/i18n/measunit_impl.h424
-rw-r--r--contrib/libs/icu/i18n/measure.cpp6
-rw-r--r--contrib/libs/icu/i18n/msgfmt.cpp126
-rw-r--r--contrib/libs/icu/i18n/msgfmt_impl.h2
-rw-r--r--contrib/libs/icu/i18n/name2uni.cpp6
-rw-r--r--contrib/libs/icu/i18n/name2uni.h4
-rw-r--r--contrib/libs/icu/i18n/nfrlist.h4
-rw-r--r--contrib/libs/icu/i18n/nfrs.cpp50
-rw-r--r--contrib/libs/icu/i18n/nfrs.h12
-rw-r--r--contrib/libs/icu/i18n/nfrule.cpp144
-rw-r--r--contrib/libs/icu/i18n/nfrule.h12
-rw-r--r--contrib/libs/icu/i18n/nfsubs.cpp164
-rw-r--r--contrib/libs/icu/i18n/nfsubs.h8
-rw-r--r--contrib/libs/icu/i18n/nortrans.cpp4
-rw-r--r--contrib/libs/icu/i18n/nortrans.h4
-rw-r--r--contrib/libs/icu/i18n/nounit.cpp84
-rw-r--r--contrib/libs/icu/i18n/nultrans.cpp4
-rw-r--r--contrib/libs/icu/i18n/nultrans.h4
-rw-r--r--contrib/libs/icu/i18n/number_affixutils.cpp880
-rw-r--r--contrib/libs/icu/i18n/number_affixutils.h488
-rw-r--r--contrib/libs/icu/i18n/number_asformat.cpp234
-rw-r--r--contrib/libs/icu/i18n/number_asformat.h214
-rw-r--r--contrib/libs/icu/i18n/number_capi.cpp468
-rw-r--r--contrib/libs/icu/i18n/number_compact.cpp670
-rw-r--r--contrib/libs/icu/i18n/number_compact.h194
-rw-r--r--contrib/libs/icu/i18n/number_currencysymbols.cpp242
-rw-r--r--contrib/libs/icu/i18n/number_currencysymbols.h130
-rw-r--r--contrib/libs/icu/i18n/number_decimalquantity.cpp2694
-rw-r--r--contrib/libs/icu/i18n/number_decimalquantity.h1052
-rw-r--r--contrib/libs/icu/i18n/number_decimfmtprops.cpp304
-rw-r--r--contrib/libs/icu/i18n/number_decimfmtprops.h348
-rw-r--r--contrib/libs/icu/i18n/number_decnum.h158
-rw-r--r--contrib/libs/icu/i18n/number_fluent.cpp1536
-rw-r--r--contrib/libs/icu/i18n/number_formatimpl.cpp1072
-rw-r--r--contrib/libs/icu/i18n/number_formatimpl.h308
-rw-r--r--contrib/libs/icu/i18n/number_grouping.cpp218
-rw-r--r--contrib/libs/icu/i18n/number_integerwidth.cpp136
-rw-r--r--contrib/libs/icu/i18n/number_longnames.cpp700
-rw-r--r--contrib/libs/icu/i18n/number_longnames.h140
-rw-r--r--contrib/libs/icu/i18n/number_mapper.cpp1016
-rw-r--r--contrib/libs/icu/i18n/number_mapper.h502
-rw-r--r--contrib/libs/icu/i18n/number_microprops.h166
-rw-r--r--contrib/libs/icu/i18n/number_modifiers.cpp970
-rw-r--r--contrib/libs/icu/i18n/number_modifiers.h676
-rw-r--r--contrib/libs/icu/i18n/number_multiplier.cpp318
-rw-r--r--contrib/libs/icu/i18n/number_multiplier.h114
-rw-r--r--contrib/libs/icu/i18n/number_notation.cpp176
-rw-r--r--contrib/libs/icu/i18n/number_output.cpp94
-rw-r--r--contrib/libs/icu/i18n/number_padding.cpp192
-rw-r--r--contrib/libs/icu/i18n/number_patternmodifier.cpp660
-rw-r--r--contrib/libs/icu/i18n/number_patternmodifier.h508
-rw-r--r--contrib/libs/icu/i18n/number_patternstring.cpp2240
-rw-r--r--contrib/libs/icu/i18n/number_patternstring.h658
-rw-r--r--contrib/libs/icu/i18n/number_rounding.cpp882
-rw-r--r--contrib/libs/icu/i18n/number_roundingutils.h398
-rw-r--r--contrib/libs/icu/i18n/number_scientific.cpp354
-rw-r--r--contrib/libs/icu/i18n/number_scientific.h136
-rw-r--r--contrib/libs/icu/i18n/number_skeletons.cpp3462
-rw-r--r--contrib/libs/icu/i18n/number_skeletons.h704
-rw-r--r--contrib/libs/icu/i18n/number_types.h732
-rw-r--r--contrib/libs/icu/i18n/number_utils.cpp532
-rw-r--r--contrib/libs/icu/i18n/number_utils.h224
-rw-r--r--contrib/libs/icu/i18n/number_utypes.h100
-rw-r--r--contrib/libs/icu/i18n/numfmt.cpp216
-rw-r--r--contrib/libs/icu/i18n/numparse_affixes.cpp946
-rw-r--r--contrib/libs/icu/i18n/numparse_affixes.h450
-rw-r--r--contrib/libs/icu/i18n/numparse_compositions.cpp216
-rw-r--r--contrib/libs/icu/i18n/numparse_compositions.h248
-rw-r--r--contrib/libs/icu/i18n/numparse_currency.cpp378
-rw-r--r--contrib/libs/icu/i18n/numparse_currency.h148
-rw-r--r--contrib/libs/icu/i18n/numparse_decimal.cpp918
-rw-r--r--contrib/libs/icu/i18n/numparse_decimal.h152
-rw-r--r--contrib/libs/icu/i18n/numparse_impl.cpp730
-rw-r--r--contrib/libs/icu/i18n/numparse_impl.h222
-rw-r--r--contrib/libs/icu/i18n/numparse_parsednumber.cpp252
-rw-r--r--contrib/libs/icu/i18n/numparse_scientific.cpp326
-rw-r--r--contrib/libs/icu/i18n/numparse_scientific.h94
-rw-r--r--contrib/libs/icu/i18n/numparse_symbols.cpp396
-rw-r--r--contrib/libs/icu/i18n/numparse_symbols.h346
-rw-r--r--contrib/libs/icu/i18n/numparse_types.h542
-rw-r--r--contrib/libs/icu/i18n/numparse_utils.h86
-rw-r--r--contrib/libs/icu/i18n/numparse_validators.cpp170
-rw-r--r--contrib/libs/icu/i18n/numparse_validators.h190
-rw-r--r--contrib/libs/icu/i18n/numrange_fluent.cpp804
-rw-r--r--contrib/libs/icu/i18n/numrange_impl.cpp1016
-rw-r--r--contrib/libs/icu/i18n/numrange_impl.h226
-rw-r--r--contrib/libs/icu/i18n/numsys.cpp258
-rw-r--r--contrib/libs/icu/i18n/numsys_impl.h12
-rw-r--r--contrib/libs/icu/i18n/olsontz.cpp48
-rw-r--r--contrib/libs/icu/i18n/olsontz.h6
-rw-r--r--contrib/libs/icu/i18n/persncal.cpp6
-rw-r--r--contrib/libs/icu/i18n/persncal.h4
-rw-r--r--contrib/libs/icu/i18n/plurfmt.cpp70
-rw-r--r--contrib/libs/icu/i18n/plurrule.cpp736
-rw-r--r--contrib/libs/icu/i18n/plurrule_impl.h384
-rw-r--r--contrib/libs/icu/i18n/quant.cpp4
-rw-r--r--contrib/libs/icu/i18n/quant.h4
-rw-r--r--contrib/libs/icu/i18n/quantityformatter.cpp92
-rw-r--r--contrib/libs/icu/i18n/quantityformatter.h50
-rw-r--r--contrib/libs/icu/i18n/rbnf.cpp524
-rw-r--r--contrib/libs/icu/i18n/rbt.cpp10
-rw-r--r--contrib/libs/icu/i18n/rbt.h12
-rw-r--r--contrib/libs/icu/i18n/rbt_data.cpp2
-rw-r--r--contrib/libs/icu/i18n/rbt_data.h2
-rw-r--r--contrib/libs/icu/i18n/rbt_pars.cpp16
-rw-r--r--contrib/libs/icu/i18n/rbt_pars.h2
-rw-r--r--contrib/libs/icu/i18n/rbt_rule.cpp8
-rw-r--r--contrib/libs/icu/i18n/rbt_rule.h2
-rw-r--r--contrib/libs/icu/i18n/rbt_set.cpp2
-rw-r--r--contrib/libs/icu/i18n/rbt_set.h2
-rw-r--r--contrib/libs/icu/i18n/rbtz.cpp8
-rw-r--r--contrib/libs/icu/i18n/regexcmp.cpp612
-rw-r--r--contrib/libs/icu/i18n/regexcmp.h2
-rw-r--r--contrib/libs/icu/i18n/regexcst.h202
-rw-r--r--contrib/libs/icu/i18n/regeximp.cpp10
-rw-r--r--contrib/libs/icu/i18n/regeximp.h4
-rw-r--r--contrib/libs/icu/i18n/regexst.cpp136
-rw-r--r--contrib/libs/icu/i18n/regexst.h20
-rw-r--r--contrib/libs/icu/i18n/regextxt.cpp2
-rw-r--r--contrib/libs/icu/i18n/regextxt.h2
-rw-r--r--contrib/libs/icu/i18n/region.cpp94
-rw-r--r--contrib/libs/icu/i18n/region_impl.h2
-rw-r--r--contrib/libs/icu/i18n/reldatefmt.cpp878
-rw-r--r--contrib/libs/icu/i18n/reldtfmt.cpp14
-rw-r--r--contrib/libs/icu/i18n/reldtfmt.h4
-rw-r--r--contrib/libs/icu/i18n/rematch.cpp486
-rw-r--r--contrib/libs/icu/i18n/remtrans.cpp8
-rw-r--r--contrib/libs/icu/i18n/remtrans.h4
-rw-r--r--contrib/libs/icu/i18n/repattrn.cpp86
-rw-r--r--contrib/libs/icu/i18n/rulebasedcollator.cpp26
-rw-r--r--contrib/libs/icu/i18n/scientificnumberformatter.cpp18
-rw-r--r--contrib/libs/icu/i18n/scriptset.cpp24
-rw-r--r--contrib/libs/icu/i18n/scriptset.h10
-rw-r--r--contrib/libs/icu/i18n/search.cpp2
-rw-r--r--contrib/libs/icu/i18n/selfmt.cpp4
-rw-r--r--contrib/libs/icu/i18n/selfmtimpl.h2
-rw-r--r--contrib/libs/icu/i18n/sharedbreakiterator.cpp2
-rw-r--r--contrib/libs/icu/i18n/sharedbreakiterator.h2
-rw-r--r--contrib/libs/icu/i18n/sharedcalendar.h2
-rw-r--r--contrib/libs/icu/i18n/shareddateformatsymbols.h12
-rw-r--r--contrib/libs/icu/i18n/sharednumberformat.h2
-rw-r--r--contrib/libs/icu/i18n/sharedpluralrules.h2
-rw-r--r--contrib/libs/icu/i18n/simpletz.cpp34
-rw-r--r--contrib/libs/icu/i18n/smpdtfmt.cpp714
-rw-r--r--contrib/libs/icu/i18n/smpdtfst.cpp2
-rw-r--r--contrib/libs/icu/i18n/smpdtfst.h4
-rw-r--r--contrib/libs/icu/i18n/sortkey.cpp2
-rw-r--r--contrib/libs/icu/i18n/standardplural.cpp2
-rw-r--r--contrib/libs/icu/i18n/standardplural.h2
-rw-r--r--contrib/libs/icu/i18n/string_segment.cpp290
-rw-r--r--contrib/libs/icu/i18n/string_segment.h268
-rw-r--r--contrib/libs/icu/i18n/strmatch.cpp4
-rw-r--r--contrib/libs/icu/i18n/strmatch.h4
-rw-r--r--contrib/libs/icu/i18n/strrepl.cpp4
-rw-r--r--contrib/libs/icu/i18n/strrepl.h4
-rw-r--r--contrib/libs/icu/i18n/stsearch.cpp4
-rw-r--r--contrib/libs/icu/i18n/taiwncal.cpp4
-rw-r--r--contrib/libs/icu/i18n/taiwncal.h4
-rw-r--r--contrib/libs/icu/i18n/timezone.cpp186
-rw-r--r--contrib/libs/icu/i18n/titletrn.cpp14
-rw-r--r--contrib/libs/icu/i18n/titletrn.h4
-rw-r--r--contrib/libs/icu/i18n/tmunit.cpp6
-rw-r--r--contrib/libs/icu/i18n/tmutamt.cpp4
-rw-r--r--contrib/libs/icu/i18n/tmutfmt.cpp14
-rw-r--r--contrib/libs/icu/i18n/tolowtrn.cpp4
-rw-r--r--contrib/libs/icu/i18n/tolowtrn.h4
-rw-r--r--contrib/libs/icu/i18n/toupptrn.cpp4
-rw-r--r--contrib/libs/icu/i18n/toupptrn.h4
-rw-r--r--contrib/libs/icu/i18n/translit.cpp72
-rw-r--r--contrib/libs/icu/i18n/transreg.cpp216
-rw-r--r--contrib/libs/icu/i18n/transreg.h14
-rw-r--r--contrib/libs/icu/i18n/tridpars.cpp6
-rw-r--r--contrib/libs/icu/i18n/tridpars.h2
-rw-r--r--contrib/libs/icu/i18n/tzfmt.cpp110
-rw-r--r--contrib/libs/icu/i18n/tzgnames.cpp38
-rw-r--r--contrib/libs/icu/i18n/tzgnames.h4
-rw-r--r--contrib/libs/icu/i18n/tznames.cpp12
-rw-r--r--contrib/libs/icu/i18n/tznames_impl.cpp96
-rw-r--r--contrib/libs/icu/i18n/tznames_impl.h16
-rw-r--r--contrib/libs/icu/i18n/tzrule.cpp4
-rw-r--r--contrib/libs/icu/i18n/tztrans.cpp2
-rw-r--r--contrib/libs/icu/i18n/ucal.cpp80
-rw-r--r--contrib/libs/icu/i18n/ucln_in.cpp4
-rw-r--r--contrib/libs/icu/i18n/ucln_in.h16
-rw-r--r--contrib/libs/icu/i18n/ucol.cpp6
-rw-r--r--contrib/libs/icu/i18n/ucol_imp.h4
-rw-r--r--contrib/libs/icu/i18n/ucol_res.cpp36
-rw-r--r--contrib/libs/icu/i18n/ucol_sit.cpp152
-rw-r--r--contrib/libs/icu/i18n/ucoleitr.cpp2
-rw-r--r--contrib/libs/icu/i18n/ucsdet.cpp2
-rw-r--r--contrib/libs/icu/i18n/udat.cpp16
-rw-r--r--contrib/libs/icu/i18n/udateintervalformat.cpp96
-rw-r--r--contrib/libs/icu/i18n/udatpg.cpp52
-rw-r--r--contrib/libs/icu/i18n/ufieldpositer.cpp2
-rw-r--r--contrib/libs/icu/i18n/uitercollationiterator.cpp2
-rw-r--r--contrib/libs/icu/i18n/uitercollationiterator.h2
-rw-r--r--contrib/libs/icu/i18n/ulistformatter.cpp320
-rw-r--r--contrib/libs/icu/i18n/ulocdata.cpp772
-rw-r--r--contrib/libs/icu/i18n/umsg.cpp14
-rw-r--r--contrib/libs/icu/i18n/umsg_imp.h4
-rw-r--r--contrib/libs/icu/i18n/unesctrn.cpp4
-rw-r--r--contrib/libs/icu/i18n/unesctrn.h4
-rw-r--r--contrib/libs/icu/i18n/uni2name.cpp4
-rw-r--r--contrib/libs/icu/i18n/uni2name.h4
-rw-r--r--contrib/libs/icu/i18n/unum.cpp216
-rw-r--r--contrib/libs/icu/i18n/unumsys.cpp2
-rw-r--r--contrib/libs/icu/i18n/upluralrules.cpp210
-rw-r--r--contrib/libs/icu/i18n/uregex.cpp22
-rw-r--r--contrib/libs/icu/i18n/uregexc.cpp2
-rw-r--r--contrib/libs/icu/i18n/uregion.cpp2
-rw-r--r--contrib/libs/icu/i18n/usearch.cpp34
-rw-r--r--contrib/libs/icu/i18n/uspoof.cpp282
-rw-r--r--contrib/libs/icu/i18n/uspoof_build.cpp46
-rw-r--r--contrib/libs/icu/i18n/uspoof_conf.cpp72
-rw-r--r--contrib/libs/icu/i18n/uspoof_conf.h8
-rw-r--r--contrib/libs/icu/i18n/uspoof_impl.cpp118
-rw-r--r--contrib/libs/icu/i18n/uspoof_impl.h22
-rw-r--r--contrib/libs/icu/i18n/usrchimp.h2
-rw-r--r--contrib/libs/icu/i18n/utf16collationiterator.cpp2
-rw-r--r--contrib/libs/icu/i18n/utf16collationiterator.h2
-rw-r--r--contrib/libs/icu/i18n/utf8collationiterator.cpp68
-rw-r--r--contrib/libs/icu/i18n/utf8collationiterator.h2
-rw-r--r--contrib/libs/icu/i18n/utmscale.cpp232
-rw-r--r--contrib/libs/icu/i18n/utrans.cpp12
-rw-r--r--contrib/libs/icu/i18n/vtzone.cpp380
-rw-r--r--contrib/libs/icu/i18n/vzone.cpp2
-rw-r--r--contrib/libs/icu/i18n/vzone.h2
-rw-r--r--contrib/libs/icu/i18n/windtfmt.cpp214
-rw-r--r--contrib/libs/icu/i18n/windtfmt.h14
-rw-r--r--contrib/libs/icu/i18n/winnmfmt.cpp278
-rw-r--r--contrib/libs/icu/i18n/winnmfmt.h8
-rw-r--r--contrib/libs/icu/i18n/wintzimpl.cpp36
-rw-r--r--contrib/libs/icu/i18n/wintzimpl.h6
-rw-r--r--contrib/libs/icu/i18n/zonemeta.cpp46
-rw-r--r--contrib/libs/icu/i18n/zonemeta.h12
-rw-r--r--contrib/libs/icu/i18n/zrule.cpp2
-rw-r--r--contrib/libs/icu/i18n/zrule.h2
-rw-r--r--contrib/libs/icu/i18n/ztrans.cpp2
-rw-r--r--contrib/libs/icu/i18n/ztrans.h2
-rw-r--r--contrib/libs/icu/icu4c.css1030
-rw-r--r--contrib/libs/icu/include/unicode/alphaindex.h34
-rw-r--r--contrib/libs/icu/include/unicode/appendable.h60
-rw-r--r--contrib/libs/icu/include/unicode/basictz.h38
-rw-r--r--contrib/libs/icu/include/unicode/brkiter.h66
-rw-r--r--contrib/libs/icu/include/unicode/bytestream.h126
-rw-r--r--contrib/libs/icu/include/unicode/bytestrie.h98
-rw-r--r--contrib/libs/icu/include/unicode/bytestriebuilder.h20
-rw-r--r--contrib/libs/icu/include/unicode/calendar.h210
-rw-r--r--contrib/libs/icu/include/unicode/caniter.h18
-rw-r--r--contrib/libs/icu/include/unicode/casemap.h994
-rw-r--r--contrib/libs/icu/include/unicode/char16ptr.h626
-rw-r--r--contrib/libs/icu/include/unicode/chariter.h58
-rw-r--r--contrib/libs/icu/include/unicode/choicfmt.h16
-rw-r--r--contrib/libs/icu/include/unicode/coleitr.h12
-rw-r--r--contrib/libs/icu/include/unicode/coll.h92
-rw-r--r--contrib/libs/icu/include/unicode/compactdecimalformat.h74
-rw-r--r--contrib/libs/icu/include/unicode/curramt.h22
-rw-r--r--contrib/libs/icu/include/unicode/currpinf.h34
-rw-r--r--contrib/libs/icu/include/unicode/currunit.h86
-rw-r--r--contrib/libs/icu/include/unicode/datefmt.h40
-rw-r--r--contrib/libs/icu/include/unicode/dbbi.h14
-rw-r--r--contrib/libs/icu/include/unicode/dcfmtsym.h224
-rw-r--r--contrib/libs/icu/include/unicode/decimfmt.h810
-rw-r--r--contrib/libs/icu/include/unicode/docmain.h50
-rw-r--r--contrib/libs/icu/include/unicode/dtfmtsym.h22
-rw-r--r--contrib/libs/icu/include/unicode/dtintrv.h20
-rw-r--r--contrib/libs/icu/include/unicode/dtitvfmt.h292
-rw-r--r--contrib/libs/icu/include/unicode/dtitvinf.h26
-rw-r--r--contrib/libs/icu/include/unicode/dtptngen.h160
-rw-r--r--contrib/libs/icu/include/unicode/dtrule.h12
-rw-r--r--contrib/libs/icu/include/unicode/edits.h1062
-rw-r--r--contrib/libs/icu/include/unicode/enumset.h8
-rw-r--r--contrib/libs/icu/include/unicode/errorcode.h14
-rw-r--r--contrib/libs/icu/include/unicode/fieldpos.h10
-rw-r--r--contrib/libs/icu/include/unicode/filteredbrk.h78
-rw-r--r--contrib/libs/icu/include/unicode/fmtable.h38
-rw-r--r--contrib/libs/icu/include/unicode/format.h10
-rw-r--r--contrib/libs/icu/include/unicode/formattedvalue.h634
-rw-r--r--contrib/libs/icu/include/unicode/fpositer.h16
-rw-r--r--contrib/libs/icu/include/unicode/gender.h22
-rw-r--r--contrib/libs/icu/include/unicode/gregocal.h16
-rw-r--r--contrib/libs/icu/include/unicode/icudataver.h2
-rw-r--r--contrib/libs/icu/include/unicode/icuplug.h4
-rw-r--r--contrib/libs/icu/include/unicode/idna.h14
-rw-r--r--contrib/libs/icu/include/unicode/listformatter.h602
-rw-r--r--contrib/libs/icu/include/unicode/localebuilder.h624
-rw-r--r--contrib/libs/icu/include/unicode/localematcher.h1330
-rw-r--r--contrib/libs/icu/include/unicode/localpointer.h216
-rw-r--r--contrib/libs/icu/include/unicode/locdspnm.h14
-rw-r--r--contrib/libs/icu/include/unicode/locid.h942
-rw-r--r--contrib/libs/icu/include/unicode/measfmt.h74
-rw-r--r--contrib/libs/icu/include/unicode/measunit.h4478
-rw-r--r--contrib/libs/icu/include/unicode/measure.h14
-rw-r--r--contrib/libs/icu/include/unicode/messagepattern.h16
-rw-r--r--contrib/libs/icu/include/unicode/msgfmt.h76
-rw-r--r--contrib/libs/icu/include/unicode/normalizer2.h278
-rw-r--r--contrib/libs/icu/include/unicode/normlzr.h28
-rw-r--r--contrib/libs/icu/include/unicode/nounit.h232
-rw-r--r--contrib/libs/icu/include/unicode/numberformatter.h5284
-rw-r--r--contrib/libs/icu/include/unicode/numberrangeformatter.h1732
-rw-r--r--contrib/libs/icu/include/unicode/numfmt.h218
-rw-r--r--contrib/libs/icu/include/unicode/numsys.h54
-rw-r--r--contrib/libs/icu/include/unicode/parseerr.h6
-rw-r--r--contrib/libs/icu/include/unicode/parsepos.h26
-rw-r--r--contrib/libs/icu/include/unicode/platform.h230
-rw-r--r--contrib/libs/icu/include/unicode/plurfmt.h20
-rw-r--r--contrib/libs/icu/include/unicode/plurrule.h88
-rw-r--r--contrib/libs/icu/include/unicode/ptypes.h6
-rw-r--r--contrib/libs/icu/include/unicode/putil.h8
-rw-r--r--contrib/libs/icu/include/unicode/rbbi.h250
-rw-r--r--contrib/libs/icu/include/unicode/rbnf.h98
-rw-r--r--contrib/libs/icu/include/unicode/rbtz.h16
-rw-r--r--contrib/libs/icu/include/unicode/regex.h274
-rw-r--r--contrib/libs/icu/include/unicode/region.h16
-rw-r--r--contrib/libs/icu/include/unicode/reldatefmt.h476
-rw-r--r--contrib/libs/icu/include/unicode/rep.h20
-rw-r--r--contrib/libs/icu/include/unicode/resbund.h18
-rw-r--r--contrib/libs/icu/include/unicode/schriter.h20
-rw-r--r--contrib/libs/icu/include/unicode/scientificnumberformatter.h16
-rw-r--r--contrib/libs/icu/include/unicode/search.h12
-rw-r--r--contrib/libs/icu/include/unicode/selfmt.h16
-rw-r--r--contrib/libs/icu/include/unicode/simpleformatter.h138
-rw-r--r--contrib/libs/icu/include/unicode/simpletz.h24
-rw-r--r--contrib/libs/icu/include/unicode/smpdtfmt.h124
-rw-r--r--contrib/libs/icu/include/unicode/sortkey.h10
-rw-r--r--contrib/libs/icu/include/unicode/std_string.h16
-rw-r--r--contrib/libs/icu/include/unicode/strenum.h22
-rw-r--r--contrib/libs/icu/include/unicode/stringoptions.h380
-rw-r--r--contrib/libs/icu/include/unicode/stringpiece.h268
-rw-r--r--contrib/libs/icu/include/unicode/stringtriebuilder.h66
-rw-r--r--contrib/libs/icu/include/unicode/stsearch.h14
-rw-r--r--contrib/libs/icu/include/unicode/symtable.h12
-rw-r--r--contrib/libs/icu/include/unicode/tblcoll.h46
-rw-r--r--contrib/libs/icu/include/unicode/timezone.h74
-rw-r--r--contrib/libs/icu/include/unicode/tmunit.h14
-rw-r--r--contrib/libs/icu/include/unicode/tmutamt.h20
-rw-r--r--contrib/libs/icu/include/unicode/tmutfmt.h14
-rw-r--r--contrib/libs/icu/include/unicode/translit.h554
-rw-r--r--contrib/libs/icu/include/unicode/tzfmt.h26
-rw-r--r--contrib/libs/icu/include/unicode/tznames.h16
-rw-r--r--contrib/libs/icu/include/unicode/tzrule.h18
-rw-r--r--contrib/libs/icu/include/unicode/tztrans.h12
-rw-r--r--contrib/libs/icu/include/unicode/ubidi.h38
-rw-r--r--contrib/libs/icu/include/unicode/ubiditransform.h90
-rw-r--r--contrib/libs/icu/include/unicode/ubrk.h122
-rw-r--r--contrib/libs/icu/include/unicode/ucal.h132
-rw-r--r--contrib/libs/icu/include/unicode/ucasemap.h14
-rw-r--r--contrib/libs/icu/include/unicode/ucat.h2
-rw-r--r--contrib/libs/icu/include/unicode/uchar.h792
-rw-r--r--contrib/libs/icu/include/unicode/ucharstrie.h190
-rw-r--r--contrib/libs/icu/include/unicode/ucharstriebuilder.h34
-rw-r--r--contrib/libs/icu/include/unicode/uchriter.h80
-rw-r--r--contrib/libs/icu/include/unicode/uclean.h30
-rw-r--r--contrib/libs/icu/include/unicode/ucnv.h34
-rw-r--r--contrib/libs/icu/include/unicode/ucnv_cb.h2
-rw-r--r--contrib/libs/icu/include/unicode/ucnv_err.h14
-rw-r--r--contrib/libs/icu/include/unicode/ucnvsel.h2
-rw-r--r--contrib/libs/icu/include/unicode/ucol.h20
-rw-r--r--contrib/libs/icu/include/unicode/ucoleitr.h6
-rw-r--r--contrib/libs/icu/include/unicode/uconfig.h44
-rw-r--r--contrib/libs/icu/include/unicode/ucpmap.h318
-rw-r--r--contrib/libs/icu/include/unicode/ucptrie.h1288
-rw-r--r--contrib/libs/icu/include/unicode/ucsdet.h14
-rw-r--r--contrib/libs/icu/include/unicode/ucurr.h72
-rw-r--r--contrib/libs/icu/include/unicode/udat.h190
-rw-r--r--contrib/libs/icu/include/unicode/udata.h42
-rw-r--r--contrib/libs/icu/include/unicode/udateintervalformat.h240
-rw-r--r--contrib/libs/icu/include/unicode/udatpg.h154
-rw-r--r--contrib/libs/icu/include/unicode/udisplaycontext.h8
-rw-r--r--contrib/libs/icu/include/unicode/uenum.h10
-rw-r--r--contrib/libs/icu/include/unicode/ufieldpositer.h2
-rw-r--r--contrib/libs/icu/include/unicode/uformattable.h4
-rw-r--r--contrib/libs/icu/include/unicode/uformattedvalue.h874
-rw-r--r--contrib/libs/icu/include/unicode/ugender.h6
-rw-r--r--contrib/libs/icu/include/unicode/uidna.h4
-rw-r--r--contrib/libs/icu/include/unicode/uiter.h4
-rw-r--r--contrib/libs/icu/include/unicode/uldnames.h2
-rw-r--r--contrib/libs/icu/include/unicode/ulistformatter.h668
-rw-r--r--contrib/libs/icu/include/unicode/uloc.h278
-rw-r--r--contrib/libs/icu/include/unicode/ulocdata.h10
-rw-r--r--contrib/libs/icu/include/unicode/umachine.h240
-rw-r--r--contrib/libs/icu/include/unicode/umisc.h4
-rw-r--r--contrib/libs/icu/include/unicode/umsg.h4
-rw-r--r--contrib/libs/icu/include/unicode/umutablecptrie.h476
-rw-r--r--contrib/libs/icu/include/unicode/unifilt.h32
-rw-r--r--contrib/libs/icu/include/unicode/unifunct.h12
-rw-r--r--contrib/libs/icu/include/unicode/unimatch.h8
-rw-r--r--contrib/libs/icu/include/unicode/unirepl.h10
-rw-r--r--contrib/libs/icu/include/unicode/uniset.h132
-rw-r--r--contrib/libs/icu/include/unicode/unistr.h1472
-rw-r--r--contrib/libs/icu/include/unicode/unorm.h26
-rw-r--r--contrib/libs/icu/include/unicode/unorm2.h6
-rw-r--r--contrib/libs/icu/include/unicode/unum.h234
-rw-r--r--contrib/libs/icu/include/unicode/unumberformatter.h1410
-rw-r--r--contrib/libs/icu/include/unicode/unumsys.h4
-rw-r--r--contrib/libs/icu/include/unicode/uobject.h46
-rw-r--r--contrib/libs/icu/include/unicode/upluralrules.h168
-rw-r--r--contrib/libs/icu/include/unicode/uregex.h6
-rw-r--r--contrib/libs/icu/include/unicode/uregion.h4
-rw-r--r--contrib/libs/icu/include/unicode/ureldatefmt.h350
-rw-r--r--contrib/libs/icu/include/unicode/urename.h258
-rw-r--r--contrib/libs/icu/include/unicode/urep.h2
-rw-r--r--contrib/libs/icu/include/unicode/ures.h28
-rw-r--r--contrib/libs/icu/include/unicode/uscript.h86
-rw-r--r--contrib/libs/icu/include/unicode/usearch.h30
-rw-r--r--contrib/libs/icu/include/unicode/uset.h18
-rw-r--r--contrib/libs/icu/include/unicode/usetiter.h12
-rw-r--r--contrib/libs/icu/include/unicode/ushape.h6
-rw-r--r--contrib/libs/icu/include/unicode/uspoof.h562
-rw-r--r--contrib/libs/icu/include/unicode/usprep.h14
-rw-r--r--contrib/libs/icu/include/unicode/ustdio.h2
-rw-r--r--contrib/libs/icu/include/unicode/ustream.h16
-rw-r--r--contrib/libs/icu/include/unicode/ustring.h40
-rw-r--r--contrib/libs/icu/include/unicode/ustringtrie.h4
-rw-r--r--contrib/libs/icu/include/unicode/utext.h86
-rw-r--r--contrib/libs/icu/include/unicode/utf.h38
-rw-r--r--contrib/libs/icu/include/unicode/utf16.h312
-rw-r--r--contrib/libs/icu/include/unicode/utf32.h4
-rw-r--r--contrib/libs/icu/include/unicode/utf8.h438
-rw-r--r--contrib/libs/icu/include/unicode/utf_old.h276
-rw-r--r--contrib/libs/icu/include/unicode/utmscale.h16
-rw-r--r--contrib/libs/icu/include/unicode/utrace.h278
-rw-r--r--contrib/libs/icu/include/unicode/utrans.h16
-rw-r--r--contrib/libs/icu/include/unicode/utypes.h76
-rw-r--r--contrib/libs/icu/include/unicode/uvernum.h88
-rw-r--r--contrib/libs/icu/include/unicode/uversion.h36
-rw-r--r--contrib/libs/icu/include/unicode/vtzone.h16
-rw-r--r--contrib/libs/icu/io/locbund.cpp4
-rw-r--r--contrib/libs/icu/io/locbund.h2
-rw-r--r--contrib/libs/icu/io/sprintf.cpp518
-rw-r--r--contrib/libs/icu/io/sscanf.cpp260
-rw-r--r--contrib/libs/icu/io/ucln_io.cpp6
-rw-r--r--contrib/libs/icu/io/ucln_io.h4
-rw-r--r--contrib/libs/icu/io/ufile.cpp686
-rw-r--r--contrib/libs/icu/io/ufile.h6
-rw-r--r--contrib/libs/icu/io/ufmt_cmn.cpp518
-rw-r--r--contrib/libs/icu/io/ufmt_cmn.h4
-rw-r--r--contrib/libs/icu/io/uprintf.cpp4
-rw-r--r--contrib/libs/icu/io/uprintf.h2
-rw-r--r--contrib/libs/icu/io/uprntf_p.cpp3206
-rw-r--r--contrib/libs/icu/io/uscanf.cpp216
-rw-r--r--contrib/libs/icu/io/uscanf.h2
-rw-r--r--contrib/libs/icu/io/uscanf_p.cpp2896
-rw-r--r--contrib/libs/icu/io/ustdio.cpp1462
-rw-r--r--contrib/libs/icu/io/ustream.cpp4
-rw-r--r--contrib/libs/icu/license.html36
-rw-r--r--contrib/libs/icu/readme.html3826
-rw-r--r--contrib/libs/icu/ya.make272
-rw-r--r--contrib/libs/nghttp2/AUTHORS10
-rw-r--r--contrib/libs/nghttp2/lib/includes/nghttp2/nghttp2.h46
-rw-r--r--contrib/libs/nghttp2/lib/nghttp2_helper.c4
-rw-r--r--contrib/libs/nghttp2/lib/nghttp2_option.c10
-rw-r--r--contrib/libs/nghttp2/lib/nghttp2_option.h10
-rw-r--r--contrib/libs/nghttp2/lib/nghttp2_session.c82
-rw-r--r--contrib/libs/nghttp2/lib/nghttp2_session.h68
-rw-r--r--contrib/libs/nghttp2/lib/nghttp2_submit.c28
-rw-r--r--contrib/libs/ya.make4
931 files changed, 142256 insertions, 142256 deletions
diff --git a/contrib/libs/icu/APIChangeReport.html b/contrib/libs/icu/APIChangeReport.html
index 5a61733594..e2921fe877 100644
--- a/contrib/libs/icu/APIChangeReport.html
+++ b/contrib/libs/icu/APIChangeReport.html
@@ -1,2593 +1,2593 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html><!--
- Copyright © 2016 and later: Unicode, Inc. and others.
- License & terms of use: http://www.unicode.org/copyright.html
- -->
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=utf-8">
-<title>ICU4C API Comparison: ICU 66 with ICU 67</title>
-<link type="text/css" href="icu4c.css" rel="stylesheet">
-</head>
-<body>
-<a name="#_top"></a>
-<h1>ICU4C API Comparison: ICU 66 with ICU 67</h1>
-<div id="toc">
-<ul>
-<li>
-<a href="#removed">Removed from ICU 66</a>
-</li>
-<li>
-<a href="#deprecated">Deprecated or Obsoleted in ICU 67</a>
-</li>
-<li>
-<a href="#changed">Changed in ICU 67</a>
-</li>
-<li>
-<a href="#promoted">Promoted to stable in ICU 67</a>
-</li>
-<li>
-<a href="#added">Added in ICU 67</a>
-</li>
-<li>
-<a href="#other">Other existing drafts in ICU 67</a>
-</li>
-<li>
-<a href="#simplifications">Signature Simplifications</a>
-</li>
-</ul>
-<hr>
-</div>
-<a name="removed"></a>
-<h2>Removed from ICU 66</h2>
-<table BORDER="1" class="genTable">
-<THEAD>
-<tr>
-<th>File</th><th>API</th><th>ICU 66</th><th>ICU 67</th>
-</tr>
-</THEAD>
-<tr class="row1">
-<td class="file">listformatter.h</td><td class="proto">UnicodeString&amp; icu::ListFormatter::format(const UnicodeString items[], int32_t, UnicodeString&amp;, FieldPositionIterator*, UErrorCode&amp;) const</td><td class="">Draft<br>ICU 63</td><td>(missing)<br>
-<span class=""><span></span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">numberformatter.h</td><td class="proto">UBool icu::number::FormattedNumber::nextFieldPosition(FieldPosition&amp;, UErrorCode&amp;) const</td><td class="">Draft<br>ICU 62</td><td>(missing)<br>
-<span class=""><span></span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">numberformatter.h</td><td class="proto">void icu::number::FormattedNumber::getAllFieldPositions(FieldPositionIterator&amp;, UErrorCode&amp;) const</td><td class="">Draft<br>ICU 62</td><td>(missing)<br>
-<span class=""><span></span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">numberrangeformatter.h</td><td class="proto">UBool icu::number::FormattedNumberRange::nextFieldPosition(FieldPosition&amp;, UErrorCode&amp;) const</td><td class="">Draft<br>ICU 63</td><td>(missing)<br>
-<span class=""><span></span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">numberrangeformatter.h</td><td class="proto">void icu::number::FormattedNumberRange::getAllFieldPositions(FieldPositionIterator&amp;, UErrorCode&amp;) const</td><td class="">Draft<br>ICU 63</td><td>(missing)<br>
-<span class=""><span></span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">udateintervalformat.h</td><td class="proto">void udtitvfmt_formatToResult(const UDateIntervalFormat*, UFormattedDateInterval*, UDate, UDate, UErrorCode*)</td><td class="">Draft<br>ICU 64</td><td>(missing)<br>
-<span class=""><span></span></span></td>
-</tr>
-</table>
-<P></P>
-<a href="#_top">(jump back to top)</a>
-<hr>
-<a name="deprecated"></a>
-<h2>Deprecated or Obsoleted in ICU 67</h2>
-<table BORDER="1" class="genTable">
-<THEAD>
-<tr>
-<th>File</th><th>API</th><th>ICU 66</th><th>ICU 67</th>
-</tr>
-</THEAD>
-</table>
-<P></P>
-<a href="#_top">(jump back to top)</a>
-<hr>
-<a name="changed"></a>
-<h2>Changed in ICU 67 (old, new)</h2>
-<table BORDER="1" class="genTable">
-<THEAD>
-<tr>
-<th>File</th><th>API</th><th>ICU 66</th><th>ICU 67</th>
-</tr>
-</THEAD>
-<tr class="row1">
-<td class="file">currunit.h</td><td class="proto">icu::CurrencyUnit::CurrencyUnit(StringPiece, UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">decimfmt.h</td><td class="proto">UBool icu::DecimalFormat::isFormatFailIfMoreThanMaxDigits() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">decimfmt.h</td><td class="proto">UBool icu::DecimalFormat::isParseCaseSensitive() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">decimfmt.h</td><td class="proto">UBool icu::DecimalFormat::isParseNoExponent() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">decimfmt.h</td><td class="proto">UBool icu::DecimalFormat::isSignAlwaysShown() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">decimfmt.h</td><td class="proto">const number::LocalizedNumberFormatter* icu::DecimalFormat::toNumberFormatter(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">decimfmt.h</td><td class="proto">int32_t icu::DecimalFormat::getMinimumGroupingDigits() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setFormatFailIfMoreThanMaxDigits(UBool)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setMinimumGroupingDigits(int32_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setParseCaseSensitive(UBool)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setParseNoExponent(UBool)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setSignAlwaysShown(UBool)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">dtitvfmt.h</td><td class="proto">Appendable&amp; icu::FormattedDateInterval::appendTo(Appendable&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">dtitvfmt.h</td><td class="proto">FormattedDateInterval icu::DateIntervalFormat::formatToValue(Calendar&amp;, Calendar&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">dtitvfmt.h</td><td class="proto">FormattedDateInterval icu::DateIntervalFormat::formatToValue(const DateInterval&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">dtitvfmt.h</td><td class="proto">FormattedDateInterval&amp; icu::FormattedDateInterval::operator=(FormattedDateInterval&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">dtitvfmt.h</td><td class="proto">UBool icu::FormattedDateInterval::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">dtitvfmt.h</td><td class="proto">UnicodeString icu::FormattedDateInterval::toString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">dtitvfmt.h</td><td class="proto">UnicodeString icu::FormattedDateInterval::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">dtitvfmt.h</td><td class="proto">icu::FormattedDateInterval::FormattedDateInterval()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">dtitvfmt.h</td><td class="proto">icu::FormattedDateInterval::FormattedDateInterval(FormattedDateInterval&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">dtitvfmt.h</td><td class="proto">icu::FormattedDateInterval::~FormattedDateInterval()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">formattedvalue.h</td><td class="proto">Appendable&amp; icu::FormattedValue::appendTo(Appendable&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">formattedvalue.h</td><td class="proto">UBool icu::ConstrainedFieldPosition::matchesField(int32_t, int32_t) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">formattedvalue.h</td><td class="proto">UBool icu::FormattedValue::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">formattedvalue.h</td><td class="proto">UnicodeString icu::FormattedValue::toString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">formattedvalue.h</td><td class="proto">UnicodeString icu::FormattedValue::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">formattedvalue.h</td><td class="proto">icu::ConstrainedFieldPosition::ConstrainedFieldPosition()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">formattedvalue.h</td><td class="proto">icu::ConstrainedFieldPosition::~ConstrainedFieldPosition()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">formattedvalue.h</td><td class="proto">icu::FormattedValue::~FormattedValue()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">formattedvalue.h</td><td class="proto">int32_t icu::ConstrainedFieldPosition::getCategory() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">formattedvalue.h</td><td class="proto">int32_t icu::ConstrainedFieldPosition::getField() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">formattedvalue.h</td><td class="proto">int32_t icu::ConstrainedFieldPosition::getLimit() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">formattedvalue.h</td><td class="proto">int32_t icu::ConstrainedFieldPosition::getStart() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">formattedvalue.h</td><td class="proto">int64_t icu::ConstrainedFieldPosition::getInt64IterationContext() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::constrainCategory(int32_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::constrainField(int32_t, int32_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::reset()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::setInt64IterationContext(int64_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::setState(int32_t, int32_t, int32_t, int32_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">listformatter.h</td><td class="proto">Appendable&amp; icu::FormattedList::appendTo(Appendable&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">listformatter.h</td><td class="proto">FormattedList icu::ListFormatter::formatStringsToValue(const UnicodeString items[], int32_t, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">listformatter.h</td><td class="proto">FormattedList&amp; icu::FormattedList::operator=(FormattedList&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">listformatter.h</td><td class="proto">UBool icu::FormattedList::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">listformatter.h</td><td class="proto">UnicodeString icu::FormattedList::toString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">listformatter.h</td><td class="proto">UnicodeString icu::FormattedList::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">listformatter.h</td><td class="proto">icu::FormattedList::FormattedList()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">listformatter.h</td><td class="proto">icu::FormattedList::FormattedList(FormattedList&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">listformatter.h</td><td class="proto">icu::FormattedList::~FormattedList()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localebuilder.h</td><td class="proto">Locale icu::LocaleBuilder::build(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::addUnicodeLocaleAttribute(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::clear()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::clearExtensions()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::removeUnicodeLocaleAttribute(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setExtension(char, StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setLanguage(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setLanguageTag(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setLocale(const Locale&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setRegion(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setScript(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setUnicodeLocaleKeyword(StringPiece, StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setVariant(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localebuilder.h</td><td class="proto">icu::LocaleBuilder::LocaleBuilder()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localebuilder.h</td><td class="proto">icu::LocaleBuilder::~LocaleBuilder()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localpointer.h</td><td class="proto">LocalArray&lt;T&gt;&amp; icu::LocalArray&lt; T &gt;::operator=(std::unique_ptr&lt; T[]&gt;&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localpointer.h</td><td class="proto">LocalPointer&lt;T&gt;&amp; icu::LocalPointer&lt; T &gt;::operator=(std::unique_ptr&lt; T &gt;&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localpointer.h</td><td class="proto">icu::LocalArray&lt; T &gt;::LocalArray(std::unique_ptr&lt; T[]&gt;&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localpointer.h</td><td class="proto">icu::LocalArray&lt; T &gt;::operator std::unique_ptr&lt; T[]&gt;() &amp;&amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localpointer.h</td><td class="proto">icu::LocalPointer&lt; T &gt;::LocalPointer(std::unique_ptr&lt; T &gt;&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localpointer.h</td><td class="proto">icu::LocalPointer&lt; T &gt;::operator std::unique_ptr&lt; T &gt;() &amp;&amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAcre()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAcreFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAmpere()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getArcMinute()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getArcSecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAstronomicalUnit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAtmosphere()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getBarrel()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getBit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getBritishThermalUnit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getBushel()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getByte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCalorie()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCarat()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCelsius()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCentiliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCentimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCentury()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicCentimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicInch()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicKilometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicMeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicMile()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicYard()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCup()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCupMetric()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDalton()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDay()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDayPerson()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDeciliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDecimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDegree()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDunam()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getEarthMass()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getElectronvolt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFahrenheit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFathom()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFluidOunce()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFluidOunceImperial()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFoodcalorie()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFurlong()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGForce()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGallon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGallonImperial()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGenericTemperature()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGigabit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGigabyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGigahertz()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGigawatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGram()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHectare()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHectoliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHectopascal()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHertz()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHorsepower()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHour()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getInch()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getInchHg()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getJoule()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKarat()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKelvin()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilobit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilobyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilocalorie()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilogram()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilohertz()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilojoule()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilometerPerHour()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilopascal()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilowatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilowattHour()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKnot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLightYear()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLiter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLiterPer100Kilometers()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLiterPerKilometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLux()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegabit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegabyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegahertz()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegaliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegapascal()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegawatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMeterPerSecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMeterPerSecondSquared()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMetricTon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMicrogram()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMicrometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMicrosecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMile()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilePerGallon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilePerGallonImperial()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilePerHour()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMileScandinavian()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilliampere()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillibar()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilligram()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilligramPerDeciliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilliliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillimeterOfMercury()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillimolePerLiter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillisecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilliwatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMinute()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMole()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMonth()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMonthPerson()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNanometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNanosecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNauticalMile()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNewton()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNewtonMeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getOhm()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getOunce()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getOunceTroy()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getParsec()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPartPerMillion()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPercent()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPermille()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPermyriad()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPetabyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPicometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPint()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPintMetric()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPoint()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPound()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPoundFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPoundForce()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPoundPerSquareInch()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getQuart()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getRadian()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getRevolutionAngle()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSolarLuminosity()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSolarMass()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSolarRadius()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareCentimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareInch()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareKilometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareMeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareMile()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareYard()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getStone()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTablespoon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTeaspoon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTerabit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTerabyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getVolt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getWatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getWeek()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getWeekPerson()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getYard()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getYear()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getYearPerson()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createBarrel(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createBritishThermalUnit(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createDalton(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createDayPerson(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createDunam(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createEarthMass(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createElectronvolt(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createFluidOunceImperial(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createKilopascal(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createMegapascal(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createMole(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createMonthPerson(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createNewton(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createNewtonMeter(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPermyriad(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPoundFoot(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPoundForce(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createSolarLuminosity(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createSolarMass(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createSolarRadius(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createWeekPerson(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createYearPerson(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">numberformatter.h</td><td class="proto">LocalPointer&lt;Derived&gt; icu::number::NumberFormatterSettings&lt; Derived &gt;::clone() &amp;&amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">numberformatter.h</td><td class="proto">LocalPointer&lt;Derived&gt; icu::number::NumberFormatterSettings&lt; Derived &gt;::clone() const &amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">numberformatter.h</td><td class="proto">UBool icu::number::FormattedNumber::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">numberformatter.h</td><td class="proto">UnicodeString icu::number::FormattedNumber::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">numberformatter.h</td><td class="proto">icu::number::FormattedNumber::FormattedNumber()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">numberformatter.h</td><td class="proto"><tt>static</tt> UnlocalizedNumberFormatter icu::number::NumberFormatter::forSkeleton(const UnicodeString&amp;, UParseError&amp;, UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">numberrangeformatter.h</td><td class="proto">LocalPointer&lt;Derived&gt; icu::number::NumberRangeFormatterSettings&lt; Derived &gt;::clone() &amp;&amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">numberrangeformatter.h</td><td class="proto">LocalPointer&lt;Derived&gt; icu::number::NumberRangeFormatterSettings&lt; Derived &gt;::clone() const &amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">numberrangeformatter.h</td><td class="proto">UBool icu::number::FormattedNumberRange::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">numberrangeformatter.h</td><td class="proto">UnicodeString icu::number::FormattedNumberRange::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">numfmt.h</td><td class="proto"><tt>enum</tt> icu::NumberFormat::EAlignmentFields::kCompactField</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">numfmt.h</td><td class="proto"><tt>enum</tt> icu::NumberFormat::EAlignmentFields::kMeasureUnitField</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">plurrule.h</td><td class="proto">UnicodeString icu::PluralRules::select(const number::FormattedNumber&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">reldatefmt.h</td><td class="proto">Appendable&amp; icu::FormattedRelativeDateTime::appendTo(Appendable&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime icu::RelativeDateTimeFormatter::formatNumericToValue(double, URelativeDateTimeUnit, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime icu::RelativeDateTimeFormatter::formatToValue(UDateDirection, UDateAbsoluteUnit, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime icu::RelativeDateTimeFormatter::formatToValue(double, UDateDirection, UDateRelativeUnit, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime icu::RelativeDateTimeFormatter::formatToValue(double, URelativeDateTimeUnit, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime&amp; icu::FormattedRelativeDateTime::operator=(FormattedRelativeDateTime&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">reldatefmt.h</td><td class="proto">UBool icu::FormattedRelativeDateTime::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">reldatefmt.h</td><td class="proto">UnicodeString icu::FormattedRelativeDateTime::toString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">reldatefmt.h</td><td class="proto">UnicodeString icu::FormattedRelativeDateTime::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">reldatefmt.h</td><td class="proto">icu::FormattedRelativeDateTime::FormattedRelativeDateTime()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">reldatefmt.h</td><td class="proto">icu::FormattedRelativeDateTime::FormattedRelativeDateTime(FormattedRelativeDateTime&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">reldatefmt.h</td><td class="proto">icu::FormattedRelativeDateTime::~FormattedRelativeDateTime()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">udateintervalformat.h</td><td class="proto">UFormattedDateInterval* udtitvfmt_openResult(UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">udateintervalformat.h</td><td class="proto">const UFormattedValue* udtitvfmt_resultAsValue(const UFormattedDateInterval*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">udateintervalformat.h</td><td class="proto">void udtitvfmt_closeResult(UFormattedDateInterval*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto">UBool ucfpos_matchesField(const UConstrainedFieldPosition*, int32_t, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto">UBool ufmtval_nextPosition(const UFormattedValue*, UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto">UConstrainedFieldPosition* ucfpos_open(UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto">const UChar* ufmtval_getString(const UFormattedValue*, int32_t*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_DATE_INTERVAL_SPAN</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_DATE</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_LIST_SPAN</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_LIST</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_NUMBER</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_RELATIVE_DATETIME</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_UNDEFINED</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto">int32_t ucfpos_getCategory(const UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto">int32_t ucfpos_getField(const UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto">int64_t ucfpos_getInt64IterationContext(const UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_close(UConstrainedFieldPosition*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_constrainCategory(UConstrainedFieldPosition*, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_constrainField(UConstrainedFieldPosition*, int32_t, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_getIndexes(const UConstrainedFieldPosition*, int32_t*, int32_t*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_reset(UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_setInt64IterationContext(UConstrainedFieldPosition*, int64_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_setState(UConstrainedFieldPosition*, int32_t, int32_t, int32_t, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">ulistformatter.h</td><td class="proto">UFormattedList* ulistfmt_openResult(UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">ulistformatter.h</td><td class="proto">const UFormattedValue* ulistfmt_resultAsValue(const UFormattedList*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterField::ULISTFMT_ELEMENT_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 63</td>
-</tr>
-<tr class="row0">
-<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterField::ULISTFMT_LITERAL_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 63</td>
-</tr>
-<tr class="row1">
-<td class="file">ulistformatter.h</td><td class="proto">void ulistfmt_closeResult(UFormattedList*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">ulistformatter.h</td><td class="proto">void ulistfmt_formatStringsToResult(const UListFormatter*, const UChar* const strings[], const int32_t*, int32_t, UFormattedList*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatAttribute::UNUM_MINIMUM_GROUPING_DIGITS</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatAttribute::UNUM_PARSE_CASE_SENSITIVE</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatAttribute::UNUM_SIGN_ALWAYS_SHOWN</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatFields::UNUM_COMPACT_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatFields::UNUM_MEASURE_UNIT_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">unumberformatter.h</td><td class="proto">UNumberFormatter* unumf_openForSkeletonAndLocaleWithError(const UChar*, int32_t, const char*, UParseError*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">unumberformatter.h</td><td class="proto">const UFormattedValue* unumf_resultAsValue(const UFormattedNumber*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">upluralrules.h</td><td class="proto">int32_t uplrules_selectFormatted(const UPluralRules*, const struct UFormattedNumber*, UChar*, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">ureldatefmt.h</td><td class="proto">UFormattedRelativeDateTime* ureldatefmt_openResult(UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">ureldatefmt.h</td><td class="proto">const UFormattedValue* ureldatefmt_resultAsValue(const UFormattedRelativeDateTime*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">ureldatefmt.h</td><td class="proto"><tt>enum</tt> URelativeDateTimeFormatterField::UDAT_REL_LITERAL_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">ureldatefmt.h</td><td class="proto"><tt>enum</tt> URelativeDateTimeFormatterField::UDAT_REL_NUMERIC_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">ureldatefmt.h</td><td class="proto">void ureldatefmt_closeResult(UFormattedRelativeDateTime*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">ureldatefmt.h</td><td class="proto">void ureldatefmt_formatNumericToResult(const URelativeDateTimeFormatter*, double, URelativeDateTimeUnit, UFormattedRelativeDateTime*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">ureldatefmt.h</td><td class="proto">void ureldatefmt_formatToResult(const URelativeDateTimeFormatter*, double, URelativeDateTimeUnit, UFormattedRelativeDateTime*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-</table>
-<P></P>
-<a href="#_top">(jump back to top)</a>
-<hr>
-<a name="promoted"></a>
-<h2>Promoted to stable in ICU 67</h2>
-<table BORDER="1" class="genTable">
-<THEAD>
-<tr>
-<th>File</th><th>API</th><th>ICU 66</th><th>ICU 67</th>
-</tr>
-</THEAD>
-<tr class="row1">
-<td class="file">currunit.h</td><td class="proto">icu::CurrencyUnit::CurrencyUnit(StringPiece, UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">decimfmt.h</td><td class="proto">UBool icu::DecimalFormat::isFormatFailIfMoreThanMaxDigits() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">decimfmt.h</td><td class="proto">UBool icu::DecimalFormat::isParseCaseSensitive() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">decimfmt.h</td><td class="proto">UBool icu::DecimalFormat::isParseNoExponent() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">decimfmt.h</td><td class="proto">UBool icu::DecimalFormat::isSignAlwaysShown() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">decimfmt.h</td><td class="proto">const number::LocalizedNumberFormatter* icu::DecimalFormat::toNumberFormatter(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">decimfmt.h</td><td class="proto">int32_t icu::DecimalFormat::getMinimumGroupingDigits() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setFormatFailIfMoreThanMaxDigits(UBool)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setMinimumGroupingDigits(int32_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setParseCaseSensitive(UBool)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setParseNoExponent(UBool)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setSignAlwaysShown(UBool)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">dtitvfmt.h</td><td class="proto">Appendable&amp; icu::FormattedDateInterval::appendTo(Appendable&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">dtitvfmt.h</td><td class="proto">FormattedDateInterval icu::DateIntervalFormat::formatToValue(Calendar&amp;, Calendar&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">dtitvfmt.h</td><td class="proto">FormattedDateInterval icu::DateIntervalFormat::formatToValue(const DateInterval&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">dtitvfmt.h</td><td class="proto">FormattedDateInterval&amp; icu::FormattedDateInterval::operator=(FormattedDateInterval&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">dtitvfmt.h</td><td class="proto">UBool icu::FormattedDateInterval::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">dtitvfmt.h</td><td class="proto">UnicodeString icu::FormattedDateInterval::toString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">dtitvfmt.h</td><td class="proto">UnicodeString icu::FormattedDateInterval::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">dtitvfmt.h</td><td class="proto">icu::FormattedDateInterval::FormattedDateInterval()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">dtitvfmt.h</td><td class="proto">icu::FormattedDateInterval::FormattedDateInterval(FormattedDateInterval&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">dtitvfmt.h</td><td class="proto">icu::FormattedDateInterval::~FormattedDateInterval()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">formattedvalue.h</td><td class="proto">Appendable&amp; icu::FormattedValue::appendTo(Appendable&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">formattedvalue.h</td><td class="proto">UBool icu::ConstrainedFieldPosition::matchesField(int32_t, int32_t) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">formattedvalue.h</td><td class="proto">UBool icu::FormattedValue::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">formattedvalue.h</td><td class="proto">UnicodeString icu::FormattedValue::toString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">formattedvalue.h</td><td class="proto">UnicodeString icu::FormattedValue::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">formattedvalue.h</td><td class="proto">icu::ConstrainedFieldPosition::ConstrainedFieldPosition()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">formattedvalue.h</td><td class="proto">icu::ConstrainedFieldPosition::~ConstrainedFieldPosition()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">formattedvalue.h</td><td class="proto">icu::FormattedValue::~FormattedValue()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">formattedvalue.h</td><td class="proto">int32_t icu::ConstrainedFieldPosition::getCategory() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">formattedvalue.h</td><td class="proto">int32_t icu::ConstrainedFieldPosition::getField() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">formattedvalue.h</td><td class="proto">int32_t icu::ConstrainedFieldPosition::getLimit() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">formattedvalue.h</td><td class="proto">int32_t icu::ConstrainedFieldPosition::getStart() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">formattedvalue.h</td><td class="proto">int64_t icu::ConstrainedFieldPosition::getInt64IterationContext() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::constrainCategory(int32_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::constrainField(int32_t, int32_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::reset()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::setInt64IterationContext(int64_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::setState(int32_t, int32_t, int32_t, int32_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">listformatter.h</td><td class="proto">Appendable&amp; icu::FormattedList::appendTo(Appendable&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">listformatter.h</td><td class="proto">FormattedList icu::ListFormatter::formatStringsToValue(const UnicodeString items[], int32_t, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">listformatter.h</td><td class="proto">FormattedList&amp; icu::FormattedList::operator=(FormattedList&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">listformatter.h</td><td class="proto">UBool icu::FormattedList::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">listformatter.h</td><td class="proto">UnicodeString icu::FormattedList::toString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">listformatter.h</td><td class="proto">UnicodeString icu::FormattedList::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">listformatter.h</td><td class="proto">icu::FormattedList::FormattedList()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">listformatter.h</td><td class="proto">icu::FormattedList::FormattedList(FormattedList&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">listformatter.h</td><td class="proto">icu::FormattedList::~FormattedList()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localebuilder.h</td><td class="proto">Locale icu::LocaleBuilder::build(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::addUnicodeLocaleAttribute(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::clear()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::clearExtensions()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::removeUnicodeLocaleAttribute(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setExtension(char, StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setLanguage(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setLanguageTag(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setLocale(const Locale&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setRegion(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setScript(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setUnicodeLocaleKeyword(StringPiece, StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setVariant(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localebuilder.h</td><td class="proto">icu::LocaleBuilder::LocaleBuilder()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localebuilder.h</td><td class="proto">icu::LocaleBuilder::~LocaleBuilder()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localpointer.h</td><td class="proto">LocalArray&lt;T&gt;&amp; icu::LocalArray&lt; T &gt;::operator=(std::unique_ptr&lt; T[]&gt;&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localpointer.h</td><td class="proto">LocalPointer&lt;T&gt;&amp; icu::LocalPointer&lt; T &gt;::operator=(std::unique_ptr&lt; T &gt;&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localpointer.h</td><td class="proto">icu::LocalArray&lt; T &gt;::LocalArray(std::unique_ptr&lt; T[]&gt;&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localpointer.h</td><td class="proto">icu::LocalArray&lt; T &gt;::operator std::unique_ptr&lt; T[]&gt;() &amp;&amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">localpointer.h</td><td class="proto">icu::LocalPointer&lt; T &gt;::LocalPointer(std::unique_ptr&lt; T &gt;&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">localpointer.h</td><td class="proto">icu::LocalPointer&lt; T &gt;::operator std::unique_ptr&lt; T &gt;() &amp;&amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAcre()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAcreFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAmpere()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getArcMinute()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getArcSecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAstronomicalUnit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAtmosphere()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getBarrel()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getBit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getBritishThermalUnit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getBushel()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getByte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCalorie()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCarat()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCelsius()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCentiliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCentimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCentury()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicCentimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicInch()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicKilometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicMeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicMile()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicYard()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCup()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCupMetric()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDalton()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDay()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDayPerson()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDeciliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDecimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDegree()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDunam()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getEarthMass()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getElectronvolt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFahrenheit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFathom()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFluidOunce()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFluidOunceImperial()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFoodcalorie()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFurlong()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGForce()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGallon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGallonImperial()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGenericTemperature()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGigabit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGigabyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGigahertz()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGigawatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGram()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHectare()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHectoliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHectopascal()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHertz()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHorsepower()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHour()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getInch()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getInchHg()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getJoule()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKarat()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKelvin()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilobit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilobyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilocalorie()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilogram()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilohertz()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilojoule()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilometerPerHour()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilopascal()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilowatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilowattHour()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKnot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLightYear()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLiter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLiterPer100Kilometers()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLiterPerKilometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLux()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegabit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegabyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegahertz()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegaliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegapascal()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegawatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMeterPerSecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMeterPerSecondSquared()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMetricTon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMicrogram()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMicrometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMicrosecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMile()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilePerGallon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilePerGallonImperial()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilePerHour()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMileScandinavian()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilliampere()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillibar()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilligram()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilligramPerDeciliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilliliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillimeterOfMercury()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillimolePerLiter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillisecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilliwatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMinute()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMole()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMonth()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMonthPerson()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNanometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNanosecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNauticalMile()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNewton()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNewtonMeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getOhm()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getOunce()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getOunceTroy()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getParsec()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPartPerMillion()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPercent()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPermille()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPermyriad()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPetabyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPicometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPint()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPintMetric()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPoint()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPound()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPoundFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPoundForce()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPoundPerSquareInch()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getQuart()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getRadian()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getRevolutionAngle()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSolarLuminosity()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSolarMass()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSolarRadius()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareCentimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareInch()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareKilometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareMeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareMile()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareYard()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getStone()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTablespoon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTeaspoon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTerabit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTerabyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getVolt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getWatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getWeek()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getWeekPerson()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getYard()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getYear()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getYearPerson()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createBarrel(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createBritishThermalUnit(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createDalton(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createDayPerson(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createDunam(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createEarthMass(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createElectronvolt(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createFluidOunceImperial(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createKilopascal(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createMegapascal(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createMole(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createMonthPerson(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createNewton(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createNewtonMeter(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPermyriad(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPoundFoot(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPoundForce(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createSolarLuminosity(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createSolarMass(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createSolarRadius(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createWeekPerson(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createYearPerson(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">numberformatter.h</td><td class="proto">LocalPointer&lt;Derived&gt; icu::number::NumberFormatterSettings&lt; Derived &gt;::clone() &amp;&amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">numberformatter.h</td><td class="proto">LocalPointer&lt;Derived&gt; icu::number::NumberFormatterSettings&lt; Derived &gt;::clone() const &amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">numberformatter.h</td><td class="proto">UBool icu::number::FormattedNumber::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">numberformatter.h</td><td class="proto">UnicodeString icu::number::FormattedNumber::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">numberformatter.h</td><td class="proto">icu::number::FormattedNumber::FormattedNumber()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">numberformatter.h</td><td class="proto"><tt>static</tt> UnlocalizedNumberFormatter icu::number::NumberFormatter::forSkeleton(const UnicodeString&amp;, UParseError&amp;, UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">numberrangeformatter.h</td><td class="proto">LocalPointer&lt;Derived&gt; icu::number::NumberRangeFormatterSettings&lt; Derived &gt;::clone() &amp;&amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">numberrangeformatter.h</td><td class="proto">LocalPointer&lt;Derived&gt; icu::number::NumberRangeFormatterSettings&lt; Derived &gt;::clone() const &amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">numberrangeformatter.h</td><td class="proto">UBool icu::number::FormattedNumberRange::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">numberrangeformatter.h</td><td class="proto">UnicodeString icu::number::FormattedNumberRange::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">numfmt.h</td><td class="proto"><tt>enum</tt> icu::NumberFormat::EAlignmentFields::kCompactField</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">numfmt.h</td><td class="proto"><tt>enum</tt> icu::NumberFormat::EAlignmentFields::kMeasureUnitField</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">numsys.h</td><td class="proto">NumberingSystem&amp; icu::NumberingSystem::operator=(const NumberingSystem&amp;)=default</td><td class="">(missing)</td><td>Stable<br>
-<span class=""><span>ICU 4.2</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">plurrule.h</td><td class="proto">UnicodeString icu::PluralRules::select(const number::FormattedNumber&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">reldatefmt.h</td><td class="proto">Appendable&amp; icu::FormattedRelativeDateTime::appendTo(Appendable&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime icu::RelativeDateTimeFormatter::formatNumericToValue(double, URelativeDateTimeUnit, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime icu::RelativeDateTimeFormatter::formatToValue(UDateDirection, UDateAbsoluteUnit, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime icu::RelativeDateTimeFormatter::formatToValue(double, UDateDirection, UDateRelativeUnit, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime icu::RelativeDateTimeFormatter::formatToValue(double, URelativeDateTimeUnit, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime&amp; icu::FormattedRelativeDateTime::operator=(FormattedRelativeDateTime&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">reldatefmt.h</td><td class="proto">UBool icu::FormattedRelativeDateTime::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">reldatefmt.h</td><td class="proto">UnicodeString icu::FormattedRelativeDateTime::toString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">reldatefmt.h</td><td class="proto">UnicodeString icu::FormattedRelativeDateTime::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">reldatefmt.h</td><td class="proto">icu::FormattedRelativeDateTime::FormattedRelativeDateTime()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">reldatefmt.h</td><td class="proto">icu::FormattedRelativeDateTime::FormattedRelativeDateTime(FormattedRelativeDateTime&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">reldatefmt.h</td><td class="proto">icu::FormattedRelativeDateTime::~FormattedRelativeDateTime()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">udateintervalformat.h</td><td class="proto">UFormattedDateInterval* udtitvfmt_openResult(UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">udateintervalformat.h</td><td class="proto">const UFormattedValue* udtitvfmt_resultAsValue(const UFormattedDateInterval*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">udateintervalformat.h</td><td class="proto">void udtitvfmt_closeResult(UFormattedDateInterval*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto">UBool ucfpos_matchesField(const UConstrainedFieldPosition*, int32_t, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto">UBool ufmtval_nextPosition(const UFormattedValue*, UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto">UConstrainedFieldPosition* ucfpos_open(UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto">const UChar* ufmtval_getString(const UFormattedValue*, int32_t*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_DATE_INTERVAL_SPAN</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_DATE</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_LIST_SPAN</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_LIST</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_NUMBER</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_RELATIVE_DATETIME</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_UNDEFINED</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto">int32_t ucfpos_getCategory(const UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto">int32_t ucfpos_getField(const UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto">int64_t ucfpos_getInt64IterationContext(const UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_close(UConstrainedFieldPosition*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_constrainCategory(UConstrainedFieldPosition*, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_constrainField(UConstrainedFieldPosition*, int32_t, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_getIndexes(const UConstrainedFieldPosition*, int32_t*, int32_t*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_reset(UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_setInt64IterationContext(UConstrainedFieldPosition*, int64_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_setState(UConstrainedFieldPosition*, int32_t, int32_t, int32_t, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">ulistformatter.h</td><td class="proto">UFormattedList* ulistfmt_openResult(UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">ulistformatter.h</td><td class="proto">const UFormattedValue* ulistfmt_resultAsValue(const UFormattedList*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterField::ULISTFMT_ELEMENT_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 63</td>
-</tr>
-<tr class="row1">
-<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterField::ULISTFMT_LITERAL_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 63</td>
-</tr>
-<tr class="row0">
-<td class="file">ulistformatter.h</td><td class="proto">void ulistfmt_closeResult(UFormattedList*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">ulistformatter.h</td><td class="proto">void ulistfmt_formatStringsToResult(const UListFormatter*, const UChar* const strings[], const int32_t*, int32_t, UFormattedList*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatAttribute::UNUM_MINIMUM_GROUPING_DIGITS</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatAttribute::UNUM_PARSE_CASE_SENSITIVE</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatAttribute::UNUM_SIGN_ALWAYS_SHOWN</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatFields::UNUM_COMPACT_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatFields::UNUM_MEASURE_UNIT_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">unumberformatter.h</td><td class="proto">UNumberFormatter* unumf_openForSkeletonAndLocaleWithError(const UChar*, int32_t, const char*, UParseError*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">unumberformatter.h</td><td class="proto">const UFormattedValue* unumf_resultAsValue(const UFormattedNumber*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">upluralrules.h</td><td class="proto">int32_t uplrules_selectFormatted(const UPluralRules*, const struct UFormattedNumber*, UChar*, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">ureldatefmt.h</td><td class="proto">UFormattedRelativeDateTime* ureldatefmt_openResult(UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">ureldatefmt.h</td><td class="proto">const UFormattedValue* ureldatefmt_resultAsValue(const UFormattedRelativeDateTime*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">ureldatefmt.h</td><td class="proto"><tt>enum</tt> URelativeDateTimeFormatterField::UDAT_REL_LITERAL_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">ureldatefmt.h</td><td class="proto"><tt>enum</tt> URelativeDateTimeFormatterField::UDAT_REL_NUMERIC_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">ureldatefmt.h</td><td class="proto">void ureldatefmt_closeResult(UFormattedRelativeDateTime*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row1">
-<td class="file">ureldatefmt.h</td><td class="proto">void ureldatefmt_formatNumericToResult(const URelativeDateTimeFormatter*, double, URelativeDateTimeUnit, UFormattedRelativeDateTime*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-<tr class="row0">
-<td class="file">ureldatefmt.h</td><td class="proto">void ureldatefmt_formatToResult(const URelativeDateTimeFormatter*, double, URelativeDateTimeUnit, UFormattedRelativeDateTime*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
-</tr>
-</table>
-<P></P>
-<a href="#_top">(jump back to top)</a>
-<hr>
-<a name="added"></a>
-<h2>Added in ICU 67</h2>
-<table BORDER="1" class="genTable">
-<THEAD>
-<tr>
-<th>File</th><th>API</th><th>ICU 66</th><th>ICU 67</th>
-</tr>
-</THEAD>
-<tr class="row1">
-<td class="file">bytestream.h</td><td class="proto">void icu::ByteSink::AppendU8(const char*, int32_t)</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">bytestream.h</td><td class="proto">void icu::ByteSink::AppendU8(const char8_t*, int32_t)</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">dcfmtsym.h</td><td class="proto">void icu::DecimalFormatSymbols::setCurrency(const UChar*, UErrorCode&amp;)</td><td class="">(missing)</td><td>Internal<br>
-<span class=""><span></span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">dtptngen.h</td><td class="proto">UDateFormatHourCycle icu::DateTimePatternGenerator::getDefaultHourCycle(UErrorCode&amp;) const</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">listformatter.h</td><td class="proto"><tt>static</tt> ListFormatter* icu::ListFormatter::createInstance(const Locale&amp;, UListFormatterType, UListFormatterWidth, UErrorCode&amp;)</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::setDirection(ULocMatchDirection)</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">localematcher.h</td><td class="proto"><tt>enum</tt> ULocMatchDirection::ULOCMATCH_DIRECTION_ONLY_TWO_WAY</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto"><tt>enum</tt> ULocMatchDirection::ULOCMATCH_DIRECTION_WITH_ONE_WAY</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">locid.h</td><td class="proto">void icu::Locale::canonicalize(UErrorCode&amp;)</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto">LocalArray&lt;MeasureUnit&gt; icu::MeasureUnit::splitToSingleUnits(int32_t&amp;, UErrorCode&amp;) const</td><td class="">(missing)</td><td>Internal<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto">MeasureUnit icu::MeasureUnit::product(const MeasureUnit&amp;, UErrorCode&amp;) const</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto">MeasureUnit icu::MeasureUnit::reciprocal(UErrorCode&amp;) const</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto">MeasureUnit icu::MeasureUnit::withDimensionality(int32_t, UErrorCode&amp;) const</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto">MeasureUnit icu::MeasureUnit::withSIPrefix(UMeasureSIPrefix, UErrorCode&amp;) const</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto">MeasureUnit&amp; icu::MeasureUnit::operator=(MeasureUnit&amp;&amp;) noexcept</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto">UMeasureSIPrefix icu::MeasureUnit::getSIPrefix(UErrorCode&amp;) const</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto">UMeasureUnitComplexity icu::MeasureUnit::getComplexity(UErrorCode&amp;) const</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto">const char* icu::MeasureUnit::getIdentifier() const</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto">icu::MeasureUnit::MeasureUnit(MeasureUnit&amp;&amp;) noexcept</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto">int32_t icu::MeasureUnit::getDimensionality(UErrorCode&amp;) const</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::forIdentifier(StringPiece, UErrorCode&amp;)</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">numsys.h</td><td class="proto">NumberingSystem&amp; icu::NumberingSystem::operator=(const NumberingSystem&amp;)=default</td><td class="">(missing)</td><td>Stable<br>
-<span class=""><span>ICU 4.2</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">stringpiece.h</td><td class="proto">icu::StringPiece::StringPiece(const char8_t*)</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">stringpiece.h</td><td class="proto">icu::StringPiece::StringPiece(const char8_t*, int32_t)</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">stringpiece.h</td><td class="proto">icu::StringPiece::StringPiece(const std::u8string&amp;)</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">stringpiece.h</td><td class="proto">icu::StringPiece::StringPiece(std::nullptr_t)</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">stringpiece.h</td><td class="proto">int32_t icu::StringPiece::compare(StringPiece)</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">stringpiece.h</td><td class="proto">int32_t icu::StringPiece::find(StringPiece, int32_t)</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">stringpiece.h</td><td class="proto">void icu::StringPiece::set(const char8_t*)</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">stringpiece.h</td><td class="proto">void icu::StringPiece::set(const char8_t*, int32_t)</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">udat.h</td><td class="proto"><tt>enum</tt> UDateFormatHourCycle::UDAT_HOUR_CYCLE_11</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">udat.h</td><td class="proto"><tt>enum</tt> UDateFormatHourCycle::UDAT_HOUR_CYCLE_12</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">udat.h</td><td class="proto"><tt>enum</tt> UDateFormatHourCycle::UDAT_HOUR_CYCLE_23</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">udat.h</td><td class="proto"><tt>enum</tt> UDateFormatHourCycle::UDAT_HOUR_CYCLE_24</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">udateintervalformat.h</td><td class="proto">void udtitvfmt_formatCalendarToResult(const UDateIntervalFormat*, UCalendar*, UCalendar*, UFormattedDateInterval*, UErrorCode*)</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">udateintervalformat.h</td><td class="proto">void udtitvfmt_formatToResult(const UDateIntervalFormat*, UDate, UDate, UFormattedDateInterval*, UErrorCode*)</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">udatpg.h</td><td class="proto">UDateFormatHourCycle udatpg_getDefaultHourCycle(const UDateTimePatternGenerator*, UErrorCode*)</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">ulistformatter.h</td><td class="proto">UListFormatter* ulistfmt_openForType(const char*, UListFormatterType, UListFormatterWidth, UErrorCode*)</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterType::ULISTFMT_TYPE_AND</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterType::ULISTFMT_TYPE_OR</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterType::ULISTFMT_TYPE_UNITS</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterWidth::ULISTFMT_WIDTH_NARROW</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterWidth::ULISTFMT_WIDTH_SHORT</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterWidth::ULISTFMT_WIDTH_WIDE</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UBRK_CREATE_BREAK_ENGINE</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UBRK_CREATE_CHARACTER</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UBRK_CREATE_LINE</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UBRK_CREATE_SENTENCE</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UBRK_CREATE_TITLE</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UBRK_CREATE_WORD</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-<tr class="row1">
-<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UBRK_LIMIT</td><td class="">(missing)</td><td>Internal<br>
-<span class=""><span></span></span></td>
-</tr>
-<tr class="row0">
-<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UBRK_START</td><td class="">(missing)</td><td>Draft<br>
-<span class=""><span>ICU 67</span></span></td>
-</tr>
-</table>
-<P></P>
-<a href="#_top">(jump back to top)</a>
-<hr>
-<a name="other"></a>
-<h2>Other existing drafts in ICU 67</h2>
-<div class="other">
-<table BORDER="1" class="genTable">
-<THEAD>
-<tr>
-<th>File</th><th>API</th><th>ICU 66</th><th>ICU 67</th>
-</tr>
-</THEAD>
-<tr class="row1">
-<td class="file">bytestrie.h</td><td class="proto">BytesTrie&amp; icu::BytesTrie::resetToState64(uint64_t)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">bytestrie.h</td><td class="proto">uint64_t icu::BytesTrie::getState64() const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">localebuilder.h</td><td class="proto">UBool icu::LocaleBuilder::copyErrorTo(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::addSupportedLocale(const Locale&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::operator=(Builder&amp;&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::setDefaultLocale(const Locale*)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::setDemotionPerDesiredLocale(ULocMatchDemotion)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::setFavorSubtag(ULocMatchFavorSubtag)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::setSupportedLocales(Iter, Iter)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::setSupportedLocales(Locale::Iterator&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::setSupportedLocalesFromListString(StringPiece)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::setSupportedLocalesViaConverter(Iter, Iter, Conv)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">localematcher.h</td><td class="proto">Locale icu::LocaleMatcher::Result::makeResolvedLocale(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto">LocaleMatcher icu::LocaleMatcher::Builder::build(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">localematcher.h</td><td class="proto">LocaleMatcher&amp; icu::LocaleMatcher::operator=(LocaleMatcher&amp;&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto">Result icu::LocaleMatcher::getBestMatchResult(Locale::Iterator&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">localematcher.h</td><td class="proto">Result icu::LocaleMatcher::getBestMatchResult(const Locale&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto">Result&amp; icu::LocaleMatcher::Result::operator=(Result&amp;&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">localematcher.h</td><td class="proto">UBool icu::LocaleMatcher::Builder::copyErrorTo(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto">const Locale* icu::LocaleMatcher::Result::getDesiredLocale() const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">localematcher.h</td><td class="proto">const Locale* icu::LocaleMatcher::Result::getSupportedLocale() const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto">const Locale* icu::LocaleMatcher::getBestMatch(Locale::Iterator&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">localematcher.h</td><td class="proto">const Locale* icu::LocaleMatcher::getBestMatch(const Locale&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto">const Locale* icu::LocaleMatcher::getBestMatchForListString(StringPiece, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">localematcher.h</td><td class="proto"><tt>enum</tt> ULocMatchDemotion::ULOCMATCH_DEMOTION_NONE</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto"><tt>enum</tt> ULocMatchDemotion::ULOCMATCH_DEMOTION_REGION</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">localematcher.h</td><td class="proto"><tt>enum</tt> ULocMatchFavorSubtag::ULOCMATCH_FAVOR_LANGUAGE</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto"><tt>enum</tt> ULocMatchFavorSubtag::ULOCMATCH_FAVOR_SCRIPT</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">localematcher.h</td><td class="proto">icu::LocaleMatcher::Builder::Builder()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto">icu::LocaleMatcher::Builder::Builder(Builder&amp;&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">localematcher.h</td><td class="proto">icu::LocaleMatcher::Builder::~Builder()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto">icu::LocaleMatcher::LocaleMatcher(LocaleMatcher&amp;&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">localematcher.h</td><td class="proto">icu::LocaleMatcher::Result::Result(Result&amp;&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto">icu::LocaleMatcher::Result::~Result()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">localematcher.h</td><td class="proto">icu::LocaleMatcher::~LocaleMatcher()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">localematcher.h</td><td class="proto">int32_t icu::LocaleMatcher::Result::getDesiredIndex() const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">localematcher.h</td><td class="proto">int32_t icu::LocaleMatcher::Result::getSupportedIndex() const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">locid.h</td><td class="proto">UBool icu::Locale::ConvertingIterator&lt; Iter, Conv &gt;::hasNext() const override</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">locid.h</td><td class="proto">UBool icu::Locale::Iterator::hasNext() const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">locid.h</td><td class="proto">UBool icu::Locale::RangeIterator&lt; Iter &gt;::hasNext() const override</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">locid.h</td><td class="proto">const Locale&amp; icu::Locale::ConvertingIterator&lt; Iter, Conv &gt;::next() override</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">locid.h</td><td class="proto">const Locale&amp; icu::Locale::Iterator::next()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">locid.h</td><td class="proto">const Locale&amp; icu::Locale::RangeIterator&lt; Iter &gt;::next() override</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">locid.h</td><td class="proto">icu::Locale::ConvertingIterator&lt; Iter, Conv &gt;::ConvertingIterator(Iter, Iter, Conv)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">locid.h</td><td class="proto">icu::Locale::Iterator::~Iterator()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">locid.h</td><td class="proto">icu::Locale::RangeIterator&lt; Iter &gt;::RangeIterator(Iter, Iter)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">measfmt.h</td><td class="proto">void icu::MeasureFormat::parseObject(const UnicodeString&amp;, Formattable&amp;, ParsePosition&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 53</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getBar()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDecade()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDotPerCentimeter()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDotPerInch()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getEm()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegapixel()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPascal()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPixel()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPixelPerCentimeter()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPixelPerInch()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getThermUs()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createBar(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createDecade(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createDotPerCentimeter(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createDotPerInch(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createEm(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createMegapixel(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPascal(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPixel(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPixelPerCentimeter(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPixelPerInch(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createThermUs(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">nounit.h</td><td class="proto">UClassID icu::NoUnit::getDynamicClassID() const</td><td class="" colspan="2" align="center">Draft<br>ICU 60</td>
-</tr>
-<tr class="row1">
-<td class="file">nounit.h</td><td class="proto">icu::NoUnit::NoUnit(const NoUnit&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 60</td>
-</tr>
-<tr class="row0">
-<td class="file">nounit.h</td><td class="proto">icu::NoUnit::~NoUnit()</td><td class="" colspan="2" align="center">Draft<br>ICU 60</td>
-</tr>
-<tr class="row1">
-<td class="file">nounit.h</td><td class="proto"><tt>static</tt> NoUnit icu::NoUnit::base()</td><td class="" colspan="2" align="center">Draft<br>ICU 60</td>
-</tr>
-<tr class="row0">
-<td class="file">nounit.h</td><td class="proto"><tt>static</tt> NoUnit icu::NoUnit::percent()</td><td class="" colspan="2" align="center">Draft<br>ICU 60</td>
-</tr>
-<tr class="row1">
-<td class="file">nounit.h</td><td class="proto"><tt>static</tt> NoUnit icu::NoUnit::permille()</td><td class="" colspan="2" align="center">Draft<br>ICU 60</td>
-</tr>
-<tr class="row0">
-<td class="file">nounit.h</td><td class="proto"><tt>static</tt> UClassID icu::NoUnit::getStaticClassID()</td><td class="" colspan="2" align="center">Draft<br>ICU 60</td>
-</tr>
-<tr class="row1">
-<td class="file">nounit.h</td><td class="proto">void* icu::NoUnit::clone() const</td><td class="" colspan="2" align="center">Draft<br>ICU 60</td>
-</tr>
-<tr class="row0">
-<td class="file">numberformatter.h</td><td class="proto">StringClass icu::number::FormattedNumber::toDecimalNumber(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">numberrangeformatter.h</td><td class="proto">UnicodeString icu::number::FormattedNumberRange::getFirstDecimal(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 63</td>
-</tr>
-<tr class="row0">
-<td class="file">numberrangeformatter.h</td><td class="proto">UnicodeString icu::number::FormattedNumberRange::getSecondDecimal(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 63</td>
-</tr>
-<tr class="row1">
-<td class="file">reldatefmt.h</td><td class="proto"><tt>enum</tt> UDateAbsoluteUnit::UDAT_ABSOLUTE_HOUR</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">reldatefmt.h</td><td class="proto"><tt>enum</tt> UDateAbsoluteUnit::UDAT_ABSOLUTE_MINUTE</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">stringpiece.h</td><td class="proto">icu::StringPiece::StringPiece(T)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">ucal.h</td><td class="proto">int32_t ucal_getHostTimeZone(UChar*, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">ucharstrie.h</td><td class="proto">UCharsTrie&amp; icu::UCharsTrie::resetToState64(uint64_t)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">ucharstrie.h</td><td class="proto">uint64_t icu::UCharsTrie::getState64() const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">uloc.h</td><td class="proto">UEnumeration* uloc_openAvailableByType(ULocAvailableType, UErrorCode*)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">uloc.h</td><td class="proto"><tt>enum</tt> ULocAvailableType::ULOC_AVAILABLE_DEFAULT</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">uloc.h</td><td class="proto"><tt>enum</tt> ULocAvailableType::ULOC_AVAILABLE_ONLY_LEGACY_ALIASES</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">uloc.h</td><td class="proto"><tt>enum</tt> ULocAvailableType::ULOC_AVAILABLE_WITH_LEGACY_ALIASES</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">uregex.h</td><td class="proto"><tt>enum</tt> URegexpFlag::UREGEX_CANON_EQ</td><td class="" colspan="2" align="center">Draft<br>ICU 2.4</td>
-</tr>
-<tr class="row0">
-<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UDATA_BUNDLE</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UDATA_DATA_FILE</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UDATA_RESOURCE</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row1">
-<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UDATA_RES_FILE</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-<tr class="row0">
-<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UDATA_START</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
-</tr>
-</table>
-</div>
-<P></P>
-<a href="#_top">(jump back to top)</a>
-<hr>
-<a name="simplifications"></a>
-<h2>Signature Simplifications</h2>
-<i>This section shows cases where the signature was "simplified" for the sake of comparison. The simplified form is in bold, followed by
- all possible variations in "original" form.</i>
-<div class="other">
-<ul></ul>
-</div>
-<P></P>
-<a href="#_top">(jump back to top)</a>
-<hr>
-<p>
-<i><font size="-1">Contents generated by StableAPI tool on Fri Apr 03 07:26:43 PDT 2020<br>
- Copyright &copy; 2017 and later: Unicode, Inc. and others.<br>
- License &amp; terms of use: http://www.unicode.org/copyright.html
- </font></i>
-</p>
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html><!--
+ Copyright © 2016 and later: Unicode, Inc. and others.
+ License & terms of use: http://www.unicode.org/copyright.html
+ -->
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>ICU4C API Comparison: ICU 66 with ICU 67</title>
+<link type="text/css" href="icu4c.css" rel="stylesheet">
+</head>
+<body>
+<a name="#_top"></a>
+<h1>ICU4C API Comparison: ICU 66 with ICU 67</h1>
+<div id="toc">
+<ul>
+<li>
+<a href="#removed">Removed from ICU 66</a>
+</li>
+<li>
+<a href="#deprecated">Deprecated or Obsoleted in ICU 67</a>
+</li>
+<li>
+<a href="#changed">Changed in ICU 67</a>
+</li>
+<li>
+<a href="#promoted">Promoted to stable in ICU 67</a>
+</li>
+<li>
+<a href="#added">Added in ICU 67</a>
+</li>
+<li>
+<a href="#other">Other existing drafts in ICU 67</a>
+</li>
+<li>
+<a href="#simplifications">Signature Simplifications</a>
+</li>
+</ul>
+<hr>
+</div>
+<a name="removed"></a>
+<h2>Removed from ICU 66</h2>
+<table BORDER="1" class="genTable">
+<THEAD>
+<tr>
+<th>File</th><th>API</th><th>ICU 66</th><th>ICU 67</th>
+</tr>
+</THEAD>
+<tr class="row1">
+<td class="file">listformatter.h</td><td class="proto">UnicodeString&amp; icu::ListFormatter::format(const UnicodeString items[], int32_t, UnicodeString&amp;, FieldPositionIterator*, UErrorCode&amp;) const</td><td class="">Draft<br>ICU 63</td><td>(missing)<br>
+<span class=""><span></span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">numberformatter.h</td><td class="proto">UBool icu::number::FormattedNumber::nextFieldPosition(FieldPosition&amp;, UErrorCode&amp;) const</td><td class="">Draft<br>ICU 62</td><td>(missing)<br>
+<span class=""><span></span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">numberformatter.h</td><td class="proto">void icu::number::FormattedNumber::getAllFieldPositions(FieldPositionIterator&amp;, UErrorCode&amp;) const</td><td class="">Draft<br>ICU 62</td><td>(missing)<br>
+<span class=""><span></span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">numberrangeformatter.h</td><td class="proto">UBool icu::number::FormattedNumberRange::nextFieldPosition(FieldPosition&amp;, UErrorCode&amp;) const</td><td class="">Draft<br>ICU 63</td><td>(missing)<br>
+<span class=""><span></span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">numberrangeformatter.h</td><td class="proto">void icu::number::FormattedNumberRange::getAllFieldPositions(FieldPositionIterator&amp;, UErrorCode&amp;) const</td><td class="">Draft<br>ICU 63</td><td>(missing)<br>
+<span class=""><span></span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">udateintervalformat.h</td><td class="proto">void udtitvfmt_formatToResult(const UDateIntervalFormat*, UFormattedDateInterval*, UDate, UDate, UErrorCode*)</td><td class="">Draft<br>ICU 64</td><td>(missing)<br>
+<span class=""><span></span></span></td>
+</tr>
+</table>
+<P></P>
+<a href="#_top">(jump back to top)</a>
+<hr>
+<a name="deprecated"></a>
+<h2>Deprecated or Obsoleted in ICU 67</h2>
+<table BORDER="1" class="genTable">
+<THEAD>
+<tr>
+<th>File</th><th>API</th><th>ICU 66</th><th>ICU 67</th>
+</tr>
+</THEAD>
+</table>
+<P></P>
+<a href="#_top">(jump back to top)</a>
+<hr>
+<a name="changed"></a>
+<h2>Changed in ICU 67 (old, new)</h2>
+<table BORDER="1" class="genTable">
+<THEAD>
+<tr>
+<th>File</th><th>API</th><th>ICU 66</th><th>ICU 67</th>
+</tr>
+</THEAD>
+<tr class="row1">
+<td class="file">currunit.h</td><td class="proto">icu::CurrencyUnit::CurrencyUnit(StringPiece, UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">decimfmt.h</td><td class="proto">UBool icu::DecimalFormat::isFormatFailIfMoreThanMaxDigits() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">decimfmt.h</td><td class="proto">UBool icu::DecimalFormat::isParseCaseSensitive() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">decimfmt.h</td><td class="proto">UBool icu::DecimalFormat::isParseNoExponent() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">decimfmt.h</td><td class="proto">UBool icu::DecimalFormat::isSignAlwaysShown() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">decimfmt.h</td><td class="proto">const number::LocalizedNumberFormatter* icu::DecimalFormat::toNumberFormatter(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">decimfmt.h</td><td class="proto">int32_t icu::DecimalFormat::getMinimumGroupingDigits() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setFormatFailIfMoreThanMaxDigits(UBool)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setMinimumGroupingDigits(int32_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setParseCaseSensitive(UBool)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setParseNoExponent(UBool)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setSignAlwaysShown(UBool)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">dtitvfmt.h</td><td class="proto">Appendable&amp; icu::FormattedDateInterval::appendTo(Appendable&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">dtitvfmt.h</td><td class="proto">FormattedDateInterval icu::DateIntervalFormat::formatToValue(Calendar&amp;, Calendar&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">dtitvfmt.h</td><td class="proto">FormattedDateInterval icu::DateIntervalFormat::formatToValue(const DateInterval&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">dtitvfmt.h</td><td class="proto">FormattedDateInterval&amp; icu::FormattedDateInterval::operator=(FormattedDateInterval&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">dtitvfmt.h</td><td class="proto">UBool icu::FormattedDateInterval::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">dtitvfmt.h</td><td class="proto">UnicodeString icu::FormattedDateInterval::toString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">dtitvfmt.h</td><td class="proto">UnicodeString icu::FormattedDateInterval::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">dtitvfmt.h</td><td class="proto">icu::FormattedDateInterval::FormattedDateInterval()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">dtitvfmt.h</td><td class="proto">icu::FormattedDateInterval::FormattedDateInterval(FormattedDateInterval&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">dtitvfmt.h</td><td class="proto">icu::FormattedDateInterval::~FormattedDateInterval()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">formattedvalue.h</td><td class="proto">Appendable&amp; icu::FormattedValue::appendTo(Appendable&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">formattedvalue.h</td><td class="proto">UBool icu::ConstrainedFieldPosition::matchesField(int32_t, int32_t) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">formattedvalue.h</td><td class="proto">UBool icu::FormattedValue::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">formattedvalue.h</td><td class="proto">UnicodeString icu::FormattedValue::toString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">formattedvalue.h</td><td class="proto">UnicodeString icu::FormattedValue::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">formattedvalue.h</td><td class="proto">icu::ConstrainedFieldPosition::ConstrainedFieldPosition()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">formattedvalue.h</td><td class="proto">icu::ConstrainedFieldPosition::~ConstrainedFieldPosition()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">formattedvalue.h</td><td class="proto">icu::FormattedValue::~FormattedValue()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">formattedvalue.h</td><td class="proto">int32_t icu::ConstrainedFieldPosition::getCategory() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">formattedvalue.h</td><td class="proto">int32_t icu::ConstrainedFieldPosition::getField() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">formattedvalue.h</td><td class="proto">int32_t icu::ConstrainedFieldPosition::getLimit() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">formattedvalue.h</td><td class="proto">int32_t icu::ConstrainedFieldPosition::getStart() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">formattedvalue.h</td><td class="proto">int64_t icu::ConstrainedFieldPosition::getInt64IterationContext() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::constrainCategory(int32_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::constrainField(int32_t, int32_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::reset()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::setInt64IterationContext(int64_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::setState(int32_t, int32_t, int32_t, int32_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">listformatter.h</td><td class="proto">Appendable&amp; icu::FormattedList::appendTo(Appendable&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">listformatter.h</td><td class="proto">FormattedList icu::ListFormatter::formatStringsToValue(const UnicodeString items[], int32_t, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">listformatter.h</td><td class="proto">FormattedList&amp; icu::FormattedList::operator=(FormattedList&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">listformatter.h</td><td class="proto">UBool icu::FormattedList::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">listformatter.h</td><td class="proto">UnicodeString icu::FormattedList::toString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">listformatter.h</td><td class="proto">UnicodeString icu::FormattedList::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">listformatter.h</td><td class="proto">icu::FormattedList::FormattedList()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">listformatter.h</td><td class="proto">icu::FormattedList::FormattedList(FormattedList&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">listformatter.h</td><td class="proto">icu::FormattedList::~FormattedList()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localebuilder.h</td><td class="proto">Locale icu::LocaleBuilder::build(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::addUnicodeLocaleAttribute(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::clear()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::clearExtensions()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::removeUnicodeLocaleAttribute(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setExtension(char, StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setLanguage(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setLanguageTag(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setLocale(const Locale&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setRegion(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setScript(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setUnicodeLocaleKeyword(StringPiece, StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setVariant(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localebuilder.h</td><td class="proto">icu::LocaleBuilder::LocaleBuilder()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localebuilder.h</td><td class="proto">icu::LocaleBuilder::~LocaleBuilder()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localpointer.h</td><td class="proto">LocalArray&lt;T&gt;&amp; icu::LocalArray&lt; T &gt;::operator=(std::unique_ptr&lt; T[]&gt;&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localpointer.h</td><td class="proto">LocalPointer&lt;T&gt;&amp; icu::LocalPointer&lt; T &gt;::operator=(std::unique_ptr&lt; T &gt;&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localpointer.h</td><td class="proto">icu::LocalArray&lt; T &gt;::LocalArray(std::unique_ptr&lt; T[]&gt;&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localpointer.h</td><td class="proto">icu::LocalArray&lt; T &gt;::operator std::unique_ptr&lt; T[]&gt;() &amp;&amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localpointer.h</td><td class="proto">icu::LocalPointer&lt; T &gt;::LocalPointer(std::unique_ptr&lt; T &gt;&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localpointer.h</td><td class="proto">icu::LocalPointer&lt; T &gt;::operator std::unique_ptr&lt; T &gt;() &amp;&amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAcre()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAcreFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAmpere()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getArcMinute()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getArcSecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAstronomicalUnit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAtmosphere()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getBarrel()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getBit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getBritishThermalUnit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getBushel()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getByte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCalorie()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCarat()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCelsius()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCentiliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCentimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCentury()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicCentimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicInch()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicKilometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicMeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicMile()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicYard()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCup()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCupMetric()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDalton()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDay()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDayPerson()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDeciliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDecimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDegree()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDunam()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getEarthMass()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getElectronvolt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFahrenheit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFathom()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFluidOunce()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFluidOunceImperial()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFoodcalorie()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFurlong()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGForce()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGallon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGallonImperial()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGenericTemperature()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGigabit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGigabyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGigahertz()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGigawatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGram()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHectare()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHectoliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHectopascal()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHertz()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHorsepower()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHour()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getInch()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getInchHg()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getJoule()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKarat()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKelvin()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilobit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilobyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilocalorie()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilogram()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilohertz()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilojoule()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilometerPerHour()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilopascal()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilowatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilowattHour()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKnot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLightYear()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLiter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLiterPer100Kilometers()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLiterPerKilometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLux()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegabit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegabyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegahertz()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegaliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegapascal()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegawatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMeterPerSecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMeterPerSecondSquared()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMetricTon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMicrogram()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMicrometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMicrosecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMile()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilePerGallon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilePerGallonImperial()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilePerHour()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMileScandinavian()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilliampere()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillibar()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilligram()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilligramPerDeciliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilliliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillimeterOfMercury()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillimolePerLiter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillisecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilliwatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMinute()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMole()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMonth()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMonthPerson()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNanometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNanosecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNauticalMile()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNewton()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNewtonMeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getOhm()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getOunce()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getOunceTroy()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getParsec()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPartPerMillion()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPercent()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPermille()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPermyriad()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPetabyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPicometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPint()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPintMetric()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPoint()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPound()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPoundFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPoundForce()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPoundPerSquareInch()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getQuart()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getRadian()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getRevolutionAngle()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSolarLuminosity()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSolarMass()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSolarRadius()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareCentimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareInch()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareKilometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareMeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareMile()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareYard()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getStone()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTablespoon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTeaspoon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTerabit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTerabyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getVolt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getWatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getWeek()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getWeekPerson()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getYard()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getYear()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getYearPerson()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createBarrel(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createBritishThermalUnit(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createDalton(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createDayPerson(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createDunam(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createEarthMass(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createElectronvolt(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createFluidOunceImperial(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createKilopascal(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createMegapascal(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createMole(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createMonthPerson(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createNewton(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createNewtonMeter(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPermyriad(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPoundFoot(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPoundForce(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createSolarLuminosity(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createSolarMass(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createSolarRadius(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createWeekPerson(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createYearPerson(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">numberformatter.h</td><td class="proto">LocalPointer&lt;Derived&gt; icu::number::NumberFormatterSettings&lt; Derived &gt;::clone() &amp;&amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">numberformatter.h</td><td class="proto">LocalPointer&lt;Derived&gt; icu::number::NumberFormatterSettings&lt; Derived &gt;::clone() const &amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">numberformatter.h</td><td class="proto">UBool icu::number::FormattedNumber::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">numberformatter.h</td><td class="proto">UnicodeString icu::number::FormattedNumber::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">numberformatter.h</td><td class="proto">icu::number::FormattedNumber::FormattedNumber()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">numberformatter.h</td><td class="proto"><tt>static</tt> UnlocalizedNumberFormatter icu::number::NumberFormatter::forSkeleton(const UnicodeString&amp;, UParseError&amp;, UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">numberrangeformatter.h</td><td class="proto">LocalPointer&lt;Derived&gt; icu::number::NumberRangeFormatterSettings&lt; Derived &gt;::clone() &amp;&amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">numberrangeformatter.h</td><td class="proto">LocalPointer&lt;Derived&gt; icu::number::NumberRangeFormatterSettings&lt; Derived &gt;::clone() const &amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">numberrangeformatter.h</td><td class="proto">UBool icu::number::FormattedNumberRange::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">numberrangeformatter.h</td><td class="proto">UnicodeString icu::number::FormattedNumberRange::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">numfmt.h</td><td class="proto"><tt>enum</tt> icu::NumberFormat::EAlignmentFields::kCompactField</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">numfmt.h</td><td class="proto"><tt>enum</tt> icu::NumberFormat::EAlignmentFields::kMeasureUnitField</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">plurrule.h</td><td class="proto">UnicodeString icu::PluralRules::select(const number::FormattedNumber&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">reldatefmt.h</td><td class="proto">Appendable&amp; icu::FormattedRelativeDateTime::appendTo(Appendable&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime icu::RelativeDateTimeFormatter::formatNumericToValue(double, URelativeDateTimeUnit, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime icu::RelativeDateTimeFormatter::formatToValue(UDateDirection, UDateAbsoluteUnit, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime icu::RelativeDateTimeFormatter::formatToValue(double, UDateDirection, UDateRelativeUnit, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime icu::RelativeDateTimeFormatter::formatToValue(double, URelativeDateTimeUnit, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime&amp; icu::FormattedRelativeDateTime::operator=(FormattedRelativeDateTime&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">reldatefmt.h</td><td class="proto">UBool icu::FormattedRelativeDateTime::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">reldatefmt.h</td><td class="proto">UnicodeString icu::FormattedRelativeDateTime::toString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">reldatefmt.h</td><td class="proto">UnicodeString icu::FormattedRelativeDateTime::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">reldatefmt.h</td><td class="proto">icu::FormattedRelativeDateTime::FormattedRelativeDateTime()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">reldatefmt.h</td><td class="proto">icu::FormattedRelativeDateTime::FormattedRelativeDateTime(FormattedRelativeDateTime&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">reldatefmt.h</td><td class="proto">icu::FormattedRelativeDateTime::~FormattedRelativeDateTime()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">udateintervalformat.h</td><td class="proto">UFormattedDateInterval* udtitvfmt_openResult(UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">udateintervalformat.h</td><td class="proto">const UFormattedValue* udtitvfmt_resultAsValue(const UFormattedDateInterval*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">udateintervalformat.h</td><td class="proto">void udtitvfmt_closeResult(UFormattedDateInterval*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto">UBool ucfpos_matchesField(const UConstrainedFieldPosition*, int32_t, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto">UBool ufmtval_nextPosition(const UFormattedValue*, UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto">UConstrainedFieldPosition* ucfpos_open(UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto">const UChar* ufmtval_getString(const UFormattedValue*, int32_t*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_DATE_INTERVAL_SPAN</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_DATE</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_LIST_SPAN</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_LIST</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_NUMBER</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_RELATIVE_DATETIME</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_UNDEFINED</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto">int32_t ucfpos_getCategory(const UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto">int32_t ucfpos_getField(const UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto">int64_t ucfpos_getInt64IterationContext(const UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_close(UConstrainedFieldPosition*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_constrainCategory(UConstrainedFieldPosition*, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_constrainField(UConstrainedFieldPosition*, int32_t, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_getIndexes(const UConstrainedFieldPosition*, int32_t*, int32_t*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_reset(UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_setInt64IterationContext(UConstrainedFieldPosition*, int64_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_setState(UConstrainedFieldPosition*, int32_t, int32_t, int32_t, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">ulistformatter.h</td><td class="proto">UFormattedList* ulistfmt_openResult(UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">ulistformatter.h</td><td class="proto">const UFormattedValue* ulistfmt_resultAsValue(const UFormattedList*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterField::ULISTFMT_ELEMENT_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 63</td>
+</tr>
+<tr class="row0">
+<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterField::ULISTFMT_LITERAL_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 63</td>
+</tr>
+<tr class="row1">
+<td class="file">ulistformatter.h</td><td class="proto">void ulistfmt_closeResult(UFormattedList*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">ulistformatter.h</td><td class="proto">void ulistfmt_formatStringsToResult(const UListFormatter*, const UChar* const strings[], const int32_t*, int32_t, UFormattedList*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatAttribute::UNUM_MINIMUM_GROUPING_DIGITS</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatAttribute::UNUM_PARSE_CASE_SENSITIVE</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatAttribute::UNUM_SIGN_ALWAYS_SHOWN</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatFields::UNUM_COMPACT_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatFields::UNUM_MEASURE_UNIT_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">unumberformatter.h</td><td class="proto">UNumberFormatter* unumf_openForSkeletonAndLocaleWithError(const UChar*, int32_t, const char*, UParseError*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">unumberformatter.h</td><td class="proto">const UFormattedValue* unumf_resultAsValue(const UFormattedNumber*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">upluralrules.h</td><td class="proto">int32_t uplrules_selectFormatted(const UPluralRules*, const struct UFormattedNumber*, UChar*, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">ureldatefmt.h</td><td class="proto">UFormattedRelativeDateTime* ureldatefmt_openResult(UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">ureldatefmt.h</td><td class="proto">const UFormattedValue* ureldatefmt_resultAsValue(const UFormattedRelativeDateTime*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">ureldatefmt.h</td><td class="proto"><tt>enum</tt> URelativeDateTimeFormatterField::UDAT_REL_LITERAL_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">ureldatefmt.h</td><td class="proto"><tt>enum</tt> URelativeDateTimeFormatterField::UDAT_REL_NUMERIC_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">ureldatefmt.h</td><td class="proto">void ureldatefmt_closeResult(UFormattedRelativeDateTime*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">ureldatefmt.h</td><td class="proto">void ureldatefmt_formatNumericToResult(const URelativeDateTimeFormatter*, double, URelativeDateTimeUnit, UFormattedRelativeDateTime*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">ureldatefmt.h</td><td class="proto">void ureldatefmt_formatToResult(const URelativeDateTimeFormatter*, double, URelativeDateTimeUnit, UFormattedRelativeDateTime*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+</table>
+<P></P>
+<a href="#_top">(jump back to top)</a>
+<hr>
+<a name="promoted"></a>
+<h2>Promoted to stable in ICU 67</h2>
+<table BORDER="1" class="genTable">
+<THEAD>
+<tr>
+<th>File</th><th>API</th><th>ICU 66</th><th>ICU 67</th>
+</tr>
+</THEAD>
+<tr class="row1">
+<td class="file">currunit.h</td><td class="proto">icu::CurrencyUnit::CurrencyUnit(StringPiece, UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">decimfmt.h</td><td class="proto">UBool icu::DecimalFormat::isFormatFailIfMoreThanMaxDigits() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">decimfmt.h</td><td class="proto">UBool icu::DecimalFormat::isParseCaseSensitive() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">decimfmt.h</td><td class="proto">UBool icu::DecimalFormat::isParseNoExponent() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">decimfmt.h</td><td class="proto">UBool icu::DecimalFormat::isSignAlwaysShown() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">decimfmt.h</td><td class="proto">const number::LocalizedNumberFormatter* icu::DecimalFormat::toNumberFormatter(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">decimfmt.h</td><td class="proto">int32_t icu::DecimalFormat::getMinimumGroupingDigits() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setFormatFailIfMoreThanMaxDigits(UBool)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setMinimumGroupingDigits(int32_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setParseCaseSensitive(UBool)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setParseNoExponent(UBool)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">decimfmt.h</td><td class="proto">void icu::DecimalFormat::setSignAlwaysShown(UBool)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">dtitvfmt.h</td><td class="proto">Appendable&amp; icu::FormattedDateInterval::appendTo(Appendable&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">dtitvfmt.h</td><td class="proto">FormattedDateInterval icu::DateIntervalFormat::formatToValue(Calendar&amp;, Calendar&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">dtitvfmt.h</td><td class="proto">FormattedDateInterval icu::DateIntervalFormat::formatToValue(const DateInterval&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">dtitvfmt.h</td><td class="proto">FormattedDateInterval&amp; icu::FormattedDateInterval::operator=(FormattedDateInterval&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">dtitvfmt.h</td><td class="proto">UBool icu::FormattedDateInterval::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">dtitvfmt.h</td><td class="proto">UnicodeString icu::FormattedDateInterval::toString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">dtitvfmt.h</td><td class="proto">UnicodeString icu::FormattedDateInterval::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">dtitvfmt.h</td><td class="proto">icu::FormattedDateInterval::FormattedDateInterval()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">dtitvfmt.h</td><td class="proto">icu::FormattedDateInterval::FormattedDateInterval(FormattedDateInterval&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">dtitvfmt.h</td><td class="proto">icu::FormattedDateInterval::~FormattedDateInterval()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">formattedvalue.h</td><td class="proto">Appendable&amp; icu::FormattedValue::appendTo(Appendable&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">formattedvalue.h</td><td class="proto">UBool icu::ConstrainedFieldPosition::matchesField(int32_t, int32_t) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">formattedvalue.h</td><td class="proto">UBool icu::FormattedValue::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">formattedvalue.h</td><td class="proto">UnicodeString icu::FormattedValue::toString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">formattedvalue.h</td><td class="proto">UnicodeString icu::FormattedValue::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">formattedvalue.h</td><td class="proto">icu::ConstrainedFieldPosition::ConstrainedFieldPosition()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">formattedvalue.h</td><td class="proto">icu::ConstrainedFieldPosition::~ConstrainedFieldPosition()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">formattedvalue.h</td><td class="proto">icu::FormattedValue::~FormattedValue()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">formattedvalue.h</td><td class="proto">int32_t icu::ConstrainedFieldPosition::getCategory() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">formattedvalue.h</td><td class="proto">int32_t icu::ConstrainedFieldPosition::getField() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">formattedvalue.h</td><td class="proto">int32_t icu::ConstrainedFieldPosition::getLimit() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">formattedvalue.h</td><td class="proto">int32_t icu::ConstrainedFieldPosition::getStart() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">formattedvalue.h</td><td class="proto">int64_t icu::ConstrainedFieldPosition::getInt64IterationContext() const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::constrainCategory(int32_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::constrainField(int32_t, int32_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::reset()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::setInt64IterationContext(int64_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">formattedvalue.h</td><td class="proto">void icu::ConstrainedFieldPosition::setState(int32_t, int32_t, int32_t, int32_t)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">listformatter.h</td><td class="proto">Appendable&amp; icu::FormattedList::appendTo(Appendable&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">listformatter.h</td><td class="proto">FormattedList icu::ListFormatter::formatStringsToValue(const UnicodeString items[], int32_t, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">listformatter.h</td><td class="proto">FormattedList&amp; icu::FormattedList::operator=(FormattedList&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">listformatter.h</td><td class="proto">UBool icu::FormattedList::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">listformatter.h</td><td class="proto">UnicodeString icu::FormattedList::toString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">listformatter.h</td><td class="proto">UnicodeString icu::FormattedList::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">listformatter.h</td><td class="proto">icu::FormattedList::FormattedList()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">listformatter.h</td><td class="proto">icu::FormattedList::FormattedList(FormattedList&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">listformatter.h</td><td class="proto">icu::FormattedList::~FormattedList()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localebuilder.h</td><td class="proto">Locale icu::LocaleBuilder::build(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::addUnicodeLocaleAttribute(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::clear()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::clearExtensions()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::removeUnicodeLocaleAttribute(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setExtension(char, StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setLanguage(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setLanguageTag(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setLocale(const Locale&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setRegion(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setScript(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setUnicodeLocaleKeyword(StringPiece, StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localebuilder.h</td><td class="proto">LocaleBuilder&amp; icu::LocaleBuilder::setVariant(StringPiece)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localebuilder.h</td><td class="proto">icu::LocaleBuilder::LocaleBuilder()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localebuilder.h</td><td class="proto">icu::LocaleBuilder::~LocaleBuilder()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localpointer.h</td><td class="proto">LocalArray&lt;T&gt;&amp; icu::LocalArray&lt; T &gt;::operator=(std::unique_ptr&lt; T[]&gt;&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localpointer.h</td><td class="proto">LocalPointer&lt;T&gt;&amp; icu::LocalPointer&lt; T &gt;::operator=(std::unique_ptr&lt; T &gt;&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localpointer.h</td><td class="proto">icu::LocalArray&lt; T &gt;::LocalArray(std::unique_ptr&lt; T[]&gt;&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localpointer.h</td><td class="proto">icu::LocalArray&lt; T &gt;::operator std::unique_ptr&lt; T[]&gt;() &amp;&amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">localpointer.h</td><td class="proto">icu::LocalPointer&lt; T &gt;::LocalPointer(std::unique_ptr&lt; T &gt;&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">localpointer.h</td><td class="proto">icu::LocalPointer&lt; T &gt;::operator std::unique_ptr&lt; T &gt;() &amp;&amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAcre()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAcreFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAmpere()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getArcMinute()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getArcSecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAstronomicalUnit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getAtmosphere()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getBarrel()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getBit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getBritishThermalUnit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getBushel()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getByte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCalorie()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCarat()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCelsius()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCentiliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCentimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCentury()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicCentimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicInch()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicKilometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicMeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicMile()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCubicYard()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCup()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getCupMetric()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDalton()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDay()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDayPerson()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDeciliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDecimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDegree()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDunam()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getEarthMass()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getElectronvolt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFahrenheit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFathom()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFluidOunce()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFluidOunceImperial()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFoodcalorie()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getFurlong()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGForce()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGallon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGallonImperial()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGenericTemperature()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGigabit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGigabyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGigahertz()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGigawatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getGram()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHectare()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHectoliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHectopascal()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHertz()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHorsepower()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getHour()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getInch()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getInchHg()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getJoule()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKarat()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKelvin()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilobit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilobyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilocalorie()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilogram()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilohertz()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilojoule()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilometerPerHour()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilopascal()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilowatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKilowattHour()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getKnot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLightYear()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLiter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLiterPer100Kilometers()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLiterPerKilometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getLux()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegabit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegabyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegahertz()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegaliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegapascal()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegawatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMeterPerSecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMeterPerSecondSquared()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMetricTon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMicrogram()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMicrometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMicrosecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMile()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilePerGallon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilePerGallonImperial()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilePerHour()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMileScandinavian()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilliampere()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillibar()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilligram()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilligramPerDeciliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilliliter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillimeterOfMercury()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillimolePerLiter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMillisecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMilliwatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMinute()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMole()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMonth()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMonthPerson()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNanometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNanosecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNauticalMile()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNewton()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getNewtonMeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getOhm()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getOunce()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getOunceTroy()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getParsec()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPartPerMillion()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPercent()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPermille()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPermyriad()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPetabyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPicometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPint()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPintMetric()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPoint()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPound()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPoundFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPoundForce()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPoundPerSquareInch()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getQuart()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getRadian()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getRevolutionAngle()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSecond()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSolarLuminosity()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSolarMass()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSolarRadius()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareCentimeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareFoot()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareInch()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareKilometer()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareMeter()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareMile()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getSquareYard()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getStone()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTablespoon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTeaspoon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTerabit()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTerabyte()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getTon()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getVolt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getWatt()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getWeek()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getWeekPerson()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getYard()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getYear()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getYearPerson()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createBarrel(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createBritishThermalUnit(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createDalton(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createDayPerson(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createDunam(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createEarthMass(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createElectronvolt(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createFluidOunceImperial(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createKilopascal(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createMegapascal(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createMole(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createMonthPerson(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createNewton(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createNewtonMeter(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPermyriad(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPoundFoot(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPoundForce(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createSolarLuminosity(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createSolarMass(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createSolarRadius(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createWeekPerson(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createYearPerson(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">numberformatter.h</td><td class="proto">LocalPointer&lt;Derived&gt; icu::number::NumberFormatterSettings&lt; Derived &gt;::clone() &amp;&amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">numberformatter.h</td><td class="proto">LocalPointer&lt;Derived&gt; icu::number::NumberFormatterSettings&lt; Derived &gt;::clone() const &amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">numberformatter.h</td><td class="proto">UBool icu::number::FormattedNumber::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">numberformatter.h</td><td class="proto">UnicodeString icu::number::FormattedNumber::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">numberformatter.h</td><td class="proto">icu::number::FormattedNumber::FormattedNumber()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">numberformatter.h</td><td class="proto"><tt>static</tt> UnlocalizedNumberFormatter icu::number::NumberFormatter::forSkeleton(const UnicodeString&amp;, UParseError&amp;, UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">numberrangeformatter.h</td><td class="proto">LocalPointer&lt;Derived&gt; icu::number::NumberRangeFormatterSettings&lt; Derived &gt;::clone() &amp;&amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">numberrangeformatter.h</td><td class="proto">LocalPointer&lt;Derived&gt; icu::number::NumberRangeFormatterSettings&lt; Derived &gt;::clone() const &amp;</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">numberrangeformatter.h</td><td class="proto">UBool icu::number::FormattedNumberRange::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">numberrangeformatter.h</td><td class="proto">UnicodeString icu::number::FormattedNumberRange::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">numfmt.h</td><td class="proto"><tt>enum</tt> icu::NumberFormat::EAlignmentFields::kCompactField</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">numfmt.h</td><td class="proto"><tt>enum</tt> icu::NumberFormat::EAlignmentFields::kMeasureUnitField</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">numsys.h</td><td class="proto">NumberingSystem&amp; icu::NumberingSystem::operator=(const NumberingSystem&amp;)=default</td><td class="">(missing)</td><td>Stable<br>
+<span class=""><span>ICU 4.2</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">plurrule.h</td><td class="proto">UnicodeString icu::PluralRules::select(const number::FormattedNumber&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">reldatefmt.h</td><td class="proto">Appendable&amp; icu::FormattedRelativeDateTime::appendTo(Appendable&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime icu::RelativeDateTimeFormatter::formatNumericToValue(double, URelativeDateTimeUnit, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime icu::RelativeDateTimeFormatter::formatToValue(UDateDirection, UDateAbsoluteUnit, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime icu::RelativeDateTimeFormatter::formatToValue(double, UDateDirection, UDateRelativeUnit, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime icu::RelativeDateTimeFormatter::formatToValue(double, URelativeDateTimeUnit, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">reldatefmt.h</td><td class="proto">FormattedRelativeDateTime&amp; icu::FormattedRelativeDateTime::operator=(FormattedRelativeDateTime&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">reldatefmt.h</td><td class="proto">UBool icu::FormattedRelativeDateTime::nextPosition(ConstrainedFieldPosition&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">reldatefmt.h</td><td class="proto">UnicodeString icu::FormattedRelativeDateTime::toString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">reldatefmt.h</td><td class="proto">UnicodeString icu::FormattedRelativeDateTime::toTempString(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">reldatefmt.h</td><td class="proto">icu::FormattedRelativeDateTime::FormattedRelativeDateTime()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">reldatefmt.h</td><td class="proto">icu::FormattedRelativeDateTime::FormattedRelativeDateTime(FormattedRelativeDateTime&amp;&amp;)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">reldatefmt.h</td><td class="proto">icu::FormattedRelativeDateTime::~FormattedRelativeDateTime()</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">udateintervalformat.h</td><td class="proto">UFormattedDateInterval* udtitvfmt_openResult(UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">udateintervalformat.h</td><td class="proto">const UFormattedValue* udtitvfmt_resultAsValue(const UFormattedDateInterval*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">udateintervalformat.h</td><td class="proto">void udtitvfmt_closeResult(UFormattedDateInterval*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto">UBool ucfpos_matchesField(const UConstrainedFieldPosition*, int32_t, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto">UBool ufmtval_nextPosition(const UFormattedValue*, UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto">UConstrainedFieldPosition* ucfpos_open(UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto">const UChar* ufmtval_getString(const UFormattedValue*, int32_t*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_DATE_INTERVAL_SPAN</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_DATE</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_LIST_SPAN</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_LIST</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_NUMBER</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_RELATIVE_DATETIME</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto"><tt>enum</tt> UFieldCategory::UFIELD_CATEGORY_UNDEFINED</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto">int32_t ucfpos_getCategory(const UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto">int32_t ucfpos_getField(const UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto">int64_t ucfpos_getInt64IterationContext(const UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_close(UConstrainedFieldPosition*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_constrainCategory(UConstrainedFieldPosition*, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_constrainField(UConstrainedFieldPosition*, int32_t, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_getIndexes(const UConstrainedFieldPosition*, int32_t*, int32_t*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_reset(UConstrainedFieldPosition*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_setInt64IterationContext(UConstrainedFieldPosition*, int64_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">uformattedvalue.h</td><td class="proto">void ucfpos_setState(UConstrainedFieldPosition*, int32_t, int32_t, int32_t, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">ulistformatter.h</td><td class="proto">UFormattedList* ulistfmt_openResult(UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">ulistformatter.h</td><td class="proto">const UFormattedValue* ulistfmt_resultAsValue(const UFormattedList*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterField::ULISTFMT_ELEMENT_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 63</td>
+</tr>
+<tr class="row1">
+<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterField::ULISTFMT_LITERAL_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 63</td>
+</tr>
+<tr class="row0">
+<td class="file">ulistformatter.h</td><td class="proto">void ulistfmt_closeResult(UFormattedList*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">ulistformatter.h</td><td class="proto">void ulistfmt_formatStringsToResult(const UListFormatter*, const UChar* const strings[], const int32_t*, int32_t, UFormattedList*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatAttribute::UNUM_MINIMUM_GROUPING_DIGITS</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatAttribute::UNUM_PARSE_CASE_SENSITIVE</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatAttribute::UNUM_SIGN_ALWAYS_SHOWN</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatFields::UNUM_COMPACT_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">unum.h</td><td class="proto"><tt>enum</tt> UNumberFormatFields::UNUM_MEASURE_UNIT_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">unumberformatter.h</td><td class="proto">UNumberFormatter* unumf_openForSkeletonAndLocaleWithError(const UChar*, int32_t, const char*, UParseError*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">unumberformatter.h</td><td class="proto">const UFormattedValue* unumf_resultAsValue(const UFormattedNumber*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">upluralrules.h</td><td class="proto">int32_t uplrules_selectFormatted(const UPluralRules*, const struct UFormattedNumber*, UChar*, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">ureldatefmt.h</td><td class="proto">UFormattedRelativeDateTime* ureldatefmt_openResult(UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">ureldatefmt.h</td><td class="proto">const UFormattedValue* ureldatefmt_resultAsValue(const UFormattedRelativeDateTime*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">ureldatefmt.h</td><td class="proto"><tt>enum</tt> URelativeDateTimeFormatterField::UDAT_REL_LITERAL_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">ureldatefmt.h</td><td class="proto"><tt>enum</tt> URelativeDateTimeFormatterField::UDAT_REL_NUMERIC_FIELD</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">ureldatefmt.h</td><td class="proto">void ureldatefmt_closeResult(UFormattedRelativeDateTime*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row1">
+<td class="file">ureldatefmt.h</td><td class="proto">void ureldatefmt_formatNumericToResult(const URelativeDateTimeFormatter*, double, URelativeDateTimeUnit, UFormattedRelativeDateTime*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+<tr class="row0">
+<td class="file">ureldatefmt.h</td><td class="proto">void ureldatefmt_formatToResult(const URelativeDateTimeFormatter*, double, URelativeDateTimeUnit, UFormattedRelativeDateTime*, UErrorCode*)</td><td class="" colspan="2" align="center">Draft&rarr;Stable<br>ICU 64</td>
+</tr>
+</table>
+<P></P>
+<a href="#_top">(jump back to top)</a>
+<hr>
+<a name="added"></a>
+<h2>Added in ICU 67</h2>
+<table BORDER="1" class="genTable">
+<THEAD>
+<tr>
+<th>File</th><th>API</th><th>ICU 66</th><th>ICU 67</th>
+</tr>
+</THEAD>
+<tr class="row1">
+<td class="file">bytestream.h</td><td class="proto">void icu::ByteSink::AppendU8(const char*, int32_t)</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">bytestream.h</td><td class="proto">void icu::ByteSink::AppendU8(const char8_t*, int32_t)</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">dcfmtsym.h</td><td class="proto">void icu::DecimalFormatSymbols::setCurrency(const UChar*, UErrorCode&amp;)</td><td class="">(missing)</td><td>Internal<br>
+<span class=""><span></span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">dtptngen.h</td><td class="proto">UDateFormatHourCycle icu::DateTimePatternGenerator::getDefaultHourCycle(UErrorCode&amp;) const</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">listformatter.h</td><td class="proto"><tt>static</tt> ListFormatter* icu::ListFormatter::createInstance(const Locale&amp;, UListFormatterType, UListFormatterWidth, UErrorCode&amp;)</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::setDirection(ULocMatchDirection)</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">localematcher.h</td><td class="proto"><tt>enum</tt> ULocMatchDirection::ULOCMATCH_DIRECTION_ONLY_TWO_WAY</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto"><tt>enum</tt> ULocMatchDirection::ULOCMATCH_DIRECTION_WITH_ONE_WAY</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">locid.h</td><td class="proto">void icu::Locale::canonicalize(UErrorCode&amp;)</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto">LocalArray&lt;MeasureUnit&gt; icu::MeasureUnit::splitToSingleUnits(int32_t&amp;, UErrorCode&amp;) const</td><td class="">(missing)</td><td>Internal<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto">MeasureUnit icu::MeasureUnit::product(const MeasureUnit&amp;, UErrorCode&amp;) const</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto">MeasureUnit icu::MeasureUnit::reciprocal(UErrorCode&amp;) const</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto">MeasureUnit icu::MeasureUnit::withDimensionality(int32_t, UErrorCode&amp;) const</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto">MeasureUnit icu::MeasureUnit::withSIPrefix(UMeasureSIPrefix, UErrorCode&amp;) const</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto">MeasureUnit&amp; icu::MeasureUnit::operator=(MeasureUnit&amp;&amp;) noexcept</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto">UMeasureSIPrefix icu::MeasureUnit::getSIPrefix(UErrorCode&amp;) const</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto">UMeasureUnitComplexity icu::MeasureUnit::getComplexity(UErrorCode&amp;) const</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto">const char* icu::MeasureUnit::getIdentifier() const</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto">icu::MeasureUnit::MeasureUnit(MeasureUnit&amp;&amp;) noexcept</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto">int32_t icu::MeasureUnit::getDimensionality(UErrorCode&amp;) const</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::forIdentifier(StringPiece, UErrorCode&amp;)</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">numsys.h</td><td class="proto">NumberingSystem&amp; icu::NumberingSystem::operator=(const NumberingSystem&amp;)=default</td><td class="">(missing)</td><td>Stable<br>
+<span class=""><span>ICU 4.2</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">stringpiece.h</td><td class="proto">icu::StringPiece::StringPiece(const char8_t*)</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">stringpiece.h</td><td class="proto">icu::StringPiece::StringPiece(const char8_t*, int32_t)</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">stringpiece.h</td><td class="proto">icu::StringPiece::StringPiece(const std::u8string&amp;)</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">stringpiece.h</td><td class="proto">icu::StringPiece::StringPiece(std::nullptr_t)</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">stringpiece.h</td><td class="proto">int32_t icu::StringPiece::compare(StringPiece)</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">stringpiece.h</td><td class="proto">int32_t icu::StringPiece::find(StringPiece, int32_t)</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">stringpiece.h</td><td class="proto">void icu::StringPiece::set(const char8_t*)</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">stringpiece.h</td><td class="proto">void icu::StringPiece::set(const char8_t*, int32_t)</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">udat.h</td><td class="proto"><tt>enum</tt> UDateFormatHourCycle::UDAT_HOUR_CYCLE_11</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">udat.h</td><td class="proto"><tt>enum</tt> UDateFormatHourCycle::UDAT_HOUR_CYCLE_12</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">udat.h</td><td class="proto"><tt>enum</tt> UDateFormatHourCycle::UDAT_HOUR_CYCLE_23</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">udat.h</td><td class="proto"><tt>enum</tt> UDateFormatHourCycle::UDAT_HOUR_CYCLE_24</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">udateintervalformat.h</td><td class="proto">void udtitvfmt_formatCalendarToResult(const UDateIntervalFormat*, UCalendar*, UCalendar*, UFormattedDateInterval*, UErrorCode*)</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">udateintervalformat.h</td><td class="proto">void udtitvfmt_formatToResult(const UDateIntervalFormat*, UDate, UDate, UFormattedDateInterval*, UErrorCode*)</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">udatpg.h</td><td class="proto">UDateFormatHourCycle udatpg_getDefaultHourCycle(const UDateTimePatternGenerator*, UErrorCode*)</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">ulistformatter.h</td><td class="proto">UListFormatter* ulistfmt_openForType(const char*, UListFormatterType, UListFormatterWidth, UErrorCode*)</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterType::ULISTFMT_TYPE_AND</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterType::ULISTFMT_TYPE_OR</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterType::ULISTFMT_TYPE_UNITS</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterWidth::ULISTFMT_WIDTH_NARROW</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterWidth::ULISTFMT_WIDTH_SHORT</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">ulistformatter.h</td><td class="proto"><tt>enum</tt> UListFormatterWidth::ULISTFMT_WIDTH_WIDE</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UBRK_CREATE_BREAK_ENGINE</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UBRK_CREATE_CHARACTER</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UBRK_CREATE_LINE</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UBRK_CREATE_SENTENCE</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UBRK_CREATE_TITLE</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UBRK_CREATE_WORD</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+<tr class="row1">
+<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UBRK_LIMIT</td><td class="">(missing)</td><td>Internal<br>
+<span class=""><span></span></span></td>
+</tr>
+<tr class="row0">
+<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UBRK_START</td><td class="">(missing)</td><td>Draft<br>
+<span class=""><span>ICU 67</span></span></td>
+</tr>
+</table>
+<P></P>
+<a href="#_top">(jump back to top)</a>
+<hr>
+<a name="other"></a>
+<h2>Other existing drafts in ICU 67</h2>
+<div class="other">
+<table BORDER="1" class="genTable">
+<THEAD>
+<tr>
+<th>File</th><th>API</th><th>ICU 66</th><th>ICU 67</th>
+</tr>
+</THEAD>
+<tr class="row1">
+<td class="file">bytestrie.h</td><td class="proto">BytesTrie&amp; icu::BytesTrie::resetToState64(uint64_t)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">bytestrie.h</td><td class="proto">uint64_t icu::BytesTrie::getState64() const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">localebuilder.h</td><td class="proto">UBool icu::LocaleBuilder::copyErrorTo(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::addSupportedLocale(const Locale&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::operator=(Builder&amp;&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::setDefaultLocale(const Locale*)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::setDemotionPerDesiredLocale(ULocMatchDemotion)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::setFavorSubtag(ULocMatchFavorSubtag)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::setSupportedLocales(Iter, Iter)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::setSupportedLocales(Locale::Iterator&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::setSupportedLocalesFromListString(StringPiece)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto">Builder&amp; icu::LocaleMatcher::Builder::setSupportedLocalesViaConverter(Iter, Iter, Conv)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">localematcher.h</td><td class="proto">Locale icu::LocaleMatcher::Result::makeResolvedLocale(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto">LocaleMatcher icu::LocaleMatcher::Builder::build(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">localematcher.h</td><td class="proto">LocaleMatcher&amp; icu::LocaleMatcher::operator=(LocaleMatcher&amp;&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto">Result icu::LocaleMatcher::getBestMatchResult(Locale::Iterator&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">localematcher.h</td><td class="proto">Result icu::LocaleMatcher::getBestMatchResult(const Locale&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto">Result&amp; icu::LocaleMatcher::Result::operator=(Result&amp;&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">localematcher.h</td><td class="proto">UBool icu::LocaleMatcher::Builder::copyErrorTo(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto">const Locale* icu::LocaleMatcher::Result::getDesiredLocale() const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">localematcher.h</td><td class="proto">const Locale* icu::LocaleMatcher::Result::getSupportedLocale() const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto">const Locale* icu::LocaleMatcher::getBestMatch(Locale::Iterator&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">localematcher.h</td><td class="proto">const Locale* icu::LocaleMatcher::getBestMatch(const Locale&amp;, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto">const Locale* icu::LocaleMatcher::getBestMatchForListString(StringPiece, UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">localematcher.h</td><td class="proto"><tt>enum</tt> ULocMatchDemotion::ULOCMATCH_DEMOTION_NONE</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto"><tt>enum</tt> ULocMatchDemotion::ULOCMATCH_DEMOTION_REGION</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">localematcher.h</td><td class="proto"><tt>enum</tt> ULocMatchFavorSubtag::ULOCMATCH_FAVOR_LANGUAGE</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto"><tt>enum</tt> ULocMatchFavorSubtag::ULOCMATCH_FAVOR_SCRIPT</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">localematcher.h</td><td class="proto">icu::LocaleMatcher::Builder::Builder()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto">icu::LocaleMatcher::Builder::Builder(Builder&amp;&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">localematcher.h</td><td class="proto">icu::LocaleMatcher::Builder::~Builder()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto">icu::LocaleMatcher::LocaleMatcher(LocaleMatcher&amp;&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">localematcher.h</td><td class="proto">icu::LocaleMatcher::Result::Result(Result&amp;&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto">icu::LocaleMatcher::Result::~Result()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">localematcher.h</td><td class="proto">icu::LocaleMatcher::~LocaleMatcher()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">localematcher.h</td><td class="proto">int32_t icu::LocaleMatcher::Result::getDesiredIndex() const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">localematcher.h</td><td class="proto">int32_t icu::LocaleMatcher::Result::getSupportedIndex() const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">locid.h</td><td class="proto">UBool icu::Locale::ConvertingIterator&lt; Iter, Conv &gt;::hasNext() const override</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">locid.h</td><td class="proto">UBool icu::Locale::Iterator::hasNext() const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">locid.h</td><td class="proto">UBool icu::Locale::RangeIterator&lt; Iter &gt;::hasNext() const override</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">locid.h</td><td class="proto">const Locale&amp; icu::Locale::ConvertingIterator&lt; Iter, Conv &gt;::next() override</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">locid.h</td><td class="proto">const Locale&amp; icu::Locale::Iterator::next()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">locid.h</td><td class="proto">const Locale&amp; icu::Locale::RangeIterator&lt; Iter &gt;::next() override</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">locid.h</td><td class="proto">icu::Locale::ConvertingIterator&lt; Iter, Conv &gt;::ConvertingIterator(Iter, Iter, Conv)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">locid.h</td><td class="proto">icu::Locale::Iterator::~Iterator()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">locid.h</td><td class="proto">icu::Locale::RangeIterator&lt; Iter &gt;::RangeIterator(Iter, Iter)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">measfmt.h</td><td class="proto">void icu::MeasureFormat::parseObject(const UnicodeString&amp;, Formattable&amp;, ParsePosition&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 53</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getBar()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDecade()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDotPerCentimeter()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getDotPerInch()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getEm()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getMegapixel()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPascal()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPixel()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPixelPerCentimeter()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getPixelPerInch()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit icu::MeasureUnit::getThermUs()</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createBar(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createDecade(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createDotPerCentimeter(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createDotPerInch(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createEm(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createMegapixel(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPascal(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPixel(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPixelPerCentimeter(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createPixelPerInch(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">measunit.h</td><td class="proto"><tt>static</tt> MeasureUnit* icu::MeasureUnit::createThermUs(UErrorCode&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">nounit.h</td><td class="proto">UClassID icu::NoUnit::getDynamicClassID() const</td><td class="" colspan="2" align="center">Draft<br>ICU 60</td>
+</tr>
+<tr class="row1">
+<td class="file">nounit.h</td><td class="proto">icu::NoUnit::NoUnit(const NoUnit&amp;)</td><td class="" colspan="2" align="center">Draft<br>ICU 60</td>
+</tr>
+<tr class="row0">
+<td class="file">nounit.h</td><td class="proto">icu::NoUnit::~NoUnit()</td><td class="" colspan="2" align="center">Draft<br>ICU 60</td>
+</tr>
+<tr class="row1">
+<td class="file">nounit.h</td><td class="proto"><tt>static</tt> NoUnit icu::NoUnit::base()</td><td class="" colspan="2" align="center">Draft<br>ICU 60</td>
+</tr>
+<tr class="row0">
+<td class="file">nounit.h</td><td class="proto"><tt>static</tt> NoUnit icu::NoUnit::percent()</td><td class="" colspan="2" align="center">Draft<br>ICU 60</td>
+</tr>
+<tr class="row1">
+<td class="file">nounit.h</td><td class="proto"><tt>static</tt> NoUnit icu::NoUnit::permille()</td><td class="" colspan="2" align="center">Draft<br>ICU 60</td>
+</tr>
+<tr class="row0">
+<td class="file">nounit.h</td><td class="proto"><tt>static</tt> UClassID icu::NoUnit::getStaticClassID()</td><td class="" colspan="2" align="center">Draft<br>ICU 60</td>
+</tr>
+<tr class="row1">
+<td class="file">nounit.h</td><td class="proto">void* icu::NoUnit::clone() const</td><td class="" colspan="2" align="center">Draft<br>ICU 60</td>
+</tr>
+<tr class="row0">
+<td class="file">numberformatter.h</td><td class="proto">StringClass icu::number::FormattedNumber::toDecimalNumber(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">numberrangeformatter.h</td><td class="proto">UnicodeString icu::number::FormattedNumberRange::getFirstDecimal(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 63</td>
+</tr>
+<tr class="row0">
+<td class="file">numberrangeformatter.h</td><td class="proto">UnicodeString icu::number::FormattedNumberRange::getSecondDecimal(UErrorCode&amp;) const</td><td class="" colspan="2" align="center">Draft<br>ICU 63</td>
+</tr>
+<tr class="row1">
+<td class="file">reldatefmt.h</td><td class="proto"><tt>enum</tt> UDateAbsoluteUnit::UDAT_ABSOLUTE_HOUR</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">reldatefmt.h</td><td class="proto"><tt>enum</tt> UDateAbsoluteUnit::UDAT_ABSOLUTE_MINUTE</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">stringpiece.h</td><td class="proto">icu::StringPiece::StringPiece(T)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">ucal.h</td><td class="proto">int32_t ucal_getHostTimeZone(UChar*, int32_t, UErrorCode*)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">ucharstrie.h</td><td class="proto">UCharsTrie&amp; icu::UCharsTrie::resetToState64(uint64_t)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">ucharstrie.h</td><td class="proto">uint64_t icu::UCharsTrie::getState64() const</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">uloc.h</td><td class="proto">UEnumeration* uloc_openAvailableByType(ULocAvailableType, UErrorCode*)</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">uloc.h</td><td class="proto"><tt>enum</tt> ULocAvailableType::ULOC_AVAILABLE_DEFAULT</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">uloc.h</td><td class="proto"><tt>enum</tt> ULocAvailableType::ULOC_AVAILABLE_ONLY_LEGACY_ALIASES</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">uloc.h</td><td class="proto"><tt>enum</tt> ULocAvailableType::ULOC_AVAILABLE_WITH_LEGACY_ALIASES</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">uregex.h</td><td class="proto"><tt>enum</tt> URegexpFlag::UREGEX_CANON_EQ</td><td class="" colspan="2" align="center">Draft<br>ICU 2.4</td>
+</tr>
+<tr class="row0">
+<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UDATA_BUNDLE</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UDATA_DATA_FILE</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UDATA_RESOURCE</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row1">
+<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UDATA_RES_FILE</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+<tr class="row0">
+<td class="file">utrace.h</td><td class="proto"><tt>enum</tt> UTraceFunctionNumber::UTRACE_UDATA_START</td><td class="" colspan="2" align="center">Draft<br>ICU 65</td>
+</tr>
+</table>
+</div>
+<P></P>
+<a href="#_top">(jump back to top)</a>
+<hr>
+<a name="simplifications"></a>
+<h2>Signature Simplifications</h2>
+<i>This section shows cases where the signature was "simplified" for the sake of comparison. The simplified form is in bold, followed by
+ all possible variations in "original" form.</i>
+<div class="other">
+<ul></ul>
+</div>
+<P></P>
+<a href="#_top">(jump back to top)</a>
+<hr>
+<p>
+<i><font size="-1">Contents generated by StableAPI tool on Fri Apr 03 07:26:43 PDT 2020<br>
+ Copyright &copy; 2017 and later: Unicode, Inc. and others.<br>
+ License &amp; terms of use: http://www.unicode.org/copyright.html
+ </font></i>
+</p>
+</body>
+</html>
diff --git a/contrib/libs/icu/LICENSE b/contrib/libs/icu/LICENSE
index 82ee5542b7..e7f98ed183 100644
--- a/contrib/libs/icu/LICENSE
+++ b/contrib/libs/icu/LICENSE
@@ -1,414 +1,414 @@
-COPYRIGHT AND PERMISSION NOTICE (ICU 58 and later)
-
-Copyright © 1991-2020 Unicode, Inc. All rights reserved.
-Distributed under the Terms of Use in https://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
-(the "Data Files") or Unicode software and any associated documentation
-(the "Software") to deal in the Data Files or Software
-without restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, and/or sell copies of
-the Data Files or Software, and to permit persons to whom the Data Files
-or Software are furnished to do so, provided that either
-(a) this copyright and permission notice appear with all copies
-of the Data Files or Software, or
-(b) this copyright and permission notice appear in associated
-Documentation.
-
-THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
-ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT OF THIRD PARTY RIGHTS.
-IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
-NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
-DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THE DATA FILES OR SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale,
-use or other dealings in these Data Files or Software without prior
-written authorization of the copyright holder.
-
----------------------
-
-Third-Party Software Licenses
-
-This section contains third-party software notices and/or additional
-terms for licensed third-party software components included within ICU
-libraries.
-
-1. ICU License - ICU 1.8.1 to ICU 57.1
-
-COPYRIGHT AND PERMISSION NOTICE
-
-Copyright (c) 1995-2016 International Business Machines Corporation and others
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
-SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-All trademarks and registered trademarks mentioned herein are the
-property of their respective owners.
-
-2. Chinese/Japanese Word Break Dictionary Data (cjdict.txt)
-
- # The Google Chrome software developed by Google is licensed under
- # the BSD license. Other software included in this distribution is
- # provided under other licenses, as set forth below.
- #
- # The BSD License
- # http://opensource.org/licenses/bsd-license.php
- # Copyright (C) 2006-2008, Google Inc.
- #
- # 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.
- #
- #
- # The word list in cjdict.txt are generated by combining three word lists
- # listed below with further processing for compound word breaking. The
- # frequency is generated with an iterative training against Google web
- # corpora.
- #
- # * Libtabe (Chinese)
- # - https://sourceforge.net/project/?group_id=1519
- # - Its license terms and conditions are shown below.
- #
- # * IPADIC (Japanese)
- # - http://chasen.aist-nara.ac.jp/chasen/distribution.html
- # - Its license terms and conditions are shown below.
- #
- # ---------COPYING.libtabe ---- BEGIN--------------------
- #
- # /*
- # * Copyright (c) 1999 TaBE Project.
- # * Copyright (c) 1999 Pai-Hsiang Hsiao.
- # * 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 the TaBE Project 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
- # * REGENTS 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.
- # */
- #
- # /*
- # * Copyright (c) 1999 Computer Systems and Communication Lab,
- # * Institute of Information Science, Academia
- # * Sinica. 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 the Computer Systems and Communication Lab
- # * 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
- # * REGENTS 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.
- # */
- #
- # Copyright 1996 Chih-Hao Tsai @ Beckman Institute,
- # University of Illinois
- # c-tsai4@uiuc.edu http://casper.beckman.uiuc.edu/~c-tsai4
- #
- # ---------------COPYING.libtabe-----END--------------------------------
- #
- #
- # ---------------COPYING.ipadic-----BEGIN-------------------------------
- #
- # Copyright 2000, 2001, 2002, 2003 Nara Institute of Science
- # and Technology. All Rights Reserved.
- #
- # Use, reproduction, and distribution of this software is permitted.
- # Any copy of this software, whether in its original form or modified,
- # must include both the above copyright notice and the following
- # paragraphs.
- #
- # Nara Institute of Science and Technology (NAIST),
- # the copyright holders, disclaims all warranties with regard to this
- # software, including all implied warranties of merchantability and
- # fitness, in no event shall NAIST be liable for
- # any special, indirect or consequential damages or any damages
- # whatsoever resulting from loss of use, data or profits, whether in an
- # action of contract, negligence or other tortuous action, arising out
- # of or in connection with the use or performance of this software.
- #
- # A large portion of the dictionary entries
- # originate from ICOT Free Software. The following conditions for ICOT
- # Free Software applies to the current dictionary as well.
- #
- # Each User may also freely distribute the Program, whether in its
- # original form or modified, to any third party or parties, PROVIDED
- # that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear
- # on, or be attached to, the Program, which is distributed substantially
- # in the same form as set out herein and that such intended
- # distribution, if actually made, will neither violate or otherwise
- # contravene any of the laws and regulations of the countries having
- # jurisdiction over the User or the intended distribution itself.
- #
- # NO WARRANTY
- #
- # The program was produced on an experimental basis in the course of the
- # research and development conducted during the project and is provided
- # to users as so produced on an experimental basis. Accordingly, the
- # program is provided without any warranty whatsoever, whether express,
- # implied, statutory or otherwise. The term "warranty" used herein
- # includes, but is not limited to, any warranty of the quality,
- # performance, merchantability and fitness for a particular purpose of
- # the program and the nonexistence of any infringement or violation of
- # any right of any third party.
- #
- # Each user of the program will agree and understand, and be deemed to
- # have agreed and understood, that there is no warranty whatsoever for
- # the program and, accordingly, the entire risk arising from or
- # otherwise connected with the program is assumed by the user.
- #
- # Therefore, neither ICOT, the copyright holder, or any other
- # organization that participated in or was otherwise related to the
- # development of the program and their respective officials, directors,
- # officers and other employees shall be held liable for any and all
- # damages, including, without limitation, general, special, incidental
- # and consequential damages, arising out of or otherwise in connection
- # with the use or inability to use the program or any product, material
- # or result produced or otherwise obtained by using the program,
- # regardless of whether they have been advised of, or otherwise had
- # knowledge of, the possibility of such damages at any time during the
- # project or thereafter. Each user will be deemed to have agreed to the
- # foregoing by his or her commencement of use of the program. The term
- # "use" as used herein includes, but is not limited to, the use,
- # modification, copying and distribution of the program and the
- # production of secondary products from the program.
- #
- # In the case where the program, whether in its original form or
- # modified, was distributed or delivered to or received by a user from
- # any person, organization or entity other than ICOT, unless it makes or
- # grants independently of ICOT any specific warranty to the user in
- # writing, such person, organization or entity, will also be exempted
- # from and not be held liable to the user for any such damages as noted
- # above as far as the program is concerned.
- #
- # ---------------COPYING.ipadic-----END----------------------------------
-
-3. Lao Word Break Dictionary Data (laodict.txt)
-
- # 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
- # (copied below)
- #
- # This file is derived from the above dictionary, with slight
- # modifications.
- # ----------------------------------------------------------------------
- # Copyright (C) 2013 Brian Eugene Wilson, Robert Martin Campbell.
- # 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.
- #
- #
- # 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 HOLDER 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.
- # --------------------------------------------------------------------------
-
-4. Burmese Word Break Dictionary Data (burmesedict.txt)
-
- # Copyright (c) 2014 International Business Machines Corporation
- # and others. All Rights Reserved.
- #
- # This list is part of a project hosted at:
- # github.com/kanyawtech/myanmar-karen-word-lists
- #
- # --------------------------------------------------------------------------
- # Copyright (c) 2013, LeRoy Benjamin Sharon
- # 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 Myanmar Karen Word Lists, 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 HOLDER 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.
- # --------------------------------------------------------------------------
-
-5. Time Zone Database
-
- ICU uses the public domain data and code derived from Time Zone
-Database for its time zone support. The ownership of the TZ database
-is explained in BCP 175: Procedure for Maintaining the Time Zone
-Database section 7.
-
- # 7. Database Ownership
- #
- # The TZ database itself is not an IETF Contribution or an IETF
- # document. Rather it is a pre-existing and regularly updated work
- # that is in the public domain, and is intended to remain in the
- # public domain. Therefore, BCPs 78 [RFC5378] and 79 [RFC3979] do
- # not apply to the TZ Database or contributions that individuals make
- # to it. Should any claims be made and substantiated against the TZ
- # Database, the organization that is providing the IANA
- # Considerations defined in this RFC, under the memorandum of
- # understanding with the IETF, currently ICANN, may act in accordance
- # with all competent court orders. No ownership claims will be made
- # 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.
+COPYRIGHT AND PERMISSION NOTICE (ICU 58 and later)
+
+Copyright © 1991-2020 Unicode, Inc. All rights reserved.
+Distributed under the Terms of Use in https://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
+(the "Data Files") or Unicode software and any associated documentation
+(the "Software") to deal in the Data Files or Software
+without restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, and/or sell copies of
+the Data Files or Software, and to permit persons to whom the Data Files
+or Software are furnished to do so, provided that either
+(a) this copyright and permission notice appear with all copies
+of the Data Files or Software, or
+(b) this copyright and permission notice appear in associated
+Documentation.
+
+THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT OF THIRD PARTY RIGHTS.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
+NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
+DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THE DATA FILES OR SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale,
+use or other dealings in these Data Files or Software without prior
+written authorization of the copyright holder.
+
+---------------------
+
+Third-Party Software Licenses
+
+This section contains third-party software notices and/or additional
+terms for licensed third-party software components included within ICU
+libraries.
+
+1. ICU License - ICU 1.8.1 to ICU 57.1
+
+COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 1995-2016 International Business Machines Corporation and others
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+All trademarks and registered trademarks mentioned herein are the
+property of their respective owners.
+
+2. Chinese/Japanese Word Break Dictionary Data (cjdict.txt)
+
+ # The Google Chrome software developed by Google is licensed under
+ # the BSD license. Other software included in this distribution is
+ # provided under other licenses, as set forth below.
+ #
+ # The BSD License
+ # http://opensource.org/licenses/bsd-license.php
+ # Copyright (C) 2006-2008, Google Inc.
+ #
+ # 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.
+ #
+ #
+ # The word list in cjdict.txt are generated by combining three word lists
+ # listed below with further processing for compound word breaking. The
+ # frequency is generated with an iterative training against Google web
+ # corpora.
+ #
+ # * Libtabe (Chinese)
+ # - https://sourceforge.net/project/?group_id=1519
+ # - Its license terms and conditions are shown below.
+ #
+ # * IPADIC (Japanese)
+ # - http://chasen.aist-nara.ac.jp/chasen/distribution.html
+ # - Its license terms and conditions are shown below.
+ #
+ # ---------COPYING.libtabe ---- BEGIN--------------------
+ #
+ # /*
+ # * Copyright (c) 1999 TaBE Project.
+ # * Copyright (c) 1999 Pai-Hsiang Hsiao.
+ # * 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 the TaBE Project 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
+ # * REGENTS 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.
+ # */
+ #
+ # /*
+ # * Copyright (c) 1999 Computer Systems and Communication Lab,
+ # * Institute of Information Science, Academia
+ # * Sinica. 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 the Computer Systems and Communication Lab
+ # * 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
+ # * REGENTS 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.
+ # */
+ #
+ # Copyright 1996 Chih-Hao Tsai @ Beckman Institute,
+ # University of Illinois
+ # c-tsai4@uiuc.edu http://casper.beckman.uiuc.edu/~c-tsai4
+ #
+ # ---------------COPYING.libtabe-----END--------------------------------
+ #
+ #
+ # ---------------COPYING.ipadic-----BEGIN-------------------------------
+ #
+ # Copyright 2000, 2001, 2002, 2003 Nara Institute of Science
+ # and Technology. All Rights Reserved.
+ #
+ # Use, reproduction, and distribution of this software is permitted.
+ # Any copy of this software, whether in its original form or modified,
+ # must include both the above copyright notice and the following
+ # paragraphs.
+ #
+ # Nara Institute of Science and Technology (NAIST),
+ # the copyright holders, disclaims all warranties with regard to this
+ # software, including all implied warranties of merchantability and
+ # fitness, in no event shall NAIST be liable for
+ # any special, indirect or consequential damages or any damages
+ # whatsoever resulting from loss of use, data or profits, whether in an
+ # action of contract, negligence or other tortuous action, arising out
+ # of or in connection with the use or performance of this software.
+ #
+ # A large portion of the dictionary entries
+ # originate from ICOT Free Software. The following conditions for ICOT
+ # Free Software applies to the current dictionary as well.
+ #
+ # Each User may also freely distribute the Program, whether in its
+ # original form or modified, to any third party or parties, PROVIDED
+ # that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear
+ # on, or be attached to, the Program, which is distributed substantially
+ # in the same form as set out herein and that such intended
+ # distribution, if actually made, will neither violate or otherwise
+ # contravene any of the laws and regulations of the countries having
+ # jurisdiction over the User or the intended distribution itself.
+ #
+ # NO WARRANTY
+ #
+ # The program was produced on an experimental basis in the course of the
+ # research and development conducted during the project and is provided
+ # to users as so produced on an experimental basis. Accordingly, the
+ # program is provided without any warranty whatsoever, whether express,
+ # implied, statutory or otherwise. The term "warranty" used herein
+ # includes, but is not limited to, any warranty of the quality,
+ # performance, merchantability and fitness for a particular purpose of
+ # the program and the nonexistence of any infringement or violation of
+ # any right of any third party.
+ #
+ # Each user of the program will agree and understand, and be deemed to
+ # have agreed and understood, that there is no warranty whatsoever for
+ # the program and, accordingly, the entire risk arising from or
+ # otherwise connected with the program is assumed by the user.
+ #
+ # Therefore, neither ICOT, the copyright holder, or any other
+ # organization that participated in or was otherwise related to the
+ # development of the program and their respective officials, directors,
+ # officers and other employees shall be held liable for any and all
+ # damages, including, without limitation, general, special, incidental
+ # and consequential damages, arising out of or otherwise in connection
+ # with the use or inability to use the program or any product, material
+ # or result produced or otherwise obtained by using the program,
+ # regardless of whether they have been advised of, or otherwise had
+ # knowledge of, the possibility of such damages at any time during the
+ # project or thereafter. Each user will be deemed to have agreed to the
+ # foregoing by his or her commencement of use of the program. The term
+ # "use" as used herein includes, but is not limited to, the use,
+ # modification, copying and distribution of the program and the
+ # production of secondary products from the program.
+ #
+ # In the case where the program, whether in its original form or
+ # modified, was distributed or delivered to or received by a user from
+ # any person, organization or entity other than ICOT, unless it makes or
+ # grants independently of ICOT any specific warranty to the user in
+ # writing, such person, organization or entity, will also be exempted
+ # from and not be held liable to the user for any such damages as noted
+ # above as far as the program is concerned.
+ #
+ # ---------------COPYING.ipadic-----END----------------------------------
+
+3. Lao Word Break Dictionary Data (laodict.txt)
+
+ # 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
+ # (copied below)
+ #
+ # This file is derived from the above dictionary, with slight
+ # modifications.
+ # ----------------------------------------------------------------------
+ # Copyright (C) 2013 Brian Eugene Wilson, Robert Martin Campbell.
+ # 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.
+ #
+ #
+ # 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 HOLDER 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.
+ # --------------------------------------------------------------------------
+
+4. Burmese Word Break Dictionary Data (burmesedict.txt)
+
+ # Copyright (c) 2014 International Business Machines Corporation
+ # and others. All Rights Reserved.
+ #
+ # This list is part of a project hosted at:
+ # github.com/kanyawtech/myanmar-karen-word-lists
+ #
+ # --------------------------------------------------------------------------
+ # Copyright (c) 2013, LeRoy Benjamin Sharon
+ # 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 Myanmar Karen Word Lists, 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 HOLDER 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.
+ # --------------------------------------------------------------------------
+
+5. Time Zone Database
+
+ ICU uses the public domain data and code derived from Time Zone
+Database for its time zone support. The ownership of the TZ database
+is explained in BCP 175: Procedure for Maintaining the Time Zone
+Database section 7.
+
+ # 7. Database Ownership
+ #
+ # The TZ database itself is not an IETF Contribution or an IETF
+ # document. Rather it is a pre-existing and regularly updated work
+ # that is in the public domain, and is intended to remain in the
+ # public domain. Therefore, BCPs 78 [RFC5378] and 79 [RFC3979] do
+ # not apply to the TZ Database or contributions that individuals make
+ # to it. Should any claims be made and substantiated against the TZ
+ # Database, the organization that is providing the IANA
+ # Considerations defined in this RFC, under the memorandum of
+ # understanding with the IETF, currently ICANN, may act in accordance
+ # with all competent court orders. No ownership claims will be made
+ # 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.
diff --git a/contrib/libs/icu/common/appendable.cpp b/contrib/libs/icu/common/appendable.cpp
index 5feefbda4a..fca3c1e413 100644
--- a/contrib/libs/icu/common/appendable.cpp
+++ b/contrib/libs/icu/common/appendable.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: appendable.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/bmpset.cpp b/contrib/libs/icu/common/bmpset.cpp
index 5806133f3c..bc79f5e5a6 100644
--- a/contrib/libs/icu/common/bmpset.cpp
+++ b/contrib/libs/icu/common/bmpset.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: bmpset.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -28,7 +28,7 @@ U_NAMESPACE_BEGIN
BMPSet::BMPSet(const int32_t *parentList, int32_t parentListLength) :
list(parentList), listLength(parentListLength) {
- uprv_memset(latin1Contains, 0, sizeof(latin1Contains));
+ uprv_memset(latin1Contains, 0, sizeof(latin1Contains));
uprv_memset(table7FF, 0, sizeof(table7FF));
uprv_memset(bmpBlockBits, 0, sizeof(bmpBlockBits));
@@ -45,16 +45,16 @@ BMPSet::BMPSet(const int32_t *parentList, int32_t parentListLength) :
list4kStarts[i]=findCodePoint(i<<12, list4kStarts[i-1], listLength-1);
}
list4kStarts[0x11]=listLength-1;
- containsFFFD=containsSlow(0xfffd, list4kStarts[0xf], list4kStarts[0x10]);
+ containsFFFD=containsSlow(0xfffd, list4kStarts[0xf], list4kStarts[0x10]);
initBits();
overrideIllegal();
}
BMPSet::BMPSet(const BMPSet &otherBMPSet, const int32_t *newParentList, int32_t newParentListLength) :
- containsFFFD(otherBMPSet.containsFFFD),
+ containsFFFD(otherBMPSet.containsFFFD),
list(newParentList), listLength(newParentListLength) {
- uprv_memcpy(latin1Contains, otherBMPSet.latin1Contains, sizeof(latin1Contains));
+ uprv_memcpy(latin1Contains, otherBMPSet.latin1Contains, sizeof(latin1Contains));
uprv_memcpy(table7FF, otherBMPSet.table7FF, sizeof(table7FF));
uprv_memcpy(bmpBlockBits, otherBMPSet.bmpBlockBits, sizeof(bmpBlockBits));
uprv_memcpy(list4kStarts, otherBMPSet.list4kStarts, sizeof(list4kStarts));
@@ -100,9 +100,9 @@ static void set32x64Bits(uint32_t table[64], int32_t start, int32_t limit) {
++lead;
}
if(lead<limitLead) {
- bits=~(((unsigned)1<<lead)-1);
+ bits=~(((unsigned)1<<lead)-1);
if(limitLead<0x20) {
- bits&=((unsigned)1<<limitLead)-1;
+ bits&=((unsigned)1<<limitLead)-1;
}
for(trail=0; trail<64; ++trail) {
table[trail]|=bits;
@@ -122,7 +122,7 @@ void BMPSet::initBits() {
UChar32 start, limit;
int32_t listIndex=0;
- // Set latin1Contains[].
+ // Set latin1Contains[].
do {
start=list[listIndex++];
if(listIndex<listLength) {
@@ -130,31 +130,31 @@ void BMPSet::initBits() {
} else {
limit=0x110000;
}
- if(start>=0x100) {
+ if(start>=0x100) {
break;
}
do {
- latin1Contains[start++]=1;
- } while(start<limit && start<0x100);
- } while(limit<=0x100);
-
- // Find the first range overlapping with (or after) 80..FF again,
- // to include them in table7FF as well.
- for(listIndex=0;;) {
- start=list[listIndex++];
- if(listIndex<listLength) {
- limit=list[listIndex++];
- } else {
- limit=0x110000;
- }
- if(limit>0x80) {
- if(start<0x80) {
- start=0x80;
- }
- break;
- }
- }
-
+ latin1Contains[start++]=1;
+ } while(start<limit && start<0x100);
+ } while(limit<=0x100);
+
+ // Find the first range overlapping with (or after) 80..FF again,
+ // to include them in table7FF as well.
+ for(listIndex=0;;) {
+ start=list[listIndex++];
+ if(listIndex<listLength) {
+ limit=list[listIndex++];
+ } else {
+ limit=0x110000;
+ }
+ if(limit>0x80) {
+ if(start<0x80) {
+ start=0x80;
+ }
+ break;
+ }
+ }
+
// Set table7FF[].
while(start<0x800) {
set32x64Bits(table7FF, start, limit<=0x800 ? limit : 0x800);
@@ -223,14 +223,14 @@ void BMPSet::initBits() {
* for faster validity checking at runtime.
* No need to set 0 values where they were reset to 0 in the constructor
* and not modified by initBits().
- * (table7FF[] 0..7F, bmpBlockBits[] 0..7FF)
+ * (table7FF[] 0..7F, bmpBlockBits[] 0..7FF)
* Need to set 0 values for surrogates D800..DFFF.
*/
void BMPSet::overrideIllegal() {
uint32_t bits, mask;
int32_t i;
- if(containsFFFD) {
+ if(containsFFFD) {
bits=3; // Lead bytes 0xC0 and 0xC1.
for(i=0; i<64; ++i) {
table7FF[i]|=bits;
@@ -241,13 +241,13 @@ void BMPSet::overrideIllegal() {
bmpBlockBits[i]|=bits;
}
- mask= static_cast<uint32_t>(~(0x10001<<0xd)); // Lead byte 0xED.
+ mask= static_cast<uint32_t>(~(0x10001<<0xd)); // Lead byte 0xED.
bits=1<<0xd;
for(i=32; i<64; ++i) { // Second half of 4k block.
bmpBlockBits[i]=(bmpBlockBits[i]&mask)|bits;
}
} else {
- mask= static_cast<uint32_t>(~(0x10001<<0xd)); // Lead byte 0xED.
+ mask= static_cast<uint32_t>(~(0x10001<<0xd)); // Lead byte 0xED.
for(i=32; i<64; ++i) { // Second half of 4k block.
bmpBlockBits[i]&=mask;
}
@@ -290,8 +290,8 @@ int32_t BMPSet::findCodePoint(UChar32 c, int32_t lo, int32_t hi) const {
UBool
BMPSet::contains(UChar32 c) const {
- if((uint32_t)c<=0xff) {
- return (UBool)latin1Contains[c];
+ if((uint32_t)c<=0xff) {
+ return (UBool)latin1Contains[c];
} else if((uint32_t)c<=0x7ff) {
return (UBool)((table7FF[c&0x3f]&((uint32_t)1<<(c>>6)))!=0);
} else if((uint32_t)c<0xd800 || (c>=0xe000 && c<=0xffff)) {
@@ -327,8 +327,8 @@ BMPSet::span(const UChar *s, const UChar *limit, USetSpanCondition spanCondition
// span
do {
c=*s;
- if(c<=0xff) {
- if(!latin1Contains[c]) {
+ if(c<=0xff) {
+ if(!latin1Contains[c]) {
break;
}
} else if(c<=0x7ff) {
@@ -367,8 +367,8 @@ BMPSet::span(const UChar *s, const UChar *limit, USetSpanCondition spanCondition
// span not
do {
c=*s;
- if(c<=0xff) {
- if(latin1Contains[c]) {
+ if(c<=0xff) {
+ if(latin1Contains[c]) {
break;
}
} else if(c<=0x7ff) {
@@ -416,8 +416,8 @@ BMPSet::spanBack(const UChar *s, const UChar *limit, USetSpanCondition spanCondi
// span
for(;;) {
c=*(--limit);
- if(c<=0xff) {
- if(!latin1Contains[c]) {
+ if(c<=0xff) {
+ if(!latin1Contains[c]) {
break;
}
} else if(c<=0x7ff) {
@@ -459,8 +459,8 @@ BMPSet::spanBack(const UChar *s, const UChar *limit, USetSpanCondition spanCondi
// span not
for(;;) {
c=*(--limit);
- if(c<=0xff) {
- if(latin1Contains[c]) {
+ if(c<=0xff) {
+ if(latin1Contains[c]) {
break;
}
} else if(c<=0x7ff) {
@@ -510,22 +510,22 @@ const uint8_t *
BMPSet::spanUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanCondition) const {
const uint8_t *limit=s+length;
uint8_t b=*s;
- if(U8_IS_SINGLE(b)) {
+ if(U8_IS_SINGLE(b)) {
// Initial all-ASCII span.
if(spanCondition) {
do {
- if(!latin1Contains[b] || ++s==limit) {
+ if(!latin1Contains[b] || ++s==limit) {
return s;
}
b=*s;
- } while(U8_IS_SINGLE(b));
+ } while(U8_IS_SINGLE(b));
} else {
do {
- if(latin1Contains[b] || ++s==limit) {
+ if(latin1Contains[b] || ++s==limit) {
return s;
}
b=*s;
- } while(U8_IS_SINGLE(b));
+ } while(U8_IS_SINGLE(b));
}
length=(int32_t)(limit-s);
}
@@ -553,20 +553,20 @@ BMPSet::spanUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanConditi
// single trail byte, check for preceding 3- or 4-byte lead byte
if(length>=2 && (b=*(limit-2))>=0xe0) {
limit-=2;
- if(containsFFFD!=spanCondition) {
+ if(containsFFFD!=spanCondition) {
limit0=limit;
}
} else if(b<0xc0 && b>=0x80 && length>=3 && (b=*(limit-3))>=0xf0) {
// 4-byte lead byte with only two trail bytes
limit-=3;
- if(containsFFFD!=spanCondition) {
+ if(containsFFFD!=spanCondition) {
limit0=limit;
}
}
} else {
// lead byte with no trail bytes
--limit;
- if(containsFFFD!=spanCondition) {
+ if(containsFFFD!=spanCondition) {
limit0=limit;
}
}
@@ -576,26 +576,26 @@ BMPSet::spanUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanConditi
while(s<limit) {
b=*s;
- if(U8_IS_SINGLE(b)) {
- // ASCII
+ if(U8_IS_SINGLE(b)) {
+ // ASCII
if(spanCondition) {
do {
- if(!latin1Contains[b]) {
+ if(!latin1Contains[b]) {
return s;
} else if(++s==limit) {
return limit0;
}
b=*s;
- } while(U8_IS_SINGLE(b));
+ } while(U8_IS_SINGLE(b));
} else {
do {
- if(latin1Contains[b]) {
+ if(latin1Contains[b]) {
return s;
} else if(++s==limit) {
return limit0;
}
b=*s;
- } while(U8_IS_SINGLE(b));
+ } while(U8_IS_SINGLE(b));
}
}
++s; // Advance past the lead byte.
@@ -632,7 +632,7 @@ BMPSet::spanUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanConditi
UChar32 c=((UChar32)(b-0xf0)<<18)|((UChar32)t1<<12)|(t2<<6)|t3;
if( ( (0x10000<=c && c<=0x10ffff) ?
containsSlow(c, list4kStarts[0x10], list4kStarts[0x11]) :
- containsFFFD
+ containsFFFD
) != spanCondition
) {
return s-1;
@@ -640,9 +640,9 @@ BMPSet::spanUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanConditi
s+=3;
continue;
}
- } else {
+ } else {
if( /* handle U+0000..U+07FF inline */
- b>=0xc0 &&
+ b>=0xc0 &&
(t1=(uint8_t)(*s-0x80)) <= 0x3f
) {
if((USetSpanCondition)((table7FF[t1]&((uint32_t)1<<(b&0x1f)))!=0) != spanCondition) {
@@ -656,7 +656,7 @@ BMPSet::spanUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanConditi
// Give an illegal sequence the same value as the result of contains(FFFD).
// Handle each byte of an illegal sequence separately to simplify the code;
// no need to optimize error handling.
- if(containsFFFD!=spanCondition) {
+ if(containsFFFD!=spanCondition) {
return s-1;
}
}
@@ -681,26 +681,26 @@ BMPSet::spanBackUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanCon
do {
b=s[--length];
- if(U8_IS_SINGLE(b)) {
+ if(U8_IS_SINGLE(b)) {
// ASCII sub-span
if(spanCondition) {
do {
- if(!latin1Contains[b]) {
+ if(!latin1Contains[b]) {
return length+1;
} else if(length==0) {
return 0;
}
b=s[--length];
- } while(U8_IS_SINGLE(b));
+ } while(U8_IS_SINGLE(b));
} else {
do {
- if(latin1Contains[b]) {
+ if(latin1Contains[b]) {
return length+1;
} else if(length==0) {
return 0;
}
b=s[--length];
- } while(U8_IS_SINGLE(b));
+ } while(U8_IS_SINGLE(b));
}
}
diff --git a/contrib/libs/icu/common/bmpset.h b/contrib/libs/icu/common/bmpset.h
index fb7dde162f..018aeb7f95 100644
--- a/contrib/libs/icu/common/bmpset.h
+++ b/contrib/libs/icu/common/bmpset.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: bmpset.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -28,12 +28,12 @@ U_NAMESPACE_BEGIN
* Helper class for frozen UnicodeSets, implements contains() and span()
* optimized for BMP code points. Structured to be UTF-8-friendly.
*
- * Latin-1: Look up bytes.
+ * Latin-1: Look up bytes.
* 2-byte characters: Bits organized vertically.
* 3-byte characters: Use zero/one/mixed data per 64-block in U+0000..U+FFFF,
* with mixed for illegal ranges.
- * Supplementary characters: Binary search over
- * the supplementary part of the parent set's inversion list.
+ * Supplementary characters: Binary search over
+ * the supplementary part of the parent set's inversion list.
*/
class BMPSet : public UMemory {
public:
@@ -97,13 +97,13 @@ private:
inline UBool containsSlow(UChar32 c, int32_t lo, int32_t hi) const;
/*
- * One byte 0 or 1 per Latin-1 character.
+ * One byte 0 or 1 per Latin-1 character.
*/
- UBool latin1Contains[0x100];
+ UBool latin1Contains[0x100];
+
+ /* TRUE if contains(U+FFFD). */
+ UBool containsFFFD;
- /* TRUE if contains(U+FFFD). */
- UBool containsFFFD;
-
/*
* One bit per code point from U+0000..U+07FF.
* The bits are organized vertically; consecutive code points
diff --git a/contrib/libs/icu/common/brkeng.cpp b/contrib/libs/icu/common/brkeng.cpp
index 241e71bc18..78492db662 100644
--- a/contrib/libs/icu/common/brkeng.cpp
+++ b/contrib/libs/icu/common/brkeng.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
************************************************************************************
@@ -21,10 +21,10 @@
#include "unicode/uscript.h"
#include "unicode/ucharstrie.h"
#include "unicode/bytestrie.h"
-
-#include "brkeng.h"
-#include "cmemory.h"
-#include "dictbe.h"
+
+#include "brkeng.h"
+#include "cmemory.h"
+#include "dictbe.h"
#include "charstr.h"
#include "dictionarydata.h"
#include "mutex.h"
@@ -59,47 +59,47 @@ LanguageBreakFactory::~LanguageBreakFactory() {
******************************************************************
*/
-UnhandledEngine::UnhandledEngine(UErrorCode &status) : fHandled(nullptr) {
- (void)status;
+UnhandledEngine::UnhandledEngine(UErrorCode &status) : fHandled(nullptr) {
+ (void)status;
}
UnhandledEngine::~UnhandledEngine() {
- delete fHandled;
- fHandled = nullptr;
+ delete fHandled;
+ fHandled = nullptr;
}
UBool
-UnhandledEngine::handles(UChar32 c) const {
- return fHandled && fHandled->contains(c);
+UnhandledEngine::handles(UChar32 c) const {
+ return fHandled && fHandled->contains(c);
}
int32_t
UnhandledEngine::findBreaks( UText *text,
- int32_t /* startPos */,
- int32_t endPos,
- UVector32 &/*foundBreaks*/ ) const {
- 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);
+ int32_t /* startPos */,
+ int32_t endPos,
+ UVector32 &/*foundBreaks*/ ) const {
+ 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) {
- if (fHandled == nullptr) {
- fHandled = new UnicodeSet();
- if (fHandled == nullptr) {
- return;
+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);
- }
+ 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);
+ }
}
/*
@@ -125,11 +125,11 @@ U_CDECL_END
U_NAMESPACE_BEGIN
const LanguageBreakEngine *
-ICULanguageBreakFactory::getEngineFor(UChar32 c) {
+ICULanguageBreakFactory::getEngineFor(UChar32 c) {
const LanguageBreakEngine *lbe = NULL;
UErrorCode status = U_ZERO_ERROR;
- static UMutex gBreakEngineMutex;
+ static UMutex gBreakEngineMutex;
Mutex m(&gBreakEngineMutex);
if (fEngines == NULL) {
@@ -144,14 +144,14 @@ ICULanguageBreakFactory::getEngineFor(UChar32 c) {
int32_t i = fEngines->size();
while (--i >= 0) {
lbe = (const LanguageBreakEngine *)(fEngines->elementAt(i));
- if (lbe != NULL && lbe->handles(c)) {
+ if (lbe != NULL && lbe->handles(c)) {
return lbe;
}
}
}
// We didn't find an engine. Create one.
- lbe = loadEngineFor(c);
+ lbe = loadEngineFor(c);
if (lbe != NULL) {
fEngines->push((void *)lbe, status);
}
@@ -159,11 +159,11 @@ ICULanguageBreakFactory::getEngineFor(UChar32 c) {
}
const LanguageBreakEngine *
-ICULanguageBreakFactory::loadEngineFor(UChar32 c) {
+ICULanguageBreakFactory::loadEngineFor(UChar32 c) {
UErrorCode status = U_ZERO_ERROR;
UScriptCode code = uscript_getScript(c, &status);
if (U_SUCCESS(status)) {
- DictionaryMatcher *m = loadDictionaryMatcherFor(code);
+ DictionaryMatcher *m = loadDictionaryMatcherFor(code);
if (m != NULL) {
const LanguageBreakEngine *engine = NULL;
switch(code) {
@@ -224,7 +224,7 @@ ICULanguageBreakFactory::loadEngineFor(UChar32 c) {
}
DictionaryMatcher *
-ICULanguageBreakFactory::loadDictionaryMatcherFor(UScriptCode script) {
+ICULanguageBreakFactory::loadDictionaryMatcherFor(UScriptCode script) {
UErrorCode status = U_ZERO_ERROR;
// open root from brkitr tree.
UResourceBundle *b = ures_open(U_ICUDATA_BRKITR, "", &status);
diff --git a/contrib/libs/icu/common/brkeng.h b/contrib/libs/icu/common/brkeng.h
index d0cc2ca26f..e40fce13f6 100644
--- a/contrib/libs/icu/common/brkeng.h
+++ b/contrib/libs/icu/common/brkeng.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/**
************************************************************************************
@@ -19,7 +19,7 @@ U_NAMESPACE_BEGIN
class UnicodeSet;
class UStack;
-class UVector32;
+class UVector32;
class DictionaryMatcher;
/*******************************************************************
@@ -57,7 +57,7 @@ class LanguageBreakEngine : public UMemory {
* @return TRUE if this engine handles the particular character and break
* type.
*/
- virtual UBool handles(UChar32 c) const = 0;
+ virtual UBool handles(UChar32 c) const = 0;
/**
* <p>Find any breaks within a run in the supplied text.</p>
@@ -67,13 +67,13 @@ 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 foundBreaks A Vector of int32_t to receive the breaks.
+ * @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,
- UVector32 &foundBreaks ) const = 0;
+ UVector32 &foundBreaks ) const = 0;
};
@@ -124,7 +124,7 @@ class LanguageBreakFactory : public UMemory {
* sought.
* @return A LanguageBreakEngine with the desired characteristics, or 0.
*/
- virtual const LanguageBreakEngine *getEngineFor(UChar32 c) = 0;
+ virtual const LanguageBreakEngine *getEngineFor(UChar32 c) = 0;
};
@@ -147,11 +147,11 @@ class UnhandledEngine : public LanguageBreakEngine {
private:
/**
- * The sets of characters handled.
+ * The sets of characters handled.
* @internal
*/
- UnicodeSet *fHandled;
+ UnicodeSet *fHandled;
public:
@@ -174,7 +174,7 @@ class UnhandledEngine : public LanguageBreakEngine {
* @return TRUE if this engine handles the particular character and break
* type.
*/
- virtual UBool handles(UChar32 c) const;
+ virtual UBool handles(UChar32 c) const;
/**
* <p>Find any breaks within a run in the supplied text.</p>
@@ -190,14 +190,14 @@ class UnhandledEngine : public LanguageBreakEngine {
virtual int32_t findBreaks( UText *text,
int32_t startPos,
int32_t endPos,
- UVector32 &foundBreaks ) const;
+ 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
*/
- virtual void handleCharacter(UChar32 c);
+ virtual void handleCharacter(UChar32 c);
};
@@ -243,7 +243,7 @@ class ICULanguageBreakFactory : public LanguageBreakFactory {
* sought.
* @return A LanguageBreakEngine with the desired characteristics, or 0.
*/
- virtual const LanguageBreakEngine *getEngineFor(UChar32 c);
+ virtual const LanguageBreakEngine *getEngineFor(UChar32 c);
protected:
/**
@@ -254,7 +254,7 @@ protected:
* sought.
* @return A LanguageBreakEngine with the desired characteristics, or 0.
*/
- virtual const LanguageBreakEngine *loadEngineFor(UChar32 c);
+ virtual const LanguageBreakEngine *loadEngineFor(UChar32 c);
/**
* <p>Create a DictionaryMatcher for the specified script and break type.</p>
@@ -262,7 +262,7 @@ protected:
* created.
* @return A DictionaryMatcher with the desired characteristics, or NULL.
*/
- virtual DictionaryMatcher *loadDictionaryMatcherFor(UScriptCode script);
+ virtual DictionaryMatcher *loadDictionaryMatcherFor(UScriptCode script);
};
U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/brkiter.cpp b/contrib/libs/icu/common/brkiter.cpp
index 67e7e09047..b9b6ca65cd 100644
--- a/contrib/libs/icu/common/brkiter.cpp
+++ b/contrib/libs/icu/common/brkiter.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -38,7 +38,7 @@
#include "uresimp.h"
#include "uassert.h"
#include "ubrkimpl.h"
-#include "utracimp.h"
+#include "utracimp.h"
#include "charstr.h"
// *****************************************************************************
@@ -53,7 +53,7 @@ U_NAMESPACE_BEGIN
// -------------------------------------
BreakIterator*
-BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &status)
+BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &status)
{
char fnbuff[256];
char ext[4]={'\0'};
@@ -195,7 +195,7 @@ BreakIterator::getAvailableLocales(int32_t& count)
// ------------------------------------------
//
-// Constructors, destructor and assignment operator
+// Constructors, destructor and assignment operator
//
//-------------------------------------------
@@ -204,19 +204,19 @@ BreakIterator::BreakIterator()
*validLocale = *actualLocale = 0;
}
-BreakIterator::BreakIterator(const BreakIterator &other) : UObject(other) {
- uprv_strncpy(actualLocale, other.actualLocale, sizeof(actualLocale));
- uprv_strncpy(validLocale, other.validLocale, sizeof(validLocale));
-}
-
-BreakIterator &BreakIterator::operator =(const BreakIterator &other) {
- if (this != &other) {
- uprv_strncpy(actualLocale, other.actualLocale, sizeof(actualLocale));
- uprv_strncpy(validLocale, other.validLocale, sizeof(validLocale));
- }
- return *this;
-}
-
+BreakIterator::BreakIterator(const BreakIterator &other) : UObject(other) {
+ uprv_strncpy(actualLocale, other.actualLocale, sizeof(actualLocale));
+ uprv_strncpy(validLocale, other.validLocale, sizeof(validLocale));
+}
+
+BreakIterator &BreakIterator::operator =(const BreakIterator &other) {
+ if (this != &other) {
+ uprv_strncpy(actualLocale, other.actualLocale, sizeof(actualLocale));
+ uprv_strncpy(validLocale, other.validLocale, sizeof(validLocale));
+ }
+ return *this;
+}
+
BreakIterator::~BreakIterator()
{
}
@@ -278,7 +278,7 @@ ICUBreakIteratorService::~ICUBreakIteratorService() {}
// defined in ucln_cmn.h
U_NAMESPACE_END
-static icu::UInitOnce gInitOnceBrkiter = U_INITONCE_INITIALIZER;
+static icu::UInitOnce gInitOnceBrkiter = U_INITONCE_INITIALIZER;
static icu::ICULocaleService* gService = NULL;
@@ -293,7 +293,7 @@ static UBool U_CALLCONV breakiterator_cleanup(void) {
delete gService;
gService = NULL;
}
- gInitOnceBrkiter.reset();
+ gInitOnceBrkiter.reset();
#endif
return TRUE;
}
@@ -309,7 +309,7 @@ initService(void) {
static ICULocaleService*
getService(void)
{
- umtx_initOnce(gInitOnceBrkiter, &initService);
+ umtx_initOnce(gInitOnceBrkiter, &initService);
return gService;
}
@@ -319,7 +319,7 @@ getService(void)
static inline UBool
hasService(void)
{
- return !gInitOnceBrkiter.isReset() && getService() != NULL;
+ return !gInitOnceBrkiter.isReset() && getService() != NULL;
}
// -------------------------------------
@@ -413,23 +413,23 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status)
BreakIterator *result = NULL;
switch (kind) {
case UBRK_CHARACTER:
- {
- UTRACE_ENTRY(UTRACE_UBRK_CREATE_CHARACTER);
- result = BreakIterator::buildInstance(loc, "grapheme", status);
- UTRACE_EXIT_STATUS(status);
- }
+ {
+ UTRACE_ENTRY(UTRACE_UBRK_CREATE_CHARACTER);
+ result = BreakIterator::buildInstance(loc, "grapheme", status);
+ UTRACE_EXIT_STATUS(status);
+ }
break;
case UBRK_WORD:
- {
- UTRACE_ENTRY(UTRACE_UBRK_CREATE_WORD);
- result = BreakIterator::buildInstance(loc, "word", status);
- UTRACE_EXIT_STATUS(status);
- }
+ {
+ UTRACE_ENTRY(UTRACE_UBRK_CREATE_WORD);
+ result = BreakIterator::buildInstance(loc, "word", status);
+ UTRACE_EXIT_STATUS(status);
+ }
break;
case UBRK_LINE:
{
- UTRACE_ENTRY(UTRACE_UBRK_CREATE_LINE);
- uprv_strcpy(lbType, "line");
+ UTRACE_ENTRY(UTRACE_UBRK_CREATE_LINE);
+ uprv_strcpy(lbType, "line");
char lbKeyValue[kKeyValueLenMax] = {0};
UErrorCode kvStatus = U_ZERO_ERROR;
int32_t kLen = loc.getKeywordValue("lb", lbKeyValue, kKeyValueLenMax, kvStatus);
@@ -437,16 +437,16 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status)
uprv_strcat(lbType, "_");
uprv_strcat(lbType, lbKeyValue);
}
- result = BreakIterator::buildInstance(loc, lbType, status);
-
- UTRACE_DATA1(UTRACE_INFO, "lb=%s", lbKeyValue);
- UTRACE_EXIT_STATUS(status);
+ result = BreakIterator::buildInstance(loc, lbType, status);
+
+ UTRACE_DATA1(UTRACE_INFO, "lb=%s", lbKeyValue);
+ UTRACE_EXIT_STATUS(status);
}
break;
case UBRK_SENTENCE:
- {
- UTRACE_ENTRY(UTRACE_UBRK_CREATE_SENTENCE);
- result = BreakIterator::buildInstance(loc, "sentence", status);
+ {
+ UTRACE_ENTRY(UTRACE_UBRK_CREATE_SENTENCE);
+ result = BreakIterator::buildInstance(loc, "sentence", status);
#if !UCONFIG_NO_FILTERED_BREAK_ITERATION
char ssKeyValue[kKeyValueLenMax] = {0};
UErrorCode kvStatus = U_ZERO_ERROR;
@@ -458,16 +458,16 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status)
delete fbiBuilder;
}
}
-#endif
- UTRACE_EXIT_STATUS(status);
+#endif
+ UTRACE_EXIT_STATUS(status);
}
break;
case UBRK_TITLE:
- {
- UTRACE_ENTRY(UTRACE_UBRK_CREATE_TITLE);
- result = BreakIterator::buildInstance(loc, "title", status);
- UTRACE_EXIT_STATUS(status);
- }
+ {
+ UTRACE_ENTRY(UTRACE_UBRK_CREATE_TITLE);
+ result = BreakIterator::buildInstance(loc, "title", status);
+ UTRACE_EXIT_STATUS(status);
+ }
break;
default:
status = U_ILLEGAL_ARGUMENT_ERROR;
diff --git a/contrib/libs/icu/common/bytesinkutil.cpp b/contrib/libs/icu/common/bytesinkutil.cpp
index f49617d708..c64a845f87 100644
--- a/contrib/libs/icu/common/bytesinkutil.cpp
+++ b/contrib/libs/icu/common/bytesinkutil.cpp
@@ -1,161 +1,161 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// bytesinkutil.cpp
-// created: 2017sep14 Markus W. Scherer
-
-#include "unicode/utypes.h"
-#include "unicode/bytestream.h"
-#include "unicode/edits.h"
-#include "unicode/stringoptions.h"
-#include "unicode/utf8.h"
-#include "unicode/utf16.h"
-#include "bytesinkutil.h"
-#include "charstr.h"
-#include "cmemory.h"
-#include "uassert.h"
-
-U_NAMESPACE_BEGIN
-
-UBool
-ByteSinkUtil::appendChange(int32_t length, const char16_t *s16, int32_t s16Length,
- ByteSink &sink, Edits *edits, UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) { return FALSE; }
- char scratch[200];
- int32_t s8Length = 0;
- for (int32_t i = 0; i < s16Length;) {
- int32_t capacity;
- int32_t desiredCapacity = s16Length - i;
- if (desiredCapacity < (INT32_MAX / 3)) {
- desiredCapacity *= 3; // max 3 UTF-8 bytes per UTF-16 code unit
- } else if (desiredCapacity < (INT32_MAX / 2)) {
- desiredCapacity *= 2;
- } else {
- desiredCapacity = INT32_MAX;
- }
- char *buffer = sink.GetAppendBuffer(U8_MAX_LENGTH, desiredCapacity,
- scratch, UPRV_LENGTHOF(scratch), &capacity);
- capacity -= U8_MAX_LENGTH - 1;
- int32_t j = 0;
- for (; i < s16Length && j < capacity;) {
- UChar32 c;
- U16_NEXT_UNSAFE(s16, i, c);
- U8_APPEND_UNSAFE(buffer, j, c);
- }
- if (j > (INT32_MAX - s8Length)) {
- errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
- return FALSE;
- }
- sink.Append(buffer, j);
- s8Length += j;
- }
- if (edits != nullptr) {
- edits->addReplace(length, s8Length);
- }
- return TRUE;
-}
-
-UBool
-ByteSinkUtil::appendChange(const uint8_t *s, const uint8_t *limit,
- const char16_t *s16, int32_t s16Length,
- ByteSink &sink, Edits *edits, UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) { return FALSE; }
- if ((limit - s) > INT32_MAX) {
- errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
- return FALSE;
- }
- return appendChange((int32_t)(limit - s), s16, s16Length, sink, edits, errorCode);
-}
-
-void
-ByteSinkUtil::appendCodePoint(int32_t length, UChar32 c, ByteSink &sink, Edits *edits) {
- char s8[U8_MAX_LENGTH];
- int32_t s8Length = 0;
- U8_APPEND_UNSAFE(s8, s8Length, c);
- if (edits != nullptr) {
- edits->addReplace(length, s8Length);
- }
- sink.Append(s8, s8Length);
-}
-
-namespace {
-
-// See unicode/utf8.h U8_APPEND_UNSAFE().
-inline uint8_t getTwoByteLead(UChar32 c) { return (uint8_t)((c >> 6) | 0xc0); }
-inline uint8_t getTwoByteTrail(UChar32 c) { return (uint8_t)((c & 0x3f) | 0x80); }
-
-} // namespace
-
-void
-ByteSinkUtil::appendTwoBytes(UChar32 c, ByteSink &sink) {
- U_ASSERT(0x80 <= c && c <= 0x7ff); // 2-byte UTF-8
- char s8[2] = { (char)getTwoByteLead(c), (char)getTwoByteTrail(c) };
- sink.Append(s8, 2);
-}
-
-void
-ByteSinkUtil::appendNonEmptyUnchanged(const uint8_t *s, int32_t length,
- ByteSink &sink, uint32_t options, Edits *edits) {
- U_ASSERT(length > 0);
- if (edits != nullptr) {
- edits->addUnchanged(length);
- }
- if ((options & U_OMIT_UNCHANGED_TEXT) == 0) {
- sink.Append(reinterpret_cast<const char *>(s), length);
- }
-}
-
-UBool
-ByteSinkUtil::appendUnchanged(const uint8_t *s, const uint8_t *limit,
- ByteSink &sink, uint32_t options, Edits *edits,
- UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) { return FALSE; }
- if ((limit - s) > INT32_MAX) {
- errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
- return FALSE;
- }
- int32_t length = (int32_t)(limit - s);
- if (length > 0) {
- appendNonEmptyUnchanged(s, length, sink, options, edits);
- }
- return TRUE;
-}
-
-CharStringByteSink::CharStringByteSink(CharString* dest) : dest_(*dest) {
-}
-
-CharStringByteSink::~CharStringByteSink() = default;
-
-void
-CharStringByteSink::Append(const char* bytes, int32_t n) {
- UErrorCode status = U_ZERO_ERROR;
- dest_.append(bytes, n, status);
- // Any errors are silently ignored.
-}
-
-char*
-CharStringByteSink::GetAppendBuffer(int32_t min_capacity,
- int32_t desired_capacity_hint,
- char* scratch,
- int32_t scratch_capacity,
- int32_t* result_capacity) {
- if (min_capacity < 1 || scratch_capacity < min_capacity) {
- *result_capacity = 0;
- return nullptr;
- }
-
- UErrorCode status = U_ZERO_ERROR;
- char* result = dest_.getAppendBuffer(
- min_capacity,
- desired_capacity_hint,
- *result_capacity,
- status);
- if (U_SUCCESS(status)) {
- return result;
- }
-
- *result_capacity = scratch_capacity;
- return scratch;
-}
-
-U_NAMESPACE_END
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// bytesinkutil.cpp
+// created: 2017sep14 Markus W. Scherer
+
+#include "unicode/utypes.h"
+#include "unicode/bytestream.h"
+#include "unicode/edits.h"
+#include "unicode/stringoptions.h"
+#include "unicode/utf8.h"
+#include "unicode/utf16.h"
+#include "bytesinkutil.h"
+#include "charstr.h"
+#include "cmemory.h"
+#include "uassert.h"
+
+U_NAMESPACE_BEGIN
+
+UBool
+ByteSinkUtil::appendChange(int32_t length, const char16_t *s16, int32_t s16Length,
+ ByteSink &sink, Edits *edits, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return FALSE; }
+ char scratch[200];
+ int32_t s8Length = 0;
+ for (int32_t i = 0; i < s16Length;) {
+ int32_t capacity;
+ int32_t desiredCapacity = s16Length - i;
+ if (desiredCapacity < (INT32_MAX / 3)) {
+ desiredCapacity *= 3; // max 3 UTF-8 bytes per UTF-16 code unit
+ } else if (desiredCapacity < (INT32_MAX / 2)) {
+ desiredCapacity *= 2;
+ } else {
+ desiredCapacity = INT32_MAX;
+ }
+ char *buffer = sink.GetAppendBuffer(U8_MAX_LENGTH, desiredCapacity,
+ scratch, UPRV_LENGTHOF(scratch), &capacity);
+ capacity -= U8_MAX_LENGTH - 1;
+ int32_t j = 0;
+ for (; i < s16Length && j < capacity;) {
+ UChar32 c;
+ U16_NEXT_UNSAFE(s16, i, c);
+ U8_APPEND_UNSAFE(buffer, j, c);
+ }
+ if (j > (INT32_MAX - s8Length)) {
+ errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
+ return FALSE;
+ }
+ sink.Append(buffer, j);
+ s8Length += j;
+ }
+ if (edits != nullptr) {
+ edits->addReplace(length, s8Length);
+ }
+ return TRUE;
+}
+
+UBool
+ByteSinkUtil::appendChange(const uint8_t *s, const uint8_t *limit,
+ const char16_t *s16, int32_t s16Length,
+ ByteSink &sink, Edits *edits, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return FALSE; }
+ if ((limit - s) > INT32_MAX) {
+ errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
+ return FALSE;
+ }
+ return appendChange((int32_t)(limit - s), s16, s16Length, sink, edits, errorCode);
+}
+
+void
+ByteSinkUtil::appendCodePoint(int32_t length, UChar32 c, ByteSink &sink, Edits *edits) {
+ char s8[U8_MAX_LENGTH];
+ int32_t s8Length = 0;
+ U8_APPEND_UNSAFE(s8, s8Length, c);
+ if (edits != nullptr) {
+ edits->addReplace(length, s8Length);
+ }
+ sink.Append(s8, s8Length);
+}
+
+namespace {
+
+// See unicode/utf8.h U8_APPEND_UNSAFE().
+inline uint8_t getTwoByteLead(UChar32 c) { return (uint8_t)((c >> 6) | 0xc0); }
+inline uint8_t getTwoByteTrail(UChar32 c) { return (uint8_t)((c & 0x3f) | 0x80); }
+
+} // namespace
+
+void
+ByteSinkUtil::appendTwoBytes(UChar32 c, ByteSink &sink) {
+ U_ASSERT(0x80 <= c && c <= 0x7ff); // 2-byte UTF-8
+ char s8[2] = { (char)getTwoByteLead(c), (char)getTwoByteTrail(c) };
+ sink.Append(s8, 2);
+}
+
+void
+ByteSinkUtil::appendNonEmptyUnchanged(const uint8_t *s, int32_t length,
+ ByteSink &sink, uint32_t options, Edits *edits) {
+ U_ASSERT(length > 0);
+ if (edits != nullptr) {
+ edits->addUnchanged(length);
+ }
+ if ((options & U_OMIT_UNCHANGED_TEXT) == 0) {
+ sink.Append(reinterpret_cast<const char *>(s), length);
+ }
+}
+
+UBool
+ByteSinkUtil::appendUnchanged(const uint8_t *s, const uint8_t *limit,
+ ByteSink &sink, uint32_t options, Edits *edits,
+ UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return FALSE; }
+ if ((limit - s) > INT32_MAX) {
+ errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
+ return FALSE;
+ }
+ int32_t length = (int32_t)(limit - s);
+ if (length > 0) {
+ appendNonEmptyUnchanged(s, length, sink, options, edits);
+ }
+ return TRUE;
+}
+
+CharStringByteSink::CharStringByteSink(CharString* dest) : dest_(*dest) {
+}
+
+CharStringByteSink::~CharStringByteSink() = default;
+
+void
+CharStringByteSink::Append(const char* bytes, int32_t n) {
+ UErrorCode status = U_ZERO_ERROR;
+ dest_.append(bytes, n, status);
+ // Any errors are silently ignored.
+}
+
+char*
+CharStringByteSink::GetAppendBuffer(int32_t min_capacity,
+ int32_t desired_capacity_hint,
+ char* scratch,
+ int32_t scratch_capacity,
+ int32_t* result_capacity) {
+ if (min_capacity < 1 || scratch_capacity < min_capacity) {
+ *result_capacity = 0;
+ return nullptr;
+ }
+
+ UErrorCode status = U_ZERO_ERROR;
+ char* result = dest_.getAppendBuffer(
+ min_capacity,
+ desired_capacity_hint,
+ *result_capacity,
+ status);
+ if (U_SUCCESS(status)) {
+ return result;
+ }
+
+ *result_capacity = scratch_capacity;
+ return scratch;
+}
+
+U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/bytesinkutil.h b/contrib/libs/icu/common/bytesinkutil.h
index 01cd1dadc7..6808fbe677 100644
--- a/contrib/libs/icu/common/bytesinkutil.h
+++ b/contrib/libs/icu/common/bytesinkutil.h
@@ -1,83 +1,83 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// bytesinkutil.h
-// created: 2017sep14 Markus W. Scherer
-
-#include "unicode/utypes.h"
-#include "unicode/bytestream.h"
-#include "unicode/edits.h"
-#include "cmemory.h"
-#include "uassert.h"
-
-U_NAMESPACE_BEGIN
-
-class ByteSink;
-class CharString;
-class Edits;
-
-class U_COMMON_API ByteSinkUtil {
-public:
- ByteSinkUtil() = delete; // all static
-
- /** (length) bytes were mapped to valid (s16, s16Length). */
- static UBool appendChange(int32_t length,
- const char16_t *s16, int32_t s16Length,
- ByteSink &sink, Edits *edits, UErrorCode &errorCode);
-
- /** The bytes at [s, limit[ were mapped to valid (s16, s16Length). */
- static UBool appendChange(const uint8_t *s, const uint8_t *limit,
- const char16_t *s16, int32_t s16Length,
- ByteSink &sink, Edits *edits, UErrorCode &errorCode);
-
- /** (length) bytes were mapped/changed to valid code point c. */
- static void appendCodePoint(int32_t length, UChar32 c, ByteSink &sink, Edits *edits = nullptr);
-
- /** The few bytes at [src, nextSrc[ were mapped/changed to valid code point c. */
- static inline void appendCodePoint(const uint8_t *src, const uint8_t *nextSrc, UChar32 c,
- ByteSink &sink, Edits *edits = nullptr) {
- appendCodePoint((int32_t)(nextSrc - src), c, sink, edits);
- }
-
- /** Append the two-byte character (U+0080..U+07FF). */
- static void appendTwoBytes(UChar32 c, ByteSink &sink);
-
- 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 (length > 0) { appendNonEmptyUnchanged(s, length, sink, options, edits); }
- return TRUE;
- }
-
- static UBool appendUnchanged(const uint8_t *s, const uint8_t *limit,
- ByteSink &sink, uint32_t options, Edits *edits,
- UErrorCode &errorCode);
-
-private:
- static void appendNonEmptyUnchanged(const uint8_t *s, int32_t length,
- ByteSink &sink, uint32_t options, Edits *edits);
-};
-
-class U_COMMON_API CharStringByteSink : public ByteSink {
-public:
- CharStringByteSink(CharString* dest);
- ~CharStringByteSink() override;
-
- CharStringByteSink() = delete;
- CharStringByteSink(const CharStringByteSink&) = delete;
- CharStringByteSink& operator=(const CharStringByteSink&) = delete;
-
- void Append(const char* bytes, int32_t n) override;
-
- char* GetAppendBuffer(int32_t min_capacity,
- int32_t desired_capacity_hint,
- char* scratch,
- int32_t scratch_capacity,
- int32_t* result_capacity) override;
-
-private:
- CharString& dest_;
-};
-
-U_NAMESPACE_END
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// bytesinkutil.h
+// created: 2017sep14 Markus W. Scherer
+
+#include "unicode/utypes.h"
+#include "unicode/bytestream.h"
+#include "unicode/edits.h"
+#include "cmemory.h"
+#include "uassert.h"
+
+U_NAMESPACE_BEGIN
+
+class ByteSink;
+class CharString;
+class Edits;
+
+class U_COMMON_API ByteSinkUtil {
+public:
+ ByteSinkUtil() = delete; // all static
+
+ /** (length) bytes were mapped to valid (s16, s16Length). */
+ static UBool appendChange(int32_t length,
+ const char16_t *s16, int32_t s16Length,
+ ByteSink &sink, Edits *edits, UErrorCode &errorCode);
+
+ /** The bytes at [s, limit[ were mapped to valid (s16, s16Length). */
+ static UBool appendChange(const uint8_t *s, const uint8_t *limit,
+ const char16_t *s16, int32_t s16Length,
+ ByteSink &sink, Edits *edits, UErrorCode &errorCode);
+
+ /** (length) bytes were mapped/changed to valid code point c. */
+ static void appendCodePoint(int32_t length, UChar32 c, ByteSink &sink, Edits *edits = nullptr);
+
+ /** The few bytes at [src, nextSrc[ were mapped/changed to valid code point c. */
+ static inline void appendCodePoint(const uint8_t *src, const uint8_t *nextSrc, UChar32 c,
+ ByteSink &sink, Edits *edits = nullptr) {
+ appendCodePoint((int32_t)(nextSrc - src), c, sink, edits);
+ }
+
+ /** Append the two-byte character (U+0080..U+07FF). */
+ static void appendTwoBytes(UChar32 c, ByteSink &sink);
+
+ 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 (length > 0) { appendNonEmptyUnchanged(s, length, sink, options, edits); }
+ return TRUE;
+ }
+
+ static UBool appendUnchanged(const uint8_t *s, const uint8_t *limit,
+ ByteSink &sink, uint32_t options, Edits *edits,
+ UErrorCode &errorCode);
+
+private:
+ static void appendNonEmptyUnchanged(const uint8_t *s, int32_t length,
+ ByteSink &sink, uint32_t options, Edits *edits);
+};
+
+class U_COMMON_API CharStringByteSink : public ByteSink {
+public:
+ CharStringByteSink(CharString* dest);
+ ~CharStringByteSink() override;
+
+ CharStringByteSink() = delete;
+ CharStringByteSink(const CharStringByteSink&) = delete;
+ CharStringByteSink& operator=(const CharStringByteSink&) = delete;
+
+ void Append(const char* bytes, int32_t n) override;
+
+ char* GetAppendBuffer(int32_t min_capacity,
+ int32_t desired_capacity_hint,
+ char* scratch,
+ int32_t scratch_capacity,
+ int32_t* result_capacity) override;
+
+private:
+ CharString& dest_;
+};
+
+U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/bytestream.cpp b/contrib/libs/icu/common/bytestream.cpp
index 689bf8c7b3..0d0e4dda39 100644
--- a/contrib/libs/icu/common/bytestream.cpp
+++ b/contrib/libs/icu/common/bytestream.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
// Copyright (C) 2009-2011, International Business Machines
// Corporation and others. All Rights Reserved.
@@ -45,12 +45,12 @@ void CheckedArrayByteSink::Append(const char* bytes, int32_t n) {
if (n <= 0) {
return;
}
- if (n > (INT32_MAX - appended_)) {
- // TODO: Report as integer overflow, not merely buffer overflow.
- appended_ = INT32_MAX;
- overflowed_ = TRUE;
- return;
- }
+ if (n > (INT32_MAX - appended_)) {
+ // TODO: Report as integer overflow, not merely buffer overflow.
+ appended_ = INT32_MAX;
+ overflowed_ = TRUE;
+ return;
+ }
appended_ += n;
int32_t available = capacity_ - size_;
if (n > available) {
diff --git a/contrib/libs/icu/common/bytestrie.cpp b/contrib/libs/icu/common/bytestrie.cpp
index 0be3685e5e..c4d498c4bf 100644
--- a/contrib/libs/icu/common/bytestrie.cpp
+++ b/contrib/libs/icu/common/bytestrie.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: bytestrie.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/bytestriebuilder.cpp b/contrib/libs/icu/common/bytestriebuilder.cpp
index 85ac9de2db..ec1ab7d8f5 100644
--- a/contrib/libs/icu/common/bytestriebuilder.cpp
+++ b/contrib/libs/icu/common/bytestriebuilder.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: bytestriebuilder.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -339,8 +339,8 @@ BytesTrieBuilder::indexOfElementWithNextUnit(int32_t i, int32_t byteIndex, UChar
BytesTrieBuilder::BTLinearMatchNode::BTLinearMatchNode(const char *bytes, int32_t len, Node *nextNode)
: LinearMatchNode(len, nextNode), s(bytes) {
- hash=static_cast<int32_t>(
- static_cast<uint32_t>(hash)*37u + static_cast<uint32_t>(ustr_hashCharsN(bytes, len)));
+ hash=static_cast<int32_t>(
+ static_cast<uint32_t>(hash)*37u + static_cast<uint32_t>(ustr_hashCharsN(bytes, len)));
}
UBool
diff --git a/contrib/libs/icu/common/bytestrieiterator.cpp b/contrib/libs/icu/common/bytestrieiterator.cpp
index 4303f64462..e64961a1f1 100644
--- a/contrib/libs/icu/common/bytestrieiterator.cpp
+++ b/contrib/libs/icu/common/bytestrieiterator.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: bytestrieiterator.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/caniter.cpp b/contrib/libs/icu/common/caniter.cpp
index 6c59b47d47..b28acfc84e 100644
--- a/contrib/libs/icu/common/caniter.cpp
+++ b/contrib/libs/icu/common/caniter.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************
@@ -311,12 +311,12 @@ void U_EXPORT2 CanonicalIterator::permute(UnicodeString &source, UBool skipZeros
// see what the permutations of the characters before and after this one are
//Hashtable *subpermute = permute(source.substring(0,i) + source.substring(i + UTF16.getCharCount(cp)));
- permute(subPermuteString.remove(i, U16_LENGTH(cp)), skipZeros, &subpermute, status);
+ permute(subPermuteString.remove(i, U16_LENGTH(cp)), skipZeros, &subpermute, status);
/* Test for buffer overflows */
if(U_FAILURE(status)) {
return;
}
- // The upper remove is destructive. The question is do we have to make a copy, or we don't care about the contents
+ // The upper remove is destructive. The question is do we have to make a copy, or we don't care about the contents
// of source at this point.
// prefix this character to all of them
@@ -405,7 +405,7 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i
//String[] finalResult = new String[result.size()];
UnicodeString *finalResult = NULL;
int32_t resultCount;
- if((resultCount = result.count()) != 0) {
+ if((resultCount = result.count()) != 0) {
finalResult = new UnicodeString[resultCount];
if (finalResult == 0) {
status = U_MEMORY_ALLOCATION_ERROR;
diff --git a/contrib/libs/icu/common/capi_helper.h b/contrib/libs/icu/common/capi_helper.h
index 85c0d28d3f..54b1db9e33 100644
--- a/contrib/libs/icu/common/capi_helper.h
+++ b/contrib/libs/icu/common/capi_helper.h
@@ -1,97 +1,97 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#ifndef __CAPI_HELPER_H__
-#define __CAPI_HELPER_H__
-
-#include "unicode/utypes.h"
-
-U_NAMESPACE_BEGIN
-
-/**
- * An internal helper class to help convert between C and C++ APIs.
- */
-template<typename CType, typename CPPType, int32_t kMagic>
-class IcuCApiHelper {
- public:
- /**
- * Convert from the C type to the C++ type (const version).
- */
- static const CPPType* validate(const CType* input, UErrorCode& status);
-
- /**
- * Convert from the C type to the C++ type (non-const version).
- */
- static CPPType* validate(CType* input, UErrorCode& status);
-
- /**
- * Convert from the C++ type to the C type (const version).
- */
- const CType* exportConstForC() const;
-
- /**
- * Convert from the C++ type to the C type (non-const version).
- */
- CType* exportForC();
-
- /**
- * Invalidates the object.
- */
- ~IcuCApiHelper();
-
- private:
- /**
- * While the object is valid, fMagic equals kMagic.
- */
- int32_t fMagic = kMagic;
-};
-
-
-template<typename CType, typename CPPType, int32_t kMagic>
-const CPPType*
-IcuCApiHelper<CType, CPPType, kMagic>::validate(const CType* input, UErrorCode& status) {
- if (U_FAILURE(status)) {
- return nullptr;
- }
- if (input == nullptr) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
- }
- auto* impl = reinterpret_cast<const CPPType*>(input);
- if (static_cast<const IcuCApiHelper<CType, CPPType, kMagic>*>(impl)->fMagic != kMagic) {
- status = U_INVALID_FORMAT_ERROR;
- return nullptr;
- }
- return impl;
-}
-
-template<typename CType, typename CPPType, int32_t kMagic>
-CPPType*
-IcuCApiHelper<CType, CPPType, kMagic>::validate(CType* input, UErrorCode& status) {
- auto* constInput = static_cast<const CType*>(input);
- auto* validated = validate(constInput, status);
- return const_cast<CPPType*>(validated);
-}
-
-template<typename CType, typename CPPType, int32_t kMagic>
-const CType*
-IcuCApiHelper<CType, CPPType, kMagic>::exportConstForC() const {
- return reinterpret_cast<const CType*>(static_cast<const CPPType*>(this));
-}
-
-template<typename CType, typename CPPType, int32_t kMagic>
-CType*
-IcuCApiHelper<CType, CPPType, kMagic>::exportForC() {
- return reinterpret_cast<CType*>(static_cast<CPPType*>(this));
-}
-
-template<typename CType, typename CPPType, int32_t kMagic>
-IcuCApiHelper<CType, CPPType, kMagic>::~IcuCApiHelper() {
- // head off application errors by preventing use of of deleted objects.
- fMagic = 0;
-}
-
-
-U_NAMESPACE_END
-
-#endif // __CAPI_HELPER_H__
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#ifndef __CAPI_HELPER_H__
+#define __CAPI_HELPER_H__
+
+#include "unicode/utypes.h"
+
+U_NAMESPACE_BEGIN
+
+/**
+ * An internal helper class to help convert between C and C++ APIs.
+ */
+template<typename CType, typename CPPType, int32_t kMagic>
+class IcuCApiHelper {
+ public:
+ /**
+ * Convert from the C type to the C++ type (const version).
+ */
+ static const CPPType* validate(const CType* input, UErrorCode& status);
+
+ /**
+ * Convert from the C type to the C++ type (non-const version).
+ */
+ static CPPType* validate(CType* input, UErrorCode& status);
+
+ /**
+ * Convert from the C++ type to the C type (const version).
+ */
+ const CType* exportConstForC() const;
+
+ /**
+ * Convert from the C++ type to the C type (non-const version).
+ */
+ CType* exportForC();
+
+ /**
+ * Invalidates the object.
+ */
+ ~IcuCApiHelper();
+
+ private:
+ /**
+ * While the object is valid, fMagic equals kMagic.
+ */
+ int32_t fMagic = kMagic;
+};
+
+
+template<typename CType, typename CPPType, int32_t kMagic>
+const CPPType*
+IcuCApiHelper<CType, CPPType, kMagic>::validate(const CType* input, UErrorCode& status) {
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ if (input == nullptr) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return nullptr;
+ }
+ auto* impl = reinterpret_cast<const CPPType*>(input);
+ if (static_cast<const IcuCApiHelper<CType, CPPType, kMagic>*>(impl)->fMagic != kMagic) {
+ status = U_INVALID_FORMAT_ERROR;
+ return nullptr;
+ }
+ return impl;
+}
+
+template<typename CType, typename CPPType, int32_t kMagic>
+CPPType*
+IcuCApiHelper<CType, CPPType, kMagic>::validate(CType* input, UErrorCode& status) {
+ auto* constInput = static_cast<const CType*>(input);
+ auto* validated = validate(constInput, status);
+ return const_cast<CPPType*>(validated);
+}
+
+template<typename CType, typename CPPType, int32_t kMagic>
+const CType*
+IcuCApiHelper<CType, CPPType, kMagic>::exportConstForC() const {
+ return reinterpret_cast<const CType*>(static_cast<const CPPType*>(this));
+}
+
+template<typename CType, typename CPPType, int32_t kMagic>
+CType*
+IcuCApiHelper<CType, CPPType, kMagic>::exportForC() {
+ return reinterpret_cast<CType*>(static_cast<CPPType*>(this));
+}
+
+template<typename CType, typename CPPType, int32_t kMagic>
+IcuCApiHelper<CType, CPPType, kMagic>::~IcuCApiHelper() {
+ // head off application errors by preventing use of of deleted objects.
+ fMagic = 0;
+}
+
+
+U_NAMESPACE_END
+
+#endif // __CAPI_HELPER_H__
diff --git a/contrib/libs/icu/common/characterproperties.cpp b/contrib/libs/icu/common/characterproperties.cpp
index 6cfa722021..7b50a4e205 100644
--- a/contrib/libs/icu/common/characterproperties.cpp
+++ b/contrib/libs/icu/common/characterproperties.cpp
@@ -1,383 +1,383 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// characterproperties.cpp
-// created: 2018sep03 Markus W. Scherer
-
-#include "unicode/utypes.h"
-#include "unicode/localpointer.h"
-#include "unicode/uchar.h"
-#include "unicode/ucpmap.h"
-#include "unicode/ucptrie.h"
-#include "unicode/umutablecptrie.h"
-#include "unicode/uniset.h"
-#include "unicode/uscript.h"
-#include "unicode/uset.h"
-#include "cmemory.h"
-#include "mutex.h"
-#include "normalizer2impl.h"
-#include "uassert.h"
-#include "ubidi_props.h"
-#include "ucase.h"
-#include "ucln_cmn.h"
-#include "umutex.h"
-#include "uprops.h"
-
-using icu::LocalPointer;
-#if !UCONFIG_NO_NORMALIZATION
-using icu::Normalizer2Factory;
-using icu::Normalizer2Impl;
-#endif
-using icu::UInitOnce;
-using icu::UnicodeSet;
-
-namespace {
-
-UBool U_CALLCONV characterproperties_cleanup();
-
-constexpr int32_t NUM_INCLUSIONS = UPROPS_SRC_COUNT + UCHAR_INT_LIMIT - UCHAR_INT_START;
-
-struct Inclusion {
- UnicodeSet *fSet = nullptr;
- UInitOnce fInitOnce = U_INITONCE_INITIALIZER;
-};
-Inclusion gInclusions[NUM_INCLUSIONS]; // cached getInclusions()
-
-UnicodeSet *sets[UCHAR_BINARY_LIMIT] = {};
-
-UCPMap *maps[UCHAR_INT_LIMIT - UCHAR_INT_START] = {};
-
-icu::UMutex cpMutex;
-
-//----------------------------------------------------------------
-// Inclusions list
-//----------------------------------------------------------------
-
-// USetAdder implementation
-// Does not use uset.h to reduce code dependencies
-void U_CALLCONV
-_set_add(USet *set, UChar32 c) {
- ((UnicodeSet *)set)->add(c);
-}
-
-void U_CALLCONV
-_set_addRange(USet *set, UChar32 start, UChar32 end) {
- ((UnicodeSet *)set)->add(start, end);
-}
-
-void U_CALLCONV
-_set_addString(USet *set, const UChar *str, int32_t length) {
- ((UnicodeSet *)set)->add(icu::UnicodeString((UBool)(length<0), str, length));
-}
-
-UBool U_CALLCONV characterproperties_cleanup() {
- for (Inclusion &in: gInclusions) {
- delete in.fSet;
- in.fSet = nullptr;
- in.fInitOnce.reset();
- }
- for (int32_t i = 0; i < UPRV_LENGTHOF(sets); ++i) {
- delete sets[i];
- sets[i] = nullptr;
- }
- for (int32_t i = 0; i < UPRV_LENGTHOF(maps); ++i) {
- ucptrie_close(reinterpret_cast<UCPTrie *>(maps[i]));
- maps[i] = nullptr;
- }
- return TRUE;
-}
-
-void U_CALLCONV initInclusion(UPropertySource src, UErrorCode &errorCode) {
- // This function is invoked only via umtx_initOnce().
- U_ASSERT(0 <= src && src < UPROPS_SRC_COUNT);
- if (src == UPROPS_SRC_NONE) {
- errorCode = U_INTERNAL_PROGRAM_ERROR;
- return;
- }
- U_ASSERT(gInclusions[src].fSet == nullptr);
-
- LocalPointer<UnicodeSet> incl(new UnicodeSet());
- if (incl.isNull()) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- USetAdder sa = {
- (USet *)incl.getAlias(),
- _set_add,
- _set_addRange,
- _set_addString,
- nullptr, // don't need remove()
- nullptr // don't need removeRange()
- };
-
- switch(src) {
- case UPROPS_SRC_CHAR:
- uchar_addPropertyStarts(&sa, &errorCode);
- break;
- case UPROPS_SRC_PROPSVEC:
- upropsvec_addPropertyStarts(&sa, &errorCode);
- break;
- case UPROPS_SRC_CHAR_AND_PROPSVEC:
- uchar_addPropertyStarts(&sa, &errorCode);
- upropsvec_addPropertyStarts(&sa, &errorCode);
- break;
-#if !UCONFIG_NO_NORMALIZATION
- case UPROPS_SRC_CASE_AND_NORM: {
- const Normalizer2Impl *impl=Normalizer2Factory::getNFCImpl(errorCode);
- if(U_SUCCESS(errorCode)) {
- impl->addPropertyStarts(&sa, errorCode);
- }
- ucase_addPropertyStarts(&sa, &errorCode);
- break;
- }
- case UPROPS_SRC_NFC: {
- const Normalizer2Impl *impl=Normalizer2Factory::getNFCImpl(errorCode);
- if(U_SUCCESS(errorCode)) {
- impl->addPropertyStarts(&sa, errorCode);
- }
- break;
- }
- case UPROPS_SRC_NFKC: {
- const Normalizer2Impl *impl=Normalizer2Factory::getNFKCImpl(errorCode);
- if(U_SUCCESS(errorCode)) {
- impl->addPropertyStarts(&sa, errorCode);
- }
- break;
- }
- case UPROPS_SRC_NFKC_CF: {
- const Normalizer2Impl *impl=Normalizer2Factory::getNFKC_CFImpl(errorCode);
- if(U_SUCCESS(errorCode)) {
- impl->addPropertyStarts(&sa, errorCode);
- }
- break;
- }
- case UPROPS_SRC_NFC_CANON_ITER: {
- const Normalizer2Impl *impl=Normalizer2Factory::getNFCImpl(errorCode);
- if(U_SUCCESS(errorCode)) {
- impl->addCanonIterPropertyStarts(&sa, errorCode);
- }
- break;
- }
-#endif
- case UPROPS_SRC_CASE:
- ucase_addPropertyStarts(&sa, &errorCode);
- break;
- case UPROPS_SRC_BIDI:
- ubidi_addPropertyStarts(&sa, &errorCode);
- break;
- case UPROPS_SRC_INPC:
- case UPROPS_SRC_INSC:
- case UPROPS_SRC_VO:
- uprops_addPropertyStarts((UPropertySource)src, &sa, &errorCode);
- break;
- default:
- errorCode = U_INTERNAL_PROGRAM_ERROR;
- break;
- }
-
- if (U_FAILURE(errorCode)) {
- return;
- }
- if (incl->isBogus()) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- // Compact for caching.
- incl->compact();
- gInclusions[src].fSet = incl.orphan();
- ucln_common_registerCleanup(UCLN_COMMON_CHARACTERPROPERTIES, characterproperties_cleanup);
-}
-
-const UnicodeSet *getInclusionsForSource(UPropertySource src, UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) { return nullptr; }
- if (src < 0 || UPROPS_SRC_COUNT <= src) {
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
- }
- Inclusion &i = gInclusions[src];
- umtx_initOnce(i.fInitOnce, &initInclusion, src, errorCode);
- return i.fSet;
-}
-
-void U_CALLCONV initIntPropInclusion(UProperty prop, UErrorCode &errorCode) {
- // This function is invoked only via umtx_initOnce().
- U_ASSERT(UCHAR_INT_START <= prop && prop < UCHAR_INT_LIMIT);
- int32_t inclIndex = UPROPS_SRC_COUNT + prop - UCHAR_INT_START;
- U_ASSERT(gInclusions[inclIndex].fSet == nullptr);
- UPropertySource src = uprops_getSource(prop);
- const UnicodeSet *incl = getInclusionsForSource(src, errorCode);
- if (U_FAILURE(errorCode)) {
- return;
- }
-
- LocalPointer<UnicodeSet> intPropIncl(new UnicodeSet(0, 0));
- if (intPropIncl.isNull()) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- int32_t numRanges = incl->getRangeCount();
- int32_t prevValue = 0;
- for (int32_t i = 0; i < numRanges; ++i) {
- UChar32 rangeEnd = incl->getRangeEnd(i);
- for (UChar32 c = incl->getRangeStart(i); c <= rangeEnd; ++c) {
- // TODO: Get a UCharacterProperty.IntProperty to avoid the property dispatch.
- int32_t value = u_getIntPropertyValue(c, prop);
- if (value != prevValue) {
- intPropIncl->add(c);
- prevValue = value;
- }
- }
- }
-
- if (intPropIncl->isBogus()) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- // Compact for caching.
- intPropIncl->compact();
- gInclusions[inclIndex].fSet = intPropIncl.orphan();
- ucln_common_registerCleanup(UCLN_COMMON_CHARACTERPROPERTIES, characterproperties_cleanup);
-}
-
-} // namespace
-
-U_NAMESPACE_BEGIN
-
-const UnicodeSet *CharacterProperties::getInclusionsForProperty(
- UProperty prop, UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) { return nullptr; }
- if (UCHAR_INT_START <= prop && prop < UCHAR_INT_LIMIT) {
- int32_t inclIndex = UPROPS_SRC_COUNT + prop - UCHAR_INT_START;
- Inclusion &i = gInclusions[inclIndex];
- umtx_initOnce(i.fInitOnce, &initIntPropInclusion, prop, errorCode);
- return i.fSet;
- } else {
- UPropertySource src = uprops_getSource(prop);
- return getInclusionsForSource(src, errorCode);
- }
-}
-
-U_NAMESPACE_END
-
-namespace {
-
-UnicodeSet *makeSet(UProperty property, UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) { return nullptr; }
- LocalPointer<UnicodeSet> set(new UnicodeSet());
- if (set.isNull()) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
- const UnicodeSet *inclusions =
- icu::CharacterProperties::getInclusionsForProperty(property, errorCode);
- if (U_FAILURE(errorCode)) { return nullptr; }
- int32_t numRanges = inclusions->getRangeCount();
- UChar32 startHasProperty = -1;
-
- for (int32_t i = 0; i < numRanges; ++i) {
- UChar32 rangeEnd = inclusions->getRangeEnd(i);
- for (UChar32 c = inclusions->getRangeStart(i); c <= rangeEnd; ++c) {
- // TODO: Get a UCharacterProperty.BinaryProperty to avoid the property dispatch.
- if (u_hasBinaryProperty(c, property)) {
- if (startHasProperty < 0) {
- // Transition from false to true.
- startHasProperty = c;
- }
- } else if (startHasProperty >= 0) {
- // Transition from true to false.
- set->add(startHasProperty, c - 1);
- startHasProperty = -1;
- }
- }
- }
- if (startHasProperty >= 0) {
- set->add(startHasProperty, 0x10FFFF);
- }
- set->freeze();
- return set.orphan();
-}
-
-UCPMap *makeMap(UProperty property, UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) { return nullptr; }
- uint32_t nullValue = property == UCHAR_SCRIPT ? USCRIPT_UNKNOWN : 0;
- icu::LocalUMutableCPTriePointer mutableTrie(
- umutablecptrie_open(nullValue, nullValue, &errorCode));
- const UnicodeSet *inclusions =
- icu::CharacterProperties::getInclusionsForProperty(property, errorCode);
- if (U_FAILURE(errorCode)) { return nullptr; }
- int32_t numRanges = inclusions->getRangeCount();
- UChar32 start = 0;
- uint32_t value = nullValue;
-
- for (int32_t i = 0; i < numRanges; ++i) {
- UChar32 rangeEnd = inclusions->getRangeEnd(i);
- for (UChar32 c = inclusions->getRangeStart(i); c <= rangeEnd; ++c) {
- // TODO: Get a UCharacterProperty.IntProperty to avoid the property dispatch.
- uint32_t nextValue = u_getIntPropertyValue(c, property);
- if (value != nextValue) {
- if (value != nullValue) {
- umutablecptrie_setRange(mutableTrie.getAlias(), start, c - 1, value, &errorCode);
- }
- start = c;
- value = nextValue;
- }
- }
- }
- if (value != 0) {
- umutablecptrie_setRange(mutableTrie.getAlias(), start, 0x10FFFF, value, &errorCode);
- }
-
- UCPTrieType type;
- if (property == UCHAR_BIDI_CLASS || property == UCHAR_GENERAL_CATEGORY) {
- type = UCPTRIE_TYPE_FAST;
- } else {
- type = UCPTRIE_TYPE_SMALL;
- }
- UCPTrieValueWidth valueWidth;
- // TODO: UCharacterProperty.IntProperty
- int32_t max = u_getIntPropertyMaxValue(property);
- if (max <= 0xff) {
- valueWidth = UCPTRIE_VALUE_BITS_8;
- } else if (max <= 0xffff) {
- valueWidth = UCPTRIE_VALUE_BITS_16;
- } else {
- valueWidth = UCPTRIE_VALUE_BITS_32;
- }
- return reinterpret_cast<UCPMap *>(
- umutablecptrie_buildImmutable(mutableTrie.getAlias(), type, valueWidth, &errorCode));
-}
-
-} // namespace
-
-U_NAMESPACE_USE
-
-U_CAPI const USet * U_EXPORT2
-u_getBinaryPropertySet(UProperty property, UErrorCode *pErrorCode) {
- if (U_FAILURE(*pErrorCode)) { return nullptr; }
- if (property < 0 || UCHAR_BINARY_LIMIT <= property) {
- *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
- }
- Mutex m(&cpMutex);
- UnicodeSet *set = sets[property];
- if (set == nullptr) {
- sets[property] = set = makeSet(property, *pErrorCode);
- }
- if (U_FAILURE(*pErrorCode)) { return nullptr; }
- return set->toUSet();
-}
-
-U_CAPI const UCPMap * U_EXPORT2
-u_getIntPropertyMap(UProperty property, UErrorCode *pErrorCode) {
- if (U_FAILURE(*pErrorCode)) { return nullptr; }
- if (property < UCHAR_INT_START || UCHAR_INT_LIMIT <= property) {
- *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
- }
- Mutex m(&cpMutex);
- UCPMap *map = maps[property - UCHAR_INT_START];
- if (map == nullptr) {
- maps[property - UCHAR_INT_START] = map = makeMap(property, *pErrorCode);
- }
- return map;
-}
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// characterproperties.cpp
+// created: 2018sep03 Markus W. Scherer
+
+#include "unicode/utypes.h"
+#include "unicode/localpointer.h"
+#include "unicode/uchar.h"
+#include "unicode/ucpmap.h"
+#include "unicode/ucptrie.h"
+#include "unicode/umutablecptrie.h"
+#include "unicode/uniset.h"
+#include "unicode/uscript.h"
+#include "unicode/uset.h"
+#include "cmemory.h"
+#include "mutex.h"
+#include "normalizer2impl.h"
+#include "uassert.h"
+#include "ubidi_props.h"
+#include "ucase.h"
+#include "ucln_cmn.h"
+#include "umutex.h"
+#include "uprops.h"
+
+using icu::LocalPointer;
+#if !UCONFIG_NO_NORMALIZATION
+using icu::Normalizer2Factory;
+using icu::Normalizer2Impl;
+#endif
+using icu::UInitOnce;
+using icu::UnicodeSet;
+
+namespace {
+
+UBool U_CALLCONV characterproperties_cleanup();
+
+constexpr int32_t NUM_INCLUSIONS = UPROPS_SRC_COUNT + UCHAR_INT_LIMIT - UCHAR_INT_START;
+
+struct Inclusion {
+ UnicodeSet *fSet = nullptr;
+ UInitOnce fInitOnce = U_INITONCE_INITIALIZER;
+};
+Inclusion gInclusions[NUM_INCLUSIONS]; // cached getInclusions()
+
+UnicodeSet *sets[UCHAR_BINARY_LIMIT] = {};
+
+UCPMap *maps[UCHAR_INT_LIMIT - UCHAR_INT_START] = {};
+
+icu::UMutex cpMutex;
+
+//----------------------------------------------------------------
+// Inclusions list
+//----------------------------------------------------------------
+
+// USetAdder implementation
+// Does not use uset.h to reduce code dependencies
+void U_CALLCONV
+_set_add(USet *set, UChar32 c) {
+ ((UnicodeSet *)set)->add(c);
+}
+
+void U_CALLCONV
+_set_addRange(USet *set, UChar32 start, UChar32 end) {
+ ((UnicodeSet *)set)->add(start, end);
+}
+
+void U_CALLCONV
+_set_addString(USet *set, const UChar *str, int32_t length) {
+ ((UnicodeSet *)set)->add(icu::UnicodeString((UBool)(length<0), str, length));
+}
+
+UBool U_CALLCONV characterproperties_cleanup() {
+ for (Inclusion &in: gInclusions) {
+ delete in.fSet;
+ in.fSet = nullptr;
+ in.fInitOnce.reset();
+ }
+ for (int32_t i = 0; i < UPRV_LENGTHOF(sets); ++i) {
+ delete sets[i];
+ sets[i] = nullptr;
+ }
+ for (int32_t i = 0; i < UPRV_LENGTHOF(maps); ++i) {
+ ucptrie_close(reinterpret_cast<UCPTrie *>(maps[i]));
+ maps[i] = nullptr;
+ }
+ return TRUE;
+}
+
+void U_CALLCONV initInclusion(UPropertySource src, UErrorCode &errorCode) {
+ // This function is invoked only via umtx_initOnce().
+ U_ASSERT(0 <= src && src < UPROPS_SRC_COUNT);
+ if (src == UPROPS_SRC_NONE) {
+ errorCode = U_INTERNAL_PROGRAM_ERROR;
+ return;
+ }
+ U_ASSERT(gInclusions[src].fSet == nullptr);
+
+ LocalPointer<UnicodeSet> incl(new UnicodeSet());
+ if (incl.isNull()) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ USetAdder sa = {
+ (USet *)incl.getAlias(),
+ _set_add,
+ _set_addRange,
+ _set_addString,
+ nullptr, // don't need remove()
+ nullptr // don't need removeRange()
+ };
+
+ switch(src) {
+ case UPROPS_SRC_CHAR:
+ uchar_addPropertyStarts(&sa, &errorCode);
+ break;
+ case UPROPS_SRC_PROPSVEC:
+ upropsvec_addPropertyStarts(&sa, &errorCode);
+ break;
+ case UPROPS_SRC_CHAR_AND_PROPSVEC:
+ uchar_addPropertyStarts(&sa, &errorCode);
+ upropsvec_addPropertyStarts(&sa, &errorCode);
+ break;
+#if !UCONFIG_NO_NORMALIZATION
+ case UPROPS_SRC_CASE_AND_NORM: {
+ const Normalizer2Impl *impl=Normalizer2Factory::getNFCImpl(errorCode);
+ if(U_SUCCESS(errorCode)) {
+ impl->addPropertyStarts(&sa, errorCode);
+ }
+ ucase_addPropertyStarts(&sa, &errorCode);
+ break;
+ }
+ case UPROPS_SRC_NFC: {
+ const Normalizer2Impl *impl=Normalizer2Factory::getNFCImpl(errorCode);
+ if(U_SUCCESS(errorCode)) {
+ impl->addPropertyStarts(&sa, errorCode);
+ }
+ break;
+ }
+ case UPROPS_SRC_NFKC: {
+ const Normalizer2Impl *impl=Normalizer2Factory::getNFKCImpl(errorCode);
+ if(U_SUCCESS(errorCode)) {
+ impl->addPropertyStarts(&sa, errorCode);
+ }
+ break;
+ }
+ case UPROPS_SRC_NFKC_CF: {
+ const Normalizer2Impl *impl=Normalizer2Factory::getNFKC_CFImpl(errorCode);
+ if(U_SUCCESS(errorCode)) {
+ impl->addPropertyStarts(&sa, errorCode);
+ }
+ break;
+ }
+ case UPROPS_SRC_NFC_CANON_ITER: {
+ const Normalizer2Impl *impl=Normalizer2Factory::getNFCImpl(errorCode);
+ if(U_SUCCESS(errorCode)) {
+ impl->addCanonIterPropertyStarts(&sa, errorCode);
+ }
+ break;
+ }
+#endif
+ case UPROPS_SRC_CASE:
+ ucase_addPropertyStarts(&sa, &errorCode);
+ break;
+ case UPROPS_SRC_BIDI:
+ ubidi_addPropertyStarts(&sa, &errorCode);
+ break;
+ case UPROPS_SRC_INPC:
+ case UPROPS_SRC_INSC:
+ case UPROPS_SRC_VO:
+ uprops_addPropertyStarts((UPropertySource)src, &sa, &errorCode);
+ break;
+ default:
+ errorCode = U_INTERNAL_PROGRAM_ERROR;
+ break;
+ }
+
+ if (U_FAILURE(errorCode)) {
+ return;
+ }
+ if (incl->isBogus()) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ // Compact for caching.
+ incl->compact();
+ gInclusions[src].fSet = incl.orphan();
+ ucln_common_registerCleanup(UCLN_COMMON_CHARACTERPROPERTIES, characterproperties_cleanup);
+}
+
+const UnicodeSet *getInclusionsForSource(UPropertySource src, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return nullptr; }
+ if (src < 0 || UPROPS_SRC_COUNT <= src) {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return nullptr;
+ }
+ Inclusion &i = gInclusions[src];
+ umtx_initOnce(i.fInitOnce, &initInclusion, src, errorCode);
+ return i.fSet;
+}
+
+void U_CALLCONV initIntPropInclusion(UProperty prop, UErrorCode &errorCode) {
+ // This function is invoked only via umtx_initOnce().
+ U_ASSERT(UCHAR_INT_START <= prop && prop < UCHAR_INT_LIMIT);
+ int32_t inclIndex = UPROPS_SRC_COUNT + prop - UCHAR_INT_START;
+ U_ASSERT(gInclusions[inclIndex].fSet == nullptr);
+ UPropertySource src = uprops_getSource(prop);
+ const UnicodeSet *incl = getInclusionsForSource(src, errorCode);
+ if (U_FAILURE(errorCode)) {
+ return;
+ }
+
+ LocalPointer<UnicodeSet> intPropIncl(new UnicodeSet(0, 0));
+ if (intPropIncl.isNull()) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ int32_t numRanges = incl->getRangeCount();
+ int32_t prevValue = 0;
+ for (int32_t i = 0; i < numRanges; ++i) {
+ UChar32 rangeEnd = incl->getRangeEnd(i);
+ for (UChar32 c = incl->getRangeStart(i); c <= rangeEnd; ++c) {
+ // TODO: Get a UCharacterProperty.IntProperty to avoid the property dispatch.
+ int32_t value = u_getIntPropertyValue(c, prop);
+ if (value != prevValue) {
+ intPropIncl->add(c);
+ prevValue = value;
+ }
+ }
+ }
+
+ if (intPropIncl->isBogus()) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ // Compact for caching.
+ intPropIncl->compact();
+ gInclusions[inclIndex].fSet = intPropIncl.orphan();
+ ucln_common_registerCleanup(UCLN_COMMON_CHARACTERPROPERTIES, characterproperties_cleanup);
+}
+
+} // namespace
+
+U_NAMESPACE_BEGIN
+
+const UnicodeSet *CharacterProperties::getInclusionsForProperty(
+ UProperty prop, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return nullptr; }
+ if (UCHAR_INT_START <= prop && prop < UCHAR_INT_LIMIT) {
+ int32_t inclIndex = UPROPS_SRC_COUNT + prop - UCHAR_INT_START;
+ Inclusion &i = gInclusions[inclIndex];
+ umtx_initOnce(i.fInitOnce, &initIntPropInclusion, prop, errorCode);
+ return i.fSet;
+ } else {
+ UPropertySource src = uprops_getSource(prop);
+ return getInclusionsForSource(src, errorCode);
+ }
+}
+
+U_NAMESPACE_END
+
+namespace {
+
+UnicodeSet *makeSet(UProperty property, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return nullptr; }
+ LocalPointer<UnicodeSet> set(new UnicodeSet());
+ if (set.isNull()) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+ const UnicodeSet *inclusions =
+ icu::CharacterProperties::getInclusionsForProperty(property, errorCode);
+ if (U_FAILURE(errorCode)) { return nullptr; }
+ int32_t numRanges = inclusions->getRangeCount();
+ UChar32 startHasProperty = -1;
+
+ for (int32_t i = 0; i < numRanges; ++i) {
+ UChar32 rangeEnd = inclusions->getRangeEnd(i);
+ for (UChar32 c = inclusions->getRangeStart(i); c <= rangeEnd; ++c) {
+ // TODO: Get a UCharacterProperty.BinaryProperty to avoid the property dispatch.
+ if (u_hasBinaryProperty(c, property)) {
+ if (startHasProperty < 0) {
+ // Transition from false to true.
+ startHasProperty = c;
+ }
+ } else if (startHasProperty >= 0) {
+ // Transition from true to false.
+ set->add(startHasProperty, c - 1);
+ startHasProperty = -1;
+ }
+ }
+ }
+ if (startHasProperty >= 0) {
+ set->add(startHasProperty, 0x10FFFF);
+ }
+ set->freeze();
+ return set.orphan();
+}
+
+UCPMap *makeMap(UProperty property, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return nullptr; }
+ uint32_t nullValue = property == UCHAR_SCRIPT ? USCRIPT_UNKNOWN : 0;
+ icu::LocalUMutableCPTriePointer mutableTrie(
+ umutablecptrie_open(nullValue, nullValue, &errorCode));
+ const UnicodeSet *inclusions =
+ icu::CharacterProperties::getInclusionsForProperty(property, errorCode);
+ if (U_FAILURE(errorCode)) { return nullptr; }
+ int32_t numRanges = inclusions->getRangeCount();
+ UChar32 start = 0;
+ uint32_t value = nullValue;
+
+ for (int32_t i = 0; i < numRanges; ++i) {
+ UChar32 rangeEnd = inclusions->getRangeEnd(i);
+ for (UChar32 c = inclusions->getRangeStart(i); c <= rangeEnd; ++c) {
+ // TODO: Get a UCharacterProperty.IntProperty to avoid the property dispatch.
+ uint32_t nextValue = u_getIntPropertyValue(c, property);
+ if (value != nextValue) {
+ if (value != nullValue) {
+ umutablecptrie_setRange(mutableTrie.getAlias(), start, c - 1, value, &errorCode);
+ }
+ start = c;
+ value = nextValue;
+ }
+ }
+ }
+ if (value != 0) {
+ umutablecptrie_setRange(mutableTrie.getAlias(), start, 0x10FFFF, value, &errorCode);
+ }
+
+ UCPTrieType type;
+ if (property == UCHAR_BIDI_CLASS || property == UCHAR_GENERAL_CATEGORY) {
+ type = UCPTRIE_TYPE_FAST;
+ } else {
+ type = UCPTRIE_TYPE_SMALL;
+ }
+ UCPTrieValueWidth valueWidth;
+ // TODO: UCharacterProperty.IntProperty
+ int32_t max = u_getIntPropertyMaxValue(property);
+ if (max <= 0xff) {
+ valueWidth = UCPTRIE_VALUE_BITS_8;
+ } else if (max <= 0xffff) {
+ valueWidth = UCPTRIE_VALUE_BITS_16;
+ } else {
+ valueWidth = UCPTRIE_VALUE_BITS_32;
+ }
+ return reinterpret_cast<UCPMap *>(
+ umutablecptrie_buildImmutable(mutableTrie.getAlias(), type, valueWidth, &errorCode));
+}
+
+} // namespace
+
+U_NAMESPACE_USE
+
+U_CAPI const USet * U_EXPORT2
+u_getBinaryPropertySet(UProperty property, UErrorCode *pErrorCode) {
+ if (U_FAILURE(*pErrorCode)) { return nullptr; }
+ if (property < 0 || UCHAR_BINARY_LIMIT <= property) {
+ *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return nullptr;
+ }
+ Mutex m(&cpMutex);
+ UnicodeSet *set = sets[property];
+ if (set == nullptr) {
+ sets[property] = set = makeSet(property, *pErrorCode);
+ }
+ if (U_FAILURE(*pErrorCode)) { return nullptr; }
+ return set->toUSet();
+}
+
+U_CAPI const UCPMap * U_EXPORT2
+u_getIntPropertyMap(UProperty property, UErrorCode *pErrorCode) {
+ if (U_FAILURE(*pErrorCode)) { return nullptr; }
+ if (property < UCHAR_INT_START || UCHAR_INT_LIMIT <= property) {
+ *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return nullptr;
+ }
+ Mutex m(&cpMutex);
+ UCPMap *map = maps[property - UCHAR_INT_START];
+ if (map == nullptr) {
+ maps[property - UCHAR_INT_START] = map = makeMap(property, *pErrorCode);
+ }
+ return map;
+}
diff --git a/contrib/libs/icu/common/chariter.cpp b/contrib/libs/icu/common/chariter.cpp
index 3ebbc43185..887119a0eb 100644
--- a/contrib/libs/icu/common/chariter.cpp
+++ b/contrib/libs/icu/common/chariter.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/charstr.cpp b/contrib/libs/icu/common/charstr.cpp
index cd89757a11..dda29dac63 100644
--- a/contrib/libs/icu/common/charstr.cpp
+++ b/contrib/libs/icu/common/charstr.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: charstr.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -15,7 +15,7 @@
*/
#include "unicode/utypes.h"
-#include "unicode/putil.h"
+#include "unicode/putil.h"
#include "charstr.h"
#include "cmemory.h"
#include "cstring.h"
@@ -23,29 +23,29 @@
U_NAMESPACE_BEGIN
-CharString::CharString(CharString&& src) U_NOEXCEPT
- : buffer(std::move(src.buffer)), len(src.len) {
- src.len = 0; // not strictly necessary because we make no guarantees on the source string
-}
-
-CharString& CharString::operator=(CharString&& src) U_NOEXCEPT {
- buffer = std::move(src.buffer);
- len = src.len;
- src.len = 0; // not strictly necessary because we make no guarantees on the source string
- return *this;
-}
-
-char *CharString::cloneData(UErrorCode &errorCode) const {
- if (U_FAILURE(errorCode)) { return nullptr; }
- char *p = static_cast<char *>(uprv_malloc(len + 1));
- if (p == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
- uprv_memcpy(p, buffer.getAlias(), len + 1);
- return p;
-}
-
+CharString::CharString(CharString&& src) U_NOEXCEPT
+ : buffer(std::move(src.buffer)), len(src.len) {
+ src.len = 0; // not strictly necessary because we make no guarantees on the source string
+}
+
+CharString& CharString::operator=(CharString&& src) U_NOEXCEPT {
+ buffer = std::move(src.buffer);
+ len = src.len;
+ src.len = 0; // not strictly necessary because we make no guarantees on the source string
+ return *this;
+}
+
+char *CharString::cloneData(UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode)) { return nullptr; }
+ char *p = static_cast<char *>(uprv_malloc(len + 1));
+ if (p == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+ uprv_memcpy(p, buffer.getAlias(), len + 1);
+ return p;
+}
+
CharString &CharString::copyFrom(const CharString &s, UErrorCode &errorCode) {
if(U_SUCCESS(errorCode) && this!=&s && ensureCapacity(s.len+1, 0, errorCode)) {
len=s.len;
@@ -63,18 +63,18 @@ int32_t CharString::lastIndexOf(char c) const {
return -1;
}
-bool CharString::contains(StringPiece s) const {
- if (s.empty()) { return false; }
- const char *p = buffer.getAlias();
- int32_t lastStart = len - s.length();
- for (int32_t i = 0; i <= lastStart; ++i) {
- if (uprv_memcmp(p + i, s.data(), s.length()) == 0) {
- return true;
- }
- }
- return false;
-}
-
+bool CharString::contains(StringPiece s) const {
+ if (s.empty()) { return false; }
+ const char *p = buffer.getAlias();
+ int32_t lastStart = len - s.length();
+ for (int32_t i = 0; i <= lastStart; ++i) {
+ if (uprv_memcmp(p + i, s.data(), s.length()) == 0) {
+ return true;
+ }
+ }
+ return false;
+}
+
CharString &CharString::truncate(int32_t newLength) {
if(newLength<0) {
newLength=0;
@@ -102,7 +102,7 @@ CharString &CharString::append(const char *s, int32_t sLength, UErrorCode &error
return *this;
}
if(sLength<0) {
- sLength= static_cast<int32_t>(uprv_strlen(s));
+ sLength= static_cast<int32_t>(uprv_strlen(s));
}
if(sLength>0) {
if(s==(buffer.getAlias()+len)) {
@@ -149,21 +149,21 @@ char *CharString::getAppendBuffer(int32_t minCapacity,
}
CharString &CharString::appendInvariantChars(const UnicodeString &s, UErrorCode &errorCode) {
- return appendInvariantChars(s.getBuffer(), s.length(), errorCode);
-}
-
-CharString &CharString::appendInvariantChars(const UChar* uchars, int32_t ucharsLen, UErrorCode &errorCode) {
+ return appendInvariantChars(s.getBuffer(), s.length(), errorCode);
+}
+
+CharString &CharString::appendInvariantChars(const UChar* uchars, int32_t ucharsLen, UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
return *this;
}
- if (!uprv_isInvariantUString(uchars, ucharsLen)) {
+ if (!uprv_isInvariantUString(uchars, ucharsLen)) {
errorCode = U_INVARIANT_CONVERSION_ERROR;
return *this;
}
- if(ensureCapacity(len+ucharsLen+1, 0, errorCode)) {
- u_UCharsToChars(uchars, buffer.getAlias()+len, ucharsLen);
- len += ucharsLen;
- buffer[len] = 0;
+ if(ensureCapacity(len+ucharsLen+1, 0, errorCode)) {
+ u_UCharsToChars(uchars, buffer.getAlias()+len, ucharsLen);
+ len += ucharsLen;
+ buffer[len] = 0;
}
return *this;
}
diff --git a/contrib/libs/icu/common/charstr.h b/contrib/libs/icu/common/charstr.h
index 818f6a997a..23b950ed6e 100644
--- a/contrib/libs/icu/common/charstr.h
+++ b/contrib/libs/icu/common/charstr.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -56,18 +56,18 @@ public:
~CharString() {}
/**
- * Move constructor; might leave src in an undefined state.
- * This string will have the same contents and state that the source string had.
- */
- CharString(CharString &&src) U_NOEXCEPT;
- /**
- * Move assignment operator; might leave src in an undefined state.
- * This string will have the same contents and state that the source string had.
- * The behavior is undefined if *this and src are the same object.
- */
- CharString &operator=(CharString &&src) U_NOEXCEPT;
-
- /**
+ * Move constructor; might leave src in an undefined state.
+ * This string will have the same contents and state that the source string had.
+ */
+ CharString(CharString &&src) U_NOEXCEPT;
+ /**
+ * Move assignment operator; might leave src in an undefined state.
+ * This string will have the same contents and state that the source string had.
+ * The behavior is undefined if *this and src are the same object.
+ */
+ CharString &operator=(CharString &&src) U_NOEXCEPT;
+
+ /**
* Replaces this string's contents with the other string's contents.
* CharString does not support the standard copy constructor nor
* the assignment operator, to make copies explicit and to
@@ -82,24 +82,24 @@ public:
const char *data() const { return buffer.getAlias(); }
char *data() { return buffer.getAlias(); }
- /**
- * Allocates length()+1 chars and copies the NUL-terminated data().
- * The caller must uprv_free() the result.
- */
- char *cloneData(UErrorCode &errorCode) const;
-
- bool operator==(StringPiece other) const {
- return len == other.length() && (len == 0 || uprv_memcmp(data(), other.data(), len) == 0);
- }
- bool operator!=(StringPiece other) const {
- return !operator==(other);
- }
-
+ /**
+ * Allocates length()+1 chars and copies the NUL-terminated data().
+ * The caller must uprv_free() the result.
+ */
+ char *cloneData(UErrorCode &errorCode) const;
+
+ bool operator==(StringPiece other) const {
+ return len == other.length() && (len == 0 || uprv_memcmp(data(), other.data(), len) == 0);
+ }
+ bool operator!=(StringPiece other) const {
+ return !operator==(other);
+ }
+
/** @return last index of c, or -1 if c is not in this string */
int32_t lastIndexOf(char c) const;
- bool contains(StringPiece s) const;
-
+ bool contains(StringPiece s) const;
+
CharString &clear() { len=0; buffer[0]=0; return *this; }
CharString &truncate(int32_t newLength);
@@ -137,7 +137,7 @@ public:
UErrorCode &errorCode);
CharString &appendInvariantChars(const UnicodeString &s, UErrorCode &errorCode);
- CharString &appendInvariantChars(const UChar* uchars, int32_t ucharsLen, UErrorCode& errorCode);
+ CharString &appendInvariantChars(const UChar* uchars, int32_t ucharsLen, UErrorCode& errorCode);
/**
* Appends a filename/path part, e.g., a directory name.
diff --git a/contrib/libs/icu/common/cmemory.cpp b/contrib/libs/icu/common/cmemory.cpp
index bdbd083fc4..663c1411e4 100644
--- a/contrib/libs/icu/common/cmemory.cpp
+++ b/contrib/libs/icu/common/cmemory.cpp
@@ -1,138 +1,138 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 2002-2015, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-*
-* File cmemory.c ICU Heap allocation.
-* All ICU heap allocation, both for C and C++ new of ICU
-* class types, comes through these functions.
-*
-* If you have a need to replace ICU allocation, this is the
-* place to do it.
-*
-* Note that uprv_malloc(0) returns a non-NULL pointer, and
-* that a subsequent free of that pointer value is a NOP.
-*
-******************************************************************************
-*/
-#include "unicode/uclean.h"
-#include "cmemory.h"
-#include "putilimp.h"
-#include "uassert.h"
-#include <stdlib.h>
-
-/* uprv_malloc(0) returns a pointer to this read-only data. */
-static const int32_t zeroMem[] = {0, 0, 0, 0, 0, 0};
-
-/* Function Pointers for user-supplied heap functions */
-static const void *pContext;
-static UMemAllocFn *pAlloc;
-static UMemReallocFn *pRealloc;
-static UMemFreeFn *pFree;
-
-#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
-#include <stdio.h>
-static int n=0;
-static long b=0;
-#endif
-
-U_CAPI void * U_EXPORT2
-uprv_malloc(size_t s) {
-#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
-#if 1
- putchar('>');
- fflush(stdout);
-#else
- fprintf(stderr,"MALLOC\t#%d\t%ul bytes\t%ul total\n", ++n,s,(b+=s)); fflush(stderr);
-#endif
-#endif
- if (s > 0) {
- if (pAlloc) {
- return (*pAlloc)(pContext, s);
- } else {
- return uprv_default_malloc(s);
- }
- } else {
- return (void *)zeroMem;
- }
-}
-
-U_CAPI void * U_EXPORT2
-uprv_realloc(void * buffer, size_t size) {
-#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
- putchar('~');
- fflush(stdout);
-#endif
- if (buffer == zeroMem) {
- return uprv_malloc(size);
- } else if (size == 0) {
- if (pFree) {
- (*pFree)(pContext, buffer);
- } else {
- uprv_default_free(buffer);
- }
- return (void *)zeroMem;
- } else {
- if (pRealloc) {
- return (*pRealloc)(pContext, buffer, size);
- } else {
- return uprv_default_realloc(buffer, size);
- }
- }
-}
-
-U_CAPI void U_EXPORT2
-uprv_free(void *buffer) {
-#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
- putchar('<');
- fflush(stdout);
-#endif
- if (buffer != zeroMem) {
- if (pFree) {
- (*pFree)(pContext, buffer);
- } else {
- uprv_default_free(buffer);
- }
- }
-}
-
-U_CAPI void * U_EXPORT2
-uprv_calloc(size_t num, size_t size) {
- void *mem = NULL;
- size *= num;
- mem = uprv_malloc(size);
- if (mem) {
- uprv_memset(mem, 0, size);
- }
- return mem;
-}
-
-U_CAPI void U_EXPORT2
-u_setMemoryFunctions(const void *context, UMemAllocFn *a, UMemReallocFn *r, UMemFreeFn *f, UErrorCode *status)
-{
- if (U_FAILURE(*status)) {
- return;
- }
- if (a==NULL || r==NULL || f==NULL) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- pContext = context;
- pAlloc = a;
- pRealloc = r;
- pFree = f;
-}
-
-
-U_CFUNC UBool cmemory_cleanup(void) {
- pContext = NULL;
- pAlloc = NULL;
- pRealloc = NULL;
- pFree = NULL;
- return TRUE;
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 2002-2015, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+*
+* File cmemory.c ICU Heap allocation.
+* All ICU heap allocation, both for C and C++ new of ICU
+* class types, comes through these functions.
+*
+* If you have a need to replace ICU allocation, this is the
+* place to do it.
+*
+* Note that uprv_malloc(0) returns a non-NULL pointer, and
+* that a subsequent free of that pointer value is a NOP.
+*
+******************************************************************************
+*/
+#include "unicode/uclean.h"
+#include "cmemory.h"
+#include "putilimp.h"
+#include "uassert.h"
+#include <stdlib.h>
+
+/* uprv_malloc(0) returns a pointer to this read-only data. */
+static const int32_t zeroMem[] = {0, 0, 0, 0, 0, 0};
+
+/* Function Pointers for user-supplied heap functions */
+static const void *pContext;
+static UMemAllocFn *pAlloc;
+static UMemReallocFn *pRealloc;
+static UMemFreeFn *pFree;
+
+#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
+#include <stdio.h>
+static int n=0;
+static long b=0;
+#endif
+
+U_CAPI void * U_EXPORT2
+uprv_malloc(size_t s) {
+#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
+#if 1
+ putchar('>');
+ fflush(stdout);
+#else
+ fprintf(stderr,"MALLOC\t#%d\t%ul bytes\t%ul total\n", ++n,s,(b+=s)); fflush(stderr);
+#endif
+#endif
+ if (s > 0) {
+ if (pAlloc) {
+ return (*pAlloc)(pContext, s);
+ } else {
+ return uprv_default_malloc(s);
+ }
+ } else {
+ return (void *)zeroMem;
+ }
+}
+
+U_CAPI void * U_EXPORT2
+uprv_realloc(void * buffer, size_t size) {
+#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
+ putchar('~');
+ fflush(stdout);
+#endif
+ if (buffer == zeroMem) {
+ return uprv_malloc(size);
+ } else if (size == 0) {
+ if (pFree) {
+ (*pFree)(pContext, buffer);
+ } else {
+ uprv_default_free(buffer);
+ }
+ return (void *)zeroMem;
+ } else {
+ if (pRealloc) {
+ return (*pRealloc)(pContext, buffer, size);
+ } else {
+ return uprv_default_realloc(buffer, size);
+ }
+ }
+}
+
+U_CAPI void U_EXPORT2
+uprv_free(void *buffer) {
+#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
+ putchar('<');
+ fflush(stdout);
+#endif
+ if (buffer != zeroMem) {
+ if (pFree) {
+ (*pFree)(pContext, buffer);
+ } else {
+ uprv_default_free(buffer);
+ }
+ }
+}
+
+U_CAPI void * U_EXPORT2
+uprv_calloc(size_t num, size_t size) {
+ void *mem = NULL;
+ size *= num;
+ mem = uprv_malloc(size);
+ if (mem) {
+ uprv_memset(mem, 0, size);
+ }
+ return mem;
+}
+
+U_CAPI void U_EXPORT2
+u_setMemoryFunctions(const void *context, UMemAllocFn *a, UMemReallocFn *r, UMemFreeFn *f, UErrorCode *status)
+{
+ if (U_FAILURE(*status)) {
+ return;
+ }
+ if (a==NULL || r==NULL || f==NULL) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ pContext = context;
+ pAlloc = a;
+ pRealloc = r;
+ pFree = f;
+}
+
+
+U_CFUNC UBool cmemory_cleanup(void) {
+ pContext = NULL;
+ pAlloc = NULL;
+ pRealloc = NULL;
+ pFree = NULL;
+ return TRUE;
+}
diff --git a/contrib/libs/icu/common/cmemory.h b/contrib/libs/icu/common/cmemory.h
index 9121f3f8b5..8d60442021 100644
--- a/contrib/libs/icu/common/cmemory.h
+++ b/contrib/libs/icu/common/cmemory.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -50,7 +50,7 @@
#define UPRV_LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
#define uprv_memset(buffer, mark, size) U_STANDARD_CPP_NAMESPACE memset(buffer, mark, size)
#define uprv_memcmp(buffer1, buffer2, size) U_STANDARD_CPP_NAMESPACE memcmp(buffer1, buffer2,size)
-#define uprv_memchr(ptr, value, num) U_STANDARD_CPP_NAMESPACE memchr(ptr, value, num)
+#define uprv_memchr(ptr, value, num) U_STANDARD_CPP_NAMESPACE memchr(ptr, value, num)
U_CAPI void * U_EXPORT2
uprv_malloc(size_t s) U_MALLOC_ATTR U_ALLOC_SIZE_ATTR(1);
@@ -69,32 +69,32 @@ uprv_calloc(size_t num, size_t size) U_MALLOC_ATTR U_ALLOC_SIZE_ATTR2(1,2);
* For example, with a mask of 3, the macro gets the 2 least significant bits,
* which will be 0 if the pointer is 32-bit (4-byte) aligned.
*
- * uintptr_t is the most appropriate integer type to cast to.
+ * uintptr_t is the most appropriate integer type to cast to.
*/
-#define U_POINTER_MASK_LSB(ptr, mask) ((uintptr_t)(ptr) & (mask))
+#define U_POINTER_MASK_LSB(ptr, mask) ((uintptr_t)(ptr) & (mask))
/**
- * Create & return an instance of "type" in statically allocated storage.
- * e.g.
- * static std::mutex *myMutex = STATIC_NEW(std::mutex);
- * To destroy an object created in this way, invoke the destructor explicitly, e.g.
- * myMutex->~mutex();
- * DO NOT use delete.
- * DO NOT use with class UMutex, which has specific support for static instances.
- *
- * STATIC_NEW is intended for use when
- * - We want a static (or global) object.
- * - We don't want it to ever be destructed, or to explicitly control destruction,
- * to avoid use-after-destruction problems.
- * - We want to avoid an ordinary heap allocated object,
- * to avoid the possibility of memory allocation failures, and
- * to avoid memory leak reports, from valgrind, for example.
- * This is defined as a macro rather than a template function because each invocation
- * must define distinct static storage for the object being returned.
+ * Create & return an instance of "type" in statically allocated storage.
+ * e.g.
+ * static std::mutex *myMutex = STATIC_NEW(std::mutex);
+ * To destroy an object created in this way, invoke the destructor explicitly, e.g.
+ * myMutex->~mutex();
+ * DO NOT use delete.
+ * DO NOT use with class UMutex, which has specific support for static instances.
+ *
+ * STATIC_NEW is intended for use when
+ * - We want a static (or global) object.
+ * - We don't want it to ever be destructed, or to explicitly control destruction,
+ * to avoid use-after-destruction problems.
+ * - We want to avoid an ordinary heap allocated object,
+ * to avoid the possibility of memory allocation failures, and
+ * to avoid memory leak reports, from valgrind, for example.
+ * This is defined as a macro rather than a template function because each invocation
+ * must define distinct static storage for the object being returned.
*/
-#define STATIC_NEW(type) [] () { \
- alignas(type) static char storage[sizeof(type)]; \
- return new(storage) type();} ()
+#define STATIC_NEW(type) [] () { \
+ alignas(type) static char storage[sizeof(type)]; \
+ return new(storage) type();} ()
/**
* Heap clean up function, called from u_cleanup()
@@ -122,9 +122,9 @@ uprv_deleteUObject(void *obj);
#ifdef __cplusplus
-#include <utility>
-#include "unicode/uobject.h"
-
+#include <utility>
+#include "unicode/uobject.h"
+
U_NAMESPACE_BEGIN
/**
@@ -164,7 +164,7 @@ public:
* @return *this
*/
LocalMemory<T> &operator=(LocalMemory<T> &&src) U_NOEXCEPT {
- uprv_free(LocalPointerBase<T>::ptr);
+ uprv_free(LocalPointerBase<T>::ptr);
LocalPointerBase<T>::ptr=src.ptr;
src.ptr=NULL;
return *this;
@@ -271,49 +271,49 @@ inline T *LocalMemory<T>::allocateInsteadAndCopy(int32_t newCapacity, int32_t le
*
* Unlike LocalMemory and LocalArray, this class never adopts
* (takes ownership of) another array.
- *
- * WARNING: MaybeStackArray only works with primitive (plain-old data) types.
- * It does NOT know how to call a destructor! If you work with classes with
- * destructors, consider:
- *
- * - LocalArray in localpointer.h if you know the length ahead of time
- * - MaybeStackVector if you know the length at runtime
+ *
+ * WARNING: MaybeStackArray only works with primitive (plain-old data) types.
+ * It does NOT know how to call a destructor! If you work with classes with
+ * destructors, consider:
+ *
+ * - LocalArray in localpointer.h if you know the length ahead of time
+ * - MaybeStackVector if you know the length at runtime
*/
template<typename T, int32_t stackCapacity>
class MaybeStackArray {
public:
- // No heap allocation. Use only on the stack.
- static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete;
- static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete;
-#if U_HAVE_PLACEMENT_NEW
- static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete;
-#endif
-
+ // No heap allocation. Use only on the stack.
+ static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete;
+ static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete;
+#if U_HAVE_PLACEMENT_NEW
+ static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete;
+#endif
+
/**
* Default constructor initializes with internal T[stackCapacity] buffer.
*/
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); }
- }
- /**
+ * 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); }
+ }
+ /**
* Destructor deletes the array (if owned).
*/
~MaybeStackArray() { releaseArray(); }
/**
- * Move constructor: transfers ownership or copies the stack array.
- */
- MaybeStackArray(MaybeStackArray<T, stackCapacity> &&src) U_NOEXCEPT;
- /**
- * Move assignment: transfers ownership or copies the stack array.
- */
- MaybeStackArray<T, stackCapacity> &operator=(MaybeStackArray<T, stackCapacity> &&src) U_NOEXCEPT;
- /**
+ * Move constructor: transfers ownership or copies the stack array.
+ */
+ MaybeStackArray(MaybeStackArray<T, stackCapacity> &&src) U_NOEXCEPT;
+ /**
+ * Move assignment: transfers ownership or copies the stack array.
+ */
+ MaybeStackArray<T, stackCapacity> &operator=(MaybeStackArray<T, stackCapacity> &&src) U_NOEXCEPT;
+ /**
* Returns the array capacity (number of T items).
* @return array capacity
*/
@@ -390,11 +390,11 @@ private:
uprv_free(ptr);
}
}
- void resetToStackArray() {
- ptr=stackArray;
- capacity=stackCapacity;
- needToRelease=FALSE;
- }
+ void resetToStackArray() {
+ ptr=stackArray;
+ capacity=stackCapacity;
+ needToRelease=FALSE;
+ }
/* No comparison operators with other MaybeStackArray's. */
bool operator==(const MaybeStackArray & /*other*/) {return FALSE;}
bool operator!=(const MaybeStackArray & /*other*/) {return TRUE;}
@@ -404,34 +404,34 @@ private:
};
template<typename T, int32_t stackCapacity>
-icu::MaybeStackArray<T, stackCapacity>::MaybeStackArray(
- MaybeStackArray <T, stackCapacity>&& src) U_NOEXCEPT
- : ptr(src.ptr), capacity(src.capacity), needToRelease(src.needToRelease) {
- if (src.ptr == src.stackArray) {
- ptr = stackArray;
- uprv_memcpy(stackArray, src.stackArray, sizeof(T) * src.capacity);
- } else {
- src.resetToStackArray(); // take ownership away from src
- }
-}
-
-template<typename T, int32_t stackCapacity>
-inline MaybeStackArray <T, stackCapacity>&
-MaybeStackArray<T, stackCapacity>::operator=(MaybeStackArray <T, stackCapacity>&& src) U_NOEXCEPT {
- releaseArray(); // in case this instance had its own memory allocated
- capacity = src.capacity;
- needToRelease = src.needToRelease;
- if (src.ptr == src.stackArray) {
- ptr = stackArray;
- uprv_memcpy(stackArray, src.stackArray, sizeof(T) * src.capacity);
- } else {
- ptr = src.ptr;
- src.resetToStackArray(); // take ownership away from src
- }
- return *this;
-}
-
-template<typename T, int32_t stackCapacity>
+icu::MaybeStackArray<T, stackCapacity>::MaybeStackArray(
+ MaybeStackArray <T, stackCapacity>&& src) U_NOEXCEPT
+ : ptr(src.ptr), capacity(src.capacity), needToRelease(src.needToRelease) {
+ if (src.ptr == src.stackArray) {
+ ptr = stackArray;
+ uprv_memcpy(stackArray, src.stackArray, sizeof(T) * src.capacity);
+ } else {
+ src.resetToStackArray(); // take ownership away from src
+ }
+}
+
+template<typename T, int32_t stackCapacity>
+inline MaybeStackArray <T, stackCapacity>&
+MaybeStackArray<T, stackCapacity>::operator=(MaybeStackArray <T, stackCapacity>&& src) U_NOEXCEPT {
+ releaseArray(); // in case this instance had its own memory allocated
+ capacity = src.capacity;
+ needToRelease = src.needToRelease;
+ if (src.ptr == src.stackArray) {
+ ptr = stackArray;
+ uprv_memcpy(stackArray, src.stackArray, sizeof(T) * src.capacity);
+ } else {
+ ptr = src.ptr;
+ src.resetToStackArray(); // take ownership away from src
+ }
+ return *this;
+}
+
+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)
@@ -480,7 +480,7 @@ inline T *MaybeStackArray<T, stackCapacity>::orphanOrClone(int32_t length, int32
uprv_memcpy(p, ptr, (size_t)length*sizeof(T));
}
resultCapacity=length;
- resetToStackArray();
+ resetToStackArray();
return p;
}
@@ -497,13 +497,13 @@ inline T *MaybeStackArray<T, stackCapacity>::orphanOrClone(int32_t length, int32
template<typename H, typename T, int32_t stackCapacity>
class MaybeStackHeaderAndArray {
public:
- // No heap allocation. Use only on the stack.
- static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete;
- static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete;
-#if U_HAVE_PLACEMENT_NEW
- static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete;
-#endif
-
+ // No heap allocation. Use only on the stack.
+ static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete;
+ static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete;
+#if U_HAVE_PLACEMENT_NEW
+ static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete;
+#endif
+
/**
* Default constructor initializes with internal H+T[stackCapacity] buffer.
*/
@@ -661,159 +661,159 @@ inline H *MaybeStackHeaderAndArray<H, T, stackCapacity>::orphanOrClone(int32_t l
return p;
}
-/**
- * A simple memory management class that creates new heap allocated objects (of
- * any class that has a public constructor), keeps track of them and eventually
- * deletes them all in its own destructor.
- *
- * A typical use-case would be code like this:
- *
- * MemoryPool<MyType> pool;
- *
- * MyType* o1 = pool.create();
- * if (o1 != nullptr) {
- * foo(o1);
- * }
- *
- * MyType* o2 = pool.create(1, 2, 3);
- * if (o2 != nullptr) {
- * bar(o2);
- * }
- *
- * // MemoryPool will take care of deleting the MyType objects.
- *
- * It doesn't do anything more than that, and is intentionally kept minimalist.
- */
-template<typename T, int32_t stackCapacity = 8>
-class MemoryPool : public UMemory {
-public:
- MemoryPool() : fCount(0), fPool() {}
-
- ~MemoryPool() {
- for (int32_t i = 0; i < fCount; ++i) {
- delete fPool[i];
- }
- }
-
- MemoryPool(const MemoryPool&) = delete;
- MemoryPool& operator=(const MemoryPool&) = delete;
-
- MemoryPool(MemoryPool&& other) U_NOEXCEPT : fCount(other.fCount),
- fPool(std::move(other.fPool)) {
- other.fCount = 0;
- }
-
- MemoryPool& operator=(MemoryPool&& other) U_NOEXCEPT {
- fCount = other.fCount;
- fPool = std::move(other.fPool);
- other.fCount = 0;
- return *this;
- }
-
- /**
- * Creates a new object of typename T, by forwarding any and all arguments
- * to the typename T constructor.
- *
- * @param args Arguments to be forwarded to the typename T constructor.
- * @return A pointer to the newly created object, or nullptr on error.
- */
- template<typename... Args>
- T* create(Args&&... args) {
- int32_t capacity = fPool.getCapacity();
- if (fCount == capacity &&
- fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity,
- capacity) == nullptr) {
- return nullptr;
- }
- return fPool[fCount++] = new T(std::forward<Args>(args)...);
- }
-
- /**
- * @return Number of elements that have been allocated.
- */
- int32_t count() const {
- return fCount;
- }
-
-protected:
- int32_t fCount;
- MaybeStackArray<T*, stackCapacity> fPool;
-};
-
-/**
- * An internal Vector-like implementation based on MemoryPool.
- *
- * Heap-allocates each element and stores pointers.
- *
- * To append an item to the vector, use emplaceBack.
- *
- * MaybeStackVector<MyType> vector;
- * MyType* element = vector.emplaceBack();
- * if (!element) {
- * status = U_MEMORY_ALLOCATION_ERROR;
- * }
- * // do stuff with element
- *
- * To loop over the vector, use a for loop with indices:
- *
- * for (int32_t i = 0; i < vector.length(); i++) {
- * MyType* element = vector[i];
- * }
- */
-template<typename T, int32_t stackCapacity = 8>
-class MaybeStackVector : protected MemoryPool<T, stackCapacity> {
-public:
- using MemoryPool<T, stackCapacity>::MemoryPool;
- using MemoryPool<T, stackCapacity>::operator=;
-
- template<typename... Args>
- T* emplaceBack(Args&&... args) {
- return this->create(args...);
- }
-
- int32_t length() const {
- return this->fCount;
- }
-
- T** getAlias() {
- return this->fPool.getAlias();
- }
-
- /**
- * Array item access (read-only).
- * No index bounds check.
- * @param i array index
- * @return reference to the array item
- */
- const T* operator[](ptrdiff_t i) const {
- return this->fPool[i];
- }
-
- /**
- * Array item access (writable).
- * No index bounds check.
- * @param i array index
- * @return reference to the array item
- */
- 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;
- }
- }
- }
-};
-
-
+/**
+ * A simple memory management class that creates new heap allocated objects (of
+ * any class that has a public constructor), keeps track of them and eventually
+ * deletes them all in its own destructor.
+ *
+ * A typical use-case would be code like this:
+ *
+ * MemoryPool<MyType> pool;
+ *
+ * MyType* o1 = pool.create();
+ * if (o1 != nullptr) {
+ * foo(o1);
+ * }
+ *
+ * MyType* o2 = pool.create(1, 2, 3);
+ * if (o2 != nullptr) {
+ * bar(o2);
+ * }
+ *
+ * // MemoryPool will take care of deleting the MyType objects.
+ *
+ * It doesn't do anything more than that, and is intentionally kept minimalist.
+ */
+template<typename T, int32_t stackCapacity = 8>
+class MemoryPool : public UMemory {
+public:
+ MemoryPool() : fCount(0), fPool() {}
+
+ ~MemoryPool() {
+ for (int32_t i = 0; i < fCount; ++i) {
+ delete fPool[i];
+ }
+ }
+
+ MemoryPool(const MemoryPool&) = delete;
+ MemoryPool& operator=(const MemoryPool&) = delete;
+
+ MemoryPool(MemoryPool&& other) U_NOEXCEPT : fCount(other.fCount),
+ fPool(std::move(other.fPool)) {
+ other.fCount = 0;
+ }
+
+ MemoryPool& operator=(MemoryPool&& other) U_NOEXCEPT {
+ fCount = other.fCount;
+ fPool = std::move(other.fPool);
+ other.fCount = 0;
+ return *this;
+ }
+
+ /**
+ * Creates a new object of typename T, by forwarding any and all arguments
+ * to the typename T constructor.
+ *
+ * @param args Arguments to be forwarded to the typename T constructor.
+ * @return A pointer to the newly created object, or nullptr on error.
+ */
+ template<typename... Args>
+ T* create(Args&&... args) {
+ int32_t capacity = fPool.getCapacity();
+ if (fCount == capacity &&
+ fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity,
+ capacity) == nullptr) {
+ return nullptr;
+ }
+ return fPool[fCount++] = new T(std::forward<Args>(args)...);
+ }
+
+ /**
+ * @return Number of elements that have been allocated.
+ */
+ int32_t count() const {
+ return fCount;
+ }
+
+protected:
+ int32_t fCount;
+ MaybeStackArray<T*, stackCapacity> fPool;
+};
+
+/**
+ * An internal Vector-like implementation based on MemoryPool.
+ *
+ * Heap-allocates each element and stores pointers.
+ *
+ * To append an item to the vector, use emplaceBack.
+ *
+ * MaybeStackVector<MyType> vector;
+ * MyType* element = vector.emplaceBack();
+ * if (!element) {
+ * status = U_MEMORY_ALLOCATION_ERROR;
+ * }
+ * // do stuff with element
+ *
+ * To loop over the vector, use a for loop with indices:
+ *
+ * for (int32_t i = 0; i < vector.length(); i++) {
+ * MyType* element = vector[i];
+ * }
+ */
+template<typename T, int32_t stackCapacity = 8>
+class MaybeStackVector : protected MemoryPool<T, stackCapacity> {
+public:
+ using MemoryPool<T, stackCapacity>::MemoryPool;
+ using MemoryPool<T, stackCapacity>::operator=;
+
+ template<typename... Args>
+ T* emplaceBack(Args&&... args) {
+ return this->create(args...);
+ }
+
+ int32_t length() const {
+ return this->fCount;
+ }
+
+ T** getAlias() {
+ return this->fPool.getAlias();
+ }
+
+ /**
+ * Array item access (read-only).
+ * No index bounds check.
+ * @param i array index
+ * @return reference to the array item
+ */
+ const T* operator[](ptrdiff_t i) const {
+ return this->fPool[i];
+ }
+
+ /**
+ * Array item access (writable).
+ * No index bounds check.
+ * @param i array index
+ * @return reference to the array item
+ */
+ 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;
+ }
+ }
+ }
+};
+
+
U_NAMESPACE_END
#endif /* __cplusplus */
diff --git a/contrib/libs/icu/common/cpputils.h b/contrib/libs/icu/common/cpputils.h
index 689e3c3a9a..307e570486 100644
--- a/contrib/libs/icu/common/cpputils.h
+++ b/contrib/libs/icu/common/cpputils.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: cpputils.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*/
diff --git a/contrib/libs/icu/common/cstr.cpp b/contrib/libs/icu/common/cstr.cpp
index 7e4aa0dfe7..24654f8fc2 100644
--- a/contrib/libs/icu/common/cstr.cpp
+++ b/contrib/libs/icu/common/cstr.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/common/cstr.h b/contrib/libs/icu/common/cstr.h
index d567c7d827..c33f487ea1 100644
--- a/contrib/libs/icu/common/cstr.h
+++ b/contrib/libs/icu/common/cstr.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/common/cstring.cpp b/contrib/libs/icu/common/cstring.cpp
index 07a64dfa65..06275c4b56 100644
--- a/contrib/libs/icu/common/cstring.cpp
+++ b/contrib/libs/icu/common/cstring.cpp
@@ -1,341 +1,341 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 1997-2011, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-*
-* File CSTRING.C
-*
-* @author Helena Shih
-*
-* Modification History:
-*
-* Date Name Description
-* 6/18/98 hshih Created
-* 09/08/98 stephen Added include for ctype, for Mac Port
-* 11/15/99 helena Integrated S/390 IEEE changes.
-******************************************************************************
-*/
-
-
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "unicode/utypes.h"
-#include "cmemory.h"
-#include "cstring.h"
-#include "uassert.h"
-
-/*
- * We hardcode case conversion for invariant characters to match our expectation
- * and the compiler execution charset.
- * This prevents problems on systems
- * - with non-default casing behavior, like Turkish system locales where
- * tolower('I') maps to dotless i and toupper('i') maps to dotted I
- * - where there are no lowercase Latin characters at all, or using different
- * codes (some old EBCDIC codepages)
- *
- * This works because the compiler usually runs on a platform where the execution
- * charset includes all of the invariant characters at their expected
- * code positions, so that the char * string literals in ICU code match
- * the char literals here.
- *
- * Note that the set of lowercase Latin letters is discontiguous in EBCDIC
- * and the set of uppercase Latin letters is discontiguous as well.
- */
-
-U_CAPI UBool U_EXPORT2
-uprv_isASCIILetter(char c) {
-#if U_CHARSET_FAMILY==U_EBCDIC_FAMILY
- return
- ('a'<=c && c<='i') || ('j'<=c && c<='r') || ('s'<=c && c<='z') ||
- ('A'<=c && c<='I') || ('J'<=c && c<='R') || ('S'<=c && c<='Z');
-#else
- return ('a'<=c && c<='z') || ('A'<=c && c<='Z');
-#endif
-}
-
-U_CAPI char U_EXPORT2
-uprv_toupper(char c) {
-#if U_CHARSET_FAMILY==U_EBCDIC_FAMILY
- if(('a'<=c && c<='i') || ('j'<=c && c<='r') || ('s'<=c && c<='z')) {
- c=(char)(c+('A'-'a'));
- }
-#else
- if('a'<=c && c<='z') {
- c=(char)(c+('A'-'a'));
- }
-#endif
- return c;
-}
-
-
-#if 0
-/*
- * Commented out because cstring.h defines uprv_tolower() to be
- * the same as either uprv_asciitolower() or uprv_ebcdictolower()
- * to reduce the amount of code to cover with tests.
- *
- * Note that this uprv_tolower() definition is likely to work for most
- * charset families, not just ASCII and EBCDIC, because its #else branch
- * is written generically.
- */
-U_CAPI char U_EXPORT2
-uprv_tolower(char c) {
-#if U_CHARSET_FAMILY==U_EBCDIC_FAMILY
- if(('A'<=c && c<='I') || ('J'<=c && c<='R') || ('S'<=c && c<='Z')) {
- c=(char)(c+('a'-'A'));
- }
-#else
- if('A'<=c && c<='Z') {
- c=(char)(c+('a'-'A'));
- }
-#endif
- return c;
-}
-#endif
-
-U_CAPI char U_EXPORT2
-uprv_asciitolower(char c) {
- if(0x41<=c && c<=0x5a) {
- c=(char)(c+0x20);
- }
- return c;
-}
-
-U_CAPI char U_EXPORT2
-uprv_ebcdictolower(char c) {
- if( (0xc1<=(uint8_t)c && (uint8_t)c<=0xc9) ||
- (0xd1<=(uint8_t)c && (uint8_t)c<=0xd9) ||
- (0xe2<=(uint8_t)c && (uint8_t)c<=0xe9)
- ) {
- c=(char)(c-0x40);
- }
- return c;
-}
-
-
-U_CAPI char* U_EXPORT2
-T_CString_toLowerCase(char* str)
-{
- char* origPtr = str;
-
- if (str) {
- do
- *str = (char)uprv_tolower(*str);
- while (*(str++));
- }
-
- return origPtr;
-}
-
-U_CAPI char* U_EXPORT2
-T_CString_toUpperCase(char* str)
-{
- char* origPtr = str;
-
- if (str) {
- do
- *str = (char)uprv_toupper(*str);
- while (*(str++));
- }
-
- return origPtr;
-}
-
-/*
- * Takes a int32_t and fills in a char* string with that number "radix"-based.
- * Does not handle negative values (makes an empty string for them).
- * Writes at most 12 chars ("-2147483647" plus NUL).
- * Returns the length of the string (not including the NUL).
- */
-U_CAPI int32_t U_EXPORT2
-T_CString_integerToString(char* buffer, int32_t v, int32_t radix)
-{
- char tbuf[30];
- int32_t tbx = sizeof(tbuf);
- uint8_t digit;
- int32_t length = 0;
- uint32_t uval;
-
- U_ASSERT(radix>=2 && radix<=16);
- uval = (uint32_t) v;
- if(v<0 && radix == 10) {
- /* Only in base 10 do we conside numbers to be signed. */
- uval = (uint32_t)(-v);
- buffer[length++] = '-';
- }
-
- tbx = sizeof(tbuf)-1;
- tbuf[tbx] = 0; /* We are generating the digits backwards. Null term the end. */
- do {
- digit = (uint8_t)(uval % radix);
- tbuf[--tbx] = (char)(T_CString_itosOffset(digit));
- uval = uval / radix;
- } while (uval != 0);
-
- /* copy converted number into user buffer */
- uprv_strcpy(buffer+length, tbuf+tbx);
- length += sizeof(tbuf) - tbx -1;
- return length;
-}
-
-
-
-/*
- * Takes a int64_t and fills in a char* string with that number "radix"-based.
- * Writes at most 21: chars ("-9223372036854775807" plus NUL).
- * Returns the length of the string, not including the terminating NULL.
- */
-U_CAPI int32_t U_EXPORT2
-T_CString_int64ToString(char* buffer, int64_t v, uint32_t radix)
-{
- char tbuf[30];
- int32_t tbx = sizeof(tbuf);
- uint8_t digit;
- int32_t length = 0;
- uint64_t uval;
-
- U_ASSERT(radix>=2 && radix<=16);
- uval = (uint64_t) v;
- if(v<0 && radix == 10) {
- /* Only in base 10 do we conside numbers to be signed. */
- uval = (uint64_t)(-v);
- buffer[length++] = '-';
- }
-
- tbx = sizeof(tbuf)-1;
- tbuf[tbx] = 0; /* We are generating the digits backwards. Null term the end. */
- do {
- digit = (uint8_t)(uval % radix);
- tbuf[--tbx] = (char)(T_CString_itosOffset(digit));
- uval = uval / radix;
- } while (uval != 0);
-
- /* copy converted number into user buffer */
- uprv_strcpy(buffer+length, tbuf+tbx);
- length += sizeof(tbuf) - tbx -1;
- return length;
-}
-
-
-U_CAPI int32_t U_EXPORT2
-T_CString_stringToInteger(const char *integerString, int32_t radix)
-{
- char *end;
- return uprv_strtoul(integerString, &end, radix);
-
-}
-
-U_CAPI int U_EXPORT2
-uprv_stricmp(const char *str1, const char *str2) {
- if(str1==NULL) {
- if(str2==NULL) {
- return 0;
- } else {
- return -1;
- }
- } else if(str2==NULL) {
- return 1;
- } else {
- /* compare non-NULL strings lexically with lowercase */
- int rc;
- unsigned char c1, c2;
-
- for(;;) {
- c1=(unsigned char)*str1;
- c2=(unsigned char)*str2;
- if(c1==0) {
- if(c2==0) {
- return 0;
- } else {
- return -1;
- }
- } else if(c2==0) {
- return 1;
- } else {
- /* compare non-zero characters with lowercase */
- rc=(int)(unsigned char)uprv_tolower(c1)-(int)(unsigned char)uprv_tolower(c2);
- if(rc!=0) {
- return rc;
- }
- }
- ++str1;
- ++str2;
- }
- }
-}
-
-U_CAPI int U_EXPORT2
-uprv_strnicmp(const char *str1, const char *str2, uint32_t n) {
- if(str1==NULL) {
- if(str2==NULL) {
- return 0;
- } else {
- return -1;
- }
- } else if(str2==NULL) {
- return 1;
- } else {
- /* compare non-NULL strings lexically with lowercase */
- int rc;
- unsigned char c1, c2;
-
- for(; n--;) {
- c1=(unsigned char)*str1;
- c2=(unsigned char)*str2;
- if(c1==0) {
- if(c2==0) {
- return 0;
- } else {
- return -1;
- }
- } else if(c2==0) {
- return 1;
- } else {
- /* compare non-zero characters with lowercase */
- rc=(int)(unsigned char)uprv_tolower(c1)-(int)(unsigned char)uprv_tolower(c2);
- if(rc!=0) {
- return rc;
- }
- }
- ++str1;
- ++str2;
- }
- }
-
- return 0;
-}
-
-U_CAPI char* U_EXPORT2
-uprv_strdup(const char *src) {
- size_t len = uprv_strlen(src) + 1;
- char *dup = (char *) uprv_malloc(len);
-
- if (dup) {
- uprv_memcpy(dup, src, len);
- }
-
- return dup;
-}
-
-U_CAPI char* U_EXPORT2
-uprv_strndup(const char *src, int32_t n) {
- char *dup;
-
- if(n < 0) {
- dup = uprv_strdup(src);
- } else {
- dup = (char*)uprv_malloc(n+1);
- if (dup) {
- uprv_memcpy(dup, src, n);
- dup[n] = 0;
- }
- }
-
- return dup;
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 1997-2011, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+*
+* File CSTRING.C
+*
+* @author Helena Shih
+*
+* Modification History:
+*
+* Date Name Description
+* 6/18/98 hshih Created
+* 09/08/98 stephen Added include for ctype, for Mac Port
+* 11/15/99 helena Integrated S/390 IEEE changes.
+******************************************************************************
+*/
+
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "unicode/utypes.h"
+#include "cmemory.h"
+#include "cstring.h"
+#include "uassert.h"
+
+/*
+ * We hardcode case conversion for invariant characters to match our expectation
+ * and the compiler execution charset.
+ * This prevents problems on systems
+ * - with non-default casing behavior, like Turkish system locales where
+ * tolower('I') maps to dotless i and toupper('i') maps to dotted I
+ * - where there are no lowercase Latin characters at all, or using different
+ * codes (some old EBCDIC codepages)
+ *
+ * This works because the compiler usually runs on a platform where the execution
+ * charset includes all of the invariant characters at their expected
+ * code positions, so that the char * string literals in ICU code match
+ * the char literals here.
+ *
+ * Note that the set of lowercase Latin letters is discontiguous in EBCDIC
+ * and the set of uppercase Latin letters is discontiguous as well.
+ */
+
+U_CAPI UBool U_EXPORT2
+uprv_isASCIILetter(char c) {
+#if U_CHARSET_FAMILY==U_EBCDIC_FAMILY
+ return
+ ('a'<=c && c<='i') || ('j'<=c && c<='r') || ('s'<=c && c<='z') ||
+ ('A'<=c && c<='I') || ('J'<=c && c<='R') || ('S'<=c && c<='Z');
+#else
+ return ('a'<=c && c<='z') || ('A'<=c && c<='Z');
+#endif
+}
+
+U_CAPI char U_EXPORT2
+uprv_toupper(char c) {
+#if U_CHARSET_FAMILY==U_EBCDIC_FAMILY
+ if(('a'<=c && c<='i') || ('j'<=c && c<='r') || ('s'<=c && c<='z')) {
+ c=(char)(c+('A'-'a'));
+ }
+#else
+ if('a'<=c && c<='z') {
+ c=(char)(c+('A'-'a'));
+ }
+#endif
+ return c;
+}
+
+
+#if 0
+/*
+ * Commented out because cstring.h defines uprv_tolower() to be
+ * the same as either uprv_asciitolower() or uprv_ebcdictolower()
+ * to reduce the amount of code to cover with tests.
+ *
+ * Note that this uprv_tolower() definition is likely to work for most
+ * charset families, not just ASCII and EBCDIC, because its #else branch
+ * is written generically.
+ */
+U_CAPI char U_EXPORT2
+uprv_tolower(char c) {
+#if U_CHARSET_FAMILY==U_EBCDIC_FAMILY
+ if(('A'<=c && c<='I') || ('J'<=c && c<='R') || ('S'<=c && c<='Z')) {
+ c=(char)(c+('a'-'A'));
+ }
+#else
+ if('A'<=c && c<='Z') {
+ c=(char)(c+('a'-'A'));
+ }
+#endif
+ return c;
+}
+#endif
+
+U_CAPI char U_EXPORT2
+uprv_asciitolower(char c) {
+ if(0x41<=c && c<=0x5a) {
+ c=(char)(c+0x20);
+ }
+ return c;
+}
+
+U_CAPI char U_EXPORT2
+uprv_ebcdictolower(char c) {
+ if( (0xc1<=(uint8_t)c && (uint8_t)c<=0xc9) ||
+ (0xd1<=(uint8_t)c && (uint8_t)c<=0xd9) ||
+ (0xe2<=(uint8_t)c && (uint8_t)c<=0xe9)
+ ) {
+ c=(char)(c-0x40);
+ }
+ return c;
+}
+
+
+U_CAPI char* U_EXPORT2
+T_CString_toLowerCase(char* str)
+{
+ char* origPtr = str;
+
+ if (str) {
+ do
+ *str = (char)uprv_tolower(*str);
+ while (*(str++));
+ }
+
+ return origPtr;
+}
+
+U_CAPI char* U_EXPORT2
+T_CString_toUpperCase(char* str)
+{
+ char* origPtr = str;
+
+ if (str) {
+ do
+ *str = (char)uprv_toupper(*str);
+ while (*(str++));
+ }
+
+ return origPtr;
+}
+
+/*
+ * Takes a int32_t and fills in a char* string with that number "radix"-based.
+ * Does not handle negative values (makes an empty string for them).
+ * Writes at most 12 chars ("-2147483647" plus NUL).
+ * Returns the length of the string (not including the NUL).
+ */
+U_CAPI int32_t U_EXPORT2
+T_CString_integerToString(char* buffer, int32_t v, int32_t radix)
+{
+ char tbuf[30];
+ int32_t tbx = sizeof(tbuf);
+ uint8_t digit;
+ int32_t length = 0;
+ uint32_t uval;
+
+ U_ASSERT(radix>=2 && radix<=16);
+ uval = (uint32_t) v;
+ if(v<0 && radix == 10) {
+ /* Only in base 10 do we conside numbers to be signed. */
+ uval = (uint32_t)(-v);
+ buffer[length++] = '-';
+ }
+
+ tbx = sizeof(tbuf)-1;
+ tbuf[tbx] = 0; /* We are generating the digits backwards. Null term the end. */
+ do {
+ digit = (uint8_t)(uval % radix);
+ tbuf[--tbx] = (char)(T_CString_itosOffset(digit));
+ uval = uval / radix;
+ } while (uval != 0);
+
+ /* copy converted number into user buffer */
+ uprv_strcpy(buffer+length, tbuf+tbx);
+ length += sizeof(tbuf) - tbx -1;
+ return length;
+}
+
+
+
+/*
+ * Takes a int64_t and fills in a char* string with that number "radix"-based.
+ * Writes at most 21: chars ("-9223372036854775807" plus NUL).
+ * Returns the length of the string, not including the terminating NULL.
+ */
+U_CAPI int32_t U_EXPORT2
+T_CString_int64ToString(char* buffer, int64_t v, uint32_t radix)
+{
+ char tbuf[30];
+ int32_t tbx = sizeof(tbuf);
+ uint8_t digit;
+ int32_t length = 0;
+ uint64_t uval;
+
+ U_ASSERT(radix>=2 && radix<=16);
+ uval = (uint64_t) v;
+ if(v<0 && radix == 10) {
+ /* Only in base 10 do we conside numbers to be signed. */
+ uval = (uint64_t)(-v);
+ buffer[length++] = '-';
+ }
+
+ tbx = sizeof(tbuf)-1;
+ tbuf[tbx] = 0; /* We are generating the digits backwards. Null term the end. */
+ do {
+ digit = (uint8_t)(uval % radix);
+ tbuf[--tbx] = (char)(T_CString_itosOffset(digit));
+ uval = uval / radix;
+ } while (uval != 0);
+
+ /* copy converted number into user buffer */
+ uprv_strcpy(buffer+length, tbuf+tbx);
+ length += sizeof(tbuf) - tbx -1;
+ return length;
+}
+
+
+U_CAPI int32_t U_EXPORT2
+T_CString_stringToInteger(const char *integerString, int32_t radix)
+{
+ char *end;
+ return uprv_strtoul(integerString, &end, radix);
+
+}
+
+U_CAPI int U_EXPORT2
+uprv_stricmp(const char *str1, const char *str2) {
+ if(str1==NULL) {
+ if(str2==NULL) {
+ return 0;
+ } else {
+ return -1;
+ }
+ } else if(str2==NULL) {
+ return 1;
+ } else {
+ /* compare non-NULL strings lexically with lowercase */
+ int rc;
+ unsigned char c1, c2;
+
+ for(;;) {
+ c1=(unsigned char)*str1;
+ c2=(unsigned char)*str2;
+ if(c1==0) {
+ if(c2==0) {
+ return 0;
+ } else {
+ return -1;
+ }
+ } else if(c2==0) {
+ return 1;
+ } else {
+ /* compare non-zero characters with lowercase */
+ rc=(int)(unsigned char)uprv_tolower(c1)-(int)(unsigned char)uprv_tolower(c2);
+ if(rc!=0) {
+ return rc;
+ }
+ }
+ ++str1;
+ ++str2;
+ }
+ }
+}
+
+U_CAPI int U_EXPORT2
+uprv_strnicmp(const char *str1, const char *str2, uint32_t n) {
+ if(str1==NULL) {
+ if(str2==NULL) {
+ return 0;
+ } else {
+ return -1;
+ }
+ } else if(str2==NULL) {
+ return 1;
+ } else {
+ /* compare non-NULL strings lexically with lowercase */
+ int rc;
+ unsigned char c1, c2;
+
+ for(; n--;) {
+ c1=(unsigned char)*str1;
+ c2=(unsigned char)*str2;
+ if(c1==0) {
+ if(c2==0) {
+ return 0;
+ } else {
+ return -1;
+ }
+ } else if(c2==0) {
+ return 1;
+ } else {
+ /* compare non-zero characters with lowercase */
+ rc=(int)(unsigned char)uprv_tolower(c1)-(int)(unsigned char)uprv_tolower(c2);
+ if(rc!=0) {
+ return rc;
+ }
+ }
+ ++str1;
+ ++str2;
+ }
+ }
+
+ return 0;
+}
+
+U_CAPI char* U_EXPORT2
+uprv_strdup(const char *src) {
+ size_t len = uprv_strlen(src) + 1;
+ char *dup = (char *) uprv_malloc(len);
+
+ if (dup) {
+ uprv_memcpy(dup, src, len);
+ }
+
+ return dup;
+}
+
+U_CAPI char* U_EXPORT2
+uprv_strndup(const char *src, int32_t n) {
+ char *dup;
+
+ if(n < 0) {
+ dup = uprv_strdup(src);
+ } else {
+ dup = (char*)uprv_malloc(n+1);
+ if (dup) {
+ uprv_memcpy(dup, src, n);
+ dup[n] = 0;
+ }
+ }
+
+ return dup;
+}
diff --git a/contrib/libs/icu/common/cstring.h b/contrib/libs/icu/common/cstring.h
index 19574136b0..3a14e4216c 100644
--- a/contrib/libs/icu/common/cstring.h
+++ b/contrib/libs/icu/common/cstring.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -52,8 +52,8 @@
U_CAPI UBool U_EXPORT2
uprv_isASCIILetter(char c);
-// NOTE: For u_asciiToUpper that takes a UChar, see ustr_imp.h
-
+// NOTE: For u_asciiToUpper that takes a UChar, see ustr_imp.h
+
U_CAPI char U_EXPORT2
uprv_toupper(char c);
diff --git a/contrib/libs/icu/common/cwchar.cpp b/contrib/libs/icu/common/cwchar.cpp
index cac93c1796..20c7d71e0f 100644
--- a/contrib/libs/icu/common/cwchar.cpp
+++ b/contrib/libs/icu/common/cwchar.cpp
@@ -1,55 +1,55 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 2001, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-* file name: cwchar.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 2001may25
-* created by: Markus W. Scherer
-*/
-
-#include "unicode/utypes.h"
-
-#if !U_HAVE_WCSCPY
-
-#include "cwchar.h"
-
-U_CAPI wchar_t *uprv_wcscat(wchar_t *dst, const wchar_t *src) {
- wchar_t *start=dst;
- while(*dst!=0) {
- ++dst;
- }
- while((*dst=*src)!=0) {
- ++dst;
- ++src;
- }
- return start;
-}
-
-U_CAPI wchar_t *uprv_wcscpy(wchar_t *dst, const wchar_t *src) {
- wchar_t *start=dst;
- while((*dst=*src)!=0) {
- ++dst;
- ++src;
- }
- return start;
-}
-
-U_CAPI size_t uprv_wcslen(const wchar_t *src) {
- const wchar_t *start=src;
- while(*src!=0) {
- ++src;
- }
- return src-start;
-}
-
-#endif
-
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 2001, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+* file name: cwchar.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2001may25
+* created by: Markus W. Scherer
+*/
+
+#include "unicode/utypes.h"
+
+#if !U_HAVE_WCSCPY
+
+#include "cwchar.h"
+
+U_CAPI wchar_t *uprv_wcscat(wchar_t *dst, const wchar_t *src) {
+ wchar_t *start=dst;
+ while(*dst!=0) {
+ ++dst;
+ }
+ while((*dst=*src)!=0) {
+ ++dst;
+ ++src;
+ }
+ return start;
+}
+
+U_CAPI wchar_t *uprv_wcscpy(wchar_t *dst, const wchar_t *src) {
+ wchar_t *start=dst;
+ while((*dst=*src)!=0) {
+ ++dst;
+ ++src;
+ }
+ return start;
+}
+
+U_CAPI size_t uprv_wcslen(const wchar_t *src) {
+ const wchar_t *start=src;
+ while(*src!=0) {
+ ++src;
+ }
+ return src-start;
+}
+
+#endif
+
diff --git a/contrib/libs/icu/common/cwchar.h b/contrib/libs/icu/common/cwchar.h
index df104f5940..8fd041a1b9 100644
--- a/contrib/libs/icu/common/cwchar.h
+++ b/contrib/libs/icu/common/cwchar.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: cwchar.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/dictbe.cpp b/contrib/libs/icu/common/dictbe.cpp
index 8bf91f56d1..b42cdf03fa 100644
--- a/contrib/libs/icu/common/dictbe.cpp
+++ b/contrib/libs/icu/common/dictbe.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/**
*******************************************************************************
@@ -7,8 +7,8 @@
*******************************************************************************
*/
-#include <utility>
-
+#include <utility>
+
#include "unicode/utypes.h"
#if !UCONFIG_NO_BREAK_ITERATION
@@ -18,7 +18,7 @@
#include "unicode/uniset.h"
#include "unicode/chariter.h"
#include "unicode/ubrk.h"
-#include "utracimp.h"
+#include "utracimp.h"
#include "uvectr32.h"
#include "uvector.h"
#include "uassert.h"
@@ -32,23 +32,23 @@ U_NAMESPACE_BEGIN
******************************************************************
*/
-DictionaryBreakEngine::DictionaryBreakEngine() {
+DictionaryBreakEngine::DictionaryBreakEngine() {
}
DictionaryBreakEngine::~DictionaryBreakEngine() {
}
UBool
-DictionaryBreakEngine::handles(UChar32 c) const {
- return fSet.contains(c);
+DictionaryBreakEngine::handles(UChar32 c) const {
+ return fSet.contains(c);
}
int32_t
DictionaryBreakEngine::findBreaks( UText *text,
int32_t startPos,
int32_t endPos,
- UVector32 &foundBreaks ) const {
- (void)startPos; // TODO: remove this param?
+ UVector32 &foundBreaks ) const {
+ (void)startPos; // TODO: remove this param?
int32_t result = 0;
// Find the span of characters included in the set.
@@ -60,14 +60,14 @@ DictionaryBreakEngine::findBreaks( UText *text,
int32_t rangeStart;
int32_t rangeEnd;
UChar32 c = utext_current32(text);
- while((current = (int32_t)utext_getNativeIndex(text)) < endPos && fSet.contains(c)) {
- utext_next32(text); // TODO: recast loop for postincrement
- c = utext_current32(text);
+ while((current = (int32_t)utext_getNativeIndex(text)) < endPos && fSet.contains(c)) {
+ utext_next32(text); // TODO: recast loop for postincrement
+ c = utext_current32(text);
}
- rangeStart = start;
- rangeEnd = current;
- result = divideUpDictionaryRange(text, rangeStart, rangeEnd, foundBreaks);
- utext_setNativeIndex(text, current);
+ rangeStart = start;
+ rangeEnd = current;
+ result = divideUpDictionaryRange(text, rangeStart, rangeEnd, foundBreaks);
+ utext_setNativeIndex(text, current);
return result;
}
@@ -104,8 +104,8 @@ private:
int32_t cpLengths[POSSIBLE_WORD_LIST_MAX]; // Word Lengths, in code points.
public:
- PossibleWord() : count(0), prefix(0), offset(-1), mark(0), current(0) {}
- ~PossibleWord() {}
+ PossibleWord() : count(0), prefix(0), offset(-1), mark(0), current(0) {}
+ ~PossibleWord() {}
// Fill the list of candidates if needed, select the longest, and return the number found
int32_t candidates( UText *text, DictionaryMatcher *dict, int32_t rangeEnd );
@@ -119,13 +119,13 @@ public:
// Return the longest prefix this candidate location shares with a dictionary word
// Return value is in code points.
- int32_t longestPrefix() { return prefix; }
+ int32_t longestPrefix() { return prefix; }
// Mark the current candidate as the one we like
- void markCurrent() { mark = current; }
+ void markCurrent() { mark = current; }
// Get length in code points of the marked word.
- int32_t markedCPLength() { return cpLengths[mark]; }
+ int32_t markedCPLength() { return cpLengths[mark]; }
};
@@ -192,11 +192,11 @@ static const int32_t THAI_MIN_WORD = 2;
static const int32_t THAI_MIN_WORD_SPAN = THAI_MIN_WORD * 2;
ThaiBreakEngine::ThaiBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status)
- : DictionaryBreakEngine(),
+ : DictionaryBreakEngine(),
fDictionary(adoptDictionary)
{
- UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE);
- UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Thai");
+ UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE);
+ UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Thai");
fThaiWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Thai:]&[:LineBreak=SA:]]"), status);
if (U_SUCCESS(status)) {
setCharacters(fThaiWordSet);
@@ -216,7 +216,7 @@ ThaiBreakEngine::ThaiBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode
fEndWordSet.compact();
fBeginWordSet.compact();
fSuffixSet.compact();
- UTRACE_EXIT_STATUS(status);
+ UTRACE_EXIT_STATUS(status);
}
ThaiBreakEngine::~ThaiBreakEngine() {
@@ -227,7 +227,7 @@ int32_t
ThaiBreakEngine::divideUpDictionaryRange( UText *text,
int32_t rangeStart,
int32_t rangeEnd,
- UVector32 &foundBreaks ) const {
+ UVector32 &foundBreaks ) const {
utext_setNativeIndex(text, rangeStart);
utext_moveIndex32(text, THAI_MIN_WORD_SPAN);
if (utext_getNativeIndex(text) >= rangeEnd) {
@@ -331,9 +331,9 @@ foundBest:
// two characters after uc were not 0x0E4C THANTHAKHAT before
// checking the dictionary. That is just a performance filter,
// but it's not clear it's faster than checking the trie.
- int32_t num_candidates = words[(wordsFound + 1) % THAI_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
+ int32_t num_candidates = words[(wordsFound + 1) % THAI_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
utext_setNativeIndex(text, current + cuWordLength + chars);
- if (num_candidates > 0) {
+ if (num_candidates > 0) {
break;
}
}
@@ -437,11 +437,11 @@ static const int32_t LAO_MIN_WORD = 2;
static const int32_t LAO_MIN_WORD_SPAN = LAO_MIN_WORD * 2;
LaoBreakEngine::LaoBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status)
- : DictionaryBreakEngine(),
+ : DictionaryBreakEngine(),
fDictionary(adoptDictionary)
{
- UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE);
- UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Laoo");
+ UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE);
+ UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Laoo");
fLaoWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Laoo:]&[:LineBreak=SA:]]"), status);
if (U_SUCCESS(status)) {
setCharacters(fLaoWordSet);
@@ -458,7 +458,7 @@ LaoBreakEngine::LaoBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &s
fMarkSet.compact();
fEndWordSet.compact();
fBeginWordSet.compact();
- UTRACE_EXIT_STATUS(status);
+ UTRACE_EXIT_STATUS(status);
}
LaoBreakEngine::~LaoBreakEngine() {
@@ -469,7 +469,7 @@ int32_t
LaoBreakEngine::divideUpDictionaryRange( UText *text,
int32_t rangeStart,
int32_t rangeEnd,
- UVector32 &foundBreaks ) const {
+ UVector32 &foundBreaks ) const {
if ((rangeEnd - rangeStart) < LAO_MIN_WORD_SPAN) {
return 0; // Not enough characters for two words
}
@@ -564,9 +564,9 @@ foundBest:
if (fEndWordSet.contains(pc) && fBeginWordSet.contains(uc)) {
// Maybe. See if it's in the dictionary.
// TODO: this looks iffy; compare with old code.
- int32_t num_candidates = words[(wordsFound + 1) % LAO_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
+ int32_t num_candidates = words[(wordsFound + 1) % LAO_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
utext_setNativeIndex(text, current + cuWordLength + chars);
- if (num_candidates > 0) {
+ if (num_candidates > 0) {
break;
}
}
@@ -636,11 +636,11 @@ static const int32_t BURMESE_MIN_WORD = 2;
static const int32_t BURMESE_MIN_WORD_SPAN = BURMESE_MIN_WORD * 2;
BurmeseBreakEngine::BurmeseBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status)
- : DictionaryBreakEngine(),
+ : DictionaryBreakEngine(),
fDictionary(adoptDictionary)
{
- UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE);
- UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Mymr");
+ UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE);
+ UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Mymr");
fBurmeseWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Mymr:]&[:LineBreak=SA:]]"), status);
if (U_SUCCESS(status)) {
setCharacters(fBurmeseWordSet);
@@ -654,7 +654,7 @@ BurmeseBreakEngine::BurmeseBreakEngine(DictionaryMatcher *adoptDictionary, UErro
fMarkSet.compact();
fEndWordSet.compact();
fBeginWordSet.compact();
- UTRACE_EXIT_STATUS(status);
+ UTRACE_EXIT_STATUS(status);
}
BurmeseBreakEngine::~BurmeseBreakEngine() {
@@ -665,7 +665,7 @@ int32_t
BurmeseBreakEngine::divideUpDictionaryRange( UText *text,
int32_t rangeStart,
int32_t rangeEnd,
- UVector32 &foundBreaks ) const {
+ UVector32 &foundBreaks ) const {
if ((rangeEnd - rangeStart) < BURMESE_MIN_WORD_SPAN) {
return 0; // Not enough characters for two words
}
@@ -760,9 +760,9 @@ foundBest:
if (fEndWordSet.contains(pc) && fBeginWordSet.contains(uc)) {
// Maybe. See if it's in the dictionary.
// TODO: this looks iffy; compare with old code.
- int32_t num_candidates = words[(wordsFound + 1) % BURMESE_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
+ int32_t num_candidates = words[(wordsFound + 1) % BURMESE_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
utext_setNativeIndex(text, current + cuWordLength + chars);
- if (num_candidates > 0) {
+ if (num_candidates > 0) {
break;
}
}
@@ -832,11 +832,11 @@ static const int32_t KHMER_MIN_WORD = 2;
static const int32_t KHMER_MIN_WORD_SPAN = KHMER_MIN_WORD * 2;
KhmerBreakEngine::KhmerBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status)
- : DictionaryBreakEngine(),
+ : DictionaryBreakEngine(),
fDictionary(adoptDictionary)
{
- UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE);
- UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Khmr");
+ UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE);
+ UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Khmr");
fKhmerWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Khmr:]&[:LineBreak=SA:]]"), status);
if (U_SUCCESS(status)) {
setCharacters(fKhmerWordSet);
@@ -862,7 +862,7 @@ KhmerBreakEngine::KhmerBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCod
fEndWordSet.compact();
fBeginWordSet.compact();
// fSuffixSet.compact();
- UTRACE_EXIT_STATUS(status);
+ UTRACE_EXIT_STATUS(status);
}
KhmerBreakEngine::~KhmerBreakEngine() {
@@ -873,7 +873,7 @@ int32_t
KhmerBreakEngine::divideUpDictionaryRange( UText *text,
int32_t rangeStart,
int32_t rangeEnd,
- UVector32 &foundBreaks ) const {
+ UVector32 &foundBreaks ) const {
if ((rangeEnd - rangeStart) < KHMER_MIN_WORD_SPAN) {
return 0; // Not enough characters for two words
}
@@ -968,9 +968,9 @@ foundBest:
uc = utext_current32(text);
if (fEndWordSet.contains(pc) && fBeginWordSet.contains(uc)) {
// Maybe. See if it's in the dictionary.
- int32_t num_candidates = words[(wordsFound + 1) % KHMER_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
+ int32_t num_candidates = words[(wordsFound + 1) % KHMER_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
utext_setNativeIndex(text, current+cuWordLength+chars);
- if (num_candidates > 0) {
+ if (num_candidates > 0) {
break;
}
}
@@ -1057,9 +1057,9 @@ foundBest:
*/
static const uint32_t kuint32max = 0xFFFFFFFF;
CjkBreakEngine::CjkBreakEngine(DictionaryMatcher *adoptDictionary, LanguageType type, UErrorCode &status)
-: DictionaryBreakEngine(), fDictionary(adoptDictionary) {
- UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE);
- UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Hani");
+: DictionaryBreakEngine(), fDictionary(adoptDictionary) {
+ UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE);
+ UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Hani");
// Korean dictionary only includes Hangul syllables
fHangulWordSet.applyPattern(UNICODE_STRING_SIMPLE("[\\uac00-\\ud7a3]"), status);
fHanWordSet.applyPattern(UNICODE_STRING_SIMPLE("[:Han:]"), status);
@@ -1081,7 +1081,7 @@ CjkBreakEngine::CjkBreakEngine(DictionaryMatcher *adoptDictionary, LanguageType
setCharacters(cjSet);
}
}
- UTRACE_EXIT_STATUS(status);
+ UTRACE_EXIT_STATUS(status);
}
CjkBreakEngine::~CjkBreakEngine(){
@@ -1101,9 +1101,9 @@ static inline uint32_t getKatakanaCost(int32_t wordLength){
return (wordLength > kMaxKatakanaLength) ? 8192 : katakanaCost[wordLength];
}
-static inline bool isKatakana(UChar32 value) {
- return (value >= 0x30A1 && value <= 0x30FE && value != 0x30FB) ||
- (value >= 0xFF66 && value <= 0xFF9f);
+static inline bool isKatakana(UChar32 value) {
+ return (value >= 0x30A1 && value <= 0x30FE && value != 0x30FB) ||
+ (value >= 0xFF66 && value <= 0xFF9f);
}
@@ -1119,14 +1119,14 @@ static inline int32_t utext_i32_flag(int32_t bitIndex) {
* @param text A UText representing the text
* @param rangeStart The start of the range of dictionary characters
* @param rangeEnd The end of the range of dictionary characters
- * @param foundBreaks vector<int32> to receive the break positions
+ * @param foundBreaks vector<int32> to receive the break positions
* @return The number of breaks found
*/
int32_t
CjkBreakEngine::divideUpDictionaryRange( UText *inText,
int32_t rangeStart,
int32_t rangeEnd,
- UVector32 &foundBreaks ) const {
+ UVector32 &foundBreaks ) const {
if (rangeStart >= rangeEnd) {
return 0;
}
@@ -1222,8 +1222,8 @@ CjkBreakEngine::divideUpDictionaryRange( UText *inText,
inputMap->elementAti(inString.length()) : inString.length()+rangeStart;
normalizedMap->addElement(nativeEnd, status);
- inputMap = std::move(normalizedMap);
- inString = std::move(normalizedInput);
+ inputMap = std::move(normalizedMap);
+ inString = std::move(normalizedInput);
}
int32_t numCodePts = inString.countChar32();
@@ -1337,8 +1337,8 @@ CjkBreakEngine::divideUpDictionaryRange( UText *inText,
}
if (katakanaRunLength < kMaxKatakanaGroupLength) {
uint32_t newSnlp = bestSnlp.elementAti(i) + getKatakanaCost(katakanaRunLength);
- if (newSnlp < (uint32_t)bestSnlp.elementAti(i+katakanaRunLength)) {
- bestSnlp.setElementAt(newSnlp, i+katakanaRunLength);
+ if (newSnlp < (uint32_t)bestSnlp.elementAti(i+katakanaRunLength)) {
+ bestSnlp.setElementAt(newSnlp, i+katakanaRunLength);
prev.setElementAt(i, i+katakanaRunLength); // prev[j] = i;
}
}
@@ -1376,27 +1376,27 @@ CjkBreakEngine::divideUpDictionaryRange( UText *inText,
// Now that we're done, convert positions in t_boundary[] (indices in
// the normalized input string) back to indices in the original input UText
// while reversing t_boundary and pushing values to foundBreaks.
- int32_t prevCPPos = -1;
- int32_t prevUTextPos = -1;
+ int32_t prevCPPos = -1;
+ int32_t prevUTextPos = -1;
for (int32_t i = numBreaks-1; i >= 0; i--) {
int32_t cpPos = t_boundary.elementAti(i);
- U_ASSERT(cpPos > prevCPPos);
+ U_ASSERT(cpPos > prevCPPos);
int32_t utextPos = inputMap.isValid() ? inputMap->elementAti(cpPos) : cpPos + rangeStart;
- U_ASSERT(utextPos >= prevUTextPos);
- if (utextPos > prevUTextPos) {
- // Boundaries are added to foundBreaks output in ascending order.
- U_ASSERT(foundBreaks.size() == 0 || foundBreaks.peeki() < utextPos);
- foundBreaks.push(utextPos, status);
- } else {
- // Normalization expanded the input text, the dictionary found a boundary
- // within the expansion, giving two boundaries with the same index in the
- // original text. Ignore the second. See ticket #12918.
- --numBreaks;
- }
- prevCPPos = cpPos;
- prevUTextPos = utextPos;
+ U_ASSERT(utextPos >= prevUTextPos);
+ if (utextPos > prevUTextPos) {
+ // Boundaries are added to foundBreaks output in ascending order.
+ U_ASSERT(foundBreaks.size() == 0 || foundBreaks.peeki() < utextPos);
+ foundBreaks.push(utextPos, status);
+ } else {
+ // Normalization expanded the input text, the dictionary found a boundary
+ // within the expansion, giving two boundaries with the same index in the
+ // original text. Ignore the second. See ticket #12918.
+ --numBreaks;
+ }
+ prevCPPos = cpPos;
+ prevUTextPos = utextPos;
}
- (void)prevCPPos; // suppress compiler warnings about unused variable
+ (void)prevCPPos; // suppress compiler warnings about unused variable
// inString goes out of scope
// inputMap goes out of scope
diff --git a/contrib/libs/icu/common/dictbe.h b/contrib/libs/icu/common/dictbe.h
index a1dc944194..731bfdff9f 100644
--- a/contrib/libs/icu/common/dictbe.h
+++ b/contrib/libs/icu/common/dictbe.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/**
*******************************************************************************
@@ -15,7 +15,7 @@
#include "unicode/utext.h"
#include "brkeng.h"
-#include "uvectr32.h"
+#include "uvectr32.h"
U_NAMESPACE_BEGIN
@@ -42,10 +42,10 @@ class DictionaryBreakEngine : public LanguageBreakEngine {
UnicodeSet fSet;
- public:
+ public:
/**
- * <p>Constructor </p>
+ * <p>Constructor </p>
*/
DictionaryBreakEngine();
@@ -62,23 +62,23 @@ class DictionaryBreakEngine : public LanguageBreakEngine {
* @return TRUE if this engine handles the particular character and break
* type.
*/
- virtual UBool handles(UChar32 c) const;
+ virtual UBool handles(UChar32 c) const;
/**
* <p>Find any breaks within a run in the supplied text.</p>
*
* @param text A UText representing the text. The iterator is left at
* the end of the run of characters which the engine is capable of handling
- * that starts from the first character in the range.
+ * that starts from the first character in the range.
* @param startPos The start of the run within the supplied text.
* @param endPos The end of the run within the supplied text.
- * @param foundBreaks vector of int32_t to receive the break positions
+ * @param foundBreaks vector of int32_t to receive the break positions
* @return The number of breaks found.
*/
virtual int32_t findBreaks( UText *text,
int32_t startPos,
int32_t endPos,
- UVector32 &foundBreaks ) const;
+ UVector32 &foundBreaks ) const;
protected:
@@ -101,7 +101,7 @@ class DictionaryBreakEngine : public LanguageBreakEngine {
virtual int32_t divideUpDictionaryRange( UText *text,
int32_t rangeStart,
int32_t rangeEnd,
- UVector32 &foundBreaks ) const = 0;
+ UVector32 &foundBreaks ) const = 0;
};
@@ -158,7 +158,7 @@ class ThaiBreakEngine : public DictionaryBreakEngine {
virtual int32_t divideUpDictionaryRange( UText *text,
int32_t rangeStart,
int32_t rangeEnd,
- UVector32 &foundBreaks ) const;
+ UVector32 &foundBreaks ) const;
};
@@ -214,7 +214,7 @@ class LaoBreakEngine : public DictionaryBreakEngine {
virtual int32_t divideUpDictionaryRange( UText *text,
int32_t rangeStart,
int32_t rangeEnd,
- UVector32 &foundBreaks ) const;
+ UVector32 &foundBreaks ) const;
};
@@ -270,7 +270,7 @@ class BurmeseBreakEngine : public DictionaryBreakEngine {
virtual int32_t divideUpDictionaryRange( UText *text,
int32_t rangeStart,
int32_t rangeEnd,
- UVector32 &foundBreaks ) const;
+ UVector32 &foundBreaks ) const;
};
@@ -326,7 +326,7 @@ class KhmerBreakEngine : public DictionaryBreakEngine {
virtual int32_t divideUpDictionaryRange( UText *text,
int32_t rangeStart,
int32_t rangeEnd,
- UVector32 &foundBreaks ) const;
+ UVector32 &foundBreaks ) const;
};
@@ -390,7 +390,7 @@ class CjkBreakEngine : public DictionaryBreakEngine {
virtual int32_t divideUpDictionaryRange( UText *text,
int32_t rangeStart,
int32_t rangeEnd,
- UVector32 &foundBreaks ) const;
+ UVector32 &foundBreaks ) const;
};
diff --git a/contrib/libs/icu/common/dictionarydata.cpp b/contrib/libs/icu/common/dictionarydata.cpp
index ddac191003..6e2dbee5b6 100644
--- a/contrib/libs/icu/common/dictionarydata.cpp
+++ b/contrib/libs/icu/common/dictionarydata.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/common/dictionarydata.h b/contrib/libs/icu/common/dictionarydata.h
index 36c1b6b725..0d303d9a8d 100644
--- a/contrib/libs/icu/common/dictionarydata.h
+++ b/contrib/libs/icu/common/dictionarydata.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -68,7 +68,7 @@ public:
*/
class U_COMMON_API DictionaryMatcher : public UMemory {
public:
- DictionaryMatcher() {}
+ DictionaryMatcher() {}
virtual ~DictionaryMatcher();
// this should emulate CompactTrieDictionary::matches()
/* @param text The text in which to look for matching words. Matching begins
diff --git a/contrib/libs/icu/common/dtintrv.cpp b/contrib/libs/icu/common/dtintrv.cpp
index 7376ff989a..80bb5d6dbd 100644
--- a/contrib/libs/icu/common/dtintrv.cpp
+++ b/contrib/libs/icu/common/dtintrv.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*******************************************************************************
* Copyright (C) 2008, International Business Machines Corporation and
diff --git a/contrib/libs/icu/common/edits.cpp b/contrib/libs/icu/common/edits.cpp
index 492b33fc38..95f0c19a72 100644
--- a/contrib/libs/icu/common/edits.cpp
+++ b/contrib/libs/icu/common/edits.cpp
@@ -1,803 +1,803 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// edits.cpp
-// created: 2017feb08 Markus W. Scherer
-
-#include "unicode/edits.h"
-#include "unicode/unistr.h"
-#include "unicode/utypes.h"
-#include "cmemory.h"
-#include "uassert.h"
-#include "util.h"
-
-U_NAMESPACE_BEGIN
-
-namespace {
-
-// 0000uuuuuuuuuuuu records u+1 unchanged text units.
-const int32_t MAX_UNCHANGED_LENGTH = 0x1000;
-const int32_t MAX_UNCHANGED = MAX_UNCHANGED_LENGTH - 1;
-
-// 0mmmnnnccccccccc with m=1..6 records ccc+1 replacements of m:n text units.
-const int32_t MAX_SHORT_CHANGE_OLD_LENGTH = 6;
-const int32_t MAX_SHORT_CHANGE_NEW_LENGTH = 7;
-const int32_t SHORT_CHANGE_NUM_MASK = 0x1ff;
-const int32_t MAX_SHORT_CHANGE = 0x6fff;
-
-// 0111mmmmmmnnnnnn records a replacement of m text units with n.
-// m or n = 61: actual length follows in the next edits array unit.
-// m or n = 62..63: actual length follows in the next two edits array units.
-// Bit 30 of the actual length is in the head unit.
-// Trailing units have bit 15 set.
-const int32_t LENGTH_IN_1TRAIL = 61;
-const int32_t LENGTH_IN_2TRAIL = 62;
-
-} // namespace
-
-void Edits::releaseArray() U_NOEXCEPT {
- if (array != stackArray) {
- uprv_free(array);
- }
-}
-
-Edits &Edits::copyArray(const Edits &other) {
- if (U_FAILURE(errorCode_)) {
- length = delta = numChanges = 0;
- return *this;
- }
- if (length > capacity) {
- uint16_t *newArray = (uint16_t *)uprv_malloc((size_t)length * 2);
- if (newArray == nullptr) {
- length = delta = numChanges = 0;
- errorCode_ = U_MEMORY_ALLOCATION_ERROR;
- return *this;
- }
- releaseArray();
- array = newArray;
- capacity = length;
- }
- if (length > 0) {
- uprv_memcpy(array, other.array, (size_t)length * 2);
- }
- return *this;
-}
-
-Edits &Edits::moveArray(Edits &src) U_NOEXCEPT {
- if (U_FAILURE(errorCode_)) {
- length = delta = numChanges = 0;
- return *this;
- }
- releaseArray();
- if (length > STACK_CAPACITY) {
- array = src.array;
- capacity = src.capacity;
- src.array = src.stackArray;
- src.capacity = STACK_CAPACITY;
- src.reset();
- return *this;
- }
- array = stackArray;
- capacity = STACK_CAPACITY;
- if (length > 0) {
- uprv_memcpy(array, src.array, (size_t)length * 2);
- }
- return *this;
-}
-
-Edits &Edits::operator=(const Edits &other) {
- length = other.length;
- delta = other.delta;
- numChanges = other.numChanges;
- errorCode_ = other.errorCode_;
- return copyArray(other);
-}
-
-Edits &Edits::operator=(Edits &&src) U_NOEXCEPT {
- length = src.length;
- delta = src.delta;
- numChanges = src.numChanges;
- errorCode_ = src.errorCode_;
- return moveArray(src);
-}
-
-Edits::~Edits() {
- releaseArray();
-}
-
-void Edits::reset() U_NOEXCEPT {
- length = delta = numChanges = 0;
- errorCode_ = U_ZERO_ERROR;
-}
-
-void Edits::addUnchanged(int32_t unchangedLength) {
- if(U_FAILURE(errorCode_) || unchangedLength == 0) { return; }
- if(unchangedLength < 0) {
- errorCode_ = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- // Merge into previous unchanged-text record, if any.
- int32_t last = lastUnit();
- if(last < MAX_UNCHANGED) {
- int32_t remaining = MAX_UNCHANGED - last;
- if (remaining >= unchangedLength) {
- setLastUnit(last + unchangedLength);
- return;
- }
- setLastUnit(MAX_UNCHANGED);
- unchangedLength -= remaining;
- }
- // Split large lengths into multiple units.
- while(unchangedLength >= MAX_UNCHANGED_LENGTH) {
- append(MAX_UNCHANGED);
- unchangedLength -= MAX_UNCHANGED_LENGTH;
- }
- // Write a small (remaining) length.
- if(unchangedLength > 0) {
- append(unchangedLength - 1);
- }
-}
-
-void Edits::addReplace(int32_t oldLength, int32_t newLength) {
- if(U_FAILURE(errorCode_)) { return; }
- if(oldLength < 0 || newLength < 0) {
- errorCode_ = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- if (oldLength == 0 && newLength == 0) {
- return;
- }
- ++numChanges;
- int32_t newDelta = newLength - oldLength;
- if (newDelta != 0) {
- if ((newDelta > 0 && delta >= 0 && newDelta > (INT32_MAX - delta)) ||
- (newDelta < 0 && delta < 0 && newDelta < (INT32_MIN - delta))) {
- // Integer overflow or underflow.
- errorCode_ = U_INDEX_OUTOFBOUNDS_ERROR;
- return;
- }
- delta += newDelta;
- }
-
- if(0 < oldLength && oldLength <= MAX_SHORT_CHANGE_OLD_LENGTH &&
- newLength <= MAX_SHORT_CHANGE_NEW_LENGTH) {
- // Merge into previous same-lengths short-replacement record, if any.
- int32_t u = (oldLength << 12) | (newLength << 9);
- int32_t last = lastUnit();
- if(MAX_UNCHANGED < last && last < MAX_SHORT_CHANGE &&
- (last & ~SHORT_CHANGE_NUM_MASK) == u &&
- (last & SHORT_CHANGE_NUM_MASK) < SHORT_CHANGE_NUM_MASK) {
- setLastUnit(last + 1);
- return;
- }
- append(u);
- return;
- }
-
- int32_t head = 0x7000;
- if (oldLength < LENGTH_IN_1TRAIL && newLength < LENGTH_IN_1TRAIL) {
- head |= oldLength << 6;
- head |= newLength;
- append(head);
- } else if ((capacity - length) >= 5 || growArray()) {
- int32_t limit = length + 1;
- if(oldLength < LENGTH_IN_1TRAIL) {
- head |= oldLength << 6;
- } else if(oldLength <= 0x7fff) {
- head |= LENGTH_IN_1TRAIL << 6;
- array[limit++] = (uint16_t)(0x8000 | oldLength);
- } else {
- head |= (LENGTH_IN_2TRAIL + (oldLength >> 30)) << 6;
- array[limit++] = (uint16_t)(0x8000 | (oldLength >> 15));
- array[limit++] = (uint16_t)(0x8000 | oldLength);
- }
- if(newLength < LENGTH_IN_1TRAIL) {
- head |= newLength;
- } else if(newLength <= 0x7fff) {
- head |= LENGTH_IN_1TRAIL;
- array[limit++] = (uint16_t)(0x8000 | newLength);
- } else {
- head |= LENGTH_IN_2TRAIL + (newLength >> 30);
- array[limit++] = (uint16_t)(0x8000 | (newLength >> 15));
- array[limit++] = (uint16_t)(0x8000 | newLength);
- }
- array[length] = (uint16_t)head;
- length = limit;
- }
-}
-
-void Edits::append(int32_t r) {
- if(length < capacity || growArray()) {
- array[length++] = (uint16_t)r;
- }
-}
-
-UBool Edits::growArray() {
- int32_t newCapacity;
- if (array == stackArray) {
- newCapacity = 2000;
- } else if (capacity == INT32_MAX) {
- // Not U_BUFFER_OVERFLOW_ERROR because that could be confused on a string transform API
- // with a result-string-buffer overflow.
- errorCode_ = U_INDEX_OUTOFBOUNDS_ERROR;
- return FALSE;
- } else if (capacity >= (INT32_MAX / 2)) {
- newCapacity = INT32_MAX;
- } else {
- newCapacity = 2 * capacity;
- }
- // Grow by at least 5 units so that a maximal change record will fit.
- if ((newCapacity - capacity) < 5) {
- errorCode_ = U_INDEX_OUTOFBOUNDS_ERROR;
- return FALSE;
- }
- uint16_t *newArray = (uint16_t *)uprv_malloc((size_t)newCapacity * 2);
- if (newArray == NULL) {
- errorCode_ = U_MEMORY_ALLOCATION_ERROR;
- return FALSE;
- }
- uprv_memcpy(newArray, array, (size_t)length * 2);
- releaseArray();
- array = newArray;
- capacity = newCapacity;
- return TRUE;
-}
-
-UBool Edits::copyErrorTo(UErrorCode &outErrorCode) const {
- if (U_FAILURE(outErrorCode)) { return TRUE; }
- if (U_SUCCESS(errorCode_)) { return FALSE; }
- outErrorCode = errorCode_;
- return TRUE;
-}
-
-Edits &Edits::mergeAndAppend(const Edits &ab, const Edits &bc, UErrorCode &errorCode) {
- if (copyErrorTo(errorCode)) { return *this; }
- // Picture string a --(Edits ab)--> string b --(Edits bc)--> string c.
- // Parallel iteration over both Edits.
- Iterator abIter = ab.getFineIterator();
- Iterator bcIter = bc.getFineIterator();
- UBool abHasNext = TRUE, bcHasNext = TRUE;
- // Copy iterator state into local variables, so that we can modify and subdivide spans.
- // ab old & new length, bc old & new length
- int32_t aLength = 0, ab_bLength = 0, bc_bLength = 0, cLength = 0;
- // When we have different-intermediate-length changes, we accumulate a larger change.
- int32_t pending_aLength = 0, pending_cLength = 0;
- for (;;) {
- // At this point, for each of the two iterators:
- // Either we are done with the locally cached current edit,
- // and its intermediate-string length has been reset,
- // or we will continue to work with a truncated remainder of this edit.
- //
- // If the current edit is done, and the iterator has not yet reached the end,
- // then we fetch the next edit. This is true for at least one of the iterators.
- //
- // Normally it does not matter whether we fetch from ab and then bc or vice versa.
- // However, the result is observably different when
- // ab deletions meet bc insertions at the same intermediate-string index.
- // Some users expect the bc insertions to come first, so we fetch from bc first.
- if (bc_bLength == 0) {
- if (bcHasNext && (bcHasNext = bcIter.next(errorCode)) != 0) {
- bc_bLength = bcIter.oldLength();
- cLength = bcIter.newLength();
- if (bc_bLength == 0) {
- // insertion
- if (ab_bLength == 0 || !abIter.hasChange()) {
- addReplace(pending_aLength, pending_cLength + cLength);
- pending_aLength = pending_cLength = 0;
- } else {
- pending_cLength += cLength;
- }
- continue;
- }
- }
- // else see if the other iterator is done, too.
- }
- if (ab_bLength == 0) {
- if (abHasNext && (abHasNext = abIter.next(errorCode)) != 0) {
- aLength = abIter.oldLength();
- ab_bLength = abIter.newLength();
- if (ab_bLength == 0) {
- // deletion
- if (bc_bLength == bcIter.oldLength() || !bcIter.hasChange()) {
- addReplace(pending_aLength + aLength, pending_cLength);
- pending_aLength = pending_cLength = 0;
- } else {
- pending_aLength += aLength;
- }
- continue;
- }
- } else if (bc_bLength == 0) {
- // Both iterators are done at the same time:
- // The intermediate-string lengths match.
- break;
- } else {
- // The ab output string is shorter than the bc input string.
- if (!copyErrorTo(errorCode)) {
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- }
- return *this;
- }
- }
- if (bc_bLength == 0) {
- // The bc input string is shorter than the ab output string.
- if (!copyErrorTo(errorCode)) {
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- }
- return *this;
- }
- // Done fetching: ab_bLength > 0 && bc_bLength > 0
-
- // The current state has two parts:
- // - Past: We accumulate a longer ac edit in the "pending" variables.
- // - Current: We have copies of the current ab/bc edits in local variables.
- // At least one side is newly fetched.
- // One side might be a truncated remainder of an edit we fetched earlier.
-
- if (!abIter.hasChange() && !bcIter.hasChange()) {
- // An unchanged span all the way from string a to string c.
- if (pending_aLength != 0 || pending_cLength != 0) {
- addReplace(pending_aLength, pending_cLength);
- pending_aLength = pending_cLength = 0;
- }
- int32_t unchangedLength = aLength <= cLength ? aLength : cLength;
- addUnchanged(unchangedLength);
- ab_bLength = aLength -= unchangedLength;
- bc_bLength = cLength -= unchangedLength;
- // At least one of the unchanged spans is now empty.
- continue;
- }
- if (!abIter.hasChange() && bcIter.hasChange()) {
- // Unchanged a->b but changed b->c.
- if (ab_bLength >= bc_bLength) {
- // Split the longer unchanged span into change + remainder.
- addReplace(pending_aLength + bc_bLength, pending_cLength + cLength);
- pending_aLength = pending_cLength = 0;
- aLength = ab_bLength -= bc_bLength;
- bc_bLength = 0;
- continue;
- }
- // Handle the shorter unchanged span below like a change.
- } else if (abIter.hasChange() && !bcIter.hasChange()) {
- // Changed a->b and then unchanged b->c.
- if (ab_bLength <= bc_bLength) {
- // Split the longer unchanged span into change + remainder.
- addReplace(pending_aLength + aLength, pending_cLength + ab_bLength);
- pending_aLength = pending_cLength = 0;
- cLength = bc_bLength -= ab_bLength;
- ab_bLength = 0;
- continue;
- }
- // Handle the shorter unchanged span below like a change.
- } else { // both abIter.hasChange() && bcIter.hasChange()
- if (ab_bLength == bc_bLength) {
- // Changes on both sides up to the same position. Emit & reset.
- addReplace(pending_aLength + aLength, pending_cLength + cLength);
- pending_aLength = pending_cLength = 0;
- ab_bLength = bc_bLength = 0;
- continue;
- }
- }
- // Accumulate the a->c change, reset the shorter side,
- // keep a remainder of the longer one.
- pending_aLength += aLength;
- pending_cLength += cLength;
- if (ab_bLength < bc_bLength) {
- bc_bLength -= ab_bLength;
- cLength = ab_bLength = 0;
- } else { // ab_bLength > bc_bLength
- ab_bLength -= bc_bLength;
- aLength = bc_bLength = 0;
- }
- }
- if (pending_aLength != 0 || pending_cLength != 0) {
- addReplace(pending_aLength, pending_cLength);
- }
- copyErrorTo(errorCode);
- return *this;
-}
-
-Edits::Iterator::Iterator(const uint16_t *a, int32_t len, UBool oc, UBool crs) :
- array(a), index(0), length(len), remaining(0),
- onlyChanges_(oc), coarse(crs),
- dir(0), changed(FALSE), oldLength_(0), newLength_(0),
- srcIndex(0), replIndex(0), destIndex(0) {}
-
-int32_t Edits::Iterator::readLength(int32_t head) {
- if (head < LENGTH_IN_1TRAIL) {
- return head;
- } else if (head < LENGTH_IN_2TRAIL) {
- U_ASSERT(index < length);
- U_ASSERT(array[index] >= 0x8000);
- return array[index++] & 0x7fff;
- } else {
- U_ASSERT((index + 2) <= length);
- U_ASSERT(array[index] >= 0x8000);
- U_ASSERT(array[index + 1] >= 0x8000);
- int32_t len = ((head & 1) << 30) |
- ((int32_t)(array[index] & 0x7fff) << 15) |
- (array[index + 1] & 0x7fff);
- index += 2;
- return len;
- }
-}
-
-void Edits::Iterator::updateNextIndexes() {
- srcIndex += oldLength_;
- if (changed) {
- replIndex += newLength_;
- }
- destIndex += newLength_;
-}
-
-void Edits::Iterator::updatePreviousIndexes() {
- srcIndex -= oldLength_;
- if (changed) {
- replIndex -= newLength_;
- }
- destIndex -= newLength_;
-}
-
-UBool Edits::Iterator::noNext() {
- // No change before or beyond the string.
- dir = 0;
- changed = FALSE;
- oldLength_ = newLength_ = 0;
- return FALSE;
-}
-
-UBool Edits::Iterator::next(UBool onlyChanges, UErrorCode &errorCode) {
- // Forward iteration: Update the string indexes to the limit of the current span,
- // and post-increment-read array units to assemble a new span.
- // Leaves the array index one after the last unit of that span.
- if (U_FAILURE(errorCode)) { return FALSE; }
- // We have an errorCode in case we need to start guarding against integer overflows.
- // It is also convenient for caller loops if we bail out when an error was set elsewhere.
- if (dir > 0) {
- updateNextIndexes();
- } else {
- if (dir < 0) {
- // Turn around from previous() to next().
- // Post-increment-read the same span again.
- if (remaining > 0) {
- // Fine-grained iterator:
- // Stay on the current one of a sequence of compressed changes.
- ++index; // next() rests on the index after the sequence unit.
- dir = 1;
- return TRUE;
- }
- }
- dir = 1;
- }
- if (remaining >= 1) {
- // Fine-grained iterator: Continue a sequence of compressed changes.
- if (remaining > 1) {
- --remaining;
- return TRUE;
- }
- remaining = 0;
- }
- if (index >= length) {
- return noNext();
- }
- int32_t u = array[index++];
- if (u <= MAX_UNCHANGED) {
- // Combine adjacent unchanged ranges.
- changed = FALSE;
- oldLength_ = u + 1;
- while (index < length && (u = array[index]) <= MAX_UNCHANGED) {
- ++index;
- oldLength_ += u + 1;
- }
- newLength_ = oldLength_;
- if (onlyChanges) {
- updateNextIndexes();
- if (index >= length) {
- return noNext();
- }
- // already fetched u > MAX_UNCHANGED at index
- ++index;
- } else {
- return TRUE;
- }
- }
- changed = TRUE;
- if (u <= MAX_SHORT_CHANGE) {
- int32_t oldLen = u >> 12;
- int32_t newLen = (u >> 9) & MAX_SHORT_CHANGE_NEW_LENGTH;
- int32_t num = (u & SHORT_CHANGE_NUM_MASK) + 1;
- if (coarse) {
- oldLength_ = num * oldLen;
- newLength_ = num * newLen;
- } else {
- // Split a sequence of changes that was compressed into one unit.
- oldLength_ = oldLen;
- newLength_ = newLen;
- if (num > 1) {
- remaining = num; // This is the first of two or more changes.
- }
- return TRUE;
- }
- } else {
- U_ASSERT(u <= 0x7fff);
- oldLength_ = readLength((u >> 6) & 0x3f);
- newLength_ = readLength(u & 0x3f);
- if (!coarse) {
- return TRUE;
- }
- }
- // Combine adjacent changes.
- while (index < length && (u = array[index]) > MAX_UNCHANGED) {
- ++index;
- if (u <= MAX_SHORT_CHANGE) {
- int32_t num = (u & SHORT_CHANGE_NUM_MASK) + 1;
- oldLength_ += (u >> 12) * num;
- newLength_ += ((u >> 9) & MAX_SHORT_CHANGE_NEW_LENGTH) * num;
- } else {
- U_ASSERT(u <= 0x7fff);
- oldLength_ += readLength((u >> 6) & 0x3f);
- newLength_ += readLength(u & 0x3f);
- }
- }
- return TRUE;
-}
-
-UBool Edits::Iterator::previous(UErrorCode &errorCode) {
- // Backward iteration: Pre-decrement-read array units to assemble a new span,
- // then update the string indexes to the start of that span.
- // Leaves the array index on the head unit of that span.
- if (U_FAILURE(errorCode)) { return FALSE; }
- // We have an errorCode in case we need to start guarding against integer overflows.
- // It is also convenient for caller loops if we bail out when an error was set elsewhere.
- if (dir >= 0) {
- if (dir > 0) {
- // Turn around from next() to previous().
- // Set the string indexes to the span limit and
- // pre-decrement-read the same span again.
- if (remaining > 0) {
- // Fine-grained iterator:
- // Stay on the current one of a sequence of compressed changes.
- --index; // previous() rests on the sequence unit.
- dir = -1;
- return TRUE;
- }
- updateNextIndexes();
- }
- dir = -1;
- }
- if (remaining > 0) {
- // Fine-grained iterator: Continue a sequence of compressed changes.
- int32_t u = array[index];
- U_ASSERT(MAX_UNCHANGED < u && u <= MAX_SHORT_CHANGE);
- if (remaining <= (u & SHORT_CHANGE_NUM_MASK)) {
- ++remaining;
- updatePreviousIndexes();
- return TRUE;
- }
- remaining = 0;
- }
- if (index <= 0) {
- return noNext();
- }
- int32_t u = array[--index];
- if (u <= MAX_UNCHANGED) {
- // Combine adjacent unchanged ranges.
- changed = FALSE;
- oldLength_ = u + 1;
- while (index > 0 && (u = array[index - 1]) <= MAX_UNCHANGED) {
- --index;
- oldLength_ += u + 1;
- }
- newLength_ = oldLength_;
- // No need to handle onlyChanges as long as previous() is called only from findIndex().
- updatePreviousIndexes();
- return TRUE;
- }
- changed = TRUE;
- if (u <= MAX_SHORT_CHANGE) {
- int32_t oldLen = u >> 12;
- int32_t newLen = (u >> 9) & MAX_SHORT_CHANGE_NEW_LENGTH;
- int32_t num = (u & SHORT_CHANGE_NUM_MASK) + 1;
- if (coarse) {
- oldLength_ = num * oldLen;
- newLength_ = num * newLen;
- } else {
- // Split a sequence of changes that was compressed into one unit.
- oldLength_ = oldLen;
- newLength_ = newLen;
- if (num > 1) {
- remaining = 1; // This is the last of two or more changes.
- }
- updatePreviousIndexes();
- return TRUE;
- }
- } else {
- if (u <= 0x7fff) {
- // The change is encoded in u alone.
- oldLength_ = readLength((u >> 6) & 0x3f);
- newLength_ = readLength(u & 0x3f);
- } else {
- // Back up to the head of the change, read the lengths,
- // and reset the index to the head again.
- U_ASSERT(index > 0);
- while ((u = array[--index]) > 0x7fff) {}
- U_ASSERT(u > MAX_SHORT_CHANGE);
- int32_t headIndex = index++;
- oldLength_ = readLength((u >> 6) & 0x3f);
- newLength_ = readLength(u & 0x3f);
- index = headIndex;
- }
- if (!coarse) {
- updatePreviousIndexes();
- return TRUE;
- }
- }
- // Combine adjacent changes.
- while (index > 0 && (u = array[index - 1]) > MAX_UNCHANGED) {
- --index;
- if (u <= MAX_SHORT_CHANGE) {
- int32_t num = (u & SHORT_CHANGE_NUM_MASK) + 1;
- oldLength_ += (u >> 12) * num;
- newLength_ += ((u >> 9) & MAX_SHORT_CHANGE_NEW_LENGTH) * num;
- } else if (u <= 0x7fff) {
- // Read the lengths, and reset the index to the head again.
- int32_t headIndex = index++;
- oldLength_ += readLength((u >> 6) & 0x3f);
- newLength_ += readLength(u & 0x3f);
- index = headIndex;
- }
- }
- updatePreviousIndexes();
- return TRUE;
-}
-
-int32_t Edits::Iterator::findIndex(int32_t i, UBool findSource, UErrorCode &errorCode) {
- if (U_FAILURE(errorCode) || i < 0) { return -1; }
- int32_t spanStart, spanLength;
- if (findSource) { // find source index
- spanStart = srcIndex;
- spanLength = oldLength_;
- } else { // find destination index
- spanStart = destIndex;
- spanLength = newLength_;
- }
- if (i < spanStart) {
- if (i >= (spanStart / 2)) {
- // Search backwards.
- for (;;) {
- UBool hasPrevious = previous(errorCode);
- U_ASSERT(hasPrevious); // because i>=0 and the first span starts at 0
- (void)hasPrevious; // avoid unused-variable warning
- spanStart = findSource ? srcIndex : destIndex;
- if (i >= spanStart) {
- // The index is in the current span.
- return 0;
- }
- if (remaining > 0) {
- // Is the index in one of the remaining compressed edits?
- // spanStart is the start of the current span, first of the remaining ones.
- spanLength = findSource ? oldLength_ : newLength_;
- int32_t u = array[index];
- U_ASSERT(MAX_UNCHANGED < u && u <= MAX_SHORT_CHANGE);
- int32_t num = (u & SHORT_CHANGE_NUM_MASK) + 1 - remaining;
- int32_t len = num * spanLength;
- if (i >= (spanStart - len)) {
- int32_t n = ((spanStart - i - 1) / spanLength) + 1;
- // 1 <= n <= num
- srcIndex -= n * oldLength_;
- replIndex -= n * newLength_;
- destIndex -= n * newLength_;
- remaining += n;
- return 0;
- }
- // Skip all of these edits at once.
- srcIndex -= num * oldLength_;
- replIndex -= num * newLength_;
- destIndex -= num * newLength_;
- remaining = 0;
- }
- }
- }
- // Reset the iterator to the start.
- dir = 0;
- index = remaining = oldLength_ = newLength_ = srcIndex = replIndex = destIndex = 0;
- } else if (i < (spanStart + spanLength)) {
- // The index is in the current span.
- return 0;
- }
- while (next(FALSE, errorCode)) {
- if (findSource) {
- spanStart = srcIndex;
- spanLength = oldLength_;
- } else {
- spanStart = destIndex;
- spanLength = newLength_;
- }
- if (i < (spanStart + spanLength)) {
- // The index is in the current span.
- return 0;
- }
- if (remaining > 1) {
- // Is the index in one of the remaining compressed edits?
- // spanStart is the start of the current span, first of the remaining ones.
- int32_t len = remaining * spanLength;
- if (i < (spanStart + len)) {
- int32_t n = (i - spanStart) / spanLength; // 1 <= n <= remaining - 1
- srcIndex += n * oldLength_;
- replIndex += n * newLength_;
- destIndex += n * newLength_;
- remaining -= n;
- return 0;
- }
- // Make next() skip all of these edits at once.
- oldLength_ *= remaining;
- newLength_ *= remaining;
- remaining = 0;
- }
- }
- return 1;
-}
-
-int32_t Edits::Iterator::destinationIndexFromSourceIndex(int32_t i, UErrorCode &errorCode) {
- int32_t where = findIndex(i, TRUE, errorCode);
- if (where < 0) {
- // Error or before the string.
- return 0;
- }
- if (where > 0 || i == srcIndex) {
- // At or after string length, or at start of the found span.
- return destIndex;
- }
- if (changed) {
- // In a change span, map to its end.
- return destIndex + newLength_;
- } else {
- // In an unchanged span, offset 1:1 within it.
- return destIndex + (i - srcIndex);
- }
-}
-
-int32_t Edits::Iterator::sourceIndexFromDestinationIndex(int32_t i, UErrorCode &errorCode) {
- int32_t where = findIndex(i, FALSE, errorCode);
- if (where < 0) {
- // Error or before the string.
- return 0;
- }
- if (where > 0 || i == destIndex) {
- // At or after string length, or at start of the found span.
- return srcIndex;
- }
- if (changed) {
- // In a change span, map to its end.
- return srcIndex + oldLength_;
- } else {
- // In an unchanged span, offset within it.
- return srcIndex + (i - destIndex);
- }
-}
-
-UnicodeString& Edits::Iterator::toString(UnicodeString& sb) const {
- sb.append(u"{ src[", -1);
- ICU_Utility::appendNumber(sb, srcIndex);
- sb.append(u"..", -1);
- ICU_Utility::appendNumber(sb, srcIndex + oldLength_);
- if (changed) {
- sb.append(u"] ⇝ dest[", -1);
- } else {
- sb.append(u"] ≡ dest[", -1);
- }
- ICU_Utility::appendNumber(sb, destIndex);
- sb.append(u"..", -1);
- ICU_Utility::appendNumber(sb, destIndex + newLength_);
- if (changed) {
- sb.append(u"], repl[", -1);
- ICU_Utility::appendNumber(sb, replIndex);
- sb.append(u"..", -1);
- ICU_Utility::appendNumber(sb, replIndex + newLength_);
- sb.append(u"] }", -1);
- } else {
- sb.append(u"] (no-change) }", -1);
- }
- return sb;
-}
-
-U_NAMESPACE_END
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// edits.cpp
+// created: 2017feb08 Markus W. Scherer
+
+#include "unicode/edits.h"
+#include "unicode/unistr.h"
+#include "unicode/utypes.h"
+#include "cmemory.h"
+#include "uassert.h"
+#include "util.h"
+
+U_NAMESPACE_BEGIN
+
+namespace {
+
+// 0000uuuuuuuuuuuu records u+1 unchanged text units.
+const int32_t MAX_UNCHANGED_LENGTH = 0x1000;
+const int32_t MAX_UNCHANGED = MAX_UNCHANGED_LENGTH - 1;
+
+// 0mmmnnnccccccccc with m=1..6 records ccc+1 replacements of m:n text units.
+const int32_t MAX_SHORT_CHANGE_OLD_LENGTH = 6;
+const int32_t MAX_SHORT_CHANGE_NEW_LENGTH = 7;
+const int32_t SHORT_CHANGE_NUM_MASK = 0x1ff;
+const int32_t MAX_SHORT_CHANGE = 0x6fff;
+
+// 0111mmmmmmnnnnnn records a replacement of m text units with n.
+// m or n = 61: actual length follows in the next edits array unit.
+// m or n = 62..63: actual length follows in the next two edits array units.
+// Bit 30 of the actual length is in the head unit.
+// Trailing units have bit 15 set.
+const int32_t LENGTH_IN_1TRAIL = 61;
+const int32_t LENGTH_IN_2TRAIL = 62;
+
+} // namespace
+
+void Edits::releaseArray() U_NOEXCEPT {
+ if (array != stackArray) {
+ uprv_free(array);
+ }
+}
+
+Edits &Edits::copyArray(const Edits &other) {
+ if (U_FAILURE(errorCode_)) {
+ length = delta = numChanges = 0;
+ return *this;
+ }
+ if (length > capacity) {
+ uint16_t *newArray = (uint16_t *)uprv_malloc((size_t)length * 2);
+ if (newArray == nullptr) {
+ length = delta = numChanges = 0;
+ errorCode_ = U_MEMORY_ALLOCATION_ERROR;
+ return *this;
+ }
+ releaseArray();
+ array = newArray;
+ capacity = length;
+ }
+ if (length > 0) {
+ uprv_memcpy(array, other.array, (size_t)length * 2);
+ }
+ return *this;
+}
+
+Edits &Edits::moveArray(Edits &src) U_NOEXCEPT {
+ if (U_FAILURE(errorCode_)) {
+ length = delta = numChanges = 0;
+ return *this;
+ }
+ releaseArray();
+ if (length > STACK_CAPACITY) {
+ array = src.array;
+ capacity = src.capacity;
+ src.array = src.stackArray;
+ src.capacity = STACK_CAPACITY;
+ src.reset();
+ return *this;
+ }
+ array = stackArray;
+ capacity = STACK_CAPACITY;
+ if (length > 0) {
+ uprv_memcpy(array, src.array, (size_t)length * 2);
+ }
+ return *this;
+}
+
+Edits &Edits::operator=(const Edits &other) {
+ length = other.length;
+ delta = other.delta;
+ numChanges = other.numChanges;
+ errorCode_ = other.errorCode_;
+ return copyArray(other);
+}
+
+Edits &Edits::operator=(Edits &&src) U_NOEXCEPT {
+ length = src.length;
+ delta = src.delta;
+ numChanges = src.numChanges;
+ errorCode_ = src.errorCode_;
+ return moveArray(src);
+}
+
+Edits::~Edits() {
+ releaseArray();
+}
+
+void Edits::reset() U_NOEXCEPT {
+ length = delta = numChanges = 0;
+ errorCode_ = U_ZERO_ERROR;
+}
+
+void Edits::addUnchanged(int32_t unchangedLength) {
+ if(U_FAILURE(errorCode_) || unchangedLength == 0) { return; }
+ if(unchangedLength < 0) {
+ errorCode_ = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ // Merge into previous unchanged-text record, if any.
+ int32_t last = lastUnit();
+ if(last < MAX_UNCHANGED) {
+ int32_t remaining = MAX_UNCHANGED - last;
+ if (remaining >= unchangedLength) {
+ setLastUnit(last + unchangedLength);
+ return;
+ }
+ setLastUnit(MAX_UNCHANGED);
+ unchangedLength -= remaining;
+ }
+ // Split large lengths into multiple units.
+ while(unchangedLength >= MAX_UNCHANGED_LENGTH) {
+ append(MAX_UNCHANGED);
+ unchangedLength -= MAX_UNCHANGED_LENGTH;
+ }
+ // Write a small (remaining) length.
+ if(unchangedLength > 0) {
+ append(unchangedLength - 1);
+ }
+}
+
+void Edits::addReplace(int32_t oldLength, int32_t newLength) {
+ if(U_FAILURE(errorCode_)) { return; }
+ if(oldLength < 0 || newLength < 0) {
+ errorCode_ = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ if (oldLength == 0 && newLength == 0) {
+ return;
+ }
+ ++numChanges;
+ int32_t newDelta = newLength - oldLength;
+ if (newDelta != 0) {
+ if ((newDelta > 0 && delta >= 0 && newDelta > (INT32_MAX - delta)) ||
+ (newDelta < 0 && delta < 0 && newDelta < (INT32_MIN - delta))) {
+ // Integer overflow or underflow.
+ errorCode_ = U_INDEX_OUTOFBOUNDS_ERROR;
+ return;
+ }
+ delta += newDelta;
+ }
+
+ if(0 < oldLength && oldLength <= MAX_SHORT_CHANGE_OLD_LENGTH &&
+ newLength <= MAX_SHORT_CHANGE_NEW_LENGTH) {
+ // Merge into previous same-lengths short-replacement record, if any.
+ int32_t u = (oldLength << 12) | (newLength << 9);
+ int32_t last = lastUnit();
+ if(MAX_UNCHANGED < last && last < MAX_SHORT_CHANGE &&
+ (last & ~SHORT_CHANGE_NUM_MASK) == u &&
+ (last & SHORT_CHANGE_NUM_MASK) < SHORT_CHANGE_NUM_MASK) {
+ setLastUnit(last + 1);
+ return;
+ }
+ append(u);
+ return;
+ }
+
+ int32_t head = 0x7000;
+ if (oldLength < LENGTH_IN_1TRAIL && newLength < LENGTH_IN_1TRAIL) {
+ head |= oldLength << 6;
+ head |= newLength;
+ append(head);
+ } else if ((capacity - length) >= 5 || growArray()) {
+ int32_t limit = length + 1;
+ if(oldLength < LENGTH_IN_1TRAIL) {
+ head |= oldLength << 6;
+ } else if(oldLength <= 0x7fff) {
+ head |= LENGTH_IN_1TRAIL << 6;
+ array[limit++] = (uint16_t)(0x8000 | oldLength);
+ } else {
+ head |= (LENGTH_IN_2TRAIL + (oldLength >> 30)) << 6;
+ array[limit++] = (uint16_t)(0x8000 | (oldLength >> 15));
+ array[limit++] = (uint16_t)(0x8000 | oldLength);
+ }
+ if(newLength < LENGTH_IN_1TRAIL) {
+ head |= newLength;
+ } else if(newLength <= 0x7fff) {
+ head |= LENGTH_IN_1TRAIL;
+ array[limit++] = (uint16_t)(0x8000 | newLength);
+ } else {
+ head |= LENGTH_IN_2TRAIL + (newLength >> 30);
+ array[limit++] = (uint16_t)(0x8000 | (newLength >> 15));
+ array[limit++] = (uint16_t)(0x8000 | newLength);
+ }
+ array[length] = (uint16_t)head;
+ length = limit;
+ }
+}
+
+void Edits::append(int32_t r) {
+ if(length < capacity || growArray()) {
+ array[length++] = (uint16_t)r;
+ }
+}
+
+UBool Edits::growArray() {
+ int32_t newCapacity;
+ if (array == stackArray) {
+ newCapacity = 2000;
+ } else if (capacity == INT32_MAX) {
+ // Not U_BUFFER_OVERFLOW_ERROR because that could be confused on a string transform API
+ // with a result-string-buffer overflow.
+ errorCode_ = U_INDEX_OUTOFBOUNDS_ERROR;
+ return FALSE;
+ } else if (capacity >= (INT32_MAX / 2)) {
+ newCapacity = INT32_MAX;
+ } else {
+ newCapacity = 2 * capacity;
+ }
+ // Grow by at least 5 units so that a maximal change record will fit.
+ if ((newCapacity - capacity) < 5) {
+ errorCode_ = U_INDEX_OUTOFBOUNDS_ERROR;
+ return FALSE;
+ }
+ uint16_t *newArray = (uint16_t *)uprv_malloc((size_t)newCapacity * 2);
+ if (newArray == NULL) {
+ errorCode_ = U_MEMORY_ALLOCATION_ERROR;
+ return FALSE;
+ }
+ uprv_memcpy(newArray, array, (size_t)length * 2);
+ releaseArray();
+ array = newArray;
+ capacity = newCapacity;
+ return TRUE;
+}
+
+UBool Edits::copyErrorTo(UErrorCode &outErrorCode) const {
+ if (U_FAILURE(outErrorCode)) { return TRUE; }
+ if (U_SUCCESS(errorCode_)) { return FALSE; }
+ outErrorCode = errorCode_;
+ return TRUE;
+}
+
+Edits &Edits::mergeAndAppend(const Edits &ab, const Edits &bc, UErrorCode &errorCode) {
+ if (copyErrorTo(errorCode)) { return *this; }
+ // Picture string a --(Edits ab)--> string b --(Edits bc)--> string c.
+ // Parallel iteration over both Edits.
+ Iterator abIter = ab.getFineIterator();
+ Iterator bcIter = bc.getFineIterator();
+ UBool abHasNext = TRUE, bcHasNext = TRUE;
+ // Copy iterator state into local variables, so that we can modify and subdivide spans.
+ // ab old & new length, bc old & new length
+ int32_t aLength = 0, ab_bLength = 0, bc_bLength = 0, cLength = 0;
+ // When we have different-intermediate-length changes, we accumulate a larger change.
+ int32_t pending_aLength = 0, pending_cLength = 0;
+ for (;;) {
+ // At this point, for each of the two iterators:
+ // Either we are done with the locally cached current edit,
+ // and its intermediate-string length has been reset,
+ // or we will continue to work with a truncated remainder of this edit.
+ //
+ // If the current edit is done, and the iterator has not yet reached the end,
+ // then we fetch the next edit. This is true for at least one of the iterators.
+ //
+ // Normally it does not matter whether we fetch from ab and then bc or vice versa.
+ // However, the result is observably different when
+ // ab deletions meet bc insertions at the same intermediate-string index.
+ // Some users expect the bc insertions to come first, so we fetch from bc first.
+ if (bc_bLength == 0) {
+ if (bcHasNext && (bcHasNext = bcIter.next(errorCode)) != 0) {
+ bc_bLength = bcIter.oldLength();
+ cLength = bcIter.newLength();
+ if (bc_bLength == 0) {
+ // insertion
+ if (ab_bLength == 0 || !abIter.hasChange()) {
+ addReplace(pending_aLength, pending_cLength + cLength);
+ pending_aLength = pending_cLength = 0;
+ } else {
+ pending_cLength += cLength;
+ }
+ continue;
+ }
+ }
+ // else see if the other iterator is done, too.
+ }
+ if (ab_bLength == 0) {
+ if (abHasNext && (abHasNext = abIter.next(errorCode)) != 0) {
+ aLength = abIter.oldLength();
+ ab_bLength = abIter.newLength();
+ if (ab_bLength == 0) {
+ // deletion
+ if (bc_bLength == bcIter.oldLength() || !bcIter.hasChange()) {
+ addReplace(pending_aLength + aLength, pending_cLength);
+ pending_aLength = pending_cLength = 0;
+ } else {
+ pending_aLength += aLength;
+ }
+ continue;
+ }
+ } else if (bc_bLength == 0) {
+ // Both iterators are done at the same time:
+ // The intermediate-string lengths match.
+ break;
+ } else {
+ // The ab output string is shorter than the bc input string.
+ if (!copyErrorTo(errorCode)) {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ }
+ return *this;
+ }
+ }
+ if (bc_bLength == 0) {
+ // The bc input string is shorter than the ab output string.
+ if (!copyErrorTo(errorCode)) {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ }
+ return *this;
+ }
+ // Done fetching: ab_bLength > 0 && bc_bLength > 0
+
+ // The current state has two parts:
+ // - Past: We accumulate a longer ac edit in the "pending" variables.
+ // - Current: We have copies of the current ab/bc edits in local variables.
+ // At least one side is newly fetched.
+ // One side might be a truncated remainder of an edit we fetched earlier.
+
+ if (!abIter.hasChange() && !bcIter.hasChange()) {
+ // An unchanged span all the way from string a to string c.
+ if (pending_aLength != 0 || pending_cLength != 0) {
+ addReplace(pending_aLength, pending_cLength);
+ pending_aLength = pending_cLength = 0;
+ }
+ int32_t unchangedLength = aLength <= cLength ? aLength : cLength;
+ addUnchanged(unchangedLength);
+ ab_bLength = aLength -= unchangedLength;
+ bc_bLength = cLength -= unchangedLength;
+ // At least one of the unchanged spans is now empty.
+ continue;
+ }
+ if (!abIter.hasChange() && bcIter.hasChange()) {
+ // Unchanged a->b but changed b->c.
+ if (ab_bLength >= bc_bLength) {
+ // Split the longer unchanged span into change + remainder.
+ addReplace(pending_aLength + bc_bLength, pending_cLength + cLength);
+ pending_aLength = pending_cLength = 0;
+ aLength = ab_bLength -= bc_bLength;
+ bc_bLength = 0;
+ continue;
+ }
+ // Handle the shorter unchanged span below like a change.
+ } else if (abIter.hasChange() && !bcIter.hasChange()) {
+ // Changed a->b and then unchanged b->c.
+ if (ab_bLength <= bc_bLength) {
+ // Split the longer unchanged span into change + remainder.
+ addReplace(pending_aLength + aLength, pending_cLength + ab_bLength);
+ pending_aLength = pending_cLength = 0;
+ cLength = bc_bLength -= ab_bLength;
+ ab_bLength = 0;
+ continue;
+ }
+ // Handle the shorter unchanged span below like a change.
+ } else { // both abIter.hasChange() && bcIter.hasChange()
+ if (ab_bLength == bc_bLength) {
+ // Changes on both sides up to the same position. Emit & reset.
+ addReplace(pending_aLength + aLength, pending_cLength + cLength);
+ pending_aLength = pending_cLength = 0;
+ ab_bLength = bc_bLength = 0;
+ continue;
+ }
+ }
+ // Accumulate the a->c change, reset the shorter side,
+ // keep a remainder of the longer one.
+ pending_aLength += aLength;
+ pending_cLength += cLength;
+ if (ab_bLength < bc_bLength) {
+ bc_bLength -= ab_bLength;
+ cLength = ab_bLength = 0;
+ } else { // ab_bLength > bc_bLength
+ ab_bLength -= bc_bLength;
+ aLength = bc_bLength = 0;
+ }
+ }
+ if (pending_aLength != 0 || pending_cLength != 0) {
+ addReplace(pending_aLength, pending_cLength);
+ }
+ copyErrorTo(errorCode);
+ return *this;
+}
+
+Edits::Iterator::Iterator(const uint16_t *a, int32_t len, UBool oc, UBool crs) :
+ array(a), index(0), length(len), remaining(0),
+ onlyChanges_(oc), coarse(crs),
+ dir(0), changed(FALSE), oldLength_(0), newLength_(0),
+ srcIndex(0), replIndex(0), destIndex(0) {}
+
+int32_t Edits::Iterator::readLength(int32_t head) {
+ if (head < LENGTH_IN_1TRAIL) {
+ return head;
+ } else if (head < LENGTH_IN_2TRAIL) {
+ U_ASSERT(index < length);
+ U_ASSERT(array[index] >= 0x8000);
+ return array[index++] & 0x7fff;
+ } else {
+ U_ASSERT((index + 2) <= length);
+ U_ASSERT(array[index] >= 0x8000);
+ U_ASSERT(array[index + 1] >= 0x8000);
+ int32_t len = ((head & 1) << 30) |
+ ((int32_t)(array[index] & 0x7fff) << 15) |
+ (array[index + 1] & 0x7fff);
+ index += 2;
+ return len;
+ }
+}
+
+void Edits::Iterator::updateNextIndexes() {
+ srcIndex += oldLength_;
+ if (changed) {
+ replIndex += newLength_;
+ }
+ destIndex += newLength_;
+}
+
+void Edits::Iterator::updatePreviousIndexes() {
+ srcIndex -= oldLength_;
+ if (changed) {
+ replIndex -= newLength_;
+ }
+ destIndex -= newLength_;
+}
+
+UBool Edits::Iterator::noNext() {
+ // No change before or beyond the string.
+ dir = 0;
+ changed = FALSE;
+ oldLength_ = newLength_ = 0;
+ return FALSE;
+}
+
+UBool Edits::Iterator::next(UBool onlyChanges, UErrorCode &errorCode) {
+ // Forward iteration: Update the string indexes to the limit of the current span,
+ // and post-increment-read array units to assemble a new span.
+ // Leaves the array index one after the last unit of that span.
+ if (U_FAILURE(errorCode)) { return FALSE; }
+ // We have an errorCode in case we need to start guarding against integer overflows.
+ // It is also convenient for caller loops if we bail out when an error was set elsewhere.
+ if (dir > 0) {
+ updateNextIndexes();
+ } else {
+ if (dir < 0) {
+ // Turn around from previous() to next().
+ // Post-increment-read the same span again.
+ if (remaining > 0) {
+ // Fine-grained iterator:
+ // Stay on the current one of a sequence of compressed changes.
+ ++index; // next() rests on the index after the sequence unit.
+ dir = 1;
+ return TRUE;
+ }
+ }
+ dir = 1;
+ }
+ if (remaining >= 1) {
+ // Fine-grained iterator: Continue a sequence of compressed changes.
+ if (remaining > 1) {
+ --remaining;
+ return TRUE;
+ }
+ remaining = 0;
+ }
+ if (index >= length) {
+ return noNext();
+ }
+ int32_t u = array[index++];
+ if (u <= MAX_UNCHANGED) {
+ // Combine adjacent unchanged ranges.
+ changed = FALSE;
+ oldLength_ = u + 1;
+ while (index < length && (u = array[index]) <= MAX_UNCHANGED) {
+ ++index;
+ oldLength_ += u + 1;
+ }
+ newLength_ = oldLength_;
+ if (onlyChanges) {
+ updateNextIndexes();
+ if (index >= length) {
+ return noNext();
+ }
+ // already fetched u > MAX_UNCHANGED at index
+ ++index;
+ } else {
+ return TRUE;
+ }
+ }
+ changed = TRUE;
+ if (u <= MAX_SHORT_CHANGE) {
+ int32_t oldLen = u >> 12;
+ int32_t newLen = (u >> 9) & MAX_SHORT_CHANGE_NEW_LENGTH;
+ int32_t num = (u & SHORT_CHANGE_NUM_MASK) + 1;
+ if (coarse) {
+ oldLength_ = num * oldLen;
+ newLength_ = num * newLen;
+ } else {
+ // Split a sequence of changes that was compressed into one unit.
+ oldLength_ = oldLen;
+ newLength_ = newLen;
+ if (num > 1) {
+ remaining = num; // This is the first of two or more changes.
+ }
+ return TRUE;
+ }
+ } else {
+ U_ASSERT(u <= 0x7fff);
+ oldLength_ = readLength((u >> 6) & 0x3f);
+ newLength_ = readLength(u & 0x3f);
+ if (!coarse) {
+ return TRUE;
+ }
+ }
+ // Combine adjacent changes.
+ while (index < length && (u = array[index]) > MAX_UNCHANGED) {
+ ++index;
+ if (u <= MAX_SHORT_CHANGE) {
+ int32_t num = (u & SHORT_CHANGE_NUM_MASK) + 1;
+ oldLength_ += (u >> 12) * num;
+ newLength_ += ((u >> 9) & MAX_SHORT_CHANGE_NEW_LENGTH) * num;
+ } else {
+ U_ASSERT(u <= 0x7fff);
+ oldLength_ += readLength((u >> 6) & 0x3f);
+ newLength_ += readLength(u & 0x3f);
+ }
+ }
+ return TRUE;
+}
+
+UBool Edits::Iterator::previous(UErrorCode &errorCode) {
+ // Backward iteration: Pre-decrement-read array units to assemble a new span,
+ // then update the string indexes to the start of that span.
+ // Leaves the array index on the head unit of that span.
+ if (U_FAILURE(errorCode)) { return FALSE; }
+ // We have an errorCode in case we need to start guarding against integer overflows.
+ // It is also convenient for caller loops if we bail out when an error was set elsewhere.
+ if (dir >= 0) {
+ if (dir > 0) {
+ // Turn around from next() to previous().
+ // Set the string indexes to the span limit and
+ // pre-decrement-read the same span again.
+ if (remaining > 0) {
+ // Fine-grained iterator:
+ // Stay on the current one of a sequence of compressed changes.
+ --index; // previous() rests on the sequence unit.
+ dir = -1;
+ return TRUE;
+ }
+ updateNextIndexes();
+ }
+ dir = -1;
+ }
+ if (remaining > 0) {
+ // Fine-grained iterator: Continue a sequence of compressed changes.
+ int32_t u = array[index];
+ U_ASSERT(MAX_UNCHANGED < u && u <= MAX_SHORT_CHANGE);
+ if (remaining <= (u & SHORT_CHANGE_NUM_MASK)) {
+ ++remaining;
+ updatePreviousIndexes();
+ return TRUE;
+ }
+ remaining = 0;
+ }
+ if (index <= 0) {
+ return noNext();
+ }
+ int32_t u = array[--index];
+ if (u <= MAX_UNCHANGED) {
+ // Combine adjacent unchanged ranges.
+ changed = FALSE;
+ oldLength_ = u + 1;
+ while (index > 0 && (u = array[index - 1]) <= MAX_UNCHANGED) {
+ --index;
+ oldLength_ += u + 1;
+ }
+ newLength_ = oldLength_;
+ // No need to handle onlyChanges as long as previous() is called only from findIndex().
+ updatePreviousIndexes();
+ return TRUE;
+ }
+ changed = TRUE;
+ if (u <= MAX_SHORT_CHANGE) {
+ int32_t oldLen = u >> 12;
+ int32_t newLen = (u >> 9) & MAX_SHORT_CHANGE_NEW_LENGTH;
+ int32_t num = (u & SHORT_CHANGE_NUM_MASK) + 1;
+ if (coarse) {
+ oldLength_ = num * oldLen;
+ newLength_ = num * newLen;
+ } else {
+ // Split a sequence of changes that was compressed into one unit.
+ oldLength_ = oldLen;
+ newLength_ = newLen;
+ if (num > 1) {
+ remaining = 1; // This is the last of two or more changes.
+ }
+ updatePreviousIndexes();
+ return TRUE;
+ }
+ } else {
+ if (u <= 0x7fff) {
+ // The change is encoded in u alone.
+ oldLength_ = readLength((u >> 6) & 0x3f);
+ newLength_ = readLength(u & 0x3f);
+ } else {
+ // Back up to the head of the change, read the lengths,
+ // and reset the index to the head again.
+ U_ASSERT(index > 0);
+ while ((u = array[--index]) > 0x7fff) {}
+ U_ASSERT(u > MAX_SHORT_CHANGE);
+ int32_t headIndex = index++;
+ oldLength_ = readLength((u >> 6) & 0x3f);
+ newLength_ = readLength(u & 0x3f);
+ index = headIndex;
+ }
+ if (!coarse) {
+ updatePreviousIndexes();
+ return TRUE;
+ }
+ }
+ // Combine adjacent changes.
+ while (index > 0 && (u = array[index - 1]) > MAX_UNCHANGED) {
+ --index;
+ if (u <= MAX_SHORT_CHANGE) {
+ int32_t num = (u & SHORT_CHANGE_NUM_MASK) + 1;
+ oldLength_ += (u >> 12) * num;
+ newLength_ += ((u >> 9) & MAX_SHORT_CHANGE_NEW_LENGTH) * num;
+ } else if (u <= 0x7fff) {
+ // Read the lengths, and reset the index to the head again.
+ int32_t headIndex = index++;
+ oldLength_ += readLength((u >> 6) & 0x3f);
+ newLength_ += readLength(u & 0x3f);
+ index = headIndex;
+ }
+ }
+ updatePreviousIndexes();
+ return TRUE;
+}
+
+int32_t Edits::Iterator::findIndex(int32_t i, UBool findSource, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode) || i < 0) { return -1; }
+ int32_t spanStart, spanLength;
+ if (findSource) { // find source index
+ spanStart = srcIndex;
+ spanLength = oldLength_;
+ } else { // find destination index
+ spanStart = destIndex;
+ spanLength = newLength_;
+ }
+ if (i < spanStart) {
+ if (i >= (spanStart / 2)) {
+ // Search backwards.
+ for (;;) {
+ UBool hasPrevious = previous(errorCode);
+ U_ASSERT(hasPrevious); // because i>=0 and the first span starts at 0
+ (void)hasPrevious; // avoid unused-variable warning
+ spanStart = findSource ? srcIndex : destIndex;
+ if (i >= spanStart) {
+ // The index is in the current span.
+ return 0;
+ }
+ if (remaining > 0) {
+ // Is the index in one of the remaining compressed edits?
+ // spanStart is the start of the current span, first of the remaining ones.
+ spanLength = findSource ? oldLength_ : newLength_;
+ int32_t u = array[index];
+ U_ASSERT(MAX_UNCHANGED < u && u <= MAX_SHORT_CHANGE);
+ int32_t num = (u & SHORT_CHANGE_NUM_MASK) + 1 - remaining;
+ int32_t len = num * spanLength;
+ if (i >= (spanStart - len)) {
+ int32_t n = ((spanStart - i - 1) / spanLength) + 1;
+ // 1 <= n <= num
+ srcIndex -= n * oldLength_;
+ replIndex -= n * newLength_;
+ destIndex -= n * newLength_;
+ remaining += n;
+ return 0;
+ }
+ // Skip all of these edits at once.
+ srcIndex -= num * oldLength_;
+ replIndex -= num * newLength_;
+ destIndex -= num * newLength_;
+ remaining = 0;
+ }
+ }
+ }
+ // Reset the iterator to the start.
+ dir = 0;
+ index = remaining = oldLength_ = newLength_ = srcIndex = replIndex = destIndex = 0;
+ } else if (i < (spanStart + spanLength)) {
+ // The index is in the current span.
+ return 0;
+ }
+ while (next(FALSE, errorCode)) {
+ if (findSource) {
+ spanStart = srcIndex;
+ spanLength = oldLength_;
+ } else {
+ spanStart = destIndex;
+ spanLength = newLength_;
+ }
+ if (i < (spanStart + spanLength)) {
+ // The index is in the current span.
+ return 0;
+ }
+ if (remaining > 1) {
+ // Is the index in one of the remaining compressed edits?
+ // spanStart is the start of the current span, first of the remaining ones.
+ int32_t len = remaining * spanLength;
+ if (i < (spanStart + len)) {
+ int32_t n = (i - spanStart) / spanLength; // 1 <= n <= remaining - 1
+ srcIndex += n * oldLength_;
+ replIndex += n * newLength_;
+ destIndex += n * newLength_;
+ remaining -= n;
+ return 0;
+ }
+ // Make next() skip all of these edits at once.
+ oldLength_ *= remaining;
+ newLength_ *= remaining;
+ remaining = 0;
+ }
+ }
+ return 1;
+}
+
+int32_t Edits::Iterator::destinationIndexFromSourceIndex(int32_t i, UErrorCode &errorCode) {
+ int32_t where = findIndex(i, TRUE, errorCode);
+ if (where < 0) {
+ // Error or before the string.
+ return 0;
+ }
+ if (where > 0 || i == srcIndex) {
+ // At or after string length, or at start of the found span.
+ return destIndex;
+ }
+ if (changed) {
+ // In a change span, map to its end.
+ return destIndex + newLength_;
+ } else {
+ // In an unchanged span, offset 1:1 within it.
+ return destIndex + (i - srcIndex);
+ }
+}
+
+int32_t Edits::Iterator::sourceIndexFromDestinationIndex(int32_t i, UErrorCode &errorCode) {
+ int32_t where = findIndex(i, FALSE, errorCode);
+ if (where < 0) {
+ // Error or before the string.
+ return 0;
+ }
+ if (where > 0 || i == destIndex) {
+ // At or after string length, or at start of the found span.
+ return srcIndex;
+ }
+ if (changed) {
+ // In a change span, map to its end.
+ return srcIndex + oldLength_;
+ } else {
+ // In an unchanged span, offset within it.
+ return srcIndex + (i - destIndex);
+ }
+}
+
+UnicodeString& Edits::Iterator::toString(UnicodeString& sb) const {
+ sb.append(u"{ src[", -1);
+ ICU_Utility::appendNumber(sb, srcIndex);
+ sb.append(u"..", -1);
+ ICU_Utility::appendNumber(sb, srcIndex + oldLength_);
+ if (changed) {
+ sb.append(u"] ⇝ dest[", -1);
+ } else {
+ sb.append(u"] ≡ dest[", -1);
+ }
+ ICU_Utility::appendNumber(sb, destIndex);
+ sb.append(u"..", -1);
+ ICU_Utility::appendNumber(sb, destIndex + newLength_);
+ if (changed) {
+ sb.append(u"], repl[", -1);
+ ICU_Utility::appendNumber(sb, replIndex);
+ sb.append(u"..", -1);
+ ICU_Utility::appendNumber(sb, replIndex + newLength_);
+ sb.append(u"] }", -1);
+ } else {
+ sb.append(u"] (no-change) }", -1);
+ }
+ return sb;
+}
+
+U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/errorcode.cpp b/contrib/libs/icu/common/errorcode.cpp
index c5e9bc713e..e7ac43b527 100644
--- a/contrib/libs/icu/common/errorcode.cpp
+++ b/contrib/libs/icu/common/errorcode.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: errorcode.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/filteredbrk.cpp b/contrib/libs/icu/common/filteredbrk.cpp
index 4839838689..c07128cbce 100644
--- a/contrib/libs/icu/common/filteredbrk.cpp
+++ b/contrib/libs/icu/common/filteredbrk.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -173,7 +173,7 @@ public:
status = U_SAFECLONE_ALLOCATED_WARNING;
return clone();
}
- virtual SimpleFilteredSentenceBreakIterator* clone() const { return new SimpleFilteredSentenceBreakIterator(*this); }
+ virtual SimpleFilteredSentenceBreakIterator* clone() const { return new SimpleFilteredSentenceBreakIterator(*this); }
virtual UClassID getDynamicClassID(void) const { return NULL; }
virtual UBool operator==(const BreakIterator& o) const { if(this==&o) return true; return false; }
@@ -694,12 +694,12 @@ FilteredBreakIteratorBuilder::createInstance(const Locale& where, UErrorCode& st
}
FilteredBreakIteratorBuilder *
-FilteredBreakIteratorBuilder::createInstance(UErrorCode &status) {
- return createEmptyInstance(status);
-}
-
-FilteredBreakIteratorBuilder *
-FilteredBreakIteratorBuilder::createEmptyInstance(UErrorCode& status) {
+FilteredBreakIteratorBuilder::createInstance(UErrorCode &status) {
+ return createEmptyInstance(status);
+}
+
+FilteredBreakIteratorBuilder *
+FilteredBreakIteratorBuilder::createEmptyInstance(UErrorCode& status) {
if(U_FAILURE(status)) return NULL;
LocalPointer<FilteredBreakIteratorBuilder> ret(new SimpleFilteredBreakIteratorBuilder(status), status);
return (U_SUCCESS(status))? ret.orphan(): NULL;
@@ -707,4 +707,4 @@ FilteredBreakIteratorBuilder::createEmptyInstance(UErrorCode& status) {
U_NAMESPACE_END
-#endif //#if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION
+#endif //#if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION
diff --git a/contrib/libs/icu/common/filterednormalizer2.cpp b/contrib/libs/icu/common/filterednormalizer2.cpp
index b3ace79764..1a0914d3f7 100644
--- a/contrib/libs/icu/common/filterednormalizer2.cpp
+++ b/contrib/libs/icu/common/filterednormalizer2.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: filterednormalizer2.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -20,9 +20,9 @@
#if !UCONFIG_NO_NORMALIZATION
-#include "unicode/edits.h"
+#include "unicode/edits.h"
#include "unicode/normalizer2.h"
-#include "unicode/stringoptions.h"
+#include "unicode/stringoptions.h"
#include "unicode/uniset.h"
#include "unicode/unistr.h"
#include "unicode/unorm.h"
@@ -87,52 +87,52 @@ FilteredNormalizer2::normalize(const UnicodeString &src,
return dest;
}
-void
-FilteredNormalizer2::normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink,
- Edits *edits, UErrorCode &errorCode) const {
- if (U_FAILURE(errorCode)) {
- return;
- }
- if (edits != nullptr && (options & U_EDITS_NO_RESET) == 0) {
- edits->reset();
- }
- options |= U_EDITS_NO_RESET; // Do not reset for each span.
- normalizeUTF8(options, src.data(), src.length(), sink, edits, USET_SPAN_SIMPLE, errorCode);
-}
-
-void
-FilteredNormalizer2::normalizeUTF8(uint32_t options, const char *src, int32_t length,
- ByteSink &sink, Edits *edits,
- USetSpanCondition spanCondition,
- UErrorCode &errorCode) const {
- while (length > 0) {
- int32_t spanLength = set.spanUTF8(src, length, spanCondition);
- if (spanCondition == USET_SPAN_NOT_CONTAINED) {
- if (spanLength != 0) {
- if (edits != nullptr) {
- edits->addUnchanged(spanLength);
- }
- if ((options & U_OMIT_UNCHANGED_TEXT) == 0) {
- sink.Append(src, spanLength);
- }
- }
- spanCondition = USET_SPAN_SIMPLE;
- } else {
- if (spanLength != 0) {
- // Not norm2.normalizeSecondAndAppend() because we do not want
- // to modify the non-filter part of dest.
- norm2.normalizeUTF8(options, StringPiece(src, spanLength), sink, edits, errorCode);
- if (U_FAILURE(errorCode)) {
- break;
- }
- }
- spanCondition = USET_SPAN_NOT_CONTAINED;
- }
- src += spanLength;
- length -= spanLength;
- }
-}
-
+void
+FilteredNormalizer2::normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink,
+ Edits *edits, UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode)) {
+ return;
+ }
+ if (edits != nullptr && (options & U_EDITS_NO_RESET) == 0) {
+ edits->reset();
+ }
+ options |= U_EDITS_NO_RESET; // Do not reset for each span.
+ normalizeUTF8(options, src.data(), src.length(), sink, edits, USET_SPAN_SIMPLE, errorCode);
+}
+
+void
+FilteredNormalizer2::normalizeUTF8(uint32_t options, const char *src, int32_t length,
+ ByteSink &sink, Edits *edits,
+ USetSpanCondition spanCondition,
+ UErrorCode &errorCode) const {
+ while (length > 0) {
+ int32_t spanLength = set.spanUTF8(src, length, spanCondition);
+ if (spanCondition == USET_SPAN_NOT_CONTAINED) {
+ if (spanLength != 0) {
+ if (edits != nullptr) {
+ edits->addUnchanged(spanLength);
+ }
+ if ((options & U_OMIT_UNCHANGED_TEXT) == 0) {
+ sink.Append(src, spanLength);
+ }
+ }
+ spanCondition = USET_SPAN_SIMPLE;
+ } else {
+ if (spanLength != 0) {
+ // Not norm2.normalizeSecondAndAppend() because we do not want
+ // to modify the non-filter part of dest.
+ norm2.normalizeUTF8(options, StringPiece(src, spanLength), sink, edits, errorCode);
+ if (U_FAILURE(errorCode)) {
+ break;
+ }
+ }
+ spanCondition = USET_SPAN_NOT_CONTAINED;
+ }
+ src += spanLength;
+ length -= spanLength;
+ }
+}
+
UnicodeString &
FilteredNormalizer2::normalizeSecondAndAppend(UnicodeString &first,
const UnicodeString &second,
@@ -244,31 +244,31 @@ FilteredNormalizer2::isNormalized(const UnicodeString &s, UErrorCode &errorCode)
return TRUE;
}
-UBool
-FilteredNormalizer2::isNormalizedUTF8(StringPiece sp, UErrorCode &errorCode) const {
- if(U_FAILURE(errorCode)) {
- return FALSE;
- }
- const char *s = sp.data();
- int32_t length = sp.length();
- USetSpanCondition spanCondition = USET_SPAN_SIMPLE;
- while (length > 0) {
- int32_t spanLength = set.spanUTF8(s, length, spanCondition);
- if (spanCondition == USET_SPAN_NOT_CONTAINED) {
- spanCondition = USET_SPAN_SIMPLE;
- } else {
- if (!norm2.isNormalizedUTF8(StringPiece(s, spanLength), errorCode) ||
- U_FAILURE(errorCode)) {
- return FALSE;
- }
- spanCondition = USET_SPAN_NOT_CONTAINED;
- }
- s += spanLength;
- length -= spanLength;
- }
- return TRUE;
-}
-
+UBool
+FilteredNormalizer2::isNormalizedUTF8(StringPiece sp, UErrorCode &errorCode) const {
+ if(U_FAILURE(errorCode)) {
+ return FALSE;
+ }
+ const char *s = sp.data();
+ int32_t length = sp.length();
+ USetSpanCondition spanCondition = USET_SPAN_SIMPLE;
+ while (length > 0) {
+ int32_t spanLength = set.spanUTF8(s, length, spanCondition);
+ if (spanCondition == USET_SPAN_NOT_CONTAINED) {
+ spanCondition = USET_SPAN_SIMPLE;
+ } else {
+ if (!norm2.isNormalizedUTF8(StringPiece(s, spanLength), errorCode) ||
+ U_FAILURE(errorCode)) {
+ return FALSE;
+ }
+ spanCondition = USET_SPAN_NOT_CONTAINED;
+ }
+ s += spanLength;
+ length -= spanLength;
+ }
+ return TRUE;
+}
+
UNormalizationCheckResult
FilteredNormalizer2::quickCheck(const UnicodeString &s, UErrorCode &errorCode) const {
uprv_checkCanGetBuffer(s, errorCode);
diff --git a/contrib/libs/icu/common/hash.h b/contrib/libs/icu/common/hash.h
index b0ddc6e331..f02cb7087a 100644
--- a/contrib/libs/icu/common/hash.h
+++ b/contrib/libs/icu/common/hash.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -33,81 +33,81 @@ class U_COMMON_API Hashtable : public UMemory {
inline void init(UHashFunction *keyHash, UKeyComparator *keyComp, UValueComparator *valueComp, UErrorCode& status);
- inline void initSize(UHashFunction *keyHash, UKeyComparator *keyComp, UValueComparator *valueComp, int32_t size, UErrorCode& status);
-
+ inline void initSize(UHashFunction *keyHash, UKeyComparator *keyComp, UValueComparator *valueComp, int32_t size, UErrorCode& status);
+
public:
/**
* Construct a hashtable
* @param ignoreKeyCase If true, keys are case insensitive.
* @param status Error code
*/
- inline Hashtable(UBool ignoreKeyCase, UErrorCode& status);
+ inline Hashtable(UBool ignoreKeyCase, UErrorCode& status);
+
+ /**
+ * Construct a hashtable
+ * @param ignoreKeyCase If true, keys are case insensitive.
+ * @param size initial size allocation
+ * @param status Error code
+ */
+ inline Hashtable(UBool ignoreKeyCase, int32_t size, UErrorCode& status);
/**
* Construct a hashtable
- * @param ignoreKeyCase If true, keys are case insensitive.
- * @param size initial size allocation
- * @param status Error code
- */
- inline Hashtable(UBool ignoreKeyCase, int32_t size, UErrorCode& status);
-
- /**
- * Construct a hashtable
* @param keyComp Comparator for comparing the keys
* @param valueComp Comparator for comparing the values
* @param status Error code
*/
- inline Hashtable(UKeyComparator *keyComp, UValueComparator *valueComp, UErrorCode& status);
+ inline Hashtable(UKeyComparator *keyComp, UValueComparator *valueComp, UErrorCode& status);
/**
* Construct a hashtable
* @param status Error code
*/
- inline Hashtable(UErrorCode& status);
+ inline Hashtable(UErrorCode& status);
/**
* Construct a hashtable, _disregarding any error_. Use this constructor
* with caution.
*/
- inline Hashtable();
+ inline Hashtable();
/**
* Non-virtual destructor; make this virtual if Hashtable is subclassed
* in the future.
*/
- inline ~Hashtable();
+ inline ~Hashtable();
+
+ inline UObjectDeleter *setValueDeleter(UObjectDeleter *fn);
- inline UObjectDeleter *setValueDeleter(UObjectDeleter *fn);
+ inline int32_t count() const;
- inline int32_t count() const;
+ inline void* put(const UnicodeString& key, void* value, UErrorCode& status);
- inline void* put(const UnicodeString& key, void* value, UErrorCode& status);
+ inline int32_t puti(const UnicodeString& key, int32_t value, UErrorCode& status);
- inline int32_t puti(const UnicodeString& key, int32_t value, UErrorCode& status);
+ inline void* get(const UnicodeString& key) const;
- inline void* get(const UnicodeString& key) const;
+ inline int32_t geti(const UnicodeString& key) const;
- inline int32_t geti(const UnicodeString& key) const;
+ inline void* remove(const UnicodeString& key);
- inline void* remove(const UnicodeString& key);
+ inline int32_t removei(const UnicodeString& key);
- inline int32_t removei(const UnicodeString& key);
+ inline void removeAll(void);
+
+ inline const UHashElement* find(const UnicodeString& key) const;
- inline void removeAll(void);
-
- inline const UHashElement* find(const UnicodeString& key) const;
-
/**
* @param pos - must be UHASH_FIRST on first call, and untouched afterwards.
* @see uhash_nextElement
*/
- inline const UHashElement* nextElement(int32_t& pos) const;
+ inline const UHashElement* nextElement(int32_t& pos) const;
+
+ inline UKeyComparator* setKeyComparator(UKeyComparator*keyComp);
- inline UKeyComparator* setKeyComparator(UKeyComparator*keyComp);
-
- inline UValueComparator* setValueComparator(UValueComparator* valueComp);
-
- inline UBool equals(const Hashtable& that) const;
+ inline UValueComparator* setValueComparator(UValueComparator* valueComp);
+
+ inline UBool equals(const Hashtable& that) const;
private:
Hashtable(const Hashtable &other); // forbid copying of this class
Hashtable &operator=(const Hashtable &other); // forbid copying of this class
@@ -117,7 +117,7 @@ private:
* Implementation
********************************************************************/
-inline void Hashtable::init(UHashFunction *keyHash, UKeyComparator *keyComp,
+inline void Hashtable::init(UHashFunction *keyHash, UKeyComparator *keyComp,
UValueComparator *valueComp, UErrorCode& status) {
if (U_FAILURE(status)) {
return;
@@ -129,23 +129,23 @@ inline void Hashtable::init(UHashFunction *keyHash, UKeyComparator *keyComp,
}
}
-inline void Hashtable::initSize(UHashFunction *keyHash, UKeyComparator *keyComp,
- UValueComparator *valueComp, int32_t size, UErrorCode& status) {
- if (U_FAILURE(status)) {
- return;
- }
- uhash_initSize(&hashObj, keyHash, keyComp, valueComp, size, &status);
- if (U_SUCCESS(status)) {
- hash = &hashObj;
- uhash_setKeyDeleter(hash, uprv_deleteUObject);
- }
-}
-
-inline Hashtable::Hashtable(UKeyComparator *keyComp, UValueComparator *valueComp,
+inline void Hashtable::initSize(UHashFunction *keyHash, UKeyComparator *keyComp,
+ UValueComparator *valueComp, int32_t size, UErrorCode& status) {
+ if (U_FAILURE(status)) {
+ return;
+ }
+ uhash_initSize(&hashObj, keyHash, keyComp, valueComp, size, &status);
+ if (U_SUCCESS(status)) {
+ hash = &hashObj;
+ uhash_setKeyDeleter(hash, uprv_deleteUObject);
+ }
+}
+
+inline Hashtable::Hashtable(UKeyComparator *keyComp, UValueComparator *valueComp,
UErrorCode& status) : hash(0) {
init( uhash_hashUnicodeString, keyComp, valueComp, status);
}
-
+
inline Hashtable::Hashtable(UBool ignoreKeyCase, UErrorCode& status)
: hash(0)
{
@@ -157,17 +157,17 @@ inline Hashtable::Hashtable(UBool ignoreKeyCase, UErrorCode& status)
status);
}
-inline Hashtable::Hashtable(UBool ignoreKeyCase, int32_t size, UErrorCode& status)
- : hash(0)
-{
- initSize(ignoreKeyCase ? uhash_hashCaselessUnicodeString
- : uhash_hashUnicodeString,
- ignoreKeyCase ? uhash_compareCaselessUnicodeString
- : uhash_compareUnicodeString,
- NULL, size,
- status);
-}
-
+inline Hashtable::Hashtable(UBool ignoreKeyCase, int32_t size, UErrorCode& status)
+ : hash(0)
+{
+ initSize(ignoreKeyCase ? uhash_hashCaselessUnicodeString
+ : uhash_hashUnicodeString,
+ ignoreKeyCase ? uhash_compareCaselessUnicodeString
+ : uhash_compareUnicodeString,
+ NULL, size,
+ status);
+}
+
inline Hashtable::Hashtable(UErrorCode& status)
: hash(0)
{
@@ -234,7 +234,7 @@ inline void Hashtable::removeAll(void) {
inline UKeyComparator* Hashtable::setKeyComparator(UKeyComparator*keyComp){
return uhash_setKeyComparator(hash, keyComp);
}
-
+
inline UValueComparator* Hashtable::setValueComparator(UValueComparator* valueComp){
return uhash_setValueComparator(hash, valueComp);
}
diff --git a/contrib/libs/icu/common/icudataver.cpp b/contrib/libs/icu/common/icudataver.cpp
index d8e6770e1a..d314411374 100644
--- a/contrib/libs/icu/common/icudataver.cpp
+++ b/contrib/libs/icu/common/icudataver.cpp
@@ -1,31 +1,31 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 2009-2011, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-*/
-
-#include "unicode/utypes.h"
-#include "unicode/icudataver.h"
-#include "unicode/ures.h"
-#include "uresimp.h" /* for ures_getVersionByKey */
-
-U_CAPI void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status) {
- UResourceBundle *icudatares = NULL;
-
- if (U_FAILURE(*status)) {
- return;
- }
-
- if (dataVersionFillin != NULL) {
- icudatares = ures_openDirect(NULL, U_ICU_VERSION_BUNDLE , status);
- if (U_SUCCESS(*status)) {
- ures_getVersionByKey(icudatares, U_ICU_DATA_KEY, dataVersionFillin, status);
- }
- ures_close(icudatares);
- }
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 2009-2011, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+*/
+
+#include "unicode/utypes.h"
+#include "unicode/icudataver.h"
+#include "unicode/ures.h"
+#include "uresimp.h" /* for ures_getVersionByKey */
+
+U_CAPI void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status) {
+ UResourceBundle *icudatares = NULL;
+
+ if (U_FAILURE(*status)) {
+ return;
+ }
+
+ if (dataVersionFillin != NULL) {
+ icudatares = ures_openDirect(NULL, U_ICU_VERSION_BUNDLE , status);
+ if (U_SUCCESS(*status)) {
+ ures_getVersionByKey(icudatares, U_ICU_DATA_KEY, dataVersionFillin, status);
+ }
+ ures_close(icudatares);
+ }
+}
diff --git a/contrib/libs/icu/common/icuplug.cpp b/contrib/libs/icu/common/icuplug.cpp
index c124afe6d1..c6439cc819 100644
--- a/contrib/libs/icu/common/icuplug.cpp
+++ b/contrib/libs/icu/common/icuplug.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/common/icuplugimp.h b/contrib/libs/icu/common/icuplugimp.h
index 4ba8aa3213..3cad8f87f1 100644
--- a/contrib/libs/icu/common/icuplugimp.h
+++ b/contrib/libs/icu/common/icuplugimp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/common/loadednormalizer2impl.cpp b/contrib/libs/icu/common/loadednormalizer2impl.cpp
index ea46d08676..e4b36f1055 100644
--- a/contrib/libs/icu/common/loadednormalizer2impl.cpp
+++ b/contrib/libs/icu/common/loadednormalizer2impl.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -18,7 +18,7 @@
#include "unicode/udata.h"
#include "unicode/localpointer.h"
#include "unicode/normalizer2.h"
-#include "unicode/ucptrie.h"
+#include "unicode/ucptrie.h"
#include "unicode/unistr.h"
#include "unicode/unorm.h"
#include "cstring.h"
@@ -43,12 +43,12 @@ private:
isAcceptable(void *context, const char *type, const char *name, const UDataInfo *pInfo);
UDataMemory *memory;
- UCPTrie *ownedTrie;
+ UCPTrie *ownedTrie;
};
LoadedNormalizer2Impl::~LoadedNormalizer2Impl() {
udata_close(memory);
- ucptrie_close(ownedTrie);
+ ucptrie_close(ownedTrie);
}
UBool U_CALLCONV
@@ -63,7 +63,7 @@ LoadedNormalizer2Impl::isAcceptable(void * /*context*/,
pInfo->dataFormat[1]==0x72 &&
pInfo->dataFormat[2]==0x6d &&
pInfo->dataFormat[3]==0x32 &&
- pInfo->formatVersion[0]==4
+ pInfo->formatVersion[0]==4
) {
// Normalizer2Impl *me=(Normalizer2Impl *)context;
// uprv_memcpy(me->dataVersion, pInfo->dataVersion, 4);
@@ -85,16 +85,16 @@ LoadedNormalizer2Impl::load(const char *packageName, const char *name, UErrorCod
const uint8_t *inBytes=(const uint8_t *)udata_getMemory(memory);
const int32_t *inIndexes=(const int32_t *)inBytes;
int32_t indexesLength=inIndexes[IX_NORM_TRIE_OFFSET]/4;
- if(indexesLength<=IX_MIN_LCCC_CP) {
+ if(indexesLength<=IX_MIN_LCCC_CP) {
errorCode=U_INVALID_FORMAT_ERROR; // Not enough indexes.
return;
}
int32_t offset=inIndexes[IX_NORM_TRIE_OFFSET];
int32_t nextOffset=inIndexes[IX_EXTRA_DATA_OFFSET];
- ownedTrie=ucptrie_openFromBinary(UCPTRIE_TYPE_FAST, UCPTRIE_VALUE_BITS_16,
- inBytes+offset, nextOffset-offset, NULL,
- &errorCode);
+ ownedTrie=ucptrie_openFromBinary(UCPTRIE_TYPE_FAST, UCPTRIE_VALUE_BITS_16,
+ inBytes+offset, nextOffset-offset, NULL,
+ &errorCode);
if(U_FAILURE(errorCode)) {
return;
}
@@ -132,32 +132,32 @@ U_CDECL_BEGIN
static UBool U_CALLCONV uprv_loaded_normalizer2_cleanup();
U_CDECL_END
-#if !NORM2_HARDCODE_NFC_DATA
-static Norm2AllModes *nfcSingleton;
-static icu::UInitOnce nfcInitOnce = U_INITONCE_INITIALIZER;
-#endif
-
+#if !NORM2_HARDCODE_NFC_DATA
+static Norm2AllModes *nfcSingleton;
+static icu::UInitOnce nfcInitOnce = U_INITONCE_INITIALIZER;
+#endif
+
static Norm2AllModes *nfkcSingleton;
-static icu::UInitOnce nfkcInitOnce = U_INITONCE_INITIALIZER;
-
+static icu::UInitOnce nfkcInitOnce = U_INITONCE_INITIALIZER;
+
static Norm2AllModes *nfkc_cfSingleton;
-static icu::UInitOnce nfkc_cfInitOnce = U_INITONCE_INITIALIZER;
-
+static icu::UInitOnce nfkc_cfInitOnce = U_INITONCE_INITIALIZER;
+
static UHashtable *cache=NULL;
// UInitOnce singleton initialization function
static void U_CALLCONV initSingletons(const char *what, UErrorCode &errorCode) {
-#if !NORM2_HARDCODE_NFC_DATA
- if (uprv_strcmp(what, "nfc") == 0) {
- nfcSingleton = Norm2AllModes::createInstance(NULL, "nfc", errorCode);
- } else
-#endif
+#if !NORM2_HARDCODE_NFC_DATA
+ if (uprv_strcmp(what, "nfc") == 0) {
+ nfcSingleton = Norm2AllModes::createInstance(NULL, "nfc", errorCode);
+ } else
+#endif
if (uprv_strcmp(what, "nfkc") == 0) {
nfkcSingleton = Norm2AllModes::createInstance(NULL, "nfkc", errorCode);
} else if (uprv_strcmp(what, "nfkc_cf") == 0) {
nfkc_cfSingleton = Norm2AllModes::createInstance(NULL, "nfkc_cf", errorCode);
} else {
- UPRV_UNREACHABLE; // Unknown singleton
+ UPRV_UNREACHABLE; // Unknown singleton
}
ucln_common_registerCleanup(UCLN_COMMON_LOADED_NORMALIZER2, uprv_loaded_normalizer2_cleanup);
}
@@ -169,20 +169,20 @@ static void U_CALLCONV deleteNorm2AllModes(void *allModes) {
}
static UBool U_CALLCONV uprv_loaded_normalizer2_cleanup() {
-#if !NORM2_HARDCODE_NFC_DATA
- delete nfcSingleton;
- nfcSingleton = NULL;
- nfcInitOnce.reset();
-#endif
-
+#if !NORM2_HARDCODE_NFC_DATA
+ delete nfcSingleton;
+ nfcSingleton = NULL;
+ nfcInitOnce.reset();
+#endif
+
delete nfkcSingleton;
nfkcSingleton = NULL;
- nfkcInitOnce.reset();
-
+ nfkcInitOnce.reset();
+
delete nfkc_cfSingleton;
nfkc_cfSingleton = NULL;
- nfkc_cfInitOnce.reset();
-
+ nfkc_cfInitOnce.reset();
+
uhash_close(cache);
cache=NULL;
return TRUE;
@@ -190,16 +190,16 @@ static UBool U_CALLCONV uprv_loaded_normalizer2_cleanup() {
U_CDECL_END
-#if !NORM2_HARDCODE_NFC_DATA
+#if !NORM2_HARDCODE_NFC_DATA
+const Norm2AllModes *
+Norm2AllModes::getNFCInstance(UErrorCode &errorCode) {
+ if(U_FAILURE(errorCode)) { return NULL; }
+ umtx_initOnce(nfcInitOnce, &initSingletons, "nfc", errorCode);
+ return nfcSingleton;
+}
+#endif
+
const Norm2AllModes *
-Norm2AllModes::getNFCInstance(UErrorCode &errorCode) {
- if(U_FAILURE(errorCode)) { return NULL; }
- umtx_initOnce(nfcInitOnce, &initSingletons, "nfc", errorCode);
- return nfcSingleton;
-}
-#endif
-
-const Norm2AllModes *
Norm2AllModes::getNFKCInstance(UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) { return NULL; }
umtx_initOnce(nfkcInitOnce, &initSingletons, "nfkc", errorCode);
@@ -213,37 +213,37 @@ Norm2AllModes::getNFKC_CFInstance(UErrorCode &errorCode) {
return nfkc_cfSingleton;
}
-#if !NORM2_HARDCODE_NFC_DATA
+#if !NORM2_HARDCODE_NFC_DATA
+const Normalizer2 *
+Normalizer2::getNFCInstance(UErrorCode &errorCode) {
+ const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
+ return allModes!=NULL ? &allModes->comp : NULL;
+}
+
+const Normalizer2 *
+Normalizer2::getNFDInstance(UErrorCode &errorCode) {
+ const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
+ return allModes!=NULL ? &allModes->decomp : NULL;
+}
+
+const Normalizer2 *Normalizer2Factory::getFCDInstance(UErrorCode &errorCode) {
+ const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
+ return allModes!=NULL ? &allModes->fcd : NULL;
+}
+
+const Normalizer2 *Normalizer2Factory::getFCCInstance(UErrorCode &errorCode) {
+ const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
+ return allModes!=NULL ? &allModes->fcc : NULL;
+}
+
+const Normalizer2Impl *
+Normalizer2Factory::getNFCImpl(UErrorCode &errorCode) {
+ const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
+ return allModes!=NULL ? allModes->impl : NULL;
+}
+#endif
+
const Normalizer2 *
-Normalizer2::getNFCInstance(UErrorCode &errorCode) {
- const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
- return allModes!=NULL ? &allModes->comp : NULL;
-}
-
-const Normalizer2 *
-Normalizer2::getNFDInstance(UErrorCode &errorCode) {
- const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
- return allModes!=NULL ? &allModes->decomp : NULL;
-}
-
-const Normalizer2 *Normalizer2Factory::getFCDInstance(UErrorCode &errorCode) {
- const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
- return allModes!=NULL ? &allModes->fcd : NULL;
-}
-
-const Normalizer2 *Normalizer2Factory::getFCCInstance(UErrorCode &errorCode) {
- const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
- return allModes!=NULL ? &allModes->fcc : NULL;
-}
-
-const Normalizer2Impl *
-Normalizer2Factory::getNFCImpl(UErrorCode &errorCode) {
- const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
- return allModes!=NULL ? allModes->impl : NULL;
-}
-#endif
-
-const Normalizer2 *
Normalizer2::getNFKCInstance(UErrorCode &errorCode) {
const Norm2AllModes *allModes=Norm2AllModes::getNFKCInstance(errorCode);
return allModes!=NULL ? &allModes->comp : NULL;
@@ -291,7 +291,7 @@ Normalizer2::getInstance(const char *packageName,
}
}
if(allModes==NULL) {
- ucln_common_registerCleanup(UCLN_COMMON_LOADED_NORMALIZER2, uprv_loaded_normalizer2_cleanup);
+ ucln_common_registerCleanup(UCLN_COMMON_LOADED_NORMALIZER2, uprv_loaded_normalizer2_cleanup);
LocalPointer<Norm2AllModes> localAllModes(
Norm2AllModes::createInstance(packageName, name, errorCode));
if(U_SUCCESS(errorCode)) {
@@ -306,7 +306,7 @@ Normalizer2::getInstance(const char *packageName,
}
void *temp=uhash_get(cache, name);
if(temp==NULL) {
- int32_t keyLength= static_cast<int32_t>(uprv_strlen(name)+1);
+ int32_t keyLength= static_cast<int32_t>(uprv_strlen(name)+1);
char *nameCopy=(char *)uprv_malloc(keyLength);
if(nameCopy==NULL) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
diff --git a/contrib/libs/icu/common/localebuilder.cpp b/contrib/libs/icu/common/localebuilder.cpp
index 6633215327..1dd8131e58 100644
--- a/contrib/libs/icu/common/localebuilder.cpp
+++ b/contrib/libs/icu/common/localebuilder.cpp
@@ -1,468 +1,468 @@
-// © 2019 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include <utility>
-
-#include "bytesinkutil.h" // CharStringByteSink
-#include "charstr.h"
-#include "cstring.h"
-#include "ulocimp.h"
-#include "unicode/localebuilder.h"
-#include "unicode/locid.h"
-
-U_NAMESPACE_BEGIN
-
-#define UPRV_ISDIGIT(c) (((c) >= '0') && ((c) <= '9'))
-#define UPRV_ISALPHANUM(c) (uprv_isASCIILetter(c) || UPRV_ISDIGIT(c) )
-
-const char* kAttributeKey = "attribute";
-
-static bool _isExtensionSubtags(char key, const char* s, int32_t len) {
- switch (uprv_tolower(key)) {
- case 'u':
- return ultag_isUnicodeExtensionSubtags(s, len);
- case 't':
- return ultag_isTransformedExtensionSubtags(s, len);
- case 'x':
- return ultag_isPrivateuseValueSubtags(s, len);
- default:
- return ultag_isExtensionSubtags(s, len);
- }
-}
-
-LocaleBuilder::LocaleBuilder() : UObject(), status_(U_ZERO_ERROR), language_(),
- script_(), region_(), variant_(nullptr), extensions_(nullptr)
-{
- language_[0] = 0;
- script_[0] = 0;
- region_[0] = 0;
-}
-
-LocaleBuilder::~LocaleBuilder()
-{
- delete variant_;
- delete extensions_;
-}
-
-LocaleBuilder& LocaleBuilder::setLocale(const Locale& locale)
-{
- clear();
- setLanguage(locale.getLanguage());
- setScript(locale.getScript());
- setRegion(locale.getCountry());
- setVariant(locale.getVariant());
- extensions_ = locale.clone();
- if (extensions_ == nullptr) {
- status_ = U_MEMORY_ALLOCATION_ERROR;
- }
- return *this;
-}
-
-LocaleBuilder& LocaleBuilder::setLanguageTag(StringPiece tag)
-{
- Locale l = Locale::forLanguageTag(tag, status_);
- if (U_FAILURE(status_)) { return *this; }
- // Because setLocale will reset status_ we need to return
- // first if we have error in forLanguageTag.
- setLocale(l);
- return *this;
-}
-
-static void setField(StringPiece input, char* dest, UErrorCode& errorCode,
- UBool (*test)(const char*, int32_t)) {
- if (U_FAILURE(errorCode)) { return; }
- if (input.empty()) {
- dest[0] = '\0';
- } else if (test(input.data(), input.length())) {
- uprv_memcpy(dest, input.data(), input.length());
- dest[input.length()] = '\0';
- } else {
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- }
-}
-
-LocaleBuilder& LocaleBuilder::setLanguage(StringPiece language)
-{
- setField(language, language_, status_, &ultag_isLanguageSubtag);
- return *this;
-}
-
-LocaleBuilder& LocaleBuilder::setScript(StringPiece script)
-{
- setField(script, script_, status_, &ultag_isScriptSubtag);
- return *this;
-}
-
-LocaleBuilder& LocaleBuilder::setRegion(StringPiece region)
-{
- setField(region, region_, status_, &ultag_isRegionSubtag);
- return *this;
-}
-
-static void transform(char* data, int32_t len) {
- for (int32_t i = 0; i < len; i++, data++) {
- if (*data == '_') {
- *data = '-';
- } else {
- *data = uprv_tolower(*data);
- }
- }
-}
-
-LocaleBuilder& LocaleBuilder::setVariant(StringPiece variant)
-{
- if (U_FAILURE(status_)) { return *this; }
- if (variant.empty()) {
- delete variant_;
- variant_ = nullptr;
- return *this;
- }
- CharString* new_variant = new CharString(variant, status_);
- if (U_FAILURE(status_)) { return *this; }
- if (new_variant == nullptr) {
- status_ = U_MEMORY_ALLOCATION_ERROR;
- return *this;
- }
- transform(new_variant->data(), new_variant->length());
- if (!ultag_isVariantSubtags(new_variant->data(), new_variant->length())) {
- delete new_variant;
- status_ = U_ILLEGAL_ARGUMENT_ERROR;
- return *this;
- }
- delete variant_;
- variant_ = new_variant;
- return *this;
-}
-
-static bool
-_isKeywordValue(const char* key, const char* value, int32_t value_len)
-{
- if (key[1] == '\0') {
- // one char key
- return (UPRV_ISALPHANUM(uprv_tolower(key[0])) &&
- _isExtensionSubtags(key[0], value, value_len));
- } else if (uprv_strcmp(key, kAttributeKey) == 0) {
- // unicode attributes
- return ultag_isUnicodeLocaleAttributes(value, value_len);
- }
- // otherwise: unicode extension value
- // We need to convert from legacy key/value to unicode
- // key/value
- const char* unicode_locale_key = uloc_toUnicodeLocaleKey(key);
- const char* unicode_locale_type = uloc_toUnicodeLocaleType(key, value);
-
- return unicode_locale_key && unicode_locale_type &&
- ultag_isUnicodeLocaleKey(unicode_locale_key, -1) &&
- ultag_isUnicodeLocaleType(unicode_locale_type, -1);
-}
-
-static void
-_copyExtensions(const Locale& from, icu::StringEnumeration *keywords,
- Locale& to, bool validate, UErrorCode& errorCode)
-{
- if (U_FAILURE(errorCode)) { return; }
- LocalPointer<icu::StringEnumeration> ownedKeywords;
- if (keywords == nullptr) {
- ownedKeywords.adoptInstead(from.createKeywords(errorCode));
- if (U_FAILURE(errorCode) || ownedKeywords.isNull()) { return; }
- keywords = ownedKeywords.getAlias();
- }
- const char* key;
- while ((key = keywords->next(nullptr, errorCode)) != nullptr) {
- CharString value;
- CharStringByteSink sink(&value);
- from.getKeywordValue(key, sink, errorCode);
- if (U_FAILURE(errorCode)) { return; }
- if (uprv_strcmp(key, kAttributeKey) == 0) {
- transform(value.data(), value.length());
- }
- if (validate &&
- !_isKeywordValue(key, value.data(), value.length())) {
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- to.setKeywordValue(key, value.data(), errorCode);
- if (U_FAILURE(errorCode)) { return; }
- }
-}
-
-void static
-_clearUAttributesAndKeyType(Locale& locale, UErrorCode& errorCode)
-{
- // Clear Unicode attributes
- locale.setKeywordValue(kAttributeKey, "", errorCode);
-
- // Clear all Unicode keyword values
- LocalPointer<icu::StringEnumeration> iter(locale.createUnicodeKeywords(errorCode));
- if (U_FAILURE(errorCode) || iter.isNull()) { return; }
- const char* key;
- while ((key = iter->next(nullptr, errorCode)) != nullptr) {
- locale.setUnicodeKeywordValue(key, nullptr, errorCode);
- }
-}
-
-static void
-_setUnicodeExtensions(Locale& locale, const CharString& value, UErrorCode& errorCode)
-{
- // Add the unicode extensions to extensions_
- CharString locale_str("und-u-", errorCode);
- locale_str.append(value, errorCode);
- _copyExtensions(
- Locale::forLanguageTag(locale_str.data(), errorCode), nullptr,
- locale, false, errorCode);
-}
-
-LocaleBuilder& LocaleBuilder::setExtension(char key, StringPiece value)
-{
- if (U_FAILURE(status_)) { return *this; }
- if (!UPRV_ISALPHANUM(key)) {
- status_ = U_ILLEGAL_ARGUMENT_ERROR;
- return *this;
- }
- CharString value_str(value, status_);
- if (U_FAILURE(status_)) { return *this; }
- transform(value_str.data(), value_str.length());
- if (!value_str.isEmpty() &&
- !_isExtensionSubtags(key, value_str.data(), value_str.length())) {
- status_ = U_ILLEGAL_ARGUMENT_ERROR;
- return *this;
- }
- if (extensions_ == nullptr) {
- extensions_ = new Locale();
- if (extensions_ == nullptr) {
- status_ = U_MEMORY_ALLOCATION_ERROR;
- return *this;
- }
- }
- if (uprv_tolower(key) != 'u') {
- // for t, x and others extension.
- extensions_->setKeywordValue(StringPiece(&key, 1), value_str.data(),
- status_);
- return *this;
- }
- _clearUAttributesAndKeyType(*extensions_, status_);
- if (U_FAILURE(status_)) { return *this; }
- if (!value.empty()) {
- _setUnicodeExtensions(*extensions_, value_str, status_);
- }
- return *this;
-}
-
-LocaleBuilder& LocaleBuilder::setUnicodeLocaleKeyword(
- StringPiece key, StringPiece type)
-{
- if (U_FAILURE(status_)) { return *this; }
- if (!ultag_isUnicodeLocaleKey(key.data(), key.length()) ||
- (!type.empty() &&
- !ultag_isUnicodeLocaleType(type.data(), type.length()))) {
- status_ = U_ILLEGAL_ARGUMENT_ERROR;
- return *this;
- }
- if (extensions_ == nullptr) {
- extensions_ = new Locale();
- }
- if (extensions_ == nullptr) {
- status_ = U_MEMORY_ALLOCATION_ERROR;
- return *this;
- }
- extensions_->setUnicodeKeywordValue(key, type, status_);
- return *this;
-}
-
-LocaleBuilder& LocaleBuilder::addUnicodeLocaleAttribute(
- StringPiece value)
-{
- CharString value_str(value, status_);
- if (U_FAILURE(status_)) { return *this; }
- transform(value_str.data(), value_str.length());
- if (!ultag_isUnicodeLocaleAttribute(value_str.data(), value_str.length())) {
- status_ = U_ILLEGAL_ARGUMENT_ERROR;
- return *this;
- }
- if (extensions_ == nullptr) {
- extensions_ = new Locale();
- if (extensions_ == nullptr) {
- status_ = U_MEMORY_ALLOCATION_ERROR;
- return *this;
- }
- extensions_->setKeywordValue(kAttributeKey, value_str.data(), status_);
- return *this;
- }
-
- CharString attributes;
- CharStringByteSink sink(&attributes);
- UErrorCode localErrorCode = U_ZERO_ERROR;
- extensions_->getKeywordValue(kAttributeKey, sink, localErrorCode);
- if (U_FAILURE(localErrorCode)) {
- CharString new_attributes(value_str.data(), status_);
- // No attributes, set the attribute.
- extensions_->setKeywordValue(kAttributeKey, new_attributes.data(), status_);
- return *this;
- }
-
- transform(attributes.data(),attributes.length());
- const char* start = attributes.data();
- const char* limit = attributes.data() + attributes.length();
- CharString new_attributes;
- bool inserted = false;
- while (start < limit) {
- if (!inserted) {
- int cmp = uprv_strcmp(start, value_str.data());
- if (cmp == 0) { return *this; } // Found it in attributes: Just return
- if (cmp > 0) {
- if (!new_attributes.isEmpty()) new_attributes.append('_', status_);
- new_attributes.append(value_str.data(), status_);
- inserted = true;
- }
- }
- if (!new_attributes.isEmpty()) {
- new_attributes.append('_', status_);
- }
- new_attributes.append(start, status_);
- start += uprv_strlen(start) + 1;
- }
- if (!inserted) {
- if (!new_attributes.isEmpty()) {
- new_attributes.append('_', status_);
- }
- new_attributes.append(value_str.data(), status_);
- }
- // Not yet in the attributes, set the attribute.
- extensions_->setKeywordValue(kAttributeKey, new_attributes.data(), status_);
- return *this;
-}
-
-LocaleBuilder& LocaleBuilder::removeUnicodeLocaleAttribute(
- StringPiece value)
-{
- CharString value_str(value, status_);
- if (U_FAILURE(status_)) { return *this; }
- transform(value_str.data(), value_str.length());
- if (!ultag_isUnicodeLocaleAttribute(value_str.data(), value_str.length())) {
- status_ = U_ILLEGAL_ARGUMENT_ERROR;
- return *this;
- }
- if (extensions_ == nullptr) { return *this; }
- UErrorCode localErrorCode = U_ZERO_ERROR;
- CharString attributes;
- CharStringByteSink sink(&attributes);
- extensions_->getKeywordValue(kAttributeKey, sink, localErrorCode);
- // get failure, just return
- if (U_FAILURE(localErrorCode)) { return *this; }
- // Do not have any attributes, just return.
- if (attributes.isEmpty()) { return *this; }
-
- char* p = attributes.data();
- // Replace null terminiator in place for _ and - so later
- // we can use uprv_strcmp to compare.
- for (int32_t i = 0; i < attributes.length(); i++, p++) {
- *p = (*p == '_' || *p == '-') ? '\0' : uprv_tolower(*p);
- }
-
- const char* start = attributes.data();
- const char* limit = attributes.data() + attributes.length();
- CharString new_attributes;
- bool found = false;
- while (start < limit) {
- if (uprv_strcmp(start, value_str.data()) == 0) {
- found = true;
- } else {
- if (!new_attributes.isEmpty()) {
- new_attributes.append('_', status_);
- }
- new_attributes.append(start, status_);
- }
- start += uprv_strlen(start) + 1;
- }
- // Found the value in attributes, set the attribute.
- if (found) {
- extensions_->setKeywordValue(kAttributeKey, new_attributes.data(), status_);
- }
- return *this;
-}
-
-LocaleBuilder& LocaleBuilder::clear()
-{
- status_ = U_ZERO_ERROR;
- language_[0] = 0;
- script_[0] = 0;
- region_[0] = 0;
- delete variant_;
- variant_ = nullptr;
- clearExtensions();
- return *this;
-}
-
-LocaleBuilder& LocaleBuilder::clearExtensions()
-{
- delete extensions_;
- extensions_ = nullptr;
- return *this;
-}
-
-Locale makeBogusLocale() {
- Locale bogus;
- bogus.setToBogus();
- return bogus;
-}
-
-void LocaleBuilder::copyExtensionsFrom(const Locale& src, UErrorCode& errorCode)
-{
- if (U_FAILURE(errorCode)) { return; }
- LocalPointer<icu::StringEnumeration> keywords(src.createKeywords(errorCode));
- if (U_FAILURE(errorCode) || keywords.isNull() || keywords->count(errorCode) == 0) {
- // Error, or no extensions to copy.
- return;
- }
- if (extensions_ == nullptr) {
- extensions_ = new Locale();
- if (extensions_ == nullptr) {
- status_ = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- }
- _copyExtensions(src, keywords.getAlias(), *extensions_, false, errorCode);
-}
-
-Locale LocaleBuilder::build(UErrorCode& errorCode)
-{
- if (U_FAILURE(errorCode)) {
- return makeBogusLocale();
- }
- if (U_FAILURE(status_)) {
- errorCode = status_;
- return makeBogusLocale();
- }
- CharString locale_str(language_, errorCode);
- if (uprv_strlen(script_) > 0) {
- locale_str.append('-', errorCode).append(StringPiece(script_), errorCode);
- }
- if (uprv_strlen(region_) > 0) {
- locale_str.append('-', errorCode).append(StringPiece(region_), errorCode);
- }
- if (variant_ != nullptr) {
- locale_str.append('-', errorCode).append(StringPiece(variant_->data()), errorCode);
- }
- if (U_FAILURE(errorCode)) {
- return makeBogusLocale();
- }
- Locale product(locale_str.data());
- if (extensions_ != nullptr) {
- _copyExtensions(*extensions_, nullptr, product, true, errorCode);
- }
- if (U_FAILURE(errorCode)) {
- return makeBogusLocale();
- }
- return product;
-}
-
-UBool LocaleBuilder::copyErrorTo(UErrorCode &outErrorCode) const {
- if (U_FAILURE(outErrorCode)) {
- // Do not overwrite the older error code
- return TRUE;
- }
- outErrorCode = status_;
- return U_FAILURE(outErrorCode);
-}
-
-U_NAMESPACE_END
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include <utility>
+
+#include "bytesinkutil.h" // CharStringByteSink
+#include "charstr.h"
+#include "cstring.h"
+#include "ulocimp.h"
+#include "unicode/localebuilder.h"
+#include "unicode/locid.h"
+
+U_NAMESPACE_BEGIN
+
+#define UPRV_ISDIGIT(c) (((c) >= '0') && ((c) <= '9'))
+#define UPRV_ISALPHANUM(c) (uprv_isASCIILetter(c) || UPRV_ISDIGIT(c) )
+
+const char* kAttributeKey = "attribute";
+
+static bool _isExtensionSubtags(char key, const char* s, int32_t len) {
+ switch (uprv_tolower(key)) {
+ case 'u':
+ return ultag_isUnicodeExtensionSubtags(s, len);
+ case 't':
+ return ultag_isTransformedExtensionSubtags(s, len);
+ case 'x':
+ return ultag_isPrivateuseValueSubtags(s, len);
+ default:
+ return ultag_isExtensionSubtags(s, len);
+ }
+}
+
+LocaleBuilder::LocaleBuilder() : UObject(), status_(U_ZERO_ERROR), language_(),
+ script_(), region_(), variant_(nullptr), extensions_(nullptr)
+{
+ language_[0] = 0;
+ script_[0] = 0;
+ region_[0] = 0;
+}
+
+LocaleBuilder::~LocaleBuilder()
+{
+ delete variant_;
+ delete extensions_;
+}
+
+LocaleBuilder& LocaleBuilder::setLocale(const Locale& locale)
+{
+ clear();
+ setLanguage(locale.getLanguage());
+ setScript(locale.getScript());
+ setRegion(locale.getCountry());
+ setVariant(locale.getVariant());
+ extensions_ = locale.clone();
+ if (extensions_ == nullptr) {
+ status_ = U_MEMORY_ALLOCATION_ERROR;
+ }
+ return *this;
+}
+
+LocaleBuilder& LocaleBuilder::setLanguageTag(StringPiece tag)
+{
+ Locale l = Locale::forLanguageTag(tag, status_);
+ if (U_FAILURE(status_)) { return *this; }
+ // Because setLocale will reset status_ we need to return
+ // first if we have error in forLanguageTag.
+ setLocale(l);
+ return *this;
+}
+
+static void setField(StringPiece input, char* dest, UErrorCode& errorCode,
+ UBool (*test)(const char*, int32_t)) {
+ if (U_FAILURE(errorCode)) { return; }
+ if (input.empty()) {
+ dest[0] = '\0';
+ } else if (test(input.data(), input.length())) {
+ uprv_memcpy(dest, input.data(), input.length());
+ dest[input.length()] = '\0';
+ } else {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ }
+}
+
+LocaleBuilder& LocaleBuilder::setLanguage(StringPiece language)
+{
+ setField(language, language_, status_, &ultag_isLanguageSubtag);
+ return *this;
+}
+
+LocaleBuilder& LocaleBuilder::setScript(StringPiece script)
+{
+ setField(script, script_, status_, &ultag_isScriptSubtag);
+ return *this;
+}
+
+LocaleBuilder& LocaleBuilder::setRegion(StringPiece region)
+{
+ setField(region, region_, status_, &ultag_isRegionSubtag);
+ return *this;
+}
+
+static void transform(char* data, int32_t len) {
+ for (int32_t i = 0; i < len; i++, data++) {
+ if (*data == '_') {
+ *data = '-';
+ } else {
+ *data = uprv_tolower(*data);
+ }
+ }
+}
+
+LocaleBuilder& LocaleBuilder::setVariant(StringPiece variant)
+{
+ if (U_FAILURE(status_)) { return *this; }
+ if (variant.empty()) {
+ delete variant_;
+ variant_ = nullptr;
+ return *this;
+ }
+ CharString* new_variant = new CharString(variant, status_);
+ if (U_FAILURE(status_)) { return *this; }
+ if (new_variant == nullptr) {
+ status_ = U_MEMORY_ALLOCATION_ERROR;
+ return *this;
+ }
+ transform(new_variant->data(), new_variant->length());
+ if (!ultag_isVariantSubtags(new_variant->data(), new_variant->length())) {
+ delete new_variant;
+ status_ = U_ILLEGAL_ARGUMENT_ERROR;
+ return *this;
+ }
+ delete variant_;
+ variant_ = new_variant;
+ return *this;
+}
+
+static bool
+_isKeywordValue(const char* key, const char* value, int32_t value_len)
+{
+ if (key[1] == '\0') {
+ // one char key
+ return (UPRV_ISALPHANUM(uprv_tolower(key[0])) &&
+ _isExtensionSubtags(key[0], value, value_len));
+ } else if (uprv_strcmp(key, kAttributeKey) == 0) {
+ // unicode attributes
+ return ultag_isUnicodeLocaleAttributes(value, value_len);
+ }
+ // otherwise: unicode extension value
+ // We need to convert from legacy key/value to unicode
+ // key/value
+ const char* unicode_locale_key = uloc_toUnicodeLocaleKey(key);
+ const char* unicode_locale_type = uloc_toUnicodeLocaleType(key, value);
+
+ return unicode_locale_key && unicode_locale_type &&
+ ultag_isUnicodeLocaleKey(unicode_locale_key, -1) &&
+ ultag_isUnicodeLocaleType(unicode_locale_type, -1);
+}
+
+static void
+_copyExtensions(const Locale& from, icu::StringEnumeration *keywords,
+ Locale& to, bool validate, UErrorCode& errorCode)
+{
+ if (U_FAILURE(errorCode)) { return; }
+ LocalPointer<icu::StringEnumeration> ownedKeywords;
+ if (keywords == nullptr) {
+ ownedKeywords.adoptInstead(from.createKeywords(errorCode));
+ if (U_FAILURE(errorCode) || ownedKeywords.isNull()) { return; }
+ keywords = ownedKeywords.getAlias();
+ }
+ const char* key;
+ while ((key = keywords->next(nullptr, errorCode)) != nullptr) {
+ CharString value;
+ CharStringByteSink sink(&value);
+ from.getKeywordValue(key, sink, errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ if (uprv_strcmp(key, kAttributeKey) == 0) {
+ transform(value.data(), value.length());
+ }
+ if (validate &&
+ !_isKeywordValue(key, value.data(), value.length())) {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ to.setKeywordValue(key, value.data(), errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ }
+}
+
+void static
+_clearUAttributesAndKeyType(Locale& locale, UErrorCode& errorCode)
+{
+ // Clear Unicode attributes
+ locale.setKeywordValue(kAttributeKey, "", errorCode);
+
+ // Clear all Unicode keyword values
+ LocalPointer<icu::StringEnumeration> iter(locale.createUnicodeKeywords(errorCode));
+ if (U_FAILURE(errorCode) || iter.isNull()) { return; }
+ const char* key;
+ while ((key = iter->next(nullptr, errorCode)) != nullptr) {
+ locale.setUnicodeKeywordValue(key, nullptr, errorCode);
+ }
+}
+
+static void
+_setUnicodeExtensions(Locale& locale, const CharString& value, UErrorCode& errorCode)
+{
+ // Add the unicode extensions to extensions_
+ CharString locale_str("und-u-", errorCode);
+ locale_str.append(value, errorCode);
+ _copyExtensions(
+ Locale::forLanguageTag(locale_str.data(), errorCode), nullptr,
+ locale, false, errorCode);
+}
+
+LocaleBuilder& LocaleBuilder::setExtension(char key, StringPiece value)
+{
+ if (U_FAILURE(status_)) { return *this; }
+ if (!UPRV_ISALPHANUM(key)) {
+ status_ = U_ILLEGAL_ARGUMENT_ERROR;
+ return *this;
+ }
+ CharString value_str(value, status_);
+ if (U_FAILURE(status_)) { return *this; }
+ transform(value_str.data(), value_str.length());
+ if (!value_str.isEmpty() &&
+ !_isExtensionSubtags(key, value_str.data(), value_str.length())) {
+ status_ = U_ILLEGAL_ARGUMENT_ERROR;
+ return *this;
+ }
+ if (extensions_ == nullptr) {
+ extensions_ = new Locale();
+ if (extensions_ == nullptr) {
+ status_ = U_MEMORY_ALLOCATION_ERROR;
+ return *this;
+ }
+ }
+ if (uprv_tolower(key) != 'u') {
+ // for t, x and others extension.
+ extensions_->setKeywordValue(StringPiece(&key, 1), value_str.data(),
+ status_);
+ return *this;
+ }
+ _clearUAttributesAndKeyType(*extensions_, status_);
+ if (U_FAILURE(status_)) { return *this; }
+ if (!value.empty()) {
+ _setUnicodeExtensions(*extensions_, value_str, status_);
+ }
+ return *this;
+}
+
+LocaleBuilder& LocaleBuilder::setUnicodeLocaleKeyword(
+ StringPiece key, StringPiece type)
+{
+ if (U_FAILURE(status_)) { return *this; }
+ if (!ultag_isUnicodeLocaleKey(key.data(), key.length()) ||
+ (!type.empty() &&
+ !ultag_isUnicodeLocaleType(type.data(), type.length()))) {
+ status_ = U_ILLEGAL_ARGUMENT_ERROR;
+ return *this;
+ }
+ if (extensions_ == nullptr) {
+ extensions_ = new Locale();
+ }
+ if (extensions_ == nullptr) {
+ status_ = U_MEMORY_ALLOCATION_ERROR;
+ return *this;
+ }
+ extensions_->setUnicodeKeywordValue(key, type, status_);
+ return *this;
+}
+
+LocaleBuilder& LocaleBuilder::addUnicodeLocaleAttribute(
+ StringPiece value)
+{
+ CharString value_str(value, status_);
+ if (U_FAILURE(status_)) { return *this; }
+ transform(value_str.data(), value_str.length());
+ if (!ultag_isUnicodeLocaleAttribute(value_str.data(), value_str.length())) {
+ status_ = U_ILLEGAL_ARGUMENT_ERROR;
+ return *this;
+ }
+ if (extensions_ == nullptr) {
+ extensions_ = new Locale();
+ if (extensions_ == nullptr) {
+ status_ = U_MEMORY_ALLOCATION_ERROR;
+ return *this;
+ }
+ extensions_->setKeywordValue(kAttributeKey, value_str.data(), status_);
+ return *this;
+ }
+
+ CharString attributes;
+ CharStringByteSink sink(&attributes);
+ UErrorCode localErrorCode = U_ZERO_ERROR;
+ extensions_->getKeywordValue(kAttributeKey, sink, localErrorCode);
+ if (U_FAILURE(localErrorCode)) {
+ CharString new_attributes(value_str.data(), status_);
+ // No attributes, set the attribute.
+ extensions_->setKeywordValue(kAttributeKey, new_attributes.data(), status_);
+ return *this;
+ }
+
+ transform(attributes.data(),attributes.length());
+ const char* start = attributes.data();
+ const char* limit = attributes.data() + attributes.length();
+ CharString new_attributes;
+ bool inserted = false;
+ while (start < limit) {
+ if (!inserted) {
+ int cmp = uprv_strcmp(start, value_str.data());
+ if (cmp == 0) { return *this; } // Found it in attributes: Just return
+ if (cmp > 0) {
+ if (!new_attributes.isEmpty()) new_attributes.append('_', status_);
+ new_attributes.append(value_str.data(), status_);
+ inserted = true;
+ }
+ }
+ if (!new_attributes.isEmpty()) {
+ new_attributes.append('_', status_);
+ }
+ new_attributes.append(start, status_);
+ start += uprv_strlen(start) + 1;
+ }
+ if (!inserted) {
+ if (!new_attributes.isEmpty()) {
+ new_attributes.append('_', status_);
+ }
+ new_attributes.append(value_str.data(), status_);
+ }
+ // Not yet in the attributes, set the attribute.
+ extensions_->setKeywordValue(kAttributeKey, new_attributes.data(), status_);
+ return *this;
+}
+
+LocaleBuilder& LocaleBuilder::removeUnicodeLocaleAttribute(
+ StringPiece value)
+{
+ CharString value_str(value, status_);
+ if (U_FAILURE(status_)) { return *this; }
+ transform(value_str.data(), value_str.length());
+ if (!ultag_isUnicodeLocaleAttribute(value_str.data(), value_str.length())) {
+ status_ = U_ILLEGAL_ARGUMENT_ERROR;
+ return *this;
+ }
+ if (extensions_ == nullptr) { return *this; }
+ UErrorCode localErrorCode = U_ZERO_ERROR;
+ CharString attributes;
+ CharStringByteSink sink(&attributes);
+ extensions_->getKeywordValue(kAttributeKey, sink, localErrorCode);
+ // get failure, just return
+ if (U_FAILURE(localErrorCode)) { return *this; }
+ // Do not have any attributes, just return.
+ if (attributes.isEmpty()) { return *this; }
+
+ char* p = attributes.data();
+ // Replace null terminiator in place for _ and - so later
+ // we can use uprv_strcmp to compare.
+ for (int32_t i = 0; i < attributes.length(); i++, p++) {
+ *p = (*p == '_' || *p == '-') ? '\0' : uprv_tolower(*p);
+ }
+
+ const char* start = attributes.data();
+ const char* limit = attributes.data() + attributes.length();
+ CharString new_attributes;
+ bool found = false;
+ while (start < limit) {
+ if (uprv_strcmp(start, value_str.data()) == 0) {
+ found = true;
+ } else {
+ if (!new_attributes.isEmpty()) {
+ new_attributes.append('_', status_);
+ }
+ new_attributes.append(start, status_);
+ }
+ start += uprv_strlen(start) + 1;
+ }
+ // Found the value in attributes, set the attribute.
+ if (found) {
+ extensions_->setKeywordValue(kAttributeKey, new_attributes.data(), status_);
+ }
+ return *this;
+}
+
+LocaleBuilder& LocaleBuilder::clear()
+{
+ status_ = U_ZERO_ERROR;
+ language_[0] = 0;
+ script_[0] = 0;
+ region_[0] = 0;
+ delete variant_;
+ variant_ = nullptr;
+ clearExtensions();
+ return *this;
+}
+
+LocaleBuilder& LocaleBuilder::clearExtensions()
+{
+ delete extensions_;
+ extensions_ = nullptr;
+ return *this;
+}
+
+Locale makeBogusLocale() {
+ Locale bogus;
+ bogus.setToBogus();
+ return bogus;
+}
+
+void LocaleBuilder::copyExtensionsFrom(const Locale& src, UErrorCode& errorCode)
+{
+ if (U_FAILURE(errorCode)) { return; }
+ LocalPointer<icu::StringEnumeration> keywords(src.createKeywords(errorCode));
+ if (U_FAILURE(errorCode) || keywords.isNull() || keywords->count(errorCode) == 0) {
+ // Error, or no extensions to copy.
+ return;
+ }
+ if (extensions_ == nullptr) {
+ extensions_ = new Locale();
+ if (extensions_ == nullptr) {
+ status_ = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ }
+ _copyExtensions(src, keywords.getAlias(), *extensions_, false, errorCode);
+}
+
+Locale LocaleBuilder::build(UErrorCode& errorCode)
+{
+ if (U_FAILURE(errorCode)) {
+ return makeBogusLocale();
+ }
+ if (U_FAILURE(status_)) {
+ errorCode = status_;
+ return makeBogusLocale();
+ }
+ CharString locale_str(language_, errorCode);
+ if (uprv_strlen(script_) > 0) {
+ locale_str.append('-', errorCode).append(StringPiece(script_), errorCode);
+ }
+ if (uprv_strlen(region_) > 0) {
+ locale_str.append('-', errorCode).append(StringPiece(region_), errorCode);
+ }
+ if (variant_ != nullptr) {
+ locale_str.append('-', errorCode).append(StringPiece(variant_->data()), errorCode);
+ }
+ if (U_FAILURE(errorCode)) {
+ return makeBogusLocale();
+ }
+ Locale product(locale_str.data());
+ if (extensions_ != nullptr) {
+ _copyExtensions(*extensions_, nullptr, product, true, errorCode);
+ }
+ if (U_FAILURE(errorCode)) {
+ return makeBogusLocale();
+ }
+ return product;
+}
+
+UBool LocaleBuilder::copyErrorTo(UErrorCode &outErrorCode) const {
+ if (U_FAILURE(outErrorCode)) {
+ // Do not overwrite the older error code
+ return TRUE;
+ }
+ outErrorCode = status_;
+ return U_FAILURE(outErrorCode);
+}
+
+U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/localematcher.cpp b/contrib/libs/icu/common/localematcher.cpp
index 97fff49b92..85db8c8bf3 100644
--- a/contrib/libs/icu/common/localematcher.cpp
+++ b/contrib/libs/icu/common/localematcher.cpp
@@ -1,794 +1,794 @@
-// © 2019 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html#License
-
-// 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"
-#include "unicode/locid.h"
-#include "unicode/stringpiece.h"
-#include "unicode/uloc.h"
-#include "unicode/uobject.h"
-#include "cstring.h"
-#include "localeprioritylist.h"
-#include "loclikelysubtags.h"
-#include "locdistance.h"
-#include "lsr.h"
-#include "uassert.h"
-#include "uhash.h"
-#include "ustr_imp.h"
-#include "uvector.h"
-
-#define UND_LSR LSR("und", "", "", LSR::EXPLICIT_LSR)
-
-/**
- * Indicator for the lifetime of desired-locale objects passed into the LocaleMatcher.
- *
- * @draft ICU 65
- */
-enum ULocMatchLifetime {
- /**
- * Locale objects are temporary.
- * The matcher will make a copy of a locale that will be used beyond one function call.
- *
- * @draft ICU 65
- */
- ULOCMATCH_TEMPORARY_LOCALES,
- /**
- * Locale objects are stored at least as long as the matcher is used.
- * The matcher will keep only a pointer to a locale that will be used beyond one function call,
- * avoiding a copy.
- *
- * @draft ICU 65
- */
- ULOCMATCH_STORED_LOCALES // TODO: permanent? cached? clone?
-};
-#ifndef U_IN_DOXYGEN
-typedef enum ULocMatchLifetime ULocMatchLifetime;
-#endif
-
-U_NAMESPACE_BEGIN
-
-LocaleMatcher::Result::Result(LocaleMatcher::Result &&src) U_NOEXCEPT :
- desiredLocale(src.desiredLocale),
- supportedLocale(src.supportedLocale),
- desiredIndex(src.desiredIndex),
- supportedIndex(src.supportedIndex),
- desiredIsOwned(src.desiredIsOwned) {
- if (desiredIsOwned) {
- src.desiredLocale = nullptr;
- src.desiredIndex = -1;
- src.desiredIsOwned = FALSE;
- }
-}
-
-LocaleMatcher::Result::~Result() {
- if (desiredIsOwned) {
- delete desiredLocale;
- }
-}
-
-LocaleMatcher::Result &LocaleMatcher::Result::operator=(LocaleMatcher::Result &&src) U_NOEXCEPT {
- this->~Result();
-
- desiredLocale = src.desiredLocale;
- supportedLocale = src.supportedLocale;
- desiredIndex = src.desiredIndex;
- supportedIndex = src.supportedIndex;
- desiredIsOwned = src.desiredIsOwned;
-
- if (desiredIsOwned) {
- src.desiredLocale = nullptr;
- src.desiredIndex = -1;
- src.desiredIsOwned = FALSE;
- }
- return *this;
-}
-
-Locale LocaleMatcher::Result::makeResolvedLocale(UErrorCode &errorCode) const {
- if (U_FAILURE(errorCode) || supportedLocale == nullptr) {
- return Locale::getRoot();
- }
- const Locale *bestDesired = getDesiredLocale();
- if (bestDesired == nullptr || *supportedLocale == *bestDesired) {
- return *supportedLocale;
- }
- LocaleBuilder b;
- b.setLocale(*supportedLocale);
-
- // Copy the region from bestDesired, if there is one.
- const char *region = bestDesired->getCountry();
- if (*region != 0) {
- b.setRegion(region);
- }
-
- // Copy the variants from bestDesired, if there are any.
- // Note that this will override any supportedLocale variants.
- // For example, "sco-ulster-fonipa" + "...-fonupa" => "sco-fonupa" (replacing ulster).
- const char *variants = bestDesired->getVariant();
- if (*variants != 0) {
- b.setVariant(variants);
- }
-
- // Copy the extensions from bestDesired, if there are any.
- // C++ note: The following note, copied from Java, may not be true,
- // as long as C++ copies by legacy ICU keyword, not by extension singleton.
- // Note that this will override any supportedLocale extensions.
- // For example, "th-u-nu-latn-ca-buddhist" + "...-u-nu-native" => "th-u-nu-native"
- // (replacing calendar).
- b.copyExtensionsFrom(*bestDesired, errorCode);
- return b.build(errorCode);
-}
-
-LocaleMatcher::Builder::Builder(LocaleMatcher::Builder &&src) U_NOEXCEPT :
- errorCode_(src.errorCode_),
- supportedLocales_(src.supportedLocales_),
- thresholdDistance_(src.thresholdDistance_),
- demotion_(src.demotion_),
- defaultLocale_(src.defaultLocale_),
- favor_(src.favor_),
- direction_(src.direction_) {
- src.supportedLocales_ = nullptr;
- src.defaultLocale_ = nullptr;
-}
-
-LocaleMatcher::Builder::~Builder() {
- delete supportedLocales_;
- delete defaultLocale_;
-}
-
-LocaleMatcher::Builder &LocaleMatcher::Builder::operator=(LocaleMatcher::Builder &&src) U_NOEXCEPT {
- this->~Builder();
-
- errorCode_ = src.errorCode_;
- supportedLocales_ = src.supportedLocales_;
- thresholdDistance_ = src.thresholdDistance_;
- demotion_ = src.demotion_;
- defaultLocale_ = src.defaultLocale_;
- favor_ = src.favor_;
- direction_ = src.direction_;
-
- src.supportedLocales_ = nullptr;
- src.defaultLocale_ = nullptr;
- return *this;
-}
-
-void LocaleMatcher::Builder::clearSupportedLocales() {
- if (supportedLocales_ != nullptr) {
- supportedLocales_->removeAllElements();
- }
-}
-
-bool LocaleMatcher::Builder::ensureSupportedLocaleVector() {
- if (U_FAILURE(errorCode_)) { return false; }
- if (supportedLocales_ != nullptr) { return true; }
- supportedLocales_ = new UVector(uprv_deleteUObject, nullptr, errorCode_);
- if (U_FAILURE(errorCode_)) { return false; }
- if (supportedLocales_ == nullptr) {
- errorCode_ = U_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- return true;
-}
-
-LocaleMatcher::Builder &LocaleMatcher::Builder::setSupportedLocalesFromListString(
- StringPiece locales) {
- LocalePriorityList list(locales, errorCode_);
- if (U_FAILURE(errorCode_)) { return *this; }
- clearSupportedLocales();
- if (!ensureSupportedLocaleVector()) { return *this; }
- int32_t length = list.getLengthIncludingRemoved();
- for (int32_t i = 0; i < length; ++i) {
- Locale *locale = list.orphanLocaleAt(i);
- if (locale == nullptr) { continue; }
- supportedLocales_->addElement(locale, errorCode_);
- if (U_FAILURE(errorCode_)) {
- delete locale;
- break;
- }
- }
- return *this;
-}
-
-LocaleMatcher::Builder &LocaleMatcher::Builder::setSupportedLocales(Locale::Iterator &locales) {
- if (U_FAILURE(errorCode_)) { return *this; }
- clearSupportedLocales();
- if (!ensureSupportedLocaleVector()) { return *this; }
- while (locales.hasNext()) {
- const Locale &locale = locales.next();
- Locale *clone = locale.clone();
- if (clone == nullptr) {
- errorCode_ = U_MEMORY_ALLOCATION_ERROR;
- break;
- }
- supportedLocales_->addElement(clone, errorCode_);
- if (U_FAILURE(errorCode_)) {
- delete clone;
- break;
- }
- }
- return *this;
-}
-
-LocaleMatcher::Builder &LocaleMatcher::Builder::addSupportedLocale(const Locale &locale) {
- if (!ensureSupportedLocaleVector()) { return *this; }
- Locale *clone = locale.clone();
- if (clone == nullptr) {
- errorCode_ = U_MEMORY_ALLOCATION_ERROR;
- return *this;
- }
- supportedLocales_->addElement(clone, errorCode_);
- if (U_FAILURE(errorCode_)) {
- delete clone;
- }
- return *this;
-}
-
-LocaleMatcher::Builder &LocaleMatcher::Builder::setDefaultLocale(const Locale *defaultLocale) {
- if (U_FAILURE(errorCode_)) { return *this; }
- Locale *clone = nullptr;
- if (defaultLocale != nullptr) {
- clone = defaultLocale->clone();
- if (clone == nullptr) {
- errorCode_ = U_MEMORY_ALLOCATION_ERROR;
- return *this;
- }
- }
- delete defaultLocale_;
- defaultLocale_ = clone;
- return *this;
-}
-
-LocaleMatcher::Builder &LocaleMatcher::Builder::setFavorSubtag(ULocMatchFavorSubtag subtag) {
- if (U_FAILURE(errorCode_)) { return *this; }
- favor_ = subtag;
- return *this;
-}
-
-LocaleMatcher::Builder &LocaleMatcher::Builder::setDemotionPerDesiredLocale(ULocMatchDemotion demotion) {
- if (U_FAILURE(errorCode_)) { return *this; }
- demotion_ = demotion;
- return *this;
-}
-
-#if 0
-/**
- * <i>Internal only!</i>
- *
- * @param thresholdDistance the thresholdDistance to set, with -1 = default
- * @return this Builder object
- * @internal
- * @deprecated This API is ICU internal only.
- */
-@Deprecated
-LocaleMatcher::Builder &LocaleMatcher::Builder::internalSetThresholdDistance(int32_t thresholdDistance) {
- if (U_FAILURE(errorCode_)) { return *this; }
- if (thresholdDistance > 100) {
- thresholdDistance = 100;
- }
- thresholdDistance_ = thresholdDistance;
- return *this;
-}
-#endif
-
-UBool LocaleMatcher::Builder::copyErrorTo(UErrorCode &outErrorCode) const {
- if (U_FAILURE(outErrorCode)) { return TRUE; }
- if (U_SUCCESS(errorCode_)) { return FALSE; }
- outErrorCode = errorCode_;
- return TRUE;
-}
-
-LocaleMatcher LocaleMatcher::Builder::build(UErrorCode &errorCode) const {
- if (U_SUCCESS(errorCode) && U_FAILURE(errorCode_)) {
- errorCode = errorCode_;
- }
- return LocaleMatcher(*this, errorCode);
-}
-
-namespace {
-
-LSR getMaximalLsrOrUnd(const XLikelySubtags &likelySubtags, const Locale &locale,
- UErrorCode &errorCode) {
- if (U_FAILURE(errorCode) || locale.isBogus() || *locale.getName() == 0 /* "und" */) {
- return UND_LSR;
- } else {
- return likelySubtags.makeMaximizedLsrFrom(locale, errorCode);
- }
-}
-
-int32_t hashLSR(const UHashTok token) {
- const LSR *lsr = static_cast<const LSR *>(token.pointer);
- return lsr->hashCode;
-}
-
-UBool compareLSRs(const UHashTok t1, const UHashTok t2) {
- const LSR *lsr1 = static_cast<const LSR *>(t1.pointer);
- const LSR *lsr2 = static_cast<const LSR *>(t2.pointer);
- return *lsr1 == *lsr2;
-}
-
-} // namespace
-
-int32_t LocaleMatcher::putIfAbsent(const LSR &lsr, int32_t i, int32_t suppLength,
- UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) { return suppLength; }
- int32_t index = uhash_geti(supportedLsrToIndex, &lsr);
- if (index == 0) {
- uhash_puti(supportedLsrToIndex, const_cast<LSR *>(&lsr), i + 1, &errorCode);
- if (U_SUCCESS(errorCode)) {
- supportedLSRs[suppLength] = &lsr;
- supportedIndexes[suppLength++] = i;
- }
- }
- return suppLength;
-}
-
-LocaleMatcher::LocaleMatcher(const Builder &builder, UErrorCode &errorCode) :
- likelySubtags(*XLikelySubtags::getSingleton(errorCode)),
- localeDistance(*LocaleDistance::getSingleton(errorCode)),
- thresholdDistance(builder.thresholdDistance_),
- demotionPerDesiredLocale(0),
- favorSubtag(builder.favor_),
- direction(builder.direction_),
- supportedLocales(nullptr), lsrs(nullptr), supportedLocalesLength(0),
- supportedLsrToIndex(nullptr),
- 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;
- if (def != nullptr) {
- ownedDefaultLocale = def->clone();
- if (ownedDefaultLocale == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- def = ownedDefaultLocale;
- builderDefaultLSR = getMaximalLsrOrUnd(likelySubtags, *def, errorCode);
- if (U_FAILURE(errorCode)) { return; }
- defLSR = &builderDefaultLSR;
- }
- supportedLocalesLength = builder.supportedLocales_ != nullptr ?
- builder.supportedLocales_->size() : 0;
- if (supportedLocalesLength > 0) {
- // Store the supported locales in input order,
- // so that when different types are used (e.g., language tag strings)
- // we can return those by parallel index.
- supportedLocales = static_cast<const Locale **>(
- uprv_malloc(supportedLocalesLength * sizeof(const Locale *)));
- // Supported LRSs in input order.
- // In C++, we store these permanently to simplify ownership management
- // in the hash tables. Duplicate LSRs (if any) are unused overhead.
- lsrs = new LSR[supportedLocalesLength];
- if (supportedLocales == nullptr || lsrs == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- // If the constructor fails partway, we need null pointers for destructibility.
- uprv_memset(supportedLocales, 0, supportedLocalesLength * sizeof(const Locale *));
- for (int32_t i = 0; i < supportedLocalesLength; ++i) {
- const Locale &locale = *static_cast<Locale *>(builder.supportedLocales_->elementAt(i));
- supportedLocales[i] = locale.clone();
- if (supportedLocales[i] == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- const Locale &supportedLocale = *supportedLocales[i];
- LSR &lsr = lsrs[i] = getMaximalLsrOrUnd(likelySubtags, supportedLocale, errorCode);
- lsr.setHashCode();
- if (U_FAILURE(errorCode)) { return; }
- }
-
- // We need an unordered map from LSR to first supported locale with that LSR,
- // and an ordered list of (LSR, supported index) for
- // the supported locales in the following order:
- // 1. Default locale, if it is supported.
- // 2. Priority locales (aka "paradigm locales") in builder order.
- // 3. Remaining locales in builder order.
- supportedLsrToIndex = uhash_openSize(hashLSR, compareLSRs, uhash_compareLong,
- supportedLocalesLength, &errorCode);
- if (U_FAILURE(errorCode)) { return; }
- supportedLSRs = static_cast<const LSR **>(
- uprv_malloc(supportedLocalesLength * sizeof(const LSR *)));
- supportedIndexes = static_cast<int32_t *>(
- uprv_malloc(supportedLocalesLength * sizeof(int32_t)));
- if (supportedLSRs == nullptr || supportedIndexes == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- 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;
- }
- 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) {
- U_ASSERT(i == 0);
- def = &locale;
- defLSR = &lsr;
- order[i] = 1;
- suppLength = putIfAbsent(lsr, 0, suppLength, errorCode);
- } else if (lsr.isEquivalentTo(*defLSR)) {
- order[i] = 1;
- suppLength = putIfAbsent(lsr, i, suppLength, errorCode);
- } else if (localeDistance.isParadigmLSR(lsr)) {
- order[i] = 2;
- ++numParadigms;
- } else {
- order[i] = 3;
- }
- if (U_FAILURE(errorCode)) { return; }
- }
- // Add supported paradigm locales.
- int32_t paradigmLimit = suppLength + numParadigms;
- for (int32_t i = 0; i < supportedLocalesLength && suppLength < paradigmLimit; ++i) {
- if (order[i] == 2) {
- suppLength = putIfAbsent(lsrs[i], i, suppLength, errorCode);
- }
- }
- // Add remaining supported locales.
- for (int32_t i = 0; i < supportedLocalesLength; ++i) {
- if (order[i] == 3) {
- suppLength = putIfAbsent(lsrs[i], i, suppLength, errorCode);
- }
- }
- supportedLSRsLength = suppLength;
- // If supportedLSRsLength < supportedLocalesLength then
- // we waste as many array slots as there are duplicate supported LSRs,
- // but the amount of wasted space is small as long as there are few duplicates.
- }
-
- defaultLocale = def;
-
- if (builder.demotion_ == ULOCMATCH_DEMOTION_REGION) {
- demotionPerDesiredLocale = localeDistance.getDefaultDemotionPerDesiredLocale();
- }
-}
-
-LocaleMatcher::LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT :
- likelySubtags(src.likelySubtags),
- localeDistance(src.localeDistance),
- thresholdDistance(src.thresholdDistance),
- demotionPerDesiredLocale(src.demotionPerDesiredLocale),
- favorSubtag(src.favorSubtag),
- direction(src.direction),
- supportedLocales(src.supportedLocales), lsrs(src.lsrs),
- supportedLocalesLength(src.supportedLocalesLength),
- supportedLsrToIndex(src.supportedLsrToIndex),
- supportedLSRs(src.supportedLSRs),
- supportedIndexes(src.supportedIndexes),
- supportedLSRsLength(src.supportedLSRsLength),
- ownedDefaultLocale(src.ownedDefaultLocale), defaultLocale(src.defaultLocale) {
- src.supportedLocales = nullptr;
- src.lsrs = nullptr;
- src.supportedLocalesLength = 0;
- src.supportedLsrToIndex = nullptr;
- src.supportedLSRs = nullptr;
- src.supportedIndexes = nullptr;
- src.supportedLSRsLength = 0;
- src.ownedDefaultLocale = nullptr;
- src.defaultLocale = nullptr;
-}
-
-LocaleMatcher::~LocaleMatcher() {
- for (int32_t i = 0; i < supportedLocalesLength; ++i) {
- delete supportedLocales[i];
- }
- uprv_free(supportedLocales);
- delete[] lsrs;
- uhash_close(supportedLsrToIndex);
- uprv_free(supportedLSRs);
- uprv_free(supportedIndexes);
- delete ownedDefaultLocale;
-}
-
-LocaleMatcher &LocaleMatcher::operator=(LocaleMatcher &&src) U_NOEXCEPT {
- this->~LocaleMatcher();
-
- thresholdDistance = src.thresholdDistance;
- demotionPerDesiredLocale = src.demotionPerDesiredLocale;
- favorSubtag = src.favorSubtag;
- direction = src.direction;
- supportedLocales = src.supportedLocales;
- lsrs = src.lsrs;
- supportedLocalesLength = src.supportedLocalesLength;
- supportedLsrToIndex = src.supportedLsrToIndex;
- supportedLSRs = src.supportedLSRs;
- supportedIndexes = src.supportedIndexes;
- supportedLSRsLength = src.supportedLSRsLength;
- ownedDefaultLocale = src.ownedDefaultLocale;
- defaultLocale = src.defaultLocale;
-
- src.supportedLocales = nullptr;
- src.lsrs = nullptr;
- src.supportedLocalesLength = 0;
- src.supportedLsrToIndex = nullptr;
- src.supportedLSRs = nullptr;
- src.supportedIndexes = nullptr;
- src.supportedLSRsLength = 0;
- src.ownedDefaultLocale = nullptr;
- src.defaultLocale = nullptr;
- return *this;
-}
-
-class LocaleLsrIterator {
-public:
- LocaleLsrIterator(const XLikelySubtags &likelySubtags, Locale::Iterator &locales,
- ULocMatchLifetime lifetime) :
- likelySubtags(likelySubtags), locales(locales), lifetime(lifetime) {}
-
- ~LocaleLsrIterator() {
- if (lifetime == ULOCMATCH_TEMPORARY_LOCALES) {
- delete remembered;
- }
- }
-
- bool hasNext() const {
- return locales.hasNext();
- }
-
- LSR next(UErrorCode &errorCode) {
- current = &locales.next();
- return getMaximalLsrOrUnd(likelySubtags, *current, errorCode);
- }
-
- void rememberCurrent(int32_t desiredIndex, UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) { return; }
- bestDesiredIndex = desiredIndex;
- if (lifetime == ULOCMATCH_STORED_LOCALES) {
- remembered = current;
- } else {
- // ULOCMATCH_TEMPORARY_LOCALES
- delete remembered;
- remembered = new Locale(*current);
- if (remembered == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- }
- }
- }
-
- const Locale *orphanRemembered() {
- const Locale *rem = remembered;
- remembered = nullptr;
- return rem;
- }
-
- int32_t getBestDesiredIndex() const {
- return bestDesiredIndex;
- }
-
-private:
- const XLikelySubtags &likelySubtags;
- Locale::Iterator &locales;
- ULocMatchLifetime lifetime;
- const Locale *current = nullptr, *remembered = nullptr;
- int32_t bestDesiredIndex = -1;
-};
-
-const Locale *LocaleMatcher::getBestMatch(const Locale &desiredLocale, UErrorCode &errorCode) const {
- if (U_FAILURE(errorCode)) { return nullptr; }
- int32_t suppIndex = getBestSuppIndex(
- getMaximalLsrOrUnd(likelySubtags, desiredLocale, errorCode),
- nullptr, errorCode);
- return U_SUCCESS(errorCode) && suppIndex >= 0 ? supportedLocales[suppIndex] : defaultLocale;
-}
-
-const Locale *LocaleMatcher::getBestMatch(Locale::Iterator &desiredLocales,
- UErrorCode &errorCode) const {
- if (U_FAILURE(errorCode)) { return nullptr; }
- if (!desiredLocales.hasNext()) {
- return defaultLocale;
- }
- LocaleLsrIterator lsrIter(likelySubtags, desiredLocales, ULOCMATCH_TEMPORARY_LOCALES);
- int32_t suppIndex = getBestSuppIndex(lsrIter.next(errorCode), &lsrIter, errorCode);
- return U_SUCCESS(errorCode) && suppIndex >= 0 ? supportedLocales[suppIndex] : defaultLocale;
-}
-
-const Locale *LocaleMatcher::getBestMatchForListString(
- StringPiece desiredLocaleList, UErrorCode &errorCode) const {
- LocalePriorityList list(desiredLocaleList, errorCode);
- LocalePriorityList::Iterator iter = list.iterator();
- return getBestMatch(iter, errorCode);
-}
-
-LocaleMatcher::Result LocaleMatcher::getBestMatchResult(
- const Locale &desiredLocale, UErrorCode &errorCode) const {
- if (U_FAILURE(errorCode)) {
- return Result(nullptr, defaultLocale, -1, -1, FALSE);
- }
- int32_t suppIndex = getBestSuppIndex(
- getMaximalLsrOrUnd(likelySubtags, desiredLocale, errorCode),
- nullptr, errorCode);
- if (U_FAILURE(errorCode) || suppIndex < 0) {
- return Result(nullptr, defaultLocale, -1, -1, FALSE);
- } else {
- return Result(&desiredLocale, supportedLocales[suppIndex], 0, suppIndex, FALSE);
- }
-}
-
-LocaleMatcher::Result LocaleMatcher::getBestMatchResult(
- Locale::Iterator &desiredLocales, UErrorCode &errorCode) const {
- if (U_FAILURE(errorCode) || !desiredLocales.hasNext()) {
- return Result(nullptr, defaultLocale, -1, -1, FALSE);
- }
- LocaleLsrIterator lsrIter(likelySubtags, desiredLocales, ULOCMATCH_TEMPORARY_LOCALES);
- int32_t suppIndex = getBestSuppIndex(lsrIter.next(errorCode), &lsrIter, errorCode);
- if (U_FAILURE(errorCode) || suppIndex < 0) {
- return Result(nullptr, defaultLocale, -1, -1, FALSE);
- } else {
- return Result(lsrIter.orphanRemembered(), supportedLocales[suppIndex],
- lsrIter.getBestDesiredIndex(), suppIndex, TRUE);
- }
-}
-
-int32_t LocaleMatcher::getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remainingIter,
- UErrorCode &errorCode) const {
- if (U_FAILURE(errorCode)) { return -1; }
- int32_t desiredIndex = 0;
- int32_t bestSupportedLsrIndex = -1;
- for (int32_t bestShiftedDistance = LocaleDistance::shiftDistance(thresholdDistance);;) {
- // Quick check for exact maximized LSR.
- // Returns suppIndex+1 where 0 means not found.
- if (supportedLsrToIndex != nullptr) {
- desiredLSR.setHashCode();
- int32_t index = uhash_geti(supportedLsrToIndex, &desiredLSR);
- if (index != 0) {
- int32_t suppIndex = index - 1;
- if (remainingIter != nullptr) {
- remainingIter->rememberCurrent(desiredIndex, errorCode);
- }
- return suppIndex;
- }
- }
- int32_t bestIndexAndDistance = localeDistance.getBestIndexAndDistance(
- desiredLSR, supportedLSRs, supportedLSRsLength,
- bestShiftedDistance, favorSubtag, direction);
- if (bestIndexAndDistance >= 0) {
- bestShiftedDistance = LocaleDistance::getShiftedDistance(bestIndexAndDistance);
- if (remainingIter != nullptr) {
- remainingIter->rememberCurrent(desiredIndex, errorCode);
- if (U_FAILURE(errorCode)) { return -1; }
- }
- bestSupportedLsrIndex = LocaleDistance::getIndex(bestIndexAndDistance);
- }
- if ((bestShiftedDistance -= LocaleDistance::shiftDistance(demotionPerDesiredLocale)) <= 0) {
- break;
- }
- if (remainingIter == nullptr || !remainingIter->hasNext()) {
- break;
- }
- desiredLSR = remainingIter->next(errorCode);
- if (U_FAILURE(errorCode)) { return -1; }
- ++desiredIndex;
- }
- if (bestSupportedLsrIndex < 0) {
- // no good match
- return -1;
- }
- return supportedIndexes[bestSupportedLsrIndex];
-}
-
-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);
- 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);
- double distance = LocaleDistance::getDistanceDouble(indexAndDistance);
- return (100.0 - distance) / 100.0;
-}
-
-U_NAMESPACE_END
-
-// uloc_acceptLanguage() --------------------------------------------------- ***
-
-U_NAMESPACE_USE
-
-namespace {
-
-class LocaleFromTag {
-public:
- LocaleFromTag() : locale(Locale::getRoot()) {}
- const Locale &operator()(const char *tag) { return locale = Locale(tag); }
-
-private:
- // Store the locale in the converter, rather than return a reference to a temporary,
- // or a value which could go out of scope with the caller's reference to it.
- Locale locale;
-};
-
-int32_t acceptLanguage(UEnumeration &supportedLocales, Locale::Iterator &desiredLocales,
- char *dest, int32_t capacity, UAcceptResult *acceptResult,
- UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) { return 0; }
- LocaleMatcher::Builder builder;
- const char *locString;
- while ((locString = uenum_next(&supportedLocales, nullptr, &errorCode)) != nullptr) {
- Locale loc(locString);
- if (loc.isBogus()) {
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
- builder.addSupportedLocale(loc);
- }
- LocaleMatcher matcher = builder.build(errorCode);
- LocaleMatcher::Result result = matcher.getBestMatchResult(desiredLocales, errorCode);
- if (U_FAILURE(errorCode)) { return 0; }
- if (result.getDesiredIndex() >= 0) {
- if (acceptResult != nullptr) {
- *acceptResult = *result.getDesiredLocale() == *result.getSupportedLocale() ?
- ULOC_ACCEPT_VALID : ULOC_ACCEPT_FALLBACK;
- }
- const char *bestStr = result.getSupportedLocale()->getName();
- int32_t bestLength = (int32_t)uprv_strlen(bestStr);
- if (bestLength <= capacity) {
- uprv_memcpy(dest, bestStr, bestLength);
- }
- return u_terminateChars(dest, capacity, bestLength, &errorCode);
- } else {
- if (acceptResult != nullptr) {
- *acceptResult = ULOC_ACCEPT_FAILED;
- }
- return u_terminateChars(dest, capacity, 0, &errorCode);
- }
-}
-
-} // namespace
-
-U_CAPI int32_t U_EXPORT2
-uloc_acceptLanguage(char *result, int32_t resultAvailable,
- UAcceptResult *outResult,
- const char **acceptList, int32_t acceptListCount,
- UEnumeration *availableLocales,
- UErrorCode *status) {
- if (U_FAILURE(*status)) { return 0; }
- if ((result == nullptr ? resultAvailable != 0 : resultAvailable < 0) ||
- (acceptList == nullptr ? acceptListCount != 0 : acceptListCount < 0) ||
- availableLocales == nullptr) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
- LocaleFromTag converter;
- Locale::ConvertingIterator<const char **, LocaleFromTag> desiredLocales(
- acceptList, acceptList + acceptListCount, converter);
- return acceptLanguage(*availableLocales, desiredLocales,
- result, resultAvailable, outResult, *status);
-}
-
-U_CAPI int32_t U_EXPORT2
-uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable,
- UAcceptResult *outResult,
- const char *httpAcceptLanguage,
- UEnumeration *availableLocales,
- UErrorCode *status) {
- if (U_FAILURE(*status)) { return 0; }
- if ((result == nullptr ? resultAvailable != 0 : resultAvailable < 0) ||
- httpAcceptLanguage == nullptr || availableLocales == nullptr) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
- LocalePriorityList list(httpAcceptLanguage, *status);
- LocalePriorityList::Iterator desiredLocales = list.iterator();
- return acceptLanguage(*availableLocales, desiredLocales,
- result, resultAvailable, outResult, *status);
-}
-
-#endif // __LOCMATCHER_H__
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// 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"
+#include "unicode/locid.h"
+#include "unicode/stringpiece.h"
+#include "unicode/uloc.h"
+#include "unicode/uobject.h"
+#include "cstring.h"
+#include "localeprioritylist.h"
+#include "loclikelysubtags.h"
+#include "locdistance.h"
+#include "lsr.h"
+#include "uassert.h"
+#include "uhash.h"
+#include "ustr_imp.h"
+#include "uvector.h"
+
+#define UND_LSR LSR("und", "", "", LSR::EXPLICIT_LSR)
+
+/**
+ * Indicator for the lifetime of desired-locale objects passed into the LocaleMatcher.
+ *
+ * @draft ICU 65
+ */
+enum ULocMatchLifetime {
+ /**
+ * Locale objects are temporary.
+ * The matcher will make a copy of a locale that will be used beyond one function call.
+ *
+ * @draft ICU 65
+ */
+ ULOCMATCH_TEMPORARY_LOCALES,
+ /**
+ * Locale objects are stored at least as long as the matcher is used.
+ * The matcher will keep only a pointer to a locale that will be used beyond one function call,
+ * avoiding a copy.
+ *
+ * @draft ICU 65
+ */
+ ULOCMATCH_STORED_LOCALES // TODO: permanent? cached? clone?
+};
+#ifndef U_IN_DOXYGEN
+typedef enum ULocMatchLifetime ULocMatchLifetime;
+#endif
+
+U_NAMESPACE_BEGIN
+
+LocaleMatcher::Result::Result(LocaleMatcher::Result &&src) U_NOEXCEPT :
+ desiredLocale(src.desiredLocale),
+ supportedLocale(src.supportedLocale),
+ desiredIndex(src.desiredIndex),
+ supportedIndex(src.supportedIndex),
+ desiredIsOwned(src.desiredIsOwned) {
+ if (desiredIsOwned) {
+ src.desiredLocale = nullptr;
+ src.desiredIndex = -1;
+ src.desiredIsOwned = FALSE;
+ }
+}
+
+LocaleMatcher::Result::~Result() {
+ if (desiredIsOwned) {
+ delete desiredLocale;
+ }
+}
+
+LocaleMatcher::Result &LocaleMatcher::Result::operator=(LocaleMatcher::Result &&src) U_NOEXCEPT {
+ this->~Result();
+
+ desiredLocale = src.desiredLocale;
+ supportedLocale = src.supportedLocale;
+ desiredIndex = src.desiredIndex;
+ supportedIndex = src.supportedIndex;
+ desiredIsOwned = src.desiredIsOwned;
+
+ if (desiredIsOwned) {
+ src.desiredLocale = nullptr;
+ src.desiredIndex = -1;
+ src.desiredIsOwned = FALSE;
+ }
+ return *this;
+}
+
+Locale LocaleMatcher::Result::makeResolvedLocale(UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode) || supportedLocale == nullptr) {
+ return Locale::getRoot();
+ }
+ const Locale *bestDesired = getDesiredLocale();
+ if (bestDesired == nullptr || *supportedLocale == *bestDesired) {
+ return *supportedLocale;
+ }
+ LocaleBuilder b;
+ b.setLocale(*supportedLocale);
+
+ // Copy the region from bestDesired, if there is one.
+ const char *region = bestDesired->getCountry();
+ if (*region != 0) {
+ b.setRegion(region);
+ }
+
+ // Copy the variants from bestDesired, if there are any.
+ // Note that this will override any supportedLocale variants.
+ // For example, "sco-ulster-fonipa" + "...-fonupa" => "sco-fonupa" (replacing ulster).
+ const char *variants = bestDesired->getVariant();
+ if (*variants != 0) {
+ b.setVariant(variants);
+ }
+
+ // Copy the extensions from bestDesired, if there are any.
+ // C++ note: The following note, copied from Java, may not be true,
+ // as long as C++ copies by legacy ICU keyword, not by extension singleton.
+ // Note that this will override any supportedLocale extensions.
+ // For example, "th-u-nu-latn-ca-buddhist" + "...-u-nu-native" => "th-u-nu-native"
+ // (replacing calendar).
+ b.copyExtensionsFrom(*bestDesired, errorCode);
+ return b.build(errorCode);
+}
+
+LocaleMatcher::Builder::Builder(LocaleMatcher::Builder &&src) U_NOEXCEPT :
+ errorCode_(src.errorCode_),
+ supportedLocales_(src.supportedLocales_),
+ thresholdDistance_(src.thresholdDistance_),
+ demotion_(src.demotion_),
+ defaultLocale_(src.defaultLocale_),
+ favor_(src.favor_),
+ direction_(src.direction_) {
+ src.supportedLocales_ = nullptr;
+ src.defaultLocale_ = nullptr;
+}
+
+LocaleMatcher::Builder::~Builder() {
+ delete supportedLocales_;
+ delete defaultLocale_;
+}
+
+LocaleMatcher::Builder &LocaleMatcher::Builder::operator=(LocaleMatcher::Builder &&src) U_NOEXCEPT {
+ this->~Builder();
+
+ errorCode_ = src.errorCode_;
+ supportedLocales_ = src.supportedLocales_;
+ thresholdDistance_ = src.thresholdDistance_;
+ demotion_ = src.demotion_;
+ defaultLocale_ = src.defaultLocale_;
+ favor_ = src.favor_;
+ direction_ = src.direction_;
+
+ src.supportedLocales_ = nullptr;
+ src.defaultLocale_ = nullptr;
+ return *this;
+}
+
+void LocaleMatcher::Builder::clearSupportedLocales() {
+ if (supportedLocales_ != nullptr) {
+ supportedLocales_->removeAllElements();
+ }
+}
+
+bool LocaleMatcher::Builder::ensureSupportedLocaleVector() {
+ if (U_FAILURE(errorCode_)) { return false; }
+ if (supportedLocales_ != nullptr) { return true; }
+ supportedLocales_ = new UVector(uprv_deleteUObject, nullptr, errorCode_);
+ if (U_FAILURE(errorCode_)) { return false; }
+ if (supportedLocales_ == nullptr) {
+ errorCode_ = U_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ return true;
+}
+
+LocaleMatcher::Builder &LocaleMatcher::Builder::setSupportedLocalesFromListString(
+ StringPiece locales) {
+ LocalePriorityList list(locales, errorCode_);
+ if (U_FAILURE(errorCode_)) { return *this; }
+ clearSupportedLocales();
+ if (!ensureSupportedLocaleVector()) { return *this; }
+ int32_t length = list.getLengthIncludingRemoved();
+ for (int32_t i = 0; i < length; ++i) {
+ Locale *locale = list.orphanLocaleAt(i);
+ if (locale == nullptr) { continue; }
+ supportedLocales_->addElement(locale, errorCode_);
+ if (U_FAILURE(errorCode_)) {
+ delete locale;
+ break;
+ }
+ }
+ return *this;
+}
+
+LocaleMatcher::Builder &LocaleMatcher::Builder::setSupportedLocales(Locale::Iterator &locales) {
+ if (U_FAILURE(errorCode_)) { return *this; }
+ clearSupportedLocales();
+ if (!ensureSupportedLocaleVector()) { return *this; }
+ while (locales.hasNext()) {
+ const Locale &locale = locales.next();
+ Locale *clone = locale.clone();
+ if (clone == nullptr) {
+ errorCode_ = U_MEMORY_ALLOCATION_ERROR;
+ break;
+ }
+ supportedLocales_->addElement(clone, errorCode_);
+ if (U_FAILURE(errorCode_)) {
+ delete clone;
+ break;
+ }
+ }
+ return *this;
+}
+
+LocaleMatcher::Builder &LocaleMatcher::Builder::addSupportedLocale(const Locale &locale) {
+ if (!ensureSupportedLocaleVector()) { return *this; }
+ Locale *clone = locale.clone();
+ if (clone == nullptr) {
+ errorCode_ = U_MEMORY_ALLOCATION_ERROR;
+ return *this;
+ }
+ supportedLocales_->addElement(clone, errorCode_);
+ if (U_FAILURE(errorCode_)) {
+ delete clone;
+ }
+ return *this;
+}
+
+LocaleMatcher::Builder &LocaleMatcher::Builder::setDefaultLocale(const Locale *defaultLocale) {
+ if (U_FAILURE(errorCode_)) { return *this; }
+ Locale *clone = nullptr;
+ if (defaultLocale != nullptr) {
+ clone = defaultLocale->clone();
+ if (clone == nullptr) {
+ errorCode_ = U_MEMORY_ALLOCATION_ERROR;
+ return *this;
+ }
+ }
+ delete defaultLocale_;
+ defaultLocale_ = clone;
+ return *this;
+}
+
+LocaleMatcher::Builder &LocaleMatcher::Builder::setFavorSubtag(ULocMatchFavorSubtag subtag) {
+ if (U_FAILURE(errorCode_)) { return *this; }
+ favor_ = subtag;
+ return *this;
+}
+
+LocaleMatcher::Builder &LocaleMatcher::Builder::setDemotionPerDesiredLocale(ULocMatchDemotion demotion) {
+ if (U_FAILURE(errorCode_)) { return *this; }
+ demotion_ = demotion;
+ return *this;
+}
+
+#if 0
+/**
+ * <i>Internal only!</i>
+ *
+ * @param thresholdDistance the thresholdDistance to set, with -1 = default
+ * @return this Builder object
+ * @internal
+ * @deprecated This API is ICU internal only.
+ */
+@Deprecated
+LocaleMatcher::Builder &LocaleMatcher::Builder::internalSetThresholdDistance(int32_t thresholdDistance) {
+ if (U_FAILURE(errorCode_)) { return *this; }
+ if (thresholdDistance > 100) {
+ thresholdDistance = 100;
+ }
+ thresholdDistance_ = thresholdDistance;
+ return *this;
+}
+#endif
+
+UBool LocaleMatcher::Builder::copyErrorTo(UErrorCode &outErrorCode) const {
+ if (U_FAILURE(outErrorCode)) { return TRUE; }
+ if (U_SUCCESS(errorCode_)) { return FALSE; }
+ outErrorCode = errorCode_;
+ return TRUE;
+}
+
+LocaleMatcher LocaleMatcher::Builder::build(UErrorCode &errorCode) const {
+ if (U_SUCCESS(errorCode) && U_FAILURE(errorCode_)) {
+ errorCode = errorCode_;
+ }
+ return LocaleMatcher(*this, errorCode);
+}
+
+namespace {
+
+LSR getMaximalLsrOrUnd(const XLikelySubtags &likelySubtags, const Locale &locale,
+ UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode) || locale.isBogus() || *locale.getName() == 0 /* "und" */) {
+ return UND_LSR;
+ } else {
+ return likelySubtags.makeMaximizedLsrFrom(locale, errorCode);
+ }
+}
+
+int32_t hashLSR(const UHashTok token) {
+ const LSR *lsr = static_cast<const LSR *>(token.pointer);
+ return lsr->hashCode;
+}
+
+UBool compareLSRs(const UHashTok t1, const UHashTok t2) {
+ const LSR *lsr1 = static_cast<const LSR *>(t1.pointer);
+ const LSR *lsr2 = static_cast<const LSR *>(t2.pointer);
+ return *lsr1 == *lsr2;
+}
+
+} // namespace
+
+int32_t LocaleMatcher::putIfAbsent(const LSR &lsr, int32_t i, int32_t suppLength,
+ UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return suppLength; }
+ int32_t index = uhash_geti(supportedLsrToIndex, &lsr);
+ if (index == 0) {
+ uhash_puti(supportedLsrToIndex, const_cast<LSR *>(&lsr), i + 1, &errorCode);
+ if (U_SUCCESS(errorCode)) {
+ supportedLSRs[suppLength] = &lsr;
+ supportedIndexes[suppLength++] = i;
+ }
+ }
+ return suppLength;
+}
+
+LocaleMatcher::LocaleMatcher(const Builder &builder, UErrorCode &errorCode) :
+ likelySubtags(*XLikelySubtags::getSingleton(errorCode)),
+ localeDistance(*LocaleDistance::getSingleton(errorCode)),
+ thresholdDistance(builder.thresholdDistance_),
+ demotionPerDesiredLocale(0),
+ favorSubtag(builder.favor_),
+ direction(builder.direction_),
+ supportedLocales(nullptr), lsrs(nullptr), supportedLocalesLength(0),
+ supportedLsrToIndex(nullptr),
+ 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;
+ if (def != nullptr) {
+ ownedDefaultLocale = def->clone();
+ if (ownedDefaultLocale == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ def = ownedDefaultLocale;
+ builderDefaultLSR = getMaximalLsrOrUnd(likelySubtags, *def, errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ defLSR = &builderDefaultLSR;
+ }
+ supportedLocalesLength = builder.supportedLocales_ != nullptr ?
+ builder.supportedLocales_->size() : 0;
+ if (supportedLocalesLength > 0) {
+ // Store the supported locales in input order,
+ // so that when different types are used (e.g., language tag strings)
+ // we can return those by parallel index.
+ supportedLocales = static_cast<const Locale **>(
+ uprv_malloc(supportedLocalesLength * sizeof(const Locale *)));
+ // Supported LRSs in input order.
+ // In C++, we store these permanently to simplify ownership management
+ // in the hash tables. Duplicate LSRs (if any) are unused overhead.
+ lsrs = new LSR[supportedLocalesLength];
+ if (supportedLocales == nullptr || lsrs == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ // If the constructor fails partway, we need null pointers for destructibility.
+ uprv_memset(supportedLocales, 0, supportedLocalesLength * sizeof(const Locale *));
+ for (int32_t i = 0; i < supportedLocalesLength; ++i) {
+ const Locale &locale = *static_cast<Locale *>(builder.supportedLocales_->elementAt(i));
+ supportedLocales[i] = locale.clone();
+ if (supportedLocales[i] == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ const Locale &supportedLocale = *supportedLocales[i];
+ LSR &lsr = lsrs[i] = getMaximalLsrOrUnd(likelySubtags, supportedLocale, errorCode);
+ lsr.setHashCode();
+ if (U_FAILURE(errorCode)) { return; }
+ }
+
+ // We need an unordered map from LSR to first supported locale with that LSR,
+ // and an ordered list of (LSR, supported index) for
+ // the supported locales in the following order:
+ // 1. Default locale, if it is supported.
+ // 2. Priority locales (aka "paradigm locales") in builder order.
+ // 3. Remaining locales in builder order.
+ supportedLsrToIndex = uhash_openSize(hashLSR, compareLSRs, uhash_compareLong,
+ supportedLocalesLength, &errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ supportedLSRs = static_cast<const LSR **>(
+ uprv_malloc(supportedLocalesLength * sizeof(const LSR *)));
+ supportedIndexes = static_cast<int32_t *>(
+ uprv_malloc(supportedLocalesLength * sizeof(int32_t)));
+ if (supportedLSRs == nullptr || supportedIndexes == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ 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;
+ }
+ 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) {
+ U_ASSERT(i == 0);
+ def = &locale;
+ defLSR = &lsr;
+ order[i] = 1;
+ suppLength = putIfAbsent(lsr, 0, suppLength, errorCode);
+ } else if (lsr.isEquivalentTo(*defLSR)) {
+ order[i] = 1;
+ suppLength = putIfAbsent(lsr, i, suppLength, errorCode);
+ } else if (localeDistance.isParadigmLSR(lsr)) {
+ order[i] = 2;
+ ++numParadigms;
+ } else {
+ order[i] = 3;
+ }
+ if (U_FAILURE(errorCode)) { return; }
+ }
+ // Add supported paradigm locales.
+ int32_t paradigmLimit = suppLength + numParadigms;
+ for (int32_t i = 0; i < supportedLocalesLength && suppLength < paradigmLimit; ++i) {
+ if (order[i] == 2) {
+ suppLength = putIfAbsent(lsrs[i], i, suppLength, errorCode);
+ }
+ }
+ // Add remaining supported locales.
+ for (int32_t i = 0; i < supportedLocalesLength; ++i) {
+ if (order[i] == 3) {
+ suppLength = putIfAbsent(lsrs[i], i, suppLength, errorCode);
+ }
+ }
+ supportedLSRsLength = suppLength;
+ // If supportedLSRsLength < supportedLocalesLength then
+ // we waste as many array slots as there are duplicate supported LSRs,
+ // but the amount of wasted space is small as long as there are few duplicates.
+ }
+
+ defaultLocale = def;
+
+ if (builder.demotion_ == ULOCMATCH_DEMOTION_REGION) {
+ demotionPerDesiredLocale = localeDistance.getDefaultDemotionPerDesiredLocale();
+ }
+}
+
+LocaleMatcher::LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT :
+ likelySubtags(src.likelySubtags),
+ localeDistance(src.localeDistance),
+ thresholdDistance(src.thresholdDistance),
+ demotionPerDesiredLocale(src.demotionPerDesiredLocale),
+ favorSubtag(src.favorSubtag),
+ direction(src.direction),
+ supportedLocales(src.supportedLocales), lsrs(src.lsrs),
+ supportedLocalesLength(src.supportedLocalesLength),
+ supportedLsrToIndex(src.supportedLsrToIndex),
+ supportedLSRs(src.supportedLSRs),
+ supportedIndexes(src.supportedIndexes),
+ supportedLSRsLength(src.supportedLSRsLength),
+ ownedDefaultLocale(src.ownedDefaultLocale), defaultLocale(src.defaultLocale) {
+ src.supportedLocales = nullptr;
+ src.lsrs = nullptr;
+ src.supportedLocalesLength = 0;
+ src.supportedLsrToIndex = nullptr;
+ src.supportedLSRs = nullptr;
+ src.supportedIndexes = nullptr;
+ src.supportedLSRsLength = 0;
+ src.ownedDefaultLocale = nullptr;
+ src.defaultLocale = nullptr;
+}
+
+LocaleMatcher::~LocaleMatcher() {
+ for (int32_t i = 0; i < supportedLocalesLength; ++i) {
+ delete supportedLocales[i];
+ }
+ uprv_free(supportedLocales);
+ delete[] lsrs;
+ uhash_close(supportedLsrToIndex);
+ uprv_free(supportedLSRs);
+ uprv_free(supportedIndexes);
+ delete ownedDefaultLocale;
+}
+
+LocaleMatcher &LocaleMatcher::operator=(LocaleMatcher &&src) U_NOEXCEPT {
+ this->~LocaleMatcher();
+
+ thresholdDistance = src.thresholdDistance;
+ demotionPerDesiredLocale = src.demotionPerDesiredLocale;
+ favorSubtag = src.favorSubtag;
+ direction = src.direction;
+ supportedLocales = src.supportedLocales;
+ lsrs = src.lsrs;
+ supportedLocalesLength = src.supportedLocalesLength;
+ supportedLsrToIndex = src.supportedLsrToIndex;
+ supportedLSRs = src.supportedLSRs;
+ supportedIndexes = src.supportedIndexes;
+ supportedLSRsLength = src.supportedLSRsLength;
+ ownedDefaultLocale = src.ownedDefaultLocale;
+ defaultLocale = src.defaultLocale;
+
+ src.supportedLocales = nullptr;
+ src.lsrs = nullptr;
+ src.supportedLocalesLength = 0;
+ src.supportedLsrToIndex = nullptr;
+ src.supportedLSRs = nullptr;
+ src.supportedIndexes = nullptr;
+ src.supportedLSRsLength = 0;
+ src.ownedDefaultLocale = nullptr;
+ src.defaultLocale = nullptr;
+ return *this;
+}
+
+class LocaleLsrIterator {
+public:
+ LocaleLsrIterator(const XLikelySubtags &likelySubtags, Locale::Iterator &locales,
+ ULocMatchLifetime lifetime) :
+ likelySubtags(likelySubtags), locales(locales), lifetime(lifetime) {}
+
+ ~LocaleLsrIterator() {
+ if (lifetime == ULOCMATCH_TEMPORARY_LOCALES) {
+ delete remembered;
+ }
+ }
+
+ bool hasNext() const {
+ return locales.hasNext();
+ }
+
+ LSR next(UErrorCode &errorCode) {
+ current = &locales.next();
+ return getMaximalLsrOrUnd(likelySubtags, *current, errorCode);
+ }
+
+ void rememberCurrent(int32_t desiredIndex, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return; }
+ bestDesiredIndex = desiredIndex;
+ if (lifetime == ULOCMATCH_STORED_LOCALES) {
+ remembered = current;
+ } else {
+ // ULOCMATCH_TEMPORARY_LOCALES
+ delete remembered;
+ remembered = new Locale(*current);
+ if (remembered == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ }
+ }
+ }
+
+ const Locale *orphanRemembered() {
+ const Locale *rem = remembered;
+ remembered = nullptr;
+ return rem;
+ }
+
+ int32_t getBestDesiredIndex() const {
+ return bestDesiredIndex;
+ }
+
+private:
+ const XLikelySubtags &likelySubtags;
+ Locale::Iterator &locales;
+ ULocMatchLifetime lifetime;
+ const Locale *current = nullptr, *remembered = nullptr;
+ int32_t bestDesiredIndex = -1;
+};
+
+const Locale *LocaleMatcher::getBestMatch(const Locale &desiredLocale, UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode)) { return nullptr; }
+ int32_t suppIndex = getBestSuppIndex(
+ getMaximalLsrOrUnd(likelySubtags, desiredLocale, errorCode),
+ nullptr, errorCode);
+ return U_SUCCESS(errorCode) && suppIndex >= 0 ? supportedLocales[suppIndex] : defaultLocale;
+}
+
+const Locale *LocaleMatcher::getBestMatch(Locale::Iterator &desiredLocales,
+ UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode)) { return nullptr; }
+ if (!desiredLocales.hasNext()) {
+ return defaultLocale;
+ }
+ LocaleLsrIterator lsrIter(likelySubtags, desiredLocales, ULOCMATCH_TEMPORARY_LOCALES);
+ int32_t suppIndex = getBestSuppIndex(lsrIter.next(errorCode), &lsrIter, errorCode);
+ return U_SUCCESS(errorCode) && suppIndex >= 0 ? supportedLocales[suppIndex] : defaultLocale;
+}
+
+const Locale *LocaleMatcher::getBestMatchForListString(
+ StringPiece desiredLocaleList, UErrorCode &errorCode) const {
+ LocalePriorityList list(desiredLocaleList, errorCode);
+ LocalePriorityList::Iterator iter = list.iterator();
+ return getBestMatch(iter, errorCode);
+}
+
+LocaleMatcher::Result LocaleMatcher::getBestMatchResult(
+ const Locale &desiredLocale, UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode)) {
+ return Result(nullptr, defaultLocale, -1, -1, FALSE);
+ }
+ int32_t suppIndex = getBestSuppIndex(
+ getMaximalLsrOrUnd(likelySubtags, desiredLocale, errorCode),
+ nullptr, errorCode);
+ if (U_FAILURE(errorCode) || suppIndex < 0) {
+ return Result(nullptr, defaultLocale, -1, -1, FALSE);
+ } else {
+ return Result(&desiredLocale, supportedLocales[suppIndex], 0, suppIndex, FALSE);
+ }
+}
+
+LocaleMatcher::Result LocaleMatcher::getBestMatchResult(
+ Locale::Iterator &desiredLocales, UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode) || !desiredLocales.hasNext()) {
+ return Result(nullptr, defaultLocale, -1, -1, FALSE);
+ }
+ LocaleLsrIterator lsrIter(likelySubtags, desiredLocales, ULOCMATCH_TEMPORARY_LOCALES);
+ int32_t suppIndex = getBestSuppIndex(lsrIter.next(errorCode), &lsrIter, errorCode);
+ if (U_FAILURE(errorCode) || suppIndex < 0) {
+ return Result(nullptr, defaultLocale, -1, -1, FALSE);
+ } else {
+ return Result(lsrIter.orphanRemembered(), supportedLocales[suppIndex],
+ lsrIter.getBestDesiredIndex(), suppIndex, TRUE);
+ }
+}
+
+int32_t LocaleMatcher::getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remainingIter,
+ UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode)) { return -1; }
+ int32_t desiredIndex = 0;
+ int32_t bestSupportedLsrIndex = -1;
+ for (int32_t bestShiftedDistance = LocaleDistance::shiftDistance(thresholdDistance);;) {
+ // Quick check for exact maximized LSR.
+ // Returns suppIndex+1 where 0 means not found.
+ if (supportedLsrToIndex != nullptr) {
+ desiredLSR.setHashCode();
+ int32_t index = uhash_geti(supportedLsrToIndex, &desiredLSR);
+ if (index != 0) {
+ int32_t suppIndex = index - 1;
+ if (remainingIter != nullptr) {
+ remainingIter->rememberCurrent(desiredIndex, errorCode);
+ }
+ return suppIndex;
+ }
+ }
+ int32_t bestIndexAndDistance = localeDistance.getBestIndexAndDistance(
+ desiredLSR, supportedLSRs, supportedLSRsLength,
+ bestShiftedDistance, favorSubtag, direction);
+ if (bestIndexAndDistance >= 0) {
+ bestShiftedDistance = LocaleDistance::getShiftedDistance(bestIndexAndDistance);
+ if (remainingIter != nullptr) {
+ remainingIter->rememberCurrent(desiredIndex, errorCode);
+ if (U_FAILURE(errorCode)) { return -1; }
+ }
+ bestSupportedLsrIndex = LocaleDistance::getIndex(bestIndexAndDistance);
+ }
+ if ((bestShiftedDistance -= LocaleDistance::shiftDistance(demotionPerDesiredLocale)) <= 0) {
+ break;
+ }
+ if (remainingIter == nullptr || !remainingIter->hasNext()) {
+ break;
+ }
+ desiredLSR = remainingIter->next(errorCode);
+ if (U_FAILURE(errorCode)) { return -1; }
+ ++desiredIndex;
+ }
+ if (bestSupportedLsrIndex < 0) {
+ // no good match
+ return -1;
+ }
+ return supportedIndexes[bestSupportedLsrIndex];
+}
+
+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);
+ 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);
+ double distance = LocaleDistance::getDistanceDouble(indexAndDistance);
+ return (100.0 - distance) / 100.0;
+}
+
+U_NAMESPACE_END
+
+// uloc_acceptLanguage() --------------------------------------------------- ***
+
+U_NAMESPACE_USE
+
+namespace {
+
+class LocaleFromTag {
+public:
+ LocaleFromTag() : locale(Locale::getRoot()) {}
+ const Locale &operator()(const char *tag) { return locale = Locale(tag); }
+
+private:
+ // Store the locale in the converter, rather than return a reference to a temporary,
+ // or a value which could go out of scope with the caller's reference to it.
+ Locale locale;
+};
+
+int32_t acceptLanguage(UEnumeration &supportedLocales, Locale::Iterator &desiredLocales,
+ char *dest, int32_t capacity, UAcceptResult *acceptResult,
+ UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return 0; }
+ LocaleMatcher::Builder builder;
+ const char *locString;
+ while ((locString = uenum_next(&supportedLocales, nullptr, &errorCode)) != nullptr) {
+ Locale loc(locString);
+ if (loc.isBogus()) {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+ builder.addSupportedLocale(loc);
+ }
+ LocaleMatcher matcher = builder.build(errorCode);
+ LocaleMatcher::Result result = matcher.getBestMatchResult(desiredLocales, errorCode);
+ if (U_FAILURE(errorCode)) { return 0; }
+ if (result.getDesiredIndex() >= 0) {
+ if (acceptResult != nullptr) {
+ *acceptResult = *result.getDesiredLocale() == *result.getSupportedLocale() ?
+ ULOC_ACCEPT_VALID : ULOC_ACCEPT_FALLBACK;
+ }
+ const char *bestStr = result.getSupportedLocale()->getName();
+ int32_t bestLength = (int32_t)uprv_strlen(bestStr);
+ if (bestLength <= capacity) {
+ uprv_memcpy(dest, bestStr, bestLength);
+ }
+ return u_terminateChars(dest, capacity, bestLength, &errorCode);
+ } else {
+ if (acceptResult != nullptr) {
+ *acceptResult = ULOC_ACCEPT_FAILED;
+ }
+ return u_terminateChars(dest, capacity, 0, &errorCode);
+ }
+}
+
+} // namespace
+
+U_CAPI int32_t U_EXPORT2
+uloc_acceptLanguage(char *result, int32_t resultAvailable,
+ UAcceptResult *outResult,
+ const char **acceptList, int32_t acceptListCount,
+ UEnumeration *availableLocales,
+ UErrorCode *status) {
+ if (U_FAILURE(*status)) { return 0; }
+ if ((result == nullptr ? resultAvailable != 0 : resultAvailable < 0) ||
+ (acceptList == nullptr ? acceptListCount != 0 : acceptListCount < 0) ||
+ availableLocales == nullptr) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+ LocaleFromTag converter;
+ Locale::ConvertingIterator<const char **, LocaleFromTag> desiredLocales(
+ acceptList, acceptList + acceptListCount, converter);
+ return acceptLanguage(*availableLocales, desiredLocales,
+ result, resultAvailable, outResult, *status);
+}
+
+U_CAPI int32_t U_EXPORT2
+uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable,
+ UAcceptResult *outResult,
+ const char *httpAcceptLanguage,
+ UEnumeration *availableLocales,
+ UErrorCode *status) {
+ if (U_FAILURE(*status)) { return 0; }
+ if ((result == nullptr ? resultAvailable != 0 : resultAvailable < 0) ||
+ httpAcceptLanguage == nullptr || availableLocales == nullptr) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+ LocalePriorityList list(httpAcceptLanguage, *status);
+ LocalePriorityList::Iterator desiredLocales = list.iterator();
+ return acceptLanguage(*availableLocales, desiredLocales,
+ result, resultAvailable, outResult, *status);
+}
+
+#endif // __LOCMATCHER_H__
diff --git a/contrib/libs/icu/common/localeprioritylist.cpp b/contrib/libs/icu/common/localeprioritylist.cpp
index 62bce00446..cee408269c 100644
--- a/contrib/libs/icu/common/localeprioritylist.cpp
+++ b/contrib/libs/icu/common/localeprioritylist.cpp
@@ -1,239 +1,239 @@
-// © 2019 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html#License
-
-// localeprioritylist.cpp
-// created: 2019jul11 Markus W. Scherer
-
-#include "unicode/utypes.h"
-#include "unicode/localpointer.h"
-#include "unicode/locid.h"
-#include "unicode/stringpiece.h"
-#include "unicode/uobject.h"
-#include "charstr.h"
-#include "cmemory.h"
-#include "localeprioritylist.h"
-#include "uarrsort.h"
-#include "uassert.h"
-#include "uhash.h"
-
-U_NAMESPACE_BEGIN
-
-namespace {
-
-int32_t hashLocale(const UHashTok token) {
- auto *locale = static_cast<const Locale *>(token.pointer);
- return locale->hashCode();
-}
-
-UBool compareLocales(const UHashTok t1, const UHashTok t2) {
- auto *l1 = static_cast<const Locale *>(t1.pointer);
- auto *l2 = static_cast<const Locale *>(t2.pointer);
- return *l1 == *l2;
-}
-
-constexpr int32_t WEIGHT_ONE = 1000;
-
-struct LocaleAndWeight {
- Locale *locale;
- int32_t weight; // 0..1000 = 0.0..1.0
- int32_t index; // force stable sort
-
- int32_t compare(const LocaleAndWeight &other) const {
- int32_t diff = other.weight - weight; // descending: other-this
- if (diff != 0) { return diff; }
- return index - other.index;
- }
-};
-
-int32_t U_CALLCONV
-compareLocaleAndWeight(const void * /*context*/, const void *left, const void *right) {
- return static_cast<const LocaleAndWeight *>(left)->
- compare(*static_cast<const LocaleAndWeight *>(right));
-}
-
-const char *skipSpaces(const char *p, const char *limit) {
- while (p < limit && *p == ' ') { ++p; }
- return p;
-}
-
-int32_t findTagLength(const char *p, const char *limit) {
- // Look for accept-language delimiters.
- // Leave other validation up to the Locale constructor.
- const char *q;
- for (q = p; q < limit; ++q) {
- char c = *q;
- if (c == ' ' || c == ',' || c == ';') { break; }
- }
- return static_cast<int32_t>(q - p);
-}
-
-/**
- * Parses and returns a qvalue weight in millis.
- * Advances p to after the parsed substring.
- * Returns a negative value if parsing fails.
- */
-int32_t parseWeight(const char *&p, const char *limit) {
- p = skipSpaces(p, limit);
- char c;
- if (p == limit || ((c = *p) != '0' && c != '1')) { return -1; }
- int32_t weight = (c - '0') * 1000;
- if (++p == limit || *p != '.') { return weight; }
- int32_t multiplier = 100;
- while (++p != limit && '0' <= (c = *p) && c <= '9') {
- c -= '0';
- if (multiplier > 0) {
- weight += c * multiplier;
- multiplier /= 10;
- } else if (multiplier == 0) {
- // round up
- if (c >= 5) { ++weight; }
- multiplier = -1;
- } // else ignore further fraction digits
- }
- return weight <= WEIGHT_ONE ? weight : -1; // bad if > 1.0
-}
-
-} // namespace
-
-/**
- * Nothing but a wrapper over a MaybeStackArray of LocaleAndWeight.
- *
- * This wrapper exists (and is not in an anonymous namespace)
- * so that we can forward-declare it in the header file and
- * don't have to expose the MaybeStackArray specialization and
- * the LocaleAndWeight to code (like the test) that #includes localeprioritylist.h.
- * Also, otherwise we would have to do a platform-specific
- * template export declaration of some kind for the MaybeStackArray specialization
- * to be properly exported from the common DLL.
- */
-struct LocaleAndWeightArray : public UMemory {
- MaybeStackArray<LocaleAndWeight, 20> array;
-};
-
-LocalePriorityList::LocalePriorityList(StringPiece s, UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) { return; }
- list = new LocaleAndWeightArray();
- if (list == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- const char *p = s.data();
- const char *limit = p + s.length();
- while ((p = skipSpaces(p, limit)) != limit) {
- if (*p == ',') { // empty range field
- ++p;
- continue;
- }
- int32_t tagLength = findTagLength(p, limit);
- if (tagLength == 0) {
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- CharString tag(p, tagLength, errorCode);
- if (U_FAILURE(errorCode)) { return; }
- Locale locale = Locale(tag.data());
- if (locale.isBogus()) {
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- int32_t weight = WEIGHT_ONE;
- if ((p = skipSpaces(p + tagLength, limit)) != limit && *p == ';') {
- if ((p = skipSpaces(p + 1, limit)) == limit || *p != 'q' ||
- (p = skipSpaces(p + 1, limit)) == limit || *p != '=' ||
- (++p, (weight = parseWeight(p, limit)) < 0)) {
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- p = skipSpaces(p, limit);
- }
- if (p != limit && *p != ',') { // trailing junk
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- add(locale, weight, errorCode);
- if (p == limit) { break; }
- ++p;
- }
- sort(errorCode);
-}
-
-LocalePriorityList::~LocalePriorityList() {
- if (list != nullptr) {
- for (int32_t i = 0; i < listLength; ++i) {
- delete list->array[i].locale;
- }
- delete list;
- }
- uhash_close(map);
-}
-
-const Locale *LocalePriorityList::localeAt(int32_t i) const {
- return list->array[i].locale;
-}
-
-Locale *LocalePriorityList::orphanLocaleAt(int32_t i) {
- if (list == nullptr) { return nullptr; }
- LocaleAndWeight &lw = list->array[i];
- Locale *l = lw.locale;
- lw.locale = nullptr;
- return l;
-}
-
-bool LocalePriorityList::add(const Locale &locale, int32_t weight, UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) { return false; }
- if (map == nullptr) {
- if (weight <= 0) { return true; } // do not add q=0
- map = uhash_open(hashLocale, compareLocales, uhash_compareLong, &errorCode);
- if (U_FAILURE(errorCode)) { return false; }
- }
- LocalPointer<Locale> clone;
- int32_t index = uhash_geti(map, &locale);
- if (index != 0) {
- // Duplicate: Remove the old item and append it anew.
- LocaleAndWeight &lw = list->array[index - 1];
- clone.adoptInstead(lw.locale);
- lw.locale = nullptr;
- lw.weight = 0;
- ++numRemoved;
- }
- if (weight <= 0) { // do not add q=0
- if (index != 0) {
- // Not strictly necessary but cleaner.
- uhash_removei(map, &locale);
- }
- return true;
- }
- if (clone.isNull()) {
- clone.adoptInstead(locale.clone());
- if (clone.isNull() || (clone->isBogus() && !locale.isBogus())) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- }
- if (listLength == list->array.getCapacity()) {
- int32_t newCapacity = listLength < 50 ? 100 : 4 * listLength;
- if (list->array.resize(newCapacity, listLength) == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- }
- uhash_puti(map, clone.getAlias(), listLength + 1, &errorCode);
- if (U_FAILURE(errorCode)) { return false; }
- LocaleAndWeight &lw = list->array[listLength];
- lw.locale = clone.orphan();
- lw.weight = weight;
- lw.index = listLength++;
- if (weight < WEIGHT_ONE) { hasWeights = true; }
- U_ASSERT(uhash_count(map) == getLength());
- return true;
-}
-
-void LocalePriorityList::sort(UErrorCode &errorCode) {
- // Sort by descending weights if there is a mix of weights.
- // The comparator forces a stable sort via the item index.
- if (U_FAILURE(errorCode) || getLength() <= 1 || !hasWeights) { return; }
- uprv_sortArray(list->array.getAlias(), listLength, sizeof(LocaleAndWeight),
- compareLocaleAndWeight, nullptr, FALSE, &errorCode);
-}
-
-U_NAMESPACE_END
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// localeprioritylist.cpp
+// created: 2019jul11 Markus W. Scherer
+
+#include "unicode/utypes.h"
+#include "unicode/localpointer.h"
+#include "unicode/locid.h"
+#include "unicode/stringpiece.h"
+#include "unicode/uobject.h"
+#include "charstr.h"
+#include "cmemory.h"
+#include "localeprioritylist.h"
+#include "uarrsort.h"
+#include "uassert.h"
+#include "uhash.h"
+
+U_NAMESPACE_BEGIN
+
+namespace {
+
+int32_t hashLocale(const UHashTok token) {
+ auto *locale = static_cast<const Locale *>(token.pointer);
+ return locale->hashCode();
+}
+
+UBool compareLocales(const UHashTok t1, const UHashTok t2) {
+ auto *l1 = static_cast<const Locale *>(t1.pointer);
+ auto *l2 = static_cast<const Locale *>(t2.pointer);
+ return *l1 == *l2;
+}
+
+constexpr int32_t WEIGHT_ONE = 1000;
+
+struct LocaleAndWeight {
+ Locale *locale;
+ int32_t weight; // 0..1000 = 0.0..1.0
+ int32_t index; // force stable sort
+
+ int32_t compare(const LocaleAndWeight &other) const {
+ int32_t diff = other.weight - weight; // descending: other-this
+ if (diff != 0) { return diff; }
+ return index - other.index;
+ }
+};
+
+int32_t U_CALLCONV
+compareLocaleAndWeight(const void * /*context*/, const void *left, const void *right) {
+ return static_cast<const LocaleAndWeight *>(left)->
+ compare(*static_cast<const LocaleAndWeight *>(right));
+}
+
+const char *skipSpaces(const char *p, const char *limit) {
+ while (p < limit && *p == ' ') { ++p; }
+ return p;
+}
+
+int32_t findTagLength(const char *p, const char *limit) {
+ // Look for accept-language delimiters.
+ // Leave other validation up to the Locale constructor.
+ const char *q;
+ for (q = p; q < limit; ++q) {
+ char c = *q;
+ if (c == ' ' || c == ',' || c == ';') { break; }
+ }
+ return static_cast<int32_t>(q - p);
+}
+
+/**
+ * Parses and returns a qvalue weight in millis.
+ * Advances p to after the parsed substring.
+ * Returns a negative value if parsing fails.
+ */
+int32_t parseWeight(const char *&p, const char *limit) {
+ p = skipSpaces(p, limit);
+ char c;
+ if (p == limit || ((c = *p) != '0' && c != '1')) { return -1; }
+ int32_t weight = (c - '0') * 1000;
+ if (++p == limit || *p != '.') { return weight; }
+ int32_t multiplier = 100;
+ while (++p != limit && '0' <= (c = *p) && c <= '9') {
+ c -= '0';
+ if (multiplier > 0) {
+ weight += c * multiplier;
+ multiplier /= 10;
+ } else if (multiplier == 0) {
+ // round up
+ if (c >= 5) { ++weight; }
+ multiplier = -1;
+ } // else ignore further fraction digits
+ }
+ return weight <= WEIGHT_ONE ? weight : -1; // bad if > 1.0
+}
+
+} // namespace
+
+/**
+ * Nothing but a wrapper over a MaybeStackArray of LocaleAndWeight.
+ *
+ * This wrapper exists (and is not in an anonymous namespace)
+ * so that we can forward-declare it in the header file and
+ * don't have to expose the MaybeStackArray specialization and
+ * the LocaleAndWeight to code (like the test) that #includes localeprioritylist.h.
+ * Also, otherwise we would have to do a platform-specific
+ * template export declaration of some kind for the MaybeStackArray specialization
+ * to be properly exported from the common DLL.
+ */
+struct LocaleAndWeightArray : public UMemory {
+ MaybeStackArray<LocaleAndWeight, 20> array;
+};
+
+LocalePriorityList::LocalePriorityList(StringPiece s, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return; }
+ list = new LocaleAndWeightArray();
+ if (list == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ const char *p = s.data();
+ const char *limit = p + s.length();
+ while ((p = skipSpaces(p, limit)) != limit) {
+ if (*p == ',') { // empty range field
+ ++p;
+ continue;
+ }
+ int32_t tagLength = findTagLength(p, limit);
+ if (tagLength == 0) {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ CharString tag(p, tagLength, errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ Locale locale = Locale(tag.data());
+ if (locale.isBogus()) {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ int32_t weight = WEIGHT_ONE;
+ if ((p = skipSpaces(p + tagLength, limit)) != limit && *p == ';') {
+ if ((p = skipSpaces(p + 1, limit)) == limit || *p != 'q' ||
+ (p = skipSpaces(p + 1, limit)) == limit || *p != '=' ||
+ (++p, (weight = parseWeight(p, limit)) < 0)) {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ p = skipSpaces(p, limit);
+ }
+ if (p != limit && *p != ',') { // trailing junk
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ add(locale, weight, errorCode);
+ if (p == limit) { break; }
+ ++p;
+ }
+ sort(errorCode);
+}
+
+LocalePriorityList::~LocalePriorityList() {
+ if (list != nullptr) {
+ for (int32_t i = 0; i < listLength; ++i) {
+ delete list->array[i].locale;
+ }
+ delete list;
+ }
+ uhash_close(map);
+}
+
+const Locale *LocalePriorityList::localeAt(int32_t i) const {
+ return list->array[i].locale;
+}
+
+Locale *LocalePriorityList::orphanLocaleAt(int32_t i) {
+ if (list == nullptr) { return nullptr; }
+ LocaleAndWeight &lw = list->array[i];
+ Locale *l = lw.locale;
+ lw.locale = nullptr;
+ return l;
+}
+
+bool LocalePriorityList::add(const Locale &locale, int32_t weight, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return false; }
+ if (map == nullptr) {
+ if (weight <= 0) { return true; } // do not add q=0
+ map = uhash_open(hashLocale, compareLocales, uhash_compareLong, &errorCode);
+ if (U_FAILURE(errorCode)) { return false; }
+ }
+ LocalPointer<Locale> clone;
+ int32_t index = uhash_geti(map, &locale);
+ if (index != 0) {
+ // Duplicate: Remove the old item and append it anew.
+ LocaleAndWeight &lw = list->array[index - 1];
+ clone.adoptInstead(lw.locale);
+ lw.locale = nullptr;
+ lw.weight = 0;
+ ++numRemoved;
+ }
+ if (weight <= 0) { // do not add q=0
+ if (index != 0) {
+ // Not strictly necessary but cleaner.
+ uhash_removei(map, &locale);
+ }
+ return true;
+ }
+ if (clone.isNull()) {
+ clone.adoptInstead(locale.clone());
+ if (clone.isNull() || (clone->isBogus() && !locale.isBogus())) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ }
+ if (listLength == list->array.getCapacity()) {
+ int32_t newCapacity = listLength < 50 ? 100 : 4 * listLength;
+ if (list->array.resize(newCapacity, listLength) == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ }
+ uhash_puti(map, clone.getAlias(), listLength + 1, &errorCode);
+ if (U_FAILURE(errorCode)) { return false; }
+ LocaleAndWeight &lw = list->array[listLength];
+ lw.locale = clone.orphan();
+ lw.weight = weight;
+ lw.index = listLength++;
+ if (weight < WEIGHT_ONE) { hasWeights = true; }
+ U_ASSERT(uhash_count(map) == getLength());
+ return true;
+}
+
+void LocalePriorityList::sort(UErrorCode &errorCode) {
+ // Sort by descending weights if there is a mix of weights.
+ // The comparator forces a stable sort via the item index.
+ if (U_FAILURE(errorCode) || getLength() <= 1 || !hasWeights) { return; }
+ uprv_sortArray(list->array.getAlias(), listLength, sizeof(LocaleAndWeight),
+ compareLocaleAndWeight, nullptr, FALSE, &errorCode);
+}
+
+U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/localeprioritylist.h b/contrib/libs/icu/common/localeprioritylist.h
index a39f7e1f5b..80ca38a7b5 100644
--- a/contrib/libs/icu/common/localeprioritylist.h
+++ b/contrib/libs/icu/common/localeprioritylist.h
@@ -1,115 +1,115 @@
-// © 2019 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html#License
-
-// localeprioritylist.h
-// created: 2019jul11 Markus W. Scherer
-
-#ifndef __LOCALEPRIORITYLIST_H__
-#define __LOCALEPRIORITYLIST_H__
-
-#include "unicode/utypes.h"
-#include "unicode/locid.h"
-#include "unicode/stringpiece.h"
-#include "unicode/uobject.h"
-
-struct UHashtable;
-
-U_NAMESPACE_BEGIN
-
-struct LocaleAndWeightArray;
-
-/**
- * Parses a list of locales from an accept-language string.
- * We are a bit more lenient than the spec:
- * We accept extra whitespace in more places, empty range fields,
- * and any number of qvalue fraction digits.
- *
- * https://tools.ietf.org/html/rfc2616#section-14.4
- * 14.4 Accept-Language
- *
- * Accept-Language = "Accept-Language" ":"
- * 1#( language-range [ ";" "q" "=" qvalue ] )
- * language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )
- *
- * Each language-range MAY be given an associated quality value which
- * represents an estimate of the user's preference for the languages
- * specified by that range. The quality value defaults to "q=1". For
- * example,
- *
- * Accept-Language: da, en-gb;q=0.8, en;q=0.7
- *
- * https://tools.ietf.org/html/rfc2616#section-3.9
- * 3.9 Quality Values
- *
- * HTTP content negotiation (section 12) uses short "floating point"
- * numbers to indicate the relative importance ("weight") of various
- * negotiable parameters. A weight is normalized to a real number in
- * the range 0 through 1, where 0 is the minimum and 1 the maximum
- * value. If a parameter has a quality value of 0, then content with
- * this parameter is `not acceptable' for the client. HTTP/1.1
- * applications MUST NOT generate more than three digits after the
- * decimal point. User configuration of these values SHOULD also be
- * limited in this fashion.
- *
- * qvalue = ( "0" [ "." 0*3DIGIT ] )
- * | ( "1" [ "." 0*3("0") ] )
- */
-class U_COMMON_API LocalePriorityList : public UMemory {
-public:
- class Iterator : public Locale::Iterator {
- public:
- UBool hasNext() const override { return count < length; }
-
- const Locale &next() override {
- for(;;) {
- const Locale *locale = list.localeAt(index++);
- if (locale != nullptr) {
- ++count;
- return *locale;
- }
- }
- }
-
- private:
- friend class LocalePriorityList;
-
- Iterator(const LocalePriorityList &list) : list(list), length(list.getLength()) {}
-
- const LocalePriorityList &list;
- int32_t index = 0;
- int32_t count = 0;
- const int32_t length;
- };
-
- LocalePriorityList(StringPiece s, UErrorCode &errorCode);
-
- ~LocalePriorityList();
-
- int32_t getLength() const { return listLength - numRemoved; }
-
- int32_t getLengthIncludingRemoved() const { return listLength; }
-
- Iterator iterator() const { return Iterator(*this); }
-
- const Locale *localeAt(int32_t i) const;
-
- Locale *orphanLocaleAt(int32_t i);
-
-private:
- LocalePriorityList(const LocalePriorityList &) = delete;
- LocalePriorityList &operator=(const LocalePriorityList &) = delete;
-
- bool add(const Locale &locale, int32_t weight, UErrorCode &errorCode);
-
- void sort(UErrorCode &errorCode);
-
- LocaleAndWeightArray *list = nullptr;
- int32_t listLength = 0;
- int32_t numRemoved = 0;
- bool hasWeights = false; // other than 1.0
- UHashtable *map = nullptr;
-};
-
-U_NAMESPACE_END
-
-#endif // __LOCALEPRIORITYLIST_H__
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// localeprioritylist.h
+// created: 2019jul11 Markus W. Scherer
+
+#ifndef __LOCALEPRIORITYLIST_H__
+#define __LOCALEPRIORITYLIST_H__
+
+#include "unicode/utypes.h"
+#include "unicode/locid.h"
+#include "unicode/stringpiece.h"
+#include "unicode/uobject.h"
+
+struct UHashtable;
+
+U_NAMESPACE_BEGIN
+
+struct LocaleAndWeightArray;
+
+/**
+ * Parses a list of locales from an accept-language string.
+ * We are a bit more lenient than the spec:
+ * We accept extra whitespace in more places, empty range fields,
+ * and any number of qvalue fraction digits.
+ *
+ * https://tools.ietf.org/html/rfc2616#section-14.4
+ * 14.4 Accept-Language
+ *
+ * Accept-Language = "Accept-Language" ":"
+ * 1#( language-range [ ";" "q" "=" qvalue ] )
+ * language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )
+ *
+ * Each language-range MAY be given an associated quality value which
+ * represents an estimate of the user's preference for the languages
+ * specified by that range. The quality value defaults to "q=1". For
+ * example,
+ *
+ * Accept-Language: da, en-gb;q=0.8, en;q=0.7
+ *
+ * https://tools.ietf.org/html/rfc2616#section-3.9
+ * 3.9 Quality Values
+ *
+ * HTTP content negotiation (section 12) uses short "floating point"
+ * numbers to indicate the relative importance ("weight") of various
+ * negotiable parameters. A weight is normalized to a real number in
+ * the range 0 through 1, where 0 is the minimum and 1 the maximum
+ * value. If a parameter has a quality value of 0, then content with
+ * this parameter is `not acceptable' for the client. HTTP/1.1
+ * applications MUST NOT generate more than three digits after the
+ * decimal point. User configuration of these values SHOULD also be
+ * limited in this fashion.
+ *
+ * qvalue = ( "0" [ "." 0*3DIGIT ] )
+ * | ( "1" [ "." 0*3("0") ] )
+ */
+class U_COMMON_API LocalePriorityList : public UMemory {
+public:
+ class Iterator : public Locale::Iterator {
+ public:
+ UBool hasNext() const override { return count < length; }
+
+ const Locale &next() override {
+ for(;;) {
+ const Locale *locale = list.localeAt(index++);
+ if (locale != nullptr) {
+ ++count;
+ return *locale;
+ }
+ }
+ }
+
+ private:
+ friend class LocalePriorityList;
+
+ Iterator(const LocalePriorityList &list) : list(list), length(list.getLength()) {}
+
+ const LocalePriorityList &list;
+ int32_t index = 0;
+ int32_t count = 0;
+ const int32_t length;
+ };
+
+ LocalePriorityList(StringPiece s, UErrorCode &errorCode);
+
+ ~LocalePriorityList();
+
+ int32_t getLength() const { return listLength - numRemoved; }
+
+ int32_t getLengthIncludingRemoved() const { return listLength; }
+
+ Iterator iterator() const { return Iterator(*this); }
+
+ const Locale *localeAt(int32_t i) const;
+
+ Locale *orphanLocaleAt(int32_t i);
+
+private:
+ LocalePriorityList(const LocalePriorityList &) = delete;
+ LocalePriorityList &operator=(const LocalePriorityList &) = delete;
+
+ bool add(const Locale &locale, int32_t weight, UErrorCode &errorCode);
+
+ void sort(UErrorCode &errorCode);
+
+ LocaleAndWeightArray *list = nullptr;
+ int32_t listLength = 0;
+ int32_t numRemoved = 0;
+ bool hasWeights = false; // other than 1.0
+ UHashtable *map = nullptr;
+};
+
+U_NAMESPACE_END
+
+#endif // __LOCALEPRIORITYLIST_H__
diff --git a/contrib/libs/icu/common/localsvc.h b/contrib/libs/icu/common/localsvc.h
index 11b1695d7c..3364019513 100644
--- a/contrib/libs/icu/common/localsvc.h
+++ b/contrib/libs/icu/common/localsvc.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
***************************************************************************
@@ -12,7 +12,7 @@
#include "unicode/utypes.h"
-#if defined(U_LOCAL_SERVICE_HOOK) && U_LOCAL_SERVICE_HOOK
+#if defined(U_LOCAL_SERVICE_HOOK) && U_LOCAL_SERVICE_HOOK
/**
* Prototype for user-supplied service hook. This function is expected to return
* a type of factory object specific to the requested service.
diff --git a/contrib/libs/icu/common/locavailable.cpp b/contrib/libs/icu/common/locavailable.cpp
index 0a13ffbe71..e8ec512e37 100644
--- a/contrib/libs/icu/common/locavailable.cpp
+++ b/contrib/libs/icu/common/locavailable.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: locavailable.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -19,13 +19,13 @@
* that then do not depend on resource bundle code and res_index bundles.
*/
-#include "unicode/errorcode.h"
+#include "unicode/errorcode.h"
#include "unicode/utypes.h"
#include "unicode/locid.h"
#include "unicode/uloc.h"
#include "unicode/ures.h"
#include "cmemory.h"
-#include "cstring.h"
+#include "cstring.h"
#include "ucln_cmn.h"
#include "uassert.h"
#include "umutex.h"
@@ -37,7 +37,7 @@ U_NAMESPACE_BEGIN
static icu::Locale* availableLocaleList = NULL;
static int32_t availableLocaleListCount;
-static icu::UInitOnce gInitOnceLocale = U_INITONCE_INITIALIZER;
+static icu::UInitOnce gInitOnceLocale = U_INITONCE_INITIALIZER;
U_NAMESPACE_END
@@ -52,7 +52,7 @@ static UBool U_CALLCONV locale_available_cleanup(void)
availableLocaleList = NULL;
}
availableLocaleListCount = 0;
- gInitOnceLocale.reset();
+ gInitOnceLocale.reset();
return TRUE;
}
@@ -83,7 +83,7 @@ void U_CALLCONV locale_available_init() {
const Locale* U_EXPORT2
Locale::getAvailableLocales(int32_t& count)
{
- umtx_initOnce(gInitOnceLocale, &locale_available_init);
+ umtx_initOnce(gInitOnceLocale, &locale_available_init);
count = availableLocaleListCount;
return availableLocaleList;
}
@@ -97,174 +97,174 @@ U_NAMESPACE_USE
/* ### Constants **************************************************/
-namespace {
-
-// Enough capacity for the two lists in the res_index.res file
-const char** gAvailableLocaleNames[2] = {};
-int32_t gAvailableLocaleCounts[2] = {};
-icu::UInitOnce ginstalledLocalesInitOnce = U_INITONCE_INITIALIZER;
-
-class AvailableLocalesSink : public ResourceSink {
- public:
- void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) U_OVERRIDE {
- ResourceTable resIndexTable = value.getTable(status);
- if (U_FAILURE(status)) {
- return;
- }
- for (int32_t i = 0; resIndexTable.getKeyAndValue(i, key, value); ++i) {
- ULocAvailableType type;
- if (uprv_strcmp(key, "InstalledLocales") == 0) {
- type = ULOC_AVAILABLE_DEFAULT;
- } else if (uprv_strcmp(key, "AliasLocales") == 0) {
- type = ULOC_AVAILABLE_ONLY_LEGACY_ALIASES;
- } else {
- // CLDRVersion, etc.
- continue;
- }
- ResourceTable availableLocalesTable = value.getTable(status);
- if (U_FAILURE(status)) {
- return;
- }
- gAvailableLocaleCounts[type] = availableLocalesTable.getSize();
- gAvailableLocaleNames[type] = static_cast<const char**>(
- uprv_malloc(gAvailableLocaleCounts[type] * sizeof(const char*)));
- if (gAvailableLocaleNames[type] == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- for (int32_t j = 0; availableLocalesTable.getKeyAndValue(j, key, value); ++j) {
- gAvailableLocaleNames[type][j] = key;
- }
- }
- }
-};
-
-class AvailableLocalesStringEnumeration : public StringEnumeration {
- public:
- AvailableLocalesStringEnumeration(ULocAvailableType type) : fType(type) {
- }
-
- const char* next(int32_t *resultLength, UErrorCode&) override {
- ULocAvailableType actualType = fType;
- int32_t actualIndex = fIndex++;
-
- // If the "combined" list was requested, resolve that now
- if (fType == ULOC_AVAILABLE_WITH_LEGACY_ALIASES) {
- int32_t defaultLocalesCount = gAvailableLocaleCounts[ULOC_AVAILABLE_DEFAULT];
- if (actualIndex < defaultLocalesCount) {
- actualType = ULOC_AVAILABLE_DEFAULT;
- } else {
- actualIndex -= defaultLocalesCount;
- actualType = ULOC_AVAILABLE_ONLY_LEGACY_ALIASES;
- }
- }
-
- // Return the requested string
- int32_t count = gAvailableLocaleCounts[actualType];
- const char* result;
- if (actualIndex < count) {
- result = gAvailableLocaleNames[actualType][actualIndex];
- if (resultLength != nullptr) {
- *resultLength = static_cast<int32_t>(uprv_strlen(result));
- }
- } else {
- result = nullptr;
- if (resultLength != nullptr) {
- *resultLength = 0;
- }
- }
- return result;
+namespace {
+
+// Enough capacity for the two lists in the res_index.res file
+const char** gAvailableLocaleNames[2] = {};
+int32_t gAvailableLocaleCounts[2] = {};
+icu::UInitOnce ginstalledLocalesInitOnce = U_INITONCE_INITIALIZER;
+
+class AvailableLocalesSink : public ResourceSink {
+ public:
+ void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) U_OVERRIDE {
+ ResourceTable resIndexTable = value.getTable(status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ for (int32_t i = 0; resIndexTable.getKeyAndValue(i, key, value); ++i) {
+ ULocAvailableType type;
+ if (uprv_strcmp(key, "InstalledLocales") == 0) {
+ type = ULOC_AVAILABLE_DEFAULT;
+ } else if (uprv_strcmp(key, "AliasLocales") == 0) {
+ type = ULOC_AVAILABLE_ONLY_LEGACY_ALIASES;
+ } else {
+ // CLDRVersion, etc.
+ continue;
+ }
+ ResourceTable availableLocalesTable = value.getTable(status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ gAvailableLocaleCounts[type] = availableLocalesTable.getSize();
+ gAvailableLocaleNames[type] = static_cast<const char**>(
+ uprv_malloc(gAvailableLocaleCounts[type] * sizeof(const char*)));
+ if (gAvailableLocaleNames[type] == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ for (int32_t j = 0; availableLocalesTable.getKeyAndValue(j, key, value); ++j) {
+ gAvailableLocaleNames[type][j] = key;
+ }
+ }
}
-
- void reset(UErrorCode&) override {
- fIndex = 0;
- }
-
- int32_t count(UErrorCode&) const override {
- if (fType == ULOC_AVAILABLE_WITH_LEGACY_ALIASES) {
- return gAvailableLocaleCounts[ULOC_AVAILABLE_DEFAULT]
- + gAvailableLocaleCounts[ULOC_AVAILABLE_ONLY_LEGACY_ALIASES];
- } else {
- return gAvailableLocaleCounts[fType];
- }
- }
-
- private:
- ULocAvailableType fType;
- int32_t fIndex = 0;
-};
-
-/* ### Get available **************************************************/
-
-static UBool U_CALLCONV uloc_cleanup(void) {
- for (int32_t i = 0; i < UPRV_LENGTHOF(gAvailableLocaleNames); i++) {
- uprv_free(gAvailableLocaleNames[i]);
- gAvailableLocaleNames[i] = nullptr;
- gAvailableLocaleCounts[i] = 0;
- }
- ginstalledLocalesInitOnce.reset();
+};
+
+class AvailableLocalesStringEnumeration : public StringEnumeration {
+ public:
+ AvailableLocalesStringEnumeration(ULocAvailableType type) : fType(type) {
+ }
+
+ const char* next(int32_t *resultLength, UErrorCode&) override {
+ ULocAvailableType actualType = fType;
+ int32_t actualIndex = fIndex++;
+
+ // If the "combined" list was requested, resolve that now
+ if (fType == ULOC_AVAILABLE_WITH_LEGACY_ALIASES) {
+ int32_t defaultLocalesCount = gAvailableLocaleCounts[ULOC_AVAILABLE_DEFAULT];
+ if (actualIndex < defaultLocalesCount) {
+ actualType = ULOC_AVAILABLE_DEFAULT;
+ } else {
+ actualIndex -= defaultLocalesCount;
+ actualType = ULOC_AVAILABLE_ONLY_LEGACY_ALIASES;
+ }
+ }
+
+ // Return the requested string
+ int32_t count = gAvailableLocaleCounts[actualType];
+ const char* result;
+ if (actualIndex < count) {
+ result = gAvailableLocaleNames[actualType][actualIndex];
+ if (resultLength != nullptr) {
+ *resultLength = static_cast<int32_t>(uprv_strlen(result));
+ }
+ } else {
+ result = nullptr;
+ if (resultLength != nullptr) {
+ *resultLength = 0;
+ }
+ }
+ return result;
+ }
+
+ void reset(UErrorCode&) override {
+ fIndex = 0;
+ }
+
+ int32_t count(UErrorCode&) const override {
+ if (fType == ULOC_AVAILABLE_WITH_LEGACY_ALIASES) {
+ return gAvailableLocaleCounts[ULOC_AVAILABLE_DEFAULT]
+ + gAvailableLocaleCounts[ULOC_AVAILABLE_ONLY_LEGACY_ALIASES];
+ } else {
+ return gAvailableLocaleCounts[fType];
+ }
+ }
+
+ private:
+ ULocAvailableType fType;
+ int32_t fIndex = 0;
+};
+
+/* ### Get available **************************************************/
+
+static UBool U_CALLCONV uloc_cleanup(void) {
+ for (int32_t i = 0; i < UPRV_LENGTHOF(gAvailableLocaleNames); i++) {
+ uprv_free(gAvailableLocaleNames[i]);
+ gAvailableLocaleNames[i] = nullptr;
+ gAvailableLocaleCounts[i] = 0;
+ }
+ ginstalledLocalesInitOnce.reset();
return TRUE;
}
// Load Installed Locales. This function will be called exactly once
// via the initOnce mechanism.
-static void U_CALLCONV loadInstalledLocales(UErrorCode& status) {
- ucln_common_registerCleanup(UCLN_COMMON_ULOC, uloc_cleanup);
+static void U_CALLCONV loadInstalledLocales(UErrorCode& status) {
+ ucln_common_registerCleanup(UCLN_COMMON_ULOC, uloc_cleanup);
- icu::LocalUResourceBundlePointer rb(ures_openDirect(NULL, "res_index", &status));
- AvailableLocalesSink sink;
- ures_getAllItemsWithFallback(rb.getAlias(), "", sink, status);
+ icu::LocalUResourceBundlePointer rb(ures_openDirect(NULL, "res_index", &status));
+ AvailableLocalesSink sink;
+ ures_getAllItemsWithFallback(rb.getAlias(), "", sink, status);
}
-void _load_installedLocales(UErrorCode& status) {
- umtx_initOnce(ginstalledLocalesInitOnce, &loadInstalledLocales, status);
+void _load_installedLocales(UErrorCode& status) {
+ umtx_initOnce(ginstalledLocalesInitOnce, &loadInstalledLocales, status);
}
-} // namespace
-
+} // namespace
+
U_CAPI const char* U_EXPORT2
-uloc_getAvailable(int32_t offset) {
- icu::ErrorCode status;
- _load_installedLocales(status);
- if (status.isFailure()) {
- return nullptr;
- }
- if (offset > gAvailableLocaleCounts[0]) {
- // *status = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
- }
- return gAvailableLocaleNames[0][offset];
+uloc_getAvailable(int32_t offset) {
+ icu::ErrorCode status;
+ _load_installedLocales(status);
+ if (status.isFailure()) {
+ return nullptr;
+ }
+ if (offset > gAvailableLocaleCounts[0]) {
+ // *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return nullptr;
+ }
+ return gAvailableLocaleNames[0][offset];
}
U_CAPI int32_t U_EXPORT2
-uloc_countAvailable() {
- icu::ErrorCode status;
- _load_installedLocales(status);
- if (status.isFailure()) {
- return 0;
- }
- return gAvailableLocaleCounts[0];
+uloc_countAvailable() {
+ icu::ErrorCode status;
+ _load_installedLocales(status);
+ if (status.isFailure()) {
+ return 0;
+ }
+ return gAvailableLocaleCounts[0];
+}
+
+U_CAPI UEnumeration* U_EXPORT2
+uloc_openAvailableByType(ULocAvailableType type, UErrorCode* status) {
+ if (U_FAILURE(*status)) {
+ return nullptr;
+ }
+ if (type < 0 || type >= ULOC_AVAILABLE_COUNT) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return nullptr;
+ }
+ _load_installedLocales(*status);
+ if (U_FAILURE(*status)) {
+ return nullptr;
+ }
+ LocalPointer<AvailableLocalesStringEnumeration> result(
+ new AvailableLocalesStringEnumeration(type), *status);
+ if (U_FAILURE(*status)) {
+ return nullptr;
+ }
+ return uenum_openFromStringEnumeration(result.orphan(), status);
}
-U_CAPI UEnumeration* U_EXPORT2
-uloc_openAvailableByType(ULocAvailableType type, UErrorCode* status) {
- if (U_FAILURE(*status)) {
- return nullptr;
- }
- if (type < 0 || type >= ULOC_AVAILABLE_COUNT) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
- }
- _load_installedLocales(*status);
- if (U_FAILURE(*status)) {
- return nullptr;
- }
- LocalPointer<AvailableLocalesStringEnumeration> result(
- new AvailableLocalesStringEnumeration(type), *status);
- if (U_FAILURE(*status)) {
- return nullptr;
- }
- return uenum_openFromStringEnumeration(result.orphan(), status);
-}
-
diff --git a/contrib/libs/icu/common/locbased.cpp b/contrib/libs/icu/common/locbased.cpp
index db8199131a..ff378b4cc7 100644
--- a/contrib/libs/icu/common/locbased.cpp
+++ b/contrib/libs/icu/common/locbased.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/locbased.h b/contrib/libs/icu/common/locbased.h
index d1be65536d..45738863b5 100644
--- a/contrib/libs/icu/common/locbased.h
+++ b/contrib/libs/icu/common/locbased.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -22,7 +22,7 @@
* `actualLocale' of size ULOC_FULLNAME_CAPACITY
*/
#define U_LOCALE_BASED(varname, objname) \
- LocaleBased varname((objname).validLocale, (objname).actualLocale)
+ LocaleBased varname((objname).validLocale, (objname).actualLocale)
U_NAMESPACE_BEGIN
diff --git a/contrib/libs/icu/common/locdispnames.cpp b/contrib/libs/icu/common/locdispnames.cpp
index 387be6784a..d92348e31c 100644
--- a/contrib/libs/icu/common/locdispnames.cpp
+++ b/contrib/libs/icu/common/locdispnames.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: locdispnames.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -22,7 +22,7 @@
#include "unicode/utypes.h"
#include "unicode/brkiter.h"
#include "unicode/locid.h"
-#include "unicode/uenum.h"
+#include "unicode/uenum.h"
#include "unicode/uloc.h"
#include "unicode/ures.h"
#include "unicode/ustring.h"
@@ -307,10 +307,10 @@ _getStringOrCopyKey(const char *path, const char *locale,
if(itemKey==NULL) {
/* top-level item: normal resource bundle access */
- icu::LocalUResourceBundlePointer rb(ures_open(path, locale, pErrorCode));
+ icu::LocalUResourceBundlePointer rb(ures_open(path, locale, pErrorCode));
if(U_SUCCESS(*pErrorCode)) {
- s=ures_getStringByKey(rb.getAlias(), tableKey, &length, pErrorCode);
+ s=ures_getStringByKey(rb.getAlias(), tableKey, &length, pErrorCode);
/* see comment about closing rb near "return item;" in _res_getTableStringWithFallback() */
}
} else {
@@ -374,12 +374,12 @@ _getDisplayNameForComponent(const char *locale,
return 0;
}
if(length==0) {
- // For the display name, we treat this as unknown language (ICU-20273).
- if (getter == uloc_getLanguage) {
- uprv_strcpy(localeBuffer, "und");
- } else {
- return u_terminateUChars(dest, destCapacity, 0, pErrorCode);
- }
+ // For the display name, we treat this as unknown language (ICU-20273).
+ if (getter == uloc_getLanguage) {
+ uprv_strcpy(localeBuffer, "und");
+ } else {
+ return u_terminateUChars(dest, destCapacity, 0, pErrorCode);
+ }
}
root = tag == _kCountries ? U_ICUDATA_REGION : U_ICUDATA_LANG;
@@ -514,13 +514,13 @@ uloc_getDisplayName(const char *locale,
{
UErrorCode status = U_ZERO_ERROR;
- icu::LocalUResourceBundlePointer locbundle(
- ures_open(U_ICUDATA_LANG, displayLocale, &status));
- icu::LocalUResourceBundlePointer dspbundle(
- ures_getByKeyWithFallback(locbundle.getAlias(), _kLocaleDisplayPattern, NULL, &status));
+ icu::LocalUResourceBundlePointer locbundle(
+ ures_open(U_ICUDATA_LANG, displayLocale, &status));
+ icu::LocalUResourceBundlePointer dspbundle(
+ ures_getByKeyWithFallback(locbundle.getAlias(), _kLocaleDisplayPattern, NULL, &status));
- separator=ures_getStringByKeyWithFallback(dspbundle.getAlias(), _kSeparator, &sepLen, &status);
- pattern=ures_getStringByKeyWithFallback(dspbundle.getAlias(), _kPattern, &patLen, &status);
+ separator=ures_getStringByKeyWithFallback(dspbundle.getAlias(), _kSeparator, &sepLen, &status);
+ pattern=ures_getStringByKeyWithFallback(dspbundle.getAlias(), _kPattern, &patLen, &status);
}
/* If we couldn't find any data, then use the defaults */
@@ -544,7 +544,7 @@ uloc_getDisplayName(const char *locale,
return 0;
}
separator = (const UChar *)p0 + subLen;
- sepLen = static_cast<int32_t>(p1 - separator);
+ sepLen = static_cast<int32_t>(p1 - separator);
}
if(patLen==0 || (patLen==defaultPatLen && !u_strncmp(pattern, defaultPattern, patLen))) {
@@ -560,8 +560,8 @@ uloc_getDisplayName(const char *locale,
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
- sub0Pos = static_cast<int32_t>(p0-pattern);
- sub1Pos = static_cast<int32_t>(p1-pattern);
+ sub0Pos = static_cast<int32_t>(p0-pattern);
+ sub1Pos = static_cast<int32_t>(p1-pattern);
if (sub1Pos < sub0Pos) { /* a very odd pattern */
int32_t t=sub0Pos; sub0Pos=sub1Pos; sub1Pos=t;
langi=1;
@@ -588,7 +588,7 @@ uloc_getDisplayName(const char *locale,
int32_t langPos=0; /* position in output of language substitution */
int32_t restLen=0; /* length of 'everything else' substitution */
int32_t restPos=0; /* position in output of 'everything else' substitution */
- icu::LocalUEnumerationPointer kenum; /* keyword enumeration */
+ icu::LocalUEnumerationPointer kenum; /* keyword enumeration */
/* prefix of pattern, extremely likely to be empty */
if(sub0Pos) {
@@ -641,10 +641,10 @@ uloc_getDisplayName(const char *locale,
len=uloc_getDisplayVariant(locale, displayLocale, p, cap, pErrorCode);
break;
case 3:
- kenum.adoptInstead(uloc_openKeywords(locale, pErrorCode));
+ kenum.adoptInstead(uloc_openKeywords(locale, pErrorCode));
U_FALLTHROUGH;
default: {
- const char* kw=uenum_next(kenum.getAlias(), &len, pErrorCode);
+ const char* kw=uenum_next(kenum.getAlias(), &len, pErrorCode);
if (kw == NULL) {
len=0; /* mark that we didn't add a component */
subdone=TRUE;
@@ -822,8 +822,8 @@ 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;
+ if (*status == U_STRING_NOT_TERMINATED_WARNING)
+ *status = U_BUFFER_OVERFLOW_ERROR;
/*
* if the keyword is equal to currency .. then to get the display name
@@ -833,16 +833,16 @@ uloc_getDisplayKeywordValue( const char* locale,
int32_t dispNameLen = 0;
const UChar *dispName = NULL;
-
- icu::LocalUResourceBundlePointer bundle(
- ures_open(U_ICUDATA_CURR, displayLocale, status));
- icu::LocalUResourceBundlePointer currencies(
- ures_getByKey(bundle.getAlias(), _kCurrencies, NULL, status));
- icu::LocalUResourceBundlePointer currency(
- ures_getByKeyWithFallback(currencies.getAlias(), keywordValue, NULL, status));
-
- dispName = ures_getStringByIndex(currency.getAlias(), UCURRENCY_DISPLAY_NAME_INDEX, &dispNameLen, status);
-
+
+ icu::LocalUResourceBundlePointer bundle(
+ ures_open(U_ICUDATA_CURR, displayLocale, status));
+ icu::LocalUResourceBundlePointer currencies(
+ ures_getByKey(bundle.getAlias(), _kCurrencies, NULL, status));
+ icu::LocalUResourceBundlePointer currency(
+ ures_getByKeyWithFallback(currencies.getAlias(), keywordValue, NULL, status));
+
+ dispName = ures_getStringByIndex(currency.getAlias(), UCURRENCY_DISPLAY_NAME_INDEX, &dispNameLen, status);
+
if(U_FAILURE(*status)){
if(*status == U_MISSING_RESOURCE_ERROR){
/* we just want to write the value over if nothing is available */
diff --git a/contrib/libs/icu/common/locdistance.cpp b/contrib/libs/icu/common/locdistance.cpp
index eb218b3efe..18e4d91bce 100644
--- a/contrib/libs/icu/common/locdistance.cpp
+++ b/contrib/libs/icu/common/locdistance.cpp
@@ -1,415 +1,415 @@
-// © 2019 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html#License
-
-// locdistance.cpp
-// created: 2019may08 Markus W. Scherer
-
-#include "unicode/utypes.h"
-#include "unicode/bytestrie.h"
-#include "unicode/localematcher.h"
-#include "unicode/locid.h"
-#include "unicode/uobject.h"
-#include "unicode/ures.h"
-#include "cstring.h"
-#include "locdistance.h"
-#include "loclikelysubtags.h"
-#include "uassert.h"
-#include "ucln_cmn.h"
-#include "uinvchar.h"
-#include "umutex.h"
-
-U_NAMESPACE_BEGIN
-
-namespace {
-
-/**
- * Bit flag used on the last character of a subtag in the trie.
- * Must be set consistently by the builder and the lookup code.
- */
-constexpr int32_t END_OF_SUBTAG = 0x80;
-/** Distance value bit flag, set by the builder. */
-constexpr int32_t DISTANCE_SKIP_SCRIPT = 0x80;
-/** Distance value bit flag, set by trieNext(). */
-constexpr int32_t DISTANCE_IS_FINAL = 0x100;
-constexpr int32_t DISTANCE_IS_FINAL_OR_SKIP_SCRIPT = DISTANCE_IS_FINAL | DISTANCE_SKIP_SCRIPT;
-
-constexpr int32_t ABOVE_THRESHOLD = 100;
-
-// Indexes into array of distances.
-enum {
- IX_DEF_LANG_DISTANCE,
- IX_DEF_SCRIPT_DISTANCE,
- IX_DEF_REGION_DISTANCE,
- IX_MIN_REGION_DISTANCE,
- IX_LIMIT
-};
-
-LocaleDistance *gLocaleDistance = nullptr;
-UInitOnce gInitOnce = U_INITONCE_INITIALIZER;
-
-UBool U_CALLCONV cleanup() {
- delete gLocaleDistance;
- gLocaleDistance = nullptr;
- gInitOnce.reset();
- return TRUE;
-}
-
-} // namespace
-
-void U_CALLCONV LocaleDistance::initLocaleDistance(UErrorCode &errorCode) {
- // This function is invoked only via umtx_initOnce().
- U_ASSERT(gLocaleDistance == nullptr);
- const XLikelySubtags &likely = *XLikelySubtags::getSingleton(errorCode);
- if (U_FAILURE(errorCode)) { return; }
- const LocaleDistanceData &data = likely.getDistanceData();
- if (data.distanceTrieBytes == nullptr ||
- data.regionToPartitions == nullptr || data.partitions == nullptr ||
- // ok if no paradigms
- data.distances == nullptr) {
- errorCode = U_MISSING_RESOURCE_ERROR;
- return;
- }
- gLocaleDistance = new LocaleDistance(data, likely);
- if (gLocaleDistance == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- ucln_common_registerCleanup(UCLN_COMMON_LOCALE_DISTANCE, cleanup);
-}
-
-const LocaleDistance *LocaleDistance::getSingleton(UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) { return nullptr; }
- umtx_initOnce(gInitOnce, &LocaleDistance::initLocaleDistance, errorCode);
- return gLocaleDistance;
-}
-
-LocaleDistance::LocaleDistance(const LocaleDistanceData &data, const XLikelySubtags &likely) :
- likelySubtags(likely),
- trie(data.distanceTrieBytes),
- regionToPartitionsIndex(data.regionToPartitions), partitionArrays(data.partitions),
- paradigmLSRs(data.paradigms), paradigmLSRsLength(data.paradigmsLength),
- defaultLanguageDistance(data.distances[IX_DEF_LANG_DISTANCE]),
- defaultScriptDistance(data.distances[IX_DEF_SCRIPT_DISTANCE]),
- defaultRegionDistance(data.distances[IX_DEF_REGION_DISTANCE]),
- minRegionDistance(data.distances[IX_MIN_REGION_DISTANCE]) {
- // For the default demotion value, use the
- // default region distance between unrelated Englishes.
- // Thus, unless demotion is turned off,
- // a mere region difference for one desired locale
- // is as good as a perfect match for the next following desired locale.
- // As of CLDR 36, we have <languageMatch desired="en_*_*" supported="en_*_*" distance="5"/>.
- LSR en("en", "Latn", "US", LSR::EXPLICIT_LSR);
- LSR enGB("en", "Latn", "GB", LSR::EXPLICIT_LSR);
- const LSR *p_enGB = &enGB;
- int32_t indexAndDistance = getBestIndexAndDistance(en, &p_enGB, 1,
- shiftDistance(50), ULOCMATCH_FAVOR_LANGUAGE, ULOCMATCH_DIRECTION_WITH_ONE_WAY);
- defaultDemotionPerDesiredLocale = getDistanceFloor(indexAndDistance);
-}
-
-int32_t LocaleDistance::getBestIndexAndDistance(
- const LSR &desired,
- const LSR **supportedLSRs, int32_t supportedLSRsLength,
- int32_t shiftedThreshold,
- ULocMatchFavorSubtag favorSubtag, ULocMatchDirection direction) const {
- BytesTrie iter(trie);
- // Look up the desired language only once for all supported LSRs.
- // Its "distance" is either a match point value of 0, or a non-match negative value.
- // Note: The data builder verifies that there are no <*, supported> or <desired, *> rules.
- int32_t desLangDistance = trieNext(iter, desired.language, false);
- uint64_t desLangState = desLangDistance >= 0 && supportedLSRsLength > 1 ? iter.getState64() : 0;
- // Index of the supported LSR with the lowest distance.
- int32_t bestIndex = -1;
- // Cached lookup info from XLikelySubtags.compareLikely().
- int32_t bestLikelyInfo = -1;
- for (int32_t slIndex = 0; slIndex < supportedLSRsLength; ++slIndex) {
- const LSR &supported = *supportedLSRs[slIndex];
- bool star = false;
- int32_t distance = desLangDistance;
- if (distance >= 0) {
- U_ASSERT((distance & DISTANCE_IS_FINAL) == 0);
- if (slIndex != 0) {
- iter.resetToState64(desLangState);
- }
- distance = trieNext(iter, supported.language, true);
- }
- // Note: The data builder verifies that there are no rules with "any" (*) language and
- // real (non *) script or region subtags.
- // This means that if the lookup for either language fails we can use
- // the default distances without further lookups.
- int32_t flags;
- if (distance >= 0) {
- flags = distance & DISTANCE_IS_FINAL_OR_SKIP_SCRIPT;
- distance &= ~DISTANCE_IS_FINAL_OR_SKIP_SCRIPT;
- } else { // <*, *>
- if (uprv_strcmp(desired.language, supported.language) == 0) {
- distance = 0;
- } else {
- distance = defaultLanguageDistance;
- }
- flags = 0;
- star = true;
- }
- U_ASSERT(0 <= distance && distance <= 100);
- // Round up the shifted threshold (if fraction bits are not 0)
- // for comparison with un-shifted distances until we need fraction bits.
- // (If we simply shifted non-zero fraction bits away, then we might ignore a language
- // when it's really still a micro distance below the threshold.)
- int32_t roundedThreshold = (shiftedThreshold + DISTANCE_FRACTION_MASK) >> DISTANCE_SHIFT;
- // We implement "favor subtag" by reducing the language subtag distance
- // (unscientifically reducing it to a quarter of the normal value),
- // so that the script distance is relatively more important.
- // For example, given a default language distance of 80, we reduce it to 20,
- // which is below the default threshold of 50, which is the default script distance.
- if (favorSubtag == ULOCMATCH_FAVOR_SCRIPT) {
- distance >>= 2;
- }
- // Let distance == roundedThreshold pass until the tie-breaker logic
- // at the end of the loop.
- if (distance > roundedThreshold) {
- continue;
- }
-
- int32_t scriptDistance;
- if (star || flags != 0) {
- if (uprv_strcmp(desired.script, supported.script) == 0) {
- scriptDistance = 0;
- } else {
- scriptDistance = defaultScriptDistance;
- }
- } else {
- scriptDistance = getDesSuppScriptDistance(iter, iter.getState64(),
- desired.script, supported.script);
- flags = scriptDistance & DISTANCE_IS_FINAL;
- scriptDistance &= ~DISTANCE_IS_FINAL;
- }
- distance += scriptDistance;
- if (distance > roundedThreshold) {
- continue;
- }
-
- if (uprv_strcmp(desired.region, supported.region) == 0) {
- // regionDistance = 0
- } else if (star || (flags & DISTANCE_IS_FINAL) != 0) {
- distance += defaultRegionDistance;
- } else {
- int32_t remainingThreshold = roundedThreshold - distance;
- if (minRegionDistance > remainingThreshold) {
- continue;
- }
-
- // From here on we know the regions are not equal.
- // Map each region to zero or more partitions. (zero = one non-matching string)
- // (Each array of single-character partition strings is encoded as one string.)
- // If either side has more than one, then we find the maximum distance.
- // This could be optimized by adding some more structure, but probably not worth it.
- distance += getRegionPartitionsDistance(
- iter, iter.getState64(),
- partitionsForRegion(desired),
- partitionsForRegion(supported),
- remainingThreshold);
- }
- int32_t shiftedDistance = shiftDistance(distance);
- if (shiftedDistance == 0) {
- // Distinguish between equivalent but originally unequal locales via an
- // additional micro distance.
- shiftedDistance |= (desired.flags ^ supported.flags);
- if (shiftedDistance < shiftedThreshold) {
- if (direction != ULOCMATCH_DIRECTION_ONLY_TWO_WAY ||
- // Is there also a match when we swap desired/supported?
- isMatch(supported, desired, shiftedThreshold, favorSubtag)) {
- if (shiftedDistance == 0) {
- return slIndex << INDEX_SHIFT;
- }
- bestIndex = slIndex;
- shiftedThreshold = shiftedDistance;
- bestLikelyInfo = -1;
- }
- }
- } else {
- if (shiftedDistance < shiftedThreshold) {
- if (direction != ULOCMATCH_DIRECTION_ONLY_TWO_WAY ||
- // Is there also a match when we swap desired/supported?
- isMatch(supported, desired, shiftedThreshold, favorSubtag)) {
- bestIndex = slIndex;
- shiftedThreshold = shiftedDistance;
- bestLikelyInfo = -1;
- }
- } else if (shiftedDistance == shiftedThreshold && bestIndex >= 0) {
- if (direction != ULOCMATCH_DIRECTION_ONLY_TWO_WAY ||
- // Is there also a match when we swap desired/supported?
- isMatch(supported, desired, shiftedThreshold, favorSubtag)) {
- bestLikelyInfo = likelySubtags.compareLikely(
- supported, *supportedLSRs[bestIndex], bestLikelyInfo);
- if ((bestLikelyInfo & 1) != 0) {
- // This supported locale matches as well as the previous best match,
- // and neither matches perfectly,
- // but this one is "more likely" (has more-default subtags).
- bestIndex = slIndex;
- }
- }
- }
- }
- }
- return bestIndex >= 0 ?
- (bestIndex << INDEX_SHIFT) | shiftedThreshold :
- INDEX_NEG_1 | shiftDistance(ABOVE_THRESHOLD);
-}
-
-int32_t LocaleDistance::getDesSuppScriptDistance(
- BytesTrie &iter, uint64_t startState, const char *desired, const char *supported) {
- // Note: The data builder verifies that there are no <*, supported> or <desired, *> rules.
- int32_t distance = trieNext(iter, desired, false);
- if (distance >= 0) {
- distance = trieNext(iter, supported, true);
- }
- if (distance < 0) {
- UStringTrieResult result = iter.resetToState64(startState).next(u'*'); // <*, *>
- U_ASSERT(USTRINGTRIE_HAS_VALUE(result));
- if (uprv_strcmp(desired, supported) == 0) {
- distance = 0; // same script
- } else {
- distance = iter.getValue();
- U_ASSERT(distance >= 0);
- }
- if (result == USTRINGTRIE_FINAL_VALUE) {
- distance |= DISTANCE_IS_FINAL;
- }
- }
- return distance;
-}
-
-int32_t LocaleDistance::getRegionPartitionsDistance(
- BytesTrie &iter, uint64_t startState,
- const char *desiredPartitions, const char *supportedPartitions, int32_t threshold) {
- char desired = *desiredPartitions++;
- char supported = *supportedPartitions++;
- U_ASSERT(desired != 0 && supported != 0);
- // See if we have single desired/supported partitions, from NUL-terminated
- // partition strings without explicit length.
- bool suppLengthGt1 = *supportedPartitions != 0; // gt1: more than 1 character
- // equivalent to: if (desLength == 1 && suppLength == 1)
- if (*desiredPartitions == 0 && !suppLengthGt1) {
- // Fastpath for single desired/supported partitions.
- UStringTrieResult result = iter.next(uprv_invCharToAscii(desired) | END_OF_SUBTAG);
- if (USTRINGTRIE_HAS_NEXT(result)) {
- result = iter.next(uprv_invCharToAscii(supported) | END_OF_SUBTAG);
- if (USTRINGTRIE_HAS_VALUE(result)) {
- return iter.getValue();
- }
- }
- return getFallbackRegionDistance(iter, startState);
- }
-
- const char *supportedStart = supportedPartitions - 1; // for restart of inner loop
- int32_t regionDistance = 0;
- // Fall back to * only once, not for each pair of partition strings.
- bool star = false;
- for (;;) {
- // Look up each desired-partition string only once,
- // not for each (desired, supported) pair.
- UStringTrieResult result = iter.next(uprv_invCharToAscii(desired) | END_OF_SUBTAG);
- if (USTRINGTRIE_HAS_NEXT(result)) {
- uint64_t desState = suppLengthGt1 ? iter.getState64() : 0;
- for (;;) {
- result = iter.next(uprv_invCharToAscii(supported) | END_OF_SUBTAG);
- int32_t d;
- if (USTRINGTRIE_HAS_VALUE(result)) {
- d = iter.getValue();
- } else if (star) {
- d = 0;
- } else {
- d = getFallbackRegionDistance(iter, startState);
- star = true;
- }
- if (d > threshold) {
- return d;
- } else if (regionDistance < d) {
- regionDistance = d;
- }
- if ((supported = *supportedPartitions++) != 0) {
- iter.resetToState64(desState);
- } else {
- break;
- }
- }
- } else if (!star) {
- int32_t d = getFallbackRegionDistance(iter, startState);
- if (d > threshold) {
- return d;
- } else if (regionDistance < d) {
- regionDistance = d;
- }
- star = true;
- }
- if ((desired = *desiredPartitions++) != 0) {
- iter.resetToState64(startState);
- supportedPartitions = supportedStart;
- supported = *supportedPartitions++;
- } else {
- break;
- }
- }
- return regionDistance;
-}
-
-int32_t LocaleDistance::getFallbackRegionDistance(BytesTrie &iter, uint64_t startState) {
-#if U_DEBUG
- UStringTrieResult result =
-#endif
- iter.resetToState64(startState).next(u'*'); // <*, *>
- U_ASSERT(USTRINGTRIE_HAS_VALUE(result));
- int32_t distance = iter.getValue();
- U_ASSERT(distance >= 0);
- return distance;
-}
-
-int32_t LocaleDistance::trieNext(BytesTrie &iter, const char *s, bool wantValue) {
- uint8_t c;
- if ((c = *s) == 0) {
- return -1; // no empty subtags in the distance data
- }
- for (;;) {
- c = uprv_invCharToAscii(c);
- // EBCDIC: If *s is not an invariant character,
- // then c is now 0 and will simply not match anything, which is harmless.
- uint8_t next = *++s;
- if (next != 0) {
- if (!USTRINGTRIE_HAS_NEXT(iter.next(c))) {
- return -1;
- }
- } else {
- // last character of this subtag
- UStringTrieResult result = iter.next(c | END_OF_SUBTAG);
- if (wantValue) {
- if (USTRINGTRIE_HAS_VALUE(result)) {
- int32_t value = iter.getValue();
- if (result == USTRINGTRIE_FINAL_VALUE) {
- value |= DISTANCE_IS_FINAL;
- }
- return value;
- }
- } else {
- if (USTRINGTRIE_HAS_NEXT(result)) {
- return 0;
- }
- }
- return -1;
- }
- c = next;
- }
-}
-
-UBool LocaleDistance::isParadigmLSR(const LSR &lsr) const {
- // Linear search for a very short list (length 6 as of 2019),
- // because we look for equivalence not equality, and
- // because it's easy.
- // If there are many paradigm LSRs we should use a hash set
- // with custom comparator and hasher.
- U_ASSERT(paradigmLSRsLength <= 15);
- for (int32_t i = 0; i < paradigmLSRsLength; ++i) {
- if (lsr.isEquivalentTo(paradigmLSRs[i])) { return true; }
- }
- return false;
-}
-
-U_NAMESPACE_END
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// locdistance.cpp
+// created: 2019may08 Markus W. Scherer
+
+#include "unicode/utypes.h"
+#include "unicode/bytestrie.h"
+#include "unicode/localematcher.h"
+#include "unicode/locid.h"
+#include "unicode/uobject.h"
+#include "unicode/ures.h"
+#include "cstring.h"
+#include "locdistance.h"
+#include "loclikelysubtags.h"
+#include "uassert.h"
+#include "ucln_cmn.h"
+#include "uinvchar.h"
+#include "umutex.h"
+
+U_NAMESPACE_BEGIN
+
+namespace {
+
+/**
+ * Bit flag used on the last character of a subtag in the trie.
+ * Must be set consistently by the builder and the lookup code.
+ */
+constexpr int32_t END_OF_SUBTAG = 0x80;
+/** Distance value bit flag, set by the builder. */
+constexpr int32_t DISTANCE_SKIP_SCRIPT = 0x80;
+/** Distance value bit flag, set by trieNext(). */
+constexpr int32_t DISTANCE_IS_FINAL = 0x100;
+constexpr int32_t DISTANCE_IS_FINAL_OR_SKIP_SCRIPT = DISTANCE_IS_FINAL | DISTANCE_SKIP_SCRIPT;
+
+constexpr int32_t ABOVE_THRESHOLD = 100;
+
+// Indexes into array of distances.
+enum {
+ IX_DEF_LANG_DISTANCE,
+ IX_DEF_SCRIPT_DISTANCE,
+ IX_DEF_REGION_DISTANCE,
+ IX_MIN_REGION_DISTANCE,
+ IX_LIMIT
+};
+
+LocaleDistance *gLocaleDistance = nullptr;
+UInitOnce gInitOnce = U_INITONCE_INITIALIZER;
+
+UBool U_CALLCONV cleanup() {
+ delete gLocaleDistance;
+ gLocaleDistance = nullptr;
+ gInitOnce.reset();
+ return TRUE;
+}
+
+} // namespace
+
+void U_CALLCONV LocaleDistance::initLocaleDistance(UErrorCode &errorCode) {
+ // This function is invoked only via umtx_initOnce().
+ U_ASSERT(gLocaleDistance == nullptr);
+ const XLikelySubtags &likely = *XLikelySubtags::getSingleton(errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ const LocaleDistanceData &data = likely.getDistanceData();
+ if (data.distanceTrieBytes == nullptr ||
+ data.regionToPartitions == nullptr || data.partitions == nullptr ||
+ // ok if no paradigms
+ data.distances == nullptr) {
+ errorCode = U_MISSING_RESOURCE_ERROR;
+ return;
+ }
+ gLocaleDistance = new LocaleDistance(data, likely);
+ if (gLocaleDistance == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ ucln_common_registerCleanup(UCLN_COMMON_LOCALE_DISTANCE, cleanup);
+}
+
+const LocaleDistance *LocaleDistance::getSingleton(UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return nullptr; }
+ umtx_initOnce(gInitOnce, &LocaleDistance::initLocaleDistance, errorCode);
+ return gLocaleDistance;
+}
+
+LocaleDistance::LocaleDistance(const LocaleDistanceData &data, const XLikelySubtags &likely) :
+ likelySubtags(likely),
+ trie(data.distanceTrieBytes),
+ regionToPartitionsIndex(data.regionToPartitions), partitionArrays(data.partitions),
+ paradigmLSRs(data.paradigms), paradigmLSRsLength(data.paradigmsLength),
+ defaultLanguageDistance(data.distances[IX_DEF_LANG_DISTANCE]),
+ defaultScriptDistance(data.distances[IX_DEF_SCRIPT_DISTANCE]),
+ defaultRegionDistance(data.distances[IX_DEF_REGION_DISTANCE]),
+ minRegionDistance(data.distances[IX_MIN_REGION_DISTANCE]) {
+ // For the default demotion value, use the
+ // default region distance between unrelated Englishes.
+ // Thus, unless demotion is turned off,
+ // a mere region difference for one desired locale
+ // is as good as a perfect match for the next following desired locale.
+ // As of CLDR 36, we have <languageMatch desired="en_*_*" supported="en_*_*" distance="5"/>.
+ LSR en("en", "Latn", "US", LSR::EXPLICIT_LSR);
+ LSR enGB("en", "Latn", "GB", LSR::EXPLICIT_LSR);
+ const LSR *p_enGB = &enGB;
+ int32_t indexAndDistance = getBestIndexAndDistance(en, &p_enGB, 1,
+ shiftDistance(50), ULOCMATCH_FAVOR_LANGUAGE, ULOCMATCH_DIRECTION_WITH_ONE_WAY);
+ defaultDemotionPerDesiredLocale = getDistanceFloor(indexAndDistance);
+}
+
+int32_t LocaleDistance::getBestIndexAndDistance(
+ const LSR &desired,
+ const LSR **supportedLSRs, int32_t supportedLSRsLength,
+ int32_t shiftedThreshold,
+ ULocMatchFavorSubtag favorSubtag, ULocMatchDirection direction) const {
+ BytesTrie iter(trie);
+ // Look up the desired language only once for all supported LSRs.
+ // Its "distance" is either a match point value of 0, or a non-match negative value.
+ // Note: The data builder verifies that there are no <*, supported> or <desired, *> rules.
+ int32_t desLangDistance = trieNext(iter, desired.language, false);
+ uint64_t desLangState = desLangDistance >= 0 && supportedLSRsLength > 1 ? iter.getState64() : 0;
+ // Index of the supported LSR with the lowest distance.
+ int32_t bestIndex = -1;
+ // Cached lookup info from XLikelySubtags.compareLikely().
+ int32_t bestLikelyInfo = -1;
+ for (int32_t slIndex = 0; slIndex < supportedLSRsLength; ++slIndex) {
+ const LSR &supported = *supportedLSRs[slIndex];
+ bool star = false;
+ int32_t distance = desLangDistance;
+ if (distance >= 0) {
+ U_ASSERT((distance & DISTANCE_IS_FINAL) == 0);
+ if (slIndex != 0) {
+ iter.resetToState64(desLangState);
+ }
+ distance = trieNext(iter, supported.language, true);
+ }
+ // Note: The data builder verifies that there are no rules with "any" (*) language and
+ // real (non *) script or region subtags.
+ // This means that if the lookup for either language fails we can use
+ // the default distances without further lookups.
+ int32_t flags;
+ if (distance >= 0) {
+ flags = distance & DISTANCE_IS_FINAL_OR_SKIP_SCRIPT;
+ distance &= ~DISTANCE_IS_FINAL_OR_SKIP_SCRIPT;
+ } else { // <*, *>
+ if (uprv_strcmp(desired.language, supported.language) == 0) {
+ distance = 0;
+ } else {
+ distance = defaultLanguageDistance;
+ }
+ flags = 0;
+ star = true;
+ }
+ U_ASSERT(0 <= distance && distance <= 100);
+ // Round up the shifted threshold (if fraction bits are not 0)
+ // for comparison with un-shifted distances until we need fraction bits.
+ // (If we simply shifted non-zero fraction bits away, then we might ignore a language
+ // when it's really still a micro distance below the threshold.)
+ int32_t roundedThreshold = (shiftedThreshold + DISTANCE_FRACTION_MASK) >> DISTANCE_SHIFT;
+ // We implement "favor subtag" by reducing the language subtag distance
+ // (unscientifically reducing it to a quarter of the normal value),
+ // so that the script distance is relatively more important.
+ // For example, given a default language distance of 80, we reduce it to 20,
+ // which is below the default threshold of 50, which is the default script distance.
+ if (favorSubtag == ULOCMATCH_FAVOR_SCRIPT) {
+ distance >>= 2;
+ }
+ // Let distance == roundedThreshold pass until the tie-breaker logic
+ // at the end of the loop.
+ if (distance > roundedThreshold) {
+ continue;
+ }
+
+ int32_t scriptDistance;
+ if (star || flags != 0) {
+ if (uprv_strcmp(desired.script, supported.script) == 0) {
+ scriptDistance = 0;
+ } else {
+ scriptDistance = defaultScriptDistance;
+ }
+ } else {
+ scriptDistance = getDesSuppScriptDistance(iter, iter.getState64(),
+ desired.script, supported.script);
+ flags = scriptDistance & DISTANCE_IS_FINAL;
+ scriptDistance &= ~DISTANCE_IS_FINAL;
+ }
+ distance += scriptDistance;
+ if (distance > roundedThreshold) {
+ continue;
+ }
+
+ if (uprv_strcmp(desired.region, supported.region) == 0) {
+ // regionDistance = 0
+ } else if (star || (flags & DISTANCE_IS_FINAL) != 0) {
+ distance += defaultRegionDistance;
+ } else {
+ int32_t remainingThreshold = roundedThreshold - distance;
+ if (minRegionDistance > remainingThreshold) {
+ continue;
+ }
+
+ // From here on we know the regions are not equal.
+ // Map each region to zero or more partitions. (zero = one non-matching string)
+ // (Each array of single-character partition strings is encoded as one string.)
+ // If either side has more than one, then we find the maximum distance.
+ // This could be optimized by adding some more structure, but probably not worth it.
+ distance += getRegionPartitionsDistance(
+ iter, iter.getState64(),
+ partitionsForRegion(desired),
+ partitionsForRegion(supported),
+ remainingThreshold);
+ }
+ int32_t shiftedDistance = shiftDistance(distance);
+ if (shiftedDistance == 0) {
+ // Distinguish between equivalent but originally unequal locales via an
+ // additional micro distance.
+ shiftedDistance |= (desired.flags ^ supported.flags);
+ if (shiftedDistance < shiftedThreshold) {
+ if (direction != ULOCMATCH_DIRECTION_ONLY_TWO_WAY ||
+ // Is there also a match when we swap desired/supported?
+ isMatch(supported, desired, shiftedThreshold, favorSubtag)) {
+ if (shiftedDistance == 0) {
+ return slIndex << INDEX_SHIFT;
+ }
+ bestIndex = slIndex;
+ shiftedThreshold = shiftedDistance;
+ bestLikelyInfo = -1;
+ }
+ }
+ } else {
+ if (shiftedDistance < shiftedThreshold) {
+ if (direction != ULOCMATCH_DIRECTION_ONLY_TWO_WAY ||
+ // Is there also a match when we swap desired/supported?
+ isMatch(supported, desired, shiftedThreshold, favorSubtag)) {
+ bestIndex = slIndex;
+ shiftedThreshold = shiftedDistance;
+ bestLikelyInfo = -1;
+ }
+ } else if (shiftedDistance == shiftedThreshold && bestIndex >= 0) {
+ if (direction != ULOCMATCH_DIRECTION_ONLY_TWO_WAY ||
+ // Is there also a match when we swap desired/supported?
+ isMatch(supported, desired, shiftedThreshold, favorSubtag)) {
+ bestLikelyInfo = likelySubtags.compareLikely(
+ supported, *supportedLSRs[bestIndex], bestLikelyInfo);
+ if ((bestLikelyInfo & 1) != 0) {
+ // This supported locale matches as well as the previous best match,
+ // and neither matches perfectly,
+ // but this one is "more likely" (has more-default subtags).
+ bestIndex = slIndex;
+ }
+ }
+ }
+ }
+ }
+ return bestIndex >= 0 ?
+ (bestIndex << INDEX_SHIFT) | shiftedThreshold :
+ INDEX_NEG_1 | shiftDistance(ABOVE_THRESHOLD);
+}
+
+int32_t LocaleDistance::getDesSuppScriptDistance(
+ BytesTrie &iter, uint64_t startState, const char *desired, const char *supported) {
+ // Note: The data builder verifies that there are no <*, supported> or <desired, *> rules.
+ int32_t distance = trieNext(iter, desired, false);
+ if (distance >= 0) {
+ distance = trieNext(iter, supported, true);
+ }
+ if (distance < 0) {
+ UStringTrieResult result = iter.resetToState64(startState).next(u'*'); // <*, *>
+ U_ASSERT(USTRINGTRIE_HAS_VALUE(result));
+ if (uprv_strcmp(desired, supported) == 0) {
+ distance = 0; // same script
+ } else {
+ distance = iter.getValue();
+ U_ASSERT(distance >= 0);
+ }
+ if (result == USTRINGTRIE_FINAL_VALUE) {
+ distance |= DISTANCE_IS_FINAL;
+ }
+ }
+ return distance;
+}
+
+int32_t LocaleDistance::getRegionPartitionsDistance(
+ BytesTrie &iter, uint64_t startState,
+ const char *desiredPartitions, const char *supportedPartitions, int32_t threshold) {
+ char desired = *desiredPartitions++;
+ char supported = *supportedPartitions++;
+ U_ASSERT(desired != 0 && supported != 0);
+ // See if we have single desired/supported partitions, from NUL-terminated
+ // partition strings without explicit length.
+ bool suppLengthGt1 = *supportedPartitions != 0; // gt1: more than 1 character
+ // equivalent to: if (desLength == 1 && suppLength == 1)
+ if (*desiredPartitions == 0 && !suppLengthGt1) {
+ // Fastpath for single desired/supported partitions.
+ UStringTrieResult result = iter.next(uprv_invCharToAscii(desired) | END_OF_SUBTAG);
+ if (USTRINGTRIE_HAS_NEXT(result)) {
+ result = iter.next(uprv_invCharToAscii(supported) | END_OF_SUBTAG);
+ if (USTRINGTRIE_HAS_VALUE(result)) {
+ return iter.getValue();
+ }
+ }
+ return getFallbackRegionDistance(iter, startState);
+ }
+
+ const char *supportedStart = supportedPartitions - 1; // for restart of inner loop
+ int32_t regionDistance = 0;
+ // Fall back to * only once, not for each pair of partition strings.
+ bool star = false;
+ for (;;) {
+ // Look up each desired-partition string only once,
+ // not for each (desired, supported) pair.
+ UStringTrieResult result = iter.next(uprv_invCharToAscii(desired) | END_OF_SUBTAG);
+ if (USTRINGTRIE_HAS_NEXT(result)) {
+ uint64_t desState = suppLengthGt1 ? iter.getState64() : 0;
+ for (;;) {
+ result = iter.next(uprv_invCharToAscii(supported) | END_OF_SUBTAG);
+ int32_t d;
+ if (USTRINGTRIE_HAS_VALUE(result)) {
+ d = iter.getValue();
+ } else if (star) {
+ d = 0;
+ } else {
+ d = getFallbackRegionDistance(iter, startState);
+ star = true;
+ }
+ if (d > threshold) {
+ return d;
+ } else if (regionDistance < d) {
+ regionDistance = d;
+ }
+ if ((supported = *supportedPartitions++) != 0) {
+ iter.resetToState64(desState);
+ } else {
+ break;
+ }
+ }
+ } else if (!star) {
+ int32_t d = getFallbackRegionDistance(iter, startState);
+ if (d > threshold) {
+ return d;
+ } else if (regionDistance < d) {
+ regionDistance = d;
+ }
+ star = true;
+ }
+ if ((desired = *desiredPartitions++) != 0) {
+ iter.resetToState64(startState);
+ supportedPartitions = supportedStart;
+ supported = *supportedPartitions++;
+ } else {
+ break;
+ }
+ }
+ return regionDistance;
+}
+
+int32_t LocaleDistance::getFallbackRegionDistance(BytesTrie &iter, uint64_t startState) {
+#if U_DEBUG
+ UStringTrieResult result =
+#endif
+ iter.resetToState64(startState).next(u'*'); // <*, *>
+ U_ASSERT(USTRINGTRIE_HAS_VALUE(result));
+ int32_t distance = iter.getValue();
+ U_ASSERT(distance >= 0);
+ return distance;
+}
+
+int32_t LocaleDistance::trieNext(BytesTrie &iter, const char *s, bool wantValue) {
+ uint8_t c;
+ if ((c = *s) == 0) {
+ return -1; // no empty subtags in the distance data
+ }
+ for (;;) {
+ c = uprv_invCharToAscii(c);
+ // EBCDIC: If *s is not an invariant character,
+ // then c is now 0 and will simply not match anything, which is harmless.
+ uint8_t next = *++s;
+ if (next != 0) {
+ if (!USTRINGTRIE_HAS_NEXT(iter.next(c))) {
+ return -1;
+ }
+ } else {
+ // last character of this subtag
+ UStringTrieResult result = iter.next(c | END_OF_SUBTAG);
+ if (wantValue) {
+ if (USTRINGTRIE_HAS_VALUE(result)) {
+ int32_t value = iter.getValue();
+ if (result == USTRINGTRIE_FINAL_VALUE) {
+ value |= DISTANCE_IS_FINAL;
+ }
+ return value;
+ }
+ } else {
+ if (USTRINGTRIE_HAS_NEXT(result)) {
+ return 0;
+ }
+ }
+ return -1;
+ }
+ c = next;
+ }
+}
+
+UBool LocaleDistance::isParadigmLSR(const LSR &lsr) const {
+ // Linear search for a very short list (length 6 as of 2019),
+ // because we look for equivalence not equality, and
+ // because it's easy.
+ // If there are many paradigm LSRs we should use a hash set
+ // with custom comparator and hasher.
+ U_ASSERT(paradigmLSRsLength <= 15);
+ for (int32_t i = 0; i < paradigmLSRsLength; ++i) {
+ if (lsr.isEquivalentTo(paradigmLSRs[i])) { return true; }
+ }
+ return false;
+}
+
+U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/locdistance.h b/contrib/libs/icu/common/locdistance.h
index 4c85746923..ad84151383 100644
--- a/contrib/libs/icu/common/locdistance.h
+++ b/contrib/libs/icu/common/locdistance.h
@@ -1,151 +1,151 @@
-// © 2019 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html#License
-
-// locdistance.h
-// created: 2019may08 Markus W. Scherer
-
-#ifndef __LOCDISTANCE_H__
-#define __LOCDISTANCE_H__
-
-#include "unicode/utypes.h"
-#include "unicode/bytestrie.h"
-#include "unicode/localematcher.h"
-#include "unicode/locid.h"
-#include "unicode/uobject.h"
-#include "lsr.h"
-
-U_NAMESPACE_BEGIN
-
-struct LocaleDistanceData;
-
-/**
- * Offline-built data for LocaleMatcher.
- * Mostly but not only the data for mapping locales to their maximized forms.
- */
-class LocaleDistance final : public UMemory {
-public:
- static const LocaleDistance *getSingleton(UErrorCode &errorCode);
-
- static int32_t shiftDistance(int32_t distance) {
- return distance << DISTANCE_SHIFT;
- }
-
- static int32_t getShiftedDistance(int32_t indexAndDistance) {
- return indexAndDistance & DISTANCE_MASK;
- }
-
- static double getDistanceDouble(int32_t indexAndDistance) {
- double shiftedDistance = getShiftedDistance(indexAndDistance);
- return shiftedDistance / (1 << DISTANCE_SHIFT);
- }
-
- static int32_t getIndex(int32_t indexAndDistance) {
- // assert indexAndDistance >= 0;
- return indexAndDistance >> INDEX_SHIFT;
- }
-
- /**
- * Finds the supported LSR with the smallest distance from the desired one.
- * Equivalent LSR subtags must be normalized into a canonical form.
- *
- * <p>Returns the index of the lowest-distance supported LSR in the high bits
- * (negative if none has a distance below the threshold),
- * and its distance (0..ABOVE_THRESHOLD) in the low bits.
- */
- int32_t getBestIndexAndDistance(const LSR &desired,
- const LSR **supportedLSRs, int32_t supportedLSRsLength,
- int32_t shiftedThreshold,
- ULocMatchFavorSubtag favorSubtag,
- ULocMatchDirection direction) const;
-
- UBool isParadigmLSR(const LSR &lsr) const;
-
- int32_t getDefaultScriptDistance() const {
- return defaultScriptDistance;
- }
-
- int32_t getDefaultDemotionPerDesiredLocale() const {
- return defaultDemotionPerDesiredLocale;
- }
-
-private:
- // The distance is shifted left to gain some fraction bits.
- static constexpr int32_t DISTANCE_SHIFT = 3;
- static constexpr int32_t DISTANCE_FRACTION_MASK = 7;
- // 7 bits for 0..100
- static constexpr int32_t DISTANCE_INT_SHIFT = 7;
- static constexpr int32_t INDEX_SHIFT = DISTANCE_INT_SHIFT + DISTANCE_SHIFT;
- static constexpr int32_t DISTANCE_MASK = 0x3ff;
- // 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;
-
- static void initLocaleDistance(UErrorCode &errorCode);
-
- UBool isMatch(const LSR &desired, const LSR &supported,
- int32_t shiftedThreshold, ULocMatchFavorSubtag favorSubtag) const {
- const LSR *pSupp = &supported;
- return getBestIndexAndDistance(
- desired, &pSupp, 1,
- shiftedThreshold, favorSubtag, ULOCMATCH_DIRECTION_WITH_ONE_WAY) >= 0;
- }
-
- static int32_t getDesSuppScriptDistance(BytesTrie &iter, uint64_t startState,
- const char *desired, const char *supported);
-
- static int32_t getRegionPartitionsDistance(
- BytesTrie &iter, uint64_t startState,
- const char *desiredPartitions, const char *supportedPartitions,
- int32_t threshold);
-
- static int32_t getFallbackRegionDistance(BytesTrie &iter, uint64_t startState);
-
- static int32_t trieNext(BytesTrie &iter, const char *s, bool wantValue);
-
- const char *partitionsForRegion(const LSR &lsr) const {
- // ill-formed region -> one non-matching string
- int32_t pIndex = regionToPartitionsIndex[lsr.regionIndex];
- return partitionArrays[pIndex];
- }
-
- int32_t getDefaultRegionDistance() const {
- return defaultRegionDistance;
- }
-
- const XLikelySubtags &likelySubtags;
-
- // The trie maps each dlang+slang+dscript+sscript+dregion+sregion
- // (encoded in ASCII with bit 7 set on the last character of each subtag) to a distance.
- // There is also a trie value for each subsequence of whole subtags.
- // One '*' is used for a (desired, supported) pair of "und", "Zzzz"/"", or "ZZ"/"".
- BytesTrie trie;
-
- /**
- * Maps each region to zero or more single-character partitions.
- */
- const uint8_t *regionToPartitionsIndex;
- const char **partitionArrays;
-
- /**
- * Used to get the paradigm region for a cluster, if there is one.
- */
- const LSR *paradigmLSRs;
- int32_t paradigmLSRsLength;
-
- int32_t defaultLanguageDistance;
- int32_t defaultScriptDistance;
- int32_t defaultRegionDistance;
- int32_t minRegionDistance;
- int32_t defaultDemotionPerDesiredLocale;
-};
-
-U_NAMESPACE_END
-
-#endif // __LOCDISTANCE_H__
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// locdistance.h
+// created: 2019may08 Markus W. Scherer
+
+#ifndef __LOCDISTANCE_H__
+#define __LOCDISTANCE_H__
+
+#include "unicode/utypes.h"
+#include "unicode/bytestrie.h"
+#include "unicode/localematcher.h"
+#include "unicode/locid.h"
+#include "unicode/uobject.h"
+#include "lsr.h"
+
+U_NAMESPACE_BEGIN
+
+struct LocaleDistanceData;
+
+/**
+ * Offline-built data for LocaleMatcher.
+ * Mostly but not only the data for mapping locales to their maximized forms.
+ */
+class LocaleDistance final : public UMemory {
+public:
+ static const LocaleDistance *getSingleton(UErrorCode &errorCode);
+
+ static int32_t shiftDistance(int32_t distance) {
+ return distance << DISTANCE_SHIFT;
+ }
+
+ static int32_t getShiftedDistance(int32_t indexAndDistance) {
+ return indexAndDistance & DISTANCE_MASK;
+ }
+
+ static double getDistanceDouble(int32_t indexAndDistance) {
+ double shiftedDistance = getShiftedDistance(indexAndDistance);
+ return shiftedDistance / (1 << DISTANCE_SHIFT);
+ }
+
+ static int32_t getIndex(int32_t indexAndDistance) {
+ // assert indexAndDistance >= 0;
+ return indexAndDistance >> INDEX_SHIFT;
+ }
+
+ /**
+ * Finds the supported LSR with the smallest distance from the desired one.
+ * Equivalent LSR subtags must be normalized into a canonical form.
+ *
+ * <p>Returns the index of the lowest-distance supported LSR in the high bits
+ * (negative if none has a distance below the threshold),
+ * and its distance (0..ABOVE_THRESHOLD) in the low bits.
+ */
+ int32_t getBestIndexAndDistance(const LSR &desired,
+ const LSR **supportedLSRs, int32_t supportedLSRsLength,
+ int32_t shiftedThreshold,
+ ULocMatchFavorSubtag favorSubtag,
+ ULocMatchDirection direction) const;
+
+ UBool isParadigmLSR(const LSR &lsr) const;
+
+ int32_t getDefaultScriptDistance() const {
+ return defaultScriptDistance;
+ }
+
+ int32_t getDefaultDemotionPerDesiredLocale() const {
+ return defaultDemotionPerDesiredLocale;
+ }
+
+private:
+ // The distance is shifted left to gain some fraction bits.
+ static constexpr int32_t DISTANCE_SHIFT = 3;
+ static constexpr int32_t DISTANCE_FRACTION_MASK = 7;
+ // 7 bits for 0..100
+ static constexpr int32_t DISTANCE_INT_SHIFT = 7;
+ static constexpr int32_t INDEX_SHIFT = DISTANCE_INT_SHIFT + DISTANCE_SHIFT;
+ static constexpr int32_t DISTANCE_MASK = 0x3ff;
+ // 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;
+
+ static void initLocaleDistance(UErrorCode &errorCode);
+
+ UBool isMatch(const LSR &desired, const LSR &supported,
+ int32_t shiftedThreshold, ULocMatchFavorSubtag favorSubtag) const {
+ const LSR *pSupp = &supported;
+ return getBestIndexAndDistance(
+ desired, &pSupp, 1,
+ shiftedThreshold, favorSubtag, ULOCMATCH_DIRECTION_WITH_ONE_WAY) >= 0;
+ }
+
+ static int32_t getDesSuppScriptDistance(BytesTrie &iter, uint64_t startState,
+ const char *desired, const char *supported);
+
+ static int32_t getRegionPartitionsDistance(
+ BytesTrie &iter, uint64_t startState,
+ const char *desiredPartitions, const char *supportedPartitions,
+ int32_t threshold);
+
+ static int32_t getFallbackRegionDistance(BytesTrie &iter, uint64_t startState);
+
+ static int32_t trieNext(BytesTrie &iter, const char *s, bool wantValue);
+
+ const char *partitionsForRegion(const LSR &lsr) const {
+ // ill-formed region -> one non-matching string
+ int32_t pIndex = regionToPartitionsIndex[lsr.regionIndex];
+ return partitionArrays[pIndex];
+ }
+
+ int32_t getDefaultRegionDistance() const {
+ return defaultRegionDistance;
+ }
+
+ const XLikelySubtags &likelySubtags;
+
+ // The trie maps each dlang+slang+dscript+sscript+dregion+sregion
+ // (encoded in ASCII with bit 7 set on the last character of each subtag) to a distance.
+ // There is also a trie value for each subsequence of whole subtags.
+ // One '*' is used for a (desired, supported) pair of "und", "Zzzz"/"", or "ZZ"/"".
+ BytesTrie trie;
+
+ /**
+ * Maps each region to zero or more single-character partitions.
+ */
+ const uint8_t *regionToPartitionsIndex;
+ const char **partitionArrays;
+
+ /**
+ * Used to get the paradigm region for a cluster, if there is one.
+ */
+ const LSR *paradigmLSRs;
+ int32_t paradigmLSRsLength;
+
+ int32_t defaultLanguageDistance;
+ int32_t defaultScriptDistance;
+ int32_t defaultRegionDistance;
+ int32_t minRegionDistance;
+ int32_t defaultDemotionPerDesiredLocale;
+};
+
+U_NAMESPACE_END
+
+#endif // __LOCDISTANCE_H__
diff --git a/contrib/libs/icu/common/locdspnm.cpp b/contrib/libs/icu/common/locdspnm.cpp
index a81f5a69d0..43334f5196 100644
--- a/contrib/libs/icu/common/locdspnm.cpp
+++ b/contrib/libs/icu/common/locdspnm.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -13,7 +13,7 @@
#include "unicode/locdspnm.h"
#include "unicode/simpleformatter.h"
-#include "unicode/ucasemap.h"
+#include "unicode/ucasemap.h"
#include "unicode/ures.h"
#include "unicode/udisplaycontext.h"
#include "unicode/brkiter.h"
@@ -45,16 +45,16 @@ static int32_t ncat(char *buffer, uint32_t buflen, ...) {
}
va_start(args, buflen);
- while ((str = va_arg(args, char *)) != 0) {
+ while ((str = va_arg(args, char *)) != 0) {
char c;
- while (p != e && (c = *str++) != 0) {
+ while (p != e && (c = *str++) != 0) {
*p++ = c;
}
}
*p = 0;
va_end(args);
- return static_cast<int32_t>(p - buffer);
+ return static_cast<int32_t>(p - buffer);
}
U_NAMESPACE_BEGIN
@@ -98,7 +98,7 @@ ICUDataTable::ICUDataTable(const char* path, const Locale& locale)
: path(NULL), locale(Locale::getRoot())
{
if (path) {
- int32_t len = static_cast<int32_t>(uprv_strlen(path));
+ int32_t len = static_cast<int32_t>(uprv_strlen(path));
this->path = (const char*) uprv_malloc(len + 1);
if (this->path) {
uprv_strcpy((char *)this->path, path);
@@ -291,7 +291,7 @@ class LocaleDisplayNamesImpl : public LocaleDisplayNames {
UnicodeString formatCloseParen;
UnicodeString formatReplaceCloseParen;
UDisplayContext nameLength;
- UDisplayContext substitute;
+ UDisplayContext substitute;
// Constants for capitalization context usage types.
enum CapContextUsage {
@@ -338,7 +338,7 @@ public:
UnicodeString& result) const;
private:
UnicodeString& localeIdName(const char* localeId,
- UnicodeString& result, bool substitute) const;
+ UnicodeString& result, bool substitute) const;
UnicodeString& appendWithSep(UnicodeString& buffer, const UnicodeString& src) const;
UnicodeString& adjustForUsageAndContext(CapContextUsage usage, UnicodeString& result) const;
UnicodeString& scriptDisplayName(const char* script, UnicodeString& result, UBool skipAdjust) const;
@@ -360,7 +360,7 @@ LocaleDisplayNamesImpl::LocaleDisplayNamesImpl(const Locale& locale,
, capitalizationContext(UDISPCTX_CAPITALIZATION_NONE)
, capitalizationBrkIter(NULL)
, nameLength(UDISPCTX_LENGTH_FULL)
- , substitute(UDISPCTX_SUBSTITUTE)
+ , substitute(UDISPCTX_SUBSTITUTE)
{
initialize();
}
@@ -373,7 +373,7 @@ LocaleDisplayNamesImpl::LocaleDisplayNamesImpl(const Locale& locale,
, capitalizationContext(UDISPCTX_CAPITALIZATION_NONE)
, capitalizationBrkIter(NULL)
, nameLength(UDISPCTX_LENGTH_FULL)
- , substitute(UDISPCTX_SUBSTITUTE)
+ , substitute(UDISPCTX_SUBSTITUTE)
{
while (length-- > 0) {
UDisplayContext value = *contexts++;
@@ -388,9 +388,9 @@ LocaleDisplayNamesImpl::LocaleDisplayNamesImpl(const Locale& locale,
case UDISPCTX_TYPE_DISPLAY_LENGTH:
nameLength = value;
break;
- case UDISPCTX_TYPE_SUBSTITUTE_HANDLING:
- substitute = value;
- break;
+ case UDISPCTX_TYPE_SUBSTITUTE_HANDLING:
+ substitute = value;
+ break;
default:
break;
}
@@ -541,8 +541,8 @@ LocaleDisplayNamesImpl::getContext(UDisplayContextType type) const {
return capitalizationContext;
case UDISPCTX_TYPE_DISPLAY_LENGTH:
return nameLength;
- case UDISPCTX_TYPE_SUBSTITUTE_HANDLING:
- return substitute;
+ case UDISPCTX_TYPE_SUBSTITUTE_HANDLING:
+ return substitute;
default:
break;
}
@@ -557,7 +557,7 @@ LocaleDisplayNamesImpl::adjustForUsageAndContext(CapContextUsage usage,
if ( result.length() > 0 && u_islower(result.char32At(0)) && capitalizationBrkIter!= NULL &&
( capitalizationContext==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE || fCapitalization[usage] ) ) {
// note fCapitalization[usage] won't be set unless capitalizationContext is UI_LIST_OR_MENU or STANDALONE
- static UMutex capitalizationBrkIterLock;
+ static UMutex capitalizationBrkIterLock;
Mutex lock(&capitalizationBrkIterLock);
result.toTitle(capitalizationBrkIter, locale, U_TITLECASE_NO_LOWERCASE | U_TITLECASE_NO_BREAK_ADJUSTMENT);
}
@@ -566,21 +566,21 @@ LocaleDisplayNamesImpl::adjustForUsageAndContext(CapContextUsage usage,
}
UnicodeString&
-LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc,
+LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc,
UnicodeString& result) const {
- if (loc.isBogus()) {
+ if (loc.isBogus()) {
result.setToBogus();
return result;
}
UnicodeString resultName;
- const char* lang = loc.getLanguage();
+ const char* lang = loc.getLanguage();
if (uprv_strlen(lang) == 0) {
lang = "root";
}
- const char* script = loc.getScript();
- const char* country = loc.getCountry();
- const char* variant = loc.getVariant();
+ const char* script = loc.getScript();
+ const char* country = loc.getCountry();
+ const char* variant = loc.getVariant();
UBool hasScript = uprv_strlen(script) > 0;
UBool hasCountry = uprv_strlen(country) > 0;
@@ -591,7 +591,7 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc,
do { // loop construct is so we can break early out of search
if (hasScript && hasCountry) {
ncat(buffer, ULOC_FULLNAME_CAPACITY, lang, "_", script, "_", country, (char *)0);
- localeIdName(buffer, resultName, false);
+ localeIdName(buffer, resultName, false);
if (!resultName.isBogus()) {
hasScript = FALSE;
hasCountry = FALSE;
@@ -600,7 +600,7 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc,
}
if (hasScript) {
ncat(buffer, ULOC_FULLNAME_CAPACITY, lang, "_", script, (char *)0);
- localeIdName(buffer, resultName, false);
+ localeIdName(buffer, resultName, false);
if (!resultName.isBogus()) {
hasScript = FALSE;
break;
@@ -608,7 +608,7 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc,
}
if (hasCountry) {
ncat(buffer, ULOC_FULLNAME_CAPACITY, lang, "_", country, (char*)0);
- localeIdName(buffer, resultName, false);
+ localeIdName(buffer, resultName, false);
if (!resultName.isBogus()) {
hasCountry = FALSE;
break;
@@ -617,11 +617,11 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc,
} while (FALSE);
}
if (resultName.isBogus() || resultName.isEmpty()) {
- localeIdName(lang, resultName, substitute == UDISPCTX_SUBSTITUTE);
- if (resultName.isBogus()) {
- result.setToBogus();
- return result;
- }
+ localeIdName(lang, resultName, substitute == UDISPCTX_SUBSTITUTE);
+ if (resultName.isBogus()) {
+ result.setToBogus();
+ return result;
+ }
}
UnicodeString resultRemainder;
@@ -629,41 +629,41 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc,
UErrorCode status = U_ZERO_ERROR;
if (hasScript) {
- UnicodeString script_str = scriptDisplayName(script, temp, TRUE);
- if (script_str.isBogus()) {
- result.setToBogus();
- return result;
- }
- resultRemainder.append(script_str);
+ UnicodeString script_str = scriptDisplayName(script, temp, TRUE);
+ if (script_str.isBogus()) {
+ result.setToBogus();
+ return result;
+ }
+ resultRemainder.append(script_str);
}
if (hasCountry) {
- UnicodeString region_str = regionDisplayName(country, temp, TRUE);
- if (region_str.isBogus()) {
- result.setToBogus();
- return result;
- }
- appendWithSep(resultRemainder, region_str);
+ UnicodeString region_str = regionDisplayName(country, temp, TRUE);
+ if (region_str.isBogus()) {
+ result.setToBogus();
+ return result;
+ }
+ appendWithSep(resultRemainder, region_str);
}
if (hasVariant) {
- UnicodeString variant_str = variantDisplayName(variant, temp, TRUE);
- if (variant_str.isBogus()) {
- result.setToBogus();
- return result;
- }
- appendWithSep(resultRemainder, variant_str);
+ UnicodeString variant_str = variantDisplayName(variant, temp, TRUE);
+ if (variant_str.isBogus()) {
+ result.setToBogus();
+ return result;
+ }
+ appendWithSep(resultRemainder, variant_str);
}
resultRemainder.findAndReplace(formatOpenParen, formatReplaceOpenParen);
resultRemainder.findAndReplace(formatCloseParen, formatReplaceCloseParen);
- LocalPointer<StringEnumeration> e(loc.createKeywords(status));
+ LocalPointer<StringEnumeration> e(loc.createKeywords(status));
if (e.isValid() && U_SUCCESS(status)) {
UnicodeString temp2;
char value[ULOC_KEYWORD_AND_VALUES_CAPACITY]; // sigh, no ULOC_VALUE_CAPACITY
const char* key;
while ((key = e->next((int32_t *)0, status)) != NULL) {
- value[0] = 0;
- loc.getKeywordValue(key, value, ULOC_KEYWORD_AND_VALUES_CAPACITY, status);
- if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING) {
+ value[0] = 0;
+ loc.getKeywordValue(key, value, ULOC_KEYWORD_AND_VALUES_CAPACITY, status);
+ if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING) {
return result;
}
keyDisplayName(key, temp, TRUE);
@@ -716,18 +716,18 @@ LocaleDisplayNamesImpl::localeDisplayName(const char* localeId,
// private
UnicodeString&
LocaleDisplayNamesImpl::localeIdName(const char* localeId,
- UnicodeString& result, bool substitute) const {
+ UnicodeString& result, bool substitute) const {
if (nameLength == UDISPCTX_LENGTH_SHORT) {
langData.getNoFallback("Languages%short", localeId, result);
if (!result.isBogus()) {
return result;
}
}
- if (substitute) {
- return langData.get("Languages", localeId, result);
- } else {
- return langData.getNoFallback("Languages", localeId, result);
- }
+ if (substitute) {
+ return langData.get("Languages", localeId, result);
+ } else {
+ return langData.getNoFallback("Languages", localeId, result);
+ }
}
UnicodeString&
@@ -737,16 +737,16 @@ LocaleDisplayNamesImpl::languageDisplayName(const char* lang,
return result = UnicodeString(lang, -1, US_INV);
}
if (nameLength == UDISPCTX_LENGTH_SHORT) {
- langData.getNoFallback("Languages%short", lang, result);
+ langData.getNoFallback("Languages%short", lang, result);
if (!result.isBogus()) {
return adjustForUsageAndContext(kCapContextUsageLanguage, result);
}
}
- if (substitute == UDISPCTX_SUBSTITUTE) {
- langData.get("Languages", lang, result);
- } else {
- langData.getNoFallback("Languages", lang, result);
- }
+ if (substitute == UDISPCTX_SUBSTITUTE) {
+ langData.get("Languages", lang, result);
+ } else {
+ langData.getNoFallback("Languages", lang, result);
+ }
return adjustForUsageAndContext(kCapContextUsageLanguage, result);
}
@@ -755,16 +755,16 @@ LocaleDisplayNamesImpl::scriptDisplayName(const char* script,
UnicodeString& result,
UBool skipAdjust) const {
if (nameLength == UDISPCTX_LENGTH_SHORT) {
- langData.getNoFallback("Scripts%short", script, result);
+ langData.getNoFallback("Scripts%short", script, result);
if (!result.isBogus()) {
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageScript, result);
}
}
- if (substitute == UDISPCTX_SUBSTITUTE) {
- langData.get("Scripts", script, result);
- } else {
- langData.getNoFallback("Scripts", script, result);
- }
+ if (substitute == UDISPCTX_SUBSTITUTE) {
+ langData.get("Scripts", script, result);
+ } else {
+ langData.getNoFallback("Scripts", script, result);
+ }
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageScript, result);
}
@@ -785,16 +785,16 @@ LocaleDisplayNamesImpl::regionDisplayName(const char* region,
UnicodeString& result,
UBool skipAdjust) const {
if (nameLength == UDISPCTX_LENGTH_SHORT) {
- regionData.getNoFallback("Countries%short", region, result);
+ regionData.getNoFallback("Countries%short", region, result);
if (!result.isBogus()) {
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageTerritory, result);
}
}
- if (substitute == UDISPCTX_SUBSTITUTE) {
- regionData.get("Countries", region, result);
- } else {
- regionData.getNoFallback("Countries", region, result);
- }
+ if (substitute == UDISPCTX_SUBSTITUTE) {
+ regionData.get("Countries", region, result);
+ } else {
+ regionData.getNoFallback("Countries", region, result);
+ }
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageTerritory, result);
}
@@ -810,11 +810,11 @@ LocaleDisplayNamesImpl::variantDisplayName(const char* variant,
UnicodeString& result,
UBool skipAdjust) const {
// don't have a resource for short variant names
- if (substitute == UDISPCTX_SUBSTITUTE) {
- langData.get("Variants", variant, result);
- } else {
- langData.getNoFallback("Variants", variant, result);
- }
+ if (substitute == UDISPCTX_SUBSTITUTE) {
+ langData.get("Variants", variant, result);
+ } else {
+ langData.getNoFallback("Variants", variant, result);
+ }
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageVariant, result);
}
@@ -829,11 +829,11 @@ LocaleDisplayNamesImpl::keyDisplayName(const char* key,
UnicodeString& result,
UBool skipAdjust) const {
// don't have a resource for short key names
- if (substitute == UDISPCTX_SUBSTITUTE) {
- langData.get("Keys", key, result);
- } else {
- langData.getNoFallback("Keys", key, result);
- }
+ if (substitute == UDISPCTX_SUBSTITUTE) {
+ langData.get("Keys", key, result);
+ } else {
+ langData.getNoFallback("Keys", key, result);
+ }
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageKey, result);
}
@@ -854,7 +854,7 @@ LocaleDisplayNamesImpl::keyValueDisplayName(const char* key,
UnicodeString ustrValue(value, -1, US_INV);
int32_t len;
const UChar *currencyName = ucurr_getName(ustrValue.getTerminatedBuffer(),
- locale.getBaseName(), UCURR_LONG_NAME, nullptr /* isChoiceFormat */, &len, &sts);
+ locale.getBaseName(), UCURR_LONG_NAME, nullptr /* isChoiceFormat */, &len, &sts);
if (U_FAILURE(sts)) {
// Return the value as is on failure
result = ustrValue;
@@ -865,16 +865,16 @@ LocaleDisplayNamesImpl::keyValueDisplayName(const char* key,
}
if (nameLength == UDISPCTX_LENGTH_SHORT) {
- langData.getNoFallback("Types%short", key, value, result);
+ langData.getNoFallback("Types%short", key, value, result);
if (!result.isBogus()) {
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageKeyValue, result);
}
}
- if (substitute == UDISPCTX_SUBSTITUTE) {
- langData.get("Types", key, value, result);
- } else {
- langData.getNoFallback("Types", key, value, result);
- }
+ if (substitute == UDISPCTX_SUBSTITUTE) {
+ langData.get("Types", key, value, result);
+ } else {
+ langData.getNoFallback("Types", key, value, result);
+ }
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageKeyValue, result);
}
diff --git a/contrib/libs/icu/common/locid.cpp b/contrib/libs/icu/common/locid.cpp
index 969f566490..753a452120 100644
--- a/contrib/libs/icu/common/locid.cpp
+++ b/contrib/libs/icu/common/locid.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -31,26 +31,26 @@
******************************************************************************
*/
-#include <utility>
+#include <utility>
-#include "unicode/bytestream.h"
+#include "unicode/bytestream.h"
#include "unicode/locid.h"
-#include "unicode/strenum.h"
-#include "unicode/stringpiece.h"
+#include "unicode/strenum.h"
+#include "unicode/stringpiece.h"
#include "unicode/uloc.h"
-#include "unicode/ures.h"
-
-#include "bytesinkutil.h"
-#include "charstr.h"
+#include "unicode/ures.h"
+
+#include "bytesinkutil.h"
+#include "charstr.h"
#include "cmemory.h"
#include "cstring.h"
-#include "mutex.h"
-#include "putilimp.h"
+#include "mutex.h"
+#include "putilimp.h"
#include "uassert.h"
-#include "ucln_cmn.h"
+#include "ucln_cmn.h"
#include "uhash.h"
-#include "ulocimp.h"
-#include "umutex.h"
+#include "ulocimp.h"
+#include "umutex.h"
#include "ustr_imp.h"
U_CDECL_BEGIN
@@ -63,7 +63,7 @@ static Locale *gLocaleCache = NULL;
static UInitOnce gLocaleCacheInitOnce = U_INITONCE_INITIALIZER;
// gDefaultLocaleMutex protects all access to gDefaultLocalesHashT and gDefaultLocale.
-static UMutex gDefaultLocaleMutex;
+static UMutex gDefaultLocaleMutex;
static UHashtable *gDefaultLocalesHashT = NULL;
static Locale *gDefaultLocale = NULL;
@@ -184,15 +184,15 @@ Locale *locale_set_default_internal(const char *id, UErrorCode& status) {
canonicalize = TRUE; // always canonicalize host ID
}
- CharString localeNameBuf;
- {
- CharStringByteSink sink(&localeNameBuf);
- if (canonicalize) {
- ulocimp_canonicalize(id, sink, &status);
- } else {
- ulocimp_getName(id, sink, &status);
- }
- }
+ CharString localeNameBuf;
+ {
+ CharStringByteSink sink(&localeNameBuf);
+ if (canonicalize) {
+ ulocimp_canonicalize(id, sink, &status);
+ } else {
+ ulocimp_getName(id, sink, &status);
+ }
+ }
if (U_FAILURE(status)) {
return gDefaultLocale;
@@ -207,14 +207,14 @@ Locale *locale_set_default_internal(const char *id, UErrorCode& status) {
ucln_common_registerCleanup(UCLN_COMMON_LOCALE, locale_cleanup);
}
- Locale *newDefault = (Locale *)uhash_get(gDefaultLocalesHashT, localeNameBuf.data());
+ Locale *newDefault = (Locale *)uhash_get(gDefaultLocalesHashT, localeNameBuf.data());
if (newDefault == NULL) {
newDefault = new Locale(Locale::eBOGUS);
if (newDefault == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return gDefaultLocale;
}
- newDefault->init(localeNameBuf.data(), FALSE);
+ newDefault->init(localeNameBuf.data(), FALSE);
uhash_put(gDefaultLocalesHashT, (char*) newDefault->getName(), newDefault, &status);
if (U_FAILURE(status)) {
return gDefaultLocale;
@@ -428,59 +428,59 @@ Locale::Locale(const Locale &other)
*this = other;
}
-Locale::Locale(Locale&& other) U_NOEXCEPT
- : UObject(other), fullName(fullNameBuffer), baseName(fullName) {
- *this = std::move(other);
-}
-
-Locale& Locale::operator=(const Locale& other) {
+Locale::Locale(Locale&& other) U_NOEXCEPT
+ : UObject(other), fullName(fullNameBuffer), baseName(fullName) {
+ *this = std::move(other);
+}
+
+Locale& Locale::operator=(const Locale& other) {
if (this == &other) {
return *this;
}
- setToBogus();
-
- if (other.fullName == other.fullNameBuffer) {
- uprv_strcpy(fullNameBuffer, other.fullNameBuffer);
- } else if (other.fullName == nullptr) {
- fullName = nullptr;
- } else {
- fullName = uprv_strdup(other.fullName);
- if (fullName == nullptr) return *this;
- }
-
- if (other.baseName == other.fullName) {
- baseName = fullName;
- } else if (other.baseName != nullptr) {
- baseName = uprv_strdup(other.baseName);
- if (baseName == nullptr) return *this;
- }
-
- uprv_strcpy(language, other.language);
- uprv_strcpy(script, other.script);
- uprv_strcpy(country, other.country);
-
- variantBegin = other.variantBegin;
- fIsBogus = other.fIsBogus;
-
- return *this;
-}
-
-Locale& Locale::operator=(Locale&& other) U_NOEXCEPT {
- if (baseName != fullName) uprv_free(baseName);
- if (fullName != fullNameBuffer) uprv_free(fullName);
-
- if (other.fullName == other.fullNameBuffer) {
- uprv_strcpy(fullNameBuffer, other.fullNameBuffer);
- fullName = fullNameBuffer;
- } else {
- fullName = other.fullName;
+ setToBogus();
+
+ if (other.fullName == other.fullNameBuffer) {
+ uprv_strcpy(fullNameBuffer, other.fullNameBuffer);
+ } else if (other.fullName == nullptr) {
+ fullName = nullptr;
+ } else {
+ fullName = uprv_strdup(other.fullName);
+ if (fullName == nullptr) return *this;
+ }
+
+ if (other.baseName == other.fullName) {
+ baseName = fullName;
+ } else if (other.baseName != nullptr) {
+ baseName = uprv_strdup(other.baseName);
+ if (baseName == nullptr) return *this;
+ }
+
+ uprv_strcpy(language, other.language);
+ uprv_strcpy(script, other.script);
+ uprv_strcpy(country, other.country);
+
+ variantBegin = other.variantBegin;
+ fIsBogus = other.fIsBogus;
+
+ return *this;
+}
+
+Locale& Locale::operator=(Locale&& other) U_NOEXCEPT {
+ if (baseName != fullName) uprv_free(baseName);
+ if (fullName != fullNameBuffer) uprv_free(fullName);
+
+ if (other.fullName == other.fullNameBuffer) {
+ uprv_strcpy(fullNameBuffer, other.fullNameBuffer);
+ fullName = fullNameBuffer;
+ } else {
+ fullName = other.fullName;
}
if (other.baseName == other.fullName) {
baseName = fullName;
} else {
- baseName = other.baseName;
+ baseName = other.baseName;
}
uprv_strcpy(language, other.language);
@@ -489,9 +489,9 @@ Locale& Locale::operator=(Locale&& other) U_NOEXCEPT {
variantBegin = other.variantBegin;
fIsBogus = other.fIsBogus;
-
- other.baseName = other.fullName = other.fullNameBuffer;
-
+
+ other.baseName = other.fullName = other.fullNameBuffer;
+
return *this;
}
@@ -508,36 +508,36 @@ Locale::operator==( const Locale& other) const
#define ISASCIIALPHA(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z'))
-namespace {
-
-CharString& AppendLSCVE(CharString& out, const char* language, const char* script,
- const char* country, const char* variants, const char* extension,
- UErrorCode& status) {
- out.append(language, status);
- if (script && script[0] != '\0') {
- out.append('_', status);
- out.append(script, status);
- }
- if (country && country[0] != '\0') {
- out.append('_', status);
- out.append(country, status);
- }
- if (variants && variants[0] != '\0') {
- if ((script == nullptr || script[0] == '\0') &&
- (country == nullptr || country[0] == '\0')) {
- out.append('_', status);
- }
- out.append('_', status);
- out.append(variants, status);
- }
- if (extension && extension[0] != '\0') {
- out.append(extension, status);
- }
- return out;
-}
-
-} // namespace
-
+namespace {
+
+CharString& AppendLSCVE(CharString& out, const char* language, const char* script,
+ const char* country, const char* variants, const char* extension,
+ UErrorCode& status) {
+ out.append(language, status);
+ if (script && script[0] != '\0') {
+ out.append('_', status);
+ out.append(script, status);
+ }
+ if (country && country[0] != '\0') {
+ out.append('_', status);
+ out.append(country, status);
+ }
+ if (variants && variants[0] != '\0') {
+ if ((script == nullptr || script[0] == '\0') &&
+ (country == nullptr || country[0] == '\0')) {
+ out.append('_', status);
+ }
+ out.append('_', status);
+ out.append(variants, status);
+ }
+ if (extension && extension[0] != '\0') {
+ out.append(extension, status);
+ }
+ return out;
+}
+
+} // namespace
+
/*This function initializes a Locale from a C locale ID*/
Locale& Locale::init(const char* localeID, UBool canonicalize)
{
@@ -598,13 +598,13 @@ Locale& Locale::init(const char* localeID, UBool canonicalize)
variantBegin = length;
/* after uloc_getName/canonicalize() we know that only '_' are separators */
- /* But _ could also appeared in timezone such as "en@timezone=America/Los_Angeles" */
+ /* But _ could also appeared in timezone such as "en@timezone=America/Los_Angeles" */
separator = field[0] = fullName;
fieldIdx = 1;
- char* at = uprv_strchr(fullName, '@');
- while ((separator = uprv_strchr(field[fieldIdx-1], SEP_CHAR)) != 0 &&
- fieldIdx < UPRV_LENGTHOF(field)-1 &&
- (at == nullptr || separator < at)) {
+ char* at = uprv_strchr(fullName, '@');
+ while ((separator = uprv_strchr(field[fieldIdx-1], SEP_CHAR)) != 0 &&
+ fieldIdx < UPRV_LENGTHOF(field)-1 &&
+ (at == nullptr || separator < at)) {
field[fieldIdx] = separator + 1;
fieldLen[fieldIdx-1] = (int32_t)(separator - field[fieldIdx-1]);
fieldIdx++;
@@ -661,195 +661,195 @@ Locale& Locale::init(const char* localeID, UBool canonicalize)
break;
}
- if (canonicalize) {
- UErrorCode status = U_ZERO_ERROR;
- // TODO: Try to use ResourceDataValue and ures_getValueWithFallback() etc.
- LocalUResourceBundlePointer metadata(ures_openDirect(NULL, "metadata", &status));
- LocalUResourceBundlePointer metadataAlias(ures_getByKey(metadata.getAlias(), "alias", NULL, &status));
- // Look up the metadata:alias:language:$key:replacement entries
- // key could be one of the following:
- // language
- // language_Script_REGION
- // language_REGION
- // language_variant
- do {
- // The resource structure looks like
- // metadata {
- // alias {
- // language {
- // art_lojban {
- // replacement{"jbo"}
- // }
- // ...
- // ks_Arab_IN {
- // replacement{"ks_IN"}
- // }
- // ...
- // no {
- // replacement{"nb"}
- // }
- // ....
- // zh_CN {
- // replacement{"zh_Hans_CN"}
- // }
- // }
- // ...
- // }
- // }
- LocalUResourceBundlePointer languageAlias(ures_getByKey(metadataAlias.getAlias(), "language", NULL, &status));
- if (U_FAILURE(status))
- break;
- CharString temp;
- // Handle cases of key pattern "language _ variant"
- // ex: Map "art_lojban" to "jbo"
- const char* variants = getVariant();
- if (variants != nullptr && variants[0] != '\0') {
- const char* begin = variants;
- const char* end = begin;
- // We may have multiple variants, need to look at each of
- // them.
- do {
- status = U_ZERO_ERROR;
- end = uprv_strchr(begin, '_');
- int32_t len = (end == nullptr) ? int32_t(uprv_strlen(begin)) : int32_t(end - begin);
- temp.clear().append(getLanguage(), status).append("_", status).append(begin, len, status);
- LocalUResourceBundlePointer languageVariantAlias(
- ures_getByKey(languageAlias.getAlias(),
- temp.data(),
- NULL, &status));
- temp.clear().appendInvariantChars(
- UnicodeString(ures_getStringByKey(languageVariantAlias.getAlias(), "replacement", nullptr, &status)), status);
- if (U_SUCCESS(status)) {
- CharString newVar;
- if (begin != variants) {
- newVar.append(variants, static_cast<int32_t>(begin - variants - 1), status);
- }
- if (end != nullptr) {
- if (begin != variants) {
- newVar.append("_", status);
- }
- newVar.append(end + 1, status);
- }
- Locale l(temp.data());
- init(AppendLSCVE(temp.clear(),
- l.getLanguage(),
- (getScript() != nullptr && getScript()[0] != '\0') ? getScript() : l.getScript(),
- (getCountry() != nullptr && getCountry()[0] != '\0') ? getCountry() : l.getCountry(),
- newVar.data(),
- uprv_strchr(fullName, '@'), status).data(), false);
- break;
- }
- begin = end + 1;
- } while (end != nullptr);
- } // End of handle language _ variant
- // Handle cases of key pattern "language _ Script _ REGION"
- // ex: Map "ks_Arab_IN" to "ks_IN"
- if (getScript() != nullptr && getScript()[0] != '\0' &&
- getCountry() != nullptr && getCountry()[0] != '\0') {
- status = U_ZERO_ERROR;
- LocalUResourceBundlePointer replacedAlias(
- ures_getByKey(languageAlias.getAlias(),
- AppendLSCVE(temp.clear(), getLanguage(), getScript(), getCountry(),
- nullptr, nullptr, status).data(), NULL, &status));
- temp.clear().appendInvariantChars(
- UnicodeString(ures_getStringByKey(replacedAlias.getAlias(), "replacement", nullptr, &status)), status);
- if (U_SUCCESS(status)) {
- Locale l(temp.data());
- init(AppendLSCVE(temp.clear(),
- l.getLanguage(),
- l.getScript(),
- l.getCountry(),
- getVariant(),
- uprv_strchr(fullName, '@'), status).data(), false);
- }
- } // End of handle language _ Script _ REGION
- // Handle cases of key pattern "language _ REGION"
- // ex: Map "zh_CN" to "zh_Hans_CN"
- if (getCountry() != nullptr && getCountry()[0] != '\0') {
- status = U_ZERO_ERROR;
- LocalUResourceBundlePointer replacedAlias(
- ures_getByKey(languageAlias.getAlias(),
- AppendLSCVE(temp.clear(), getLanguage(), nullptr, getCountry(),
- nullptr, nullptr, status).data(), NULL, &status));
- temp.clear().appendInvariantChars(
- UnicodeString(ures_getStringByKey(replacedAlias.getAlias(), "replacement", nullptr, &status)), status);
- if (U_SUCCESS(status)) {
- Locale l(temp.data());
- init(AppendLSCVE(temp.clear(),
- l.getLanguage(),
- (getScript() != nullptr && getScript()[0] != '\0') ? getScript() : l.getScript(),
- l.getCountry(),
- getVariant(),
- uprv_strchr(fullName, '@'), status).data(), false);
- }
- } // End of handle "language _ REGION"
- // Handle cases of key pattern "language"
- // ex: Map "no" to "nb"
- {
- status = U_ZERO_ERROR;
- LocalUResourceBundlePointer replaceLanguageAlias(ures_getByKey(languageAlias.getAlias(), getLanguage(), NULL, &status));
- temp.clear().appendInvariantChars(
- UnicodeString(ures_getStringByKey(replaceLanguageAlias.getAlias(), "replacement", nullptr, &status)), status);
- if (U_SUCCESS(status)) {
- Locale l(temp.data());
- init(AppendLSCVE(temp.clear(),
- l.getLanguage(),
- (getScript() != nullptr && getScript()[0] != '\0') ? getScript() : l.getScript(),
- (getCountry() != nullptr && getCountry()[0] != '\0') ? getCountry() : l.getCountry(),
- getVariant(),
- uprv_strchr(fullName, '@'), status).data(), false);
- }
- } // End of handle "language"
-
- // Look up the metadata:alias:territory:$key:replacement entries
- // key is region code.
- if (getCountry() != nullptr) {
- status = U_ZERO_ERROR;
- // The resource structure looks like
- // metadata {
- // alias {
- // ...
- // territory: {
- // 172 {
- // replacement{"RU AM AZ BY GE KG KZ MD TJ TM UA UZ"}
- // }
- // ...
- // 554 {
- // replacement{"NZ"}
- // }
- // }
- // }
- // }
- LocalUResourceBundlePointer territoryAlias(ures_getByKey(metadataAlias.getAlias(), "territory", NULL, &status));
- LocalUResourceBundlePointer countryAlias(ures_getByKey(territoryAlias.getAlias(), getCountry(), NULL, &status));
- UnicodeString replacements(
- ures_getStringByKey(countryAlias.getAlias(), "replacement", nullptr, &status));
- if (U_SUCCESS(status)) {
- CharString replacedCountry;
- int32_t delPos = replacements.indexOf(' ');
- if (delPos == -1) {
- replacedCountry.appendInvariantChars(replacements, status);
- } else {
- Locale l(AppendLSCVE(temp.clear(), getLanguage(), nullptr, getScript(),
- nullptr, nullptr, status).data());
- l.addLikelySubtags(status);
- if (replacements.indexOf(UnicodeString(l.getCountry())) != -1) {
- replacedCountry.append(l.getCountry(), status);
- } else {
- replacedCountry.appendInvariantChars(replacements.getBuffer(), delPos, status);
- }
- }
- init(AppendLSCVE(temp.clear(),
- getLanguage(),
- getScript(),
- replacedCountry.data(),
- getVariant(),
- uprv_strchr(fullName, '@'), status).data(), false);
- }
- } // End of handle REGION
- } while (0);
- } // if (canonicalize) {
-
+ if (canonicalize) {
+ UErrorCode status = U_ZERO_ERROR;
+ // TODO: Try to use ResourceDataValue and ures_getValueWithFallback() etc.
+ LocalUResourceBundlePointer metadata(ures_openDirect(NULL, "metadata", &status));
+ LocalUResourceBundlePointer metadataAlias(ures_getByKey(metadata.getAlias(), "alias", NULL, &status));
+ // Look up the metadata:alias:language:$key:replacement entries
+ // key could be one of the following:
+ // language
+ // language_Script_REGION
+ // language_REGION
+ // language_variant
+ do {
+ // The resource structure looks like
+ // metadata {
+ // alias {
+ // language {
+ // art_lojban {
+ // replacement{"jbo"}
+ // }
+ // ...
+ // ks_Arab_IN {
+ // replacement{"ks_IN"}
+ // }
+ // ...
+ // no {
+ // replacement{"nb"}
+ // }
+ // ....
+ // zh_CN {
+ // replacement{"zh_Hans_CN"}
+ // }
+ // }
+ // ...
+ // }
+ // }
+ LocalUResourceBundlePointer languageAlias(ures_getByKey(metadataAlias.getAlias(), "language", NULL, &status));
+ if (U_FAILURE(status))
+ break;
+ CharString temp;
+ // Handle cases of key pattern "language _ variant"
+ // ex: Map "art_lojban" to "jbo"
+ const char* variants = getVariant();
+ if (variants != nullptr && variants[0] != '\0') {
+ const char* begin = variants;
+ const char* end = begin;
+ // We may have multiple variants, need to look at each of
+ // them.
+ do {
+ status = U_ZERO_ERROR;
+ end = uprv_strchr(begin, '_');
+ int32_t len = (end == nullptr) ? int32_t(uprv_strlen(begin)) : int32_t(end - begin);
+ temp.clear().append(getLanguage(), status).append("_", status).append(begin, len, status);
+ LocalUResourceBundlePointer languageVariantAlias(
+ ures_getByKey(languageAlias.getAlias(),
+ temp.data(),
+ NULL, &status));
+ temp.clear().appendInvariantChars(
+ UnicodeString(ures_getStringByKey(languageVariantAlias.getAlias(), "replacement", nullptr, &status)), status);
+ if (U_SUCCESS(status)) {
+ CharString newVar;
+ if (begin != variants) {
+ newVar.append(variants, static_cast<int32_t>(begin - variants - 1), status);
+ }
+ if (end != nullptr) {
+ if (begin != variants) {
+ newVar.append("_", status);
+ }
+ newVar.append(end + 1, status);
+ }
+ Locale l(temp.data());
+ init(AppendLSCVE(temp.clear(),
+ l.getLanguage(),
+ (getScript() != nullptr && getScript()[0] != '\0') ? getScript() : l.getScript(),
+ (getCountry() != nullptr && getCountry()[0] != '\0') ? getCountry() : l.getCountry(),
+ newVar.data(),
+ uprv_strchr(fullName, '@'), status).data(), false);
+ break;
+ }
+ begin = end + 1;
+ } while (end != nullptr);
+ } // End of handle language _ variant
+ // Handle cases of key pattern "language _ Script _ REGION"
+ // ex: Map "ks_Arab_IN" to "ks_IN"
+ if (getScript() != nullptr && getScript()[0] != '\0' &&
+ getCountry() != nullptr && getCountry()[0] != '\0') {
+ status = U_ZERO_ERROR;
+ LocalUResourceBundlePointer replacedAlias(
+ ures_getByKey(languageAlias.getAlias(),
+ AppendLSCVE(temp.clear(), getLanguage(), getScript(), getCountry(),
+ nullptr, nullptr, status).data(), NULL, &status));
+ temp.clear().appendInvariantChars(
+ UnicodeString(ures_getStringByKey(replacedAlias.getAlias(), "replacement", nullptr, &status)), status);
+ if (U_SUCCESS(status)) {
+ Locale l(temp.data());
+ init(AppendLSCVE(temp.clear(),
+ l.getLanguage(),
+ l.getScript(),
+ l.getCountry(),
+ getVariant(),
+ uprv_strchr(fullName, '@'), status).data(), false);
+ }
+ } // End of handle language _ Script _ REGION
+ // Handle cases of key pattern "language _ REGION"
+ // ex: Map "zh_CN" to "zh_Hans_CN"
+ if (getCountry() != nullptr && getCountry()[0] != '\0') {
+ status = U_ZERO_ERROR;
+ LocalUResourceBundlePointer replacedAlias(
+ ures_getByKey(languageAlias.getAlias(),
+ AppendLSCVE(temp.clear(), getLanguage(), nullptr, getCountry(),
+ nullptr, nullptr, status).data(), NULL, &status));
+ temp.clear().appendInvariantChars(
+ UnicodeString(ures_getStringByKey(replacedAlias.getAlias(), "replacement", nullptr, &status)), status);
+ if (U_SUCCESS(status)) {
+ Locale l(temp.data());
+ init(AppendLSCVE(temp.clear(),
+ l.getLanguage(),
+ (getScript() != nullptr && getScript()[0] != '\0') ? getScript() : l.getScript(),
+ l.getCountry(),
+ getVariant(),
+ uprv_strchr(fullName, '@'), status).data(), false);
+ }
+ } // End of handle "language _ REGION"
+ // Handle cases of key pattern "language"
+ // ex: Map "no" to "nb"
+ {
+ status = U_ZERO_ERROR;
+ LocalUResourceBundlePointer replaceLanguageAlias(ures_getByKey(languageAlias.getAlias(), getLanguage(), NULL, &status));
+ temp.clear().appendInvariantChars(
+ UnicodeString(ures_getStringByKey(replaceLanguageAlias.getAlias(), "replacement", nullptr, &status)), status);
+ if (U_SUCCESS(status)) {
+ Locale l(temp.data());
+ init(AppendLSCVE(temp.clear(),
+ l.getLanguage(),
+ (getScript() != nullptr && getScript()[0] != '\0') ? getScript() : l.getScript(),
+ (getCountry() != nullptr && getCountry()[0] != '\0') ? getCountry() : l.getCountry(),
+ getVariant(),
+ uprv_strchr(fullName, '@'), status).data(), false);
+ }
+ } // End of handle "language"
+
+ // Look up the metadata:alias:territory:$key:replacement entries
+ // key is region code.
+ if (getCountry() != nullptr) {
+ status = U_ZERO_ERROR;
+ // The resource structure looks like
+ // metadata {
+ // alias {
+ // ...
+ // territory: {
+ // 172 {
+ // replacement{"RU AM AZ BY GE KG KZ MD TJ TM UA UZ"}
+ // }
+ // ...
+ // 554 {
+ // replacement{"NZ"}
+ // }
+ // }
+ // }
+ // }
+ LocalUResourceBundlePointer territoryAlias(ures_getByKey(metadataAlias.getAlias(), "territory", NULL, &status));
+ LocalUResourceBundlePointer countryAlias(ures_getByKey(territoryAlias.getAlias(), getCountry(), NULL, &status));
+ UnicodeString replacements(
+ ures_getStringByKey(countryAlias.getAlias(), "replacement", nullptr, &status));
+ if (U_SUCCESS(status)) {
+ CharString replacedCountry;
+ int32_t delPos = replacements.indexOf(' ');
+ if (delPos == -1) {
+ replacedCountry.appendInvariantChars(replacements, status);
+ } else {
+ Locale l(AppendLSCVE(temp.clear(), getLanguage(), nullptr, getScript(),
+ nullptr, nullptr, status).data());
+ l.addLikelySubtags(status);
+ if (replacements.indexOf(UnicodeString(l.getCountry())) != -1) {
+ replacedCountry.append(l.getCountry(), status);
+ } else {
+ replacedCountry.appendInvariantChars(replacements.getBuffer(), delPos, status);
+ }
+ }
+ init(AppendLSCVE(temp.clear(),
+ getLanguage(),
+ getScript(),
+ replacedCountry.data(),
+ getVariant(),
+ uprv_strchr(fullName, '@'), status).data(), false);
+ }
+ } // End of handle REGION
+ } while (0);
+ } // if (canonicalize) {
+
// successful end of init()
return *this;
} while(0); /*loop doesn't iterate*/
@@ -900,7 +900,7 @@ Locale::initBaseName(UErrorCode &status) {
int32_t
Locale::hashCode() const
{
- return ustr_hashCharsN(fullName, static_cast<int32_t>(uprv_strlen(fullName)));
+ return ustr_hashCharsN(fullName, static_cast<int32_t>(uprv_strlen(fullName)));
}
void
@@ -952,132 +952,132 @@ Locale::setDefault( const Locale& newLocale,
locale_set_default_internal(localeID, status);
}
-void
-Locale::addLikelySubtags(UErrorCode& status) {
- if (U_FAILURE(status)) {
- return;
- }
-
- CharString maximizedLocaleID;
- {
- CharStringByteSink sink(&maximizedLocaleID);
- ulocimp_addLikelySubtags(fullName, sink, &status);
- }
-
- if (U_FAILURE(status)) {
- return;
- }
-
- init(maximizedLocaleID.data(), /*canonicalize=*/FALSE);
- if (isBogus()) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- }
-}
-
-void
-Locale::minimizeSubtags(UErrorCode& status) {
- if (U_FAILURE(status)) {
- return;
- }
-
- CharString minimizedLocaleID;
- {
- CharStringByteSink sink(&minimizedLocaleID);
- ulocimp_minimizeSubtags(fullName, sink, &status);
- }
-
- if (U_FAILURE(status)) {
- return;
- }
-
- init(minimizedLocaleID.data(), /*canonicalize=*/FALSE);
- if (isBogus()) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- }
-}
-
-void
-Locale::canonicalize(UErrorCode& status) {
- if (U_FAILURE(status)) {
- return;
- }
- if (isBogus()) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- CharString uncanonicalized(fullName, status);
- if (U_FAILURE(status)) {
- return;
- }
- init(uncanonicalized.data(), /*canonicalize=*/TRUE);
- if (isBogus()) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- }
-}
-
+void
+Locale::addLikelySubtags(UErrorCode& status) {
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ CharString maximizedLocaleID;
+ {
+ CharStringByteSink sink(&maximizedLocaleID);
+ ulocimp_addLikelySubtags(fullName, sink, &status);
+ }
+
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ init(maximizedLocaleID.data(), /*canonicalize=*/FALSE);
+ if (isBogus()) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ }
+}
+
+void
+Locale::minimizeSubtags(UErrorCode& status) {
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ CharString minimizedLocaleID;
+ {
+ CharStringByteSink sink(&minimizedLocaleID);
+ ulocimp_minimizeSubtags(fullName, sink, &status);
+ }
+
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ init(minimizedLocaleID.data(), /*canonicalize=*/FALSE);
+ if (isBogus()) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ }
+}
+
+void
+Locale::canonicalize(UErrorCode& status) {
+ if (U_FAILURE(status)) {
+ return;
+ }
+ if (isBogus()) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ CharString uncanonicalized(fullName, status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ init(uncanonicalized.data(), /*canonicalize=*/TRUE);
+ if (isBogus()) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ }
+}
+
+Locale U_EXPORT2
+Locale::forLanguageTag(StringPiece tag, UErrorCode& status)
+{
+ Locale result(Locale::eBOGUS);
+
+ if (U_FAILURE(status)) {
+ return result;
+ }
+
+ // If a BCP-47 language tag is passed as the language parameter to the
+ // normal Locale constructor, it will actually fall back to invoking
+ // uloc_forLanguageTag() to parse it if it somehow is able to detect that
+ // the string actually is BCP-47. This works well for things like strings
+ // using BCP-47 extensions, but it does not at all work for things like
+ // BCP-47 grandfathered tags (eg. "en-GB-oed") which are possible to also
+ // interpret as ICU locale IDs and because of that won't trigger the BCP-47
+ // parsing. Therefore the code here explicitly calls uloc_forLanguageTag()
+ // and then Locale::init(), instead of just calling the normal constructor.
+
+ CharString localeID;
+ int32_t parsedLength;
+ {
+ CharStringByteSink sink(&localeID);
+ ulocimp_forLanguageTag(
+ tag.data(),
+ tag.length(),
+ sink,
+ &parsedLength,
+ &status);
+ }
+
+ if (U_FAILURE(status)) {
+ return result;
+ }
+
+ if (parsedLength != tag.size()) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return result;
+ }
+
+ result.init(localeID.data(), /*canonicalize=*/FALSE);
+ if (result.isBogus()) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ }
+ return result;
+}
+
+void
+Locale::toLanguageTag(ByteSink& sink, UErrorCode& status) const
+{
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ if (fIsBogus) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ ulocimp_toLanguageTag(fullName, sink, /*strict=*/FALSE, &status);
+}
+
Locale U_EXPORT2
-Locale::forLanguageTag(StringPiece tag, UErrorCode& status)
-{
- Locale result(Locale::eBOGUS);
-
- if (U_FAILURE(status)) {
- return result;
- }
-
- // If a BCP-47 language tag is passed as the language parameter to the
- // normal Locale constructor, it will actually fall back to invoking
- // uloc_forLanguageTag() to parse it if it somehow is able to detect that
- // the string actually is BCP-47. This works well for things like strings
- // using BCP-47 extensions, but it does not at all work for things like
- // BCP-47 grandfathered tags (eg. "en-GB-oed") which are possible to also
- // interpret as ICU locale IDs and because of that won't trigger the BCP-47
- // parsing. Therefore the code here explicitly calls uloc_forLanguageTag()
- // and then Locale::init(), instead of just calling the normal constructor.
-
- CharString localeID;
- int32_t parsedLength;
- {
- CharStringByteSink sink(&localeID);
- ulocimp_forLanguageTag(
- tag.data(),
- tag.length(),
- sink,
- &parsedLength,
- &status);
- }
-
- if (U_FAILURE(status)) {
- return result;
- }
-
- if (parsedLength != tag.size()) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return result;
- }
-
- result.init(localeID.data(), /*canonicalize=*/FALSE);
- if (result.isBogus()) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- }
- return result;
-}
-
-void
-Locale::toLanguageTag(ByteSink& sink, UErrorCode& status) const
-{
- if (U_FAILURE(status)) {
- return;
- }
-
- if (fIsBogus) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- ulocimp_toLanguageTag(fullName, sink, /*strict=*/FALSE, &status);
-}
-
-Locale U_EXPORT2
Locale::createFromName (const char *name)
{
if (name) {
@@ -1383,55 +1383,84 @@ KeywordEnumeration::~KeywordEnumeration() {
uprv_free(keywords);
}
-// A wrapper around KeywordEnumeration that calls uloc_toUnicodeLocaleKey() in
-// the next() method for each keyword before returning it.
-class UnicodeKeywordEnumeration : public KeywordEnumeration {
-public:
- using KeywordEnumeration::KeywordEnumeration;
- virtual ~UnicodeKeywordEnumeration();
-
- virtual const char* next(int32_t* resultLength, UErrorCode& status) {
- const char* legacy_key = KeywordEnumeration::next(nullptr, status);
- if (U_SUCCESS(status) && legacy_key != nullptr) {
- const char* key = uloc_toUnicodeLocaleKey(legacy_key);
- if (key == nullptr) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- } else {
- if (resultLength != nullptr) {
- *resultLength = static_cast<int32_t>(uprv_strlen(key));
- }
- return key;
- }
- }
- if (resultLength != nullptr) *resultLength = 0;
- return nullptr;
- }
-};
-
-// Out-of-line virtual destructor to serve as the "key function".
-UnicodeKeywordEnumeration::~UnicodeKeywordEnumeration() = default;
-
+// A wrapper around KeywordEnumeration that calls uloc_toUnicodeLocaleKey() in
+// the next() method for each keyword before returning it.
+class UnicodeKeywordEnumeration : public KeywordEnumeration {
+public:
+ using KeywordEnumeration::KeywordEnumeration;
+ virtual ~UnicodeKeywordEnumeration();
+
+ virtual const char* next(int32_t* resultLength, UErrorCode& status) {
+ const char* legacy_key = KeywordEnumeration::next(nullptr, status);
+ if (U_SUCCESS(status) && legacy_key != nullptr) {
+ const char* key = uloc_toUnicodeLocaleKey(legacy_key);
+ if (key == nullptr) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ } else {
+ if (resultLength != nullptr) {
+ *resultLength = static_cast<int32_t>(uprv_strlen(key));
+ }
+ return key;
+ }
+ }
+ if (resultLength != nullptr) *resultLength = 0;
+ return nullptr;
+ }
+};
+
+// Out-of-line virtual destructor to serve as the "key function".
+UnicodeKeywordEnumeration::~UnicodeKeywordEnumeration() = default;
+
StringEnumeration *
Locale::createKeywords(UErrorCode &status) const
{
char keywords[256];
- int32_t keywordCapacity = sizeof keywords;
+ int32_t keywordCapacity = sizeof keywords;
StringEnumeration *result = NULL;
- if (U_FAILURE(status)) {
- return result;
- }
-
+ if (U_FAILURE(status)) {
+ return result;
+ }
+
const char* variantStart = uprv_strchr(fullName, '@');
const char* assignment = uprv_strchr(fullName, '=');
if(variantStart) {
if(assignment > variantStart) {
- int32_t keyLen = locale_getKeywords(variantStart+1, '@', keywords, keywordCapacity, FALSE, &status);
- if(U_SUCCESS(status) && keyLen) {
+ int32_t keyLen = locale_getKeywords(variantStart+1, '@', keywords, keywordCapacity, FALSE, &status);
+ if(U_SUCCESS(status) && keyLen) {
result = new KeywordEnumeration(keywords, keyLen, 0, status);
- if (!result) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
+ if (!result) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
+ }
+ } else {
+ status = U_INVALID_FORMAT_ERROR;
+ }
+ }
+ return result;
+}
+
+StringEnumeration *
+Locale::createUnicodeKeywords(UErrorCode &status) const
+{
+ char keywords[256];
+ int32_t keywordCapacity = sizeof keywords;
+ StringEnumeration *result = NULL;
+
+ if (U_FAILURE(status)) {
+ return result;
+ }
+
+ const char* variantStart = uprv_strchr(fullName, '@');
+ const char* assignment = uprv_strchr(fullName, '=');
+ if(variantStart) {
+ if(assignment > variantStart) {
+ int32_t keyLen = locale_getKeywords(variantStart+1, '@', keywords, keywordCapacity, FALSE, &status);
+ if(U_SUCCESS(status) && keyLen) {
+ result = new UnicodeKeywordEnumeration(keywords, keyLen, 0, status);
+ if (!result) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
}
} else {
status = U_INVALID_FORMAT_ERROR;
@@ -1440,35 +1469,6 @@ Locale::createKeywords(UErrorCode &status) const
return result;
}
-StringEnumeration *
-Locale::createUnicodeKeywords(UErrorCode &status) const
-{
- char keywords[256];
- int32_t keywordCapacity = sizeof keywords;
- StringEnumeration *result = NULL;
-
- if (U_FAILURE(status)) {
- return result;
- }
-
- const char* variantStart = uprv_strchr(fullName, '@');
- const char* assignment = uprv_strchr(fullName, '=');
- if(variantStart) {
- if(assignment > variantStart) {
- int32_t keyLen = locale_getKeywords(variantStart+1, '@', keywords, keywordCapacity, FALSE, &status);
- if(U_SUCCESS(status) && keyLen) {
- result = new UnicodeKeywordEnumeration(keywords, keyLen, 0, status);
- if (!result) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
- }
- } else {
- status = U_INVALID_FORMAT_ERROR;
- }
- }
- return result;
-}
-
int32_t
Locale::getKeywordValue(const char* keywordName, char *buffer, int32_t bufLen, UErrorCode &status) const
{
@@ -1476,188 +1476,188 @@ Locale::getKeywordValue(const char* keywordName, char *buffer, int32_t bufLen, U
}
void
-Locale::getKeywordValue(StringPiece keywordName, ByteSink& sink, UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return;
- }
-
- if (fIsBogus) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- // TODO: Remove the need for a const char* to a NUL terminated buffer.
- const CharString keywordName_nul(keywordName, status);
- if (U_FAILURE(status)) {
- return;
- }
-
- LocalMemory<char> scratch;
- int32_t scratch_capacity = 16; // Arbitrarily chosen default size.
-
- char* buffer;
- int32_t result_capacity, reslen;
-
- for (;;) {
- if (scratch.allocateInsteadAndReset(scratch_capacity) == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
-
- buffer = sink.GetAppendBuffer(
- /*min_capacity=*/scratch_capacity,
- /*desired_capacity_hint=*/scratch_capacity,
- scratch.getAlias(),
- scratch_capacity,
- &result_capacity);
-
- reslen = uloc_getKeywordValue(
- fullName,
- keywordName_nul.data(),
- buffer,
- result_capacity,
- &status);
-
- if (status != U_BUFFER_OVERFLOW_ERROR) {
- break;
- }
-
- scratch_capacity = reslen;
- status = U_ZERO_ERROR;
- }
-
- if (U_FAILURE(status)) {
- return;
- }
-
- sink.Append(buffer, reslen);
- if (status == U_STRING_NOT_TERMINATED_WARNING) {
- status = U_ZERO_ERROR; // Terminators not used.
- }
-}
-
-void
-Locale::getUnicodeKeywordValue(StringPiece keywordName,
- ByteSink& sink,
- UErrorCode& status) const {
- // TODO: Remove the need for a const char* to a NUL terminated buffer.
- const CharString keywordName_nul(keywordName, status);
- if (U_FAILURE(status)) {
- return;
- }
-
- const char* legacy_key = uloc_toLegacyKey(keywordName_nul.data());
-
- if (legacy_key == nullptr) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- CharString legacy_value;
- {
- CharStringByteSink sink(&legacy_value);
- getKeywordValue(legacy_key, sink, status);
- }
-
- if (U_FAILURE(status)) {
- return;
- }
-
- const char* unicode_value = uloc_toUnicodeLocaleType(
- keywordName_nul.data(), legacy_value.data());
-
- if (unicode_value == nullptr) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- sink.Append(unicode_value, static_cast<int32_t>(uprv_strlen(unicode_value)));
-}
-
-void
+Locale::getKeywordValue(StringPiece keywordName, ByteSink& sink, UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ if (fIsBogus) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ // TODO: Remove the need for a const char* to a NUL terminated buffer.
+ const CharString keywordName_nul(keywordName, status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ LocalMemory<char> scratch;
+ int32_t scratch_capacity = 16; // Arbitrarily chosen default size.
+
+ char* buffer;
+ int32_t result_capacity, reslen;
+
+ for (;;) {
+ if (scratch.allocateInsteadAndReset(scratch_capacity) == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+
+ buffer = sink.GetAppendBuffer(
+ /*min_capacity=*/scratch_capacity,
+ /*desired_capacity_hint=*/scratch_capacity,
+ scratch.getAlias(),
+ scratch_capacity,
+ &result_capacity);
+
+ reslen = uloc_getKeywordValue(
+ fullName,
+ keywordName_nul.data(),
+ buffer,
+ result_capacity,
+ &status);
+
+ if (status != U_BUFFER_OVERFLOW_ERROR) {
+ break;
+ }
+
+ scratch_capacity = reslen;
+ status = U_ZERO_ERROR;
+ }
+
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ sink.Append(buffer, reslen);
+ if (status == U_STRING_NOT_TERMINATED_WARNING) {
+ status = U_ZERO_ERROR; // Terminators not used.
+ }
+}
+
+void
+Locale::getUnicodeKeywordValue(StringPiece keywordName,
+ ByteSink& sink,
+ UErrorCode& status) const {
+ // TODO: Remove the need for a const char* to a NUL terminated buffer.
+ const CharString keywordName_nul(keywordName, status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ const char* legacy_key = uloc_toLegacyKey(keywordName_nul.data());
+
+ if (legacy_key == nullptr) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ CharString legacy_value;
+ {
+ CharStringByteSink sink(&legacy_value);
+ getKeywordValue(legacy_key, sink, status);
+ }
+
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ const char* unicode_value = uloc_toUnicodeLocaleType(
+ keywordName_nul.data(), legacy_value.data());
+
+ if (unicode_value == nullptr) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ sink.Append(unicode_value, static_cast<int32_t>(uprv_strlen(unicode_value)));
+}
+
+void
Locale::setKeywordValue(const char* keywordName, const char* keywordValue, UErrorCode &status)
{
- if (U_FAILURE(status)) {
- return;
- }
- int32_t bufferLength = uprv_max((int32_t)(uprv_strlen(fullName) + 1), ULOC_FULLNAME_CAPACITY);
- int32_t newLength = uloc_setKeywordValue(keywordName, keywordValue, fullName,
- bufferLength, &status) + 1;
- /* Handle the case the current buffer is not enough to hold the new id */
- if (status == U_BUFFER_OVERFLOW_ERROR) {
- U_ASSERT(newLength > bufferLength);
- char* newFullName = (char *)uprv_malloc(newLength);
- if (newFullName == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- uprv_strcpy(newFullName, fullName);
- if (fullName != fullNameBuffer) {
- // if full Name is already on the heap, need to free it.
- uprv_free(fullName);
- }
- fullName = newFullName;
- status = U_ZERO_ERROR;
- uloc_setKeywordValue(keywordName, keywordValue, fullName, newLength, &status);
- } else {
- U_ASSERT(newLength <= bufferLength);
- }
+ if (U_FAILURE(status)) {
+ return;
+ }
+ int32_t bufferLength = uprv_max((int32_t)(uprv_strlen(fullName) + 1), ULOC_FULLNAME_CAPACITY);
+ int32_t newLength = uloc_setKeywordValue(keywordName, keywordValue, fullName,
+ bufferLength, &status) + 1;
+ /* Handle the case the current buffer is not enough to hold the new id */
+ if (status == U_BUFFER_OVERFLOW_ERROR) {
+ U_ASSERT(newLength > bufferLength);
+ char* newFullName = (char *)uprv_malloc(newLength);
+ if (newFullName == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ uprv_strcpy(newFullName, fullName);
+ if (fullName != fullNameBuffer) {
+ // if full Name is already on the heap, need to free it.
+ uprv_free(fullName);
+ }
+ fullName = newFullName;
+ status = U_ZERO_ERROR;
+ uloc_setKeywordValue(keywordName, keywordValue, fullName, newLength, &status);
+ } else {
+ U_ASSERT(newLength <= bufferLength);
+ }
if (U_SUCCESS(status) && baseName == fullName) {
// May have added the first keyword, meaning that the fullName is no longer also the baseName.
initBaseName(status);
}
}
-void
-Locale::setKeywordValue(StringPiece keywordName,
- StringPiece keywordValue,
- UErrorCode& status) {
- // TODO: Remove the need for a const char* to a NUL terminated buffer.
- const CharString keywordName_nul(keywordName, status);
- const CharString keywordValue_nul(keywordValue, status);
- setKeywordValue(keywordName_nul.data(), keywordValue_nul.data(), status);
-}
-
-void
-Locale::setUnicodeKeywordValue(StringPiece keywordName,
- StringPiece keywordValue,
- UErrorCode& status) {
- // TODO: Remove the need for a const char* to a NUL terminated buffer.
- const CharString keywordName_nul(keywordName, status);
- const CharString keywordValue_nul(keywordValue, status);
-
- if (U_FAILURE(status)) {
- return;
- }
-
- const char* legacy_key = uloc_toLegacyKey(keywordName_nul.data());
-
- if (legacy_key == nullptr) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- const char* legacy_value = nullptr;
-
- if (!keywordValue_nul.isEmpty()) {
- legacy_value =
- uloc_toLegacyType(keywordName_nul.data(), keywordValue_nul.data());
-
- if (legacy_value == nullptr) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- }
-
- setKeywordValue(legacy_key, legacy_value, status);
-}
-
+void
+Locale::setKeywordValue(StringPiece keywordName,
+ StringPiece keywordValue,
+ UErrorCode& status) {
+ // TODO: Remove the need for a const char* to a NUL terminated buffer.
+ const CharString keywordName_nul(keywordName, status);
+ const CharString keywordValue_nul(keywordValue, status);
+ setKeywordValue(keywordName_nul.data(), keywordValue_nul.data(), status);
+}
+
+void
+Locale::setUnicodeKeywordValue(StringPiece keywordName,
+ StringPiece keywordValue,
+ UErrorCode& status) {
+ // TODO: Remove the need for a const char* to a NUL terminated buffer.
+ const CharString keywordName_nul(keywordName, status);
+ const CharString keywordValue_nul(keywordValue, status);
+
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ const char* legacy_key = uloc_toLegacyKey(keywordName_nul.data());
+
+ if (legacy_key == nullptr) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ const char* legacy_value = nullptr;
+
+ if (!keywordValue_nul.isEmpty()) {
+ legacy_value =
+ uloc_toLegacyType(keywordName_nul.data(), keywordValue_nul.data());
+
+ if (legacy_value == nullptr) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ }
+
+ setKeywordValue(legacy_key, legacy_value, status);
+}
+
const char *
Locale::getBaseName() const {
return baseName;
}
-Locale::Iterator::~Iterator() = default;
-
+Locale::Iterator::~Iterator() = default;
+
//eof
U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/loclikely.cpp b/contrib/libs/icu/common/loclikely.cpp
index f7df4a0281..a4a4181cb1 100644
--- a/contrib/libs/icu/common/loclikely.cpp
+++ b/contrib/libs/icu/common/loclikely.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: loclikely.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -19,29 +19,29 @@
* that then do not depend on resource bundle code and likely-subtags data.
*/
-#include "unicode/bytestream.h"
+#include "unicode/bytestream.h"
#include "unicode/utypes.h"
#include "unicode/locid.h"
#include "unicode/putil.h"
-#include "unicode/uchar.h"
+#include "unicode/uchar.h"
#include "unicode/uloc.h"
#include "unicode/ures.h"
#include "unicode/uscript.h"
-#include "bytesinkutil.h"
-#include "charstr.h"
+#include "bytesinkutil.h"
+#include "charstr.h"
#include "cmemory.h"
#include "cstring.h"
#include "ulocimp.h"
#include "ustr_imp.h"
/**
- * These are the canonical strings for unknown languages, scripts and regions.
- **/
-static const char* const unknownLanguage = "und";
-static const char* const unknownScript = "Zzzz";
-static const char* const unknownRegion = "ZZ";
-
-/**
+ * These are the canonical strings for unknown languages, scripts and regions.
+ **/
+static const char* const unknownLanguage = "und";
+static const char* const unknownScript = "Zzzz";
+static const char* const unknownRegion = "ZZ";
+
+/**
* This function looks for the localeID in the likelySubtags resource.
*
* @param localeID The tag to find.
@@ -60,22 +60,22 @@ findLikelySubtags(const char* localeID,
int32_t resLen = 0;
const UChar* s = NULL;
UErrorCode tmpErr = U_ZERO_ERROR;
- icu::LocalUResourceBundlePointer subtags(ures_openDirect(NULL, "likelySubtags", &tmpErr));
+ icu::LocalUResourceBundlePointer subtags(ures_openDirect(NULL, "likelySubtags", &tmpErr));
if (U_SUCCESS(tmpErr)) {
- icu::CharString und;
- if (localeID != NULL) {
- if (*localeID == '\0') {
- localeID = unknownLanguage;
- } else if (*localeID == '_') {
- und.append(unknownLanguage, *err);
- und.append(localeID, *err);
- if (U_FAILURE(*err)) {
- return NULL;
- }
- localeID = und.data();
- }
- }
- s = ures_getStringByKey(subtags.getAlias(), localeID, &resLen, &tmpErr);
+ icu::CharString und;
+ if (localeID != NULL) {
+ if (*localeID == '\0') {
+ localeID = unknownLanguage;
+ } else if (*localeID == '_') {
+ und.append(unknownLanguage, *err);
+ und.append(localeID, *err);
+ if (U_FAILURE(*err)) {
+ return NULL;
+ }
+ localeID = und.data();
+ }
+ }
+ s = ures_getStringByKey(subtags.getAlias(), localeID, &resLen, &tmpErr);
if (U_FAILURE(tmpErr)) {
/*
@@ -92,11 +92,11 @@ findLikelySubtags(const char* localeID,
}
else {
u_UCharsToChars(s, buffer, resLen + 1);
- if (resLen >= 3 &&
- uprv_strnicmp(buffer, unknownLanguage, 3) == 0 &&
- (resLen == 3 || buffer[3] == '_')) {
- uprv_memmove(buffer, buffer + 3, resLen - 3 + 1);
- }
+ if (resLen >= 3 &&
+ uprv_strnicmp(buffer, unknownLanguage, 3) == 0 &&
+ (resLen == 3 || buffer[3] == '_')) {
+ uprv_memmove(buffer, buffer + 3, resLen - 3 + 1);
+ }
result = buffer;
}
} else {
@@ -122,10 +122,10 @@ appendTag(
const char* tag,
int32_t tagLength,
char* buffer,
- int32_t* bufferLength,
- UBool withSeparator) {
+ int32_t* bufferLength,
+ UBool withSeparator) {
- if (withSeparator) {
+ if (withSeparator) {
buffer[*bufferLength] = '_';
++(*bufferLength);
}
@@ -167,10 +167,10 @@ appendTag(
* @param trailing Any trailing data to append to the new tag.
* @param trailingLength The length of the trailing data.
* @param alternateTags A string containing any alternate tags.
- * @param sink The output sink receiving the tag string.
+ * @param sink The output sink receiving the tag string.
* @param err A pointer to a UErrorCode for error reporting.
**/
-static void U_CALLCONV
+static void U_CALLCONV
createTagStringWithAlternates(
const char* lang,
int32_t langLength,
@@ -181,13 +181,13 @@ createTagStringWithAlternates(
const char* trailing,
int32_t trailingLength,
const char* alternateTags,
- icu::ByteSink& sink,
+ icu::ByteSink& sink,
UErrorCode* err) {
if (U_FAILURE(*err)) {
goto error;
}
- else if (langLength >= ULOC_LANG_CAPACITY ||
+ else if (langLength >= ULOC_LANG_CAPACITY ||
scriptLength >= ULOC_SCRIPT_CAPACITY ||
regionLength >= ULOC_COUNTRY_CAPACITY) {
goto error;
@@ -208,12 +208,12 @@ createTagStringWithAlternates(
lang,
langLength,
tagBuffer,
- &tagLength,
- /*withSeparator=*/FALSE);
+ &tagLength,
+ /*withSeparator=*/FALSE);
}
else if (alternateTags == NULL) {
/*
- * Use the empty string for an unknown language, if
+ * Use the empty string for an unknown language, if
* we found no language.
*/
}
@@ -236,7 +236,7 @@ createTagStringWithAlternates(
}
else if (alternateLangLength == 0) {
/*
- * Use the empty string for an unknown language, if
+ * Use the empty string for an unknown language, if
* we found no language.
*/
}
@@ -245,8 +245,8 @@ createTagStringWithAlternates(
alternateLang,
alternateLangLength,
tagBuffer,
- &tagLength,
- /*withSeparator=*/FALSE);
+ &tagLength,
+ /*withSeparator=*/FALSE);
}
}
@@ -255,8 +255,8 @@ createTagStringWithAlternates(
script,
scriptLength,
tagBuffer,
- &tagLength,
- /*withSeparator=*/TRUE);
+ &tagLength,
+ /*withSeparator=*/TRUE);
}
else if (alternateTags != NULL) {
/*
@@ -280,8 +280,8 @@ createTagStringWithAlternates(
alternateScript,
alternateScriptLength,
tagBuffer,
- &tagLength,
- /*withSeparator=*/TRUE);
+ &tagLength,
+ /*withSeparator=*/TRUE);
}
}
@@ -290,8 +290,8 @@ createTagStringWithAlternates(
region,
regionLength,
tagBuffer,
- &tagLength,
- /*withSeparator=*/TRUE);
+ &tagLength,
+ /*withSeparator=*/TRUE);
regionAppended = TRUE;
}
@@ -316,35 +316,35 @@ createTagStringWithAlternates(
alternateRegion,
alternateRegionLength,
tagBuffer,
- &tagLength,
- /*withSeparator=*/TRUE);
+ &tagLength,
+ /*withSeparator=*/TRUE);
regionAppended = TRUE;
}
}
- /**
- * Copy the partial tag from our internal buffer to the supplied
- * target.
- **/
- sink.Append(tagBuffer, tagLength);
+ /**
+ * Copy the partial tag from our internal buffer to the supplied
+ * target.
+ **/
+ sink.Append(tagBuffer, tagLength);
if (trailingLength > 0) {
- if (*trailing != '@') {
- sink.Append("_", 1);
- if (!regionAppended) {
+ if (*trailing != '@') {
+ sink.Append("_", 1);
+ if (!regionAppended) {
/* extra separator is required */
- sink.Append("_", 1);
+ sink.Append("_", 1);
}
}
- /*
- * Copy the trailing data into the supplied buffer.
- */
- sink.Append(trailing, trailingLength);
+ /*
+ * Copy the trailing data into the supplied buffer.
+ */
+ sink.Append(trailing, trailingLength);
}
- return;
+ return;
}
error:
@@ -381,10 +381,10 @@ error:
* @param regionLength The length of the region tag.
* @param trailing Any trailing data to append to the new tag.
* @param trailingLength The length of the trailing data.
- * @param sink The output sink receiving the tag string.
+ * @param sink The output sink receiving the tag string.
* @param err A pointer to a UErrorCode for error reporting.
**/
-static void U_CALLCONV
+static void U_CALLCONV
createTagString(
const char* lang,
int32_t langLength,
@@ -394,10 +394,10 @@ createTagString(
int32_t regionLength,
const char* trailing,
int32_t trailingLength,
- icu::ByteSink& sink,
+ icu::ByteSink& sink,
UErrorCode* err)
{
- createTagStringWithAlternates(
+ createTagStringWithAlternates(
lang,
langLength,
script,
@@ -407,7 +407,7 @@ createTagString(
trailing,
trailingLength,
NULL,
- sink,
+ sink,
err);
}
@@ -479,10 +479,10 @@ parseTagString(
*langLength = subtagLength;
/*
- * If no language was present, use the empty string instead.
- * Otherwise, move past any separator.
+ * If no language was present, use the empty string instead.
+ * Otherwise, move past any separator.
*/
- if (_isIDSeparator(*position)) {
+ if (_isIDSeparator(*position)) {
++position;
}
@@ -549,7 +549,7 @@ error:
goto exit;
}
-static UBool U_CALLCONV
+static UBool U_CALLCONV
createLikelySubtagsString(
const char* lang,
int32_t langLength,
@@ -559,8 +559,8 @@ createLikelySubtagsString(
int32_t regionLength,
const char* variants,
int32_t variantsLength,
- icu::ByteSink& sink,
- UErrorCode* err) {
+ icu::ByteSink& sink,
+ UErrorCode* err) {
/**
* ULOC_FULLNAME_CAPACITY will provide enough capacity
* that we can build a string that contains the language,
@@ -580,28 +580,28 @@ createLikelySubtagsString(
const char* likelySubtags = NULL;
- icu::CharString tagBuffer;
- {
- icu::CharStringByteSink sink(&tagBuffer);
- createTagString(
- lang,
- langLength,
- script,
- scriptLength,
- region,
- regionLength,
- NULL,
- 0,
- sink,
- err);
- }
+ icu::CharString tagBuffer;
+ {
+ icu::CharStringByteSink sink(&tagBuffer);
+ createTagString(
+ lang,
+ langLength,
+ script,
+ scriptLength,
+ region,
+ regionLength,
+ NULL,
+ 0,
+ sink,
+ err);
+ }
if(U_FAILURE(*err)) {
goto error;
}
likelySubtags =
findLikelySubtags(
- tagBuffer.data(),
+ tagBuffer.data(),
likelySubtagsBuffer,
sizeof(likelySubtagsBuffer),
err);
@@ -613,7 +613,7 @@ createLikelySubtagsString(
/* Always use the language tag from the
maximal string, since it may be more
specific than the one provided. */
- createTagStringWithAlternates(
+ createTagStringWithAlternates(
NULL,
0,
NULL,
@@ -623,9 +623,9 @@ createLikelySubtagsString(
variants,
variantsLength,
likelySubtags,
- sink,
+ sink,
err);
- return TRUE;
+ return TRUE;
}
}
@@ -636,28 +636,28 @@ createLikelySubtagsString(
const char* likelySubtags = NULL;
- icu::CharString tagBuffer;
- {
- icu::CharStringByteSink sink(&tagBuffer);
- createTagString(
- lang,
- langLength,
- script,
- scriptLength,
- NULL,
- 0,
- NULL,
- 0,
- sink,
- err);
- }
+ icu::CharString tagBuffer;
+ {
+ icu::CharStringByteSink sink(&tagBuffer);
+ createTagString(
+ lang,
+ langLength,
+ script,
+ scriptLength,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ sink,
+ err);
+ }
if(U_FAILURE(*err)) {
goto error;
}
likelySubtags =
findLikelySubtags(
- tagBuffer.data(),
+ tagBuffer.data(),
likelySubtagsBuffer,
sizeof(likelySubtagsBuffer),
err);
@@ -669,7 +669,7 @@ createLikelySubtagsString(
/* Always use the language tag from the
maximal string, since it may be more
specific than the one provided. */
- createTagStringWithAlternates(
+ createTagStringWithAlternates(
NULL,
0,
NULL,
@@ -679,9 +679,9 @@ createLikelySubtagsString(
variants,
variantsLength,
likelySubtags,
- sink,
+ sink,
err);
- return TRUE;
+ return TRUE;
}
}
@@ -692,28 +692,28 @@ createLikelySubtagsString(
const char* likelySubtags = NULL;
- icu::CharString tagBuffer;
- {
- icu::CharStringByteSink sink(&tagBuffer);
- createTagString(
- lang,
- langLength,
- NULL,
- 0,
- region,
- regionLength,
- NULL,
- 0,
- sink,
- err);
- }
+ icu::CharString tagBuffer;
+ {
+ icu::CharStringByteSink sink(&tagBuffer);
+ createTagString(
+ lang,
+ langLength,
+ NULL,
+ 0,
+ region,
+ regionLength,
+ NULL,
+ 0,
+ sink,
+ err);
+ }
if(U_FAILURE(*err)) {
goto error;
}
likelySubtags =
findLikelySubtags(
- tagBuffer.data(),
+ tagBuffer.data(),
likelySubtagsBuffer,
sizeof(likelySubtagsBuffer),
err);
@@ -725,7 +725,7 @@ createLikelySubtagsString(
/* Always use the language tag from the
maximal string, since it may be more
specific than the one provided. */
- createTagStringWithAlternates(
+ createTagStringWithAlternates(
NULL,
0,
script,
@@ -735,9 +735,9 @@ createLikelySubtagsString(
variants,
variantsLength,
likelySubtags,
- sink,
+ sink,
err);
- return TRUE;
+ return TRUE;
}
}
@@ -747,28 +747,28 @@ createLikelySubtagsString(
{
const char* likelySubtags = NULL;
- icu::CharString tagBuffer;
- {
- icu::CharStringByteSink sink(&tagBuffer);
- createTagString(
- lang,
- langLength,
- NULL,
- 0,
- NULL,
- 0,
- NULL,
- 0,
- sink,
- err);
- }
+ icu::CharString tagBuffer;
+ {
+ icu::CharStringByteSink sink(&tagBuffer);
+ createTagString(
+ lang,
+ langLength,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ sink,
+ err);
+ }
if(U_FAILURE(*err)) {
goto error;
}
likelySubtags =
findLikelySubtags(
- tagBuffer.data(),
+ tagBuffer.data(),
likelySubtagsBuffer,
sizeof(likelySubtagsBuffer),
err);
@@ -780,7 +780,7 @@ createLikelySubtagsString(
/* Always use the language tag from the
maximal string, since it may be more
specific than the one provided. */
- createTagStringWithAlternates(
+ createTagStringWithAlternates(
NULL,
0,
script,
@@ -790,13 +790,13 @@ createLikelySubtagsString(
variants,
variantsLength,
likelySubtags,
- sink,
+ sink,
err);
- return TRUE;
+ return TRUE;
}
}
- return FALSE;
+ return FALSE;
error:
@@ -804,32 +804,32 @@ error:
*err = U_ILLEGAL_ARGUMENT_ERROR;
}
- return FALSE;
+ return FALSE;
}
-#define CHECK_TRAILING_VARIANT_SIZE(trailing, trailingLength) UPRV_BLOCK_MACRO_BEGIN { \
- int32_t count = 0; \
- int32_t i; \
- for (i = 0; i < trailingLength; i++) { \
- if (trailing[i] == '-' || trailing[i] == '_') { \
- count = 0; \
- if (count > 8) { \
+#define CHECK_TRAILING_VARIANT_SIZE(trailing, trailingLength) UPRV_BLOCK_MACRO_BEGIN { \
+ int32_t count = 0; \
+ int32_t i; \
+ for (i = 0; i < trailingLength; i++) { \
+ if (trailing[i] == '-' || trailing[i] == '_') { \
+ count = 0; \
+ if (count > 8) { \
goto error; \
} \
- } else if (trailing[i] == '@') { \
- break; \
- } else if (count > 8) { \
- goto error; \
- } else { \
- count++; \
+ } else if (trailing[i] == '@') { \
+ break; \
+ } else if (count > 8) { \
+ goto error; \
+ } else { \
+ count++; \
} \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
-static void
-_uloc_addLikelySubtags(const char* localeID,
- icu::ByteSink& sink,
- UErrorCode* err) {
+static void
+_uloc_addLikelySubtags(const char* localeID,
+ icu::ByteSink& sink,
+ UErrorCode* err) {
char lang[ULOC_LANG_CAPACITY];
int32_t langLength = sizeof(lang);
char script[ULOC_SCRIPT_CAPACITY];
@@ -839,12 +839,12 @@ _uloc_addLikelySubtags(const char* localeID,
const char* trailing = "";
int32_t trailingLength = 0;
int32_t trailingIndex = 0;
- UBool success = FALSE;
+ UBool success = FALSE;
if(U_FAILURE(*err)) {
goto error;
}
- if (localeID == NULL) {
+ if (localeID == NULL) {
goto error;
}
@@ -875,7 +875,7 @@ _uloc_addLikelySubtags(const char* localeID,
CHECK_TRAILING_VARIANT_SIZE(trailing, trailingLength);
- success =
+ success =
createLikelySubtagsString(
lang,
langLength,
@@ -885,19 +885,19 @@ _uloc_addLikelySubtags(const char* localeID,
regionLength,
trailing,
trailingLength,
- sink,
+ sink,
err);
- if (!success) {
+ if (!success) {
const int32_t localIDLength = (int32_t)uprv_strlen(localeID);
/*
* If we get here, we need to return localeID.
*/
- sink.Append(localeID, localIDLength);
+ sink.Append(localeID, localIDLength);
}
- return;
+ return;
error:
@@ -906,11 +906,11 @@ error:
}
}
-static void
-_uloc_minimizeSubtags(const char* localeID,
- icu::ByteSink& sink,
- UErrorCode* err) {
- icu::CharString maximizedTagBuffer;
+static void
+_uloc_minimizeSubtags(const char* localeID,
+ icu::ByteSink& sink,
+ UErrorCode* err) {
+ icu::CharString maximizedTagBuffer;
char lang[ULOC_LANG_CAPACITY];
int32_t langLength = sizeof(lang);
@@ -925,7 +925,7 @@ _uloc_minimizeSubtags(const char* localeID,
if(U_FAILURE(*err)) {
goto error;
}
- else if (localeID == NULL) {
+ else if (localeID == NULL) {
goto error;
}
@@ -958,31 +958,31 @@ _uloc_minimizeSubtags(const char* localeID,
CHECK_TRAILING_VARIANT_SIZE(trailing, trailingLength);
- {
- icu::CharString base;
- {
- icu::CharStringByteSink sink(&base);
- createTagString(
- lang,
- langLength,
- script,
- scriptLength,
- region,
- regionLength,
- NULL,
- 0,
- sink,
- err);
- }
-
- /**
- * First, we need to first get the maximization
- * from AddLikelySubtags.
- **/
- {
- icu::CharStringByteSink sink(&maximizedTagBuffer);
- ulocimp_addLikelySubtags(base.data(), sink, err);
- }
+ {
+ icu::CharString base;
+ {
+ icu::CharStringByteSink sink(&base);
+ createTagString(
+ lang,
+ langLength,
+ script,
+ scriptLength,
+ region,
+ regionLength,
+ NULL,
+ 0,
+ sink,
+ err);
+ }
+
+ /**
+ * First, we need to first get the maximization
+ * from AddLikelySubtags.
+ **/
+ {
+ icu::CharStringByteSink sink(&maximizedTagBuffer);
+ ulocimp_addLikelySubtags(base.data(), sink, err);
+ }
}
if(U_FAILURE(*err)) {
@@ -993,9 +993,9 @@ _uloc_minimizeSubtags(const char* localeID,
* Start first with just the language.
**/
{
- icu::CharString tagBuffer;
- {
- icu::CharStringByteSink sink(&tagBuffer);
+ icu::CharString tagBuffer;
+ {
+ icu::CharStringByteSink sink(&tagBuffer);
createLikelySubtagsString(
lang,
langLength,
@@ -1005,19 +1005,19 @@ _uloc_minimizeSubtags(const char* localeID,
0,
NULL,
0,
- sink,
+ sink,
err);
- }
+ }
if(U_FAILURE(*err)) {
goto error;
}
- else if (!tagBuffer.isEmpty() && uprv_strnicmp(
- maximizedTagBuffer.data(),
- tagBuffer.data(),
- tagBuffer.length()) == 0) {
+ else if (!tagBuffer.isEmpty() && uprv_strnicmp(
+ maximizedTagBuffer.data(),
+ tagBuffer.data(),
+ tagBuffer.length()) == 0) {
- createTagString(
+ createTagString(
lang,
langLength,
NULL,
@@ -1026,9 +1026,9 @@ _uloc_minimizeSubtags(const char* localeID,
0,
trailing,
trailingLength,
- sink,
+ sink,
err);
- return;
+ return;
}
}
@@ -1037,9 +1037,9 @@ _uloc_minimizeSubtags(const char* localeID,
**/
if (regionLength > 0) {
- icu::CharString tagBuffer;
- {
- icu::CharStringByteSink sink(&tagBuffer);
+ icu::CharString tagBuffer;
+ {
+ icu::CharStringByteSink sink(&tagBuffer);
createLikelySubtagsString(
lang,
langLength,
@@ -1049,19 +1049,19 @@ _uloc_minimizeSubtags(const char* localeID,
regionLength,
NULL,
0,
- sink,
+ sink,
err);
- }
+ }
if(U_FAILURE(*err)) {
goto error;
}
else if (uprv_strnicmp(
- maximizedTagBuffer.data(),
- tagBuffer.data(),
- tagBuffer.length()) == 0) {
+ maximizedTagBuffer.data(),
+ tagBuffer.data(),
+ tagBuffer.length()) == 0) {
- createTagString(
+ createTagString(
lang,
langLength,
NULL,
@@ -1070,9 +1070,9 @@ _uloc_minimizeSubtags(const char* localeID,
regionLength,
trailing,
trailingLength,
- sink,
+ sink,
err);
- return;
+ return;
}
}
@@ -1082,9 +1082,9 @@ _uloc_minimizeSubtags(const char* localeID,
* maximal version that we already have.
**/
if (scriptLength > 0 && regionLength > 0) {
- icu::CharString tagBuffer;
- {
- icu::CharStringByteSink sink(&tagBuffer);
+ icu::CharString tagBuffer;
+ {
+ icu::CharStringByteSink sink(&tagBuffer);
createLikelySubtagsString(
lang,
langLength,
@@ -1094,19 +1094,19 @@ _uloc_minimizeSubtags(const char* localeID,
0,
NULL,
0,
- sink,
+ sink,
err);
- }
+ }
if(U_FAILURE(*err)) {
goto error;
}
else if (uprv_strnicmp(
- maximizedTagBuffer.data(),
- tagBuffer.data(),
- tagBuffer.length()) == 0) {
+ maximizedTagBuffer.data(),
+ tagBuffer.data(),
+ tagBuffer.length()) == 0) {
- createTagString(
+ createTagString(
lang,
langLength,
script,
@@ -1115,9 +1115,9 @@ _uloc_minimizeSubtags(const char* localeID,
0,
trailing,
trailingLength,
- sink,
+ sink,
err);
- return;
+ return;
}
}
@@ -1126,8 +1126,8 @@ _uloc_minimizeSubtags(const char* localeID,
* If we got here, return the locale ID parameter.
**/
const int32_t localeIDLength = (int32_t)uprv_strlen(localeID);
- sink.Append(localeID, localeIDLength);
- return;
+ sink.Append(localeID, localeIDLength);
+ return;
}
error:
@@ -1165,91 +1165,91 @@ do_canonicalize(const char* localeID,
}
U_CAPI int32_t U_EXPORT2
-uloc_addLikelySubtags(const char* localeID,
- char* maximizedLocaleID,
- int32_t maximizedLocaleIDCapacity,
- UErrorCode* status) {
- if (U_FAILURE(*status)) {
- return 0;
- }
-
- icu::CheckedArrayByteSink sink(
- maximizedLocaleID, maximizedLocaleIDCapacity);
-
- ulocimp_addLikelySubtags(localeID, sink, status);
- int32_t reslen = sink.NumberOfBytesAppended();
-
- if (U_FAILURE(*status)) {
- return sink.Overflowed() ? reslen : -1;
- }
-
- if (sink.Overflowed()) {
- *status = U_BUFFER_OVERFLOW_ERROR;
- } else {
- u_terminateChars(
- maximizedLocaleID, maximizedLocaleIDCapacity, reslen, status);
- }
-
- return reslen;
-}
-
-U_CAPI void U_EXPORT2
-ulocimp_addLikelySubtags(const char* localeID,
- icu::ByteSink& sink,
- UErrorCode* status) {
+uloc_addLikelySubtags(const char* localeID,
+ char* maximizedLocaleID,
+ int32_t maximizedLocaleIDCapacity,
+ UErrorCode* status) {
+ if (U_FAILURE(*status)) {
+ return 0;
+ }
+
+ icu::CheckedArrayByteSink sink(
+ maximizedLocaleID, maximizedLocaleIDCapacity);
+
+ ulocimp_addLikelySubtags(localeID, sink, status);
+ int32_t reslen = sink.NumberOfBytesAppended();
+
+ if (U_FAILURE(*status)) {
+ return sink.Overflowed() ? reslen : -1;
+ }
+
+ if (sink.Overflowed()) {
+ *status = U_BUFFER_OVERFLOW_ERROR;
+ } else {
+ u_terminateChars(
+ maximizedLocaleID, maximizedLocaleIDCapacity, reslen, status);
+ }
+
+ return reslen;
+}
+
+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);
+ if (do_canonicalize(localeID, localeBuffer, sizeof localeBuffer, status)) {
+ _uloc_addLikelySubtags(localeBuffer, sink, status);
}
}
U_CAPI int32_t U_EXPORT2
-uloc_minimizeSubtags(const char* localeID,
- char* minimizedLocaleID,
- int32_t minimizedLocaleIDCapacity,
- UErrorCode* status) {
- if (U_FAILURE(*status)) {
- return 0;
- }
-
- icu::CheckedArrayByteSink sink(
- minimizedLocaleID, minimizedLocaleIDCapacity);
-
- ulocimp_minimizeSubtags(localeID, sink, status);
- int32_t reslen = sink.NumberOfBytesAppended();
-
- if (U_FAILURE(*status)) {
- return sink.Overflowed() ? reslen : -1;
- }
-
- if (sink.Overflowed()) {
- *status = U_BUFFER_OVERFLOW_ERROR;
- } else {
- u_terminateChars(
- minimizedLocaleID, minimizedLocaleIDCapacity, reslen, status);
- }
-
- return reslen;
-}
-
-U_CAPI void U_EXPORT2
-ulocimp_minimizeSubtags(const char* localeID,
- icu::ByteSink& sink,
- UErrorCode* status) {
+uloc_minimizeSubtags(const char* localeID,
+ char* minimizedLocaleID,
+ int32_t minimizedLocaleIDCapacity,
+ UErrorCode* status) {
+ if (U_FAILURE(*status)) {
+ return 0;
+ }
+
+ icu::CheckedArrayByteSink sink(
+ minimizedLocaleID, minimizedLocaleIDCapacity);
+
+ ulocimp_minimizeSubtags(localeID, sink, status);
+ int32_t reslen = sink.NumberOfBytesAppended();
+
+ if (U_FAILURE(*status)) {
+ return sink.Overflowed() ? reslen : -1;
+ }
+
+ if (sink.Overflowed()) {
+ *status = U_BUFFER_OVERFLOW_ERROR;
+ } else {
+ u_terminateChars(
+ minimizedLocaleID, minimizedLocaleIDCapacity, reslen, status);
+ }
+
+ return reslen;
+}
+
+U_CAPI void U_EXPORT2
+ulocimp_minimizeSubtags(const char* localeID,
+ icu::ByteSink& sink,
+ UErrorCode* status) {
char localeBuffer[ULOC_FULLNAME_CAPACITY];
- if (do_canonicalize(localeID, localeBuffer, sizeof localeBuffer, status)) {
- _uloc_minimizeSubtags(localeBuffer, sink, status);
+ if (do_canonicalize(localeID, localeBuffer, sizeof localeBuffer, status)) {
+ _uloc_minimizeSubtags(localeBuffer, sink, status);
}
}
// Pairs of (language subtag, + or -) for finding out fast if common languages
// are LTR (minus) or RTL (plus).
-static const char LANG_DIR_STRING[] =
+static const char LANG_DIR_STRING[] =
"root-en-es-pt-zh-ja-ko-de-fr-it-ar+he+fa+ru-nl-pl-th-tr-";
-// Implemented here because this calls ulocimp_addLikelySubtags().
+// Implemented here because this calls ulocimp_addLikelySubtags().
U_CAPI UBool U_EXPORT2
uloc_isRightToLeft(const char *locale) {
UErrorCode errorCode = U_ZERO_ERROR;
@@ -1262,30 +1262,30 @@ uloc_isRightToLeft(const char *locale) {
errorCode = U_ZERO_ERROR;
char lang[8];
int32_t langLength = uloc_getLanguage(locale, lang, UPRV_LENGTHOF(lang), &errorCode);
- if (U_FAILURE(errorCode) || errorCode == U_STRING_NOT_TERMINATED_WARNING) {
+ if (U_FAILURE(errorCode) || errorCode == U_STRING_NOT_TERMINATED_WARNING) {
return FALSE;
}
- if (langLength > 0) {
- const char* langPtr = uprv_strstr(LANG_DIR_STRING, lang);
- if (langPtr != NULL) {
- switch (langPtr[langLength]) {
- case '-': return FALSE;
- case '+': return TRUE;
- default: break; // partial match of a longer code
- }
+ if (langLength > 0) {
+ const char* langPtr = uprv_strstr(LANG_DIR_STRING, lang);
+ if (langPtr != NULL) {
+ switch (langPtr[langLength]) {
+ case '-': return FALSE;
+ case '+': return TRUE;
+ default: break; // partial match of a longer code
+ }
}
}
// Otherwise, find the likely script.
errorCode = U_ZERO_ERROR;
- icu::CharString likely;
- {
- icu::CharStringByteSink sink(&likely);
- ulocimp_addLikelySubtags(locale, sink, &errorCode);
- }
+ icu::CharString likely;
+ {
+ icu::CharStringByteSink sink(&likely);
+ ulocimp_addLikelySubtags(locale, sink, &errorCode);
+ }
if (U_FAILURE(errorCode) || errorCode == U_STRING_NOT_TERMINATED_WARNING) {
return FALSE;
}
- scriptLength = uloc_getScript(likely.data(), script, UPRV_LENGTHOF(script), &errorCode);
+ scriptLength = uloc_getScript(likely.data(), script, UPRV_LENGTHOF(script), &errorCode);
if (U_FAILURE(errorCode) || errorCode == U_STRING_NOT_TERMINATED_WARNING ||
scriptLength == 0) {
return FALSE;
@@ -1337,13 +1337,13 @@ ulocimp_getRegionForSupplementalData(const char *localeID, UBool inferRegion,
} else if (rgLen == 0 && inferRegion) {
// no unicode_region_subtag but inferRegion TRUE, try likely subtags
rgStatus = U_ZERO_ERROR;
- icu::CharString locBuf;
- {
- icu::CharStringByteSink sink(&locBuf);
- ulocimp_addLikelySubtags(localeID, sink, &rgStatus);
- }
+ icu::CharString locBuf;
+ {
+ icu::CharStringByteSink sink(&locBuf);
+ ulocimp_addLikelySubtags(localeID, sink, &rgStatus);
+ }
if (U_SUCCESS(rgStatus)) {
- rgLen = uloc_getCountry(locBuf.data(), rgBuf, ULOC_RG_BUFLEN, status);
+ rgLen = uloc_getCountry(locBuf.data(), rgBuf, ULOC_RG_BUFLEN, status);
if (U_FAILURE(*status)) {
rgLen = 0;
}
diff --git a/contrib/libs/icu/common/loclikelysubtags.cpp b/contrib/libs/icu/common/loclikelysubtags.cpp
index d575f7e4dd..1fbf1a1463 100644
--- a/contrib/libs/icu/common/loclikelysubtags.cpp
+++ b/contrib/libs/icu/common/loclikelysubtags.cpp
@@ -1,746 +1,746 @@
-// © 2019 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html#License
-
-// loclikelysubtags.cpp
-// created: 2019may08 Markus W. Scherer
-
-#include <utility>
-#include "unicode/utypes.h"
-#include "unicode/bytestrie.h"
-#include "unicode/localpointer.h"
-#include "unicode/locid.h"
-#include "unicode/uobject.h"
-#include "unicode/ures.h"
-#include "charstr.h"
-#include "cstring.h"
-#include "loclikelysubtags.h"
-#include "lsr.h"
-#include "uassert.h"
-#include "ucln_cmn.h"
-#include "uhash.h"
-#include "uinvchar.h"
-#include "umutex.h"
-#include "uresdata.h"
-#include "uresimp.h"
-
-U_NAMESPACE_BEGIN
-
-namespace {
-
-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) :
- distanceTrieBytes(data.distanceTrieBytes),
- regionToPartitions(data.regionToPartitions),
- partitions(data.partitions),
- paradigms(data.paradigms), paradigmsLength(data.paradigmsLength),
- distances(data.distances) {
- data.partitions = nullptr;
- data.paradigms = nullptr;
-}
-
-LocaleDistanceData::~LocaleDistanceData() {
- uprv_free(partitions);
- delete[] paradigms;
-}
-
-// TODO(ICU-20777): Rename to just LikelySubtagsData.
-struct XLikelySubtagsData {
- UResourceBundle *langInfoBundle = nullptr;
- UniqueCharStrings strings;
- CharStringMap languageAliases;
- CharStringMap regionAliases;
- const uint8_t *trieBytes = nullptr;
- LSR *lsrs = nullptr;
- int32_t lsrsLength = 0;
-
- LocaleDistanceData distanceData;
-
- XLikelySubtagsData(UErrorCode &errorCode) : strings(errorCode) {}
-
- ~XLikelySubtagsData() {
- ures_close(langInfoBundle);
- delete[] lsrs;
- }
-
- void load(UErrorCode &errorCode) {
- langInfoBundle = ures_openDirect(nullptr, "langInfo", &errorCode);
- if (U_FAILURE(errorCode)) { return; }
- StackUResourceBundle stackTempBundle;
- ResourceDataValue value;
- ures_getValueWithFallback(langInfoBundle, "likely", stackTempBundle.getAlias(),
- value, errorCode);
- ResourceTable likelyTable = value.getTable(errorCode);
- if (U_FAILURE(errorCode)) { return; }
-
- // Read all strings in the resource bundle and convert them to invariant char *.
- LocalMemory<int32_t> languageIndexes, regionIndexes, lsrSubtagIndexes;
- int32_t languagesLength = 0, regionsLength = 0, lsrSubtagsLength = 0;
- if (!readStrings(likelyTable, "languageAliases", value,
- languageIndexes, languagesLength, errorCode) ||
- !readStrings(likelyTable, "regionAliases", value,
- regionIndexes, regionsLength, errorCode) ||
- !readStrings(likelyTable, "lsrs", value,
- lsrSubtagIndexes,lsrSubtagsLength, errorCode)) {
- return;
- }
- if ((languagesLength & 1) != 0 ||
- (regionsLength & 1) != 0 ||
- (lsrSubtagsLength % 3) != 0) {
- errorCode = U_INVALID_FORMAT_ERROR;
- return;
- }
- if (lsrSubtagsLength == 0) {
- errorCode = U_MISSING_RESOURCE_ERROR;
- return;
- }
-
- if (!likelyTable.findValue("trie", value)) {
- errorCode = U_MISSING_RESOURCE_ERROR;
- return;
- }
- int32_t length;
- trieBytes = value.getBinary(length, errorCode);
- if (U_FAILURE(errorCode)) { return; }
-
- // Also read distance/matcher data if available,
- // to open & keep only one resource bundle pointer
- // and to use one single UniqueCharStrings.
- UErrorCode matchErrorCode = U_ZERO_ERROR;
- ures_getValueWithFallback(langInfoBundle, "match", stackTempBundle.getAlias(),
- value, matchErrorCode);
- LocalMemory<int32_t> partitionIndexes, paradigmSubtagIndexes;
- int32_t partitionsLength = 0, paradigmSubtagsLength = 0;
- if (U_SUCCESS(matchErrorCode)) {
- ResourceTable matchTable = value.getTable(errorCode);
- if (U_FAILURE(errorCode)) { return; }
-
- if (matchTable.findValue("trie", value)) {
- distanceData.distanceTrieBytes = value.getBinary(length, errorCode);
- if (U_FAILURE(errorCode)) { return; }
- }
-
- if (matchTable.findValue("regionToPartitions", value)) {
- distanceData.regionToPartitions = value.getBinary(length, errorCode);
- if (U_FAILURE(errorCode)) { return; }
- if (length < LSR::REGION_INDEX_LIMIT) {
- errorCode = U_INVALID_FORMAT_ERROR;
- return;
- }
- }
-
- if (!readStrings(matchTable, "partitions", value,
- partitionIndexes, partitionsLength, errorCode) ||
- !readStrings(matchTable, "paradigms", value,
- paradigmSubtagIndexes, paradigmSubtagsLength, errorCode)) {
- return;
- }
- if ((paradigmSubtagsLength % 3) != 0) {
- errorCode = U_INVALID_FORMAT_ERROR;
- return;
- }
-
- if (matchTable.findValue("distances", value)) {
- distanceData.distances = value.getIntVector(length, errorCode);
- if (U_FAILURE(errorCode)) { return; }
- if (length < 4) { // LocaleDistance IX_LIMIT
- errorCode = U_INVALID_FORMAT_ERROR;
- return;
- }
- }
- } else if (matchErrorCode == U_MISSING_RESOURCE_ERROR) {
- // ok for likely subtags
- } else { // error other than missing resource
- errorCode = matchErrorCode;
- return;
- }
-
- // Fetch & store invariant-character versions of strings
- // only after we have collected and de-duplicated all of them.
- strings.freeze();
-
- languageAliases = CharStringMap(languagesLength / 2, errorCode);
- for (int32_t i = 0; i < languagesLength; i += 2) {
- languageAliases.put(strings.get(languageIndexes[i]),
- strings.get(languageIndexes[i + 1]), errorCode);
- }
-
- regionAliases = CharStringMap(regionsLength / 2, errorCode);
- for (int32_t i = 0; i < regionsLength; i += 2) {
- regionAliases.put(strings.get(regionIndexes[i]),
- strings.get(regionIndexes[i + 1]), errorCode);
- }
- if (U_FAILURE(errorCode)) { return; }
-
- lsrsLength = lsrSubtagsLength / 3;
- lsrs = new LSR[lsrsLength];
- if (lsrs == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- for (int32_t i = 0, j = 0; i < lsrSubtagsLength; i += 3, ++j) {
- lsrs[j] = LSR(strings.get(lsrSubtagIndexes[i]),
- strings.get(lsrSubtagIndexes[i + 1]),
- strings.get(lsrSubtagIndexes[i + 2]),
- LSR::IMPLICIT_LSR);
- }
-
- if (partitionsLength > 0) {
- distanceData.partitions = static_cast<const char **>(
- uprv_malloc(partitionsLength * sizeof(const char *)));
- if (distanceData.partitions == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- for (int32_t i = 0; i < partitionsLength; ++i) {
- distanceData.partitions[i] = strings.get(partitionIndexes[i]);
- }
- }
-
- if (paradigmSubtagsLength > 0) {
- distanceData.paradigmsLength = paradigmSubtagsLength / 3;
- LSR *paradigms = new LSR[distanceData.paradigmsLength];
- if (paradigms == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- for (int32_t i = 0, j = 0; i < paradigmSubtagsLength; i += 3, ++j) {
- paradigms[j] = LSR(strings.get(paradigmSubtagIndexes[i]),
- strings.get(paradigmSubtagIndexes[i + 1]),
- strings.get(paradigmSubtagIndexes[i + 2]),
- LSR::DONT_CARE_FLAGS);
- }
- distanceData.paradigms = paradigms;
- }
- }
-
-private:
- bool readStrings(const ResourceTable &table, const char *key, ResourceValue &value,
- LocalMemory<int32_t> &indexes, int32_t &length, UErrorCode &errorCode) {
- if (table.findValue(key, value)) {
- ResourceArray stringArray = value.getArray(errorCode);
- if (U_FAILURE(errorCode)) { return false; }
- length = stringArray.getSize();
- if (length == 0) { return true; }
- int32_t *rawIndexes = indexes.allocateInsteadAndCopy(length);
- if (rawIndexes == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- for (int i = 0; i < length; ++i) {
- stringArray.getValue(i, value); // returns TRUE because i < length
- rawIndexes[i] = strings.add(value.getUnicodeString(errorCode), errorCode);
- if (U_FAILURE(errorCode)) { return false; }
- }
- }
- return true;
- }
-};
-
-namespace {
-
-XLikelySubtags *gLikelySubtags = nullptr;
-UInitOnce gInitOnce = U_INITONCE_INITIALIZER;
-
-UBool U_CALLCONV cleanup() {
- delete gLikelySubtags;
- gLikelySubtags = nullptr;
- gInitOnce.reset();
- return TRUE;
-}
-
-} // namespace
-
-void U_CALLCONV XLikelySubtags::initLikelySubtags(UErrorCode &errorCode) {
- // This function is invoked only via umtx_initOnce().
- U_ASSERT(gLikelySubtags == nullptr);
- XLikelySubtagsData data(errorCode);
- data.load(errorCode);
- if (U_FAILURE(errorCode)) { return; }
- gLikelySubtags = new XLikelySubtags(data);
- if (gLikelySubtags == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- ucln_common_registerCleanup(UCLN_COMMON_LIKELY_SUBTAGS, cleanup);
-}
-
-const XLikelySubtags *XLikelySubtags::getSingleton(UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) { return nullptr; }
- umtx_initOnce(gInitOnce, &XLikelySubtags::initLikelySubtags, errorCode);
- return gLikelySubtags;
-}
-
-XLikelySubtags::XLikelySubtags(XLikelySubtagsData &data) :
- langInfoBundle(data.langInfoBundle),
- strings(data.strings.orphanCharStrings()),
- languageAliases(std::move(data.languageAliases)),
- regionAliases(std::move(data.regionAliases)),
- trie(data.trieBytes),
- lsrs(data.lsrs),
-#if U_DEBUG
- lsrsLength(data.lsrsLength),
-#endif
- distanceData(std::move(data.distanceData)) {
- data.langInfoBundle = nullptr;
- data.lsrs = nullptr;
-
- // Cache the result of looking up language="und" encoded as "*", and "und-Zzzz" ("**").
- UStringTrieResult result = trie.next(u'*');
- U_ASSERT(USTRINGTRIE_HAS_NEXT(result));
- trieUndState = trie.getState64();
- result = trie.next(u'*');
- U_ASSERT(USTRINGTRIE_HAS_NEXT(result));
- trieUndZzzzState = trie.getState64();
- result = trie.next(u'*');
- U_ASSERT(USTRINGTRIE_HAS_VALUE(result));
- defaultLsrIndex = trie.getValue();
- trie.reset();
-
- for (char16_t c = u'a'; c <= u'z'; ++c) {
- result = trie.next(c);
- if (result == USTRINGTRIE_NO_VALUE) {
- trieFirstLetterStates[c - u'a'] = trie.getState64();
- }
- trie.reset();
- }
-}
-
-XLikelySubtags::~XLikelySubtags() {
- ures_close(langInfoBundle);
- delete strings;
- delete[] lsrs;
-}
-
-LSR XLikelySubtags::makeMaximizedLsrFrom(const Locale &locale, UErrorCode &errorCode) const {
- const char *name = locale.getName();
- if (uprv_isAtSign(name[0]) && name[1] == 'x' && name[2] == '=') { // name.startsWith("@x=")
- // Private use language tag x-subtag-subtag...
- return LSR(name, "", "", LSR::EXPLICIT_LSR);
- }
- return makeMaximizedLsr(locale.getLanguage(), locale.getScript(), locale.getCountry(),
- locale.getVariant(), errorCode);
-}
-
-namespace {
-
-const char *getCanonical(const CharStringMap &aliases, const char *alias) {
- const char *canonical = aliases.get(alias);
- return canonical == nullptr ? alias : canonical;
-}
-
-} // namespace
-
-LSR XLikelySubtags::makeMaximizedLsr(const char *language, const char *script, const char *region,
- const char *variant, UErrorCode &errorCode) const {
- // Handle pseudolocales like en-XA, ar-XB, fr-PSCRACK.
- // They should match only themselves,
- // not other locales with what looks like the same language and script subtags.
- char c1;
- if (region[0] == 'X' && (c1 = region[1]) != 0 && region[2] == 0) {
- switch (c1) {
- case 'A':
- return LSR(PSEUDO_ACCENTS_PREFIX, language, script, region,
- LSR::EXPLICIT_LSR, errorCode);
- case 'B':
- return LSR(PSEUDO_BIDI_PREFIX, language, script, region,
- LSR::EXPLICIT_LSR, errorCode);
- case 'C':
- return LSR(PSEUDO_CRACKED_PREFIX, language, script, region,
- LSR::EXPLICIT_LSR, errorCode);
- default: // normal locale
- break;
- }
- }
-
- if (variant[0] == 'P' && variant[1] == 'S') {
- int32_t lsrFlags = *region == 0 ?
- LSR::EXPLICIT_LANGUAGE | LSR::EXPLICIT_SCRIPT : LSR::EXPLICIT_LSR;
- if (uprv_strcmp(variant, "PSACCENT") == 0) {
- return LSR(PSEUDO_ACCENTS_PREFIX, language, script,
- *region == 0 ? "XA" : region, lsrFlags, errorCode);
- } else if (uprv_strcmp(variant, "PSBIDI") == 0) {
- return LSR(PSEUDO_BIDI_PREFIX, language, script,
- *region == 0 ? "XB" : region, lsrFlags, errorCode);
- } else if (uprv_strcmp(variant, "PSCRACK") == 0) {
- return LSR(PSEUDO_CRACKED_PREFIX, language, script,
- *region == 0 ? "XC" : region, lsrFlags, errorCode);
- }
- // else normal locale
- }
-
- language = getCanonical(languageAliases, language);
- // (We have no script mappings.)
- region = getCanonical(regionAliases, region);
- return maximize(language, script, region);
-}
-
-LSR XLikelySubtags::maximize(const char *language, const char *script, const char *region) const {
- if (uprv_strcmp(language, "und") == 0) {
- language = "";
- }
- if (uprv_strcmp(script, "Zzzz") == 0) {
- script = "";
- }
- if (uprv_strcmp(region, "ZZ") == 0) {
- region = "";
- }
- if (*script != 0 && *region != 0 && *language != 0) {
- return LSR(language, script, region, LSR::EXPLICIT_LSR); // already maximized
- }
-
- uint32_t retainOldMask = 0;
- BytesTrie iter(trie);
- uint64_t state;
- int32_t value;
- // Small optimization: Array lookup for first language letter.
- int32_t c0;
- if (0 <= (c0 = uprv_lowerOrdinal(language[0])) && c0 <= 25 &&
- language[1] != 0 && // language.length() >= 2
- (state = trieFirstLetterStates[c0]) != 0) {
- value = trieNext(iter.resetToState64(state), language, 1);
- } else {
- value = trieNext(iter, language, 0);
- }
- if (value >= 0) {
- if (*language != 0) {
- retainOldMask |= 4;
- }
- state = iter.getState64();
- } else {
- retainOldMask |= 4;
- iter.resetToState64(trieUndState); // "und" ("*")
- state = 0;
- }
-
- if (value > 0) {
- // Intermediate or final value from just language.
- if (value == SKIP_SCRIPT) {
- value = 0;
- }
- if (*script != 0) {
- retainOldMask |= 2;
- }
- } else {
- value = trieNext(iter, script, 0);
- if (value >= 0) {
- if (*script != 0) {
- retainOldMask |= 2;
- }
- state = iter.getState64();
- } else {
- retainOldMask |= 2;
- if (state == 0) {
- iter.resetToState64(trieUndZzzzState); // "und-Zzzz" ("**")
- } else {
- iter.resetToState64(state);
- value = trieNext(iter, "", 0);
- U_ASSERT(value >= 0);
- state = iter.getState64();
- }
- }
- }
-
- if (value > 0) {
- // Final value from just language or language+script.
- if (*region != 0) {
- retainOldMask |= 1;
- }
- } else {
- value = trieNext(iter, region, 0);
- if (value >= 0) {
- if (*region != 0) {
- retainOldMask |= 1;
- }
- } else {
- retainOldMask |= 1;
- if (state == 0) {
- value = defaultLsrIndex;
- } else {
- iter.resetToState64(state);
- value = trieNext(iter, "", 0);
- U_ASSERT(value > 0);
- }
- }
- }
- U_ASSERT(value < lsrsLength);
- const LSR &result = lsrs[value];
-
- if (*language == 0) {
- language = "und";
- }
-
- if (retainOldMask == 0) {
- // Quickly return a copy of the lookup-result LSR
- // without new allocation of the subtags.
- return LSR(result.language, result.script, result.region, result.flags);
- }
- if ((retainOldMask & 4) == 0) {
- language = result.language;
- }
- if ((retainOldMask & 2) == 0) {
- script = result.script;
- }
- if ((retainOldMask & 1) == 0) {
- region = result.region;
- }
- // retainOldMask flags = LSR explicit-subtag flags
- return LSR(language, script, region, retainOldMask);
-}
-
-int32_t XLikelySubtags::compareLikely(const LSR &lsr, const LSR &other, int32_t likelyInfo) const {
- // If likelyInfo >= 0:
- // likelyInfo bit 1 is set if the previous comparison with lsr
- // was for equal language and script.
- // Otherwise the scripts differed.
- if (uprv_strcmp(lsr.language, other.language) != 0) {
- return 0xfffffffc; // negative, lsr not better than other
- }
- if (uprv_strcmp(lsr.script, other.script) != 0) {
- int32_t index;
- if (likelyInfo >= 0 && (likelyInfo & 2) == 0) {
- index = likelyInfo >> 2;
- } else {
- index = getLikelyIndex(lsr.language, "");
- likelyInfo = index << 2;
- }
- const LSR &likely = lsrs[index];
- if (uprv_strcmp(lsr.script, likely.script) == 0) {
- return likelyInfo | 1;
- } else {
- return likelyInfo & ~1;
- }
- }
- if (uprv_strcmp(lsr.region, other.region) != 0) {
- int32_t index;
- if (likelyInfo >= 0 && (likelyInfo & 2) != 0) {
- index = likelyInfo >> 2;
- } else {
- index = getLikelyIndex(lsr.language, lsr.region);
- likelyInfo = (index << 2) | 2;
- }
- const LSR &likely = lsrs[index];
- if (uprv_strcmp(lsr.region, likely.region) == 0) {
- return likelyInfo | 1;
- } else {
- return likelyInfo & ~1;
- }
- }
- return likelyInfo & ~1; // lsr not better than other
-}
-
-// Subset of maximize().
-int32_t XLikelySubtags::getLikelyIndex(const char *language, const char *script) const {
- if (uprv_strcmp(language, "und") == 0) {
- language = "";
- }
- if (uprv_strcmp(script, "Zzzz") == 0) {
- script = "";
- }
-
- BytesTrie iter(trie);
- uint64_t state;
- int32_t value;
- // Small optimization: Array lookup for first language letter.
- int32_t c0;
- if (0 <= (c0 = uprv_lowerOrdinal(language[0])) && c0 <= 25 &&
- language[1] != 0 && // language.length() >= 2
- (state = trieFirstLetterStates[c0]) != 0) {
- value = trieNext(iter.resetToState64(state), language, 1);
- } else {
- value = trieNext(iter, language, 0);
- }
- if (value >= 0) {
- state = iter.getState64();
- } else {
- iter.resetToState64(trieUndState); // "und" ("*")
- state = 0;
- }
-
- if (value > 0) {
- // Intermediate or final value from just language.
- if (value == SKIP_SCRIPT) {
- value = 0;
- }
- } else {
- value = trieNext(iter, script, 0);
- if (value >= 0) {
- state = iter.getState64();
- } else {
- if (state == 0) {
- iter.resetToState64(trieUndZzzzState); // "und-Zzzz" ("**")
- } else {
- iter.resetToState64(state);
- value = trieNext(iter, "", 0);
- U_ASSERT(value >= 0);
- state = iter.getState64();
- }
- }
- }
-
- if (value > 0) {
- // Final value from just language or language+script.
- } else {
- value = trieNext(iter, "", 0);
- U_ASSERT(value > 0);
- }
- U_ASSERT(value < lsrsLength);
- return value;
-}
-
-int32_t XLikelySubtags::trieNext(BytesTrie &iter, const char *s, int32_t i) {
- UStringTrieResult result;
- uint8_t c;
- if ((c = s[i]) == 0) {
- result = iter.next(u'*');
- } else {
- for (;;) {
- c = uprv_invCharToAscii(c);
- // EBCDIC: If s[i] is not an invariant character,
- // then c is now 0 and will simply not match anything, which is harmless.
- uint8_t next = s[++i];
- if (next != 0) {
- if (!USTRINGTRIE_HAS_NEXT(iter.next(c))) {
- return -1;
- }
- } else {
- // last character of this subtag
- result = iter.next(c | 0x80);
- break;
- }
- c = next;
- }
- }
- switch (result) {
- case USTRINGTRIE_NO_MATCH: return -1;
- case USTRINGTRIE_NO_VALUE: return 0;
- case USTRINGTRIE_INTERMEDIATE_VALUE:
- U_ASSERT(iter.getValue() == SKIP_SCRIPT);
- return SKIP_SCRIPT;
- case USTRINGTRIE_FINAL_VALUE: return iter.getValue();
- default: return -1;
- }
-}
-
-// TODO(ICU-20777): Switch Locale/uloc_ likely-subtags API from the old code
-// in loclikely.cpp to this new code, including activating this
-// minimizeSubtags() function. The LocaleMatcher does not minimize.
-#if 0
-LSR XLikelySubtags::minimizeSubtags(const char *languageIn, const char *scriptIn,
- const char *regionIn, ULocale.Minimize fieldToFavor,
- UErrorCode &errorCode) const {
- LSR result = maximize(languageIn, scriptIn, regionIn);
-
- // We could try just a series of checks, like:
- // LSR result2 = addLikelySubtags(languageIn, "", "");
- // if result.equals(result2) return result2;
- // However, we can optimize 2 of the cases:
- // (languageIn, "", "")
- // (languageIn, "", regionIn)
-
- // value00 = lookup(result.language, "", "")
- BytesTrie iter = new BytesTrie(trie);
- int value = trieNext(iter, result.language, 0);
- U_ASSERT(value >= 0);
- if (value == 0) {
- value = trieNext(iter, "", 0);
- U_ASSERT(value >= 0);
- if (value == 0) {
- value = trieNext(iter, "", 0);
- }
- }
- U_ASSERT(value > 0);
- LSR value00 = lsrs[value];
- boolean favorRegionOk = false;
- if (result.script.equals(value00.script)) { //script is default
- if (result.region.equals(value00.region)) {
- return new LSR(result.language, "", "", LSR.DONT_CARE_FLAGS);
- } else if (fieldToFavor == ULocale.Minimize.FAVOR_REGION) {
- return new LSR(result.language, "", result.region, LSR.DONT_CARE_FLAGS);
- } else {
- favorRegionOk = true;
- }
- }
-
- // The last case is not as easy to optimize.
- // Maybe do later, but for now use the straightforward code.
- LSR result2 = maximize(languageIn, scriptIn, "");
- if (result2.equals(result)) {
- return new LSR(result.language, result.script, "", LSR.DONT_CARE_FLAGS);
- } else if (favorRegionOk) {
- return new LSR(result.language, "", result.region, LSR.DONT_CARE_FLAGS);
- }
- return result;
-}
-#endif
-
-U_NAMESPACE_END
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// loclikelysubtags.cpp
+// created: 2019may08 Markus W. Scherer
+
+#include <utility>
+#include "unicode/utypes.h"
+#include "unicode/bytestrie.h"
+#include "unicode/localpointer.h"
+#include "unicode/locid.h"
+#include "unicode/uobject.h"
+#include "unicode/ures.h"
+#include "charstr.h"
+#include "cstring.h"
+#include "loclikelysubtags.h"
+#include "lsr.h"
+#include "uassert.h"
+#include "ucln_cmn.h"
+#include "uhash.h"
+#include "uinvchar.h"
+#include "umutex.h"
+#include "uresdata.h"
+#include "uresimp.h"
+
+U_NAMESPACE_BEGIN
+
+namespace {
+
+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) :
+ distanceTrieBytes(data.distanceTrieBytes),
+ regionToPartitions(data.regionToPartitions),
+ partitions(data.partitions),
+ paradigms(data.paradigms), paradigmsLength(data.paradigmsLength),
+ distances(data.distances) {
+ data.partitions = nullptr;
+ data.paradigms = nullptr;
+}
+
+LocaleDistanceData::~LocaleDistanceData() {
+ uprv_free(partitions);
+ delete[] paradigms;
+}
+
+// TODO(ICU-20777): Rename to just LikelySubtagsData.
+struct XLikelySubtagsData {
+ UResourceBundle *langInfoBundle = nullptr;
+ UniqueCharStrings strings;
+ CharStringMap languageAliases;
+ CharStringMap regionAliases;
+ const uint8_t *trieBytes = nullptr;
+ LSR *lsrs = nullptr;
+ int32_t lsrsLength = 0;
+
+ LocaleDistanceData distanceData;
+
+ XLikelySubtagsData(UErrorCode &errorCode) : strings(errorCode) {}
+
+ ~XLikelySubtagsData() {
+ ures_close(langInfoBundle);
+ delete[] lsrs;
+ }
+
+ void load(UErrorCode &errorCode) {
+ langInfoBundle = ures_openDirect(nullptr, "langInfo", &errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ StackUResourceBundle stackTempBundle;
+ ResourceDataValue value;
+ ures_getValueWithFallback(langInfoBundle, "likely", stackTempBundle.getAlias(),
+ value, errorCode);
+ ResourceTable likelyTable = value.getTable(errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+
+ // Read all strings in the resource bundle and convert them to invariant char *.
+ LocalMemory<int32_t> languageIndexes, regionIndexes, lsrSubtagIndexes;
+ int32_t languagesLength = 0, regionsLength = 0, lsrSubtagsLength = 0;
+ if (!readStrings(likelyTable, "languageAliases", value,
+ languageIndexes, languagesLength, errorCode) ||
+ !readStrings(likelyTable, "regionAliases", value,
+ regionIndexes, regionsLength, errorCode) ||
+ !readStrings(likelyTable, "lsrs", value,
+ lsrSubtagIndexes,lsrSubtagsLength, errorCode)) {
+ return;
+ }
+ if ((languagesLength & 1) != 0 ||
+ (regionsLength & 1) != 0 ||
+ (lsrSubtagsLength % 3) != 0) {
+ errorCode = U_INVALID_FORMAT_ERROR;
+ return;
+ }
+ if (lsrSubtagsLength == 0) {
+ errorCode = U_MISSING_RESOURCE_ERROR;
+ return;
+ }
+
+ if (!likelyTable.findValue("trie", value)) {
+ errorCode = U_MISSING_RESOURCE_ERROR;
+ return;
+ }
+ int32_t length;
+ trieBytes = value.getBinary(length, errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+
+ // Also read distance/matcher data if available,
+ // to open & keep only one resource bundle pointer
+ // and to use one single UniqueCharStrings.
+ UErrorCode matchErrorCode = U_ZERO_ERROR;
+ ures_getValueWithFallback(langInfoBundle, "match", stackTempBundle.getAlias(),
+ value, matchErrorCode);
+ LocalMemory<int32_t> partitionIndexes, paradigmSubtagIndexes;
+ int32_t partitionsLength = 0, paradigmSubtagsLength = 0;
+ if (U_SUCCESS(matchErrorCode)) {
+ ResourceTable matchTable = value.getTable(errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+
+ if (matchTable.findValue("trie", value)) {
+ distanceData.distanceTrieBytes = value.getBinary(length, errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ }
+
+ if (matchTable.findValue("regionToPartitions", value)) {
+ distanceData.regionToPartitions = value.getBinary(length, errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ if (length < LSR::REGION_INDEX_LIMIT) {
+ errorCode = U_INVALID_FORMAT_ERROR;
+ return;
+ }
+ }
+
+ if (!readStrings(matchTable, "partitions", value,
+ partitionIndexes, partitionsLength, errorCode) ||
+ !readStrings(matchTable, "paradigms", value,
+ paradigmSubtagIndexes, paradigmSubtagsLength, errorCode)) {
+ return;
+ }
+ if ((paradigmSubtagsLength % 3) != 0) {
+ errorCode = U_INVALID_FORMAT_ERROR;
+ return;
+ }
+
+ if (matchTable.findValue("distances", value)) {
+ distanceData.distances = value.getIntVector(length, errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ if (length < 4) { // LocaleDistance IX_LIMIT
+ errorCode = U_INVALID_FORMAT_ERROR;
+ return;
+ }
+ }
+ } else if (matchErrorCode == U_MISSING_RESOURCE_ERROR) {
+ // ok for likely subtags
+ } else { // error other than missing resource
+ errorCode = matchErrorCode;
+ return;
+ }
+
+ // Fetch & store invariant-character versions of strings
+ // only after we have collected and de-duplicated all of them.
+ strings.freeze();
+
+ languageAliases = CharStringMap(languagesLength / 2, errorCode);
+ for (int32_t i = 0; i < languagesLength; i += 2) {
+ languageAliases.put(strings.get(languageIndexes[i]),
+ strings.get(languageIndexes[i + 1]), errorCode);
+ }
+
+ regionAliases = CharStringMap(regionsLength / 2, errorCode);
+ for (int32_t i = 0; i < regionsLength; i += 2) {
+ regionAliases.put(strings.get(regionIndexes[i]),
+ strings.get(regionIndexes[i + 1]), errorCode);
+ }
+ if (U_FAILURE(errorCode)) { return; }
+
+ lsrsLength = lsrSubtagsLength / 3;
+ lsrs = new LSR[lsrsLength];
+ if (lsrs == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ for (int32_t i = 0, j = 0; i < lsrSubtagsLength; i += 3, ++j) {
+ lsrs[j] = LSR(strings.get(lsrSubtagIndexes[i]),
+ strings.get(lsrSubtagIndexes[i + 1]),
+ strings.get(lsrSubtagIndexes[i + 2]),
+ LSR::IMPLICIT_LSR);
+ }
+
+ if (partitionsLength > 0) {
+ distanceData.partitions = static_cast<const char **>(
+ uprv_malloc(partitionsLength * sizeof(const char *)));
+ if (distanceData.partitions == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ for (int32_t i = 0; i < partitionsLength; ++i) {
+ distanceData.partitions[i] = strings.get(partitionIndexes[i]);
+ }
+ }
+
+ if (paradigmSubtagsLength > 0) {
+ distanceData.paradigmsLength = paradigmSubtagsLength / 3;
+ LSR *paradigms = new LSR[distanceData.paradigmsLength];
+ if (paradigms == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ for (int32_t i = 0, j = 0; i < paradigmSubtagsLength; i += 3, ++j) {
+ paradigms[j] = LSR(strings.get(paradigmSubtagIndexes[i]),
+ strings.get(paradigmSubtagIndexes[i + 1]),
+ strings.get(paradigmSubtagIndexes[i + 2]),
+ LSR::DONT_CARE_FLAGS);
+ }
+ distanceData.paradigms = paradigms;
+ }
+ }
+
+private:
+ bool readStrings(const ResourceTable &table, const char *key, ResourceValue &value,
+ LocalMemory<int32_t> &indexes, int32_t &length, UErrorCode &errorCode) {
+ if (table.findValue(key, value)) {
+ ResourceArray stringArray = value.getArray(errorCode);
+ if (U_FAILURE(errorCode)) { return false; }
+ length = stringArray.getSize();
+ if (length == 0) { return true; }
+ int32_t *rawIndexes = indexes.allocateInsteadAndCopy(length);
+ if (rawIndexes == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ for (int i = 0; i < length; ++i) {
+ stringArray.getValue(i, value); // returns TRUE because i < length
+ rawIndexes[i] = strings.add(value.getUnicodeString(errorCode), errorCode);
+ if (U_FAILURE(errorCode)) { return false; }
+ }
+ }
+ return true;
+ }
+};
+
+namespace {
+
+XLikelySubtags *gLikelySubtags = nullptr;
+UInitOnce gInitOnce = U_INITONCE_INITIALIZER;
+
+UBool U_CALLCONV cleanup() {
+ delete gLikelySubtags;
+ gLikelySubtags = nullptr;
+ gInitOnce.reset();
+ return TRUE;
+}
+
+} // namespace
+
+void U_CALLCONV XLikelySubtags::initLikelySubtags(UErrorCode &errorCode) {
+ // This function is invoked only via umtx_initOnce().
+ U_ASSERT(gLikelySubtags == nullptr);
+ XLikelySubtagsData data(errorCode);
+ data.load(errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ gLikelySubtags = new XLikelySubtags(data);
+ if (gLikelySubtags == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ ucln_common_registerCleanup(UCLN_COMMON_LIKELY_SUBTAGS, cleanup);
+}
+
+const XLikelySubtags *XLikelySubtags::getSingleton(UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return nullptr; }
+ umtx_initOnce(gInitOnce, &XLikelySubtags::initLikelySubtags, errorCode);
+ return gLikelySubtags;
+}
+
+XLikelySubtags::XLikelySubtags(XLikelySubtagsData &data) :
+ langInfoBundle(data.langInfoBundle),
+ strings(data.strings.orphanCharStrings()),
+ languageAliases(std::move(data.languageAliases)),
+ regionAliases(std::move(data.regionAliases)),
+ trie(data.trieBytes),
+ lsrs(data.lsrs),
+#if U_DEBUG
+ lsrsLength(data.lsrsLength),
+#endif
+ distanceData(std::move(data.distanceData)) {
+ data.langInfoBundle = nullptr;
+ data.lsrs = nullptr;
+
+ // Cache the result of looking up language="und" encoded as "*", and "und-Zzzz" ("**").
+ UStringTrieResult result = trie.next(u'*');
+ U_ASSERT(USTRINGTRIE_HAS_NEXT(result));
+ trieUndState = trie.getState64();
+ result = trie.next(u'*');
+ U_ASSERT(USTRINGTRIE_HAS_NEXT(result));
+ trieUndZzzzState = trie.getState64();
+ result = trie.next(u'*');
+ U_ASSERT(USTRINGTRIE_HAS_VALUE(result));
+ defaultLsrIndex = trie.getValue();
+ trie.reset();
+
+ for (char16_t c = u'a'; c <= u'z'; ++c) {
+ result = trie.next(c);
+ if (result == USTRINGTRIE_NO_VALUE) {
+ trieFirstLetterStates[c - u'a'] = trie.getState64();
+ }
+ trie.reset();
+ }
+}
+
+XLikelySubtags::~XLikelySubtags() {
+ ures_close(langInfoBundle);
+ delete strings;
+ delete[] lsrs;
+}
+
+LSR XLikelySubtags::makeMaximizedLsrFrom(const Locale &locale, UErrorCode &errorCode) const {
+ const char *name = locale.getName();
+ if (uprv_isAtSign(name[0]) && name[1] == 'x' && name[2] == '=') { // name.startsWith("@x=")
+ // Private use language tag x-subtag-subtag...
+ return LSR(name, "", "", LSR::EXPLICIT_LSR);
+ }
+ return makeMaximizedLsr(locale.getLanguage(), locale.getScript(), locale.getCountry(),
+ locale.getVariant(), errorCode);
+}
+
+namespace {
+
+const char *getCanonical(const CharStringMap &aliases, const char *alias) {
+ const char *canonical = aliases.get(alias);
+ return canonical == nullptr ? alias : canonical;
+}
+
+} // namespace
+
+LSR XLikelySubtags::makeMaximizedLsr(const char *language, const char *script, const char *region,
+ const char *variant, UErrorCode &errorCode) const {
+ // Handle pseudolocales like en-XA, ar-XB, fr-PSCRACK.
+ // They should match only themselves,
+ // not other locales with what looks like the same language and script subtags.
+ char c1;
+ if (region[0] == 'X' && (c1 = region[1]) != 0 && region[2] == 0) {
+ switch (c1) {
+ case 'A':
+ return LSR(PSEUDO_ACCENTS_PREFIX, language, script, region,
+ LSR::EXPLICIT_LSR, errorCode);
+ case 'B':
+ return LSR(PSEUDO_BIDI_PREFIX, language, script, region,
+ LSR::EXPLICIT_LSR, errorCode);
+ case 'C':
+ return LSR(PSEUDO_CRACKED_PREFIX, language, script, region,
+ LSR::EXPLICIT_LSR, errorCode);
+ default: // normal locale
+ break;
+ }
+ }
+
+ if (variant[0] == 'P' && variant[1] == 'S') {
+ int32_t lsrFlags = *region == 0 ?
+ LSR::EXPLICIT_LANGUAGE | LSR::EXPLICIT_SCRIPT : LSR::EXPLICIT_LSR;
+ if (uprv_strcmp(variant, "PSACCENT") == 0) {
+ return LSR(PSEUDO_ACCENTS_PREFIX, language, script,
+ *region == 0 ? "XA" : region, lsrFlags, errorCode);
+ } else if (uprv_strcmp(variant, "PSBIDI") == 0) {
+ return LSR(PSEUDO_BIDI_PREFIX, language, script,
+ *region == 0 ? "XB" : region, lsrFlags, errorCode);
+ } else if (uprv_strcmp(variant, "PSCRACK") == 0) {
+ return LSR(PSEUDO_CRACKED_PREFIX, language, script,
+ *region == 0 ? "XC" : region, lsrFlags, errorCode);
+ }
+ // else normal locale
+ }
+
+ language = getCanonical(languageAliases, language);
+ // (We have no script mappings.)
+ region = getCanonical(regionAliases, region);
+ return maximize(language, script, region);
+}
+
+LSR XLikelySubtags::maximize(const char *language, const char *script, const char *region) const {
+ if (uprv_strcmp(language, "und") == 0) {
+ language = "";
+ }
+ if (uprv_strcmp(script, "Zzzz") == 0) {
+ script = "";
+ }
+ if (uprv_strcmp(region, "ZZ") == 0) {
+ region = "";
+ }
+ if (*script != 0 && *region != 0 && *language != 0) {
+ return LSR(language, script, region, LSR::EXPLICIT_LSR); // already maximized
+ }
+
+ uint32_t retainOldMask = 0;
+ BytesTrie iter(trie);
+ uint64_t state;
+ int32_t value;
+ // Small optimization: Array lookup for first language letter.
+ int32_t c0;
+ if (0 <= (c0 = uprv_lowerOrdinal(language[0])) && c0 <= 25 &&
+ language[1] != 0 && // language.length() >= 2
+ (state = trieFirstLetterStates[c0]) != 0) {
+ value = trieNext(iter.resetToState64(state), language, 1);
+ } else {
+ value = trieNext(iter, language, 0);
+ }
+ if (value >= 0) {
+ if (*language != 0) {
+ retainOldMask |= 4;
+ }
+ state = iter.getState64();
+ } else {
+ retainOldMask |= 4;
+ iter.resetToState64(trieUndState); // "und" ("*")
+ state = 0;
+ }
+
+ if (value > 0) {
+ // Intermediate or final value from just language.
+ if (value == SKIP_SCRIPT) {
+ value = 0;
+ }
+ if (*script != 0) {
+ retainOldMask |= 2;
+ }
+ } else {
+ value = trieNext(iter, script, 0);
+ if (value >= 0) {
+ if (*script != 0) {
+ retainOldMask |= 2;
+ }
+ state = iter.getState64();
+ } else {
+ retainOldMask |= 2;
+ if (state == 0) {
+ iter.resetToState64(trieUndZzzzState); // "und-Zzzz" ("**")
+ } else {
+ iter.resetToState64(state);
+ value = trieNext(iter, "", 0);
+ U_ASSERT(value >= 0);
+ state = iter.getState64();
+ }
+ }
+ }
+
+ if (value > 0) {
+ // Final value from just language or language+script.
+ if (*region != 0) {
+ retainOldMask |= 1;
+ }
+ } else {
+ value = trieNext(iter, region, 0);
+ if (value >= 0) {
+ if (*region != 0) {
+ retainOldMask |= 1;
+ }
+ } else {
+ retainOldMask |= 1;
+ if (state == 0) {
+ value = defaultLsrIndex;
+ } else {
+ iter.resetToState64(state);
+ value = trieNext(iter, "", 0);
+ U_ASSERT(value > 0);
+ }
+ }
+ }
+ U_ASSERT(value < lsrsLength);
+ const LSR &result = lsrs[value];
+
+ if (*language == 0) {
+ language = "und";
+ }
+
+ if (retainOldMask == 0) {
+ // Quickly return a copy of the lookup-result LSR
+ // without new allocation of the subtags.
+ return LSR(result.language, result.script, result.region, result.flags);
+ }
+ if ((retainOldMask & 4) == 0) {
+ language = result.language;
+ }
+ if ((retainOldMask & 2) == 0) {
+ script = result.script;
+ }
+ if ((retainOldMask & 1) == 0) {
+ region = result.region;
+ }
+ // retainOldMask flags = LSR explicit-subtag flags
+ return LSR(language, script, region, retainOldMask);
+}
+
+int32_t XLikelySubtags::compareLikely(const LSR &lsr, const LSR &other, int32_t likelyInfo) const {
+ // If likelyInfo >= 0:
+ // likelyInfo bit 1 is set if the previous comparison with lsr
+ // was for equal language and script.
+ // Otherwise the scripts differed.
+ if (uprv_strcmp(lsr.language, other.language) != 0) {
+ return 0xfffffffc; // negative, lsr not better than other
+ }
+ if (uprv_strcmp(lsr.script, other.script) != 0) {
+ int32_t index;
+ if (likelyInfo >= 0 && (likelyInfo & 2) == 0) {
+ index = likelyInfo >> 2;
+ } else {
+ index = getLikelyIndex(lsr.language, "");
+ likelyInfo = index << 2;
+ }
+ const LSR &likely = lsrs[index];
+ if (uprv_strcmp(lsr.script, likely.script) == 0) {
+ return likelyInfo | 1;
+ } else {
+ return likelyInfo & ~1;
+ }
+ }
+ if (uprv_strcmp(lsr.region, other.region) != 0) {
+ int32_t index;
+ if (likelyInfo >= 0 && (likelyInfo & 2) != 0) {
+ index = likelyInfo >> 2;
+ } else {
+ index = getLikelyIndex(lsr.language, lsr.region);
+ likelyInfo = (index << 2) | 2;
+ }
+ const LSR &likely = lsrs[index];
+ if (uprv_strcmp(lsr.region, likely.region) == 0) {
+ return likelyInfo | 1;
+ } else {
+ return likelyInfo & ~1;
+ }
+ }
+ return likelyInfo & ~1; // lsr not better than other
+}
+
+// Subset of maximize().
+int32_t XLikelySubtags::getLikelyIndex(const char *language, const char *script) const {
+ if (uprv_strcmp(language, "und") == 0) {
+ language = "";
+ }
+ if (uprv_strcmp(script, "Zzzz") == 0) {
+ script = "";
+ }
+
+ BytesTrie iter(trie);
+ uint64_t state;
+ int32_t value;
+ // Small optimization: Array lookup for first language letter.
+ int32_t c0;
+ if (0 <= (c0 = uprv_lowerOrdinal(language[0])) && c0 <= 25 &&
+ language[1] != 0 && // language.length() >= 2
+ (state = trieFirstLetterStates[c0]) != 0) {
+ value = trieNext(iter.resetToState64(state), language, 1);
+ } else {
+ value = trieNext(iter, language, 0);
+ }
+ if (value >= 0) {
+ state = iter.getState64();
+ } else {
+ iter.resetToState64(trieUndState); // "und" ("*")
+ state = 0;
+ }
+
+ if (value > 0) {
+ // Intermediate or final value from just language.
+ if (value == SKIP_SCRIPT) {
+ value = 0;
+ }
+ } else {
+ value = trieNext(iter, script, 0);
+ if (value >= 0) {
+ state = iter.getState64();
+ } else {
+ if (state == 0) {
+ iter.resetToState64(trieUndZzzzState); // "und-Zzzz" ("**")
+ } else {
+ iter.resetToState64(state);
+ value = trieNext(iter, "", 0);
+ U_ASSERT(value >= 0);
+ state = iter.getState64();
+ }
+ }
+ }
+
+ if (value > 0) {
+ // Final value from just language or language+script.
+ } else {
+ value = trieNext(iter, "", 0);
+ U_ASSERT(value > 0);
+ }
+ U_ASSERT(value < lsrsLength);
+ return value;
+}
+
+int32_t XLikelySubtags::trieNext(BytesTrie &iter, const char *s, int32_t i) {
+ UStringTrieResult result;
+ uint8_t c;
+ if ((c = s[i]) == 0) {
+ result = iter.next(u'*');
+ } else {
+ for (;;) {
+ c = uprv_invCharToAscii(c);
+ // EBCDIC: If s[i] is not an invariant character,
+ // then c is now 0 and will simply not match anything, which is harmless.
+ uint8_t next = s[++i];
+ if (next != 0) {
+ if (!USTRINGTRIE_HAS_NEXT(iter.next(c))) {
+ return -1;
+ }
+ } else {
+ // last character of this subtag
+ result = iter.next(c | 0x80);
+ break;
+ }
+ c = next;
+ }
+ }
+ switch (result) {
+ case USTRINGTRIE_NO_MATCH: return -1;
+ case USTRINGTRIE_NO_VALUE: return 0;
+ case USTRINGTRIE_INTERMEDIATE_VALUE:
+ U_ASSERT(iter.getValue() == SKIP_SCRIPT);
+ return SKIP_SCRIPT;
+ case USTRINGTRIE_FINAL_VALUE: return iter.getValue();
+ default: return -1;
+ }
+}
+
+// TODO(ICU-20777): Switch Locale/uloc_ likely-subtags API from the old code
+// in loclikely.cpp to this new code, including activating this
+// minimizeSubtags() function. The LocaleMatcher does not minimize.
+#if 0
+LSR XLikelySubtags::minimizeSubtags(const char *languageIn, const char *scriptIn,
+ const char *regionIn, ULocale.Minimize fieldToFavor,
+ UErrorCode &errorCode) const {
+ LSR result = maximize(languageIn, scriptIn, regionIn);
+
+ // We could try just a series of checks, like:
+ // LSR result2 = addLikelySubtags(languageIn, "", "");
+ // if result.equals(result2) return result2;
+ // However, we can optimize 2 of the cases:
+ // (languageIn, "", "")
+ // (languageIn, "", regionIn)
+
+ // value00 = lookup(result.language, "", "")
+ BytesTrie iter = new BytesTrie(trie);
+ int value = trieNext(iter, result.language, 0);
+ U_ASSERT(value >= 0);
+ if (value == 0) {
+ value = trieNext(iter, "", 0);
+ U_ASSERT(value >= 0);
+ if (value == 0) {
+ value = trieNext(iter, "", 0);
+ }
+ }
+ U_ASSERT(value > 0);
+ LSR value00 = lsrs[value];
+ boolean favorRegionOk = false;
+ if (result.script.equals(value00.script)) { //script is default
+ if (result.region.equals(value00.region)) {
+ return new LSR(result.language, "", "", LSR.DONT_CARE_FLAGS);
+ } else if (fieldToFavor == ULocale.Minimize.FAVOR_REGION) {
+ return new LSR(result.language, "", result.region, LSR.DONT_CARE_FLAGS);
+ } else {
+ favorRegionOk = true;
+ }
+ }
+
+ // The last case is not as easy to optimize.
+ // Maybe do later, but for now use the straightforward code.
+ LSR result2 = maximize(languageIn, scriptIn, "");
+ if (result2.equals(result)) {
+ return new LSR(result.language, result.script, "", LSR.DONT_CARE_FLAGS);
+ } else if (favorRegionOk) {
+ return new LSR(result.language, "", result.region, LSR.DONT_CARE_FLAGS);
+ }
+ return result;
+}
+#endif
+
+U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/loclikelysubtags.h b/contrib/libs/icu/common/loclikelysubtags.h
index 653b206182..90ddfffaca 100644
--- a/contrib/libs/icu/common/loclikelysubtags.h
+++ b/contrib/libs/icu/common/loclikelysubtags.h
@@ -1,157 +1,157 @@
-// © 2019 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html#License
-
-// loclikelysubtags.h
-// created: 2019may08 Markus W. Scherer
-
-#ifndef __LOCLIKELYSUBTAGS_H__
-#define __LOCLIKELYSUBTAGS_H__
-
-#include <utility>
-#include "unicode/utypes.h"
-#include "unicode/bytestrie.h"
-#include "unicode/locid.h"
-#include "unicode/uobject.h"
-#include "unicode/ures.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);
- ~LocaleDistanceData();
-
- const uint8_t *distanceTrieBytes = nullptr;
- const uint8_t *regionToPartitions = nullptr;
- const char **partitions = nullptr;
- const LSR *paradigms = nullptr;
- int32_t paradigmsLength = 0;
- const int32_t *distances = nullptr;
-
-private:
- LocaleDistanceData &operator=(const LocaleDistanceData &) = delete;
-};
-
-// TODO(ICU-20777): Rename to just LikelySubtags.
-class XLikelySubtags final : public UMemory {
-public:
- ~XLikelySubtags();
-
- static constexpr int32_t SKIP_SCRIPT = 1;
-
- // VisibleForTesting
- static const XLikelySubtags *getSingleton(UErrorCode &errorCode);
-
- // VisibleForTesting
- LSR makeMaximizedLsrFrom(const Locale &locale, UErrorCode &errorCode) const;
-
- /**
- * Tests whether lsr is "more likely" than other.
- * For example, fr-Latn-FR is more likely than fr-Latn-CH because
- * FR is the default region for fr-Latn.
- *
- * The likelyInfo caches lookup information between calls.
- * The return value is an updated likelyInfo value,
- * with bit 0 set if lsr is "more likely".
- * The initial value of likelyInfo must be negative.
- */
- int32_t compareLikely(const LSR &lsr, const LSR &other, int32_t likelyInfo) const;
-
- // TODO(ICU-20777): Switch Locale/uloc_ likely-subtags API from the old code
- // in loclikely.cpp to this new code, including activating this
- // minimizeSubtags() function. The LocaleMatcher does not minimize.
-#if 0
- LSR minimizeSubtags(const char *languageIn, const char *scriptIn, const char *regionIn,
- ULocale.Minimize fieldToFavor, UErrorCode &errorCode) const;
-#endif
-
- // visible for LocaleDistance
- const LocaleDistanceData &getDistanceData() const { return distanceData; }
-
-private:
- XLikelySubtags(XLikelySubtagsData &data);
- XLikelySubtags(const XLikelySubtags &other) = delete;
- XLikelySubtags &operator=(const XLikelySubtags &other) = delete;
-
- static void initLikelySubtags(UErrorCode &errorCode);
-
- LSR makeMaximizedLsr(const char *language, const char *script, const char *region,
- const char *variant, UErrorCode &errorCode) const;
-
- /**
- * Raw access to addLikelySubtags. Input must be in canonical format, eg "en", not "eng" or "EN".
- */
- LSR maximize(const char *language, const char *script, const char *region) const;
-
- int32_t getLikelyIndex(const char *language, const char *script) const;
-
- static int32_t trieNext(BytesTrie &iter, const char *s, int32_t i);
-
- UResourceBundle *langInfoBundle;
- // We could store the strings by value, except that if there were few enough strings,
- // moving the contents could copy it to a different array,
- // invalidating the pointers stored in the maps.
- CharString *strings;
- CharStringMap languageAliases;
- CharStringMap regionAliases;
-
- // The trie maps each lang+script+region (encoded in ASCII) to an index into lsrs.
- // There is also a trie value for each intermediate lang and lang+script.
- // '*' is used instead of "und", "Zzzz"/"" and "ZZ"/"".
- BytesTrie trie;
- uint64_t trieUndState;
- uint64_t trieUndZzzzState;
- int32_t defaultLsrIndex;
- uint64_t trieFirstLetterStates[26];
- const LSR *lsrs;
-#if U_DEBUG
- int32_t lsrsLength;
-#endif
-
- // distance/matcher data: see comment in XLikelySubtagsData::load()
- LocaleDistanceData distanceData;
-};
-
-U_NAMESPACE_END
-
-#endif // __LOCLIKELYSUBTAGS_H__
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// loclikelysubtags.h
+// created: 2019may08 Markus W. Scherer
+
+#ifndef __LOCLIKELYSUBTAGS_H__
+#define __LOCLIKELYSUBTAGS_H__
+
+#include <utility>
+#include "unicode/utypes.h"
+#include "unicode/bytestrie.h"
+#include "unicode/locid.h"
+#include "unicode/uobject.h"
+#include "unicode/ures.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);
+ ~LocaleDistanceData();
+
+ const uint8_t *distanceTrieBytes = nullptr;
+ const uint8_t *regionToPartitions = nullptr;
+ const char **partitions = nullptr;
+ const LSR *paradigms = nullptr;
+ int32_t paradigmsLength = 0;
+ const int32_t *distances = nullptr;
+
+private:
+ LocaleDistanceData &operator=(const LocaleDistanceData &) = delete;
+};
+
+// TODO(ICU-20777): Rename to just LikelySubtags.
+class XLikelySubtags final : public UMemory {
+public:
+ ~XLikelySubtags();
+
+ static constexpr int32_t SKIP_SCRIPT = 1;
+
+ // VisibleForTesting
+ static const XLikelySubtags *getSingleton(UErrorCode &errorCode);
+
+ // VisibleForTesting
+ LSR makeMaximizedLsrFrom(const Locale &locale, UErrorCode &errorCode) const;
+
+ /**
+ * Tests whether lsr is "more likely" than other.
+ * For example, fr-Latn-FR is more likely than fr-Latn-CH because
+ * FR is the default region for fr-Latn.
+ *
+ * The likelyInfo caches lookup information between calls.
+ * The return value is an updated likelyInfo value,
+ * with bit 0 set if lsr is "more likely".
+ * The initial value of likelyInfo must be negative.
+ */
+ int32_t compareLikely(const LSR &lsr, const LSR &other, int32_t likelyInfo) const;
+
+ // TODO(ICU-20777): Switch Locale/uloc_ likely-subtags API from the old code
+ // in loclikely.cpp to this new code, including activating this
+ // minimizeSubtags() function. The LocaleMatcher does not minimize.
+#if 0
+ LSR minimizeSubtags(const char *languageIn, const char *scriptIn, const char *regionIn,
+ ULocale.Minimize fieldToFavor, UErrorCode &errorCode) const;
+#endif
+
+ // visible for LocaleDistance
+ const LocaleDistanceData &getDistanceData() const { return distanceData; }
+
+private:
+ XLikelySubtags(XLikelySubtagsData &data);
+ XLikelySubtags(const XLikelySubtags &other) = delete;
+ XLikelySubtags &operator=(const XLikelySubtags &other) = delete;
+
+ static void initLikelySubtags(UErrorCode &errorCode);
+
+ LSR makeMaximizedLsr(const char *language, const char *script, const char *region,
+ const char *variant, UErrorCode &errorCode) const;
+
+ /**
+ * Raw access to addLikelySubtags. Input must be in canonical format, eg "en", not "eng" or "EN".
+ */
+ LSR maximize(const char *language, const char *script, const char *region) const;
+
+ int32_t getLikelyIndex(const char *language, const char *script) const;
+
+ static int32_t trieNext(BytesTrie &iter, const char *s, int32_t i);
+
+ UResourceBundle *langInfoBundle;
+ // We could store the strings by value, except that if there were few enough strings,
+ // moving the contents could copy it to a different array,
+ // invalidating the pointers stored in the maps.
+ CharString *strings;
+ CharStringMap languageAliases;
+ CharStringMap regionAliases;
+
+ // The trie maps each lang+script+region (encoded in ASCII) to an index into lsrs.
+ // There is also a trie value for each intermediate lang and lang+script.
+ // '*' is used instead of "und", "Zzzz"/"" and "ZZ"/"".
+ BytesTrie trie;
+ uint64_t trieUndState;
+ uint64_t trieUndZzzzState;
+ int32_t defaultLsrIndex;
+ uint64_t trieFirstLetterStates[26];
+ const LSR *lsrs;
+#if U_DEBUG
+ int32_t lsrsLength;
+#endif
+
+ // distance/matcher data: see comment in XLikelySubtagsData::load()
+ LocaleDistanceData distanceData;
+};
+
+U_NAMESPACE_END
+
+#endif // __LOCLIKELYSUBTAGS_H__
diff --git a/contrib/libs/icu/common/locmap.cpp b/contrib/libs/icu/common/locmap.cpp
index e13397c934..a631134355 100644
--- a/contrib/libs/icu/common/locmap.cpp
+++ b/contrib/libs/icu/common/locmap.cpp
@@ -1,1309 +1,1309 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
- **********************************************************************
- * Copyright (C) 1996-2016, International Business Machines
- * Corporation and others. All Rights Reserved.
- **********************************************************************
- *
- * Provides functionality for mapping between
- * LCID and Posix IDs or ICU locale to codepage
- *
- * Note: All classes and code in this file are
- * intended for internal use only.
- *
- * Methods of interest:
- * unsigned long convertToLCID(const char*);
- * const char* convertToPosix(unsigned long);
- *
- * Kathleen Wilson, 4/30/96
- *
- * Date Name Description
- * 3/11/97 aliu Fixed off-by-one bug in assignment operator. Added
- * setId() method and safety check against
- * MAX_ID_LENGTH.
- * 04/23/99 stephen Added C wrapper for convertToPosix.
- * 09/18/00 george Removed the memory leaks.
- * 08/23/01 george Convert to C
- */
-
-#include "locmap.h"
-#include "cstring.h"
-#include "cmemory.h"
-#include "unicode/uloc.h"
-
-#if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API
-#include <windows.h>
-#include <winnls.h> // LCIDToLocaleName and LocaleNameToLCID
-#endif
-
-/*
- * Note:
- * The mapping from Win32 locale ID numbers to POSIX locale strings should
- * be the faster one.
- *
- * Windows LCIDs are defined at https://msdn.microsoft.com/en-us/library/cc233965.aspx
- * [MS-LCID] Windows Language Code Identifier (LCID) Reference
- */
-
-/*
-////////////////////////////////////////////////
-//
-// Internal Classes for LCID <--> POSIX Mapping
-//
-/////////////////////////////////////////////////
-*/
-
-typedef struct ILcidPosixElement
-{
- const uint32_t hostID;
- const char * const posixID;
-} ILcidPosixElement;
-
-typedef struct ILcidPosixMap
-{
- const uint32_t numRegions;
- const struct ILcidPosixElement* const regionMaps;
-} ILcidPosixMap;
-
-
-/*
-/////////////////////////////////////////////////
-//
-// Easy macros to make the LCID <--> POSIX Mapping
-//
-/////////////////////////////////////////////////
-*/
-
-/**
- * The standard one language/one country mapping for LCID.
- * The first element must be the language, and the following
- * elements are the language with the country.
- * @param hostID LCID in host format such as 0x044d
- * @param languageID posix ID of just the language such as 'de'
- * @param posixID posix ID of the language_TERRITORY such as 'de_CH'
- */
-#define ILCID_POSIX_ELEMENT_ARRAY(hostID, languageID, posixID) \
-static const ILcidPosixElement locmap_ ## languageID [] = { \
- {LANGUAGE_LCID(hostID), #languageID}, /* parent locale */ \
- {hostID, #posixID}, \
-};
-
-/**
- * Define a subtable by ID
- * @param id the POSIX ID, either a language or language_TERRITORY
- */
-#define ILCID_POSIX_SUBTABLE(id) \
-static const ILcidPosixElement locmap_ ## id [] =
-
-
-/**
- * Create the map for the posixID. This macro supposes that the language string
- * name is the same as the global variable name, and that the first element
- * in the ILcidPosixElement is just the language.
- * @param _posixID the full POSIX ID for this entry.
- */
-#define ILCID_POSIX_MAP(_posixID) \
- {UPRV_LENGTHOF(locmap_ ## _posixID), locmap_ ## _posixID}
-
-/*
-////////////////////////////////////////////
-//
-// Create the table of LCID to POSIX Mapping
-// None of it should be dynamically created.
-//
-// Keep static locale variables inside the function so that
-// it can be created properly during static init.
-//
-// Note: This table should be updated periodically. Check the [MS-LCID] Windows Language Code Identifier
-// (LCID) Reference defined at https://msdn.microsoft.com/en-us/library/cc233965.aspx
-//
-// Microsoft is moving away from LCID in favor of locale name as of Vista. This table needs to be
-// maintained for support of older Windows version.
-// Update: Windows 7 (091130)
-//
-// Note: Microsoft assign a different LCID if a locale has a sorting variant. POSIX IDs below may contain
-// @collation=XXX, but no other keywords are allowed (at least for now). When uprv_convertToLCID() is
-// called from uloc_getLCID(), keywords other than collation are already removed. If we really need
-// to support other keywords in this mapping data, we must update the implementation.
-////////////////////////////////////////////
-*/
-
-// TODO: For Windows ideally this table would be a list of exceptions rather than a complete list as
-// LocaleNameToLCID and LCIDToLocaleName provide 90% of these.
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0436, af, af_ZA)
-
-ILCID_POSIX_SUBTABLE(ar) {
- {0x01, "ar"},
- {0x3801, "ar_AE"},
- {0x3c01, "ar_BH"},
- {0x1401, "ar_DZ"},
- {0x0c01, "ar_EG"},
- {0x0801, "ar_IQ"},
- {0x2c01, "ar_JO"},
- {0x3401, "ar_KW"},
- {0x3001, "ar_LB"},
- {0x1001, "ar_LY"},
- {0x1801, "ar_MA"},
- {0x1801, "ar_MO"},
- {0x2001, "ar_OM"},
- {0x4001, "ar_QA"},
- {0x0401, "ar_SA"},
- {0x2801, "ar_SY"},
- {0x1c01, "ar_TN"},
- {0x2401, "ar_YE"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x044d, as, as_IN)
-ILCID_POSIX_ELEMENT_ARRAY(0x045e, am, am_ET)
-ILCID_POSIX_ELEMENT_ARRAY(0x047a, arn,arn_CL)
-
-ILCID_POSIX_SUBTABLE(az) {
- {0x2c, "az"},
- {0x082c, "az_Cyrl_AZ"}, /* Cyrillic based */
- {0x742c, "az_Cyrl"}, /* Cyrillic based */
- {0x042c, "az_Latn_AZ"}, /* Latin based */
- {0x782c, "az_Latn"}, /* Latin based */
- {0x042c, "az_AZ"} /* Latin based */
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x046d, ba, ba_RU)
-ILCID_POSIX_ELEMENT_ARRAY(0x0423, be, be_BY)
-
-/*ILCID_POSIX_SUBTABLE(ber) {
- {0x5f, "ber"},
- {0x045f, "ber_Arab_DZ"},
- {0x045f, "ber_Arab"},
- {0x085f, "ber_Latn_DZ"},
- {0x085f, "ber_Latn"}
-};*/
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0402, bg, bg_BG)
-
-ILCID_POSIX_SUBTABLE(bin) {
- {0x66, "bin"},
- {0x0466, "bin_NG"}
-};
-
-ILCID_POSIX_SUBTABLE(bn) {
- {0x45, "bn"},
- {0x0845, "bn_BD"},
- {0x0445, "bn_IN"}
-};
-
-ILCID_POSIX_SUBTABLE(bo) {
- {0x51, "bo"},
- {0x0851, "bo_BT"},
- {0x0451, "bo_CN"},
- {0x0c51, "dz_BT"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x047e, br, br_FR)
-
-ILCID_POSIX_SUBTABLE(ca) {
- {0x03, "ca"},
- {0x0403, "ca_ES"},
- {0x0803, "ca_ES_VALENCIA"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0483, co, co_FR)
-
-ILCID_POSIX_SUBTABLE(chr) {
- {0x05c, "chr"},
- {0x7c5c, "chr_Cher"},
- {0x045c, "chr_Cher_US"},
- {0x045c, "chr_US"}
-};
-
-// ICU has chosen different names for these.
-ILCID_POSIX_SUBTABLE(ckb) {
- {0x92, "ckb"},
- {0x7c92, "ckb_Arab"},
- {0x0492, "ckb_Arab_IQ"}
-};
-
-/* Declared as cs_CZ to get around compiler errors on z/OS, which defines cs as a function */
-ILCID_POSIX_ELEMENT_ARRAY(0x0405, cs, cs_CZ)
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0452, cy, cy_GB)
-ILCID_POSIX_ELEMENT_ARRAY(0x0406, da, da_DK)
-
-// Windows doesn't know POSIX or BCP47 Unicode phonebook sort names
-ILCID_POSIX_SUBTABLE(de) {
- {0x07, "de"},
- {0x0c07, "de_AT"},
- {0x0807, "de_CH"},
- {0x0407, "de_DE"},
- {0x1407, "de_LI"},
- {0x1007, "de_LU"},
- {0x10407,"de_DE@collation=phonebook"}, /*This is really de_DE_PHONEBOOK on Windows*/
- {0x10407,"de@collation=phonebook"} /*This is really de_DE_PHONEBOOK on Windows*/
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0465, dv, dv_MV)
-ILCID_POSIX_ELEMENT_ARRAY(0x0408, el, el_GR)
-
-// Windows uses an empty string for 'invariant'
-ILCID_POSIX_SUBTABLE(en) {
- {0x09, "en"},
- {0x0c09, "en_AU"},
- {0x2809, "en_BZ"},
- {0x1009, "en_CA"},
- {0x0809, "en_GB"},
- {0x3c09, "en_HK"},
- {0x3809, "en_ID"},
- {0x1809, "en_IE"},
- {0x4009, "en_IN"},
- {0x2009, "en_JM"},
- {0x4409, "en_MY"},
- {0x1409, "en_NZ"},
- {0x3409, "en_PH"},
- {0x4809, "en_SG"},
- {0x2C09, "en_TT"},
- {0x0409, "en_US"},
- {0x007f, "en_US_POSIX"}, /* duplicate for round-tripping */
- {0x2409, "en_029"},
- {0x1c09, "en_ZA"},
- {0x3009, "en_ZW"},
- {0x2409, "en_VI"}, /* Virgin Islands AKA Caribbean Islands (en_CB). On Windows8+ This is 0x1000 or dynamically assigned */
- {0x0409, "en_AS"}, /* Alias for en_US. Leave last. On Windows8+ This is 0x1000 or dynamically assigned */
- {0x0409, "en_GU"}, /* Alias for en_US. Leave last. On Windows8+ This is 0x1000 or dynamically assigned */
- {0x0409, "en_MH"}, /* Alias for en_US. Leave last. On Windows8+ This is 0x1000 or dynamically assigned */
- {0x0409, "en_MP"}, /* Alias for en_US. Leave last. On Windows8+ This is 0x1000 or dynamically assigned */
- {0x0409, "en_UM"} /* Alias for en_US. Leave last. On Windows8+ This is 0x1000 or dynamically assigned */
-};
-
-ILCID_POSIX_SUBTABLE(en_US_POSIX) {
- {0x007f, "en_US_POSIX"} /* duplicate for roundtripping */
-};
-
-// Windows doesn't know POSIX or BCP47 Unicode traditional sort names
-ILCID_POSIX_SUBTABLE(es) {
- {0x0a, "es"},
- {0x2c0a, "es_AR"},
- {0x400a, "es_BO"},
- {0x340a, "es_CL"},
- {0x240a, "es_CO"},
- {0x140a, "es_CR"},
- {0x5c0a, "es_CU"},
- {0x1c0a, "es_DO"},
- {0x300a, "es_EC"},
- {0x0c0a, "es_ES"}, /*Modern sort.*/
- {0x100a, "es_GT"},
- {0x480a, "es_HN"},
- {0x080a, "es_MX"},
- {0x4c0a, "es_NI"},
- {0x180a, "es_PA"},
- {0x280a, "es_PE"},
- {0x500a, "es_PR"},
- {0x3c0a, "es_PY"},
- {0x440a, "es_SV"},
- {0x540a, "es_US"},
- {0x380a, "es_UY"},
- {0x200a, "es_VE"},
- {0x580a, "es_419"},
- {0x040a, "es_ES@collation=traditional"},
- {0x040a, "es@collation=traditional"} // Windows will treat this as es-ES@collation=traditional
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0425, et, et_EE)
-ILCID_POSIX_ELEMENT_ARRAY(0x042d, eu, eu_ES)
-
-/* ISO-639 doesn't distinguish between Persian and Dari.*/
-ILCID_POSIX_SUBTABLE(fa) {
- {0x29, "fa"},
- {0x0429, "fa_IR"}, /* Persian/Farsi (Iran) */
- {0x048c, "fa_AF"} /* Persian/Dari (Afghanistan) */
-};
-
-
-/* duplicate for roundtripping */
-ILCID_POSIX_SUBTABLE(fa_AF) {
- {0x8c, "fa_AF"}, /* Persian/Dari (Afghanistan) */
- {0x048c, "fa_AF"} /* Persian/Dari (Afghanistan) */
-};
-
-ILCID_POSIX_SUBTABLE(ff) {
- {0x67, "ff"},
- {0x7c67, "ff_Latn"},
- {0x0867, "ff_Latn_SN"},
- {0x0467, "ff_NG"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x040b, fi, fi_FI)
-ILCID_POSIX_ELEMENT_ARRAY(0x0464, fil,fil_PH)
-ILCID_POSIX_ELEMENT_ARRAY(0x0438, fo, fo_FO)
-
-ILCID_POSIX_SUBTABLE(fr) {
- {0x0c, "fr"},
- {0x080c, "fr_BE"},
- {0x0c0c, "fr_CA"},
- {0x240c, "fr_CD"},
- {0x240c, "fr_CG"},
- {0x100c, "fr_CH"},
- {0x300c, "fr_CI"},
- {0x2c0c, "fr_CM"},
- {0x040c, "fr_FR"},
- {0x3c0c, "fr_HT"},
- {0x140c, "fr_LU"},
- {0x380c, "fr_MA"},
- {0x180c, "fr_MC"},
- {0x340c, "fr_ML"},
- {0x200c, "fr_RE"},
- {0x280c, "fr_SN"},
- {0xe40c, "fr_015"},
- {0x1c0c, "fr_029"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0467, fuv, fuv_NG)
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0462, fy, fy_NL)
-
-ILCID_POSIX_SUBTABLE(ga) { /* Gaelic (Ireland) */
- {0x3c, "ga"},
- {0x083c, "ga_IE"},
- {0x043c, "gd_GB"}
-};
-
-ILCID_POSIX_SUBTABLE(gd) { /* Gaelic (Scotland) */
- {0x91, "gd"},
- {0x0491, "gd_GB"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0456, gl, gl_ES)
-ILCID_POSIX_ELEMENT_ARRAY(0x0447, gu, gu_IN)
-ILCID_POSIX_ELEMENT_ARRAY(0x0474, gn, gn_PY)
-ILCID_POSIX_ELEMENT_ARRAY(0x0484, gsw,gsw_FR)
-
-ILCID_POSIX_SUBTABLE(ha) {
- {0x68, "ha"},
- {0x7c68, "ha_Latn"},
- {0x0468, "ha_Latn_NG"},
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0475, haw,haw_US)
-ILCID_POSIX_ELEMENT_ARRAY(0x040d, he, he_IL)
-ILCID_POSIX_ELEMENT_ARRAY(0x0439, hi, hi_IN)
-
-/* This LCID is really four different locales.*/
-ILCID_POSIX_SUBTABLE(hr) {
- {0x1a, "hr"},
- {0x141a, "bs_Latn_BA"}, /* Bosnian, Bosnia and Herzegovina */
- {0x681a, "bs_Latn"}, /* Bosnian, Bosnia and Herzegovina */
- {0x141a, "bs_BA"}, /* Bosnian, Bosnia and Herzegovina */
- {0x781a, "bs"}, /* Bosnian */
- {0x201a, "bs_Cyrl_BA"}, /* Bosnian, Bosnia and Herzegovina */
- {0x641a, "bs_Cyrl"}, /* Bosnian, Bosnia and Herzegovina */
- {0x101a, "hr_BA"}, /* Croatian in Bosnia */
- {0x041a, "hr_HR"}, /* Croatian*/
- {0x2c1a, "sr_Latn_ME"},
- {0x241a, "sr_Latn_RS"},
- {0x181a, "sr_Latn_BA"}, /* Serbo-Croatian in Bosnia */
- {0x081a, "sr_Latn_CS"}, /* Serbo-Croatian*/
- {0x701a, "sr_Latn"}, /* It's 0x1a or 0x081a, pick one to make the test program happy. */
- {0x1c1a, "sr_Cyrl_BA"}, /* Serbo-Croatian in Bosnia */
- {0x0c1a, "sr_Cyrl_CS"}, /* Serbian*/
- {0x301a, "sr_Cyrl_ME"},
- {0x281a, "sr_Cyrl_RS"},
- {0x6c1a, "sr_Cyrl"}, /* It's 0x1a or 0x0c1a, pick one to make the test program happy. */
- {0x7c1a, "sr"} /* In CLDR sr is sr_Cyrl. */
-};
-
-ILCID_POSIX_SUBTABLE(hsb) {
- {0x2E, "hsb"},
- {0x042E, "hsb_DE"},
- {0x082E, "dsb_DE"},
- {0x7C2E, "dsb"},
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x040e, hu, hu_HU)
-ILCID_POSIX_ELEMENT_ARRAY(0x042b, hy, hy_AM)
-
-ILCID_POSIX_SUBTABLE(ibb) {
- {0x69, "ibb"},
- {0x0469, "ibb_NG"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0421, id, id_ID)
-ILCID_POSIX_ELEMENT_ARRAY(0x0470, ig, ig_NG)
-ILCID_POSIX_ELEMENT_ARRAY(0x0478, ii, ii_CN)
-ILCID_POSIX_ELEMENT_ARRAY(0x040f, is, is_IS)
-
-ILCID_POSIX_SUBTABLE(it) {
- {0x10, "it"},
- {0x0810, "it_CH"},
- {0x0410, "it_IT"}
-};
-
-ILCID_POSIX_SUBTABLE(iu) {
- {0x5d, "iu"},
- {0x045d, "iu_Cans_CA"},
- {0x785d, "iu_Cans"},
- {0x085d, "iu_Latn_CA"},
- {0x7c5d, "iu_Latn"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x040d, iw, iw_IL) /*Left in for compatibility*/
-ILCID_POSIX_ELEMENT_ARRAY(0x0411, ja, ja_JP)
-ILCID_POSIX_ELEMENT_ARRAY(0x0437, ka, ka_GE)
-ILCID_POSIX_ELEMENT_ARRAY(0x043f, kk, kk_KZ)
-ILCID_POSIX_ELEMENT_ARRAY(0x046f, kl, kl_GL)
-ILCID_POSIX_ELEMENT_ARRAY(0x0453, km, km_KH)
-ILCID_POSIX_ELEMENT_ARRAY(0x044b, kn, kn_IN)
-
-ILCID_POSIX_SUBTABLE(ko) {
- {0x12, "ko"},
- {0x0812, "ko_KP"},
- {0x0412, "ko_KR"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0457, kok, kok_IN)
-ILCID_POSIX_ELEMENT_ARRAY(0x0471, kr, kr_NG)
-
-ILCID_POSIX_SUBTABLE(ks) { /* We could add PK and CN too */
- {0x60, "ks"},
- {0x0460, "ks_Arab_IN"},
- {0x0860, "ks_Deva_IN"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0440, ky, ky_KG) /* Kyrgyz is spoken in Kyrgyzstan */
-
-ILCID_POSIX_SUBTABLE(la) {
- {0x76, "la"},
- {0x0476, "la_001"},
- {0x0476, "la_IT"} /*Left in for compatibility*/
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x046e, lb, lb_LU)
-ILCID_POSIX_ELEMENT_ARRAY(0x0454, lo, lo_LA)
-ILCID_POSIX_ELEMENT_ARRAY(0x0427, lt, lt_LT)
-ILCID_POSIX_ELEMENT_ARRAY(0x0426, lv, lv_LV)
-ILCID_POSIX_ELEMENT_ARRAY(0x0481, mi, mi_NZ)
-ILCID_POSIX_ELEMENT_ARRAY(0x042f, mk, mk_MK)
-ILCID_POSIX_ELEMENT_ARRAY(0x044c, ml, ml_IN)
-
-ILCID_POSIX_SUBTABLE(mn) {
- {0x50, "mn"},
- {0x0450, "mn_MN"},
- {0x7c50, "mn_Mong"},
- {0x0850, "mn_Mong_CN"},
- {0x0850, "mn_CN"},
- {0x7850, "mn_Cyrl"},
- {0x0c50, "mn_Mong_MN"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0458, mni,mni_IN)
-ILCID_POSIX_ELEMENT_ARRAY(0x047c, moh,moh_CA)
-ILCID_POSIX_ELEMENT_ARRAY(0x044e, mr, mr_IN)
-
-ILCID_POSIX_SUBTABLE(ms) {
- {0x3e, "ms"},
- {0x083e, "ms_BN"}, /* Brunei Darussalam*/
- {0x043e, "ms_MY"} /* Malaysia*/
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x043a, mt, mt_MT)
-ILCID_POSIX_ELEMENT_ARRAY(0x0455, my, my_MM)
-
-ILCID_POSIX_SUBTABLE(ne) {
- {0x61, "ne"},
- {0x0861, "ne_IN"}, /* India*/
- {0x0461, "ne_NP"} /* Nepal*/
-};
-
-ILCID_POSIX_SUBTABLE(nl) {
- {0x13, "nl"},
- {0x0813, "nl_BE"},
- {0x0413, "nl_NL"}
-};
-
-/* The "no" locale split into nb and nn. By default in ICU, "no" is nb.*/
-// TODO: Not all of these are needed on Windows, but I don't know how ICU treats preferred ones here.
-ILCID_POSIX_SUBTABLE(no) {
- {0x14, "no"}, /* really nb_NO - actually Windows differentiates between neutral (no region) and specific (with region) */
- {0x7c14, "nb"}, /* really nb */
- {0x0414, "nb_NO"}, /* really nb_NO. Keep first in the 414 list. */
- {0x0414, "no_NO"}, /* really nb_NO */
- {0x0814, "nn_NO"}, /* really nn_NO. Keep first in the 814 list. */
- {0x7814, "nn"}, /* It's 0x14 or 0x814, pick one to make the test program happy. */
- {0x0814, "no_NO_NY"}/* really nn_NO */
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x046c, nso,nso_ZA) /* TODO: Verify the ISO-639 code */
-ILCID_POSIX_ELEMENT_ARRAY(0x0482, oc, oc_FR)
-
-ILCID_POSIX_SUBTABLE(om) { /* TODO: Verify the country */
- {0x72, "om"},
- {0x0472, "om_ET"},
- {0x0472, "gaz_ET"}
-};
-
-/* Declared as or_IN to get around compiler errors*/
-ILCID_POSIX_SUBTABLE(or_IN) {
- {0x48, "or"},
- {0x0448, "or_IN"},
-};
-
-ILCID_POSIX_SUBTABLE(pa) {
- {0x46, "pa"},
- {0x0446, "pa_IN"},
- {0x0846, "pa_Arab_PK"},
- {0x0846, "pa_PK"}
-};
-
-ILCID_POSIX_SUBTABLE(pap) {
- {0x79, "pap"},
- {0x0479, "pap_029"},
- {0x0479, "pap_AN"} /*Left in for compatibility*/
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0415, pl, pl_PL)
-ILCID_POSIX_ELEMENT_ARRAY(0x0463, ps, ps_AF)
-
-ILCID_POSIX_SUBTABLE(pt) {
- {0x16, "pt"},
- {0x0416, "pt_BR"},
- {0x0816, "pt_PT"}
-};
-
-ILCID_POSIX_SUBTABLE(qu) {
- {0x6b, "qu"},
- {0x046b, "qu_BO"},
- {0x086b, "qu_EC"},
- {0x0C6b, "qu_PE"},
- {0x046b, "quz_BO"},
- {0x086b, "quz_EC"},
- {0x0C6b, "quz_PE"}
-};
-
-ILCID_POSIX_SUBTABLE(quc) {
- {0x93, "quc"},
- {0x0493, "quc_CO"},
- /*
- "quc_Latn_GT" is an exceptional case. Language ID of "quc"
- is 0x93, but LCID of "quc_Latn_GT" is 0x486, which should be
- under the group of "qut". "qut" is a retired ISO 639-3 language
- code for West Central Quiche, and merged to "quc".
- It looks Windows previously reserved "qut" for K'iche', but,
- decided to use "quc" when adding a locale for K'iche' (Guatemala).
-
- This data structure used here assumes language ID bits in
- LCID is unique for alphabetic language code. But this is not true
- for "quc_Latn_GT". If we don't have the data below, LCID look up
- by alphabetic locale ID (POSIX) will fail. The same entry is found
- under "qut" below, which is required for reverse look up.
- */
- {0x0486, "quc_Latn_GT"}
-};
-
-ILCID_POSIX_SUBTABLE(qut) {
- {0x86, "qut"},
- {0x0486, "qut_GT"},
- /*
- See the note in "quc" above.
- */
- {0x0486, "quc_Latn_GT"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0417, rm, rm_CH)
-
-ILCID_POSIX_SUBTABLE(ro) {
- {0x18, "ro"},
- {0x0418, "ro_RO"},
- {0x0818, "ro_MD"}
-};
-
-// TODO: This is almost certainly 'wrong'. 0 in Windows is a synonym for LOCALE_USER_DEFAULT.
-// More likely this is a similar concept to the Windows 0x7f Invariant locale ""
-// (Except that it's not invariant in ICU)
-ILCID_POSIX_SUBTABLE(root) {
- {0x00, "root"}
-};
-
-ILCID_POSIX_SUBTABLE(ru) {
- {0x19, "ru"},
- {0x0419, "ru_RU"},
- {0x0819, "ru_MD"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0487, rw, rw_RW)
-ILCID_POSIX_ELEMENT_ARRAY(0x044f, sa, sa_IN)
-ILCID_POSIX_ELEMENT_ARRAY(0x0485, sah,sah_RU)
-
-ILCID_POSIX_SUBTABLE(sd) {
- {0x59, "sd"},
- {0x0459, "sd_Deva_IN"},
- {0x0459, "sd_IN"},
- {0x0859, "sd_Arab_PK"},
- {0x0859, "sd_PK"},
- {0x7c59, "sd_Arab"}
-};
-
-ILCID_POSIX_SUBTABLE(se) {
- {0x3b, "se"},
- {0x0c3b, "se_FI"},
- {0x043b, "se_NO"},
- {0x083b, "se_SE"},
- {0x783b, "sma"},
- {0x183b, "sma_NO"},
- {0x1c3b, "sma_SE"},
- {0x7c3b, "smj"},
- {0x703b, "smn"},
- {0x743b, "sms"},
- {0x103b, "smj_NO"},
- {0x143b, "smj_SE"},
- {0x243b, "smn_FI"},
- {0x203b, "sms_FI"},
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x045b, si, si_LK)
-ILCID_POSIX_ELEMENT_ARRAY(0x041b, sk, sk_SK)
-ILCID_POSIX_ELEMENT_ARRAY(0x0424, sl, sl_SI)
-
-ILCID_POSIX_SUBTABLE(so) {
- {0x77, "so"},
- {0x0477, "so_SO"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x041c, sq, sq_AL)
-ILCID_POSIX_ELEMENT_ARRAY(0x0430, st, st_ZA)
-
-ILCID_POSIX_SUBTABLE(sv) {
- {0x1d, "sv"},
- {0x081d, "sv_FI"},
- {0x041d, "sv_SE"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0441, sw, sw_KE)
-ILCID_POSIX_ELEMENT_ARRAY(0x045A, syr, syr_SY)
-
-ILCID_POSIX_SUBTABLE(ta) {
- {0x49, "ta"},
- {0x0449, "ta_IN"},
- {0x0849, "ta_LK"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x044a, te, te_IN)
-
-/* Cyrillic based by default */
-ILCID_POSIX_SUBTABLE(tg) {
- {0x28, "tg"},
- {0x7c28, "tg_Cyrl"},
- {0x0428, "tg_Cyrl_TJ"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x041e, th, th_TH)
-
-ILCID_POSIX_SUBTABLE(ti) {
- {0x73, "ti"},
- {0x0873, "ti_ER"},
- {0x0473, "ti_ET"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0442, tk, tk_TM)
-
-ILCID_POSIX_SUBTABLE(tn) {
- {0x32, "tn"},
- {0x0832, "tn_BW"},
- {0x0432, "tn_ZA"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x041f, tr, tr_TR)
-ILCID_POSIX_ELEMENT_ARRAY(0x0431, ts, ts_ZA)
-ILCID_POSIX_ELEMENT_ARRAY(0x0444, tt, tt_RU)
-
-ILCID_POSIX_SUBTABLE(tzm) {
- {0x5f, "tzm"},
- {0x7c5f, "tzm_Latn"},
- {0x085f, "tzm_Latn_DZ"},
- {0x105f, "tzm_Tfng_MA"},
- {0x045f, "tzm_Arab_MA"},
- {0x045f, "tmz"}
-};
-
-ILCID_POSIX_SUBTABLE(ug) {
- {0x80, "ug"},
- {0x0480, "ug_CN"},
- {0x0480, "ug_Arab_CN"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0422, uk, uk_UA)
-
-ILCID_POSIX_SUBTABLE(ur) {
- {0x20, "ur"},
- {0x0820, "ur_IN"},
- {0x0420, "ur_PK"}
-};
-
-ILCID_POSIX_SUBTABLE(uz) {
- {0x43, "uz"},
- {0x0843, "uz_Cyrl_UZ"}, /* Cyrillic based */
- {0x7843, "uz_Cyrl"}, /* Cyrillic based */
- {0x0843, "uz_UZ"}, /* Cyrillic based */
- {0x0443, "uz_Latn_UZ"}, /* Latin based */
- {0x7c43, "uz_Latn"} /* Latin based */
-};
-
-ILCID_POSIX_SUBTABLE(ve) { /* TODO: Verify the country */
- {0x33, "ve"},
- {0x0433, "ve_ZA"},
- {0x0433, "ven_ZA"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x042a, vi, vi_VN)
-ILCID_POSIX_ELEMENT_ARRAY(0x0488, wo, wo_SN)
-ILCID_POSIX_ELEMENT_ARRAY(0x0434, xh, xh_ZA)
-
-ILCID_POSIX_SUBTABLE(yi) {
- {0x003d, "yi"},
- {0x043d, "yi_001"}
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x046a, yo, yo_NG)
-
-// Windows & ICU tend to different names for some of these
-// TODO: Windows probably does not need all of these entries, but I don't know how the precedence works.
-ILCID_POSIX_SUBTABLE(zh) {
- {0x0004, "zh_Hans"},
- {0x7804, "zh"},
- {0x0804, "zh_CN"},
- {0x0804, "zh_Hans_CN"},
- {0x0c04, "zh_Hant_HK"},
- {0x0c04, "zh_HK"},
- {0x1404, "zh_Hant_MO"},
- {0x1404, "zh_MO"},
- {0x1004, "zh_Hans_SG"},
- {0x1004, "zh_SG"},
- {0x0404, "zh_Hant_TW"},
- {0x7c04, "zh_Hant"},
- {0x0404, "zh_TW"},
- {0x30404,"zh_Hant_TW"}, /* Bopomofo order */
- {0x30404,"zh_TW"}, /* Bopomofo order */
- {0x20004,"zh@collation=stroke"},
- {0x20404,"zh_Hant@collation=stroke"},
- {0x20404,"zh_Hant_TW@collation=stroke"},
- {0x20404,"zh_TW@collation=stroke"},
- {0x20804,"zh_Hans@collation=stroke"},
- {0x20804,"zh_Hans_CN@collation=stroke"},
- {0x20804,"zh_CN@collation=stroke"}
- // TODO: Alternate collations for other LCIDs are missing, eg: 0x50804
-};
-
-ILCID_POSIX_ELEMENT_ARRAY(0x0435, zu, zu_ZA)
-
-/* This must be static and grouped by LCID. */
-static const ILcidPosixMap gPosixIDmap[] = {
- ILCID_POSIX_MAP(af), /* af Afrikaans 0x36 */
- ILCID_POSIX_MAP(am), /* am Amharic 0x5e */
- ILCID_POSIX_MAP(ar), /* ar Arabic 0x01 */
- ILCID_POSIX_MAP(arn), /* arn Araucanian/Mapudungun 0x7a */
- ILCID_POSIX_MAP(as), /* as Assamese 0x4d */
- ILCID_POSIX_MAP(az), /* az Azerbaijani 0x2c */
- ILCID_POSIX_MAP(ba), /* ba Bashkir 0x6d */
- ILCID_POSIX_MAP(be), /* be Belarusian 0x23 */
-/* ILCID_POSIX_MAP(ber), ber Berber/Tamazight 0x5f */
- ILCID_POSIX_MAP(bg), /* bg Bulgarian 0x02 */
- ILCID_POSIX_MAP(bin), /* bin Edo 0x66 */
- ILCID_POSIX_MAP(bn), /* bn Bengali; Bangla 0x45 */
- ILCID_POSIX_MAP(bo), /* bo Tibetan 0x51 */
- ILCID_POSIX_MAP(br), /* br Breton 0x7e */
- ILCID_POSIX_MAP(ca), /* ca Catalan 0x03 */
- ILCID_POSIX_MAP(chr), /* chr Cherokee 0x5c */
- ILCID_POSIX_MAP(ckb), /* ckb Sorani (Central Kurdish) 0x92 */
- ILCID_POSIX_MAP(co), /* co Corsican 0x83 */
- ILCID_POSIX_MAP(cs), /* cs Czech 0x05 */
- ILCID_POSIX_MAP(cy), /* cy Welsh 0x52 */
- ILCID_POSIX_MAP(da), /* da Danish 0x06 */
- ILCID_POSIX_MAP(de), /* de German 0x07 */
- ILCID_POSIX_MAP(dv), /* dv Divehi 0x65 */
- ILCID_POSIX_MAP(el), /* el Greek 0x08 */
- ILCID_POSIX_MAP(en), /* en English 0x09 */
- ILCID_POSIX_MAP(en_US_POSIX), /* invariant 0x7f */
- ILCID_POSIX_MAP(es), /* es Spanish 0x0a */
- ILCID_POSIX_MAP(et), /* et Estonian 0x25 */
- ILCID_POSIX_MAP(eu), /* eu Basque 0x2d */
- ILCID_POSIX_MAP(fa), /* fa Persian/Farsi 0x29 */
- ILCID_POSIX_MAP(fa_AF), /* fa Persian/Dari 0x8c */
- ILCID_POSIX_MAP(ff), /* ff Fula 0x67 */
- ILCID_POSIX_MAP(fi), /* fi Finnish 0x0b */
- ILCID_POSIX_MAP(fil), /* fil Filipino 0x64 */
- ILCID_POSIX_MAP(fo), /* fo Faroese 0x38 */
- ILCID_POSIX_MAP(fr), /* fr French 0x0c */
- ILCID_POSIX_MAP(fuv), /* fuv Fulfulde - Nigeria 0x67 */
- ILCID_POSIX_MAP(fy), /* fy Frisian 0x62 */
- ILCID_POSIX_MAP(ga), /* * Gaelic (Ireland,Scotland) 0x3c */
- ILCID_POSIX_MAP(gd), /* gd Gaelic (United Kingdom) 0x91 */
- ILCID_POSIX_MAP(gl), /* gl Galician 0x56 */
- ILCID_POSIX_MAP(gn), /* gn Guarani 0x74 */
- ILCID_POSIX_MAP(gsw), /* gsw Alemanic/Alsatian/Swiss German 0x84 */
- ILCID_POSIX_MAP(gu), /* gu Gujarati 0x47 */
- ILCID_POSIX_MAP(ha), /* ha Hausa 0x68 */
- ILCID_POSIX_MAP(haw), /* haw Hawaiian 0x75 */
- ILCID_POSIX_MAP(he), /* he Hebrew (formerly iw) 0x0d */
- ILCID_POSIX_MAP(hi), /* hi Hindi 0x39 */
- ILCID_POSIX_MAP(hr), /* * Croatian and others 0x1a */
- ILCID_POSIX_MAP(hsb), /* hsb Upper Sorbian 0x2e */
- ILCID_POSIX_MAP(hu), /* hu Hungarian 0x0e */
- ILCID_POSIX_MAP(hy), /* hy Armenian 0x2b */
- ILCID_POSIX_MAP(ibb), /* ibb Ibibio - Nigeria 0x69 */
- ILCID_POSIX_MAP(id), /* id Indonesian (formerly in) 0x21 */
- ILCID_POSIX_MAP(ig), /* ig Igbo 0x70 */
- ILCID_POSIX_MAP(ii), /* ii Sichuan Yi 0x78 */
- ILCID_POSIX_MAP(is), /* is Icelandic 0x0f */
- ILCID_POSIX_MAP(it), /* it Italian 0x10 */
- ILCID_POSIX_MAP(iu), /* iu Inuktitut 0x5d */
- ILCID_POSIX_MAP(iw), /* iw Hebrew 0x0d */
- ILCID_POSIX_MAP(ja), /* ja Japanese 0x11 */
- ILCID_POSIX_MAP(ka), /* ka Georgian 0x37 */
- ILCID_POSIX_MAP(kk), /* kk Kazakh 0x3f */
- ILCID_POSIX_MAP(kl), /* kl Kalaallisut 0x6f */
- ILCID_POSIX_MAP(km), /* km Khmer 0x53 */
- ILCID_POSIX_MAP(kn), /* kn Kannada 0x4b */
- ILCID_POSIX_MAP(ko), /* ko Korean 0x12 */
- ILCID_POSIX_MAP(kok), /* kok Konkani 0x57 */
- ILCID_POSIX_MAP(kr), /* kr Kanuri 0x71 */
- ILCID_POSIX_MAP(ks), /* ks Kashmiri 0x60 */
- ILCID_POSIX_MAP(ky), /* ky Kyrgyz 0x40 */
- ILCID_POSIX_MAP(lb), /* lb Luxembourgish 0x6e */
- ILCID_POSIX_MAP(la), /* la Latin 0x76 */
- ILCID_POSIX_MAP(lo), /* lo Lao 0x54 */
- ILCID_POSIX_MAP(lt), /* lt Lithuanian 0x27 */
- ILCID_POSIX_MAP(lv), /* lv Latvian, Lettish 0x26 */
- ILCID_POSIX_MAP(mi), /* mi Maori 0x81 */
- ILCID_POSIX_MAP(mk), /* mk Macedonian 0x2f */
- ILCID_POSIX_MAP(ml), /* ml Malayalam 0x4c */
- ILCID_POSIX_MAP(mn), /* mn Mongolian 0x50 */
- ILCID_POSIX_MAP(mni), /* mni Manipuri 0x58 */
- ILCID_POSIX_MAP(moh), /* moh Mohawk 0x7c */
- ILCID_POSIX_MAP(mr), /* mr Marathi 0x4e */
- ILCID_POSIX_MAP(ms), /* ms Malay 0x3e */
- ILCID_POSIX_MAP(mt), /* mt Maltese 0x3a */
- ILCID_POSIX_MAP(my), /* my Burmese 0x55 */
-/* ILCID_POSIX_MAP(nb), // no Norwegian 0x14 */
- ILCID_POSIX_MAP(ne), /* ne Nepali 0x61 */
- ILCID_POSIX_MAP(nl), /* nl Dutch 0x13 */
-/* ILCID_POSIX_MAP(nn), // no Norwegian 0x14 */
- ILCID_POSIX_MAP(no), /* * Norwegian 0x14 */
- ILCID_POSIX_MAP(nso), /* nso Sotho, Northern (Sepedi dialect) 0x6c */
- ILCID_POSIX_MAP(oc), /* oc Occitan 0x82 */
- ILCID_POSIX_MAP(om), /* om Oromo 0x72 */
- ILCID_POSIX_MAP(or_IN), /* or Oriya 0x48 */
- ILCID_POSIX_MAP(pa), /* pa Punjabi 0x46 */
- ILCID_POSIX_MAP(pap), /* pap Papiamentu 0x79 */
- ILCID_POSIX_MAP(pl), /* pl Polish 0x15 */
- ILCID_POSIX_MAP(ps), /* ps Pashto 0x63 */
- ILCID_POSIX_MAP(pt), /* pt Portuguese 0x16 */
- ILCID_POSIX_MAP(qu), /* qu Quechua 0x6B */
- ILCID_POSIX_MAP(quc), /* quc K'iche 0x93 */
- ILCID_POSIX_MAP(qut), /* qut K'iche 0x86 */
- ILCID_POSIX_MAP(rm), /* rm Raeto-Romance/Romansh 0x17 */
- ILCID_POSIX_MAP(ro), /* ro Romanian 0x18 */
- ILCID_POSIX_MAP(root), /* root 0x00 */
- ILCID_POSIX_MAP(ru), /* ru Russian 0x19 */
- ILCID_POSIX_MAP(rw), /* rw Kinyarwanda 0x87 */
- ILCID_POSIX_MAP(sa), /* sa Sanskrit 0x4f */
- ILCID_POSIX_MAP(sah), /* sah Yakut 0x85 */
- ILCID_POSIX_MAP(sd), /* sd Sindhi 0x59 */
- ILCID_POSIX_MAP(se), /* se Sami 0x3b */
-/* ILCID_POSIX_MAP(sh), // sh Serbo-Croatian 0x1a */
- ILCID_POSIX_MAP(si), /* si Sinhalese 0x5b */
- ILCID_POSIX_MAP(sk), /* sk Slovak 0x1b */
- ILCID_POSIX_MAP(sl), /* sl Slovenian 0x24 */
- ILCID_POSIX_MAP(so), /* so Somali 0x77 */
- ILCID_POSIX_MAP(sq), /* sq Albanian 0x1c */
-/* ILCID_POSIX_MAP(sr), // sr Serbian 0x1a */
- ILCID_POSIX_MAP(st), /* st Sutu 0x30 */
- ILCID_POSIX_MAP(sv), /* sv Swedish 0x1d */
- ILCID_POSIX_MAP(sw), /* sw Swahili 0x41 */
- ILCID_POSIX_MAP(syr), /* syr Syriac 0x5A */
- ILCID_POSIX_MAP(ta), /* ta Tamil 0x49 */
- ILCID_POSIX_MAP(te), /* te Telugu 0x4a */
- ILCID_POSIX_MAP(tg), /* tg Tajik 0x28 */
- ILCID_POSIX_MAP(th), /* th Thai 0x1e */
- ILCID_POSIX_MAP(ti), /* ti Tigrigna 0x73 */
- ILCID_POSIX_MAP(tk), /* tk Turkmen 0x42 */
- ILCID_POSIX_MAP(tn), /* tn Tswana 0x32 */
- ILCID_POSIX_MAP(tr), /* tr Turkish 0x1f */
- ILCID_POSIX_MAP(ts), /* ts Tsonga 0x31 */
- ILCID_POSIX_MAP(tt), /* tt Tatar 0x44 */
- ILCID_POSIX_MAP(tzm), /* tzm Tamazight 0x5f */
- ILCID_POSIX_MAP(ug), /* ug Uighur 0x80 */
- ILCID_POSIX_MAP(uk), /* uk Ukrainian 0x22 */
- ILCID_POSIX_MAP(ur), /* ur Urdu 0x20 */
- ILCID_POSIX_MAP(uz), /* uz Uzbek 0x43 */
- ILCID_POSIX_MAP(ve), /* ve Venda 0x33 */
- ILCID_POSIX_MAP(vi), /* vi Vietnamese 0x2a */
- ILCID_POSIX_MAP(wo), /* wo Wolof 0x88 */
- ILCID_POSIX_MAP(xh), /* xh Xhosa 0x34 */
- ILCID_POSIX_MAP(yi), /* yi Yiddish 0x3d */
- ILCID_POSIX_MAP(yo), /* yo Yoruba 0x6a */
- ILCID_POSIX_MAP(zh), /* zh Chinese 0x04 */
- ILCID_POSIX_MAP(zu), /* zu Zulu 0x35 */
-};
-
-static const uint32_t gLocaleCount = UPRV_LENGTHOF(gPosixIDmap);
-
-/**
- * Do not call this function. It is called by hostID.
- * The function is not private because this struct must stay as a C struct,
- * and this is an internal class.
- */
-static int32_t
-idCmp(const char* id1, const char* id2)
-{
- int32_t diffIdx = 0;
- while (*id1 == *id2 && *id1 != 0) {
- diffIdx++;
- id1++;
- id2++;
- }
- return diffIdx;
-}
-
-/**
- * Searches for a Windows LCID
- *
- * @param posixID the Posix style locale id.
- * @param status gets set to U_ILLEGAL_ARGUMENT_ERROR when the Posix ID has
- * no equivalent Windows LCID.
- * @return the LCID
- */
-static uint32_t
-getHostID(const ILcidPosixMap *this_0, const char* posixID, UErrorCode* status)
-{
- int32_t bestIdx = 0;
- int32_t bestIdxDiff = 0;
- int32_t posixIDlen = (int32_t)uprv_strlen(posixID);
- uint32_t idx;
-
- for (idx = 0; idx < this_0->numRegions; idx++ ) {
- int32_t sameChars = idCmp(posixID, this_0->regionMaps[idx].posixID);
- if (sameChars > bestIdxDiff && this_0->regionMaps[idx].posixID[sameChars] == 0) {
- if (posixIDlen == sameChars) {
- /* Exact match */
- return this_0->regionMaps[idx].hostID;
- }
- bestIdxDiff = sameChars;
- bestIdx = idx;
- }
- }
- /* We asked for something unusual, like en_ZZ, and we try to return the number for the same language. */
- /* We also have to make sure that sid and si and similar string subsets don't match. */
- if ((posixID[bestIdxDiff] == '_' || posixID[bestIdxDiff] == '@')
- && this_0->regionMaps[bestIdx].posixID[bestIdxDiff] == 0)
- {
- *status = U_USING_FALLBACK_WARNING;
- return this_0->regionMaps[bestIdx].hostID;
- }
-
- /*no match found */
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return this_0->regionMaps->hostID;
-}
-
-static const char*
-getPosixID(const ILcidPosixMap *this_0, uint32_t hostID)
-{
- uint32_t i;
- for (i = 0; i < this_0->numRegions; i++)
- {
- if (this_0->regionMaps[i].hostID == hostID)
- {
- return this_0->regionMaps[i].posixID;
- }
- }
-
- /* If you get here, then no matching region was found,
- so return the language id with the wild card region. */
- return this_0->regionMaps[0].posixID;
-}
-
-/*
-//////////////////////////////////////
-//
-// LCID --> POSIX
-//
-/////////////////////////////////////
-*/
-#if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API
-/*
- * Various language tags needs to be changed:
- * quz -> qu
- * prs -> fa
- */
-#define FIX_LANGUAGE_ID_TAG(buffer, len) \
- if (len >= 3) { \
- if (buffer[0] == 'q' && buffer[1] == 'u' && buffer[2] == 'z') {\
- buffer[2] = 0; \
- uprv_strcat(buffer, buffer+3); \
- } else if (buffer[0] == 'p' && buffer[1] == 'r' && buffer[2] == 's') {\
- buffer[0] = 'f'; buffer[1] = 'a'; buffer[2] = 0; \
- uprv_strcat(buffer, buffer+3); \
- } \
- }
-
-#endif
-
-U_CAPI int32_t
-uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UErrorCode* status)
-{
- uint16_t langID;
- uint32_t localeIndex;
- UBool bLookup = TRUE;
- const char *pPosixID = NULL;
-
-#if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API
- static_assert(ULOC_FULLNAME_CAPACITY > LOCALE_NAME_MAX_LENGTH, "Windows locale names have smaller length than ICU locale names.");
-
- char locName[LOCALE_NAME_MAX_LENGTH] = {};
-
- // Note: Windows primary lang ID 0x92 in LCID is used for Central Kurdish and
- // GetLocaleInfo() maps such LCID to "ku". However, CLDR uses "ku" for
- // Northern Kurdish and "ckb" for Central Kurdish. For this reason, we cannot
- // use the Windows API to resolve locale ID for this specific case.
- if ((hostid & 0x3FF) != 0x92) {
- int32_t tmpLen = 0;
- char16_t windowsLocaleName[LOCALE_NAME_MAX_LENGTH] = {};
-
- // Note: LOCALE_ALLOW_NEUTRAL_NAMES was enabled in Windows7+, prior versions did not handle neutral (no-region) locale names.
- tmpLen = LCIDToLocaleName(hostid, (PWSTR)windowsLocaleName, UPRV_LENGTHOF(windowsLocaleName), LOCALE_ALLOW_NEUTRAL_NAMES);
- if (tmpLen > 1) {
- int32_t i = 0;
- // Only need to look up in table if have _, eg for de-de_phoneb type alternate sort.
- bLookup = FALSE;
- for (i = 0; i < UPRV_LENGTHOF(locName); i++)
- {
- locName[i] = (char)(windowsLocaleName[i]);
-
- // Windows locale name may contain sorting variant, such as "es-ES_tradnl".
- // In such cases, we need special mapping data found in the hardcoded table
- // in this source file.
- if (windowsLocaleName[i] == L'_')
- {
- // Keep the base locale, without variant
- // TODO: Should these be mapped from _phoneb to @collation=phonebook, etc.?
- locName[i] = '\0';
- tmpLen = i;
- bLookup = TRUE;
- break;
- }
- else if (windowsLocaleName[i] == L'-')
- {
- // Windows names use -, ICU uses _
- locName[i] = '_';
- }
- else if (windowsLocaleName[i] == L'\0')
- {
- // No point in doing more work than necessary
- break;
- }
- }
- // TODO: Need to understand this better, why isn't it an alias?
- FIX_LANGUAGE_ID_TAG(locName, tmpLen);
- pPosixID = locName;
- }
- }
-#endif
-
- if (bLookup) {
- const char *pCandidate = NULL;
- langID = LANGUAGE_LCID(hostid);
-
- for (localeIndex = 0; localeIndex < gLocaleCount; localeIndex++) {
- if (langID == gPosixIDmap[localeIndex].regionMaps->hostID) {
- pCandidate = getPosixID(&gPosixIDmap[localeIndex], hostid);
- break;
- }
- }
-
- /* On Windows, when locale name has a variant, we still look up the hardcoded table.
- If a match in the hardcoded table is longer than the Windows locale name without
- variant, we use the one as the result */
- if (pCandidate && (pPosixID == NULL || uprv_strlen(pCandidate) > uprv_strlen(pPosixID))) {
- pPosixID = pCandidate;
- }
- }
-
- if (pPosixID) {
- int32_t resLen = static_cast<int32_t>(uprv_strlen(pPosixID));
- int32_t copyLen = resLen <= posixIDCapacity ? resLen : posixIDCapacity;
- uprv_memcpy(posixID, pPosixID, copyLen);
- if (resLen < posixIDCapacity) {
- posixID[resLen] = 0;
- if (*status == U_STRING_NOT_TERMINATED_WARNING) {
- *status = U_ZERO_ERROR;
- }
- } else if (resLen == posixIDCapacity) {
- *status = U_STRING_NOT_TERMINATED_WARNING;
- } else {
- *status = U_BUFFER_OVERFLOW_ERROR;
- }
- return resLen;
- }
-
- /* no match found */
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return -1;
-}
-
-/*
-//////////////////////////////////////
-//
-// POSIX --> LCID
-// This should only be called from uloc_getLCID.
-// The locale ID must be in canonical form.
-//
-/////////////////////////////////////
-*/
-U_CAPI uint32_t
-uprv_convertToLCIDPlatform(const char* localeID, UErrorCode* status)
-{
- if (U_FAILURE(*status)) {
- return 0;
- }
-
- // The purpose of this function is to leverage the Windows platform name->lcid
- // 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)
- {
- // If it contains the keyword collation, return 0 so that the LCID lookup table will be used.
- return 0;
- }
- else
- {
- // If the locale ID contains keywords other than collation, just use the base name.
- len = uloc_getBaseName(localeID, baseName, UPRV_LENGTHOF(baseName) - 1, status);
-
- if (U_SUCCESS(*status) && len > 0)
- {
- baseName[len] = 0;
- mylocaleID = baseName;
- }
- }
- }
-
- char asciiBCP47Tag[LOCALE_NAME_MAX_LENGTH] = {};
- // this will change it from de_DE@collation=phonebook to de-DE-u-co-phonebk form
- (void)uloc_toLanguageTag(mylocaleID, asciiBCP47Tag, UPRV_LENGTHOF(asciiBCP47Tag), FALSE, status);
-
- if (U_SUCCESS(*status))
- {
- // Need it to be UTF-16, not 8-bit
- wchar_t bcp47Tag[LOCALE_NAME_MAX_LENGTH] = {};
- int32_t i;
- for (i = 0; i < UPRV_LENGTHOF(bcp47Tag); i++)
- {
- if (asciiBCP47Tag[i] == '\0')
- {
- break;
- }
- else
- {
- // Copy the character
- bcp47Tag[i] = static_cast<wchar_t>(asciiBCP47Tag[i]);
- }
- }
-
- if (i < (UPRV_LENGTHOF(bcp47Tag) - 1))
- {
- // Ensure it's null terminated
- bcp47Tag[i] = L'\0';
- LCID lcid = LocaleNameToLCID(bcp47Tag, LOCALE_ALLOW_NEUTRAL_NAMES);
- if (lcid > 0)
- {
- // Found LCID from windows, return that one, unless its completely ambiguous
- // LOCALE_USER_DEFAULT and transients are OK because they will round trip
- // for this process.
- if (lcid != LOCALE_CUSTOM_UNSPECIFIED)
- {
- return lcid;
- }
- }
- }
- }
-#else
- (void) localeID; // Suppress unused variable warning.
-#endif
-
- // Nothing found, or not implemented.
- return 0;
-}
-
-U_CAPI uint32_t
-uprv_convertToLCID(const char *langID, const char* posixID, UErrorCode* status)
-{
- // This function does the table lookup when native platform name->lcid conversion isn't available,
- // or for locales that don't follow patterns the platform expects.
- uint32_t low = 0;
- uint32_t high = gLocaleCount;
- uint32_t mid;
- uint32_t oldmid = 0;
- int32_t compVal;
-
- uint32_t value = 0;
- uint32_t fallbackValue = (uint32_t)-1;
- UErrorCode myStatus;
- uint32_t idx;
-
- /* Check for incomplete id. */
- if (!langID || !posixID || uprv_strlen(langID) < 2 || uprv_strlen(posixID) < 2) {
- return 0;
- }
-
- /*Binary search for the map entry for normal cases */
-
- while (high > low) /*binary search*/{
-
- mid = (high+low) >> 1; /*Finds median*/
-
- if (mid == oldmid)
- break;
-
- compVal = uprv_strcmp(langID, gPosixIDmap[mid].regionMaps->posixID);
- if (compVal < 0){
- high = mid;
- }
- else if (compVal > 0){
- low = mid;
- }
- else /*we found it*/{
- return getHostID(&gPosixIDmap[mid], posixID, status);
- }
- oldmid = mid;
- }
-
- /*
- * Sometimes we can't do a binary search on posixID because some LCIDs
- * go to different locales. We hit one of those special cases.
- */
- for (idx = 0; idx < gLocaleCount; idx++ ) {
- myStatus = U_ZERO_ERROR;
- value = getHostID(&gPosixIDmap[idx], posixID, &myStatus);
- if (myStatus == U_ZERO_ERROR) {
- return value;
- }
- else if (myStatus == U_USING_FALLBACK_WARNING) {
- fallbackValue = value;
- }
- }
-
- if (fallbackValue != (uint32_t)-1) {
- *status = U_USING_FALLBACK_WARNING;
- return fallbackValue;
- }
-
- /* no match found */
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return 0; /* return international (root) */
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+ **********************************************************************
+ * Copyright (C) 1996-2016, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ *
+ * Provides functionality for mapping between
+ * LCID and Posix IDs or ICU locale to codepage
+ *
+ * Note: All classes and code in this file are
+ * intended for internal use only.
+ *
+ * Methods of interest:
+ * unsigned long convertToLCID(const char*);
+ * const char* convertToPosix(unsigned long);
+ *
+ * Kathleen Wilson, 4/30/96
+ *
+ * Date Name Description
+ * 3/11/97 aliu Fixed off-by-one bug in assignment operator. Added
+ * setId() method and safety check against
+ * MAX_ID_LENGTH.
+ * 04/23/99 stephen Added C wrapper for convertToPosix.
+ * 09/18/00 george Removed the memory leaks.
+ * 08/23/01 george Convert to C
+ */
+
+#include "locmap.h"
+#include "cstring.h"
+#include "cmemory.h"
+#include "unicode/uloc.h"
+
+#if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API
+#include <windows.h>
+#include <winnls.h> // LCIDToLocaleName and LocaleNameToLCID
+#endif
+
+/*
+ * Note:
+ * The mapping from Win32 locale ID numbers to POSIX locale strings should
+ * be the faster one.
+ *
+ * Windows LCIDs are defined at https://msdn.microsoft.com/en-us/library/cc233965.aspx
+ * [MS-LCID] Windows Language Code Identifier (LCID) Reference
+ */
+
+/*
+////////////////////////////////////////////////
+//
+// Internal Classes for LCID <--> POSIX Mapping
+//
+/////////////////////////////////////////////////
+*/
+
+typedef struct ILcidPosixElement
+{
+ const uint32_t hostID;
+ const char * const posixID;
+} ILcidPosixElement;
+
+typedef struct ILcidPosixMap
+{
+ const uint32_t numRegions;
+ const struct ILcidPosixElement* const regionMaps;
+} ILcidPosixMap;
+
+
+/*
+/////////////////////////////////////////////////
+//
+// Easy macros to make the LCID <--> POSIX Mapping
+//
+/////////////////////////////////////////////////
+*/
+
+/**
+ * The standard one language/one country mapping for LCID.
+ * The first element must be the language, and the following
+ * elements are the language with the country.
+ * @param hostID LCID in host format such as 0x044d
+ * @param languageID posix ID of just the language such as 'de'
+ * @param posixID posix ID of the language_TERRITORY such as 'de_CH'
+ */
+#define ILCID_POSIX_ELEMENT_ARRAY(hostID, languageID, posixID) \
+static const ILcidPosixElement locmap_ ## languageID [] = { \
+ {LANGUAGE_LCID(hostID), #languageID}, /* parent locale */ \
+ {hostID, #posixID}, \
+};
+
+/**
+ * Define a subtable by ID
+ * @param id the POSIX ID, either a language or language_TERRITORY
+ */
+#define ILCID_POSIX_SUBTABLE(id) \
+static const ILcidPosixElement locmap_ ## id [] =
+
+
+/**
+ * Create the map for the posixID. This macro supposes that the language string
+ * name is the same as the global variable name, and that the first element
+ * in the ILcidPosixElement is just the language.
+ * @param _posixID the full POSIX ID for this entry.
+ */
+#define ILCID_POSIX_MAP(_posixID) \
+ {UPRV_LENGTHOF(locmap_ ## _posixID), locmap_ ## _posixID}
+
+/*
+////////////////////////////////////////////
+//
+// Create the table of LCID to POSIX Mapping
+// None of it should be dynamically created.
+//
+// Keep static locale variables inside the function so that
+// it can be created properly during static init.
+//
+// Note: This table should be updated periodically. Check the [MS-LCID] Windows Language Code Identifier
+// (LCID) Reference defined at https://msdn.microsoft.com/en-us/library/cc233965.aspx
+//
+// Microsoft is moving away from LCID in favor of locale name as of Vista. This table needs to be
+// maintained for support of older Windows version.
+// Update: Windows 7 (091130)
+//
+// Note: Microsoft assign a different LCID if a locale has a sorting variant. POSIX IDs below may contain
+// @collation=XXX, but no other keywords are allowed (at least for now). When uprv_convertToLCID() is
+// called from uloc_getLCID(), keywords other than collation are already removed. If we really need
+// to support other keywords in this mapping data, we must update the implementation.
+////////////////////////////////////////////
+*/
+
+// TODO: For Windows ideally this table would be a list of exceptions rather than a complete list as
+// LocaleNameToLCID and LCIDToLocaleName provide 90% of these.
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0436, af, af_ZA)
+
+ILCID_POSIX_SUBTABLE(ar) {
+ {0x01, "ar"},
+ {0x3801, "ar_AE"},
+ {0x3c01, "ar_BH"},
+ {0x1401, "ar_DZ"},
+ {0x0c01, "ar_EG"},
+ {0x0801, "ar_IQ"},
+ {0x2c01, "ar_JO"},
+ {0x3401, "ar_KW"},
+ {0x3001, "ar_LB"},
+ {0x1001, "ar_LY"},
+ {0x1801, "ar_MA"},
+ {0x1801, "ar_MO"},
+ {0x2001, "ar_OM"},
+ {0x4001, "ar_QA"},
+ {0x0401, "ar_SA"},
+ {0x2801, "ar_SY"},
+ {0x1c01, "ar_TN"},
+ {0x2401, "ar_YE"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x044d, as, as_IN)
+ILCID_POSIX_ELEMENT_ARRAY(0x045e, am, am_ET)
+ILCID_POSIX_ELEMENT_ARRAY(0x047a, arn,arn_CL)
+
+ILCID_POSIX_SUBTABLE(az) {
+ {0x2c, "az"},
+ {0x082c, "az_Cyrl_AZ"}, /* Cyrillic based */
+ {0x742c, "az_Cyrl"}, /* Cyrillic based */
+ {0x042c, "az_Latn_AZ"}, /* Latin based */
+ {0x782c, "az_Latn"}, /* Latin based */
+ {0x042c, "az_AZ"} /* Latin based */
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x046d, ba, ba_RU)
+ILCID_POSIX_ELEMENT_ARRAY(0x0423, be, be_BY)
+
+/*ILCID_POSIX_SUBTABLE(ber) {
+ {0x5f, "ber"},
+ {0x045f, "ber_Arab_DZ"},
+ {0x045f, "ber_Arab"},
+ {0x085f, "ber_Latn_DZ"},
+ {0x085f, "ber_Latn"}
+};*/
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0402, bg, bg_BG)
+
+ILCID_POSIX_SUBTABLE(bin) {
+ {0x66, "bin"},
+ {0x0466, "bin_NG"}
+};
+
+ILCID_POSIX_SUBTABLE(bn) {
+ {0x45, "bn"},
+ {0x0845, "bn_BD"},
+ {0x0445, "bn_IN"}
+};
+
+ILCID_POSIX_SUBTABLE(bo) {
+ {0x51, "bo"},
+ {0x0851, "bo_BT"},
+ {0x0451, "bo_CN"},
+ {0x0c51, "dz_BT"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x047e, br, br_FR)
+
+ILCID_POSIX_SUBTABLE(ca) {
+ {0x03, "ca"},
+ {0x0403, "ca_ES"},
+ {0x0803, "ca_ES_VALENCIA"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0483, co, co_FR)
+
+ILCID_POSIX_SUBTABLE(chr) {
+ {0x05c, "chr"},
+ {0x7c5c, "chr_Cher"},
+ {0x045c, "chr_Cher_US"},
+ {0x045c, "chr_US"}
+};
+
+// ICU has chosen different names for these.
+ILCID_POSIX_SUBTABLE(ckb) {
+ {0x92, "ckb"},
+ {0x7c92, "ckb_Arab"},
+ {0x0492, "ckb_Arab_IQ"}
+};
+
+/* Declared as cs_CZ to get around compiler errors on z/OS, which defines cs as a function */
+ILCID_POSIX_ELEMENT_ARRAY(0x0405, cs, cs_CZ)
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0452, cy, cy_GB)
+ILCID_POSIX_ELEMENT_ARRAY(0x0406, da, da_DK)
+
+// Windows doesn't know POSIX or BCP47 Unicode phonebook sort names
+ILCID_POSIX_SUBTABLE(de) {
+ {0x07, "de"},
+ {0x0c07, "de_AT"},
+ {0x0807, "de_CH"},
+ {0x0407, "de_DE"},
+ {0x1407, "de_LI"},
+ {0x1007, "de_LU"},
+ {0x10407,"de_DE@collation=phonebook"}, /*This is really de_DE_PHONEBOOK on Windows*/
+ {0x10407,"de@collation=phonebook"} /*This is really de_DE_PHONEBOOK on Windows*/
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0465, dv, dv_MV)
+ILCID_POSIX_ELEMENT_ARRAY(0x0408, el, el_GR)
+
+// Windows uses an empty string for 'invariant'
+ILCID_POSIX_SUBTABLE(en) {
+ {0x09, "en"},
+ {0x0c09, "en_AU"},
+ {0x2809, "en_BZ"},
+ {0x1009, "en_CA"},
+ {0x0809, "en_GB"},
+ {0x3c09, "en_HK"},
+ {0x3809, "en_ID"},
+ {0x1809, "en_IE"},
+ {0x4009, "en_IN"},
+ {0x2009, "en_JM"},
+ {0x4409, "en_MY"},
+ {0x1409, "en_NZ"},
+ {0x3409, "en_PH"},
+ {0x4809, "en_SG"},
+ {0x2C09, "en_TT"},
+ {0x0409, "en_US"},
+ {0x007f, "en_US_POSIX"}, /* duplicate for round-tripping */
+ {0x2409, "en_029"},
+ {0x1c09, "en_ZA"},
+ {0x3009, "en_ZW"},
+ {0x2409, "en_VI"}, /* Virgin Islands AKA Caribbean Islands (en_CB). On Windows8+ This is 0x1000 or dynamically assigned */
+ {0x0409, "en_AS"}, /* Alias for en_US. Leave last. On Windows8+ This is 0x1000 or dynamically assigned */
+ {0x0409, "en_GU"}, /* Alias for en_US. Leave last. On Windows8+ This is 0x1000 or dynamically assigned */
+ {0x0409, "en_MH"}, /* Alias for en_US. Leave last. On Windows8+ This is 0x1000 or dynamically assigned */
+ {0x0409, "en_MP"}, /* Alias for en_US. Leave last. On Windows8+ This is 0x1000 or dynamically assigned */
+ {0x0409, "en_UM"} /* Alias for en_US. Leave last. On Windows8+ This is 0x1000 or dynamically assigned */
+};
+
+ILCID_POSIX_SUBTABLE(en_US_POSIX) {
+ {0x007f, "en_US_POSIX"} /* duplicate for roundtripping */
+};
+
+// Windows doesn't know POSIX or BCP47 Unicode traditional sort names
+ILCID_POSIX_SUBTABLE(es) {
+ {0x0a, "es"},
+ {0x2c0a, "es_AR"},
+ {0x400a, "es_BO"},
+ {0x340a, "es_CL"},
+ {0x240a, "es_CO"},
+ {0x140a, "es_CR"},
+ {0x5c0a, "es_CU"},
+ {0x1c0a, "es_DO"},
+ {0x300a, "es_EC"},
+ {0x0c0a, "es_ES"}, /*Modern sort.*/
+ {0x100a, "es_GT"},
+ {0x480a, "es_HN"},
+ {0x080a, "es_MX"},
+ {0x4c0a, "es_NI"},
+ {0x180a, "es_PA"},
+ {0x280a, "es_PE"},
+ {0x500a, "es_PR"},
+ {0x3c0a, "es_PY"},
+ {0x440a, "es_SV"},
+ {0x540a, "es_US"},
+ {0x380a, "es_UY"},
+ {0x200a, "es_VE"},
+ {0x580a, "es_419"},
+ {0x040a, "es_ES@collation=traditional"},
+ {0x040a, "es@collation=traditional"} // Windows will treat this as es-ES@collation=traditional
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0425, et, et_EE)
+ILCID_POSIX_ELEMENT_ARRAY(0x042d, eu, eu_ES)
+
+/* ISO-639 doesn't distinguish between Persian and Dari.*/
+ILCID_POSIX_SUBTABLE(fa) {
+ {0x29, "fa"},
+ {0x0429, "fa_IR"}, /* Persian/Farsi (Iran) */
+ {0x048c, "fa_AF"} /* Persian/Dari (Afghanistan) */
+};
+
+
+/* duplicate for roundtripping */
+ILCID_POSIX_SUBTABLE(fa_AF) {
+ {0x8c, "fa_AF"}, /* Persian/Dari (Afghanistan) */
+ {0x048c, "fa_AF"} /* Persian/Dari (Afghanistan) */
+};
+
+ILCID_POSIX_SUBTABLE(ff) {
+ {0x67, "ff"},
+ {0x7c67, "ff_Latn"},
+ {0x0867, "ff_Latn_SN"},
+ {0x0467, "ff_NG"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x040b, fi, fi_FI)
+ILCID_POSIX_ELEMENT_ARRAY(0x0464, fil,fil_PH)
+ILCID_POSIX_ELEMENT_ARRAY(0x0438, fo, fo_FO)
+
+ILCID_POSIX_SUBTABLE(fr) {
+ {0x0c, "fr"},
+ {0x080c, "fr_BE"},
+ {0x0c0c, "fr_CA"},
+ {0x240c, "fr_CD"},
+ {0x240c, "fr_CG"},
+ {0x100c, "fr_CH"},
+ {0x300c, "fr_CI"},
+ {0x2c0c, "fr_CM"},
+ {0x040c, "fr_FR"},
+ {0x3c0c, "fr_HT"},
+ {0x140c, "fr_LU"},
+ {0x380c, "fr_MA"},
+ {0x180c, "fr_MC"},
+ {0x340c, "fr_ML"},
+ {0x200c, "fr_RE"},
+ {0x280c, "fr_SN"},
+ {0xe40c, "fr_015"},
+ {0x1c0c, "fr_029"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0467, fuv, fuv_NG)
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0462, fy, fy_NL)
+
+ILCID_POSIX_SUBTABLE(ga) { /* Gaelic (Ireland) */
+ {0x3c, "ga"},
+ {0x083c, "ga_IE"},
+ {0x043c, "gd_GB"}
+};
+
+ILCID_POSIX_SUBTABLE(gd) { /* Gaelic (Scotland) */
+ {0x91, "gd"},
+ {0x0491, "gd_GB"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0456, gl, gl_ES)
+ILCID_POSIX_ELEMENT_ARRAY(0x0447, gu, gu_IN)
+ILCID_POSIX_ELEMENT_ARRAY(0x0474, gn, gn_PY)
+ILCID_POSIX_ELEMENT_ARRAY(0x0484, gsw,gsw_FR)
+
+ILCID_POSIX_SUBTABLE(ha) {
+ {0x68, "ha"},
+ {0x7c68, "ha_Latn"},
+ {0x0468, "ha_Latn_NG"},
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0475, haw,haw_US)
+ILCID_POSIX_ELEMENT_ARRAY(0x040d, he, he_IL)
+ILCID_POSIX_ELEMENT_ARRAY(0x0439, hi, hi_IN)
+
+/* This LCID is really four different locales.*/
+ILCID_POSIX_SUBTABLE(hr) {
+ {0x1a, "hr"},
+ {0x141a, "bs_Latn_BA"}, /* Bosnian, Bosnia and Herzegovina */
+ {0x681a, "bs_Latn"}, /* Bosnian, Bosnia and Herzegovina */
+ {0x141a, "bs_BA"}, /* Bosnian, Bosnia and Herzegovina */
+ {0x781a, "bs"}, /* Bosnian */
+ {0x201a, "bs_Cyrl_BA"}, /* Bosnian, Bosnia and Herzegovina */
+ {0x641a, "bs_Cyrl"}, /* Bosnian, Bosnia and Herzegovina */
+ {0x101a, "hr_BA"}, /* Croatian in Bosnia */
+ {0x041a, "hr_HR"}, /* Croatian*/
+ {0x2c1a, "sr_Latn_ME"},
+ {0x241a, "sr_Latn_RS"},
+ {0x181a, "sr_Latn_BA"}, /* Serbo-Croatian in Bosnia */
+ {0x081a, "sr_Latn_CS"}, /* Serbo-Croatian*/
+ {0x701a, "sr_Latn"}, /* It's 0x1a or 0x081a, pick one to make the test program happy. */
+ {0x1c1a, "sr_Cyrl_BA"}, /* Serbo-Croatian in Bosnia */
+ {0x0c1a, "sr_Cyrl_CS"}, /* Serbian*/
+ {0x301a, "sr_Cyrl_ME"},
+ {0x281a, "sr_Cyrl_RS"},
+ {0x6c1a, "sr_Cyrl"}, /* It's 0x1a or 0x0c1a, pick one to make the test program happy. */
+ {0x7c1a, "sr"} /* In CLDR sr is sr_Cyrl. */
+};
+
+ILCID_POSIX_SUBTABLE(hsb) {
+ {0x2E, "hsb"},
+ {0x042E, "hsb_DE"},
+ {0x082E, "dsb_DE"},
+ {0x7C2E, "dsb"},
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x040e, hu, hu_HU)
+ILCID_POSIX_ELEMENT_ARRAY(0x042b, hy, hy_AM)
+
+ILCID_POSIX_SUBTABLE(ibb) {
+ {0x69, "ibb"},
+ {0x0469, "ibb_NG"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0421, id, id_ID)
+ILCID_POSIX_ELEMENT_ARRAY(0x0470, ig, ig_NG)
+ILCID_POSIX_ELEMENT_ARRAY(0x0478, ii, ii_CN)
+ILCID_POSIX_ELEMENT_ARRAY(0x040f, is, is_IS)
+
+ILCID_POSIX_SUBTABLE(it) {
+ {0x10, "it"},
+ {0x0810, "it_CH"},
+ {0x0410, "it_IT"}
+};
+
+ILCID_POSIX_SUBTABLE(iu) {
+ {0x5d, "iu"},
+ {0x045d, "iu_Cans_CA"},
+ {0x785d, "iu_Cans"},
+ {0x085d, "iu_Latn_CA"},
+ {0x7c5d, "iu_Latn"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x040d, iw, iw_IL) /*Left in for compatibility*/
+ILCID_POSIX_ELEMENT_ARRAY(0x0411, ja, ja_JP)
+ILCID_POSIX_ELEMENT_ARRAY(0x0437, ka, ka_GE)
+ILCID_POSIX_ELEMENT_ARRAY(0x043f, kk, kk_KZ)
+ILCID_POSIX_ELEMENT_ARRAY(0x046f, kl, kl_GL)
+ILCID_POSIX_ELEMENT_ARRAY(0x0453, km, km_KH)
+ILCID_POSIX_ELEMENT_ARRAY(0x044b, kn, kn_IN)
+
+ILCID_POSIX_SUBTABLE(ko) {
+ {0x12, "ko"},
+ {0x0812, "ko_KP"},
+ {0x0412, "ko_KR"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0457, kok, kok_IN)
+ILCID_POSIX_ELEMENT_ARRAY(0x0471, kr, kr_NG)
+
+ILCID_POSIX_SUBTABLE(ks) { /* We could add PK and CN too */
+ {0x60, "ks"},
+ {0x0460, "ks_Arab_IN"},
+ {0x0860, "ks_Deva_IN"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0440, ky, ky_KG) /* Kyrgyz is spoken in Kyrgyzstan */
+
+ILCID_POSIX_SUBTABLE(la) {
+ {0x76, "la"},
+ {0x0476, "la_001"},
+ {0x0476, "la_IT"} /*Left in for compatibility*/
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x046e, lb, lb_LU)
+ILCID_POSIX_ELEMENT_ARRAY(0x0454, lo, lo_LA)
+ILCID_POSIX_ELEMENT_ARRAY(0x0427, lt, lt_LT)
+ILCID_POSIX_ELEMENT_ARRAY(0x0426, lv, lv_LV)
+ILCID_POSIX_ELEMENT_ARRAY(0x0481, mi, mi_NZ)
+ILCID_POSIX_ELEMENT_ARRAY(0x042f, mk, mk_MK)
+ILCID_POSIX_ELEMENT_ARRAY(0x044c, ml, ml_IN)
+
+ILCID_POSIX_SUBTABLE(mn) {
+ {0x50, "mn"},
+ {0x0450, "mn_MN"},
+ {0x7c50, "mn_Mong"},
+ {0x0850, "mn_Mong_CN"},
+ {0x0850, "mn_CN"},
+ {0x7850, "mn_Cyrl"},
+ {0x0c50, "mn_Mong_MN"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0458, mni,mni_IN)
+ILCID_POSIX_ELEMENT_ARRAY(0x047c, moh,moh_CA)
+ILCID_POSIX_ELEMENT_ARRAY(0x044e, mr, mr_IN)
+
+ILCID_POSIX_SUBTABLE(ms) {
+ {0x3e, "ms"},
+ {0x083e, "ms_BN"}, /* Brunei Darussalam*/
+ {0x043e, "ms_MY"} /* Malaysia*/
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x043a, mt, mt_MT)
+ILCID_POSIX_ELEMENT_ARRAY(0x0455, my, my_MM)
+
+ILCID_POSIX_SUBTABLE(ne) {
+ {0x61, "ne"},
+ {0x0861, "ne_IN"}, /* India*/
+ {0x0461, "ne_NP"} /* Nepal*/
+};
+
+ILCID_POSIX_SUBTABLE(nl) {
+ {0x13, "nl"},
+ {0x0813, "nl_BE"},
+ {0x0413, "nl_NL"}
+};
+
+/* The "no" locale split into nb and nn. By default in ICU, "no" is nb.*/
+// TODO: Not all of these are needed on Windows, but I don't know how ICU treats preferred ones here.
+ILCID_POSIX_SUBTABLE(no) {
+ {0x14, "no"}, /* really nb_NO - actually Windows differentiates between neutral (no region) and specific (with region) */
+ {0x7c14, "nb"}, /* really nb */
+ {0x0414, "nb_NO"}, /* really nb_NO. Keep first in the 414 list. */
+ {0x0414, "no_NO"}, /* really nb_NO */
+ {0x0814, "nn_NO"}, /* really nn_NO. Keep first in the 814 list. */
+ {0x7814, "nn"}, /* It's 0x14 or 0x814, pick one to make the test program happy. */
+ {0x0814, "no_NO_NY"}/* really nn_NO */
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x046c, nso,nso_ZA) /* TODO: Verify the ISO-639 code */
+ILCID_POSIX_ELEMENT_ARRAY(0x0482, oc, oc_FR)
+
+ILCID_POSIX_SUBTABLE(om) { /* TODO: Verify the country */
+ {0x72, "om"},
+ {0x0472, "om_ET"},
+ {0x0472, "gaz_ET"}
+};
+
+/* Declared as or_IN to get around compiler errors*/
+ILCID_POSIX_SUBTABLE(or_IN) {
+ {0x48, "or"},
+ {0x0448, "or_IN"},
+};
+
+ILCID_POSIX_SUBTABLE(pa) {
+ {0x46, "pa"},
+ {0x0446, "pa_IN"},
+ {0x0846, "pa_Arab_PK"},
+ {0x0846, "pa_PK"}
+};
+
+ILCID_POSIX_SUBTABLE(pap) {
+ {0x79, "pap"},
+ {0x0479, "pap_029"},
+ {0x0479, "pap_AN"} /*Left in for compatibility*/
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0415, pl, pl_PL)
+ILCID_POSIX_ELEMENT_ARRAY(0x0463, ps, ps_AF)
+
+ILCID_POSIX_SUBTABLE(pt) {
+ {0x16, "pt"},
+ {0x0416, "pt_BR"},
+ {0x0816, "pt_PT"}
+};
+
+ILCID_POSIX_SUBTABLE(qu) {
+ {0x6b, "qu"},
+ {0x046b, "qu_BO"},
+ {0x086b, "qu_EC"},
+ {0x0C6b, "qu_PE"},
+ {0x046b, "quz_BO"},
+ {0x086b, "quz_EC"},
+ {0x0C6b, "quz_PE"}
+};
+
+ILCID_POSIX_SUBTABLE(quc) {
+ {0x93, "quc"},
+ {0x0493, "quc_CO"},
+ /*
+ "quc_Latn_GT" is an exceptional case. Language ID of "quc"
+ is 0x93, but LCID of "quc_Latn_GT" is 0x486, which should be
+ under the group of "qut". "qut" is a retired ISO 639-3 language
+ code for West Central Quiche, and merged to "quc".
+ It looks Windows previously reserved "qut" for K'iche', but,
+ decided to use "quc" when adding a locale for K'iche' (Guatemala).
+
+ This data structure used here assumes language ID bits in
+ LCID is unique for alphabetic language code. But this is not true
+ for "quc_Latn_GT". If we don't have the data below, LCID look up
+ by alphabetic locale ID (POSIX) will fail. The same entry is found
+ under "qut" below, which is required for reverse look up.
+ */
+ {0x0486, "quc_Latn_GT"}
+};
+
+ILCID_POSIX_SUBTABLE(qut) {
+ {0x86, "qut"},
+ {0x0486, "qut_GT"},
+ /*
+ See the note in "quc" above.
+ */
+ {0x0486, "quc_Latn_GT"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0417, rm, rm_CH)
+
+ILCID_POSIX_SUBTABLE(ro) {
+ {0x18, "ro"},
+ {0x0418, "ro_RO"},
+ {0x0818, "ro_MD"}
+};
+
+// TODO: This is almost certainly 'wrong'. 0 in Windows is a synonym for LOCALE_USER_DEFAULT.
+// More likely this is a similar concept to the Windows 0x7f Invariant locale ""
+// (Except that it's not invariant in ICU)
+ILCID_POSIX_SUBTABLE(root) {
+ {0x00, "root"}
+};
+
+ILCID_POSIX_SUBTABLE(ru) {
+ {0x19, "ru"},
+ {0x0419, "ru_RU"},
+ {0x0819, "ru_MD"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0487, rw, rw_RW)
+ILCID_POSIX_ELEMENT_ARRAY(0x044f, sa, sa_IN)
+ILCID_POSIX_ELEMENT_ARRAY(0x0485, sah,sah_RU)
+
+ILCID_POSIX_SUBTABLE(sd) {
+ {0x59, "sd"},
+ {0x0459, "sd_Deva_IN"},
+ {0x0459, "sd_IN"},
+ {0x0859, "sd_Arab_PK"},
+ {0x0859, "sd_PK"},
+ {0x7c59, "sd_Arab"}
+};
+
+ILCID_POSIX_SUBTABLE(se) {
+ {0x3b, "se"},
+ {0x0c3b, "se_FI"},
+ {0x043b, "se_NO"},
+ {0x083b, "se_SE"},
+ {0x783b, "sma"},
+ {0x183b, "sma_NO"},
+ {0x1c3b, "sma_SE"},
+ {0x7c3b, "smj"},
+ {0x703b, "smn"},
+ {0x743b, "sms"},
+ {0x103b, "smj_NO"},
+ {0x143b, "smj_SE"},
+ {0x243b, "smn_FI"},
+ {0x203b, "sms_FI"},
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x045b, si, si_LK)
+ILCID_POSIX_ELEMENT_ARRAY(0x041b, sk, sk_SK)
+ILCID_POSIX_ELEMENT_ARRAY(0x0424, sl, sl_SI)
+
+ILCID_POSIX_SUBTABLE(so) {
+ {0x77, "so"},
+ {0x0477, "so_SO"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x041c, sq, sq_AL)
+ILCID_POSIX_ELEMENT_ARRAY(0x0430, st, st_ZA)
+
+ILCID_POSIX_SUBTABLE(sv) {
+ {0x1d, "sv"},
+ {0x081d, "sv_FI"},
+ {0x041d, "sv_SE"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0441, sw, sw_KE)
+ILCID_POSIX_ELEMENT_ARRAY(0x045A, syr, syr_SY)
+
+ILCID_POSIX_SUBTABLE(ta) {
+ {0x49, "ta"},
+ {0x0449, "ta_IN"},
+ {0x0849, "ta_LK"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x044a, te, te_IN)
+
+/* Cyrillic based by default */
+ILCID_POSIX_SUBTABLE(tg) {
+ {0x28, "tg"},
+ {0x7c28, "tg_Cyrl"},
+ {0x0428, "tg_Cyrl_TJ"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x041e, th, th_TH)
+
+ILCID_POSIX_SUBTABLE(ti) {
+ {0x73, "ti"},
+ {0x0873, "ti_ER"},
+ {0x0473, "ti_ET"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0442, tk, tk_TM)
+
+ILCID_POSIX_SUBTABLE(tn) {
+ {0x32, "tn"},
+ {0x0832, "tn_BW"},
+ {0x0432, "tn_ZA"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x041f, tr, tr_TR)
+ILCID_POSIX_ELEMENT_ARRAY(0x0431, ts, ts_ZA)
+ILCID_POSIX_ELEMENT_ARRAY(0x0444, tt, tt_RU)
+
+ILCID_POSIX_SUBTABLE(tzm) {
+ {0x5f, "tzm"},
+ {0x7c5f, "tzm_Latn"},
+ {0x085f, "tzm_Latn_DZ"},
+ {0x105f, "tzm_Tfng_MA"},
+ {0x045f, "tzm_Arab_MA"},
+ {0x045f, "tmz"}
+};
+
+ILCID_POSIX_SUBTABLE(ug) {
+ {0x80, "ug"},
+ {0x0480, "ug_CN"},
+ {0x0480, "ug_Arab_CN"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0422, uk, uk_UA)
+
+ILCID_POSIX_SUBTABLE(ur) {
+ {0x20, "ur"},
+ {0x0820, "ur_IN"},
+ {0x0420, "ur_PK"}
+};
+
+ILCID_POSIX_SUBTABLE(uz) {
+ {0x43, "uz"},
+ {0x0843, "uz_Cyrl_UZ"}, /* Cyrillic based */
+ {0x7843, "uz_Cyrl"}, /* Cyrillic based */
+ {0x0843, "uz_UZ"}, /* Cyrillic based */
+ {0x0443, "uz_Latn_UZ"}, /* Latin based */
+ {0x7c43, "uz_Latn"} /* Latin based */
+};
+
+ILCID_POSIX_SUBTABLE(ve) { /* TODO: Verify the country */
+ {0x33, "ve"},
+ {0x0433, "ve_ZA"},
+ {0x0433, "ven_ZA"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x042a, vi, vi_VN)
+ILCID_POSIX_ELEMENT_ARRAY(0x0488, wo, wo_SN)
+ILCID_POSIX_ELEMENT_ARRAY(0x0434, xh, xh_ZA)
+
+ILCID_POSIX_SUBTABLE(yi) {
+ {0x003d, "yi"},
+ {0x043d, "yi_001"}
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x046a, yo, yo_NG)
+
+// Windows & ICU tend to different names for some of these
+// TODO: Windows probably does not need all of these entries, but I don't know how the precedence works.
+ILCID_POSIX_SUBTABLE(zh) {
+ {0x0004, "zh_Hans"},
+ {0x7804, "zh"},
+ {0x0804, "zh_CN"},
+ {0x0804, "zh_Hans_CN"},
+ {0x0c04, "zh_Hant_HK"},
+ {0x0c04, "zh_HK"},
+ {0x1404, "zh_Hant_MO"},
+ {0x1404, "zh_MO"},
+ {0x1004, "zh_Hans_SG"},
+ {0x1004, "zh_SG"},
+ {0x0404, "zh_Hant_TW"},
+ {0x7c04, "zh_Hant"},
+ {0x0404, "zh_TW"},
+ {0x30404,"zh_Hant_TW"}, /* Bopomofo order */
+ {0x30404,"zh_TW"}, /* Bopomofo order */
+ {0x20004,"zh@collation=stroke"},
+ {0x20404,"zh_Hant@collation=stroke"},
+ {0x20404,"zh_Hant_TW@collation=stroke"},
+ {0x20404,"zh_TW@collation=stroke"},
+ {0x20804,"zh_Hans@collation=stroke"},
+ {0x20804,"zh_Hans_CN@collation=stroke"},
+ {0x20804,"zh_CN@collation=stroke"}
+ // TODO: Alternate collations for other LCIDs are missing, eg: 0x50804
+};
+
+ILCID_POSIX_ELEMENT_ARRAY(0x0435, zu, zu_ZA)
+
+/* This must be static and grouped by LCID. */
+static const ILcidPosixMap gPosixIDmap[] = {
+ ILCID_POSIX_MAP(af), /* af Afrikaans 0x36 */
+ ILCID_POSIX_MAP(am), /* am Amharic 0x5e */
+ ILCID_POSIX_MAP(ar), /* ar Arabic 0x01 */
+ ILCID_POSIX_MAP(arn), /* arn Araucanian/Mapudungun 0x7a */
+ ILCID_POSIX_MAP(as), /* as Assamese 0x4d */
+ ILCID_POSIX_MAP(az), /* az Azerbaijani 0x2c */
+ ILCID_POSIX_MAP(ba), /* ba Bashkir 0x6d */
+ ILCID_POSIX_MAP(be), /* be Belarusian 0x23 */
+/* ILCID_POSIX_MAP(ber), ber Berber/Tamazight 0x5f */
+ ILCID_POSIX_MAP(bg), /* bg Bulgarian 0x02 */
+ ILCID_POSIX_MAP(bin), /* bin Edo 0x66 */
+ ILCID_POSIX_MAP(bn), /* bn Bengali; Bangla 0x45 */
+ ILCID_POSIX_MAP(bo), /* bo Tibetan 0x51 */
+ ILCID_POSIX_MAP(br), /* br Breton 0x7e */
+ ILCID_POSIX_MAP(ca), /* ca Catalan 0x03 */
+ ILCID_POSIX_MAP(chr), /* chr Cherokee 0x5c */
+ ILCID_POSIX_MAP(ckb), /* ckb Sorani (Central Kurdish) 0x92 */
+ ILCID_POSIX_MAP(co), /* co Corsican 0x83 */
+ ILCID_POSIX_MAP(cs), /* cs Czech 0x05 */
+ ILCID_POSIX_MAP(cy), /* cy Welsh 0x52 */
+ ILCID_POSIX_MAP(da), /* da Danish 0x06 */
+ ILCID_POSIX_MAP(de), /* de German 0x07 */
+ ILCID_POSIX_MAP(dv), /* dv Divehi 0x65 */
+ ILCID_POSIX_MAP(el), /* el Greek 0x08 */
+ ILCID_POSIX_MAP(en), /* en English 0x09 */
+ ILCID_POSIX_MAP(en_US_POSIX), /* invariant 0x7f */
+ ILCID_POSIX_MAP(es), /* es Spanish 0x0a */
+ ILCID_POSIX_MAP(et), /* et Estonian 0x25 */
+ ILCID_POSIX_MAP(eu), /* eu Basque 0x2d */
+ ILCID_POSIX_MAP(fa), /* fa Persian/Farsi 0x29 */
+ ILCID_POSIX_MAP(fa_AF), /* fa Persian/Dari 0x8c */
+ ILCID_POSIX_MAP(ff), /* ff Fula 0x67 */
+ ILCID_POSIX_MAP(fi), /* fi Finnish 0x0b */
+ ILCID_POSIX_MAP(fil), /* fil Filipino 0x64 */
+ ILCID_POSIX_MAP(fo), /* fo Faroese 0x38 */
+ ILCID_POSIX_MAP(fr), /* fr French 0x0c */
+ ILCID_POSIX_MAP(fuv), /* fuv Fulfulde - Nigeria 0x67 */
+ ILCID_POSIX_MAP(fy), /* fy Frisian 0x62 */
+ ILCID_POSIX_MAP(ga), /* * Gaelic (Ireland,Scotland) 0x3c */
+ ILCID_POSIX_MAP(gd), /* gd Gaelic (United Kingdom) 0x91 */
+ ILCID_POSIX_MAP(gl), /* gl Galician 0x56 */
+ ILCID_POSIX_MAP(gn), /* gn Guarani 0x74 */
+ ILCID_POSIX_MAP(gsw), /* gsw Alemanic/Alsatian/Swiss German 0x84 */
+ ILCID_POSIX_MAP(gu), /* gu Gujarati 0x47 */
+ ILCID_POSIX_MAP(ha), /* ha Hausa 0x68 */
+ ILCID_POSIX_MAP(haw), /* haw Hawaiian 0x75 */
+ ILCID_POSIX_MAP(he), /* he Hebrew (formerly iw) 0x0d */
+ ILCID_POSIX_MAP(hi), /* hi Hindi 0x39 */
+ ILCID_POSIX_MAP(hr), /* * Croatian and others 0x1a */
+ ILCID_POSIX_MAP(hsb), /* hsb Upper Sorbian 0x2e */
+ ILCID_POSIX_MAP(hu), /* hu Hungarian 0x0e */
+ ILCID_POSIX_MAP(hy), /* hy Armenian 0x2b */
+ ILCID_POSIX_MAP(ibb), /* ibb Ibibio - Nigeria 0x69 */
+ ILCID_POSIX_MAP(id), /* id Indonesian (formerly in) 0x21 */
+ ILCID_POSIX_MAP(ig), /* ig Igbo 0x70 */
+ ILCID_POSIX_MAP(ii), /* ii Sichuan Yi 0x78 */
+ ILCID_POSIX_MAP(is), /* is Icelandic 0x0f */
+ ILCID_POSIX_MAP(it), /* it Italian 0x10 */
+ ILCID_POSIX_MAP(iu), /* iu Inuktitut 0x5d */
+ ILCID_POSIX_MAP(iw), /* iw Hebrew 0x0d */
+ ILCID_POSIX_MAP(ja), /* ja Japanese 0x11 */
+ ILCID_POSIX_MAP(ka), /* ka Georgian 0x37 */
+ ILCID_POSIX_MAP(kk), /* kk Kazakh 0x3f */
+ ILCID_POSIX_MAP(kl), /* kl Kalaallisut 0x6f */
+ ILCID_POSIX_MAP(km), /* km Khmer 0x53 */
+ ILCID_POSIX_MAP(kn), /* kn Kannada 0x4b */
+ ILCID_POSIX_MAP(ko), /* ko Korean 0x12 */
+ ILCID_POSIX_MAP(kok), /* kok Konkani 0x57 */
+ ILCID_POSIX_MAP(kr), /* kr Kanuri 0x71 */
+ ILCID_POSIX_MAP(ks), /* ks Kashmiri 0x60 */
+ ILCID_POSIX_MAP(ky), /* ky Kyrgyz 0x40 */
+ ILCID_POSIX_MAP(lb), /* lb Luxembourgish 0x6e */
+ ILCID_POSIX_MAP(la), /* la Latin 0x76 */
+ ILCID_POSIX_MAP(lo), /* lo Lao 0x54 */
+ ILCID_POSIX_MAP(lt), /* lt Lithuanian 0x27 */
+ ILCID_POSIX_MAP(lv), /* lv Latvian, Lettish 0x26 */
+ ILCID_POSIX_MAP(mi), /* mi Maori 0x81 */
+ ILCID_POSIX_MAP(mk), /* mk Macedonian 0x2f */
+ ILCID_POSIX_MAP(ml), /* ml Malayalam 0x4c */
+ ILCID_POSIX_MAP(mn), /* mn Mongolian 0x50 */
+ ILCID_POSIX_MAP(mni), /* mni Manipuri 0x58 */
+ ILCID_POSIX_MAP(moh), /* moh Mohawk 0x7c */
+ ILCID_POSIX_MAP(mr), /* mr Marathi 0x4e */
+ ILCID_POSIX_MAP(ms), /* ms Malay 0x3e */
+ ILCID_POSIX_MAP(mt), /* mt Maltese 0x3a */
+ ILCID_POSIX_MAP(my), /* my Burmese 0x55 */
+/* ILCID_POSIX_MAP(nb), // no Norwegian 0x14 */
+ ILCID_POSIX_MAP(ne), /* ne Nepali 0x61 */
+ ILCID_POSIX_MAP(nl), /* nl Dutch 0x13 */
+/* ILCID_POSIX_MAP(nn), // no Norwegian 0x14 */
+ ILCID_POSIX_MAP(no), /* * Norwegian 0x14 */
+ ILCID_POSIX_MAP(nso), /* nso Sotho, Northern (Sepedi dialect) 0x6c */
+ ILCID_POSIX_MAP(oc), /* oc Occitan 0x82 */
+ ILCID_POSIX_MAP(om), /* om Oromo 0x72 */
+ ILCID_POSIX_MAP(or_IN), /* or Oriya 0x48 */
+ ILCID_POSIX_MAP(pa), /* pa Punjabi 0x46 */
+ ILCID_POSIX_MAP(pap), /* pap Papiamentu 0x79 */
+ ILCID_POSIX_MAP(pl), /* pl Polish 0x15 */
+ ILCID_POSIX_MAP(ps), /* ps Pashto 0x63 */
+ ILCID_POSIX_MAP(pt), /* pt Portuguese 0x16 */
+ ILCID_POSIX_MAP(qu), /* qu Quechua 0x6B */
+ ILCID_POSIX_MAP(quc), /* quc K'iche 0x93 */
+ ILCID_POSIX_MAP(qut), /* qut K'iche 0x86 */
+ ILCID_POSIX_MAP(rm), /* rm Raeto-Romance/Romansh 0x17 */
+ ILCID_POSIX_MAP(ro), /* ro Romanian 0x18 */
+ ILCID_POSIX_MAP(root), /* root 0x00 */
+ ILCID_POSIX_MAP(ru), /* ru Russian 0x19 */
+ ILCID_POSIX_MAP(rw), /* rw Kinyarwanda 0x87 */
+ ILCID_POSIX_MAP(sa), /* sa Sanskrit 0x4f */
+ ILCID_POSIX_MAP(sah), /* sah Yakut 0x85 */
+ ILCID_POSIX_MAP(sd), /* sd Sindhi 0x59 */
+ ILCID_POSIX_MAP(se), /* se Sami 0x3b */
+/* ILCID_POSIX_MAP(sh), // sh Serbo-Croatian 0x1a */
+ ILCID_POSIX_MAP(si), /* si Sinhalese 0x5b */
+ ILCID_POSIX_MAP(sk), /* sk Slovak 0x1b */
+ ILCID_POSIX_MAP(sl), /* sl Slovenian 0x24 */
+ ILCID_POSIX_MAP(so), /* so Somali 0x77 */
+ ILCID_POSIX_MAP(sq), /* sq Albanian 0x1c */
+/* ILCID_POSIX_MAP(sr), // sr Serbian 0x1a */
+ ILCID_POSIX_MAP(st), /* st Sutu 0x30 */
+ ILCID_POSIX_MAP(sv), /* sv Swedish 0x1d */
+ ILCID_POSIX_MAP(sw), /* sw Swahili 0x41 */
+ ILCID_POSIX_MAP(syr), /* syr Syriac 0x5A */
+ ILCID_POSIX_MAP(ta), /* ta Tamil 0x49 */
+ ILCID_POSIX_MAP(te), /* te Telugu 0x4a */
+ ILCID_POSIX_MAP(tg), /* tg Tajik 0x28 */
+ ILCID_POSIX_MAP(th), /* th Thai 0x1e */
+ ILCID_POSIX_MAP(ti), /* ti Tigrigna 0x73 */
+ ILCID_POSIX_MAP(tk), /* tk Turkmen 0x42 */
+ ILCID_POSIX_MAP(tn), /* tn Tswana 0x32 */
+ ILCID_POSIX_MAP(tr), /* tr Turkish 0x1f */
+ ILCID_POSIX_MAP(ts), /* ts Tsonga 0x31 */
+ ILCID_POSIX_MAP(tt), /* tt Tatar 0x44 */
+ ILCID_POSIX_MAP(tzm), /* tzm Tamazight 0x5f */
+ ILCID_POSIX_MAP(ug), /* ug Uighur 0x80 */
+ ILCID_POSIX_MAP(uk), /* uk Ukrainian 0x22 */
+ ILCID_POSIX_MAP(ur), /* ur Urdu 0x20 */
+ ILCID_POSIX_MAP(uz), /* uz Uzbek 0x43 */
+ ILCID_POSIX_MAP(ve), /* ve Venda 0x33 */
+ ILCID_POSIX_MAP(vi), /* vi Vietnamese 0x2a */
+ ILCID_POSIX_MAP(wo), /* wo Wolof 0x88 */
+ ILCID_POSIX_MAP(xh), /* xh Xhosa 0x34 */
+ ILCID_POSIX_MAP(yi), /* yi Yiddish 0x3d */
+ ILCID_POSIX_MAP(yo), /* yo Yoruba 0x6a */
+ ILCID_POSIX_MAP(zh), /* zh Chinese 0x04 */
+ ILCID_POSIX_MAP(zu), /* zu Zulu 0x35 */
+};
+
+static const uint32_t gLocaleCount = UPRV_LENGTHOF(gPosixIDmap);
+
+/**
+ * Do not call this function. It is called by hostID.
+ * The function is not private because this struct must stay as a C struct,
+ * and this is an internal class.
+ */
+static int32_t
+idCmp(const char* id1, const char* id2)
+{
+ int32_t diffIdx = 0;
+ while (*id1 == *id2 && *id1 != 0) {
+ diffIdx++;
+ id1++;
+ id2++;
+ }
+ return diffIdx;
+}
+
+/**
+ * Searches for a Windows LCID
+ *
+ * @param posixID the Posix style locale id.
+ * @param status gets set to U_ILLEGAL_ARGUMENT_ERROR when the Posix ID has
+ * no equivalent Windows LCID.
+ * @return the LCID
+ */
+static uint32_t
+getHostID(const ILcidPosixMap *this_0, const char* posixID, UErrorCode* status)
+{
+ int32_t bestIdx = 0;
+ int32_t bestIdxDiff = 0;
+ int32_t posixIDlen = (int32_t)uprv_strlen(posixID);
+ uint32_t idx;
+
+ for (idx = 0; idx < this_0->numRegions; idx++ ) {
+ int32_t sameChars = idCmp(posixID, this_0->regionMaps[idx].posixID);
+ if (sameChars > bestIdxDiff && this_0->regionMaps[idx].posixID[sameChars] == 0) {
+ if (posixIDlen == sameChars) {
+ /* Exact match */
+ return this_0->regionMaps[idx].hostID;
+ }
+ bestIdxDiff = sameChars;
+ bestIdx = idx;
+ }
+ }
+ /* We asked for something unusual, like en_ZZ, and we try to return the number for the same language. */
+ /* We also have to make sure that sid and si and similar string subsets don't match. */
+ if ((posixID[bestIdxDiff] == '_' || posixID[bestIdxDiff] == '@')
+ && this_0->regionMaps[bestIdx].posixID[bestIdxDiff] == 0)
+ {
+ *status = U_USING_FALLBACK_WARNING;
+ return this_0->regionMaps[bestIdx].hostID;
+ }
+
+ /*no match found */
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return this_0->regionMaps->hostID;
+}
+
+static const char*
+getPosixID(const ILcidPosixMap *this_0, uint32_t hostID)
+{
+ uint32_t i;
+ for (i = 0; i < this_0->numRegions; i++)
+ {
+ if (this_0->regionMaps[i].hostID == hostID)
+ {
+ return this_0->regionMaps[i].posixID;
+ }
+ }
+
+ /* If you get here, then no matching region was found,
+ so return the language id with the wild card region. */
+ return this_0->regionMaps[0].posixID;
+}
+
+/*
+//////////////////////////////////////
+//
+// LCID --> POSIX
+//
+/////////////////////////////////////
+*/
+#if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API
+/*
+ * Various language tags needs to be changed:
+ * quz -> qu
+ * prs -> fa
+ */
+#define FIX_LANGUAGE_ID_TAG(buffer, len) \
+ if (len >= 3) { \
+ if (buffer[0] == 'q' && buffer[1] == 'u' && buffer[2] == 'z') {\
+ buffer[2] = 0; \
+ uprv_strcat(buffer, buffer+3); \
+ } else if (buffer[0] == 'p' && buffer[1] == 'r' && buffer[2] == 's') {\
+ buffer[0] = 'f'; buffer[1] = 'a'; buffer[2] = 0; \
+ uprv_strcat(buffer, buffer+3); \
+ } \
+ }
+
+#endif
+
+U_CAPI int32_t
+uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UErrorCode* status)
+{
+ uint16_t langID;
+ uint32_t localeIndex;
+ UBool bLookup = TRUE;
+ const char *pPosixID = NULL;
+
+#if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API
+ static_assert(ULOC_FULLNAME_CAPACITY > LOCALE_NAME_MAX_LENGTH, "Windows locale names have smaller length than ICU locale names.");
+
+ char locName[LOCALE_NAME_MAX_LENGTH] = {};
+
+ // Note: Windows primary lang ID 0x92 in LCID is used for Central Kurdish and
+ // GetLocaleInfo() maps such LCID to "ku". However, CLDR uses "ku" for
+ // Northern Kurdish and "ckb" for Central Kurdish. For this reason, we cannot
+ // use the Windows API to resolve locale ID for this specific case.
+ if ((hostid & 0x3FF) != 0x92) {
+ int32_t tmpLen = 0;
+ char16_t windowsLocaleName[LOCALE_NAME_MAX_LENGTH] = {};
+
+ // Note: LOCALE_ALLOW_NEUTRAL_NAMES was enabled in Windows7+, prior versions did not handle neutral (no-region) locale names.
+ tmpLen = LCIDToLocaleName(hostid, (PWSTR)windowsLocaleName, UPRV_LENGTHOF(windowsLocaleName), LOCALE_ALLOW_NEUTRAL_NAMES);
+ if (tmpLen > 1) {
+ int32_t i = 0;
+ // Only need to look up in table if have _, eg for de-de_phoneb type alternate sort.
+ bLookup = FALSE;
+ for (i = 0; i < UPRV_LENGTHOF(locName); i++)
+ {
+ locName[i] = (char)(windowsLocaleName[i]);
+
+ // Windows locale name may contain sorting variant, such as "es-ES_tradnl".
+ // In such cases, we need special mapping data found in the hardcoded table
+ // in this source file.
+ if (windowsLocaleName[i] == L'_')
+ {
+ // Keep the base locale, without variant
+ // TODO: Should these be mapped from _phoneb to @collation=phonebook, etc.?
+ locName[i] = '\0';
+ tmpLen = i;
+ bLookup = TRUE;
+ break;
+ }
+ else if (windowsLocaleName[i] == L'-')
+ {
+ // Windows names use -, ICU uses _
+ locName[i] = '_';
+ }
+ else if (windowsLocaleName[i] == L'\0')
+ {
+ // No point in doing more work than necessary
+ break;
+ }
+ }
+ // TODO: Need to understand this better, why isn't it an alias?
+ FIX_LANGUAGE_ID_TAG(locName, tmpLen);
+ pPosixID = locName;
+ }
+ }
+#endif
+
+ if (bLookup) {
+ const char *pCandidate = NULL;
+ langID = LANGUAGE_LCID(hostid);
+
+ for (localeIndex = 0; localeIndex < gLocaleCount; localeIndex++) {
+ if (langID == gPosixIDmap[localeIndex].regionMaps->hostID) {
+ pCandidate = getPosixID(&gPosixIDmap[localeIndex], hostid);
+ break;
+ }
+ }
+
+ /* On Windows, when locale name has a variant, we still look up the hardcoded table.
+ If a match in the hardcoded table is longer than the Windows locale name without
+ variant, we use the one as the result */
+ if (pCandidate && (pPosixID == NULL || uprv_strlen(pCandidate) > uprv_strlen(pPosixID))) {
+ pPosixID = pCandidate;
+ }
+ }
+
+ if (pPosixID) {
+ int32_t resLen = static_cast<int32_t>(uprv_strlen(pPosixID));
+ int32_t copyLen = resLen <= posixIDCapacity ? resLen : posixIDCapacity;
+ uprv_memcpy(posixID, pPosixID, copyLen);
+ if (resLen < posixIDCapacity) {
+ posixID[resLen] = 0;
+ if (*status == U_STRING_NOT_TERMINATED_WARNING) {
+ *status = U_ZERO_ERROR;
+ }
+ } else if (resLen == posixIDCapacity) {
+ *status = U_STRING_NOT_TERMINATED_WARNING;
+ } else {
+ *status = U_BUFFER_OVERFLOW_ERROR;
+ }
+ return resLen;
+ }
+
+ /* no match found */
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return -1;
+}
+
+/*
+//////////////////////////////////////
+//
+// POSIX --> LCID
+// This should only be called from uloc_getLCID.
+// The locale ID must be in canonical form.
+//
+/////////////////////////////////////
+*/
+U_CAPI uint32_t
+uprv_convertToLCIDPlatform(const char* localeID, UErrorCode* status)
+{
+ if (U_FAILURE(*status)) {
+ return 0;
+ }
+
+ // The purpose of this function is to leverage the Windows platform name->lcid
+ // 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)
+ {
+ // If it contains the keyword collation, return 0 so that the LCID lookup table will be used.
+ return 0;
+ }
+ else
+ {
+ // If the locale ID contains keywords other than collation, just use the base name.
+ len = uloc_getBaseName(localeID, baseName, UPRV_LENGTHOF(baseName) - 1, status);
+
+ if (U_SUCCESS(*status) && len > 0)
+ {
+ baseName[len] = 0;
+ mylocaleID = baseName;
+ }
+ }
+ }
+
+ char asciiBCP47Tag[LOCALE_NAME_MAX_LENGTH] = {};
+ // this will change it from de_DE@collation=phonebook to de-DE-u-co-phonebk form
+ (void)uloc_toLanguageTag(mylocaleID, asciiBCP47Tag, UPRV_LENGTHOF(asciiBCP47Tag), FALSE, status);
+
+ if (U_SUCCESS(*status))
+ {
+ // Need it to be UTF-16, not 8-bit
+ wchar_t bcp47Tag[LOCALE_NAME_MAX_LENGTH] = {};
+ int32_t i;
+ for (i = 0; i < UPRV_LENGTHOF(bcp47Tag); i++)
+ {
+ if (asciiBCP47Tag[i] == '\0')
+ {
+ break;
+ }
+ else
+ {
+ // Copy the character
+ bcp47Tag[i] = static_cast<wchar_t>(asciiBCP47Tag[i]);
+ }
+ }
+
+ if (i < (UPRV_LENGTHOF(bcp47Tag) - 1))
+ {
+ // Ensure it's null terminated
+ bcp47Tag[i] = L'\0';
+ LCID lcid = LocaleNameToLCID(bcp47Tag, LOCALE_ALLOW_NEUTRAL_NAMES);
+ if (lcid > 0)
+ {
+ // Found LCID from windows, return that one, unless its completely ambiguous
+ // LOCALE_USER_DEFAULT and transients are OK because they will round trip
+ // for this process.
+ if (lcid != LOCALE_CUSTOM_UNSPECIFIED)
+ {
+ return lcid;
+ }
+ }
+ }
+ }
+#else
+ (void) localeID; // Suppress unused variable warning.
+#endif
+
+ // Nothing found, or not implemented.
+ return 0;
+}
+
+U_CAPI uint32_t
+uprv_convertToLCID(const char *langID, const char* posixID, UErrorCode* status)
+{
+ // This function does the table lookup when native platform name->lcid conversion isn't available,
+ // or for locales that don't follow patterns the platform expects.
+ uint32_t low = 0;
+ uint32_t high = gLocaleCount;
+ uint32_t mid;
+ uint32_t oldmid = 0;
+ int32_t compVal;
+
+ uint32_t value = 0;
+ uint32_t fallbackValue = (uint32_t)-1;
+ UErrorCode myStatus;
+ uint32_t idx;
+
+ /* Check for incomplete id. */
+ if (!langID || !posixID || uprv_strlen(langID) < 2 || uprv_strlen(posixID) < 2) {
+ return 0;
+ }
+
+ /*Binary search for the map entry for normal cases */
+
+ while (high > low) /*binary search*/{
+
+ mid = (high+low) >> 1; /*Finds median*/
+
+ if (mid == oldmid)
+ break;
+
+ compVal = uprv_strcmp(langID, gPosixIDmap[mid].regionMaps->posixID);
+ if (compVal < 0){
+ high = mid;
+ }
+ else if (compVal > 0){
+ low = mid;
+ }
+ else /*we found it*/{
+ return getHostID(&gPosixIDmap[mid], posixID, status);
+ }
+ oldmid = mid;
+ }
+
+ /*
+ * Sometimes we can't do a binary search on posixID because some LCIDs
+ * go to different locales. We hit one of those special cases.
+ */
+ for (idx = 0; idx < gLocaleCount; idx++ ) {
+ myStatus = U_ZERO_ERROR;
+ value = getHostID(&gPosixIDmap[idx], posixID, &myStatus);
+ if (myStatus == U_ZERO_ERROR) {
+ return value;
+ }
+ else if (myStatus == U_USING_FALLBACK_WARNING) {
+ fallbackValue = value;
+ }
+ }
+
+ if (fallbackValue != (uint32_t)-1) {
+ *status = U_USING_FALLBACK_WARNING;
+ return fallbackValue;
+ }
+
+ /* no match found */
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0; /* return international (root) */
+}
diff --git a/contrib/libs/icu/common/locmap.h b/contrib/libs/icu/common/locmap.h
index 64e9ec039f..e669873a14 100644
--- a/contrib/libs/icu/common/locmap.h
+++ b/contrib/libs/icu/common/locmap.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -32,9 +32,9 @@
U_CAPI int32_t uprv_convertToPosix(uint32_t hostid, char* posixID, int32_t posixIDCapacity, UErrorCode* status);
-/* Don't call these functions directly. Use uloc_getLCID instead. */
-U_CAPI uint32_t uprv_convertToLCIDPlatform(const char* localeID, UErrorCode* status); // Leverage platform conversion if possible
-U_CAPI uint32_t uprv_convertToLCID(const char* langID, const char* posixID, UErrorCode* status);
+/* Don't call these functions directly. Use uloc_getLCID instead. */
+U_CAPI uint32_t uprv_convertToLCIDPlatform(const char* localeID, UErrorCode* status); // Leverage platform conversion if possible
+U_CAPI uint32_t uprv_convertToLCID(const char* langID, const char* posixID, UErrorCode* status);
#endif /* LOCMAP_H */
diff --git a/contrib/libs/icu/common/locresdata.cpp b/contrib/libs/icu/common/locresdata.cpp
index d35b036814..d1d9a4729f 100644
--- a/contrib/libs/icu/common/locresdata.cpp
+++ b/contrib/libs/icu/common/locresdata.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: loclikely.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -58,7 +58,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
* this falls back through the locale's chain to root
*/
errorCode=U_ZERO_ERROR;
- icu::LocalUResourceBundlePointer rb(ures_open(path, locale, &errorCode));
+ icu::LocalUResourceBundlePointer rb(ures_open(path, locale, &errorCode));
if(U_FAILURE(errorCode)) {
/* total failure, not even root could be opened */
@@ -72,24 +72,24 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
}
for(;;){
- icu::StackUResourceBundle table;
- icu::StackUResourceBundle subTable;
- ures_getByKeyWithFallback(rb.getAlias(), tableKey, table.getAlias(), &errorCode);
+ icu::StackUResourceBundle table;
+ icu::StackUResourceBundle subTable;
+ ures_getByKeyWithFallback(rb.getAlias(), tableKey, table.getAlias(), &errorCode);
if (subTableKey != NULL) {
/*
- ures_getByKeyWithFallback(table.getAlias(), subTableKey, subTable.getAlias(), &errorCode);
- item = ures_getStringByKeyWithFallback(subTable.getAlias(), itemKey, pLength, &errorCode);
+ ures_getByKeyWithFallback(table.getAlias(), subTableKey, subTable.getAlias(), &errorCode);
+ item = ures_getStringByKeyWithFallback(subTable.getAlias(), itemKey, pLength, &errorCode);
if(U_FAILURE(errorCode)){
*pErrorCode = errorCode;
}
break;*/
- ures_getByKeyWithFallback(table.getAlias(), subTableKey, table.getAlias(), &errorCode);
+ ures_getByKeyWithFallback(table.getAlias(), subTableKey, table.getAlias(), &errorCode);
}
if(U_SUCCESS(errorCode)){
- item = ures_getStringByKeyWithFallback(table.getAlias(), itemKey, pLength, &errorCode);
+ item = ures_getStringByKeyWithFallback(table.getAlias(), itemKey, pLength, &errorCode);
if(U_FAILURE(errorCode)){
const char* replacement = NULL;
*pErrorCode = errorCode; /*save the errorCode*/
@@ -102,7 +102,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
}
/*pointer comparison is ok since uloc_getCurrentCountryID & uloc_getCurrentLanguageID return the key itself is replacement is not found*/
if(replacement!=NULL && itemKey != replacement){
- item = ures_getStringByKeyWithFallback(table.getAlias(), replacement, pLength, &errorCode);
+ item = ures_getStringByKeyWithFallback(table.getAlias(), replacement, pLength, &errorCode);
if(U_SUCCESS(errorCode)){
*pErrorCode = errorCode;
break;
@@ -121,7 +121,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
*pErrorCode = errorCode;
errorCode = U_ZERO_ERROR;
- fallbackLocale = ures_getStringByKeyWithFallback(table.getAlias(), "Fallback", &len, &errorCode);
+ fallbackLocale = ures_getStringByKeyWithFallback(table.getAlias(), "Fallback", &len, &errorCode);
if(U_FAILURE(errorCode)){
*pErrorCode = errorCode;
break;
@@ -134,7 +134,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
*pErrorCode = U_INTERNAL_PROGRAM_ERROR;
break;
}
- rb.adoptInstead(ures_open(path, explicitFallbackName, &errorCode));
+ rb.adoptInstead(ures_open(path, explicitFallbackName, &errorCode));
if(U_FAILURE(errorCode)){
*pErrorCode = errorCode;
break;
@@ -144,7 +144,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
break;
}
}
-
+
return item;
}
diff --git a/contrib/libs/icu/common/locutil.cpp b/contrib/libs/icu/common/locutil.cpp
index fd64a132ae..3d9d69ff7e 100644
--- a/contrib/libs/icu/common/locutil.cpp
+++ b/contrib/libs/icu/common/locutil.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -11,7 +11,7 @@
#if !UCONFIG_NO_SERVICE || !UCONFIG_NO_TRANSLITERATION
#include "unicode/resbund.h"
-#include "unicode/uenum.h"
+#include "unicode/uenum.h"
#include "cmemory.h"
#include "ustrfmt.h"
#include "locutil.h"
@@ -230,9 +230,9 @@ LocaleUtility::getAvailableLocaleNames(const UnicodeString& bundleID)
CharString cbundleID;
cbundleID.appendInvariantChars(bundleID, status);
const char* path = cbundleID.isEmpty() ? NULL : cbundleID.data();
- icu::LocalUEnumerationPointer uenum(ures_openAvailableLocales(path, &status));
+ icu::LocalUEnumerationPointer uenum(ures_openAvailableLocales(path, &status));
for (;;) {
- const UChar* id = uenum_unext(uenum.getAlias(), NULL, &status);
+ const UChar* id = uenum_unext(uenum.getAlias(), NULL, &status);
if (id == NULL) {
break;
}
diff --git a/contrib/libs/icu/common/locutil.h b/contrib/libs/icu/common/locutil.h
index 68c7399a78..31bfffd7a5 100644
--- a/contrib/libs/icu/common/locutil.h
+++ b/contrib/libs/icu/common/locutil.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/**
*******************************************************************************
diff --git a/contrib/libs/icu/common/lsr.cpp b/contrib/libs/icu/common/lsr.cpp
index 43500edf40..d4308ad027 100644
--- a/contrib/libs/icu/common/lsr.cpp
+++ b/contrib/libs/icu/common/lsr.cpp
@@ -1,114 +1,114 @@
-// © 2019 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html#License
-
-// lsr.cpp
-// created: 2019may08 Markus W. Scherer
-
-#include "unicode/utypes.h"
-#include "charstr.h"
-#include "cmemory.h"
-#include "cstring.h"
-#include "lsr.h"
-#include "uinvchar.h"
-#include "ustr_imp.h"
-
-U_NAMESPACE_BEGIN
-
-LSR::LSR(char prefix, const char *lang, const char *scr, const char *r, int32_t f,
- UErrorCode &errorCode) :
- language(nullptr), script(nullptr), region(r),
- regionIndex(indexForRegion(region)), flags(f) {
- if (U_SUCCESS(errorCode)) {
- CharString langScript;
- langScript.append(prefix, errorCode).append(lang, errorCode).append('\0', errorCode);
- int32_t scriptOffset = langScript.length();
- langScript.append(prefix, errorCode).append(scr, errorCode);
- owned = langScript.cloneData(errorCode);
- if (U_SUCCESS(errorCode)) {
- language = owned;
- script = owned + scriptOffset;
- }
- }
-}
-
-LSR::LSR(LSR &&other) U_NOEXCEPT :
- language(other.language), script(other.script), region(other.region), owned(other.owned),
- regionIndex(other.regionIndex), flags(other.flags),
- hashCode(other.hashCode) {
- if (owned != nullptr) {
- other.language = other.script = "";
- other.owned = nullptr;
- other.hashCode = 0;
- }
-}
-
-void LSR::deleteOwned() {
- uprv_free(owned);
-}
-
-LSR &LSR::operator=(LSR &&other) U_NOEXCEPT {
- this->~LSR();
- language = other.language;
- script = other.script;
- region = other.region;
- regionIndex = other.regionIndex;
- flags = other.flags;
- owned = other.owned;
- hashCode = other.hashCode;
- if (owned != nullptr) {
- other.language = other.script = "";
- other.owned = nullptr;
- other.hashCode = 0;
- }
- return *this;
-}
-
-UBool LSR::isEquivalentTo(const LSR &other) const {
- return
- uprv_strcmp(language, other.language) == 0 &&
- uprv_strcmp(script, other.script) == 0 &&
- regionIndex == other.regionIndex &&
- // Compare regions if both are ill-formed (and their indexes are 0).
- (regionIndex > 0 || uprv_strcmp(region, other.region) == 0);
-}
-
-UBool LSR::operator==(const LSR &other) const {
- return
- uprv_strcmp(language, other.language) == 0 &&
- uprv_strcmp(script, other.script) == 0 &&
- regionIndex == other.regionIndex &&
- // Compare regions if both are ill-formed (and their indexes are 0).
- (regionIndex > 0 || uprv_strcmp(region, other.region) == 0) &&
- flags == other.flags;
-}
-
-int32_t LSR::indexForRegion(const char *region) {
- int32_t c = region[0];
- int32_t a = c - '0';
- if (0 <= a && a <= 9) { // digits: "419"
- int32_t b = region[1] - '0';
- if (b < 0 || 9 < b) { return 0; }
- c = region[2] - '0';
- if (c < 0 || 9 < c || region[3] != 0) { return 0; }
- return (10 * a + b) * 10 + c + 1;
- } else { // letters: "DE"
- a = uprv_upperOrdinal(c);
- if (a < 0 || 25 < a) { return 0; }
- int32_t b = uprv_upperOrdinal(region[1]);
- if (b < 0 || 25 < b || region[2] != 0) { return 0; }
- return 26 * a + b + 1001;
- }
- return 0;
-}
-
-LSR &LSR::setHashCode() {
- if (hashCode == 0) {
- uint32_t h = ustr_hashCharsN(language, static_cast<int32_t>(uprv_strlen(language)));
- h = h * 37 + ustr_hashCharsN(script, static_cast<int32_t>(uprv_strlen(script)));
- h = h * 37 + regionIndex;
- hashCode = h * 37 + flags;
- }
- return *this;
-}
-
-U_NAMESPACE_END
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// lsr.cpp
+// created: 2019may08 Markus W. Scherer
+
+#include "unicode/utypes.h"
+#include "charstr.h"
+#include "cmemory.h"
+#include "cstring.h"
+#include "lsr.h"
+#include "uinvchar.h"
+#include "ustr_imp.h"
+
+U_NAMESPACE_BEGIN
+
+LSR::LSR(char prefix, const char *lang, const char *scr, const char *r, int32_t f,
+ UErrorCode &errorCode) :
+ language(nullptr), script(nullptr), region(r),
+ regionIndex(indexForRegion(region)), flags(f) {
+ if (U_SUCCESS(errorCode)) {
+ CharString langScript;
+ langScript.append(prefix, errorCode).append(lang, errorCode).append('\0', errorCode);
+ int32_t scriptOffset = langScript.length();
+ langScript.append(prefix, errorCode).append(scr, errorCode);
+ owned = langScript.cloneData(errorCode);
+ if (U_SUCCESS(errorCode)) {
+ language = owned;
+ script = owned + scriptOffset;
+ }
+ }
+}
+
+LSR::LSR(LSR &&other) U_NOEXCEPT :
+ language(other.language), script(other.script), region(other.region), owned(other.owned),
+ regionIndex(other.regionIndex), flags(other.flags),
+ hashCode(other.hashCode) {
+ if (owned != nullptr) {
+ other.language = other.script = "";
+ other.owned = nullptr;
+ other.hashCode = 0;
+ }
+}
+
+void LSR::deleteOwned() {
+ uprv_free(owned);
+}
+
+LSR &LSR::operator=(LSR &&other) U_NOEXCEPT {
+ this->~LSR();
+ language = other.language;
+ script = other.script;
+ region = other.region;
+ regionIndex = other.regionIndex;
+ flags = other.flags;
+ owned = other.owned;
+ hashCode = other.hashCode;
+ if (owned != nullptr) {
+ other.language = other.script = "";
+ other.owned = nullptr;
+ other.hashCode = 0;
+ }
+ return *this;
+}
+
+UBool LSR::isEquivalentTo(const LSR &other) const {
+ return
+ uprv_strcmp(language, other.language) == 0 &&
+ uprv_strcmp(script, other.script) == 0 &&
+ regionIndex == other.regionIndex &&
+ // Compare regions if both are ill-formed (and their indexes are 0).
+ (regionIndex > 0 || uprv_strcmp(region, other.region) == 0);
+}
+
+UBool LSR::operator==(const LSR &other) const {
+ return
+ uprv_strcmp(language, other.language) == 0 &&
+ uprv_strcmp(script, other.script) == 0 &&
+ regionIndex == other.regionIndex &&
+ // Compare regions if both are ill-formed (and their indexes are 0).
+ (regionIndex > 0 || uprv_strcmp(region, other.region) == 0) &&
+ flags == other.flags;
+}
+
+int32_t LSR::indexForRegion(const char *region) {
+ int32_t c = region[0];
+ int32_t a = c - '0';
+ if (0 <= a && a <= 9) { // digits: "419"
+ int32_t b = region[1] - '0';
+ if (b < 0 || 9 < b) { return 0; }
+ c = region[2] - '0';
+ if (c < 0 || 9 < c || region[3] != 0) { return 0; }
+ return (10 * a + b) * 10 + c + 1;
+ } else { // letters: "DE"
+ a = uprv_upperOrdinal(c);
+ if (a < 0 || 25 < a) { return 0; }
+ int32_t b = uprv_upperOrdinal(region[1]);
+ if (b < 0 || 25 < b || region[2] != 0) { return 0; }
+ return 26 * a + b + 1001;
+ }
+ return 0;
+}
+
+LSR &LSR::setHashCode() {
+ if (hashCode == 0) {
+ uint32_t h = ustr_hashCharsN(language, static_cast<int32_t>(uprv_strlen(language)));
+ h = h * 37 + ustr_hashCharsN(script, static_cast<int32_t>(uprv_strlen(script)));
+ h = h * 37 + regionIndex;
+ hashCode = h * 37 + flags;
+ }
+ return *this;
+}
+
+U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/lsr.h b/contrib/libs/icu/common/lsr.h
index d2e7445a9a..d535e5b037 100644
--- a/contrib/libs/icu/common/lsr.h
+++ b/contrib/libs/icu/common/lsr.h
@@ -1,82 +1,82 @@
-// © 2019 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html#License
-
-// lsr.h
-// created: 2019may08 Markus W. Scherer
-
-#ifndef __LSR_H__
-#define __LSR_H__
-
-#include "unicode/utypes.h"
-#include "unicode/uobject.h"
-#include "cstring.h"
-
-U_NAMESPACE_BEGIN
-
-struct LSR final : public UMemory {
- static constexpr int32_t REGION_INDEX_LIMIT = 1001 + 26 * 26;
-
- static constexpr int32_t EXPLICIT_LSR = 7;
- static constexpr int32_t EXPLICIT_LANGUAGE = 4;
- static constexpr int32_t EXPLICIT_SCRIPT = 2;
- static constexpr int32_t EXPLICIT_REGION = 1;
- static constexpr int32_t IMPLICIT_LSR = 0;
- static constexpr int32_t DONT_CARE_FLAGS = 0;
-
- const char *language;
- const char *script;
- const char *region;
- char *owned = nullptr;
- /** Index for region, 0 if ill-formed. @see indexForRegion */
- int32_t regionIndex = 0;
- int32_t flags = 0;
- /** Only set for LSRs that will be used in a hash table. */
- int32_t hashCode = 0;
-
- LSR() : language("und"), script(""), region("") {}
-
- /** Constructor which aliases all subtag pointers. */
- LSR(const char *lang, const char *scr, const char *r, int32_t f) :
- language(lang), script(scr), region(r),
- regionIndex(indexForRegion(region)), flags(f) {}
- /**
- * Constructor which prepends the prefix to the language and script,
- * copies those into owned memory, and aliases the region.
- */
- LSR(char prefix, const char *lang, const char *scr, const char *r, int32_t f,
- UErrorCode &errorCode);
- LSR(LSR &&other) U_NOEXCEPT;
- LSR(const LSR &other) = delete;
- inline ~LSR() {
- // Pure inline code for almost all instances.
- if (owned != nullptr) {
- deleteOwned();
- }
- }
-
- LSR &operator=(LSR &&other) U_NOEXCEPT;
- LSR &operator=(const LSR &other) = delete;
-
- /**
- * Returns a positive index (>0) for a well-formed region code.
- * Do not rely on a particular region->index mapping; it may change.
- * Returns 0 for ill-formed strings.
- */
- static int32_t indexForRegion(const char *region);
-
- UBool isEquivalentTo(const LSR &other) const;
- UBool operator==(const LSR &other) const;
-
- inline UBool operator!=(const LSR &other) const {
- return !operator==(other);
- }
-
- LSR &setHashCode();
-
-private:
- void deleteOwned();
-};
-
-U_NAMESPACE_END
-
-#endif // __LSR_H__
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// lsr.h
+// created: 2019may08 Markus W. Scherer
+
+#ifndef __LSR_H__
+#define __LSR_H__
+
+#include "unicode/utypes.h"
+#include "unicode/uobject.h"
+#include "cstring.h"
+
+U_NAMESPACE_BEGIN
+
+struct LSR final : public UMemory {
+ static constexpr int32_t REGION_INDEX_LIMIT = 1001 + 26 * 26;
+
+ static constexpr int32_t EXPLICIT_LSR = 7;
+ static constexpr int32_t EXPLICIT_LANGUAGE = 4;
+ static constexpr int32_t EXPLICIT_SCRIPT = 2;
+ static constexpr int32_t EXPLICIT_REGION = 1;
+ static constexpr int32_t IMPLICIT_LSR = 0;
+ static constexpr int32_t DONT_CARE_FLAGS = 0;
+
+ const char *language;
+ const char *script;
+ const char *region;
+ char *owned = nullptr;
+ /** Index for region, 0 if ill-formed. @see indexForRegion */
+ int32_t regionIndex = 0;
+ int32_t flags = 0;
+ /** Only set for LSRs that will be used in a hash table. */
+ int32_t hashCode = 0;
+
+ LSR() : language("und"), script(""), region("") {}
+
+ /** Constructor which aliases all subtag pointers. */
+ LSR(const char *lang, const char *scr, const char *r, int32_t f) :
+ language(lang), script(scr), region(r),
+ regionIndex(indexForRegion(region)), flags(f) {}
+ /**
+ * Constructor which prepends the prefix to the language and script,
+ * copies those into owned memory, and aliases the region.
+ */
+ LSR(char prefix, const char *lang, const char *scr, const char *r, int32_t f,
+ UErrorCode &errorCode);
+ LSR(LSR &&other) U_NOEXCEPT;
+ LSR(const LSR &other) = delete;
+ inline ~LSR() {
+ // Pure inline code for almost all instances.
+ if (owned != nullptr) {
+ deleteOwned();
+ }
+ }
+
+ LSR &operator=(LSR &&other) U_NOEXCEPT;
+ LSR &operator=(const LSR &other) = delete;
+
+ /**
+ * Returns a positive index (>0) for a well-formed region code.
+ * Do not rely on a particular region->index mapping; it may change.
+ * Returns 0 for ill-formed strings.
+ */
+ static int32_t indexForRegion(const char *region);
+
+ UBool isEquivalentTo(const LSR &other) const;
+ UBool operator==(const LSR &other) const;
+
+ inline UBool operator!=(const LSR &other) const {
+ return !operator==(other);
+ }
+
+ LSR &setHashCode();
+
+private:
+ void deleteOwned();
+};
+
+U_NAMESPACE_END
+
+#endif // __LSR_H__
diff --git a/contrib/libs/icu/common/messageimpl.h b/contrib/libs/icu/common/messageimpl.h
index 522458cd11..dc7a6edd6c 100644
--- a/contrib/libs/icu/common/messageimpl.h
+++ b/contrib/libs/icu/common/messageimpl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: messageimpl.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/messagepattern.cpp b/contrib/libs/icu/common/messagepattern.cpp
index faf1720fae..f223d06711 100644
--- a/contrib/libs/icu/common/messagepattern.cpp
+++ b/contrib/libs/icu/common/messagepattern.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: messagepattern.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/msvcres.h b/contrib/libs/icu/common/msvcres.h
index 84e56cc0cc..0cace85e74 100644
--- a/contrib/libs/icu/common/msvcres.h
+++ b/contrib/libs/icu/common/msvcres.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//{{NO_DEPENDENCIES}}
// Copyright (c) 2003-2010 International Business Machines
diff --git a/contrib/libs/icu/common/mutex.h b/contrib/libs/icu/common/mutex.h
index 27a455ecf0..44b1f90ba0 100644
--- a/contrib/libs/icu/common/mutex.h
+++ b/contrib/libs/icu/common/mutex.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -28,46 +28,46 @@
U_NAMESPACE_BEGIN
-/**
- * Mutex is a helper class for convenient locking and unlocking of a UMutex.
- *
- * Creating a local scope Mutex will lock a UMutex, holding the lock until the Mutex
- * goes out of scope.
- *
- * If no UMutex is specified, the ICU global mutex is implied.
- *
- * For example:
- *
- * static UMutex myMutex;
- *
- * void Function(int arg1, int arg2)
- * {
- * static Object* foo; // Shared read-write object
- * Mutex mutex(&myMutex); // or no args for the global lock
- * foo->Method();
- * // When 'mutex' goes out of scope and gets destroyed here, the lock is released
- * }
- *
- * Note: Do NOT use the form 'Mutex mutex();' as that merely forward-declares a function
- * returning a Mutex. This is a common mistake which silently slips through the
- * compiler!!
- */
+/**
+ * Mutex is a helper class for convenient locking and unlocking of a UMutex.
+ *
+ * Creating a local scope Mutex will lock a UMutex, holding the lock until the Mutex
+ * goes out of scope.
+ *
+ * If no UMutex is specified, the ICU global mutex is implied.
+ *
+ * For example:
+ *
+ * static UMutex myMutex;
+ *
+ * void Function(int arg1, int arg2)
+ * {
+ * static Object* foo; // Shared read-write object
+ * Mutex mutex(&myMutex); // or no args for the global lock
+ * foo->Method();
+ * // When 'mutex' goes out of scope and gets destroyed here, the lock is released
+ * }
+ *
+ * Note: Do NOT use the form 'Mutex mutex();' as that merely forward-declares a function
+ * returning a Mutex. This is a common mistake which silently slips through the
+ * compiler!!
+ */
class U_COMMON_API Mutex : public UMemory {
public:
- Mutex(UMutex *mutex = nullptr) : fMutex(mutex) {
- umtx_lock(fMutex);
- }
- ~Mutex() {
- umtx_unlock(fMutex);
- }
+ Mutex(UMutex *mutex = nullptr) : fMutex(mutex) {
+ umtx_lock(fMutex);
+ }
+ ~Mutex() {
+ umtx_unlock(fMutex);
+ }
+
+ Mutex(const Mutex &other) = delete; // forbid assigning of this class
+ Mutex &operator=(const Mutex &other) = delete; // forbid copying of this class
+ void *operator new(size_t s) = delete; // forbid heap allocation. Locals only.
- Mutex(const Mutex &other) = delete; // forbid assigning of this class
- Mutex &operator=(const Mutex &other) = delete; // forbid copying of this class
- void *operator new(size_t s) = delete; // forbid heap allocation. Locals only.
-
private:
- UMutex *fMutex;
+ UMutex *fMutex;
};
diff --git a/contrib/libs/icu/common/norm2_nfc_data.h b/contrib/libs/icu/common/norm2_nfc_data.h
index fc69cb1c5a..455cc0c428 100644
--- a/contrib/libs/icu/common/norm2_nfc_data.h
+++ b/contrib/libs/icu/common/norm2_nfc_data.h
@@ -1,646 +1,646 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
-//
-// Copyright (C) 1999-2016, International Business Machines
-// Corporation and others. All Rights Reserved.
-//
-// file name: norm2_nfc_data.h
-//
-// machine-generated by: icu/source/tools/gennorm2/n2builder.cpp
+//
+// Copyright (C) 1999-2016, International Business Machines
+// Corporation and others. All Rights Reserved.
+//
+// file name: norm2_nfc_data.h
+//
+// machine-generated by: icu/source/tools/gennorm2/n2builder.cpp
+
-
#ifdef INCLUDED_FROM_NORMALIZER2_CPP
-static const UVersionInfo norm2_nfc_data_formatVersion={4,0,0,0};
-static const UVersionInfo norm2_nfc_data_dataVersion={0xd,0,0,0};
+static const UVersionInfo norm2_nfc_data_formatVersion={4,0,0,0};
+static const UVersionInfo norm2_nfc_data_dataVersion={0xd,0,0,0};
static const int32_t norm2_nfc_data_indexes[Normalizer2Impl::IX_COUNT]={
-0x50,0x4bac,0x8814,0x8914,0x8914,0x8914,0x8914,0x8914,0xc0,0x300,0xae2,0x29e0,0x3c66,0xfc00,0x1288,0x3b9c,
-0x3c34,0x3c66,0x300,0
+0x50,0x4bac,0x8814,0x8914,0x8914,0x8914,0x8914,0x8914,0xc0,0x300,0xae2,0x29e0,0x3c66,0xfc00,0x1288,0x3b9c,
+0x3c34,0x3c66,0x300,0
+};
+
+static const uint16_t norm2_nfc_data_trieIndex[1746]={
+0,0x40,0x7b,0xbb,0xfb,0x13a,0x17a,0x1b2,0x1f2,0x226,0x254,0x226,0x294,0x2d4,0x313,0x353,
+0x393,0x3d2,0x40f,0x44e,0x226,0x226,0x488,0x4c8,0x4f8,0x530,0x226,0x570,0x59f,0x5de,0x226,0x5f3,
+0x631,0x65f,0x226,0x68c,0x6cc,0x709,0x729,0x768,0x7a7,0x7e4,0x803,0x840,0x729,0x879,0x8a7,0x8e6,
+0x226,0x920,0x937,0x977,0x98e,0x9cd,0x226,0xa03,0xa23,0xa5e,0xa6a,0xaa5,0xacd,0xb0a,0xb4a,0xb84,
+0xb9f,0x226,0xbda,0x226,0xc1a,0xc39,0xc6f,0xcac,0x226,0x226,0x226,0x226,0x226,0xccf,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xcfb,0x226,0x226,0xd30,
+0x226,0x226,0xd4e,0x226,0xd78,0x226,0x226,0x226,0xdb4,0xdd4,0xe14,0xe53,0xe8e,0xece,0xf02,0xf2e,
+0x808,0x226,0x226,0xf62,0x226,0x226,0x226,0xfa2,0xfe2,0x1022,0x1062,0x10a2,0x10e2,0x1122,0x1162,0x11a2,
+0x11e2,0x226,0x226,0x1212,0x1243,0x226,0x1273,0x12a6,0x12e3,0x1322,0x1362,0x1398,0x13c6,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x13f1,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0xcbd,0x226,0x140e,0x226,0x144e,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x148e,0x14c8,0x1506,0x1546,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1585,0x15c3,0x15e3,0x226,0x226,0x226,0x226,
+0x161d,0x226,0x226,0x1645,0x1677,0x16a5,0x80c,0x16b8,0x226,0x226,0x16c8,0x1708,0x226,0x226,0x226,0x1420,
+0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,
+0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,
+0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,
+0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,
+0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,
+0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,
+0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,
+0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,
+0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,
+0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,
+0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x1794,0x226,
+0x17d4,0x180f,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x184f,0x188f,0x18cf,0x190f,0x194f,0x198f,0x19cf,0x1a0f,0x1a32,0x1a72,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1a92,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x655,0x664,0x67c,0x69b,0x6b0,0x6b0,0x6b0,0x6b4,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xbda,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x54f,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x40c,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1ac5,0x226,0x226,0x1ad5,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0xdc6,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1ae5,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x15d6,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x1aef,0x54f,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x7eb,0x226,0x226,
+0x9ba,0x226,0x1aff,0x1b0c,0x1b18,0x226,0x226,0x226,0x226,0x414,0x226,0x1b23,0x1b33,0x226,0x226,0x226,
+0x7e0,0x226,0x226,0x226,0x226,0x1b43,0x226,0x226,0x226,0x1b4e,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x1b55,0x226,0x226,0x226,0x226,0x1b60,0x1b6f,0x8f6,0x1b7d,0x412,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x1b8b,0x798,0x226,0x226,0x226,0x226,0x226,0x1b9b,0x1baa,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x8d6,0x1bb2,0x1bc2,0x226,
+0x226,0x226,0x9ba,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1bcc,0x226,0x226,0x226,0x226,0x226,
+0x226,0x7e6,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1bc9,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1bdc,
+0x7e0,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x84d,0x226,0x226,0x226,0x7ed,0x7ea,
+0x226,0x226,0x226,0x226,0x7e8,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x9ba,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xbd4,0x226,0x226,0x226,
+0x226,0x7ea,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x1bec,0x226,0x226,0x226,0xefb,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x1bfc,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1bfe,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x1c0d,0x1c1d,0x1c2b,0x1c38,0x226,0x1c44,0x1c52,0x1c62,0x226,0x226,
+0x226,0x226,0xcea,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1c72,0x1c7a,
+0x1c88,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0xefb,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x4fc,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x1c98,0x226,0x226,0x226,0x226,0x226,0x226,0x1ca4,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x1cb4,0x1cc4,0x1cd4,0x1ce4,0x1cf4,0x1d04,0x1d14,0x1d24,0x1d34,0x1d44,0x1d54,
+0x1d64,0x1d74,0x1d84,0x1d94,0x1da4,0x1db4,0x1dc4,0x1dd4,0x1de4,0x1df4,0x1e04,0x1e14,0x1e24,0x1e34,0x1e44,0x1e54,
+0x1e64,0x1e74,0x1e84,0x1e94,0x1ea4,0x1eb4,0x1ec4,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
+0x226,0x226,0x226,0x226,0x226,0x408,0x428,0xc4,0xc4,0xc4,0x448,0x457,0x46d,0x489,0x4a6,0x4c2,
+0x4df,0x4fc,0x51b,0x538,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,
+0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x552,0xc4,0x566,0xc4,0xc4,0xc4,0xc4,
+0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,
+0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x586,0xc4,0xc4,0xc4,0xc4,0xc4,
+0xc4,0xc4,0xc4,0x591,0x5ae,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x5ce,0x5e2,0xc4,0xc4,0x5f5,
+0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,
+0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,
+0x615,0x635
+};
+
+static const uint16_t norm2_nfc_data_trieData[7892]={
+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,4,8,0xc,1,
+1,0x10,0x50,0x5c,0x70,0x88,0xcc,0xd0,0xec,0x108,0x144,0x148,0x15c,0x174,0x180,0x1a4,
+0x1e4,1,0x1ec,0x20c,0x228,0x244,0x290,0x298,0x2b0,0x2b8,0x2dc,1,1,1,1,1,
+1,0x2f4,0x334,0x340,0x354,0x36c,0x3b0,0x3b4,0x3d0,0x3f0,0x428,0x430,0x444,0x45c,0x468,0x48c,
+0x4cc,1,0x4d4,0x4f4,0x510,0x530,0x57c,0x584,0x5a0,0x5a8,0x5d0,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,0x5e8,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,0x128a,0x1290,0xae4,0x1296,0xafa,
+0xb04,0x5f4,0xb0e,0x129c,0x12a2,0xb18,0x12a8,0x12ae,0x12b4,0x12ba,0xb2e,1,0x12c0,0x12c6,0x12cc,0xb38,
+0xb4e,0xb60,1,0x5fc,0x12d2,0x12d8,0x12de,0xb6a,0x12e4,1,1,0x12ea,0x12f0,0xb80,0x12f6,0xb96,
+0xba0,0x600,0xbaa,0x12fc,0x1302,0xbb4,0x1308,0x130e,0x1314,0x131a,0xbca,1,0x1320,0x1326,0x132c,0xbd4,
+0xbea,0xbfc,1,0x608,0x1332,0x1338,0x133e,0xc06,0x1344,1,0x134a,0x1350,0x1356,0xc1c,0xc32,0x135d,
+0x1363,0x1368,0x136e,0x1374,0x137a,0x1380,0x1386,0x138c,0x1392,0x1398,0x139e,1,1,0xc48,0xc56,0x13a4,
+0x13aa,0x13b0,0x13b6,0x13bd,0x13c3,0x13c8,0x13ce,0x13d4,0x13da,0x13e0,0x13e6,0x13ec,0x13f2,0x13f9,0x13ff,0x1404,
+0x140a,1,1,0x1410,0x1416,0x141c,0x1422,0x1428,0x142e,0x1435,0x143b,0x1440,1,1,1,0x1447,
+0x144d,0x1453,0x1459,1,0x145e,0x1464,0x146b,0x1471,0x1476,0x147c,1,1,1,0x1482,0x1488,0x148f,
+0x1495,0x149a,0x14a0,1,1,1,0xc64,0xc72,0x14a6,0x14ac,0x14b2,0x14b8,1,1,0x14be,0x14c4,
+0x14cb,0x14d1,0x14d6,0x14dc,0xc80,0xc8a,0x14e2,0x14e8,0x14ef,0x14f5,0xc94,0xc9e,0x14fb,0x1501,0x1506,0x150c,
+1,1,0xca8,0xcb2,0xcbc,0xcc6,0x1512,0x1518,0x151e,0x1524,0x152a,0x1530,0x1537,0x153d,0x1542,0x1548,
+0x154e,0x1554,0x155a,0x1560,0x1566,0x156c,0x1572,0x1578,0x157e,0x60c,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,0xcd0,0xcea,1,1,1,1,
+1,1,1,1,1,1,1,1,1,0xd04,0xd1e,1,1,1,1,1,
+1,0x610,1,1,1,1,1,1,1,1,1,1,1,1,1,0x1584,
+0x158a,0x1590,0x1596,0x159c,0x15a2,0x15a8,0x15ae,0x15b6,0x15c0,0x15ca,0x15d4,0x15de,0x15e8,0x15f2,0x15fc,1,
+0x1606,0x1610,0x161a,0x1624,0x162d,0x1633,1,1,0x1638,0x163e,0x1644,0x164a,0xd38,0xd42,0x1653,0x165d,
+0x1665,0x166b,0x1671,1,1,1,0x1676,0x167c,1,1,0x1682,0x1688,0x1690,0x169a,0x16a3,0x16a9,
+0x16af,0x16b5,0x16ba,0x16c0,0x16c6,0x16cc,0x16d2,0x16d8,0x16de,0x16e4,0x16ea,0x16f0,0x16f6,0x16fc,0x1702,0x1708,
+0x170e,0x1714,0x171a,0x1720,0x1726,0x172c,0x1732,0x1738,0x173e,0x1744,0x174a,0x1750,0x1756,0x175c,1,1,
+0x1762,0x1768,1,1,1,1,1,1,0xd4c,0xd56,0xd60,0xd6a,0x1770,0x177a,0x1784,0x178e,
+0xd74,0xd7e,0x1798,0x17a2,0x17aa,0x17b0,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,0x614,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,0xfdcc,0xfdcc,0xfdcc,0xfdcc,0xfdcc,0xffcc,0xfdcc,0xfdcc,0xfdcc,0xfdcc,0xfdcc,0xfdcc,
+0xfdcc,0xffcc,0xffcc,0xfdcc,0xffcc,0xfdcc,0xffcc,0xfdcc,0xfdcc,0xffd0,0xffb8,0xffb8,0xffb8,0xffb8,0xffd0,0xfdb0,
+0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xff94,0xff94,0xfdb8,0xfdb8,0xfdb8,0xfdb8,0xfd94,0xfd94,0xffb8,0xffb8,0xffb8,
+0xffb8,0xfdb8,0xfdb8,0xffb8,0xfdb8,0xfdb8,0xffb8,0xffb8,0xfe02,0xfe02,0xfe02,0xfe02,0xfc02,0xffb8,0xffb8,0xffb8,
+0xffb8,0xffcc,0xffcc,0xffcc,0x3c36,0x3c3c,0xfdcc,0x3c42,0x3c48,0xfde0,0xffcc,0xffb8,0xffb8,0xffb8,0xffcc,0xffcc,
+0xffcc,0xffb8,0xffb8,1,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffcc,0xffd0,0xffb8,0xffb8,0xffcc,
+0xffd2,0xffd4,0xffd4,0xffd2,0xffd4,0xffd4,0xffd2,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
+0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,1,0x29e1,1,1,1,1,1,1,1,
+1,1,0x29e5,1,1,1,1,1,0x17b7,0x17bd,0x29e9,0x17c3,0x17c9,0x17cf,1,0x17d5,
+1,0x17db,0x17e1,0x17e9,0x618,1,1,1,0x634,1,0x644,1,0x658,1,1,1,
+1,1,0x674,1,0x684,1,1,1,0x688,1,1,1,0x6a0,0x17f1,0x17f7,0xd88,
+0x17fd,0xd92,0x1803,0x180b,0x6b4,1,1,1,0x6d4,1,0x6e4,1,0x6fc,1,1,1,
+1,1,0x71c,1,0x72c,1,1,1,0x734,1,1,1,0x754,0xd9c,0xdae,0x1813,
+0x1819,0xdc0,1,1,1,0x76c,0x181f,0x1825,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,0x182b,0x1831,1,0x1837,1,1,0x774,0x183d,1,1,1,1,0x1843,
+0x1849,0x184f,1,0x778,1,1,0x780,1,0x784,0x790,0x798,0x79c,0x1855,0x7ac,1,1,
+1,0x7b0,1,1,1,1,0x7b4,1,1,1,0x7c4,1,1,1,0x7c8,1,
+0x7cc,1,1,0x7d0,1,1,0x7d8,1,0x7dc,0x7e8,0x7f0,0x7f4,0x185b,0x804,1,1,
+1,0x808,1,1,1,0x80c,1,1,1,0x81c,1,1,1,0x820,1,0x824,
+1,1,0x1861,0x1867,1,0x186d,1,1,0x828,0x1873,1,1,1,1,0x1879,0x187f,
+0x1885,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,0x82c,0x830,0x188b,0x1891,1,1,1,1,1,1,
+1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,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,0x1897,
+0x189d,1,1,1,1,1,1,1,1,1,1,1,1,1,0x18a3,0x18a9,
+0x18af,0x18b5,1,1,0x18bb,0x18c1,0x834,0x838,0x18c7,0x18cd,0x18d3,0x18d9,0x18df,0x18e5,1,1,
+0x18eb,0x18f1,0x18f7,0x18fd,0x1903,0x1909,0x83c,0x840,0x190f,0x1915,0x191b,0x1921,0x1927,0x192d,0x1933,0x1939,
+0x193f,0x1945,0x194b,0x1951,1,1,0x1957,0x195d,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,
+0xffcc,0xffcc,0xffbc,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,
+0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffbc,0xffc8,0xffcc,0xfe14,0xfe16,0xfe18,0xfe1a,0xfe1c,0xfe1e,0xfe20,0xfe22,
+0xfe24,0xfe26,0xfe26,0xfe28,0xfe2a,0xfe2c,1,0xfe2e,1,0xfe30,0xfe32,1,0xffcc,0xffb8,1,0xfe24,
+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,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
+0xfe3c,0xfe3e,0xfe40,1,1,1,1,1,1,1,0x1962,0x1968,0x196f,0x1975,0x197b,0x844,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,0x850,1,0x854,0xfe36,0xfe38,0xfe3a,0xfe3c,0xfe3e,
+0xfe40,0xfe42,0xfe44,0xfdcc,0xfdcc,0xfdb8,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffb8,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+0xfe46,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+0x1981,0x858,0x1987,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,0x85c,0x198d,1,0x860,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1,0xffcc,
+0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,1,1,0xffcc,0xffcc,1,0xffb8,0xffcc,0xffcc,0xffb8,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+0xfe48,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,0xffcc,
+0xffb8,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffcc,0xffb8,0xffb8,0xffcc,0xffb8,0xffcc,0xffcc,
+0xffb8,0xffcc,0xffb8,0xffcc,0xffb8,0xffcc,0xffb8,0xffcc,0xffcc,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,0xffcc,0xffcc,
+0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,1,1,1,1,1,1,1,1,1,
+0xffb8,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,0xffcc,0xffcc,
+0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,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,0xffb8,0xffb8,0xffb8,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,0xffb8,
+0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffb8,
+0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xfe36,0xfe38,0xfe3a,0xffcc,
+0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffb8,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,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,0x864,0x1993,1,1,1,1,1,1,0x868,0x1999,1,0x86c,
+0x199f,1,1,1,1,1,1,1,0xfc0e,1,1,1,1,1,1,1,
+1,1,1,1,1,1,0xfe12,1,1,1,0xffcc,0xffb8,0xffcc,0xffcc,1,1,
+1,0x29ec,0x29f2,0x29f8,0x29fe,0x2a04,0x2a0a,0x2a10,0x2a16,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,0xfe0e,1,0xfc00,1,1,1,1,1,1,1,0x870,
+1,1,1,0x19a5,0x19ab,0xfe12,1,1,1,1,1,1,1,1,1,0xfc00,
+1,1,1,1,0x2a1c,0x2a22,1,0x2a28,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,0xffcc,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,0x2a2e,1,1,0x2a34,1,1,
+1,1,1,0xfe0e,1,1,1,1,1,1,1,1,1,1,1,1,
+1,0xfe12,1,1,1,1,1,1,1,1,1,1,1,0x2a3a,0x2a40,0x2a46,
+1,1,0x2a4c,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,0xfe0e,
+1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe12,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,
+0x878,0x19b1,1,1,0x19b7,0x19bd,0xfe12,1,1,1,1,1,1,1,1,0xfc00,
+0xfc00,1,1,1,1,0x2a52,0x2a58,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,0x884,1,0x19c3,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,0xfc00,1,1,1,1,1,1,0x888,0x890,1,1,
+0x19c9,0x19cf,0x19d5,0xfe12,1,1,1,1,1,1,1,1,1,0xfc00,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,0x894,1,0x19db,1,1,1,1,0xfe12,1,1,
+1,1,1,1,1,0xfea8,0xfcb6,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,0xfe0e,1,1,0x898,0x19e1,1,0xfc00,1,1,1,0x89c,0x19e7,0x19ed,
+1,0xdca,0x19f5,1,0xfe12,1,1,1,1,1,1,1,0xfc00,0xfc00,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,0xfe12,0xfe12,1,0xfc00,1,1,1,
+1,1,1,0x8a8,0x8b0,1,1,0x19fd,0x1a03,0x1a09,0xfe12,1,1,1,1,1,
+1,1,1,1,0xfc00,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,0xfc12,1,1,
+1,1,0xfc00,1,1,1,1,1,1,1,1,1,0x8b4,0x1a0f,1,0xdd4,
+0x1a17,0x1a1f,0xfc00,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,0xfece,0xfece,0xfe12,1,1,
+1,1,1,1,1,1,0xfed6,0xfed6,0xfed6,0xfed6,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,0xfeec,0xfeec,0xfe12,1,1,1,1,1,1,1,1,0xfef4,0xfef4,0xfef4,
+0xfef4,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,0xffb8,0xffb8,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,0xffb8,1,0xffb8,1,0xffb0,1,1,1,1,1,1,0x2a5f,1,1,
+1,1,1,1,1,1,1,0x2a65,1,1,1,1,0x2a6b,1,1,1,
+1,0x2a71,1,1,1,1,0x2a77,1,1,1,1,1,1,1,1,1,
+1,1,1,0x2a7d,1,1,1,1,1,1,1,0xff02,0xff04,0x3c50,0xff08,0x3c58,
+0x2a82,1,0x2a88,1,0xff04,0xff04,0xff04,0xff04,1,1,0xff04,0x3c60,0xffcc,0xffcc,0xfe12,1,
+0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,0x2a8f,1,1,
+1,1,1,1,1,1,1,0x2a95,1,1,1,1,0x2a9b,1,1,1,
+1,0x2aa1,1,1,1,1,0x2aa7,1,1,1,1,1,1,1,1,1,
+1,1,1,0x2aad,1,1,1,1,1,1,0xffb8,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,0x8c0,0x1a25,1,1,1,1,1,1,1,0xfc00,1,1,
+1,1,1,1,1,1,0xfe0e,1,0xfe12,0xfe12,1,1,1,1,1,1,
+1,1,1,1,1,1,1,0xffb8,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,2,2,2,2,2,2,
+2,2,2,2,2,2,2,2,2,2,2,2,2,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,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,
+0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,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,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,
+0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,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,0xffcc,0xffcc,0xffcc,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,0xfe12,
+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,0xfe12,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,0xfe12,1,1,1,1,1,1,1,1,1,1,0xffcc,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,0xffc8,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,0xffbc,0xffcc,0xffb8,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,0xffcc,0xffb8,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,0xfe12,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
+0xffcc,1,1,0xffb8,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,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffcc,
+0xffcc,0xffb8,1,0xffb8,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,0x8c4,0x1a2b,0x8c8,0x1a31,0x8cc,0x1a37,0x8d0,0x1a3d,0x8d4,0x1a43,1,1,0x8d8,
+0x1a49,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,0xfe0e,0xfc00,1,1,1,1,0x8dc,0x1a4f,0x8e0,0x1a55,0x8e4,0x8e8,0x1a5b,0x1a61,
+0x8ec,0x1a67,0xfe12,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,0xffcc,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
+0xffcc,0xffcc,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,0xfe12,0xfe12,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,0xfe0e,1,1,1,1,1,1,1,1,1,1,1,
+0xfe12,0xfe12,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,0xffcc,0xffcc,0xffcc,1,0xfe02,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffcc,0xffcc,0xffb8,0xffb8,
+0xffb8,0xffb8,0xffcc,1,0xfe02,0xfe02,0xfe02,0xfe02,0xfe02,0xfe02,0xfe02,1,1,1,1,0xffb8,
+1,1,1,1,1,1,0xffcc,1,1,1,0xffcc,0xffcc,1,1,1,1,
+1,1,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffd4,
+0xffac,0xffb8,0xff94,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
+0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
+0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffd0,0xffc8,0xffc8,0xffb8,1,0xffcc,0xffd2,0xffb8,
+0xffcc,0xffb8,0x1a6c,0x1a72,0x1a78,0x1a7e,0x1a85,0x1a8b,0x1a91,0x1a97,0x1a9f,0x1aa9,0x1ab0,0x1ab6,0x1abc,0x1ac2,
+0x1ac8,0x1ace,0x1ad5,0x1adb,0x1ae0,0x1ae6,0x1aee,0x1af8,0x1b02,0x1b0c,0x1b14,0x1b1a,0x1b20,0x1b26,0x1b2f,0x1b39,
+0x1b41,0x1b47,0x1b4c,0x1b52,0x1b58,0x1b5e,0x1b64,0x1b6a,0x1b70,0x1b76,0x1b7d,0x1b83,0x1b88,0x1b8e,0x1b94,0x1b9a,
+0x1ba2,0x1bac,0x1bb4,0x1bba,0x1bc0,0x1bc6,0x1bcc,0x1bd2,0xdde,0xde8,0x1bda,0x1be4,0x1bec,0x1bf2,0x1bf8,0x1bfe,
+0x1c04,0x1c0a,0x1c10,0x1c16,0x1c1d,0x1c23,0x1c28,0x1c2e,0x1c34,0x1c3a,0x1c40,0x1c46,0x1c4c,0x1c52,0x1c5a,0x1c64,
+0x1c6e,0x1c78,0x1c82,0x1c8c,0x1c96,0x1ca0,0x1ca9,0x1caf,0x1cb5,0x1cbb,0x1cc0,0x1cc6,0xdf2,0xdfc,0x1cce,0x1cd8,
+0x1ce0,0x1ce6,0x1cec,0x1cf2,0xe06,0xe10,0x1cfa,0x1d04,0x1d0e,0x1d18,0x1d22,0x1d2c,0x1d34,0x1d3a,0x1d40,0x1d46,
+0x1d4c,0x1d52,0x1d58,0x1d5e,0x1d64,0x1d6a,0x1d70,0x1d76,0x1d7c,0x1d82,0x1d8a,0x1d94,0x1d9e,0x1da8,0x1db0,0x1db6,
+0x1dbd,0x1dc3,0x1dc8,0x1dce,0x1dd4,0x1dda,0x1de0,0x1de6,0x1dec,0x1df2,0x1df9,0x1dff,0x1e05,0x1e0b,0x1e11,0x1e17,
+0x1e1c,0x1e22,0x1e28,0x1e2e,0x1e35,0x1e3b,0x1e41,0x1e47,0x1e4c,0x1e52,0x1e58,0x1e5e,1,0x1e65,1,1,
+1,1,0xe1a,0xe28,0x1e6a,0x1e70,0x1e78,0x1e82,0x1e8c,0x1e96,0x1ea0,0x1eaa,0x1eb4,0x1ebe,0x1ec8,0x1ed2,
+0x1edc,0x1ee6,0x1ef0,0x1efa,0x1f04,0x1f0e,0x1f18,0x1f22,0x1f2c,0x1f36,0xe36,0xe40,0x1f3e,0x1f44,0x1f4a,0x1f50,
+0x1f58,0x1f62,0x1f6c,0x1f76,0x1f80,0x1f8a,0x1f94,0x1f9e,0x1fa8,0x1fb2,0x1fba,0x1fc0,0x1fc6,0x1fcc,0xe4a,0xe54,
+0x1fd2,0x1fd8,0x1fe0,0x1fea,0x1ff4,0x1ffe,0x2008,0x2012,0x201c,0x2026,0x2030,0x203a,0x2044,0x204e,0x2058,0x2062,
+0x206c,0x2076,0x2080,0x208a,0x2094,0x209e,0x20a6,0x20ac,0x20b2,0x20b8,0x20c0,0x20ca,0x20d4,0x20de,0x20e8,0x20f2,
+0x20fc,0x2106,0x2110,0x211a,0x2122,0x2128,0x212f,0x2135,0x213a,0x2140,0x2146,0x214c,1,1,1,1,
+1,1,0xe5e,0xe74,0xe8c,0xe9a,0xea8,0xeb6,0xec4,0xed2,0xede,0xef4,0xf0c,0xf1a,0xf28,0xf36,
+0xf44,0xf52,0xf5e,0xf6c,0x2155,0x215f,0x2169,0x2173,1,1,0xf7a,0xf88,0x217d,0x2187,0x2191,0x219b,
+1,1,0xf96,0xfac,0xfc4,0xfd2,0xfe0,0xfee,0xffc,0x100a,0x1016,0x102c,0x1044,0x1052,0x1060,0x106e,
+0x107c,0x108a,0x1096,0x10a8,0x21a5,0x21af,0x21b9,0x21c3,0x21cd,0x21d7,0x10ba,0x10cc,0x21e1,0x21eb,0x21f5,0x21ff,
+0x2209,0x2213,0x10de,0x10ec,0x221d,0x2227,0x2231,0x223b,1,1,0x10fa,0x1108,0x2245,0x224f,0x2259,0x2263,
+1,1,0x1116,0x1128,0x226d,0x2277,0x2281,0x228b,0x2295,0x229f,1,0x113a,1,0x22a9,1,0x22b3,
+1,0x22bd,0x114c,0x1162,0x117a,0x1188,0x1196,0x11a4,0x11b2,0x11c0,0x11cc,0x11e2,0x11fa,0x1208,0x1216,0x1224,
+0x1232,0x1240,0x124c,0x3b9e,0x22c5,0x3ba6,0x1256,0x3bae,0x22cb,0x3bb6,0x22d1,0x3bbe,0x22d7,0x3bc6,0x1260,0x3bce,
+1,1,0x22de,0x22e8,0x22f7,0x2307,0x2317,0x2327,0x2337,0x2347,0x2352,0x235c,0x236b,0x237b,0x238b,0x239b,
+0x23ab,0x23bb,0x23c6,0x23d0,0x23df,0x23ef,0x23ff,0x240f,0x241f,0x242f,0x243a,0x2444,0x2453,0x2463,0x2473,0x2483,
+0x2493,0x24a3,0x24ae,0x24b8,0x24c7,0x24d7,0x24e7,0x24f7,0x2507,0x2517,0x2522,0x252c,0x253b,0x254b,0x255b,0x256b,
+0x257b,0x258b,0x2595,0x259b,0x25a3,0x25aa,0x25b3,1,0x126a,0x25bd,0x25c5,0x25cb,0x25d1,0x3bd6,0x25d6,1,
+0x2ab2,0x8f0,1,0x25dd,0x25e5,0x25ec,0x25f5,1,0x1274,0x25ff,0x2607,0x3bde,0x260d,0x3be6,0x2612,0x2619,
+0x261f,0x2625,0x262b,0x2631,0x2639,0x3bf0,1,1,0x2641,0x2649,0x2651,0x2657,0x265d,0x3bfa,1,0x2663,
+0x2669,0x266f,0x2675,0x267b,0x2683,0x3c04,0x268b,0x2691,0x2697,0x269f,0x26a7,0x26ad,0x26b3,0x3c0e,0x26b9,0x26bf,
+0x3c16,0x2ab7,1,1,0x26c7,0x26ce,0x26d7,1,0x127e,0x26e1,0x26e9,0x3c1e,0x26ef,0x3c26,0x26f4,0x2abb,
+0x8fc,1,0xfa09,0xfa09,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,0xffcc,0xffcc,0xfe02,0xfe02,0xffcc,0xffcc,0xffcc,0xffcc,0xfe02,0xfe02,0xfe02,0xffcc,0xffcc,1,
+1,1,1,0xffcc,1,1,1,0xfe02,0xfe02,0xffcc,0xffb8,0xffcc,0xfe02,0xfe02,0xffb8,0xffb8,
+0xffb8,0xffb8,0xffcc,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,0x2abe,1,1,1,0x2ac2,0x3c2e,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,0x908,1,0x90c,1,0x910,1,1,1,1,1,0x26fb,0x2701,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,0x2707,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,0x270d,0x2713,0x2719,0x914,1,0x918,1,0x91c,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,0x920,0x271f,1,1,1,0x924,0x2725,1,0x928,0x272b,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,0x92c,0x2731,0x930,0x2737,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x934,
+1,1,1,0x273d,1,0x938,0x2743,0x93c,1,0x2749,0x940,0x274f,1,1,1,0x944,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,0x2755,0x948,0x275b,1,0x94c,0x950,1,1,1,1,1,1,1,0x2761,
+0x2767,0x276d,0x2773,0x2779,0x954,0x958,0x277f,0x2785,0x95c,0x960,0x278b,0x2791,0x964,0x968,0x96c,0x970,
+1,1,0x2797,0x279d,0x974,0x978,0x27a3,0x27a9,0x97c,0x980,0x27af,0x27b5,1,1,1,1,
+1,1,1,0x984,0x988,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,0x98c,1,1,1,1,1,0x990,0x994,1,0x998,0x27bb,0x27c1,
+0x27c7,0x27cd,1,1,0x99c,0x9a0,0x9a4,0x9a8,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,0x27d3,0x27d9,0x27df,0x27e5,1,1,1,1,
+1,1,0x27eb,0x27f1,0x27f7,0x27fd,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,0x2ac7,
+0x2acb,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,0x2acf,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,0xfe12,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,0xffcc,0xffcc,
+0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
+0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,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,0xffb4,0xffc8,0xffd0,0xffbc,0xffc0,0xffc0,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x9ac,1,
+1,1,1,0x9b0,0x2803,0x9b4,0x2809,0x9b8,0x280f,0x9bc,0x2815,0x9c0,0x281b,0x9c4,0x2821,0x9c8,
+0x2827,0x9cc,0x282d,0x9d0,0x2833,0x9d4,0x2839,0x9d8,0x283f,0x9dc,0x2845,1,0x9e0,0x284b,0x9e4,0x2851,
+0x9e8,0x2857,1,1,1,1,1,0x9ec,0x285d,0x2863,0x9f4,0x2869,0x286f,0x9fc,0x2875,0x287b,
+0xa04,0x2881,0x2887,0xa0c,0x288d,0x2893,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,0x2899,1,1,1,1,0xfc10,
+0xfc10,1,1,0xa14,0x289f,1,1,1,1,1,1,1,0xa18,1,1,1,
+1,0xa1c,0x28a5,0xa20,0x28ab,0xa24,0x28b1,0xa28,0x28b7,0xa2c,0x28bd,0xa30,0x28c3,0xa34,0x28c9,0xa38,
+0x28cf,0xa3c,0x28d5,0xa40,0x28db,0xa44,0x28e1,0xa48,0x28e7,1,0xa4c,0x28ed,0xa50,0x28f3,0xa54,0x28f9,
+1,1,1,1,1,0xa58,0x28ff,0x2905,0xa60,0x290b,0x2911,0xa68,0x2917,0x291d,0xa70,0x2923,
+0x2929,0xa78,0x292f,0x2935,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,0xa80,0xa84,0xa88,0xa8c,1,0x293b,1,1,0x2941,0x2947,0x294d,
+0x2953,1,1,0xa90,0x2959,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,0xffcc,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
+0xffcc,0xffcc,0xffcc,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,0xffcc,0xffcc,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,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,0xfe12,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,0xfe12,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,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
+0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,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,0xffb8,0xffb8,0xffb8,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,0xfe12,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,0xffcc,1,0xffcc,0xffcc,0xffb8,1,1,0xffcc,
+0xffcc,1,1,1,1,1,0xffcc,0xffcc,1,0xffcc,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,0xfe12,1,
+1,1,1,1,1,1,1,1,0xae2,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,
+0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,
+0x1289,0x1289,0x1289,0x1289,0xae2,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,
+0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,
+0xae2,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,
+0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0xae2,0x1289,0x1289,0x1289,
+0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,
+0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,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,0x3c66,1,0x3c66,0x3c66,0x3c66,0x3c66,0x3c66,0x3c66,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x3c66,0x3c66,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,0x3c66,1,1,1,1,0x3c66,1,1,1,0x3c66,1,0x3c66,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,0x3b97,1,0x2ad5,
+0x2ad9,0x2add,0x2ae1,0x2ae5,0x2ae9,0x2aed,0x2af1,0x2af1,0x2af5,0x2af9,0x2afd,0x2b01,0x2b05,0x2b09,0x2b0d,0x2b11,
+0x2b15,0x2b19,0x2b1d,0x2b21,0x2b25,0x2b29,0x2b2d,0x2b31,0x2b35,0x2b39,0x2b3d,0x2b41,0x2b45,0x2b49,0x2b4d,0x2b51,
+0x2b55,0x2b59,0x2b5d,0x2b61,0x2b65,0x2b69,0x2b6d,0x2b71,0x2b75,0x2b79,0x2b7d,0x2b81,0x2b85,0x2b89,0x2b8d,0x2b91,
+0x2b95,0x2b99,0x2b9d,0x2ba1,0x2ba5,0x2ba9,0x2bad,0x2bb1,0x2bb5,0x2bb9,0x2bbd,0x2bc1,0x2bc5,0x2bc9,0x2bcd,0x2bd1,
+0x2bd5,0x2bd9,0x2bdd,0x2be1,0x2be5,0x2be9,0x2bed,0x2bf1,0x2bf5,0x2bf9,0x2bfd,0x2c01,0x2c05,0x2c09,0x2c0d,0x2c11,
+0x2c15,0x2c19,0x2c1d,0x2c21,0x2c25,0x2c29,0x2c2d,0x2c31,0x2c35,0x2c39,0x2c3d,0x2b21,0x2c41,0x2c45,0x2c49,0x2c4d,
+0x2c51,0x2c55,0x2c59,0x2c5d,0x2c61,0x2c65,0x2c69,0x2c6d,0x2c71,0x2c75,0x2c79,0x2c7d,0x2c81,0x2c85,0x2c89,0x2c8d,
+0x2c91,0x2c95,0x2c99,0x2c9d,0x2ca1,0x2ca5,0x2ca9,0x2cad,0x2cb1,0x2cb5,0x2cb9,0x2cbd,0x2cc1,0x2cc5,0x2cc9,0x2ccd,
+0x2cd1,0x2cd5,0x2cd9,0x2cdd,0x2ce1,0x2ce5,0x2ce9,0x2ced,0x2cf1,0x2cf5,0x2cf9,0x2cfd,0x2d01,0x2d05,0x2d09,0x2d0d,
+0x2d11,0x2d15,0x2d19,0x2d1d,0x2d21,0x2d25,0x2d29,0x2d2d,0x2d31,0x2d35,0x2d39,0x2d3d,0x2d41,0x2d45,0x2d49,0x2d4d,
+0x2c89,0x2d51,0x2d55,0x2d59,0x2d5d,0x2d61,0x2d65,0x2d69,0x2d6d,0x2c49,0x2d71,0x2d75,0x2d79,0x2d7d,0x2d81,0x2d85,
+0x2d89,0x2d8d,0x2d91,0x2d95,0x2d99,0x2d9d,0x2da1,0x2da5,0x2da9,0x2dad,0x2db1,0x2db5,0x2db9,0x2dbd,0x2b21,0x2dc1,
+0x2dc5,0x2dc9,0x2dcd,0x2dd1,0x2dd5,0x2dd9,0x2ddd,0x2de1,0x2de5,0x2de9,0x2ded,0x2df1,0x2df5,0x2df9,0x2dfd,0x2e01,
+0x2e05,0x2e09,0x2e0d,0x2e11,0x2e15,0x2e19,0x2e1d,0x2e21,0x2e25,0x2e29,0x2c51,0x2e2d,0x2e31,0x2e35,0x2e39,0x2e3d,
+0x2e41,0x2e45,0x2e49,0x2e4d,0x2e51,0x2e55,0x2e59,0x2e5d,0x2e61,0x2e65,0x2e69,0x2e6d,0x2e71,0x2e75,0x2e79,0x2e7d,
+0x2e81,0x2e85,0x2e89,0x2e8d,0x2e91,0x2e95,0x2e99,0x2e9d,0x2ea1,0x2ea5,0x2ea9,0x2ead,0x2eb1,0x2eb5,0x2eb9,0x2ebd,
+0x2ec1,0x2ec5,0x2ec9,0x2ecd,0x2ed1,0x2ed5,0x2ed9,0x2edd,0x2ee1,0x2ee5,0x2ee9,0x2eed,0x2ef1,1,1,0x2ef5,
+1,0x2ef9,1,1,0x2efd,0x2f01,0x2f05,0x2f09,0x2f0d,0x2f11,0x2f15,0x2f19,0x2f1d,0x2f21,1,0x2f25,
+1,0x2f29,1,1,0x2f2d,0x2f31,1,1,1,0x2f35,0x2f39,0x2f3d,0x2f41,0x2f45,0x2f49,0x2f4d,
+0x2f51,0x2f55,0x2f59,0x2f5d,0x2f61,0x2f65,0x2f69,0x2f6d,0x2f71,0x2f75,0x2f79,0x2f7d,0x2f81,0x2f85,0x2f89,0x2f8d,
+0x2f91,0x2f95,0x2f99,0x2f9d,0x2fa1,0x2fa5,0x2fa9,0x2fad,0x2fb1,0x2fb5,0x2fb9,0x2fbd,0x2fc1,0x2fc5,0x2fc9,0x2fcd,
+0x2fd1,0x2fd5,0x2fd9,0x2fdd,0x2fe1,0x2fe5,0x2d25,0x2fe9,0x2fed,0x2ff1,0x2ff5,0x2ff9,0x2ffd,0x2ffd,0x3001,0x3005,
+0x3009,0x300d,0x3011,0x3015,0x3019,0x301d,0x2f2d,0x3021,0x3025,0x3029,0x302d,0x3031,0x3037,1,1,0x303b,
+0x303f,0x3043,0x3047,0x304b,0x304f,0x3053,0x3057,0x2f65,0x305b,0x305f,0x3063,0x2ef5,0x3067,0x306b,0x306f,0x3073,
+0x3077,0x307b,0x307f,0x3083,0x3087,0x308b,0x308f,0x3093,0x2f89,0x3097,0x2f8d,0x309b,0x309f,0x30a3,0x30a7,0x30ab,
+0x2ef9,0x2b75,0x30af,0x30b3,0x30b7,0x2c8d,0x2de9,0x30bb,0x30bf,0x2fa9,0x30c3,0x2fad,0x30c7,0x30cb,0x30cf,0x2f01,
+0x30d3,0x30d7,0x30db,0x30df,0x30e3,0x2f05,0x30e7,0x30eb,0x30ef,0x30f3,0x30f7,0x30fb,0x2fe5,0x30ff,0x3103,0x2d25,
+0x3107,0x2ff5,0x310b,0x310f,0x3113,0x3117,0x311b,0x3009,0x311f,0x2f29,0x3123,0x300d,0x2c41,0x3127,0x3011,0x312b,
+0x3019,0x312f,0x3133,0x3137,0x313b,0x313f,0x3021,0x2f19,0x3143,0x3025,0x3147,0x3029,0x314b,0x2af1,0x314f,0x3155,
+0x315b,0x3161,0x3165,0x3169,0x316d,0x3173,0x3179,0x317f,0x3183,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,0x3186,
+0xfe34,0x318c,1,1,1,1,1,1,1,1,1,1,0x3192,0x3198,0x31a0,0x31aa,
+0x31b2,0x31b8,0x31be,0x31c4,0x31ca,0x31d0,0x31d6,0x31dc,0x31e2,1,0x31e8,0x31ee,0x31f4,0x31fa,0x3200,1,
+0x3206,1,0x320c,0x3212,1,0x3218,0x321e,1,0x3224,0x322a,0x3230,0x3236,0x323c,0x3242,0x3248,0x324e,
+0x3254,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,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,
+0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,0xffb8,1,0xffcc,1,1,1,1,1,1,1,1,0xffcc,0xfe02,0xffb8,
+1,1,1,1,0xfe12,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,
+1,1,1,1,1,0xffb8,0xffb8,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,0xffb8,0xffb8,0xffb8,1,
+1,1,1,1,1,1,1,1,0xa94,0x295f,0xa9a,0x2969,1,1,1,1,
+1,0xaa0,1,1,1,1,1,0x2973,1,1,1,1,1,1,1,1,
+1,0xfe12,0xfc0e,1,1,1,1,1,1,1,0xfc00,1,1,1,1,1,
+1,0x297d,0x2987,1,0xaa6,0xaac,0xfe12,0xfe12,1,1,1,1,1,1,1,1,
+1,1,1,0xfe12,1,1,1,1,1,1,1,1,1,0xfe0e,1,1,
+1,1,1,0xfe12,0xfe0e,1,1,1,1,1,1,1,1,1,0xfe0e,0xfe12,
+1,1,1,1,1,1,1,1,1,1,1,0xfe0e,0xfe0e,1,0xfc00,1,
+1,1,1,1,1,1,0xab2,1,1,1,0x2991,0x299b,0xfe12,1,1,1,
+1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,0xfe12,1,1,
+1,0xfe0e,1,1,1,1,1,1,1,1,1,0xfc00,1,1,1,1,
+1,1,1,1,0xabe,0xfc00,0x29a5,0x29af,0xfc00,0x29b9,1,1,0xfe12,0xfe0e,1,1,
+1,1,1,1,1,1,1,1,1,1,0xad0,0xad6,0x29c3,0x29cd,1,1,
+1,0xfe12,0xfe0e,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,0xfe12,0xfe0e,1,1,1,1,1,1,1,1,0xfc00,1,1,1,
+1,0xadc,1,1,0x29d7,1,1,1,1,0xfe12,0xfe12,1,0xfe02,0xfe02,0xfe02,0xfe02,
+0xfe02,1,1,1,1,1,1,1,1,1,1,1,0xfe0c,0xfe0c,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,0xfe02,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,0x325a,0x3264,0x3278,0x3290,0x32a8,
+0x32c0,0x32d8,0xffb0,0xffb0,0xfe02,0xfe02,0xfe02,1,1,1,0xffc4,0xffb0,0xffb0,0xffb0,1,1,
+1,1,1,1,1,1,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,1,1,0xffcc,0xffcc,0xffcc,
+0xffcc,0xffcc,0xffb8,0xffb8,1,1,1,1,1,1,1,1,1,1,0xffcc,0xffcc,
+0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,0x32e6,0x32f0,0x3304,
+0x331c,0x3334,0x334c,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
+0xffcc,0xffcc,0xffcc,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,1,0xffcc,0xffcc,
+0xffcc,0xffcc,0xffcc,1,1,1,1,1,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,1,
+1,1,1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xfe0e,1,
+1,1,1,1,0x335b,0x335f,0x3363,0x3367,0x336d,0x2f4d,0x3371,0x3375,0x3379,0x337d,0x2f51,0x3381,
+0x3385,0x3389,0x2f55,0x338f,0x3393,0x3397,0x339b,0x33a1,0x33a5,0x33a9,0x33ad,0x33b3,0x33b7,0x33bb,0x33bf,0x303f,
+0x33c3,0x33c9,0x33cd,0x33d1,0x33d5,0x33d9,0x33dd,0x33e1,0x33e5,0x3053,0x2f59,0x2f5d,0x3057,0x33e9,0x33ed,0x2c59,
+0x33f1,0x2f61,0x33f5,0x33f9,0x33fd,0x3401,0x3401,0x3401,0x3405,0x340b,0x340f,0x3413,0x3417,0x341d,0x3421,0x3425,
+0x3429,0x342d,0x3431,0x3435,0x3439,0x343d,0x3441,0x3445,0x3449,0x344d,0x344d,0x305f,0x3451,0x3455,0x3459,0x345d,
+0x2f69,0x3461,0x3465,0x3469,0x2ebd,0x346d,0x3471,0x3475,0x3479,0x347d,0x3481,0x3485,0x3489,0x348d,0x3493,0x3497,
+0x349b,0x349f,0x34a3,0x34a7,0x34ab,0x34b1,0x34b7,0x34bb,0x34bf,0x34c3,0x34c7,0x34cb,0x34cf,0x34d3,0x34d7,0x34d7,
+0x34db,0x34e1,0x34e5,0x2c49,0x34e9,0x34ed,0x34f3,0x34f7,0x34fb,0x34ff,0x3503,0x3507,0x2f7d,0x350b,0x350f,0x3513,
+0x3519,0x351d,0x3523,0x3527,0x352b,0x352f,0x3533,0x3537,0x353b,0x353f,0x3543,0x3547,0x354b,0x354f,0x3555,0x3559,
+0x355d,0x3561,0x2b71,0x3565,0x356b,0x356f,0x356f,0x3575,0x3579,0x3579,0x357d,0x3581,0x3587,0x358d,0x3591,0x3595,
+0x3599,0x359d,0x35a1,0x35a5,0x35a9,0x35ad,0x35b1,0x2f81,0x35b5,0x35bb,0x35bf,0x35c3,0x308f,0x35c3,0x35c7,0x2f89,
+0x35cb,0x35cf,0x35d3,0x35d7,0x2f8d,0x2b05,0x35db,0x35df,0x35e3,0x35e7,0x35eb,0x35ef,0x35f3,0x35f9,0x35fd,0x3601,
+0x3605,0x3609,0x360d,0x3613,0x3617,0x361b,0x361f,0x3623,0x3627,0x362b,0x362f,0x3633,0x2f91,0x3637,0x363b,0x3641,
+0x3645,0x3649,0x364d,0x2f99,0x3651,0x3655,0x3659,0x365d,0x3661,0x3665,0x3669,0x366d,0x2b75,0x30af,0x3671,0x3675,
+0x3679,0x367d,0x3683,0x3687,0x368b,0x368f,0x2f9d,0x3693,0x3699,0x369d,0x36a1,0x3161,0x36a5,0x36a9,0x36ad,0x36b1,
+0x36b5,0x36bb,0x36bf,0x36c3,0x36c7,0x36cd,0x36d1,0x36d5,0x36d9,0x2c8d,0x36dd,0x36e1,0x36e7,0x36ed,0x36f3,0x36f7,
+0x36fd,0x3701,0x3705,0x3709,0x370d,0x2fa1,0x2de9,0x3711,0x3715,0x3719,0x371d,0x3723,0x3727,0x372b,0x372f,0x30bf,
+0x3733,0x3737,0x373d,0x3741,0x3745,0x374b,0x3751,0x3755,0x30c3,0x3759,0x375d,0x3761,0x3765,0x3769,0x376d,0x3771,
+0x3777,0x377b,0x3781,0x3785,0x378b,0x30cb,0x378f,0x3793,0x3799,0x379d,0x37a1,0x37a7,0x37ad,0x37b1,0x37b5,0x37b9,
+0x37bd,0x37bd,0x37c1,0x37c5,0x30d3,0x37c9,0x37cd,0x37d1,0x37d5,0x37d9,0x37df,0x37e3,0x2c55,0x37e9,0x37ef,0x37f3,
+0x37f9,0x37ff,0x3805,0x3809,0x30eb,0x380d,0x3813,0x3819,0x381f,0x3825,0x3829,0x3829,0x30ef,0x3169,0x382d,0x3831,
+0x3835,0x3839,0x383f,0x2bbd,0x30f7,0x3843,0x3847,0x2fcd,0x384d,0x3853,0x2f15,0x3859,0x385d,0x2fdd,0x3861,0x3865,
+0x3869,0x386f,0x386f,0x3875,0x3879,0x387d,0x3883,0x3887,0x388b,0x388f,0x3895,0x3899,0x389d,0x38a1,0x38a5,0x38a9,
+0x38af,0x38b3,0x38b7,0x38bb,0x38bf,0x38c3,0x38c7,0x38cd,0x38d3,0x38d7,0x38dd,0x38e1,0x38e7,0x38eb,0x2ff5,0x38ef,
+0x38f5,0x38fb,0x38ff,0x3905,0x3909,0x390f,0x3913,0x3917,0x391b,0x391f,0x3923,0x3927,0x392d,0x3933,0x3939,0x3575,
+0x393f,0x3943,0x3947,0x394b,0x394f,0x3953,0x3957,0x395b,0x395f,0x3963,0x3967,0x396b,0x2c9d,0x3971,0x3975,0x3979,
+0x397d,0x3981,0x3985,0x3001,0x3989,0x398d,0x3991,0x3995,0x3999,0x399f,0x39a5,0x39ab,0x39af,0x39b3,0x39b7,0x39bb,
+0x39c1,0x39c5,0x39cb,0x39cf,0x39d3,0x39d9,0x39df,0x39e3,0x2ba9,0x39e7,0x39eb,0x39ef,0x39f3,0x39f7,0x39fb,0x3113,
+0x39ff,0x3a03,0x3a07,0x3a0b,0x3a0f,0x3a13,0x3a17,0x3a1b,0x3a1f,0x3a23,0x3a29,0x3a2d,0x3a31,0x3a35,0x3a39,0x3a3d,
+0x3a43,0x3a49,0x3a4d,0x3a51,0x3127,0x312b,0x3a55,0x3a59,0x3a5f,0x3a63,0x3a67,0x3a6b,0x3a6f,0x3a75,0x3a7b,0x3a7f,
+0x3a83,0x3a87,0x3a8d,0x312f,0x3a91,0x3a97,0x3a9d,0x3aa1,0x3aa5,0x3aa9,0x3aaf,0x3ab3,0x3ab7,0x3abb,0x3abf,0x3ac3,
+0x3ac7,0x3acb,0x3ad1,0x3ad5,0x3ad9,0x3add,0x3ae3,0x3ae7,0x3aeb,0x3aef,0x3af3,0x3af9,0x3aff,0x3b03,0x3b07,0x3b0b,
+0x3b11,0x3b15,0x3147,0x3147,0x3b1b,0x3b1f,0x3b25,0x3b29,0x3b2d,0x3b31,0x3b35,0x3b39,0x3b3d,0x3b41,0x314b,0x3b47,
+0x3b4b,0x3b4f,0x3b53,0x3b57,0x3b5b,0x3b61,0x3b65,0x3b6b,0x3b71,0x3b77,0x3b7b,0x3b7f,0x3b83,0x3b87,0x3b8b,0x3b8f,
+0x3b93,0x3b97,1,1
};
-static const uint16_t norm2_nfc_data_trieIndex[1746]={
-0,0x40,0x7b,0xbb,0xfb,0x13a,0x17a,0x1b2,0x1f2,0x226,0x254,0x226,0x294,0x2d4,0x313,0x353,
-0x393,0x3d2,0x40f,0x44e,0x226,0x226,0x488,0x4c8,0x4f8,0x530,0x226,0x570,0x59f,0x5de,0x226,0x5f3,
-0x631,0x65f,0x226,0x68c,0x6cc,0x709,0x729,0x768,0x7a7,0x7e4,0x803,0x840,0x729,0x879,0x8a7,0x8e6,
-0x226,0x920,0x937,0x977,0x98e,0x9cd,0x226,0xa03,0xa23,0xa5e,0xa6a,0xaa5,0xacd,0xb0a,0xb4a,0xb84,
-0xb9f,0x226,0xbda,0x226,0xc1a,0xc39,0xc6f,0xcac,0x226,0x226,0x226,0x226,0x226,0xccf,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xcfb,0x226,0x226,0xd30,
-0x226,0x226,0xd4e,0x226,0xd78,0x226,0x226,0x226,0xdb4,0xdd4,0xe14,0xe53,0xe8e,0xece,0xf02,0xf2e,
-0x808,0x226,0x226,0xf62,0x226,0x226,0x226,0xfa2,0xfe2,0x1022,0x1062,0x10a2,0x10e2,0x1122,0x1162,0x11a2,
-0x11e2,0x226,0x226,0x1212,0x1243,0x226,0x1273,0x12a6,0x12e3,0x1322,0x1362,0x1398,0x13c6,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x13f1,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0xcbd,0x226,0x140e,0x226,0x144e,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x148e,0x14c8,0x1506,0x1546,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1585,0x15c3,0x15e3,0x226,0x226,0x226,0x226,
-0x161d,0x226,0x226,0x1645,0x1677,0x16a5,0x80c,0x16b8,0x226,0x226,0x16c8,0x1708,0x226,0x226,0x226,0x1420,
-0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,
-0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,
-0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,
-0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,
-0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,
-0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,
-0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,
-0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,
-0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,
-0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,
-0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x1794,0x226,
-0x17d4,0x180f,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x184f,0x188f,0x18cf,0x190f,0x194f,0x198f,0x19cf,0x1a0f,0x1a32,0x1a72,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1a92,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x655,0x664,0x67c,0x69b,0x6b0,0x6b0,0x6b0,0x6b4,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xbda,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x54f,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x40c,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1ac5,0x226,0x226,0x1ad5,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0xdc6,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1ae5,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x15d6,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x1aef,0x54f,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x7eb,0x226,0x226,
-0x9ba,0x226,0x1aff,0x1b0c,0x1b18,0x226,0x226,0x226,0x226,0x414,0x226,0x1b23,0x1b33,0x226,0x226,0x226,
-0x7e0,0x226,0x226,0x226,0x226,0x1b43,0x226,0x226,0x226,0x1b4e,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x1b55,0x226,0x226,0x226,0x226,0x1b60,0x1b6f,0x8f6,0x1b7d,0x412,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x1b8b,0x798,0x226,0x226,0x226,0x226,0x226,0x1b9b,0x1baa,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x8d6,0x1bb2,0x1bc2,0x226,
-0x226,0x226,0x9ba,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1bcc,0x226,0x226,0x226,0x226,0x226,
-0x226,0x7e6,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1bc9,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1bdc,
-0x7e0,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x84d,0x226,0x226,0x226,0x7ed,0x7ea,
-0x226,0x226,0x226,0x226,0x7e8,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x9ba,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xbd4,0x226,0x226,0x226,
-0x226,0x7ea,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x1bec,0x226,0x226,0x226,0xefb,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x1bfc,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1bfe,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x1c0d,0x1c1d,0x1c2b,0x1c38,0x226,0x1c44,0x1c52,0x1c62,0x226,0x226,
-0x226,0x226,0xcea,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1c72,0x1c7a,
-0x1c88,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0xefb,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x4fc,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x1c98,0x226,0x226,0x226,0x226,0x226,0x226,0x1ca4,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x1cb4,0x1cc4,0x1cd4,0x1ce4,0x1cf4,0x1d04,0x1d14,0x1d24,0x1d34,0x1d44,0x1d54,
-0x1d64,0x1d74,0x1d84,0x1d94,0x1da4,0x1db4,0x1dc4,0x1dd4,0x1de4,0x1df4,0x1e04,0x1e14,0x1e24,0x1e34,0x1e44,0x1e54,
-0x1e64,0x1e74,0x1e84,0x1e94,0x1ea4,0x1eb4,0x1ec4,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,
-0x226,0x226,0x226,0x226,0x226,0x408,0x428,0xc4,0xc4,0xc4,0x448,0x457,0x46d,0x489,0x4a6,0x4c2,
-0x4df,0x4fc,0x51b,0x538,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,
-0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x552,0xc4,0x566,0xc4,0xc4,0xc4,0xc4,
-0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,
-0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x586,0xc4,0xc4,0xc4,0xc4,0xc4,
-0xc4,0xc4,0xc4,0x591,0x5ae,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x5ce,0x5e2,0xc4,0xc4,0x5f5,
-0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,
-0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,
-0x615,0x635
+static const UCPTrie norm2_nfc_data_trie={
+ norm2_nfc_data_trieIndex,
+ { norm2_nfc_data_trieData },
+ 1746, 7892,
+ 0x2fc00, 0x30,
+ 0, 0,
+ 0, 0,
+ 0xc4, 0x226,
+ 0x1,
};
-static const uint16_t norm2_nfc_data_trieData[7892]={
-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,4,8,0xc,1,
-1,0x10,0x50,0x5c,0x70,0x88,0xcc,0xd0,0xec,0x108,0x144,0x148,0x15c,0x174,0x180,0x1a4,
-0x1e4,1,0x1ec,0x20c,0x228,0x244,0x290,0x298,0x2b0,0x2b8,0x2dc,1,1,1,1,1,
-1,0x2f4,0x334,0x340,0x354,0x36c,0x3b0,0x3b4,0x3d0,0x3f0,0x428,0x430,0x444,0x45c,0x468,0x48c,
-0x4cc,1,0x4d4,0x4f4,0x510,0x530,0x57c,0x584,0x5a0,0x5a8,0x5d0,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,0x5e8,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,0x128a,0x1290,0xae4,0x1296,0xafa,
-0xb04,0x5f4,0xb0e,0x129c,0x12a2,0xb18,0x12a8,0x12ae,0x12b4,0x12ba,0xb2e,1,0x12c0,0x12c6,0x12cc,0xb38,
-0xb4e,0xb60,1,0x5fc,0x12d2,0x12d8,0x12de,0xb6a,0x12e4,1,1,0x12ea,0x12f0,0xb80,0x12f6,0xb96,
-0xba0,0x600,0xbaa,0x12fc,0x1302,0xbb4,0x1308,0x130e,0x1314,0x131a,0xbca,1,0x1320,0x1326,0x132c,0xbd4,
-0xbea,0xbfc,1,0x608,0x1332,0x1338,0x133e,0xc06,0x1344,1,0x134a,0x1350,0x1356,0xc1c,0xc32,0x135d,
-0x1363,0x1368,0x136e,0x1374,0x137a,0x1380,0x1386,0x138c,0x1392,0x1398,0x139e,1,1,0xc48,0xc56,0x13a4,
-0x13aa,0x13b0,0x13b6,0x13bd,0x13c3,0x13c8,0x13ce,0x13d4,0x13da,0x13e0,0x13e6,0x13ec,0x13f2,0x13f9,0x13ff,0x1404,
-0x140a,1,1,0x1410,0x1416,0x141c,0x1422,0x1428,0x142e,0x1435,0x143b,0x1440,1,1,1,0x1447,
-0x144d,0x1453,0x1459,1,0x145e,0x1464,0x146b,0x1471,0x1476,0x147c,1,1,1,0x1482,0x1488,0x148f,
-0x1495,0x149a,0x14a0,1,1,1,0xc64,0xc72,0x14a6,0x14ac,0x14b2,0x14b8,1,1,0x14be,0x14c4,
-0x14cb,0x14d1,0x14d6,0x14dc,0xc80,0xc8a,0x14e2,0x14e8,0x14ef,0x14f5,0xc94,0xc9e,0x14fb,0x1501,0x1506,0x150c,
-1,1,0xca8,0xcb2,0xcbc,0xcc6,0x1512,0x1518,0x151e,0x1524,0x152a,0x1530,0x1537,0x153d,0x1542,0x1548,
-0x154e,0x1554,0x155a,0x1560,0x1566,0x156c,0x1572,0x1578,0x157e,0x60c,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,0xcd0,0xcea,1,1,1,1,
-1,1,1,1,1,1,1,1,1,0xd04,0xd1e,1,1,1,1,1,
-1,0x610,1,1,1,1,1,1,1,1,1,1,1,1,1,0x1584,
-0x158a,0x1590,0x1596,0x159c,0x15a2,0x15a8,0x15ae,0x15b6,0x15c0,0x15ca,0x15d4,0x15de,0x15e8,0x15f2,0x15fc,1,
-0x1606,0x1610,0x161a,0x1624,0x162d,0x1633,1,1,0x1638,0x163e,0x1644,0x164a,0xd38,0xd42,0x1653,0x165d,
-0x1665,0x166b,0x1671,1,1,1,0x1676,0x167c,1,1,0x1682,0x1688,0x1690,0x169a,0x16a3,0x16a9,
-0x16af,0x16b5,0x16ba,0x16c0,0x16c6,0x16cc,0x16d2,0x16d8,0x16de,0x16e4,0x16ea,0x16f0,0x16f6,0x16fc,0x1702,0x1708,
-0x170e,0x1714,0x171a,0x1720,0x1726,0x172c,0x1732,0x1738,0x173e,0x1744,0x174a,0x1750,0x1756,0x175c,1,1,
-0x1762,0x1768,1,1,1,1,1,1,0xd4c,0xd56,0xd60,0xd6a,0x1770,0x177a,0x1784,0x178e,
-0xd74,0xd7e,0x1798,0x17a2,0x17aa,0x17b0,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,0x614,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,0xfdcc,0xfdcc,0xfdcc,0xfdcc,0xfdcc,0xffcc,0xfdcc,0xfdcc,0xfdcc,0xfdcc,0xfdcc,0xfdcc,
-0xfdcc,0xffcc,0xffcc,0xfdcc,0xffcc,0xfdcc,0xffcc,0xfdcc,0xfdcc,0xffd0,0xffb8,0xffb8,0xffb8,0xffb8,0xffd0,0xfdb0,
-0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xff94,0xff94,0xfdb8,0xfdb8,0xfdb8,0xfdb8,0xfd94,0xfd94,0xffb8,0xffb8,0xffb8,
-0xffb8,0xfdb8,0xfdb8,0xffb8,0xfdb8,0xfdb8,0xffb8,0xffb8,0xfe02,0xfe02,0xfe02,0xfe02,0xfc02,0xffb8,0xffb8,0xffb8,
-0xffb8,0xffcc,0xffcc,0xffcc,0x3c36,0x3c3c,0xfdcc,0x3c42,0x3c48,0xfde0,0xffcc,0xffb8,0xffb8,0xffb8,0xffcc,0xffcc,
-0xffcc,0xffb8,0xffb8,1,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffcc,0xffd0,0xffb8,0xffb8,0xffcc,
-0xffd2,0xffd4,0xffd4,0xffd2,0xffd4,0xffd4,0xffd2,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
-0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,1,0x29e1,1,1,1,1,1,1,1,
-1,1,0x29e5,1,1,1,1,1,0x17b7,0x17bd,0x29e9,0x17c3,0x17c9,0x17cf,1,0x17d5,
-1,0x17db,0x17e1,0x17e9,0x618,1,1,1,0x634,1,0x644,1,0x658,1,1,1,
-1,1,0x674,1,0x684,1,1,1,0x688,1,1,1,0x6a0,0x17f1,0x17f7,0xd88,
-0x17fd,0xd92,0x1803,0x180b,0x6b4,1,1,1,0x6d4,1,0x6e4,1,0x6fc,1,1,1,
-1,1,0x71c,1,0x72c,1,1,1,0x734,1,1,1,0x754,0xd9c,0xdae,0x1813,
-0x1819,0xdc0,1,1,1,0x76c,0x181f,0x1825,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,0x182b,0x1831,1,0x1837,1,1,0x774,0x183d,1,1,1,1,0x1843,
-0x1849,0x184f,1,0x778,1,1,0x780,1,0x784,0x790,0x798,0x79c,0x1855,0x7ac,1,1,
-1,0x7b0,1,1,1,1,0x7b4,1,1,1,0x7c4,1,1,1,0x7c8,1,
-0x7cc,1,1,0x7d0,1,1,0x7d8,1,0x7dc,0x7e8,0x7f0,0x7f4,0x185b,0x804,1,1,
-1,0x808,1,1,1,0x80c,1,1,1,0x81c,1,1,1,0x820,1,0x824,
-1,1,0x1861,0x1867,1,0x186d,1,1,0x828,0x1873,1,1,1,1,0x1879,0x187f,
-0x1885,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,0x82c,0x830,0x188b,0x1891,1,1,1,1,1,1,
-1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,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,0x1897,
-0x189d,1,1,1,1,1,1,1,1,1,1,1,1,1,0x18a3,0x18a9,
-0x18af,0x18b5,1,1,0x18bb,0x18c1,0x834,0x838,0x18c7,0x18cd,0x18d3,0x18d9,0x18df,0x18e5,1,1,
-0x18eb,0x18f1,0x18f7,0x18fd,0x1903,0x1909,0x83c,0x840,0x190f,0x1915,0x191b,0x1921,0x1927,0x192d,0x1933,0x1939,
-0x193f,0x1945,0x194b,0x1951,1,1,0x1957,0x195d,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,
-0xffcc,0xffcc,0xffbc,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,
-0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffbc,0xffc8,0xffcc,0xfe14,0xfe16,0xfe18,0xfe1a,0xfe1c,0xfe1e,0xfe20,0xfe22,
-0xfe24,0xfe26,0xfe26,0xfe28,0xfe2a,0xfe2c,1,0xfe2e,1,0xfe30,0xfe32,1,0xffcc,0xffb8,1,0xfe24,
-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,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
-0xfe3c,0xfe3e,0xfe40,1,1,1,1,1,1,1,0x1962,0x1968,0x196f,0x1975,0x197b,0x844,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,0x850,1,0x854,0xfe36,0xfe38,0xfe3a,0xfe3c,0xfe3e,
-0xfe40,0xfe42,0xfe44,0xfdcc,0xfdcc,0xfdb8,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffb8,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-0xfe46,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-0x1981,0x858,0x1987,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,0x85c,0x198d,1,0x860,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1,0xffcc,
-0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,1,1,0xffcc,0xffcc,1,0xffb8,0xffcc,0xffcc,0xffb8,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-0xfe48,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,0xffcc,
-0xffb8,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffcc,0xffb8,0xffb8,0xffcc,0xffb8,0xffcc,0xffcc,
-0xffb8,0xffcc,0xffb8,0xffcc,0xffb8,0xffcc,0xffb8,0xffcc,0xffcc,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,0xffcc,0xffcc,
-0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,1,1,1,1,1,1,1,1,1,
-0xffb8,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,0xffcc,0xffcc,
-0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,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,0xffb8,0xffb8,0xffb8,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,0xffb8,
-0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffb8,
-0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xfe36,0xfe38,0xfe3a,0xffcc,
-0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffb8,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,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,0x864,0x1993,1,1,1,1,1,1,0x868,0x1999,1,0x86c,
-0x199f,1,1,1,1,1,1,1,0xfc0e,1,1,1,1,1,1,1,
-1,1,1,1,1,1,0xfe12,1,1,1,0xffcc,0xffb8,0xffcc,0xffcc,1,1,
-1,0x29ec,0x29f2,0x29f8,0x29fe,0x2a04,0x2a0a,0x2a10,0x2a16,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,0xfe0e,1,0xfc00,1,1,1,1,1,1,1,0x870,
-1,1,1,0x19a5,0x19ab,0xfe12,1,1,1,1,1,1,1,1,1,0xfc00,
-1,1,1,1,0x2a1c,0x2a22,1,0x2a28,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,0xffcc,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,0x2a2e,1,1,0x2a34,1,1,
-1,1,1,0xfe0e,1,1,1,1,1,1,1,1,1,1,1,1,
-1,0xfe12,1,1,1,1,1,1,1,1,1,1,1,0x2a3a,0x2a40,0x2a46,
-1,1,0x2a4c,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,0xfe0e,
-1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe12,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,
-0x878,0x19b1,1,1,0x19b7,0x19bd,0xfe12,1,1,1,1,1,1,1,1,0xfc00,
-0xfc00,1,1,1,1,0x2a52,0x2a58,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,0x884,1,0x19c3,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,0xfc00,1,1,1,1,1,1,0x888,0x890,1,1,
-0x19c9,0x19cf,0x19d5,0xfe12,1,1,1,1,1,1,1,1,1,0xfc00,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,0x894,1,0x19db,1,1,1,1,0xfe12,1,1,
-1,1,1,1,1,0xfea8,0xfcb6,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,0xfe0e,1,1,0x898,0x19e1,1,0xfc00,1,1,1,0x89c,0x19e7,0x19ed,
-1,0xdca,0x19f5,1,0xfe12,1,1,1,1,1,1,1,0xfc00,0xfc00,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,0xfe12,0xfe12,1,0xfc00,1,1,1,
-1,1,1,0x8a8,0x8b0,1,1,0x19fd,0x1a03,0x1a09,0xfe12,1,1,1,1,1,
-1,1,1,1,0xfc00,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,0xfc12,1,1,
-1,1,0xfc00,1,1,1,1,1,1,1,1,1,0x8b4,0x1a0f,1,0xdd4,
-0x1a17,0x1a1f,0xfc00,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,0xfece,0xfece,0xfe12,1,1,
-1,1,1,1,1,1,0xfed6,0xfed6,0xfed6,0xfed6,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,0xfeec,0xfeec,0xfe12,1,1,1,1,1,1,1,1,0xfef4,0xfef4,0xfef4,
-0xfef4,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,0xffb8,0xffb8,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,0xffb8,1,0xffb8,1,0xffb0,1,1,1,1,1,1,0x2a5f,1,1,
-1,1,1,1,1,1,1,0x2a65,1,1,1,1,0x2a6b,1,1,1,
-1,0x2a71,1,1,1,1,0x2a77,1,1,1,1,1,1,1,1,1,
-1,1,1,0x2a7d,1,1,1,1,1,1,1,0xff02,0xff04,0x3c50,0xff08,0x3c58,
-0x2a82,1,0x2a88,1,0xff04,0xff04,0xff04,0xff04,1,1,0xff04,0x3c60,0xffcc,0xffcc,0xfe12,1,
-0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,0x2a8f,1,1,
-1,1,1,1,1,1,1,0x2a95,1,1,1,1,0x2a9b,1,1,1,
-1,0x2aa1,1,1,1,1,0x2aa7,1,1,1,1,1,1,1,1,1,
-1,1,1,0x2aad,1,1,1,1,1,1,0xffb8,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,0x8c0,0x1a25,1,1,1,1,1,1,1,0xfc00,1,1,
-1,1,1,1,1,1,0xfe0e,1,0xfe12,0xfe12,1,1,1,1,1,1,
-1,1,1,1,1,1,1,0xffb8,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,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,2,2,2,2,2,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,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,
-0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,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,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,
-0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,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,0xffcc,0xffcc,0xffcc,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,0xfe12,
-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,0xfe12,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,0xfe12,1,1,1,1,1,1,1,1,1,1,0xffcc,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,0xffc8,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,0xffbc,0xffcc,0xffb8,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,0xffcc,0xffb8,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,0xfe12,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
-0xffcc,1,1,0xffb8,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,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffcc,
-0xffcc,0xffb8,1,0xffb8,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,0x8c4,0x1a2b,0x8c8,0x1a31,0x8cc,0x1a37,0x8d0,0x1a3d,0x8d4,0x1a43,1,1,0x8d8,
-0x1a49,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,0xfe0e,0xfc00,1,1,1,1,0x8dc,0x1a4f,0x8e0,0x1a55,0x8e4,0x8e8,0x1a5b,0x1a61,
-0x8ec,0x1a67,0xfe12,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,0xffcc,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
-0xffcc,0xffcc,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,0xfe12,0xfe12,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,0xfe0e,1,1,1,1,1,1,1,1,1,1,1,
-0xfe12,0xfe12,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,0xffcc,0xffcc,0xffcc,1,0xfe02,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffcc,0xffcc,0xffb8,0xffb8,
-0xffb8,0xffb8,0xffcc,1,0xfe02,0xfe02,0xfe02,0xfe02,0xfe02,0xfe02,0xfe02,1,1,1,1,0xffb8,
-1,1,1,1,1,1,0xffcc,1,1,1,0xffcc,0xffcc,1,1,1,1,
-1,1,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffd4,
-0xffac,0xffb8,0xff94,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
-0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
-0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffd0,0xffc8,0xffc8,0xffb8,1,0xffcc,0xffd2,0xffb8,
-0xffcc,0xffb8,0x1a6c,0x1a72,0x1a78,0x1a7e,0x1a85,0x1a8b,0x1a91,0x1a97,0x1a9f,0x1aa9,0x1ab0,0x1ab6,0x1abc,0x1ac2,
-0x1ac8,0x1ace,0x1ad5,0x1adb,0x1ae0,0x1ae6,0x1aee,0x1af8,0x1b02,0x1b0c,0x1b14,0x1b1a,0x1b20,0x1b26,0x1b2f,0x1b39,
-0x1b41,0x1b47,0x1b4c,0x1b52,0x1b58,0x1b5e,0x1b64,0x1b6a,0x1b70,0x1b76,0x1b7d,0x1b83,0x1b88,0x1b8e,0x1b94,0x1b9a,
-0x1ba2,0x1bac,0x1bb4,0x1bba,0x1bc0,0x1bc6,0x1bcc,0x1bd2,0xdde,0xde8,0x1bda,0x1be4,0x1bec,0x1bf2,0x1bf8,0x1bfe,
-0x1c04,0x1c0a,0x1c10,0x1c16,0x1c1d,0x1c23,0x1c28,0x1c2e,0x1c34,0x1c3a,0x1c40,0x1c46,0x1c4c,0x1c52,0x1c5a,0x1c64,
-0x1c6e,0x1c78,0x1c82,0x1c8c,0x1c96,0x1ca0,0x1ca9,0x1caf,0x1cb5,0x1cbb,0x1cc0,0x1cc6,0xdf2,0xdfc,0x1cce,0x1cd8,
-0x1ce0,0x1ce6,0x1cec,0x1cf2,0xe06,0xe10,0x1cfa,0x1d04,0x1d0e,0x1d18,0x1d22,0x1d2c,0x1d34,0x1d3a,0x1d40,0x1d46,
-0x1d4c,0x1d52,0x1d58,0x1d5e,0x1d64,0x1d6a,0x1d70,0x1d76,0x1d7c,0x1d82,0x1d8a,0x1d94,0x1d9e,0x1da8,0x1db0,0x1db6,
-0x1dbd,0x1dc3,0x1dc8,0x1dce,0x1dd4,0x1dda,0x1de0,0x1de6,0x1dec,0x1df2,0x1df9,0x1dff,0x1e05,0x1e0b,0x1e11,0x1e17,
-0x1e1c,0x1e22,0x1e28,0x1e2e,0x1e35,0x1e3b,0x1e41,0x1e47,0x1e4c,0x1e52,0x1e58,0x1e5e,1,0x1e65,1,1,
-1,1,0xe1a,0xe28,0x1e6a,0x1e70,0x1e78,0x1e82,0x1e8c,0x1e96,0x1ea0,0x1eaa,0x1eb4,0x1ebe,0x1ec8,0x1ed2,
-0x1edc,0x1ee6,0x1ef0,0x1efa,0x1f04,0x1f0e,0x1f18,0x1f22,0x1f2c,0x1f36,0xe36,0xe40,0x1f3e,0x1f44,0x1f4a,0x1f50,
-0x1f58,0x1f62,0x1f6c,0x1f76,0x1f80,0x1f8a,0x1f94,0x1f9e,0x1fa8,0x1fb2,0x1fba,0x1fc0,0x1fc6,0x1fcc,0xe4a,0xe54,
-0x1fd2,0x1fd8,0x1fe0,0x1fea,0x1ff4,0x1ffe,0x2008,0x2012,0x201c,0x2026,0x2030,0x203a,0x2044,0x204e,0x2058,0x2062,
-0x206c,0x2076,0x2080,0x208a,0x2094,0x209e,0x20a6,0x20ac,0x20b2,0x20b8,0x20c0,0x20ca,0x20d4,0x20de,0x20e8,0x20f2,
-0x20fc,0x2106,0x2110,0x211a,0x2122,0x2128,0x212f,0x2135,0x213a,0x2140,0x2146,0x214c,1,1,1,1,
-1,1,0xe5e,0xe74,0xe8c,0xe9a,0xea8,0xeb6,0xec4,0xed2,0xede,0xef4,0xf0c,0xf1a,0xf28,0xf36,
-0xf44,0xf52,0xf5e,0xf6c,0x2155,0x215f,0x2169,0x2173,1,1,0xf7a,0xf88,0x217d,0x2187,0x2191,0x219b,
-1,1,0xf96,0xfac,0xfc4,0xfd2,0xfe0,0xfee,0xffc,0x100a,0x1016,0x102c,0x1044,0x1052,0x1060,0x106e,
-0x107c,0x108a,0x1096,0x10a8,0x21a5,0x21af,0x21b9,0x21c3,0x21cd,0x21d7,0x10ba,0x10cc,0x21e1,0x21eb,0x21f5,0x21ff,
-0x2209,0x2213,0x10de,0x10ec,0x221d,0x2227,0x2231,0x223b,1,1,0x10fa,0x1108,0x2245,0x224f,0x2259,0x2263,
-1,1,0x1116,0x1128,0x226d,0x2277,0x2281,0x228b,0x2295,0x229f,1,0x113a,1,0x22a9,1,0x22b3,
-1,0x22bd,0x114c,0x1162,0x117a,0x1188,0x1196,0x11a4,0x11b2,0x11c0,0x11cc,0x11e2,0x11fa,0x1208,0x1216,0x1224,
-0x1232,0x1240,0x124c,0x3b9e,0x22c5,0x3ba6,0x1256,0x3bae,0x22cb,0x3bb6,0x22d1,0x3bbe,0x22d7,0x3bc6,0x1260,0x3bce,
-1,1,0x22de,0x22e8,0x22f7,0x2307,0x2317,0x2327,0x2337,0x2347,0x2352,0x235c,0x236b,0x237b,0x238b,0x239b,
-0x23ab,0x23bb,0x23c6,0x23d0,0x23df,0x23ef,0x23ff,0x240f,0x241f,0x242f,0x243a,0x2444,0x2453,0x2463,0x2473,0x2483,
-0x2493,0x24a3,0x24ae,0x24b8,0x24c7,0x24d7,0x24e7,0x24f7,0x2507,0x2517,0x2522,0x252c,0x253b,0x254b,0x255b,0x256b,
-0x257b,0x258b,0x2595,0x259b,0x25a3,0x25aa,0x25b3,1,0x126a,0x25bd,0x25c5,0x25cb,0x25d1,0x3bd6,0x25d6,1,
-0x2ab2,0x8f0,1,0x25dd,0x25e5,0x25ec,0x25f5,1,0x1274,0x25ff,0x2607,0x3bde,0x260d,0x3be6,0x2612,0x2619,
-0x261f,0x2625,0x262b,0x2631,0x2639,0x3bf0,1,1,0x2641,0x2649,0x2651,0x2657,0x265d,0x3bfa,1,0x2663,
-0x2669,0x266f,0x2675,0x267b,0x2683,0x3c04,0x268b,0x2691,0x2697,0x269f,0x26a7,0x26ad,0x26b3,0x3c0e,0x26b9,0x26bf,
-0x3c16,0x2ab7,1,1,0x26c7,0x26ce,0x26d7,1,0x127e,0x26e1,0x26e9,0x3c1e,0x26ef,0x3c26,0x26f4,0x2abb,
-0x8fc,1,0xfa09,0xfa09,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,0xffcc,0xffcc,0xfe02,0xfe02,0xffcc,0xffcc,0xffcc,0xffcc,0xfe02,0xfe02,0xfe02,0xffcc,0xffcc,1,
-1,1,1,0xffcc,1,1,1,0xfe02,0xfe02,0xffcc,0xffb8,0xffcc,0xfe02,0xfe02,0xffb8,0xffb8,
-0xffb8,0xffb8,0xffcc,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,0x2abe,1,1,1,0x2ac2,0x3c2e,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,0x908,1,0x90c,1,0x910,1,1,1,1,1,0x26fb,0x2701,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,0x2707,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,0x270d,0x2713,0x2719,0x914,1,0x918,1,0x91c,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,0x920,0x271f,1,1,1,0x924,0x2725,1,0x928,0x272b,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,0x92c,0x2731,0x930,0x2737,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x934,
-1,1,1,0x273d,1,0x938,0x2743,0x93c,1,0x2749,0x940,0x274f,1,1,1,0x944,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,0x2755,0x948,0x275b,1,0x94c,0x950,1,1,1,1,1,1,1,0x2761,
-0x2767,0x276d,0x2773,0x2779,0x954,0x958,0x277f,0x2785,0x95c,0x960,0x278b,0x2791,0x964,0x968,0x96c,0x970,
-1,1,0x2797,0x279d,0x974,0x978,0x27a3,0x27a9,0x97c,0x980,0x27af,0x27b5,1,1,1,1,
-1,1,1,0x984,0x988,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,0x98c,1,1,1,1,1,0x990,0x994,1,0x998,0x27bb,0x27c1,
-0x27c7,0x27cd,1,1,0x99c,0x9a0,0x9a4,0x9a8,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,0x27d3,0x27d9,0x27df,0x27e5,1,1,1,1,
-1,1,0x27eb,0x27f1,0x27f7,0x27fd,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,0x2ac7,
-0x2acb,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,0x2acf,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,0xfe12,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,0xffcc,0xffcc,
-0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
-0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,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,0xffb4,0xffc8,0xffd0,0xffbc,0xffc0,0xffc0,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x9ac,1,
-1,1,1,0x9b0,0x2803,0x9b4,0x2809,0x9b8,0x280f,0x9bc,0x2815,0x9c0,0x281b,0x9c4,0x2821,0x9c8,
-0x2827,0x9cc,0x282d,0x9d0,0x2833,0x9d4,0x2839,0x9d8,0x283f,0x9dc,0x2845,1,0x9e0,0x284b,0x9e4,0x2851,
-0x9e8,0x2857,1,1,1,1,1,0x9ec,0x285d,0x2863,0x9f4,0x2869,0x286f,0x9fc,0x2875,0x287b,
-0xa04,0x2881,0x2887,0xa0c,0x288d,0x2893,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,0x2899,1,1,1,1,0xfc10,
-0xfc10,1,1,0xa14,0x289f,1,1,1,1,1,1,1,0xa18,1,1,1,
-1,0xa1c,0x28a5,0xa20,0x28ab,0xa24,0x28b1,0xa28,0x28b7,0xa2c,0x28bd,0xa30,0x28c3,0xa34,0x28c9,0xa38,
-0x28cf,0xa3c,0x28d5,0xa40,0x28db,0xa44,0x28e1,0xa48,0x28e7,1,0xa4c,0x28ed,0xa50,0x28f3,0xa54,0x28f9,
-1,1,1,1,1,0xa58,0x28ff,0x2905,0xa60,0x290b,0x2911,0xa68,0x2917,0x291d,0xa70,0x2923,
-0x2929,0xa78,0x292f,0x2935,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,0xa80,0xa84,0xa88,0xa8c,1,0x293b,1,1,0x2941,0x2947,0x294d,
-0x2953,1,1,0xa90,0x2959,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,0xffcc,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
-0xffcc,0xffcc,0xffcc,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,0xffcc,0xffcc,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,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,0xfe12,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,0xfe12,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,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
-0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,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,0xffb8,0xffb8,0xffb8,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,0xfe12,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,0xffcc,1,0xffcc,0xffcc,0xffb8,1,1,0xffcc,
-0xffcc,1,1,1,1,1,0xffcc,0xffcc,1,0xffcc,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,0xfe12,1,
-1,1,1,1,1,1,1,1,0xae2,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,
-0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,
-0x1289,0x1289,0x1289,0x1289,0xae2,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,
-0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,
-0xae2,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,
-0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0xae2,0x1289,0x1289,0x1289,
-0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,
-0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,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,0x3c66,1,0x3c66,0x3c66,0x3c66,0x3c66,0x3c66,0x3c66,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x3c66,0x3c66,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,0x3c66,1,1,1,1,0x3c66,1,1,1,0x3c66,1,0x3c66,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,0x3b97,1,0x2ad5,
-0x2ad9,0x2add,0x2ae1,0x2ae5,0x2ae9,0x2aed,0x2af1,0x2af1,0x2af5,0x2af9,0x2afd,0x2b01,0x2b05,0x2b09,0x2b0d,0x2b11,
-0x2b15,0x2b19,0x2b1d,0x2b21,0x2b25,0x2b29,0x2b2d,0x2b31,0x2b35,0x2b39,0x2b3d,0x2b41,0x2b45,0x2b49,0x2b4d,0x2b51,
-0x2b55,0x2b59,0x2b5d,0x2b61,0x2b65,0x2b69,0x2b6d,0x2b71,0x2b75,0x2b79,0x2b7d,0x2b81,0x2b85,0x2b89,0x2b8d,0x2b91,
-0x2b95,0x2b99,0x2b9d,0x2ba1,0x2ba5,0x2ba9,0x2bad,0x2bb1,0x2bb5,0x2bb9,0x2bbd,0x2bc1,0x2bc5,0x2bc9,0x2bcd,0x2bd1,
-0x2bd5,0x2bd9,0x2bdd,0x2be1,0x2be5,0x2be9,0x2bed,0x2bf1,0x2bf5,0x2bf9,0x2bfd,0x2c01,0x2c05,0x2c09,0x2c0d,0x2c11,
-0x2c15,0x2c19,0x2c1d,0x2c21,0x2c25,0x2c29,0x2c2d,0x2c31,0x2c35,0x2c39,0x2c3d,0x2b21,0x2c41,0x2c45,0x2c49,0x2c4d,
-0x2c51,0x2c55,0x2c59,0x2c5d,0x2c61,0x2c65,0x2c69,0x2c6d,0x2c71,0x2c75,0x2c79,0x2c7d,0x2c81,0x2c85,0x2c89,0x2c8d,
-0x2c91,0x2c95,0x2c99,0x2c9d,0x2ca1,0x2ca5,0x2ca9,0x2cad,0x2cb1,0x2cb5,0x2cb9,0x2cbd,0x2cc1,0x2cc5,0x2cc9,0x2ccd,
-0x2cd1,0x2cd5,0x2cd9,0x2cdd,0x2ce1,0x2ce5,0x2ce9,0x2ced,0x2cf1,0x2cf5,0x2cf9,0x2cfd,0x2d01,0x2d05,0x2d09,0x2d0d,
-0x2d11,0x2d15,0x2d19,0x2d1d,0x2d21,0x2d25,0x2d29,0x2d2d,0x2d31,0x2d35,0x2d39,0x2d3d,0x2d41,0x2d45,0x2d49,0x2d4d,
-0x2c89,0x2d51,0x2d55,0x2d59,0x2d5d,0x2d61,0x2d65,0x2d69,0x2d6d,0x2c49,0x2d71,0x2d75,0x2d79,0x2d7d,0x2d81,0x2d85,
-0x2d89,0x2d8d,0x2d91,0x2d95,0x2d99,0x2d9d,0x2da1,0x2da5,0x2da9,0x2dad,0x2db1,0x2db5,0x2db9,0x2dbd,0x2b21,0x2dc1,
-0x2dc5,0x2dc9,0x2dcd,0x2dd1,0x2dd5,0x2dd9,0x2ddd,0x2de1,0x2de5,0x2de9,0x2ded,0x2df1,0x2df5,0x2df9,0x2dfd,0x2e01,
-0x2e05,0x2e09,0x2e0d,0x2e11,0x2e15,0x2e19,0x2e1d,0x2e21,0x2e25,0x2e29,0x2c51,0x2e2d,0x2e31,0x2e35,0x2e39,0x2e3d,
-0x2e41,0x2e45,0x2e49,0x2e4d,0x2e51,0x2e55,0x2e59,0x2e5d,0x2e61,0x2e65,0x2e69,0x2e6d,0x2e71,0x2e75,0x2e79,0x2e7d,
-0x2e81,0x2e85,0x2e89,0x2e8d,0x2e91,0x2e95,0x2e99,0x2e9d,0x2ea1,0x2ea5,0x2ea9,0x2ead,0x2eb1,0x2eb5,0x2eb9,0x2ebd,
-0x2ec1,0x2ec5,0x2ec9,0x2ecd,0x2ed1,0x2ed5,0x2ed9,0x2edd,0x2ee1,0x2ee5,0x2ee9,0x2eed,0x2ef1,1,1,0x2ef5,
-1,0x2ef9,1,1,0x2efd,0x2f01,0x2f05,0x2f09,0x2f0d,0x2f11,0x2f15,0x2f19,0x2f1d,0x2f21,1,0x2f25,
-1,0x2f29,1,1,0x2f2d,0x2f31,1,1,1,0x2f35,0x2f39,0x2f3d,0x2f41,0x2f45,0x2f49,0x2f4d,
-0x2f51,0x2f55,0x2f59,0x2f5d,0x2f61,0x2f65,0x2f69,0x2f6d,0x2f71,0x2f75,0x2f79,0x2f7d,0x2f81,0x2f85,0x2f89,0x2f8d,
-0x2f91,0x2f95,0x2f99,0x2f9d,0x2fa1,0x2fa5,0x2fa9,0x2fad,0x2fb1,0x2fb5,0x2fb9,0x2fbd,0x2fc1,0x2fc5,0x2fc9,0x2fcd,
-0x2fd1,0x2fd5,0x2fd9,0x2fdd,0x2fe1,0x2fe5,0x2d25,0x2fe9,0x2fed,0x2ff1,0x2ff5,0x2ff9,0x2ffd,0x2ffd,0x3001,0x3005,
-0x3009,0x300d,0x3011,0x3015,0x3019,0x301d,0x2f2d,0x3021,0x3025,0x3029,0x302d,0x3031,0x3037,1,1,0x303b,
-0x303f,0x3043,0x3047,0x304b,0x304f,0x3053,0x3057,0x2f65,0x305b,0x305f,0x3063,0x2ef5,0x3067,0x306b,0x306f,0x3073,
-0x3077,0x307b,0x307f,0x3083,0x3087,0x308b,0x308f,0x3093,0x2f89,0x3097,0x2f8d,0x309b,0x309f,0x30a3,0x30a7,0x30ab,
-0x2ef9,0x2b75,0x30af,0x30b3,0x30b7,0x2c8d,0x2de9,0x30bb,0x30bf,0x2fa9,0x30c3,0x2fad,0x30c7,0x30cb,0x30cf,0x2f01,
-0x30d3,0x30d7,0x30db,0x30df,0x30e3,0x2f05,0x30e7,0x30eb,0x30ef,0x30f3,0x30f7,0x30fb,0x2fe5,0x30ff,0x3103,0x2d25,
-0x3107,0x2ff5,0x310b,0x310f,0x3113,0x3117,0x311b,0x3009,0x311f,0x2f29,0x3123,0x300d,0x2c41,0x3127,0x3011,0x312b,
-0x3019,0x312f,0x3133,0x3137,0x313b,0x313f,0x3021,0x2f19,0x3143,0x3025,0x3147,0x3029,0x314b,0x2af1,0x314f,0x3155,
-0x315b,0x3161,0x3165,0x3169,0x316d,0x3173,0x3179,0x317f,0x3183,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,0x3186,
-0xfe34,0x318c,1,1,1,1,1,1,1,1,1,1,0x3192,0x3198,0x31a0,0x31aa,
-0x31b2,0x31b8,0x31be,0x31c4,0x31ca,0x31d0,0x31d6,0x31dc,0x31e2,1,0x31e8,0x31ee,0x31f4,0x31fa,0x3200,1,
-0x3206,1,0x320c,0x3212,1,0x3218,0x321e,1,0x3224,0x322a,0x3230,0x3236,0x323c,0x3242,0x3248,0x324e,
-0x3254,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,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,
-0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,0xffb8,1,0xffcc,1,1,1,1,1,1,1,1,0xffcc,0xfe02,0xffb8,
-1,1,1,1,0xfe12,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,
-1,1,1,1,1,0xffb8,0xffb8,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,0xffb8,0xffb8,0xffb8,1,
-1,1,1,1,1,1,1,1,0xa94,0x295f,0xa9a,0x2969,1,1,1,1,
-1,0xaa0,1,1,1,1,1,0x2973,1,1,1,1,1,1,1,1,
-1,0xfe12,0xfc0e,1,1,1,1,1,1,1,0xfc00,1,1,1,1,1,
-1,0x297d,0x2987,1,0xaa6,0xaac,0xfe12,0xfe12,1,1,1,1,1,1,1,1,
-1,1,1,0xfe12,1,1,1,1,1,1,1,1,1,0xfe0e,1,1,
-1,1,1,0xfe12,0xfe0e,1,1,1,1,1,1,1,1,1,0xfe0e,0xfe12,
-1,1,1,1,1,1,1,1,1,1,1,0xfe0e,0xfe0e,1,0xfc00,1,
-1,1,1,1,1,1,0xab2,1,1,1,0x2991,0x299b,0xfe12,1,1,1,
-1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,0xfe12,1,1,
-1,0xfe0e,1,1,1,1,1,1,1,1,1,0xfc00,1,1,1,1,
-1,1,1,1,0xabe,0xfc00,0x29a5,0x29af,0xfc00,0x29b9,1,1,0xfe12,0xfe0e,1,1,
-1,1,1,1,1,1,1,1,1,1,0xad0,0xad6,0x29c3,0x29cd,1,1,
-1,0xfe12,0xfe0e,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,0xfe12,0xfe0e,1,1,1,1,1,1,1,1,0xfc00,1,1,1,
-1,0xadc,1,1,0x29d7,1,1,1,1,0xfe12,0xfe12,1,0xfe02,0xfe02,0xfe02,0xfe02,
-0xfe02,1,1,1,1,1,1,1,1,1,1,1,0xfe0c,0xfe0c,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,0xfe02,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,0x325a,0x3264,0x3278,0x3290,0x32a8,
-0x32c0,0x32d8,0xffb0,0xffb0,0xfe02,0xfe02,0xfe02,1,1,1,0xffc4,0xffb0,0xffb0,0xffb0,1,1,
-1,1,1,1,1,1,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,1,1,0xffcc,0xffcc,0xffcc,
-0xffcc,0xffcc,0xffb8,0xffb8,1,1,1,1,1,1,1,1,1,1,0xffcc,0xffcc,
-0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,0x32e6,0x32f0,0x3304,
-0x331c,0x3334,0x334c,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,
-0xffcc,0xffcc,0xffcc,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,1,0xffcc,0xffcc,
-0xffcc,0xffcc,0xffcc,1,1,1,1,1,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,1,
-1,1,1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xfe0e,1,
-1,1,1,1,0x335b,0x335f,0x3363,0x3367,0x336d,0x2f4d,0x3371,0x3375,0x3379,0x337d,0x2f51,0x3381,
-0x3385,0x3389,0x2f55,0x338f,0x3393,0x3397,0x339b,0x33a1,0x33a5,0x33a9,0x33ad,0x33b3,0x33b7,0x33bb,0x33bf,0x303f,
-0x33c3,0x33c9,0x33cd,0x33d1,0x33d5,0x33d9,0x33dd,0x33e1,0x33e5,0x3053,0x2f59,0x2f5d,0x3057,0x33e9,0x33ed,0x2c59,
-0x33f1,0x2f61,0x33f5,0x33f9,0x33fd,0x3401,0x3401,0x3401,0x3405,0x340b,0x340f,0x3413,0x3417,0x341d,0x3421,0x3425,
-0x3429,0x342d,0x3431,0x3435,0x3439,0x343d,0x3441,0x3445,0x3449,0x344d,0x344d,0x305f,0x3451,0x3455,0x3459,0x345d,
-0x2f69,0x3461,0x3465,0x3469,0x2ebd,0x346d,0x3471,0x3475,0x3479,0x347d,0x3481,0x3485,0x3489,0x348d,0x3493,0x3497,
-0x349b,0x349f,0x34a3,0x34a7,0x34ab,0x34b1,0x34b7,0x34bb,0x34bf,0x34c3,0x34c7,0x34cb,0x34cf,0x34d3,0x34d7,0x34d7,
-0x34db,0x34e1,0x34e5,0x2c49,0x34e9,0x34ed,0x34f3,0x34f7,0x34fb,0x34ff,0x3503,0x3507,0x2f7d,0x350b,0x350f,0x3513,
-0x3519,0x351d,0x3523,0x3527,0x352b,0x352f,0x3533,0x3537,0x353b,0x353f,0x3543,0x3547,0x354b,0x354f,0x3555,0x3559,
-0x355d,0x3561,0x2b71,0x3565,0x356b,0x356f,0x356f,0x3575,0x3579,0x3579,0x357d,0x3581,0x3587,0x358d,0x3591,0x3595,
-0x3599,0x359d,0x35a1,0x35a5,0x35a9,0x35ad,0x35b1,0x2f81,0x35b5,0x35bb,0x35bf,0x35c3,0x308f,0x35c3,0x35c7,0x2f89,
-0x35cb,0x35cf,0x35d3,0x35d7,0x2f8d,0x2b05,0x35db,0x35df,0x35e3,0x35e7,0x35eb,0x35ef,0x35f3,0x35f9,0x35fd,0x3601,
-0x3605,0x3609,0x360d,0x3613,0x3617,0x361b,0x361f,0x3623,0x3627,0x362b,0x362f,0x3633,0x2f91,0x3637,0x363b,0x3641,
-0x3645,0x3649,0x364d,0x2f99,0x3651,0x3655,0x3659,0x365d,0x3661,0x3665,0x3669,0x366d,0x2b75,0x30af,0x3671,0x3675,
-0x3679,0x367d,0x3683,0x3687,0x368b,0x368f,0x2f9d,0x3693,0x3699,0x369d,0x36a1,0x3161,0x36a5,0x36a9,0x36ad,0x36b1,
-0x36b5,0x36bb,0x36bf,0x36c3,0x36c7,0x36cd,0x36d1,0x36d5,0x36d9,0x2c8d,0x36dd,0x36e1,0x36e7,0x36ed,0x36f3,0x36f7,
-0x36fd,0x3701,0x3705,0x3709,0x370d,0x2fa1,0x2de9,0x3711,0x3715,0x3719,0x371d,0x3723,0x3727,0x372b,0x372f,0x30bf,
-0x3733,0x3737,0x373d,0x3741,0x3745,0x374b,0x3751,0x3755,0x30c3,0x3759,0x375d,0x3761,0x3765,0x3769,0x376d,0x3771,
-0x3777,0x377b,0x3781,0x3785,0x378b,0x30cb,0x378f,0x3793,0x3799,0x379d,0x37a1,0x37a7,0x37ad,0x37b1,0x37b5,0x37b9,
-0x37bd,0x37bd,0x37c1,0x37c5,0x30d3,0x37c9,0x37cd,0x37d1,0x37d5,0x37d9,0x37df,0x37e3,0x2c55,0x37e9,0x37ef,0x37f3,
-0x37f9,0x37ff,0x3805,0x3809,0x30eb,0x380d,0x3813,0x3819,0x381f,0x3825,0x3829,0x3829,0x30ef,0x3169,0x382d,0x3831,
-0x3835,0x3839,0x383f,0x2bbd,0x30f7,0x3843,0x3847,0x2fcd,0x384d,0x3853,0x2f15,0x3859,0x385d,0x2fdd,0x3861,0x3865,
-0x3869,0x386f,0x386f,0x3875,0x3879,0x387d,0x3883,0x3887,0x388b,0x388f,0x3895,0x3899,0x389d,0x38a1,0x38a5,0x38a9,
-0x38af,0x38b3,0x38b7,0x38bb,0x38bf,0x38c3,0x38c7,0x38cd,0x38d3,0x38d7,0x38dd,0x38e1,0x38e7,0x38eb,0x2ff5,0x38ef,
-0x38f5,0x38fb,0x38ff,0x3905,0x3909,0x390f,0x3913,0x3917,0x391b,0x391f,0x3923,0x3927,0x392d,0x3933,0x3939,0x3575,
-0x393f,0x3943,0x3947,0x394b,0x394f,0x3953,0x3957,0x395b,0x395f,0x3963,0x3967,0x396b,0x2c9d,0x3971,0x3975,0x3979,
-0x397d,0x3981,0x3985,0x3001,0x3989,0x398d,0x3991,0x3995,0x3999,0x399f,0x39a5,0x39ab,0x39af,0x39b3,0x39b7,0x39bb,
-0x39c1,0x39c5,0x39cb,0x39cf,0x39d3,0x39d9,0x39df,0x39e3,0x2ba9,0x39e7,0x39eb,0x39ef,0x39f3,0x39f7,0x39fb,0x3113,
-0x39ff,0x3a03,0x3a07,0x3a0b,0x3a0f,0x3a13,0x3a17,0x3a1b,0x3a1f,0x3a23,0x3a29,0x3a2d,0x3a31,0x3a35,0x3a39,0x3a3d,
-0x3a43,0x3a49,0x3a4d,0x3a51,0x3127,0x312b,0x3a55,0x3a59,0x3a5f,0x3a63,0x3a67,0x3a6b,0x3a6f,0x3a75,0x3a7b,0x3a7f,
-0x3a83,0x3a87,0x3a8d,0x312f,0x3a91,0x3a97,0x3a9d,0x3aa1,0x3aa5,0x3aa9,0x3aaf,0x3ab3,0x3ab7,0x3abb,0x3abf,0x3ac3,
-0x3ac7,0x3acb,0x3ad1,0x3ad5,0x3ad9,0x3add,0x3ae3,0x3ae7,0x3aeb,0x3aef,0x3af3,0x3af9,0x3aff,0x3b03,0x3b07,0x3b0b,
-0x3b11,0x3b15,0x3147,0x3147,0x3b1b,0x3b1f,0x3b25,0x3b29,0x3b2d,0x3b31,0x3b35,0x3b39,0x3b3d,0x3b41,0x314b,0x3b47,
-0x3b4b,0x3b4f,0x3b53,0x3b57,0x3b5b,0x3b61,0x3b65,0x3b6b,0x3b71,0x3b77,0x3b7b,0x3b7f,0x3b83,0x3b87,0x3b8b,0x3b8f,
-0x3b93,0x3b97,1,1
-};
-
-static const UCPTrie norm2_nfc_data_trie={
- norm2_nfc_data_trieIndex,
- { norm2_nfc_data_trieData },
- 1746, 7892,
- 0x2fc00, 0x30,
- 0, 0,
- 0, 0,
- 0xc4, 0x226,
- 0x1,
-};
-
-static const uint16_t norm2_nfc_data_extraData[7732]={
+static const uint16_t norm2_nfc_data_extraData[7732]={
0xffff,0xffff,0x8670,0x44dc,0x8670,0x44c0,0x8670,0x44de,0x600,0x180,0x602,0x182,0x604,0x185,0x606,0x186,
0x608,0x200,0x60c,0x205,0x60e,0x44d,0x610,0x189,0x612,0x3d44,0x614,0x18b,0x618,0x39a,0x61e,0x400,
0x622,0x404,0x646,0x3d41,0x64a,0x3c00,0x8650,0x208,0x60e,0x3c04,0x646,0x3c08,0x8662,0x3c0c,0x602,0x20c,
@@ -727,409 +727,409 @@ static const uint16_t norm2_nfc_data_extraData[7732]={
0x6132,0x61a6,0xe134,0x61a8,0x6132,0x61ac,0xe134,0x61ae,0x6132,0x61b2,0xe134,0x61b4,0x6132,0x61b8,0xe134,0x61ba,
0xe132,0x61ee,0xe132,0x61f0,0xe132,0x61f2,0xe132,0x61f4,0xe132,0x61fc,0xb489,0x2e82,0x2134,0xb489,0x2e82,0x2138,
0xb489,0x2e82,0x2156,0xb489,0x49c2,0x225c,0xb489,0x49c2,0x225e,0x3489,0xcf82,0x2696,0xb489,0xd5c2,0x2698,0x348b,
-0x2c02,0x2978,0x348b,0x2e82,0x2976,0xb48b,0x2f42,0x297c,0xb48b,0x6bc2,0x2b74,0xb48b,0x6bc2,0x2b76,0xb48d,0x4c02,
-0x3270,2,0xe602,0x41,0x302,0x600,0x3d4c,0x602,0x3d48,0x606,0x3d54,0x8612,0x3d50,0xe602,0x41,0x308,
-0x8608,0x3bc,0xe602,0x41,0x30a,0x8602,0x3f4,0xca02,0x43,0x327,0x8602,0x3c10,0xe602,0x45,0x302,0x600,
-0x3d80,0x602,0x3d7c,0x606,0x3d88,0x8612,0x3d84,0xe602,0x49,0x308,0x8602,0x3c5c,0xe602,0x4f,0x302,0x600,
-0x3da4,0x602,0x3da0,0x606,0x3dac,0x8612,0x3da8,0xe602,0x4f,0x303,0x602,0x3c98,0x608,0x458,0x8610,0x3c9c,
-0xe602,0x4f,0x308,0x8608,0x454,0xe602,0x55,0x308,0x600,0x3b6,0x602,0x3ae,0x608,0x3aa,0x8618,0x3b2,
-0xe602,0x61,0x302,0x600,0x3d4e,0x602,0x3d4a,0x606,0x3d56,0x8612,0x3d52,0xe602,0x61,0x308,0x8608,0x3be,
-0xe602,0x61,0x30a,0x8602,0x3f6,0xca02,0x63,0x327,0x8602,0x3c12,0xe602,0x65,0x302,0x600,0x3d82,0x602,
-0x3d7e,0x606,0x3d8a,0x8612,0x3d86,0xe602,0x69,0x308,0x8602,0x3c5e,0xe602,0x6f,0x302,0x600,0x3da6,0x602,
-0x3da2,0x606,0x3dae,0x8612,0x3daa,0xe602,0x6f,0x303,0x602,0x3c9a,0x608,0x45a,0x8610,0x3c9e,0xe602,0x6f,
-0x308,0x8608,0x456,0xe602,0x75,0x308,0x600,0x3b8,0x602,0x3b0,0x608,0x3ac,0x8618,0x3b4,0xe602,0x41,
-0x306,0x600,0x3d60,0x602,0x3d5c,0x606,0x3d68,0x8612,0x3d64,0xe602,0x61,0x306,0x600,0x3d62,0x602,0x3d5e,
-0x606,0x3d6a,0x8612,0x3d66,0xe602,0x45,0x304,0x600,0x3c28,0x8602,0x3c2c,0xe602,0x65,0x304,0x600,0x3c2a,
-0x8602,0x3c2e,0xe602,0x4f,0x304,0x600,0x3ca0,0x8602,0x3ca4,0xe602,0x6f,0x304,0x600,0x3ca2,0x8602,0x3ca6,
-0xe602,0x53,0x301,0x860e,0x3cc8,0xe602,0x73,0x301,0x860e,0x3cca,0xe602,0x53,0x30c,0x860e,0x3ccc,0xe602,
-0x73,0x30c,0x860e,0x3cce,0xe602,0x55,0x303,0x8602,0x3cf0,0xe602,0x75,0x303,0x8602,0x3cf2,0xe602,0x55,
-0x304,0x8610,0x3cf4,0xe602,0x75,0x304,0x8610,0x3cf6,0xd802,0x4f,0x31b,0x600,0x3db8,0x602,0x3db4,0x606,
-0x3dc0,0x612,0x3dbc,0x8646,0x3dc4,0xd802,0x6f,0x31b,0x600,0x3dba,0x602,0x3db6,0x606,0x3dc2,0x612,0x3dbe,
-0x8646,0x3dc6,0xd802,0x55,0x31b,0x600,0x3dd4,0x602,0x3dd0,0x606,0x3ddc,0x612,0x3dd8,0x8646,0x3de0,0xd802,
-0x75,0x31b,0x600,0x3dd6,0x602,0x3dd2,0x606,0x3dde,0x612,0x3dda,0x8646,0x3de2,0xca02,0x4f,0x328,0x8608,
-0x3d8,0xca02,0x6f,0x328,0x8608,0x3da,0xe602,0x41,0x307,0x8608,0x3c0,0xe602,0x61,0x307,0x8608,0x3c2,
-0xca02,0x45,0x327,0x860c,0x3c38,0xca02,0x65,0x327,0x860c,0x3c3a,0xe602,0x4f,0x307,0x8608,0x460,0xe602,
-0x6f,0x307,0x8608,0x462,0xe602,0x3b1,0x301,0x868a,0x3f68,0xe602,0x3b7,0x301,0x868a,0x3f88,0xe602,0x3b9,
-0x308,0x600,0x3fa4,0x602,0x720,0x8684,0x3fae,0xe602,0x3c5,0x308,0x600,0x3fc4,0x602,0x760,0x8684,0x3fce,
-0xe602,0x3c9,0x301,0x868a,0x3fe8,2,0xcc6,0xcc2,0x99aa,0x1996,2,0xdd9,0xdcf,0x9b94,0x1bba,0xdc02,
-0x4c,0x323,0x8608,0x3c70,0xdc02,0x6c,0x323,0x8608,0x3c72,0xdc02,0x52,0x323,0x8608,0x3cb8,0xdc02,0x72,
-0x323,0x8608,0x3cba,0xdc02,0x53,0x323,0x860e,0x3cd0,0xdc02,0x73,0x323,0x860e,0x3cd2,0xdc02,0x41,0x323,
-0x604,0x3d58,0x860c,0x3d6c,0xdc02,0x61,0x323,0x604,0x3d5a,0x860c,0x3d6e,0xdc02,0x45,0x323,0x8604,0x3d8c,
-0xdc02,0x65,0x323,0x8604,0x3d8e,0xdc02,0x4f,0x323,0x8604,0x3db0,0xdc02,0x6f,0x323,0x8604,0x3db2,0xe602,
-0x3b1,0x313,0x600,0x3e05,0x602,0x3e09,0x684,0x3e0d,0x868a,0x3f00,0xe602,0x3b1,0x314,0x600,0x3e07,0x602,
-0x3e0b,0x684,0x3e0f,0x868a,0x3f02,0x1f00,0xe643,0x3b1,0x313,0x300,0x868a,0x3f04,0x1f01,0xe643,0x3b1,0x314,
-0x300,0x868a,0x3f06,0x1f00,0xe643,0x3b1,0x313,0x301,0x868a,0x3f08,0x1f01,0xe643,0x3b1,0x314,0x301,0x868a,
-0x3f0a,0x1f00,0xe643,0x3b1,0x313,0x342,0x868a,0x3f0c,0x1f01,0xe643,0x3b1,0x314,0x342,0x868a,0x3f0e,0xe602,
-0x391,0x313,0x600,0x3e15,0x602,0x3e19,0x684,0x3e1d,0x868a,0x3f10,0xe602,0x391,0x314,0x600,0x3e17,0x602,
-0x3e1b,0x684,0x3e1f,0x868a,0x3f12,0x1f08,0xe643,0x391,0x313,0x300,0x868a,0x3f14,0x1f09,0xe643,0x391,0x314,
-0x300,0x868a,0x3f16,0x1f08,0xe643,0x391,0x313,0x301,0x868a,0x3f18,0x1f09,0xe643,0x391,0x314,0x301,0x868a,
-0x3f1a,0x1f08,0xe643,0x391,0x313,0x342,0x868a,0x3f1c,0x1f09,0xe643,0x391,0x314,0x342,0x868a,0x3f1e,0xe602,
-0x3b5,0x313,0x600,0x3e24,0x8602,0x3e28,0xe602,0x3b5,0x314,0x600,0x3e26,0x8602,0x3e2a,0xe602,0x395,0x313,
-0x600,0x3e34,0x8602,0x3e38,0xe602,0x395,0x314,0x600,0x3e36,0x8602,0x3e3a,0xe602,0x3b7,0x313,0x600,0x3e45,
-0x602,0x3e49,0x684,0x3e4d,0x868a,0x3f20,0xe602,0x3b7,0x314,0x600,0x3e47,0x602,0x3e4b,0x684,0x3e4f,0x868a,
-0x3f22,0x1f20,0xe643,0x3b7,0x313,0x300,0x868a,0x3f24,0x1f21,0xe643,0x3b7,0x314,0x300,0x868a,0x3f26,0x1f20,
-0xe643,0x3b7,0x313,0x301,0x868a,0x3f28,0x1f21,0xe643,0x3b7,0x314,0x301,0x868a,0x3f2a,0x1f20,0xe643,0x3b7,
-0x313,0x342,0x868a,0x3f2c,0x1f21,0xe643,0x3b7,0x314,0x342,0x868a,0x3f2e,0xe602,0x397,0x313,0x600,0x3e55,
-0x602,0x3e59,0x684,0x3e5d,0x868a,0x3f30,0xe602,0x397,0x314,0x600,0x3e57,0x602,0x3e5b,0x684,0x3e5f,0x868a,
-0x3f32,0x1f28,0xe643,0x397,0x313,0x300,0x868a,0x3f34,0x1f29,0xe643,0x397,0x314,0x300,0x868a,0x3f36,0x1f28,
-0xe643,0x397,0x313,0x301,0x868a,0x3f38,0x1f29,0xe643,0x397,0x314,0x301,0x868a,0x3f3a,0x1f28,0xe643,0x397,
-0x313,0x342,0x868a,0x3f3c,0x1f29,0xe643,0x397,0x314,0x342,0x868a,0x3f3e,0xe602,0x3b9,0x313,0x600,0x3e64,
-0x602,0x3e68,0x8684,0x3e6c,0xe602,0x3b9,0x314,0x600,0x3e66,0x602,0x3e6a,0x8684,0x3e6e,0xe602,0x399,0x313,
-0x600,0x3e74,0x602,0x3e78,0x8684,0x3e7c,0xe602,0x399,0x314,0x600,0x3e76,0x602,0x3e7a,0x8684,0x3e7e,0xe602,
-0x3bf,0x313,0x600,0x3e84,0x8602,0x3e88,0xe602,0x3bf,0x314,0x600,0x3e86,0x8602,0x3e8a,0xe602,0x39f,0x313,
-0x600,0x3e94,0x8602,0x3e98,0xe602,0x39f,0x314,0x600,0x3e96,0x8602,0x3e9a,0xe602,0x3c5,0x313,0x600,0x3ea4,
-0x602,0x3ea8,0x8684,0x3eac,0xe602,0x3c5,0x314,0x600,0x3ea6,0x602,0x3eaa,0x8684,0x3eae,0xe602,0x3a5,0x314,
-0x600,0x3eb6,0x602,0x3eba,0x8684,0x3ebe,0xe602,0x3c9,0x313,0x600,0x3ec5,0x602,0x3ec9,0x684,0x3ecd,0x868a,
-0x3f40,0xe602,0x3c9,0x314,0x600,0x3ec7,0x602,0x3ecb,0x684,0x3ecf,0x868a,0x3f42,0x1f60,0xe643,0x3c9,0x313,
-0x300,0x868a,0x3f44,0x1f61,0xe643,0x3c9,0x314,0x300,0x868a,0x3f46,0x1f60,0xe643,0x3c9,0x313,0x301,0x868a,
-0x3f48,0x1f61,0xe643,0x3c9,0x314,0x301,0x868a,0x3f4a,0x1f60,0xe643,0x3c9,0x313,0x342,0x868a,0x3f4c,0x1f61,
-0xe643,0x3c9,0x314,0x342,0x868a,0x3f4e,0xe602,0x3a9,0x313,0x600,0x3ed5,0x602,0x3ed9,0x684,0x3edd,0x868a,
-0x3f50,0xe602,0x3a9,0x314,0x600,0x3ed7,0x602,0x3edb,0x684,0x3edf,0x868a,0x3f52,0x1f68,0xe643,0x3a9,0x313,
-0x300,0x868a,0x3f54,0x1f69,0xe643,0x3a9,0x314,0x300,0x868a,0x3f56,0x1f68,0xe643,0x3a9,0x313,0x301,0x868a,
-0x3f58,0x1f69,0xe643,0x3a9,0x314,0x301,0x868a,0x3f5a,0x1f68,0xe643,0x3a9,0x313,0x342,0x868a,0x3f5c,0x1f69,
-0xe643,0x3a9,0x314,0x342,0x868a,0x3f5e,0xe602,0x3b1,0x300,0x868a,0x3f64,0xe602,0x3b7,0x300,0x868a,0x3f84,
-0xe602,0x3c9,0x300,0x868a,0x3fe4,0xe602,0x3b1,0x342,0x868a,0x3f6e,0xe602,0x3b7,0x342,0x868a,0x3f8e,0xe602,
-0x3c9,0x342,0x868a,0x3fee,3,0xe602,0x41,0x300,0xe602,0x41,0x301,0xe602,0x41,0x303,0xe602,0x45,
-0x300,0xe602,0x45,0x301,0xe602,0x45,0x308,0xe602,0x49,0x300,0xe602,0x49,0x301,0xe602,0x49,0x302,
-0xe602,0x4e,0x303,0xe602,0x4f,0x300,0xe602,0x4f,0x301,0xe602,0x55,0x300,0xe602,0x55,0x301,0xe602,
-0x55,0x302,0xe602,0x59,0x301,0xe602,0x61,0x300,0xe602,0x61,0x301,0xe602,0x61,0x303,0xe602,0x65,
-0x300,0xe602,0x65,0x301,0xe602,0x65,0x308,0xe602,0x69,0x300,0xe602,0x69,0x301,0xe602,0x69,0x302,
-0xe602,0x6e,0x303,0xe602,0x6f,0x300,0xe602,0x6f,0x301,0xe602,0x75,0x300,0xe602,0x75,0x301,0xe602,
-0x75,0x302,0xe602,0x79,0x301,0xe602,0x79,0x308,0xe602,0x41,0x304,0xe602,0x61,0x304,0xca02,0x41,
-0x328,0xca02,0x61,0x328,0xe602,0x43,0x301,0xe602,0x63,0x301,0xe602,0x43,0x302,0xe602,0x63,0x302,
-0xe602,0x43,0x307,0xe602,0x63,0x307,0xe602,0x43,0x30c,0xe602,0x63,0x30c,0xe602,0x44,0x30c,0xe602,
-0x64,0x30c,0xe602,0x45,0x306,0xe602,0x65,0x306,0xe602,0x45,0x307,0xe602,0x65,0x307,0xca02,0x45,
-0x328,0xca02,0x65,0x328,0xe602,0x45,0x30c,0xe602,0x65,0x30c,0xe602,0x47,0x302,0xe602,0x67,0x302,
-0xe602,0x47,0x306,0xe602,0x67,0x306,0xe602,0x47,0x307,0xe602,0x67,0x307,0xca02,0x47,0x327,0xca02,
-0x67,0x327,0xe602,0x48,0x302,0xe602,0x68,0x302,0xe602,0x49,0x303,0xe602,0x69,0x303,0xe602,0x49,
-0x304,0xe602,0x69,0x304,0xe602,0x49,0x306,0xe602,0x69,0x306,0xca02,0x49,0x328,0xca02,0x69,0x328,
-0xe602,0x49,0x307,0xe602,0x4a,0x302,0xe602,0x6a,0x302,0xca02,0x4b,0x327,0xca02,0x6b,0x327,0xe602,
-0x4c,0x301,0xe602,0x6c,0x301,0xca02,0x4c,0x327,0xca02,0x6c,0x327,0xe602,0x4c,0x30c,0xe602,0x6c,
-0x30c,0xe602,0x4e,0x301,0xe602,0x6e,0x301,0xca02,0x4e,0x327,0xca02,0x6e,0x327,0xe602,0x4e,0x30c,
-0xe602,0x6e,0x30c,0xe602,0x4f,0x306,0xe602,0x6f,0x306,0xe602,0x4f,0x30b,0xe602,0x6f,0x30b,0xe602,
-0x52,0x301,0xe602,0x72,0x301,0xca02,0x52,0x327,0xca02,0x72,0x327,0xe602,0x52,0x30c,0xe602,0x72,
-0x30c,0xe602,0x53,0x302,0xe602,0x73,0x302,0xca02,0x53,0x327,0xca02,0x73,0x327,0xca02,0x54,0x327,
-0xca02,0x74,0x327,0xe602,0x54,0x30c,0xe602,0x74,0x30c,0xe602,0x55,0x306,0xe602,0x75,0x306,0xe602,
-0x55,0x30a,0xe602,0x75,0x30a,0xe602,0x55,0x30b,0xe602,0x75,0x30b,0xca02,0x55,0x328,0xca02,0x75,
-0x328,0xe602,0x57,0x302,0xe602,0x77,0x302,0xe602,0x59,0x302,0xe602,0x79,0x302,0xe602,0x59,0x308,
-0xe602,0x5a,0x301,0xe602,0x7a,0x301,0xe602,0x5a,0x307,0xe602,0x7a,0x307,0xe602,0x5a,0x30c,0xe602,
-0x7a,0x30c,0xe602,0x41,0x30c,0xe602,0x61,0x30c,0xe602,0x49,0x30c,0xe602,0x69,0x30c,0xe602,0x4f,
-0x30c,0xe602,0x6f,0x30c,0xe602,0x55,0x30c,0xe602,0x75,0x30c,0xdc,0xe643,0x55,0x308,0x304,0xfc,
-0xe643,0x75,0x308,0x304,0xdc,0xe643,0x55,0x308,0x301,0xfc,0xe643,0x75,0x308,0x301,0xdc,0xe643,
-0x55,0x308,0x30c,0xfc,0xe643,0x75,0x308,0x30c,0xdc,0xe643,0x55,0x308,0x300,0xfc,0xe643,0x75,
-0x308,0x300,0xc4,0xe643,0x41,0x308,0x304,0xe4,0xe643,0x61,0x308,0x304,0x226,0xe643,0x41,0x307,
-0x304,0x227,0xe643,0x61,0x307,0x304,0xe602,0xc6,0x304,0xe602,0xe6,0x304,0xe602,0x47,0x30c,0xe602,
-0x67,0x30c,0xe602,0x4b,0x30c,0xe602,0x6b,0x30c,0x1ea,0xe643,0x4f,0x328,0x304,0x1eb,0xe643,0x6f,
-0x328,0x304,0xe602,0x1b7,0x30c,0xe602,0x292,0x30c,0xe602,0x6a,0x30c,0xe602,0x47,0x301,0xe602,0x67,
-0x301,0xe602,0x4e,0x300,0xe602,0x6e,0x300,0xc5,0xe643,0x41,0x30a,0x301,0xe5,0xe643,0x61,0x30a,
-0x301,0xe602,0xc6,0x301,0xe602,0xe6,0x301,0xe602,0xd8,0x301,0xe602,0xf8,0x301,0xe602,0x41,0x30f,
-0xe602,0x61,0x30f,0xe602,0x41,0x311,0xe602,0x61,0x311,0xe602,0x45,0x30f,0xe602,0x65,0x30f,0xe602,
-0x45,0x311,0xe602,0x65,0x311,0xe602,0x49,0x30f,0xe602,0x69,0x30f,0xe602,0x49,0x311,0xe602,0x69,
-0x311,0xe602,0x4f,0x30f,0xe602,0x6f,0x30f,0xe602,0x4f,0x311,0xe602,0x6f,0x311,0xe602,0x52,0x30f,
-0xe602,0x72,0x30f,0xe602,0x52,0x311,0xe602,0x72,0x311,0xe602,0x55,0x30f,0xe602,0x75,0x30f,0xe602,
-0x55,0x311,0xe602,0x75,0x311,0xdc02,0x53,0x326,0xdc02,0x73,0x326,0xdc02,0x54,0x326,0xdc02,0x74,
-0x326,0xe602,0x48,0x30c,0xe602,0x68,0x30c,0xd6,0xe643,0x4f,0x308,0x304,0xf6,0xe643,0x6f,0x308,
-0x304,0xd5,0xe643,0x4f,0x303,0x304,0xf5,0xe643,0x6f,0x303,0x304,0x22e,0xe643,0x4f,0x307,0x304,
-0x22f,0xe643,0x6f,0x307,0x304,0xe602,0x59,0x304,0xe602,0x79,0x304,0xe602,0xa8,0x301,0xe602,0x391,
-0x301,0xe602,0x395,0x301,0xe602,0x397,0x301,0xe602,0x399,0x301,0xe602,0x39f,0x301,0xe602,0x3a5,0x301,
-0xe602,0x3a9,0x301,0x3ca,0xe643,0x3b9,0x308,0x301,0xe602,0x399,0x308,0xe602,0x3a5,0x308,0xe602,0x3b5,
-0x301,0xe602,0x3b9,0x301,0x3cb,0xe643,0x3c5,0x308,0x301,0xe602,0x3bf,0x301,0xe602,0x3c5,0x301,0xe602,
-0x3d2,0x301,0xe602,0x3d2,0x308,0xe602,0x415,0x300,0xe602,0x415,0x308,0xe602,0x413,0x301,0xe602,0x406,
-0x308,0xe602,0x41a,0x301,0xe602,0x418,0x300,0xe602,0x423,0x306,0xe602,0x418,0x306,0xe602,0x438,0x306,
-0xe602,0x435,0x300,0xe602,0x435,0x308,0xe602,0x433,0x301,0xe602,0x456,0x308,0xe602,0x43a,0x301,0xe602,
-0x438,0x300,0xe602,0x443,0x306,0xe602,0x474,0x30f,0xe602,0x475,0x30f,0xe602,0x416,0x306,0xe602,0x436,
-0x306,0xe602,0x410,0x306,0xe602,0x430,0x306,0xe602,0x410,0x308,0xe602,0x430,0x308,0xe602,0x415,0x306,
-0xe602,0x435,0x306,0xe602,0x4d8,0x308,0xe602,0x4d9,0x308,0xe602,0x416,0x308,0xe602,0x436,0x308,0xe602,
-0x417,0x308,0xe602,0x437,0x308,0xe602,0x418,0x304,0xe602,0x438,0x304,0xe602,0x418,0x308,0xe602,0x438,
-0x308,0xe602,0x41e,0x308,0xe602,0x43e,0x308,0xe602,0x4e8,0x308,0xe602,0x4e9,0x308,0xe602,0x42d,0x308,
-0xe602,0x44d,0x308,0xe602,0x423,0x304,0xe602,0x443,0x304,0xe602,0x423,0x308,0xe602,0x443,0x308,0xe602,
-0x423,0x30b,0xe602,0x443,0x30b,0xe602,0x427,0x308,0xe602,0x447,0x308,0xe602,0x42b,0x308,0xe602,0x44b,
-0x308,0xe602,0x627,0x653,0xe602,0x627,0x654,0xe602,0x648,0x654,0xdc02,0x627,0x655,0xe602,0x64a,0x654,
-0xe602,0x6d5,0x654,0xe602,0x6c1,0x654,0xe602,0x6d2,0x654,0x702,0x928,0x93c,0x702,0x930,0x93c,0x702,
-0x933,0x93c,2,0x9c7,0x9be,2,0x9c7,0x9d7,2,0xb47,0xb56,2,0xb47,0xb3e,2,0xb47,
-0xb57,2,0xb92,0xbd7,2,0xbc6,0xbbe,2,0xbc7,0xbbe,2,0xbc6,0xbd7,0x5b02,0xc46,0xc56,
-2,0xcbf,0xcd5,2,0xcc6,0xcd5,2,0xcc6,0xcd6,0xcca,0x43,0xcc6,0xcc2,0xcd5,2,0xd46,
-0xd3e,2,0xd47,0xd3e,2,0xd46,0xd57,0x902,0xdd9,0xdca,0xddc,0x943,0xdd9,0xdcf,0xdca,2,
-0xdd9,0xddf,2,0x1025,0x102e,2,0x1b05,0x1b35,2,0x1b07,0x1b35,2,0x1b09,0x1b35,2,0x1b0b,
-0x1b35,2,0x1b0d,0x1b35,2,0x1b11,0x1b35,2,0x1b3a,0x1b35,2,0x1b3c,0x1b35,2,0x1b3e,0x1b35,
-2,0x1b3f,0x1b35,2,0x1b42,0x1b35,0xdc02,0x41,0x325,0xdc02,0x61,0x325,0xe602,0x42,0x307,0xe602,
-0x62,0x307,0xdc02,0x42,0x323,0xdc02,0x62,0x323,0xdc02,0x42,0x331,0xdc02,0x62,0x331,0xc7,0xe643,
-0x43,0x327,0x301,0xe7,0xe643,0x63,0x327,0x301,0xe602,0x44,0x307,0xe602,0x64,0x307,0xdc02,0x44,
-0x323,0xdc02,0x64,0x323,0xdc02,0x44,0x331,0xdc02,0x64,0x331,0xca02,0x44,0x327,0xca02,0x64,0x327,
-0xdc02,0x44,0x32d,0xdc02,0x64,0x32d,0x112,0xe643,0x45,0x304,0x300,0x113,0xe643,0x65,0x304,0x300,
-0x112,0xe643,0x45,0x304,0x301,0x113,0xe643,0x65,0x304,0x301,0xdc02,0x45,0x32d,0xdc02,0x65,0x32d,
-0xdc02,0x45,0x330,0xdc02,0x65,0x330,0x228,0xe643,0x45,0x327,0x306,0x229,0xe643,0x65,0x327,0x306,
-0xe602,0x46,0x307,0xe602,0x66,0x307,0xe602,0x47,0x304,0xe602,0x67,0x304,0xe602,0x48,0x307,0xe602,
-0x68,0x307,0xdc02,0x48,0x323,0xdc02,0x68,0x323,0xe602,0x48,0x308,0xe602,0x68,0x308,0xca02,0x48,
-0x327,0xca02,0x68,0x327,0xdc02,0x48,0x32e,0xdc02,0x68,0x32e,0xdc02,0x49,0x330,0xdc02,0x69,0x330,
-0xcf,0xe643,0x49,0x308,0x301,0xef,0xe643,0x69,0x308,0x301,0xe602,0x4b,0x301,0xe602,0x6b,0x301,
-0xdc02,0x4b,0x323,0xdc02,0x6b,0x323,0xdc02,0x4b,0x331,0xdc02,0x6b,0x331,0x1e36,0xe643,0x4c,0x323,
-0x304,0x1e37,0xe643,0x6c,0x323,0x304,0xdc02,0x4c,0x331,0xdc02,0x6c,0x331,0xdc02,0x4c,0x32d,0xdc02,
-0x6c,0x32d,0xe602,0x4d,0x301,0xe602,0x6d,0x301,0xe602,0x4d,0x307,0xe602,0x6d,0x307,0xdc02,0x4d,
-0x323,0xdc02,0x6d,0x323,0xe602,0x4e,0x307,0xe602,0x6e,0x307,0xdc02,0x4e,0x323,0xdc02,0x6e,0x323,
-0xdc02,0x4e,0x331,0xdc02,0x6e,0x331,0xdc02,0x4e,0x32d,0xdc02,0x6e,0x32d,0xd5,0xe643,0x4f,0x303,
-0x301,0xf5,0xe643,0x6f,0x303,0x301,0xd5,0xe643,0x4f,0x303,0x308,0xf5,0xe643,0x6f,0x303,0x308,
-0x14c,0xe643,0x4f,0x304,0x300,0x14d,0xe643,0x6f,0x304,0x300,0x14c,0xe643,0x4f,0x304,0x301,0x14d,
-0xe643,0x6f,0x304,0x301,0xe602,0x50,0x301,0xe602,0x70,0x301,0xe602,0x50,0x307,0xe602,0x70,0x307,
-0xe602,0x52,0x307,0xe602,0x72,0x307,0x1e5a,0xe643,0x52,0x323,0x304,0x1e5b,0xe643,0x72,0x323,0x304,
-0xdc02,0x52,0x331,0xdc02,0x72,0x331,0xe602,0x53,0x307,0xe602,0x73,0x307,0x15a,0xe643,0x53,0x301,
-0x307,0x15b,0xe643,0x73,0x301,0x307,0x160,0xe643,0x53,0x30c,0x307,0x161,0xe643,0x73,0x30c,0x307,
-0x1e62,0xe643,0x53,0x323,0x307,0x1e63,0xe643,0x73,0x323,0x307,0xe602,0x54,0x307,0xe602,0x74,0x307,
-0xdc02,0x54,0x323,0xdc02,0x74,0x323,0xdc02,0x54,0x331,0xdc02,0x74,0x331,0xdc02,0x54,0x32d,0xdc02,
-0x74,0x32d,0xdc02,0x55,0x324,0xdc02,0x75,0x324,0xdc02,0x55,0x330,0xdc02,0x75,0x330,0xdc02,0x55,
-0x32d,0xdc02,0x75,0x32d,0x168,0xe643,0x55,0x303,0x301,0x169,0xe643,0x75,0x303,0x301,0x16a,0xe643,
-0x55,0x304,0x308,0x16b,0xe643,0x75,0x304,0x308,0xe602,0x56,0x303,0xe602,0x76,0x303,0xdc02,0x56,
-0x323,0xdc02,0x76,0x323,0xe602,0x57,0x300,0xe602,0x77,0x300,0xe602,0x57,0x301,0xe602,0x77,0x301,
-0xe602,0x57,0x308,0xe602,0x77,0x308,0xe602,0x57,0x307,0xe602,0x77,0x307,0xdc02,0x57,0x323,0xdc02,
-0x77,0x323,0xe602,0x58,0x307,0xe602,0x78,0x307,0xe602,0x58,0x308,0xe602,0x78,0x308,0xe602,0x59,
-0x307,0xe602,0x79,0x307,0xe602,0x5a,0x302,0xe602,0x7a,0x302,0xdc02,0x5a,0x323,0xdc02,0x7a,0x323,
-0xdc02,0x5a,0x331,0xdc02,0x7a,0x331,0xdc02,0x68,0x331,0xe602,0x74,0x308,0xe602,0x77,0x30a,0xe602,
-0x79,0x30a,0xe602,0x17f,0x307,0xe602,0x41,0x309,0xe602,0x61,0x309,0xc2,0xe643,0x41,0x302,0x301,
-0xe2,0xe643,0x61,0x302,0x301,0xc2,0xe643,0x41,0x302,0x300,0xe2,0xe643,0x61,0x302,0x300,0xc2,
-0xe643,0x41,0x302,0x309,0xe2,0xe643,0x61,0x302,0x309,0xc2,0xe643,0x41,0x302,0x303,0xe2,0xe643,
-0x61,0x302,0x303,0x1ea0,0xe643,0x41,0x323,0x302,0x1ea1,0xe643,0x61,0x323,0x302,0x102,0xe643,0x41,
-0x306,0x301,0x103,0xe643,0x61,0x306,0x301,0x102,0xe643,0x41,0x306,0x300,0x103,0xe643,0x61,0x306,
-0x300,0x102,0xe643,0x41,0x306,0x309,0x103,0xe643,0x61,0x306,0x309,0x102,0xe643,0x41,0x306,0x303,
-0x103,0xe643,0x61,0x306,0x303,0x1ea0,0xe643,0x41,0x323,0x306,0x1ea1,0xe643,0x61,0x323,0x306,0xe602,
-0x45,0x309,0xe602,0x65,0x309,0xe602,0x45,0x303,0xe602,0x65,0x303,0xca,0xe643,0x45,0x302,0x301,
-0xea,0xe643,0x65,0x302,0x301,0xca,0xe643,0x45,0x302,0x300,0xea,0xe643,0x65,0x302,0x300,0xca,
-0xe643,0x45,0x302,0x309,0xea,0xe643,0x65,0x302,0x309,0xca,0xe643,0x45,0x302,0x303,0xea,0xe643,
-0x65,0x302,0x303,0x1eb8,0xe643,0x45,0x323,0x302,0x1eb9,0xe643,0x65,0x323,0x302,0xe602,0x49,0x309,
-0xe602,0x69,0x309,0xdc02,0x49,0x323,0xdc02,0x69,0x323,0xe602,0x4f,0x309,0xe602,0x6f,0x309,0xd4,
-0xe643,0x4f,0x302,0x301,0xf4,0xe643,0x6f,0x302,0x301,0xd4,0xe643,0x4f,0x302,0x300,0xf4,0xe643,
-0x6f,0x302,0x300,0xd4,0xe643,0x4f,0x302,0x309,0xf4,0xe643,0x6f,0x302,0x309,0xd4,0xe643,0x4f,
-0x302,0x303,0xf4,0xe643,0x6f,0x302,0x303,0x1ecc,0xe643,0x4f,0x323,0x302,0x1ecd,0xe643,0x6f,0x323,
-0x302,0x1a0,0xe643,0x4f,0x31b,0x301,0x1a1,0xe643,0x6f,0x31b,0x301,0x1a0,0xe643,0x4f,0x31b,0x300,
-0x1a1,0xe643,0x6f,0x31b,0x300,0x1a0,0xe643,0x4f,0x31b,0x309,0x1a1,0xe643,0x6f,0x31b,0x309,0x1a0,
-0xe643,0x4f,0x31b,0x303,0x1a1,0xe643,0x6f,0x31b,0x303,0x1a0,0xdc43,0x4f,0x31b,0x323,0x1a1,0xdc43,
-0x6f,0x31b,0x323,0xdc02,0x55,0x323,0xdc02,0x75,0x323,0xe602,0x55,0x309,0xe602,0x75,0x309,0x1af,
-0xe643,0x55,0x31b,0x301,0x1b0,0xe643,0x75,0x31b,0x301,0x1af,0xe643,0x55,0x31b,0x300,0x1b0,0xe643,
-0x75,0x31b,0x300,0x1af,0xe643,0x55,0x31b,0x309,0x1b0,0xe643,0x75,0x31b,0x309,0x1af,0xe643,0x55,
-0x31b,0x303,0x1b0,0xe643,0x75,0x31b,0x303,0x1af,0xdc43,0x55,0x31b,0x323,0x1b0,0xdc43,0x75,0x31b,
-0x323,0xe602,0x59,0x300,0xe602,0x79,0x300,0xdc02,0x59,0x323,0xdc02,0x79,0x323,0xe602,0x59,0x309,
-0xe602,0x79,0x309,0xe602,0x59,0x303,0xe602,0x79,0x303,0x1f10,0xe643,0x3b5,0x313,0x300,0x1f11,0xe643,
-0x3b5,0x314,0x300,0x1f10,0xe643,0x3b5,0x313,0x301,0x1f11,0xe643,0x3b5,0x314,0x301,0x1f18,0xe643,0x395,
-0x313,0x300,0x1f19,0xe643,0x395,0x314,0x300,0x1f18,0xe643,0x395,0x313,0x301,0x1f19,0xe643,0x395,0x314,
-0x301,0x1f30,0xe643,0x3b9,0x313,0x300,0x1f31,0xe643,0x3b9,0x314,0x300,0x1f30,0xe643,0x3b9,0x313,0x301,
-0x1f31,0xe643,0x3b9,0x314,0x301,0x1f30,0xe643,0x3b9,0x313,0x342,0x1f31,0xe643,0x3b9,0x314,0x342,0x1f38,
-0xe643,0x399,0x313,0x300,0x1f39,0xe643,0x399,0x314,0x300,0x1f38,0xe643,0x399,0x313,0x301,0x1f39,0xe643,
-0x399,0x314,0x301,0x1f38,0xe643,0x399,0x313,0x342,0x1f39,0xe643,0x399,0x314,0x342,0x1f40,0xe643,0x3bf,
-0x313,0x300,0x1f41,0xe643,0x3bf,0x314,0x300,0x1f40,0xe643,0x3bf,0x313,0x301,0x1f41,0xe643,0x3bf,0x314,
-0x301,0x1f48,0xe643,0x39f,0x313,0x300,0x1f49,0xe643,0x39f,0x314,0x300,0x1f48,0xe643,0x39f,0x313,0x301,
-0x1f49,0xe643,0x39f,0x314,0x301,0x1f50,0xe643,0x3c5,0x313,0x300,0x1f51,0xe643,0x3c5,0x314,0x300,0x1f50,
-0xe643,0x3c5,0x313,0x301,0x1f51,0xe643,0x3c5,0x314,0x301,0x1f50,0xe643,0x3c5,0x313,0x342,0x1f51,0xe643,
-0x3c5,0x314,0x342,0x1f59,0xe643,0x3a5,0x314,0x300,0x1f59,0xe643,0x3a5,0x314,0x301,0x1f59,0xe643,0x3a5,
-0x314,0x342,0xe602,0x3b5,0x300,0xe602,0x3b9,0x300,0xe602,0x3bf,0x300,0xe602,0x3c5,0x300,0x1f00,0xf043,
-0x3b1,0x313,0x345,0x1f01,0xf043,0x3b1,0x314,0x345,0x1f02,0x345,2,0xf044,0x3b1,0x313,0x300,0x345,
-0x1f03,0x345,2,0xf044,0x3b1,0x314,0x300,0x345,0x1f04,0x345,2,0xf044,0x3b1,0x313,0x301,0x345,
-0x1f05,0x345,2,0xf044,0x3b1,0x314,0x301,0x345,0x1f06,0x345,2,0xf044,0x3b1,0x313,0x342,0x345,
-0x1f07,0x345,2,0xf044,0x3b1,0x314,0x342,0x345,0x1f08,0xf043,0x391,0x313,0x345,0x1f09,0xf043,0x391,
-0x314,0x345,0x1f0a,0x345,2,0xf044,0x391,0x313,0x300,0x345,0x1f0b,0x345,2,0xf044,0x391,0x314,
-0x300,0x345,0x1f0c,0x345,2,0xf044,0x391,0x313,0x301,0x345,0x1f0d,0x345,2,0xf044,0x391,0x314,
-0x301,0x345,0x1f0e,0x345,2,0xf044,0x391,0x313,0x342,0x345,0x1f0f,0x345,2,0xf044,0x391,0x314,
-0x342,0x345,0x1f20,0xf043,0x3b7,0x313,0x345,0x1f21,0xf043,0x3b7,0x314,0x345,0x1f22,0x345,2,0xf044,
-0x3b7,0x313,0x300,0x345,0x1f23,0x345,2,0xf044,0x3b7,0x314,0x300,0x345,0x1f24,0x345,2,0xf044,
-0x3b7,0x313,0x301,0x345,0x1f25,0x345,2,0xf044,0x3b7,0x314,0x301,0x345,0x1f26,0x345,2,0xf044,
-0x3b7,0x313,0x342,0x345,0x1f27,0x345,2,0xf044,0x3b7,0x314,0x342,0x345,0x1f28,0xf043,0x397,0x313,
-0x345,0x1f29,0xf043,0x397,0x314,0x345,0x1f2a,0x345,2,0xf044,0x397,0x313,0x300,0x345,0x1f2b,0x345,
-2,0xf044,0x397,0x314,0x300,0x345,0x1f2c,0x345,2,0xf044,0x397,0x313,0x301,0x345,0x1f2d,0x345,
-2,0xf044,0x397,0x314,0x301,0x345,0x1f2e,0x345,2,0xf044,0x397,0x313,0x342,0x345,0x1f2f,0x345,
-2,0xf044,0x397,0x314,0x342,0x345,0x1f60,0xf043,0x3c9,0x313,0x345,0x1f61,0xf043,0x3c9,0x314,0x345,
-0x1f62,0x345,2,0xf044,0x3c9,0x313,0x300,0x345,0x1f63,0x345,2,0xf044,0x3c9,0x314,0x300,0x345,
-0x1f64,0x345,2,0xf044,0x3c9,0x313,0x301,0x345,0x1f65,0x345,2,0xf044,0x3c9,0x314,0x301,0x345,
-0x1f66,0x345,2,0xf044,0x3c9,0x313,0x342,0x345,0x1f67,0x345,2,0xf044,0x3c9,0x314,0x342,0x345,
-0x1f68,0xf043,0x3a9,0x313,0x345,0x1f69,0xf043,0x3a9,0x314,0x345,0x1f6a,0x345,2,0xf044,0x3a9,0x313,
-0x300,0x345,0x1f6b,0x345,2,0xf044,0x3a9,0x314,0x300,0x345,0x1f6c,0x345,2,0xf044,0x3a9,0x313,
-0x301,0x345,0x1f6d,0x345,2,0xf044,0x3a9,0x314,0x301,0x345,0x1f6e,0x345,2,0xf044,0x3a9,0x313,
-0x342,0x345,0x1f6f,0x345,2,0xf044,0x3a9,0x314,0x342,0x345,0xe602,0x3b1,0x306,0xe602,0x3b1,0x304,
-0x1f70,0xf043,0x3b1,0x300,0x345,0xf002,0x3b1,0x345,0x3ac,0xf043,0x3b1,0x301,0x345,0x1fb6,0xf043,0x3b1,
-0x342,0x345,0xe602,0x391,0x306,0xe602,0x391,0x304,0xe602,0x391,0x300,0xf002,0x391,0x345,0xe602,0xa8,
-0x342,0x1f74,0xf043,0x3b7,0x300,0x345,0xf002,0x3b7,0x345,0x3ae,0xf043,0x3b7,0x301,0x345,0x1fc6,0xf043,
-0x3b7,0x342,0x345,0xe602,0x395,0x300,0xe602,0x397,0x300,0xf002,0x397,0x345,0xe602,0x1fbf,0x300,0xe602,
-0x1fbf,0x301,0xe602,0x1fbf,0x342,0xe602,0x3b9,0x306,0xe602,0x3b9,0x304,0x3ca,0xe643,0x3b9,0x308,0x300,
-0xe602,0x3b9,0x342,0x3ca,0xe643,0x3b9,0x308,0x342,0xe602,0x399,0x306,0xe602,0x399,0x304,0xe602,0x399,
-0x300,0xe602,0x1ffe,0x300,0xe602,0x1ffe,0x301,0xe602,0x1ffe,0x342,0xe602,0x3c5,0x306,0xe602,0x3c5,0x304,
-0x3cb,0xe643,0x3c5,0x308,0x300,0xe602,0x3c1,0x313,0xe602,0x3c1,0x314,0xe602,0x3c5,0x342,0x3cb,0xe643,
-0x3c5,0x308,0x342,0xe602,0x3a5,0x306,0xe602,0x3a5,0x304,0xe602,0x3a5,0x300,0xe602,0x3a1,0x314,0xe602,
-0xa8,0x300,0x1f7c,0xf043,0x3c9,0x300,0x345,0xf002,0x3c9,0x345,0x3ce,0xf043,0x3c9,0x301,0x345,0x1ff6,
-0xf043,0x3c9,0x342,0x345,0xe602,0x39f,0x300,0xe602,0x3a9,0x300,0xf002,0x3a9,0x345,0x102,0x2190,0x338,
-0x102,0x2192,0x338,0x102,0x2194,0x338,0x102,0x21d0,0x338,0x102,0x21d4,0x338,0x102,0x21d2,0x338,0x102,
-0x2203,0x338,0x102,0x2208,0x338,0x102,0x220b,0x338,0x102,0x2223,0x338,0x102,0x2225,0x338,0x102,0x223c,
-0x338,0x102,0x2243,0x338,0x102,0x2245,0x338,0x102,0x2248,0x338,0x102,0x3d,0x338,0x102,0x2261,0x338,
-0x102,0x224d,0x338,0x102,0x3c,0x338,0x102,0x3e,0x338,0x102,0x2264,0x338,0x102,0x2265,0x338,0x102,
-0x2272,0x338,0x102,0x2273,0x338,0x102,0x2276,0x338,0x102,0x2277,0x338,0x102,0x227a,0x338,0x102,0x227b,
-0x338,0x102,0x2282,0x338,0x102,0x2283,0x338,0x102,0x2286,0x338,0x102,0x2287,0x338,0x102,0x22a2,0x338,
-0x102,0x22a8,0x338,0x102,0x22a9,0x338,0x102,0x22ab,0x338,0x102,0x227c,0x338,0x102,0x227d,0x338,0x102,
-0x2291,0x338,0x102,0x2292,0x338,0x102,0x22b2,0x338,0x102,0x22b3,0x338,0x102,0x22b4,0x338,0x102,0x22b5,
-0x338,0x802,0x304b,0x3099,0x802,0x304d,0x3099,0x802,0x304f,0x3099,0x802,0x3051,0x3099,0x802,0x3053,0x3099,
-0x802,0x3055,0x3099,0x802,0x3057,0x3099,0x802,0x3059,0x3099,0x802,0x305b,0x3099,0x802,0x305d,0x3099,0x802,
-0x305f,0x3099,0x802,0x3061,0x3099,0x802,0x3064,0x3099,0x802,0x3066,0x3099,0x802,0x3068,0x3099,0x802,0x306f,
-0x3099,0x802,0x306f,0x309a,0x802,0x3072,0x3099,0x802,0x3072,0x309a,0x802,0x3075,0x3099,0x802,0x3075,0x309a,
-0x802,0x3078,0x3099,0x802,0x3078,0x309a,0x802,0x307b,0x3099,0x802,0x307b,0x309a,0x802,0x3046,0x3099,0x802,
-0x309d,0x3099,0x802,0x30ab,0x3099,0x802,0x30ad,0x3099,0x802,0x30af,0x3099,0x802,0x30b1,0x3099,0x802,0x30b3,
-0x3099,0x802,0x30b5,0x3099,0x802,0x30b7,0x3099,0x802,0x30b9,0x3099,0x802,0x30bb,0x3099,0x802,0x30bd,0x3099,
-0x802,0x30bf,0x3099,0x802,0x30c1,0x3099,0x802,0x30c4,0x3099,0x802,0x30c6,0x3099,0x802,0x30c8,0x3099,0x802,
-0x30cf,0x3099,0x802,0x30cf,0x309a,0x802,0x30d2,0x3099,0x802,0x30d2,0x309a,0x802,0x30d5,0x3099,0x802,0x30d5,
-0x309a,0x802,0x30d8,0x3099,0x802,0x30d8,0x309a,0x802,0x30db,0x3099,0x802,0x30db,0x309a,0x802,0x30a6,0x3099,
-0x802,0x30ef,0x3099,0x802,0x30f0,0x3099,0x802,0x30f1,0x3099,0x802,0x30f2,0x3099,0x802,0x30fd,0x3099,0x704,
-0xd804,0xdc99,0xd804,0xdcba,0x704,0xd804,0xdc9b,0xd804,0xdcba,0x704,0xd804,0xdca5,0xd804,0xdcba,4,0xd804,
-0xdd31,0xd804,0xdd27,4,0xd804,0xdd32,0xd804,0xdd27,4,0xd804,0xdf47,0xd804,0xdf3e,4,0xd804,0xdf47,
-0xd804,0xdf57,4,0xd805,0xdcb9,0xd805,0xdcba,4,0xd805,0xdcb9,0xd805,0xdcb0,4,0xd805,0xdcb9,0xd805,
-0xdcbd,4,0xd805,0xddb8,0xd805,0xddaf,4,0xd805,0xddb9,0xd805,0xddaf,4,0xd806,0xdd35,0xd806,0xdd30,
-1,0x2b9,1,0x3b,1,0xb7,0x702,0x915,0x93c,0x702,0x916,0x93c,0x702,0x917,0x93c,0x702,
-0x91c,0x93c,0x702,0x921,0x93c,0x702,0x922,0x93c,0x702,0x92b,0x93c,0x702,0x92f,0x93c,0x702,0x9a1,
-0x9bc,0x702,0x9a2,0x9bc,0x702,0x9af,0x9bc,0x702,0xa32,0xa3c,0x702,0xa38,0xa3c,0x702,0xa16,0xa3c,
-0x702,0xa17,0xa3c,0x702,0xa1c,0xa3c,0x702,0xa2b,0xa3c,0x702,0xb21,0xb3c,0x702,0xb22,0xb3c,2,
-0xf42,0xfb7,2,0xf4c,0xfb7,2,0xf51,0xfb7,2,0xf56,0xfb7,2,0xf5b,0xfb7,2,0xf40,
-0xfb5,0x8202,0xfb2,0xf80,0x8202,0xfb3,0xf80,2,0xf92,0xfb7,2,0xf9c,0xfb7,2,0xfa1,0xfb7,
-2,0xfa6,0xfb7,2,0xfab,0xfb7,2,0xf90,0xfb5,1,0x3b9,1,0x60,1,0xb4,1,
-0x3a9,1,0x4b,1,0x3008,1,0x3009,0x102,0x2add,0x338,1,0x8c48,1,0x66f4,1,0x8eca,
-1,0x8cc8,1,0x6ed1,1,0x4e32,1,0x53e5,1,0x9f9c,1,0x5951,1,0x91d1,1,0x5587,
-1,0x5948,1,0x61f6,1,0x7669,1,0x7f85,1,0x863f,1,0x87ba,1,0x88f8,1,0x908f,
-1,0x6a02,1,0x6d1b,1,0x70d9,1,0x73de,1,0x843d,1,0x916a,1,0x99f1,1,0x4e82,
-1,0x5375,1,0x6b04,1,0x721b,1,0x862d,1,0x9e1e,1,0x5d50,1,0x6feb,1,0x85cd,
-1,0x8964,1,0x62c9,1,0x81d8,1,0x881f,1,0x5eca,1,0x6717,1,0x6d6a,1,0x72fc,
-1,0x90ce,1,0x4f86,1,0x51b7,1,0x52de,1,0x64c4,1,0x6ad3,1,0x7210,1,0x76e7,
-1,0x8001,1,0x8606,1,0x865c,1,0x8def,1,0x9732,1,0x9b6f,1,0x9dfa,1,0x788c,
-1,0x797f,1,0x7da0,1,0x83c9,1,0x9304,1,0x9e7f,1,0x8ad6,1,0x58df,1,0x5f04,
-1,0x7c60,1,0x807e,1,0x7262,1,0x78ca,1,0x8cc2,1,0x96f7,1,0x58d8,1,0x5c62,
-1,0x6a13,1,0x6dda,1,0x6f0f,1,0x7d2f,1,0x7e37,1,0x964b,1,0x52d2,1,0x808b,
-1,0x51dc,1,0x51cc,1,0x7a1c,1,0x7dbe,1,0x83f1,1,0x9675,1,0x8b80,1,0x62cf,
-1,0x8afe,1,0x4e39,1,0x5be7,1,0x6012,1,0x7387,1,0x7570,1,0x5317,1,0x78fb,
-1,0x4fbf,1,0x5fa9,1,0x4e0d,1,0x6ccc,1,0x6578,1,0x7d22,1,0x53c3,1,0x585e,
-1,0x7701,1,0x8449,1,0x8aaa,1,0x6bba,1,0x8fb0,1,0x6c88,1,0x62fe,1,0x82e5,
-1,0x63a0,1,0x7565,1,0x4eae,1,0x5169,1,0x51c9,1,0x6881,1,0x7ce7,1,0x826f,
-1,0x8ad2,1,0x91cf,1,0x52f5,1,0x5442,1,0x5973,1,0x5eec,1,0x65c5,1,0x6ffe,
-1,0x792a,1,0x95ad,1,0x9a6a,1,0x9e97,1,0x9ece,1,0x529b,1,0x66c6,1,0x6b77,
-1,0x8f62,1,0x5e74,1,0x6190,1,0x6200,1,0x649a,1,0x6f23,1,0x7149,1,0x7489,
-1,0x79ca,1,0x7df4,1,0x806f,1,0x8f26,1,0x84ee,1,0x9023,1,0x934a,1,0x5217,
-1,0x52a3,1,0x54bd,1,0x70c8,1,0x88c2,1,0x5ec9,1,0x5ff5,1,0x637b,1,0x6bae,
-1,0x7c3e,1,0x7375,1,0x4ee4,1,0x56f9,1,0x5dba,1,0x601c,1,0x73b2,1,0x7469,
-1,0x7f9a,1,0x8046,1,0x9234,1,0x96f6,1,0x9748,1,0x9818,1,0x4f8b,1,0x79ae,
-1,0x91b4,1,0x96b8,1,0x60e1,1,0x4e86,1,0x50da,1,0x5bee,1,0x5c3f,1,0x6599,
-1,0x71ce,1,0x7642,1,0x84fc,1,0x907c,1,0x9f8d,1,0x6688,1,0x962e,1,0x5289,
-1,0x677b,1,0x67f3,1,0x6d41,1,0x6e9c,1,0x7409,1,0x7559,1,0x786b,1,0x7d10,
-1,0x985e,1,0x516d,1,0x622e,1,0x9678,1,0x502b,1,0x5d19,1,0x6dea,1,0x8f2a,
-1,0x5f8b,1,0x6144,1,0x6817,1,0x9686,1,0x5229,1,0x540f,1,0x5c65,1,0x6613,
-1,0x674e,1,0x68a8,1,0x6ce5,1,0x7406,1,0x75e2,1,0x7f79,1,0x88cf,1,0x88e1,
-1,0x91cc,1,0x96e2,1,0x533f,1,0x6eba,1,0x541d,1,0x71d0,1,0x7498,1,0x85fa,
-1,0x96a3,1,0x9c57,1,0x9e9f,1,0x6797,1,0x6dcb,1,0x81e8,1,0x7acb,1,0x7b20,
-1,0x7c92,1,0x72c0,1,0x7099,1,0x8b58,1,0x4ec0,1,0x8336,1,0x523a,1,0x5207,
-1,0x5ea6,1,0x62d3,1,0x7cd6,1,0x5b85,1,0x6d1e,1,0x66b4,1,0x8f3b,1,0x884c,
-1,0x964d,1,0x898b,1,0x5ed3,1,0x5140,1,0x55c0,1,0x585a,1,0x6674,1,0x51de,
-1,0x732a,1,0x76ca,1,0x793c,1,0x795e,1,0x7965,1,0x798f,1,0x9756,1,0x7cbe,
-1,0x7fbd,1,0x8612,1,0x8af8,1,0x9038,1,0x90fd,1,0x98ef,1,0x98fc,1,0x9928,
-1,0x9db4,1,0x90de,1,0x96b7,1,0x4fae,1,0x50e7,1,0x514d,1,0x52c9,1,0x52e4,
-1,0x5351,1,0x559d,1,0x5606,1,0x5668,1,0x5840,1,0x58a8,1,0x5c64,1,0x5c6e,
-1,0x6094,1,0x6168,1,0x618e,1,0x61f2,1,0x654f,1,0x65e2,1,0x6691,1,0x6885,
-1,0x6d77,1,0x6e1a,1,0x6f22,1,0x716e,1,0x722b,1,0x7422,1,0x7891,1,0x793e,
-1,0x7949,1,0x7948,1,0x7950,1,0x7956,1,0x795d,1,0x798d,1,0x798e,1,0x7a40,
-1,0x7a81,1,0x7bc0,1,0x7e09,1,0x7e41,1,0x7f72,1,0x8005,1,0x81ed,1,0x8279,
-1,0x8457,1,0x8910,1,0x8996,1,0x8b01,1,0x8b39,1,0x8cd3,1,0x8d08,1,0x8fb6,
-1,0x96e3,1,0x97ff,1,0x983b,1,0x6075,2,0xd850,0xdeee,1,0x8218,1,0x4e26,1,
-0x51b5,1,0x5168,1,0x4f80,1,0x5145,1,0x5180,1,0x52c7,1,0x52fa,1,0x5555,1,
-0x5599,1,0x55e2,1,0x58b3,1,0x5944,1,0x5954,1,0x5a62,1,0x5b28,1,0x5ed2,1,
-0x5ed9,1,0x5f69,1,0x5fad,1,0x60d8,1,0x614e,1,0x6108,1,0x6160,1,0x6234,1,
-0x63c4,1,0x641c,1,0x6452,1,0x6556,1,0x671b,1,0x6756,1,0x6b79,1,0x6edb,1,
-0x6ecb,1,0x701e,1,0x77a7,1,0x7235,1,0x72af,1,0x7471,1,0x7506,1,0x753b,1,
-0x761d,1,0x761f,1,0x76db,1,0x76f4,1,0x774a,1,0x7740,1,0x78cc,1,0x7ab1,1,
-0x7c7b,1,0x7d5b,1,0x7f3e,1,0x8352,1,0x83ef,1,0x8779,1,0x8941,1,0x8986,1,
-0x8abf,1,0x8acb,1,0x8aed,1,0x8b8a,1,0x8f38,1,0x9072,1,0x9199,1,0x9276,1,
-0x967c,1,0x97db,1,0x980b,1,0x9b12,2,0xd84a,0xdc4a,2,0xd84a,0xdc44,2,0xd84c,0xdfd5,
-1,0x3b9d,1,0x4018,1,0x4039,2,0xd854,0xde49,2,0xd857,0xdcd0,2,0xd85f,0xded3,1,
-0x9f43,1,0x9f8e,0xe02,0x5d9,0x5b4,0x1102,0x5f2,0x5b7,0x1802,0x5e9,0x5c1,0x1902,0x5e9,0x5c2,0xfb49,
-0x1843,0x5e9,0x5bc,0x5c1,0xfb49,0x1943,0x5e9,0x5bc,0x5c2,0x1102,0x5d0,0x5b7,0x1202,0x5d0,0x5b8,0x1502,
-0x5d0,0x5bc,0x1502,0x5d1,0x5bc,0x1502,0x5d2,0x5bc,0x1502,0x5d3,0x5bc,0x1502,0x5d4,0x5bc,0x1502,0x5d5,
-0x5bc,0x1502,0x5d6,0x5bc,0x1502,0x5d8,0x5bc,0x1502,0x5d9,0x5bc,0x1502,0x5da,0x5bc,0x1502,0x5db,0x5bc,
-0x1502,0x5dc,0x5bc,0x1502,0x5de,0x5bc,0x1502,0x5e0,0x5bc,0x1502,0x5e1,0x5bc,0x1502,0x5e3,0x5bc,0x1502,
-0x5e4,0x5bc,0x1502,0x5e6,0x5bc,0x1502,0x5e7,0x5bc,0x1502,0x5e8,0x5bc,0x1502,0x5e9,0x5bc,0x1502,0x5ea,
-0x5bc,0x1302,0x5d5,0x5b9,0x1702,0x5d1,0x5bf,0x1702,0x5db,0x5bf,0x1702,0x5e4,0x5bf,0xd804,0xd834,0xdd57,
-0xd834,0xdd65,0xd804,0xd834,0xdd58,0xd834,0xdd65,0xd834,0xdd5f,0xd834,0xdd6e,4,0xd846,0xd834,0xdd58,0xd834,
-0xdd65,0xd834,0xdd6e,0xd834,0xdd5f,0xd834,0xdd6f,4,0xd846,0xd834,0xdd58,0xd834,0xdd65,0xd834,0xdd6f,0xd834,
-0xdd5f,0xd834,0xdd70,4,0xd846,0xd834,0xdd58,0xd834,0xdd65,0xd834,0xdd70,0xd834,0xdd5f,0xd834,0xdd71,4,
-0xd846,0xd834,0xdd58,0xd834,0xdd65,0xd834,0xdd71,0xd834,0xdd5f,0xd834,0xdd72,4,0xd846,0xd834,0xdd58,0xd834,
-0xdd65,0xd834,0xdd72,0xd804,0xd834,0xddb9,0xd834,0xdd65,0xd804,0xd834,0xddba,0xd834,0xdd65,0xd834,0xddbb,0xd834,
-0xdd6e,4,0xd846,0xd834,0xddb9,0xd834,0xdd65,0xd834,0xdd6e,0xd834,0xddbc,0xd834,0xdd6e,4,0xd846,0xd834,
-0xddba,0xd834,0xdd65,0xd834,0xdd6e,0xd834,0xddbb,0xd834,0xdd6f,4,0xd846,0xd834,0xddb9,0xd834,0xdd65,0xd834,
-0xdd6f,0xd834,0xddbc,0xd834,0xdd6f,4,0xd846,0xd834,0xddba,0xd834,0xdd65,0xd834,0xdd6f,1,0x4e3d,1,
-0x4e38,1,0x4e41,2,0xd840,0xdd22,1,0x4f60,1,0x4fbb,1,0x5002,1,0x507a,1,0x5099,
-1,0x50cf,1,0x349e,2,0xd841,0xde3a,1,0x5154,1,0x5164,1,0x5177,2,0xd841,0xdd1c,
-1,0x34b9,1,0x5167,1,0x518d,2,0xd841,0xdd4b,1,0x5197,1,0x51a4,1,0x4ecc,1,
-0x51ac,2,0xd864,0xdddf,1,0x51f5,1,0x5203,1,0x34df,1,0x523b,1,0x5246,1,0x5272,
-1,0x5277,1,0x3515,1,0x5305,1,0x5306,1,0x5349,1,0x535a,1,0x5373,1,0x537d,
-1,0x537f,2,0xd842,0xde2c,1,0x7070,1,0x53ca,1,0x53df,2,0xd842,0xdf63,1,0x53eb,
-1,0x53f1,1,0x5406,1,0x549e,1,0x5438,1,0x5448,1,0x5468,1,0x54a2,1,0x54f6,
-1,0x5510,1,0x5553,1,0x5563,1,0x5584,1,0x55ab,1,0x55b3,1,0x55c2,1,0x5716,
-1,0x5717,1,0x5651,1,0x5674,1,0x58ee,1,0x57ce,1,0x57f4,1,0x580d,1,0x578b,
-1,0x5832,1,0x5831,1,0x58ac,2,0xd845,0xdce4,1,0x58f2,1,0x58f7,1,0x5906,1,
-0x591a,1,0x5922,1,0x5962,2,0xd845,0xdea8,2,0xd845,0xdeea,1,0x59ec,1,0x5a1b,1,
-0x5a27,1,0x59d8,1,0x5a66,1,0x36ee,1,0x36fc,1,0x5b08,1,0x5b3e,2,0xd846,0xddc8,
-1,0x5bc3,1,0x5bd8,1,0x5bf3,2,0xd846,0xdf18,1,0x5bff,1,0x5c06,1,0x5f53,1,
-0x5c22,1,0x3781,1,0x5c60,1,0x5cc0,1,0x5c8d,2,0xd847,0xdde4,1,0x5d43,2,0xd847,
-0xdde6,1,0x5d6e,1,0x5d6b,1,0x5d7c,1,0x5de1,1,0x5de2,1,0x382f,1,0x5dfd,1,
-0x5e28,1,0x5e3d,1,0x5e69,1,0x3862,2,0xd848,0xdd83,1,0x387c,1,0x5eb0,1,0x5eb3,
-1,0x5eb6,2,0xd868,0xdf92,1,0x5efe,2,0xd848,0xdf31,1,0x8201,1,0x5f22,1,0x38c7,
-2,0xd84c,0xdeb8,2,0xd858,0xddda,1,0x5f62,1,0x5f6b,1,0x38e3,1,0x5f9a,1,0x5fcd,
-1,0x5fd7,1,0x5ff9,1,0x6081,1,0x393a,1,0x391c,2,0xd849,0xded4,1,0x60c7,1,
-0x6148,1,0x614c,1,0x617a,1,0x61b2,1,0x61a4,1,0x61af,1,0x61de,1,0x6210,1,
-0x621b,1,0x625d,1,0x62b1,1,0x62d4,1,0x6350,2,0xd84a,0xdf0c,1,0x633d,1,0x62fc,
-1,0x6368,1,0x6383,1,0x63e4,2,0xd84a,0xdff1,1,0x6422,1,0x63c5,1,0x63a9,1,
-0x3a2e,1,0x6469,1,0x647e,1,0x649d,1,0x6477,1,0x3a6c,1,0x656c,2,0xd84c,0xdc0a,
-1,0x65e3,1,0x66f8,1,0x6649,1,0x3b19,1,0x3b08,1,0x3ae4,1,0x5192,1,0x5195,
-1,0x6700,1,0x669c,1,0x80ad,1,0x43d9,1,0x6721,1,0x675e,1,0x6753,2,0xd84c,
-0xdfc3,1,0x3b49,1,0x67fa,1,0x6785,1,0x6852,2,0xd84d,0xdc6d,1,0x688e,1,0x681f,
-1,0x6914,1,0x6942,1,0x69a3,1,0x69ea,1,0x6aa8,2,0xd84d,0xdea3,1,0x6adb,1,
-0x3c18,1,0x6b21,2,0xd84e,0xdca7,1,0x6b54,1,0x3c4e,1,0x6b72,1,0x6b9f,1,0x6bbb,
-2,0xd84e,0xde8d,2,0xd847,0xdd0b,2,0xd84e,0xdefa,1,0x6c4e,2,0xd84f,0xdcbc,1,0x6cbf,
-1,0x6ccd,1,0x6c67,1,0x6d16,1,0x6d3e,1,0x6d69,1,0x6d78,1,0x6d85,2,0xd84f,
-0xdd1e,1,0x6d34,1,0x6e2f,1,0x6e6e,1,0x3d33,1,0x6ec7,2,0xd84f,0xded1,1,0x6df9,
-1,0x6f6e,2,0xd84f,0xdf5e,2,0xd84f,0xdf8e,1,0x6fc6,1,0x7039,1,0x701b,1,0x3d96,
-1,0x704a,1,0x707d,1,0x7077,1,0x70ad,2,0xd841,0xdd25,1,0x7145,2,0xd850,0xde63,
-1,0x719c,2,0xd850,0xdfab,1,0x7228,1,0x7250,2,0xd851,0xde08,1,0x7280,1,0x7295,
-2,0xd851,0xdf35,2,0xd852,0xdc14,1,0x737a,1,0x738b,1,0x3eac,1,0x73a5,1,0x3eb8,
-1,0x7447,1,0x745c,1,0x7485,1,0x74ca,1,0x3f1b,1,0x7524,2,0xd853,0xdc36,1,
-0x753e,2,0xd853,0xdc92,2,0xd848,0xdd9f,1,0x7610,2,0xd853,0xdfa1,2,0xd853,0xdfb8,2,
-0xd854,0xdc44,1,0x3ffc,1,0x4008,2,0xd854,0xdcf3,2,0xd854,0xdcf2,2,0xd854,0xdd19,2,
-0xd854,0xdd33,1,0x771e,1,0x771f,1,0x778b,1,0x4046,1,0x4096,2,0xd855,0xdc1d,1,
-0x784e,1,0x40e3,2,0xd855,0xde26,2,0xd855,0xde9a,2,0xd855,0xdec5,1,0x79eb,1,0x412f,
-1,0x7a4a,1,0x7a4f,2,0xd856,0xdd7c,2,0xd856,0xdea7,1,0x7aee,1,0x4202,2,0xd856,
-0xdfab,1,0x7bc6,1,0x7bc9,1,0x4227,2,0xd857,0xdc80,1,0x7cd2,1,0x42a0,1,0x7ce8,
-1,0x7ce3,1,0x7d00,2,0xd857,0xdf86,1,0x7d63,1,0x4301,1,0x7dc7,1,0x7e02,1,
-0x7e45,1,0x4334,2,0xd858,0xde28,2,0xd858,0xde47,1,0x4359,2,0xd858,0xded9,1,0x7f7a,
-2,0xd858,0xdf3e,1,0x7f95,1,0x7ffa,2,0xd859,0xdcda,2,0xd859,0xdd23,1,0x8060,2,
-0xd859,0xdda8,1,0x8070,2,0xd84c,0xdf5f,1,0x43d5,1,0x80b2,1,0x8103,1,0x440b,1,
-0x813e,1,0x5ab5,2,0xd859,0xdfa7,2,0xd859,0xdfb5,2,0xd84c,0xdf93,2,0xd84c,0xdf9c,1,
-0x8204,1,0x8f9e,1,0x446b,1,0x8291,1,0x828b,1,0x829d,1,0x52b3,1,0x82b1,1,
-0x82b3,1,0x82bd,1,0x82e6,2,0xd85a,0xdf3c,1,0x831d,1,0x8363,1,0x83ad,1,0x8323,
-1,0x83bd,1,0x83e7,1,0x8353,1,0x83ca,1,0x83cc,1,0x83dc,2,0xd85b,0xdc36,2,
-0xd85b,0xdd6b,2,0xd85b,0xdcd5,1,0x452b,1,0x84f1,1,0x84f3,1,0x8516,2,0xd85c,0xdfca,
-1,0x8564,2,0xd85b,0xdf2c,1,0x455d,1,0x4561,2,0xd85b,0xdfb1,2,0xd85c,0xdcd2,1,
-0x456b,1,0x8650,1,0x8667,1,0x8669,1,0x86a9,1,0x8688,1,0x870e,1,0x86e2,1,
-0x8728,1,0x876b,1,0x8786,1,0x45d7,1,0x87e1,1,0x8801,1,0x45f9,1,0x8860,1,
-0x8863,2,0xd85d,0xde67,1,0x88d7,1,0x88de,1,0x4635,1,0x88fa,1,0x34bb,2,0xd85e,
-0xdcae,2,0xd85e,0xdd66,1,0x46be,1,0x46c7,1,0x8aa0,1,0x8c55,2,0xd85f,0xdca8,1,
-0x8cab,1,0x8cc1,1,0x8d1b,1,0x8d77,2,0xd85f,0xdf2f,2,0xd842,0xdc04,1,0x8dcb,1,
-0x8dbc,1,0x8df0,2,0xd842,0xdcde,1,0x8ed4,2,0xd861,0xddd2,2,0xd861,0xdded,1,0x9094,
-1,0x90f1,1,0x9111,2,0xd861,0xdf2e,1,0x911b,1,0x9238,1,0x92d7,1,0x92d8,1,
-0x927c,1,0x93f9,1,0x9415,2,0xd862,0xdffa,1,0x958b,1,0x4995,1,0x95b7,2,0xd863,
-0xdd77,1,0x49e6,1,0x96c3,1,0x5db2,1,0x9723,2,0xd864,0xdd45,2,0xd864,0xde1a,1,
-0x4a6e,1,0x4a76,1,0x97e0,2,0xd865,0xdc0a,1,0x4ab2,2,0xd865,0xdc96,1,0x9829,2,
-0xd865,0xddb6,1,0x98e2,1,0x4b33,1,0x9929,1,0x99a7,1,0x99c2,1,0x99fe,1,0x4bce,
-2,0xd866,0xdf30,1,0x9c40,1,0x9cfd,1,0x4cce,1,0x4ced,1,0x9d67,2,0xd868,0xdcce,
-1,0x4cf8,2,0xd868,0xdd05,2,0xd868,0xde0e,2,0xd868,0xde91,1,0x9ebb,1,0x4d56,1,
-0x9ef9,1,0x9efe,1,0x9f05,1,0x9f0f,1,0x9f16,1,0x9f3b,2,0xd869,0xde00,0x3ac,0xe642,
-0x3b1,0x301,0x3ad,0xe642,0x3b5,0x301,0x3ae,0xe642,0x3b7,0x301,0x3af,0xe642,0x3b9,0x301,0x3cc,0xe642,
-0x3bf,0x301,0x3cd,0xe642,0x3c5,0x301,0x3ce,0xe642,0x3c9,0x301,0x386,0xe642,0x391,0x301,0x388,0xe642,
-0x395,0x301,0x389,0xe642,0x397,0x301,0x390,1,0xe643,0x3b9,0x308,0x301,0x38a,0xe642,0x399,0x301,
-0x3b0,1,0xe643,0x3c5,0x308,0x301,0x38e,0xe642,0x3a5,0x301,0x385,0xe642,0xa8,0x301,0x38c,0xe642,
-0x39f,0x301,0x38f,0xe642,0x3a9,0x301,0xc5,0xe642,0x41,0x30a,0xe6e6,0xe681,0x300,0xe6e6,0xe681,0x301,
-0xe6e6,0xe681,0x313,0xe6e6,0xe682,0x308,0x301,0x8100,0x8282,0xf71,0xf72,0x8100,0x8482,0xf71,0xf74,0x8100,
-0x8282,0xf71,0xf80,0
+0x2c02,0x2978,0x348b,0x2e82,0x2976,0xb48b,0x2f42,0x297c,0xb48b,0x6bc2,0x2b74,0xb48b,0x6bc2,0x2b76,0xb48d,0x4c02,
+0x3270,2,0xe602,0x41,0x302,0x600,0x3d4c,0x602,0x3d48,0x606,0x3d54,0x8612,0x3d50,0xe602,0x41,0x308,
+0x8608,0x3bc,0xe602,0x41,0x30a,0x8602,0x3f4,0xca02,0x43,0x327,0x8602,0x3c10,0xe602,0x45,0x302,0x600,
+0x3d80,0x602,0x3d7c,0x606,0x3d88,0x8612,0x3d84,0xe602,0x49,0x308,0x8602,0x3c5c,0xe602,0x4f,0x302,0x600,
+0x3da4,0x602,0x3da0,0x606,0x3dac,0x8612,0x3da8,0xe602,0x4f,0x303,0x602,0x3c98,0x608,0x458,0x8610,0x3c9c,
+0xe602,0x4f,0x308,0x8608,0x454,0xe602,0x55,0x308,0x600,0x3b6,0x602,0x3ae,0x608,0x3aa,0x8618,0x3b2,
+0xe602,0x61,0x302,0x600,0x3d4e,0x602,0x3d4a,0x606,0x3d56,0x8612,0x3d52,0xe602,0x61,0x308,0x8608,0x3be,
+0xe602,0x61,0x30a,0x8602,0x3f6,0xca02,0x63,0x327,0x8602,0x3c12,0xe602,0x65,0x302,0x600,0x3d82,0x602,
+0x3d7e,0x606,0x3d8a,0x8612,0x3d86,0xe602,0x69,0x308,0x8602,0x3c5e,0xe602,0x6f,0x302,0x600,0x3da6,0x602,
+0x3da2,0x606,0x3dae,0x8612,0x3daa,0xe602,0x6f,0x303,0x602,0x3c9a,0x608,0x45a,0x8610,0x3c9e,0xe602,0x6f,
+0x308,0x8608,0x456,0xe602,0x75,0x308,0x600,0x3b8,0x602,0x3b0,0x608,0x3ac,0x8618,0x3b4,0xe602,0x41,
+0x306,0x600,0x3d60,0x602,0x3d5c,0x606,0x3d68,0x8612,0x3d64,0xe602,0x61,0x306,0x600,0x3d62,0x602,0x3d5e,
+0x606,0x3d6a,0x8612,0x3d66,0xe602,0x45,0x304,0x600,0x3c28,0x8602,0x3c2c,0xe602,0x65,0x304,0x600,0x3c2a,
+0x8602,0x3c2e,0xe602,0x4f,0x304,0x600,0x3ca0,0x8602,0x3ca4,0xe602,0x6f,0x304,0x600,0x3ca2,0x8602,0x3ca6,
+0xe602,0x53,0x301,0x860e,0x3cc8,0xe602,0x73,0x301,0x860e,0x3cca,0xe602,0x53,0x30c,0x860e,0x3ccc,0xe602,
+0x73,0x30c,0x860e,0x3cce,0xe602,0x55,0x303,0x8602,0x3cf0,0xe602,0x75,0x303,0x8602,0x3cf2,0xe602,0x55,
+0x304,0x8610,0x3cf4,0xe602,0x75,0x304,0x8610,0x3cf6,0xd802,0x4f,0x31b,0x600,0x3db8,0x602,0x3db4,0x606,
+0x3dc0,0x612,0x3dbc,0x8646,0x3dc4,0xd802,0x6f,0x31b,0x600,0x3dba,0x602,0x3db6,0x606,0x3dc2,0x612,0x3dbe,
+0x8646,0x3dc6,0xd802,0x55,0x31b,0x600,0x3dd4,0x602,0x3dd0,0x606,0x3ddc,0x612,0x3dd8,0x8646,0x3de0,0xd802,
+0x75,0x31b,0x600,0x3dd6,0x602,0x3dd2,0x606,0x3dde,0x612,0x3dda,0x8646,0x3de2,0xca02,0x4f,0x328,0x8608,
+0x3d8,0xca02,0x6f,0x328,0x8608,0x3da,0xe602,0x41,0x307,0x8608,0x3c0,0xe602,0x61,0x307,0x8608,0x3c2,
+0xca02,0x45,0x327,0x860c,0x3c38,0xca02,0x65,0x327,0x860c,0x3c3a,0xe602,0x4f,0x307,0x8608,0x460,0xe602,
+0x6f,0x307,0x8608,0x462,0xe602,0x3b1,0x301,0x868a,0x3f68,0xe602,0x3b7,0x301,0x868a,0x3f88,0xe602,0x3b9,
+0x308,0x600,0x3fa4,0x602,0x720,0x8684,0x3fae,0xe602,0x3c5,0x308,0x600,0x3fc4,0x602,0x760,0x8684,0x3fce,
+0xe602,0x3c9,0x301,0x868a,0x3fe8,2,0xcc6,0xcc2,0x99aa,0x1996,2,0xdd9,0xdcf,0x9b94,0x1bba,0xdc02,
+0x4c,0x323,0x8608,0x3c70,0xdc02,0x6c,0x323,0x8608,0x3c72,0xdc02,0x52,0x323,0x8608,0x3cb8,0xdc02,0x72,
+0x323,0x8608,0x3cba,0xdc02,0x53,0x323,0x860e,0x3cd0,0xdc02,0x73,0x323,0x860e,0x3cd2,0xdc02,0x41,0x323,
+0x604,0x3d58,0x860c,0x3d6c,0xdc02,0x61,0x323,0x604,0x3d5a,0x860c,0x3d6e,0xdc02,0x45,0x323,0x8604,0x3d8c,
+0xdc02,0x65,0x323,0x8604,0x3d8e,0xdc02,0x4f,0x323,0x8604,0x3db0,0xdc02,0x6f,0x323,0x8604,0x3db2,0xe602,
+0x3b1,0x313,0x600,0x3e05,0x602,0x3e09,0x684,0x3e0d,0x868a,0x3f00,0xe602,0x3b1,0x314,0x600,0x3e07,0x602,
+0x3e0b,0x684,0x3e0f,0x868a,0x3f02,0x1f00,0xe643,0x3b1,0x313,0x300,0x868a,0x3f04,0x1f01,0xe643,0x3b1,0x314,
+0x300,0x868a,0x3f06,0x1f00,0xe643,0x3b1,0x313,0x301,0x868a,0x3f08,0x1f01,0xe643,0x3b1,0x314,0x301,0x868a,
+0x3f0a,0x1f00,0xe643,0x3b1,0x313,0x342,0x868a,0x3f0c,0x1f01,0xe643,0x3b1,0x314,0x342,0x868a,0x3f0e,0xe602,
+0x391,0x313,0x600,0x3e15,0x602,0x3e19,0x684,0x3e1d,0x868a,0x3f10,0xe602,0x391,0x314,0x600,0x3e17,0x602,
+0x3e1b,0x684,0x3e1f,0x868a,0x3f12,0x1f08,0xe643,0x391,0x313,0x300,0x868a,0x3f14,0x1f09,0xe643,0x391,0x314,
+0x300,0x868a,0x3f16,0x1f08,0xe643,0x391,0x313,0x301,0x868a,0x3f18,0x1f09,0xe643,0x391,0x314,0x301,0x868a,
+0x3f1a,0x1f08,0xe643,0x391,0x313,0x342,0x868a,0x3f1c,0x1f09,0xe643,0x391,0x314,0x342,0x868a,0x3f1e,0xe602,
+0x3b5,0x313,0x600,0x3e24,0x8602,0x3e28,0xe602,0x3b5,0x314,0x600,0x3e26,0x8602,0x3e2a,0xe602,0x395,0x313,
+0x600,0x3e34,0x8602,0x3e38,0xe602,0x395,0x314,0x600,0x3e36,0x8602,0x3e3a,0xe602,0x3b7,0x313,0x600,0x3e45,
+0x602,0x3e49,0x684,0x3e4d,0x868a,0x3f20,0xe602,0x3b7,0x314,0x600,0x3e47,0x602,0x3e4b,0x684,0x3e4f,0x868a,
+0x3f22,0x1f20,0xe643,0x3b7,0x313,0x300,0x868a,0x3f24,0x1f21,0xe643,0x3b7,0x314,0x300,0x868a,0x3f26,0x1f20,
+0xe643,0x3b7,0x313,0x301,0x868a,0x3f28,0x1f21,0xe643,0x3b7,0x314,0x301,0x868a,0x3f2a,0x1f20,0xe643,0x3b7,
+0x313,0x342,0x868a,0x3f2c,0x1f21,0xe643,0x3b7,0x314,0x342,0x868a,0x3f2e,0xe602,0x397,0x313,0x600,0x3e55,
+0x602,0x3e59,0x684,0x3e5d,0x868a,0x3f30,0xe602,0x397,0x314,0x600,0x3e57,0x602,0x3e5b,0x684,0x3e5f,0x868a,
+0x3f32,0x1f28,0xe643,0x397,0x313,0x300,0x868a,0x3f34,0x1f29,0xe643,0x397,0x314,0x300,0x868a,0x3f36,0x1f28,
+0xe643,0x397,0x313,0x301,0x868a,0x3f38,0x1f29,0xe643,0x397,0x314,0x301,0x868a,0x3f3a,0x1f28,0xe643,0x397,
+0x313,0x342,0x868a,0x3f3c,0x1f29,0xe643,0x397,0x314,0x342,0x868a,0x3f3e,0xe602,0x3b9,0x313,0x600,0x3e64,
+0x602,0x3e68,0x8684,0x3e6c,0xe602,0x3b9,0x314,0x600,0x3e66,0x602,0x3e6a,0x8684,0x3e6e,0xe602,0x399,0x313,
+0x600,0x3e74,0x602,0x3e78,0x8684,0x3e7c,0xe602,0x399,0x314,0x600,0x3e76,0x602,0x3e7a,0x8684,0x3e7e,0xe602,
+0x3bf,0x313,0x600,0x3e84,0x8602,0x3e88,0xe602,0x3bf,0x314,0x600,0x3e86,0x8602,0x3e8a,0xe602,0x39f,0x313,
+0x600,0x3e94,0x8602,0x3e98,0xe602,0x39f,0x314,0x600,0x3e96,0x8602,0x3e9a,0xe602,0x3c5,0x313,0x600,0x3ea4,
+0x602,0x3ea8,0x8684,0x3eac,0xe602,0x3c5,0x314,0x600,0x3ea6,0x602,0x3eaa,0x8684,0x3eae,0xe602,0x3a5,0x314,
+0x600,0x3eb6,0x602,0x3eba,0x8684,0x3ebe,0xe602,0x3c9,0x313,0x600,0x3ec5,0x602,0x3ec9,0x684,0x3ecd,0x868a,
+0x3f40,0xe602,0x3c9,0x314,0x600,0x3ec7,0x602,0x3ecb,0x684,0x3ecf,0x868a,0x3f42,0x1f60,0xe643,0x3c9,0x313,
+0x300,0x868a,0x3f44,0x1f61,0xe643,0x3c9,0x314,0x300,0x868a,0x3f46,0x1f60,0xe643,0x3c9,0x313,0x301,0x868a,
+0x3f48,0x1f61,0xe643,0x3c9,0x314,0x301,0x868a,0x3f4a,0x1f60,0xe643,0x3c9,0x313,0x342,0x868a,0x3f4c,0x1f61,
+0xe643,0x3c9,0x314,0x342,0x868a,0x3f4e,0xe602,0x3a9,0x313,0x600,0x3ed5,0x602,0x3ed9,0x684,0x3edd,0x868a,
+0x3f50,0xe602,0x3a9,0x314,0x600,0x3ed7,0x602,0x3edb,0x684,0x3edf,0x868a,0x3f52,0x1f68,0xe643,0x3a9,0x313,
+0x300,0x868a,0x3f54,0x1f69,0xe643,0x3a9,0x314,0x300,0x868a,0x3f56,0x1f68,0xe643,0x3a9,0x313,0x301,0x868a,
+0x3f58,0x1f69,0xe643,0x3a9,0x314,0x301,0x868a,0x3f5a,0x1f68,0xe643,0x3a9,0x313,0x342,0x868a,0x3f5c,0x1f69,
+0xe643,0x3a9,0x314,0x342,0x868a,0x3f5e,0xe602,0x3b1,0x300,0x868a,0x3f64,0xe602,0x3b7,0x300,0x868a,0x3f84,
+0xe602,0x3c9,0x300,0x868a,0x3fe4,0xe602,0x3b1,0x342,0x868a,0x3f6e,0xe602,0x3b7,0x342,0x868a,0x3f8e,0xe602,
+0x3c9,0x342,0x868a,0x3fee,3,0xe602,0x41,0x300,0xe602,0x41,0x301,0xe602,0x41,0x303,0xe602,0x45,
+0x300,0xe602,0x45,0x301,0xe602,0x45,0x308,0xe602,0x49,0x300,0xe602,0x49,0x301,0xe602,0x49,0x302,
+0xe602,0x4e,0x303,0xe602,0x4f,0x300,0xe602,0x4f,0x301,0xe602,0x55,0x300,0xe602,0x55,0x301,0xe602,
+0x55,0x302,0xe602,0x59,0x301,0xe602,0x61,0x300,0xe602,0x61,0x301,0xe602,0x61,0x303,0xe602,0x65,
+0x300,0xe602,0x65,0x301,0xe602,0x65,0x308,0xe602,0x69,0x300,0xe602,0x69,0x301,0xe602,0x69,0x302,
+0xe602,0x6e,0x303,0xe602,0x6f,0x300,0xe602,0x6f,0x301,0xe602,0x75,0x300,0xe602,0x75,0x301,0xe602,
+0x75,0x302,0xe602,0x79,0x301,0xe602,0x79,0x308,0xe602,0x41,0x304,0xe602,0x61,0x304,0xca02,0x41,
+0x328,0xca02,0x61,0x328,0xe602,0x43,0x301,0xe602,0x63,0x301,0xe602,0x43,0x302,0xe602,0x63,0x302,
+0xe602,0x43,0x307,0xe602,0x63,0x307,0xe602,0x43,0x30c,0xe602,0x63,0x30c,0xe602,0x44,0x30c,0xe602,
+0x64,0x30c,0xe602,0x45,0x306,0xe602,0x65,0x306,0xe602,0x45,0x307,0xe602,0x65,0x307,0xca02,0x45,
+0x328,0xca02,0x65,0x328,0xe602,0x45,0x30c,0xe602,0x65,0x30c,0xe602,0x47,0x302,0xe602,0x67,0x302,
+0xe602,0x47,0x306,0xe602,0x67,0x306,0xe602,0x47,0x307,0xe602,0x67,0x307,0xca02,0x47,0x327,0xca02,
+0x67,0x327,0xe602,0x48,0x302,0xe602,0x68,0x302,0xe602,0x49,0x303,0xe602,0x69,0x303,0xe602,0x49,
+0x304,0xe602,0x69,0x304,0xe602,0x49,0x306,0xe602,0x69,0x306,0xca02,0x49,0x328,0xca02,0x69,0x328,
+0xe602,0x49,0x307,0xe602,0x4a,0x302,0xe602,0x6a,0x302,0xca02,0x4b,0x327,0xca02,0x6b,0x327,0xe602,
+0x4c,0x301,0xe602,0x6c,0x301,0xca02,0x4c,0x327,0xca02,0x6c,0x327,0xe602,0x4c,0x30c,0xe602,0x6c,
+0x30c,0xe602,0x4e,0x301,0xe602,0x6e,0x301,0xca02,0x4e,0x327,0xca02,0x6e,0x327,0xe602,0x4e,0x30c,
+0xe602,0x6e,0x30c,0xe602,0x4f,0x306,0xe602,0x6f,0x306,0xe602,0x4f,0x30b,0xe602,0x6f,0x30b,0xe602,
+0x52,0x301,0xe602,0x72,0x301,0xca02,0x52,0x327,0xca02,0x72,0x327,0xe602,0x52,0x30c,0xe602,0x72,
+0x30c,0xe602,0x53,0x302,0xe602,0x73,0x302,0xca02,0x53,0x327,0xca02,0x73,0x327,0xca02,0x54,0x327,
+0xca02,0x74,0x327,0xe602,0x54,0x30c,0xe602,0x74,0x30c,0xe602,0x55,0x306,0xe602,0x75,0x306,0xe602,
+0x55,0x30a,0xe602,0x75,0x30a,0xe602,0x55,0x30b,0xe602,0x75,0x30b,0xca02,0x55,0x328,0xca02,0x75,
+0x328,0xe602,0x57,0x302,0xe602,0x77,0x302,0xe602,0x59,0x302,0xe602,0x79,0x302,0xe602,0x59,0x308,
+0xe602,0x5a,0x301,0xe602,0x7a,0x301,0xe602,0x5a,0x307,0xe602,0x7a,0x307,0xe602,0x5a,0x30c,0xe602,
+0x7a,0x30c,0xe602,0x41,0x30c,0xe602,0x61,0x30c,0xe602,0x49,0x30c,0xe602,0x69,0x30c,0xe602,0x4f,
+0x30c,0xe602,0x6f,0x30c,0xe602,0x55,0x30c,0xe602,0x75,0x30c,0xdc,0xe643,0x55,0x308,0x304,0xfc,
+0xe643,0x75,0x308,0x304,0xdc,0xe643,0x55,0x308,0x301,0xfc,0xe643,0x75,0x308,0x301,0xdc,0xe643,
+0x55,0x308,0x30c,0xfc,0xe643,0x75,0x308,0x30c,0xdc,0xe643,0x55,0x308,0x300,0xfc,0xe643,0x75,
+0x308,0x300,0xc4,0xe643,0x41,0x308,0x304,0xe4,0xe643,0x61,0x308,0x304,0x226,0xe643,0x41,0x307,
+0x304,0x227,0xe643,0x61,0x307,0x304,0xe602,0xc6,0x304,0xe602,0xe6,0x304,0xe602,0x47,0x30c,0xe602,
+0x67,0x30c,0xe602,0x4b,0x30c,0xe602,0x6b,0x30c,0x1ea,0xe643,0x4f,0x328,0x304,0x1eb,0xe643,0x6f,
+0x328,0x304,0xe602,0x1b7,0x30c,0xe602,0x292,0x30c,0xe602,0x6a,0x30c,0xe602,0x47,0x301,0xe602,0x67,
+0x301,0xe602,0x4e,0x300,0xe602,0x6e,0x300,0xc5,0xe643,0x41,0x30a,0x301,0xe5,0xe643,0x61,0x30a,
+0x301,0xe602,0xc6,0x301,0xe602,0xe6,0x301,0xe602,0xd8,0x301,0xe602,0xf8,0x301,0xe602,0x41,0x30f,
+0xe602,0x61,0x30f,0xe602,0x41,0x311,0xe602,0x61,0x311,0xe602,0x45,0x30f,0xe602,0x65,0x30f,0xe602,
+0x45,0x311,0xe602,0x65,0x311,0xe602,0x49,0x30f,0xe602,0x69,0x30f,0xe602,0x49,0x311,0xe602,0x69,
+0x311,0xe602,0x4f,0x30f,0xe602,0x6f,0x30f,0xe602,0x4f,0x311,0xe602,0x6f,0x311,0xe602,0x52,0x30f,
+0xe602,0x72,0x30f,0xe602,0x52,0x311,0xe602,0x72,0x311,0xe602,0x55,0x30f,0xe602,0x75,0x30f,0xe602,
+0x55,0x311,0xe602,0x75,0x311,0xdc02,0x53,0x326,0xdc02,0x73,0x326,0xdc02,0x54,0x326,0xdc02,0x74,
+0x326,0xe602,0x48,0x30c,0xe602,0x68,0x30c,0xd6,0xe643,0x4f,0x308,0x304,0xf6,0xe643,0x6f,0x308,
+0x304,0xd5,0xe643,0x4f,0x303,0x304,0xf5,0xe643,0x6f,0x303,0x304,0x22e,0xe643,0x4f,0x307,0x304,
+0x22f,0xe643,0x6f,0x307,0x304,0xe602,0x59,0x304,0xe602,0x79,0x304,0xe602,0xa8,0x301,0xe602,0x391,
+0x301,0xe602,0x395,0x301,0xe602,0x397,0x301,0xe602,0x399,0x301,0xe602,0x39f,0x301,0xe602,0x3a5,0x301,
+0xe602,0x3a9,0x301,0x3ca,0xe643,0x3b9,0x308,0x301,0xe602,0x399,0x308,0xe602,0x3a5,0x308,0xe602,0x3b5,
+0x301,0xe602,0x3b9,0x301,0x3cb,0xe643,0x3c5,0x308,0x301,0xe602,0x3bf,0x301,0xe602,0x3c5,0x301,0xe602,
+0x3d2,0x301,0xe602,0x3d2,0x308,0xe602,0x415,0x300,0xe602,0x415,0x308,0xe602,0x413,0x301,0xe602,0x406,
+0x308,0xe602,0x41a,0x301,0xe602,0x418,0x300,0xe602,0x423,0x306,0xe602,0x418,0x306,0xe602,0x438,0x306,
+0xe602,0x435,0x300,0xe602,0x435,0x308,0xe602,0x433,0x301,0xe602,0x456,0x308,0xe602,0x43a,0x301,0xe602,
+0x438,0x300,0xe602,0x443,0x306,0xe602,0x474,0x30f,0xe602,0x475,0x30f,0xe602,0x416,0x306,0xe602,0x436,
+0x306,0xe602,0x410,0x306,0xe602,0x430,0x306,0xe602,0x410,0x308,0xe602,0x430,0x308,0xe602,0x415,0x306,
+0xe602,0x435,0x306,0xe602,0x4d8,0x308,0xe602,0x4d9,0x308,0xe602,0x416,0x308,0xe602,0x436,0x308,0xe602,
+0x417,0x308,0xe602,0x437,0x308,0xe602,0x418,0x304,0xe602,0x438,0x304,0xe602,0x418,0x308,0xe602,0x438,
+0x308,0xe602,0x41e,0x308,0xe602,0x43e,0x308,0xe602,0x4e8,0x308,0xe602,0x4e9,0x308,0xe602,0x42d,0x308,
+0xe602,0x44d,0x308,0xe602,0x423,0x304,0xe602,0x443,0x304,0xe602,0x423,0x308,0xe602,0x443,0x308,0xe602,
+0x423,0x30b,0xe602,0x443,0x30b,0xe602,0x427,0x308,0xe602,0x447,0x308,0xe602,0x42b,0x308,0xe602,0x44b,
+0x308,0xe602,0x627,0x653,0xe602,0x627,0x654,0xe602,0x648,0x654,0xdc02,0x627,0x655,0xe602,0x64a,0x654,
+0xe602,0x6d5,0x654,0xe602,0x6c1,0x654,0xe602,0x6d2,0x654,0x702,0x928,0x93c,0x702,0x930,0x93c,0x702,
+0x933,0x93c,2,0x9c7,0x9be,2,0x9c7,0x9d7,2,0xb47,0xb56,2,0xb47,0xb3e,2,0xb47,
+0xb57,2,0xb92,0xbd7,2,0xbc6,0xbbe,2,0xbc7,0xbbe,2,0xbc6,0xbd7,0x5b02,0xc46,0xc56,
+2,0xcbf,0xcd5,2,0xcc6,0xcd5,2,0xcc6,0xcd6,0xcca,0x43,0xcc6,0xcc2,0xcd5,2,0xd46,
+0xd3e,2,0xd47,0xd3e,2,0xd46,0xd57,0x902,0xdd9,0xdca,0xddc,0x943,0xdd9,0xdcf,0xdca,2,
+0xdd9,0xddf,2,0x1025,0x102e,2,0x1b05,0x1b35,2,0x1b07,0x1b35,2,0x1b09,0x1b35,2,0x1b0b,
+0x1b35,2,0x1b0d,0x1b35,2,0x1b11,0x1b35,2,0x1b3a,0x1b35,2,0x1b3c,0x1b35,2,0x1b3e,0x1b35,
+2,0x1b3f,0x1b35,2,0x1b42,0x1b35,0xdc02,0x41,0x325,0xdc02,0x61,0x325,0xe602,0x42,0x307,0xe602,
+0x62,0x307,0xdc02,0x42,0x323,0xdc02,0x62,0x323,0xdc02,0x42,0x331,0xdc02,0x62,0x331,0xc7,0xe643,
+0x43,0x327,0x301,0xe7,0xe643,0x63,0x327,0x301,0xe602,0x44,0x307,0xe602,0x64,0x307,0xdc02,0x44,
+0x323,0xdc02,0x64,0x323,0xdc02,0x44,0x331,0xdc02,0x64,0x331,0xca02,0x44,0x327,0xca02,0x64,0x327,
+0xdc02,0x44,0x32d,0xdc02,0x64,0x32d,0x112,0xe643,0x45,0x304,0x300,0x113,0xe643,0x65,0x304,0x300,
+0x112,0xe643,0x45,0x304,0x301,0x113,0xe643,0x65,0x304,0x301,0xdc02,0x45,0x32d,0xdc02,0x65,0x32d,
+0xdc02,0x45,0x330,0xdc02,0x65,0x330,0x228,0xe643,0x45,0x327,0x306,0x229,0xe643,0x65,0x327,0x306,
+0xe602,0x46,0x307,0xe602,0x66,0x307,0xe602,0x47,0x304,0xe602,0x67,0x304,0xe602,0x48,0x307,0xe602,
+0x68,0x307,0xdc02,0x48,0x323,0xdc02,0x68,0x323,0xe602,0x48,0x308,0xe602,0x68,0x308,0xca02,0x48,
+0x327,0xca02,0x68,0x327,0xdc02,0x48,0x32e,0xdc02,0x68,0x32e,0xdc02,0x49,0x330,0xdc02,0x69,0x330,
+0xcf,0xe643,0x49,0x308,0x301,0xef,0xe643,0x69,0x308,0x301,0xe602,0x4b,0x301,0xe602,0x6b,0x301,
+0xdc02,0x4b,0x323,0xdc02,0x6b,0x323,0xdc02,0x4b,0x331,0xdc02,0x6b,0x331,0x1e36,0xe643,0x4c,0x323,
+0x304,0x1e37,0xe643,0x6c,0x323,0x304,0xdc02,0x4c,0x331,0xdc02,0x6c,0x331,0xdc02,0x4c,0x32d,0xdc02,
+0x6c,0x32d,0xe602,0x4d,0x301,0xe602,0x6d,0x301,0xe602,0x4d,0x307,0xe602,0x6d,0x307,0xdc02,0x4d,
+0x323,0xdc02,0x6d,0x323,0xe602,0x4e,0x307,0xe602,0x6e,0x307,0xdc02,0x4e,0x323,0xdc02,0x6e,0x323,
+0xdc02,0x4e,0x331,0xdc02,0x6e,0x331,0xdc02,0x4e,0x32d,0xdc02,0x6e,0x32d,0xd5,0xe643,0x4f,0x303,
+0x301,0xf5,0xe643,0x6f,0x303,0x301,0xd5,0xe643,0x4f,0x303,0x308,0xf5,0xe643,0x6f,0x303,0x308,
+0x14c,0xe643,0x4f,0x304,0x300,0x14d,0xe643,0x6f,0x304,0x300,0x14c,0xe643,0x4f,0x304,0x301,0x14d,
+0xe643,0x6f,0x304,0x301,0xe602,0x50,0x301,0xe602,0x70,0x301,0xe602,0x50,0x307,0xe602,0x70,0x307,
+0xe602,0x52,0x307,0xe602,0x72,0x307,0x1e5a,0xe643,0x52,0x323,0x304,0x1e5b,0xe643,0x72,0x323,0x304,
+0xdc02,0x52,0x331,0xdc02,0x72,0x331,0xe602,0x53,0x307,0xe602,0x73,0x307,0x15a,0xe643,0x53,0x301,
+0x307,0x15b,0xe643,0x73,0x301,0x307,0x160,0xe643,0x53,0x30c,0x307,0x161,0xe643,0x73,0x30c,0x307,
+0x1e62,0xe643,0x53,0x323,0x307,0x1e63,0xe643,0x73,0x323,0x307,0xe602,0x54,0x307,0xe602,0x74,0x307,
+0xdc02,0x54,0x323,0xdc02,0x74,0x323,0xdc02,0x54,0x331,0xdc02,0x74,0x331,0xdc02,0x54,0x32d,0xdc02,
+0x74,0x32d,0xdc02,0x55,0x324,0xdc02,0x75,0x324,0xdc02,0x55,0x330,0xdc02,0x75,0x330,0xdc02,0x55,
+0x32d,0xdc02,0x75,0x32d,0x168,0xe643,0x55,0x303,0x301,0x169,0xe643,0x75,0x303,0x301,0x16a,0xe643,
+0x55,0x304,0x308,0x16b,0xe643,0x75,0x304,0x308,0xe602,0x56,0x303,0xe602,0x76,0x303,0xdc02,0x56,
+0x323,0xdc02,0x76,0x323,0xe602,0x57,0x300,0xe602,0x77,0x300,0xe602,0x57,0x301,0xe602,0x77,0x301,
+0xe602,0x57,0x308,0xe602,0x77,0x308,0xe602,0x57,0x307,0xe602,0x77,0x307,0xdc02,0x57,0x323,0xdc02,
+0x77,0x323,0xe602,0x58,0x307,0xe602,0x78,0x307,0xe602,0x58,0x308,0xe602,0x78,0x308,0xe602,0x59,
+0x307,0xe602,0x79,0x307,0xe602,0x5a,0x302,0xe602,0x7a,0x302,0xdc02,0x5a,0x323,0xdc02,0x7a,0x323,
+0xdc02,0x5a,0x331,0xdc02,0x7a,0x331,0xdc02,0x68,0x331,0xe602,0x74,0x308,0xe602,0x77,0x30a,0xe602,
+0x79,0x30a,0xe602,0x17f,0x307,0xe602,0x41,0x309,0xe602,0x61,0x309,0xc2,0xe643,0x41,0x302,0x301,
+0xe2,0xe643,0x61,0x302,0x301,0xc2,0xe643,0x41,0x302,0x300,0xe2,0xe643,0x61,0x302,0x300,0xc2,
+0xe643,0x41,0x302,0x309,0xe2,0xe643,0x61,0x302,0x309,0xc2,0xe643,0x41,0x302,0x303,0xe2,0xe643,
+0x61,0x302,0x303,0x1ea0,0xe643,0x41,0x323,0x302,0x1ea1,0xe643,0x61,0x323,0x302,0x102,0xe643,0x41,
+0x306,0x301,0x103,0xe643,0x61,0x306,0x301,0x102,0xe643,0x41,0x306,0x300,0x103,0xe643,0x61,0x306,
+0x300,0x102,0xe643,0x41,0x306,0x309,0x103,0xe643,0x61,0x306,0x309,0x102,0xe643,0x41,0x306,0x303,
+0x103,0xe643,0x61,0x306,0x303,0x1ea0,0xe643,0x41,0x323,0x306,0x1ea1,0xe643,0x61,0x323,0x306,0xe602,
+0x45,0x309,0xe602,0x65,0x309,0xe602,0x45,0x303,0xe602,0x65,0x303,0xca,0xe643,0x45,0x302,0x301,
+0xea,0xe643,0x65,0x302,0x301,0xca,0xe643,0x45,0x302,0x300,0xea,0xe643,0x65,0x302,0x300,0xca,
+0xe643,0x45,0x302,0x309,0xea,0xe643,0x65,0x302,0x309,0xca,0xe643,0x45,0x302,0x303,0xea,0xe643,
+0x65,0x302,0x303,0x1eb8,0xe643,0x45,0x323,0x302,0x1eb9,0xe643,0x65,0x323,0x302,0xe602,0x49,0x309,
+0xe602,0x69,0x309,0xdc02,0x49,0x323,0xdc02,0x69,0x323,0xe602,0x4f,0x309,0xe602,0x6f,0x309,0xd4,
+0xe643,0x4f,0x302,0x301,0xf4,0xe643,0x6f,0x302,0x301,0xd4,0xe643,0x4f,0x302,0x300,0xf4,0xe643,
+0x6f,0x302,0x300,0xd4,0xe643,0x4f,0x302,0x309,0xf4,0xe643,0x6f,0x302,0x309,0xd4,0xe643,0x4f,
+0x302,0x303,0xf4,0xe643,0x6f,0x302,0x303,0x1ecc,0xe643,0x4f,0x323,0x302,0x1ecd,0xe643,0x6f,0x323,
+0x302,0x1a0,0xe643,0x4f,0x31b,0x301,0x1a1,0xe643,0x6f,0x31b,0x301,0x1a0,0xe643,0x4f,0x31b,0x300,
+0x1a1,0xe643,0x6f,0x31b,0x300,0x1a0,0xe643,0x4f,0x31b,0x309,0x1a1,0xe643,0x6f,0x31b,0x309,0x1a0,
+0xe643,0x4f,0x31b,0x303,0x1a1,0xe643,0x6f,0x31b,0x303,0x1a0,0xdc43,0x4f,0x31b,0x323,0x1a1,0xdc43,
+0x6f,0x31b,0x323,0xdc02,0x55,0x323,0xdc02,0x75,0x323,0xe602,0x55,0x309,0xe602,0x75,0x309,0x1af,
+0xe643,0x55,0x31b,0x301,0x1b0,0xe643,0x75,0x31b,0x301,0x1af,0xe643,0x55,0x31b,0x300,0x1b0,0xe643,
+0x75,0x31b,0x300,0x1af,0xe643,0x55,0x31b,0x309,0x1b0,0xe643,0x75,0x31b,0x309,0x1af,0xe643,0x55,
+0x31b,0x303,0x1b0,0xe643,0x75,0x31b,0x303,0x1af,0xdc43,0x55,0x31b,0x323,0x1b0,0xdc43,0x75,0x31b,
+0x323,0xe602,0x59,0x300,0xe602,0x79,0x300,0xdc02,0x59,0x323,0xdc02,0x79,0x323,0xe602,0x59,0x309,
+0xe602,0x79,0x309,0xe602,0x59,0x303,0xe602,0x79,0x303,0x1f10,0xe643,0x3b5,0x313,0x300,0x1f11,0xe643,
+0x3b5,0x314,0x300,0x1f10,0xe643,0x3b5,0x313,0x301,0x1f11,0xe643,0x3b5,0x314,0x301,0x1f18,0xe643,0x395,
+0x313,0x300,0x1f19,0xe643,0x395,0x314,0x300,0x1f18,0xe643,0x395,0x313,0x301,0x1f19,0xe643,0x395,0x314,
+0x301,0x1f30,0xe643,0x3b9,0x313,0x300,0x1f31,0xe643,0x3b9,0x314,0x300,0x1f30,0xe643,0x3b9,0x313,0x301,
+0x1f31,0xe643,0x3b9,0x314,0x301,0x1f30,0xe643,0x3b9,0x313,0x342,0x1f31,0xe643,0x3b9,0x314,0x342,0x1f38,
+0xe643,0x399,0x313,0x300,0x1f39,0xe643,0x399,0x314,0x300,0x1f38,0xe643,0x399,0x313,0x301,0x1f39,0xe643,
+0x399,0x314,0x301,0x1f38,0xe643,0x399,0x313,0x342,0x1f39,0xe643,0x399,0x314,0x342,0x1f40,0xe643,0x3bf,
+0x313,0x300,0x1f41,0xe643,0x3bf,0x314,0x300,0x1f40,0xe643,0x3bf,0x313,0x301,0x1f41,0xe643,0x3bf,0x314,
+0x301,0x1f48,0xe643,0x39f,0x313,0x300,0x1f49,0xe643,0x39f,0x314,0x300,0x1f48,0xe643,0x39f,0x313,0x301,
+0x1f49,0xe643,0x39f,0x314,0x301,0x1f50,0xe643,0x3c5,0x313,0x300,0x1f51,0xe643,0x3c5,0x314,0x300,0x1f50,
+0xe643,0x3c5,0x313,0x301,0x1f51,0xe643,0x3c5,0x314,0x301,0x1f50,0xe643,0x3c5,0x313,0x342,0x1f51,0xe643,
+0x3c5,0x314,0x342,0x1f59,0xe643,0x3a5,0x314,0x300,0x1f59,0xe643,0x3a5,0x314,0x301,0x1f59,0xe643,0x3a5,
+0x314,0x342,0xe602,0x3b5,0x300,0xe602,0x3b9,0x300,0xe602,0x3bf,0x300,0xe602,0x3c5,0x300,0x1f00,0xf043,
+0x3b1,0x313,0x345,0x1f01,0xf043,0x3b1,0x314,0x345,0x1f02,0x345,2,0xf044,0x3b1,0x313,0x300,0x345,
+0x1f03,0x345,2,0xf044,0x3b1,0x314,0x300,0x345,0x1f04,0x345,2,0xf044,0x3b1,0x313,0x301,0x345,
+0x1f05,0x345,2,0xf044,0x3b1,0x314,0x301,0x345,0x1f06,0x345,2,0xf044,0x3b1,0x313,0x342,0x345,
+0x1f07,0x345,2,0xf044,0x3b1,0x314,0x342,0x345,0x1f08,0xf043,0x391,0x313,0x345,0x1f09,0xf043,0x391,
+0x314,0x345,0x1f0a,0x345,2,0xf044,0x391,0x313,0x300,0x345,0x1f0b,0x345,2,0xf044,0x391,0x314,
+0x300,0x345,0x1f0c,0x345,2,0xf044,0x391,0x313,0x301,0x345,0x1f0d,0x345,2,0xf044,0x391,0x314,
+0x301,0x345,0x1f0e,0x345,2,0xf044,0x391,0x313,0x342,0x345,0x1f0f,0x345,2,0xf044,0x391,0x314,
+0x342,0x345,0x1f20,0xf043,0x3b7,0x313,0x345,0x1f21,0xf043,0x3b7,0x314,0x345,0x1f22,0x345,2,0xf044,
+0x3b7,0x313,0x300,0x345,0x1f23,0x345,2,0xf044,0x3b7,0x314,0x300,0x345,0x1f24,0x345,2,0xf044,
+0x3b7,0x313,0x301,0x345,0x1f25,0x345,2,0xf044,0x3b7,0x314,0x301,0x345,0x1f26,0x345,2,0xf044,
+0x3b7,0x313,0x342,0x345,0x1f27,0x345,2,0xf044,0x3b7,0x314,0x342,0x345,0x1f28,0xf043,0x397,0x313,
+0x345,0x1f29,0xf043,0x397,0x314,0x345,0x1f2a,0x345,2,0xf044,0x397,0x313,0x300,0x345,0x1f2b,0x345,
+2,0xf044,0x397,0x314,0x300,0x345,0x1f2c,0x345,2,0xf044,0x397,0x313,0x301,0x345,0x1f2d,0x345,
+2,0xf044,0x397,0x314,0x301,0x345,0x1f2e,0x345,2,0xf044,0x397,0x313,0x342,0x345,0x1f2f,0x345,
+2,0xf044,0x397,0x314,0x342,0x345,0x1f60,0xf043,0x3c9,0x313,0x345,0x1f61,0xf043,0x3c9,0x314,0x345,
+0x1f62,0x345,2,0xf044,0x3c9,0x313,0x300,0x345,0x1f63,0x345,2,0xf044,0x3c9,0x314,0x300,0x345,
+0x1f64,0x345,2,0xf044,0x3c9,0x313,0x301,0x345,0x1f65,0x345,2,0xf044,0x3c9,0x314,0x301,0x345,
+0x1f66,0x345,2,0xf044,0x3c9,0x313,0x342,0x345,0x1f67,0x345,2,0xf044,0x3c9,0x314,0x342,0x345,
+0x1f68,0xf043,0x3a9,0x313,0x345,0x1f69,0xf043,0x3a9,0x314,0x345,0x1f6a,0x345,2,0xf044,0x3a9,0x313,
+0x300,0x345,0x1f6b,0x345,2,0xf044,0x3a9,0x314,0x300,0x345,0x1f6c,0x345,2,0xf044,0x3a9,0x313,
+0x301,0x345,0x1f6d,0x345,2,0xf044,0x3a9,0x314,0x301,0x345,0x1f6e,0x345,2,0xf044,0x3a9,0x313,
+0x342,0x345,0x1f6f,0x345,2,0xf044,0x3a9,0x314,0x342,0x345,0xe602,0x3b1,0x306,0xe602,0x3b1,0x304,
+0x1f70,0xf043,0x3b1,0x300,0x345,0xf002,0x3b1,0x345,0x3ac,0xf043,0x3b1,0x301,0x345,0x1fb6,0xf043,0x3b1,
+0x342,0x345,0xe602,0x391,0x306,0xe602,0x391,0x304,0xe602,0x391,0x300,0xf002,0x391,0x345,0xe602,0xa8,
+0x342,0x1f74,0xf043,0x3b7,0x300,0x345,0xf002,0x3b7,0x345,0x3ae,0xf043,0x3b7,0x301,0x345,0x1fc6,0xf043,
+0x3b7,0x342,0x345,0xe602,0x395,0x300,0xe602,0x397,0x300,0xf002,0x397,0x345,0xe602,0x1fbf,0x300,0xe602,
+0x1fbf,0x301,0xe602,0x1fbf,0x342,0xe602,0x3b9,0x306,0xe602,0x3b9,0x304,0x3ca,0xe643,0x3b9,0x308,0x300,
+0xe602,0x3b9,0x342,0x3ca,0xe643,0x3b9,0x308,0x342,0xe602,0x399,0x306,0xe602,0x399,0x304,0xe602,0x399,
+0x300,0xe602,0x1ffe,0x300,0xe602,0x1ffe,0x301,0xe602,0x1ffe,0x342,0xe602,0x3c5,0x306,0xe602,0x3c5,0x304,
+0x3cb,0xe643,0x3c5,0x308,0x300,0xe602,0x3c1,0x313,0xe602,0x3c1,0x314,0xe602,0x3c5,0x342,0x3cb,0xe643,
+0x3c5,0x308,0x342,0xe602,0x3a5,0x306,0xe602,0x3a5,0x304,0xe602,0x3a5,0x300,0xe602,0x3a1,0x314,0xe602,
+0xa8,0x300,0x1f7c,0xf043,0x3c9,0x300,0x345,0xf002,0x3c9,0x345,0x3ce,0xf043,0x3c9,0x301,0x345,0x1ff6,
+0xf043,0x3c9,0x342,0x345,0xe602,0x39f,0x300,0xe602,0x3a9,0x300,0xf002,0x3a9,0x345,0x102,0x2190,0x338,
+0x102,0x2192,0x338,0x102,0x2194,0x338,0x102,0x21d0,0x338,0x102,0x21d4,0x338,0x102,0x21d2,0x338,0x102,
+0x2203,0x338,0x102,0x2208,0x338,0x102,0x220b,0x338,0x102,0x2223,0x338,0x102,0x2225,0x338,0x102,0x223c,
+0x338,0x102,0x2243,0x338,0x102,0x2245,0x338,0x102,0x2248,0x338,0x102,0x3d,0x338,0x102,0x2261,0x338,
+0x102,0x224d,0x338,0x102,0x3c,0x338,0x102,0x3e,0x338,0x102,0x2264,0x338,0x102,0x2265,0x338,0x102,
+0x2272,0x338,0x102,0x2273,0x338,0x102,0x2276,0x338,0x102,0x2277,0x338,0x102,0x227a,0x338,0x102,0x227b,
+0x338,0x102,0x2282,0x338,0x102,0x2283,0x338,0x102,0x2286,0x338,0x102,0x2287,0x338,0x102,0x22a2,0x338,
+0x102,0x22a8,0x338,0x102,0x22a9,0x338,0x102,0x22ab,0x338,0x102,0x227c,0x338,0x102,0x227d,0x338,0x102,
+0x2291,0x338,0x102,0x2292,0x338,0x102,0x22b2,0x338,0x102,0x22b3,0x338,0x102,0x22b4,0x338,0x102,0x22b5,
+0x338,0x802,0x304b,0x3099,0x802,0x304d,0x3099,0x802,0x304f,0x3099,0x802,0x3051,0x3099,0x802,0x3053,0x3099,
+0x802,0x3055,0x3099,0x802,0x3057,0x3099,0x802,0x3059,0x3099,0x802,0x305b,0x3099,0x802,0x305d,0x3099,0x802,
+0x305f,0x3099,0x802,0x3061,0x3099,0x802,0x3064,0x3099,0x802,0x3066,0x3099,0x802,0x3068,0x3099,0x802,0x306f,
+0x3099,0x802,0x306f,0x309a,0x802,0x3072,0x3099,0x802,0x3072,0x309a,0x802,0x3075,0x3099,0x802,0x3075,0x309a,
+0x802,0x3078,0x3099,0x802,0x3078,0x309a,0x802,0x307b,0x3099,0x802,0x307b,0x309a,0x802,0x3046,0x3099,0x802,
+0x309d,0x3099,0x802,0x30ab,0x3099,0x802,0x30ad,0x3099,0x802,0x30af,0x3099,0x802,0x30b1,0x3099,0x802,0x30b3,
+0x3099,0x802,0x30b5,0x3099,0x802,0x30b7,0x3099,0x802,0x30b9,0x3099,0x802,0x30bb,0x3099,0x802,0x30bd,0x3099,
+0x802,0x30bf,0x3099,0x802,0x30c1,0x3099,0x802,0x30c4,0x3099,0x802,0x30c6,0x3099,0x802,0x30c8,0x3099,0x802,
+0x30cf,0x3099,0x802,0x30cf,0x309a,0x802,0x30d2,0x3099,0x802,0x30d2,0x309a,0x802,0x30d5,0x3099,0x802,0x30d5,
+0x309a,0x802,0x30d8,0x3099,0x802,0x30d8,0x309a,0x802,0x30db,0x3099,0x802,0x30db,0x309a,0x802,0x30a6,0x3099,
+0x802,0x30ef,0x3099,0x802,0x30f0,0x3099,0x802,0x30f1,0x3099,0x802,0x30f2,0x3099,0x802,0x30fd,0x3099,0x704,
+0xd804,0xdc99,0xd804,0xdcba,0x704,0xd804,0xdc9b,0xd804,0xdcba,0x704,0xd804,0xdca5,0xd804,0xdcba,4,0xd804,
+0xdd31,0xd804,0xdd27,4,0xd804,0xdd32,0xd804,0xdd27,4,0xd804,0xdf47,0xd804,0xdf3e,4,0xd804,0xdf47,
+0xd804,0xdf57,4,0xd805,0xdcb9,0xd805,0xdcba,4,0xd805,0xdcb9,0xd805,0xdcb0,4,0xd805,0xdcb9,0xd805,
+0xdcbd,4,0xd805,0xddb8,0xd805,0xddaf,4,0xd805,0xddb9,0xd805,0xddaf,4,0xd806,0xdd35,0xd806,0xdd30,
+1,0x2b9,1,0x3b,1,0xb7,0x702,0x915,0x93c,0x702,0x916,0x93c,0x702,0x917,0x93c,0x702,
+0x91c,0x93c,0x702,0x921,0x93c,0x702,0x922,0x93c,0x702,0x92b,0x93c,0x702,0x92f,0x93c,0x702,0x9a1,
+0x9bc,0x702,0x9a2,0x9bc,0x702,0x9af,0x9bc,0x702,0xa32,0xa3c,0x702,0xa38,0xa3c,0x702,0xa16,0xa3c,
+0x702,0xa17,0xa3c,0x702,0xa1c,0xa3c,0x702,0xa2b,0xa3c,0x702,0xb21,0xb3c,0x702,0xb22,0xb3c,2,
+0xf42,0xfb7,2,0xf4c,0xfb7,2,0xf51,0xfb7,2,0xf56,0xfb7,2,0xf5b,0xfb7,2,0xf40,
+0xfb5,0x8202,0xfb2,0xf80,0x8202,0xfb3,0xf80,2,0xf92,0xfb7,2,0xf9c,0xfb7,2,0xfa1,0xfb7,
+2,0xfa6,0xfb7,2,0xfab,0xfb7,2,0xf90,0xfb5,1,0x3b9,1,0x60,1,0xb4,1,
+0x3a9,1,0x4b,1,0x3008,1,0x3009,0x102,0x2add,0x338,1,0x8c48,1,0x66f4,1,0x8eca,
+1,0x8cc8,1,0x6ed1,1,0x4e32,1,0x53e5,1,0x9f9c,1,0x5951,1,0x91d1,1,0x5587,
+1,0x5948,1,0x61f6,1,0x7669,1,0x7f85,1,0x863f,1,0x87ba,1,0x88f8,1,0x908f,
+1,0x6a02,1,0x6d1b,1,0x70d9,1,0x73de,1,0x843d,1,0x916a,1,0x99f1,1,0x4e82,
+1,0x5375,1,0x6b04,1,0x721b,1,0x862d,1,0x9e1e,1,0x5d50,1,0x6feb,1,0x85cd,
+1,0x8964,1,0x62c9,1,0x81d8,1,0x881f,1,0x5eca,1,0x6717,1,0x6d6a,1,0x72fc,
+1,0x90ce,1,0x4f86,1,0x51b7,1,0x52de,1,0x64c4,1,0x6ad3,1,0x7210,1,0x76e7,
+1,0x8001,1,0x8606,1,0x865c,1,0x8def,1,0x9732,1,0x9b6f,1,0x9dfa,1,0x788c,
+1,0x797f,1,0x7da0,1,0x83c9,1,0x9304,1,0x9e7f,1,0x8ad6,1,0x58df,1,0x5f04,
+1,0x7c60,1,0x807e,1,0x7262,1,0x78ca,1,0x8cc2,1,0x96f7,1,0x58d8,1,0x5c62,
+1,0x6a13,1,0x6dda,1,0x6f0f,1,0x7d2f,1,0x7e37,1,0x964b,1,0x52d2,1,0x808b,
+1,0x51dc,1,0x51cc,1,0x7a1c,1,0x7dbe,1,0x83f1,1,0x9675,1,0x8b80,1,0x62cf,
+1,0x8afe,1,0x4e39,1,0x5be7,1,0x6012,1,0x7387,1,0x7570,1,0x5317,1,0x78fb,
+1,0x4fbf,1,0x5fa9,1,0x4e0d,1,0x6ccc,1,0x6578,1,0x7d22,1,0x53c3,1,0x585e,
+1,0x7701,1,0x8449,1,0x8aaa,1,0x6bba,1,0x8fb0,1,0x6c88,1,0x62fe,1,0x82e5,
+1,0x63a0,1,0x7565,1,0x4eae,1,0x5169,1,0x51c9,1,0x6881,1,0x7ce7,1,0x826f,
+1,0x8ad2,1,0x91cf,1,0x52f5,1,0x5442,1,0x5973,1,0x5eec,1,0x65c5,1,0x6ffe,
+1,0x792a,1,0x95ad,1,0x9a6a,1,0x9e97,1,0x9ece,1,0x529b,1,0x66c6,1,0x6b77,
+1,0x8f62,1,0x5e74,1,0x6190,1,0x6200,1,0x649a,1,0x6f23,1,0x7149,1,0x7489,
+1,0x79ca,1,0x7df4,1,0x806f,1,0x8f26,1,0x84ee,1,0x9023,1,0x934a,1,0x5217,
+1,0x52a3,1,0x54bd,1,0x70c8,1,0x88c2,1,0x5ec9,1,0x5ff5,1,0x637b,1,0x6bae,
+1,0x7c3e,1,0x7375,1,0x4ee4,1,0x56f9,1,0x5dba,1,0x601c,1,0x73b2,1,0x7469,
+1,0x7f9a,1,0x8046,1,0x9234,1,0x96f6,1,0x9748,1,0x9818,1,0x4f8b,1,0x79ae,
+1,0x91b4,1,0x96b8,1,0x60e1,1,0x4e86,1,0x50da,1,0x5bee,1,0x5c3f,1,0x6599,
+1,0x71ce,1,0x7642,1,0x84fc,1,0x907c,1,0x9f8d,1,0x6688,1,0x962e,1,0x5289,
+1,0x677b,1,0x67f3,1,0x6d41,1,0x6e9c,1,0x7409,1,0x7559,1,0x786b,1,0x7d10,
+1,0x985e,1,0x516d,1,0x622e,1,0x9678,1,0x502b,1,0x5d19,1,0x6dea,1,0x8f2a,
+1,0x5f8b,1,0x6144,1,0x6817,1,0x9686,1,0x5229,1,0x540f,1,0x5c65,1,0x6613,
+1,0x674e,1,0x68a8,1,0x6ce5,1,0x7406,1,0x75e2,1,0x7f79,1,0x88cf,1,0x88e1,
+1,0x91cc,1,0x96e2,1,0x533f,1,0x6eba,1,0x541d,1,0x71d0,1,0x7498,1,0x85fa,
+1,0x96a3,1,0x9c57,1,0x9e9f,1,0x6797,1,0x6dcb,1,0x81e8,1,0x7acb,1,0x7b20,
+1,0x7c92,1,0x72c0,1,0x7099,1,0x8b58,1,0x4ec0,1,0x8336,1,0x523a,1,0x5207,
+1,0x5ea6,1,0x62d3,1,0x7cd6,1,0x5b85,1,0x6d1e,1,0x66b4,1,0x8f3b,1,0x884c,
+1,0x964d,1,0x898b,1,0x5ed3,1,0x5140,1,0x55c0,1,0x585a,1,0x6674,1,0x51de,
+1,0x732a,1,0x76ca,1,0x793c,1,0x795e,1,0x7965,1,0x798f,1,0x9756,1,0x7cbe,
+1,0x7fbd,1,0x8612,1,0x8af8,1,0x9038,1,0x90fd,1,0x98ef,1,0x98fc,1,0x9928,
+1,0x9db4,1,0x90de,1,0x96b7,1,0x4fae,1,0x50e7,1,0x514d,1,0x52c9,1,0x52e4,
+1,0x5351,1,0x559d,1,0x5606,1,0x5668,1,0x5840,1,0x58a8,1,0x5c64,1,0x5c6e,
+1,0x6094,1,0x6168,1,0x618e,1,0x61f2,1,0x654f,1,0x65e2,1,0x6691,1,0x6885,
+1,0x6d77,1,0x6e1a,1,0x6f22,1,0x716e,1,0x722b,1,0x7422,1,0x7891,1,0x793e,
+1,0x7949,1,0x7948,1,0x7950,1,0x7956,1,0x795d,1,0x798d,1,0x798e,1,0x7a40,
+1,0x7a81,1,0x7bc0,1,0x7e09,1,0x7e41,1,0x7f72,1,0x8005,1,0x81ed,1,0x8279,
+1,0x8457,1,0x8910,1,0x8996,1,0x8b01,1,0x8b39,1,0x8cd3,1,0x8d08,1,0x8fb6,
+1,0x96e3,1,0x97ff,1,0x983b,1,0x6075,2,0xd850,0xdeee,1,0x8218,1,0x4e26,1,
+0x51b5,1,0x5168,1,0x4f80,1,0x5145,1,0x5180,1,0x52c7,1,0x52fa,1,0x5555,1,
+0x5599,1,0x55e2,1,0x58b3,1,0x5944,1,0x5954,1,0x5a62,1,0x5b28,1,0x5ed2,1,
+0x5ed9,1,0x5f69,1,0x5fad,1,0x60d8,1,0x614e,1,0x6108,1,0x6160,1,0x6234,1,
+0x63c4,1,0x641c,1,0x6452,1,0x6556,1,0x671b,1,0x6756,1,0x6b79,1,0x6edb,1,
+0x6ecb,1,0x701e,1,0x77a7,1,0x7235,1,0x72af,1,0x7471,1,0x7506,1,0x753b,1,
+0x761d,1,0x761f,1,0x76db,1,0x76f4,1,0x774a,1,0x7740,1,0x78cc,1,0x7ab1,1,
+0x7c7b,1,0x7d5b,1,0x7f3e,1,0x8352,1,0x83ef,1,0x8779,1,0x8941,1,0x8986,1,
+0x8abf,1,0x8acb,1,0x8aed,1,0x8b8a,1,0x8f38,1,0x9072,1,0x9199,1,0x9276,1,
+0x967c,1,0x97db,1,0x980b,1,0x9b12,2,0xd84a,0xdc4a,2,0xd84a,0xdc44,2,0xd84c,0xdfd5,
+1,0x3b9d,1,0x4018,1,0x4039,2,0xd854,0xde49,2,0xd857,0xdcd0,2,0xd85f,0xded3,1,
+0x9f43,1,0x9f8e,0xe02,0x5d9,0x5b4,0x1102,0x5f2,0x5b7,0x1802,0x5e9,0x5c1,0x1902,0x5e9,0x5c2,0xfb49,
+0x1843,0x5e9,0x5bc,0x5c1,0xfb49,0x1943,0x5e9,0x5bc,0x5c2,0x1102,0x5d0,0x5b7,0x1202,0x5d0,0x5b8,0x1502,
+0x5d0,0x5bc,0x1502,0x5d1,0x5bc,0x1502,0x5d2,0x5bc,0x1502,0x5d3,0x5bc,0x1502,0x5d4,0x5bc,0x1502,0x5d5,
+0x5bc,0x1502,0x5d6,0x5bc,0x1502,0x5d8,0x5bc,0x1502,0x5d9,0x5bc,0x1502,0x5da,0x5bc,0x1502,0x5db,0x5bc,
+0x1502,0x5dc,0x5bc,0x1502,0x5de,0x5bc,0x1502,0x5e0,0x5bc,0x1502,0x5e1,0x5bc,0x1502,0x5e3,0x5bc,0x1502,
+0x5e4,0x5bc,0x1502,0x5e6,0x5bc,0x1502,0x5e7,0x5bc,0x1502,0x5e8,0x5bc,0x1502,0x5e9,0x5bc,0x1502,0x5ea,
+0x5bc,0x1302,0x5d5,0x5b9,0x1702,0x5d1,0x5bf,0x1702,0x5db,0x5bf,0x1702,0x5e4,0x5bf,0xd804,0xd834,0xdd57,
+0xd834,0xdd65,0xd804,0xd834,0xdd58,0xd834,0xdd65,0xd834,0xdd5f,0xd834,0xdd6e,4,0xd846,0xd834,0xdd58,0xd834,
+0xdd65,0xd834,0xdd6e,0xd834,0xdd5f,0xd834,0xdd6f,4,0xd846,0xd834,0xdd58,0xd834,0xdd65,0xd834,0xdd6f,0xd834,
+0xdd5f,0xd834,0xdd70,4,0xd846,0xd834,0xdd58,0xd834,0xdd65,0xd834,0xdd70,0xd834,0xdd5f,0xd834,0xdd71,4,
+0xd846,0xd834,0xdd58,0xd834,0xdd65,0xd834,0xdd71,0xd834,0xdd5f,0xd834,0xdd72,4,0xd846,0xd834,0xdd58,0xd834,
+0xdd65,0xd834,0xdd72,0xd804,0xd834,0xddb9,0xd834,0xdd65,0xd804,0xd834,0xddba,0xd834,0xdd65,0xd834,0xddbb,0xd834,
+0xdd6e,4,0xd846,0xd834,0xddb9,0xd834,0xdd65,0xd834,0xdd6e,0xd834,0xddbc,0xd834,0xdd6e,4,0xd846,0xd834,
+0xddba,0xd834,0xdd65,0xd834,0xdd6e,0xd834,0xddbb,0xd834,0xdd6f,4,0xd846,0xd834,0xddb9,0xd834,0xdd65,0xd834,
+0xdd6f,0xd834,0xddbc,0xd834,0xdd6f,4,0xd846,0xd834,0xddba,0xd834,0xdd65,0xd834,0xdd6f,1,0x4e3d,1,
+0x4e38,1,0x4e41,2,0xd840,0xdd22,1,0x4f60,1,0x4fbb,1,0x5002,1,0x507a,1,0x5099,
+1,0x50cf,1,0x349e,2,0xd841,0xde3a,1,0x5154,1,0x5164,1,0x5177,2,0xd841,0xdd1c,
+1,0x34b9,1,0x5167,1,0x518d,2,0xd841,0xdd4b,1,0x5197,1,0x51a4,1,0x4ecc,1,
+0x51ac,2,0xd864,0xdddf,1,0x51f5,1,0x5203,1,0x34df,1,0x523b,1,0x5246,1,0x5272,
+1,0x5277,1,0x3515,1,0x5305,1,0x5306,1,0x5349,1,0x535a,1,0x5373,1,0x537d,
+1,0x537f,2,0xd842,0xde2c,1,0x7070,1,0x53ca,1,0x53df,2,0xd842,0xdf63,1,0x53eb,
+1,0x53f1,1,0x5406,1,0x549e,1,0x5438,1,0x5448,1,0x5468,1,0x54a2,1,0x54f6,
+1,0x5510,1,0x5553,1,0x5563,1,0x5584,1,0x55ab,1,0x55b3,1,0x55c2,1,0x5716,
+1,0x5717,1,0x5651,1,0x5674,1,0x58ee,1,0x57ce,1,0x57f4,1,0x580d,1,0x578b,
+1,0x5832,1,0x5831,1,0x58ac,2,0xd845,0xdce4,1,0x58f2,1,0x58f7,1,0x5906,1,
+0x591a,1,0x5922,1,0x5962,2,0xd845,0xdea8,2,0xd845,0xdeea,1,0x59ec,1,0x5a1b,1,
+0x5a27,1,0x59d8,1,0x5a66,1,0x36ee,1,0x36fc,1,0x5b08,1,0x5b3e,2,0xd846,0xddc8,
+1,0x5bc3,1,0x5bd8,1,0x5bf3,2,0xd846,0xdf18,1,0x5bff,1,0x5c06,1,0x5f53,1,
+0x5c22,1,0x3781,1,0x5c60,1,0x5cc0,1,0x5c8d,2,0xd847,0xdde4,1,0x5d43,2,0xd847,
+0xdde6,1,0x5d6e,1,0x5d6b,1,0x5d7c,1,0x5de1,1,0x5de2,1,0x382f,1,0x5dfd,1,
+0x5e28,1,0x5e3d,1,0x5e69,1,0x3862,2,0xd848,0xdd83,1,0x387c,1,0x5eb0,1,0x5eb3,
+1,0x5eb6,2,0xd868,0xdf92,1,0x5efe,2,0xd848,0xdf31,1,0x8201,1,0x5f22,1,0x38c7,
+2,0xd84c,0xdeb8,2,0xd858,0xddda,1,0x5f62,1,0x5f6b,1,0x38e3,1,0x5f9a,1,0x5fcd,
+1,0x5fd7,1,0x5ff9,1,0x6081,1,0x393a,1,0x391c,2,0xd849,0xded4,1,0x60c7,1,
+0x6148,1,0x614c,1,0x617a,1,0x61b2,1,0x61a4,1,0x61af,1,0x61de,1,0x6210,1,
+0x621b,1,0x625d,1,0x62b1,1,0x62d4,1,0x6350,2,0xd84a,0xdf0c,1,0x633d,1,0x62fc,
+1,0x6368,1,0x6383,1,0x63e4,2,0xd84a,0xdff1,1,0x6422,1,0x63c5,1,0x63a9,1,
+0x3a2e,1,0x6469,1,0x647e,1,0x649d,1,0x6477,1,0x3a6c,1,0x656c,2,0xd84c,0xdc0a,
+1,0x65e3,1,0x66f8,1,0x6649,1,0x3b19,1,0x3b08,1,0x3ae4,1,0x5192,1,0x5195,
+1,0x6700,1,0x669c,1,0x80ad,1,0x43d9,1,0x6721,1,0x675e,1,0x6753,2,0xd84c,
+0xdfc3,1,0x3b49,1,0x67fa,1,0x6785,1,0x6852,2,0xd84d,0xdc6d,1,0x688e,1,0x681f,
+1,0x6914,1,0x6942,1,0x69a3,1,0x69ea,1,0x6aa8,2,0xd84d,0xdea3,1,0x6adb,1,
+0x3c18,1,0x6b21,2,0xd84e,0xdca7,1,0x6b54,1,0x3c4e,1,0x6b72,1,0x6b9f,1,0x6bbb,
+2,0xd84e,0xde8d,2,0xd847,0xdd0b,2,0xd84e,0xdefa,1,0x6c4e,2,0xd84f,0xdcbc,1,0x6cbf,
+1,0x6ccd,1,0x6c67,1,0x6d16,1,0x6d3e,1,0x6d69,1,0x6d78,1,0x6d85,2,0xd84f,
+0xdd1e,1,0x6d34,1,0x6e2f,1,0x6e6e,1,0x3d33,1,0x6ec7,2,0xd84f,0xded1,1,0x6df9,
+1,0x6f6e,2,0xd84f,0xdf5e,2,0xd84f,0xdf8e,1,0x6fc6,1,0x7039,1,0x701b,1,0x3d96,
+1,0x704a,1,0x707d,1,0x7077,1,0x70ad,2,0xd841,0xdd25,1,0x7145,2,0xd850,0xde63,
+1,0x719c,2,0xd850,0xdfab,1,0x7228,1,0x7250,2,0xd851,0xde08,1,0x7280,1,0x7295,
+2,0xd851,0xdf35,2,0xd852,0xdc14,1,0x737a,1,0x738b,1,0x3eac,1,0x73a5,1,0x3eb8,
+1,0x7447,1,0x745c,1,0x7485,1,0x74ca,1,0x3f1b,1,0x7524,2,0xd853,0xdc36,1,
+0x753e,2,0xd853,0xdc92,2,0xd848,0xdd9f,1,0x7610,2,0xd853,0xdfa1,2,0xd853,0xdfb8,2,
+0xd854,0xdc44,1,0x3ffc,1,0x4008,2,0xd854,0xdcf3,2,0xd854,0xdcf2,2,0xd854,0xdd19,2,
+0xd854,0xdd33,1,0x771e,1,0x771f,1,0x778b,1,0x4046,1,0x4096,2,0xd855,0xdc1d,1,
+0x784e,1,0x40e3,2,0xd855,0xde26,2,0xd855,0xde9a,2,0xd855,0xdec5,1,0x79eb,1,0x412f,
+1,0x7a4a,1,0x7a4f,2,0xd856,0xdd7c,2,0xd856,0xdea7,1,0x7aee,1,0x4202,2,0xd856,
+0xdfab,1,0x7bc6,1,0x7bc9,1,0x4227,2,0xd857,0xdc80,1,0x7cd2,1,0x42a0,1,0x7ce8,
+1,0x7ce3,1,0x7d00,2,0xd857,0xdf86,1,0x7d63,1,0x4301,1,0x7dc7,1,0x7e02,1,
+0x7e45,1,0x4334,2,0xd858,0xde28,2,0xd858,0xde47,1,0x4359,2,0xd858,0xded9,1,0x7f7a,
+2,0xd858,0xdf3e,1,0x7f95,1,0x7ffa,2,0xd859,0xdcda,2,0xd859,0xdd23,1,0x8060,2,
+0xd859,0xdda8,1,0x8070,2,0xd84c,0xdf5f,1,0x43d5,1,0x80b2,1,0x8103,1,0x440b,1,
+0x813e,1,0x5ab5,2,0xd859,0xdfa7,2,0xd859,0xdfb5,2,0xd84c,0xdf93,2,0xd84c,0xdf9c,1,
+0x8204,1,0x8f9e,1,0x446b,1,0x8291,1,0x828b,1,0x829d,1,0x52b3,1,0x82b1,1,
+0x82b3,1,0x82bd,1,0x82e6,2,0xd85a,0xdf3c,1,0x831d,1,0x8363,1,0x83ad,1,0x8323,
+1,0x83bd,1,0x83e7,1,0x8353,1,0x83ca,1,0x83cc,1,0x83dc,2,0xd85b,0xdc36,2,
+0xd85b,0xdd6b,2,0xd85b,0xdcd5,1,0x452b,1,0x84f1,1,0x84f3,1,0x8516,2,0xd85c,0xdfca,
+1,0x8564,2,0xd85b,0xdf2c,1,0x455d,1,0x4561,2,0xd85b,0xdfb1,2,0xd85c,0xdcd2,1,
+0x456b,1,0x8650,1,0x8667,1,0x8669,1,0x86a9,1,0x8688,1,0x870e,1,0x86e2,1,
+0x8728,1,0x876b,1,0x8786,1,0x45d7,1,0x87e1,1,0x8801,1,0x45f9,1,0x8860,1,
+0x8863,2,0xd85d,0xde67,1,0x88d7,1,0x88de,1,0x4635,1,0x88fa,1,0x34bb,2,0xd85e,
+0xdcae,2,0xd85e,0xdd66,1,0x46be,1,0x46c7,1,0x8aa0,1,0x8c55,2,0xd85f,0xdca8,1,
+0x8cab,1,0x8cc1,1,0x8d1b,1,0x8d77,2,0xd85f,0xdf2f,2,0xd842,0xdc04,1,0x8dcb,1,
+0x8dbc,1,0x8df0,2,0xd842,0xdcde,1,0x8ed4,2,0xd861,0xddd2,2,0xd861,0xdded,1,0x9094,
+1,0x90f1,1,0x9111,2,0xd861,0xdf2e,1,0x911b,1,0x9238,1,0x92d7,1,0x92d8,1,
+0x927c,1,0x93f9,1,0x9415,2,0xd862,0xdffa,1,0x958b,1,0x4995,1,0x95b7,2,0xd863,
+0xdd77,1,0x49e6,1,0x96c3,1,0x5db2,1,0x9723,2,0xd864,0xdd45,2,0xd864,0xde1a,1,
+0x4a6e,1,0x4a76,1,0x97e0,2,0xd865,0xdc0a,1,0x4ab2,2,0xd865,0xdc96,1,0x9829,2,
+0xd865,0xddb6,1,0x98e2,1,0x4b33,1,0x9929,1,0x99a7,1,0x99c2,1,0x99fe,1,0x4bce,
+2,0xd866,0xdf30,1,0x9c40,1,0x9cfd,1,0x4cce,1,0x4ced,1,0x9d67,2,0xd868,0xdcce,
+1,0x4cf8,2,0xd868,0xdd05,2,0xd868,0xde0e,2,0xd868,0xde91,1,0x9ebb,1,0x4d56,1,
+0x9ef9,1,0x9efe,1,0x9f05,1,0x9f0f,1,0x9f16,1,0x9f3b,2,0xd869,0xde00,0x3ac,0xe642,
+0x3b1,0x301,0x3ad,0xe642,0x3b5,0x301,0x3ae,0xe642,0x3b7,0x301,0x3af,0xe642,0x3b9,0x301,0x3cc,0xe642,
+0x3bf,0x301,0x3cd,0xe642,0x3c5,0x301,0x3ce,0xe642,0x3c9,0x301,0x386,0xe642,0x391,0x301,0x388,0xe642,
+0x395,0x301,0x389,0xe642,0x397,0x301,0x390,1,0xe643,0x3b9,0x308,0x301,0x38a,0xe642,0x399,0x301,
+0x3b0,1,0xe643,0x3c5,0x308,0x301,0x38e,0xe642,0x3a5,0x301,0x385,0xe642,0xa8,0x301,0x38c,0xe642,
+0x39f,0x301,0x38f,0xe642,0x3a9,0x301,0xc5,0xe642,0x41,0x30a,0xe6e6,0xe681,0x300,0xe6e6,0xe681,0x301,
+0xe6e6,0xe681,0x313,0xe6e6,0xe682,0x308,0x301,0x8100,0x8282,0xf71,0xf72,0x8100,0x8482,0xf71,0xf74,0x8100,
+0x8282,0xf71,0xf80,0
};
static const uint8_t norm2_nfc_data_smallFCD[256]={
-0xc0,0xef,3,0x7f,0xdf,0x70,0xcf,0x87,0xc7,0xe6,0x66,0x46,0x64,0x46,0x66,0x5b,
-0x12,0,0,4,0,0,0,0x43,0x20,2,0x69,0xae,0xc2,0xc0,0xff,0xff,
+0xc0,0xef,3,0x7f,0xdf,0x70,0xcf,0x87,0xc7,0xe6,0x66,0x46,0x64,0x46,0x66,0x5b,
+0x12,0,0,4,0,0,0,0x43,0x20,2,0x69,0xae,0xc2,0xc0,0xff,0xff,
0xc0,0x72,0xbf,0,0,0,0,0,0,0,0x40,0,0x80,0x88,0,0,
0xfe,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,0,0,
@@ -1138,7 +1138,7 @@ static const uint8_t norm2_nfc_data_smallFCD[256]={
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,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,0x98,0,0xc3,0x66,0xe0,0x80,0,0,0,0,
+0,0,0,0,0,0,0x98,0,0xc3,0x66,0xe0,0x80,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,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,
diff --git a/contrib/libs/icu/common/norm2allmodes.h b/contrib/libs/icu/common/norm2allmodes.h
index ccb22433ef..682ece28f1 100644
--- a/contrib/libs/icu/common/norm2allmodes.h
+++ b/contrib/libs/icu/common/norm2allmodes.h
@@ -1,11 +1,11 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2014, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
-* norm2allmodes.h
+* norm2allmodes.h
*
* created on: 2014sep07
* created by: Markus W. Scherer
@@ -18,9 +18,9 @@
#if !UCONFIG_NO_NORMALIZATION
-#include "unicode/edits.h"
+#include "unicode/edits.h"
#include "unicode/normalizer2.h"
-#include "unicode/stringoptions.h"
+#include "unicode/stringoptions.h"
#include "unicode/unistr.h"
#include "cpputils.h"
#include "normalizer2impl.h"
@@ -212,8 +212,8 @@ private:
virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const {
return impl.isDecompYes(impl.getNorm16(c)) ? UNORM_YES : UNORM_NO;
}
- virtual UBool hasBoundaryBefore(UChar32 c) const { return impl.hasDecompBoundaryBefore(c); }
- virtual UBool hasBoundaryAfter(UChar32 c) const { return impl.hasDecompBoundaryAfter(c); }
+ virtual UBool hasBoundaryBefore(UChar32 c) const { return impl.hasDecompBoundaryBefore(c); }
+ virtual UBool hasBoundaryAfter(UChar32 c) const { return impl.hasDecompBoundaryAfter(c); }
virtual UBool isInert(UChar32 c) const { return impl.isDecompInert(c); }
};
@@ -226,35 +226,35 @@ public:
private:
virtual void
normalize(const UChar *src, const UChar *limit,
- ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE {
+ ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE {
impl.compose(src, limit, onlyContiguous, TRUE, buffer, errorCode);
}
using Normalizer2WithImpl::normalize; // Avoid warning about hiding base class function.
-
- void
- normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink,
- Edits *edits, UErrorCode &errorCode) const U_OVERRIDE {
- if (U_FAILURE(errorCode)) {
- return;
- }
- if (edits != nullptr && (options & U_EDITS_NO_RESET) == 0) {
- edits->reset();
- }
- const uint8_t *s = reinterpret_cast<const uint8_t *>(src.data());
- impl.composeUTF8(options, onlyContiguous, s, s + src.length(),
- &sink, edits, errorCode);
- sink.Flush();
- }
-
+
+ void
+ normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink,
+ Edits *edits, UErrorCode &errorCode) const U_OVERRIDE {
+ if (U_FAILURE(errorCode)) {
+ return;
+ }
+ if (edits != nullptr && (options & U_EDITS_NO_RESET) == 0) {
+ edits->reset();
+ }
+ const uint8_t *s = reinterpret_cast<const uint8_t *>(src.data());
+ impl.composeUTF8(options, onlyContiguous, s, s + src.length(),
+ &sink, edits, errorCode);
+ sink.Flush();
+ }
+
virtual void
normalizeAndAppend(const UChar *src, const UChar *limit, UBool doNormalize,
UnicodeString &safeMiddle,
- ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE {
+ ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE {
impl.composeAndAppend(src, limit, doNormalize, onlyContiguous, safeMiddle, buffer, errorCode);
}
virtual UBool
- isNormalized(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE {
+ isNormalized(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE {
if(U_FAILURE(errorCode)) {
return FALSE;
}
@@ -270,16 +270,16 @@ private:
}
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;
- }
- const uint8_t *s = reinterpret_cast<const uint8_t *>(sp.data());
- return impl.composeUTF8(0, onlyContiguous, s, s + sp.length(), nullptr, nullptr, errorCode);
- }
+ virtual UBool
+ isNormalizedUTF8(StringPiece sp, UErrorCode &errorCode) const U_OVERRIDE {
+ if(U_FAILURE(errorCode)) {
+ 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);
+ }
virtual UNormalizationCheckResult
- quickCheck(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE {
+ quickCheck(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE {
if(U_FAILURE(errorCode)) {
return UNORM_MAYBE;
}
@@ -293,21 +293,21 @@ private:
return qcResult;
}
virtual const UChar *
- spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &) const U_OVERRIDE {
+ spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &) const U_OVERRIDE {
return impl.composeQuickCheck(src, limit, onlyContiguous, NULL);
}
using Normalizer2WithImpl::spanQuickCheckYes; // Avoid warning about hiding base class function.
- virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const U_OVERRIDE {
+ virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const U_OVERRIDE {
return impl.getCompQuickCheck(impl.getNorm16(c));
}
- virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE {
+ virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE {
return impl.hasCompBoundaryBefore(c);
}
- virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE {
- return impl.hasCompBoundaryAfter(c, onlyContiguous);
+ virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE {
+ return impl.hasCompBoundaryAfter(c, onlyContiguous);
}
- virtual UBool isInert(UChar32 c) const U_OVERRIDE {
- return impl.isCompInert(c, onlyContiguous);
+ virtual UBool isInert(UChar32 c) const U_OVERRIDE {
+ return impl.isCompInert(c, onlyContiguous);
}
const UBool onlyContiguous;
diff --git a/contrib/libs/icu/common/normalizer2.cpp b/contrib/libs/icu/common/normalizer2.cpp
index e88e0dc8bd..6be7e0b21a 100644
--- a/contrib/libs/icu/common/normalizer2.cpp
+++ b/contrib/libs/icu/common/normalizer2.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: normalizer2.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -20,9 +20,9 @@
#if !UCONFIG_NO_NORMALIZATION
-#include "unicode/edits.h"
+#include "unicode/edits.h"
#include "unicode/normalizer2.h"
-#include "unicode/stringoptions.h"
+#include "unicode/stringoptions.h"
#include "unicode/unistr.h"
#include "unicode/unorm.h"
#include "cstring.h"
@@ -34,11 +34,11 @@
using icu::Normalizer2Impl;
-#if NORM2_HARDCODE_NFC_DATA
+#if NORM2_HARDCODE_NFC_DATA
// NFC/NFD data machine-generated by gennorm2 --csource
#define INCLUDED_FROM_NORMALIZER2_CPP
#include "norm2_nfc_data.h"
-#endif
+#endif
U_NAMESPACE_BEGIN
@@ -46,20 +46,20 @@ U_NAMESPACE_BEGIN
Normalizer2::~Normalizer2() {}
-void
-Normalizer2::normalizeUTF8(uint32_t /*options*/, StringPiece src, ByteSink &sink,
- Edits *edits, UErrorCode &errorCode) const {
- if (U_FAILURE(errorCode)) {
- return;
- }
- if (edits != nullptr) {
- errorCode = U_UNSUPPORTED_ERROR;
- return;
- }
- UnicodeString src16 = UnicodeString::fromUTF8(src);
- normalize(src16, errorCode).toUTF8(sink);
-}
-
+void
+Normalizer2::normalizeUTF8(uint32_t /*options*/, StringPiece src, ByteSink &sink,
+ Edits *edits, UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode)) {
+ return;
+ }
+ if (edits != nullptr) {
+ errorCode = U_UNSUPPORTED_ERROR;
+ return;
+ }
+ UnicodeString src16 = UnicodeString::fromUTF8(src);
+ normalize(src16, errorCode).toUTF8(sink);
+}
+
UBool
Normalizer2::getRawDecomposition(UChar32, UnicodeString &) const {
return FALSE;
@@ -75,11 +75,11 @@ Normalizer2::getCombiningClass(UChar32 /*c*/) const {
return 0;
}
-UBool
-Normalizer2::isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const {
- return U_SUCCESS(errorCode) && isNormalized(UnicodeString::fromUTF8(s), errorCode);
-}
-
+UBool
+Normalizer2::isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const {
+ return U_SUCCESS(errorCode) && isNormalized(UnicodeString::fromUTF8(s), errorCode);
+}
+
// Normalizer2 implementation for the old UNORM_NONE.
class NoopNormalizer2 : public Normalizer2 {
virtual ~NoopNormalizer2();
@@ -87,7 +87,7 @@ class NoopNormalizer2 : public Normalizer2 {
virtual UnicodeString &
normalize(const UnicodeString &src,
UnicodeString &dest,
- UErrorCode &errorCode) const U_OVERRIDE {
+ UErrorCode &errorCode) const U_OVERRIDE {
if(U_SUCCESS(errorCode)) {
if(&dest!=&src) {
dest=src;
@@ -97,27 +97,27 @@ class NoopNormalizer2 : public Normalizer2 {
}
return dest;
}
- virtual void
- normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink,
- Edits *edits, UErrorCode &errorCode) const U_OVERRIDE {
- if(U_SUCCESS(errorCode)) {
- if (edits != nullptr) {
- if ((options & U_EDITS_NO_RESET) == 0) {
- edits->reset();
- }
- edits->addUnchanged(src.length());
- }
- if ((options & U_OMIT_UNCHANGED_TEXT) == 0) {
- sink.Append(src.data(), src.length());
- }
- sink.Flush();
- }
- }
-
+ virtual void
+ normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink,
+ Edits *edits, UErrorCode &errorCode) const U_OVERRIDE {
+ if(U_SUCCESS(errorCode)) {
+ if (edits != nullptr) {
+ if ((options & U_EDITS_NO_RESET) == 0) {
+ edits->reset();
+ }
+ edits->addUnchanged(src.length());
+ }
+ if ((options & U_OMIT_UNCHANGED_TEXT) == 0) {
+ sink.Append(src.data(), src.length());
+ }
+ sink.Flush();
+ }
+ }
+
virtual UnicodeString &
normalizeSecondAndAppend(UnicodeString &first,
const UnicodeString &second,
- UErrorCode &errorCode) const U_OVERRIDE {
+ UErrorCode &errorCode) const U_OVERRIDE {
if(U_SUCCESS(errorCode)) {
if(&first!=&second) {
first.append(second);
@@ -130,7 +130,7 @@ class NoopNormalizer2 : public Normalizer2 {
virtual UnicodeString &
append(UnicodeString &first,
const UnicodeString &second,
- UErrorCode &errorCode) const U_OVERRIDE {
+ UErrorCode &errorCode) const U_OVERRIDE {
if(U_SUCCESS(errorCode)) {
if(&first!=&second) {
first.append(second);
@@ -141,29 +141,29 @@ class NoopNormalizer2 : public Normalizer2 {
return first;
}
virtual UBool
- getDecomposition(UChar32, UnicodeString &) const U_OVERRIDE {
+ getDecomposition(UChar32, UnicodeString &) const U_OVERRIDE {
return FALSE;
}
- // No need to U_OVERRIDE the default getRawDecomposition().
+ // No need to U_OVERRIDE the default getRawDecomposition().
+ virtual UBool
+ isNormalized(const UnicodeString &, UErrorCode &errorCode) const U_OVERRIDE {
+ return U_SUCCESS(errorCode);
+ }
virtual UBool
- isNormalized(const UnicodeString &, UErrorCode &errorCode) const U_OVERRIDE {
- return U_SUCCESS(errorCode);
+ isNormalizedUTF8(StringPiece, UErrorCode &errorCode) const U_OVERRIDE {
+ return U_SUCCESS(errorCode);
}
- virtual UBool
- isNormalizedUTF8(StringPiece, UErrorCode &errorCode) const U_OVERRIDE {
- return U_SUCCESS(errorCode);
- }
virtual UNormalizationCheckResult
- quickCheck(const UnicodeString &, UErrorCode &) const U_OVERRIDE {
+ quickCheck(const UnicodeString &, UErrorCode &) const U_OVERRIDE {
return UNORM_YES;
}
virtual int32_t
- spanQuickCheckYes(const UnicodeString &s, UErrorCode &) const U_OVERRIDE {
+ spanQuickCheckYes(const UnicodeString &s, UErrorCode &) const U_OVERRIDE {
return s.length();
}
- virtual UBool hasBoundaryBefore(UChar32) const U_OVERRIDE { return TRUE; }
- virtual UBool hasBoundaryAfter(UChar32) const U_OVERRIDE { return TRUE; }
- virtual UBool isInert(UChar32) const U_OVERRIDE { return TRUE; }
+ virtual UBool hasBoundaryBefore(UChar32) const U_OVERRIDE { return TRUE; }
+ virtual UBool hasBoundaryAfter(UChar32) const U_OVERRIDE { return TRUE; }
+ virtual UBool isInert(UChar32) const U_OVERRIDE { return TRUE; }
};
NoopNormalizer2::~NoopNormalizer2() {}
@@ -178,36 +178,36 @@ FCDNormalizer2::~FCDNormalizer2() {}
// instance cache ---------------------------------------------------------- ***
-U_CDECL_BEGIN
-static UBool U_CALLCONV uprv_normalizer2_cleanup();
-U_CDECL_END
-
-static Normalizer2 *noopSingleton;
-static icu::UInitOnce noopInitOnce = U_INITONCE_INITIALIZER;
-
-static void U_CALLCONV initNoopSingleton(UErrorCode &errorCode) {
- if(U_FAILURE(errorCode)) {
- return;
- }
- noopSingleton=new NoopNormalizer2;
- if(noopSingleton==NULL) {
- errorCode=U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- ucln_common_registerCleanup(UCLN_COMMON_NORMALIZER2, uprv_normalizer2_cleanup);
-}
-
-const Normalizer2 *Normalizer2Factory::getNoopInstance(UErrorCode &errorCode) {
- if(U_FAILURE(errorCode)) { return NULL; }
- umtx_initOnce(noopInitOnce, &initNoopSingleton, errorCode);
- return noopSingleton;
-}
-
-const Normalizer2Impl *
-Normalizer2Factory::getImpl(const Normalizer2 *norm2) {
- return &((Normalizer2WithImpl *)norm2)->impl;
-}
-
+U_CDECL_BEGIN
+static UBool U_CALLCONV uprv_normalizer2_cleanup();
+U_CDECL_END
+
+static Normalizer2 *noopSingleton;
+static icu::UInitOnce noopInitOnce = U_INITONCE_INITIALIZER;
+
+static void U_CALLCONV initNoopSingleton(UErrorCode &errorCode) {
+ if(U_FAILURE(errorCode)) {
+ return;
+ }
+ noopSingleton=new NoopNormalizer2;
+ if(noopSingleton==NULL) {
+ errorCode=U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ ucln_common_registerCleanup(UCLN_COMMON_NORMALIZER2, uprv_normalizer2_cleanup);
+}
+
+const Normalizer2 *Normalizer2Factory::getNoopInstance(UErrorCode &errorCode) {
+ if(U_FAILURE(errorCode)) { return NULL; }
+ umtx_initOnce(noopInitOnce, &initNoopSingleton, errorCode);
+ return noopSingleton;
+}
+
+const Normalizer2Impl *
+Normalizer2Factory::getImpl(const Normalizer2 *norm2) {
+ return &((Normalizer2WithImpl *)norm2)->impl;
+}
+
Norm2AllModes::~Norm2AllModes() {
delete impl;
}
@@ -227,7 +227,7 @@ Norm2AllModes::createInstance(Normalizer2Impl *impl, UErrorCode &errorCode) {
return allModes;
}
-#if NORM2_HARDCODE_NFC_DATA
+#if NORM2_HARDCODE_NFC_DATA
Norm2AllModes *
Norm2AllModes::createNFCInstance(UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
@@ -286,24 +286,24 @@ Normalizer2Factory::getNFCImpl(UErrorCode &errorCode) {
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
return allModes!=NULL ? allModes->impl : NULL;
}
-#endif // NORM2_HARDCODE_NFC_DATA
+#endif // NORM2_HARDCODE_NFC_DATA
-U_CDECL_BEGIN
-
-static UBool U_CALLCONV uprv_normalizer2_cleanup() {
- delete noopSingleton;
- noopSingleton = NULL;
- noopInitOnce.reset();
-#if NORM2_HARDCODE_NFC_DATA
- delete nfcSingleton;
- nfcSingleton = NULL;
- nfcInitOnce.reset();
-#endif
- return TRUE;
+U_CDECL_BEGIN
+
+static UBool U_CALLCONV uprv_normalizer2_cleanup() {
+ delete noopSingleton;
+ noopSingleton = NULL;
+ noopInitOnce.reset();
+#if NORM2_HARDCODE_NFC_DATA
+ delete nfcSingleton;
+ nfcSingleton = NULL;
+ nfcInitOnce.reset();
+#endif
+ return TRUE;
}
-U_CDECL_END
-
+U_CDECL_END
+
U_NAMESPACE_END
// C API ------------------------------------------------------------------- ***
diff --git a/contrib/libs/icu/common/normalizer2impl.cpp b/contrib/libs/icu/common/normalizer2impl.cpp
index 8beedeadef..cbf6b4d980 100644
--- a/contrib/libs/icu/common/normalizer2impl.cpp
+++ b/contrib/libs/icu/common/normalizer2impl.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: normalizer2impl.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -16,169 +16,169 @@
* created by: Markus W. Scherer
*/
-// #define UCPTRIE_DEBUG
-
+// #define UCPTRIE_DEBUG
+
#include "unicode/utypes.h"
#if !UCONFIG_NO_NORMALIZATION
-#include "unicode/bytestream.h"
-#include "unicode/edits.h"
+#include "unicode/bytestream.h"
+#include "unicode/edits.h"
#include "unicode/normalizer2.h"
-#include "unicode/stringoptions.h"
-#include "unicode/ucptrie.h"
+#include "unicode/stringoptions.h"
+#include "unicode/ucptrie.h"
#include "unicode/udata.h"
-#include "unicode/umutablecptrie.h"
+#include "unicode/umutablecptrie.h"
#include "unicode/ustring.h"
#include "unicode/utf16.h"
-#include "unicode/utf8.h"
-#include "bytesinkutil.h"
+#include "unicode/utf8.h"
+#include "bytesinkutil.h"
#include "cmemory.h"
#include "mutex.h"
#include "normalizer2impl.h"
#include "putilimp.h"
#include "uassert.h"
-#include "ucptrie_impl.h"
+#include "ucptrie_impl.h"
#include "uset_imp.h"
#include "uvector.h"
U_NAMESPACE_BEGIN
-namespace {
-
-/**
- * UTF-8 lead byte for minNoMaybeCP.
- * Can be lower than the actual lead byte for c.
- * Typically U+0300 for NFC/NFD, U+00A0 for NFKC/NFKD, U+0041 for NFKC_Casefold.
- */
-inline uint8_t leadByteForCP(UChar32 c) {
- if (c <= 0x7f) {
- return (uint8_t)c;
- } else if (c <= 0x7ff) {
- return (uint8_t)(0xc0+(c>>6));
- } else {
- // Should not occur because ccc(U+0300)!=0.
- return 0xe0;
- }
-}
-
-/**
- * Returns the code point from one single well-formed UTF-8 byte sequence
- * between cpStart and cpLimit.
- *
- * Trie UTF-8 macros do not assemble whole code points (for efficiency).
- * When we do need the code point, we call this function.
- * We should not need it for normalization-inert data (norm16==0).
- * Illegal sequences yield the error value norm16==0 just like real normalization-inert code points.
- */
-UChar32 codePointFromValidUTF8(const uint8_t *cpStart, const uint8_t *cpLimit) {
- // Similar to U8_NEXT_UNSAFE(s, i, c).
- U_ASSERT(cpStart < cpLimit);
- uint8_t c = *cpStart;
- switch(cpLimit-cpStart) {
- case 1:
- return c;
- case 2:
- return ((c&0x1f)<<6) | (cpStart[1]&0x3f);
- case 3:
- // no need for (c&0xf) because the upper bits are truncated after <<12 in the cast to (UChar)
- return (UChar)((c<<12) | ((cpStart[1]&0x3f)<<6) | (cpStart[2]&0x3f));
- case 4:
- return ((c&7)<<18) | ((cpStart[1]&0x3f)<<12) | ((cpStart[2]&0x3f)<<6) | (cpStart[3]&0x3f);
- default:
- UPRV_UNREACHABLE; // Should not occur.
- }
-}
-
-/**
- * Returns the last code point in [start, p[ if it is valid and in U+1000..U+D7FF.
- * Otherwise returns a negative value.
- */
-UChar32 previousHangulOrJamo(const uint8_t *start, const uint8_t *p) {
- if ((p - start) >= 3) {
- p -= 3;
- uint8_t l = *p;
- uint8_t t1, t2;
- if (0xe1 <= l && l <= 0xed &&
- (t1 = (uint8_t)(p[1] - 0x80)) <= 0x3f &&
- (t2 = (uint8_t)(p[2] - 0x80)) <= 0x3f &&
- (l < 0xed || t1 <= 0x1f)) {
- return ((l & 0xf) << 12) | (t1 << 6) | t2;
- }
- }
- return U_SENTINEL;
-}
-
-/**
- * Returns the offset from the Jamo T base if [src, limit[ starts with a single Jamo T code point.
- * Otherwise returns a negative value.
- */
-int32_t getJamoTMinusBase(const uint8_t *src, const uint8_t *limit) {
- // Jamo T: E1 86 A8..E1 87 82
- if ((limit - src) >= 3 && *src == 0xe1) {
- if (src[1] == 0x86) {
- uint8_t t = src[2];
- // The first Jamo T is U+11A8 but JAMO_T_BASE is 11A7.
- // Offset 0 does not correspond to any conjoining Jamo.
- if (0xa8 <= t && t <= 0xbf) {
- return t - 0xa7;
- }
- } else if (src[1] == 0x87) {
- uint8_t t = src[2];
- if ((int8_t)t <= (int8_t)0x82u) {
- return t - (0xa7 - 0x40);
- }
- }
- }
- return -1;
-}
-
-void
-appendCodePointDelta(const uint8_t *cpStart, const uint8_t *cpLimit, int32_t delta,
- ByteSink &sink, Edits *edits) {
- char buffer[U8_MAX_LENGTH];
- int32_t length;
- int32_t cpLength = (int32_t)(cpLimit - cpStart);
- if (cpLength == 1) {
- // The builder makes ASCII map to ASCII.
- buffer[0] = (uint8_t)(*cpStart + delta);
- length = 1;
- } else {
- int32_t trail = *(cpLimit-1) + delta;
- if (0x80 <= trail && trail <= 0xbf) {
- // The delta only changes the last trail byte.
- --cpLimit;
- length = 0;
- do { buffer[length++] = *cpStart++; } while (cpStart < cpLimit);
- buffer[length++] = (uint8_t)trail;
- } else {
- // Decode the code point, add the delta, re-encode.
- UChar32 c = codePointFromValidUTF8(cpStart, cpLimit) + delta;
- length = 0;
- U8_APPEND_UNSAFE(buffer, length, c);
- }
- }
- if (edits != nullptr) {
- edits->addReplace(cpLength, length);
- }
- sink.Append(buffer, length);
-}
-
-} // namespace
-
+namespace {
+
+/**
+ * UTF-8 lead byte for minNoMaybeCP.
+ * Can be lower than the actual lead byte for c.
+ * Typically U+0300 for NFC/NFD, U+00A0 for NFKC/NFKD, U+0041 for NFKC_Casefold.
+ */
+inline uint8_t leadByteForCP(UChar32 c) {
+ if (c <= 0x7f) {
+ return (uint8_t)c;
+ } else if (c <= 0x7ff) {
+ return (uint8_t)(0xc0+(c>>6));
+ } else {
+ // Should not occur because ccc(U+0300)!=0.
+ return 0xe0;
+ }
+}
+
+/**
+ * Returns the code point from one single well-formed UTF-8 byte sequence
+ * between cpStart and cpLimit.
+ *
+ * Trie UTF-8 macros do not assemble whole code points (for efficiency).
+ * When we do need the code point, we call this function.
+ * We should not need it for normalization-inert data (norm16==0).
+ * Illegal sequences yield the error value norm16==0 just like real normalization-inert code points.
+ */
+UChar32 codePointFromValidUTF8(const uint8_t *cpStart, const uint8_t *cpLimit) {
+ // Similar to U8_NEXT_UNSAFE(s, i, c).
+ U_ASSERT(cpStart < cpLimit);
+ uint8_t c = *cpStart;
+ switch(cpLimit-cpStart) {
+ case 1:
+ return c;
+ case 2:
+ return ((c&0x1f)<<6) | (cpStart[1]&0x3f);
+ case 3:
+ // no need for (c&0xf) because the upper bits are truncated after <<12 in the cast to (UChar)
+ return (UChar)((c<<12) | ((cpStart[1]&0x3f)<<6) | (cpStart[2]&0x3f));
+ case 4:
+ return ((c&7)<<18) | ((cpStart[1]&0x3f)<<12) | ((cpStart[2]&0x3f)<<6) | (cpStart[3]&0x3f);
+ default:
+ UPRV_UNREACHABLE; // Should not occur.
+ }
+}
+
+/**
+ * Returns the last code point in [start, p[ if it is valid and in U+1000..U+D7FF.
+ * Otherwise returns a negative value.
+ */
+UChar32 previousHangulOrJamo(const uint8_t *start, const uint8_t *p) {
+ if ((p - start) >= 3) {
+ p -= 3;
+ uint8_t l = *p;
+ uint8_t t1, t2;
+ if (0xe1 <= l && l <= 0xed &&
+ (t1 = (uint8_t)(p[1] - 0x80)) <= 0x3f &&
+ (t2 = (uint8_t)(p[2] - 0x80)) <= 0x3f &&
+ (l < 0xed || t1 <= 0x1f)) {
+ return ((l & 0xf) << 12) | (t1 << 6) | t2;
+ }
+ }
+ return U_SENTINEL;
+}
+
+/**
+ * Returns the offset from the Jamo T base if [src, limit[ starts with a single Jamo T code point.
+ * Otherwise returns a negative value.
+ */
+int32_t getJamoTMinusBase(const uint8_t *src, const uint8_t *limit) {
+ // Jamo T: E1 86 A8..E1 87 82
+ if ((limit - src) >= 3 && *src == 0xe1) {
+ if (src[1] == 0x86) {
+ uint8_t t = src[2];
+ // The first Jamo T is U+11A8 but JAMO_T_BASE is 11A7.
+ // Offset 0 does not correspond to any conjoining Jamo.
+ if (0xa8 <= t && t <= 0xbf) {
+ return t - 0xa7;
+ }
+ } else if (src[1] == 0x87) {
+ uint8_t t = src[2];
+ if ((int8_t)t <= (int8_t)0x82u) {
+ return t - (0xa7 - 0x40);
+ }
+ }
+ }
+ return -1;
+}
+
+void
+appendCodePointDelta(const uint8_t *cpStart, const uint8_t *cpLimit, int32_t delta,
+ ByteSink &sink, Edits *edits) {
+ char buffer[U8_MAX_LENGTH];
+ int32_t length;
+ int32_t cpLength = (int32_t)(cpLimit - cpStart);
+ if (cpLength == 1) {
+ // The builder makes ASCII map to ASCII.
+ buffer[0] = (uint8_t)(*cpStart + delta);
+ length = 1;
+ } else {
+ int32_t trail = *(cpLimit-1) + delta;
+ if (0x80 <= trail && trail <= 0xbf) {
+ // The delta only changes the last trail byte.
+ --cpLimit;
+ length = 0;
+ do { buffer[length++] = *cpStart++; } while (cpStart < cpLimit);
+ buffer[length++] = (uint8_t)trail;
+ } else {
+ // Decode the code point, add the delta, re-encode.
+ UChar32 c = codePointFromValidUTF8(cpStart, cpLimit) + delta;
+ length = 0;
+ U8_APPEND_UNSAFE(buffer, length, c);
+ }
+ }
+ if (edits != nullptr) {
+ edits->addReplace(cpLength, length);
+ }
+ sink.Append(buffer, length);
+}
+
+} // namespace
+
// ReorderingBuffer -------------------------------------------------------- ***
-ReorderingBuffer::ReorderingBuffer(const Normalizer2Impl &ni, UnicodeString &dest,
- UErrorCode &errorCode) :
- impl(ni), str(dest),
- start(str.getBuffer(8)), reorderStart(start), limit(start),
- remainingCapacity(str.getCapacity()), lastCC(0) {
- if (start == nullptr && U_SUCCESS(errorCode)) {
- // getBuffer() already did str.setToBogus()
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- }
-}
-
+ReorderingBuffer::ReorderingBuffer(const Normalizer2Impl &ni, UnicodeString &dest,
+ UErrorCode &errorCode) :
+ impl(ni), str(dest),
+ start(str.getBuffer(8)), reorderStart(start), limit(start),
+ remainingCapacity(str.getCapacity()), lastCC(0) {
+ if (start == nullptr && U_SUCCESS(errorCode)) {
+ // getBuffer() already did str.setToBogus()
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ }
+}
+
UBool ReorderingBuffer::init(int32_t destCapacity, UErrorCode &errorCode) {
int32_t length=str.length();
start=str.getBuffer(destCapacity);
@@ -211,32 +211,32 @@ UBool ReorderingBuffer::equals(const UChar *otherStart, const UChar *otherLimit)
0==u_memcmp(start, otherStart, length);
}
-UBool ReorderingBuffer::equals(const uint8_t *otherStart, const uint8_t *otherLimit) const {
- U_ASSERT((otherLimit - otherStart) <= INT32_MAX); // ensured by caller
- int32_t length = (int32_t)(limit - start);
- int32_t otherLength = (int32_t)(otherLimit - otherStart);
- // For equal strings, UTF-8 is at least as long as UTF-16, and at most three times as long.
- if (otherLength < length || (otherLength / 3) > length) {
- return FALSE;
- }
- // Compare valid strings from between normalization boundaries.
- // (Invalid sequences are normalization-inert.)
- for (int32_t i = 0, j = 0;;) {
- if (i >= length) {
- return j >= otherLength;
- } else if (j >= otherLength) {
- return FALSE;
- }
- // Not at the end of either string yet.
- UChar32 c, other;
- U16_NEXT_UNSAFE(start, i, c);
- U8_NEXT_UNSAFE(otherStart, j, other);
- if (c != other) {
- return FALSE;
- }
- }
-}
-
+UBool ReorderingBuffer::equals(const uint8_t *otherStart, const uint8_t *otherLimit) const {
+ U_ASSERT((otherLimit - otherStart) <= INT32_MAX); // ensured by caller
+ int32_t length = (int32_t)(limit - start);
+ int32_t otherLength = (int32_t)(otherLimit - otherStart);
+ // For equal strings, UTF-8 is at least as long as UTF-16, and at most three times as long.
+ if (otherLength < length || (otherLength / 3) > length) {
+ return FALSE;
+ }
+ // Compare valid strings from between normalization boundaries.
+ // (Invalid sequences are normalization-inert.)
+ for (int32_t i = 0, j = 0;;) {
+ if (i >= length) {
+ return j >= otherLength;
+ } else if (j >= otherLength) {
+ return FALSE;
+ }
+ // Not at the end of either string yet.
+ UChar32 c, other;
+ U16_NEXT_UNSAFE(start, i, c);
+ U8_NEXT_UNSAFE(otherStart, j, other);
+ if (c != other) {
+ return FALSE;
+ }
+ }
+}
+
UBool ReorderingBuffer::appendSupplementary(UChar32 c, uint8_t cc, UErrorCode &errorCode) {
if(remainingCapacity<2 && !resize(2, errorCode)) {
return FALSE;
@@ -256,7 +256,7 @@ UBool ReorderingBuffer::appendSupplementary(UChar32 c, uint8_t cc, UErrorCode &e
return TRUE;
}
-UBool ReorderingBuffer::append(const UChar *s, int32_t length, UBool isNFD,
+UBool ReorderingBuffer::append(const UChar *s, int32_t length, UBool isNFD,
uint8_t leadCC, uint8_t trailCC,
UErrorCode &errorCode) {
if(length==0) {
@@ -283,11 +283,11 @@ UBool ReorderingBuffer::append(const UChar *s, int32_t length, UBool isNFD,
while(i<length) {
U16_NEXT(s, i, length, c);
if(i<length) {
- if (isNFD) {
- leadCC = Normalizer2Impl::getCCFromYesOrMaybe(impl.getRawNorm16(c));
- } else {
- leadCC = impl.getCC(impl.getNorm16(c));
- }
+ if (isNFD) {
+ leadCC = Normalizer2Impl::getCCFromYesOrMaybe(impl.getRawNorm16(c));
+ } else {
+ leadCC = impl.getCC(impl.getNorm16(c));
+ }
} else {
leadCC=trailCC;
}
@@ -392,7 +392,7 @@ uint8_t ReorderingBuffer::previousCC() {
--codePointStart;
c=U16_GET_SUPPLEMENTARY(c2, c);
}
- return impl.getCCFromYesOrMaybeCP(c);
+ return impl.getCCFromYesOrMaybeCP(c);
}
// Inserts c somewhere before the last character.
@@ -417,8 +417,8 @@ struct CanonIterData : public UMemory {
CanonIterData(UErrorCode &errorCode);
~CanonIterData();
void addToStartSet(UChar32 origin, UChar32 decompLead, UErrorCode &errorCode);
- UMutableCPTrie *mutableTrie;
- UCPTrie *trie;
+ UMutableCPTrie *mutableTrie;
+ UCPTrie *trie;
UVector canonStartSets; // contains UnicodeSet *
};
@@ -427,27 +427,27 @@ Normalizer2Impl::~Normalizer2Impl() {
}
void
-Normalizer2Impl::init(const int32_t *inIndexes, const UCPTrie *inTrie,
+Normalizer2Impl::init(const int32_t *inIndexes, const UCPTrie *inTrie,
const uint16_t *inExtraData, const uint8_t *inSmallFCD) {
- minDecompNoCP = static_cast<UChar>(inIndexes[IX_MIN_DECOMP_NO_CP]);
- minCompNoMaybeCP = static_cast<UChar>(inIndexes[IX_MIN_COMP_NO_MAYBE_CP]);
- minLcccCP = static_cast<UChar>(inIndexes[IX_MIN_LCCC_CP]);
-
- minYesNo = static_cast<uint16_t>(inIndexes[IX_MIN_YES_NO]);
- minYesNoMappingsOnly = static_cast<uint16_t>(inIndexes[IX_MIN_YES_NO_MAPPINGS_ONLY]);
- minNoNo = static_cast<uint16_t>(inIndexes[IX_MIN_NO_NO]);
- minNoNoCompBoundaryBefore = static_cast<uint16_t>(inIndexes[IX_MIN_NO_NO_COMP_BOUNDARY_BEFORE]);
- minNoNoCompNoMaybeCC = static_cast<uint16_t>(inIndexes[IX_MIN_NO_NO_COMP_NO_MAYBE_CC]);
- minNoNoEmpty = static_cast<uint16_t>(inIndexes[IX_MIN_NO_NO_EMPTY]);
- limitNoNo = static_cast<uint16_t>(inIndexes[IX_LIMIT_NO_NO]);
- minMaybeYes = static_cast<uint16_t>(inIndexes[IX_MIN_MAYBE_YES]);
- U_ASSERT((minMaybeYes & 7) == 0); // 8-aligned for noNoDelta bit fields
- centerNoNoDelta = (minMaybeYes >> DELTA_SHIFT) - MAX_DELTA - 1;
+ minDecompNoCP = static_cast<UChar>(inIndexes[IX_MIN_DECOMP_NO_CP]);
+ minCompNoMaybeCP = static_cast<UChar>(inIndexes[IX_MIN_COMP_NO_MAYBE_CP]);
+ minLcccCP = static_cast<UChar>(inIndexes[IX_MIN_LCCC_CP]);
+
+ minYesNo = static_cast<uint16_t>(inIndexes[IX_MIN_YES_NO]);
+ minYesNoMappingsOnly = static_cast<uint16_t>(inIndexes[IX_MIN_YES_NO_MAPPINGS_ONLY]);
+ minNoNo = static_cast<uint16_t>(inIndexes[IX_MIN_NO_NO]);
+ minNoNoCompBoundaryBefore = static_cast<uint16_t>(inIndexes[IX_MIN_NO_NO_COMP_BOUNDARY_BEFORE]);
+ minNoNoCompNoMaybeCC = static_cast<uint16_t>(inIndexes[IX_MIN_NO_NO_COMP_NO_MAYBE_CC]);
+ minNoNoEmpty = static_cast<uint16_t>(inIndexes[IX_MIN_NO_NO_EMPTY]);
+ limitNoNo = static_cast<uint16_t>(inIndexes[IX_LIMIT_NO_NO]);
+ minMaybeYes = static_cast<uint16_t>(inIndexes[IX_MIN_MAYBE_YES]);
+ U_ASSERT((minMaybeYes & 7) == 0); // 8-aligned for noNoDelta bit fields
+ centerNoNoDelta = (minMaybeYes >> DELTA_SHIFT) - MAX_DELTA - 1;
normTrie=inTrie;
maybeYesCompositions=inExtraData;
- extraData=maybeYesCompositions+((MIN_NORMAL_MAYBE_YES-minMaybeYes)>>OFFSET_SHIFT);
+ extraData=maybeYesCompositions+((MIN_NORMAL_MAYBE_YES-minMaybeYes)>>OFFSET_SHIFT);
smallFCD=inSmallFCD;
}
@@ -463,44 +463,44 @@ U_CDECL_END
void
Normalizer2Impl::addLcccChars(UnicodeSet &set) const {
- UChar32 start = 0, end;
- uint32_t norm16;
- while ((end = ucptrie_getRange(normTrie, start, UCPMAP_RANGE_FIXED_LEAD_SURROGATES, INERT,
- nullptr, nullptr, &norm16)) >= 0) {
- if (norm16 > Normalizer2Impl::MIN_NORMAL_MAYBE_YES &&
- norm16 != Normalizer2Impl::JAMO_VT) {
- set.add(start, end);
- } else if (minNoNoCompNoMaybeCC <= norm16 && norm16 < limitNoNo) {
- uint16_t fcd16 = getFCD16(start);
- if (fcd16 > 0xff) { set.add(start, end); }
- }
- start = end + 1;
- }
+ UChar32 start = 0, end;
+ uint32_t norm16;
+ while ((end = ucptrie_getRange(normTrie, start, UCPMAP_RANGE_FIXED_LEAD_SURROGATES, INERT,
+ nullptr, nullptr, &norm16)) >= 0) {
+ if (norm16 > Normalizer2Impl::MIN_NORMAL_MAYBE_YES &&
+ norm16 != Normalizer2Impl::JAMO_VT) {
+ set.add(start, end);
+ } else if (minNoNoCompNoMaybeCC <= norm16 && norm16 < limitNoNo) {
+ uint16_t fcd16 = getFCD16(start);
+ if (fcd16 > 0xff) { set.add(start, end); }
+ }
+ start = end + 1;
+ }
}
void
Normalizer2Impl::addPropertyStarts(const USetAdder *sa, UErrorCode & /*errorCode*/) const {
- // Add the start code point of each same-value range of the trie.
- UChar32 start = 0, end;
- uint32_t value;
- while ((end = ucptrie_getRange(normTrie, start, UCPMAP_RANGE_FIXED_LEAD_SURROGATES, INERT,
- nullptr, nullptr, &value)) >= 0) {
- sa->add(sa->set, start);
- if (start != end && isAlgorithmicNoNo((uint16_t)value) &&
- (value & Normalizer2Impl::DELTA_TCCC_MASK) > Normalizer2Impl::DELTA_TCCC_1) {
- // Range of code points with same-norm16-value algorithmic decompositions.
- // They might have different non-zero FCD16 values.
- uint16_t prevFCD16 = getFCD16(start);
- while (++start <= end) {
- uint16_t fcd16 = getFCD16(start);
- if (fcd16 != prevFCD16) {
- sa->add(sa->set, start);
- prevFCD16 = fcd16;
- }
- }
- }
- start = end + 1;
- }
+ // Add the start code point of each same-value range of the trie.
+ UChar32 start = 0, end;
+ uint32_t value;
+ while ((end = ucptrie_getRange(normTrie, start, UCPMAP_RANGE_FIXED_LEAD_SURROGATES, INERT,
+ nullptr, nullptr, &value)) >= 0) {
+ sa->add(sa->set, start);
+ if (start != end && isAlgorithmicNoNo((uint16_t)value) &&
+ (value & Normalizer2Impl::DELTA_TCCC_MASK) > Normalizer2Impl::DELTA_TCCC_1) {
+ // Range of code points with same-norm16-value algorithmic decompositions.
+ // They might have different non-zero FCD16 values.
+ uint16_t prevFCD16 = getFCD16(start);
+ while (++start <= end) {
+ uint16_t fcd16 = getFCD16(start);
+ if (fcd16 != prevFCD16) {
+ sa->add(sa->set, start);
+ prevFCD16 = fcd16;
+ }
+ }
+ }
+ start = end + 1;
+ }
/* add Hangul LV syllables and LV+1 because of skippables */
for(UChar c=Hangul::HANGUL_BASE; c<Hangul::HANGUL_LIMIT; c+=Hangul::JAMO_T_COUNT) {
@@ -512,15 +512,15 @@ Normalizer2Impl::addPropertyStarts(const USetAdder *sa, UErrorCode & /*errorCode
void
Normalizer2Impl::addCanonIterPropertyStarts(const USetAdder *sa, UErrorCode &errorCode) const {
- // Add the start code point of each same-value range of the canonical iterator data trie.
- if (!ensureCanonIterData(errorCode)) { return; }
- // Currently only used for the SEGMENT_STARTER property.
- UChar32 start = 0, end;
- uint32_t value;
- while ((end = ucptrie_getRange(fCanonIterData->trie, start, UCPMAP_RANGE_NORMAL, 0,
- segmentStarterMapper, nullptr, &value)) >= 0) {
- sa->add(sa->set, start);
- start = end + 1;
+ // Add the start code point of each same-value range of the canonical iterator data trie.
+ if (!ensureCanonIterData(errorCode)) { return; }
+ // Currently only used for the SEGMENT_STARTER property.
+ UChar32 start = 0, end;
+ uint32_t value;
+ while ((end = ucptrie_getRange(fCanonIterData->trie, start, UCPMAP_RANGE_NORMAL, 0,
+ segmentStarterMapper, nullptr, &value)) >= 0) {
+ sa->add(sa->set, start);
+ start = end + 1;
}
}
@@ -607,23 +607,23 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *limit,
// count code units below the minimum or with irrelevant data for the quick check
for(prevSrc=src; src!=limit;) {
if( (c=*src)<minNoCP ||
- isMostDecompYesAndZeroCC(norm16=UCPTRIE_FAST_BMP_GET(normTrie, UCPTRIE_16, c))
+ isMostDecompYesAndZeroCC(norm16=UCPTRIE_FAST_BMP_GET(normTrie, UCPTRIE_16, c))
) {
++src;
- } else if(!U16_IS_LEAD(c)) {
+ } else if(!U16_IS_LEAD(c)) {
break;
} else {
UChar c2;
- if((src+1)!=limit && U16_IS_TRAIL(c2=src[1])) {
- c=U16_GET_SUPPLEMENTARY(c, c2);
- norm16=UCPTRIE_FAST_SUPP_GET(normTrie, UCPTRIE_16, c);
- if(isMostDecompYesAndZeroCC(norm16)) {
- src+=2;
- } else {
- break;
+ if((src+1)!=limit && U16_IS_TRAIL(c2=src[1])) {
+ c=U16_GET_SUPPLEMENTARY(c, c2);
+ norm16=UCPTRIE_FAST_SUPP_GET(normTrie, UCPTRIE_16, c);
+ if(isMostDecompYesAndZeroCC(norm16)) {
+ src+=2;
+ } else {
+ break;
}
} else {
- ++src; // unpaired lead surrogate: inert
+ ++src; // unpaired lead surrogate: inert
}
}
}
@@ -669,174 +669,174 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *limit,
// fail the quick check loop and/or where the quick check loop's overhead
// is unlikely to be amortized.
// Called by the compose() and makeFCD() implementations.
-const UChar *
-Normalizer2Impl::decomposeShort(const UChar *src, const UChar *limit,
- UBool stopAtCompBoundary, UBool onlyContiguous,
- ReorderingBuffer &buffer, UErrorCode &errorCode) const {
- if (U_FAILURE(errorCode)) {
- return nullptr;
- }
+const UChar *
+Normalizer2Impl::decomposeShort(const UChar *src, const UChar *limit,
+ UBool stopAtCompBoundary, UBool onlyContiguous,
+ ReorderingBuffer &buffer, UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode)) {
+ return nullptr;
+ }
while(src<limit) {
- if (stopAtCompBoundary && *src < minCompNoMaybeCP) {
- return src;
- }
- const UChar *prevSrc = src;
+ if (stopAtCompBoundary && *src < minCompNoMaybeCP) {
+ return src;
+ }
+ const UChar *prevSrc = src;
UChar32 c;
uint16_t norm16;
- UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, src, limit, c, norm16);
- if (stopAtCompBoundary && norm16HasCompBoundaryBefore(norm16)) {
- return prevSrc;
- }
+ UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, src, limit, c, norm16);
+ if (stopAtCompBoundary && norm16HasCompBoundaryBefore(norm16)) {
+ return prevSrc;
+ }
if(!decompose(c, norm16, buffer, errorCode)) {
- return nullptr;
+ return nullptr;
+ }
+ if (stopAtCompBoundary && norm16HasCompBoundaryAfter(norm16, onlyContiguous)) {
+ return src;
}
- if (stopAtCompBoundary && norm16HasCompBoundaryAfter(norm16, onlyContiguous)) {
- return src;
- }
}
- return src;
+ return src;
}
UBool Normalizer2Impl::decompose(UChar32 c, uint16_t norm16,
ReorderingBuffer &buffer,
UErrorCode &errorCode) const {
- // get the decomposition and the lead and trail cc's
- if (norm16 >= limitNoNo) {
- if (isMaybeOrNonZeroCC(norm16)) {
+ // get the decomposition and the lead and trail cc's
+ if (norm16 >= limitNoNo) {
+ if (isMaybeOrNonZeroCC(norm16)) {
return buffer.append(c, getCCFromYesOrMaybe(norm16), errorCode);
- }
- // Maps to an isCompYesAndZeroCC.
- c=mapAlgorithmic(c, norm16);
- norm16=getRawNorm16(c);
- }
- if (norm16 < minYesNo) {
- // c does not decompose
- return buffer.append(c, 0, errorCode);
- } else if(isHangulLV(norm16) || isHangulLVT(norm16)) {
- // Hangul syllable: decompose algorithmically
- UChar jamos[3];
- return buffer.appendZeroCC(jamos, jamos+Hangul::decompose(c, jamos), errorCode);
- }
- // c decomposes, get everything from the variable-length extra data
- const uint16_t *mapping=getMapping(norm16);
- uint16_t firstUnit=*mapping;
- int32_t length=firstUnit&MAPPING_LENGTH_MASK;
- uint8_t leadCC, trailCC;
- trailCC=(uint8_t)(firstUnit>>8);
- if(firstUnit&MAPPING_HAS_CCC_LCCC_WORD) {
- leadCC=(uint8_t)(*(mapping-1)>>8);
- } else {
- leadCC=0;
- }
- return buffer.append((const UChar *)mapping+1, length, TRUE, leadCC, trailCC, errorCode);
-}
-
-const uint8_t *
-Normalizer2Impl::decomposeShort(const uint8_t *src, const uint8_t *limit,
- UBool stopAtCompBoundary, UBool onlyContiguous,
- ReorderingBuffer &buffer, UErrorCode &errorCode) const {
- if (U_FAILURE(errorCode)) {
- return nullptr;
- }
- while (src < limit) {
- const uint8_t *prevSrc = src;
- uint16_t norm16;
- UCPTRIE_FAST_U8_NEXT(normTrie, UCPTRIE_16, src, limit, norm16);
- // Get the decomposition and the lead and trail cc's.
- UChar32 c = U_SENTINEL;
- if (norm16 >= limitNoNo) {
- if (isMaybeOrNonZeroCC(norm16)) {
- // No boundaries around this character.
- c = codePointFromValidUTF8(prevSrc, src);
- if (!buffer.append(c, getCCFromYesOrMaybe(norm16), errorCode)) {
- return nullptr;
- }
- continue;
- }
- // Maps to an isCompYesAndZeroCC.
- if (stopAtCompBoundary) {
- return prevSrc;
- }
- c = codePointFromValidUTF8(prevSrc, src);
- c = mapAlgorithmic(c, norm16);
- norm16 = getRawNorm16(c);
- } else if (stopAtCompBoundary && norm16 < minNoNoCompNoMaybeCC) {
- return prevSrc;
- }
- // norm16!=INERT guarantees that [prevSrc, src[ is valid UTF-8.
- // We do not see invalid UTF-8 here because
- // its norm16==INERT is normalization-inert,
- // so it gets copied unchanged in the fast path,
- // and we stop the slow path where invalid UTF-8 begins.
- U_ASSERT(norm16 != INERT);
- if (norm16 < minYesNo) {
- if (c < 0) {
- c = codePointFromValidUTF8(prevSrc, src);
- }
- // does not decompose
- if (!buffer.append(c, 0, errorCode)) {
- return nullptr;
- }
- } else if (isHangulLV(norm16) || isHangulLVT(norm16)) {
+ }
+ // Maps to an isCompYesAndZeroCC.
+ c=mapAlgorithmic(c, norm16);
+ norm16=getRawNorm16(c);
+ }
+ if (norm16 < minYesNo) {
+ // c does not decompose
+ return buffer.append(c, 0, errorCode);
+ } else if(isHangulLV(norm16) || isHangulLVT(norm16)) {
+ // Hangul syllable: decompose algorithmically
+ UChar jamos[3];
+ return buffer.appendZeroCC(jamos, jamos+Hangul::decompose(c, jamos), errorCode);
+ }
+ // c decomposes, get everything from the variable-length extra data
+ const uint16_t *mapping=getMapping(norm16);
+ uint16_t firstUnit=*mapping;
+ int32_t length=firstUnit&MAPPING_LENGTH_MASK;
+ uint8_t leadCC, trailCC;
+ trailCC=(uint8_t)(firstUnit>>8);
+ if(firstUnit&MAPPING_HAS_CCC_LCCC_WORD) {
+ leadCC=(uint8_t)(*(mapping-1)>>8);
+ } else {
+ leadCC=0;
+ }
+ return buffer.append((const UChar *)mapping+1, length, TRUE, leadCC, trailCC, errorCode);
+}
+
+const uint8_t *
+Normalizer2Impl::decomposeShort(const uint8_t *src, const uint8_t *limit,
+ UBool stopAtCompBoundary, UBool onlyContiguous,
+ ReorderingBuffer &buffer, UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode)) {
+ return nullptr;
+ }
+ while (src < limit) {
+ const uint8_t *prevSrc = src;
+ uint16_t norm16;
+ UCPTRIE_FAST_U8_NEXT(normTrie, UCPTRIE_16, src, limit, norm16);
+ // Get the decomposition and the lead and trail cc's.
+ UChar32 c = U_SENTINEL;
+ if (norm16 >= limitNoNo) {
+ if (isMaybeOrNonZeroCC(norm16)) {
+ // No boundaries around this character.
+ c = codePointFromValidUTF8(prevSrc, src);
+ if (!buffer.append(c, getCCFromYesOrMaybe(norm16), errorCode)) {
+ return nullptr;
+ }
+ continue;
+ }
+ // Maps to an isCompYesAndZeroCC.
+ if (stopAtCompBoundary) {
+ return prevSrc;
+ }
+ c = codePointFromValidUTF8(prevSrc, src);
+ c = mapAlgorithmic(c, norm16);
+ norm16 = getRawNorm16(c);
+ } else if (stopAtCompBoundary && norm16 < minNoNoCompNoMaybeCC) {
+ return prevSrc;
+ }
+ // norm16!=INERT guarantees that [prevSrc, src[ is valid UTF-8.
+ // We do not see invalid UTF-8 here because
+ // its norm16==INERT is normalization-inert,
+ // so it gets copied unchanged in the fast path,
+ // and we stop the slow path where invalid UTF-8 begins.
+ U_ASSERT(norm16 != INERT);
+ if (norm16 < minYesNo) {
+ if (c < 0) {
+ c = codePointFromValidUTF8(prevSrc, src);
+ }
+ // does not decompose
+ if (!buffer.append(c, 0, errorCode)) {
+ return nullptr;
+ }
+ } else if (isHangulLV(norm16) || isHangulLVT(norm16)) {
// Hangul syllable: decompose algorithmically
- if (c < 0) {
- c = codePointFromValidUTF8(prevSrc, src);
- }
- char16_t jamos[3];
- if (!buffer.appendZeroCC(jamos, jamos+Hangul::decompose(c, jamos), errorCode)) {
- return nullptr;
- }
+ if (c < 0) {
+ c = codePointFromValidUTF8(prevSrc, src);
+ }
+ char16_t jamos[3];
+ if (!buffer.appendZeroCC(jamos, jamos+Hangul::decompose(c, jamos), errorCode)) {
+ return nullptr;
+ }
} else {
- // The character decomposes, get everything from the variable-length extra data.
- const uint16_t *mapping = getMapping(norm16);
- uint16_t firstUnit = *mapping;
- int32_t length = firstUnit & MAPPING_LENGTH_MASK;
- uint8_t trailCC = (uint8_t)(firstUnit >> 8);
- uint8_t leadCC;
- if (firstUnit & MAPPING_HAS_CCC_LCCC_WORD) {
- leadCC = (uint8_t)(*(mapping-1) >> 8);
+ // The character decomposes, get everything from the variable-length extra data.
+ const uint16_t *mapping = getMapping(norm16);
+ uint16_t firstUnit = *mapping;
+ int32_t length = firstUnit & MAPPING_LENGTH_MASK;
+ uint8_t trailCC = (uint8_t)(firstUnit >> 8);
+ uint8_t leadCC;
+ if (firstUnit & MAPPING_HAS_CCC_LCCC_WORD) {
+ leadCC = (uint8_t)(*(mapping-1) >> 8);
} else {
- leadCC = 0;
+ leadCC = 0;
}
- if (!buffer.append((const char16_t *)mapping+1, length, TRUE, leadCC, trailCC, errorCode)) {
- return nullptr;
- }
+ if (!buffer.append((const char16_t *)mapping+1, length, TRUE, leadCC, trailCC, errorCode)) {
+ return nullptr;
+ }
+ }
+ if (stopAtCompBoundary && norm16HasCompBoundaryAfter(norm16, onlyContiguous)) {
+ return src;
}
- if (stopAtCompBoundary && norm16HasCompBoundaryAfter(norm16, onlyContiguous)) {
- return src;
- }
}
- return src;
+ return src;
}
const UChar *
Normalizer2Impl::getDecomposition(UChar32 c, UChar buffer[4], int32_t &length) const {
uint16_t norm16;
- if(c<minDecompNoCP || isMaybeOrNonZeroCC(norm16=getNorm16(c))) {
- // c does not decompose
- return nullptr;
- }
- const UChar *decomp = nullptr;
- if(isDecompNoAlgorithmic(norm16)) {
- // Maps to an isCompYesAndZeroCC.
- c=mapAlgorithmic(c, norm16);
- decomp=buffer;
- length=0;
- U16_APPEND_UNSAFE(buffer, length, c);
- // The mapping might decompose further.
- norm16 = getRawNorm16(c);
- }
- if (norm16 < minYesNo) {
- return decomp;
- } else if(isHangulLV(norm16) || isHangulLVT(norm16)) {
- // Hangul syllable: decompose algorithmically
- length=Hangul::decompose(c, buffer);
- return buffer;
- }
- // c decomposes, get everything from the variable-length extra data
- const uint16_t *mapping=getMapping(norm16);
- length=*mapping&MAPPING_LENGTH_MASK;
- return (const UChar *)mapping+1;
+ if(c<minDecompNoCP || isMaybeOrNonZeroCC(norm16=getNorm16(c))) {
+ // c does not decompose
+ return nullptr;
+ }
+ const UChar *decomp = nullptr;
+ if(isDecompNoAlgorithmic(norm16)) {
+ // Maps to an isCompYesAndZeroCC.
+ c=mapAlgorithmic(c, norm16);
+ decomp=buffer;
+ length=0;
+ U16_APPEND_UNSAFE(buffer, length, c);
+ // The mapping might decompose further.
+ norm16 = getRawNorm16(c);
+ }
+ if (norm16 < minYesNo) {
+ return decomp;
+ } else if(isHangulLV(norm16) || isHangulLVT(norm16)) {
+ // Hangul syllable: decompose algorithmically
+ length=Hangul::decompose(c, buffer);
+ return buffer;
+ }
+ // c decomposes, get everything from the variable-length extra data
+ const uint16_t *mapping=getMapping(norm16);
+ length=*mapping&MAPPING_LENGTH_MASK;
+ return (const UChar *)mapping+1;
}
// The capacity of the buffer must be 30=MAPPING_LENGTH_MASK-1
@@ -849,7 +849,7 @@ Normalizer2Impl::getRawDecomposition(UChar32 c, UChar buffer[30], int32_t &lengt
if(c<minDecompNoCP || isDecompYes(norm16=getNorm16(c))) {
// c does not decompose
return NULL;
- } else if(isHangulLV(norm16) || isHangulLVT(norm16)) {
+ } else if(isHangulLV(norm16) || isHangulLVT(norm16)) {
// Hangul syllable: decompose algorithmically
Hangul::getRawDecomposition(c, buffer);
length=2;
@@ -859,29 +859,29 @@ Normalizer2Impl::getRawDecomposition(UChar32 c, UChar buffer[30], int32_t &lengt
length=0;
U16_APPEND_UNSAFE(buffer, length, c);
return buffer;
- }
- // c decomposes, get everything from the variable-length extra data
- const uint16_t *mapping=getMapping(norm16);
- uint16_t firstUnit=*mapping;
- int32_t mLength=firstUnit&MAPPING_LENGTH_MASK; // length of normal mapping
- if(firstUnit&MAPPING_HAS_RAW_MAPPING) {
- // Read the raw mapping from before the firstUnit and before the optional ccc/lccc word.
- // Bit 7=MAPPING_HAS_CCC_LCCC_WORD
- const uint16_t *rawMapping=mapping-((firstUnit>>7)&1)-1;
- uint16_t rm0=*rawMapping;
- if(rm0<=MAPPING_LENGTH_MASK) {
- length=rm0;
- return (const UChar *)rawMapping-rm0;
+ }
+ // c decomposes, get everything from the variable-length extra data
+ const uint16_t *mapping=getMapping(norm16);
+ uint16_t firstUnit=*mapping;
+ int32_t mLength=firstUnit&MAPPING_LENGTH_MASK; // length of normal mapping
+ if(firstUnit&MAPPING_HAS_RAW_MAPPING) {
+ // Read the raw mapping from before the firstUnit and before the optional ccc/lccc word.
+ // Bit 7=MAPPING_HAS_CCC_LCCC_WORD
+ const uint16_t *rawMapping=mapping-((firstUnit>>7)&1)-1;
+ uint16_t rm0=*rawMapping;
+ if(rm0<=MAPPING_LENGTH_MASK) {
+ length=rm0;
+ return (const UChar *)rawMapping-rm0;
} else {
- // Copy the normal mapping and replace its first two code units with rm0.
- buffer[0]=(UChar)rm0;
- u_memcpy(buffer+1, (const UChar *)mapping+1+2, mLength-2);
- length=mLength-1;
- return buffer;
+ // Copy the normal mapping and replace its first two code units with rm0.
+ buffer[0]=(UChar)rm0;
+ u_memcpy(buffer+1, (const UChar *)mapping+1+2, mLength-2);
+ length=mLength-1;
+ return buffer;
}
- } else {
- length=mLength;
- return (const UChar *)mapping+1;
+ } else {
+ length=mLength;
+ return (const UChar *)mapping+1;
}
}
@@ -896,87 +896,87 @@ void Normalizer2Impl::decomposeAndAppend(const UChar *src, const UChar *limit,
return;
}
// Just merge the strings at the boundary.
- bool isFirst = true;
- uint8_t firstCC = 0, prevCC = 0, cc;
- const UChar *p = src;
- while (p != limit) {
- const UChar *codePointStart = p;
- UChar32 c;
- uint16_t norm16;
- UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, p, limit, c, norm16);
- if ((cc = getCC(norm16)) == 0) {
- p = codePointStart;
- break;
- }
- if (isFirst) {
- firstCC = cc;
- isFirst = false;
- }
- prevCC = cc;
- }
+ bool isFirst = true;
+ uint8_t firstCC = 0, prevCC = 0, cc;
+ const UChar *p = src;
+ while (p != limit) {
+ const UChar *codePointStart = p;
+ UChar32 c;
+ uint16_t norm16;
+ UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, p, limit, c, norm16);
+ if ((cc = getCC(norm16)) == 0) {
+ p = codePointStart;
+ break;
+ }
+ if (isFirst) {
+ firstCC = cc;
+ isFirst = false;
+ }
+ prevCC = cc;
+ }
if(limit==NULL) { // appendZeroCC() needs limit!=NULL
- limit=u_strchr(p, 0);
- }
-
- if (buffer.append(src, (int32_t)(p - src), FALSE, firstCC, prevCC, errorCode)) {
- buffer.appendZeroCC(p, limit, errorCode);
- }
-}
-
-UBool Normalizer2Impl::hasDecompBoundaryBefore(UChar32 c) const {
- return c < minLcccCP || (c <= 0xffff && !singleLeadMightHaveNonZeroFCD16(c)) ||
- norm16HasDecompBoundaryBefore(getNorm16(c));
-}
-
-UBool Normalizer2Impl::norm16HasDecompBoundaryBefore(uint16_t norm16) const {
- if (norm16 < minNoNoCompNoMaybeCC) {
- return TRUE;
- }
- if (norm16 >= limitNoNo) {
- return norm16 <= MIN_NORMAL_MAYBE_YES || norm16 == JAMO_VT;
- }
- // c decomposes, get everything from the variable-length extra data
- const uint16_t *mapping=getMapping(norm16);
- uint16_t firstUnit=*mapping;
- // TRUE if leadCC==0 (hasFCDBoundaryBefore())
- return (firstUnit&MAPPING_HAS_CCC_LCCC_WORD)==0 || (*(mapping-1)&0xff00)==0;
-}
-
-UBool Normalizer2Impl::hasDecompBoundaryAfter(UChar32 c) const {
- if (c < minDecompNoCP) {
- return TRUE;
- }
- if (c <= 0xffff && !singleLeadMightHaveNonZeroFCD16(c)) {
- return TRUE;
- }
- return norm16HasDecompBoundaryAfter(getNorm16(c));
-}
-
-UBool Normalizer2Impl::norm16HasDecompBoundaryAfter(uint16_t norm16) const {
- if(norm16 <= minYesNo || isHangulLVT(norm16)) {
- return TRUE;
- }
- if (norm16 >= limitNoNo) {
- if (isMaybeOrNonZeroCC(norm16)) {
- return norm16 <= MIN_NORMAL_MAYBE_YES || norm16 == JAMO_VT;
- }
- // Maps to an isCompYesAndZeroCC.
- return (norm16 & DELTA_TCCC_MASK) <= DELTA_TCCC_1;
- }
- // c decomposes, get everything from the variable-length extra data
- const uint16_t *mapping=getMapping(norm16);
- uint16_t firstUnit=*mapping;
- // decomp after-boundary: same as hasFCDBoundaryAfter(),
- // fcd16<=1 || trailCC==0
- if(firstUnit>0x1ff) {
- return FALSE; // trailCC>1
- }
- if(firstUnit<=0xff) {
- return TRUE; // trailCC==0
- }
- // if(trailCC==1) test leadCC==0, same as checking for before-boundary
- // TRUE if leadCC==0 (hasFCDBoundaryBefore())
- return (firstUnit&MAPPING_HAS_CCC_LCCC_WORD)==0 || (*(mapping-1)&0xff00)==0;
+ limit=u_strchr(p, 0);
+ }
+
+ if (buffer.append(src, (int32_t)(p - src), FALSE, firstCC, prevCC, errorCode)) {
+ buffer.appendZeroCC(p, limit, errorCode);
+ }
+}
+
+UBool Normalizer2Impl::hasDecompBoundaryBefore(UChar32 c) const {
+ return c < minLcccCP || (c <= 0xffff && !singleLeadMightHaveNonZeroFCD16(c)) ||
+ norm16HasDecompBoundaryBefore(getNorm16(c));
+}
+
+UBool Normalizer2Impl::norm16HasDecompBoundaryBefore(uint16_t norm16) const {
+ if (norm16 < minNoNoCompNoMaybeCC) {
+ return TRUE;
+ }
+ if (norm16 >= limitNoNo) {
+ return norm16 <= MIN_NORMAL_MAYBE_YES || norm16 == JAMO_VT;
+ }
+ // c decomposes, get everything from the variable-length extra data
+ const uint16_t *mapping=getMapping(norm16);
+ uint16_t firstUnit=*mapping;
+ // TRUE if leadCC==0 (hasFCDBoundaryBefore())
+ return (firstUnit&MAPPING_HAS_CCC_LCCC_WORD)==0 || (*(mapping-1)&0xff00)==0;
+}
+
+UBool Normalizer2Impl::hasDecompBoundaryAfter(UChar32 c) const {
+ if (c < minDecompNoCP) {
+ return TRUE;
+ }
+ if (c <= 0xffff && !singleLeadMightHaveNonZeroFCD16(c)) {
+ return TRUE;
+ }
+ return norm16HasDecompBoundaryAfter(getNorm16(c));
+}
+
+UBool Normalizer2Impl::norm16HasDecompBoundaryAfter(uint16_t norm16) const {
+ if(norm16 <= minYesNo || isHangulLVT(norm16)) {
+ return TRUE;
+ }
+ if (norm16 >= limitNoNo) {
+ if (isMaybeOrNonZeroCC(norm16)) {
+ return norm16 <= MIN_NORMAL_MAYBE_YES || norm16 == JAMO_VT;
+ }
+ // Maps to an isCompYesAndZeroCC.
+ return (norm16 & DELTA_TCCC_MASK) <= DELTA_TCCC_1;
+ }
+ // c decomposes, get everything from the variable-length extra data
+ const uint16_t *mapping=getMapping(norm16);
+ uint16_t firstUnit=*mapping;
+ // decomp after-boundary: same as hasFCDBoundaryAfter(),
+ // fcd16<=1 || trailCC==0
+ if(firstUnit>0x1ff) {
+ return FALSE; // trailCC>1
+ }
+ if(firstUnit<=0xff) {
+ return TRUE; // trailCC==0
+ }
+ // if(trailCC==1) test leadCC==0, same as checking for before-boundary
+ // TRUE if leadCC==0 (hasFCDBoundaryBefore())
+ return (firstUnit&MAPPING_HAS_CCC_LCCC_WORD)==0 || (*(mapping-1)&0xff00)==0;
}
/*
@@ -1066,7 +1066,7 @@ void Normalizer2Impl::addComposites(const uint16_t *list, UnicodeSet &set) const
}
UChar32 composite=compositeAndFwd>>1;
if((compositeAndFwd&1)!=0) {
- addComposites(getCompositionsListForComposite(getRawNorm16(composite)), set);
+ addComposites(getCompositionsListForComposite(getRawNorm16(composite)), set);
}
set.add(composite);
} while((firstUnit&COMP_1_LAST_TUPLE)==0);
@@ -1105,7 +1105,7 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart
prevCC=0;
for(;;) {
- UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, p, limit, c, norm16);
+ UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, p, limit, c, norm16);
cc=getCCFromYesOrMaybe(norm16);
if( // this character combines backward and
isMaybe(norm16) &&
@@ -1210,7 +1210,7 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart
// Is the composite a starter that combines forward?
if(compositeAndFwd&1) {
compositionsList=
- getCompositionsListForComposite(getRawNorm16(composite));
+ getCompositionsListForComposite(getRawNorm16(composite));
} else {
compositionsList=NULL;
}
@@ -1249,12 +1249,12 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart
UChar32
Normalizer2Impl::composePair(UChar32 a, UChar32 b) const {
- uint16_t norm16=getNorm16(a); // maps an out-of-range 'a' to inert norm16
+ uint16_t norm16=getNorm16(a); // maps an out-of-range 'a' to inert norm16
const uint16_t *list;
if(isInert(norm16)) {
return U_SENTINEL;
} else if(norm16<minYesNoMappingsOnly) {
- // a combines forward.
+ // a combines forward.
if(isJamoL(norm16)) {
b-=Hangul::JAMO_V_BASE;
if(0<=b && b<Hangul::JAMO_V_COUNT) {
@@ -1265,26 +1265,26 @@ Normalizer2Impl::composePair(UChar32 a, UChar32 b) const {
} else {
return U_SENTINEL;
}
- } else if(isHangulLV(norm16)) {
+ } else if(isHangulLV(norm16)) {
b-=Hangul::JAMO_T_BASE;
- if(0<b && b<Hangul::JAMO_T_COUNT) { // not b==0!
+ if(0<b && b<Hangul::JAMO_T_COUNT) { // not b==0!
return a+b;
} else {
return U_SENTINEL;
}
} else {
// 'a' has a compositions list in extraData
- list=getMapping(norm16);
+ list=getMapping(norm16);
if(norm16>minYesNo) { // composite 'a' has both mapping & compositions list
list+= // mapping pointer
- 1+ // +1 to skip the first unit with the mapping length
+ 1+ // +1 to skip the first unit with the mapping length
(*list&MAPPING_LENGTH_MASK); // + mapping length
}
}
} else if(norm16<minMaybeYes || MIN_NORMAL_MAYBE_YES<=norm16) {
return U_SENTINEL;
} else {
- list=getCompositionsListForMaybe(norm16);
+ list=getCompositionsListForMaybe(norm16);
}
if(b<0 || 0x10ffff<b) { // combine(list, b) requires a valid code point b
return U_SENTINEL;
@@ -1315,250 +1315,250 @@ Normalizer2Impl::compose(const UChar *src, const UChar *limit,
if(U_FAILURE(errorCode)) {
return FALSE;
}
- limit=u_strchr(src, 0);
- if (prevBoundary != src) {
- if (hasCompBoundaryAfter(*(src-1), onlyContiguous)) {
- prevBoundary = src;
- } else {
- buffer.removeSuffix(1);
- prevBoundary = --src;
- }
- }
- }
-
- for (;;) {
- // Fast path: Scan over a sequence of characters below the minimum "no or maybe" code point,
- // or with (compYes && ccc==0) properties.
- const UChar *prevSrc;
- UChar32 c = 0;
- uint16_t norm16 = 0;
- for (;;) {
- if (src == limit) {
- if (prevBoundary != limit && doCompose) {
- buffer.appendZeroCC(prevBoundary, limit, errorCode);
- }
- return TRUE;
- }
+ limit=u_strchr(src, 0);
+ if (prevBoundary != src) {
+ if (hasCompBoundaryAfter(*(src-1), onlyContiguous)) {
+ prevBoundary = src;
+ } else {
+ buffer.removeSuffix(1);
+ prevBoundary = --src;
+ }
+ }
+ }
+
+ for (;;) {
+ // Fast path: Scan over a sequence of characters below the minimum "no or maybe" code point,
+ // or with (compYes && ccc==0) properties.
+ const UChar *prevSrc;
+ UChar32 c = 0;
+ uint16_t norm16 = 0;
+ for (;;) {
+ if (src == limit) {
+ if (prevBoundary != limit && doCompose) {
+ buffer.appendZeroCC(prevBoundary, limit, errorCode);
+ }
+ return TRUE;
+ }
if( (c=*src)<minNoMaybeCP ||
- isCompYesAndZeroCC(norm16=UCPTRIE_FAST_BMP_GET(normTrie, UCPTRIE_16, c))
+ isCompYesAndZeroCC(norm16=UCPTRIE_FAST_BMP_GET(normTrie, UCPTRIE_16, c))
) {
++src;
} else {
- prevSrc = src++;
- if(!U16_IS_LEAD(c)) {
- break;
- } else {
- UChar c2;
- if(src!=limit && U16_IS_TRAIL(c2=*src)) {
- ++src;
+ prevSrc = src++;
+ if(!U16_IS_LEAD(c)) {
+ break;
+ } else {
+ UChar c2;
+ if(src!=limit && U16_IS_TRAIL(c2=*src)) {
+ ++src;
c=U16_GET_SUPPLEMENTARY(c, c2);
- norm16=UCPTRIE_FAST_SUPP_GET(normTrie, UCPTRIE_16, c);
- if(!isCompYesAndZeroCC(norm16)) {
- break;
- }
+ norm16=UCPTRIE_FAST_SUPP_GET(normTrie, UCPTRIE_16, c);
+ if(!isCompYesAndZeroCC(norm16)) {
+ break;
+ }
}
}
}
}
- // isCompYesAndZeroCC(norm16) is false, that is, norm16>=minNoNo.
- // The current character is either a "noNo" (has a mapping)
- // or a "maybeYes" (combines backward)
- // or a "yesYes" with ccc!=0.
- // It is not a Hangul syllable or Jamo L because those have "yes" properties.
-
- // Medium-fast path: Handle cases that do not require full decomposition and recomposition.
- if (!isMaybeOrNonZeroCC(norm16)) { // minNoNo <= norm16 < minMaybeYes
- if (!doCompose) {
- return FALSE;
- }
- // Fast path for mapping a character that is immediately surrounded by boundaries.
- // In this case, we need not decompose around the current character.
- if (isDecompNoAlgorithmic(norm16)) {
- // Maps to a single isCompYesAndZeroCC character
- // which also implies hasCompBoundaryBefore.
- if (norm16HasCompBoundaryAfter(norm16, onlyContiguous) ||
- hasCompBoundaryBefore(src, limit)) {
- if (prevBoundary != prevSrc && !buffer.appendZeroCC(prevBoundary, prevSrc, errorCode)) {
- break;
- }
- if(!buffer.append(mapAlgorithmic(c, norm16), 0, errorCode)) {
- break;
- }
- prevBoundary = src;
- continue;
+ // isCompYesAndZeroCC(norm16) is false, that is, norm16>=minNoNo.
+ // The current character is either a "noNo" (has a mapping)
+ // or a "maybeYes" (combines backward)
+ // or a "yesYes" with ccc!=0.
+ // It is not a Hangul syllable or Jamo L because those have "yes" properties.
+
+ // Medium-fast path: Handle cases that do not require full decomposition and recomposition.
+ if (!isMaybeOrNonZeroCC(norm16)) { // minNoNo <= norm16 < minMaybeYes
+ if (!doCompose) {
+ return FALSE;
+ }
+ // Fast path for mapping a character that is immediately surrounded by boundaries.
+ // In this case, we need not decompose around the current character.
+ if (isDecompNoAlgorithmic(norm16)) {
+ // Maps to a single isCompYesAndZeroCC character
+ // which also implies hasCompBoundaryBefore.
+ if (norm16HasCompBoundaryAfter(norm16, onlyContiguous) ||
+ hasCompBoundaryBefore(src, limit)) {
+ if (prevBoundary != prevSrc && !buffer.appendZeroCC(prevBoundary, prevSrc, errorCode)) {
+ break;
+ }
+ if(!buffer.append(mapAlgorithmic(c, norm16), 0, errorCode)) {
+ break;
+ }
+ prevBoundary = src;
+ continue;
+ }
+ } else if (norm16 < minNoNoCompBoundaryBefore) {
+ // The mapping is comp-normalized which also implies hasCompBoundaryBefore.
+ if (norm16HasCompBoundaryAfter(norm16, onlyContiguous) ||
+ hasCompBoundaryBefore(src, limit)) {
+ if (prevBoundary != prevSrc && !buffer.appendZeroCC(prevBoundary, prevSrc, errorCode)) {
+ break;
+ }
+ const UChar *mapping = reinterpret_cast<const UChar *>(getMapping(norm16));
+ int32_t length = *mapping++ & MAPPING_LENGTH_MASK;
+ if(!buffer.appendZeroCC(mapping, mapping + length, errorCode)) {
+ break;
+ }
+ prevBoundary = src;
+ continue;
}
- } else if (norm16 < minNoNoCompBoundaryBefore) {
- // The mapping is comp-normalized which also implies hasCompBoundaryBefore.
- if (norm16HasCompBoundaryAfter(norm16, onlyContiguous) ||
- hasCompBoundaryBefore(src, limit)) {
- if (prevBoundary != prevSrc && !buffer.appendZeroCC(prevBoundary, prevSrc, errorCode)) {
- break;
- }
- const UChar *mapping = reinterpret_cast<const UChar *>(getMapping(norm16));
- int32_t length = *mapping++ & MAPPING_LENGTH_MASK;
- if(!buffer.appendZeroCC(mapping, mapping + length, errorCode)) {
- break;
- }
- prevBoundary = src;
- continue;
- }
- } else if (norm16 >= minNoNoEmpty) {
- // The current character maps to nothing.
- // Simply omit it from the output if there is a boundary before _or_ after it.
- // The character itself implies no boundaries.
- if (hasCompBoundaryBefore(src, limit) ||
- hasCompBoundaryAfter(prevBoundary, prevSrc, onlyContiguous)) {
- if (prevBoundary != prevSrc && !buffer.appendZeroCC(prevBoundary, prevSrc, errorCode)) {
- break;
- }
- prevBoundary = src;
- continue;
- }
- }
- // Other "noNo" type, or need to examine more text around this character:
- // Fall through to the slow path.
- } else if (isJamoVT(norm16) && prevBoundary != prevSrc) {
+ } else if (norm16 >= minNoNoEmpty) {
+ // The current character maps to nothing.
+ // Simply omit it from the output if there is a boundary before _or_ after it.
+ // The character itself implies no boundaries.
+ if (hasCompBoundaryBefore(src, limit) ||
+ hasCompBoundaryAfter(prevBoundary, prevSrc, onlyContiguous)) {
+ if (prevBoundary != prevSrc && !buffer.appendZeroCC(prevBoundary, prevSrc, errorCode)) {
+ break;
+ }
+ prevBoundary = src;
+ continue;
+ }
+ }
+ // Other "noNo" type, or need to examine more text around this character:
+ // Fall through to the slow path.
+ } else if (isJamoVT(norm16) && prevBoundary != prevSrc) {
UChar prev=*(prevSrc-1);
if(c<Hangul::JAMO_T_BASE) {
- // The current character is a Jamo Vowel,
- // compose with previous Jamo L and following Jamo T.
- UChar l = (UChar)(prev-Hangul::JAMO_L_BASE);
- if(l<Hangul::JAMO_L_COUNT) {
- if (!doCompose) {
+ // The current character is a Jamo Vowel,
+ // compose with previous Jamo L and following Jamo T.
+ UChar l = (UChar)(prev-Hangul::JAMO_L_BASE);
+ if(l<Hangul::JAMO_L_COUNT) {
+ if (!doCompose) {
return FALSE;
}
- int32_t t;
- if (src != limit &&
- 0 < (t = ((int32_t)*src - Hangul::JAMO_T_BASE)) &&
- t < Hangul::JAMO_T_COUNT) {
- // The next character is a Jamo T.
+ int32_t t;
+ if (src != limit &&
+ 0 < (t = ((int32_t)*src - Hangul::JAMO_T_BASE)) &&
+ t < Hangul::JAMO_T_COUNT) {
+ // The next character is a Jamo T.
++src;
- } else if (hasCompBoundaryBefore(src, limit)) {
- // No Jamo T follows, not even via decomposition.
- t = 0;
- } else {
- t = -1;
- }
- if (t >= 0) {
- UChar32 syllable = Hangul::HANGUL_BASE +
- (l*Hangul::JAMO_V_COUNT + (c-Hangul::JAMO_V_BASE)) *
- Hangul::JAMO_T_COUNT + t;
- --prevSrc; // Replace the Jamo L as well.
- if (prevBoundary != prevSrc && !buffer.appendZeroCC(prevBoundary, prevSrc, errorCode)) {
- break;
- }
- if(!buffer.appendBMP((UChar)syllable, 0, errorCode)) {
- break;
- }
- prevBoundary = src;
+ } else if (hasCompBoundaryBefore(src, limit)) {
+ // No Jamo T follows, not even via decomposition.
+ t = 0;
+ } else {
+ t = -1;
+ }
+ if (t >= 0) {
+ UChar32 syllable = Hangul::HANGUL_BASE +
+ (l*Hangul::JAMO_V_COUNT + (c-Hangul::JAMO_V_BASE)) *
+ Hangul::JAMO_T_COUNT + t;
+ --prevSrc; // Replace the Jamo L as well.
+ if (prevBoundary != prevSrc && !buffer.appendZeroCC(prevBoundary, prevSrc, errorCode)) {
+ break;
+ }
+ if(!buffer.appendBMP((UChar)syllable, 0, errorCode)) {
+ break;
+ }
+ prevBoundary = src;
continue;
}
// If we see L+V+x where x!=T then we drop to the slow path,
// decompose and recompose.
// This is to deal with NFKC finding normal L and V but a
- // compatibility variant of a T.
- // We need to either fully compose that combination here
- // (which would complicate the code and may not work with strange custom data)
- // or use the slow path.
+ // compatibility variant of a T.
+ // We need to either fully compose that combination here
+ // (which would complicate the code and may not work with strange custom data)
+ // or use the slow path.
}
- } else if (Hangul::isHangulLV(prev)) {
- // The current character is a Jamo Trailing consonant,
+ } else if (Hangul::isHangulLV(prev)) {
+ // The current character is a Jamo Trailing consonant,
// compose with previous Hangul LV that does not contain a Jamo T.
- if (!doCompose) {
+ if (!doCompose) {
return FALSE;
}
- UChar32 syllable = prev + c - Hangul::JAMO_T_BASE;
- --prevSrc; // Replace the Hangul LV as well.
- if (prevBoundary != prevSrc && !buffer.appendZeroCC(prevBoundary, prevSrc, errorCode)) {
- break;
+ UChar32 syllable = prev + c - Hangul::JAMO_T_BASE;
+ --prevSrc; // Replace the Hangul LV as well.
+ if (prevBoundary != prevSrc && !buffer.appendZeroCC(prevBoundary, prevSrc, errorCode)) {
+ break;
+ }
+ if(!buffer.appendBMP((UChar)syllable, 0, errorCode)) {
+ break;
}
- if(!buffer.appendBMP((UChar)syllable, 0, errorCode)) {
- break;
- }
- prevBoundary = src;
+ prevBoundary = src;
continue;
}
- // No matching context, or may need to decompose surrounding text first:
- // Fall through to the slow path.
- } else if (norm16 > JAMO_VT) { // norm16 >= MIN_YES_YES_WITH_CC
- // One or more combining marks that do not combine-back:
- // Check for canonical order, copy unchanged if ok and
- // if followed by a character with a boundary-before.
- uint8_t cc = getCCFromNormalYesOrMaybe(norm16); // cc!=0
- if (onlyContiguous /* FCC */ && getPreviousTrailCC(prevBoundary, prevSrc) > cc) {
+ // No matching context, or may need to decompose surrounding text first:
+ // Fall through to the slow path.
+ } else if (norm16 > JAMO_VT) { // norm16 >= MIN_YES_YES_WITH_CC
+ // One or more combining marks that do not combine-back:
+ // Check for canonical order, copy unchanged if ok and
+ // if followed by a character with a boundary-before.
+ uint8_t cc = getCCFromNormalYesOrMaybe(norm16); // cc!=0
+ if (onlyContiguous /* FCC */ && getPreviousTrailCC(prevBoundary, prevSrc) > cc) {
// Fails FCD test, need to decompose and contiguously recompose.
- if (!doCompose) {
+ if (!doCompose) {
return FALSE;
}
- } else {
- // If !onlyContiguous (not FCC), then we ignore the tccc of
- // the previous character which passed the quick check "yes && ccc==0" test.
- const UChar *nextSrc;
- uint16_t n16;
- for (;;) {
- if (src == limit) {
- if (doCompose) {
- buffer.appendZeroCC(prevBoundary, limit, errorCode);
- }
- return TRUE;
- }
- uint8_t prevCC = cc;
- nextSrc = src;
- UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, nextSrc, limit, c, n16);
- if (n16 >= MIN_YES_YES_WITH_CC) {
- cc = getCCFromNormalYesOrMaybe(n16);
- if (prevCC > cc) {
- if (!doCompose) {
- return FALSE;
- }
- break;
- }
- } else {
- break;
- }
- src = nextSrc;
+ } else {
+ // If !onlyContiguous (not FCC), then we ignore the tccc of
+ // the previous character which passed the quick check "yes && ccc==0" test.
+ const UChar *nextSrc;
+ uint16_t n16;
+ for (;;) {
+ if (src == limit) {
+ if (doCompose) {
+ buffer.appendZeroCC(prevBoundary, limit, errorCode);
+ }
+ return TRUE;
+ }
+ uint8_t prevCC = cc;
+ nextSrc = src;
+ UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, nextSrc, limit, c, n16);
+ if (n16 >= MIN_YES_YES_WITH_CC) {
+ cc = getCCFromNormalYesOrMaybe(n16);
+ if (prevCC > cc) {
+ if (!doCompose) {
+ return FALSE;
+ }
+ break;
+ }
+ } else {
+ break;
+ }
+ src = nextSrc;
+ }
+ // src is after the last in-order combining mark.
+ // If there is a boundary here, then we continue with no change.
+ if (norm16HasCompBoundaryBefore(n16)) {
+ if (isCompYesAndZeroCC(n16)) {
+ src = nextSrc;
+ }
+ continue;
}
- // src is after the last in-order combining mark.
- // If there is a boundary here, then we continue with no change.
- if (norm16HasCompBoundaryBefore(n16)) {
- if (isCompYesAndZeroCC(n16)) {
- src = nextSrc;
- }
- continue;
- }
- // Use the slow path. There is no boundary in [prevSrc, src[.
- }
- }
-
- // Slow path: Find the nearest boundaries around the current character,
- // decompose and recompose.
- if (prevBoundary != prevSrc && !norm16HasCompBoundaryBefore(norm16)) {
- const UChar *p = prevSrc;
- UCPTRIE_FAST_U16_PREV(normTrie, UCPTRIE_16, prevBoundary, p, c, norm16);
- if (!norm16HasCompBoundaryAfter(norm16, onlyContiguous)) {
- prevSrc = p;
- }
- }
- if (doCompose && prevBoundary != prevSrc && !buffer.appendZeroCC(prevBoundary, prevSrc, errorCode)) {
- break;
- }
+ // Use the slow path. There is no boundary in [prevSrc, src[.
+ }
+ }
+
+ // Slow path: Find the nearest boundaries around the current character,
+ // decompose and recompose.
+ if (prevBoundary != prevSrc && !norm16HasCompBoundaryBefore(norm16)) {
+ const UChar *p = prevSrc;
+ UCPTRIE_FAST_U16_PREV(normTrie, UCPTRIE_16, prevBoundary, p, c, norm16);
+ if (!norm16HasCompBoundaryAfter(norm16, onlyContiguous)) {
+ prevSrc = p;
+ }
+ }
+ if (doCompose && prevBoundary != prevSrc && !buffer.appendZeroCC(prevBoundary, prevSrc, errorCode)) {
+ break;
+ }
int32_t recomposeStartIndex=buffer.length();
- // We know there is not a boundary here.
- decomposeShort(prevSrc, src, FALSE /* !stopAtCompBoundary */, onlyContiguous,
- buffer, errorCode);
- // Decompose until the next boundary.
- src = decomposeShort(src, limit, TRUE /* stopAtCompBoundary */, onlyContiguous,
- buffer, errorCode);
- if (U_FAILURE(errorCode)) {
+ // We know there is not a boundary here.
+ decomposeShort(prevSrc, src, FALSE /* !stopAtCompBoundary */, onlyContiguous,
+ buffer, errorCode);
+ // Decompose until the next boundary.
+ src = decomposeShort(src, limit, TRUE /* stopAtCompBoundary */, onlyContiguous,
+ buffer, errorCode);
+ if (U_FAILURE(errorCode)) {
break;
}
- if ((src - prevSrc) > INT32_MAX) { // guard before buffer.equals()
- errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
- return TRUE;
- }
+ if ((src - prevSrc) > INT32_MAX) { // guard before buffer.equals()
+ errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
+ return TRUE;
+ }
recompose(buffer, recomposeStartIndex, onlyContiguous);
if(!doCompose) {
- if(!buffer.equals(prevSrc, src)) {
+ if(!buffer.equals(prevSrc, src)) {
return FALSE;
}
buffer.remove();
@@ -1580,111 +1580,111 @@ Normalizer2Impl::composeQuickCheck(const UChar *src, const UChar *limit,
if(limit==NULL) {
UErrorCode errorCode=U_ZERO_ERROR;
src=copyLowPrefixFromNulTerminated(src, minNoMaybeCP, NULL, errorCode);
- limit=u_strchr(src, 0);
- if (prevBoundary != src) {
- if (hasCompBoundaryAfter(*(src-1), onlyContiguous)) {
- prevBoundary = src;
- } else {
- prevBoundary = --src;
- }
+ limit=u_strchr(src, 0);
+ if (prevBoundary != src) {
+ if (hasCompBoundaryAfter(*(src-1), onlyContiguous)) {
+ prevBoundary = src;
+ } else {
+ prevBoundary = --src;
+ }
}
}
for(;;) {
- // Fast path: Scan over a sequence of characters below the minimum "no or maybe" code point,
- // or with (compYes && ccc==0) properties.
- const UChar *prevSrc;
- UChar32 c = 0;
- uint16_t norm16 = 0;
- for (;;) {
+ // Fast path: Scan over a sequence of characters below the minimum "no or maybe" code point,
+ // or with (compYes && ccc==0) properties.
+ const UChar *prevSrc;
+ UChar32 c = 0;
+ uint16_t norm16 = 0;
+ for (;;) {
if(src==limit) {
return src;
}
if( (c=*src)<minNoMaybeCP ||
- isCompYesAndZeroCC(norm16=UCPTRIE_FAST_BMP_GET(normTrie, UCPTRIE_16, c))
+ isCompYesAndZeroCC(norm16=UCPTRIE_FAST_BMP_GET(normTrie, UCPTRIE_16, c))
) {
++src;
} else {
- prevSrc = src++;
- if(!U16_IS_LEAD(c)) {
- break;
- } else {
- UChar c2;
- if(src!=limit && U16_IS_TRAIL(c2=*src)) {
- ++src;
+ prevSrc = src++;
+ if(!U16_IS_LEAD(c)) {
+ break;
+ } else {
+ UChar c2;
+ if(src!=limit && U16_IS_TRAIL(c2=*src)) {
+ ++src;
c=U16_GET_SUPPLEMENTARY(c, c2);
- norm16=UCPTRIE_FAST_SUPP_GET(normTrie, UCPTRIE_16, c);
- if(!isCompYesAndZeroCC(norm16)) {
- break;
- }
+ norm16=UCPTRIE_FAST_SUPP_GET(normTrie, UCPTRIE_16, c);
+ if(!isCompYesAndZeroCC(norm16)) {
+ break;
+ }
}
}
- }
- }
- // isCompYesAndZeroCC(norm16) is false, that is, norm16>=minNoNo.
- // The current character is either a "noNo" (has a mapping)
- // or a "maybeYes" (combines backward)
- // or a "yesYes" with ccc!=0.
- // It is not a Hangul syllable or Jamo L because those have "yes" properties.
-
- uint16_t prevNorm16 = INERT;
- if (prevBoundary != prevSrc) {
- if (norm16HasCompBoundaryBefore(norm16)) {
- prevBoundary = prevSrc;
- } else {
- const UChar *p = prevSrc;
- uint16_t n16;
- UCPTRIE_FAST_U16_PREV(normTrie, UCPTRIE_16, prevBoundary, p, c, n16);
- if (norm16HasCompBoundaryAfter(n16, onlyContiguous)) {
- prevBoundary = prevSrc;
+ }
+ }
+ // isCompYesAndZeroCC(norm16) is false, that is, norm16>=minNoNo.
+ // The current character is either a "noNo" (has a mapping)
+ // or a "maybeYes" (combines backward)
+ // or a "yesYes" with ccc!=0.
+ // It is not a Hangul syllable or Jamo L because those have "yes" properties.
+
+ uint16_t prevNorm16 = INERT;
+ if (prevBoundary != prevSrc) {
+ if (norm16HasCompBoundaryBefore(norm16)) {
+ prevBoundary = prevSrc;
+ } else {
+ const UChar *p = prevSrc;
+ uint16_t n16;
+ UCPTRIE_FAST_U16_PREV(normTrie, UCPTRIE_16, prevBoundary, p, c, n16);
+ if (norm16HasCompBoundaryAfter(n16, onlyContiguous)) {
+ prevBoundary = prevSrc;
} else {
- prevBoundary = p;
- prevNorm16 = n16;
+ prevBoundary = p;
+ prevNorm16 = n16;
}
}
}
if(isMaybeOrNonZeroCC(norm16)) {
uint8_t cc=getCCFromYesOrMaybe(norm16);
- if (onlyContiguous /* FCC */ && cc != 0 &&
- getTrailCCFromCompYesAndZeroCC(prevNorm16) > cc) {
- // The [prevBoundary..prevSrc[ character
- // passed the quick check "yes && ccc==0" test
- // but is out of canonical order with the current combining mark.
- } else {
- // If !onlyContiguous (not FCC), then we ignore the tccc of
- // the previous character which passed the quick check "yes && ccc==0" test.
- const UChar *nextSrc;
- for (;;) {
- if (norm16 < MIN_YES_YES_WITH_CC) {
- if (pQCResult != nullptr) {
- *pQCResult = UNORM_MAYBE;
- } else {
- return prevBoundary;
- }
- }
- if (src == limit) {
- return src;
- }
- uint8_t prevCC = cc;
- nextSrc = src;
- UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, nextSrc, limit, c, norm16);
- if (isMaybeOrNonZeroCC(norm16)) {
- cc = getCCFromYesOrMaybe(norm16);
- if (!(prevCC <= cc || cc == 0)) {
- break;
- }
+ if (onlyContiguous /* FCC */ && cc != 0 &&
+ getTrailCCFromCompYesAndZeroCC(prevNorm16) > cc) {
+ // The [prevBoundary..prevSrc[ character
+ // passed the quick check "yes && ccc==0" test
+ // but is out of canonical order with the current combining mark.
+ } else {
+ // If !onlyContiguous (not FCC), then we ignore the tccc of
+ // the previous character which passed the quick check "yes && ccc==0" test.
+ const UChar *nextSrc;
+ for (;;) {
+ if (norm16 < MIN_YES_YES_WITH_CC) {
+ if (pQCResult != nullptr) {
+ *pQCResult = UNORM_MAYBE;
+ } else {
+ return prevBoundary;
+ }
+ }
+ if (src == limit) {
+ return src;
+ }
+ uint8_t prevCC = cc;
+ nextSrc = src;
+ UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, nextSrc, limit, c, norm16);
+ if (isMaybeOrNonZeroCC(norm16)) {
+ cc = getCCFromYesOrMaybe(norm16);
+ if (!(prevCC <= cc || cc == 0)) {
+ break;
+ }
} else {
- break;
+ break;
}
- src = nextSrc;
+ src = nextSrc;
+ }
+ // src is after the last in-order combining mark.
+ if (isCompYesAndZeroCC(norm16)) {
+ prevBoundary = src;
+ src = nextSrc;
+ continue;
}
- // src is after the last in-order combining mark.
- if (isCompYesAndZeroCC(norm16)) {
- prevBoundary = src;
- src = nextSrc;
- continue;
- }
}
}
if(pQCResult!=NULL) {
@@ -1701,10 +1701,10 @@ void Normalizer2Impl::composeAndAppend(const UChar *src, const UChar *limit,
ReorderingBuffer &buffer,
UErrorCode &errorCode) const {
if(!buffer.isEmpty()) {
- const UChar *firstStarterInSrc=findNextCompBoundary(src, limit, onlyContiguous);
+ const UChar *firstStarterInSrc=findNextCompBoundary(src, limit, onlyContiguous);
if(src!=firstStarterInSrc) {
const UChar *lastStarterInDest=findPreviousCompBoundary(buffer.getStart(),
- buffer.getLimit(), onlyContiguous);
+ buffer.getLimit(), onlyContiguous);
int32_t destSuffixLength=(int32_t)(buffer.getLimit()-lastStarterInDest);
UnicodeString middle(lastStarterInDest, destSuffixLength);
buffer.removeSuffix(destSuffixLength);
@@ -1729,408 +1729,408 @@ void Normalizer2Impl::composeAndAppend(const UChar *src, const UChar *limit,
}
}
-UBool
-Normalizer2Impl::composeUTF8(uint32_t options, UBool onlyContiguous,
- const uint8_t *src, const uint8_t *limit,
- ByteSink *sink, Edits *edits, UErrorCode &errorCode) const {
- U_ASSERT(limit != nullptr);
- UnicodeString s16;
- uint8_t minNoMaybeLead = leadByteForCP(minCompNoMaybeCP);
- const uint8_t *prevBoundary = src;
-
- for (;;) {
- // Fast path: Scan over a sequence of characters below the minimum "no or maybe" code point,
- // or with (compYes && ccc==0) properties.
- const uint8_t *prevSrc;
- uint16_t norm16 = 0;
- for (;;) {
- if (src == limit) {
- if (prevBoundary != limit && sink != nullptr) {
- ByteSinkUtil::appendUnchanged(prevBoundary, limit,
- *sink, options, edits, errorCode);
- }
- return TRUE;
- }
- if (*src < minNoMaybeLead) {
- ++src;
- } else {
- prevSrc = src;
- UCPTRIE_FAST_U8_NEXT(normTrie, UCPTRIE_16, src, limit, norm16);
- if (!isCompYesAndZeroCC(norm16)) {
- break;
- }
- }
- }
- // isCompYesAndZeroCC(norm16) is false, that is, norm16>=minNoNo.
- // The current character is either a "noNo" (has a mapping)
- // or a "maybeYes" (combines backward)
- // or a "yesYes" with ccc!=0.
- // It is not a Hangul syllable or Jamo L because those have "yes" properties.
-
- // Medium-fast path: Handle cases that do not require full decomposition and recomposition.
- if (!isMaybeOrNonZeroCC(norm16)) { // minNoNo <= norm16 < minMaybeYes
- if (sink == nullptr) {
- return FALSE;
- }
- // Fast path for mapping a character that is immediately surrounded by boundaries.
- // In this case, we need not decompose around the current character.
- if (isDecompNoAlgorithmic(norm16)) {
- // Maps to a single isCompYesAndZeroCC character
- // which also implies hasCompBoundaryBefore.
- if (norm16HasCompBoundaryAfter(norm16, onlyContiguous) ||
- hasCompBoundaryBefore(src, limit)) {
- if (prevBoundary != prevSrc &&
- !ByteSinkUtil::appendUnchanged(prevBoundary, prevSrc,
- *sink, options, edits, errorCode)) {
- break;
- }
- appendCodePointDelta(prevSrc, src, getAlgorithmicDelta(norm16), *sink, edits);
- prevBoundary = src;
- continue;
- }
- } else if (norm16 < minNoNoCompBoundaryBefore) {
- // The mapping is comp-normalized which also implies hasCompBoundaryBefore.
- if (norm16HasCompBoundaryAfter(norm16, onlyContiguous) ||
- hasCompBoundaryBefore(src, limit)) {
- if (prevBoundary != prevSrc &&
- !ByteSinkUtil::appendUnchanged(prevBoundary, prevSrc,
- *sink, options, edits, errorCode)) {
- break;
- }
- const uint16_t *mapping = getMapping(norm16);
- int32_t length = *mapping++ & MAPPING_LENGTH_MASK;
- if (!ByteSinkUtil::appendChange(prevSrc, src, (const UChar *)mapping, length,
- *sink, edits, errorCode)) {
- break;
- }
- prevBoundary = src;
- continue;
- }
- } else if (norm16 >= minNoNoEmpty) {
- // The current character maps to nothing.
- // Simply omit it from the output if there is a boundary before _or_ after it.
- // The character itself implies no boundaries.
- if (hasCompBoundaryBefore(src, limit) ||
- hasCompBoundaryAfter(prevBoundary, prevSrc, onlyContiguous)) {
- if (prevBoundary != prevSrc &&
- !ByteSinkUtil::appendUnchanged(prevBoundary, prevSrc,
- *sink, options, edits, errorCode)) {
- break;
- }
- if (edits != nullptr) {
- edits->addReplace((int32_t)(src - prevSrc), 0);
- }
- prevBoundary = src;
- continue;
- }
- }
- // Other "noNo" type, or need to examine more text around this character:
- // Fall through to the slow path.
- } else if (isJamoVT(norm16)) {
- // Jamo L: E1 84 80..92
- // Jamo V: E1 85 A1..B5
- // Jamo T: E1 86 A8..E1 87 82
- U_ASSERT((src - prevSrc) == 3 && *prevSrc == 0xe1);
- UChar32 prev = previousHangulOrJamo(prevBoundary, prevSrc);
- if (prevSrc[1] == 0x85) {
- // The current character is a Jamo Vowel,
- // compose with previous Jamo L and following Jamo T.
- UChar32 l = prev - Hangul::JAMO_L_BASE;
- if ((uint32_t)l < Hangul::JAMO_L_COUNT) {
- if (sink == nullptr) {
- return FALSE;
- }
- int32_t t = getJamoTMinusBase(src, limit);
- if (t >= 0) {
- // The next character is a Jamo T.
- src += 3;
- } else if (hasCompBoundaryBefore(src, limit)) {
- // No Jamo T follows, not even via decomposition.
- t = 0;
- }
- if (t >= 0) {
- UChar32 syllable = Hangul::HANGUL_BASE +
- (l*Hangul::JAMO_V_COUNT + (prevSrc[2]-0xa1)) *
- Hangul::JAMO_T_COUNT + t;
- prevSrc -= 3; // Replace the Jamo L as well.
- if (prevBoundary != prevSrc &&
- !ByteSinkUtil::appendUnchanged(prevBoundary, prevSrc,
- *sink, options, edits, errorCode)) {
- break;
- }
- ByteSinkUtil::appendCodePoint(prevSrc, src, syllable, *sink, edits);
- prevBoundary = src;
- continue;
- }
- // If we see L+V+x where x!=T then we drop to the slow path,
- // decompose and recompose.
- // This is to deal with NFKC finding normal L and V but a
- // compatibility variant of a T.
- // We need to either fully compose that combination here
- // (which would complicate the code and may not work with strange custom data)
- // or use the slow path.
- }
- } else if (Hangul::isHangulLV(prev)) {
- // The current character is a Jamo Trailing consonant,
- // compose with previous Hangul LV that does not contain a Jamo T.
- if (sink == nullptr) {
- return FALSE;
- }
- UChar32 syllable = prev + getJamoTMinusBase(prevSrc, src);
- prevSrc -= 3; // Replace the Hangul LV as well.
- if (prevBoundary != prevSrc &&
- !ByteSinkUtil::appendUnchanged(prevBoundary, prevSrc,
- *sink, options, edits, errorCode)) {
- break;
- }
- ByteSinkUtil::appendCodePoint(prevSrc, src, syllable, *sink, edits);
- prevBoundary = src;
- continue;
- }
- // No matching context, or may need to decompose surrounding text first:
- // Fall through to the slow path.
- } else if (norm16 > JAMO_VT) { // norm16 >= MIN_YES_YES_WITH_CC
- // One or more combining marks that do not combine-back:
- // Check for canonical order, copy unchanged if ok and
- // if followed by a character with a boundary-before.
- uint8_t cc = getCCFromNormalYesOrMaybe(norm16); // cc!=0
- if (onlyContiguous /* FCC */ && getPreviousTrailCC(prevBoundary, prevSrc) > cc) {
- // Fails FCD test, need to decompose and contiguously recompose.
- if (sink == nullptr) {
- return FALSE;
- }
- } else {
- // If !onlyContiguous (not FCC), then we ignore the tccc of
- // the previous character which passed the quick check "yes && ccc==0" test.
- const uint8_t *nextSrc;
- uint16_t n16;
- for (;;) {
- if (src == limit) {
- if (sink != nullptr) {
- ByteSinkUtil::appendUnchanged(prevBoundary, limit,
- *sink, options, edits, errorCode);
- }
- return TRUE;
- }
- uint8_t prevCC = cc;
- nextSrc = src;
- UCPTRIE_FAST_U8_NEXT(normTrie, UCPTRIE_16, nextSrc, limit, n16);
- if (n16 >= MIN_YES_YES_WITH_CC) {
- cc = getCCFromNormalYesOrMaybe(n16);
- if (prevCC > cc) {
- if (sink == nullptr) {
- return FALSE;
- }
- break;
- }
- } else {
- break;
- }
- src = nextSrc;
- }
- // src is after the last in-order combining mark.
- // If there is a boundary here, then we continue with no change.
- if (norm16HasCompBoundaryBefore(n16)) {
- if (isCompYesAndZeroCC(n16)) {
- src = nextSrc;
- }
- continue;
- }
- // Use the slow path. There is no boundary in [prevSrc, src[.
- }
- }
-
- // Slow path: Find the nearest boundaries around the current character,
- // decompose and recompose.
- if (prevBoundary != prevSrc && !norm16HasCompBoundaryBefore(norm16)) {
- const uint8_t *p = prevSrc;
- UCPTRIE_FAST_U8_PREV(normTrie, UCPTRIE_16, prevBoundary, p, norm16);
- if (!norm16HasCompBoundaryAfter(norm16, onlyContiguous)) {
- prevSrc = p;
- }
- }
- ReorderingBuffer buffer(*this, s16, errorCode);
- if (U_FAILURE(errorCode)) {
- break;
- }
- // We know there is not a boundary here.
- decomposeShort(prevSrc, src, FALSE /* !stopAtCompBoundary */, onlyContiguous,
- buffer, errorCode);
- // Decompose until the next boundary.
- src = decomposeShort(src, limit, TRUE /* stopAtCompBoundary */, onlyContiguous,
- buffer, errorCode);
- if (U_FAILURE(errorCode)) {
- break;
- }
- if ((src - prevSrc) > INT32_MAX) { // guard before buffer.equals()
- errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
+UBool
+Normalizer2Impl::composeUTF8(uint32_t options, UBool onlyContiguous,
+ const uint8_t *src, const uint8_t *limit,
+ ByteSink *sink, Edits *edits, UErrorCode &errorCode) const {
+ U_ASSERT(limit != nullptr);
+ UnicodeString s16;
+ uint8_t minNoMaybeLead = leadByteForCP(minCompNoMaybeCP);
+ const uint8_t *prevBoundary = src;
+
+ for (;;) {
+ // Fast path: Scan over a sequence of characters below the minimum "no or maybe" code point,
+ // or with (compYes && ccc==0) properties.
+ const uint8_t *prevSrc;
+ uint16_t norm16 = 0;
+ for (;;) {
+ if (src == limit) {
+ if (prevBoundary != limit && sink != nullptr) {
+ ByteSinkUtil::appendUnchanged(prevBoundary, limit,
+ *sink, options, edits, errorCode);
+ }
+ return TRUE;
+ }
+ if (*src < minNoMaybeLead) {
+ ++src;
+ } else {
+ prevSrc = src;
+ UCPTRIE_FAST_U8_NEXT(normTrie, UCPTRIE_16, src, limit, norm16);
+ if (!isCompYesAndZeroCC(norm16)) {
+ break;
+ }
+ }
+ }
+ // isCompYesAndZeroCC(norm16) is false, that is, norm16>=minNoNo.
+ // The current character is either a "noNo" (has a mapping)
+ // or a "maybeYes" (combines backward)
+ // or a "yesYes" with ccc!=0.
+ // It is not a Hangul syllable or Jamo L because those have "yes" properties.
+
+ // Medium-fast path: Handle cases that do not require full decomposition and recomposition.
+ if (!isMaybeOrNonZeroCC(norm16)) { // minNoNo <= norm16 < minMaybeYes
+ if (sink == nullptr) {
+ return FALSE;
+ }
+ // Fast path for mapping a character that is immediately surrounded by boundaries.
+ // In this case, we need not decompose around the current character.
+ if (isDecompNoAlgorithmic(norm16)) {
+ // Maps to a single isCompYesAndZeroCC character
+ // which also implies hasCompBoundaryBefore.
+ if (norm16HasCompBoundaryAfter(norm16, onlyContiguous) ||
+ hasCompBoundaryBefore(src, limit)) {
+ if (prevBoundary != prevSrc &&
+ !ByteSinkUtil::appendUnchanged(prevBoundary, prevSrc,
+ *sink, options, edits, errorCode)) {
+ break;
+ }
+ appendCodePointDelta(prevSrc, src, getAlgorithmicDelta(norm16), *sink, edits);
+ prevBoundary = src;
+ continue;
+ }
+ } else if (norm16 < minNoNoCompBoundaryBefore) {
+ // The mapping is comp-normalized which also implies hasCompBoundaryBefore.
+ if (norm16HasCompBoundaryAfter(norm16, onlyContiguous) ||
+ hasCompBoundaryBefore(src, limit)) {
+ if (prevBoundary != prevSrc &&
+ !ByteSinkUtil::appendUnchanged(prevBoundary, prevSrc,
+ *sink, options, edits, errorCode)) {
+ break;
+ }
+ const uint16_t *mapping = getMapping(norm16);
+ int32_t length = *mapping++ & MAPPING_LENGTH_MASK;
+ if (!ByteSinkUtil::appendChange(prevSrc, src, (const UChar *)mapping, length,
+ *sink, edits, errorCode)) {
+ break;
+ }
+ prevBoundary = src;
+ continue;
+ }
+ } else if (norm16 >= minNoNoEmpty) {
+ // The current character maps to nothing.
+ // Simply omit it from the output if there is a boundary before _or_ after it.
+ // The character itself implies no boundaries.
+ if (hasCompBoundaryBefore(src, limit) ||
+ hasCompBoundaryAfter(prevBoundary, prevSrc, onlyContiguous)) {
+ if (prevBoundary != prevSrc &&
+ !ByteSinkUtil::appendUnchanged(prevBoundary, prevSrc,
+ *sink, options, edits, errorCode)) {
+ break;
+ }
+ if (edits != nullptr) {
+ edits->addReplace((int32_t)(src - prevSrc), 0);
+ }
+ prevBoundary = src;
+ continue;
+ }
+ }
+ // Other "noNo" type, or need to examine more text around this character:
+ // Fall through to the slow path.
+ } else if (isJamoVT(norm16)) {
+ // Jamo L: E1 84 80..92
+ // Jamo V: E1 85 A1..B5
+ // Jamo T: E1 86 A8..E1 87 82
+ U_ASSERT((src - prevSrc) == 3 && *prevSrc == 0xe1);
+ UChar32 prev = previousHangulOrJamo(prevBoundary, prevSrc);
+ if (prevSrc[1] == 0x85) {
+ // The current character is a Jamo Vowel,
+ // compose with previous Jamo L and following Jamo T.
+ UChar32 l = prev - Hangul::JAMO_L_BASE;
+ if ((uint32_t)l < Hangul::JAMO_L_COUNT) {
+ if (sink == nullptr) {
+ return FALSE;
+ }
+ int32_t t = getJamoTMinusBase(src, limit);
+ if (t >= 0) {
+ // The next character is a Jamo T.
+ src += 3;
+ } else if (hasCompBoundaryBefore(src, limit)) {
+ // No Jamo T follows, not even via decomposition.
+ t = 0;
+ }
+ if (t >= 0) {
+ UChar32 syllable = Hangul::HANGUL_BASE +
+ (l*Hangul::JAMO_V_COUNT + (prevSrc[2]-0xa1)) *
+ Hangul::JAMO_T_COUNT + t;
+ prevSrc -= 3; // Replace the Jamo L as well.
+ if (prevBoundary != prevSrc &&
+ !ByteSinkUtil::appendUnchanged(prevBoundary, prevSrc,
+ *sink, options, edits, errorCode)) {
+ break;
+ }
+ ByteSinkUtil::appendCodePoint(prevSrc, src, syllable, *sink, edits);
+ prevBoundary = src;
+ continue;
+ }
+ // If we see L+V+x where x!=T then we drop to the slow path,
+ // decompose and recompose.
+ // This is to deal with NFKC finding normal L and V but a
+ // compatibility variant of a T.
+ // We need to either fully compose that combination here
+ // (which would complicate the code and may not work with strange custom data)
+ // or use the slow path.
+ }
+ } else if (Hangul::isHangulLV(prev)) {
+ // The current character is a Jamo Trailing consonant,
+ // compose with previous Hangul LV that does not contain a Jamo T.
+ if (sink == nullptr) {
+ return FALSE;
+ }
+ UChar32 syllable = prev + getJamoTMinusBase(prevSrc, src);
+ prevSrc -= 3; // Replace the Hangul LV as well.
+ if (prevBoundary != prevSrc &&
+ !ByteSinkUtil::appendUnchanged(prevBoundary, prevSrc,
+ *sink, options, edits, errorCode)) {
+ break;
+ }
+ ByteSinkUtil::appendCodePoint(prevSrc, src, syllable, *sink, edits);
+ prevBoundary = src;
+ continue;
+ }
+ // No matching context, or may need to decompose surrounding text first:
+ // Fall through to the slow path.
+ } else if (norm16 > JAMO_VT) { // norm16 >= MIN_YES_YES_WITH_CC
+ // One or more combining marks that do not combine-back:
+ // Check for canonical order, copy unchanged if ok and
+ // if followed by a character with a boundary-before.
+ uint8_t cc = getCCFromNormalYesOrMaybe(norm16); // cc!=0
+ if (onlyContiguous /* FCC */ && getPreviousTrailCC(prevBoundary, prevSrc) > cc) {
+ // Fails FCD test, need to decompose and contiguously recompose.
+ if (sink == nullptr) {
+ return FALSE;
+ }
+ } else {
+ // If !onlyContiguous (not FCC), then we ignore the tccc of
+ // the previous character which passed the quick check "yes && ccc==0" test.
+ const uint8_t *nextSrc;
+ uint16_t n16;
+ for (;;) {
+ if (src == limit) {
+ if (sink != nullptr) {
+ ByteSinkUtil::appendUnchanged(prevBoundary, limit,
+ *sink, options, edits, errorCode);
+ }
+ return TRUE;
+ }
+ uint8_t prevCC = cc;
+ nextSrc = src;
+ UCPTRIE_FAST_U8_NEXT(normTrie, UCPTRIE_16, nextSrc, limit, n16);
+ if (n16 >= MIN_YES_YES_WITH_CC) {
+ cc = getCCFromNormalYesOrMaybe(n16);
+ if (prevCC > cc) {
+ if (sink == nullptr) {
+ return FALSE;
+ }
+ break;
+ }
+ } else {
+ break;
+ }
+ src = nextSrc;
+ }
+ // src is after the last in-order combining mark.
+ // If there is a boundary here, then we continue with no change.
+ if (norm16HasCompBoundaryBefore(n16)) {
+ if (isCompYesAndZeroCC(n16)) {
+ src = nextSrc;
+ }
+ continue;
+ }
+ // Use the slow path. There is no boundary in [prevSrc, src[.
+ }
+ }
+
+ // Slow path: Find the nearest boundaries around the current character,
+ // decompose and recompose.
+ if (prevBoundary != prevSrc && !norm16HasCompBoundaryBefore(norm16)) {
+ const uint8_t *p = prevSrc;
+ UCPTRIE_FAST_U8_PREV(normTrie, UCPTRIE_16, prevBoundary, p, norm16);
+ if (!norm16HasCompBoundaryAfter(norm16, onlyContiguous)) {
+ prevSrc = p;
+ }
+ }
+ ReorderingBuffer buffer(*this, s16, errorCode);
+ if (U_FAILURE(errorCode)) {
+ break;
+ }
+ // We know there is not a boundary here.
+ decomposeShort(prevSrc, src, FALSE /* !stopAtCompBoundary */, onlyContiguous,
+ buffer, errorCode);
+ // Decompose until the next boundary.
+ src = decomposeShort(src, limit, TRUE /* stopAtCompBoundary */, onlyContiguous,
+ buffer, errorCode);
+ if (U_FAILURE(errorCode)) {
+ break;
+ }
+ if ((src - prevSrc) > INT32_MAX) { // guard before buffer.equals()
+ errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
return TRUE;
- }
- recompose(buffer, 0, onlyContiguous);
- if (!buffer.equals(prevSrc, src)) {
- if (sink == nullptr) {
+ }
+ recompose(buffer, 0, onlyContiguous);
+ if (!buffer.equals(prevSrc, src)) {
+ if (sink == nullptr) {
return FALSE;
}
- if (prevBoundary != prevSrc &&
- !ByteSinkUtil::appendUnchanged(prevBoundary, prevSrc,
- *sink, options, edits, errorCode)) {
- break;
+ if (prevBoundary != prevSrc &&
+ !ByteSinkUtil::appendUnchanged(prevBoundary, prevSrc,
+ *sink, options, edits, errorCode)) {
+ break;
}
- if (!ByteSinkUtil::appendChange(prevSrc, src, buffer.getStart(), buffer.length(),
- *sink, edits, errorCode)) {
- break;
- }
- prevBoundary = src;
+ if (!ByteSinkUtil::appendChange(prevSrc, src, buffer.getStart(), buffer.length(),
+ *sink, edits, errorCode)) {
+ break;
+ }
+ prevBoundary = src;
}
}
- return TRUE;
+ return TRUE;
+}
+
+UBool Normalizer2Impl::hasCompBoundaryBefore(const UChar *src, const UChar *limit) const {
+ if (src == limit || *src < minCompNoMaybeCP) {
+ return TRUE;
+ }
+ UChar32 c;
+ uint16_t norm16;
+ UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, src, limit, c, norm16);
+ return norm16HasCompBoundaryBefore(norm16);
}
-UBool Normalizer2Impl::hasCompBoundaryBefore(const UChar *src, const UChar *limit) const {
- if (src == limit || *src < minCompNoMaybeCP) {
- return TRUE;
+UBool Normalizer2Impl::hasCompBoundaryBefore(const uint8_t *src, const uint8_t *limit) const {
+ if (src == limit) {
+ return TRUE;
}
- UChar32 c;
- uint16_t norm16;
- UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, src, limit, c, norm16);
- return norm16HasCompBoundaryBefore(norm16);
+ uint16_t norm16;
+ UCPTRIE_FAST_U8_NEXT(normTrie, UCPTRIE_16, src, limit, norm16);
+ return norm16HasCompBoundaryBefore(norm16);
}
-UBool Normalizer2Impl::hasCompBoundaryBefore(const uint8_t *src, const uint8_t *limit) const {
- if (src == limit) {
- return TRUE;
- }
+UBool Normalizer2Impl::hasCompBoundaryAfter(const UChar *start, const UChar *p,
+ UBool onlyContiguous) const {
+ if (start == p) {
+ return TRUE;
+ }
+ UChar32 c;
uint16_t norm16;
- UCPTRIE_FAST_U8_NEXT(normTrie, UCPTRIE_16, src, limit, norm16);
- return norm16HasCompBoundaryBefore(norm16);
+ UCPTRIE_FAST_U16_PREV(normTrie, UCPTRIE_16, start, p, c, norm16);
+ return norm16HasCompBoundaryAfter(norm16, onlyContiguous);
}
-UBool Normalizer2Impl::hasCompBoundaryAfter(const UChar *start, const UChar *p,
- UBool onlyContiguous) const {
- if (start == p) {
- return TRUE;
- }
- UChar32 c;
+UBool Normalizer2Impl::hasCompBoundaryAfter(const uint8_t *start, const uint8_t *p,
+ UBool onlyContiguous) const {
+ if (start == p) {
+ return TRUE;
+ }
uint16_t norm16;
- UCPTRIE_FAST_U16_PREV(normTrie, UCPTRIE_16, start, p, c, norm16);
- return norm16HasCompBoundaryAfter(norm16, onlyContiguous);
-}
-
-UBool Normalizer2Impl::hasCompBoundaryAfter(const uint8_t *start, const uint8_t *p,
- UBool onlyContiguous) const {
- if (start == p) {
- return TRUE;
- }
- uint16_t norm16;
- UCPTRIE_FAST_U8_PREV(normTrie, UCPTRIE_16, start, p, norm16);
- return norm16HasCompBoundaryAfter(norm16, onlyContiguous);
-}
-
-const UChar *Normalizer2Impl::findPreviousCompBoundary(const UChar *start, const UChar *p,
- UBool onlyContiguous) const {
- while (p != start) {
- const UChar *codePointLimit = p;
- UChar32 c;
- uint16_t norm16;
- UCPTRIE_FAST_U16_PREV(normTrie, UCPTRIE_16, start, p, c, norm16);
- if (norm16HasCompBoundaryAfter(norm16, onlyContiguous)) {
- return codePointLimit;
- }
- if (hasCompBoundaryBefore(c, norm16)) {
- return p;
- }
- }
- return p;
-}
-
-const UChar *Normalizer2Impl::findNextCompBoundary(const UChar *p, const UChar *limit,
- UBool onlyContiguous) const {
- while (p != limit) {
- const UChar *codePointStart = p;
- UChar32 c;
- uint16_t norm16;
- UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, p, limit, c, norm16);
- if (hasCompBoundaryBefore(c, norm16)) {
- return codePointStart;
- }
- if (norm16HasCompBoundaryAfter(norm16, onlyContiguous)) {
- return p;
- }
- }
- return p;
-}
-
-uint8_t Normalizer2Impl::getPreviousTrailCC(const UChar *start, const UChar *p) const {
- if (start == p) {
- return 0;
- }
- int32_t i = (int32_t)(p - start);
- UChar32 c;
- U16_PREV(start, 0, i, c);
- return (uint8_t)getFCD16(c);
-}
-
-uint8_t Normalizer2Impl::getPreviousTrailCC(const uint8_t *start, const uint8_t *p) const {
- if (start == p) {
- return 0;
- }
- int32_t i = (int32_t)(p - start);
- UChar32 c;
- U8_PREV(start, 0, i, c);
- return (uint8_t)getFCD16(c);
-}
-
+ UCPTRIE_FAST_U8_PREV(normTrie, UCPTRIE_16, start, p, norm16);
+ return norm16HasCompBoundaryAfter(norm16, onlyContiguous);
+}
+
+const UChar *Normalizer2Impl::findPreviousCompBoundary(const UChar *start, const UChar *p,
+ UBool onlyContiguous) const {
+ while (p != start) {
+ const UChar *codePointLimit = p;
+ UChar32 c;
+ uint16_t norm16;
+ UCPTRIE_FAST_U16_PREV(normTrie, UCPTRIE_16, start, p, c, norm16);
+ if (norm16HasCompBoundaryAfter(norm16, onlyContiguous)) {
+ return codePointLimit;
+ }
+ if (hasCompBoundaryBefore(c, norm16)) {
+ return p;
+ }
+ }
+ return p;
+}
+
+const UChar *Normalizer2Impl::findNextCompBoundary(const UChar *p, const UChar *limit,
+ UBool onlyContiguous) const {
+ while (p != limit) {
+ const UChar *codePointStart = p;
+ UChar32 c;
+ uint16_t norm16;
+ UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, p, limit, c, norm16);
+ if (hasCompBoundaryBefore(c, norm16)) {
+ return codePointStart;
+ }
+ if (norm16HasCompBoundaryAfter(norm16, onlyContiguous)) {
+ return p;
+ }
+ }
+ return p;
+}
+
+uint8_t Normalizer2Impl::getPreviousTrailCC(const UChar *start, const UChar *p) const {
+ if (start == p) {
+ return 0;
+ }
+ int32_t i = (int32_t)(p - start);
+ UChar32 c;
+ U16_PREV(start, 0, i, c);
+ return (uint8_t)getFCD16(c);
+}
+
+uint8_t Normalizer2Impl::getPreviousTrailCC(const uint8_t *start, const uint8_t *p) const {
+ if (start == p) {
+ return 0;
+ }
+ int32_t i = (int32_t)(p - start);
+ UChar32 c;
+ U8_PREV(start, 0, i, c);
+ return (uint8_t)getFCD16(c);
+}
+
// Note: normalizer2impl.cpp r30982 (2011-nov-27)
// still had getFCDTrie() which built and cached an FCD trie.
// That provided faster access to FCD data than getFCD16FromNormData()
// but required synchronization and consumed some 10kB of heap memory
// in any process that uses FCD (e.g., via collation).
-// minDecompNoCP etc. and smallFCD[] are intended to help with any loss of performance,
-// at least for ASCII & CJK.
-
-// Ticket 20907 - The optimizer in MSVC/Visual Studio versions below 16.4 has trouble with this
-// function on Windows ARM64. As a work-around, we disable optimizations for this function.
-// This work-around could/should be removed once the following versions of Visual Studio are no
-// longer supported: All versions of VS2017, and versions of VS2019 below 16.4.
-#if (defined(_MSC_VER) && (defined(_M_ARM64)) && (_MSC_VER < 1924))
-#pragma optimize( "", off )
-#endif
+// minDecompNoCP etc. and smallFCD[] are intended to help with any loss of performance,
+// at least for ASCII & CJK.
+
+// Ticket 20907 - The optimizer in MSVC/Visual Studio versions below 16.4 has trouble with this
+// function on Windows ARM64. As a work-around, we disable optimizations for this function.
+// This work-around could/should be removed once the following versions of Visual Studio are no
+// longer supported: All versions of VS2017, and versions of VS2019 below 16.4.
+#if (defined(_MSC_VER) && (defined(_M_ARM64)) && (_MSC_VER < 1924))
+#pragma optimize( "", off )
+#endif
// Gets the FCD value from the regular normalization data.
uint16_t Normalizer2Impl::getFCD16FromNormData(UChar32 c) const {
- uint16_t norm16=getNorm16(c);
- if (norm16 >= limitNoNo) {
- if(norm16>=MIN_NORMAL_MAYBE_YES) {
+ uint16_t norm16=getNorm16(c);
+ if (norm16 >= limitNoNo) {
+ if(norm16>=MIN_NORMAL_MAYBE_YES) {
// combining mark
- norm16=getCCFromNormalYesOrMaybe(norm16);
+ norm16=getCCFromNormalYesOrMaybe(norm16);
return norm16|(norm16<<8);
} else if(norm16>=minMaybeYes) {
return 0;
- } else { // isDecompNoAlgorithmic(norm16)
- uint16_t deltaTrailCC = norm16 & DELTA_TCCC_MASK;
- if (deltaTrailCC <= DELTA_TCCC_1) {
- return deltaTrailCC >> OFFSET_SHIFT;
- }
- // Maps to an isCompYesAndZeroCC.
+ } else { // isDecompNoAlgorithmic(norm16)
+ uint16_t deltaTrailCC = norm16 & DELTA_TCCC_MASK;
+ if (deltaTrailCC <= DELTA_TCCC_1) {
+ return deltaTrailCC >> OFFSET_SHIFT;
+ }
+ // Maps to an isCompYesAndZeroCC.
c=mapAlgorithmic(c, norm16);
- norm16=getRawNorm16(c);
- }
- }
- if(norm16<=minYesNo || isHangulLVT(norm16)) {
- // no decomposition or Hangul syllable, all zeros
- return 0;
- }
- // c decomposes, get everything from the variable-length extra data
- const uint16_t *mapping=getMapping(norm16);
- uint16_t firstUnit=*mapping;
- norm16=firstUnit>>8; // tccc
- if(firstUnit&MAPPING_HAS_CCC_LCCC_WORD) {
- norm16|=*(mapping-1)&0xff00; // lccc
- }
- return norm16;
-}
-#if (defined(_MSC_VER) && (defined(_M_ARM64)) && (_MSC_VER < 1924))
-#pragma optimize( "", on )
-#endif
+ norm16=getRawNorm16(c);
+ }
+ }
+ if(norm16<=minYesNo || isHangulLVT(norm16)) {
+ // no decomposition or Hangul syllable, all zeros
+ return 0;
+ }
+ // c decomposes, get everything from the variable-length extra data
+ const uint16_t *mapping=getMapping(norm16);
+ uint16_t firstUnit=*mapping;
+ norm16=firstUnit>>8; // tccc
+ if(firstUnit&MAPPING_HAS_CCC_LCCC_WORD) {
+ norm16|=*(mapping-1)&0xff00; // lccc
+ }
+ return norm16;
+}
+#if (defined(_MSC_VER) && (defined(_M_ARM64)) && (_MSC_VER < 1924))
+#pragma optimize( "", on )
+#endif
// Dual functionality:
// buffer!=NULL: normalize
@@ -2144,7 +2144,7 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit,
const UChar *prevBoundary=src;
int32_t prevFCD16=0;
if(limit==NULL) {
- src=copyLowPrefixFromNulTerminated(src, minLcccCP, buffer, errorCode);
+ src=copyLowPrefixFromNulTerminated(src, minLcccCP, buffer, errorCode);
if(U_FAILURE(errorCode)) {
return src;
}
@@ -2173,17 +2173,17 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit,
for(;;) {
// count code units with lccc==0
for(prevSrc=src; src!=limit;) {
- if((c=*src)<minLcccCP) {
+ if((c=*src)<minLcccCP) {
prevFCD16=~c;
++src;
} else if(!singleLeadMightHaveNonZeroFCD16(c)) {
prevFCD16=0;
++src;
} else {
- if(U16_IS_LEAD(c)) {
+ if(U16_IS_LEAD(c)) {
UChar c2;
- if((src+1)!=limit && U16_IS_TRAIL(c2=src[1])) {
- c=U16_GET_SUPPLEMENTARY(c, c2);
+ if((src+1)!=limit && U16_IS_TRAIL(c2=src[1])) {
+ c=U16_GET_SUPPLEMENTARY(c, c2);
}
}
if((fcd16=getFCD16FromNormData(c))<=0xff) {
@@ -2205,15 +2205,15 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit,
prevBoundary=src;
// We know that the previous character's lccc==0.
if(prevFCD16<0) {
- // Fetching the fcd16 value was deferred for this below-minLcccCP code point.
+ // Fetching the fcd16 value was deferred for this below-minLcccCP code point.
UChar32 prev=~prevFCD16;
- if(prev<minDecompNoCP) {
- prevFCD16=0;
- } else {
- prevFCD16=getFCD16FromNormData(prev);
- if(prevFCD16>1) {
- --prevBoundary;
- }
+ if(prev<minDecompNoCP) {
+ prevFCD16=0;
+ } else {
+ prevFCD16=getFCD16FromNormData(prev);
+ if(prevFCD16>1) {
+ --prevBoundary;
+ }
}
} else {
const UChar *p=src-1;
@@ -2265,8 +2265,8 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit,
* The source text does not fulfill the conditions for FCD.
* Decompose and reorder a limited piece of the text.
*/
- decomposeShort(prevBoundary, src, FALSE, FALSE, *buffer, errorCode);
- if (U_FAILURE(errorCode)) {
+ decomposeShort(prevBoundary, src, FALSE, FALSE, *buffer, errorCode);
+ if (U_FAILURE(errorCode)) {
break;
}
prevBoundary=src;
@@ -2310,33 +2310,33 @@ void Normalizer2Impl::makeFCDAndAppend(const UChar *src, const UChar *limit,
}
const UChar *Normalizer2Impl::findPreviousFCDBoundary(const UChar *start, const UChar *p) const {
- while(start<p) {
- const UChar *codePointLimit = p;
- UChar32 c;
- uint16_t norm16;
- UCPTRIE_FAST_U16_PREV(normTrie, UCPTRIE_16, start, p, c, norm16);
- if (c < minDecompNoCP || norm16HasDecompBoundaryAfter(norm16)) {
- return codePointLimit;
- }
- if (norm16HasDecompBoundaryBefore(norm16)) {
- return p;
- }
- }
+ while(start<p) {
+ const UChar *codePointLimit = p;
+ UChar32 c;
+ uint16_t norm16;
+ UCPTRIE_FAST_U16_PREV(normTrie, UCPTRIE_16, start, p, c, norm16);
+ if (c < minDecompNoCP || norm16HasDecompBoundaryAfter(norm16)) {
+ return codePointLimit;
+ }
+ if (norm16HasDecompBoundaryBefore(norm16)) {
+ return p;
+ }
+ }
return p;
}
const UChar *Normalizer2Impl::findNextFCDBoundary(const UChar *p, const UChar *limit) const {
while(p<limit) {
const UChar *codePointStart=p;
- UChar32 c;
- uint16_t norm16;
- UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, p, limit, c, norm16);
- if (c < minLcccCP || norm16HasDecompBoundaryBefore(norm16)) {
+ UChar32 c;
+ uint16_t norm16;
+ UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, p, limit, c, norm16);
+ if (c < minLcccCP || norm16HasDecompBoundaryBefore(norm16)) {
return codePointStart;
}
- if (norm16HasDecompBoundaryAfter(norm16)) {
- return p;
- }
+ if (norm16HasDecompBoundaryAfter(norm16)) {
+ return p;
+ }
}
return p;
}
@@ -2344,20 +2344,20 @@ const UChar *Normalizer2Impl::findNextFCDBoundary(const UChar *p, const UChar *l
// CanonicalIterator data -------------------------------------------------- ***
CanonIterData::CanonIterData(UErrorCode &errorCode) :
- mutableTrie(umutablecptrie_open(0, 0, &errorCode)), trie(nullptr),
+ mutableTrie(umutablecptrie_open(0, 0, &errorCode)), trie(nullptr),
canonStartSets(uprv_deleteUObject, NULL, errorCode) {}
CanonIterData::~CanonIterData() {
- umutablecptrie_close(mutableTrie);
- ucptrie_close(trie);
+ umutablecptrie_close(mutableTrie);
+ ucptrie_close(trie);
}
void CanonIterData::addToStartSet(UChar32 origin, UChar32 decompLead, UErrorCode &errorCode) {
- uint32_t canonValue = umutablecptrie_get(mutableTrie, decompLead);
+ uint32_t canonValue = umutablecptrie_get(mutableTrie, decompLead);
if((canonValue&(CANON_HAS_SET|CANON_VALUE_MASK))==0 && origin!=0) {
// origin is the first character whose decomposition starts with
// the character for which we are setting the value.
- umutablecptrie_set(mutableTrie, decompLead, canonValue|origin, &errorCode);
+ umutablecptrie_set(mutableTrie, decompLead, canonValue|origin, &errorCode);
} else {
// origin is not the first character, or it is U+0000.
UnicodeSet *set;
@@ -2369,7 +2369,7 @@ void CanonIterData::addToStartSet(UChar32 origin, UChar32 decompLead, UErrorCode
}
UChar32 firstOrigin=(UChar32)(canonValue&CANON_VALUE_MASK);
canonValue=(canonValue&~CANON_VALUE_MASK)|CANON_HAS_SET|(uint32_t)canonStartSets.size();
- umutablecptrie_set(mutableTrie, decompLead, canonValue, &errorCode);
+ umutablecptrie_set(mutableTrie, decompLead, canonValue, &errorCode);
canonStartSets.addElement(set, errorCode);
if(firstOrigin!=0) {
set->add(firstOrigin);
@@ -2381,47 +2381,47 @@ void CanonIterData::addToStartSet(UChar32 origin, UChar32 decompLead, UErrorCode
}
}
-// C++ class for friend access to private Normalizer2Impl members.
-class InitCanonIterData {
-public:
- static void doInit(Normalizer2Impl *impl, UErrorCode &errorCode);
-};
-
+// C++ class for friend access to private Normalizer2Impl members.
+class InitCanonIterData {
+public:
+ static void doInit(Normalizer2Impl *impl, UErrorCode &errorCode);
+};
+
U_CDECL_BEGIN
-// UInitOnce instantiation function for CanonIterData
-static void U_CALLCONV
-initCanonIterData(Normalizer2Impl *impl, UErrorCode &errorCode) {
- InitCanonIterData::doInit(impl, errorCode);
+// UInitOnce instantiation function for CanonIterData
+static void U_CALLCONV
+initCanonIterData(Normalizer2Impl *impl, UErrorCode &errorCode) {
+ InitCanonIterData::doInit(impl, errorCode);
}
-U_CDECL_END
+U_CDECL_END
-void InitCanonIterData::doInit(Normalizer2Impl *impl, UErrorCode &errorCode) {
+void InitCanonIterData::doInit(Normalizer2Impl *impl, UErrorCode &errorCode) {
U_ASSERT(impl->fCanonIterData == NULL);
impl->fCanonIterData = new CanonIterData(errorCode);
if (impl->fCanonIterData == NULL) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
}
if (U_SUCCESS(errorCode)) {
- UChar32 start = 0, end;
- uint32_t value;
- while ((end = ucptrie_getRange(impl->normTrie, start,
- UCPMAP_RANGE_FIXED_LEAD_SURROGATES, Normalizer2Impl::INERT,
- nullptr, nullptr, &value)) >= 0) {
- // Call Normalizer2Impl::makeCanonIterDataFromNorm16() for a range of same-norm16 characters.
- if (value != Normalizer2Impl::INERT) {
- impl->makeCanonIterDataFromNorm16(start, end, value, *impl->fCanonIterData, errorCode);
- }
- start = end + 1;
- }
-#ifdef UCPTRIE_DEBUG
- umutablecptrie_setName(impl->fCanonIterData->mutableTrie, "CanonIterData");
-#endif
- impl->fCanonIterData->trie = umutablecptrie_buildImmutable(
- impl->fCanonIterData->mutableTrie, UCPTRIE_TYPE_SMALL, UCPTRIE_VALUE_BITS_32, &errorCode);
- umutablecptrie_close(impl->fCanonIterData->mutableTrie);
- impl->fCanonIterData->mutableTrie = nullptr;
+ UChar32 start = 0, end;
+ uint32_t value;
+ while ((end = ucptrie_getRange(impl->normTrie, start,
+ UCPMAP_RANGE_FIXED_LEAD_SURROGATES, Normalizer2Impl::INERT,
+ nullptr, nullptr, &value)) >= 0) {
+ // Call Normalizer2Impl::makeCanonIterDataFromNorm16() for a range of same-norm16 characters.
+ if (value != Normalizer2Impl::INERT) {
+ impl->makeCanonIterDataFromNorm16(start, end, value, *impl->fCanonIterData, errorCode);
+ }
+ start = end + 1;
+ }
+#ifdef UCPTRIE_DEBUG
+ umutablecptrie_setName(impl->fCanonIterData->mutableTrie, "CanonIterData");
+#endif
+ impl->fCanonIterData->trie = umutablecptrie_buildImmutable(
+ impl->fCanonIterData->mutableTrie, UCPTRIE_TYPE_SMALL, UCPTRIE_VALUE_BITS_32, &errorCode);
+ umutablecptrie_close(impl->fCanonIterData->mutableTrie);
+ impl->fCanonIterData->mutableTrie = nullptr;
}
if (U_FAILURE(errorCode)) {
delete impl->fCanonIterData;
@@ -2429,10 +2429,10 @@ void InitCanonIterData::doInit(Normalizer2Impl *impl, UErrorCode &errorCode) {
}
}
-void Normalizer2Impl::makeCanonIterDataFromNorm16(UChar32 start, UChar32 end, const uint16_t norm16,
+void Normalizer2Impl::makeCanonIterDataFromNorm16(UChar32 start, UChar32 end, const uint16_t norm16,
CanonIterData &newData,
UErrorCode &errorCode) const {
- if(isInert(norm16) || (minYesNo<=norm16 && norm16<minNoNo)) {
+ if(isInert(norm16) || (minYesNo<=norm16 && norm16<minNoNo)) {
// Inert, or 2-way mapping (including Hangul syllable).
// We do not write a canonStartSet for any yesNo character.
// Composites from 2-way mappings are added at runtime from the
@@ -2442,9 +2442,9 @@ void Normalizer2Impl::makeCanonIterDataFromNorm16(UChar32 start, UChar32 end, co
return;
}
for(UChar32 c=start; c<=end; ++c) {
- uint32_t oldValue = umutablecptrie_get(newData.mutableTrie, c);
+ uint32_t oldValue = umutablecptrie_get(newData.mutableTrie, c);
uint32_t newValue=oldValue;
- if(isMaybeOrNonZeroCC(norm16)) {
+ if(isMaybeOrNonZeroCC(norm16)) {
// not a segment starter if it occurs in a decomposition or has cc!=0
newValue|=CANON_NOT_SEGMENT_STARTER;
if(norm16<MIN_NORMAL_MAYBE_YES) {
@@ -2455,16 +2455,16 @@ void Normalizer2Impl::makeCanonIterDataFromNorm16(UChar32 start, UChar32 end, co
} else {
// c has a one-way decomposition
UChar32 c2=c;
- // Do not modify the whole-range norm16 value.
+ // Do not modify the whole-range norm16 value.
uint16_t norm16_2=norm16;
- if (isDecompNoAlgorithmic(norm16_2)) {
- // Maps to an isCompYesAndZeroCC.
- c2 = mapAlgorithmic(c2, norm16_2);
- norm16_2 = getRawNorm16(c2);
- // No compatibility mappings for the CanonicalIterator.
- U_ASSERT(!(isHangulLV(norm16_2) || isHangulLVT(norm16_2)));
- }
- if (norm16_2 > minYesNo) {
+ if (isDecompNoAlgorithmic(norm16_2)) {
+ // Maps to an isCompYesAndZeroCC.
+ c2 = mapAlgorithmic(c2, norm16_2);
+ norm16_2 = getRawNorm16(c2);
+ // No compatibility mappings for the CanonicalIterator.
+ U_ASSERT(!(isHangulLV(norm16_2) || isHangulLVT(norm16_2)));
+ }
+ if (norm16_2 > minYesNo) {
// c decomposes, get everything from the variable-length extra data
const uint16_t *mapping=getMapping(norm16_2);
uint16_t firstUnit=*mapping;
@@ -2487,10 +2487,10 @@ void Normalizer2Impl::makeCanonIterDataFromNorm16(UChar32 start, UChar32 end, co
if(norm16_2>=minNoNo) {
while(i<length) {
U16_NEXT_UNSAFE(mapping, i, c2);
- uint32_t c2Value = umutablecptrie_get(newData.mutableTrie, c2);
+ uint32_t c2Value = umutablecptrie_get(newData.mutableTrie, c2);
if((c2Value&CANON_NOT_SEGMENT_STARTER)==0) {
- umutablecptrie_set(newData.mutableTrie, c2,
- c2Value|CANON_NOT_SEGMENT_STARTER, &errorCode);
+ umutablecptrie_set(newData.mutableTrie, c2,
+ c2Value|CANON_NOT_SEGMENT_STARTER, &errorCode);
}
}
}
@@ -2501,7 +2501,7 @@ void Normalizer2Impl::makeCanonIterDataFromNorm16(UChar32 start, UChar32 end, co
}
}
if(newValue!=oldValue) {
- umutablecptrie_set(newData.mutableTrie, c, newValue, &errorCode);
+ umutablecptrie_set(newData.mutableTrie, c, newValue, &errorCode);
}
}
}
@@ -2514,7 +2514,7 @@ UBool Normalizer2Impl::ensureCanonIterData(UErrorCode &errorCode) const {
}
int32_t Normalizer2Impl::getCanonValue(UChar32 c) const {
- return (int32_t)ucptrie_get(fCanonIterData->trie, c);
+ return (int32_t)ucptrie_get(fCanonIterData->trie, c);
}
const UnicodeSet &Normalizer2Impl::getCanonStartSet(int32_t n) const {
@@ -2538,7 +2538,7 @@ UBool Normalizer2Impl::getCanonStartSet(UChar32 c, UnicodeSet &set) const {
set.add(value);
}
if((canonValue&CANON_HAS_COMPOSITIONS)!=0) {
- uint16_t norm16=getRawNorm16(c);
+ uint16_t norm16=getRawNorm16(c);
if(norm16==JAMO_L) {
UChar32 syllable=
(UChar32)(Hangul::HANGUL_BASE+(c-Hangul::JAMO_L_BASE)*Hangul::JAMO_VT_COUNT);
@@ -2567,7 +2567,7 @@ unorm2_swap(const UDataSwapper *ds,
uint8_t *outBytes;
const int32_t *inIndexes;
- int32_t indexes[Normalizer2Impl::IX_TOTAL_SIZE+1];
+ int32_t indexes[Normalizer2Impl::IX_TOTAL_SIZE+1];
int32_t i, offset, nextOffset, size;
@@ -2579,13 +2579,13 @@ unorm2_swap(const UDataSwapper *ds,
/* check data format and format version */
pInfo=(const UDataInfo *)((const char *)inData+4);
- uint8_t formatVersion0=pInfo->formatVersion[0];
+ uint8_t formatVersion0=pInfo->formatVersion[0];
if(!(
pInfo->dataFormat[0]==0x4e && /* dataFormat="Nrm2" */
pInfo->dataFormat[1]==0x72 &&
pInfo->dataFormat[2]==0x6d &&
pInfo->dataFormat[3]==0x32 &&
- (1<=formatVersion0 && formatVersion0<=4)
+ (1<=formatVersion0 && formatVersion0<=4)
)) {
udata_printError(ds, "unorm2_swap(): data format %02x.%02x.%02x.%02x (format version %02x) is not recognized as Normalizer2 data\n",
pInfo->dataFormat[0], pInfo->dataFormat[1],
@@ -2599,18 +2599,18 @@ unorm2_swap(const UDataSwapper *ds,
outBytes=(uint8_t *)outData+headerSize;
inIndexes=(const int32_t *)inBytes;
- int32_t minIndexesLength;
- if(formatVersion0==1) {
- minIndexesLength=Normalizer2Impl::IX_MIN_MAYBE_YES+1;
- } else if(formatVersion0==2) {
- minIndexesLength=Normalizer2Impl::IX_MIN_YES_NO_MAPPINGS_ONLY+1;
- } else {
- minIndexesLength=Normalizer2Impl::IX_MIN_LCCC_CP+1;
- }
+ int32_t minIndexesLength;
+ if(formatVersion0==1) {
+ minIndexesLength=Normalizer2Impl::IX_MIN_MAYBE_YES+1;
+ } else if(formatVersion0==2) {
+ minIndexesLength=Normalizer2Impl::IX_MIN_YES_NO_MAPPINGS_ONLY+1;
+ } else {
+ minIndexesLength=Normalizer2Impl::IX_MIN_LCCC_CP+1;
+ }
if(length>=0) {
length-=headerSize;
- if(length<minIndexesLength*4) {
+ if(length<minIndexesLength*4) {
udata_printError(ds, "unorm2_swap(): too few bytes (%d after header) for Normalizer2 data\n",
length);
*pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
@@ -2619,7 +2619,7 @@ unorm2_swap(const UDataSwapper *ds,
}
/* read the first few indexes */
- for(i=0; i<UPRV_LENGTHOF(indexes); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(indexes); ++i) {
indexes[i]=udata_readInt32(ds, inIndexes[i]);
}
@@ -2646,9 +2646,9 @@ unorm2_swap(const UDataSwapper *ds,
ds->swapArray32(ds, inBytes, nextOffset-offset, outBytes, pErrorCode);
offset=nextOffset;
- /* swap the trie */
+ /* swap the trie */
nextOffset=indexes[Normalizer2Impl::IX_EXTRA_DATA_OFFSET];
- utrie_swapAnyVersion(ds, inBytes+offset, nextOffset-offset, outBytes+offset, pErrorCode);
+ utrie_swapAnyVersion(ds, inBytes+offset, nextOffset-offset, outBytes+offset, pErrorCode);
offset=nextOffset;
/* swap the uint16_t extraData[] */
diff --git a/contrib/libs/icu/common/normalizer2impl.h b/contrib/libs/icu/common/normalizer2impl.h
index a60fd9fef8..cf3015ea88 100644
--- a/contrib/libs/icu/common/normalizer2impl.h
+++ b/contrib/libs/icu/common/normalizer2impl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: normalizer2impl.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -24,30 +24,30 @@
#if !UCONFIG_NO_NORMALIZATION
#include "unicode/normalizer2.h"
-#include "unicode/ucptrie.h"
+#include "unicode/ucptrie.h"
#include "unicode/unistr.h"
#include "unicode/unorm.h"
-#include "unicode/utf.h"
+#include "unicode/utf.h"
#include "unicode/utf16.h"
#include "mutex.h"
-#include "udataswp.h"
+#include "udataswp.h"
#include "uset_imp.h"
-// When the nfc.nrm data is *not* hardcoded into the common library
-// (with this constant set to 0),
-// then it needs to be built into the data package:
-// Add nfc.nrm to icu4c/source/data/Makefile.in DAT_FILES_SHORT
-#define NORM2_HARDCODE_NFC_DATA 1
-
+// When the nfc.nrm data is *not* hardcoded into the common library
+// (with this constant set to 0),
+// then it needs to be built into the data package:
+// Add nfc.nrm to icu4c/source/data/Makefile.in DAT_FILES_SHORT
+#define NORM2_HARDCODE_NFC_DATA 1
+
U_NAMESPACE_BEGIN
struct CanonIterData;
-class ByteSink;
-class Edits;
-class InitCanonIterData;
-class LcccContext;
-
+class ByteSink;
+class Edits;
+class InitCanonIterData;
+class LcccContext;
+
class U_COMMON_API Hangul {
public:
/* Korean Hangul and Jamo constants */
@@ -76,9 +76,9 @@ public:
return HANGUL_BASE<=c && c<HANGUL_LIMIT;
}
static inline UBool
- isHangulLV(UChar32 c) {
+ isHangulLV(UChar32 c) {
c-=HANGUL_BASE;
- return 0<=c && c<HANGUL_COUNT && c%JAMO_T_COUNT==0;
+ return 0<=c && c<HANGUL_COUNT && c%JAMO_T_COUNT==0;
}
static inline UBool isJamoL(UChar32 c) {
return (uint32_t)(c-JAMO_L_BASE)<JAMO_L_COUNT;
@@ -86,14 +86,14 @@ public:
static inline UBool isJamoV(UChar32 c) {
return (uint32_t)(c-JAMO_V_BASE)<JAMO_V_COUNT;
}
- static inline UBool isJamoT(UChar32 c) {
- int32_t t=c-JAMO_T_BASE;
- return 0<t && t<JAMO_T_COUNT; // not JAMO_T_BASE itself
- }
- static UBool isJamo(UChar32 c) {
- return JAMO_L_BASE<=c && c<=JAMO_T_END &&
- (c<=JAMO_L_END || (JAMO_V_BASE<=c && c<=JAMO_V_END) || JAMO_T_BASE<c);
- }
+ static inline UBool isJamoT(UChar32 c) {
+ int32_t t=c-JAMO_T_BASE;
+ return 0<t && t<JAMO_T_COUNT; // not JAMO_T_BASE itself
+ }
+ static UBool isJamo(UChar32 c) {
+ return JAMO_L_BASE<=c && c<=JAMO_T_END &&
+ (c<=JAMO_L_END || (JAMO_V_BASE<=c && c<=JAMO_V_END) || JAMO_T_BASE<c);
+ }
/**
* Decomposes c, which must be a Hangul syllable, into buffer
@@ -126,7 +126,7 @@ public:
buffer[0]=(UChar)(JAMO_L_BASE+c/JAMO_V_COUNT);
buffer[1]=(UChar)(JAMO_V_BASE+c%JAMO_V_COUNT);
} else {
- buffer[0]=(UChar)(orig-c2); // LV syllable
+ buffer[0]=(UChar)(orig-c2); // LV syllable
buffer[1]=(UChar)(JAMO_T_BASE+c2);
}
}
@@ -138,13 +138,13 @@ class Normalizer2Impl;
class U_COMMON_API ReorderingBuffer : public UMemory {
public:
- /** Constructs only; init() should be called. */
+ /** Constructs only; init() should be called. */
ReorderingBuffer(const Normalizer2Impl &ni, UnicodeString &dest) :
impl(ni), str(dest),
start(NULL), reorderStart(NULL), limit(NULL),
remainingCapacity(0), lastCC(0) {}
- /** Constructs, removes the string contents, and initializes for a small initial capacity. */
- ReorderingBuffer(const Normalizer2Impl &ni, UnicodeString &dest, UErrorCode &errorCode);
+ /** Constructs, removes the string contents, and initializes for a small initial capacity. */
+ ReorderingBuffer(const Normalizer2Impl &ni, UnicodeString &dest, UErrorCode &errorCode);
~ReorderingBuffer() {
if(start!=NULL) {
str.releaseBuffer((int32_t)(limit-start));
@@ -159,14 +159,14 @@ public:
uint8_t getLastCC() const { return lastCC; }
UBool equals(const UChar *start, const UChar *limit) const;
- UBool equals(const uint8_t *otherStart, const uint8_t *otherLimit) const;
+ UBool equals(const uint8_t *otherStart, const uint8_t *otherLimit) const;
UBool append(UChar32 c, uint8_t cc, UErrorCode &errorCode) {
return (c<=0xffff) ?
appendBMP((UChar)c, cc, errorCode) :
appendSupplementary(c, cc, errorCode);
}
- UBool append(const UChar *s, int32_t length, UBool isNFD,
+ UBool append(const UChar *s, int32_t length, UBool isNFD,
uint8_t leadCC, uint8_t trailCC,
UErrorCode &errorCode);
UBool appendBMP(UChar c, uint8_t cc, UErrorCode &errorCode) {
@@ -195,7 +195,7 @@ public:
lastCC=0;
}
void copyReorderableSuffixTo(UnicodeString &s) const {
- s.setTo(ConstChar16Ptr(reorderStart), (int32_t)(limit-reorderStart));
+ s.setTo(ConstChar16Ptr(reorderStart), (int32_t)(limit-reorderStart));
}
private:
/*
@@ -237,18 +237,18 @@ private:
UChar *codePointStart, *codePointLimit;
};
-/**
- * Low-level implementation of the Unicode Normalization Algorithm.
- * For the data structure and details see the documentation at the end of
- * this normalizer2impl.h and in the design doc at
- * http://site.icu-project.org/design/normalization/custom
- */
+/**
+ * Low-level implementation of the Unicode Normalization Algorithm.
+ * For the data structure and details see the documentation at the end of
+ * this normalizer2impl.h and in the design doc at
+ * http://site.icu-project.org/design/normalization/custom
+ */
class U_COMMON_API Normalizer2Impl : public UObject {
public:
- Normalizer2Impl() : normTrie(NULL), fCanonIterData(NULL) { }
+ Normalizer2Impl() : normTrie(NULL), fCanonIterData(NULL) { }
virtual ~Normalizer2Impl();
- void init(const int32_t *inIndexes, const UCPTrie *inTrie,
+ void init(const int32_t *inIndexes, const UCPTrie *inTrie,
const uint16_t *inExtraData, const uint8_t *inSmallFCD);
void addLcccChars(UnicodeSet &set) const;
@@ -259,14 +259,14 @@ public:
UBool ensureCanonIterData(UErrorCode &errorCode) const;
- // The trie stores values for lead surrogate code *units*.
- // Surrogate code *points* are inert.
- uint16_t getNorm16(UChar32 c) const {
- return U_IS_LEAD(c) ?
- static_cast<uint16_t>(INERT) :
- UCPTRIE_FAST_GET(normTrie, UCPTRIE_16, c);
- }
- uint16_t getRawNorm16(UChar32 c) const { return UCPTRIE_FAST_GET(normTrie, UCPTRIE_16, c); }
+ // The trie stores values for lead surrogate code *units*.
+ // Surrogate code *points* are inert.
+ uint16_t getNorm16(UChar32 c) const {
+ return U_IS_LEAD(c) ?
+ static_cast<uint16_t>(INERT) :
+ UCPTRIE_FAST_GET(normTrie, UCPTRIE_16, c);
+ }
+ uint16_t getRawNorm16(UChar32 c) const { return UCPTRIE_FAST_GET(normTrie, UCPTRIE_16, c); }
UNormalizationCheckResult getCompQuickCheck(uint16_t norm16) const {
if(norm16<minNoNo || MIN_YES_YES_WITH_CC<=norm16) {
@@ -283,23 +283,23 @@ public:
uint8_t getCC(uint16_t norm16) const {
if(norm16>=MIN_NORMAL_MAYBE_YES) {
- return getCCFromNormalYesOrMaybe(norm16);
+ return getCCFromNormalYesOrMaybe(norm16);
}
if(norm16<minNoNo || limitNoNo<=norm16) {
return 0;
}
return getCCFromNoNo(norm16);
}
- static uint8_t getCCFromNormalYesOrMaybe(uint16_t norm16) {
- return (uint8_t)(norm16 >> OFFSET_SHIFT);
- }
+ static uint8_t getCCFromNormalYesOrMaybe(uint16_t norm16) {
+ return (uint8_t)(norm16 >> OFFSET_SHIFT);
+ }
static uint8_t getCCFromYesOrMaybe(uint16_t norm16) {
- return norm16>=MIN_NORMAL_MAYBE_YES ? getCCFromNormalYesOrMaybe(norm16) : 0;
+ return norm16>=MIN_NORMAL_MAYBE_YES ? getCCFromNormalYesOrMaybe(norm16) : 0;
+ }
+ uint8_t getCCFromYesOrMaybeCP(UChar32 c) const {
+ if (c < minCompNoMaybeCP) { return 0; }
+ return getCCFromYesOrMaybe(getNorm16(c));
}
- uint8_t getCCFromYesOrMaybeCP(UChar32 c) const {
- if (c < minCompNoMaybeCP) { return 0; }
- return getCCFromYesOrMaybe(getNorm16(c));
- }
/**
* Returns the FCD data for code point c.
@@ -307,7 +307,7 @@ public:
* @return The lccc(c) in bits 15..8 and tccc(c) in bits 7..0.
*/
uint16_t getFCD16(UChar32 c) const {
- if(c<minDecompNoCP) {
+ if(c<minDecompNoCP) {
return 0;
} else if(c<=0xffff) {
if(!singleLeadMightHaveNonZeroFCD16(c)) { return 0; }
@@ -324,7 +324,7 @@ public:
*/
uint16_t nextFCD16(const UChar *&s, const UChar *limit) const {
UChar32 c=*s++;
- if(c<minDecompNoCP || !singleLeadMightHaveNonZeroFCD16(c)) {
+ if(c<minDecompNoCP || !singleLeadMightHaveNonZeroFCD16(c)) {
return 0;
}
UChar c2;
@@ -342,8 +342,8 @@ public:
*/
uint16_t previousFCD16(const UChar *start, const UChar *&s) const {
UChar32 c=*--s;
- if(c<minDecompNoCP) {
- return 0;
+ if(c<minDecompNoCP) {
+ return 0;
}
if(!U16_IS_TRAIL(c)) {
if(!singleLeadMightHaveNonZeroFCD16(c)) {
@@ -393,25 +393,25 @@ public:
UBool getCanonStartSet(UChar32 c, UnicodeSet &set) const;
enum {
- // Fixed norm16 values.
- 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
-
- // norm16 bit 0 is comp-boundary-after.
- HAS_COMP_BOUNDARY_AFTER=1,
- OFFSET_SHIFT=1,
-
- // For algorithmic one-way mappings, norm16 bits 2..1 indicate the
- // tccc (0, 1, >1) for quick FCC boundary-after tests.
- DELTA_TCCC_0=0,
- DELTA_TCCC_1=2,
- DELTA_TCCC_GT_1=4,
- DELTA_TCCC_MASK=6,
- DELTA_SHIFT=3,
-
+ // Fixed norm16 values.
+ 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
+
+ // norm16 bit 0 is comp-boundary-after.
+ HAS_COMP_BOUNDARY_AFTER=1,
+ OFFSET_SHIFT=1,
+
+ // For algorithmic one-way mappings, norm16 bits 2..1 indicate the
+ // tccc (0, 1, >1) for quick FCC boundary-after tests.
+ DELTA_TCCC_0=0,
+ DELTA_TCCC_1=2,
+ DELTA_TCCC_GT_1=4,
+ DELTA_TCCC_MASK=6,
+ DELTA_SHIFT=3,
+
MAX_DELTA=0x40
};
@@ -431,32 +431,32 @@ public:
IX_MIN_COMP_NO_MAYBE_CP,
// Norm16 value thresholds for quick check combinations and types of extra data.
-
- /** Mappings & compositions in [minYesNo..minYesNoMappingsOnly[. */
- IX_MIN_YES_NO,
- /** Mappings are comp-normalized. */
+
+ /** Mappings & compositions in [minYesNo..minYesNoMappingsOnly[. */
+ IX_MIN_YES_NO,
+ /** Mappings are comp-normalized. */
IX_MIN_NO_NO,
IX_LIMIT_NO_NO,
IX_MIN_MAYBE_YES,
- /** Mappings only in [minYesNoMappingsOnly..minNoNo[. */
- IX_MIN_YES_NO_MAPPINGS_ONLY,
- /** Mappings are not comp-normalized but have a comp boundary before. */
- IX_MIN_NO_NO_COMP_BOUNDARY_BEFORE,
- /** Mappings do not have a comp boundary before. */
- IX_MIN_NO_NO_COMP_NO_MAYBE_CC,
- /** Mappings to the empty string. */
- IX_MIN_NO_NO_EMPTY,
-
- IX_MIN_LCCC_CP,
- IX_RESERVED19,
+ /** Mappings only in [minYesNoMappingsOnly..minNoNo[. */
+ IX_MIN_YES_NO_MAPPINGS_ONLY,
+ /** Mappings are not comp-normalized but have a comp boundary before. */
+ IX_MIN_NO_NO_COMP_BOUNDARY_BEFORE,
+ /** Mappings do not have a comp boundary before. */
+ IX_MIN_NO_NO_COMP_NO_MAYBE_CC,
+ /** Mappings to the empty string. */
+ IX_MIN_NO_NO_EMPTY,
+
+ IX_MIN_LCCC_CP,
+ IX_RESERVED19,
IX_COUNT
};
enum {
MAPPING_HAS_CCC_LCCC_WORD=0x80,
MAPPING_HAS_RAW_MAPPING=0x40,
- // unused bit 0x20,
+ // unused bit 0x20,
MAPPING_LENGTH_MASK=0x1f
};
@@ -505,12 +505,12 @@ public:
UnicodeString &safeMiddle,
ReorderingBuffer &buffer,
UErrorCode &errorCode) const;
-
- /** sink==nullptr: isNormalized() */
- UBool composeUTF8(uint32_t options, UBool onlyContiguous,
- const uint8_t *src, const uint8_t *limit,
- ByteSink *sink, icu::Edits *edits, UErrorCode &errorCode) const;
-
+
+ /** sink==nullptr: isNormalized() */
+ UBool composeUTF8(uint32_t options, UBool onlyContiguous,
+ const uint8_t *src, const uint8_t *limit,
+ ByteSink *sink, icu::Edits *edits, UErrorCode &errorCode) const;
+
const UChar *makeFCD(const UChar *src, const UChar *limit,
ReorderingBuffer *buffer, UErrorCode &errorCode) const;
void makeFCDAndAppend(const UChar *src, const UChar *limit,
@@ -519,42 +519,42 @@ public:
ReorderingBuffer &buffer,
UErrorCode &errorCode) const;
- UBool hasDecompBoundaryBefore(UChar32 c) const;
- UBool norm16HasDecompBoundaryBefore(uint16_t norm16) const;
- UBool hasDecompBoundaryAfter(UChar32 c) const;
- UBool norm16HasDecompBoundaryAfter(uint16_t norm16) const;
+ UBool hasDecompBoundaryBefore(UChar32 c) const;
+ UBool norm16HasDecompBoundaryBefore(uint16_t norm16) const;
+ UBool hasDecompBoundaryAfter(UChar32 c) const;
+ UBool norm16HasDecompBoundaryAfter(uint16_t norm16) const;
UBool isDecompInert(UChar32 c) const { return isDecompYesAndZeroCC(getNorm16(c)); }
UBool hasCompBoundaryBefore(UChar32 c) const {
- return c<minCompNoMaybeCP || norm16HasCompBoundaryBefore(getNorm16(c));
- }
- UBool hasCompBoundaryAfter(UChar32 c, UBool onlyContiguous) const {
- return norm16HasCompBoundaryAfter(getNorm16(c), onlyContiguous);
- }
- UBool isCompInert(UChar32 c, UBool onlyContiguous) const {
- uint16_t norm16=getNorm16(c);
- return isCompYesAndZeroCC(norm16) &&
- (norm16 & HAS_COMP_BOUNDARY_AFTER) != 0 &&
- (!onlyContiguous || isInert(norm16) || *getMapping(norm16) <= 0x1ff);
- }
-
- UBool hasFCDBoundaryBefore(UChar32 c) const { return hasDecompBoundaryBefore(c); }
- UBool hasFCDBoundaryAfter(UChar32 c) const { return hasDecompBoundaryAfter(c); }
+ return c<minCompNoMaybeCP || norm16HasCompBoundaryBefore(getNorm16(c));
+ }
+ UBool hasCompBoundaryAfter(UChar32 c, UBool onlyContiguous) const {
+ return norm16HasCompBoundaryAfter(getNorm16(c), onlyContiguous);
+ }
+ UBool isCompInert(UChar32 c, UBool onlyContiguous) const {
+ uint16_t norm16=getNorm16(c);
+ return isCompYesAndZeroCC(norm16) &&
+ (norm16 & HAS_COMP_BOUNDARY_AFTER) != 0 &&
+ (!onlyContiguous || isInert(norm16) || *getMapping(norm16) <= 0x1ff);
+ }
+
+ UBool hasFCDBoundaryBefore(UChar32 c) const { return hasDecompBoundaryBefore(c); }
+ UBool hasFCDBoundaryAfter(UChar32 c) const { return hasDecompBoundaryAfter(c); }
UBool isFCDInert(UChar32 c) const { return getFCD16(c)<=1; }
private:
- friend class InitCanonIterData;
- friend class LcccContext;
-
+ friend class InitCanonIterData;
+ friend class LcccContext;
+
UBool isMaybe(uint16_t norm16) const { return minMaybeYes<=norm16 && norm16<=JAMO_VT; }
UBool isMaybeOrNonZeroCC(uint16_t norm16) const { return norm16>=minMaybeYes; }
- static UBool isInert(uint16_t norm16) { return norm16==INERT; }
- static UBool isJamoL(uint16_t norm16) { return norm16==JAMO_L; }
+ static UBool isInert(uint16_t norm16) { return norm16==INERT; }
+ static UBool isJamoL(uint16_t norm16) { return norm16==JAMO_L; }
static UBool isJamoVT(uint16_t norm16) { return norm16==JAMO_VT; }
- uint16_t hangulLVT() const { return minYesNoMappingsOnly|HAS_COMP_BOUNDARY_AFTER; }
- UBool isHangulLV(uint16_t norm16) const { return norm16==minYesNo; }
- UBool isHangulLVT(uint16_t norm16) const {
- return norm16==hangulLVT();
- }
+ uint16_t hangulLVT() const { return minYesNoMappingsOnly|HAS_COMP_BOUNDARY_AFTER; }
+ UBool isHangulLV(uint16_t norm16) const { return norm16==minYesNo; }
+ UBool isHangulLVT(uint16_t norm16) const {
+ return norm16==hangulLVT();
+ }
UBool isCompYesAndZeroCC(uint16_t norm16) const { return norm16<minNoNo; }
// UBool isCompYes(uint16_t norm16) const {
// return norm16>=MIN_YES_YES_WITH_CC || norm16<minNoNo;
@@ -573,7 +573,7 @@ private:
/**
* A little faster and simpler than isDecompYesAndZeroCC() but does not include
* the MaybeYes which combine-forward and have ccc=0.
- * (Standard Unicode 10 normalization does not have such characters.)
+ * (Standard Unicode 10 normalization does not have such characters.)
*/
UBool isMostDecompYesAndZeroCC(uint16_t norm16) const {
return norm16<minYesNo || norm16==MIN_NORMAL_MAYBE_YES || norm16==JAMO_VT;
@@ -583,7 +583,7 @@ private:
// For use with isCompYes().
// Perhaps the compiler can combine the two tests for MIN_YES_YES_WITH_CC.
// static uint8_t getCCFromYes(uint16_t norm16) {
- // return norm16>=MIN_YES_YES_WITH_CC ? getCCFromNormalYesOrMaybe(norm16) : 0;
+ // return norm16>=MIN_YES_YES_WITH_CC ? getCCFromNormalYesOrMaybe(norm16) : 0;
// }
uint8_t getCCFromNoNo(uint16_t norm16) const {
const uint16_t *mapping=getMapping(norm16);
@@ -594,47 +594,47 @@ private:
}
}
// requires that the [cpStart..cpLimit[ character passes isCompYesAndZeroCC()
- uint8_t getTrailCCFromCompYesAndZeroCC(uint16_t norm16) const {
- if(norm16<=minYesNo) {
- return 0; // yesYes and Hangul LV have ccc=tccc=0
- } else {
- // For Hangul LVT we harmlessly fetch a firstUnit with tccc=0 here.
- return (uint8_t)(*getMapping(norm16)>>8); // tccc from yesNo
- }
- }
- uint8_t getPreviousTrailCC(const UChar *start, const UChar *p) const;
- uint8_t getPreviousTrailCC(const uint8_t *start, const uint8_t *p) const;
+ uint8_t getTrailCCFromCompYesAndZeroCC(uint16_t norm16) const {
+ if(norm16<=minYesNo) {
+ return 0; // yesYes and Hangul LV have ccc=tccc=0
+ } else {
+ // For Hangul LVT we harmlessly fetch a firstUnit with tccc=0 here.
+ return (uint8_t)(*getMapping(norm16)>>8); // tccc from yesNo
+ }
+ }
+ uint8_t getPreviousTrailCC(const UChar *start, const UChar *p) const;
+ uint8_t getPreviousTrailCC(const uint8_t *start, const uint8_t *p) const;
// Requires algorithmic-NoNo.
UChar32 mapAlgorithmic(UChar32 c, uint16_t norm16) const {
- return c+(norm16>>DELTA_SHIFT)-centerNoNoDelta;
+ return c+(norm16>>DELTA_SHIFT)-centerNoNoDelta;
+ }
+ UChar32 getAlgorithmicDelta(uint16_t norm16) const {
+ return (norm16>>DELTA_SHIFT)-centerNoNoDelta;
}
- UChar32 getAlgorithmicDelta(uint16_t norm16) const {
- return (norm16>>DELTA_SHIFT)-centerNoNoDelta;
- }
// Requires minYesNo<norm16<limitNoNo.
- const uint16_t *getMapping(uint16_t norm16) const { return extraData+(norm16>>OFFSET_SHIFT); }
+ const uint16_t *getMapping(uint16_t norm16) const { return extraData+(norm16>>OFFSET_SHIFT); }
const uint16_t *getCompositionsListForDecompYes(uint16_t norm16) const {
- if(norm16<JAMO_L || MIN_NORMAL_MAYBE_YES<=norm16) {
+ if(norm16<JAMO_L || MIN_NORMAL_MAYBE_YES<=norm16) {
return NULL;
} else if(norm16<minMaybeYes) {
- return getMapping(norm16); // for yesYes; if Jamo L: harmless empty list
+ return getMapping(norm16); // for yesYes; if Jamo L: harmless empty list
} else {
return maybeYesCompositions+norm16-minMaybeYes;
}
}
const uint16_t *getCompositionsListForComposite(uint16_t norm16) const {
- // A composite has both mapping & compositions list.
- const uint16_t *list=getMapping(norm16);
+ // A composite has both mapping & compositions list.
+ const uint16_t *list=getMapping(norm16);
return list+ // mapping pointer
- 1+ // +1 to skip the first unit with the mapping length
+ 1+ // +1 to skip the first unit with the mapping length
(*list&MAPPING_LENGTH_MASK); // + mapping length
}
- const uint16_t *getCompositionsListForMaybe(uint16_t norm16) const {
- // minMaybeYes<=norm16<MIN_NORMAL_MAYBE_YES
- return maybeYesCompositions+((norm16-minMaybeYes)>>OFFSET_SHIFT);
- }
+ const uint16_t *getCompositionsListForMaybe(uint16_t norm16) const {
+ // minMaybeYes<=norm16<MIN_NORMAL_MAYBE_YES
+ return maybeYesCompositions+((norm16-minMaybeYes)>>OFFSET_SHIFT);
+ }
/**
* @param c code point must have compositions
* @return compositions list pointer
@@ -649,79 +649,79 @@ private:
UChar32 minNeedDataCP,
ReorderingBuffer *buffer,
UErrorCode &errorCode) const;
- const UChar *decomposeShort(const UChar *src, const UChar *limit,
- UBool stopAtCompBoundary, UBool onlyContiguous,
- ReorderingBuffer &buffer, UErrorCode &errorCode) const;
+ const UChar *decomposeShort(const UChar *src, const UChar *limit,
+ UBool stopAtCompBoundary, UBool onlyContiguous,
+ ReorderingBuffer &buffer, UErrorCode &errorCode) const;
UBool decompose(UChar32 c, uint16_t norm16,
ReorderingBuffer &buffer, UErrorCode &errorCode) const;
- const uint8_t *decomposeShort(const uint8_t *src, const uint8_t *limit,
- UBool stopAtCompBoundary, UBool onlyContiguous,
- ReorderingBuffer &buffer, UErrorCode &errorCode) const;
-
+ const uint8_t *decomposeShort(const uint8_t *src, const uint8_t *limit,
+ UBool stopAtCompBoundary, UBool onlyContiguous,
+ ReorderingBuffer &buffer, UErrorCode &errorCode) const;
+
static int32_t combine(const uint16_t *list, UChar32 trail);
void addComposites(const uint16_t *list, UnicodeSet &set) const;
void recompose(ReorderingBuffer &buffer, int32_t recomposeStartIndex,
UBool onlyContiguous) const;
- UBool hasCompBoundaryBefore(UChar32 c, uint16_t norm16) const {
- return c<minCompNoMaybeCP || norm16HasCompBoundaryBefore(norm16);
- }
- UBool norm16HasCompBoundaryBefore(uint16_t norm16) const {
- return norm16 < minNoNoCompNoMaybeCC || isAlgorithmicNoNo(norm16);
- }
- UBool hasCompBoundaryBefore(const UChar *src, const UChar *limit) const;
- UBool hasCompBoundaryBefore(const uint8_t *src, const uint8_t *limit) const;
- UBool hasCompBoundaryAfter(const UChar *start, const UChar *p,
- UBool onlyContiguous) const;
- UBool hasCompBoundaryAfter(const uint8_t *start, const uint8_t *p,
- UBool onlyContiguous) const;
- UBool norm16HasCompBoundaryAfter(uint16_t norm16, UBool onlyContiguous) const {
- return (norm16 & HAS_COMP_BOUNDARY_AFTER) != 0 &&
- (!onlyContiguous || isTrailCC01ForCompBoundaryAfter(norm16));
- }
- /** For FCC: Given norm16 HAS_COMP_BOUNDARY_AFTER, does it have tccc<=1? */
- UBool isTrailCC01ForCompBoundaryAfter(uint16_t norm16) const {
- return isInert(norm16) || (isDecompNoAlgorithmic(norm16) ?
- (norm16 & DELTA_TCCC_MASK) <= DELTA_TCCC_1 : *getMapping(norm16) <= 0x1ff);
- }
-
- const UChar *findPreviousCompBoundary(const UChar *start, const UChar *p, UBool onlyContiguous) const;
- const UChar *findNextCompBoundary(const UChar *p, const UChar *limit, UBool onlyContiguous) const;
-
+ UBool hasCompBoundaryBefore(UChar32 c, uint16_t norm16) const {
+ return c<minCompNoMaybeCP || norm16HasCompBoundaryBefore(norm16);
+ }
+ UBool norm16HasCompBoundaryBefore(uint16_t norm16) const {
+ return norm16 < minNoNoCompNoMaybeCC || isAlgorithmicNoNo(norm16);
+ }
+ UBool hasCompBoundaryBefore(const UChar *src, const UChar *limit) const;
+ UBool hasCompBoundaryBefore(const uint8_t *src, const uint8_t *limit) const;
+ UBool hasCompBoundaryAfter(const UChar *start, const UChar *p,
+ UBool onlyContiguous) const;
+ UBool hasCompBoundaryAfter(const uint8_t *start, const uint8_t *p,
+ UBool onlyContiguous) const;
+ UBool norm16HasCompBoundaryAfter(uint16_t norm16, UBool onlyContiguous) const {
+ return (norm16 & HAS_COMP_BOUNDARY_AFTER) != 0 &&
+ (!onlyContiguous || isTrailCC01ForCompBoundaryAfter(norm16));
+ }
+ /** For FCC: Given norm16 HAS_COMP_BOUNDARY_AFTER, does it have tccc<=1? */
+ UBool isTrailCC01ForCompBoundaryAfter(uint16_t norm16) const {
+ return isInert(norm16) || (isDecompNoAlgorithmic(norm16) ?
+ (norm16 & DELTA_TCCC_MASK) <= DELTA_TCCC_1 : *getMapping(norm16) <= 0x1ff);
+ }
+
+ const UChar *findPreviousCompBoundary(const UChar *start, const UChar *p, UBool onlyContiguous) const;
+ const UChar *findNextCompBoundary(const UChar *p, const UChar *limit, UBool onlyContiguous) const;
+
const UChar *findPreviousFCDBoundary(const UChar *start, const UChar *p) const;
const UChar *findNextFCDBoundary(const UChar *p, const UChar *limit) const;
- void makeCanonIterDataFromNorm16(UChar32 start, UChar32 end, const uint16_t norm16,
- CanonIterData &newData, UErrorCode &errorCode) const;
-
+ void makeCanonIterDataFromNorm16(UChar32 start, UChar32 end, const uint16_t norm16,
+ CanonIterData &newData, UErrorCode &errorCode) const;
+
int32_t getCanonValue(UChar32 c) const;
const UnicodeSet &getCanonStartSet(int32_t n) const;
// UVersionInfo dataVersion;
- // BMP code point thresholds for quick check loops looking at single UTF-16 code units.
- UChar minDecompNoCP;
- UChar minCompNoMaybeCP;
- UChar minLcccCP;
+ // BMP code point thresholds for quick check loops looking at single UTF-16 code units.
+ UChar minDecompNoCP;
+ UChar minCompNoMaybeCP;
+ UChar minLcccCP;
// Norm16 value thresholds for quick check combinations and types of extra data.
uint16_t minYesNo;
uint16_t minYesNoMappingsOnly;
uint16_t minNoNo;
- uint16_t minNoNoCompBoundaryBefore;
- uint16_t minNoNoCompNoMaybeCC;
- uint16_t minNoNoEmpty;
+ uint16_t minNoNoCompBoundaryBefore;
+ uint16_t minNoNoCompNoMaybeCC;
+ uint16_t minNoNoEmpty;
uint16_t limitNoNo;
- uint16_t centerNoNoDelta;
+ uint16_t centerNoNoDelta;
uint16_t minMaybeYes;
- const UCPTrie *normTrie;
+ const UCPTrie *normTrie;
const uint16_t *maybeYesCompositions;
const uint16_t *extraData; // mappings and/or compositions for yesYes, yesNo & noNo characters
const uint8_t *smallFCD; // [0x100] one bit per 32 BMP code points, set if any FCD!=0
- UInitOnce fCanonIterDataInitOnce = U_INITONCE_INITIALIZER;
+ UInitOnce fCanonIterDataInitOnce = U_INITONCE_INITIALIZER;
CanonIterData *fCanonIterData;
};
@@ -776,14 +776,14 @@ unorm_getFCD16(UChar32 c);
/**
* Format of Normalizer2 .nrm data files.
- * Format version 4.0.
+ * Format version 4.0.
*
* Normalizer2 .nrm data files provide data for the Unicode Normalization algorithms.
* ICU ships with data files for standard Unicode Normalization Forms
* NFC and NFD (nfc.nrm), NFKC and NFKD (nfkc.nrm) and NFKC_Casefold (nfkc_cf.nrm).
* Custom (application-specific) data can be built into additional .nrm files
* with the gennorm2 build tool.
- * ICU ships with one such file, uts46.nrm, for the implementation of UTS #46.
+ * ICU ships with one such file, uts46.nrm, for the implementation of UTS #46.
*
* Normalizer2.getInstance() causes a .nrm file to be loaded, unless it has been
* cached already. Internally, Normalizer2Impl.load() reads the .nrm file.
@@ -814,35 +814,35 @@ unorm_getFCD16(UChar32 c);
* with a decomposition mapping, that is, with NF*D_QC=No.
* minCompNoMaybeCP=indexes[IX_MIN_COMP_NO_MAYBE_CP] is the lowest code point
* with NF*C_QC=No (has a one-way mapping) or Maybe (combines backward).
- * minLcccCP=indexes[IX_MIN_LCCC_CP] (index 18, new in formatVersion 3)
- * is the lowest code point with lccc!=0.
+ * minLcccCP=indexes[IX_MIN_LCCC_CP] (index 18, new in formatVersion 3)
+ * is the lowest code point with lccc!=0.
*
- * The next eight indexes are thresholds of 16-bit trie values for ranges of
+ * The next eight indexes are thresholds of 16-bit trie values for ranges of
* values indicating multiple normalization properties.
- * They are listed here in threshold order, not in the order they are stored in the indexes.
+ * They are listed here in threshold order, not in the order they are stored in the indexes.
* minYesNo=indexes[IX_MIN_YES_NO];
- * minYesNoMappingsOnly=indexes[IX_MIN_YES_NO_MAPPINGS_ONLY];
+ * minYesNoMappingsOnly=indexes[IX_MIN_YES_NO_MAPPINGS_ONLY];
* minNoNo=indexes[IX_MIN_NO_NO];
- * minNoNoCompBoundaryBefore=indexes[IX_MIN_NO_NO_COMP_BOUNDARY_BEFORE];
- * minNoNoCompNoMaybeCC=indexes[IX_MIN_NO_NO_COMP_NO_MAYBE_CC];
- * minNoNoEmpty=indexes[IX_MIN_NO_NO_EMPTY];
+ * minNoNoCompBoundaryBefore=indexes[IX_MIN_NO_NO_COMP_BOUNDARY_BEFORE];
+ * minNoNoCompNoMaybeCC=indexes[IX_MIN_NO_NO_COMP_NO_MAYBE_CC];
+ * minNoNoEmpty=indexes[IX_MIN_NO_NO_EMPTY];
* limitNoNo=indexes[IX_LIMIT_NO_NO];
* minMaybeYes=indexes[IX_MIN_MAYBE_YES];
* See the normTrie description below and the design doc for details.
*
- * UCPTrie normTrie; -- see ucptrie_impl.h and ucptrie.h, same as Java CodePointTrie
+ * UCPTrie normTrie; -- see ucptrie_impl.h and ucptrie.h, same as Java CodePointTrie
*
* The trie holds the main normalization data. Each code point is mapped to a 16-bit value.
* Rather than using independent bits in the value (which would require more than 16 bits),
* information is extracted primarily via range checks.
- * Except, format version 3 uses bit 0 for hasCompBoundaryAfter().
+ * Except, format version 3 uses bit 0 for hasCompBoundaryAfter().
* For example, a 16-bit value norm16 in the range minYesNo<=norm16<minNoNo
* means that the character has NF*C_QC=Yes and NF*D_QC=No properties,
* which means it has a two-way (round-trip) decomposition mapping.
* Values in the range 2<=norm16<limitNoNo are also directly indexes into the extraData
* pointing to mappings, compositions lists, or both.
- * Value norm16==INERT (0 in versions 1 & 2, 1 in version 3)
- * means that the character is normalization-inert, that is,
+ * Value norm16==INERT (0 in versions 1 & 2, 1 in version 3)
+ * means that the character is normalization-inert, that is,
* it does not have a mapping, does not participate in composition, has a zero
* canonical combining class, and forms a boundary where text before it and after it
* can be normalized independently.
@@ -856,7 +856,7 @@ unorm_getFCD16(UChar32 c);
* The trie has a value for each lead surrogate code unit representing the "worst case"
* properties of the 1024 supplementary characters whose UTF-16 form starts with
* the lead surrogate. If all of the 1024 supplementary characters are normalization-inert,
- * then their lead surrogate code unit has the trie value INERT.
+ * then their lead surrogate code unit has the trie value INERT.
* When the lead surrogate unit's value exceeds the quick check minimum during processing,
* the properties for the full supplementary code point need to be looked up.
*
@@ -865,7 +865,7 @@ unorm_getFCD16(UChar32 c);
*
* There is only one byte offset for the end of these two arrays.
* The split between them is given by the constant and variable mentioned above.
- * In version 3, the difference must be shifted right by OFFSET_SHIFT.
+ * In version 3, the difference must be shifted right by OFFSET_SHIFT.
*
* The maybeYesCompositions array contains compositions lists for characters that
* combine both forward (as starters in composition pairs)
@@ -882,8 +882,8 @@ unorm_getFCD16(UChar32 c);
* followed by only mappings for "NoNo" characters.
* (Referring to pairs of NFC/NFD quick check values.)
* The norm16 values of those characters are directly indexes into the extraData array.
- * In version 3, the norm16 values must be shifted right by OFFSET_SHIFT
- * for accessing extraData.
+ * In version 3, the norm16 values must be shifted right by OFFSET_SHIFT
+ * for accessing extraData.
*
* The data structures for compositions lists and mappings are described in the design doc.
*
@@ -914,64 +914,64 @@ unorm_getFCD16(UChar32 c);
* This is fully equivalent with formatVersion 1's MAPPING_PLUS_COMPOSITION_LIST flag.
* It is needed for the new (in ICU 49) composePair(), not for other normalization.
* - Addition of the smallFCD[] bit set.
- *
- * Changes from format version 2 to format version 3 (ICU 60) ------------------
- *
- * - norm16 bit 0 indicates hasCompBoundaryAfter(),
- * except that for contiguous composition (FCC) the tccc must be checked as well.
- * Data indexes and ccc values are shifted left by one (OFFSET_SHIFT).
- * Thresholds like minNoNo are tested before shifting.
- *
- * - Algorithmic mapping deltas are shifted left by two more bits (total DELTA_SHIFT),
- * to make room for two bits (three values) indicating whether the tccc is 0, 1, or greater.
- * See DELTA_TCCC_MASK etc.
- * This helps with fetching tccc/FCD values and FCC hasCompBoundaryAfter().
- * minMaybeYes is 8-aligned so that the DELTA_TCCC_MASK bits can be tested directly.
- *
- * - Algorithmic mappings are only used for mapping to "comp yes and ccc=0" characters,
- * and ASCII characters are mapped algorithmically only to other ASCII characters.
- * This helps with hasCompBoundaryBefore() and compose() fast paths.
- * It is never necessary any more to loop for algorithmic mappings.
- *
- * - Addition of indexes[IX_MIN_NO_NO_COMP_BOUNDARY_BEFORE],
- * indexes[IX_MIN_NO_NO_COMP_NO_MAYBE_CC], and indexes[IX_MIN_NO_NO_EMPTY],
- * and separation of the noNo extraData into distinct ranges.
- * With this, the noNo norm16 value indicates whether the mapping is
- * compose-normalized, not normalized but hasCompBoundaryBefore(),
- * not even that, or maps to an empty string.
- * hasCompBoundaryBefore() can be determined solely from the norm16 value.
- *
- * - The norm16 value for Hangul LVT is now different from that for Hangul LV,
- * so that hasCompBoundaryAfter() need not check for the syllable type.
- * For Hangul LV, minYesNo continues to be used (no comp-boundary-after).
- * For Hangul LVT, minYesNoMappingsOnly|HAS_COMP_BOUNDARY_AFTER is used.
- * The extraData units at these indexes are set to firstUnit=2 and firstUnit=3, respectively,
- * to simplify some code.
- *
- * - The extraData firstUnit bit 5 is no longer necessary
- * (norm16 bit 0 used instead of firstUnit MAPPING_NO_COMP_BOUNDARY_AFTER),
- * is reserved again, and always set to 0.
- *
- * - Addition of indexes[IX_MIN_LCCC_CP], the first code point where lccc!=0.
- * This used to be hardcoded to U+0300, but in data like NFKC_Casefold it is lower:
- * U+00AD Soft Hyphen maps to an empty string,
- * which is artificially assigned "worst case" values lccc=1 and tccc=255.
- *
- * - A mapping to an empty string has explicit lccc=1 and tccc=255 values.
- *
- * Changes from format version 3 to format version 4 (ICU 63) ------------------
- *
- * Switched from UTrie2 to UCPTrie/CodePointTrie.
- *
- * The new trie no longer stores different values for surrogate code *units* vs.
- * surrogate code *points*.
- * Lead surrogates still have values for optimized UTF-16 string processing.
- * When looking up code point properties, the code now checks for lead surrogates and
- * treats them as inert.
- *
- * gennorm2 now has to reject mappings for surrogate code points.
- * UTS #46 maps unpaired surrogates to U+FFFD in code rather than via its
- * custom normalization data file.
+ *
+ * Changes from format version 2 to format version 3 (ICU 60) ------------------
+ *
+ * - norm16 bit 0 indicates hasCompBoundaryAfter(),
+ * except that for contiguous composition (FCC) the tccc must be checked as well.
+ * Data indexes and ccc values are shifted left by one (OFFSET_SHIFT).
+ * Thresholds like minNoNo are tested before shifting.
+ *
+ * - Algorithmic mapping deltas are shifted left by two more bits (total DELTA_SHIFT),
+ * to make room for two bits (three values) indicating whether the tccc is 0, 1, or greater.
+ * See DELTA_TCCC_MASK etc.
+ * This helps with fetching tccc/FCD values and FCC hasCompBoundaryAfter().
+ * minMaybeYes is 8-aligned so that the DELTA_TCCC_MASK bits can be tested directly.
+ *
+ * - Algorithmic mappings are only used for mapping to "comp yes and ccc=0" characters,
+ * and ASCII characters are mapped algorithmically only to other ASCII characters.
+ * This helps with hasCompBoundaryBefore() and compose() fast paths.
+ * It is never necessary any more to loop for algorithmic mappings.
+ *
+ * - Addition of indexes[IX_MIN_NO_NO_COMP_BOUNDARY_BEFORE],
+ * indexes[IX_MIN_NO_NO_COMP_NO_MAYBE_CC], and indexes[IX_MIN_NO_NO_EMPTY],
+ * and separation of the noNo extraData into distinct ranges.
+ * With this, the noNo norm16 value indicates whether the mapping is
+ * compose-normalized, not normalized but hasCompBoundaryBefore(),
+ * not even that, or maps to an empty string.
+ * hasCompBoundaryBefore() can be determined solely from the norm16 value.
+ *
+ * - The norm16 value for Hangul LVT is now different from that for Hangul LV,
+ * so that hasCompBoundaryAfter() need not check for the syllable type.
+ * For Hangul LV, minYesNo continues to be used (no comp-boundary-after).
+ * For Hangul LVT, minYesNoMappingsOnly|HAS_COMP_BOUNDARY_AFTER is used.
+ * The extraData units at these indexes are set to firstUnit=2 and firstUnit=3, respectively,
+ * to simplify some code.
+ *
+ * - The extraData firstUnit bit 5 is no longer necessary
+ * (norm16 bit 0 used instead of firstUnit MAPPING_NO_COMP_BOUNDARY_AFTER),
+ * is reserved again, and always set to 0.
+ *
+ * - Addition of indexes[IX_MIN_LCCC_CP], the first code point where lccc!=0.
+ * This used to be hardcoded to U+0300, but in data like NFKC_Casefold it is lower:
+ * U+00AD Soft Hyphen maps to an empty string,
+ * which is artificially assigned "worst case" values lccc=1 and tccc=255.
+ *
+ * - A mapping to an empty string has explicit lccc=1 and tccc=255 values.
+ *
+ * Changes from format version 3 to format version 4 (ICU 63) ------------------
+ *
+ * Switched from UTrie2 to UCPTrie/CodePointTrie.
+ *
+ * The new trie no longer stores different values for surrogate code *units* vs.
+ * surrogate code *points*.
+ * Lead surrogates still have values for optimized UTF-16 string processing.
+ * When looking up code point properties, the code now checks for lead surrogates and
+ * treats them as inert.
+ *
+ * gennorm2 now has to reject mappings for surrogate code points.
+ * UTS #46 maps unpaired surrogates to U+FFFD in code rather than via its
+ * custom normalization data file.
*/
#endif /* !UCONFIG_NO_NORMALIZATION */
diff --git a/contrib/libs/icu/common/normlzr.cpp b/contrib/libs/icu/common/normlzr.cpp
index 596550a787..2dea0ffc33 100644
--- a/contrib/libs/icu/common/normlzr.cpp
+++ b/contrib/libs/icu/common/normlzr.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*************************************************************************
@@ -23,12 +23,12 @@
#include "normalizer2impl.h"
#include "uprops.h" // for uniset_getUnicode32Instance()
-#if defined(move32)
- // System can define move32 intrinsics, but the char iters define move32 method
- // using same undef trick in headers, so undef here to re-enable the method.
-#undef move32
-#endif
-
+#if defined(move32)
+ // System can define move32 intrinsics, but the char iters define move32 method
+ // using same undef trick in headers, so undef here to re-enable the method.
+#undef move32
+#endif
+
U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Normalizer)
@@ -46,7 +46,7 @@ Normalizer::Normalizer(const UnicodeString& str, UNormalizationMode mode) :
init();
}
-Normalizer::Normalizer(ConstChar16Ptr str, int32_t length, UNormalizationMode mode) :
+Normalizer::Normalizer(ConstChar16Ptr str, int32_t length, UNormalizationMode mode) :
UObject(), fFilteredNorm2(NULL), fNorm2(NULL), fUMode(mode), fOptions(0),
text(new UCharCharacterIterator(str, length)),
currentIndex(0), nextIndex(0),
@@ -441,7 +441,7 @@ Normalizer::setText(const CharacterIterator& newText,
}
void
-Normalizer::setText(ConstChar16Ptr newText,
+Normalizer::setText(ConstChar16Ptr newText,
int32_t length,
UErrorCode &status)
{
diff --git a/contrib/libs/icu/common/parsepos.cpp b/contrib/libs/icu/common/parsepos.cpp
index dad34f65d3..56c6c78813 100644
--- a/contrib/libs/icu/common/parsepos.cpp
+++ b/contrib/libs/icu/common/parsepos.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/patternprops.cpp b/contrib/libs/icu/common/patternprops.cpp
index 54378c9c33..c38a7e276d 100644
--- a/contrib/libs/icu/common/patternprops.cpp
+++ b/contrib/libs/icu/common/patternprops.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: patternprops.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -173,16 +173,16 @@ PatternProps::skipWhiteSpace(const UChar *s, int32_t length) {
return s;
}
-int32_t
-PatternProps::skipWhiteSpace(const UnicodeString& s, int32_t start) {
- int32_t i = start;
- int32_t length = s.length();
- while(i<length && isWhiteSpace(s.charAt(i))) {
- ++i;
- }
- return i;
-}
-
+int32_t
+PatternProps::skipWhiteSpace(const UnicodeString& s, int32_t start) {
+ int32_t i = start;
+ int32_t length = s.length();
+ while(i<length && isWhiteSpace(s.charAt(i))) {
+ ++i;
+ }
+ return i;
+}
+
const UChar *
PatternProps::trimWhiteSpace(const UChar *s, int32_t &length) {
if(length<=0 || (!isWhiteSpace(s[0]) && !isWhiteSpace(s[length-1]))) {
diff --git a/contrib/libs/icu/common/patternprops.h b/contrib/libs/icu/common/patternprops.h
index 90268ea6ff..b57cdeb6e5 100644
--- a/contrib/libs/icu/common/patternprops.h
+++ b/contrib/libs/icu/common/patternprops.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: patternprops.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -17,7 +17,7 @@
#ifndef __PATTERNPROPS_H__
#define __PATTERNPROPS_H__
-#include "unicode/unistr.h"
+#include "unicode/unistr.h"
#include "unicode/utypes.h"
U_NAMESPACE_BEGIN
@@ -65,12 +65,12 @@ public:
static const UChar *skipWhiteSpace(const UChar *s, int32_t length);
/**
- * Skips over Pattern_White_Space starting at index start in s.
- * @return The smallest index at or after start with a non-white space character.
- */
- static int32_t skipWhiteSpace(const UnicodeString &s, int32_t start);
-
- /**
+ * Skips over Pattern_White_Space starting at index start in s.
+ * @return The smallest index at or after start with a non-white space character.
+ */
+ static int32_t skipWhiteSpace(const UnicodeString &s, int32_t start);
+
+ /**
* @return s except with leading and trailing Pattern_White_Space removed and length adjusted.
*/
static const UChar *trimWhiteSpace(const UChar *s, int32_t &length);
diff --git a/contrib/libs/icu/common/pluralmap.cpp b/contrib/libs/icu/common/pluralmap.cpp
index 2a3d7a7066..ec87f0198e 100644
--- a/contrib/libs/icu/common/pluralmap.cpp
+++ b/contrib/libs/icu/common/pluralmap.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
* Copyright (C) 2015, International Business Machines Corporation and
diff --git a/contrib/libs/icu/common/pluralmap.h b/contrib/libs/icu/common/pluralmap.h
index f323446784..db644093a1 100644
--- a/contrib/libs/icu/common/pluralmap.h
+++ b/contrib/libs/icu/common/pluralmap.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/common/propname.cpp b/contrib/libs/icu/common/propname.cpp
index 99c3135d50..a12eb7d913 100644
--- a/contrib/libs/icu/common/propname.cpp
+++ b/contrib/libs/icu/common/propname.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/propname.h b/contrib/libs/icu/common/propname.h
index bbd88db5e6..1a8ced5b87 100644
--- a/contrib/libs/icu/common/propname.h
+++ b/contrib/libs/icu/common/propname.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/propname_data.h b/contrib/libs/icu/common/propname_data.h
index f590a8c5a4..6f63e9cdd4 100644
--- a/contrib/libs/icu/common/propname_data.h
+++ b/contrib/libs/icu/common/propname_data.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// Copyright (C) 1999-2016, International Business Machines
@@ -13,1044 +13,1044 @@
U_NAMESPACE_BEGIN
-const int32_t PropNameData::indexes[8]={0x20,0x15b8,0x5048,0xa69a,0xa69a,0xa69a,0x2f,0};
+const int32_t PropNameData::indexes[8]={0x20,0x15b8,0x5048,0xa69a,0xa69a,0xa69a,0x2f,0};
-const int32_t PropNameData::valueMaps[1382]={
-6,0,0x41,0,0xe3,0x368,0xe3,0x37e,0xe3,0x393,0xe3,0x3a9,0xe3,0x3b4,0xe3,0x3d5,
-0xe3,0x3e5,0xe3,0x3f4,0xe3,0x402,0xe3,0x426,0xe3,0x43d,0xe3,0x455,0xe3,0x46c,0xe3,0x47b,
-0xe3,0x48a,0xe3,0x49b,0xe3,0x4a9,0xe3,0x4bb,0xe3,0x4d5,0xe3,0x4f0,0xe3,0x505,0xe3,0x522,
-0xe3,0x533,0xe3,0x53e,0xe3,0x55d,0xe3,0x573,0xe3,0x584,0xe3,0x594,0xe3,0x5af,0xe3,0x5c8,
-0xe3,0x5d9,0xe3,0x5f3,0xe3,0x606,0xe3,0x616,0xe3,0x630,0xe3,0x649,0xe3,0x660,0xe3,0x674,
-0xe3,0x68a,0xe3,0x69e,0xe3,0x6b4,0xe3,0x6ce,0xe3,0x6e6,0xe3,0x702,0xe3,0x70a,0xe3,0x712,
-0xe3,0x71a,0xe3,0x722,0xe3,0x72b,0xe3,0x738,0xe3,0x74b,0xe3,0x768,0xe3,0x785,0xe3,0x7a2,
-0xe3,0x7c0,0xe3,0x7de,0xe3,0x802,0xe3,0x80f,0xe3,0x829,0xe3,0x83e,0xe3,0x859,0xe3,0x870,
-0xe3,0x887,0xe3,0x8a9,0xe3,0x1000,0x1019,0x8c8,0x15f,0xae8,0x17a,0x2f11,0xe9,0x2f30,0x2b3,0x306e,
-0x2c9,0x30c8,0x2d3,0x3325,0x2f5,0x3c20,0x35f,0x3c90,0x369,0x3f2a,0x398,0x3f68,0x3a0,0x4a5b,0x465,0x4ad9,
-0x46f,0x4afe,0x475,0x4b18,0x47b,0x4b39,0x482,0x4b53,0xe9,0x4b78,0xe9,0x4b9e,0x489,0x4c48,0x49f,0x4cc1,
-0x4b2,0x4d73,0x4cd,0x4daa,0x4d4,0x4f8a,0x4e8,0x540a,0x510,0x2000,0x2001,0x5469,0x518,0x3000,0x3001,0x54f5,
-0,0x4000,0x400e,0x5507,0,0x5510,0,0x552a,0,0x553b,0,0x554c,0,0x5562,0,0x556b,
-0,0x5588,0,0x55a6,0,0x55c4,0,0x55e2,0,0x55f8,0,0x560c,0,0x5622,0,0x7000,
-0x7001,0x563b,0,0x7d6,0x12,0,1,0x12,0x20,0x7f4,0x4a,0,1,6,7,8,
-9,0xa,0xb,0xc,0xd,0xe,0xf,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,
-0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20,0x21,0x22,0x23,0x24,0x54,0x5b,0x67,0x6b,
-0x76,0x7a,0x81,0x82,0x84,0x85,0xc8,0xca,0xd6,0xd8,0xda,0xdc,0xde,0xe0,0xe2,0xe4,
-0xe6,0xe8,0xe9,0xea,0xf0,0x2e,0x40,0x4c,0x5e,0x68,0x79,0x84,0x91,0x9e,0xab,0xb8,
-0xc5,0xd2,0xdf,0xec,0xf9,0x106,0x113,0x120,0x12d,0x13a,0x147,0x154,0x161,0x16e,0x17b,0x188,
-0x195,0x1a2,0x1af,0x1bc,0x1c9,0x1d6,0x1e3,0x1f0,0x1fd,0x20c,0x21b,0x22a,0x239,0x248,0x257,0x266,
-0x275,0x28f,0x2a3,0x2b7,0x2d2,0x2e1,0x2ea,0x2fa,0x302,0x30b,0x31a,0x323,0x333,0x344,0x355,0x995,
-1,0,0x17,0x8d7,0x8e8,0x8f9,0x90d,0x924,0x93c,0x94e,0x963,0x97a,0x98f,0x99f,0x9b1,0x9ce,
-0x9ea,0x9fc,0xa19,0xa35,0xa51,0xa66,0xa7b,0xa95,0xab0,0xacb,0xb37,1,0,0x135,0xaf3,0xb00,
-0xb13,0xb3b,0xb59,0xb77,0xb8f,0xbba,0xbe4,0xbfc,0xc0f,0xc22,0xc31,0xc40,0xc4f,0xc5e,0xc75,0xc86,
-0xc99,0xcac,0xcb9,0xcc6,0xcd5,0xce6,0xcfb,0xd0c,0xd17,0xd20,0xd31,0xd42,0xd55,0xd67,0xd7a,0xd8d,
-0xdcc,0xdd9,0xde6,0xdf3,0xe08,0xe38,0xe52,0xe73,0xe9e,0xec1,0xf1f,0xf46,0xf61,0xf70,0xf97,0xfbf,
-0xfe2,0x1005,0x102f,0x1048,0x1067,0x108a,0x10ae,0x10c1,0x10db,0x1105,0x111d,0x1145,0x116e,0x1181,0x1194,0x11a7,
-0x11ce,0x11dd,0x11fd,0x122b,0x1249,0x1277,0x1293,0x12ae,0x12c7,0x12e0,0x1301,0x1331,0x1350,0x1372,0x13a6,0x13d3,
-0x1418,0x1439,0x1463,0x1484,0x14ad,0x14c0,0x14f3,0x150a,0x1519,0x152a,0x1555,0x156c,0x159d,0x15cb,0x160e,0x1619,
-0x1652,0x1663,0x1674,0x1681,0x1694,0x16ce,0x16f2,0x1716,0x1750,0x1788,0x17b3,0x17cb,0x17f7,0x1823,0x1830,0x183f,
-0x185c,0x187e,0x18ac,0x18cc,0x18f3,0x191a,0x1939,0x194c,0x195d,0x196e,0x1993,0x19b8,0x19df,0x1a13,0x1a40,0x1a5e,
-0x1a71,0x1a8a,0x1ac3,0x1ad2,0x1af2,0x1b14,0x1b36,0x1b4d,0x1b64,0x1b91,0x1baa,0x1bc3,0x1bf4,0x1c1e,0x1c39,0x1c4c,
-0x1c6b,0x1c74,0x1c87,0x1ca5,0x1cc3,0x1cd6,0x1ced,0x1d02,0x1d37,0x1d5b,0x1d70,0x1d7f,0x1d92,0x1db6,0x1dbf,0x1de3,
-0x1dfa,0x1e0d,0x1e1c,0x1e27,0x1e48,0x1e60,0x1e6f,0x1e7e,0x1e8d,0x1ea4,0x1eb9,0x1ece,0x1f07,0x1f1a,0x1f36,0x1f41,
-0x1f4e,0x1f7c,0x1fa0,0x1fc3,0x1fd6,0x1ff8,0x200b,0x2026,0x2049,0x206c,0x2091,0x20a2,0x20d1,0x20fe,0x2115,0x2130,
-0x213f,0x216a,0x21a2,0x21dc,0x220a,0x221b,0x2228,0x224c,0x225b,0x2277,0x2291,0x22ae,0x22e6,0x22fb,0x2328,0x2347,
-0x2375,0x2395,0x23c9,0x23d8,0x2402,0x2425,0x2450,0x245b,0x246c,0x2487,0x24ab,0x24b8,0x24cd,0x24f4,0x251f,0x2556,
-0x2569,0x257a,0x25aa,0x25bb,0x25ca,0x25df,0x25fd,0x2610,0x2623,0x263a,0x2657,0x2662,0x266b,0x268d,0x26a2,0x26c7,
-0x26de,0x2707,0x2722,0x2737,0x2750,0x2771,0x27a6,0x27b7,0x27e8,0x280c,0x281d,0x2836,0x2841,0x286e,0x2890,0x28be,
-0x28f1,0x2900,0x2911,0x292e,0x2970,0x2997,0x29a4,0x29b9,0x29dd,0x2a03,0x2a3c,0x2a4d,0x2a71,0x2a7c,0x2a89,0x2a98,
-0x2abd,0x2aeb,0x2b07,0x2b24,0x2b31,0x2b42,0x2b60,0x2b83,0x2ba0,0x2bad,0x2bcd,0x2bea,0x2c0b,0x2c34,0x2c45,0x2c64,
-0x2c7d,0x2c96,0x2ca7,0x2cf0,0x2d01,0x2d1a,0x2d49,0x2d76,0x2d9b,0x2ddd,0x2df9,0x2e08,0x2e1f,0x2e4d,0x2e66,0x2e8f,
-0x2ea9,0x2ee4,0x2f02,0x1e85,1,0,0x12,0x2f47,0x2f57,0x2f6a,0x2f7a,0x2f8a,0x2f99,0x2fa9,0x2fbb,0x2fce,
-0x2fe0,0x2ff0,0x3000,0x300f,0x301e,0x302e,0x303b,0x304a,0x305e,0x1f43,1,0,6,0x3083,0x308e,0x309b,
-0x30a8,0x30b5,0x30c0,0x1f87,1,0,0x1e,0x30dd,0x30ec,0x3101,0x3116,0x312b,0x313f,0x3150,0x3164,0x3177,
-0x3188,0x31a1,0x31b3,0x31c4,0x31d8,0x31eb,0x3203,0x3215,0x3220,0x3230,0x323e,0x3253,0x3268,0x327e,0x3298,0x32ae,
-0x32be,0x32d2,0x32e6,0x32f7,0x330f,0x21b2,1,0,0x66,0x3337,0x335a,0x3363,0x3370,0x337b,0x3384,0x338f,
-0x3398,0x33b1,0x33b6,0x33bf,0x33dc,0x33e5,0x33f2,0x33fb,0x341f,0x3426,0x342f,0x3442,0x344d,0x3456,0x3461,0x347a,
-0x3483,0x3492,0x349d,0x34a6,0x34b1,0x34ba,0x34c1,0x34ca,0x34d5,0x34de,0x34f7,0x3500,0x350d,0x3518,0x3529,0x3534,
-0x3549,0x3560,0x3569,0x3572,0x358b,0x3596,0x359f,0x35a8,0x35bf,0x35dc,0x35e7,0x35f8,0x3603,0x360a,0x3617,0x3624,
-0x3651,0x3666,0x366f,0x368a,0x36ad,0x36ce,0x36ef,0x3714,0x373b,0x375c,0x377f,0x37a0,0x37c7,0x37e8,0x380d,0x382c,
-0x384b,0x386a,0x3887,0x38a8,0x38c9,0x38ec,0x3911,0x3930,0x394f,0x3970,0x3997,0x39bc,0x39db,0x39fc,0x3a1f,0x3a3a,
-0x3a53,0x3a6e,0x3a87,0x3aa4,0x3abf,0x3adc,0x3afb,0x3b18,0x3b35,0x3b54,0x3b71,0x3b8c,0x3ba9,0x3bc6,0x3bf9,0x24f7,
-1,0,6,0x3c31,0x3c40,0x3c50,0x3c60,0x3c70,0x3c81,0x2555,1,0,0x2b,0x3c9f,0x3cab,0x3cb9,
-0x3cc8,0x3cd7,0x3ce7,0x3cf8,0x3d0c,0x3d21,0x3d37,0x3d4a,0x3d5e,0x3d6e,0x3d77,0x3d82,0x3d92,0x3dae,0x3dc0,0x3dce,
-0x3ddd,0x3de9,0x3dfe,0x3e12,0x3e25,0x3e33,0x3e47,0x3e55,0x3e5f,0x3e71,0x3e7d,0x3e8b,0x3e9b,0x3ea2,0x3ea9,0x3eb0,
-0x3eb7,0x3ebe,0x3ed4,0x3ef5,0x870,0x3f07,0x3f12,0x3f21,0x27ae,1,0,4,0x3f3b,0x3f46,0x3f52,0x3f5c,
-0x27d4,1,0,0xc1,0x3f73,0x3f80,0x3f95,0x3fa2,0x3fb1,0x3fbf,0x3fce,0x3fdd,0x3fef,0x3ffe,0x400c,0x401d,
-0x402c,0x403b,0x4048,0x4054,0x4063,0x4072,0x407c,0x4089,0x4096,0x40a5,0x40b3,0x40c2,0x40ce,0x40d8,0x40e4,0x40f4,
-0x4104,0x4112,0x411e,0x412f,0x413b,0x4147,0x4155,0x4162,0x416e,0x417b,0xd0c,0x4188,0x4196,0x41b0,0x41b9,0x41c7,
-0x41d5,0x41e1,0x41f0,0x41fe,0x420c,0x4218,0x4227,0x4235,0x4243,0x4250,0x425f,0x427a,0x4289,0x429a,0x42ab,0x42be,
-0x42d0,0x42df,0x42f1,0x4300,0x430c,0x4317,0x1e1c,0x4324,0x432f,0x433a,0x4345,0x4350,0x436b,0x4376,0x4381,0x438c,
-0x439f,0x43b3,0x43be,0x43cd,0x43dc,0x43e7,0x43f2,0x43ff,0x440e,0x441c,0x4427,0x4442,0x444c,0x445d,0x446e,0x447d,
-0x448e,0x4499,0x44a4,0x44af,0x44ba,0x44c5,0x44d0,0x44db,0x44e5,0x44f0,0x4500,0x450b,0x4519,0x4526,0x4531,0x4540,
-0x454d,0x455a,0x4569,0x4576,0x4587,0x4599,0x45a9,0x45b4,0x45c7,0x45de,0x45ec,0x45f9,0x4604,0x4611,0x4622,0x463e,
-0x4654,0x465f,0x467c,0x468c,0x469b,0x46a6,0x46b1,0x1f36,0x46bd,0x46c8,0x46e0,0x46f0,0x46ff,0x470d,0x471b,0x4726,
-0x4731,0x4745,0x475c,0x4774,0x4784,0x4794,0x47a4,0x47b6,0x47c1,0x47cc,0x47d6,0x47e2,0x47f0,0x4803,0x480f,0x481c,
-0x4827,0x4843,0x4850,0x485e,0x4877,0x2836,0x4886,0x2657,0x4893,0x48a1,0x48b3,0x48c1,0x48cd,0x48dd,0x2a71,0x48eb,
-0x48f7,0x4902,0x490d,0x4918,0x492c,0x493a,0x4951,0x495d,0x4971,0x497f,0x4991,0x49a7,0x49b5,0x49c7,0x49d5,0x49f2,
-0x4a04,0x4a11,0x4a22,0x4a34,0x4a4e,0x31cc,1,0,6,0x4a75,0x4a88,0x4a98,0x4aa6,0x4ab7,0x4ac7,0x3228,
-0x12,0,1,0x4af1,0x4af7,0x3235,0x12,0,1,0x4af1,0x4af7,0x3242,1,0,3,0x4af1,
-0x4af7,0x4b30,0x3258,1,0,3,0x4af1,0x4af7,0x4b30,0x326e,1,0,0x12,0x4bba,0x4bc4,0x4bd0,
-0x4bd7,0x4be2,0x4be7,0x4bee,0x4bf5,0x4bfe,0x4c03,0x4c08,0x4c18,0x870,0x3f07,0x4c24,0x3f12,0x4c34,0x3f21,0x3317,
-1,0,0xf,0x4bba,0x4c5b,0x4c65,0x4c6f,0x4c7a,0x3ddd,0x4c84,0x4c90,0x4c98,0x4c9f,0x4ca9,0x4bd0,0x4bd7,
-0x4be7,0x4cb3,0x339e,1,0,0x17,0x4bba,0x4cd0,0x4c6f,0x4cdc,0x4ce9,0x4cf7,0x3ddd,0x4d02,0x4bd0,0x4d13,
-0x4be7,0x4d22,0x4d30,0x870,0x3ef5,0x4d3c,0x4d4d,0x3f07,0x4c24,0x3f12,0x4c34,0x3f21,0x4d5e,0x34bb,1,0,
-3,0x4d91,0x4d99,0x4da1,0x34d4,1,0,0x10,0x4dca,0x4dd1,0x4de0,0x4e01,0x4e24,0x4e2f,0x4e4e,0x4e65,
-0x4e72,0x4e7b,0x4e9a,0x4ecd,0x4ee8,0x4f17,0x4f34,0x4f59,0x356d,1,0,0x24,0x4fa8,0x4fb5,0x4fc8,0x4fd5,
-0x5002,0x5027,0x503c,0x505b,0x507c,0x50a9,0x50e2,0x5105,0x5128,0x5155,0x518a,0x51b1,0x51da,0x5211,0x5240,0x5261,
-0x5286,0x5295,0x52b8,0x52cf,0x52dc,0x52eb,0x5308,0x5321,0x5344,0x5369,0x5382,0x5397,0x53a6,0x53b7,0x53c4,0x53e5,
-0x373d,1,0,4,0x5423,0x542e,0x5446,0x545e,0x3779,0x36,1,2,4,8,0xe,0x10,
-0x20,0x3e,0x40,0x80,0x100,0x1c0,0x200,0x400,0x800,0xe00,0x1000,0x2000,0x4000,0x7000,0x8000,0x10000,
-0x20000,0x40000,0x78001,0x80000,0x100000,0x200000,0x400000,0x800000,0x1000000,0x2000000,0x4000000,0x8000000,0xf000000,0x10000000,0x20000000,0x30f80000,
-0x30dd,0x30ec,0x3101,0x3116,0x5497,0x312b,0x313f,0x548d,0x3150,0x3164,0x3177,0x54a8,0x3188,0x31a1,0x31b3,0x54bf,
-0x31c4,0x31d8,0x31eb,0x54e8,0x3203,0x3215,0x3220,0x3230,0x5484,0x323e,0x3253,0x3268,0x327e,0x3298,0x32ae,0x32be,
-0x32d2,0x32e6,0x54de,0x32f7,0x330f,0x54c9
+const int32_t PropNameData::valueMaps[1382]={
+6,0,0x41,0,0xe3,0x368,0xe3,0x37e,0xe3,0x393,0xe3,0x3a9,0xe3,0x3b4,0xe3,0x3d5,
+0xe3,0x3e5,0xe3,0x3f4,0xe3,0x402,0xe3,0x426,0xe3,0x43d,0xe3,0x455,0xe3,0x46c,0xe3,0x47b,
+0xe3,0x48a,0xe3,0x49b,0xe3,0x4a9,0xe3,0x4bb,0xe3,0x4d5,0xe3,0x4f0,0xe3,0x505,0xe3,0x522,
+0xe3,0x533,0xe3,0x53e,0xe3,0x55d,0xe3,0x573,0xe3,0x584,0xe3,0x594,0xe3,0x5af,0xe3,0x5c8,
+0xe3,0x5d9,0xe3,0x5f3,0xe3,0x606,0xe3,0x616,0xe3,0x630,0xe3,0x649,0xe3,0x660,0xe3,0x674,
+0xe3,0x68a,0xe3,0x69e,0xe3,0x6b4,0xe3,0x6ce,0xe3,0x6e6,0xe3,0x702,0xe3,0x70a,0xe3,0x712,
+0xe3,0x71a,0xe3,0x722,0xe3,0x72b,0xe3,0x738,0xe3,0x74b,0xe3,0x768,0xe3,0x785,0xe3,0x7a2,
+0xe3,0x7c0,0xe3,0x7de,0xe3,0x802,0xe3,0x80f,0xe3,0x829,0xe3,0x83e,0xe3,0x859,0xe3,0x870,
+0xe3,0x887,0xe3,0x8a9,0xe3,0x1000,0x1019,0x8c8,0x15f,0xae8,0x17a,0x2f11,0xe9,0x2f30,0x2b3,0x306e,
+0x2c9,0x30c8,0x2d3,0x3325,0x2f5,0x3c20,0x35f,0x3c90,0x369,0x3f2a,0x398,0x3f68,0x3a0,0x4a5b,0x465,0x4ad9,
+0x46f,0x4afe,0x475,0x4b18,0x47b,0x4b39,0x482,0x4b53,0xe9,0x4b78,0xe9,0x4b9e,0x489,0x4c48,0x49f,0x4cc1,
+0x4b2,0x4d73,0x4cd,0x4daa,0x4d4,0x4f8a,0x4e8,0x540a,0x510,0x2000,0x2001,0x5469,0x518,0x3000,0x3001,0x54f5,
+0,0x4000,0x400e,0x5507,0,0x5510,0,0x552a,0,0x553b,0,0x554c,0,0x5562,0,0x556b,
+0,0x5588,0,0x55a6,0,0x55c4,0,0x55e2,0,0x55f8,0,0x560c,0,0x5622,0,0x7000,
+0x7001,0x563b,0,0x7d6,0x12,0,1,0x12,0x20,0x7f4,0x4a,0,1,6,7,8,
+9,0xa,0xb,0xc,0xd,0xe,0xf,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,
+0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20,0x21,0x22,0x23,0x24,0x54,0x5b,0x67,0x6b,
+0x76,0x7a,0x81,0x82,0x84,0x85,0xc8,0xca,0xd6,0xd8,0xda,0xdc,0xde,0xe0,0xe2,0xe4,
+0xe6,0xe8,0xe9,0xea,0xf0,0x2e,0x40,0x4c,0x5e,0x68,0x79,0x84,0x91,0x9e,0xab,0xb8,
+0xc5,0xd2,0xdf,0xec,0xf9,0x106,0x113,0x120,0x12d,0x13a,0x147,0x154,0x161,0x16e,0x17b,0x188,
+0x195,0x1a2,0x1af,0x1bc,0x1c9,0x1d6,0x1e3,0x1f0,0x1fd,0x20c,0x21b,0x22a,0x239,0x248,0x257,0x266,
+0x275,0x28f,0x2a3,0x2b7,0x2d2,0x2e1,0x2ea,0x2fa,0x302,0x30b,0x31a,0x323,0x333,0x344,0x355,0x995,
+1,0,0x17,0x8d7,0x8e8,0x8f9,0x90d,0x924,0x93c,0x94e,0x963,0x97a,0x98f,0x99f,0x9b1,0x9ce,
+0x9ea,0x9fc,0xa19,0xa35,0xa51,0xa66,0xa7b,0xa95,0xab0,0xacb,0xb37,1,0,0x135,0xaf3,0xb00,
+0xb13,0xb3b,0xb59,0xb77,0xb8f,0xbba,0xbe4,0xbfc,0xc0f,0xc22,0xc31,0xc40,0xc4f,0xc5e,0xc75,0xc86,
+0xc99,0xcac,0xcb9,0xcc6,0xcd5,0xce6,0xcfb,0xd0c,0xd17,0xd20,0xd31,0xd42,0xd55,0xd67,0xd7a,0xd8d,
+0xdcc,0xdd9,0xde6,0xdf3,0xe08,0xe38,0xe52,0xe73,0xe9e,0xec1,0xf1f,0xf46,0xf61,0xf70,0xf97,0xfbf,
+0xfe2,0x1005,0x102f,0x1048,0x1067,0x108a,0x10ae,0x10c1,0x10db,0x1105,0x111d,0x1145,0x116e,0x1181,0x1194,0x11a7,
+0x11ce,0x11dd,0x11fd,0x122b,0x1249,0x1277,0x1293,0x12ae,0x12c7,0x12e0,0x1301,0x1331,0x1350,0x1372,0x13a6,0x13d3,
+0x1418,0x1439,0x1463,0x1484,0x14ad,0x14c0,0x14f3,0x150a,0x1519,0x152a,0x1555,0x156c,0x159d,0x15cb,0x160e,0x1619,
+0x1652,0x1663,0x1674,0x1681,0x1694,0x16ce,0x16f2,0x1716,0x1750,0x1788,0x17b3,0x17cb,0x17f7,0x1823,0x1830,0x183f,
+0x185c,0x187e,0x18ac,0x18cc,0x18f3,0x191a,0x1939,0x194c,0x195d,0x196e,0x1993,0x19b8,0x19df,0x1a13,0x1a40,0x1a5e,
+0x1a71,0x1a8a,0x1ac3,0x1ad2,0x1af2,0x1b14,0x1b36,0x1b4d,0x1b64,0x1b91,0x1baa,0x1bc3,0x1bf4,0x1c1e,0x1c39,0x1c4c,
+0x1c6b,0x1c74,0x1c87,0x1ca5,0x1cc3,0x1cd6,0x1ced,0x1d02,0x1d37,0x1d5b,0x1d70,0x1d7f,0x1d92,0x1db6,0x1dbf,0x1de3,
+0x1dfa,0x1e0d,0x1e1c,0x1e27,0x1e48,0x1e60,0x1e6f,0x1e7e,0x1e8d,0x1ea4,0x1eb9,0x1ece,0x1f07,0x1f1a,0x1f36,0x1f41,
+0x1f4e,0x1f7c,0x1fa0,0x1fc3,0x1fd6,0x1ff8,0x200b,0x2026,0x2049,0x206c,0x2091,0x20a2,0x20d1,0x20fe,0x2115,0x2130,
+0x213f,0x216a,0x21a2,0x21dc,0x220a,0x221b,0x2228,0x224c,0x225b,0x2277,0x2291,0x22ae,0x22e6,0x22fb,0x2328,0x2347,
+0x2375,0x2395,0x23c9,0x23d8,0x2402,0x2425,0x2450,0x245b,0x246c,0x2487,0x24ab,0x24b8,0x24cd,0x24f4,0x251f,0x2556,
+0x2569,0x257a,0x25aa,0x25bb,0x25ca,0x25df,0x25fd,0x2610,0x2623,0x263a,0x2657,0x2662,0x266b,0x268d,0x26a2,0x26c7,
+0x26de,0x2707,0x2722,0x2737,0x2750,0x2771,0x27a6,0x27b7,0x27e8,0x280c,0x281d,0x2836,0x2841,0x286e,0x2890,0x28be,
+0x28f1,0x2900,0x2911,0x292e,0x2970,0x2997,0x29a4,0x29b9,0x29dd,0x2a03,0x2a3c,0x2a4d,0x2a71,0x2a7c,0x2a89,0x2a98,
+0x2abd,0x2aeb,0x2b07,0x2b24,0x2b31,0x2b42,0x2b60,0x2b83,0x2ba0,0x2bad,0x2bcd,0x2bea,0x2c0b,0x2c34,0x2c45,0x2c64,
+0x2c7d,0x2c96,0x2ca7,0x2cf0,0x2d01,0x2d1a,0x2d49,0x2d76,0x2d9b,0x2ddd,0x2df9,0x2e08,0x2e1f,0x2e4d,0x2e66,0x2e8f,
+0x2ea9,0x2ee4,0x2f02,0x1e85,1,0,0x12,0x2f47,0x2f57,0x2f6a,0x2f7a,0x2f8a,0x2f99,0x2fa9,0x2fbb,0x2fce,
+0x2fe0,0x2ff0,0x3000,0x300f,0x301e,0x302e,0x303b,0x304a,0x305e,0x1f43,1,0,6,0x3083,0x308e,0x309b,
+0x30a8,0x30b5,0x30c0,0x1f87,1,0,0x1e,0x30dd,0x30ec,0x3101,0x3116,0x312b,0x313f,0x3150,0x3164,0x3177,
+0x3188,0x31a1,0x31b3,0x31c4,0x31d8,0x31eb,0x3203,0x3215,0x3220,0x3230,0x323e,0x3253,0x3268,0x327e,0x3298,0x32ae,
+0x32be,0x32d2,0x32e6,0x32f7,0x330f,0x21b2,1,0,0x66,0x3337,0x335a,0x3363,0x3370,0x337b,0x3384,0x338f,
+0x3398,0x33b1,0x33b6,0x33bf,0x33dc,0x33e5,0x33f2,0x33fb,0x341f,0x3426,0x342f,0x3442,0x344d,0x3456,0x3461,0x347a,
+0x3483,0x3492,0x349d,0x34a6,0x34b1,0x34ba,0x34c1,0x34ca,0x34d5,0x34de,0x34f7,0x3500,0x350d,0x3518,0x3529,0x3534,
+0x3549,0x3560,0x3569,0x3572,0x358b,0x3596,0x359f,0x35a8,0x35bf,0x35dc,0x35e7,0x35f8,0x3603,0x360a,0x3617,0x3624,
+0x3651,0x3666,0x366f,0x368a,0x36ad,0x36ce,0x36ef,0x3714,0x373b,0x375c,0x377f,0x37a0,0x37c7,0x37e8,0x380d,0x382c,
+0x384b,0x386a,0x3887,0x38a8,0x38c9,0x38ec,0x3911,0x3930,0x394f,0x3970,0x3997,0x39bc,0x39db,0x39fc,0x3a1f,0x3a3a,
+0x3a53,0x3a6e,0x3a87,0x3aa4,0x3abf,0x3adc,0x3afb,0x3b18,0x3b35,0x3b54,0x3b71,0x3b8c,0x3ba9,0x3bc6,0x3bf9,0x24f7,
+1,0,6,0x3c31,0x3c40,0x3c50,0x3c60,0x3c70,0x3c81,0x2555,1,0,0x2b,0x3c9f,0x3cab,0x3cb9,
+0x3cc8,0x3cd7,0x3ce7,0x3cf8,0x3d0c,0x3d21,0x3d37,0x3d4a,0x3d5e,0x3d6e,0x3d77,0x3d82,0x3d92,0x3dae,0x3dc0,0x3dce,
+0x3ddd,0x3de9,0x3dfe,0x3e12,0x3e25,0x3e33,0x3e47,0x3e55,0x3e5f,0x3e71,0x3e7d,0x3e8b,0x3e9b,0x3ea2,0x3ea9,0x3eb0,
+0x3eb7,0x3ebe,0x3ed4,0x3ef5,0x870,0x3f07,0x3f12,0x3f21,0x27ae,1,0,4,0x3f3b,0x3f46,0x3f52,0x3f5c,
+0x27d4,1,0,0xc1,0x3f73,0x3f80,0x3f95,0x3fa2,0x3fb1,0x3fbf,0x3fce,0x3fdd,0x3fef,0x3ffe,0x400c,0x401d,
+0x402c,0x403b,0x4048,0x4054,0x4063,0x4072,0x407c,0x4089,0x4096,0x40a5,0x40b3,0x40c2,0x40ce,0x40d8,0x40e4,0x40f4,
+0x4104,0x4112,0x411e,0x412f,0x413b,0x4147,0x4155,0x4162,0x416e,0x417b,0xd0c,0x4188,0x4196,0x41b0,0x41b9,0x41c7,
+0x41d5,0x41e1,0x41f0,0x41fe,0x420c,0x4218,0x4227,0x4235,0x4243,0x4250,0x425f,0x427a,0x4289,0x429a,0x42ab,0x42be,
+0x42d0,0x42df,0x42f1,0x4300,0x430c,0x4317,0x1e1c,0x4324,0x432f,0x433a,0x4345,0x4350,0x436b,0x4376,0x4381,0x438c,
+0x439f,0x43b3,0x43be,0x43cd,0x43dc,0x43e7,0x43f2,0x43ff,0x440e,0x441c,0x4427,0x4442,0x444c,0x445d,0x446e,0x447d,
+0x448e,0x4499,0x44a4,0x44af,0x44ba,0x44c5,0x44d0,0x44db,0x44e5,0x44f0,0x4500,0x450b,0x4519,0x4526,0x4531,0x4540,
+0x454d,0x455a,0x4569,0x4576,0x4587,0x4599,0x45a9,0x45b4,0x45c7,0x45de,0x45ec,0x45f9,0x4604,0x4611,0x4622,0x463e,
+0x4654,0x465f,0x467c,0x468c,0x469b,0x46a6,0x46b1,0x1f36,0x46bd,0x46c8,0x46e0,0x46f0,0x46ff,0x470d,0x471b,0x4726,
+0x4731,0x4745,0x475c,0x4774,0x4784,0x4794,0x47a4,0x47b6,0x47c1,0x47cc,0x47d6,0x47e2,0x47f0,0x4803,0x480f,0x481c,
+0x4827,0x4843,0x4850,0x485e,0x4877,0x2836,0x4886,0x2657,0x4893,0x48a1,0x48b3,0x48c1,0x48cd,0x48dd,0x2a71,0x48eb,
+0x48f7,0x4902,0x490d,0x4918,0x492c,0x493a,0x4951,0x495d,0x4971,0x497f,0x4991,0x49a7,0x49b5,0x49c7,0x49d5,0x49f2,
+0x4a04,0x4a11,0x4a22,0x4a34,0x4a4e,0x31cc,1,0,6,0x4a75,0x4a88,0x4a98,0x4aa6,0x4ab7,0x4ac7,0x3228,
+0x12,0,1,0x4af1,0x4af7,0x3235,0x12,0,1,0x4af1,0x4af7,0x3242,1,0,3,0x4af1,
+0x4af7,0x4b30,0x3258,1,0,3,0x4af1,0x4af7,0x4b30,0x326e,1,0,0x12,0x4bba,0x4bc4,0x4bd0,
+0x4bd7,0x4be2,0x4be7,0x4bee,0x4bf5,0x4bfe,0x4c03,0x4c08,0x4c18,0x870,0x3f07,0x4c24,0x3f12,0x4c34,0x3f21,0x3317,
+1,0,0xf,0x4bba,0x4c5b,0x4c65,0x4c6f,0x4c7a,0x3ddd,0x4c84,0x4c90,0x4c98,0x4c9f,0x4ca9,0x4bd0,0x4bd7,
+0x4be7,0x4cb3,0x339e,1,0,0x17,0x4bba,0x4cd0,0x4c6f,0x4cdc,0x4ce9,0x4cf7,0x3ddd,0x4d02,0x4bd0,0x4d13,
+0x4be7,0x4d22,0x4d30,0x870,0x3ef5,0x4d3c,0x4d4d,0x3f07,0x4c24,0x3f12,0x4c34,0x3f21,0x4d5e,0x34bb,1,0,
+3,0x4d91,0x4d99,0x4da1,0x34d4,1,0,0x10,0x4dca,0x4dd1,0x4de0,0x4e01,0x4e24,0x4e2f,0x4e4e,0x4e65,
+0x4e72,0x4e7b,0x4e9a,0x4ecd,0x4ee8,0x4f17,0x4f34,0x4f59,0x356d,1,0,0x24,0x4fa8,0x4fb5,0x4fc8,0x4fd5,
+0x5002,0x5027,0x503c,0x505b,0x507c,0x50a9,0x50e2,0x5105,0x5128,0x5155,0x518a,0x51b1,0x51da,0x5211,0x5240,0x5261,
+0x5286,0x5295,0x52b8,0x52cf,0x52dc,0x52eb,0x5308,0x5321,0x5344,0x5369,0x5382,0x5397,0x53a6,0x53b7,0x53c4,0x53e5,
+0x373d,1,0,4,0x5423,0x542e,0x5446,0x545e,0x3779,0x36,1,2,4,8,0xe,0x10,
+0x20,0x3e,0x40,0x80,0x100,0x1c0,0x200,0x400,0x800,0xe00,0x1000,0x2000,0x4000,0x7000,0x8000,0x10000,
+0x20000,0x40000,0x78001,0x80000,0x100000,0x200000,0x400000,0x800000,0x1000000,0x2000000,0x4000000,0x8000000,0xf000000,0x10000000,0x20000000,0x30f80000,
+0x30dd,0x30ec,0x3101,0x3116,0x5497,0x312b,0x313f,0x548d,0x3150,0x3164,0x3177,0x54a8,0x3188,0x31a1,0x31b3,0x54bf,
+0x31c4,0x31d8,0x31eb,0x54e8,0x3203,0x3215,0x3220,0x3230,0x5484,0x323e,0x3253,0x3268,0x327e,0x3298,0x32ae,0x32be,
+0x32d2,0x32e6,0x54de,0x32f7,0x330f,0x54c9
};
-const uint8_t PropNameData::bytesTries[14992]={
-0,0x15,0x6d,0xc3,0x78,0x73,0xc2,0x12,0x76,0x7a,0x76,0x6a,0x77,0xa2,0x52,0x78,
-1,0x64,0x50,0x69,0x10,0x64,1,0x63,0x30,0x73,0x62,0x13,0x74,0x61,0x72,0x74,
-0x63,0x60,0x16,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,0x61,0x13,0x69,0x67,0x69,0x74,
-0x81,3,0x61,0x2e,0x65,0x4c,0x6f,0xc3,0x18,0x73,0x69,0x1e,0x72,0x69,0x61,0x74,
-0x69,0x6f,0x6e,0x73,0x65,0x6c,0x65,0x63,0x74,0x6f,0x72,0x69,0x10,0x72,0x1f,0x74,
-0x69,0x63,0x61,0x6c,0x6f,0x72,0x69,0x65,0x6e,0x74,0x61,0x74,0x69,0x6f,0x6e,0xc3,
-0x18,3,0x62,0xc3,0x14,0x68,0x32,0x6f,0x42,0x73,0x13,0x70,0x61,0x63,0x65,0x5f,
-0x17,0x69,0x74,0x65,0x73,0x70,0x61,0x63,0x65,0x5f,0x16,0x72,0x64,0x62,0x72,0x65,
-0x61,0x6b,0xc3,0x14,0x73,0xa2,0x49,0x74,0xa4,0x3b,0x75,3,0x63,0xd9,0x40,0xc,
-0x69,0x52,0x6e,0x58,0x70,0x12,0x70,0x65,0x72,0x5c,0x13,0x63,0x61,0x73,0x65,0x5c,
-0x16,0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40,0xc,0x12,0x64,0x65,0x6f,0x5b,
-0x10,0x69,1,0x63,0x3e,0x66,0x1b,0x69,0x65,0x64,0x69,0x64,0x65,0x6f,0x67,0x72,
-0x61,0x70,0x68,0x5b,0x17,0x6f,0x64,0x65,0x31,0x6e,0x61,0x6d,0x65,0xd9,0x40,0xb,
-0xa,0x69,0x84,0x70,0x19,0x70,0x30,0x74,0x36,0x75,0x10,0x63,0xd9,0x40,9,0x12,
-0x61,0x63,0x65,0x5f,1,0x63,0xd9,0x40,8,0x65,0x11,0x72,0x6d,0x67,0x69,0x3c,
-0x6c,0xa2,0x5f,0x6f,0x17,0x66,0x74,0x64,0x6f,0x74,0x74,0x65,0x64,0x57,0x13,0x6d,
-0x70,0x6c,0x65,3,0x63,0x50,0x6c,0x68,0x74,0x8a,0x75,0x1e,0x70,0x70,0x65,0x72,
-0x63,0x61,0x73,0x65,0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40,9,0x19,0x61,
-0x73,0x65,0x66,0x6f,0x6c,0x64,0x69,0x6e,0x67,0xd9,0x40,6,0x1e,0x6f,0x77,0x65,
-0x72,0x63,0x61,0x73,0x65,0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40,7,0x1e,
-0x69,0x74,0x6c,0x65,0x63,0x61,0x73,0x65,0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,
-0x40,8,0x10,0x63,0xd9,0x40,7,0x62,0xc3,0x13,0x63,0x34,0x64,0x57,0x65,0x6e,
-0x66,0x10,0x63,0xd9,0x40,6,0xc2,0xa,2,0x66,0xd9,0x40,6,0x72,0x28,0x78,
-0xd9,0x70,0,0x12,0x69,0x70,0x74,0xc2,0xa,0x19,0x65,0x78,0x74,0x65,0x6e,0x73,
-0x69,0x6f,0x6e,0x73,0xd9,0x70,0,1,0x67,0x6a,0x6e,1,0x73,0x54,0x74,0x13,
-0x65,0x6e,0x63,0x65,1,0x62,0x34,0x74,0x16,0x65,0x72,0x6d,0x69,0x6e,0x61,0x6c,
-0x67,0x13,0x72,0x65,0x61,0x6b,0xc3,0x13,0x14,0x69,0x74,0x69,0x76,0x65,0x65,1,
-0x6d,0x2e,0x73,0x13,0x74,0x61,0x72,0x74,0x73,0x19,0x65,0x6e,0x74,0x73,0x74,0x61,
-0x72,0x74,0x65,0x72,0x73,3,0x63,0x66,0x65,0x72,0x69,0x98,0x72,0x19,0x61,0x69,
-0x6c,0x63,0x61,0x6e,0x6f,0x6e,0x69,0x63,0x1f,0x61,0x6c,0x63,0x6f,0x6d,0x62,0x69,
-0x6e,0x69,0x6e,0x67,0x63,0x6c,0x61,0x73,0x73,0xc3,0x11,0xd8,0x40,0xa,0x11,0x63,
-0x63,0xc3,0x11,0x11,0x72,0x6d,0x58,0x1e,0x69,0x6e,0x61,0x6c,0x70,0x75,0x6e,0x63,
-0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x59,0x1d,0x74,0x6c,0x65,0x63,0x61,0x73,0x65,
-0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40,0xa,0x6d,0x70,0x6e,0x76,0x70,0xa2,
-0xf1,0x71,0xa4,0x43,0x72,2,0x61,0x28,0x65,0x32,0x69,0x9d,0x14,0x64,0x69,0x63,
-0x61,0x6c,0x55,0x1e,0x67,0x69,0x6f,0x6e,0x61,0x6c,0x69,0x6e,0x64,0x69,0x63,0x61,
-0x74,0x6f,0x72,0x9d,0x12,0x61,0x74,0x68,0x4f,6,0x6f,0x39,0x6f,0x32,0x74,0xc3,
-9,0x75,0x54,0x76,0xd9,0x30,0,0x12,0x6e,0x63,0x68,0x1f,0x61,0x72,0x61,0x63,
-0x74,0x65,0x72,0x63,0x6f,0x64,0x65,0x70,0x6f,0x69,0x6e,0x74,0x51,0x14,0x6d,0x65,
-0x72,0x69,0x63,1,0x74,0x32,0x76,0x13,0x61,0x6c,0x75,0x65,0xd9,0x30,0,0x12,
-0x79,0x70,0x65,0xc3,9,0x61,0xa2,0x77,0x63,0xa2,0x82,0x66,2,0x63,0x98,0x64,
-0xa2,0x53,0x6b,1,0x63,0x56,0x64,1,0x69,0x42,0x71,1,0x63,0xc3,0xd,0x75,
-0x17,0x69,0x63,0x6b,0x63,0x68,0x65,0x63,0x6b,0xc3,0xd,0x13,0x6e,0x65,0x72,0x74,
-0x6d,1,0x69,0x42,0x71,1,0x63,0xc3,0xf,0x75,0x17,0x69,0x63,0x6b,0x63,0x68,
-0x65,0x63,0x6b,0xc3,0xf,0x13,0x6e,0x65,0x72,0x74,0x71,1,0x69,0x42,0x71,1,
-0x63,0xc3,0xe,0x75,0x17,0x69,0x63,0x6b,0x63,0x68,0x65,0x63,0x6b,0xc3,0xe,0x13,
-0x6e,0x65,0x72,0x74,0x6f,1,0x69,0x42,0x71,1,0x63,0xc3,0xc,0x75,0x17,0x69,
-0x63,0x6b,0x63,0x68,0x65,0x63,0x6b,0xc3,0xc,0x13,0x6e,0x65,0x72,0x74,0x6b,0xd8,
-0x40,5,1,0x31,0xd9,0x40,0xb,0x6d,0x10,0x65,0xd9,0x40,5,0x12,0x68,0x61,
-0x72,0x51,2,0x61,0x6c,0x63,0xa2,0x4c,0x72,1,0x65,0x2a,0x69,0x11,0x6e,0x74,
-0x7f,0x16,0x70,0x65,0x6e,0x64,0x65,0x64,0x63,0x1f,0x6f,0x6e,0x63,0x61,0x74,0x65,
-0x6e,0x61,0x74,0x69,0x6f,0x6e,0x6d,0x61,0x72,0x6b,0x9f,0x10,0x74,2,0x73,0x2c,
-0x74,0x30,0x77,0x10,0x73,0x77,0x11,0x79,0x6e,0x75,0x12,0x65,0x72,0x6e,1,0x73,
-0x38,0x77,0x18,0x68,0x69,0x74,0x65,0x73,0x70,0x61,0x63,0x65,0x77,0x14,0x79,0x6e,
-0x74,0x61,0x78,0x75,0x10,0x6d,0x9f,1,0x6d,0x3c,0x75,0x1a,0x6f,0x74,0x61,0x74,
-0x69,0x6f,0x6e,0x6d,0x61,0x72,0x6b,0x53,0x12,0x61,0x72,0x6b,0x53,0x66,0xc1,0xf8,
-0x69,0xc1,0x3c,0x69,0xa2,0x6f,0x6a,0xa4,9,0x6c,4,0x62,0xc3,8,0x63,0x8c,
-0x65,0x98,0x69,0xa2,0x56,0x6f,2,0x65,0x4b,0x67,0x4c,0x77,0x11,0x65,0x72,0x4c,
-0x13,0x63,0x61,0x73,0x65,0x4c,0x16,0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40,
-4,0x11,0x69,0x63,0x1f,0x61,0x6c,0x6f,0x72,0x64,0x65,0x72,0x65,0x78,0x63,0x65,
-0x70,0x74,0x69,0x6f,0x6e,0x4b,0xd8,0x40,4,0x11,0x63,0x63,0xc3,0x10,0x18,0x61,
-0x64,0x63,0x61,0x6e,0x6f,0x6e,0x69,0x63,0x1f,0x61,0x6c,0x63,0x6f,0x6d,0x62,0x69,
-0x6e,0x69,0x6e,0x67,0x63,0x6c,0x61,0x73,0x73,0xc3,0x10,0x16,0x6e,0x65,0x62,0x72,
-0x65,0x61,0x6b,0xc3,8,2,0x64,0x4a,0x6e,0xa2,0x5b,0x73,1,0x63,0xd9,0x40,
-3,0x6f,0x16,0x63,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0xd9,0x40,3,2,0x63,0x80,
-0x65,0x90,0x73,0x40,1,0x62,0x52,0x74,0x46,1,0x61,0x40,0x72,0x1c,0x69,0x6e,
-0x61,0x72,0x79,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x47,0x11,0x72,0x74,0x41,
-0x44,0x1c,0x69,0x6e,0x61,0x72,0x79,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x45,
-0x3e,0x16,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,0x3f,0x10,0x6f,0x42,0x16,0x67,0x72,
-0x61,0x70,0x68,0x69,0x63,0x43,2,0x64,0x2e,0x70,0x86,0x73,0x10,0x63,0xc3,0x17,
-0x11,0x69,0x63,1,0x70,0x46,0x73,0x1e,0x79,0x6c,0x6c,0x61,0x62,0x69,0x63,0x63,
-0x61,0x74,0x65,0x67,0x6f,0x72,0x79,0xc3,0x17,0x10,0x6f,0x1f,0x73,0x69,0x74,0x69,
-0x6f,0x6e,0x61,0x6c,0x63,0x61,0x74,0x65,0x67,0x6f,0x72,0x79,0xc3,0x16,0x10,0x63,
-0xc3,0x16,2,0x67,0xc3,6,0x6f,0x26,0x74,0xc3,7,0x11,0x69,0x6e,1,0x63,
-0x4a,0x69,0x11,0x6e,0x67,1,0x67,0x2e,0x74,0x12,0x79,0x70,0x65,0xc3,7,0x13,
-0x72,0x6f,0x75,0x70,0xc3,6,0x48,0x15,0x6f,0x6e,0x74,0x72,0x6f,0x6c,0x49,0x66,
-0x86,0x67,0xa2,0x4a,0x68,3,0x61,0x36,0x65,0x58,0x73,0x68,0x79,0x13,0x70,0x68,
-0x65,0x6e,0x3d,0x1f,0x6e,0x67,0x75,0x6c,0x73,0x79,0x6c,0x6c,0x61,0x62,0x6c,0x65,
-0x74,0x79,0x70,0x65,0xc3,0xb,0x10,0x78,0x3a,0x14,0x64,0x69,0x67,0x69,0x74,0x3b,
-0x10,0x74,0xc3,0xb,0x16,0x75,0x6c,0x6c,0x63,0x6f,0x6d,0x70,0x1f,0x6f,0x73,0x69,
-0x74,0x69,0x6f,0x6e,0x65,0x78,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x33,2,0x63,
-0xa2,0x44,0x65,0xa2,0x4b,0x72,3,0x61,0x34,0x62,0x84,0x65,0x8a,0x6c,0x12,0x69,
-0x6e,0x6b,0x39,0x11,0x70,0x68,0x7c,0x12,0x65,0x6d,0x65,3,0x62,0x5e,0x63,0x30,
-0x65,0x48,0x6c,0x12,0x69,0x6e,0x6b,0x39,0x1a,0x6c,0x75,0x73,0x74,0x65,0x72,0x62,
-0x72,0x65,0x61,0x6b,0xc3,0x12,0x14,0x78,0x74,0x65,0x6e,0x64,0x37,0x12,0x61,0x73,
-0x65,0x35,0x11,0x78,0x74,0x37,0xc2,5,1,0x62,0xc3,0x12,0x6d,0xd9,0x20,0,
-0x1c,0x6e,0x65,0x72,0x61,0x6c,0x63,0x61,0x74,0x65,0x67,0x6f,0x72,0x79,0xc2,5,
-0x13,0x6d,0x61,0x73,0x6b,0xd9,0x20,0,0x61,0xa2,0x90,0x62,0xa2,0xbe,0x63,0xa4,
-0x30,0x64,0xa4,0xfd,0x65,5,0x6d,0x63,0x6d,0x6e,0x70,0xa2,0x59,0x78,0x10,0x74,
-0x30,1,0x65,0x2c,0x70,0x12,0x69,0x63,0x74,0xa1,0x12,0x6e,0x64,0x65,1,0x64,
-0x24,0x72,0x31,0x1b,0x70,0x69,0x63,0x74,0x6f,0x67,0x72,0x61,0x70,0x68,0x69,0x63,
-0xa1,0x10,0x6f,1,0x64,0x97,0x6a,0x10,0x69,0x92,2,0x63,0x40,0x6d,0x50,0x70,
-0x1a,0x72,0x65,0x73,0x65,0x6e,0x74,0x61,0x74,0x69,0x6f,0x6e,0x95,0x17,0x6f,0x6d,
-0x70,0x6f,0x6e,0x65,0x6e,0x74,0x9b,0x16,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,0x96,
-0x13,0x62,0x61,0x73,0x65,0x99,0x12,0x72,0x65,0x73,0x95,0x61,0x30,0x62,0x4e,0x63,
-0x12,0x6f,0x6d,0x70,0x9b,0xc2,4,0x1b,0x73,0x74,0x61,0x73,0x69,0x61,0x6e,0x77,
-0x69,0x64,0x74,0x68,0xc3,4,0x12,0x61,0x73,0x65,0x99,3,0x67,0x44,0x68,0x4a,
-0x6c,0x4e,0x73,0x1a,0x63,0x69,0x69,0x68,0x65,0x78,0x64,0x69,0x67,0x69,0x74,0x23,
-0x10,0x65,0xd9,0x40,0,0x11,0x65,0x78,0x23,1,0x6e,0x38,0x70,0x11,0x68,0x61,
-0x20,0x14,0x62,0x65,0x74,0x69,0x63,0x21,0x11,0x75,0x6d,0x79,4,0x63,0xc3,0,
-0x69,0x3e,0x6c,0xa2,0x57,0x6d,0xa2,0x64,0x70,1,0x62,0xd9,0x40,0xd,0x74,0xc3,
-0x15,0x11,0x64,0x69,2,0x63,0x54,0x6d,0x74,0x70,0x1b,0x61,0x69,0x72,0x65,0x64,
-0x62,0x72,0x61,0x63,0x6b,0x65,0x74,0xd8,0x40,0xd,0x13,0x74,0x79,0x70,0x65,0xc3,
-0x15,0x24,1,0x6c,0x30,0x6f,0x14,0x6e,0x74,0x72,0x6f,0x6c,0x25,0x12,0x61,0x73,
-0x73,0xc3,0,0x26,0x14,0x69,0x72,0x72,0x6f,0x72,1,0x65,0x38,0x69,0x16,0x6e,
-0x67,0x67,0x6c,0x79,0x70,0x68,0xd9,0x40,1,0x10,0x64,0x27,2,0x61,0x32,0x6b,
-0xc3,1,0x6f,0x11,0x63,0x6b,0xc3,1,0x11,0x6e,0x6b,0x7b,0x10,0x67,0xd9,0x40,
-1,6,0x68,0x7c,0x68,0x54,0x69,0x85,0x6f,0xa2,0x6f,0x77,4,0x63,0x30,0x6b,
-0x36,0x6c,0x87,0x74,0x8b,0x75,0x89,1,0x66,0x8d,0x6d,0x8f,0x11,0x63,0x66,0x91,
-0x18,0x61,0x6e,0x67,0x65,0x73,0x77,0x68,0x65,0x6e,4,0x63,0x44,0x6c,0x6c,0x6e,
-0x7e,0x74,0x98,0x75,0x18,0x70,0x70,0x65,0x72,0x63,0x61,0x73,0x65,0x64,0x89,0x12,
-0x61,0x73,0x65,1,0x66,0x30,0x6d,0x14,0x61,0x70,0x70,0x65,0x64,0x8f,0x14,0x6f,
-0x6c,0x64,0x65,0x64,0x8d,0x18,0x6f,0x77,0x65,0x72,0x63,0x61,0x73,0x65,0x64,0x87,
-0x1c,0x66,0x6b,0x63,0x63,0x61,0x73,0x65,0x66,0x6f,0x6c,0x64,0x65,0x64,0x91,0x18,
-0x69,0x74,0x6c,0x65,0x63,0x61,0x73,0x65,0x64,0x8b,0x13,0x6d,0x70,0x65,0x78,0x33,
-0x61,0x2e,0x63,0xa2,0x48,0x66,0xd9,0x40,2,1,0x6e,0x72,0x73,0x10,0x65,3,
-0x64,0x83,0x66,0x3a,0x69,0x4a,0x73,0x17,0x65,0x6e,0x73,0x69,0x74,0x69,0x76,0x65,
-0x65,0x15,0x6f,0x6c,0x64,0x69,0x6e,0x67,0xd9,0x40,2,0x17,0x67,0x6e,0x6f,0x72,
-0x61,0x62,0x6c,0x65,0x85,0x13,0x6f,0x6e,0x69,0x63,0x1f,0x61,0x6c,0x63,0x6f,0x6d,
-0x62,0x69,0x6e,0x69,0x6e,0x67,0x63,0x6c,0x61,0x73,0x73,0xc3,2,0x10,0x63,0xc3,
-2,3,0x61,0x30,0x65,0x34,0x69,0xa2,0x41,0x74,0xc3,3,0x11,0x73,0x68,0x29,
-2,0x63,0x3a,0x66,0x58,0x70,0x2c,0x16,0x72,0x65,0x63,0x61,0x74,0x65,0x64,0x2d,
-0x1d,0x6f,0x6d,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x74,0x79,0x70,0x65,0xc3,
-3,0x15,0x61,0x75,0x6c,0x74,0x69,0x67,0x1f,0x6e,0x6f,0x72,0x61,0x62,0x6c,0x65,
-0x63,0x6f,0x64,0x65,0x70,0x6f,0x69,0x6e,0x74,0x2b,0x2a,0x10,0x61,0x2e,0x15,0x63,
-0x72,0x69,0x74,0x69,0x63,0x2f,3,0x66,0x34,0x6e,0x3e,0x74,0x42,0x79,0x22,0x11,
-0x65,0x73,0x23,0x20,0x13,0x61,0x6c,0x73,0x65,0x21,0x20,0x10,0x6f,0x21,0x22,0x12,
-0x72,0x75,0x65,0x23,0xb,0x6b,0x5b,0x6f,0x23,0x6f,0x3c,0x72,0x4c,0x76,1,0x69,
-0x24,0x72,0x33,0x13,0x72,0x61,0x6d,0x61,0x33,0x10,0x76,0x22,0x14,0x65,0x72,0x6c,
-0x61,0x79,0x23,0xa2,0xe2,0x13,0x69,0x67,0x68,0x74,0xa3,0xe2,0x6b,0x58,0x6c,0x74,
-0x6e,3,0x6b,0x2f,0x6f,0x30,0x72,0x21,0x75,0x12,0x6b,0x74,0x61,0x2f,0x19,0x74,
-0x72,0x65,0x6f,0x72,0x64,0x65,0x72,0x65,0x64,0x21,1,0x61,0x24,0x76,0x31,0x18,
-0x6e,0x61,0x76,0x6f,0x69,0x63,0x69,0x6e,0x67,0x31,0xa2,0xe0,0x12,0x65,0x66,0x74,
-0xa3,0xe0,0x64,0x45,0x64,0x4e,0x68,0x88,0x69,1,0x6f,0x26,0x73,0xa3,0xf0,0x1a,
-0x74,0x61,0x73,0x75,0x62,0x73,0x63,0x72,0x69,0x70,0x74,0xa3,0xf0,2,0x61,0xa3,
-0xea,0x62,0xa3,0xe9,0x6f,0x13,0x75,0x62,0x6c,0x65,1,0x61,0x30,0x62,0x13,0x65,
-0x6c,0x6f,0x77,0xa3,0xe9,0x13,0x62,0x6f,0x76,0x65,0xa3,0xea,0x12,0x61,0x6e,0x72,
-0x2c,0x15,0x65,0x61,0x64,0x69,0x6e,0x67,0x2d,0x61,0xa2,0x7b,0x62,0xa2,0xd4,0x63,
-0x11,0x63,0x63,4,0x31,0x3c,0x32,0xa2,0x42,0x33,0xa2,0x56,0x38,0xa2,0x64,0x39,
-0x10,0x31,0xa3,0x5b,9,0x35,0xa,0x35,0x3f,0x36,0x41,0x37,0x43,0x38,0x45,0x39,
-0x47,0x30,0x30,0x31,0x3c,0x32,0x42,0x33,0x4e,0x34,0x3d,0x34,1,0x33,0xa3,0x67,
-0x37,0xa3,0x6b,0x36,0x10,0x38,0xa3,0x76,0x38,1,0x32,0xa3,0x7a,0x39,0xa3,0x81,
-0x3a,2,0x30,0xa3,0x82,0x32,0xa3,0x84,0x33,0xa3,0x85,9,0x35,0xa,0x35,0x53,
-0x36,0x55,0x37,0x57,0x38,0x59,0x39,0x5b,0x30,0x49,0x31,0x4b,0x32,0x4d,0x33,0x4f,
-0x34,0x51,6,0x33,8,0x33,0x63,0x34,0x65,0x35,0x67,0x36,0x69,0x30,0x5d,0x31,
-0x5f,0x32,0x61,0x10,0x34,0xa3,0x54,0xa2,0xe6,3,0x62,0xa0,0x6c,0xa3,0xe4,0x72,
-0xa3,0xe8,0x74,2,0x61,0x74,0x62,0x7c,0x74,0x14,0x61,0x63,0x68,0x65,0x64,1,
-0x61,0x3e,0x62,0x13,0x65,0x6c,0x6f,0x77,0xa2,0xca,0x13,0x6c,0x65,0x66,0x74,0xa3,
-0xc8,0x13,0x62,0x6f,0x76,0x65,0xa2,0xd6,0x14,0x72,0x69,0x67,0x68,0x74,0xa3,0xd8,
-0xa2,0xd6,0x10,0x72,0xa3,0xd8,0xa2,0xca,0x10,0x6c,0xa3,0xc8,0x12,0x6f,0x76,0x65,
-0xa2,0xe6,1,0x6c,0x30,0x72,0x13,0x69,0x67,0x68,0x74,0xa3,0xe8,0x12,0x65,0x66,
-0x74,0xa3,0xe4,0xa2,0xdc,2,0x65,0x2c,0x6c,0xa3,0xda,0x72,0xa3,0xde,0x12,0x6c,
-0x6f,0x77,0xa2,0xdc,1,0x6c,0x30,0x72,0x13,0x69,0x67,0x68,0x74,0xa3,0xde,0x12,
-0x65,0x66,0x74,0xa3,0xda,0xb,0x6e,0xc0,0xca,0x72,0x5f,0x72,0x46,0x73,0xa2,0x48,
-0x77,1,0x68,0x24,0x73,0x33,0x17,0x69,0x74,0x65,0x73,0x70,0x61,0x63,0x65,0x33,
-0x22,1,0x69,0x30,0x6c,2,0x65,0x3d,0x69,0x4b,0x6f,0x3f,0x18,0x67,0x68,0x74,
-0x74,0x6f,0x6c,0x65,0x66,0x74,0x22,2,0x65,0x38,0x69,0x48,0x6f,0x16,0x76,0x65,
-0x72,0x72,0x69,0x64,0x65,0x3f,0x17,0x6d,0x62,0x65,0x64,0x64,0x69,0x6e,0x67,0x3d,
-0x15,0x73,0x6f,0x6c,0x61,0x74,0x65,0x4b,0x30,0x1e,0x65,0x67,0x6d,0x65,0x6e,0x74,
-0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0x31,0x6e,0xa2,0x41,0x6f,0xa2,0x53,
-0x70,2,0x61,0x66,0x64,0x86,0x6f,0x1b,0x70,0x64,0x69,0x72,0x65,0x63,0x74,0x69,
-0x6f,0x6e,0x61,0x6c,1,0x66,0x32,0x69,0x15,0x73,0x6f,0x6c,0x61,0x74,0x65,0x4d,
-0x14,0x6f,0x72,0x6d,0x61,0x74,0x41,0x1f,0x72,0x61,0x67,0x72,0x61,0x70,0x68,0x73,
-0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0x2f,1,0x66,0x41,0x69,0x4d,1,0x6f,
-0x28,0x73,0x10,0x6d,0x43,0x1b,0x6e,0x73,0x70,0x61,0x63,0x69,0x6e,0x67,0x6d,0x61,
-0x72,0x6b,0x43,1,0x6e,0x35,0x74,0x19,0x68,0x65,0x72,0x6e,0x65,0x75,0x74,0x72,
-0x61,0x6c,0x35,0x65,0x88,0x65,0x98,0x66,0xa2,0x6a,0x6c,0x20,1,0x65,0x30,0x72,
-2,0x65,0x37,0x69,0x49,0x6f,0x39,0x18,0x66,0x74,0x74,0x6f,0x72,0x69,0x67,0x68,
-0x74,0x20,2,0x65,0x38,0x69,0x48,0x6f,0x16,0x76,0x65,0x72,0x72,0x69,0x64,0x65,
-0x39,0x17,0x6d,0x62,0x65,0x64,0x64,0x69,0x6e,0x67,0x37,0x15,0x73,0x6f,0x6c,0x61,
-0x74,0x65,0x49,3,0x6e,0x25,0x73,0x27,0x74,0x29,0x75,0x15,0x72,0x6f,0x70,0x65,
-0x61,0x6e,2,0x6e,0x3c,0x73,0x46,0x74,0x18,0x65,0x72,0x6d,0x69,0x6e,0x61,0x74,
-0x6f,0x72,0x29,0x14,0x75,0x6d,0x62,0x65,0x72,0x25,0x17,0x65,0x70,0x61,0x72,0x61,
-0x74,0x6f,0x72,0x27,1,0x69,0x28,0x73,0x10,0x69,0x47,0x1f,0x72,0x73,0x74,0x73,
-0x74,0x72,0x6f,0x6e,0x67,0x69,0x73,0x6f,0x6c,0x61,0x74,0x65,0x47,0x61,0x4e,0x62,
-0x84,0x63,1,0x6f,0x24,0x73,0x2d,0x1c,0x6d,0x6d,0x6f,0x6e,0x73,0x65,0x70,0x61,
-0x72,0x61,0x74,0x6f,0x72,0x2d,2,0x6c,0x3b,0x6e,0x2b,0x72,0x13,0x61,0x62,0x69,
-0x63,1,0x6c,0x30,0x6e,0x14,0x75,0x6d,0x62,0x65,0x72,0x2b,0x14,0x65,0x74,0x74,
-0x65,0x72,0x3b,0x2e,1,0x6e,0x45,0x6f,0x1c,0x75,0x6e,0x64,0x61,0x72,0x79,0x6e,
-0x65,0x75,0x74,0x72,0x61,0x6c,0x45,0,0x16,0x6d,0xc8,0xc8,0x74,0xc1,0xee,0x77,
-0x6a,0x77,0x48,0x79,0x70,0x7a,0x1d,0x61,0x6e,0x61,0x62,0x61,0x7a,0x61,0x72,0x73,
-0x71,0x75,0x61,0x72,0x65,0xa5,0x18,0x10,0x61,1,0x6e,0x36,0x72,0x16,0x61,0x6e,
-0x67,0x63,0x69,0x74,0x69,0xa3,0xfc,0x12,0x63,0x68,0x6f,0xa5,0x2c,1,0x65,0x88,
-0x69,2,0x6a,0x3c,0x72,0x68,0x73,0x17,0x79,0x6c,0x6c,0x61,0x62,0x6c,0x65,0x73,
-0xa3,0x48,0x12,0x69,0x6e,0x67,0xa2,0x74,0x1e,0x68,0x65,0x78,0x61,0x67,0x72,0x61,
-0x6d,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0x74,0x16,0x61,0x64,0x69,0x63,0x61,
-0x6c,0x73,0xa3,0x49,0x13,0x7a,0x69,0x64,0x69,0xa5,0x34,0x74,0xa2,0x59,0x75,0xa4,
-0x35,0x76,2,0x61,0x36,0x65,0x7a,0x73,0xa2,0x6c,0x12,0x73,0x75,0x70,0xa3,0x7d,
-1,0x69,0xa3,0x9f,0x72,0x1e,0x69,0x61,0x74,0x69,0x6f,0x6e,0x73,0x65,0x6c,0x65,
-0x63,0x74,0x6f,0x72,0x73,0xa2,0x6c,0x19,0x73,0x75,0x70,0x70,0x6c,0x65,0x6d,0x65,
-0x6e,0x74,0xa3,0x7d,1,0x64,0x3c,0x72,0x19,0x74,0x69,0x63,0x61,0x6c,0x66,0x6f,
-0x72,0x6d,0x73,0xa3,0x91,0x14,0x69,0x63,0x65,0x78,0x74,0xa2,0xaf,0x16,0x65,0x6e,
-0x73,0x69,0x6f,0x6e,0x73,0xa3,0xaf,4,0x61,0x68,0x65,0xa2,0xad,0x68,0xa2,0xb0,
-0x69,0xa2,0xb8,0x72,0x1c,0x61,0x6e,0x73,0x70,0x6f,0x72,0x74,0x61,0x6e,0x64,0x6d,
-0x61,0x70,0xa2,0xcf,0x16,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0xcf,4,0x67,
-0x7e,0x69,0xa2,0x41,0x6b,0xa2,0x6a,0x6d,0xa2,0x6c,0x6e,0x12,0x67,0x75,0x74,0xa4,
-0x10,1,0x63,0x40,0x73,0x11,0x75,0x70,0xa4,0x33,0x16,0x70,0x6c,0x65,0x6d,0x65,
-0x6e,0x74,0xa5,0x33,0x18,0x6f,0x6d,0x70,0x6f,0x6e,0x65,0x6e,0x74,0x73,0xa5,0x11,
-2,0x61,0x2a,0x62,0x32,0x73,0xa3,0x60,0x12,0x6c,0x6f,0x67,0xa3,0x62,0x13,0x61,
-0x6e,0x77,0x61,0xa3,0x65,3,0x6c,0x52,0x74,0x56,0x76,0x5e,0x78,0x16,0x75,0x61,
-0x6e,0x6a,0x69,0x6e,0x67,0xa2,0x7c,0x16,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,
-0x7c,0x10,0x65,0xa3,0x70,0x12,0x68,0x61,0x6d,0xa3,0xae,0x12,0x69,0x65,0x74,0xa3,
-0xb7,0x11,0x72,0x69,0xa3,0xdc,0x11,0x69,0x6c,0x48,0x12,0x73,0x75,0x70,0xa4,0x2b,
-0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0x2b,0x13,0x6c,0x75,0x67,0x75,0x4b,
-0x10,0x61,1,0x61,0x24,0x69,0x53,0x11,0x6e,0x61,0x3d,2,0x62,0x34,0x66,0x3c,
-0x72,0x13,0x68,0x75,0x74,0x61,0xa3,0xfb,0x13,0x65,0x74,0x61,0x6e,0x57,0x14,0x69,
-0x6e,0x61,0x67,0x68,0xa3,0x90,2,0x63,0x82,0x67,0x92,0x6e,0x1f,0x69,0x66,0x69,
-0x65,0x64,0x63,0x61,0x6e,0x61,0x64,0x69,0x61,0x6e,0x61,0x62,0x6f,0x1f,0x72,0x69,
-0x67,0x69,0x6e,0x61,0x6c,0x73,0x79,0x6c,0x6c,0x61,0x62,0x69,0x63,0x73,0x62,0x17,
-0x65,0x78,0x74,0x65,0x6e,0x64,0x65,0x64,0xa3,0xad,0x11,0x61,0x73,0x62,0x12,0x65,
-0x78,0x74,0xa3,0xad,0x15,0x61,0x72,0x69,0x74,0x69,0x63,0xa3,0x78,0x70,0xc3,0x4b,
-0x70,0xa6,0x61,0x72,0xa8,0x1d,0x73,7,0x6f,0xc1,0xbe,0x6f,0xa2,0x69,0x70,0xa2,
-0x85,0x75,0xa2,0xa4,0x79,2,0x6c,0x50,0x6d,0x62,0x72,0x12,0x69,0x61,0x63,0x3a,
-0x12,0x73,0x75,0x70,0xa4,0x17,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0x17,
-0x17,0x6f,0x74,0x69,0x6e,0x61,0x67,0x72,0x69,0xa3,0x8f,0x13,0x62,0x6f,0x6c,0x73,
-1,0x61,0x4c,0x66,0x10,0x6f,0x1f,0x72,0x6c,0x65,0x67,0x61,0x63,0x79,0x63,0x6f,
-0x6d,0x70,0x75,0x74,0x69,0x6e,0x67,0xa5,0x32,0x1f,0x6e,0x64,0x70,0x69,0x63,0x74,
-0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0x65,0x78,0x74,1,0x61,0xa5,0x2a,0x65,0x14,
-0x6e,0x64,0x65,0x64,0x61,0xa5,0x2a,2,0x67,0x34,0x72,0x3e,0x79,0x13,0x6f,0x6d,
-0x62,0x6f,0xa5,0x16,0x13,0x64,0x69,0x61,0x6e,0xa5,0x23,0x17,0x61,0x73,0x6f,0x6d,
-0x70,0x65,0x6e,0x67,0xa3,0xda,1,0x61,0x32,0x65,0x14,0x63,0x69,0x61,0x6c,0x73,
-0xa3,0x56,0x12,0x63,0x69,0x6e,0x1f,0x67,0x6d,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,
-0x6c,0x65,0x74,0x74,0x65,0x72,0x73,0x2d,2,0x6e,0x48,0x70,0x76,0x74,0x1d,0x74,
-0x6f,0x6e,0x73,0x69,0x67,0x6e,0x77,0x72,0x69,0x74,0x69,0x6e,0x67,0xa5,6,0x15,
-0x64,0x61,0x6e,0x65,0x73,0x65,0xa2,0x9b,0x12,0x73,0x75,0x70,0xa2,0xdb,0x16,0x70,
-0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xdb,4,0x61,0xa2,0xa8,0x65,0x5c,0x6d,0x9e,
-0x70,0xa2,0x4b,0x73,0x13,0x79,0x6d,0x62,0x6f,0x1f,0x6c,0x73,0x61,0x6e,0x64,0x70,
-0x69,0x63,0x74,0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0xa5,5,0x10,0x72,1,0x61,
-0x4e,0x73,0x12,0x63,0x72,0x69,0x1f,0x70,0x74,0x73,0x61,0x6e,0x64,0x73,0x75,0x62,
-0x73,0x63,0x72,0x69,0x70,0x74,0x73,0x73,0x14,0x6e,0x64,0x73,0x75,0x62,0x73,0x1b,
-0x61,0x74,0x68,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x73,0xa3,0x6a,1,0x6c,
-0x40,0x75,1,0x61,0x6e,0x6e,0x17,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xa3,
-0x8e,0x15,0x65,0x6d,0x65,0x6e,0x74,0x61,1,0x6c,0x50,0x72,0x1e,0x79,0x70,0x72,
-0x69,0x76,0x61,0x74,0x65,0x75,0x73,0x65,0x61,0x72,0x65,0x61,1,0x61,0xa3,0x6d,
-0x62,0xa3,0x6e,3,0x61,0x5c,0x6d,0x78,0x70,0xa2,0x41,0x73,0x13,0x79,0x6d,0x62,
-0x6f,0x1f,0x6c,0x73,0x61,0x6e,0x64,0x70,0x69,0x63,0x74,0x6f,0x67,0x72,0x61,0x70,
-0x68,0x73,0xa5,5,0x14,0x72,0x72,0x6f,0x77,0x73,2,0x61,0xa3,0x67,0x62,0xa3,
-0x68,0x63,0xa3,0xfa,0x13,0x61,0x74,0x68,0x65,0x1f,0x6d,0x61,0x74,0x69,0x63,0x61,
-0x6c,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x73,0xa3,0x6a,0x19,0x75,0x6e,0x63,
-0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xa3,0x8e,0x61,0x88,0x68,0xa2,0x48,0x69,0xa2,
-0x71,0x6d,0x12,0x61,0x6c,0x6c,1,0x66,0x46,0x6b,0x15,0x61,0x6e,0x61,0x65,0x78,
-0x74,0xa4,0x29,0x15,0x65,0x6e,0x73,0x69,0x6f,0x6e,0xa5,0x29,0x12,0x6f,0x72,0x6d,
-1,0x73,0xa3,0x54,0x76,0x16,0x61,0x72,0x69,0x61,0x6e,0x74,0x73,0xa3,0x54,1,
-0x6d,0x36,0x75,0x16,0x72,0x61,0x73,0x68,0x74,0x72,0x61,0xa3,0xa1,0x15,0x61,0x72,
-0x69,0x74,0x61,0x6e,0xa3,0xac,1,0x61,0x52,0x6f,0x13,0x72,0x74,0x68,0x61,0x1f,
-0x6e,0x64,0x66,0x6f,0x72,0x6d,0x61,0x74,0x63,0x6f,0x6e,0x74,0x72,0x6f,0x6c,0x73,
-0xa3,0xf7,1,0x72,0x2e,0x76,0x12,0x69,0x61,0x6e,0xa3,0x79,0x12,0x61,0x64,0x61,
-0xa3,0xd9,1,0x64,0x50,0x6e,0x13,0x68,0x61,0x6c,0x61,0x50,0x1d,0x61,0x72,0x63,
-0x68,0x61,0x69,0x63,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,0xa3,0xf9,0x13,0x64,0x68,
-0x61,0x6d,0xa3,0xf8,5,0x72,0x35,0x72,0x44,0x73,0x64,0x75,1,0x61,0xa3,0x4e,
-0x6e,0x17,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x71,0x17,0x69,0x76,0x61,0x74,
-0x65,0x75,0x73,0x65,0xa2,0x4e,0x13,0x61,0x72,0x65,0x61,0xa3,0x4e,0x1b,0x61,0x6c,
-0x74,0x65,0x72,0x70,0x61,0x68,0x6c,0x61,0x76,0x69,0xa3,0xf6,0x61,0x40,0x68,0x82,
-0x6c,0x19,0x61,0x79,0x69,0x6e,0x67,0x63,0x61,0x72,0x64,0x73,0xa3,0xcc,2,0x68,
-0x38,0x6c,0x4a,0x75,0x15,0x63,0x69,0x6e,0x68,0x61,0x75,0xa3,0xf5,0x17,0x61,0x77,
-0x68,0x68,0x6d,0x6f,0x6e,0x67,0xa3,0xf3,0x15,0x6d,0x79,0x72,0x65,0x6e,0x65,0xa3,
-0xf4,1,0x61,0x8e,0x6f,1,0x65,0x74,0x6e,0x16,0x65,0x74,0x69,0x63,0x65,0x78,
-0x74,0xa2,0x72,1,0x65,0x2c,0x73,0x11,0x75,0x70,0xa3,0x8d,0x15,0x6e,0x73,0x69,
-0x6f,0x6e,0x73,0xa2,0x72,0x19,0x73,0x75,0x70,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,
-0xa3,0x8d,0x15,0x6e,0x69,0x63,0x69,0x61,0x6e,0xa3,0x97,1,0x67,0x3e,0x69,0x13,
-0x73,0x74,0x6f,0x73,0xa2,0xa6,0x13,0x64,0x69,0x73,0x63,0xa3,0xa6,0x12,0x73,0x70,
-0x61,0xa3,0x96,1,0x65,0x5c,0x75,1,0x6d,0x2a,0x6e,0x11,0x69,0x63,0x67,0x10,
+const uint8_t PropNameData::bytesTries[14992]={
+0,0x15,0x6d,0xc3,0x78,0x73,0xc2,0x12,0x76,0x7a,0x76,0x6a,0x77,0xa2,0x52,0x78,
+1,0x64,0x50,0x69,0x10,0x64,1,0x63,0x30,0x73,0x62,0x13,0x74,0x61,0x72,0x74,
+0x63,0x60,0x16,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,0x61,0x13,0x69,0x67,0x69,0x74,
+0x81,3,0x61,0x2e,0x65,0x4c,0x6f,0xc3,0x18,0x73,0x69,0x1e,0x72,0x69,0x61,0x74,
+0x69,0x6f,0x6e,0x73,0x65,0x6c,0x65,0x63,0x74,0x6f,0x72,0x69,0x10,0x72,0x1f,0x74,
+0x69,0x63,0x61,0x6c,0x6f,0x72,0x69,0x65,0x6e,0x74,0x61,0x74,0x69,0x6f,0x6e,0xc3,
+0x18,3,0x62,0xc3,0x14,0x68,0x32,0x6f,0x42,0x73,0x13,0x70,0x61,0x63,0x65,0x5f,
+0x17,0x69,0x74,0x65,0x73,0x70,0x61,0x63,0x65,0x5f,0x16,0x72,0x64,0x62,0x72,0x65,
+0x61,0x6b,0xc3,0x14,0x73,0xa2,0x49,0x74,0xa4,0x3b,0x75,3,0x63,0xd9,0x40,0xc,
+0x69,0x52,0x6e,0x58,0x70,0x12,0x70,0x65,0x72,0x5c,0x13,0x63,0x61,0x73,0x65,0x5c,
+0x16,0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40,0xc,0x12,0x64,0x65,0x6f,0x5b,
+0x10,0x69,1,0x63,0x3e,0x66,0x1b,0x69,0x65,0x64,0x69,0x64,0x65,0x6f,0x67,0x72,
+0x61,0x70,0x68,0x5b,0x17,0x6f,0x64,0x65,0x31,0x6e,0x61,0x6d,0x65,0xd9,0x40,0xb,
+0xa,0x69,0x84,0x70,0x19,0x70,0x30,0x74,0x36,0x75,0x10,0x63,0xd9,0x40,9,0x12,
+0x61,0x63,0x65,0x5f,1,0x63,0xd9,0x40,8,0x65,0x11,0x72,0x6d,0x67,0x69,0x3c,
+0x6c,0xa2,0x5f,0x6f,0x17,0x66,0x74,0x64,0x6f,0x74,0x74,0x65,0x64,0x57,0x13,0x6d,
+0x70,0x6c,0x65,3,0x63,0x50,0x6c,0x68,0x74,0x8a,0x75,0x1e,0x70,0x70,0x65,0x72,
+0x63,0x61,0x73,0x65,0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40,9,0x19,0x61,
+0x73,0x65,0x66,0x6f,0x6c,0x64,0x69,0x6e,0x67,0xd9,0x40,6,0x1e,0x6f,0x77,0x65,
+0x72,0x63,0x61,0x73,0x65,0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40,7,0x1e,
+0x69,0x74,0x6c,0x65,0x63,0x61,0x73,0x65,0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,
+0x40,8,0x10,0x63,0xd9,0x40,7,0x62,0xc3,0x13,0x63,0x34,0x64,0x57,0x65,0x6e,
+0x66,0x10,0x63,0xd9,0x40,6,0xc2,0xa,2,0x66,0xd9,0x40,6,0x72,0x28,0x78,
+0xd9,0x70,0,0x12,0x69,0x70,0x74,0xc2,0xa,0x19,0x65,0x78,0x74,0x65,0x6e,0x73,
+0x69,0x6f,0x6e,0x73,0xd9,0x70,0,1,0x67,0x6a,0x6e,1,0x73,0x54,0x74,0x13,
+0x65,0x6e,0x63,0x65,1,0x62,0x34,0x74,0x16,0x65,0x72,0x6d,0x69,0x6e,0x61,0x6c,
+0x67,0x13,0x72,0x65,0x61,0x6b,0xc3,0x13,0x14,0x69,0x74,0x69,0x76,0x65,0x65,1,
+0x6d,0x2e,0x73,0x13,0x74,0x61,0x72,0x74,0x73,0x19,0x65,0x6e,0x74,0x73,0x74,0x61,
+0x72,0x74,0x65,0x72,0x73,3,0x63,0x66,0x65,0x72,0x69,0x98,0x72,0x19,0x61,0x69,
+0x6c,0x63,0x61,0x6e,0x6f,0x6e,0x69,0x63,0x1f,0x61,0x6c,0x63,0x6f,0x6d,0x62,0x69,
+0x6e,0x69,0x6e,0x67,0x63,0x6c,0x61,0x73,0x73,0xc3,0x11,0xd8,0x40,0xa,0x11,0x63,
+0x63,0xc3,0x11,0x11,0x72,0x6d,0x58,0x1e,0x69,0x6e,0x61,0x6c,0x70,0x75,0x6e,0x63,
+0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x59,0x1d,0x74,0x6c,0x65,0x63,0x61,0x73,0x65,
+0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40,0xa,0x6d,0x70,0x6e,0x76,0x70,0xa2,
+0xf1,0x71,0xa4,0x43,0x72,2,0x61,0x28,0x65,0x32,0x69,0x9d,0x14,0x64,0x69,0x63,
+0x61,0x6c,0x55,0x1e,0x67,0x69,0x6f,0x6e,0x61,0x6c,0x69,0x6e,0x64,0x69,0x63,0x61,
+0x74,0x6f,0x72,0x9d,0x12,0x61,0x74,0x68,0x4f,6,0x6f,0x39,0x6f,0x32,0x74,0xc3,
+9,0x75,0x54,0x76,0xd9,0x30,0,0x12,0x6e,0x63,0x68,0x1f,0x61,0x72,0x61,0x63,
+0x74,0x65,0x72,0x63,0x6f,0x64,0x65,0x70,0x6f,0x69,0x6e,0x74,0x51,0x14,0x6d,0x65,
+0x72,0x69,0x63,1,0x74,0x32,0x76,0x13,0x61,0x6c,0x75,0x65,0xd9,0x30,0,0x12,
+0x79,0x70,0x65,0xc3,9,0x61,0xa2,0x77,0x63,0xa2,0x82,0x66,2,0x63,0x98,0x64,
+0xa2,0x53,0x6b,1,0x63,0x56,0x64,1,0x69,0x42,0x71,1,0x63,0xc3,0xd,0x75,
+0x17,0x69,0x63,0x6b,0x63,0x68,0x65,0x63,0x6b,0xc3,0xd,0x13,0x6e,0x65,0x72,0x74,
+0x6d,1,0x69,0x42,0x71,1,0x63,0xc3,0xf,0x75,0x17,0x69,0x63,0x6b,0x63,0x68,
+0x65,0x63,0x6b,0xc3,0xf,0x13,0x6e,0x65,0x72,0x74,0x71,1,0x69,0x42,0x71,1,
+0x63,0xc3,0xe,0x75,0x17,0x69,0x63,0x6b,0x63,0x68,0x65,0x63,0x6b,0xc3,0xe,0x13,
+0x6e,0x65,0x72,0x74,0x6f,1,0x69,0x42,0x71,1,0x63,0xc3,0xc,0x75,0x17,0x69,
+0x63,0x6b,0x63,0x68,0x65,0x63,0x6b,0xc3,0xc,0x13,0x6e,0x65,0x72,0x74,0x6b,0xd8,
+0x40,5,1,0x31,0xd9,0x40,0xb,0x6d,0x10,0x65,0xd9,0x40,5,0x12,0x68,0x61,
+0x72,0x51,2,0x61,0x6c,0x63,0xa2,0x4c,0x72,1,0x65,0x2a,0x69,0x11,0x6e,0x74,
+0x7f,0x16,0x70,0x65,0x6e,0x64,0x65,0x64,0x63,0x1f,0x6f,0x6e,0x63,0x61,0x74,0x65,
+0x6e,0x61,0x74,0x69,0x6f,0x6e,0x6d,0x61,0x72,0x6b,0x9f,0x10,0x74,2,0x73,0x2c,
+0x74,0x30,0x77,0x10,0x73,0x77,0x11,0x79,0x6e,0x75,0x12,0x65,0x72,0x6e,1,0x73,
+0x38,0x77,0x18,0x68,0x69,0x74,0x65,0x73,0x70,0x61,0x63,0x65,0x77,0x14,0x79,0x6e,
+0x74,0x61,0x78,0x75,0x10,0x6d,0x9f,1,0x6d,0x3c,0x75,0x1a,0x6f,0x74,0x61,0x74,
+0x69,0x6f,0x6e,0x6d,0x61,0x72,0x6b,0x53,0x12,0x61,0x72,0x6b,0x53,0x66,0xc1,0xf8,
+0x69,0xc1,0x3c,0x69,0xa2,0x6f,0x6a,0xa4,9,0x6c,4,0x62,0xc3,8,0x63,0x8c,
+0x65,0x98,0x69,0xa2,0x56,0x6f,2,0x65,0x4b,0x67,0x4c,0x77,0x11,0x65,0x72,0x4c,
+0x13,0x63,0x61,0x73,0x65,0x4c,0x16,0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40,
+4,0x11,0x69,0x63,0x1f,0x61,0x6c,0x6f,0x72,0x64,0x65,0x72,0x65,0x78,0x63,0x65,
+0x70,0x74,0x69,0x6f,0x6e,0x4b,0xd8,0x40,4,0x11,0x63,0x63,0xc3,0x10,0x18,0x61,
+0x64,0x63,0x61,0x6e,0x6f,0x6e,0x69,0x63,0x1f,0x61,0x6c,0x63,0x6f,0x6d,0x62,0x69,
+0x6e,0x69,0x6e,0x67,0x63,0x6c,0x61,0x73,0x73,0xc3,0x10,0x16,0x6e,0x65,0x62,0x72,
+0x65,0x61,0x6b,0xc3,8,2,0x64,0x4a,0x6e,0xa2,0x5b,0x73,1,0x63,0xd9,0x40,
+3,0x6f,0x16,0x63,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0xd9,0x40,3,2,0x63,0x80,
+0x65,0x90,0x73,0x40,1,0x62,0x52,0x74,0x46,1,0x61,0x40,0x72,0x1c,0x69,0x6e,
+0x61,0x72,0x79,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x47,0x11,0x72,0x74,0x41,
+0x44,0x1c,0x69,0x6e,0x61,0x72,0x79,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x45,
+0x3e,0x16,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,0x3f,0x10,0x6f,0x42,0x16,0x67,0x72,
+0x61,0x70,0x68,0x69,0x63,0x43,2,0x64,0x2e,0x70,0x86,0x73,0x10,0x63,0xc3,0x17,
+0x11,0x69,0x63,1,0x70,0x46,0x73,0x1e,0x79,0x6c,0x6c,0x61,0x62,0x69,0x63,0x63,
+0x61,0x74,0x65,0x67,0x6f,0x72,0x79,0xc3,0x17,0x10,0x6f,0x1f,0x73,0x69,0x74,0x69,
+0x6f,0x6e,0x61,0x6c,0x63,0x61,0x74,0x65,0x67,0x6f,0x72,0x79,0xc3,0x16,0x10,0x63,
+0xc3,0x16,2,0x67,0xc3,6,0x6f,0x26,0x74,0xc3,7,0x11,0x69,0x6e,1,0x63,
+0x4a,0x69,0x11,0x6e,0x67,1,0x67,0x2e,0x74,0x12,0x79,0x70,0x65,0xc3,7,0x13,
+0x72,0x6f,0x75,0x70,0xc3,6,0x48,0x15,0x6f,0x6e,0x74,0x72,0x6f,0x6c,0x49,0x66,
+0x86,0x67,0xa2,0x4a,0x68,3,0x61,0x36,0x65,0x58,0x73,0x68,0x79,0x13,0x70,0x68,
+0x65,0x6e,0x3d,0x1f,0x6e,0x67,0x75,0x6c,0x73,0x79,0x6c,0x6c,0x61,0x62,0x6c,0x65,
+0x74,0x79,0x70,0x65,0xc3,0xb,0x10,0x78,0x3a,0x14,0x64,0x69,0x67,0x69,0x74,0x3b,
+0x10,0x74,0xc3,0xb,0x16,0x75,0x6c,0x6c,0x63,0x6f,0x6d,0x70,0x1f,0x6f,0x73,0x69,
+0x74,0x69,0x6f,0x6e,0x65,0x78,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x33,2,0x63,
+0xa2,0x44,0x65,0xa2,0x4b,0x72,3,0x61,0x34,0x62,0x84,0x65,0x8a,0x6c,0x12,0x69,
+0x6e,0x6b,0x39,0x11,0x70,0x68,0x7c,0x12,0x65,0x6d,0x65,3,0x62,0x5e,0x63,0x30,
+0x65,0x48,0x6c,0x12,0x69,0x6e,0x6b,0x39,0x1a,0x6c,0x75,0x73,0x74,0x65,0x72,0x62,
+0x72,0x65,0x61,0x6b,0xc3,0x12,0x14,0x78,0x74,0x65,0x6e,0x64,0x37,0x12,0x61,0x73,
+0x65,0x35,0x11,0x78,0x74,0x37,0xc2,5,1,0x62,0xc3,0x12,0x6d,0xd9,0x20,0,
+0x1c,0x6e,0x65,0x72,0x61,0x6c,0x63,0x61,0x74,0x65,0x67,0x6f,0x72,0x79,0xc2,5,
+0x13,0x6d,0x61,0x73,0x6b,0xd9,0x20,0,0x61,0xa2,0x90,0x62,0xa2,0xbe,0x63,0xa4,
+0x30,0x64,0xa4,0xfd,0x65,5,0x6d,0x63,0x6d,0x6e,0x70,0xa2,0x59,0x78,0x10,0x74,
+0x30,1,0x65,0x2c,0x70,0x12,0x69,0x63,0x74,0xa1,0x12,0x6e,0x64,0x65,1,0x64,
+0x24,0x72,0x31,0x1b,0x70,0x69,0x63,0x74,0x6f,0x67,0x72,0x61,0x70,0x68,0x69,0x63,
+0xa1,0x10,0x6f,1,0x64,0x97,0x6a,0x10,0x69,0x92,2,0x63,0x40,0x6d,0x50,0x70,
+0x1a,0x72,0x65,0x73,0x65,0x6e,0x74,0x61,0x74,0x69,0x6f,0x6e,0x95,0x17,0x6f,0x6d,
+0x70,0x6f,0x6e,0x65,0x6e,0x74,0x9b,0x16,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,0x96,
+0x13,0x62,0x61,0x73,0x65,0x99,0x12,0x72,0x65,0x73,0x95,0x61,0x30,0x62,0x4e,0x63,
+0x12,0x6f,0x6d,0x70,0x9b,0xc2,4,0x1b,0x73,0x74,0x61,0x73,0x69,0x61,0x6e,0x77,
+0x69,0x64,0x74,0x68,0xc3,4,0x12,0x61,0x73,0x65,0x99,3,0x67,0x44,0x68,0x4a,
+0x6c,0x4e,0x73,0x1a,0x63,0x69,0x69,0x68,0x65,0x78,0x64,0x69,0x67,0x69,0x74,0x23,
+0x10,0x65,0xd9,0x40,0,0x11,0x65,0x78,0x23,1,0x6e,0x38,0x70,0x11,0x68,0x61,
+0x20,0x14,0x62,0x65,0x74,0x69,0x63,0x21,0x11,0x75,0x6d,0x79,4,0x63,0xc3,0,
+0x69,0x3e,0x6c,0xa2,0x57,0x6d,0xa2,0x64,0x70,1,0x62,0xd9,0x40,0xd,0x74,0xc3,
+0x15,0x11,0x64,0x69,2,0x63,0x54,0x6d,0x74,0x70,0x1b,0x61,0x69,0x72,0x65,0x64,
+0x62,0x72,0x61,0x63,0x6b,0x65,0x74,0xd8,0x40,0xd,0x13,0x74,0x79,0x70,0x65,0xc3,
+0x15,0x24,1,0x6c,0x30,0x6f,0x14,0x6e,0x74,0x72,0x6f,0x6c,0x25,0x12,0x61,0x73,
+0x73,0xc3,0,0x26,0x14,0x69,0x72,0x72,0x6f,0x72,1,0x65,0x38,0x69,0x16,0x6e,
+0x67,0x67,0x6c,0x79,0x70,0x68,0xd9,0x40,1,0x10,0x64,0x27,2,0x61,0x32,0x6b,
+0xc3,1,0x6f,0x11,0x63,0x6b,0xc3,1,0x11,0x6e,0x6b,0x7b,0x10,0x67,0xd9,0x40,
+1,6,0x68,0x7c,0x68,0x54,0x69,0x85,0x6f,0xa2,0x6f,0x77,4,0x63,0x30,0x6b,
+0x36,0x6c,0x87,0x74,0x8b,0x75,0x89,1,0x66,0x8d,0x6d,0x8f,0x11,0x63,0x66,0x91,
+0x18,0x61,0x6e,0x67,0x65,0x73,0x77,0x68,0x65,0x6e,4,0x63,0x44,0x6c,0x6c,0x6e,
+0x7e,0x74,0x98,0x75,0x18,0x70,0x70,0x65,0x72,0x63,0x61,0x73,0x65,0x64,0x89,0x12,
+0x61,0x73,0x65,1,0x66,0x30,0x6d,0x14,0x61,0x70,0x70,0x65,0x64,0x8f,0x14,0x6f,
+0x6c,0x64,0x65,0x64,0x8d,0x18,0x6f,0x77,0x65,0x72,0x63,0x61,0x73,0x65,0x64,0x87,
+0x1c,0x66,0x6b,0x63,0x63,0x61,0x73,0x65,0x66,0x6f,0x6c,0x64,0x65,0x64,0x91,0x18,
+0x69,0x74,0x6c,0x65,0x63,0x61,0x73,0x65,0x64,0x8b,0x13,0x6d,0x70,0x65,0x78,0x33,
+0x61,0x2e,0x63,0xa2,0x48,0x66,0xd9,0x40,2,1,0x6e,0x72,0x73,0x10,0x65,3,
+0x64,0x83,0x66,0x3a,0x69,0x4a,0x73,0x17,0x65,0x6e,0x73,0x69,0x74,0x69,0x76,0x65,
+0x65,0x15,0x6f,0x6c,0x64,0x69,0x6e,0x67,0xd9,0x40,2,0x17,0x67,0x6e,0x6f,0x72,
+0x61,0x62,0x6c,0x65,0x85,0x13,0x6f,0x6e,0x69,0x63,0x1f,0x61,0x6c,0x63,0x6f,0x6d,
+0x62,0x69,0x6e,0x69,0x6e,0x67,0x63,0x6c,0x61,0x73,0x73,0xc3,2,0x10,0x63,0xc3,
+2,3,0x61,0x30,0x65,0x34,0x69,0xa2,0x41,0x74,0xc3,3,0x11,0x73,0x68,0x29,
+2,0x63,0x3a,0x66,0x58,0x70,0x2c,0x16,0x72,0x65,0x63,0x61,0x74,0x65,0x64,0x2d,
+0x1d,0x6f,0x6d,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x74,0x79,0x70,0x65,0xc3,
+3,0x15,0x61,0x75,0x6c,0x74,0x69,0x67,0x1f,0x6e,0x6f,0x72,0x61,0x62,0x6c,0x65,
+0x63,0x6f,0x64,0x65,0x70,0x6f,0x69,0x6e,0x74,0x2b,0x2a,0x10,0x61,0x2e,0x15,0x63,
+0x72,0x69,0x74,0x69,0x63,0x2f,3,0x66,0x34,0x6e,0x3e,0x74,0x42,0x79,0x22,0x11,
+0x65,0x73,0x23,0x20,0x13,0x61,0x6c,0x73,0x65,0x21,0x20,0x10,0x6f,0x21,0x22,0x12,
+0x72,0x75,0x65,0x23,0xb,0x6b,0x5b,0x6f,0x23,0x6f,0x3c,0x72,0x4c,0x76,1,0x69,
+0x24,0x72,0x33,0x13,0x72,0x61,0x6d,0x61,0x33,0x10,0x76,0x22,0x14,0x65,0x72,0x6c,
+0x61,0x79,0x23,0xa2,0xe2,0x13,0x69,0x67,0x68,0x74,0xa3,0xe2,0x6b,0x58,0x6c,0x74,
+0x6e,3,0x6b,0x2f,0x6f,0x30,0x72,0x21,0x75,0x12,0x6b,0x74,0x61,0x2f,0x19,0x74,
+0x72,0x65,0x6f,0x72,0x64,0x65,0x72,0x65,0x64,0x21,1,0x61,0x24,0x76,0x31,0x18,
+0x6e,0x61,0x76,0x6f,0x69,0x63,0x69,0x6e,0x67,0x31,0xa2,0xe0,0x12,0x65,0x66,0x74,
+0xa3,0xe0,0x64,0x45,0x64,0x4e,0x68,0x88,0x69,1,0x6f,0x26,0x73,0xa3,0xf0,0x1a,
+0x74,0x61,0x73,0x75,0x62,0x73,0x63,0x72,0x69,0x70,0x74,0xa3,0xf0,2,0x61,0xa3,
+0xea,0x62,0xa3,0xe9,0x6f,0x13,0x75,0x62,0x6c,0x65,1,0x61,0x30,0x62,0x13,0x65,
+0x6c,0x6f,0x77,0xa3,0xe9,0x13,0x62,0x6f,0x76,0x65,0xa3,0xea,0x12,0x61,0x6e,0x72,
+0x2c,0x15,0x65,0x61,0x64,0x69,0x6e,0x67,0x2d,0x61,0xa2,0x7b,0x62,0xa2,0xd4,0x63,
+0x11,0x63,0x63,4,0x31,0x3c,0x32,0xa2,0x42,0x33,0xa2,0x56,0x38,0xa2,0x64,0x39,
+0x10,0x31,0xa3,0x5b,9,0x35,0xa,0x35,0x3f,0x36,0x41,0x37,0x43,0x38,0x45,0x39,
+0x47,0x30,0x30,0x31,0x3c,0x32,0x42,0x33,0x4e,0x34,0x3d,0x34,1,0x33,0xa3,0x67,
+0x37,0xa3,0x6b,0x36,0x10,0x38,0xa3,0x76,0x38,1,0x32,0xa3,0x7a,0x39,0xa3,0x81,
+0x3a,2,0x30,0xa3,0x82,0x32,0xa3,0x84,0x33,0xa3,0x85,9,0x35,0xa,0x35,0x53,
+0x36,0x55,0x37,0x57,0x38,0x59,0x39,0x5b,0x30,0x49,0x31,0x4b,0x32,0x4d,0x33,0x4f,
+0x34,0x51,6,0x33,8,0x33,0x63,0x34,0x65,0x35,0x67,0x36,0x69,0x30,0x5d,0x31,
+0x5f,0x32,0x61,0x10,0x34,0xa3,0x54,0xa2,0xe6,3,0x62,0xa0,0x6c,0xa3,0xe4,0x72,
+0xa3,0xe8,0x74,2,0x61,0x74,0x62,0x7c,0x74,0x14,0x61,0x63,0x68,0x65,0x64,1,
+0x61,0x3e,0x62,0x13,0x65,0x6c,0x6f,0x77,0xa2,0xca,0x13,0x6c,0x65,0x66,0x74,0xa3,
+0xc8,0x13,0x62,0x6f,0x76,0x65,0xa2,0xd6,0x14,0x72,0x69,0x67,0x68,0x74,0xa3,0xd8,
+0xa2,0xd6,0x10,0x72,0xa3,0xd8,0xa2,0xca,0x10,0x6c,0xa3,0xc8,0x12,0x6f,0x76,0x65,
+0xa2,0xe6,1,0x6c,0x30,0x72,0x13,0x69,0x67,0x68,0x74,0xa3,0xe8,0x12,0x65,0x66,
+0x74,0xa3,0xe4,0xa2,0xdc,2,0x65,0x2c,0x6c,0xa3,0xda,0x72,0xa3,0xde,0x12,0x6c,
+0x6f,0x77,0xa2,0xdc,1,0x6c,0x30,0x72,0x13,0x69,0x67,0x68,0x74,0xa3,0xde,0x12,
+0x65,0x66,0x74,0xa3,0xda,0xb,0x6e,0xc0,0xca,0x72,0x5f,0x72,0x46,0x73,0xa2,0x48,
+0x77,1,0x68,0x24,0x73,0x33,0x17,0x69,0x74,0x65,0x73,0x70,0x61,0x63,0x65,0x33,
+0x22,1,0x69,0x30,0x6c,2,0x65,0x3d,0x69,0x4b,0x6f,0x3f,0x18,0x67,0x68,0x74,
+0x74,0x6f,0x6c,0x65,0x66,0x74,0x22,2,0x65,0x38,0x69,0x48,0x6f,0x16,0x76,0x65,
+0x72,0x72,0x69,0x64,0x65,0x3f,0x17,0x6d,0x62,0x65,0x64,0x64,0x69,0x6e,0x67,0x3d,
+0x15,0x73,0x6f,0x6c,0x61,0x74,0x65,0x4b,0x30,0x1e,0x65,0x67,0x6d,0x65,0x6e,0x74,
+0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0x31,0x6e,0xa2,0x41,0x6f,0xa2,0x53,
+0x70,2,0x61,0x66,0x64,0x86,0x6f,0x1b,0x70,0x64,0x69,0x72,0x65,0x63,0x74,0x69,
+0x6f,0x6e,0x61,0x6c,1,0x66,0x32,0x69,0x15,0x73,0x6f,0x6c,0x61,0x74,0x65,0x4d,
+0x14,0x6f,0x72,0x6d,0x61,0x74,0x41,0x1f,0x72,0x61,0x67,0x72,0x61,0x70,0x68,0x73,
+0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0x2f,1,0x66,0x41,0x69,0x4d,1,0x6f,
+0x28,0x73,0x10,0x6d,0x43,0x1b,0x6e,0x73,0x70,0x61,0x63,0x69,0x6e,0x67,0x6d,0x61,
+0x72,0x6b,0x43,1,0x6e,0x35,0x74,0x19,0x68,0x65,0x72,0x6e,0x65,0x75,0x74,0x72,
+0x61,0x6c,0x35,0x65,0x88,0x65,0x98,0x66,0xa2,0x6a,0x6c,0x20,1,0x65,0x30,0x72,
+2,0x65,0x37,0x69,0x49,0x6f,0x39,0x18,0x66,0x74,0x74,0x6f,0x72,0x69,0x67,0x68,
+0x74,0x20,2,0x65,0x38,0x69,0x48,0x6f,0x16,0x76,0x65,0x72,0x72,0x69,0x64,0x65,
+0x39,0x17,0x6d,0x62,0x65,0x64,0x64,0x69,0x6e,0x67,0x37,0x15,0x73,0x6f,0x6c,0x61,
+0x74,0x65,0x49,3,0x6e,0x25,0x73,0x27,0x74,0x29,0x75,0x15,0x72,0x6f,0x70,0x65,
+0x61,0x6e,2,0x6e,0x3c,0x73,0x46,0x74,0x18,0x65,0x72,0x6d,0x69,0x6e,0x61,0x74,
+0x6f,0x72,0x29,0x14,0x75,0x6d,0x62,0x65,0x72,0x25,0x17,0x65,0x70,0x61,0x72,0x61,
+0x74,0x6f,0x72,0x27,1,0x69,0x28,0x73,0x10,0x69,0x47,0x1f,0x72,0x73,0x74,0x73,
+0x74,0x72,0x6f,0x6e,0x67,0x69,0x73,0x6f,0x6c,0x61,0x74,0x65,0x47,0x61,0x4e,0x62,
+0x84,0x63,1,0x6f,0x24,0x73,0x2d,0x1c,0x6d,0x6d,0x6f,0x6e,0x73,0x65,0x70,0x61,
+0x72,0x61,0x74,0x6f,0x72,0x2d,2,0x6c,0x3b,0x6e,0x2b,0x72,0x13,0x61,0x62,0x69,
+0x63,1,0x6c,0x30,0x6e,0x14,0x75,0x6d,0x62,0x65,0x72,0x2b,0x14,0x65,0x74,0x74,
+0x65,0x72,0x3b,0x2e,1,0x6e,0x45,0x6f,0x1c,0x75,0x6e,0x64,0x61,0x72,0x79,0x6e,
+0x65,0x75,0x74,0x72,0x61,0x6c,0x45,0,0x16,0x6d,0xc8,0xc8,0x74,0xc1,0xee,0x77,
+0x6a,0x77,0x48,0x79,0x70,0x7a,0x1d,0x61,0x6e,0x61,0x62,0x61,0x7a,0x61,0x72,0x73,
+0x71,0x75,0x61,0x72,0x65,0xa5,0x18,0x10,0x61,1,0x6e,0x36,0x72,0x16,0x61,0x6e,
+0x67,0x63,0x69,0x74,0x69,0xa3,0xfc,0x12,0x63,0x68,0x6f,0xa5,0x2c,1,0x65,0x88,
+0x69,2,0x6a,0x3c,0x72,0x68,0x73,0x17,0x79,0x6c,0x6c,0x61,0x62,0x6c,0x65,0x73,
+0xa3,0x48,0x12,0x69,0x6e,0x67,0xa2,0x74,0x1e,0x68,0x65,0x78,0x61,0x67,0x72,0x61,
+0x6d,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0x74,0x16,0x61,0x64,0x69,0x63,0x61,
+0x6c,0x73,0xa3,0x49,0x13,0x7a,0x69,0x64,0x69,0xa5,0x34,0x74,0xa2,0x59,0x75,0xa4,
+0x35,0x76,2,0x61,0x36,0x65,0x7a,0x73,0xa2,0x6c,0x12,0x73,0x75,0x70,0xa3,0x7d,
+1,0x69,0xa3,0x9f,0x72,0x1e,0x69,0x61,0x74,0x69,0x6f,0x6e,0x73,0x65,0x6c,0x65,
+0x63,0x74,0x6f,0x72,0x73,0xa2,0x6c,0x19,0x73,0x75,0x70,0x70,0x6c,0x65,0x6d,0x65,
+0x6e,0x74,0xa3,0x7d,1,0x64,0x3c,0x72,0x19,0x74,0x69,0x63,0x61,0x6c,0x66,0x6f,
+0x72,0x6d,0x73,0xa3,0x91,0x14,0x69,0x63,0x65,0x78,0x74,0xa2,0xaf,0x16,0x65,0x6e,
+0x73,0x69,0x6f,0x6e,0x73,0xa3,0xaf,4,0x61,0x68,0x65,0xa2,0xad,0x68,0xa2,0xb0,
+0x69,0xa2,0xb8,0x72,0x1c,0x61,0x6e,0x73,0x70,0x6f,0x72,0x74,0x61,0x6e,0x64,0x6d,
+0x61,0x70,0xa2,0xcf,0x16,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0xcf,4,0x67,
+0x7e,0x69,0xa2,0x41,0x6b,0xa2,0x6a,0x6d,0xa2,0x6c,0x6e,0x12,0x67,0x75,0x74,0xa4,
+0x10,1,0x63,0x40,0x73,0x11,0x75,0x70,0xa4,0x33,0x16,0x70,0x6c,0x65,0x6d,0x65,
+0x6e,0x74,0xa5,0x33,0x18,0x6f,0x6d,0x70,0x6f,0x6e,0x65,0x6e,0x74,0x73,0xa5,0x11,
+2,0x61,0x2a,0x62,0x32,0x73,0xa3,0x60,0x12,0x6c,0x6f,0x67,0xa3,0x62,0x13,0x61,
+0x6e,0x77,0x61,0xa3,0x65,3,0x6c,0x52,0x74,0x56,0x76,0x5e,0x78,0x16,0x75,0x61,
+0x6e,0x6a,0x69,0x6e,0x67,0xa2,0x7c,0x16,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,
+0x7c,0x10,0x65,0xa3,0x70,0x12,0x68,0x61,0x6d,0xa3,0xae,0x12,0x69,0x65,0x74,0xa3,
+0xb7,0x11,0x72,0x69,0xa3,0xdc,0x11,0x69,0x6c,0x48,0x12,0x73,0x75,0x70,0xa4,0x2b,
+0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0x2b,0x13,0x6c,0x75,0x67,0x75,0x4b,
+0x10,0x61,1,0x61,0x24,0x69,0x53,0x11,0x6e,0x61,0x3d,2,0x62,0x34,0x66,0x3c,
+0x72,0x13,0x68,0x75,0x74,0x61,0xa3,0xfb,0x13,0x65,0x74,0x61,0x6e,0x57,0x14,0x69,
+0x6e,0x61,0x67,0x68,0xa3,0x90,2,0x63,0x82,0x67,0x92,0x6e,0x1f,0x69,0x66,0x69,
+0x65,0x64,0x63,0x61,0x6e,0x61,0x64,0x69,0x61,0x6e,0x61,0x62,0x6f,0x1f,0x72,0x69,
+0x67,0x69,0x6e,0x61,0x6c,0x73,0x79,0x6c,0x6c,0x61,0x62,0x69,0x63,0x73,0x62,0x17,
+0x65,0x78,0x74,0x65,0x6e,0x64,0x65,0x64,0xa3,0xad,0x11,0x61,0x73,0x62,0x12,0x65,
+0x78,0x74,0xa3,0xad,0x15,0x61,0x72,0x69,0x74,0x69,0x63,0xa3,0x78,0x70,0xc3,0x4b,
+0x70,0xa6,0x61,0x72,0xa8,0x1d,0x73,7,0x6f,0xc1,0xbe,0x6f,0xa2,0x69,0x70,0xa2,
+0x85,0x75,0xa2,0xa4,0x79,2,0x6c,0x50,0x6d,0x62,0x72,0x12,0x69,0x61,0x63,0x3a,
+0x12,0x73,0x75,0x70,0xa4,0x17,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0x17,
+0x17,0x6f,0x74,0x69,0x6e,0x61,0x67,0x72,0x69,0xa3,0x8f,0x13,0x62,0x6f,0x6c,0x73,
+1,0x61,0x4c,0x66,0x10,0x6f,0x1f,0x72,0x6c,0x65,0x67,0x61,0x63,0x79,0x63,0x6f,
+0x6d,0x70,0x75,0x74,0x69,0x6e,0x67,0xa5,0x32,0x1f,0x6e,0x64,0x70,0x69,0x63,0x74,
+0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0x65,0x78,0x74,1,0x61,0xa5,0x2a,0x65,0x14,
+0x6e,0x64,0x65,0x64,0x61,0xa5,0x2a,2,0x67,0x34,0x72,0x3e,0x79,0x13,0x6f,0x6d,
+0x62,0x6f,0xa5,0x16,0x13,0x64,0x69,0x61,0x6e,0xa5,0x23,0x17,0x61,0x73,0x6f,0x6d,
+0x70,0x65,0x6e,0x67,0xa3,0xda,1,0x61,0x32,0x65,0x14,0x63,0x69,0x61,0x6c,0x73,
+0xa3,0x56,0x12,0x63,0x69,0x6e,0x1f,0x67,0x6d,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,
+0x6c,0x65,0x74,0x74,0x65,0x72,0x73,0x2d,2,0x6e,0x48,0x70,0x76,0x74,0x1d,0x74,
+0x6f,0x6e,0x73,0x69,0x67,0x6e,0x77,0x72,0x69,0x74,0x69,0x6e,0x67,0xa5,6,0x15,
+0x64,0x61,0x6e,0x65,0x73,0x65,0xa2,0x9b,0x12,0x73,0x75,0x70,0xa2,0xdb,0x16,0x70,
+0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xdb,4,0x61,0xa2,0xa8,0x65,0x5c,0x6d,0x9e,
+0x70,0xa2,0x4b,0x73,0x13,0x79,0x6d,0x62,0x6f,0x1f,0x6c,0x73,0x61,0x6e,0x64,0x70,
+0x69,0x63,0x74,0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0xa5,5,0x10,0x72,1,0x61,
+0x4e,0x73,0x12,0x63,0x72,0x69,0x1f,0x70,0x74,0x73,0x61,0x6e,0x64,0x73,0x75,0x62,
+0x73,0x63,0x72,0x69,0x70,0x74,0x73,0x73,0x14,0x6e,0x64,0x73,0x75,0x62,0x73,0x1b,
+0x61,0x74,0x68,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x73,0xa3,0x6a,1,0x6c,
+0x40,0x75,1,0x61,0x6e,0x6e,0x17,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xa3,
+0x8e,0x15,0x65,0x6d,0x65,0x6e,0x74,0x61,1,0x6c,0x50,0x72,0x1e,0x79,0x70,0x72,
+0x69,0x76,0x61,0x74,0x65,0x75,0x73,0x65,0x61,0x72,0x65,0x61,1,0x61,0xa3,0x6d,
+0x62,0xa3,0x6e,3,0x61,0x5c,0x6d,0x78,0x70,0xa2,0x41,0x73,0x13,0x79,0x6d,0x62,
+0x6f,0x1f,0x6c,0x73,0x61,0x6e,0x64,0x70,0x69,0x63,0x74,0x6f,0x67,0x72,0x61,0x70,
+0x68,0x73,0xa5,5,0x14,0x72,0x72,0x6f,0x77,0x73,2,0x61,0xa3,0x67,0x62,0xa3,
+0x68,0x63,0xa3,0xfa,0x13,0x61,0x74,0x68,0x65,0x1f,0x6d,0x61,0x74,0x69,0x63,0x61,
+0x6c,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x73,0xa3,0x6a,0x19,0x75,0x6e,0x63,
+0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xa3,0x8e,0x61,0x88,0x68,0xa2,0x48,0x69,0xa2,
+0x71,0x6d,0x12,0x61,0x6c,0x6c,1,0x66,0x46,0x6b,0x15,0x61,0x6e,0x61,0x65,0x78,
+0x74,0xa4,0x29,0x15,0x65,0x6e,0x73,0x69,0x6f,0x6e,0xa5,0x29,0x12,0x6f,0x72,0x6d,
+1,0x73,0xa3,0x54,0x76,0x16,0x61,0x72,0x69,0x61,0x6e,0x74,0x73,0xa3,0x54,1,
+0x6d,0x36,0x75,0x16,0x72,0x61,0x73,0x68,0x74,0x72,0x61,0xa3,0xa1,0x15,0x61,0x72,
+0x69,0x74,0x61,0x6e,0xa3,0xac,1,0x61,0x52,0x6f,0x13,0x72,0x74,0x68,0x61,0x1f,
+0x6e,0x64,0x66,0x6f,0x72,0x6d,0x61,0x74,0x63,0x6f,0x6e,0x74,0x72,0x6f,0x6c,0x73,
+0xa3,0xf7,1,0x72,0x2e,0x76,0x12,0x69,0x61,0x6e,0xa3,0x79,0x12,0x61,0x64,0x61,
+0xa3,0xd9,1,0x64,0x50,0x6e,0x13,0x68,0x61,0x6c,0x61,0x50,0x1d,0x61,0x72,0x63,
+0x68,0x61,0x69,0x63,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,0xa3,0xf9,0x13,0x64,0x68,
+0x61,0x6d,0xa3,0xf8,5,0x72,0x35,0x72,0x44,0x73,0x64,0x75,1,0x61,0xa3,0x4e,
+0x6e,0x17,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x71,0x17,0x69,0x76,0x61,0x74,
+0x65,0x75,0x73,0x65,0xa2,0x4e,0x13,0x61,0x72,0x65,0x61,0xa3,0x4e,0x1b,0x61,0x6c,
+0x74,0x65,0x72,0x70,0x61,0x68,0x6c,0x61,0x76,0x69,0xa3,0xf6,0x61,0x40,0x68,0x82,
+0x6c,0x19,0x61,0x79,0x69,0x6e,0x67,0x63,0x61,0x72,0x64,0x73,0xa3,0xcc,2,0x68,
+0x38,0x6c,0x4a,0x75,0x15,0x63,0x69,0x6e,0x68,0x61,0x75,0xa3,0xf5,0x17,0x61,0x77,
+0x68,0x68,0x6d,0x6f,0x6e,0x67,0xa3,0xf3,0x15,0x6d,0x79,0x72,0x65,0x6e,0x65,0xa3,
+0xf4,1,0x61,0x8e,0x6f,1,0x65,0x74,0x6e,0x16,0x65,0x74,0x69,0x63,0x65,0x78,
+0x74,0xa2,0x72,1,0x65,0x2c,0x73,0x11,0x75,0x70,0xa3,0x8d,0x15,0x6e,0x73,0x69,
+0x6f,0x6e,0x73,0xa2,0x72,0x19,0x73,0x75,0x70,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,
+0xa3,0x8d,0x15,0x6e,0x69,0x63,0x69,0x61,0x6e,0xa3,0x97,1,0x67,0x3e,0x69,0x13,
+0x73,0x74,0x6f,0x73,0xa2,0xa6,0x13,0x64,0x69,0x73,0x63,0xa3,0xa6,0x12,0x73,0x70,
+0x61,0xa3,0x96,1,0x65,0x5c,0x75,1,0x6d,0x2a,0x6e,0x11,0x69,0x63,0x67,0x10,
0x69,0xa2,0xc0,0x1d,0x6e,0x75,0x6d,0x65,0x72,0x61,0x6c,0x73,0x79,0x6d,0x62,0x6f,
-0x6c,0x73,0xa3,0xc0,0x13,0x6a,0x61,0x6e,0x67,0xa3,0xa3,0x6d,0xa2,0xe6,0x6e,0xa8,
-0x19,0x6f,6,0x70,0x63,0x70,0x56,0x72,0x8a,0x73,0xa2,0x4c,0x74,0x10,0x74,0x1f,
-0x6f,0x6d,0x61,0x6e,0x73,0x69,0x79,0x61,0x71,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,
-0xa5,0x28,0x18,0x74,0x69,0x63,0x61,0x6c,0x63,0x68,0x61,0x72,0x1f,0x61,0x63,0x74,
-0x65,0x72,0x72,0x65,0x63,0x6f,0x67,0x6e,0x69,0x74,0x69,0x6f,0x6e,0x85,1,0x69,
-0x46,0x6e,0x1e,0x61,0x6d,0x65,0x6e,0x74,0x61,0x6c,0x64,0x69,0x6e,0x67,0x62,0x61,
-0x74,0x73,0xa3,0xf2,0x11,0x79,0x61,0x47,1,0x61,0x30,0x6d,0x13,0x61,0x6e,0x79,
-0x61,0xa3,0x7a,0x11,0x67,0x65,0xa5,0xf,0x63,0xa2,0x71,0x67,0xa2,0x71,0x6c,1,
-0x63,0xa2,0x62,0x64,5,0x70,0x38,0x70,0x36,0x73,0x56,0x74,0x14,0x75,0x72,0x6b,
-0x69,0x63,0xa3,0xbf,0x11,0x65,0x72,1,0x6d,0x2e,0x73,0x12,0x69,0x61,0x6e,0xa3,
-0x8c,0x11,0x69,0x63,0xa3,0xf1,0x10,0x6f,1,0x67,0x3a,0x75,0x18,0x74,0x68,0x61,
-0x72,0x61,0x62,0x69,0x61,0x6e,0xa3,0xbb,0x13,0x64,0x69,0x61,0x6e,0xa5,0x22,0x68,
-0x42,0x69,0x54,0x6e,0x1a,0x6f,0x72,0x74,0x68,0x61,0x72,0x61,0x62,0x69,0x61,0x6e,
-0xa3,0xf0,0x17,0x75,0x6e,0x67,0x61,0x72,0x69,0x61,0x6e,0xa5,4,0x14,0x74,0x61,
-0x6c,0x69,0x63,0xa3,0x58,0x13,0x68,0x69,0x6b,0x69,0xa3,0x9d,0x10,0x72,0x85,0x12,
-0x68,0x61,0x6d,0x65,6,0x6f,0x86,0x6f,0x6c,0x72,0xa2,0x61,0x75,0xa2,0x62,0x79,
-0x14,0x61,0x6e,0x6d,0x61,0x72,0x58,0x12,0x65,0x78,0x74,2,0x61,0xa3,0xb6,0x62,
-0xa3,0xee,0x65,0x13,0x6e,0x64,0x65,0x64,1,0x61,0xa3,0xb6,0x62,0xa3,0xee,1,
-0x64,0x52,0x6e,0x15,0x67,0x6f,0x6c,0x69,0x61,0x6e,0x6a,0x12,0x73,0x75,0x70,0xa4,
-0xd,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0xd,0x10,0x69,0xa2,0xec,0x13,
-0x66,0x69,0x65,0x72,1,0x6c,0x3c,0x74,0x19,0x6f,0x6e,0x65,0x6c,0x65,0x74,0x74,
-0x65,0x72,0x73,0xa3,0x8a,0x15,0x65,0x74,0x74,0x65,0x72,0x73,0x2d,0x10,0x6f,0xa3,
-0xed,1,0x6c,0x44,0x73,0x11,0x69,0x63,0xa2,0x5c,0x18,0x61,0x6c,0x73,0x79,0x6d,
-0x62,0x6f,0x6c,0x73,0xa3,0x5c,0x13,0x74,0x61,0x6e,0x69,0xa5,3,0x61,0xa2,0x9b,
-0x65,0xa4,0x4c,0x69,1,0x61,0xa2,0x8f,0x73,0x10,0x63,5,0x70,0x18,0x70,0xa2,
-0x71,0x73,0x36,0x74,0x17,0x65,0x63,0x68,0x6e,0x69,0x63,0x61,0x6c,0x81,0x15,0x79,
-0x6d,0x62,0x6f,0x6c,0x73,0x8f,0x61,0xa2,0x66,0x65,0x46,0x6d,0x19,0x61,0x74,0x68,
-0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,1,0x61,0xa3,0x66,0x62,0xa3,0x69,0x17,0x6c,
-0x6c,0x61,0x6e,0x65,0x6f,0x75,0x73,2,0x6d,0x3a,0x73,0x6c,0x74,0x17,0x65,0x63,
-0x68,0x6e,0x69,0x63,0x61,0x6c,0x81,0x11,0x61,0x74,0x1f,0x68,0x65,0x6d,0x61,0x74,
-0x69,0x63,0x61,0x6c,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,1,0x61,0xa3,0x66,0x62,
-0xa3,0x69,0x15,0x79,0x6d,0x62,0x6f,0x6c,0x73,0x8e,0x12,0x61,0x6e,0x64,1,0x61,
-0x3c,0x70,0x19,0x69,0x63,0x74,0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0xa3,0xcd,0x14,
-0x72,0x72,0x6f,0x77,0x73,0xa3,0x73,0x10,0x6f,0xa3,0xd8,7,0x72,0x6f,0x72,0x44,
-0x73,0x4e,0x74,0x62,0x79,0x19,0x61,0x6e,0x6e,0x75,0x6d,0x65,0x72,0x61,0x6c,0x73,
-0xa5,0x20,0x13,0x63,0x68,0x65,0x6e,0xa5,0xc,0x18,0x61,0x72,0x61,0x6d,0x67,0x6f,
-0x6e,0x64,0x69,0xa5,0x14,0x10,0x68,2,0x61,0x3a,0x65,0x4a,0x6f,0x17,0x70,0x65,
-0x72,0x61,0x74,0x6f,0x72,0x73,0x7f,0x16,0x6c,0x70,0x68,0x61,0x6e,0x75,0x6d,0xa3,
-0x5d,0x16,0x6d,0x61,0x74,0x69,0x63,0x61,0x6c,1,0x61,0x36,0x6f,0x17,0x70,0x65,
-0x72,0x61,0x74,0x6f,0x72,0x73,0x7f,0x11,0x6c,0x70,0x1f,0x68,0x61,0x6e,0x75,0x6d,
-0x65,0x72,0x69,0x63,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0x5d,0x68,0x50,0x6b,
-0x7e,0x6c,0x88,0x6e,1,0x64,0x34,0x69,0x15,0x63,0x68,0x61,0x65,0x61,0x6e,0xa3,
-0xea,0x12,0x61,0x69,0x63,0xa3,0xc6,1,0x61,0x3e,0x6a,0x12,0x6f,0x6e,0x67,0xa2,
-0xaa,0x14,0x74,0x69,0x6c,0x65,0x73,0xa3,0xaa,0x13,0x6a,0x61,0x6e,0x69,0xa3,0xe9,
-0x13,0x61,0x73,0x61,0x72,0xa5,0x1f,0x15,0x61,0x79,0x61,0x6c,0x61,0x6d,0x4f,3,
-0x64,0x6c,0x65,0x7e,0x6e,0xa2,0x47,0x72,0x14,0x6f,0x69,0x74,0x69,0x63,1,0x63,
-0x3c,0x68,0x19,0x69,0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,0x73,0xa3,0xd7,0x15,
-0x75,0x72,0x73,0x69,0x76,0x65,0xa3,0xd6,0x17,0x65,0x66,0x61,0x69,0x64,0x72,0x69,
-0x6e,0xa5,0x21,0x17,0x74,0x65,0x69,0x6d,0x61,0x79,0x65,0x6b,0xa2,0xb8,0x12,0x65,
-0x78,0x74,0xa2,0xd5,0x16,0x65,0x6e,0x73,0x69,0x6f,0x6e,0x73,0xa3,0xd5,0x18,0x64,
-0x65,0x6b,0x69,0x6b,0x61,0x6b,0x75,0x69,0xa3,0xeb,6,0x6b,0x3b,0x6b,0x56,0x6f,
-0x5a,0x75,0x64,0x79,0x11,0x69,0x61,0x1f,0x6b,0x65,0x6e,0x67,0x70,0x75,0x61,0x63,
-0x68,0x75,0x65,0x68,0x6d,0x6f,0x6e,0x67,0xa5,0x27,0x10,0x6f,0xa3,0x92,0x14,0x62,
-0x6c,0x6f,0x63,0x6b,0x21,1,0x6d,0x2c,0x73,0x11,0x68,0x75,0xa5,0x15,0x17,0x62,
-0x65,0x72,0x66,0x6f,0x72,0x6d,0x73,0x7b,0x61,0x44,0x62,0x21,0x65,0x10,0x77,1,
-0x61,0xa5,0xe,0x74,0x14,0x61,0x69,0x6c,0x75,0x65,0xa3,0x8b,1,0x62,0x38,0x6e,
-0x17,0x64,0x69,0x6e,0x61,0x67,0x61,0x72,0x69,0xa5,0x26,0x15,0x61,0x74,0x61,0x65,
-0x61,0x6e,0xa3,0xef,0x67,0xc4,0x32,0x6a,0xc1,0xb9,0x6a,0xa2,0xd5,0x6b,0xa2,0xee,
-0x6c,4,0x61,0x54,0x65,0xa2,0x61,0x69,0xa2,0x78,0x6f,0xa2,0xb7,0x79,1,0x63,
-0x2e,0x64,0x12,0x69,0x61,0x6e,0xa3,0xa9,0x12,0x69,0x61,0x6e,0xa3,0xa7,1,0x6f,
-0x55,0x74,0x11,0x69,0x6e,1,0x31,0x82,0x65,0x11,0x78,0x74,4,0x61,0x5c,0x62,
-0x29,0x63,0xa3,0x94,0x64,0xa3,0x95,0x65,0xa2,0xe7,0x13,0x6e,0x64,0x65,0x64,4,
-0x61,0x36,0x62,0x29,0x63,0xa3,0x94,0x64,0xa3,0x95,0x65,0xa3,0xe7,0x26,0x18,0x64,
-0x64,0x69,0x74,0x69,0x6f,0x6e,0x61,0x6c,0x6d,0x24,0x12,0x73,0x75,0x70,0x24,0x16,
-0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x25,1,0x70,0x42,0x74,0x1d,0x74,0x65,0x72,
-0x6c,0x69,0x6b,0x65,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0x79,0x12,0x63,0x68,0x61,
-0xa3,0x9c,2,0x6d,0x4e,0x6e,0x54,0x73,0x10,0x75,0xa2,0xb0,0x12,0x73,0x75,0x70,
-0xa4,0x31,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0x31,0x11,0x62,0x75,0xa3,
-0x6f,0x12,0x65,0x61,0x72,1,0x61,0xa3,0xe8,0x62,1,0x69,0x38,0x73,0x17,0x79,
-0x6c,0x6c,0x61,0x62,0x61,0x72,0x79,0xa3,0x75,0x17,0x64,0x65,0x6f,0x67,0x72,0x61,
-0x6d,0x73,0xa3,0x76,0x1a,0x77,0x73,0x75,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0x73,
-0xa3,0x4d,0x10,0x61,1,0x6d,0x32,0x76,0x14,0x61,0x6e,0x65,0x73,0x65,0xa3,0xb5,
-0x10,0x6f,0x5c,0x12,0x65,0x78,0x74,1,0x61,0xa3,0xb4,0x62,0xa3,0xb9,1,0x61,
-0xa2,0x43,0x68,4,0x61,0x40,0x69,0x50,0x6d,0x6e,0x6f,0x86,0x75,0x15,0x64,0x61,
-0x77,0x61,0x64,0x69,0xa3,0xe6,0x16,0x72,0x6f,0x73,0x68,0x74,0x68,0x69,0xa3,0x89,
-0x1d,0x74,0x61,0x6e,0x73,0x6d,0x61,0x6c,0x6c,0x73,0x63,0x72,0x69,0x70,0x74,0xa5,
-0x30,0x11,0x65,0x72,0x68,0x16,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0x71,0x12,
-0x6a,0x6b,0x69,0xa3,0xe5,3,0x69,0x3a,0x6e,0x42,0x74,0xa2,0x51,0x79,0x13,0x61,
-0x68,0x6c,0x69,0xa3,0xa2,0x12,0x74,0x68,0x69,0xa3,0xc1,3,0x61,0x34,0x62,0x76,
-0x67,0x7c,0x6e,0x12,0x61,0x64,0x61,0x4d,1,0x65,0x40,0x73,0x11,0x75,0x70,0xa2,
-0xcb,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xcb,0x11,0x78,0x74,1,0x61,
-0xa5,0x13,0x65,0x14,0x6e,0x64,0x65,0x64,0x61,0xa5,0x13,0x11,0x75,0x6e,0xa3,0x42,
-0x11,0x78,0x69,0x96,0x17,0x72,0x61,0x64,0x69,0x63,0x61,0x6c,0x73,0x97,0x14,0x61,
-0x6b,0x61,0x6e,0x61,0x9e,1,0x65,0x4c,0x70,0x10,0x68,0x1f,0x6f,0x6e,0x65,0x74,
-0x69,0x63,0x65,0x78,0x74,0x65,0x6e,0x73,0x69,0x6f,0x6e,0x73,0xa3,0x6b,0x11,0x78,
-0x74,0xa3,0x6b,0x67,0xa2,0xb5,0x68,0xa4,0x84,0x69,3,0x64,0x4c,0x6d,0xa2,0x55,
-0x6e,0xa2,0x62,0x70,0x13,0x61,0x65,0x78,0x74,0x2a,0x16,0x65,0x6e,0x73,0x69,0x6f,
-0x6e,0x73,0x2b,1,0x63,0x99,0x65,0x17,0x6f,0x67,0x72,0x61,0x70,0x68,0x69,0x63,
-1,0x64,0x56,0x73,0x15,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa4,0xb,0x1d,0x61,0x6e,
-0x64,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xa5,0xb,0x13,0x65,
-0x73,0x63,0x72,0x1f,0x69,0x70,0x74,0x69,0x6f,0x6e,0x63,0x68,0x61,0x72,0x61,0x63,
-0x74,0x65,0x72,0x73,0x99,0x1c,0x70,0x65,0x72,0x69,0x61,0x6c,0x61,0x72,0x61,0x6d,
-0x61,0x69,0x63,0xa3,0xba,1,0x64,0x62,0x73,0x1b,0x63,0x72,0x69,0x70,0x74,0x69,
-0x6f,0x6e,0x61,0x6c,0x70,0x61,1,0x68,0x32,0x72,0x14,0x74,0x68,0x69,0x61,0x6e,
-0xa3,0xbd,0x13,0x6c,0x61,0x76,0x69,0xa3,0xbe,0x11,0x69,0x63,1,0x6e,0x3e,0x73,
-0x1a,0x69,0x79,0x61,0x71,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,0xa5,0x1e,0x19,0x75,
-0x6d,0x62,0x65,0x72,0x66,0x6f,0x72,0x6d,0x73,0xa3,0xb2,4,0x65,0x74,0x6c,0xa2,
-0x82,0x6f,0xa2,0x9a,0x72,0xa2,0x9e,0x75,2,0x6a,0x34,0x6e,0x3e,0x72,0x14,0x6d,
-0x75,0x6b,0x68,0x69,0x43,0x14,0x61,0x72,0x61,0x74,0x69,0x45,0x18,0x6a,0x61,0x6c,
-0x61,0x67,0x6f,0x6e,0x64,0x69,0xa5,0x1c,1,0x6e,0xa2,0x46,0x6f,1,0x6d,0x6e,
-0x72,0x13,0x67,0x69,0x61,0x6e,0x5a,1,0x65,0x40,0x73,0x11,0x75,0x70,0xa2,0x87,
-0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x87,0x11,0x78,0x74,0xa4,0x1b,0x14,
-0x65,0x6e,0x64,0x65,0x64,0xa5,0x1b,0x1a,0x65,0x74,0x72,0x69,0x63,0x73,0x68,0x61,
-0x70,0x65,0x73,0x8c,0x12,0x65,0x78,0x74,0xa2,0xe3,0x14,0x65,0x6e,0x64,0x65,0x64,
-0xa3,0xe3,0x1e,0x65,0x72,0x61,0x6c,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,
-0x6f,0x6e,0x71,0x17,0x61,0x67,0x6f,0x6c,0x69,0x74,0x69,0x63,0xa2,0x88,0x12,0x73,
-0x75,0x70,0xa4,0xa,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0xa,0x13,0x74,
-0x68,0x69,0x63,0xa3,0x59,1,0x61,0x5c,0x65,0x11,0x65,0x6b,0x30,1,0x61,0x38,
-0x65,0x11,0x78,0x74,0x6e,0x14,0x65,0x6e,0x64,0x65,0x64,0x6f,0x17,0x6e,0x64,0x63,
-0x6f,0x70,0x74,0x69,0x63,0x31,0x13,0x6e,0x74,0x68,0x61,0xa3,0xe4,2,0x61,0xa2,
-0x48,0x65,0xa2,0xdf,0x69,1,0x67,0x30,0x72,0x14,0x61,0x67,0x61,0x6e,0x61,0x9d,
-0x10,0x68,1,0x70,0x3a,0x73,0x18,0x75,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0x73,
-0xa3,0x4b,1,0x72,0x3c,0x75,0x19,0x73,0x75,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,
-0x73,0xa3,0x4c,0x11,0x69,0x76,0x1f,0x61,0x74,0x65,0x75,0x73,0x65,0x73,0x75,0x72,
-0x72,0x6f,0x67,0x61,0x74,0x65,0x73,0xa3,0x4c,2,0x6c,0x32,0x6e,0x9a,0x74,0x12,
-0x72,0x61,0x6e,0xa5,2,0x10,0x66,2,0x61,0x58,0x6d,0x70,0x77,0x14,0x69,0x64,
-0x74,0x68,0x61,0x1f,0x6e,0x64,0x66,0x75,0x6c,0x6c,0x77,0x69,0x64,0x74,0x68,0x66,
-0x6f,0x72,0x6d,0x73,0xa3,0x57,0x1a,0x6e,0x64,0x66,0x75,0x6c,0x6c,0x66,0x6f,0x72,
-0x6d,0x73,0xa3,0x57,0x13,0x61,0x72,0x6b,0x73,0xa3,0x52,2,0x67,0x34,0x69,0xa2,
-0x45,0x75,0x12,0x6e,0x6f,0x6f,0xa3,0x63,0x11,0x75,0x6c,0xa2,0x4a,2,0x63,0x3c,
-0x6a,0x5e,0x73,0x17,0x79,0x6c,0x6c,0x61,0x62,0x6c,0x65,0x73,0xa3,0x4a,0x1f,0x6f,
-0x6d,0x70,0x61,0x74,0x69,0x62,0x69,0x6c,0x69,0x74,0x79,0x6a,0x61,0x6d,0x6f,0xa3,
-0x41,0x12,0x61,0x6d,0x6f,0x5c,0x17,0x65,0x78,0x74,0x65,0x6e,0x64,0x65,0x64,1,
-0x61,0xa3,0xb4,0x62,0xa3,0xb9,0x19,0x66,0x69,0x72,0x6f,0x68,0x69,0x6e,0x67,0x79,
-0x61,0xa5,0x1d,0x13,0x62,0x72,0x65,0x77,0x37,0x61,0xa4,5,0x62,0xa6,0x45,0x63,
-0xa8,0x1a,0x64,0xac,0xb8,0x65,5,0x6d,0xa2,0x6d,0x86,0x6e,0x96,0x74,0x15,0x68,
-0x69,0x6f,0x70,0x69,0x63,0x5e,1,0x65,0x40,0x73,0x11,0x75,0x70,0xa2,0x86,0x16,
-0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x86,0x11,0x78,0x74,0xa2,0x85,1,0x61,
-0xa3,0xc8,0x65,0x13,0x6e,0x64,0x65,0x64,0xa2,0x85,0x10,0x61,0xa3,0xc8,0x16,0x6f,
-0x74,0x69,0x63,0x6f,0x6e,0x73,0xa3,0xce,0x15,0x63,0x6c,0x6f,0x73,0x65,0x64,2,
-0x61,0x5a,0x63,0x9e,0x69,0x1c,0x64,0x65,0x6f,0x67,0x72,0x61,0x70,0x68,0x69,0x63,
-0x73,0x75,0x70,0xa2,0xc4,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xc4,0x16,
-0x6c,0x70,0x68,0x61,0x6e,0x75,0x6d,0x86,1,0x65,0x2c,0x73,0x11,0x75,0x70,0xa3,
-0xc3,0x13,0x72,0x69,0x63,0x73,0x86,0x18,0x75,0x70,0x70,0x6c,0x65,0x6d,0x65,0x6e,
-0x74,0xa3,0xc3,0x11,0x6a,0x6b,0xa2,0x44,0x1f,0x6c,0x65,0x74,0x74,0x65,0x72,0x73,
-0x61,0x6e,0x64,0x6d,0x6f,0x6e,0x74,0x68,0x73,0xa3,0x44,0x61,0x4a,0x67,0x76,0x6c,
-1,0x62,0x30,0x79,0x13,0x6d,0x61,0x69,0x63,0xa5,0x25,0x13,0x61,0x73,0x61,0x6e,
-0xa3,0xe2,0x13,0x72,0x6c,0x79,0x64,0x1f,0x79,0x6e,0x61,0x73,0x74,0x69,0x63,0x63,
-0x75,0x6e,0x65,0x69,0x66,0x6f,0x72,0x6d,0xa5,1,0x1f,0x79,0x70,0x74,0x69,0x61,
-0x6e,0x68,0x69,0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,1,0x66,0x26,0x73,0xa3,
-0xc2,0x1c,0x6f,0x72,0x6d,0x61,0x74,0x63,0x6f,0x6e,0x74,0x72,0x6f,0x6c,0x73,0xa5,
-0x24,7,0x6e,0xc0,0xe5,0x6e,0x3e,0x72,0xa2,0x5d,0x73,0xa2,0xd8,0x76,0x14,0x65,
-0x73,0x74,0x61,0x6e,0xa3,0xbc,1,0x61,0x92,0x63,0x13,0x69,0x65,0x6e,0x74,1,
-0x67,0x34,0x73,0x15,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0xa5,0x13,0x72,0x65,0x65,
-0x6b,1,0x6d,0x34,0x6e,0x15,0x75,0x6d,0x62,0x65,0x72,0x73,0xa3,0x7f,0x13,0x75,
-0x73,0x69,0x63,0xa2,0x7e,0x19,0x61,0x6c,0x6e,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e,
-0xa3,0x7e,0x10,0x74,0x1f,0x6f,0x6c,0x69,0x61,0x6e,0x68,0x69,0x65,0x72,0x6f,0x67,
-0x6c,0x79,0x70,0x68,0x73,0xa3,0xfe,2,0x61,0x32,0x6d,0xa2,0x71,0x72,0x12,0x6f,
-0x77,0x73,0x7d,0x12,0x62,0x69,0x63,0x38,3,0x65,0x4a,0x6d,0x66,0x70,0xa2,0x43,
-0x73,0x11,0x75,0x70,0xa2,0x80,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x80,
-0x11,0x78,0x74,1,0x61,0xa3,0xd2,0x65,0x14,0x6e,0x64,0x65,0x64,0x61,0xa3,0xd2,
-0x12,0x61,0x74,0x68,0xa2,0xd3,0x18,0x65,0x6d,0x61,0x74,0x69,0x63,0x61,0x6c,0x61,
-0x1f,0x6c,0x70,0x68,0x61,0x62,0x65,0x74,0x69,0x63,0x73,0x79,0x6d,0x62,0x6f,0x6c,
-0x73,0xa3,0xd3,1,0x66,0x42,0x72,0x1e,0x65,0x73,0x65,0x6e,0x74,0x61,0x74,0x69,
-0x6f,0x6e,0x66,0x6f,0x72,0x6d,0x73,1,0x61,0xa3,0x51,0x62,0xa3,0x55,0x14,0x65,
-0x6e,0x69,0x61,0x6e,0x35,0x12,0x63,0x69,0x69,0x23,0x64,0x9e,0x65,0xa2,0x42,0x68,
-0xa2,0x4d,0x6c,1,0x63,0x62,0x70,0x17,0x68,0x61,0x62,0x65,0x74,0x69,0x63,0x70,
-1,0x66,0xa3,0x50,0x72,0x1e,0x65,0x73,0x65,0x6e,0x74,0x61,0x74,0x69,0x6f,0x6e,
-0x66,0x6f,0x72,0x6d,0x73,0xa3,0x50,0x16,0x68,0x65,0x6d,0x69,0x63,0x61,0x6c,0xa2,
-0xd0,0x16,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0xd0,0x12,0x6c,0x61,0x6d,0xa5,
-7,0x1a,0x67,0x65,0x61,0x6e,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,0xa3,0x77,0x11,
-0x6f,0x6d,0xa3,0xfd,7,0x6f,0x71,0x6f,0x64,0x72,0xa2,0x41,0x75,0xa2,0x58,0x79,
-0x1b,0x7a,0x61,0x6e,0x74,0x69,0x6e,0x65,0x6d,0x75,0x73,0x69,0x63,0xa2,0x5b,0x18,
-0x61,0x6c,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0x5b,1,0x70,0x34,0x78,0x16,
-0x64,0x72,0x61,0x77,0x69,0x6e,0x67,0x89,0x14,0x6f,0x6d,0x6f,0x66,0x6f,0xa0,0x12,
-0x65,0x78,0x74,0xa2,0x43,0x14,0x65,0x6e,0x64,0x65,0x64,0xa3,0x43,0x10,0x61,1,
-0x68,0x40,0x69,0x12,0x6c,0x6c,0x65,0x92,0x17,0x70,0x61,0x74,0x74,0x65,0x72,0x6e,
-0x73,0x93,0x11,0x6d,0x69,0xa3,0xc9,1,0x67,0x2c,0x68,0x11,0x69,0x64,0xa3,0x64,
-0x14,0x69,0x6e,0x65,0x73,0x65,0xa3,0x81,0x61,0x48,0x65,0xa2,0x4e,0x68,0xa2,0x52,
-0x6c,0x1a,0x6f,0x63,0x6b,0x65,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x73,0x8b,3,0x6c,
-0x34,0x6d,0x40,0x73,0x66,0x74,0x11,0x61,0x6b,0xa3,0xc7,0x14,0x69,0x6e,0x65,0x73,
-0x65,0xa3,0x93,0x11,0x75,0x6d,0xa2,0xb1,0x12,0x73,0x75,0x70,0xa2,0xca,0x16,0x70,
-0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xca,1,0x69,0x30,0x73,0x13,0x61,0x76,0x61,
-0x68,0xa3,0xdd,0x15,0x63,0x6c,0x61,0x74,0x69,0x6e,0x23,0x14,0x6e,0x67,0x61,0x6c,
-0x69,0x41,0x16,0x61,0x69,0x6b,0x73,0x75,0x6b,0x69,0xa5,8,5,0x6f,0xc1,0x4c,
-0x6f,0xa2,0x55,0x75,0xa4,0x10,0x79,1,0x70,0x9c,0x72,0x14,0x69,0x6c,0x6c,0x69,
-0x63,0x32,1,0x65,0x4c,0x73,0x11,0x75,0x70,0xa2,0x61,0x16,0x70,0x6c,0x65,0x6d,
-0x65,0x6e,0x74,0xa2,0x61,0x12,0x61,0x72,0x79,0xa3,0x61,0x11,0x78,0x74,3,0x61,
-0xa3,0x9e,0x62,0xa3,0xa0,0x63,0xa5,9,0x65,0x13,0x6e,0x64,0x65,0x64,2,0x61,
-0xa3,0x9e,0x62,0xa3,0xa0,0x63,0xa5,9,0x1c,0x72,0x69,0x6f,0x74,0x73,0x79,0x6c,
-0x6c,0x61,0x62,0x61,0x72,0x79,0xa3,0x7b,3,0x6d,0x5a,0x6e,0xa2,0x95,0x70,0xa2,
-0xa0,0x75,0x17,0x6e,0x74,0x69,0x6e,0x67,0x72,0x6f,0x64,0xa2,0x9a,0x17,0x6e,0x75,
-0x6d,0x65,0x72,0x61,0x6c,0x73,0xa3,0x9a,2,0x62,0x3a,0x6d,0xa2,0x5f,0x70,0x15,
-0x61,0x74,0x6a,0x61,0x6d,0x6f,0xa3,0x41,0x14,0x69,0x6e,0x69,0x6e,0x67,2,0x64,
-0x46,0x68,0x9e,0x6d,0x1d,0x61,0x72,0x6b,0x73,0x66,0x6f,0x72,0x73,0x79,0x6d,0x62,
-0x6f,0x6c,0x73,0x77,0x1e,0x69,0x61,0x63,0x72,0x69,0x74,0x69,0x63,0x61,0x6c,0x6d,
-0x61,0x72,0x6b,0x73,0x2e,2,0x65,0x40,0x66,0xa6,0x41,0x73,0x18,0x75,0x70,0x70,
-0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x83,0x16,0x78,0x74,0x65,0x6e,0x64,0x65,0x64,
-0xa3,0xe0,0x17,0x61,0x6c,0x66,0x6d,0x61,0x72,0x6b,0x73,0xa3,0x52,0x11,0x6f,0x6e,
-0x1f,0x69,0x6e,0x64,0x69,0x63,0x6e,0x75,0x6d,0x62,0x65,0x72,0x66,0x6f,0x72,0x6d,
-0x73,0xa3,0xb2,0x1b,0x74,0x72,0x6f,0x6c,0x70,0x69,0x63,0x74,0x75,0x72,0x65,0x73,
-0x83,0x12,0x74,0x69,0x63,0xa2,0x84,0x1b,0x65,0x70,0x61,0x63,0x74,0x6e,0x75,0x6d,
-0x62,0x65,0x72,0x73,0xa3,0xdf,1,0x6e,0x3e,0x72,0x1b,0x72,0x65,0x6e,0x63,0x79,
-0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0x75,0x15,0x65,0x69,0x66,0x6f,0x72,0x6d,0xa2,
-0x98,0x16,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,0xa2,0x99,0x1d,0x61,0x6e,0x64,0x70,
-0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xa3,0x99,0x61,0xa2,0xe1,0x68,
-0xa4,0xb,0x6a,0x10,0x6b,0xa2,0x47,4,0x63,0x8c,0x65,0xa2,0x80,0x72,0xa2,0x98,
-0x73,0xa2,0xaa,0x75,0x1f,0x6e,0x69,0x66,0x69,0x65,0x64,0x69,0x64,0x65,0x6f,0x67,
-0x72,0x61,0x70,0x68,0x73,0xa2,0x47,0x18,0x65,0x78,0x74,0x65,0x6e,0x73,0x69,0x6f,
-0x6e,6,0x64,0x6b,0x64,0xa3,0xd1,0x65,0xa5,0,0x66,0xa5,0x12,0x67,0xa5,0x2e,
-0x14,0x6f,0x6d,0x70,0x61,0x74,0xa2,0x45,1,0x66,0x96,0x69,1,0x62,0x44,0x64,
-0x17,0x65,0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0xa2,0x4f,0x12,0x73,0x75,0x70,0xa3,
-0x5f,0x14,0x69,0x6c,0x69,0x74,0x79,0xa2,0x45,1,0x66,0x54,0x69,0x18,0x64,0x65,
-0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0xa2,0x4f,0x19,0x73,0x75,0x70,0x70,0x6c,0x65,
-0x6d,0x65,0x6e,0x74,0xa3,0x5f,0x13,0x6f,0x72,0x6d,0x73,0xa3,0x53,0x11,0x78,0x74,
-6,0x64,0xc,0x64,0xa3,0xd1,0x65,0xa5,0,0x66,0xa5,0x12,0x67,0xa5,0x2e,0x61,
-0xa3,0x46,0x62,0xa3,0x5e,0x63,0xa3,0xc5,0x19,0x61,0x64,0x69,0x63,0x61,0x6c,0x73,
-0x73,0x75,0x70,0x94,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x95,1,0x74,0x50,
-0x79,0x14,0x6d,0x62,0x6f,0x6c,0x73,0x9a,0x1d,0x61,0x6e,0x64,0x70,0x75,0x6e,0x63,
-0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x9b,0x14,0x72,0x6f,0x6b,0x65,0x73,0xa3,0x82,
-2,0x6e,0x48,0x72,0x64,0x75,0x1d,0x63,0x61,0x73,0x69,0x61,0x6e,0x61,0x6c,0x62,
-0x61,0x6e,0x69,0x61,0x6e,0xa3,0xde,0x1d,0x61,0x64,0x69,0x61,0x6e,0x73,0x79,0x6c,
-0x6c,0x61,0x62,0x69,0x63,0x73,0x63,0x12,0x69,0x61,0x6e,0xa3,0xa8,2,0x61,0x3a,
-0x65,0x4c,0x6f,0x16,0x72,0x61,0x73,0x6d,0x69,0x61,0x6e,0xa5,0x2d,1,0x6b,0x26,
-0x6d,0xa3,0xa4,0x11,0x6d,0x61,0xa3,0xd4,1,0x72,0x38,0x73,0x17,0x73,0x73,0x79,
-0x6d,0x62,0x6f,0x6c,0x73,0xa5,0x19,0x13,0x6f,0x6b,0x65,0x65,0x60,0x12,0x73,0x75,
-0x70,0xa2,0xff,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xff,3,0x65,0x3e,
-0x69,0x7e,0x6f,0xa2,0x69,0x75,0x15,0x70,0x6c,0x6f,0x79,0x61,0x6e,0xa3,0xe1,1,
+0x6c,0x73,0xa3,0xc0,0x13,0x6a,0x61,0x6e,0x67,0xa3,0xa3,0x6d,0xa2,0xe6,0x6e,0xa8,
+0x19,0x6f,6,0x70,0x63,0x70,0x56,0x72,0x8a,0x73,0xa2,0x4c,0x74,0x10,0x74,0x1f,
+0x6f,0x6d,0x61,0x6e,0x73,0x69,0x79,0x61,0x71,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,
+0xa5,0x28,0x18,0x74,0x69,0x63,0x61,0x6c,0x63,0x68,0x61,0x72,0x1f,0x61,0x63,0x74,
+0x65,0x72,0x72,0x65,0x63,0x6f,0x67,0x6e,0x69,0x74,0x69,0x6f,0x6e,0x85,1,0x69,
+0x46,0x6e,0x1e,0x61,0x6d,0x65,0x6e,0x74,0x61,0x6c,0x64,0x69,0x6e,0x67,0x62,0x61,
+0x74,0x73,0xa3,0xf2,0x11,0x79,0x61,0x47,1,0x61,0x30,0x6d,0x13,0x61,0x6e,0x79,
+0x61,0xa3,0x7a,0x11,0x67,0x65,0xa5,0xf,0x63,0xa2,0x71,0x67,0xa2,0x71,0x6c,1,
+0x63,0xa2,0x62,0x64,5,0x70,0x38,0x70,0x36,0x73,0x56,0x74,0x14,0x75,0x72,0x6b,
+0x69,0x63,0xa3,0xbf,0x11,0x65,0x72,1,0x6d,0x2e,0x73,0x12,0x69,0x61,0x6e,0xa3,
+0x8c,0x11,0x69,0x63,0xa3,0xf1,0x10,0x6f,1,0x67,0x3a,0x75,0x18,0x74,0x68,0x61,
+0x72,0x61,0x62,0x69,0x61,0x6e,0xa3,0xbb,0x13,0x64,0x69,0x61,0x6e,0xa5,0x22,0x68,
+0x42,0x69,0x54,0x6e,0x1a,0x6f,0x72,0x74,0x68,0x61,0x72,0x61,0x62,0x69,0x61,0x6e,
+0xa3,0xf0,0x17,0x75,0x6e,0x67,0x61,0x72,0x69,0x61,0x6e,0xa5,4,0x14,0x74,0x61,
+0x6c,0x69,0x63,0xa3,0x58,0x13,0x68,0x69,0x6b,0x69,0xa3,0x9d,0x10,0x72,0x85,0x12,
+0x68,0x61,0x6d,0x65,6,0x6f,0x86,0x6f,0x6c,0x72,0xa2,0x61,0x75,0xa2,0x62,0x79,
+0x14,0x61,0x6e,0x6d,0x61,0x72,0x58,0x12,0x65,0x78,0x74,2,0x61,0xa3,0xb6,0x62,
+0xa3,0xee,0x65,0x13,0x6e,0x64,0x65,0x64,1,0x61,0xa3,0xb6,0x62,0xa3,0xee,1,
+0x64,0x52,0x6e,0x15,0x67,0x6f,0x6c,0x69,0x61,0x6e,0x6a,0x12,0x73,0x75,0x70,0xa4,
+0xd,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0xd,0x10,0x69,0xa2,0xec,0x13,
+0x66,0x69,0x65,0x72,1,0x6c,0x3c,0x74,0x19,0x6f,0x6e,0x65,0x6c,0x65,0x74,0x74,
+0x65,0x72,0x73,0xa3,0x8a,0x15,0x65,0x74,0x74,0x65,0x72,0x73,0x2d,0x10,0x6f,0xa3,
+0xed,1,0x6c,0x44,0x73,0x11,0x69,0x63,0xa2,0x5c,0x18,0x61,0x6c,0x73,0x79,0x6d,
+0x62,0x6f,0x6c,0x73,0xa3,0x5c,0x13,0x74,0x61,0x6e,0x69,0xa5,3,0x61,0xa2,0x9b,
+0x65,0xa4,0x4c,0x69,1,0x61,0xa2,0x8f,0x73,0x10,0x63,5,0x70,0x18,0x70,0xa2,
+0x71,0x73,0x36,0x74,0x17,0x65,0x63,0x68,0x6e,0x69,0x63,0x61,0x6c,0x81,0x15,0x79,
+0x6d,0x62,0x6f,0x6c,0x73,0x8f,0x61,0xa2,0x66,0x65,0x46,0x6d,0x19,0x61,0x74,0x68,
+0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,1,0x61,0xa3,0x66,0x62,0xa3,0x69,0x17,0x6c,
+0x6c,0x61,0x6e,0x65,0x6f,0x75,0x73,2,0x6d,0x3a,0x73,0x6c,0x74,0x17,0x65,0x63,
+0x68,0x6e,0x69,0x63,0x61,0x6c,0x81,0x11,0x61,0x74,0x1f,0x68,0x65,0x6d,0x61,0x74,
+0x69,0x63,0x61,0x6c,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,1,0x61,0xa3,0x66,0x62,
+0xa3,0x69,0x15,0x79,0x6d,0x62,0x6f,0x6c,0x73,0x8e,0x12,0x61,0x6e,0x64,1,0x61,
+0x3c,0x70,0x19,0x69,0x63,0x74,0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0xa3,0xcd,0x14,
+0x72,0x72,0x6f,0x77,0x73,0xa3,0x73,0x10,0x6f,0xa3,0xd8,7,0x72,0x6f,0x72,0x44,
+0x73,0x4e,0x74,0x62,0x79,0x19,0x61,0x6e,0x6e,0x75,0x6d,0x65,0x72,0x61,0x6c,0x73,
+0xa5,0x20,0x13,0x63,0x68,0x65,0x6e,0xa5,0xc,0x18,0x61,0x72,0x61,0x6d,0x67,0x6f,
+0x6e,0x64,0x69,0xa5,0x14,0x10,0x68,2,0x61,0x3a,0x65,0x4a,0x6f,0x17,0x70,0x65,
+0x72,0x61,0x74,0x6f,0x72,0x73,0x7f,0x16,0x6c,0x70,0x68,0x61,0x6e,0x75,0x6d,0xa3,
+0x5d,0x16,0x6d,0x61,0x74,0x69,0x63,0x61,0x6c,1,0x61,0x36,0x6f,0x17,0x70,0x65,
+0x72,0x61,0x74,0x6f,0x72,0x73,0x7f,0x11,0x6c,0x70,0x1f,0x68,0x61,0x6e,0x75,0x6d,
+0x65,0x72,0x69,0x63,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0x5d,0x68,0x50,0x6b,
+0x7e,0x6c,0x88,0x6e,1,0x64,0x34,0x69,0x15,0x63,0x68,0x61,0x65,0x61,0x6e,0xa3,
+0xea,0x12,0x61,0x69,0x63,0xa3,0xc6,1,0x61,0x3e,0x6a,0x12,0x6f,0x6e,0x67,0xa2,
+0xaa,0x14,0x74,0x69,0x6c,0x65,0x73,0xa3,0xaa,0x13,0x6a,0x61,0x6e,0x69,0xa3,0xe9,
+0x13,0x61,0x73,0x61,0x72,0xa5,0x1f,0x15,0x61,0x79,0x61,0x6c,0x61,0x6d,0x4f,3,
+0x64,0x6c,0x65,0x7e,0x6e,0xa2,0x47,0x72,0x14,0x6f,0x69,0x74,0x69,0x63,1,0x63,
+0x3c,0x68,0x19,0x69,0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,0x73,0xa3,0xd7,0x15,
+0x75,0x72,0x73,0x69,0x76,0x65,0xa3,0xd6,0x17,0x65,0x66,0x61,0x69,0x64,0x72,0x69,
+0x6e,0xa5,0x21,0x17,0x74,0x65,0x69,0x6d,0x61,0x79,0x65,0x6b,0xa2,0xb8,0x12,0x65,
+0x78,0x74,0xa2,0xd5,0x16,0x65,0x6e,0x73,0x69,0x6f,0x6e,0x73,0xa3,0xd5,0x18,0x64,
+0x65,0x6b,0x69,0x6b,0x61,0x6b,0x75,0x69,0xa3,0xeb,6,0x6b,0x3b,0x6b,0x56,0x6f,
+0x5a,0x75,0x64,0x79,0x11,0x69,0x61,0x1f,0x6b,0x65,0x6e,0x67,0x70,0x75,0x61,0x63,
+0x68,0x75,0x65,0x68,0x6d,0x6f,0x6e,0x67,0xa5,0x27,0x10,0x6f,0xa3,0x92,0x14,0x62,
+0x6c,0x6f,0x63,0x6b,0x21,1,0x6d,0x2c,0x73,0x11,0x68,0x75,0xa5,0x15,0x17,0x62,
+0x65,0x72,0x66,0x6f,0x72,0x6d,0x73,0x7b,0x61,0x44,0x62,0x21,0x65,0x10,0x77,1,
+0x61,0xa5,0xe,0x74,0x14,0x61,0x69,0x6c,0x75,0x65,0xa3,0x8b,1,0x62,0x38,0x6e,
+0x17,0x64,0x69,0x6e,0x61,0x67,0x61,0x72,0x69,0xa5,0x26,0x15,0x61,0x74,0x61,0x65,
+0x61,0x6e,0xa3,0xef,0x67,0xc4,0x32,0x6a,0xc1,0xb9,0x6a,0xa2,0xd5,0x6b,0xa2,0xee,
+0x6c,4,0x61,0x54,0x65,0xa2,0x61,0x69,0xa2,0x78,0x6f,0xa2,0xb7,0x79,1,0x63,
+0x2e,0x64,0x12,0x69,0x61,0x6e,0xa3,0xa9,0x12,0x69,0x61,0x6e,0xa3,0xa7,1,0x6f,
+0x55,0x74,0x11,0x69,0x6e,1,0x31,0x82,0x65,0x11,0x78,0x74,4,0x61,0x5c,0x62,
+0x29,0x63,0xa3,0x94,0x64,0xa3,0x95,0x65,0xa2,0xe7,0x13,0x6e,0x64,0x65,0x64,4,
+0x61,0x36,0x62,0x29,0x63,0xa3,0x94,0x64,0xa3,0x95,0x65,0xa3,0xe7,0x26,0x18,0x64,
+0x64,0x69,0x74,0x69,0x6f,0x6e,0x61,0x6c,0x6d,0x24,0x12,0x73,0x75,0x70,0x24,0x16,
+0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x25,1,0x70,0x42,0x74,0x1d,0x74,0x65,0x72,
+0x6c,0x69,0x6b,0x65,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0x79,0x12,0x63,0x68,0x61,
+0xa3,0x9c,2,0x6d,0x4e,0x6e,0x54,0x73,0x10,0x75,0xa2,0xb0,0x12,0x73,0x75,0x70,
+0xa4,0x31,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0x31,0x11,0x62,0x75,0xa3,
+0x6f,0x12,0x65,0x61,0x72,1,0x61,0xa3,0xe8,0x62,1,0x69,0x38,0x73,0x17,0x79,
+0x6c,0x6c,0x61,0x62,0x61,0x72,0x79,0xa3,0x75,0x17,0x64,0x65,0x6f,0x67,0x72,0x61,
+0x6d,0x73,0xa3,0x76,0x1a,0x77,0x73,0x75,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0x73,
+0xa3,0x4d,0x10,0x61,1,0x6d,0x32,0x76,0x14,0x61,0x6e,0x65,0x73,0x65,0xa3,0xb5,
+0x10,0x6f,0x5c,0x12,0x65,0x78,0x74,1,0x61,0xa3,0xb4,0x62,0xa3,0xb9,1,0x61,
+0xa2,0x43,0x68,4,0x61,0x40,0x69,0x50,0x6d,0x6e,0x6f,0x86,0x75,0x15,0x64,0x61,
+0x77,0x61,0x64,0x69,0xa3,0xe6,0x16,0x72,0x6f,0x73,0x68,0x74,0x68,0x69,0xa3,0x89,
+0x1d,0x74,0x61,0x6e,0x73,0x6d,0x61,0x6c,0x6c,0x73,0x63,0x72,0x69,0x70,0x74,0xa5,
+0x30,0x11,0x65,0x72,0x68,0x16,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0x71,0x12,
+0x6a,0x6b,0x69,0xa3,0xe5,3,0x69,0x3a,0x6e,0x42,0x74,0xa2,0x51,0x79,0x13,0x61,
+0x68,0x6c,0x69,0xa3,0xa2,0x12,0x74,0x68,0x69,0xa3,0xc1,3,0x61,0x34,0x62,0x76,
+0x67,0x7c,0x6e,0x12,0x61,0x64,0x61,0x4d,1,0x65,0x40,0x73,0x11,0x75,0x70,0xa2,
+0xcb,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xcb,0x11,0x78,0x74,1,0x61,
+0xa5,0x13,0x65,0x14,0x6e,0x64,0x65,0x64,0x61,0xa5,0x13,0x11,0x75,0x6e,0xa3,0x42,
+0x11,0x78,0x69,0x96,0x17,0x72,0x61,0x64,0x69,0x63,0x61,0x6c,0x73,0x97,0x14,0x61,
+0x6b,0x61,0x6e,0x61,0x9e,1,0x65,0x4c,0x70,0x10,0x68,0x1f,0x6f,0x6e,0x65,0x74,
+0x69,0x63,0x65,0x78,0x74,0x65,0x6e,0x73,0x69,0x6f,0x6e,0x73,0xa3,0x6b,0x11,0x78,
+0x74,0xa3,0x6b,0x67,0xa2,0xb5,0x68,0xa4,0x84,0x69,3,0x64,0x4c,0x6d,0xa2,0x55,
+0x6e,0xa2,0x62,0x70,0x13,0x61,0x65,0x78,0x74,0x2a,0x16,0x65,0x6e,0x73,0x69,0x6f,
+0x6e,0x73,0x2b,1,0x63,0x99,0x65,0x17,0x6f,0x67,0x72,0x61,0x70,0x68,0x69,0x63,
+1,0x64,0x56,0x73,0x15,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa4,0xb,0x1d,0x61,0x6e,
+0x64,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xa5,0xb,0x13,0x65,
+0x73,0x63,0x72,0x1f,0x69,0x70,0x74,0x69,0x6f,0x6e,0x63,0x68,0x61,0x72,0x61,0x63,
+0x74,0x65,0x72,0x73,0x99,0x1c,0x70,0x65,0x72,0x69,0x61,0x6c,0x61,0x72,0x61,0x6d,
+0x61,0x69,0x63,0xa3,0xba,1,0x64,0x62,0x73,0x1b,0x63,0x72,0x69,0x70,0x74,0x69,
+0x6f,0x6e,0x61,0x6c,0x70,0x61,1,0x68,0x32,0x72,0x14,0x74,0x68,0x69,0x61,0x6e,
+0xa3,0xbd,0x13,0x6c,0x61,0x76,0x69,0xa3,0xbe,0x11,0x69,0x63,1,0x6e,0x3e,0x73,
+0x1a,0x69,0x79,0x61,0x71,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,0xa5,0x1e,0x19,0x75,
+0x6d,0x62,0x65,0x72,0x66,0x6f,0x72,0x6d,0x73,0xa3,0xb2,4,0x65,0x74,0x6c,0xa2,
+0x82,0x6f,0xa2,0x9a,0x72,0xa2,0x9e,0x75,2,0x6a,0x34,0x6e,0x3e,0x72,0x14,0x6d,
+0x75,0x6b,0x68,0x69,0x43,0x14,0x61,0x72,0x61,0x74,0x69,0x45,0x18,0x6a,0x61,0x6c,
+0x61,0x67,0x6f,0x6e,0x64,0x69,0xa5,0x1c,1,0x6e,0xa2,0x46,0x6f,1,0x6d,0x6e,
+0x72,0x13,0x67,0x69,0x61,0x6e,0x5a,1,0x65,0x40,0x73,0x11,0x75,0x70,0xa2,0x87,
+0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x87,0x11,0x78,0x74,0xa4,0x1b,0x14,
+0x65,0x6e,0x64,0x65,0x64,0xa5,0x1b,0x1a,0x65,0x74,0x72,0x69,0x63,0x73,0x68,0x61,
+0x70,0x65,0x73,0x8c,0x12,0x65,0x78,0x74,0xa2,0xe3,0x14,0x65,0x6e,0x64,0x65,0x64,
+0xa3,0xe3,0x1e,0x65,0x72,0x61,0x6c,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,
+0x6f,0x6e,0x71,0x17,0x61,0x67,0x6f,0x6c,0x69,0x74,0x69,0x63,0xa2,0x88,0x12,0x73,
+0x75,0x70,0xa4,0xa,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0xa,0x13,0x74,
+0x68,0x69,0x63,0xa3,0x59,1,0x61,0x5c,0x65,0x11,0x65,0x6b,0x30,1,0x61,0x38,
+0x65,0x11,0x78,0x74,0x6e,0x14,0x65,0x6e,0x64,0x65,0x64,0x6f,0x17,0x6e,0x64,0x63,
+0x6f,0x70,0x74,0x69,0x63,0x31,0x13,0x6e,0x74,0x68,0x61,0xa3,0xe4,2,0x61,0xa2,
+0x48,0x65,0xa2,0xdf,0x69,1,0x67,0x30,0x72,0x14,0x61,0x67,0x61,0x6e,0x61,0x9d,
+0x10,0x68,1,0x70,0x3a,0x73,0x18,0x75,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0x73,
+0xa3,0x4b,1,0x72,0x3c,0x75,0x19,0x73,0x75,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,
+0x73,0xa3,0x4c,0x11,0x69,0x76,0x1f,0x61,0x74,0x65,0x75,0x73,0x65,0x73,0x75,0x72,
+0x72,0x6f,0x67,0x61,0x74,0x65,0x73,0xa3,0x4c,2,0x6c,0x32,0x6e,0x9a,0x74,0x12,
+0x72,0x61,0x6e,0xa5,2,0x10,0x66,2,0x61,0x58,0x6d,0x70,0x77,0x14,0x69,0x64,
+0x74,0x68,0x61,0x1f,0x6e,0x64,0x66,0x75,0x6c,0x6c,0x77,0x69,0x64,0x74,0x68,0x66,
+0x6f,0x72,0x6d,0x73,0xa3,0x57,0x1a,0x6e,0x64,0x66,0x75,0x6c,0x6c,0x66,0x6f,0x72,
+0x6d,0x73,0xa3,0x57,0x13,0x61,0x72,0x6b,0x73,0xa3,0x52,2,0x67,0x34,0x69,0xa2,
+0x45,0x75,0x12,0x6e,0x6f,0x6f,0xa3,0x63,0x11,0x75,0x6c,0xa2,0x4a,2,0x63,0x3c,
+0x6a,0x5e,0x73,0x17,0x79,0x6c,0x6c,0x61,0x62,0x6c,0x65,0x73,0xa3,0x4a,0x1f,0x6f,
+0x6d,0x70,0x61,0x74,0x69,0x62,0x69,0x6c,0x69,0x74,0x79,0x6a,0x61,0x6d,0x6f,0xa3,
+0x41,0x12,0x61,0x6d,0x6f,0x5c,0x17,0x65,0x78,0x74,0x65,0x6e,0x64,0x65,0x64,1,
+0x61,0xa3,0xb4,0x62,0xa3,0xb9,0x19,0x66,0x69,0x72,0x6f,0x68,0x69,0x6e,0x67,0x79,
+0x61,0xa5,0x1d,0x13,0x62,0x72,0x65,0x77,0x37,0x61,0xa4,5,0x62,0xa6,0x45,0x63,
+0xa8,0x1a,0x64,0xac,0xb8,0x65,5,0x6d,0xa2,0x6d,0x86,0x6e,0x96,0x74,0x15,0x68,
+0x69,0x6f,0x70,0x69,0x63,0x5e,1,0x65,0x40,0x73,0x11,0x75,0x70,0xa2,0x86,0x16,
+0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x86,0x11,0x78,0x74,0xa2,0x85,1,0x61,
+0xa3,0xc8,0x65,0x13,0x6e,0x64,0x65,0x64,0xa2,0x85,0x10,0x61,0xa3,0xc8,0x16,0x6f,
+0x74,0x69,0x63,0x6f,0x6e,0x73,0xa3,0xce,0x15,0x63,0x6c,0x6f,0x73,0x65,0x64,2,
+0x61,0x5a,0x63,0x9e,0x69,0x1c,0x64,0x65,0x6f,0x67,0x72,0x61,0x70,0x68,0x69,0x63,
+0x73,0x75,0x70,0xa2,0xc4,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xc4,0x16,
+0x6c,0x70,0x68,0x61,0x6e,0x75,0x6d,0x86,1,0x65,0x2c,0x73,0x11,0x75,0x70,0xa3,
+0xc3,0x13,0x72,0x69,0x63,0x73,0x86,0x18,0x75,0x70,0x70,0x6c,0x65,0x6d,0x65,0x6e,
+0x74,0xa3,0xc3,0x11,0x6a,0x6b,0xa2,0x44,0x1f,0x6c,0x65,0x74,0x74,0x65,0x72,0x73,
+0x61,0x6e,0x64,0x6d,0x6f,0x6e,0x74,0x68,0x73,0xa3,0x44,0x61,0x4a,0x67,0x76,0x6c,
+1,0x62,0x30,0x79,0x13,0x6d,0x61,0x69,0x63,0xa5,0x25,0x13,0x61,0x73,0x61,0x6e,
+0xa3,0xe2,0x13,0x72,0x6c,0x79,0x64,0x1f,0x79,0x6e,0x61,0x73,0x74,0x69,0x63,0x63,
+0x75,0x6e,0x65,0x69,0x66,0x6f,0x72,0x6d,0xa5,1,0x1f,0x79,0x70,0x74,0x69,0x61,
+0x6e,0x68,0x69,0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,1,0x66,0x26,0x73,0xa3,
+0xc2,0x1c,0x6f,0x72,0x6d,0x61,0x74,0x63,0x6f,0x6e,0x74,0x72,0x6f,0x6c,0x73,0xa5,
+0x24,7,0x6e,0xc0,0xe5,0x6e,0x3e,0x72,0xa2,0x5d,0x73,0xa2,0xd8,0x76,0x14,0x65,
+0x73,0x74,0x61,0x6e,0xa3,0xbc,1,0x61,0x92,0x63,0x13,0x69,0x65,0x6e,0x74,1,
+0x67,0x34,0x73,0x15,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0xa5,0x13,0x72,0x65,0x65,
+0x6b,1,0x6d,0x34,0x6e,0x15,0x75,0x6d,0x62,0x65,0x72,0x73,0xa3,0x7f,0x13,0x75,
+0x73,0x69,0x63,0xa2,0x7e,0x19,0x61,0x6c,0x6e,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e,
+0xa3,0x7e,0x10,0x74,0x1f,0x6f,0x6c,0x69,0x61,0x6e,0x68,0x69,0x65,0x72,0x6f,0x67,
+0x6c,0x79,0x70,0x68,0x73,0xa3,0xfe,2,0x61,0x32,0x6d,0xa2,0x71,0x72,0x12,0x6f,
+0x77,0x73,0x7d,0x12,0x62,0x69,0x63,0x38,3,0x65,0x4a,0x6d,0x66,0x70,0xa2,0x43,
+0x73,0x11,0x75,0x70,0xa2,0x80,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x80,
+0x11,0x78,0x74,1,0x61,0xa3,0xd2,0x65,0x14,0x6e,0x64,0x65,0x64,0x61,0xa3,0xd2,
+0x12,0x61,0x74,0x68,0xa2,0xd3,0x18,0x65,0x6d,0x61,0x74,0x69,0x63,0x61,0x6c,0x61,
+0x1f,0x6c,0x70,0x68,0x61,0x62,0x65,0x74,0x69,0x63,0x73,0x79,0x6d,0x62,0x6f,0x6c,
+0x73,0xa3,0xd3,1,0x66,0x42,0x72,0x1e,0x65,0x73,0x65,0x6e,0x74,0x61,0x74,0x69,
+0x6f,0x6e,0x66,0x6f,0x72,0x6d,0x73,1,0x61,0xa3,0x51,0x62,0xa3,0x55,0x14,0x65,
+0x6e,0x69,0x61,0x6e,0x35,0x12,0x63,0x69,0x69,0x23,0x64,0x9e,0x65,0xa2,0x42,0x68,
+0xa2,0x4d,0x6c,1,0x63,0x62,0x70,0x17,0x68,0x61,0x62,0x65,0x74,0x69,0x63,0x70,
+1,0x66,0xa3,0x50,0x72,0x1e,0x65,0x73,0x65,0x6e,0x74,0x61,0x74,0x69,0x6f,0x6e,
+0x66,0x6f,0x72,0x6d,0x73,0xa3,0x50,0x16,0x68,0x65,0x6d,0x69,0x63,0x61,0x6c,0xa2,
+0xd0,0x16,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0xd0,0x12,0x6c,0x61,0x6d,0xa5,
+7,0x1a,0x67,0x65,0x61,0x6e,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,0xa3,0x77,0x11,
+0x6f,0x6d,0xa3,0xfd,7,0x6f,0x71,0x6f,0x64,0x72,0xa2,0x41,0x75,0xa2,0x58,0x79,
+0x1b,0x7a,0x61,0x6e,0x74,0x69,0x6e,0x65,0x6d,0x75,0x73,0x69,0x63,0xa2,0x5b,0x18,
+0x61,0x6c,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0x5b,1,0x70,0x34,0x78,0x16,
+0x64,0x72,0x61,0x77,0x69,0x6e,0x67,0x89,0x14,0x6f,0x6d,0x6f,0x66,0x6f,0xa0,0x12,
+0x65,0x78,0x74,0xa2,0x43,0x14,0x65,0x6e,0x64,0x65,0x64,0xa3,0x43,0x10,0x61,1,
+0x68,0x40,0x69,0x12,0x6c,0x6c,0x65,0x92,0x17,0x70,0x61,0x74,0x74,0x65,0x72,0x6e,
+0x73,0x93,0x11,0x6d,0x69,0xa3,0xc9,1,0x67,0x2c,0x68,0x11,0x69,0x64,0xa3,0x64,
+0x14,0x69,0x6e,0x65,0x73,0x65,0xa3,0x81,0x61,0x48,0x65,0xa2,0x4e,0x68,0xa2,0x52,
+0x6c,0x1a,0x6f,0x63,0x6b,0x65,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x73,0x8b,3,0x6c,
+0x34,0x6d,0x40,0x73,0x66,0x74,0x11,0x61,0x6b,0xa3,0xc7,0x14,0x69,0x6e,0x65,0x73,
+0x65,0xa3,0x93,0x11,0x75,0x6d,0xa2,0xb1,0x12,0x73,0x75,0x70,0xa2,0xca,0x16,0x70,
+0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xca,1,0x69,0x30,0x73,0x13,0x61,0x76,0x61,
+0x68,0xa3,0xdd,0x15,0x63,0x6c,0x61,0x74,0x69,0x6e,0x23,0x14,0x6e,0x67,0x61,0x6c,
+0x69,0x41,0x16,0x61,0x69,0x6b,0x73,0x75,0x6b,0x69,0xa5,8,5,0x6f,0xc1,0x4c,
+0x6f,0xa2,0x55,0x75,0xa4,0x10,0x79,1,0x70,0x9c,0x72,0x14,0x69,0x6c,0x6c,0x69,
+0x63,0x32,1,0x65,0x4c,0x73,0x11,0x75,0x70,0xa2,0x61,0x16,0x70,0x6c,0x65,0x6d,
+0x65,0x6e,0x74,0xa2,0x61,0x12,0x61,0x72,0x79,0xa3,0x61,0x11,0x78,0x74,3,0x61,
+0xa3,0x9e,0x62,0xa3,0xa0,0x63,0xa5,9,0x65,0x13,0x6e,0x64,0x65,0x64,2,0x61,
+0xa3,0x9e,0x62,0xa3,0xa0,0x63,0xa5,9,0x1c,0x72,0x69,0x6f,0x74,0x73,0x79,0x6c,
+0x6c,0x61,0x62,0x61,0x72,0x79,0xa3,0x7b,3,0x6d,0x5a,0x6e,0xa2,0x95,0x70,0xa2,
+0xa0,0x75,0x17,0x6e,0x74,0x69,0x6e,0x67,0x72,0x6f,0x64,0xa2,0x9a,0x17,0x6e,0x75,
+0x6d,0x65,0x72,0x61,0x6c,0x73,0xa3,0x9a,2,0x62,0x3a,0x6d,0xa2,0x5f,0x70,0x15,
+0x61,0x74,0x6a,0x61,0x6d,0x6f,0xa3,0x41,0x14,0x69,0x6e,0x69,0x6e,0x67,2,0x64,
+0x46,0x68,0x9e,0x6d,0x1d,0x61,0x72,0x6b,0x73,0x66,0x6f,0x72,0x73,0x79,0x6d,0x62,
+0x6f,0x6c,0x73,0x77,0x1e,0x69,0x61,0x63,0x72,0x69,0x74,0x69,0x63,0x61,0x6c,0x6d,
+0x61,0x72,0x6b,0x73,0x2e,2,0x65,0x40,0x66,0xa6,0x41,0x73,0x18,0x75,0x70,0x70,
+0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x83,0x16,0x78,0x74,0x65,0x6e,0x64,0x65,0x64,
+0xa3,0xe0,0x17,0x61,0x6c,0x66,0x6d,0x61,0x72,0x6b,0x73,0xa3,0x52,0x11,0x6f,0x6e,
+0x1f,0x69,0x6e,0x64,0x69,0x63,0x6e,0x75,0x6d,0x62,0x65,0x72,0x66,0x6f,0x72,0x6d,
+0x73,0xa3,0xb2,0x1b,0x74,0x72,0x6f,0x6c,0x70,0x69,0x63,0x74,0x75,0x72,0x65,0x73,
+0x83,0x12,0x74,0x69,0x63,0xa2,0x84,0x1b,0x65,0x70,0x61,0x63,0x74,0x6e,0x75,0x6d,
+0x62,0x65,0x72,0x73,0xa3,0xdf,1,0x6e,0x3e,0x72,0x1b,0x72,0x65,0x6e,0x63,0x79,
+0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0x75,0x15,0x65,0x69,0x66,0x6f,0x72,0x6d,0xa2,
+0x98,0x16,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,0xa2,0x99,0x1d,0x61,0x6e,0x64,0x70,
+0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xa3,0x99,0x61,0xa2,0xe1,0x68,
+0xa4,0xb,0x6a,0x10,0x6b,0xa2,0x47,4,0x63,0x8c,0x65,0xa2,0x80,0x72,0xa2,0x98,
+0x73,0xa2,0xaa,0x75,0x1f,0x6e,0x69,0x66,0x69,0x65,0x64,0x69,0x64,0x65,0x6f,0x67,
+0x72,0x61,0x70,0x68,0x73,0xa2,0x47,0x18,0x65,0x78,0x74,0x65,0x6e,0x73,0x69,0x6f,
+0x6e,6,0x64,0x6b,0x64,0xa3,0xd1,0x65,0xa5,0,0x66,0xa5,0x12,0x67,0xa5,0x2e,
+0x14,0x6f,0x6d,0x70,0x61,0x74,0xa2,0x45,1,0x66,0x96,0x69,1,0x62,0x44,0x64,
+0x17,0x65,0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0xa2,0x4f,0x12,0x73,0x75,0x70,0xa3,
+0x5f,0x14,0x69,0x6c,0x69,0x74,0x79,0xa2,0x45,1,0x66,0x54,0x69,0x18,0x64,0x65,
+0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0xa2,0x4f,0x19,0x73,0x75,0x70,0x70,0x6c,0x65,
+0x6d,0x65,0x6e,0x74,0xa3,0x5f,0x13,0x6f,0x72,0x6d,0x73,0xa3,0x53,0x11,0x78,0x74,
+6,0x64,0xc,0x64,0xa3,0xd1,0x65,0xa5,0,0x66,0xa5,0x12,0x67,0xa5,0x2e,0x61,
+0xa3,0x46,0x62,0xa3,0x5e,0x63,0xa3,0xc5,0x19,0x61,0x64,0x69,0x63,0x61,0x6c,0x73,
+0x73,0x75,0x70,0x94,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x95,1,0x74,0x50,
+0x79,0x14,0x6d,0x62,0x6f,0x6c,0x73,0x9a,0x1d,0x61,0x6e,0x64,0x70,0x75,0x6e,0x63,
+0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x9b,0x14,0x72,0x6f,0x6b,0x65,0x73,0xa3,0x82,
+2,0x6e,0x48,0x72,0x64,0x75,0x1d,0x63,0x61,0x73,0x69,0x61,0x6e,0x61,0x6c,0x62,
+0x61,0x6e,0x69,0x61,0x6e,0xa3,0xde,0x1d,0x61,0x64,0x69,0x61,0x6e,0x73,0x79,0x6c,
+0x6c,0x61,0x62,0x69,0x63,0x73,0x63,0x12,0x69,0x61,0x6e,0xa3,0xa8,2,0x61,0x3a,
+0x65,0x4c,0x6f,0x16,0x72,0x61,0x73,0x6d,0x69,0x61,0x6e,0xa5,0x2d,1,0x6b,0x26,
+0x6d,0xa3,0xa4,0x11,0x6d,0x61,0xa3,0xd4,1,0x72,0x38,0x73,0x17,0x73,0x73,0x79,
+0x6d,0x62,0x6f,0x6c,0x73,0xa5,0x19,0x13,0x6f,0x6b,0x65,0x65,0x60,0x12,0x73,0x75,
+0x70,0xa2,0xff,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xff,3,0x65,0x3e,
+0x69,0x7e,0x6f,0xa2,0x69,0x75,0x15,0x70,0x6c,0x6f,0x79,0x61,0x6e,0xa3,0xe1,1,
0x73,0x50,0x76,0x16,0x61,0x6e,0x61,0x67,0x61,0x72,0x69,0x3e,0x12,0x65,0x78,0x74,
0xa2,0xb3,0x14,0x65,0x6e,0x64,0x65,0x64,0xa3,0xb3,0x13,0x65,0x72,0x65,0x74,0xa3,
-0x5a,2,0x61,0x3a,0x6e,0x82,0x76,0x16,0x65,0x73,0x61,0x6b,0x75,0x72,0x75,0xa5,
-0x2f,0x18,0x63,0x72,0x69,0x74,0x69,0x63,0x61,0x6c,0x73,0x2e,2,0x65,0x30,0x66,
-0x36,0x73,0x11,0x75,0x70,0xa3,0x83,0x11,0x78,0x74,0xa3,0xe0,0x18,0x6f,0x72,0x73,
-0x79,0x6d,0x62,0x6f,0x6c,0x73,0x77,0x14,0x67,0x62,0x61,0x74,0x73,0x91,1,0x67,
-0x3e,0x6d,0x12,0x69,0x6e,0x6f,0xa2,0xab,0x14,0x74,0x69,0x6c,0x65,0x73,0xa3,0xab,
-0x11,0x72,0x61,0xa5,0x1a,8,0x6d,0x5f,0x6d,0x3a,0x6e,0x48,0x73,0x7a,0x76,0xa2,
-0x4b,0x77,0x12,0x69,0x64,0x65,0x43,0x11,0x65,0x64,0x32,0x12,0x69,0x61,0x6c,0x33,
-2,0x61,0x40,0x62,0x37,0x6f,1,0x62,0x28,0x6e,0x10,0x65,0x21,0x13,0x72,0x65,
-0x61,0x6b,0x37,0x10,0x72,0x34,0x12,0x72,0x6f,0x77,0x35,2,0x6d,0x38,0x71,0x46,
-0x75,1,0x62,0x3d,0x70,0x3e,0x11,0x65,0x72,0x3f,1,0x61,0x24,0x6c,0x39,0x11,
-0x6c,0x6c,0x39,1,0x72,0x3b,0x75,0x12,0x61,0x72,0x65,0x3b,0x12,0x65,0x72,0x74,
-0x40,0x13,0x69,0x63,0x61,0x6c,0x41,0x63,0x58,0x65,0x92,0x66,0x96,0x69,1,0x6e,
-0x36,0x73,0x10,0x6f,0x30,0x14,0x6c,0x61,0x74,0x65,0x64,0x31,0x11,0x69,0x74,0x2e,
-0x12,0x69,0x61,0x6c,0x2f,2,0x61,0x36,0x69,0x48,0x6f,0x10,0x6d,0x24,0x12,0x70,
-0x61,0x74,0x25,0x10,0x6e,0x22,0x15,0x6f,0x6e,0x69,0x63,0x61,0x6c,0x23,0x13,0x72,
-0x63,0x6c,0x65,0x27,0x11,0x6e,0x63,0x27,2,0x69,0x3a,0x6f,0x44,0x72,0x10,0x61,
-0x2c,0x14,0x63,0x74,0x69,0x6f,0x6e,0x2d,0x10,0x6e,0x28,0x11,0x61,0x6c,0x29,0x11,
-0x6e,0x74,0x2b,4,0x61,0x3a,0x66,0x4c,0x68,0x5e,0x6e,0x70,0x77,0x2a,0x12,0x69,
-0x64,0x65,0x2b,0x22,0x17,0x6d,0x62,0x69,0x67,0x75,0x6f,0x75,0x73,0x23,0x26,0x17,
-0x75,0x6c,0x6c,0x77,0x69,0x64,0x74,0x68,0x27,0x24,0x17,0x61,0x6c,0x66,0x77,0x69,
-0x64,0x74,0x68,0x25,0x20,1,0x61,0x30,0x65,0x14,0x75,0x74,0x72,0x61,0x6c,0x21,
-0x28,0x13,0x72,0x72,0x6f,0x77,0x29,0xd,0x6e,0xc0,0xfb,0x73,0x6d,0x73,0x3a,0x74,
-0x98,0x75,0xa2,0x49,0x7a,2,0x6c,0x3b,0x70,0x3d,0x73,0x39,5,0x6f,0x28,0x6f,
-0x57,0x70,0x34,0x75,0x16,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0x45,0x11,0x61,0x63,
-1,0x65,0x32,0x69,0x15,0x6e,0x67,0x6d,0x61,0x72,0x6b,0x31,0x18,0x73,0x65,0x70,
-0x61,0x72,0x61,0x74,0x6f,0x72,0x39,0x63,0x53,0x6b,0x55,0x6d,0x51,0x1d,0x69,0x74,
-0x6c,0x65,0x63,0x61,0x73,0x65,0x6c,0x65,0x74,0x74,0x65,0x72,0x27,1,0x6e,0x40,
-0x70,0x1c,0x70,0x65,0x72,0x63,0x61,0x73,0x65,0x6c,0x65,0x74,0x74,0x65,0x72,0x23,
-0x17,0x61,0x73,0x73,0x69,0x67,0x6e,0x65,0x64,0x21,0x6e,0x8a,0x6f,0xa2,0x47,0x70,
-8,0x66,0x14,0x66,0x5b,0x69,0x59,0x6f,0x4f,0x72,0x24,0x73,0x49,0x17,0x69,0x76,
-0x61,0x74,0x65,0x75,0x73,0x65,0x43,0x61,0x2c,0x63,0x4d,0x64,0x47,0x65,0x4b,0x1f,
-0x72,0x61,0x67,0x72,0x61,0x70,0x68,0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,
-0x3d,2,0x64,0x33,0x6c,0x35,0x6f,0x36,0x1b,0x6e,0x73,0x70,0x61,0x63,0x69,0x6e,
-0x67,0x6d,0x61,0x72,0x6b,0x2d,1,0x70,0x7c,0x74,0x12,0x68,0x65,0x72,3,0x6c,
-0x38,0x6e,0x42,0x70,0x4c,0x73,0x14,0x79,0x6d,0x62,0x6f,0x6c,0x57,0x14,0x65,0x74,
-0x74,0x65,0x72,0x2b,0x14,0x75,0x6d,0x62,0x65,0x72,0x37,0x19,0x75,0x6e,0x63,0x74,
-0x75,0x61,0x74,0x69,0x6f,0x6e,0x4f,0x1c,0x65,0x6e,0x70,0x75,0x6e,0x63,0x74,0x75,
-0x61,0x74,0x69,0x6f,0x6e,0x49,0x66,0x9e,0x66,0x88,0x69,0xa2,0x4b,0x6c,0xa2,0x5c,
-0x6d,4,0x61,0x60,0x63,0x31,0x65,0x2f,0x6e,0x2d,0x6f,0x15,0x64,0x69,0x66,0x69,
-0x65,0x72,1,0x6c,0x30,0x73,0x14,0x79,0x6d,0x62,0x6f,0x6c,0x55,0x14,0x65,0x74,
-0x74,0x65,0x72,0x29,0x17,0x74,0x68,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x51,1,0x69,
-0x2e,0x6f,0x13,0x72,0x6d,0x61,0x74,0x41,0x1d,0x6e,0x61,0x6c,0x70,0x75,0x6e,0x63,
-0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x5b,0x10,0x6e,0x1f,0x69,0x74,0x69,0x61,0x6c,
-0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x59,6,0x6d,0x18,0x6d,
-0x29,0x6f,0x28,0x74,0x27,0x75,0x23,0x2a,0x1c,0x77,0x65,0x72,0x63,0x61,0x73,0x65,
-0x6c,0x65,0x74,0x74,0x65,0x72,0x25,0x65,0x28,0x69,0x3c,0x6c,0x25,0x19,0x74,0x74,
-0x65,0x72,0x6e,0x75,0x6d,0x62,0x65,0x72,0x35,0x1a,0x6e,0x65,0x73,0x65,0x70,0x61,
-0x72,0x61,0x74,0x6f,0x72,0x3b,0x63,0x44,0x64,0xa2,0x60,0x65,0x1b,0x6e,0x63,0x6c,
-0x6f,0x73,0x69,0x6e,0x67,0x6d,0x61,0x72,0x6b,0x2f,6,0x6e,0x39,0x6e,0x46,0x6f,
-0x4e,0x73,0x45,0x75,0x1b,0x72,0x72,0x65,0x6e,0x63,0x79,0x73,0x79,0x6d,0x62,0x6f,
-0x6c,0x53,0x20,0x12,0x74,0x72,0x6c,0x3f,0x42,0x10,0x6e,1,0x6e,0x2c,0x74,0x12,
-0x72,0x6f,0x6c,0x3f,0x1f,0x65,0x63,0x74,0x6f,0x72,0x70,0x75,0x6e,0x63,0x74,0x75,
-0x61,0x74,0x69,0x6f,0x6e,0x4d,0x63,0x3f,0x66,0x41,0x6c,0x1d,0x6f,0x73,0x65,0x70,
-0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4b,2,0x61,0x30,0x65,0x4a,
-0x69,0x12,0x67,0x69,0x74,0x33,0x1c,0x73,0x68,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,
-0x74,0x69,0x6f,0x6e,0x47,0x1a,0x63,0x69,0x6d,0x61,0x6c,0x6e,0x75,0x6d,0x62,0x65,
-0x72,0x33,0,0x12,0x6d,0xc2,0x3f,0x73,0xa1,0x73,0x4e,0x74,0xa2,0x56,0x77,0xa2,
-0x72,0x79,0xa2,0x73,0x7a,1,0x61,0x2c,0x68,0x12,0x61,0x69,0x6e,0x8b,0x11,0x69,
-0x6e,0x85,5,0x74,0x22,0x74,0x38,0x77,0x4c,0x79,0x16,0x72,0x69,0x61,0x63,0x77,
-0x61,0x77,0x6f,0x18,0x72,0x61,0x69,0x67,0x68,0x74,0x77,0x61,0x77,0xa3,0x55,0x15,
-0x61,0x73,0x68,0x6b,0x61,0x66,0x6d,0x61,0x2e,0x65,0x38,0x68,0x11,0x69,0x6e,0x6b,
-0x10,0x64,0x62,0x11,0x68,0x65,0x65,1,0x65,0x2e,0x6d,0x13,0x6b,0x61,0x74,0x68,
-0x69,0x10,0x6e,0x67,1,0x61,0x4e,0x65,1,0x68,0x28,0x74,0x10,0x68,0x77,0x16,
-0x6d,0x61,0x72,0x62,0x75,0x74,0x61,0x74,0x13,0x67,0x6f,0x61,0x6c,0x3d,1,0x68,
-0x71,0x77,0x73,0x11,0x61,0x77,0x79,1,0x65,0x32,0x75,0x11,0x64,0x68,0x80,0x11,
-0x68,0x65,0x83,0x10,0x68,0x7a,1,0x62,0x34,0x77,0x16,0x69,0x74,0x68,0x74,0x61,
-0x69,0x6c,0x7f,0x14,0x61,0x72,0x72,0x65,0x65,0x7d,0x6d,0x6c,0x6e,0xa4,0x6b,0x70,
-0xa4,0x88,0x71,0xa4,0x88,0x72,1,0x65,0x38,0x6f,0x18,0x68,0x69,0x6e,0x67,0x79,
-0x61,0x79,0x65,0x68,0x93,1,0x68,0x5f,0x76,0x16,0x65,0x72,0x73,0x65,0x64,0x70,
-0x65,0x61,2,0x61,0x2e,0x65,0xa4,0x3e,0x69,0x10,0x6d,0x53,1,0x6c,0xa2,0xe7,
-0x6e,0x16,0x69,0x63,0x68,0x61,0x65,0x61,0x6e,0,0x12,0x6e,0x76,0x73,0x51,0x73,
-0x3e,0x74,0x5c,0x77,0xa0,0x79,0xa2,0x42,0x7a,0x13,0x61,0x79,0x69,0x6e,0xa3,0x54,
-0x10,0x61,1,0x64,0x2e,0x6d,0x12,0x65,0x6b,0x68,0xa3,0x4c,0x11,0x68,0x65,0xa3,
-0x4b,3,0x61,0x38,0x65,0x3c,0x68,0x4a,0x77,0x13,0x65,0x6e,0x74,0x79,0xa3,0x51,
-0x10,0x77,0xa3,0x4d,1,0x6e,0xa3,0x4e,0x74,0x10,0x68,0xa3,0x4f,0x14,0x61,0x6d,
-0x65,0x64,0x68,0xa3,0x50,0x11,0x61,0x77,0xa3,0x52,0x12,0x6f,0x64,0x68,0xa3,0x53,
-0x6e,0x3a,0x6f,0x40,0x70,0x46,0x71,0x4a,0x72,0x12,0x65,0x73,0x68,0xa3,0x4a,0x11,
-0x75,0x6e,0xa3,0x46,0x11,0x6e,0x65,0xa3,0x47,0x10,0x65,0xa3,0x48,0x12,0x6f,0x70,
-0x68,0xa3,0x49,0x67,0x33,0x67,0x38,0x68,0x40,0x6b,0x5e,0x6c,0x66,0x6d,0x11,0x65,
-0x6d,0xa3,0x45,0x13,0x69,0x6d,0x65,0x6c,0xa1,1,0x65,0x32,0x75,0x14,0x6e,0x64,
-0x72,0x65,0x64,0xa3,0x42,0x11,0x74,0x68,0xa3,0x41,0x12,0x61,0x70,0x68,0xa3,0x43,
-0x14,0x61,0x6d,0x65,0x64,0x68,0xa3,0x44,0x61,0x34,0x62,0x4a,0x64,0x50,0x66,0x12,
-0x69,0x76,0x65,0x9f,1,0x6c,0x2a,0x79,0x11,0x69,0x6e,0x97,0x12,0x65,0x70,0x68,
-0x95,0x12,0x65,0x74,0x68,0x99,1,0x61,0x30,0x68,0x14,0x61,0x6d,0x65,0x64,0x68,
-0x9d,0x13,0x6c,0x65,0x74,0x68,0x9b,0x15,0x61,0x79,0x61,0x6c,0x61,0x6d,6,0x6e,
-0x2c,0x6e,0x34,0x72,0x5e,0x73,0x62,0x74,0x11,0x74,0x61,0xa3,0x63,2,0x67,0x2e,
-0x6e,0x32,0x79,0x10,0x61,0xa3,0x60,0x10,0x61,0xa3,0x5d,1,0x61,0xa3,0x5e,0x6e,
-0x10,0x61,0xa3,0x5f,0x10,0x61,0xa3,0x61,0x11,0x73,0x61,0xa3,0x62,0x62,0x3c,0x6a,
-0x42,0x6c,0x10,0x6c,1,0x61,0xa3,0x5b,0x6c,0x10,0x61,0xa3,0x5c,0x11,0x68,0x61,
-0xa3,0x59,0x10,0x61,0xa3,0x5a,0x11,0x65,0x6d,0x51,2,0x6f,0x2c,0x75,0x50,0x79,
-0x10,0x61,0x91,1,0x6a,0x28,0x6f,0x10,0x6e,0x55,0x1a,0x6f,0x69,0x6e,0x69,0x6e,
-0x67,0x67,0x72,0x6f,0x75,0x70,0x21,0x10,0x6e,0x57,0x10,0x65,0x59,0x10,0x61,1,
-0x66,0x5b,0x70,0x10,0x68,0x5d,0x66,0x9a,0x66,0x42,0x67,0x7a,0x68,0x8a,0x6b,0xa2,
-0x75,0x6c,0x11,0x61,0x6d,0x4c,0x12,0x61,0x64,0x68,0x4f,2,0x61,0x3e,0x65,0x4a,
-0x69,0x19,0x6e,0x61,0x6c,0x73,0x65,0x6d,0x6b,0x61,0x74,0x68,0x35,0x15,0x72,0x73,
-0x69,0x79,0x65,0x68,0x8f,0x86,0x10,0x68,0x33,0x10,0x61,1,0x66,0x37,0x6d,0x11,
-0x61,0x6c,0x39,1,0x61,0x40,0x65,0x3e,1,0x68,0x28,0x74,0x10,0x68,0x45,0x40,
-0x13,0x67,0x6f,0x61,0x6c,0x43,2,0x68,0x3b,0x6d,0x5c,0x6e,0x1a,0x69,0x66,0x69,
-0x72,0x6f,0x68,0x69,0x6e,0x67,0x79,0x61,1,0x6b,0x2a,0x70,0x10,0x61,0xa3,0x65,
-0x15,0x69,0x6e,0x6e,0x61,0x79,0x61,0xa3,0x64,0x1a,0x7a,0x61,0x6f,0x6e,0x68,0x65,
-0x68,0x67,0x6f,0x61,0x6c,0x3d,2,0x61,0x3a,0x68,0x44,0x6e,0x17,0x6f,0x74,0x74,
-0x65,0x64,0x68,0x65,0x68,0x4b,1,0x66,0x47,0x70,0x10,0x68,0x49,0x12,0x61,0x70,
-0x68,0x89,0x61,0x2e,0x62,0x8a,0x64,0xa2,0x51,0x65,0x31,2,0x66,0x3c,0x69,0x70,
-0x6c,1,0x61,0x28,0x65,0x10,0x66,0x27,0x11,0x70,0x68,0x25,0x14,0x72,0x69,0x63,
-0x61,0x6e,2,0x66,0x30,0x6e,0x36,0x71,0x11,0x61,0x66,0xa3,0x58,0x11,0x65,0x68,
-0xa3,0x56,0x12,0x6f,0x6f,0x6e,0xa3,0x57,0x10,0x6e,0x23,1,0x65,0x4a,0x75,0x10,
-0x72,0x1f,0x75,0x73,0x68,0x61,0x73,0x6b,0x69,0x79,0x65,0x68,0x62,0x61,0x72,0x72,
-0x65,0x65,0x8d,1,0x68,0x29,0x74,0x10,0x68,0x2b,0x11,0x61,0x6c,0x2c,0x16,0x61,
-0x74,0x68,0x72,0x69,0x73,0x68,0x2f,7,0x6e,0x2e,0x6e,0x2c,0x72,0x3e,0x74,0x56,
-0x75,0x21,0x18,0x6f,0x6e,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x21,0x28,0x1a,0x69,
-0x67,0x68,0x74,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x29,0x2a,0x19,0x72,0x61,0x6e,
-0x73,0x70,0x61,0x72,0x65,0x6e,0x74,0x2b,0x63,0x23,0x64,0x40,0x6a,0x56,0x6c,0x26,
-0x19,0x65,0x66,0x74,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x27,0x24,0x19,0x75,0x61,
-0x6c,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x25,0x19,0x6f,0x69,0x6e,0x63,0x61,0x75,
-0x73,0x69,0x6e,0x67,0x23,0,0x13,0x6e,0xc0,0xd0,0x73,0x49,0x73,0x48,0x75,0x78,
-0x77,0x84,0x78,0x9c,0x7a,0x10,0x77,0x58,1,0x6a,0x75,0x73,0x13,0x70,0x61,0x63,
-0x65,0x59,4,0x61,0x51,0x67,0x53,0x70,0x28,0x75,0x30,0x79,0x57,0x54,0x12,0x61,
-0x63,0x65,0x55,0x16,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0x53,0x15,0x6e,0x6b,0x6e,
-0x6f,0x77,0x6e,0x21,1,0x6a,0x5d,0x6f,0x17,0x72,0x64,0x6a,0x6f,0x69,0x6e,0x65,
-0x72,0x5d,0x10,0x78,0x21,0x6e,0x60,0x6f,0xa2,0x41,0x70,0xa2,0x50,0x71,0xa2,0x6e,
-0x72,1,0x65,0x24,0x69,0x6f,0x1e,0x67,0x69,0x6f,0x6e,0x61,0x6c,0x69,0x6e,0x64,
-0x69,0x63,0x61,0x74,0x6f,0x72,0x6f,4,0x65,0x3e,0x6c,0x5b,0x6f,0x46,0x73,0x45,
-0x75,0x46,0x14,0x6d,0x65,0x72,0x69,0x63,0x47,0x15,0x78,0x74,0x6c,0x69,0x6e,0x65,
-0x5b,0x17,0x6e,0x73,0x74,0x61,0x72,0x74,0x65,0x72,0x45,0x10,0x70,0x48,0x1c,0x65,
-0x6e,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x49,1,0x6f,0x3e,
-0x72,0x4c,0x1a,0x65,0x66,0x69,0x78,0x6e,0x75,0x6d,0x65,0x72,0x69,0x63,0x4d,0x4a,
-0x1b,0x73,0x74,0x66,0x69,0x78,0x6e,0x75,0x6d,0x65,0x72,0x69,0x63,0x4b,0x10,0x75,
-0x4e,0x16,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e,0x4f,0x68,0x7b,0x68,0x50,0x69,0x86,
-0x6a,0xa2,0x61,0x6c,0xa2,0x65,0x6d,0x1c,0x61,0x6e,0x64,0x61,0x74,0x6f,0x72,0x79,
-0x62,0x72,0x65,0x61,0x6b,0x2d,4,0x32,0x5f,0x33,0x61,0x65,0x34,0x6c,0x6d,0x79,
-0x3a,0x13,0x70,0x68,0x65,0x6e,0x3b,0x19,0x62,0x72,0x65,0x77,0x6c,0x65,0x74,0x74,
-0x65,0x72,0x6d,2,0x64,0x28,0x6e,0x3c,0x73,0x41,0x3c,0x18,0x65,0x6f,0x67,0x72,
-0x61,0x70,0x68,0x69,0x63,0x3d,0x3e,1,0x66,0x3e,0x73,0x11,0x65,0x70,1,0x61,
-0x22,0x65,0x14,0x72,0x61,0x62,0x6c,0x65,0x3f,0x18,0x69,0x78,0x6e,0x75,0x6d,0x65,
-0x72,0x69,0x63,0x41,2,0x6c,0x63,0x74,0x65,0x76,0x67,1,0x66,0x43,0x69,0x15,
-0x6e,0x65,0x66,0x65,0x65,0x64,0x43,0x61,0x40,0x62,0x70,0x63,0xa2,0x55,0x65,0xa2,
-0xdb,0x67,0x10,0x6c,0x38,0x11,0x75,0x65,0x39,2,0x69,0x23,0x6c,0x34,0x6d,0x16,
-0x62,0x69,0x67,0x75,0x6f,0x75,0x73,0x23,0x24,0x17,0x70,0x68,0x61,0x62,0x65,0x74,
-0x69,0x63,0x25,4,0x32,0x27,0x61,0x29,0x62,0x2b,0x6b,0x2d,0x72,0x12,0x65,0x61,
-0x6b,2,0x61,0x36,0x62,0x3e,0x73,0x15,0x79,0x6d,0x62,0x6f,0x6c,0x73,0x57,0x13,
-0x66,0x74,0x65,0x72,0x29,1,0x65,0x2a,0x6f,0x11,0x74,0x68,0x27,0x13,0x66,0x6f,
-0x72,0x65,0x2b,7,0x6d,0x51,0x6d,0x33,0x6f,0x28,0x70,0x69,0x72,0x35,1,0x6d,
-0x76,0x6e,1,0x64,0x3c,0x74,0x1a,0x69,0x6e,0x67,0x65,0x6e,0x74,0x62,0x72,0x65,
-0x61,0x6b,0x2f,0x15,0x69,0x74,0x69,0x6f,0x6e,0x61,0x1f,0x6c,0x6a,0x61,0x70,0x61,
-0x6e,0x65,0x73,0x65,0x73,0x74,0x61,0x72,0x74,0x65,0x72,0x6b,1,0x62,0x3a,0x70,
-0x19,0x6c,0x65,0x78,0x63,0x6f,0x6e,0x74,0x65,0x78,0x74,0x51,0x18,0x69,0x6e,0x69,
-0x6e,0x67,0x6d,0x61,0x72,0x6b,0x33,0x61,0x6a,0x62,0x2f,0x6a,0x6b,0x6c,0x30,0x13,
-0x6f,0x73,0x65,0x70,1,0x61,0x38,0x75,0x18,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,
-0x6f,0x6e,0x31,0x18,0x72,0x65,0x6e,0x74,0x68,0x65,0x73,0x69,0x73,0x69,0x1b,0x72,
-0x72,0x69,0x61,0x67,0x65,0x72,0x65,0x74,0x75,0x72,0x6e,0x35,2,0x62,0x3e,0x6d,
-0x46,0x78,0x36,0x18,0x63,0x6c,0x61,0x6d,0x61,0x74,0x69,0x6f,0x6e,0x37,0x70,0x12,
-0x61,0x73,0x65,0x71,0x72,0x16,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,0x73,1,0x64,
-0x42,0x6e,1,0x6f,0x32,0x75,0x26,0x14,0x6d,0x65,0x72,0x69,0x63,0x27,0x11,0x6e,
-0x65,0x21,1,0x65,0x2e,0x69,0x24,0x12,0x67,0x69,0x74,0x25,0x22,0x14,0x63,0x69,
-0x6d,0x61,0x6c,0x23,0,0x18,0x6e,0xc4,0x2a,0x74,0xc1,0x6d,0x77,0x96,0x77,0xa2,
-0x4c,0x78,0xa2,0x70,0x79,0xa2,0x7a,0x7a,6,0x73,0x1e,0x73,0x34,0x78,0x42,0x79,
-0x48,0x7a,0x11,0x7a,0x7a,0xa3,0x67,0x10,0x79,1,0x65,0xa3,0xae,0x6d,0xa3,0x81,
-0x11,0x78,0x78,0xa3,0x66,0x11,0x79,0x79,0x21,0x61,0x30,0x69,0x58,0x6d,0x11,0x74,
-0x68,0xa3,0x80,0x10,0x6e,1,0x61,0x26,0x62,0xa3,0xb1,0x1a,0x62,0x61,0x7a,0x61,
-0x72,0x73,0x71,0x75,0x61,0x72,0x65,0xa3,0xb1,0x11,0x6e,0x68,0x23,2,0x61,0x30,
-0x63,0x5a,0x6f,0x11,0x6c,0x65,0xa3,0x9b,1,0x6e,0x3c,0x72,0x10,0x61,0xa2,0x92,
-0x15,0x6e,0x67,0x63,0x69,0x74,0x69,0xa3,0x92,0x12,0x63,0x68,0x6f,0xa3,0xbc,0x11,
-0x68,0x6f,0xa3,0xbc,1,0x70,0x2c,0x73,0x11,0x75,0x78,0xa3,0x65,0x11,0x65,0x6f,
-0x9b,1,0x65,0x2c,0x69,0x72,0x11,0x69,0x69,0x73,0x11,0x7a,0x69,0xa2,0xc0,0x11,
-0x64,0x69,0xa3,0xc0,0x74,0x4a,0x75,0xa2,0xba,0x76,1,0x61,0x2c,0x69,0x11,0x73,
-0x70,0xa3,0x64,0x10,0x69,0xa2,0x63,0x10,0x69,0xa3,0x63,5,0x67,0x36,0x67,0x68,
-0x68,0x6c,0x69,2,0x62,0x3a,0x66,0x4a,0x72,0x10,0x68,0xa2,0x9e,0x12,0x75,0x74,
-0x61,0xa3,0x9e,1,0x65,0x24,0x74,0x6f,0x12,0x74,0x61,0x6e,0x6f,0x14,0x69,0x6e,
-0x61,0x67,0x68,0x99,0x11,0x6c,0x67,0x75,0x10,0x61,1,0x61,0x24,0x69,0x6d,0x6a,
-0x11,0x6e,0x61,0x6b,0x61,0x30,0x65,0xa2,0x5b,0x66,0x11,0x6e,0x67,0x99,6,0x6c,
-0x21,0x6c,0x32,0x6d,0x38,0x6e,0x44,0x76,0x10,0x74,0xa3,0x7f,1,0x65,0x89,0x75,
-0x97,1,0x69,0x24,0x6c,0x67,0x10,0x6c,0x67,0x10,0x67,0xa2,0x9a,0x11,0x75,0x74,
-0xa3,0x9a,0x67,0x36,0x69,0x52,0x6b,0x10,0x72,0xa2,0x99,0x10,0x69,0xa3,0x99,1,
-0x61,0x30,0x62,0x7a,0x13,0x61,0x6e,0x77,0x61,0x7b,0x12,0x6c,0x6f,0x67,0x75,2,
-0x6c,0x32,0x74,0x34,0x76,0x12,0x69,0x65,0x74,0xa3,0x7f,0x10,0x65,0x89,0x12,0x68,
-0x61,0x6d,0xa3,0x6a,1,0x6c,0x2a,0x6e,0x10,0x67,0xa3,0x62,0x10,0x75,0x68,0x11,
-0x67,0x75,0x69,1,0x67,0x32,0x6e,0x14,0x6b,0x6e,0x6f,0x77,0x6e,0xa3,0x67,0x11,
-0x61,0x72,0x8a,0x13,0x69,0x74,0x69,0x63,0x8b,0x71,0xc1,0x13,0x71,0xa2,0xde,0x72,
-0xa2,0xe3,0x73,6,0x69,0x8a,0x69,0x72,0x6f,0xa2,0x4c,0x75,0xa2,0x75,0x79,1,
-0x6c,0x46,0x72,4,0x63,0x65,0x65,0xa3,0x5f,0x69,0x2c,0x6a,0xa3,0x60,0x6e,0xa3,
-0x61,0x11,0x61,0x63,0x65,0x10,0x6f,0x94,0x16,0x74,0x69,0x6e,0x61,0x67,0x72,0x69,
-0x95,2,0x64,0x3c,0x67,0x4c,0x6e,1,0x64,0xa3,0x91,0x68,0x62,0x12,0x61,0x6c,
-0x61,0x63,0x10,0x64,0xa2,0xa6,0x12,0x68,0x61,0x6d,0xa3,0xa6,0x17,0x6e,0x77,0x72,
-0x69,0x74,0x69,0x6e,0x67,0xa3,0x70,2,0x67,0x3a,0x72,0x52,0x79,0x10,0x6f,0xa2,
-0xb0,0x12,0x6d,0x62,0x6f,0xa3,0xb0,1,0x64,0x26,0x6f,0xa3,0xb8,0xa2,0xb7,0x12,
-0x69,0x61,0x6e,0xa3,0xb7,0x10,0x61,0xa2,0x98,0x16,0x73,0x6f,0x6d,0x70,0x65,0x6e,
-0x67,0xa3,0x98,0x11,0x6e,0x64,0xa2,0x71,0x14,0x61,0x6e,0x65,0x73,0x65,0xa3,0x71,
-0x61,0x5c,0x67,0xa2,0x43,0x68,1,0x61,0x2a,0x72,0x10,0x64,0xa3,0x97,2,0x72,
-0x28,0x76,0x30,0x77,0x87,0x12,0x61,0x64,0x61,0xa3,0x97,0x12,0x69,0x61,0x6e,0x87,
-2,0x6d,0x40,0x72,0x58,0x75,0x10,0x72,0xa2,0x6f,0x15,0x61,0x73,0x68,0x74,0x72,
-0x61,0xa3,0x6f,1,0x61,0x26,0x72,0xa3,0x7e,0x14,0x72,0x69,0x74,0x61,0x6e,0xa3,
-0x7e,1,0x61,0xa3,0x5e,0x62,0xa3,0x85,0x11,0x6e,0x77,0xa3,0x70,0x11,0x61,0x61,
-1,0x63,0x2f,0x69,0x23,3,0x65,0x3e,0x6a,0x48,0x6f,0x4e,0x75,0x10,0x6e,1,
-0x69,0x24,0x72,0x61,0x10,0x63,0x61,0x13,0x6a,0x61,0x6e,0x67,0xa3,0x6e,0x11,0x6e,
-0x67,0xa3,0x6e,1,0x68,0x2a,0x72,0x10,0x6f,0xa3,0x5d,0x10,0x67,0xa3,0xb6,0x6e,
-0xa2,0x83,0x6f,0xa2,0xf2,0x70,5,0x6c,0x1e,0x6c,0x44,0x72,0x4a,0x73,0x1b,0x61,
-0x6c,0x74,0x65,0x72,0x70,0x61,0x68,0x6c,0x61,0x76,0x69,0xa3,0x7b,0x11,0x72,0x64,
-0xa3,0x5c,0x11,0x74,0x69,0xa3,0x7d,0x61,0x7c,0x65,0xa2,0x54,0x68,3,0x61,0x3e,
-0x6c,0x4e,0x6e,0x5e,0x6f,0x16,0x65,0x6e,0x69,0x63,0x69,0x61,0x6e,0xa3,0x5b,0x10,
-0x67,0xa2,0x5a,0x12,0x73,0x70,0x61,0xa3,0x5a,2,0x69,0xa3,0x7a,0x70,0xa3,0x7b,
-0x76,0xa3,0x7c,0x10,0x78,0xa3,0x5b,2,0x68,0x3e,0x6c,0x50,0x75,0x10,0x63,0xa2,
-0xa5,0x14,0x69,0x6e,0x68,0x61,0x75,0xa3,0xa5,0x17,0x61,0x77,0x68,0x68,0x6d,0x6f,
-0x6e,0x67,0xa3,0x4b,0x10,0x6d,0xa2,0x90,0x14,0x79,0x72,0x65,0x6e,0x65,0xa3,0x90,
-0x11,0x72,0x6d,0xa3,0x59,6,0x6b,0x36,0x6b,0x56,0x73,0x6e,0x75,0x74,0x79,0x11,
-0x69,0x61,0x1f,0x6b,0x65,0x6e,0x67,0x70,0x75,0x61,0x63,0x68,0x75,0x65,0x68,0x6d,
-0x6f,0x6e,0x67,0xa3,0xba,1,0x67,0x2e,0x6f,0xa2,0x57,0x10,0x6f,0xa3,0x57,0x10,
-0x62,0xa3,0x84,0x11,0x68,0x75,0xa3,0x96,0x12,0x73,0x68,0x75,0xa3,0x96,0x61,0x42,
-0x62,0x80,0x65,0x10,0x77,1,0x61,0xa3,0xaa,0x74,0x14,0x61,0x69,0x6c,0x75,0x65,
-0x97,2,0x62,0x2e,0x6e,0x3c,0x72,0x10,0x62,0xa3,0x8e,0x15,0x61,0x74,0x61,0x65,
-0x61,0x6e,0xa3,0x8f,0x10,0x64,0xa2,0xbb,0x16,0x69,0x6e,0x61,0x67,0x61,0x72,0x69,
-0xa3,0xbb,0x11,0x61,0x74,0xa3,0x8f,3,0x67,0x5a,0x6c,0x6c,0x72,0xa2,0x93,0x73,
+0x5a,2,0x61,0x3a,0x6e,0x82,0x76,0x16,0x65,0x73,0x61,0x6b,0x75,0x72,0x75,0xa5,
+0x2f,0x18,0x63,0x72,0x69,0x74,0x69,0x63,0x61,0x6c,0x73,0x2e,2,0x65,0x30,0x66,
+0x36,0x73,0x11,0x75,0x70,0xa3,0x83,0x11,0x78,0x74,0xa3,0xe0,0x18,0x6f,0x72,0x73,
+0x79,0x6d,0x62,0x6f,0x6c,0x73,0x77,0x14,0x67,0x62,0x61,0x74,0x73,0x91,1,0x67,
+0x3e,0x6d,0x12,0x69,0x6e,0x6f,0xa2,0xab,0x14,0x74,0x69,0x6c,0x65,0x73,0xa3,0xab,
+0x11,0x72,0x61,0xa5,0x1a,8,0x6d,0x5f,0x6d,0x3a,0x6e,0x48,0x73,0x7a,0x76,0xa2,
+0x4b,0x77,0x12,0x69,0x64,0x65,0x43,0x11,0x65,0x64,0x32,0x12,0x69,0x61,0x6c,0x33,
+2,0x61,0x40,0x62,0x37,0x6f,1,0x62,0x28,0x6e,0x10,0x65,0x21,0x13,0x72,0x65,
+0x61,0x6b,0x37,0x10,0x72,0x34,0x12,0x72,0x6f,0x77,0x35,2,0x6d,0x38,0x71,0x46,
+0x75,1,0x62,0x3d,0x70,0x3e,0x11,0x65,0x72,0x3f,1,0x61,0x24,0x6c,0x39,0x11,
+0x6c,0x6c,0x39,1,0x72,0x3b,0x75,0x12,0x61,0x72,0x65,0x3b,0x12,0x65,0x72,0x74,
+0x40,0x13,0x69,0x63,0x61,0x6c,0x41,0x63,0x58,0x65,0x92,0x66,0x96,0x69,1,0x6e,
+0x36,0x73,0x10,0x6f,0x30,0x14,0x6c,0x61,0x74,0x65,0x64,0x31,0x11,0x69,0x74,0x2e,
+0x12,0x69,0x61,0x6c,0x2f,2,0x61,0x36,0x69,0x48,0x6f,0x10,0x6d,0x24,0x12,0x70,
+0x61,0x74,0x25,0x10,0x6e,0x22,0x15,0x6f,0x6e,0x69,0x63,0x61,0x6c,0x23,0x13,0x72,
+0x63,0x6c,0x65,0x27,0x11,0x6e,0x63,0x27,2,0x69,0x3a,0x6f,0x44,0x72,0x10,0x61,
+0x2c,0x14,0x63,0x74,0x69,0x6f,0x6e,0x2d,0x10,0x6e,0x28,0x11,0x61,0x6c,0x29,0x11,
+0x6e,0x74,0x2b,4,0x61,0x3a,0x66,0x4c,0x68,0x5e,0x6e,0x70,0x77,0x2a,0x12,0x69,
+0x64,0x65,0x2b,0x22,0x17,0x6d,0x62,0x69,0x67,0x75,0x6f,0x75,0x73,0x23,0x26,0x17,
+0x75,0x6c,0x6c,0x77,0x69,0x64,0x74,0x68,0x27,0x24,0x17,0x61,0x6c,0x66,0x77,0x69,
+0x64,0x74,0x68,0x25,0x20,1,0x61,0x30,0x65,0x14,0x75,0x74,0x72,0x61,0x6c,0x21,
+0x28,0x13,0x72,0x72,0x6f,0x77,0x29,0xd,0x6e,0xc0,0xfb,0x73,0x6d,0x73,0x3a,0x74,
+0x98,0x75,0xa2,0x49,0x7a,2,0x6c,0x3b,0x70,0x3d,0x73,0x39,5,0x6f,0x28,0x6f,
+0x57,0x70,0x34,0x75,0x16,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0x45,0x11,0x61,0x63,
+1,0x65,0x32,0x69,0x15,0x6e,0x67,0x6d,0x61,0x72,0x6b,0x31,0x18,0x73,0x65,0x70,
+0x61,0x72,0x61,0x74,0x6f,0x72,0x39,0x63,0x53,0x6b,0x55,0x6d,0x51,0x1d,0x69,0x74,
+0x6c,0x65,0x63,0x61,0x73,0x65,0x6c,0x65,0x74,0x74,0x65,0x72,0x27,1,0x6e,0x40,
+0x70,0x1c,0x70,0x65,0x72,0x63,0x61,0x73,0x65,0x6c,0x65,0x74,0x74,0x65,0x72,0x23,
+0x17,0x61,0x73,0x73,0x69,0x67,0x6e,0x65,0x64,0x21,0x6e,0x8a,0x6f,0xa2,0x47,0x70,
+8,0x66,0x14,0x66,0x5b,0x69,0x59,0x6f,0x4f,0x72,0x24,0x73,0x49,0x17,0x69,0x76,
+0x61,0x74,0x65,0x75,0x73,0x65,0x43,0x61,0x2c,0x63,0x4d,0x64,0x47,0x65,0x4b,0x1f,
+0x72,0x61,0x67,0x72,0x61,0x70,0x68,0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,
+0x3d,2,0x64,0x33,0x6c,0x35,0x6f,0x36,0x1b,0x6e,0x73,0x70,0x61,0x63,0x69,0x6e,
+0x67,0x6d,0x61,0x72,0x6b,0x2d,1,0x70,0x7c,0x74,0x12,0x68,0x65,0x72,3,0x6c,
+0x38,0x6e,0x42,0x70,0x4c,0x73,0x14,0x79,0x6d,0x62,0x6f,0x6c,0x57,0x14,0x65,0x74,
+0x74,0x65,0x72,0x2b,0x14,0x75,0x6d,0x62,0x65,0x72,0x37,0x19,0x75,0x6e,0x63,0x74,
+0x75,0x61,0x74,0x69,0x6f,0x6e,0x4f,0x1c,0x65,0x6e,0x70,0x75,0x6e,0x63,0x74,0x75,
+0x61,0x74,0x69,0x6f,0x6e,0x49,0x66,0x9e,0x66,0x88,0x69,0xa2,0x4b,0x6c,0xa2,0x5c,
+0x6d,4,0x61,0x60,0x63,0x31,0x65,0x2f,0x6e,0x2d,0x6f,0x15,0x64,0x69,0x66,0x69,
+0x65,0x72,1,0x6c,0x30,0x73,0x14,0x79,0x6d,0x62,0x6f,0x6c,0x55,0x14,0x65,0x74,
+0x74,0x65,0x72,0x29,0x17,0x74,0x68,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x51,1,0x69,
+0x2e,0x6f,0x13,0x72,0x6d,0x61,0x74,0x41,0x1d,0x6e,0x61,0x6c,0x70,0x75,0x6e,0x63,
+0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x5b,0x10,0x6e,0x1f,0x69,0x74,0x69,0x61,0x6c,
+0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x59,6,0x6d,0x18,0x6d,
+0x29,0x6f,0x28,0x74,0x27,0x75,0x23,0x2a,0x1c,0x77,0x65,0x72,0x63,0x61,0x73,0x65,
+0x6c,0x65,0x74,0x74,0x65,0x72,0x25,0x65,0x28,0x69,0x3c,0x6c,0x25,0x19,0x74,0x74,
+0x65,0x72,0x6e,0x75,0x6d,0x62,0x65,0x72,0x35,0x1a,0x6e,0x65,0x73,0x65,0x70,0x61,
+0x72,0x61,0x74,0x6f,0x72,0x3b,0x63,0x44,0x64,0xa2,0x60,0x65,0x1b,0x6e,0x63,0x6c,
+0x6f,0x73,0x69,0x6e,0x67,0x6d,0x61,0x72,0x6b,0x2f,6,0x6e,0x39,0x6e,0x46,0x6f,
+0x4e,0x73,0x45,0x75,0x1b,0x72,0x72,0x65,0x6e,0x63,0x79,0x73,0x79,0x6d,0x62,0x6f,
+0x6c,0x53,0x20,0x12,0x74,0x72,0x6c,0x3f,0x42,0x10,0x6e,1,0x6e,0x2c,0x74,0x12,
+0x72,0x6f,0x6c,0x3f,0x1f,0x65,0x63,0x74,0x6f,0x72,0x70,0x75,0x6e,0x63,0x74,0x75,
+0x61,0x74,0x69,0x6f,0x6e,0x4d,0x63,0x3f,0x66,0x41,0x6c,0x1d,0x6f,0x73,0x65,0x70,
+0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4b,2,0x61,0x30,0x65,0x4a,
+0x69,0x12,0x67,0x69,0x74,0x33,0x1c,0x73,0x68,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,
+0x74,0x69,0x6f,0x6e,0x47,0x1a,0x63,0x69,0x6d,0x61,0x6c,0x6e,0x75,0x6d,0x62,0x65,
+0x72,0x33,0,0x12,0x6d,0xc2,0x3f,0x73,0xa1,0x73,0x4e,0x74,0xa2,0x56,0x77,0xa2,
+0x72,0x79,0xa2,0x73,0x7a,1,0x61,0x2c,0x68,0x12,0x61,0x69,0x6e,0x8b,0x11,0x69,
+0x6e,0x85,5,0x74,0x22,0x74,0x38,0x77,0x4c,0x79,0x16,0x72,0x69,0x61,0x63,0x77,
+0x61,0x77,0x6f,0x18,0x72,0x61,0x69,0x67,0x68,0x74,0x77,0x61,0x77,0xa3,0x55,0x15,
+0x61,0x73,0x68,0x6b,0x61,0x66,0x6d,0x61,0x2e,0x65,0x38,0x68,0x11,0x69,0x6e,0x6b,
+0x10,0x64,0x62,0x11,0x68,0x65,0x65,1,0x65,0x2e,0x6d,0x13,0x6b,0x61,0x74,0x68,
+0x69,0x10,0x6e,0x67,1,0x61,0x4e,0x65,1,0x68,0x28,0x74,0x10,0x68,0x77,0x16,
+0x6d,0x61,0x72,0x62,0x75,0x74,0x61,0x74,0x13,0x67,0x6f,0x61,0x6c,0x3d,1,0x68,
+0x71,0x77,0x73,0x11,0x61,0x77,0x79,1,0x65,0x32,0x75,0x11,0x64,0x68,0x80,0x11,
+0x68,0x65,0x83,0x10,0x68,0x7a,1,0x62,0x34,0x77,0x16,0x69,0x74,0x68,0x74,0x61,
+0x69,0x6c,0x7f,0x14,0x61,0x72,0x72,0x65,0x65,0x7d,0x6d,0x6c,0x6e,0xa4,0x6b,0x70,
+0xa4,0x88,0x71,0xa4,0x88,0x72,1,0x65,0x38,0x6f,0x18,0x68,0x69,0x6e,0x67,0x79,
+0x61,0x79,0x65,0x68,0x93,1,0x68,0x5f,0x76,0x16,0x65,0x72,0x73,0x65,0x64,0x70,
+0x65,0x61,2,0x61,0x2e,0x65,0xa4,0x3e,0x69,0x10,0x6d,0x53,1,0x6c,0xa2,0xe7,
+0x6e,0x16,0x69,0x63,0x68,0x61,0x65,0x61,0x6e,0,0x12,0x6e,0x76,0x73,0x51,0x73,
+0x3e,0x74,0x5c,0x77,0xa0,0x79,0xa2,0x42,0x7a,0x13,0x61,0x79,0x69,0x6e,0xa3,0x54,
+0x10,0x61,1,0x64,0x2e,0x6d,0x12,0x65,0x6b,0x68,0xa3,0x4c,0x11,0x68,0x65,0xa3,
+0x4b,3,0x61,0x38,0x65,0x3c,0x68,0x4a,0x77,0x13,0x65,0x6e,0x74,0x79,0xa3,0x51,
+0x10,0x77,0xa3,0x4d,1,0x6e,0xa3,0x4e,0x74,0x10,0x68,0xa3,0x4f,0x14,0x61,0x6d,
+0x65,0x64,0x68,0xa3,0x50,0x11,0x61,0x77,0xa3,0x52,0x12,0x6f,0x64,0x68,0xa3,0x53,
+0x6e,0x3a,0x6f,0x40,0x70,0x46,0x71,0x4a,0x72,0x12,0x65,0x73,0x68,0xa3,0x4a,0x11,
+0x75,0x6e,0xa3,0x46,0x11,0x6e,0x65,0xa3,0x47,0x10,0x65,0xa3,0x48,0x12,0x6f,0x70,
+0x68,0xa3,0x49,0x67,0x33,0x67,0x38,0x68,0x40,0x6b,0x5e,0x6c,0x66,0x6d,0x11,0x65,
+0x6d,0xa3,0x45,0x13,0x69,0x6d,0x65,0x6c,0xa1,1,0x65,0x32,0x75,0x14,0x6e,0x64,
+0x72,0x65,0x64,0xa3,0x42,0x11,0x74,0x68,0xa3,0x41,0x12,0x61,0x70,0x68,0xa3,0x43,
+0x14,0x61,0x6d,0x65,0x64,0x68,0xa3,0x44,0x61,0x34,0x62,0x4a,0x64,0x50,0x66,0x12,
+0x69,0x76,0x65,0x9f,1,0x6c,0x2a,0x79,0x11,0x69,0x6e,0x97,0x12,0x65,0x70,0x68,
+0x95,0x12,0x65,0x74,0x68,0x99,1,0x61,0x30,0x68,0x14,0x61,0x6d,0x65,0x64,0x68,
+0x9d,0x13,0x6c,0x65,0x74,0x68,0x9b,0x15,0x61,0x79,0x61,0x6c,0x61,0x6d,6,0x6e,
+0x2c,0x6e,0x34,0x72,0x5e,0x73,0x62,0x74,0x11,0x74,0x61,0xa3,0x63,2,0x67,0x2e,
+0x6e,0x32,0x79,0x10,0x61,0xa3,0x60,0x10,0x61,0xa3,0x5d,1,0x61,0xa3,0x5e,0x6e,
+0x10,0x61,0xa3,0x5f,0x10,0x61,0xa3,0x61,0x11,0x73,0x61,0xa3,0x62,0x62,0x3c,0x6a,
+0x42,0x6c,0x10,0x6c,1,0x61,0xa3,0x5b,0x6c,0x10,0x61,0xa3,0x5c,0x11,0x68,0x61,
+0xa3,0x59,0x10,0x61,0xa3,0x5a,0x11,0x65,0x6d,0x51,2,0x6f,0x2c,0x75,0x50,0x79,
+0x10,0x61,0x91,1,0x6a,0x28,0x6f,0x10,0x6e,0x55,0x1a,0x6f,0x69,0x6e,0x69,0x6e,
+0x67,0x67,0x72,0x6f,0x75,0x70,0x21,0x10,0x6e,0x57,0x10,0x65,0x59,0x10,0x61,1,
+0x66,0x5b,0x70,0x10,0x68,0x5d,0x66,0x9a,0x66,0x42,0x67,0x7a,0x68,0x8a,0x6b,0xa2,
+0x75,0x6c,0x11,0x61,0x6d,0x4c,0x12,0x61,0x64,0x68,0x4f,2,0x61,0x3e,0x65,0x4a,
+0x69,0x19,0x6e,0x61,0x6c,0x73,0x65,0x6d,0x6b,0x61,0x74,0x68,0x35,0x15,0x72,0x73,
+0x69,0x79,0x65,0x68,0x8f,0x86,0x10,0x68,0x33,0x10,0x61,1,0x66,0x37,0x6d,0x11,
+0x61,0x6c,0x39,1,0x61,0x40,0x65,0x3e,1,0x68,0x28,0x74,0x10,0x68,0x45,0x40,
+0x13,0x67,0x6f,0x61,0x6c,0x43,2,0x68,0x3b,0x6d,0x5c,0x6e,0x1a,0x69,0x66,0x69,
+0x72,0x6f,0x68,0x69,0x6e,0x67,0x79,0x61,1,0x6b,0x2a,0x70,0x10,0x61,0xa3,0x65,
+0x15,0x69,0x6e,0x6e,0x61,0x79,0x61,0xa3,0x64,0x1a,0x7a,0x61,0x6f,0x6e,0x68,0x65,
+0x68,0x67,0x6f,0x61,0x6c,0x3d,2,0x61,0x3a,0x68,0x44,0x6e,0x17,0x6f,0x74,0x74,
+0x65,0x64,0x68,0x65,0x68,0x4b,1,0x66,0x47,0x70,0x10,0x68,0x49,0x12,0x61,0x70,
+0x68,0x89,0x61,0x2e,0x62,0x8a,0x64,0xa2,0x51,0x65,0x31,2,0x66,0x3c,0x69,0x70,
+0x6c,1,0x61,0x28,0x65,0x10,0x66,0x27,0x11,0x70,0x68,0x25,0x14,0x72,0x69,0x63,
+0x61,0x6e,2,0x66,0x30,0x6e,0x36,0x71,0x11,0x61,0x66,0xa3,0x58,0x11,0x65,0x68,
+0xa3,0x56,0x12,0x6f,0x6f,0x6e,0xa3,0x57,0x10,0x6e,0x23,1,0x65,0x4a,0x75,0x10,
+0x72,0x1f,0x75,0x73,0x68,0x61,0x73,0x6b,0x69,0x79,0x65,0x68,0x62,0x61,0x72,0x72,
+0x65,0x65,0x8d,1,0x68,0x29,0x74,0x10,0x68,0x2b,0x11,0x61,0x6c,0x2c,0x16,0x61,
+0x74,0x68,0x72,0x69,0x73,0x68,0x2f,7,0x6e,0x2e,0x6e,0x2c,0x72,0x3e,0x74,0x56,
+0x75,0x21,0x18,0x6f,0x6e,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x21,0x28,0x1a,0x69,
+0x67,0x68,0x74,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x29,0x2a,0x19,0x72,0x61,0x6e,
+0x73,0x70,0x61,0x72,0x65,0x6e,0x74,0x2b,0x63,0x23,0x64,0x40,0x6a,0x56,0x6c,0x26,
+0x19,0x65,0x66,0x74,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x27,0x24,0x19,0x75,0x61,
+0x6c,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x25,0x19,0x6f,0x69,0x6e,0x63,0x61,0x75,
+0x73,0x69,0x6e,0x67,0x23,0,0x13,0x6e,0xc0,0xd0,0x73,0x49,0x73,0x48,0x75,0x78,
+0x77,0x84,0x78,0x9c,0x7a,0x10,0x77,0x58,1,0x6a,0x75,0x73,0x13,0x70,0x61,0x63,
+0x65,0x59,4,0x61,0x51,0x67,0x53,0x70,0x28,0x75,0x30,0x79,0x57,0x54,0x12,0x61,
+0x63,0x65,0x55,0x16,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0x53,0x15,0x6e,0x6b,0x6e,
+0x6f,0x77,0x6e,0x21,1,0x6a,0x5d,0x6f,0x17,0x72,0x64,0x6a,0x6f,0x69,0x6e,0x65,
+0x72,0x5d,0x10,0x78,0x21,0x6e,0x60,0x6f,0xa2,0x41,0x70,0xa2,0x50,0x71,0xa2,0x6e,
+0x72,1,0x65,0x24,0x69,0x6f,0x1e,0x67,0x69,0x6f,0x6e,0x61,0x6c,0x69,0x6e,0x64,
+0x69,0x63,0x61,0x74,0x6f,0x72,0x6f,4,0x65,0x3e,0x6c,0x5b,0x6f,0x46,0x73,0x45,
+0x75,0x46,0x14,0x6d,0x65,0x72,0x69,0x63,0x47,0x15,0x78,0x74,0x6c,0x69,0x6e,0x65,
+0x5b,0x17,0x6e,0x73,0x74,0x61,0x72,0x74,0x65,0x72,0x45,0x10,0x70,0x48,0x1c,0x65,
+0x6e,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x49,1,0x6f,0x3e,
+0x72,0x4c,0x1a,0x65,0x66,0x69,0x78,0x6e,0x75,0x6d,0x65,0x72,0x69,0x63,0x4d,0x4a,
+0x1b,0x73,0x74,0x66,0x69,0x78,0x6e,0x75,0x6d,0x65,0x72,0x69,0x63,0x4b,0x10,0x75,
+0x4e,0x16,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e,0x4f,0x68,0x7b,0x68,0x50,0x69,0x86,
+0x6a,0xa2,0x61,0x6c,0xa2,0x65,0x6d,0x1c,0x61,0x6e,0x64,0x61,0x74,0x6f,0x72,0x79,
+0x62,0x72,0x65,0x61,0x6b,0x2d,4,0x32,0x5f,0x33,0x61,0x65,0x34,0x6c,0x6d,0x79,
+0x3a,0x13,0x70,0x68,0x65,0x6e,0x3b,0x19,0x62,0x72,0x65,0x77,0x6c,0x65,0x74,0x74,
+0x65,0x72,0x6d,2,0x64,0x28,0x6e,0x3c,0x73,0x41,0x3c,0x18,0x65,0x6f,0x67,0x72,
+0x61,0x70,0x68,0x69,0x63,0x3d,0x3e,1,0x66,0x3e,0x73,0x11,0x65,0x70,1,0x61,
+0x22,0x65,0x14,0x72,0x61,0x62,0x6c,0x65,0x3f,0x18,0x69,0x78,0x6e,0x75,0x6d,0x65,
+0x72,0x69,0x63,0x41,2,0x6c,0x63,0x74,0x65,0x76,0x67,1,0x66,0x43,0x69,0x15,
+0x6e,0x65,0x66,0x65,0x65,0x64,0x43,0x61,0x40,0x62,0x70,0x63,0xa2,0x55,0x65,0xa2,
+0xdb,0x67,0x10,0x6c,0x38,0x11,0x75,0x65,0x39,2,0x69,0x23,0x6c,0x34,0x6d,0x16,
+0x62,0x69,0x67,0x75,0x6f,0x75,0x73,0x23,0x24,0x17,0x70,0x68,0x61,0x62,0x65,0x74,
+0x69,0x63,0x25,4,0x32,0x27,0x61,0x29,0x62,0x2b,0x6b,0x2d,0x72,0x12,0x65,0x61,
+0x6b,2,0x61,0x36,0x62,0x3e,0x73,0x15,0x79,0x6d,0x62,0x6f,0x6c,0x73,0x57,0x13,
+0x66,0x74,0x65,0x72,0x29,1,0x65,0x2a,0x6f,0x11,0x74,0x68,0x27,0x13,0x66,0x6f,
+0x72,0x65,0x2b,7,0x6d,0x51,0x6d,0x33,0x6f,0x28,0x70,0x69,0x72,0x35,1,0x6d,
+0x76,0x6e,1,0x64,0x3c,0x74,0x1a,0x69,0x6e,0x67,0x65,0x6e,0x74,0x62,0x72,0x65,
+0x61,0x6b,0x2f,0x15,0x69,0x74,0x69,0x6f,0x6e,0x61,0x1f,0x6c,0x6a,0x61,0x70,0x61,
+0x6e,0x65,0x73,0x65,0x73,0x74,0x61,0x72,0x74,0x65,0x72,0x6b,1,0x62,0x3a,0x70,
+0x19,0x6c,0x65,0x78,0x63,0x6f,0x6e,0x74,0x65,0x78,0x74,0x51,0x18,0x69,0x6e,0x69,
+0x6e,0x67,0x6d,0x61,0x72,0x6b,0x33,0x61,0x6a,0x62,0x2f,0x6a,0x6b,0x6c,0x30,0x13,
+0x6f,0x73,0x65,0x70,1,0x61,0x38,0x75,0x18,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,
+0x6f,0x6e,0x31,0x18,0x72,0x65,0x6e,0x74,0x68,0x65,0x73,0x69,0x73,0x69,0x1b,0x72,
+0x72,0x69,0x61,0x67,0x65,0x72,0x65,0x74,0x75,0x72,0x6e,0x35,2,0x62,0x3e,0x6d,
+0x46,0x78,0x36,0x18,0x63,0x6c,0x61,0x6d,0x61,0x74,0x69,0x6f,0x6e,0x37,0x70,0x12,
+0x61,0x73,0x65,0x71,0x72,0x16,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,0x73,1,0x64,
+0x42,0x6e,1,0x6f,0x32,0x75,0x26,0x14,0x6d,0x65,0x72,0x69,0x63,0x27,0x11,0x6e,
+0x65,0x21,1,0x65,0x2e,0x69,0x24,0x12,0x67,0x69,0x74,0x25,0x22,0x14,0x63,0x69,
+0x6d,0x61,0x6c,0x23,0,0x18,0x6e,0xc4,0x2a,0x74,0xc1,0x6d,0x77,0x96,0x77,0xa2,
+0x4c,0x78,0xa2,0x70,0x79,0xa2,0x7a,0x7a,6,0x73,0x1e,0x73,0x34,0x78,0x42,0x79,
+0x48,0x7a,0x11,0x7a,0x7a,0xa3,0x67,0x10,0x79,1,0x65,0xa3,0xae,0x6d,0xa3,0x81,
+0x11,0x78,0x78,0xa3,0x66,0x11,0x79,0x79,0x21,0x61,0x30,0x69,0x58,0x6d,0x11,0x74,
+0x68,0xa3,0x80,0x10,0x6e,1,0x61,0x26,0x62,0xa3,0xb1,0x1a,0x62,0x61,0x7a,0x61,
+0x72,0x73,0x71,0x75,0x61,0x72,0x65,0xa3,0xb1,0x11,0x6e,0x68,0x23,2,0x61,0x30,
+0x63,0x5a,0x6f,0x11,0x6c,0x65,0xa3,0x9b,1,0x6e,0x3c,0x72,0x10,0x61,0xa2,0x92,
+0x15,0x6e,0x67,0x63,0x69,0x74,0x69,0xa3,0x92,0x12,0x63,0x68,0x6f,0xa3,0xbc,0x11,
+0x68,0x6f,0xa3,0xbc,1,0x70,0x2c,0x73,0x11,0x75,0x78,0xa3,0x65,0x11,0x65,0x6f,
+0x9b,1,0x65,0x2c,0x69,0x72,0x11,0x69,0x69,0x73,0x11,0x7a,0x69,0xa2,0xc0,0x11,
+0x64,0x69,0xa3,0xc0,0x74,0x4a,0x75,0xa2,0xba,0x76,1,0x61,0x2c,0x69,0x11,0x73,
+0x70,0xa3,0x64,0x10,0x69,0xa2,0x63,0x10,0x69,0xa3,0x63,5,0x67,0x36,0x67,0x68,
+0x68,0x6c,0x69,2,0x62,0x3a,0x66,0x4a,0x72,0x10,0x68,0xa2,0x9e,0x12,0x75,0x74,
+0x61,0xa3,0x9e,1,0x65,0x24,0x74,0x6f,0x12,0x74,0x61,0x6e,0x6f,0x14,0x69,0x6e,
+0x61,0x67,0x68,0x99,0x11,0x6c,0x67,0x75,0x10,0x61,1,0x61,0x24,0x69,0x6d,0x6a,
+0x11,0x6e,0x61,0x6b,0x61,0x30,0x65,0xa2,0x5b,0x66,0x11,0x6e,0x67,0x99,6,0x6c,
+0x21,0x6c,0x32,0x6d,0x38,0x6e,0x44,0x76,0x10,0x74,0xa3,0x7f,1,0x65,0x89,0x75,
+0x97,1,0x69,0x24,0x6c,0x67,0x10,0x6c,0x67,0x10,0x67,0xa2,0x9a,0x11,0x75,0x74,
+0xa3,0x9a,0x67,0x36,0x69,0x52,0x6b,0x10,0x72,0xa2,0x99,0x10,0x69,0xa3,0x99,1,
+0x61,0x30,0x62,0x7a,0x13,0x61,0x6e,0x77,0x61,0x7b,0x12,0x6c,0x6f,0x67,0x75,2,
+0x6c,0x32,0x74,0x34,0x76,0x12,0x69,0x65,0x74,0xa3,0x7f,0x10,0x65,0x89,0x12,0x68,
+0x61,0x6d,0xa3,0x6a,1,0x6c,0x2a,0x6e,0x10,0x67,0xa3,0x62,0x10,0x75,0x68,0x11,
+0x67,0x75,0x69,1,0x67,0x32,0x6e,0x14,0x6b,0x6e,0x6f,0x77,0x6e,0xa3,0x67,0x11,
+0x61,0x72,0x8a,0x13,0x69,0x74,0x69,0x63,0x8b,0x71,0xc1,0x13,0x71,0xa2,0xde,0x72,
+0xa2,0xe3,0x73,6,0x69,0x8a,0x69,0x72,0x6f,0xa2,0x4c,0x75,0xa2,0x75,0x79,1,
+0x6c,0x46,0x72,4,0x63,0x65,0x65,0xa3,0x5f,0x69,0x2c,0x6a,0xa3,0x60,0x6e,0xa3,
+0x61,0x11,0x61,0x63,0x65,0x10,0x6f,0x94,0x16,0x74,0x69,0x6e,0x61,0x67,0x72,0x69,
+0x95,2,0x64,0x3c,0x67,0x4c,0x6e,1,0x64,0xa3,0x91,0x68,0x62,0x12,0x61,0x6c,
+0x61,0x63,0x10,0x64,0xa2,0xa6,0x12,0x68,0x61,0x6d,0xa3,0xa6,0x17,0x6e,0x77,0x72,
+0x69,0x74,0x69,0x6e,0x67,0xa3,0x70,2,0x67,0x3a,0x72,0x52,0x79,0x10,0x6f,0xa2,
+0xb0,0x12,0x6d,0x62,0x6f,0xa3,0xb0,1,0x64,0x26,0x6f,0xa3,0xb8,0xa2,0xb7,0x12,
+0x69,0x61,0x6e,0xa3,0xb7,0x10,0x61,0xa2,0x98,0x16,0x73,0x6f,0x6d,0x70,0x65,0x6e,
+0x67,0xa3,0x98,0x11,0x6e,0x64,0xa2,0x71,0x14,0x61,0x6e,0x65,0x73,0x65,0xa3,0x71,
+0x61,0x5c,0x67,0xa2,0x43,0x68,1,0x61,0x2a,0x72,0x10,0x64,0xa3,0x97,2,0x72,
+0x28,0x76,0x30,0x77,0x87,0x12,0x61,0x64,0x61,0xa3,0x97,0x12,0x69,0x61,0x6e,0x87,
+2,0x6d,0x40,0x72,0x58,0x75,0x10,0x72,0xa2,0x6f,0x15,0x61,0x73,0x68,0x74,0x72,
+0x61,0xa3,0x6f,1,0x61,0x26,0x72,0xa3,0x7e,0x14,0x72,0x69,0x74,0x61,0x6e,0xa3,
+0x7e,1,0x61,0xa3,0x5e,0x62,0xa3,0x85,0x11,0x6e,0x77,0xa3,0x70,0x11,0x61,0x61,
+1,0x63,0x2f,0x69,0x23,3,0x65,0x3e,0x6a,0x48,0x6f,0x4e,0x75,0x10,0x6e,1,
+0x69,0x24,0x72,0x61,0x10,0x63,0x61,0x13,0x6a,0x61,0x6e,0x67,0xa3,0x6e,0x11,0x6e,
+0x67,0xa3,0x6e,1,0x68,0x2a,0x72,0x10,0x6f,0xa3,0x5d,0x10,0x67,0xa3,0xb6,0x6e,
+0xa2,0x83,0x6f,0xa2,0xf2,0x70,5,0x6c,0x1e,0x6c,0x44,0x72,0x4a,0x73,0x1b,0x61,
+0x6c,0x74,0x65,0x72,0x70,0x61,0x68,0x6c,0x61,0x76,0x69,0xa3,0x7b,0x11,0x72,0x64,
+0xa3,0x5c,0x11,0x74,0x69,0xa3,0x7d,0x61,0x7c,0x65,0xa2,0x54,0x68,3,0x61,0x3e,
+0x6c,0x4e,0x6e,0x5e,0x6f,0x16,0x65,0x6e,0x69,0x63,0x69,0x61,0x6e,0xa3,0x5b,0x10,
+0x67,0xa2,0x5a,0x12,0x73,0x70,0x61,0xa3,0x5a,2,0x69,0xa3,0x7a,0x70,0xa3,0x7b,
+0x76,0xa3,0x7c,0x10,0x78,0xa3,0x5b,2,0x68,0x3e,0x6c,0x50,0x75,0x10,0x63,0xa2,
+0xa5,0x14,0x69,0x6e,0x68,0x61,0x75,0xa3,0xa5,0x17,0x61,0x77,0x68,0x68,0x6d,0x6f,
+0x6e,0x67,0xa3,0x4b,0x10,0x6d,0xa2,0x90,0x14,0x79,0x72,0x65,0x6e,0x65,0xa3,0x90,
+0x11,0x72,0x6d,0xa3,0x59,6,0x6b,0x36,0x6b,0x56,0x73,0x6e,0x75,0x74,0x79,0x11,
+0x69,0x61,0x1f,0x6b,0x65,0x6e,0x67,0x70,0x75,0x61,0x63,0x68,0x75,0x65,0x68,0x6d,
+0x6f,0x6e,0x67,0xa3,0xba,1,0x67,0x2e,0x6f,0xa2,0x57,0x10,0x6f,0xa3,0x57,0x10,
+0x62,0xa3,0x84,0x11,0x68,0x75,0xa3,0x96,0x12,0x73,0x68,0x75,0xa3,0x96,0x61,0x42,
+0x62,0x80,0x65,0x10,0x77,1,0x61,0xa3,0xaa,0x74,0x14,0x61,0x69,0x6c,0x75,0x65,
+0x97,2,0x62,0x2e,0x6e,0x3c,0x72,0x10,0x62,0xa3,0x8e,0x15,0x61,0x74,0x61,0x65,
+0x61,0x6e,0xa3,0x8f,0x10,0x64,0xa2,0xbb,0x16,0x69,0x6e,0x61,0x67,0x61,0x72,0x69,
+0xa3,0xbb,0x11,0x61,0x74,0xa3,0x8f,3,0x67,0x5a,0x6c,0x6c,0x72,0xa2,0x93,0x73,
2,0x61,0x36,0x67,0x3c,0x6d,0x10,0x61,0x84,0x12,0x6e,0x79,0x61,0x85,0x11,0x67,
0x65,0xa3,0xab,0x10,0x65,0xa3,0xab,1,0x61,0x2a,0x68,0x11,0x61,0x6d,0x5b,0x10,
-0x6d,0x5b,1,0x63,0xa2,0x60,0x64,5,0x70,0x37,0x70,0x36,0x73,0x54,0x74,0x14,
+0x6d,0x5b,1,0x63,0xa2,0x60,0x64,5,0x70,0x37,0x70,0x36,0x73,0x54,0x74,0x14,
0x75,0x72,0x6b,0x69,0x63,0xa3,0x58,0x11,0x65,0x72,1,0x6d,0x2c,0x73,0x12,0x69,
-0x61,0x6e,0x9b,0x11,0x69,0x63,0xa3,0x59,0x10,0x6f,1,0x67,0x3a,0x75,0x18,0x74,
-0x68,0x61,0x72,0x61,0x62,0x69,0x61,0x6e,0xa3,0x85,0x13,0x64,0x69,0x61,0x6e,0xa3,
-0xb8,0x68,0x42,0x69,0x54,0x6e,0x1a,0x6f,0x72,0x74,0x68,0x61,0x72,0x61,0x62,0x69,
-0x61,0x6e,0xa3,0x8e,0x17,0x75,0x6e,0x67,0x61,0x72,0x69,0x61,0x6e,0xa3,0x4c,0x14,
-0x74,0x61,0x6c,0x69,0x63,0x5d,1,0x68,0x26,0x6b,0xa3,0x6d,0x12,0x69,0x6b,0x69,
-0xa3,0x6d,2,0x69,0x2c,0x6b,0x30,0x79,0x10,0x61,0x5f,0x11,0x79,0x61,0x5f,0x10,
-0x68,0xa3,0x58,0x68,0xc3,0xd,0x6b,0xc2,0x24,0x6b,0xa4,0x17,0x6c,0xa4,0xb2,0x6d,
-8,0x6f,0x46,0x6f,0x48,0x72,0x74,0x74,0x80,0x75,0x86,0x79,1,0x61,0x28,0x6d,
-0x10,0x72,0x59,0x13,0x6e,0x6d,0x61,0x72,0x59,2,0x64,0x2e,0x6e,0x32,0x6f,0x10,
-0x6e,0xa3,0x72,0x10,0x69,0xa3,0xa3,0x10,0x67,0x56,0x14,0x6f,0x6c,0x69,0x61,0x6e,
-0x57,0x10,0x6f,0xa2,0x95,0x10,0x6f,0xa3,0x95,0x11,0x65,0x69,0xa3,0x73,0x11,0x6c,
-0x74,0xa2,0xa4,0x12,0x61,0x6e,0x69,0xa3,0xa4,0x61,0x36,0x65,0xa2,0x67,0x69,0xa2,
-0xbd,0x6c,0x11,0x79,0x6d,0x55,6,0x6e,0x38,0x6e,0x32,0x72,0x5c,0x73,0x6c,0x79,
-0x10,0x61,0xa3,0x55,1,0x64,0x38,0x69,0xa2,0x79,0x15,0x63,0x68,0x61,0x65,0x61,
-0x6e,0xa3,0x79,0xa2,0x54,0x12,0x61,0x69,0x63,0xa3,0x54,0x10,0x63,0xa2,0xa9,0x12,
-0x68,0x65,0x6e,0xa3,0xa9,0x18,0x61,0x72,0x61,0x6d,0x67,0x6f,0x6e,0x64,0x69,0xa3,
-0xaf,0x68,0x36,0x6b,0x4c,0x6c,0x15,0x61,0x79,0x61,0x6c,0x61,0x6d,0x55,1,0x61,
-0x26,0x6a,0xa3,0xa0,0x13,0x6a,0x61,0x6e,0x69,0xa3,0xa0,0x10,0x61,0xa2,0xb4,0x12,
-0x73,0x61,0x72,0xa3,0xb4,3,0x64,0x78,0x65,0x94,0x6e,0xa2,0x42,0x72,1,0x63,
-0xa3,0x8d,0x6f,0xa2,0x56,0x13,0x69,0x74,0x69,0x63,1,0x63,0x3c,0x68,0x19,0x69,
-0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,0x73,0xa3,0x56,0x15,0x75,0x72,0x73,0x69,
-0x76,0x65,0xa3,0x8d,1,0x65,0x26,0x66,0xa3,0xb5,0x16,0x66,0x61,0x69,0x64,0x72,
-0x69,0x6e,0xa3,0xb5,0x17,0x74,0x65,0x69,0x6d,0x61,0x79,0x65,0x6b,0xa3,0x73,0x10,
-0x64,0xa2,0x8c,0x17,0x65,0x6b,0x69,0x6b,0x61,0x6b,0x75,0x69,0xa3,0x8c,0x11,0x61,
-0x6f,0xa3,0x5c,6,0x6e,0x1a,0x6e,0x34,0x6f,0x38,0x70,0x3e,0x74,0x11,0x68,0x69,
-0xa3,0x78,0x11,0x64,0x61,0x4b,0x11,0x72,0x65,0xa3,0x77,0x11,0x65,0x6c,0xa3,0x8a,
-0x61,0x30,0x68,0x9a,0x69,0x11,0x74,0x73,0xa3,0xbf,4,0x69,0x3c,0x6c,0x44,0x6e,
+0x61,0x6e,0x9b,0x11,0x69,0x63,0xa3,0x59,0x10,0x6f,1,0x67,0x3a,0x75,0x18,0x74,
+0x68,0x61,0x72,0x61,0x62,0x69,0x61,0x6e,0xa3,0x85,0x13,0x64,0x69,0x61,0x6e,0xa3,
+0xb8,0x68,0x42,0x69,0x54,0x6e,0x1a,0x6f,0x72,0x74,0x68,0x61,0x72,0x61,0x62,0x69,
+0x61,0x6e,0xa3,0x8e,0x17,0x75,0x6e,0x67,0x61,0x72,0x69,0x61,0x6e,0xa3,0x4c,0x14,
+0x74,0x61,0x6c,0x69,0x63,0x5d,1,0x68,0x26,0x6b,0xa3,0x6d,0x12,0x69,0x6b,0x69,
+0xa3,0x6d,2,0x69,0x2c,0x6b,0x30,0x79,0x10,0x61,0x5f,0x11,0x79,0x61,0x5f,0x10,
+0x68,0xa3,0x58,0x68,0xc3,0xd,0x6b,0xc2,0x24,0x6b,0xa4,0x17,0x6c,0xa4,0xb2,0x6d,
+8,0x6f,0x46,0x6f,0x48,0x72,0x74,0x74,0x80,0x75,0x86,0x79,1,0x61,0x28,0x6d,
+0x10,0x72,0x59,0x13,0x6e,0x6d,0x61,0x72,0x59,2,0x64,0x2e,0x6e,0x32,0x6f,0x10,
+0x6e,0xa3,0x72,0x10,0x69,0xa3,0xa3,0x10,0x67,0x56,0x14,0x6f,0x6c,0x69,0x61,0x6e,
+0x57,0x10,0x6f,0xa2,0x95,0x10,0x6f,0xa3,0x95,0x11,0x65,0x69,0xa3,0x73,0x11,0x6c,
+0x74,0xa2,0xa4,0x12,0x61,0x6e,0x69,0xa3,0xa4,0x61,0x36,0x65,0xa2,0x67,0x69,0xa2,
+0xbd,0x6c,0x11,0x79,0x6d,0x55,6,0x6e,0x38,0x6e,0x32,0x72,0x5c,0x73,0x6c,0x79,
+0x10,0x61,0xa3,0x55,1,0x64,0x38,0x69,0xa2,0x79,0x15,0x63,0x68,0x61,0x65,0x61,
+0x6e,0xa3,0x79,0xa2,0x54,0x12,0x61,0x69,0x63,0xa3,0x54,0x10,0x63,0xa2,0xa9,0x12,
+0x68,0x65,0x6e,0xa3,0xa9,0x18,0x61,0x72,0x61,0x6d,0x67,0x6f,0x6e,0x64,0x69,0xa3,
+0xaf,0x68,0x36,0x6b,0x4c,0x6c,0x15,0x61,0x79,0x61,0x6c,0x61,0x6d,0x55,1,0x61,
+0x26,0x6a,0xa3,0xa0,0x13,0x6a,0x61,0x6e,0x69,0xa3,0xa0,0x10,0x61,0xa2,0xb4,0x12,
+0x73,0x61,0x72,0xa3,0xb4,3,0x64,0x78,0x65,0x94,0x6e,0xa2,0x42,0x72,1,0x63,
+0xa3,0x8d,0x6f,0xa2,0x56,0x13,0x69,0x74,0x69,0x63,1,0x63,0x3c,0x68,0x19,0x69,
+0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,0x73,0xa3,0x56,0x15,0x75,0x72,0x73,0x69,
+0x76,0x65,0xa3,0x8d,1,0x65,0x26,0x66,0xa3,0xb5,0x16,0x66,0x61,0x69,0x64,0x72,
+0x69,0x6e,0xa3,0xb5,0x17,0x74,0x65,0x69,0x6d,0x61,0x79,0x65,0x6b,0xa3,0x73,0x10,
+0x64,0xa2,0x8c,0x17,0x65,0x6b,0x69,0x6b,0x61,0x6b,0x75,0x69,0xa3,0x8c,0x11,0x61,
+0x6f,0xa3,0x5c,6,0x6e,0x1a,0x6e,0x34,0x6f,0x38,0x70,0x3e,0x74,0x11,0x68,0x69,
+0xa3,0x78,0x11,0x64,0x61,0x4b,0x11,0x72,0x65,0xa3,0x77,0x11,0x65,0x6c,0xa3,0x8a,
+0x61,0x30,0x68,0x9a,0x69,0x11,0x74,0x73,0xa3,0xbf,4,0x69,0x3c,0x6c,0x44,0x6e,
0x48,0x74,0x56,0x79,0x13,0x61,0x68,0x6c,0x69,0xa3,0x4f,0x12,0x74,0x68,0x69,0xa3,
0x78,0x10,0x69,0xa3,0x4f,1,0x61,0x4d,0x6e,0x12,0x61,0x64,0x61,0x4b,0x14,0x61,
0x6b,0x61,0x6e,0x61,0x4c,0x19,0x6f,0x72,0x68,0x69,0x72,0x61,0x67,0x61,0x6e,0x61,
-0x8d,4,0x61,0x40,0x69,0x52,0x6d,0x70,0x6f,0x7c,0x75,0x15,0x64,0x61,0x77,0x61,
-0x64,0x69,0xa3,0x91,0x10,0x72,0x92,0x15,0x6f,0x73,0x68,0x74,0x68,0x69,0x93,0x1d,
-0x74,0x61,0x6e,0x73,0x6d,0x61,0x6c,0x6c,0x73,0x63,0x72,0x69,0x70,0x74,0xa3,0xbf,
-1,0x65,0x24,0x72,0x4f,0x10,0x72,0x4f,0x10,0x6a,0xa2,0x9d,0x11,0x6b,0x69,0xa3,
-0x9d,4,0x61,0x5c,0x65,0x90,0x69,0xa0,0x6f,0xa2,0x5d,0x79,1,0x63,0x34,0x64,
-0x10,0x69,0xa2,0x6c,0x11,0x61,0x6e,0xa3,0x6c,0x10,0x69,0xa2,0x6b,0x11,0x61,0x6e,
-0xa3,0x6b,2,0x6e,0x42,0x6f,0x46,0x74,3,0x66,0xa3,0x50,0x67,0xa3,0x51,0x69,
-0x24,0x6e,0x53,0x10,0x6e,0x53,0x10,0x61,0xa3,0x6a,0x50,0x10,0x6f,0x51,0x11,0x70,
-0x63,0xa2,0x52,0x11,0x68,0x61,0xa3,0x52,2,0x6d,0x2e,0x6e,0x36,0x73,0x10,0x75,
-0xa3,0x83,0x10,0x62,0x80,0x10,0x75,0x81,2,0x61,0xa3,0x53,0x62,0x83,0x65,0x11,
-0x61,0x72,1,0x61,0xa3,0x53,0x62,0x83,0x11,0x6d,0x61,0xa3,0x8b,0x68,0x6e,0x69,
-0xa2,0x95,0x6a,2,0x61,0x30,0x70,0x52,0x75,0x11,0x72,0x63,0xa3,0x94,1,0x6d,
-0x38,0x76,0x10,0x61,0xa2,0x4e,0x13,0x6e,0x65,0x73,0x65,0xa3,0x4e,0x10,0x6f,0xa3,
-0xad,0x11,0x61,0x6e,0xa3,0x69,6,0x6c,0x1e,0x6c,0x34,0x6d,0x3a,0x72,0x48,0x75,
-0x11,0x6e,0x67,0xa3,0x4c,0x11,0x75,0x77,0xa3,0x9c,0x10,0x6e,1,0x67,0xa3,0x4b,
-0x70,0xa3,0xba,0x11,0x6b,0x74,0x8d,0x61,0x3c,0x65,0xa2,0x43,0x69,0x11,0x72,0x61,
-0x48,0x13,0x67,0x61,0x6e,0x61,0x49,1,0x6e,0x34,0x74,0x10,0x72,0xa2,0xa2,0x11,
-0x61,0x6e,0xa3,0xa2,0x42,6,0x6f,0xe,0x6f,0x77,0x73,0xa3,0x49,0x74,0xa3,0x4a,
-0x75,0x12,0x6e,0x6f,0x6f,0x77,0x62,0xa3,0xac,0x67,0x3e,0x69,0x42,0x19,0x66,0x69,
-0x72,0x6f,0x68,0x69,0x6e,0x67,0x79,0x61,0xa3,0xb6,0x44,0x11,0x75,0x6c,0x45,0x11,
-0x62,0x72,0x46,0x11,0x65,0x77,0x47,2,0x6d,0x2e,0x6e,0x4a,0x74,0x11,0x61,0x6c,
-0x5d,0x1c,0x70,0x65,0x72,0x69,0x61,0x6c,0x61,0x72,0x61,0x6d,0x61,0x69,0x63,0xa3,
-0x74,2,0x64,0x66,0x68,0x6a,0x73,0x1b,0x63,0x72,0x69,0x70,0x74,0x69,0x6f,0x6e,
-0x61,0x6c,0x70,0x61,1,0x68,0x32,0x72,0x14,0x74,0x68,0x69,0x61,0x6e,0xa3,0x7d,
-0x13,0x6c,0x61,0x76,0x69,0xa3,0x7a,0x10,0x73,0xa3,0x4d,0x15,0x65,0x72,0x69,0x74,
-0x65,0x64,0x23,0x64,0xc1,0xd,0x64,0xa2,0x7a,0x65,0xa2,0xc1,0x67,4,0x65,0x82,
-0x6c,0x9a,0x6f,0xa2,0x46,0x72,0xa2,0x55,0x75,2,0x6a,0x3c,0x6e,0x4e,0x72,1,
-0x6d,0x24,0x75,0x41,0x13,0x75,0x6b,0x68,0x69,0x41,1,0x61,0x24,0x72,0x3f,0x13,
-0x72,0x61,0x74,0x69,0x3f,0x18,0x6a,0x61,0x6c,0x61,0x67,0x6f,0x6e,0x64,0x69,0xa3,
-0xb3,0x10,0x6f,1,0x6b,0xa3,0x48,0x72,0x38,0x13,0x67,0x69,0x61,0x6e,0x39,0x11,
-0x61,0x67,0x90,0x15,0x6f,0x6c,0x69,0x74,0x69,0x63,0x91,1,0x6e,0x30,0x74,0x10,
-0x68,0x3a,0x11,0x69,0x63,0x3b,1,0x67,0xa3,0xb3,0x6d,0xa3,0xaf,1,0x61,0x32,
-0x65,1,0x65,0x24,0x6b,0x3d,0x10,0x6b,0x3d,0x10,0x6e,0xa2,0x89,0x12,0x74,0x68,
-0x61,0xa3,0x89,4,0x65,0x46,0x69,0x6c,0x6f,0x8c,0x73,0x9a,0x75,0x11,0x70,0x6c,
-0xa2,0x87,0x13,0x6f,0x79,0x61,0x6e,0xa3,0x87,1,0x73,0x38,0x76,0x10,0x61,0x34,
-0x15,0x6e,0x61,0x67,0x61,0x72,0x69,0x35,0x13,0x65,0x72,0x65,0x74,0x33,1,0x61,
-0x36,0x76,0x16,0x65,0x73,0x61,0x6b,0x75,0x72,0x75,0xa3,0xbe,0x10,0x6b,0xa3,0xbe,
-0x11,0x67,0x72,0xa2,0xb2,0x10,0x61,0xa3,0xb2,0x11,0x72,0x74,0x33,2,0x67,0x3a,
-0x6c,0x72,0x74,0x11,0x68,0x69,0x36,0x13,0x6f,0x70,0x69,0x63,0x37,0x10,0x79,2,
-0x64,0xa3,0x45,0x68,0xa3,0x46,0x70,0xa2,0x47,0x1e,0x74,0x69,0x61,0x6e,0x68,0x69,
-0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,0x73,0xa3,0x47,1,0x62,0x36,0x79,0x10,
-0x6d,0xa2,0xb9,0x12,0x61,0x69,0x63,0xa3,0xb9,0x10,0x61,0xa2,0x88,0x12,0x73,0x61,
-0x6e,0xa3,0x88,0x61,0xa2,0xb4,0x62,0xa4,0x19,0x63,6,0x6f,0x3d,0x6f,0x5a,0x70,
-0x76,0x75,0x7a,0x79,1,0x70,0x3e,0x72,2,0x69,0x2a,0x6c,0x31,0x73,0xa3,0x44,
-0x13,0x6c,0x6c,0x69,0x63,0x31,0x13,0x72,0x69,0x6f,0x74,0x7f,1,0x6d,0x30,0x70,
-0x10,0x74,0x2e,0x11,0x69,0x63,0x2f,0x12,0x6d,0x6f,0x6e,0x21,0x11,0x72,0x74,0x7f,
-0x16,0x6e,0x65,0x69,0x66,0x6f,0x72,0x6d,0xa3,0x65,0x61,0x32,0x68,0xa2,0x41,0x69,
-0x11,0x72,0x74,0xa3,0x43,3,0x6b,0x4c,0x6e,0x50,0x72,0x76,0x75,0x1d,0x63,0x61,
-0x73,0x69,0x61,0x6e,0x61,0x6c,0x62,0x61,0x6e,0x69,0x61,0x6e,0xa3,0x9f,0x10,0x6d,
-0xa3,0x76,1,0x61,0x24,0x73,0x71,0x1d,0x64,0x69,0x61,0x6e,0x61,0x62,0x6f,0x72,
-0x69,0x67,0x69,0x6e,0x61,0x6c,0x71,0x10,0x69,0xa2,0x68,0x11,0x61,0x6e,0xa3,0x68,
-3,0x61,0x32,0x65,0x44,0x6f,0x52,0x72,0x10,0x73,0xa3,0xbd,1,0x6b,0x26,0x6d,
-0xa3,0x42,0x11,0x6d,0x61,0xa3,0x76,0x10,0x72,0x2c,0x13,0x6f,0x6b,0x65,0x65,0x2d,
-0x16,0x72,0x61,0x73,0x6d,0x69,0x61,0x6e,0xa3,0xbd,6,0x68,0x4a,0x68,0x48,0x6e,
-0x4e,0x72,0x76,0x76,1,0x65,0x2a,0x73,0x10,0x74,0xa3,0x75,0x13,0x73,0x74,0x61,
-0x6e,0xa3,0x75,0x11,0x6f,0x6d,0xa3,0xa1,0x11,0x61,0x74,0x1f,0x6f,0x6c,0x69,0x61,
-0x6e,0x68,0x69,0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,0x73,0xa3,0x9c,1,0x61,
-0x3e,0x6d,2,0x65,0x2a,0x69,0xa3,0x74,0x6e,0x27,0x13,0x6e,0x69,0x61,0x6e,0x27,
-0x10,0x62,0x24,0x11,0x69,0x63,0x25,0x64,0x30,0x66,0x44,0x67,0x11,0x68,0x62,0xa3,
-0x9f,0x10,0x6c,1,0x61,0x26,0x6d,0xa3,0xa7,0x10,0x6d,0xa3,0xa7,0x11,0x61,0x6b,
-0xa3,0x93,6,0x6c,0x3c,0x6c,0x52,0x6f,0x56,0x72,0x66,0x75,1,0x67,0x30,0x68,
-1,0x64,0x79,0x69,0x10,0x64,0x79,0x10,0x69,0x8e,0x13,0x6e,0x65,0x73,0x65,0x8f,
-0x11,0x69,0x73,0xa1,0x11,0x70,0x6f,0x2a,0x13,0x6d,0x6f,0x66,0x6f,0x2b,0x10,0x61,
-1,0x68,0x2e,0x69,0x7c,0x12,0x6c,0x6c,0x65,0x7d,0xa2,0x41,0x11,0x6d,0x69,0xa3,
-0x41,0x61,0x48,0x65,0x9c,0x68,1,0x61,0x2a,0x6b,0x10,0x73,0xa3,0xa8,0x15,0x69,
-0x6b,0x73,0x75,0x6b,0x69,0xa3,0xa8,3,0x6c,0x3a,0x6d,0x48,0x73,0x54,0x74,1,
-0x61,0x24,0x6b,0x9f,0x10,0x6b,0x9f,0x10,0x69,0x9c,0x13,0x6e,0x65,0x73,0x65,0x9d,
-0x10,0x75,0xa2,0x82,0x10,0x6d,0xa3,0x82,0x10,0x73,0xa2,0x86,0x13,0x61,0x76,0x61,
-0x68,0xa3,0x86,0x11,0x6e,0x67,0x28,0x12,0x61,0x6c,0x69,0x29,3,0x6c,0x42,0x6e,
-0x90,0x74,0xa2,0x46,0x76,0x24,0x17,0x6f,0x77,0x65,0x6c,0x6a,0x61,0x6d,0x6f,0x25,
-0x22,1,0x65,0x54,0x76,0x28,1,0x73,0x38,0x74,0x2a,0x17,0x73,0x79,0x6c,0x6c,
-0x61,0x62,0x6c,0x65,0x2b,0x16,0x79,0x6c,0x6c,0x61,0x62,0x6c,0x65,0x29,0x18,0x61,
-0x64,0x69,0x6e,0x67,0x6a,0x61,0x6d,0x6f,0x23,1,0x61,0x21,0x6f,0x1a,0x74,0x61,
-0x70,0x70,0x6c,0x69,0x63,0x61,0x62,0x6c,0x65,0x21,0x26,0x1a,0x72,0x61,0x69,0x6c,
-0x69,0x6e,0x67,0x6a,0x61,0x6d,0x6f,0x27,1,0x6e,0x2c,0x79,0x22,0x11,0x65,0x73,
-0x23,0x20,0x10,0x6f,0x21,1,0x6e,0x2c,0x79,0x22,0x11,0x65,0x73,0x23,0x20,0x10,
-0x6f,0x21,2,0x6d,0x30,0x6e,0x3a,0x79,0x22,0x11,0x65,0x73,0x23,0x24,0x13,0x61,
-0x79,0x62,0x65,0x25,0x20,0x10,0x6f,0x21,2,0x6d,0x30,0x6e,0x3a,0x79,0x22,0x11,
-0x65,0x73,0x23,0x24,0x13,0x61,0x79,0x62,0x65,0x25,0x20,0x10,0x6f,0x21,0xb,0x72,
-0x39,0x76,0xc,0x76,0x33,0x78,0x2a,0x7a,0x11,0x77,0x6a,0x43,0x10,0x78,0x21,0x72,
-0x28,0x73,0x50,0x74,0x31,1,0x65,0x24,0x69,0x39,0x1e,0x67,0x69,0x6f,0x6e,0x61,
-0x6c,0x69,0x6e,0x64,0x69,0x63,0x61,0x74,0x6f,0x72,0x39,1,0x6d,0x35,0x70,0x18,
-0x61,0x63,0x69,0x6e,0x67,0x6d,0x61,0x72,0x6b,0x35,0x6c,0x1f,0x6c,0x3c,0x6f,0x4a,
-0x70,1,0x70,0x37,0x72,0x14,0x65,0x70,0x65,0x6e,0x64,0x37,0x28,1,0x66,0x2b,
-0x76,0x2c,0x10,0x74,0x2f,0x13,0x74,0x68,0x65,0x72,0x21,0x63,0x4c,0x65,0x64,0x67,
-1,0x61,0x3a,0x6c,0x19,0x75,0x65,0x61,0x66,0x74,0x65,0x72,0x7a,0x77,0x6a,0x41,
-0x10,0x7a,0x41,2,0x6e,0x23,0x6f,0x24,0x72,0x25,0x14,0x6e,0x74,0x72,0x6f,0x6c,
-0x23,2,0x62,0x34,0x6d,0x4e,0x78,0x26,0x13,0x74,0x65,0x6e,0x64,0x27,0x3a,1,
-0x61,0x24,0x67,0x3d,0x11,0x73,0x65,0x3a,0x12,0x67,0x61,0x7a,0x3d,0x3e,0x16,0x6f,
-0x64,0x69,0x66,0x69,0x65,0x72,0x3f,9,0x6e,0x4a,0x6e,0x34,0x6f,0x44,0x73,0x60,
-0x75,0x94,0x78,0x10,0x78,0x21,0x10,0x75,0x2a,0x14,0x6d,0x65,0x72,0x69,0x63,0x2b,
-1,0x6c,0x2c,0x74,0x12,0x68,0x65,0x72,0x21,0x14,0x65,0x74,0x74,0x65,0x72,0x2d,
-3,0x63,0x36,0x65,0x46,0x70,0x31,0x74,0x32,0x12,0x65,0x72,0x6d,0x33,0x3c,0x16,
-0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,0x3d,0x2e,0x10,0x70,0x2f,0x10,0x70,0x34,0x12,
-0x70,0x65,0x72,0x35,0x61,0x46,0x63,0x52,0x65,0x64,0x66,0x72,0x6c,2,0x65,0x2d,
-0x66,0x3b,0x6f,0x28,0x12,0x77,0x65,0x72,0x29,0x10,0x74,0x22,0x12,0x65,0x72,0x6d,
-0x23,1,0x6c,0x24,0x72,0x37,0x24,0x12,0x6f,0x73,0x65,0x25,0x10,0x78,0x38,0x13,
-0x74,0x65,0x6e,0x64,0x39,0x10,0x6f,0x26,0x13,0x72,0x6d,0x61,0x74,0x27,0,0x10,
-0x6c,0x88,0x72,0x40,0x72,0x36,0x73,0x5e,0x77,0x7a,0x78,0x8a,0x7a,0x11,0x77,0x6a,
+0x8d,4,0x61,0x40,0x69,0x52,0x6d,0x70,0x6f,0x7c,0x75,0x15,0x64,0x61,0x77,0x61,
+0x64,0x69,0xa3,0x91,0x10,0x72,0x92,0x15,0x6f,0x73,0x68,0x74,0x68,0x69,0x93,0x1d,
+0x74,0x61,0x6e,0x73,0x6d,0x61,0x6c,0x6c,0x73,0x63,0x72,0x69,0x70,0x74,0xa3,0xbf,
+1,0x65,0x24,0x72,0x4f,0x10,0x72,0x4f,0x10,0x6a,0xa2,0x9d,0x11,0x6b,0x69,0xa3,
+0x9d,4,0x61,0x5c,0x65,0x90,0x69,0xa0,0x6f,0xa2,0x5d,0x79,1,0x63,0x34,0x64,
+0x10,0x69,0xa2,0x6c,0x11,0x61,0x6e,0xa3,0x6c,0x10,0x69,0xa2,0x6b,0x11,0x61,0x6e,
+0xa3,0x6b,2,0x6e,0x42,0x6f,0x46,0x74,3,0x66,0xa3,0x50,0x67,0xa3,0x51,0x69,
+0x24,0x6e,0x53,0x10,0x6e,0x53,0x10,0x61,0xa3,0x6a,0x50,0x10,0x6f,0x51,0x11,0x70,
+0x63,0xa2,0x52,0x11,0x68,0x61,0xa3,0x52,2,0x6d,0x2e,0x6e,0x36,0x73,0x10,0x75,
+0xa3,0x83,0x10,0x62,0x80,0x10,0x75,0x81,2,0x61,0xa3,0x53,0x62,0x83,0x65,0x11,
+0x61,0x72,1,0x61,0xa3,0x53,0x62,0x83,0x11,0x6d,0x61,0xa3,0x8b,0x68,0x6e,0x69,
+0xa2,0x95,0x6a,2,0x61,0x30,0x70,0x52,0x75,0x11,0x72,0x63,0xa3,0x94,1,0x6d,
+0x38,0x76,0x10,0x61,0xa2,0x4e,0x13,0x6e,0x65,0x73,0x65,0xa3,0x4e,0x10,0x6f,0xa3,
+0xad,0x11,0x61,0x6e,0xa3,0x69,6,0x6c,0x1e,0x6c,0x34,0x6d,0x3a,0x72,0x48,0x75,
+0x11,0x6e,0x67,0xa3,0x4c,0x11,0x75,0x77,0xa3,0x9c,0x10,0x6e,1,0x67,0xa3,0x4b,
+0x70,0xa3,0xba,0x11,0x6b,0x74,0x8d,0x61,0x3c,0x65,0xa2,0x43,0x69,0x11,0x72,0x61,
+0x48,0x13,0x67,0x61,0x6e,0x61,0x49,1,0x6e,0x34,0x74,0x10,0x72,0xa2,0xa2,0x11,
+0x61,0x6e,0xa3,0xa2,0x42,6,0x6f,0xe,0x6f,0x77,0x73,0xa3,0x49,0x74,0xa3,0x4a,
+0x75,0x12,0x6e,0x6f,0x6f,0x77,0x62,0xa3,0xac,0x67,0x3e,0x69,0x42,0x19,0x66,0x69,
+0x72,0x6f,0x68,0x69,0x6e,0x67,0x79,0x61,0xa3,0xb6,0x44,0x11,0x75,0x6c,0x45,0x11,
+0x62,0x72,0x46,0x11,0x65,0x77,0x47,2,0x6d,0x2e,0x6e,0x4a,0x74,0x11,0x61,0x6c,
+0x5d,0x1c,0x70,0x65,0x72,0x69,0x61,0x6c,0x61,0x72,0x61,0x6d,0x61,0x69,0x63,0xa3,
+0x74,2,0x64,0x66,0x68,0x6a,0x73,0x1b,0x63,0x72,0x69,0x70,0x74,0x69,0x6f,0x6e,
+0x61,0x6c,0x70,0x61,1,0x68,0x32,0x72,0x14,0x74,0x68,0x69,0x61,0x6e,0xa3,0x7d,
+0x13,0x6c,0x61,0x76,0x69,0xa3,0x7a,0x10,0x73,0xa3,0x4d,0x15,0x65,0x72,0x69,0x74,
+0x65,0x64,0x23,0x64,0xc1,0xd,0x64,0xa2,0x7a,0x65,0xa2,0xc1,0x67,4,0x65,0x82,
+0x6c,0x9a,0x6f,0xa2,0x46,0x72,0xa2,0x55,0x75,2,0x6a,0x3c,0x6e,0x4e,0x72,1,
+0x6d,0x24,0x75,0x41,0x13,0x75,0x6b,0x68,0x69,0x41,1,0x61,0x24,0x72,0x3f,0x13,
+0x72,0x61,0x74,0x69,0x3f,0x18,0x6a,0x61,0x6c,0x61,0x67,0x6f,0x6e,0x64,0x69,0xa3,
+0xb3,0x10,0x6f,1,0x6b,0xa3,0x48,0x72,0x38,0x13,0x67,0x69,0x61,0x6e,0x39,0x11,
+0x61,0x67,0x90,0x15,0x6f,0x6c,0x69,0x74,0x69,0x63,0x91,1,0x6e,0x30,0x74,0x10,
+0x68,0x3a,0x11,0x69,0x63,0x3b,1,0x67,0xa3,0xb3,0x6d,0xa3,0xaf,1,0x61,0x32,
+0x65,1,0x65,0x24,0x6b,0x3d,0x10,0x6b,0x3d,0x10,0x6e,0xa2,0x89,0x12,0x74,0x68,
+0x61,0xa3,0x89,4,0x65,0x46,0x69,0x6c,0x6f,0x8c,0x73,0x9a,0x75,0x11,0x70,0x6c,
+0xa2,0x87,0x13,0x6f,0x79,0x61,0x6e,0xa3,0x87,1,0x73,0x38,0x76,0x10,0x61,0x34,
+0x15,0x6e,0x61,0x67,0x61,0x72,0x69,0x35,0x13,0x65,0x72,0x65,0x74,0x33,1,0x61,
+0x36,0x76,0x16,0x65,0x73,0x61,0x6b,0x75,0x72,0x75,0xa3,0xbe,0x10,0x6b,0xa3,0xbe,
+0x11,0x67,0x72,0xa2,0xb2,0x10,0x61,0xa3,0xb2,0x11,0x72,0x74,0x33,2,0x67,0x3a,
+0x6c,0x72,0x74,0x11,0x68,0x69,0x36,0x13,0x6f,0x70,0x69,0x63,0x37,0x10,0x79,2,
+0x64,0xa3,0x45,0x68,0xa3,0x46,0x70,0xa2,0x47,0x1e,0x74,0x69,0x61,0x6e,0x68,0x69,
+0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,0x73,0xa3,0x47,1,0x62,0x36,0x79,0x10,
+0x6d,0xa2,0xb9,0x12,0x61,0x69,0x63,0xa3,0xb9,0x10,0x61,0xa2,0x88,0x12,0x73,0x61,
+0x6e,0xa3,0x88,0x61,0xa2,0xb4,0x62,0xa4,0x19,0x63,6,0x6f,0x3d,0x6f,0x5a,0x70,
+0x76,0x75,0x7a,0x79,1,0x70,0x3e,0x72,2,0x69,0x2a,0x6c,0x31,0x73,0xa3,0x44,
+0x13,0x6c,0x6c,0x69,0x63,0x31,0x13,0x72,0x69,0x6f,0x74,0x7f,1,0x6d,0x30,0x70,
+0x10,0x74,0x2e,0x11,0x69,0x63,0x2f,0x12,0x6d,0x6f,0x6e,0x21,0x11,0x72,0x74,0x7f,
+0x16,0x6e,0x65,0x69,0x66,0x6f,0x72,0x6d,0xa3,0x65,0x61,0x32,0x68,0xa2,0x41,0x69,
+0x11,0x72,0x74,0xa3,0x43,3,0x6b,0x4c,0x6e,0x50,0x72,0x76,0x75,0x1d,0x63,0x61,
+0x73,0x69,0x61,0x6e,0x61,0x6c,0x62,0x61,0x6e,0x69,0x61,0x6e,0xa3,0x9f,0x10,0x6d,
+0xa3,0x76,1,0x61,0x24,0x73,0x71,0x1d,0x64,0x69,0x61,0x6e,0x61,0x62,0x6f,0x72,
+0x69,0x67,0x69,0x6e,0x61,0x6c,0x71,0x10,0x69,0xa2,0x68,0x11,0x61,0x6e,0xa3,0x68,
+3,0x61,0x32,0x65,0x44,0x6f,0x52,0x72,0x10,0x73,0xa3,0xbd,1,0x6b,0x26,0x6d,
+0xa3,0x42,0x11,0x6d,0x61,0xa3,0x76,0x10,0x72,0x2c,0x13,0x6f,0x6b,0x65,0x65,0x2d,
+0x16,0x72,0x61,0x73,0x6d,0x69,0x61,0x6e,0xa3,0xbd,6,0x68,0x4a,0x68,0x48,0x6e,
+0x4e,0x72,0x76,0x76,1,0x65,0x2a,0x73,0x10,0x74,0xa3,0x75,0x13,0x73,0x74,0x61,
+0x6e,0xa3,0x75,0x11,0x6f,0x6d,0xa3,0xa1,0x11,0x61,0x74,0x1f,0x6f,0x6c,0x69,0x61,
+0x6e,0x68,0x69,0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,0x73,0xa3,0x9c,1,0x61,
+0x3e,0x6d,2,0x65,0x2a,0x69,0xa3,0x74,0x6e,0x27,0x13,0x6e,0x69,0x61,0x6e,0x27,
+0x10,0x62,0x24,0x11,0x69,0x63,0x25,0x64,0x30,0x66,0x44,0x67,0x11,0x68,0x62,0xa3,
+0x9f,0x10,0x6c,1,0x61,0x26,0x6d,0xa3,0xa7,0x10,0x6d,0xa3,0xa7,0x11,0x61,0x6b,
+0xa3,0x93,6,0x6c,0x3c,0x6c,0x52,0x6f,0x56,0x72,0x66,0x75,1,0x67,0x30,0x68,
+1,0x64,0x79,0x69,0x10,0x64,0x79,0x10,0x69,0x8e,0x13,0x6e,0x65,0x73,0x65,0x8f,
+0x11,0x69,0x73,0xa1,0x11,0x70,0x6f,0x2a,0x13,0x6d,0x6f,0x66,0x6f,0x2b,0x10,0x61,
+1,0x68,0x2e,0x69,0x7c,0x12,0x6c,0x6c,0x65,0x7d,0xa2,0x41,0x11,0x6d,0x69,0xa3,
+0x41,0x61,0x48,0x65,0x9c,0x68,1,0x61,0x2a,0x6b,0x10,0x73,0xa3,0xa8,0x15,0x69,
+0x6b,0x73,0x75,0x6b,0x69,0xa3,0xa8,3,0x6c,0x3a,0x6d,0x48,0x73,0x54,0x74,1,
+0x61,0x24,0x6b,0x9f,0x10,0x6b,0x9f,0x10,0x69,0x9c,0x13,0x6e,0x65,0x73,0x65,0x9d,
+0x10,0x75,0xa2,0x82,0x10,0x6d,0xa3,0x82,0x10,0x73,0xa2,0x86,0x13,0x61,0x76,0x61,
+0x68,0xa3,0x86,0x11,0x6e,0x67,0x28,0x12,0x61,0x6c,0x69,0x29,3,0x6c,0x42,0x6e,
+0x90,0x74,0xa2,0x46,0x76,0x24,0x17,0x6f,0x77,0x65,0x6c,0x6a,0x61,0x6d,0x6f,0x25,
+0x22,1,0x65,0x54,0x76,0x28,1,0x73,0x38,0x74,0x2a,0x17,0x73,0x79,0x6c,0x6c,
+0x61,0x62,0x6c,0x65,0x2b,0x16,0x79,0x6c,0x6c,0x61,0x62,0x6c,0x65,0x29,0x18,0x61,
+0x64,0x69,0x6e,0x67,0x6a,0x61,0x6d,0x6f,0x23,1,0x61,0x21,0x6f,0x1a,0x74,0x61,
+0x70,0x70,0x6c,0x69,0x63,0x61,0x62,0x6c,0x65,0x21,0x26,0x1a,0x72,0x61,0x69,0x6c,
+0x69,0x6e,0x67,0x6a,0x61,0x6d,0x6f,0x27,1,0x6e,0x2c,0x79,0x22,0x11,0x65,0x73,
+0x23,0x20,0x10,0x6f,0x21,1,0x6e,0x2c,0x79,0x22,0x11,0x65,0x73,0x23,0x20,0x10,
+0x6f,0x21,2,0x6d,0x30,0x6e,0x3a,0x79,0x22,0x11,0x65,0x73,0x23,0x24,0x13,0x61,
+0x79,0x62,0x65,0x25,0x20,0x10,0x6f,0x21,2,0x6d,0x30,0x6e,0x3a,0x79,0x22,0x11,
+0x65,0x73,0x23,0x24,0x13,0x61,0x79,0x62,0x65,0x25,0x20,0x10,0x6f,0x21,0xb,0x72,
+0x39,0x76,0xc,0x76,0x33,0x78,0x2a,0x7a,0x11,0x77,0x6a,0x43,0x10,0x78,0x21,0x72,
+0x28,0x73,0x50,0x74,0x31,1,0x65,0x24,0x69,0x39,0x1e,0x67,0x69,0x6f,0x6e,0x61,
+0x6c,0x69,0x6e,0x64,0x69,0x63,0x61,0x74,0x6f,0x72,0x39,1,0x6d,0x35,0x70,0x18,
+0x61,0x63,0x69,0x6e,0x67,0x6d,0x61,0x72,0x6b,0x35,0x6c,0x1f,0x6c,0x3c,0x6f,0x4a,
+0x70,1,0x70,0x37,0x72,0x14,0x65,0x70,0x65,0x6e,0x64,0x37,0x28,1,0x66,0x2b,
+0x76,0x2c,0x10,0x74,0x2f,0x13,0x74,0x68,0x65,0x72,0x21,0x63,0x4c,0x65,0x64,0x67,
+1,0x61,0x3a,0x6c,0x19,0x75,0x65,0x61,0x66,0x74,0x65,0x72,0x7a,0x77,0x6a,0x41,
+0x10,0x7a,0x41,2,0x6e,0x23,0x6f,0x24,0x72,0x25,0x14,0x6e,0x74,0x72,0x6f,0x6c,
+0x23,2,0x62,0x34,0x6d,0x4e,0x78,0x26,0x13,0x74,0x65,0x6e,0x64,0x27,0x3a,1,
+0x61,0x24,0x67,0x3d,0x11,0x73,0x65,0x3a,0x12,0x67,0x61,0x7a,0x3d,0x3e,0x16,0x6f,
+0x64,0x69,0x66,0x69,0x65,0x72,0x3f,9,0x6e,0x4a,0x6e,0x34,0x6f,0x44,0x73,0x60,
+0x75,0x94,0x78,0x10,0x78,0x21,0x10,0x75,0x2a,0x14,0x6d,0x65,0x72,0x69,0x63,0x2b,
+1,0x6c,0x2c,0x74,0x12,0x68,0x65,0x72,0x21,0x14,0x65,0x74,0x74,0x65,0x72,0x2d,
+3,0x63,0x36,0x65,0x46,0x70,0x31,0x74,0x32,0x12,0x65,0x72,0x6d,0x33,0x3c,0x16,
+0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,0x3d,0x2e,0x10,0x70,0x2f,0x10,0x70,0x34,0x12,
+0x70,0x65,0x72,0x35,0x61,0x46,0x63,0x52,0x65,0x64,0x66,0x72,0x6c,2,0x65,0x2d,
+0x66,0x3b,0x6f,0x28,0x12,0x77,0x65,0x72,0x29,0x10,0x74,0x22,0x12,0x65,0x72,0x6d,
+0x23,1,0x6c,0x24,0x72,0x37,0x24,0x12,0x6f,0x73,0x65,0x25,0x10,0x78,0x38,0x13,
+0x74,0x65,0x6e,0x64,0x39,0x10,0x6f,0x26,0x13,0x72,0x6d,0x61,0x74,0x27,0,0x10,
+0x6c,0x88,0x72,0x40,0x72,0x36,0x73,0x5e,0x77,0x7a,0x78,0x8a,0x7a,0x11,0x77,0x6a,
0x4b,1,0x65,0x24,0x69,0x3b,0x1e,0x67,0x69,0x6f,0x6e,0x61,0x6c,0x69,0x6e,0x64,
0x69,0x63,0x61,0x74,0x6f,0x72,0x3b,1,0x69,0x24,0x71,0x3f,0x18,0x6e,0x67,0x6c,
-0x65,0x71,0x75,0x6f,0x74,0x65,0x3f,0x17,0x73,0x65,0x67,0x73,0x70,0x61,0x63,0x65,
-0x4d,0x10,0x78,0x21,0x6c,0x36,0x6d,0x3c,0x6e,0x76,0x6f,0x13,0x74,0x68,0x65,0x72,
-0x21,1,0x65,0x23,0x66,0x35,3,0x62,0x37,0x69,0x28,0x6c,0x29,0x6e,0x2b,0x10,
-0x64,1,0x6c,0x34,0x6e,0x11,0x75,0x6d,0x2a,0x12,0x6c,0x65,0x74,0x37,0x14,0x65,
-0x74,0x74,0x65,0x72,0x29,2,0x65,0x36,0x6c,0x39,0x75,0x2c,0x14,0x6d,0x65,0x72,
-0x69,0x63,0x2d,0x14,0x77,0x6c,0x69,0x6e,0x65,0x39,0x66,0x3f,0x66,0x40,0x67,0x4e,
-0x68,0x70,0x6b,0x10,0x61,0x26,0x15,0x74,0x61,0x6b,0x61,0x6e,0x61,0x27,0x10,0x6f,
-0x24,0x13,0x72,0x6d,0x61,0x74,0x25,1,0x61,0x3a,0x6c,0x19,0x75,0x65,0x61,0x66,
-0x74,0x65,0x72,0x7a,0x77,0x6a,0x49,0x10,0x7a,0x49,1,0x65,0x24,0x6c,0x3d,0x19,
-0x62,0x72,0x65,0x77,0x6c,0x65,0x74,0x74,0x65,0x72,0x3d,0x61,0x86,0x63,0x92,0x64,
-0x94,0x65,2,0x62,0x44,0x6d,0x5e,0x78,0x2e,0x13,0x74,0x65,0x6e,0x64,0x32,0x15,
-0x6e,0x75,0x6d,0x6c,0x65,0x74,0x2f,0x42,1,0x61,0x24,0x67,0x45,0x11,0x73,0x65,
-0x42,0x12,0x67,0x61,0x7a,0x45,0x46,0x16,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,0x47,
-0x15,0x6c,0x65,0x74,0x74,0x65,0x72,0x23,0x10,0x72,0x31,1,0x6f,0x24,0x71,0x41,
-0x18,0x75,0x62,0x6c,0x65,0x71,0x75,0x6f,0x74,0x65,0x41,2,0x63,0x32,0x6e,0x3c,
-0x6f,0x22,0x12,0x70,0x65,0x6e,0x23,0x24,0x13,0x6c,0x6f,0x73,0x65,0x25,0x20,0x12,
-0x6f,0x6e,0x65,0x21,6,0x6f,0x65,0x6f,0x4a,0x72,0x5c,0x74,0x64,0x76,0x1d,0x69,
-0x73,0x75,0x61,0x6c,0x6f,0x72,0x64,0x65,0x72,0x6c,0x65,0x66,0x74,0x3d,0x18,0x76,
-0x65,0x72,0x73,0x74,0x72,0x75,0x63,0x6b,0x2d,0x13,0x69,0x67,0x68,0x74,0x2f,0x11,
-0x6f,0x70,0x30,0x12,0x61,0x6e,0x64,2,0x62,0x32,0x6c,0x62,0x72,0x13,0x69,0x67,
-0x68,0x74,0x3b,0x14,0x6f,0x74,0x74,0x6f,0x6d,0x32,0x12,0x61,0x6e,0x64,1,0x6c,
-0x2e,0x72,0x13,0x69,0x67,0x68,0x74,0x35,0x12,0x65,0x66,0x74,0x3f,0x12,0x65,0x66,
-0x74,0x36,0x17,0x61,0x6e,0x64,0x72,0x69,0x67,0x68,0x74,0x39,0x62,0x2c,0x6c,0x5c,
-0x6e,0x10,0x61,0x21,0x14,0x6f,0x74,0x74,0x6f,0x6d,0x22,0x12,0x61,0x6e,0x64,1,
-0x6c,0x2e,0x72,0x13,0x69,0x67,0x68,0x74,0x27,0x12,0x65,0x66,0x74,0x25,0x12,0x65,
-0x66,0x74,0x28,0x17,0x61,0x6e,0x64,0x72,0x69,0x67,0x68,0x74,0x2b,0xd,0x6e,0xaa,
-0x72,0x70,0x72,0x92,0x73,0xa2,0x46,0x74,0xa2,0x54,0x76,1,0x69,0x60,0x6f,0x12,
-0x77,0x65,0x6c,0x62,1,0x64,0x3a,0x69,0x19,0x6e,0x64,0x65,0x70,0x65,0x6e,0x64,
-0x65,0x6e,0x74,0x67,0x17,0x65,0x70,0x65,0x6e,0x64,0x65,0x6e,0x74,0x65,1,0x72,
-0x2e,0x73,0x13,0x61,0x72,0x67,0x61,0x61,0x12,0x61,0x6d,0x61,0x5f,0x1d,0x65,0x67,
-0x69,0x73,0x74,0x65,0x72,0x73,0x68,0x69,0x66,0x74,0x65,0x72,0x57,0x1e,0x79,0x6c,
-0x6c,0x61,0x62,0x6c,0x65,0x6d,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,0x59,0x12,0x6f,
-0x6e,0x65,1,0x6c,0x2c,0x6d,0x12,0x61,0x72,0x6b,0x5d,0x14,0x65,0x74,0x74,0x65,
-0x72,0x5b,0x6e,0x3c,0x6f,0x7c,0x70,0x18,0x75,0x72,0x65,0x6b,0x69,0x6c,0x6c,0x65,
-0x72,0x55,1,0x6f,0x4c,0x75,1,0x6b,0x3c,0x6d,0x12,0x62,0x65,0x72,0x50,0x15,
-0x6a,0x6f,0x69,0x6e,0x65,0x72,0x53,0x11,0x74,0x61,0x4f,0x16,0x6e,0x6a,0x6f,0x69,
-0x6e,0x65,0x72,0x4d,0x13,0x74,0x68,0x65,0x72,0x21,0x67,0x3e,0x67,0x4a,0x69,0x64,
-0x6a,0x82,0x6d,0x1d,0x6f,0x64,0x69,0x66,0x79,0x69,0x6e,0x67,0x6c,0x65,0x74,0x74,
-0x65,0x72,0x4b,0x1c,0x65,0x6d,0x69,0x6e,0x61,0x74,0x69,0x6f,0x6e,0x6d,0x61,0x72,
-0x6b,0x45,0x1e,0x6e,0x76,0x69,0x73,0x69,0x62,0x6c,0x65,0x73,0x74,0x61,0x63,0x6b,
-0x65,0x72,0x47,0x14,0x6f,0x69,0x6e,0x65,0x72,0x49,0x61,0xa2,0xba,0x62,0xa2,0xc0,
-0x63,1,0x61,0xa2,0xa2,0x6f,0x16,0x6e,0x73,0x6f,0x6e,0x61,0x6e,0x74,0x2a,8,
-0x6b,0x67,0x6b,0x48,0x6d,0x52,0x70,0x5c,0x73,0xa2,0x42,0x77,0x19,0x69,0x74,0x68,
-0x73,0x74,0x61,0x63,0x6b,0x65,0x72,0x43,0x14,0x69,0x6c,0x6c,0x65,0x72,0x35,0x14,
-0x65,0x64,0x69,0x61,0x6c,0x37,1,0x6c,0x52,0x72,0x10,0x65,1,0x63,0x2e,0x66,
-0x13,0x69,0x78,0x65,0x64,0x3d,0x19,0x65,0x64,0x69,0x6e,0x67,0x72,0x65,0x70,0x68,
-0x61,0x3b,0x18,0x61,0x63,0x65,0x68,0x6f,0x6c,0x64,0x65,0x72,0x39,0x10,0x75,1,
-0x62,0x3e,0x63,0x1b,0x63,0x65,0x65,0x64,0x69,0x6e,0x67,0x72,0x65,0x70,0x68,0x61,
-0x41,0x15,0x6a,0x6f,0x69,0x6e,0x65,0x64,0x3f,0x64,0x4c,0x66,0x52,0x68,0x5a,0x69,
-0x1e,0x6e,0x69,0x74,0x69,0x61,0x6c,0x70,0x6f,0x73,0x74,0x66,0x69,0x78,0x65,0x64,
-0x33,0x12,0x65,0x61,0x64,0x2d,0x13,0x69,0x6e,0x61,0x6c,0x2f,0x18,0x65,0x61,0x64,
-0x6c,0x65,0x74,0x74,0x65,0x72,0x31,0x1d,0x6e,0x74,0x69,0x6c,0x6c,0x61,0x74,0x69,
-0x6f,0x6e,0x6d,0x61,0x72,0x6b,0x29,0x16,0x76,0x61,0x67,0x72,0x61,0x68,0x61,0x23,
-1,0x69,0x4a,0x72,0x10,0x61,0x1f,0x68,0x6d,0x69,0x6a,0x6f,0x69,0x6e,0x69,0x6e,
-0x67,0x6e,0x75,0x6d,0x62,0x65,0x72,0x27,0x12,0x6e,0x64,0x75,0x25,2,0x72,0x38,
-0x74,0x46,0x75,0x26,0x15,0x70,0x72,0x69,0x67,0x68,0x74,0x27,0x20,0x15,0x6f,0x74,
-0x61,0x74,0x65,0x64,0x21,1,0x72,0x24,0x75,0x25,0x22,0x18,0x61,0x6e,0x73,0x66,
-0x6f,0x72,0x6d,0x65,0x64,1,0x72,0x32,0x75,0x15,0x70,0x72,0x69,0x67,0x68,0x74,
-0x25,0x15,0x6f,0x74,0x61,0x74,0x65,0x64,0x23,0xd,0x6e,0xc1,0x86,0x73,0xa8,0x73,
-0x4c,0x74,0xa2,0x76,0x75,0xa2,0x83,0x7a,0xd8,0x70,0,2,0x6c,0xd9,0x20,0,
-0x70,0xd9,0x40,0,0x73,0xc3,0,0xfe,0xf,0,0,0,7,0x6f,0x3c,0x6f,
-0xff,8,0,0,0,0x70,0x3a,0x75,0x6e,0x79,0x13,0x6d,0x62,0x6f,0x6c,0xff,
-0xf,0,0,0,0x11,0x61,0x63,1,0x65,0x34,0x69,0x15,0x6e,0x67,0x6d,0x61,
-0x72,0x6b,0xa5,0,0x18,0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0xc3,0,
-0x16,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0xe1,0,0,0x63,0xff,2,0,0,
-0,0x65,0x38,0x6b,0xff,4,0,0,0,0x6d,0xff,1,0,0,0,0x16,
-0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0xd9,0x70,0,0x1d,0x69,0x74,0x6c,0x65,0x63,
-0x61,0x73,0x65,0x6c,0x65,0x74,0x74,0x65,0x72,0x31,1,0x6e,0x40,0x70,0x1c,0x70,
-0x65,0x72,0x63,0x61,0x73,0x65,0x6c,0x65,0x74,0x74,0x65,0x72,0x25,0x17,0x61,0x73,
-0x73,0x69,0x67,0x6e,0x65,0x64,0x23,0x6e,0xa2,0x69,0x6f,0xa2,0x89,0x70,0xfe,0x30,
-0xf8,0,0,9,0x69,0x33,0x69,0xff,0x10,0,0,0,0x6f,0xfd,0x80,0,
-0,0x72,0x54,0x73,0xf9,0,0,0x75,0x12,0x6e,0x63,0x74,0xfe,0x30,0xf8,0,
-0,0x15,0x75,0x61,0x74,0x69,0x6f,0x6e,0xff,0x30,0xf8,0,0,0x17,0x69,0x76,
-0x61,0x74,0x65,0x75,0x73,0x65,0xdd,0,0,0x61,0x48,0x63,0xfd,0x40,0,0,
-0x64,0xe9,0,0,0x65,0xfd,0x20,0,0,0x66,0xff,0x20,0,0,0,0x1f,
-0x72,0x61,0x67,0x72,0x61,0x70,0x68,0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,
-0xd9,0x40,0,0xbe,0,3,0x64,0xa7,0,0x6c,0xab,0,0x6f,0x30,0x75,0x13,
-0x6d,0x62,0x65,0x72,0xbf,0,0xb2,0,0x1b,0x6e,0x73,0x70,0x61,0x63,0x69,0x6e,
-0x67,0x6d,0x61,0x72,0x6b,0xa1,1,0x70,0x92,0x74,0x12,0x68,0x65,0x72,0xe6,0x80,
-1,3,0x6c,0x40,0x6e,0x4a,0x70,0x56,0x73,0x14,0x79,0x6d,0x62,0x6f,0x6c,0xff,
-8,0,0,0,0x14,0x65,0x74,0x74,0x65,0x72,0x61,0x14,0x75,0x6d,0x62,0x65,
-0x72,0xb3,0,0x19,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xfd,0x80,
-0,0,0x1c,0x65,0x6e,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,
-0xf9,0,0,0x66,0xc0,0xc4,0x66,0xa2,0x47,0x69,0xa2,0x64,0x6c,0xa2,0x79,0x6d,
-0xa4,0xc0,4,0x61,0x6c,0x63,0xa5,0,0x65,0xa3,0x80,0x6e,0xa1,0x6f,0x15,0x64,
-0x69,0x66,0x69,0x65,0x72,1,0x6c,0x38,0x73,0x14,0x79,0x6d,0x62,0x6f,0x6c,0xff,
-4,0,0,0,0x14,0x65,0x74,0x74,0x65,0x72,0x41,1,0x72,0x3c,0x74,0x16,
-0x68,0x73,0x79,0x6d,0x62,0x6f,0x6c,0xff,1,0,0,0,0x10,0x6b,0xa5,0xc0,
-1,0x69,0x32,0x6f,0x13,0x72,0x6d,0x61,0x74,0xdb,0,0,0x1d,0x6e,0x61,0x6c,
-0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xff,0x20,0,0,0,
-0x10,0x6e,0x1f,0x69,0x74,0x69,0x61,0x6c,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,
-0x69,0x6f,0x6e,0xff,0x10,0,0,0,0x9c,7,0x6d,0x18,0x6d,0x41,0x6f,0x28,
-0x74,0x31,0x75,0x25,0x60,0x1c,0x77,0x65,0x72,0x63,0x61,0x73,0x65,0x6c,0x65,0x74,
-0x74,0x65,0x72,0x29,0x63,0x3d,0x65,0x28,0x69,0x42,0x6c,0x29,0x13,0x74,0x74,0x65,
-0x72,0x9c,0x15,0x6e,0x75,0x6d,0x62,0x65,0x72,0xab,0,0x1a,0x6e,0x65,0x73,0x65,
-0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0xd9,0x20,0,0x63,0x46,0x64,0xa2,0x96,0x65,
-0x1b,0x6e,0x63,0x6c,0x6f,0x73,0x69,0x6e,0x67,0x6d,0x61,0x72,0x6b,0xa3,0x80,0xe6,
-0x80,1,7,0x6e,0x57,0x6e,0x52,0x6f,0x5e,0x73,0xe1,0,0,0x75,0x1b,0x72,
-0x72,0x65,0x6e,0x63,0x79,0x73,0x79,0x6d,0x62,0x6f,0x6c,0xff,2,0,0,0,
-0x22,0x12,0x74,0x72,0x6c,0xd9,0x80,0,0xdc,0,0,1,0x6d,0x62,0x6e,1,
-0x6e,0x30,0x74,0x12,0x72,0x6f,0x6c,0xd9,0x80,0,0x1f,0x65,0x63,0x74,0x6f,0x72,
-0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xfd,0x40,0,0,0x19,
-0x62,0x69,0x6e,0x69,0x6e,0x67,0x6d,0x61,0x72,0x6b,0xa5,0xc0,0x61,0x58,0x63,0xd9,
-0x80,0,0x66,0xdb,0,0,0x6c,0x1d,0x6f,0x73,0x65,0x70,0x75,0x6e,0x63,0x74,
-0x75,0x61,0x74,0x69,0x6f,0x6e,0xfd,0x20,0,0,0x18,0x73,0x65,0x64,0x6c,0x65,
-0x74,0x74,0x65,0x72,0x3d,2,0x61,0x32,0x65,0x50,0x69,0x12,0x67,0x69,0x74,0xa7,
-0,0x1c,0x73,0x68,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xe9,
-0,0,0x1a,0x63,0x69,0x6d,0x61,0x6c,0x6e,0x75,0x6d,0x62,0x65,0x72,0xa7,0
+0x65,0x71,0x75,0x6f,0x74,0x65,0x3f,0x17,0x73,0x65,0x67,0x73,0x70,0x61,0x63,0x65,
+0x4d,0x10,0x78,0x21,0x6c,0x36,0x6d,0x3c,0x6e,0x76,0x6f,0x13,0x74,0x68,0x65,0x72,
+0x21,1,0x65,0x23,0x66,0x35,3,0x62,0x37,0x69,0x28,0x6c,0x29,0x6e,0x2b,0x10,
+0x64,1,0x6c,0x34,0x6e,0x11,0x75,0x6d,0x2a,0x12,0x6c,0x65,0x74,0x37,0x14,0x65,
+0x74,0x74,0x65,0x72,0x29,2,0x65,0x36,0x6c,0x39,0x75,0x2c,0x14,0x6d,0x65,0x72,
+0x69,0x63,0x2d,0x14,0x77,0x6c,0x69,0x6e,0x65,0x39,0x66,0x3f,0x66,0x40,0x67,0x4e,
+0x68,0x70,0x6b,0x10,0x61,0x26,0x15,0x74,0x61,0x6b,0x61,0x6e,0x61,0x27,0x10,0x6f,
+0x24,0x13,0x72,0x6d,0x61,0x74,0x25,1,0x61,0x3a,0x6c,0x19,0x75,0x65,0x61,0x66,
+0x74,0x65,0x72,0x7a,0x77,0x6a,0x49,0x10,0x7a,0x49,1,0x65,0x24,0x6c,0x3d,0x19,
+0x62,0x72,0x65,0x77,0x6c,0x65,0x74,0x74,0x65,0x72,0x3d,0x61,0x86,0x63,0x92,0x64,
+0x94,0x65,2,0x62,0x44,0x6d,0x5e,0x78,0x2e,0x13,0x74,0x65,0x6e,0x64,0x32,0x15,
+0x6e,0x75,0x6d,0x6c,0x65,0x74,0x2f,0x42,1,0x61,0x24,0x67,0x45,0x11,0x73,0x65,
+0x42,0x12,0x67,0x61,0x7a,0x45,0x46,0x16,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,0x47,
+0x15,0x6c,0x65,0x74,0x74,0x65,0x72,0x23,0x10,0x72,0x31,1,0x6f,0x24,0x71,0x41,
+0x18,0x75,0x62,0x6c,0x65,0x71,0x75,0x6f,0x74,0x65,0x41,2,0x63,0x32,0x6e,0x3c,
+0x6f,0x22,0x12,0x70,0x65,0x6e,0x23,0x24,0x13,0x6c,0x6f,0x73,0x65,0x25,0x20,0x12,
+0x6f,0x6e,0x65,0x21,6,0x6f,0x65,0x6f,0x4a,0x72,0x5c,0x74,0x64,0x76,0x1d,0x69,
+0x73,0x75,0x61,0x6c,0x6f,0x72,0x64,0x65,0x72,0x6c,0x65,0x66,0x74,0x3d,0x18,0x76,
+0x65,0x72,0x73,0x74,0x72,0x75,0x63,0x6b,0x2d,0x13,0x69,0x67,0x68,0x74,0x2f,0x11,
+0x6f,0x70,0x30,0x12,0x61,0x6e,0x64,2,0x62,0x32,0x6c,0x62,0x72,0x13,0x69,0x67,
+0x68,0x74,0x3b,0x14,0x6f,0x74,0x74,0x6f,0x6d,0x32,0x12,0x61,0x6e,0x64,1,0x6c,
+0x2e,0x72,0x13,0x69,0x67,0x68,0x74,0x35,0x12,0x65,0x66,0x74,0x3f,0x12,0x65,0x66,
+0x74,0x36,0x17,0x61,0x6e,0x64,0x72,0x69,0x67,0x68,0x74,0x39,0x62,0x2c,0x6c,0x5c,
+0x6e,0x10,0x61,0x21,0x14,0x6f,0x74,0x74,0x6f,0x6d,0x22,0x12,0x61,0x6e,0x64,1,
+0x6c,0x2e,0x72,0x13,0x69,0x67,0x68,0x74,0x27,0x12,0x65,0x66,0x74,0x25,0x12,0x65,
+0x66,0x74,0x28,0x17,0x61,0x6e,0x64,0x72,0x69,0x67,0x68,0x74,0x2b,0xd,0x6e,0xaa,
+0x72,0x70,0x72,0x92,0x73,0xa2,0x46,0x74,0xa2,0x54,0x76,1,0x69,0x60,0x6f,0x12,
+0x77,0x65,0x6c,0x62,1,0x64,0x3a,0x69,0x19,0x6e,0x64,0x65,0x70,0x65,0x6e,0x64,
+0x65,0x6e,0x74,0x67,0x17,0x65,0x70,0x65,0x6e,0x64,0x65,0x6e,0x74,0x65,1,0x72,
+0x2e,0x73,0x13,0x61,0x72,0x67,0x61,0x61,0x12,0x61,0x6d,0x61,0x5f,0x1d,0x65,0x67,
+0x69,0x73,0x74,0x65,0x72,0x73,0x68,0x69,0x66,0x74,0x65,0x72,0x57,0x1e,0x79,0x6c,
+0x6c,0x61,0x62,0x6c,0x65,0x6d,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,0x59,0x12,0x6f,
+0x6e,0x65,1,0x6c,0x2c,0x6d,0x12,0x61,0x72,0x6b,0x5d,0x14,0x65,0x74,0x74,0x65,
+0x72,0x5b,0x6e,0x3c,0x6f,0x7c,0x70,0x18,0x75,0x72,0x65,0x6b,0x69,0x6c,0x6c,0x65,
+0x72,0x55,1,0x6f,0x4c,0x75,1,0x6b,0x3c,0x6d,0x12,0x62,0x65,0x72,0x50,0x15,
+0x6a,0x6f,0x69,0x6e,0x65,0x72,0x53,0x11,0x74,0x61,0x4f,0x16,0x6e,0x6a,0x6f,0x69,
+0x6e,0x65,0x72,0x4d,0x13,0x74,0x68,0x65,0x72,0x21,0x67,0x3e,0x67,0x4a,0x69,0x64,
+0x6a,0x82,0x6d,0x1d,0x6f,0x64,0x69,0x66,0x79,0x69,0x6e,0x67,0x6c,0x65,0x74,0x74,
+0x65,0x72,0x4b,0x1c,0x65,0x6d,0x69,0x6e,0x61,0x74,0x69,0x6f,0x6e,0x6d,0x61,0x72,
+0x6b,0x45,0x1e,0x6e,0x76,0x69,0x73,0x69,0x62,0x6c,0x65,0x73,0x74,0x61,0x63,0x6b,
+0x65,0x72,0x47,0x14,0x6f,0x69,0x6e,0x65,0x72,0x49,0x61,0xa2,0xba,0x62,0xa2,0xc0,
+0x63,1,0x61,0xa2,0xa2,0x6f,0x16,0x6e,0x73,0x6f,0x6e,0x61,0x6e,0x74,0x2a,8,
+0x6b,0x67,0x6b,0x48,0x6d,0x52,0x70,0x5c,0x73,0xa2,0x42,0x77,0x19,0x69,0x74,0x68,
+0x73,0x74,0x61,0x63,0x6b,0x65,0x72,0x43,0x14,0x69,0x6c,0x6c,0x65,0x72,0x35,0x14,
+0x65,0x64,0x69,0x61,0x6c,0x37,1,0x6c,0x52,0x72,0x10,0x65,1,0x63,0x2e,0x66,
+0x13,0x69,0x78,0x65,0x64,0x3d,0x19,0x65,0x64,0x69,0x6e,0x67,0x72,0x65,0x70,0x68,
+0x61,0x3b,0x18,0x61,0x63,0x65,0x68,0x6f,0x6c,0x64,0x65,0x72,0x39,0x10,0x75,1,
+0x62,0x3e,0x63,0x1b,0x63,0x65,0x65,0x64,0x69,0x6e,0x67,0x72,0x65,0x70,0x68,0x61,
+0x41,0x15,0x6a,0x6f,0x69,0x6e,0x65,0x64,0x3f,0x64,0x4c,0x66,0x52,0x68,0x5a,0x69,
+0x1e,0x6e,0x69,0x74,0x69,0x61,0x6c,0x70,0x6f,0x73,0x74,0x66,0x69,0x78,0x65,0x64,
+0x33,0x12,0x65,0x61,0x64,0x2d,0x13,0x69,0x6e,0x61,0x6c,0x2f,0x18,0x65,0x61,0x64,
+0x6c,0x65,0x74,0x74,0x65,0x72,0x31,0x1d,0x6e,0x74,0x69,0x6c,0x6c,0x61,0x74,0x69,
+0x6f,0x6e,0x6d,0x61,0x72,0x6b,0x29,0x16,0x76,0x61,0x67,0x72,0x61,0x68,0x61,0x23,
+1,0x69,0x4a,0x72,0x10,0x61,0x1f,0x68,0x6d,0x69,0x6a,0x6f,0x69,0x6e,0x69,0x6e,
+0x67,0x6e,0x75,0x6d,0x62,0x65,0x72,0x27,0x12,0x6e,0x64,0x75,0x25,2,0x72,0x38,
+0x74,0x46,0x75,0x26,0x15,0x70,0x72,0x69,0x67,0x68,0x74,0x27,0x20,0x15,0x6f,0x74,
+0x61,0x74,0x65,0x64,0x21,1,0x72,0x24,0x75,0x25,0x22,0x18,0x61,0x6e,0x73,0x66,
+0x6f,0x72,0x6d,0x65,0x64,1,0x72,0x32,0x75,0x15,0x70,0x72,0x69,0x67,0x68,0x74,
+0x25,0x15,0x6f,0x74,0x61,0x74,0x65,0x64,0x23,0xd,0x6e,0xc1,0x86,0x73,0xa8,0x73,
+0x4c,0x74,0xa2,0x76,0x75,0xa2,0x83,0x7a,0xd8,0x70,0,2,0x6c,0xd9,0x20,0,
+0x70,0xd9,0x40,0,0x73,0xc3,0,0xfe,0xf,0,0,0,7,0x6f,0x3c,0x6f,
+0xff,8,0,0,0,0x70,0x3a,0x75,0x6e,0x79,0x13,0x6d,0x62,0x6f,0x6c,0xff,
+0xf,0,0,0,0x11,0x61,0x63,1,0x65,0x34,0x69,0x15,0x6e,0x67,0x6d,0x61,
+0x72,0x6b,0xa5,0,0x18,0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0xc3,0,
+0x16,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0xe1,0,0,0x63,0xff,2,0,0,
+0,0x65,0x38,0x6b,0xff,4,0,0,0,0x6d,0xff,1,0,0,0,0x16,
+0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0xd9,0x70,0,0x1d,0x69,0x74,0x6c,0x65,0x63,
+0x61,0x73,0x65,0x6c,0x65,0x74,0x74,0x65,0x72,0x31,1,0x6e,0x40,0x70,0x1c,0x70,
+0x65,0x72,0x63,0x61,0x73,0x65,0x6c,0x65,0x74,0x74,0x65,0x72,0x25,0x17,0x61,0x73,
+0x73,0x69,0x67,0x6e,0x65,0x64,0x23,0x6e,0xa2,0x69,0x6f,0xa2,0x89,0x70,0xfe,0x30,
+0xf8,0,0,9,0x69,0x33,0x69,0xff,0x10,0,0,0,0x6f,0xfd,0x80,0,
+0,0x72,0x54,0x73,0xf9,0,0,0x75,0x12,0x6e,0x63,0x74,0xfe,0x30,0xf8,0,
+0,0x15,0x75,0x61,0x74,0x69,0x6f,0x6e,0xff,0x30,0xf8,0,0,0x17,0x69,0x76,
+0x61,0x74,0x65,0x75,0x73,0x65,0xdd,0,0,0x61,0x48,0x63,0xfd,0x40,0,0,
+0x64,0xe9,0,0,0x65,0xfd,0x20,0,0,0x66,0xff,0x20,0,0,0,0x1f,
+0x72,0x61,0x67,0x72,0x61,0x70,0x68,0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,
+0xd9,0x40,0,0xbe,0,3,0x64,0xa7,0,0x6c,0xab,0,0x6f,0x30,0x75,0x13,
+0x6d,0x62,0x65,0x72,0xbf,0,0xb2,0,0x1b,0x6e,0x73,0x70,0x61,0x63,0x69,0x6e,
+0x67,0x6d,0x61,0x72,0x6b,0xa1,1,0x70,0x92,0x74,0x12,0x68,0x65,0x72,0xe6,0x80,
+1,3,0x6c,0x40,0x6e,0x4a,0x70,0x56,0x73,0x14,0x79,0x6d,0x62,0x6f,0x6c,0xff,
+8,0,0,0,0x14,0x65,0x74,0x74,0x65,0x72,0x61,0x14,0x75,0x6d,0x62,0x65,
+0x72,0xb3,0,0x19,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xfd,0x80,
+0,0,0x1c,0x65,0x6e,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,
+0xf9,0,0,0x66,0xc0,0xc4,0x66,0xa2,0x47,0x69,0xa2,0x64,0x6c,0xa2,0x79,0x6d,
+0xa4,0xc0,4,0x61,0x6c,0x63,0xa5,0,0x65,0xa3,0x80,0x6e,0xa1,0x6f,0x15,0x64,
+0x69,0x66,0x69,0x65,0x72,1,0x6c,0x38,0x73,0x14,0x79,0x6d,0x62,0x6f,0x6c,0xff,
+4,0,0,0,0x14,0x65,0x74,0x74,0x65,0x72,0x41,1,0x72,0x3c,0x74,0x16,
+0x68,0x73,0x79,0x6d,0x62,0x6f,0x6c,0xff,1,0,0,0,0x10,0x6b,0xa5,0xc0,
+1,0x69,0x32,0x6f,0x13,0x72,0x6d,0x61,0x74,0xdb,0,0,0x1d,0x6e,0x61,0x6c,
+0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xff,0x20,0,0,0,
+0x10,0x6e,0x1f,0x69,0x74,0x69,0x61,0x6c,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,
+0x69,0x6f,0x6e,0xff,0x10,0,0,0,0x9c,7,0x6d,0x18,0x6d,0x41,0x6f,0x28,
+0x74,0x31,0x75,0x25,0x60,0x1c,0x77,0x65,0x72,0x63,0x61,0x73,0x65,0x6c,0x65,0x74,
+0x74,0x65,0x72,0x29,0x63,0x3d,0x65,0x28,0x69,0x42,0x6c,0x29,0x13,0x74,0x74,0x65,
+0x72,0x9c,0x15,0x6e,0x75,0x6d,0x62,0x65,0x72,0xab,0,0x1a,0x6e,0x65,0x73,0x65,
+0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0xd9,0x20,0,0x63,0x46,0x64,0xa2,0x96,0x65,
+0x1b,0x6e,0x63,0x6c,0x6f,0x73,0x69,0x6e,0x67,0x6d,0x61,0x72,0x6b,0xa3,0x80,0xe6,
+0x80,1,7,0x6e,0x57,0x6e,0x52,0x6f,0x5e,0x73,0xe1,0,0,0x75,0x1b,0x72,
+0x72,0x65,0x6e,0x63,0x79,0x73,0x79,0x6d,0x62,0x6f,0x6c,0xff,2,0,0,0,
+0x22,0x12,0x74,0x72,0x6c,0xd9,0x80,0,0xdc,0,0,1,0x6d,0x62,0x6e,1,
+0x6e,0x30,0x74,0x12,0x72,0x6f,0x6c,0xd9,0x80,0,0x1f,0x65,0x63,0x74,0x6f,0x72,
+0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xfd,0x40,0,0,0x19,
+0x62,0x69,0x6e,0x69,0x6e,0x67,0x6d,0x61,0x72,0x6b,0xa5,0xc0,0x61,0x58,0x63,0xd9,
+0x80,0,0x66,0xdb,0,0,0x6c,0x1d,0x6f,0x73,0x65,0x70,0x75,0x6e,0x63,0x74,
+0x75,0x61,0x74,0x69,0x6f,0x6e,0xfd,0x20,0,0,0x18,0x73,0x65,0x64,0x6c,0x65,
+0x74,0x74,0x65,0x72,0x3d,2,0x61,0x32,0x65,0x50,0x69,0x12,0x67,0x69,0x74,0xa7,
+0,0x1c,0x73,0x68,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xe9,
+0,0,0x1a,0x63,0x69,0x6d,0x61,0x6c,0x6e,0x75,0x6d,0x62,0x65,0x72,0xa7,0
};
-const char PropNameData::nameGroups[22098]={
+const char PropNameData::nameGroups[22098]={
2,'A','l','p','h','a',0,'A','l','p','h','a','b','e','t','i','c',0,
4,'N',0,'N','o',0,'F',0,'F','a','l','s','e',0,4,'Y',0,'Y','e','s',0,'T',0,'T','r','u','e',0,
2,'N','R',0,'N','o','t','_','R','e','o','r','d','e','r','e','d',0,
-2,'O','V',0,'O','v','e','r','l','a','y',0,2,'H','A','N','R',0,'H','a','n','_','R','e','a','d','i','n','g',0,
-2,'N','K',0,'N','u','k','t','a',0,2,'K','V',0,'K','a','n','a','_','V','o','i','c','i','n','g',0,
+2,'O','V',0,'O','v','e','r','l','a','y',0,2,'H','A','N','R',0,'H','a','n','_','R','e','a','d','i','n','g',0,
+2,'N','K',0,'N','u','k','t','a',0,2,'K','V',0,'K','a','n','a','_','V','o','i','c','i','n','g',0,
2,'V','R',0,'V','i','r','a','m','a',0,2,'C','C','C','1','0',0,'C','C','C','1','0',0,
2,'C','C','C','1','1',0,'C','C','C','1','1',0,2,'C','C','C','1','2',0,'C','C','C','1','2',0,
2,'C','C','C','1','3',0,'C','C','C','1','3',0,2,'C','C','C','1','4',0,'C','C','C','1','4',0,
@@ -1131,15 +1131,15 @@ const char PropNameData::nameGroups[22098]={
2,'C','W','C','M',0,'C','h','a','n','g','e','s','_','W','h','e','n','_','C','a','s','e','m','a','p','p','e','d',0,
2,'C','W','K','C','F',0,'C','h','a','n','g','e','s','_','W','h','e','n','_','N','F','K','C','_','C','a','s','e','f','o','l',
'd','e','d',0,2,'E','m','o','j','i',0,'E','m','o','j','i',0,
-2,'E','P','r','e','s',0,'E','m','o','j','i','_','P','r','e','s','e','n','t','a','t','i','o','n',0,
-2,'E','M','o','d',0,'E','m','o','j','i','_','M','o','d','i','f','i','e','r',0,
-2,'E','B','a','s','e',0,'E','m','o','j','i','_','M','o','d','i','f','i','e','r','_','B','a','s','e',0,
-2,'E','C','o','m','p',0,'E','m','o','j','i','_','C','o','m','p','o','n','e','n','t',0,
-2,'R','I',0,'R','e','g','i','o','n','a','l','_','I','n','d','i','c','a','t','o','r',0,
-2,'P','C','M',0,'P','r','e','p','e','n','d','e','d','_','C','o','n','c','a','t','e','n','a','t','i','o','n','_','M','a','r',
-'k',0,2,'E','x','t','P','i','c','t',0,'E','x','t','e','n','d','e','d','_','P','i','c','t','o','g','r','a','p','h','i','c',
-0,2,'b','c',0,'B','i','d','i','_','C','l','a','s','s',0,
-2,'L',0,'L','e','f','t','_','T','o','_','R','i','g','h','t',0,
+2,'E','P','r','e','s',0,'E','m','o','j','i','_','P','r','e','s','e','n','t','a','t','i','o','n',0,
+2,'E','M','o','d',0,'E','m','o','j','i','_','M','o','d','i','f','i','e','r',0,
+2,'E','B','a','s','e',0,'E','m','o','j','i','_','M','o','d','i','f','i','e','r','_','B','a','s','e',0,
+2,'E','C','o','m','p',0,'E','m','o','j','i','_','C','o','m','p','o','n','e','n','t',0,
+2,'R','I',0,'R','e','g','i','o','n','a','l','_','I','n','d','i','c','a','t','o','r',0,
+2,'P','C','M',0,'P','r','e','p','e','n','d','e','d','_','C','o','n','c','a','t','e','n','a','t','i','o','n','_','M','a','r',
+'k',0,2,'E','x','t','P','i','c','t',0,'E','x','t','e','n','d','e','d','_','P','i','c','t','o','g','r','a','p','h','i','c',
+0,2,'b','c',0,'B','i','d','i','_','C','l','a','s','s',0,
+2,'L',0,'L','e','f','t','_','T','o','_','R','i','g','h','t',0,
2,'R',0,'R','i','g','h','t','_','T','o','_','L','e','f','t',0,
2,'E','N',0,'E','u','r','o','p','e','a','n','_','N','u','m','b','e','r',0,
2,'E','S',0,'E','u','r','o','p','e','a','n','_','S','e','p','a','r','a','t','o','r',0,
@@ -1470,48 +1470,48 @@ const char PropNameData::nameGroups[22098]={
'e','n','t',0,2,'N','e','w','a',0,'N','e','w','a',0,2,'O','s','a','g','e',0,'O','s','a','g','e',0,
2,'T','a','n','g','u','t',0,'T','a','n','g','u','t',0,2,'T','a','n','g','u','t','_','C','o','m','p','o','n','e','n','t',
's',0,'T','a','n','g','u','t','_','C','o','m','p','o','n','e','n','t','s',0,
-2,'C','J','K','_','E','x','t','_','F',0,'C','J','K','_','U','n','i','f','i','e','d','_','I','d','e','o','g','r','a','p','h',
-'s','_','E','x','t','e','n','s','i','o','n','_','F',0,2,'K','a','n','a','_','E','x','t','_','A',0,
-'K','a','n','a','_','E','x','t','e','n','d','e','d','_','A',0,
-2,'M','a','s','a','r','a','m','_','G','o','n','d','i',0,'M','a','s','a','r','a','m','_','G','o','n','d','i',0,
-2,'N','u','s','h','u',0,'N','u','s','h','u',0,2,'S','o','y','o','m','b','o',0,'S','o','y','o','m','b','o',0,
-2,'S','y','r','i','a','c','_','S','u','p',0,'S','y','r','i','a','c','_','S','u','p','p','l','e','m','e','n','t',0,
-2,'Z','a','n','a','b','a','z','a','r','_','S','q','u','a','r','e',0,'Z','a','n','a','b','a','z','a','r','_','S','q','u','a',
-'r','e',0,2,'C','h','e','s','s','_','S','y','m','b','o','l','s',0,'C','h','e','s','s','_','S','y','m','b','o','l','s',0,
-2,'D','o','g','r','a',0,'D','o','g','r','a',0,2,'G','e','o','r','g','i','a','n','_','E','x','t',0,
-'G','e','o','r','g','i','a','n','_','E','x','t','e','n','d','e','d',0,
-2,'G','u','n','j','a','l','a','_','G','o','n','d','i',0,'G','u','n','j','a','l','a','_','G','o','n','d','i',0,
-2,'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a',0,'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a',
-0,2,'I','n','d','i','c','_','S','i','y','a','q','_','N','u','m','b','e','r','s',0,'I','n','d','i','c','_','S','i','y','a',
-'q','_','N','u','m','b','e','r','s',0,2,'M','a','k','a','s','a','r',0,'M','a','k','a','s','a','r',0,
-2,'M','a','y','a','n','_','N','u','m','e','r','a','l','s',0,'M','a','y','a','n','_','N','u','m','e','r','a','l','s',0,
-2,'M','e','d','e','f','a','i','d','r','i','n',0,'M','e','d','e','f','a','i','d','r','i','n',0,
-2,'O','l','d','_','S','o','g','d','i','a','n',0,'O','l','d','_','S','o','g','d','i','a','n',0,
-2,'S','o','g','d','i','a','n',0,'S','o','g','d','i','a','n',0,
-2,'E','g','y','p','t','i','a','n','_','H','i','e','r','o','g','l','y','p','h','_','F','o','r','m','a','t','_','C','o','n','t',
-'r','o','l','s',0,'E','g','y','p','t','i','a','n','_','H','i','e','r','o','g','l','y','p','h','_','F','o','r','m','a','t','_',
-'C','o','n','t','r','o','l','s',0,2,'E','l','y','m','a','i','c',0,'E','l','y','m','a','i','c',0,
-2,'N','a','n','d','i','n','a','g','a','r','i',0,'N','a','n','d','i','n','a','g','a','r','i',0,
-2,'N','y','i','a','k','e','n','g','_','P','u','a','c','h','u','e','_','H','m','o','n','g',0,
-'N','y','i','a','k','e','n','g','_','P','u','a','c','h','u','e','_','H','m','o','n','g',0,
-2,'O','t','t','o','m','a','n','_','S','i','y','a','q','_','N','u','m','b','e','r','s',0,'O','t','t','o','m','a','n','_','S',
-'i','y','a','q','_','N','u','m','b','e','r','s',0,2,'S','m','a','l','l','_','K','a','n','a','_','E','x','t',0,
-'S','m','a','l','l','_','K','a','n','a','_','E','x','t','e','n','s','i','o','n',0,
-2,'S','y','m','b','o','l','s','_','A','n','d','_','P','i','c','t','o','g','r','a','p','h','s','_','E','x','t','_','A',0,
-'S','y','m','b','o','l','s','_','A','n','d','_','P','i','c','t','o','g','r','a','p','h','s','_','E','x','t','e','n','d','e','d',
-'_','A',0,2,'T','a','m','i','l','_','S','u','p',0,'T','a','m','i','l','_','S','u','p','p','l','e','m','e','n','t',0,
-2,'W','a','n','c','h','o',0,'W','a','n','c','h','o',0,2,'C','h','o','r','a','s','m','i','a','n',0,
-'C','h','o','r','a','s','m','i','a','n',0,2,'C','J','K','_','E','x','t','_','G',0,'C','J','K','_','U','n','i','f','i','e',
-'d','_','I','d','e','o','g','r','a','p','h','s','_','E','x','t','e','n','s','i','o','n','_','G',0,
-2,'D','i','v','e','s','_','A','k','u','r','u',0,'D','i','v','e','s','_','A','k','u','r','u',0,
-2,'K','h','i','t','a','n','_','S','m','a','l','l','_','S','c','r','i','p','t',0,'K','h','i','t','a','n','_','S','m','a','l',
-'l','_','S','c','r','i','p','t',0,2,'L','i','s','u','_','S','u','p',0,'L','i','s','u','_','S','u','p','p','l','e','m','e',
-'n','t',0,2,'S','y','m','b','o','l','s','_','F','o','r','_','L','e','g','a','c','y','_','C','o','m','p','u','t','i','n','g',
-0,'S','y','m','b','o','l','s','_','F','o','r','_','L','e','g','a','c','y','_','C','o','m','p','u','t','i','n','g',0,
-2,'T','a','n','g','u','t','_','S','u','p',0,'T','a','n','g','u','t','_','S','u','p','p','l','e','m','e','n','t',0,
-2,'Y','e','z','i','d','i',0,'Y','e','z','i','d','i',0,2,'c','c','c',0,'C','a','n','o','n','i','c','a','l','_','C','o',
-'m','b','i','n','i','n','g','_','C','l','a','s','s',0,2,'d','t',0,'D','e','c','o','m','p','o','s','i','t','i','o','n','_',
-'T','y','p','e',0,3,'N','o','n','e',0,'N','o','n','e',0,'n','o','n','e',0,
+2,'C','J','K','_','E','x','t','_','F',0,'C','J','K','_','U','n','i','f','i','e','d','_','I','d','e','o','g','r','a','p','h',
+'s','_','E','x','t','e','n','s','i','o','n','_','F',0,2,'K','a','n','a','_','E','x','t','_','A',0,
+'K','a','n','a','_','E','x','t','e','n','d','e','d','_','A',0,
+2,'M','a','s','a','r','a','m','_','G','o','n','d','i',0,'M','a','s','a','r','a','m','_','G','o','n','d','i',0,
+2,'N','u','s','h','u',0,'N','u','s','h','u',0,2,'S','o','y','o','m','b','o',0,'S','o','y','o','m','b','o',0,
+2,'S','y','r','i','a','c','_','S','u','p',0,'S','y','r','i','a','c','_','S','u','p','p','l','e','m','e','n','t',0,
+2,'Z','a','n','a','b','a','z','a','r','_','S','q','u','a','r','e',0,'Z','a','n','a','b','a','z','a','r','_','S','q','u','a',
+'r','e',0,2,'C','h','e','s','s','_','S','y','m','b','o','l','s',0,'C','h','e','s','s','_','S','y','m','b','o','l','s',0,
+2,'D','o','g','r','a',0,'D','o','g','r','a',0,2,'G','e','o','r','g','i','a','n','_','E','x','t',0,
+'G','e','o','r','g','i','a','n','_','E','x','t','e','n','d','e','d',0,
+2,'G','u','n','j','a','l','a','_','G','o','n','d','i',0,'G','u','n','j','a','l','a','_','G','o','n','d','i',0,
+2,'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a',0,'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a',
+0,2,'I','n','d','i','c','_','S','i','y','a','q','_','N','u','m','b','e','r','s',0,'I','n','d','i','c','_','S','i','y','a',
+'q','_','N','u','m','b','e','r','s',0,2,'M','a','k','a','s','a','r',0,'M','a','k','a','s','a','r',0,
+2,'M','a','y','a','n','_','N','u','m','e','r','a','l','s',0,'M','a','y','a','n','_','N','u','m','e','r','a','l','s',0,
+2,'M','e','d','e','f','a','i','d','r','i','n',0,'M','e','d','e','f','a','i','d','r','i','n',0,
+2,'O','l','d','_','S','o','g','d','i','a','n',0,'O','l','d','_','S','o','g','d','i','a','n',0,
+2,'S','o','g','d','i','a','n',0,'S','o','g','d','i','a','n',0,
+2,'E','g','y','p','t','i','a','n','_','H','i','e','r','o','g','l','y','p','h','_','F','o','r','m','a','t','_','C','o','n','t',
+'r','o','l','s',0,'E','g','y','p','t','i','a','n','_','H','i','e','r','o','g','l','y','p','h','_','F','o','r','m','a','t','_',
+'C','o','n','t','r','o','l','s',0,2,'E','l','y','m','a','i','c',0,'E','l','y','m','a','i','c',0,
+2,'N','a','n','d','i','n','a','g','a','r','i',0,'N','a','n','d','i','n','a','g','a','r','i',0,
+2,'N','y','i','a','k','e','n','g','_','P','u','a','c','h','u','e','_','H','m','o','n','g',0,
+'N','y','i','a','k','e','n','g','_','P','u','a','c','h','u','e','_','H','m','o','n','g',0,
+2,'O','t','t','o','m','a','n','_','S','i','y','a','q','_','N','u','m','b','e','r','s',0,'O','t','t','o','m','a','n','_','S',
+'i','y','a','q','_','N','u','m','b','e','r','s',0,2,'S','m','a','l','l','_','K','a','n','a','_','E','x','t',0,
+'S','m','a','l','l','_','K','a','n','a','_','E','x','t','e','n','s','i','o','n',0,
+2,'S','y','m','b','o','l','s','_','A','n','d','_','P','i','c','t','o','g','r','a','p','h','s','_','E','x','t','_','A',0,
+'S','y','m','b','o','l','s','_','A','n','d','_','P','i','c','t','o','g','r','a','p','h','s','_','E','x','t','e','n','d','e','d',
+'_','A',0,2,'T','a','m','i','l','_','S','u','p',0,'T','a','m','i','l','_','S','u','p','p','l','e','m','e','n','t',0,
+2,'W','a','n','c','h','o',0,'W','a','n','c','h','o',0,2,'C','h','o','r','a','s','m','i','a','n',0,
+'C','h','o','r','a','s','m','i','a','n',0,2,'C','J','K','_','E','x','t','_','G',0,'C','J','K','_','U','n','i','f','i','e',
+'d','_','I','d','e','o','g','r','a','p','h','s','_','E','x','t','e','n','s','i','o','n','_','G',0,
+2,'D','i','v','e','s','_','A','k','u','r','u',0,'D','i','v','e','s','_','A','k','u','r','u',0,
+2,'K','h','i','t','a','n','_','S','m','a','l','l','_','S','c','r','i','p','t',0,'K','h','i','t','a','n','_','S','m','a','l',
+'l','_','S','c','r','i','p','t',0,2,'L','i','s','u','_','S','u','p',0,'L','i','s','u','_','S','u','p','p','l','e','m','e',
+'n','t',0,2,'S','y','m','b','o','l','s','_','F','o','r','_','L','e','g','a','c','y','_','C','o','m','p','u','t','i','n','g',
+0,'S','y','m','b','o','l','s','_','F','o','r','_','L','e','g','a','c','y','_','C','o','m','p','u','t','i','n','g',0,
+2,'T','a','n','g','u','t','_','S','u','p',0,'T','a','n','g','u','t','_','S','u','p','p','l','e','m','e','n','t',0,
+2,'Y','e','z','i','d','i',0,'Y','e','z','i','d','i',0,2,'c','c','c',0,'C','a','n','o','n','i','c','a','l','_','C','o',
+'m','b','i','n','i','n','g','_','C','l','a','s','s',0,2,'d','t',0,'D','e','c','o','m','p','o','s','i','t','i','o','n','_',
+'T','y','p','e',0,3,'N','o','n','e',0,'N','o','n','e',0,'n','o','n','e',0,
3,'C','a','n',0,'C','a','n','o','n','i','c','a','l',0,'c','a','n',0,
3,'C','o','m',0,'C','o','m','p','a','t',0,'c','o','m',0,
3,'E','n','c',0,'C','i','r','c','l','e',0,'e','n','c',0,
@@ -1630,21 +1630,21 @@ const char PropNameData::nameGroups[22098]={
2,'A','f','r','i','c','a','n','_','F','e','h',0,'A','f','r','i','c','a','n','_','F','e','h',0,
2,'A','f','r','i','c','a','n','_','N','o','o','n',0,'A','f','r','i','c','a','n','_','N','o','o','n',0,
2,'A','f','r','i','c','a','n','_','Q','a','f',0,'A','f','r','i','c','a','n','_','Q','a','f',0,
-2,'M','a','l','a','y','a','l','a','m','_','B','h','a',0,'M','a','l','a','y','a','l','a','m','_','B','h','a',0,
-2,'M','a','l','a','y','a','l','a','m','_','J','a',0,'M','a','l','a','y','a','l','a','m','_','J','a',0,
-2,'M','a','l','a','y','a','l','a','m','_','L','l','a',0,'M','a','l','a','y','a','l','a','m','_','L','l','a',0,
-2,'M','a','l','a','y','a','l','a','m','_','L','l','l','a',0,'M','a','l','a','y','a','l','a','m','_','L','l','l','a',0,
-2,'M','a','l','a','y','a','l','a','m','_','N','g','a',0,'M','a','l','a','y','a','l','a','m','_','N','g','a',0,
-2,'M','a','l','a','y','a','l','a','m','_','N','n','a',0,'M','a','l','a','y','a','l','a','m','_','N','n','a',0,
-2,'M','a','l','a','y','a','l','a','m','_','N','n','n','a',0,'M','a','l','a','y','a','l','a','m','_','N','n','n','a',0,
-2,'M','a','l','a','y','a','l','a','m','_','N','y','a',0,'M','a','l','a','y','a','l','a','m','_','N','y','a',0,
-2,'M','a','l','a','y','a','l','a','m','_','R','a',0,'M','a','l','a','y','a','l','a','m','_','R','a',0,
-2,'M','a','l','a','y','a','l','a','m','_','S','s','a',0,'M','a','l','a','y','a','l','a','m','_','S','s','a',0,
-2,'M','a','l','a','y','a','l','a','m','_','T','t','a',0,'M','a','l','a','y','a','l','a','m','_','T','t','a',0,
-2,'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a','_','K','i','n','n','a','_','Y','a',0,
-'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a','_','K','i','n','n','a','_','Y','a',0,
-2,'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a','_','P','a',0,'H','a','n','i','f','i','_','R','o','h','i','n',
-'g','y','a','_','P','a',0,2,'j','t',0,'J','o','i','n','i','n','g','_','T','y','p','e',0,
+2,'M','a','l','a','y','a','l','a','m','_','B','h','a',0,'M','a','l','a','y','a','l','a','m','_','B','h','a',0,
+2,'M','a','l','a','y','a','l','a','m','_','J','a',0,'M','a','l','a','y','a','l','a','m','_','J','a',0,
+2,'M','a','l','a','y','a','l','a','m','_','L','l','a',0,'M','a','l','a','y','a','l','a','m','_','L','l','a',0,
+2,'M','a','l','a','y','a','l','a','m','_','L','l','l','a',0,'M','a','l','a','y','a','l','a','m','_','L','l','l','a',0,
+2,'M','a','l','a','y','a','l','a','m','_','N','g','a',0,'M','a','l','a','y','a','l','a','m','_','N','g','a',0,
+2,'M','a','l','a','y','a','l','a','m','_','N','n','a',0,'M','a','l','a','y','a','l','a','m','_','N','n','a',0,
+2,'M','a','l','a','y','a','l','a','m','_','N','n','n','a',0,'M','a','l','a','y','a','l','a','m','_','N','n','n','a',0,
+2,'M','a','l','a','y','a','l','a','m','_','N','y','a',0,'M','a','l','a','y','a','l','a','m','_','N','y','a',0,
+2,'M','a','l','a','y','a','l','a','m','_','R','a',0,'M','a','l','a','y','a','l','a','m','_','R','a',0,
+2,'M','a','l','a','y','a','l','a','m','_','S','s','a',0,'M','a','l','a','y','a','l','a','m','_','S','s','a',0,
+2,'M','a','l','a','y','a','l','a','m','_','T','t','a',0,'M','a','l','a','y','a','l','a','m','_','T','t','a',0,
+2,'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a','_','K','i','n','n','a','_','Y','a',0,
+'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a','_','K','i','n','n','a','_','Y','a',0,
+2,'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a','_','P','a',0,'H','a','n','i','f','i','_','R','o','h','i','n',
+'g','y','a','_','P','a',0,2,'j','t',0,'J','o','i','n','i','n','g','_','T','y','p','e',0,
2,'U',0,'N','o','n','_','J','o','i','n','i','n','g',0,2,'C',0,'J','o','i','n','_','C','a','u','s','i','n','g',0,
2,'D',0,'D','u','a','l','_','J','o','i','n','i','n','g',0,
2,'L',0,'L','e','f','t','_','J','o','i','n','i','n','g',0,
@@ -1770,7 +1770,7 @@ const char PropNameData::nameGroups[22098]={
2,'S','i','n','d',0,'K','h','u','d','a','w','a','d','i',0,
2,'W','a','r','a',0,'W','a','r','a','n','g','_','C','i','t','i',0,
2,'A','f','a','k',0,'A','f','a','k',0,2,'J','u','r','c',0,'J','u','r','c',0,
-2,'M','r','o','o',0,'M','r','o',0,2,'N','s','h','u',0,'N','u','s','h','u',0,
+2,'M','r','o','o',0,'M','r','o',0,2,'N','s','h','u',0,'N','u','s','h','u',0,
2,'S','h','r','d',0,'S','h','a','r','a','d','a',0,2,'S','o','r','a',0,'S','o','r','a','_','S','o','m','p','e','n','g',
0,2,'T','a','k','r',0,'T','a','k','r','i',0,2,'T','a','n','g',0,'T','a','n','g','u','t',0,
2,'W','o','l','e',0,'W','o','l','e',0,2,'H','l','u','w',0,'A','n','a','t','o','l','i','a','n','_','H','i','e','r','o',
@@ -1783,20 +1783,20 @@ const char PropNameData::nameGroups[22098]={
2,'B','h','k','s',0,'B','h','a','i','k','s','u','k','i',0,
2,'M','a','r','c',0,'M','a','r','c','h','e','n',0,2,'O','s','g','e',0,'O','s','a','g','e',0,
2,'H','a','n','b',0,'H','a','n','b',0,2,'J','a','m','o',0,'J','a','m','o',0,
-2,'Z','s','y','e',0,'Z','s','y','e',0,2,'G','o','n','m',0,'M','a','s','a','r','a','m','_','G','o','n','d','i',0,
-2,'S','o','y','o',0,'S','o','y','o','m','b','o',0,2,'Z','a','n','b',0,'Z','a','n','a','b','a','z','a','r','_','S','q',
-'u','a','r','e',0,2,'D','o','g','r',0,'D','o','g','r','a',0,
-2,'G','o','n','g',0,'G','u','n','j','a','l','a','_','G','o','n','d','i',0,
-2,'M','a','k','a',0,'M','a','k','a','s','a','r',0,2,'M','e','d','f',0,'M','e','d','e','f','a','i','d','r','i','n',0,
-2,'R','o','h','g',0,'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a',0,
-2,'S','o','g','d',0,'S','o','g','d','i','a','n',0,2,'S','o','g','o',0,'O','l','d','_','S','o','g','d','i','a','n',0,
-2,'E','l','y','m',0,'E','l','y','m','a','i','c',0,2,'H','m','n','p',0,'N','y','i','a','k','e','n','g','_','P','u','a',
-'c','h','u','e','_','H','m','o','n','g',0,2,'N','a','n','d',0,'N','a','n','d','i','n','a','g','a','r','i',0,
-2,'W','c','h','o',0,'W','a','n','c','h','o',0,2,'C','h','r','s',0,'C','h','o','r','a','s','m','i','a','n',0,
-2,'D','i','a','k',0,'D','i','v','e','s','_','A','k','u','r','u',0,
-2,'K','i','t','s',0,'K','h','i','t','a','n','_','S','m','a','l','l','_','S','c','r','i','p','t',0,
-2,'Y','e','z','i',0,'Y','e','z','i','d','i',0,2,'h','s','t',0,'H','a','n','g','u','l','_','S','y','l','l','a','b','l',
-'e','_','T','y','p','e',0,2,'N','A',0,'N','o','t','_','A','p','p','l','i','c','a','b','l','e',0,
+2,'Z','s','y','e',0,'Z','s','y','e',0,2,'G','o','n','m',0,'M','a','s','a','r','a','m','_','G','o','n','d','i',0,
+2,'S','o','y','o',0,'S','o','y','o','m','b','o',0,2,'Z','a','n','b',0,'Z','a','n','a','b','a','z','a','r','_','S','q',
+'u','a','r','e',0,2,'D','o','g','r',0,'D','o','g','r','a',0,
+2,'G','o','n','g',0,'G','u','n','j','a','l','a','_','G','o','n','d','i',0,
+2,'M','a','k','a',0,'M','a','k','a','s','a','r',0,2,'M','e','d','f',0,'M','e','d','e','f','a','i','d','r','i','n',0,
+2,'R','o','h','g',0,'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a',0,
+2,'S','o','g','d',0,'S','o','g','d','i','a','n',0,2,'S','o','g','o',0,'O','l','d','_','S','o','g','d','i','a','n',0,
+2,'E','l','y','m',0,'E','l','y','m','a','i','c',0,2,'H','m','n','p',0,'N','y','i','a','k','e','n','g','_','P','u','a',
+'c','h','u','e','_','H','m','o','n','g',0,2,'N','a','n','d',0,'N','a','n','d','i','n','a','g','a','r','i',0,
+2,'W','c','h','o',0,'W','a','n','c','h','o',0,2,'C','h','r','s',0,'C','h','o','r','a','s','m','i','a','n',0,
+2,'D','i','a','k',0,'D','i','v','e','s','_','A','k','u','r','u',0,
+2,'K','i','t','s',0,'K','h','i','t','a','n','_','S','m','a','l','l','_','S','c','r','i','p','t',0,
+2,'Y','e','z','i',0,'Y','e','z','i','d','i',0,2,'h','s','t',0,'H','a','n','g','u','l','_','S','y','l','l','a','b','l',
+'e','_','T','y','p','e',0,2,'N','A',0,'N','o','t','_','A','p','p','l','i','c','a','b','l','e',0,
2,'L',0,'L','e','a','d','i','n','g','_','J','a','m','o',0,
2,'V',0,'V','o','w','e','l','_','J','a','m','o',0,2,'T',0,'T','r','a','i','l','i','n','g','_','J','a','m','o',0,
2,'L','V',0,'L','V','_','S','y','l','l','a','b','l','e',0,
@@ -1827,73 +1827,73 @@ const char PropNameData::nameGroups[22098]={
2,'E','x','t','e','n','d',0,'E','x','t','e','n','d',0,2,'M','B',0,'M','i','d','N','u','m','L','e','t',0,
2,'N','L',0,'N','e','w','l','i','n','e',0,2,'S','Q',0,'S','i','n','g','l','e','_','Q','u','o','t','e',0,
2,'D','Q',0,'D','o','u','b','l','e','_','Q','u','o','t','e',0,
-2,'W','S','e','g','S','p','a','c','e',0,'W','S','e','g','S','p','a','c','e',0,
+2,'W','S','e','g','S','p','a','c','e',0,'W','S','e','g','S','p','a','c','e',0,
2,'b','p','t',0,'B','i','d','i','_','P','a','i','r','e','d','_','B','r','a','c','k','e','t','_','T','y','p','e',0,
2,'n',0,'N','o','n','e',0,2,'o',0,'O','p','e','n',0,
-2,'c',0,'C','l','o','s','e',0,2,'I','n','P','C',0,'I','n','d','i','c','_','P','o','s','i','t','i','o','n','a','l','_',
-'C','a','t','e','g','o','r','y',0,2,'N','A',0,'N','A',0,
-2,'B','o','t','t','o','m',0,'B','o','t','t','o','m',0,2,'B','o','t','t','o','m','_','A','n','d','_','L','e','f','t',0,
-'B','o','t','t','o','m','_','A','n','d','_','L','e','f','t',0,
-2,'B','o','t','t','o','m','_','A','n','d','_','R','i','g','h','t',0,'B','o','t','t','o','m','_','A','n','d','_','R','i','g',
-'h','t',0,2,'L','e','f','t',0,'L','e','f','t',0,2,'L','e','f','t','_','A','n','d','_','R','i','g','h','t',0,
-'L','e','f','t','_','A','n','d','_','R','i','g','h','t',0,2,'O','v','e','r','s','t','r','u','c','k',0,
-'O','v','e','r','s','t','r','u','c','k',0,2,'R','i','g','h','t',0,'R','i','g','h','t',0,
-2,'T','o','p',0,'T','o','p',0,2,'T','o','p','_','A','n','d','_','B','o','t','t','o','m',0,
-'T','o','p','_','A','n','d','_','B','o','t','t','o','m',0,2,'T','o','p','_','A','n','d','_','B','o','t','t','o','m','_','A',
-'n','d','_','R','i','g','h','t',0,'T','o','p','_','A','n','d','_','B','o','t','t','o','m','_','A','n','d','_','R','i','g','h',
-'t',0,2,'T','o','p','_','A','n','d','_','L','e','f','t',0,'T','o','p','_','A','n','d','_','L','e','f','t',0,
-2,'T','o','p','_','A','n','d','_','L','e','f','t','_','A','n','d','_','R','i','g','h','t',0,
-'T','o','p','_','A','n','d','_','L','e','f','t','_','A','n','d','_','R','i','g','h','t',0,
-2,'T','o','p','_','A','n','d','_','R','i','g','h','t',0,'T','o','p','_','A','n','d','_','R','i','g','h','t',0,
-2,'V','i','s','u','a','l','_','O','r','d','e','r','_','L','e','f','t',0,'V','i','s','u','a','l','_','O','r','d','e','r','_',
-'L','e','f','t',0,2,'T','o','p','_','A','n','d','_','B','o','t','t','o','m','_','A','n','d','_','L','e','f','t',0,
-'T','o','p','_','A','n','d','_','B','o','t','t','o','m','_','A','n','d','_','L','e','f','t',0,
-2,'I','n','S','C',0,'I','n','d','i','c','_','S','y','l','l','a','b','i','c','_','C','a','t','e','g','o','r','y',0,
-2,'O','t','h','e','r',0,'O','t','h','e','r',0,2,'A','v','a','g','r','a','h','a',0,'A','v','a','g','r','a','h','a',0,
-2,'B','i','n','d','u',0,'B','i','n','d','u',0,2,'B','r','a','h','m','i','_','J','o','i','n','i','n','g','_','N','u','m',
-'b','e','r',0,'B','r','a','h','m','i','_','J','o','i','n','i','n','g','_','N','u','m','b','e','r',0,
-2,'C','a','n','t','i','l','l','a','t','i','o','n','_','M','a','r','k',0,'C','a','n','t','i','l','l','a','t','i','o','n','_',
-'M','a','r','k',0,2,'C','o','n','s','o','n','a','n','t',0,'C','o','n','s','o','n','a','n','t',0,
-2,'C','o','n','s','o','n','a','n','t','_','D','e','a','d',0,'C','o','n','s','o','n','a','n','t','_','D','e','a','d',0,
-2,'C','o','n','s','o','n','a','n','t','_','F','i','n','a','l',0,'C','o','n','s','o','n','a','n','t','_','F','i','n','a','l',
-0,2,'C','o','n','s','o','n','a','n','t','_','H','e','a','d','_','L','e','t','t','e','r',0,
-'C','o','n','s','o','n','a','n','t','_','H','e','a','d','_','L','e','t','t','e','r',0,
-2,'C','o','n','s','o','n','a','n','t','_','I','n','i','t','i','a','l','_','P','o','s','t','f','i','x','e','d',0,
-'C','o','n','s','o','n','a','n','t','_','I','n','i','t','i','a','l','_','P','o','s','t','f','i','x','e','d',0,
-2,'C','o','n','s','o','n','a','n','t','_','K','i','l','l','e','r',0,'C','o','n','s','o','n','a','n','t','_','K','i','l','l',
-'e','r',0,2,'C','o','n','s','o','n','a','n','t','_','M','e','d','i','a','l',0,'C','o','n','s','o','n','a','n','t','_','M',
-'e','d','i','a','l',0,2,'C','o','n','s','o','n','a','n','t','_','P','l','a','c','e','h','o','l','d','e','r',0,
-'C','o','n','s','o','n','a','n','t','_','P','l','a','c','e','h','o','l','d','e','r',0,
-2,'C','o','n','s','o','n','a','n','t','_','P','r','e','c','e','d','i','n','g','_','R','e','p','h','a',0,
-'C','o','n','s','o','n','a','n','t','_','P','r','e','c','e','d','i','n','g','_','R','e','p','h','a',0,
-2,'C','o','n','s','o','n','a','n','t','_','P','r','e','f','i','x','e','d',0,'C','o','n','s','o','n','a','n','t','_','P','r',
-'e','f','i','x','e','d',0,2,'C','o','n','s','o','n','a','n','t','_','S','u','b','j','o','i','n','e','d',0,
-'C','o','n','s','o','n','a','n','t','_','S','u','b','j','o','i','n','e','d',0,
-2,'C','o','n','s','o','n','a','n','t','_','S','u','c','c','e','e','d','i','n','g','_','R','e','p','h','a',0,
-'C','o','n','s','o','n','a','n','t','_','S','u','c','c','e','e','d','i','n','g','_','R','e','p','h','a',0,
-2,'C','o','n','s','o','n','a','n','t','_','W','i','t','h','_','S','t','a','c','k','e','r',0,
-'C','o','n','s','o','n','a','n','t','_','W','i','t','h','_','S','t','a','c','k','e','r',0,
-2,'G','e','m','i','n','a','t','i','o','n','_','M','a','r','k',0,'G','e','m','i','n','a','t','i','o','n','_','M','a','r','k',
-0,2,'I','n','v','i','s','i','b','l','e','_','S','t','a','c','k','e','r',0,'I','n','v','i','s','i','b','l','e','_','S','t',
-'a','c','k','e','r',0,2,'J','o','i','n','e','r',0,'J','o','i','n','e','r',0,
-2,'M','o','d','i','f','y','i','n','g','_','L','e','t','t','e','r',0,'M','o','d','i','f','y','i','n','g','_','L','e','t','t',
-'e','r',0,2,'N','o','n','_','J','o','i','n','e','r',0,'N','o','n','_','J','o','i','n','e','r',0,
-2,'N','u','k','t','a',0,'N','u','k','t','a',0,2,'N','u','m','b','e','r',0,'N','u','m','b','e','r',0,
-2,'N','u','m','b','e','r','_','J','o','i','n','e','r',0,'N','u','m','b','e','r','_','J','o','i','n','e','r',0,
-2,'P','u','r','e','_','K','i','l','l','e','r',0,'P','u','r','e','_','K','i','l','l','e','r',0,
-2,'R','e','g','i','s','t','e','r','_','S','h','i','f','t','e','r',0,'R','e','g','i','s','t','e','r','_','S','h','i','f','t',
-'e','r',0,2,'S','y','l','l','a','b','l','e','_','M','o','d','i','f','i','e','r',0,'S','y','l','l','a','b','l','e','_','M',
-'o','d','i','f','i','e','r',0,2,'T','o','n','e','_','L','e','t','t','e','r',0,'T','o','n','e','_','L','e','t','t','e','r',
-0,2,'T','o','n','e','_','M','a','r','k',0,'T','o','n','e','_','M','a','r','k',0,
-2,'V','i','r','a','m','a',0,'V','i','r','a','m','a',0,2,'V','i','s','a','r','g','a',0,
-'V','i','s','a','r','g','a',0,2,'V','o','w','e','l',0,'V','o','w','e','l',0,
-2,'V','o','w','e','l','_','D','e','p','e','n','d','e','n','t',0,'V','o','w','e','l','_','D','e','p','e','n','d','e','n','t',
-0,2,'V','o','w','e','l','_','I','n','d','e','p','e','n','d','e','n','t',0,'V','o','w','e','l','_','I','n','d','e','p','e',
-'n','d','e','n','t',0,2,'v','o',0,'V','e','r','t','i','c','a','l','_','O','r','i','e','n','t','a','t','i','o','n',0,
-2,'R',0,'R','o','t','a','t','e','d',0,2,'T','r',0,'T','r','a','n','s','f','o','r','m','e','d','_','R','o','t','a','t',
-'e','d',0,2,'T','u',0,'T','r','a','n','s','f','o','r','m','e','d','_','U','p','r','i','g','h','t',0,
-2,'U',0,'U','p','r','i','g','h','t',0,2,'g','c','m',0,'G','e','n','e','r','a','l','_','C','a','t','e','g','o','r','y',
-'_','M','a','s','k',0,2,'C',0,'O','t','h','e','r',0,2,'L',0,'L','e','t','t','e','r',0,
+2,'c',0,'C','l','o','s','e',0,2,'I','n','P','C',0,'I','n','d','i','c','_','P','o','s','i','t','i','o','n','a','l','_',
+'C','a','t','e','g','o','r','y',0,2,'N','A',0,'N','A',0,
+2,'B','o','t','t','o','m',0,'B','o','t','t','o','m',0,2,'B','o','t','t','o','m','_','A','n','d','_','L','e','f','t',0,
+'B','o','t','t','o','m','_','A','n','d','_','L','e','f','t',0,
+2,'B','o','t','t','o','m','_','A','n','d','_','R','i','g','h','t',0,'B','o','t','t','o','m','_','A','n','d','_','R','i','g',
+'h','t',0,2,'L','e','f','t',0,'L','e','f','t',0,2,'L','e','f','t','_','A','n','d','_','R','i','g','h','t',0,
+'L','e','f','t','_','A','n','d','_','R','i','g','h','t',0,2,'O','v','e','r','s','t','r','u','c','k',0,
+'O','v','e','r','s','t','r','u','c','k',0,2,'R','i','g','h','t',0,'R','i','g','h','t',0,
+2,'T','o','p',0,'T','o','p',0,2,'T','o','p','_','A','n','d','_','B','o','t','t','o','m',0,
+'T','o','p','_','A','n','d','_','B','o','t','t','o','m',0,2,'T','o','p','_','A','n','d','_','B','o','t','t','o','m','_','A',
+'n','d','_','R','i','g','h','t',0,'T','o','p','_','A','n','d','_','B','o','t','t','o','m','_','A','n','d','_','R','i','g','h',
+'t',0,2,'T','o','p','_','A','n','d','_','L','e','f','t',0,'T','o','p','_','A','n','d','_','L','e','f','t',0,
+2,'T','o','p','_','A','n','d','_','L','e','f','t','_','A','n','d','_','R','i','g','h','t',0,
+'T','o','p','_','A','n','d','_','L','e','f','t','_','A','n','d','_','R','i','g','h','t',0,
+2,'T','o','p','_','A','n','d','_','R','i','g','h','t',0,'T','o','p','_','A','n','d','_','R','i','g','h','t',0,
+2,'V','i','s','u','a','l','_','O','r','d','e','r','_','L','e','f','t',0,'V','i','s','u','a','l','_','O','r','d','e','r','_',
+'L','e','f','t',0,2,'T','o','p','_','A','n','d','_','B','o','t','t','o','m','_','A','n','d','_','L','e','f','t',0,
+'T','o','p','_','A','n','d','_','B','o','t','t','o','m','_','A','n','d','_','L','e','f','t',0,
+2,'I','n','S','C',0,'I','n','d','i','c','_','S','y','l','l','a','b','i','c','_','C','a','t','e','g','o','r','y',0,
+2,'O','t','h','e','r',0,'O','t','h','e','r',0,2,'A','v','a','g','r','a','h','a',0,'A','v','a','g','r','a','h','a',0,
+2,'B','i','n','d','u',0,'B','i','n','d','u',0,2,'B','r','a','h','m','i','_','J','o','i','n','i','n','g','_','N','u','m',
+'b','e','r',0,'B','r','a','h','m','i','_','J','o','i','n','i','n','g','_','N','u','m','b','e','r',0,
+2,'C','a','n','t','i','l','l','a','t','i','o','n','_','M','a','r','k',0,'C','a','n','t','i','l','l','a','t','i','o','n','_',
+'M','a','r','k',0,2,'C','o','n','s','o','n','a','n','t',0,'C','o','n','s','o','n','a','n','t',0,
+2,'C','o','n','s','o','n','a','n','t','_','D','e','a','d',0,'C','o','n','s','o','n','a','n','t','_','D','e','a','d',0,
+2,'C','o','n','s','o','n','a','n','t','_','F','i','n','a','l',0,'C','o','n','s','o','n','a','n','t','_','F','i','n','a','l',
+0,2,'C','o','n','s','o','n','a','n','t','_','H','e','a','d','_','L','e','t','t','e','r',0,
+'C','o','n','s','o','n','a','n','t','_','H','e','a','d','_','L','e','t','t','e','r',0,
+2,'C','o','n','s','o','n','a','n','t','_','I','n','i','t','i','a','l','_','P','o','s','t','f','i','x','e','d',0,
+'C','o','n','s','o','n','a','n','t','_','I','n','i','t','i','a','l','_','P','o','s','t','f','i','x','e','d',0,
+2,'C','o','n','s','o','n','a','n','t','_','K','i','l','l','e','r',0,'C','o','n','s','o','n','a','n','t','_','K','i','l','l',
+'e','r',0,2,'C','o','n','s','o','n','a','n','t','_','M','e','d','i','a','l',0,'C','o','n','s','o','n','a','n','t','_','M',
+'e','d','i','a','l',0,2,'C','o','n','s','o','n','a','n','t','_','P','l','a','c','e','h','o','l','d','e','r',0,
+'C','o','n','s','o','n','a','n','t','_','P','l','a','c','e','h','o','l','d','e','r',0,
+2,'C','o','n','s','o','n','a','n','t','_','P','r','e','c','e','d','i','n','g','_','R','e','p','h','a',0,
+'C','o','n','s','o','n','a','n','t','_','P','r','e','c','e','d','i','n','g','_','R','e','p','h','a',0,
+2,'C','o','n','s','o','n','a','n','t','_','P','r','e','f','i','x','e','d',0,'C','o','n','s','o','n','a','n','t','_','P','r',
+'e','f','i','x','e','d',0,2,'C','o','n','s','o','n','a','n','t','_','S','u','b','j','o','i','n','e','d',0,
+'C','o','n','s','o','n','a','n','t','_','S','u','b','j','o','i','n','e','d',0,
+2,'C','o','n','s','o','n','a','n','t','_','S','u','c','c','e','e','d','i','n','g','_','R','e','p','h','a',0,
+'C','o','n','s','o','n','a','n','t','_','S','u','c','c','e','e','d','i','n','g','_','R','e','p','h','a',0,
+2,'C','o','n','s','o','n','a','n','t','_','W','i','t','h','_','S','t','a','c','k','e','r',0,
+'C','o','n','s','o','n','a','n','t','_','W','i','t','h','_','S','t','a','c','k','e','r',0,
+2,'G','e','m','i','n','a','t','i','o','n','_','M','a','r','k',0,'G','e','m','i','n','a','t','i','o','n','_','M','a','r','k',
+0,2,'I','n','v','i','s','i','b','l','e','_','S','t','a','c','k','e','r',0,'I','n','v','i','s','i','b','l','e','_','S','t',
+'a','c','k','e','r',0,2,'J','o','i','n','e','r',0,'J','o','i','n','e','r',0,
+2,'M','o','d','i','f','y','i','n','g','_','L','e','t','t','e','r',0,'M','o','d','i','f','y','i','n','g','_','L','e','t','t',
+'e','r',0,2,'N','o','n','_','J','o','i','n','e','r',0,'N','o','n','_','J','o','i','n','e','r',0,
+2,'N','u','k','t','a',0,'N','u','k','t','a',0,2,'N','u','m','b','e','r',0,'N','u','m','b','e','r',0,
+2,'N','u','m','b','e','r','_','J','o','i','n','e','r',0,'N','u','m','b','e','r','_','J','o','i','n','e','r',0,
+2,'P','u','r','e','_','K','i','l','l','e','r',0,'P','u','r','e','_','K','i','l','l','e','r',0,
+2,'R','e','g','i','s','t','e','r','_','S','h','i','f','t','e','r',0,'R','e','g','i','s','t','e','r','_','S','h','i','f','t',
+'e','r',0,2,'S','y','l','l','a','b','l','e','_','M','o','d','i','f','i','e','r',0,'S','y','l','l','a','b','l','e','_','M',
+'o','d','i','f','i','e','r',0,2,'T','o','n','e','_','L','e','t','t','e','r',0,'T','o','n','e','_','L','e','t','t','e','r',
+0,2,'T','o','n','e','_','M','a','r','k',0,'T','o','n','e','_','M','a','r','k',0,
+2,'V','i','r','a','m','a',0,'V','i','r','a','m','a',0,2,'V','i','s','a','r','g','a',0,
+'V','i','s','a','r','g','a',0,2,'V','o','w','e','l',0,'V','o','w','e','l',0,
+2,'V','o','w','e','l','_','D','e','p','e','n','d','e','n','t',0,'V','o','w','e','l','_','D','e','p','e','n','d','e','n','t',
+0,2,'V','o','w','e','l','_','I','n','d','e','p','e','n','d','e','n','t',0,'V','o','w','e','l','_','I','n','d','e','p','e',
+'n','d','e','n','t',0,2,'v','o',0,'V','e','r','t','i','c','a','l','_','O','r','i','e','n','t','a','t','i','o','n',0,
+2,'R',0,'R','o','t','a','t','e','d',0,2,'T','r',0,'T','r','a','n','s','f','o','r','m','e','d','_','R','o','t','a','t',
+'e','d',0,2,'T','u',0,'T','r','a','n','s','f','o','r','m','e','d','_','U','p','r','i','g','h','t',0,
+2,'U',0,'U','p','r','i','g','h','t',0,2,'g','c','m',0,'G','e','n','e','r','a','l','_','C','a','t','e','g','o','r','y',
+'_','M','a','s','k',0,2,'C',0,'O','t','h','e','r',0,2,'L',0,'L','e','t','t','e','r',0,
2,'L','C',0,'C','a','s','e','d','_','L','e','t','t','e','r',0,
3,'M',0,'M','a','r','k',0,'C','o','m','b','i','n','i','n','g','_','M','a','r','k',0,
2,'N',0,'N','u','m','b','e','r',0,3,'P',0,'P','u','n','c','t','u','a','t','i','o','n',0,
diff --git a/contrib/libs/icu/common/propsvec.cpp b/contrib/libs/icu/common/propsvec.cpp
index ff0010eea5..056fcda9cf 100644
--- a/contrib/libs/icu/common/propsvec.cpp
+++ b/contrib/libs/icu/common/propsvec.cpp
@@ -1,529 +1,529 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-*******************************************************************************
-*
-* Copyright (C) 2002-2011, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-*******************************************************************************
-* file name: propsvec.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 2002feb22
-* created by: Markus W. Scherer
-*
-* Store bits (Unicode character properties) in bit set vectors.
-*/
-
-#include <stdlib.h>
-#include "unicode/utypes.h"
-#include "cmemory.h"
-#include "utrie.h"
-#include "utrie2.h"
-#include "uarrsort.h"
-#include "propsvec.h"
-#include "uassert.h"
-
-struct UPropsVectors {
- uint32_t *v;
- int32_t columns; /* number of columns, plus two for start & limit values */
- int32_t maxRows;
- int32_t rows;
- int32_t prevRow; /* search optimization: remember last row seen */
- UBool isCompacted;
-};
-
-#define UPVEC_INITIAL_ROWS (1<<12)
-#define UPVEC_MEDIUM_ROWS ((int32_t)1<<16)
-#define UPVEC_MAX_ROWS (UPVEC_MAX_CP+1)
-
-U_CAPI UPropsVectors * U_EXPORT2
-upvec_open(int32_t columns, UErrorCode *pErrorCode) {
- UPropsVectors *pv;
- uint32_t *v, *row;
- uint32_t cp;
-
- if(U_FAILURE(*pErrorCode)) {
- return NULL;
- }
- if(columns<1) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
- }
- columns+=2; /* count range start and limit columns */
-
- pv=(UPropsVectors *)uprv_malloc(sizeof(UPropsVectors));
- v=(uint32_t *)uprv_malloc(UPVEC_INITIAL_ROWS*columns*4);
- if(pv==NULL || v==NULL) {
- uprv_free(pv);
- uprv_free(v);
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
- uprv_memset(pv, 0, sizeof(UPropsVectors));
- pv->v=v;
- pv->columns=columns;
- pv->maxRows=UPVEC_INITIAL_ROWS;
- pv->rows=2+(UPVEC_MAX_CP-UPVEC_FIRST_SPECIAL_CP);
-
- /* set the all-Unicode row and the special-value rows */
- row=pv->v;
- uprv_memset(row, 0, pv->rows*columns*4);
- row[0]=0;
- row[1]=0x110000;
- row+=columns;
- for(cp=UPVEC_FIRST_SPECIAL_CP; cp<=UPVEC_MAX_CP; ++cp) {
- row[0]=cp;
- row[1]=cp+1;
- row+=columns;
- }
- return pv;
-}
-
-U_CAPI void U_EXPORT2
-upvec_close(UPropsVectors *pv) {
- if(pv!=NULL) {
- uprv_free(pv->v);
- uprv_free(pv);
- }
-}
-
-static uint32_t *
-_findRow(UPropsVectors *pv, UChar32 rangeStart) {
- uint32_t *row;
- int32_t columns, i, start, limit, prevRow;
-
- columns=pv->columns;
- limit=pv->rows;
- prevRow=pv->prevRow;
-
- /* check the vicinity of the last-seen row (start searching with an unrolled loop) */
- row=pv->v+prevRow*columns;
- if(rangeStart>=(UChar32)row[0]) {
- if(rangeStart<(UChar32)row[1]) {
- /* same row as last seen */
- return row;
- } else if(rangeStart<(UChar32)(row+=columns)[1]) {
- /* next row after the last one */
- pv->prevRow=prevRow+1;
- return row;
- } else if(rangeStart<(UChar32)(row+=columns)[1]) {
- /* second row after the last one */
- pv->prevRow=prevRow+2;
- return row;
- } else if((rangeStart-(UChar32)row[1])<10) {
- /* we are close, continue looping */
- prevRow+=2;
- do {
- ++prevRow;
- row+=columns;
- } while(rangeStart>=(UChar32)row[1]);
- pv->prevRow=prevRow;
- return row;
- }
- } else if(rangeStart<(UChar32)pv->v[1]) {
- /* the very first row */
- pv->prevRow=0;
- return pv->v;
- }
-
- /* do a binary search for the start of the range */
- start=0;
- while(start<limit-1) {
- i=(start+limit)/2;
- row=pv->v+i*columns;
- if(rangeStart<(UChar32)row[0]) {
- limit=i;
- } else if(rangeStart<(UChar32)row[1]) {
- pv->prevRow=i;
- return row;
- } else {
- start=i;
- }
- }
-
- /* must be found because all ranges together always cover all of Unicode */
- pv->prevRow=start;
- return pv->v+start*columns;
-}
-
-U_CAPI void U_EXPORT2
-upvec_setValue(UPropsVectors *pv,
- UChar32 start, UChar32 end,
- int32_t column,
- uint32_t value, uint32_t mask,
- UErrorCode *pErrorCode) {
- uint32_t *firstRow, *lastRow;
- int32_t columns;
- UChar32 limit;
- UBool splitFirstRow, splitLastRow;
-
- /* argument checking */
- if(U_FAILURE(*pErrorCode)) {
- return;
- }
- if( pv==NULL ||
- start<0 || start>end || end>UPVEC_MAX_CP ||
- column<0 || column>=(pv->columns-2)
- ) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- if(pv->isCompacted) {
- *pErrorCode=U_NO_WRITE_PERMISSION;
- return;
- }
- limit=end+1;
-
- /* initialize */
- columns=pv->columns;
- column+=2; /* skip range start and limit columns */
- value&=mask;
-
- /* find the rows whose ranges overlap with the input range */
-
- /* find the first and last rows, always successful */
- firstRow=_findRow(pv, start);
- lastRow=_findRow(pv, end);
-
- /*
- * Rows need to be split if they partially overlap with the
- * input range (only possible for the first and last rows)
- * and if their value differs from the input value.
- */
- splitFirstRow= (UBool)(start!=(UChar32)firstRow[0] && value!=(firstRow[column]&mask));
- splitLastRow= (UBool)(limit!=(UChar32)lastRow[1] && value!=(lastRow[column]&mask));
-
- /* split first/last rows if necessary */
- if(splitFirstRow || splitLastRow) {
- int32_t count, rows;
-
- rows=pv->rows;
- if((rows+splitFirstRow+splitLastRow)>pv->maxRows) {
- uint32_t *newVectors;
- int32_t newMaxRows;
-
- if(pv->maxRows<UPVEC_MEDIUM_ROWS) {
- newMaxRows=UPVEC_MEDIUM_ROWS;
- } else if(pv->maxRows<UPVEC_MAX_ROWS) {
- newMaxRows=UPVEC_MAX_ROWS;
- } else {
- /* Implementation bug, or UPVEC_MAX_ROWS too low. */
- *pErrorCode=U_INTERNAL_PROGRAM_ERROR;
- return;
- }
- newVectors=(uint32_t *)uprv_malloc(newMaxRows*columns*4);
- if(newVectors==NULL) {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- uprv_memcpy(newVectors, pv->v, (size_t)rows*columns*4);
- firstRow=newVectors+(firstRow-pv->v);
- lastRow=newVectors+(lastRow-pv->v);
- uprv_free(pv->v);
- pv->v=newVectors;
- pv->maxRows=newMaxRows;
- }
-
- /* count the number of row cells to move after the last row, and move them */
- count = (int32_t)((pv->v+rows*columns)-(lastRow+columns));
- if(count>0) {
- uprv_memmove(
- lastRow+(1+splitFirstRow+splitLastRow)*columns,
- lastRow+columns,
- count*4);
- }
- pv->rows=rows+splitFirstRow+splitLastRow;
-
- /* split the first row, and move the firstRow pointer to the second part */
- if(splitFirstRow) {
- /* copy all affected rows up one and move the lastRow pointer */
- count = (int32_t)((lastRow-firstRow)+columns);
- uprv_memmove(firstRow+columns, firstRow, (size_t)count*4);
- lastRow+=columns;
-
- /* split the range and move the firstRow pointer */
- firstRow[1]=firstRow[columns]=(uint32_t)start;
- firstRow+=columns;
- }
-
- /* split the last row */
- if(splitLastRow) {
- /* copy the last row data */
- uprv_memcpy(lastRow+columns, lastRow, (size_t)columns*4);
-
- /* split the range and move the firstRow pointer */
- lastRow[1]=lastRow[columns]=(uint32_t)limit;
- }
- }
-
- /* set the "row last seen" to the last row for the range */
- pv->prevRow=(int32_t)((lastRow-(pv->v))/columns);
-
- /* set the input value in all remaining rows */
- firstRow+=column;
- lastRow+=column;
- mask=~mask;
- for(;;) {
- *firstRow=(*firstRow&mask)|value;
- if(firstRow==lastRow) {
- break;
- }
- firstRow+=columns;
- }
-}
-
-U_CAPI uint32_t U_EXPORT2
-upvec_getValue(const UPropsVectors *pv, UChar32 c, int32_t column) {
- uint32_t *row;
- UPropsVectors *ncpv;
-
- if(pv->isCompacted || c<0 || c>UPVEC_MAX_CP || column<0 || column>=(pv->columns-2)) {
- return 0;
- }
- ncpv=(UPropsVectors *)pv;
- row=_findRow(ncpv, c);
- return row[2+column];
-}
-
-U_CAPI uint32_t * U_EXPORT2
-upvec_getRow(const UPropsVectors *pv, int32_t rowIndex,
- UChar32 *pRangeStart, UChar32 *pRangeEnd) {
- uint32_t *row;
- int32_t columns;
-
- if(pv->isCompacted || rowIndex<0 || rowIndex>=pv->rows) {
- return NULL;
- }
-
- columns=pv->columns;
- row=pv->v+rowIndex*columns;
- if(pRangeStart!=NULL) {
- *pRangeStart=(UChar32)row[0];
- }
- if(pRangeEnd!=NULL) {
- *pRangeEnd=(UChar32)row[1]-1;
- }
- return row+2;
-}
-
-static int32_t U_CALLCONV
-upvec_compareRows(const void *context, const void *l, const void *r) {
- const uint32_t *left=(const uint32_t *)l, *right=(const uint32_t *)r;
- const UPropsVectors *pv=(const UPropsVectors *)context;
- int32_t i, count, columns;
-
- count=columns=pv->columns; /* includes start/limit columns */
-
- /* start comparing after start/limit but wrap around to them */
- i=2;
- do {
- if(left[i]!=right[i]) {
- return left[i]<right[i] ? -1 : 1;
- }
- if(++i==columns) {
- i=0;
- }
- } while(--count>0);
-
- return 0;
-}
-
-U_CAPI void U_EXPORT2
-upvec_compact(UPropsVectors *pv, UPVecCompactHandler *handler, void *context, UErrorCode *pErrorCode) {
- uint32_t *row;
- int32_t i, columns, valueColumns, rows, count;
- UChar32 start, limit;
-
- /* argument checking */
- if(U_FAILURE(*pErrorCode)) {
- return;
- }
- if(handler==NULL) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- if(pv->isCompacted) {
- return;
- }
-
- /* Set the flag now: Sorting and compacting destroys the builder data structure. */
- pv->isCompacted=TRUE;
-
- rows=pv->rows;
- columns=pv->columns;
- U_ASSERT(columns>=3); /* upvec_open asserts this */
- valueColumns=columns-2; /* not counting start & limit */
-
- /* sort the properties vectors to find unique vector values */
- uprv_sortArray(pv->v, rows, columns*4,
- upvec_compareRows, pv, FALSE, pErrorCode);
- if(U_FAILURE(*pErrorCode)) {
- return;
- }
-
- /*
- * Find and set the special values.
- * This has to do almost the same work as the compaction below,
- * to find the indexes where the special-value rows will move.
- */
- row=pv->v;
- count=-valueColumns;
- for(i=0; i<rows; ++i) {
- start=(UChar32)row[0];
-
- /* count a new values vector if it is different from the current one */
- if(count<0 || 0!=uprv_memcmp(row+2, row-valueColumns, valueColumns*4)) {
- count+=valueColumns;
- }
-
- if(start>=UPVEC_FIRST_SPECIAL_CP) {
- handler(context, start, start, count, row+2, valueColumns, pErrorCode);
- if(U_FAILURE(*pErrorCode)) {
- return;
- }
- }
-
- row+=columns;
- }
-
- /* count is at the beginning of the last vector, add valueColumns to include that last vector */
- count+=valueColumns;
-
- /* Call the handler once more to signal the start of delivering real values. */
- handler(context, UPVEC_START_REAL_VALUES_CP, UPVEC_START_REAL_VALUES_CP,
- count, row-valueColumns, valueColumns, pErrorCode);
- if(U_FAILURE(*pErrorCode)) {
- return;
- }
-
- /*
- * Move vector contents up to a contiguous array with only unique
- * vector values, and call the handler function for each vector.
- *
- * This destroys the Properties Vector structure and replaces it
- * with an array of just vector values.
- */
- row=pv->v;
- count=-valueColumns;
- for(i=0; i<rows; ++i) {
- /* fetch these first before memmove() may overwrite them */
- start=(UChar32)row[0];
- limit=(UChar32)row[1];
-
- /* add a new values vector if it is different from the current one */
- if(count<0 || 0!=uprv_memcmp(row+2, pv->v+count, valueColumns*4)) {
- count+=valueColumns;
- uprv_memmove(pv->v+count, row+2, (size_t)valueColumns*4);
- }
-
- if(start<UPVEC_FIRST_SPECIAL_CP) {
- handler(context, start, limit-1, count, pv->v+count, valueColumns, pErrorCode);
- if(U_FAILURE(*pErrorCode)) {
- return;
- }
- }
-
- row+=columns;
- }
-
- /* count is at the beginning of the last vector, add one to include that last vector */
- pv->rows=count/valueColumns+1;
-}
-
-U_CAPI const uint32_t * U_EXPORT2
-upvec_getArray(const UPropsVectors *pv, int32_t *pRows, int32_t *pColumns) {
- if(!pv->isCompacted) {
- return NULL;
- }
- if(pRows!=NULL) {
- *pRows=pv->rows;
- }
- if(pColumns!=NULL) {
- *pColumns=pv->columns-2;
- }
- return pv->v;
-}
-
-U_CAPI uint32_t * U_EXPORT2
-upvec_cloneArray(const UPropsVectors *pv,
- int32_t *pRows, int32_t *pColumns, UErrorCode *pErrorCode) {
- uint32_t *clonedArray;
- int32_t byteLength;
-
- if(U_FAILURE(*pErrorCode)) {
- return NULL;
- }
- if(!pv->isCompacted) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
- }
- byteLength=pv->rows*(pv->columns-2)*4;
- clonedArray=(uint32_t *)uprv_malloc(byteLength);
- if(clonedArray==NULL) {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
- uprv_memcpy(clonedArray, pv->v, byteLength);
- if(pRows!=NULL) {
- *pRows=pv->rows;
- }
- if(pColumns!=NULL) {
- *pColumns=pv->columns-2;
- }
- return clonedArray;
-}
-
-U_CAPI UTrie2 * U_EXPORT2
-upvec_compactToUTrie2WithRowIndexes(UPropsVectors *pv, UErrorCode *pErrorCode) {
- UPVecToUTrie2Context toUTrie2={ NULL, 0, 0, 0 };
- upvec_compact(pv, upvec_compactToUTrie2Handler, &toUTrie2, pErrorCode);
- utrie2_freeze(toUTrie2.trie, UTRIE2_16_VALUE_BITS, pErrorCode);
- if(U_FAILURE(*pErrorCode)) {
- utrie2_close(toUTrie2.trie);
- toUTrie2.trie=NULL;
- }
- return toUTrie2.trie;
-}
-
-/*
- * TODO(markus): Add upvec_16BitsToUTrie2() function that enumerates all rows, extracts
- * some 16-bit field and builds and returns a UTrie2.
- */
-
-U_CAPI void U_CALLCONV
-upvec_compactToUTrie2Handler(void *context,
- UChar32 start, UChar32 end,
- int32_t rowIndex, uint32_t *row, int32_t columns,
- UErrorCode *pErrorCode) {
- (void)row;
- (void)columns;
- UPVecToUTrie2Context *toUTrie2=(UPVecToUTrie2Context *)context;
- if(start<UPVEC_FIRST_SPECIAL_CP) {
- utrie2_setRange32(toUTrie2->trie, start, end, (uint32_t)rowIndex, TRUE, pErrorCode);
- } else {
- switch(start) {
- case UPVEC_INITIAL_VALUE_CP:
- toUTrie2->initialValue=rowIndex;
- break;
- case UPVEC_ERROR_VALUE_CP:
- toUTrie2->errorValue=rowIndex;
- break;
- case UPVEC_START_REAL_VALUES_CP:
- toUTrie2->maxValue=rowIndex;
- if(rowIndex>0xffff) {
- /* too many rows for a 16-bit trie */
- *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
- } else {
- toUTrie2->trie=utrie2_open(toUTrie2->initialValue,
- toUTrie2->errorValue, pErrorCode);
- }
- break;
- default:
- break;
- }
- }
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+* Copyright (C) 2002-2011, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: propsvec.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2002feb22
+* created by: Markus W. Scherer
+*
+* Store bits (Unicode character properties) in bit set vectors.
+*/
+
+#include <stdlib.h>
+#include "unicode/utypes.h"
+#include "cmemory.h"
+#include "utrie.h"
+#include "utrie2.h"
+#include "uarrsort.h"
+#include "propsvec.h"
+#include "uassert.h"
+
+struct UPropsVectors {
+ uint32_t *v;
+ int32_t columns; /* number of columns, plus two for start & limit values */
+ int32_t maxRows;
+ int32_t rows;
+ int32_t prevRow; /* search optimization: remember last row seen */
+ UBool isCompacted;
+};
+
+#define UPVEC_INITIAL_ROWS (1<<12)
+#define UPVEC_MEDIUM_ROWS ((int32_t)1<<16)
+#define UPVEC_MAX_ROWS (UPVEC_MAX_CP+1)
+
+U_CAPI UPropsVectors * U_EXPORT2
+upvec_open(int32_t columns, UErrorCode *pErrorCode) {
+ UPropsVectors *pv;
+ uint32_t *v, *row;
+ uint32_t cp;
+
+ if(U_FAILURE(*pErrorCode)) {
+ return NULL;
+ }
+ if(columns<1) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
+ }
+ columns+=2; /* count range start and limit columns */
+
+ pv=(UPropsVectors *)uprv_malloc(sizeof(UPropsVectors));
+ v=(uint32_t *)uprv_malloc(UPVEC_INITIAL_ROWS*columns*4);
+ if(pv==NULL || v==NULL) {
+ uprv_free(pv);
+ uprv_free(v);
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+ uprv_memset(pv, 0, sizeof(UPropsVectors));
+ pv->v=v;
+ pv->columns=columns;
+ pv->maxRows=UPVEC_INITIAL_ROWS;
+ pv->rows=2+(UPVEC_MAX_CP-UPVEC_FIRST_SPECIAL_CP);
+
+ /* set the all-Unicode row and the special-value rows */
+ row=pv->v;
+ uprv_memset(row, 0, pv->rows*columns*4);
+ row[0]=0;
+ row[1]=0x110000;
+ row+=columns;
+ for(cp=UPVEC_FIRST_SPECIAL_CP; cp<=UPVEC_MAX_CP; ++cp) {
+ row[0]=cp;
+ row[1]=cp+1;
+ row+=columns;
+ }
+ return pv;
+}
+
+U_CAPI void U_EXPORT2
+upvec_close(UPropsVectors *pv) {
+ if(pv!=NULL) {
+ uprv_free(pv->v);
+ uprv_free(pv);
+ }
+}
+
+static uint32_t *
+_findRow(UPropsVectors *pv, UChar32 rangeStart) {
+ uint32_t *row;
+ int32_t columns, i, start, limit, prevRow;
+
+ columns=pv->columns;
+ limit=pv->rows;
+ prevRow=pv->prevRow;
+
+ /* check the vicinity of the last-seen row (start searching with an unrolled loop) */
+ row=pv->v+prevRow*columns;
+ if(rangeStart>=(UChar32)row[0]) {
+ if(rangeStart<(UChar32)row[1]) {
+ /* same row as last seen */
+ return row;
+ } else if(rangeStart<(UChar32)(row+=columns)[1]) {
+ /* next row after the last one */
+ pv->prevRow=prevRow+1;
+ return row;
+ } else if(rangeStart<(UChar32)(row+=columns)[1]) {
+ /* second row after the last one */
+ pv->prevRow=prevRow+2;
+ return row;
+ } else if((rangeStart-(UChar32)row[1])<10) {
+ /* we are close, continue looping */
+ prevRow+=2;
+ do {
+ ++prevRow;
+ row+=columns;
+ } while(rangeStart>=(UChar32)row[1]);
+ pv->prevRow=prevRow;
+ return row;
+ }
+ } else if(rangeStart<(UChar32)pv->v[1]) {
+ /* the very first row */
+ pv->prevRow=0;
+ return pv->v;
+ }
+
+ /* do a binary search for the start of the range */
+ start=0;
+ while(start<limit-1) {
+ i=(start+limit)/2;
+ row=pv->v+i*columns;
+ if(rangeStart<(UChar32)row[0]) {
+ limit=i;
+ } else if(rangeStart<(UChar32)row[1]) {
+ pv->prevRow=i;
+ return row;
+ } else {
+ start=i;
+ }
+ }
+
+ /* must be found because all ranges together always cover all of Unicode */
+ pv->prevRow=start;
+ return pv->v+start*columns;
+}
+
+U_CAPI void U_EXPORT2
+upvec_setValue(UPropsVectors *pv,
+ UChar32 start, UChar32 end,
+ int32_t column,
+ uint32_t value, uint32_t mask,
+ UErrorCode *pErrorCode) {
+ uint32_t *firstRow, *lastRow;
+ int32_t columns;
+ UChar32 limit;
+ UBool splitFirstRow, splitLastRow;
+
+ /* argument checking */
+ if(U_FAILURE(*pErrorCode)) {
+ return;
+ }
+ if( pv==NULL ||
+ start<0 || start>end || end>UPVEC_MAX_CP ||
+ column<0 || column>=(pv->columns-2)
+ ) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ if(pv->isCompacted) {
+ *pErrorCode=U_NO_WRITE_PERMISSION;
+ return;
+ }
+ limit=end+1;
+
+ /* initialize */
+ columns=pv->columns;
+ column+=2; /* skip range start and limit columns */
+ value&=mask;
+
+ /* find the rows whose ranges overlap with the input range */
+
+ /* find the first and last rows, always successful */
+ firstRow=_findRow(pv, start);
+ lastRow=_findRow(pv, end);
+
+ /*
+ * Rows need to be split if they partially overlap with the
+ * input range (only possible for the first and last rows)
+ * and if their value differs from the input value.
+ */
+ splitFirstRow= (UBool)(start!=(UChar32)firstRow[0] && value!=(firstRow[column]&mask));
+ splitLastRow= (UBool)(limit!=(UChar32)lastRow[1] && value!=(lastRow[column]&mask));
+
+ /* split first/last rows if necessary */
+ if(splitFirstRow || splitLastRow) {
+ int32_t count, rows;
+
+ rows=pv->rows;
+ if((rows+splitFirstRow+splitLastRow)>pv->maxRows) {
+ uint32_t *newVectors;
+ int32_t newMaxRows;
+
+ if(pv->maxRows<UPVEC_MEDIUM_ROWS) {
+ newMaxRows=UPVEC_MEDIUM_ROWS;
+ } else if(pv->maxRows<UPVEC_MAX_ROWS) {
+ newMaxRows=UPVEC_MAX_ROWS;
+ } else {
+ /* Implementation bug, or UPVEC_MAX_ROWS too low. */
+ *pErrorCode=U_INTERNAL_PROGRAM_ERROR;
+ return;
+ }
+ newVectors=(uint32_t *)uprv_malloc(newMaxRows*columns*4);
+ if(newVectors==NULL) {
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ uprv_memcpy(newVectors, pv->v, (size_t)rows*columns*4);
+ firstRow=newVectors+(firstRow-pv->v);
+ lastRow=newVectors+(lastRow-pv->v);
+ uprv_free(pv->v);
+ pv->v=newVectors;
+ pv->maxRows=newMaxRows;
+ }
+
+ /* count the number of row cells to move after the last row, and move them */
+ count = (int32_t)((pv->v+rows*columns)-(lastRow+columns));
+ if(count>0) {
+ uprv_memmove(
+ lastRow+(1+splitFirstRow+splitLastRow)*columns,
+ lastRow+columns,
+ count*4);
+ }
+ pv->rows=rows+splitFirstRow+splitLastRow;
+
+ /* split the first row, and move the firstRow pointer to the second part */
+ if(splitFirstRow) {
+ /* copy all affected rows up one and move the lastRow pointer */
+ count = (int32_t)((lastRow-firstRow)+columns);
+ uprv_memmove(firstRow+columns, firstRow, (size_t)count*4);
+ lastRow+=columns;
+
+ /* split the range and move the firstRow pointer */
+ firstRow[1]=firstRow[columns]=(uint32_t)start;
+ firstRow+=columns;
+ }
+
+ /* split the last row */
+ if(splitLastRow) {
+ /* copy the last row data */
+ uprv_memcpy(lastRow+columns, lastRow, (size_t)columns*4);
+
+ /* split the range and move the firstRow pointer */
+ lastRow[1]=lastRow[columns]=(uint32_t)limit;
+ }
+ }
+
+ /* set the "row last seen" to the last row for the range */
+ pv->prevRow=(int32_t)((lastRow-(pv->v))/columns);
+
+ /* set the input value in all remaining rows */
+ firstRow+=column;
+ lastRow+=column;
+ mask=~mask;
+ for(;;) {
+ *firstRow=(*firstRow&mask)|value;
+ if(firstRow==lastRow) {
+ break;
+ }
+ firstRow+=columns;
+ }
+}
+
+U_CAPI uint32_t U_EXPORT2
+upvec_getValue(const UPropsVectors *pv, UChar32 c, int32_t column) {
+ uint32_t *row;
+ UPropsVectors *ncpv;
+
+ if(pv->isCompacted || c<0 || c>UPVEC_MAX_CP || column<0 || column>=(pv->columns-2)) {
+ return 0;
+ }
+ ncpv=(UPropsVectors *)pv;
+ row=_findRow(ncpv, c);
+ return row[2+column];
+}
+
+U_CAPI uint32_t * U_EXPORT2
+upvec_getRow(const UPropsVectors *pv, int32_t rowIndex,
+ UChar32 *pRangeStart, UChar32 *pRangeEnd) {
+ uint32_t *row;
+ int32_t columns;
+
+ if(pv->isCompacted || rowIndex<0 || rowIndex>=pv->rows) {
+ return NULL;
+ }
+
+ columns=pv->columns;
+ row=pv->v+rowIndex*columns;
+ if(pRangeStart!=NULL) {
+ *pRangeStart=(UChar32)row[0];
+ }
+ if(pRangeEnd!=NULL) {
+ *pRangeEnd=(UChar32)row[1]-1;
+ }
+ return row+2;
+}
+
+static int32_t U_CALLCONV
+upvec_compareRows(const void *context, const void *l, const void *r) {
+ const uint32_t *left=(const uint32_t *)l, *right=(const uint32_t *)r;
+ const UPropsVectors *pv=(const UPropsVectors *)context;
+ int32_t i, count, columns;
+
+ count=columns=pv->columns; /* includes start/limit columns */
+
+ /* start comparing after start/limit but wrap around to them */
+ i=2;
+ do {
+ if(left[i]!=right[i]) {
+ return left[i]<right[i] ? -1 : 1;
+ }
+ if(++i==columns) {
+ i=0;
+ }
+ } while(--count>0);
+
+ return 0;
+}
+
+U_CAPI void U_EXPORT2
+upvec_compact(UPropsVectors *pv, UPVecCompactHandler *handler, void *context, UErrorCode *pErrorCode) {
+ uint32_t *row;
+ int32_t i, columns, valueColumns, rows, count;
+ UChar32 start, limit;
+
+ /* argument checking */
+ if(U_FAILURE(*pErrorCode)) {
+ return;
+ }
+ if(handler==NULL) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ if(pv->isCompacted) {
+ return;
+ }
+
+ /* Set the flag now: Sorting and compacting destroys the builder data structure. */
+ pv->isCompacted=TRUE;
+
+ rows=pv->rows;
+ columns=pv->columns;
+ U_ASSERT(columns>=3); /* upvec_open asserts this */
+ valueColumns=columns-2; /* not counting start & limit */
+
+ /* sort the properties vectors to find unique vector values */
+ uprv_sortArray(pv->v, rows, columns*4,
+ upvec_compareRows, pv, FALSE, pErrorCode);
+ if(U_FAILURE(*pErrorCode)) {
+ return;
+ }
+
+ /*
+ * Find and set the special values.
+ * This has to do almost the same work as the compaction below,
+ * to find the indexes where the special-value rows will move.
+ */
+ row=pv->v;
+ count=-valueColumns;
+ for(i=0; i<rows; ++i) {
+ start=(UChar32)row[0];
+
+ /* count a new values vector if it is different from the current one */
+ if(count<0 || 0!=uprv_memcmp(row+2, row-valueColumns, valueColumns*4)) {
+ count+=valueColumns;
+ }
+
+ if(start>=UPVEC_FIRST_SPECIAL_CP) {
+ handler(context, start, start, count, row+2, valueColumns, pErrorCode);
+ if(U_FAILURE(*pErrorCode)) {
+ return;
+ }
+ }
+
+ row+=columns;
+ }
+
+ /* count is at the beginning of the last vector, add valueColumns to include that last vector */
+ count+=valueColumns;
+
+ /* Call the handler once more to signal the start of delivering real values. */
+ handler(context, UPVEC_START_REAL_VALUES_CP, UPVEC_START_REAL_VALUES_CP,
+ count, row-valueColumns, valueColumns, pErrorCode);
+ if(U_FAILURE(*pErrorCode)) {
+ return;
+ }
+
+ /*
+ * Move vector contents up to a contiguous array with only unique
+ * vector values, and call the handler function for each vector.
+ *
+ * This destroys the Properties Vector structure and replaces it
+ * with an array of just vector values.
+ */
+ row=pv->v;
+ count=-valueColumns;
+ for(i=0; i<rows; ++i) {
+ /* fetch these first before memmove() may overwrite them */
+ start=(UChar32)row[0];
+ limit=(UChar32)row[1];
+
+ /* add a new values vector if it is different from the current one */
+ if(count<0 || 0!=uprv_memcmp(row+2, pv->v+count, valueColumns*4)) {
+ count+=valueColumns;
+ uprv_memmove(pv->v+count, row+2, (size_t)valueColumns*4);
+ }
+
+ if(start<UPVEC_FIRST_SPECIAL_CP) {
+ handler(context, start, limit-1, count, pv->v+count, valueColumns, pErrorCode);
+ if(U_FAILURE(*pErrorCode)) {
+ return;
+ }
+ }
+
+ row+=columns;
+ }
+
+ /* count is at the beginning of the last vector, add one to include that last vector */
+ pv->rows=count/valueColumns+1;
+}
+
+U_CAPI const uint32_t * U_EXPORT2
+upvec_getArray(const UPropsVectors *pv, int32_t *pRows, int32_t *pColumns) {
+ if(!pv->isCompacted) {
+ return NULL;
+ }
+ if(pRows!=NULL) {
+ *pRows=pv->rows;
+ }
+ if(pColumns!=NULL) {
+ *pColumns=pv->columns-2;
+ }
+ return pv->v;
+}
+
+U_CAPI uint32_t * U_EXPORT2
+upvec_cloneArray(const UPropsVectors *pv,
+ int32_t *pRows, int32_t *pColumns, UErrorCode *pErrorCode) {
+ uint32_t *clonedArray;
+ int32_t byteLength;
+
+ if(U_FAILURE(*pErrorCode)) {
+ return NULL;
+ }
+ if(!pv->isCompacted) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
+ }
+ byteLength=pv->rows*(pv->columns-2)*4;
+ clonedArray=(uint32_t *)uprv_malloc(byteLength);
+ if(clonedArray==NULL) {
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+ uprv_memcpy(clonedArray, pv->v, byteLength);
+ if(pRows!=NULL) {
+ *pRows=pv->rows;
+ }
+ if(pColumns!=NULL) {
+ *pColumns=pv->columns-2;
+ }
+ return clonedArray;
+}
+
+U_CAPI UTrie2 * U_EXPORT2
+upvec_compactToUTrie2WithRowIndexes(UPropsVectors *pv, UErrorCode *pErrorCode) {
+ UPVecToUTrie2Context toUTrie2={ NULL, 0, 0, 0 };
+ upvec_compact(pv, upvec_compactToUTrie2Handler, &toUTrie2, pErrorCode);
+ utrie2_freeze(toUTrie2.trie, UTRIE2_16_VALUE_BITS, pErrorCode);
+ if(U_FAILURE(*pErrorCode)) {
+ utrie2_close(toUTrie2.trie);
+ toUTrie2.trie=NULL;
+ }
+ return toUTrie2.trie;
+}
+
+/*
+ * TODO(markus): Add upvec_16BitsToUTrie2() function that enumerates all rows, extracts
+ * some 16-bit field and builds and returns a UTrie2.
+ */
+
+U_CAPI void U_CALLCONV
+upvec_compactToUTrie2Handler(void *context,
+ UChar32 start, UChar32 end,
+ int32_t rowIndex, uint32_t *row, int32_t columns,
+ UErrorCode *pErrorCode) {
+ (void)row;
+ (void)columns;
+ UPVecToUTrie2Context *toUTrie2=(UPVecToUTrie2Context *)context;
+ if(start<UPVEC_FIRST_SPECIAL_CP) {
+ utrie2_setRange32(toUTrie2->trie, start, end, (uint32_t)rowIndex, TRUE, pErrorCode);
+ } else {
+ switch(start) {
+ case UPVEC_INITIAL_VALUE_CP:
+ toUTrie2->initialValue=rowIndex;
+ break;
+ case UPVEC_ERROR_VALUE_CP:
+ toUTrie2->errorValue=rowIndex;
+ break;
+ case UPVEC_START_REAL_VALUES_CP:
+ toUTrie2->maxValue=rowIndex;
+ if(rowIndex>0xffff) {
+ /* too many rows for a 16-bit trie */
+ *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
+ } else {
+ toUTrie2->trie=utrie2_open(toUTrie2->initialValue,
+ toUTrie2->errorValue, pErrorCode);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+}
diff --git a/contrib/libs/icu/common/propsvec.h b/contrib/libs/icu/common/propsvec.h
index ed436e15eb..39080615ea 100644
--- a/contrib/libs/icu/common/propsvec.h
+++ b/contrib/libs/icu/common/propsvec.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: propsvec.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/punycode.cpp b/contrib/libs/icu/common/punycode.cpp
index aa4b891037..90fe1ec3c8 100644
--- a/contrib/libs/icu/common/punycode.cpp
+++ b/contrib/libs/icu/common/punycode.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: punycode.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/punycode.h b/contrib/libs/icu/common/punycode.h
index cb994e66ee..5d8a243175 100644
--- a/contrib/libs/icu/common/punycode.h
+++ b/contrib/libs/icu/common/punycode.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: punycode.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/putil.cpp b/contrib/libs/icu/common/putil.cpp
index 1791cd2801..0f3c795336 100644
--- a/contrib/libs/icu/common/putil.cpp
+++ b/contrib/libs/icu/common/putil.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -43,24 +43,24 @@
// Must be before any other #includes.
#include "uposixdefs.h"
-// First, the platform type. Need this for U_PLATFORM.
-#include "unicode/platform.h"
-
-#if U_PLATFORM == U_PF_MINGW && defined __STRICT_ANSI__
-/* tzset isn't defined in strict ANSI on MinGW. */
-#undef __STRICT_ANSI__
-#endif
-
-/*
- * Cygwin with GCC requires inclusion of time.h after the above disabling strict asci mode statement.
- */
-#include <time.h>
-
-#if !U_PLATFORM_USES_ONLY_WIN32_API
-#include <sys/time.h>
-#endif
-
-/* include the rest of the ICU headers */
+// First, the platform type. Need this for U_PLATFORM.
+#include "unicode/platform.h"
+
+#if U_PLATFORM == U_PF_MINGW && defined __STRICT_ANSI__
+/* tzset isn't defined in strict ANSI on MinGW. */
+#undef __STRICT_ANSI__
+#endif
+
+/*
+ * Cygwin with GCC requires inclusion of time.h after the above disabling strict asci mode statement.
+ */
+#include <time.h>
+
+#if !U_PLATFORM_USES_ONLY_WIN32_API
+#include <sys/time.h>
+#endif
+
+/* include the rest of the ICU headers */
#include "unicode/putil.h"
#include "unicode/ustring.h"
#include "putilimp.h"
@@ -92,16 +92,16 @@
* Should Cygwin be included as well (U_PLATFORM_HAS_WIN32_API)
* to use native APIs as much as possible?
*/
-#ifndef WIN32_LEAN_AND_MEAN
+#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
-#endif
+#endif
# define VC_EXTRALEAN
# define NOUSER
# define NOSERVICE
# define NOIME
# define NOMCX
# include <windows.h>
-# include "unicode/uloc.h"
+# include "unicode/uloc.h"
# include "wintz.h"
#elif U_PLATFORM == U_PF_OS400
# include <float.h>
@@ -249,7 +249,7 @@ static UDate getUTCtime_real() {
}
static UDate getUTCtime_fake() {
- static UMutex fakeClockMutex;
+ static UMutex fakeClockMutex;
umtx_lock(&fakeClockMutex);
if(!fakeClock_set) {
UDate real = getUTCtime_real();
@@ -521,28 +521,28 @@ uprv_fmin(double x, double y)
return (x > y ? y : x);
}
-U_CAPI UBool U_EXPORT2
-uprv_add32_overflow(int32_t a, int32_t b, int32_t* res) {
- // NOTE: Some compilers (GCC, Clang) have primitives available, like __builtin_add_overflow.
- // This function could be optimized by calling one of those primitives.
- auto a64 = static_cast<int64_t>(a);
- auto b64 = static_cast<int64_t>(b);
- int64_t res64 = a64 + b64;
- *res = static_cast<int32_t>(res64);
- return res64 != *res;
-}
-
-U_CAPI UBool U_EXPORT2
-uprv_mul32_overflow(int32_t a, int32_t b, int32_t* res) {
- // NOTE: Some compilers (GCC, Clang) have primitives available, like __builtin_mul_overflow.
- // This function could be optimized by calling one of those primitives.
- auto a64 = static_cast<int64_t>(a);
- auto b64 = static_cast<int64_t>(b);
- int64_t res64 = a64 * b64;
- *res = static_cast<int32_t>(res64);
- return res64 != *res;
-}
-
+U_CAPI UBool U_EXPORT2
+uprv_add32_overflow(int32_t a, int32_t b, int32_t* res) {
+ // NOTE: Some compilers (GCC, Clang) have primitives available, like __builtin_add_overflow.
+ // This function could be optimized by calling one of those primitives.
+ auto a64 = static_cast<int64_t>(a);
+ auto b64 = static_cast<int64_t>(b);
+ int64_t res64 = a64 + b64;
+ *res = static_cast<int32_t>(res64);
+ return res64 != *res;
+}
+
+U_CAPI UBool U_EXPORT2
+uprv_mul32_overflow(int32_t a, int32_t b, int32_t* res) {
+ // NOTE: Some compilers (GCC, Clang) have primitives available, like __builtin_mul_overflow.
+ // This function could be optimized by calling one of those primitives.
+ auto a64 = static_cast<int64_t>(a);
+ auto b64 = static_cast<int64_t>(b);
+ int64_t res64 = a64 * b64;
+ *res = static_cast<int32_t>(res64);
+ return res64 != *res;
+}
+
/**
* Truncates the given double.
* trunc(3.3) = 3.0, trunc (-3.3) = -3.0
@@ -678,23 +678,23 @@ uprv_timezone()
/* Note that U_TZNAME does *not* have to be tzname, but if it is,
some platforms need to have it declared here. */
-#if defined(U_TZNAME) && (U_PLATFORM == U_PF_IRIX || U_PLATFORM_IS_DARWIN_BASED)
+#if defined(U_TZNAME) && (U_PLATFORM == U_PF_IRIX || U_PLATFORM_IS_DARWIN_BASED)
/* RS6000 and others reject char **tzname. */
extern U_IMPORT char *U_TZNAME[];
#endif
#if !UCONFIG_NO_FILE_IO && ((U_PLATFORM_IS_DARWIN_BASED && (U_PLATFORM != U_PF_IPHONE || defined(U_TIMEZONE))) || U_PLATFORM_IS_LINUX_BASED || U_PLATFORM == U_PF_BSD || U_PLATFORM == U_PF_SOLARIS)
/* These platforms are likely to use Olson timezone IDs. */
-/* common targets of the symbolic link at TZDEFAULT are:
- * "/usr/share/zoneinfo/<olsonID>" default, older Linux distros, macOS to 10.12
- * "../usr/share/zoneinfo/<olsonID>" newer Linux distros: Red Hat Enterprise Linux 7, Ubuntu 16, SuSe Linux 12
- * "/usr/share/lib/zoneinfo/<olsonID>" Solaris
- * "../usr/share/lib/zoneinfo/<olsonID>" Solaris
- * "/var/db/timezone/zoneinfo/<olsonID>" macOS 10.13
- * To avoid checking lots of paths, just check that the target path
- * before the <olsonID> ends with "/zoneinfo/", and the <olsonID> is valid.
- */
-
+/* common targets of the symbolic link at TZDEFAULT are:
+ * "/usr/share/zoneinfo/<olsonID>" default, older Linux distros, macOS to 10.12
+ * "../usr/share/zoneinfo/<olsonID>" newer Linux distros: Red Hat Enterprise Linux 7, Ubuntu 16, SuSe Linux 12
+ * "/usr/share/lib/zoneinfo/<olsonID>" Solaris
+ * "../usr/share/lib/zoneinfo/<olsonID>" Solaris
+ * "/var/db/timezone/zoneinfo/<olsonID>" macOS 10.13
+ * To avoid checking lots of paths, just check that the target path
+ * before the <olsonID> ends with "/zoneinfo/", and the <olsonID> is valid.
+ */
+
#define CHECK_LOCALTIME_LINK 1
#if U_PLATFORM_IS_DARWIN_BASED
#include <tzfile.h>
@@ -707,7 +707,7 @@ extern U_IMPORT char *U_TZNAME[];
#define TZDEFAULT "/etc/localtime"
#define TZZONEINFO "/usr/share/zoneinfo/"
#endif
-#define TZZONEINFOTAIL "/zoneinfo/"
+#define TZZONEINFOTAIL "/zoneinfo/"
#if U_HAVE_DIRENT_H
#define TZFILE_SKIP "posixrules" /* tz file to skip when searching. */
/* Some Linux distributions have 'localtime' in /usr/share/zoneinfo
@@ -959,26 +959,26 @@ static CharString *gSearchTZFileResult = NULL;
* This function is not thread safe - it uses a global, gSearchTZFileResult, to hold its results.
*/
static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
- DIR* dirp = NULL;
+ DIR* dirp = NULL;
struct dirent* dirEntry = NULL;
- char* result = NULL;
- UErrorCode status = U_ZERO_ERROR;
-
- /* Save the current path */
- CharString curpath(path, -1, status);
- if (U_FAILURE(status)) {
- goto cleanupAndReturn;
- }
-
- dirp = opendir(path);
+ char* result = NULL;
+ UErrorCode status = U_ZERO_ERROR;
+
+ /* Save the current path */
+ CharString curpath(path, -1, status);
+ if (U_FAILURE(status)) {
+ goto cleanupAndReturn;
+ }
+
+ dirp = opendir(path);
if (dirp == NULL) {
- goto cleanupAndReturn;
+ goto cleanupAndReturn;
}
if (gSearchTZFileResult == NULL) {
gSearchTZFileResult = new CharString;
if (gSearchTZFileResult == NULL) {
- goto cleanupAndReturn;
+ goto cleanupAndReturn;
}
ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup);
}
@@ -986,22 +986,22 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
/* Check each entry in the directory. */
while((dirEntry = readdir(dirp)) != NULL) {
const char* dirName = dirEntry->d_name;
- if (uprv_strcmp(dirName, SKIP1) != 0 && uprv_strcmp(dirName, SKIP2) != 0
- && uprv_strcmp(TZFILE_SKIP, dirName) != 0 && uprv_strcmp(TZFILE_SKIP2, dirName) != 0) {
+ if (uprv_strcmp(dirName, SKIP1) != 0 && uprv_strcmp(dirName, SKIP2) != 0
+ && uprv_strcmp(TZFILE_SKIP, dirName) != 0 && uprv_strcmp(TZFILE_SKIP2, dirName) != 0) {
/* Create a newpath with the new entry to test each entry in the directory. */
CharString newpath(curpath, status);
newpath.append(dirName, -1, status);
if (U_FAILURE(status)) {
- break;
+ break;
}
- DIR* subDirp = NULL;
+ DIR* subDirp = NULL;
if ((subDirp = opendir(newpath.data())) != NULL) {
/* If this new path is a directory, make a recursive call with the newpath. */
closedir(subDirp);
newpath.append('/', status);
if (U_FAILURE(status)) {
- break;
+ break;
}
result = searchForTZFile(newpath.data(), tzInfo);
/*
@@ -1014,7 +1014,7 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
*/
if (result != NULL)
break;
- } else {
+ } else {
if(compareBinaryFiles(TZDEFAULT, newpath.data(), tzInfo)) {
int32_t amountToSkip = sizeof(TZZONEINFO) - 1;
if (amountToSkip > newpath.length()) {
@@ -1025,7 +1025,7 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
gSearchTZFileResult->clear();
gSearchTZFileResult->append(zoneid, -1, status);
if (U_FAILURE(status)) {
- break;
+ break;
}
result = gSearchTZFileResult->data();
/* Get out after the first one found. */
@@ -1034,11 +1034,11 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
}
}
}
-
- cleanupAndReturn:
- if (dirp) {
- closedir(dirp);
- }
+
+ cleanupAndReturn:
+ if (dirp) {
+ closedir(dirp);
+ }
return result;
}
#endif
@@ -1054,7 +1054,7 @@ uprv_tzname_clear_cache()
U_CAPI const char* U_EXPORT2
uprv_tzname(int n)
{
- (void)n; // Avoid unreferenced parameter warning.
+ (void)n; // Avoid unreferenced parameter warning.
const char *tzid = NULL;
#if U_PLATFORM_USES_ONLY_WIN32_API
tzid = uprv_detectWindowsTimeZone();
@@ -1062,15 +1062,15 @@ uprv_tzname(int n)
if (tzid != NULL) {
return tzid;
}
-
-#ifndef U_TZNAME
- // The return value is free'd in timezone.cpp on Windows because
- // the other code path returns a pointer to a heap location.
- // If we don't have a name already, then tzname wouldn't be any
- // better, so just fall back.
- return uprv_strdup("");
-#endif // !U_TZNAME
-
+
+#ifndef U_TZNAME
+ // The return value is free'd in timezone.cpp on Windows because
+ // the other code path returns a pointer to a heap location.
+ // If we don't have a name already, then tzname wouldn't be any
+ // better, so just fall back.
+ return uprv_strdup("");
+#endif // !U_TZNAME
+
#else
/*#if U_PLATFORM_IS_DARWIN_BASED
@@ -1112,14 +1112,14 @@ uprv_tzname(int n)
*/
int32_t ret = (int32_t)readlink(TZDEFAULT, gTimeZoneBuffer, sizeof(gTimeZoneBuffer)-1);
if (0 < ret) {
- int32_t tzZoneInfoTailLen = uprv_strlen(TZZONEINFOTAIL);
+ int32_t tzZoneInfoTailLen = uprv_strlen(TZZONEINFOTAIL);
gTimeZoneBuffer[ret] = 0;
- char * tzZoneInfoTailPtr = uprv_strstr(gTimeZoneBuffer, TZZONEINFOTAIL);
-
- if (tzZoneInfoTailPtr != NULL
- && isValidOlsonID(tzZoneInfoTailPtr + tzZoneInfoTailLen))
+ char * tzZoneInfoTailPtr = uprv_strstr(gTimeZoneBuffer, TZZONEINFOTAIL);
+
+ if (tzZoneInfoTailPtr != NULL
+ && isValidOlsonID(tzZoneInfoTailPtr + tzZoneInfoTailLen))
{
- return (gTimeZoneBufferPtr = tzZoneInfoTailPtr + tzZoneInfoTailLen);
+ return (gTimeZoneBufferPtr = tzZoneInfoTailPtr + tzZoneInfoTailLen);
}
} else {
#if defined(SEARCH_TZFILE)
@@ -1206,8 +1206,8 @@ UInitOnce gTimeZoneFilesInitOnce = U_INITONCE_INITIALIZER;
static CharString *gTimeZoneFilesDirectory = NULL;
#if U_POSIX_LOCALE || U_PLATFORM_USES_ONLY_WIN32_API
- static const char *gCorrectedPOSIXLocale = NULL; /* Sometimes heap allocated */
- static bool gCorrectedPOSIXLocaleHeapAllocated = false;
+ static const char *gCorrectedPOSIXLocale = NULL; /* Sometimes heap allocated */
+ static bool gCorrectedPOSIXLocaleHeapAllocated = false;
#endif
static UBool U_CALLCONV putil_cleanup(void)
@@ -1228,10 +1228,10 @@ static UBool U_CALLCONV putil_cleanup(void)
#endif
#if U_POSIX_LOCALE || U_PLATFORM_USES_ONLY_WIN32_API
- if (gCorrectedPOSIXLocale && gCorrectedPOSIXLocaleHeapAllocated) {
- uprv_free(const_cast<char *>(gCorrectedPOSIXLocale));
+ if (gCorrectedPOSIXLocale && gCorrectedPOSIXLocaleHeapAllocated) {
+ uprv_free(const_cast<char *>(gCorrectedPOSIXLocale));
gCorrectedPOSIXLocale = NULL;
- gCorrectedPOSIXLocaleHeapAllocated = false;
+ gCorrectedPOSIXLocaleHeapAllocated = false;
}
#endif
return TRUE;
@@ -1265,7 +1265,7 @@ u_setDataDirectory(const char *directory) {
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
{
char *p;
- while((p = uprv_strchr(newDataDir, U_FILE_ALT_SEP_CHAR)) != NULL) {
+ while((p = uprv_strchr(newDataDir, U_FILE_ALT_SEP_CHAR)) != NULL) {
*p = U_FILE_SEP_CHAR;
}
}
@@ -1307,49 +1307,49 @@ uprv_pathIsAbsolute(const char *path)
return FALSE;
}
-/* Backup setting of ICU_DATA_DIR_PREFIX_ENV_VAR
- (needed for some Darwin ICU build environments) */
-#if U_PLATFORM_IS_DARWIN_BASED && TARGET_OS_SIMULATOR
+/* Backup setting of ICU_DATA_DIR_PREFIX_ENV_VAR
+ (needed for some Darwin ICU build environments) */
+#if U_PLATFORM_IS_DARWIN_BASED && TARGET_OS_SIMULATOR
# if !defined(ICU_DATA_DIR_PREFIX_ENV_VAR)
# define ICU_DATA_DIR_PREFIX_ENV_VAR "IPHONE_SIMULATOR_ROOT"
# endif
#endif
-#if defined(ICU_DATA_DIR_WINDOWS)
-// Helper function to get the ICU Data Directory under the Windows directory location.
-static BOOL U_CALLCONV getIcuDataDirectoryUnderWindowsDirectory(char* directoryBuffer, UINT bufferLength)
-{
- wchar_t windowsPath[MAX_PATH];
- char windowsPathUtf8[MAX_PATH];
-
- UINT length = GetSystemWindowsDirectoryW(windowsPath, UPRV_LENGTHOF(windowsPath));
- if ((length > 0) && (length < (UPRV_LENGTHOF(windowsPath) - 1))) {
- // Convert UTF-16 to a UTF-8 string.
- UErrorCode status = U_ZERO_ERROR;
- int32_t windowsPathUtf8Len = 0;
- u_strToUTF8(windowsPathUtf8, static_cast<int32_t>(UPRV_LENGTHOF(windowsPathUtf8)),
- &windowsPathUtf8Len, reinterpret_cast<const UChar*>(windowsPath), -1, &status);
-
- if (U_SUCCESS(status) && (status != U_STRING_NOT_TERMINATED_WARNING) &&
- (windowsPathUtf8Len < (UPRV_LENGTHOF(windowsPathUtf8) - 1))) {
- // Ensure it always has a separator, so we can append the ICU data path.
- if (windowsPathUtf8[windowsPathUtf8Len - 1] != U_FILE_SEP_CHAR) {
- windowsPathUtf8[windowsPathUtf8Len++] = U_FILE_SEP_CHAR;
- windowsPathUtf8[windowsPathUtf8Len] = '\0';
- }
- // Check if the concatenated string will fit.
- if ((windowsPathUtf8Len + UPRV_LENGTHOF(ICU_DATA_DIR_WINDOWS)) < bufferLength) {
- uprv_strcpy(directoryBuffer, windowsPathUtf8);
- uprv_strcat(directoryBuffer, ICU_DATA_DIR_WINDOWS);
- return TRUE;
- }
- }
- }
-
- return FALSE;
-}
-#endif
-
+#if defined(ICU_DATA_DIR_WINDOWS)
+// Helper function to get the ICU Data Directory under the Windows directory location.
+static BOOL U_CALLCONV getIcuDataDirectoryUnderWindowsDirectory(char* directoryBuffer, UINT bufferLength)
+{
+ wchar_t windowsPath[MAX_PATH];
+ char windowsPathUtf8[MAX_PATH];
+
+ UINT length = GetSystemWindowsDirectoryW(windowsPath, UPRV_LENGTHOF(windowsPath));
+ if ((length > 0) && (length < (UPRV_LENGTHOF(windowsPath) - 1))) {
+ // Convert UTF-16 to a UTF-8 string.
+ UErrorCode status = U_ZERO_ERROR;
+ int32_t windowsPathUtf8Len = 0;
+ u_strToUTF8(windowsPathUtf8, static_cast<int32_t>(UPRV_LENGTHOF(windowsPathUtf8)),
+ &windowsPathUtf8Len, reinterpret_cast<const UChar*>(windowsPath), -1, &status);
+
+ if (U_SUCCESS(status) && (status != U_STRING_NOT_TERMINATED_WARNING) &&
+ (windowsPathUtf8Len < (UPRV_LENGTHOF(windowsPathUtf8) - 1))) {
+ // Ensure it always has a separator, so we can append the ICU data path.
+ if (windowsPathUtf8[windowsPathUtf8Len - 1] != U_FILE_SEP_CHAR) {
+ windowsPathUtf8[windowsPathUtf8Len++] = U_FILE_SEP_CHAR;
+ windowsPathUtf8[windowsPathUtf8Len] = '\0';
+ }
+ // Check if the concatenated string will fit.
+ if ((windowsPathUtf8Len + UPRV_LENGTHOF(ICU_DATA_DIR_WINDOWS)) < bufferLength) {
+ uprv_strcpy(directoryBuffer, windowsPathUtf8);
+ uprv_strcat(directoryBuffer, ICU_DATA_DIR_WINDOWS);
+ return TRUE;
+ }
+ }
+ }
+
+ return FALSE;
+}
+#endif
+
static void U_CALLCONV dataDirectoryInitFn() {
/* If we already have the directory, then return immediately. Will happen if user called
* u_setDataDirectory().
@@ -1378,9 +1378,9 @@ static void U_CALLCONV dataDirectoryInitFn() {
*/
# if !defined(ICU_NO_USER_DATA_OVERRIDE) && !UCONFIG_NO_FILE_IO
/* First try to get the environment variable */
-# if U_PLATFORM_HAS_WINUWP_API == 0 // Windows UWP does not support getenv
- path=getenv("ICU_DATA");
-# endif
+# if U_PLATFORM_HAS_WINUWP_API == 0 // Windows UWP does not support getenv
+ path=getenv("ICU_DATA");
+# endif
# endif
/* ICU_DATA_DIR may be set as a compile option.
@@ -1409,13 +1409,13 @@ static void U_CALLCONV dataDirectoryInitFn() {
}
#endif
-#if defined(ICU_DATA_DIR_WINDOWS)
- char datadir_path_buffer[MAX_PATH];
- if (getIcuDataDirectoryUnderWindowsDirectory(datadir_path_buffer, UPRV_LENGTHOF(datadir_path_buffer))) {
- path = datadir_path_buffer;
- }
-#endif
-
+#if defined(ICU_DATA_DIR_WINDOWS)
+ char datadir_path_buffer[MAX_PATH];
+ if (getIcuDataDirectoryUnderWindowsDirectory(datadir_path_buffer, UPRV_LENGTHOF(datadir_path_buffer))) {
+ path = datadir_path_buffer;
+ }
+#endif
+
if(path==NULL) {
/* It looks really bad, set it to something. */
path = "";
@@ -1439,7 +1439,7 @@ static void setTimeZoneFilesDir(const char *path, UErrorCode &status) {
gTimeZoneFilesDirectory->append(path, status);
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
char *p = gTimeZoneFilesDirectory->data();
- while ((p = uprv_strchr(p, U_FILE_ALT_SEP_CHAR)) != NULL) {
+ while ((p = uprv_strchr(p, U_FILE_ALT_SEP_CHAR)) != NULL) {
*p = U_FILE_SEP_CHAR;
}
#endif
@@ -1456,47 +1456,47 @@ static void U_CALLCONV TimeZoneDataDirInitFn(UErrorCode &status) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
-
- const char *dir = "";
-
-#if defined(ICU_TIMEZONE_FILES_DIR_PREFIX_ENV_VAR)
- char timezonefilesdir_path_buffer[PATH_MAX];
- const char *prefix = getenv(ICU_TIMEZONE_FILES_DIR_PREFIX_ENV_VAR);
-#endif
-
-#if U_PLATFORM_HAS_WINUWP_API == 1
-// The UWP version does not support the environment variable setting.
-
-# if defined(ICU_DATA_DIR_WINDOWS)
- // When using the Windows system data, we can possibly pick up time zone data from the Windows directory.
- char datadir_path_buffer[MAX_PATH];
- if (getIcuDataDirectoryUnderWindowsDirectory(datadir_path_buffer, UPRV_LENGTHOF(datadir_path_buffer))) {
- dir = datadir_path_buffer;
- }
-# endif
-
-#else
- dir = getenv("ICU_TIMEZONE_FILES_DIR");
-#endif // U_PLATFORM_HAS_WINUWP_API
-
+
+ const char *dir = "";
+
+#if defined(ICU_TIMEZONE_FILES_DIR_PREFIX_ENV_VAR)
+ char timezonefilesdir_path_buffer[PATH_MAX];
+ const char *prefix = getenv(ICU_TIMEZONE_FILES_DIR_PREFIX_ENV_VAR);
+#endif
+
+#if U_PLATFORM_HAS_WINUWP_API == 1
+// The UWP version does not support the environment variable setting.
+
+# if defined(ICU_DATA_DIR_WINDOWS)
+ // When using the Windows system data, we can possibly pick up time zone data from the Windows directory.
+ char datadir_path_buffer[MAX_PATH];
+ if (getIcuDataDirectoryUnderWindowsDirectory(datadir_path_buffer, UPRV_LENGTHOF(datadir_path_buffer))) {
+ dir = datadir_path_buffer;
+ }
+# endif
+
+#else
+ dir = getenv("ICU_TIMEZONE_FILES_DIR");
+#endif // U_PLATFORM_HAS_WINUWP_API
+
#if defined(U_TIMEZONE_FILES_DIR)
if (dir == NULL) {
- // Build time configuration setting.
+ // Build time configuration setting.
dir = TO_STRING(U_TIMEZONE_FILES_DIR);
}
#endif
-
+
if (dir == NULL) {
dir = "";
}
-
-#if defined(ICU_TIMEZONE_FILES_DIR_PREFIX_ENV_VAR)
- if (prefix != NULL) {
- snprintf(timezonefilesdir_path_buffer, PATH_MAX, "%s%s", prefix, dir);
- dir = timezonefilesdir_path_buffer;
- }
-#endif
-
+
+#if defined(ICU_TIMEZONE_FILES_DIR_PREFIX_ENV_VAR)
+ if (prefix != NULL) {
+ snprintf(timezonefilesdir_path_buffer, PATH_MAX, "%s%s", prefix, dir);
+ dir = timezonefilesdir_path_buffer;
+ }
+#endif
+
setTimeZoneFilesDir(dir, status);
}
@@ -1575,10 +1575,10 @@ static const char *uprv_getPOSIXIDForCategory(int category)
{
/* Nothing worked. Give it a nice POSIX default value. */
posixID = "en_US_POSIX";
- // Note: this test will not catch 'C.UTF-8',
- // that will be handled in uprv_getDefaultLocaleID().
- // Leave this mapping here for the uprv_getPOSIXIDForDefaultCodepage()
- // caller which expects to see "en_US_POSIX" in many branches.
+ // Note: this test will not catch 'C.UTF-8',
+ // that will be handled in uprv_getDefaultLocaleID().
+ // Leave this mapping here for the uprv_getPOSIXIDForDefaultCodepage()
+ // caller which expects to see "en_US_POSIX" in many branches.
}
return posixID;
}
@@ -1645,36 +1645,36 @@ The leftmost codepage (.xxx) wins.
l = lang, C = ctry, M = charmap, V = variant
*/
- if (gCorrectedPOSIXLocale != nullptr) {
+ if (gCorrectedPOSIXLocale != nullptr) {
return gCorrectedPOSIXLocale;
}
- // Copy the ID into owned memory.
- // Over-allocate in case we replace "C" with "en_US_POSIX" (+10), + null termination
- char *correctedPOSIXLocale = static_cast<char *>(uprv_malloc(uprv_strlen(posixID) + 10 + 1));
- if (correctedPOSIXLocale == nullptr) {
- return nullptr;
- }
- uprv_strcpy(correctedPOSIXLocale, posixID);
-
- char *limit;
- if ((limit = uprv_strchr(correctedPOSIXLocale, '.')) != nullptr) {
- *limit = 0;
- }
- if ((limit = uprv_strchr(correctedPOSIXLocale, '@')) != nullptr) {
- *limit = 0;
- }
-
- if ((uprv_strcmp("C", correctedPOSIXLocale) == 0) // no @ variant
- || (uprv_strcmp("POSIX", correctedPOSIXLocale) == 0)) {
- // Raw input was C.* or POSIX.*, Give it a nice POSIX default value.
- // (The "C"/"POSIX" case is handled in uprv_getPOSIXIDForCategory())
- uprv_strcpy(correctedPOSIXLocale, "en_US_POSIX");
- }
-
+ // Copy the ID into owned memory.
+ // Over-allocate in case we replace "C" with "en_US_POSIX" (+10), + null termination
+ char *correctedPOSIXLocale = static_cast<char *>(uprv_malloc(uprv_strlen(posixID) + 10 + 1));
+ if (correctedPOSIXLocale == nullptr) {
+ return nullptr;
+ }
+ uprv_strcpy(correctedPOSIXLocale, posixID);
+
+ char *limit;
+ if ((limit = uprv_strchr(correctedPOSIXLocale, '.')) != nullptr) {
+ *limit = 0;
+ }
+ if ((limit = uprv_strchr(correctedPOSIXLocale, '@')) != nullptr) {
+ *limit = 0;
+ }
+
+ if ((uprv_strcmp("C", correctedPOSIXLocale) == 0) // no @ variant
+ || (uprv_strcmp("POSIX", correctedPOSIXLocale) == 0)) {
+ // Raw input was C.* or POSIX.*, Give it a nice POSIX default value.
+ // (The "C"/"POSIX" case is handled in uprv_getPOSIXIDForCategory())
+ uprv_strcpy(correctedPOSIXLocale, "en_US_POSIX");
+ }
+
/* Note that we scan the *uncorrected* ID. */
- const char *p;
- if ((p = uprv_strrchr(posixID, '@')) != nullptr) {
+ const char *p;
+ if ((p = uprv_strrchr(posixID, '@')) != nullptr) {
p++;
/* Take care of any special cases here.. */
@@ -1683,18 +1683,18 @@ The leftmost codepage (.xxx) wins.
/* Don't worry about no__NY. In practice, it won't appear. */
}
- if (uprv_strchr(correctedPOSIXLocale,'_') == nullptr) {
- uprv_strcat(correctedPOSIXLocale, "__"); /* aa@b -> aa__b (note this can make the new locale 1 char longer) */
+ if (uprv_strchr(correctedPOSIXLocale,'_') == nullptr) {
+ uprv_strcat(correctedPOSIXLocale, "__"); /* aa@b -> aa__b (note this can make the new locale 1 char longer) */
}
else {
uprv_strcat(correctedPOSIXLocale, "_"); /* aa_CC@b -> aa_CC_b */
}
- const char *q;
- if ((q = uprv_strchr(p, '.')) != nullptr) {
+ const char *q;
+ if ((q = uprv_strchr(p, '.')) != nullptr) {
/* How big will the resulting string be? */
- int32_t len = (int32_t)(uprv_strlen(correctedPOSIXLocale) + (q-p));
- uprv_strncat(correctedPOSIXLocale, p, q-p); // do not include charset
+ int32_t len = (int32_t)(uprv_strlen(correctedPOSIXLocale) + (q-p));
+ uprv_strncat(correctedPOSIXLocale, p, q-p); // do not include charset
correctedPOSIXLocale[len] = 0;
}
else {
@@ -1709,15 +1709,15 @@ The leftmost codepage (.xxx) wins.
*/
}
- if (gCorrectedPOSIXLocale == nullptr) {
+ if (gCorrectedPOSIXLocale == nullptr) {
gCorrectedPOSIXLocale = correctedPOSIXLocale;
- gCorrectedPOSIXLocaleHeapAllocated = true;
+ gCorrectedPOSIXLocaleHeapAllocated = true;
ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup);
- correctedPOSIXLocale = nullptr;
+ correctedPOSIXLocale = nullptr;
}
- posixID = gCorrectedPOSIXLocale;
+ posixID = gCorrectedPOSIXLocale;
- if (correctedPOSIXLocale != nullptr) { /* Was already set - clean up. */
+ if (correctedPOSIXLocale != nullptr) { /* Was already set - clean up. */
uprv_free(correctedPOSIXLocale);
}
@@ -1726,71 +1726,71 @@ The leftmost codepage (.xxx) wins.
#elif U_PLATFORM_USES_ONLY_WIN32_API
#define POSIX_LOCALE_CAPACITY 64
UErrorCode status = U_ZERO_ERROR;
- char *correctedPOSIXLocale = nullptr;
+ char *correctedPOSIXLocale = nullptr;
- // If we have already figured this out just use the cached value
- if (gCorrectedPOSIXLocale != nullptr) {
+ // If we have already figured this out just use the cached value
+ if (gCorrectedPOSIXLocale != nullptr) {
return gCorrectedPOSIXLocale;
}
- // No cached value, need to determine the current value
- static WCHAR windowsLocale[LOCALE_NAME_MAX_LENGTH] = {};
- int length = GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SNAME, windowsLocale, LOCALE_NAME_MAX_LENGTH);
-
- // Now we should have a Windows locale name that needs converted to the POSIX style.
- if (length > 0) // If length is 0, then the GetLocaleInfoEx failed.
- {
- // First we need to go from UTF-16 to char (and also convert from _ to - while we're at it.)
- char modifiedWindowsLocale[LOCALE_NAME_MAX_LENGTH] = {};
-
- int32_t i;
- for (i = 0; i < UPRV_LENGTHOF(modifiedWindowsLocale); i++)
- {
- if (windowsLocale[i] == '_')
- {
- modifiedWindowsLocale[i] = '-';
- }
- else
- {
- modifiedWindowsLocale[i] = static_cast<char>(windowsLocale[i]);
- }
-
- if (modifiedWindowsLocale[i] == '\0')
- {
- break;
- }
+ // No cached value, need to determine the current value
+ static WCHAR windowsLocale[LOCALE_NAME_MAX_LENGTH] = {};
+ int length = GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SNAME, windowsLocale, LOCALE_NAME_MAX_LENGTH);
+
+ // Now we should have a Windows locale name that needs converted to the POSIX style.
+ if (length > 0) // If length is 0, then the GetLocaleInfoEx failed.
+ {
+ // First we need to go from UTF-16 to char (and also convert from _ to - while we're at it.)
+ char modifiedWindowsLocale[LOCALE_NAME_MAX_LENGTH] = {};
+
+ int32_t i;
+ for (i = 0; i < UPRV_LENGTHOF(modifiedWindowsLocale); i++)
+ {
+ if (windowsLocale[i] == '_')
+ {
+ modifiedWindowsLocale[i] = '-';
+ }
+ else
+ {
+ modifiedWindowsLocale[i] = static_cast<char>(windowsLocale[i]);
+ }
+
+ if (modifiedWindowsLocale[i] == '\0')
+ {
+ break;
+ }
+ }
+
+ if (i >= UPRV_LENGTHOF(modifiedWindowsLocale))
+ {
+ // Ran out of room, can't really happen, maybe we'll be lucky about a matching
+ // locale when tags are dropped
+ modifiedWindowsLocale[UPRV_LENGTHOF(modifiedWindowsLocale) - 1] = '\0';
+ }
+
+ // Now normalize the resulting name
+ correctedPOSIXLocale = static_cast<char *>(uprv_malloc(POSIX_LOCALE_CAPACITY + 1));
+ /* TODO: Should we just exit on memory allocation failure? */
+ if (correctedPOSIXLocale)
+ {
+ int32_t posixLen = uloc_canonicalize(modifiedWindowsLocale, correctedPOSIXLocale, POSIX_LOCALE_CAPACITY, &status);
+ if (U_SUCCESS(status))
+ {
+ *(correctedPOSIXLocale + posixLen) = 0;
+ gCorrectedPOSIXLocale = correctedPOSIXLocale;
+ gCorrectedPOSIXLocaleHeapAllocated = true;
+ ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup);
+ }
+ else
+ {
+ uprv_free(correctedPOSIXLocale);
+ }
}
-
- if (i >= UPRV_LENGTHOF(modifiedWindowsLocale))
- {
- // Ran out of room, can't really happen, maybe we'll be lucky about a matching
- // locale when tags are dropped
- modifiedWindowsLocale[UPRV_LENGTHOF(modifiedWindowsLocale) - 1] = '\0';
- }
-
- // Now normalize the resulting name
- correctedPOSIXLocale = static_cast<char *>(uprv_malloc(POSIX_LOCALE_CAPACITY + 1));
- /* TODO: Should we just exit on memory allocation failure? */
- if (correctedPOSIXLocale)
- {
- int32_t posixLen = uloc_canonicalize(modifiedWindowsLocale, correctedPOSIXLocale, POSIX_LOCALE_CAPACITY, &status);
- if (U_SUCCESS(status))
- {
- *(correctedPOSIXLocale + posixLen) = 0;
- gCorrectedPOSIXLocale = correctedPOSIXLocale;
- gCorrectedPOSIXLocaleHeapAllocated = true;
- ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup);
- }
- else
- {
- uprv_free(correctedPOSIXLocale);
- }
- }
}
- // If unable to find a locale we can agree upon, use en-US by default
- if (gCorrectedPOSIXLocale == nullptr) {
- gCorrectedPOSIXLocale = "en_US";
+ // If unable to find a locale we can agree upon, use en-US by default
+ if (gCorrectedPOSIXLocale == nullptr) {
+ gCorrectedPOSIXLocale = "en_US";
}
return gCorrectedPOSIXLocale;
@@ -2077,35 +2077,35 @@ int_getDefaultCodepage()
#elif U_PLATFORM_USES_ONLY_WIN32_API
static char codepage[64];
- DWORD codepageNumber = 0;
-
-#if U_PLATFORM_HAS_WINUWP_API == 1
- // UWP doesn't have a direct API to get the default ACP as Microsoft would rather
- // have folks use Unicode than a "system" code page, however this is the same
- // codepage as the system default locale codepage. (FWIW, the system locale is
- // ONLY used for codepage, it should never be used for anything else)
- GetLocaleInfoEx(LOCALE_NAME_SYSTEM_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
- (LPWSTR)&codepageNumber, sizeof(codepageNumber) / sizeof(WCHAR));
-#else
- // Win32 apps can call GetACP
- codepageNumber = GetACP();
-#endif
- // Special case for UTF-8
- if (codepageNumber == 65001)
- {
- return "UTF-8";
- }
- // Windows codepages can look like windows-1252, so format the found number
- // the numbers are eclectic, however all valid system code pages, besides UTF-8
- // are between 3 and 19999
- if (codepageNumber > 0 && codepageNumber < 20000)
+ DWORD codepageNumber = 0;
+
+#if U_PLATFORM_HAS_WINUWP_API == 1
+ // UWP doesn't have a direct API to get the default ACP as Microsoft would rather
+ // have folks use Unicode than a "system" code page, however this is the same
+ // codepage as the system default locale codepage. (FWIW, the system locale is
+ // ONLY used for codepage, it should never be used for anything else)
+ GetLocaleInfoEx(LOCALE_NAME_SYSTEM_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
+ (LPWSTR)&codepageNumber, sizeof(codepageNumber) / sizeof(WCHAR));
+#else
+ // Win32 apps can call GetACP
+ codepageNumber = GetACP();
+#endif
+ // Special case for UTF-8
+ if (codepageNumber == 65001)
{
- sprintf(codepage, "windows-%ld", codepageNumber);
- return codepage;
- }
- // If the codepage number call failed then return UTF-8
- return "UTF-8";
-
+ return "UTF-8";
+ }
+ // Windows codepages can look like windows-1252, so format the found number
+ // the numbers are eclectic, however all valid system code pages, besides UTF-8
+ // are between 3 and 19999
+ if (codepageNumber > 0 && codepageNumber < 20000)
+ {
+ sprintf(codepage, "windows-%ld", codepageNumber);
+ return codepage;
+ }
+ // If the codepage number call failed then return UTF-8
+ return "UTF-8";
+
#elif U_POSIX_LOCALE
static char codesetName[100];
const char *localeName = NULL;
@@ -2288,7 +2288,7 @@ u_getVersion(UVersionInfo versionArray) {
* icucfg.h dependent code
*/
-#if U_ENABLE_DYLOAD && HAVE_DLOPEN && !U_PLATFORM_USES_ONLY_WIN32_API
+#if U_ENABLE_DYLOAD && HAVE_DLOPEN && !U_PLATFORM_USES_ONLY_WIN32_API
#if HAVE_DLFCN_H
#ifdef __MVS__
@@ -2297,7 +2297,7 @@ u_getVersion(UVersionInfo versionArray) {
#endif
#endif
#include <dlfcn.h>
-#endif /* HAVE_DLFCN_H */
+#endif /* HAVE_DLFCN_H */
U_INTERNAL void * U_EXPORT2
uprv_dl_open(const char *libName, UErrorCode *status) {
@@ -2337,10 +2337,10 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
return uret.fp;
}
-#elif U_ENABLE_DYLOAD && U_PLATFORM_USES_ONLY_WIN32_API && !U_PLATFORM_HAS_WINUWP_API
+#elif U_ENABLE_DYLOAD && U_PLATFORM_USES_ONLY_WIN32_API && !U_PLATFORM_HAS_WINUWP_API
-/* Windows API implementation. */
-// Note: UWP does not expose/allow these APIs, so the UWP version gets the null implementation. */
+/* Windows API implementation. */
+// Note: UWP does not expose/allow these APIs, so the UWP version gets the null implementation. */
U_INTERNAL void * U_EXPORT2
uprv_dl_open(const char *libName, UErrorCode *status) {
@@ -2390,7 +2390,7 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
#else
-/* No dynamic loading, null (nonexistent) implementation. */
+/* No dynamic loading, null (nonexistent) implementation. */
U_INTERNAL void * U_EXPORT2
uprv_dl_open(const char *libName, UErrorCode *status) {
@@ -2418,7 +2418,7 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
return (UVoidFunction*)NULL;
}
-#endif
+#endif
/*
* Hey, Emacs, please set the following:
diff --git a/contrib/libs/icu/common/putilimp.h b/contrib/libs/icu/common/putilimp.h
index 3cff5e8b19..d9c90cf4e7 100644
--- a/contrib/libs/icu/common/putilimp.h
+++ b/contrib/libs/icu/common/putilimp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -78,7 +78,7 @@ typedef size_t uintptr_t;
#ifdef U_HAVE_NL_LANGINFO_CODESET
/* Use the predefined value. */
-#elif U_PLATFORM_USES_ONLY_WIN32_API || U_PLATFORM == U_PF_ANDROID || U_PLATFORM == U_PF_QNX
+#elif U_PLATFORM_USES_ONLY_WIN32_API || U_PLATFORM == U_PF_ANDROID || U_PLATFORM == U_PF_QNX
# define U_HAVE_NL_LANGINFO_CODESET 0
#else
# define U_HAVE_NL_LANGINFO_CODESET 1
@@ -94,13 +94,13 @@ typedef size_t uintptr_t;
# define U_NL_LANGINFO_CODESET CODESET
#endif
-#if defined(U_TZSET) || defined(U_HAVE_TZSET)
+#if defined(U_TZSET) || defined(U_HAVE_TZSET)
/* Use the predefined value. */
#elif U_PLATFORM_USES_ONLY_WIN32_API
- // UWP doesn't support tzset or environment variables for tz
-#if U_PLATFORM_HAS_WINUWP_API == 0
+ // UWP doesn't support tzset or environment variables for tz
+#if U_PLATFORM_HAS_WINUWP_API == 0
# define U_TZSET _tzset
-#endif
+#endif
#elif U_PLATFORM == U_PF_OS400
/* not defined */
#else
@@ -111,15 +111,15 @@ typedef size_t uintptr_t;
/* Use the predefined value. */
#elif U_PLATFORM == U_PF_ANDROID
# define U_TIMEZONE timezone
-#elif defined(__UCLIBC__)
- // uClibc does not have __timezone or _timezone.
-#elif defined(_NEWLIB_VERSION)
-# define U_TIMEZONE _timezone
-#elif defined(__GLIBC__)
- // glibc
-# define U_TIMEZONE __timezone
+#elif defined(__UCLIBC__)
+ // uClibc does not have __timezone or _timezone.
+#elif defined(_NEWLIB_VERSION)
+# define U_TIMEZONE _timezone
+#elif defined(__GLIBC__)
+ // glibc
+# define U_TIMEZONE __timezone
#elif U_PLATFORM_IS_LINUX_BASED
- // not defined
+ // not defined
#elif U_PLATFORM_USES_ONLY_WIN32_API
# define U_TIMEZONE _timezone
#elif U_PLATFORM == U_PF_BSD && !defined(__NetBSD__)
@@ -132,13 +132,13 @@ typedef size_t uintptr_t;
# define U_TIMEZONE timezone
#endif
-#if defined(U_TZNAME) || defined(U_HAVE_TZNAME)
+#if defined(U_TZNAME) || defined(U_HAVE_TZNAME)
/* Use the predefined value. */
#elif U_PLATFORM_USES_ONLY_WIN32_API
- /* not usable on all windows platforms */
-#if U_PLATFORM_HAS_WINUWP_API == 0
+ /* not usable on all windows platforms */
+#if U_PLATFORM_HAS_WINUWP_API == 0
# define U_TZNAME _tzname
-#endif
+#endif
#elif U_PLATFORM == U_PF_OS400
/* not defined */
#else
@@ -202,7 +202,7 @@ typedef size_t uintptr_t;
/**
* Platform utilities isolates the platform dependencies of the
- * library. For each platform which this code is ported to, these
+ * library. For each platform which this code is ported to, these
* functions may have to be re-implemented.
*/
@@ -325,32 +325,32 @@ U_INTERNAL double U_EXPORT2 uprv_log(double d);
*/
U_INTERNAL double U_EXPORT2 uprv_round(double x);
-/**
- * Adds the signed integers a and b, storing the result in res.
- * Checks for signed integer overflow.
- * Similar to the GCC/Clang extension __builtin_add_overflow
- *
- * @param a The first operand.
- * @param b The second operand.
- * @param res a + b
- * @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);
-
-/**
- * Multiplies the signed integers a and b, storing the result in res.
- * Checks for signed integer overflow.
- * Similar to the GCC/Clang extension __builtin_mul_overflow
- *
- * @param a The first multiplicand.
- * @param b The second multiplicand.
- * @param res a * b
- * @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);
-
+/**
+ * Adds the signed integers a and b, storing the result in res.
+ * Checks for signed integer overflow.
+ * Similar to the GCC/Clang extension __builtin_add_overflow
+ *
+ * @param a The first operand.
+ * @param b The second operand.
+ * @param res a + b
+ * @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);
+
+/**
+ * Multiplies the signed integers a and b, storing the result in res.
+ * Checks for signed integer overflow.
+ * Similar to the GCC/Clang extension __builtin_mul_overflow
+ *
+ * @param a The first multiplicand.
+ * @param b The second multiplicand.
+ * @param res a * b
+ * @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);
+
#if 0
/**
* Returns the number of digits after the decimal point in a double number x.
@@ -376,7 +376,7 @@ U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void);
/**
* Please use uloc_getDefault() instead.
- * Return the default locale ID string by querying the system, or
+ * Return the default locale ID string by querying the system, or
* zero if one cannot be found.
* This function can call setlocale() on Unix platforms. Please read the
* platform documentation on setlocale() before calling this function.
@@ -520,49 +520,49 @@ U_INTERNAL void * U_EXPORT2 uprv_maximumPtr(void *base);
# endif
#endif
-
-#ifdef __cplusplus
-/**
- * Pin a buffer capacity such that doing pointer arithmetic
- * on the destination pointer and capacity cannot overflow.
- *
- * The pinned capacity must fulfill the following conditions (for positive capacities):
- * - dest + capacity is a valid pointer according to the machine arcitecture (AS/400, 64-bit, etc.)
- * - (dest + capacity) >= dest
- * - The size (in bytes) of T[capacity] does not exceed 0x7fffffff
- *
- * @param dest the destination buffer pointer.
- * @param capacity the requested buffer capacity, in units of type T.
- * @return the pinned capacity.
- * @internal
- */
-template <typename T>
-inline int32_t pinCapacity(T *dest, int32_t capacity) {
- if (capacity <= 0) { return capacity; }
-
- uintptr_t destInt = (uintptr_t)dest;
- uintptr_t maxInt;
-
-# if U_PLATFORM == U_PF_OS390 && !defined(_LP64)
- // We have 31-bit pointers.
- maxInt = 0x7fffffff;
-# elif U_PLATFORM == U_PF_OS400
- maxInt = (uintptr_t)uprv_maximumPtr((void *)dest);
-# else
- maxInt = destInt + 0x7fffffffu;
- if (maxInt < destInt) {
- // Less than 2GB to the end of the address space.
- // Pin to that to prevent address overflow.
- maxInt = (uintptr_t)-1;
- }
-# endif
-
- uintptr_t maxBytes = maxInt - destInt; // max. 2GB
- int32_t maxCapacity = (int32_t)(maxBytes / sizeof(T));
- return capacity <= maxCapacity ? capacity : maxCapacity;
-}
-#endif // __cplusplus
-
+
+#ifdef __cplusplus
+/**
+ * Pin a buffer capacity such that doing pointer arithmetic
+ * on the destination pointer and capacity cannot overflow.
+ *
+ * The pinned capacity must fulfill the following conditions (for positive capacities):
+ * - dest + capacity is a valid pointer according to the machine arcitecture (AS/400, 64-bit, etc.)
+ * - (dest + capacity) >= dest
+ * - The size (in bytes) of T[capacity] does not exceed 0x7fffffff
+ *
+ * @param dest the destination buffer pointer.
+ * @param capacity the requested buffer capacity, in units of type T.
+ * @return the pinned capacity.
+ * @internal
+ */
+template <typename T>
+inline int32_t pinCapacity(T *dest, int32_t capacity) {
+ if (capacity <= 0) { return capacity; }
+
+ uintptr_t destInt = (uintptr_t)dest;
+ uintptr_t maxInt;
+
+# if U_PLATFORM == U_PF_OS390 && !defined(_LP64)
+ // We have 31-bit pointers.
+ maxInt = 0x7fffffff;
+# elif U_PLATFORM == U_PF_OS400
+ maxInt = (uintptr_t)uprv_maximumPtr((void *)dest);
+# else
+ maxInt = destInt + 0x7fffffffu;
+ if (maxInt < destInt) {
+ // Less than 2GB to the end of the address space.
+ // Pin to that to prevent address overflow.
+ maxInt = (uintptr_t)-1;
+ }
+# endif
+
+ uintptr_t maxBytes = maxInt - destInt; // max. 2GB
+ int32_t maxCapacity = (int32_t)(maxBytes / sizeof(T));
+ return capacity <= maxCapacity ? capacity : maxCapacity;
+}
+#endif // __cplusplus
+
/* Dynamic Library Functions */
typedef void (UVoidFunction)(void);
diff --git a/contrib/libs/icu/common/rbbi.cpp b/contrib/libs/icu/common/rbbi.cpp
index ab6add407b..43ba58ba9e 100644
--- a/contrib/libs/icu/common/rbbi.cpp
+++ b/contrib/libs/icu/common/rbbi.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
***************************************************************************
@@ -7,7 +7,7 @@
***************************************************************************
*/
//
-// file: rbbi.cpp Contains the implementation of the rule based break iterator
+// file: rbbi.cpp Contains the implementation of the rule based break iterator
// runtime engine and the API implementation for
// class RuleBasedBreakIterator
//
@@ -18,37 +18,37 @@
#if !UCONFIG_NO_BREAK_ITERATION
-#include <cinttypes>
-
+#include <cinttypes>
+
#include "unicode/rbbi.h"
#include "unicode/schriter.h"
#include "unicode/uchriter.h"
-#include "unicode/uclean.h"
+#include "unicode/uclean.h"
#include "unicode/udata.h"
-
-#include "brkeng.h"
-#include "ucln_cmn.h"
-#include "cmemory.h"
-#include "cstring.h"
-#include "localsvc.h"
+
+#include "brkeng.h"
+#include "ucln_cmn.h"
+#include "cmemory.h"
+#include "cstring.h"
+#include "localsvc.h"
#include "rbbidata.h"
-#include "rbbi_cache.h"
+#include "rbbi_cache.h"
#include "rbbirb.h"
-#include "uassert.h"
+#include "uassert.h"
#include "umutex.h"
-#include "uvectr32.h"
+#include "uvectr32.h"
#ifdef RBBI_DEBUG
-static UBool gTrace = FALSE;
+static UBool gTrace = FALSE;
#endif
U_NAMESPACE_BEGIN
// The state number of the starting state
-constexpr int32_t START_STATE = 1;
+constexpr int32_t START_STATE = 1;
// The state-transition value indicating "stop"
-constexpr int32_t STOP_STATE = 0;
+constexpr int32_t STOP_STATE = 0;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RuleBasedBreakIterator)
@@ -63,9 +63,9 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RuleBasedBreakIterator)
* tables object that is passed in as a parameter.
*/
RuleBasedBreakIterator::RuleBasedBreakIterator(RBBIDataHeader* data, UErrorCode &status)
- : fSCharIter(UnicodeString())
+ : fSCharIter(UnicodeString())
{
- init(status);
+ init(status);
fData = new RBBIDataWrapper(data, status); // status checked in constructor
if (U_FAILURE(status)) {return;}
if(fData == 0) {
@@ -80,10 +80,10 @@ RuleBasedBreakIterator::RuleBasedBreakIterator(RBBIDataHeader* data, UErrorCode
//
RuleBasedBreakIterator::RuleBasedBreakIterator(const uint8_t *compiledRules,
uint32_t ruleLength,
- UErrorCode &status)
- : fSCharIter(UnicodeString())
-{
- init(status);
+ UErrorCode &status)
+ : fSCharIter(UnicodeString())
+{
+ init(status);
if (U_FAILURE(status)) {
return;
}
@@ -96,13 +96,13 @@ RuleBasedBreakIterator::RuleBasedBreakIterator(const uint8_t *compiledRules,
status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
- fData = new RBBIDataWrapper(data, RBBIDataWrapper::kDontAdopt, status);
+ fData = new RBBIDataWrapper(data, RBBIDataWrapper::kDontAdopt, status);
if (U_FAILURE(status)) {return;}
if(fData == 0) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
-}
+}
//-------------------------------------------------------------------------------
@@ -112,9 +112,9 @@ RuleBasedBreakIterator::RuleBasedBreakIterator(const uint8_t *compiledRules,
//
//-------------------------------------------------------------------------------
RuleBasedBreakIterator::RuleBasedBreakIterator(UDataMemory* udm, UErrorCode &status)
- : fSCharIter(UnicodeString())
+ : fSCharIter(UnicodeString())
{
- init(status);
+ init(status);
fData = new RBBIDataWrapper(udm, status); // status checked in constructor
if (U_FAILURE(status)) {return;}
if(fData == 0) {
@@ -133,9 +133,9 @@ RuleBasedBreakIterator::RuleBasedBreakIterator(UDataMemory* udm, UErrorCode &sta
RuleBasedBreakIterator::RuleBasedBreakIterator( const UnicodeString &rules,
UParseError &parseError,
UErrorCode &status)
- : fSCharIter(UnicodeString())
+ : fSCharIter(UnicodeString())
{
- init(status);
+ init(status);
if (U_FAILURE(status)) {return;}
RuleBasedBreakIterator *bi = (RuleBasedBreakIterator *)
RBBIRuleBuilder::createRuleBasedBreakIterator(rules, &parseError, status);
@@ -156,11 +156,11 @@ RuleBasedBreakIterator::RuleBasedBreakIterator( const UnicodeString &rules,
// Used when creating a RuleBasedBreakIterator from a set
// of rules.
//-------------------------------------------------------------------------------
-RuleBasedBreakIterator::RuleBasedBreakIterator()
- : fSCharIter(UnicodeString())
-{
- UErrorCode status = U_ZERO_ERROR;
- init(status);
+RuleBasedBreakIterator::RuleBasedBreakIterator()
+ : fSCharIter(UnicodeString())
+{
+ UErrorCode status = U_ZERO_ERROR;
+ init(status);
}
@@ -171,11 +171,11 @@ RuleBasedBreakIterator::RuleBasedBreakIterator()
//
//-------------------------------------------------------------------------------
RuleBasedBreakIterator::RuleBasedBreakIterator(const RuleBasedBreakIterator& other)
-: BreakIterator(other),
- fSCharIter(UnicodeString())
+: BreakIterator(other),
+ fSCharIter(UnicodeString())
{
- UErrorCode status = U_ZERO_ERROR;
- this->init(status);
+ UErrorCode status = U_ZERO_ERROR;
+ this->init(status);
*this = other;
}
@@ -184,29 +184,29 @@ RuleBasedBreakIterator::RuleBasedBreakIterator(const RuleBasedBreakIterator& oth
* Destructor
*/
RuleBasedBreakIterator::~RuleBasedBreakIterator() {
- if (fCharIter != &fSCharIter) {
+ if (fCharIter != &fSCharIter) {
// fCharIter was adopted from the outside.
delete fCharIter;
}
fCharIter = NULL;
- utext_close(&fText);
-
+ utext_close(&fText);
+
if (fData != NULL) {
fData->removeReference();
fData = NULL;
}
- delete fBreakCache;
- fBreakCache = NULL;
-
- delete fDictionaryCache;
- fDictionaryCache = NULL;
-
- delete fLanguageBreakEngines;
- fLanguageBreakEngines = NULL;
-
- delete fUnhandledBreakEngine;
- fUnhandledBreakEngine = NULL;
+ delete fBreakCache;
+ fBreakCache = NULL;
+
+ delete fDictionaryCache;
+ fDictionaryCache = NULL;
+
+ delete fLanguageBreakEngines;
+ fLanguageBreakEngines = NULL;
+
+ delete fUnhandledBreakEngine;
+ fUnhandledBreakEngine = NULL;
}
/**
@@ -218,31 +218,31 @@ RuleBasedBreakIterator::operator=(const RuleBasedBreakIterator& that) {
if (this == &that) {
return *this;
}
- BreakIterator::operator=(that);
-
+ BreakIterator::operator=(that);
+
if (fLanguageBreakEngines != NULL) {
delete fLanguageBreakEngines;
fLanguageBreakEngines = NULL; // Just rebuild for now
}
// TODO: clone fLanguageBreakEngines from "that"
UErrorCode status = U_ZERO_ERROR;
- utext_clone(&fText, &that.fText, FALSE, TRUE, &status);
+ utext_clone(&fText, &that.fText, FALSE, TRUE, &status);
- if (fCharIter != &fSCharIter) {
+ if (fCharIter != &fSCharIter) {
delete fCharIter;
}
- fCharIter = &fSCharIter;
+ fCharIter = &fSCharIter;
- if (that.fCharIter != NULL && that.fCharIter != &that.fSCharIter) {
+ if (that.fCharIter != NULL && that.fCharIter != &that.fSCharIter) {
// This is a little bit tricky - it will intially appear that
// this->fCharIter is adopted, even if that->fCharIter was
// not adopted. That's ok.
fCharIter = that.fCharIter->clone();
}
- fSCharIter = that.fSCharIter;
- if (fCharIter == NULL) {
- fCharIter = &fSCharIter;
- }
+ fSCharIter = that.fSCharIter;
+ if (fCharIter == NULL) {
+ fCharIter = &fSCharIter;
+ }
if (fData != NULL) {
fData->removeReference();
@@ -252,17 +252,17 @@ RuleBasedBreakIterator::operator=(const RuleBasedBreakIterator& that) {
fData = that.fData->addReference();
}
- fPosition = that.fPosition;
- fRuleStatusIndex = that.fRuleStatusIndex;
- fDone = that.fDone;
-
- // TODO: both the dictionary and the main cache need to be copied.
- // Current position could be within a dictionary range. Trying to continue
- // the iteration without the caches present would go to the rules, with
- // the assumption that the current position is on a rule boundary.
- fBreakCache->reset(fPosition, fRuleStatusIndex);
- fDictionaryCache->reset();
-
+ fPosition = that.fPosition;
+ fRuleStatusIndex = that.fRuleStatusIndex;
+ fDone = that.fDone;
+
+ // TODO: both the dictionary and the main cache need to be copied.
+ // Current position could be within a dictionary range. Trying to continue
+ // the iteration without the caches present would go to the rules, with
+ // the assumption that the current position is on a rule boundary.
+ fBreakCache->reset(fPosition, fRuleStatusIndex);
+ fDictionaryCache->reset();
+
return *this;
}
@@ -274,40 +274,40 @@ RuleBasedBreakIterator::operator=(const RuleBasedBreakIterator& that) {
// Initializes all fields, leaving the object in a consistent state.
//
//-----------------------------------------------------------------------------
-void RuleBasedBreakIterator::init(UErrorCode &status) {
+void RuleBasedBreakIterator::init(UErrorCode &status) {
fCharIter = NULL;
fData = NULL;
- fPosition = 0;
- fRuleStatusIndex = 0;
- fDone = false;
+ fPosition = 0;
+ fRuleStatusIndex = 0;
+ fDone = false;
fDictionaryCharCount = 0;
- fLanguageBreakEngines = NULL;
- fUnhandledBreakEngine = NULL;
- fBreakCache = NULL;
- fDictionaryCache = NULL;
-
- // Note: IBM xlC is unable to assign or initialize member fText from UTEXT_INITIALIZER.
- // fText = UTEXT_INITIALIZER;
- static const UText initializedUText = UTEXT_INITIALIZER;
- uprv_memcpy(&fText, &initializedUText, sizeof(UText));
-
- if (U_FAILURE(status)) {
- return;
- }
-
- utext_openUChars(&fText, NULL, 0, &status);
- fDictionaryCache = new DictionaryCache(this, status);
- fBreakCache = new BreakCache(this, status);
- if (U_SUCCESS(status) && (fDictionaryCache == NULL || fBreakCache == NULL)) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
-
+ fLanguageBreakEngines = NULL;
+ fUnhandledBreakEngine = NULL;
+ fBreakCache = NULL;
+ fDictionaryCache = NULL;
+
+ // Note: IBM xlC is unable to assign or initialize member fText from UTEXT_INITIALIZER.
+ // fText = UTEXT_INITIALIZER;
+ static const UText initializedUText = UTEXT_INITIALIZER;
+ uprv_memcpy(&fText, &initializedUText, sizeof(UText));
+
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ utext_openUChars(&fText, NULL, 0, &status);
+ fDictionaryCache = new DictionaryCache(this, status);
+ fBreakCache = new BreakCache(this, status);
+ if (U_SUCCESS(status) && (fDictionaryCache == NULL || fBreakCache == NULL)) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
+
#ifdef RBBI_DEBUG
static UBool debugInitDone = FALSE;
if (debugInitDone == FALSE) {
char *debugEnv = getenv("U_RBBIDEBUG");
if (debugEnv && uprv_strstr(debugEnv, "trace")) {
- gTrace = TRUE;
+ gTrace = TRUE;
}
debugInitDone = TRUE;
}
@@ -323,8 +323,8 @@ void RuleBasedBreakIterator::init(UErrorCode &status) {
// Virtual function: does the right thing with subclasses.
//
//-----------------------------------------------------------------------------
-RuleBasedBreakIterator*
-RuleBasedBreakIterator::clone() const {
+RuleBasedBreakIterator*
+RuleBasedBreakIterator::clone() const {
return new RuleBasedBreakIterator(*this);
}
@@ -337,28 +337,28 @@ RuleBasedBreakIterator::operator==(const BreakIterator& that) const {
if (typeid(*this) != typeid(that)) {
return FALSE;
}
- if (this == &that) {
- return TRUE;
- }
+ if (this == &that) {
+ return TRUE;
+ }
+
+ // The base class BreakIterator carries no state that participates in equality,
+ // and does not implement an equality function that would otherwise be
+ // checked at this point.
- // The base class BreakIterator carries no state that participates in equality,
- // and does not implement an equality function that would otherwise be
- // checked at this point.
-
const RuleBasedBreakIterator& that2 = (const RuleBasedBreakIterator&) that;
- if (!utext_equals(&fText, &that2.fText)) {
+ if (!utext_equals(&fText, &that2.fText)) {
// The two break iterators are operating on different text,
- // or have a different iteration position.
- // Note that fText's position is always the same as the break iterator's position.
+ // or have a different iteration position.
+ // Note that fText's position is always the same as the break iterator's position.
return FALSE;
- }
+ }
- if (!(fPosition == that2.fPosition &&
- fRuleStatusIndex == that2.fRuleStatusIndex &&
- fDone == that2.fDone)) {
- return FALSE;
- }
+ if (!(fPosition == that2.fPosition &&
+ fRuleStatusIndex == that2.fRuleStatusIndex &&
+ fDone == that2.fDone)) {
+ return FALSE;
+ }
if (that2.fData == fData ||
(fData != NULL && that2.fData != NULL && *that2.fData == *fData)) {
@@ -386,9 +386,9 @@ void RuleBasedBreakIterator::setText(UText *ut, UErrorCode &status) {
if (U_FAILURE(status)) {
return;
}
- fBreakCache->reset();
- fDictionaryCache->reset();
- utext_clone(&fText, ut, FALSE, TRUE, &status);
+ fBreakCache->reset();
+ fDictionaryCache->reset();
+ utext_clone(&fText, ut, FALSE, TRUE, &status);
// Set up a dummy CharacterIterator to be returned if anyone
// calls getText(). With input from UText, there is no reasonable
@@ -396,20 +396,20 @@ void RuleBasedBreakIterator::setText(UText *ut, UErrorCode &status) {
// Return one over an empty string instead - this is the closest
// we can come to signaling a failure.
// (GetText() is obsolete, this failure is sort of OK)
- fSCharIter.setText(UnicodeString());
+ fSCharIter.setText(UnicodeString());
- if (fCharIter != &fSCharIter) {
+ if (fCharIter != &fSCharIter) {
// existing fCharIter was adopted from the outside. Delete it now.
delete fCharIter;
}
- fCharIter = &fSCharIter;
+ fCharIter = &fSCharIter;
this->first();
}
UText *RuleBasedBreakIterator::getUText(UText *fillIn, UErrorCode &status) const {
- UText *result = utext_clone(fillIn, &fText, FALSE, TRUE, &status);
+ UText *result = utext_clone(fillIn, &fText, FALSE, TRUE, &status);
return result;
}
@@ -419,7 +419,7 @@ UText *RuleBasedBreakIterator::getUText(UText *fillIn, UErrorCode &status) const
//=======================================================================
/**
- * Return a CharacterIterator over the text being analyzed.
+ * Return a CharacterIterator over the text being analyzed.
*/
CharacterIterator&
RuleBasedBreakIterator::getText() const {
@@ -433,22 +433,22 @@ RuleBasedBreakIterator::getText() const {
*/
void
RuleBasedBreakIterator::adoptText(CharacterIterator* newText) {
- // If we are holding a CharacterIterator adopted from a
+ // If we are holding a CharacterIterator adopted from a
// previous call to this function, delete it now.
- if (fCharIter != &fSCharIter) {
+ if (fCharIter != &fSCharIter) {
delete fCharIter;
}
fCharIter = newText;
UErrorCode status = U_ZERO_ERROR;
- fBreakCache->reset();
- fDictionaryCache->reset();
- if (newText==NULL || newText->startIndex() != 0) {
+ fBreakCache->reset();
+ fDictionaryCache->reset();
+ if (newText==NULL || newText->startIndex() != 0) {
// startIndex !=0 wants to be an error, but there's no way to report it.
// Make the iterator text be an empty string.
- utext_openUChars(&fText, NULL, 0, &status);
+ utext_openUChars(&fText, NULL, 0, &status);
} else {
- utext_openCharacterIterator(&fText, newText, &status);
+ utext_openCharacterIterator(&fText, newText, &status);
}
this->first();
}
@@ -461,21 +461,21 @@ RuleBasedBreakIterator::adoptText(CharacterIterator* newText) {
void
RuleBasedBreakIterator::setText(const UnicodeString& newText) {
UErrorCode status = U_ZERO_ERROR;
- fBreakCache->reset();
- fDictionaryCache->reset();
- utext_openConstUnicodeString(&fText, &newText, &status);
+ fBreakCache->reset();
+ fDictionaryCache->reset();
+ utext_openConstUnicodeString(&fText, &newText, &status);
- // Set up a character iterator on the string.
+ // Set up a character iterator on the string.
// Needed in case someone calls getText().
// Can not, unfortunately, do this lazily on the (probably never)
// call to getText(), because getText is const.
- fSCharIter.setText(newText);
+ fSCharIter.setText(newText);
- if (fCharIter != &fSCharIter) {
+ if (fCharIter != &fSCharIter) {
// old fCharIter was adopted from the outside. Delete it.
delete fCharIter;
}
- fCharIter = &fSCharIter;
+ fCharIter = &fSCharIter;
this->first();
}
@@ -495,14 +495,14 @@ RuleBasedBreakIterator &RuleBasedBreakIterator::refreshInputText(UText *input, U
status = U_ILLEGAL_ARGUMENT_ERROR;
return *this;
}
- int64_t pos = utext_getNativeIndex(&fText);
+ int64_t pos = utext_getNativeIndex(&fText);
// Shallow read-only clone of the new UText into the existing input UText
- utext_clone(&fText, input, FALSE, TRUE, &status);
+ utext_clone(&fText, input, FALSE, TRUE, &status);
if (U_FAILURE(status)) {
return *this;
}
- utext_setNativeIndex(&fText, pos);
- if (utext_getNativeIndex(&fText) != pos) {
+ utext_setNativeIndex(&fText, pos);
+ if (utext_getNativeIndex(&fText) != pos) {
// Sanity check. The new input utext is supposed to have the exact same
// contents as the old. If we can't set to the same position, it doesn't.
// The contents underlying the old utext might be invalid at this point,
@@ -518,12 +518,12 @@ RuleBasedBreakIterator &RuleBasedBreakIterator::refreshInputText(UText *input, U
* @return The new iterator position, which is zero.
*/
int32_t RuleBasedBreakIterator::first(void) {
- UErrorCode status = U_ZERO_ERROR;
- if (!fBreakCache->seek(0)) {
- fBreakCache->populateNear(0, status);
- }
- fBreakCache->current();
- U_ASSERT(fPosition == 0);
+ UErrorCode status = U_ZERO_ERROR;
+ if (!fBreakCache->seek(0)) {
+ fBreakCache->populateNear(0, status);
+ }
+ fBreakCache->current();
+ U_ASSERT(fPosition == 0);
return 0;
}
@@ -532,12 +532,12 @@ int32_t RuleBasedBreakIterator::first(void) {
* @return The text's past-the-end offset.
*/
int32_t RuleBasedBreakIterator::last(void) {
- int32_t endPos = (int32_t)utext_nativeLength(&fText);
- UBool endShouldBeBoundary = isBoundary(endPos); // Has side effect of setting iterator position.
- (void)endShouldBeBoundary;
- U_ASSERT(endShouldBeBoundary);
- U_ASSERT(fPosition == endPos);
- return endPos;
+ int32_t endPos = (int32_t)utext_nativeLength(&fText);
+ UBool endShouldBeBoundary = isBoundary(endPos); // Has side effect of setting iterator position.
+ (void)endShouldBeBoundary;
+ U_ASSERT(endShouldBeBoundary);
+ U_ASSERT(fPosition == endPos);
+ return endPos;
}
/**
@@ -550,17 +550,17 @@ int32_t RuleBasedBreakIterator::last(void) {
* the current one.
*/
int32_t RuleBasedBreakIterator::next(int32_t n) {
- int32_t result = 0;
- if (n > 0) {
- for (; n > 0 && result != UBRK_DONE; --n) {
- result = next();
- }
- } else if (n < 0) {
- for (; n < 0 && result != UBRK_DONE; ++n) {
- result = previous();
- }
- } else {
- result = current();
+ int32_t result = 0;
+ if (n > 0) {
+ for (; n > 0 && result != UBRK_DONE; --n) {
+ result = next();
+ }
+ } else if (n < 0) {
+ for (; n < 0 && result != UBRK_DONE; ++n) {
+ result = previous();
+ }
+ } else {
+ result = current();
}
return result;
}
@@ -570,74 +570,74 @@ int32_t RuleBasedBreakIterator::next(int32_t n) {
* @return The position of the first boundary after this one.
*/
int32_t RuleBasedBreakIterator::next(void) {
- fBreakCache->next();
- return fDone ? UBRK_DONE : fPosition;
+ fBreakCache->next();
+ return fDone ? UBRK_DONE : fPosition;
}
/**
- * Move the iterator backwards, to the boundary preceding the current one.
- *
- * Starts from the current position within fText.
- * Starting position need not be on a boundary.
- *
- * @return The position of the boundary position immediately preceding the starting position.
+ * Move the iterator backwards, to the boundary preceding the current one.
+ *
+ * Starts from the current position within fText.
+ * Starting position need not be on a boundary.
+ *
+ * @return The position of the boundary position immediately preceding the starting position.
*/
int32_t RuleBasedBreakIterator::previous(void) {
- UErrorCode status = U_ZERO_ERROR;
- fBreakCache->previous(status);
- return fDone ? UBRK_DONE : fPosition;
+ UErrorCode status = U_ZERO_ERROR;
+ fBreakCache->previous(status);
+ return fDone ? UBRK_DONE : fPosition;
}
/**
* Sets the iterator to refer to the first boundary position following
* the specified position.
- * @param startPos The position from which to begin searching for a break position.
+ * @param startPos The position from which to begin searching for a break position.
* @return The position of the first break after the current position.
*/
-int32_t RuleBasedBreakIterator::following(int32_t startPos) {
- // if the supplied position is before the beginning, return the
+int32_t RuleBasedBreakIterator::following(int32_t startPos) {
+ // if the supplied position is before the beginning, return the
// text's starting offset
- if (startPos < 0) {
+ if (startPos < 0) {
return first();
}
// Move requested offset to a code point start. It might be on a trail surrogate,
- // or on a trail byte if the input is UTF-8. Or it may be beyond the end of the text.
- utext_setNativeIndex(&fText, startPos);
- startPos = (int32_t)utext_getNativeIndex(&fText);
+ // or on a trail byte if the input is UTF-8. Or it may be beyond the end of the text.
+ utext_setNativeIndex(&fText, startPos);
+ startPos = (int32_t)utext_getNativeIndex(&fText);
- UErrorCode status = U_ZERO_ERROR;
- fBreakCache->following(startPos, status);
- return fDone ? UBRK_DONE : fPosition;
+ UErrorCode status = U_ZERO_ERROR;
+ fBreakCache->following(startPos, status);
+ return fDone ? UBRK_DONE : fPosition;
}
/**
* Sets the iterator to refer to the last boundary position before the
* specified position.
- * @param offset The position to begin searching for a break from.
+ * @param offset The position to begin searching for a break from.
* @return The position of the last boundary before the starting position.
*/
int32_t RuleBasedBreakIterator::preceding(int32_t offset) {
- if (offset > utext_nativeLength(&fText)) {
+ if (offset > utext_nativeLength(&fText)) {
return last();
}
// Move requested offset to a code point start. It might be on a trail surrogate,
// or on a trail byte if the input is UTF-8.
- utext_setNativeIndex(&fText, offset);
- int32_t adjustedOffset = static_cast<int32_t>(utext_getNativeIndex(&fText));
+ utext_setNativeIndex(&fText, offset);
+ int32_t adjustedOffset = static_cast<int32_t>(utext_getNativeIndex(&fText));
- UErrorCode status = U_ZERO_ERROR;
- fBreakCache->preceding(adjustedOffset, status);
- return fDone ? UBRK_DONE : fPosition;
+ UErrorCode status = U_ZERO_ERROR;
+ fBreakCache->preceding(adjustedOffset, status);
+ return fDone ? UBRK_DONE : fPosition;
}
/**
* Returns true if the specfied position is a boundary position. As a side
* effect, leaves the iterator pointing to the first boundary position at
* or after "offset".
- *
+ *
* @param offset the offset to check.
* @return True if "offset" is a boundary position.
*/
@@ -648,42 +648,42 @@ UBool RuleBasedBreakIterator::isBoundary(int32_t offset) {
return FALSE;
}
- // Adjust offset to be on a code point boundary and not beyond the end of the text.
- // Note that isBoundary() is always false for offsets that are not on code point boundaries.
- // But we still need the side effect of leaving iteration at the following boundary.
-
- utext_setNativeIndex(&fText, offset);
- int32_t adjustedOffset = static_cast<int32_t>(utext_getNativeIndex(&fText));
-
- bool result = false;
- UErrorCode status = U_ZERO_ERROR;
- if (fBreakCache->seek(adjustedOffset) || fBreakCache->populateNear(adjustedOffset, status)) {
- result = (fBreakCache->current() == offset);
- }
-
- if (result && adjustedOffset < offset && utext_char32At(&fText, offset) == U_SENTINEL) {
- // Original offset is beyond the end of the text. Return FALSE, it's not a boundary,
- // but the iteration position remains set to the end of the text, which is a boundary.
+ // Adjust offset to be on a code point boundary and not beyond the end of the text.
+ // Note that isBoundary() is always false for offsets that are not on code point boundaries.
+ // But we still need the side effect of leaving iteration at the following boundary.
+
+ utext_setNativeIndex(&fText, offset);
+ int32_t adjustedOffset = static_cast<int32_t>(utext_getNativeIndex(&fText));
+
+ bool result = false;
+ UErrorCode status = U_ZERO_ERROR;
+ if (fBreakCache->seek(adjustedOffset) || fBreakCache->populateNear(adjustedOffset, status)) {
+ result = (fBreakCache->current() == offset);
+ }
+
+ if (result && adjustedOffset < offset && utext_char32At(&fText, offset) == U_SENTINEL) {
+ // Original offset is beyond the end of the text. Return FALSE, it's not a boundary,
+ // but the iteration position remains set to the end of the text, which is a boundary.
return FALSE;
}
- if (!result) {
- // Not on a boundary. isBoundary() must leave iterator on the following boundary.
- // Cache->seek(), above, left us on the preceding boundary, so advance one.
- next();
- }
+ if (!result) {
+ // Not on a boundary. isBoundary() must leave iterator on the following boundary.
+ // Cache->seek(), above, left us on the preceding boundary, so advance one.
+ next();
+ }
return result;
}
-
+
/**
* Returns the current iteration position.
* @return The current iteration position.
*/
int32_t RuleBasedBreakIterator::current(void) const {
- return fPosition;
+ return fPosition;
}
-
-
+
+
//=======================================================================
// implementation
//=======================================================================
@@ -716,7 +716,7 @@ struct LookAheadResults {
int32_t fPositions[8];
int16_t fKeys[8];
- LookAheadResults() : fUsedSlotLimit(0), fPositions(), fKeys() {}
+ LookAheadResults() : fUsedSlotLimit(0), fPositions(), fKeys() {}
int32_t getPosition(int16_t key) {
for (int32_t i=0; i<fUsedSlotLimit; ++i) {
@@ -724,7 +724,7 @@ struct LookAheadResults {
return fPositions[i];
}
}
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
void setPosition(int16_t key, int32_t position) {
@@ -736,7 +736,7 @@ struct LookAheadResults {
}
}
if (i >= kMaxLookaheads) {
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
fKeys[i] = key;
fPositions[i] = position;
@@ -748,43 +748,43 @@ struct LookAheadResults {
//-----------------------------------------------------------------------------------
//
-// handleNext()
-// Run the state machine to find a boundary
+// handleNext()
+// Run the state machine to find a boundary
//
//-----------------------------------------------------------------------------------
-int32_t RuleBasedBreakIterator::handleNext() {
+int32_t RuleBasedBreakIterator::handleNext() {
int32_t state;
uint16_t category = 0;
RBBIRunMode mode;
-
+
RBBIStateTableRow *row;
UChar32 c;
LookAheadResults lookAheadMatches;
int32_t result = 0;
int32_t initialPosition = 0;
- const RBBIStateTable *statetable = fData->fForwardTable;
+ const RBBIStateTable *statetable = fData->fForwardTable;
const char *tableData = statetable->fTableData;
uint32_t tableRowLen = statetable->fRowLen;
#ifdef RBBI_DEBUG
- if (gTrace) {
+ if (gTrace) {
RBBIDebugPuts("Handle Next pos char state category");
}
#endif
- // handleNext alway sets the break tag value.
- // Set the default for it.
- fRuleStatusIndex = 0;
+ // handleNext alway sets the break tag value.
+ // Set the default for it.
+ fRuleStatusIndex = 0;
+
+ fDictionaryCharCount = 0;
- fDictionaryCharCount = 0;
-
// if we're already at the end of the text, return DONE.
- initialPosition = fPosition;
- UTEXT_SETNATIVEINDEX(&fText, initialPosition);
+ initialPosition = fPosition;
+ UTEXT_SETNATIVEINDEX(&fText, initialPosition);
result = initialPosition;
- c = UTEXT_NEXT32(&fText);
- if (c==U_SENTINEL) {
- fDone = TRUE;
- return UBRK_DONE;
+ c = UTEXT_NEXT32(&fText);
+ if (c==U_SENTINEL) {
+ fDone = TRUE;
+ return UBRK_DONE;
}
// Set the initial state for the state machine
@@ -792,8 +792,8 @@ int32_t RuleBasedBreakIterator::handleNext() {
row = (RBBIStateTableRow *)
//(statetable->fTableData + (statetable->fRowLen * state));
(tableData + tableRowLen * state);
-
-
+
+
mode = RBBI_RUN;
if (statetable->fFlags & RBBI_BOF_REQUIRED) {
category = 2;
@@ -807,7 +807,7 @@ int32_t RuleBasedBreakIterator::handleNext() {
if (c == U_SENTINEL) {
// Reached end of input string.
if (mode == RBBI_END) {
- // We have already run the loop one last time with the
+ // We have already run the loop one last time with the
// character set to the psueudo {eof} value. Now it is time
// to unconditionally bail out.
break;
@@ -828,10 +828,10 @@ int32_t RuleBasedBreakIterator::handleNext() {
// 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);
+ category = UTRIE2_GET16(fData->fTrie, c);
// Check the dictionary bit in the character's category.
- // Counter is only used by dictionary based iteration.
+ // 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.
//
@@ -843,8 +843,8 @@ int32_t RuleBasedBreakIterator::handleNext() {
}
#ifdef RBBI_DEBUG
- if (gTrace) {
- RBBIDebugPrintf(" %4" PRId64 " ", utext_getNativeIndex(&fText));
+ if (gTrace) {
+ RBBIDebugPrintf(" %4" PRId64 " ", utext_getNativeIndex(&fText));
if (0x20<=c && c<0x7f) {
RBBIDebugPrintf("\"%c\" ", c);
} else {
@@ -857,7 +857,7 @@ int32_t RuleBasedBreakIterator::handleNext() {
// State Transition - move machine to its next state
//
- // fNextState is a variable-length array.
+ // fNextState is a variable-length array.
U_ASSERT(category<fData->fHeader->fCatCount);
state = row->fNextState[category]; /*Not accessing beyond memory*/
row = (RBBIStateTableRow *)
@@ -868,31 +868,31 @@ int32_t RuleBasedBreakIterator::handleNext() {
if (row->fAccepting == -1) {
// Match found, common case.
if (mode != RBBI_START) {
- result = (int32_t)UTEXT_GETNATIVEINDEX(&fText);
+ result = (int32_t)UTEXT_GETNATIVEINDEX(&fText);
}
- fRuleStatusIndex = row->fTagIdx; // Remember the break status (tag) values.
+ fRuleStatusIndex = row->fTagIdx; // Remember the break status (tag) values.
}
int16_t completedRule = row->fAccepting;
if (completedRule > 0) {
- // Lookahead match is completed.
+ // Lookahead match is completed.
int32_t lookaheadResult = lookAheadMatches.getPosition(completedRule);
if (lookaheadResult >= 0) {
- fRuleStatusIndex = row->fTagIdx;
- fPosition = lookaheadResult;
+ fRuleStatusIndex = row->fTagIdx;
+ fPosition = lookaheadResult;
return lookaheadResult;
}
}
-
- // If we are at the position of the '/' in a look-ahead (hard break) rule;
- // record the current position, to be returned later, if the full rule matches.
- // TODO: Move this check before the previous check of fAccepting.
- // This would enable hard-break rules with no following context.
- // But there are line break test failures when trying this. Investigate.
- // Issue ICU-20837
+
+ // If we are at the position of the '/' in a look-ahead (hard break) rule;
+ // record the current position, to be returned later, if the full rule matches.
+ // TODO: Move this check before the previous check of fAccepting.
+ // 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) {
- int32_t pos = (int32_t)UTEXT_GETNATIVEINDEX(&fText);
+ int32_t pos = (int32_t)UTEXT_GETNATIVEINDEX(&fText);
lookAheadMatches.setPosition(rule, pos);
}
@@ -902,13 +902,13 @@ int32_t RuleBasedBreakIterator::handleNext() {
// longer match is possible, no matter what characters follow.
break;
}
-
- // Advance to the next character.
+
+ // Advance to the next character.
// If this is a beginning-of-input loop iteration, don't advance
// the input position. The next iteration will be processing the
// first real input character.
if (mode == RBBI_RUN) {
- c = UTEXT_NEXT32(&fText);
+ c = UTEXT_NEXT32(&fText);
} else {
if (mode == RBBI_START) {
mode = RBBI_RUN;
@@ -922,16 +922,16 @@ int32_t RuleBasedBreakIterator::handleNext() {
// (This really indicates a defect in the break rules. They should always match
// at least one character.)
if (result == initialPosition) {
- utext_setNativeIndex(&fText, initialPosition);
- utext_next32(&fText);
- result = (int32_t)utext_getNativeIndex(&fText);
- fRuleStatusIndex = 0;
+ utext_setNativeIndex(&fText, initialPosition);
+ utext_next32(&fText);
+ result = (int32_t)utext_getNativeIndex(&fText);
+ fRuleStatusIndex = 0;
}
// Leave the iterator at our result position.
- fPosition = result;
+ fPosition = result;
#ifdef RBBI_DEBUG
- if (gTrace) {
+ if (gTrace) {
RBBIDebugPrintf("result = %d\n\n", result);
}
#endif
@@ -941,55 +941,55 @@ int32_t RuleBasedBreakIterator::handleNext() {
//-----------------------------------------------------------------------------------
//
-// handleSafePrevious()
+// handleSafePrevious()
//
-// Iterate backwards using the safe reverse rules.
-// The logic of this function is similar to handleNext(), but simpler
-// because the safe table does not require as many options.
+// Iterate backwards using the safe reverse rules.
+// The logic of this function is similar to handleNext(), but simpler
+// because the safe table does not require as many options.
//
//-----------------------------------------------------------------------------------
-int32_t RuleBasedBreakIterator::handleSafePrevious(int32_t fromPosition) {
+int32_t RuleBasedBreakIterator::handleSafePrevious(int32_t fromPosition) {
int32_t state;
uint16_t category = 0;
RBBIStateTableRow *row;
UChar32 c;
int32_t result = 0;
- const RBBIStateTable *stateTable = fData->fReverseTable;
- UTEXT_SETNATIVEINDEX(&fText, fromPosition);
+ const RBBIStateTable *stateTable = fData->fReverseTable;
+ UTEXT_SETNATIVEINDEX(&fText, fromPosition);
#ifdef RBBI_DEBUG
- if (gTrace) {
+ if (gTrace) {
RBBIDebugPuts("Handle Previous pos char state category");
}
#endif
// if we're already at the start of the text, return DONE.
- if (fData == NULL || UTEXT_GETNATIVEINDEX(&fText)==0) {
+ if (fData == NULL || UTEXT_GETNATIVEINDEX(&fText)==0) {
return BreakIterator::DONE;
}
// Set the initial state for the state machine
- c = UTEXT_PREVIOUS32(&fText);
+ c = UTEXT_PREVIOUS32(&fText);
state = START_STATE;
row = (RBBIStateTableRow *)
- (stateTable->fTableData + (stateTable->fRowLen * state));
+ (stateTable->fTableData + (stateTable->fRowLen * state));
// loop until we reach the start of the text or transition to state 0
//
- for (; c != U_SENTINEL; c = UTEXT_PREVIOUS32(&fText)) {
+ for (; c != U_SENTINEL; c = UTEXT_PREVIOUS32(&fText)) {
- // 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.
+ // 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;
+ // And off the dictionary flag bit. For reverse iteration it is not used.
+ category = UTRIE2_GET16(fData->fTrie, c);
+ category &= ~0x4000;
#ifdef RBBI_DEBUG
- if (gTrace) {
- RBBIDebugPrintf(" %4d ", (int32_t)utext_getNativeIndex(&fText));
+ if (gTrace) {
+ RBBIDebugPrintf(" %4d ", (int32_t)utext_getNativeIndex(&fText));
if (0x20<=c && c<0x7f) {
RBBIDebugPrintf("\"%c\" ", c);
} else {
@@ -1001,23 +1001,23 @@ int32_t RuleBasedBreakIterator::handleSafePrevious(int32_t fromPosition) {
// State Transition - move machine to its next state
//
- // fNextState is a variable-length array.
+ // fNextState is a variable-length array.
U_ASSERT(category<fData->fHeader->fCatCount);
state = row->fNextState[category]; /*Not accessing beyond memory*/
row = (RBBIStateTableRow *)
- (stateTable->fTableData + (stateTable->fRowLen * state));
+ (stateTable->fTableData + (stateTable->fRowLen * state));
if (state == STOP_STATE) {
// This is the normal exit from the lookup state machine.
- // Transistion to state zero means we have found a safe point.
+ // Transistion to state zero means we have found a safe point.
break;
}
}
// The state machine is done. Check whether it found a match...
- result = (int32_t)UTEXT_GETNATIVEINDEX(&fText);
+ result = (int32_t)UTEXT_GETNATIVEINDEX(&fText);
#ifdef RBBI_DEBUG
- if (gTrace) {
+ if (gTrace) {
RBBIDebugPrintf("result = %d\n\n", result);
}
#endif
@@ -1038,7 +1038,7 @@ int32_t RuleBasedBreakIterator::getRuleStatus() const {
// fLastRuleStatusIndex indexes to the start of the appropriate status record
// (the number of status values.)
// This function returns the last (largest) of the array of status values.
- int32_t idx = fRuleStatusIndex + fData->fRuleStatusTable[fRuleStatusIndex];
+ int32_t idx = fRuleStatusIndex + fData->fRuleStatusTable[fRuleStatusIndex];
int32_t tagVal = fData->fRuleStatusTable[idx];
return tagVal;
@@ -1046,12 +1046,12 @@ int32_t RuleBasedBreakIterator::getRuleStatus() const {
int32_t RuleBasedBreakIterator::getRuleStatusVec(
- int32_t *fillInVec, int32_t capacity, UErrorCode &status) {
+ int32_t *fillInVec, int32_t capacity, UErrorCode &status) {
if (U_FAILURE(status)) {
return 0;
}
- int32_t numVals = fData->fRuleStatusTable[fRuleStatusIndex];
+ int32_t numVals = fData->fRuleStatusTable[fRuleStatusIndex];
int32_t numValsToCopy = numVals;
if (numVals > capacity) {
status = U_BUFFER_OVERFLOW_ERROR;
@@ -1059,7 +1059,7 @@ int32_t RuleBasedBreakIterator::getRuleStatusVec(
}
int i;
for (i=0; i<numValsToCopy; i++) {
- fillInVec[i] = fData->fRuleStatusTable[fRuleStatusIndex + i + 1];
+ fillInVec[i] = fData->fRuleStatusTable[fRuleStatusIndex + i + 1];
}
return numVals;
}
@@ -1085,8 +1085,8 @@ const uint8_t *RuleBasedBreakIterator::getBinaryRules(uint32_t &length) {
}
-RuleBasedBreakIterator *RuleBasedBreakIterator::createBufferClone(
- void * /*stackBuffer*/, int32_t &bufferSize, UErrorCode &status) {
+RuleBasedBreakIterator *RuleBasedBreakIterator::createBufferClone(
+ void * /*stackBuffer*/, int32_t &bufferSize, UErrorCode &status) {
if (U_FAILURE(status)){
return NULL;
}
@@ -1108,22 +1108,22 @@ RuleBasedBreakIterator *RuleBasedBreakIterator::createBufferClone(
U_NAMESPACE_END
-static icu::UStack *gLanguageBreakFactories = nullptr;
-static const icu::UnicodeString *gEmptyString = nullptr;
+static icu::UStack *gLanguageBreakFactories = nullptr;
+static const icu::UnicodeString *gEmptyString = nullptr;
static icu::UInitOnce gLanguageBreakFactoriesInitOnce = U_INITONCE_INITIALIZER;
-static icu::UInitOnce gRBBIInitOnce = U_INITONCE_INITIALIZER;
+static icu::UInitOnce gRBBIInitOnce = U_INITONCE_INITIALIZER;
/**
- * Release all static memory held by breakiterator.
+ * Release all static memory held by breakiterator.
*/
U_CDECL_BEGIN
-UBool U_CALLCONV rbbi_cleanup(void) {
- delete gLanguageBreakFactories;
- gLanguageBreakFactories = nullptr;
- delete gEmptyString;
- gEmptyString = nullptr;
+UBool U_CALLCONV rbbi_cleanup(void) {
+ delete gLanguageBreakFactories;
+ gLanguageBreakFactories = nullptr;
+ delete gEmptyString;
+ gEmptyString = nullptr;
gLanguageBreakFactoriesInitOnce.reset();
- gRBBIInitOnce.reset();
+ gRBBIInitOnce.reset();
return TRUE;
}
U_CDECL_END
@@ -1135,11 +1135,11 @@ static void U_CALLCONV _deleteFactory(void *obj) {
U_CDECL_END
U_NAMESPACE_BEGIN
-static void U_CALLCONV rbbiInit() {
- gEmptyString = new UnicodeString();
- ucln_common_registerCleanup(UCLN_COMMON_RBBI, rbbi_cleanup);
-}
-
+static void U_CALLCONV rbbiInit() {
+ gEmptyString = new UnicodeString();
+ ucln_common_registerCleanup(UCLN_COMMON_RBBI, rbbi_cleanup);
+}
+
static void U_CALLCONV initLanguageFactories() {
UErrorCode status = U_ZERO_ERROR;
U_ASSERT(gLanguageBreakFactories == NULL);
@@ -1154,23 +1154,23 @@ static void U_CALLCONV initLanguageFactories() {
}
#endif
}
- ucln_common_registerCleanup(UCLN_COMMON_RBBI, rbbi_cleanup);
+ ucln_common_registerCleanup(UCLN_COMMON_RBBI, rbbi_cleanup);
}
static const LanguageBreakEngine*
-getLanguageBreakEngineFromFactory(UChar32 c)
+getLanguageBreakEngineFromFactory(UChar32 c)
{
umtx_initOnce(gLanguageBreakFactoriesInitOnce, &initLanguageFactories);
if (gLanguageBreakFactories == NULL) {
return NULL;
}
-
+
int32_t i = gLanguageBreakFactories->size();
const LanguageBreakEngine *lbe = NULL;
while (--i >= 0) {
LanguageBreakFactory *factory = (LanguageBreakFactory *)(gLanguageBreakFactories->elementAt(i));
- lbe = factory->getEngineFor(c);
+ lbe = factory->getEngineFor(c);
if (lbe != NULL) {
break;
}
@@ -1189,7 +1189,7 @@ const LanguageBreakEngine *
RuleBasedBreakIterator::getLanguageBreakEngine(UChar32 c) {
const LanguageBreakEngine *lbe = NULL;
UErrorCode status = U_ZERO_ERROR;
-
+
if (fLanguageBreakEngines == NULL) {
fLanguageBreakEngines = new UStack(status);
if (fLanguageBreakEngines == NULL || U_FAILURE(status)) {
@@ -1198,19 +1198,19 @@ RuleBasedBreakIterator::getLanguageBreakEngine(UChar32 c) {
return NULL;
}
}
-
+
int32_t i = fLanguageBreakEngines->size();
while (--i >= 0) {
lbe = (const LanguageBreakEngine *)(fLanguageBreakEngines->elementAt(i));
- if (lbe->handles(c)) {
+ if (lbe->handles(c)) {
return lbe;
}
}
-
+
// No existing dictionary took the character. See if a factory wants to
// give us a new LanguageBreakEngine for this character.
- lbe = getLanguageBreakEngineFromFactory(c);
-
+ lbe = getLanguageBreakEngineFromFactory(c);
+
// If we got one, use it and push it on our stack.
if (lbe != NULL) {
fLanguageBreakEngines->push((void *)lbe, status);
@@ -1218,14 +1218,14 @@ RuleBasedBreakIterator::getLanguageBreakEngine(UChar32 c) {
// return it even if the push fails.
return lbe;
}
-
+
// No engine is forthcoming for this character. Add it to the
// reject set. Create the reject break engine if needed.
if (fUnhandledBreakEngine == NULL) {
fUnhandledBreakEngine = new UnhandledEngine(status);
if (U_SUCCESS(status) && fUnhandledBreakEngine == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
+ return nullptr;
}
// Put it last so that scripts for which we have an engine get tried
// first.
@@ -1237,34 +1237,34 @@ RuleBasedBreakIterator::getLanguageBreakEngine(UChar32 c) {
return NULL;
}
}
-
+
// Tell the reject engine about the character; at its discretion, it may
// add more than just the one character.
- fUnhandledBreakEngine->handleCharacter(c);
-
+ fUnhandledBreakEngine->handleCharacter(c);
+
return fUnhandledBreakEngine;
}
-void RuleBasedBreakIterator::dumpCache() {
- fBreakCache->dumpCache();
-}
-
-void RuleBasedBreakIterator::dumpTables() {
- fData->printData();
-}
-
-/**
- * Returns the description used to create this iterator
- */
-
-const UnicodeString&
-RuleBasedBreakIterator::getRules() const {
- if (fData != NULL) {
- return fData->getRuleSourceString();
- } else {
- umtx_initOnce(gRBBIInitOnce, &rbbiInit);
- return *gEmptyString;
- }
+void RuleBasedBreakIterator::dumpCache() {
+ fBreakCache->dumpCache();
+}
+
+void RuleBasedBreakIterator::dumpTables() {
+ fData->printData();
+}
+
+/**
+ * Returns the description used to create this iterator
+ */
+
+const UnicodeString&
+RuleBasedBreakIterator::getRules() const {
+ if (fData != NULL) {
+ return fData->getRuleSourceString();
+ } else {
+ umtx_initOnce(gRBBIInitOnce, &rbbiInit);
+ return *gEmptyString;
+ }
}
U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/rbbi_cache.cpp b/contrib/libs/icu/common/rbbi_cache.cpp
index 5814d5e03b..4f9e83360a 100644
--- a/contrib/libs/icu/common/rbbi_cache.cpp
+++ b/contrib/libs/icu/common/rbbi_cache.cpp
@@ -1,653 +1,653 @@
-// Copyright (C) 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// file: rbbi_cache.cpp
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_BREAK_ITERATION
-
-#include "unicode/ubrk.h"
-#include "unicode/rbbi.h"
-
-#include "rbbi_cache.h"
-
-#include "brkeng.h"
-#include "cmemory.h"
-#include "rbbidata.h"
-#include "rbbirb.h"
-#include "uassert.h"
-#include "uvectr32.h"
-
-U_NAMESPACE_BEGIN
-
-/*
- * DictionaryCache implementation
- */
-
-RuleBasedBreakIterator::DictionaryCache::DictionaryCache(RuleBasedBreakIterator *bi, UErrorCode &status) :
- fBI(bi), fBreaks(status), fPositionInCache(-1),
- fStart(0), fLimit(0), fFirstRuleStatusIndex(0), fOtherRuleStatusIndex(0) {
-}
-
-RuleBasedBreakIterator::DictionaryCache::~DictionaryCache() {
-}
-
-void RuleBasedBreakIterator::DictionaryCache::reset() {
- fPositionInCache = -1;
- fStart = 0;
- fLimit = 0;
- fFirstRuleStatusIndex = 0;
- fOtherRuleStatusIndex = 0;
- fBreaks.removeAllElements();
-}
-
-UBool RuleBasedBreakIterator::DictionaryCache::following(int32_t fromPos, int32_t *result, int32_t *statusIndex) {
- if (fromPos >= fLimit || fromPos < fStart) {
- fPositionInCache = -1;
- return FALSE;
- }
-
- // Sequential iteration, move from previous boundary to the following
-
- int32_t r = 0;
- if (fPositionInCache >= 0 && fPositionInCache < fBreaks.size() && fBreaks.elementAti(fPositionInCache) == fromPos) {
- ++fPositionInCache;
- if (fPositionInCache >= fBreaks.size()) {
- fPositionInCache = -1;
- return FALSE;
- }
- r = fBreaks.elementAti(fPositionInCache);
- U_ASSERT(r > fromPos);
- *result = r;
- *statusIndex = fOtherRuleStatusIndex;
- return TRUE;
- }
-
- // Random indexing. Linear search for the boundary following the given position.
-
- for (fPositionInCache = 0; fPositionInCache < fBreaks.size(); ++fPositionInCache) {
- r= fBreaks.elementAti(fPositionInCache);
- if (r > fromPos) {
- *result = r;
- *statusIndex = fOtherRuleStatusIndex;
- return TRUE;
- }
- }
- UPRV_UNREACHABLE;
-}
-
-
-UBool RuleBasedBreakIterator::DictionaryCache::preceding(int32_t fromPos, int32_t *result, int32_t *statusIndex) {
- if (fromPos <= fStart || fromPos > fLimit) {
- fPositionInCache = -1;
- return FALSE;
- }
-
- if (fromPos == fLimit) {
- fPositionInCache = fBreaks.size() - 1;
- if (fPositionInCache >= 0) {
- U_ASSERT(fBreaks.elementAti(fPositionInCache) == fromPos);
- }
- }
-
- int32_t r;
- if (fPositionInCache > 0 && fPositionInCache < fBreaks.size() && fBreaks.elementAti(fPositionInCache) == fromPos) {
- --fPositionInCache;
- r = fBreaks.elementAti(fPositionInCache);
- U_ASSERT(r < fromPos);
- *result = r;
- *statusIndex = ( r== fStart) ? fFirstRuleStatusIndex : fOtherRuleStatusIndex;
- return TRUE;
- }
-
- if (fPositionInCache == 0) {
- fPositionInCache = -1;
- return FALSE;
- }
-
- for (fPositionInCache = fBreaks.size()-1; fPositionInCache >= 0; --fPositionInCache) {
- r = fBreaks.elementAti(fPositionInCache);
- if (r < fromPos) {
- *result = r;
- *statusIndex = ( r == fStart) ? fFirstRuleStatusIndex : fOtherRuleStatusIndex;
- return TRUE;
- }
- }
- UPRV_UNREACHABLE;
-}
-
-void RuleBasedBreakIterator::DictionaryCache::populateDictionary(int32_t startPos, int32_t endPos,
- int32_t firstRuleStatus, int32_t otherRuleStatus) {
- if ((endPos - startPos) <= 1) {
- return;
- }
-
- reset();
- fFirstRuleStatusIndex = firstRuleStatus;
- fOtherRuleStatusIndex = otherRuleStatus;
-
- int32_t rangeStart = startPos;
- int32_t rangeEnd = endPos;
-
- uint16_t category;
- int32_t current;
- UErrorCode status = U_ZERO_ERROR;
- int32_t foundBreakCount = 0;
- UText *text = &fBI->fText;
-
- // Loop through the text, looking for ranges of dictionary characters.
- // For each span, find the appropriate break engine, and ask it to find
- // any breaks within the span.
-
- utext_setNativeIndex(text, rangeStart);
- UChar32 c = utext_current32(text);
- category = UTRIE2_GET16(fBI->fData->fTrie, c);
-
- while(U_SUCCESS(status)) {
- while((current = (int32_t)UTEXT_GETNATIVEINDEX(text)) < rangeEnd && (category & 0x4000) == 0) {
- utext_next32(text); // TODO: cleaner loop structure.
- c = utext_current32(text);
- category = UTRIE2_GET16(fBI->fData->fTrie, c);
- }
- if (current >= rangeEnd) {
- break;
- }
-
- // We now have a dictionary character. Get the appropriate language object
- // to deal with it.
- const LanguageBreakEngine *lbe = fBI->getLanguageBreakEngine(c);
-
- // Ask the language object if there are any breaks. It will add them to the cache and
- // leave the text pointer on the other side of its range, ready to search for the next one.
- if (lbe != NULL) {
- foundBreakCount += lbe->findBreaks(text, rangeStart, rangeEnd, fBreaks);
- }
-
- // Reload the loop variables for the next go-round
- c = utext_current32(text);
- category = UTRIE2_GET16(fBI->fData->fTrie, c);
- }
-
- // If we found breaks, ensure that the first and last entries are
- // the original starting and ending position. And initialize the
- // cache iteration position to the first entry.
-
- // printf("foundBreakCount = %d\n", foundBreakCount);
- if (foundBreakCount > 0) {
- U_ASSERT(foundBreakCount == fBreaks.size());
- if (startPos < fBreaks.elementAti(0)) {
- // The dictionary did not place a boundary at the start of the segment of text.
- // Add one now. This should not commonly happen, but it would be easy for interactions
- // of the rules for dictionary segments and the break engine implementations to
- // inadvertently cause it. Cover it here, just in case.
- fBreaks.insertElementAt(startPos, 0, status);
- }
- if (endPos > fBreaks.peeki()) {
- fBreaks.push(endPos, status);
- }
- fPositionInCache = 0;
- // Note: Dictionary matching may extend beyond the original limit.
- fStart = fBreaks.elementAti(0);
- fLimit = fBreaks.peeki();
- } else {
- // there were no language-based breaks, even though the segment contained
- // dictionary characters. Subsequent attempts to fetch boundaries from the dictionary cache
- // for this range will fail, and the calling code will fall back to the rule based boundaries.
- }
-}
-
-
-/*
- * BreakCache implemetation
- */
-
-RuleBasedBreakIterator::BreakCache::BreakCache(RuleBasedBreakIterator *bi, UErrorCode &status) :
- fBI(bi), fSideBuffer(status) {
- reset();
-}
-
-
-RuleBasedBreakIterator::BreakCache::~BreakCache() {
-}
-
-
-void RuleBasedBreakIterator::BreakCache::reset(int32_t pos, int32_t ruleStatus) {
- fStartBufIdx = 0;
- fEndBufIdx = 0;
- fTextIdx = pos;
- fBufIdx = 0;
- fBoundaries[0] = pos;
- fStatuses[0] = (uint16_t)ruleStatus;
-}
-
-
-int32_t RuleBasedBreakIterator::BreakCache::current() {
- fBI->fPosition = fTextIdx;
- fBI->fRuleStatusIndex = fStatuses[fBufIdx];
- fBI->fDone = FALSE;
- return fTextIdx;
-}
-
-
-void RuleBasedBreakIterator::BreakCache::following(int32_t startPos, UErrorCode &status) {
- if (U_FAILURE(status)) {
- return;
- }
- if (startPos == fTextIdx || seek(startPos) || populateNear(startPos, status)) {
- // startPos is in the cache. Do a next() from that position.
- // TODO: an awkward set of interactions with bi->fDone
- // seek() does not clear it; it can't because of interactions with populateNear().
- // next() does not clear it in the fast-path case, where everything matters. Maybe it should.
- // So clear it here, for the case where seek() succeeded on an iterator that had previously run off the end.
- fBI->fDone = false;
- next();
- }
- return;
-}
-
-
-void RuleBasedBreakIterator::BreakCache::preceding(int32_t startPos, UErrorCode &status) {
- if (U_FAILURE(status)) {
- return;
- }
- if (startPos == fTextIdx || seek(startPos) || populateNear(startPos, status)) {
- if (startPos == fTextIdx) {
- previous(status);
- } else {
- // seek() leaves the BreakCache positioned at the preceding boundary
- // if the requested position is between two bounaries.
- // current() pushes the BreakCache position out to the BreakIterator itself.
- U_ASSERT(startPos > fTextIdx);
- current();
- }
- }
- return;
-}
-
-
-/*
- * Out-of-line code for BreakCache::next().
- * Cache does not already contain the boundary
- */
-void RuleBasedBreakIterator::BreakCache::nextOL() {
- fBI->fDone = !populateFollowing();
- fBI->fPosition = fTextIdx;
- fBI->fRuleStatusIndex = fStatuses[fBufIdx];
- return;
-}
-
-
-void RuleBasedBreakIterator::BreakCache::previous(UErrorCode &status) {
- if (U_FAILURE(status)) {
- return;
- }
- int32_t initialBufIdx = fBufIdx;
- if (fBufIdx == fStartBufIdx) {
- // At start of cache. Prepend to it.
- populatePreceding(status);
- } else {
- // Cache already holds the next boundary
- fBufIdx = modChunkSize(fBufIdx - 1);
- fTextIdx = fBoundaries[fBufIdx];
- }
- fBI->fDone = (fBufIdx == initialBufIdx);
- fBI->fPosition = fTextIdx;
- fBI->fRuleStatusIndex = fStatuses[fBufIdx];
- return;
-}
-
-
-UBool RuleBasedBreakIterator::BreakCache::seek(int32_t pos) {
- if (pos < fBoundaries[fStartBufIdx] || pos > fBoundaries[fEndBufIdx]) {
- return FALSE;
- }
- if (pos == fBoundaries[fStartBufIdx]) {
- // Common case: seek(0), from BreakIterator::first()
- fBufIdx = fStartBufIdx;
- fTextIdx = fBoundaries[fBufIdx];
- return TRUE;
- }
- if (pos == fBoundaries[fEndBufIdx]) {
- fBufIdx = fEndBufIdx;
- fTextIdx = fBoundaries[fBufIdx];
- return TRUE;
- }
-
- int32_t min = fStartBufIdx;
- int32_t max = fEndBufIdx;
- while (min != max) {
- int32_t probe = (min + max + (min>max ? CACHE_SIZE : 0)) / 2;
- probe = modChunkSize(probe);
- if (fBoundaries[probe] > pos) {
- max = probe;
- } else {
- min = modChunkSize(probe + 1);
- }
- }
- U_ASSERT(fBoundaries[max] > pos);
- fBufIdx = modChunkSize(max - 1);
- fTextIdx = fBoundaries[fBufIdx];
- U_ASSERT(fTextIdx <= pos);
- return TRUE;
-}
-
-
-UBool RuleBasedBreakIterator::BreakCache::populateNear(int32_t position, UErrorCode &status) {
- if (U_FAILURE(status)) {
- return FALSE;
- }
- U_ASSERT(position < fBoundaries[fStartBufIdx] || position > fBoundaries[fEndBufIdx]);
-
- // Find a boundary somewhere in the vicinity of the requested position.
- // Depending on the safe rules and the text data, it could be either before, at, or after
- // the requested position.
-
-
- // If the requested position is not near already cached positions, clear the existing cache,
- // find a near-by boundary and begin new cache contents there.
-
- if ((position < fBoundaries[fStartBufIdx] - 15) || position > (fBoundaries[fEndBufIdx] + 15)) {
- int32_t aBoundary = 0;
- int32_t ruleStatusIndex = 0;
- if (position > 20) {
- int32_t backupPos = fBI->handleSafePrevious(position);
-
- if (backupPos > 0) {
- // Advance to the boundary following the backup position.
- // There is a complication: the safe reverse rules identify pairs of code points
- // that are safe. If advancing from the safe point moves forwards by less than
- // two code points, we need to advance one more time to ensure that the boundary
- // is good, including a correct rules status value.
- //
- fBI->fPosition = backupPos;
- aBoundary = fBI->handleNext();
- if (aBoundary <= backupPos + 4) {
- // +4 is a quick test for possibly having advanced only one codepoint.
- // Four being the length of the longest potential code point, a supplementary in UTF-8
- utext_setNativeIndex(&fBI->fText, aBoundary);
- if (backupPos == utext_getPreviousNativeIndex(&fBI->fText)) {
- // The initial handleNext() only advanced by a single code point. Go again.
- aBoundary = fBI->handleNext(); // Safe rules identify safe pairs.
- }
- }
- ruleStatusIndex = fBI->fRuleStatusIndex;
- }
- }
- reset(aBoundary, ruleStatusIndex); // Reset cache to hold aBoundary as a single starting point.
- }
-
- // Fill in boundaries between existing cache content and the new requested position.
-
- if (fBoundaries[fEndBufIdx] < position) {
- // The last position in the cache precedes the requested position.
- // Add following position(s) to the cache.
- while (fBoundaries[fEndBufIdx] < position) {
- if (!populateFollowing()) {
- UPRV_UNREACHABLE;
- }
- }
- fBufIdx = fEndBufIdx; // Set iterator position to the end of the buffer.
- fTextIdx = fBoundaries[fBufIdx]; // Required because populateFollowing may add extra boundaries.
- while (fTextIdx > position) { // Move backwards to a position at or preceding the requested pos.
- previous(status);
- }
- return true;
- }
-
- if (fBoundaries[fStartBufIdx] > position) {
- // The first position in the cache is beyond the requested position.
- // back up more until we get a boundary <= the requested position.
- while (fBoundaries[fStartBufIdx] > position) {
- populatePreceding(status);
- }
- fBufIdx = fStartBufIdx; // Set iterator position to the start of the buffer.
- fTextIdx = fBoundaries[fBufIdx]; // Required because populatePreceding may add extra boundaries.
- while (fTextIdx < position) { // Move forwards to a position at or following the requested pos.
- next();
- }
- if (fTextIdx > position) {
- // If position is not itself a boundary, the next() loop above will overshoot.
- // Back up one, leaving cache position at the boundary preceding the requested position.
- previous(status);
- }
- return true;
- }
-
- U_ASSERT(fTextIdx == position);
- return true;
-}
-
-
-
-UBool RuleBasedBreakIterator::BreakCache::populateFollowing() {
- int32_t fromPosition = fBoundaries[fEndBufIdx];
- int32_t fromRuleStatusIdx = fStatuses[fEndBufIdx];
- int32_t pos = 0;
- int32_t ruleStatusIdx = 0;
-
- if (fBI->fDictionaryCache->following(fromPosition, &pos, &ruleStatusIdx)) {
- addFollowing(pos, ruleStatusIdx, UpdateCachePosition);
- return TRUE;
- }
-
- fBI->fPosition = fromPosition;
- pos = fBI->handleNext();
- if (pos == UBRK_DONE) {
- return FALSE;
- }
-
- ruleStatusIdx = fBI->fRuleStatusIndex;
- if (fBI->fDictionaryCharCount > 0) {
- // The text segment obtained from the rules includes dictionary characters.
- // Subdivide it, with subdivided results going into the dictionary cache.
- fBI->fDictionaryCache->populateDictionary(fromPosition, pos, fromRuleStatusIdx, ruleStatusIdx);
- if (fBI->fDictionaryCache->following(fromPosition, &pos, &ruleStatusIdx)) {
- addFollowing(pos, ruleStatusIdx, UpdateCachePosition);
- return TRUE;
- // TODO: may want to move a sizable chunk of dictionary cache to break cache at this point.
- // But be careful with interactions with populateNear().
- }
- }
-
- // Rule based segment did not include dictionary characters.
- // Or, it did contain dictionary chars, but the dictionary segmenter didn't handle them,
- // meaning that we didn't take the return, above.
- // Add its end point to the cache.
- addFollowing(pos, ruleStatusIdx, UpdateCachePosition);
-
- // Add several non-dictionary boundaries at this point, to optimize straight forward iteration.
- // (subsequent calls to BreakIterator::next() will take the fast path, getting cached results.
- //
- for (int count=0; count<6; ++count) {
- pos = fBI->handleNext();
- if (pos == UBRK_DONE || fBI->fDictionaryCharCount > 0) {
- break;
- }
- addFollowing(pos, fBI->fRuleStatusIndex, RetainCachePosition);
- }
-
- return TRUE;
-}
-
-
-UBool RuleBasedBreakIterator::BreakCache::populatePreceding(UErrorCode &status) {
- if (U_FAILURE(status)) {
- return FALSE;
- }
-
- int32_t fromPosition = fBoundaries[fStartBufIdx];
- if (fromPosition == 0) {
- return FALSE;
- }
-
- int32_t position = 0;
- int32_t positionStatusIdx = 0;
-
- if (fBI->fDictionaryCache->preceding(fromPosition, &position, &positionStatusIdx)) {
- addPreceding(position, positionStatusIdx, UpdateCachePosition);
- return TRUE;
- }
-
- int32_t backupPosition = fromPosition;
-
- // Find a boundary somewhere preceding the first already-cached boundary
- do {
- backupPosition = backupPosition - 30;
- if (backupPosition <= 0) {
- backupPosition = 0;
- } else {
- backupPosition = fBI->handleSafePrevious(backupPosition);
- }
- if (backupPosition == UBRK_DONE || backupPosition == 0) {
- position = 0;
- positionStatusIdx = 0;
- } else {
- // Advance to the boundary following the backup position.
- // There is a complication: the safe reverse rules identify pairs of code points
- // that are safe. If advancing from the safe point moves forwards by less than
- // two code points, we need to advance one more time to ensure that the boundary
- // is good, including a correct rules status value.
- //
- fBI->fPosition = backupPosition;
- position = fBI->handleNext();
- if (position <= backupPosition + 4) {
- // +4 is a quick test for possibly having advanced only one codepoint.
- // Four being the length of the longest potential code point, a supplementary in UTF-8
- utext_setNativeIndex(&fBI->fText, position);
- if (backupPosition == utext_getPreviousNativeIndex(&fBI->fText)) {
- // The initial handleNext() only advanced by a single code point. Go again.
- position = fBI->handleNext(); // Safe rules identify safe pairs.
- }
- }
- positionStatusIdx = fBI->fRuleStatusIndex;
- }
- } while (position >= fromPosition);
-
- // Find boundaries between the one we just located and the first already-cached boundary
- // Put them in a side buffer, because we don't yet know where they will fall in the circular cache buffer..
-
- fSideBuffer.removeAllElements();
- fSideBuffer.addElement(position, status);
- fSideBuffer.addElement(positionStatusIdx, status);
-
- do {
- int32_t prevPosition = fBI->fPosition = position;
- int32_t prevStatusIdx = positionStatusIdx;
- position = fBI->handleNext();
- positionStatusIdx = fBI->fRuleStatusIndex;
- if (position == UBRK_DONE) {
- break;
- }
-
- UBool segmentHandledByDictionary = FALSE;
- if (fBI->fDictionaryCharCount != 0) {
- // Segment from the rules includes dictionary characters.
- // Subdivide it, with subdivided results going into the dictionary cache.
- int32_t dictSegEndPosition = position;
- fBI->fDictionaryCache->populateDictionary(prevPosition, dictSegEndPosition, prevStatusIdx, positionStatusIdx);
- while (fBI->fDictionaryCache->following(prevPosition, &position, &positionStatusIdx)) {
- segmentHandledByDictionary = true;
- U_ASSERT(position > prevPosition);
- if (position >= fromPosition) {
- break;
- }
- U_ASSERT(position <= dictSegEndPosition);
- fSideBuffer.addElement(position, status);
- fSideBuffer.addElement(positionStatusIdx, status);
- prevPosition = position;
- }
- U_ASSERT(position==dictSegEndPosition || position>=fromPosition);
- }
-
- if (!segmentHandledByDictionary && position < fromPosition) {
- fSideBuffer.addElement(position, status);
- fSideBuffer.addElement(positionStatusIdx, status);
- }
- } while (position < fromPosition);
-
- // Move boundaries from the side buffer to the main circular buffer.
- UBool success = FALSE;
- if (!fSideBuffer.isEmpty()) {
- positionStatusIdx = fSideBuffer.popi();
- position = fSideBuffer.popi();
- addPreceding(position, positionStatusIdx, UpdateCachePosition);
- success = TRUE;
- }
-
- while (!fSideBuffer.isEmpty()) {
- positionStatusIdx = fSideBuffer.popi();
- position = fSideBuffer.popi();
- if (!addPreceding(position, positionStatusIdx, RetainCachePosition)) {
- // No space in circular buffer to hold a new preceding result while
- // also retaining the current cache (iteration) position.
- // Bailing out is safe; the cache will refill again if needed.
- break;
- }
- }
-
- return success;
-}
-
-
-void RuleBasedBreakIterator::BreakCache::addFollowing(int32_t position, int32_t ruleStatusIdx, UpdatePositionValues update) {
- U_ASSERT(position > fBoundaries[fEndBufIdx]);
- U_ASSERT(ruleStatusIdx <= UINT16_MAX);
- int32_t nextIdx = modChunkSize(fEndBufIdx + 1);
- if (nextIdx == fStartBufIdx) {
- fStartBufIdx = modChunkSize(fStartBufIdx + 6); // TODO: experiment. Probably revert to 1.
- }
- fBoundaries[nextIdx] = position;
- fStatuses[nextIdx] = static_cast<uint16_t>(ruleStatusIdx);
- fEndBufIdx = nextIdx;
- if (update == UpdateCachePosition) {
- // Set current position to the newly added boundary.
- fBufIdx = nextIdx;
- fTextIdx = position;
- } else {
- // Retaining the original cache position.
- // Check if the added boundary wraps around the buffer, and would over-write the original position.
- // It's the responsibility of callers of this function to not add too many.
- U_ASSERT(nextIdx != fBufIdx);
- }
-}
-
-bool RuleBasedBreakIterator::BreakCache::addPreceding(int32_t position, int32_t ruleStatusIdx, UpdatePositionValues update) {
- U_ASSERT(position < fBoundaries[fStartBufIdx]);
- U_ASSERT(ruleStatusIdx <= UINT16_MAX);
- int32_t nextIdx = modChunkSize(fStartBufIdx - 1);
- if (nextIdx == fEndBufIdx) {
- if (fBufIdx == fEndBufIdx && update == RetainCachePosition) {
- // Failure. The insertion of the new boundary would claim the buffer position that is the
- // current iteration position. And we also want to retain the current iteration position.
- // (The buffer is already completely full of entries that precede the iteration position.)
- return false;
- }
- fEndBufIdx = modChunkSize(fEndBufIdx - 1);
- }
- fBoundaries[nextIdx] = position;
- fStatuses[nextIdx] = static_cast<uint16_t>(ruleStatusIdx);
- fStartBufIdx = nextIdx;
- if (update == UpdateCachePosition) {
- fBufIdx = nextIdx;
- fTextIdx = position;
- }
- return true;
-}
-
-
-void RuleBasedBreakIterator::BreakCache::dumpCache() {
-#ifdef RBBI_DEBUG
- RBBIDebugPrintf("fTextIdx:%d fBufIdx:%d\n", fTextIdx, fBufIdx);
- for (int32_t i=fStartBufIdx; ; i=modChunkSize(i+1)) {
- RBBIDebugPrintf("%d %d\n", i, fBoundaries[i]);
- if (i == fEndBufIdx) {
- break;
- }
- }
-#endif
-}
-
-U_NAMESPACE_END
-
-#endif // #if !UCONFIG_NO_BREAK_ITERATION
+// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// file: rbbi_cache.cpp
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_BREAK_ITERATION
+
+#include "unicode/ubrk.h"
+#include "unicode/rbbi.h"
+
+#include "rbbi_cache.h"
+
+#include "brkeng.h"
+#include "cmemory.h"
+#include "rbbidata.h"
+#include "rbbirb.h"
+#include "uassert.h"
+#include "uvectr32.h"
+
+U_NAMESPACE_BEGIN
+
+/*
+ * DictionaryCache implementation
+ */
+
+RuleBasedBreakIterator::DictionaryCache::DictionaryCache(RuleBasedBreakIterator *bi, UErrorCode &status) :
+ fBI(bi), fBreaks(status), fPositionInCache(-1),
+ fStart(0), fLimit(0), fFirstRuleStatusIndex(0), fOtherRuleStatusIndex(0) {
+}
+
+RuleBasedBreakIterator::DictionaryCache::~DictionaryCache() {
+}
+
+void RuleBasedBreakIterator::DictionaryCache::reset() {
+ fPositionInCache = -1;
+ fStart = 0;
+ fLimit = 0;
+ fFirstRuleStatusIndex = 0;
+ fOtherRuleStatusIndex = 0;
+ fBreaks.removeAllElements();
+}
+
+UBool RuleBasedBreakIterator::DictionaryCache::following(int32_t fromPos, int32_t *result, int32_t *statusIndex) {
+ if (fromPos >= fLimit || fromPos < fStart) {
+ fPositionInCache = -1;
+ return FALSE;
+ }
+
+ // Sequential iteration, move from previous boundary to the following
+
+ int32_t r = 0;
+ if (fPositionInCache >= 0 && fPositionInCache < fBreaks.size() && fBreaks.elementAti(fPositionInCache) == fromPos) {
+ ++fPositionInCache;
+ if (fPositionInCache >= fBreaks.size()) {
+ fPositionInCache = -1;
+ return FALSE;
+ }
+ r = fBreaks.elementAti(fPositionInCache);
+ U_ASSERT(r > fromPos);
+ *result = r;
+ *statusIndex = fOtherRuleStatusIndex;
+ return TRUE;
+ }
+
+ // Random indexing. Linear search for the boundary following the given position.
+
+ for (fPositionInCache = 0; fPositionInCache < fBreaks.size(); ++fPositionInCache) {
+ r= fBreaks.elementAti(fPositionInCache);
+ if (r > fromPos) {
+ *result = r;
+ *statusIndex = fOtherRuleStatusIndex;
+ return TRUE;
+ }
+ }
+ UPRV_UNREACHABLE;
+}
+
+
+UBool RuleBasedBreakIterator::DictionaryCache::preceding(int32_t fromPos, int32_t *result, int32_t *statusIndex) {
+ if (fromPos <= fStart || fromPos > fLimit) {
+ fPositionInCache = -1;
+ return FALSE;
+ }
+
+ if (fromPos == fLimit) {
+ fPositionInCache = fBreaks.size() - 1;
+ if (fPositionInCache >= 0) {
+ U_ASSERT(fBreaks.elementAti(fPositionInCache) == fromPos);
+ }
+ }
+
+ int32_t r;
+ if (fPositionInCache > 0 && fPositionInCache < fBreaks.size() && fBreaks.elementAti(fPositionInCache) == fromPos) {
+ --fPositionInCache;
+ r = fBreaks.elementAti(fPositionInCache);
+ U_ASSERT(r < fromPos);
+ *result = r;
+ *statusIndex = ( r== fStart) ? fFirstRuleStatusIndex : fOtherRuleStatusIndex;
+ return TRUE;
+ }
+
+ if (fPositionInCache == 0) {
+ fPositionInCache = -1;
+ return FALSE;
+ }
+
+ for (fPositionInCache = fBreaks.size()-1; fPositionInCache >= 0; --fPositionInCache) {
+ r = fBreaks.elementAti(fPositionInCache);
+ if (r < fromPos) {
+ *result = r;
+ *statusIndex = ( r == fStart) ? fFirstRuleStatusIndex : fOtherRuleStatusIndex;
+ return TRUE;
+ }
+ }
+ UPRV_UNREACHABLE;
+}
+
+void RuleBasedBreakIterator::DictionaryCache::populateDictionary(int32_t startPos, int32_t endPos,
+ int32_t firstRuleStatus, int32_t otherRuleStatus) {
+ if ((endPos - startPos) <= 1) {
+ return;
+ }
+
+ reset();
+ fFirstRuleStatusIndex = firstRuleStatus;
+ fOtherRuleStatusIndex = otherRuleStatus;
+
+ int32_t rangeStart = startPos;
+ int32_t rangeEnd = endPos;
+
+ uint16_t category;
+ int32_t current;
+ UErrorCode status = U_ZERO_ERROR;
+ int32_t foundBreakCount = 0;
+ UText *text = &fBI->fText;
+
+ // Loop through the text, looking for ranges of dictionary characters.
+ // For each span, find the appropriate break engine, and ask it to find
+ // any breaks within the span.
+
+ utext_setNativeIndex(text, rangeStart);
+ UChar32 c = utext_current32(text);
+ category = UTRIE2_GET16(fBI->fData->fTrie, c);
+
+ while(U_SUCCESS(status)) {
+ while((current = (int32_t)UTEXT_GETNATIVEINDEX(text)) < rangeEnd && (category & 0x4000) == 0) {
+ utext_next32(text); // TODO: cleaner loop structure.
+ c = utext_current32(text);
+ category = UTRIE2_GET16(fBI->fData->fTrie, c);
+ }
+ if (current >= rangeEnd) {
+ break;
+ }
+
+ // We now have a dictionary character. Get the appropriate language object
+ // to deal with it.
+ const LanguageBreakEngine *lbe = fBI->getLanguageBreakEngine(c);
+
+ // Ask the language object if there are any breaks. It will add them to the cache and
+ // leave the text pointer on the other side of its range, ready to search for the next one.
+ if (lbe != NULL) {
+ foundBreakCount += lbe->findBreaks(text, rangeStart, rangeEnd, fBreaks);
+ }
+
+ // Reload the loop variables for the next go-round
+ c = utext_current32(text);
+ category = UTRIE2_GET16(fBI->fData->fTrie, c);
+ }
+
+ // If we found breaks, ensure that the first and last entries are
+ // the original starting and ending position. And initialize the
+ // cache iteration position to the first entry.
+
+ // printf("foundBreakCount = %d\n", foundBreakCount);
+ if (foundBreakCount > 0) {
+ U_ASSERT(foundBreakCount == fBreaks.size());
+ if (startPos < fBreaks.elementAti(0)) {
+ // The dictionary did not place a boundary at the start of the segment of text.
+ // Add one now. This should not commonly happen, but it would be easy for interactions
+ // of the rules for dictionary segments and the break engine implementations to
+ // inadvertently cause it. Cover it here, just in case.
+ fBreaks.insertElementAt(startPos, 0, status);
+ }
+ if (endPos > fBreaks.peeki()) {
+ fBreaks.push(endPos, status);
+ }
+ fPositionInCache = 0;
+ // Note: Dictionary matching may extend beyond the original limit.
+ fStart = fBreaks.elementAti(0);
+ fLimit = fBreaks.peeki();
+ } else {
+ // there were no language-based breaks, even though the segment contained
+ // dictionary characters. Subsequent attempts to fetch boundaries from the dictionary cache
+ // for this range will fail, and the calling code will fall back to the rule based boundaries.
+ }
+}
+
+
+/*
+ * BreakCache implemetation
+ */
+
+RuleBasedBreakIterator::BreakCache::BreakCache(RuleBasedBreakIterator *bi, UErrorCode &status) :
+ fBI(bi), fSideBuffer(status) {
+ reset();
+}
+
+
+RuleBasedBreakIterator::BreakCache::~BreakCache() {
+}
+
+
+void RuleBasedBreakIterator::BreakCache::reset(int32_t pos, int32_t ruleStatus) {
+ fStartBufIdx = 0;
+ fEndBufIdx = 0;
+ fTextIdx = pos;
+ fBufIdx = 0;
+ fBoundaries[0] = pos;
+ fStatuses[0] = (uint16_t)ruleStatus;
+}
+
+
+int32_t RuleBasedBreakIterator::BreakCache::current() {
+ fBI->fPosition = fTextIdx;
+ fBI->fRuleStatusIndex = fStatuses[fBufIdx];
+ fBI->fDone = FALSE;
+ return fTextIdx;
+}
+
+
+void RuleBasedBreakIterator::BreakCache::following(int32_t startPos, UErrorCode &status) {
+ if (U_FAILURE(status)) {
+ return;
+ }
+ if (startPos == fTextIdx || seek(startPos) || populateNear(startPos, status)) {
+ // startPos is in the cache. Do a next() from that position.
+ // TODO: an awkward set of interactions with bi->fDone
+ // seek() does not clear it; it can't because of interactions with populateNear().
+ // next() does not clear it in the fast-path case, where everything matters. Maybe it should.
+ // So clear it here, for the case where seek() succeeded on an iterator that had previously run off the end.
+ fBI->fDone = false;
+ next();
+ }
+ return;
+}
+
+
+void RuleBasedBreakIterator::BreakCache::preceding(int32_t startPos, UErrorCode &status) {
+ if (U_FAILURE(status)) {
+ return;
+ }
+ if (startPos == fTextIdx || seek(startPos) || populateNear(startPos, status)) {
+ if (startPos == fTextIdx) {
+ previous(status);
+ } else {
+ // seek() leaves the BreakCache positioned at the preceding boundary
+ // if the requested position is between two bounaries.
+ // current() pushes the BreakCache position out to the BreakIterator itself.
+ U_ASSERT(startPos > fTextIdx);
+ current();
+ }
+ }
+ return;
+}
+
+
+/*
+ * Out-of-line code for BreakCache::next().
+ * Cache does not already contain the boundary
+ */
+void RuleBasedBreakIterator::BreakCache::nextOL() {
+ fBI->fDone = !populateFollowing();
+ fBI->fPosition = fTextIdx;
+ fBI->fRuleStatusIndex = fStatuses[fBufIdx];
+ return;
+}
+
+
+void RuleBasedBreakIterator::BreakCache::previous(UErrorCode &status) {
+ if (U_FAILURE(status)) {
+ return;
+ }
+ int32_t initialBufIdx = fBufIdx;
+ if (fBufIdx == fStartBufIdx) {
+ // At start of cache. Prepend to it.
+ populatePreceding(status);
+ } else {
+ // Cache already holds the next boundary
+ fBufIdx = modChunkSize(fBufIdx - 1);
+ fTextIdx = fBoundaries[fBufIdx];
+ }
+ fBI->fDone = (fBufIdx == initialBufIdx);
+ fBI->fPosition = fTextIdx;
+ fBI->fRuleStatusIndex = fStatuses[fBufIdx];
+ return;
+}
+
+
+UBool RuleBasedBreakIterator::BreakCache::seek(int32_t pos) {
+ if (pos < fBoundaries[fStartBufIdx] || pos > fBoundaries[fEndBufIdx]) {
+ return FALSE;
+ }
+ if (pos == fBoundaries[fStartBufIdx]) {
+ // Common case: seek(0), from BreakIterator::first()
+ fBufIdx = fStartBufIdx;
+ fTextIdx = fBoundaries[fBufIdx];
+ return TRUE;
+ }
+ if (pos == fBoundaries[fEndBufIdx]) {
+ fBufIdx = fEndBufIdx;
+ fTextIdx = fBoundaries[fBufIdx];
+ return TRUE;
+ }
+
+ int32_t min = fStartBufIdx;
+ int32_t max = fEndBufIdx;
+ while (min != max) {
+ int32_t probe = (min + max + (min>max ? CACHE_SIZE : 0)) / 2;
+ probe = modChunkSize(probe);
+ if (fBoundaries[probe] > pos) {
+ max = probe;
+ } else {
+ min = modChunkSize(probe + 1);
+ }
+ }
+ U_ASSERT(fBoundaries[max] > pos);
+ fBufIdx = modChunkSize(max - 1);
+ fTextIdx = fBoundaries[fBufIdx];
+ U_ASSERT(fTextIdx <= pos);
+ return TRUE;
+}
+
+
+UBool RuleBasedBreakIterator::BreakCache::populateNear(int32_t position, UErrorCode &status) {
+ if (U_FAILURE(status)) {
+ return FALSE;
+ }
+ U_ASSERT(position < fBoundaries[fStartBufIdx] || position > fBoundaries[fEndBufIdx]);
+
+ // Find a boundary somewhere in the vicinity of the requested position.
+ // Depending on the safe rules and the text data, it could be either before, at, or after
+ // the requested position.
+
+
+ // If the requested position is not near already cached positions, clear the existing cache,
+ // find a near-by boundary and begin new cache contents there.
+
+ if ((position < fBoundaries[fStartBufIdx] - 15) || position > (fBoundaries[fEndBufIdx] + 15)) {
+ int32_t aBoundary = 0;
+ int32_t ruleStatusIndex = 0;
+ if (position > 20) {
+ int32_t backupPos = fBI->handleSafePrevious(position);
+
+ if (backupPos > 0) {
+ // Advance to the boundary following the backup position.
+ // There is a complication: the safe reverse rules identify pairs of code points
+ // that are safe. If advancing from the safe point moves forwards by less than
+ // two code points, we need to advance one more time to ensure that the boundary
+ // is good, including a correct rules status value.
+ //
+ fBI->fPosition = backupPos;
+ aBoundary = fBI->handleNext();
+ if (aBoundary <= backupPos + 4) {
+ // +4 is a quick test for possibly having advanced only one codepoint.
+ // Four being the length of the longest potential code point, a supplementary in UTF-8
+ utext_setNativeIndex(&fBI->fText, aBoundary);
+ if (backupPos == utext_getPreviousNativeIndex(&fBI->fText)) {
+ // The initial handleNext() only advanced by a single code point. Go again.
+ aBoundary = fBI->handleNext(); // Safe rules identify safe pairs.
+ }
+ }
+ ruleStatusIndex = fBI->fRuleStatusIndex;
+ }
+ }
+ reset(aBoundary, ruleStatusIndex); // Reset cache to hold aBoundary as a single starting point.
+ }
+
+ // Fill in boundaries between existing cache content and the new requested position.
+
+ if (fBoundaries[fEndBufIdx] < position) {
+ // The last position in the cache precedes the requested position.
+ // Add following position(s) to the cache.
+ while (fBoundaries[fEndBufIdx] < position) {
+ if (!populateFollowing()) {
+ UPRV_UNREACHABLE;
+ }
+ }
+ fBufIdx = fEndBufIdx; // Set iterator position to the end of the buffer.
+ fTextIdx = fBoundaries[fBufIdx]; // Required because populateFollowing may add extra boundaries.
+ while (fTextIdx > position) { // Move backwards to a position at or preceding the requested pos.
+ previous(status);
+ }
+ return true;
+ }
+
+ if (fBoundaries[fStartBufIdx] > position) {
+ // The first position in the cache is beyond the requested position.
+ // back up more until we get a boundary <= the requested position.
+ while (fBoundaries[fStartBufIdx] > position) {
+ populatePreceding(status);
+ }
+ fBufIdx = fStartBufIdx; // Set iterator position to the start of the buffer.
+ fTextIdx = fBoundaries[fBufIdx]; // Required because populatePreceding may add extra boundaries.
+ while (fTextIdx < position) { // Move forwards to a position at or following the requested pos.
+ next();
+ }
+ if (fTextIdx > position) {
+ // If position is not itself a boundary, the next() loop above will overshoot.
+ // Back up one, leaving cache position at the boundary preceding the requested position.
+ previous(status);
+ }
+ return true;
+ }
+
+ U_ASSERT(fTextIdx == position);
+ return true;
+}
+
+
+
+UBool RuleBasedBreakIterator::BreakCache::populateFollowing() {
+ int32_t fromPosition = fBoundaries[fEndBufIdx];
+ int32_t fromRuleStatusIdx = fStatuses[fEndBufIdx];
+ int32_t pos = 0;
+ int32_t ruleStatusIdx = 0;
+
+ if (fBI->fDictionaryCache->following(fromPosition, &pos, &ruleStatusIdx)) {
+ addFollowing(pos, ruleStatusIdx, UpdateCachePosition);
+ return TRUE;
+ }
+
+ fBI->fPosition = fromPosition;
+ pos = fBI->handleNext();
+ if (pos == UBRK_DONE) {
+ return FALSE;
+ }
+
+ ruleStatusIdx = fBI->fRuleStatusIndex;
+ if (fBI->fDictionaryCharCount > 0) {
+ // The text segment obtained from the rules includes dictionary characters.
+ // Subdivide it, with subdivided results going into the dictionary cache.
+ fBI->fDictionaryCache->populateDictionary(fromPosition, pos, fromRuleStatusIdx, ruleStatusIdx);
+ if (fBI->fDictionaryCache->following(fromPosition, &pos, &ruleStatusIdx)) {
+ addFollowing(pos, ruleStatusIdx, UpdateCachePosition);
+ return TRUE;
+ // TODO: may want to move a sizable chunk of dictionary cache to break cache at this point.
+ // But be careful with interactions with populateNear().
+ }
+ }
+
+ // Rule based segment did not include dictionary characters.
+ // Or, it did contain dictionary chars, but the dictionary segmenter didn't handle them,
+ // meaning that we didn't take the return, above.
+ // Add its end point to the cache.
+ addFollowing(pos, ruleStatusIdx, UpdateCachePosition);
+
+ // Add several non-dictionary boundaries at this point, to optimize straight forward iteration.
+ // (subsequent calls to BreakIterator::next() will take the fast path, getting cached results.
+ //
+ for (int count=0; count<6; ++count) {
+ pos = fBI->handleNext();
+ if (pos == UBRK_DONE || fBI->fDictionaryCharCount > 0) {
+ break;
+ }
+ addFollowing(pos, fBI->fRuleStatusIndex, RetainCachePosition);
+ }
+
+ return TRUE;
+}
+
+
+UBool RuleBasedBreakIterator::BreakCache::populatePreceding(UErrorCode &status) {
+ if (U_FAILURE(status)) {
+ return FALSE;
+ }
+
+ int32_t fromPosition = fBoundaries[fStartBufIdx];
+ if (fromPosition == 0) {
+ return FALSE;
+ }
+
+ int32_t position = 0;
+ int32_t positionStatusIdx = 0;
+
+ if (fBI->fDictionaryCache->preceding(fromPosition, &position, &positionStatusIdx)) {
+ addPreceding(position, positionStatusIdx, UpdateCachePosition);
+ return TRUE;
+ }
+
+ int32_t backupPosition = fromPosition;
+
+ // Find a boundary somewhere preceding the first already-cached boundary
+ do {
+ backupPosition = backupPosition - 30;
+ if (backupPosition <= 0) {
+ backupPosition = 0;
+ } else {
+ backupPosition = fBI->handleSafePrevious(backupPosition);
+ }
+ if (backupPosition == UBRK_DONE || backupPosition == 0) {
+ position = 0;
+ positionStatusIdx = 0;
+ } else {
+ // Advance to the boundary following the backup position.
+ // There is a complication: the safe reverse rules identify pairs of code points
+ // that are safe. If advancing from the safe point moves forwards by less than
+ // two code points, we need to advance one more time to ensure that the boundary
+ // is good, including a correct rules status value.
+ //
+ fBI->fPosition = backupPosition;
+ position = fBI->handleNext();
+ if (position <= backupPosition + 4) {
+ // +4 is a quick test for possibly having advanced only one codepoint.
+ // Four being the length of the longest potential code point, a supplementary in UTF-8
+ utext_setNativeIndex(&fBI->fText, position);
+ if (backupPosition == utext_getPreviousNativeIndex(&fBI->fText)) {
+ // The initial handleNext() only advanced by a single code point. Go again.
+ position = fBI->handleNext(); // Safe rules identify safe pairs.
+ }
+ }
+ positionStatusIdx = fBI->fRuleStatusIndex;
+ }
+ } while (position >= fromPosition);
+
+ // Find boundaries between the one we just located and the first already-cached boundary
+ // Put them in a side buffer, because we don't yet know where they will fall in the circular cache buffer..
+
+ fSideBuffer.removeAllElements();
+ fSideBuffer.addElement(position, status);
+ fSideBuffer.addElement(positionStatusIdx, status);
+
+ do {
+ int32_t prevPosition = fBI->fPosition = position;
+ int32_t prevStatusIdx = positionStatusIdx;
+ position = fBI->handleNext();
+ positionStatusIdx = fBI->fRuleStatusIndex;
+ if (position == UBRK_DONE) {
+ break;
+ }
+
+ UBool segmentHandledByDictionary = FALSE;
+ if (fBI->fDictionaryCharCount != 0) {
+ // Segment from the rules includes dictionary characters.
+ // Subdivide it, with subdivided results going into the dictionary cache.
+ int32_t dictSegEndPosition = position;
+ fBI->fDictionaryCache->populateDictionary(prevPosition, dictSegEndPosition, prevStatusIdx, positionStatusIdx);
+ while (fBI->fDictionaryCache->following(prevPosition, &position, &positionStatusIdx)) {
+ segmentHandledByDictionary = true;
+ U_ASSERT(position > prevPosition);
+ if (position >= fromPosition) {
+ break;
+ }
+ U_ASSERT(position <= dictSegEndPosition);
+ fSideBuffer.addElement(position, status);
+ fSideBuffer.addElement(positionStatusIdx, status);
+ prevPosition = position;
+ }
+ U_ASSERT(position==dictSegEndPosition || position>=fromPosition);
+ }
+
+ if (!segmentHandledByDictionary && position < fromPosition) {
+ fSideBuffer.addElement(position, status);
+ fSideBuffer.addElement(positionStatusIdx, status);
+ }
+ } while (position < fromPosition);
+
+ // Move boundaries from the side buffer to the main circular buffer.
+ UBool success = FALSE;
+ if (!fSideBuffer.isEmpty()) {
+ positionStatusIdx = fSideBuffer.popi();
+ position = fSideBuffer.popi();
+ addPreceding(position, positionStatusIdx, UpdateCachePosition);
+ success = TRUE;
+ }
+
+ while (!fSideBuffer.isEmpty()) {
+ positionStatusIdx = fSideBuffer.popi();
+ position = fSideBuffer.popi();
+ if (!addPreceding(position, positionStatusIdx, RetainCachePosition)) {
+ // No space in circular buffer to hold a new preceding result while
+ // also retaining the current cache (iteration) position.
+ // Bailing out is safe; the cache will refill again if needed.
+ break;
+ }
+ }
+
+ return success;
+}
+
+
+void RuleBasedBreakIterator::BreakCache::addFollowing(int32_t position, int32_t ruleStatusIdx, UpdatePositionValues update) {
+ U_ASSERT(position > fBoundaries[fEndBufIdx]);
+ U_ASSERT(ruleStatusIdx <= UINT16_MAX);
+ int32_t nextIdx = modChunkSize(fEndBufIdx + 1);
+ if (nextIdx == fStartBufIdx) {
+ fStartBufIdx = modChunkSize(fStartBufIdx + 6); // TODO: experiment. Probably revert to 1.
+ }
+ fBoundaries[nextIdx] = position;
+ fStatuses[nextIdx] = static_cast<uint16_t>(ruleStatusIdx);
+ fEndBufIdx = nextIdx;
+ if (update == UpdateCachePosition) {
+ // Set current position to the newly added boundary.
+ fBufIdx = nextIdx;
+ fTextIdx = position;
+ } else {
+ // Retaining the original cache position.
+ // Check if the added boundary wraps around the buffer, and would over-write the original position.
+ // It's the responsibility of callers of this function to not add too many.
+ U_ASSERT(nextIdx != fBufIdx);
+ }
+}
+
+bool RuleBasedBreakIterator::BreakCache::addPreceding(int32_t position, int32_t ruleStatusIdx, UpdatePositionValues update) {
+ U_ASSERT(position < fBoundaries[fStartBufIdx]);
+ U_ASSERT(ruleStatusIdx <= UINT16_MAX);
+ int32_t nextIdx = modChunkSize(fStartBufIdx - 1);
+ if (nextIdx == fEndBufIdx) {
+ if (fBufIdx == fEndBufIdx && update == RetainCachePosition) {
+ // Failure. The insertion of the new boundary would claim the buffer position that is the
+ // current iteration position. And we also want to retain the current iteration position.
+ // (The buffer is already completely full of entries that precede the iteration position.)
+ return false;
+ }
+ fEndBufIdx = modChunkSize(fEndBufIdx - 1);
+ }
+ fBoundaries[nextIdx] = position;
+ fStatuses[nextIdx] = static_cast<uint16_t>(ruleStatusIdx);
+ fStartBufIdx = nextIdx;
+ if (update == UpdateCachePosition) {
+ fBufIdx = nextIdx;
+ fTextIdx = position;
+ }
+ return true;
+}
+
+
+void RuleBasedBreakIterator::BreakCache::dumpCache() {
+#ifdef RBBI_DEBUG
+ RBBIDebugPrintf("fTextIdx:%d fBufIdx:%d\n", fTextIdx, fBufIdx);
+ for (int32_t i=fStartBufIdx; ; i=modChunkSize(i+1)) {
+ RBBIDebugPrintf("%d %d\n", i, fBoundaries[i]);
+ if (i == fEndBufIdx) {
+ break;
+ }
+ }
+#endif
+}
+
+U_NAMESPACE_END
+
+#endif // #if !UCONFIG_NO_BREAK_ITERATION
diff --git a/contrib/libs/icu/common/rbbi_cache.h b/contrib/libs/icu/common/rbbi_cache.h
index d802a93d91..7991d6c0c7 100644
--- a/contrib/libs/icu/common/rbbi_cache.h
+++ b/contrib/libs/icu/common/rbbi_cache.h
@@ -1,203 +1,203 @@
-// Copyright (C) 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// file: rbbi_cache.h
-//
-#ifndef RBBI_CACHE_H
-#define RBBI_CACHE_H
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_BREAK_ITERATION
-
-#include "unicode/rbbi.h"
-#include "unicode/uobject.h"
-
-#include "uvectr32.h"
-
-U_NAMESPACE_BEGIN
-
-/* DictionaryCache stores the boundaries obtained from a run of dictionary characters.
- * Dictionary boundaries are moved first to this cache, then from here
- * to the main BreakCache, where they may inter-leave with non-dictionary
- * boundaries. The public BreakIterator API always fetches directly
- * from the main BreakCache, not from here.
- *
- * In common situations, the number of boundaries in a single dictionary run
- * should be quite small, it will be terminated by punctuation, spaces,
- * or any other non-dictionary characters. The main BreakCache may end
- * up with boundaries from multiple dictionary based runs.
- *
- * The boundaries are stored in a simple ArrayList (vector), with the
- * assumption that they will be accessed sequentially.
- */
-class RuleBasedBreakIterator::DictionaryCache: public UMemory {
- public:
- DictionaryCache(RuleBasedBreakIterator *bi, UErrorCode &status);
- ~DictionaryCache();
-
- void reset();
-
- UBool following(int32_t fromPos, int32_t *pos, int32_t *statusIndex);
- UBool preceding(int32_t fromPos, int32_t *pos, int32_t *statusIndex);
-
- /**
- * Populate the cache with the dictionary based boundaries within a region of text.
- * @param startPos The start position of a range of text
- * @param endPos The end position of a range of text
- * @param firstRuleStatus The rule status index that applies to the break at startPos
- * @param otherRuleStatus The rule status index that applies to boundaries other than startPos
- * @internal
- */
- void populateDictionary(int32_t startPos, int32_t endPos,
- int32_t firstRuleStatus, int32_t otherRuleStatus);
-
-
-
- RuleBasedBreakIterator *fBI;
-
- UVector32 fBreaks; // A vector containing the boundaries.
- int32_t fPositionInCache; // Index in fBreaks of last boundary returned by following()
- // or preceding(). Optimizes sequential access.
- int32_t fStart; // Text position of first boundary in cache.
- int32_t fLimit; // Last boundary in cache. Which is the limit of the
- // text segment being handled by the dictionary.
- int32_t fFirstRuleStatusIndex; // Rule status info for first boundary.
- int32_t fOtherRuleStatusIndex; // Rule status info for 2nd through last boundaries.
-};
-
-
-/*
- * class BreakCache
- *
- * Cache of break boundary positions and rule status values.
- * Break iterator API functions, next(), previous(), etc., will use cached results
- * when possible, and otherwise cache new results as they are obtained.
- *
- * Uniformly caches both dictionary and rule based (non-dictionary) boundaries.
- *
- * The cache is implemented as a single circular buffer.
- */
-
-/*
- * size of the circular cache buffer.
- */
-
-class RuleBasedBreakIterator::BreakCache: public UMemory {
- public:
- BreakCache(RuleBasedBreakIterator *bi, UErrorCode &status);
- virtual ~BreakCache();
- void reset(int32_t pos = 0, int32_t ruleStatus = 0);
- void next() { if (fBufIdx == fEndBufIdx) {
- nextOL();
- } else {
- fBufIdx = modChunkSize(fBufIdx + 1);
- fTextIdx = fBI->fPosition = fBoundaries[fBufIdx];
- fBI->fRuleStatusIndex = fStatuses[fBufIdx];
- }
- }
-
-
- void nextOL();
- void previous(UErrorCode &status);
-
- // Move the iteration state to the position following the startPosition.
- // Input position must be pinned to the input length.
- void following(int32_t startPosition, UErrorCode &status);
-
- void preceding(int32_t startPosition, UErrorCode &status);
-
- /*
- * Update the state of the public BreakIterator (fBI) to reflect the
- * current state of the break iterator cache (this).
- */
- int32_t current();
-
- /**
- * Add boundaries to the cache near the specified position.
- * The given position need not be a boundary itself.
- * The input position must be within the range of the text, and
- * on a code point boundary.
- * If the requested position is a break boundary, leave the iteration
- * position on it.
- * If the requested position is not a boundary, leave the iteration
- * position on the preceding boundary and include both the
- * preceding and following boundaries in the cache.
- * Additional boundaries, either preceding or following, may be added
- * to the cache as a side effect.
- *
- * 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.
- * Leave iteration position at the first newly added boundary, or unchanged if no boundary was added.
- */
- UBool populateFollowing();
-
- /**
- * Add one or more boundaries to the cache preceding the first currently cached boundary.
- * Leave the iteration position on the first added boundary.
- * Return false if no boundaries could be added (if at the start of the text.)
- */
- UBool populatePreceding(UErrorCode &status);
-
- enum UpdatePositionValues {
- RetainCachePosition = 0,
- UpdateCachePosition = 1
- };
-
- /*
- * Add the boundary following the current position.
- * The current position can be left as it was, or changed to the newly added boundary,
- * as specified by the update parameter.
- */
- void addFollowing(int32_t position, int32_t ruleStatusIdx, UpdatePositionValues update);
-
-
- /*
- * Add the boundary preceding the current position.
- * The current position can be left as it was, or changed to the newly added boundary,
- * as specified by the update parameter.
- */
- bool addPreceding(int32_t position, int32_t ruleStatusIdx, UpdatePositionValues update);
-
- /**
- * Set the cache position to the specified position, or, if the position
- * falls between to cached boundaries, to the preceding boundary.
- * 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
- * the last cached boundary or before the first.
- */
- UBool seek(int32_t startPosition);
-
- void dumpCache();
-
- private:
- static inline int32_t modChunkSize(int index) { return index & (CACHE_SIZE - 1); }
-
- static constexpr int32_t CACHE_SIZE = 128;
- static_assert((CACHE_SIZE & (CACHE_SIZE-1)) == 0, "CACHE_SIZE must be power of two.");
-
- RuleBasedBreakIterator *fBI;
- int32_t fStartBufIdx;
- int32_t fEndBufIdx; // inclusive
-
- int32_t fTextIdx;
- int32_t fBufIdx;
-
- int32_t fBoundaries[CACHE_SIZE];
- uint16_t fStatuses[CACHE_SIZE];
-
- UVector32 fSideBuffer;
-};
-
-U_NAMESPACE_END
-
-#endif // #if !UCONFIG_NO_BREAK_ITERATION
-
-#endif // RBBI_CACHE_H
+// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// file: rbbi_cache.h
+//
+#ifndef RBBI_CACHE_H
+#define RBBI_CACHE_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_BREAK_ITERATION
+
+#include "unicode/rbbi.h"
+#include "unicode/uobject.h"
+
+#include "uvectr32.h"
+
+U_NAMESPACE_BEGIN
+
+/* DictionaryCache stores the boundaries obtained from a run of dictionary characters.
+ * Dictionary boundaries are moved first to this cache, then from here
+ * to the main BreakCache, where they may inter-leave with non-dictionary
+ * boundaries. The public BreakIterator API always fetches directly
+ * from the main BreakCache, not from here.
+ *
+ * In common situations, the number of boundaries in a single dictionary run
+ * should be quite small, it will be terminated by punctuation, spaces,
+ * or any other non-dictionary characters. The main BreakCache may end
+ * up with boundaries from multiple dictionary based runs.
+ *
+ * The boundaries are stored in a simple ArrayList (vector), with the
+ * assumption that they will be accessed sequentially.
+ */
+class RuleBasedBreakIterator::DictionaryCache: public UMemory {
+ public:
+ DictionaryCache(RuleBasedBreakIterator *bi, UErrorCode &status);
+ ~DictionaryCache();
+
+ void reset();
+
+ UBool following(int32_t fromPos, int32_t *pos, int32_t *statusIndex);
+ UBool preceding(int32_t fromPos, int32_t *pos, int32_t *statusIndex);
+
+ /**
+ * Populate the cache with the dictionary based boundaries within a region of text.
+ * @param startPos The start position of a range of text
+ * @param endPos The end position of a range of text
+ * @param firstRuleStatus The rule status index that applies to the break at startPos
+ * @param otherRuleStatus The rule status index that applies to boundaries other than startPos
+ * @internal
+ */
+ void populateDictionary(int32_t startPos, int32_t endPos,
+ int32_t firstRuleStatus, int32_t otherRuleStatus);
+
+
+
+ RuleBasedBreakIterator *fBI;
+
+ UVector32 fBreaks; // A vector containing the boundaries.
+ int32_t fPositionInCache; // Index in fBreaks of last boundary returned by following()
+ // or preceding(). Optimizes sequential access.
+ int32_t fStart; // Text position of first boundary in cache.
+ int32_t fLimit; // Last boundary in cache. Which is the limit of the
+ // text segment being handled by the dictionary.
+ int32_t fFirstRuleStatusIndex; // Rule status info for first boundary.
+ int32_t fOtherRuleStatusIndex; // Rule status info for 2nd through last boundaries.
+};
+
+
+/*
+ * class BreakCache
+ *
+ * Cache of break boundary positions and rule status values.
+ * Break iterator API functions, next(), previous(), etc., will use cached results
+ * when possible, and otherwise cache new results as they are obtained.
+ *
+ * Uniformly caches both dictionary and rule based (non-dictionary) boundaries.
+ *
+ * The cache is implemented as a single circular buffer.
+ */
+
+/*
+ * size of the circular cache buffer.
+ */
+
+class RuleBasedBreakIterator::BreakCache: public UMemory {
+ public:
+ BreakCache(RuleBasedBreakIterator *bi, UErrorCode &status);
+ virtual ~BreakCache();
+ void reset(int32_t pos = 0, int32_t ruleStatus = 0);
+ void next() { if (fBufIdx == fEndBufIdx) {
+ nextOL();
+ } else {
+ fBufIdx = modChunkSize(fBufIdx + 1);
+ fTextIdx = fBI->fPosition = fBoundaries[fBufIdx];
+ fBI->fRuleStatusIndex = fStatuses[fBufIdx];
+ }
+ }
+
+
+ void nextOL();
+ void previous(UErrorCode &status);
+
+ // Move the iteration state to the position following the startPosition.
+ // Input position must be pinned to the input length.
+ void following(int32_t startPosition, UErrorCode &status);
+
+ void preceding(int32_t startPosition, UErrorCode &status);
+
+ /*
+ * Update the state of the public BreakIterator (fBI) to reflect the
+ * current state of the break iterator cache (this).
+ */
+ int32_t current();
+
+ /**
+ * Add boundaries to the cache near the specified position.
+ * The given position need not be a boundary itself.
+ * The input position must be within the range of the text, and
+ * on a code point boundary.
+ * If the requested position is a break boundary, leave the iteration
+ * position on it.
+ * If the requested position is not a boundary, leave the iteration
+ * position on the preceding boundary and include both the
+ * preceding and following boundaries in the cache.
+ * Additional boundaries, either preceding or following, may be added
+ * to the cache as a side effect.
+ *
+ * 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.
+ * Leave iteration position at the first newly added boundary, or unchanged if no boundary was added.
+ */
+ UBool populateFollowing();
+
+ /**
+ * Add one or more boundaries to the cache preceding the first currently cached boundary.
+ * Leave the iteration position on the first added boundary.
+ * Return false if no boundaries could be added (if at the start of the text.)
+ */
+ UBool populatePreceding(UErrorCode &status);
+
+ enum UpdatePositionValues {
+ RetainCachePosition = 0,
+ UpdateCachePosition = 1
+ };
+
+ /*
+ * Add the boundary following the current position.
+ * The current position can be left as it was, or changed to the newly added boundary,
+ * as specified by the update parameter.
+ */
+ void addFollowing(int32_t position, int32_t ruleStatusIdx, UpdatePositionValues update);
+
+
+ /*
+ * Add the boundary preceding the current position.
+ * The current position can be left as it was, or changed to the newly added boundary,
+ * as specified by the update parameter.
+ */
+ bool addPreceding(int32_t position, int32_t ruleStatusIdx, UpdatePositionValues update);
+
+ /**
+ * Set the cache position to the specified position, or, if the position
+ * falls between to cached boundaries, to the preceding boundary.
+ * 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
+ * the last cached boundary or before the first.
+ */
+ UBool seek(int32_t startPosition);
+
+ void dumpCache();
+
+ private:
+ static inline int32_t modChunkSize(int index) { return index & (CACHE_SIZE - 1); }
+
+ static constexpr int32_t CACHE_SIZE = 128;
+ static_assert((CACHE_SIZE & (CACHE_SIZE-1)) == 0, "CACHE_SIZE must be power of two.");
+
+ RuleBasedBreakIterator *fBI;
+ int32_t fStartBufIdx;
+ int32_t fEndBufIdx; // inclusive
+
+ int32_t fTextIdx;
+ int32_t fBufIdx;
+
+ int32_t fBoundaries[CACHE_SIZE];
+ uint16_t fStatuses[CACHE_SIZE];
+
+ UVector32 fSideBuffer;
+};
+
+U_NAMESPACE_END
+
+#endif // #if !UCONFIG_NO_BREAK_ITERATION
+
+#endif // RBBI_CACHE_H
diff --git a/contrib/libs/icu/common/rbbidata.cpp b/contrib/libs/icu/common/rbbidata.cpp
index 1568739210..1d4c9e5895 100644
--- a/contrib/libs/icu/common/rbbidata.cpp
+++ b/contrib/libs/icu/common/rbbidata.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
***************************************************************************
@@ -14,7 +14,7 @@
#include "unicode/utypes.h"
#include "rbbidata.h"
#include "rbbirb.h"
-#include "utrie2.h"
+#include "utrie2.h"
#include "udatamem.h"
#include "cmemory.h"
#include "cstring.h"
@@ -54,8 +54,8 @@ RBBIDataWrapper::RBBIDataWrapper(UDataMemory* udm, UErrorCode &status) {
dh->info.dataFormat[0] == 0x42 && // dataFormat="Brk "
dh->info.dataFormat[1] == 0x72 &&
dh->info.dataFormat[2] == 0x6b &&
- dh->info.dataFormat[3] == 0x20 &&
- isDataVersionAcceptable(dh->info.formatVersion))
+ dh->info.dataFormat[3] == 0x20 &&
+ isDataVersionAcceptable(dh->info.formatVersion))
) {
status = U_INVALID_FORMAT_ERROR;
return;
@@ -66,11 +66,11 @@ RBBIDataWrapper::RBBIDataWrapper(UDataMemory* udm, UErrorCode &status) {
fUDataMem = udm;
}
-UBool RBBIDataWrapper::isDataVersionAcceptable(const UVersionInfo version) {
- return RBBI_DATA_FORMAT_VERSION[0] == version[0];
-}
-
-
+UBool RBBIDataWrapper::isDataVersionAcceptable(const UVersionInfo version) {
+ return RBBI_DATA_FORMAT_VERSION[0] == version[0];
+}
+
+
//-----------------------------------------------------------------------------
//
// init(). Does most of the work of construction, shared between the
@@ -81,11 +81,11 @@ void RBBIDataWrapper::init0() {
fHeader = NULL;
fForwardTable = NULL;
fReverseTable = NULL;
- fRuleSource = NULL;
+ fRuleSource = NULL;
fRuleStatusTable = NULL;
- fTrie = NULL;
- fUDataMem = NULL;
- fRefCount = 0;
+ fTrie = NULL;
+ fUDataMem = NULL;
+ fRefCount = 0;
fDontFreeData = TRUE;
}
@@ -94,7 +94,7 @@ void RBBIDataWrapper::init(const RBBIDataHeader *data, UErrorCode &status) {
return;
}
fHeader = data;
- if (fHeader->fMagic != 0xb1a0 || !isDataVersionAcceptable(fHeader->fFormatVersion)) {
+ if (fHeader->fMagic != 0xb1a0 || !isDataVersionAcceptable(fHeader->fFormatVersion)) {
status = U_INVALID_FORMAT_ERROR;
return;
}
@@ -110,11 +110,11 @@ 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 = utrie2_openFromSerialized(UTRIE2_16_VALUE_BITS,
+ (uint8_t *)data + fHeader->fTrie,
+ fHeader->fTrieLen,
+ NULL, // *actual length
+ &status);
if (U_FAILURE(status)) {
return;
}
@@ -142,8 +142,8 @@ void RBBIDataWrapper::init(const RBBIDataHeader *data, UErrorCode &status) {
//-----------------------------------------------------------------------------
RBBIDataWrapper::~RBBIDataWrapper() {
U_ASSERT(fRefCount == 0);
- utrie2_close(fTrie);
- fTrie = NULL;
+ utrie2_close(fTrie);
+ fTrie = NULL;
if (fUDataMem) {
udata_close(fUDataMem);
} else if (!fDontFreeData) {
@@ -250,7 +250,7 @@ void RBBIDataWrapper::printTable(const char *heading, const RBBIStateTable *tab
#endif
-void RBBIDataWrapper::printData() {
+void RBBIDataWrapper::printData() {
#ifdef RBBI_DEBUG
RBBIDebugPrintf("RBBI Data at %p\n", (void *)fHeader);
RBBIDebugPrintf(" Version = {%d %d %d %d}\n", fHeader->fFormatVersion[0], fHeader->fFormatVersion[1],
@@ -266,7 +266,7 @@ void RBBIDataWrapper::printData() {
RBBIDebugPrintf("%c", fRuleSource[c]);
}
RBBIDebugPrintf("\n\n");
-#endif
+#endif
}
@@ -300,7 +300,7 @@ ubrk_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outD
pInfo->dataFormat[1]==0x72 &&
pInfo->dataFormat[2]==0x6b &&
pInfo->dataFormat[3]==0x20 &&
- RBBIDataWrapper::isDataVersionAcceptable(pInfo->formatVersion) )) {
+ RBBIDataWrapper::isDataVersionAcceptable(pInfo->formatVersion) )) {
udata_printError(ds, "ubrk_swap(): data format %02x.%02x.%02x.%02x (format version %02x) is not recognized\n",
pInfo->dataFormat[0], pInfo->dataFormat[1],
pInfo->dataFormat[2], pInfo->dataFormat[3],
@@ -324,8 +324,8 @@ ubrk_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outD
const uint8_t *inBytes =(const uint8_t *)inData+headerSize;
RBBIDataHeader *rbbiDH = (RBBIDataHeader *)inBytes;
if (ds->readUInt32(rbbiDH->fMagic) != 0xb1a0 ||
- !RBBIDataWrapper::isDataVersionAcceptable(rbbiDH->fFormatVersion) ||
- ds->readUInt32(rbbiDH->fLength) < sizeof(RBBIDataHeader)) {
+ !RBBIDataWrapper::isDataVersionAcceptable(rbbiDH->fFormatVersion) ||
+ ds->readUInt32(rbbiDH->fLength) < sizeof(RBBIDataHeader)) {
udata_printError(ds, "ubrk_swap(): RBBI Data header is invalid.\n");
*status=U_UNSUPPORTED_ERROR;
return 0;
@@ -400,8 +400,8 @@ ubrk_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outD
}
// Trie table for character categories
- utrie2_swap(ds, inBytes+ds->readUInt32(rbbiDH->fTrie), ds->readUInt32(rbbiDH->fTrieLen),
- outBytes+ds->readUInt32(rbbiDH->fTrie), status);
+ utrie2_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),
diff --git a/contrib/libs/icu/common/rbbidata.h b/contrib/libs/icu/common/rbbidata.h
index 7035aa9ed0..7b9b8d8252 100644
--- a/contrib/libs/icu/common/rbbidata.h
+++ b/contrib/libs/icu/common/rbbidata.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: rbbidata.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -51,21 +51,21 @@ ubrk_swap(const UDataSwapper *ds,
#include "unicode/uobject.h"
#include "unicode/unistr.h"
-#include "unicode/uversion.h"
+#include "unicode/uversion.h"
#include "umutex.h"
-#include "utrie2.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};
-
+// The current RBBI data format version.
+static const uint8_t RBBI_DATA_FORMAT_VERSION[] = {5, 0, 0, 0};
+
/*
* The following structs map exactly onto the raw data from ICU common data file.
*/
struct RBBIDataHeader {
uint32_t fMagic; /* == 0xbla0 */
- UVersionInfo fFormatVersion; /* Data Format. Same as the value in struct UDataInfo */
+ UVersionInfo fFormatVersion; /* Data Format. Same as the value in struct UDataInfo */
/* if there is one associated with this data. */
/* (version originates in rbbi, is copied to UDataInfo) */
uint32_t fLength; /* Total length in bytes of this RBBI Data, */
@@ -112,10 +112,10 @@ struct RBBIStateTableRow {
/* 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*/
+ 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. */
};
@@ -126,9 +126,9 @@ struct RBBIStateTable {
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. */
+ 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.) */
};
@@ -152,8 +152,8 @@ public:
RBBIDataWrapper(UDataMemory* udm, UErrorCode &status);
~RBBIDataWrapper();
- static UBool isDataVersionAcceptable(const UVersionInfo version);
-
+ static UBool isDataVersionAcceptable(const UVersionInfo version);
+
void init0();
void init(const RBBIDataHeader *data, UErrorCode &status);
RBBIDataWrapper *addReference();
@@ -176,11 +176,11 @@ public:
/* number of int32_t values in the rule status table. Used to sanity check indexing */
int32_t fStatusMaxIdx;
- UTrie2 *fTrie;
+ UTrie2 *fTrie;
private:
u_atomic_int32_t fRefCount;
- UDataMemory *fUDataMem;
+ UDataMemory *fUDataMem;
UnicodeString fRuleString;
UBool fDontFreeData;
@@ -192,8 +192,8 @@ private:
U_NAMESPACE_END
-U_CFUNC UBool rbbi_cleanup(void);
-
+U_CFUNC UBool rbbi_cleanup(void);
+
#endif /* C++ */
#endif
diff --git a/contrib/libs/icu/common/rbbinode.cpp b/contrib/libs/icu/common/rbbinode.cpp
index 5c07cf383e..69d84151fe 100644
--- a/contrib/libs/icu/common/rbbinode.cpp
+++ b/contrib/libs/icu/common/rbbinode.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
***************************************************************************
diff --git a/contrib/libs/icu/common/rbbinode.h b/contrib/libs/icu/common/rbbinode.h
index 12fd3fa023..f352596022 100644
--- a/contrib/libs/icu/common/rbbinode.h
+++ b/contrib/libs/icu/common/rbbinode.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************
* COPYRIGHT:
diff --git a/contrib/libs/icu/common/rbbirb.cpp b/contrib/libs/icu/common/rbbirb.cpp
index 39b4267bc8..68ded32e1d 100644
--- a/contrib/libs/icu/common/rbbirb.cpp
+++ b/contrib/libs/icu/common/rbbirb.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// file: rbbirb.cpp
@@ -24,7 +24,7 @@
#include "unicode/uchriter.h"
#include "unicode/parsepos.h"
#include "unicode/parseerr.h"
-
+
#include "cmemory.h"
#include "cstring.h"
#include "rbbirb.h"
@@ -33,7 +33,7 @@
#include "rbbisetb.h"
#include "rbbitblb.h"
#include "rbbidata.h"
-#include "uassert.h"
+#include "uassert.h"
U_NAMESPACE_BEGIN
@@ -47,7 +47,7 @@ U_NAMESPACE_BEGIN
RBBIRuleBuilder::RBBIRuleBuilder(const UnicodeString &rules,
UParseError *parseErr,
UErrorCode &status)
- : fRules(rules), fStrippedRules(rules)
+ : fRules(rules), fStrippedRules(rules)
{
fStatus = &status; // status is checked below
fParseError = parseErr;
@@ -62,7 +62,7 @@ RBBIRuleBuilder::RBBIRuleBuilder(const UnicodeString &rules,
fSafeFwdTree = NULL;
fSafeRevTree = NULL;
fDefaultTree = &fForwardTree;
- fForwardTable = NULL;
+ fForwardTable = NULL;
fRuleStatusVals = NULL;
fChainRules = FALSE;
fLBCMNoChain = FALSE;
@@ -111,7 +111,7 @@ RBBIRuleBuilder::~RBBIRuleBuilder() {
delete fUSetNodes;
delete fSetBuilder;
- delete fForwardTable;
+ delete fForwardTable;
delete fForwardTree;
delete fReverseTree;
delete fSafeFwdTree;
@@ -140,9 +140,9 @@ RBBIDataHeader *RBBIRuleBuilder::flattenData() {
return NULL;
}
- // Remove whitespace from the rules to make it smaller.
- // The rule parser has already removed comments.
- fStrippedRules = fScanner->stripRules(fStrippedRules);
+ // Remove whitespace from the rules to make it smaller.
+ // The rule parser has already removed comments.
+ fStrippedRules = fScanner->stripRules(fStrippedRules);
// Calculate the size of each section in the data.
// Sizes here are padded up to a multiple of 8 for better memory alignment.
@@ -150,30 +150,30 @@ RBBIDataHeader *RBBIRuleBuilder::flattenData() {
// without the padding.
//
int32_t headerSize = align8(sizeof(RBBIDataHeader));
- int32_t forwardTableSize = align8(fForwardTable->getTableSize());
- int32_t reverseTableSize = align8(fForwardTable->getSafeTableSize());
+ int32_t forwardTableSize = align8(fForwardTable->getTableSize());
+ 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 rulesSize = align8((fStrippedRules.length()+1) * sizeof(UChar));
- int32_t totalSize = headerSize
- + forwardTableSize
- + reverseTableSize
+ int32_t totalSize = headerSize
+ + forwardTableSize
+ + reverseTableSize
+ statusTableSize + trieSize + rulesSize;
-#ifdef RBBI_DEBUG
- if (fDebugEnv && uprv_strstr(fDebugEnv, "size")) {
- RBBIDebugPrintf("Header Size: %8d\n", headerSize);
- RBBIDebugPrintf("Forward Table Size: %8d\n", forwardTableSize);
- RBBIDebugPrintf("Reverse Table Size: %8d\n", reverseTableSize);
- RBBIDebugPrintf("Trie Size: %8d\n", trieSize);
- RBBIDebugPrintf("Status Table Size: %8d\n", statusTableSize);
- RBBIDebugPrintf("Rules Size: %8d\n", rulesSize);
- RBBIDebugPrintf("-----------------------------\n");
- RBBIDebugPrintf("Total Size: %8d\n", totalSize);
- }
-#endif
-
+#ifdef RBBI_DEBUG
+ if (fDebugEnv && uprv_strstr(fDebugEnv, "size")) {
+ RBBIDebugPrintf("Header Size: %8d\n", headerSize);
+ RBBIDebugPrintf("Forward Table Size: %8d\n", forwardTableSize);
+ RBBIDebugPrintf("Reverse Table Size: %8d\n", reverseTableSize);
+ RBBIDebugPrintf("Trie Size: %8d\n", trieSize);
+ RBBIDebugPrintf("Status Table Size: %8d\n", statusTableSize);
+ RBBIDebugPrintf("Rules Size: %8d\n", rulesSize);
+ RBBIDebugPrintf("-----------------------------\n");
+ RBBIDebugPrintf("Total Size: %8d\n", totalSize);
+ }
+#endif
+
RBBIDataHeader *data = (RBBIDataHeader *)uprv_malloc(totalSize);
if (data == NULL) {
*fStatus = U_MEMORY_ALLOCATION_ERROR;
@@ -183,30 +183,30 @@ RBBIDataHeader *RBBIRuleBuilder::flattenData() {
data->fMagic = 0xb1a0;
- data->fFormatVersion[0] = RBBI_DATA_FORMAT_VERSION[0];
- data->fFormatVersion[1] = RBBI_DATA_FORMAT_VERSION[1];
- data->fFormatVersion[2] = RBBI_DATA_FORMAT_VERSION[2];
- data->fFormatVersion[3] = RBBI_DATA_FORMAT_VERSION[3];
+ data->fFormatVersion[0] = RBBI_DATA_FORMAT_VERSION[0];
+ data->fFormatVersion[1] = RBBI_DATA_FORMAT_VERSION[1];
+ data->fFormatVersion[2] = RBBI_DATA_FORMAT_VERSION[2];
+ data->fFormatVersion[3] = RBBI_DATA_FORMAT_VERSION[3];
data->fLength = totalSize;
data->fCatCount = fSetBuilder->getNumCharCategories();
data->fFTable = headerSize;
data->fFTableLen = forwardTableSize;
-
- data->fRTable = data->fFTable + data->fFTableLen;
+
+ data->fRTable = data->fFTable + data->fFTableLen;
data->fRTableLen = reverseTableSize;
- data->fTrie = data->fRTable + data->fRTableLen;
+ data->fTrie = data->fRTable + data->fRTableLen;
data->fTrieLen = fSetBuilder->getTrieSize();
data->fStatusTable = data->fTrie + trieSize;
data->fStatusTableLen= statusTableSize;
data->fRuleSource = data->fStatusTable + statusTableSize;
- data->fRuleSourceLen = fStrippedRules.length() * sizeof(UChar);
+ data->fRuleSourceLen = fStrippedRules.length() * sizeof(UChar);
uprv_memset(data->fReserved, 0, sizeof(data->fReserved));
- fForwardTable->exportTable((uint8_t *)data + data->fFTable);
- fForwardTable->exportSafeTable((uint8_t *)data + data->fRTable);
+ fForwardTable->exportTable((uint8_t *)data + data->fFTable);
+ fForwardTable->exportSafeTable((uint8_t *)data + data->fRTable);
fSetBuilder->serializeTrie ((uint8_t *)data + data->fTrie);
int32_t *ruleStatusTable = (int32_t *)((uint8_t *)data + data->fStatusTable);
@@ -214,7 +214,7 @@ RBBIDataHeader *RBBIRuleBuilder::flattenData() {
ruleStatusTable[i] = fRuleStatusVals->elementAti(i);
}
- fStrippedRules.extract((UChar *)((uint8_t *)data+data->fRuleSource), rulesSize/2+1, *fStatus);
+ fStrippedRules.extract((UChar *)((uint8_t *)data+data->fRuleSource), rulesSize/2+1, *fStatus);
return data;
}
@@ -240,100 +240,100 @@ RBBIRuleBuilder::createRuleBasedBreakIterator( const UnicodeString &rules,
return NULL;
}
- RBBIDataHeader *data = builder.build(status);
-
- if (U_FAILURE(status)) {
- return nullptr;
- }
-
+ RBBIDataHeader *data = builder.build(status);
+
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+
//
- // Create a break iterator from the compiled rules.
- // (Identical to creation from stored pre-compiled rules)
- //
- // status is checked after init in construction.
- RuleBasedBreakIterator *This = new RuleBasedBreakIterator(data, status);
- if (U_FAILURE(status)) {
- delete This;
- This = NULL;
- }
- else if(This == NULL) { // test for NULL
- status = U_MEMORY_ALLOCATION_ERROR;
- }
- return This;
-}
-
-RBBIDataHeader *RBBIRuleBuilder::build(UErrorCode &status) {
- if (U_FAILURE(status)) {
- return nullptr;
- }
-
- fScanner->parse();
- if (U_FAILURE(status)) {
- return nullptr;
+ // Create a break iterator from the compiled rules.
+ // (Identical to creation from stored pre-compiled rules)
+ //
+ // status is checked after init in construction.
+ RuleBasedBreakIterator *This = new RuleBasedBreakIterator(data, status);
+ if (U_FAILURE(status)) {
+ delete This;
+ This = NULL;
}
-
- //
+ else if(This == NULL) { // test for NULL
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
+ return This;
+}
+
+RBBIDataHeader *RBBIRuleBuilder::build(UErrorCode &status) {
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+
+ fScanner->parse();
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+
+ //
// UnicodeSet processing.
// Munge the Unicode Sets to create a set of character categories.
- // Generate the mapping tables (TRIE) from input code points to
+ // Generate the mapping tables (TRIE) from input code points to
// the character categories.
//
- fSetBuilder->buildRanges();
+ fSetBuilder->buildRanges();
//
// Generate the DFA state transition table.
//
- fForwardTable = new RBBITableBuilder(this, &fForwardTree, status);
- if (fForwardTable == nullptr) {
+ fForwardTable = new RBBITableBuilder(this, &fForwardTree, status);
+ if (fForwardTable == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
+ return nullptr;
}
- fForwardTable->buildForwardTable();
- optimizeTables();
- fForwardTable->buildSafeReverseTable(status);
+ fForwardTable->buildForwardTable();
+ optimizeTables();
+ fForwardTable->buildSafeReverseTable(status);
+
-
#ifdef RBBI_DEBUG
- if (fDebugEnv && uprv_strstr(fDebugEnv, "states")) {
- fForwardTable->printStates();
- fForwardTable->printRuleStatusTable();
- fForwardTable->printReverseTable();
+ if (fDebugEnv && uprv_strstr(fDebugEnv, "states")) {
+ fForwardTable->printStates();
+ fForwardTable->printRuleStatusTable();
+ fForwardTable->printReverseTable();
}
#endif
- fSetBuilder->buildTrie();
-
+ fSetBuilder->buildTrie();
+
//
// Package up the compiled data into a memory image
// in the run-time format.
//
- RBBIDataHeader *data = flattenData(); // returns NULL if error
- if (U_FAILURE(status)) {
- return nullptr;
+ RBBIDataHeader *data = flattenData(); // returns NULL if error
+ if (U_FAILURE(status)) {
+ return nullptr;
}
- return data;
-}
-
-void RBBIRuleBuilder::optimizeTables() {
- bool didSomething;
- do {
- didSomething = false;
-
- // Begin looking for duplicates with char class 3.
- // Classes 0, 1 and 2 are special; they are unused, {bof} and {eof} respectively,
- // and should not have other categories merged into them.
- IntPair duplPair = {3, 0};
- while (fForwardTable->findDuplCharClassFrom(&duplPair)) {
- fSetBuilder->mergeCategories(duplPair);
- fForwardTable->removeColumn(duplPair.second);
- didSomething = true;
- }
-
- while (fForwardTable->removeDuplicateStates() > 0) {
- didSomething = true;
- }
- } while (didSomething);
+ return data;
+}
+
+void RBBIRuleBuilder::optimizeTables() {
+ bool didSomething;
+ do {
+ didSomething = false;
+
+ // Begin looking for duplicates with char class 3.
+ // Classes 0, 1 and 2 are special; they are unused, {bof} and {eof} respectively,
+ // and should not have other categories merged into them.
+ IntPair duplPair = {3, 0};
+ while (fForwardTable->findDuplCharClassFrom(&duplPair)) {
+ fSetBuilder->mergeCategories(duplPair);
+ fForwardTable->removeColumn(duplPair.second);
+ didSomething = true;
+ }
+
+ while (fForwardTable->removeDuplicateStates() > 0) {
+ didSomething = true;
+ }
+ } while (didSomething);
}
U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/rbbirb.h b/contrib/libs/icu/common/rbbirb.h
index da452d88f4..037c1dc2ce 100644
--- a/contrib/libs/icu/common/rbbirb.h
+++ b/contrib/libs/icu/common/rbbirb.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// rbbirb.h
@@ -15,11 +15,11 @@
#define RBBIRB_H
#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_BREAK_ITERATION
-
-#include <utility>
-
+
+#if !UCONFIG_NO_BREAK_ITERATION
+
+#include <utility>
+
#include "unicode/uobject.h"
#include "unicode/rbbi.h"
#include "unicode/uniset.h"
@@ -27,7 +27,7 @@
#include "uhash.h"
#include "uvector.h"
#include "unicode/symtable.h"// For UnicodeSet parsing, is the interface that
- // looks up references to $variables within a set.
+ // looks up references to $variables within a set.
U_NAMESPACE_BEGIN
@@ -124,28 +124,28 @@ public:
RBBIRuleBuilder(const UnicodeString &rules,
UParseError *parseErr,
UErrorCode &status
- );
+ );
virtual ~RBBIRuleBuilder();
-
- /**
- * Build the state tables and char class Trie from the source rules.
- */
- RBBIDataHeader *build(UErrorCode &status);
-
-
- /**
- * Fold together redundant character classes (table columns) and
- * redundant states (table rows). Done after initial table generation,
- * before serializing the result.
- */
- void optimizeTables();
-
+
+ /**
+ * Build the state tables and char class Trie from the source rules.
+ */
+ RBBIDataHeader *build(UErrorCode &status);
+
+
+ /**
+ * Fold together redundant character classes (table columns) and
+ * redundant states (table rows). Done after initial table generation,
+ * before serializing the result.
+ */
+ void optimizeTables();
+
char *fDebugEnv; // controls debug trace output
UErrorCode *fStatus; // Error reporting. Keeping status
UParseError *fParseError; // here avoids passing it everywhere.
const UnicodeString &fRules; // The rule string that we are compiling
- UnicodeString fStrippedRules; // The rule string, with comments stripped.
+ UnicodeString fStrippedRules; // The rule string, with comments stripped.
RBBIRuleScanner *fScanner; // The scanner.
RBBINode *fForwardTree; // The parse trees, generated by the scanner,
@@ -169,7 +169,7 @@ public:
RBBISetBuilder *fSetBuilder; // Set and Character Category builder.
UVector *fUSetNodes; // Vector of all uset nodes.
- RBBITableBuilder *fForwardTable; // State transition table, build time form.
+ RBBITableBuilder *fForwardTable; // State transition table, build time form.
UVector *fRuleStatusVals; // The values that can be returned
// from getRuleStatus().
@@ -204,12 +204,12 @@ struct RBBISetTableEl {
RBBINode *val;
};
-/**
- * A pair of ints, used to bundle pairs of states or pairs of character classes.
- */
-typedef std::pair<int32_t, int32_t> IntPair;
+/**
+ * A pair of ints, used to bundle pairs of states or pairs of character classes.
+ */
+typedef std::pair<int32_t, int32_t> IntPair;
+
-
//----------------------------------------------------------------------------
//
// RBBIDebugPrintf Printf equivalent, for debugging output.
@@ -228,9 +228,9 @@ typedef std::pair<int32_t, int32_t> IntPair;
#endif
U_NAMESPACE_END
-
-#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
-
+
+#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
+
#endif
diff --git a/contrib/libs/icu/common/rbbirpt.h b/contrib/libs/icu/common/rbbirpt.h
index 501c1992bb..586953c90c 100644
--- a/contrib/libs/icu/common/rbbirpt.h
+++ b/contrib/libs/icu/common/rbbirpt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//---------------------------------------------------------------------------------
//
diff --git a/contrib/libs/icu/common/rbbiscan.cpp b/contrib/libs/icu/common/rbbiscan.cpp
index 887192d3a9..4eb324b4b9 100644
--- a/contrib/libs/icu/common/rbbiscan.cpp
+++ b/contrib/libs/icu/common/rbbiscan.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// file: rbbiscan.cpp
@@ -47,7 +47,7 @@
//
//------------------------------------------------------------------------------
static const UChar gRuleSet_rule_char_pattern[] = {
- // Characters that may appear as literals in patterns without escaping or quoting.
+ // Characters that may appear as literals in patterns without escaping or quoting.
// [ ^ [ \ p { Z } \ u 0 0 2 0
0x5b, 0x5e, 0x5b, 0x5c, 0x70, 0x7b, 0x5a, 0x7d, 0x5c, 0x75, 0x30, 0x30, 0x32, 0x30,
// - \ u 0 0 7 f ] - [ \ p
@@ -372,7 +372,7 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
// (forward, reverse, safe_forward, safe_reverse)
// OR this rule into the appropriate group of them.
//
- RBBINode **destRules = (fReverseRule? &fRB->fSafeRevTree : fRB->fDefaultTree);
+ RBBINode **destRules = (fReverseRule? &fRB->fSafeRevTree : fRB->fDefaultTree);
if (*destRules != NULL) {
// This is not the first rule encounted.
@@ -380,7 +380,7 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
// with the current rule expression (on the Node Stack)
// with the resulting OR expression going to *destRules
//
- thisRule = fNodeStack[fNodeStackPtr];
+ thisRule = fNodeStack[fNodeStackPtr];
RBBINode *prevRules = *destRules;
RBBINode *orNode = pushNewNode(RBBINode::opOr);
if (U_FAILURE(*fRB->fStatus)) {
@@ -559,10 +559,10 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
fRB->fDefaultTree = &fRB->fSafeRevTree;
} else if (opt == UNICODE_STRING("lookAheadHardBreak", 18)) {
fRB->fLookAheadHardBreak = TRUE;
- } else if (opt == UNICODE_STRING("quoted_literals_only", 20)) {
- fRuleSets[kRuleSet_rule_char-128].clear();
- } else if (opt == UNICODE_STRING("unquoted_literals", 17)) {
- fRuleSets[kRuleSet_rule_char-128].applyPattern(UnicodeString(gRuleSet_rule_char_pattern), *fRB->fStatus);
+ } else if (opt == UNICODE_STRING("quoted_literals_only", 20)) {
+ fRuleSets[kRuleSet_rule_char-128].clear();
+ } else if (opt == UNICODE_STRING("unquoted_literals", 17)) {
+ fRuleSets[kRuleSet_rule_char-128].applyPattern(UnicodeString(gRuleSet_rule_char_pattern), *fRB->fStatus);
} else {
error(U_BRK_UNRECOGNIZED_OPTION);
}
@@ -822,23 +822,23 @@ static const UChar chRParen = 0x29;
//------------------------------------------------------------------------------
//
-// stripRules Return a rules string without extra spaces.
-// (Comments are removed separately, during rule parsing.)
+// stripRules Return a rules string without extra spaces.
+// (Comments are removed separately, during rule parsing.)
//
//------------------------------------------------------------------------------
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) {
- continue;
+ 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) {
+ continue;
}
- strippedRules.append(cp);
- skippingSpaces = whiteSpace;
+ strippedRules.append(cp);
+ skippingSpaces = whiteSpace;
}
return strippedRules;
}
@@ -939,7 +939,7 @@ void RBBIRuleScanner::nextChar(RBBIRuleChar &c) {
// It will be treated as white-space, and serves to break up anything
// that might otherwise incorrectly clump together with a comment in
// the middle (a variable name, for example.)
- int32_t commentStart = fScanIndex;
+ int32_t commentStart = fScanIndex;
for (;;) {
c.fChar = nextCharLL();
if (c.fChar == (UChar32)-1 || // EOF
@@ -948,9 +948,9 @@ void RBBIRuleScanner::nextChar(RBBIRuleChar &c) {
c.fChar == chNEL ||
c.fChar == chLS) {break;}
}
- for (int32_t i=commentStart; i<fNextIndex-1; ++i) {
- fRB->fStrippedRules.setCharAt(i, u' ');
- }
+ for (int32_t i=commentStart; i<fNextIndex-1; ++i) {
+ fRB->fStrippedRules.setCharAt(i, u' ');
+ }
}
if (c.fChar == (UChar32)-1) {
return;
@@ -1169,12 +1169,12 @@ RBBINode *RBBIRuleScanner::pushNewNode(RBBINode::NodeType t) {
if (U_FAILURE(*fRB->fStatus)) {
return NULL;
}
- if (fNodeStackPtr >= kStackSize - 1) {
- error(U_BRK_RULE_SYNTAX);
+ if (fNodeStackPtr >= kStackSize - 1) {
+ error(U_BRK_RULE_SYNTAX);
RBBIDebugPuts("RBBIRuleScanner::pushNewNode - stack overflow.");
return NULL;
}
- fNodeStackPtr++;
+ fNodeStackPtr++;
fNodeStack[fNodeStackPtr] = new RBBINode(t);
if (fNodeStack[fNodeStackPtr] == NULL) {
*fRB->fStatus = U_MEMORY_ALLOCATION_ERROR;
@@ -1274,10 +1274,10 @@ void RBBIRuleScanner::scanSet() {
}
-int32_t RBBIRuleScanner::numRules() {
- return fRuleNum;
-}
-
+int32_t RBBIRuleScanner::numRules() {
+ return fRuleNum;
+}
+
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
diff --git a/contrib/libs/icu/common/rbbiscan.h b/contrib/libs/icu/common/rbbiscan.h
index 3546263013..6828ba3934 100644
--- a/contrib/libs/icu/common/rbbiscan.h
+++ b/contrib/libs/icu/common/rbbiscan.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// rbbiscan.h
@@ -54,7 +54,7 @@ public:
struct RBBIRuleChar {
UChar32 fChar;
UBool fEscaped;
- RBBIRuleChar() : fChar(0), fEscaped(FALSE) {}
+ RBBIRuleChar() : fChar(0), fEscaped(FALSE) {}
};
RBBIRuleScanner(RBBIRuleBuilder *rb);
@@ -73,8 +73,8 @@ public:
// reverse rules,
// and a list of UnicodeSets encountered.
- int32_t numRules(); // Return the number of rules that have been seen.
-
+ int32_t numRules(); // Return the number of rules that have been seen.
+
/**
* Return a rules string without unnecessary
* characters.
diff --git a/contrib/libs/icu/common/rbbisetb.cpp b/contrib/libs/icu/common/rbbisetb.cpp
index 1aed2b1ba1..36e2e07e9c 100644
--- a/contrib/libs/icu/common/rbbisetb.cpp
+++ b/contrib/libs/icu/common/rbbisetb.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// rbbisetb.cpp
@@ -35,7 +35,7 @@
#if !UCONFIG_NO_BREAK_ITERATION
#include "unicode/uniset.h"
-#include "utrie2.h"
+#include "utrie2.h"
#include "uvector.h"
#include "uassert.h"
#include "cmemory.h"
@@ -79,7 +79,7 @@ RBBISetBuilder::~RBBISetBuilder()
delete r;
}
- utrie2_close(fTrie);
+ utrie2_close(fTrie);
}
@@ -91,7 +91,7 @@ RBBISetBuilder::~RBBISetBuilder()
// from the Unicode Sets.
//
//------------------------------------------------------------------------
-void RBBISetBuilder::buildRanges() {
+void RBBISetBuilder::buildRanges() {
RBBINode *usetNode;
RangeDescriptor *rlRange;
@@ -245,64 +245,64 @@ void RBBISetBuilder::buildRanges() {
if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "rgroup")) {printRangeGroups();}
if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "esets")) {printSets();}
-}
-
-
-//
-// Build the Trie table for mapping UChar32 values to the corresponding
-// range group number.
-//
-void RBBISetBuilder::buildTrie() {
- RangeDescriptor *rlRange;
-
- fTrie = utrie2_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);
+}
+
+
+//
+// Build the Trie table for mapping UChar32 values to the corresponding
+// range group number.
+//
+void RBBISetBuilder::buildTrie() {
+ RangeDescriptor *rlRange;
+
+ fTrie = utrie2_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);
+ }
+}
+
+
+void RBBISetBuilder::mergeCategories(IntPair categories) {
+ U_ASSERT(categories.first >= 1);
+ U_ASSERT(categories.second > categories.first);
+ for (RangeDescriptor *rd = fRangeList; rd != nullptr; rd = rd->fNext) {
+ int32_t rangeNum = rd->fNum & ~DICT_BIT;
+ int32_t rangeDict = rd->fNum & DICT_BIT;
+ if (rangeNum == categories.second) {
+ rd->fNum = categories.first | rangeDict;
+ } else if (rangeNum > categories.second) {
+ rd->fNum--;
+ }
}
+ --fGroupCount;
}
-void RBBISetBuilder::mergeCategories(IntPair categories) {
- U_ASSERT(categories.first >= 1);
- U_ASSERT(categories.second > categories.first);
- for (RangeDescriptor *rd = fRangeList; rd != nullptr; rd = rd->fNext) {
- int32_t rangeNum = rd->fNum & ~DICT_BIT;
- int32_t rangeDict = rd->fNum & DICT_BIT;
- if (rangeNum == categories.second) {
- rd->fNum = categories.first | rangeDict;
- } else if (rangeNum > categories.second) {
- rd->fNum--;
- }
- }
- --fGroupCount;
-}
-
-
//-----------------------------------------------------------------------------------
//
// getTrieSize() Return the size that will be required to serialize the Trie.
//
//-----------------------------------------------------------------------------------
-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;
- }
+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;
+ }
// RBBIDebugPrintf("Trie table size is %d\n", trieSize);
return fTrieSize;
}
@@ -316,10 +316,10 @@ int32_t RBBISetBuilder::getTrieSize() {
//
//-----------------------------------------------------------------------------------
void RBBISetBuilder::serializeTrie(uint8_t *where) {
- utrie2_serialize(fTrie,
- where, // Buffer
- fTrieSize, // Capacity
- fStatus);
+ utrie2_serialize(fTrie,
+ where, // Buffer
+ fTrieSize, // Capacity
+ fStatus);
}
//------------------------------------------------------------------------
@@ -467,7 +467,7 @@ void RBBISetBuilder::printRangeGroups() {
lastPrintedGroupNum = groupNum;
RBBIDebugPrintf("%2i ", groupNum);
- if (rlRange->fNum & DICT_BIT) { RBBIDebugPrintf(" <DICT> ");}
+ if (rlRange->fNum & DICT_BIT) { RBBIDebugPrintf(" <DICT> ");}
for (i=0; i<rlRange->fIncludesSets->size(); i++) {
RBBINode *usetNode = (RBBINode *)rlRange->fIncludesSets->elementAt(i);
@@ -660,18 +660,18 @@ void RangeDescriptor::split(UChar32 where, UErrorCode &status) {
void RangeDescriptor::setDictionaryFlag() {
int i;
- static const char16_t *dictionary = u"dictionary";
- for (i=0; i<fIncludesSets->size(); i++) {
- RBBINode *usetNode = (RBBINode *)fIncludesSets->elementAt(i);
- RBBINode *setRef = usetNode->fParent;
- if (setRef != nullptr) {
+ static const char16_t *dictionary = u"dictionary";
+ for (i=0; i<fIncludesSets->size(); i++) {
+ RBBINode *usetNode = (RBBINode *)fIncludesSets->elementAt(i);
+ RBBINode *setRef = usetNode->fParent;
+ if (setRef != nullptr) {
RBBINode *varRef = setRef->fParent;
- if (varRef && varRef->fType == RBBINode::varRef) {
- const UnicodeString *setName = &varRef->fText;
- if (setName->compare(dictionary, -1) == 0) {
- fNum |= RBBISetBuilder::DICT_BIT;
- break;
- }
+ if (varRef && varRef->fType == RBBINode::varRef) {
+ const UnicodeString *setName = &varRef->fText;
+ if (setName->compare(dictionary, -1) == 0) {
+ fNum |= RBBISetBuilder::DICT_BIT;
+ break;
+ }
}
}
}
diff --git a/contrib/libs/icu/common/rbbisetb.h b/contrib/libs/icu/common/rbbisetb.h
index 4ab97fc0c5..ed6a76b121 100644
--- a/contrib/libs/icu/common/rbbisetb.h
+++ b/contrib/libs/icu/common/rbbisetb.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// rbbisetb.h
@@ -13,12 +13,12 @@
#define RBBISETB_H
#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_BREAK_ITERATION
-
+
+#if !UCONFIG_NO_BREAK_ITERATION
+
#include "unicode/uobject.h"
#include "rbbirb.h"
-#include "utrie2.h"
+#include "utrie2.h"
#include "uvector.h"
U_NAMESPACE_BEGIN
@@ -82,8 +82,8 @@ public:
RBBISetBuilder(RBBIRuleBuilder *rb);
~RBBISetBuilder();
- void buildRanges();
- void buildTrie();
+ void buildRanges();
+ void buildTrie();
void addValToSets(UVector *sets, uint32_t val);
void addValToSet (RBBINode *usetNode, uint32_t val);
int32_t getNumCharCategories() const; // CharCategories are the same as input symbol set to the
@@ -94,15 +94,15 @@ public:
UChar32 getFirstChar(int32_t val) const;
UBool sawBOF() const; // Indicate whether any references to the {bof} pseudo
// character were encountered.
- /**
- * Merge two character categories that have been identified as having equivalent behavior.
- * The ranges belonging to the second category (table column) will be added to the first.
- * @param categories the pair of categories to be merged.
- */
- void mergeCategories(IntPair categories);
-
- static constexpr int32_t DICT_BIT = 0x4000;
-
+ /**
+ * Merge two character categories that have been identified as having equivalent behavior.
+ * The ranges belonging to the second category (table column) will be added to the first.
+ * @param categories the pair of categories to be merged.
+ */
+ void mergeCategories(IntPair categories);
+
+ static constexpr int32_t DICT_BIT = 0x4000;
+
#ifdef RBBI_DEBUG
void printSets();
void printRanges();
@@ -121,8 +121,8 @@ private:
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.
+ UTrie2 *fTrie; // The mapping TRIE that is the end result of processing
+ uint32_t fTrieSize; // the Unicode Sets.
// Groups correspond to character categories -
// groups of ranges that are in the same original UnicodeSets.
@@ -141,7 +141,7 @@ private:
U_NAMESPACE_END
-
-#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
-
+
+#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
+
#endif
diff --git a/contrib/libs/icu/common/rbbistbl.cpp b/contrib/libs/icu/common/rbbistbl.cpp
index e1fa4ec140..5303f76096 100644
--- a/contrib/libs/icu/common/rbbistbl.cpp
+++ b/contrib/libs/icu/common/rbbistbl.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// file: rbbistbl.cpp Implementation of the ICU RBBISymbolTable class
diff --git a/contrib/libs/icu/common/rbbitblb.cpp b/contrib/libs/icu/common/rbbitblb.cpp
index 7515ea4758..960ef7ec82 100644
--- a/contrib/libs/icu/common/rbbitblb.cpp
+++ b/contrib/libs/icu/common/rbbitblb.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -18,29 +18,29 @@
#include "unicode/unistr.h"
#include "rbbitblb.h"
#include "rbbirb.h"
-#include "rbbiscan.h"
+#include "rbbiscan.h"
#include "rbbisetb.h"
#include "rbbidata.h"
#include "cstring.h"
#include "uassert.h"
-#include "uvectr32.h"
+#include "uvectr32.h"
#include "cmemory.h"
U_NAMESPACE_BEGIN
-RBBITableBuilder::RBBITableBuilder(RBBIRuleBuilder *rb, RBBINode **rootNode, UErrorCode &status) :
- fRB(rb),
- fTree(*rootNode),
- fStatus(&status),
- fDStates(nullptr),
- fSafeTable(nullptr) {
+RBBITableBuilder::RBBITableBuilder(RBBIRuleBuilder *rb, RBBINode **rootNode, UErrorCode &status) :
+ fRB(rb),
+ fTree(*rootNode),
+ fStatus(&status),
+ fDStates(nullptr),
+ fSafeTable(nullptr) {
if (U_FAILURE(status)) {
return;
}
- // fDStates is UVector<RBBIStateDescriptor *>
- fDStates = new UVector(status);
- if (U_SUCCESS(status) && fDStates == nullptr ) {
- status = U_MEMORY_ALLOCATION_ERROR;
+ // fDStates is UVector<RBBIStateDescriptor *>
+ fDStates = new UVector(status);
+ if (U_SUCCESS(status) && fDStates == nullptr ) {
+ status = U_MEMORY_ALLOCATION_ERROR;
}
}
@@ -51,19 +51,19 @@ RBBITableBuilder::~RBBITableBuilder() {
for (i=0; i<fDStates->size(); i++) {
delete (RBBIStateDescriptor *)fDStates->elementAt(i);
}
- delete fDStates;
- delete fSafeTable;
- delete fLookAheadRuleMap;
+ delete fDStates;
+ delete fSafeTable;
+ delete fLookAheadRuleMap;
}
//-----------------------------------------------------------------------------
//
-// RBBITableBuilder::buildForwardTable - This is the main function for building
-// the DFA state transition table from the RBBI rules parse tree.
+// RBBITableBuilder::buildForwardTable - This is the main function for building
+// the DFA state transition table from the RBBI rules parse tree.
//
//-----------------------------------------------------------------------------
-void RBBITableBuilder::buildForwardTable() {
+void RBBITableBuilder::buildForwardTable() {
if (U_FAILURE(*fStatus)) {
return;
@@ -123,7 +123,7 @@ void RBBITableBuilder::buildForwardTable() {
}
cn->fLeftChild = fTree;
fTree->fParent = cn;
- RBBINode *endMarkerNode = cn->fRightChild = new RBBINode(RBBINode::endMark);
+ RBBINode *endMarkerNode = cn->fRightChild = new RBBINode(RBBINode::endMark);
// Delete and exit if memory allocation failed.
if (cn->fRightChild == NULL) {
*fStatus = U_MEMORY_ALLOCATION_ERROR;
@@ -166,7 +166,7 @@ void RBBITableBuilder::buildForwardTable() {
// For "chained" rules, modify the followPos sets
//
if (fRB->fChainRules) {
- calcChainedFollowPos(fTree, endMarkerNode);
+ calcChainedFollowPos(fTree, endMarkerNode);
}
//
@@ -180,7 +180,7 @@ void RBBITableBuilder::buildForwardTable() {
// Build the DFA state transition tables.
//
buildStateTable();
- mapLookAheadRules();
+ mapLookAheadRules();
flagAcceptingStates();
flagLookAheadStates();
flagTaggedStates();
@@ -404,7 +404,7 @@ void RBBITableBuilder::addRuleRootNodes(UVector *dest, RBBINode *node) {
// to implement rule chaining. NOT described by Aho
//
//-----------------------------------------------------------------------------
-void RBBITableBuilder::calcChainedFollowPos(RBBINode *tree, RBBINode *endMarkNode) {
+void RBBITableBuilder::calcChainedFollowPos(RBBINode *tree, RBBINode *endMarkNode) {
UVector leafNodes(*fStatus);
if (U_FAILURE(*fStatus)) {
@@ -425,8 +425,8 @@ void RBBITableBuilder::calcChainedFollowPos(RBBINode *tree, RBBINode *endMarkNod
addRuleRootNodes(&ruleRootNodes, tree);
UVector matchStartNodes(*fStatus);
- for (int j=0; j<ruleRootNodes.size(); ++j) {
- RBBINode *node = static_cast<RBBINode *>(ruleRootNodes.elementAt(j));
+ for (int j=0; j<ruleRootNodes.size(); ++j) {
+ RBBINode *node = static_cast<RBBINode *>(ruleRootNodes.elementAt(j));
if (node->fChainIn) {
setAdd(&matchStartNodes, node->fFirstPosSet);
}
@@ -439,26 +439,26 @@ void RBBITableBuilder::calcChainedFollowPos(RBBINode *tree, RBBINode *endMarkNod
int32_t startNodeIx;
for (endNodeIx=0; endNodeIx<leafNodes.size(); endNodeIx++) {
- RBBINode *endNode = (RBBINode *)leafNodes.elementAt(endNodeIx);
+ RBBINode *endNode = (RBBINode *)leafNodes.elementAt(endNodeIx);
// Identify leaf nodes that correspond to overall rule match positions.
- // These include the endMarkNode in their followPos sets.
- //
- // Note: do not consider other end marker nodes, those that are added to
- // look-ahead rules. These can't chain; a match immediately stops
- // further matching. This leaves exactly one end marker node, the one
- // at the end of the complete tree.
-
- if (!endNode->fFollowPos->contains(endMarkNode)) {
+ // These include the endMarkNode in their followPos sets.
+ //
+ // Note: do not consider other end marker nodes, those that are added to
+ // look-ahead rules. These can't chain; a match immediately stops
+ // further matching. This leaves exactly one end marker node, the one
+ // at the end of the complete tree.
+
+ if (!endNode->fFollowPos->contains(endMarkNode)) {
continue;
}
// We've got a node that can end a match.
- // !!LBCMNoChain implementation: If this node's val correspond to
- // the Line Break $CM char class, don't chain from it.
- // TODO: Remove this. !!LBCMNoChain is deprecated, and is not used
- // by any of the standard ICU rules.
+ // !!LBCMNoChain implementation: If this node's val correspond to
+ // the Line Break $CM char class, don't chain from it.
+ // TODO: Remove this. !!LBCMNoChain is deprecated, and is not used
+ // by any of the standard ICU rules.
if (fRB->fLBCMNoChain) {
UChar32 c = this->fRB->fSetBuilder->getFirstChar(endNode->fVal);
if (c != -1) {
@@ -699,78 +699,78 @@ ExitBuildSTdeleteall:
}
-/**
- * mapLookAheadRules
- *
- */
-void RBBITableBuilder::mapLookAheadRules() {
- fLookAheadRuleMap = new UVector32(fRB->fScanner->numRules() + 1, *fStatus);
- if (fLookAheadRuleMap == nullptr) {
- *fStatus = U_MEMORY_ALLOCATION_ERROR;
- }
- if (U_FAILURE(*fStatus)) {
- 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);
- int32_t laSlotForState = 0;
-
- // Establish the look-ahead slot for this state, if the state covers
- // any look-ahead nodes - corresponding to the '/' in look-ahead rules.
-
- // If any of the look-ahead nodes already have a slot assigned, use it,
- // otherwise assign a new one.
-
- bool sawLookAheadNode = false;
- for (int32_t ipos=0; ipos<sd->fPositions->size(); ++ipos) {
- RBBINode *node = static_cast<RBBINode *>(sd->fPositions->elementAt(ipos));
- if (node->fType != RBBINode::NodeType::lookAhead) {
- continue;
- }
- sawLookAheadNode = true;
- int32_t ruleNum = node->fVal; // Set when rule was originally parsed.
- U_ASSERT(ruleNum < fLookAheadRuleMap->size());
- U_ASSERT(ruleNum > 0);
- int32_t laSlot = fLookAheadRuleMap->elementAti(ruleNum);
- if (laSlot != 0) {
- if (laSlotForState == 0) {
- laSlotForState = laSlot;
- } else {
- // TODO: figure out if this can fail, change to setting an error code if so.
- U_ASSERT(laSlot == laSlotForState);
- }
- }
- }
- if (!sawLookAheadNode) {
- continue;
- }
-
- if (laSlotForState == 0) {
- laSlotForState = ++laSlotsInUse;
- }
-
- // For each look ahead node covered by this state,
- // set the mapping from the node's rule number to the look ahead slot.
- // There can be multiple nodes/rule numbers going to the same la slot.
-
- for (int32_t ipos=0; ipos<sd->fPositions->size(); ++ipos) {
- RBBINode *node = static_cast<RBBINode *>(sd->fPositions->elementAt(ipos));
- if (node->fType != RBBINode::NodeType::lookAhead) {
- continue;
- }
- int32_t ruleNum = node->fVal; // Set when rule was originally parsed.
- int32_t existingVal = fLookAheadRuleMap->elementAti(ruleNum);
- (void)existingVal;
- U_ASSERT(existingVal == 0 || existingVal == laSlotForState);
- fLookAheadRuleMap->setElementAt(laSlotForState, ruleNum);
- }
- }
-
-}
-
+/**
+ * mapLookAheadRules
+ *
+ */
+void RBBITableBuilder::mapLookAheadRules() {
+ fLookAheadRuleMap = new UVector32(fRB->fScanner->numRules() + 1, *fStatus);
+ if (fLookAheadRuleMap == nullptr) {
+ *fStatus = U_MEMORY_ALLOCATION_ERROR;
+ }
+ if (U_FAILURE(*fStatus)) {
+ 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);
+ int32_t laSlotForState = 0;
+
+ // Establish the look-ahead slot for this state, if the state covers
+ // any look-ahead nodes - corresponding to the '/' in look-ahead rules.
+
+ // If any of the look-ahead nodes already have a slot assigned, use it,
+ // otherwise assign a new one.
+
+ bool sawLookAheadNode = false;
+ for (int32_t ipos=0; ipos<sd->fPositions->size(); ++ipos) {
+ RBBINode *node = static_cast<RBBINode *>(sd->fPositions->elementAt(ipos));
+ if (node->fType != RBBINode::NodeType::lookAhead) {
+ continue;
+ }
+ sawLookAheadNode = true;
+ int32_t ruleNum = node->fVal; // Set when rule was originally parsed.
+ U_ASSERT(ruleNum < fLookAheadRuleMap->size());
+ U_ASSERT(ruleNum > 0);
+ int32_t laSlot = fLookAheadRuleMap->elementAti(ruleNum);
+ if (laSlot != 0) {
+ if (laSlotForState == 0) {
+ laSlotForState = laSlot;
+ } else {
+ // TODO: figure out if this can fail, change to setting an error code if so.
+ U_ASSERT(laSlot == laSlotForState);
+ }
+ }
+ }
+ if (!sawLookAheadNode) {
+ continue;
+ }
+
+ if (laSlotForState == 0) {
+ laSlotForState = ++laSlotsInUse;
+ }
+
+ // For each look ahead node covered by this state,
+ // set the mapping from the node's rule number to the look ahead slot.
+ // There can be multiple nodes/rule numbers going to the same la slot.
+
+ for (int32_t ipos=0; ipos<sd->fPositions->size(); ++ipos) {
+ RBBINode *node = static_cast<RBBINode *>(sd->fPositions->elementAt(ipos));
+ if (node->fType != RBBINode::NodeType::lookAhead) {
+ continue;
+ }
+ int32_t ruleNum = node->fVal; // Set when rule was originally parsed.
+ int32_t existingVal = fLookAheadRuleMap->elementAti(ruleNum);
+ (void)existingVal;
+ U_ASSERT(existingVal == 0 || existingVal == laSlotForState);
+ fLookAheadRuleMap->setElementAt(laSlotForState, ruleNum);
+ }
+ }
+
+}
+
//-----------------------------------------------------------------------------
//
// flagAcceptingStates Identify accepting states.
@@ -809,16 +809,16 @@ void RBBITableBuilder::flagAcceptingStates() {
if (sd->fAccepting==0) {
// State hasn't been marked as accepting yet. Do it now.
- sd->fAccepting = fLookAheadRuleMap->elementAti(endMarker->fVal);
+ sd->fAccepting = fLookAheadRuleMap->elementAti(endMarker->fVal);
if (sd->fAccepting == 0) {
sd->fAccepting = -1;
}
}
if (sd->fAccepting==-1 && 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);
+ // 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.
@@ -848,20 +848,20 @@ void RBBITableBuilder::flagLookAheadStates() {
}
for (i=0; i<lookAheadNodes.size(); i++) {
lookAheadNode = (RBBINode *)lookAheadNodes.elementAt(i);
- U_ASSERT(lookAheadNode->fType == RBBINode::NodeType::lookAhead);
+ U_ASSERT(lookAheadNode->fType == RBBINode::NodeType::lookAhead);
for (n=0; n<fDStates->size(); n++) {
RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(n);
- int32_t positionsIdx = sd->fPositions->indexOf(lookAheadNode);
- if (positionsIdx >= 0) {
- U_ASSERT(lookAheadNode == sd->fPositions->elementAt(positionsIdx));
- int32_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",
- // __FILE__, __LINE__, sd->fLookAhead, lookaheadSlot);
- // }
- sd->fLookAhead = lookaheadSlot;
+ int32_t positionsIdx = sd->fPositions->indexOf(lookAheadNode);
+ if (positionsIdx >= 0) {
+ U_ASSERT(lookAheadNode == sd->fPositions->elementAt(positionsIdx));
+ int32_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",
+ // __FILE__, __LINE__, sd->fLookAhead, lookaheadSlot);
+ // }
+ sd->fLookAhead = lookaheadSlot;
}
}
}
@@ -1140,180 +1140,180 @@ void RBBITableBuilder::printPosSets(RBBINode *n) {
}
#endif
-//
-// findDuplCharClassFrom()
-//
-bool RBBITableBuilder::findDuplCharClassFrom(IntPair *categories) {
- int32_t numStates = fDStates->size();
- int32_t numCols = fRB->fSetBuilder->getNumCharCategories();
-
- for (; categories->first < numCols-1; categories->first++) {
- for (categories->second=categories->first+1; categories->second < numCols; 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;
- for (int32_t state=0; state<numStates; state++) {
- RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(state);
- table_base = (uint16_t)sd->fDtran->elementAti(categories->first);
- table_dupl = (uint16_t)sd->fDtran->elementAti(categories->second);
- if (table_base != table_dupl) {
- break;
- }
- }
- if (table_base == table_dupl) {
- return true;
- }
- }
- }
- return false;
-}
-
-
-//
-// removeColumn()
-//
-void RBBITableBuilder::removeColumn(int32_t column) {
- int32_t numStates = fDStates->size();
- for (int32_t state=0; state<numStates; state++) {
- RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(state);
- U_ASSERT(column < sd->fDtran->size());
- sd->fDtran->removeElementAt(column);
- }
-}
-
-/*
- * findDuplicateState
- */
-bool RBBITableBuilder::findDuplicateState(IntPair *states) {
- int32_t numStates = fDStates->size();
- int32_t numCols = fRB->fSetBuilder->getNumCharCategories();
-
- for (; states->first<numStates-1; states->first++) {
- RBBIStateDescriptor *firstSD = (RBBIStateDescriptor *)fDStates->elementAt(states->first);
- for (states->second=states->first+1; states->second<numStates; states->second++) {
- RBBIStateDescriptor *duplSD = (RBBIStateDescriptor *)fDStates->elementAt(states->second);
- if (firstSD->fAccepting != duplSD->fAccepting ||
- firstSD->fLookAhead != duplSD->fLookAhead ||
- firstSD->fTagsIdx != duplSD->fTagsIdx) {
- continue;
- }
- bool rowsMatch = true;
- for (int32_t col=0; col < numCols; ++col) {
- int32_t firstVal = firstSD->fDtran->elementAti(col);
- int32_t duplVal = duplSD->fDtran->elementAti(col);
- if (!((firstVal == duplVal) ||
- ((firstVal == states->first || firstVal == states->second) &&
- (duplVal == states->first || duplVal == states->second)))) {
- rowsMatch = false;
- break;
- }
- }
- if (rowsMatch) {
- return true;
- }
- }
- }
- return false;
-}
-
-
-bool RBBITableBuilder::findDuplicateSafeState(IntPair *states) {
- int32_t numStates = fSafeTable->size();
-
- for (; states->first<numStates-1; states->first++) {
- UnicodeString *firstRow = static_cast<UnicodeString *>(fSafeTable->elementAt(states->first));
- for (states->second=states->first+1; states->second<numStates; states->second++) {
- UnicodeString *duplRow = static_cast<UnicodeString *>(fSafeTable->elementAt(states->second));
- bool rowsMatch = true;
- int32_t numCols = firstRow->length();
- for (int32_t col=0; col < numCols; ++col) {
- int32_t firstVal = firstRow->charAt(col);
- int32_t duplVal = duplRow->charAt(col);
- if (!((firstVal == duplVal) ||
- ((firstVal == states->first || firstVal == states->second) &&
- (duplVal == states->first || duplVal == states->second)))) {
- rowsMatch = false;
- break;
- }
- }
- if (rowsMatch) {
- return true;
- }
- }
- }
- return false;
-}
-
-
-void RBBITableBuilder::removeState(IntPair duplStates) {
- const int32_t keepState = duplStates.first;
- const int32_t duplState = duplStates.second;
- U_ASSERT(keepState < duplState);
- U_ASSERT(duplState < fDStates->size());
-
- RBBIStateDescriptor *duplSD = (RBBIStateDescriptor *)fDStates->elementAt(duplState);
- fDStates->removeElementAt(duplState);
- delete duplSD;
-
- int32_t numStates = fDStates->size();
- int32_t numCols = fRB->fSetBuilder->getNumCharCategories();
- for (int32_t state=0; state<numStates; ++state) {
- RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(state);
- for (int32_t col=0; col<numCols; col++) {
- int32_t existingVal = sd->fDtran->elementAti(col);
- int32_t newVal = existingVal;
- if (existingVal == duplState) {
- newVal = keepState;
- } else if (existingVal > duplState) {
- newVal = existingVal - 1;
- }
- sd->fDtran->setElementAt(newVal, col);
- }
- }
-}
-
-void RBBITableBuilder::removeSafeState(IntPair duplStates) {
- const int32_t keepState = duplStates.first;
- const int32_t duplState = duplStates.second;
- U_ASSERT(keepState < duplState);
- U_ASSERT(duplState < fSafeTable->size());
-
- fSafeTable->removeElementAt(duplState); // Note that fSafeTable has a deleter function
- // and will auto-delete the removed element.
- int32_t numStates = fSafeTable->size();
- for (int32_t state=0; state<numStates; ++state) {
- UnicodeString *sd = (UnicodeString *)fSafeTable->elementAt(state);
- int32_t numCols = sd->length();
- for (int32_t col=0; col<numCols; col++) {
- int32_t existingVal = sd->charAt(col);
- int32_t newVal = existingVal;
- if (existingVal == duplState) {
- newVal = keepState;
- } else if (existingVal > duplState) {
- newVal = existingVal - 1;
- }
- sd->setCharAt(col, static_cast<char16_t>(newVal));
- }
- }
-}
-
-
-/*
- * RemoveDuplicateStates
- */
-int32_t RBBITableBuilder::removeDuplicateStates() {
- IntPair dupls = {3, 0};
- int32_t numStatesRemoved = 0;
-
- while (findDuplicateState(&dupls)) {
- // printf("Removing duplicate states (%d, %d)\n", dupls.first, dupls.second);
- removeState(dupls);
- ++numStatesRemoved;
- }
- return numStatesRemoved;
-}
-
-
+//
+// findDuplCharClassFrom()
+//
+bool RBBITableBuilder::findDuplCharClassFrom(IntPair *categories) {
+ int32_t numStates = fDStates->size();
+ int32_t numCols = fRB->fSetBuilder->getNumCharCategories();
+
+ for (; categories->first < numCols-1; categories->first++) {
+ for (categories->second=categories->first+1; categories->second < numCols; 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;
+ for (int32_t state=0; state<numStates; state++) {
+ RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(state);
+ table_base = (uint16_t)sd->fDtran->elementAti(categories->first);
+ table_dupl = (uint16_t)sd->fDtran->elementAti(categories->second);
+ if (table_base != table_dupl) {
+ break;
+ }
+ }
+ if (table_base == table_dupl) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+
+//
+// removeColumn()
+//
+void RBBITableBuilder::removeColumn(int32_t column) {
+ int32_t numStates = fDStates->size();
+ for (int32_t state=0; state<numStates; state++) {
+ RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(state);
+ U_ASSERT(column < sd->fDtran->size());
+ sd->fDtran->removeElementAt(column);
+ }
+}
+
+/*
+ * findDuplicateState
+ */
+bool RBBITableBuilder::findDuplicateState(IntPair *states) {
+ int32_t numStates = fDStates->size();
+ int32_t numCols = fRB->fSetBuilder->getNumCharCategories();
+
+ for (; states->first<numStates-1; states->first++) {
+ RBBIStateDescriptor *firstSD = (RBBIStateDescriptor *)fDStates->elementAt(states->first);
+ for (states->second=states->first+1; states->second<numStates; states->second++) {
+ RBBIStateDescriptor *duplSD = (RBBIStateDescriptor *)fDStates->elementAt(states->second);
+ if (firstSD->fAccepting != duplSD->fAccepting ||
+ firstSD->fLookAhead != duplSD->fLookAhead ||
+ firstSD->fTagsIdx != duplSD->fTagsIdx) {
+ continue;
+ }
+ bool rowsMatch = true;
+ for (int32_t col=0; col < numCols; ++col) {
+ int32_t firstVal = firstSD->fDtran->elementAti(col);
+ int32_t duplVal = duplSD->fDtran->elementAti(col);
+ if (!((firstVal == duplVal) ||
+ ((firstVal == states->first || firstVal == states->second) &&
+ (duplVal == states->first || duplVal == states->second)))) {
+ rowsMatch = false;
+ break;
+ }
+ }
+ if (rowsMatch) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+
+bool RBBITableBuilder::findDuplicateSafeState(IntPair *states) {
+ int32_t numStates = fSafeTable->size();
+
+ for (; states->first<numStates-1; states->first++) {
+ UnicodeString *firstRow = static_cast<UnicodeString *>(fSafeTable->elementAt(states->first));
+ for (states->second=states->first+1; states->second<numStates; states->second++) {
+ UnicodeString *duplRow = static_cast<UnicodeString *>(fSafeTable->elementAt(states->second));
+ bool rowsMatch = true;
+ int32_t numCols = firstRow->length();
+ for (int32_t col=0; col < numCols; ++col) {
+ int32_t firstVal = firstRow->charAt(col);
+ int32_t duplVal = duplRow->charAt(col);
+ if (!((firstVal == duplVal) ||
+ ((firstVal == states->first || firstVal == states->second) &&
+ (duplVal == states->first || duplVal == states->second)))) {
+ rowsMatch = false;
+ break;
+ }
+ }
+ if (rowsMatch) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+
+void RBBITableBuilder::removeState(IntPair duplStates) {
+ const int32_t keepState = duplStates.first;
+ const int32_t duplState = duplStates.second;
+ U_ASSERT(keepState < duplState);
+ U_ASSERT(duplState < fDStates->size());
+
+ RBBIStateDescriptor *duplSD = (RBBIStateDescriptor *)fDStates->elementAt(duplState);
+ fDStates->removeElementAt(duplState);
+ delete duplSD;
+
+ int32_t numStates = fDStates->size();
+ int32_t numCols = fRB->fSetBuilder->getNumCharCategories();
+ for (int32_t state=0; state<numStates; ++state) {
+ RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(state);
+ for (int32_t col=0; col<numCols; col++) {
+ int32_t existingVal = sd->fDtran->elementAti(col);
+ int32_t newVal = existingVal;
+ if (existingVal == duplState) {
+ newVal = keepState;
+ } else if (existingVal > duplState) {
+ newVal = existingVal - 1;
+ }
+ sd->fDtran->setElementAt(newVal, col);
+ }
+ }
+}
+
+void RBBITableBuilder::removeSafeState(IntPair duplStates) {
+ const int32_t keepState = duplStates.first;
+ const int32_t duplState = duplStates.second;
+ U_ASSERT(keepState < duplState);
+ U_ASSERT(duplState < fSafeTable->size());
+
+ fSafeTable->removeElementAt(duplState); // Note that fSafeTable has a deleter function
+ // and will auto-delete the removed element.
+ int32_t numStates = fSafeTable->size();
+ for (int32_t state=0; state<numStates; ++state) {
+ UnicodeString *sd = (UnicodeString *)fSafeTable->elementAt(state);
+ int32_t numCols = sd->length();
+ for (int32_t col=0; col<numCols; col++) {
+ int32_t existingVal = sd->charAt(col);
+ int32_t newVal = existingVal;
+ if (existingVal == duplState) {
+ newVal = keepState;
+ } else if (existingVal > duplState) {
+ newVal = existingVal - 1;
+ }
+ sd->setCharAt(col, static_cast<char16_t>(newVal));
+ }
+ }
+}
+
+
+/*
+ * RemoveDuplicateStates
+ */
+int32_t RBBITableBuilder::removeDuplicateStates() {
+ IntPair dupls = {3, 0};
+ int32_t numStatesRemoved = 0;
+
+ while (findDuplicateState(&dupls)) {
+ // printf("Removing duplicate states (%d, %d)\n", dupls.first, dupls.second);
+ removeState(dupls);
+ ++numStatesRemoved;
+ }
+ return numStatesRemoved;
+}
+
+
//-----------------------------------------------------------------------------
//
// getTableSize() Calculate the size of the runtime form of this
@@ -1330,12 +1330,12 @@ int32_t RBBITableBuilder::getTableSize() const {
return 0;
}
- size = offsetof(RBBIStateTable, fTableData); // The header, with no rows to the table.
+ size = offsetof(RBBIStateTable, fTableData); // The header, with no rows to the table.
numRows = fDStates->size();
numCols = fRB->fSetBuilder->getNumCharCategories();
- rowSize = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t)*numCols;
+ rowSize = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t)*numCols;
size += numRows * rowSize;
return size;
}
@@ -1357,14 +1357,14 @@ void RBBITableBuilder::exportTable(void *where) {
return;
}
- int32_t catCount = fRB->fSetBuilder->getNumCharCategories();
- if (catCount > 0x7fff ||
+ int32_t catCount = fRB->fSetBuilder->getNumCharCategories();
+ if (catCount > 0x7fff ||
fDStates->size() > 0x7fff) {
*fStatus = U_BRK_INTERNAL_ERROR;
return;
}
- table->fRowLen = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t) * catCount;
+ table->fRowLen = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t) * catCount;
table->fNumStates = fDStates->size();
table->fFlags = 0;
if (fRB->fLookAheadHardBreak) {
@@ -1383,195 +1383,195 @@ void RBBITableBuilder::exportTable(void *where) {
row->fAccepting = (int16_t)sd->fAccepting;
row->fLookAhead = (int16_t)sd->fLookAhead;
row->fTagIdx = (int16_t)sd->fTagsIdx;
- for (col=0; col<catCount; col++) {
+ for (col=0; col<catCount; col++) {
row->fNextState[col] = (uint16_t)sd->fDtran->elementAti(col);
}
}
}
-/**
- * Synthesize a safe state table from the main state table.
- */
-void RBBITableBuilder::buildSafeReverseTable(UErrorCode &status) {
- // The safe table creation has three steps:
+/**
+ * Synthesize a safe state table from the main state table.
+ */
+void RBBITableBuilder::buildSafeReverseTable(UErrorCode &status) {
+ // The safe table creation has three steps:
+
+ // 1. Identifiy pairs of character classes that are "safe." Safe means that boundaries
+ // following the pair do not depend on context or state before the pair. To test
+ // whether a pair is safe, run it through the main forward state table, starting
+ // from each state. If the the final state is the same, no matter what the starting state,
+ // the pair is safe.
+ //
+ // 2. Build a state table that recognizes the safe pairs. It's similar to their
+ // forward table, with a column for each input character [class], and a row for
+ // each state. Row 1 is the start state, and row 0 is the stop state. Initially
+ // create an additional state for each input character category; being in
+ // one of these states means that the character has been seen, and is potentially
+ // the first of a pair. In each of these rows, the entry for the second character
+ // of a safe pair is set to the stop state (0), indicating that a match was found.
+ // All other table entries are set to the state corresponding the current input
+ // character, allowing that charcter to be the of a start following pair.
+ //
+ // Because the safe rules are to be run in reverse, moving backwards in the text,
+ // the first and second pair categories are swapped when building the table.
+ //
+ // 3. Compress the table. There are typically many rows (states) that are
+ // equivalent - that have zeroes (match completed) in the same columns -
+ // and can be folded together.
+
+ // Each safe pair is stored as two UChars in the safePair string.
+ UnicodeString safePairs;
+
+ int32_t numCharClasses = fRB->fSetBuilder->getNumCharCategories();
+ int32_t numStates = fDStates->size();
+
+ for (int32_t c1=0; c1<numCharClasses; ++c1) {
+ for (int32_t c2=0; c2 < numCharClasses; ++c2) {
+ int32_t wantedEndState = -1;
+ int32_t endState = 0;
+ for (int32_t startState = 1; startState < numStates; ++startState) {
+ RBBIStateDescriptor *startStateD = static_cast<RBBIStateDescriptor *>(fDStates->elementAt(startState));
+ int32_t s2 = startStateD->fDtran->elementAti(c1);
+ RBBIStateDescriptor *s2StateD = static_cast<RBBIStateDescriptor *>(fDStates->elementAt(s2));
+ endState = s2StateD->fDtran->elementAti(c2);
+ if (wantedEndState < 0) {
+ wantedEndState = endState;
+ } else {
+ if (wantedEndState != endState) {
+ break;
+ }
+ }
+ }
+ if (wantedEndState == endState) {
+ safePairs.append((char16_t)c1);
+ safePairs.append((char16_t)c2);
+ // printf("(%d, %d) ", c1, c2);
+ }
+ }
+ // printf("\n");
+ }
+
+ // Populate the initial safe table.
+ // The table as a whole is UVector<UnicodeString>
+ // Each row is represented by a UnicodeString, being used as a Vector<int16>.
+ // Row 0 is the stop state.
+ // Row 1 is the start sate.
+ // Row 2 and beyond are other states, initially one per char class, but
+ // after initial construction, many of the states will be combined, compacting the table.
+ // The String holds the nextState data only. The four leading fields of a row, fAccepting,
+ // fLookAhead, etc. are not needed for the safe table, and are omitted at this stage of building.
+
+ U_ASSERT(fSafeTable == nullptr);
+ fSafeTable = new UVector(uprv_deleteUObject, uhash_compareUnicodeString, numCharClasses + 2, status);
+ for (int32_t row=0; row<numCharClasses + 2; ++row) {
+ fSafeTable->addElement(new UnicodeString(numCharClasses, 0, numCharClasses+4), status);
+ }
+
+ // From the start state, each input char class transitions to the state for that input.
+ UnicodeString &startState = *static_cast<UnicodeString *>(fSafeTable->elementAt(1));
+ for (int32_t charClass=0; charClass < numCharClasses; ++charClass) {
+ // Note: +2 for the start & stop state.
+ startState.setCharAt(charClass, static_cast<char16_t>(charClass+2));
+ }
+
+ // Initially make every other state table row look like the start state row,
+ for (int32_t row=2; row<numCharClasses+2; ++row) {
+ UnicodeString &rowState = *static_cast<UnicodeString *>(fSafeTable->elementAt(row));
+ rowState = startState; // UnicodeString assignment, copies contents.
+ }
+
+ // Run through the safe pairs, set the next state to zero when pair has been seen.
+ // Zero being the stop state, meaning we found a safe point.
+ for (int32_t pairIdx=0; pairIdx<safePairs.length(); pairIdx+=2) {
+ int32_t c1 = safePairs.charAt(pairIdx);
+ int32_t c2 = safePairs.charAt(pairIdx + 1);
+
+ UnicodeString &rowState = *static_cast<UnicodeString *>(fSafeTable->elementAt(c2 + 2));
+ rowState.setCharAt(c1, 0);
+ }
+
+ // Remove duplicate or redundant rows from the table.
+ IntPair states = {1, 0};
+ while (findDuplicateSafeState(&states)) {
+ // printf("Removing duplicate safe states (%d, %d)\n", states.first, states.second);
+ removeSafeState(states);
+ }
+}
+
+
+//-----------------------------------------------------------------------------
+//
+// getSafeTableSize() Calculate the size of the runtime form of this
+// safe state table.
+//
+//-----------------------------------------------------------------------------
+int32_t RBBITableBuilder::getSafeTableSize() const {
+ int32_t size = 0;
+ int32_t numRows;
+ int32_t numCols;
+ int32_t rowSize;
+
+ if (fSafeTable == nullptr) {
+ return 0;
+ }
+
+ size = offsetof(RBBIStateTable, fTableData); // The header, with no rows to the table.
+
+ numRows = fSafeTable->size();
+ numCols = fRB->fSetBuilder->getNumCharCategories();
+
+ rowSize = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t)*numCols;
+ size += numRows * rowSize;
+ return size;
+}
+
+
+//-----------------------------------------------------------------------------
+//
+// exportSafeTable() export the state transition table in the format required
+// by the runtime engine. getTableSize() bytes of memory
+// must be available at the output address "where".
+//
+//-----------------------------------------------------------------------------
+void RBBITableBuilder::exportSafeTable(void *where) {
+ RBBIStateTable *table = (RBBIStateTable *)where;
+ uint32_t state;
+ int col;
+
+ if (U_FAILURE(*fStatus) || fSafeTable == nullptr) {
+ return;
+ }
+
+ int32_t catCount = fRB->fSetBuilder->getNumCharCategories();
+ if (catCount > 0x7fff ||
+ fSafeTable->size() > 0x7fff) {
+ *fStatus = U_BRK_INTERNAL_ERROR;
+ return;
+ }
+
+ table->fRowLen = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t) * catCount;
+ table->fNumStates = fSafeTable->size();
+ table->fFlags = 0;
+ table->fReserved = 0;
+
+ 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);
+ }
+ }
+}
+
+
+
- // 1. Identifiy pairs of character classes that are "safe." Safe means that boundaries
- // following the pair do not depend on context or state before the pair. To test
- // whether a pair is safe, run it through the main forward state table, starting
- // from each state. If the the final state is the same, no matter what the starting state,
- // the pair is safe.
- //
- // 2. Build a state table that recognizes the safe pairs. It's similar to their
- // forward table, with a column for each input character [class], and a row for
- // each state. Row 1 is the start state, and row 0 is the stop state. Initially
- // create an additional state for each input character category; being in
- // one of these states means that the character has been seen, and is potentially
- // the first of a pair. In each of these rows, the entry for the second character
- // of a safe pair is set to the stop state (0), indicating that a match was found.
- // All other table entries are set to the state corresponding the current input
- // character, allowing that charcter to be the of a start following pair.
- //
- // Because the safe rules are to be run in reverse, moving backwards in the text,
- // the first and second pair categories are swapped when building the table.
- //
- // 3. Compress the table. There are typically many rows (states) that are
- // equivalent - that have zeroes (match completed) in the same columns -
- // and can be folded together.
-
- // Each safe pair is stored as two UChars in the safePair string.
- UnicodeString safePairs;
-
- int32_t numCharClasses = fRB->fSetBuilder->getNumCharCategories();
- int32_t numStates = fDStates->size();
-
- for (int32_t c1=0; c1<numCharClasses; ++c1) {
- for (int32_t c2=0; c2 < numCharClasses; ++c2) {
- int32_t wantedEndState = -1;
- int32_t endState = 0;
- for (int32_t startState = 1; startState < numStates; ++startState) {
- RBBIStateDescriptor *startStateD = static_cast<RBBIStateDescriptor *>(fDStates->elementAt(startState));
- int32_t s2 = startStateD->fDtran->elementAti(c1);
- RBBIStateDescriptor *s2StateD = static_cast<RBBIStateDescriptor *>(fDStates->elementAt(s2));
- endState = s2StateD->fDtran->elementAti(c2);
- if (wantedEndState < 0) {
- wantedEndState = endState;
- } else {
- if (wantedEndState != endState) {
- break;
- }
- }
- }
- if (wantedEndState == endState) {
- safePairs.append((char16_t)c1);
- safePairs.append((char16_t)c2);
- // printf("(%d, %d) ", c1, c2);
- }
- }
- // printf("\n");
- }
-
- // Populate the initial safe table.
- // The table as a whole is UVector<UnicodeString>
- // Each row is represented by a UnicodeString, being used as a Vector<int16>.
- // Row 0 is the stop state.
- // Row 1 is the start sate.
- // Row 2 and beyond are other states, initially one per char class, but
- // after initial construction, many of the states will be combined, compacting the table.
- // The String holds the nextState data only. The four leading fields of a row, fAccepting,
- // fLookAhead, etc. are not needed for the safe table, and are omitted at this stage of building.
-
- U_ASSERT(fSafeTable == nullptr);
- fSafeTable = new UVector(uprv_deleteUObject, uhash_compareUnicodeString, numCharClasses + 2, status);
- for (int32_t row=0; row<numCharClasses + 2; ++row) {
- fSafeTable->addElement(new UnicodeString(numCharClasses, 0, numCharClasses+4), status);
- }
-
- // From the start state, each input char class transitions to the state for that input.
- UnicodeString &startState = *static_cast<UnicodeString *>(fSafeTable->elementAt(1));
- for (int32_t charClass=0; charClass < numCharClasses; ++charClass) {
- // Note: +2 for the start & stop state.
- startState.setCharAt(charClass, static_cast<char16_t>(charClass+2));
- }
-
- // Initially make every other state table row look like the start state row,
- for (int32_t row=2; row<numCharClasses+2; ++row) {
- UnicodeString &rowState = *static_cast<UnicodeString *>(fSafeTable->elementAt(row));
- rowState = startState; // UnicodeString assignment, copies contents.
- }
-
- // Run through the safe pairs, set the next state to zero when pair has been seen.
- // Zero being the stop state, meaning we found a safe point.
- for (int32_t pairIdx=0; pairIdx<safePairs.length(); pairIdx+=2) {
- int32_t c1 = safePairs.charAt(pairIdx);
- int32_t c2 = safePairs.charAt(pairIdx + 1);
-
- UnicodeString &rowState = *static_cast<UnicodeString *>(fSafeTable->elementAt(c2 + 2));
- rowState.setCharAt(c1, 0);
- }
-
- // Remove duplicate or redundant rows from the table.
- IntPair states = {1, 0};
- while (findDuplicateSafeState(&states)) {
- // printf("Removing duplicate safe states (%d, %d)\n", states.first, states.second);
- removeSafeState(states);
- }
-}
-
-
//-----------------------------------------------------------------------------
//
-// getSafeTableSize() Calculate the size of the runtime form of this
-// safe state table.
-//
-//-----------------------------------------------------------------------------
-int32_t RBBITableBuilder::getSafeTableSize() const {
- int32_t size = 0;
- int32_t numRows;
- int32_t numCols;
- int32_t rowSize;
-
- if (fSafeTable == nullptr) {
- return 0;
- }
-
- size = offsetof(RBBIStateTable, fTableData); // The header, with no rows to the table.
-
- numRows = fSafeTable->size();
- numCols = fRB->fSetBuilder->getNumCharCategories();
-
- rowSize = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t)*numCols;
- size += numRows * rowSize;
- return size;
-}
-
-
-//-----------------------------------------------------------------------------
-//
-// exportSafeTable() export the state transition table in the format required
-// by the runtime engine. getTableSize() bytes of memory
-// must be available at the output address "where".
-//
-//-----------------------------------------------------------------------------
-void RBBITableBuilder::exportSafeTable(void *where) {
- RBBIStateTable *table = (RBBIStateTable *)where;
- uint32_t state;
- int col;
-
- if (U_FAILURE(*fStatus) || fSafeTable == nullptr) {
- return;
- }
-
- int32_t catCount = fRB->fSetBuilder->getNumCharCategories();
- if (catCount > 0x7fff ||
- fSafeTable->size() > 0x7fff) {
- *fStatus = U_BRK_INTERNAL_ERROR;
- return;
- }
-
- table->fRowLen = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t) * catCount;
- table->fNumStates = fSafeTable->size();
- table->fFlags = 0;
- table->fReserved = 0;
-
- 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);
- }
- }
-}
-
-
-
-
-//-----------------------------------------------------------------------------
-//
// printSet Debug function. Print the contents of a UVector
//
//-----------------------------------------------------------------------------
@@ -1623,48 +1623,48 @@ void RBBITableBuilder::printStates() {
#endif
-//-----------------------------------------------------------------------------
-//
-// printSafeTable Debug Function. Dump the fully constructed safe table.
-//
-//-----------------------------------------------------------------------------
-#ifdef RBBI_DEBUG
-void RBBITableBuilder::printReverseTable() {
- int c; // input "character"
- int n; // state number
-
- RBBIDebugPrintf(" Safe Reverse Table \n");
- if (fSafeTable == nullptr) {
- RBBIDebugPrintf(" --- nullptr ---\n");
- return;
- }
- 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("\n");
- RBBIDebugPrintf(" |---------------");
- for (c=0; c<fRB->fSetBuilder->getNumCharCategories(); c++) {
- RBBIDebugPrintf("---");
- }
- RBBIDebugPrintf("\n");
-
- for (n=0; n<fSafeTable->size(); n++) {
- UnicodeString *rowString = (UnicodeString *)fSafeTable->elementAt(n);
- RBBIDebugPrintf(" %3d | " , n);
- RBBIDebugPrintf("%3d %3d %5d ", 0, 0, 0); // Accepting, LookAhead, Tags
- for (c=0; c<fRB->fSetBuilder->getNumCharCategories(); c++) {
- RBBIDebugPrintf(" %2d", rowString->charAt(c));
- }
- RBBIDebugPrintf("\n");
- }
- RBBIDebugPrintf("\n\n");
-}
-#endif
-
-
-
+//-----------------------------------------------------------------------------
+//
+// printSafeTable Debug Function. Dump the fully constructed safe table.
+//
+//-----------------------------------------------------------------------------
+#ifdef RBBI_DEBUG
+void RBBITableBuilder::printReverseTable() {
+ int c; // input "character"
+ int n; // state number
+
+ RBBIDebugPrintf(" Safe Reverse Table \n");
+ if (fSafeTable == nullptr) {
+ RBBIDebugPrintf(" --- nullptr ---\n");
+ return;
+ }
+ 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("\n");
+ RBBIDebugPrintf(" |---------------");
+ for (c=0; c<fRB->fSetBuilder->getNumCharCategories(); c++) {
+ RBBIDebugPrintf("---");
+ }
+ RBBIDebugPrintf("\n");
+
+ for (n=0; n<fSafeTable->size(); n++) {
+ UnicodeString *rowString = (UnicodeString *)fSafeTable->elementAt(n);
+ RBBIDebugPrintf(" %3d | " , n);
+ RBBIDebugPrintf("%3d %3d %5d ", 0, 0, 0); // Accepting, LookAhead, Tags
+ for (c=0; c<fRB->fSetBuilder->getNumCharCategories(); c++) {
+ RBBIDebugPrintf(" %2d", rowString->charAt(c));
+ }
+ RBBIDebugPrintf("\n");
+ }
+ RBBIDebugPrintf("\n\n");
+}
+#endif
+
+
+
//-----------------------------------------------------------------------------
//
// printRuleStatusTable Debug Function. Dump the common rule status table
@@ -1710,7 +1710,7 @@ RBBIStateDescriptor::RBBIStateDescriptor(int lastInputSymbol, UErrorCode *fStatu
fPositions = NULL;
fDtran = NULL;
- fDtran = new UVector32(lastInputSymbol+1, *fStatus);
+ fDtran = new UVector32(lastInputSymbol+1, *fStatus);
if (U_FAILURE(*fStatus)) {
return;
}
@@ -1718,7 +1718,7 @@ RBBIStateDescriptor::RBBIStateDescriptor(int lastInputSymbol, UErrorCode *fStatu
*fStatus = U_MEMORY_ALLOCATION_ERROR;
return;
}
- fDtran->setSize(lastInputSymbol+1); // fDtran needs to be pre-sized.
+ fDtran->setSize(lastInputSymbol+1); // fDtran needs to be pre-sized.
// It is indexed by input symbols, and will
// hold the next state number for each
// symbol.
diff --git a/contrib/libs/icu/common/rbbitblb.h b/contrib/libs/icu/common/rbbitblb.h
index eff8918f51..c2b574fe1b 100644
--- a/contrib/libs/icu/common/rbbitblb.h
+++ b/contrib/libs/icu/common/rbbitblb.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// rbbitblb.h
@@ -15,12 +15,12 @@
#define RBBITBLB_H
#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_BREAK_ITERATION
-
+
+#if !UCONFIG_NO_BREAK_ITERATION
+
#include "unicode/uobject.h"
#include "unicode/rbbi.h"
-#include "rbbirb.h"
+#include "rbbirb.h"
#include "rbbinode.h"
@@ -28,7 +28,7 @@ U_NAMESPACE_BEGIN
class RBBIRuleScanner;
class RBBIRuleBuilder;
-class UVector32;
+class UVector32;
//
// class RBBITableBuilder is part of the RBBI rule compiler.
@@ -41,104 +41,104 @@ class UVector32;
class RBBITableBuilder : public UMemory {
public:
- RBBITableBuilder(RBBIRuleBuilder *rb, RBBINode **rootNode, UErrorCode &status);
+ RBBITableBuilder(RBBIRuleBuilder *rb, RBBINode **rootNode, UErrorCode &status);
~RBBITableBuilder();
- void buildForwardTable();
-
- /** Return the runtime size in bytes of the built state table. */
- int32_t getTableSize() const;
-
- /** Fill in the runtime state table. Sufficient memory must exist at the specified location.
- */
- void exportTable(void *where);
-
- /**
- * Find duplicate (redundant) character classes. Begin looking with categories.first.
- * Duplicate, if found are returned in the categories parameter.
- * This is an iterator-like function, used to identify character classes
- * (state table columns) that can be eliminated.
- * @param categories in/out parameter, specifies where to start looking for duplicates,
- * and returns the first pair of duplicates found, if any.
- * @return true if duplicate char classes were found, false otherwise.
- */
- bool findDuplCharClassFrom(IntPair *categories);
-
- /** Remove a column from the state table. Used when two character categories
- * have been found equivalent, and merged together, to eliminate the uneeded table column.
- */
- void removeColumn(int32_t column);
-
- /**
- * Check for, and remove dupicate states (table rows).
- * @return the number of states removed.
- */
- int32_t removeDuplicateStates();
-
- /** Build the safe reverse table from the already-constructed forward table. */
- void buildSafeReverseTable(UErrorCode &status);
-
- /** Return the runtime size in bytes of the built safe reverse state table. */
- int32_t getSafeTableSize() const;
-
- /** Fill in the runtime safe state table. Sufficient memory must exist at the specified location.
- */
- void exportSafeTable(void *where);
-
-
+ void buildForwardTable();
+
+ /** Return the runtime size in bytes of the built state table. */
+ int32_t getTableSize() const;
+
+ /** Fill in the runtime state table. Sufficient memory must exist at the specified location.
+ */
+ void exportTable(void *where);
+
+ /**
+ * Find duplicate (redundant) character classes. Begin looking with categories.first.
+ * Duplicate, if found are returned in the categories parameter.
+ * This is an iterator-like function, used to identify character classes
+ * (state table columns) that can be eliminated.
+ * @param categories in/out parameter, specifies where to start looking for duplicates,
+ * and returns the first pair of duplicates found, if any.
+ * @return true if duplicate char classes were found, false otherwise.
+ */
+ bool findDuplCharClassFrom(IntPair *categories);
+
+ /** Remove a column from the state table. Used when two character categories
+ * have been found equivalent, and merged together, to eliminate the uneeded table column.
+ */
+ void removeColumn(int32_t column);
+
+ /**
+ * Check for, and remove dupicate states (table rows).
+ * @return the number of states removed.
+ */
+ int32_t removeDuplicateStates();
+
+ /** Build the safe reverse table from the already-constructed forward table. */
+ void buildSafeReverseTable(UErrorCode &status);
+
+ /** Return the runtime size in bytes of the built safe reverse state table. */
+ int32_t getSafeTableSize() const;
+
+ /** Fill in the runtime safe state table. Sufficient memory must exist at the specified location.
+ */
+ void exportSafeTable(void *where);
+
+
private:
void calcNullable(RBBINode *n);
void calcFirstPos(RBBINode *n);
void calcLastPos(RBBINode *n);
void calcFollowPos(RBBINode *n);
- void calcChainedFollowPos(RBBINode *n, RBBINode *endMarkNode);
+ void calcChainedFollowPos(RBBINode *n, RBBINode *endMarkNode);
void bofFixup();
void buildStateTable();
- void mapLookAheadRules();
+ void mapLookAheadRules();
void flagAcceptingStates();
void flagLookAheadStates();
void flagTaggedStates();
void mergeRuleStatusVals();
- /**
- * Merge redundant state table columns, eliminating character classes with identical behavior.
- * Done after the state tables are generated, just before converting to their run-time format.
- */
- int32_t mergeColumns();
-
+ /**
+ * Merge redundant state table columns, eliminating character classes with identical behavior.
+ * Done after the state tables are generated, just before converting to their run-time format.
+ */
+ int32_t mergeColumns();
+
void addRuleRootNodes(UVector *dest, RBBINode *node);
- /**
- * Find duplicate (redundant) states, beginning at the specified pair,
- * within this state table. This is an iterator-like function, used to
- * identify states (state table rows) that can be eliminated.
- * @param states in/out parameter, specifies where to start looking for duplicates,
- * and returns the first pair of duplicates found, if any.
- * @return true if duplicate states were found, false otherwise.
- */
- bool findDuplicateState(IntPair *states);
-
- /** Remove a duplicate state.
- * @param duplStates The duplicate states. The first is kept, the second is removed.
- * All references to the second in the state table are retargeted
- * to the first.
- */
- void removeState(IntPair duplStates);
-
- /** Find the next duplicate state in the safe reverse table. An iterator function.
- * @param states in/out parameter, specifies where to start looking for duplicates,
- * and returns the first pair of duplicates found, if any.
- * @return true if a duplicate pair of states was found.
- */
- bool findDuplicateSafeState(IntPair *states);
-
- /** Remove a duplicate state from the safe table.
- * @param duplStates The duplicate states. The first is kept, the second is removed.
- * All references to the second in the state table are retargeted
- * to the first.
- */
- void removeSafeState(IntPair duplStates);
-
+ /**
+ * Find duplicate (redundant) states, beginning at the specified pair,
+ * within this state table. This is an iterator-like function, used to
+ * identify states (state table rows) that can be eliminated.
+ * @param states in/out parameter, specifies where to start looking for duplicates,
+ * and returns the first pair of duplicates found, if any.
+ * @return true if duplicate states were found, false otherwise.
+ */
+ bool findDuplicateState(IntPair *states);
+
+ /** Remove a duplicate state.
+ * @param duplStates The duplicate states. The first is kept, the second is removed.
+ * All references to the second in the state table are retargeted
+ * to the first.
+ */
+ void removeState(IntPair duplStates);
+
+ /** Find the next duplicate state in the safe reverse table. An iterator function.
+ * @param states in/out parameter, specifies where to start looking for duplicates,
+ * and returns the first pair of duplicates found, if any.
+ * @return true if a duplicate pair of states was found.
+ */
+ bool findDuplicateSafeState(IntPair *states);
+
+ /** Remove a duplicate state from the safe table.
+ * @param duplStates The duplicate states. The first is kept, the second is removed.
+ * All references to the second in the state table are retargeted
+ * to the first.
+ */
+ void removeSafeState(IntPair duplStates);
+
// Set functions for UVector.
// TODO: make a USet subclass of UVector
@@ -153,13 +153,13 @@ public:
void printPosSets(RBBINode *n /* = NULL*/);
void printStates();
void printRuleStatusTable();
- void printReverseTable();
+ void printReverseTable();
#else
#define printSet(s)
#define printPosSets(n)
#define printStates()
#define printRuleStatusTable()
- #define printReverseTable()
+ #define printReverseTable()
#endif
private:
@@ -168,18 +168,18 @@ private:
// table for.
UErrorCode *fStatus;
- /** State Descriptors, UVector<RBBIStateDescriptor> */
+ /** State Descriptors, UVector<RBBIStateDescriptor> */
UVector *fDStates; // D states (Aho's terminology)
// Index is state number
// Contents are RBBIStateDescriptor pointers.
- /** Synthesized safe table, UVector of UnicodeString, one string per table row. */
- UVector *fSafeTable;
+ /** Synthesized safe table, UVector of UnicodeString, one string per table row. */
+ UVector *fSafeTable;
+
+ /** Map from rule number (fVal in look ahead nodes) to sequential lookahead index. */
+ UVector32 *fLookAheadRuleMap = nullptr;
+
- /** Map from rule number (fVal in look ahead nodes) to sequential lookahead index. */
- UVector32 *fLookAheadRuleMap = nullptr;
-
-
RBBITableBuilder(const RBBITableBuilder &other); // forbid copying of this class
RBBITableBuilder &operator=(const RBBITableBuilder &other); // forbid copying of this class
};
@@ -198,7 +198,7 @@ public:
// with this state. Unordered (it's a set).
// UVector contents are RBBINode *
- UVector32 *fDtran; // Transitions out of this state.
+ UVector32 *fDtran; // Transitions out of this state.
// indexed by input character
// contents is int index of dest state
// in RBBITableBuilder.fDStates
@@ -214,7 +214,7 @@ private:
U_NAMESPACE_END
-
-#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
-
+
+#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
+
#endif
diff --git a/contrib/libs/icu/common/resbund.cpp b/contrib/libs/icu/common/resbund.cpp
index ed1cdfd9d3..7c5063b211 100644
--- a/contrib/libs/icu/common/resbund.cpp
+++ b/contrib/libs/icu/common/resbund.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -51,7 +51,7 @@
#include "unicode/utypes.h"
#include "unicode/resbund.h"
-#include "cmemory.h"
+#include "cmemory.h"
#include "mutex.h"
#include "uassert.h"
#include "umutex.h"
@@ -378,7 +378,7 @@ void ResourceBundle::getVersion(UVersionInfo versionInfo) const {
}
const Locale &ResourceBundle::getLocale(void) const {
- static UMutex gLocaleLock;
+ static UMutex gLocaleLock;
Mutex lock(&gLocaleLock);
if (fLocale != NULL) {
return *fLocale;
diff --git a/contrib/libs/icu/common/resbund_cnv.cpp b/contrib/libs/icu/common/resbund_cnv.cpp
index aeb2f7147e..45c0b399bf 100644
--- a/contrib/libs/icu/common/resbund_cnv.cpp
+++ b/contrib/libs/icu/common/resbund_cnv.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: resbund_cnv.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/resource.cpp b/contrib/libs/icu/common/resource.cpp
index 3870545ded..3d41a16029 100644
--- a/contrib/libs/icu/common/resource.cpp
+++ b/contrib/libs/icu/common/resource.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/common/resource.h b/contrib/libs/icu/common/resource.h
index 3fd327315d..5199b85888 100644
--- a/contrib/libs/icu/common/resource.h
+++ b/contrib/libs/icu/common/resource.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -28,7 +28,7 @@
#include "unicode/utypes.h"
#include "unicode/unistr.h"
#include "unicode/ures.h"
-#include "restrace.h"
+#include "restrace.h"
struct ResourceData;
@@ -48,10 +48,10 @@ public:
ResourceArray() : items16(NULL), items32(NULL), length(0) {}
/** Only for implementation use. @internal */
- ResourceArray(const uint16_t *i16, const uint32_t *i32, int32_t len,
- const ResourceTracer& traceInfo) :
- items16(i16), items32(i32), length(len),
- fTraceInfo(traceInfo) {}
+ ResourceArray(const uint16_t *i16, const uint32_t *i32, int32_t len,
+ const ResourceTracer& traceInfo) :
+ items16(i16), items32(i32), length(len),
+ fTraceInfo(traceInfo) {}
/**
* @return The number of items in the array resource.
@@ -71,7 +71,7 @@ private:
const uint16_t *items16;
const uint32_t *items32;
int32_t length;
- ResourceTracer fTraceInfo;
+ ResourceTracer fTraceInfo;
};
/**
@@ -84,37 +84,37 @@ public:
/** Only for implementation use. @internal */
ResourceTable(const uint16_t *k16, const int32_t *k32,
- const uint16_t *i16, const uint32_t *i32, int32_t len,
- const ResourceTracer& traceInfo) :
- keys16(k16), keys32(k32), items16(i16), items32(i32), length(len),
- fTraceInfo(traceInfo) {}
+ const uint16_t *i16, const uint32_t *i32, int32_t len,
+ const ResourceTracer& traceInfo) :
+ keys16(k16), keys32(k32), items16(i16), items32(i32), length(len),
+ fTraceInfo(traceInfo) {}
/**
* @return The number of items in the array resource.
*/
int32_t getSize() const { return length; }
/**
- * @param i Table item index.
+ * @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().
*/
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.
- */
- UBool findValue(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.
+ */
+ UBool findValue(const char *key, ResourceValue &value) const;
+
private:
const uint16_t *keys16;
const int32_t *keys32;
const uint16_t *items16;
const uint32_t *items32;
int32_t length;
- ResourceTracer fTraceInfo;
+ ResourceTracer fTraceInfo;
};
/**
diff --git a/contrib/libs/icu/common/restrace.cpp b/contrib/libs/icu/common/restrace.cpp
index fe22d560dc..5c6498850e 100644
--- a/contrib/libs/icu/common/restrace.cpp
+++ b/contrib/libs/icu/common/restrace.cpp
@@ -1,130 +1,130 @@
-// © 2019 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if U_ENABLE_TRACING
-
-#include "restrace.h"
-#include "charstr.h"
-#include "cstring.h"
-#include "utracimp.h"
-#include "uresimp.h"
-#include "uassert.h"
-#include "util.h"
-
-U_NAMESPACE_BEGIN
-
-ResourceTracer::~ResourceTracer() = default;
-
-void ResourceTracer::trace(const char* resType) const {
- U_ASSERT(fResB || fParent);
- UTRACE_ENTRY(UTRACE_UDATA_RESOURCE);
- UErrorCode status = U_ZERO_ERROR;
-
- CharString filePath;
- getFilePath(filePath, status);
-
- CharString resPath;
- getResPath(resPath, status);
-
- // The longest type ("intvector") is 9 chars
- const char kSpaces[] = " ";
- CharString format;
- format.append(kSpaces, sizeof(kSpaces) - 1 - uprv_strlen(resType), status);
- format.append("(%s) %s @ %s", status);
-
- UTRACE_DATA3(UTRACE_VERBOSE,
- format.data(),
- resType,
- filePath.data(),
- resPath.data());
- UTRACE_EXIT_STATUS(status);
-}
-
-void ResourceTracer::traceOpen() const {
- U_ASSERT(fResB);
- UTRACE_ENTRY(UTRACE_UDATA_BUNDLE);
- UErrorCode status = U_ZERO_ERROR;
-
- CharString filePath;
- UTRACE_DATA1(UTRACE_VERBOSE, "%s", getFilePath(filePath, status).data());
- UTRACE_EXIT_STATUS(status);
-}
-
-CharString& ResourceTracer::getFilePath(CharString& output, UErrorCode& status) const {
- if (fResB) {
- output.append(fResB->fData->fPath, status);
- output.append('/', status);
- output.append(fResB->fData->fName, status);
- output.append(".res", status);
- } else {
- fParent->getFilePath(output, status);
- }
- return output;
-}
-
-CharString& ResourceTracer::getResPath(CharString& output, UErrorCode& status) const {
- if (fResB) {
- output.append('/', status);
- output.append(fResB->fResPath, status);
- // removing the trailing /
- U_ASSERT(output[output.length()-1] == '/');
- output.truncate(output.length()-1);
- } else {
- fParent->getResPath(output, status);
- }
- if (fKey) {
- output.append('/', status);
- output.append(fKey, status);
- }
- if (fIndex != -1) {
- output.append('[', status);
- UnicodeString indexString;
- ICU_Utility::appendNumber(indexString, fIndex);
- output.appendInvariantChars(indexString, status);
- output.append(']', status);
- }
- return output;
-}
-
-void FileTracer::traceOpen(const char* path, const char* type, const char* name) {
- if (uprv_strcmp(type, "res") == 0) {
- traceOpenResFile(path, name);
- } else {
- traceOpenDataFile(path, type, name);
- }
-}
-
-void FileTracer::traceOpenDataFile(const char* path, const char* type, const char* name) {
- UTRACE_ENTRY(UTRACE_UDATA_DATA_FILE);
- UErrorCode status = U_ZERO_ERROR;
-
- CharString filePath;
- filePath.append(path, status);
- filePath.append('/', status);
- filePath.append(name, status);
- filePath.append('.', status);
- filePath.append(type, status);
-
- UTRACE_DATA1(UTRACE_VERBOSE, "%s", filePath.data());
- UTRACE_EXIT_STATUS(status);
-}
-
-void FileTracer::traceOpenResFile(const char* path, const char* name) {
- UTRACE_ENTRY(UTRACE_UDATA_RES_FILE);
- UErrorCode status = U_ZERO_ERROR;
-
- CharString filePath;
- filePath.append(path, status);
- filePath.append('/', status);
- filePath.append(name, status);
- filePath.append(".res", status);
-
- UTRACE_DATA1(UTRACE_VERBOSE, "%s", filePath.data());
- UTRACE_EXIT_STATUS(status);
-}
-
-U_NAMESPACE_END
-
-#endif // U_ENABLE_TRACING
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if U_ENABLE_TRACING
+
+#include "restrace.h"
+#include "charstr.h"
+#include "cstring.h"
+#include "utracimp.h"
+#include "uresimp.h"
+#include "uassert.h"
+#include "util.h"
+
+U_NAMESPACE_BEGIN
+
+ResourceTracer::~ResourceTracer() = default;
+
+void ResourceTracer::trace(const char* resType) const {
+ U_ASSERT(fResB || fParent);
+ UTRACE_ENTRY(UTRACE_UDATA_RESOURCE);
+ UErrorCode status = U_ZERO_ERROR;
+
+ CharString filePath;
+ getFilePath(filePath, status);
+
+ CharString resPath;
+ getResPath(resPath, status);
+
+ // The longest type ("intvector") is 9 chars
+ const char kSpaces[] = " ";
+ CharString format;
+ format.append(kSpaces, sizeof(kSpaces) - 1 - uprv_strlen(resType), status);
+ format.append("(%s) %s @ %s", status);
+
+ UTRACE_DATA3(UTRACE_VERBOSE,
+ format.data(),
+ resType,
+ filePath.data(),
+ resPath.data());
+ UTRACE_EXIT_STATUS(status);
+}
+
+void ResourceTracer::traceOpen() const {
+ U_ASSERT(fResB);
+ UTRACE_ENTRY(UTRACE_UDATA_BUNDLE);
+ UErrorCode status = U_ZERO_ERROR;
+
+ CharString filePath;
+ UTRACE_DATA1(UTRACE_VERBOSE, "%s", getFilePath(filePath, status).data());
+ UTRACE_EXIT_STATUS(status);
+}
+
+CharString& ResourceTracer::getFilePath(CharString& output, UErrorCode& status) const {
+ if (fResB) {
+ output.append(fResB->fData->fPath, status);
+ output.append('/', status);
+ output.append(fResB->fData->fName, status);
+ output.append(".res", status);
+ } else {
+ fParent->getFilePath(output, status);
+ }
+ return output;
+}
+
+CharString& ResourceTracer::getResPath(CharString& output, UErrorCode& status) const {
+ if (fResB) {
+ output.append('/', status);
+ output.append(fResB->fResPath, status);
+ // removing the trailing /
+ U_ASSERT(output[output.length()-1] == '/');
+ output.truncate(output.length()-1);
+ } else {
+ fParent->getResPath(output, status);
+ }
+ if (fKey) {
+ output.append('/', status);
+ output.append(fKey, status);
+ }
+ if (fIndex != -1) {
+ output.append('[', status);
+ UnicodeString indexString;
+ ICU_Utility::appendNumber(indexString, fIndex);
+ output.appendInvariantChars(indexString, status);
+ output.append(']', status);
+ }
+ return output;
+}
+
+void FileTracer::traceOpen(const char* path, const char* type, const char* name) {
+ if (uprv_strcmp(type, "res") == 0) {
+ traceOpenResFile(path, name);
+ } else {
+ traceOpenDataFile(path, type, name);
+ }
+}
+
+void FileTracer::traceOpenDataFile(const char* path, const char* type, const char* name) {
+ UTRACE_ENTRY(UTRACE_UDATA_DATA_FILE);
+ UErrorCode status = U_ZERO_ERROR;
+
+ CharString filePath;
+ filePath.append(path, status);
+ filePath.append('/', status);
+ filePath.append(name, status);
+ filePath.append('.', status);
+ filePath.append(type, status);
+
+ UTRACE_DATA1(UTRACE_VERBOSE, "%s", filePath.data());
+ UTRACE_EXIT_STATUS(status);
+}
+
+void FileTracer::traceOpenResFile(const char* path, const char* name) {
+ UTRACE_ENTRY(UTRACE_UDATA_RES_FILE);
+ UErrorCode status = U_ZERO_ERROR;
+
+ CharString filePath;
+ filePath.append(path, status);
+ filePath.append('/', status);
+ filePath.append(name, status);
+ filePath.append(".res", status);
+
+ UTRACE_DATA1(UTRACE_VERBOSE, "%s", filePath.data());
+ UTRACE_EXIT_STATUS(status);
+}
+
+U_NAMESPACE_END
+
+#endif // U_ENABLE_TRACING
diff --git a/contrib/libs/icu/common/restrace.h b/contrib/libs/icu/common/restrace.h
index 7686898d53..ef29eaed57 100644
--- a/contrib/libs/icu/common/restrace.h
+++ b/contrib/libs/icu/common/restrace.h
@@ -1,147 +1,147 @@
-// © 2019 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#ifndef __RESTRACE_H__
-#define __RESTRACE_H__
-
-#include "unicode/utypes.h"
-
-#if U_ENABLE_TRACING
-
-struct UResourceBundle;
-
-U_NAMESPACE_BEGIN
-
-class CharString;
-
-/**
- * Instances of this class store information used to trace reads from resource
- * bundles when ICU is built with --enable-tracing.
- *
- * All arguments of type const UResourceBundle*, const char*, and
- * const ResourceTracer& are stored as pointers. The caller must retain
- * ownership for the lifetime of this ResourceTracer.
- *
- * Exported as U_COMMON_API for Windows because it is a value field
- * in other exported types.
- */
-class U_COMMON_API ResourceTracer {
-public:
- ResourceTracer() :
- fResB(nullptr),
- fParent(nullptr),
- fKey(nullptr),
- fIndex(-1) {}
-
- ResourceTracer(const UResourceBundle* resB) :
- fResB(resB),
- fParent(nullptr),
- fKey(nullptr),
- fIndex(-1) {}
-
- ResourceTracer(const UResourceBundle* resB, const char* key) :
- fResB(resB),
- fParent(nullptr),
- fKey(key),
- fIndex(-1) {}
-
- ResourceTracer(const UResourceBundle* resB, int32_t index) :
- fResB(resB),
- fParent(nullptr),
- fKey(nullptr),
- fIndex(index) {}
-
- ResourceTracer(const ResourceTracer& parent, const char* key) :
- fResB(nullptr),
- fParent(&parent),
- fKey(key),
- fIndex(-1) {}
-
- ResourceTracer(const ResourceTracer& parent, int32_t index) :
- fResB(nullptr),
- fParent(&parent),
- fKey(nullptr),
- fIndex(index) {}
-
- ~ResourceTracer();
-
- void trace(const char* type) const;
- void traceOpen() const;
-
- /**
- * Calls trace() if the resB or parent provided to the constructor was
- * non-null; otherwise, does nothing.
- */
- void maybeTrace(const char* type) const {
- if (fResB || fParent) {
- trace(type);
- }
- }
-
-private:
- const UResourceBundle* fResB;
- const ResourceTracer* fParent;
- const char* fKey;
- int32_t fIndex;
-
- CharString& getFilePath(CharString& output, UErrorCode& status) const;
-
- CharString& getResPath(CharString& output, UErrorCode& status) const;
-};
-
-/**
- * This class provides methods to trace data file reads when ICU is built
- * with --enable-tracing.
- */
-class FileTracer {
-public:
- static void traceOpen(const char* path, const char* type, const char* name);
-
-private:
- static void traceOpenDataFile(const char* path, const char* type, const char* name);
- static void traceOpenResFile(const char* path, const char* name);
-};
-
-U_NAMESPACE_END
-
-#else // U_ENABLE_TRACING
-
-U_NAMESPACE_BEGIN
-
-/**
- * Default trivial implementation when --enable-tracing is not used.
- */
-class U_COMMON_API ResourceTracer {
-public:
- ResourceTracer() {}
-
- ResourceTracer(const void*) {}
-
- ResourceTracer(const void*, const char*) {}
-
- ResourceTracer(const void*, int32_t) {}
-
- ResourceTracer(const ResourceTracer&, const char*) {}
-
- ResourceTracer(const ResourceTracer&, int32_t) {}
-
- void trace(const char*) const {}
-
- void traceOpen() const {}
-
- void maybeTrace(const char*) const {}
-};
-
-/**
- * Default trivial implementation when --enable-tracing is not used.
- */
-class FileTracer {
-public:
- static void traceOpen(const char*, const char*, const char*) {}
-};
-
-U_NAMESPACE_END
-
-#endif // U_ENABLE_TRACING
-
-#endif //__RESTRACE_H__
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#ifndef __RESTRACE_H__
+#define __RESTRACE_H__
+
+#include "unicode/utypes.h"
+
+#if U_ENABLE_TRACING
+
+struct UResourceBundle;
+
+U_NAMESPACE_BEGIN
+
+class CharString;
+
+/**
+ * Instances of this class store information used to trace reads from resource
+ * bundles when ICU is built with --enable-tracing.
+ *
+ * All arguments of type const UResourceBundle*, const char*, and
+ * const ResourceTracer& are stored as pointers. The caller must retain
+ * ownership for the lifetime of this ResourceTracer.
+ *
+ * Exported as U_COMMON_API for Windows because it is a value field
+ * in other exported types.
+ */
+class U_COMMON_API ResourceTracer {
+public:
+ ResourceTracer() :
+ fResB(nullptr),
+ fParent(nullptr),
+ fKey(nullptr),
+ fIndex(-1) {}
+
+ ResourceTracer(const UResourceBundle* resB) :
+ fResB(resB),
+ fParent(nullptr),
+ fKey(nullptr),
+ fIndex(-1) {}
+
+ ResourceTracer(const UResourceBundle* resB, const char* key) :
+ fResB(resB),
+ fParent(nullptr),
+ fKey(key),
+ fIndex(-1) {}
+
+ ResourceTracer(const UResourceBundle* resB, int32_t index) :
+ fResB(resB),
+ fParent(nullptr),
+ fKey(nullptr),
+ fIndex(index) {}
+
+ ResourceTracer(const ResourceTracer& parent, const char* key) :
+ fResB(nullptr),
+ fParent(&parent),
+ fKey(key),
+ fIndex(-1) {}
+
+ ResourceTracer(const ResourceTracer& parent, int32_t index) :
+ fResB(nullptr),
+ fParent(&parent),
+ fKey(nullptr),
+ fIndex(index) {}
+
+ ~ResourceTracer();
+
+ void trace(const char* type) const;
+ void traceOpen() const;
+
+ /**
+ * Calls trace() if the resB or parent provided to the constructor was
+ * non-null; otherwise, does nothing.
+ */
+ void maybeTrace(const char* type) const {
+ if (fResB || fParent) {
+ trace(type);
+ }
+ }
+
+private:
+ const UResourceBundle* fResB;
+ const ResourceTracer* fParent;
+ const char* fKey;
+ int32_t fIndex;
+
+ CharString& getFilePath(CharString& output, UErrorCode& status) const;
+
+ CharString& getResPath(CharString& output, UErrorCode& status) const;
+};
+
+/**
+ * This class provides methods to trace data file reads when ICU is built
+ * with --enable-tracing.
+ */
+class FileTracer {
+public:
+ static void traceOpen(const char* path, const char* type, const char* name);
+
+private:
+ static void traceOpenDataFile(const char* path, const char* type, const char* name);
+ static void traceOpenResFile(const char* path, const char* name);
+};
+
+U_NAMESPACE_END
+
+#else // U_ENABLE_TRACING
+
+U_NAMESPACE_BEGIN
+
+/**
+ * Default trivial implementation when --enable-tracing is not used.
+ */
+class U_COMMON_API ResourceTracer {
+public:
+ ResourceTracer() {}
+
+ ResourceTracer(const void*) {}
+
+ ResourceTracer(const void*, const char*) {}
+
+ ResourceTracer(const void*, int32_t) {}
+
+ ResourceTracer(const ResourceTracer&, const char*) {}
+
+ ResourceTracer(const ResourceTracer&, int32_t) {}
+
+ void trace(const char*) const {}
+
+ void traceOpen() const {}
+
+ void maybeTrace(const char*) const {}
+};
+
+/**
+ * Default trivial implementation when --enable-tracing is not used.
+ */
+class FileTracer {
+public:
+ static void traceOpen(const char*, const char*, const char*) {}
+};
+
+U_NAMESPACE_END
+
+#endif // U_ENABLE_TRACING
+
+#endif //__RESTRACE_H__
diff --git a/contrib/libs/icu/common/ruleiter.cpp b/contrib/libs/icu/common/ruleiter.cpp
index 55e800b694..41eea23c0d 100644
--- a/contrib/libs/icu/common/ruleiter.cpp
+++ b/contrib/libs/icu/common/ruleiter.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/ruleiter.h b/contrib/libs/icu/common/ruleiter.h
index e6d0d83026..4e1be53823 100644
--- a/contrib/libs/icu/common/ruleiter.h
+++ b/contrib/libs/icu/common/ruleiter.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/schriter.cpp b/contrib/libs/icu/common/schriter.cpp
index 4a323b0ff0..17b68aee9d 100644
--- a/contrib/libs/icu/common/schriter.cpp
+++ b/contrib/libs/icu/common/schriter.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -101,7 +101,7 @@ StringCharacterIterator::operator==(const ForwardCharacterIterator& that) const
&& end == realThat.end;
}
-StringCharacterIterator*
+StringCharacterIterator*
StringCharacterIterator::clone() const {
return new StringCharacterIterator(*this);
}
diff --git a/contrib/libs/icu/common/serv.cpp b/contrib/libs/icu/common/serv.cpp
index 89d21294ef..ce545b9dbd 100644
--- a/contrib/libs/icu/common/serv.cpp
+++ b/contrib/libs/icu/common/serv.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/**
*******************************************************************************
@@ -333,7 +333,7 @@ U_CDECL_END
******************************************************************
*/
-static UMutex lock;
+static UMutex lock;
ICUService::ICUService()
: name()
@@ -553,7 +553,7 @@ outerEnd:
if (cacheDescriptorList._obj != NULL) {
for (int32_t i = cacheDescriptorList._obj->size(); --i >= 0;) {
UnicodeString* desc = (UnicodeString*)cacheDescriptorList._obj->elementAt(i);
-
+
serviceCache->put(*desc, result, status);
if (U_FAILURE(status)) {
return NULL;
@@ -702,9 +702,9 @@ ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result, const
}
// fallback
- status = U_ZERO_ERROR;
+ status = U_ZERO_ERROR;
ICUServiceKey* fallbackKey = createKey(&id, status);
- while (fallbackKey != NULL && fallbackKey->fallback()) {
+ while (fallbackKey != NULL && fallbackKey->fallback()) {
UnicodeString us;
fallbackKey->currentID(us);
f = (ICUServiceFactory*)map->get(us);
diff --git a/contrib/libs/icu/common/serv.h b/contrib/libs/icu/common/serv.h
index 8a0cb8c473..e1f69cd411 100644
--- a/contrib/libs/icu/common/serv.h
+++ b/contrib/libs/icu/common/serv.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/**
*******************************************************************************
diff --git a/contrib/libs/icu/common/servlk.cpp b/contrib/libs/icu/common/servlk.cpp
index c747231d16..538982ca36 100644
--- a/contrib/libs/icu/common/servlk.cpp
+++ b/contrib/libs/icu/common/servlk.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/**
*******************************************************************************
diff --git a/contrib/libs/icu/common/servlkf.cpp b/contrib/libs/icu/common/servlkf.cpp
index a90cd66c51..84f2347cdd 100644
--- a/contrib/libs/icu/common/servlkf.cpp
+++ b/contrib/libs/icu/common/servlkf.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/**
*******************************************************************************
diff --git a/contrib/libs/icu/common/servloc.h b/contrib/libs/icu/common/servloc.h
index 36549f6280..ccf6433379 100644
--- a/contrib/libs/icu/common/servloc.h
+++ b/contrib/libs/icu/common/servloc.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/**
*******************************************************************************
diff --git a/contrib/libs/icu/common/servls.cpp b/contrib/libs/icu/common/servls.cpp
index e9c6bdaf73..81dc4f750e 100644
--- a/contrib/libs/icu/common/servls.cpp
+++ b/contrib/libs/icu/common/servls.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/**
*******************************************************************************
@@ -263,7 +263,7 @@ ICULocaleService::validateFallbackLocale() const
{
const Locale& loc = Locale::getDefault();
ICULocaleService* ncThis = (ICULocaleService*)this;
- static UMutex llock;
+ static UMutex llock;
{
Mutex mutex(&llock);
if (loc != fallbackLocale) {
diff --git a/contrib/libs/icu/common/servnotf.cpp b/contrib/libs/icu/common/servnotf.cpp
index c9db8497ee..f577795cae 100644
--- a/contrib/libs/icu/common/servnotf.cpp
+++ b/contrib/libs/icu/common/servnotf.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/**
*******************************************************************************
@@ -21,7 +21,7 @@ U_NAMESPACE_BEGIN
EventListener::~EventListener() {}
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(EventListener)
-static UMutex notifyLock;
+static UMutex notifyLock;
ICUNotifier::ICUNotifier(void)
: listeners(NULL)
diff --git a/contrib/libs/icu/common/servnotf.h b/contrib/libs/icu/common/servnotf.h
index 964a6e5e09..dba7a0fea3 100644
--- a/contrib/libs/icu/common/servnotf.h
+++ b/contrib/libs/icu/common/servnotf.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/**
*******************************************************************************
diff --git a/contrib/libs/icu/common/servrbf.cpp b/contrib/libs/icu/common/servrbf.cpp
index 388b64d8a9..94279ab3a1 100644
--- a/contrib/libs/icu/common/servrbf.cpp
+++ b/contrib/libs/icu/common/servrbf.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/**
*******************************************************************************
diff --git a/contrib/libs/icu/common/servslkf.cpp b/contrib/libs/icu/common/servslkf.cpp
index 0bb7980aa6..09154d1b91 100644
--- a/contrib/libs/icu/common/servslkf.cpp
+++ b/contrib/libs/icu/common/servslkf.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/**
*******************************************************************************
diff --git a/contrib/libs/icu/common/sharedobject.cpp b/contrib/libs/icu/common/sharedobject.cpp
index b2fbd35180..6eeca8605f 100644
--- a/contrib/libs/icu/common/sharedobject.cpp
+++ b/contrib/libs/icu/common/sharedobject.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,10 +8,10 @@
* sharedobject.cpp
*/
#include "sharedobject.h"
-#include "mutex.h"
+#include "mutex.h"
#include "uassert.h"
-#include "umutex.h"
-#include "unifiedcache.h"
+#include "umutex.h"
+#include "unifiedcache.h"
U_NAMESPACE_BEGIN
@@ -20,28 +20,28 @@ SharedObject::~SharedObject() {}
UnifiedCacheBase::~UnifiedCacheBase() {}
void
-SharedObject::addRef() const {
- umtx_atomic_inc(&hardRefCount);
+SharedObject::addRef() const {
+ umtx_atomic_inc(&hardRefCount);
}
-// removeRef Decrement the reference count and delete if it is zero.
-// Note that SharedObjects with a non-null cachePtr are owned by the
-// unified cache, and the cache will be responsible for the actual deletion.
-// The deletion could be as soon as immediately following the
-// update to the reference count, if another thread is running
-// a cache eviction cycle concurrently.
-// NO ACCESS TO *this PERMITTED AFTER REFERENCE COUNT == 0 for cached objects.
-// THE OBJECT MAY ALREADY BE GONE.
+// removeRef Decrement the reference count and delete if it is zero.
+// Note that SharedObjects with a non-null cachePtr are owned by the
+// unified cache, and the cache will be responsible for the actual deletion.
+// The deletion could be as soon as immediately following the
+// update to the reference count, if another thread is running
+// a cache eviction cycle concurrently.
+// NO ACCESS TO *this PERMITTED AFTER REFERENCE COUNT == 0 for cached objects.
+// THE OBJECT MAY ALREADY BE GONE.
void
-SharedObject::removeRef() const {
- const UnifiedCacheBase *cache = this->cachePtr;
- int32_t updatedRefCount = umtx_atomic_dec(&hardRefCount);
- U_ASSERT(updatedRefCount >= 0);
- if (updatedRefCount == 0) {
- if (cache) {
- cache->handleUnreferencedObject();
+SharedObject::removeRef() const {
+ const UnifiedCacheBase *cache = this->cachePtr;
+ int32_t updatedRefCount = umtx_atomic_dec(&hardRefCount);
+ U_ASSERT(updatedRefCount >= 0);
+ if (updatedRefCount == 0) {
+ if (cache) {
+ cache->handleUnreferencedObject();
} else {
- delete this;
+ delete this;
}
}
}
@@ -54,7 +54,7 @@ SharedObject::getRefCount() const {
void
SharedObject::deleteIfZeroRefCount() const {
- if (this->cachePtr == nullptr && getRefCount() == 0) {
+ if (this->cachePtr == nullptr && getRefCount() == 0) {
delete this;
}
}
diff --git a/contrib/libs/icu/common/sharedobject.h b/contrib/libs/icu/common/sharedobject.h
index 6c260ca784..c0a5aba478 100644
--- a/contrib/libs/icu/common/sharedobject.h
+++ b/contrib/libs/icu/common/sharedobject.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -17,8 +17,8 @@
U_NAMESPACE_BEGIN
-class SharedObject;
-
+class SharedObject;
+
/**
* Base class for unified cache exposing enough methods to SharedObject
* instances to allow their addRef() and removeRef() methods to
@@ -30,11 +30,11 @@ public:
UnifiedCacheBase() { }
/**
- * Notify the cache implementation that an object was seen transitioning to
- * zero hard references. The cache may use this to keep track the number of
- * unreferenced SharedObjects, and to trigger evictions.
+ * Notify the cache implementation that an object was seen transitioning to
+ * zero hard references. The cache may use this to keep track the number of
+ * unreferenced SharedObjects, and to trigger evictions.
*/
- virtual void handleUnreferencedObject() const = 0;
+ virtual void handleUnreferencedObject() const = 0;
virtual ~UnifiedCacheBase();
private:
@@ -69,22 +69,22 @@ public:
virtual ~SharedObject();
/**
- * Increments the number of hard references to this object. Thread-safe.
- * Not for use from within the Unified Cache implementation.
+ * Increments the number of hard references to this object. Thread-safe.
+ * Not for use from within the Unified Cache implementation.
*/
- void addRef() const;
+ void addRef() const;
/**
- * Decrements the number of hard references to this object, and
- * arrange for possible cache-eviction and/or deletion if ref
- * count goes to zero. Thread-safe.
- *
- * Not for use from within the UnifiedCache implementation.
+ * Decrements the number of hard references to this object, and
+ * arrange for possible cache-eviction and/or deletion if ref
+ * count goes to zero. Thread-safe.
+ *
+ * Not for use from within the UnifiedCache implementation.
*/
- void removeRef() const;
+ void removeRef() const;
/**
- * Returns the number of hard references for this object.
+ * Returns the number of hard references for this object.
* Uses a memory barrier.
*/
int32_t getRefCount() const;
@@ -93,18 +93,18 @@ public:
* 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; }
+ inline UBool noHardReferences() const { return getRefCount() == 0; }
/**
* 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; }
+ inline UBool hasHardReferences() const { return getRefCount() != 0; }
/**
- * Deletes this object if it has no references.
- * Available for non-cached SharedObjects only. Ownership of cached objects
- * is with the UnifiedCache, which is solely responsible for eviction and deletion.
+ * Deletes this object if it has no references.
+ * Available for non-cached SharedObjects only. Ownership of cached objects
+ * is with the UnifiedCache, which is solely responsible for eviction and deletion.
*/
void deleteIfZeroRefCount() const;
@@ -161,20 +161,20 @@ public:
}
private:
- /**
- * The number of references from the UnifiedCache, which is
- * the number of times that the sharedObject is stored as a hash table value.
- * For use by UnifiedCache implementation code only.
- * All access is synchronized by UnifiedCache's gCacheMutex
- */
+ /**
+ * The number of references from the UnifiedCache, which is
+ * the number of times that the sharedObject is stored as a hash table value.
+ * For use by UnifiedCache implementation code only.
+ * All access is synchronized by UnifiedCache's gCacheMutex
+ */
mutable int32_t softRefCount;
- friend class UnifiedCache;
+ friend class UnifiedCache;
- /**
- * Reference count, excluding references from within the UnifiedCache implementation.
- */
+ /**
+ * Reference count, excluding references from within the UnifiedCache implementation.
+ */
mutable u_atomic_int32_t hardRefCount;
-
+
mutable const UnifiedCacheBase *cachePtr;
};
diff --git a/contrib/libs/icu/common/simpleformatter.cpp b/contrib/libs/icu/common/simpleformatter.cpp
index bb3e98fd7f..76d8f54efd 100644
--- a/contrib/libs/icu/common/simpleformatter.cpp
+++ b/contrib/libs/icu/common/simpleformatter.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -246,24 +246,24 @@ UnicodeString &SimpleFormatter::formatAndReplace(
}
UnicodeString SimpleFormatter::getTextWithNoArguments(
- const UChar *compiledPattern,
- int32_t compiledPatternLength,
- int32_t* offsets,
- int32_t offsetsLength) {
- for (int32_t i = 0; i < offsetsLength; i++) {
- offsets[i] = -1;
- }
+ const UChar *compiledPattern,
+ int32_t compiledPatternLength,
+ int32_t* offsets,
+ int32_t offsetsLength) {
+ for (int32_t i = 0; i < offsetsLength; i++) {
+ offsets[i] = -1;
+ }
int32_t capacity = compiledPatternLength - 1 -
getArgumentLimit(compiledPattern, compiledPatternLength);
UnicodeString sb(capacity, 0, 0); // Java: StringBuilder
for (int32_t i = 1; i < compiledPatternLength;) {
- int32_t n = compiledPattern[i++];
- if (n > ARG_NUM_LIMIT) {
- n -= ARG_NUM_LIMIT;
- sb.append(compiledPattern + i, n);
- i += n;
- } else if (n < offsetsLength) {
- offsets[n] = sb.length();
+ int32_t n = compiledPattern[i++];
+ if (n > ARG_NUM_LIMIT) {
+ n -= ARG_NUM_LIMIT;
+ sb.append(compiledPattern + i, n);
+ i += n;
+ } else if (n < offsetsLength) {
+ offsets[n] = sb.length();
}
}
return sb;
diff --git a/contrib/libs/icu/common/sprpimpl.h b/contrib/libs/icu/common/sprpimpl.h
index a69768b394..ca0bcdb516 100644
--- a/contrib/libs/icu/common/sprpimpl.h
+++ b/contrib/libs/icu/common/sprpimpl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: sprpimpl.h
- * encoding: UTF-8
+ * encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/static_unicode_sets.cpp b/contrib/libs/icu/common/static_unicode_sets.cpp
index 94bf08dc96..5dab3931a7 100644
--- a/contrib/libs/icu/common/static_unicode_sets.cpp
+++ b/contrib/libs/icu/common/static_unicode_sets.cpp
@@ -1,245 +1,245 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include "static_unicode_sets.h"
-#include "umutex.h"
-#include "ucln_cmn.h"
-#include "unicode/uniset.h"
-#include "uresimp.h"
-#include "cstring.h"
-#include "uassert.h"
-
-using namespace icu;
-using namespace icu::unisets;
-
-
-namespace {
-
-UnicodeSet* gUnicodeSets[UNISETS_KEY_COUNT] = {};
-
-// Save the empty instance in static memory to have well-defined behavior if a
-// regular UnicodeSet cannot be allocated.
-alignas(UnicodeSet)
-char gEmptyUnicodeSet[sizeof(UnicodeSet)];
-
-// Whether the gEmptyUnicodeSet is initialized and ready to use.
-UBool gEmptyUnicodeSetInitialized = FALSE;
-
-inline UnicodeSet* getImpl(Key key) {
- UnicodeSet* candidate = gUnicodeSets[key];
- if (candidate == nullptr) {
- return reinterpret_cast<UnicodeSet*>(gEmptyUnicodeSet);
- }
- return candidate;
-}
-
-UnicodeSet* computeUnion(Key k1, Key k2) {
- UnicodeSet* result = new UnicodeSet();
- if (result == nullptr) {
- return nullptr;
- }
- result->addAll(*getImpl(k1));
- result->addAll(*getImpl(k2));
- result->freeze();
- return result;
-}
-
-UnicodeSet* computeUnion(Key k1, Key k2, Key k3) {
- UnicodeSet* result = new UnicodeSet();
- if (result == nullptr) {
- return nullptr;
- }
- result->addAll(*getImpl(k1));
- result->addAll(*getImpl(k2));
- result->addAll(*getImpl(k3));
- result->freeze();
- return result;
-}
-
-
-void saveSet(Key key, const UnicodeString& unicodeSetPattern, UErrorCode& status) {
- // assert unicodeSets.get(key) == null;
- gUnicodeSets[key] = new UnicodeSet(unicodeSetPattern, status);
-}
-
-class ParseDataSink : public ResourceSink {
- public:
- void put(const char* key, ResourceValue& value, UBool /*noFallback*/, UErrorCode& status) U_OVERRIDE {
- ResourceTable contextsTable = value.getTable(status);
- if (U_FAILURE(status)) { return; }
- for (int i = 0; contextsTable.getKeyAndValue(i, key, value); i++) {
- if (uprv_strcmp(key, "date") == 0) {
- // ignore
- } else {
- ResourceTable strictnessTable = value.getTable(status);
- if (U_FAILURE(status)) { return; }
- for (int j = 0; strictnessTable.getKeyAndValue(j, key, value); j++) {
- bool isLenient = (uprv_strcmp(key, "lenient") == 0);
- ResourceArray array = value.getArray(status);
- if (U_FAILURE(status)) { return; }
- for (int k = 0; k < array.getSize(); k++) {
- array.getValue(k, value);
- UnicodeString str = value.getUnicodeString(status);
- if (U_FAILURE(status)) { return; }
- // There is both lenient and strict data for comma/period,
- // but not for any of the other symbols.
- if (str.indexOf(u'.') != -1) {
- saveSet(isLenient ? PERIOD : STRICT_PERIOD, str, status);
- } else if (str.indexOf(u',') != -1) {
- saveSet(isLenient ? COMMA : STRICT_COMMA, str, status);
- } else if (str.indexOf(u'+') != -1) {
- saveSet(PLUS_SIGN, str, status);
- } else if (str.indexOf(u'-') != -1) {
- saveSet(MINUS_SIGN, str, status);
- } else if (str.indexOf(u'$') != -1) {
- saveSet(DOLLAR_SIGN, str, status);
- } else if (str.indexOf(u'£') != -1) {
- saveSet(POUND_SIGN, str, status);
- } else if (str.indexOf(u'₹') != -1) {
- saveSet(RUPEE_SIGN, str, status);
- } else if (str.indexOf(u'¥') != -1) {
- saveSet(YEN_SIGN, str, status);
- } else if (str.indexOf(u'₩') != -1) {
- saveSet(WON_SIGN, str, status);
- } else if (str.indexOf(u'%') != -1) {
- saveSet(PERCENT_SIGN, str, status);
- } else if (str.indexOf(u'‰') != -1) {
- saveSet(PERMILLE_SIGN, str, status);
- } else if (str.indexOf(u'’') != -1) {
- saveSet(APOSTROPHE_SIGN, str, status);
- } else {
- // Unknown class of parse lenients
- // TODO(ICU-20428): Make ICU automatically accept new classes?
- U_ASSERT(FALSE);
- }
- if (U_FAILURE(status)) { return; }
- }
- }
- }
- }
- }
-};
-
-
-icu::UInitOnce gNumberParseUniSetsInitOnce = U_INITONCE_INITIALIZER;
-
-UBool U_CALLCONV cleanupNumberParseUniSets() {
- if (gEmptyUnicodeSetInitialized) {
- reinterpret_cast<UnicodeSet*>(gEmptyUnicodeSet)->~UnicodeSet();
- gEmptyUnicodeSetInitialized = FALSE;
- }
- for (int32_t i = 0; i < UNISETS_KEY_COUNT; i++) {
- delete gUnicodeSets[i];
- gUnicodeSets[i] = nullptr;
- }
- gNumberParseUniSetsInitOnce.reset();
- return TRUE;
-}
-
-void U_CALLCONV initNumberParseUniSets(UErrorCode& status) {
- ucln_common_registerCleanup(UCLN_COMMON_NUMPARSE_UNISETS, cleanupNumberParseUniSets);
-
- // Initialize the empty instance for well-defined fallback behavior
- new(gEmptyUnicodeSet) UnicodeSet();
- reinterpret_cast<UnicodeSet*>(gEmptyUnicodeSet)->freeze();
- gEmptyUnicodeSetInitialized = TRUE;
-
- // These sets were decided after discussion with icu-design@. See tickets #13084 and #13309.
- // Zs+TAB is "horizontal whitespace" according to UTS #18 (blank property).
- gUnicodeSets[DEFAULT_IGNORABLES] = new UnicodeSet(
- u"[[:Zs:][\\u0009][:Bidi_Control:][:Variation_Selector:]]", status);
- gUnicodeSets[STRICT_IGNORABLES] = new UnicodeSet(u"[[:Bidi_Control:]]", status);
-
- LocalUResourceBundlePointer rb(ures_open(nullptr, "root", &status));
- if (U_FAILURE(status)) { return; }
- ParseDataSink sink;
- ures_getAllItemsWithFallback(rb.getAlias(), "parse", sink, status);
- if (U_FAILURE(status)) { return; }
-
- // NOTE: It is OK for these assertions to fail if there was a no-data build.
- U_ASSERT(gUnicodeSets[COMMA] != nullptr);
- U_ASSERT(gUnicodeSets[STRICT_COMMA] != nullptr);
- U_ASSERT(gUnicodeSets[PERIOD] != nullptr);
- U_ASSERT(gUnicodeSets[STRICT_PERIOD] != nullptr);
- U_ASSERT(gUnicodeSets[APOSTROPHE_SIGN] != nullptr);
-
- LocalPointer<UnicodeSet> otherGrouping(new UnicodeSet(
- u"[٬‘\\u0020\\u00A0\\u2000-\\u200A\\u202F\\u205F\\u3000]",
- status
- ), status);
- if (U_FAILURE(status)) { return; }
- otherGrouping->addAll(*gUnicodeSets[APOSTROPHE_SIGN]);
- gUnicodeSets[OTHER_GROUPING_SEPARATORS] = otherGrouping.orphan();
- gUnicodeSets[ALL_SEPARATORS] = computeUnion(COMMA, PERIOD, OTHER_GROUPING_SEPARATORS);
- gUnicodeSets[STRICT_ALL_SEPARATORS] = computeUnion(
- STRICT_COMMA, STRICT_PERIOD, OTHER_GROUPING_SEPARATORS);
-
- U_ASSERT(gUnicodeSets[MINUS_SIGN] != nullptr);
- U_ASSERT(gUnicodeSets[PLUS_SIGN] != nullptr);
- U_ASSERT(gUnicodeSets[PERCENT_SIGN] != nullptr);
- U_ASSERT(gUnicodeSets[PERMILLE_SIGN] != nullptr);
-
- gUnicodeSets[INFINITY_SIGN] = new UnicodeSet(u"[∞]", status);
- if (U_FAILURE(status)) { return; }
-
- U_ASSERT(gUnicodeSets[DOLLAR_SIGN] != nullptr);
- U_ASSERT(gUnicodeSets[POUND_SIGN] != nullptr);
- U_ASSERT(gUnicodeSets[RUPEE_SIGN] != nullptr);
- U_ASSERT(gUnicodeSets[YEN_SIGN] != nullptr);
- U_ASSERT(gUnicodeSets[WON_SIGN] != nullptr);
-
- gUnicodeSets[DIGITS] = new UnicodeSet(u"[:digit:]", status);
- if (U_FAILURE(status)) { return; }
- gUnicodeSets[DIGITS_OR_ALL_SEPARATORS] = computeUnion(DIGITS, ALL_SEPARATORS);
- gUnicodeSets[DIGITS_OR_STRICT_ALL_SEPARATORS] = computeUnion(DIGITS, STRICT_ALL_SEPARATORS);
-
- for (auto* uniset : gUnicodeSets) {
- if (uniset != nullptr) {
- uniset->freeze();
- }
- }
-}
-
-}
-
-const UnicodeSet* unisets::get(Key key) {
- UErrorCode localStatus = U_ZERO_ERROR;
- umtx_initOnce(gNumberParseUniSetsInitOnce, &initNumberParseUniSets, localStatus);
- if (U_FAILURE(localStatus)) {
- return reinterpret_cast<UnicodeSet*>(gEmptyUnicodeSet);
- }
- return getImpl(key);
-}
-
-Key unisets::chooseFrom(UnicodeString str, Key key1) {
- return get(key1)->contains(str) ? key1 : NONE;
-}
-
-Key unisets::chooseFrom(UnicodeString str, Key key1, Key key2) {
- return get(key1)->contains(str) ? key1 : chooseFrom(str, key2);
-}
-
-//Key unisets::chooseCurrency(UnicodeString str) {
-// if (get(DOLLAR_SIGN)->contains(str)) {
-// return DOLLAR_SIGN;
-// } else if (get(POUND_SIGN)->contains(str)) {
-// return POUND_SIGN;
-// } else if (get(RUPEE_SIGN)->contains(str)) {
-// return RUPEE_SIGN;
-// } else if (get(YEN_SIGN)->contains(str)) {
-// return YEN_SIGN;
-// } else {
-// return NONE;
-// }
-//}
-
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include "static_unicode_sets.h"
+#include "umutex.h"
+#include "ucln_cmn.h"
+#include "unicode/uniset.h"
+#include "uresimp.h"
+#include "cstring.h"
+#include "uassert.h"
+
+using namespace icu;
+using namespace icu::unisets;
+
+
+namespace {
+
+UnicodeSet* gUnicodeSets[UNISETS_KEY_COUNT] = {};
+
+// Save the empty instance in static memory to have well-defined behavior if a
+// regular UnicodeSet cannot be allocated.
+alignas(UnicodeSet)
+char gEmptyUnicodeSet[sizeof(UnicodeSet)];
+
+// Whether the gEmptyUnicodeSet is initialized and ready to use.
+UBool gEmptyUnicodeSetInitialized = FALSE;
+
+inline UnicodeSet* getImpl(Key key) {
+ UnicodeSet* candidate = gUnicodeSets[key];
+ if (candidate == nullptr) {
+ return reinterpret_cast<UnicodeSet*>(gEmptyUnicodeSet);
+ }
+ return candidate;
+}
+
+UnicodeSet* computeUnion(Key k1, Key k2) {
+ UnicodeSet* result = new UnicodeSet();
+ if (result == nullptr) {
+ return nullptr;
+ }
+ result->addAll(*getImpl(k1));
+ result->addAll(*getImpl(k2));
+ result->freeze();
+ return result;
+}
+
+UnicodeSet* computeUnion(Key k1, Key k2, Key k3) {
+ UnicodeSet* result = new UnicodeSet();
+ if (result == nullptr) {
+ return nullptr;
+ }
+ result->addAll(*getImpl(k1));
+ result->addAll(*getImpl(k2));
+ result->addAll(*getImpl(k3));
+ result->freeze();
+ return result;
+}
+
+
+void saveSet(Key key, const UnicodeString& unicodeSetPattern, UErrorCode& status) {
+ // assert unicodeSets.get(key) == null;
+ gUnicodeSets[key] = new UnicodeSet(unicodeSetPattern, status);
+}
+
+class ParseDataSink : public ResourceSink {
+ public:
+ void put(const char* key, ResourceValue& value, UBool /*noFallback*/, UErrorCode& status) U_OVERRIDE {
+ ResourceTable contextsTable = value.getTable(status);
+ if (U_FAILURE(status)) { return; }
+ for (int i = 0; contextsTable.getKeyAndValue(i, key, value); i++) {
+ if (uprv_strcmp(key, "date") == 0) {
+ // ignore
+ } else {
+ ResourceTable strictnessTable = value.getTable(status);
+ if (U_FAILURE(status)) { return; }
+ for (int j = 0; strictnessTable.getKeyAndValue(j, key, value); j++) {
+ bool isLenient = (uprv_strcmp(key, "lenient") == 0);
+ ResourceArray array = value.getArray(status);
+ if (U_FAILURE(status)) { return; }
+ for (int k = 0; k < array.getSize(); k++) {
+ array.getValue(k, value);
+ UnicodeString str = value.getUnicodeString(status);
+ if (U_FAILURE(status)) { return; }
+ // There is both lenient and strict data for comma/period,
+ // but not for any of the other symbols.
+ if (str.indexOf(u'.') != -1) {
+ saveSet(isLenient ? PERIOD : STRICT_PERIOD, str, status);
+ } else if (str.indexOf(u',') != -1) {
+ saveSet(isLenient ? COMMA : STRICT_COMMA, str, status);
+ } else if (str.indexOf(u'+') != -1) {
+ saveSet(PLUS_SIGN, str, status);
+ } else if (str.indexOf(u'-') != -1) {
+ saveSet(MINUS_SIGN, str, status);
+ } else if (str.indexOf(u'$') != -1) {
+ saveSet(DOLLAR_SIGN, str, status);
+ } else if (str.indexOf(u'£') != -1) {
+ saveSet(POUND_SIGN, str, status);
+ } else if (str.indexOf(u'₹') != -1) {
+ saveSet(RUPEE_SIGN, str, status);
+ } else if (str.indexOf(u'¥') != -1) {
+ saveSet(YEN_SIGN, str, status);
+ } else if (str.indexOf(u'₩') != -1) {
+ saveSet(WON_SIGN, str, status);
+ } else if (str.indexOf(u'%') != -1) {
+ saveSet(PERCENT_SIGN, str, status);
+ } else if (str.indexOf(u'‰') != -1) {
+ saveSet(PERMILLE_SIGN, str, status);
+ } else if (str.indexOf(u'’') != -1) {
+ saveSet(APOSTROPHE_SIGN, str, status);
+ } else {
+ // Unknown class of parse lenients
+ // TODO(ICU-20428): Make ICU automatically accept new classes?
+ U_ASSERT(FALSE);
+ }
+ if (U_FAILURE(status)) { return; }
+ }
+ }
+ }
+ }
+ }
+};
+
+
+icu::UInitOnce gNumberParseUniSetsInitOnce = U_INITONCE_INITIALIZER;
+
+UBool U_CALLCONV cleanupNumberParseUniSets() {
+ if (gEmptyUnicodeSetInitialized) {
+ reinterpret_cast<UnicodeSet*>(gEmptyUnicodeSet)->~UnicodeSet();
+ gEmptyUnicodeSetInitialized = FALSE;
+ }
+ for (int32_t i = 0; i < UNISETS_KEY_COUNT; i++) {
+ delete gUnicodeSets[i];
+ gUnicodeSets[i] = nullptr;
+ }
+ gNumberParseUniSetsInitOnce.reset();
+ return TRUE;
+}
+
+void U_CALLCONV initNumberParseUniSets(UErrorCode& status) {
+ ucln_common_registerCleanup(UCLN_COMMON_NUMPARSE_UNISETS, cleanupNumberParseUniSets);
+
+ // Initialize the empty instance for well-defined fallback behavior
+ new(gEmptyUnicodeSet) UnicodeSet();
+ reinterpret_cast<UnicodeSet*>(gEmptyUnicodeSet)->freeze();
+ gEmptyUnicodeSetInitialized = TRUE;
+
+ // These sets were decided after discussion with icu-design@. See tickets #13084 and #13309.
+ // Zs+TAB is "horizontal whitespace" according to UTS #18 (blank property).
+ gUnicodeSets[DEFAULT_IGNORABLES] = new UnicodeSet(
+ u"[[:Zs:][\\u0009][:Bidi_Control:][:Variation_Selector:]]", status);
+ gUnicodeSets[STRICT_IGNORABLES] = new UnicodeSet(u"[[:Bidi_Control:]]", status);
+
+ LocalUResourceBundlePointer rb(ures_open(nullptr, "root", &status));
+ if (U_FAILURE(status)) { return; }
+ ParseDataSink sink;
+ ures_getAllItemsWithFallback(rb.getAlias(), "parse", sink, status);
+ if (U_FAILURE(status)) { return; }
+
+ // NOTE: It is OK for these assertions to fail if there was a no-data build.
+ U_ASSERT(gUnicodeSets[COMMA] != nullptr);
+ U_ASSERT(gUnicodeSets[STRICT_COMMA] != nullptr);
+ U_ASSERT(gUnicodeSets[PERIOD] != nullptr);
+ U_ASSERT(gUnicodeSets[STRICT_PERIOD] != nullptr);
+ U_ASSERT(gUnicodeSets[APOSTROPHE_SIGN] != nullptr);
+
+ LocalPointer<UnicodeSet> otherGrouping(new UnicodeSet(
+ u"[٬‘\\u0020\\u00A0\\u2000-\\u200A\\u202F\\u205F\\u3000]",
+ status
+ ), status);
+ if (U_FAILURE(status)) { return; }
+ otherGrouping->addAll(*gUnicodeSets[APOSTROPHE_SIGN]);
+ gUnicodeSets[OTHER_GROUPING_SEPARATORS] = otherGrouping.orphan();
+ gUnicodeSets[ALL_SEPARATORS] = computeUnion(COMMA, PERIOD, OTHER_GROUPING_SEPARATORS);
+ gUnicodeSets[STRICT_ALL_SEPARATORS] = computeUnion(
+ STRICT_COMMA, STRICT_PERIOD, OTHER_GROUPING_SEPARATORS);
+
+ U_ASSERT(gUnicodeSets[MINUS_SIGN] != nullptr);
+ U_ASSERT(gUnicodeSets[PLUS_SIGN] != nullptr);
+ U_ASSERT(gUnicodeSets[PERCENT_SIGN] != nullptr);
+ U_ASSERT(gUnicodeSets[PERMILLE_SIGN] != nullptr);
+
+ gUnicodeSets[INFINITY_SIGN] = new UnicodeSet(u"[∞]", status);
+ if (U_FAILURE(status)) { return; }
+
+ U_ASSERT(gUnicodeSets[DOLLAR_SIGN] != nullptr);
+ U_ASSERT(gUnicodeSets[POUND_SIGN] != nullptr);
+ U_ASSERT(gUnicodeSets[RUPEE_SIGN] != nullptr);
+ U_ASSERT(gUnicodeSets[YEN_SIGN] != nullptr);
+ U_ASSERT(gUnicodeSets[WON_SIGN] != nullptr);
+
+ gUnicodeSets[DIGITS] = new UnicodeSet(u"[:digit:]", status);
+ if (U_FAILURE(status)) { return; }
+ gUnicodeSets[DIGITS_OR_ALL_SEPARATORS] = computeUnion(DIGITS, ALL_SEPARATORS);
+ gUnicodeSets[DIGITS_OR_STRICT_ALL_SEPARATORS] = computeUnion(DIGITS, STRICT_ALL_SEPARATORS);
+
+ for (auto* uniset : gUnicodeSets) {
+ if (uniset != nullptr) {
+ uniset->freeze();
+ }
+ }
+}
+
+}
+
+const UnicodeSet* unisets::get(Key key) {
+ UErrorCode localStatus = U_ZERO_ERROR;
+ umtx_initOnce(gNumberParseUniSetsInitOnce, &initNumberParseUniSets, localStatus);
+ if (U_FAILURE(localStatus)) {
+ return reinterpret_cast<UnicodeSet*>(gEmptyUnicodeSet);
+ }
+ return getImpl(key);
+}
+
+Key unisets::chooseFrom(UnicodeString str, Key key1) {
+ return get(key1)->contains(str) ? key1 : NONE;
+}
+
+Key unisets::chooseFrom(UnicodeString str, Key key1, Key key2) {
+ return get(key1)->contains(str) ? key1 : chooseFrom(str, key2);
+}
+
+//Key unisets::chooseCurrency(UnicodeString str) {
+// if (get(DOLLAR_SIGN)->contains(str)) {
+// return DOLLAR_SIGN;
+// } else if (get(POUND_SIGN)->contains(str)) {
+// return POUND_SIGN;
+// } else if (get(RUPEE_SIGN)->contains(str)) {
+// return RUPEE_SIGN;
+// } else if (get(YEN_SIGN)->contains(str)) {
+// return YEN_SIGN;
+// } else {
+// return NONE;
+// }
+//}
+
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/common/static_unicode_sets.h b/contrib/libs/icu/common/static_unicode_sets.h
index b636710877..5d90ce5908 100644
--- a/contrib/libs/icu/common/static_unicode_sets.h
+++ b/contrib/libs/icu/common/static_unicode_sets.h
@@ -1,140 +1,140 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// This file contains utilities to deal with static-allocated UnicodeSets.
-//
-// Common use case: you write a "private static final" UnicodeSet in Java, and
-// want something similarly easy in C++. Originally written for number
-// parsing, but this header can be used for other applications.
-//
-// Main entrypoint: `unisets::get(unisets::MY_SET_ID_HERE)`
-//
-// This file is in common instead of i18n because it is needed by ucurr.cpp.
-//
-// Author: sffc
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __STATIC_UNICODE_SETS_H__
-#define __STATIC_UNICODE_SETS_H__
-
-#include "unicode/uniset.h"
-#include "unicode/unistr.h"
-
-U_NAMESPACE_BEGIN
-namespace unisets {
-
-enum Key {
- // NONE is used to indicate null in chooseFrom().
- // EMPTY is used to get an empty UnicodeSet.
- NONE = -1,
- EMPTY = 0,
-
- // Ignorables
- DEFAULT_IGNORABLES,
- STRICT_IGNORABLES,
-
- // Separators
- // Notes:
- // - COMMA is a superset of STRICT_COMMA
- // - PERIOD is a superset of SCRICT_PERIOD
- // - ALL_SEPARATORS is the union of COMMA, PERIOD, and OTHER_GROUPING_SEPARATORS
- // - STRICT_ALL_SEPARATORS is the union of STRICT_COMMA, STRICT_PERIOD, and OTHER_GRP_SEPARATORS
- COMMA,
- PERIOD,
- STRICT_COMMA,
- STRICT_PERIOD,
- APOSTROPHE_SIGN,
- OTHER_GROUPING_SEPARATORS,
- ALL_SEPARATORS,
- STRICT_ALL_SEPARATORS,
-
- // Symbols
- MINUS_SIGN,
- PLUS_SIGN,
- PERCENT_SIGN,
- PERMILLE_SIGN,
- INFINITY_SIGN,
-
- // Currency Symbols
- DOLLAR_SIGN,
- POUND_SIGN,
- RUPEE_SIGN,
- YEN_SIGN,
- WON_SIGN,
-
- // Other
- DIGITS,
-
- // Combined Separators with Digits (for lead code points)
- DIGITS_OR_ALL_SEPARATORS,
- DIGITS_OR_STRICT_ALL_SEPARATORS,
-
- // The number of elements in the enum.
- UNISETS_KEY_COUNT
-};
-
-/**
- * Gets the static-allocated UnicodeSet according to the provided key. The
- * pointer will be deleted during u_cleanup(); the caller should NOT delete it.
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// This file contains utilities to deal with static-allocated UnicodeSets.
+//
+// Common use case: you write a "private static final" UnicodeSet in Java, and
+// want something similarly easy in C++. Originally written for number
+// parsing, but this header can be used for other applications.
+//
+// Main entrypoint: `unisets::get(unisets::MY_SET_ID_HERE)`
+//
+// This file is in common instead of i18n because it is needed by ucurr.cpp.
+//
+// Author: sffc
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __STATIC_UNICODE_SETS_H__
+#define __STATIC_UNICODE_SETS_H__
+
+#include "unicode/uniset.h"
+#include "unicode/unistr.h"
+
+U_NAMESPACE_BEGIN
+namespace unisets {
+
+enum Key {
+ // NONE is used to indicate null in chooseFrom().
+ // EMPTY is used to get an empty UnicodeSet.
+ NONE = -1,
+ EMPTY = 0,
+
+ // Ignorables
+ DEFAULT_IGNORABLES,
+ STRICT_IGNORABLES,
+
+ // Separators
+ // Notes:
+ // - COMMA is a superset of STRICT_COMMA
+ // - PERIOD is a superset of SCRICT_PERIOD
+ // - ALL_SEPARATORS is the union of COMMA, PERIOD, and OTHER_GROUPING_SEPARATORS
+ // - STRICT_ALL_SEPARATORS is the union of STRICT_COMMA, STRICT_PERIOD, and OTHER_GRP_SEPARATORS
+ COMMA,
+ PERIOD,
+ STRICT_COMMA,
+ STRICT_PERIOD,
+ APOSTROPHE_SIGN,
+ OTHER_GROUPING_SEPARATORS,
+ ALL_SEPARATORS,
+ STRICT_ALL_SEPARATORS,
+
+ // Symbols
+ MINUS_SIGN,
+ PLUS_SIGN,
+ PERCENT_SIGN,
+ PERMILLE_SIGN,
+ INFINITY_SIGN,
+
+ // Currency Symbols
+ DOLLAR_SIGN,
+ POUND_SIGN,
+ RUPEE_SIGN,
+ YEN_SIGN,
+ WON_SIGN,
+
+ // Other
+ DIGITS,
+
+ // Combined Separators with Digits (for lead code points)
+ DIGITS_OR_ALL_SEPARATORS,
+ DIGITS_OR_STRICT_ALL_SEPARATORS,
+
+ // The number of elements in the enum.
+ UNISETS_KEY_COUNT
+};
+
+/**
+ * Gets the static-allocated UnicodeSet according to the provided key. The
+ * pointer will be deleted during u_cleanup(); the caller should NOT delete it.
+ *
+ * Exported as U_COMMON_API for ucurr.cpp
+ *
+ * This method is always safe and OK to chain: in the case of a memory or other
+ * error, it returns an empty set from static memory.
*
- * Exported as U_COMMON_API for ucurr.cpp
+ * Example:
*
- * This method is always safe and OK to chain: in the case of a memory or other
- * error, it returns an empty set from static memory.
- *
- * Example:
- *
- * UBool hasIgnorables = unisets::get(unisets::DEFAULT_IGNORABLES)->contains(...);
- *
- * @param key The desired UnicodeSet according to the enum in this file.
- * @return The requested UnicodeSet. Guaranteed to be frozen and non-null, but
- * may be empty if an error occurred during data loading.
- */
-U_COMMON_API const UnicodeSet* get(Key key);
-
-/**
- * Checks if the UnicodeSet given by key1 contains the given string.
- *
- * Exported as U_COMMON_API for numparse_decimal.cpp
- *
- * @param str The string to check.
- * @param key1 The set to check.
- * @return key1 if the set contains str, or NONE if not.
- */
-U_COMMON_API Key chooseFrom(UnicodeString str, Key key1);
-
-/**
- * Checks if the UnicodeSet given by either key1 or key2 contains the string.
- *
- * Exported as U_COMMON_API for numparse_decimal.cpp
- *
- * @param str The string to check.
- * @param key1 The first set to check.
- * @param key2 The second set to check.
- * @return key1 if that set contains str; key2 if that set contains str; or
- * NONE if neither set contains str.
- */
-U_COMMON_API Key chooseFrom(UnicodeString str, Key key1, Key key2);
-
-// TODO: Load these from data: ICU-20108
-// Unused in C++:
-// Key chooseCurrency(UnicodeString str);
-// Used instead:
-static const struct {
- Key key;
- UChar32 exemplar;
-} kCurrencyEntries[] = {
- {DOLLAR_SIGN, u'$'},
- {POUND_SIGN, u'£'},
- {RUPEE_SIGN, u'₹'},
- {YEN_SIGN, u'¥'},
- {WON_SIGN, u'₩'},
-};
-
-} // namespace unisets
-U_NAMESPACE_END
-
-#endif //__STATIC_UNICODE_SETS_H__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+ * UBool hasIgnorables = unisets::get(unisets::DEFAULT_IGNORABLES)->contains(...);
+ *
+ * @param key The desired UnicodeSet according to the enum in this file.
+ * @return The requested UnicodeSet. Guaranteed to be frozen and non-null, but
+ * may be empty if an error occurred during data loading.
+ */
+U_COMMON_API const UnicodeSet* get(Key key);
+
+/**
+ * Checks if the UnicodeSet given by key1 contains the given string.
+ *
+ * Exported as U_COMMON_API for numparse_decimal.cpp
+ *
+ * @param str The string to check.
+ * @param key1 The set to check.
+ * @return key1 if the set contains str, or NONE if not.
+ */
+U_COMMON_API Key chooseFrom(UnicodeString str, Key key1);
+
+/**
+ * Checks if the UnicodeSet given by either key1 or key2 contains the string.
+ *
+ * Exported as U_COMMON_API for numparse_decimal.cpp
+ *
+ * @param str The string to check.
+ * @param key1 The first set to check.
+ * @param key2 The second set to check.
+ * @return key1 if that set contains str; key2 if that set contains str; or
+ * NONE if neither set contains str.
+ */
+U_COMMON_API Key chooseFrom(UnicodeString str, Key key1, Key key2);
+
+// TODO: Load these from data: ICU-20108
+// Unused in C++:
+// Key chooseCurrency(UnicodeString str);
+// Used instead:
+static const struct {
+ Key key;
+ UChar32 exemplar;
+} kCurrencyEntries[] = {
+ {DOLLAR_SIGN, u'$'},
+ {POUND_SIGN, u'£'},
+ {RUPEE_SIGN, u'₹'},
+ {YEN_SIGN, u'¥'},
+ {WON_SIGN, u'₩'},
+};
+
+} // namespace unisets
+U_NAMESPACE_END
+
+#endif //__STATIC_UNICODE_SETS_H__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/common/stringpiece.cpp b/contrib/libs/icu/common/stringpiece.cpp
index f7fe552078..99089e08ef 100644
--- a/contrib/libs/icu/common/stringpiece.cpp
+++ b/contrib/libs/icu/common/stringpiece.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
// Copyright (C) 2009-2013, International Business Machines
// Corporation and others. All Rights Reserved.
@@ -51,47 +51,47 @@ void StringPiece::set(const char* str) {
length_ = 0;
}
-int32_t StringPiece::find(StringPiece needle, int32_t offset) {
- if (length() == 0 && needle.length() == 0) {
- return 0;
- }
- // TODO: Improve to be better than O(N^2)?
- for (int32_t i = offset; i < length(); i++) {
- int32_t j = 0;
- for (; j < needle.length(); i++, j++) {
- if (data()[i] != needle.data()[j]) {
- i -= j;
- goto outer_end;
- }
- }
- return i - j;
- outer_end: void();
- }
- return -1;
-}
-
-int32_t StringPiece::compare(StringPiece other) {
- int32_t i = 0;
- for (; i < length(); i++) {
- if (i == other.length()) {
- // this is longer
- return 1;
- }
- char a = data()[i];
- char b = other.data()[i];
- if (a < b) {
- return -1;
- } else if (a > b) {
- return 1;
- }
- }
- if (i < other.length()) {
- // other is longer
- return -1;
- }
- return 0;
-}
-
+int32_t StringPiece::find(StringPiece needle, int32_t offset) {
+ if (length() == 0 && needle.length() == 0) {
+ return 0;
+ }
+ // TODO: Improve to be better than O(N^2)?
+ for (int32_t i = offset; i < length(); i++) {
+ int32_t j = 0;
+ for (; j < needle.length(); i++, j++) {
+ if (data()[i] != needle.data()[j]) {
+ i -= j;
+ goto outer_end;
+ }
+ }
+ return i - j;
+ outer_end: void();
+ }
+ return -1;
+}
+
+int32_t StringPiece::compare(StringPiece other) {
+ int32_t i = 0;
+ for (; i < length(); i++) {
+ if (i == other.length()) {
+ // this is longer
+ return 1;
+ }
+ char a = data()[i];
+ char b = other.data()[i];
+ if (a < b) {
+ return -1;
+ } else if (a > b) {
+ return 1;
+ }
+ }
+ if (i < other.length()) {
+ // other is longer
+ return -1;
+ }
+ return 0;
+}
+
U_EXPORT UBool U_EXPORT2
operator==(const StringPiece& x, const StringPiece& y) {
int32_t len = x.size();
diff --git a/contrib/libs/icu/common/stringtriebuilder.cpp b/contrib/libs/icu/common/stringtriebuilder.cpp
index 95b3825c5e..6f9cc2e5c2 100644
--- a/contrib/libs/icu/common/stringtriebuilder.cpp
+++ b/contrib/libs/icu/common/stringtriebuilder.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: stringtriebuilder.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -373,7 +373,7 @@ StringTrieBuilder::registerFinalValue(int32_t value, UErrorCode &errorCode) {
return newNode;
}
-int32_t
+int32_t
StringTrieBuilder::hashNode(const void *node) {
return ((const Node *)node)->hashCode();
}
diff --git a/contrib/libs/icu/common/uarrsort.cpp b/contrib/libs/icu/common/uarrsort.cpp
index 1784779165..c17dbb2e2b 100644
--- a/contrib/libs/icu/common/uarrsort.cpp
+++ b/contrib/libs/icu/common/uarrsort.cpp
@@ -1,274 +1,274 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-*******************************************************************************
-*
-* Copyright (C) 2003-2013, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-*******************************************************************************
-* file name: uarrsort.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 2003aug04
-* created by: Markus W. Scherer
-*
-* Internal function for sorting arrays.
-*/
-
-#include <cstddef>
-
-#include "unicode/utypes.h"
-#include "cmemory.h"
-#include "uarrsort.h"
-
-enum {
- /**
- * "from Knuth"
- *
- * A binary search over 8 items performs 4 comparisons:
- * log2(8)=3 to subdivide, +1 to check for equality.
- * A linear search over 8 items on average also performs 4 comparisons.
- */
- MIN_QSORT=9,
- STACK_ITEM_SIZE=200
-};
-
-static constexpr int32_t sizeInMaxAlignTs(int32_t sizeInBytes) {
- return (sizeInBytes + sizeof(std::max_align_t) - 1) / sizeof(std::max_align_t);
-}
-
-/* UComparator convenience implementations ---------------------------------- */
-
-U_CAPI int32_t U_EXPORT2
-uprv_uint16Comparator(const void *context, const void *left, const void *right) {
- (void)context;
- return (int32_t)*(const uint16_t *)left - (int32_t)*(const uint16_t *)right;
-}
-
-U_CAPI int32_t U_EXPORT2
-uprv_int32Comparator(const void *context, const void *left, const void *right) {
- (void)context;
- return *(const int32_t *)left - *(const int32_t *)right;
-}
-
-U_CAPI int32_t U_EXPORT2
-uprv_uint32Comparator(const void *context, const void *left, const void *right) {
- (void)context;
- uint32_t l=*(const uint32_t *)left, r=*(const uint32_t *)right;
-
- /* compare directly because (l-r) would overflow the int32_t result */
- if(l<r) {
- return -1;
- } else if(l==r) {
- return 0;
- } else /* l>r */ {
- return 1;
- }
-}
-
-/* Insertion sort using binary search --------------------------------------- */
-
-U_CAPI int32_t U_EXPORT2
-uprv_stableBinarySearch(char *array, int32_t limit, void *item, int32_t itemSize,
- UComparator *cmp, const void *context) {
- int32_t start=0;
- UBool found=FALSE;
-
- /* Binary search until we get down to a tiny sub-array. */
- while((limit-start)>=MIN_QSORT) {
- int32_t i=(start+limit)/2;
- int32_t diff=cmp(context, item, array+i*itemSize);
- if(diff==0) {
- /*
- * Found the item. We look for the *last* occurrence of such
- * an item, for stable sorting.
- * If we knew that there will be only few equal items,
- * we could break now and enter the linear search.
- * However, if there are many equal items, then it should be
- * faster to continue with the binary search.
- * It seems likely that we either have all unique items
- * (where found will never become TRUE in the insertion sort)
- * or potentially many duplicates.
- */
- found=TRUE;
- start=i+1;
- } else if(diff<0) {
- limit=i;
- } else {
- start=i;
- }
- }
-
- /* Linear search over the remaining tiny sub-array. */
- while(start<limit) {
- int32_t diff=cmp(context, item, array+start*itemSize);
- if(diff==0) {
- found=TRUE;
- } else if(diff<0) {
- break;
- }
- ++start;
- }
- return found ? (start-1) : ~start;
-}
-
-static void
-doInsertionSort(char *array, int32_t length, int32_t itemSize,
- UComparator *cmp, const void *context, void *pv) {
- int32_t j;
-
- for(j=1; j<length; ++j) {
- char *item=array+j*itemSize;
- int32_t insertionPoint=uprv_stableBinarySearch(array, j, item, itemSize, cmp, context);
- if(insertionPoint<0) {
- insertionPoint=~insertionPoint;
- } else {
- ++insertionPoint; /* one past the last equal item */
- }
- if(insertionPoint<j) {
- char *dest=array+insertionPoint*itemSize;
- uprv_memcpy(pv, item, itemSize); /* v=array[j] */
- uprv_memmove(dest+itemSize, dest, (j-insertionPoint)*(size_t)itemSize);
- uprv_memcpy(dest, pv, itemSize); /* array[insertionPoint]=v */
- }
- }
-}
-
-static void
-insertionSort(char *array, int32_t length, int32_t itemSize,
- UComparator *cmp, const void *context, UErrorCode *pErrorCode) {
-
- icu::MaybeStackArray<std::max_align_t, sizeInMaxAlignTs(STACK_ITEM_SIZE)> v;
- if (sizeInMaxAlignTs(itemSize) > v.getCapacity() &&
- v.resize(sizeInMaxAlignTs(itemSize)) == nullptr) {
- *pErrorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
-
- doInsertionSort(array, length, itemSize, cmp, context, v.getAlias());
-}
-
-/* QuickSort ---------------------------------------------------------------- */
-
-/*
- * This implementation is semi-recursive:
- * It recurses for the smaller sub-array to shorten the recursion depth,
- * and loops for the larger sub-array.
- *
- * Loosely after QuickSort algorithms in
- * Niklaus Wirth
- * Algorithmen und Datenstrukturen mit Modula-2
- * B.G. Teubner Stuttgart
- * 4. Auflage 1986
- * ISBN 3-519-02260-5
- */
-static void
-subQuickSort(char *array, int32_t start, int32_t limit, int32_t itemSize,
- UComparator *cmp, const void *context,
- void *px, void *pw) {
- int32_t left, right;
-
- /* start and left are inclusive, limit and right are exclusive */
- do {
- if((start+MIN_QSORT)>=limit) {
- doInsertionSort(array+start*itemSize, limit-start, itemSize, cmp, context, px);
- break;
- }
-
- left=start;
- right=limit;
-
- /* x=array[middle] */
- uprv_memcpy(px, array+(size_t)((start+limit)/2)*itemSize, itemSize);
-
- do {
- while(/* array[left]<x */
- cmp(context, array+left*itemSize, px)<0
- ) {
- ++left;
- }
- while(/* x<array[right-1] */
- cmp(context, px, array+(right-1)*itemSize)<0
- ) {
- --right;
- }
-
- /* swap array[left] and array[right-1] via w; ++left; --right */
- if(left<right) {
- --right;
-
- if(left<right) {
- uprv_memcpy(pw, array+(size_t)left*itemSize, itemSize);
- uprv_memcpy(array+(size_t)left*itemSize, array+(size_t)right*itemSize, itemSize);
- uprv_memcpy(array+(size_t)right*itemSize, pw, itemSize);
- }
-
- ++left;
- }
- } while(left<right);
-
- /* sort sub-arrays */
- if((right-start)<(limit-left)) {
- /* sort [start..right[ */
- if(start<(right-1)) {
- subQuickSort(array, start, right, itemSize, cmp, context, px, pw);
- }
-
- /* sort [left..limit[ */
- start=left;
- } else {
- /* sort [left..limit[ */
- if(left<(limit-1)) {
- subQuickSort(array, left, limit, itemSize, cmp, context, px, pw);
- }
-
- /* sort [start..right[ */
- limit=right;
- }
- } while(start<(limit-1));
-}
-
-static void
-quickSort(char *array, int32_t length, int32_t itemSize,
- UComparator *cmp, const void *context, UErrorCode *pErrorCode) {
- /* allocate two intermediate item variables (x and w) */
- icu::MaybeStackArray<std::max_align_t, sizeInMaxAlignTs(STACK_ITEM_SIZE) * 2> xw;
- if(sizeInMaxAlignTs(itemSize)*2 > xw.getCapacity() &&
- xw.resize(sizeInMaxAlignTs(itemSize) * 2) == nullptr) {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return;
- }
-
- subQuickSort(array, 0, length, itemSize, cmp, context,
- xw.getAlias(), xw.getAlias() + sizeInMaxAlignTs(itemSize));
-}
-
-/* uprv_sortArray() API ----------------------------------------------------- */
-
-/*
- * Check arguments, select an appropriate implementation,
- * cast the array to char * so that array+i*itemSize works.
- */
-U_CAPI void U_EXPORT2
-uprv_sortArray(void *array, int32_t length, int32_t itemSize,
- UComparator *cmp, const void *context,
- UBool sortStable, UErrorCode *pErrorCode) {
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return;
- }
- if((length>0 && array==NULL) || length<0 || itemSize<=0 || cmp==NULL) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- if(length<=1) {
- return;
- } else if(length<MIN_QSORT || sortStable) {
- insertionSort((char *)array, length, itemSize, cmp, context, pErrorCode);
- } else {
- quickSort((char *)array, length, itemSize, cmp, context, pErrorCode);
- }
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+* Copyright (C) 2003-2013, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: uarrsort.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2003aug04
+* created by: Markus W. Scherer
+*
+* Internal function for sorting arrays.
+*/
+
+#include <cstddef>
+
+#include "unicode/utypes.h"
+#include "cmemory.h"
+#include "uarrsort.h"
+
+enum {
+ /**
+ * "from Knuth"
+ *
+ * A binary search over 8 items performs 4 comparisons:
+ * log2(8)=3 to subdivide, +1 to check for equality.
+ * A linear search over 8 items on average also performs 4 comparisons.
+ */
+ MIN_QSORT=9,
+ STACK_ITEM_SIZE=200
+};
+
+static constexpr int32_t sizeInMaxAlignTs(int32_t sizeInBytes) {
+ return (sizeInBytes + sizeof(std::max_align_t) - 1) / sizeof(std::max_align_t);
+}
+
+/* UComparator convenience implementations ---------------------------------- */
+
+U_CAPI int32_t U_EXPORT2
+uprv_uint16Comparator(const void *context, const void *left, const void *right) {
+ (void)context;
+ return (int32_t)*(const uint16_t *)left - (int32_t)*(const uint16_t *)right;
+}
+
+U_CAPI int32_t U_EXPORT2
+uprv_int32Comparator(const void *context, const void *left, const void *right) {
+ (void)context;
+ return *(const int32_t *)left - *(const int32_t *)right;
+}
+
+U_CAPI int32_t U_EXPORT2
+uprv_uint32Comparator(const void *context, const void *left, const void *right) {
+ (void)context;
+ uint32_t l=*(const uint32_t *)left, r=*(const uint32_t *)right;
+
+ /* compare directly because (l-r) would overflow the int32_t result */
+ if(l<r) {
+ return -1;
+ } else if(l==r) {
+ return 0;
+ } else /* l>r */ {
+ return 1;
+ }
+}
+
+/* Insertion sort using binary search --------------------------------------- */
+
+U_CAPI int32_t U_EXPORT2
+uprv_stableBinarySearch(char *array, int32_t limit, void *item, int32_t itemSize,
+ UComparator *cmp, const void *context) {
+ int32_t start=0;
+ UBool found=FALSE;
+
+ /* Binary search until we get down to a tiny sub-array. */
+ while((limit-start)>=MIN_QSORT) {
+ int32_t i=(start+limit)/2;
+ int32_t diff=cmp(context, item, array+i*itemSize);
+ if(diff==0) {
+ /*
+ * Found the item. We look for the *last* occurrence of such
+ * an item, for stable sorting.
+ * If we knew that there will be only few equal items,
+ * we could break now and enter the linear search.
+ * However, if there are many equal items, then it should be
+ * faster to continue with the binary search.
+ * It seems likely that we either have all unique items
+ * (where found will never become TRUE in the insertion sort)
+ * or potentially many duplicates.
+ */
+ found=TRUE;
+ start=i+1;
+ } else if(diff<0) {
+ limit=i;
+ } else {
+ start=i;
+ }
+ }
+
+ /* Linear search over the remaining tiny sub-array. */
+ while(start<limit) {
+ int32_t diff=cmp(context, item, array+start*itemSize);
+ if(diff==0) {
+ found=TRUE;
+ } else if(diff<0) {
+ break;
+ }
+ ++start;
+ }
+ return found ? (start-1) : ~start;
+}
+
+static void
+doInsertionSort(char *array, int32_t length, int32_t itemSize,
+ UComparator *cmp, const void *context, void *pv) {
+ int32_t j;
+
+ for(j=1; j<length; ++j) {
+ char *item=array+j*itemSize;
+ int32_t insertionPoint=uprv_stableBinarySearch(array, j, item, itemSize, cmp, context);
+ if(insertionPoint<0) {
+ insertionPoint=~insertionPoint;
+ } else {
+ ++insertionPoint; /* one past the last equal item */
+ }
+ if(insertionPoint<j) {
+ char *dest=array+insertionPoint*itemSize;
+ uprv_memcpy(pv, item, itemSize); /* v=array[j] */
+ uprv_memmove(dest+itemSize, dest, (j-insertionPoint)*(size_t)itemSize);
+ uprv_memcpy(dest, pv, itemSize); /* array[insertionPoint]=v */
+ }
+ }
+}
+
+static void
+insertionSort(char *array, int32_t length, int32_t itemSize,
+ UComparator *cmp, const void *context, UErrorCode *pErrorCode) {
+
+ icu::MaybeStackArray<std::max_align_t, sizeInMaxAlignTs(STACK_ITEM_SIZE)> v;
+ if (sizeInMaxAlignTs(itemSize) > v.getCapacity() &&
+ v.resize(sizeInMaxAlignTs(itemSize)) == nullptr) {
+ *pErrorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+
+ doInsertionSort(array, length, itemSize, cmp, context, v.getAlias());
+}
+
+/* QuickSort ---------------------------------------------------------------- */
+
+/*
+ * This implementation is semi-recursive:
+ * It recurses for the smaller sub-array to shorten the recursion depth,
+ * and loops for the larger sub-array.
+ *
+ * Loosely after QuickSort algorithms in
+ * Niklaus Wirth
+ * Algorithmen und Datenstrukturen mit Modula-2
+ * B.G. Teubner Stuttgart
+ * 4. Auflage 1986
+ * ISBN 3-519-02260-5
+ */
+static void
+subQuickSort(char *array, int32_t start, int32_t limit, int32_t itemSize,
+ UComparator *cmp, const void *context,
+ void *px, void *pw) {
+ int32_t left, right;
+
+ /* start and left are inclusive, limit and right are exclusive */
+ do {
+ if((start+MIN_QSORT)>=limit) {
+ doInsertionSort(array+start*itemSize, limit-start, itemSize, cmp, context, px);
+ break;
+ }
+
+ left=start;
+ right=limit;
+
+ /* x=array[middle] */
+ uprv_memcpy(px, array+(size_t)((start+limit)/2)*itemSize, itemSize);
+
+ do {
+ while(/* array[left]<x */
+ cmp(context, array+left*itemSize, px)<0
+ ) {
+ ++left;
+ }
+ while(/* x<array[right-1] */
+ cmp(context, px, array+(right-1)*itemSize)<0
+ ) {
+ --right;
+ }
+
+ /* swap array[left] and array[right-1] via w; ++left; --right */
+ if(left<right) {
+ --right;
+
+ if(left<right) {
+ uprv_memcpy(pw, array+(size_t)left*itemSize, itemSize);
+ uprv_memcpy(array+(size_t)left*itemSize, array+(size_t)right*itemSize, itemSize);
+ uprv_memcpy(array+(size_t)right*itemSize, pw, itemSize);
+ }
+
+ ++left;
+ }
+ } while(left<right);
+
+ /* sort sub-arrays */
+ if((right-start)<(limit-left)) {
+ /* sort [start..right[ */
+ if(start<(right-1)) {
+ subQuickSort(array, start, right, itemSize, cmp, context, px, pw);
+ }
+
+ /* sort [left..limit[ */
+ start=left;
+ } else {
+ /* sort [left..limit[ */
+ if(left<(limit-1)) {
+ subQuickSort(array, left, limit, itemSize, cmp, context, px, pw);
+ }
+
+ /* sort [start..right[ */
+ limit=right;
+ }
+ } while(start<(limit-1));
+}
+
+static void
+quickSort(char *array, int32_t length, int32_t itemSize,
+ UComparator *cmp, const void *context, UErrorCode *pErrorCode) {
+ /* allocate two intermediate item variables (x and w) */
+ icu::MaybeStackArray<std::max_align_t, sizeInMaxAlignTs(STACK_ITEM_SIZE) * 2> xw;
+ if(sizeInMaxAlignTs(itemSize)*2 > xw.getCapacity() &&
+ xw.resize(sizeInMaxAlignTs(itemSize) * 2) == nullptr) {
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+
+ subQuickSort(array, 0, length, itemSize, cmp, context,
+ xw.getAlias(), xw.getAlias() + sizeInMaxAlignTs(itemSize));
+}
+
+/* uprv_sortArray() API ----------------------------------------------------- */
+
+/*
+ * Check arguments, select an appropriate implementation,
+ * cast the array to char * so that array+i*itemSize works.
+ */
+U_CAPI void U_EXPORT2
+uprv_sortArray(void *array, int32_t length, int32_t itemSize,
+ UComparator *cmp, const void *context,
+ UBool sortStable, UErrorCode *pErrorCode) {
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return;
+ }
+ if((length>0 && array==NULL) || length<0 || itemSize<=0 || cmp==NULL) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ if(length<=1) {
+ return;
+ } else if(length<MIN_QSORT || sortStable) {
+ insertionSort((char *)array, length, itemSize, cmp, context, pErrorCode);
+ } else {
+ quickSort((char *)array, length, itemSize, cmp, context, pErrorCode);
+ }
+}
diff --git a/contrib/libs/icu/common/uarrsort.h b/contrib/libs/icu/common/uarrsort.h
index 695ff44124..a55dca5b9e 100644
--- a/contrib/libs/icu/common/uarrsort.h
+++ b/contrib/libs/icu/common/uarrsort.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: uarrsort.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/uassert.h b/contrib/libs/icu/common/uassert.h
index d038bacc59..15cd55c873 100644
--- a/contrib/libs/icu/common/uassert.h
+++ b/contrib/libs/icu/common/uassert.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -10,42 +10,42 @@
*
* File uassert.h
*
-* Contains the U_ASSERT and UPRV_UNREACHABLE macros
+* Contains the U_ASSERT and UPRV_UNREACHABLE macros
*
******************************************************************************
*/
#ifndef U_ASSERT_H
#define U_ASSERT_H
-
+
/* utypes.h is included to get the proper define for uint8_t */
#include "unicode/utypes.h"
-/* for abort */
-#include <stdlib.h>
-
-/**
- * \def U_ASSERT
- * By default, U_ASSERT just wraps the C library assert macro.
- * By changing the definition here, the assert behavior for ICU can be changed
- * without affecting other non - ICU uses of the C library assert().
-*/
+/* for abort */
+#include <stdlib.h>
+
+/**
+ * \def U_ASSERT
+ * By default, U_ASSERT just wraps the C library assert macro.
+ * By changing the definition here, the assert behavior for ICU can be changed
+ * without affecting other non - ICU uses of the C library assert().
+*/
#if U_DEBUG
# include <assert.h>
# define U_ASSERT(exp) assert(exp)
-#elif U_CPLUSPLUS_VERSION
-# define U_ASSERT(exp) void()
+#elif U_CPLUSPLUS_VERSION
+# define U_ASSERT(exp) void()
#else
# define U_ASSERT(exp)
#endif
-
-/**
- * \def UPRV_UNREACHABLE
- * This macro is used to unconditionally abort if unreachable code is ever executed.
- * @internal
-*/
-#if defined(UPRV_UNREACHABLE)
- // Use the predefined value.
-#else
-# define UPRV_UNREACHABLE abort()
+
+/**
+ * \def UPRV_UNREACHABLE
+ * This macro is used to unconditionally abort if unreachable code is ever executed.
+ * @internal
+*/
+#if defined(UPRV_UNREACHABLE)
+ // Use the predefined value.
+#else
+# define UPRV_UNREACHABLE abort()
#endif
-#endif
+#endif
diff --git a/contrib/libs/icu/common/ubidi.cpp b/contrib/libs/icu/common/ubidi.cpp
index 9dbdc7d52b..3ddb45721e 100644
--- a/contrib/libs/icu/common/ubidi.cpp
+++ b/contrib/libs/icu/common/ubidi.cpp
@@ -1,3036 +1,3036 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 1999-2015, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-* file name: ubidi.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 1999jul27
-* created by: Markus W. Scherer, updated by Matitiahu Allouche
-*
-*/
-
-#include "cmemory.h"
-#include "unicode/utypes.h"
-#include "unicode/ustring.h"
-#include "unicode/uchar.h"
-#include "unicode/ubidi.h"
-#include "unicode/utf16.h"
-#include "ubidi_props.h"
-#include "ubidiimp.h"
-#include "uassert.h"
-
-/*
- * General implementation notes:
- *
- * Throughout the implementation, there are comments like (W2) that refer to
- * rules of the BiDi algorithm, in this example to the second rule of the
- * resolution of weak types.
- *
- * For handling surrogate pairs, where two UChar's form one "abstract" (or UTF-32)
- * character according to UTF-16, the second UChar gets the directional property of
- * the entire character assigned, while the first one gets a BN, a boundary
- * neutral, type, which is ignored by most of the algorithm according to
- * rule (X9) and the implementation suggestions of the BiDi algorithm.
- *
- * Later, adjustWSLevels() will set the level for each BN to that of the
- * following character (UChar), which results in surrogate pairs getting the
- * same level on each of their surrogates.
- *
- * In a UTF-8 implementation, the same thing could be done: the last byte of
- * a multi-byte sequence would get the "real" property, while all previous
- * bytes of that sequence would get BN.
- *
- * It is not possible to assign all those parts of a character the same real
- * property because this would fail in the resolution of weak types with rules
- * that look at immediately surrounding types.
- *
- * As a related topic, this implementation does not remove Boundary Neutral
- * types from the input, but ignores them wherever this is relevant.
- * For example, the loop for the resolution of the weak types reads
- * types until it finds a non-BN.
- * Also, explicit embedding codes are neither changed into BN nor removed.
- * They are only treated the same way real BNs are.
- * As stated before, adjustWSLevels() takes care of them at the end.
- * For the purpose of conformance, the levels of all these codes
- * do not matter.
- *
- * Note that this implementation modifies the dirProps
- * after the initial setup, when applying X5c (replace FSI by LRI or RLI),
- * X6, N0 (replace paired brackets by L or R).
- *
- * In this implementation, the resolution of weak types (W1 to W6),
- * neutrals (N1 and N2), and the assignment of the resolved level (In)
- * are all done in one single loop, in resolveImplicitLevels().
- * Changes of dirProp values are done on the fly, without writing
- * them back to the dirProps array.
- *
- *
- * This implementation contains code that allows to bypass steps of the
- * algorithm that are not needed on the specific paragraph
- * in order to speed up the most common cases considerably,
- * like text that is entirely LTR, or RTL text without numbers.
- *
- * Most of this is done by setting a bit for each directional property
- * in a flags variable and later checking for whether there are
- * any LTR characters or any RTL characters, or both, whether
- * there are any explicit embedding codes, etc.
- *
- * If the (Xn) steps are performed, then the flags are re-evaluated,
- * because they will then not contain the embedding codes any more
- * and will be adjusted for override codes, so that subsequently
- * more bypassing may be possible than what the initial flags suggested.
- *
- * If the text is not mixed-directional, then the
- * algorithm steps for the weak type resolution are not performed,
- * and all levels are set to the paragraph level.
- *
- * If there are no explicit embedding codes, then the (Xn) steps
- * are not performed.
- *
- * If embedding levels are supplied as a parameter, then all
- * explicit embedding codes are ignored, and the (Xn) steps
- * are not performed.
- *
- * White Space types could get the level of the run they belong to,
- * and are checked with a test of (flags&MASK_EMBEDDING) to
- * consider if the paragraph direction should be considered in
- * the flags variable.
- *
- * If there are no White Space types in the paragraph, then
- * (L1) is not necessary in adjustWSLevels().
- */
-
-/* to avoid some conditional statements, use tiny constant arrays */
-static const Flags flagLR[2]={ DIRPROP_FLAG(L), DIRPROP_FLAG(R) };
-static const Flags flagE[2]={ DIRPROP_FLAG(LRE), DIRPROP_FLAG(RLE) };
-static const Flags flagO[2]={ DIRPROP_FLAG(LRO), DIRPROP_FLAG(RLO) };
-
-#define DIRPROP_FLAG_LR(level) flagLR[(level)&1]
-#define DIRPROP_FLAG_E(level) flagE[(level)&1]
-#define DIRPROP_FLAG_O(level) flagO[(level)&1]
-
-#define DIR_FROM_STRONG(strong) ((strong)==L ? L : R)
-
-#define NO_OVERRIDE(level) ((level)&~UBIDI_LEVEL_OVERRIDE)
-
-/* UBiDi object management -------------------------------------------------- */
-
-U_CAPI UBiDi * U_EXPORT2
-ubidi_open(void)
-{
- UErrorCode errorCode=U_ZERO_ERROR;
- return ubidi_openSized(0, 0, &errorCode);
-}
-
-U_CAPI UBiDi * U_EXPORT2
-ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode) {
- UBiDi *pBiDi;
-
- /* check the argument values */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return NULL;
- } else if(maxLength<0 || maxRunCount<0) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL; /* invalid arguments */
- }
-
- /* allocate memory for the object */
- pBiDi=(UBiDi *)uprv_malloc(sizeof(UBiDi));
- if(pBiDi==NULL) {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
-
- /* reset the object, all pointers NULL, all flags FALSE, all sizes 0 */
- uprv_memset(pBiDi, 0, sizeof(UBiDi));
-
- /* allocate memory for arrays as requested */
- if(maxLength>0) {
- if( !getInitialDirPropsMemory(pBiDi, maxLength) ||
- !getInitialLevelsMemory(pBiDi, maxLength)
- ) {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- }
- } else {
- pBiDi->mayAllocateText=TRUE;
- }
-
- if(maxRunCount>0) {
- if(maxRunCount==1) {
- /* use simpleRuns[] */
- pBiDi->runsSize=sizeof(Run);
- } else if(!getInitialRunsMemory(pBiDi, maxRunCount)) {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- }
- } else {
- pBiDi->mayAllocateRuns=TRUE;
- }
-
- if(U_SUCCESS(*pErrorCode)) {
- return pBiDi;
- } else {
- ubidi_close(pBiDi);
- return NULL;
- }
-}
-
-/*
- * We are allowed to allocate memory if memory==NULL or
- * mayAllocate==TRUE for each array that we need.
- * We also try to grow memory as needed if we
- * allocate it.
- *
- * Assume sizeNeeded>0.
- * If *pMemory!=NULL, then assume *pSize>0.
- *
- * ### this realloc() may unnecessarily copy the old data,
- * which we know we don't need any more;
- * is this the best way to do this??
- */
-U_CFUNC UBool
-ubidi_getMemory(BidiMemoryForAllocation *bidiMem, int32_t *pSize, UBool mayAllocate, int32_t sizeNeeded) {
- void **pMemory = (void **)bidiMem;
- /* check for existing memory */
- if(*pMemory==NULL) {
- /* we need to allocate memory */
- if(mayAllocate && (*pMemory=uprv_malloc(sizeNeeded))!=NULL) {
- *pSize=sizeNeeded;
- return TRUE;
- } else {
- return FALSE;
- }
- } else {
- if(sizeNeeded<=*pSize) {
- /* there is already enough memory */
- return TRUE;
- }
- else if(!mayAllocate) {
- /* not enough memory, and we must not allocate */
- return FALSE;
- } else {
- /* we try to grow */
- void *memory;
- /* in most cases, we do not need the copy-old-data part of
- * realloc, but it is needed when adding runs using getRunsMemory()
- * in setParaRunsOnly()
- */
- if((memory=uprv_realloc(*pMemory, sizeNeeded))!=NULL) {
- *pMemory=memory;
- *pSize=sizeNeeded;
- return TRUE;
- } else {
- /* we failed to grow */
- return FALSE;
- }
- }
- }
-}
-
-U_CAPI void U_EXPORT2
-ubidi_close(UBiDi *pBiDi) {
- if(pBiDi!=NULL) {
- pBiDi->pParaBiDi=NULL; /* in case one tries to reuse this block */
- if(pBiDi->dirPropsMemory!=NULL) {
- uprv_free(pBiDi->dirPropsMemory);
- }
- if(pBiDi->levelsMemory!=NULL) {
- uprv_free(pBiDi->levelsMemory);
- }
- if(pBiDi->openingsMemory!=NULL) {
- uprv_free(pBiDi->openingsMemory);
- }
- if(pBiDi->parasMemory!=NULL) {
- uprv_free(pBiDi->parasMemory);
- }
- if(pBiDi->runsMemory!=NULL) {
- uprv_free(pBiDi->runsMemory);
- }
- if(pBiDi->isolatesMemory!=NULL) {
- uprv_free(pBiDi->isolatesMemory);
- }
- if(pBiDi->insertPoints.points!=NULL) {
- uprv_free(pBiDi->insertPoints.points);
- }
-
- uprv_free(pBiDi);
- }
-}
-
-/* set to approximate "inverse BiDi" ---------------------------------------- */
-
-U_CAPI void U_EXPORT2
-ubidi_setInverse(UBiDi *pBiDi, UBool isInverse) {
- if(pBiDi!=NULL) {
- pBiDi->isInverse=isInverse;
- pBiDi->reorderingMode = isInverse ? UBIDI_REORDER_INVERSE_NUMBERS_AS_L
- : UBIDI_REORDER_DEFAULT;
- }
-}
-
-U_CAPI UBool U_EXPORT2
-ubidi_isInverse(UBiDi *pBiDi) {
- if(pBiDi!=NULL) {
- return pBiDi->isInverse;
- } else {
- return FALSE;
- }
-}
-
-/* FOOD FOR THOUGHT: currently the reordering modes are a mixture of
- * algorithm for direct BiDi, algorithm for inverse BiDi and the bizarre
- * concept of RUNS_ONLY which is a double operation.
- * It could be advantageous to divide this into 3 concepts:
- * a) Operation: direct / inverse / RUNS_ONLY
- * b) Direct algorithm: default / NUMBERS_SPECIAL / GROUP_NUMBERS_WITH_R
- * c) Inverse algorithm: default / INVERSE_LIKE_DIRECT / NUMBERS_SPECIAL
- * This would allow combinations not possible today like RUNS_ONLY with
- * NUMBERS_SPECIAL.
- * Also allow to set INSERT_MARKS for the direct step of RUNS_ONLY and
- * REMOVE_CONTROLS for the inverse step.
- * Not all combinations would be supported, and probably not all do make sense.
- * This would need to document which ones are supported and what are the
- * fallbacks for unsupported combinations.
- */
-U_CAPI void U_EXPORT2
-ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode) {
- if ((pBiDi!=NULL) && (reorderingMode >= UBIDI_REORDER_DEFAULT)
- && (reorderingMode < UBIDI_REORDER_COUNT)) {
- pBiDi->reorderingMode = reorderingMode;
- pBiDi->isInverse = (UBool)(reorderingMode == UBIDI_REORDER_INVERSE_NUMBERS_AS_L);
- }
-}
-
-U_CAPI UBiDiReorderingMode U_EXPORT2
-ubidi_getReorderingMode(UBiDi *pBiDi) {
- if (pBiDi!=NULL) {
- return pBiDi->reorderingMode;
- } else {
- return UBIDI_REORDER_DEFAULT;
- }
-}
-
-U_CAPI void U_EXPORT2
-ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions) {
- if (reorderingOptions & UBIDI_OPTION_REMOVE_CONTROLS) {
- reorderingOptions&=~UBIDI_OPTION_INSERT_MARKS;
- }
- if (pBiDi!=NULL) {
- pBiDi->reorderingOptions=reorderingOptions;
- }
-}
-
-U_CAPI uint32_t U_EXPORT2
-ubidi_getReorderingOptions(UBiDi *pBiDi) {
- if (pBiDi!=NULL) {
- return pBiDi->reorderingOptions;
- } else {
- return 0;
- }
-}
-
-U_CAPI UBiDiDirection U_EXPORT2
-ubidi_getBaseDirection(const UChar *text,
-int32_t length){
-
- int32_t i;
- UChar32 uchar;
- UCharDirection dir;
-
- if( text==NULL || length<-1 ){
- return UBIDI_NEUTRAL;
- }
-
- if(length==-1) {
- length=u_strlen(text);
- }
-
- for( i = 0 ; i < length; ) {
- /* i is incremented by U16_NEXT */
- U16_NEXT(text, i, length, uchar);
- dir = u_charDirection(uchar);
- if( dir == U_LEFT_TO_RIGHT )
- return UBIDI_LTR;
- if( dir == U_RIGHT_TO_LEFT || dir ==U_RIGHT_TO_LEFT_ARABIC )
- return UBIDI_RTL;
- }
- return UBIDI_NEUTRAL;
-}
-
-/* perform (P2)..(P3) ------------------------------------------------------- */
-
-/**
- * Returns the directionality of the first strong character
- * after the last B in prologue, if any.
- * Requires prologue!=null.
- */
-static DirProp
-firstL_R_AL(UBiDi *pBiDi) {
- const UChar *text=pBiDi->prologue;
- int32_t length=pBiDi->proLength;
- int32_t i;
- UChar32 uchar;
- DirProp dirProp, result=ON;
- for(i=0; i<length; ) {
- /* i is incremented by U16_NEXT */
- U16_NEXT(text, i, length, uchar);
- dirProp=(DirProp)ubidi_getCustomizedClass(pBiDi, uchar);
- if(result==ON) {
- if(dirProp==L || dirProp==R || dirProp==AL) {
- result=dirProp;
- }
- } else {
- if(dirProp==B) {
- result=ON;
- }
- }
- }
- return result;
-}
-
-/*
- * Check that there are enough entries in the array pointed to by pBiDi->paras
- */
-static UBool
-checkParaCount(UBiDi *pBiDi) {
- int32_t count=pBiDi->paraCount;
- if(pBiDi->paras==pBiDi->simpleParas) {
- if(count<=SIMPLE_PARAS_COUNT)
- return TRUE;
- if(!getInitialParasMemory(pBiDi, SIMPLE_PARAS_COUNT * 2))
- return FALSE;
- pBiDi->paras=pBiDi->parasMemory;
- uprv_memcpy(pBiDi->parasMemory, pBiDi->simpleParas, SIMPLE_PARAS_COUNT * sizeof(Para));
- return TRUE;
- }
- if(!getInitialParasMemory(pBiDi, count * 2))
- return FALSE;
- pBiDi->paras=pBiDi->parasMemory;
- return TRUE;
-}
-
-/*
- * Get the directional properties for the text, calculate the flags bit-set, and
- * determine the paragraph level if necessary (in pBiDi->paras[i].level).
- * FSI initiators are also resolved and their dirProp replaced with LRI or RLI.
- * When encountering an FSI, it is initially replaced with an LRI, which is the
- * default. Only if a strong R or AL is found within its scope will the LRI be
- * replaced by an RLI.
- */
-static UBool
-getDirProps(UBiDi *pBiDi) {
- const UChar *text=pBiDi->text;
- DirProp *dirProps=pBiDi->dirPropsMemory; /* pBiDi->dirProps is const */
-
- int32_t i=0, originalLength=pBiDi->originalLength;
- Flags flags=0; /* collect all directionalities in the text */
- UChar32 uchar;
- DirProp dirProp=0, defaultParaLevel=0; /* initialize to avoid compiler warnings */
- UBool isDefaultLevel=IS_DEFAULT_LEVEL(pBiDi->paraLevel);
- /* for inverse BiDi, the default para level is set to RTL if there is a
- strong R or AL character at either end of the text */
- UBool isDefaultLevelInverse=isDefaultLevel && (UBool)
- (pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_LIKE_DIRECT ||
- pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL);
- int32_t lastArabicPos=-1;
- int32_t controlCount=0;
- UBool removeBiDiControls = (UBool)(pBiDi->reorderingOptions &
- UBIDI_OPTION_REMOVE_CONTROLS);
-
- enum State {
- NOT_SEEKING_STRONG, /* 0: not contextual paraLevel, not after FSI */
- SEEKING_STRONG_FOR_PARA, /* 1: looking for first strong char in para */
- SEEKING_STRONG_FOR_FSI, /* 2: looking for first strong after FSI */
- LOOKING_FOR_PDI /* 3: found strong after FSI, looking for PDI */
- };
- State state;
- DirProp lastStrong=ON; /* for default level & inverse BiDi */
- /* The following stacks are used to manage isolate sequences. Those
- sequences may be nested, but obviously never more deeply than the
- maximum explicit embedding level.
- lastStack is the index of the last used entry in the stack. A value of -1
- means that there is no open isolate sequence.
- lastStack is reset to -1 on paragraph boundaries. */
- /* The following stack contains the position of the initiator of
- each open isolate sequence */
- int32_t isolateStartStack[UBIDI_MAX_EXPLICIT_LEVEL+1];
- /* The following stack contains the last known state before
- encountering the initiator of an isolate sequence */
- State previousStateStack[UBIDI_MAX_EXPLICIT_LEVEL+1];
- int32_t stackLast=-1;
-
- if(pBiDi->reorderingOptions & UBIDI_OPTION_STREAMING)
- pBiDi->length=0;
- defaultParaLevel=pBiDi->paraLevel&1;
- if(isDefaultLevel) {
- pBiDi->paras[0].level=defaultParaLevel;
- lastStrong=defaultParaLevel;
- if(pBiDi->proLength>0 && /* there is a prologue */
- (dirProp=firstL_R_AL(pBiDi))!=ON) { /* with a strong character */
- if(dirProp==L)
- pBiDi->paras[0].level=0; /* set the default para level */
- else
- pBiDi->paras[0].level=1; /* set the default para level */
- state=NOT_SEEKING_STRONG;
- } else {
- state=SEEKING_STRONG_FOR_PARA;
- }
- } else {
- pBiDi->paras[0].level=pBiDi->paraLevel;
- state=NOT_SEEKING_STRONG;
- }
- /* count paragraphs and determine the paragraph level (P2..P3) */
- /*
- * see comment in ubidi.h:
- * the UBIDI_DEFAULT_XXX values are designed so that
- * their bit 0 alone yields the intended default
- */
- for( /* i=0 above */ ; i<originalLength; ) {
- /* i is incremented by U16_NEXT */
- U16_NEXT(text, i, originalLength, uchar);
- flags|=DIRPROP_FLAG(dirProp=(DirProp)ubidi_getCustomizedClass(pBiDi, uchar));
- dirProps[i-1]=dirProp;
- if(uchar>0xffff) { /* set the lead surrogate's property to BN */
- flags|=DIRPROP_FLAG(BN);
- dirProps[i-2]=BN;
- }
- if(removeBiDiControls && IS_BIDI_CONTROL_CHAR(uchar))
- controlCount++;
- if(dirProp==L) {
- if(state==SEEKING_STRONG_FOR_PARA) {
- pBiDi->paras[pBiDi->paraCount-1].level=0;
- state=NOT_SEEKING_STRONG;
- }
- else if(state==SEEKING_STRONG_FOR_FSI) {
- if(stackLast<=UBIDI_MAX_EXPLICIT_LEVEL) {
- /* no need for next statement, already set by default */
- /* dirProps[isolateStartStack[stackLast]]=LRI; */
- flags|=DIRPROP_FLAG(LRI);
- }
- state=LOOKING_FOR_PDI;
- }
- lastStrong=L;
- continue;
- }
- if(dirProp==R || dirProp==AL) {
- if(state==SEEKING_STRONG_FOR_PARA) {
- pBiDi->paras[pBiDi->paraCount-1].level=1;
- state=NOT_SEEKING_STRONG;
- }
- else if(state==SEEKING_STRONG_FOR_FSI) {
- if(stackLast<=UBIDI_MAX_EXPLICIT_LEVEL) {
- dirProps[isolateStartStack[stackLast]]=RLI;
- flags|=DIRPROP_FLAG(RLI);
- }
- state=LOOKING_FOR_PDI;
- }
- lastStrong=R;
- if(dirProp==AL)
- lastArabicPos=i-1;
- continue;
- }
- if(dirProp>=FSI && dirProp<=RLI) { /* FSI, LRI or RLI */
- stackLast++;
- if(stackLast<=UBIDI_MAX_EXPLICIT_LEVEL) {
- isolateStartStack[stackLast]=i-1;
- previousStateStack[stackLast]=state;
- }
- if(dirProp==FSI) {
- dirProps[i-1]=LRI; /* default if no strong char */
- state=SEEKING_STRONG_FOR_FSI;
- }
- else
- state=LOOKING_FOR_PDI;
- continue;
- }
- if(dirProp==PDI) {
- if(state==SEEKING_STRONG_FOR_FSI) {
- if(stackLast<=UBIDI_MAX_EXPLICIT_LEVEL) {
- /* no need for next statement, already set by default */
- /* dirProps[isolateStartStack[stackLast]]=LRI; */
- flags|=DIRPROP_FLAG(LRI);
- }
- }
- if(stackLast>=0) {
- if(stackLast<=UBIDI_MAX_EXPLICIT_LEVEL)
- state=previousStateStack[stackLast];
- stackLast--;
- }
- continue;
- }
- if(dirProp==B) {
- if(i<originalLength && uchar==CR && text[i]==LF) /* do nothing on the CR */
- continue;
- pBiDi->paras[pBiDi->paraCount-1].limit=i;
- if(isDefaultLevelInverse && lastStrong==R)
- pBiDi->paras[pBiDi->paraCount-1].level=1;
- if(pBiDi->reorderingOptions & UBIDI_OPTION_STREAMING) {
- /* When streaming, we only process whole paragraphs
- thus some updates are only done on paragraph boundaries */
- pBiDi->length=i; /* i is index to next character */
- pBiDi->controlCount=controlCount;
- }
- if(i<originalLength) { /* B not last char in text */
- pBiDi->paraCount++;
- if(checkParaCount(pBiDi)==FALSE) /* not enough memory for a new para entry */
- return FALSE;
- if(isDefaultLevel) {
- pBiDi->paras[pBiDi->paraCount-1].level=defaultParaLevel;
- state=SEEKING_STRONG_FOR_PARA;
- lastStrong=defaultParaLevel;
- } else {
- pBiDi->paras[pBiDi->paraCount-1].level=pBiDi->paraLevel;
- state=NOT_SEEKING_STRONG;
- }
- stackLast=-1;
- }
- continue;
- }
- }
- /* Ignore still open isolate sequences with overflow */
- if(stackLast>UBIDI_MAX_EXPLICIT_LEVEL) {
- stackLast=UBIDI_MAX_EXPLICIT_LEVEL;
- state=SEEKING_STRONG_FOR_FSI; /* to be on the safe side */
- }
- /* Resolve direction of still unresolved open FSI sequences */
- while(stackLast>=0) {
- if(state==SEEKING_STRONG_FOR_FSI) {
- /* no need for next statement, already set by default */
- /* dirProps[isolateStartStack[stackLast]]=LRI; */
- flags|=DIRPROP_FLAG(LRI);
- break;
- }
- state=previousStateStack[stackLast];
- stackLast--;
- }
- /* When streaming, ignore text after the last paragraph separator */
- if(pBiDi->reorderingOptions & UBIDI_OPTION_STREAMING) {
- if(pBiDi->length<originalLength)
- pBiDi->paraCount--;
- } else {
- pBiDi->paras[pBiDi->paraCount-1].limit=originalLength;
- pBiDi->controlCount=controlCount;
- }
- /* For inverse bidi, default para direction is RTL if there is
- a strong R or AL at either end of the paragraph */
- if(isDefaultLevelInverse && lastStrong==R) {
- pBiDi->paras[pBiDi->paraCount-1].level=1;
- }
- if(isDefaultLevel) {
- pBiDi->paraLevel=static_cast<UBiDiLevel>(pBiDi->paras[0].level);
- }
- /* The following is needed to resolve the text direction for default level
- paragraphs containing no strong character */
- for(i=0; i<pBiDi->paraCount; i++)
- flags|=DIRPROP_FLAG_LR(pBiDi->paras[i].level);
-
- if(pBiDi->orderParagraphsLTR && (flags&DIRPROP_FLAG(B))) {
- flags|=DIRPROP_FLAG(L);
- }
- pBiDi->flags=flags;
- pBiDi->lastArabicPos=lastArabicPos;
- return TRUE;
-}
-
-/* determine the paragraph level at position index */
-U_CFUNC UBiDiLevel
-ubidi_getParaLevelAtIndex(const UBiDi *pBiDi, int32_t pindex) {
- int32_t i;
- for(i=0; i<pBiDi->paraCount; i++)
- if(pindex<pBiDi->paras[i].limit)
- break;
- if(i>=pBiDi->paraCount)
- i=pBiDi->paraCount-1;
- return (UBiDiLevel)(pBiDi->paras[i].level);
-}
-
-/* Functions for handling paired brackets ----------------------------------- */
-
-/* In the isoRuns array, the first entry is used for text outside of any
- isolate sequence. Higher entries are used for each more deeply nested
- isolate sequence. isoRunLast is the index of the last used entry. The
- openings array is used to note the data of opening brackets not yet
- matched by a closing bracket, or matched but still susceptible to change
- level.
- Each isoRun entry contains the index of the first and
- one-after-last openings entries for pending opening brackets it
- contains. The next openings entry to use is the one-after-last of the
- most deeply nested isoRun entry.
- isoRun entries also contain their current embedding level and the last
- encountered strong character, since these will be needed to resolve
- the level of paired brackets. */
-
-static void
-bracketInit(UBiDi *pBiDi, BracketData *bd) {
- bd->pBiDi=pBiDi;
- bd->isoRunLast=0;
- bd->isoRuns[0].start=0;
- bd->isoRuns[0].limit=0;
- bd->isoRuns[0].level=GET_PARALEVEL(pBiDi, 0);
- UBiDiLevel t = GET_PARALEVEL(pBiDi, 0) & 1;
- bd->isoRuns[0].lastStrong = bd->isoRuns[0].lastBase = t;
- bd->isoRuns[0].contextDir = (UBiDiDirection)t;
- bd->isoRuns[0].contextPos=0;
- if(pBiDi->openingsMemory) {
- bd->openings=pBiDi->openingsMemory;
- bd->openingsCount=pBiDi->openingsSize / sizeof(Opening);
- } else {
- bd->openings=bd->simpleOpenings;
- bd->openingsCount=SIMPLE_OPENINGS_COUNT;
- }
- bd->isNumbersSpecial=bd->pBiDi->reorderingMode==UBIDI_REORDER_NUMBERS_SPECIAL ||
- bd->pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL;
-}
-
-/* paragraph boundary */
-static void
-bracketProcessB(BracketData *bd, UBiDiLevel level) {
- bd->isoRunLast=0;
- bd->isoRuns[0].limit=0;
- bd->isoRuns[0].level=level;
- bd->isoRuns[0].lastStrong=bd->isoRuns[0].lastBase=level&1;
- bd->isoRuns[0].contextDir=(UBiDiDirection)(level&1);
- bd->isoRuns[0].contextPos=0;
-}
-
-/* LRE, LRO, RLE, RLO, PDF */
-static void
-bracketProcessBoundary(BracketData *bd, int32_t lastCcPos,
- UBiDiLevel contextLevel, UBiDiLevel embeddingLevel) {
- IsoRun *pLastIsoRun=&bd->isoRuns[bd->isoRunLast];
- DirProp *dirProps=bd->pBiDi->dirProps;
- if(DIRPROP_FLAG(dirProps[lastCcPos])&MASK_ISO) /* after an isolate */
- return;
- if(NO_OVERRIDE(embeddingLevel)>NO_OVERRIDE(contextLevel)) /* not a PDF */
- contextLevel=embeddingLevel;
- pLastIsoRun->limit=pLastIsoRun->start;
- pLastIsoRun->level=embeddingLevel;
- pLastIsoRun->lastStrong=pLastIsoRun->lastBase=contextLevel&1;
- pLastIsoRun->contextDir=(UBiDiDirection)(contextLevel&1);
- pLastIsoRun->contextPos=(UBiDiDirection)lastCcPos;
-}
-
-/* LRI or RLI */
-static void
-bracketProcessLRI_RLI(BracketData *bd, UBiDiLevel level) {
- IsoRun *pLastIsoRun=&bd->isoRuns[bd->isoRunLast];
- int16_t lastLimit;
- pLastIsoRun->lastBase=ON;
- lastLimit=pLastIsoRun->limit;
- bd->isoRunLast++;
- pLastIsoRun++;
- pLastIsoRun->start=pLastIsoRun->limit=lastLimit;
- pLastIsoRun->level=level;
- pLastIsoRun->lastStrong=pLastIsoRun->lastBase=level&1;
- pLastIsoRun->contextDir=(UBiDiDirection)(level&1);
- pLastIsoRun->contextPos=0;
-}
-
-/* PDI */
-static void
-bracketProcessPDI(BracketData *bd) {
- IsoRun *pLastIsoRun;
- bd->isoRunLast--;
- pLastIsoRun=&bd->isoRuns[bd->isoRunLast];
- pLastIsoRun->lastBase=ON;
-}
-
-/* newly found opening bracket: create an openings entry */
-static UBool /* return TRUE if success */
-bracketAddOpening(BracketData *bd, UChar match, int32_t position) {
- IsoRun *pLastIsoRun=&bd->isoRuns[bd->isoRunLast];
- Opening *pOpening;
- if(pLastIsoRun->limit>=bd->openingsCount) { /* no available new entry */
- UBiDi *pBiDi=bd->pBiDi;
- if(!getInitialOpeningsMemory(pBiDi, pLastIsoRun->limit * 2))
- return FALSE;
- if(bd->openings==bd->simpleOpenings)
- uprv_memcpy(pBiDi->openingsMemory, bd->simpleOpenings,
- SIMPLE_OPENINGS_COUNT * sizeof(Opening));
- bd->openings=pBiDi->openingsMemory; /* may have changed */
- bd->openingsCount=pBiDi->openingsSize / sizeof(Opening);
- }
- pOpening=&bd->openings[pLastIsoRun->limit];
- pOpening->position=position;
- pOpening->match=match;
- pOpening->contextDir=pLastIsoRun->contextDir;
- pOpening->contextPos=pLastIsoRun->contextPos;
- pOpening->flags=0;
- pLastIsoRun->limit++;
- return TRUE;
-}
-
-/* change N0c1 to N0c2 when a preceding bracket is assigned the embedding level */
-static void
-fixN0c(BracketData *bd, int32_t openingIndex, int32_t newPropPosition, DirProp newProp) {
- /* This function calls itself recursively */
- IsoRun *pLastIsoRun=&bd->isoRuns[bd->isoRunLast];
- Opening *qOpening;
- DirProp *dirProps=bd->pBiDi->dirProps;
- int32_t k, openingPosition, closingPosition;
- for(k=openingIndex+1, qOpening=&bd->openings[k]; k<pLastIsoRun->limit; k++, qOpening++) {
- if(qOpening->match>=0) /* not an N0c match */
- continue;
- if(newPropPosition<qOpening->contextPos)
- break;
- if(newPropPosition>=qOpening->position)
- continue;
- if(newProp==qOpening->contextDir)
- break;
- openingPosition=qOpening->position;
- dirProps[openingPosition]=newProp;
- closingPosition=-(qOpening->match);
- dirProps[closingPosition]=newProp;
- qOpening->match=0; /* prevent further changes */
- fixN0c(bd, k, openingPosition, newProp);
- fixN0c(bd, k, closingPosition, newProp);
- }
-}
-
-/* process closing bracket */
-static DirProp /* return L or R if N0b or N0c, ON if N0d */
-bracketProcessClosing(BracketData *bd, int32_t openIdx, int32_t position) {
- IsoRun *pLastIsoRun=&bd->isoRuns[bd->isoRunLast];
- Opening *pOpening, *qOpening;
- UBiDiDirection direction;
- UBool stable;
- DirProp newProp;
- pOpening=&bd->openings[openIdx];
- direction=(UBiDiDirection)(pLastIsoRun->level&1);
- stable=TRUE; /* assume stable until proved otherwise */
-
- /* The stable flag is set when brackets are paired and their
- level is resolved and cannot be changed by what will be
- found later in the source string.
- An unstable match can occur only when applying N0c, where
- the resolved level depends on the preceding context, and
- this context may be affected by text occurring later.
- Example: RTL paragraph containing: abc[(latin) HEBREW]
- When the closing parenthesis is encountered, it appears
- that N0c1 must be applied since 'abc' sets an opposite
- direction context and both parentheses receive level 2.
- However, when the closing square bracket is processed,
- N0b applies because of 'HEBREW' being included within the
- brackets, thus the square brackets are treated like R and
- receive level 1. However, this changes the preceding
- context of the opening parenthesis, and it now appears
- that N0c2 must be applied to the parentheses rather than
- N0c1. */
-
- if((direction==0 && pOpening->flags&FOUND_L) ||
- (direction==1 && pOpening->flags&FOUND_R)) { /* N0b */
- newProp=static_cast<DirProp>(direction);
- }
- else if(pOpening->flags&(FOUND_L|FOUND_R)) { /* N0c */
- /* it is stable if there is no containing pair or in
- conditions too complicated and not worth checking */
- stable=(openIdx==pLastIsoRun->start);
- if(direction!=pOpening->contextDir)
- newProp= static_cast<DirProp>(pOpening->contextDir); /* N0c1 */
- else
- newProp= static_cast<DirProp>(direction); /* N0c2 */
- } else {
- /* forget this and any brackets nested within this pair */
- pLastIsoRun->limit= static_cast<uint16_t>(openIdx);
- return ON; /* N0d */
- }
- bd->pBiDi->dirProps[pOpening->position]=newProp;
- bd->pBiDi->dirProps[position]=newProp;
- /* Update nested N0c pairs that may be affected */
- fixN0c(bd, openIdx, pOpening->position, newProp);
- if(stable) {
- pLastIsoRun->limit= static_cast<uint16_t>(openIdx); /* forget any brackets nested within this pair */
- /* remove lower located synonyms if any */
- while(pLastIsoRun->limit>pLastIsoRun->start &&
- bd->openings[pLastIsoRun->limit-1].position==pOpening->position)
- pLastIsoRun->limit--;
- } else {
- int32_t k;
- pOpening->match=-position;
- /* neutralize lower located synonyms if any */
- k=openIdx-1;
- while(k>=pLastIsoRun->start &&
- bd->openings[k].position==pOpening->position)
- bd->openings[k--].match=0;
- /* neutralize any unmatched opening between the current pair;
- this will also neutralize higher located synonyms if any */
- for(k=openIdx+1; k<pLastIsoRun->limit; k++) {
- qOpening=&bd->openings[k];
- if(qOpening->position>=position)
- break;
- if(qOpening->match>0)
- qOpening->match=0;
- }
- }
- return newProp;
-}
-
-/* handle strong characters, digits and candidates for closing brackets */
-static UBool /* return TRUE if success */
-bracketProcessChar(BracketData *bd, int32_t position) {
- IsoRun *pLastIsoRun=&bd->isoRuns[bd->isoRunLast];
- DirProp *dirProps, dirProp, newProp;
- UBiDiLevel level;
- dirProps=bd->pBiDi->dirProps;
- dirProp=dirProps[position];
- if(dirProp==ON) {
- UChar c, match;
- int32_t idx;
- /* First see if it is a matching closing bracket. Hopefully, this is
- more efficient than checking if it is a closing bracket at all */
- c=bd->pBiDi->text[position];
- for(idx=pLastIsoRun->limit-1; idx>=pLastIsoRun->start; idx--) {
- if(bd->openings[idx].match!=c)
- continue;
- /* We have a match */
- newProp=bracketProcessClosing(bd, idx, position);
- if(newProp==ON) { /* N0d */
- c=0; /* prevent handling as an opening */
- break;
- }
- pLastIsoRun->lastBase=ON;
- pLastIsoRun->contextDir=(UBiDiDirection)newProp;
- pLastIsoRun->contextPos=position;
- level=bd->pBiDi->levels[position];
- if(level&UBIDI_LEVEL_OVERRIDE) { /* X4, X5 */
- uint16_t flag;
- int32_t i;
- newProp=level&1;
- pLastIsoRun->lastStrong=newProp;
- flag=DIRPROP_FLAG(newProp);
- for(i=pLastIsoRun->start; i<idx; i++)
- bd->openings[i].flags|=flag;
- /* matching brackets are not overridden by LRO/RLO */
- bd->pBiDi->levels[position]&=~UBIDI_LEVEL_OVERRIDE;
- }
- /* matching brackets are not overridden by LRO/RLO */
- bd->pBiDi->levels[bd->openings[idx].position]&=~UBIDI_LEVEL_OVERRIDE;
- return TRUE;
- }
- /* We get here only if the ON character is not a matching closing
- bracket or it is a case of N0d */
- /* Now see if it is an opening bracket */
- if(c)
- match= static_cast<UChar>(u_getBidiPairedBracket(c)); /* get the matching char */
- else
- match=0;
- if(match!=c && /* has a matching char */
- ubidi_getPairedBracketType(c)==U_BPT_OPEN) { /* opening bracket */
- /* special case: process synonyms
- create an opening entry for each synonym */
- if(match==0x232A) { /* RIGHT-POINTING ANGLE BRACKET */
- if(!bracketAddOpening(bd, 0x3009, position))
- return FALSE;
- }
- else if(match==0x3009) { /* RIGHT ANGLE BRACKET */
- if(!bracketAddOpening(bd, 0x232A, position))
- return FALSE;
- }
- if(!bracketAddOpening(bd, match, position))
- return FALSE;
- }
- }
- level=bd->pBiDi->levels[position];
- if(level&UBIDI_LEVEL_OVERRIDE) { /* X4, X5 */
- newProp=level&1;
- if(dirProp!=S && dirProp!=WS && dirProp!=ON)
- dirProps[position]=newProp;
- pLastIsoRun->lastBase=newProp;
- pLastIsoRun->lastStrong=newProp;
- pLastIsoRun->contextDir=(UBiDiDirection)newProp;
- pLastIsoRun->contextPos=position;
- }
- else if(dirProp<=R || dirProp==AL) {
- newProp= static_cast<DirProp>(DIR_FROM_STRONG(dirProp));
- pLastIsoRun->lastBase=dirProp;
- pLastIsoRun->lastStrong=dirProp;
- pLastIsoRun->contextDir=(UBiDiDirection)newProp;
- pLastIsoRun->contextPos=position;
- }
- else if(dirProp==EN) {
- pLastIsoRun->lastBase=EN;
- if(pLastIsoRun->lastStrong==L) {
- newProp=L; /* W7 */
- if(!bd->isNumbersSpecial)
- dirProps[position]=ENL;
- pLastIsoRun->contextDir=(UBiDiDirection)L;
- pLastIsoRun->contextPos=position;
- }
- else {
- newProp=R; /* N0 */
- if(pLastIsoRun->lastStrong==AL)
- dirProps[position]=AN; /* W2 */
- else
- dirProps[position]=ENR;
- pLastIsoRun->contextDir=(UBiDiDirection)R;
- pLastIsoRun->contextPos=position;
- }
- }
- else if(dirProp==AN) {
- newProp=R; /* N0 */
- pLastIsoRun->lastBase=AN;
- pLastIsoRun->contextDir=(UBiDiDirection)R;
- pLastIsoRun->contextPos=position;
- }
- else if(dirProp==NSM) {
- /* if the last real char was ON, change NSM to ON so that it
- will stay ON even if the last real char is a bracket which
- may be changed to L or R */
- newProp=pLastIsoRun->lastBase;
- if(newProp==ON)
- dirProps[position]=newProp;
- }
- else {
- newProp=dirProp;
- pLastIsoRun->lastBase=dirProp;
- }
- if(newProp<=R || newProp==AL) {
- int32_t i;
- uint16_t flag=DIRPROP_FLAG(DIR_FROM_STRONG(newProp));
- for(i=pLastIsoRun->start; i<pLastIsoRun->limit; i++)
- if(position>bd->openings[i].position)
- bd->openings[i].flags|=flag;
- }
- return TRUE;
-}
-
-/* perform (X1)..(X9) ------------------------------------------------------- */
-
-/* determine if the text is mixed-directional or single-directional */
-static UBiDiDirection
-directionFromFlags(UBiDi *pBiDi) {
- Flags flags=pBiDi->flags;
- /* if the text contains AN and neutrals, then some neutrals may become RTL */
- if(!(flags&MASK_RTL || ((flags&DIRPROP_FLAG(AN)) && (flags&MASK_POSSIBLE_N)))) {
- return UBIDI_LTR;
- } else if(!(flags&MASK_LTR)) {
- return UBIDI_RTL;
- } else {
- return UBIDI_MIXED;
- }
-}
-
-/*
- * Resolve the explicit levels as specified by explicit embedding codes.
- * Recalculate the flags to have them reflect the real properties
- * after taking the explicit embeddings into account.
- *
- * The BiDi algorithm is designed to result in the same behavior whether embedding
- * levels are externally specified (from "styled text", supposedly the preferred
- * method) or set by explicit embedding codes (LRx, RLx, PDF, FSI, PDI) in the plain text.
- * That is why (X9) instructs to remove all not-isolate explicit codes (and BN).
- * However, in a real implementation, the removal of these codes and their index
- * positions in the plain text is undesirable since it would result in
- * reallocated, reindexed text.
- * Instead, this implementation leaves the codes in there and just ignores them
- * in the subsequent processing.
- * In order to get the same reordering behavior, positions with a BN or a not-isolate
- * explicit embedding code just get the same level assigned as the last "real"
- * character.
- *
- * Some implementations, not this one, then overwrite some of these
- * directionality properties at "real" same-level-run boundaries by
- * L or R codes so that the resolution of weak types can be performed on the
- * entire paragraph at once instead of having to parse it once more and
- * perform that resolution on same-level-runs.
- * This limits the scope of the implicit rules in effectively
- * the same way as the run limits.
- *
- * Instead, this implementation does not modify these codes, except for
- * paired brackets whose properties (ON) may be replaced by L or R.
- * On one hand, the paragraph has to be scanned for same-level-runs, but
- * on the other hand, this saves another loop to reset these codes,
- * or saves making and modifying a copy of dirProps[].
- *
- *
- * Note that (Pn) and (Xn) changed significantly from version 4 of the BiDi algorithm.
- *
- *
- * Handling the stack of explicit levels (Xn):
- *
- * With the BiDi stack of explicit levels, as pushed with each
- * LRE, RLE, LRO, RLO, LRI, RLI and FSI and popped with each PDF and PDI,
- * the explicit level must never exceed UBIDI_MAX_EXPLICIT_LEVEL.
- *
- * In order to have a correct push-pop semantics even in the case of overflows,
- * overflow counters and a valid isolate counter are used as described in UAX#9
- * section 3.3.2 "Explicit Levels and Directions".
- *
- * This implementation assumes that UBIDI_MAX_EXPLICIT_LEVEL is odd.
- *
- * Returns normally the direction; -1 if there was a memory shortage
- *
- */
-static UBiDiDirection
-resolveExplicitLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) {
- DirProp *dirProps=pBiDi->dirProps;
- UBiDiLevel *levels=pBiDi->levels;
- const UChar *text=pBiDi->text;
-
- int32_t i=0, length=pBiDi->length;
- Flags flags=pBiDi->flags; /* collect all directionalities in the text */
- DirProp dirProp;
- UBiDiLevel level=GET_PARALEVEL(pBiDi, 0);
- UBiDiDirection direction;
- pBiDi->isolateCount=0;
-
- if(U_FAILURE(*pErrorCode)) { return UBIDI_LTR; }
-
- /* determine if the text is mixed-directional or single-directional */
- direction=directionFromFlags(pBiDi);
-
- /* we may not need to resolve any explicit levels */
- if((direction!=UBIDI_MIXED)) {
- /* not mixed directionality: levels don't matter - trailingWSStart will be 0 */
- return direction;
- }
- if(pBiDi->reorderingMode > UBIDI_REORDER_LAST_LOGICAL_TO_VISUAL) {
- /* inverse BiDi: mixed, but all characters are at the same embedding level */
- /* set all levels to the paragraph level */
- int32_t paraIndex, start, limit;
- for(paraIndex=0; paraIndex<pBiDi->paraCount; paraIndex++) {
- if(paraIndex==0)
- start=0;
- else
- start=pBiDi->paras[paraIndex-1].limit;
- limit=pBiDi->paras[paraIndex].limit;
- level= static_cast<UBiDiLevel>(pBiDi->paras[paraIndex].level);
- for(i=start; i<limit; i++)
- levels[i]=level;
- }
- return direction; /* no bracket matching for inverse BiDi */
- }
- if(!(flags&(MASK_EXPLICIT|MASK_ISO))) {
- /* no embeddings, set all levels to the paragraph level */
- /* we still have to perform bracket matching */
- int32_t paraIndex, start, limit;
- BracketData bracketData;
- bracketInit(pBiDi, &bracketData);
- for(paraIndex=0; paraIndex<pBiDi->paraCount; paraIndex++) {
- if(paraIndex==0)
- start=0;
- else
- start=pBiDi->paras[paraIndex-1].limit;
- limit=pBiDi->paras[paraIndex].limit;
- level= static_cast<UBiDiLevel>(pBiDi->paras[paraIndex].level);
- for(i=start; i<limit; i++) {
- levels[i]=level;
- dirProp=dirProps[i];
- if(dirProp==BN)
- continue;
- if(dirProp==B) {
- if((i+1)<length) {
- if(text[i]==CR && text[i+1]==LF)
- continue; /* skip CR when followed by LF */
- bracketProcessB(&bracketData, level);
- }
- continue;
- }
- if(!bracketProcessChar(&bracketData, i)) {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return UBIDI_LTR;
- }
- }
- }
- return direction;
- }
- {
- /* continue to perform (Xn) */
-
- /* (X1) level is set for all codes, embeddingLevel keeps track of the push/pop operations */
- /* both variables may carry the UBIDI_LEVEL_OVERRIDE flag to indicate the override status */
- UBiDiLevel embeddingLevel=level, newLevel;
- UBiDiLevel previousLevel=level; /* previous level for regular (not CC) characters */
- int32_t lastCcPos=0; /* index of last effective LRx,RLx, PDx */
-
- /* The following stack remembers the embedding level and the ISOLATE flag of level runs.
- stackLast points to its current entry. */
- uint16_t stack[UBIDI_MAX_EXPLICIT_LEVEL+2]; /* we never push anything >=UBIDI_MAX_EXPLICIT_LEVEL
- but we need one more entry as base */
- uint32_t stackLast=0;
- int32_t overflowIsolateCount=0;
- int32_t overflowEmbeddingCount=0;
- int32_t validIsolateCount=0;
- BracketData bracketData;
- bracketInit(pBiDi, &bracketData);
- stack[0]=level; /* initialize base entry to para level, no override, no isolate */
-
- /* recalculate the flags */
- flags=0;
-
- for(i=0; i<length; ++i) {
- dirProp=dirProps[i];
- switch(dirProp) {
- case LRE:
- case RLE:
- case LRO:
- case RLO:
- /* (X2, X3, X4, X5) */
- flags|=DIRPROP_FLAG(BN);
- levels[i]=previousLevel;
- if (dirProp==LRE || dirProp==LRO)
- /* least greater even level */
- newLevel=(UBiDiLevel)((embeddingLevel+2)&~(UBIDI_LEVEL_OVERRIDE|1));
- else
- /* least greater odd level */
- newLevel=(UBiDiLevel)((NO_OVERRIDE(embeddingLevel)+1)|1);
- if(newLevel<=UBIDI_MAX_EXPLICIT_LEVEL && overflowIsolateCount==0 &&
- overflowEmbeddingCount==0) {
- lastCcPos=i;
- embeddingLevel=newLevel;
- if(dirProp==LRO || dirProp==RLO)
- embeddingLevel|=UBIDI_LEVEL_OVERRIDE;
- stackLast++;
- stack[stackLast]=embeddingLevel;
- /* we don't need to set UBIDI_LEVEL_OVERRIDE off for LRE and RLE
- since this has already been done for newLevel which is
- the source for embeddingLevel.
- */
- } else {
- if(overflowIsolateCount==0)
- overflowEmbeddingCount++;
- }
- break;
- case PDF:
- /* (X7) */
- flags|=DIRPROP_FLAG(BN);
- levels[i]=previousLevel;
- /* handle all the overflow cases first */
- if(overflowIsolateCount) {
- break;
- }
- if(overflowEmbeddingCount) {
- overflowEmbeddingCount--;
- break;
- }
- if(stackLast>0 && stack[stackLast]<ISOLATE) { /* not an isolate entry */
- lastCcPos=i;
- stackLast--;
- embeddingLevel=(UBiDiLevel)stack[stackLast];
- }
- break;
- case LRI:
- case RLI:
- flags|=(DIRPROP_FLAG(ON)|DIRPROP_FLAG_LR(embeddingLevel));
- levels[i]=NO_OVERRIDE(embeddingLevel);
- if(NO_OVERRIDE(embeddingLevel)!=NO_OVERRIDE(previousLevel)) {
- bracketProcessBoundary(&bracketData, lastCcPos,
- previousLevel, embeddingLevel);
- flags|=DIRPROP_FLAG_MULTI_RUNS;
- }
- previousLevel=embeddingLevel;
- /* (X5a, X5b) */
- if(dirProp==LRI)
- /* least greater even level */
- newLevel=(UBiDiLevel)((embeddingLevel+2)&~(UBIDI_LEVEL_OVERRIDE|1));
- else
- /* least greater odd level */
- newLevel=(UBiDiLevel)((NO_OVERRIDE(embeddingLevel)+1)|1);
- if(newLevel<=UBIDI_MAX_EXPLICIT_LEVEL && overflowIsolateCount==0 &&
- overflowEmbeddingCount==0) {
- flags|=DIRPROP_FLAG(dirProp);
- lastCcPos=i;
- validIsolateCount++;
- if(validIsolateCount>pBiDi->isolateCount)
- pBiDi->isolateCount=validIsolateCount;
- embeddingLevel=newLevel;
- /* we can increment stackLast without checking because newLevel
- will exceed UBIDI_MAX_EXPLICIT_LEVEL before stackLast overflows */
- stackLast++;
- stack[stackLast]=embeddingLevel+ISOLATE;
- bracketProcessLRI_RLI(&bracketData, embeddingLevel);
- } else {
- /* make it WS so that it is handled by adjustWSLevels() */
- dirProps[i]=WS;
- overflowIsolateCount++;
- }
- break;
- case PDI:
- if(NO_OVERRIDE(embeddingLevel)!=NO_OVERRIDE(previousLevel)) {
- bracketProcessBoundary(&bracketData, lastCcPos,
- previousLevel, embeddingLevel);
- flags|=DIRPROP_FLAG_MULTI_RUNS;
- }
- /* (X6a) */
- if(overflowIsolateCount) {
- overflowIsolateCount--;
- /* make it WS so that it is handled by adjustWSLevels() */
- dirProps[i]=WS;
- }
- else if(validIsolateCount) {
- flags|=DIRPROP_FLAG(PDI);
- lastCcPos=i;
- overflowEmbeddingCount=0;
- while(stack[stackLast]<ISOLATE) /* pop embedding entries */
- stackLast--; /* until the last isolate entry */
- stackLast--; /* pop also the last isolate entry */
- validIsolateCount--;
- bracketProcessPDI(&bracketData);
- } else
- /* make it WS so that it is handled by adjustWSLevels() */
- dirProps[i]=WS;
- embeddingLevel=(UBiDiLevel)stack[stackLast]&~ISOLATE;
- flags|=(DIRPROP_FLAG(ON)|DIRPROP_FLAG_LR(embeddingLevel));
- previousLevel=embeddingLevel;
- levels[i]=NO_OVERRIDE(embeddingLevel);
- break;
- case B:
- flags|=DIRPROP_FLAG(B);
- levels[i]=GET_PARALEVEL(pBiDi, i);
- if((i+1)<length) {
- if(text[i]==CR && text[i+1]==LF)
- break; /* skip CR when followed by LF */
- overflowEmbeddingCount=overflowIsolateCount=0;
- validIsolateCount=0;
- stackLast=0;
- previousLevel=embeddingLevel=GET_PARALEVEL(pBiDi, i+1);
- stack[0]=embeddingLevel; /* initialize base entry to para level, no override, no isolate */
- bracketProcessB(&bracketData, embeddingLevel);
- }
- break;
- case BN:
- /* BN, LRE, RLE, and PDF are supposed to be removed (X9) */
- /* they will get their levels set correctly in adjustWSLevels() */
- levels[i]=previousLevel;
- flags|=DIRPROP_FLAG(BN);
- break;
- default:
- /* all other types are normal characters and get the "real" level */
- if(NO_OVERRIDE(embeddingLevel)!=NO_OVERRIDE(previousLevel)) {
- bracketProcessBoundary(&bracketData, lastCcPos,
- previousLevel, embeddingLevel);
- flags|=DIRPROP_FLAG_MULTI_RUNS;
- if(embeddingLevel&UBIDI_LEVEL_OVERRIDE)
- flags|=DIRPROP_FLAG_O(embeddingLevel);
- else
- flags|=DIRPROP_FLAG_E(embeddingLevel);
- }
- previousLevel=embeddingLevel;
- levels[i]=embeddingLevel;
- if(!bracketProcessChar(&bracketData, i))
- return (UBiDiDirection)-1;
- /* the dirProp may have been changed in bracketProcessChar() */
- flags|=DIRPROP_FLAG(dirProps[i]);
- break;
- }
- }
- if(flags&MASK_EMBEDDING)
- flags|=DIRPROP_FLAG_LR(pBiDi->paraLevel);
- if(pBiDi->orderParagraphsLTR && (flags&DIRPROP_FLAG(B)))
- flags|=DIRPROP_FLAG(L);
- /* again, determine if the text is mixed-directional or single-directional */
- pBiDi->flags=flags;
- direction=directionFromFlags(pBiDi);
- }
- return direction;
-}
-
-/*
- * Use a pre-specified embedding levels array:
- *
- * Adjust the directional properties for overrides (->LEVEL_OVERRIDE),
- * ignore all explicit codes (X9),
- * and check all the preset levels.
- *
- * Recalculate the flags to have them reflect the real properties
- * after taking the explicit embeddings into account.
- */
-static UBiDiDirection
-checkExplicitLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) {
- DirProp *dirProps=pBiDi->dirProps;
- UBiDiLevel *levels=pBiDi->levels;
- int32_t isolateCount=0;
-
- int32_t length=pBiDi->length;
- Flags flags=0; /* collect all directionalities in the text */
- pBiDi->isolateCount=0;
-
- int32_t currentParaIndex = 0;
- int32_t currentParaLimit = pBiDi->paras[0].limit;
- int32_t currentParaLevel = pBiDi->paraLevel;
-
- for(int32_t i=0; i<length; ++i) {
- UBiDiLevel level=levels[i];
- DirProp dirProp=dirProps[i];
- if(dirProp==LRI || dirProp==RLI) {
- isolateCount++;
- if(isolateCount>pBiDi->isolateCount)
- pBiDi->isolateCount=isolateCount;
- }
- else if(dirProp==PDI)
- isolateCount--;
- else if(dirProp==B)
- isolateCount=0;
-
- // optimized version of int32_t currentParaLevel = GET_PARALEVEL(pBiDi, i);
- if (pBiDi->defaultParaLevel != 0 &&
- i == currentParaLimit && (currentParaIndex + 1) < pBiDi->paraCount) {
- currentParaLevel = pBiDi->paras[++currentParaIndex].level;
- currentParaLimit = pBiDi->paras[currentParaIndex].limit;
- }
-
- UBiDiLevel overrideFlag = level & UBIDI_LEVEL_OVERRIDE;
- level &= ~UBIDI_LEVEL_OVERRIDE;
- if (level < currentParaLevel || UBIDI_MAX_EXPLICIT_LEVEL < level) {
- if (level == 0) {
- if (dirProp == B) {
- // Paragraph separators are ok with explicit level 0.
- // Prevents reordering of paragraphs.
- } else {
- // Treat explicit level 0 as a wildcard for the paragraph level.
- // Avoid making the caller guess what the paragraph level would be.
- level = (UBiDiLevel)currentParaLevel;
- levels[i] = level | overrideFlag;
- }
- } else {
- // 1 <= level < currentParaLevel or UBIDI_MAX_EXPLICIT_LEVEL < level
- /* level out of bounds */
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return UBIDI_LTR;
- }
- }
- if (overrideFlag != 0) {
- /* keep the override flag in levels[i] but adjust the flags */
- flags|=DIRPROP_FLAG_O(level);
- } else {
- /* set the flags */
- flags|=DIRPROP_FLAG_E(level)|DIRPROP_FLAG(dirProp);
- }
- }
- if(flags&MASK_EMBEDDING)
- flags|=DIRPROP_FLAG_LR(pBiDi->paraLevel);
- /* determine if the text is mixed-directional or single-directional */
- pBiDi->flags=flags;
- return directionFromFlags(pBiDi);
-}
-
-/******************************************************************
- The Properties state machine table
-*******************************************************************
-
- All table cells are 8 bits:
- bits 0..4: next state
- bits 5..7: action to perform (if > 0)
-
- Cells may be of format "n" where n represents the next state
- (except for the rightmost column).
- Cells may also be of format "s(x,y)" where x represents an action
- to perform and y represents the next state.
-
-*******************************************************************
- Definitions and type for properties state table
-*******************************************************************
-*/
-#define IMPTABPROPS_COLUMNS 16
-#define IMPTABPROPS_RES (IMPTABPROPS_COLUMNS - 1)
-#define GET_STATEPROPS(cell) ((cell)&0x1f)
-#define GET_ACTIONPROPS(cell) ((cell)>>5)
-#define s(action, newState) ((uint8_t)(newState+(action<<5)))
-
-static const uint8_t groupProp[] = /* dirProp regrouped */
-{
-/* L R EN ES ET AN CS B S WS ON LRE LRO AL RLE RLO PDF NSM BN FSI LRI RLI PDI ENL ENR */
- 0, 1, 2, 7, 8, 3, 9, 6, 5, 4, 4, 10, 10, 12, 10, 10, 10, 11, 10, 4, 4, 4, 4, 13, 14
-};
-enum { DirProp_L=0, DirProp_R=1, DirProp_EN=2, DirProp_AN=3, DirProp_ON=4, DirProp_S=5, DirProp_B=6 }; /* reduced dirProp */
-
-/******************************************************************
-
- PROPERTIES STATE TABLE
-
- In table impTabProps,
- - the ON column regroups ON and WS, FSI, RLI, LRI and PDI
- - the BN column regroups BN, LRE, RLE, LRO, RLO, PDF
- - the Res column is the reduced property assigned to a run
-
- Action 1: process current run1, init new run1
- 2: init new run2
- 3: process run1, process run2, init new run1
- 4: process run1, set run1=run2, init new run2
-
- Notes:
- 1) This table is used in resolveImplicitLevels().
- 2) This table triggers actions when there is a change in the Bidi
- property of incoming characters (action 1).
- 3) Most such property sequences are processed immediately (in
- fact, passed to processPropertySeq().
- 4) However, numbers are assembled as one sequence. This means
- that undefined situations (like CS following digits, until
- it is known if the next char will be a digit) are held until
- following chars define them.
- Example: digits followed by CS, then comes another CS or ON;
- the digits will be processed, then the CS assigned
- as the start of an ON sequence (action 3).
- 5) There are cases where more than one sequence must be
- processed, for instance digits followed by CS followed by L:
- the digits must be processed as one sequence, and the CS
- must be processed as an ON sequence, all this before starting
- assembling chars for the opening L sequence.
-
-
-*/
-static const uint8_t impTabProps[][IMPTABPROPS_COLUMNS] =
-{
-/* L , R , EN , AN , ON , S , B , ES , ET , CS , BN , NSM , AL , ENL , ENR , Res */
-/* 0 Init */ { 1 , 2 , 4 , 5 , 7 , 15 , 17 , 7 , 9 , 7 , 0 , 7 , 3 , 18 , 21 , DirProp_ON },
-/* 1 L */ { 1 , s(1,2), s(1,4), s(1,5), s(1,7),s(1,15),s(1,17), s(1,7), s(1,9), s(1,7), 1 , 1 , s(1,3),s(1,18),s(1,21), DirProp_L },
-/* 2 R */ { s(1,1), 2 , s(1,4), s(1,5), s(1,7),s(1,15),s(1,17), s(1,7), s(1,9), s(1,7), 2 , 2 , s(1,3),s(1,18),s(1,21), DirProp_R },
-/* 3 AL */ { s(1,1), s(1,2), s(1,6), s(1,6), s(1,8),s(1,16),s(1,17), s(1,8), s(1,8), s(1,8), 3 , 3 , 3 ,s(1,18),s(1,21), DirProp_R },
-/* 4 EN */ { s(1,1), s(1,2), 4 , s(1,5), s(1,7),s(1,15),s(1,17),s(2,10), 11 ,s(2,10), 4 , 4 , s(1,3), 18 , 21 , DirProp_EN },
-/* 5 AN */ { s(1,1), s(1,2), s(1,4), 5 , s(1,7),s(1,15),s(1,17), s(1,7), s(1,9),s(2,12), 5 , 5 , s(1,3),s(1,18),s(1,21), DirProp_AN },
-/* 6 AL:EN/AN */ { s(1,1), s(1,2), 6 , 6 , s(1,8),s(1,16),s(1,17), s(1,8), s(1,8),s(2,13), 6 , 6 , s(1,3), 18 , 21 , DirProp_AN },
-/* 7 ON */ { s(1,1), s(1,2), s(1,4), s(1,5), 7 ,s(1,15),s(1,17), 7 ,s(2,14), 7 , 7 , 7 , s(1,3),s(1,18),s(1,21), DirProp_ON },
-/* 8 AL:ON */ { s(1,1), s(1,2), s(1,6), s(1,6), 8 ,s(1,16),s(1,17), 8 , 8 , 8 , 8 , 8 , s(1,3),s(1,18),s(1,21), DirProp_ON },
-/* 9 ET */ { s(1,1), s(1,2), 4 , s(1,5), 7 ,s(1,15),s(1,17), 7 , 9 , 7 , 9 , 9 , s(1,3), 18 , 21 , DirProp_ON },
-/*10 EN+ES/CS */ { s(3,1), s(3,2), 4 , s(3,5), s(4,7),s(3,15),s(3,17), s(4,7),s(4,14), s(4,7), 10 , s(4,7), s(3,3), 18 , 21 , DirProp_EN },
-/*11 EN+ET */ { s(1,1), s(1,2), 4 , s(1,5), s(1,7),s(1,15),s(1,17), s(1,7), 11 , s(1,7), 11 , 11 , s(1,3), 18 , 21 , DirProp_EN },
-/*12 AN+CS */ { s(3,1), s(3,2), s(3,4), 5 , s(4,7),s(3,15),s(3,17), s(4,7),s(4,14), s(4,7), 12 , s(4,7), s(3,3),s(3,18),s(3,21), DirProp_AN },
-/*13 AL:EN/AN+CS */ { s(3,1), s(3,2), 6 , 6 , s(4,8),s(3,16),s(3,17), s(4,8), s(4,8), s(4,8), 13 , s(4,8), s(3,3), 18 , 21 , DirProp_AN },
-/*14 ON+ET */ { s(1,1), s(1,2), s(4,4), s(1,5), 7 ,s(1,15),s(1,17), 7 , 14 , 7 , 14 , 14 , s(1,3),s(4,18),s(4,21), DirProp_ON },
-/*15 S */ { s(1,1), s(1,2), s(1,4), s(1,5), s(1,7), 15 ,s(1,17), s(1,7), s(1,9), s(1,7), 15 , s(1,7), s(1,3),s(1,18),s(1,21), DirProp_S },
-/*16 AL:S */ { s(1,1), s(1,2), s(1,6), s(1,6), s(1,8), 16 ,s(1,17), s(1,8), s(1,8), s(1,8), 16 , s(1,8), s(1,3),s(1,18),s(1,21), DirProp_S },
-/*17 B */ { s(1,1), s(1,2), s(1,4), s(1,5), s(1,7),s(1,15), 17 , s(1,7), s(1,9), s(1,7), 17 , s(1,7), s(1,3),s(1,18),s(1,21), DirProp_B },
-/*18 ENL */ { s(1,1), s(1,2), 18 , s(1,5), s(1,7),s(1,15),s(1,17),s(2,19), 20 ,s(2,19), 18 , 18 , s(1,3), 18 , 21 , DirProp_L },
-/*19 ENL+ES/CS */ { s(3,1), s(3,2), 18 , s(3,5), s(4,7),s(3,15),s(3,17), s(4,7),s(4,14), s(4,7), 19 , s(4,7), s(3,3), 18 , 21 , DirProp_L },
-/*20 ENL+ET */ { s(1,1), s(1,2), 18 , s(1,5), s(1,7),s(1,15),s(1,17), s(1,7), 20 , s(1,7), 20 , 20 , s(1,3), 18 , 21 , DirProp_L },
-/*21 ENR */ { s(1,1), s(1,2), 21 , s(1,5), s(1,7),s(1,15),s(1,17),s(2,22), 23 ,s(2,22), 21 , 21 , s(1,3), 18 , 21 , DirProp_AN },
-/*22 ENR+ES/CS */ { s(3,1), s(3,2), 21 , s(3,5), s(4,7),s(3,15),s(3,17), s(4,7),s(4,14), s(4,7), 22 , s(4,7), s(3,3), 18 , 21 , DirProp_AN },
-/*23 ENR+ET */ { s(1,1), s(1,2), 21 , s(1,5), s(1,7),s(1,15),s(1,17), s(1,7), 23 , s(1,7), 23 , 23 , s(1,3), 18 , 21 , DirProp_AN }
-};
-
-/* we must undef macro s because the levels tables have a different
- * structure (4 bits for action and 4 bits for next state.
- */
-#undef s
-
-/******************************************************************
- The levels state machine tables
-*******************************************************************
-
- All table cells are 8 bits:
- bits 0..3: next state
- bits 4..7: action to perform (if > 0)
-
- Cells may be of format "n" where n represents the next state
- (except for the rightmost column).
- Cells may also be of format "s(x,y)" where x represents an action
- to perform and y represents the next state.
-
- This format limits each table to 16 states each and to 15 actions.
-
-*******************************************************************
- Definitions and type for levels state tables
-*******************************************************************
-*/
-#define IMPTABLEVELS_COLUMNS (DirProp_B + 2)
-#define IMPTABLEVELS_RES (IMPTABLEVELS_COLUMNS - 1)
-#define GET_STATE(cell) ((cell)&0x0f)
-#define GET_ACTION(cell) ((cell)>>4)
-#define s(action, newState) ((uint8_t)(newState+(action<<4)))
-
-typedef uint8_t ImpTab[][IMPTABLEVELS_COLUMNS];
-typedef uint8_t ImpAct[];
-
-/* FOOD FOR THOUGHT: each ImpTab should have its associated ImpAct,
- * instead of having a pair of ImpTab and a pair of ImpAct.
- */
-typedef struct ImpTabPair {
- const void * pImpTab[2];
- const void * pImpAct[2];
-} ImpTabPair;
-
-/******************************************************************
-
- LEVELS STATE TABLES
-
- In all levels state tables,
- - state 0 is the initial state
- - the Res column is the increment to add to the text level
- for this property sequence.
-
- The impAct arrays for each table of a pair map the local action
- numbers of the table to the total list of actions. For instance,
- action 2 in a given table corresponds to the action number which
- appears in entry [2] of the impAct array for that table.
- The first entry of all impAct arrays must be 0.
-
- Action 1: init conditional sequence
- 2: prepend conditional sequence to current sequence
- 3: set ON sequence to new level - 1
- 4: init EN/AN/ON sequence
- 5: fix EN/AN/ON sequence followed by R
- 6: set previous level sequence to level 2
-
- Notes:
- 1) These tables are used in processPropertySeq(). The input
- is property sequences as determined by resolveImplicitLevels.
- 2) Most such property sequences are processed immediately
- (levels are assigned).
- 3) However, some sequences cannot be assigned a final level till
- one or more following sequences are received. For instance,
- ON following an R sequence within an even-level paragraph.
- If the following sequence is R, the ON sequence will be
- assigned basic run level+1, and so will the R sequence.
- 4) S is generally handled like ON, since its level will be fixed
- to paragraph level in adjustWSLevels().
-
-*/
-
-static const ImpTab impTabL_DEFAULT = /* Even paragraph level */
-/* In this table, conditional sequences receive the lower possible level
- until proven otherwise.
-*/
-{
-/* L , R , EN , AN , ON , S , B , Res */
-/* 0 : init */ { 0 , 1 , 0 , 2 , 0 , 0 , 0 , 0 },
-/* 1 : R */ { 0 , 1 , 3 , 3 , s(1,4), s(1,4), 0 , 1 },
-/* 2 : AN */ { 0 , 1 , 0 , 2 , s(1,5), s(1,5), 0 , 2 },
-/* 3 : R+EN/AN */ { 0 , 1 , 3 , 3 , s(1,4), s(1,4), 0 , 2 },
-/* 4 : R+ON */ { 0 , s(2,1), s(3,3), s(3,3), 4 , 4 , 0 , 0 },
-/* 5 : AN+ON */ { 0 , s(2,1), 0 , s(3,2), 5 , 5 , 0 , 0 }
-};
-static const ImpTab impTabR_DEFAULT = /* Odd paragraph level */
-/* In this table, conditional sequences receive the lower possible level
- until proven otherwise.
-*/
-{
-/* L , R , EN , AN , ON , S , B , Res */
-/* 0 : init */ { 1 , 0 , 2 , 2 , 0 , 0 , 0 , 0 },
-/* 1 : L */ { 1 , 0 , 1 , 3 , s(1,4), s(1,4), 0 , 1 },
-/* 2 : EN/AN */ { 1 , 0 , 2 , 2 , 0 , 0 , 0 , 1 },
-/* 3 : L+AN */ { 1 , 0 , 1 , 3 , 5 , 5 , 0 , 1 },
-/* 4 : L+ON */ { s(2,1), 0 , s(2,1), 3 , 4 , 4 , 0 , 0 },
-/* 5 : L+AN+ON */ { 1 , 0 , 1 , 3 , 5 , 5 , 0 , 0 }
-};
-static const ImpAct impAct0 = {0,1,2,3,4};
-static const ImpTabPair impTab_DEFAULT = {{&impTabL_DEFAULT,
- &impTabR_DEFAULT},
- {&impAct0, &impAct0}};
-
-static const ImpTab impTabL_NUMBERS_SPECIAL = /* Even paragraph level */
-/* In this table, conditional sequences receive the lower possible level
- until proven otherwise.
-*/
-{
-/* L , R , EN , AN , ON , S , B , Res */
-/* 0 : init */ { 0 , 2 , s(1,1), s(1,1), 0 , 0 , 0 , 0 },
-/* 1 : L+EN/AN */ { 0 , s(4,2), 1 , 1 , 0 , 0 , 0 , 0 },
-/* 2 : R */ { 0 , 2 , 4 , 4 , s(1,3), s(1,3), 0 , 1 },
-/* 3 : R+ON */ { 0 , s(2,2), s(3,4), s(3,4), 3 , 3 , 0 , 0 },
-/* 4 : R+EN/AN */ { 0 , 2 , 4 , 4 , s(1,3), s(1,3), 0 , 2 }
-};
-static const ImpTabPair impTab_NUMBERS_SPECIAL = {{&impTabL_NUMBERS_SPECIAL,
- &impTabR_DEFAULT},
- {&impAct0, &impAct0}};
-
-static const ImpTab impTabL_GROUP_NUMBERS_WITH_R =
-/* In this table, EN/AN+ON sequences receive levels as if associated with R
- until proven that there is L or sor/eor on both sides. AN is handled like EN.
-*/
-{
-/* L , R , EN , AN , ON , S , B , Res */
-/* 0 init */ { 0 , 3 , s(1,1), s(1,1), 0 , 0 , 0 , 0 },
-/* 1 EN/AN */ { s(2,0), 3 , 1 , 1 , 2 , s(2,0), s(2,0), 2 },
-/* 2 EN/AN+ON */ { s(2,0), 3 , 1 , 1 , 2 , s(2,0), s(2,0), 1 },
-/* 3 R */ { 0 , 3 , 5 , 5 , s(1,4), 0 , 0 , 1 },
-/* 4 R+ON */ { s(2,0), 3 , 5 , 5 , 4 , s(2,0), s(2,0), 1 },
-/* 5 R+EN/AN */ { 0 , 3 , 5 , 5 , s(1,4), 0 , 0 , 2 }
-};
-static const ImpTab impTabR_GROUP_NUMBERS_WITH_R =
-/* In this table, EN/AN+ON sequences receive levels as if associated with R
- until proven that there is L on both sides. AN is handled like EN.
-*/
-{
-/* L , R , EN , AN , ON , S , B , Res */
-/* 0 init */ { 2 , 0 , 1 , 1 , 0 , 0 , 0 , 0 },
-/* 1 EN/AN */ { 2 , 0 , 1 , 1 , 0 , 0 , 0 , 1 },
-/* 2 L */ { 2 , 0 , s(1,4), s(1,4), s(1,3), 0 , 0 , 1 },
-/* 3 L+ON */ { s(2,2), 0 , 4 , 4 , 3 , 0 , 0 , 0 },
-/* 4 L+EN/AN */ { s(2,2), 0 , 4 , 4 , 3 , 0 , 0 , 1 }
-};
-static const ImpTabPair impTab_GROUP_NUMBERS_WITH_R = {
- {&impTabL_GROUP_NUMBERS_WITH_R,
- &impTabR_GROUP_NUMBERS_WITH_R},
- {&impAct0, &impAct0}};
-
-
-static const ImpTab impTabL_INVERSE_NUMBERS_AS_L =
-/* This table is identical to the Default LTR table except that EN and AN are
- handled like L.
-*/
-{
-/* L , R , EN , AN , ON , S , B , Res */
-/* 0 : init */ { 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 },
-/* 1 : R */ { 0 , 1 , 0 , 0 , s(1,4), s(1,4), 0 , 1 },
-/* 2 : AN */ { 0 , 1 , 0 , 0 , s(1,5), s(1,5), 0 , 2 },
-/* 3 : R+EN/AN */ { 0 , 1 , 0 , 0 , s(1,4), s(1,4), 0 , 2 },
-/* 4 : R+ON */ { s(2,0), 1 , s(2,0), s(2,0), 4 , 4 , s(2,0), 1 },
-/* 5 : AN+ON */ { s(2,0), 1 , s(2,0), s(2,0), 5 , 5 , s(2,0), 1 }
-};
-static const ImpTab impTabR_INVERSE_NUMBERS_AS_L =
-/* This table is identical to the Default RTL table except that EN and AN are
- handled like L.
-*/
-{
-/* L , R , EN , AN , ON , S , B , Res */
-/* 0 : init */ { 1 , 0 , 1 , 1 , 0 , 0 , 0 , 0 },
-/* 1 : L */ { 1 , 0 , 1 , 1 , s(1,4), s(1,4), 0 , 1 },
-/* 2 : EN/AN */ { 1 , 0 , 1 , 1 , 0 , 0 , 0 , 1 },
-/* 3 : L+AN */ { 1 , 0 , 1 , 1 , 5 , 5 , 0 , 1 },
-/* 4 : L+ON */ { s(2,1), 0 , s(2,1), s(2,1), 4 , 4 , 0 , 0 },
-/* 5 : L+AN+ON */ { 1 , 0 , 1 , 1 , 5 , 5 , 0 , 0 }
-};
-static const ImpTabPair impTab_INVERSE_NUMBERS_AS_L = {
- {&impTabL_INVERSE_NUMBERS_AS_L,
- &impTabR_INVERSE_NUMBERS_AS_L},
- {&impAct0, &impAct0}};
-
-static const ImpTab impTabR_INVERSE_LIKE_DIRECT = /* Odd paragraph level */
-/* In this table, conditional sequences receive the lower possible level
- until proven otherwise.
-*/
-{
-/* L , R , EN , AN , ON , S , B , Res */
-/* 0 : init */ { 1 , 0 , 2 , 2 , 0 , 0 , 0 , 0 },
-/* 1 : L */ { 1 , 0 , 1 , 2 , s(1,3), s(1,3), 0 , 1 },
-/* 2 : EN/AN */ { 1 , 0 , 2 , 2 , 0 , 0 , 0 , 1 },
-/* 3 : L+ON */ { s(2,1), s(3,0), 6 , 4 , 3 , 3 , s(3,0), 0 },
-/* 4 : L+ON+AN */ { s(2,1), s(3,0), 6 , 4 , 5 , 5 , s(3,0), 3 },
-/* 5 : L+AN+ON */ { s(2,1), s(3,0), 6 , 4 , 5 , 5 , s(3,0), 2 },
-/* 6 : L+ON+EN */ { s(2,1), s(3,0), 6 , 4 , 3 , 3 , s(3,0), 1 }
-};
-static const ImpAct impAct1 = {0,1,13,14};
-/* FOOD FOR THOUGHT: in LTR table below, check case "JKL 123abc"
- */
-static const ImpTabPair impTab_INVERSE_LIKE_DIRECT = {
- {&impTabL_DEFAULT,
- &impTabR_INVERSE_LIKE_DIRECT},
- {&impAct0, &impAct1}};
-
-static const ImpTab impTabL_INVERSE_LIKE_DIRECT_WITH_MARKS =
-/* The case handled in this table is (visually): R EN L
-*/
-{
-/* L , R , EN , AN , ON , S , B , Res */
-/* 0 : init */ { 0 , s(6,3), 0 , 1 , 0 , 0 , 0 , 0 },
-/* 1 : L+AN */ { 0 , s(6,3), 0 , 1 , s(1,2), s(3,0), 0 , 4 },
-/* 2 : L+AN+ON */ { s(2,0), s(6,3), s(2,0), 1 , 2 , s(3,0), s(2,0), 3 },
-/* 3 : R */ { 0 , s(6,3), s(5,5), s(5,6), s(1,4), s(3,0), 0 , 3 },
-/* 4 : R+ON */ { s(3,0), s(4,3), s(5,5), s(5,6), 4 , s(3,0), s(3,0), 3 },
-/* 5 : R+EN */ { s(3,0), s(4,3), 5 , s(5,6), s(1,4), s(3,0), s(3,0), 4 },
-/* 6 : R+AN */ { s(3,0), s(4,3), s(5,5), 6 , s(1,4), s(3,0), s(3,0), 4 }
-};
-static const ImpTab impTabR_INVERSE_LIKE_DIRECT_WITH_MARKS =
-/* The cases handled in this table are (visually): R EN L
- R L AN L
-*/
-{
-/* L , R , EN , AN , ON , S , B , Res */
-/* 0 : init */ { s(1,3), 0 , 1 , 1 , 0 , 0 , 0 , 0 },
-/* 1 : R+EN/AN */ { s(2,3), 0 , 1 , 1 , 2 , s(4,0), 0 , 1 },
-/* 2 : R+EN/AN+ON */ { s(2,3), 0 , 1 , 1 , 2 , s(4,0), 0 , 0 },
-/* 3 : L */ { 3 , 0 , 3 , s(3,6), s(1,4), s(4,0), 0 , 1 },
-/* 4 : L+ON */ { s(5,3), s(4,0), 5 , s(3,6), 4 , s(4,0), s(4,0), 0 },
-/* 5 : L+ON+EN */ { s(5,3), s(4,0), 5 , s(3,6), 4 , s(4,0), s(4,0), 1 },
-/* 6 : L+AN */ { s(5,3), s(4,0), 6 , 6 , 4 , s(4,0), s(4,0), 3 }
-};
-static const ImpAct impAct2 = {0,1,2,5,6,7,8};
-static const ImpAct impAct3 = {0,1,9,10,11,12};
-static const ImpTabPair impTab_INVERSE_LIKE_DIRECT_WITH_MARKS = {
- {&impTabL_INVERSE_LIKE_DIRECT_WITH_MARKS,
- &impTabR_INVERSE_LIKE_DIRECT_WITH_MARKS},
- {&impAct2, &impAct3}};
-
-static const ImpTabPair impTab_INVERSE_FOR_NUMBERS_SPECIAL = {
- {&impTabL_NUMBERS_SPECIAL,
- &impTabR_INVERSE_LIKE_DIRECT},
- {&impAct0, &impAct1}};
-
-static const ImpTab impTabL_INVERSE_FOR_NUMBERS_SPECIAL_WITH_MARKS =
-/* The case handled in this table is (visually): R EN L
-*/
-{
-/* L , R , EN , AN , ON , S , B , Res */
-/* 0 : init */ { 0 , s(6,2), 1 , 1 , 0 , 0 , 0 , 0 },
-/* 1 : L+EN/AN */ { 0 , s(6,2), 1 , 1 , 0 , s(3,0), 0 , 4 },
-/* 2 : R */ { 0 , s(6,2), s(5,4), s(5,4), s(1,3), s(3,0), 0 , 3 },
-/* 3 : R+ON */ { s(3,0), s(4,2), s(5,4), s(5,4), 3 , s(3,0), s(3,0), 3 },
-/* 4 : R+EN/AN */ { s(3,0), s(4,2), 4 , 4 , s(1,3), s(3,0), s(3,0), 4 }
-};
-static const ImpTabPair impTab_INVERSE_FOR_NUMBERS_SPECIAL_WITH_MARKS = {
- {&impTabL_INVERSE_FOR_NUMBERS_SPECIAL_WITH_MARKS,
- &impTabR_INVERSE_LIKE_DIRECT_WITH_MARKS},
- {&impAct2, &impAct3}};
-
-#undef s
-
-typedef struct {
- const ImpTab * pImpTab; /* level table pointer */
- const ImpAct * pImpAct; /* action map array */
- int32_t startON; /* start of ON sequence */
- int32_t startL2EN; /* start of level 2 sequence */
- int32_t lastStrongRTL; /* index of last found R or AL */
- int32_t state; /* current state */
- int32_t runStart; /* start position of the run */
- UBiDiLevel runLevel; /* run level before implicit solving */
-} LevState;
-
-/*------------------------------------------------------------------------*/
-
-static void
-addPoint(UBiDi *pBiDi, int32_t pos, int32_t flag)
- /* param pos: position where to insert
- param flag: one of LRM_BEFORE, LRM_AFTER, RLM_BEFORE, RLM_AFTER
- */
-{
-#define FIRSTALLOC 10
- Point point;
- InsertPoints * pInsertPoints=&(pBiDi->insertPoints);
-
- if (pInsertPoints->capacity == 0)
- {
- pInsertPoints->points=static_cast<Point *>(uprv_malloc(sizeof(Point)*FIRSTALLOC));
- if (pInsertPoints->points == NULL)
- {
- pInsertPoints->errorCode=U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- pInsertPoints->capacity=FIRSTALLOC;
- }
- if (pInsertPoints->size >= pInsertPoints->capacity) /* no room for new point */
- {
- Point * savePoints=pInsertPoints->points;
- pInsertPoints->points=static_cast<Point *>(uprv_realloc(pInsertPoints->points,
- pInsertPoints->capacity*2*sizeof(Point)));
- if (pInsertPoints->points == NULL)
- {
- pInsertPoints->points=savePoints;
- pInsertPoints->errorCode=U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- else pInsertPoints->capacity*=2;
- }
- point.pos=pos;
- point.flag=flag;
- pInsertPoints->points[pInsertPoints->size]=point;
- pInsertPoints->size++;
-#undef FIRSTALLOC
-}
-
-static void
-setLevelsOutsideIsolates(UBiDi *pBiDi, int32_t start, int32_t limit, UBiDiLevel level)
-{
- DirProp *dirProps=pBiDi->dirProps, dirProp;
- UBiDiLevel *levels=pBiDi->levels;
- int32_t isolateCount=0, k;
- for(k=start; k<limit; k++) {
- dirProp=dirProps[k];
- if(dirProp==PDI)
- isolateCount--;
- if(isolateCount==0)
- levels[k]=level;
- if(dirProp==LRI || dirProp==RLI)
- isolateCount++;
- }
-}
-
-/* perform rules (Wn), (Nn), and (In) on a run of the text ------------------ */
-
-/*
- * This implementation of the (Wn) rules applies all rules in one pass.
- * In order to do so, it needs a look-ahead of typically 1 character
- * (except for W5: sequences of ET) and keeps track of changes
- * in a rule Wp that affect a later Wq (p<q).
- *
- * The (Nn) and (In) rules are also performed in that same single loop,
- * but effectively one iteration behind for white space.
- *
- * Since all implicit rules are performed in one step, it is not necessary
- * to actually store the intermediate directional properties in dirProps[].
- */
-
-static void
-processPropertySeq(UBiDi *pBiDi, LevState *pLevState, uint8_t _prop,
- int32_t start, int32_t limit) {
- uint8_t cell, oldStateSeq, actionSeq;
- const ImpTab * pImpTab=pLevState->pImpTab;
- const ImpAct * pImpAct=pLevState->pImpAct;
- UBiDiLevel * levels=pBiDi->levels;
- UBiDiLevel level, addLevel;
- InsertPoints * pInsertPoints;
- int32_t start0, k;
-
- start0=start; /* save original start position */
- oldStateSeq=(uint8_t)pLevState->state;
- cell=(*pImpTab)[oldStateSeq][_prop];
- pLevState->state=GET_STATE(cell); /* isolate the new state */
- actionSeq=(*pImpAct)[GET_ACTION(cell)]; /* isolate the action */
- addLevel=(*pImpTab)[pLevState->state][IMPTABLEVELS_RES];
-
- if(actionSeq) {
- switch(actionSeq) {
- case 1: /* init ON seq */
- pLevState->startON=start0;
- break;
-
- case 2: /* prepend ON seq to current seq */
- start=pLevState->startON;
- break;
-
- case 3: /* EN/AN after R+ON */
- level=pLevState->runLevel+1;
- setLevelsOutsideIsolates(pBiDi, pLevState->startON, start0, level);
- break;
-
- case 4: /* EN/AN before R for NUMBERS_SPECIAL */
- level=pLevState->runLevel+2;
- setLevelsOutsideIsolates(pBiDi, pLevState->startON, start0, level);
- break;
-
- case 5: /* L or S after possible relevant EN/AN */
- /* check if we had EN after R/AL */
- if (pLevState->startL2EN >= 0) {
- addPoint(pBiDi, pLevState->startL2EN, LRM_BEFORE);
- }
- pLevState->startL2EN=-1; /* not within previous if since could also be -2 */
- /* check if we had any relevant EN/AN after R/AL */
- pInsertPoints=&(pBiDi->insertPoints);
- if ((pInsertPoints->capacity == 0) ||
- (pInsertPoints->size <= pInsertPoints->confirmed))
- {
- /* nothing, just clean up */
- pLevState->lastStrongRTL=-1;
- /* check if we have a pending conditional segment */
- level=(*pImpTab)[oldStateSeq][IMPTABLEVELS_RES];
- if ((level & 1) && (pLevState->startON > 0)) { /* after ON */
- start=pLevState->startON; /* reset to basic run level */
- }
- if (_prop == DirProp_S) /* add LRM before S */
- {
- addPoint(pBiDi, start0, LRM_BEFORE);
- pInsertPoints->confirmed=pInsertPoints->size;
- }
- break;
- }
- /* reset previous RTL cont to level for LTR text */
- for (k=pLevState->lastStrongRTL+1; k<start0; k++)
- {
- /* reset odd level, leave runLevel+2 as is */
- levels[k]=(levels[k] - 2) & ~1;
- }
- /* mark insert points as confirmed */
- pInsertPoints->confirmed=pInsertPoints->size;
- pLevState->lastStrongRTL=-1;
- if (_prop == DirProp_S) /* add LRM before S */
- {
- addPoint(pBiDi, start0, LRM_BEFORE);
- pInsertPoints->confirmed=pInsertPoints->size;
- }
- break;
-
- case 6: /* R/AL after possible relevant EN/AN */
- /* just clean up */
- pInsertPoints=&(pBiDi->insertPoints);
- if (pInsertPoints->capacity > 0)
- /* remove all non confirmed insert points */
- pInsertPoints->size=pInsertPoints->confirmed;
- pLevState->startON=-1;
- pLevState->startL2EN=-1;
- pLevState->lastStrongRTL=limit - 1;
- break;
-
- case 7: /* EN/AN after R/AL + possible cont */
- /* check for real AN */
- if ((_prop == DirProp_AN) && (pBiDi->dirProps[start0] == AN) &&
- (pBiDi->reorderingMode!=UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL))
- {
- /* real AN */
- if (pLevState->startL2EN == -1) /* if no relevant EN already found */
- {
- /* just note the righmost digit as a strong RTL */
- pLevState->lastStrongRTL=limit - 1;
- break;
- }
- if (pLevState->startL2EN >= 0) /* after EN, no AN */
- {
- addPoint(pBiDi, pLevState->startL2EN, LRM_BEFORE);
- pLevState->startL2EN=-2;
- }
- /* note AN */
- addPoint(pBiDi, start0, LRM_BEFORE);
- break;
- }
- /* if first EN/AN after R/AL */
- if (pLevState->startL2EN == -1) {
- pLevState->startL2EN=start0;
- }
- break;
-
- case 8: /* note location of latest R/AL */
- pLevState->lastStrongRTL=limit - 1;
- pLevState->startON=-1;
- break;
-
- case 9: /* L after R+ON/EN/AN */
- /* include possible adjacent number on the left */
- for (k=start0-1; k>=0 && !(levels[k]&1); k--);
- if(k>=0) {
- addPoint(pBiDi, k, RLM_BEFORE); /* add RLM before */
- pInsertPoints=&(pBiDi->insertPoints);
- pInsertPoints->confirmed=pInsertPoints->size; /* confirm it */
- }
- pLevState->startON=start0;
- break;
-
- case 10: /* AN after L */
- /* AN numbers between L text on both sides may be trouble. */
- /* tentatively bracket with LRMs; will be confirmed if followed by L */
- addPoint(pBiDi, start0, LRM_BEFORE); /* add LRM before */
- addPoint(pBiDi, start0, LRM_AFTER); /* add LRM after */
- break;
-
- case 11: /* R after L+ON/EN/AN */
- /* false alert, infirm LRMs around previous AN */
- pInsertPoints=&(pBiDi->insertPoints);
- pInsertPoints->size=pInsertPoints->confirmed;
- if (_prop == DirProp_S) /* add RLM before S */
- {
- addPoint(pBiDi, start0, RLM_BEFORE);
- pInsertPoints->confirmed=pInsertPoints->size;
- }
- break;
-
- case 12: /* L after L+ON/AN */
- level=pLevState->runLevel + addLevel;
- for(k=pLevState->startON; k<start0; k++) {
- if (levels[k]<level)
- levels[k]=level;
- }
- pInsertPoints=&(pBiDi->insertPoints);
- pInsertPoints->confirmed=pInsertPoints->size; /* confirm inserts */
- pLevState->startON=start0;
- break;
-
- case 13: /* L after L+ON+EN/AN/ON */
- level=pLevState->runLevel;
- for(k=start0-1; k>=pLevState->startON; k--) {
- if(levels[k]==level+3) {
- while(levels[k]==level+3) {
- levels[k--]-=2;
- }
- while(levels[k]==level) {
- k--;
- }
- }
- if(levels[k]==level+2) {
- levels[k]=level;
- continue;
- }
- levels[k]=level+1;
- }
- break;
-
- case 14: /* R after L+ON+EN/AN/ON */
- level=pLevState->runLevel+1;
- for(k=start0-1; k>=pLevState->startON; k--) {
- if(levels[k]>level) {
- levels[k]-=2;
- }
- }
- break;
-
- default: /* we should never get here */
- UPRV_UNREACHABLE;
- }
- }
- if((addLevel) || (start < start0)) {
- level=pLevState->runLevel + addLevel;
- if(start>=pLevState->runStart) {
- for(k=start; k<limit; k++) {
- levels[k]=level;
- }
- } else {
- setLevelsOutsideIsolates(pBiDi, start, limit, level);
- }
- }
-}
-
-/**
- * Returns the directionality of the last strong character at the end of the prologue, if any.
- * Requires prologue!=null.
- */
-static DirProp
-lastL_R_AL(UBiDi *pBiDi) {
- const UChar *text=pBiDi->prologue;
- int32_t length=pBiDi->proLength;
- int32_t i;
- UChar32 uchar;
- DirProp dirProp;
- for(i=length; i>0; ) {
- /* i is decremented by U16_PREV */
- U16_PREV(text, 0, i, uchar);
- dirProp=(DirProp)ubidi_getCustomizedClass(pBiDi, uchar);
- if(dirProp==L) {
- return DirProp_L;
- }
- if(dirProp==R || dirProp==AL) {
- return DirProp_R;
- }
- if(dirProp==B) {
- return DirProp_ON;
- }
- }
- return DirProp_ON;
-}
-
-/**
- * Returns the directionality of the first strong character, or digit, in the epilogue, if any.
- * Requires epilogue!=null.
- */
-static DirProp
-firstL_R_AL_EN_AN(UBiDi *pBiDi) {
- const UChar *text=pBiDi->epilogue;
- int32_t length=pBiDi->epiLength;
- int32_t i;
- UChar32 uchar;
- DirProp dirProp;
- for(i=0; i<length; ) {
- /* i is incremented by U16_NEXT */
- U16_NEXT(text, i, length, uchar);
- dirProp=(DirProp)ubidi_getCustomizedClass(pBiDi, uchar);
- if(dirProp==L) {
- return DirProp_L;
- }
- if(dirProp==R || dirProp==AL) {
- return DirProp_R;
- }
- if(dirProp==EN) {
- return DirProp_EN;
- }
- if(dirProp==AN) {
- return DirProp_AN;
- }
- }
- return DirProp_ON;
-}
-
-static void
-resolveImplicitLevels(UBiDi *pBiDi,
- int32_t start, int32_t limit,
- DirProp sor, DirProp eor) {
- const DirProp *dirProps=pBiDi->dirProps;
- DirProp dirProp;
- LevState levState;
- int32_t i, start1, start2;
- uint16_t oldStateImp, stateImp, actionImp;
- uint8_t gprop, resProp, cell;
- UBool inverseRTL;
- DirProp nextStrongProp=R;
- int32_t nextStrongPos=-1;
-
- /* check for RTL inverse BiDi mode */
- /* FOOD FOR THOUGHT: in case of RTL inverse BiDi, it would make sense to
- * loop on the text characters from end to start.
- * This would need a different properties state table (at least different
- * actions) and different levels state tables (maybe very similar to the
- * LTR corresponding ones.
- */
- inverseRTL=(UBool)
- ((start<pBiDi->lastArabicPos) && (GET_PARALEVEL(pBiDi, start) & 1) &&
- (pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_LIKE_DIRECT ||
- pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL));
-
- /* initialize for property and levels state tables */
- levState.startL2EN=-1; /* used for INVERSE_LIKE_DIRECT_WITH_MARKS */
- levState.lastStrongRTL=-1; /* used for INVERSE_LIKE_DIRECT_WITH_MARKS */
- levState.runStart=start;
- levState.runLevel=pBiDi->levels[start];
- levState.pImpTab=(const ImpTab*)((pBiDi->pImpTabPair)->pImpTab)[levState.runLevel&1];
- levState.pImpAct=(const ImpAct*)((pBiDi->pImpTabPair)->pImpAct)[levState.runLevel&1];
- if(start==0 && pBiDi->proLength>0) {
- DirProp lastStrong=lastL_R_AL(pBiDi);
- if(lastStrong!=DirProp_ON) {
- sor=lastStrong;
- }
- }
- /* The isolates[] entries contain enough information to
- resume the bidi algorithm in the same state as it was
- when it was interrupted by an isolate sequence. */
- if(dirProps[start]==PDI && pBiDi->isolateCount >= 0) {
- levState.startON=pBiDi->isolates[pBiDi->isolateCount].startON;
- start1=pBiDi->isolates[pBiDi->isolateCount].start1;
- stateImp=pBiDi->isolates[pBiDi->isolateCount].stateImp;
- levState.state=pBiDi->isolates[pBiDi->isolateCount].state;
- pBiDi->isolateCount--;
- } else {
- levState.startON=-1;
- start1=start;
- if(dirProps[start]==NSM)
- stateImp = 1 + sor;
- else
- stateImp=0;
- levState.state=0;
- processPropertySeq(pBiDi, &levState, sor, start, start);
- }
- start2=start; /* to make Java compiler happy */
-
- for(i=start; i<=limit; i++) {
- if(i>=limit) {
- int32_t k;
- for(k=limit-1; k>start&&(DIRPROP_FLAG(dirProps[k])&MASK_BN_EXPLICIT); k--);
- dirProp=dirProps[k];
- if(dirProp==LRI || dirProp==RLI)
- break; /* no forced closing for sequence ending with LRI/RLI */
- gprop=eor;
- } else {
- DirProp prop, prop1;
- prop=dirProps[i];
- if(prop==B) {
- pBiDi->isolateCount=-1; /* current isolates stack entry == none */
- }
- if(inverseRTL) {
- if(prop==AL) {
- /* AL before EN does not make it AN */
- prop=R;
- } else if(prop==EN) {
- if(nextStrongPos<=i) {
- /* look for next strong char (L/R/AL) */
- int32_t j;
- nextStrongProp=R; /* set default */
- nextStrongPos=limit;
- for(j=i+1; j<limit; j++) {
- prop1=dirProps[j];
- if(prop1==L || prop1==R || prop1==AL) {
- nextStrongProp=prop1;
- nextStrongPos=j;
- break;
- }
- }
- }
- if(nextStrongProp==AL) {
- prop=AN;
- }
- }
- }
- gprop=groupProp[prop];
- }
- oldStateImp=stateImp;
- cell=impTabProps[oldStateImp][gprop];
- stateImp=GET_STATEPROPS(cell); /* isolate the new state */
- actionImp=GET_ACTIONPROPS(cell); /* isolate the action */
- if((i==limit) && (actionImp==0)) {
- /* there is an unprocessed sequence if its property == eor */
- actionImp=1; /* process the last sequence */
- }
- if(actionImp) {
- resProp=impTabProps[oldStateImp][IMPTABPROPS_RES];
- switch(actionImp) {
- case 1: /* process current seq1, init new seq1 */
- processPropertySeq(pBiDi, &levState, resProp, start1, i);
- start1=i;
- break;
- case 2: /* init new seq2 */
- start2=i;
- break;
- case 3: /* process seq1, process seq2, init new seq1 */
- processPropertySeq(pBiDi, &levState, resProp, start1, start2);
- processPropertySeq(pBiDi, &levState, DirProp_ON, start2, i);
- start1=i;
- break;
- case 4: /* process seq1, set seq1=seq2, init new seq2 */
- processPropertySeq(pBiDi, &levState, resProp, start1, start2);
- start1=start2;
- start2=i;
- break;
- default: /* we should never get here */
- UPRV_UNREACHABLE;
- }
- }
- }
-
- /* flush possible pending sequence, e.g. ON */
- if(limit==pBiDi->length && pBiDi->epiLength>0) {
- DirProp firstStrong=firstL_R_AL_EN_AN(pBiDi);
- if(firstStrong!=DirProp_ON) {
- eor=firstStrong;
- }
- }
-
- /* look for the last char not a BN or LRE/RLE/LRO/RLO/PDF */
- for(i=limit-1; i>start&&(DIRPROP_FLAG(dirProps[i])&MASK_BN_EXPLICIT); i--);
- dirProp=dirProps[i];
- if((dirProp==LRI || dirProp==RLI) && limit<pBiDi->length) {
- pBiDi->isolateCount++;
- pBiDi->isolates[pBiDi->isolateCount].stateImp=stateImp;
- pBiDi->isolates[pBiDi->isolateCount].state=levState.state;
- pBiDi->isolates[pBiDi->isolateCount].start1=start1;
- pBiDi->isolates[pBiDi->isolateCount].startON=levState.startON;
- }
- else
- processPropertySeq(pBiDi, &levState, eor, limit, limit);
-}
-
-/* perform (L1) and (X9) ---------------------------------------------------- */
-
-/*
- * Reset the embedding levels for some non-graphic characters (L1).
- * This function also sets appropriate levels for BN, and
- * explicit embedding types that are supposed to have been removed
- * from the paragraph in (X9).
- */
-static void
-adjustWSLevels(UBiDi *pBiDi) {
- const DirProp *dirProps=pBiDi->dirProps;
- UBiDiLevel *levels=pBiDi->levels;
- int32_t i;
-
- if(pBiDi->flags&MASK_WS) {
- UBool orderParagraphsLTR=pBiDi->orderParagraphsLTR;
- Flags flag;
-
- i=pBiDi->trailingWSStart;
- while(i>0) {
- /* reset a sequence of WS/BN before eop and B/S to the paragraph paraLevel */
- while(i>0 && (flag=DIRPROP_FLAG(dirProps[--i]))&MASK_WS) {
- if(orderParagraphsLTR&&(flag&DIRPROP_FLAG(B))) {
- levels[i]=0;
- } else {
- levels[i]=GET_PARALEVEL(pBiDi, i);
- }
- }
-
- /* reset BN to the next character's paraLevel until B/S, which restarts above loop */
- /* here, i+1 is guaranteed to be <length */
- while(i>0) {
- flag=DIRPROP_FLAG(dirProps[--i]);
- if(flag&MASK_BN_EXPLICIT) {
- levels[i]=levels[i+1];
- } else if(orderParagraphsLTR&&(flag&DIRPROP_FLAG(B))) {
- levels[i]=0;
- break;
- } else if(flag&MASK_B_S) {
- levels[i]=GET_PARALEVEL(pBiDi, i);
- break;
- }
- }
- }
- }
-}
-
-U_CAPI void U_EXPORT2
-ubidi_setContext(UBiDi *pBiDi,
- const UChar *prologue, int32_t proLength,
- const UChar *epilogue, int32_t epiLength,
- UErrorCode *pErrorCode) {
- /* check the argument values */
- RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
- if(pBiDi==NULL || proLength<-1 || epiLength<-1 ||
- (prologue==NULL && proLength!=0) || (epilogue==NULL && epiLength!=0)) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- if(proLength==-1) {
- pBiDi->proLength=u_strlen(prologue);
- } else {
- pBiDi->proLength=proLength;
- }
- if(epiLength==-1) {
- pBiDi->epiLength=u_strlen(epilogue);
- } else {
- pBiDi->epiLength=epiLength;
- }
- pBiDi->prologue=prologue;
- pBiDi->epilogue=epilogue;
-}
-
-static void
-setParaSuccess(UBiDi *pBiDi) {
- pBiDi->proLength=0; /* forget the last context */
- pBiDi->epiLength=0;
- pBiDi->pParaBiDi=pBiDi; /* mark successful setPara */
-}
-
-#define BIDI_MIN(x, y) ((x)<(y) ? (x) : (y))
-#define BIDI_ABS(x) ((x)>=0 ? (x) : (-(x)))
-
-static void
-setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length,
- UBiDiLevel paraLevel, UErrorCode *pErrorCode) {
- int32_t *runsOnlyMemory = NULL;
- int32_t *visualMap;
- UChar *visualText;
- int32_t saveLength, saveTrailingWSStart;
- const UBiDiLevel *levels;
- UBiDiLevel *saveLevels;
- UBiDiDirection saveDirection;
- UBool saveMayAllocateText;
- Run *runs;
- int32_t visualLength, i, j, visualStart, logicalStart,
- runCount, runLength, addedRuns, insertRemove,
- start, limit, step, indexOddBit, logicalPos,
- index0, index1;
- uint32_t saveOptions;
-
- pBiDi->reorderingMode=UBIDI_REORDER_DEFAULT;
- if(length==0) {
- ubidi_setPara(pBiDi, text, length, paraLevel, NULL, pErrorCode);
- goto cleanup3;
- }
- /* obtain memory for mapping table and visual text */
- runsOnlyMemory=static_cast<int32_t *>(uprv_malloc(length*(sizeof(int32_t)+sizeof(UChar)+sizeof(UBiDiLevel))));
- if(runsOnlyMemory==NULL) {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- goto cleanup3;
- }
- visualMap=runsOnlyMemory;
- visualText=(UChar *)&visualMap[length];
- saveLevels=(UBiDiLevel *)&visualText[length];
- saveOptions=pBiDi->reorderingOptions;
- if(saveOptions & UBIDI_OPTION_INSERT_MARKS) {
- pBiDi->reorderingOptions&=~UBIDI_OPTION_INSERT_MARKS;
- pBiDi->reorderingOptions|=UBIDI_OPTION_REMOVE_CONTROLS;
- }
- paraLevel&=1; /* accept only 0 or 1 */
- ubidi_setPara(pBiDi, text, length, paraLevel, NULL, pErrorCode);
- if(U_FAILURE(*pErrorCode)) {
- goto cleanup3;
- }
- /* we cannot access directly pBiDi->levels since it is not yet set if
- * direction is not MIXED
- */
- levels=ubidi_getLevels(pBiDi, pErrorCode);
- uprv_memcpy(saveLevels, levels, (size_t)pBiDi->length*sizeof(UBiDiLevel));
- saveTrailingWSStart=pBiDi->trailingWSStart;
- saveLength=pBiDi->length;
- saveDirection=pBiDi->direction;
-
- /* FOOD FOR THOUGHT: instead of writing the visual text, we could use
- * the visual map and the dirProps array to drive the second call
- * to ubidi_setPara (but must make provision for possible removal of
- * BiDi controls. Alternatively, only use the dirProps array via
- * customized classifier callback.
- */
- visualLength=ubidi_writeReordered(pBiDi, visualText, length,
- UBIDI_DO_MIRRORING, pErrorCode);
- ubidi_getVisualMap(pBiDi, visualMap, pErrorCode);
- if(U_FAILURE(*pErrorCode)) {
- goto cleanup2;
- }
- pBiDi->reorderingOptions=saveOptions;
-
- pBiDi->reorderingMode=UBIDI_REORDER_INVERSE_LIKE_DIRECT;
- paraLevel^=1;
- /* Because what we did with reorderingOptions, visualText may be shorter
- * than the original text. But we don't want the levels memory to be
- * reallocated shorter than the original length, since we need to restore
- * the levels as after the first call to ubidi_setpara() before returning.
- * We will force mayAllocateText to FALSE before the second call to
- * ubidi_setpara(), and will restore it afterwards.
- */
- saveMayAllocateText=pBiDi->mayAllocateText;
- pBiDi->mayAllocateText=FALSE;
- ubidi_setPara(pBiDi, visualText, visualLength, paraLevel, NULL, pErrorCode);
- pBiDi->mayAllocateText=saveMayAllocateText;
- ubidi_getRuns(pBiDi, pErrorCode);
- if(U_FAILURE(*pErrorCode)) {
- goto cleanup1;
- }
- /* check if some runs must be split, count how many splits */
- addedRuns=0;
- runCount=pBiDi->runCount;
- runs=pBiDi->runs;
- visualStart=0;
- for(i=0; i<runCount; i++, visualStart+=runLength) {
- runLength=runs[i].visualLimit-visualStart;
- if(runLength<2) {
- continue;
- }
- logicalStart=GET_INDEX(runs[i].logicalStart);
- for(j=logicalStart+1; j<logicalStart+runLength; j++) {
- index0=visualMap[j];
- index1=visualMap[j-1];
- if((BIDI_ABS(index0-index1)!=1) || (saveLevels[index0]!=saveLevels[index1])) {
- addedRuns++;
- }
- }
- }
- if(addedRuns) {
- if(getRunsMemory(pBiDi, runCount+addedRuns)) {
- if(runCount==1) {
- /* because we switch from UBiDi.simpleRuns to UBiDi.runs */
- pBiDi->runsMemory[0]=runs[0];
- }
- runs=pBiDi->runs=pBiDi->runsMemory;
- pBiDi->runCount+=addedRuns;
- } else {
- goto cleanup1;
- }
- }
- /* split runs which are not consecutive in source text */
- for(i=runCount-1; i>=0; i--) {
- runLength= i==0 ? runs[0].visualLimit :
- runs[i].visualLimit-runs[i-1].visualLimit;
- logicalStart=runs[i].logicalStart;
- indexOddBit=GET_ODD_BIT(logicalStart);
- logicalStart=GET_INDEX(logicalStart);
- if(runLength<2) {
- if(addedRuns) {
- runs[i+addedRuns]=runs[i];
- }
- logicalPos=visualMap[logicalStart];
- runs[i+addedRuns].logicalStart=MAKE_INDEX_ODD_PAIR(logicalPos,
- saveLevels[logicalPos]^indexOddBit);
- continue;
- }
- if(indexOddBit) {
- start=logicalStart;
- limit=logicalStart+runLength-1;
- step=1;
- } else {
- start=logicalStart+runLength-1;
- limit=logicalStart;
- step=-1;
- }
- for(j=start; j!=limit; j+=step) {
- index0=visualMap[j];
- index1=visualMap[j+step];
- if((BIDI_ABS(index0-index1)!=1) || (saveLevels[index0]!=saveLevels[index1])) {
- logicalPos=BIDI_MIN(visualMap[start], index0);
- runs[i+addedRuns].logicalStart=MAKE_INDEX_ODD_PAIR(logicalPos,
- saveLevels[logicalPos]^indexOddBit);
- runs[i+addedRuns].visualLimit=runs[i].visualLimit;
- runs[i].visualLimit-=BIDI_ABS(j-start)+1;
- insertRemove=runs[i].insertRemove&(LRM_AFTER|RLM_AFTER);
- runs[i+addedRuns].insertRemove=insertRemove;
- runs[i].insertRemove&=~insertRemove;
- start=j+step;
- addedRuns--;
- }
- }
- if(addedRuns) {
- runs[i+addedRuns]=runs[i];
- }
- logicalPos=BIDI_MIN(visualMap[start], visualMap[limit]);
- runs[i+addedRuns].logicalStart=MAKE_INDEX_ODD_PAIR(logicalPos,
- saveLevels[logicalPos]^indexOddBit);
- }
-
- cleanup1:
- /* restore initial paraLevel */
- pBiDi->paraLevel^=1;
- cleanup2:
- /* restore real text */
- pBiDi->text=text;
- pBiDi->length=saveLength;
- pBiDi->originalLength=length;
- pBiDi->direction=saveDirection;
- /* the saved levels should never excess levelsSize, but we check anyway */
- if(saveLength>pBiDi->levelsSize) {
- saveLength=pBiDi->levelsSize;
- }
- uprv_memcpy(pBiDi->levels, saveLevels, (size_t)saveLength*sizeof(UBiDiLevel));
- pBiDi->trailingWSStart=saveTrailingWSStart;
- if(pBiDi->runCount>1) {
- pBiDi->direction=UBIDI_MIXED;
- }
- cleanup3:
- /* free memory for mapping table and visual text */
- uprv_free(runsOnlyMemory);
-
- pBiDi->reorderingMode=UBIDI_REORDER_RUNS_ONLY;
-}
-
-/* ubidi_setPara ------------------------------------------------------------ */
-
-U_CAPI void U_EXPORT2
-ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
- UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels,
- UErrorCode *pErrorCode) {
- UBiDiDirection direction;
- DirProp *dirProps;
-
- /* check the argument values */
- RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
- if(pBiDi==NULL || text==NULL || length<-1 ||
- (paraLevel>UBIDI_MAX_EXPLICIT_LEVEL && paraLevel<UBIDI_DEFAULT_LTR)) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- if(length==-1) {
- length=u_strlen(text);
- }
-
- /* special treatment for RUNS_ONLY mode */
- if(pBiDi->reorderingMode==UBIDI_REORDER_RUNS_ONLY) {
- setParaRunsOnly(pBiDi, text, length, paraLevel, pErrorCode);
- return;
- }
-
- /* initialize the UBiDi structure */
- pBiDi->pParaBiDi=NULL; /* mark unfinished setPara */
- pBiDi->text=text;
- pBiDi->length=pBiDi->originalLength=pBiDi->resultLength=length;
- pBiDi->paraLevel=paraLevel;
- pBiDi->direction=(UBiDiDirection)(paraLevel&1);
- pBiDi->paraCount=1;
-
- pBiDi->dirProps=NULL;
- pBiDi->levels=NULL;
- pBiDi->runs=NULL;
- pBiDi->insertPoints.size=0; /* clean up from last call */
- pBiDi->insertPoints.confirmed=0; /* clean up from last call */
-
- /*
- * Save the original paraLevel if contextual; otherwise, set to 0.
- */
- pBiDi->defaultParaLevel=IS_DEFAULT_LEVEL(paraLevel);
-
- if(length==0) {
- /*
- * For an empty paragraph, create a UBiDi object with the paraLevel and
- * the flags and the direction set but without allocating zero-length arrays.
- * There is nothing more to do.
- */
- if(IS_DEFAULT_LEVEL(paraLevel)) {
- pBiDi->paraLevel&=1;
- pBiDi->defaultParaLevel=0;
- }
- pBiDi->flags=DIRPROP_FLAG_LR(paraLevel);
- pBiDi->runCount=0;
- pBiDi->paraCount=0;
- setParaSuccess(pBiDi); /* mark successful setPara */
- return;
- }
-
- pBiDi->runCount=-1;
-
- /* allocate paras memory */
- if(pBiDi->parasMemory)
- pBiDi->paras=pBiDi->parasMemory;
- else
- pBiDi->paras=pBiDi->simpleParas;
-
- /*
- * Get the directional properties,
- * the flags bit-set, and
- * determine the paragraph level if necessary.
- */
- if(getDirPropsMemory(pBiDi, length)) {
- pBiDi->dirProps=pBiDi->dirPropsMemory;
- if(!getDirProps(pBiDi)) {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- } else {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- dirProps=pBiDi->dirProps;
- /* the processed length may have changed if UBIDI_OPTION_STREAMING */
- length= pBiDi->length;
- pBiDi->trailingWSStart=length; /* the levels[] will reflect the WS run */
-
- /* are explicit levels specified? */
- if(embeddingLevels==NULL) {
- /* no: determine explicit levels according to the (Xn) rules */\
- if(getLevelsMemory(pBiDi, length)) {
- pBiDi->levels=pBiDi->levelsMemory;
- direction=resolveExplicitLevels(pBiDi, pErrorCode);
- if(U_FAILURE(*pErrorCode)) {
- return;
- }
- } else {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- } else {
- /* set BN for all explicit codes, check that all levels are 0 or paraLevel..UBIDI_MAX_EXPLICIT_LEVEL */
- pBiDi->levels=embeddingLevels;
- direction=checkExplicitLevels(pBiDi, pErrorCode);
- if(U_FAILURE(*pErrorCode)) {
- return;
- }
- }
-
- /* allocate isolate memory */
- if(pBiDi->isolateCount<=SIMPLE_ISOLATES_COUNT)
- pBiDi->isolates=pBiDi->simpleIsolates;
- else
- if((int32_t)(pBiDi->isolateCount*sizeof(Isolate))<=pBiDi->isolatesSize)
- pBiDi->isolates=pBiDi->isolatesMemory;
- else {
- if(getInitialIsolatesMemory(pBiDi, pBiDi->isolateCount)) {
- pBiDi->isolates=pBiDi->isolatesMemory;
- } else {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- }
- pBiDi->isolateCount=-1; /* current isolates stack entry == none */
-
- /*
- * The steps after (X9) in the UBiDi algorithm are performed only if
- * the paragraph text has mixed directionality!
- */
- pBiDi->direction=direction;
- switch(direction) {
- case UBIDI_LTR:
- /* all levels are implicitly at paraLevel (important for ubidi_getLevels()) */
- pBiDi->trailingWSStart=0;
- break;
- case UBIDI_RTL:
- /* all levels are implicitly at paraLevel (important for ubidi_getLevels()) */
- pBiDi->trailingWSStart=0;
- break;
- default:
- /*
- * Choose the right implicit state table
- */
- switch(pBiDi->reorderingMode) {
- case UBIDI_REORDER_DEFAULT:
- pBiDi->pImpTabPair=&impTab_DEFAULT;
- break;
- case UBIDI_REORDER_NUMBERS_SPECIAL:
- pBiDi->pImpTabPair=&impTab_NUMBERS_SPECIAL;
- break;
- case UBIDI_REORDER_GROUP_NUMBERS_WITH_R:
- pBiDi->pImpTabPair=&impTab_GROUP_NUMBERS_WITH_R;
- break;
- case UBIDI_REORDER_INVERSE_NUMBERS_AS_L:
- pBiDi->pImpTabPair=&impTab_INVERSE_NUMBERS_AS_L;
- break;
- case UBIDI_REORDER_INVERSE_LIKE_DIRECT:
- if (pBiDi->reorderingOptions & UBIDI_OPTION_INSERT_MARKS) {
- pBiDi->pImpTabPair=&impTab_INVERSE_LIKE_DIRECT_WITH_MARKS;
- } else {
- pBiDi->pImpTabPair=&impTab_INVERSE_LIKE_DIRECT;
- }
- break;
- case UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL:
- if (pBiDi->reorderingOptions & UBIDI_OPTION_INSERT_MARKS) {
- pBiDi->pImpTabPair=&impTab_INVERSE_FOR_NUMBERS_SPECIAL_WITH_MARKS;
- } else {
- pBiDi->pImpTabPair=&impTab_INVERSE_FOR_NUMBERS_SPECIAL;
- }
- break;
- default:
- /* we should never get here */
- UPRV_UNREACHABLE;
- }
- /*
- * If there are no external levels specified and there
- * are no significant explicit level codes in the text,
- * then we can treat the entire paragraph as one run.
- * Otherwise, we need to perform the following rules on runs of
- * the text with the same embedding levels. (X10)
- * "Significant" explicit level codes are ones that actually
- * affect non-BN characters.
- * Examples for "insignificant" ones are empty embeddings
- * LRE-PDF, LRE-RLE-PDF-PDF, etc.
- */
- if(embeddingLevels==NULL && pBiDi->paraCount<=1 &&
- !(pBiDi->flags&DIRPROP_FLAG_MULTI_RUNS)) {
- resolveImplicitLevels(pBiDi, 0, length,
- GET_LR_FROM_LEVEL(GET_PARALEVEL(pBiDi, 0)),
- GET_LR_FROM_LEVEL(GET_PARALEVEL(pBiDi, length-1)));
- } else {
- /* sor, eor: start and end types of same-level-run */
- UBiDiLevel *levels=pBiDi->levels;
- int32_t start, limit=0;
- UBiDiLevel level, nextLevel;
- DirProp sor, eor;
-
- /* determine the first sor and set eor to it because of the loop body (sor=eor there) */
- level=GET_PARALEVEL(pBiDi, 0);
- nextLevel=levels[0];
- if(level<nextLevel) {
- eor=GET_LR_FROM_LEVEL(nextLevel);
- } else {
- eor=GET_LR_FROM_LEVEL(level);
- }
-
- do {
- /* determine start and limit of the run (end points just behind the run) */
-
- /* the values for this run's start are the same as for the previous run's end */
- start=limit;
- level=nextLevel;
- if((start>0) && (dirProps[start-1]==B)) {
- /* except if this is a new paragraph, then set sor = para level */
- sor=GET_LR_FROM_LEVEL(GET_PARALEVEL(pBiDi, start));
- } else {
- sor=eor;
- }
-
- /* search for the limit of this run */
- while((++limit<length) &&
- ((levels[limit]==level) ||
- (DIRPROP_FLAG(dirProps[limit])&MASK_BN_EXPLICIT))) {}
-
- /* get the correct level of the next run */
- if(limit<length) {
- nextLevel=levels[limit];
- } else {
- nextLevel=GET_PARALEVEL(pBiDi, length-1);
- }
-
- /* determine eor from max(level, nextLevel); sor is last run's eor */
- if(NO_OVERRIDE(level)<NO_OVERRIDE(nextLevel)) {
- eor=GET_LR_FROM_LEVEL(nextLevel);
- } else {
- eor=GET_LR_FROM_LEVEL(level);
- }
-
- /* if the run consists of overridden directional types, then there
- are no implicit types to be resolved */
- if(!(level&UBIDI_LEVEL_OVERRIDE)) {
- resolveImplicitLevels(pBiDi, start, limit, sor, eor);
- } else {
- /* remove the UBIDI_LEVEL_OVERRIDE flags */
- do {
- levels[start++]&=~UBIDI_LEVEL_OVERRIDE;
- } while(start<limit);
- }
- } while(limit<length);
- }
- /* check if we got any memory shortage while adding insert points */
- if (U_FAILURE(pBiDi->insertPoints.errorCode))
- {
- *pErrorCode=pBiDi->insertPoints.errorCode;
- return;
- }
- /* reset the embedding levels for some non-graphic characters (L1), (X9) */
- adjustWSLevels(pBiDi);
- break;
- }
- /* add RLM for inverse Bidi with contextual orientation resolving
- * to RTL which would not round-trip otherwise
- */
- if((pBiDi->defaultParaLevel>0) &&
- (pBiDi->reorderingOptions & UBIDI_OPTION_INSERT_MARKS) &&
- ((pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_LIKE_DIRECT) ||
- (pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL))) {
- int32_t i, j, start, last;
- UBiDiLevel level;
- DirProp dirProp;
- for(i=0; i<pBiDi->paraCount; i++) {
- last=(pBiDi->paras[i].limit)-1;
- level= static_cast<UBiDiLevel>(pBiDi->paras[i].level);
- if(level==0)
- continue; /* LTR paragraph */
- start= i==0 ? 0 : pBiDi->paras[i-1].limit;
- for(j=last; j>=start; j--) {
- dirProp=dirProps[j];
- if(dirProp==L) {
- if(j<last) {
- while(dirProps[last]==B) {
- last--;
- }
- }
- addPoint(pBiDi, last, RLM_BEFORE);
- break;
- }
- if(DIRPROP_FLAG(dirProp) & MASK_R_AL) {
- break;
- }
- }
- }
- }
-
- if(pBiDi->reorderingOptions & UBIDI_OPTION_REMOVE_CONTROLS) {
- pBiDi->resultLength -= pBiDi->controlCount;
- } else {
- pBiDi->resultLength += pBiDi->insertPoints.size;
- }
- setParaSuccess(pBiDi); /* mark successful setPara */
-}
-
-U_CAPI void U_EXPORT2
-ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR) {
- if(pBiDi!=NULL) {
- pBiDi->orderParagraphsLTR=orderParagraphsLTR;
- }
-}
-
-U_CAPI UBool U_EXPORT2
-ubidi_isOrderParagraphsLTR(UBiDi *pBiDi) {
- if(pBiDi!=NULL) {
- return pBiDi->orderParagraphsLTR;
- } else {
- return FALSE;
- }
-}
-
-U_CAPI UBiDiDirection U_EXPORT2
-ubidi_getDirection(const UBiDi *pBiDi) {
- if(IS_VALID_PARA_OR_LINE(pBiDi)) {
- return pBiDi->direction;
- } else {
- return UBIDI_LTR;
- }
-}
-
-U_CAPI const UChar * U_EXPORT2
-ubidi_getText(const UBiDi *pBiDi) {
- if(IS_VALID_PARA_OR_LINE(pBiDi)) {
- return pBiDi->text;
- } else {
- return NULL;
- }
-}
-
-U_CAPI int32_t U_EXPORT2
-ubidi_getLength(const UBiDi *pBiDi) {
- if(IS_VALID_PARA_OR_LINE(pBiDi)) {
- return pBiDi->originalLength;
- } else {
- return 0;
- }
-}
-
-U_CAPI int32_t U_EXPORT2
-ubidi_getProcessedLength(const UBiDi *pBiDi) {
- if(IS_VALID_PARA_OR_LINE(pBiDi)) {
- return pBiDi->length;
- } else {
- return 0;
- }
-}
-
-U_CAPI int32_t U_EXPORT2
-ubidi_getResultLength(const UBiDi *pBiDi) {
- if(IS_VALID_PARA_OR_LINE(pBiDi)) {
- return pBiDi->resultLength;
- } else {
- return 0;
- }
-}
-
-/* paragraphs API functions ------------------------------------------------- */
-
-U_CAPI UBiDiLevel U_EXPORT2
-ubidi_getParaLevel(const UBiDi *pBiDi) {
- if(IS_VALID_PARA_OR_LINE(pBiDi)) {
- return pBiDi->paraLevel;
- } else {
- return 0;
- }
-}
-
-U_CAPI int32_t U_EXPORT2
-ubidi_countParagraphs(UBiDi *pBiDi) {
- if(!IS_VALID_PARA_OR_LINE(pBiDi)) {
- return 0;
- } else {
- return pBiDi->paraCount;
- }
-}
-
-U_CAPI void U_EXPORT2
-ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex,
- int32_t *pParaStart, int32_t *pParaLimit,
- UBiDiLevel *pParaLevel, UErrorCode *pErrorCode) {
- int32_t paraStart;
-
- /* check the argument values */
- RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
- RETURN_VOID_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode);
- RETURN_VOID_IF_BAD_RANGE(paraIndex, 0, pBiDi->paraCount, *pErrorCode);
-
- pBiDi=pBiDi->pParaBiDi; /* get Para object if Line object */
- if(paraIndex) {
- paraStart=pBiDi->paras[paraIndex-1].limit;
- } else {
- paraStart=0;
- }
- if(pParaStart!=NULL) {
- *pParaStart=paraStart;
- }
- if(pParaLimit!=NULL) {
- *pParaLimit=pBiDi->paras[paraIndex].limit;
- }
- if(pParaLevel!=NULL) {
- *pParaLevel=GET_PARALEVEL(pBiDi, paraStart);
- }
-}
-
-U_CAPI int32_t U_EXPORT2
-ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex,
- int32_t *pParaStart, int32_t *pParaLimit,
- UBiDiLevel *pParaLevel, UErrorCode *pErrorCode) {
- int32_t paraIndex;
-
- /* check the argument values */
- /* pErrorCode will be checked by the call to ubidi_getParagraphByIndex */
- RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, -1);
- RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, -1);
- pBiDi=pBiDi->pParaBiDi; /* get Para object if Line object */
- RETURN_IF_BAD_RANGE(charIndex, 0, pBiDi->length, *pErrorCode, -1);
-
- for(paraIndex=0; charIndex>=pBiDi->paras[paraIndex].limit; paraIndex++);
- ubidi_getParagraphByIndex(pBiDi, paraIndex, pParaStart, pParaLimit, pParaLevel, pErrorCode);
- return paraIndex;
-}
-
-U_CAPI void U_EXPORT2
-ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn,
- const void *newContext, UBiDiClassCallback **oldFn,
- const void **oldContext, UErrorCode *pErrorCode)
-{
- RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
- if(pBiDi==NULL) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- if( oldFn )
- {
- *oldFn = pBiDi->fnClassCallback;
- }
- if( oldContext )
- {
- *oldContext = pBiDi->coClassCallback;
- }
- pBiDi->fnClassCallback = newFn;
- pBiDi->coClassCallback = newContext;
-}
-
-U_CAPI void U_EXPORT2
-ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context)
-{
- if(pBiDi==NULL) {
- return;
- }
- if( fn )
- {
- *fn = pBiDi->fnClassCallback;
- }
- if( context )
- {
- *context = pBiDi->coClassCallback;
- }
-}
-
-U_CAPI UCharDirection U_EXPORT2
-ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c)
-{
- UCharDirection dir;
-
- if( pBiDi->fnClassCallback == NULL ||
- (dir = (*pBiDi->fnClassCallback)(pBiDi->coClassCallback, c)) == U_BIDI_CLASS_DEFAULT )
- {
- dir = ubidi_getClass(c);
- }
- if(dir >= U_CHAR_DIRECTION_COUNT) {
- dir = (UCharDirection)ON;
- }
- return dir;
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 1999-2015, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+* file name: ubidi.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 1999jul27
+* created by: Markus W. Scherer, updated by Matitiahu Allouche
+*
+*/
+
+#include "cmemory.h"
+#include "unicode/utypes.h"
+#include "unicode/ustring.h"
+#include "unicode/uchar.h"
+#include "unicode/ubidi.h"
+#include "unicode/utf16.h"
+#include "ubidi_props.h"
+#include "ubidiimp.h"
+#include "uassert.h"
+
+/*
+ * General implementation notes:
+ *
+ * Throughout the implementation, there are comments like (W2) that refer to
+ * rules of the BiDi algorithm, in this example to the second rule of the
+ * resolution of weak types.
+ *
+ * For handling surrogate pairs, where two UChar's form one "abstract" (or UTF-32)
+ * character according to UTF-16, the second UChar gets the directional property of
+ * the entire character assigned, while the first one gets a BN, a boundary
+ * neutral, type, which is ignored by most of the algorithm according to
+ * rule (X9) and the implementation suggestions of the BiDi algorithm.
+ *
+ * Later, adjustWSLevels() will set the level for each BN to that of the
+ * following character (UChar), which results in surrogate pairs getting the
+ * same level on each of their surrogates.
+ *
+ * In a UTF-8 implementation, the same thing could be done: the last byte of
+ * a multi-byte sequence would get the "real" property, while all previous
+ * bytes of that sequence would get BN.
+ *
+ * It is not possible to assign all those parts of a character the same real
+ * property because this would fail in the resolution of weak types with rules
+ * that look at immediately surrounding types.
+ *
+ * As a related topic, this implementation does not remove Boundary Neutral
+ * types from the input, but ignores them wherever this is relevant.
+ * For example, the loop for the resolution of the weak types reads
+ * types until it finds a non-BN.
+ * Also, explicit embedding codes are neither changed into BN nor removed.
+ * They are only treated the same way real BNs are.
+ * As stated before, adjustWSLevels() takes care of them at the end.
+ * For the purpose of conformance, the levels of all these codes
+ * do not matter.
+ *
+ * Note that this implementation modifies the dirProps
+ * after the initial setup, when applying X5c (replace FSI by LRI or RLI),
+ * X6, N0 (replace paired brackets by L or R).
+ *
+ * In this implementation, the resolution of weak types (W1 to W6),
+ * neutrals (N1 and N2), and the assignment of the resolved level (In)
+ * are all done in one single loop, in resolveImplicitLevels().
+ * Changes of dirProp values are done on the fly, without writing
+ * them back to the dirProps array.
+ *
+ *
+ * This implementation contains code that allows to bypass steps of the
+ * algorithm that are not needed on the specific paragraph
+ * in order to speed up the most common cases considerably,
+ * like text that is entirely LTR, or RTL text without numbers.
+ *
+ * Most of this is done by setting a bit for each directional property
+ * in a flags variable and later checking for whether there are
+ * any LTR characters or any RTL characters, or both, whether
+ * there are any explicit embedding codes, etc.
+ *
+ * If the (Xn) steps are performed, then the flags are re-evaluated,
+ * because they will then not contain the embedding codes any more
+ * and will be adjusted for override codes, so that subsequently
+ * more bypassing may be possible than what the initial flags suggested.
+ *
+ * If the text is not mixed-directional, then the
+ * algorithm steps for the weak type resolution are not performed,
+ * and all levels are set to the paragraph level.
+ *
+ * If there are no explicit embedding codes, then the (Xn) steps
+ * are not performed.
+ *
+ * If embedding levels are supplied as a parameter, then all
+ * explicit embedding codes are ignored, and the (Xn) steps
+ * are not performed.
+ *
+ * White Space types could get the level of the run they belong to,
+ * and are checked with a test of (flags&MASK_EMBEDDING) to
+ * consider if the paragraph direction should be considered in
+ * the flags variable.
+ *
+ * If there are no White Space types in the paragraph, then
+ * (L1) is not necessary in adjustWSLevels().
+ */
+
+/* to avoid some conditional statements, use tiny constant arrays */
+static const Flags flagLR[2]={ DIRPROP_FLAG(L), DIRPROP_FLAG(R) };
+static const Flags flagE[2]={ DIRPROP_FLAG(LRE), DIRPROP_FLAG(RLE) };
+static const Flags flagO[2]={ DIRPROP_FLAG(LRO), DIRPROP_FLAG(RLO) };
+
+#define DIRPROP_FLAG_LR(level) flagLR[(level)&1]
+#define DIRPROP_FLAG_E(level) flagE[(level)&1]
+#define DIRPROP_FLAG_O(level) flagO[(level)&1]
+
+#define DIR_FROM_STRONG(strong) ((strong)==L ? L : R)
+
+#define NO_OVERRIDE(level) ((level)&~UBIDI_LEVEL_OVERRIDE)
+
+/* UBiDi object management -------------------------------------------------- */
+
+U_CAPI UBiDi * U_EXPORT2
+ubidi_open(void)
+{
+ UErrorCode errorCode=U_ZERO_ERROR;
+ return ubidi_openSized(0, 0, &errorCode);
+}
+
+U_CAPI UBiDi * U_EXPORT2
+ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode) {
+ UBiDi *pBiDi;
+
+ /* check the argument values */
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return NULL;
+ } else if(maxLength<0 || maxRunCount<0) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL; /* invalid arguments */
+ }
+
+ /* allocate memory for the object */
+ pBiDi=(UBiDi *)uprv_malloc(sizeof(UBiDi));
+ if(pBiDi==NULL) {
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+
+ /* reset the object, all pointers NULL, all flags FALSE, all sizes 0 */
+ uprv_memset(pBiDi, 0, sizeof(UBiDi));
+
+ /* allocate memory for arrays as requested */
+ if(maxLength>0) {
+ if( !getInitialDirPropsMemory(pBiDi, maxLength) ||
+ !getInitialLevelsMemory(pBiDi, maxLength)
+ ) {
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ }
+ } else {
+ pBiDi->mayAllocateText=TRUE;
+ }
+
+ if(maxRunCount>0) {
+ if(maxRunCount==1) {
+ /* use simpleRuns[] */
+ pBiDi->runsSize=sizeof(Run);
+ } else if(!getInitialRunsMemory(pBiDi, maxRunCount)) {
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ }
+ } else {
+ pBiDi->mayAllocateRuns=TRUE;
+ }
+
+ if(U_SUCCESS(*pErrorCode)) {
+ return pBiDi;
+ } else {
+ ubidi_close(pBiDi);
+ return NULL;
+ }
+}
+
+/*
+ * We are allowed to allocate memory if memory==NULL or
+ * mayAllocate==TRUE for each array that we need.
+ * We also try to grow memory as needed if we
+ * allocate it.
+ *
+ * Assume sizeNeeded>0.
+ * If *pMemory!=NULL, then assume *pSize>0.
+ *
+ * ### this realloc() may unnecessarily copy the old data,
+ * which we know we don't need any more;
+ * is this the best way to do this??
+ */
+U_CFUNC UBool
+ubidi_getMemory(BidiMemoryForAllocation *bidiMem, int32_t *pSize, UBool mayAllocate, int32_t sizeNeeded) {
+ void **pMemory = (void **)bidiMem;
+ /* check for existing memory */
+ if(*pMemory==NULL) {
+ /* we need to allocate memory */
+ if(mayAllocate && (*pMemory=uprv_malloc(sizeNeeded))!=NULL) {
+ *pSize=sizeNeeded;
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ } else {
+ if(sizeNeeded<=*pSize) {
+ /* there is already enough memory */
+ return TRUE;
+ }
+ else if(!mayAllocate) {
+ /* not enough memory, and we must not allocate */
+ return FALSE;
+ } else {
+ /* we try to grow */
+ void *memory;
+ /* in most cases, we do not need the copy-old-data part of
+ * realloc, but it is needed when adding runs using getRunsMemory()
+ * in setParaRunsOnly()
+ */
+ if((memory=uprv_realloc(*pMemory, sizeNeeded))!=NULL) {
+ *pMemory=memory;
+ *pSize=sizeNeeded;
+ return TRUE;
+ } else {
+ /* we failed to grow */
+ return FALSE;
+ }
+ }
+ }
+}
+
+U_CAPI void U_EXPORT2
+ubidi_close(UBiDi *pBiDi) {
+ if(pBiDi!=NULL) {
+ pBiDi->pParaBiDi=NULL; /* in case one tries to reuse this block */
+ if(pBiDi->dirPropsMemory!=NULL) {
+ uprv_free(pBiDi->dirPropsMemory);
+ }
+ if(pBiDi->levelsMemory!=NULL) {
+ uprv_free(pBiDi->levelsMemory);
+ }
+ if(pBiDi->openingsMemory!=NULL) {
+ uprv_free(pBiDi->openingsMemory);
+ }
+ if(pBiDi->parasMemory!=NULL) {
+ uprv_free(pBiDi->parasMemory);
+ }
+ if(pBiDi->runsMemory!=NULL) {
+ uprv_free(pBiDi->runsMemory);
+ }
+ if(pBiDi->isolatesMemory!=NULL) {
+ uprv_free(pBiDi->isolatesMemory);
+ }
+ if(pBiDi->insertPoints.points!=NULL) {
+ uprv_free(pBiDi->insertPoints.points);
+ }
+
+ uprv_free(pBiDi);
+ }
+}
+
+/* set to approximate "inverse BiDi" ---------------------------------------- */
+
+U_CAPI void U_EXPORT2
+ubidi_setInverse(UBiDi *pBiDi, UBool isInverse) {
+ if(pBiDi!=NULL) {
+ pBiDi->isInverse=isInverse;
+ pBiDi->reorderingMode = isInverse ? UBIDI_REORDER_INVERSE_NUMBERS_AS_L
+ : UBIDI_REORDER_DEFAULT;
+ }
+}
+
+U_CAPI UBool U_EXPORT2
+ubidi_isInverse(UBiDi *pBiDi) {
+ if(pBiDi!=NULL) {
+ return pBiDi->isInverse;
+ } else {
+ return FALSE;
+ }
+}
+
+/* FOOD FOR THOUGHT: currently the reordering modes are a mixture of
+ * algorithm for direct BiDi, algorithm for inverse BiDi and the bizarre
+ * concept of RUNS_ONLY which is a double operation.
+ * It could be advantageous to divide this into 3 concepts:
+ * a) Operation: direct / inverse / RUNS_ONLY
+ * b) Direct algorithm: default / NUMBERS_SPECIAL / GROUP_NUMBERS_WITH_R
+ * c) Inverse algorithm: default / INVERSE_LIKE_DIRECT / NUMBERS_SPECIAL
+ * This would allow combinations not possible today like RUNS_ONLY with
+ * NUMBERS_SPECIAL.
+ * Also allow to set INSERT_MARKS for the direct step of RUNS_ONLY and
+ * REMOVE_CONTROLS for the inverse step.
+ * Not all combinations would be supported, and probably not all do make sense.
+ * This would need to document which ones are supported and what are the
+ * fallbacks for unsupported combinations.
+ */
+U_CAPI void U_EXPORT2
+ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode) {
+ if ((pBiDi!=NULL) && (reorderingMode >= UBIDI_REORDER_DEFAULT)
+ && (reorderingMode < UBIDI_REORDER_COUNT)) {
+ pBiDi->reorderingMode = reorderingMode;
+ pBiDi->isInverse = (UBool)(reorderingMode == UBIDI_REORDER_INVERSE_NUMBERS_AS_L);
+ }
+}
+
+U_CAPI UBiDiReorderingMode U_EXPORT2
+ubidi_getReorderingMode(UBiDi *pBiDi) {
+ if (pBiDi!=NULL) {
+ return pBiDi->reorderingMode;
+ } else {
+ return UBIDI_REORDER_DEFAULT;
+ }
+}
+
+U_CAPI void U_EXPORT2
+ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions) {
+ if (reorderingOptions & UBIDI_OPTION_REMOVE_CONTROLS) {
+ reorderingOptions&=~UBIDI_OPTION_INSERT_MARKS;
+ }
+ if (pBiDi!=NULL) {
+ pBiDi->reorderingOptions=reorderingOptions;
+ }
+}
+
+U_CAPI uint32_t U_EXPORT2
+ubidi_getReorderingOptions(UBiDi *pBiDi) {
+ if (pBiDi!=NULL) {
+ return pBiDi->reorderingOptions;
+ } else {
+ return 0;
+ }
+}
+
+U_CAPI UBiDiDirection U_EXPORT2
+ubidi_getBaseDirection(const UChar *text,
+int32_t length){
+
+ int32_t i;
+ UChar32 uchar;
+ UCharDirection dir;
+
+ if( text==NULL || length<-1 ){
+ return UBIDI_NEUTRAL;
+ }
+
+ if(length==-1) {
+ length=u_strlen(text);
+ }
+
+ for( i = 0 ; i < length; ) {
+ /* i is incremented by U16_NEXT */
+ U16_NEXT(text, i, length, uchar);
+ dir = u_charDirection(uchar);
+ if( dir == U_LEFT_TO_RIGHT )
+ return UBIDI_LTR;
+ if( dir == U_RIGHT_TO_LEFT || dir ==U_RIGHT_TO_LEFT_ARABIC )
+ return UBIDI_RTL;
+ }
+ return UBIDI_NEUTRAL;
+}
+
+/* perform (P2)..(P3) ------------------------------------------------------- */
+
+/**
+ * Returns the directionality of the first strong character
+ * after the last B in prologue, if any.
+ * Requires prologue!=null.
+ */
+static DirProp
+firstL_R_AL(UBiDi *pBiDi) {
+ const UChar *text=pBiDi->prologue;
+ int32_t length=pBiDi->proLength;
+ int32_t i;
+ UChar32 uchar;
+ DirProp dirProp, result=ON;
+ for(i=0; i<length; ) {
+ /* i is incremented by U16_NEXT */
+ U16_NEXT(text, i, length, uchar);
+ dirProp=(DirProp)ubidi_getCustomizedClass(pBiDi, uchar);
+ if(result==ON) {
+ if(dirProp==L || dirProp==R || dirProp==AL) {
+ result=dirProp;
+ }
+ } else {
+ if(dirProp==B) {
+ result=ON;
+ }
+ }
+ }
+ return result;
+}
+
+/*
+ * Check that there are enough entries in the array pointed to by pBiDi->paras
+ */
+static UBool
+checkParaCount(UBiDi *pBiDi) {
+ int32_t count=pBiDi->paraCount;
+ if(pBiDi->paras==pBiDi->simpleParas) {
+ if(count<=SIMPLE_PARAS_COUNT)
+ return TRUE;
+ if(!getInitialParasMemory(pBiDi, SIMPLE_PARAS_COUNT * 2))
+ return FALSE;
+ pBiDi->paras=pBiDi->parasMemory;
+ uprv_memcpy(pBiDi->parasMemory, pBiDi->simpleParas, SIMPLE_PARAS_COUNT * sizeof(Para));
+ return TRUE;
+ }
+ if(!getInitialParasMemory(pBiDi, count * 2))
+ return FALSE;
+ pBiDi->paras=pBiDi->parasMemory;
+ return TRUE;
+}
+
+/*
+ * Get the directional properties for the text, calculate the flags bit-set, and
+ * determine the paragraph level if necessary (in pBiDi->paras[i].level).
+ * FSI initiators are also resolved and their dirProp replaced with LRI or RLI.
+ * When encountering an FSI, it is initially replaced with an LRI, which is the
+ * default. Only if a strong R or AL is found within its scope will the LRI be
+ * replaced by an RLI.
+ */
+static UBool
+getDirProps(UBiDi *pBiDi) {
+ const UChar *text=pBiDi->text;
+ DirProp *dirProps=pBiDi->dirPropsMemory; /* pBiDi->dirProps is const */
+
+ int32_t i=0, originalLength=pBiDi->originalLength;
+ Flags flags=0; /* collect all directionalities in the text */
+ UChar32 uchar;
+ DirProp dirProp=0, defaultParaLevel=0; /* initialize to avoid compiler warnings */
+ UBool isDefaultLevel=IS_DEFAULT_LEVEL(pBiDi->paraLevel);
+ /* for inverse BiDi, the default para level is set to RTL if there is a
+ strong R or AL character at either end of the text */
+ UBool isDefaultLevelInverse=isDefaultLevel && (UBool)
+ (pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_LIKE_DIRECT ||
+ pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL);
+ int32_t lastArabicPos=-1;
+ int32_t controlCount=0;
+ UBool removeBiDiControls = (UBool)(pBiDi->reorderingOptions &
+ UBIDI_OPTION_REMOVE_CONTROLS);
+
+ enum State {
+ NOT_SEEKING_STRONG, /* 0: not contextual paraLevel, not after FSI */
+ SEEKING_STRONG_FOR_PARA, /* 1: looking for first strong char in para */
+ SEEKING_STRONG_FOR_FSI, /* 2: looking for first strong after FSI */
+ LOOKING_FOR_PDI /* 3: found strong after FSI, looking for PDI */
+ };
+ State state;
+ DirProp lastStrong=ON; /* for default level & inverse BiDi */
+ /* The following stacks are used to manage isolate sequences. Those
+ sequences may be nested, but obviously never more deeply than the
+ maximum explicit embedding level.
+ lastStack is the index of the last used entry in the stack. A value of -1
+ means that there is no open isolate sequence.
+ lastStack is reset to -1 on paragraph boundaries. */
+ /* The following stack contains the position of the initiator of
+ each open isolate sequence */
+ int32_t isolateStartStack[UBIDI_MAX_EXPLICIT_LEVEL+1];
+ /* The following stack contains the last known state before
+ encountering the initiator of an isolate sequence */
+ State previousStateStack[UBIDI_MAX_EXPLICIT_LEVEL+1];
+ int32_t stackLast=-1;
+
+ if(pBiDi->reorderingOptions & UBIDI_OPTION_STREAMING)
+ pBiDi->length=0;
+ defaultParaLevel=pBiDi->paraLevel&1;
+ if(isDefaultLevel) {
+ pBiDi->paras[0].level=defaultParaLevel;
+ lastStrong=defaultParaLevel;
+ if(pBiDi->proLength>0 && /* there is a prologue */
+ (dirProp=firstL_R_AL(pBiDi))!=ON) { /* with a strong character */
+ if(dirProp==L)
+ pBiDi->paras[0].level=0; /* set the default para level */
+ else
+ pBiDi->paras[0].level=1; /* set the default para level */
+ state=NOT_SEEKING_STRONG;
+ } else {
+ state=SEEKING_STRONG_FOR_PARA;
+ }
+ } else {
+ pBiDi->paras[0].level=pBiDi->paraLevel;
+ state=NOT_SEEKING_STRONG;
+ }
+ /* count paragraphs and determine the paragraph level (P2..P3) */
+ /*
+ * see comment in ubidi.h:
+ * the UBIDI_DEFAULT_XXX values are designed so that
+ * their bit 0 alone yields the intended default
+ */
+ for( /* i=0 above */ ; i<originalLength; ) {
+ /* i is incremented by U16_NEXT */
+ U16_NEXT(text, i, originalLength, uchar);
+ flags|=DIRPROP_FLAG(dirProp=(DirProp)ubidi_getCustomizedClass(pBiDi, uchar));
+ dirProps[i-1]=dirProp;
+ if(uchar>0xffff) { /* set the lead surrogate's property to BN */
+ flags|=DIRPROP_FLAG(BN);
+ dirProps[i-2]=BN;
+ }
+ if(removeBiDiControls && IS_BIDI_CONTROL_CHAR(uchar))
+ controlCount++;
+ if(dirProp==L) {
+ if(state==SEEKING_STRONG_FOR_PARA) {
+ pBiDi->paras[pBiDi->paraCount-1].level=0;
+ state=NOT_SEEKING_STRONG;
+ }
+ else if(state==SEEKING_STRONG_FOR_FSI) {
+ if(stackLast<=UBIDI_MAX_EXPLICIT_LEVEL) {
+ /* no need for next statement, already set by default */
+ /* dirProps[isolateStartStack[stackLast]]=LRI; */
+ flags|=DIRPROP_FLAG(LRI);
+ }
+ state=LOOKING_FOR_PDI;
+ }
+ lastStrong=L;
+ continue;
+ }
+ if(dirProp==R || dirProp==AL) {
+ if(state==SEEKING_STRONG_FOR_PARA) {
+ pBiDi->paras[pBiDi->paraCount-1].level=1;
+ state=NOT_SEEKING_STRONG;
+ }
+ else if(state==SEEKING_STRONG_FOR_FSI) {
+ if(stackLast<=UBIDI_MAX_EXPLICIT_LEVEL) {
+ dirProps[isolateStartStack[stackLast]]=RLI;
+ flags|=DIRPROP_FLAG(RLI);
+ }
+ state=LOOKING_FOR_PDI;
+ }
+ lastStrong=R;
+ if(dirProp==AL)
+ lastArabicPos=i-1;
+ continue;
+ }
+ if(dirProp>=FSI && dirProp<=RLI) { /* FSI, LRI or RLI */
+ stackLast++;
+ if(stackLast<=UBIDI_MAX_EXPLICIT_LEVEL) {
+ isolateStartStack[stackLast]=i-1;
+ previousStateStack[stackLast]=state;
+ }
+ if(dirProp==FSI) {
+ dirProps[i-1]=LRI; /* default if no strong char */
+ state=SEEKING_STRONG_FOR_FSI;
+ }
+ else
+ state=LOOKING_FOR_PDI;
+ continue;
+ }
+ if(dirProp==PDI) {
+ if(state==SEEKING_STRONG_FOR_FSI) {
+ if(stackLast<=UBIDI_MAX_EXPLICIT_LEVEL) {
+ /* no need for next statement, already set by default */
+ /* dirProps[isolateStartStack[stackLast]]=LRI; */
+ flags|=DIRPROP_FLAG(LRI);
+ }
+ }
+ if(stackLast>=0) {
+ if(stackLast<=UBIDI_MAX_EXPLICIT_LEVEL)
+ state=previousStateStack[stackLast];
+ stackLast--;
+ }
+ continue;
+ }
+ if(dirProp==B) {
+ if(i<originalLength && uchar==CR && text[i]==LF) /* do nothing on the CR */
+ continue;
+ pBiDi->paras[pBiDi->paraCount-1].limit=i;
+ if(isDefaultLevelInverse && lastStrong==R)
+ pBiDi->paras[pBiDi->paraCount-1].level=1;
+ if(pBiDi->reorderingOptions & UBIDI_OPTION_STREAMING) {
+ /* When streaming, we only process whole paragraphs
+ thus some updates are only done on paragraph boundaries */
+ pBiDi->length=i; /* i is index to next character */
+ pBiDi->controlCount=controlCount;
+ }
+ if(i<originalLength) { /* B not last char in text */
+ pBiDi->paraCount++;
+ if(checkParaCount(pBiDi)==FALSE) /* not enough memory for a new para entry */
+ return FALSE;
+ if(isDefaultLevel) {
+ pBiDi->paras[pBiDi->paraCount-1].level=defaultParaLevel;
+ state=SEEKING_STRONG_FOR_PARA;
+ lastStrong=defaultParaLevel;
+ } else {
+ pBiDi->paras[pBiDi->paraCount-1].level=pBiDi->paraLevel;
+ state=NOT_SEEKING_STRONG;
+ }
+ stackLast=-1;
+ }
+ continue;
+ }
+ }
+ /* Ignore still open isolate sequences with overflow */
+ if(stackLast>UBIDI_MAX_EXPLICIT_LEVEL) {
+ stackLast=UBIDI_MAX_EXPLICIT_LEVEL;
+ state=SEEKING_STRONG_FOR_FSI; /* to be on the safe side */
+ }
+ /* Resolve direction of still unresolved open FSI sequences */
+ while(stackLast>=0) {
+ if(state==SEEKING_STRONG_FOR_FSI) {
+ /* no need for next statement, already set by default */
+ /* dirProps[isolateStartStack[stackLast]]=LRI; */
+ flags|=DIRPROP_FLAG(LRI);
+ break;
+ }
+ state=previousStateStack[stackLast];
+ stackLast--;
+ }
+ /* When streaming, ignore text after the last paragraph separator */
+ if(pBiDi->reorderingOptions & UBIDI_OPTION_STREAMING) {
+ if(pBiDi->length<originalLength)
+ pBiDi->paraCount--;
+ } else {
+ pBiDi->paras[pBiDi->paraCount-1].limit=originalLength;
+ pBiDi->controlCount=controlCount;
+ }
+ /* For inverse bidi, default para direction is RTL if there is
+ a strong R or AL at either end of the paragraph */
+ if(isDefaultLevelInverse && lastStrong==R) {
+ pBiDi->paras[pBiDi->paraCount-1].level=1;
+ }
+ if(isDefaultLevel) {
+ pBiDi->paraLevel=static_cast<UBiDiLevel>(pBiDi->paras[0].level);
+ }
+ /* The following is needed to resolve the text direction for default level
+ paragraphs containing no strong character */
+ for(i=0; i<pBiDi->paraCount; i++)
+ flags|=DIRPROP_FLAG_LR(pBiDi->paras[i].level);
+
+ if(pBiDi->orderParagraphsLTR && (flags&DIRPROP_FLAG(B))) {
+ flags|=DIRPROP_FLAG(L);
+ }
+ pBiDi->flags=flags;
+ pBiDi->lastArabicPos=lastArabicPos;
+ return TRUE;
+}
+
+/* determine the paragraph level at position index */
+U_CFUNC UBiDiLevel
+ubidi_getParaLevelAtIndex(const UBiDi *pBiDi, int32_t pindex) {
+ int32_t i;
+ for(i=0; i<pBiDi->paraCount; i++)
+ if(pindex<pBiDi->paras[i].limit)
+ break;
+ if(i>=pBiDi->paraCount)
+ i=pBiDi->paraCount-1;
+ return (UBiDiLevel)(pBiDi->paras[i].level);
+}
+
+/* Functions for handling paired brackets ----------------------------------- */
+
+/* In the isoRuns array, the first entry is used for text outside of any
+ isolate sequence. Higher entries are used for each more deeply nested
+ isolate sequence. isoRunLast is the index of the last used entry. The
+ openings array is used to note the data of opening brackets not yet
+ matched by a closing bracket, or matched but still susceptible to change
+ level.
+ Each isoRun entry contains the index of the first and
+ one-after-last openings entries for pending opening brackets it
+ contains. The next openings entry to use is the one-after-last of the
+ most deeply nested isoRun entry.
+ isoRun entries also contain their current embedding level and the last
+ encountered strong character, since these will be needed to resolve
+ the level of paired brackets. */
+
+static void
+bracketInit(UBiDi *pBiDi, BracketData *bd) {
+ bd->pBiDi=pBiDi;
+ bd->isoRunLast=0;
+ bd->isoRuns[0].start=0;
+ bd->isoRuns[0].limit=0;
+ bd->isoRuns[0].level=GET_PARALEVEL(pBiDi, 0);
+ UBiDiLevel t = GET_PARALEVEL(pBiDi, 0) & 1;
+ bd->isoRuns[0].lastStrong = bd->isoRuns[0].lastBase = t;
+ bd->isoRuns[0].contextDir = (UBiDiDirection)t;
+ bd->isoRuns[0].contextPos=0;
+ if(pBiDi->openingsMemory) {
+ bd->openings=pBiDi->openingsMemory;
+ bd->openingsCount=pBiDi->openingsSize / sizeof(Opening);
+ } else {
+ bd->openings=bd->simpleOpenings;
+ bd->openingsCount=SIMPLE_OPENINGS_COUNT;
+ }
+ bd->isNumbersSpecial=bd->pBiDi->reorderingMode==UBIDI_REORDER_NUMBERS_SPECIAL ||
+ bd->pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL;
+}
+
+/* paragraph boundary */
+static void
+bracketProcessB(BracketData *bd, UBiDiLevel level) {
+ bd->isoRunLast=0;
+ bd->isoRuns[0].limit=0;
+ bd->isoRuns[0].level=level;
+ bd->isoRuns[0].lastStrong=bd->isoRuns[0].lastBase=level&1;
+ bd->isoRuns[0].contextDir=(UBiDiDirection)(level&1);
+ bd->isoRuns[0].contextPos=0;
+}
+
+/* LRE, LRO, RLE, RLO, PDF */
+static void
+bracketProcessBoundary(BracketData *bd, int32_t lastCcPos,
+ UBiDiLevel contextLevel, UBiDiLevel embeddingLevel) {
+ IsoRun *pLastIsoRun=&bd->isoRuns[bd->isoRunLast];
+ DirProp *dirProps=bd->pBiDi->dirProps;
+ if(DIRPROP_FLAG(dirProps[lastCcPos])&MASK_ISO) /* after an isolate */
+ return;
+ if(NO_OVERRIDE(embeddingLevel)>NO_OVERRIDE(contextLevel)) /* not a PDF */
+ contextLevel=embeddingLevel;
+ pLastIsoRun->limit=pLastIsoRun->start;
+ pLastIsoRun->level=embeddingLevel;
+ pLastIsoRun->lastStrong=pLastIsoRun->lastBase=contextLevel&1;
+ pLastIsoRun->contextDir=(UBiDiDirection)(contextLevel&1);
+ pLastIsoRun->contextPos=(UBiDiDirection)lastCcPos;
+}
+
+/* LRI or RLI */
+static void
+bracketProcessLRI_RLI(BracketData *bd, UBiDiLevel level) {
+ IsoRun *pLastIsoRun=&bd->isoRuns[bd->isoRunLast];
+ int16_t lastLimit;
+ pLastIsoRun->lastBase=ON;
+ lastLimit=pLastIsoRun->limit;
+ bd->isoRunLast++;
+ pLastIsoRun++;
+ pLastIsoRun->start=pLastIsoRun->limit=lastLimit;
+ pLastIsoRun->level=level;
+ pLastIsoRun->lastStrong=pLastIsoRun->lastBase=level&1;
+ pLastIsoRun->contextDir=(UBiDiDirection)(level&1);
+ pLastIsoRun->contextPos=0;
+}
+
+/* PDI */
+static void
+bracketProcessPDI(BracketData *bd) {
+ IsoRun *pLastIsoRun;
+ bd->isoRunLast--;
+ pLastIsoRun=&bd->isoRuns[bd->isoRunLast];
+ pLastIsoRun->lastBase=ON;
+}
+
+/* newly found opening bracket: create an openings entry */
+static UBool /* return TRUE if success */
+bracketAddOpening(BracketData *bd, UChar match, int32_t position) {
+ IsoRun *pLastIsoRun=&bd->isoRuns[bd->isoRunLast];
+ Opening *pOpening;
+ if(pLastIsoRun->limit>=bd->openingsCount) { /* no available new entry */
+ UBiDi *pBiDi=bd->pBiDi;
+ if(!getInitialOpeningsMemory(pBiDi, pLastIsoRun->limit * 2))
+ return FALSE;
+ if(bd->openings==bd->simpleOpenings)
+ uprv_memcpy(pBiDi->openingsMemory, bd->simpleOpenings,
+ SIMPLE_OPENINGS_COUNT * sizeof(Opening));
+ bd->openings=pBiDi->openingsMemory; /* may have changed */
+ bd->openingsCount=pBiDi->openingsSize / sizeof(Opening);
+ }
+ pOpening=&bd->openings[pLastIsoRun->limit];
+ pOpening->position=position;
+ pOpening->match=match;
+ pOpening->contextDir=pLastIsoRun->contextDir;
+ pOpening->contextPos=pLastIsoRun->contextPos;
+ pOpening->flags=0;
+ pLastIsoRun->limit++;
+ return TRUE;
+}
+
+/* change N0c1 to N0c2 when a preceding bracket is assigned the embedding level */
+static void
+fixN0c(BracketData *bd, int32_t openingIndex, int32_t newPropPosition, DirProp newProp) {
+ /* This function calls itself recursively */
+ IsoRun *pLastIsoRun=&bd->isoRuns[bd->isoRunLast];
+ Opening *qOpening;
+ DirProp *dirProps=bd->pBiDi->dirProps;
+ int32_t k, openingPosition, closingPosition;
+ for(k=openingIndex+1, qOpening=&bd->openings[k]; k<pLastIsoRun->limit; k++, qOpening++) {
+ if(qOpening->match>=0) /* not an N0c match */
+ continue;
+ if(newPropPosition<qOpening->contextPos)
+ break;
+ if(newPropPosition>=qOpening->position)
+ continue;
+ if(newProp==qOpening->contextDir)
+ break;
+ openingPosition=qOpening->position;
+ dirProps[openingPosition]=newProp;
+ closingPosition=-(qOpening->match);
+ dirProps[closingPosition]=newProp;
+ qOpening->match=0; /* prevent further changes */
+ fixN0c(bd, k, openingPosition, newProp);
+ fixN0c(bd, k, closingPosition, newProp);
+ }
+}
+
+/* process closing bracket */
+static DirProp /* return L or R if N0b or N0c, ON if N0d */
+bracketProcessClosing(BracketData *bd, int32_t openIdx, int32_t position) {
+ IsoRun *pLastIsoRun=&bd->isoRuns[bd->isoRunLast];
+ Opening *pOpening, *qOpening;
+ UBiDiDirection direction;
+ UBool stable;
+ DirProp newProp;
+ pOpening=&bd->openings[openIdx];
+ direction=(UBiDiDirection)(pLastIsoRun->level&1);
+ stable=TRUE; /* assume stable until proved otherwise */
+
+ /* The stable flag is set when brackets are paired and their
+ level is resolved and cannot be changed by what will be
+ found later in the source string.
+ An unstable match can occur only when applying N0c, where
+ the resolved level depends on the preceding context, and
+ this context may be affected by text occurring later.
+ Example: RTL paragraph containing: abc[(latin) HEBREW]
+ When the closing parenthesis is encountered, it appears
+ that N0c1 must be applied since 'abc' sets an opposite
+ direction context and both parentheses receive level 2.
+ However, when the closing square bracket is processed,
+ N0b applies because of 'HEBREW' being included within the
+ brackets, thus the square brackets are treated like R and
+ receive level 1. However, this changes the preceding
+ context of the opening parenthesis, and it now appears
+ that N0c2 must be applied to the parentheses rather than
+ N0c1. */
+
+ if((direction==0 && pOpening->flags&FOUND_L) ||
+ (direction==1 && pOpening->flags&FOUND_R)) { /* N0b */
+ newProp=static_cast<DirProp>(direction);
+ }
+ else if(pOpening->flags&(FOUND_L|FOUND_R)) { /* N0c */
+ /* it is stable if there is no containing pair or in
+ conditions too complicated and not worth checking */
+ stable=(openIdx==pLastIsoRun->start);
+ if(direction!=pOpening->contextDir)
+ newProp= static_cast<DirProp>(pOpening->contextDir); /* N0c1 */
+ else
+ newProp= static_cast<DirProp>(direction); /* N0c2 */
+ } else {
+ /* forget this and any brackets nested within this pair */
+ pLastIsoRun->limit= static_cast<uint16_t>(openIdx);
+ return ON; /* N0d */
+ }
+ bd->pBiDi->dirProps[pOpening->position]=newProp;
+ bd->pBiDi->dirProps[position]=newProp;
+ /* Update nested N0c pairs that may be affected */
+ fixN0c(bd, openIdx, pOpening->position, newProp);
+ if(stable) {
+ pLastIsoRun->limit= static_cast<uint16_t>(openIdx); /* forget any brackets nested within this pair */
+ /* remove lower located synonyms if any */
+ while(pLastIsoRun->limit>pLastIsoRun->start &&
+ bd->openings[pLastIsoRun->limit-1].position==pOpening->position)
+ pLastIsoRun->limit--;
+ } else {
+ int32_t k;
+ pOpening->match=-position;
+ /* neutralize lower located synonyms if any */
+ k=openIdx-1;
+ while(k>=pLastIsoRun->start &&
+ bd->openings[k].position==pOpening->position)
+ bd->openings[k--].match=0;
+ /* neutralize any unmatched opening between the current pair;
+ this will also neutralize higher located synonyms if any */
+ for(k=openIdx+1; k<pLastIsoRun->limit; k++) {
+ qOpening=&bd->openings[k];
+ if(qOpening->position>=position)
+ break;
+ if(qOpening->match>0)
+ qOpening->match=0;
+ }
+ }
+ return newProp;
+}
+
+/* handle strong characters, digits and candidates for closing brackets */
+static UBool /* return TRUE if success */
+bracketProcessChar(BracketData *bd, int32_t position) {
+ IsoRun *pLastIsoRun=&bd->isoRuns[bd->isoRunLast];
+ DirProp *dirProps, dirProp, newProp;
+ UBiDiLevel level;
+ dirProps=bd->pBiDi->dirProps;
+ dirProp=dirProps[position];
+ if(dirProp==ON) {
+ UChar c, match;
+ int32_t idx;
+ /* First see if it is a matching closing bracket. Hopefully, this is
+ more efficient than checking if it is a closing bracket at all */
+ c=bd->pBiDi->text[position];
+ for(idx=pLastIsoRun->limit-1; idx>=pLastIsoRun->start; idx--) {
+ if(bd->openings[idx].match!=c)
+ continue;
+ /* We have a match */
+ newProp=bracketProcessClosing(bd, idx, position);
+ if(newProp==ON) { /* N0d */
+ c=0; /* prevent handling as an opening */
+ break;
+ }
+ pLastIsoRun->lastBase=ON;
+ pLastIsoRun->contextDir=(UBiDiDirection)newProp;
+ pLastIsoRun->contextPos=position;
+ level=bd->pBiDi->levels[position];
+ if(level&UBIDI_LEVEL_OVERRIDE) { /* X4, X5 */
+ uint16_t flag;
+ int32_t i;
+ newProp=level&1;
+ pLastIsoRun->lastStrong=newProp;
+ flag=DIRPROP_FLAG(newProp);
+ for(i=pLastIsoRun->start; i<idx; i++)
+ bd->openings[i].flags|=flag;
+ /* matching brackets are not overridden by LRO/RLO */
+ bd->pBiDi->levels[position]&=~UBIDI_LEVEL_OVERRIDE;
+ }
+ /* matching brackets are not overridden by LRO/RLO */
+ bd->pBiDi->levels[bd->openings[idx].position]&=~UBIDI_LEVEL_OVERRIDE;
+ return TRUE;
+ }
+ /* We get here only if the ON character is not a matching closing
+ bracket or it is a case of N0d */
+ /* Now see if it is an opening bracket */
+ if(c)
+ match= static_cast<UChar>(u_getBidiPairedBracket(c)); /* get the matching char */
+ else
+ match=0;
+ if(match!=c && /* has a matching char */
+ ubidi_getPairedBracketType(c)==U_BPT_OPEN) { /* opening bracket */
+ /* special case: process synonyms
+ create an opening entry for each synonym */
+ if(match==0x232A) { /* RIGHT-POINTING ANGLE BRACKET */
+ if(!bracketAddOpening(bd, 0x3009, position))
+ return FALSE;
+ }
+ else if(match==0x3009) { /* RIGHT ANGLE BRACKET */
+ if(!bracketAddOpening(bd, 0x232A, position))
+ return FALSE;
+ }
+ if(!bracketAddOpening(bd, match, position))
+ return FALSE;
+ }
+ }
+ level=bd->pBiDi->levels[position];
+ if(level&UBIDI_LEVEL_OVERRIDE) { /* X4, X5 */
+ newProp=level&1;
+ if(dirProp!=S && dirProp!=WS && dirProp!=ON)
+ dirProps[position]=newProp;
+ pLastIsoRun->lastBase=newProp;
+ pLastIsoRun->lastStrong=newProp;
+ pLastIsoRun->contextDir=(UBiDiDirection)newProp;
+ pLastIsoRun->contextPos=position;
+ }
+ else if(dirProp<=R || dirProp==AL) {
+ newProp= static_cast<DirProp>(DIR_FROM_STRONG(dirProp));
+ pLastIsoRun->lastBase=dirProp;
+ pLastIsoRun->lastStrong=dirProp;
+ pLastIsoRun->contextDir=(UBiDiDirection)newProp;
+ pLastIsoRun->contextPos=position;
+ }
+ else if(dirProp==EN) {
+ pLastIsoRun->lastBase=EN;
+ if(pLastIsoRun->lastStrong==L) {
+ newProp=L; /* W7 */
+ if(!bd->isNumbersSpecial)
+ dirProps[position]=ENL;
+ pLastIsoRun->contextDir=(UBiDiDirection)L;
+ pLastIsoRun->contextPos=position;
+ }
+ else {
+ newProp=R; /* N0 */
+ if(pLastIsoRun->lastStrong==AL)
+ dirProps[position]=AN; /* W2 */
+ else
+ dirProps[position]=ENR;
+ pLastIsoRun->contextDir=(UBiDiDirection)R;
+ pLastIsoRun->contextPos=position;
+ }
+ }
+ else if(dirProp==AN) {
+ newProp=R; /* N0 */
+ pLastIsoRun->lastBase=AN;
+ pLastIsoRun->contextDir=(UBiDiDirection)R;
+ pLastIsoRun->contextPos=position;
+ }
+ else if(dirProp==NSM) {
+ /* if the last real char was ON, change NSM to ON so that it
+ will stay ON even if the last real char is a bracket which
+ may be changed to L or R */
+ newProp=pLastIsoRun->lastBase;
+ if(newProp==ON)
+ dirProps[position]=newProp;
+ }
+ else {
+ newProp=dirProp;
+ pLastIsoRun->lastBase=dirProp;
+ }
+ if(newProp<=R || newProp==AL) {
+ int32_t i;
+ uint16_t flag=DIRPROP_FLAG(DIR_FROM_STRONG(newProp));
+ for(i=pLastIsoRun->start; i<pLastIsoRun->limit; i++)
+ if(position>bd->openings[i].position)
+ bd->openings[i].flags|=flag;
+ }
+ return TRUE;
+}
+
+/* perform (X1)..(X9) ------------------------------------------------------- */
+
+/* determine if the text is mixed-directional or single-directional */
+static UBiDiDirection
+directionFromFlags(UBiDi *pBiDi) {
+ Flags flags=pBiDi->flags;
+ /* if the text contains AN and neutrals, then some neutrals may become RTL */
+ if(!(flags&MASK_RTL || ((flags&DIRPROP_FLAG(AN)) && (flags&MASK_POSSIBLE_N)))) {
+ return UBIDI_LTR;
+ } else if(!(flags&MASK_LTR)) {
+ return UBIDI_RTL;
+ } else {
+ return UBIDI_MIXED;
+ }
+}
+
+/*
+ * Resolve the explicit levels as specified by explicit embedding codes.
+ * Recalculate the flags to have them reflect the real properties
+ * after taking the explicit embeddings into account.
+ *
+ * The BiDi algorithm is designed to result in the same behavior whether embedding
+ * levels are externally specified (from "styled text", supposedly the preferred
+ * method) or set by explicit embedding codes (LRx, RLx, PDF, FSI, PDI) in the plain text.
+ * That is why (X9) instructs to remove all not-isolate explicit codes (and BN).
+ * However, in a real implementation, the removal of these codes and their index
+ * positions in the plain text is undesirable since it would result in
+ * reallocated, reindexed text.
+ * Instead, this implementation leaves the codes in there and just ignores them
+ * in the subsequent processing.
+ * In order to get the same reordering behavior, positions with a BN or a not-isolate
+ * explicit embedding code just get the same level assigned as the last "real"
+ * character.
+ *
+ * Some implementations, not this one, then overwrite some of these
+ * directionality properties at "real" same-level-run boundaries by
+ * L or R codes so that the resolution of weak types can be performed on the
+ * entire paragraph at once instead of having to parse it once more and
+ * perform that resolution on same-level-runs.
+ * This limits the scope of the implicit rules in effectively
+ * the same way as the run limits.
+ *
+ * Instead, this implementation does not modify these codes, except for
+ * paired brackets whose properties (ON) may be replaced by L or R.
+ * On one hand, the paragraph has to be scanned for same-level-runs, but
+ * on the other hand, this saves another loop to reset these codes,
+ * or saves making and modifying a copy of dirProps[].
+ *
+ *
+ * Note that (Pn) and (Xn) changed significantly from version 4 of the BiDi algorithm.
+ *
+ *
+ * Handling the stack of explicit levels (Xn):
+ *
+ * With the BiDi stack of explicit levels, as pushed with each
+ * LRE, RLE, LRO, RLO, LRI, RLI and FSI and popped with each PDF and PDI,
+ * the explicit level must never exceed UBIDI_MAX_EXPLICIT_LEVEL.
+ *
+ * In order to have a correct push-pop semantics even in the case of overflows,
+ * overflow counters and a valid isolate counter are used as described in UAX#9
+ * section 3.3.2 "Explicit Levels and Directions".
+ *
+ * This implementation assumes that UBIDI_MAX_EXPLICIT_LEVEL is odd.
+ *
+ * Returns normally the direction; -1 if there was a memory shortage
+ *
+ */
+static UBiDiDirection
+resolveExplicitLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) {
+ DirProp *dirProps=pBiDi->dirProps;
+ UBiDiLevel *levels=pBiDi->levels;
+ const UChar *text=pBiDi->text;
+
+ int32_t i=0, length=pBiDi->length;
+ Flags flags=pBiDi->flags; /* collect all directionalities in the text */
+ DirProp dirProp;
+ UBiDiLevel level=GET_PARALEVEL(pBiDi, 0);
+ UBiDiDirection direction;
+ pBiDi->isolateCount=0;
+
+ if(U_FAILURE(*pErrorCode)) { return UBIDI_LTR; }
+
+ /* determine if the text is mixed-directional or single-directional */
+ direction=directionFromFlags(pBiDi);
+
+ /* we may not need to resolve any explicit levels */
+ if((direction!=UBIDI_MIXED)) {
+ /* not mixed directionality: levels don't matter - trailingWSStart will be 0 */
+ return direction;
+ }
+ if(pBiDi->reorderingMode > UBIDI_REORDER_LAST_LOGICAL_TO_VISUAL) {
+ /* inverse BiDi: mixed, but all characters are at the same embedding level */
+ /* set all levels to the paragraph level */
+ int32_t paraIndex, start, limit;
+ for(paraIndex=0; paraIndex<pBiDi->paraCount; paraIndex++) {
+ if(paraIndex==0)
+ start=0;
+ else
+ start=pBiDi->paras[paraIndex-1].limit;
+ limit=pBiDi->paras[paraIndex].limit;
+ level= static_cast<UBiDiLevel>(pBiDi->paras[paraIndex].level);
+ for(i=start; i<limit; i++)
+ levels[i]=level;
+ }
+ return direction; /* no bracket matching for inverse BiDi */
+ }
+ if(!(flags&(MASK_EXPLICIT|MASK_ISO))) {
+ /* no embeddings, set all levels to the paragraph level */
+ /* we still have to perform bracket matching */
+ int32_t paraIndex, start, limit;
+ BracketData bracketData;
+ bracketInit(pBiDi, &bracketData);
+ for(paraIndex=0; paraIndex<pBiDi->paraCount; paraIndex++) {
+ if(paraIndex==0)
+ start=0;
+ else
+ start=pBiDi->paras[paraIndex-1].limit;
+ limit=pBiDi->paras[paraIndex].limit;
+ level= static_cast<UBiDiLevel>(pBiDi->paras[paraIndex].level);
+ for(i=start; i<limit; i++) {
+ levels[i]=level;
+ dirProp=dirProps[i];
+ if(dirProp==BN)
+ continue;
+ if(dirProp==B) {
+ if((i+1)<length) {
+ if(text[i]==CR && text[i+1]==LF)
+ continue; /* skip CR when followed by LF */
+ bracketProcessB(&bracketData, level);
+ }
+ continue;
+ }
+ if(!bracketProcessChar(&bracketData, i)) {
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ return UBIDI_LTR;
+ }
+ }
+ }
+ return direction;
+ }
+ {
+ /* continue to perform (Xn) */
+
+ /* (X1) level is set for all codes, embeddingLevel keeps track of the push/pop operations */
+ /* both variables may carry the UBIDI_LEVEL_OVERRIDE flag to indicate the override status */
+ UBiDiLevel embeddingLevel=level, newLevel;
+ UBiDiLevel previousLevel=level; /* previous level for regular (not CC) characters */
+ int32_t lastCcPos=0; /* index of last effective LRx,RLx, PDx */
+
+ /* The following stack remembers the embedding level and the ISOLATE flag of level runs.
+ stackLast points to its current entry. */
+ uint16_t stack[UBIDI_MAX_EXPLICIT_LEVEL+2]; /* we never push anything >=UBIDI_MAX_EXPLICIT_LEVEL
+ but we need one more entry as base */
+ uint32_t stackLast=0;
+ int32_t overflowIsolateCount=0;
+ int32_t overflowEmbeddingCount=0;
+ int32_t validIsolateCount=0;
+ BracketData bracketData;
+ bracketInit(pBiDi, &bracketData);
+ stack[0]=level; /* initialize base entry to para level, no override, no isolate */
+
+ /* recalculate the flags */
+ flags=0;
+
+ for(i=0; i<length; ++i) {
+ dirProp=dirProps[i];
+ switch(dirProp) {
+ case LRE:
+ case RLE:
+ case LRO:
+ case RLO:
+ /* (X2, X3, X4, X5) */
+ flags|=DIRPROP_FLAG(BN);
+ levels[i]=previousLevel;
+ if (dirProp==LRE || dirProp==LRO)
+ /* least greater even level */
+ newLevel=(UBiDiLevel)((embeddingLevel+2)&~(UBIDI_LEVEL_OVERRIDE|1));
+ else
+ /* least greater odd level */
+ newLevel=(UBiDiLevel)((NO_OVERRIDE(embeddingLevel)+1)|1);
+ if(newLevel<=UBIDI_MAX_EXPLICIT_LEVEL && overflowIsolateCount==0 &&
+ overflowEmbeddingCount==0) {
+ lastCcPos=i;
+ embeddingLevel=newLevel;
+ if(dirProp==LRO || dirProp==RLO)
+ embeddingLevel|=UBIDI_LEVEL_OVERRIDE;
+ stackLast++;
+ stack[stackLast]=embeddingLevel;
+ /* we don't need to set UBIDI_LEVEL_OVERRIDE off for LRE and RLE
+ since this has already been done for newLevel which is
+ the source for embeddingLevel.
+ */
+ } else {
+ if(overflowIsolateCount==0)
+ overflowEmbeddingCount++;
+ }
+ break;
+ case PDF:
+ /* (X7) */
+ flags|=DIRPROP_FLAG(BN);
+ levels[i]=previousLevel;
+ /* handle all the overflow cases first */
+ if(overflowIsolateCount) {
+ break;
+ }
+ if(overflowEmbeddingCount) {
+ overflowEmbeddingCount--;
+ break;
+ }
+ if(stackLast>0 && stack[stackLast]<ISOLATE) { /* not an isolate entry */
+ lastCcPos=i;
+ stackLast--;
+ embeddingLevel=(UBiDiLevel)stack[stackLast];
+ }
+ break;
+ case LRI:
+ case RLI:
+ flags|=(DIRPROP_FLAG(ON)|DIRPROP_FLAG_LR(embeddingLevel));
+ levels[i]=NO_OVERRIDE(embeddingLevel);
+ if(NO_OVERRIDE(embeddingLevel)!=NO_OVERRIDE(previousLevel)) {
+ bracketProcessBoundary(&bracketData, lastCcPos,
+ previousLevel, embeddingLevel);
+ flags|=DIRPROP_FLAG_MULTI_RUNS;
+ }
+ previousLevel=embeddingLevel;
+ /* (X5a, X5b) */
+ if(dirProp==LRI)
+ /* least greater even level */
+ newLevel=(UBiDiLevel)((embeddingLevel+2)&~(UBIDI_LEVEL_OVERRIDE|1));
+ else
+ /* least greater odd level */
+ newLevel=(UBiDiLevel)((NO_OVERRIDE(embeddingLevel)+1)|1);
+ if(newLevel<=UBIDI_MAX_EXPLICIT_LEVEL && overflowIsolateCount==0 &&
+ overflowEmbeddingCount==0) {
+ flags|=DIRPROP_FLAG(dirProp);
+ lastCcPos=i;
+ validIsolateCount++;
+ if(validIsolateCount>pBiDi->isolateCount)
+ pBiDi->isolateCount=validIsolateCount;
+ embeddingLevel=newLevel;
+ /* we can increment stackLast without checking because newLevel
+ will exceed UBIDI_MAX_EXPLICIT_LEVEL before stackLast overflows */
+ stackLast++;
+ stack[stackLast]=embeddingLevel+ISOLATE;
+ bracketProcessLRI_RLI(&bracketData, embeddingLevel);
+ } else {
+ /* make it WS so that it is handled by adjustWSLevels() */
+ dirProps[i]=WS;
+ overflowIsolateCount++;
+ }
+ break;
+ case PDI:
+ if(NO_OVERRIDE(embeddingLevel)!=NO_OVERRIDE(previousLevel)) {
+ bracketProcessBoundary(&bracketData, lastCcPos,
+ previousLevel, embeddingLevel);
+ flags|=DIRPROP_FLAG_MULTI_RUNS;
+ }
+ /* (X6a) */
+ if(overflowIsolateCount) {
+ overflowIsolateCount--;
+ /* make it WS so that it is handled by adjustWSLevels() */
+ dirProps[i]=WS;
+ }
+ else if(validIsolateCount) {
+ flags|=DIRPROP_FLAG(PDI);
+ lastCcPos=i;
+ overflowEmbeddingCount=0;
+ while(stack[stackLast]<ISOLATE) /* pop embedding entries */
+ stackLast--; /* until the last isolate entry */
+ stackLast--; /* pop also the last isolate entry */
+ validIsolateCount--;
+ bracketProcessPDI(&bracketData);
+ } else
+ /* make it WS so that it is handled by adjustWSLevels() */
+ dirProps[i]=WS;
+ embeddingLevel=(UBiDiLevel)stack[stackLast]&~ISOLATE;
+ flags|=(DIRPROP_FLAG(ON)|DIRPROP_FLAG_LR(embeddingLevel));
+ previousLevel=embeddingLevel;
+ levels[i]=NO_OVERRIDE(embeddingLevel);
+ break;
+ case B:
+ flags|=DIRPROP_FLAG(B);
+ levels[i]=GET_PARALEVEL(pBiDi, i);
+ if((i+1)<length) {
+ if(text[i]==CR && text[i+1]==LF)
+ break; /* skip CR when followed by LF */
+ overflowEmbeddingCount=overflowIsolateCount=0;
+ validIsolateCount=0;
+ stackLast=0;
+ previousLevel=embeddingLevel=GET_PARALEVEL(pBiDi, i+1);
+ stack[0]=embeddingLevel; /* initialize base entry to para level, no override, no isolate */
+ bracketProcessB(&bracketData, embeddingLevel);
+ }
+ break;
+ case BN:
+ /* BN, LRE, RLE, and PDF are supposed to be removed (X9) */
+ /* they will get their levels set correctly in adjustWSLevels() */
+ levels[i]=previousLevel;
+ flags|=DIRPROP_FLAG(BN);
+ break;
+ default:
+ /* all other types are normal characters and get the "real" level */
+ if(NO_OVERRIDE(embeddingLevel)!=NO_OVERRIDE(previousLevel)) {
+ bracketProcessBoundary(&bracketData, lastCcPos,
+ previousLevel, embeddingLevel);
+ flags|=DIRPROP_FLAG_MULTI_RUNS;
+ if(embeddingLevel&UBIDI_LEVEL_OVERRIDE)
+ flags|=DIRPROP_FLAG_O(embeddingLevel);
+ else
+ flags|=DIRPROP_FLAG_E(embeddingLevel);
+ }
+ previousLevel=embeddingLevel;
+ levels[i]=embeddingLevel;
+ if(!bracketProcessChar(&bracketData, i))
+ return (UBiDiDirection)-1;
+ /* the dirProp may have been changed in bracketProcessChar() */
+ flags|=DIRPROP_FLAG(dirProps[i]);
+ break;
+ }
+ }
+ if(flags&MASK_EMBEDDING)
+ flags|=DIRPROP_FLAG_LR(pBiDi->paraLevel);
+ if(pBiDi->orderParagraphsLTR && (flags&DIRPROP_FLAG(B)))
+ flags|=DIRPROP_FLAG(L);
+ /* again, determine if the text is mixed-directional or single-directional */
+ pBiDi->flags=flags;
+ direction=directionFromFlags(pBiDi);
+ }
+ return direction;
+}
+
+/*
+ * Use a pre-specified embedding levels array:
+ *
+ * Adjust the directional properties for overrides (->LEVEL_OVERRIDE),
+ * ignore all explicit codes (X9),
+ * and check all the preset levels.
+ *
+ * Recalculate the flags to have them reflect the real properties
+ * after taking the explicit embeddings into account.
+ */
+static UBiDiDirection
+checkExplicitLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) {
+ DirProp *dirProps=pBiDi->dirProps;
+ UBiDiLevel *levels=pBiDi->levels;
+ int32_t isolateCount=0;
+
+ int32_t length=pBiDi->length;
+ Flags flags=0; /* collect all directionalities in the text */
+ pBiDi->isolateCount=0;
+
+ int32_t currentParaIndex = 0;
+ int32_t currentParaLimit = pBiDi->paras[0].limit;
+ int32_t currentParaLevel = pBiDi->paraLevel;
+
+ for(int32_t i=0; i<length; ++i) {
+ UBiDiLevel level=levels[i];
+ DirProp dirProp=dirProps[i];
+ if(dirProp==LRI || dirProp==RLI) {
+ isolateCount++;
+ if(isolateCount>pBiDi->isolateCount)
+ pBiDi->isolateCount=isolateCount;
+ }
+ else if(dirProp==PDI)
+ isolateCount--;
+ else if(dirProp==B)
+ isolateCount=0;
+
+ // optimized version of int32_t currentParaLevel = GET_PARALEVEL(pBiDi, i);
+ if (pBiDi->defaultParaLevel != 0 &&
+ i == currentParaLimit && (currentParaIndex + 1) < pBiDi->paraCount) {
+ currentParaLevel = pBiDi->paras[++currentParaIndex].level;
+ currentParaLimit = pBiDi->paras[currentParaIndex].limit;
+ }
+
+ UBiDiLevel overrideFlag = level & UBIDI_LEVEL_OVERRIDE;
+ level &= ~UBIDI_LEVEL_OVERRIDE;
+ if (level < currentParaLevel || UBIDI_MAX_EXPLICIT_LEVEL < level) {
+ if (level == 0) {
+ if (dirProp == B) {
+ // Paragraph separators are ok with explicit level 0.
+ // Prevents reordering of paragraphs.
+ } else {
+ // Treat explicit level 0 as a wildcard for the paragraph level.
+ // Avoid making the caller guess what the paragraph level would be.
+ level = (UBiDiLevel)currentParaLevel;
+ levels[i] = level | overrideFlag;
+ }
+ } else {
+ // 1 <= level < currentParaLevel or UBIDI_MAX_EXPLICIT_LEVEL < level
+ /* level out of bounds */
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return UBIDI_LTR;
+ }
+ }
+ if (overrideFlag != 0) {
+ /* keep the override flag in levels[i] but adjust the flags */
+ flags|=DIRPROP_FLAG_O(level);
+ } else {
+ /* set the flags */
+ flags|=DIRPROP_FLAG_E(level)|DIRPROP_FLAG(dirProp);
+ }
+ }
+ if(flags&MASK_EMBEDDING)
+ flags|=DIRPROP_FLAG_LR(pBiDi->paraLevel);
+ /* determine if the text is mixed-directional or single-directional */
+ pBiDi->flags=flags;
+ return directionFromFlags(pBiDi);
+}
+
+/******************************************************************
+ The Properties state machine table
+*******************************************************************
+
+ All table cells are 8 bits:
+ bits 0..4: next state
+ bits 5..7: action to perform (if > 0)
+
+ Cells may be of format "n" where n represents the next state
+ (except for the rightmost column).
+ Cells may also be of format "s(x,y)" where x represents an action
+ to perform and y represents the next state.
+
+*******************************************************************
+ Definitions and type for properties state table
+*******************************************************************
+*/
+#define IMPTABPROPS_COLUMNS 16
+#define IMPTABPROPS_RES (IMPTABPROPS_COLUMNS - 1)
+#define GET_STATEPROPS(cell) ((cell)&0x1f)
+#define GET_ACTIONPROPS(cell) ((cell)>>5)
+#define s(action, newState) ((uint8_t)(newState+(action<<5)))
+
+static const uint8_t groupProp[] = /* dirProp regrouped */
+{
+/* L R EN ES ET AN CS B S WS ON LRE LRO AL RLE RLO PDF NSM BN FSI LRI RLI PDI ENL ENR */
+ 0, 1, 2, 7, 8, 3, 9, 6, 5, 4, 4, 10, 10, 12, 10, 10, 10, 11, 10, 4, 4, 4, 4, 13, 14
+};
+enum { DirProp_L=0, DirProp_R=1, DirProp_EN=2, DirProp_AN=3, DirProp_ON=4, DirProp_S=5, DirProp_B=6 }; /* reduced dirProp */
+
+/******************************************************************
+
+ PROPERTIES STATE TABLE
+
+ In table impTabProps,
+ - the ON column regroups ON and WS, FSI, RLI, LRI and PDI
+ - the BN column regroups BN, LRE, RLE, LRO, RLO, PDF
+ - the Res column is the reduced property assigned to a run
+
+ Action 1: process current run1, init new run1
+ 2: init new run2
+ 3: process run1, process run2, init new run1
+ 4: process run1, set run1=run2, init new run2
+
+ Notes:
+ 1) This table is used in resolveImplicitLevels().
+ 2) This table triggers actions when there is a change in the Bidi
+ property of incoming characters (action 1).
+ 3) Most such property sequences are processed immediately (in
+ fact, passed to processPropertySeq().
+ 4) However, numbers are assembled as one sequence. This means
+ that undefined situations (like CS following digits, until
+ it is known if the next char will be a digit) are held until
+ following chars define them.
+ Example: digits followed by CS, then comes another CS or ON;
+ the digits will be processed, then the CS assigned
+ as the start of an ON sequence (action 3).
+ 5) There are cases where more than one sequence must be
+ processed, for instance digits followed by CS followed by L:
+ the digits must be processed as one sequence, and the CS
+ must be processed as an ON sequence, all this before starting
+ assembling chars for the opening L sequence.
+
+
+*/
+static const uint8_t impTabProps[][IMPTABPROPS_COLUMNS] =
+{
+/* L , R , EN , AN , ON , S , B , ES , ET , CS , BN , NSM , AL , ENL , ENR , Res */
+/* 0 Init */ { 1 , 2 , 4 , 5 , 7 , 15 , 17 , 7 , 9 , 7 , 0 , 7 , 3 , 18 , 21 , DirProp_ON },
+/* 1 L */ { 1 , s(1,2), s(1,4), s(1,5), s(1,7),s(1,15),s(1,17), s(1,7), s(1,9), s(1,7), 1 , 1 , s(1,3),s(1,18),s(1,21), DirProp_L },
+/* 2 R */ { s(1,1), 2 , s(1,4), s(1,5), s(1,7),s(1,15),s(1,17), s(1,7), s(1,9), s(1,7), 2 , 2 , s(1,3),s(1,18),s(1,21), DirProp_R },
+/* 3 AL */ { s(1,1), s(1,2), s(1,6), s(1,6), s(1,8),s(1,16),s(1,17), s(1,8), s(1,8), s(1,8), 3 , 3 , 3 ,s(1,18),s(1,21), DirProp_R },
+/* 4 EN */ { s(1,1), s(1,2), 4 , s(1,5), s(1,7),s(1,15),s(1,17),s(2,10), 11 ,s(2,10), 4 , 4 , s(1,3), 18 , 21 , DirProp_EN },
+/* 5 AN */ { s(1,1), s(1,2), s(1,4), 5 , s(1,7),s(1,15),s(1,17), s(1,7), s(1,9),s(2,12), 5 , 5 , s(1,3),s(1,18),s(1,21), DirProp_AN },
+/* 6 AL:EN/AN */ { s(1,1), s(1,2), 6 , 6 , s(1,8),s(1,16),s(1,17), s(1,8), s(1,8),s(2,13), 6 , 6 , s(1,3), 18 , 21 , DirProp_AN },
+/* 7 ON */ { s(1,1), s(1,2), s(1,4), s(1,5), 7 ,s(1,15),s(1,17), 7 ,s(2,14), 7 , 7 , 7 , s(1,3),s(1,18),s(1,21), DirProp_ON },
+/* 8 AL:ON */ { s(1,1), s(1,2), s(1,6), s(1,6), 8 ,s(1,16),s(1,17), 8 , 8 , 8 , 8 , 8 , s(1,3),s(1,18),s(1,21), DirProp_ON },
+/* 9 ET */ { s(1,1), s(1,2), 4 , s(1,5), 7 ,s(1,15),s(1,17), 7 , 9 , 7 , 9 , 9 , s(1,3), 18 , 21 , DirProp_ON },
+/*10 EN+ES/CS */ { s(3,1), s(3,2), 4 , s(3,5), s(4,7),s(3,15),s(3,17), s(4,7),s(4,14), s(4,7), 10 , s(4,7), s(3,3), 18 , 21 , DirProp_EN },
+/*11 EN+ET */ { s(1,1), s(1,2), 4 , s(1,5), s(1,7),s(1,15),s(1,17), s(1,7), 11 , s(1,7), 11 , 11 , s(1,3), 18 , 21 , DirProp_EN },
+/*12 AN+CS */ { s(3,1), s(3,2), s(3,4), 5 , s(4,7),s(3,15),s(3,17), s(4,7),s(4,14), s(4,7), 12 , s(4,7), s(3,3),s(3,18),s(3,21), DirProp_AN },
+/*13 AL:EN/AN+CS */ { s(3,1), s(3,2), 6 , 6 , s(4,8),s(3,16),s(3,17), s(4,8), s(4,8), s(4,8), 13 , s(4,8), s(3,3), 18 , 21 , DirProp_AN },
+/*14 ON+ET */ { s(1,1), s(1,2), s(4,4), s(1,5), 7 ,s(1,15),s(1,17), 7 , 14 , 7 , 14 , 14 , s(1,3),s(4,18),s(4,21), DirProp_ON },
+/*15 S */ { s(1,1), s(1,2), s(1,4), s(1,5), s(1,7), 15 ,s(1,17), s(1,7), s(1,9), s(1,7), 15 , s(1,7), s(1,3),s(1,18),s(1,21), DirProp_S },
+/*16 AL:S */ { s(1,1), s(1,2), s(1,6), s(1,6), s(1,8), 16 ,s(1,17), s(1,8), s(1,8), s(1,8), 16 , s(1,8), s(1,3),s(1,18),s(1,21), DirProp_S },
+/*17 B */ { s(1,1), s(1,2), s(1,4), s(1,5), s(1,7),s(1,15), 17 , s(1,7), s(1,9), s(1,7), 17 , s(1,7), s(1,3),s(1,18),s(1,21), DirProp_B },
+/*18 ENL */ { s(1,1), s(1,2), 18 , s(1,5), s(1,7),s(1,15),s(1,17),s(2,19), 20 ,s(2,19), 18 , 18 , s(1,3), 18 , 21 , DirProp_L },
+/*19 ENL+ES/CS */ { s(3,1), s(3,2), 18 , s(3,5), s(4,7),s(3,15),s(3,17), s(4,7),s(4,14), s(4,7), 19 , s(4,7), s(3,3), 18 , 21 , DirProp_L },
+/*20 ENL+ET */ { s(1,1), s(1,2), 18 , s(1,5), s(1,7),s(1,15),s(1,17), s(1,7), 20 , s(1,7), 20 , 20 , s(1,3), 18 , 21 , DirProp_L },
+/*21 ENR */ { s(1,1), s(1,2), 21 , s(1,5), s(1,7),s(1,15),s(1,17),s(2,22), 23 ,s(2,22), 21 , 21 , s(1,3), 18 , 21 , DirProp_AN },
+/*22 ENR+ES/CS */ { s(3,1), s(3,2), 21 , s(3,5), s(4,7),s(3,15),s(3,17), s(4,7),s(4,14), s(4,7), 22 , s(4,7), s(3,3), 18 , 21 , DirProp_AN },
+/*23 ENR+ET */ { s(1,1), s(1,2), 21 , s(1,5), s(1,7),s(1,15),s(1,17), s(1,7), 23 , s(1,7), 23 , 23 , s(1,3), 18 , 21 , DirProp_AN }
+};
+
+/* we must undef macro s because the levels tables have a different
+ * structure (4 bits for action and 4 bits for next state.
+ */
+#undef s
+
+/******************************************************************
+ The levels state machine tables
+*******************************************************************
+
+ All table cells are 8 bits:
+ bits 0..3: next state
+ bits 4..7: action to perform (if > 0)
+
+ Cells may be of format "n" where n represents the next state
+ (except for the rightmost column).
+ Cells may also be of format "s(x,y)" where x represents an action
+ to perform and y represents the next state.
+
+ This format limits each table to 16 states each and to 15 actions.
+
+*******************************************************************
+ Definitions and type for levels state tables
+*******************************************************************
+*/
+#define IMPTABLEVELS_COLUMNS (DirProp_B + 2)
+#define IMPTABLEVELS_RES (IMPTABLEVELS_COLUMNS - 1)
+#define GET_STATE(cell) ((cell)&0x0f)
+#define GET_ACTION(cell) ((cell)>>4)
+#define s(action, newState) ((uint8_t)(newState+(action<<4)))
+
+typedef uint8_t ImpTab[][IMPTABLEVELS_COLUMNS];
+typedef uint8_t ImpAct[];
+
+/* FOOD FOR THOUGHT: each ImpTab should have its associated ImpAct,
+ * instead of having a pair of ImpTab and a pair of ImpAct.
+ */
+typedef struct ImpTabPair {
+ const void * pImpTab[2];
+ const void * pImpAct[2];
+} ImpTabPair;
+
+/******************************************************************
+
+ LEVELS STATE TABLES
+
+ In all levels state tables,
+ - state 0 is the initial state
+ - the Res column is the increment to add to the text level
+ for this property sequence.
+
+ The impAct arrays for each table of a pair map the local action
+ numbers of the table to the total list of actions. For instance,
+ action 2 in a given table corresponds to the action number which
+ appears in entry [2] of the impAct array for that table.
+ The first entry of all impAct arrays must be 0.
+
+ Action 1: init conditional sequence
+ 2: prepend conditional sequence to current sequence
+ 3: set ON sequence to new level - 1
+ 4: init EN/AN/ON sequence
+ 5: fix EN/AN/ON sequence followed by R
+ 6: set previous level sequence to level 2
+
+ Notes:
+ 1) These tables are used in processPropertySeq(). The input
+ is property sequences as determined by resolveImplicitLevels.
+ 2) Most such property sequences are processed immediately
+ (levels are assigned).
+ 3) However, some sequences cannot be assigned a final level till
+ one or more following sequences are received. For instance,
+ ON following an R sequence within an even-level paragraph.
+ If the following sequence is R, the ON sequence will be
+ assigned basic run level+1, and so will the R sequence.
+ 4) S is generally handled like ON, since its level will be fixed
+ to paragraph level in adjustWSLevels().
+
+*/
+
+static const ImpTab impTabL_DEFAULT = /* Even paragraph level */
+/* In this table, conditional sequences receive the lower possible level
+ until proven otherwise.
+*/
+{
+/* L , R , EN , AN , ON , S , B , Res */
+/* 0 : init */ { 0 , 1 , 0 , 2 , 0 , 0 , 0 , 0 },
+/* 1 : R */ { 0 , 1 , 3 , 3 , s(1,4), s(1,4), 0 , 1 },
+/* 2 : AN */ { 0 , 1 , 0 , 2 , s(1,5), s(1,5), 0 , 2 },
+/* 3 : R+EN/AN */ { 0 , 1 , 3 , 3 , s(1,4), s(1,4), 0 , 2 },
+/* 4 : R+ON */ { 0 , s(2,1), s(3,3), s(3,3), 4 , 4 , 0 , 0 },
+/* 5 : AN+ON */ { 0 , s(2,1), 0 , s(3,2), 5 , 5 , 0 , 0 }
+};
+static const ImpTab impTabR_DEFAULT = /* Odd paragraph level */
+/* In this table, conditional sequences receive the lower possible level
+ until proven otherwise.
+*/
+{
+/* L , R , EN , AN , ON , S , B , Res */
+/* 0 : init */ { 1 , 0 , 2 , 2 , 0 , 0 , 0 , 0 },
+/* 1 : L */ { 1 , 0 , 1 , 3 , s(1,4), s(1,4), 0 , 1 },
+/* 2 : EN/AN */ { 1 , 0 , 2 , 2 , 0 , 0 , 0 , 1 },
+/* 3 : L+AN */ { 1 , 0 , 1 , 3 , 5 , 5 , 0 , 1 },
+/* 4 : L+ON */ { s(2,1), 0 , s(2,1), 3 , 4 , 4 , 0 , 0 },
+/* 5 : L+AN+ON */ { 1 , 0 , 1 , 3 , 5 , 5 , 0 , 0 }
+};
+static const ImpAct impAct0 = {0,1,2,3,4};
+static const ImpTabPair impTab_DEFAULT = {{&impTabL_DEFAULT,
+ &impTabR_DEFAULT},
+ {&impAct0, &impAct0}};
+
+static const ImpTab impTabL_NUMBERS_SPECIAL = /* Even paragraph level */
+/* In this table, conditional sequences receive the lower possible level
+ until proven otherwise.
+*/
+{
+/* L , R , EN , AN , ON , S , B , Res */
+/* 0 : init */ { 0 , 2 , s(1,1), s(1,1), 0 , 0 , 0 , 0 },
+/* 1 : L+EN/AN */ { 0 , s(4,2), 1 , 1 , 0 , 0 , 0 , 0 },
+/* 2 : R */ { 0 , 2 , 4 , 4 , s(1,3), s(1,3), 0 , 1 },
+/* 3 : R+ON */ { 0 , s(2,2), s(3,4), s(3,4), 3 , 3 , 0 , 0 },
+/* 4 : R+EN/AN */ { 0 , 2 , 4 , 4 , s(1,3), s(1,3), 0 , 2 }
+};
+static const ImpTabPair impTab_NUMBERS_SPECIAL = {{&impTabL_NUMBERS_SPECIAL,
+ &impTabR_DEFAULT},
+ {&impAct0, &impAct0}};
+
+static const ImpTab impTabL_GROUP_NUMBERS_WITH_R =
+/* In this table, EN/AN+ON sequences receive levels as if associated with R
+ until proven that there is L or sor/eor on both sides. AN is handled like EN.
+*/
+{
+/* L , R , EN , AN , ON , S , B , Res */
+/* 0 init */ { 0 , 3 , s(1,1), s(1,1), 0 , 0 , 0 , 0 },
+/* 1 EN/AN */ { s(2,0), 3 , 1 , 1 , 2 , s(2,0), s(2,0), 2 },
+/* 2 EN/AN+ON */ { s(2,0), 3 , 1 , 1 , 2 , s(2,0), s(2,0), 1 },
+/* 3 R */ { 0 , 3 , 5 , 5 , s(1,4), 0 , 0 , 1 },
+/* 4 R+ON */ { s(2,0), 3 , 5 , 5 , 4 , s(2,0), s(2,0), 1 },
+/* 5 R+EN/AN */ { 0 , 3 , 5 , 5 , s(1,4), 0 , 0 , 2 }
+};
+static const ImpTab impTabR_GROUP_NUMBERS_WITH_R =
+/* In this table, EN/AN+ON sequences receive levels as if associated with R
+ until proven that there is L on both sides. AN is handled like EN.
+*/
+{
+/* L , R , EN , AN , ON , S , B , Res */
+/* 0 init */ { 2 , 0 , 1 , 1 , 0 , 0 , 0 , 0 },
+/* 1 EN/AN */ { 2 , 0 , 1 , 1 , 0 , 0 , 0 , 1 },
+/* 2 L */ { 2 , 0 , s(1,4), s(1,4), s(1,3), 0 , 0 , 1 },
+/* 3 L+ON */ { s(2,2), 0 , 4 , 4 , 3 , 0 , 0 , 0 },
+/* 4 L+EN/AN */ { s(2,2), 0 , 4 , 4 , 3 , 0 , 0 , 1 }
+};
+static const ImpTabPair impTab_GROUP_NUMBERS_WITH_R = {
+ {&impTabL_GROUP_NUMBERS_WITH_R,
+ &impTabR_GROUP_NUMBERS_WITH_R},
+ {&impAct0, &impAct0}};
+
+
+static const ImpTab impTabL_INVERSE_NUMBERS_AS_L =
+/* This table is identical to the Default LTR table except that EN and AN are
+ handled like L.
+*/
+{
+/* L , R , EN , AN , ON , S , B , Res */
+/* 0 : init */ { 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 },
+/* 1 : R */ { 0 , 1 , 0 , 0 , s(1,4), s(1,4), 0 , 1 },
+/* 2 : AN */ { 0 , 1 , 0 , 0 , s(1,5), s(1,5), 0 , 2 },
+/* 3 : R+EN/AN */ { 0 , 1 , 0 , 0 , s(1,4), s(1,4), 0 , 2 },
+/* 4 : R+ON */ { s(2,0), 1 , s(2,0), s(2,0), 4 , 4 , s(2,0), 1 },
+/* 5 : AN+ON */ { s(2,0), 1 , s(2,0), s(2,0), 5 , 5 , s(2,0), 1 }
+};
+static const ImpTab impTabR_INVERSE_NUMBERS_AS_L =
+/* This table is identical to the Default RTL table except that EN and AN are
+ handled like L.
+*/
+{
+/* L , R , EN , AN , ON , S , B , Res */
+/* 0 : init */ { 1 , 0 , 1 , 1 , 0 , 0 , 0 , 0 },
+/* 1 : L */ { 1 , 0 , 1 , 1 , s(1,4), s(1,4), 0 , 1 },
+/* 2 : EN/AN */ { 1 , 0 , 1 , 1 , 0 , 0 , 0 , 1 },
+/* 3 : L+AN */ { 1 , 0 , 1 , 1 , 5 , 5 , 0 , 1 },
+/* 4 : L+ON */ { s(2,1), 0 , s(2,1), s(2,1), 4 , 4 , 0 , 0 },
+/* 5 : L+AN+ON */ { 1 , 0 , 1 , 1 , 5 , 5 , 0 , 0 }
+};
+static const ImpTabPair impTab_INVERSE_NUMBERS_AS_L = {
+ {&impTabL_INVERSE_NUMBERS_AS_L,
+ &impTabR_INVERSE_NUMBERS_AS_L},
+ {&impAct0, &impAct0}};
+
+static const ImpTab impTabR_INVERSE_LIKE_DIRECT = /* Odd paragraph level */
+/* In this table, conditional sequences receive the lower possible level
+ until proven otherwise.
+*/
+{
+/* L , R , EN , AN , ON , S , B , Res */
+/* 0 : init */ { 1 , 0 , 2 , 2 , 0 , 0 , 0 , 0 },
+/* 1 : L */ { 1 , 0 , 1 , 2 , s(1,3), s(1,3), 0 , 1 },
+/* 2 : EN/AN */ { 1 , 0 , 2 , 2 , 0 , 0 , 0 , 1 },
+/* 3 : L+ON */ { s(2,1), s(3,0), 6 , 4 , 3 , 3 , s(3,0), 0 },
+/* 4 : L+ON+AN */ { s(2,1), s(3,0), 6 , 4 , 5 , 5 , s(3,0), 3 },
+/* 5 : L+AN+ON */ { s(2,1), s(3,0), 6 , 4 , 5 , 5 , s(3,0), 2 },
+/* 6 : L+ON+EN */ { s(2,1), s(3,0), 6 , 4 , 3 , 3 , s(3,0), 1 }
+};
+static const ImpAct impAct1 = {0,1,13,14};
+/* FOOD FOR THOUGHT: in LTR table below, check case "JKL 123abc"
+ */
+static const ImpTabPair impTab_INVERSE_LIKE_DIRECT = {
+ {&impTabL_DEFAULT,
+ &impTabR_INVERSE_LIKE_DIRECT},
+ {&impAct0, &impAct1}};
+
+static const ImpTab impTabL_INVERSE_LIKE_DIRECT_WITH_MARKS =
+/* The case handled in this table is (visually): R EN L
+*/
+{
+/* L , R , EN , AN , ON , S , B , Res */
+/* 0 : init */ { 0 , s(6,3), 0 , 1 , 0 , 0 , 0 , 0 },
+/* 1 : L+AN */ { 0 , s(6,3), 0 , 1 , s(1,2), s(3,0), 0 , 4 },
+/* 2 : L+AN+ON */ { s(2,0), s(6,3), s(2,0), 1 , 2 , s(3,0), s(2,0), 3 },
+/* 3 : R */ { 0 , s(6,3), s(5,5), s(5,6), s(1,4), s(3,0), 0 , 3 },
+/* 4 : R+ON */ { s(3,0), s(4,3), s(5,5), s(5,6), 4 , s(3,0), s(3,0), 3 },
+/* 5 : R+EN */ { s(3,0), s(4,3), 5 , s(5,6), s(1,4), s(3,0), s(3,0), 4 },
+/* 6 : R+AN */ { s(3,0), s(4,3), s(5,5), 6 , s(1,4), s(3,0), s(3,0), 4 }
+};
+static const ImpTab impTabR_INVERSE_LIKE_DIRECT_WITH_MARKS =
+/* The cases handled in this table are (visually): R EN L
+ R L AN L
+*/
+{
+/* L , R , EN , AN , ON , S , B , Res */
+/* 0 : init */ { s(1,3), 0 , 1 , 1 , 0 , 0 , 0 , 0 },
+/* 1 : R+EN/AN */ { s(2,3), 0 , 1 , 1 , 2 , s(4,0), 0 , 1 },
+/* 2 : R+EN/AN+ON */ { s(2,3), 0 , 1 , 1 , 2 , s(4,0), 0 , 0 },
+/* 3 : L */ { 3 , 0 , 3 , s(3,6), s(1,4), s(4,0), 0 , 1 },
+/* 4 : L+ON */ { s(5,3), s(4,0), 5 , s(3,6), 4 , s(4,0), s(4,0), 0 },
+/* 5 : L+ON+EN */ { s(5,3), s(4,0), 5 , s(3,6), 4 , s(4,0), s(4,0), 1 },
+/* 6 : L+AN */ { s(5,3), s(4,0), 6 , 6 , 4 , s(4,0), s(4,0), 3 }
+};
+static const ImpAct impAct2 = {0,1,2,5,6,7,8};
+static const ImpAct impAct3 = {0,1,9,10,11,12};
+static const ImpTabPair impTab_INVERSE_LIKE_DIRECT_WITH_MARKS = {
+ {&impTabL_INVERSE_LIKE_DIRECT_WITH_MARKS,
+ &impTabR_INVERSE_LIKE_DIRECT_WITH_MARKS},
+ {&impAct2, &impAct3}};
+
+static const ImpTabPair impTab_INVERSE_FOR_NUMBERS_SPECIAL = {
+ {&impTabL_NUMBERS_SPECIAL,
+ &impTabR_INVERSE_LIKE_DIRECT},
+ {&impAct0, &impAct1}};
+
+static const ImpTab impTabL_INVERSE_FOR_NUMBERS_SPECIAL_WITH_MARKS =
+/* The case handled in this table is (visually): R EN L
+*/
+{
+/* L , R , EN , AN , ON , S , B , Res */
+/* 0 : init */ { 0 , s(6,2), 1 , 1 , 0 , 0 , 0 , 0 },
+/* 1 : L+EN/AN */ { 0 , s(6,2), 1 , 1 , 0 , s(3,0), 0 , 4 },
+/* 2 : R */ { 0 , s(6,2), s(5,4), s(5,4), s(1,3), s(3,0), 0 , 3 },
+/* 3 : R+ON */ { s(3,0), s(4,2), s(5,4), s(5,4), 3 , s(3,0), s(3,0), 3 },
+/* 4 : R+EN/AN */ { s(3,0), s(4,2), 4 , 4 , s(1,3), s(3,0), s(3,0), 4 }
+};
+static const ImpTabPair impTab_INVERSE_FOR_NUMBERS_SPECIAL_WITH_MARKS = {
+ {&impTabL_INVERSE_FOR_NUMBERS_SPECIAL_WITH_MARKS,
+ &impTabR_INVERSE_LIKE_DIRECT_WITH_MARKS},
+ {&impAct2, &impAct3}};
+
+#undef s
+
+typedef struct {
+ const ImpTab * pImpTab; /* level table pointer */
+ const ImpAct * pImpAct; /* action map array */
+ int32_t startON; /* start of ON sequence */
+ int32_t startL2EN; /* start of level 2 sequence */
+ int32_t lastStrongRTL; /* index of last found R or AL */
+ int32_t state; /* current state */
+ int32_t runStart; /* start position of the run */
+ UBiDiLevel runLevel; /* run level before implicit solving */
+} LevState;
+
+/*------------------------------------------------------------------------*/
+
+static void
+addPoint(UBiDi *pBiDi, int32_t pos, int32_t flag)
+ /* param pos: position where to insert
+ param flag: one of LRM_BEFORE, LRM_AFTER, RLM_BEFORE, RLM_AFTER
+ */
+{
+#define FIRSTALLOC 10
+ Point point;
+ InsertPoints * pInsertPoints=&(pBiDi->insertPoints);
+
+ if (pInsertPoints->capacity == 0)
+ {
+ pInsertPoints->points=static_cast<Point *>(uprv_malloc(sizeof(Point)*FIRSTALLOC));
+ if (pInsertPoints->points == NULL)
+ {
+ pInsertPoints->errorCode=U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ pInsertPoints->capacity=FIRSTALLOC;
+ }
+ if (pInsertPoints->size >= pInsertPoints->capacity) /* no room for new point */
+ {
+ Point * savePoints=pInsertPoints->points;
+ pInsertPoints->points=static_cast<Point *>(uprv_realloc(pInsertPoints->points,
+ pInsertPoints->capacity*2*sizeof(Point)));
+ if (pInsertPoints->points == NULL)
+ {
+ pInsertPoints->points=savePoints;
+ pInsertPoints->errorCode=U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ else pInsertPoints->capacity*=2;
+ }
+ point.pos=pos;
+ point.flag=flag;
+ pInsertPoints->points[pInsertPoints->size]=point;
+ pInsertPoints->size++;
+#undef FIRSTALLOC
+}
+
+static void
+setLevelsOutsideIsolates(UBiDi *pBiDi, int32_t start, int32_t limit, UBiDiLevel level)
+{
+ DirProp *dirProps=pBiDi->dirProps, dirProp;
+ UBiDiLevel *levels=pBiDi->levels;
+ int32_t isolateCount=0, k;
+ for(k=start; k<limit; k++) {
+ dirProp=dirProps[k];
+ if(dirProp==PDI)
+ isolateCount--;
+ if(isolateCount==0)
+ levels[k]=level;
+ if(dirProp==LRI || dirProp==RLI)
+ isolateCount++;
+ }
+}
+
+/* perform rules (Wn), (Nn), and (In) on a run of the text ------------------ */
+
+/*
+ * This implementation of the (Wn) rules applies all rules in one pass.
+ * In order to do so, it needs a look-ahead of typically 1 character
+ * (except for W5: sequences of ET) and keeps track of changes
+ * in a rule Wp that affect a later Wq (p<q).
+ *
+ * The (Nn) and (In) rules are also performed in that same single loop,
+ * but effectively one iteration behind for white space.
+ *
+ * Since all implicit rules are performed in one step, it is not necessary
+ * to actually store the intermediate directional properties in dirProps[].
+ */
+
+static void
+processPropertySeq(UBiDi *pBiDi, LevState *pLevState, uint8_t _prop,
+ int32_t start, int32_t limit) {
+ uint8_t cell, oldStateSeq, actionSeq;
+ const ImpTab * pImpTab=pLevState->pImpTab;
+ const ImpAct * pImpAct=pLevState->pImpAct;
+ UBiDiLevel * levels=pBiDi->levels;
+ UBiDiLevel level, addLevel;
+ InsertPoints * pInsertPoints;
+ int32_t start0, k;
+
+ start0=start; /* save original start position */
+ oldStateSeq=(uint8_t)pLevState->state;
+ cell=(*pImpTab)[oldStateSeq][_prop];
+ pLevState->state=GET_STATE(cell); /* isolate the new state */
+ actionSeq=(*pImpAct)[GET_ACTION(cell)]; /* isolate the action */
+ addLevel=(*pImpTab)[pLevState->state][IMPTABLEVELS_RES];
+
+ if(actionSeq) {
+ switch(actionSeq) {
+ case 1: /* init ON seq */
+ pLevState->startON=start0;
+ break;
+
+ case 2: /* prepend ON seq to current seq */
+ start=pLevState->startON;
+ break;
+
+ case 3: /* EN/AN after R+ON */
+ level=pLevState->runLevel+1;
+ setLevelsOutsideIsolates(pBiDi, pLevState->startON, start0, level);
+ break;
+
+ case 4: /* EN/AN before R for NUMBERS_SPECIAL */
+ level=pLevState->runLevel+2;
+ setLevelsOutsideIsolates(pBiDi, pLevState->startON, start0, level);
+ break;
+
+ case 5: /* L or S after possible relevant EN/AN */
+ /* check if we had EN after R/AL */
+ if (pLevState->startL2EN >= 0) {
+ addPoint(pBiDi, pLevState->startL2EN, LRM_BEFORE);
+ }
+ pLevState->startL2EN=-1; /* not within previous if since could also be -2 */
+ /* check if we had any relevant EN/AN after R/AL */
+ pInsertPoints=&(pBiDi->insertPoints);
+ if ((pInsertPoints->capacity == 0) ||
+ (pInsertPoints->size <= pInsertPoints->confirmed))
+ {
+ /* nothing, just clean up */
+ pLevState->lastStrongRTL=-1;
+ /* check if we have a pending conditional segment */
+ level=(*pImpTab)[oldStateSeq][IMPTABLEVELS_RES];
+ if ((level & 1) && (pLevState->startON > 0)) { /* after ON */
+ start=pLevState->startON; /* reset to basic run level */
+ }
+ if (_prop == DirProp_S) /* add LRM before S */
+ {
+ addPoint(pBiDi, start0, LRM_BEFORE);
+ pInsertPoints->confirmed=pInsertPoints->size;
+ }
+ break;
+ }
+ /* reset previous RTL cont to level for LTR text */
+ for (k=pLevState->lastStrongRTL+1; k<start0; k++)
+ {
+ /* reset odd level, leave runLevel+2 as is */
+ levels[k]=(levels[k] - 2) & ~1;
+ }
+ /* mark insert points as confirmed */
+ pInsertPoints->confirmed=pInsertPoints->size;
+ pLevState->lastStrongRTL=-1;
+ if (_prop == DirProp_S) /* add LRM before S */
+ {
+ addPoint(pBiDi, start0, LRM_BEFORE);
+ pInsertPoints->confirmed=pInsertPoints->size;
+ }
+ break;
+
+ case 6: /* R/AL after possible relevant EN/AN */
+ /* just clean up */
+ pInsertPoints=&(pBiDi->insertPoints);
+ if (pInsertPoints->capacity > 0)
+ /* remove all non confirmed insert points */
+ pInsertPoints->size=pInsertPoints->confirmed;
+ pLevState->startON=-1;
+ pLevState->startL2EN=-1;
+ pLevState->lastStrongRTL=limit - 1;
+ break;
+
+ case 7: /* EN/AN after R/AL + possible cont */
+ /* check for real AN */
+ if ((_prop == DirProp_AN) && (pBiDi->dirProps[start0] == AN) &&
+ (pBiDi->reorderingMode!=UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL))
+ {
+ /* real AN */
+ if (pLevState->startL2EN == -1) /* if no relevant EN already found */
+ {
+ /* just note the righmost digit as a strong RTL */
+ pLevState->lastStrongRTL=limit - 1;
+ break;
+ }
+ if (pLevState->startL2EN >= 0) /* after EN, no AN */
+ {
+ addPoint(pBiDi, pLevState->startL2EN, LRM_BEFORE);
+ pLevState->startL2EN=-2;
+ }
+ /* note AN */
+ addPoint(pBiDi, start0, LRM_BEFORE);
+ break;
+ }
+ /* if first EN/AN after R/AL */
+ if (pLevState->startL2EN == -1) {
+ pLevState->startL2EN=start0;
+ }
+ break;
+
+ case 8: /* note location of latest R/AL */
+ pLevState->lastStrongRTL=limit - 1;
+ pLevState->startON=-1;
+ break;
+
+ case 9: /* L after R+ON/EN/AN */
+ /* include possible adjacent number on the left */
+ for (k=start0-1; k>=0 && !(levels[k]&1); k--);
+ if(k>=0) {
+ addPoint(pBiDi, k, RLM_BEFORE); /* add RLM before */
+ pInsertPoints=&(pBiDi->insertPoints);
+ pInsertPoints->confirmed=pInsertPoints->size; /* confirm it */
+ }
+ pLevState->startON=start0;
+ break;
+
+ case 10: /* AN after L */
+ /* AN numbers between L text on both sides may be trouble. */
+ /* tentatively bracket with LRMs; will be confirmed if followed by L */
+ addPoint(pBiDi, start0, LRM_BEFORE); /* add LRM before */
+ addPoint(pBiDi, start0, LRM_AFTER); /* add LRM after */
+ break;
+
+ case 11: /* R after L+ON/EN/AN */
+ /* false alert, infirm LRMs around previous AN */
+ pInsertPoints=&(pBiDi->insertPoints);
+ pInsertPoints->size=pInsertPoints->confirmed;
+ if (_prop == DirProp_S) /* add RLM before S */
+ {
+ addPoint(pBiDi, start0, RLM_BEFORE);
+ pInsertPoints->confirmed=pInsertPoints->size;
+ }
+ break;
+
+ case 12: /* L after L+ON/AN */
+ level=pLevState->runLevel + addLevel;
+ for(k=pLevState->startON; k<start0; k++) {
+ if (levels[k]<level)
+ levels[k]=level;
+ }
+ pInsertPoints=&(pBiDi->insertPoints);
+ pInsertPoints->confirmed=pInsertPoints->size; /* confirm inserts */
+ pLevState->startON=start0;
+ break;
+
+ case 13: /* L after L+ON+EN/AN/ON */
+ level=pLevState->runLevel;
+ for(k=start0-1; k>=pLevState->startON; k--) {
+ if(levels[k]==level+3) {
+ while(levels[k]==level+3) {
+ levels[k--]-=2;
+ }
+ while(levels[k]==level) {
+ k--;
+ }
+ }
+ if(levels[k]==level+2) {
+ levels[k]=level;
+ continue;
+ }
+ levels[k]=level+1;
+ }
+ break;
+
+ case 14: /* R after L+ON+EN/AN/ON */
+ level=pLevState->runLevel+1;
+ for(k=start0-1; k>=pLevState->startON; k--) {
+ if(levels[k]>level) {
+ levels[k]-=2;
+ }
+ }
+ break;
+
+ default: /* we should never get here */
+ UPRV_UNREACHABLE;
+ }
+ }
+ if((addLevel) || (start < start0)) {
+ level=pLevState->runLevel + addLevel;
+ if(start>=pLevState->runStart) {
+ for(k=start; k<limit; k++) {
+ levels[k]=level;
+ }
+ } else {
+ setLevelsOutsideIsolates(pBiDi, start, limit, level);
+ }
+ }
+}
+
+/**
+ * Returns the directionality of the last strong character at the end of the prologue, if any.
+ * Requires prologue!=null.
+ */
+static DirProp
+lastL_R_AL(UBiDi *pBiDi) {
+ const UChar *text=pBiDi->prologue;
+ int32_t length=pBiDi->proLength;
+ int32_t i;
+ UChar32 uchar;
+ DirProp dirProp;
+ for(i=length; i>0; ) {
+ /* i is decremented by U16_PREV */
+ U16_PREV(text, 0, i, uchar);
+ dirProp=(DirProp)ubidi_getCustomizedClass(pBiDi, uchar);
+ if(dirProp==L) {
+ return DirProp_L;
+ }
+ if(dirProp==R || dirProp==AL) {
+ return DirProp_R;
+ }
+ if(dirProp==B) {
+ return DirProp_ON;
+ }
+ }
+ return DirProp_ON;
+}
+
+/**
+ * Returns the directionality of the first strong character, or digit, in the epilogue, if any.
+ * Requires epilogue!=null.
+ */
+static DirProp
+firstL_R_AL_EN_AN(UBiDi *pBiDi) {
+ const UChar *text=pBiDi->epilogue;
+ int32_t length=pBiDi->epiLength;
+ int32_t i;
+ UChar32 uchar;
+ DirProp dirProp;
+ for(i=0; i<length; ) {
+ /* i is incremented by U16_NEXT */
+ U16_NEXT(text, i, length, uchar);
+ dirProp=(DirProp)ubidi_getCustomizedClass(pBiDi, uchar);
+ if(dirProp==L) {
+ return DirProp_L;
+ }
+ if(dirProp==R || dirProp==AL) {
+ return DirProp_R;
+ }
+ if(dirProp==EN) {
+ return DirProp_EN;
+ }
+ if(dirProp==AN) {
+ return DirProp_AN;
+ }
+ }
+ return DirProp_ON;
+}
+
+static void
+resolveImplicitLevels(UBiDi *pBiDi,
+ int32_t start, int32_t limit,
+ DirProp sor, DirProp eor) {
+ const DirProp *dirProps=pBiDi->dirProps;
+ DirProp dirProp;
+ LevState levState;
+ int32_t i, start1, start2;
+ uint16_t oldStateImp, stateImp, actionImp;
+ uint8_t gprop, resProp, cell;
+ UBool inverseRTL;
+ DirProp nextStrongProp=R;
+ int32_t nextStrongPos=-1;
+
+ /* check for RTL inverse BiDi mode */
+ /* FOOD FOR THOUGHT: in case of RTL inverse BiDi, it would make sense to
+ * loop on the text characters from end to start.
+ * This would need a different properties state table (at least different
+ * actions) and different levels state tables (maybe very similar to the
+ * LTR corresponding ones.
+ */
+ inverseRTL=(UBool)
+ ((start<pBiDi->lastArabicPos) && (GET_PARALEVEL(pBiDi, start) & 1) &&
+ (pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_LIKE_DIRECT ||
+ pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL));
+
+ /* initialize for property and levels state tables */
+ levState.startL2EN=-1; /* used for INVERSE_LIKE_DIRECT_WITH_MARKS */
+ levState.lastStrongRTL=-1; /* used for INVERSE_LIKE_DIRECT_WITH_MARKS */
+ levState.runStart=start;
+ levState.runLevel=pBiDi->levels[start];
+ levState.pImpTab=(const ImpTab*)((pBiDi->pImpTabPair)->pImpTab)[levState.runLevel&1];
+ levState.pImpAct=(const ImpAct*)((pBiDi->pImpTabPair)->pImpAct)[levState.runLevel&1];
+ if(start==0 && pBiDi->proLength>0) {
+ DirProp lastStrong=lastL_R_AL(pBiDi);
+ if(lastStrong!=DirProp_ON) {
+ sor=lastStrong;
+ }
+ }
+ /* The isolates[] entries contain enough information to
+ resume the bidi algorithm in the same state as it was
+ when it was interrupted by an isolate sequence. */
+ if(dirProps[start]==PDI && pBiDi->isolateCount >= 0) {
+ levState.startON=pBiDi->isolates[pBiDi->isolateCount].startON;
+ start1=pBiDi->isolates[pBiDi->isolateCount].start1;
+ stateImp=pBiDi->isolates[pBiDi->isolateCount].stateImp;
+ levState.state=pBiDi->isolates[pBiDi->isolateCount].state;
+ pBiDi->isolateCount--;
+ } else {
+ levState.startON=-1;
+ start1=start;
+ if(dirProps[start]==NSM)
+ stateImp = 1 + sor;
+ else
+ stateImp=0;
+ levState.state=0;
+ processPropertySeq(pBiDi, &levState, sor, start, start);
+ }
+ start2=start; /* to make Java compiler happy */
+
+ for(i=start; i<=limit; i++) {
+ if(i>=limit) {
+ int32_t k;
+ for(k=limit-1; k>start&&(DIRPROP_FLAG(dirProps[k])&MASK_BN_EXPLICIT); k--);
+ dirProp=dirProps[k];
+ if(dirProp==LRI || dirProp==RLI)
+ break; /* no forced closing for sequence ending with LRI/RLI */
+ gprop=eor;
+ } else {
+ DirProp prop, prop1;
+ prop=dirProps[i];
+ if(prop==B) {
+ pBiDi->isolateCount=-1; /* current isolates stack entry == none */
+ }
+ if(inverseRTL) {
+ if(prop==AL) {
+ /* AL before EN does not make it AN */
+ prop=R;
+ } else if(prop==EN) {
+ if(nextStrongPos<=i) {
+ /* look for next strong char (L/R/AL) */
+ int32_t j;
+ nextStrongProp=R; /* set default */
+ nextStrongPos=limit;
+ for(j=i+1; j<limit; j++) {
+ prop1=dirProps[j];
+ if(prop1==L || prop1==R || prop1==AL) {
+ nextStrongProp=prop1;
+ nextStrongPos=j;
+ break;
+ }
+ }
+ }
+ if(nextStrongProp==AL) {
+ prop=AN;
+ }
+ }
+ }
+ gprop=groupProp[prop];
+ }
+ oldStateImp=stateImp;
+ cell=impTabProps[oldStateImp][gprop];
+ stateImp=GET_STATEPROPS(cell); /* isolate the new state */
+ actionImp=GET_ACTIONPROPS(cell); /* isolate the action */
+ if((i==limit) && (actionImp==0)) {
+ /* there is an unprocessed sequence if its property == eor */
+ actionImp=1; /* process the last sequence */
+ }
+ if(actionImp) {
+ resProp=impTabProps[oldStateImp][IMPTABPROPS_RES];
+ switch(actionImp) {
+ case 1: /* process current seq1, init new seq1 */
+ processPropertySeq(pBiDi, &levState, resProp, start1, i);
+ start1=i;
+ break;
+ case 2: /* init new seq2 */
+ start2=i;
+ break;
+ case 3: /* process seq1, process seq2, init new seq1 */
+ processPropertySeq(pBiDi, &levState, resProp, start1, start2);
+ processPropertySeq(pBiDi, &levState, DirProp_ON, start2, i);
+ start1=i;
+ break;
+ case 4: /* process seq1, set seq1=seq2, init new seq2 */
+ processPropertySeq(pBiDi, &levState, resProp, start1, start2);
+ start1=start2;
+ start2=i;
+ break;
+ default: /* we should never get here */
+ UPRV_UNREACHABLE;
+ }
+ }
+ }
+
+ /* flush possible pending sequence, e.g. ON */
+ if(limit==pBiDi->length && pBiDi->epiLength>0) {
+ DirProp firstStrong=firstL_R_AL_EN_AN(pBiDi);
+ if(firstStrong!=DirProp_ON) {
+ eor=firstStrong;
+ }
+ }
+
+ /* look for the last char not a BN or LRE/RLE/LRO/RLO/PDF */
+ for(i=limit-1; i>start&&(DIRPROP_FLAG(dirProps[i])&MASK_BN_EXPLICIT); i--);
+ dirProp=dirProps[i];
+ if((dirProp==LRI || dirProp==RLI) && limit<pBiDi->length) {
+ pBiDi->isolateCount++;
+ pBiDi->isolates[pBiDi->isolateCount].stateImp=stateImp;
+ pBiDi->isolates[pBiDi->isolateCount].state=levState.state;
+ pBiDi->isolates[pBiDi->isolateCount].start1=start1;
+ pBiDi->isolates[pBiDi->isolateCount].startON=levState.startON;
+ }
+ else
+ processPropertySeq(pBiDi, &levState, eor, limit, limit);
+}
+
+/* perform (L1) and (X9) ---------------------------------------------------- */
+
+/*
+ * Reset the embedding levels for some non-graphic characters (L1).
+ * This function also sets appropriate levels for BN, and
+ * explicit embedding types that are supposed to have been removed
+ * from the paragraph in (X9).
+ */
+static void
+adjustWSLevels(UBiDi *pBiDi) {
+ const DirProp *dirProps=pBiDi->dirProps;
+ UBiDiLevel *levels=pBiDi->levels;
+ int32_t i;
+
+ if(pBiDi->flags&MASK_WS) {
+ UBool orderParagraphsLTR=pBiDi->orderParagraphsLTR;
+ Flags flag;
+
+ i=pBiDi->trailingWSStart;
+ while(i>0) {
+ /* reset a sequence of WS/BN before eop and B/S to the paragraph paraLevel */
+ while(i>0 && (flag=DIRPROP_FLAG(dirProps[--i]))&MASK_WS) {
+ if(orderParagraphsLTR&&(flag&DIRPROP_FLAG(B))) {
+ levels[i]=0;
+ } else {
+ levels[i]=GET_PARALEVEL(pBiDi, i);
+ }
+ }
+
+ /* reset BN to the next character's paraLevel until B/S, which restarts above loop */
+ /* here, i+1 is guaranteed to be <length */
+ while(i>0) {
+ flag=DIRPROP_FLAG(dirProps[--i]);
+ if(flag&MASK_BN_EXPLICIT) {
+ levels[i]=levels[i+1];
+ } else if(orderParagraphsLTR&&(flag&DIRPROP_FLAG(B))) {
+ levels[i]=0;
+ break;
+ } else if(flag&MASK_B_S) {
+ levels[i]=GET_PARALEVEL(pBiDi, i);
+ break;
+ }
+ }
+ }
+ }
+}
+
+U_CAPI void U_EXPORT2
+ubidi_setContext(UBiDi *pBiDi,
+ const UChar *prologue, int32_t proLength,
+ const UChar *epilogue, int32_t epiLength,
+ UErrorCode *pErrorCode) {
+ /* check the argument values */
+ RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
+ if(pBiDi==NULL || proLength<-1 || epiLength<-1 ||
+ (prologue==NULL && proLength!=0) || (epilogue==NULL && epiLength!=0)) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ if(proLength==-1) {
+ pBiDi->proLength=u_strlen(prologue);
+ } else {
+ pBiDi->proLength=proLength;
+ }
+ if(epiLength==-1) {
+ pBiDi->epiLength=u_strlen(epilogue);
+ } else {
+ pBiDi->epiLength=epiLength;
+ }
+ pBiDi->prologue=prologue;
+ pBiDi->epilogue=epilogue;
+}
+
+static void
+setParaSuccess(UBiDi *pBiDi) {
+ pBiDi->proLength=0; /* forget the last context */
+ pBiDi->epiLength=0;
+ pBiDi->pParaBiDi=pBiDi; /* mark successful setPara */
+}
+
+#define BIDI_MIN(x, y) ((x)<(y) ? (x) : (y))
+#define BIDI_ABS(x) ((x)>=0 ? (x) : (-(x)))
+
+static void
+setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length,
+ UBiDiLevel paraLevel, UErrorCode *pErrorCode) {
+ int32_t *runsOnlyMemory = NULL;
+ int32_t *visualMap;
+ UChar *visualText;
+ int32_t saveLength, saveTrailingWSStart;
+ const UBiDiLevel *levels;
+ UBiDiLevel *saveLevels;
+ UBiDiDirection saveDirection;
+ UBool saveMayAllocateText;
+ Run *runs;
+ int32_t visualLength, i, j, visualStart, logicalStart,
+ runCount, runLength, addedRuns, insertRemove,
+ start, limit, step, indexOddBit, logicalPos,
+ index0, index1;
+ uint32_t saveOptions;
+
+ pBiDi->reorderingMode=UBIDI_REORDER_DEFAULT;
+ if(length==0) {
+ ubidi_setPara(pBiDi, text, length, paraLevel, NULL, pErrorCode);
+ goto cleanup3;
+ }
+ /* obtain memory for mapping table and visual text */
+ runsOnlyMemory=static_cast<int32_t *>(uprv_malloc(length*(sizeof(int32_t)+sizeof(UChar)+sizeof(UBiDiLevel))));
+ if(runsOnlyMemory==NULL) {
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ goto cleanup3;
+ }
+ visualMap=runsOnlyMemory;
+ visualText=(UChar *)&visualMap[length];
+ saveLevels=(UBiDiLevel *)&visualText[length];
+ saveOptions=pBiDi->reorderingOptions;
+ if(saveOptions & UBIDI_OPTION_INSERT_MARKS) {
+ pBiDi->reorderingOptions&=~UBIDI_OPTION_INSERT_MARKS;
+ pBiDi->reorderingOptions|=UBIDI_OPTION_REMOVE_CONTROLS;
+ }
+ paraLevel&=1; /* accept only 0 or 1 */
+ ubidi_setPara(pBiDi, text, length, paraLevel, NULL, pErrorCode);
+ if(U_FAILURE(*pErrorCode)) {
+ goto cleanup3;
+ }
+ /* we cannot access directly pBiDi->levels since it is not yet set if
+ * direction is not MIXED
+ */
+ levels=ubidi_getLevels(pBiDi, pErrorCode);
+ uprv_memcpy(saveLevels, levels, (size_t)pBiDi->length*sizeof(UBiDiLevel));
+ saveTrailingWSStart=pBiDi->trailingWSStart;
+ saveLength=pBiDi->length;
+ saveDirection=pBiDi->direction;
+
+ /* FOOD FOR THOUGHT: instead of writing the visual text, we could use
+ * the visual map and the dirProps array to drive the second call
+ * to ubidi_setPara (but must make provision for possible removal of
+ * BiDi controls. Alternatively, only use the dirProps array via
+ * customized classifier callback.
+ */
+ visualLength=ubidi_writeReordered(pBiDi, visualText, length,
+ UBIDI_DO_MIRRORING, pErrorCode);
+ ubidi_getVisualMap(pBiDi, visualMap, pErrorCode);
+ if(U_FAILURE(*pErrorCode)) {
+ goto cleanup2;
+ }
+ pBiDi->reorderingOptions=saveOptions;
+
+ pBiDi->reorderingMode=UBIDI_REORDER_INVERSE_LIKE_DIRECT;
+ paraLevel^=1;
+ /* Because what we did with reorderingOptions, visualText may be shorter
+ * than the original text. But we don't want the levels memory to be
+ * reallocated shorter than the original length, since we need to restore
+ * the levels as after the first call to ubidi_setpara() before returning.
+ * We will force mayAllocateText to FALSE before the second call to
+ * ubidi_setpara(), and will restore it afterwards.
+ */
+ saveMayAllocateText=pBiDi->mayAllocateText;
+ pBiDi->mayAllocateText=FALSE;
+ ubidi_setPara(pBiDi, visualText, visualLength, paraLevel, NULL, pErrorCode);
+ pBiDi->mayAllocateText=saveMayAllocateText;
+ ubidi_getRuns(pBiDi, pErrorCode);
+ if(U_FAILURE(*pErrorCode)) {
+ goto cleanup1;
+ }
+ /* check if some runs must be split, count how many splits */
+ addedRuns=0;
+ runCount=pBiDi->runCount;
+ runs=pBiDi->runs;
+ visualStart=0;
+ for(i=0; i<runCount; i++, visualStart+=runLength) {
+ runLength=runs[i].visualLimit-visualStart;
+ if(runLength<2) {
+ continue;
+ }
+ logicalStart=GET_INDEX(runs[i].logicalStart);
+ for(j=logicalStart+1; j<logicalStart+runLength; j++) {
+ index0=visualMap[j];
+ index1=visualMap[j-1];
+ if((BIDI_ABS(index0-index1)!=1) || (saveLevels[index0]!=saveLevels[index1])) {
+ addedRuns++;
+ }
+ }
+ }
+ if(addedRuns) {
+ if(getRunsMemory(pBiDi, runCount+addedRuns)) {
+ if(runCount==1) {
+ /* because we switch from UBiDi.simpleRuns to UBiDi.runs */
+ pBiDi->runsMemory[0]=runs[0];
+ }
+ runs=pBiDi->runs=pBiDi->runsMemory;
+ pBiDi->runCount+=addedRuns;
+ } else {
+ goto cleanup1;
+ }
+ }
+ /* split runs which are not consecutive in source text */
+ for(i=runCount-1; i>=0; i--) {
+ runLength= i==0 ? runs[0].visualLimit :
+ runs[i].visualLimit-runs[i-1].visualLimit;
+ logicalStart=runs[i].logicalStart;
+ indexOddBit=GET_ODD_BIT(logicalStart);
+ logicalStart=GET_INDEX(logicalStart);
+ if(runLength<2) {
+ if(addedRuns) {
+ runs[i+addedRuns]=runs[i];
+ }
+ logicalPos=visualMap[logicalStart];
+ runs[i+addedRuns].logicalStart=MAKE_INDEX_ODD_PAIR(logicalPos,
+ saveLevels[logicalPos]^indexOddBit);
+ continue;
+ }
+ if(indexOddBit) {
+ start=logicalStart;
+ limit=logicalStart+runLength-1;
+ step=1;
+ } else {
+ start=logicalStart+runLength-1;
+ limit=logicalStart;
+ step=-1;
+ }
+ for(j=start; j!=limit; j+=step) {
+ index0=visualMap[j];
+ index1=visualMap[j+step];
+ if((BIDI_ABS(index0-index1)!=1) || (saveLevels[index0]!=saveLevels[index1])) {
+ logicalPos=BIDI_MIN(visualMap[start], index0);
+ runs[i+addedRuns].logicalStart=MAKE_INDEX_ODD_PAIR(logicalPos,
+ saveLevels[logicalPos]^indexOddBit);
+ runs[i+addedRuns].visualLimit=runs[i].visualLimit;
+ runs[i].visualLimit-=BIDI_ABS(j-start)+1;
+ insertRemove=runs[i].insertRemove&(LRM_AFTER|RLM_AFTER);
+ runs[i+addedRuns].insertRemove=insertRemove;
+ runs[i].insertRemove&=~insertRemove;
+ start=j+step;
+ addedRuns--;
+ }
+ }
+ if(addedRuns) {
+ runs[i+addedRuns]=runs[i];
+ }
+ logicalPos=BIDI_MIN(visualMap[start], visualMap[limit]);
+ runs[i+addedRuns].logicalStart=MAKE_INDEX_ODD_PAIR(logicalPos,
+ saveLevels[logicalPos]^indexOddBit);
+ }
+
+ cleanup1:
+ /* restore initial paraLevel */
+ pBiDi->paraLevel^=1;
+ cleanup2:
+ /* restore real text */
+ pBiDi->text=text;
+ pBiDi->length=saveLength;
+ pBiDi->originalLength=length;
+ pBiDi->direction=saveDirection;
+ /* the saved levels should never excess levelsSize, but we check anyway */
+ if(saveLength>pBiDi->levelsSize) {
+ saveLength=pBiDi->levelsSize;
+ }
+ uprv_memcpy(pBiDi->levels, saveLevels, (size_t)saveLength*sizeof(UBiDiLevel));
+ pBiDi->trailingWSStart=saveTrailingWSStart;
+ if(pBiDi->runCount>1) {
+ pBiDi->direction=UBIDI_MIXED;
+ }
+ cleanup3:
+ /* free memory for mapping table and visual text */
+ uprv_free(runsOnlyMemory);
+
+ pBiDi->reorderingMode=UBIDI_REORDER_RUNS_ONLY;
+}
+
+/* ubidi_setPara ------------------------------------------------------------ */
+
+U_CAPI void U_EXPORT2
+ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
+ UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels,
+ UErrorCode *pErrorCode) {
+ UBiDiDirection direction;
+ DirProp *dirProps;
+
+ /* check the argument values */
+ RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
+ if(pBiDi==NULL || text==NULL || length<-1 ||
+ (paraLevel>UBIDI_MAX_EXPLICIT_LEVEL && paraLevel<UBIDI_DEFAULT_LTR)) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ if(length==-1) {
+ length=u_strlen(text);
+ }
+
+ /* special treatment for RUNS_ONLY mode */
+ if(pBiDi->reorderingMode==UBIDI_REORDER_RUNS_ONLY) {
+ setParaRunsOnly(pBiDi, text, length, paraLevel, pErrorCode);
+ return;
+ }
+
+ /* initialize the UBiDi structure */
+ pBiDi->pParaBiDi=NULL; /* mark unfinished setPara */
+ pBiDi->text=text;
+ pBiDi->length=pBiDi->originalLength=pBiDi->resultLength=length;
+ pBiDi->paraLevel=paraLevel;
+ pBiDi->direction=(UBiDiDirection)(paraLevel&1);
+ pBiDi->paraCount=1;
+
+ pBiDi->dirProps=NULL;
+ pBiDi->levels=NULL;
+ pBiDi->runs=NULL;
+ pBiDi->insertPoints.size=0; /* clean up from last call */
+ pBiDi->insertPoints.confirmed=0; /* clean up from last call */
+
+ /*
+ * Save the original paraLevel if contextual; otherwise, set to 0.
+ */
+ pBiDi->defaultParaLevel=IS_DEFAULT_LEVEL(paraLevel);
+
+ if(length==0) {
+ /*
+ * For an empty paragraph, create a UBiDi object with the paraLevel and
+ * the flags and the direction set but without allocating zero-length arrays.
+ * There is nothing more to do.
+ */
+ if(IS_DEFAULT_LEVEL(paraLevel)) {
+ pBiDi->paraLevel&=1;
+ pBiDi->defaultParaLevel=0;
+ }
+ pBiDi->flags=DIRPROP_FLAG_LR(paraLevel);
+ pBiDi->runCount=0;
+ pBiDi->paraCount=0;
+ setParaSuccess(pBiDi); /* mark successful setPara */
+ return;
+ }
+
+ pBiDi->runCount=-1;
+
+ /* allocate paras memory */
+ if(pBiDi->parasMemory)
+ pBiDi->paras=pBiDi->parasMemory;
+ else
+ pBiDi->paras=pBiDi->simpleParas;
+
+ /*
+ * Get the directional properties,
+ * the flags bit-set, and
+ * determine the paragraph level if necessary.
+ */
+ if(getDirPropsMemory(pBiDi, length)) {
+ pBiDi->dirProps=pBiDi->dirPropsMemory;
+ if(!getDirProps(pBiDi)) {
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ } else {
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ dirProps=pBiDi->dirProps;
+ /* the processed length may have changed if UBIDI_OPTION_STREAMING */
+ length= pBiDi->length;
+ pBiDi->trailingWSStart=length; /* the levels[] will reflect the WS run */
+
+ /* are explicit levels specified? */
+ if(embeddingLevels==NULL) {
+ /* no: determine explicit levels according to the (Xn) rules */\
+ if(getLevelsMemory(pBiDi, length)) {
+ pBiDi->levels=pBiDi->levelsMemory;
+ direction=resolveExplicitLevels(pBiDi, pErrorCode);
+ if(U_FAILURE(*pErrorCode)) {
+ return;
+ }
+ } else {
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ } else {
+ /* set BN for all explicit codes, check that all levels are 0 or paraLevel..UBIDI_MAX_EXPLICIT_LEVEL */
+ pBiDi->levels=embeddingLevels;
+ direction=checkExplicitLevels(pBiDi, pErrorCode);
+ if(U_FAILURE(*pErrorCode)) {
+ return;
+ }
+ }
+
+ /* allocate isolate memory */
+ if(pBiDi->isolateCount<=SIMPLE_ISOLATES_COUNT)
+ pBiDi->isolates=pBiDi->simpleIsolates;
+ else
+ if((int32_t)(pBiDi->isolateCount*sizeof(Isolate))<=pBiDi->isolatesSize)
+ pBiDi->isolates=pBiDi->isolatesMemory;
+ else {
+ if(getInitialIsolatesMemory(pBiDi, pBiDi->isolateCount)) {
+ pBiDi->isolates=pBiDi->isolatesMemory;
+ } else {
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ }
+ pBiDi->isolateCount=-1; /* current isolates stack entry == none */
+
+ /*
+ * The steps after (X9) in the UBiDi algorithm are performed only if
+ * the paragraph text has mixed directionality!
+ */
+ pBiDi->direction=direction;
+ switch(direction) {
+ case UBIDI_LTR:
+ /* all levels are implicitly at paraLevel (important for ubidi_getLevels()) */
+ pBiDi->trailingWSStart=0;
+ break;
+ case UBIDI_RTL:
+ /* all levels are implicitly at paraLevel (important for ubidi_getLevels()) */
+ pBiDi->trailingWSStart=0;
+ break;
+ default:
+ /*
+ * Choose the right implicit state table
+ */
+ switch(pBiDi->reorderingMode) {
+ case UBIDI_REORDER_DEFAULT:
+ pBiDi->pImpTabPair=&impTab_DEFAULT;
+ break;
+ case UBIDI_REORDER_NUMBERS_SPECIAL:
+ pBiDi->pImpTabPair=&impTab_NUMBERS_SPECIAL;
+ break;
+ case UBIDI_REORDER_GROUP_NUMBERS_WITH_R:
+ pBiDi->pImpTabPair=&impTab_GROUP_NUMBERS_WITH_R;
+ break;
+ case UBIDI_REORDER_INVERSE_NUMBERS_AS_L:
+ pBiDi->pImpTabPair=&impTab_INVERSE_NUMBERS_AS_L;
+ break;
+ case UBIDI_REORDER_INVERSE_LIKE_DIRECT:
+ if (pBiDi->reorderingOptions & UBIDI_OPTION_INSERT_MARKS) {
+ pBiDi->pImpTabPair=&impTab_INVERSE_LIKE_DIRECT_WITH_MARKS;
+ } else {
+ pBiDi->pImpTabPair=&impTab_INVERSE_LIKE_DIRECT;
+ }
+ break;
+ case UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL:
+ if (pBiDi->reorderingOptions & UBIDI_OPTION_INSERT_MARKS) {
+ pBiDi->pImpTabPair=&impTab_INVERSE_FOR_NUMBERS_SPECIAL_WITH_MARKS;
+ } else {
+ pBiDi->pImpTabPair=&impTab_INVERSE_FOR_NUMBERS_SPECIAL;
+ }
+ break;
+ default:
+ /* we should never get here */
+ UPRV_UNREACHABLE;
+ }
+ /*
+ * If there are no external levels specified and there
+ * are no significant explicit level codes in the text,
+ * then we can treat the entire paragraph as one run.
+ * Otherwise, we need to perform the following rules on runs of
+ * the text with the same embedding levels. (X10)
+ * "Significant" explicit level codes are ones that actually
+ * affect non-BN characters.
+ * Examples for "insignificant" ones are empty embeddings
+ * LRE-PDF, LRE-RLE-PDF-PDF, etc.
+ */
+ if(embeddingLevels==NULL && pBiDi->paraCount<=1 &&
+ !(pBiDi->flags&DIRPROP_FLAG_MULTI_RUNS)) {
+ resolveImplicitLevels(pBiDi, 0, length,
+ GET_LR_FROM_LEVEL(GET_PARALEVEL(pBiDi, 0)),
+ GET_LR_FROM_LEVEL(GET_PARALEVEL(pBiDi, length-1)));
+ } else {
+ /* sor, eor: start and end types of same-level-run */
+ UBiDiLevel *levels=pBiDi->levels;
+ int32_t start, limit=0;
+ UBiDiLevel level, nextLevel;
+ DirProp sor, eor;
+
+ /* determine the first sor and set eor to it because of the loop body (sor=eor there) */
+ level=GET_PARALEVEL(pBiDi, 0);
+ nextLevel=levels[0];
+ if(level<nextLevel) {
+ eor=GET_LR_FROM_LEVEL(nextLevel);
+ } else {
+ eor=GET_LR_FROM_LEVEL(level);
+ }
+
+ do {
+ /* determine start and limit of the run (end points just behind the run) */
+
+ /* the values for this run's start are the same as for the previous run's end */
+ start=limit;
+ level=nextLevel;
+ if((start>0) && (dirProps[start-1]==B)) {
+ /* except if this is a new paragraph, then set sor = para level */
+ sor=GET_LR_FROM_LEVEL(GET_PARALEVEL(pBiDi, start));
+ } else {
+ sor=eor;
+ }
+
+ /* search for the limit of this run */
+ while((++limit<length) &&
+ ((levels[limit]==level) ||
+ (DIRPROP_FLAG(dirProps[limit])&MASK_BN_EXPLICIT))) {}
+
+ /* get the correct level of the next run */
+ if(limit<length) {
+ nextLevel=levels[limit];
+ } else {
+ nextLevel=GET_PARALEVEL(pBiDi, length-1);
+ }
+
+ /* determine eor from max(level, nextLevel); sor is last run's eor */
+ if(NO_OVERRIDE(level)<NO_OVERRIDE(nextLevel)) {
+ eor=GET_LR_FROM_LEVEL(nextLevel);
+ } else {
+ eor=GET_LR_FROM_LEVEL(level);
+ }
+
+ /* if the run consists of overridden directional types, then there
+ are no implicit types to be resolved */
+ if(!(level&UBIDI_LEVEL_OVERRIDE)) {
+ resolveImplicitLevels(pBiDi, start, limit, sor, eor);
+ } else {
+ /* remove the UBIDI_LEVEL_OVERRIDE flags */
+ do {
+ levels[start++]&=~UBIDI_LEVEL_OVERRIDE;
+ } while(start<limit);
+ }
+ } while(limit<length);
+ }
+ /* check if we got any memory shortage while adding insert points */
+ if (U_FAILURE(pBiDi->insertPoints.errorCode))
+ {
+ *pErrorCode=pBiDi->insertPoints.errorCode;
+ return;
+ }
+ /* reset the embedding levels for some non-graphic characters (L1), (X9) */
+ adjustWSLevels(pBiDi);
+ break;
+ }
+ /* add RLM for inverse Bidi with contextual orientation resolving
+ * to RTL which would not round-trip otherwise
+ */
+ if((pBiDi->defaultParaLevel>0) &&
+ (pBiDi->reorderingOptions & UBIDI_OPTION_INSERT_MARKS) &&
+ ((pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_LIKE_DIRECT) ||
+ (pBiDi->reorderingMode==UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL))) {
+ int32_t i, j, start, last;
+ UBiDiLevel level;
+ DirProp dirProp;
+ for(i=0; i<pBiDi->paraCount; i++) {
+ last=(pBiDi->paras[i].limit)-1;
+ level= static_cast<UBiDiLevel>(pBiDi->paras[i].level);
+ if(level==0)
+ continue; /* LTR paragraph */
+ start= i==0 ? 0 : pBiDi->paras[i-1].limit;
+ for(j=last; j>=start; j--) {
+ dirProp=dirProps[j];
+ if(dirProp==L) {
+ if(j<last) {
+ while(dirProps[last]==B) {
+ last--;
+ }
+ }
+ addPoint(pBiDi, last, RLM_BEFORE);
+ break;
+ }
+ if(DIRPROP_FLAG(dirProp) & MASK_R_AL) {
+ break;
+ }
+ }
+ }
+ }
+
+ if(pBiDi->reorderingOptions & UBIDI_OPTION_REMOVE_CONTROLS) {
+ pBiDi->resultLength -= pBiDi->controlCount;
+ } else {
+ pBiDi->resultLength += pBiDi->insertPoints.size;
+ }
+ setParaSuccess(pBiDi); /* mark successful setPara */
+}
+
+U_CAPI void U_EXPORT2
+ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR) {
+ if(pBiDi!=NULL) {
+ pBiDi->orderParagraphsLTR=orderParagraphsLTR;
+ }
+}
+
+U_CAPI UBool U_EXPORT2
+ubidi_isOrderParagraphsLTR(UBiDi *pBiDi) {
+ if(pBiDi!=NULL) {
+ return pBiDi->orderParagraphsLTR;
+ } else {
+ return FALSE;
+ }
+}
+
+U_CAPI UBiDiDirection U_EXPORT2
+ubidi_getDirection(const UBiDi *pBiDi) {
+ if(IS_VALID_PARA_OR_LINE(pBiDi)) {
+ return pBiDi->direction;
+ } else {
+ return UBIDI_LTR;
+ }
+}
+
+U_CAPI const UChar * U_EXPORT2
+ubidi_getText(const UBiDi *pBiDi) {
+ if(IS_VALID_PARA_OR_LINE(pBiDi)) {
+ return pBiDi->text;
+ } else {
+ return NULL;
+ }
+}
+
+U_CAPI int32_t U_EXPORT2
+ubidi_getLength(const UBiDi *pBiDi) {
+ if(IS_VALID_PARA_OR_LINE(pBiDi)) {
+ return pBiDi->originalLength;
+ } else {
+ return 0;
+ }
+}
+
+U_CAPI int32_t U_EXPORT2
+ubidi_getProcessedLength(const UBiDi *pBiDi) {
+ if(IS_VALID_PARA_OR_LINE(pBiDi)) {
+ return pBiDi->length;
+ } else {
+ return 0;
+ }
+}
+
+U_CAPI int32_t U_EXPORT2
+ubidi_getResultLength(const UBiDi *pBiDi) {
+ if(IS_VALID_PARA_OR_LINE(pBiDi)) {
+ return pBiDi->resultLength;
+ } else {
+ return 0;
+ }
+}
+
+/* paragraphs API functions ------------------------------------------------- */
+
+U_CAPI UBiDiLevel U_EXPORT2
+ubidi_getParaLevel(const UBiDi *pBiDi) {
+ if(IS_VALID_PARA_OR_LINE(pBiDi)) {
+ return pBiDi->paraLevel;
+ } else {
+ return 0;
+ }
+}
+
+U_CAPI int32_t U_EXPORT2
+ubidi_countParagraphs(UBiDi *pBiDi) {
+ if(!IS_VALID_PARA_OR_LINE(pBiDi)) {
+ return 0;
+ } else {
+ return pBiDi->paraCount;
+ }
+}
+
+U_CAPI void U_EXPORT2
+ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex,
+ int32_t *pParaStart, int32_t *pParaLimit,
+ UBiDiLevel *pParaLevel, UErrorCode *pErrorCode) {
+ int32_t paraStart;
+
+ /* check the argument values */
+ RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
+ RETURN_VOID_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode);
+ RETURN_VOID_IF_BAD_RANGE(paraIndex, 0, pBiDi->paraCount, *pErrorCode);
+
+ pBiDi=pBiDi->pParaBiDi; /* get Para object if Line object */
+ if(paraIndex) {
+ paraStart=pBiDi->paras[paraIndex-1].limit;
+ } else {
+ paraStart=0;
+ }
+ if(pParaStart!=NULL) {
+ *pParaStart=paraStart;
+ }
+ if(pParaLimit!=NULL) {
+ *pParaLimit=pBiDi->paras[paraIndex].limit;
+ }
+ if(pParaLevel!=NULL) {
+ *pParaLevel=GET_PARALEVEL(pBiDi, paraStart);
+ }
+}
+
+U_CAPI int32_t U_EXPORT2
+ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex,
+ int32_t *pParaStart, int32_t *pParaLimit,
+ UBiDiLevel *pParaLevel, UErrorCode *pErrorCode) {
+ int32_t paraIndex;
+
+ /* check the argument values */
+ /* pErrorCode will be checked by the call to ubidi_getParagraphByIndex */
+ RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, -1);
+ RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, -1);
+ pBiDi=pBiDi->pParaBiDi; /* get Para object if Line object */
+ RETURN_IF_BAD_RANGE(charIndex, 0, pBiDi->length, *pErrorCode, -1);
+
+ for(paraIndex=0; charIndex>=pBiDi->paras[paraIndex].limit; paraIndex++);
+ ubidi_getParagraphByIndex(pBiDi, paraIndex, pParaStart, pParaLimit, pParaLevel, pErrorCode);
+ return paraIndex;
+}
+
+U_CAPI void U_EXPORT2
+ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn,
+ const void *newContext, UBiDiClassCallback **oldFn,
+ const void **oldContext, UErrorCode *pErrorCode)
+{
+ RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
+ if(pBiDi==NULL) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ if( oldFn )
+ {
+ *oldFn = pBiDi->fnClassCallback;
+ }
+ if( oldContext )
+ {
+ *oldContext = pBiDi->coClassCallback;
+ }
+ pBiDi->fnClassCallback = newFn;
+ pBiDi->coClassCallback = newContext;
+}
+
+U_CAPI void U_EXPORT2
+ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context)
+{
+ if(pBiDi==NULL) {
+ return;
+ }
+ if( fn )
+ {
+ *fn = pBiDi->fnClassCallback;
+ }
+ if( context )
+ {
+ *context = pBiDi->coClassCallback;
+ }
+}
+
+U_CAPI UCharDirection U_EXPORT2
+ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c)
+{
+ UCharDirection dir;
+
+ if( pBiDi->fnClassCallback == NULL ||
+ (dir = (*pBiDi->fnClassCallback)(pBiDi->coClassCallback, c)) == U_BIDI_CLASS_DEFAULT )
+ {
+ dir = ubidi_getClass(c);
+ }
+ if(dir >= U_CHAR_DIRECTION_COUNT) {
+ dir = (UCharDirection)ON;
+ }
+ return dir;
+}
diff --git a/contrib/libs/icu/common/ubidi_props.cpp b/contrib/libs/icu/common/ubidi_props.cpp
index e4f1937e1d..4141c21938 100644
--- a/contrib/libs/icu/common/ubidi_props.cpp
+++ b/contrib/libs/icu/common/ubidi_props.cpp
@@ -1,254 +1,254 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-*******************************************************************************
-*
-* Copyright (C) 2004-2014, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-*******************************************************************************
-* file name: ubidi_props.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 2004dec30
-* created by: Markus W. Scherer
-*
-* Low-level Unicode bidi/shaping properties access.
-*/
-
-#include "unicode/utypes.h"
-#include "unicode/uset.h"
-#include "unicode/udata.h" /* UDataInfo */
-#include "ucmndata.h" /* DataHeader */
-#include "udatamem.h"
-#include "uassert.h"
-#include "cmemory.h"
-#include "utrie2.h"
-#include "ubidi_props.h"
-#include "ucln_cmn.h"
-
-struct UBiDiProps {
- UDataMemory *mem;
- const int32_t *indexes;
- const uint32_t *mirrors;
- const uint8_t *jgArray;
- const uint8_t *jgArray2;
-
- UTrie2 trie;
- uint8_t formatVersion[4];
-};
-
-/* ubidi_props_data.h is machine-generated by genbidi --csource */
-#define INCLUDED_FROM_UBIDI_PROPS_C
-#include "ubidi_props_data.h"
-
-/* set of property starts for UnicodeSet ------------------------------------ */
-
-static UBool U_CALLCONV
-_enumPropertyStartsRange(const void *context, UChar32 start, UChar32 end, uint32_t value) {
- (void)end;
- (void)value;
- /* add the start code point to the USet */
- const USetAdder *sa=(const USetAdder *)context;
- sa->add(sa->set, start);
- return TRUE;
-}
-
-U_CFUNC void
-ubidi_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
- int32_t i, length;
- UChar32 c, start, limit;
-
- const uint8_t *jgArray;
- uint8_t prev, jg;
-
- if(U_FAILURE(*pErrorCode)) {
- return;
- }
-
- /* add the start code point of each same-value range of the trie */
- utrie2_enum(&ubidi_props_singleton.trie, NULL, _enumPropertyStartsRange, sa);
-
- /* add the code points from the bidi mirroring table */
- length=ubidi_props_singleton.indexes[UBIDI_IX_MIRROR_LENGTH];
- for(i=0; i<length; ++i) {
- c=UBIDI_GET_MIRROR_CODE_POINT(ubidi_props_singleton.mirrors[i]);
- sa->addRange(sa->set, c, c+1);
- }
-
- /* add the code points from the Joining_Group array where the value changes */
- start=ubidi_props_singleton.indexes[UBIDI_IX_JG_START];
- limit=ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT];
- jgArray=ubidi_props_singleton.jgArray;
- for(;;) {
- prev=0;
- while(start<limit) {
- jg=*jgArray++;
- if(jg!=prev) {
- sa->add(sa->set, start);
- prev=jg;
- }
- ++start;
- }
- if(prev!=0) {
- /* add the limit code point if the last value was not 0 (it is now start==limit) */
- sa->add(sa->set, limit);
- }
- if(limit==ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT]) {
- /* switch to the second Joining_Group range */
- start=ubidi_props_singleton.indexes[UBIDI_IX_JG_START2];
- limit=ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT2];
- jgArray=ubidi_props_singleton.jgArray2;
- } else {
- break;
- }
- }
-
- /* add code points with hardcoded properties, plus the ones following them */
-
- /* (none right now) */
-}
-
-/* property access functions ------------------------------------------------ */
-
-U_CFUNC int32_t
-ubidi_getMaxValue(UProperty which) {
- int32_t max=ubidi_props_singleton.indexes[UBIDI_MAX_VALUES_INDEX];
- switch(which) {
- case UCHAR_BIDI_CLASS:
- return (max&UBIDI_CLASS_MASK);
- case UCHAR_JOINING_GROUP:
- return (max&UBIDI_MAX_JG_MASK)>>UBIDI_MAX_JG_SHIFT;
- case UCHAR_JOINING_TYPE:
- return (max&UBIDI_JT_MASK)>>UBIDI_JT_SHIFT;
- case UCHAR_BIDI_PAIRED_BRACKET_TYPE:
- return (max&UBIDI_BPT_MASK)>>UBIDI_BPT_SHIFT;
- default:
- return -1; /* undefined */
- }
-}
-
-U_CAPI UCharDirection
-ubidi_getClass(UChar32 c) {
- uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
- return (UCharDirection)UBIDI_GET_CLASS(props);
-}
-
-U_CFUNC UBool
-ubidi_isMirrored(UChar32 c) {
- uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
- return (UBool)UBIDI_GET_FLAG(props, UBIDI_IS_MIRRORED_SHIFT);
-}
-
-static UChar32
-getMirror(UChar32 c, uint16_t props) {
- int32_t delta=UBIDI_GET_MIRROR_DELTA(props);
- if(delta!=UBIDI_ESC_MIRROR_DELTA) {
- return c+delta;
- } else {
- /* look for mirror code point in the mirrors[] table */
- const uint32_t *mirrors;
- uint32_t m;
- int32_t i, length;
- UChar32 c2;
-
- mirrors=ubidi_props_singleton.mirrors;
- length=ubidi_props_singleton.indexes[UBIDI_IX_MIRROR_LENGTH];
-
- /* linear search */
- for(i=0; i<length; ++i) {
- m=mirrors[i];
- c2=UBIDI_GET_MIRROR_CODE_POINT(m);
- if(c==c2) {
- /* found c, return its mirror code point using the index in m */
- return UBIDI_GET_MIRROR_CODE_POINT(mirrors[UBIDI_GET_MIRROR_INDEX(m)]);
- } else if(c<c2) {
- break;
- }
- }
-
- /* c not found, return it itself */
- return c;
- }
-}
-
-U_CFUNC UChar32
-ubidi_getMirror(UChar32 c) {
- uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
- return getMirror(c, props);
-}
-
-U_CFUNC UBool
-ubidi_isBidiControl(UChar32 c) {
- uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
- return (UBool)UBIDI_GET_FLAG(props, UBIDI_BIDI_CONTROL_SHIFT);
-}
-
-U_CFUNC UBool
-ubidi_isJoinControl(UChar32 c) {
- uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
- return (UBool)UBIDI_GET_FLAG(props, UBIDI_JOIN_CONTROL_SHIFT);
-}
-
-U_CFUNC UJoiningType
-ubidi_getJoiningType(UChar32 c) {
- uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
- return (UJoiningType)((props&UBIDI_JT_MASK)>>UBIDI_JT_SHIFT);
-}
-
-U_CFUNC UJoiningGroup
-ubidi_getJoiningGroup(UChar32 c) {
- UChar32 start, limit;
-
- start=ubidi_props_singleton.indexes[UBIDI_IX_JG_START];
- limit=ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT];
- if(start<=c && c<limit) {
- return (UJoiningGroup)ubidi_props_singleton.jgArray[c-start];
- }
- start=ubidi_props_singleton.indexes[UBIDI_IX_JG_START2];
- limit=ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT2];
- if(start<=c && c<limit) {
- return (UJoiningGroup)ubidi_props_singleton.jgArray2[c-start];
- }
- return U_JG_NO_JOINING_GROUP;
-}
-
-U_CFUNC UBidiPairedBracketType
-ubidi_getPairedBracketType(UChar32 c) {
- uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
- return (UBidiPairedBracketType)((props&UBIDI_BPT_MASK)>>UBIDI_BPT_SHIFT);
-}
-
-U_CFUNC UChar32
-ubidi_getPairedBracket(UChar32 c) {
- uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
- if((props&UBIDI_BPT_MASK)==0) {
- return c;
- } else {
- return getMirror(c, props);
- }
-}
-
-/* public API (see uchar.h) ------------------------------------------------- */
-
-U_CFUNC UCharDirection
-u_charDirection(UChar32 c) {
- return ubidi_getClass(c);
-}
-
-U_CFUNC UBool
-u_isMirrored(UChar32 c) {
- return ubidi_isMirrored(c);
-}
-
-U_CFUNC UChar32
-u_charMirror(UChar32 c) {
- return ubidi_getMirror(c);
-}
-
-U_STABLE UChar32 U_EXPORT2
-u_getBidiPairedBracket(UChar32 c) {
- return ubidi_getPairedBracket(c);
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+* Copyright (C) 2004-2014, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: ubidi_props.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2004dec30
+* created by: Markus W. Scherer
+*
+* Low-level Unicode bidi/shaping properties access.
+*/
+
+#include "unicode/utypes.h"
+#include "unicode/uset.h"
+#include "unicode/udata.h" /* UDataInfo */
+#include "ucmndata.h" /* DataHeader */
+#include "udatamem.h"
+#include "uassert.h"
+#include "cmemory.h"
+#include "utrie2.h"
+#include "ubidi_props.h"
+#include "ucln_cmn.h"
+
+struct UBiDiProps {
+ UDataMemory *mem;
+ const int32_t *indexes;
+ const uint32_t *mirrors;
+ const uint8_t *jgArray;
+ const uint8_t *jgArray2;
+
+ UTrie2 trie;
+ uint8_t formatVersion[4];
+};
+
+/* ubidi_props_data.h is machine-generated by genbidi --csource */
+#define INCLUDED_FROM_UBIDI_PROPS_C
+#include "ubidi_props_data.h"
+
+/* set of property starts for UnicodeSet ------------------------------------ */
+
+static UBool U_CALLCONV
+_enumPropertyStartsRange(const void *context, UChar32 start, UChar32 end, uint32_t value) {
+ (void)end;
+ (void)value;
+ /* add the start code point to the USet */
+ const USetAdder *sa=(const USetAdder *)context;
+ sa->add(sa->set, start);
+ return TRUE;
+}
+
+U_CFUNC void
+ubidi_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
+ int32_t i, length;
+ UChar32 c, start, limit;
+
+ const uint8_t *jgArray;
+ uint8_t prev, jg;
+
+ if(U_FAILURE(*pErrorCode)) {
+ return;
+ }
+
+ /* add the start code point of each same-value range of the trie */
+ utrie2_enum(&ubidi_props_singleton.trie, NULL, _enumPropertyStartsRange, sa);
+
+ /* add the code points from the bidi mirroring table */
+ length=ubidi_props_singleton.indexes[UBIDI_IX_MIRROR_LENGTH];
+ for(i=0; i<length; ++i) {
+ c=UBIDI_GET_MIRROR_CODE_POINT(ubidi_props_singleton.mirrors[i]);
+ sa->addRange(sa->set, c, c+1);
+ }
+
+ /* add the code points from the Joining_Group array where the value changes */
+ start=ubidi_props_singleton.indexes[UBIDI_IX_JG_START];
+ limit=ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT];
+ jgArray=ubidi_props_singleton.jgArray;
+ for(;;) {
+ prev=0;
+ while(start<limit) {
+ jg=*jgArray++;
+ if(jg!=prev) {
+ sa->add(sa->set, start);
+ prev=jg;
+ }
+ ++start;
+ }
+ if(prev!=0) {
+ /* add the limit code point if the last value was not 0 (it is now start==limit) */
+ sa->add(sa->set, limit);
+ }
+ if(limit==ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT]) {
+ /* switch to the second Joining_Group range */
+ start=ubidi_props_singleton.indexes[UBIDI_IX_JG_START2];
+ limit=ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT2];
+ jgArray=ubidi_props_singleton.jgArray2;
+ } else {
+ break;
+ }
+ }
+
+ /* add code points with hardcoded properties, plus the ones following them */
+
+ /* (none right now) */
+}
+
+/* property access functions ------------------------------------------------ */
+
+U_CFUNC int32_t
+ubidi_getMaxValue(UProperty which) {
+ int32_t max=ubidi_props_singleton.indexes[UBIDI_MAX_VALUES_INDEX];
+ switch(which) {
+ case UCHAR_BIDI_CLASS:
+ return (max&UBIDI_CLASS_MASK);
+ case UCHAR_JOINING_GROUP:
+ return (max&UBIDI_MAX_JG_MASK)>>UBIDI_MAX_JG_SHIFT;
+ case UCHAR_JOINING_TYPE:
+ return (max&UBIDI_JT_MASK)>>UBIDI_JT_SHIFT;
+ case UCHAR_BIDI_PAIRED_BRACKET_TYPE:
+ return (max&UBIDI_BPT_MASK)>>UBIDI_BPT_SHIFT;
+ default:
+ return -1; /* undefined */
+ }
+}
+
+U_CAPI UCharDirection
+ubidi_getClass(UChar32 c) {
+ uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
+ return (UCharDirection)UBIDI_GET_CLASS(props);
+}
+
+U_CFUNC UBool
+ubidi_isMirrored(UChar32 c) {
+ uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
+ return (UBool)UBIDI_GET_FLAG(props, UBIDI_IS_MIRRORED_SHIFT);
+}
+
+static UChar32
+getMirror(UChar32 c, uint16_t props) {
+ int32_t delta=UBIDI_GET_MIRROR_DELTA(props);
+ if(delta!=UBIDI_ESC_MIRROR_DELTA) {
+ return c+delta;
+ } else {
+ /* look for mirror code point in the mirrors[] table */
+ const uint32_t *mirrors;
+ uint32_t m;
+ int32_t i, length;
+ UChar32 c2;
+
+ mirrors=ubidi_props_singleton.mirrors;
+ length=ubidi_props_singleton.indexes[UBIDI_IX_MIRROR_LENGTH];
+
+ /* linear search */
+ for(i=0; i<length; ++i) {
+ m=mirrors[i];
+ c2=UBIDI_GET_MIRROR_CODE_POINT(m);
+ if(c==c2) {
+ /* found c, return its mirror code point using the index in m */
+ return UBIDI_GET_MIRROR_CODE_POINT(mirrors[UBIDI_GET_MIRROR_INDEX(m)]);
+ } else if(c<c2) {
+ break;
+ }
+ }
+
+ /* c not found, return it itself */
+ return c;
+ }
+}
+
+U_CFUNC UChar32
+ubidi_getMirror(UChar32 c) {
+ uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
+ return getMirror(c, props);
+}
+
+U_CFUNC UBool
+ubidi_isBidiControl(UChar32 c) {
+ uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
+ return (UBool)UBIDI_GET_FLAG(props, UBIDI_BIDI_CONTROL_SHIFT);
+}
+
+U_CFUNC UBool
+ubidi_isJoinControl(UChar32 c) {
+ uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
+ return (UBool)UBIDI_GET_FLAG(props, UBIDI_JOIN_CONTROL_SHIFT);
+}
+
+U_CFUNC UJoiningType
+ubidi_getJoiningType(UChar32 c) {
+ uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
+ return (UJoiningType)((props&UBIDI_JT_MASK)>>UBIDI_JT_SHIFT);
+}
+
+U_CFUNC UJoiningGroup
+ubidi_getJoiningGroup(UChar32 c) {
+ UChar32 start, limit;
+
+ start=ubidi_props_singleton.indexes[UBIDI_IX_JG_START];
+ limit=ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT];
+ if(start<=c && c<limit) {
+ return (UJoiningGroup)ubidi_props_singleton.jgArray[c-start];
+ }
+ start=ubidi_props_singleton.indexes[UBIDI_IX_JG_START2];
+ limit=ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT2];
+ if(start<=c && c<limit) {
+ return (UJoiningGroup)ubidi_props_singleton.jgArray2[c-start];
+ }
+ return U_JG_NO_JOINING_GROUP;
+}
+
+U_CFUNC UBidiPairedBracketType
+ubidi_getPairedBracketType(UChar32 c) {
+ uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
+ return (UBidiPairedBracketType)((props&UBIDI_BPT_MASK)>>UBIDI_BPT_SHIFT);
+}
+
+U_CFUNC UChar32
+ubidi_getPairedBracket(UChar32 c) {
+ uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
+ if((props&UBIDI_BPT_MASK)==0) {
+ return c;
+ } else {
+ return getMirror(c, props);
+ }
+}
+
+/* public API (see uchar.h) ------------------------------------------------- */
+
+U_CFUNC UCharDirection
+u_charDirection(UChar32 c) {
+ return ubidi_getClass(c);
+}
+
+U_CFUNC UBool
+u_isMirrored(UChar32 c) {
+ return ubidi_isMirrored(c);
+}
+
+U_CFUNC UChar32
+u_charMirror(UChar32 c) {
+ return ubidi_getMirror(c);
+}
+
+U_STABLE UChar32 U_EXPORT2
+u_getBidiPairedBracket(UChar32 c) {
+ return ubidi_getPairedBracket(c);
+}
diff --git a/contrib/libs/icu/common/ubidi_props.h b/contrib/libs/icu/common/ubidi_props.h
index 0ebabc7485..698ee9c52b 100644
--- a/contrib/libs/icu/common/ubidi_props.h
+++ b/contrib/libs/icu/common/ubidi_props.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: ubidi_props.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -32,39 +32,39 @@ U_CDECL_BEGIN
/* library API -------------------------------------------------------------- */
U_CFUNC void
-ubidi_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode);
+ubidi_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode);
/* property access functions */
U_CFUNC int32_t
-ubidi_getMaxValue(UProperty which);
+ubidi_getMaxValue(UProperty which);
U_CAPI UCharDirection
-ubidi_getClass(UChar32 c);
+ubidi_getClass(UChar32 c);
U_CFUNC UBool
-ubidi_isMirrored(UChar32 c);
+ubidi_isMirrored(UChar32 c);
U_CFUNC UChar32
-ubidi_getMirror(UChar32 c);
+ubidi_getMirror(UChar32 c);
U_CFUNC UBool
-ubidi_isBidiControl(UChar32 c);
+ubidi_isBidiControl(UChar32 c);
U_CFUNC UBool
-ubidi_isJoinControl(UChar32 c);
+ubidi_isJoinControl(UChar32 c);
U_CFUNC UJoiningType
-ubidi_getJoiningType(UChar32 c);
+ubidi_getJoiningType(UChar32 c);
U_CFUNC UJoiningGroup
-ubidi_getJoiningGroup(UChar32 c);
+ubidi_getJoiningGroup(UChar32 c);
U_CFUNC UBidiPairedBracketType
-ubidi_getPairedBracketType(UChar32 c);
+ubidi_getPairedBracketType(UChar32 c);
U_CFUNC UChar32
-ubidi_getPairedBracket(UChar32 c);
+ubidi_getPairedBracket(UChar32 c);
/* file definitions --------------------------------------------------------- */
diff --git a/contrib/libs/icu/common/ubidi_props_data.h b/contrib/libs/icu/common/ubidi_props_data.h
index 69a99cadf7..7a34870bd8 100644
--- a/contrib/libs/icu/common/ubidi_props_data.h
+++ b/contrib/libs/icu/common/ubidi_props_data.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// Copyright (C) 1999-2016, International Business Machines
@@ -11,358 +11,358 @@
#ifdef INCLUDED_FROM_UBIDI_PROPS_C
-static const UVersionInfo ubidi_props_dataVersion={0xd,0,0,0};
+static const UVersionInfo ubidi_props_dataVersion={0xd,0,0,0};
-static const int32_t ubidi_props_indexes[UBIDI_IX_TOP]={0x10,0x67ec,0x6200,0x28,0x620,0x8c8,0x10ac0,0x10d24,0,0,0,0,0,0,0,0x6502b6};
+static const int32_t ubidi_props_indexes[UBIDI_IX_TOP]={0x10,0x67ec,0x6200,0x28,0x620,0x8c8,0x10ac0,0x10d24,0,0,0,0,0,0,0,0x6502b6};
-static const uint16_t ubidi_props_trieIndex[12536]={
-0x37c,0x384,0x38c,0x394,0x3ac,0x3b4,0x3bc,0x3c4,0x39c,0x3a4,0x39c,0x3a4,0x39c,0x3a4,0x39c,0x3a4,
-0x39c,0x3a4,0x39c,0x3a4,0x3ca,0x3d2,0x3da,0x3e2,0x3ea,0x3f2,0x3ee,0x3f6,0x3fe,0x406,0x401,0x409,
-0x39c,0x3a4,0x39c,0x3a4,0x411,0x419,0x39c,0x3a4,0x39c,0x3a4,0x39c,0x3a4,0x41f,0x427,0x42f,0x437,
-0x43f,0x447,0x44f,0x457,0x45d,0x465,0x46d,0x475,0x47d,0x485,0x48b,0x493,0x49b,0x4a3,0x4ab,0x4b3,
-0x4bf,0x4bb,0x4c7,0x4cf,0x431,0x4df,0x4e6,0x4d7,0x4ee,0x4f0,0x4f8,0x500,0x508,0x509,0x511,0x519,
-0x521,0x509,0x529,0x52e,0x521,0x509,0x536,0x53e,0x508,0x546,0x54e,0x500,0x556,0x39c,0x55e,0x562,
-0x56a,0x56c,0x574,0x57c,0x508,0x584,0x58c,0x500,0x413,0x590,0x511,0x500,0x508,0x39c,0x598,0x39c,
-0x39c,0x59e,0x5a6,0x39c,0x39c,0x5aa,0x5b2,0x39c,0x5b6,0x5bd,0x39c,0x5c5,0x5cd,0x5d4,0x555,0x39c,
-0x39c,0x5dc,0x5e4,0x5ec,0x5f4,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x5fc,0x39c,0x604,0x39c,0x39c,0x39c,
-0x60c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x614,0x39c,0x39c,0x39c,0x61c,0x61c,0x515,0x515,0x39c,0x622,0x62a,0x604,
-0x640,0x632,0x632,0x648,0x64f,0x638,0x39c,0x39c,0x39c,0x657,0x65f,0x39c,0x39c,0x39c,0x661,0x669,
-0x671,0x39c,0x678,0x680,0x39c,0x688,0x56b,0x39c,0x545,0x690,0x556,0x698,0x413,0x6a0,0x39c,0x6a7,
-0x39c,0x6ac,0x39c,0x39c,0x39c,0x39c,0x6b2,0x6ba,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x3ea,0x6c2,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x6ca,0x6d2,0x6d6,
-0x6ee,0x6f4,0x6de,0x6e6,0x6fc,0x704,0x708,0x5d7,0x710,0x718,0x720,0x39c,0x728,0x669,0x669,0x669,
-0x738,0x740,0x748,0x750,0x755,0x75d,0x765,0x730,0x76d,0x775,0x39c,0x77b,0x782,0x669,0x669,0x669,
-0x669,0x582,0x788,0x669,0x790,0x39c,0x39c,0x666,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,
-0x669,0x669,0x669,0x669,0x669,0x798,0x669,0x669,0x669,0x669,0x669,0x79e,0x669,0x669,0x7a6,0x7ae,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x669,0x669,0x669,0x669,0x7be,0x7c6,0x7ce,0x7b6,
-0x7de,0x7e6,0x7ee,0x7f5,0x7fc,0x804,0x808,0x7d6,0x669,0x669,0x669,0x810,0x816,0x669,0x669,0x81c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x824,0x39c,0x39c,0x39c,0x82c,0x39c,0x39c,0x39c,0x3ea,
-0x834,0x83c,0x840,0x39c,0x848,0x669,0x669,0x66c,0x669,0x669,0x669,0x669,0x669,0x669,0x84f,0x855,
-0x865,0x85d,0x39c,0x39c,0x86d,0x60c,0x39c,0x3c3,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x669,0x82b,
-0x3d1,0x39c,0x875,0x87d,0x39c,0x885,0x88d,0x39c,0x39c,0x39c,0x39c,0x891,0x39c,0x39c,0x661,0x3c2,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x669,0x669,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x875,0x669,0x582,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x898,0x39c,0x39c,0x89d,0x56c,0x39c,0x39c,0x5b8,0x669,0x660,0x39c,0x39c,0x8a5,0x39c,0x39c,0x39c,
-0x8ad,0x8b4,0x632,0x8bc,0x39c,0x39c,0x58e,0x8c4,0x39c,0x8cc,0x8d3,0x39c,0x4ee,0x8d8,0x39c,0x507,
-0x39c,0x8e0,0x8e8,0x509,0x39c,0x8ec,0x508,0x8f4,0x39c,0x39c,0x39c,0x8fa,0x39c,0x39c,0x39c,0x901,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x915,0x909,0x90d,0x49b,0x49b,0x49b,0x49b,0x49b,
-0x49b,0x49b,0x49b,0x49b,0x49b,0x49b,0x49b,0x49b,0x49b,0x91d,0x49b,0x49b,0x49b,0x49b,0x925,0x929,
-0x931,0x939,0x93d,0x945,0x49b,0x49b,0x49b,0x949,0x951,0x38c,0x959,0x961,0x39c,0x39c,0x39c,0x969,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0xe70,0xe70,0xeb0,0xef0,0xe70,0xe70,0xe70,0xe70,0xe70,0xe70,0xf28,0xf68,0xfa8,0xfb8,0xff8,0x1004,
-0xe70,0xe70,0x1044,0xe70,0xe70,0xe70,0x107c,0x10bc,0x10fc,0x113c,0x1174,0x11b4,0x11f4,0x122c,0x126c,0x12ac,
-0xa40,0xa80,0xac0,0xaff,0x1a0,0x1a0,0xb3f,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xb68,0x1a0,0x1a0,
-0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xba8,0x1a0,0x1a0,0xbdd,0xc1d,0xc5d,0xc9d,0xcdd,0xd1d,
+static const uint16_t ubidi_props_trieIndex[12536]={
+0x37c,0x384,0x38c,0x394,0x3ac,0x3b4,0x3bc,0x3c4,0x39c,0x3a4,0x39c,0x3a4,0x39c,0x3a4,0x39c,0x3a4,
+0x39c,0x3a4,0x39c,0x3a4,0x3ca,0x3d2,0x3da,0x3e2,0x3ea,0x3f2,0x3ee,0x3f6,0x3fe,0x406,0x401,0x409,
+0x39c,0x3a4,0x39c,0x3a4,0x411,0x419,0x39c,0x3a4,0x39c,0x3a4,0x39c,0x3a4,0x41f,0x427,0x42f,0x437,
+0x43f,0x447,0x44f,0x457,0x45d,0x465,0x46d,0x475,0x47d,0x485,0x48b,0x493,0x49b,0x4a3,0x4ab,0x4b3,
+0x4bf,0x4bb,0x4c7,0x4cf,0x431,0x4df,0x4e6,0x4d7,0x4ee,0x4f0,0x4f8,0x500,0x508,0x509,0x511,0x519,
+0x521,0x509,0x529,0x52e,0x521,0x509,0x536,0x53e,0x508,0x546,0x54e,0x500,0x556,0x39c,0x55e,0x562,
+0x56a,0x56c,0x574,0x57c,0x508,0x584,0x58c,0x500,0x413,0x590,0x511,0x500,0x508,0x39c,0x598,0x39c,
+0x39c,0x59e,0x5a6,0x39c,0x39c,0x5aa,0x5b2,0x39c,0x5b6,0x5bd,0x39c,0x5c5,0x5cd,0x5d4,0x555,0x39c,
+0x39c,0x5dc,0x5e4,0x5ec,0x5f4,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x5fc,0x39c,0x604,0x39c,0x39c,0x39c,
+0x60c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x614,0x39c,0x39c,0x39c,0x61c,0x61c,0x515,0x515,0x39c,0x622,0x62a,0x604,
+0x640,0x632,0x632,0x648,0x64f,0x638,0x39c,0x39c,0x39c,0x657,0x65f,0x39c,0x39c,0x39c,0x661,0x669,
+0x671,0x39c,0x678,0x680,0x39c,0x688,0x56b,0x39c,0x545,0x690,0x556,0x698,0x413,0x6a0,0x39c,0x6a7,
+0x39c,0x6ac,0x39c,0x39c,0x39c,0x39c,0x6b2,0x6ba,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x3ea,0x6c2,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x6ca,0x6d2,0x6d6,
+0x6ee,0x6f4,0x6de,0x6e6,0x6fc,0x704,0x708,0x5d7,0x710,0x718,0x720,0x39c,0x728,0x669,0x669,0x669,
+0x738,0x740,0x748,0x750,0x755,0x75d,0x765,0x730,0x76d,0x775,0x39c,0x77b,0x782,0x669,0x669,0x669,
+0x669,0x582,0x788,0x669,0x790,0x39c,0x39c,0x666,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,
+0x669,0x669,0x669,0x669,0x669,0x798,0x669,0x669,0x669,0x669,0x669,0x79e,0x669,0x669,0x7a6,0x7ae,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x669,0x669,0x669,0x669,0x7be,0x7c6,0x7ce,0x7b6,
+0x7de,0x7e6,0x7ee,0x7f5,0x7fc,0x804,0x808,0x7d6,0x669,0x669,0x669,0x810,0x816,0x669,0x669,0x81c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x824,0x39c,0x39c,0x39c,0x82c,0x39c,0x39c,0x39c,0x3ea,
+0x834,0x83c,0x840,0x39c,0x848,0x669,0x669,0x66c,0x669,0x669,0x669,0x669,0x669,0x669,0x84f,0x855,
+0x865,0x85d,0x39c,0x39c,0x86d,0x60c,0x39c,0x3c3,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x669,0x82b,
+0x3d1,0x39c,0x875,0x87d,0x39c,0x885,0x88d,0x39c,0x39c,0x39c,0x39c,0x891,0x39c,0x39c,0x661,0x3c2,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x669,0x669,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x875,0x669,0x582,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x898,0x39c,0x39c,0x89d,0x56c,0x39c,0x39c,0x5b8,0x669,0x660,0x39c,0x39c,0x8a5,0x39c,0x39c,0x39c,
+0x8ad,0x8b4,0x632,0x8bc,0x39c,0x39c,0x58e,0x8c4,0x39c,0x8cc,0x8d3,0x39c,0x4ee,0x8d8,0x39c,0x507,
+0x39c,0x8e0,0x8e8,0x509,0x39c,0x8ec,0x508,0x8f4,0x39c,0x39c,0x39c,0x8fa,0x39c,0x39c,0x39c,0x901,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x915,0x909,0x90d,0x49b,0x49b,0x49b,0x49b,0x49b,
+0x49b,0x49b,0x49b,0x49b,0x49b,0x49b,0x49b,0x49b,0x49b,0x91d,0x49b,0x49b,0x49b,0x49b,0x925,0x929,
+0x931,0x939,0x93d,0x945,0x49b,0x49b,0x49b,0x949,0x951,0x38c,0x959,0x961,0x39c,0x39c,0x39c,0x969,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0xe70,0xe70,0xeb0,0xef0,0xe70,0xe70,0xe70,0xe70,0xe70,0xe70,0xf28,0xf68,0xfa8,0xfb8,0xff8,0x1004,
+0xe70,0xe70,0x1044,0xe70,0xe70,0xe70,0x107c,0x10bc,0x10fc,0x113c,0x1174,0x11b4,0x11f4,0x122c,0x126c,0x12ac,
+0xa40,0xa80,0xac0,0xaff,0x1a0,0x1a0,0xb3f,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xb68,0x1a0,0x1a0,
+0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xba8,0x1a0,0x1a0,0xbdd,0xc1d,0xc5d,0xc9d,0xcdd,0xd1d,
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
-0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
+0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
-0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
+0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
-0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
+0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
-0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
+0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
-0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
+0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
-0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
+0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
-0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
+0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
-0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
+0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
-0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
+0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
-0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
+0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
-0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
+0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
-0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
-0xd9d,0xdad,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
-0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
+0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
+0xd9d,0xdad,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
+0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
-0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
+0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
-0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x971,0x39c,0x669,0x669,0x979,0x60c,0x39c,0x501,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x981,0x39c,0x39c,0x39c,0x988,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x990,0x431,0x431,0x431,0x431,0x431,0x431,0x431,
-0x998,0x99c,0x431,0x431,0x431,0x431,0x9ac,0x9a4,0x431,0x9b4,0x431,0x431,0x9bc,0x9c2,0x431,0x431,
-0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x9d2,0x9ca,0x431,0x431,0x431,0x431,0x431,0x431,
-0x431,0x431,0x431,0x9da,0x431,0x9e2,0x431,0x431,0x431,0x9e6,0x9ed,0x9f3,0x431,0x9f7,0x9ff,0x431,
-0x508,0xa07,0xa0e,0xa15,0x413,0xa18,0x39c,0x39c,0x4ee,0xa1f,0x39c,0xa25,0x413,0xa2a,0xa32,0x39c,
-0x39c,0xa37,0x39c,0x39c,0x39c,0x39c,0x82c,0xa3f,0x413,0x590,0x56b,0xa46,0x39c,0x39c,0x39c,0x39c,
-0x39c,0xa07,0xa4e,0x39c,0x39c,0xa56,0xa5e,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xa62,0xa6a,0x39c,
-0x39c,0xa72,0x56b,0xa7a,0x39c,0xa80,0x39c,0x39c,0x5fc,0xa88,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0xa8d,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xa94,0xa9c,0x39c,0x39c,0x39c,0xa9f,0x56b,0xaa7,
-0xaab,0xab3,0x39c,0xaba,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0xac1,0x39c,0x39c,0xacf,0xac9,0x39c,0x39c,0x39c,0xad7,0xadf,0x39c,0xae3,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x592,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xaf0,0xaeb,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0xaf8,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xaff,
-0x39c,0xb05,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0xa26,0x39c,0xb0b,0x39c,0x39c,0xb13,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x522,0xb1b,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xb22,0xb2a,0xb30,0x39c,0x39c,0x669,0x669,0xb38,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x669,0x669,0x83f,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0xb3a,0x39c,0xb41,0x39c,0xb3d,0x39c,0xb44,0x39c,0xb4c,0xb50,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x3ea,0xb58,0x3ea,
-0xb5f,0xb66,0xb6e,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xb76,0xb7e,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xb05,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0xb83,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x431,0x431,0x431,
-0x431,0x431,0x431,0xb8b,0x431,0xb93,0xb93,0xb9a,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,
-0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,
-0x90d,0x49b,0x49b,0x431,0x431,0x49b,0x49b,0x9f3,0x431,0x431,0x431,0x431,0x431,0x49b,0x49b,0x49b,
-0x49b,0x49b,0x49b,0x49b,0xba2,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x669,0xbaa,0x669,
-0x669,0x66c,0xbaf,0xbb3,0x84f,0xbbb,0x3be,0x39c,0xbc1,0x39c,0xbc6,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x779,0x39c,0x39c,0x39c,0x39c,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,
-0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,
-0x669,0x669,0x669,0x66b,0x979,0x669,0x669,0x669,0x66c,0x669,0x669,0xbce,0x66e,0xbaa,0x669,0xbd6,
-0x669,0xbde,0xbe3,0x39c,0x39c,0x669,0x669,0x669,0xbeb,0x669,0x669,0x798,0x669,0x669,0x669,0x66c,
-0xbf2,0xbfa,0xc00,0xc05,0x39c,0x669,0x669,0x669,0x669,0xc0d,0x669,0x788,0xc15,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xc1c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
-0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xc1c,0xc2c,0xc24,0xc24,
-0xc24,0xc2d,0xc2d,0xc2d,0xc2d,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0xc35,0xc2d,0xc2d,0xc2d,
-0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,
-0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,
-0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,
-0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0x37b,0x37b,0x37b,
-0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,8,7,8,9,7,0x12,0x12,
-0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,7,7,7,8,
-9,0xa,0xa,4,4,4,0xa,0xa,0x310a,0xf20a,0xa,3,6,3,6,6,
-2,2,2,2,2,2,2,2,2,2,6,0xa,0x500a,0xa,0xd00a,0xa,
-0xa,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,0x510a,0xa,0xd20a,0xa,0xa,
-0xa,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,0x510a,0xa,0xd20a,0xa,0x12,
-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,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,0,0,0,0,0,0,
-0x12,0x12,0x12,0x12,0x12,7,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
+0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x971,0x39c,0x669,0x669,0x979,0x60c,0x39c,0x501,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x981,0x39c,0x39c,0x39c,0x988,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x990,0x431,0x431,0x431,0x431,0x431,0x431,0x431,
+0x998,0x99c,0x431,0x431,0x431,0x431,0x9ac,0x9a4,0x431,0x9b4,0x431,0x431,0x9bc,0x9c2,0x431,0x431,
+0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x9d2,0x9ca,0x431,0x431,0x431,0x431,0x431,0x431,
+0x431,0x431,0x431,0x9da,0x431,0x9e2,0x431,0x431,0x431,0x9e6,0x9ed,0x9f3,0x431,0x9f7,0x9ff,0x431,
+0x508,0xa07,0xa0e,0xa15,0x413,0xa18,0x39c,0x39c,0x4ee,0xa1f,0x39c,0xa25,0x413,0xa2a,0xa32,0x39c,
+0x39c,0xa37,0x39c,0x39c,0x39c,0x39c,0x82c,0xa3f,0x413,0x590,0x56b,0xa46,0x39c,0x39c,0x39c,0x39c,
+0x39c,0xa07,0xa4e,0x39c,0x39c,0xa56,0xa5e,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xa62,0xa6a,0x39c,
+0x39c,0xa72,0x56b,0xa7a,0x39c,0xa80,0x39c,0x39c,0x5fc,0xa88,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0xa8d,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xa94,0xa9c,0x39c,0x39c,0x39c,0xa9f,0x56b,0xaa7,
+0xaab,0xab3,0x39c,0xaba,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0xac1,0x39c,0x39c,0xacf,0xac9,0x39c,0x39c,0x39c,0xad7,0xadf,0x39c,0xae3,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x592,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xaf0,0xaeb,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0xaf8,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xaff,
+0x39c,0xb05,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0xa26,0x39c,0xb0b,0x39c,0x39c,0xb13,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x522,0xb1b,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xb22,0xb2a,0xb30,0x39c,0x39c,0x669,0x669,0xb38,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x669,0x669,0x83f,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0xb3a,0x39c,0xb41,0x39c,0xb3d,0x39c,0xb44,0x39c,0xb4c,0xb50,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x3ea,0xb58,0x3ea,
+0xb5f,0xb66,0xb6e,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xb76,0xb7e,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xb05,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0xb83,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x431,0x431,0x431,
+0x431,0x431,0x431,0xb8b,0x431,0xb93,0xb93,0xb9a,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,
+0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,
+0x90d,0x49b,0x49b,0x431,0x431,0x49b,0x49b,0x9f3,0x431,0x431,0x431,0x431,0x431,0x49b,0x49b,0x49b,
+0x49b,0x49b,0x49b,0x49b,0xba2,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x669,0xbaa,0x669,
+0x669,0x66c,0xbaf,0xbb3,0x84f,0xbbb,0x3be,0x39c,0xbc1,0x39c,0xbc6,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x779,0x39c,0x39c,0x39c,0x39c,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,
+0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,
+0x669,0x669,0x669,0x66b,0x979,0x669,0x669,0x669,0x66c,0x669,0x669,0xbce,0x66e,0xbaa,0x669,0xbd6,
+0x669,0xbde,0xbe3,0x39c,0x39c,0x669,0x669,0x669,0xbeb,0x669,0x669,0x798,0x669,0x669,0x669,0x66c,
+0xbf2,0xbfa,0xc00,0xc05,0x39c,0x669,0x669,0x669,0x669,0xc0d,0x669,0x788,0xc15,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xc1c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,
+0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xc1c,0xc2c,0xc24,0xc24,
+0xc24,0xc2d,0xc2d,0xc2d,0xc2d,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0xc35,0xc2d,0xc2d,0xc2d,
+0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,
+0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,
+0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,
+0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0x37b,0x37b,0x37b,
+0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,8,7,8,9,7,0x12,0x12,
+0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,7,7,7,8,
+9,0xa,0xa,4,4,4,0xa,0xa,0x310a,0xf20a,0xa,3,6,3,6,6,
+2,2,2,2,2,2,2,2,2,2,6,0xa,0x500a,0xa,0xd00a,0xa,
+0xa,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,0x510a,0xa,0xd20a,0xa,0xa,
+0xa,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,0x510a,0xa,0xd20a,0xa,0x12,
+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,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,0,0,0,0,0,0,
+0x12,0x12,0x12,0x12,0x12,7,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
-6,0xa,4,4,4,4,0xa,0xa,0xa,0xa,0,0x900a,0xa,0xb2,0xa,0xa,
-4,4,2,2,0xa,0,0xa,0xa,0xa,2,0,0x900a,0xa,0xa,0xa,0xa,
+6,0xa,4,4,4,4,0xa,0xa,0xa,0xa,0,0x900a,0xa,0xb2,0xa,0xa,
+4,4,2,2,0xa,0,0xa,0xa,0xa,2,0,0x900a,0xa,0xa,0xa,0xa,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0xa,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,0,0,0xa,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0xa,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,0,0,0xa,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,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,0xa,0xa,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
+0,0xa,0xa,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0xa,0xa,0,0,
-0,0,0,0,0,0,0xa,0,0,0,0,0,0xa,0xa,0,0xa,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0xa,0xa,0,0,
+0,0,0,0,0,0,0xa,0,0,0,0,0,0xa,0xa,0,0xa,
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,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,0xa,0,0,0,0,0,
-0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,
+0,0,0,0,0,0,0,0,0,0,0xa,0,0,0,0,0,
+0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,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,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,0xa,0,0,0xa,0xa,4,1,0xb1,0xb1,0xb1,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0xa,0,0,0xa,0xa,4,1,0xb1,0xb1,0xb1,
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,1,0xb1,1,0xb1,0xb1,1,
-0xb1,0xb1,1,0xb1,1,1,1,1,1,1,1,1,1,1,1,1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,1,0xb1,1,0xb1,0xb1,1,
+0xb1,0xb1,1,0xb1,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,5,5,5,5,
-5,5,0xa,0xa,0xd,4,4,0xd,6,0xd,0xa,0xa,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0x8ad,0xd,0xd,0xd,0x4d,0xd,0x8d,0x8d,
-0x8d,0x8d,0x4d,0x8d,0x4d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,0x4d,
-0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x2d,0x4d,0x4d,0x4d,
-0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,5,5,5,5,
-5,5,5,5,5,5,4,5,5,0xd,0x4d,0x4d,0xb1,0x8d,0x8d,0x8d,
-0xd,0x8d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,
-0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x4d,0x4d,
+1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,
+5,5,0xa,0xa,0xd,4,4,0xd,6,0xd,0xa,0xa,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0x8ad,0xd,0xd,0xd,0x4d,0xd,0x8d,0x8d,
+0x8d,0x8d,0x4d,0x8d,0x4d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,0x4d,
+0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x2d,0x4d,0x4d,0x4d,
+0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,5,5,5,5,
+5,5,5,5,5,5,4,5,5,0xd,0x4d,0x4d,0xb1,0x8d,0x8d,0x8d,
+0xd,0x8d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,
+0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x4d,0x4d,
+0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,
0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,
-0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,
-0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,
-0x4d,0x8d,0x4d,0x8d,0x4d,0x4d,0x8d,0x8d,0xd,0x8d,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,5,0xa,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0xd,0xb1,0xb1,0xa,0xb1,0xb1,
-0xb1,0xb1,0x8d,0x8d,2,2,2,2,2,2,2,2,2,2,0x4d,0x4d,
-0x4d,0xd,0xd,0x4d,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,
-0xd,0xd,0xd,0xad,0x8d,0xb1,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,0x8d,0x4d,0x4d,
-0x4d,0x4d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x8d,0x4d,
-0x8d,0x4d,0x4d,0x8d,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0xd,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,
-0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,
-0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x8d,
-0x8d,0x4d,0x4d,0x4d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0xd,0xd,0xd,0xd,
+0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,
+0x4d,0x8d,0x4d,0x8d,0x4d,0x4d,0x8d,0x8d,0xd,0x8d,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,5,0xa,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0xd,0xb1,0xb1,0xa,0xb1,0xb1,
+0xb1,0xb1,0x8d,0x8d,2,2,2,2,2,2,2,2,2,2,0x4d,0x4d,
+0x4d,0xd,0xd,0x4d,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,
+0xd,0xd,0xd,0xad,0x8d,0xb1,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,0x8d,0x4d,0x4d,
+0x4d,0x4d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x8d,0x4d,
+0x8d,0x4d,0x4d,0x8d,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0xd,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,
+0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,
+0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x8d,
+0x8d,0x4d,0x4d,0x4d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0xd,0xd,0xd,0xd,
+0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,
0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,
-0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,
-0xd,0xd,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0xd,0xd,
-0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,1,1,1,1,
-1,1,1,1,1,1,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,
+0xd,0xd,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0xd,0xd,
+0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,1,1,1,1,
+1,1,1,1,1,1,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,
0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,
-0x41,0x41,0x41,0x41,0x41,0x41,0x41,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-1,1,0xa,0xa,0xa,0xa,0x21,1,1,0xb1,1,1,0xb1,0xb1,0xb1,0xb1,
-1,0xb1,0xb1,0xb1,1,0xb1,0xb1,0xb1,0xb1,0xb1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,0xb1,0xb1,0xb1,0xb1,1,0xb1,0xb1,0xb1,0xb1,0xb1,0x81,0x41,0x41,0x41,
-0x41,0x41,0x81,0x81,0x41,0x81,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,
-0x81,0x41,0x81,0x81,0x81,0xb1,0xb1,0xb1,1,1,1,1,0x4d,0xd,0x4d,0x4d,
-0x4d,0x4d,0xd,0x8d,0x4d,0x8d,0x8d,0xd,0xd,0xd,0xd,0xd,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,0xb1,0xb1,5,0xb1,
+0x41,0x41,0x41,0x41,0x41,0x41,0x41,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
+1,1,0xa,0xa,0xa,0xa,0x21,1,1,0xb1,1,1,0xb1,0xb1,0xb1,0xb1,
+1,0xb1,0xb1,0xb1,1,0xb1,0xb1,0xb1,0xb1,0xb1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,0xb1,0xb1,0xb1,0xb1,1,0xb1,0xb1,0xb1,0xb1,0xb1,0x81,0x41,0x41,0x41,
+0x41,0x41,0x81,0x81,0x41,0x81,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,
+0x81,0x41,0x81,0x81,0x81,0xb1,0xb1,0xb1,1,1,1,1,0x4d,0xd,0x4d,0x4d,
+0x4d,0x4d,0xd,0x8d,0x4d,0x8d,0x8d,0xd,0xd,0xd,0xd,0xd,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,0xb1,0xb1,5,0xb1,
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0x4d,0x4d,0x4d,0x4d,
-0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0xd,0x8d,0x4d,0x4d,0x8d,0x8d,0x4d,
-0x4d,0xd,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,
-0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,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,0,0,0xb1,0,0xb1,0,0,0,
-0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0xb1,0,0,
-0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0x4d,0x4d,0x4d,0x4d,
+0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0xd,0x8d,0x4d,0x4d,0x8d,0x8d,0x4d,
+0x4d,0xd,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,
+0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,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,0,0,0xb1,0,0xb1,0,0,0,
+0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0xb1,0,0,
+0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,
0,0,0xb1,0xb1,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,0xb1,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,0,
-0xb1,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0xb1,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,
0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,4,
-0,0,0xb1,0,0,0xb1,0xb1,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,0,0xb1,0xb1,0,0,0,0,0xb1,0xb1,0,0,0xb1,
-0xb1,0xb1,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0,0xb1,0,0,
-0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,
-0xb1,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0,0,
-0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,
-0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,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,0,4,4,0,0,0,0,0,0,0,4,
+0,0,0xb1,0,0,0xb1,0xb1,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,0,0xb1,0xb1,0,0,0,0,0xb1,0xb1,0,0,0xb1,
+0xb1,0xb1,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0,0xb1,0,0,
+0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,
+0xb1,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0,0,
+0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,
+0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,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,0xb1,0,0,0xb1,0,0xb1,0xb1,0xb1,0xb1,0,0,0,
-0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0xb1,0xb1,0,
-0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0,0,0,
+0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0xb1,0xb1,0,
+0,0,0,0,0,0,0,0,0,0,0xb1,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,0xb1,0,0,0,0,0,0,0,
-0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,
-0xa,4,0xa,0,0,0,0,0,0xb1,0,0,0,0xb1,0,0,0,
+0,0,0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,
+0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,
+0xa,4,0xa,0,0,0,0,0,0xb1,0,0,0,0xb1,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,0,0,0,0,0xb1,0xb1,
0xb1,0,0,0,0,0,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0,0,
@@ -373,180 +373,180 @@ static const uint16_t ubidi_props_trieIndex[12536]={
0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0xa0,
0,0,0,0,0,0,0xa0,0,0,0,0,0,0xb1,0xb1,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,0xb1,0xb1,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0,0,0,
-0,0,0xb1,0xb1,0xb1,0,0xb1,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0,0,0,0,4,0,0,0,0,0,0,0,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,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,
-0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0xb1,0,0xb1,0,0xb1,0x310a,0xf20a,
-0x310a,0xf20a,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0,
-0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,
-0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0,0xb1,0xb1,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,0xb1,0xb1,0,0,0,0,0xb1,0xb1,
-0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0,0xb1,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0,0,0,
+0,0,0xb1,0xb1,0xb1,0,0xb1,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0,0,0,0,4,0,0,0,0,0,0,0,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,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,
+0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0xb1,0,0xb1,0,0xb1,0x310a,0xf20a,
+0x310a,0xf20a,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0,
+0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,
+0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0,0xb1,0xb1,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,0xb1,0xb1,0,0,0,0,0xb1,0xb1,
+0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0,0xb1,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,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,0,0,0xb1,0xb1,0xb1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,
-0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,
+0xa,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,0,0,
-9,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,0x310a,0xf20a,0,0,0,
+9,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,0x310a,0xf20a,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0xb1,0,
-0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,
-0,0,0,4,0,0xb1,0,0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
-0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
-0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xb1,0x40,0,0,0,0,0,
+0,0,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0xb1,0,
+0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,
+0,0,0,4,0,0xb1,0,0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
+0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
+0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xb1,0x40,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x4a,0xa,0xa,0x2a,0xb1,0xb1,0xb1,0x12,0,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x4a,0xa,0xa,0x2a,0xb1,0xb1,0xb1,0x12,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
-0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0,0,0,0,0,0,0,
-0,0xb1,0xb1,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
-0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xb1,0xb1,0xb1,0,
-0,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0xb1,0,
-0,0,0,0,0,0xb1,0xb1,0xb1,0,0,0,0,0xa,0,0,0,
-0xa,0xa,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,0,
-0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0,0,0,0,0,0,0,
+0,0xb1,0xb1,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
+0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xb1,0xb1,0xb1,0,
+0,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0xb1,0,
+0,0,0,0,0,0xb1,0xb1,0xb1,0,0,0,0,0xa,0,0,0,
+0xa,0xa,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,0,
+0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0xb1,
+0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0xb1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,
-0xb1,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,
-0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,
+0,0,0,0,0,0,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,
+0xb1,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,
+0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0xb1,0xb1,0xb1,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0xb1,0,0xb1,0xb1,0,0,0,0xb1,0,0xb1,0xb1,0xb1,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0,0,0,0,0xb1,0,0,0,0,0,0,0xb1,0,0,0,
-0xb1,0xb1,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,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,0xa,0,0xa,0xa,0xa,0,0,0,0,0,0,
-0,0,0,0,0,0xa,0xa,0xa,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0xa,0xa,0xa,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0xa,0xa,0,0xa,0xa,0xa,0xa,6,0x310a,0xf20a,0xa,
+0,0,0,0,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0xb1,0xb1,0xb1,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0xb1,0,0xb1,0xb1,0,0,0,0xb1,0,0xb1,0xb1,0xb1,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0,0,0,0,0xb1,0,0,0,0,0,0,0xb1,0,0,0,
+0xb1,0xb1,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,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,0xa,0,0xa,0xa,0xa,0,0,0,0,0,0,
+0,0,0,0,0,0xa,0xa,0xa,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0xa,0xa,0xa,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0xa,0xa,0,0xa,0xa,0xa,0xa,6,0x310a,0xf20a,0xa,
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,9,0xb2,0xb2,0xb2,0xb2,0xb2,0x12,0x814,0x815,
-0x813,0x816,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,2,0,0,0,2,2,2,2,
-2,2,3,3,0xa,0x310a,0xf20a,0,9,9,9,9,9,9,9,9,
-9,9,9,0xb2,0x412,0x432,0x8a0,0x8a1,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,9,7,0x8ab,0x8ae,0x8b0,0x8ac,0x8af,6,
-4,4,4,4,4,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,
-2,2,2,2,2,2,2,2,2,2,3,3,0xa,0x310a,0xf20a,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,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xa,0xa,0,0xa,0xa,0xa,0xa,0,0xa,0xa,0,0,0,0,0,0,
-0,0,0,0,0xa,0,0xa,0xa,0xa,0,0,0,0,0,0xa,0xa,
-0xa,0xa,0xa,0xa,0,0xa,0,0xa,0,0xa,0,0,0,0,4,0,
-0,0,0,0,0,0,0,0,0,0,0xa,0xa,0,0,0,0,
-0x100a,0xa,0xa,0xa,0xa,0,0,0,0,0,0xa,0xa,0xa,0xa,0,0,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,9,0xb2,0xb2,0xb2,0xb2,0xb2,0x12,0x814,0x815,
+0x813,0x816,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,2,0,0,0,2,2,2,2,
+2,2,3,3,0xa,0x310a,0xf20a,0,9,9,9,9,9,9,9,9,
+9,9,9,0xb2,0x412,0x432,0x8a0,0x8a1,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,9,7,0x8ab,0x8ae,0x8b0,0x8ac,0x8af,6,
+4,4,4,4,4,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,
+2,2,2,2,2,2,2,2,2,2,3,3,0xa,0x310a,0xf20a,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,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xa,0xa,0,0xa,0xa,0xa,0xa,0,0xa,0xa,0,0,0,0,0,0,
+0,0,0,0,0xa,0,0xa,0xa,0xa,0,0,0,0,0,0xa,0xa,
+0xa,0xa,0xa,0xa,0,0xa,0,0xa,0,0xa,0,0,0,0,4,0,
+0,0,0,0,0,0,0,0,0,0,0xa,0xa,0,0,0,0,
+0x100a,0xa,0xa,0xa,0xa,0,0,0,0,0,0xa,0xa,0xa,0xa,0,0,
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0,0,0,0,
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,
-0x300a,0xf00a,0x900a,0x900a,0x900a,0x100a,0x900a,0x900a,0x100a,0x100a,0x900a,0x900a,0x900a,0x900a,0x900a,0x100a,
-0xa,0x100a,0x100a,0x100a,0x100a,0xa,0xa,0xa,0x700a,0x700a,0x700a,0xb00a,0xb00a,0xb00a,0xa,0xa,
-0xa,0x100a,3,4,0xa,0x900a,0x100a,0xa,0xa,0xa,0x100a,0x100a,0x100a,0x100a,0xa,0x900a,
-0x900a,0x900a,0x900a,0xa,0x900a,0xa,0x100a,0xa,0xa,0xa,0xa,0x100a,0x100a,0x100a,0x100a,0x100a,
-0x100a,0x100a,0x100a,0x100a,0xa,0xa,0xa,0xa,0xa,0x100a,0xa,0x100a,0x300a,0xf00a,0x100a,0x100a,
-0x100a,0x100a,0x100a,0x900a,0x100a,0x900a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x900a,0xa,0xa,0xa,
-0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,
-0x100a,0xa,0x100a,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0x300a,0xf00a,
-0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,
-0x100a,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0x900a,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,0x900a,0x100a,0x900a,0x900a,0x100a,0x900a,
-0x100a,0x100a,0x100a,0x100a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x900a,0xa,0xa,0xa,
-0xa,0xa,0x100a,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a,
-0xf00a,0x900a,0xa,0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,
-0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,
+0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,
+0x300a,0xf00a,0x900a,0x900a,0x900a,0x100a,0x900a,0x900a,0x100a,0x100a,0x900a,0x900a,0x900a,0x900a,0x900a,0x100a,
+0xa,0x100a,0x100a,0x100a,0x100a,0xa,0xa,0xa,0x700a,0x700a,0x700a,0xb00a,0xb00a,0xb00a,0xa,0xa,
+0xa,0x100a,3,4,0xa,0x900a,0x100a,0xa,0xa,0xa,0x100a,0x100a,0x100a,0x100a,0xa,0x900a,
+0x900a,0x900a,0x900a,0xa,0x900a,0xa,0x100a,0xa,0xa,0xa,0xa,0x100a,0x100a,0x100a,0x100a,0x100a,
+0x100a,0x100a,0x100a,0x100a,0xa,0xa,0xa,0xa,0xa,0x100a,0xa,0x100a,0x300a,0xf00a,0x100a,0x100a,
+0x100a,0x100a,0x100a,0x900a,0x100a,0x900a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x900a,0xa,0xa,0xa,
+0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,
+0x100a,0xa,0x100a,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0x300a,0xf00a,
+0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,
+0x100a,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0x900a,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,0x900a,0x100a,0x900a,0x900a,0x100a,0x900a,
+0x100a,0x100a,0x100a,0x100a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x900a,0xa,0xa,0xa,
+0xa,0xa,0x100a,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a,
+0xf00a,0x900a,0xa,0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,
+0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0x100a,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,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,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0x100a,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,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,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,2,2,2,2,2,2,2,2,
+2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0xa,0xa,0x300a,0xf00a,0x310a,0xf20a,0xa,
+0x300a,0xf00a,0xa,0x500a,0x100a,0xd00a,0xa,0xa,0xa,0xa,0xa,0x100a,0x100a,0x300a,0xf00a,0xa,
+0xa,0xa,0xa,0xa,0x900a,0x300a,0xf00a,0xa,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x310a,0xf20a,
+0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0xa,0x100a,0x100a,0x100a,0xa,0xa,
+0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0x900a,0x100a,0x100a,
+0x300a,0xf00a,0xa,0xa,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,0x310a,
+0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x710a,0x320a,0xf10a,0xb20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,
+0xf20a,0xa,0xa,0x900a,0x100a,0x100a,0x100a,0x100a,0x900a,0xa,0x100a,0x900a,0x300a,0xf00a,0x100a,0x100a,
+0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0x900a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x100a,0x100a,0x300a,0xf00a,0xa,0xa,
+0xa,0x100a,0xa,0xa,0xa,0xa,0x100a,0x300a,0xf00a,0x300a,0xf00a,0xa,0x300a,0xf00a,0xa,0xa,
+0x310a,0xf20a,0x310a,0xf20a,0x100a,0xa,0xa,0xa,0xa,0xa,0x100a,0x900a,0x900a,0x900a,0x100a,0xa,
+0xa,0xa,0xa,0xa,0x300a,0xf00a,0x900a,0xa,0xa,0xa,0xa,0x100a,0xa,0xa,0xa,0x300a,
+0xf00a,0x300a,0xf00a,0x100a,0xa,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,
+0x100a,0x100a,0x100a,0x100a,0x100a,0xa,0x100a,0x100a,0x100a,0x100a,0xa,0xa,0x100a,0xa,0x100a,0xa,
+0xa,0x100a,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,
+0xa,0xa,0xa,0xa,0x300a,0xf00a,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,
+0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0x100a,0x100a,
+0x100a,0x100a,0xa,0x100a,0x100a,0xa,0xa,0x100a,0x100a,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a,
+0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,
+0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,
+0xf00a,0x300a,0xf00a,0x100a,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0x300a,
+0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,
+0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0x100a,0xa,0x900a,0xa,
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0xa,0xa,0x300a,0xf00a,0x310a,0xf20a,0xa,
-0x300a,0xf00a,0xa,0x500a,0x100a,0xd00a,0xa,0xa,0xa,0xa,0xa,0x100a,0x100a,0x300a,0xf00a,0xa,
-0xa,0xa,0xa,0xa,0x900a,0x300a,0xf00a,0xa,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x310a,0xf20a,
-0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0xa,0x100a,0x100a,0x100a,0xa,0xa,
-0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0x900a,0x100a,0x100a,
-0x300a,0xf00a,0xa,0xa,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,0x310a,
-0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x710a,0x320a,0xf10a,0xb20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,
-0xf20a,0xa,0xa,0x900a,0x100a,0x100a,0x100a,0x100a,0x900a,0xa,0x100a,0x900a,0x300a,0xf00a,0x100a,0x100a,
-0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0x900a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x100a,0x100a,0x300a,0xf00a,0xa,0xa,
-0xa,0x100a,0xa,0xa,0xa,0xa,0x100a,0x300a,0xf00a,0x300a,0xf00a,0xa,0x300a,0xf00a,0xa,0xa,
-0x310a,0xf20a,0x310a,0xf20a,0x100a,0xa,0xa,0xa,0xa,0xa,0x100a,0x900a,0x900a,0x900a,0x100a,0xa,
-0xa,0xa,0xa,0xa,0x300a,0xf00a,0x900a,0xa,0xa,0xa,0xa,0x100a,0xa,0xa,0xa,0x300a,
-0xf00a,0x300a,0xf00a,0x100a,0xa,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,
-0x100a,0x100a,0x100a,0x100a,0x100a,0xa,0x100a,0x100a,0x100a,0x100a,0xa,0xa,0x100a,0xa,0x100a,0xa,
-0xa,0x100a,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,
-0xa,0xa,0xa,0xa,0x300a,0xf00a,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,
-0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0x100a,0x100a,
-0x100a,0x100a,0xa,0x100a,0x100a,0xa,0xa,0x100a,0x100a,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a,
-0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,
-0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,
-0xf00a,0x300a,0xf00a,0x100a,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0x300a,
-0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,
-0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0x100a,0xa,0x900a,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x900a,0xa,
-0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0xb1,
-0xb1,0xb1,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-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,0,0,0xb1,
-0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0x300a,0xf00a,0xa,0x300a,0xf00a,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,
-0x300a,0xf00a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x900a,0xa,
+0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0xb1,
+0xb1,0xb1,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+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,0,0,0xb1,
+0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0x300a,0xf00a,0xa,0x300a,0xf00a,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,
+0x300a,0xf00a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -558,13 +558,13 @@ static const uint16_t ubidi_props_trieIndex[12536]={
0xa,0xa,0xa,0xa,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,0xb1,0xb1,0xa,
0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,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,
0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,
-0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,
+0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -573,25 +573,25 @@ static const uint16_t ubidi_props_trieIndex[12536]={
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0xb1,0,0,0,0xb1,0,0,0,0,0xb1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0xb1,0xb1,0,0xa,0xa,0xa,0xa,0xb1,0,0,0,
+0,0,0,0,0,0xb1,0xb1,0,0xa,0xa,0xa,0xa,0xb1,0,0,0,
0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
0x40,0x40,0x60,0,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,
-0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,
-0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,
-0,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,
-0,0,0,0xb1,0,0,0,0,0,0,0,0,0xb1,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0xb1,0,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0xb1,0xb1,
-0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,
-0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,
-0,0,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,
+0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,
+0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,
+0,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,
+0,0,0,0xb1,0,0,0,0,0,0,0,0,0xb1,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0xb1,0,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0xb1,0xb1,
+0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,
+0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,
+0,0,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0xb1,0,0,0xb1,0,0,0,
0,0xb1,0,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,3,1,1,
@@ -624,7 +624,7 @@ static const uint16_t ubidi_props_trieIndex[12536]={
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
0xa,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0,0,0,0xb1,2,2,2,2,2,2,2,2,2,2,2,
+0xa,0,0,0,0xb1,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,
@@ -642,34 +642,34 @@ static const uint16_t ubidi_props_trieIndex[12536]={
0x41,0x81,0x41,0x81,0x81,0x81,0x41,0x41,0x41,0x81,0x41,0x41,0x81,0x41,0x81,0x81,
0x41,0x81,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,0x81,0x81,0x81,0x81,0x41,0x41,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,0x4d,0x4d,0x8d,0x4d,0xb1,0xb1,0xb1,0xb1,
-0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,5,5,5,5,5,5,5,5,
-5,5,0xd,0xd,0xd,0xd,0xd,0xd,0x6d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,
-0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,
-0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,5,5,5,5,5,5,5,5,
+1,1,1,1,1,1,1,1,0x4d,0x4d,0x8d,0x4d,0xb1,0xb1,0xb1,0xb1,
+0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,5,5,5,5,5,5,5,5,
+5,5,0xd,0xd,0xd,0xd,0xd,0xd,0x6d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,
+0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,
+0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,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,1,1,1,1,1,1,1,1,1,
-1,1,1,0xb1,0xb1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0x4d,0x4d,
-0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0xd,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0x4d,0x4d,0x4d,0x8d,0xd,0xd,0xd,0xd,0xd,0xd,0xd,
-0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,0x41,1,0x41,0x41,
-0x81,0x81,0x81,1,0x41,0x81,0x81,0x41,0x41,0x81,0x41,0x41,1,0x41,0x81,0x81,
-0x41,1,1,1,1,0x81,0x41,0x61,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,
+5,5,5,5,5,5,5,1,1,1,1,1,1,1,1,1,
+1,1,1,0xb1,0xb1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0x4d,0x4d,
+0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0xd,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0x4d,0x4d,0x4d,0x8d,0xd,0xd,0xd,0xd,0xd,0xd,0xd,
+0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,0x41,1,0x41,0x41,
+0x81,0x81,0x81,1,0x41,0x81,0x81,0x41,0x41,0x81,0x41,0x41,1,0x41,0x81,0x81,
+0x41,1,1,1,1,0x81,0x41,0x61,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,
0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,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,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,
-0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,
-0,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0,0,0,0,0,0,0,0,
+0,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,
+0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,
+0,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0,0,
0xb1,0,0xb1,0xb1,0,0,0,0,0,0,0xb1,0,0,0,0,0xb1,
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,
@@ -677,7 +677,7 @@ static const uint16_t ubidi_props_trieIndex[12536]={
0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,
0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0,0xb1,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,
0xb1,0,0xb1,0,0,0,0,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -686,129 +686,129 @@ static const uint16_t ubidi_props_trieIndex[12536]={
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0,0,0xb1,0,0xb1,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0xb1,0,0xb1,0,0,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0,0,0,0,0,0,0,0,
-0,0,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,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,0xb1,0xb1,0,0xb1,0,
-0,0,0,0xb1,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,
-0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xa0,0xa0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,
-0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,
-0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,
-0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0,0xa0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0,0,0,0xb1,0,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,
-0,0xb1,0,0xb1,0,0,0,0,0,0,0,0,4,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,4,4,4,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,
-0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0,
-0xb1,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,0xb2,0xb2,0xb2,0xb2,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0xb1,0xb1,0xb1,0,0,0xb1,0,0xb1,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0xb1,0,0xb1,0,0,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0,0,0,0,0,0,0,0,
+0,0,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,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,0xb1,0xb1,0,0xb1,0,
+0,0,0,0xb1,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,
+0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xa0,0xa0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,
+0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,
+0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,
+0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0,0xa0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0,0,0,0xb1,0,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,
+0,0xb1,0,0xb1,0,0,0,0,0,0,0,0,4,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,4,4,4,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,
+0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0,
+0xb1,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,0xb2,0xb2,0xb2,0xb2,
+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,0,0,0xb1,
-0xb1,0xb1,0,0,0,0,0,0,0,0,0,0xb2,0xb2,0xb2,0xb2,0xb2,
-0xb2,0xb2,0xb2,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,
+0xb1,0xb1,0,0,0,0,0,0,0,0,0,0xb2,0xb2,0xb2,0xb2,0xb2,
+0xb2,0xb2,0xb2,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,
0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0xa,0xa,0xb1,0xb1,0xb1,0xa,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,0x100a,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0x100a,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,0x100a,0,0,0,0,0,0,0,0,0,0,2,2,
-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,
-0,0xb1,0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,
-0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0xb1,0xb1,
-0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,4,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,1,1,1,1,1,1,1,1,1,0x41,0x41,0x41,0x41,
+0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0xa,0xa,0xb1,0xb1,0xb1,0xa,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,0x100a,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0x100a,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,0x100a,0,0,0,0,0,0,0,0,0,0,2,2,
+2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,
+0,0xb1,0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,
+0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0xb1,0xb1,
+0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,4,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,1,1,1,1,1,1,1,1,1,0x41,0x41,0x41,0x41,
0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,
-0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xa1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,
-0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xa,0xa,0xd,0xd,0xd,0xd,0xd,0xd,
-0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,2,2,2,2,
-2,2,2,2,2,2,2,0xa,0xa,0xa,0xa,0xa,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,
-0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0xa,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xa1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,
+0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xa,0xa,0xd,0xd,0xd,0xd,0xd,0xd,
+0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,2,2,2,2,
+2,2,2,2,2,2,2,0xa,0xa,0xa,0xa,0xa,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,
+0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0xa,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0,0,
+0xa,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,0xa,0xa,0,0,0,
-0xa,0xa,0xa,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,
-0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,
-0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
-0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,2,2,2,2,2,2,2,2,2,2,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,0,0,0,0x12,0x12,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,0xa,0xa,0,0,0,
+0xa,0xa,0xa,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,
+0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,
+0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
+0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,2,2,2,2,2,2,2,2,2,2,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,0,0,0,0x12,0x12,
0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,
-0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,
-0x12,0xb2,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
+0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,
+0x12,0xb2,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
-0x12,0x12,0x12,0x12,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
-0x12,0x12,0x12,0x12,0,0,0,0
+0x12,0x12,0x12,0x12,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
+0x12,0x12,0x12,0x12,0,0,0,0
};
-static const uint32_t ubidi_props_mirrors[40]={
-0x2000ab,0xbb,0x4202215,0x4e0221f,0x3e02220,0x3a02221,0x3c02222,0x4c02224,0x2202243,0x1402245,0x120224c,0x4002298,0x44022a6,0x48022a8,0x46022a9,0x4a022ab,
-0x38022b8,0x10022cd,0x2e022f2,0x30022f3,0x32022f4,0x34022f6,0x36022f7,0x24022fa,0x26022fb,0x28022fc,0x2a022fd,0x2c022fe,0x20027dc,0xa0299b,0xc029a0,0x8029a3,
-0x16029b8,0x4029f5,0x1802ade,0x1c02ae3,0x1a02ae4,0x1e02ae5,0xe02aee,0x602bfe
+static const uint32_t ubidi_props_mirrors[40]={
+0x2000ab,0xbb,0x4202215,0x4e0221f,0x3e02220,0x3a02221,0x3c02222,0x4c02224,0x2202243,0x1402245,0x120224c,0x4002298,0x44022a6,0x48022a8,0x46022a9,0x4a022ab,
+0x38022b8,0x10022cd,0x2e022f2,0x30022f3,0x32022f4,0x34022f6,0x36022f7,0x24022fa,0x26022fb,0x28022fc,0x2a022fd,0x2c022fe,0x20027dc,0xa0299b,0xc029a0,0x8029a3,
+0x16029b8,0x4029f5,0x1802ade,0x1c02ae3,0x1a02ae4,0x1e02ae5,0xe02aee,0x602bfe
};
-static const uint8_t ubidi_props_jgArray[680]={
+static const uint8_t ubidi_props_jgArray[680]={
0x2d,0,3,3,0x2c,3,0x2d,3,4,0x2a,4,4,0xd,0xd,0xd,6,
6,0x1f,0x1f,0x23,0x23,0x21,0x21,0x28,0x28,1,1,0xb,0xb,0x37,0x37,0x37,
0,9,0x1d,0x13,0x16,0x18,0x1a,0x10,0x2c,0x2d,0x2d,0,0,0,0,0,
@@ -845,55 +845,55 @@ static const uint8_t ubidi_props_jgArray[680]={
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,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x5d,0x5a,0x60,0x63,0x5e,0x5f,0x59,0x61,0x5b,0x5c,0x62,0,0,0,0,0,
+0x5d,0x5a,0x60,0x63,0x5e,0x5f,0x59,0x61,0x5b,0x5c,0x62,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,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,0xd,0x28,9,0x1d,0x16,0x18,0x2d,0x2d,0x1f,0x2c,0x39,0,6,0x21,
-0xb,0x55,0x1f,1,0x13,0,4,4,4,0x1f,0x2d,0x56,0x58,0x57,4,4,
-4,0xd,0xb,1,0x58,0xd,0xd,0x16
+0xb,0x55,0x1f,1,0x13,0,4,4,4,0x1f,0x2d,0x56,0x58,0x57,4,4,
+4,0xd,0xb,1,0x58,0xd,0xd,0x16
};
-static const uint8_t ubidi_props_jgArray2[612]={
+static const uint8_t ubidi_props_jgArray2[612]={
0x3a,0x3c,0x3c,0x40,0x40,0x3d,0,0x52,0,0x54,0x54,0,0,0x41,0x4f,0x53,
0x43,0x43,0x43,0x44,0x3e,0x50,0x45,0x46,0x4c,0x3b,0x3b,0x48,0x48,0x4b,0x49,0x49,
-0x49,0x4a,0,0,0x4d,0,0,0,0,0,0,0x47,0x3f,0x4e,0x51,0x42,
-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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,
-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,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,0,0,0,0,0,0,
-0,0,0x65,0,0,0,0,0,0,0x65,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0x64,0,0,0x65,0,0x64,0,
-0x64,0,0,0x64
+0x49,0x4a,0,0,0x4d,0,0,0,0,0,0,0x47,0x3f,0x4e,0x51,0x42,
+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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,
+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,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,0,0,0,0,0,0,
+0,0,0x65,0,0,0,0,0,0,0x65,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0x64,0,0,0x65,0,0x64,0,
+0x64,0,0,0x64
};
static const UBiDiProps ubidi_props_singleton={
@@ -904,16 +904,16 @@ static const UBiDiProps ubidi_props_singleton={
ubidi_props_jgArray2,
{
ubidi_props_trieIndex,
- ubidi_props_trieIndex+3568,
+ ubidi_props_trieIndex+3568,
NULL,
- 3568,
- 8968,
+ 3568,
+ 8968,
0x1a0,
- 0xe70,
+ 0xe70,
0x0,
0x0,
0x110000,
- 0x30f4,
+ 0x30f4,
NULL, 0, FALSE, FALSE, 0, NULL
},
{ 2,2,0,0 }
diff --git a/contrib/libs/icu/common/ubidiimp.h b/contrib/libs/icu/common/ubidiimp.h
index e4469de9eb..9746b2bc10 100644
--- a/contrib/libs/icu/common/ubidiimp.h
+++ b/contrib/libs/icu/common/ubidiimp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: ubidiimp.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -198,8 +198,8 @@ typedef struct Run {
/* in a Run, logicalStart will get this bit set if the run level is odd */
#define INDEX_ODD_BIT (1UL<<31)
-#define MAKE_INDEX_ODD_PAIR(index, level) ((index)|((int32_t)((level)&1)<<31))
-#define ADD_ODD_BIT_FROM_LEVEL(x, level) ((x)|=((int32_t)((level)&1)<<31))
+#define MAKE_INDEX_ODD_PAIR(index, level) ((index)|((int32_t)((level)&1)<<31))
+#define ADD_ODD_BIT_FROM_LEVEL(x, level) ((x)|=((int32_t)((level)&1)<<31))
#define REMOVE_ODD_BIT(x) ((x)&=~INDEX_ODD_BIT)
#define GET_INDEX(x) ((x)&~INDEX_ODD_BIT)
@@ -387,49 +387,49 @@ typedef union {
} BidiMemoryForAllocation;
/* Macros for initial checks at function entry */
-#define RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \
- if((pErrcode)==NULL || U_FAILURE(*pErrcode)) return retvalue; \
-} UPRV_BLOCK_MACRO_END
-#define RETURN_IF_NOT_VALID_PARA(bidi, errcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \
- if(!IS_VALID_PARA(bidi)) { \
- errcode=U_INVALID_STATE_ERROR; \
- return retvalue; \
- } \
-} UPRV_BLOCK_MACRO_END
-#define RETURN_IF_NOT_VALID_PARA_OR_LINE(bidi, errcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \
- if(!IS_VALID_PARA_OR_LINE(bidi)) { \
- errcode=U_INVALID_STATE_ERROR; \
- return retvalue; \
- } \
-} UPRV_BLOCK_MACRO_END
-#define RETURN_IF_BAD_RANGE(arg, start, limit, errcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \
- if((arg)<(start) || (arg)>=(limit)) { \
- (errcode)=U_ILLEGAL_ARGUMENT_ERROR; \
- return retvalue; \
- } \
-} UPRV_BLOCK_MACRO_END
-
-#define RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrcode) UPRV_BLOCK_MACRO_BEGIN { \
- if((pErrcode)==NULL || U_FAILURE(*pErrcode)) return; \
-} UPRV_BLOCK_MACRO_END
-#define RETURN_VOID_IF_NOT_VALID_PARA(bidi, errcode) UPRV_BLOCK_MACRO_BEGIN { \
- if(!IS_VALID_PARA(bidi)) { \
- errcode=U_INVALID_STATE_ERROR; \
- return; \
- } \
-} UPRV_BLOCK_MACRO_END
-#define RETURN_VOID_IF_NOT_VALID_PARA_OR_LINE(bidi, errcode) UPRV_BLOCK_MACRO_BEGIN { \
- if(!IS_VALID_PARA_OR_LINE(bidi)) { \
- errcode=U_INVALID_STATE_ERROR; \
- return; \
- } \
-} UPRV_BLOCK_MACRO_END
-#define RETURN_VOID_IF_BAD_RANGE(arg, start, limit, errcode) UPRV_BLOCK_MACRO_BEGIN { \
- if((arg)<(start) || (arg)>=(limit)) { \
- (errcode)=U_ILLEGAL_ARGUMENT_ERROR; \
- return; \
- } \
-} UPRV_BLOCK_MACRO_END
+#define RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \
+ if((pErrcode)==NULL || U_FAILURE(*pErrcode)) return retvalue; \
+} UPRV_BLOCK_MACRO_END
+#define RETURN_IF_NOT_VALID_PARA(bidi, errcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \
+ if(!IS_VALID_PARA(bidi)) { \
+ errcode=U_INVALID_STATE_ERROR; \
+ return retvalue; \
+ } \
+} UPRV_BLOCK_MACRO_END
+#define RETURN_IF_NOT_VALID_PARA_OR_LINE(bidi, errcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \
+ if(!IS_VALID_PARA_OR_LINE(bidi)) { \
+ errcode=U_INVALID_STATE_ERROR; \
+ return retvalue; \
+ } \
+} UPRV_BLOCK_MACRO_END
+#define RETURN_IF_BAD_RANGE(arg, start, limit, errcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \
+ if((arg)<(start) || (arg)>=(limit)) { \
+ (errcode)=U_ILLEGAL_ARGUMENT_ERROR; \
+ return retvalue; \
+ } \
+} UPRV_BLOCK_MACRO_END
+
+#define RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrcode) UPRV_BLOCK_MACRO_BEGIN { \
+ if((pErrcode)==NULL || U_FAILURE(*pErrcode)) return; \
+} UPRV_BLOCK_MACRO_END
+#define RETURN_VOID_IF_NOT_VALID_PARA(bidi, errcode) UPRV_BLOCK_MACRO_BEGIN { \
+ if(!IS_VALID_PARA(bidi)) { \
+ errcode=U_INVALID_STATE_ERROR; \
+ return; \
+ } \
+} UPRV_BLOCK_MACRO_END
+#define RETURN_VOID_IF_NOT_VALID_PARA_OR_LINE(bidi, errcode) UPRV_BLOCK_MACRO_BEGIN { \
+ if(!IS_VALID_PARA_OR_LINE(bidi)) { \
+ errcode=U_INVALID_STATE_ERROR; \
+ return; \
+ } \
+} UPRV_BLOCK_MACRO_END
+#define RETURN_VOID_IF_BAD_RANGE(arg, start, limit, errcode) UPRV_BLOCK_MACRO_BEGIN { \
+ if((arg)<(start) || (arg)>=(limit)) { \
+ (errcode)=U_ILLEGAL_ARGUMENT_ERROR; \
+ return; \
+ } \
+} UPRV_BLOCK_MACRO_END
/* helper function to (re)allocate memory if allowed */
U_CFUNC UBool
diff --git a/contrib/libs/icu/common/ubidiln.cpp b/contrib/libs/icu/common/ubidiln.cpp
index b9a6f4dd93..3545f4e111 100644
--- a/contrib/libs/icu/common/ubidiln.cpp
+++ b/contrib/libs/icu/common/ubidiln.cpp
@@ -1,1347 +1,1347 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 1999-2015, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-* file name: ubidiln.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 1999aug06
-* created by: Markus W. Scherer, updated by Matitiahu Allouche
-*/
-
-#include "cmemory.h"
-#include "unicode/utypes.h"
-#include "unicode/ustring.h"
-#include "unicode/uchar.h"
-#include "unicode/ubidi.h"
-#include "ubidiimp.h"
-#include "uassert.h"
-
-/*
- * General remarks about the functions in this file:
- *
- * These functions deal with the aspects of potentially mixed-directional
- * text in a single paragraph or in a line of a single paragraph
- * which has already been processed according to
- * the Unicode 6.3 BiDi algorithm as defined in
- * http://www.unicode.org/unicode/reports/tr9/ , version 28,
- * also described in The Unicode Standard, Version 6.3.0 .
- *
- * This means that there is a UBiDi object with a levels
- * and a dirProps array.
- * paraLevel and direction are also set.
- * Only if the length of the text is zero, then levels==dirProps==NULL.
- *
- * The overall directionality of the paragraph
- * or line is used to bypass the reordering steps if possible.
- * Even purely RTL text does not need reordering there because
- * the ubidi_getLogical/VisualIndex() functions can compute the
- * index on the fly in such a case.
- *
- * The implementation of the access to same-level-runs and of the reordering
- * do attempt to provide better performance and less memory usage compared to
- * a direct implementation of especially rule (L2) with an array of
- * one (32-bit) integer per text character.
- *
- * Here, the levels array is scanned as soon as necessary, and a vector of
- * same-level-runs is created. Reordering then is done on this vector.
- * For each run of text positions that were resolved to the same level,
- * only 8 bytes are stored: the first text position of the run and the visual
- * position behind the run after reordering.
- * One sign bit is used to hold the directionality of the run.
- * This is inefficient if there are many very short runs. If the average run
- * length is <2, then this uses more memory.
- *
- * In a further attempt to save memory, the levels array is never changed
- * after all the resolution rules (Xn, Wn, Nn, In).
- * Many functions have to consider the field trailingWSStart:
- * if it is less than length, then there is an implicit trailing run
- * at the paraLevel,
- * which is not reflected in the levels array.
- * This allows a line UBiDi object to use the same levels array as
- * its paragraph parent object.
- *
- * When a UBiDi object is created for a line of a paragraph, then the
- * paragraph's levels and dirProps arrays are reused by way of setting
- * a pointer into them, not by copying. This again saves memory and forbids to
- * change the now shared levels for (L1).
- */
-
-/* handle trailing WS (L1) -------------------------------------------------- */
-
-/*
- * setTrailingWSStart() sets the start index for a trailing
- * run of WS in the line. This is necessary because we do not modify
- * the paragraph's levels array that we just point into.
- * Using trailingWSStart is another form of performing (L1).
- *
- * To make subsequent operations easier, we also include the run
- * before the WS if it is at the paraLevel - we merge the two here.
- *
- * This function is called only from ubidi_setLine(), so pBiDi->paraLevel is
- * set correctly for the line even when contextual multiple paragraphs.
- */
-static void
-setTrailingWSStart(UBiDi *pBiDi) {
- /* pBiDi->direction!=UBIDI_MIXED */
-
- const DirProp *dirProps=pBiDi->dirProps;
- UBiDiLevel *levels=pBiDi->levels;
- int32_t start=pBiDi->length;
- UBiDiLevel paraLevel=pBiDi->paraLevel;
-
- /* If the line is terminated by a block separator, all preceding WS etc...
- are already set to paragraph level.
- Setting trailingWSStart to pBidi->length will avoid changing the
- level of B chars from 0 to paraLevel in ubidi_getLevels when
- orderParagraphsLTR==TRUE.
- */
- if(dirProps[start-1]==B) {
- pBiDi->trailingWSStart=start; /* currently == pBiDi->length */
- return;
- }
- /* go backwards across all WS, BN, explicit codes */
- while(start>0 && DIRPROP_FLAG(dirProps[start-1])&MASK_WS) {
- --start;
- }
-
- /* if the WS run can be merged with the previous run then do so here */
- while(start>0 && levels[start-1]==paraLevel) {
- --start;
- }
-
- pBiDi->trailingWSStart=start;
-}
-
-/* ubidi_setLine ------------------------------------------------------------ */
-
-U_CAPI void U_EXPORT2
-ubidi_setLine(const UBiDi *pParaBiDi,
- int32_t start, int32_t limit,
- UBiDi *pLineBiDi,
- UErrorCode *pErrorCode) {
- int32_t length;
-
- /* check the argument values */
- RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
- RETURN_VOID_IF_NOT_VALID_PARA(pParaBiDi, *pErrorCode);
- RETURN_VOID_IF_BAD_RANGE(start, 0, limit, *pErrorCode);
- RETURN_VOID_IF_BAD_RANGE(limit, 0, pParaBiDi->length+1, *pErrorCode);
- if(pLineBiDi==NULL) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- if(ubidi_getParagraph(pParaBiDi, start, NULL, NULL, NULL, pErrorCode) !=
- ubidi_getParagraph(pParaBiDi, limit-1, NULL, NULL, NULL, pErrorCode)) {
- /* the line crosses a paragraph boundary */
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- /* set the values in pLineBiDi from its pParaBiDi parent */
- pLineBiDi->pParaBiDi=NULL; /* mark unfinished setLine */
- pLineBiDi->text=pParaBiDi->text+start;
- length=pLineBiDi->length=limit-start;
- pLineBiDi->resultLength=pLineBiDi->originalLength=length;
- pLineBiDi->paraLevel=GET_PARALEVEL(pParaBiDi, start);
- pLineBiDi->paraCount=pParaBiDi->paraCount;
- pLineBiDi->runs=NULL;
- pLineBiDi->flags=0;
- pLineBiDi->reorderingMode=pParaBiDi->reorderingMode;
- pLineBiDi->reorderingOptions=pParaBiDi->reorderingOptions;
- pLineBiDi->controlCount=0;
- if(pParaBiDi->controlCount>0) {
- int32_t j;
- for(j=start; j<limit; j++) {
- if(IS_BIDI_CONTROL_CHAR(pParaBiDi->text[j])) {
- pLineBiDi->controlCount++;
- }
- }
- pLineBiDi->resultLength-=pLineBiDi->controlCount;
- }
-
- pLineBiDi->dirProps=pParaBiDi->dirProps+start;
- pLineBiDi->levels=pParaBiDi->levels+start;
- pLineBiDi->runCount=-1;
-
- if(pParaBiDi->direction!=UBIDI_MIXED) {
- /* the parent is already trivial */
- pLineBiDi->direction=pParaBiDi->direction;
-
- /*
- * The parent's levels are all either
- * implicitly or explicitly ==paraLevel;
- * do the same here.
- */
- if(pParaBiDi->trailingWSStart<=start) {
- pLineBiDi->trailingWSStart=0;
- } else if(pParaBiDi->trailingWSStart<limit) {
- pLineBiDi->trailingWSStart=pParaBiDi->trailingWSStart-start;
- } else {
- pLineBiDi->trailingWSStart=length;
- }
- } else {
- const UBiDiLevel *levels=pLineBiDi->levels;
- int32_t i, trailingWSStart;
- UBiDiLevel level;
-
- setTrailingWSStart(pLineBiDi);
- trailingWSStart=pLineBiDi->trailingWSStart;
-
- /* recalculate pLineBiDi->direction */
- if(trailingWSStart==0) {
- /* all levels are at paraLevel */
- pLineBiDi->direction=(UBiDiDirection)(pLineBiDi->paraLevel&1);
- } else {
- /* get the level of the first character */
- level=(UBiDiLevel)(levels[0]&1);
-
- /* if there is anything of a different level, then the line is mixed */
- if(trailingWSStart<length && (pLineBiDi->paraLevel&1)!=level) {
- /* the trailing WS is at paraLevel, which differs from levels[0] */
- pLineBiDi->direction=UBIDI_MIXED;
- } else {
- /* see if levels[1..trailingWSStart-1] have the same direction as levels[0] and paraLevel */
- i=1;
- for(;;) {
- if(i==trailingWSStart) {
- /* the direction values match those in level */
- pLineBiDi->direction=(UBiDiDirection)level;
- break;
- } else if((levels[i]&1)!=level) {
- pLineBiDi->direction=UBIDI_MIXED;
- break;
- }
- ++i;
- }
- }
- }
-
- switch(pLineBiDi->direction) {
- case UBIDI_LTR:
- /* make sure paraLevel is even */
- pLineBiDi->paraLevel=(UBiDiLevel)((pLineBiDi->paraLevel+1)&~1);
-
- /* all levels are implicitly at paraLevel (important for ubidi_getLevels()) */
- pLineBiDi->trailingWSStart=0;
- break;
- case UBIDI_RTL:
- /* make sure paraLevel is odd */
- pLineBiDi->paraLevel|=1;
-
- /* all levels are implicitly at paraLevel (important for ubidi_getLevels()) */
- pLineBiDi->trailingWSStart=0;
- break;
- default:
- break;
- }
- }
- pLineBiDi->pParaBiDi=pParaBiDi; /* mark successful setLine */
- return;
-}
-
-U_CAPI UBiDiLevel U_EXPORT2
-ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex) {
- /* return paraLevel if in the trailing WS run, otherwise the real level */
- if(!IS_VALID_PARA_OR_LINE(pBiDi) || charIndex<0 || pBiDi->length<=charIndex) {
- return 0;
- } else if(pBiDi->direction!=UBIDI_MIXED || charIndex>=pBiDi->trailingWSStart) {
- return GET_PARALEVEL(pBiDi, charIndex);
- } else {
- return pBiDi->levels[charIndex];
- }
-}
-
-U_CAPI const UBiDiLevel * U_EXPORT2
-ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) {
- int32_t start, length;
-
- RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, NULL);
- RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, NULL);
- if((length=pBiDi->length)<=0) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
- }
- if((start=pBiDi->trailingWSStart)==length) {
- /* the current levels array reflects the WS run */
- return pBiDi->levels;
- }
-
- /*
- * After the previous if(), we know that the levels array
- * has an implicit trailing WS run and therefore does not fully
- * reflect itself all the levels.
- * This must be a UBiDi object for a line, and
- * we need to create a new levels array.
- */
- if(getLevelsMemory(pBiDi, length)) {
- UBiDiLevel *levels=pBiDi->levelsMemory;
-
- if(start>0 && levels!=pBiDi->levels) {
- uprv_memcpy(levels, pBiDi->levels, start);
- }
- /* pBiDi->paraLevel is ok even if contextual multiple paragraphs,
- since pBidi is a line object */
- uprv_memset(levels+start, pBiDi->paraLevel, length-start);
-
- /* this new levels array is set for the line and reflects the WS run */
- pBiDi->trailingWSStart=length;
- return pBiDi->levels=levels;
- } else {
- /* out of memory */
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
-}
-
-U_CAPI void U_EXPORT2
-ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalPosition,
- int32_t *pLogicalLimit, UBiDiLevel *pLevel) {
- UErrorCode errorCode;
- int32_t runCount, visualStart, logicalLimit, logicalFirst, i;
- Run iRun;
-
- errorCode=U_ZERO_ERROR;
- RETURN_VOID_IF_BAD_RANGE(logicalPosition, 0, pBiDi->length, errorCode);
- /* ubidi_countRuns will check VALID_PARA_OR_LINE */
- runCount=ubidi_countRuns((UBiDi *)pBiDi, &errorCode);
- if(U_FAILURE(errorCode)) {
- return;
- }
- /* this is done based on runs rather than on levels since levels have
- a special interpretation when UBIDI_REORDER_RUNS_ONLY
- */
- visualStart=logicalLimit=0;
- iRun=pBiDi->runs[0];
-
- for(i=0; i<runCount; i++) {
- iRun = pBiDi->runs[i];
- logicalFirst=GET_INDEX(iRun.logicalStart);
- logicalLimit=logicalFirst+iRun.visualLimit-visualStart;
- if((logicalPosition>=logicalFirst) &&
- (logicalPosition<logicalLimit)) {
- break;
- }
- visualStart = iRun.visualLimit;
- }
- if(pLogicalLimit) {
- *pLogicalLimit=logicalLimit;
- }
- if(pLevel) {
- if(pBiDi->reorderingMode==UBIDI_REORDER_RUNS_ONLY) {
- *pLevel=(UBiDiLevel)GET_ODD_BIT(iRun.logicalStart);
- }
- else if(pBiDi->direction!=UBIDI_MIXED || logicalPosition>=pBiDi->trailingWSStart) {
- *pLevel=GET_PARALEVEL(pBiDi, logicalPosition);
- } else {
- *pLevel=pBiDi->levels[logicalPosition];
- }
- }
-}
-
-/* runs API functions ------------------------------------------------------- */
-
-U_CAPI int32_t U_EXPORT2
-ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode) {
- RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, -1);
- RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, -1);
- ubidi_getRuns(pBiDi, pErrorCode);
- if(U_FAILURE(*pErrorCode)) {
- return -1;
- }
- return pBiDi->runCount;
-}
-
-U_CAPI UBiDiDirection U_EXPORT2
-ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,
- int32_t *pLogicalStart, int32_t *pLength)
-{
- int32_t start;
- UErrorCode errorCode = U_ZERO_ERROR;
- RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, errorCode, UBIDI_LTR);
- ubidi_getRuns(pBiDi, &errorCode);
- if(U_FAILURE(errorCode)) {
- return UBIDI_LTR;
- }
- RETURN_IF_BAD_RANGE(runIndex, 0, pBiDi->runCount, errorCode, UBIDI_LTR);
-
- start=pBiDi->runs[runIndex].logicalStart;
- if(pLogicalStart!=NULL) {
- *pLogicalStart=GET_INDEX(start);
- }
- if(pLength!=NULL) {
- if(runIndex>0) {
- *pLength=pBiDi->runs[runIndex].visualLimit-
- pBiDi->runs[runIndex-1].visualLimit;
- } else {
- *pLength=pBiDi->runs[0].visualLimit;
- }
- }
- return (UBiDiDirection)GET_ODD_BIT(start);
-}
-
-/* in trivial cases there is only one trivial run; called by ubidi_getRuns() */
-static void
-getSingleRun(UBiDi *pBiDi, UBiDiLevel level) {
- /* simple, single-run case */
- pBiDi->runs=pBiDi->simpleRuns;
- pBiDi->runCount=1;
-
- /* fill and reorder the single run */
- pBiDi->runs[0].logicalStart=MAKE_INDEX_ODD_PAIR(0, level);
- pBiDi->runs[0].visualLimit=pBiDi->length;
- pBiDi->runs[0].insertRemove=0;
-}
-
-/* reorder the runs array (L2) ---------------------------------------------- */
-
-/*
- * Reorder the same-level runs in the runs array.
- * Here, runCount>1 and maxLevel>=minLevel>=paraLevel.
- * All the visualStart fields=logical start before reordering.
- * The "odd" bits are not set yet.
- *
- * Reordering with this data structure lends itself to some handy shortcuts:
- *
- * Since each run is moved but not modified, and since at the initial maxLevel
- * each sequence of same-level runs consists of only one run each, we
- * don't need to do anything there and can predecrement maxLevel.
- * In many simple cases, the reordering is thus done entirely in the
- * index mapping.
- * Also, reordering occurs only down to the lowest odd level that occurs,
- * which is minLevel|1. However, if the lowest level itself is odd, then
- * in the last reordering the sequence of the runs at this level or higher
- * will be all runs, and we don't need the elaborate loop to search for them.
- * This is covered by ++minLevel instead of minLevel|=1 followed
- * by an extra reorder-all after the reorder-some loop.
- * About a trailing WS run:
- * Such a run would need special treatment because its level is not
- * reflected in levels[] if this is not a paragraph object.
- * Instead, all characters from trailingWSStart on are implicitly at
- * paraLevel.
- * However, for all maxLevel>paraLevel, this run will never be reordered
- * and does not need to be taken into account. maxLevel==paraLevel is only reordered
- * if minLevel==paraLevel is odd, which is done in the extra segment.
- * This means that for the main reordering loop we don't need to consider
- * this run and can --runCount. If it is later part of the all-runs
- * reordering, then runCount is adjusted accordingly.
- */
-static void
-reorderLine(UBiDi *pBiDi, UBiDiLevel minLevel, UBiDiLevel maxLevel) {
- Run *runs, tempRun;
- UBiDiLevel *levels;
- int32_t firstRun, endRun, limitRun, runCount;
-
- /* nothing to do? */
- if(maxLevel<=(minLevel|1)) {
- return;
- }
-
- /*
- * Reorder only down to the lowest odd level
- * and reorder at an odd minLevel in a separate, simpler loop.
- * See comments above for why minLevel is always incremented.
- */
- ++minLevel;
-
- runs=pBiDi->runs;
- levels=pBiDi->levels;
- runCount=pBiDi->runCount;
-
- /* do not include the WS run at paraLevel<=old minLevel except in the simple loop */
- if(pBiDi->trailingWSStart<pBiDi->length) {
- --runCount;
- }
-
- while(--maxLevel>=minLevel) {
- firstRun=0;
-
- /* loop for all sequences of runs */
- for(;;) {
- /* look for a sequence of runs that are all at >=maxLevel */
- /* look for the first run of such a sequence */
- while(firstRun<runCount && levels[runs[firstRun].logicalStart]<maxLevel) {
- ++firstRun;
- }
- if(firstRun>=runCount) {
- break; /* no more such runs */
- }
-
- /* look for the limit run of such a sequence (the run behind it) */
- for(limitRun=firstRun; ++limitRun<runCount && levels[runs[limitRun].logicalStart]>=maxLevel;) {}
-
- /* Swap the entire sequence of runs from firstRun to limitRun-1. */
- endRun=limitRun-1;
- while(firstRun<endRun) {
- tempRun = runs[firstRun];
- runs[firstRun]=runs[endRun];
- runs[endRun]=tempRun;
- ++firstRun;
- --endRun;
- }
-
- if(limitRun==runCount) {
- break; /* no more such runs */
- } else {
- firstRun=limitRun+1;
- }
- }
- }
-
- /* now do maxLevel==old minLevel (==odd!), see above */
- if(!(minLevel&1)) {
- firstRun=0;
-
- /* include the trailing WS run in this complete reordering */
- if(pBiDi->trailingWSStart==pBiDi->length) {
- --runCount;
- }
-
- /* Swap the entire sequence of all runs. (endRun==runCount) */
- while(firstRun<runCount) {
- tempRun=runs[firstRun];
- runs[firstRun]=runs[runCount];
- runs[runCount]=tempRun;
- ++firstRun;
- --runCount;
- }
- }
-}
-
-/* compute the runs array --------------------------------------------------- */
-
-static int32_t getRunFromLogicalIndex(UBiDi *pBiDi, int32_t logicalIndex) {
- Run *runs=pBiDi->runs;
- int32_t runCount=pBiDi->runCount, visualStart=0, i, length, logicalStart;
-
- for(i=0; i<runCount; i++) {
- length=runs[i].visualLimit-visualStart;
- logicalStart=GET_INDEX(runs[i].logicalStart);
- if((logicalIndex>=logicalStart) && (logicalIndex<(logicalStart+length))) {
- return i;
- }
- visualStart+=length;
- }
- /* we should never get here */
- UPRV_UNREACHABLE;
-}
-
-/*
- * Compute the runs array from the levels array.
- * After ubidi_getRuns() returns TRUE, runCount is guaranteed to be >0
- * and the runs are reordered.
- * Odd-level runs have visualStart on their visual right edge and
- * they progress visually to the left.
- * If option UBIDI_OPTION_INSERT_MARKS is set, insertRemove will contain the
- * sum of appropriate LRM/RLM_BEFORE/AFTER flags.
- * If option UBIDI_OPTION_REMOVE_CONTROLS is set, insertRemove will contain the
- * negative number of BiDi control characters within this run.
- */
-U_CFUNC UBool
-ubidi_getRuns(UBiDi *pBiDi, UErrorCode*) {
- /*
- * This method returns immediately if the runs are already set. This
- * includes the case of length==0 (handled in setPara)..
- */
- if (pBiDi->runCount>=0) {
- return TRUE;
- }
-
- if(pBiDi->direction!=UBIDI_MIXED) {
- /* simple, single-run case - this covers length==0 */
- /* pBiDi->paraLevel is ok even for contextual multiple paragraphs */
- getSingleRun(pBiDi, pBiDi->paraLevel);
- } else /* UBIDI_MIXED, length>0 */ {
- /* mixed directionality */
- int32_t length=pBiDi->length, limit;
- UBiDiLevel *levels=pBiDi->levels;
- int32_t i, runCount;
- UBiDiLevel level=UBIDI_DEFAULT_LTR; /* initialize with no valid level */
- /*
- * If there are WS characters at the end of the line
- * and the run preceding them has a level different from
- * paraLevel, then they will form their own run at paraLevel (L1).
- * Count them separately.
- * We need some special treatment for this in order to not
- * modify the levels array which a line UBiDi object shares
- * with its paragraph parent and its other line siblings.
- * In other words, for the trailing WS, it may be
- * levels[]!=paraLevel but we have to treat it like it were so.
- */
- limit=pBiDi->trailingWSStart;
- /* count the runs, there is at least one non-WS run, and limit>0 */
- runCount=0;
- for(i=0; i<limit; ++i) {
- /* increment runCount at the start of each run */
- if(levels[i]!=level) {
- ++runCount;
- level=levels[i];
- }
- }
-
- /*
- * We don't need to see if the last run can be merged with a trailing
- * WS run because setTrailingWSStart() would have done that.
- */
- if(runCount==1 && limit==length) {
- /* There is only one non-WS run and no trailing WS-run. */
- getSingleRun(pBiDi, levels[0]);
- } else /* runCount>1 || limit<length */ {
- /* allocate and set the runs */
- Run *runs;
- int32_t runIndex, start;
- UBiDiLevel minLevel=UBIDI_MAX_EXPLICIT_LEVEL+1, maxLevel=0;
-
- /* now, count a (non-mergeable) WS run */
- if(limit<length) {
- ++runCount;
- }
-
- /* runCount>1 */
- if(getRunsMemory(pBiDi, runCount)) {
- runs=pBiDi->runsMemory;
- } else {
- return FALSE;
- }
-
- /* set the runs */
- /* FOOD FOR THOUGHT: this could be optimized, e.g.:
- * 464->444, 484->444, 575->555, 595->555
- * However, that would take longer. Check also how it would
- * interact with BiDi control removal and inserting Marks.
- */
- runIndex=0;
-
- /* search for the run limits and initialize visualLimit values with the run lengths */
- i=0;
- do {
- /* prepare this run */
- start=i;
- level=levels[i];
- if(level<minLevel) {
- minLevel=level;
- }
- if(level>maxLevel) {
- maxLevel=level;
- }
-
- /* look for the run limit */
- while(++i<limit && levels[i]==level) {}
-
- /* i is another run limit */
- runs[runIndex].logicalStart=start;
- runs[runIndex].visualLimit=i-start;
- runs[runIndex].insertRemove=0;
- ++runIndex;
- } while(i<limit);
-
- if(limit<length) {
- /* there is a separate WS run */
- runs[runIndex].logicalStart=limit;
- runs[runIndex].visualLimit=length-limit;
- /* For the trailing WS run, pBiDi->paraLevel is ok even
- if contextual multiple paragraphs. */
- if(pBiDi->paraLevel<minLevel) {
- minLevel=pBiDi->paraLevel;
- }
- }
-
- /* set the object fields */
- pBiDi->runs=runs;
- pBiDi->runCount=runCount;
-
- reorderLine(pBiDi, minLevel, maxLevel);
-
- /* now add the direction flags and adjust the visualLimit's to be just that */
- /* this loop will also handle the trailing WS run */
- limit=0;
- for(i=0; i<runCount; ++i) {
- ADD_ODD_BIT_FROM_LEVEL(runs[i].logicalStart, levels[runs[i].logicalStart]);
- limit+=runs[i].visualLimit;
- runs[i].visualLimit=limit;
- }
-
- /* Set the "odd" bit for the trailing WS run. */
- /* For a RTL paragraph, it will be the *first* run in visual order. */
- /* For the trailing WS run, pBiDi->paraLevel is ok even if
- contextual multiple paragraphs. */
- if(runIndex<runCount) {
- int32_t trailingRun = ((pBiDi->paraLevel & 1) != 0)? 0 : runIndex;
-
- ADD_ODD_BIT_FROM_LEVEL(runs[trailingRun].logicalStart, pBiDi->paraLevel);
- }
- }
- }
-
- /* handle insert LRM/RLM BEFORE/AFTER run */
- if(pBiDi->insertPoints.size>0) {
- Point *point, *start=pBiDi->insertPoints.points,
- *limit=start+pBiDi->insertPoints.size;
- int32_t runIndex;
- for(point=start; point<limit; point++) {
- runIndex=getRunFromLogicalIndex(pBiDi, point->pos);
- pBiDi->runs[runIndex].insertRemove|=point->flag;
- }
- }
-
- /* handle remove BiDi control characters */
- if(pBiDi->controlCount>0) {
- int32_t runIndex;
- const UChar *start=pBiDi->text, *limit=start+pBiDi->length, *pu;
- for(pu=start; pu<limit; pu++) {
- if(IS_BIDI_CONTROL_CHAR(*pu)) {
- runIndex=getRunFromLogicalIndex(pBiDi, (int32_t)(pu-start));
- pBiDi->runs[runIndex].insertRemove--;
- }
- }
- }
-
- return TRUE;
-}
-
-static UBool
-prepareReorder(const UBiDiLevel *levels, int32_t length,
- int32_t *indexMap,
- UBiDiLevel *pMinLevel, UBiDiLevel *pMaxLevel) {
- int32_t start;
- UBiDiLevel level, minLevel, maxLevel;
-
- if(levels==NULL || length<=0) {
- return FALSE;
- }
-
- /* determine minLevel and maxLevel */
- minLevel=UBIDI_MAX_EXPLICIT_LEVEL+1;
- maxLevel=0;
- for(start=length; start>0;) {
- level=levels[--start];
- if(level>UBIDI_MAX_EXPLICIT_LEVEL+1) {
- return FALSE;
- }
- if(level<minLevel) {
- minLevel=level;
- }
- if(level>maxLevel) {
- maxLevel=level;
- }
- }
- *pMinLevel=minLevel;
- *pMaxLevel=maxLevel;
-
- /* initialize the index map */
- for(start=length; start>0;) {
- --start;
- indexMap[start]=start;
- }
-
- return TRUE;
-}
-
-/* reorder a line based on a levels array (L2) ------------------------------ */
-
-U_CAPI void U_EXPORT2
-ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap) {
- int32_t start, limit, sumOfSosEos;
- UBiDiLevel minLevel = 0, maxLevel = 0;
-
- if(indexMap==NULL || !prepareReorder(levels, length, indexMap, &minLevel, &maxLevel)) {
- return;
- }
-
- /* nothing to do? */
- if(minLevel==maxLevel && (minLevel&1)==0) {
- return;
- }
-
- /* reorder only down to the lowest odd level */
- minLevel|=1;
-
- /* loop maxLevel..minLevel */
- do {
- start=0;
-
- /* loop for all sequences of levels to reorder at the current maxLevel */
- for(;;) {
- /* look for a sequence of levels that are all at >=maxLevel */
- /* look for the first index of such a sequence */
- while(start<length && levels[start]<maxLevel) {
- ++start;
- }
- if(start>=length) {
- break; /* no more such sequences */
- }
-
- /* look for the limit of such a sequence (the index behind it) */
- for(limit=start; ++limit<length && levels[limit]>=maxLevel;) {}
-
- /*
- * sos=start of sequence, eos=end of sequence
- *
- * The closed (inclusive) interval from sos to eos includes all the logical
- * and visual indexes within this sequence. They are logically and
- * visually contiguous and in the same range.
- *
- * For each run, the new visual index=sos+eos-old visual index;
- * we pre-add sos+eos into sumOfSosEos ->
- * new visual index=sumOfSosEos-old visual index;
- */
- sumOfSosEos=start+limit-1;
-
- /* reorder each index in the sequence */
- do {
- indexMap[start]=sumOfSosEos-indexMap[start];
- } while(++start<limit);
-
- /* start==limit */
- if(limit==length) {
- break; /* no more such sequences */
- } else {
- start=limit+1;
- }
- }
- } while(--maxLevel>=minLevel);
-}
-
-U_CAPI void U_EXPORT2
-ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap) {
- int32_t start, end, limit, temp;
- UBiDiLevel minLevel = 0, maxLevel = 0;
-
- if(indexMap==NULL || !prepareReorder(levels, length, indexMap, &minLevel, &maxLevel)) {
- return;
- }
-
- /* nothing to do? */
- if(minLevel==maxLevel && (minLevel&1)==0) {
- return;
- }
-
- /* reorder only down to the lowest odd level */
- minLevel|=1;
-
- /* loop maxLevel..minLevel */
- do {
- start=0;
-
- /* loop for all sequences of levels to reorder at the current maxLevel */
- for(;;) {
- /* look for a sequence of levels that are all at >=maxLevel */
- /* look for the first index of such a sequence */
- while(start<length && levels[start]<maxLevel) {
- ++start;
- }
- if(start>=length) {
- break; /* no more such runs */
- }
-
- /* look for the limit of such a sequence (the index behind it) */
- for(limit=start; ++limit<length && levels[limit]>=maxLevel;) {}
-
- /*
- * Swap the entire interval of indexes from start to limit-1.
- * We don't need to swap the levels for the purpose of this
- * algorithm: the sequence of levels that we look at does not
- * move anyway.
- */
- end=limit-1;
- while(start<end) {
- temp=indexMap[start];
- indexMap[start]=indexMap[end];
- indexMap[end]=temp;
-
- ++start;
- --end;
- }
-
- if(limit==length) {
- break; /* no more such sequences */
- } else {
- start=limit+1;
- }
- }
- } while(--maxLevel>=minLevel);
-}
-
-/* API functions for logical<->visual mapping ------------------------------- */
-
-U_CAPI int32_t U_EXPORT2
-ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode) {
- int32_t visualIndex=UBIDI_MAP_NOWHERE;
- RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, -1);
- RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, -1);
- RETURN_IF_BAD_RANGE(logicalIndex, 0, pBiDi->length, *pErrorCode, -1);
-
- /* we can do the trivial cases without the runs array */
- switch(pBiDi->direction) {
- case UBIDI_LTR:
- visualIndex=logicalIndex;
- break;
- case UBIDI_RTL:
- visualIndex=pBiDi->length-logicalIndex-1;
- break;
- default:
- if(!ubidi_getRuns(pBiDi, pErrorCode)) {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return -1;
- } else {
- Run *runs=pBiDi->runs;
- int32_t i, visualStart=0, offset, length;
-
- /* linear search for the run, search on the visual runs */
- for(i=0; i<pBiDi->runCount; ++i) {
- length=runs[i].visualLimit-visualStart;
- offset=logicalIndex-GET_INDEX(runs[i].logicalStart);
- if(offset>=0 && offset<length) {
- if(IS_EVEN_RUN(runs[i].logicalStart)) {
- /* LTR */
- visualIndex=visualStart+offset;
- } else {
- /* RTL */
- visualIndex=visualStart+length-offset-1;
- }
- break; /* exit for loop */
- }
- visualStart+=length;
- }
- if(i>=pBiDi->runCount) {
- return UBIDI_MAP_NOWHERE;
- }
- }
- }
-
- if(pBiDi->insertPoints.size>0) {
- /* add the number of added marks until the calculated visual index */
- Run *runs=pBiDi->runs;
- int32_t i, length, insertRemove;
- int32_t visualStart=0, markFound=0;
- for(i=0; ; i++, visualStart+=length) {
- length=runs[i].visualLimit-visualStart;
- insertRemove=runs[i].insertRemove;
- if(insertRemove & (LRM_BEFORE|RLM_BEFORE)) {
- markFound++;
- }
- /* is it the run containing the visual index? */
- if(visualIndex<runs[i].visualLimit) {
- return visualIndex+markFound;
- }
- if(insertRemove & (LRM_AFTER|RLM_AFTER)) {
- markFound++;
- }
- }
- }
- else if(pBiDi->controlCount>0) {
- /* subtract the number of controls until the calculated visual index */
- Run *runs=pBiDi->runs;
- int32_t i, j, start, limit, length, insertRemove;
- int32_t visualStart=0, controlFound=0;
- UChar uchar=pBiDi->text[logicalIndex];
- /* is the logical index pointing to a control ? */
- if(IS_BIDI_CONTROL_CHAR(uchar)) {
- return UBIDI_MAP_NOWHERE;
- }
- /* loop on runs */
- for(i=0; ; i++, visualStart+=length) {
- length=runs[i].visualLimit-visualStart;
- insertRemove=runs[i].insertRemove;
- /* calculated visual index is beyond this run? */
- if(visualIndex>=runs[i].visualLimit) {
- controlFound-=insertRemove;
- continue;
- }
- /* calculated visual index must be within current run */
- if(insertRemove==0) {
- return visualIndex-controlFound;
- }
- if(IS_EVEN_RUN(runs[i].logicalStart)) {
- /* LTR: check from run start to logical index */
- start=runs[i].logicalStart;
- limit=logicalIndex;
- } else {
- /* RTL: check from logical index to run end */
- start=logicalIndex+1;
- limit=GET_INDEX(runs[i].logicalStart)+length;
- }
- for(j=start; j<limit; j++) {
- uchar=pBiDi->text[j];
- if(IS_BIDI_CONTROL_CHAR(uchar)) {
- controlFound++;
- }
- }
- return visualIndex-controlFound;
- }
- }
-
- return visualIndex;
-}
-
-U_CAPI int32_t U_EXPORT2
-ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode) {
- Run *runs;
- int32_t i, runCount, start;
- RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, -1);
- RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, -1);
- RETURN_IF_BAD_RANGE(visualIndex, 0, pBiDi->resultLength, *pErrorCode, -1);
- /* we can do the trivial cases without the runs array */
- if(pBiDi->insertPoints.size==0 && pBiDi->controlCount==0) {
- if(pBiDi->direction==UBIDI_LTR) {
- return visualIndex;
- }
- else if(pBiDi->direction==UBIDI_RTL) {
- return pBiDi->length-visualIndex-1;
- }
- }
- if(!ubidi_getRuns(pBiDi, pErrorCode)) {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return -1;
- }
-
- runs=pBiDi->runs;
- runCount=pBiDi->runCount;
- if(pBiDi->insertPoints.size>0) {
- /* handle inserted LRM/RLM */
- int32_t markFound=0, insertRemove;
- int32_t visualStart=0, length;
- runs=pBiDi->runs;
- /* subtract number of marks until visual index */
- for(i=0; ; i++, visualStart+=length) {
- length=runs[i].visualLimit-visualStart;
- insertRemove=runs[i].insertRemove;
- if(insertRemove&(LRM_BEFORE|RLM_BEFORE)) {
- if(visualIndex<=(visualStart+markFound)) {
- return UBIDI_MAP_NOWHERE;
- }
- markFound++;
- }
- /* is adjusted visual index within this run? */
- if(visualIndex<(runs[i].visualLimit+markFound)) {
- visualIndex-=markFound;
- break;
- }
- if(insertRemove&(LRM_AFTER|RLM_AFTER)) {
- if(visualIndex==(visualStart+length+markFound)) {
- return UBIDI_MAP_NOWHERE;
- }
- markFound++;
- }
- }
- }
- else if(pBiDi->controlCount>0) {
- /* handle removed BiDi control characters */
- int32_t controlFound=0, insertRemove, length;
- int32_t logicalStart, logicalEnd, visualStart=0, j, k;
- UChar uchar;
- UBool evenRun;
- /* add number of controls until visual index */
- for(i=0; ; i++, visualStart+=length) {
- length=runs[i].visualLimit-visualStart;
- insertRemove=runs[i].insertRemove;
- /* is adjusted visual index beyond current run? */
- if(visualIndex>=(runs[i].visualLimit-controlFound+insertRemove)) {
- controlFound-=insertRemove;
- continue;
- }
- /* adjusted visual index is within current run */
- if(insertRemove==0) {
- visualIndex+=controlFound;
- break;
- }
- /* count non-control chars until visualIndex */
- logicalStart=runs[i].logicalStart;
- evenRun=IS_EVEN_RUN(logicalStart);
- REMOVE_ODD_BIT(logicalStart);
- logicalEnd=logicalStart+length-1;
- for(j=0; j<length; j++) {
- k= evenRun ? logicalStart+j : logicalEnd-j;
- uchar=pBiDi->text[k];
- if(IS_BIDI_CONTROL_CHAR(uchar)) {
- controlFound++;
- }
- if((visualIndex+controlFound)==(visualStart+j)) {
- break;
- }
- }
- visualIndex+=controlFound;
- break;
- }
- }
- /* handle all cases */
- if(runCount<=10) {
- /* linear search for the run */
- for(i=0; visualIndex>=runs[i].visualLimit; ++i) {}
- } else {
- /* binary search for the run */
- int32_t begin=0, limit=runCount;
-
- /* the middle if() is guaranteed to find the run, we don't need a loop limit */
- for(;;) {
- i=(begin+limit)/2;
- if(visualIndex>=runs[i].visualLimit) {
- begin=i+1;
- } else if(i==0 || visualIndex>=runs[i-1].visualLimit) {
- break;
- } else {
- limit=i;
- }
- }
- }
-
- start=runs[i].logicalStart;
- if(IS_EVEN_RUN(start)) {
- /* LTR */
- /* the offset in runs[i] is visualIndex-runs[i-1].visualLimit */
- if(i>0) {
- visualIndex-=runs[i-1].visualLimit;
- }
- return start+visualIndex;
- } else {
- /* RTL */
- return GET_INDEX(start)+runs[i].visualLimit-visualIndex-1;
- }
-}
-
-U_CAPI void U_EXPORT2
-ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
- RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
- /* ubidi_countRuns() checks for VALID_PARA_OR_LINE */
- ubidi_countRuns(pBiDi, pErrorCode);
- if(U_FAILURE(*pErrorCode)) {
- /* no op */
- } else if(indexMap==NULL) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- } else {
- /* fill a logical-to-visual index map using the runs[] */
- int32_t visualStart, visualLimit, i, j, k;
- int32_t logicalStart, logicalLimit;
- Run *runs=pBiDi->runs;
- if (pBiDi->length<=0) {
- return;
- }
- if (pBiDi->length>pBiDi->resultLength) {
- uprv_memset(indexMap, 0xFF, pBiDi->length*sizeof(int32_t));
- }
-
- visualStart=0;
- for(j=0; j<pBiDi->runCount; ++j) {
- logicalStart=GET_INDEX(runs[j].logicalStart);
- visualLimit=runs[j].visualLimit;
- if(IS_EVEN_RUN(runs[j].logicalStart)) {
- do { /* LTR */
- indexMap[logicalStart++]=visualStart++;
- } while(visualStart<visualLimit);
- } else {
- logicalStart+=visualLimit-visualStart; /* logicalLimit */
- do { /* RTL */
- indexMap[--logicalStart]=visualStart++;
- } while(visualStart<visualLimit);
- }
- /* visualStart==visualLimit; */
- }
-
- if(pBiDi->insertPoints.size>0) {
- int32_t markFound=0, runCount=pBiDi->runCount;
- int32_t length, insertRemove;
- visualStart=0;
- /* add number of marks found until each index */
- for(i=0; i<runCount; i++, visualStart+=length) {
- length=runs[i].visualLimit-visualStart;
- insertRemove=runs[i].insertRemove;
- if(insertRemove&(LRM_BEFORE|RLM_BEFORE)) {
- markFound++;
- }
- if(markFound>0) {
- logicalStart=GET_INDEX(runs[i].logicalStart);
- logicalLimit=logicalStart+length;
- for(j=logicalStart; j<logicalLimit; j++) {
- indexMap[j]+=markFound;
- }
- }
- if(insertRemove&(LRM_AFTER|RLM_AFTER)) {
- markFound++;
- }
- }
- }
- else if(pBiDi->controlCount>0) {
- int32_t controlFound=0, runCount=pBiDi->runCount;
- int32_t length, insertRemove;
- UBool evenRun;
- UChar uchar;
- visualStart=0;
- /* subtract number of controls found until each index */
- for(i=0; i<runCount; i++, visualStart+=length) {
- length=runs[i].visualLimit-visualStart;
- insertRemove=runs[i].insertRemove;
- /* no control found within previous runs nor within this run */
- if((controlFound-insertRemove)==0) {
- continue;
- }
- logicalStart=runs[i].logicalStart;
- evenRun=IS_EVEN_RUN(logicalStart);
- REMOVE_ODD_BIT(logicalStart);
- logicalLimit=logicalStart+length;
- /* if no control within this run */
- if(insertRemove==0) {
- for(j=logicalStart; j<logicalLimit; j++) {
- indexMap[j]-=controlFound;
- }
- continue;
- }
- for(j=0; j<length; j++) {
- k= evenRun ? logicalStart+j : logicalLimit-j-1;
- uchar=pBiDi->text[k];
- if(IS_BIDI_CONTROL_CHAR(uchar)) {
- controlFound++;
- indexMap[k]=UBIDI_MAP_NOWHERE;
- continue;
- }
- indexMap[k]-=controlFound;
- }
- }
- }
- }
-}
-
-U_CAPI void U_EXPORT2
-ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
- RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
- if(indexMap==NULL) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- /* ubidi_countRuns() checks for VALID_PARA_OR_LINE */
- ubidi_countRuns(pBiDi, pErrorCode);
- if(U_SUCCESS(*pErrorCode)) {
- /* fill a visual-to-logical index map using the runs[] */
- Run *runs=pBiDi->runs, *runsLimit=runs+pBiDi->runCount;
- int32_t logicalStart, visualStart, visualLimit, *pi=indexMap;
-
- if (pBiDi->resultLength<=0) {
- return;
- }
- visualStart=0;
- for(; runs<runsLimit; ++runs) {
- logicalStart=runs->logicalStart;
- visualLimit=runs->visualLimit;
- if(IS_EVEN_RUN(logicalStart)) {
- do { /* LTR */
- *pi++ = logicalStart++;
- } while(++visualStart<visualLimit);
- } else {
- REMOVE_ODD_BIT(logicalStart);
- logicalStart+=visualLimit-visualStart; /* logicalLimit */
- do { /* RTL */
- *pi++ = --logicalStart;
- } while(++visualStart<visualLimit);
- }
- /* visualStart==visualLimit; */
- }
-
- if(pBiDi->insertPoints.size>0) {
- int32_t markFound=0, runCount=pBiDi->runCount;
- int32_t insertRemove, i, j, k;
- runs=pBiDi->runs;
- /* count all inserted marks */
- for(i=0; i<runCount; i++) {
- insertRemove=runs[i].insertRemove;
- if(insertRemove&(LRM_BEFORE|RLM_BEFORE)) {
- markFound++;
- }
- if(insertRemove&(LRM_AFTER|RLM_AFTER)) {
- markFound++;
- }
- }
- /* move back indexes by number of preceding marks */
- k=pBiDi->resultLength;
- for(i=runCount-1; i>=0 && markFound>0; i--) {
- insertRemove=runs[i].insertRemove;
- if(insertRemove&(LRM_AFTER|RLM_AFTER)) {
- indexMap[--k]= UBIDI_MAP_NOWHERE;
- markFound--;
- }
- visualStart= i>0 ? runs[i-1].visualLimit : 0;
- for(j=runs[i].visualLimit-1; j>=visualStart && markFound>0; j--) {
- indexMap[--k]=indexMap[j];
- }
- if(insertRemove&(LRM_BEFORE|RLM_BEFORE)) {
- indexMap[--k]= UBIDI_MAP_NOWHERE;
- markFound--;
- }
- }
- }
- else if(pBiDi->controlCount>0) {
- int32_t runCount=pBiDi->runCount, logicalEnd;
- int32_t insertRemove, length, i, j, k, m;
- UChar uchar;
- UBool evenRun;
- runs=pBiDi->runs;
- visualStart=0;
- /* move forward indexes by number of preceding controls */
- k=0;
- for(i=0; i<runCount; i++, visualStart+=length) {
- length=runs[i].visualLimit-visualStart;
- insertRemove=runs[i].insertRemove;
- /* if no control found yet, nothing to do in this run */
- if((insertRemove==0)&&(k==visualStart)) {
- k+=length;
- continue;
- }
- /* if no control in this run */
- if(insertRemove==0) {
- visualLimit=runs[i].visualLimit;
- for(j=visualStart; j<visualLimit; j++) {
- indexMap[k++]=indexMap[j];
- }
- continue;
- }
- logicalStart=runs[i].logicalStart;
- evenRun=IS_EVEN_RUN(logicalStart);
- REMOVE_ODD_BIT(logicalStart);
- logicalEnd=logicalStart+length-1;
- for(j=0; j<length; j++) {
- m= evenRun ? logicalStart+j : logicalEnd-j;
- uchar=pBiDi->text[m];
- if(!IS_BIDI_CONTROL_CHAR(uchar)) {
- indexMap[k++]=m;
- }
- }
- }
- }
- }
-}
-
-U_CAPI void U_EXPORT2
-ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length) {
- if(srcMap!=NULL && destMap!=NULL && length>0) {
- const int32_t *pi;
- int32_t destLength=-1, count=0;
- /* find highest value and count positive indexes in srcMap */
- pi=srcMap+length;
- while(pi>srcMap) {
- if(*--pi>destLength) {
- destLength=*pi;
- }
- if(*pi>=0) {
- count++;
- }
- }
- destLength++; /* add 1 for origin 0 */
- if(count<destLength) {
- /* we must fill unmatched destMap entries with -1 */
- uprv_memset(destMap, 0xFF, destLength*sizeof(int32_t));
- }
- pi=srcMap+length;
- while(length>0) {
- if(*--pi>=0) {
- destMap[*pi]=--length;
- } else {
- --length;
- }
- }
- }
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 1999-2015, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+* file name: ubidiln.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 1999aug06
+* created by: Markus W. Scherer, updated by Matitiahu Allouche
+*/
+
+#include "cmemory.h"
+#include "unicode/utypes.h"
+#include "unicode/ustring.h"
+#include "unicode/uchar.h"
+#include "unicode/ubidi.h"
+#include "ubidiimp.h"
+#include "uassert.h"
+
+/*
+ * General remarks about the functions in this file:
+ *
+ * These functions deal with the aspects of potentially mixed-directional
+ * text in a single paragraph or in a line of a single paragraph
+ * which has already been processed according to
+ * the Unicode 6.3 BiDi algorithm as defined in
+ * http://www.unicode.org/unicode/reports/tr9/ , version 28,
+ * also described in The Unicode Standard, Version 6.3.0 .
+ *
+ * This means that there is a UBiDi object with a levels
+ * and a dirProps array.
+ * paraLevel and direction are also set.
+ * Only if the length of the text is zero, then levels==dirProps==NULL.
+ *
+ * The overall directionality of the paragraph
+ * or line is used to bypass the reordering steps if possible.
+ * Even purely RTL text does not need reordering there because
+ * the ubidi_getLogical/VisualIndex() functions can compute the
+ * index on the fly in such a case.
+ *
+ * The implementation of the access to same-level-runs and of the reordering
+ * do attempt to provide better performance and less memory usage compared to
+ * a direct implementation of especially rule (L2) with an array of
+ * one (32-bit) integer per text character.
+ *
+ * Here, the levels array is scanned as soon as necessary, and a vector of
+ * same-level-runs is created. Reordering then is done on this vector.
+ * For each run of text positions that were resolved to the same level,
+ * only 8 bytes are stored: the first text position of the run and the visual
+ * position behind the run after reordering.
+ * One sign bit is used to hold the directionality of the run.
+ * This is inefficient if there are many very short runs. If the average run
+ * length is <2, then this uses more memory.
+ *
+ * In a further attempt to save memory, the levels array is never changed
+ * after all the resolution rules (Xn, Wn, Nn, In).
+ * Many functions have to consider the field trailingWSStart:
+ * if it is less than length, then there is an implicit trailing run
+ * at the paraLevel,
+ * which is not reflected in the levels array.
+ * This allows a line UBiDi object to use the same levels array as
+ * its paragraph parent object.
+ *
+ * When a UBiDi object is created for a line of a paragraph, then the
+ * paragraph's levels and dirProps arrays are reused by way of setting
+ * a pointer into them, not by copying. This again saves memory and forbids to
+ * change the now shared levels for (L1).
+ */
+
+/* handle trailing WS (L1) -------------------------------------------------- */
+
+/*
+ * setTrailingWSStart() sets the start index for a trailing
+ * run of WS in the line. This is necessary because we do not modify
+ * the paragraph's levels array that we just point into.
+ * Using trailingWSStart is another form of performing (L1).
+ *
+ * To make subsequent operations easier, we also include the run
+ * before the WS if it is at the paraLevel - we merge the two here.
+ *
+ * This function is called only from ubidi_setLine(), so pBiDi->paraLevel is
+ * set correctly for the line even when contextual multiple paragraphs.
+ */
+static void
+setTrailingWSStart(UBiDi *pBiDi) {
+ /* pBiDi->direction!=UBIDI_MIXED */
+
+ const DirProp *dirProps=pBiDi->dirProps;
+ UBiDiLevel *levels=pBiDi->levels;
+ int32_t start=pBiDi->length;
+ UBiDiLevel paraLevel=pBiDi->paraLevel;
+
+ /* If the line is terminated by a block separator, all preceding WS etc...
+ are already set to paragraph level.
+ Setting trailingWSStart to pBidi->length will avoid changing the
+ level of B chars from 0 to paraLevel in ubidi_getLevels when
+ orderParagraphsLTR==TRUE.
+ */
+ if(dirProps[start-1]==B) {
+ pBiDi->trailingWSStart=start; /* currently == pBiDi->length */
+ return;
+ }
+ /* go backwards across all WS, BN, explicit codes */
+ while(start>0 && DIRPROP_FLAG(dirProps[start-1])&MASK_WS) {
+ --start;
+ }
+
+ /* if the WS run can be merged with the previous run then do so here */
+ while(start>0 && levels[start-1]==paraLevel) {
+ --start;
+ }
+
+ pBiDi->trailingWSStart=start;
+}
+
+/* ubidi_setLine ------------------------------------------------------------ */
+
+U_CAPI void U_EXPORT2
+ubidi_setLine(const UBiDi *pParaBiDi,
+ int32_t start, int32_t limit,
+ UBiDi *pLineBiDi,
+ UErrorCode *pErrorCode) {
+ int32_t length;
+
+ /* check the argument values */
+ RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
+ RETURN_VOID_IF_NOT_VALID_PARA(pParaBiDi, *pErrorCode);
+ RETURN_VOID_IF_BAD_RANGE(start, 0, limit, *pErrorCode);
+ RETURN_VOID_IF_BAD_RANGE(limit, 0, pParaBiDi->length+1, *pErrorCode);
+ if(pLineBiDi==NULL) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ if(ubidi_getParagraph(pParaBiDi, start, NULL, NULL, NULL, pErrorCode) !=
+ ubidi_getParagraph(pParaBiDi, limit-1, NULL, NULL, NULL, pErrorCode)) {
+ /* the line crosses a paragraph boundary */
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ /* set the values in pLineBiDi from its pParaBiDi parent */
+ pLineBiDi->pParaBiDi=NULL; /* mark unfinished setLine */
+ pLineBiDi->text=pParaBiDi->text+start;
+ length=pLineBiDi->length=limit-start;
+ pLineBiDi->resultLength=pLineBiDi->originalLength=length;
+ pLineBiDi->paraLevel=GET_PARALEVEL(pParaBiDi, start);
+ pLineBiDi->paraCount=pParaBiDi->paraCount;
+ pLineBiDi->runs=NULL;
+ pLineBiDi->flags=0;
+ pLineBiDi->reorderingMode=pParaBiDi->reorderingMode;
+ pLineBiDi->reorderingOptions=pParaBiDi->reorderingOptions;
+ pLineBiDi->controlCount=0;
+ if(pParaBiDi->controlCount>0) {
+ int32_t j;
+ for(j=start; j<limit; j++) {
+ if(IS_BIDI_CONTROL_CHAR(pParaBiDi->text[j])) {
+ pLineBiDi->controlCount++;
+ }
+ }
+ pLineBiDi->resultLength-=pLineBiDi->controlCount;
+ }
+
+ pLineBiDi->dirProps=pParaBiDi->dirProps+start;
+ pLineBiDi->levels=pParaBiDi->levels+start;
+ pLineBiDi->runCount=-1;
+
+ if(pParaBiDi->direction!=UBIDI_MIXED) {
+ /* the parent is already trivial */
+ pLineBiDi->direction=pParaBiDi->direction;
+
+ /*
+ * The parent's levels are all either
+ * implicitly or explicitly ==paraLevel;
+ * do the same here.
+ */
+ if(pParaBiDi->trailingWSStart<=start) {
+ pLineBiDi->trailingWSStart=0;
+ } else if(pParaBiDi->trailingWSStart<limit) {
+ pLineBiDi->trailingWSStart=pParaBiDi->trailingWSStart-start;
+ } else {
+ pLineBiDi->trailingWSStart=length;
+ }
+ } else {
+ const UBiDiLevel *levels=pLineBiDi->levels;
+ int32_t i, trailingWSStart;
+ UBiDiLevel level;
+
+ setTrailingWSStart(pLineBiDi);
+ trailingWSStart=pLineBiDi->trailingWSStart;
+
+ /* recalculate pLineBiDi->direction */
+ if(trailingWSStart==0) {
+ /* all levels are at paraLevel */
+ pLineBiDi->direction=(UBiDiDirection)(pLineBiDi->paraLevel&1);
+ } else {
+ /* get the level of the first character */
+ level=(UBiDiLevel)(levels[0]&1);
+
+ /* if there is anything of a different level, then the line is mixed */
+ if(trailingWSStart<length && (pLineBiDi->paraLevel&1)!=level) {
+ /* the trailing WS is at paraLevel, which differs from levels[0] */
+ pLineBiDi->direction=UBIDI_MIXED;
+ } else {
+ /* see if levels[1..trailingWSStart-1] have the same direction as levels[0] and paraLevel */
+ i=1;
+ for(;;) {
+ if(i==trailingWSStart) {
+ /* the direction values match those in level */
+ pLineBiDi->direction=(UBiDiDirection)level;
+ break;
+ } else if((levels[i]&1)!=level) {
+ pLineBiDi->direction=UBIDI_MIXED;
+ break;
+ }
+ ++i;
+ }
+ }
+ }
+
+ switch(pLineBiDi->direction) {
+ case UBIDI_LTR:
+ /* make sure paraLevel is even */
+ pLineBiDi->paraLevel=(UBiDiLevel)((pLineBiDi->paraLevel+1)&~1);
+
+ /* all levels are implicitly at paraLevel (important for ubidi_getLevels()) */
+ pLineBiDi->trailingWSStart=0;
+ break;
+ case UBIDI_RTL:
+ /* make sure paraLevel is odd */
+ pLineBiDi->paraLevel|=1;
+
+ /* all levels are implicitly at paraLevel (important for ubidi_getLevels()) */
+ pLineBiDi->trailingWSStart=0;
+ break;
+ default:
+ break;
+ }
+ }
+ pLineBiDi->pParaBiDi=pParaBiDi; /* mark successful setLine */
+ return;
+}
+
+U_CAPI UBiDiLevel U_EXPORT2
+ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex) {
+ /* return paraLevel if in the trailing WS run, otherwise the real level */
+ if(!IS_VALID_PARA_OR_LINE(pBiDi) || charIndex<0 || pBiDi->length<=charIndex) {
+ return 0;
+ } else if(pBiDi->direction!=UBIDI_MIXED || charIndex>=pBiDi->trailingWSStart) {
+ return GET_PARALEVEL(pBiDi, charIndex);
+ } else {
+ return pBiDi->levels[charIndex];
+ }
+}
+
+U_CAPI const UBiDiLevel * U_EXPORT2
+ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) {
+ int32_t start, length;
+
+ RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, NULL);
+ RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, NULL);
+ if((length=pBiDi->length)<=0) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
+ }
+ if((start=pBiDi->trailingWSStart)==length) {
+ /* the current levels array reflects the WS run */
+ return pBiDi->levels;
+ }
+
+ /*
+ * After the previous if(), we know that the levels array
+ * has an implicit trailing WS run and therefore does not fully
+ * reflect itself all the levels.
+ * This must be a UBiDi object for a line, and
+ * we need to create a new levels array.
+ */
+ if(getLevelsMemory(pBiDi, length)) {
+ UBiDiLevel *levels=pBiDi->levelsMemory;
+
+ if(start>0 && levels!=pBiDi->levels) {
+ uprv_memcpy(levels, pBiDi->levels, start);
+ }
+ /* pBiDi->paraLevel is ok even if contextual multiple paragraphs,
+ since pBidi is a line object */
+ uprv_memset(levels+start, pBiDi->paraLevel, length-start);
+
+ /* this new levels array is set for the line and reflects the WS run */
+ pBiDi->trailingWSStart=length;
+ return pBiDi->levels=levels;
+ } else {
+ /* out of memory */
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+}
+
+U_CAPI void U_EXPORT2
+ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalPosition,
+ int32_t *pLogicalLimit, UBiDiLevel *pLevel) {
+ UErrorCode errorCode;
+ int32_t runCount, visualStart, logicalLimit, logicalFirst, i;
+ Run iRun;
+
+ errorCode=U_ZERO_ERROR;
+ RETURN_VOID_IF_BAD_RANGE(logicalPosition, 0, pBiDi->length, errorCode);
+ /* ubidi_countRuns will check VALID_PARA_OR_LINE */
+ runCount=ubidi_countRuns((UBiDi *)pBiDi, &errorCode);
+ if(U_FAILURE(errorCode)) {
+ return;
+ }
+ /* this is done based on runs rather than on levels since levels have
+ a special interpretation when UBIDI_REORDER_RUNS_ONLY
+ */
+ visualStart=logicalLimit=0;
+ iRun=pBiDi->runs[0];
+
+ for(i=0; i<runCount; i++) {
+ iRun = pBiDi->runs[i];
+ logicalFirst=GET_INDEX(iRun.logicalStart);
+ logicalLimit=logicalFirst+iRun.visualLimit-visualStart;
+ if((logicalPosition>=logicalFirst) &&
+ (logicalPosition<logicalLimit)) {
+ break;
+ }
+ visualStart = iRun.visualLimit;
+ }
+ if(pLogicalLimit) {
+ *pLogicalLimit=logicalLimit;
+ }
+ if(pLevel) {
+ if(pBiDi->reorderingMode==UBIDI_REORDER_RUNS_ONLY) {
+ *pLevel=(UBiDiLevel)GET_ODD_BIT(iRun.logicalStart);
+ }
+ else if(pBiDi->direction!=UBIDI_MIXED || logicalPosition>=pBiDi->trailingWSStart) {
+ *pLevel=GET_PARALEVEL(pBiDi, logicalPosition);
+ } else {
+ *pLevel=pBiDi->levels[logicalPosition];
+ }
+ }
+}
+
+/* runs API functions ------------------------------------------------------- */
+
+U_CAPI int32_t U_EXPORT2
+ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode) {
+ RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, -1);
+ RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, -1);
+ ubidi_getRuns(pBiDi, pErrorCode);
+ if(U_FAILURE(*pErrorCode)) {
+ return -1;
+ }
+ return pBiDi->runCount;
+}
+
+U_CAPI UBiDiDirection U_EXPORT2
+ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,
+ int32_t *pLogicalStart, int32_t *pLength)
+{
+ int32_t start;
+ UErrorCode errorCode = U_ZERO_ERROR;
+ RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, errorCode, UBIDI_LTR);
+ ubidi_getRuns(pBiDi, &errorCode);
+ if(U_FAILURE(errorCode)) {
+ return UBIDI_LTR;
+ }
+ RETURN_IF_BAD_RANGE(runIndex, 0, pBiDi->runCount, errorCode, UBIDI_LTR);
+
+ start=pBiDi->runs[runIndex].logicalStart;
+ if(pLogicalStart!=NULL) {
+ *pLogicalStart=GET_INDEX(start);
+ }
+ if(pLength!=NULL) {
+ if(runIndex>0) {
+ *pLength=pBiDi->runs[runIndex].visualLimit-
+ pBiDi->runs[runIndex-1].visualLimit;
+ } else {
+ *pLength=pBiDi->runs[0].visualLimit;
+ }
+ }
+ return (UBiDiDirection)GET_ODD_BIT(start);
+}
+
+/* in trivial cases there is only one trivial run; called by ubidi_getRuns() */
+static void
+getSingleRun(UBiDi *pBiDi, UBiDiLevel level) {
+ /* simple, single-run case */
+ pBiDi->runs=pBiDi->simpleRuns;
+ pBiDi->runCount=1;
+
+ /* fill and reorder the single run */
+ pBiDi->runs[0].logicalStart=MAKE_INDEX_ODD_PAIR(0, level);
+ pBiDi->runs[0].visualLimit=pBiDi->length;
+ pBiDi->runs[0].insertRemove=0;
+}
+
+/* reorder the runs array (L2) ---------------------------------------------- */
+
+/*
+ * Reorder the same-level runs in the runs array.
+ * Here, runCount>1 and maxLevel>=minLevel>=paraLevel.
+ * All the visualStart fields=logical start before reordering.
+ * The "odd" bits are not set yet.
+ *
+ * Reordering with this data structure lends itself to some handy shortcuts:
+ *
+ * Since each run is moved but not modified, and since at the initial maxLevel
+ * each sequence of same-level runs consists of only one run each, we
+ * don't need to do anything there and can predecrement maxLevel.
+ * In many simple cases, the reordering is thus done entirely in the
+ * index mapping.
+ * Also, reordering occurs only down to the lowest odd level that occurs,
+ * which is minLevel|1. However, if the lowest level itself is odd, then
+ * in the last reordering the sequence of the runs at this level or higher
+ * will be all runs, and we don't need the elaborate loop to search for them.
+ * This is covered by ++minLevel instead of minLevel|=1 followed
+ * by an extra reorder-all after the reorder-some loop.
+ * About a trailing WS run:
+ * Such a run would need special treatment because its level is not
+ * reflected in levels[] if this is not a paragraph object.
+ * Instead, all characters from trailingWSStart on are implicitly at
+ * paraLevel.
+ * However, for all maxLevel>paraLevel, this run will never be reordered
+ * and does not need to be taken into account. maxLevel==paraLevel is only reordered
+ * if minLevel==paraLevel is odd, which is done in the extra segment.
+ * This means that for the main reordering loop we don't need to consider
+ * this run and can --runCount. If it is later part of the all-runs
+ * reordering, then runCount is adjusted accordingly.
+ */
+static void
+reorderLine(UBiDi *pBiDi, UBiDiLevel minLevel, UBiDiLevel maxLevel) {
+ Run *runs, tempRun;
+ UBiDiLevel *levels;
+ int32_t firstRun, endRun, limitRun, runCount;
+
+ /* nothing to do? */
+ if(maxLevel<=(minLevel|1)) {
+ return;
+ }
+
+ /*
+ * Reorder only down to the lowest odd level
+ * and reorder at an odd minLevel in a separate, simpler loop.
+ * See comments above for why minLevel is always incremented.
+ */
+ ++minLevel;
+
+ runs=pBiDi->runs;
+ levels=pBiDi->levels;
+ runCount=pBiDi->runCount;
+
+ /* do not include the WS run at paraLevel<=old minLevel except in the simple loop */
+ if(pBiDi->trailingWSStart<pBiDi->length) {
+ --runCount;
+ }
+
+ while(--maxLevel>=minLevel) {
+ firstRun=0;
+
+ /* loop for all sequences of runs */
+ for(;;) {
+ /* look for a sequence of runs that are all at >=maxLevel */
+ /* look for the first run of such a sequence */
+ while(firstRun<runCount && levels[runs[firstRun].logicalStart]<maxLevel) {
+ ++firstRun;
+ }
+ if(firstRun>=runCount) {
+ break; /* no more such runs */
+ }
+
+ /* look for the limit run of such a sequence (the run behind it) */
+ for(limitRun=firstRun; ++limitRun<runCount && levels[runs[limitRun].logicalStart]>=maxLevel;) {}
+
+ /* Swap the entire sequence of runs from firstRun to limitRun-1. */
+ endRun=limitRun-1;
+ while(firstRun<endRun) {
+ tempRun = runs[firstRun];
+ runs[firstRun]=runs[endRun];
+ runs[endRun]=tempRun;
+ ++firstRun;
+ --endRun;
+ }
+
+ if(limitRun==runCount) {
+ break; /* no more such runs */
+ } else {
+ firstRun=limitRun+1;
+ }
+ }
+ }
+
+ /* now do maxLevel==old minLevel (==odd!), see above */
+ if(!(minLevel&1)) {
+ firstRun=0;
+
+ /* include the trailing WS run in this complete reordering */
+ if(pBiDi->trailingWSStart==pBiDi->length) {
+ --runCount;
+ }
+
+ /* Swap the entire sequence of all runs. (endRun==runCount) */
+ while(firstRun<runCount) {
+ tempRun=runs[firstRun];
+ runs[firstRun]=runs[runCount];
+ runs[runCount]=tempRun;
+ ++firstRun;
+ --runCount;
+ }
+ }
+}
+
+/* compute the runs array --------------------------------------------------- */
+
+static int32_t getRunFromLogicalIndex(UBiDi *pBiDi, int32_t logicalIndex) {
+ Run *runs=pBiDi->runs;
+ int32_t runCount=pBiDi->runCount, visualStart=0, i, length, logicalStart;
+
+ for(i=0; i<runCount; i++) {
+ length=runs[i].visualLimit-visualStart;
+ logicalStart=GET_INDEX(runs[i].logicalStart);
+ if((logicalIndex>=logicalStart) && (logicalIndex<(logicalStart+length))) {
+ return i;
+ }
+ visualStart+=length;
+ }
+ /* we should never get here */
+ UPRV_UNREACHABLE;
+}
+
+/*
+ * Compute the runs array from the levels array.
+ * After ubidi_getRuns() returns TRUE, runCount is guaranteed to be >0
+ * and the runs are reordered.
+ * Odd-level runs have visualStart on their visual right edge and
+ * they progress visually to the left.
+ * If option UBIDI_OPTION_INSERT_MARKS is set, insertRemove will contain the
+ * sum of appropriate LRM/RLM_BEFORE/AFTER flags.
+ * If option UBIDI_OPTION_REMOVE_CONTROLS is set, insertRemove will contain the
+ * negative number of BiDi control characters within this run.
+ */
+U_CFUNC UBool
+ubidi_getRuns(UBiDi *pBiDi, UErrorCode*) {
+ /*
+ * This method returns immediately if the runs are already set. This
+ * includes the case of length==0 (handled in setPara)..
+ */
+ if (pBiDi->runCount>=0) {
+ return TRUE;
+ }
+
+ if(pBiDi->direction!=UBIDI_MIXED) {
+ /* simple, single-run case - this covers length==0 */
+ /* pBiDi->paraLevel is ok even for contextual multiple paragraphs */
+ getSingleRun(pBiDi, pBiDi->paraLevel);
+ } else /* UBIDI_MIXED, length>0 */ {
+ /* mixed directionality */
+ int32_t length=pBiDi->length, limit;
+ UBiDiLevel *levels=pBiDi->levels;
+ int32_t i, runCount;
+ UBiDiLevel level=UBIDI_DEFAULT_LTR; /* initialize with no valid level */
+ /*
+ * If there are WS characters at the end of the line
+ * and the run preceding them has a level different from
+ * paraLevel, then they will form their own run at paraLevel (L1).
+ * Count them separately.
+ * We need some special treatment for this in order to not
+ * modify the levels array which a line UBiDi object shares
+ * with its paragraph parent and its other line siblings.
+ * In other words, for the trailing WS, it may be
+ * levels[]!=paraLevel but we have to treat it like it were so.
+ */
+ limit=pBiDi->trailingWSStart;
+ /* count the runs, there is at least one non-WS run, and limit>0 */
+ runCount=0;
+ for(i=0; i<limit; ++i) {
+ /* increment runCount at the start of each run */
+ if(levels[i]!=level) {
+ ++runCount;
+ level=levels[i];
+ }
+ }
+
+ /*
+ * We don't need to see if the last run can be merged with a trailing
+ * WS run because setTrailingWSStart() would have done that.
+ */
+ if(runCount==1 && limit==length) {
+ /* There is only one non-WS run and no trailing WS-run. */
+ getSingleRun(pBiDi, levels[0]);
+ } else /* runCount>1 || limit<length */ {
+ /* allocate and set the runs */
+ Run *runs;
+ int32_t runIndex, start;
+ UBiDiLevel minLevel=UBIDI_MAX_EXPLICIT_LEVEL+1, maxLevel=0;
+
+ /* now, count a (non-mergeable) WS run */
+ if(limit<length) {
+ ++runCount;
+ }
+
+ /* runCount>1 */
+ if(getRunsMemory(pBiDi, runCount)) {
+ runs=pBiDi->runsMemory;
+ } else {
+ return FALSE;
+ }
+
+ /* set the runs */
+ /* FOOD FOR THOUGHT: this could be optimized, e.g.:
+ * 464->444, 484->444, 575->555, 595->555
+ * However, that would take longer. Check also how it would
+ * interact with BiDi control removal and inserting Marks.
+ */
+ runIndex=0;
+
+ /* search for the run limits and initialize visualLimit values with the run lengths */
+ i=0;
+ do {
+ /* prepare this run */
+ start=i;
+ level=levels[i];
+ if(level<minLevel) {
+ minLevel=level;
+ }
+ if(level>maxLevel) {
+ maxLevel=level;
+ }
+
+ /* look for the run limit */
+ while(++i<limit && levels[i]==level) {}
+
+ /* i is another run limit */
+ runs[runIndex].logicalStart=start;
+ runs[runIndex].visualLimit=i-start;
+ runs[runIndex].insertRemove=0;
+ ++runIndex;
+ } while(i<limit);
+
+ if(limit<length) {
+ /* there is a separate WS run */
+ runs[runIndex].logicalStart=limit;
+ runs[runIndex].visualLimit=length-limit;
+ /* For the trailing WS run, pBiDi->paraLevel is ok even
+ if contextual multiple paragraphs. */
+ if(pBiDi->paraLevel<minLevel) {
+ minLevel=pBiDi->paraLevel;
+ }
+ }
+
+ /* set the object fields */
+ pBiDi->runs=runs;
+ pBiDi->runCount=runCount;
+
+ reorderLine(pBiDi, minLevel, maxLevel);
+
+ /* now add the direction flags and adjust the visualLimit's to be just that */
+ /* this loop will also handle the trailing WS run */
+ limit=0;
+ for(i=0; i<runCount; ++i) {
+ ADD_ODD_BIT_FROM_LEVEL(runs[i].logicalStart, levels[runs[i].logicalStart]);
+ limit+=runs[i].visualLimit;
+ runs[i].visualLimit=limit;
+ }
+
+ /* Set the "odd" bit for the trailing WS run. */
+ /* For a RTL paragraph, it will be the *first* run in visual order. */
+ /* For the trailing WS run, pBiDi->paraLevel is ok even if
+ contextual multiple paragraphs. */
+ if(runIndex<runCount) {
+ int32_t trailingRun = ((pBiDi->paraLevel & 1) != 0)? 0 : runIndex;
+
+ ADD_ODD_BIT_FROM_LEVEL(runs[trailingRun].logicalStart, pBiDi->paraLevel);
+ }
+ }
+ }
+
+ /* handle insert LRM/RLM BEFORE/AFTER run */
+ if(pBiDi->insertPoints.size>0) {
+ Point *point, *start=pBiDi->insertPoints.points,
+ *limit=start+pBiDi->insertPoints.size;
+ int32_t runIndex;
+ for(point=start; point<limit; point++) {
+ runIndex=getRunFromLogicalIndex(pBiDi, point->pos);
+ pBiDi->runs[runIndex].insertRemove|=point->flag;
+ }
+ }
+
+ /* handle remove BiDi control characters */
+ if(pBiDi->controlCount>0) {
+ int32_t runIndex;
+ const UChar *start=pBiDi->text, *limit=start+pBiDi->length, *pu;
+ for(pu=start; pu<limit; pu++) {
+ if(IS_BIDI_CONTROL_CHAR(*pu)) {
+ runIndex=getRunFromLogicalIndex(pBiDi, (int32_t)(pu-start));
+ pBiDi->runs[runIndex].insertRemove--;
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+static UBool
+prepareReorder(const UBiDiLevel *levels, int32_t length,
+ int32_t *indexMap,
+ UBiDiLevel *pMinLevel, UBiDiLevel *pMaxLevel) {
+ int32_t start;
+ UBiDiLevel level, minLevel, maxLevel;
+
+ if(levels==NULL || length<=0) {
+ return FALSE;
+ }
+
+ /* determine minLevel and maxLevel */
+ minLevel=UBIDI_MAX_EXPLICIT_LEVEL+1;
+ maxLevel=0;
+ for(start=length; start>0;) {
+ level=levels[--start];
+ if(level>UBIDI_MAX_EXPLICIT_LEVEL+1) {
+ return FALSE;
+ }
+ if(level<minLevel) {
+ minLevel=level;
+ }
+ if(level>maxLevel) {
+ maxLevel=level;
+ }
+ }
+ *pMinLevel=minLevel;
+ *pMaxLevel=maxLevel;
+
+ /* initialize the index map */
+ for(start=length; start>0;) {
+ --start;
+ indexMap[start]=start;
+ }
+
+ return TRUE;
+}
+
+/* reorder a line based on a levels array (L2) ------------------------------ */
+
+U_CAPI void U_EXPORT2
+ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap) {
+ int32_t start, limit, sumOfSosEos;
+ UBiDiLevel minLevel = 0, maxLevel = 0;
+
+ if(indexMap==NULL || !prepareReorder(levels, length, indexMap, &minLevel, &maxLevel)) {
+ return;
+ }
+
+ /* nothing to do? */
+ if(minLevel==maxLevel && (minLevel&1)==0) {
+ return;
+ }
+
+ /* reorder only down to the lowest odd level */
+ minLevel|=1;
+
+ /* loop maxLevel..minLevel */
+ do {
+ start=0;
+
+ /* loop for all sequences of levels to reorder at the current maxLevel */
+ for(;;) {
+ /* look for a sequence of levels that are all at >=maxLevel */
+ /* look for the first index of such a sequence */
+ while(start<length && levels[start]<maxLevel) {
+ ++start;
+ }
+ if(start>=length) {
+ break; /* no more such sequences */
+ }
+
+ /* look for the limit of such a sequence (the index behind it) */
+ for(limit=start; ++limit<length && levels[limit]>=maxLevel;) {}
+
+ /*
+ * sos=start of sequence, eos=end of sequence
+ *
+ * The closed (inclusive) interval from sos to eos includes all the logical
+ * and visual indexes within this sequence. They are logically and
+ * visually contiguous and in the same range.
+ *
+ * For each run, the new visual index=sos+eos-old visual index;
+ * we pre-add sos+eos into sumOfSosEos ->
+ * new visual index=sumOfSosEos-old visual index;
+ */
+ sumOfSosEos=start+limit-1;
+
+ /* reorder each index in the sequence */
+ do {
+ indexMap[start]=sumOfSosEos-indexMap[start];
+ } while(++start<limit);
+
+ /* start==limit */
+ if(limit==length) {
+ break; /* no more such sequences */
+ } else {
+ start=limit+1;
+ }
+ }
+ } while(--maxLevel>=minLevel);
+}
+
+U_CAPI void U_EXPORT2
+ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap) {
+ int32_t start, end, limit, temp;
+ UBiDiLevel minLevel = 0, maxLevel = 0;
+
+ if(indexMap==NULL || !prepareReorder(levels, length, indexMap, &minLevel, &maxLevel)) {
+ return;
+ }
+
+ /* nothing to do? */
+ if(minLevel==maxLevel && (minLevel&1)==0) {
+ return;
+ }
+
+ /* reorder only down to the lowest odd level */
+ minLevel|=1;
+
+ /* loop maxLevel..minLevel */
+ do {
+ start=0;
+
+ /* loop for all sequences of levels to reorder at the current maxLevel */
+ for(;;) {
+ /* look for a sequence of levels that are all at >=maxLevel */
+ /* look for the first index of such a sequence */
+ while(start<length && levels[start]<maxLevel) {
+ ++start;
+ }
+ if(start>=length) {
+ break; /* no more such runs */
+ }
+
+ /* look for the limit of such a sequence (the index behind it) */
+ for(limit=start; ++limit<length && levels[limit]>=maxLevel;) {}
+
+ /*
+ * Swap the entire interval of indexes from start to limit-1.
+ * We don't need to swap the levels for the purpose of this
+ * algorithm: the sequence of levels that we look at does not
+ * move anyway.
+ */
+ end=limit-1;
+ while(start<end) {
+ temp=indexMap[start];
+ indexMap[start]=indexMap[end];
+ indexMap[end]=temp;
+
+ ++start;
+ --end;
+ }
+
+ if(limit==length) {
+ break; /* no more such sequences */
+ } else {
+ start=limit+1;
+ }
+ }
+ } while(--maxLevel>=minLevel);
+}
+
+/* API functions for logical<->visual mapping ------------------------------- */
+
+U_CAPI int32_t U_EXPORT2
+ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode) {
+ int32_t visualIndex=UBIDI_MAP_NOWHERE;
+ RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, -1);
+ RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, -1);
+ RETURN_IF_BAD_RANGE(logicalIndex, 0, pBiDi->length, *pErrorCode, -1);
+
+ /* we can do the trivial cases without the runs array */
+ switch(pBiDi->direction) {
+ case UBIDI_LTR:
+ visualIndex=logicalIndex;
+ break;
+ case UBIDI_RTL:
+ visualIndex=pBiDi->length-logicalIndex-1;
+ break;
+ default:
+ if(!ubidi_getRuns(pBiDi, pErrorCode)) {
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ return -1;
+ } else {
+ Run *runs=pBiDi->runs;
+ int32_t i, visualStart=0, offset, length;
+
+ /* linear search for the run, search on the visual runs */
+ for(i=0; i<pBiDi->runCount; ++i) {
+ length=runs[i].visualLimit-visualStart;
+ offset=logicalIndex-GET_INDEX(runs[i].logicalStart);
+ if(offset>=0 && offset<length) {
+ if(IS_EVEN_RUN(runs[i].logicalStart)) {
+ /* LTR */
+ visualIndex=visualStart+offset;
+ } else {
+ /* RTL */
+ visualIndex=visualStart+length-offset-1;
+ }
+ break; /* exit for loop */
+ }
+ visualStart+=length;
+ }
+ if(i>=pBiDi->runCount) {
+ return UBIDI_MAP_NOWHERE;
+ }
+ }
+ }
+
+ if(pBiDi->insertPoints.size>0) {
+ /* add the number of added marks until the calculated visual index */
+ Run *runs=pBiDi->runs;
+ int32_t i, length, insertRemove;
+ int32_t visualStart=0, markFound=0;
+ for(i=0; ; i++, visualStart+=length) {
+ length=runs[i].visualLimit-visualStart;
+ insertRemove=runs[i].insertRemove;
+ if(insertRemove & (LRM_BEFORE|RLM_BEFORE)) {
+ markFound++;
+ }
+ /* is it the run containing the visual index? */
+ if(visualIndex<runs[i].visualLimit) {
+ return visualIndex+markFound;
+ }
+ if(insertRemove & (LRM_AFTER|RLM_AFTER)) {
+ markFound++;
+ }
+ }
+ }
+ else if(pBiDi->controlCount>0) {
+ /* subtract the number of controls until the calculated visual index */
+ Run *runs=pBiDi->runs;
+ int32_t i, j, start, limit, length, insertRemove;
+ int32_t visualStart=0, controlFound=0;
+ UChar uchar=pBiDi->text[logicalIndex];
+ /* is the logical index pointing to a control ? */
+ if(IS_BIDI_CONTROL_CHAR(uchar)) {
+ return UBIDI_MAP_NOWHERE;
+ }
+ /* loop on runs */
+ for(i=0; ; i++, visualStart+=length) {
+ length=runs[i].visualLimit-visualStart;
+ insertRemove=runs[i].insertRemove;
+ /* calculated visual index is beyond this run? */
+ if(visualIndex>=runs[i].visualLimit) {
+ controlFound-=insertRemove;
+ continue;
+ }
+ /* calculated visual index must be within current run */
+ if(insertRemove==0) {
+ return visualIndex-controlFound;
+ }
+ if(IS_EVEN_RUN(runs[i].logicalStart)) {
+ /* LTR: check from run start to logical index */
+ start=runs[i].logicalStart;
+ limit=logicalIndex;
+ } else {
+ /* RTL: check from logical index to run end */
+ start=logicalIndex+1;
+ limit=GET_INDEX(runs[i].logicalStart)+length;
+ }
+ for(j=start; j<limit; j++) {
+ uchar=pBiDi->text[j];
+ if(IS_BIDI_CONTROL_CHAR(uchar)) {
+ controlFound++;
+ }
+ }
+ return visualIndex-controlFound;
+ }
+ }
+
+ return visualIndex;
+}
+
+U_CAPI int32_t U_EXPORT2
+ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode) {
+ Run *runs;
+ int32_t i, runCount, start;
+ RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, -1);
+ RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, -1);
+ RETURN_IF_BAD_RANGE(visualIndex, 0, pBiDi->resultLength, *pErrorCode, -1);
+ /* we can do the trivial cases without the runs array */
+ if(pBiDi->insertPoints.size==0 && pBiDi->controlCount==0) {
+ if(pBiDi->direction==UBIDI_LTR) {
+ return visualIndex;
+ }
+ else if(pBiDi->direction==UBIDI_RTL) {
+ return pBiDi->length-visualIndex-1;
+ }
+ }
+ if(!ubidi_getRuns(pBiDi, pErrorCode)) {
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ return -1;
+ }
+
+ runs=pBiDi->runs;
+ runCount=pBiDi->runCount;
+ if(pBiDi->insertPoints.size>0) {
+ /* handle inserted LRM/RLM */
+ int32_t markFound=0, insertRemove;
+ int32_t visualStart=0, length;
+ runs=pBiDi->runs;
+ /* subtract number of marks until visual index */
+ for(i=0; ; i++, visualStart+=length) {
+ length=runs[i].visualLimit-visualStart;
+ insertRemove=runs[i].insertRemove;
+ if(insertRemove&(LRM_BEFORE|RLM_BEFORE)) {
+ if(visualIndex<=(visualStart+markFound)) {
+ return UBIDI_MAP_NOWHERE;
+ }
+ markFound++;
+ }
+ /* is adjusted visual index within this run? */
+ if(visualIndex<(runs[i].visualLimit+markFound)) {
+ visualIndex-=markFound;
+ break;
+ }
+ if(insertRemove&(LRM_AFTER|RLM_AFTER)) {
+ if(visualIndex==(visualStart+length+markFound)) {
+ return UBIDI_MAP_NOWHERE;
+ }
+ markFound++;
+ }
+ }
+ }
+ else if(pBiDi->controlCount>0) {
+ /* handle removed BiDi control characters */
+ int32_t controlFound=0, insertRemove, length;
+ int32_t logicalStart, logicalEnd, visualStart=0, j, k;
+ UChar uchar;
+ UBool evenRun;
+ /* add number of controls until visual index */
+ for(i=0; ; i++, visualStart+=length) {
+ length=runs[i].visualLimit-visualStart;
+ insertRemove=runs[i].insertRemove;
+ /* is adjusted visual index beyond current run? */
+ if(visualIndex>=(runs[i].visualLimit-controlFound+insertRemove)) {
+ controlFound-=insertRemove;
+ continue;
+ }
+ /* adjusted visual index is within current run */
+ if(insertRemove==0) {
+ visualIndex+=controlFound;
+ break;
+ }
+ /* count non-control chars until visualIndex */
+ logicalStart=runs[i].logicalStart;
+ evenRun=IS_EVEN_RUN(logicalStart);
+ REMOVE_ODD_BIT(logicalStart);
+ logicalEnd=logicalStart+length-1;
+ for(j=0; j<length; j++) {
+ k= evenRun ? logicalStart+j : logicalEnd-j;
+ uchar=pBiDi->text[k];
+ if(IS_BIDI_CONTROL_CHAR(uchar)) {
+ controlFound++;
+ }
+ if((visualIndex+controlFound)==(visualStart+j)) {
+ break;
+ }
+ }
+ visualIndex+=controlFound;
+ break;
+ }
+ }
+ /* handle all cases */
+ if(runCount<=10) {
+ /* linear search for the run */
+ for(i=0; visualIndex>=runs[i].visualLimit; ++i) {}
+ } else {
+ /* binary search for the run */
+ int32_t begin=0, limit=runCount;
+
+ /* the middle if() is guaranteed to find the run, we don't need a loop limit */
+ for(;;) {
+ i=(begin+limit)/2;
+ if(visualIndex>=runs[i].visualLimit) {
+ begin=i+1;
+ } else if(i==0 || visualIndex>=runs[i-1].visualLimit) {
+ break;
+ } else {
+ limit=i;
+ }
+ }
+ }
+
+ start=runs[i].logicalStart;
+ if(IS_EVEN_RUN(start)) {
+ /* LTR */
+ /* the offset in runs[i] is visualIndex-runs[i-1].visualLimit */
+ if(i>0) {
+ visualIndex-=runs[i-1].visualLimit;
+ }
+ return start+visualIndex;
+ } else {
+ /* RTL */
+ return GET_INDEX(start)+runs[i].visualLimit-visualIndex-1;
+ }
+}
+
+U_CAPI void U_EXPORT2
+ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
+ RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
+ /* ubidi_countRuns() checks for VALID_PARA_OR_LINE */
+ ubidi_countRuns(pBiDi, pErrorCode);
+ if(U_FAILURE(*pErrorCode)) {
+ /* no op */
+ } else if(indexMap==NULL) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ } else {
+ /* fill a logical-to-visual index map using the runs[] */
+ int32_t visualStart, visualLimit, i, j, k;
+ int32_t logicalStart, logicalLimit;
+ Run *runs=pBiDi->runs;
+ if (pBiDi->length<=0) {
+ return;
+ }
+ if (pBiDi->length>pBiDi->resultLength) {
+ uprv_memset(indexMap, 0xFF, pBiDi->length*sizeof(int32_t));
+ }
+
+ visualStart=0;
+ for(j=0; j<pBiDi->runCount; ++j) {
+ logicalStart=GET_INDEX(runs[j].logicalStart);
+ visualLimit=runs[j].visualLimit;
+ if(IS_EVEN_RUN(runs[j].logicalStart)) {
+ do { /* LTR */
+ indexMap[logicalStart++]=visualStart++;
+ } while(visualStart<visualLimit);
+ } else {
+ logicalStart+=visualLimit-visualStart; /* logicalLimit */
+ do { /* RTL */
+ indexMap[--logicalStart]=visualStart++;
+ } while(visualStart<visualLimit);
+ }
+ /* visualStart==visualLimit; */
+ }
+
+ if(pBiDi->insertPoints.size>0) {
+ int32_t markFound=0, runCount=pBiDi->runCount;
+ int32_t length, insertRemove;
+ visualStart=0;
+ /* add number of marks found until each index */
+ for(i=0; i<runCount; i++, visualStart+=length) {
+ length=runs[i].visualLimit-visualStart;
+ insertRemove=runs[i].insertRemove;
+ if(insertRemove&(LRM_BEFORE|RLM_BEFORE)) {
+ markFound++;
+ }
+ if(markFound>0) {
+ logicalStart=GET_INDEX(runs[i].logicalStart);
+ logicalLimit=logicalStart+length;
+ for(j=logicalStart; j<logicalLimit; j++) {
+ indexMap[j]+=markFound;
+ }
+ }
+ if(insertRemove&(LRM_AFTER|RLM_AFTER)) {
+ markFound++;
+ }
+ }
+ }
+ else if(pBiDi->controlCount>0) {
+ int32_t controlFound=0, runCount=pBiDi->runCount;
+ int32_t length, insertRemove;
+ UBool evenRun;
+ UChar uchar;
+ visualStart=0;
+ /* subtract number of controls found until each index */
+ for(i=0; i<runCount; i++, visualStart+=length) {
+ length=runs[i].visualLimit-visualStart;
+ insertRemove=runs[i].insertRemove;
+ /* no control found within previous runs nor within this run */
+ if((controlFound-insertRemove)==0) {
+ continue;
+ }
+ logicalStart=runs[i].logicalStart;
+ evenRun=IS_EVEN_RUN(logicalStart);
+ REMOVE_ODD_BIT(logicalStart);
+ logicalLimit=logicalStart+length;
+ /* if no control within this run */
+ if(insertRemove==0) {
+ for(j=logicalStart; j<logicalLimit; j++) {
+ indexMap[j]-=controlFound;
+ }
+ continue;
+ }
+ for(j=0; j<length; j++) {
+ k= evenRun ? logicalStart+j : logicalLimit-j-1;
+ uchar=pBiDi->text[k];
+ if(IS_BIDI_CONTROL_CHAR(uchar)) {
+ controlFound++;
+ indexMap[k]=UBIDI_MAP_NOWHERE;
+ continue;
+ }
+ indexMap[k]-=controlFound;
+ }
+ }
+ }
+ }
+}
+
+U_CAPI void U_EXPORT2
+ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
+ RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
+ if(indexMap==NULL) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ /* ubidi_countRuns() checks for VALID_PARA_OR_LINE */
+ ubidi_countRuns(pBiDi, pErrorCode);
+ if(U_SUCCESS(*pErrorCode)) {
+ /* fill a visual-to-logical index map using the runs[] */
+ Run *runs=pBiDi->runs, *runsLimit=runs+pBiDi->runCount;
+ int32_t logicalStart, visualStart, visualLimit, *pi=indexMap;
+
+ if (pBiDi->resultLength<=0) {
+ return;
+ }
+ visualStart=0;
+ for(; runs<runsLimit; ++runs) {
+ logicalStart=runs->logicalStart;
+ visualLimit=runs->visualLimit;
+ if(IS_EVEN_RUN(logicalStart)) {
+ do { /* LTR */
+ *pi++ = logicalStart++;
+ } while(++visualStart<visualLimit);
+ } else {
+ REMOVE_ODD_BIT(logicalStart);
+ logicalStart+=visualLimit-visualStart; /* logicalLimit */
+ do { /* RTL */
+ *pi++ = --logicalStart;
+ } while(++visualStart<visualLimit);
+ }
+ /* visualStart==visualLimit; */
+ }
+
+ if(pBiDi->insertPoints.size>0) {
+ int32_t markFound=0, runCount=pBiDi->runCount;
+ int32_t insertRemove, i, j, k;
+ runs=pBiDi->runs;
+ /* count all inserted marks */
+ for(i=0; i<runCount; i++) {
+ insertRemove=runs[i].insertRemove;
+ if(insertRemove&(LRM_BEFORE|RLM_BEFORE)) {
+ markFound++;
+ }
+ if(insertRemove&(LRM_AFTER|RLM_AFTER)) {
+ markFound++;
+ }
+ }
+ /* move back indexes by number of preceding marks */
+ k=pBiDi->resultLength;
+ for(i=runCount-1; i>=0 && markFound>0; i--) {
+ insertRemove=runs[i].insertRemove;
+ if(insertRemove&(LRM_AFTER|RLM_AFTER)) {
+ indexMap[--k]= UBIDI_MAP_NOWHERE;
+ markFound--;
+ }
+ visualStart= i>0 ? runs[i-1].visualLimit : 0;
+ for(j=runs[i].visualLimit-1; j>=visualStart && markFound>0; j--) {
+ indexMap[--k]=indexMap[j];
+ }
+ if(insertRemove&(LRM_BEFORE|RLM_BEFORE)) {
+ indexMap[--k]= UBIDI_MAP_NOWHERE;
+ markFound--;
+ }
+ }
+ }
+ else if(pBiDi->controlCount>0) {
+ int32_t runCount=pBiDi->runCount, logicalEnd;
+ int32_t insertRemove, length, i, j, k, m;
+ UChar uchar;
+ UBool evenRun;
+ runs=pBiDi->runs;
+ visualStart=0;
+ /* move forward indexes by number of preceding controls */
+ k=0;
+ for(i=0; i<runCount; i++, visualStart+=length) {
+ length=runs[i].visualLimit-visualStart;
+ insertRemove=runs[i].insertRemove;
+ /* if no control found yet, nothing to do in this run */
+ if((insertRemove==0)&&(k==visualStart)) {
+ k+=length;
+ continue;
+ }
+ /* if no control in this run */
+ if(insertRemove==0) {
+ visualLimit=runs[i].visualLimit;
+ for(j=visualStart; j<visualLimit; j++) {
+ indexMap[k++]=indexMap[j];
+ }
+ continue;
+ }
+ logicalStart=runs[i].logicalStart;
+ evenRun=IS_EVEN_RUN(logicalStart);
+ REMOVE_ODD_BIT(logicalStart);
+ logicalEnd=logicalStart+length-1;
+ for(j=0; j<length; j++) {
+ m= evenRun ? logicalStart+j : logicalEnd-j;
+ uchar=pBiDi->text[m];
+ if(!IS_BIDI_CONTROL_CHAR(uchar)) {
+ indexMap[k++]=m;
+ }
+ }
+ }
+ }
+ }
+}
+
+U_CAPI void U_EXPORT2
+ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length) {
+ if(srcMap!=NULL && destMap!=NULL && length>0) {
+ const int32_t *pi;
+ int32_t destLength=-1, count=0;
+ /* find highest value and count positive indexes in srcMap */
+ pi=srcMap+length;
+ while(pi>srcMap) {
+ if(*--pi>destLength) {
+ destLength=*pi;
+ }
+ if(*pi>=0) {
+ count++;
+ }
+ }
+ destLength++; /* add 1 for origin 0 */
+ if(count<destLength) {
+ /* we must fill unmatched destMap entries with -1 */
+ uprv_memset(destMap, 0xFF, destLength*sizeof(int32_t));
+ }
+ pi=srcMap+length;
+ while(length>0) {
+ if(*--pi>=0) {
+ destMap[*pi]=--length;
+ } else {
+ --length;
+ }
+ }
+ }
+}
diff --git a/contrib/libs/icu/common/ubiditransform.cpp b/contrib/libs/icu/common/ubiditransform.cpp
index 98c97292cf..5b0d5cf96a 100644
--- a/contrib/libs/icu/common/ubiditransform.cpp
+++ b/contrib/libs/icu/common/ubiditransform.cpp
@@ -1,530 +1,530 @@
-/*
-******************************************************************************
-*
-* © 2016 and later: Unicode, Inc. and others.
-* License & terms of use: http://www.unicode.org/copyright.html
-*
-******************************************************************************
-* file name: ubiditransform.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 2016jul24
-* created by: Lina Kemmel
-*
-*/
-
-#include "cmemory.h"
-#include "unicode/ubidi.h"
-#include "unicode/ustring.h"
-#include "unicode/ushape.h"
-#include "unicode/utf16.h"
-#include "ustr_imp.h"
-#include "unicode/ubiditransform.h"
-
-/* Some convenience defines */
-#define LTR UBIDI_LTR
-#define RTL UBIDI_RTL
-#define LOGICAL UBIDI_LOGICAL
-#define VISUAL UBIDI_VISUAL
-#define SHAPE_LOGICAL U_SHAPE_TEXT_DIRECTION_LOGICAL
-#define SHAPE_VISUAL U_SHAPE_TEXT_DIRECTION_VISUAL_LTR
-
-#define CHECK_LEN(STR, LEN, ERROR) UPRV_BLOCK_MACRO_BEGIN { \
- if (LEN == 0) return 0; \
- if (LEN < -1) { *(ERROR) = U_ILLEGAL_ARGUMENT_ERROR; return 0; } \
- if (LEN == -1) LEN = u_strlen(STR); \
-} UPRV_BLOCK_MACRO_END
-
-#define MAX_ACTIONS 7
-
-/**
- * Typedef for a pointer to a function, which performs some operation (such as
- * reordering, setting "inverse" mode, character mirroring, etc.). Return value
- * indicates whether the text was changed in the course of this operation or
- * not.
- */
-typedef UBool (*UBiDiAction)(UBiDiTransform *, UErrorCode *);
-
-/**
- * Structure that holds a predefined reordering scheme, including the following
- * information:
- * <ul>
- * <li>an input base direction,</li>
- * <li>an input order,</li>
- * <li>an output base direction,</li>
- * <li>an output order,</li>
- * <li>a digit shaping direction,</li>
- * <li>a letter shaping direction,</li>
- * <li>a base direction that should be applied when the reordering engine is
- * invoked (which can not always be derived from the caller-defined
- * options),</li>
- * <li>an array of pointers to functions that accomplish the bidi layout
- * transformation.</li>
- * </ul>
- */
-typedef struct {
- UBiDiLevel inLevel; /* input level */
- UBiDiOrder inOrder; /* input order */
- UBiDiLevel outLevel; /* output level */
- UBiDiOrder outOrder; /* output order */
- uint32_t digitsDir; /* digit shaping direction */
- uint32_t lettersDir; /* letter shaping direction */
- UBiDiLevel baseLevel; /* paragraph level to be used with setPara */
- const UBiDiAction actions[MAX_ACTIONS]; /* array of pointers to functions carrying out the transformation */
-} ReorderingScheme;
-
-struct UBiDiTransform {
- UBiDi *pBidi; /* pointer to a UBiDi object */
- const ReorderingScheme *pActiveScheme; /* effective reordering scheme */
- UChar *src; /* input text */
- UChar *dest; /* output text */
- uint32_t srcLength; /* input text length - not really needed as we are zero-terminated and can u_strlen */
- uint32_t srcSize; /* input text capacity excluding the trailing zero */
- uint32_t destSize; /* output text capacity */
- uint32_t *pDestLength; /* number of UChars written to dest */
- uint32_t reorderingOptions; /* reordering options - currently only suppot DO_MIRRORING */
- uint32_t digits; /* digit option for ArabicShaping */
- uint32_t letters; /* letter option for ArabicShaping */
-};
-
-U_DRAFT UBiDiTransform* U_EXPORT2
-ubiditransform_open(UErrorCode *pErrorCode)
-{
- UBiDiTransform *pBiDiTransform = NULL;
- if (U_SUCCESS(*pErrorCode)) {
- pBiDiTransform = (UBiDiTransform*) uprv_calloc(1, sizeof(UBiDiTransform));
- if (pBiDiTransform == NULL) {
- *pErrorCode = U_MEMORY_ALLOCATION_ERROR;
- }
- }
- return pBiDiTransform;
-}
-
-U_DRAFT void U_EXPORT2
-ubiditransform_close(UBiDiTransform *pBiDiTransform)
-{
- if (pBiDiTransform != NULL) {
- if (pBiDiTransform->pBidi != NULL) {
- ubidi_close(pBiDiTransform->pBidi);
- }
- if (pBiDiTransform->src != NULL) {
- uprv_free(pBiDiTransform->src);
- }
- uprv_free(pBiDiTransform);
- }
-}
-
-/**
- * Performs Bidi resolution of text.
- *
- * @param pTransform Pointer to the <code>UBiDiTransform</code> structure.
- * @param pErrorCode Pointer to the error code value.
+/*
+******************************************************************************
+*
+* © 2016 and later: Unicode, Inc. and others.
+* License & terms of use: http://www.unicode.org/copyright.html
+*
+******************************************************************************
+* file name: ubiditransform.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2016jul24
+* created by: Lina Kemmel
+*
+*/
+
+#include "cmemory.h"
+#include "unicode/ubidi.h"
+#include "unicode/ustring.h"
+#include "unicode/ushape.h"
+#include "unicode/utf16.h"
+#include "ustr_imp.h"
+#include "unicode/ubiditransform.h"
+
+/* Some convenience defines */
+#define LTR UBIDI_LTR
+#define RTL UBIDI_RTL
+#define LOGICAL UBIDI_LOGICAL
+#define VISUAL UBIDI_VISUAL
+#define SHAPE_LOGICAL U_SHAPE_TEXT_DIRECTION_LOGICAL
+#define SHAPE_VISUAL U_SHAPE_TEXT_DIRECTION_VISUAL_LTR
+
+#define CHECK_LEN(STR, LEN, ERROR) UPRV_BLOCK_MACRO_BEGIN { \
+ if (LEN == 0) return 0; \
+ if (LEN < -1) { *(ERROR) = U_ILLEGAL_ARGUMENT_ERROR; return 0; } \
+ if (LEN == -1) LEN = u_strlen(STR); \
+} UPRV_BLOCK_MACRO_END
+
+#define MAX_ACTIONS 7
+
+/**
+ * Typedef for a pointer to a function, which performs some operation (such as
+ * reordering, setting "inverse" mode, character mirroring, etc.). Return value
+ * indicates whether the text was changed in the course of this operation or
+ * not.
+ */
+typedef UBool (*UBiDiAction)(UBiDiTransform *, UErrorCode *);
+
+/**
+ * Structure that holds a predefined reordering scheme, including the following
+ * information:
+ * <ul>
+ * <li>an input base direction,</li>
+ * <li>an input order,</li>
+ * <li>an output base direction,</li>
+ * <li>an output order,</li>
+ * <li>a digit shaping direction,</li>
+ * <li>a letter shaping direction,</li>
+ * <li>a base direction that should be applied when the reordering engine is
+ * invoked (which can not always be derived from the caller-defined
+ * options),</li>
+ * <li>an array of pointers to functions that accomplish the bidi layout
+ * transformation.</li>
+ * </ul>
+ */
+typedef struct {
+ UBiDiLevel inLevel; /* input level */
+ UBiDiOrder inOrder; /* input order */
+ UBiDiLevel outLevel; /* output level */
+ UBiDiOrder outOrder; /* output order */
+ uint32_t digitsDir; /* digit shaping direction */
+ uint32_t lettersDir; /* letter shaping direction */
+ UBiDiLevel baseLevel; /* paragraph level to be used with setPara */
+ const UBiDiAction actions[MAX_ACTIONS]; /* array of pointers to functions carrying out the transformation */
+} ReorderingScheme;
+
+struct UBiDiTransform {
+ UBiDi *pBidi; /* pointer to a UBiDi object */
+ const ReorderingScheme *pActiveScheme; /* effective reordering scheme */
+ UChar *src; /* input text */
+ UChar *dest; /* output text */
+ uint32_t srcLength; /* input text length - not really needed as we are zero-terminated and can u_strlen */
+ uint32_t srcSize; /* input text capacity excluding the trailing zero */
+ uint32_t destSize; /* output text capacity */
+ uint32_t *pDestLength; /* number of UChars written to dest */
+ uint32_t reorderingOptions; /* reordering options - currently only suppot DO_MIRRORING */
+ uint32_t digits; /* digit option for ArabicShaping */
+ uint32_t letters; /* letter option for ArabicShaping */
+};
+
+U_DRAFT UBiDiTransform* U_EXPORT2
+ubiditransform_open(UErrorCode *pErrorCode)
+{
+ UBiDiTransform *pBiDiTransform = NULL;
+ if (U_SUCCESS(*pErrorCode)) {
+ pBiDiTransform = (UBiDiTransform*) uprv_calloc(1, sizeof(UBiDiTransform));
+ if (pBiDiTransform == NULL) {
+ *pErrorCode = U_MEMORY_ALLOCATION_ERROR;
+ }
+ }
+ return pBiDiTransform;
+}
+
+U_DRAFT void U_EXPORT2
+ubiditransform_close(UBiDiTransform *pBiDiTransform)
+{
+ if (pBiDiTransform != NULL) {
+ if (pBiDiTransform->pBidi != NULL) {
+ ubidi_close(pBiDiTransform->pBidi);
+ }
+ if (pBiDiTransform->src != NULL) {
+ uprv_free(pBiDiTransform->src);
+ }
+ uprv_free(pBiDiTransform);
+ }
+}
+
+/**
+ * Performs Bidi resolution of text.
*
- * @return Whether or not this function modifies the text. Besides the return
- * value, the caller should also check <code>U_SUCCESS(*pErrorCode)</code>.
- */
-static UBool
-action_resolve(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
-{
- ubidi_setPara(pTransform->pBidi, pTransform->src, pTransform->srcLength,
- pTransform->pActiveScheme->baseLevel, NULL, pErrorCode);
- return FALSE;
-}
-
-/**
- * Performs basic reordering of text (Logical -> Visual LTR).
- *
- * @param pTransform Pointer to the <code>UBiDiTransform</code> structure.
- * @param pErrorCode Pointer to the error code value.
+ * @param pTransform Pointer to the <code>UBiDiTransform</code> structure.
+ * @param pErrorCode Pointer to the error code value.
+ *
+ * @return Whether or not this function modifies the text. Besides the return
+ * value, the caller should also check <code>U_SUCCESS(*pErrorCode)</code>.
+ */
+static UBool
+action_resolve(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
+{
+ ubidi_setPara(pTransform->pBidi, pTransform->src, pTransform->srcLength,
+ pTransform->pActiveScheme->baseLevel, NULL, pErrorCode);
+ return FALSE;
+}
+
+/**
+ * Performs basic reordering of text (Logical -> Visual LTR).
*
- * @return Whether or not this function modifies the text. Besides the return
- * value, the caller should also check <code>U_SUCCESS(*pErrorCode)</code>.
- */
-static UBool
-action_reorder(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
-{
- ubidi_writeReordered(pTransform->pBidi, pTransform->dest, pTransform->destSize,
- static_cast<uint16_t>(pTransform->reorderingOptions), pErrorCode);
-
- *pTransform->pDestLength = pTransform->srcLength;
- pTransform->reorderingOptions = UBIDI_REORDER_DEFAULT;
- return TRUE;
-}
-
-/**
- * Sets "inverse" mode on the <code>UBiDi</code> object.
- *
- * @param pTransform Pointer to the <code>UBiDiTransform</code> structure.
- * @param pErrorCode Pointer to the error code value.
+ * @param pTransform Pointer to the <code>UBiDiTransform</code> structure.
+ * @param pErrorCode Pointer to the error code value.
+ *
+ * @return Whether or not this function modifies the text. Besides the return
+ * value, the caller should also check <code>U_SUCCESS(*pErrorCode)</code>.
+ */
+static UBool
+action_reorder(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
+{
+ ubidi_writeReordered(pTransform->pBidi, pTransform->dest, pTransform->destSize,
+ static_cast<uint16_t>(pTransform->reorderingOptions), pErrorCode);
+
+ *pTransform->pDestLength = pTransform->srcLength;
+ pTransform->reorderingOptions = UBIDI_REORDER_DEFAULT;
+ return TRUE;
+}
+
+/**
+ * Sets "inverse" mode on the <code>UBiDi</code> object.
*
- * @return Whether or not this function modifies the text. Besides the return
- * value, the caller should also check <code>U_SUCCESS(*pErrorCode)</code>.
- */
-static UBool
-action_setInverse(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
-{
- (void)pErrorCode;
- ubidi_setInverse(pTransform->pBidi, TRUE);
- ubidi_setReorderingMode(pTransform->pBidi, UBIDI_REORDER_INVERSE_LIKE_DIRECT);
- return FALSE;
-}
-
-/**
- * Sets "runs only" reordering mode indicating a Logical LTR <-> Logical RTL
- * transformation.
- *
- * @param pTransform Pointer to the <code>UBiDiTransform</code> structure.
- * @param pErrorCode Pointer to the error code value.
+ * @param pTransform Pointer to the <code>UBiDiTransform</code> structure.
+ * @param pErrorCode Pointer to the error code value.
+ *
+ * @return Whether or not this function modifies the text. Besides the return
+ * value, the caller should also check <code>U_SUCCESS(*pErrorCode)</code>.
+ */
+static UBool
+action_setInverse(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
+{
+ (void)pErrorCode;
+ ubidi_setInverse(pTransform->pBidi, TRUE);
+ ubidi_setReorderingMode(pTransform->pBidi, UBIDI_REORDER_INVERSE_LIKE_DIRECT);
+ return FALSE;
+}
+
+/**
+ * Sets "runs only" reordering mode indicating a Logical LTR <-> Logical RTL
+ * transformation.
*
- * @return Whether or not this function modifies the text. Besides the return
- * value, the caller should also check <code>U_SUCCESS(*pErrorCode)</code>.
- */
-static UBool
-action_setRunsOnly(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
-{
- (void)pErrorCode;
- ubidi_setReorderingMode(pTransform->pBidi, UBIDI_REORDER_RUNS_ONLY);
- return FALSE;
-}
-
-/**
- * Performs string reverse.
- *
- * @param pTransform Pointer to the <code>UBiDiTransform</code> structure.
- * @param pErrorCode Pointer to the error code value.
+ * @param pTransform Pointer to the <code>UBiDiTransform</code> structure.
+ * @param pErrorCode Pointer to the error code value.
+ *
+ * @return Whether or not this function modifies the text. Besides the return
+ * value, the caller should also check <code>U_SUCCESS(*pErrorCode)</code>.
+ */
+static UBool
+action_setRunsOnly(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
+{
+ (void)pErrorCode;
+ ubidi_setReorderingMode(pTransform->pBidi, UBIDI_REORDER_RUNS_ONLY);
+ return FALSE;
+}
+
+/**
+ * Performs string reverse.
*
- * @return Whether or not this function modifies the text. Besides the return
- * value, the caller should also check <code>U_SUCCESS(*pErrorCode)</code>.
- */
-static UBool
-action_reverse(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
-{
- ubidi_writeReverse(pTransform->src, pTransform->srcLength,
- pTransform->dest, pTransform->destSize,
- UBIDI_REORDER_DEFAULT, pErrorCode);
- *pTransform->pDestLength = pTransform->srcLength;
- return TRUE;
-}
-
-/**
- * Applies a new value to the text that serves as input at the current
- * processing step. This value is identical to the original one when we begin
- * the processing, but usually changes as the transformation progresses.
- *
- * @param pTransform A pointer to the <code>UBiDiTransform</code> structure.
- * @param newSrc A pointer whose value is to be used as input text.
- * @param newLength A length of the new text in <code>UChar</code>s.
- * @param newSize A new source capacity in <code>UChar</code>s.
- * @param pErrorCode Pointer to the error code value.
- */
-static void
-updateSrc(UBiDiTransform *pTransform, const UChar *newSrc, uint32_t newLength,
- uint32_t newSize, UErrorCode *pErrorCode)
-{
- if (newSize < newLength) {
- *pErrorCode = U_BUFFER_OVERFLOW_ERROR;
- return;
- }
- if (newSize > pTransform->srcSize) {
- newSize += 50; // allocate slightly more than needed right now
- if (pTransform->src != NULL) {
- uprv_free(pTransform->src);
- pTransform->src = NULL;
- }
- pTransform->src = (UChar *)uprv_malloc(newSize * sizeof(UChar));
- if (pTransform->src == NULL) {
- *pErrorCode = U_MEMORY_ALLOCATION_ERROR;
- //pTransform->srcLength = pTransform->srcSize = 0;
- return;
- }
- pTransform->srcSize = newSize;
- }
- u_strncpy(pTransform->src, newSrc, newLength);
- pTransform->srcLength = u_terminateUChars(pTransform->src,
- pTransform->srcSize, newLength, pErrorCode);
-}
-
-/**
- * Calls a lower level shaping function.
- *
- * @param pTransform Pointer to the <code>UBiDiTransform</code> structure.
- * @param options Shaping options.
- * @param pErrorCode Pointer to the error code value.
- */
-static void
-doShape(UBiDiTransform *pTransform, uint32_t options, UErrorCode *pErrorCode)
-{
- *pTransform->pDestLength = u_shapeArabic(pTransform->src,
- pTransform->srcLength, pTransform->dest, pTransform->destSize,
- options, pErrorCode);
-}
-
-/**
- * Performs digit and letter shaping.
- *
- * @param pTransform Pointer to the <code>UBiDiTransform</code> structure.
- * @param pErrorCode Pointer to the error code value.
+ * @param pTransform Pointer to the <code>UBiDiTransform</code> structure.
+ * @param pErrorCode Pointer to the error code value.
+ *
+ * @return Whether or not this function modifies the text. Besides the return
+ * value, the caller should also check <code>U_SUCCESS(*pErrorCode)</code>.
+ */
+static UBool
+action_reverse(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
+{
+ ubidi_writeReverse(pTransform->src, pTransform->srcLength,
+ pTransform->dest, pTransform->destSize,
+ UBIDI_REORDER_DEFAULT, pErrorCode);
+ *pTransform->pDestLength = pTransform->srcLength;
+ return TRUE;
+}
+
+/**
+ * Applies a new value to the text that serves as input at the current
+ * processing step. This value is identical to the original one when we begin
+ * the processing, but usually changes as the transformation progresses.
*
- * @return Whether or not this function modifies the text. Besides the return
- * value, the caller should also check <code>U_SUCCESS(*pErrorCode)</code>.
- */
-static UBool
-action_shapeArabic(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
-{
- if ((pTransform->letters | pTransform->digits) == 0) {
- return FALSE;
- }
- if (pTransform->pActiveScheme->lettersDir == pTransform->pActiveScheme->digitsDir) {
- doShape(pTransform, pTransform->letters | pTransform->digits | pTransform->pActiveScheme->lettersDir,
- pErrorCode);
- } else {
- doShape(pTransform, pTransform->digits | pTransform->pActiveScheme->digitsDir, pErrorCode);
- if (U_SUCCESS(*pErrorCode)) {
- updateSrc(pTransform, pTransform->dest, *pTransform->pDestLength,
- *pTransform->pDestLength, pErrorCode);
- doShape(pTransform, pTransform->letters | pTransform->pActiveScheme->lettersDir,
- pErrorCode);
- }
- }
- return TRUE;
-}
-
-/**
- * Performs character mirroring.
- *
- * @param pTransform Pointer to the <code>UBiDiTransform</code> structure.
- * @param pErrorCode Pointer to the error code value.
+ * @param pTransform A pointer to the <code>UBiDiTransform</code> structure.
+ * @param newSrc A pointer whose value is to be used as input text.
+ * @param newLength A length of the new text in <code>UChar</code>s.
+ * @param newSize A new source capacity in <code>UChar</code>s.
+ * @param pErrorCode Pointer to the error code value.
+ */
+static void
+updateSrc(UBiDiTransform *pTransform, const UChar *newSrc, uint32_t newLength,
+ uint32_t newSize, UErrorCode *pErrorCode)
+{
+ if (newSize < newLength) {
+ *pErrorCode = U_BUFFER_OVERFLOW_ERROR;
+ return;
+ }
+ if (newSize > pTransform->srcSize) {
+ newSize += 50; // allocate slightly more than needed right now
+ if (pTransform->src != NULL) {
+ uprv_free(pTransform->src);
+ pTransform->src = NULL;
+ }
+ pTransform->src = (UChar *)uprv_malloc(newSize * sizeof(UChar));
+ if (pTransform->src == NULL) {
+ *pErrorCode = U_MEMORY_ALLOCATION_ERROR;
+ //pTransform->srcLength = pTransform->srcSize = 0;
+ return;
+ }
+ pTransform->srcSize = newSize;
+ }
+ u_strncpy(pTransform->src, newSrc, newLength);
+ pTransform->srcLength = u_terminateUChars(pTransform->src,
+ pTransform->srcSize, newLength, pErrorCode);
+}
+
+/**
+ * Calls a lower level shaping function.
*
- * @return Whether or not this function modifies the text. Besides the return
- * value, the caller should also check <code>U_SUCCESS(*pErrorCode)</code>.
- */
-static UBool
-action_mirror(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
-{
- UChar32 c;
- uint32_t i = 0, j = 0;
- if (0 == (pTransform->reorderingOptions & UBIDI_DO_MIRRORING)) {
- return FALSE;
- }
- if (pTransform->destSize < pTransform->srcLength) {
- *pErrorCode = U_BUFFER_OVERFLOW_ERROR;
- return FALSE;
- }
- do {
- UBool isOdd = ubidi_getLevelAt(pTransform->pBidi, i) & 1;
- U16_NEXT(pTransform->src, i, pTransform->srcLength, c);
- U16_APPEND_UNSAFE(pTransform->dest, j, isOdd ? u_charMirror(c) : c);
- } while (i < pTransform->srcLength);
-
- *pTransform->pDestLength = pTransform->srcLength;
- pTransform->reorderingOptions = UBIDI_REORDER_DEFAULT;
- return TRUE;
-}
-
-/**
- * All possible reordering schemes.
+ * @param pTransform Pointer to the <code>UBiDiTransform</code> structure.
+ * @param options Shaping options.
+ * @param pErrorCode Pointer to the error code value.
+ */
+static void
+doShape(UBiDiTransform *pTransform, uint32_t options, UErrorCode *pErrorCode)
+{
+ *pTransform->pDestLength = u_shapeArabic(pTransform->src,
+ pTransform->srcLength, pTransform->dest, pTransform->destSize,
+ options, pErrorCode);
+}
+
+/**
+ * Performs digit and letter shaping.
*
- */
-static const ReorderingScheme Schemes[] =
-{
- /* 0: Logical LTR => Visual LTR */
- {LTR, LOGICAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
- {action_shapeArabic, action_resolve, action_reorder, NULL}},
- /* 1: Logical RTL => Visual LTR */
- {RTL, LOGICAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL,
- {action_resolve, action_reorder, action_shapeArabic, NULL}},
- /* 2: Logical LTR => Visual RTL */
- {LTR, LOGICAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
- {action_shapeArabic, action_resolve, action_reorder, action_reverse, NULL}},
- /* 3: Logical RTL => Visual RTL */
- {RTL, LOGICAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL,
- {action_resolve, action_reorder, action_shapeArabic, action_reverse, NULL}},
- /* 4: Visual LTR => Logical RTL */
- {LTR, VISUAL, RTL, LOGICAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL,
- {action_shapeArabic, action_setInverse, action_resolve, action_reorder, NULL}},
- /* 5: Visual RTL => Logical RTL */
- {RTL, VISUAL, RTL, LOGICAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL,
- {action_reverse, action_shapeArabic, action_setInverse, action_resolve, action_reorder, NULL}},
- /* 6: Visual LTR => Logical LTR */
- {LTR, VISUAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
- {action_setInverse, action_resolve, action_reorder, action_shapeArabic, NULL}},
- /* 7: Visual RTL => Logical LTR */
- {RTL, VISUAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
- {action_reverse, action_setInverse, action_resolve, action_reorder, action_shapeArabic, NULL}},
- /* 8: Logical LTR => Logical RTL */
- {LTR, LOGICAL, RTL, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
- {action_shapeArabic, action_resolve, action_mirror, action_setRunsOnly, action_resolve, action_reorder, NULL}},
- /* 9: Logical RTL => Logical LTR */
- {RTL, LOGICAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, RTL,
- {action_resolve, action_mirror, action_setRunsOnly, action_resolve, action_reorder, action_shapeArabic, NULL}},
- /* 10: Visual LTR => Visual RTL */
- {LTR, VISUAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR,
- {action_shapeArabic, action_setInverse, action_resolve, action_mirror, action_reverse, NULL}},
- /* 11: Visual RTL => Visual LTR */
- {RTL, VISUAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR,
- {action_reverse, action_shapeArabic, action_setInverse, action_resolve, action_mirror, NULL}},
- /* 12: Logical LTR => Logical LTR */
- {LTR, LOGICAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
- {action_resolve, action_mirror, action_shapeArabic, NULL}},
- /* 13: Logical RTL => Logical RTL */
- {RTL, LOGICAL, RTL, LOGICAL, SHAPE_VISUAL, SHAPE_LOGICAL, RTL,
- {action_resolve, action_mirror, action_shapeArabic, NULL}},
- /* 14: Visual LTR => Visual LTR */
- {LTR, VISUAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR,
- {action_resolve, action_mirror, action_shapeArabic, NULL}},
- /* 15: Visual RTL => Visual RTL */
- {RTL, VISUAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR,
- {action_reverse, action_resolve, action_mirror, action_shapeArabic, action_reverse, NULL}}
-};
-
-static const uint32_t nSchemes = sizeof(Schemes) / sizeof(*Schemes);
-
-/**
- * When the direction option is <code>UBIDI_DEFAULT_LTR</code> or
- * <code>UBIDI_DEFAULT_RTL</code>, resolve the base direction according to that
- * of the first strong bidi character.
- */
-static void
-resolveBaseDirection(const UChar *text, uint32_t length,
- UBiDiLevel *pInLevel, UBiDiLevel *pOutLevel)
-{
- switch (*pInLevel) {
- case UBIDI_DEFAULT_LTR:
- case UBIDI_DEFAULT_RTL: {
- UBiDiLevel level = static_cast<UBiDiLevel>(ubidi_getBaseDirection(text, length));
- *pInLevel = static_cast<UBiDiLevel>(level != UBIDI_NEUTRAL) ? level
- : *pInLevel == UBIDI_DEFAULT_RTL ? static_cast<UBiDiLevel>(RTL) : static_cast<UBiDiLevel>(LTR);
- break;
- }
- default:
- *pInLevel &= 1;
- break;
- }
- switch (*pOutLevel) {
- case UBIDI_DEFAULT_LTR:
- case UBIDI_DEFAULT_RTL:
- *pOutLevel = *pInLevel;
- break;
- default:
- *pOutLevel &= 1;
- break;
- }
-}
-
-/**
- * Finds a valid <code>ReorderingScheme</code> matching the
- * caller-defined scheme.
- *
- * @return A valid <code>ReorderingScheme</code> object or NULL
- */
-static const ReorderingScheme*
-findMatchingScheme(UBiDiLevel inLevel, UBiDiLevel outLevel,
- UBiDiOrder inOrder, UBiDiOrder outOrder)
-{
- uint32_t i;
- for (i = 0; i < nSchemes; i++) {
- const ReorderingScheme *pScheme = Schemes + i;
- if (inLevel == pScheme->inLevel && outLevel == pScheme->outLevel
- && inOrder == pScheme->inOrder && outOrder == pScheme->outOrder) {
- return pScheme;
- }
- }
- return NULL;
-}
-
-U_DRAFT uint32_t U_EXPORT2
-ubiditransform_transform(UBiDiTransform *pBiDiTransform,
- const UChar *src, int32_t srcLength,
- UChar *dest, int32_t destSize,
- UBiDiLevel inParaLevel, UBiDiOrder inOrder,
- UBiDiLevel outParaLevel, UBiDiOrder outOrder,
- UBiDiMirroring doMirroring, uint32_t shapingOptions,
- UErrorCode *pErrorCode)
-{
- uint32_t destLength = 0;
- UBool textChanged = FALSE;
- const UBiDiTransform *pOrigTransform = pBiDiTransform;
- const UBiDiAction *action = NULL;
-
- if (U_FAILURE(*pErrorCode)) {
- return 0;
- }
- if (src == NULL || dest == NULL) {
- *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
- CHECK_LEN(src, srcLength, pErrorCode);
- CHECK_LEN(dest, destSize, pErrorCode);
-
- if (pBiDiTransform == NULL) {
- pBiDiTransform = ubiditransform_open(pErrorCode);
- if (U_FAILURE(*pErrorCode)) {
- return 0;
- }
- }
- /* Current limitation: in multiple paragraphs will be resolved according
- to the 1st paragraph */
- resolveBaseDirection(src, srcLength, &inParaLevel, &outParaLevel);
-
- pBiDiTransform->pActiveScheme = findMatchingScheme(inParaLevel, outParaLevel,
- inOrder, outOrder);
- if (pBiDiTransform->pActiveScheme == NULL) {
- goto cleanup;
- }
- pBiDiTransform->reorderingOptions = doMirroring ? UBIDI_DO_MIRRORING
- : UBIDI_REORDER_DEFAULT;
-
- /* Ignore TEXT_DIRECTION_* flags, as we apply our own depending on the text
- scheme at the time shaping is invoked. */
- shapingOptions &= ~U_SHAPE_TEXT_DIRECTION_MASK;
- pBiDiTransform->digits = shapingOptions & ~U_SHAPE_LETTERS_MASK;
- pBiDiTransform->letters = shapingOptions & ~U_SHAPE_DIGITS_MASK;
-
- updateSrc(pBiDiTransform, src, srcLength, destSize > srcLength ? destSize : srcLength, pErrorCode);
- if (U_FAILURE(*pErrorCode)) {
- goto cleanup;
- }
- if (pBiDiTransform->pBidi == NULL) {
- pBiDiTransform->pBidi = ubidi_openSized(0, 0, pErrorCode);
- if (U_FAILURE(*pErrorCode)) {
- goto cleanup;
- }
- }
- pBiDiTransform->dest = dest;
- pBiDiTransform->destSize = destSize;
- pBiDiTransform->pDestLength = &destLength;
-
- /* Checking for U_SUCCESS() within the loop to bail out on first failure. */
- for (action = pBiDiTransform->pActiveScheme->actions; *action && U_SUCCESS(*pErrorCode); action++) {
- if ((*action)(pBiDiTransform, pErrorCode)) {
- if (action + 1) {
- updateSrc(pBiDiTransform, pBiDiTransform->dest, *pBiDiTransform->pDestLength,
- *pBiDiTransform->pDestLength, pErrorCode);
- }
- textChanged = TRUE;
- }
- }
- ubidi_setInverse(pBiDiTransform->pBidi, FALSE);
-
- if (!textChanged && U_SUCCESS(*pErrorCode)) {
- /* Text was not changed - just copy src to dest */
- if (destSize < srcLength) {
- *pErrorCode = U_BUFFER_OVERFLOW_ERROR;
- } else {
- u_strncpy(dest, src, srcLength);
- destLength = srcLength;
- }
- }
-cleanup:
- if (pOrigTransform != pBiDiTransform) {
- ubiditransform_close(pBiDiTransform);
- } else {
- pBiDiTransform->dest = NULL;
- pBiDiTransform->pDestLength = NULL;
- pBiDiTransform->srcLength = 0;
- pBiDiTransform->destSize = 0;
- }
- return U_FAILURE(*pErrorCode) ? 0 : destLength;
-}
+ * @param pTransform Pointer to the <code>UBiDiTransform</code> structure.
+ * @param pErrorCode Pointer to the error code value.
+ *
+ * @return Whether or not this function modifies the text. Besides the return
+ * value, the caller should also check <code>U_SUCCESS(*pErrorCode)</code>.
+ */
+static UBool
+action_shapeArabic(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
+{
+ if ((pTransform->letters | pTransform->digits) == 0) {
+ return FALSE;
+ }
+ if (pTransform->pActiveScheme->lettersDir == pTransform->pActiveScheme->digitsDir) {
+ doShape(pTransform, pTransform->letters | pTransform->digits | pTransform->pActiveScheme->lettersDir,
+ pErrorCode);
+ } else {
+ doShape(pTransform, pTransform->digits | pTransform->pActiveScheme->digitsDir, pErrorCode);
+ if (U_SUCCESS(*pErrorCode)) {
+ updateSrc(pTransform, pTransform->dest, *pTransform->pDestLength,
+ *pTransform->pDestLength, pErrorCode);
+ doShape(pTransform, pTransform->letters | pTransform->pActiveScheme->lettersDir,
+ pErrorCode);
+ }
+ }
+ return TRUE;
+}
+
+/**
+ * Performs character mirroring.
+ *
+ * @param pTransform Pointer to the <code>UBiDiTransform</code> structure.
+ * @param pErrorCode Pointer to the error code value.
+ *
+ * @return Whether or not this function modifies the text. Besides the return
+ * value, the caller should also check <code>U_SUCCESS(*pErrorCode)</code>.
+ */
+static UBool
+action_mirror(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
+{
+ UChar32 c;
+ uint32_t i = 0, j = 0;
+ if (0 == (pTransform->reorderingOptions & UBIDI_DO_MIRRORING)) {
+ return FALSE;
+ }
+ if (pTransform->destSize < pTransform->srcLength) {
+ *pErrorCode = U_BUFFER_OVERFLOW_ERROR;
+ return FALSE;
+ }
+ do {
+ UBool isOdd = ubidi_getLevelAt(pTransform->pBidi, i) & 1;
+ U16_NEXT(pTransform->src, i, pTransform->srcLength, c);
+ U16_APPEND_UNSAFE(pTransform->dest, j, isOdd ? u_charMirror(c) : c);
+ } while (i < pTransform->srcLength);
+
+ *pTransform->pDestLength = pTransform->srcLength;
+ pTransform->reorderingOptions = UBIDI_REORDER_DEFAULT;
+ return TRUE;
+}
+
+/**
+ * All possible reordering schemes.
+ *
+ */
+static const ReorderingScheme Schemes[] =
+{
+ /* 0: Logical LTR => Visual LTR */
+ {LTR, LOGICAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
+ {action_shapeArabic, action_resolve, action_reorder, NULL}},
+ /* 1: Logical RTL => Visual LTR */
+ {RTL, LOGICAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL,
+ {action_resolve, action_reorder, action_shapeArabic, NULL}},
+ /* 2: Logical LTR => Visual RTL */
+ {LTR, LOGICAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
+ {action_shapeArabic, action_resolve, action_reorder, action_reverse, NULL}},
+ /* 3: Logical RTL => Visual RTL */
+ {RTL, LOGICAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL,
+ {action_resolve, action_reorder, action_shapeArabic, action_reverse, NULL}},
+ /* 4: Visual LTR => Logical RTL */
+ {LTR, VISUAL, RTL, LOGICAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL,
+ {action_shapeArabic, action_setInverse, action_resolve, action_reorder, NULL}},
+ /* 5: Visual RTL => Logical RTL */
+ {RTL, VISUAL, RTL, LOGICAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL,
+ {action_reverse, action_shapeArabic, action_setInverse, action_resolve, action_reorder, NULL}},
+ /* 6: Visual LTR => Logical LTR */
+ {LTR, VISUAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
+ {action_setInverse, action_resolve, action_reorder, action_shapeArabic, NULL}},
+ /* 7: Visual RTL => Logical LTR */
+ {RTL, VISUAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
+ {action_reverse, action_setInverse, action_resolve, action_reorder, action_shapeArabic, NULL}},
+ /* 8: Logical LTR => Logical RTL */
+ {LTR, LOGICAL, RTL, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
+ {action_shapeArabic, action_resolve, action_mirror, action_setRunsOnly, action_resolve, action_reorder, NULL}},
+ /* 9: Logical RTL => Logical LTR */
+ {RTL, LOGICAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, RTL,
+ {action_resolve, action_mirror, action_setRunsOnly, action_resolve, action_reorder, action_shapeArabic, NULL}},
+ /* 10: Visual LTR => Visual RTL */
+ {LTR, VISUAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR,
+ {action_shapeArabic, action_setInverse, action_resolve, action_mirror, action_reverse, NULL}},
+ /* 11: Visual RTL => Visual LTR */
+ {RTL, VISUAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR,
+ {action_reverse, action_shapeArabic, action_setInverse, action_resolve, action_mirror, NULL}},
+ /* 12: Logical LTR => Logical LTR */
+ {LTR, LOGICAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
+ {action_resolve, action_mirror, action_shapeArabic, NULL}},
+ /* 13: Logical RTL => Logical RTL */
+ {RTL, LOGICAL, RTL, LOGICAL, SHAPE_VISUAL, SHAPE_LOGICAL, RTL,
+ {action_resolve, action_mirror, action_shapeArabic, NULL}},
+ /* 14: Visual LTR => Visual LTR */
+ {LTR, VISUAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR,
+ {action_resolve, action_mirror, action_shapeArabic, NULL}},
+ /* 15: Visual RTL => Visual RTL */
+ {RTL, VISUAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR,
+ {action_reverse, action_resolve, action_mirror, action_shapeArabic, action_reverse, NULL}}
+};
+
+static const uint32_t nSchemes = sizeof(Schemes) / sizeof(*Schemes);
+
+/**
+ * When the direction option is <code>UBIDI_DEFAULT_LTR</code> or
+ * <code>UBIDI_DEFAULT_RTL</code>, resolve the base direction according to that
+ * of the first strong bidi character.
+ */
+static void
+resolveBaseDirection(const UChar *text, uint32_t length,
+ UBiDiLevel *pInLevel, UBiDiLevel *pOutLevel)
+{
+ switch (*pInLevel) {
+ case UBIDI_DEFAULT_LTR:
+ case UBIDI_DEFAULT_RTL: {
+ UBiDiLevel level = static_cast<UBiDiLevel>(ubidi_getBaseDirection(text, length));
+ *pInLevel = static_cast<UBiDiLevel>(level != UBIDI_NEUTRAL) ? level
+ : *pInLevel == UBIDI_DEFAULT_RTL ? static_cast<UBiDiLevel>(RTL) : static_cast<UBiDiLevel>(LTR);
+ break;
+ }
+ default:
+ *pInLevel &= 1;
+ break;
+ }
+ switch (*pOutLevel) {
+ case UBIDI_DEFAULT_LTR:
+ case UBIDI_DEFAULT_RTL:
+ *pOutLevel = *pInLevel;
+ break;
+ default:
+ *pOutLevel &= 1;
+ break;
+ }
+}
+
+/**
+ * Finds a valid <code>ReorderingScheme</code> matching the
+ * caller-defined scheme.
+ *
+ * @return A valid <code>ReorderingScheme</code> object or NULL
+ */
+static const ReorderingScheme*
+findMatchingScheme(UBiDiLevel inLevel, UBiDiLevel outLevel,
+ UBiDiOrder inOrder, UBiDiOrder outOrder)
+{
+ uint32_t i;
+ for (i = 0; i < nSchemes; i++) {
+ const ReorderingScheme *pScheme = Schemes + i;
+ if (inLevel == pScheme->inLevel && outLevel == pScheme->outLevel
+ && inOrder == pScheme->inOrder && outOrder == pScheme->outOrder) {
+ return pScheme;
+ }
+ }
+ return NULL;
+}
+
+U_DRAFT uint32_t U_EXPORT2
+ubiditransform_transform(UBiDiTransform *pBiDiTransform,
+ const UChar *src, int32_t srcLength,
+ UChar *dest, int32_t destSize,
+ UBiDiLevel inParaLevel, UBiDiOrder inOrder,
+ UBiDiLevel outParaLevel, UBiDiOrder outOrder,
+ UBiDiMirroring doMirroring, uint32_t shapingOptions,
+ UErrorCode *pErrorCode)
+{
+ uint32_t destLength = 0;
+ UBool textChanged = FALSE;
+ const UBiDiTransform *pOrigTransform = pBiDiTransform;
+ const UBiDiAction *action = NULL;
+
+ if (U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ if (src == NULL || dest == NULL) {
+ *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+ CHECK_LEN(src, srcLength, pErrorCode);
+ CHECK_LEN(dest, destSize, pErrorCode);
+
+ if (pBiDiTransform == NULL) {
+ pBiDiTransform = ubiditransform_open(pErrorCode);
+ if (U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ }
+ /* Current limitation: in multiple paragraphs will be resolved according
+ to the 1st paragraph */
+ resolveBaseDirection(src, srcLength, &inParaLevel, &outParaLevel);
+
+ pBiDiTransform->pActiveScheme = findMatchingScheme(inParaLevel, outParaLevel,
+ inOrder, outOrder);
+ if (pBiDiTransform->pActiveScheme == NULL) {
+ goto cleanup;
+ }
+ pBiDiTransform->reorderingOptions = doMirroring ? UBIDI_DO_MIRRORING
+ : UBIDI_REORDER_DEFAULT;
+
+ /* Ignore TEXT_DIRECTION_* flags, as we apply our own depending on the text
+ scheme at the time shaping is invoked. */
+ shapingOptions &= ~U_SHAPE_TEXT_DIRECTION_MASK;
+ pBiDiTransform->digits = shapingOptions & ~U_SHAPE_LETTERS_MASK;
+ pBiDiTransform->letters = shapingOptions & ~U_SHAPE_DIGITS_MASK;
+
+ updateSrc(pBiDiTransform, src, srcLength, destSize > srcLength ? destSize : srcLength, pErrorCode);
+ if (U_FAILURE(*pErrorCode)) {
+ goto cleanup;
+ }
+ if (pBiDiTransform->pBidi == NULL) {
+ pBiDiTransform->pBidi = ubidi_openSized(0, 0, pErrorCode);
+ if (U_FAILURE(*pErrorCode)) {
+ goto cleanup;
+ }
+ }
+ pBiDiTransform->dest = dest;
+ pBiDiTransform->destSize = destSize;
+ pBiDiTransform->pDestLength = &destLength;
+
+ /* Checking for U_SUCCESS() within the loop to bail out on first failure. */
+ for (action = pBiDiTransform->pActiveScheme->actions; *action && U_SUCCESS(*pErrorCode); action++) {
+ if ((*action)(pBiDiTransform, pErrorCode)) {
+ if (action + 1) {
+ updateSrc(pBiDiTransform, pBiDiTransform->dest, *pBiDiTransform->pDestLength,
+ *pBiDiTransform->pDestLength, pErrorCode);
+ }
+ textChanged = TRUE;
+ }
+ }
+ ubidi_setInverse(pBiDiTransform->pBidi, FALSE);
+
+ if (!textChanged && U_SUCCESS(*pErrorCode)) {
+ /* Text was not changed - just copy src to dest */
+ if (destSize < srcLength) {
+ *pErrorCode = U_BUFFER_OVERFLOW_ERROR;
+ } else {
+ u_strncpy(dest, src, srcLength);
+ destLength = srcLength;
+ }
+ }
+cleanup:
+ if (pOrigTransform != pBiDiTransform) {
+ ubiditransform_close(pBiDiTransform);
+ } else {
+ pBiDiTransform->dest = NULL;
+ pBiDiTransform->pDestLength = NULL;
+ pBiDiTransform->srcLength = 0;
+ pBiDiTransform->destSize = 0;
+ }
+ return U_FAILURE(*pErrorCode) ? 0 : destLength;
+}
diff --git a/contrib/libs/icu/common/ubidiwrt.cpp b/contrib/libs/icu/common/ubidiwrt.cpp
index abb1cb40d4..a69c0a4b8b 100644
--- a/contrib/libs/icu/common/ubidiwrt.cpp
+++ b/contrib/libs/icu/common/ubidiwrt.cpp
@@ -1,650 +1,650 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 2000-2015, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-* file name: ubidiwrt.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 1999aug06
-* created by: Markus W. Scherer, updated by Matitiahu Allouche
-*
-* This file contains implementations for BiDi functions that use
-* the core algorithm and core API to write reordered text.
-*/
-
-#include "unicode/utypes.h"
-#include "unicode/ustring.h"
-#include "unicode/uchar.h"
-#include "unicode/ubidi.h"
-#include "unicode/utf16.h"
-#include "cmemory.h"
-#include "ustr_imp.h"
-#include "ubidiimp.h"
-
-/*
- * The function implementations in this file are designed
- * for UTF-16 and UTF-32, not for UTF-8.
- *
- * Assumptions that are not true for UTF-8:
- * - Any code point always needs the same number of code units
- * ("minimum-length-problem" of UTF-8)
- * - The BiDi control characters need only one code unit each
- *
- * Further assumptions for all UTFs:
- * - u_charMirror(c) needs the same number of code units as c
- */
-#if defined(UTF_SIZE) && UTF_SIZE==8
-# error reimplement ubidi_writeReordered() for UTF-8, see comment above
-#endif
-
-#define IS_COMBINING(type) ((1UL<<(type))&(1UL<<U_NON_SPACING_MARK|1UL<<U_COMBINING_SPACING_MARK|1UL<<U_ENCLOSING_MARK))
-
-/*
- * When we have UBIDI_OUTPUT_REVERSE set on ubidi_writeReordered(), then we
- * semantically write RTL runs in reverse and later reverse them again.
- * Instead, we actually write them in forward order to begin with.
- * However, if the RTL run was to be mirrored, we need to mirror here now
- * since the implicit second reversal must not do it.
- * It looks strange to do mirroring in LTR output, but it is only because
- * we are writing RTL output in reverse.
- */
-static int32_t
-doWriteForward(const UChar *src, int32_t srcLength,
- UChar *dest, int32_t destSize,
- uint16_t options,
- UErrorCode *pErrorCode) {
- /* optimize for several combinations of options */
- switch(options&(UBIDI_REMOVE_BIDI_CONTROLS|UBIDI_DO_MIRRORING)) {
- case 0: {
- /* simply copy the LTR run to the destination */
- int32_t length=srcLength;
- if(destSize<length) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- return srcLength;
- }
- do {
- *dest++=*src++;
- } while(--length>0);
- return srcLength;
- }
- case UBIDI_DO_MIRRORING: {
- /* do mirroring */
- int32_t i=0, j=0;
- UChar32 c;
-
- if(destSize<srcLength) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- return srcLength;
- }
- do {
- U16_NEXT(src, i, srcLength, c);
- c=u_charMirror(c);
- U16_APPEND_UNSAFE(dest, j, c);
- } while(i<srcLength);
- return srcLength;
- }
- case UBIDI_REMOVE_BIDI_CONTROLS: {
- /* copy the LTR run and remove any BiDi control characters */
- int32_t remaining=destSize;
- UChar c;
- do {
- c=*src++;
- if(!IS_BIDI_CONTROL_CHAR(c)) {
- if(--remaining<0) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
-
- /* preflight the length */
- while(--srcLength>0) {
- c=*src++;
- if(!IS_BIDI_CONTROL_CHAR(c)) {
- --remaining;
- }
- }
- return destSize-remaining;
- }
- *dest++=c;
- }
- } while(--srcLength>0);
- return destSize-remaining;
- }
- default: {
- /* remove BiDi control characters and do mirroring */
- int32_t remaining=destSize;
- int32_t i, j=0;
- UChar32 c;
- do {
- i=0;
- U16_NEXT(src, i, srcLength, c);
- src+=i;
- srcLength-=i;
- if(!IS_BIDI_CONTROL_CHAR(c)) {
- remaining-=i;
- if(remaining<0) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
-
- /* preflight the length */
- while(srcLength>0) {
- c=*src++;
- if(!IS_BIDI_CONTROL_CHAR(c)) {
- --remaining;
- }
- --srcLength;
- }
- return destSize-remaining;
- }
- c=u_charMirror(c);
- U16_APPEND_UNSAFE(dest, j, c);
- }
- } while(srcLength>0);
- return j;
- }
- } /* end of switch */
-}
-
-static int32_t
-doWriteReverse(const UChar *src, int32_t srcLength,
- UChar *dest, int32_t destSize,
- uint16_t options,
- UErrorCode *pErrorCode) {
- /*
- * RTL run -
- *
- * RTL runs need to be copied to the destination in reverse order
- * of code points, not code units, to keep Unicode characters intact.
- *
- * The general strategy for this is to read the source text
- * in backward order, collect all code units for a code point
- * (and optionally following combining characters, see below),
- * and copy all these code units in ascending order
- * to the destination for this run.
- *
- * Several options request whether combining characters
- * should be kept after their base characters,
- * whether BiDi control characters should be removed, and
- * whether characters should be replaced by their mirror-image
- * equivalent Unicode characters.
- */
- int32_t i, j;
- UChar32 c;
-
- /* optimize for several combinations of options */
- switch(options&(UBIDI_REMOVE_BIDI_CONTROLS|UBIDI_DO_MIRRORING|UBIDI_KEEP_BASE_COMBINING)) {
- case 0:
- /*
- * With none of the "complicated" options set, the destination
- * run will have the same length as the source run,
- * and there is no mirroring and no keeping combining characters
- * with their base characters.
- */
- if(destSize<srcLength) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- return srcLength;
- }
- destSize=srcLength;
-
- /* preserve character integrity */
- do {
- /* i is always after the last code unit known to need to be kept in this segment */
- i=srcLength;
-
- /* collect code units for one base character */
- U16_BACK_1(src, 0, srcLength);
-
- /* copy this base character */
- j=srcLength;
- do {
- *dest++=src[j++];
- } while(j<i);
- } while(srcLength>0);
- break;
- case UBIDI_KEEP_BASE_COMBINING:
- /*
- * Here, too, the destination
- * run will have the same length as the source run,
- * and there is no mirroring.
- * We do need to keep combining characters with their base characters.
- */
- if(destSize<srcLength) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- return srcLength;
- }
- destSize=srcLength;
-
- /* preserve character integrity */
- do {
- /* i is always after the last code unit known to need to be kept in this segment */
- i=srcLength;
-
- /* collect code units and modifier letters for one base character */
- do {
- U16_PREV(src, 0, srcLength, c);
- } while(srcLength>0 && IS_COMBINING(u_charType(c)));
-
- /* copy this "user character" */
- j=srcLength;
- do {
- *dest++=src[j++];
- } while(j<i);
- } while(srcLength>0);
- break;
- default:
- /*
- * With several "complicated" options set, this is the most
- * general and the slowest copying of an RTL run.
- * We will do mirroring, remove BiDi controls, and
- * keep combining characters with their base characters
- * as requested.
- */
- if(!(options&UBIDI_REMOVE_BIDI_CONTROLS)) {
- i=srcLength;
- } else {
- /* we need to find out the destination length of the run,
- which will not include the BiDi control characters */
- int32_t length=srcLength;
- UChar ch;
-
- i=0;
- do {
- ch=*src++;
- if(!IS_BIDI_CONTROL_CHAR(ch)) {
- ++i;
- }
- } while(--length>0);
- src-=srcLength;
- }
-
- if(destSize<i) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- return i;
- }
- destSize=i;
-
- /* preserve character integrity */
- do {
- /* i is always after the last code unit known to need to be kept in this segment */
- i=srcLength;
-
- /* collect code units for one base character */
- U16_PREV(src, 0, srcLength, c);
- if(options&UBIDI_KEEP_BASE_COMBINING) {
- /* collect modifier letters for this base character */
- while(srcLength>0 && IS_COMBINING(u_charType(c))) {
- U16_PREV(src, 0, srcLength, c);
- }
- }
-
- if(options&UBIDI_REMOVE_BIDI_CONTROLS && IS_BIDI_CONTROL_CHAR(c)) {
- /* do not copy this BiDi control character */
- continue;
- }
-
- /* copy this "user character" */
- j=srcLength;
- if(options&UBIDI_DO_MIRRORING) {
- /* mirror only the base character */
- int32_t k=0;
- c=u_charMirror(c);
- U16_APPEND_UNSAFE(dest, k, c);
- dest+=k;
- j+=k;
- }
- while(j<i) {
- *dest++=src[j++];
- }
- } while(srcLength>0);
- break;
- } /* end of switch */
-
- return destSize;
-}
-
-U_CAPI int32_t U_EXPORT2
-ubidi_writeReverse(const UChar *src, int32_t srcLength,
- UChar *dest, int32_t destSize,
- uint16_t options,
- UErrorCode *pErrorCode) {
- int32_t destLength;
-
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
-
- /* more error checking */
- if( src==NULL || srcLength<-1 ||
- destSize<0 || (destSize>0 && dest==NULL))
- {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* do input and output overlap? */
- if( dest!=NULL &&
- ((src>=dest && src<dest+destSize) ||
- (dest>=src && dest<src+srcLength)))
- {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- if(srcLength==-1) {
- srcLength=u_strlen(src);
- }
- if(srcLength>0) {
- destLength=doWriteReverse(src, srcLength, dest, destSize, options, pErrorCode);
- } else {
- /* nothing to do */
- destLength=0;
- }
-
- return u_terminateUChars(dest, destSize, destLength, pErrorCode);
-}
-
-// Ticket 20907 - The optimizer in MSVC/Visual Studio versions below 16.4 has trouble with this
-// function on Windows ARM64. As a work-around, we disable optimizations for this function.
-// This work-around could/should be removed once the following versions of Visual Studio are no
-// longer supported: All versions of VS2017, and versions of VS2019 below 16.4.
-#if (defined(_MSC_VER) && (defined(_M_ARM64)) && (_MSC_VER < 1924))
-#pragma optimize( "", off )
-#endif
-U_CAPI int32_t U_EXPORT2
-ubidi_writeReordered(UBiDi *pBiDi,
- UChar *dest, int32_t destSize,
- uint16_t options,
- UErrorCode *pErrorCode) {
- const UChar *text;
- UChar *saveDest;
- int32_t length, destCapacity;
- int32_t run, runCount, logicalStart, runLength;
-
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
-
- /* more error checking */
- if( pBiDi==NULL ||
- (text=pBiDi->text)==NULL || (length=pBiDi->length)<0 ||
- destSize<0 || (destSize>0 && dest==NULL))
- {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* do input and output overlap? */
- if( dest!=NULL &&
- ((text>=dest && text<dest+destSize) ||
- (dest>=text && dest<text+pBiDi->originalLength)))
- {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- if(length==0) {
- /* nothing to do */
- return u_terminateUChars(dest, destSize, 0, pErrorCode);
- }
-
- runCount=ubidi_countRuns(pBiDi, pErrorCode);
- if(U_FAILURE(*pErrorCode)) {
- return 0;
- }
-
- /* destSize shrinks, later destination length=destCapacity-destSize */
- saveDest=dest;
- destCapacity=destSize;
-
- /*
- * Option "insert marks" implies UBIDI_INSERT_LRM_FOR_NUMERIC if the
- * reordering mode (checked below) is appropriate.
- */
- if(pBiDi->reorderingOptions & UBIDI_OPTION_INSERT_MARKS) {
- options|=UBIDI_INSERT_LRM_FOR_NUMERIC;
- options&=~UBIDI_REMOVE_BIDI_CONTROLS;
- }
- /*
- * Option "remove controls" implies UBIDI_REMOVE_BIDI_CONTROLS
- * and cancels UBIDI_INSERT_LRM_FOR_NUMERIC.
- */
- if(pBiDi->reorderingOptions & UBIDI_OPTION_REMOVE_CONTROLS) {
- options|=UBIDI_REMOVE_BIDI_CONTROLS;
- options&=~UBIDI_INSERT_LRM_FOR_NUMERIC;
- }
- /*
- * If we do not perform the "inverse BiDi" algorithm, then we
- * don't need to insert any LRMs, and don't need to test for it.
- */
- if((pBiDi->reorderingMode != UBIDI_REORDER_INVERSE_NUMBERS_AS_L) &&
- (pBiDi->reorderingMode != UBIDI_REORDER_INVERSE_LIKE_DIRECT) &&
- (pBiDi->reorderingMode != UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL) &&
- (pBiDi->reorderingMode != UBIDI_REORDER_RUNS_ONLY)) {
- options&=~UBIDI_INSERT_LRM_FOR_NUMERIC;
- }
- /*
- * Iterate through all visual runs and copy the run text segments to
- * the destination, according to the options.
- *
- * The tests for where to insert LRMs ignore the fact that there may be
- * BN codes or non-BMP code points at the beginning and end of a run;
- * they may insert LRMs unnecessarily but the tests are faster this way
- * (this would have to be improved for UTF-8).
- *
- * Note that the only errors that are set by doWriteXY() are buffer overflow
- * errors. Ignore them until the end, and continue for preflighting.
- */
- if(!(options&UBIDI_OUTPUT_REVERSE)) {
- /* forward output */
- if(!(options&UBIDI_INSERT_LRM_FOR_NUMERIC)) {
- /* do not insert BiDi controls */
- for(run=0; run<runCount; ++run) {
- if(UBIDI_LTR==ubidi_getVisualRun(pBiDi, run, &logicalStart, &runLength)) {
- runLength=doWriteForward(text+logicalStart, runLength,
- dest, destSize,
- (uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode);
- } else {
- runLength=doWriteReverse(text+logicalStart, runLength,
- dest, destSize,
- options, pErrorCode);
- }
- if(dest!=NULL) {
- dest+=runLength;
- }
- destSize-=runLength;
- }
- } else {
- /* insert BiDi controls for "inverse BiDi" */
- const DirProp *dirProps=pBiDi->dirProps;
- const UChar *src;
- UChar uc;
- UBiDiDirection dir;
- int32_t markFlag;
-
- for(run=0; run<runCount; ++run) {
- dir=ubidi_getVisualRun(pBiDi, run, &logicalStart, &runLength);
- src=text+logicalStart;
- /* check if something relevant in insertPoints */
- markFlag=pBiDi->runs[run].insertRemove;
- if(markFlag<0) { /* BiDi controls count */
- markFlag=0;
- }
-
- if(UBIDI_LTR==dir) {
- if((pBiDi->isInverse) &&
- (/*run>0 &&*/ dirProps[logicalStart]!=L)) {
- markFlag |= LRM_BEFORE;
- }
- if (markFlag & LRM_BEFORE) {
- uc=LRM_CHAR;
- }
- else if (markFlag & RLM_BEFORE) {
- uc=RLM_CHAR;
- }
- else uc=0;
- if(uc) {
- if(destSize>0) {
- *dest++=uc;
- }
- --destSize;
- }
-
- runLength=doWriteForward(src, runLength,
- dest, destSize,
- (uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode);
- if(dest!=NULL) {
- dest+=runLength;
- }
- destSize-=runLength;
-
- if((pBiDi->isInverse) &&
- (/*run<runCount-1 &&*/ dirProps[logicalStart+runLength-1]!=L)) {
- markFlag |= LRM_AFTER;
- }
- if (markFlag & LRM_AFTER) {
- uc=LRM_CHAR;
- }
- else if (markFlag & RLM_AFTER) {
- uc=RLM_CHAR;
- }
- else uc=0;
- if(uc) {
- if(destSize>0) {
- *dest++=uc;
- }
- --destSize;
- }
- } else { /* RTL run */
- if((pBiDi->isInverse) &&
- (/*run>0 &&*/ !(MASK_R_AL&DIRPROP_FLAG(dirProps[logicalStart+runLength-1])))) {
- markFlag |= RLM_BEFORE;
- }
- if (markFlag & LRM_BEFORE) {
- uc=LRM_CHAR;
- }
- else if (markFlag & RLM_BEFORE) {
- uc=RLM_CHAR;
- }
- else uc=0;
- if(uc) {
- if(destSize>0) {
- *dest++=uc;
- }
- --destSize;
- }
-
- runLength=doWriteReverse(src, runLength,
- dest, destSize,
- options, pErrorCode);
- if(dest!=NULL) {
- dest+=runLength;
- }
- destSize-=runLength;
-
- if((pBiDi->isInverse) &&
- (/*run<runCount-1 &&*/ !(MASK_R_AL&DIRPROP_FLAG(dirProps[logicalStart])))) {
- markFlag |= RLM_AFTER;
- }
- if (markFlag & LRM_AFTER) {
- uc=LRM_CHAR;
- }
- else if (markFlag & RLM_AFTER) {
- uc=RLM_CHAR;
- }
- else uc=0;
- if(uc) {
- if(destSize>0) {
- *dest++=uc;
- }
- --destSize;
- }
- }
- }
- }
- } else {
- /* reverse output */
- if(!(options&UBIDI_INSERT_LRM_FOR_NUMERIC)) {
- /* do not insert BiDi controls */
- for(run=runCount; --run>=0;) {
- if(UBIDI_LTR==ubidi_getVisualRun(pBiDi, run, &logicalStart, &runLength)) {
- runLength=doWriteReverse(text+logicalStart, runLength,
- dest, destSize,
- (uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode);
- } else {
- runLength=doWriteForward(text+logicalStart, runLength,
- dest, destSize,
- options, pErrorCode);
- }
- if(dest!=NULL) {
- dest+=runLength;
- }
- destSize-=runLength;
- }
- } else {
- /* insert BiDi controls for "inverse BiDi" */
- const DirProp *dirProps=pBiDi->dirProps;
- const UChar *src;
- UBiDiDirection dir;
-
- for(run=runCount; --run>=0;) {
- /* reverse output */
- dir=ubidi_getVisualRun(pBiDi, run, &logicalStart, &runLength);
- src=text+logicalStart;
-
- if(UBIDI_LTR==dir) {
- if(/*run<runCount-1 &&*/ dirProps[logicalStart+runLength-1]!=L) {
- if(destSize>0) {
- *dest++=LRM_CHAR;
- }
- --destSize;
- }
-
- runLength=doWriteReverse(src, runLength,
- dest, destSize,
- (uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode);
- if(dest!=NULL) {
- dest+=runLength;
- }
- destSize-=runLength;
-
- if(/*run>0 &&*/ dirProps[logicalStart]!=L) {
- if(destSize>0) {
- *dest++=LRM_CHAR;
- }
- --destSize;
- }
- } else {
- if(/*run<runCount-1 &&*/ !(MASK_R_AL&DIRPROP_FLAG(dirProps[logicalStart]))) {
- if(destSize>0) {
- *dest++=RLM_CHAR;
- }
- --destSize;
- }
-
- runLength=doWriteForward(src, runLength,
- dest, destSize,
- options, pErrorCode);
- if(dest!=NULL) {
- dest+=runLength;
- }
- destSize-=runLength;
-
- if(/*run>0 &&*/ !(MASK_R_AL&DIRPROP_FLAG(dirProps[logicalStart+runLength-1]))) {
- if(destSize>0) {
- *dest++=RLM_CHAR;
- }
- --destSize;
- }
- }
- }
- }
- }
-
- return u_terminateUChars(saveDest, destCapacity, destCapacity-destSize, pErrorCode);
-}
-#if (defined(_MSC_VER) && (defined(_M_ARM64)) && (_MSC_VER < 1924))
-#pragma optimize( "", on )
-#endif
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 2000-2015, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+* file name: ubidiwrt.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 1999aug06
+* created by: Markus W. Scherer, updated by Matitiahu Allouche
+*
+* This file contains implementations for BiDi functions that use
+* the core algorithm and core API to write reordered text.
+*/
+
+#include "unicode/utypes.h"
+#include "unicode/ustring.h"
+#include "unicode/uchar.h"
+#include "unicode/ubidi.h"
+#include "unicode/utf16.h"
+#include "cmemory.h"
+#include "ustr_imp.h"
+#include "ubidiimp.h"
+
+/*
+ * The function implementations in this file are designed
+ * for UTF-16 and UTF-32, not for UTF-8.
+ *
+ * Assumptions that are not true for UTF-8:
+ * - Any code point always needs the same number of code units
+ * ("minimum-length-problem" of UTF-8)
+ * - The BiDi control characters need only one code unit each
+ *
+ * Further assumptions for all UTFs:
+ * - u_charMirror(c) needs the same number of code units as c
+ */
+#if defined(UTF_SIZE) && UTF_SIZE==8
+# error reimplement ubidi_writeReordered() for UTF-8, see comment above
+#endif
+
+#define IS_COMBINING(type) ((1UL<<(type))&(1UL<<U_NON_SPACING_MARK|1UL<<U_COMBINING_SPACING_MARK|1UL<<U_ENCLOSING_MARK))
+
+/*
+ * When we have UBIDI_OUTPUT_REVERSE set on ubidi_writeReordered(), then we
+ * semantically write RTL runs in reverse and later reverse them again.
+ * Instead, we actually write them in forward order to begin with.
+ * However, if the RTL run was to be mirrored, we need to mirror here now
+ * since the implicit second reversal must not do it.
+ * It looks strange to do mirroring in LTR output, but it is only because
+ * we are writing RTL output in reverse.
+ */
+static int32_t
+doWriteForward(const UChar *src, int32_t srcLength,
+ UChar *dest, int32_t destSize,
+ uint16_t options,
+ UErrorCode *pErrorCode) {
+ /* optimize for several combinations of options */
+ switch(options&(UBIDI_REMOVE_BIDI_CONTROLS|UBIDI_DO_MIRRORING)) {
+ case 0: {
+ /* simply copy the LTR run to the destination */
+ int32_t length=srcLength;
+ if(destSize<length) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ return srcLength;
+ }
+ do {
+ *dest++=*src++;
+ } while(--length>0);
+ return srcLength;
+ }
+ case UBIDI_DO_MIRRORING: {
+ /* do mirroring */
+ int32_t i=0, j=0;
+ UChar32 c;
+
+ if(destSize<srcLength) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ return srcLength;
+ }
+ do {
+ U16_NEXT(src, i, srcLength, c);
+ c=u_charMirror(c);
+ U16_APPEND_UNSAFE(dest, j, c);
+ } while(i<srcLength);
+ return srcLength;
+ }
+ case UBIDI_REMOVE_BIDI_CONTROLS: {
+ /* copy the LTR run and remove any BiDi control characters */
+ int32_t remaining=destSize;
+ UChar c;
+ do {
+ c=*src++;
+ if(!IS_BIDI_CONTROL_CHAR(c)) {
+ if(--remaining<0) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+
+ /* preflight the length */
+ while(--srcLength>0) {
+ c=*src++;
+ if(!IS_BIDI_CONTROL_CHAR(c)) {
+ --remaining;
+ }
+ }
+ return destSize-remaining;
+ }
+ *dest++=c;
+ }
+ } while(--srcLength>0);
+ return destSize-remaining;
+ }
+ default: {
+ /* remove BiDi control characters and do mirroring */
+ int32_t remaining=destSize;
+ int32_t i, j=0;
+ UChar32 c;
+ do {
+ i=0;
+ U16_NEXT(src, i, srcLength, c);
+ src+=i;
+ srcLength-=i;
+ if(!IS_BIDI_CONTROL_CHAR(c)) {
+ remaining-=i;
+ if(remaining<0) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+
+ /* preflight the length */
+ while(srcLength>0) {
+ c=*src++;
+ if(!IS_BIDI_CONTROL_CHAR(c)) {
+ --remaining;
+ }
+ --srcLength;
+ }
+ return destSize-remaining;
+ }
+ c=u_charMirror(c);
+ U16_APPEND_UNSAFE(dest, j, c);
+ }
+ } while(srcLength>0);
+ return j;
+ }
+ } /* end of switch */
+}
+
+static int32_t
+doWriteReverse(const UChar *src, int32_t srcLength,
+ UChar *dest, int32_t destSize,
+ uint16_t options,
+ UErrorCode *pErrorCode) {
+ /*
+ * RTL run -
+ *
+ * RTL runs need to be copied to the destination in reverse order
+ * of code points, not code units, to keep Unicode characters intact.
+ *
+ * The general strategy for this is to read the source text
+ * in backward order, collect all code units for a code point
+ * (and optionally following combining characters, see below),
+ * and copy all these code units in ascending order
+ * to the destination for this run.
+ *
+ * Several options request whether combining characters
+ * should be kept after their base characters,
+ * whether BiDi control characters should be removed, and
+ * whether characters should be replaced by their mirror-image
+ * equivalent Unicode characters.
+ */
+ int32_t i, j;
+ UChar32 c;
+
+ /* optimize for several combinations of options */
+ switch(options&(UBIDI_REMOVE_BIDI_CONTROLS|UBIDI_DO_MIRRORING|UBIDI_KEEP_BASE_COMBINING)) {
+ case 0:
+ /*
+ * With none of the "complicated" options set, the destination
+ * run will have the same length as the source run,
+ * and there is no mirroring and no keeping combining characters
+ * with their base characters.
+ */
+ if(destSize<srcLength) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ return srcLength;
+ }
+ destSize=srcLength;
+
+ /* preserve character integrity */
+ do {
+ /* i is always after the last code unit known to need to be kept in this segment */
+ i=srcLength;
+
+ /* collect code units for one base character */
+ U16_BACK_1(src, 0, srcLength);
+
+ /* copy this base character */
+ j=srcLength;
+ do {
+ *dest++=src[j++];
+ } while(j<i);
+ } while(srcLength>0);
+ break;
+ case UBIDI_KEEP_BASE_COMBINING:
+ /*
+ * Here, too, the destination
+ * run will have the same length as the source run,
+ * and there is no mirroring.
+ * We do need to keep combining characters with their base characters.
+ */
+ if(destSize<srcLength) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ return srcLength;
+ }
+ destSize=srcLength;
+
+ /* preserve character integrity */
+ do {
+ /* i is always after the last code unit known to need to be kept in this segment */
+ i=srcLength;
+
+ /* collect code units and modifier letters for one base character */
+ do {
+ U16_PREV(src, 0, srcLength, c);
+ } while(srcLength>0 && IS_COMBINING(u_charType(c)));
+
+ /* copy this "user character" */
+ j=srcLength;
+ do {
+ *dest++=src[j++];
+ } while(j<i);
+ } while(srcLength>0);
+ break;
+ default:
+ /*
+ * With several "complicated" options set, this is the most
+ * general and the slowest copying of an RTL run.
+ * We will do mirroring, remove BiDi controls, and
+ * keep combining characters with their base characters
+ * as requested.
+ */
+ if(!(options&UBIDI_REMOVE_BIDI_CONTROLS)) {
+ i=srcLength;
+ } else {
+ /* we need to find out the destination length of the run,
+ which will not include the BiDi control characters */
+ int32_t length=srcLength;
+ UChar ch;
+
+ i=0;
+ do {
+ ch=*src++;
+ if(!IS_BIDI_CONTROL_CHAR(ch)) {
+ ++i;
+ }
+ } while(--length>0);
+ src-=srcLength;
+ }
+
+ if(destSize<i) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ return i;
+ }
+ destSize=i;
+
+ /* preserve character integrity */
+ do {
+ /* i is always after the last code unit known to need to be kept in this segment */
+ i=srcLength;
+
+ /* collect code units for one base character */
+ U16_PREV(src, 0, srcLength, c);
+ if(options&UBIDI_KEEP_BASE_COMBINING) {
+ /* collect modifier letters for this base character */
+ while(srcLength>0 && IS_COMBINING(u_charType(c))) {
+ U16_PREV(src, 0, srcLength, c);
+ }
+ }
+
+ if(options&UBIDI_REMOVE_BIDI_CONTROLS && IS_BIDI_CONTROL_CHAR(c)) {
+ /* do not copy this BiDi control character */
+ continue;
+ }
+
+ /* copy this "user character" */
+ j=srcLength;
+ if(options&UBIDI_DO_MIRRORING) {
+ /* mirror only the base character */
+ int32_t k=0;
+ c=u_charMirror(c);
+ U16_APPEND_UNSAFE(dest, k, c);
+ dest+=k;
+ j+=k;
+ }
+ while(j<i) {
+ *dest++=src[j++];
+ }
+ } while(srcLength>0);
+ break;
+ } /* end of switch */
+
+ return destSize;
+}
+
+U_CAPI int32_t U_EXPORT2
+ubidi_writeReverse(const UChar *src, int32_t srcLength,
+ UChar *dest, int32_t destSize,
+ uint16_t options,
+ UErrorCode *pErrorCode) {
+ int32_t destLength;
+
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+
+ /* more error checking */
+ if( src==NULL || srcLength<-1 ||
+ destSize<0 || (destSize>0 && dest==NULL))
+ {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* do input and output overlap? */
+ if( dest!=NULL &&
+ ((src>=dest && src<dest+destSize) ||
+ (dest>=src && dest<src+srcLength)))
+ {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ if(srcLength==-1) {
+ srcLength=u_strlen(src);
+ }
+ if(srcLength>0) {
+ destLength=doWriteReverse(src, srcLength, dest, destSize, options, pErrorCode);
+ } else {
+ /* nothing to do */
+ destLength=0;
+ }
+
+ return u_terminateUChars(dest, destSize, destLength, pErrorCode);
+}
+
+// Ticket 20907 - The optimizer in MSVC/Visual Studio versions below 16.4 has trouble with this
+// function on Windows ARM64. As a work-around, we disable optimizations for this function.
+// This work-around could/should be removed once the following versions of Visual Studio are no
+// longer supported: All versions of VS2017, and versions of VS2019 below 16.4.
+#if (defined(_MSC_VER) && (defined(_M_ARM64)) && (_MSC_VER < 1924))
+#pragma optimize( "", off )
+#endif
+U_CAPI int32_t U_EXPORT2
+ubidi_writeReordered(UBiDi *pBiDi,
+ UChar *dest, int32_t destSize,
+ uint16_t options,
+ UErrorCode *pErrorCode) {
+ const UChar *text;
+ UChar *saveDest;
+ int32_t length, destCapacity;
+ int32_t run, runCount, logicalStart, runLength;
+
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+
+ /* more error checking */
+ if( pBiDi==NULL ||
+ (text=pBiDi->text)==NULL || (length=pBiDi->length)<0 ||
+ destSize<0 || (destSize>0 && dest==NULL))
+ {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* do input and output overlap? */
+ if( dest!=NULL &&
+ ((text>=dest && text<dest+destSize) ||
+ (dest>=text && dest<text+pBiDi->originalLength)))
+ {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ if(length==0) {
+ /* nothing to do */
+ return u_terminateUChars(dest, destSize, 0, pErrorCode);
+ }
+
+ runCount=ubidi_countRuns(pBiDi, pErrorCode);
+ if(U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+
+ /* destSize shrinks, later destination length=destCapacity-destSize */
+ saveDest=dest;
+ destCapacity=destSize;
+
+ /*
+ * Option "insert marks" implies UBIDI_INSERT_LRM_FOR_NUMERIC if the
+ * reordering mode (checked below) is appropriate.
+ */
+ if(pBiDi->reorderingOptions & UBIDI_OPTION_INSERT_MARKS) {
+ options|=UBIDI_INSERT_LRM_FOR_NUMERIC;
+ options&=~UBIDI_REMOVE_BIDI_CONTROLS;
+ }
+ /*
+ * Option "remove controls" implies UBIDI_REMOVE_BIDI_CONTROLS
+ * and cancels UBIDI_INSERT_LRM_FOR_NUMERIC.
+ */
+ if(pBiDi->reorderingOptions & UBIDI_OPTION_REMOVE_CONTROLS) {
+ options|=UBIDI_REMOVE_BIDI_CONTROLS;
+ options&=~UBIDI_INSERT_LRM_FOR_NUMERIC;
+ }
+ /*
+ * If we do not perform the "inverse BiDi" algorithm, then we
+ * don't need to insert any LRMs, and don't need to test for it.
+ */
+ if((pBiDi->reorderingMode != UBIDI_REORDER_INVERSE_NUMBERS_AS_L) &&
+ (pBiDi->reorderingMode != UBIDI_REORDER_INVERSE_LIKE_DIRECT) &&
+ (pBiDi->reorderingMode != UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL) &&
+ (pBiDi->reorderingMode != UBIDI_REORDER_RUNS_ONLY)) {
+ options&=~UBIDI_INSERT_LRM_FOR_NUMERIC;
+ }
+ /*
+ * Iterate through all visual runs and copy the run text segments to
+ * the destination, according to the options.
+ *
+ * The tests for where to insert LRMs ignore the fact that there may be
+ * BN codes or non-BMP code points at the beginning and end of a run;
+ * they may insert LRMs unnecessarily but the tests are faster this way
+ * (this would have to be improved for UTF-8).
+ *
+ * Note that the only errors that are set by doWriteXY() are buffer overflow
+ * errors. Ignore them until the end, and continue for preflighting.
+ */
+ if(!(options&UBIDI_OUTPUT_REVERSE)) {
+ /* forward output */
+ if(!(options&UBIDI_INSERT_LRM_FOR_NUMERIC)) {
+ /* do not insert BiDi controls */
+ for(run=0; run<runCount; ++run) {
+ if(UBIDI_LTR==ubidi_getVisualRun(pBiDi, run, &logicalStart, &runLength)) {
+ runLength=doWriteForward(text+logicalStart, runLength,
+ dest, destSize,
+ (uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode);
+ } else {
+ runLength=doWriteReverse(text+logicalStart, runLength,
+ dest, destSize,
+ options, pErrorCode);
+ }
+ if(dest!=NULL) {
+ dest+=runLength;
+ }
+ destSize-=runLength;
+ }
+ } else {
+ /* insert BiDi controls for "inverse BiDi" */
+ const DirProp *dirProps=pBiDi->dirProps;
+ const UChar *src;
+ UChar uc;
+ UBiDiDirection dir;
+ int32_t markFlag;
+
+ for(run=0; run<runCount; ++run) {
+ dir=ubidi_getVisualRun(pBiDi, run, &logicalStart, &runLength);
+ src=text+logicalStart;
+ /* check if something relevant in insertPoints */
+ markFlag=pBiDi->runs[run].insertRemove;
+ if(markFlag<0) { /* BiDi controls count */
+ markFlag=0;
+ }
+
+ if(UBIDI_LTR==dir) {
+ if((pBiDi->isInverse) &&
+ (/*run>0 &&*/ dirProps[logicalStart]!=L)) {
+ markFlag |= LRM_BEFORE;
+ }
+ if (markFlag & LRM_BEFORE) {
+ uc=LRM_CHAR;
+ }
+ else if (markFlag & RLM_BEFORE) {
+ uc=RLM_CHAR;
+ }
+ else uc=0;
+ if(uc) {
+ if(destSize>0) {
+ *dest++=uc;
+ }
+ --destSize;
+ }
+
+ runLength=doWriteForward(src, runLength,
+ dest, destSize,
+ (uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode);
+ if(dest!=NULL) {
+ dest+=runLength;
+ }
+ destSize-=runLength;
+
+ if((pBiDi->isInverse) &&
+ (/*run<runCount-1 &&*/ dirProps[logicalStart+runLength-1]!=L)) {
+ markFlag |= LRM_AFTER;
+ }
+ if (markFlag & LRM_AFTER) {
+ uc=LRM_CHAR;
+ }
+ else if (markFlag & RLM_AFTER) {
+ uc=RLM_CHAR;
+ }
+ else uc=0;
+ if(uc) {
+ if(destSize>0) {
+ *dest++=uc;
+ }
+ --destSize;
+ }
+ } else { /* RTL run */
+ if((pBiDi->isInverse) &&
+ (/*run>0 &&*/ !(MASK_R_AL&DIRPROP_FLAG(dirProps[logicalStart+runLength-1])))) {
+ markFlag |= RLM_BEFORE;
+ }
+ if (markFlag & LRM_BEFORE) {
+ uc=LRM_CHAR;
+ }
+ else if (markFlag & RLM_BEFORE) {
+ uc=RLM_CHAR;
+ }
+ else uc=0;
+ if(uc) {
+ if(destSize>0) {
+ *dest++=uc;
+ }
+ --destSize;
+ }
+
+ runLength=doWriteReverse(src, runLength,
+ dest, destSize,
+ options, pErrorCode);
+ if(dest!=NULL) {
+ dest+=runLength;
+ }
+ destSize-=runLength;
+
+ if((pBiDi->isInverse) &&
+ (/*run<runCount-1 &&*/ !(MASK_R_AL&DIRPROP_FLAG(dirProps[logicalStart])))) {
+ markFlag |= RLM_AFTER;
+ }
+ if (markFlag & LRM_AFTER) {
+ uc=LRM_CHAR;
+ }
+ else if (markFlag & RLM_AFTER) {
+ uc=RLM_CHAR;
+ }
+ else uc=0;
+ if(uc) {
+ if(destSize>0) {
+ *dest++=uc;
+ }
+ --destSize;
+ }
+ }
+ }
+ }
+ } else {
+ /* reverse output */
+ if(!(options&UBIDI_INSERT_LRM_FOR_NUMERIC)) {
+ /* do not insert BiDi controls */
+ for(run=runCount; --run>=0;) {
+ if(UBIDI_LTR==ubidi_getVisualRun(pBiDi, run, &logicalStart, &runLength)) {
+ runLength=doWriteReverse(text+logicalStart, runLength,
+ dest, destSize,
+ (uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode);
+ } else {
+ runLength=doWriteForward(text+logicalStart, runLength,
+ dest, destSize,
+ options, pErrorCode);
+ }
+ if(dest!=NULL) {
+ dest+=runLength;
+ }
+ destSize-=runLength;
+ }
+ } else {
+ /* insert BiDi controls for "inverse BiDi" */
+ const DirProp *dirProps=pBiDi->dirProps;
+ const UChar *src;
+ UBiDiDirection dir;
+
+ for(run=runCount; --run>=0;) {
+ /* reverse output */
+ dir=ubidi_getVisualRun(pBiDi, run, &logicalStart, &runLength);
+ src=text+logicalStart;
+
+ if(UBIDI_LTR==dir) {
+ if(/*run<runCount-1 &&*/ dirProps[logicalStart+runLength-1]!=L) {
+ if(destSize>0) {
+ *dest++=LRM_CHAR;
+ }
+ --destSize;
+ }
+
+ runLength=doWriteReverse(src, runLength,
+ dest, destSize,
+ (uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode);
+ if(dest!=NULL) {
+ dest+=runLength;
+ }
+ destSize-=runLength;
+
+ if(/*run>0 &&*/ dirProps[logicalStart]!=L) {
+ if(destSize>0) {
+ *dest++=LRM_CHAR;
+ }
+ --destSize;
+ }
+ } else {
+ if(/*run<runCount-1 &&*/ !(MASK_R_AL&DIRPROP_FLAG(dirProps[logicalStart]))) {
+ if(destSize>0) {
+ *dest++=RLM_CHAR;
+ }
+ --destSize;
+ }
+
+ runLength=doWriteForward(src, runLength,
+ dest, destSize,
+ options, pErrorCode);
+ if(dest!=NULL) {
+ dest+=runLength;
+ }
+ destSize-=runLength;
+
+ if(/*run>0 &&*/ !(MASK_R_AL&DIRPROP_FLAG(dirProps[logicalStart+runLength-1]))) {
+ if(destSize>0) {
+ *dest++=RLM_CHAR;
+ }
+ --destSize;
+ }
+ }
+ }
+ }
+ }
+
+ return u_terminateUChars(saveDest, destCapacity, destCapacity-destSize, pErrorCode);
+}
+#if (defined(_MSC_VER) && (defined(_M_ARM64)) && (_MSC_VER < 1924))
+#pragma optimize( "", on )
+#endif
diff --git a/contrib/libs/icu/common/ubrk.cpp b/contrib/libs/icu/common/ubrk.cpp
index b2fbd3ea54..f8bdf5a6b6 100644
--- a/contrib/libs/icu/common/ubrk.cpp
+++ b/contrib/libs/icu/common/ubrk.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -20,7 +20,7 @@
#include "unicode/rbbi.h"
#include "rbbirb.h"
#include "uassert.h"
-#include "cmemory.h"
+#include "cmemory.h"
U_NAMESPACE_USE
@@ -120,28 +120,28 @@ ubrk_openRules( const UChar *rules,
}
-U_CAPI UBreakIterator* U_EXPORT2
-ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength,
- const UChar * text, int32_t textLength,
- UErrorCode * status)
-{
- if (U_FAILURE(*status)) {
- return NULL;
- }
- if (rulesLength < 0) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
- }
- LocalPointer<RuleBasedBreakIterator> lpRBBI(new RuleBasedBreakIterator(binaryRules, rulesLength, *status), *status);
- if (U_FAILURE(*status)) {
- return NULL;
- }
- UBreakIterator *uBI = reinterpret_cast<UBreakIterator *>(lpRBBI.orphan());
- if (text != NULL) {
- ubrk_setText(uBI, text, textLength, status);
- }
- return uBI;
-}
+U_CAPI UBreakIterator* U_EXPORT2
+ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength,
+ const UChar * text, int32_t textLength,
+ UErrorCode * status)
+{
+ if (U_FAILURE(*status)) {
+ return NULL;
+ }
+ if (rulesLength < 0) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
+ }
+ LocalPointer<RuleBasedBreakIterator> lpRBBI(new RuleBasedBreakIterator(binaryRules, rulesLength, *status), *status);
+ if (U_FAILURE(*status)) {
+ return NULL;
+ }
+ UBreakIterator *uBI = reinterpret_cast<UBreakIterator *>(lpRBBI.orphan());
+ if (text != NULL) {
+ ubrk_setText(uBI, text, textLength, status);
+ }
+ return uBI;
+}
U_CAPI UBreakIterator * U_EXPORT2
@@ -310,8 +310,8 @@ ubrk_getLocaleByType(const UBreakIterator *bi,
}
-U_CAPI void U_EXPORT2
-ubrk_refreshUText(UBreakIterator *bi,
+U_CAPI void U_EXPORT2
+ubrk_refreshUText(UBreakIterator *bi,
UText *text,
UErrorCode *status)
{
@@ -319,39 +319,39 @@ ubrk_refreshUText(UBreakIterator *bi,
bii->refreshInputText(text, *status);
}
-U_CAPI int32_t U_EXPORT2
-ubrk_getBinaryRules(UBreakIterator *bi,
- uint8_t * binaryRules, int32_t rulesCapacity,
- UErrorCode * status)
-{
- if (U_FAILURE(*status)) {
- return 0;
- }
- if ((binaryRules == NULL && rulesCapacity > 0) || rulesCapacity < 0) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
- RuleBasedBreakIterator* rbbi;
- if ((rbbi = dynamic_cast<RuleBasedBreakIterator*>(reinterpret_cast<BreakIterator*>(bi))) == NULL) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
- uint32_t rulesLength;
- const uint8_t * returnedRules = rbbi->getBinaryRules(rulesLength);
- if (rulesLength > INT32_MAX) {
- *status = U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
- }
- if (binaryRules != NULL) { // if not preflighting
- // Here we know rulesLength <= INT32_MAX and rulesCapacity >= 0, can cast safely
- if ((int32_t)rulesLength > rulesCapacity) {
- *status = U_BUFFER_OVERFLOW_ERROR;
- } else {
- uprv_memcpy(binaryRules, returnedRules, rulesLength);
- }
- }
- return (int32_t)rulesLength;
-}
+U_CAPI int32_t U_EXPORT2
+ubrk_getBinaryRules(UBreakIterator *bi,
+ uint8_t * binaryRules, int32_t rulesCapacity,
+ UErrorCode * status)
+{
+ if (U_FAILURE(*status)) {
+ return 0;
+ }
+ if ((binaryRules == NULL && rulesCapacity > 0) || rulesCapacity < 0) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+ RuleBasedBreakIterator* rbbi;
+ if ((rbbi = dynamic_cast<RuleBasedBreakIterator*>(reinterpret_cast<BreakIterator*>(bi))) == NULL) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+ uint32_t rulesLength;
+ const uint8_t * returnedRules = rbbi->getBinaryRules(rulesLength);
+ if (rulesLength > INT32_MAX) {
+ *status = U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
+ }
+ if (binaryRules != NULL) { // if not preflighting
+ // Here we know rulesLength <= INT32_MAX and rulesCapacity >= 0, can cast safely
+ if ((int32_t)rulesLength > rulesCapacity) {
+ *status = U_BUFFER_OVERFLOW_ERROR;
+ } else {
+ uprv_memcpy(binaryRules, returnedRules, rulesLength);
+ }
+ }
+ return (int32_t)rulesLength;
+}
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
diff --git a/contrib/libs/icu/common/ubrkimpl.h b/contrib/libs/icu/common/ubrkimpl.h
index 5e3dea8fb9..8197f66339 100644
--- a/contrib/libs/icu/common/ubrkimpl.h
+++ b/contrib/libs/icu/common/ubrkimpl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/ucase.cpp b/contrib/libs/icu/common/ucase.cpp
index e692b81261..4ec25a27a5 100644
--- a/contrib/libs/icu/common/ucase.cpp
+++ b/contrib/libs/icu/common/ucase.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: ucase.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -57,13 +57,13 @@ _enumPropertyStartsRange(const void *context, UChar32 start, UChar32 /*end*/, ui
}
U_CFUNC void U_EXPORT2
-ucase_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
+ucase_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
if(U_FAILURE(*pErrorCode)) {
return;
}
/* add the start code point of each same-value range of the trie */
- utrie2_enum(&ucase_props_singleton.trie, NULL, _enumPropertyStartsRange, sa);
+ utrie2_enum(&ucase_props_singleton.trie, NULL, _enumPropertyStartsRange, sa);
/* add code points with hardcoded properties, plus the ones following them */
@@ -77,11 +77,11 @@ ucase_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
/* data access primitives --------------------------------------------------- */
-U_CFUNC const UTrie2 * U_EXPORT2
-ucase_getTrie() {
- return &ucase_props_singleton.trie;
-}
-
+U_CFUNC const UTrie2 * U_EXPORT2
+ucase_getTrie() {
+ return &ucase_props_singleton.trie;
+}
+
#define GET_EXCEPTIONS(csp, props) ((csp)->exceptions+((props)>>UCASE_EXC_SHIFT))
/* number of bits in an 8-bit integer value */
@@ -116,7 +116,7 @@ static const uint8_t flagsOffset[256]={
* moved to the last uint16_t of the value, use +1 for beginning of next slot
* @param value (out) int32_t or uint32_t output if hasSlot, otherwise not modified
*/
-#define GET_SLOT_VALUE(excWord, idx, pExc16, value) UPRV_BLOCK_MACRO_BEGIN { \
+#define GET_SLOT_VALUE(excWord, idx, pExc16, value) UPRV_BLOCK_MACRO_BEGIN { \
if(((excWord)&UCASE_EXC_DOUBLE_SLOTS)==0) { \
(pExc16)+=SLOT_OFFSET(excWord, idx); \
(value)=*pExc16; \
@@ -124,26 +124,26 @@ static const uint8_t flagsOffset[256]={
(pExc16)+=2*SLOT_OFFSET(excWord, idx); \
(value)=*pExc16++; \
(value)=((value)<<16)|*pExc16; \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
/* simple case mappings ----------------------------------------------------- */
U_CAPI UChar32 U_EXPORT2
-ucase_tolower(UChar32 c) {
- uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
- if(!UCASE_HAS_EXCEPTION(props)) {
- if(UCASE_IS_UPPER_OR_TITLE(props)) {
+ucase_tolower(UChar32 c) {
+ uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
+ if(!UCASE_HAS_EXCEPTION(props)) {
+ if(UCASE_IS_UPPER_OR_TITLE(props)) {
c+=UCASE_GET_DELTA(props);
}
} else {
- const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props);
+ const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props);
uint16_t excWord=*pe++;
- if(HAS_SLOT(excWord, UCASE_EXC_DELTA) && UCASE_IS_UPPER_OR_TITLE(props)) {
- int32_t delta;
- GET_SLOT_VALUE(excWord, UCASE_EXC_DELTA, pe, delta);
- return (excWord&UCASE_EXC_DELTA_IS_NEGATIVE)==0 ? c+delta : c-delta;
- }
+ if(HAS_SLOT(excWord, UCASE_EXC_DELTA) && UCASE_IS_UPPER_OR_TITLE(props)) {
+ int32_t delta;
+ GET_SLOT_VALUE(excWord, UCASE_EXC_DELTA, pe, delta);
+ return (excWord&UCASE_EXC_DELTA_IS_NEGATIVE)==0 ? c+delta : c-delta;
+ }
if(HAS_SLOT(excWord, UCASE_EXC_LOWER)) {
GET_SLOT_VALUE(excWord, UCASE_EXC_LOWER, pe, c);
}
@@ -152,20 +152,20 @@ ucase_tolower(UChar32 c) {
}
U_CAPI UChar32 U_EXPORT2
-ucase_toupper(UChar32 c) {
- uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
- if(!UCASE_HAS_EXCEPTION(props)) {
+ucase_toupper(UChar32 c) {
+ uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
+ if(!UCASE_HAS_EXCEPTION(props)) {
if(UCASE_GET_TYPE(props)==UCASE_LOWER) {
c+=UCASE_GET_DELTA(props);
}
} else {
- const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props);
+ const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props);
uint16_t excWord=*pe++;
- if(HAS_SLOT(excWord, UCASE_EXC_DELTA) && UCASE_GET_TYPE(props)==UCASE_LOWER) {
- int32_t delta;
- GET_SLOT_VALUE(excWord, UCASE_EXC_DELTA, pe, delta);
- return (excWord&UCASE_EXC_DELTA_IS_NEGATIVE)==0 ? c+delta : c-delta;
- }
+ if(HAS_SLOT(excWord, UCASE_EXC_DELTA) && UCASE_GET_TYPE(props)==UCASE_LOWER) {
+ int32_t delta;
+ GET_SLOT_VALUE(excWord, UCASE_EXC_DELTA, pe, delta);
+ return (excWord&UCASE_EXC_DELTA_IS_NEGATIVE)==0 ? c+delta : c-delta;
+ }
if(HAS_SLOT(excWord, UCASE_EXC_UPPER)) {
GET_SLOT_VALUE(excWord, UCASE_EXC_UPPER, pe, c);
}
@@ -174,20 +174,20 @@ ucase_toupper(UChar32 c) {
}
U_CAPI UChar32 U_EXPORT2
-ucase_totitle(UChar32 c) {
- uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
- if(!UCASE_HAS_EXCEPTION(props)) {
+ucase_totitle(UChar32 c) {
+ uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
+ if(!UCASE_HAS_EXCEPTION(props)) {
if(UCASE_GET_TYPE(props)==UCASE_LOWER) {
c+=UCASE_GET_DELTA(props);
}
} else {
- const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props);
+ const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props);
uint16_t excWord=*pe++;
- if(HAS_SLOT(excWord, UCASE_EXC_DELTA) && UCASE_GET_TYPE(props)==UCASE_LOWER) {
- int32_t delta;
- GET_SLOT_VALUE(excWord, UCASE_EXC_DELTA, pe, delta);
- return (excWord&UCASE_EXC_DELTA_IS_NEGATIVE)==0 ? c+delta : c-delta;
- }
+ if(HAS_SLOT(excWord, UCASE_EXC_DELTA) && UCASE_GET_TYPE(props)==UCASE_LOWER) {
+ int32_t delta;
+ GET_SLOT_VALUE(excWord, UCASE_EXC_DELTA, pe, delta);
+ return (excWord&UCASE_EXC_DELTA_IS_NEGATIVE)==0 ? c+delta : c-delta;
+ }
int32_t idx;
if(HAS_SLOT(excWord, UCASE_EXC_TITLE)) {
idx=UCASE_EXC_TITLE;
@@ -210,7 +210,7 @@ static const UChar iDotTilde[3] = { 0x69, 0x307, 0x303 };
U_CFUNC void U_EXPORT2
-ucase_addCaseClosure(UChar32 c, const USetAdder *sa) {
+ucase_addCaseClosure(UChar32 c, const USetAdder *sa) {
uint16_t props;
/*
@@ -241,8 +241,8 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa) {
break;
}
- props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
- if(!UCASE_HAS_EXCEPTION(props)) {
+ props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
+ if(!UCASE_HAS_EXCEPTION(props)) {
if(UCASE_GET_TYPE(props)!=UCASE_NONE) {
/* add the one simple case mapping, no matter what type it is */
int32_t delta=UCASE_GET_DELTA(props);
@@ -255,7 +255,7 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa) {
* c has exceptions, so there may be multiple simple and/or
* full case mappings. Add them all.
*/
- const uint16_t *pe0, *pe=GET_EXCEPTIONS(&ucase_props_singleton, props);
+ const uint16_t *pe0, *pe=GET_EXCEPTIONS(&ucase_props_singleton, props);
const UChar *closure;
uint16_t excWord=*pe++;
int32_t idx, closureLength, fullLength, length;
@@ -270,12 +270,12 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa) {
sa->add(sa->set, c);
}
}
- if(HAS_SLOT(excWord, UCASE_EXC_DELTA)) {
- pe=pe0;
- int32_t delta;
- GET_SLOT_VALUE(excWord, UCASE_EXC_DELTA, pe, delta);
- sa->add(sa->set, (excWord&UCASE_EXC_DELTA_IS_NEGATIVE)==0 ? c+delta : c-delta);
- }
+ if(HAS_SLOT(excWord, UCASE_EXC_DELTA)) {
+ pe=pe0;
+ int32_t delta;
+ GET_SLOT_VALUE(excWord, UCASE_EXC_DELTA, pe, delta);
+ sa->add(sa->set, (excWord&UCASE_EXC_DELTA_IS_NEGATIVE)==0 ? c+delta : c-delta);
+ }
/* get the closure string pointer & length */
if(HAS_SLOT(excWord, UCASE_EXC_CLOSURE)) {
@@ -356,10 +356,10 @@ strcmpMax(const UChar *s, int32_t length, const UChar *t, int32_t max) {
}
U_CFUNC UBool U_EXPORT2
-ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa) {
+ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa) {
int32_t i, start, limit, result, unfoldRows, unfoldRowWidth, unfoldStringWidth;
- if(ucase_props_singleton.unfold==NULL || s==NULL) {
+ if(ucase_props_singleton.unfold==NULL || s==NULL) {
return FALSE; /* no reverse case folding data, or no string */
}
if(length<=1) {
@@ -373,7 +373,7 @@ ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa)
return FALSE;
}
- const uint16_t *unfold=ucase_props_singleton.unfold;
+ const uint16_t *unfold=ucase_props_singleton.unfold;
unfoldRows=unfold[UCASE_UNFOLD_ROWS];
unfoldRowWidth=unfold[UCASE_UNFOLD_ROW_WIDTH];
unfoldStringWidth=unfold[UCASE_UNFOLD_STRING_WIDTH];
@@ -399,7 +399,7 @@ ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa)
for(i=unfoldStringWidth; i<unfoldRowWidth && p[i]!=0;) {
U16_NEXT_UNSAFE(p, i, c);
sa->add(sa->set, c);
- ucase_addCaseClosure(c, sa);
+ ucase_addCaseClosure(c, sa);
}
return TRUE;
} else if(result<0) {
@@ -444,180 +444,180 @@ FullCaseFoldingIterator::next(UnicodeString &full) {
return c;
}
-namespace LatinCase {
-
-const int8_t TO_LOWER_NORMAL[LIMIT] = {
- 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, 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, 0, 0, 0, 0, 0, 0,
-
- 0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
- 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 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, 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, 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, 0, 0, 0, EXC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
- 32, 32, 32, 32, 32, 32, 32, 0, 32, 32, 32, 32, 32, 32, 32, EXC,
- 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, 0, 0, 0,
-
- 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
- EXC, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1,
-
- 0, 1, 0, 1, 0, 1, 0, 1, 0, EXC, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0, -121, 1, 0, 1, 0, 1, 0, EXC
-};
-
-const int8_t TO_LOWER_TR_LT[LIMIT] = {
- 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, 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, 0, 0, 0, 0, 0, 0,
-
- 0, 32, 32, 32, 32, 32, 32, 32, 32, EXC, EXC, 32, 32, 32, 32, 32,
- 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 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, 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, 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, 0, 0, 0, EXC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, EXC, EXC, 32, 32,
- 32, 32, 32, 32, 32, 32, 32, 0, 32, 32, 32, 32, 32, 32, 32, EXC,
- 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, 0, 0, 0,
-
- 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0, EXC, 0, 1, 0, 1, 0, EXC, 0,
- EXC, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1,
-
- 0, 1, 0, 1, 0, 1, 0, 1, 0, EXC, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 0, -121, 1, 0, 1, 0, 1, 0, EXC
-};
-
-const int8_t TO_UPPER_NORMAL[LIMIT] = {
- 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, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32,
- -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, 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, 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, EXC, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, EXC,
- -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32,
- -32, -32, -32, -32, -32, -32, -32, 0, -32, -32, -32, -32, -32, -32, -32, 121,
-
- 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
- 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
- 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
- 0, EXC, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0,
-
- -1, 0, -1, 0, -1, 0, -1, 0, -1, EXC, 0, -1, 0, -1, 0, -1,
- 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
- 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
- 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, EXC
-};
-
-const int8_t TO_UPPER_TR[LIMIT] = {
- 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, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, -32, -32, -32, -32, -32, -32, -32, -32, EXC, -32, -32, -32, -32, -32, -32,
- -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, 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, 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, EXC, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, EXC,
- -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32,
- -32, -32, -32, -32, -32, -32, -32, 0, -32, -32, -32, -32, -32, -32, -32, 121,
-
- 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
- 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
- 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
- 0, EXC, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0,
-
- -1, 0, -1, 0, -1, 0, -1, 0, -1, EXC, 0, -1, 0, -1, 0, -1,
- 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
- 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
- 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, EXC
-};
-
-} // namespace LatinCase
-
+namespace LatinCase {
+
+const int8_t TO_LOWER_NORMAL[LIMIT] = {
+ 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, 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, 0, 0, 0, 0, 0, 0,
+
+ 0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 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, 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, 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, 0, 0, 0, EXC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 0, 32, 32, 32, 32, 32, 32, 32, EXC,
+ 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, 0, 0, 0,
+
+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
+ EXC, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1,
+
+ 0, 1, 0, 1, 0, 1, 0, 1, 0, EXC, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1, 0, -121, 1, 0, 1, 0, 1, 0, EXC
+};
+
+const int8_t TO_LOWER_TR_LT[LIMIT] = {
+ 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, 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, 0, 0, 0, 0, 0, 0,
+
+ 0, 32, 32, 32, 32, 32, 32, 32, 32, EXC, EXC, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 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, 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, 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, 0, 0, 0, EXC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, EXC, EXC, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 0, 32, 32, 32, 32, 32, 32, 32, EXC,
+ 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, 0, 0, 0,
+
+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1, 0, EXC, 0, 1, 0, 1, 0, EXC, 0,
+ EXC, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1,
+
+ 0, 1, 0, 1, 0, 1, 0, 1, 0, EXC, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1, 0, -121, 1, 0, 1, 0, 1, 0, EXC
+};
+
+const int8_t TO_UPPER_NORMAL[LIMIT] = {
+ 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, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32,
+ -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, 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, 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, EXC, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, EXC,
+ -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32,
+ -32, -32, -32, -32, -32, -32, -32, 0, -32, -32, -32, -32, -32, -32, -32, 121,
+
+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
+ 0, EXC, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0,
+
+ -1, 0, -1, 0, -1, 0, -1, 0, -1, EXC, 0, -1, 0, -1, 0, -1,
+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
+ 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, EXC
+};
+
+const int8_t TO_UPPER_TR[LIMIT] = {
+ 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, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, -32, -32, -32, -32, -32, -32, -32, -32, EXC, -32, -32, -32, -32, -32, -32,
+ -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, 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, 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, EXC, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, EXC,
+ -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32,
+ -32, -32, -32, -32, -32, -32, -32, 0, -32, -32, -32, -32, -32, -32, -32, 121,
+
+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
+ 0, EXC, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0,
+
+ -1, 0, -1, 0, -1, 0, -1, 0, -1, EXC, 0, -1, 0, -1, 0, -1,
+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,
+ 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, EXC
+};
+
+} // namespace LatinCase
+
U_NAMESPACE_END
/** @return UCASE_NONE, UCASE_LOWER, UCASE_UPPER, UCASE_TITLE */
U_CAPI int32_t U_EXPORT2
-ucase_getType(UChar32 c) {
- uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
+ucase_getType(UChar32 c) {
+ uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
return UCASE_GET_TYPE(props);
}
/** @return same as ucase_getType() and set bit 2 if c is case-ignorable */
U_CAPI int32_t U_EXPORT2
-ucase_getTypeOrIgnorable(UChar32 c) {
- uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
+ucase_getTypeOrIgnorable(UChar32 c) {
+ uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
return UCASE_GET_TYPE_AND_IGNORABLE(props);
}
/** @return UCASE_NO_DOT, UCASE_SOFT_DOTTED, UCASE_ABOVE, UCASE_OTHER_ACCENT */
static inline int32_t
-getDotType(UChar32 c) {
- uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
- if(!UCASE_HAS_EXCEPTION(props)) {
+getDotType(UChar32 c) {
+ uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
+ if(!UCASE_HAS_EXCEPTION(props)) {
return props&UCASE_DOT_MASK;
} else {
- const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props);
+ const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props);
return (*pe>>UCASE_EXC_DOT_SHIFT)&UCASE_DOT_MASK;
}
}
U_CAPI UBool U_EXPORT2
-ucase_isSoftDotted(UChar32 c) {
- return (UBool)(getDotType(c)==UCASE_SOFT_DOTTED);
+ucase_isSoftDotted(UChar32 c) {
+ return (UBool)(getDotType(c)==UCASE_SOFT_DOTTED);
}
U_CAPI UBool U_EXPORT2
-ucase_isCaseSensitive(UChar32 c) {
- uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
- if(!UCASE_HAS_EXCEPTION(props)) {
- return (UBool)((props&UCASE_SENSITIVE)!=0);
- } else {
- const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props);
- return (UBool)((*pe&UCASE_EXC_SENSITIVE)!=0);
- }
+ucase_isCaseSensitive(UChar32 c) {
+ uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
+ if(!UCASE_HAS_EXCEPTION(props)) {
+ return (UBool)((props&UCASE_SENSITIVE)!=0);
+ } else {
+ const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props);
+ return (UBool)((*pe&UCASE_EXC_SENSITIVE)!=0);
+ }
}
/* string casing ------------------------------------------------------------ */
@@ -718,7 +718,7 @@ ucase_isCaseSensitive(UChar32 c) {
* Accepts both 2- and 3-letter codes and accepts case variants.
*/
U_CFUNC int32_t
-ucase_getCaseLocale(const char *locale) {
+ucase_getCaseLocale(const char *locale) {
/*
* This function used to use uloc_getLanguage(), but the current code
* removes the dependency of this low-level code on uloc implementation code
@@ -728,149 +728,149 @@ ucase_getCaseLocale(const char *locale) {
* Because this code does not want to depend on uloc, the caller must
* pass in a non-NULL locale, i.e., may need to call uloc_getDefault().
*/
- char c=*locale++;
- // Fastpath for English "en" which is often used for default (=root locale) case mappings,
- // and for Chinese "zh": Very common but no special case mapping behavior.
- // Then check lowercase vs. uppercase to reduce the number of comparisons
- // for other locales without special behavior.
- if(c=='e') {
- /* el or ell? */
+ char c=*locale++;
+ // Fastpath for English "en" which is often used for default (=root locale) case mappings,
+ // and for Chinese "zh": Very common but no special case mapping behavior.
+ // Then check lowercase vs. uppercase to reduce the number of comparisons
+ // for other locales without special behavior.
+ if(c=='e') {
+ /* el or ell? */
c=*locale++;
- if(is_l(c)) {
+ if(is_l(c)) {
c=*locale++;
- if(is_l(c)) {
- c=*locale;
- }
+ if(is_l(c)) {
+ c=*locale;
+ }
if(is_sep(c)) {
- return UCASE_LOC_GREEK;
+ return UCASE_LOC_GREEK;
}
}
- // en, es, ... -> root
- } else if(c=='z') {
- return UCASE_LOC_ROOT;
-#if U_CHARSET_FAMILY==U_ASCII_FAMILY
- } else if(c>='a') { // ASCII a-z = 0x61..0x7a, after A-Z
-#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
- } else if(c<='z') { // EBCDIC a-z = 0x81..0xa9 with two gaps, before A-Z
-#else
-# error Unknown charset family!
-#endif
- // lowercase c
- if(c=='t') {
- /* tr or tur? */
+ // en, es, ... -> root
+ } else if(c=='z') {
+ return UCASE_LOC_ROOT;
+#if U_CHARSET_FAMILY==U_ASCII_FAMILY
+ } else if(c>='a') { // ASCII a-z = 0x61..0x7a, after A-Z
+#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
+ } else if(c<='z') { // EBCDIC a-z = 0x81..0xa9 with two gaps, before A-Z
+#else
+# error Unknown charset family!
+#endif
+ // lowercase c
+ if(c=='t') {
+ /* tr or tur? */
c=*locale++;
- if(is_u(c)) {
- c=*locale++;
- }
- if(is_r(c)) {
+ if(is_u(c)) {
+ c=*locale++;
+ }
+ if(is_r(c)) {
c=*locale;
- if(is_sep(c)) {
- return UCASE_LOC_TURKISH;
- }
+ if(is_sep(c)) {
+ return UCASE_LOC_TURKISH;
+ }
}
- } else if(c=='a') {
- /* az or aze? */
- c=*locale++;
- if(is_z(c)) {
- c=*locale++;
- if(is_e(c)) {
- c=*locale;
- }
- if(is_sep(c)) {
- return UCASE_LOC_TURKISH;
- }
+ } else if(c=='a') {
+ /* az or aze? */
+ c=*locale++;
+ if(is_z(c)) {
+ c=*locale++;
+ if(is_e(c)) {
+ c=*locale;
+ }
+ if(is_sep(c)) {
+ return UCASE_LOC_TURKISH;
+ }
}
- } else if(c=='l') {
- /* lt or lit? */
+ } else if(c=='l') {
+ /* lt or lit? */
c=*locale++;
- if(is_i(c)) {
- c=*locale++;
+ if(is_i(c)) {
+ c=*locale++;
+ }
+ if(is_t(c)) {
+ c=*locale;
+ if(is_sep(c)) {
+ return UCASE_LOC_LITHUANIAN;
+ }
+ }
+ } else if(c=='n') {
+ /* nl or nld? */
+ c=*locale++;
+ if(is_l(c)) {
+ c=*locale++;
+ if(is_d(c)) {
+ c=*locale;
+ }
+ if(is_sep(c)) {
+ return UCASE_LOC_DUTCH;
+ }
}
- if(is_t(c)) {
- c=*locale;
- if(is_sep(c)) {
- return UCASE_LOC_LITHUANIAN;
- }
- }
- } else if(c=='n') {
- /* nl or nld? */
- c=*locale++;
- if(is_l(c)) {
- c=*locale++;
- if(is_d(c)) {
- c=*locale;
- }
- if(is_sep(c)) {
- return UCASE_LOC_DUTCH;
- }
- }
}
- } else {
- // uppercase c
- // Same code as for lowercase c but also check for 'E'.
- if(c=='T') {
- /* tr or tur? */
+ } else {
+ // uppercase c
+ // Same code as for lowercase c but also check for 'E'.
+ if(c=='T') {
+ /* tr or tur? */
c=*locale++;
- if(is_u(c)) {
- c=*locale++;
- }
- if(is_r(c)) {
+ if(is_u(c)) {
+ c=*locale++;
+ }
+ if(is_r(c)) {
c=*locale;
- if(is_sep(c)) {
- return UCASE_LOC_TURKISH;
- }
+ if(is_sep(c)) {
+ return UCASE_LOC_TURKISH;
+ }
}
- } else if(c=='A') {
- /* az or aze? */
- c=*locale++;
- if(is_z(c)) {
- c=*locale++;
- if(is_e(c)) {
- c=*locale;
- }
- if(is_sep(c)) {
- return UCASE_LOC_TURKISH;
- }
+ } else if(c=='A') {
+ /* az or aze? */
+ c=*locale++;
+ if(is_z(c)) {
+ c=*locale++;
+ if(is_e(c)) {
+ c=*locale;
+ }
+ if(is_sep(c)) {
+ return UCASE_LOC_TURKISH;
+ }
}
- } else if(c=='L') {
- /* lt or lit? */
+ } else if(c=='L') {
+ /* lt or lit? */
c=*locale++;
- if(is_i(c)) {
- c=*locale++;
- }
- if(is_t(c)) {
+ if(is_i(c)) {
+ c=*locale++;
+ }
+ if(is_t(c)) {
c=*locale;
- if(is_sep(c)) {
- return UCASE_LOC_LITHUANIAN;
- }
+ if(is_sep(c)) {
+ return UCASE_LOC_LITHUANIAN;
+ }
}
- } else if(c=='E') {
- /* el or ell? */
- c=*locale++;
- if(is_l(c)) {
- c=*locale++;
- if(is_l(c)) {
- c=*locale;
- }
- if(is_sep(c)) {
- return UCASE_LOC_GREEK;
- }
+ } else if(c=='E') {
+ /* el or ell? */
+ c=*locale++;
+ if(is_l(c)) {
+ c=*locale++;
+ if(is_l(c)) {
+ c=*locale;
+ }
+ if(is_sep(c)) {
+ return UCASE_LOC_GREEK;
+ }
+ }
+ } else if(c=='N') {
+ /* nl or nld? */
+ c=*locale++;
+ if(is_l(c)) {
+ c=*locale++;
+ if(is_d(c)) {
+ c=*locale;
+ }
+ if(is_sep(c)) {
+ return UCASE_LOC_DUTCH;
+ }
}
- } else if(c=='N') {
- /* nl or nld? */
- c=*locale++;
- if(is_l(c)) {
- c=*locale++;
- if(is_d(c)) {
- c=*locale;
- }
- if(is_sep(c)) {
- return UCASE_LOC_DUTCH;
- }
- }
}
}
- return UCASE_LOC_ROOT;
+ return UCASE_LOC_ROOT;
}
/*
@@ -882,7 +882,7 @@ ucase_getCaseLocale(const char *locale) {
* it is also cased or not.
*/
static UBool
-isFollowedByCasedLetter(UCaseContextIterator *iter, void *context, int8_t dir) {
+isFollowedByCasedLetter(UCaseContextIterator *iter, void *context, int8_t dir) {
UChar32 c;
if(iter==NULL) {
@@ -890,7 +890,7 @@ isFollowedByCasedLetter(UCaseContextIterator *iter, void *context, int8_t dir) {
}
for(/* dir!=0 sets direction */; (c=iter(context, dir))>=0; dir=0) {
- int32_t type=ucase_getTypeOrIgnorable(c);
+ int32_t type=ucase_getTypeOrIgnorable(c);
if(type&4) {
/* case-ignorable, continue with the loop */
} else if(type!=UCASE_NONE) {
@@ -905,7 +905,7 @@ isFollowedByCasedLetter(UCaseContextIterator *iter, void *context, int8_t dir) {
/* Is preceded by Soft_Dotted character with no intervening cc=230 ? */
static UBool
-isPrecededBySoftDotted(UCaseContextIterator *iter, void *context) {
+isPrecededBySoftDotted(UCaseContextIterator *iter, void *context) {
UChar32 c;
int32_t dotType;
int8_t dir;
@@ -915,7 +915,7 @@ isPrecededBySoftDotted(UCaseContextIterator *iter, void *context) {
}
for(dir=-1; (c=iter(context, dir))>=0; dir=0) {
- dotType=getDotType(c);
+ dotType=getDotType(c);
if(dotType==UCASE_SOFT_DOTTED) {
return TRUE; /* preceded by TYPE_i */
} else if(dotType!=UCASE_OTHER_ACCENT) {
@@ -962,7 +962,7 @@ isPrecededBySoftDotted(UCaseContextIterator *iter, void *context) {
/* Is preceded by base character 'I' with no intervening cc=230 ? */
static UBool
-isPrecededBy_I(UCaseContextIterator *iter, void *context) {
+isPrecededBy_I(UCaseContextIterator *iter, void *context) {
UChar32 c;
int32_t dotType;
int8_t dir;
@@ -975,7 +975,7 @@ isPrecededBy_I(UCaseContextIterator *iter, void *context) {
if(c==0x49) {
return TRUE; /* preceded by I */
}
- dotType=getDotType(c);
+ dotType=getDotType(c);
if(dotType!=UCASE_OTHER_ACCENT) {
return FALSE; /* preceded by different base character (not I), or intervening cc==230 */
}
@@ -986,7 +986,7 @@ isPrecededBy_I(UCaseContextIterator *iter, void *context) {
/* Is followed by one or more cc==230 ? */
static UBool
-isFollowedByMoreAbove(UCaseContextIterator *iter, void *context) {
+isFollowedByMoreAbove(UCaseContextIterator *iter, void *context) {
UChar32 c;
int32_t dotType;
int8_t dir;
@@ -996,7 +996,7 @@ isFollowedByMoreAbove(UCaseContextIterator *iter, void *context) {
}
for(dir=1; (c=iter(context, dir))>=0; dir=0) {
- dotType=getDotType(c);
+ dotType=getDotType(c);
if(dotType==UCASE_ABOVE) {
return TRUE; /* at least one cc==230 following */
} else if(dotType!=UCASE_OTHER_ACCENT) {
@@ -1009,7 +1009,7 @@ isFollowedByMoreAbove(UCaseContextIterator *iter, void *context) {
/* Is followed by a dot above (without cc==230 in between) ? */
static UBool
-isFollowedByDotAbove(UCaseContextIterator *iter, void *context) {
+isFollowedByDotAbove(UCaseContextIterator *iter, void *context) {
UChar32 c;
int32_t dotType;
int8_t dir;
@@ -1022,7 +1022,7 @@ isFollowedByDotAbove(UCaseContextIterator *iter, void *context) {
if(c==0x307) {
return TRUE;
}
- dotType=getDotType(c);
+ dotType=getDotType(c);
if(dotType!=UCASE_OTHER_ACCENT) {
return FALSE; /* next base character or cc==230 in between */
}
@@ -1032,20 +1032,20 @@ isFollowedByDotAbove(UCaseContextIterator *iter, void *context) {
}
U_CAPI int32_t U_EXPORT2
-ucase_toFullLower(UChar32 c,
+ucase_toFullLower(UChar32 c,
UCaseContextIterator *iter, void *context,
const UChar **pString,
- int32_t loc) {
+ int32_t loc) {
// The sign of the result has meaning, input must be non-negative so that it can be returned as is.
U_ASSERT(c >= 0);
UChar32 result=c;
- uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
- if(!UCASE_HAS_EXCEPTION(props)) {
- if(UCASE_IS_UPPER_OR_TITLE(props)) {
+ uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
+ if(!UCASE_HAS_EXCEPTION(props)) {
+ if(UCASE_IS_UPPER_OR_TITLE(props)) {
result=c+UCASE_GET_DELTA(props);
}
} else {
- const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props), *pe2;
+ const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props), *pe2;
uint16_t excWord=*pe++;
int32_t full;
@@ -1063,7 +1063,7 @@ ucase_toFullLower(UChar32 c,
if( loc==UCASE_LOC_LITHUANIAN &&
/* base characters, find accents above */
(((c==0x49 || c==0x4a || c==0x12e) &&
- isFollowedByMoreAbove(iter, context)) ||
+ isFollowedByMoreAbove(iter, context)) ||
/* precomposed with accent above, no need to find one */
(c==0xcc || c==0xcd || c==0x128))
) {
@@ -1115,7 +1115,7 @@ ucase_toFullLower(UChar32 c,
0130; 0069; 0130; 0130; az # LATIN CAPITAL LETTER I WITH DOT ABOVE
*/
return 0x69;
- } else if(loc==UCASE_LOC_TURKISH && c==0x307 && isPrecededBy_I(iter, context)) {
+ } else if(loc==UCASE_LOC_TURKISH && c==0x307 && isPrecededBy_I(iter, context)) {
/*
# When lowercasing, remove dot_above in the sequence I + dot_above, which will turn into i.
# This matches the behavior of the canonically equivalent I-dot_above
@@ -1123,9 +1123,9 @@ ucase_toFullLower(UChar32 c,
0307; ; 0307; 0307; tr After_I; # COMBINING DOT ABOVE
0307; ; 0307; 0307; az After_I; # COMBINING DOT ABOVE
*/
- *pString=nullptr;
+ *pString=nullptr;
return 0; /* remove the dot (continue without output) */
- } else if(loc==UCASE_LOC_TURKISH && c==0x49 && !isFollowedByDotAbove(iter, context)) {
+ } else if(loc==UCASE_LOC_TURKISH && c==0x49 && !isFollowedByDotAbove(iter, context)) {
/*
# When lowercasing, unless an I is before a dot_above, it turns into a dotless i.
@@ -1142,8 +1142,8 @@ ucase_toFullLower(UChar32 c,
*pString=iDot;
return 2;
} else if( c==0x3a3 &&
- !isFollowedByCasedLetter(iter, context, 1) &&
- isFollowedByCasedLetter(iter, context, -1) /* -1=preceded */
+ !isFollowedByCasedLetter(iter, context, 1) &&
+ isFollowedByCasedLetter(iter, context, -1) /* -1=preceded */
) {
/* greek capital sigma maps depending on surrounding cased letters (see SpecialCasing.txt) */
/*
@@ -1167,11 +1167,11 @@ ucase_toFullLower(UChar32 c,
}
}
- if(HAS_SLOT(excWord, UCASE_EXC_DELTA) && UCASE_IS_UPPER_OR_TITLE(props)) {
- int32_t delta;
- GET_SLOT_VALUE(excWord, UCASE_EXC_DELTA, pe2, delta);
- return (excWord&UCASE_EXC_DELTA_IS_NEGATIVE)==0 ? c+delta : c-delta;
- }
+ if(HAS_SLOT(excWord, UCASE_EXC_DELTA) && UCASE_IS_UPPER_OR_TITLE(props)) {
+ int32_t delta;
+ GET_SLOT_VALUE(excWord, UCASE_EXC_DELTA, pe2, delta);
+ return (excWord&UCASE_EXC_DELTA_IS_NEGATIVE)==0 ? c+delta : c-delta;
+ }
if(HAS_SLOT(excWord, UCASE_EXC_LOWER)) {
GET_SLOT_VALUE(excWord, UCASE_EXC_LOWER, pe2, result);
}
@@ -1182,21 +1182,21 @@ ucase_toFullLower(UChar32 c,
/* internal */
static int32_t
-toUpperOrTitle(UChar32 c,
+toUpperOrTitle(UChar32 c,
UCaseContextIterator *iter, void *context,
const UChar **pString,
- int32_t loc,
+ int32_t loc,
UBool upperNotTitle) {
// The sign of the result has meaning, input must be non-negative so that it can be returned as is.
U_ASSERT(c >= 0);
UChar32 result=c;
- uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
- if(!UCASE_HAS_EXCEPTION(props)) {
+ uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
+ if(!UCASE_HAS_EXCEPTION(props)) {
if(UCASE_GET_TYPE(props)==UCASE_LOWER) {
result=c+UCASE_GET_DELTA(props);
}
} else {
- const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props), *pe2;
+ const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props), *pe2;
uint16_t excWord=*pe++;
int32_t full, idx;
@@ -1217,7 +1217,7 @@ toUpperOrTitle(UChar32 c,
0069; 0069; 0130; 0130; az; # LATIN SMALL LETTER I
*/
return 0x130;
- } else if(loc==UCASE_LOC_LITHUANIAN && c==0x307 && isPrecededBySoftDotted(iter, context)) {
+ } else if(loc==UCASE_LOC_LITHUANIAN && c==0x307 && isPrecededBySoftDotted(iter, context)) {
/*
# Lithuanian
@@ -1227,7 +1227,7 @@ toUpperOrTitle(UChar32 c,
0307; 0307; ; ; lt After_Soft_Dotted; # COMBINING DOT ABOVE
*/
- *pString=nullptr;
+ *pString=nullptr;
return 0; /* remove the dot (continue without output) */
} else {
/* no known conditional special case mapping, use a normal mapping */
@@ -1261,11 +1261,11 @@ toUpperOrTitle(UChar32 c,
}
}
- if(HAS_SLOT(excWord, UCASE_EXC_DELTA) && UCASE_GET_TYPE(props)==UCASE_LOWER) {
- int32_t delta;
- GET_SLOT_VALUE(excWord, UCASE_EXC_DELTA, pe2, delta);
- return (excWord&UCASE_EXC_DELTA_IS_NEGATIVE)==0 ? c+delta : c-delta;
- }
+ if(HAS_SLOT(excWord, UCASE_EXC_DELTA) && UCASE_GET_TYPE(props)==UCASE_LOWER) {
+ int32_t delta;
+ GET_SLOT_VALUE(excWord, UCASE_EXC_DELTA, pe2, delta);
+ return (excWord&UCASE_EXC_DELTA_IS_NEGATIVE)==0 ? c+delta : c-delta;
+ }
if(!upperNotTitle && HAS_SLOT(excWord, UCASE_EXC_TITLE)) {
idx=UCASE_EXC_TITLE;
} else if(HAS_SLOT(excWord, UCASE_EXC_UPPER)) {
@@ -1281,19 +1281,19 @@ toUpperOrTitle(UChar32 c,
}
U_CAPI int32_t U_EXPORT2
-ucase_toFullUpper(UChar32 c,
+ucase_toFullUpper(UChar32 c,
UCaseContextIterator *iter, void *context,
const UChar **pString,
- int32_t caseLocale) {
- return toUpperOrTitle(c, iter, context, pString, caseLocale, TRUE);
+ int32_t caseLocale) {
+ return toUpperOrTitle(c, iter, context, pString, caseLocale, TRUE);
}
U_CAPI int32_t U_EXPORT2
-ucase_toFullTitle(UChar32 c,
+ucase_toFullTitle(UChar32 c,
UCaseContextIterator *iter, void *context,
const UChar **pString,
- int32_t caseLocale) {
- return toUpperOrTitle(c, iter, context, pString, caseLocale, FALSE);
+ int32_t caseLocale) {
+ return toUpperOrTitle(c, iter, context, pString, caseLocale, FALSE);
}
/* case folding ------------------------------------------------------------- */
@@ -1339,14 +1339,14 @@ ucase_toFullTitle(UChar32 c,
/* return the simple case folding mapping for c */
U_CAPI UChar32 U_EXPORT2
-ucase_fold(UChar32 c, uint32_t options) {
- uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
- if(!UCASE_HAS_EXCEPTION(props)) {
- if(UCASE_IS_UPPER_OR_TITLE(props)) {
+ucase_fold(UChar32 c, uint32_t options) {
+ uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
+ if(!UCASE_HAS_EXCEPTION(props)) {
+ if(UCASE_IS_UPPER_OR_TITLE(props)) {
c+=UCASE_GET_DELTA(props);
}
} else {
- const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props);
+ const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props);
uint16_t excWord=*pe++;
int32_t idx;
if(excWord&UCASE_EXC_CONDITIONAL_FOLD) {
@@ -1371,14 +1371,14 @@ ucase_fold(UChar32 c, uint32_t options) {
}
}
}
- if((excWord&UCASE_EXC_NO_SIMPLE_CASE_FOLDING)!=0) {
- return c;
- }
- if(HAS_SLOT(excWord, UCASE_EXC_DELTA) && UCASE_IS_UPPER_OR_TITLE(props)) {
- int32_t delta;
- GET_SLOT_VALUE(excWord, UCASE_EXC_DELTA, pe, delta);
- return (excWord&UCASE_EXC_DELTA_IS_NEGATIVE)==0 ? c+delta : c-delta;
- }
+ if((excWord&UCASE_EXC_NO_SIMPLE_CASE_FOLDING)!=0) {
+ return c;
+ }
+ if(HAS_SLOT(excWord, UCASE_EXC_DELTA) && UCASE_IS_UPPER_OR_TITLE(props)) {
+ int32_t delta;
+ GET_SLOT_VALUE(excWord, UCASE_EXC_DELTA, pe, delta);
+ return (excWord&UCASE_EXC_DELTA_IS_NEGATIVE)==0 ? c+delta : c-delta;
+ }
if(HAS_SLOT(excWord, UCASE_EXC_FOLD)) {
idx=UCASE_EXC_FOLD;
} else if(HAS_SLOT(excWord, UCASE_EXC_LOWER)) {
@@ -1407,19 +1407,19 @@ ucase_fold(UChar32 c, uint32_t options) {
*/
U_CAPI int32_t U_EXPORT2
-ucase_toFullFolding(UChar32 c,
+ucase_toFullFolding(UChar32 c,
const UChar **pString,
uint32_t options) {
// The sign of the result has meaning, input must be non-negative so that it can be returned as is.
U_ASSERT(c >= 0);
UChar32 result=c;
- uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
- if(!UCASE_HAS_EXCEPTION(props)) {
- if(UCASE_IS_UPPER_OR_TITLE(props)) {
+ uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
+ if(!UCASE_HAS_EXCEPTION(props)) {
+ if(UCASE_IS_UPPER_OR_TITLE(props)) {
result=c+UCASE_GET_DELTA(props);
}
} else {
- const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props), *pe2;
+ const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props), *pe2;
uint16_t excWord=*pe++;
int32_t full, idx;
@@ -1466,14 +1466,14 @@ ucase_toFullFolding(UChar32 c,
}
}
- if((excWord&UCASE_EXC_NO_SIMPLE_CASE_FOLDING)!=0) {
- return ~c;
- }
- if(HAS_SLOT(excWord, UCASE_EXC_DELTA) && UCASE_IS_UPPER_OR_TITLE(props)) {
- int32_t delta;
- GET_SLOT_VALUE(excWord, UCASE_EXC_DELTA, pe2, delta);
- return (excWord&UCASE_EXC_DELTA_IS_NEGATIVE)==0 ? c+delta : c-delta;
- }
+ if((excWord&UCASE_EXC_NO_SIMPLE_CASE_FOLDING)!=0) {
+ return ~c;
+ }
+ if(HAS_SLOT(excWord, UCASE_EXC_DELTA) && UCASE_IS_UPPER_OR_TITLE(props)) {
+ int32_t delta;
+ GET_SLOT_VALUE(excWord, UCASE_EXC_DELTA, pe2, delta);
+ return (excWord&UCASE_EXC_DELTA_IS_NEGATIVE)==0 ? c+delta : c-delta;
+ }
if(HAS_SLOT(excWord, UCASE_EXC_FOLD)) {
idx=UCASE_EXC_FOLD;
} else if(HAS_SLOT(excWord, UCASE_EXC_LOWER)) {
@@ -1493,36 +1493,36 @@ ucase_toFullFolding(UChar32 c,
U_CAPI UBool U_EXPORT2
u_isULowercase(UChar32 c) {
- return (UBool)(UCASE_LOWER==ucase_getType(c));
+ return (UBool)(UCASE_LOWER==ucase_getType(c));
}
U_CAPI UBool U_EXPORT2
u_isUUppercase(UChar32 c) {
- return (UBool)(UCASE_UPPER==ucase_getType(c));
+ return (UBool)(UCASE_UPPER==ucase_getType(c));
}
/* Transforms the Unicode character to its lower case equivalent.*/
U_CAPI UChar32 U_EXPORT2
u_tolower(UChar32 c) {
- return ucase_tolower(c);
+ return ucase_tolower(c);
}
/* Transforms the Unicode character to its upper case equivalent.*/
U_CAPI UChar32 U_EXPORT2
u_toupper(UChar32 c) {
- return ucase_toupper(c);
+ return ucase_toupper(c);
}
/* Transforms the Unicode character to its title case equivalent.*/
U_CAPI UChar32 U_EXPORT2
u_totitle(UChar32 c) {
- return ucase_totitle(c);
+ return ucase_totitle(c);
}
/* return the simple case folding mapping for c */
U_CAPI UChar32 U_EXPORT2
u_foldCase(UChar32 c, uint32_t options) {
- return ucase_fold(c, options);
+ return ucase_fold(c, options);
}
U_CFUNC int32_t U_EXPORT2
@@ -1531,17 +1531,17 @@ ucase_hasBinaryProperty(UChar32 c, UProperty which) {
const UChar *resultString;
switch(which) {
case UCHAR_LOWERCASE:
- return (UBool)(UCASE_LOWER==ucase_getType(c));
+ return (UBool)(UCASE_LOWER==ucase_getType(c));
case UCHAR_UPPERCASE:
- return (UBool)(UCASE_UPPER==ucase_getType(c));
+ return (UBool)(UCASE_UPPER==ucase_getType(c));
case UCHAR_SOFT_DOTTED:
- return ucase_isSoftDotted(c);
+ return ucase_isSoftDotted(c);
case UCHAR_CASE_SENSITIVE:
- return ucase_isCaseSensitive(c);
+ return ucase_isCaseSensitive(c);
case UCHAR_CASED:
- return (UBool)(UCASE_NONE!=ucase_getType(c));
+ return (UBool)(UCASE_NONE!=ucase_getType(c));
case UCHAR_CASE_IGNORABLE:
- return (UBool)(ucase_getTypeOrIgnorable(c)>>2);
+ return (UBool)(ucase_getTypeOrIgnorable(c)>>2);
/*
* Note: The following Changes_When_Xyz are defined as testing whether
* the NFD form of the input changes when Xyz-case-mapped.
@@ -1555,17 +1555,17 @@ ucase_hasBinaryProperty(UChar32 c, UProperty which) {
* start sets for normalization and case mappings.
*/
case UCHAR_CHANGES_WHEN_LOWERCASED:
- return (UBool)(ucase_toFullLower(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
+ return (UBool)(ucase_toFullLower(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
case UCHAR_CHANGES_WHEN_UPPERCASED:
- return (UBool)(ucase_toFullUpper(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
+ return (UBool)(ucase_toFullUpper(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
case UCHAR_CHANGES_WHEN_TITLECASED:
- return (UBool)(ucase_toFullTitle(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
+ return (UBool)(ucase_toFullTitle(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
/* case UCHAR_CHANGES_WHEN_CASEFOLDED: -- in uprops.c */
case UCHAR_CHANGES_WHEN_CASEMAPPED:
return (UBool)(
- ucase_toFullLower(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0 ||
- ucase_toFullUpper(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0 ||
- ucase_toFullTitle(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
+ ucase_toFullLower(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0 ||
+ ucase_toFullUpper(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0 ||
+ ucase_toFullTitle(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
default:
return FALSE;
}
diff --git a/contrib/libs/icu/common/ucase.h b/contrib/libs/icu/common/ucase.h
index cd66f86e6c..b0a453b87e 100644
--- a/contrib/libs/icu/common/ucase.h
+++ b/contrib/libs/icu/common/ucase.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: ucase.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -26,7 +26,7 @@
#include "putilimp.h"
#include "uset_imp.h"
#include "udataswp.h"
-#include "utrie2.h"
+#include "utrie2.h"
#ifdef __cplusplus
U_NAMESPACE_BEGIN
@@ -39,7 +39,7 @@ U_NAMESPACE_END
/* library API -------------------------------------------------------------- */
U_CFUNC void U_EXPORT2
-ucase_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode);
+ucase_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode);
/**
* Requires non-NULL locale ID but otherwise does the equivalent of
@@ -47,7 +47,7 @@ ucase_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode);
* Accepts both 2- and 3-letter codes and accepts case variants.
*/
U_CFUNC int32_t
-ucase_getCaseLocale(const char *locale);
+ucase_getCaseLocale(const char *locale);
/* Casing locale types for ucase_getCaseLocale */
enum {
@@ -62,7 +62,7 @@ enum {
/**
* Bit mask for getting just the options from a string compare options word
* that are relevant for case-insensitive string comparison.
- * See stringoptions.h. Also include _STRNCMP_STYLE and U_COMPARE_CODE_POINT_ORDER.
+ * See stringoptions.h. Also include _STRNCMP_STYLE and U_COMPARE_CODE_POINT_ORDER.
* @internal
*/
#define _STRCASECMP_OPTIONS_MASK 0xffff
@@ -70,30 +70,30 @@ enum {
/**
* Bit mask for getting just the options from a string compare options word
* that are relevant for case folding (of a single string or code point).
- *
- * Currently only bit 0 for U_FOLD_CASE_EXCLUDE_SPECIAL_I.
- * It is conceivable that at some point we might use one more bit for using uppercase sharp s.
- * It is conceivable that at some point we might want the option to use only simple case foldings
- * when operating on strings.
- *
- * See stringoptions.h.
+ *
+ * Currently only bit 0 for U_FOLD_CASE_EXCLUDE_SPECIAL_I.
+ * It is conceivable that at some point we might use one more bit for using uppercase sharp s.
+ * It is conceivable that at some point we might want the option to use only simple case foldings
+ * when operating on strings.
+ *
+ * See stringoptions.h.
* @internal
*/
-#define _FOLD_CASE_OPTIONS_MASK 7
+#define _FOLD_CASE_OPTIONS_MASK 7
/* single-code point functions */
U_CAPI UChar32 U_EXPORT2
-ucase_tolower(UChar32 c);
+ucase_tolower(UChar32 c);
U_CAPI UChar32 U_EXPORT2
-ucase_toupper(UChar32 c);
+ucase_toupper(UChar32 c);
U_CAPI UChar32 U_EXPORT2
-ucase_totitle(UChar32 c);
+ucase_totitle(UChar32 c);
U_CAPI UChar32 U_EXPORT2
-ucase_fold(UChar32 c, uint32_t options);
+ucase_fold(UChar32 c, uint32_t options);
/**
* Adds all simple case mappings and the full case folding for c to sa,
@@ -105,7 +105,7 @@ ucase_fold(UChar32 c, uint32_t options);
* - for k include the Kelvin sign
*/
U_CFUNC void U_EXPORT2
-ucase_addCaseClosure(UChar32 c, const USetAdder *sa);
+ucase_addCaseClosure(UChar32 c, const USetAdder *sa);
/**
* Maps the string to single code points and adds the associated case closure
@@ -120,7 +120,7 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa);
* @return TRUE if the string was found
*/
U_CFUNC UBool U_EXPORT2
-ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa);
+ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa);
#ifdef __cplusplus
U_NAMESPACE_BEGIN
@@ -149,49 +149,49 @@ private:
int32_t rowCpIndex;
};
-/**
- * Fast case mapping data for ASCII/Latin.
- * Linear arrays of delta bytes: 0=no mapping; EXC=exception.
- * Deltas must not cross the ASCII boundary, or else they cannot be easily used
- * in simple UTF-8 code.
- */
-namespace LatinCase {
-
-/** Case mapping/folding data for code points up to U+017F. */
-constexpr UChar LIMIT = 0x180;
-/** U+017F case-folds and uppercases crossing the ASCII boundary. */
-constexpr UChar LONG_S = 0x17f;
-/** Exception: Complex mapping, or too-large delta. */
-constexpr int8_t EXC = -0x80;
-
-/** Deltas for lowercasing for most locales, and default case folding. */
-extern const int8_t TO_LOWER_NORMAL[LIMIT];
-/** Deltas for lowercasing for tr/az/lt, and Turkic case folding. */
-extern const int8_t TO_LOWER_TR_LT[LIMIT];
-
-/** Deltas for uppercasing for most locales. */
-extern const int8_t TO_UPPER_NORMAL[LIMIT];
-/** Deltas for uppercasing for tr/az. */
-extern const int8_t TO_UPPER_TR[LIMIT];
-
-} // namespace LatinCase
-
+/**
+ * Fast case mapping data for ASCII/Latin.
+ * Linear arrays of delta bytes: 0=no mapping; EXC=exception.
+ * Deltas must not cross the ASCII boundary, or else they cannot be easily used
+ * in simple UTF-8 code.
+ */
+namespace LatinCase {
+
+/** Case mapping/folding data for code points up to U+017F. */
+constexpr UChar LIMIT = 0x180;
+/** U+017F case-folds and uppercases crossing the ASCII boundary. */
+constexpr UChar LONG_S = 0x17f;
+/** Exception: Complex mapping, or too-large delta. */
+constexpr int8_t EXC = -0x80;
+
+/** Deltas for lowercasing for most locales, and default case folding. */
+extern const int8_t TO_LOWER_NORMAL[LIMIT];
+/** Deltas for lowercasing for tr/az/lt, and Turkic case folding. */
+extern const int8_t TO_LOWER_TR_LT[LIMIT];
+
+/** Deltas for uppercasing for most locales. */
+extern const int8_t TO_UPPER_NORMAL[LIMIT];
+/** Deltas for uppercasing for tr/az. */
+extern const int8_t TO_UPPER_TR[LIMIT];
+
+} // namespace LatinCase
+
U_NAMESPACE_END
#endif
/** @return UCASE_NONE, UCASE_LOWER, UCASE_UPPER, UCASE_TITLE */
U_CAPI int32_t U_EXPORT2
-ucase_getType(UChar32 c);
+ucase_getType(UChar32 c);
/** @return like ucase_getType() but also sets UCASE_IGNORABLE if c is case-ignorable */
U_CAPI int32_t U_EXPORT2
-ucase_getTypeOrIgnorable(UChar32 c);
+ucase_getTypeOrIgnorable(UChar32 c);
U_CAPI UBool U_EXPORT2
-ucase_isSoftDotted(UChar32 c);
+ucase_isSoftDotted(UChar32 c);
U_CAPI UBool U_EXPORT2
-ucase_isCaseSensitive(UChar32 c);
+ucase_isCaseSensitive(UChar32 c);
/* string case mapping functions */
@@ -264,7 +264,7 @@ enum {
* @param context Pointer to be passed into iter.
* @param pString If the mapping result is a string, then the pointer is
* written to *pString.
- * @param caseLocale Case locale value from ucase_getCaseLocale().
+ * @param caseLocale Case locale value from ucase_getCaseLocale().
* @return Output code point or string length, see UCASE_MAX_STRING_LENGTH.
*
* @see UCaseContextIterator
@@ -272,25 +272,25 @@ enum {
* @internal
*/
U_CAPI int32_t U_EXPORT2
-ucase_toFullLower(UChar32 c,
+ucase_toFullLower(UChar32 c,
UCaseContextIterator *iter, void *context,
const UChar **pString,
- int32_t caseLocale);
+ int32_t caseLocale);
U_CAPI int32_t U_EXPORT2
-ucase_toFullUpper(UChar32 c,
+ucase_toFullUpper(UChar32 c,
UCaseContextIterator *iter, void *context,
const UChar **pString,
- int32_t caseLocale);
+ int32_t caseLocale);
U_CAPI int32_t U_EXPORT2
-ucase_toFullTitle(UChar32 c,
+ucase_toFullTitle(UChar32 c,
UCaseContextIterator *iter, void *context,
const UChar **pString,
- int32_t caseLocale);
+ int32_t caseLocale);
U_CAPI int32_t U_EXPORT2
-ucase_toFullFolding(UChar32 c,
+ucase_toFullFolding(UChar32 c,
const UChar **pString,
uint32_t options);
@@ -304,10 +304,10 @@ U_CDECL_BEGIN
* @internal
*/
typedef int32_t U_CALLCONV
-UCaseMapFull(UChar32 c,
+UCaseMapFull(UChar32 c,
UCaseContextIterator *iter, void *context,
const UChar **pString,
- int32_t caseLocale);
+ int32_t caseLocale);
U_CDECL_END
@@ -336,9 +336,9 @@ enum {
/* definitions for 16-bit case properties word ------------------------------ */
-U_CFUNC const UTrie2 * U_EXPORT2
-ucase_getTrie();
-
+U_CFUNC const UTrie2 * U_EXPORT2
+ucase_getTrie();
+
/* 2-bit constants for types of cased characters */
#define UCASE_TYPE_MASK 3
enum {
@@ -351,14 +351,14 @@ enum {
#define UCASE_GET_TYPE(props) ((props)&UCASE_TYPE_MASK)
#define UCASE_GET_TYPE_AND_IGNORABLE(props) ((props)&7)
-#define UCASE_IS_UPPER_OR_TITLE(props) ((props)&2)
-
+#define UCASE_IS_UPPER_OR_TITLE(props) ((props)&2)
+
#define UCASE_IGNORABLE 4
-#define UCASE_EXCEPTION 8
-#define UCASE_SENSITIVE 0x10
+#define UCASE_EXCEPTION 8
+#define UCASE_SENSITIVE 0x10
+
+#define UCASE_HAS_EXCEPTION(props) ((props)&UCASE_EXCEPTION)
-#define UCASE_HAS_EXCEPTION(props) ((props)&UCASE_EXCEPTION)
-
#define UCASE_DOT_MASK 0x60
enum {
UCASE_NO_DOT=0, /* normal characters with cc=0 */
@@ -379,9 +379,9 @@ enum {
# define UCASE_GET_DELTA(props) (int16_t)(((props)&0x8000) ? (((props)>>UCASE_DELTA_SHIFT)|0xfe00) : ((uint16_t)(props)>>UCASE_DELTA_SHIFT))
#endif
-/* exception: bits 15..4 are an unsigned 12-bit index into the exceptions array */
-#define UCASE_EXC_SHIFT 4
-#define UCASE_EXC_MASK 0xfff0
+/* exception: bits 15..4 are an unsigned 12-bit index into the exceptions array */
+#define UCASE_EXC_SHIFT 4
+#define UCASE_EXC_MASK 0xfff0
#define UCASE_MAX_EXCEPTIONS ((UCASE_EXC_MASK>>UCASE_EXC_SHIFT)+1)
/* definitions for 16-bit main exceptions word ------------------------------ */
@@ -392,7 +392,7 @@ enum {
UCASE_EXC_FOLD,
UCASE_EXC_UPPER,
UCASE_EXC_TITLE,
- UCASE_EXC_DELTA,
+ UCASE_EXC_DELTA,
UCASE_EXC_5, /* reserved */
UCASE_EXC_CLOSURE,
UCASE_EXC_FULL_MAPPINGS,
@@ -402,11 +402,11 @@ enum {
/* each slot is 2 uint16_t instead of 1 */
#define UCASE_EXC_DOUBLE_SLOTS 0x100
-enum {
- UCASE_EXC_NO_SIMPLE_CASE_FOLDING=0x200,
- UCASE_EXC_DELTA_IS_NEGATIVE=0x400,
- UCASE_EXC_SENSITIVE=0x800
-};
+enum {
+ UCASE_EXC_NO_SIMPLE_CASE_FOLDING=0x200,
+ UCASE_EXC_DELTA_IS_NEGATIVE=0x400,
+ UCASE_EXC_SENSITIVE=0x800
+};
/* UCASE_EXC_DOT_MASK=UCASE_DOT_MASK<<UCASE_EXC_DOT_SHIFT */
#define UCASE_EXC_DOT_SHIFT 7
diff --git a/contrib/libs/icu/common/ucase_props_data.h b/contrib/libs/icu/common/ucase_props_data.h
index 7be2a34a92..7c97230957 100644
--- a/contrib/libs/icu/common/ucase_props_data.h
+++ b/contrib/libs/icu/common/ucase_props_data.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// Copyright (C) 1999-2016, International Business Machines
@@ -11,145 +11,145 @@
#ifdef INCLUDED_FROM_UCASE_CPP
-static const UVersionInfo ucase_props_dataVersion={0xd,0,0,0};
+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,0x70ca,0x6098,0x687,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,
-0x3b9,0x3c1,0x3c9,0x3d1,0x3d9,0x3e1,0x3e9,0x3f1,0x3f9,0x401,0x409,0x411,0x419,0x421,0x429,0x431,
-0x439,0x441,0x449,0x451,0x459,0x461,0x469,0x471,0x46d,0x475,0x47a,0x482,0x489,0x491,0x499,0x4a1,
-0x4a9,0x4b1,0x4b9,0x4c1,0x355,0x35d,0x4c6,0x4ce,0x4d3,0x4db,0x4e3,0x4eb,0x4ea,0x4f2,0x4f7,0x4ff,
-0x507,0x50e,0x512,0x355,0x355,0x355,0x519,0x521,0x529,0x52b,0x533,0x53b,0x53f,0x540,0x548,0x550,
-0x558,0x540,0x560,0x565,0x558,0x540,0x56d,0x575,0x53f,0x57d,0x585,0x58d,0x595,0x355,0x59d,0x355,
-0x5a5,0x4ec,0x5ad,0x58d,0x53f,0x57d,0x5b4,0x58d,0x5bc,0x5be,0x548,0x58d,0x53f,0x355,0x5c6,0x355,
-0x355,0x5cc,0x5d3,0x355,0x355,0x5d7,0x5df,0x355,0x5e3,0x5ea,0x355,0x5f1,0x5f9,0x600,0x608,0x355,
-0x355,0x60d,0x615,0x61d,0x625,0x62d,0x634,0x63c,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x644,0x355,0x355,0x654,0x654,0x64c,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x65c,0x65c,0x54c,0x54c,0x355,0x662,0x66a,0x355,
-0x672,0x355,0x67a,0x355,0x681,0x687,0x355,0x355,0x355,0x68f,0x355,0x355,0x355,0x355,0x355,0x355,
-0x696,0x355,0x69d,0x6a5,0x355,0x6ad,0x6b5,0x355,0x57c,0x6b8,0x6c0,0x6c6,0x5bc,0x6ce,0x355,0x6d5,
-0x355,0x6da,0x355,0x6e0,0x6e8,0x6ec,0x6f4,0x6fc,0x704,0x709,0x70c,0x714,0x724,0x71c,0x734,0x72c,
-0x37c,0x73c,0x37c,0x744,0x747,0x37c,0x74f,0x37c,0x757,0x75f,0x767,0x76f,0x777,0x77f,0x787,0x78f,
-0x797,0x79e,0x355,0x7a6,0x7ae,0x355,0x7b6,0x7be,0x7c6,0x7ce,0x7d6,0x7de,0x7e6,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x7e9,0x7ef,0x7f5,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x7fd,0x802,0x806,0x80e,0x37c,0x37c,0x37c,0x816,0x81e,0x825,0x355,0x82a,0x355,0x355,0x355,0x832,
-0x355,0x677,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x53e,0x83a,0x355,0x355,0x841,0x355,0x355,0x849,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x851,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x6e0,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x857,0x355,0x85f,0x864,0x86c,0x355,0x355,0x874,0x87c,0x884,0x37c,0x889,0x891,0x897,0x89f,0x8a2,
-0x8aa,0x8b1,0x355,0x355,0x355,0x355,0x8b8,0x8c0,0x355,0x8c8,0x8cf,0x355,0x529,0x8d4,0x8dc,0x681,
-0x355,0x8e2,0x8ea,0x8ee,0x355,0x8f6,0x8fe,0x906,0x355,0x90c,0x910,0x918,0x928,0x920,0x355,0x930,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x938,0x355,0x355,0x355,0x355,0x940,0x5bc,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x945,0x94d,0x951,0x355,0x355,0x355,0x355,0x338,0x33e,0x959,0x961,0x968,0x4ec,0x355,0x355,0x970,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0xd58,0xd58,0xd70,0xdb0,0xdf0,0xe2c,0xe6c,0xeac,0xee4,0xf24,0xf64,0xfa4,0xfe4,0x1024,0x1064,0x10a4,
-0x10e4,0x1124,0x1164,0x11a4,0x11b4,0x11e8,0x1224,0x1264,0x12a4,0x12e4,0xd54,0x1318,0x134c,0x138c,0x13a8,0x13dc,
-0x9e1,0xa11,0xa51,0xa90,0x188,0x188,0xac8,0x188,0x188,0x188,0x188,0x188,0x188,0xaf1,0x188,0x188,
-0x188,0x188,0x188,0x188,0x188,0x188,0x188,0xb31,0x188,0x188,0xb66,0xba5,0xbe5,0xc1f,0xc56,0x188,
+static const uint16_t ucase_props_trieIndex[12356]={
+0x336,0x33e,0x346,0x34e,0x35c,0x364,0x36c,0x374,0x37c,0x384,0x38b,0x393,0x39b,0x3a3,0x3ab,0x3b3,
+0x3b9,0x3c1,0x3c9,0x3d1,0x3d9,0x3e1,0x3e9,0x3f1,0x3f9,0x401,0x409,0x411,0x419,0x421,0x429,0x431,
+0x439,0x441,0x449,0x451,0x459,0x461,0x469,0x471,0x46d,0x475,0x47a,0x482,0x489,0x491,0x499,0x4a1,
+0x4a9,0x4b1,0x4b9,0x4c1,0x355,0x35d,0x4c6,0x4ce,0x4d3,0x4db,0x4e3,0x4eb,0x4ea,0x4f2,0x4f7,0x4ff,
+0x507,0x50e,0x512,0x355,0x355,0x355,0x519,0x521,0x529,0x52b,0x533,0x53b,0x53f,0x540,0x548,0x550,
+0x558,0x540,0x560,0x565,0x558,0x540,0x56d,0x575,0x53f,0x57d,0x585,0x58d,0x595,0x355,0x59d,0x355,
+0x5a5,0x4ec,0x5ad,0x58d,0x53f,0x57d,0x5b4,0x58d,0x5bc,0x5be,0x548,0x58d,0x53f,0x355,0x5c6,0x355,
+0x355,0x5cc,0x5d3,0x355,0x355,0x5d7,0x5df,0x355,0x5e3,0x5ea,0x355,0x5f1,0x5f9,0x600,0x608,0x355,
+0x355,0x60d,0x615,0x61d,0x625,0x62d,0x634,0x63c,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x644,0x355,0x355,0x654,0x654,0x64c,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x65c,0x65c,0x54c,0x54c,0x355,0x662,0x66a,0x355,
+0x672,0x355,0x67a,0x355,0x681,0x687,0x355,0x355,0x355,0x68f,0x355,0x355,0x355,0x355,0x355,0x355,
+0x696,0x355,0x69d,0x6a5,0x355,0x6ad,0x6b5,0x355,0x57c,0x6b8,0x6c0,0x6c6,0x5bc,0x6ce,0x355,0x6d5,
+0x355,0x6da,0x355,0x6e0,0x6e8,0x6ec,0x6f4,0x6fc,0x704,0x709,0x70c,0x714,0x724,0x71c,0x734,0x72c,
+0x37c,0x73c,0x37c,0x744,0x747,0x37c,0x74f,0x37c,0x757,0x75f,0x767,0x76f,0x777,0x77f,0x787,0x78f,
+0x797,0x79e,0x355,0x7a6,0x7ae,0x355,0x7b6,0x7be,0x7c6,0x7ce,0x7d6,0x7de,0x7e6,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x7e9,0x7ef,0x7f5,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x7fd,0x802,0x806,0x80e,0x37c,0x37c,0x37c,0x816,0x81e,0x825,0x355,0x82a,0x355,0x355,0x355,0x832,
+0x355,0x677,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x53e,0x83a,0x355,0x355,0x841,0x355,0x355,0x849,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x851,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x6e0,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x857,0x355,0x85f,0x864,0x86c,0x355,0x355,0x874,0x87c,0x884,0x37c,0x889,0x891,0x897,0x89f,0x8a2,
+0x8aa,0x8b1,0x355,0x355,0x355,0x355,0x8b8,0x8c0,0x355,0x8c8,0x8cf,0x355,0x529,0x8d4,0x8dc,0x681,
+0x355,0x8e2,0x8ea,0x8ee,0x355,0x8f6,0x8fe,0x906,0x355,0x90c,0x910,0x918,0x928,0x920,0x355,0x930,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x938,0x355,0x355,0x355,0x355,0x940,0x5bc,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x945,0x94d,0x951,0x355,0x355,0x355,0x355,0x338,0x33e,0x959,0x961,0x968,0x4ec,0x355,0x355,0x970,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0xd58,0xd58,0xd70,0xdb0,0xdf0,0xe2c,0xe6c,0xeac,0xee4,0xf24,0xf64,0xfa4,0xfe4,0x1024,0x1064,0x10a4,
+0x10e4,0x1124,0x1164,0x11a4,0x11b4,0x11e8,0x1224,0x1264,0x12a4,0x12e4,0xd54,0x1318,0x134c,0x138c,0x13a8,0x13dc,
+0x9e1,0xa11,0xa51,0xa90,0x188,0x188,0xac8,0x188,0x188,0x188,0x188,0x188,0x188,0xaf1,0x188,0x188,
+0x188,0x188,0x188,0x188,0x188,0x188,0x188,0xb31,0x188,0x188,0xb66,0xba5,0xbe5,0xc1f,0xc56,0x188,
0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,
0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,
0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,
@@ -174,266 +174,266 @@ static const uint16_t ucase_props_trieIndex[12356]={
0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,
0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,
0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,
-0xc96,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x977,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x6b5,0x355,0x355,0x355,0x97f,0x355,0x355,0x355,
-0x355,0x987,0x98d,0x991,0x355,0x355,0x995,0x999,0x99f,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x9a7,0x9ab,0x355,0x355,0x355,0x355,0x355,0x9b3,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x9bb,0x9bf,0x9c7,0x9cb,0x355,0x9d2,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x9d8,0x355,0x355,0x355,0x355,0x9df,0x355,0x355,0x355,0x355,
-0x355,0x53f,0x9e4,0x9eb,0x5bd,0x5bc,0x9ef,0x53c,0x355,0x9f7,0x9fe,0x355,0xa04,0x5bc,0xa09,0xa11,
-0x355,0x355,0xa16,0x355,0x355,0x355,0x355,0x338,0xa1e,0x5bc,0x5be,0xa26,0xa2d,0x355,0x355,0x355,
-0x355,0x355,0x9e4,0xa35,0x355,0x355,0xa3d,0xa45,0x355,0x355,0x355,0x355,0x355,0x355,0xa49,0xa51,
-0x355,0x355,0xa59,0x4b0,0x355,0x355,0xa61,0x355,0x355,0xa67,0xa6f,0x355,0x355,0x355,0x355,0x355,
-0x355,0xa74,0x355,0x355,0x355,0xa7c,0xa84,0x355,0x355,0xa8c,0xa94,0x355,0x355,0x355,0xa97,0x6b5,
-0xa9f,0xaa3,0xaab,0x355,0xab2,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0xab9,0x355,0x355,0x940,0xac1,0x355,0x355,0x355,0xac7,0xacf,0x355,0xad3,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0xad9,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0xadf,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0xae6,0x355,0xaec,0x57c,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0xa7c,0xa84,0x355,0x355,0x355,0x355,0x355,0x355,0x677,0x355,0xaf2,0x355,0x355,
-0xafa,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0xaff,0x57c,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0xb07,0xb0f,0xb15,0x355,0x355,0x355,0x355,0xb1d,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0xb25,0xb2d,0xb32,0xb38,0xb40,0xb48,0xb50,0xb29,0xb58,0xb60,
-0xb68,0xb6f,0xb2a,0xb25,0xb2d,0xb28,0xb38,0xb2b,0xb26,0xb77,0xb29,0xb7f,0xb87,0xb8f,0xb96,0xb82,
-0xb8a,0xb92,0xb99,0xb85,0xba1,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x87c,0xba9,0x87c,0xbb0,0xbb7,0xbbf,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0xbc7,0xbcf,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0xbd3,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x9d0,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0xbdb,0x355,0xbe3,0xbeb,0xbf2,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0xb21,
-0xbfa,0xbfa,0xc00,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x9f9,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x53f,0x87c,0x87c,0x87c,0x355,0x355,0x355,0x355,0x87c,0x87c,
-0x87c,0x87c,0x87c,0x87c,0x87c,0xc08,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
-0x355,0x355,0x355,0x355,0x355,0x355,0x335,0x335,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,0,0,0,0,0,0,0,0,0,0,4,
-0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,
-0,0,4,0,0,0,0,0,0,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,
-0x1012,0xa,0x5a,0x7a,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0xba,0x1012,0x1012,0x1012,0x1012,
-0x1012,0x1012,0x1012,0,0,0,4,0,4,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,
-0xf011,0xf9,0xf031,0x149,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0x189,0xf011,0xf011,0xf011,0xf011,
-0xf011,0xf011,0xf011,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,
-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,0,0,0,
-0,0,0,0,0,0,0,0,4,0,1,0,0,4,0,4,
-0,0,0,0,4,0x1c9,0,4,4,0,1,0,0,0,0,0,
-0x1012,0x1012,0x1012,0x1012,0x1012,0x1fa,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x5a,0x5a,0x1012,0x1012,
-0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x239,
-0xf011,0xf011,0xf011,0xf011,0xf011,0x2d9,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,
-0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0x3c91,
-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,
-0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x31a,0xff91,0x92,0xff91,0x92,0xff91,0x31a,0xffb1,
-0x33a,0x389,0x92,0xff91,0x92,0xff91,0x92,0xff91,1,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,
-0xff91,0x92,0xff91,0x92,0xff91,0x3d9,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,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
-0x92,0xff91,0x92,0xff91,0xc392,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x459,0x6191,0x6912,0x92,0xff91,
-0x92,0xff91,0x6712,0x92,0xff91,0x6692,0x6692,0x92,0xff91,1,0x2792,0x6512,0x6592,0x92,0xff91,0x6692,
-0x6792,0x3091,0x6992,0x6892,0x92,0xff91,0x5191,1,0x6992,0x6a92,0x4111,0x6b12,0x92,0xff91,0x92,0xff91,
-0x92,0xff91,0x6d12,0x92,0xff91,0x6d12,1,1,0x92,0xff91,0x6d12,0x92,0xff91,0x6c92,0x6c92,0x92,
-0xff91,0x92,0xff91,0x6d92,0x92,0xff91,1,0,0x92,0xff91,1,0x1c11,0,0,0,0,
-0x48a,0x4bb,0x4f9,0x52a,0x55b,0x599,0x5ca,0x5fb,0x639,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,
-0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0xd891,0x92,0xff91,0x92,0xff91,0x92,0xff91,
-0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x669,0x6ea,0x71b,0x759,
-0x92,0xff91,0xcf92,0xe412,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,0xbf12,1,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
-0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,1,1,1,1,1,1,0x78a,0x92,
-0xff91,0xae92,0x7aa,0x7c9,0x7c9,0x92,0xff91,0x9e92,0x2292,0x2392,0x92,0xff91,0x92,0xffb1,0x92,0xff91,
-0x92,0xff91,0x92,0xff91,0x7e9,0x809,0x829,0x9711,0x9911,1,0x9991,0x9991,1,0x9b11,1,0x9a91,
-0x849,1,1,1,0x9991,0x869,1,0x9891,1,0x889,0x8a9,1,0x97b1,0x9691,0x8a9,0x8c9,
-0x8e9,1,1,0x9691,1,0x909,0x9591,1,1,0x9511,1,1,1,1,1,1,
-1,0x929,1,1,0x9311,1,0x949,0x9311,1,1,1,0x969,0x9311,0xdd91,0x9391,0x9391,
-0xdc91,1,1,1,1,1,0x9291,1,0,1,1,1,1,1,1,1,
-1,0x989,0x9a9,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,5,5,0x25,5,5,5,5,5,5,4,4,4,
-0x14,4,0x14,4,5,5,4,4,4,4,4,4,4,4,4,4,
+0xc96,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x977,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x6b5,0x355,0x355,0x355,0x97f,0x355,0x355,0x355,
+0x355,0x987,0x98d,0x991,0x355,0x355,0x995,0x999,0x99f,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x9a7,0x9ab,0x355,0x355,0x355,0x355,0x355,0x9b3,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x9bb,0x9bf,0x9c7,0x9cb,0x355,0x9d2,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x9d8,0x355,0x355,0x355,0x355,0x9df,0x355,0x355,0x355,0x355,
+0x355,0x53f,0x9e4,0x9eb,0x5bd,0x5bc,0x9ef,0x53c,0x355,0x9f7,0x9fe,0x355,0xa04,0x5bc,0xa09,0xa11,
+0x355,0x355,0xa16,0x355,0x355,0x355,0x355,0x338,0xa1e,0x5bc,0x5be,0xa26,0xa2d,0x355,0x355,0x355,
+0x355,0x355,0x9e4,0xa35,0x355,0x355,0xa3d,0xa45,0x355,0x355,0x355,0x355,0x355,0x355,0xa49,0xa51,
+0x355,0x355,0xa59,0x4b0,0x355,0x355,0xa61,0x355,0x355,0xa67,0xa6f,0x355,0x355,0x355,0x355,0x355,
+0x355,0xa74,0x355,0x355,0x355,0xa7c,0xa84,0x355,0x355,0xa8c,0xa94,0x355,0x355,0x355,0xa97,0x6b5,
+0xa9f,0xaa3,0xaab,0x355,0xab2,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0xab9,0x355,0x355,0x940,0xac1,0x355,0x355,0x355,0xac7,0xacf,0x355,0xad3,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0xad9,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0xadf,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0xae6,0x355,0xaec,0x57c,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0xa7c,0xa84,0x355,0x355,0x355,0x355,0x355,0x355,0x677,0x355,0xaf2,0x355,0x355,
+0xafa,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0xaff,0x57c,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0xb07,0xb0f,0xb15,0x355,0x355,0x355,0x355,0xb1d,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0xb25,0xb2d,0xb32,0xb38,0xb40,0xb48,0xb50,0xb29,0xb58,0xb60,
+0xb68,0xb6f,0xb2a,0xb25,0xb2d,0xb28,0xb38,0xb2b,0xb26,0xb77,0xb29,0xb7f,0xb87,0xb8f,0xb96,0xb82,
+0xb8a,0xb92,0xb99,0xb85,0xba1,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x87c,0xba9,0x87c,0xbb0,0xbb7,0xbbf,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0xbc7,0xbcf,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0xbd3,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x9d0,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0xbdb,0x355,0xbe3,0xbeb,0xbf2,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0xb21,
+0xbfa,0xbfa,0xc00,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x9f9,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x53f,0x87c,0x87c,0x87c,0x355,0x355,0x355,0x355,0x87c,0x87c,
+0x87c,0x87c,0x87c,0x87c,0x87c,0xc08,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,
+0x355,0x355,0x355,0x355,0x355,0x355,0x335,0x335,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,0,0,0,0,0,0,0,0,0,0,4,
+0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,
+0,0,4,0,0,0,0,0,0,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,
+0x1012,0xa,0x5a,0x7a,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0xba,0x1012,0x1012,0x1012,0x1012,
+0x1012,0x1012,0x1012,0,0,0,4,0,4,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,
+0xf011,0xf9,0xf031,0x149,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0x189,0xf011,0xf011,0xf011,0xf011,
+0xf011,0xf011,0xf011,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,
+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,0,0,0,
+0,0,0,0,0,0,0,0,4,0,1,0,0,4,0,4,
+0,0,0,0,4,0x1c9,0,4,4,0,1,0,0,0,0,0,
+0x1012,0x1012,0x1012,0x1012,0x1012,0x1fa,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x5a,0x5a,0x1012,0x1012,
+0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x239,
+0xf011,0xf011,0xf011,0xf011,0xf011,0x2d9,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,
+0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0x3c91,
+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,
+0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x31a,0xff91,0x92,0xff91,0x92,0xff91,0x31a,0xffb1,
+0x33a,0x389,0x92,0xff91,0x92,0xff91,0x92,0xff91,1,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,
+0xff91,0x92,0xff91,0x92,0xff91,0x3d9,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,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
+0x92,0xff91,0x92,0xff91,0xc392,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x459,0x6191,0x6912,0x92,0xff91,
+0x92,0xff91,0x6712,0x92,0xff91,0x6692,0x6692,0x92,0xff91,1,0x2792,0x6512,0x6592,0x92,0xff91,0x6692,
+0x6792,0x3091,0x6992,0x6892,0x92,0xff91,0x5191,1,0x6992,0x6a92,0x4111,0x6b12,0x92,0xff91,0x92,0xff91,
+0x92,0xff91,0x6d12,0x92,0xff91,0x6d12,1,1,0x92,0xff91,0x6d12,0x92,0xff91,0x6c92,0x6c92,0x92,
+0xff91,0x92,0xff91,0x6d92,0x92,0xff91,1,0,0x92,0xff91,1,0x1c11,0,0,0,0,
+0x48a,0x4bb,0x4f9,0x52a,0x55b,0x599,0x5ca,0x5fb,0x639,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,
+0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0xd891,0x92,0xff91,0x92,0xff91,0x92,0xff91,
+0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x669,0x6ea,0x71b,0x759,
+0x92,0xff91,0xcf92,0xe412,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,0xbf12,1,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
+0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,1,1,1,1,1,1,0x78a,0x92,
+0xff91,0xae92,0x7aa,0x7c9,0x7c9,0x92,0xff91,0x9e92,0x2292,0x2392,0x92,0xff91,0x92,0xffb1,0x92,0xff91,
+0x92,0xff91,0x92,0xff91,0x7e9,0x809,0x829,0x9711,0x9911,1,0x9991,0x9991,1,0x9b11,1,0x9a91,
+0x849,1,1,1,0x9991,0x869,1,0x9891,1,0x889,0x8a9,1,0x97b1,0x9691,0x8a9,0x8c9,
+0x8e9,1,1,0x9691,1,0x909,0x9591,1,1,0x9511,1,1,1,1,1,1,
+1,0x929,1,1,0x9311,1,0x949,0x9311,1,1,1,0x969,0x9311,0xdd91,0x9391,0x9391,
+0xdc91,1,1,1,1,1,0x9291,1,0,1,1,1,1,1,1,1,
+1,0x989,0x9a9,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,5,5,0x25,5,5,5,5,5,5,4,4,4,
+0x14,4,0x14,4,5,5,4,4,4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
-4,4,4,4,5,5,5,5,5,4,4,4,4,4,4,4,
+4,4,4,4,5,5,5,5,5,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
-4,4,4,4,0x54,0x54,0x44,0x44,0x44,0x44,0x44,0x9cc,0x54,0x44,0x54,0x44,
-0x54,0x44,0x44,0x44,0x44,0x44,0x44,0x54,0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x64,
+4,4,4,4,0x54,0x54,0x44,0x44,0x44,0x44,0x44,0x9cc,0x54,0x44,0x54,0x44,
+0x54,0x44,0x44,0x44,0x44,0x44,0x44,0x54,0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x64,
0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,
-0x64,0x64,0x64,0x64,0x64,0x74,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,
-0x64,0x44,0x44,0x44,0x44,0x44,0x54,0x44,0x44,0x9dd,0x44,0x64,0x64,0x64,0x44,0x44,
-0x44,0x64,0x64,4,0x44,0x44,0x44,0x64,0x64,0x64,0x64,0x44,0x64,0x64,0x64,0x44,
-0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
-0x44,0x44,0x44,0x44,0x92,0xff91,0x92,0xff91,4,4,0x92,0xff91,0,0,5,0x4111,
-0x4111,0x4111,0,0x3a12,0,0,0,0,4,4,0x1312,4,0x1292,0x1292,0x1292,0,
-0x2012,0,0x1f92,0x1f92,0xa29,0x1012,0xafa,0x1012,0x1012,0xb3a,0x1012,0x1012,0xb7a,0xbca,0xc1a,0x1012,
-0xc5a,0x1012,0x1012,0x1012,0xc9a,0xcda,0,0xd1a,0x1012,0x1012,0xd5a,0x1012,0x1012,0xd9a,0x1012,0x1012,
-0xed11,0xed91,0xed91,0xed91,0xdd9,0xf011,0xea9,0xf011,0xf011,0xee9,0xf011,0xf011,0xf29,0xf79,0xfc9,0xf011,
-0x1009,0xf011,0xf011,0xf011,0x1049,0x1089,0x10c9,0x10f9,0xf011,0xf011,0x1139,0xf011,0xf011,0x1179,0xf011,0xf011,
-0xe011,0xe091,0xe091,0x412,0x11b9,0x11e9,2,2,2,0x1239,0x1269,0xfc11,0x92,0xff91,0x92,0xff91,
-0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
-0x92,0xff91,0x92,0xff91,0x1299,0x12c9,0x391,0xc631,0x12fa,0x1349,0,0x92,0xff91,0xfc92,0x92,0xff91,
-1,0xbf12,0xbf12,0xbf12,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,
-0x2812,0x2812,0x2812,0x2812,0x1012,0x1012,0x137a,0x1012,0x13ba,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,
-0x1012,0x1012,0x13fa,0x1012,0x1012,0x143a,0x147a,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x14ca,0x1012,
-0x1012,0x1012,0x1012,0x1012,0xf011,0xf011,0x1509,0xf011,0x1549,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,
-0xf011,0xf011,0x1589,0xf011,0xf011,0x15c9,0x1609,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0x1659,0xf011,
-0xf011,0xf011,0xf011,0xf011,0xd811,0xd811,0xd811,0xd811,0xd811,0xd811,0xd831,0xd811,0xd831,0xd811,0xd811,0xd811,
-0xd811,0xd811,0xd811,0xd811,0x92,0xff91,0x169a,0x16d9,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,0,0x44,0x44,0x44,0x44,0x44,4,4,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,0x92,0xff91,
-0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
-0x92,0xff91,0x92,0xff91,0x792,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,
-0xff91,0x92,0xff91,0xf891,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,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
-0x92,0xff91,0x92,0xff91,0,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,
-0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0,
-0,4,0,0,0,0,0,4,1,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,0xe811,0xe811,0xe811,0x1719,1,0,0,0,
-0,0,0,0,0,0x64,0x44,0x44,0x44,0x44,0x64,0x44,0x44,0x44,0x64,0x64,
-0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0x64,0x44,
-0x44,0x64,0x64,0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,
-0x64,0x64,0,0x64,0,0x64,0x64,0,0x44,0x64,0,0x64,0,0,0,0,
+0x64,0x64,0x64,0x64,0x64,0x74,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,
+0x64,0x44,0x44,0x44,0x44,0x44,0x54,0x44,0x44,0x9dd,0x44,0x64,0x64,0x64,0x44,0x44,
+0x44,0x64,0x64,4,0x44,0x44,0x44,0x64,0x64,0x64,0x64,0x44,0x64,0x64,0x64,0x44,
+0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
+0x44,0x44,0x44,0x44,0x92,0xff91,0x92,0xff91,4,4,0x92,0xff91,0,0,5,0x4111,
+0x4111,0x4111,0,0x3a12,0,0,0,0,4,4,0x1312,4,0x1292,0x1292,0x1292,0,
+0x2012,0,0x1f92,0x1f92,0xa29,0x1012,0xafa,0x1012,0x1012,0xb3a,0x1012,0x1012,0xb7a,0xbca,0xc1a,0x1012,
+0xc5a,0x1012,0x1012,0x1012,0xc9a,0xcda,0,0xd1a,0x1012,0x1012,0xd5a,0x1012,0x1012,0xd9a,0x1012,0x1012,
+0xed11,0xed91,0xed91,0xed91,0xdd9,0xf011,0xea9,0xf011,0xf011,0xee9,0xf011,0xf011,0xf29,0xf79,0xfc9,0xf011,
+0x1009,0xf011,0xf011,0xf011,0x1049,0x1089,0x10c9,0x10f9,0xf011,0xf011,0x1139,0xf011,0xf011,0x1179,0xf011,0xf011,
+0xe011,0xe091,0xe091,0x412,0x11b9,0x11e9,2,2,2,0x1239,0x1269,0xfc11,0x92,0xff91,0x92,0xff91,
+0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
+0x92,0xff91,0x92,0xff91,0x1299,0x12c9,0x391,0xc631,0x12fa,0x1349,0,0x92,0xff91,0xfc92,0x92,0xff91,
+1,0xbf12,0xbf12,0xbf12,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,
+0x2812,0x2812,0x2812,0x2812,0x1012,0x1012,0x137a,0x1012,0x13ba,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,
+0x1012,0x1012,0x13fa,0x1012,0x1012,0x143a,0x147a,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x14ca,0x1012,
+0x1012,0x1012,0x1012,0x1012,0xf011,0xf011,0x1509,0xf011,0x1549,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,
+0xf011,0xf011,0x1589,0xf011,0xf011,0x15c9,0x1609,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0x1659,0xf011,
+0xf011,0xf011,0xf011,0xf011,0xd811,0xd811,0xd811,0xd811,0xd811,0xd811,0xd831,0xd811,0xd831,0xd811,0xd811,0xd811,
+0xd811,0xd811,0xd811,0xd811,0x92,0xff91,0x169a,0x16d9,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,0,0x44,0x44,0x44,0x44,0x44,4,4,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,0x92,0xff91,
+0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
+0x92,0xff91,0x92,0xff91,0x792,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,
+0xff91,0x92,0xff91,0xf891,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,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
+0x92,0xff91,0x92,0xff91,0,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,
+0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0,
+0,4,0,0,0,0,0,4,1,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,0xe811,0xe811,0xe811,0x1719,1,0,0,0,
+0,0,0,0,0,0x64,0x44,0x44,0x44,0x44,0x64,0x44,0x44,0x44,0x64,0x64,
+0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0x64,0x44,
+0x44,0x64,0x64,0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,
+0x64,0x64,0,0x64,0,0x64,0x64,0,0x44,0x64,0,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,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,4,4,4,4,4,4,0,0,0,0,0,0,
-0,0,0,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x64,0x64,0,
-4,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,0,0,0,0,
+0,0,0,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x64,0x64,0,
+4,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,0,0,
-0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0x64,
-0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0x64,0x64,0x44,0x44,0x44,0x44,0x44,
-0x64,0x44,0x44,0x64,0,0,0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0x44,0x44,
-0x44,0x44,0x44,0x44,0x44,4,0,0x44,0x44,0x44,0x44,0x64,0x44,4,4,0x44,
-0x44,0,0x64,0x44,0x44,0x64,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,4,0,0x64,0,0,
+0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0x64,
+0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0x64,0x64,0x44,0x44,0x44,0x44,0x44,
+0x64,0x44,0x44,0x64,0,0,0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0x44,0x44,
+0x44,0x44,0x44,0x44,0x44,4,0,0x44,0x44,0x44,0x44,0x64,0x44,4,4,0x44,
+0x44,0,0x64,0x44,0x44,0x64,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,4,0,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,0,0,0,0,0,0,0x44,0x64,0x44,0x44,
-0x64,0x44,0x44,0x64,0x64,0x64,0x44,0x64,0x64,0x44,0x64,0x44,0x44,0x44,0x64,0x44,
-0x64,0x44,0x64,0x44,0x64,0x44,0x44,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0x44,0x64,0x44,0x44,
+0x64,0x44,0x44,0x64,0x64,0x64,0x44,0x64,0x64,0x44,0x64,0x44,0x44,0x44,0x64,0x44,
+0x64,0x44,0x64,0x44,0x64,0x44,0x44,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,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,4,4,
-4,4,4,4,4,4,4,4,4,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,4,4,4,4,4,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,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x44,
-4,4,0,0,0,0,4,0,0,0x64,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x44,
+4,4,0,0,0,0,4,0,0,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,0x44,0x44,0x44,0x44,4,0x44,0x44,0x44,0x44,0x44,4,0x44,0x44,0x44,
4,0x44,0x44,0x44,0x44,0x44,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,0x64,0x64,0x64,0,0,0,0,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,4,0x64,0x44,0x44,0x64,0x44,0x44,0x64,0x44,0x44,
-0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0x44,0x64,0x44,0x44,0x64,0x64,0x44,
-0x44,0x44,0x44,0x44,4,4,4,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,0,0,4,0,0x64,0,0,0,0,4,4,4,
-4,4,4,4,4,0,0,0,0,0x64,0,0,0,0x44,0x64,0x44,
-0x44,4,4,4,0,0,0,0,0,0,0,0,0,0,4,4,
-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,0,0,0,0,0,0,0,0,0,0,0,0x64,0,0,0,
-0,4,4,4,4,0,0,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,0x64,0x64,0x64,0,0,0,0,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,4,0x64,0x44,0x44,0x64,0x44,0x44,0x64,0x44,0x44,
+0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0x44,0x64,0x44,0x44,0x64,0x64,0x44,
+0x44,0x44,0x44,0x44,4,4,4,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,0,0,4,0,0x64,0,0,0,0,4,4,4,
+4,4,4,4,4,0,0,0,0,0x64,0,0,0,0x44,0x64,0x44,
+0x44,4,4,4,0,0,0,0,0,0,0,0,0,0,4,4,
+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,0,0,0,0,0,0,0,0,0,0,0,0x64,0,0,0,
+0,4,4,4,4,0,0,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,0,4,4,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,0,
-0,4,4,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,
-0,4,4,0,0,0,0,4,4,0,0,4,4,0x64,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x44,0,
+0,4,4,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,
+0,4,4,0,0,0,0,4,4,0,0,4,4,0x64,0,0,
0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,4,4,0,0,0,4,0,0,0,0,0,0,
-0,0,0,0,0,4,4,4,4,4,0,4,4,0,0,0,
+0,0,0,0,4,4,0,0,0,4,0,0,0,0,0,0,
+0,0,0,0,0,4,4,4,4,4,0,4,4,0,0,0,
0,0x64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,4,4,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,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,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,
-0x64,0,0,4,0,4,4,4,4,0,0,0,0,0,0,0,
-0,0x64,0,0,0,0,0,0,0,4,4,0,0,0,0,0,
-0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,
+0x64,0,0,4,0,4,4,4,4,0,0,0,0,0,0,0,
+0,0x64,0,0,0,0,0,0,0,4,4,0,0,0,0,0,
+0,0,0,0,0,0,4,4,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,0,4,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,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,0x64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,4,0,0,0,4,0,0,0,0,0,0,0,
+0,0,0,0,4,0,0,0,0,0,0,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,4,0,0,0,4,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,4,0,0,0,0,0,4,4,4,0,4,4,
+4,0x64,0,0,0,0,0,0,0,0x64,0x64,0,0,0,0,0,
+0,0,0,0,0,0,4,0,0,0,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,4,0,0,0,0,0,4,4,4,0,4,4,
-4,0x64,0,0,0,0,0,0,0,0x64,0x64,0,0,0,0,0,
-0,0,0,0,0,0,4,0,0,0,0,0,4,0x64,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
4,4,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,0,
-0,0,0,0x64,0x64,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0x64,0,0,0,0,0,0,0,4,4,4,0,4,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,4,0,0,4,4,4,4,0x64,0x64,0x64,0,0,0,0,0,
-0,0,4,4,0x64,0x64,0x64,0x64,4,4,4,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,
-4,4,4,4,0x64,0x64,0x64,4,4,0,0,0,0,0,0,0,
-0,0,4,0,0x64,0x64,0x64,0x64,4,4,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,0x64,0x64,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0x64,0,0x64,
-0,0x64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0x64,0x64,4,0x64,4,4,4,4,4,0x64,0x64,
-0x64,0x64,4,0,0x64,4,0x44,0x44,0x64,0,0x44,0x44,0,0,0,0,
-0,4,4,4,4,4,4,4,4,4,4,4,0,4,4,4,
+0,0,0,0x64,0x64,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0x64,0,0,0,0,0,0,0,4,4,4,0,4,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,4,0,0,4,4,4,4,0x64,0x64,0x64,0,0,0,0,0,
+0,0,4,4,0x64,0x64,0x64,0x64,4,4,4,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,
+4,4,4,4,0x64,0x64,0x64,4,4,0,0,0,0,0,0,0,
+0,0,4,0,0x64,0x64,0x64,0x64,4,4,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,0x64,0x64,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0x64,0,0x64,
+0,0x64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0x64,0x64,4,0x64,4,4,4,4,4,0x64,0x64,
+0x64,0x64,4,0,0x64,4,0x44,0x44,0x64,0,0x44,0x44,0,0,0,0,
+0,4,4,4,4,4,4,4,4,4,4,4,0,4,4,4,
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
-4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,
-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,0,0,0,0,0,0,
-0,4,4,4,4,0,4,4,4,4,4,0x64,0,0x64,0x64,0,
-0,4,4,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,4,4,0,0,
-0,0,4,4,4,0,0,0,0,0,0,0,0,0,0,0,
-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,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,
-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,
-4,4,4,4,4,4,0,0,0,0,0,0,0,0,4,0,
-0,4,4,4,4,4,4,4,4,4,0x64,4,0,0,0,4,
-0,0,0,0,0,0x44,0,0,0,0,0,0,0,0,0,0,
-0,0,0,4,4,4,4,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,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,4,4,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,4,4,4,4,4,4,4,0,0,0,
+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,0,0,0,0,0,0,
+0,4,4,4,4,0,4,4,4,4,4,0x64,0,0x64,0x64,0,
+0,4,4,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,4,4,0,0,
+0,0,4,4,4,0,0,0,0,0,0,0,0,0,0,0,
+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,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,
+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,
+4,4,4,4,4,4,0,0,0,0,0,0,0,0,4,0,
+0,4,4,4,4,4,4,4,4,4,0x64,4,0,0,0,4,
+0,0,0,0,0,0x44,0,0,0,0,0,0,0,0,0,0,
+0,0,0,4,4,4,4,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,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,4,4,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,0x64,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,0,
0,0,0,4,4,0,0,0,0,0,0,0,0,0,4,0,
@@ -445,7 +445,7 @@ static const uint16_t ucase_props_trieIndex[12356]={
4,0,0,0,0,0,0,4,4,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
0x44,0,0,0x64,0,0,0,0,0,0,0,4,0,0,0,0,
0,0,0,0,0x44,0x44,0x44,0x44,0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x44,
-0x44,0x64,4,0x64,0x64,0,0,0,0,0,0,0,0,0,0,0,
+0x44,0x64,4,0x64,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,0,0,0,
0,0,0,0,0x64,0,4,4,4,4,4,0,4,0,0,0,
0,0,4,0,0x60,0,0,0,0,0,0,0,0,0,0,0,
@@ -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,
+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,
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,38 +470,38 @@ 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,0x23c9,1,1,1,0x23e9,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,0x2409,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,
+0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x64,0x64,0x64,0,0x44,0x64,0x64,0x44,0x64,
0x44,0x44,0x64,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x44,0x44,0x64,0x64,0x64,
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,
-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,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,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,
+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,
+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,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,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,
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,74 +515,74 @@ 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,0x4e9a,0,
+2,0,0x4eda,0x4f1a,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,
-0x812,0x812,0x812,0x812,0x812,0x812,0x812,0x812,0xf811,0xf811,0xf811,0xf811,0xf811,0xf811,0xf811,0xf811,
-0xf811,0xf811,0xf811,0xf811,0xf811,0xf811,0xf811,0xf811,0,0,0,0x92,0xff91,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,0xd12,0xd12,0xd12,0xd12,0xd12,0xd12,
-0xd12,0xd12,0xd12,0xd12,0xd12,0xd12,0xd12,0xd12,0xd12,0xd12,0xd12,0xd12,0xf311,0xf311,0xf311,0xf311,
-0xf311,0xf311,0xf311,0xf311,0xf311,0xf311,0xf311,0xf311,0xf311,0xf311,0xf311,0xf311,0xf311,0xf311,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,
-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,
-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,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,
+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,
+0x812,0x812,0x812,0x812,0x812,0x812,0x812,0x812,0xf811,0xf811,0xf811,0xf811,0xf811,0xf811,0xf811,0xf811,
+0xf811,0xf811,0xf811,0xf811,0xf811,0xf811,0xf811,0xf811,0,0,0,0x92,0xff91,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,0xd12,0xd12,0xd12,0xd12,0xd12,0xd12,
+0xd12,0xd12,0xd12,0xd12,0xd12,0xd12,0xd12,0xd12,0xd12,0xd12,0xd12,0xd12,0xf311,0xf311,0xf311,0xf311,
+0xf311,0xf311,0xf311,0xf311,0xf311,0xf311,0xf311,0xf311,0xf311,0xf311,0xf311,0xf311,0xf311,0xf311,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,
+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,
+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,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,
-0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0,0,0,0,0,0,0,0,
-0,0,0x64,0x64,0x64,0x64,0x60,0x60,0,4,4,4,4,4,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,0,0,0,0,0,0,0x64,0x64,4,
-4,4,4,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,
-4,4,4,0,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,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,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,
-0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,5,5,0x44,0x44,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x44,0x44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0,0,0,0,0,0,0,0,
+0,0,0x64,0x64,0x64,0x64,0x60,0x60,0,4,4,4,4,4,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,0,0,0,0,0,0,0x64,0x64,4,
+4,4,4,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,
+4,4,4,0,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,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,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,
+0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,5,5,0x44,0x44,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x44,0x44,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,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
-4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
-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,
-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,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0x92,0xff91,0,
+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,
+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,
+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,
-0,0,0,0,0,0,0,0,0,4,4,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,0x64,4,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,4,4,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,0x64,4,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,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
-0x44,0x44,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
+0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
+0x44,0x44,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
0,0,0,0,0,0,4,4,4,4,4,0x64,0x64,0x64,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,4,4,4,4,4,0,0x60,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0x64,0,0,4,4,4,4,0,0,4,4,0,0,
+0,0,0,0x64,0,0,4,4,4,4,0,0,4,4,0,0,
0x60,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,4,4,4,4,4,4,0,0,4,4,0,0,4,4,0,
@@ -597,306 +597,306 @@ 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,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,
+1,1,1,0x52b9,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,
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,
+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,
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,
0,0,0,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x64,0x64,0x64,0x64,
0x64,0x64,0x44,0x44,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,4,0,0,4,0,0,0,0,0,0,
-0,0,0,0,0,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,
-0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0,
-0,0,4,0,4,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,
-0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0,
+0,0,0,0,0,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,
+0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0,
+0,0,4,0,4,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,
+0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,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,
0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,4,4,4,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,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,0x44,0x44,0x44,0x44,0x44,0,0,0,0,0,0x1412,0x1412,0x1412,0x1412,
-0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,
-0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0xec11,0xec11,0xec11,0xec11,
-0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,
-0xec11,0xec11,0xec11,0xec11,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,
-0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0,0,0,0,0xec11,0xec11,0xec11,0xec11,
-0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,
-0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0,0,0,0,0,4,4,4,
+0,0,0,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,0,0,0,
+0,0,0x44,0x44,0x44,0x44,0x44,0,0,0,0,0,0x1412,0x1412,0x1412,0x1412,
+0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,
+0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0xec11,0xec11,0xec11,0xec11,
+0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,
+0xec11,0xec11,0xec11,0xec11,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,
+0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0,0,0,0,0xec11,0xec11,0xec11,0xec11,
+0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,
+0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0,0,0,0,0,4,4,4,
0,4,4,0,0,0,0,0,4,0x64,4,0x44,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,0x64,0x64,0,0,0,0,0x64,0,0,0,0,
0,0x44,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,0,0x2012,0x2012,0x2012,0x2012,
-0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,
-0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0xe011,0xe011,0xe011,0xe011,
-0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,
-0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0x44,0x44,0x44,0x44,
-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,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0x64,0x64,0x44,0x44,0x44,0x64,0x44,0x64,0x64,0x64,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,0,0,0,0,0,0,0,0x2012,0x2012,0x2012,0x2012,
+0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,
+0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0x2012,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0xe011,0xe011,0xe011,0xe011,
+0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,
+0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0xe011,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0x44,0x44,0x44,0x44,
+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,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0x64,0x64,0x44,0x44,0x44,0x64,0x44,0x64,0x64,0x64,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,0,0,0,4,4,4,4,4,4,4,4,
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,0,0,0,0,0,4,
-4,4,4,0,0,0x64,0x64,0,0,4,0,0,0x44,0x44,0x44,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
+4,4,4,0,0,0x64,0x64,0,0,4,0,0,0x44,0x44,0x44,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,0,0,0,4,
+4,4,4,4,0,4,4,4,4,4,4,0x64,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,0,0,0,0,0,0,0,0,0,0,4,
-4,4,4,4,0,4,4,4,4,4,4,0x64,0x64,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,0,0,4,4,4,4,4,4,
-4,4,4,0,0x60,0,0,0,0,0,0,0,0,4,0x64,4,
-4,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,4,4,4,0,0,4,0x60,0x64,4,
-0,0,0,0,0,0,4,0,0,0,0,4,4,4,4,4,
-4,0x64,0x64,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,0x60,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0x44,0x44,0x44,0x44,0x44,0x44,
-0x44,0,0,0,0x44,0x44,0x44,0x44,0x44,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0x64,4,4,0,0x64,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0x44,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,4,0,
-0,0,0,4,4,0,0x64,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,
-0,0,0,0,0,0,4,4,4,4,0,0,0,0,0,0,
-4,4,0,0x64,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,0,0,0,
-4,4,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,4,4,0,
-0,4,0,0x64,0,0,0,0,0,0,0,0,0,0,0,4,
-0,4,0,0,4,4,4,4,4,4,0x60,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,0,0,0,0,0,4,4,4,0,0,4,4,
-4,4,0,4,4,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,4,4,4,4,4,4,4,0,0x64,0x64,0,0,0,0,0,
-0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,
-0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,
-0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,
-0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,
-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,4,4,0x60,0x64,0,
-0,0,0,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,0,0,0,0,
-4,4,4,4,0,0,4,4,0,0,0,0,0,4,4,4,
-4,4,4,4,4,4,4,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,
-0x64,4,4,4,4,0,0,4,4,4,4,0,0,0,0,0,
-0,0,0,0x64,0,0,0,0,0,0,0,0,0,4,4,4,
-4,4,4,0,0,4,4,4,0,0,0,0,0,0,0,0,
-0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,0,
-4,0x64,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,0,4,4,4,4,
-4,4,0,0x64,4,4,4,4,4,4,4,4,0,0,4,4,
-4,4,4,4,4,0,4,4,0,4,4,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,
+4,4,4,0,0x60,0,0,0,0,0,0,0,0,4,0x64,4,
+4,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,4,4,4,0,0,4,0x60,0x64,4,
+0,0,0,0,0,0,4,0,0,0,0,4,4,4,4,4,
+4,0x64,0x64,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,0x60,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0x44,0x44,0x44,0x44,0x44,0x44,
+0x44,0,0,0,0x44,0x44,0x44,0x44,0x44,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0x64,4,4,0,0x64,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0x44,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,4,0,
+0,0,0,4,4,0,0x64,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,
+0,0,0,0,0,0,4,4,4,4,0,0,0,0,0,0,
+4,4,0,0x64,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,0,0,0,
+4,4,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,4,4,0,
+0,4,0,0x64,0,0,0,0,0,0,0,0,0,0,0,4,
+0,4,0,0,4,4,4,4,4,4,0x60,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,0,0,0,0,0,4,4,4,0,0,4,4,
+4,4,0,4,4,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,4,4,4,4,4,4,4,0,0x64,0x64,0,0,0,0,0,
+0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,
+0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,
+0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,
+0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,
+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,4,4,0x60,0x64,0,
+0,0,0,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,0,0,0,0,
+4,4,4,4,0,0,4,4,0,0,0,0,0,4,4,4,
+4,4,4,4,4,4,4,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,
+0x64,4,4,4,4,0,0,4,4,4,4,0,0,0,0,0,
+0,0,0,0x64,0,0,0,0,0,0,0,0,0,4,4,4,
+4,4,4,0,0,4,4,4,0,0,0,0,0,0,0,0,
+0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,0,
+4,0x64,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,0,4,4,4,4,
+4,4,0,0x64,4,4,4,4,4,4,4,4,0,0,4,4,
+4,4,4,4,4,0,4,4,0,4,4,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,0,4,0,4,4,0,4,4,4,0x64,4,
-0x64,0x64,0,4,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,0,0,
-0,4,0,0x64,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,4,4,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,0,0,0,0,0,0,0,0,0,0,0,
+4,4,4,0,0,0,4,0,4,4,0,4,4,4,0x64,4,
+0x64,0x64,0,4,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,0,0,
+0,4,0,0x64,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,4,4,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,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0x64,0x64,0x64,0x64,0x64,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0x44,0x44,0x44,0x44,0x44,0x44,0x44,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,4,0,4,4,0,0,0,
-0,0,0,0,0,0,0,0,0x60,0x60,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,0,0,4,0x64,0,0,0,0,0,
-0,0x60,0x60,0x64,0x64,0x64,0,0,0,0x60,0x60,0x60,0x60,0x60,0x60,4,
-4,4,4,4,4,4,4,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0,
-0,0x44,0x44,0x44,0x44,0x44,0x64,0x64,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,0x44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0x44,0x44,0x44,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,2,2,2,2,2,2,2,2,2,2,2,2,
+4,4,4,4,4,4,4,4,4,4,0,4,4,0,0,0,
+0,0,0,0,0,0,0,0,0x60,0x60,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,0,0,4,0x64,0,0,0,0,0,
+0,0x60,0x60,0x64,0x64,0x64,0,0,0,0x60,0x60,0x60,0x60,0x60,0x60,4,
+4,4,4,4,4,4,4,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0,
+0,0x44,0x44,0x44,0x44,0x44,0x64,0x64,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,0x44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0x44,0x44,0x44,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,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,
1,1,1,1,1,1,0x21,0x21,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,1,1,1,1,1,1,1,0,0x21,0x21,
-1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,1,1,1,1,1,1,1,1,0x21,0x21,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,2,0,2,2,
-0,0,2,0,0,2,2,0,0,2,2,2,2,0,2,2,
-2,2,2,2,2,2,1,1,1,1,0,1,0,1,0x21,0x21,
-1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,
-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-1,1,1,1,2,2,0,2,2,2,2,0,0,2,2,2,
-2,2,2,2,2,0,2,2,2,2,2,2,2,0,1,1,
+1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,
+2,2,2,2,2,2,1,1,1,1,1,1,1,0,0x21,0x21,
+1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,
+2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+2,2,1,1,1,1,1,1,1,1,0x21,0x21,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,2,0,2,2,
+0,0,2,0,0,2,2,0,0,2,2,2,2,0,2,2,
+2,2,2,2,2,2,1,1,1,1,0,1,0,1,0x21,0x21,
+1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,
+2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+1,1,1,1,2,2,0,2,2,2,2,0,0,2,2,2,
+2,2,2,2,2,0,2,2,2,2,2,2,2,0,1,1,
1,1,1,1,1,1,0x21,0x21,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,2,2,0,2,2,2,2,0,
-2,2,2,2,2,0,2,0,0,0,2,2,2,2,2,2,
-2,0,1,1,1,1,1,1,1,1,0x21,0x21,1,1,1,1,
+1,1,1,1,1,1,1,1,2,2,0,2,2,2,2,0,
+2,2,2,2,2,0,2,0,0,0,2,2,2,2,2,2,
+2,0,1,1,1,1,1,1,1,1,0x21,0x21,1,1,1,1,
1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,
-2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,
-1,1,0,0,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,2,2,2,2,2,0,1,1,
+2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,
+2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,
+1,1,0,0,2,2,2,2,2,2,2,2,2,2,2,2,
+2,2,2,2,2,2,2,2,2,2,2,2,2,0,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,0,1,1,1,1,1,1,2,2,
+1,1,1,1,1,1,1,0,1,1,1,1,1,1,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,0,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,
-1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,1,1,1,0,1,1,1,1,1,1,2,1,
-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,4,4,4,4,4,4,
-4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,4,
-4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,
-0,0,0,0,0,4,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,0,0,0,4,4,4,4,4,0,4,4,4,
-4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0x44,0x44,0x44,0x44,
-0x44,0x44,0x44,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
-0x44,0x44,0x44,0x44,0x44,0,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0,0x44,
-0x44,0,0x44,0x44,0x44,0x44,0x44,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0x44,0x44,0x44,0x44,
-0x44,0x44,0x44,4,4,4,4,4,4,4,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0x64,0x64,0x64,0x64,
-0x64,0x64,0x64,0,0,0,0,0,0,0,0,0,0x1112,0x1112,0x1112,0x1112,
-0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,
-0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0xef11,0xef11,
-0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,
-0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0x44,0x44,0x44,0x44,
-0x44,0x44,0x64,4,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,
-2,2,0,0,0,0,0,0,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+2,2,2,2,2,2,2,0,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,
+1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,
+2,2,2,2,1,1,1,0,1,1,1,1,1,1,2,1,
+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,4,4,4,4,4,4,
+4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,4,
+4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,
+0,0,0,0,0,4,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,0,0,0,4,4,4,4,4,0,4,4,4,
+4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0x44,0x44,0x44,0x44,
+0x44,0x44,0x44,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
+0x44,0x44,0x44,0x44,0x44,0,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0,0x44,
+0x44,0,0x44,0x44,0x44,0x44,0x44,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0x44,0x44,0x44,0x44,
+0x44,0x44,0x44,4,4,4,4,4,4,4,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0x64,0x64,0x64,0x64,
+0x64,0x64,0x64,0,0,0,0,0,0,0,0,0,0x1112,0x1112,0x1112,0x1112,
+0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,
+0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0xef11,0xef11,
+0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,
+0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0x44,0x44,0x44,0x44,
+0x44,0x44,0x64,4,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,
+2,2,0,0,0,0,0,0,2,2,2,2,2,2,2,2,
+2,2,2,2,2,2,2,2,2,2,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,4,4,4,4,4,4,4,4,4,4,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0
+0,0,0,0
};
-static const uint16_t ucase_props_exceptions[1671]={
-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,
-0x212b,0x4810,1,0xce50,0xc7,2,0x49,0x131,0x844,0x49,2,0x69,0x130,0x880,0x2220,0x2bc,
-0x6e,0x2bc,0x4e,0x2bc,0x4e,0x806,0x73,0x53,0x809,0x1c6,0x1c5,0x80d,0x1c6,0x1c4,0x1c5,0x80c,
-0x1c4,0x1c5,0x809,0x1c9,0x1c8,0x80d,0x1c9,0x1c7,0x1c8,0x80c,0x1c7,0x1c8,0x809,0x1cc,0x1cb,0x80d,
-0x1cc,0x1ca,0x1cb,0x80c,0x1ca,0x1cb,0x880,0x2220,0x6a,0x30c,0x4a,0x30c,0x4a,0x30c,0x809,0x1f3,
-0x1f2,0x80d,0x1f3,0x1f1,0x1f2,0x80c,0x1f1,0x1f2,0x810,0x2a2b,0x810,0x2a28,0x810,0x2a3f,0x810,0x2a1f,
-0x810,0x2a1c,0x810,0x2a1e,0x810,0xa54f,0x810,0xa54b,0x810,0xa528,0x810,0xa544,0x810,0x29f7,0x810,0xa541,
-0x810,0x29fd,0x810,0x29e7,0x810,0xa543,0x810,0xa52a,0x1810,0xa515,0x810,0xa512,0x6800,0x3846,0x3b9,0x399,
-1,0x1fbe,0x8c0,1,0x3330,0x3b9,0x308,0x301,0x399,0x308,0x301,0x399,0x308,0x301,0x1fd3,0x841,
-0x3b2,1,0x3d0,0x841,0x3b5,1,0x3f5,0x841,0x3b8,2,0x3d1,0x3f4,0x841,0x3b9,2,0x345,
-0x1fbe,0x841,0x3ba,1,0x3f0,0x841,0x3bc,1,0xb5,0x841,0x3c0,1,0x3d6,0x841,0x3c1,1,
-0x3f1,0x4850,0x20,1,0x3c2,0x841,0x3c6,1,0x3d5,0x841,0x3c9,1,0x2126,0x8c0,1,0x3330,
-0x3c5,0x308,0x301,0x3a5,0x308,0x301,0x3a5,0x308,0x301,0x1fe3,0x844,0x392,1,0x3d0,0x844,0x395,
-1,0x3f5,0x844,0x398,2,0x3d1,0x3f4,0x844,0x399,2,0x345,0x1fbe,0x844,0x39a,1,0x3f0,
-0x844,0x39c,1,0xb5,0x844,0x3a0,1,0x3d6,0x844,0x3a1,1,0x3f1,0x806,0x3c3,0x3a3,0x844,
-0x3a3,1,0x3c2,0x844,0x3a6,1,0x3d5,0x844,0x3a9,1,0x2126,0x806,0x3b2,0x392,0x846,0x3b8,
-0x398,1,0x3f4,0x806,0x3c6,0x3a6,0x806,0x3c0,0x3a0,0x806,0x3ba,0x39a,0x806,0x3c1,0x3a1,0x841,
-0x3b8,2,0x398,0x3d1,0x806,0x3b5,0x395,0x841,0x432,1,0x1c80,0x841,0x434,1,0x1c81,0x841,
-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
+static const uint16_t ucase_props_exceptions[1671]={
+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,
+0x212b,0x4810,1,0xce50,0xc7,2,0x49,0x131,0x844,0x49,2,0x69,0x130,0x880,0x2220,0x2bc,
+0x6e,0x2bc,0x4e,0x2bc,0x4e,0x806,0x73,0x53,0x809,0x1c6,0x1c5,0x80d,0x1c6,0x1c4,0x1c5,0x80c,
+0x1c4,0x1c5,0x809,0x1c9,0x1c8,0x80d,0x1c9,0x1c7,0x1c8,0x80c,0x1c7,0x1c8,0x809,0x1cc,0x1cb,0x80d,
+0x1cc,0x1ca,0x1cb,0x80c,0x1ca,0x1cb,0x880,0x2220,0x6a,0x30c,0x4a,0x30c,0x4a,0x30c,0x809,0x1f3,
+0x1f2,0x80d,0x1f3,0x1f1,0x1f2,0x80c,0x1f1,0x1f2,0x810,0x2a2b,0x810,0x2a28,0x810,0x2a3f,0x810,0x2a1f,
+0x810,0x2a1c,0x810,0x2a1e,0x810,0xa54f,0x810,0xa54b,0x810,0xa528,0x810,0xa544,0x810,0x29f7,0x810,0xa541,
+0x810,0x29fd,0x810,0x29e7,0x810,0xa543,0x810,0xa52a,0x1810,0xa515,0x810,0xa512,0x6800,0x3846,0x3b9,0x399,
+1,0x1fbe,0x8c0,1,0x3330,0x3b9,0x308,0x301,0x399,0x308,0x301,0x399,0x308,0x301,0x1fd3,0x841,
+0x3b2,1,0x3d0,0x841,0x3b5,1,0x3f5,0x841,0x3b8,2,0x3d1,0x3f4,0x841,0x3b9,2,0x345,
+0x1fbe,0x841,0x3ba,1,0x3f0,0x841,0x3bc,1,0xb5,0x841,0x3c0,1,0x3d6,0x841,0x3c1,1,
+0x3f1,0x4850,0x20,1,0x3c2,0x841,0x3c6,1,0x3d5,0x841,0x3c9,1,0x2126,0x8c0,1,0x3330,
+0x3c5,0x308,0x301,0x3a5,0x308,0x301,0x3a5,0x308,0x301,0x1fe3,0x844,0x392,1,0x3d0,0x844,0x395,
+1,0x3f5,0x844,0x398,2,0x3d1,0x3f4,0x844,0x399,2,0x345,0x1fbe,0x844,0x39a,1,0x3f0,
+0x844,0x39c,1,0xb5,0x844,0x3a0,1,0x3d6,0x844,0x3a1,1,0x3f1,0x806,0x3c3,0x3a3,0x844,
+0x3a3,1,0x3c2,0x844,0x3a6,1,0x3d5,0x844,0x3a9,1,0x2126,0x806,0x3b2,0x392,0x846,0x3b8,
+0x398,1,0x3f4,0x806,0x3c6,0x3a6,0x806,0x3c0,0x3a0,0x806,0x3ba,0x39a,0x806,0x3c1,0x3a1,0x841,
+0x3b8,2,0x398,0x3d1,0x806,0x3b5,0x395,0x841,0x432,1,0x1c80,0x841,0x434,1,0x1c81,0x841,
+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
};
static const uint16_t ucase_props_unfold[370]={
@@ -933,19 +933,19 @@ static const UCaseProps ucase_props_singleton={
ucase_props_unfold,
{
ucase_props_trieIndex,
- ucase_props_trieIndex+3288,
+ ucase_props_trieIndex+3288,
NULL,
- 3288,
- 9068,
+ 3288,
+ 9068,
0x188,
- 0xd54,
+ 0xd54,
0x0,
0x0,
0xe0800,
- 0x3040,
+ 0x3040,
NULL, 0, FALSE, FALSE, 0, NULL
},
- { 4,0,0,0 }
+ { 4,0,0,0 }
};
#endif // INCLUDED_FROM_UCASE_CPP
diff --git a/contrib/libs/icu/common/ucasemap.cpp b/contrib/libs/icu/common/ucasemap.cpp
index d78702cd6f..ed72bda828 100644
--- a/contrib/libs/icu/common/ucasemap.cpp
+++ b/contrib/libs/icu/common/ucasemap.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: ucasemap.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -20,11 +20,11 @@
#include "unicode/utypes.h"
#include "unicode/brkiter.h"
-#include "unicode/bytestream.h"
-#include "unicode/casemap.h"
-#include "unicode/edits.h"
-#include "unicode/stringoptions.h"
-#include "unicode/stringpiece.h"
+#include "unicode/bytestream.h"
+#include "unicode/casemap.h"
+#include "unicode/edits.h"
+#include "unicode/stringoptions.h"
+#include "unicode/stringpiece.h"
#include "unicode/ubrk.h"
#include "unicode/uloc.h"
#include "unicode/ustring.h"
@@ -35,43 +35,43 @@
#include "unicode/utf.h"
#include "unicode/utf8.h"
#include "unicode/utf16.h"
-#include "bytesinkutil.h"
+#include "bytesinkutil.h"
#include "cmemory.h"
#include "cstring.h"
-#include "uassert.h"
+#include "uassert.h"
#include "ucase.h"
-#include "ucasemap_imp.h"
+#include "ucasemap_imp.h"
#include "ustr_imp.h"
U_NAMESPACE_USE
/* UCaseMap service object -------------------------------------------------- */
-UCaseMap::UCaseMap(const char *localeID, uint32_t opts, UErrorCode *pErrorCode) :
-#if !UCONFIG_NO_BREAK_ITERATION
- iter(NULL),
-#endif
- caseLocale(UCASE_LOC_UNKNOWN), options(opts) {
- ucasemap_setLocale(this, localeID, pErrorCode);
-}
-
-UCaseMap::~UCaseMap() {
-#if !UCONFIG_NO_BREAK_ITERATION
- delete iter;
-#endif
-}
-
+UCaseMap::UCaseMap(const char *localeID, uint32_t opts, UErrorCode *pErrorCode) :
+#if !UCONFIG_NO_BREAK_ITERATION
+ iter(NULL),
+#endif
+ caseLocale(UCASE_LOC_UNKNOWN), options(opts) {
+ ucasemap_setLocale(this, localeID, pErrorCode);
+}
+
+UCaseMap::~UCaseMap() {
+#if !UCONFIG_NO_BREAK_ITERATION
+ delete iter;
+#endif
+}
+
U_CAPI UCaseMap * U_EXPORT2
ucasemap_open(const char *locale, uint32_t options, UErrorCode *pErrorCode) {
if(U_FAILURE(*pErrorCode)) {
return NULL;
}
- UCaseMap *csm = new UCaseMap(locale, options, pErrorCode);
+ UCaseMap *csm = new UCaseMap(locale, options, pErrorCode);
if(csm==NULL) {
- *pErrorCode = U_MEMORY_ALLOCATION_ERROR;
+ *pErrorCode = U_MEMORY_ALLOCATION_ERROR;
return NULL;
- } else if (U_FAILURE(*pErrorCode)) {
- delete csm;
+ } else if (U_FAILURE(*pErrorCode)) {
+ delete csm;
return NULL;
}
return csm;
@@ -79,7 +79,7 @@ ucasemap_open(const char *locale, uint32_t options, UErrorCode *pErrorCode) {
U_CAPI void U_EXPORT2
ucasemap_close(UCaseMap *csm) {
- delete csm;
+ delete csm;
}
U_CAPI const char * U_EXPORT2
@@ -97,13 +97,13 @@ ucasemap_setLocale(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode) {
if(U_FAILURE(*pErrorCode)) {
return;
}
- if (locale != NULL && *locale == 0) {
- csm->locale[0] = 0;
- csm->caseLocale = UCASE_LOC_ROOT;
- return;
- }
+ if (locale != NULL && *locale == 0) {
+ csm->locale[0] = 0;
+ csm->caseLocale = UCASE_LOC_ROOT;
+ return;
+ }
- int32_t length=uloc_getName(locale, csm->locale, (int32_t)sizeof(csm->locale), pErrorCode);
+ int32_t length=uloc_getName(locale, csm->locale, (int32_t)sizeof(csm->locale), pErrorCode);
if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR || length==sizeof(csm->locale)) {
*pErrorCode=U_ZERO_ERROR;
/* we only really need the language code for case mappings */
@@ -113,59 +113,59 @@ ucasemap_setLocale(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode) {
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
}
if(U_SUCCESS(*pErrorCode)) {
- csm->caseLocale=UCASE_LOC_UNKNOWN;
- csm->caseLocale = ucase_getCaseLocale(csm->locale);
+ csm->caseLocale=UCASE_LOC_UNKNOWN;
+ csm->caseLocale = ucase_getCaseLocale(csm->locale);
} else {
csm->locale[0]=0;
- csm->caseLocale = UCASE_LOC_ROOT;
+ csm->caseLocale = UCASE_LOC_ROOT;
}
}
U_CAPI void U_EXPORT2
-ucasemap_setOptions(UCaseMap *csm, uint32_t options, UErrorCode *pErrorCode) {
- if(U_FAILURE(*pErrorCode)) {
- return;
- }
+ucasemap_setOptions(UCaseMap *csm, uint32_t options, UErrorCode *pErrorCode) {
+ if(U_FAILURE(*pErrorCode)) {
+ return;
+ }
csm->options=options;
}
/* UTF-8 string case mappings ----------------------------------------------- */
-/* TODO(markus): Move to a new, separate utf8case.cpp file. */
+/* TODO(markus): Move to a new, separate utf8case.cpp file. */
+
+namespace {
-namespace {
-
/* append a full case mapping result, see UCASE_MAX_STRING_LENGTH */
-inline UBool
-appendResult(int32_t cpLength, int32_t result, const UChar *s,
- ByteSink &sink, uint32_t options, icu::Edits *edits, UErrorCode &errorCode) {
- U_ASSERT(U_SUCCESS(errorCode));
+inline UBool
+appendResult(int32_t cpLength, int32_t result, const UChar *s,
+ ByteSink &sink, uint32_t options, icu::Edits *edits, UErrorCode &errorCode) {
+ U_ASSERT(U_SUCCESS(errorCode));
/* decode the result */
if(result<0) {
/* (not) original code point */
- if(edits!=NULL) {
- edits->addUnchanged(cpLength);
+ if(edits!=NULL) {
+ edits->addUnchanged(cpLength);
+ }
+ if((options & U_OMIT_UNCHANGED_TEXT) == 0) {
+ ByteSinkUtil::appendCodePoint(cpLength, ~result, sink);
}
- if((options & U_OMIT_UNCHANGED_TEXT) == 0) {
- ByteSinkUtil::appendCodePoint(cpLength, ~result, sink);
- }
} else {
- if(result<=UCASE_MAX_STRING_LENGTH) {
- // string: "result" is the UTF-16 length
- return ByteSinkUtil::appendChange(cpLength, s, result, sink, edits, errorCode);
+ if(result<=UCASE_MAX_STRING_LENGTH) {
+ // string: "result" is the UTF-16 length
+ return ByteSinkUtil::appendChange(cpLength, s, result, sink, edits, errorCode);
} else {
- ByteSinkUtil::appendCodePoint(cpLength, result, sink, edits);
+ ByteSinkUtil::appendCodePoint(cpLength, result, sink, edits);
}
}
- return TRUE;
+ return TRUE;
}
-// See unicode/utf8.h U8_APPEND_UNSAFE().
-inline uint8_t getTwoByteLead(UChar32 c) { return (uint8_t)((c >> 6) | 0xc0); }
-inline uint8_t getTwoByteTrail(UChar32 c) { return (uint8_t)((c & 0x3f) | 0x80); }
+// See unicode/utf8.h U8_APPEND_UNSAFE().
+inline uint8_t getTwoByteLead(UChar32 c) { return (uint8_t)((c >> 6) | 0xc0); }
+inline uint8_t getTwoByteTrail(UChar32 c) { return (uint8_t)((c & 0x3f) | 0x80); }
-UChar32 U_CALLCONV
+UChar32 U_CALLCONV
utf8_caseContextIterator(void *context, int8_t dir) {
UCaseContext *csc=(UCaseContext *)context;
UChar32 c;
@@ -197,290 +197,290 @@ utf8_caseContextIterator(void *context, int8_t dir) {
return U_SENTINEL;
}
-/**
- * caseLocale >= 0: Lowercases [srcStart..srcLimit[ but takes context [0..srcLength[ into account.
- * caseLocale < 0: Case-folds [srcStart..srcLimit[.
+/**
+ * caseLocale >= 0: Lowercases [srcStart..srcLimit[ but takes context [0..srcLength[ into account.
+ * caseLocale < 0: Case-folds [srcStart..srcLimit[.
*/
-void toLower(int32_t caseLocale, uint32_t options,
- const uint8_t *src, UCaseContext *csc, int32_t srcStart, int32_t srcLimit,
- icu::ByteSink &sink, icu::Edits *edits, UErrorCode &errorCode) {
- const int8_t *latinToLower;
- if (caseLocale == UCASE_LOC_ROOT ||
- (caseLocale >= 0 ?
- !(caseLocale == UCASE_LOC_TURKISH || caseLocale == UCASE_LOC_LITHUANIAN) :
- (options & _FOLD_CASE_OPTIONS_MASK) == U_FOLD_CASE_DEFAULT)) {
- latinToLower = LatinCase::TO_LOWER_NORMAL;
- } else {
- latinToLower = LatinCase::TO_LOWER_TR_LT;
- }
- const UTrie2 *trie = ucase_getTrie();
- int32_t prev = srcStart;
- int32_t srcIndex = srcStart;
- for (;;) {
- // fast path for simple cases
- int32_t cpStart;
- UChar32 c;
- for (;;) {
- if (U_FAILURE(errorCode) || srcIndex >= srcLimit) {
- c = U_SENTINEL;
- break;
+void toLower(int32_t caseLocale, uint32_t options,
+ const uint8_t *src, UCaseContext *csc, int32_t srcStart, int32_t srcLimit,
+ icu::ByteSink &sink, icu::Edits *edits, UErrorCode &errorCode) {
+ const int8_t *latinToLower;
+ if (caseLocale == UCASE_LOC_ROOT ||
+ (caseLocale >= 0 ?
+ !(caseLocale == UCASE_LOC_TURKISH || caseLocale == UCASE_LOC_LITHUANIAN) :
+ (options & _FOLD_CASE_OPTIONS_MASK) == U_FOLD_CASE_DEFAULT)) {
+ latinToLower = LatinCase::TO_LOWER_NORMAL;
+ } else {
+ latinToLower = LatinCase::TO_LOWER_TR_LT;
+ }
+ const UTrie2 *trie = ucase_getTrie();
+ int32_t prev = srcStart;
+ int32_t srcIndex = srcStart;
+ for (;;) {
+ // fast path for simple cases
+ int32_t cpStart;
+ UChar32 c;
+ for (;;) {
+ if (U_FAILURE(errorCode) || srcIndex >= srcLimit) {
+ c = U_SENTINEL;
+ break;
+ }
+ uint8_t lead = src[srcIndex++];
+ if (lead <= 0x7f) {
+ int8_t d = latinToLower[lead];
+ if (d == LatinCase::EXC) {
+ cpStart = srcIndex - 1;
+ c = lead;
+ break;
+ }
+ if (d == 0) { continue; }
+ ByteSinkUtil::appendUnchanged(src + prev, srcIndex - 1 - prev,
+ sink, options, edits, errorCode);
+ char ascii = (char)(lead + d);
+ sink.Append(&ascii, 1);
+ if (edits != nullptr) {
+ edits->addReplace(1, 1);
+ }
+ prev = srcIndex;
+ continue;
+ } else if (lead < 0xe3) {
+ uint8_t t;
+ if (0xc2 <= lead && lead <= 0xc5 && srcIndex < srcLimit &&
+ (t = src[srcIndex] - 0x80) <= 0x3f) {
+ // U+0080..U+017F
+ ++srcIndex;
+ c = ((lead - 0xc0) << 6) | t;
+ int8_t d = latinToLower[c];
+ if (d == LatinCase::EXC) {
+ cpStart = srcIndex - 2;
+ break;
+ }
+ if (d == 0) { continue; }
+ ByteSinkUtil::appendUnchanged(src + prev, srcIndex - 2 - prev,
+ sink, options, edits, errorCode);
+ ByteSinkUtil::appendTwoBytes(c + d, sink);
+ if (edits != nullptr) {
+ edits->addReplace(2, 2);
+ }
+ prev = srcIndex;
+ continue;
+ }
+ } else if ((lead <= 0xe9 || lead == 0xeb || lead == 0xec) &&
+ (srcIndex + 2) <= srcLimit &&
+ U8_IS_TRAIL(src[srcIndex]) && U8_IS_TRAIL(src[srcIndex + 1])) {
+ // most of CJK: no case mappings
+ srcIndex += 2;
+ continue;
}
- uint8_t lead = src[srcIndex++];
- if (lead <= 0x7f) {
- int8_t d = latinToLower[lead];
- if (d == LatinCase::EXC) {
- cpStart = srcIndex - 1;
- c = lead;
- break;
- }
- if (d == 0) { continue; }
- ByteSinkUtil::appendUnchanged(src + prev, srcIndex - 1 - prev,
- sink, options, edits, errorCode);
- char ascii = (char)(lead + d);
- sink.Append(&ascii, 1);
- if (edits != nullptr) {
- edits->addReplace(1, 1);
- }
- prev = srcIndex;
- continue;
- } else if (lead < 0xe3) {
- uint8_t t;
- if (0xc2 <= lead && lead <= 0xc5 && srcIndex < srcLimit &&
- (t = src[srcIndex] - 0x80) <= 0x3f) {
- // U+0080..U+017F
- ++srcIndex;
- c = ((lead - 0xc0) << 6) | t;
- int8_t d = latinToLower[c];
- if (d == LatinCase::EXC) {
- cpStart = srcIndex - 2;
- break;
- }
- if (d == 0) { continue; }
- ByteSinkUtil::appendUnchanged(src + prev, srcIndex - 2 - prev,
- sink, options, edits, errorCode);
- ByteSinkUtil::appendTwoBytes(c + d, sink);
- if (edits != nullptr) {
- edits->addReplace(2, 2);
- }
- prev = srcIndex;
- continue;
- }
- } else if ((lead <= 0xe9 || lead == 0xeb || lead == 0xec) &&
- (srcIndex + 2) <= srcLimit &&
- U8_IS_TRAIL(src[srcIndex]) && U8_IS_TRAIL(src[srcIndex + 1])) {
- // most of CJK: no case mappings
- srcIndex += 2;
- continue;
- }
- cpStart = --srcIndex;
- U8_NEXT(src, srcIndex, srcLimit, c);
- if (c < 0) {
- // ill-formed UTF-8
- continue;
- }
- uint16_t props = UTRIE2_GET16(trie, c);
- if (UCASE_HAS_EXCEPTION(props)) { break; }
- int32_t delta;
- if (!UCASE_IS_UPPER_OR_TITLE(props) || (delta = UCASE_GET_DELTA(props)) == 0) {
- continue;
- }
- ByteSinkUtil::appendUnchanged(src + prev, cpStart - prev,
- sink, options, edits, errorCode);
- ByteSinkUtil::appendCodePoint(srcIndex - cpStart, c + delta, sink, edits);
- prev = srcIndex;
+ cpStart = --srcIndex;
+ U8_NEXT(src, srcIndex, srcLimit, c);
+ if (c < 0) {
+ // ill-formed UTF-8
+ continue;
+ }
+ uint16_t props = UTRIE2_GET16(trie, c);
+ if (UCASE_HAS_EXCEPTION(props)) { break; }
+ int32_t delta;
+ if (!UCASE_IS_UPPER_OR_TITLE(props) || (delta = UCASE_GET_DELTA(props)) == 0) {
+ continue;
+ }
+ ByteSinkUtil::appendUnchanged(src + prev, cpStart - prev,
+ sink, options, edits, errorCode);
+ ByteSinkUtil::appendCodePoint(srcIndex - cpStart, c + delta, sink, edits);
+ prev = srcIndex;
+ }
+ if (c < 0) {
+ break;
}
- if (c < 0) {
- break;
- }
- // slow path
- const UChar *s;
- if (caseLocale >= 0) {
- csc->cpStart = cpStart;
- csc->cpLimit = srcIndex;
- c = ucase_toFullLower(c, utf8_caseContextIterator, csc, &s, caseLocale);
+ // slow path
+ const UChar *s;
+ if (caseLocale >= 0) {
+ csc->cpStart = cpStart;
+ csc->cpLimit = srcIndex;
+ c = ucase_toFullLower(c, utf8_caseContextIterator, csc, &s, caseLocale);
} else {
- c = ucase_toFullFolding(c, &s, options);
+ c = ucase_toFullFolding(c, &s, options);
}
- if (c >= 0) {
- ByteSinkUtil::appendUnchanged(src + prev, cpStart - prev,
- sink, options, edits, errorCode);
- appendResult(srcIndex - cpStart, c, s, sink, options, edits, errorCode);
- prev = srcIndex;
- }
+ if (c >= 0) {
+ ByteSinkUtil::appendUnchanged(src + prev, cpStart - prev,
+ sink, options, edits, errorCode);
+ appendResult(srcIndex - cpStart, c, s, sink, options, edits, errorCode);
+ prev = srcIndex;
+ }
+ }
+ ByteSinkUtil::appendUnchanged(src + prev, srcIndex - prev,
+ sink, options, edits, errorCode);
+}
+
+void toUpper(int32_t caseLocale, uint32_t options,
+ const uint8_t *src, UCaseContext *csc, int32_t srcLength,
+ icu::ByteSink &sink, icu::Edits *edits, UErrorCode &errorCode) {
+ const int8_t *latinToUpper;
+ if (caseLocale == UCASE_LOC_TURKISH) {
+ latinToUpper = LatinCase::TO_UPPER_TR;
+ } else {
+ latinToUpper = LatinCase::TO_UPPER_NORMAL;
}
- ByteSinkUtil::appendUnchanged(src + prev, srcIndex - prev,
- sink, options, edits, errorCode);
-}
-
-void toUpper(int32_t caseLocale, uint32_t options,
- const uint8_t *src, UCaseContext *csc, int32_t srcLength,
- icu::ByteSink &sink, icu::Edits *edits, UErrorCode &errorCode) {
- const int8_t *latinToUpper;
- if (caseLocale == UCASE_LOC_TURKISH) {
- latinToUpper = LatinCase::TO_UPPER_TR;
- } else {
- latinToUpper = LatinCase::TO_UPPER_NORMAL;
+ const UTrie2 *trie = ucase_getTrie();
+ int32_t prev = 0;
+ int32_t srcIndex = 0;
+ for (;;) {
+ // fast path for simple cases
+ int32_t cpStart;
+ UChar32 c;
+ for (;;) {
+ if (U_FAILURE(errorCode) || srcIndex >= srcLength) {
+ c = U_SENTINEL;
+ break;
+ }
+ uint8_t lead = src[srcIndex++];
+ if (lead <= 0x7f) {
+ int8_t d = latinToUpper[lead];
+ if (d == LatinCase::EXC) {
+ cpStart = srcIndex - 1;
+ c = lead;
+ break;
+ }
+ if (d == 0) { continue; }
+ ByteSinkUtil::appendUnchanged(src + prev, srcIndex - 1 - prev,
+ sink, options, edits, errorCode);
+ char ascii = (char)(lead + d);
+ sink.Append(&ascii, 1);
+ if (edits != nullptr) {
+ edits->addReplace(1, 1);
+ }
+ prev = srcIndex;
+ continue;
+ } else if (lead < 0xe3) {
+ uint8_t t;
+ if (0xc2 <= lead && lead <= 0xc5 && srcIndex < srcLength &&
+ (t = src[srcIndex] - 0x80) <= 0x3f) {
+ // U+0080..U+017F
+ ++srcIndex;
+ c = ((lead - 0xc0) << 6) | t;
+ int8_t d = latinToUpper[c];
+ if (d == LatinCase::EXC) {
+ cpStart = srcIndex - 2;
+ break;
+ }
+ if (d == 0) { continue; }
+ ByteSinkUtil::appendUnchanged(src + prev, srcIndex - 2 - prev,
+ sink, options, edits, errorCode);
+ ByteSinkUtil::appendTwoBytes(c + d, sink);
+ if (edits != nullptr) {
+ edits->addReplace(2, 2);
+ }
+ prev = srcIndex;
+ continue;
+ }
+ } else if ((lead <= 0xe9 || lead == 0xeb || lead == 0xec) &&
+ (srcIndex + 2) <= srcLength &&
+ U8_IS_TRAIL(src[srcIndex]) && U8_IS_TRAIL(src[srcIndex + 1])) {
+ // most of CJK: no case mappings
+ srcIndex += 2;
+ continue;
+ }
+ cpStart = --srcIndex;
+ U8_NEXT(src, srcIndex, srcLength, c);
+ if (c < 0) {
+ // ill-formed UTF-8
+ continue;
+ }
+ uint16_t props = UTRIE2_GET16(trie, c);
+ if (UCASE_HAS_EXCEPTION(props)) { break; }
+ int32_t delta;
+ if (UCASE_GET_TYPE(props) != UCASE_LOWER || (delta = UCASE_GET_DELTA(props)) == 0) {
+ continue;
+ }
+ ByteSinkUtil::appendUnchanged(src + prev, cpStart - prev,
+ sink, options, edits, errorCode);
+ ByteSinkUtil::appendCodePoint(srcIndex - cpStart, c + delta, sink, edits);
+ prev = srcIndex;
+ }
+ if (c < 0) {
+ break;
+ }
+ // slow path
+ csc->cpStart = cpStart;
+ csc->cpLimit = srcIndex;
+ const UChar *s;
+ c = ucase_toFullUpper(c, utf8_caseContextIterator, csc, &s, caseLocale);
+ if (c >= 0) {
+ ByteSinkUtil::appendUnchanged(src + prev, cpStart - prev,
+ sink, options, edits, errorCode);
+ appendResult(srcIndex - cpStart, c, s, sink, options, edits, errorCode);
+ prev = srcIndex;
+ }
}
- const UTrie2 *trie = ucase_getTrie();
- int32_t prev = 0;
- int32_t srcIndex = 0;
- for (;;) {
- // fast path for simple cases
- int32_t cpStart;
- UChar32 c;
- for (;;) {
- if (U_FAILURE(errorCode) || srcIndex >= srcLength) {
- c = U_SENTINEL;
- break;
- }
- uint8_t lead = src[srcIndex++];
- if (lead <= 0x7f) {
- int8_t d = latinToUpper[lead];
- if (d == LatinCase::EXC) {
- cpStart = srcIndex - 1;
- c = lead;
- break;
- }
- if (d == 0) { continue; }
- ByteSinkUtil::appendUnchanged(src + prev, srcIndex - 1 - prev,
- sink, options, edits, errorCode);
- char ascii = (char)(lead + d);
- sink.Append(&ascii, 1);
- if (edits != nullptr) {
- edits->addReplace(1, 1);
- }
- prev = srcIndex;
- continue;
- } else if (lead < 0xe3) {
- uint8_t t;
- if (0xc2 <= lead && lead <= 0xc5 && srcIndex < srcLength &&
- (t = src[srcIndex] - 0x80) <= 0x3f) {
- // U+0080..U+017F
- ++srcIndex;
- c = ((lead - 0xc0) << 6) | t;
- int8_t d = latinToUpper[c];
- if (d == LatinCase::EXC) {
- cpStart = srcIndex - 2;
- break;
- }
- if (d == 0) { continue; }
- ByteSinkUtil::appendUnchanged(src + prev, srcIndex - 2 - prev,
- sink, options, edits, errorCode);
- ByteSinkUtil::appendTwoBytes(c + d, sink);
- if (edits != nullptr) {
- edits->addReplace(2, 2);
- }
- prev = srcIndex;
- continue;
- }
- } else if ((lead <= 0xe9 || lead == 0xeb || lead == 0xec) &&
- (srcIndex + 2) <= srcLength &&
- U8_IS_TRAIL(src[srcIndex]) && U8_IS_TRAIL(src[srcIndex + 1])) {
- // most of CJK: no case mappings
- srcIndex += 2;
- continue;
- }
- cpStart = --srcIndex;
- U8_NEXT(src, srcIndex, srcLength, c);
- if (c < 0) {
- // ill-formed UTF-8
- continue;
- }
- uint16_t props = UTRIE2_GET16(trie, c);
- if (UCASE_HAS_EXCEPTION(props)) { break; }
- int32_t delta;
- if (UCASE_GET_TYPE(props) != UCASE_LOWER || (delta = UCASE_GET_DELTA(props)) == 0) {
- continue;
- }
- ByteSinkUtil::appendUnchanged(src + prev, cpStart - prev,
- sink, options, edits, errorCode);
- ByteSinkUtil::appendCodePoint(srcIndex - cpStart, c + delta, sink, edits);
- prev = srcIndex;
- }
- if (c < 0) {
- break;
- }
- // slow path
- csc->cpStart = cpStart;
- csc->cpLimit = srcIndex;
- const UChar *s;
- c = ucase_toFullUpper(c, utf8_caseContextIterator, csc, &s, caseLocale);
- if (c >= 0) {
- ByteSinkUtil::appendUnchanged(src + prev, cpStart - prev,
- sink, options, edits, errorCode);
- appendResult(srcIndex - cpStart, c, s, sink, options, edits, errorCode);
- prev = srcIndex;
- }
- }
- ByteSinkUtil::appendUnchanged(src + prev, srcIndex - prev,
- sink, options, edits, errorCode);
+ ByteSinkUtil::appendUnchanged(src + prev, srcIndex - prev,
+ sink, options, edits, errorCode);
}
-} // namespace
-
+} // namespace
+
#if !UCONFIG_NO_BREAK_ITERATION
-U_CFUNC void U_CALLCONV
-ucasemap_internalUTF8ToTitle(
- int32_t caseLocale, uint32_t options, BreakIterator *iter,
- const uint8_t *src, int32_t srcLength,
- ByteSink &sink, icu::Edits *edits,
- UErrorCode &errorCode) {
- if (!ustrcase_checkTitleAdjustmentOptions(options, errorCode)) {
- return;
+U_CFUNC void U_CALLCONV
+ucasemap_internalUTF8ToTitle(
+ int32_t caseLocale, uint32_t options, BreakIterator *iter,
+ const uint8_t *src, int32_t srcLength,
+ ByteSink &sink, icu::Edits *edits,
+ UErrorCode &errorCode) {
+ if (!ustrcase_checkTitleAdjustmentOptions(options, errorCode)) {
+ return;
}
/* set up local variables */
UCaseContext csc=UCASECONTEXT_INITIALIZER;
csc.p=(void *)src;
csc.limit=srcLength;
- int32_t prev=0;
- UBool isFirstIndex=TRUE;
+ int32_t prev=0;
+ UBool isFirstIndex=TRUE;
/* titlecasing loop */
while(prev<srcLength) {
/* find next index where to titlecase */
- int32_t index;
+ int32_t index;
if(isFirstIndex) {
isFirstIndex=FALSE;
- index=iter->first();
+ index=iter->first();
} else {
- index=iter->next();
+ index=iter->next();
}
- if(index==UBRK_DONE || index>srcLength) {
- index=srcLength;
+ if(index==UBRK_DONE || index>srcLength) {
+ index=srcLength;
}
/*
- * Segment [prev..index[ into 3 parts:
- * a) skipped characters (copy as-is) [prev..titleStart[
- * b) first letter (titlecase) [titleStart..titleLimit[
+ * Segment [prev..index[ into 3 parts:
+ * a) skipped characters (copy as-is) [prev..titleStart[
+ * b) first letter (titlecase) [titleStart..titleLimit[
* c) subsequent characters (lowercase) [titleLimit..index[
*/
- if(prev<index) {
- /* find and copy skipped characters [prev..titleStart[ */
- int32_t titleStart=prev;
- int32_t titleLimit=prev;
- UChar32 c;
- U8_NEXT(src, titleLimit, index, c);
- if ((options&U_TITLECASE_NO_BREAK_ADJUSTMENT)==0) {
- // Adjust the titlecasing index to the next cased character,
- // or to the next letter/number/symbol/private use.
- // Stop with titleStart<titleLimit<=index
- // if there is a character to be titlecased,
- // or else stop with titleStart==titleLimit==index.
- UBool toCased = (options&U_TITLECASE_ADJUST_TO_CASED) != 0;
- while (toCased ? UCASE_NONE==ucase_getType(c) : !ustrcase_isLNS(c)) {
+ if(prev<index) {
+ /* find and copy skipped characters [prev..titleStart[ */
+ int32_t titleStart=prev;
+ int32_t titleLimit=prev;
+ UChar32 c;
+ U8_NEXT(src, titleLimit, index, c);
+ if ((options&U_TITLECASE_NO_BREAK_ADJUSTMENT)==0) {
+ // Adjust the titlecasing index to the next cased character,
+ // or to the next letter/number/symbol/private use.
+ // Stop with titleStart<titleLimit<=index
+ // if there is a character to be titlecased,
+ // or else stop with titleStart==titleLimit==index.
+ UBool toCased = (options&U_TITLECASE_ADJUST_TO_CASED) != 0;
+ while (toCased ? UCASE_NONE==ucase_getType(c) : !ustrcase_isLNS(c)) {
titleStart=titleLimit;
- if(titleLimit==index) {
+ if(titleLimit==index) {
break;
}
- U8_NEXT(src, titleLimit, index, c);
- }
- if (prev < titleStart) {
- if (!ByteSinkUtil::appendUnchanged(src+prev, titleStart-prev,
- sink, options, edits, errorCode)) {
- return;
+ U8_NEXT(src, titleLimit, index, c);
+ }
+ if (prev < titleStart) {
+ if (!ByteSinkUtil::appendUnchanged(src+prev, titleStart-prev,
+ sink, options, edits, errorCode)) {
+ return;
}
}
}
@@ -490,58 +490,58 @@ ucasemap_internalUTF8ToTitle(
if(c>=0) {
csc.cpStart=titleStart;
csc.cpLimit=titleLimit;
- const UChar *s;
- c=ucase_toFullTitle(c, utf8_caseContextIterator, &csc, &s, caseLocale);
- if (!appendResult(titleLimit-titleStart, c, s, sink, options, edits, errorCode)) {
- return;
- }
+ const UChar *s;
+ c=ucase_toFullTitle(c, utf8_caseContextIterator, &csc, &s, caseLocale);
+ if (!appendResult(titleLimit-titleStart, c, s, sink, options, edits, errorCode)) {
+ return;
+ }
} else {
// Malformed UTF-8.
- if (!ByteSinkUtil::appendUnchanged(src+titleStart, titleLimit-titleStart,
- sink, options, edits, errorCode)) {
- return;
- }
+ if (!ByteSinkUtil::appendUnchanged(src+titleStart, titleLimit-titleStart,
+ sink, options, edits, errorCode)) {
+ return;
+ }
}
/* Special case Dutch IJ titlecasing */
- if (titleStart+1 < index &&
- caseLocale == UCASE_LOC_DUTCH &&
- (src[titleStart] == 0x0049 || src[titleStart] == 0x0069)) {
- if (src[titleStart+1] == 0x006A) {
- ByteSinkUtil::appendCodePoint(1, 0x004A, sink, edits);
- titleLimit++;
- } else if (src[titleStart+1] == 0x004A) {
- // Keep the capital J from getting lowercased.
- if (!ByteSinkUtil::appendUnchanged(src+titleStart+1, 1,
- sink, options, edits, errorCode)) {
- return;
- }
- titleLimit++;
- }
+ if (titleStart+1 < index &&
+ caseLocale == UCASE_LOC_DUTCH &&
+ (src[titleStart] == 0x0049 || src[titleStart] == 0x0069)) {
+ if (src[titleStart+1] == 0x006A) {
+ ByteSinkUtil::appendCodePoint(1, 0x004A, sink, edits);
+ titleLimit++;
+ } else if (src[titleStart+1] == 0x004A) {
+ // Keep the capital J from getting lowercased.
+ if (!ByteSinkUtil::appendUnchanged(src+titleStart+1, 1,
+ sink, options, edits, errorCode)) {
+ return;
+ }
+ titleLimit++;
+ }
}
-
+
/* lowercase [titleLimit..index[ */
- if(titleLimit<index) {
- if((options&U_TITLECASE_NO_LOWERCASE)==0) {
+ if(titleLimit<index) {
+ if((options&U_TITLECASE_NO_LOWERCASE)==0) {
/* Normal operation: Lowercase the rest of the word. */
- toLower(caseLocale, options,
- src, &csc, titleLimit, index,
- sink, edits, errorCode);
- if(U_FAILURE(errorCode)) {
- return;
- }
+ toLower(caseLocale, options,
+ src, &csc, titleLimit, index,
+ sink, edits, errorCode);
+ if(U_FAILURE(errorCode)) {
+ return;
+ }
} else {
/* Optionally just copy the rest of the word unchanged. */
- if (!ByteSinkUtil::appendUnchanged(src+titleLimit, index-titleLimit,
- sink, options, edits, errorCode)) {
- return;
+ if (!ByteSinkUtil::appendUnchanged(src+titleLimit, index-titleLimit,
+ sink, options, edits, errorCode)) {
+ return;
}
}
}
}
}
- prev=index;
+ prev=index;
}
}
@@ -550,11 +550,11 @@ ucasemap_internalUTF8ToTitle(
U_NAMESPACE_BEGIN
namespace GreekUpper {
-UBool isFollowedByCasedLetter(const uint8_t *s, int32_t i, int32_t length) {
+UBool isFollowedByCasedLetter(const uint8_t *s, int32_t i, int32_t length) {
while (i < length) {
UChar32 c;
U8_NEXT(s, i, length, c);
- int32_t type = ucase_getTypeOrIgnorable(c);
+ int32_t type = ucase_getTypeOrIgnorable(c);
if ((type & UCASE_IGNORABLE) != 0) {
// Case-ignorable, continue with the loop.
} else if (type != UCASE_NONE) {
@@ -567,17 +567,17 @@ UBool isFollowedByCasedLetter(const uint8_t *s, int32_t i, int32_t length) {
}
// Keep this consistent with the UTF-16 version in ustrcase.cpp and the Java version in CaseMap.java.
-void toUpper(uint32_t options,
- const uint8_t *src, int32_t srcLength,
- ByteSink &sink, Edits *edits,
- UErrorCode &errorCode) {
+void toUpper(uint32_t options,
+ const uint8_t *src, int32_t srcLength,
+ ByteSink &sink, Edits *edits,
+ UErrorCode &errorCode) {
uint32_t state = 0;
for (int32_t i = 0; i < srcLength;) {
int32_t nextIndex = i;
UChar32 c;
U8_NEXT(src, nextIndex, srcLength, c);
uint32_t nextState = 0;
- int32_t type = ucase_getTypeOrIgnorable(c);
+ int32_t type = ucase_getTypeOrIgnorable(c);
if ((type & UCASE_IGNORABLE) != 0) {
// c is case-ignorable
nextState |= (state & AFTER_CASED);
@@ -627,7 +627,7 @@ void toUpper(uint32_t options,
(data & HAS_ACCENT) != 0 &&
numYpogegrammeni == 0 &&
(state & AFTER_CASED) == 0 &&
- !isFollowedByCasedLetter(src, nextIndex, srcLength)) {
+ !isFollowedByCasedLetter(src, nextIndex, srcLength)) {
// Keep disjunctive "or" with (only) a tonos.
// We use the same "word boundary" conditions as for the Final_Sigma test.
if (i == nextIndex) {
@@ -645,69 +645,69 @@ void toUpper(uint32_t options,
data &= ~HAS_EITHER_DIALYTIKA;
}
}
-
- UBool change;
- if (edits == nullptr && (options & U_OMIT_UNCHANGED_TEXT) == 0) {
- change = TRUE; // common, simple usage
- } else {
- // Find out first whether we are changing the text.
- U_ASSERT(0x370 <= upper && upper <= 0x3ff); // 2-byte UTF-8, main Greek block
- change = (i + 2) > nextIndex ||
- src[i] != getTwoByteLead(upper) || src[i + 1] != getTwoByteTrail(upper) ||
- numYpogegrammeni > 0;
- int32_t i2 = i + 2;
- if ((data & HAS_EITHER_DIALYTIKA) != 0) {
- change |= (i2 + 2) > nextIndex ||
- src[i2] != (uint8_t)u8"\u0308"[0] ||
- src[i2 + 1] != (uint8_t)u8"\u0308"[1];
- i2 += 2;
- }
- if (addTonos) {
- change |= (i2 + 2) > nextIndex ||
- src[i2] != (uint8_t)u8"\u0301"[0] ||
- src[i2 + 1] != (uint8_t)u8"\u0301"[1];
- i2 += 2;
- }
- int32_t oldLength = nextIndex - i;
- int32_t newLength = (i2 - i) + numYpogegrammeni * 2; // 2 bytes per U+0399
- change |= oldLength != newLength;
- if (change) {
- if (edits != NULL) {
- edits->addReplace(oldLength, newLength);
- }
- } else {
- if (edits != NULL) {
- edits->addUnchanged(oldLength);
- }
- // Write unchanged text?
- change = (options & U_OMIT_UNCHANGED_TEXT) == 0;
- }
+
+ UBool change;
+ if (edits == nullptr && (options & U_OMIT_UNCHANGED_TEXT) == 0) {
+ change = TRUE; // common, simple usage
+ } else {
+ // Find out first whether we are changing the text.
+ U_ASSERT(0x370 <= upper && upper <= 0x3ff); // 2-byte UTF-8, main Greek block
+ change = (i + 2) > nextIndex ||
+ src[i] != getTwoByteLead(upper) || src[i + 1] != getTwoByteTrail(upper) ||
+ numYpogegrammeni > 0;
+ int32_t i2 = i + 2;
+ if ((data & HAS_EITHER_DIALYTIKA) != 0) {
+ change |= (i2 + 2) > nextIndex ||
+ src[i2] != (uint8_t)u8"\u0308"[0] ||
+ src[i2 + 1] != (uint8_t)u8"\u0308"[1];
+ i2 += 2;
+ }
+ if (addTonos) {
+ change |= (i2 + 2) > nextIndex ||
+ src[i2] != (uint8_t)u8"\u0301"[0] ||
+ src[i2 + 1] != (uint8_t)u8"\u0301"[1];
+ i2 += 2;
+ }
+ int32_t oldLength = nextIndex - i;
+ int32_t newLength = (i2 - i) + numYpogegrammeni * 2; // 2 bytes per U+0399
+ change |= oldLength != newLength;
+ if (change) {
+ if (edits != NULL) {
+ edits->addReplace(oldLength, newLength);
+ }
+ } else {
+ if (edits != NULL) {
+ edits->addUnchanged(oldLength);
+ }
+ // Write unchanged text?
+ change = (options & U_OMIT_UNCHANGED_TEXT) == 0;
+ }
}
-
- if (change) {
- ByteSinkUtil::appendTwoBytes(upper, sink);
- if ((data & HAS_EITHER_DIALYTIKA) != 0) {
- sink.AppendU8(u8"\u0308", 2); // restore or add a dialytika
- }
- if (addTonos) {
- sink.AppendU8(u8"\u0301", 2);
- }
- while (numYpogegrammeni > 0) {
- sink.AppendU8(u8"\u0399", 2);
- --numYpogegrammeni;
- }
+
+ if (change) {
+ ByteSinkUtil::appendTwoBytes(upper, sink);
+ if ((data & HAS_EITHER_DIALYTIKA) != 0) {
+ sink.AppendU8(u8"\u0308", 2); // restore or add a dialytika
+ }
+ if (addTonos) {
+ sink.AppendU8(u8"\u0301", 2);
+ }
+ while (numYpogegrammeni > 0) {
+ sink.AppendU8(u8"\u0399", 2);
+ --numYpogegrammeni;
+ }
}
} else if(c>=0) {
const UChar *s;
- c=ucase_toFullUpper(c, NULL, NULL, &s, UCASE_LOC_GREEK);
- if (!appendResult(nextIndex - i, c, s, sink, options, edits, errorCode)) {
- return;
+ c=ucase_toFullUpper(c, NULL, NULL, &s, UCASE_LOC_GREEK);
+ if (!appendResult(nextIndex - i, c, s, sink, options, edits, errorCode)) {
+ return;
}
} else {
// Malformed UTF-8.
- if (!ByteSinkUtil::appendUnchanged(src+i, nextIndex-i,
- sink, options, edits, errorCode)) {
- return;
+ if (!ByteSinkUtil::appendUnchanged(src+i, nextIndex-i,
+ sink, options, edits, errorCode)) {
+ return;
}
}
i = nextIndex;
@@ -718,98 +718,98 @@ void toUpper(uint32_t options,
} // namespace GreekUpper
U_NAMESPACE_END
-static void U_CALLCONV
-ucasemap_internalUTF8ToLower(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_UNUSED
+static void U_CALLCONV
+ucasemap_internalUTF8ToLower(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_UNUSED
const uint8_t *src, int32_t srcLength,
- icu::ByteSink &sink, icu::Edits *edits,
- UErrorCode &errorCode) {
+ icu::ByteSink &sink, icu::Edits *edits,
+ UErrorCode &errorCode) {
UCaseContext csc=UCASECONTEXT_INITIALIZER;
csc.p=(void *)src;
csc.limit=srcLength;
- toLower(
- caseLocale, options,
+ toLower(
+ caseLocale, options,
src, &csc, 0, srcLength,
- sink, edits, errorCode);
+ sink, edits, errorCode);
}
-static void U_CALLCONV
-ucasemap_internalUTF8ToUpper(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_UNUSED
+static void U_CALLCONV
+ucasemap_internalUTF8ToUpper(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_UNUSED
const uint8_t *src, int32_t srcLength,
- icu::ByteSink &sink, icu::Edits *edits,
- UErrorCode &errorCode) {
- if (caseLocale == UCASE_LOC_GREEK) {
- GreekUpper::toUpper(options, src, srcLength, sink, edits, errorCode);
- } else {
- UCaseContext csc=UCASECONTEXT_INITIALIZER;
- csc.p=(void *)src;
- csc.limit=srcLength;
- toUpper(
- caseLocale, options,
- src, &csc, srcLength,
- sink, edits, errorCode);
+ icu::ByteSink &sink, icu::Edits *edits,
+ UErrorCode &errorCode) {
+ if (caseLocale == UCASE_LOC_GREEK) {
+ GreekUpper::toUpper(options, src, srcLength, sink, edits, errorCode);
+ } else {
+ UCaseContext csc=UCASECONTEXT_INITIALIZER;
+ csc.p=(void *)src;
+ csc.limit=srcLength;
+ toUpper(
+ caseLocale, options,
+ src, &csc, srcLength,
+ sink, edits, errorCode);
}
}
-static void U_CALLCONV
-ucasemap_internalUTF8Fold(int32_t /* caseLocale */, uint32_t options, UCASEMAP_BREAK_ITERATOR_UNUSED
- const uint8_t *src, int32_t srcLength,
- icu::ByteSink &sink, icu::Edits *edits,
- UErrorCode &errorCode) {
- toLower(
- -1, options,
- src, nullptr, 0, srcLength,
- sink, edits, errorCode);
-}
-
-void
-ucasemap_mapUTF8(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
- const char *src, int32_t srcLength,
- UTF8CaseMapper *stringCaseMapper,
- icu::ByteSink &sink, icu::Edits *edits,
- UErrorCode &errorCode) {
- /* check argument values */
- if (U_FAILURE(errorCode)) {
- return;
- }
- if ((src == nullptr && srcLength != 0) || srcLength < -1) {
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- // Get the string length.
- if (srcLength == -1) {
- srcLength = (int32_t)uprv_strlen((const char *)src);
+static void U_CALLCONV
+ucasemap_internalUTF8Fold(int32_t /* caseLocale */, uint32_t options, UCASEMAP_BREAK_ITERATOR_UNUSED
+ const uint8_t *src, int32_t srcLength,
+ icu::ByteSink &sink, icu::Edits *edits,
+ UErrorCode &errorCode) {
+ toLower(
+ -1, options,
+ src, nullptr, 0, srcLength,
+ sink, edits, errorCode);
+}
+
+void
+ucasemap_mapUTF8(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
+ const char *src, int32_t srcLength,
+ UTF8CaseMapper *stringCaseMapper,
+ icu::ByteSink &sink, icu::Edits *edits,
+ UErrorCode &errorCode) {
+ /* check argument values */
+ if (U_FAILURE(errorCode)) {
+ return;
+ }
+ if ((src == nullptr && srcLength != 0) || srcLength < -1) {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ // Get the string length.
+ if (srcLength == -1) {
+ srcLength = (int32_t)uprv_strlen((const char *)src);
}
- if (edits != nullptr && (options & U_EDITS_NO_RESET) == 0) {
- edits->reset();
+ if (edits != nullptr && (options & U_EDITS_NO_RESET) == 0) {
+ edits->reset();
+ }
+ stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR
+ (const uint8_t *)src, srcLength, sink, edits, errorCode);
+ sink.Flush();
+ if (U_SUCCESS(errorCode)) {
+ if (edits != nullptr) {
+ edits->copyErrorTo(errorCode);
+ }
}
- stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR
- (const uint8_t *)src, srcLength, sink, edits, errorCode);
- sink.Flush();
- if (U_SUCCESS(errorCode)) {
- if (edits != nullptr) {
- edits->copyErrorTo(errorCode);
- }
- }
}
-int32_t
-ucasemap_mapUTF8(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
- char *dest, int32_t destCapacity,
- const char *src, int32_t srcLength,
+int32_t
+ucasemap_mapUTF8(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
+ char *dest, int32_t destCapacity,
+ const char *src, int32_t srcLength,
UTF8CaseMapper *stringCaseMapper,
- icu::Edits *edits,
- UErrorCode &errorCode) {
+ icu::Edits *edits,
+ UErrorCode &errorCode) {
/* check argument values */
- if(U_FAILURE(errorCode)) {
+ if(U_FAILURE(errorCode)) {
return 0;
}
if( destCapacity<0 ||
(dest==NULL && destCapacity>0) ||
- (src==NULL && srcLength!=0) || srcLength<-1
+ (src==NULL && srcLength!=0) || srcLength<-1
) {
- errorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ errorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -823,25 +823,25 @@ ucasemap_mapUTF8(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_P
((src>=dest && src<(dest+destCapacity)) ||
(dest>=src && dest<(src+srcLength)))
) {
- errorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ errorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
- CheckedArrayByteSink sink(dest, destCapacity);
- if (edits != nullptr && (options & U_EDITS_NO_RESET) == 0) {
- edits->reset();
- }
- stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR
- (const uint8_t *)src, srcLength, sink, edits, errorCode);
- sink.Flush();
- if (U_SUCCESS(errorCode)) {
- if (sink.Overflowed()) {
- errorCode = U_BUFFER_OVERFLOW_ERROR;
- } else if (edits != nullptr) {
- edits->copyErrorTo(errorCode);
- }
- }
- return u_terminateChars(dest, destCapacity, sink.NumberOfBytesAppended(), &errorCode);
+ CheckedArrayByteSink sink(dest, destCapacity);
+ if (edits != nullptr && (options & U_EDITS_NO_RESET) == 0) {
+ edits->reset();
+ }
+ stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR
+ (const uint8_t *)src, srcLength, sink, edits, errorCode);
+ sink.Flush();
+ if (U_SUCCESS(errorCode)) {
+ if (sink.Overflowed()) {
+ errorCode = U_BUFFER_OVERFLOW_ERROR;
+ } else if (edits != nullptr) {
+ edits->copyErrorTo(errorCode);
+ }
+ }
+ return u_terminateChars(dest, destCapacity, sink.NumberOfBytesAppended(), &errorCode);
}
/* public API functions */
@@ -851,11 +851,11 @@ ucasemap_utf8ToLower(const UCaseMap *csm,
char *dest, int32_t destCapacity,
const char *src, int32_t srcLength,
UErrorCode *pErrorCode) {
- return ucasemap_mapUTF8(
- csm->caseLocale, csm->options, UCASEMAP_BREAK_ITERATOR_NULL
- dest, destCapacity,
- src, srcLength,
- ucasemap_internalUTF8ToLower, NULL, *pErrorCode);
+ return ucasemap_mapUTF8(
+ csm->caseLocale, csm->options, UCASEMAP_BREAK_ITERATOR_NULL
+ dest, destCapacity,
+ src, srcLength,
+ ucasemap_internalUTF8ToLower, NULL, *pErrorCode);
}
U_CAPI int32_t U_EXPORT2
@@ -863,11 +863,11 @@ ucasemap_utf8ToUpper(const UCaseMap *csm,
char *dest, int32_t destCapacity,
const char *src, int32_t srcLength,
UErrorCode *pErrorCode) {
- return ucasemap_mapUTF8(
- csm->caseLocale, csm->options, UCASEMAP_BREAK_ITERATOR_NULL
- dest, destCapacity,
- src, srcLength,
- ucasemap_internalUTF8ToUpper, NULL, *pErrorCode);
+ return ucasemap_mapUTF8(
+ csm->caseLocale, csm->options, UCASEMAP_BREAK_ITERATOR_NULL
+ dest, destCapacity,
+ src, srcLength,
+ ucasemap_internalUTF8ToUpper, NULL, *pErrorCode);
}
U_CAPI int32_t U_EXPORT2
@@ -875,79 +875,79 @@ ucasemap_utf8FoldCase(const UCaseMap *csm,
char *dest, int32_t destCapacity,
const char *src, int32_t srcLength,
UErrorCode *pErrorCode) {
- return ucasemap_mapUTF8(
- UCASE_LOC_ROOT, csm->options, UCASEMAP_BREAK_ITERATOR_NULL
- dest, destCapacity,
- src, srcLength,
- ucasemap_internalUTF8Fold, NULL, *pErrorCode);
+ return ucasemap_mapUTF8(
+ UCASE_LOC_ROOT, csm->options, UCASEMAP_BREAK_ITERATOR_NULL
+ dest, destCapacity,
+ src, srcLength,
+ ucasemap_internalUTF8Fold, NULL, *pErrorCode);
+}
+
+U_NAMESPACE_BEGIN
+
+void CaseMap::utf8ToLower(
+ const char *locale, uint32_t options,
+ StringPiece src, ByteSink &sink, Edits *edits,
+ UErrorCode &errorCode) {
+ ucasemap_mapUTF8(
+ ustrcase_getCaseLocale(locale), options, UCASEMAP_BREAK_ITERATOR_NULL
+ src.data(), src.length(),
+ ucasemap_internalUTF8ToLower, sink, edits, errorCode);
}
-
-U_NAMESPACE_BEGIN
-
-void CaseMap::utf8ToLower(
- const char *locale, uint32_t options,
- StringPiece src, ByteSink &sink, Edits *edits,
- UErrorCode &errorCode) {
- ucasemap_mapUTF8(
- ustrcase_getCaseLocale(locale), options, UCASEMAP_BREAK_ITERATOR_NULL
- src.data(), src.length(),
- ucasemap_internalUTF8ToLower, sink, edits, errorCode);
-}
-
-void CaseMap::utf8ToUpper(
- const char *locale, uint32_t options,
- StringPiece src, ByteSink &sink, Edits *edits,
- UErrorCode &errorCode) {
- ucasemap_mapUTF8(
- ustrcase_getCaseLocale(locale), options, UCASEMAP_BREAK_ITERATOR_NULL
- src.data(), src.length(),
- ucasemap_internalUTF8ToUpper, sink, edits, errorCode);
-}
-
-void CaseMap::utf8Fold(
- uint32_t options,
- StringPiece src, ByteSink &sink, Edits *edits,
- UErrorCode &errorCode) {
- ucasemap_mapUTF8(
- UCASE_LOC_ROOT, options, UCASEMAP_BREAK_ITERATOR_NULL
- src.data(), src.length(),
- ucasemap_internalUTF8Fold, sink, edits, errorCode);
-}
-
-int32_t CaseMap::utf8ToLower(
- const char *locale, uint32_t options,
- const char *src, int32_t srcLength,
- char *dest, int32_t destCapacity, Edits *edits,
- UErrorCode &errorCode) {
- return ucasemap_mapUTF8(
- ustrcase_getCaseLocale(locale), options, UCASEMAP_BREAK_ITERATOR_NULL
- dest, destCapacity,
- src, srcLength,
- ucasemap_internalUTF8ToLower, edits, errorCode);
-}
-
-int32_t CaseMap::utf8ToUpper(
- const char *locale, uint32_t options,
- const char *src, int32_t srcLength,
- char *dest, int32_t destCapacity, Edits *edits,
- UErrorCode &errorCode) {
- return ucasemap_mapUTF8(
- ustrcase_getCaseLocale(locale), options, UCASEMAP_BREAK_ITERATOR_NULL
- dest, destCapacity,
- src, srcLength,
- ucasemap_internalUTF8ToUpper, edits, errorCode);
-}
-
-int32_t CaseMap::utf8Fold(
- uint32_t options,
- const char *src, int32_t srcLength,
- char *dest, int32_t destCapacity, Edits *edits,
- UErrorCode &errorCode) {
- return ucasemap_mapUTF8(
- UCASE_LOC_ROOT, options, UCASEMAP_BREAK_ITERATOR_NULL
- dest, destCapacity,
- src, srcLength,
- ucasemap_internalUTF8Fold, edits, errorCode);
-}
-
-U_NAMESPACE_END
+
+void CaseMap::utf8ToUpper(
+ const char *locale, uint32_t options,
+ StringPiece src, ByteSink &sink, Edits *edits,
+ UErrorCode &errorCode) {
+ ucasemap_mapUTF8(
+ ustrcase_getCaseLocale(locale), options, UCASEMAP_BREAK_ITERATOR_NULL
+ src.data(), src.length(),
+ ucasemap_internalUTF8ToUpper, sink, edits, errorCode);
+}
+
+void CaseMap::utf8Fold(
+ uint32_t options,
+ StringPiece src, ByteSink &sink, Edits *edits,
+ UErrorCode &errorCode) {
+ ucasemap_mapUTF8(
+ UCASE_LOC_ROOT, options, UCASEMAP_BREAK_ITERATOR_NULL
+ src.data(), src.length(),
+ ucasemap_internalUTF8Fold, sink, edits, errorCode);
+}
+
+int32_t CaseMap::utf8ToLower(
+ const char *locale, uint32_t options,
+ const char *src, int32_t srcLength,
+ char *dest, int32_t destCapacity, Edits *edits,
+ UErrorCode &errorCode) {
+ return ucasemap_mapUTF8(
+ ustrcase_getCaseLocale(locale), options, UCASEMAP_BREAK_ITERATOR_NULL
+ dest, destCapacity,
+ src, srcLength,
+ ucasemap_internalUTF8ToLower, edits, errorCode);
+}
+
+int32_t CaseMap::utf8ToUpper(
+ const char *locale, uint32_t options,
+ const char *src, int32_t srcLength,
+ char *dest, int32_t destCapacity, Edits *edits,
+ UErrorCode &errorCode) {
+ return ucasemap_mapUTF8(
+ ustrcase_getCaseLocale(locale), options, UCASEMAP_BREAK_ITERATOR_NULL
+ dest, destCapacity,
+ src, srcLength,
+ ucasemap_internalUTF8ToUpper, edits, errorCode);
+}
+
+int32_t CaseMap::utf8Fold(
+ uint32_t options,
+ const char *src, int32_t srcLength,
+ char *dest, int32_t destCapacity, Edits *edits,
+ UErrorCode &errorCode) {
+ return ucasemap_mapUTF8(
+ UCASE_LOC_ROOT, options, UCASEMAP_BREAK_ITERATOR_NULL
+ dest, destCapacity,
+ src, srcLength,
+ ucasemap_internalUTF8Fold, edits, errorCode);
+}
+
+U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/ucasemap_imp.h b/contrib/libs/icu/common/ucasemap_imp.h
index b29b5d9ed7..7788fd9371 100644
--- a/contrib/libs/icu/common/ucasemap_imp.h
+++ b/contrib/libs/icu/common/ucasemap_imp.h
@@ -1,282 +1,282 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// ucasemap_imp.h
-// created: 2017feb08 Markus W. Scherer
-
-#ifndef __UCASEMAP_IMP_H__
-#define __UCASEMAP_IMP_H__
-
-#include "unicode/utypes.h"
-#include "unicode/ucasemap.h"
-#include "unicode/uchar.h"
-#include "ucase.h"
-
-/**
- * Bit mask for the titlecasing iterator options bit field.
- * Currently only 3 out of 8 values are used:
- * 0 (words), U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES.
- * See stringoptions.h.
- * @internal
- */
-#define U_TITLECASE_ITERATOR_MASK 0xe0
-
-/**
- * Bit mask for the titlecasing index adjustment options bit set.
- * Currently two bits are defined:
- * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED.
- * See stringoptions.h.
- * @internal
- */
-#define U_TITLECASE_ADJUSTMENT_MASK 0x600
-
-/**
- * Internal API, used by u_strcasecmp() etc.
- * Compare strings case-insensitively,
- * in code point order or code unit order.
- */
-U_CFUNC int32_t
-u_strcmpFold(const UChar *s1, int32_t length1,
- const UChar *s2, int32_t length2,
- uint32_t options,
- UErrorCode *pErrorCode);
-
-/**
- * Internal API, used for detecting length of
- * shared prefix case-insensitively.
- * @param s1 input string 1
- * @param length1 length of string 1, or -1 (NULL terminated)
- * @param s2 input string 2
- * @param length2 length of string 2, or -1 (NULL terminated)
- * @param options compare options
- * @param matchLen1 (output) length of partial prefix match in s1
- * @param matchLen2 (output) length of partial prefix match in s2
- * @param pErrorCode receives error status
- */
-U_CAPI void
-u_caseInsensitivePrefixMatch(const UChar *s1, int32_t length1,
- const UChar *s2, int32_t length2,
- uint32_t options,
- int32_t *matchLen1, int32_t *matchLen2,
- UErrorCode *pErrorCode);
-
-#ifdef __cplusplus
-
-U_NAMESPACE_BEGIN
-
-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. */
-inline UBool ustrcase_checkTitleAdjustmentOptions(uint32_t options, UErrorCode &errorCode) {
- 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 TRUE;
-}
-
-inline UBool ustrcase_isLNS(UChar32 c) {
- // Letter, number, symbol,
- // or a private use code point because those are typically used as letters or numbers.
- // Consider modifier letters only if they are cased.
- const uint32_t LNS = (U_GC_L_MASK|U_GC_N_MASK|U_GC_S_MASK|U_GC_CO_MASK) & ~U_GC_LM_MASK;
- int gc = u_charType(c);
- return (U_MASK(gc) & LNS) != 0 || (gc == U_MODIFIER_LETTER && ucase_getType(c) != UCASE_NONE);
-}
-
-#if !UCONFIG_NO_BREAK_ITERATION
-
-/** Returns nullptr if error. Pass in either locale or locID, not both. */
-U_CFUNC
-BreakIterator *ustrcase_getTitleBreakIterator(
- const Locale *locale, const char *locID, uint32_t options, BreakIterator *iter,
- LocalPointer<BreakIterator> &ownedIter, UErrorCode &errorCode);
-
-#endif
-
-U_NAMESPACE_END
-
-#include "unicode/unistr.h" // for UStringCaseMapper
-
-/*
- * Internal string casing functions implementing
- * ustring.h/ustrcase.cpp and UnicodeString case mapping functions.
- */
-
-struct UCaseMap : public icu::UMemory {
- /** Implements most of ucasemap_open(). */
- UCaseMap(const char *localeID, uint32_t opts, UErrorCode *pErrorCode);
- ~UCaseMap();
-
-#if !UCONFIG_NO_BREAK_ITERATION
- icu::BreakIterator *iter; /* We adopt the iterator, so we own it. */
-#endif
- char locale[32];
- int32_t caseLocale;
- uint32_t options;
-};
-
-#if UCONFIG_NO_BREAK_ITERATION
-# define UCASEMAP_BREAK_ITERATOR_PARAM
-# define UCASEMAP_BREAK_ITERATOR_UNUSED
-# define UCASEMAP_BREAK_ITERATOR
-# define UCASEMAP_BREAK_ITERATOR_NULL
-#else
-# define UCASEMAP_BREAK_ITERATOR_PARAM icu::BreakIterator *iter,
-# define UCASEMAP_BREAK_ITERATOR_UNUSED icu::BreakIterator *,
-# define UCASEMAP_BREAK_ITERATOR iter,
-# define UCASEMAP_BREAK_ITERATOR_NULL NULL,
-#endif
-
-U_CFUNC int32_t
-ustrcase_getCaseLocale(const char *locale);
-
-// TODO: swap src / dest if approved for new public api
-/** Implements UStringCaseMapper. */
-U_CFUNC int32_t U_CALLCONV
-ustrcase_internalToLower(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
- icu::Edits *edits,
- UErrorCode &errorCode);
-
-/** Implements UStringCaseMapper. */
-U_CFUNC int32_t U_CALLCONV
-ustrcase_internalToUpper(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
- icu::Edits *edits,
- UErrorCode &errorCode);
-
-#if !UCONFIG_NO_BREAK_ITERATION
-
-/** Implements UStringCaseMapper. */
-U_CFUNC int32_t U_CALLCONV
-ustrcase_internalToTitle(int32_t caseLocale, uint32_t options,
- icu::BreakIterator *iter,
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
- icu::Edits *edits,
- UErrorCode &errorCode);
-
-#endif
-
-/** Implements UStringCaseMapper. */
-U_CFUNC int32_t U_CALLCONV
-ustrcase_internalFold(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
- icu::Edits *edits,
- UErrorCode &errorCode);
-
-/**
- * Common string case mapping implementation for ucasemap_toXyz() and UnicodeString::toXyz().
- * Implements argument checking.
- */
-U_CFUNC int32_t
-ustrcase_map(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
- UStringCaseMapper *stringCaseMapper,
- icu::Edits *edits,
- UErrorCode &errorCode);
-
-/**
- * Common string case mapping implementation for old-fashioned u_strToXyz() functions
- * that allow the source string to overlap the destination buffer.
- * Implements argument checking and internally works with an intermediate buffer if necessary.
- */
-U_CFUNC int32_t
-ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
- UStringCaseMapper *stringCaseMapper,
- UErrorCode &errorCode);
-
-/**
- * UTF-8 string case mapping function type, used by ucasemap_mapUTF8().
- * UTF-8 version of UStringCaseMapper.
- * All error checking must be done.
- * The UCaseMap must be fully initialized, with locale and/or iter set as needed.
- */
-typedef void U_CALLCONV
-UTF8CaseMapper(int32_t caseLocale, uint32_t options,
-#if !UCONFIG_NO_BREAK_ITERATION
- icu::BreakIterator *iter,
-#endif
- const uint8_t *src, int32_t srcLength,
- icu::ByteSink &sink, icu::Edits *edits,
- UErrorCode &errorCode);
-
-#if !UCONFIG_NO_BREAK_ITERATION
-
-/** Implements UTF8CaseMapper. */
-U_CFUNC void U_CALLCONV
-ucasemap_internalUTF8ToTitle(int32_t caseLocale, uint32_t options,
- icu::BreakIterator *iter,
- const uint8_t *src, int32_t srcLength,
- icu::ByteSink &sink, icu::Edits *edits,
- UErrorCode &errorCode);
-
-#endif
-
-void
-ucasemap_mapUTF8(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
- const char *src, int32_t srcLength,
- UTF8CaseMapper *stringCaseMapper,
- icu::ByteSink &sink, icu::Edits *edits,
- UErrorCode &errorCode);
-
-/**
- * Implements argument checking and buffer handling
- * for UTF-8 string case mapping as a common function.
- */
-int32_t
-ucasemap_mapUTF8(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
- char *dest, int32_t destCapacity,
- const char *src, int32_t srcLength,
- UTF8CaseMapper *stringCaseMapper,
- icu::Edits *edits,
- UErrorCode &errorCode);
-
-U_NAMESPACE_BEGIN
-namespace GreekUpper {
-
-// Data bits.
-static const uint32_t UPPER_MASK = 0x3ff;
-static const uint32_t HAS_VOWEL = 0x1000;
-static const uint32_t HAS_YPOGEGRAMMENI = 0x2000;
-static const uint32_t HAS_ACCENT = 0x4000;
-static const uint32_t HAS_DIALYTIKA = 0x8000;
-// Further bits during data building and processing, not stored in the data map.
-static const uint32_t HAS_COMBINING_DIALYTIKA = 0x10000;
-static const uint32_t HAS_OTHER_GREEK_DIACRITIC = 0x20000;
-
-static const uint32_t HAS_VOWEL_AND_ACCENT = HAS_VOWEL | HAS_ACCENT;
-static const uint32_t HAS_VOWEL_AND_ACCENT_AND_DIALYTIKA =
- HAS_VOWEL_AND_ACCENT | HAS_DIALYTIKA;
-static const uint32_t HAS_EITHER_DIALYTIKA = HAS_DIALYTIKA | HAS_COMBINING_DIALYTIKA;
-
-// State bits.
-static const uint32_t AFTER_CASED = 1;
-static const uint32_t AFTER_VOWEL_WITH_ACCENT = 2;
-
-uint32_t getLetterData(UChar32 c);
-
-/**
- * Returns a non-zero value for each of the Greek combining diacritics
- * listed in The Unicode Standard, version 8, chapter 7.2 Greek,
- * plus some perispomeni look-alikes.
- */
-uint32_t getDiacriticData(UChar32 c);
-
-} // namespace GreekUpper
-U_NAMESPACE_END
-
-#endif // __cplusplus
-
-#endif // __UCASEMAP_IMP_H__
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// ucasemap_imp.h
+// created: 2017feb08 Markus W. Scherer
+
+#ifndef __UCASEMAP_IMP_H__
+#define __UCASEMAP_IMP_H__
+
+#include "unicode/utypes.h"
+#include "unicode/ucasemap.h"
+#include "unicode/uchar.h"
+#include "ucase.h"
+
+/**
+ * Bit mask for the titlecasing iterator options bit field.
+ * Currently only 3 out of 8 values are used:
+ * 0 (words), U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES.
+ * See stringoptions.h.
+ * @internal
+ */
+#define U_TITLECASE_ITERATOR_MASK 0xe0
+
+/**
+ * Bit mask for the titlecasing index adjustment options bit set.
+ * Currently two bits are defined:
+ * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED.
+ * See stringoptions.h.
+ * @internal
+ */
+#define U_TITLECASE_ADJUSTMENT_MASK 0x600
+
+/**
+ * Internal API, used by u_strcasecmp() etc.
+ * Compare strings case-insensitively,
+ * in code point order or code unit order.
+ */
+U_CFUNC int32_t
+u_strcmpFold(const UChar *s1, int32_t length1,
+ const UChar *s2, int32_t length2,
+ uint32_t options,
+ UErrorCode *pErrorCode);
+
+/**
+ * Internal API, used for detecting length of
+ * shared prefix case-insensitively.
+ * @param s1 input string 1
+ * @param length1 length of string 1, or -1 (NULL terminated)
+ * @param s2 input string 2
+ * @param length2 length of string 2, or -1 (NULL terminated)
+ * @param options compare options
+ * @param matchLen1 (output) length of partial prefix match in s1
+ * @param matchLen2 (output) length of partial prefix match in s2
+ * @param pErrorCode receives error status
+ */
+U_CAPI void
+u_caseInsensitivePrefixMatch(const UChar *s1, int32_t length1,
+ const UChar *s2, int32_t length2,
+ uint32_t options,
+ int32_t *matchLen1, int32_t *matchLen2,
+ UErrorCode *pErrorCode);
+
+#ifdef __cplusplus
+
+U_NAMESPACE_BEGIN
+
+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. */
+inline UBool ustrcase_checkTitleAdjustmentOptions(uint32_t options, UErrorCode &errorCode) {
+ 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 TRUE;
+}
+
+inline UBool ustrcase_isLNS(UChar32 c) {
+ // Letter, number, symbol,
+ // or a private use code point because those are typically used as letters or numbers.
+ // Consider modifier letters only if they are cased.
+ const uint32_t LNS = (U_GC_L_MASK|U_GC_N_MASK|U_GC_S_MASK|U_GC_CO_MASK) & ~U_GC_LM_MASK;
+ int gc = u_charType(c);
+ return (U_MASK(gc) & LNS) != 0 || (gc == U_MODIFIER_LETTER && ucase_getType(c) != UCASE_NONE);
+}
+
+#if !UCONFIG_NO_BREAK_ITERATION
+
+/** Returns nullptr if error. Pass in either locale or locID, not both. */
+U_CFUNC
+BreakIterator *ustrcase_getTitleBreakIterator(
+ const Locale *locale, const char *locID, uint32_t options, BreakIterator *iter,
+ LocalPointer<BreakIterator> &ownedIter, UErrorCode &errorCode);
+
+#endif
+
+U_NAMESPACE_END
+
+#include "unicode/unistr.h" // for UStringCaseMapper
+
+/*
+ * Internal string casing functions implementing
+ * ustring.h/ustrcase.cpp and UnicodeString case mapping functions.
+ */
+
+struct UCaseMap : public icu::UMemory {
+ /** Implements most of ucasemap_open(). */
+ UCaseMap(const char *localeID, uint32_t opts, UErrorCode *pErrorCode);
+ ~UCaseMap();
+
+#if !UCONFIG_NO_BREAK_ITERATION
+ icu::BreakIterator *iter; /* We adopt the iterator, so we own it. */
+#endif
+ char locale[32];
+ int32_t caseLocale;
+ uint32_t options;
+};
+
+#if UCONFIG_NO_BREAK_ITERATION
+# define UCASEMAP_BREAK_ITERATOR_PARAM
+# define UCASEMAP_BREAK_ITERATOR_UNUSED
+# define UCASEMAP_BREAK_ITERATOR
+# define UCASEMAP_BREAK_ITERATOR_NULL
+#else
+# define UCASEMAP_BREAK_ITERATOR_PARAM icu::BreakIterator *iter,
+# define UCASEMAP_BREAK_ITERATOR_UNUSED icu::BreakIterator *,
+# define UCASEMAP_BREAK_ITERATOR iter,
+# define UCASEMAP_BREAK_ITERATOR_NULL NULL,
+#endif
+
+U_CFUNC int32_t
+ustrcase_getCaseLocale(const char *locale);
+
+// TODO: swap src / dest if approved for new public api
+/** Implements UStringCaseMapper. */
+U_CFUNC int32_t U_CALLCONV
+ustrcase_internalToLower(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
+ UChar *dest, int32_t destCapacity,
+ const UChar *src, int32_t srcLength,
+ icu::Edits *edits,
+ UErrorCode &errorCode);
+
+/** Implements UStringCaseMapper. */
+U_CFUNC int32_t U_CALLCONV
+ustrcase_internalToUpper(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
+ UChar *dest, int32_t destCapacity,
+ const UChar *src, int32_t srcLength,
+ icu::Edits *edits,
+ UErrorCode &errorCode);
+
+#if !UCONFIG_NO_BREAK_ITERATION
+
+/** Implements UStringCaseMapper. */
+U_CFUNC int32_t U_CALLCONV
+ustrcase_internalToTitle(int32_t caseLocale, uint32_t options,
+ icu::BreakIterator *iter,
+ UChar *dest, int32_t destCapacity,
+ const UChar *src, int32_t srcLength,
+ icu::Edits *edits,
+ UErrorCode &errorCode);
+
+#endif
+
+/** Implements UStringCaseMapper. */
+U_CFUNC int32_t U_CALLCONV
+ustrcase_internalFold(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
+ UChar *dest, int32_t destCapacity,
+ const UChar *src, int32_t srcLength,
+ icu::Edits *edits,
+ UErrorCode &errorCode);
+
+/**
+ * Common string case mapping implementation for ucasemap_toXyz() and UnicodeString::toXyz().
+ * Implements argument checking.
+ */
+U_CFUNC int32_t
+ustrcase_map(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
+ UChar *dest, int32_t destCapacity,
+ const UChar *src, int32_t srcLength,
+ UStringCaseMapper *stringCaseMapper,
+ icu::Edits *edits,
+ UErrorCode &errorCode);
+
+/**
+ * Common string case mapping implementation for old-fashioned u_strToXyz() functions
+ * that allow the source string to overlap the destination buffer.
+ * Implements argument checking and internally works with an intermediate buffer if necessary.
+ */
+U_CFUNC int32_t
+ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
+ UChar *dest, int32_t destCapacity,
+ const UChar *src, int32_t srcLength,
+ UStringCaseMapper *stringCaseMapper,
+ UErrorCode &errorCode);
+
+/**
+ * UTF-8 string case mapping function type, used by ucasemap_mapUTF8().
+ * UTF-8 version of UStringCaseMapper.
+ * All error checking must be done.
+ * The UCaseMap must be fully initialized, with locale and/or iter set as needed.
+ */
+typedef void U_CALLCONV
+UTF8CaseMapper(int32_t caseLocale, uint32_t options,
+#if !UCONFIG_NO_BREAK_ITERATION
+ icu::BreakIterator *iter,
+#endif
+ const uint8_t *src, int32_t srcLength,
+ icu::ByteSink &sink, icu::Edits *edits,
+ UErrorCode &errorCode);
+
+#if !UCONFIG_NO_BREAK_ITERATION
+
+/** Implements UTF8CaseMapper. */
+U_CFUNC void U_CALLCONV
+ucasemap_internalUTF8ToTitle(int32_t caseLocale, uint32_t options,
+ icu::BreakIterator *iter,
+ const uint8_t *src, int32_t srcLength,
+ icu::ByteSink &sink, icu::Edits *edits,
+ UErrorCode &errorCode);
+
+#endif
+
+void
+ucasemap_mapUTF8(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
+ const char *src, int32_t srcLength,
+ UTF8CaseMapper *stringCaseMapper,
+ icu::ByteSink &sink, icu::Edits *edits,
+ UErrorCode &errorCode);
+
+/**
+ * Implements argument checking and buffer handling
+ * for UTF-8 string case mapping as a common function.
+ */
+int32_t
+ucasemap_mapUTF8(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
+ char *dest, int32_t destCapacity,
+ const char *src, int32_t srcLength,
+ UTF8CaseMapper *stringCaseMapper,
+ icu::Edits *edits,
+ UErrorCode &errorCode);
+
+U_NAMESPACE_BEGIN
+namespace GreekUpper {
+
+// Data bits.
+static const uint32_t UPPER_MASK = 0x3ff;
+static const uint32_t HAS_VOWEL = 0x1000;
+static const uint32_t HAS_YPOGEGRAMMENI = 0x2000;
+static const uint32_t HAS_ACCENT = 0x4000;
+static const uint32_t HAS_DIALYTIKA = 0x8000;
+// Further bits during data building and processing, not stored in the data map.
+static const uint32_t HAS_COMBINING_DIALYTIKA = 0x10000;
+static const uint32_t HAS_OTHER_GREEK_DIACRITIC = 0x20000;
+
+static const uint32_t HAS_VOWEL_AND_ACCENT = HAS_VOWEL | HAS_ACCENT;
+static const uint32_t HAS_VOWEL_AND_ACCENT_AND_DIALYTIKA =
+ HAS_VOWEL_AND_ACCENT | HAS_DIALYTIKA;
+static const uint32_t HAS_EITHER_DIALYTIKA = HAS_DIALYTIKA | HAS_COMBINING_DIALYTIKA;
+
+// State bits.
+static const uint32_t AFTER_CASED = 1;
+static const uint32_t AFTER_VOWEL_WITH_ACCENT = 2;
+
+uint32_t getLetterData(UChar32 c);
+
+/**
+ * Returns a non-zero value for each of the Greek combining diacritics
+ * listed in The Unicode Standard, version 8, chapter 7.2 Greek,
+ * plus some perispomeni look-alikes.
+ */
+uint32_t getDiacriticData(UChar32 c);
+
+} // namespace GreekUpper
+U_NAMESPACE_END
+
+#endif // __cplusplus
+
+#endif // __UCASEMAP_IMP_H__
diff --git a/contrib/libs/icu/common/ucasemap_titlecase_brkiter.cpp b/contrib/libs/icu/common/ucasemap_titlecase_brkiter.cpp
index 8d1ea1fcb5..c21dfb7698 100644
--- a/contrib/libs/icu/common/ucasemap_titlecase_brkiter.cpp
+++ b/contrib/libs/icu/common/ucasemap_titlecase_brkiter.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: ucasemap_titlecase_brkiter.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -23,79 +23,79 @@
#include "unicode/brkiter.h"
#include "unicode/ubrk.h"
-#include "unicode/casemap.h"
+#include "unicode/casemap.h"
#include "unicode/ucasemap.h"
#include "cmemory.h"
#include "ucase.h"
-#include "ucasemap_imp.h"
+#include "ucasemap_imp.h"
+
+U_NAMESPACE_BEGIN
+
+void CaseMap::utf8ToTitle(
+ const char *locale, uint32_t options, BreakIterator *iter,
+ StringPiece src, ByteSink &sink, Edits *edits,
+ UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) {
+ return;
+ }
+ UText utext = UTEXT_INITIALIZER;
+ utext_openUTF8(&utext, src.data(), src.length(), &errorCode);
+ LocalPointer<BreakIterator> ownedIter;
+ iter = ustrcase_getTitleBreakIterator(nullptr, locale, options, iter, ownedIter, errorCode);
+ if (iter == nullptr) {
+ utext_close(&utext);
+ return;
+ }
+ iter->setText(&utext, errorCode);
+ ucasemap_mapUTF8(
+ ustrcase_getCaseLocale(locale), options, iter,
+ src.data(), src.length(),
+ ucasemap_internalUTF8ToTitle, sink, edits, errorCode);
+ utext_close(&utext);
+}
+
+int32_t CaseMap::utf8ToTitle(
+ const char *locale, uint32_t options, BreakIterator *iter,
+ const char *src, int32_t srcLength,
+ char *dest, int32_t destCapacity, Edits *edits,
+ UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) {
+ return 0;
+ }
+ UText utext=UTEXT_INITIALIZER;
+ utext_openUTF8(&utext, src, srcLength, &errorCode);
+ LocalPointer<BreakIterator> ownedIter;
+ iter = ustrcase_getTitleBreakIterator(nullptr, locale, options, iter, ownedIter, errorCode);
+ if(iter==NULL) {
+ utext_close(&utext);
+ return 0;
+ }
+ iter->setText(&utext, errorCode);
+ int32_t length=ucasemap_mapUTF8(
+ ustrcase_getCaseLocale(locale), options, iter,
+ dest, destCapacity,
+ src, srcLength,
+ ucasemap_internalUTF8ToTitle, edits, errorCode);
+ utext_close(&utext);
+ return length;
+}
+
+U_NAMESPACE_END
-U_NAMESPACE_BEGIN
-
-void CaseMap::utf8ToTitle(
- const char *locale, uint32_t options, BreakIterator *iter,
- StringPiece src, ByteSink &sink, Edits *edits,
- UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) {
- return;
- }
- UText utext = UTEXT_INITIALIZER;
- utext_openUTF8(&utext, src.data(), src.length(), &errorCode);
- LocalPointer<BreakIterator> ownedIter;
- iter = ustrcase_getTitleBreakIterator(nullptr, locale, options, iter, ownedIter, errorCode);
- if (iter == nullptr) {
- utext_close(&utext);
- return;
- }
- iter->setText(&utext, errorCode);
- ucasemap_mapUTF8(
- ustrcase_getCaseLocale(locale), options, iter,
- src.data(), src.length(),
- ucasemap_internalUTF8ToTitle, sink, edits, errorCode);
- utext_close(&utext);
-}
-
-int32_t CaseMap::utf8ToTitle(
- const char *locale, uint32_t options, BreakIterator *iter,
- const char *src, int32_t srcLength,
- char *dest, int32_t destCapacity, Edits *edits,
- UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) {
- return 0;
- }
- UText utext=UTEXT_INITIALIZER;
- utext_openUTF8(&utext, src, srcLength, &errorCode);
- LocalPointer<BreakIterator> ownedIter;
- iter = ustrcase_getTitleBreakIterator(nullptr, locale, options, iter, ownedIter, errorCode);
- if(iter==NULL) {
- utext_close(&utext);
- return 0;
- }
- iter->setText(&utext, errorCode);
- int32_t length=ucasemap_mapUTF8(
- ustrcase_getCaseLocale(locale), options, iter,
- dest, destCapacity,
- src, srcLength,
- ucasemap_internalUTF8ToTitle, edits, errorCode);
- utext_close(&utext);
- return length;
-}
-
-U_NAMESPACE_END
-
U_NAMESPACE_USE
U_CAPI const UBreakIterator * U_EXPORT2
ucasemap_getBreakIterator(const UCaseMap *csm) {
- return reinterpret_cast<UBreakIterator *>(csm->iter);
+ return reinterpret_cast<UBreakIterator *>(csm->iter);
}
U_CAPI void U_EXPORT2
-ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode *pErrorCode) {
- if(U_FAILURE(*pErrorCode)) {
- return;
- }
- delete csm->iter;
- csm->iter=reinterpret_cast<BreakIterator *>(iterToAdopt);
+ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode *pErrorCode) {
+ if(U_FAILURE(*pErrorCode)) {
+ return;
+ }
+ delete csm->iter;
+ csm->iter=reinterpret_cast<BreakIterator *>(iterToAdopt);
}
U_CAPI int32_t U_EXPORT2
@@ -103,30 +103,30 @@ ucasemap_utf8ToTitle(UCaseMap *csm,
char *dest, int32_t destCapacity,
const char *src, int32_t srcLength,
UErrorCode *pErrorCode) {
- if (U_FAILURE(*pErrorCode)) {
- return 0;
- }
+ if (U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
UText utext=UTEXT_INITIALIZER;
utext_openUTF8(&utext, (const char *)src, srcLength, pErrorCode);
- if (U_FAILURE(*pErrorCode)) {
+ if (U_FAILURE(*pErrorCode)) {
return 0;
}
if(csm->iter==NULL) {
- LocalPointer<BreakIterator> ownedIter;
- BreakIterator *iter = ustrcase_getTitleBreakIterator(
- nullptr, csm->locale, csm->options, nullptr, ownedIter, *pErrorCode);
- if (iter == nullptr) {
- utext_close(&utext);
- return 0;
- }
- csm->iter = ownedIter.orphan();
+ LocalPointer<BreakIterator> ownedIter;
+ BreakIterator *iter = ustrcase_getTitleBreakIterator(
+ nullptr, csm->locale, csm->options, nullptr, ownedIter, *pErrorCode);
+ if (iter == nullptr) {
+ utext_close(&utext);
+ return 0;
+ }
+ csm->iter = ownedIter.orphan();
}
- csm->iter->setText(&utext, *pErrorCode);
- int32_t length=ucasemap_mapUTF8(
- csm->caseLocale, csm->options, csm->iter,
- dest, destCapacity,
- src, srcLength,
- ucasemap_internalUTF8ToTitle, NULL, *pErrorCode);
+ csm->iter->setText(&utext, *pErrorCode);
+ int32_t length=ucasemap_mapUTF8(
+ csm->caseLocale, csm->options, csm->iter,
+ dest, destCapacity,
+ src, srcLength,
+ ucasemap_internalUTF8ToTitle, NULL, *pErrorCode);
utext_close(&utext);
return length;
}
diff --git a/contrib/libs/icu/common/ucat.cpp b/contrib/libs/icu/common/ucat.cpp
index dea32fd670..dac56eeb5c 100644
--- a/contrib/libs/icu/common/ucat.cpp
+++ b/contrib/libs/icu/common/ucat.cpp
@@ -1,78 +1,78 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-**********************************************************************
-* Copyright (c) 2003, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
-* Author: Alan Liu
-* Created: March 19 2003
-* Since: ICU 2.6
-**********************************************************************
-*/
-#include "unicode/ucat.h"
-#include "unicode/ustring.h"
-#include "cstring.h"
-#include "uassert.h"
-
-/* Separator between set_num and msg_num */
-static const char SEPARATOR = '%';
-
-/* Maximum length of a set_num/msg_num key, incl. terminating zero.
- * Longest possible key is "-2147483648%-2147483648" */
-#define MAX_KEY_LEN (24)
-
-/**
- * Fill in buffer with a set_num/msg_num key string, given the numeric
- * values. Numeric values must be >= 0. Buffer must be of length
- * MAX_KEY_LEN or more.
- */
-static char*
-_catkey(char* buffer, int32_t set_num, int32_t msg_num) {
- int32_t i = 0;
- i = T_CString_integerToString(buffer, set_num, 10);
- buffer[i++] = SEPARATOR;
- T_CString_integerToString(buffer+i, msg_num, 10);
- return buffer;
-}
-
-U_CAPI u_nl_catd U_EXPORT2
-u_catopen(const char* name, const char* locale, UErrorCode* ec) {
- return (u_nl_catd) ures_open(name, locale, ec);
-}
-
-U_CAPI void U_EXPORT2
-u_catclose(u_nl_catd catd) {
- ures_close((UResourceBundle*) catd); /* may be NULL */
-}
-
-U_CAPI const UChar* U_EXPORT2
-u_catgets(u_nl_catd catd, int32_t set_num, int32_t msg_num,
- const UChar* s,
- int32_t* len, UErrorCode* ec) {
-
- char key[MAX_KEY_LEN];
- const UChar* result;
-
- if (ec == NULL || U_FAILURE(*ec)) {
- goto ERROR;
- }
-
- result = ures_getStringByKey((const UResourceBundle*) catd,
- _catkey(key, set_num, msg_num),
- len, ec);
- if (U_FAILURE(*ec)) {
- goto ERROR;
- }
-
- return result;
-
- ERROR:
- /* In case of any failure, return s */
- if (len != NULL) {
- *len = u_strlen(s);
- }
- return s;
-}
-
-/*eof*/
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+**********************************************************************
+* Copyright (c) 2003, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* Author: Alan Liu
+* Created: March 19 2003
+* Since: ICU 2.6
+**********************************************************************
+*/
+#include "unicode/ucat.h"
+#include "unicode/ustring.h"
+#include "cstring.h"
+#include "uassert.h"
+
+/* Separator between set_num and msg_num */
+static const char SEPARATOR = '%';
+
+/* Maximum length of a set_num/msg_num key, incl. terminating zero.
+ * Longest possible key is "-2147483648%-2147483648" */
+#define MAX_KEY_LEN (24)
+
+/**
+ * Fill in buffer with a set_num/msg_num key string, given the numeric
+ * values. Numeric values must be >= 0. Buffer must be of length
+ * MAX_KEY_LEN or more.
+ */
+static char*
+_catkey(char* buffer, int32_t set_num, int32_t msg_num) {
+ int32_t i = 0;
+ i = T_CString_integerToString(buffer, set_num, 10);
+ buffer[i++] = SEPARATOR;
+ T_CString_integerToString(buffer+i, msg_num, 10);
+ return buffer;
+}
+
+U_CAPI u_nl_catd U_EXPORT2
+u_catopen(const char* name, const char* locale, UErrorCode* ec) {
+ return (u_nl_catd) ures_open(name, locale, ec);
+}
+
+U_CAPI void U_EXPORT2
+u_catclose(u_nl_catd catd) {
+ ures_close((UResourceBundle*) catd); /* may be NULL */
+}
+
+U_CAPI const UChar* U_EXPORT2
+u_catgets(u_nl_catd catd, int32_t set_num, int32_t msg_num,
+ const UChar* s,
+ int32_t* len, UErrorCode* ec) {
+
+ char key[MAX_KEY_LEN];
+ const UChar* result;
+
+ if (ec == NULL || U_FAILURE(*ec)) {
+ goto ERROR;
+ }
+
+ result = ures_getStringByKey((const UResourceBundle*) catd,
+ _catkey(key, set_num, msg_num),
+ len, ec);
+ if (U_FAILURE(*ec)) {
+ goto ERROR;
+ }
+
+ return result;
+
+ ERROR:
+ /* In case of any failure, return s */
+ if (len != NULL) {
+ *len = u_strlen(s);
+ }
+ return s;
+}
+
+/*eof*/
diff --git a/contrib/libs/icu/common/uchar.cpp b/contrib/libs/icu/common/uchar.cpp
index 02119bf5a8..eb14e4c75d 100644
--- a/contrib/libs/icu/common/uchar.cpp
+++ b/contrib/libs/icu/common/uchar.cpp
@@ -1,730 +1,730 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-********************************************************************************
-* Copyright (C) 1996-2016, International Business Machines
-* Corporation and others. All Rights Reserved.
-********************************************************************************
-*
-* File UCHAR.C
-*
-* Modification History:
-*
-* Date Name Description
-* 04/02/97 aliu Creation.
-* 4/15/99 Madhu Updated all the function definitions for C Implementation
-* 5/20/99 Madhu Added the function u_getVersion()
-* 8/19/1999 srl Upgraded scripts to Unicode3.0
-* 11/11/1999 weiv added u_isalnum(), cleaned comments
-* 01/11/2000 helena Renamed u_getVersion to u_getUnicodeVersion.
-* 06/20/2000 helena OS/400 port changes; mostly typecast.
-******************************************************************************
-*/
-
-#include "unicode/utypes.h"
-#include "unicode/uchar.h"
-#include "unicode/uscript.h"
-#include "unicode/udata.h"
-#include "uassert.h"
-#include "cmemory.h"
-#include "ucln_cmn.h"
-#include "utrie2.h"
-#include "udataswp.h"
-#include "uprops.h"
-#include "ustr_imp.h"
-
-/* uchar_props_data.h is machine-generated by genprops --csource */
-#define INCLUDED_FROM_UCHAR_C
-#include "uchar_props_data.h"
-
-/* constants and macros for access to the data ------------------------------ */
-
-/* getting a uint32_t properties word from the data */
-#define GET_PROPS(c, result) ((result)=UTRIE2_GET16(&propsTrie, c))
-
-/* API functions ------------------------------------------------------------ */
-
-/* Gets the Unicode character's general category.*/
-U_CAPI int8_t U_EXPORT2
-u_charType(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return (int8_t)GET_CATEGORY(props);
-}
-
-/* Enumerate all code points with their general categories. */
-struct _EnumTypeCallback {
- UCharEnumTypeRange *enumRange;
- const void *context;
-};
-
-static uint32_t U_CALLCONV
-_enumTypeValue(const void *context, uint32_t value) {
- (void)context;
- return GET_CATEGORY(value);
-}
-
-static UBool U_CALLCONV
-_enumTypeRange(const void *context, UChar32 start, UChar32 end, uint32_t value) {
- /* just cast the value to UCharCategory */
- return ((struct _EnumTypeCallback *)context)->
- enumRange(((struct _EnumTypeCallback *)context)->context,
- start, end+1, (UCharCategory)value);
-}
-
-U_CAPI void U_EXPORT2
-u_enumCharTypes(UCharEnumTypeRange *enumRange, const void *context) {
- struct _EnumTypeCallback callback;
-
- if(enumRange==NULL) {
- return;
- }
-
- callback.enumRange=enumRange;
- callback.context=context;
- utrie2_enum(&propsTrie, _enumTypeValue, _enumTypeRange, &callback);
-}
-
-/* Checks if ch is a lower case letter.*/
-U_CAPI UBool U_EXPORT2
-u_islower(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)(GET_CATEGORY(props)==U_LOWERCASE_LETTER);
-}
-
-/* Checks if ch is an upper case letter.*/
-U_CAPI UBool U_EXPORT2
-u_isupper(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)(GET_CATEGORY(props)==U_UPPERCASE_LETTER);
-}
-
-/* Checks if ch is a title case letter; usually upper case letters.*/
-U_CAPI UBool U_EXPORT2
-u_istitle(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)(GET_CATEGORY(props)==U_TITLECASE_LETTER);
-}
-
-/* Checks if ch is a decimal digit. */
-U_CAPI UBool U_EXPORT2
-u_isdigit(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)(GET_CATEGORY(props)==U_DECIMAL_DIGIT_NUMBER);
-}
-
-U_CAPI UBool U_EXPORT2
-u_isxdigit(UChar32 c) {
- uint32_t props;
-
- /* check ASCII and Fullwidth ASCII a-fA-F */
- if(
- (c<=0x66 && c>=0x41 && (c<=0x46 || c>=0x61)) ||
- (c>=0xff21 && c<=0xff46 && (c<=0xff26 || c>=0xff41))
- ) {
- return TRUE;
- }
-
- GET_PROPS(c, props);
- return (UBool)(GET_CATEGORY(props)==U_DECIMAL_DIGIT_NUMBER);
-}
-
-/* Checks if the Unicode character is a letter.*/
-U_CAPI UBool U_EXPORT2
-u_isalpha(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)((CAT_MASK(props)&U_GC_L_MASK)!=0);
-}
-
-U_CAPI UBool U_EXPORT2
-u_isUAlphabetic(UChar32 c) {
- return (u_getUnicodeProperties(c, 1)&U_MASK(UPROPS_ALPHABETIC))!=0;
-}
-
-/* Checks if c is a letter or a decimal digit */
-U_CAPI UBool U_EXPORT2
-u_isalnum(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)((CAT_MASK(props)&(U_GC_L_MASK|U_GC_ND_MASK))!=0);
-}
-
-/**
- * Checks if c is alphabetic, or a decimal digit; implements UCHAR_POSIX_ALNUM.
- * @internal
- */
-U_CFUNC UBool
-u_isalnumPOSIX(UChar32 c) {
- return (UBool)(u_isUAlphabetic(c) || u_isdigit(c));
-}
-
-/* Checks if ch is a unicode character with assigned character type.*/
-U_CAPI UBool U_EXPORT2
-u_isdefined(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)(GET_CATEGORY(props)!=0);
-}
-
-/* Checks if the Unicode character is a base form character that can take a diacritic.*/
-U_CAPI UBool U_EXPORT2
-u_isbase(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)((CAT_MASK(props)&(U_GC_L_MASK|U_GC_N_MASK|U_GC_MC_MASK|U_GC_ME_MASK))!=0);
-}
-
-/* Checks if the Unicode character is a control character.*/
-U_CAPI UBool U_EXPORT2
-u_iscntrl(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)((CAT_MASK(props)&(U_GC_CC_MASK|U_GC_CF_MASK|U_GC_ZL_MASK|U_GC_ZP_MASK))!=0);
-}
-
-U_CAPI UBool U_EXPORT2
-u_isISOControl(UChar32 c) {
- return (uint32_t)c<=0x9f && (c<=0x1f || c>=0x7f);
-}
-
-/* Some control characters that are used as space. */
-#define IS_THAT_CONTROL_SPACE(c) \
- (c<=0x9f && ((c>=TAB && c<=CR) || (c>=0x1c && c <=0x1f) || c==NL))
-
-/* Java has decided that U+0085 New Line is not whitespace any more. */
-#define IS_THAT_ASCII_CONTROL_SPACE(c) \
- (c<=0x1f && c>=TAB && (c<=CR || c>=0x1c))
-
-/* Checks if the Unicode character is a space character.*/
-U_CAPI UBool U_EXPORT2
-u_isspace(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)((CAT_MASK(props)&U_GC_Z_MASK)!=0 || IS_THAT_CONTROL_SPACE(c));
-}
-
-U_CAPI UBool U_EXPORT2
-u_isJavaSpaceChar(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)((CAT_MASK(props)&U_GC_Z_MASK)!=0);
-}
-
-/* Checks if the Unicode character is a whitespace character.*/
-U_CAPI UBool U_EXPORT2
-u_isWhitespace(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)(
- ((CAT_MASK(props)&U_GC_Z_MASK)!=0 &&
- c!=NBSP && c!=FIGURESP && c!=NNBSP) || /* exclude no-break spaces */
- IS_THAT_ASCII_CONTROL_SPACE(c)
- );
-}
-
-U_CAPI UBool U_EXPORT2
-u_isblank(UChar32 c) {
- if((uint32_t)c<=0x9f) {
- return c==9 || c==0x20; /* TAB or SPACE */
- } else {
- /* Zs */
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)(GET_CATEGORY(props)==U_SPACE_SEPARATOR);
- }
-}
-
-U_CAPI UBool U_EXPORT2
-u_isUWhiteSpace(UChar32 c) {
- return (u_getUnicodeProperties(c, 1)&U_MASK(UPROPS_WHITE_SPACE))!=0;
-}
-
-/* Checks if the Unicode character is printable.*/
-U_CAPI UBool U_EXPORT2
-u_isprint(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- /* comparing ==0 returns FALSE for the categories mentioned */
- return (UBool)((CAT_MASK(props)&U_GC_C_MASK)==0);
-}
-
-/**
- * Checks if c is in \p{graph}\p{blank} - \p{cntrl}.
- * Implements UCHAR_POSIX_PRINT.
- * @internal
- */
-U_CFUNC UBool
-u_isprintPOSIX(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- /*
- * The only cntrl character in graph+blank is TAB (in blank).
- * Here we implement (blank-TAB)=Zs instead of calling u_isblank().
- */
- return (UBool)((GET_CATEGORY(props)==U_SPACE_SEPARATOR) || u_isgraphPOSIX(c));
-}
-
-U_CAPI UBool U_EXPORT2
-u_isgraph(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- /* comparing ==0 returns FALSE for the categories mentioned */
- return (UBool)((CAT_MASK(props)&
- (U_GC_CC_MASK|U_GC_CF_MASK|U_GC_CS_MASK|U_GC_CN_MASK|U_GC_Z_MASK))
- ==0);
-}
-
-/**
- * Checks if c is in
- * [^\p{space}\p{gc=Control}\p{gc=Surrogate}\p{gc=Unassigned}]
- * with space=\p{Whitespace} and Control=Cc.
- * Implements UCHAR_POSIX_GRAPH.
- * @internal
- */
-U_CFUNC UBool
-u_isgraphPOSIX(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- /* \p{space}\p{gc=Control} == \p{gc=Z}\p{Control} */
- /* comparing ==0 returns FALSE for the categories mentioned */
- return (UBool)((CAT_MASK(props)&
- (U_GC_CC_MASK|U_GC_CS_MASK|U_GC_CN_MASK|U_GC_Z_MASK))
- ==0);
-}
-
-U_CAPI UBool U_EXPORT2
-u_ispunct(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)((CAT_MASK(props)&U_GC_P_MASK)!=0);
-}
-
-/* Checks if the Unicode character can start a Unicode identifier.*/
-U_CAPI UBool U_EXPORT2
-u_isIDStart(UChar32 c) {
- /* same as u_isalpha() */
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)((CAT_MASK(props)&(U_GC_L_MASK|U_GC_NL_MASK))!=0);
-}
-
-/* Checks if the Unicode character can be a Unicode identifier part other than starting the
- identifier.*/
-U_CAPI UBool U_EXPORT2
-u_isIDPart(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)(
- (CAT_MASK(props)&
- (U_GC_ND_MASK|U_GC_NL_MASK|
- U_GC_L_MASK|
- U_GC_PC_MASK|U_GC_MC_MASK|U_GC_MN_MASK)
- )!=0 ||
- u_isIDIgnorable(c));
-}
-
-/*Checks if the Unicode character can be ignorable in a Java or Unicode identifier.*/
-U_CAPI UBool U_EXPORT2
-u_isIDIgnorable(UChar32 c) {
- if(c<=0x9f) {
- return u_isISOControl(c) && !IS_THAT_ASCII_CONTROL_SPACE(c);
- } else {
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)(GET_CATEGORY(props)==U_FORMAT_CHAR);
- }
-}
-
-/*Checks if the Unicode character can start a Java identifier.*/
-U_CAPI UBool U_EXPORT2
-u_isJavaIDStart(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)((CAT_MASK(props)&(U_GC_L_MASK|U_GC_SC_MASK|U_GC_PC_MASK))!=0);
-}
-
-/*Checks if the Unicode character can be a Java identifier part other than starting the
- * identifier.
- */
-U_CAPI UBool U_EXPORT2
-u_isJavaIDPart(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)(
- (CAT_MASK(props)&
- (U_GC_ND_MASK|U_GC_NL_MASK|
- U_GC_L_MASK|
- U_GC_SC_MASK|U_GC_PC_MASK|
- U_GC_MC_MASK|U_GC_MN_MASK)
- )!=0 ||
- u_isIDIgnorable(c));
-}
-
-U_CAPI int32_t U_EXPORT2
-u_charDigitValue(UChar32 c) {
- uint32_t props;
- int32_t value;
- GET_PROPS(c, props);
- value=(int32_t)GET_NUMERIC_TYPE_VALUE(props)-UPROPS_NTV_DECIMAL_START;
- if(value<=9) {
- return value;
- } else {
- return -1;
- }
-}
-
-U_CAPI double U_EXPORT2
-u_getNumericValue(UChar32 c) {
- uint32_t props;
- int32_t ntv;
- GET_PROPS(c, props);
- ntv=(int32_t)GET_NUMERIC_TYPE_VALUE(props);
-
- if(ntv==UPROPS_NTV_NONE) {
- return U_NO_NUMERIC_VALUE;
- } else if(ntv<UPROPS_NTV_DIGIT_START) {
- /* decimal digit */
- return ntv-UPROPS_NTV_DECIMAL_START;
- } else if(ntv<UPROPS_NTV_NUMERIC_START) {
- /* other digit */
- return ntv-UPROPS_NTV_DIGIT_START;
- } else if(ntv<UPROPS_NTV_FRACTION_START) {
- /* small integer */
- return ntv-UPROPS_NTV_NUMERIC_START;
- } else if(ntv<UPROPS_NTV_LARGE_START) {
- /* fraction */
- int32_t numerator=(ntv>>4)-12;
- int32_t denominator=(ntv&0xf)+1;
- return (double)numerator/denominator;
- } else if(ntv<UPROPS_NTV_BASE60_START) {
- /* large, single-significant-digit integer */
- double numValue;
- int32_t mant=(ntv>>5)-14;
- int32_t exp=(ntv&0x1f)+2;
- numValue=mant;
-
- /* multiply by 10^exp without math.h */
- while(exp>=4) {
- numValue*=10000.;
- exp-=4;
- }
- switch(exp) {
- case 3:
- numValue*=1000.;
- break;
- case 2:
- numValue*=100.;
- break;
- case 1:
- numValue*=10.;
- break;
- case 0:
- default:
- break;
- }
-
- return numValue;
- } else if(ntv<UPROPS_NTV_FRACTION20_START) {
- /* sexagesimal (base 60) integer */
- int32_t numValue=(ntv>>2)-0xbf;
- int32_t exp=(ntv&3)+1;
-
- switch(exp) {
- case 4:
- numValue*=60*60*60*60;
- break;
- case 3:
- numValue*=60*60*60;
- break;
- case 2:
- numValue*=60*60;
- break;
- case 1:
- numValue*=60;
- break;
- case 0:
- default:
- break;
- }
-
- return numValue;
- } else if(ntv<UPROPS_NTV_FRACTION32_START) {
- // fraction-20 e.g. 3/80
- int32_t frac20=ntv-UPROPS_NTV_FRACTION20_START; // 0..0x17
- int32_t numerator=2*(frac20&3)+1;
- int32_t denominator=20<<(frac20>>2);
- return (double)numerator/denominator;
- } else if(ntv<UPROPS_NTV_RESERVED_START) {
- // fraction-32 e.g. 3/64
- int32_t frac32=ntv-UPROPS_NTV_FRACTION32_START; // 0..15
- int32_t numerator=2*(frac32&3)+1;
- int32_t denominator=32<<(frac32>>2);
- return (double)numerator/denominator;
- } else {
- /* reserved */
- return U_NO_NUMERIC_VALUE;
- }
-}
-
-U_CAPI int32_t U_EXPORT2
-u_digit(UChar32 ch, int8_t radix) {
- int8_t value;
- if((uint8_t)(radix-2)<=(36-2)) {
- value=(int8_t)u_charDigitValue(ch);
- if(value<0) {
- /* ch is not a decimal digit, try latin letters */
- if(ch>=0x61 && ch<=0x7A) {
- value=(int8_t)(ch-0x57); /* ch - 'a' + 10 */
- } else if(ch>=0x41 && ch<=0x5A) {
- value=(int8_t)(ch-0x37); /* ch - 'A' + 10 */
- } else if(ch>=0xFF41 && ch<=0xFF5A) {
- value=(int8_t)(ch-0xFF37); /* fullwidth ASCII a-z */
- } else if(ch>=0xFF21 && ch<=0xFF3A) {
- value=(int8_t)(ch-0xFF17); /* fullwidth ASCII A-Z */
- }
- }
- } else {
- value=-1; /* invalid radix */
- }
- return (int8_t)((value<radix) ? value : -1);
-}
-
-U_CAPI UChar32 U_EXPORT2
-u_forDigit(int32_t digit, int8_t radix) {
- if((uint8_t)(radix-2)>(36-2) || (uint32_t)digit>=(uint32_t)radix) {
- return 0;
- } else if(digit<10) {
- return (UChar32)(0x30+digit);
- } else {
- return (UChar32)((0x61-10)+digit);
- }
-}
-
-/* miscellaneous, and support for uprops.cpp -------------------------------- */
-
-U_CAPI void U_EXPORT2
-u_getUnicodeVersion(UVersionInfo versionArray) {
- if(versionArray!=NULL) {
- uprv_memcpy(versionArray, dataVersion, U_MAX_VERSION_LENGTH);
- }
-}
-
-U_CFUNC uint32_t
-u_getMainProperties(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return props;
-}
-
-U_CFUNC uint32_t
-u_getUnicodeProperties(UChar32 c, int32_t column) {
- U_ASSERT(column>=0);
- if(column>=propsVectorsColumns) {
- return 0;
- } else {
- uint16_t vecIndex=UTRIE2_GET16(&propsVectorsTrie, c);
- return propsVectors[vecIndex+column];
- }
-}
-
-U_CFUNC int32_t
-uprv_getMaxValues(int32_t column) {
- switch(column) {
- case 0:
- return indexes[UPROPS_MAX_VALUES_INDEX];
- case 2:
- return indexes[UPROPS_MAX_VALUES_2_INDEX];
- default:
- return 0;
- }
-}
-
-U_CAPI void U_EXPORT2
-u_charAge(UChar32 c, UVersionInfo versionArray) {
- if(versionArray!=NULL) {
- uint32_t version=u_getUnicodeProperties(c, 0)>>UPROPS_AGE_SHIFT;
- versionArray[0]=(uint8_t)(version>>4);
- versionArray[1]=(uint8_t)(version&0xf);
- versionArray[2]=versionArray[3]=0;
- }
-}
-
-U_CAPI UScriptCode U_EXPORT2
-uscript_getScript(UChar32 c, UErrorCode *pErrorCode) {
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return USCRIPT_INVALID_CODE;
- }
- if((uint32_t)c>0x10ffff) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return USCRIPT_INVALID_CODE;
- }
- uint32_t scriptX=u_getUnicodeProperties(c, 0)&UPROPS_SCRIPT_X_MASK;
- uint32_t codeOrIndex=uprops_mergeScriptCodeOrIndex(scriptX);
- if(scriptX<UPROPS_SCRIPT_X_WITH_COMMON) {
- return (UScriptCode)codeOrIndex;
- } else if(scriptX<UPROPS_SCRIPT_X_WITH_INHERITED) {
- return USCRIPT_COMMON;
- } else if(scriptX<UPROPS_SCRIPT_X_WITH_OTHER) {
- return USCRIPT_INHERITED;
- } else {
- return (UScriptCode)scriptExtensions[codeOrIndex];
- }
-}
-
-U_CAPI UBool U_EXPORT2
-uscript_hasScript(UChar32 c, UScriptCode sc) {
- uint32_t scriptX=u_getUnicodeProperties(c, 0)&UPROPS_SCRIPT_X_MASK;
- uint32_t codeOrIndex=uprops_mergeScriptCodeOrIndex(scriptX);
- if(scriptX<UPROPS_SCRIPT_X_WITH_COMMON) {
- return sc==(UScriptCode)codeOrIndex;
- }
-
- const uint16_t *scx=scriptExtensions+codeOrIndex;
- if(scriptX>=UPROPS_SCRIPT_X_WITH_OTHER) {
- scx=scriptExtensions+scx[1];
- }
- uint32_t sc32=sc;
- if(sc32>0x7fff) {
- /* Guard against bogus input that would make us go past the Script_Extensions terminator. */
- return FALSE;
- }
- while(sc32>*scx) {
- ++scx;
- }
- return sc32==(*scx&0x7fff);
-}
-
-U_CAPI int32_t U_EXPORT2
-uscript_getScriptExtensions(UChar32 c,
- UScriptCode *scripts, int32_t capacity,
- UErrorCode *pErrorCode) {
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
- if(capacity<0 || (capacity>0 && scripts==NULL)) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
- uint32_t scriptX=u_getUnicodeProperties(c, 0)&UPROPS_SCRIPT_X_MASK;
- uint32_t codeOrIndex=uprops_mergeScriptCodeOrIndex(scriptX);
- if(scriptX<UPROPS_SCRIPT_X_WITH_COMMON) {
- if(capacity==0) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- } else {
- scripts[0]=(UScriptCode)codeOrIndex;
- }
- return 1;
- }
-
- const uint16_t *scx=scriptExtensions+codeOrIndex;
- if(scriptX>=UPROPS_SCRIPT_X_WITH_OTHER) {
- scx=scriptExtensions+scx[1];
- }
- int32_t length=0;
- uint16_t sx;
- do {
- sx=*scx++;
- if(length<capacity) {
- scripts[length]=(UScriptCode)(sx&0x7fff);
- }
- ++length;
- } while(sx<0x8000);
- if(length>capacity) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- return length;
-}
-
-U_CAPI UBlockCode U_EXPORT2
-ublock_getCode(UChar32 c) {
- return (UBlockCode)((u_getUnicodeProperties(c, 0)&UPROPS_BLOCK_MASK)>>UPROPS_BLOCK_SHIFT);
-}
-
-/* property starts for UnicodeSet ------------------------------------------- */
-
-static UBool U_CALLCONV
-_enumPropertyStartsRange(const void *context, UChar32 start, UChar32 end, uint32_t value) {
- /* add the start code point to the USet */
- const USetAdder *sa=(const USetAdder *)context;
- sa->add(sa->set, start);
- (void)end;
- (void)value;
- return TRUE;
-}
-
-#define USET_ADD_CP_AND_NEXT(sa, cp) sa->add(sa->set, cp); sa->add(sa->set, cp+1)
-
-U_CFUNC void U_EXPORT2
-uchar_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
- if(U_FAILURE(*pErrorCode)) {
- return;
- }
-
- /* add the start code point of each same-value range of the main trie */
- utrie2_enum(&propsTrie, NULL, _enumPropertyStartsRange, sa);
-
- /* add code points with hardcoded properties, plus the ones following them */
-
- /* add for u_isblank() */
- USET_ADD_CP_AND_NEXT(sa, TAB);
-
- /* add for IS_THAT_CONTROL_SPACE() */
- sa->add(sa->set, CR+1); /* range TAB..CR */
- sa->add(sa->set, 0x1c);
- sa->add(sa->set, 0x1f+1);
- USET_ADD_CP_AND_NEXT(sa, NL);
-
- /* add for u_isIDIgnorable() what was not added above */
- sa->add(sa->set, DEL); /* range DEL..NBSP-1, NBSP added below */
- sa->add(sa->set, HAIRSP);
- sa->add(sa->set, RLM+1);
- sa->add(sa->set, INHSWAP);
- sa->add(sa->set, NOMDIG+1);
- USET_ADD_CP_AND_NEXT(sa, ZWNBSP);
-
- /* add no-break spaces for u_isWhitespace() what was not added above */
- USET_ADD_CP_AND_NEXT(sa, NBSP);
- USET_ADD_CP_AND_NEXT(sa, FIGURESP);
- USET_ADD_CP_AND_NEXT(sa, NNBSP);
-
- /* add for u_digit() */
- sa->add(sa->set, U_a);
- sa->add(sa->set, U_z+1);
- sa->add(sa->set, U_A);
- sa->add(sa->set, U_Z+1);
- sa->add(sa->set, U_FW_a);
- sa->add(sa->set, U_FW_z+1);
- sa->add(sa->set, U_FW_A);
- sa->add(sa->set, U_FW_Z+1);
-
- /* add for u_isxdigit() */
- sa->add(sa->set, U_f+1);
- sa->add(sa->set, U_F+1);
- sa->add(sa->set, U_FW_f+1);
- sa->add(sa->set, U_FW_F+1);
-
- /* add for UCHAR_DEFAULT_IGNORABLE_CODE_POINT what was not added above */
- sa->add(sa->set, WJ); /* range WJ..NOMDIG */
- sa->add(sa->set, 0xfff0);
- sa->add(sa->set, 0xfffb+1);
- sa->add(sa->set, 0xe0000);
- sa->add(sa->set, 0xe0fff+1);
-
- /* add for UCHAR_GRAPHEME_BASE and others */
- USET_ADD_CP_AND_NEXT(sa, CGJ);
-}
-
-U_CFUNC void U_EXPORT2
-upropsvec_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
- if(U_FAILURE(*pErrorCode)) {
- return;
- }
-
- /* add the start code point of each same-value range of the properties vectors trie */
- utrie2_enum(&propsVectorsTrie, NULL, _enumPropertyStartsRange, sa);
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+********************************************************************************
+* Copyright (C) 1996-2016, International Business Machines
+* Corporation and others. All Rights Reserved.
+********************************************************************************
+*
+* File UCHAR.C
+*
+* Modification History:
+*
+* Date Name Description
+* 04/02/97 aliu Creation.
+* 4/15/99 Madhu Updated all the function definitions for C Implementation
+* 5/20/99 Madhu Added the function u_getVersion()
+* 8/19/1999 srl Upgraded scripts to Unicode3.0
+* 11/11/1999 weiv added u_isalnum(), cleaned comments
+* 01/11/2000 helena Renamed u_getVersion to u_getUnicodeVersion.
+* 06/20/2000 helena OS/400 port changes; mostly typecast.
+******************************************************************************
+*/
+
+#include "unicode/utypes.h"
+#include "unicode/uchar.h"
+#include "unicode/uscript.h"
+#include "unicode/udata.h"
+#include "uassert.h"
+#include "cmemory.h"
+#include "ucln_cmn.h"
+#include "utrie2.h"
+#include "udataswp.h"
+#include "uprops.h"
+#include "ustr_imp.h"
+
+/* uchar_props_data.h is machine-generated by genprops --csource */
+#define INCLUDED_FROM_UCHAR_C
+#include "uchar_props_data.h"
+
+/* constants and macros for access to the data ------------------------------ */
+
+/* getting a uint32_t properties word from the data */
+#define GET_PROPS(c, result) ((result)=UTRIE2_GET16(&propsTrie, c))
+
+/* API functions ------------------------------------------------------------ */
+
+/* Gets the Unicode character's general category.*/
+U_CAPI int8_t U_EXPORT2
+u_charType(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (int8_t)GET_CATEGORY(props);
+}
+
+/* Enumerate all code points with their general categories. */
+struct _EnumTypeCallback {
+ UCharEnumTypeRange *enumRange;
+ const void *context;
+};
+
+static uint32_t U_CALLCONV
+_enumTypeValue(const void *context, uint32_t value) {
+ (void)context;
+ return GET_CATEGORY(value);
+}
+
+static UBool U_CALLCONV
+_enumTypeRange(const void *context, UChar32 start, UChar32 end, uint32_t value) {
+ /* just cast the value to UCharCategory */
+ return ((struct _EnumTypeCallback *)context)->
+ enumRange(((struct _EnumTypeCallback *)context)->context,
+ start, end+1, (UCharCategory)value);
+}
+
+U_CAPI void U_EXPORT2
+u_enumCharTypes(UCharEnumTypeRange *enumRange, const void *context) {
+ struct _EnumTypeCallback callback;
+
+ if(enumRange==NULL) {
+ return;
+ }
+
+ callback.enumRange=enumRange;
+ callback.context=context;
+ utrie2_enum(&propsTrie, _enumTypeValue, _enumTypeRange, &callback);
+}
+
+/* Checks if ch is a lower case letter.*/
+U_CAPI UBool U_EXPORT2
+u_islower(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)(GET_CATEGORY(props)==U_LOWERCASE_LETTER);
+}
+
+/* Checks if ch is an upper case letter.*/
+U_CAPI UBool U_EXPORT2
+u_isupper(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)(GET_CATEGORY(props)==U_UPPERCASE_LETTER);
+}
+
+/* Checks if ch is a title case letter; usually upper case letters.*/
+U_CAPI UBool U_EXPORT2
+u_istitle(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)(GET_CATEGORY(props)==U_TITLECASE_LETTER);
+}
+
+/* Checks if ch is a decimal digit. */
+U_CAPI UBool U_EXPORT2
+u_isdigit(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)(GET_CATEGORY(props)==U_DECIMAL_DIGIT_NUMBER);
+}
+
+U_CAPI UBool U_EXPORT2
+u_isxdigit(UChar32 c) {
+ uint32_t props;
+
+ /* check ASCII and Fullwidth ASCII a-fA-F */
+ if(
+ (c<=0x66 && c>=0x41 && (c<=0x46 || c>=0x61)) ||
+ (c>=0xff21 && c<=0xff46 && (c<=0xff26 || c>=0xff41))
+ ) {
+ return TRUE;
+ }
+
+ GET_PROPS(c, props);
+ return (UBool)(GET_CATEGORY(props)==U_DECIMAL_DIGIT_NUMBER);
+}
+
+/* Checks if the Unicode character is a letter.*/
+U_CAPI UBool U_EXPORT2
+u_isalpha(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)((CAT_MASK(props)&U_GC_L_MASK)!=0);
+}
+
+U_CAPI UBool U_EXPORT2
+u_isUAlphabetic(UChar32 c) {
+ return (u_getUnicodeProperties(c, 1)&U_MASK(UPROPS_ALPHABETIC))!=0;
+}
+
+/* Checks if c is a letter or a decimal digit */
+U_CAPI UBool U_EXPORT2
+u_isalnum(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)((CAT_MASK(props)&(U_GC_L_MASK|U_GC_ND_MASK))!=0);
+}
+
+/**
+ * Checks if c is alphabetic, or a decimal digit; implements UCHAR_POSIX_ALNUM.
+ * @internal
+ */
+U_CFUNC UBool
+u_isalnumPOSIX(UChar32 c) {
+ return (UBool)(u_isUAlphabetic(c) || u_isdigit(c));
+}
+
+/* Checks if ch is a unicode character with assigned character type.*/
+U_CAPI UBool U_EXPORT2
+u_isdefined(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)(GET_CATEGORY(props)!=0);
+}
+
+/* Checks if the Unicode character is a base form character that can take a diacritic.*/
+U_CAPI UBool U_EXPORT2
+u_isbase(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)((CAT_MASK(props)&(U_GC_L_MASK|U_GC_N_MASK|U_GC_MC_MASK|U_GC_ME_MASK))!=0);
+}
+
+/* Checks if the Unicode character is a control character.*/
+U_CAPI UBool U_EXPORT2
+u_iscntrl(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)((CAT_MASK(props)&(U_GC_CC_MASK|U_GC_CF_MASK|U_GC_ZL_MASK|U_GC_ZP_MASK))!=0);
+}
+
+U_CAPI UBool U_EXPORT2
+u_isISOControl(UChar32 c) {
+ return (uint32_t)c<=0x9f && (c<=0x1f || c>=0x7f);
+}
+
+/* Some control characters that are used as space. */
+#define IS_THAT_CONTROL_SPACE(c) \
+ (c<=0x9f && ((c>=TAB && c<=CR) || (c>=0x1c && c <=0x1f) || c==NL))
+
+/* Java has decided that U+0085 New Line is not whitespace any more. */
+#define IS_THAT_ASCII_CONTROL_SPACE(c) \
+ (c<=0x1f && c>=TAB && (c<=CR || c>=0x1c))
+
+/* Checks if the Unicode character is a space character.*/
+U_CAPI UBool U_EXPORT2
+u_isspace(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)((CAT_MASK(props)&U_GC_Z_MASK)!=0 || IS_THAT_CONTROL_SPACE(c));
+}
+
+U_CAPI UBool U_EXPORT2
+u_isJavaSpaceChar(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)((CAT_MASK(props)&U_GC_Z_MASK)!=0);
+}
+
+/* Checks if the Unicode character is a whitespace character.*/
+U_CAPI UBool U_EXPORT2
+u_isWhitespace(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)(
+ ((CAT_MASK(props)&U_GC_Z_MASK)!=0 &&
+ c!=NBSP && c!=FIGURESP && c!=NNBSP) || /* exclude no-break spaces */
+ IS_THAT_ASCII_CONTROL_SPACE(c)
+ );
+}
+
+U_CAPI UBool U_EXPORT2
+u_isblank(UChar32 c) {
+ if((uint32_t)c<=0x9f) {
+ return c==9 || c==0x20; /* TAB or SPACE */
+ } else {
+ /* Zs */
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)(GET_CATEGORY(props)==U_SPACE_SEPARATOR);
+ }
+}
+
+U_CAPI UBool U_EXPORT2
+u_isUWhiteSpace(UChar32 c) {
+ return (u_getUnicodeProperties(c, 1)&U_MASK(UPROPS_WHITE_SPACE))!=0;
+}
+
+/* Checks if the Unicode character is printable.*/
+U_CAPI UBool U_EXPORT2
+u_isprint(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ /* comparing ==0 returns FALSE for the categories mentioned */
+ return (UBool)((CAT_MASK(props)&U_GC_C_MASK)==0);
+}
+
+/**
+ * Checks if c is in \p{graph}\p{blank} - \p{cntrl}.
+ * Implements UCHAR_POSIX_PRINT.
+ * @internal
+ */
+U_CFUNC UBool
+u_isprintPOSIX(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ /*
+ * The only cntrl character in graph+blank is TAB (in blank).
+ * Here we implement (blank-TAB)=Zs instead of calling u_isblank().
+ */
+ return (UBool)((GET_CATEGORY(props)==U_SPACE_SEPARATOR) || u_isgraphPOSIX(c));
+}
+
+U_CAPI UBool U_EXPORT2
+u_isgraph(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ /* comparing ==0 returns FALSE for the categories mentioned */
+ return (UBool)((CAT_MASK(props)&
+ (U_GC_CC_MASK|U_GC_CF_MASK|U_GC_CS_MASK|U_GC_CN_MASK|U_GC_Z_MASK))
+ ==0);
+}
+
+/**
+ * Checks if c is in
+ * [^\p{space}\p{gc=Control}\p{gc=Surrogate}\p{gc=Unassigned}]
+ * with space=\p{Whitespace} and Control=Cc.
+ * Implements UCHAR_POSIX_GRAPH.
+ * @internal
+ */
+U_CFUNC UBool
+u_isgraphPOSIX(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ /* \p{space}\p{gc=Control} == \p{gc=Z}\p{Control} */
+ /* comparing ==0 returns FALSE for the categories mentioned */
+ return (UBool)((CAT_MASK(props)&
+ (U_GC_CC_MASK|U_GC_CS_MASK|U_GC_CN_MASK|U_GC_Z_MASK))
+ ==0);
+}
+
+U_CAPI UBool U_EXPORT2
+u_ispunct(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)((CAT_MASK(props)&U_GC_P_MASK)!=0);
+}
+
+/* Checks if the Unicode character can start a Unicode identifier.*/
+U_CAPI UBool U_EXPORT2
+u_isIDStart(UChar32 c) {
+ /* same as u_isalpha() */
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)((CAT_MASK(props)&(U_GC_L_MASK|U_GC_NL_MASK))!=0);
+}
+
+/* Checks if the Unicode character can be a Unicode identifier part other than starting the
+ identifier.*/
+U_CAPI UBool U_EXPORT2
+u_isIDPart(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)(
+ (CAT_MASK(props)&
+ (U_GC_ND_MASK|U_GC_NL_MASK|
+ U_GC_L_MASK|
+ U_GC_PC_MASK|U_GC_MC_MASK|U_GC_MN_MASK)
+ )!=0 ||
+ u_isIDIgnorable(c));
+}
+
+/*Checks if the Unicode character can be ignorable in a Java or Unicode identifier.*/
+U_CAPI UBool U_EXPORT2
+u_isIDIgnorable(UChar32 c) {
+ if(c<=0x9f) {
+ return u_isISOControl(c) && !IS_THAT_ASCII_CONTROL_SPACE(c);
+ } else {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)(GET_CATEGORY(props)==U_FORMAT_CHAR);
+ }
+}
+
+/*Checks if the Unicode character can start a Java identifier.*/
+U_CAPI UBool U_EXPORT2
+u_isJavaIDStart(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)((CAT_MASK(props)&(U_GC_L_MASK|U_GC_SC_MASK|U_GC_PC_MASK))!=0);
+}
+
+/*Checks if the Unicode character can be a Java identifier part other than starting the
+ * identifier.
+ */
+U_CAPI UBool U_EXPORT2
+u_isJavaIDPart(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return (UBool)(
+ (CAT_MASK(props)&
+ (U_GC_ND_MASK|U_GC_NL_MASK|
+ U_GC_L_MASK|
+ U_GC_SC_MASK|U_GC_PC_MASK|
+ U_GC_MC_MASK|U_GC_MN_MASK)
+ )!=0 ||
+ u_isIDIgnorable(c));
+}
+
+U_CAPI int32_t U_EXPORT2
+u_charDigitValue(UChar32 c) {
+ uint32_t props;
+ int32_t value;
+ GET_PROPS(c, props);
+ value=(int32_t)GET_NUMERIC_TYPE_VALUE(props)-UPROPS_NTV_DECIMAL_START;
+ if(value<=9) {
+ return value;
+ } else {
+ return -1;
+ }
+}
+
+U_CAPI double U_EXPORT2
+u_getNumericValue(UChar32 c) {
+ uint32_t props;
+ int32_t ntv;
+ GET_PROPS(c, props);
+ ntv=(int32_t)GET_NUMERIC_TYPE_VALUE(props);
+
+ if(ntv==UPROPS_NTV_NONE) {
+ return U_NO_NUMERIC_VALUE;
+ } else if(ntv<UPROPS_NTV_DIGIT_START) {
+ /* decimal digit */
+ return ntv-UPROPS_NTV_DECIMAL_START;
+ } else if(ntv<UPROPS_NTV_NUMERIC_START) {
+ /* other digit */
+ return ntv-UPROPS_NTV_DIGIT_START;
+ } else if(ntv<UPROPS_NTV_FRACTION_START) {
+ /* small integer */
+ return ntv-UPROPS_NTV_NUMERIC_START;
+ } else if(ntv<UPROPS_NTV_LARGE_START) {
+ /* fraction */
+ int32_t numerator=(ntv>>4)-12;
+ int32_t denominator=(ntv&0xf)+1;
+ return (double)numerator/denominator;
+ } else if(ntv<UPROPS_NTV_BASE60_START) {
+ /* large, single-significant-digit integer */
+ double numValue;
+ int32_t mant=(ntv>>5)-14;
+ int32_t exp=(ntv&0x1f)+2;
+ numValue=mant;
+
+ /* multiply by 10^exp without math.h */
+ while(exp>=4) {
+ numValue*=10000.;
+ exp-=4;
+ }
+ switch(exp) {
+ case 3:
+ numValue*=1000.;
+ break;
+ case 2:
+ numValue*=100.;
+ break;
+ case 1:
+ numValue*=10.;
+ break;
+ case 0:
+ default:
+ break;
+ }
+
+ return numValue;
+ } else if(ntv<UPROPS_NTV_FRACTION20_START) {
+ /* sexagesimal (base 60) integer */
+ int32_t numValue=(ntv>>2)-0xbf;
+ int32_t exp=(ntv&3)+1;
+
+ switch(exp) {
+ case 4:
+ numValue*=60*60*60*60;
+ break;
+ case 3:
+ numValue*=60*60*60;
+ break;
+ case 2:
+ numValue*=60*60;
+ break;
+ case 1:
+ numValue*=60;
+ break;
+ case 0:
+ default:
+ break;
+ }
+
+ return numValue;
+ } else if(ntv<UPROPS_NTV_FRACTION32_START) {
+ // fraction-20 e.g. 3/80
+ int32_t frac20=ntv-UPROPS_NTV_FRACTION20_START; // 0..0x17
+ int32_t numerator=2*(frac20&3)+1;
+ int32_t denominator=20<<(frac20>>2);
+ return (double)numerator/denominator;
+ } else if(ntv<UPROPS_NTV_RESERVED_START) {
+ // fraction-32 e.g. 3/64
+ int32_t frac32=ntv-UPROPS_NTV_FRACTION32_START; // 0..15
+ int32_t numerator=2*(frac32&3)+1;
+ int32_t denominator=32<<(frac32>>2);
+ return (double)numerator/denominator;
+ } else {
+ /* reserved */
+ return U_NO_NUMERIC_VALUE;
+ }
+}
+
+U_CAPI int32_t U_EXPORT2
+u_digit(UChar32 ch, int8_t radix) {
+ int8_t value;
+ if((uint8_t)(radix-2)<=(36-2)) {
+ value=(int8_t)u_charDigitValue(ch);
+ if(value<0) {
+ /* ch is not a decimal digit, try latin letters */
+ if(ch>=0x61 && ch<=0x7A) {
+ value=(int8_t)(ch-0x57); /* ch - 'a' + 10 */
+ } else if(ch>=0x41 && ch<=0x5A) {
+ value=(int8_t)(ch-0x37); /* ch - 'A' + 10 */
+ } else if(ch>=0xFF41 && ch<=0xFF5A) {
+ value=(int8_t)(ch-0xFF37); /* fullwidth ASCII a-z */
+ } else if(ch>=0xFF21 && ch<=0xFF3A) {
+ value=(int8_t)(ch-0xFF17); /* fullwidth ASCII A-Z */
+ }
+ }
+ } else {
+ value=-1; /* invalid radix */
+ }
+ return (int8_t)((value<radix) ? value : -1);
+}
+
+U_CAPI UChar32 U_EXPORT2
+u_forDigit(int32_t digit, int8_t radix) {
+ if((uint8_t)(radix-2)>(36-2) || (uint32_t)digit>=(uint32_t)radix) {
+ return 0;
+ } else if(digit<10) {
+ return (UChar32)(0x30+digit);
+ } else {
+ return (UChar32)((0x61-10)+digit);
+ }
+}
+
+/* miscellaneous, and support for uprops.cpp -------------------------------- */
+
+U_CAPI void U_EXPORT2
+u_getUnicodeVersion(UVersionInfo versionArray) {
+ if(versionArray!=NULL) {
+ uprv_memcpy(versionArray, dataVersion, U_MAX_VERSION_LENGTH);
+ }
+}
+
+U_CFUNC uint32_t
+u_getMainProperties(UChar32 c) {
+ uint32_t props;
+ GET_PROPS(c, props);
+ return props;
+}
+
+U_CFUNC uint32_t
+u_getUnicodeProperties(UChar32 c, int32_t column) {
+ U_ASSERT(column>=0);
+ if(column>=propsVectorsColumns) {
+ return 0;
+ } else {
+ uint16_t vecIndex=UTRIE2_GET16(&propsVectorsTrie, c);
+ return propsVectors[vecIndex+column];
+ }
+}
+
+U_CFUNC int32_t
+uprv_getMaxValues(int32_t column) {
+ switch(column) {
+ case 0:
+ return indexes[UPROPS_MAX_VALUES_INDEX];
+ case 2:
+ return indexes[UPROPS_MAX_VALUES_2_INDEX];
+ default:
+ return 0;
+ }
+}
+
+U_CAPI void U_EXPORT2
+u_charAge(UChar32 c, UVersionInfo versionArray) {
+ if(versionArray!=NULL) {
+ uint32_t version=u_getUnicodeProperties(c, 0)>>UPROPS_AGE_SHIFT;
+ versionArray[0]=(uint8_t)(version>>4);
+ versionArray[1]=(uint8_t)(version&0xf);
+ versionArray[2]=versionArray[3]=0;
+ }
+}
+
+U_CAPI UScriptCode U_EXPORT2
+uscript_getScript(UChar32 c, UErrorCode *pErrorCode) {
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return USCRIPT_INVALID_CODE;
+ }
+ if((uint32_t)c>0x10ffff) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return USCRIPT_INVALID_CODE;
+ }
+ uint32_t scriptX=u_getUnicodeProperties(c, 0)&UPROPS_SCRIPT_X_MASK;
+ uint32_t codeOrIndex=uprops_mergeScriptCodeOrIndex(scriptX);
+ if(scriptX<UPROPS_SCRIPT_X_WITH_COMMON) {
+ return (UScriptCode)codeOrIndex;
+ } else if(scriptX<UPROPS_SCRIPT_X_WITH_INHERITED) {
+ return USCRIPT_COMMON;
+ } else if(scriptX<UPROPS_SCRIPT_X_WITH_OTHER) {
+ return USCRIPT_INHERITED;
+ } else {
+ return (UScriptCode)scriptExtensions[codeOrIndex];
+ }
+}
+
+U_CAPI UBool U_EXPORT2
+uscript_hasScript(UChar32 c, UScriptCode sc) {
+ uint32_t scriptX=u_getUnicodeProperties(c, 0)&UPROPS_SCRIPT_X_MASK;
+ uint32_t codeOrIndex=uprops_mergeScriptCodeOrIndex(scriptX);
+ if(scriptX<UPROPS_SCRIPT_X_WITH_COMMON) {
+ return sc==(UScriptCode)codeOrIndex;
+ }
+
+ const uint16_t *scx=scriptExtensions+codeOrIndex;
+ if(scriptX>=UPROPS_SCRIPT_X_WITH_OTHER) {
+ scx=scriptExtensions+scx[1];
+ }
+ uint32_t sc32=sc;
+ if(sc32>0x7fff) {
+ /* Guard against bogus input that would make us go past the Script_Extensions terminator. */
+ return FALSE;
+ }
+ while(sc32>*scx) {
+ ++scx;
+ }
+ return sc32==(*scx&0x7fff);
+}
+
+U_CAPI int32_t U_EXPORT2
+uscript_getScriptExtensions(UChar32 c,
+ UScriptCode *scripts, int32_t capacity,
+ UErrorCode *pErrorCode) {
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ if(capacity<0 || (capacity>0 && scripts==NULL)) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+ uint32_t scriptX=u_getUnicodeProperties(c, 0)&UPROPS_SCRIPT_X_MASK;
+ uint32_t codeOrIndex=uprops_mergeScriptCodeOrIndex(scriptX);
+ if(scriptX<UPROPS_SCRIPT_X_WITH_COMMON) {
+ if(capacity==0) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ } else {
+ scripts[0]=(UScriptCode)codeOrIndex;
+ }
+ return 1;
+ }
+
+ const uint16_t *scx=scriptExtensions+codeOrIndex;
+ if(scriptX>=UPROPS_SCRIPT_X_WITH_OTHER) {
+ scx=scriptExtensions+scx[1];
+ }
+ int32_t length=0;
+ uint16_t sx;
+ do {
+ sx=*scx++;
+ if(length<capacity) {
+ scripts[length]=(UScriptCode)(sx&0x7fff);
+ }
+ ++length;
+ } while(sx<0x8000);
+ if(length>capacity) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ return length;
+}
+
+U_CAPI UBlockCode U_EXPORT2
+ublock_getCode(UChar32 c) {
+ return (UBlockCode)((u_getUnicodeProperties(c, 0)&UPROPS_BLOCK_MASK)>>UPROPS_BLOCK_SHIFT);
+}
+
+/* property starts for UnicodeSet ------------------------------------------- */
+
+static UBool U_CALLCONV
+_enumPropertyStartsRange(const void *context, UChar32 start, UChar32 end, uint32_t value) {
+ /* add the start code point to the USet */
+ const USetAdder *sa=(const USetAdder *)context;
+ sa->add(sa->set, start);
+ (void)end;
+ (void)value;
+ return TRUE;
+}
+
+#define USET_ADD_CP_AND_NEXT(sa, cp) sa->add(sa->set, cp); sa->add(sa->set, cp+1)
+
+U_CFUNC void U_EXPORT2
+uchar_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
+ if(U_FAILURE(*pErrorCode)) {
+ return;
+ }
+
+ /* add the start code point of each same-value range of the main trie */
+ utrie2_enum(&propsTrie, NULL, _enumPropertyStartsRange, sa);
+
+ /* add code points with hardcoded properties, plus the ones following them */
+
+ /* add for u_isblank() */
+ USET_ADD_CP_AND_NEXT(sa, TAB);
+
+ /* add for IS_THAT_CONTROL_SPACE() */
+ sa->add(sa->set, CR+1); /* range TAB..CR */
+ sa->add(sa->set, 0x1c);
+ sa->add(sa->set, 0x1f+1);
+ USET_ADD_CP_AND_NEXT(sa, NL);
+
+ /* add for u_isIDIgnorable() what was not added above */
+ sa->add(sa->set, DEL); /* range DEL..NBSP-1, NBSP added below */
+ sa->add(sa->set, HAIRSP);
+ sa->add(sa->set, RLM+1);
+ sa->add(sa->set, INHSWAP);
+ sa->add(sa->set, NOMDIG+1);
+ USET_ADD_CP_AND_NEXT(sa, ZWNBSP);
+
+ /* add no-break spaces for u_isWhitespace() what was not added above */
+ USET_ADD_CP_AND_NEXT(sa, NBSP);
+ USET_ADD_CP_AND_NEXT(sa, FIGURESP);
+ USET_ADD_CP_AND_NEXT(sa, NNBSP);
+
+ /* add for u_digit() */
+ sa->add(sa->set, U_a);
+ sa->add(sa->set, U_z+1);
+ sa->add(sa->set, U_A);
+ sa->add(sa->set, U_Z+1);
+ sa->add(sa->set, U_FW_a);
+ sa->add(sa->set, U_FW_z+1);
+ sa->add(sa->set, U_FW_A);
+ sa->add(sa->set, U_FW_Z+1);
+
+ /* add for u_isxdigit() */
+ sa->add(sa->set, U_f+1);
+ sa->add(sa->set, U_F+1);
+ sa->add(sa->set, U_FW_f+1);
+ sa->add(sa->set, U_FW_F+1);
+
+ /* add for UCHAR_DEFAULT_IGNORABLE_CODE_POINT what was not added above */
+ sa->add(sa->set, WJ); /* range WJ..NOMDIG */
+ sa->add(sa->set, 0xfff0);
+ sa->add(sa->set, 0xfffb+1);
+ sa->add(sa->set, 0xe0000);
+ sa->add(sa->set, 0xe0fff+1);
+
+ /* add for UCHAR_GRAPHEME_BASE and others */
+ USET_ADD_CP_AND_NEXT(sa, CGJ);
+}
+
+U_CFUNC void U_EXPORT2
+upropsvec_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
+ if(U_FAILURE(*pErrorCode)) {
+ return;
+ }
+
+ /* add the start code point of each same-value range of the properties vectors trie */
+ utrie2_enum(&propsVectorsTrie, NULL, _enumPropertyStartsRange, sa);
+}
diff --git a/contrib/libs/icu/common/uchar_props_data.h b/contrib/libs/icu/common/uchar_props_data.h
index d6c5c5ee3f..9a78918204 100644
--- a/contrib/libs/icu/common/uchar_props_data.h
+++ b/contrib/libs/icu/common/uchar_props_data.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// Copyright (C) 1999-2016, International Business Machines
@@ -11,146 +11,146 @@
#ifdef INCLUDED_FROM_UCHAR_C
-static const UVersionInfo dataVersion={0xd,0,0,0};
+static const UVersionInfo dataVersion={0xd,0,0,0};
-static const uint16_t propsTrie_index[22276]={
-0x46d,0x475,0x47d,0x485,0x49d,0x4a5,0x4ad,0x4b5,0x4bd,0x4c5,0x4cb,0x4d3,0x4db,0x4e3,0x4eb,0x4f3,
-0x4f9,0x501,0x509,0x511,0x514,0x51c,0x524,0x52c,0x534,0x53c,0x538,0x540,0x548,0x550,0x555,0x55d,
-0x565,0x56d,0x571,0x579,0x581,0x589,0x591,0x599,0x595,0x59d,0x5a2,0x5aa,0x5b0,0x5b8,0x5c0,0x5c8,
-0x5d0,0x5d8,0x5e0,0x5e8,0x5ed,0x5f5,0x5f8,0x600,0x608,0x610,0x616,0x61e,0x61d,0x625,0x62d,0x635,
-0x645,0x63d,0x64d,0x655,0x48d,0x665,0x66b,0x65d,0x67b,0x67d,0x685,0x673,0x695,0x69b,0x6a3,0x68d,
-0x6b3,0x6b9,0x6c1,0x6ab,0x6d1,0x6d7,0x6df,0x6c9,0x6ef,0x6f5,0x6fd,0x6e7,0x70d,0x715,0x71d,0x705,
-0x72d,0x733,0x73b,0x725,0x74b,0x751,0x759,0x743,0x769,0x76e,0x776,0x761,0x786,0x78d,0x795,0x77e,
-0x619,0x79d,0x7a5,0x48d,0x7ad,0x7b4,0x7bc,0x48d,0x7c4,0x7cc,0x7d4,0x7d9,0x7e1,0x7e8,0x7f0,0x48d,
-0x5d8,0x7f8,0x800,0x808,0x810,0x565,0x820,0x818,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x828,0x5d8,0x830,0x834,0x83c,0x5d8,0x842,0x5d8,0x848,0x850,0x858,0x565,0x565,0x860,
-0x868,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x86d,0x875,0x5d8,0x5d8,0x87d,0x885,0x88d,0x895,0x89d,0x5d8,0x8a5,0x8ad,0x8b5,
-0x8c5,0x5d8,0x8cd,0x8cf,0x8d7,0x8bd,0x5d8,0x8da,0x8ee,0x8e2,0x8ea,0x8f6,0x5d8,0x8fe,0x904,0x90c,
-0x914,0x5d8,0x924,0x92c,0x934,0x91c,0x944,0x48d,0x94c,0x94f,0x957,0x93c,0x967,0x95f,0x5d8,0x96e,
-0x5d8,0x97d,0x976,0x985,0x98d,0x991,0x999,0x9a1,0x50d,0x9a9,0x9ac,0x9b2,0x9b9,0x9ac,0x534,0x9c1,
-0x4bd,0x4bd,0x4bd,0x4bd,0x9c9,0x4bd,0x4bd,0x4bd,0x9d9,0x9e1,0x9e9,0x9f1,0x9f9,0x9fd,0xa05,0x9d1,
-0xa1d,0xa25,0xa0d,0xa15,0xa2d,0xa35,0xa3d,0xa45,0xa5d,0xa4d,0xa55,0xa65,0xa6d,0xa7c,0xa81,0xa74,
-0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa91,0xa99,0x90c,0xa9c,0xaa4,0xaab,0xab0,0xab8,
-0x90c,0xabf,0xabe,0xacf,0xad2,0x90c,0x90c,0xac7,0x90c,0x90c,0x90c,0x90c,0x90c,0xae1,0xae9,0xad9,
-0x90c,0x90c,0x90c,0xaee,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0xaf4,0xafc,0x90c,0xb04,0xb0b,
-0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0xa89,0xa89,0xa89,0xa89,0xb13,0xa89,0xb1a,0xb21,
-0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0x90c,0xb29,0xb30,0xb34,0xb3a,0x90c,0x90c,0x90c,
-0x565,0xb4a,0xb42,0xb52,0x4bd,0x4bd,0x4bd,0xb5a,0x50d,0xb62,0x5d8,0xb68,0xb78,0xb70,0xb70,0x534,
-0xb80,0xb88,0xb90,0x48d,0xb98,0x90c,0x90c,0xb9f,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0xba7,0xbad,
-0xbbd,0xbb5,0x619,0x5d8,0xbc5,0x868,0x5d8,0xbcd,0xbd5,0xbd9,0x5d8,0x5d8,0xbde,0x5d8,0x90c,0xbe5,
-0xab9,0xbed,0xbf3,0x90c,0xbed,0xbfb,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,
-0xc03,0x5d8,0x5d8,0x5d8,0xc0b,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0xc11,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc16,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x90c,0x90c,
-0xc1e,0x5d8,0xc21,0x5d8,0xc29,0xc2f,0xc37,0xc3f,0xc44,0x5d8,0x5d8,0xc48,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc4f,0x5d8,0xc56,0xc5c,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc64,0x5d8,0x5d8,0x5d8,0xc6c,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc6e,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc75,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0xc7c,0x5d8,0x5d8,0x5d8,0xc83,0xc8b,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc90,0x5d8,0x5d8,0xc98,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc9c,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc9f,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xca2,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0xca8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0xcb0,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0xcb5,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xcba,0x5d8,0x5d8,0x5d8,0xcbf,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0xcc7,0xcce,0xcd2,0x5d8,0x5d8,0x5d8,0xcd9,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x8ce,
-0xce7,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0xcdf,0x90c,0xcef,0x985,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0xcf4,0xcfc,0x4bd,0xd0c,0xd04,0x5d8,0x5d8,0xd14,0xd1c,0xd2c,0x4bd,0xd31,0xd39,0xd3f,0xd47,0xd24,
-0xd4f,0xd57,0x5d8,0xd5f,0xd6f,0xd72,0xd67,0xd7a,0x62d,0xd82,0xd89,0x8ce,0x67b,0xd99,0xd91,0xda1,
-0x5d8,0xda9,0xdb1,0xdb9,0x5d8,0xdc1,0xdc9,0xdd1,0xdd9,0xde1,0xde5,0xded,0x50d,0x50d,0x5d8,0xdf5,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xdfd,0xe09,0xe01,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,
-0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,
-0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
-0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
-0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
-0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
-0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
-0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
-0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
-0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
-0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
-0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
-0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
-0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
-0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0x5d8,0x5d8,0x5d8,0xe21,0x5d8,0xcda,0xe28,0xe2d,
-0x5d8,0x5d8,0x5d8,0xe35,0x5d8,0x5d8,0x8d9,0x48d,0xe4b,0xe3b,0xe43,0x5d8,0x5d8,0xe53,0xe5b,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xe60,0xe68,0x5d8,0xe6c,0x5d8,0xe72,0xe76,
-0xe7e,0xe86,0xe8d,0xe95,0x5d8,0x5d8,0x5d8,0xe9b,0xeb3,0x47d,0xebb,0xec3,0xec8,0x8ee,0xea3,0xeab,
-0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,
-0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,
-0x1234,0x1234,0x1274,0x12b4,0x12f4,0x132c,0x136c,0x13ac,0x13e4,0x1424,0x1450,0x1490,0x14d0,0x14e0,0x1520,0x1554,
-0x1594,0x15c4,0x1604,0x1644,0x1654,0x1688,0x16c0,0x1700,0x1740,0x1780,0x17b4,0x17e0,0x1820,0x1858,0x1874,0x18b4,
-0xa80,0xac0,0xb00,0xb40,0xb80,0xa40,0xbc0,0xa40,0xbe2,0xa40,0xa40,0xa40,0xa40,0xc22,0x1db,0x1db,
-0xc62,0xca2,0xa40,0xa40,0xa40,0xa40,0xce2,0xd02,0xa40,0xa40,0xd42,0xd82,0xdc2,0xe02,0xe42,0xe82,
-0xec2,0xef9,0x1db,0x1db,0xf1d,0xf51,0x1db,0xf79,0x1db,0x1db,0x1db,0x1db,0xfa6,0x1db,0x1db,0x1db,
-0x1db,0x1db,0x1db,0x1db,0xfba,0x1db,0xff2,0x1032,0x1db,0x103d,0x1db,0x1db,0x1db,0x1073,0xa40,0x10b3,
-0x1db,0x1db,0x10f3,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
+static const uint16_t propsTrie_index[22276]={
+0x46d,0x475,0x47d,0x485,0x49d,0x4a5,0x4ad,0x4b5,0x4bd,0x4c5,0x4cb,0x4d3,0x4db,0x4e3,0x4eb,0x4f3,
+0x4f9,0x501,0x509,0x511,0x514,0x51c,0x524,0x52c,0x534,0x53c,0x538,0x540,0x548,0x550,0x555,0x55d,
+0x565,0x56d,0x571,0x579,0x581,0x589,0x591,0x599,0x595,0x59d,0x5a2,0x5aa,0x5b0,0x5b8,0x5c0,0x5c8,
+0x5d0,0x5d8,0x5e0,0x5e8,0x5ed,0x5f5,0x5f8,0x600,0x608,0x610,0x616,0x61e,0x61d,0x625,0x62d,0x635,
+0x645,0x63d,0x64d,0x655,0x48d,0x665,0x66b,0x65d,0x67b,0x67d,0x685,0x673,0x695,0x69b,0x6a3,0x68d,
+0x6b3,0x6b9,0x6c1,0x6ab,0x6d1,0x6d7,0x6df,0x6c9,0x6ef,0x6f5,0x6fd,0x6e7,0x70d,0x715,0x71d,0x705,
+0x72d,0x733,0x73b,0x725,0x74b,0x751,0x759,0x743,0x769,0x76e,0x776,0x761,0x786,0x78d,0x795,0x77e,
+0x619,0x79d,0x7a5,0x48d,0x7ad,0x7b4,0x7bc,0x48d,0x7c4,0x7cc,0x7d4,0x7d9,0x7e1,0x7e8,0x7f0,0x48d,
+0x5d8,0x7f8,0x800,0x808,0x810,0x565,0x820,0x818,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x828,0x5d8,0x830,0x834,0x83c,0x5d8,0x842,0x5d8,0x848,0x850,0x858,0x565,0x565,0x860,
+0x868,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x86d,0x875,0x5d8,0x5d8,0x87d,0x885,0x88d,0x895,0x89d,0x5d8,0x8a5,0x8ad,0x8b5,
+0x8c5,0x5d8,0x8cd,0x8cf,0x8d7,0x8bd,0x5d8,0x8da,0x8ee,0x8e2,0x8ea,0x8f6,0x5d8,0x8fe,0x904,0x90c,
+0x914,0x5d8,0x924,0x92c,0x934,0x91c,0x944,0x48d,0x94c,0x94f,0x957,0x93c,0x967,0x95f,0x5d8,0x96e,
+0x5d8,0x97d,0x976,0x985,0x98d,0x991,0x999,0x9a1,0x50d,0x9a9,0x9ac,0x9b2,0x9b9,0x9ac,0x534,0x9c1,
+0x4bd,0x4bd,0x4bd,0x4bd,0x9c9,0x4bd,0x4bd,0x4bd,0x9d9,0x9e1,0x9e9,0x9f1,0x9f9,0x9fd,0xa05,0x9d1,
+0xa1d,0xa25,0xa0d,0xa15,0xa2d,0xa35,0xa3d,0xa45,0xa5d,0xa4d,0xa55,0xa65,0xa6d,0xa7c,0xa81,0xa74,
+0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa91,0xa99,0x90c,0xa9c,0xaa4,0xaab,0xab0,0xab8,
+0x90c,0xabf,0xabe,0xacf,0xad2,0x90c,0x90c,0xac7,0x90c,0x90c,0x90c,0x90c,0x90c,0xae1,0xae9,0xad9,
+0x90c,0x90c,0x90c,0xaee,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0xaf4,0xafc,0x90c,0xb04,0xb0b,
+0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0xa89,0xa89,0xa89,0xa89,0xb13,0xa89,0xb1a,0xb21,
+0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0x90c,0xb29,0xb30,0xb34,0xb3a,0x90c,0x90c,0x90c,
+0x565,0xb4a,0xb42,0xb52,0x4bd,0x4bd,0x4bd,0xb5a,0x50d,0xb62,0x5d8,0xb68,0xb78,0xb70,0xb70,0x534,
+0xb80,0xb88,0xb90,0x48d,0xb98,0x90c,0x90c,0xb9f,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0xba7,0xbad,
+0xbbd,0xbb5,0x619,0x5d8,0xbc5,0x868,0x5d8,0xbcd,0xbd5,0xbd9,0x5d8,0x5d8,0xbde,0x5d8,0x90c,0xbe5,
+0xab9,0xbed,0xbf3,0x90c,0xbed,0xbfb,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,
+0xc03,0x5d8,0x5d8,0x5d8,0xc0b,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0xc11,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc16,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x90c,0x90c,
+0xc1e,0x5d8,0xc21,0x5d8,0xc29,0xc2f,0xc37,0xc3f,0xc44,0x5d8,0x5d8,0xc48,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc4f,0x5d8,0xc56,0xc5c,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc64,0x5d8,0x5d8,0x5d8,0xc6c,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc6e,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc75,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0xc7c,0x5d8,0x5d8,0x5d8,0xc83,0xc8b,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc90,0x5d8,0x5d8,0xc98,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc9c,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc9f,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xca2,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0xca8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0xcb0,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0xcb5,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xcba,0x5d8,0x5d8,0x5d8,0xcbf,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0xcc7,0xcce,0xcd2,0x5d8,0x5d8,0x5d8,0xcd9,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x8ce,
+0xce7,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0xcdf,0x90c,0xcef,0x985,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0xcf4,0xcfc,0x4bd,0xd0c,0xd04,0x5d8,0x5d8,0xd14,0xd1c,0xd2c,0x4bd,0xd31,0xd39,0xd3f,0xd47,0xd24,
+0xd4f,0xd57,0x5d8,0xd5f,0xd6f,0xd72,0xd67,0xd7a,0x62d,0xd82,0xd89,0x8ce,0x67b,0xd99,0xd91,0xda1,
+0x5d8,0xda9,0xdb1,0xdb9,0x5d8,0xdc1,0xdc9,0xdd1,0xdd9,0xde1,0xde5,0xded,0x50d,0x50d,0x5d8,0xdf5,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xdfd,0xe09,0xe01,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,
+0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,
+0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
+0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
+0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
+0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
+0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
+0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
+0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
+0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
+0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
+0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
+0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
+0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
+0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0x5d8,0x5d8,0x5d8,0xe21,0x5d8,0xcda,0xe28,0xe2d,
+0x5d8,0x5d8,0x5d8,0xe35,0x5d8,0x5d8,0x8d9,0x48d,0xe4b,0xe3b,0xe43,0x5d8,0x5d8,0xe53,0xe5b,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xe60,0xe68,0x5d8,0xe6c,0x5d8,0xe72,0xe76,
+0xe7e,0xe86,0xe8d,0xe95,0x5d8,0x5d8,0x5d8,0xe9b,0xeb3,0x47d,0xebb,0xec3,0xec8,0x8ee,0xea3,0xeab,
+0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,
+0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,
+0x1234,0x1234,0x1274,0x12b4,0x12f4,0x132c,0x136c,0x13ac,0x13e4,0x1424,0x1450,0x1490,0x14d0,0x14e0,0x1520,0x1554,
+0x1594,0x15c4,0x1604,0x1644,0x1654,0x1688,0x16c0,0x1700,0x1740,0x1780,0x17b4,0x17e0,0x1820,0x1858,0x1874,0x18b4,
+0xa80,0xac0,0xb00,0xb40,0xb80,0xa40,0xbc0,0xa40,0xbe2,0xa40,0xa40,0xa40,0xa40,0xc22,0x1db,0x1db,
+0xc62,0xca2,0xa40,0xa40,0xa40,0xa40,0xce2,0xd02,0xa40,0xa40,0xd42,0xd82,0xdc2,0xe02,0xe42,0xe82,
+0xec2,0xef9,0x1db,0x1db,0xf1d,0xf51,0x1db,0xf79,0x1db,0x1db,0x1db,0x1db,0xfa6,0x1db,0x1db,0x1db,
+0x1db,0x1db,0x1db,0x1db,0xfba,0x1db,0xff2,0x1032,0x1db,0x103d,0x1db,0x1db,0x1db,0x1073,0xa40,0x10b3,
+0x1db,0x1db,0x10f3,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
@@ -172,343 +172,343 @@ static const uint16_t propsTrie_index[22276]={
0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
-0x1133,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
+0x1133,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,
-0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x1173,
+0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x1173,
0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,
-0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x1173,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0xed0,0xed7,0xedf,0x48d,0x5d8,0x5d8,0x5d8,0xee7,0xef7,0xeef,0xf0e,0xeff,0xf06,0xf16,0xf1a,0xf1e,
-0x48d,0x48d,0x48d,0x48d,0x8ce,0x5d8,0xf26,0xf2e,0x5d8,0xf36,0xf3e,0xf42,0xf4a,0x5d8,0xf52,0x48d,
-0x565,0x56f,0xf5a,0x5d8,0xf5e,0xf66,0xf76,0xf6e,0x5d8,0xf7e,0x5d8,0xf85,0x48d,0x48d,0x48d,0x48d,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xb78,0x8da,0xe72,0x48d,0x48d,0x48d,0x48d,
-0xf95,0xf8d,0xf98,0xfa0,0x8ee,0xfa8,0x48d,0xfb0,0xfb8,0xfc0,0x48d,0x48d,0x5d8,0xfd0,0xfd8,0xfc8,
-0xfe8,0xfef,0xfe0,0xff7,0xfff,0x48d,0x100f,0x1007,0x5d8,0x1012,0x101a,0x1022,0x102a,0x1032,0x48d,0x48d,
-0x5d8,0x5d8,0x103a,0x48d,0x565,0x1042,0x50d,0x104a,0x5d8,0x1052,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x105a,0x5d8,0x1062,0x48d,0x48d,0x106a,0x1072,0x1079,0x48d,0x48d,0xe68,0x1081,0xb78,
-0x1091,0x60e,0x1099,0x1089,0x967,0x10a1,0x10a9,0x10af,0x10c7,0x10b7,0x10bf,0x10cb,0x967,0x10db,0x10d3,0x10e3,
-0x10f3,0x10eb,0x48d,0x48d,0x10fa,0x1102,0x630,0x110a,0x111a,0x1120,0x1128,0x1112,0x48d,0x48d,0x48d,0x48d,
-0x5d8,0x1130,0x1138,0x1140,0x5d8,0x1148,0x1150,0x48d,0x48d,0x48d,0x48d,0x48d,0x5d8,0x1158,0x1160,0x48d,
-0x5d8,0x1168,0x1170,0x1178,0x5d8,0x1188,0x1180,0x48d,0x848,0x1190,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x5d8,0x1198,0x48d,0x48d,0x48d,0x565,0x50d,0x11a0,0x11b0,0x11b6,0x11a8,0x48d,0x48d,0x11c6,0x11ca,0x11be,
-0x11e2,0x11d2,0x11da,0x5d8,0x11f2,0x11ea,0x5d8,0x8cf,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x1208,0x120d,0x11fa,0x1202,0x121d,0x1215,0x48d,0x48d,0x122c,0x1230,0x1224,0x1240,0x1238,0x1180,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x1244,0x48d,0x48d,0x48d,0x48d,0x48d,0x124b,0x125b,0x1253,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x8d9,0x48d,0x48d,0x48d,
-0x126b,0x1273,0x127b,0x1263,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x1283,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x128b,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x1293,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x8cf,0x8ee,0x129b,0x48d,0x48d,0xe68,0x12a3,0x5d8,0x12b3,0x12bb,0x12c3,0x12ab,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x565,0x50d,0x12cb,0x48d,0x48d,0x48d,0x5d8,0x5d8,0x12d3,0x12d8,0x12de,0x48d,
-0x48d,0x12e6,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x12ee,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x8da,0x48d,0x103a,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x8ee,0x48d,0x12f4,0x12fb,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xe01,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x1301,0x1306,0x130e,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0xba7,0x90c,0x1316,0x90c,0x131d,0x1325,0x132b,
-0x90c,0x1331,0x90c,0x90c,0x1339,0x48d,0x48d,0x48d,0x48d,0x1341,0x90c,0x90c,0xabb,0x1349,0x48d,0x48d,
-0x48d,0x48d,0x1359,0x1360,0x1365,0x136b,0x1373,0x137b,0x1383,0x135d,0x138b,0x1393,0x139b,0x13a0,0x1372,0x1359,
-0x1360,0x135c,0x136b,0x13a8,0x135a,0x13ab,0x135d,0x13b3,0x13bb,0x13c3,0x13ca,0x13b6,0x13be,0x13c6,0x13cd,0x13b9,
-0x13d5,0x1351,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,
-0x90c,0x90c,0x534,0x13e5,0x534,0x13ec,0x13f3,0x13dd,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x13fa,0x1402,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x5d8,0x1412,0x140a,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x5d8,0x141a,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x1422,0x48d,0x565,0x1432,0x142a,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x143a,0x144a,0x1442,0x48d,0x48d,0x145a,0x1452,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x146a,0x1472,0x147a,0x1482,0x148a,0x1492,0x48d,0x1462,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x90c,0x149a,0x90c,0x90c,0xb9f,0x149f,0x14a3,0xba7,0x14ab,0x90c,0x90c,0x90c,0x90c,0xba9,
-0x48d,0x14b3,0x14bb,0x14bf,0x14c7,0x14cf,0x48d,0x48d,0x48d,0x48d,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,
-0x90c,0x14d7,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,
-0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x14df,0x14e7,0x90c,0x90c,0x90c,0xb9f,0x90c,0x90c,
-0x14ef,0x14f7,0x149a,0x90c,0x14ff,0x90c,0x1507,0x150c,0x48d,0x48d,0x90c,0x90c,0x90c,0x1514,0x90c,0x90c,
-0x151b,0x90c,0x90c,0x90c,0xb9f,0x1520,0x1528,0x152e,0x1533,0x48d,0x90c,0x90c,0x90c,0x90c,0x153b,0x90c,
-0xabe,0x117c,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x1543,0x5d8,0x5d8,0x154a,0x5d8,0x5d8,0x5d8,0x1552,0x5d8,0x155a,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0xc80,0x5d8,0x5d8,0x1562,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x156a,0x1572,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xcbf,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x1579,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x1580,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x1587,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0xf5e,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x158b,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0xf5e,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x1066,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x1590,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x1598,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0xf5e,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
-0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x655,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x15a8,0x15a0,0x15a0,0x15a0,0x48d,0x48d,0x48d,0x48d,0x534,0x534,0x534,0x534,0x534,
-0x534,0x534,0x15b0,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
-0x48d,0x48d,0x48d,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
-0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
-0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
-0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
-0xe19,0xe19,0x15b8,0x46c,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,
+0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x1173,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0xed0,0xed7,0xedf,0x48d,0x5d8,0x5d8,0x5d8,0xee7,0xef7,0xeef,0xf0e,0xeff,0xf06,0xf16,0xf1a,0xf1e,
+0x48d,0x48d,0x48d,0x48d,0x8ce,0x5d8,0xf26,0xf2e,0x5d8,0xf36,0xf3e,0xf42,0xf4a,0x5d8,0xf52,0x48d,
+0x565,0x56f,0xf5a,0x5d8,0xf5e,0xf66,0xf76,0xf6e,0x5d8,0xf7e,0x5d8,0xf85,0x48d,0x48d,0x48d,0x48d,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xb78,0x8da,0xe72,0x48d,0x48d,0x48d,0x48d,
+0xf95,0xf8d,0xf98,0xfa0,0x8ee,0xfa8,0x48d,0xfb0,0xfb8,0xfc0,0x48d,0x48d,0x5d8,0xfd0,0xfd8,0xfc8,
+0xfe8,0xfef,0xfe0,0xff7,0xfff,0x48d,0x100f,0x1007,0x5d8,0x1012,0x101a,0x1022,0x102a,0x1032,0x48d,0x48d,
+0x5d8,0x5d8,0x103a,0x48d,0x565,0x1042,0x50d,0x104a,0x5d8,0x1052,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x105a,0x5d8,0x1062,0x48d,0x48d,0x106a,0x1072,0x1079,0x48d,0x48d,0xe68,0x1081,0xb78,
+0x1091,0x60e,0x1099,0x1089,0x967,0x10a1,0x10a9,0x10af,0x10c7,0x10b7,0x10bf,0x10cb,0x967,0x10db,0x10d3,0x10e3,
+0x10f3,0x10eb,0x48d,0x48d,0x10fa,0x1102,0x630,0x110a,0x111a,0x1120,0x1128,0x1112,0x48d,0x48d,0x48d,0x48d,
+0x5d8,0x1130,0x1138,0x1140,0x5d8,0x1148,0x1150,0x48d,0x48d,0x48d,0x48d,0x48d,0x5d8,0x1158,0x1160,0x48d,
+0x5d8,0x1168,0x1170,0x1178,0x5d8,0x1188,0x1180,0x48d,0x848,0x1190,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x5d8,0x1198,0x48d,0x48d,0x48d,0x565,0x50d,0x11a0,0x11b0,0x11b6,0x11a8,0x48d,0x48d,0x11c6,0x11ca,0x11be,
+0x11e2,0x11d2,0x11da,0x5d8,0x11f2,0x11ea,0x5d8,0x8cf,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x1208,0x120d,0x11fa,0x1202,0x121d,0x1215,0x48d,0x48d,0x122c,0x1230,0x1224,0x1240,0x1238,0x1180,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x1244,0x48d,0x48d,0x48d,0x48d,0x48d,0x124b,0x125b,0x1253,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x8d9,0x48d,0x48d,0x48d,
+0x126b,0x1273,0x127b,0x1263,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x1283,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x128b,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x1293,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x8cf,0x8ee,0x129b,0x48d,0x48d,0xe68,0x12a3,0x5d8,0x12b3,0x12bb,0x12c3,0x12ab,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x565,0x50d,0x12cb,0x48d,0x48d,0x48d,0x5d8,0x5d8,0x12d3,0x12d8,0x12de,0x48d,
+0x48d,0x12e6,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x12ee,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x8da,0x48d,0x103a,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x8ee,0x48d,0x12f4,0x12fb,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xe01,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x1301,0x1306,0x130e,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0xba7,0x90c,0x1316,0x90c,0x131d,0x1325,0x132b,
+0x90c,0x1331,0x90c,0x90c,0x1339,0x48d,0x48d,0x48d,0x48d,0x1341,0x90c,0x90c,0xabb,0x1349,0x48d,0x48d,
+0x48d,0x48d,0x1359,0x1360,0x1365,0x136b,0x1373,0x137b,0x1383,0x135d,0x138b,0x1393,0x139b,0x13a0,0x1372,0x1359,
+0x1360,0x135c,0x136b,0x13a8,0x135a,0x13ab,0x135d,0x13b3,0x13bb,0x13c3,0x13ca,0x13b6,0x13be,0x13c6,0x13cd,0x13b9,
+0x13d5,0x1351,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,
+0x90c,0x90c,0x534,0x13e5,0x534,0x13ec,0x13f3,0x13dd,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x13fa,0x1402,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x5d8,0x1412,0x140a,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x5d8,0x141a,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x1422,0x48d,0x565,0x1432,0x142a,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x143a,0x144a,0x1442,0x48d,0x48d,0x145a,0x1452,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x146a,0x1472,0x147a,0x1482,0x148a,0x1492,0x48d,0x1462,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x90c,0x149a,0x90c,0x90c,0xb9f,0x149f,0x14a3,0xba7,0x14ab,0x90c,0x90c,0x90c,0x90c,0xba9,
+0x48d,0x14b3,0x14bb,0x14bf,0x14c7,0x14cf,0x48d,0x48d,0x48d,0x48d,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,
+0x90c,0x14d7,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,
+0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x14df,0x14e7,0x90c,0x90c,0x90c,0xb9f,0x90c,0x90c,
+0x14ef,0x14f7,0x149a,0x90c,0x14ff,0x90c,0x1507,0x150c,0x48d,0x48d,0x90c,0x90c,0x90c,0x1514,0x90c,0x90c,
+0x151b,0x90c,0x90c,0x90c,0xb9f,0x1520,0x1528,0x152e,0x1533,0x48d,0x90c,0x90c,0x90c,0x90c,0x153b,0x90c,
+0xabe,0x117c,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x1543,0x5d8,0x5d8,0x154a,0x5d8,0x5d8,0x5d8,0x1552,0x5d8,0x155a,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0xc80,0x5d8,0x5d8,0x1562,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x156a,0x1572,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xcbf,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x1579,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x1580,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x1587,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0xf5e,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x158b,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0xf5e,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x1066,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x1590,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x1598,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0xf5e,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,
+0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x655,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x15a8,0x15a0,0x15a0,0x15a0,0x48d,0x48d,0x48d,0x48d,0x534,0x534,0x534,0x534,0x534,
+0x534,0x534,0x15b0,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,
+0x48d,0x48d,0x48d,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
+0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
+0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
+0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,
+0xe19,0xe19,0x15b8,0x46c,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,
0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,
-0xf,0xf,0xf,0xf,0xc,0x17,0x17,0x17,0x19,0x17,0x17,0x17,0x14,0x15,0x17,0x18,
-0x17,0x13,0x17,0x17,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,
-0x18,0x18,0x18,0x17,0x17,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,0x14,
-0x17,0x15,0x1a,0x16,0x1a,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0x14,
-0x18,0x15,0x18,0xf,0,0,0,0,0,0,0,0,0,0,0,0,
+0xf,0xf,0xf,0xf,0xc,0x17,0x17,0x17,0x19,0x17,0x17,0x17,0x14,0x15,0x17,0x18,
+0x17,0x13,0x17,0x17,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,
+0x18,0x18,0x18,0x17,0x17,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,0x14,
+0x17,0x15,0x1a,0x16,0x1a,2,2,2,2,2,2,2,2,2,2,2,
+2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0x14,
+0x18,0x15,0x18,0xf,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,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,0,0,
-0,0,0,0,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,
+0,0,0,0,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,
0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,
-0xf,0xf,0xf,0xf,0xc,0x17,0x19,0x19,0x19,0x19,0x1b,0x17,0x1a,0x1b,5,0x1c,
-0x18,0x10,0x1b,0x1a,0x1b,0x18,0x34b,0x38b,0x1a,2,0x17,0x17,0x1a,0x30b,5,0x1d,
-0x34cb,0x344b,0x3ccb,0x17,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,0x18,1,1,1,1,
-1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,2,2,2,0x18,2,2,2,2,
-2,2,2,2,1,2,1,2,1,2,1,2,1,2,1,2,
+0xf,0xf,0xf,0xf,0xc,0x17,0x19,0x19,0x19,0x19,0x1b,0x17,0x1a,0x1b,5,0x1c,
+0x18,0x10,0x1b,0x1a,0x1b,0x18,0x34b,0x38b,0x1a,2,0x17,0x17,0x1a,0x30b,5,0x1d,
+0x34cb,0x344b,0x3ccb,0x17,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,0x18,1,1,1,1,
+1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,
+2,2,2,2,2,2,2,2,2,2,2,0x18,2,2,2,2,
+2,2,2,2,1,2,1,2,1,2,1,2,1,2,1,2,
1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
-1,2,1,2,1,2,1,2,1,2,1,2,2,1,2,1,
-2,1,2,1,2,2,1,2,1,2,1,2,1,2,1,2,
+1,2,1,2,1,2,1,2,1,2,1,2,2,1,2,1,
+2,1,2,1,2,2,1,2,1,2,1,2,1,2,1,2,
1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
-1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
-1,2,1,2,1,1,2,1,2,1,2,2,2,1,1,2,
-1,2,1,1,2,1,1,1,2,2,1,1,1,1,2,1,
-1,2,1,1,1,2,2,2,1,1,2,1,1,2,1,2,
-1,2,1,1,2,1,2,2,1,2,1,1,2,1,1,1,
-2,1,2,1,1,2,2,5,1,2,2,2,5,5,5,5,
-1,3,2,1,3,2,1,3,2,1,2,1,2,1,2,1,
+1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
+1,2,1,2,1,1,2,1,2,1,2,2,2,1,1,2,
+1,2,1,1,2,1,1,1,2,2,1,1,1,1,2,1,
+1,2,1,1,1,2,2,2,1,1,2,1,1,2,1,2,
+1,2,1,1,2,1,2,2,1,2,1,1,2,1,1,1,
+2,1,2,1,1,2,2,5,1,2,2,2,5,5,5,5,
+1,3,2,1,3,2,1,3,2,1,2,1,2,1,2,1,
2,1,2,1,2,1,2,1,2,2,1,2,1,2,1,2,
-1,2,1,2,1,2,1,2,1,2,1,2,2,1,3,2,
-1,2,1,1,1,2,1,2,1,2,1,2,1,2,1,2,
+1,2,1,2,1,2,1,2,1,2,1,2,2,1,3,2,
+1,2,1,1,1,2,1,2,1,2,1,2,1,2,1,2,
1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
-1,2,1,2,1,2,1,2,2,2,2,2,2,2,1,1,
-2,1,1,2,2,1,2,1,1,1,1,2,1,2,1,2,
-1,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,
+1,2,1,2,1,2,1,2,2,2,2,2,2,2,1,1,
+2,1,1,2,2,1,2,1,1,1,1,2,1,2,1,2,
+1,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,5,2,2,2,2,2,2,2,2,2,2,2,
+2,2,2,2,5,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
-4,4,0x1a,0x1a,0x1a,0x1a,4,4,4,4,4,4,4,4,4,4,
-4,4,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,
-4,4,4,4,4,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,4,0x1a,4,0x1a,
-0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,
+4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
+4,4,0x1a,0x1a,0x1a,0x1a,4,4,4,4,4,4,4,4,4,4,
+4,4,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,
+4,4,4,4,4,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,4,0x1a,4,0x1a,
+0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-1,2,1,2,4,0x1a,1,2,0,0,4,2,2,2,0x17,1,
-0,0,0,0,0x1a,0x1a,1,0x17,1,1,1,0,1,0,1,1,
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,0,1,1,1,1,1,1,1,1,1,2,2,2,2,
+6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+1,2,1,2,4,0x1a,1,2,0,0,4,2,2,2,0x17,1,
+0,0,0,0,0x1a,0x1a,1,0x17,1,1,1,0,1,0,1,1,
+2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,0,1,1,1,1,1,1,1,1,1,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,1,2,2,1,1,1,2,2,2,1,2,1,2,
+2,2,2,1,2,2,1,1,1,2,2,2,1,2,1,2,
1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
-1,2,1,2,2,2,2,2,1,2,0x18,1,2,1,1,2,
-2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,2,1,2,2,2,2,2,1,2,0x18,1,2,1,1,2,
+2,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,2,2,2,2,2,2,2,2,2,2,2,2,
+1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,1,2,1,2,1,2,1,2,1,2,1,2,
+2,2,2,2,1,2,1,2,1,2,1,2,1,2,1,2,
1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
-1,2,1,2,1,2,0x1b,6,6,6,6,6,7,7,1,2,
+1,2,1,2,1,2,0x1b,6,6,6,6,6,7,7,1,2,
1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
-1,2,1,2,1,1,2,1,2,1,2,1,2,1,2,1,
-2,1,2,2,1,2,1,2,1,2,1,2,1,2,1,2,
+1,2,1,2,1,1,2,1,2,1,2,1,2,1,2,1,
+2,1,2,2,1,2,1,2,1,2,1,2,1,2,1,2,
1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
-1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
-1,2,1,2,0,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,0,
-0,4,0x17,0x17,0x17,0x17,0x17,0x17,2,2,2,2,2,2,2,2,
+1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
+1,2,1,2,0,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,0,
+0,4,0x17,0x17,0x17,0x17,0x17,0x17,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,2,0x17,0x13,0,0,0x1b,0x1b,0x19,
-0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+2,2,2,2,2,2,2,2,2,0x17,0x13,0,0,0x1b,0x1b,0x19,
+0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-6,6,6,6,6,6,6,6,6,6,6,6,6,6,0x13,6,
-0x17,6,6,0x17,6,6,0x17,6,0,0,0,0,0,0,0,0,
-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,0,0,0,0,5,
-5,5,5,0x17,0x17,0,0,0,0,0,0,0,0,0,0,0,
-0x10,0x10,0x10,0x10,0x10,0x10,0x18,0x18,0x18,0x17,0x17,0x19,0x17,0x17,0x1b,0x1b,
-6,6,6,6,6,6,6,6,6,6,6,0x17,0x10,0,0x17,0x17,
-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,
-4,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,
+6,6,6,6,6,6,6,6,6,6,6,6,6,6,0x13,6,
+0x17,6,6,0x17,6,6,0x17,6,0,0,0,0,0,0,0,0,
+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,0,0,0,0,5,
+5,5,5,0x17,0x17,0,0,0,0,0,0,0,0,0,0,0,
+0x10,0x10,0x10,0x10,0x10,0x10,0x18,0x18,0x18,0x17,0x17,0x19,0x17,0x17,0x1b,0x1b,
+6,6,6,6,6,6,6,6,6,6,6,0x17,0x10,0,0x17,0x17,
+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,
+4,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0x17,0x17,5,5,
-6,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,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,0x17,5,6,6,6,6,6,6,6,0x10,0x1b,6,
-6,6,6,6,6,4,4,6,6,0x1b,6,6,6,6,5,5,
-0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,5,5,5,0x1b,0x1b,5,
-0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0,0x10,
-5,6,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,
-6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-6,6,6,0,0,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,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,
-6,6,6,6,6,5,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,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,6,
-6,6,6,6,6,6,6,6,4,4,0x1b,0x17,0x17,0x17,4,0,
-0,6,0x19,0x19,6,6,6,6,4,6,6,6,4,6,6,6,
-6,6,0,0,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
-0x17,0x17,0x17,0,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,6,6,6,6,4,6,
-6,6,6,6,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,6,6,6,
-0,0,0x17,0,5,5,5,5,5,5,5,5,5,5,5,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,6,6,0x10,6,6,6,6,6,6,6,6,6,
-6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,0,5,5,5,5,5,5,
-5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,6,
-6,6,6,6,6,6,6,6,6,6,6,6,5,5,6,6,
-0x17,0x17,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,4,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,8,
-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,6,8,
-6,5,8,8,8,6,6,6,6,6,6,6,6,8,8,8,
-8,6,8,8,5,6,6,6,6,6,6,6,5,5,5,5,
-5,5,5,5,5,5,6,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,
-0x1c9,0x209,0x249,0x289,5,5,0x19,0x19,0x37cb,0x35cb,0x3fcb,0x34cb,0x3ccb,0x94b,0x1b,0x19,
-5,0x17,6,0,5,6,8,8,0,5,5,5,5,5,5,5,
-5,0,0,5,5,0,0,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,0,5,5,5,5,5,5,5,0,5,0,
-0,0,5,5,5,5,0,0,6,5,8,8,8,6,6,6,
-6,0,0,8,8,0,0,8,8,6,5,0,0,0,0,0,
-0,0,0,8,0,0,0,0,5,5,0,5,0,0,0,0,
-0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,6,6,5,5,
-5,6,0x17,0,0,0,0,0,0,0,0,0,0,6,6,8,
-0,5,5,5,5,5,5,0,0,0,0,5,5,0,0,5,
+0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0x17,0x17,5,5,
+6,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,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,0x17,5,6,6,6,6,6,6,6,0x10,0x1b,6,
+6,6,6,6,6,4,4,6,6,0x1b,6,6,6,6,5,5,
+0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,5,5,5,0x1b,0x1b,5,
+0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0,0x10,
+5,6,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,
+6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+6,6,6,0,0,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,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,
+6,6,6,6,6,5,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,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,6,
+6,6,6,6,6,6,6,6,4,4,0x1b,0x17,0x17,0x17,4,0,
+0,6,0x19,0x19,6,6,6,6,4,6,6,6,4,6,6,6,
+6,6,0,0,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
+0x17,0x17,0x17,0,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,6,6,6,6,4,6,
+6,6,6,6,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,6,6,6,
+0,0,0x17,0,5,5,5,5,5,5,5,5,5,5,5,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,6,6,0x10,6,6,6,6,6,6,6,6,6,
+6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,0,5,5,5,5,5,5,
+5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,6,
+6,6,6,6,6,6,6,6,6,6,6,6,5,5,6,6,
+0x17,0x17,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,4,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,8,
+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,6,8,
+6,5,8,8,8,6,6,6,6,6,6,6,6,8,8,8,
+8,6,8,8,5,6,6,6,6,6,6,6,5,5,5,5,
+5,5,5,5,5,5,6,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,
+0x1c9,0x209,0x249,0x289,5,5,0x19,0x19,0x37cb,0x35cb,0x3fcb,0x34cb,0x3ccb,0x94b,0x1b,0x19,
+5,0x17,6,0,5,6,8,8,0,5,5,5,5,5,5,5,
+5,0,0,5,5,0,0,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,0,5,5,5,5,5,5,5,0,5,0,
+0,0,5,5,5,5,0,0,6,5,8,8,8,6,6,6,
+6,0,0,8,8,0,0,8,8,6,5,0,0,0,0,0,
+0,0,0,8,0,0,0,0,5,5,0,5,0,0,0,0,
+0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,6,6,5,5,
+5,6,0x17,0,0,0,0,0,0,0,0,0,0,6,6,8,
+0,5,5,5,5,5,5,0,0,0,0,5,5,0,0,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,0,5,5,
+5,5,5,5,5,0,5,5,0,5,5,0,5,5,0,0,
+6,0,8,8,8,6,6,0,0,0,0,6,6,0,0,6,
+6,6,0,0,0,6,0,0,0,0,0,0,0,5,5,5,
+5,0,5,0,5,5,6,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,
+0x1c9,0x209,0x249,0x289,0x17,0x19,0,0,0,0,0,0,0,5,6,6,
+6,6,6,6,0,6,6,8,0,5,5,5,5,5,5,5,
+5,5,0,5,5,5,0,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,0,5,5,5,5,5,5,5,0,5,5,
+0,5,5,5,5,5,0,0,6,5,8,8,8,6,6,6,
+6,6,0,6,6,8,0,8,8,6,0,0,5,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,5,5,6,6,
+0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x1b,5,0x34cb,0x344b,
+0x3ccb,0x37cb,0x35cb,0x3fcb,0,0,0,0,0,0,0,0,0,6,8,8,
+0,5,5,5,5,5,5,5,5,0,0,5,5,0,0,5,
5,5,5,5,5,5,5,5,5,5,5,5,5,0,5,5,
-5,5,5,5,5,0,5,5,0,5,5,0,5,5,0,0,
-6,0,8,8,8,6,6,0,0,0,0,6,6,0,0,6,
-6,6,0,0,0,6,0,0,0,0,0,0,0,5,5,5,
-5,0,5,0,5,5,6,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,
-0x1c9,0x209,0x249,0x289,0x17,0x19,0,0,0,0,0,0,0,5,6,6,
-6,6,6,6,0,6,6,8,0,5,5,5,5,5,5,5,
-5,5,0,5,5,5,0,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,0,5,5,5,5,5,5,5,0,5,5,
-0,5,5,5,5,5,0,0,6,5,8,8,8,6,6,6,
-6,6,0,6,6,8,0,8,8,6,0,0,5,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,5,5,6,6,
-0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x1b,5,0x34cb,0x344b,
-0x3ccb,0x37cb,0x35cb,0x3fcb,0,0,0,0,0,0,0,0,0,6,8,8,
-0,5,5,5,5,5,5,5,5,0,0,5,5,0,0,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,0,5,5,
-5,5,5,5,5,0,5,5,0,5,5,5,5,5,0,0,
-6,5,8,6,8,6,6,6,6,0,0,8,8,0,0,8,
-8,6,0,0,0,0,0,0,0,6,6,8,0,0,0,0,
-5,5,0,5,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,
-0x1c9,0x209,0x249,0x289,0x7cb,0x1e4b,0x784b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x19,0x1b,0,
-0,0,0,0,0,0,6,5,0,5,5,5,5,5,5,0,
-0,0,5,5,5,0,5,5,5,5,0,0,0,5,5,0,
-5,0,5,5,0,0,0,5,5,0,0,0,5,5,5,0,
-0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,0,
-0,0,8,8,6,8,8,0,0,0,8,8,8,0,8,8,
-8,6,0,0,5,0,0,0,0,0,0,8,0,0,0,0,
-0,0,0,0,5,5,6,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,
-0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,0,0x17,0x54b,0x58b,0x5cb,0x60b,
-0x58b,0x5cb,0x60b,0x1b,6,8,8,8,6,5,5,5,5,5,5,5,
-5,0,5,5,5,0,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,0,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,0,0,0,5,6,6,6,8,8,8,
-8,0,6,6,6,0,6,6,6,6,0,0,0,0,0,0,
-0,6,6,0,5,5,5,0,0,0,0,0,5,5,6,6,
-0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,5,5,0,
-0,0,0,0,0,0,0,0,0,0,0,0,5,6,8,8,
-0x17,5,5,5,5,5,5,5,5,0,5,5,5,0,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,0,5,5,
-5,5,5,5,5,5,5,5,0,5,5,5,5,5,0,0,
-6,5,8,6,8,8,8,8,8,0,6,8,8,0,8,8,
-6,6,0,0,0,0,0,0,0,8,8,0,0,0,0,0,
-0,0,5,0,5,5,6,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,
-0x1c9,0x209,0x249,0x289,0x7cb,0x1e4b,0x784b,0x34cb,0x344b,0x3ccb,0x37cb,0x35cb,0x3fcb,0x1b,5,5,
-5,5,5,5,6,6,8,8,5,5,5,5,5,5,5,5,
-5,0,5,5,5,0,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,6,6,5,8,8,8,6,6,6,6,0,8,8,
-8,0,8,8,8,6,5,0x1b,0,0,0,0,5,5,5,8,
-0xcc0b,0xca0b,0xcb4b,0xc90b,0x364b,0xc94b,0x350b,5,0,0,0,0,0,0,0x49,0x89,
-0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,8,8,0x17,0,0,0,
+5,5,5,5,5,0,5,5,0,5,5,5,5,5,0,0,
+6,5,8,6,8,6,6,6,6,0,0,8,8,0,0,8,
+8,6,0,0,0,0,0,0,0,6,6,8,0,0,0,0,
+5,5,0,5,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,
+0x1c9,0x209,0x249,0x289,0x7cb,0x1e4b,0x784b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x19,0x1b,0,
+0,0,0,0,0,0,6,5,0,5,5,5,5,5,5,0,
+0,0,5,5,5,0,5,5,5,5,0,0,0,5,5,0,
+5,0,5,5,0,0,0,5,5,0,0,0,5,5,5,0,
+0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,0,
+0,0,8,8,6,8,8,0,0,0,8,8,8,0,8,8,
+8,6,0,0,5,0,0,0,0,0,0,8,0,0,0,0,
+0,0,0,0,5,5,6,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,
+0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,0,0x17,0x54b,0x58b,0x5cb,0x60b,
+0x58b,0x5cb,0x60b,0x1b,6,8,8,8,6,5,5,5,5,5,5,5,
+5,0,5,5,5,0,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,0,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,0,0,0,5,6,6,6,8,8,8,
+8,0,6,6,6,0,6,6,6,6,0,0,0,0,0,0,
+0,6,6,0,5,5,5,0,0,0,0,0,5,5,6,6,
+0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,5,5,0,
+0,0,0,0,0,0,0,0,0,0,0,0,5,6,8,8,
+0x17,5,5,5,5,5,5,5,5,0,5,5,5,0,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,0,5,5,
+5,5,5,5,5,5,5,5,0,5,5,5,5,5,0,0,
+6,5,8,6,8,8,8,8,8,0,6,8,8,0,8,8,
+6,6,0,0,0,0,0,0,0,8,8,0,0,0,0,0,
+0,0,5,0,5,5,6,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,
+0x1c9,0x209,0x249,0x289,0x7cb,0x1e4b,0x784b,0x34cb,0x344b,0x3ccb,0x37cb,0x35cb,0x3fcb,0x1b,5,5,
+5,5,5,5,6,6,8,8,5,5,5,5,5,5,5,5,
+5,0,5,5,5,0,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,6,6,5,8,8,8,6,6,6,6,0,8,8,
+8,0,8,8,8,6,5,0x1b,0,0,0,0,5,5,5,8,
+0xcc0b,0xca0b,0xcb4b,0xc90b,0x364b,0xc94b,0x350b,5,0,0,0,0,0,0,0x49,0x89,
+0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,8,8,0x17,0,0,0,
0,0,0,0,0,0,0,0,0,6,8,8,0,5,5,5,
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,
-0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,0,5,5,5,5,5,5,5,5,5,
-0,5,0,0,5,5,5,5,5,5,5,0,0,0,6,0,
-0,0,0,8,8,8,6,6,6,0,6,0,8,8,8,8,
-8,8,8,8,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,6,5,5,6,6,6,6,6,6,6,0,
-0,0,0,0x19,5,5,5,5,5,5,4,6,6,6,6,6,
-6,6,6,0x17,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,
-0,0,0,0,0,5,5,0,5,0,5,5,5,5,5,0,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,0,5,0,5,5,5,5,5,5,5,5,5,
-5,6,5,5,6,6,6,6,6,6,6,6,6,5,0,0,
+0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,0,5,5,5,5,5,5,5,5,5,
+0,5,0,0,5,5,5,5,5,5,5,0,0,0,6,0,
+0,0,0,8,8,8,6,6,6,0,6,0,8,8,8,8,
+8,8,8,8,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,6,5,5,6,6,6,6,6,6,6,0,
+0,0,0,0x19,5,5,5,5,5,5,4,6,6,6,6,6,
+6,6,6,0x17,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,
+0,0,0,0,0,5,5,0,5,0,5,5,5,5,5,0,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,0,5,0,5,5,5,5,5,5,5,5,5,
+5,6,5,5,6,6,6,6,6,6,6,6,6,5,0,0,
5,5,5,5,5,0,4,0,6,6,6,6,6,6,0,0,
0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,5,5,5,5,
5,0x1b,0x1b,0x1b,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
@@ -532,17 +532,17 @@ static const uint16_t propsTrie_index[22276]={
5,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,
5,5,6,8,8,6,6,8,8,8,8,8,8,6,5,8,
0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,8,8,8,6,0x1b,0x1b,
-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,2,2,2,0x17,4,2,2,2,
+2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+2,2,2,2,2,2,2,2,2,2,2,0x17,4,2,2,2,
1,1,1,1,1,1,0,1,0,0,0,0,0,1,0,0,
-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-5,5,5,5,5,5,5,5,5,0,5,5,5,5,0,0,
-5,5,5,5,5,5,5,0,5,0,5,5,5,5,0,0,
-5,5,5,5,5,5,5,5,5,0,5,5,5,5,0,0,
+2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+5,5,5,5,5,5,5,5,5,0,5,5,5,5,0,0,
+5,5,5,5,5,5,5,0,5,0,5,5,5,5,0,0,
+5,5,5,5,5,5,5,5,5,0,5,5,5,5,0,0,
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
5,0,5,5,5,5,0,0,5,5,5,5,5,5,5,0,
5,0,5,5,5,5,0,0,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,0,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,0,5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,5,0,5,5,5,5,0,0,
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,0,0,6,6,6,
@@ -554,7 +554,7 @@ static const uint16_t propsTrie_index[22276]={
1,1,1,1,1,1,0,0,2,2,2,2,2,2,0,0,
0x13,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,0x1b,0x17,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,0x1b,0x17,5,5,5,5,5,5,5,5,5,5,5,5,5,
5,5,5,5,0xc,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,0x14,
0x15,0,0,0,5,5,5,5,5,5,5,5,5,5,5,0x17,
@@ -579,7 +579,7 @@ static const uint16_t propsTrie_index[22276]={
6,6,0x10,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,
0,0,0,0,5,5,5,4,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,0,0,0,0,0,0,0,5,5,5,5,
+5,5,5,5,5,0,0,0,0,0,0,0,5,5,5,5,
5,6,6,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,0,0,
0,0,0,0,0,0,0,0,6,6,6,8,8,8,8,6,
@@ -598,7 +598,7 @@ static const uint16_t propsTrie_index[22276]={
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,6,6,8,8,6,0,0,0x17,0x17,
0x17,0x17,0x17,0x17,0x17,0x17,0x17,4,0x17,0x17,0x17,0x17,0x17,0x17,0,0,
-6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,6,
+6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,6,
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
5,5,5,5,5,8,6,8,6,6,6,6,6,6,6,0,
6,8,6,8,8,6,6,6,6,6,6,6,6,8,8,8,
@@ -607,8 +607,8 @@ static const uint16_t propsTrie_index[22276]={
0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,
0x17,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,6,6,6,6,6,
6,6,6,6,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,
-6,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,0,0,
+6,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,0,0,
6,6,6,6,8,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,
6,8,6,6,6,6,6,8,6,8,8,8,8,8,6,8,
@@ -626,12 +626,12 @@ static const uint16_t propsTrie_index[22276]={
0x17,0x17,0x17,0x17,5,5,5,5,5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,5,5,5,5,4,4,4,4,
4,4,0x17,0x17,2,2,2,2,2,2,2,2,2,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,1,1,1,1,1,1,1,1,0,
-0,1,1,1,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,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,1,1,1,1,1,1,1,1,0,
+0,1,1,1,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0,0,0,0,
0,0,0,0,6,6,6,0x17,6,6,6,6,6,6,6,6,
6,6,6,6,6,8,6,6,6,6,6,6,6,5,5,5,
-5,6,5,5,5,5,5,5,6,5,5,8,6,6,5,0,
+5,6,5,5,5,5,5,5,6,5,5,8,6,6,5,0,
0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
@@ -639,7 +639,7 @@ static const uint16_t propsTrie_index[22276]={
4,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,4,
4,4,4,4,6,6,6,6,6,6,6,6,6,6,6,6,
-6,6,6,6,6,6,6,6,6,6,6,6,6,6,0,6,
+6,6,6,6,6,6,6,6,6,6,6,6,6,6,0,6,
6,6,6,6,1,2,1,2,1,2,1,2,1,2,1,2,
1,2,1,2,1,2,1,2,1,2,2,2,2,2,2,2,
2,2,1,2,2,2,2,2,2,2,2,2,1,1,1,1,
@@ -669,7 +669,7 @@ static const uint16_t propsTrie_index[22276]={
0x18,0x14,0x15,0,4,4,4,4,4,4,4,4,4,4,4,4,
4,0,0,0,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,
0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,
-0x19,0x19,0x19,0x19,0,0,0,0,0,0,0,0,0,0,0,0,
+0x19,0x19,0x19,0x19,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6,
6,7,7,7,7,6,7,7,7,6,6,6,6,6,6,6,
6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,0,
@@ -701,3160 +701,3160 @@ static const uint16_t propsTrie_index[22276]={
0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x18,0x18,0x18,0x18,
0x18,0x18,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,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,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x2cb,0x80b,0x84b,0x88b,0x8cb,0x90b,0x94b,0x98b,0x9cb,0xa0b,
-0xa4b,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb,0x2cb,0x30b,0x34b,0x38b,0x3cb,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,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,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x2cb,0x80b,0x84b,0x88b,0x8cb,0x90b,0x94b,0x98b,0x9cb,0xa0b,
+0xa4b,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb,0x2cb,0x30b,0x34b,0x38b,0x3cb,
0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb,0x80b,0x84b,0x88b,0x8cb,0x90b,0x94b,0x98b,0x9cb,0xa0b,0xa4b,
-0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb,0x80b,0x84b,0x88b,0x8cb,0x90b,0x94b,
-0x98b,0x9cb,0xa0b,0xa4b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x18,0x18,0x18,0x18,
-0x18,0x18,0x18,0x18,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x18,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x18,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb,0x80b,0x84b,0x88b,0x8cb,0x90b,0x94b,
+0x98b,0x9cb,0xa0b,0xa4b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x18,0x18,0x18,0x18,
+0x18,0x18,0x18,0x18,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x18,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x18,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x18,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,
-0x14,0x15,0x14,0x15,0x14,0x15,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb,
-0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,
-0x48b,0x4cb,0x50b,0x7cb,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x18,0x18,0x18,0x18,0x18,0x14,0x15,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
-0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
-0x18,0x18,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x18,0x18,0x18,0x18,
-0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x14,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,
+0x14,0x15,0x14,0x15,0x14,0x15,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb,
+0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,
+0x48b,0x4cb,0x50b,0x7cb,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x18,0x18,0x18,0x18,0x18,0x14,0x15,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+0x18,0x18,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x18,0x18,0x18,0x18,
+0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x14,
0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14,
-0x15,0x14,0x15,0x14,0x15,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+0x15,0x14,0x15,0x14,0x15,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
-0x14,0x15,0x14,0x15,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+0x14,0x15,0x14,0x15,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
-0x14,0x15,0x18,0x18,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
-0x18,0x18,0x18,0x18,0x18,0x1b,0x1b,0x18,0x18,0x18,0x18,0x18,0x18,0x1b,0x1b,0x1b,
+0x14,0x15,0x18,0x18,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+0x18,0x18,0x18,0x18,0x18,0x1b,0x1b,0x18,0x18,0x18,0x18,0x18,0x18,0x1b,0x1b,0x1b,
0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,2,2,2,2,2,2,2,2,
+0x1b,0x1b,0x1b,0x1b,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,0,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,0,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,1,2,1,1,1,2,2,1,
-2,1,2,1,2,1,1,1,1,2,1,2,2,1,2,2,
-2,2,2,2,4,4,1,1,1,2,1,2,2,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,1,2,1,2,6,6,6,1,2,0,0,0,0,
-0,0x17,0x17,0x17,0x17,0x344b,0x17,0x17,2,2,2,2,2,2,0,2,
-0,0,0,0,0,2,0,0,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,4,
-0x17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,
-5,5,5,5,5,5,5,0,5,5,5,5,5,5,5,0,
-5,5,5,5,5,5,5,0,5,5,5,5,5,5,5,0,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,
-0x17,0x17,0x1c,0x1d,0x1c,0x1d,0x17,0x17,0x17,0x1c,0x1d,0x17,0x1c,0x1d,0x17,0x17,
-0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x13,0x17,0x17,0x13,0x17,0x1c,0x1d,0x17,0x17,
-0x1c,0x1d,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x17,0x17,0x17,0x17,0x17,4,
-0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x13,0x13,0x17,0x17,0x17,0x17,
-0x13,0x17,0x14,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
-0x1b,0x1b,0x17,0,0,0,0,0,0,0,0,0,0,0,0,0,
+2,2,2,2,2,2,2,0,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,0,2,2,2,2,2,2,2,2,
+2,2,2,2,2,2,2,2,1,2,1,1,1,2,2,1,
+2,1,2,1,2,1,1,1,1,2,1,2,2,1,2,2,
+2,2,2,2,4,4,1,1,1,2,1,2,2,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,1,2,1,2,6,6,6,1,2,0,0,0,0,
+0,0x17,0x17,0x17,0x17,0x344b,0x17,0x17,2,2,2,2,2,2,0,2,
+0,0,0,0,0,2,0,0,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,4,
+0x17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,
+5,5,5,5,5,5,5,0,5,5,5,5,5,5,5,0,
+5,5,5,5,5,5,5,0,5,5,5,5,5,5,5,0,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,
+0x17,0x17,0x1c,0x1d,0x1c,0x1d,0x17,0x17,0x17,0x1c,0x1d,0x17,0x1c,0x1d,0x17,0x17,
+0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x13,0x17,0x17,0x13,0x17,0x1c,0x1d,0x17,0x17,
+0x1c,0x1d,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x17,0x17,0x17,0x17,0x17,4,
+0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x13,0x13,0x17,0x17,0x17,0x17,
+0x13,0x17,0x14,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
+0x1b,0x1b,0x17,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,0x1b,0x1b,
0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,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,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0,0,0,0,0x1b,0x58a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,6,6,
-6,6,8,8,0x13,4,4,4,4,4,0x1b,0x1b,0x7ca,0xa4a,0xcca,4,
-5,0x17,0x1b,0x1b,0xc,0x17,0x17,0x17,0x1b,4,5,0x54a,0x14,0x15,0x14,0x15,
-0x14,0x15,0x14,0x15,0x14,0x15,0x1b,0x1b,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,
-0x13,0x14,0x15,0x15,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,0,0,6,6,0x1a,
-0x1a,4,4,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,0x17,
-4,4,4,5,0,0,0,0,0,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,0,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,0,0x1b,0x1b,0x58b,0x5cb,0x60b,0x64b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,
-0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1b,0xa8b,0xacb,0xb0b,
-0xb4b,0xb8b,0xbcb,0xc0b,0xc4b,0xc8b,0xccb,0xd0b,0xd4b,0xd8b,0xdcb,0xe0b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0xe4b,0xe8b,0xecb,
-0xf0b,0xf4b,0xf8b,0xfcb,0x100b,0x104b,0x108b,0x10cb,0x110b,0x114b,0x118b,0x11cb,5,5,5,5,
-5,0x685,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,0x5c5,
-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,0x685,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,0x705,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,0x585,5,5,0x705,5,5,5,0x7885,
-5,0x605,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,0x785,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-0x5c5,5,5,5,5,5,5,5,0x685,5,0x645,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,0x7985,0x7c5,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,0x7845,5,5,5,5,
-5,5,5,5,0x605,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,0x685,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-0x1e45,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-0x7985,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,0x7a85,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,0x5c5,5,0x745,5,0x6c5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,0x7c5,5,0x7845,0xa45,0xcc5,5,5,5,5,5,5,0xf45,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,0x605,0x605,0x605,0x605,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,0x645,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,0x585,5,5,5,5,5,5,5,0x585,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,0x585,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,0x785,0xa45,5,5,5,5,
-5,5,5,5,5,5,5,5,0x585,0x5c5,0x605,5,0x5c5,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,0x7c5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,0x745,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,0x705,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,0x785,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,0x1e45,5,
-5,5,5,5,5,5,0x645,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,
-0x7885,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,0x5c5,5,5,5,5,0x5c5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,0x5c5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,0x7845,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,0x6c5,5,
-5,5,5,5,0x1e45,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,
-0x6c5,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,0x545,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,0,0,0,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,4,5,5,5,5,5,5,5,5,5,5,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,4,0x17,0x17,0x17,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,5,5,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0x1b,0x58a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,6,6,
+6,6,8,8,0x13,4,4,4,4,4,0x1b,0x1b,0x7ca,0xa4a,0xcca,4,
+5,0x17,0x1b,0x1b,0xc,0x17,0x17,0x17,0x1b,4,5,0x54a,0x14,0x15,0x14,0x15,
+0x14,0x15,0x14,0x15,0x14,0x15,0x1b,0x1b,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,
+0x13,0x14,0x15,0x15,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,0,0,6,6,0x1a,
+0x1a,4,4,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,0x17,
+4,4,4,5,0,0,0,0,0,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,0,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,0,0x1b,0x1b,0x58b,0x5cb,0x60b,0x64b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,
+0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1b,0xa8b,0xacb,0xb0b,
+0xb4b,0xb8b,0xbcb,0xc0b,0xc4b,0xc8b,0xccb,0xd0b,0xd4b,0xd8b,0xdcb,0xe0b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0xe4b,0xe8b,0xecb,
+0xf0b,0xf4b,0xf8b,0xfcb,0x100b,0x104b,0x108b,0x10cb,0x110b,0x114b,0x118b,0x11cb,5,5,5,5,
+5,0x685,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,0x5c5,
+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,0x685,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,0x705,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,0x585,5,5,0x705,5,5,5,0x7885,
+5,0x605,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,0x785,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+0x5c5,5,5,5,5,5,5,5,0x685,5,0x645,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,0x7985,0x7c5,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,0x7845,5,5,5,5,
+5,5,5,5,0x605,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,0x685,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+0x1e45,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+0x7985,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,0x7a85,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,0x5c5,5,0x745,5,0x6c5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,0x7c5,5,0x7845,0xa45,0xcc5,5,5,5,5,5,5,0xf45,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,0x605,0x605,0x605,0x605,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,0x645,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,0x585,5,5,5,5,5,5,5,0x585,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,0x585,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,0x785,0xa45,5,5,5,5,
+5,5,5,5,5,5,5,5,0x585,0x5c5,0x605,5,0x5c5,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,0x7c5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,0x745,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,0x705,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,0x785,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,0x1e45,5,
+5,5,5,5,5,5,0x645,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,
+0x7885,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,0x5c5,5,5,5,5,0x5c5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,0x5c5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,0x7845,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,0x6c5,5,
+5,5,5,5,0x1e45,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,
+0x6c5,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,0x545,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,0,0,0,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,4,5,5,5,5,5,5,5,5,5,5,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,4,0x17,0x17,0x17,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,5,5,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
-1,2,1,2,1,2,1,2,1,2,1,2,4,4,6,6,
-1,2,1,2,1,2,1,2,1,2,1,2,1,2,5,6,
-7,7,7,0x17,6,6,6,6,6,6,6,6,6,6,0x17,4,
-5,5,5,5,5,5,0x58a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x54a,
-6,6,0x17,0x17,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0,
+1,2,1,2,1,2,1,2,1,2,1,2,4,4,6,6,
+1,2,1,2,1,2,1,2,1,2,1,2,1,2,5,6,
+7,7,7,0x17,6,6,6,6,6,6,6,6,6,6,0x17,4,
+5,5,5,5,5,5,0x58a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x54a,
+6,6,0x17,0x17,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0,
0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,
-0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,4,4,4,4,4,4,4,4,4,
+0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,4,4,4,4,4,4,4,4,4,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,1,2,5,4,4,2,5,5,5,5,5,
-0x1a,0x1a,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
-2,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
-1,2,1,2,4,2,2,2,2,2,2,2,2,1,2,1,
-2,1,1,2,1,2,1,2,1,2,1,2,4,0x1a,0x1a,1,
-2,1,2,5,1,2,1,2,2,2,1,2,1,2,1,2,
-1,2,1,2,1,2,1,1,1,1,1,2,1,1,1,1,
-1,2,1,2,1,2,1,2,1,2,1,2,0,0,1,2,
-1,1,1,1,2,1,2,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,5,5,6,5,
-5,5,6,5,5,5,5,6,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,8,
-8,6,6,8,0x1b,0x1b,0x1b,0x1b,6,0,0,0,0x34cb,0x344b,0x3ccb,0x37cb,
-0x35cb,0x3fcb,0x1b,0x1b,0x19,0x1b,0,0,0,0,0,0,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0,8,8,8,8,
-6,6,0,0,0,0,0,0,0,0,0x17,0x17,0x49,0x89,0xc9,0x109,
-0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,8,8,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,8,8,8,8,
-8,8,8,8,8,8,8,8,6,6,6,6,6,6,6,6,
-6,6,6,6,6,6,6,6,6,6,5,5,5,5,5,5,
-0x17,0x17,0x17,5,0x17,5,5,6,5,5,5,5,5,5,6,6,
-6,6,6,6,6,6,0x17,0x17,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,
-6,6,6,6,6,6,8,8,0,0,0,0,0,0,0,0,
-0,0,0,0x17,8,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
-0x17,0x17,0,4,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,
-0,0,0x17,0x17,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,6,8,8,6,6,6,6,8,8,
-6,6,8,8,5,5,5,5,5,6,4,5,5,5,5,5,
-5,5,5,5,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,5,5,
-5,5,5,0,5,5,5,5,5,5,5,5,5,6,6,6,
-6,6,6,8,8,6,6,8,8,6,6,0,0,0,0,0,
-0,0,0,0,5,5,5,6,5,5,5,5,5,5,5,5,
-6,8,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,
-0x17,0x17,0x17,0x17,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,4,5,5,5,5,5,5,0x1b,0x1b,0x1b,5,8,
-6,8,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,6,5,6,6,6,5,5,6,6,5,5,5,
-5,5,6,6,5,6,5,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
-5,4,0x17,0x17,5,5,5,5,5,5,5,5,5,5,5,8,
-6,6,8,8,0x17,0x17,5,4,4,8,6,0,0,0,0,0,
-0,0,0,0,0,5,5,5,5,5,5,0,0,5,5,5,
-5,5,5,0,0,5,5,5,5,5,5,0,0,0,0,0,
-0,0,0,0,5,5,5,5,5,5,5,0,5,5,5,5,
-5,5,5,0,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0x1a,
-4,4,4,4,2,2,2,2,2,2,2,2,2,4,0x1a,0x1a,
-0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,5,5,5,8,8,6,8,8,6,8,8,0x17,
-8,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,
-0,0,0,0,5,5,5,5,0,0,0,0,0,0,0,0,
-0,0,0,0,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,
-0,0,0,0,5,5,5,5,5,5,5,0,0,0,0,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
+0,0,0,0,0,1,2,5,4,4,2,5,5,5,5,5,
+0x1a,0x1a,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
+2,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
+1,2,1,2,4,2,2,2,2,2,2,2,2,1,2,1,
+2,1,1,2,1,2,1,2,1,2,1,2,4,0x1a,0x1a,1,
+2,1,2,5,1,2,1,2,2,2,1,2,1,2,1,2,
+1,2,1,2,1,2,1,1,1,1,1,2,1,1,1,1,
+1,2,1,2,1,2,1,2,1,2,1,2,0,0,1,2,
+1,1,1,1,2,1,2,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,5,5,6,5,
+5,5,6,5,5,5,5,6,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,8,
+8,6,6,8,0x1b,0x1b,0x1b,0x1b,6,0,0,0,0x34cb,0x344b,0x3ccb,0x37cb,
+0x35cb,0x3fcb,0x1b,0x1b,0x19,0x1b,0,0,0,0,0,0,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0,8,8,8,8,
+6,6,0,0,0,0,0,0,0,0,0x17,0x17,0x49,0x89,0xc9,0x109,
+0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,8,8,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,8,8,8,8,
+8,8,8,8,8,8,8,8,6,6,6,6,6,6,6,6,
+6,6,6,6,6,6,6,6,6,6,5,5,5,5,5,5,
+0x17,0x17,0x17,5,0x17,5,5,6,5,5,5,5,5,5,6,6,
+6,6,6,6,6,6,0x17,0x17,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,
+6,6,6,6,6,6,8,8,0,0,0,0,0,0,0,0,
+0,0,0,0x17,8,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
+0x17,0x17,0,4,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,
+0,0,0x17,0x17,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,6,8,8,6,6,6,6,8,8,
+6,6,8,8,5,5,5,5,5,6,4,5,5,5,5,5,
+5,5,5,5,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,5,5,
+5,5,5,0,5,5,5,5,5,5,5,5,5,6,6,6,
+6,6,6,8,8,6,6,8,8,6,6,0,0,0,0,0,
+0,0,0,0,5,5,5,6,5,5,5,5,5,5,5,5,
+6,8,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,
+0x17,0x17,0x17,0x17,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,4,5,5,5,5,5,5,0x1b,0x1b,0x1b,5,8,
+6,8,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,6,5,6,6,6,5,5,6,6,5,5,5,
+5,5,6,6,5,6,5,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
+5,4,0x17,0x17,5,5,5,5,5,5,5,5,5,5,5,8,
+6,6,8,8,0x17,0x17,5,4,4,8,6,0,0,0,0,0,
+0,0,0,0,0,5,5,5,5,5,5,0,0,5,5,5,
+5,5,5,0,0,5,5,5,5,5,5,0,0,0,0,0,
+0,0,0,0,5,5,5,5,5,5,5,0,5,5,5,5,
+5,5,5,0,2,2,2,2,2,2,2,2,2,2,2,2,
+2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0x1a,
+4,4,4,4,2,2,2,2,2,2,2,2,2,4,0x1a,0x1a,
+0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,
+2,2,2,2,5,5,5,8,8,6,8,8,6,8,8,0x17,
+8,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,
+0,0,0,0,5,5,5,5,0,0,0,0,0,0,0,0,
+0,0,0,0,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,
+0,0,0,0,5,5,5,5,5,5,5,0,0,0,0,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
-0x12,0x12,0x12,0x12,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+0x12,0x12,0x12,0x12,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
-0x11,0x11,0x11,0x11,5,5,5,5,5,5,5,5,5,5,5,0x605,
-5,5,5,5,5,5,5,0x7c5,5,5,5,5,0x5c5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,0x6c5,5,0x6c5,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,0x7c5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,0,0,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,0x18,5,5,5,5,5,5,5,5,5,5,
-5,5,5,0,5,5,5,5,5,0,5,0,5,5,0,5,
-5,0,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,2,2,2,2,
-2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,
-2,2,2,2,0,0,0,0,0,5,6,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x1a,0x1a,
-0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0x15,0x14,
+0x11,0x11,0x11,0x11,5,5,5,5,5,5,5,5,5,5,5,0x605,
+5,5,5,5,5,5,5,0x7c5,5,5,5,5,0x5c5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,0x6c5,5,0x6c5,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,0x7c5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,0,0,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,0x18,5,5,5,5,5,5,5,5,5,5,
+5,5,5,0,5,5,5,5,5,0,5,0,5,5,0,5,
+5,0,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,2,2,2,2,
+2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,
+2,2,2,2,0,0,0,0,0,5,6,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x1a,0x1a,
+0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0x15,0x14,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,
-5,5,5,5,0x19,0x1b,0,0,6,6,6,6,6,6,6,6,
-6,6,6,6,6,6,6,6,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
-0x15,0x17,0,0,0,0,0,0,6,6,6,6,6,6,6,6,
-6,6,6,6,6,6,6,6,0x17,0x13,0x13,0x16,0x16,0x14,0x15,0x14,
-0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x17,0x17,0x14,0x15,0x17,0x17,0x17,
-0x17,0x16,0x16,0x16,0x17,0x17,0x17,0,0x17,0x17,0x17,0x17,0x13,0x14,0x15,0x14,
-0x15,0x14,0x15,0x17,0x17,0x17,0x18,0x13,0x18,0x18,0x18,0,0x17,0x19,0x17,0x17,
-0,0,0,0,5,5,5,5,5,0,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,0,0,0x10,0,0,5,5,
+0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,
+5,5,5,5,0x19,0x1b,0,0,6,6,6,6,6,6,6,6,
+6,6,6,6,6,6,6,6,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
+0x15,0x17,0,0,0,0,0,0,6,6,6,6,6,6,6,6,
+6,6,6,6,6,6,6,6,0x17,0x13,0x13,0x16,0x16,0x14,0x15,0x14,
+0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x17,0x17,0x14,0x15,0x17,0x17,0x17,
+0x17,0x16,0x16,0x16,0x17,0x17,0x17,0,0x17,0x17,0x17,0x17,0x13,0x14,0x15,0x14,
+0x15,0x14,0x15,0x17,0x17,0x17,0x18,0x13,0x18,0x18,0x18,0,0x17,0x19,0x17,0x17,
+0,0,0,0,5,5,5,5,5,0,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,0,0,0x10,0,0,5,5,
5,5,5,5,0,0,5,5,5,5,5,5,0,0,5,5,
-5,5,5,5,0,0,5,5,5,0,0,0,0x19,0x19,0x18,0x1a,
-0x1b,0x19,0x19,0,0x1b,0x18,0x18,0x18,0x18,0x1b,0x1b,0,0,0,0,0,
-0,0,0,0,0,0x10,0x10,0x10,0x1b,0x1b,0,0,0,0x17,0x17,0x17,
-0x19,0x17,0x17,0x17,0x14,0x15,0x17,0x18,0x17,0x13,0x17,0x17,0x49,0x89,0xc9,0x109,
-0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0x18,0x18,0x18,0x17,0x1a,2,2,2,
-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,0x14,0x18,0x15,0x18,0x14,0x15,0x17,0x14,0x15,
-0x17,0x17,5,5,5,5,5,5,5,5,5,5,4,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,4,4,
-5,5,5,5,5,5,5,5,5,5,5,5,0,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,0,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,0,5,5,0,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,0,0,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,0,0,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,0,0,0,0,0,0xb00b,0xb80b,0x784b,0x804b,
-0x884b,0x904b,0x984b,0xa04b,0xa84b,0xb04b,0xb84b,0x788b,0x808b,0x888b,0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b,
-0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x17,0x17,0x17,0,
-0,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,
-0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b,0xa00b,0xa80b,0x7ca,0x7ca,0x7ca,0x7ca,
-0x7ca,0xcca,0x11ca,0x11ca,0x11ca,0x11ca,0x1e4a,0x880a,0x980a,0x980a,0x980a,0x980a,0x980a,0x784a,0x984a,0x68a,
-0x11ca,0x344b,0x344b,0x388b,0x3ccb,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x54b,0x34cb,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0x34ca,0x344a,0x58a,0x68a,0x11ca,0x980a,0x984a,0x988a,
-0x68a,0x7ca,0x11ca,0x1e4a,0x980a,0x784a,0x984a,0x68a,0x7ca,0x11ca,0x1e4a,0x980a,0x784a,0x788a,0x988a,0x7ca,
-0x58a,0x58a,0x58a,0x5ca,0x5ca,0x5ca,0x5ca,0x68a,0x1b,0,0,0,0,0,0,0,
+5,5,5,5,0,0,5,5,5,0,0,0,0x19,0x19,0x18,0x1a,
+0x1b,0x19,0x19,0,0x1b,0x18,0x18,0x18,0x18,0x1b,0x1b,0,0,0,0,0,
+0,0,0,0,0,0x10,0x10,0x10,0x1b,0x1b,0,0,0,0x17,0x17,0x17,
+0x19,0x17,0x17,0x17,0x14,0x15,0x17,0x18,0x17,0x13,0x17,0x17,0x49,0x89,0xc9,0x109,
+0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0x18,0x18,0x18,0x17,0x1a,2,2,2,
+2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+2,2,2,2,2,2,2,0x14,0x18,0x15,0x18,0x14,0x15,0x17,0x14,0x15,
+0x17,0x17,5,5,5,5,5,5,5,5,5,5,4,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,4,4,
+5,5,5,5,5,5,5,5,5,5,5,5,0,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,0,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,0,5,5,0,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,0,0,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,0,0,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,0,0,0,0,0,0xb00b,0xb80b,0x784b,0x804b,
+0x884b,0x904b,0x984b,0xa04b,0xa84b,0xb04b,0xb84b,0x788b,0x808b,0x888b,0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b,
+0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x17,0x17,0x17,0,
+0,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,
+0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b,0xa00b,0xa80b,0x7ca,0x7ca,0x7ca,0x7ca,
+0x7ca,0xcca,0x11ca,0x11ca,0x11ca,0x11ca,0x1e4a,0x880a,0x980a,0x980a,0x980a,0x980a,0x980a,0x784a,0x984a,0x68a,
+0x11ca,0x344b,0x344b,0x388b,0x3ccb,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x54b,0x34cb,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0x34ca,0x344a,0x58a,0x68a,0x11ca,0x980a,0x984a,0x988a,
+0x68a,0x7ca,0x11ca,0x1e4a,0x980a,0x784a,0x984a,0x68a,0x7ca,0x11ca,0x1e4a,0x980a,0x784a,0x788a,0x988a,0x7ca,
+0x58a,0x58a,0x58a,0x5ca,0x5ca,0x5ca,0x5ca,0x68a,0x1b,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,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,6,0,0,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,6,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,
-0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b,
-0xa00b,0xa80b,0xb00b,0xb80b,0,0,0,0,0x58b,0x68b,0x7cb,0x11cb,0,0,0,0,
-0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,0x1bca,5,5,5,5,5,5,
-5,5,0xb80a,0,0,0,0,0,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,
-6,6,6,0,0,0,0,0,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,0,0x17,5,5,5,5,0,0,0,0,
-5,5,5,5,5,5,5,5,0x17,0x58a,0x5ca,0x7ca,0xa4a,0x1e4a,0,0,
-0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,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,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,
-0x249,0x289,0,0,0,0,0,0,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,
+0x1b,0x1b,0x1b,0x1b,0x1b,6,0,0,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,6,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,
+0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b,
+0xa00b,0xa80b,0xb00b,0xb80b,0,0,0,0,0x58b,0x68b,0x7cb,0x11cb,0,0,0,0,
+0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,0x1bca,5,5,5,5,5,5,
+5,5,0xb80a,0,0,0,0,0,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,
+6,6,6,0,0,0,0,0,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,0,0x17,5,5,5,5,0,0,0,0,
+5,5,5,5,5,5,5,5,0x17,0x58a,0x5ca,0x7ca,0xa4a,0x1e4a,0,0,
+0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,
+2,2,2,2,2,2,2,2,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,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,
+0x249,0x289,0,0,0,0,0,0,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,0,0,0,0,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,
-2,2,2,2,2,2,2,2,5,5,5,5,5,5,5,5,
-0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,
+2,2,2,2,0,0,0,0,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,
+2,2,2,2,2,2,2,2,5,5,5,5,5,5,5,5,
+0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,0,
-0,0,0,0x17,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,0,5,5,0,0,0,
-5,0,0,5,5,5,5,5,5,5,0,0,5,0,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,0,0x17,0x58b,0x5cb,0x60b,0x7cb,0xa4b,0x1e4b,0x784b,0x788b,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,0x1b,0x1b,0x58b,0x5cb,0x60b,0x64b,0x68b,0x7cb,0xa4b,
-0,0,0,0,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x64b,0x68b,0x7cb,0xa4b,0x1e4b,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,0,5,5,0,0,0,0,0,0x58b,0x68b,0x7cb,0xa4b,0x1e4b,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,0x58b,0x7cb,0xa4b,0x1e4b,0x5cb,0x60b,0,0,0,0x17,
-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,0,0,0,0,0,0x17,
-0xa04b,0xa84b,0xb04b,0xb84b,0x788b,0x808b,0x888b,0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b,0x78cb,0x80cb,0x88cb,
-0x90cb,0x98cb,0xa0cb,0xa8cb,0xb0cb,0xb8cb,0x36cb,0x354b,0x34cb,0x348b,0x46cb,0x344b,0x4ecb,0x388b,0x3ccb,0x454b,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,0,0,0,0,0x5ecb,0x344b,5,5,
-0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,
-0,0,0x1e4b,0x800b,0x880b,0x900b,0x980b,0xa00b,0xa80b,0xb00b,0xb80b,0x784b,0x804b,0x884b,0x904b,0x984b,
-0x30b,0x34b,0x38b,0x3cb,0x7cb,0xa4b,0x1e4b,0x784b,0x344b,0,0,0,0,0,0,0,
-0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,
-5,6,6,6,0,6,6,0,0,0,0,0,6,6,6,6,
-5,5,5,5,0,5,5,5,0,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,0,0,6,6,6,0,0,0,0,6,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,0x58b,0x11cb,0x17,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,0x58b,0x7cb,0xa4b,5,5,5,5,
-5,6,6,0,0,0,0,0x58b,0x68b,0x7cb,0xa4b,0x1e4b,0x17,0x17,0x17,0x17,
-0x17,0x17,0x17,0,0,0,0,0,0,0,0,0,5,5,5,5,
-5,5,5,5,0x1b,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,0,0,
-0,0x17,0x17,0x17,0x17,0x17,0x17,0x17,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0,
-0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b,0x784b,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,
-0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b,0x784b,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,
-0,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0,0,0,0,
-0,0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,
-5,0,0,0,0,0,0,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,0,0,0,0,0,
-0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,
-0,0,0x58b,0x68b,0x7cb,0x11cb,0x1e4b,0x784b,5,5,5,5,6,6,6,6,
-0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,
-0x249,0x289,0,0,0,0,0,0,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,
-0x50b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b,0xa00b,
-0xa80b,0xb00b,0xb80b,0x344b,0x34cb,0x348b,0x388b,0,5,5,5,5,5,5,5,5,
-5,5,0,6,6,0x13,0,0,5,5,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,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,0x58b,0x5cb,0x60b,0x64b,0x68b,0x7cb,0xa4b,0xccb,0x1e4b,0x344b,5,
-0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,
-6,6,6,6,6,0x58b,0x7cb,0xa4b,0x1e4b,0x17,0x17,0x17,0x17,0x17,0,0,
-0,0,0,0,5,5,5,5,5,0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b,
+0,0,0,0x17,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,0,5,5,0,0,0,
+5,0,0,5,5,5,5,5,5,5,0,0,5,0,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,0,0x17,0x58b,0x5cb,0x60b,0x7cb,0xa4b,0x1e4b,0x784b,0x788b,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,0x1b,0x1b,0x58b,0x5cb,0x60b,0x64b,0x68b,0x7cb,0xa4b,
+0,0,0,0,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x64b,0x68b,0x7cb,0xa4b,0x1e4b,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,0,5,5,0,0,0,0,0,0x58b,0x68b,0x7cb,0xa4b,0x1e4b,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,0x58b,0x7cb,0xa4b,0x1e4b,0x5cb,0x60b,0,0,0,0x17,
+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,0,0,0,0,0,0x17,
+0xa04b,0xa84b,0xb04b,0xb84b,0x788b,0x808b,0x888b,0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b,0x78cb,0x80cb,0x88cb,
+0x90cb,0x98cb,0xa0cb,0xa8cb,0xb0cb,0xb8cb,0x36cb,0x354b,0x34cb,0x348b,0x46cb,0x344b,0x4ecb,0x388b,0x3ccb,0x454b,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,0,0,0,0,0x5ecb,0x344b,5,5,
+0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,
+0,0,0x1e4b,0x800b,0x880b,0x900b,0x980b,0xa00b,0xa80b,0xb00b,0xb80b,0x784b,0x804b,0x884b,0x904b,0x984b,
+0x30b,0x34b,0x38b,0x3cb,0x7cb,0xa4b,0x1e4b,0x784b,0x344b,0,0,0,0,0,0,0,
+0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,
+5,6,6,6,0,6,6,0,0,0,0,0,6,6,6,6,
+5,5,5,5,0,5,5,5,0,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,0,0,6,6,6,0,0,0,0,6,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,0x58b,0x11cb,0x17,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,0x58b,0x7cb,0xa4b,5,5,5,5,
+5,6,6,0,0,0,0,0x58b,0x68b,0x7cb,0xa4b,0x1e4b,0x17,0x17,0x17,0x17,
+0x17,0x17,0x17,0,0,0,0,0,0,0,0,0,5,5,5,5,
+5,5,5,5,0x1b,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,0,0,
+0,0x17,0x17,0x17,0x17,0x17,0x17,0x17,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0,
+0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b,0x784b,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,
+0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b,0x784b,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,
+0,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0,0,0,0,
+0,0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,
+5,0,0,0,0,0,0,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,0,0,0,0,0,
+0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,
+2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,
+0,0,0x58b,0x68b,0x7cb,0x11cb,0x1e4b,0x784b,5,5,5,5,6,6,6,6,
+0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,
+0x249,0x289,0,0,0,0,0,0,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,
+0x50b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b,0xa00b,
+0xa80b,0xb00b,0xb80b,0x344b,0x34cb,0x348b,0x388b,0,5,5,5,5,5,5,5,5,
+5,5,0,6,6,0x13,0,0,5,5,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,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,0x58b,0x5cb,0x60b,0x64b,0x68b,0x7cb,0xa4b,0xccb,0x1e4b,0x344b,5,
+0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,
+6,6,6,6,6,0x58b,0x7cb,0xa4b,0x1e4b,0x17,0x17,0x17,0x17,0x17,0,0,
+0,0,0,0,5,5,5,5,5,0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x784b,0x49,0x89,0xc9,0x109,0x149,0x189,
-0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,6,8,6,8,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,6,6,6,6,6,6,6,0x17,0x17,0x17,0x17,0x17,
-0x17,0x17,0,0,0,0,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb,
-0xa4b,0xccb,0xf4b,0x11cb,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,8,8,8,6,6,6,6,8,8,6,6,0x17,
-0x17,0x10,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0,0,0,
-0,0x10,0,0,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,
-0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,5,5,5,5,
-5,5,5,6,6,6,6,6,8,6,6,6,6,6,6,6,
-6,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0x17,0x17,
-5,8,8,5,0,0,0,0,0,0,0,0,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,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,6,
-0x17,0x17,5,0,0,0,0,0,0,0,0,0,8,5,5,5,
-5,0x17,0x17,0x17,0x17,6,6,6,6,0x17,8,6,0x49,0x89,0xc9,0x109,
-0x149,0x189,0x1c9,0x209,0x249,0x289,5,0x17,5,0x17,0x17,0x17,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,8,
-8,8,6,6,6,6,6,6,6,6,6,8,0,0x58b,0x5cb,0x60b,
-0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,
-0x784b,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,
-5,5,5,5,5,5,5,5,8,8,8,6,6,6,8,8,
-6,8,6,6,0x17,0x17,0x17,0x17,0x17,0x17,6,0,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,
-5,0,5,5,5,5,0,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,0,5,5,5,5,5,5,5,5,5,
-5,0x17,0,0,0,0,0,0,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,8,8,8,6,6,6,6,6,
-6,6,6,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,
-0x249,0x289,0,0,0,0,0,0,5,5,8,8,0,0,6,6,
-6,6,6,6,6,0,0,0,6,6,6,6,6,0,0,0,
-0,0,0,0,0,0,0,0,6,6,8,8,0,5,5,5,
-5,5,5,5,5,0,0,5,5,0,0,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,0,5,5,5,5,5,5,
-5,0,5,5,0,5,5,5,5,5,0,6,6,5,8,8,
-6,8,8,8,8,0,0,8,8,0,0,8,8,8,0,0,
-5,0,0,0,0,0,0,8,0,0,0,0,0,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,8,8,8,6,6,6,6,6,6,6,6,
-8,8,6,6,6,8,6,5,5,5,5,0x17,0x17,0x17,0x17,0x17,
-0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0,0x17,6,5,
-5,5,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,0,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-8,8,8,6,6,6,6,6,6,8,6,8,8,8,8,6,
-6,8,6,6,5,5,0x17,5,0,0,0,0,0,0,0,0,
-0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,
+0,0,0,0,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x784b,0x49,0x89,0xc9,0x109,0x149,0x189,
+0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,6,8,6,8,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,6,6,6,6,6,6,6,0x17,0x17,0x17,0x17,0x17,
+0x17,0x17,0,0,0,0,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb,
+0xa4b,0xccb,0xf4b,0x11cb,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,8,8,8,6,6,6,6,8,8,6,6,0x17,
+0x17,0x10,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0,0,0,
+0,0x10,0,0,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,
+0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,5,5,5,5,
+5,5,5,6,6,6,6,6,8,6,6,6,6,6,6,6,
+6,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0x17,0x17,
+5,8,8,5,0,0,0,0,0,0,0,0,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,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,6,
+0x17,0x17,5,0,0,0,0,0,0,0,0,0,8,5,5,5,
+5,0x17,0x17,0x17,0x17,6,6,6,6,0x17,8,6,0x49,0x89,0xc9,0x109,
+0x149,0x189,0x1c9,0x209,0x249,0x289,5,0x17,5,0x17,0x17,0x17,5,5,5,5,
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,8,
-8,8,6,6,6,6,0,0,8,8,8,8,6,6,8,6,
-6,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
-0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,5,5,5,5,6,6,0,0,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-8,8,8,6,6,6,6,6,6,6,6,8,8,6,8,6,
-6,0x17,0x17,0x17,5,0,0,0,0,0,0,0,0,0,0,0,
-0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,
-0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0,0,0,
+8,8,6,6,6,6,6,6,6,6,6,8,0,0x58b,0x5cb,0x60b,
+0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,
+0x784b,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,
+5,5,5,5,5,5,5,5,8,8,8,6,6,6,8,8,
+6,8,6,6,0x17,0x17,0x17,0x17,0x17,0x17,6,0,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,
+5,0,5,5,5,5,0,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,0,5,5,5,5,5,5,5,5,5,
+5,0x17,0,0,0,0,0,0,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,8,8,8,6,6,6,6,6,
+6,6,6,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,
+0x249,0x289,0,0,0,0,0,0,5,5,8,8,0,0,6,6,
+6,6,6,6,6,0,0,0,6,6,6,6,6,0,0,0,
+0,0,0,0,0,0,0,0,6,6,8,8,0,5,5,5,
+5,5,5,5,5,0,0,5,5,0,0,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,0,5,5,5,5,5,5,
+5,0,5,5,0,5,5,5,5,5,0,6,6,5,8,8,
+6,8,8,8,8,0,0,8,8,0,0,8,8,8,0,0,
+5,0,0,0,0,0,0,8,0,0,0,0,0,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,8,8,8,6,6,6,6,6,6,6,6,
+8,8,6,6,6,8,6,5,5,5,5,0x17,0x17,0x17,0x17,0x17,
+0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0,0x17,6,5,
+5,5,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,0,
-0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+8,8,8,6,6,6,6,6,6,8,6,8,8,8,8,6,
+6,8,6,6,5,5,0x17,5,0,0,0,0,0,0,0,0,
+0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,8,
+8,8,6,6,6,6,0,0,8,8,8,8,6,6,8,6,
+6,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
+0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,5,5,5,5,6,6,0,0,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+8,8,8,6,6,6,6,6,6,6,6,8,8,6,8,6,
+6,0x17,0x17,0x17,5,0,0,0,0,0,0,0,0,0,0,0,
+0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,
+0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+5,5,5,5,5,5,5,5,5,5,5,6,8,6,8,8,
+6,6,6,6,6,6,8,6,5,0,0,0,0,0,0,0,
+8,8,6,6,6,6,8,6,6,6,6,6,0,0,0,0,
+0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x7cb,0xa4b,0x17,0x17,0x17,0x1b,
+5,5,5,5,5,5,5,5,5,5,5,5,8,8,8,6,
+6,6,6,6,6,6,6,6,8,6,6,0x17,0,0,0,0,
+0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,
+0x16cb,0x194b,0x1bcb,0,0,0,0,0,0,0,0,0,0,0,0,5,
+8,5,8,6,0x17,0x17,0x17,0,0,0,0,0,0,0,0,0,
+0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,
+5,5,5,5,5,5,5,0,0,5,0,0,5,5,5,5,
+5,5,5,5,0,5,5,0,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,8,8,8,8,8,8,0,8,
+8,0,0,6,6,8,6,5,6,5,0x17,5,8,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-5,5,5,5,5,5,5,5,5,5,5,6,8,6,8,8,
-6,6,6,6,6,6,8,6,5,0,0,0,0,0,0,0,
-8,8,6,6,6,6,8,6,6,6,6,6,0,0,0,0,
-0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x7cb,0xa4b,0x17,0x17,0x17,0x1b,
-5,5,5,5,5,5,5,5,5,5,5,5,8,8,8,6,
-6,6,6,6,6,6,6,6,8,6,6,0x17,0,0,0,0,
-0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,
-0x16cb,0x194b,0x1bcb,0,0,0,0,0,0,0,0,0,0,0,0,5,
-8,5,8,6,0x17,0x17,0x17,0,0,0,0,0,0,0,0,0,
-0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,
-5,5,5,5,5,5,5,0,0,5,0,0,5,5,5,5,
-5,5,5,5,0,5,5,0,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,8,8,8,8,8,8,0,8,
-8,0,0,6,6,8,6,5,6,5,0x17,5,8,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,5,5,5,5,5,5,5,5,
-0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,8,8,8,6,6,6,6,
-0,0,6,6,8,8,8,8,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,
-6,8,5,6,6,6,6,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,6,
-0,0,0,0,0,0,0,0,5,6,6,6,6,6,6,8,
-8,6,6,6,5,5,5,5,5,6,6,6,6,6,6,6,
-6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,0x17,0x17,0x17,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,8,8,8,6,6,6,6,
+0,0,6,6,8,8,8,8,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,
+6,8,5,6,6,6,6,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,6,
+0,0,0,0,0,0,0,0,5,6,6,6,6,6,6,8,
+8,6,6,6,5,5,5,5,5,6,6,6,6,6,6,6,
+6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,0x17,0x17,0x17,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,5,5,5,5,5,5,5,5,
-5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,8,
-6,6,0x17,0x17,0x17,5,0x17,0x17,5,0x17,0x17,0x17,0x17,0x17,0,0,
+5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,8,
+6,6,0x17,0x17,0x17,5,0x17,0x17,5,0x17,0x17,0x17,0x17,0x17,0,0,
0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,
-0x249,0x289,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,
-0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0,0,0,0x17,0x17,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,0,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,8,6,6,6,6,6,6,6,0,6,6,6,6,
-6,6,8,6,6,6,6,6,6,6,6,6,0,8,6,6,
-6,6,6,6,6,8,6,6,8,6,6,0,0,0,0,0,
-0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,0,0,6,6,6,6,6,6,6,6,6,6,
-6,6,6,6,6,6,5,6,0,0,0,0,0,0,0,0,
-0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,
-5,5,5,5,5,5,5,0,5,5,0,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,6,6,6,6,6,6,0,0,0,6,0,6,6,0,6,
-5,5,5,5,5,5,5,5,5,5,8,8,8,8,8,0,
-6,6,0,8,8,6,8,6,5,0,0,0,0,0,0,0,
-5,5,5,5,5,5,0,5,5,0,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,6,6,8,8,0x17,0x17,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0x19,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0x17,0xcd0b,0xcc0b,0xcb0b,0xd00b,
-0xca0b,0xcf0b,0xcb4b,0xd04b,0xc90b,0x37cb,0x37cb,0x364b,0x35cb,0xc94b,0x3fcb,0x350b,0x34cb,0x344b,0x344b,0x3ccb,
-0xcd0b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x19,0x19,0x19,0x34ca,0x354a,0x34ca,0x34ca,
-0x344a,0x348a,0x388a,0xf4a,0x11ca,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0,0x17,0x17,0x17,0x17,
-0x17,0,0,0,0,0,0,0,0,0,0,0,0x5ca,0x60a,0x64a,0x68a,
-0x6ca,0x70a,0x74a,0x78a,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x64a,0x68a,0x6ca,0x70a,0x74a,
-0x78a,0x58a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x58a,0x5ca,0x60a,0x64a,0x68a,0x5ca,
-0x60a,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x58a,0x5ca,0x60a,0x60a,0x64a,0x68a,0xc08a,0xc18a,
-0x58a,0x5ca,0x60a,0x60a,0x64a,0x68a,0x60a,0x60a,0x64a,0x64a,0x64a,0x64a,0x6ca,0x70a,0x70a,0x70a,
-0x74a,0x74a,0x78a,0x78a,0x78a,0x78a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x58a,0x5ca,0x60a,0x64a,0x64a,
-0x68a,0x68a,0x5ca,0x60a,0x58a,0x5ca,0x348a,0x388a,0x454a,0x348a,0x388a,0x35ca,5,5,5,5,
+0x249,0x289,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,
+0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0,0,0,0x17,0x17,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,0,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,8,6,6,6,6,6,6,6,0,6,6,6,6,
+6,6,8,6,6,6,6,6,6,6,6,6,0,8,6,6,
+6,6,6,6,6,8,6,6,8,6,6,0,0,0,0,0,
+0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,0,0,6,6,6,6,6,6,6,6,6,6,
+6,6,6,6,6,6,5,6,0,0,0,0,0,0,0,0,
+0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,
+5,5,5,5,5,5,5,0,5,5,0,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,6,6,6,6,6,6,0,0,0,6,0,6,6,0,6,
+5,5,5,5,5,5,5,5,5,5,8,8,8,8,8,0,
+6,6,0,8,8,6,8,6,5,0,0,0,0,0,0,0,
+5,5,5,5,5,5,0,5,5,0,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,6,6,8,8,0x17,0x17,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0x19,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0x17,0xcd0b,0xcc0b,0xcb0b,0xd00b,
+0xca0b,0xcf0b,0xcb4b,0xd04b,0xc90b,0x37cb,0x37cb,0x364b,0x35cb,0xc94b,0x3fcb,0x350b,0x34cb,0x344b,0x344b,0x3ccb,
+0xcd0b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x19,0x19,0x19,0x34ca,0x354a,0x34ca,0x34ca,
+0x344a,0x348a,0x388a,0xf4a,0x11ca,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0,0x17,0x17,0x17,0x17,
+0x17,0,0,0,0,0,0,0,0,0,0,0,0x5ca,0x60a,0x64a,0x68a,
+0x6ca,0x70a,0x74a,0x78a,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x64a,0x68a,0x6ca,0x70a,0x74a,
+0x78a,0x58a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x58a,0x5ca,0x60a,0x64a,0x68a,0x5ca,
+0x60a,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x58a,0x5ca,0x60a,0x60a,0x64a,0x68a,0xc08a,0xc18a,
+0x58a,0x5ca,0x60a,0x60a,0x64a,0x68a,0x60a,0x60a,0x64a,0x64a,0x64a,0x64a,0x6ca,0x70a,0x70a,0x70a,
+0x74a,0x74a,0x78a,0x78a,0x78a,0x78a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x58a,0x5ca,0x60a,0x64a,0x64a,
+0x68a,0x68a,0x5ca,0x60a,0x58a,0x5ca,0x348a,0x388a,0x454a,0x348a,0x388a,0x35ca,5,5,5,5,
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,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,0,0x10,0x10,0x10,0x10,
-0x10,0x10,0x10,0x10,0x10,0,0,0,0,0,0,0,5,5,5,5,
-5,5,5,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,0x49,0x89,0xc9,0x109,
-0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0x17,0x17,0,0,0,0,
+5,5,5,5,5,5,5,5,5,5,5,0,0x10,0x10,0x10,0x10,
+0x10,0x10,0x10,0x10,0x10,0,0,0,0,0,0,0,5,5,5,5,
+5,5,5,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,0x49,0x89,0xc9,0x109,
+0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0x17,0x17,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,0,0,6,6,6,6,
-6,0x17,0,0,0,0,0,0,0,0,0,0,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,
-6,6,6,0x17,0x17,0x17,0x17,0x17,0x1b,0x1b,0x1b,0x1b,4,4,4,4,
-0x17,0x1b,0,0,0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,
-0x149,0x189,0x1c9,0x209,0x249,0x289,0,0x7cb,0x1e4b,0x788b,0x790b,0x798b,0x7a0b,0x7a8b,0,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,0,0,0,0,0,5,5,5,0x54b,0x58b,0x5cb,0x60b,
-0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0x80b,0x84b,0x88b,0x8cb,0x90b,0x94b,0x98b,0x9cb,0xa0b,
-0x58b,0x5cb,0x60b,0x17,0x17,0x17,0x17,0,0,0,0,0,5,5,5,5,
-5,5,5,5,5,5,5,0,0,0,0,6,5,8,8,8,
-8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-0,0,0,0,0,0,0,6,6,6,6,4,4,4,4,4,
-4,4,4,4,4,4,4,4,4,4,0x17,4,6,0,0,0,
-0,0,0,0,0,0,0,0,8,8,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,
-5,5,5,5,0,0,0,0,0,0,0,0,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,0,0,6,6,6,6,
+6,0x17,0,0,0,0,0,0,0,0,0,0,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,
+6,6,6,0x17,0x17,0x17,0x17,0x17,0x1b,0x1b,0x1b,0x1b,4,4,4,4,
+0x17,0x1b,0,0,0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,
+0x149,0x189,0x1c9,0x209,0x249,0x289,0,0x7cb,0x1e4b,0x788b,0x790b,0x798b,0x7a0b,0x7a8b,0,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,0,0,0,0,0,5,5,5,0x54b,0x58b,0x5cb,0x60b,
+0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0x80b,0x84b,0x88b,0x8cb,0x90b,0x94b,0x98b,0x9cb,0xa0b,
+0x58b,0x5cb,0x60b,0x17,0x17,0x17,0x17,0,0,0,0,0,5,5,5,5,
+5,5,5,5,5,5,5,0,0,0,0,6,5,8,8,8,
+8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+0,0,0,0,0,0,0,6,6,6,6,4,4,4,4,4,
+4,4,4,4,4,4,4,4,4,4,0x17,4,6,0,0,0,
+0,0,0,0,0,0,0,0,8,8,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,
+5,5,5,5,0,0,0,0,0,0,0,0,5,5,5,5,
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,
-0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,
-5,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,
-5,5,0,0,0x1b,6,6,0x17,0x10,0x10,0x10,0x10,0,0,0,0,
+0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,
+5,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,
+5,5,0,0,0x1b,6,6,0x17,0x10,0x10,0x10,0x10,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,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,
+0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,8,8,6,6,6,0x1b,0x1b,
+0x1b,8,8,8,8,8,8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,6,
+6,6,6,6,6,6,6,0x1b,0x1b,6,6,6,6,6,6,6,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,6,6,6,6,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,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,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,
-0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,8,8,6,6,6,0x1b,0x1b,
-0x1b,8,8,8,8,8,8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,6,
-6,6,6,6,6,6,6,0x1b,0x1b,6,6,6,6,6,6,6,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,6,6,6,6,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,
+0,0,0,0,0x1b,0x1b,6,6,6,0x1b,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,0x1b,0x1b,6,6,6,0x1b,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,0x54b,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0x80b,
-0x84b,0x88b,0x8cb,0x90b,0x94b,0x98b,0x9cb,0xa0b,0,0,0,0,0,0,0,0,
-0,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,
-0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x58b,0x5cb,0x60b,0x64b,0x68b,0x58b,0x68b,0,0,0,
-0,0,0,0,0x249,0x289,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,
-0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x49,0x89,0xc9,0x109,0x149,0x189,
-0x1c9,0x209,0x249,0x289,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,2,2,
+0,0,0,0,0x54b,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0x80b,
+0x84b,0x88b,0x8cb,0x90b,0x94b,0x98b,0x9cb,0xa0b,0,0,0,0,0,0,0,0,
+0,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,
+0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x58b,0x5cb,0x60b,0x64b,0x68b,0x58b,0x68b,0,0,0,
+0,0,0,0,0x249,0x289,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,
+0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x49,0x89,0xc9,0x109,0x149,0x189,
+0x1c9,0x209,0x249,0x289,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,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,2,2,2,2,2,2,2,0,2,2,2,2,2,2,
+1,1,2,2,2,2,2,2,2,0,2,2,2,2,2,2,
2,2,2,2,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,2,2,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,1,0,1,1,0,0,1,0,
-0,1,1,0,0,1,1,1,1,0,1,1,1,1,1,1,
-1,1,2,2,2,2,0,2,0,2,2,2,2,2,2,2,
-0,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,
-1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,1,
-1,0,1,1,1,1,1,1,1,0,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,1,1,0,1,1,1,1,0,1,1,1,1,
-1,0,1,0,0,0,1,1,1,1,1,1,1,0,2,2,
-2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,
+2,2,2,2,2,2,2,2,1,0,1,1,0,0,1,0,
+0,1,1,0,0,1,1,1,1,0,1,1,1,1,1,1,
+1,1,2,2,2,2,0,2,0,2,2,2,2,2,2,2,
+0,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,
+1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,1,
+1,0,1,1,1,1,1,1,1,0,2,2,2,2,2,2,
+2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+2,2,2,2,1,1,0,1,1,1,1,0,1,1,1,1,
+1,0,1,0,0,0,1,1,1,1,1,1,1,0,2,2,
+2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,
-2,2,0,0,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,0x18,2,2,
+1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,
+2,2,0,0,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,0x18,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,0x18,2,2,2,2,2,2,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,0x18,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,2,2,2,2,2,0x18,2,2,
-2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,2,2,2,0x18,2,2,2,2,2,2,1,2,
-0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x49,0x89,0xc9,0x109,
-0x149,0x189,0x1c9,0x209,0,6,6,6,6,6,6,6,6,6,6,6,
-6,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6,
-6,6,6,6,6,6,6,6,6,6,6,0x1b,0x1b,0x1b,0x1b,6,
-6,6,6,6,6,6,6,6,6,6,6,6,6,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,6,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-6,0x1b,0x1b,0x17,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,6,6,6,6,6,6,6,6,0,
+2,2,2,2,2,2,2,0x18,2,2,2,2,2,2,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,0x18,2,2,2,2,2,2,2,2,
+2,2,2,2,2,2,2,2,2,2,2,2,2,0x18,2,2,
+2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,2,2,2,0x18,2,2,2,2,2,2,1,2,
+0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x49,0x89,0xc9,0x109,
+0x149,0x189,0x1c9,0x209,0,6,6,6,6,6,6,6,6,6,6,6,
+6,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6,
+6,6,6,6,6,6,6,6,6,6,6,0x1b,0x1b,0x1b,0x1b,6,
+6,6,6,6,6,6,6,6,6,6,6,6,6,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,6,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+6,0x1b,0x1b,0x17,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,6,6,6,6,6,6,6,6,0,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-6,0,0,6,6,6,6,6,6,6,0,6,6,0,6,6,
-6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,
-0x249,0x289,0,0,0,0,5,0x1b,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,
-5,5,5,5,5,0,0,0,6,6,6,6,6,6,6,4,
-4,4,4,4,4,4,0,0,5,5,5,5,5,5,5,5,
-5,5,5,5,6,6,6,6,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,
-0x249,0x289,0,0,0,0,0,0x19,5,5,5,5,5,0,0,0x58b,
-0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,6,6,6,6,6,6,6,0,
-0,0,0,0,0,0,0,0,2,2,2,2,6,6,6,6,
-6,6,6,4,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,
-0x249,0x289,0,0,0,0,0x17,0x17,1,1,2,2,2,2,2,2,
+6,0,0,6,6,6,6,6,6,6,0,6,6,0,6,6,
+6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,
+0x249,0x289,0,0,0,0,5,0x1b,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,
+5,5,5,5,5,0,0,0,6,6,6,6,6,6,6,4,
+4,4,4,4,4,4,0,0,5,5,5,5,5,5,5,5,
+5,5,5,5,6,6,6,6,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,
+0x249,0x289,0,0,0,0,0,0x19,5,5,5,5,5,0,0,0x58b,
+0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,6,6,6,6,6,6,6,0,
+0,0,0,0,0,0,0,0,2,2,2,2,6,6,6,6,
+6,6,6,4,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,
+0x249,0x289,0,0,0,0,0x17,0x17,1,1,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,
-0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x78cb,0x794b,0x814b,0x58b,0x5cb,0x60b,0x64b,0x68b,
-0x6cb,0x70b,0x74b,0x78b,0x1b,0x34cb,0x344b,0x3ccb,0x19,0x58b,0x5cb,0x788b,0x78cb,0,0,0,
-0,0,0,0,0,0,0,0,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b,
-0xa00b,0xa80b,0xb00b,0xb80b,0x784b,0x804b,0x884b,0x904b,0x984b,0xa04b,0xa84b,0xb04b,0xb84b,0x788b,0x808b,0x888b,
-0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b,0x78cb,0x80cb,0x984b,0xa04b,0xa84b,0xb04b,0xb84b,0x788b,0x808b,0x888b,
-0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b,0x1b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,
-0x900b,0xa00b,0x804b,0x788b,0x344b,0x354b,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,
-0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b,
-0xa00b,0xa80b,0xb00b,0xb80b,0x784b,0x804b,0x884b,0x904b,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0x18,0x18,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,5,5,5,5,0,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,0,5,5,0,5,0,0,5,
-0,5,5,5,5,5,5,5,5,5,5,0,5,5,5,5,
-0,5,0,5,0,0,0,0,0,0,5,0,0,0,0,5,
-0,5,0,5,0,5,5,5,0,5,5,0,5,0,0,5,
-0,5,0,5,0,5,0,5,0,5,5,0,5,0,0,5,
-5,5,5,0,5,5,5,5,5,5,5,0,5,5,5,5,
-0,5,5,5,5,0,5,0,5,5,5,5,5,5,5,5,
-5,5,0,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,0,0,0,0,0,5,5,5,0,5,5,5,
-5,5,0,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x2cb,0x2cb,0x30b,0x34b,
-0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x54b,0x54b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,
+0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x78cb,0x794b,0x814b,0x58b,0x5cb,0x60b,0x64b,0x68b,
+0x6cb,0x70b,0x74b,0x78b,0x1b,0x34cb,0x344b,0x3ccb,0x19,0x58b,0x5cb,0x788b,0x78cb,0,0,0,
+0,0,0,0,0,0,0,0,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b,
+0xa00b,0xa80b,0xb00b,0xb80b,0x784b,0x804b,0x884b,0x904b,0x984b,0xa04b,0xa84b,0xb04b,0xb84b,0x788b,0x808b,0x888b,
+0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b,0x78cb,0x80cb,0x984b,0xa04b,0xa84b,0xb04b,0xb84b,0x788b,0x808b,0x888b,
+0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b,0x1b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,
+0x900b,0xa00b,0x804b,0x788b,0x344b,0x354b,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,
+0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b,
+0xa00b,0xa80b,0xb00b,0xb80b,0x784b,0x804b,0x884b,0x904b,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0x18,0x18,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,5,5,5,5,0,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,0,5,5,0,5,0,0,5,
+0,5,5,5,5,5,5,5,5,5,5,0,5,5,5,5,
+0,5,0,5,0,0,0,0,0,0,5,0,0,0,0,5,
+0,5,0,5,0,5,5,5,0,5,5,0,5,0,0,5,
+0,5,0,5,0,5,0,5,0,5,5,0,5,0,0,5,
+5,5,5,0,5,5,5,5,5,5,5,0,5,5,5,5,
+0,5,5,5,5,0,5,0,5,5,5,5,5,5,5,5,
+5,5,0,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,0,0,0,0,0,5,5,5,0,5,5,5,
+5,5,0,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x2cb,0x2cb,0x30b,0x34b,
+0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x54b,0x54b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,
-0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
+0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0x1b,0x1b,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,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,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0x1b,0x1b,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,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,0x1b,0x1b,0x1b,0x1b,
0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,
0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0x1b,0x1b,0x1b,0x1b,
0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,
-0x1b,0x1b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,
-0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0x1b,0x1b,0x1b,0,0,0,0,0,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,
-0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,5,0x705,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,0x645,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,0x645,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,0x685,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,0xcc5,5,5,5,5,
-5,5,5,5,0xf45,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,0xf45,5,5,5,5,5,5,5,5,5,5,5,
-5,5,0x6c5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,0x605,5,5,5,5,5,5,5,5,5,5,
+0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,
+0x1b,0x1b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,
+0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0x1b,0x1b,0x1b,0,0,0,0,0,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,
+0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,5,0x705,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,0x645,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,0x645,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,0x685,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,0xcc5,5,5,5,5,
+5,5,5,5,0xf45,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,0xf45,5,5,5,5,5,5,5,5,5,5,5,
+5,5,0x6c5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,0x605,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,0x605,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,0x605,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,0x605,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,0x605,5,5,5,5,
-5,5,5,5,5,5,5,5,5,0x645,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,0x605,5,5,5,5,
+5,5,5,5,5,5,5,5,5,0x645,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,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,0,0,
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,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,0,0,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-0x785,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+0x785,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
-0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
-0,0x10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
+0,0x10,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,0,
+6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
-0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0,0,
-0,0,0,0
+0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0,0,
+0,0,0,0
};
static const UTrie2 propsTrie={
propsTrie_index,
- propsTrie_index+4532,
+ propsTrie_index+4532,
NULL,
- 4532,
- 17744,
+ 4532,
+ 17744,
0xa40,
- 0x1234,
+ 0x1234,
0x0,
0x0,
0x110000,
- 0x5700,
+ 0x5700,
NULL, 0, FALSE, FALSE, 0, NULL
};
-static const uint16_t propsVectorsTrie_index[31228]={
-0x4e8,0x4f0,0x4f8,0x500,0x518,0x520,0x528,0x530,0x538,0x540,0x548,0x550,0x558,0x560,0x568,0x570,
-0x577,0x57f,0x587,0x58f,0x592,0x59a,0x5a2,0x5aa,0x5b2,0x5ba,0x5c2,0x5ca,0x5d2,0x5da,0x5e2,0x5ea,
-0x5f2,0x5fa,0x601,0x609,0x611,0x619,0x621,0x629,0x631,0x639,0x63e,0x646,0x64d,0x655,0x65d,0x665,
-0x66d,0x675,0x67d,0x685,0x68c,0x694,0x69c,0x6a4,0x6ac,0x6b4,0x6bc,0x6c4,0x6cc,0x6d4,0x6dc,0x6e4,
-0x1a38,0xd5e,0xe35,0x6ec,0x508,0xe9c,0xea4,0x1bf2,0x1300,0x1310,0x12f8,0x1308,0x7c5,0x7cb,0x7d3,0x7db,
-0x7e3,0x7e9,0x7f1,0x7f9,0x801,0x807,0x80f,0x817,0x81f,0x825,0x82d,0x835,0x83d,0x845,0x84d,0x854,
-0x85c,0x862,0x86a,0x872,0x87a,0x880,0x888,0x890,0x898,0x1318,0x8a0,0x8a8,0x8b0,0x8b7,0x8bf,0x8c7,
-0x8cf,0x8d3,0x8db,0x8e2,0x8ea,0x8f2,0x8fa,0x902,0x162c,0x1634,0x90a,0x912,0x91a,0x922,0x92a,0x931,
-0x1692,0x1682,0x168a,0x1973,0x197b,0x1328,0x939,0x1320,0x1572,0x1572,0x1574,0x133c,0x133d,0x1330,0x1332,0x1334,
-0x169a,0x169c,0x941,0x169c,0x949,0x94e,0x956,0x16a1,0x95c,0x169c,0x962,0x96a,0xc39,0x16a9,0x16a9,0x972,
-0x16b9,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,
-0x16ba,0x16ba,0x16ba,0x16b1,0x97a,0x16c2,0x16c2,0x982,0xb59,0xb61,0xb69,0xb71,0x16d2,0x16ca,0x98a,0x992,
-0x99a,0x16dc,0x16e4,0x9a2,0x16da,0x9aa,0x1a40,0xd66,0xb79,0xb81,0xb89,0xb8e,0x18e1,0xc6c,0xc73,0x1849,
-0xc09,0x1a48,0xd6e,0xd76,0xd7e,0xd86,0xf47,0xf48,0x1939,0x193e,0xca8,0xcb0,0x19af,0x19b7,0x1b11,0xe3d,
-0x19bf,0xcf2,0xcfa,0x19c7,0x10f6,0x1196,0xf27,0xd8e,0x1869,0x1851,0x1861,0x1859,0x18f9,0x18f1,0x18b9,0xc19,
-0x1345,0x1345,0x1345,0x1345,0x1348,0x1345,0x1345,0x1350,0x9b2,0x1358,0x9b6,0x9be,0x1358,0x9c6,0x9ce,0x9d6,
-0x1368,0x1360,0x1370,0x9de,0x9e6,0x1378,0x9ee,0x9f6,0x1380,0x1388,0x1390,0x1398,0x9fe,0x13a0,0x13a7,0x13af,
-0x13b7,0x13bf,0x13c7,0x13cf,0x13d7,0x13de,0x13e6,0x13ee,0x13f6,0x13fe,0x1401,0x1403,0x16ec,0x17dc,0x17e2,0x1929,
-0x140b,0xa06,0xa0e,0x1525,0x152a,0x152d,0x1535,0x1413,0x153d,0x153d,0x1423,0x141b,0x142b,0x1433,0x143b,0x1443,
-0x144b,0x1453,0x145b,0x1463,0x17ea,0x1841,0x1983,0x1ad9,0x1473,0x147a,0x1482,0x148a,0x146b,0x1492,0x17f2,0x17f9,
-0x16f4,0x16f4,0x16f4,0x16f4,0x16f4,0x16f4,0x16f4,0x16f4,0x1801,0x1804,0x1801,0x1801,0x180c,0x1813,0x1815,0x181c,
-0x1824,0x1828,0x1828,0x182b,0x1828,0x1828,0x1831,0x1828,0x1871,0x1931,0x198b,0xb96,0xb9c,0x1c36,0x1c3e,0x1d15,
-0x18d1,0xc49,0xc4d,0x1946,0x18c1,0x18c1,0x18c1,0xc21,0x18c9,0xc41,0x1911,0xc98,0xc29,0xc31,0xc31,0x19cf,
-0x1901,0x1993,0xc83,0xc88,0xa16,0x16fc,0x16fc,0xa1e,0x1704,0x1704,0x1704,0x1704,0x1704,0x1704,0xa26,0x6f0,
-0x155a,0x157c,0xa2e,0x1584,0xa36,0x158c,0x1594,0x159c,0xa3e,0xa43,0x15a4,0x15ab,0xa48,0x170c,0x1921,0xc11,
-0xa50,0x1606,0x160d,0x15b3,0x1615,0x161c,0x15bb,0x15bf,0x15d8,0x15d8,0x15da,0x15c7,0x15cf,0x15cf,0x15d0,0x1624,
-0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
-0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
-0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
-0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
-0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
-0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
-0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
-0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
-0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
-0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
-0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
-0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
-0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1717,0x1879,0x1879,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
-0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e9,0x1a30,0x12b5,
-0x171f,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,
-0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,
-0x1725,0x1725,0x1725,0x1725,0xa58,0x172d,0xa60,0x1a50,0x19db,0x19db,0x19db,0x19db,0x19db,0x19db,0x19db,0x19db,
-0x19d7,0xd02,0x19eb,0x19e3,0x19ed,0x1a58,0x1a58,0xd96,0x18d9,0x194e,0x19a3,0x19a7,0x199b,0x1b09,0xcb8,0xcbb,
-0x1909,0xc90,0x1956,0xcc3,0x19f5,0x19f8,0xd0a,0x1a60,0x1a08,0x1a00,0xd12,0xd9e,0x1a68,0x1a6c,0xda6,0xff0,
-0x1a10,0xd1a,0xd22,0x1a74,0x1a84,0x1a7c,0xdae,0xef7,0xe45,0xe4d,0x1c85,0xfa8,0x1d32,0x1d32,0x1a8c,0xdb6,
-0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,
-0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,
-0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,
-0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,
-0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,
-0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,
-0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,
-0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,
-0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,
-0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,
-0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,
-0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,
-0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,
-0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,
-0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,
-0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,
-0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,
-0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,
-0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,
-0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,
-0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,
-0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0xa68,0xdbe,0xdc1,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,
-0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,
-0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
-0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
-0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
-0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
-0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
-0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
-0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
-0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
-0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
-0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
-0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
-0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
-0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x15f1,0x15f1,0x15f1,0x15f1,0x15f1,0x15f1,0x15f1,0x15f1,
-0x15f6,0x15fe,0x1839,0x12bd,0x1919,0x1919,0x12c1,0x12c8,0xa70,0xa78,0xa80,0x14b2,0x14b9,0x14c1,0xa88,0x14c9,
-0x14fa,0x14fa,0x14a2,0x14aa,0x14d1,0x14f1,0x14f2,0x1502,0x14d9,0x149a,0xa90,0x14e1,0xa98,0x14e9,0xaa0,0xaa4,
-0xca0,0x150a,0xaac,0xab4,0x1512,0x1518,0x151d,0xabc,0xacc,0x1562,0x156a,0x154d,0x1552,0xad4,0xadc,0xac4,
-0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,
-0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x1644,0x1644,0x1644,0x1644,
-0x1420,0x1420,0x1460,0x14a0,0x14e0,0x1520,0x1560,0x15a0,0x15dc,0x161c,0x1648,0x1688,0x16c8,0x1708,0x1748,0x1788,
-0x17c8,0x1804,0x1844,0x1884,0x18c4,0x18f8,0x1934,0x1974,0x19b4,0x19f4,0x1a30,0x1a70,0x1ab0,0x1af0,0x1b30,0x1b70,
-0xa80,0xac0,0xb00,0xb40,0xb80,0xa40,0xe75,0xa40,0xe97,0xa40,0xa40,0xa40,0xa40,0xbc0,0x12dd,0x12dd,
-0xed7,0xc00,0xa40,0xa40,0xa40,0xa40,0xf17,0xc2d,0xa40,0xa40,0xc6d,0xcad,0xced,0xd2d,0xe35,0xda5,
-0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,
-0x121d,0x121d,0x121d,0x121d,0xf57,0x125d,0x1092,0x10d2,0x129d,0x10dd,0x131d,0x131d,0x131d,0xf97,0xfb7,0xff7,
-0x135d,0x135d,0x1037,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,
-0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0x1052,
+static const uint16_t propsVectorsTrie_index[31228]={
+0x4e8,0x4f0,0x4f8,0x500,0x518,0x520,0x528,0x530,0x538,0x540,0x548,0x550,0x558,0x560,0x568,0x570,
+0x577,0x57f,0x587,0x58f,0x592,0x59a,0x5a2,0x5aa,0x5b2,0x5ba,0x5c2,0x5ca,0x5d2,0x5da,0x5e2,0x5ea,
+0x5f2,0x5fa,0x601,0x609,0x611,0x619,0x621,0x629,0x631,0x639,0x63e,0x646,0x64d,0x655,0x65d,0x665,
+0x66d,0x675,0x67d,0x685,0x68c,0x694,0x69c,0x6a4,0x6ac,0x6b4,0x6bc,0x6c4,0x6cc,0x6d4,0x6dc,0x6e4,
+0x1a38,0xd5e,0xe35,0x6ec,0x508,0xe9c,0xea4,0x1bf2,0x1300,0x1310,0x12f8,0x1308,0x7c5,0x7cb,0x7d3,0x7db,
+0x7e3,0x7e9,0x7f1,0x7f9,0x801,0x807,0x80f,0x817,0x81f,0x825,0x82d,0x835,0x83d,0x845,0x84d,0x854,
+0x85c,0x862,0x86a,0x872,0x87a,0x880,0x888,0x890,0x898,0x1318,0x8a0,0x8a8,0x8b0,0x8b7,0x8bf,0x8c7,
+0x8cf,0x8d3,0x8db,0x8e2,0x8ea,0x8f2,0x8fa,0x902,0x162c,0x1634,0x90a,0x912,0x91a,0x922,0x92a,0x931,
+0x1692,0x1682,0x168a,0x1973,0x197b,0x1328,0x939,0x1320,0x1572,0x1572,0x1574,0x133c,0x133d,0x1330,0x1332,0x1334,
+0x169a,0x169c,0x941,0x169c,0x949,0x94e,0x956,0x16a1,0x95c,0x169c,0x962,0x96a,0xc39,0x16a9,0x16a9,0x972,
+0x16b9,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,
+0x16ba,0x16ba,0x16ba,0x16b1,0x97a,0x16c2,0x16c2,0x982,0xb59,0xb61,0xb69,0xb71,0x16d2,0x16ca,0x98a,0x992,
+0x99a,0x16dc,0x16e4,0x9a2,0x16da,0x9aa,0x1a40,0xd66,0xb79,0xb81,0xb89,0xb8e,0x18e1,0xc6c,0xc73,0x1849,
+0xc09,0x1a48,0xd6e,0xd76,0xd7e,0xd86,0xf47,0xf48,0x1939,0x193e,0xca8,0xcb0,0x19af,0x19b7,0x1b11,0xe3d,
+0x19bf,0xcf2,0xcfa,0x19c7,0x10f6,0x1196,0xf27,0xd8e,0x1869,0x1851,0x1861,0x1859,0x18f9,0x18f1,0x18b9,0xc19,
+0x1345,0x1345,0x1345,0x1345,0x1348,0x1345,0x1345,0x1350,0x9b2,0x1358,0x9b6,0x9be,0x1358,0x9c6,0x9ce,0x9d6,
+0x1368,0x1360,0x1370,0x9de,0x9e6,0x1378,0x9ee,0x9f6,0x1380,0x1388,0x1390,0x1398,0x9fe,0x13a0,0x13a7,0x13af,
+0x13b7,0x13bf,0x13c7,0x13cf,0x13d7,0x13de,0x13e6,0x13ee,0x13f6,0x13fe,0x1401,0x1403,0x16ec,0x17dc,0x17e2,0x1929,
+0x140b,0xa06,0xa0e,0x1525,0x152a,0x152d,0x1535,0x1413,0x153d,0x153d,0x1423,0x141b,0x142b,0x1433,0x143b,0x1443,
+0x144b,0x1453,0x145b,0x1463,0x17ea,0x1841,0x1983,0x1ad9,0x1473,0x147a,0x1482,0x148a,0x146b,0x1492,0x17f2,0x17f9,
+0x16f4,0x16f4,0x16f4,0x16f4,0x16f4,0x16f4,0x16f4,0x16f4,0x1801,0x1804,0x1801,0x1801,0x180c,0x1813,0x1815,0x181c,
+0x1824,0x1828,0x1828,0x182b,0x1828,0x1828,0x1831,0x1828,0x1871,0x1931,0x198b,0xb96,0xb9c,0x1c36,0x1c3e,0x1d15,
+0x18d1,0xc49,0xc4d,0x1946,0x18c1,0x18c1,0x18c1,0xc21,0x18c9,0xc41,0x1911,0xc98,0xc29,0xc31,0xc31,0x19cf,
+0x1901,0x1993,0xc83,0xc88,0xa16,0x16fc,0x16fc,0xa1e,0x1704,0x1704,0x1704,0x1704,0x1704,0x1704,0xa26,0x6f0,
+0x155a,0x157c,0xa2e,0x1584,0xa36,0x158c,0x1594,0x159c,0xa3e,0xa43,0x15a4,0x15ab,0xa48,0x170c,0x1921,0xc11,
+0xa50,0x1606,0x160d,0x15b3,0x1615,0x161c,0x15bb,0x15bf,0x15d8,0x15d8,0x15da,0x15c7,0x15cf,0x15cf,0x15d0,0x1624,
+0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
+0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
+0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
+0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
+0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
+0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
+0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
+0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
+0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
+0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
+0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
+0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,
+0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1717,0x1879,0x1879,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,
+0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e9,0x1a30,0x12b5,
+0x171f,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,
+0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,
+0x1725,0x1725,0x1725,0x1725,0xa58,0x172d,0xa60,0x1a50,0x19db,0x19db,0x19db,0x19db,0x19db,0x19db,0x19db,0x19db,
+0x19d7,0xd02,0x19eb,0x19e3,0x19ed,0x1a58,0x1a58,0xd96,0x18d9,0x194e,0x19a3,0x19a7,0x199b,0x1b09,0xcb8,0xcbb,
+0x1909,0xc90,0x1956,0xcc3,0x19f5,0x19f8,0xd0a,0x1a60,0x1a08,0x1a00,0xd12,0xd9e,0x1a68,0x1a6c,0xda6,0xff0,
+0x1a10,0xd1a,0xd22,0x1a74,0x1a84,0x1a7c,0xdae,0xef7,0xe45,0xe4d,0x1c85,0xfa8,0x1d32,0x1d32,0x1a8c,0xdb6,
+0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,
+0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,
+0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,
+0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,
+0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,
+0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,
+0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,
+0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,
+0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,
+0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,
+0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,
+0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,
+0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,
+0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,
+0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,
+0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,
+0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,
+0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,
+0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,
+0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,
+0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,
+0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0xa68,0xdbe,0xdc1,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,
+0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,
+0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
+0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
+0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
+0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
+0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
+0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
+0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
+0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
+0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
+0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
+0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
+0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,
+0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x15f1,0x15f1,0x15f1,0x15f1,0x15f1,0x15f1,0x15f1,0x15f1,
+0x15f6,0x15fe,0x1839,0x12bd,0x1919,0x1919,0x12c1,0x12c8,0xa70,0xa78,0xa80,0x14b2,0x14b9,0x14c1,0xa88,0x14c9,
+0x14fa,0x14fa,0x14a2,0x14aa,0x14d1,0x14f1,0x14f2,0x1502,0x14d9,0x149a,0xa90,0x14e1,0xa98,0x14e9,0xaa0,0xaa4,
+0xca0,0x150a,0xaac,0xab4,0x1512,0x1518,0x151d,0xabc,0xacc,0x1562,0x156a,0x154d,0x1552,0xad4,0xadc,0xac4,
+0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,
+0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x1644,0x1644,0x1644,0x1644,
+0x1420,0x1420,0x1460,0x14a0,0x14e0,0x1520,0x1560,0x15a0,0x15dc,0x161c,0x1648,0x1688,0x16c8,0x1708,0x1748,0x1788,
+0x17c8,0x1804,0x1844,0x1884,0x18c4,0x18f8,0x1934,0x1974,0x19b4,0x19f4,0x1a30,0x1a70,0x1ab0,0x1af0,0x1b30,0x1b70,
+0xa80,0xac0,0xb00,0xb40,0xb80,0xa40,0xe75,0xa40,0xe97,0xa40,0xa40,0xa40,0xa40,0xbc0,0x12dd,0x12dd,
+0xed7,0xc00,0xa40,0xa40,0xa40,0xa40,0xf17,0xc2d,0xa40,0xa40,0xc6d,0xcad,0xced,0xd2d,0xe35,0xda5,
+0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,
+0x121d,0x121d,0x121d,0x121d,0xf57,0x125d,0x1092,0x10d2,0x129d,0x10dd,0x131d,0x131d,0x131d,0xf97,0xfb7,0xff7,
+0x135d,0x135d,0x1037,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,
+0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0x1052,
0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
-0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
+0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
-0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
+0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
-0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
+0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
-0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
+0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
-0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
+0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
-0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
+0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
-0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
+0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
-0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
+0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
-0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
+0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
-0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
-0xde5,0xdf5,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
-0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
-0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,
-0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x111d,
-0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,
-0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x115d,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0xba4,0xbab,0xbb3,0xbbb,0x1881,0x1881,0x1881,0xbc3,0xbcb,0xbce,0x18b1,0x18a9,0xc01,0xd2a,0xd2e,0xd32,
-0x508,0x508,0x508,0x508,0xd3a,0x1a18,0xd42,0xf3f,0x1735,0xae4,0xaea,0x1000,0xbd6,0x18e9,0xc7b,0x508,
-0x174a,0x173d,0x1742,0x1889,0xbde,0xbe6,0x1134,0x113a,0x1c6d,0xf5d,0x1c5d,0x6f8,0x508,0x508,0x508,0x508,
-0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0xfb0,0xfb8,0xfc0,0x508,0x508,0x508,0x508,
-0xbee,0xbf1,0xdc9,0x1cd5,0xff8,0x700,0x508,0x1092,0xccb,0xd4a,0x508,0x508,0x1c02,0xeff,0xf07,0x1d1d,
-0xc55,0xc5c,0xc64,0x1a94,0x1cb5,0x508,0x1c95,0xfd0,0x1a9c,0xdd1,0xdd9,0xde1,0x1020,0x708,0x508,0x508,
-0x1aa4,0x1aa4,0x710,0x508,0x1d4a,0x10aa,0x1d42,0x10b2,0x1e0e,0x11ac,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0xde9,0x1e66,0x1291,0x508,0x508,0x1e2e,0x11d4,0x11db,0x718,0x508,0x71c,0x1248,0x11e3,
-0x1b19,0x1b1b,0xe55,0xe5c,0x1aac,0x1ab4,0xdf1,0xf1f,0x1bfa,0xee7,0xeef,0xfc8,0x1c1a,0x1c1e,0x1c26,0x1040,
-0xf93,0xf98,0x724,0x508,0x109a,0x10a2,0x1c7d,0xfa0,0xf75,0xf7b,0xf83,0xf8b,0x508,0x508,0x508,0x508,
-0x1daa,0x1da2,0x1124,0x112c,0x1cfd,0x1cf5,0x1068,0x508,0x508,0x508,0x508,0x508,0x1ce5,0x1028,0x1030,0x1038,
-0x1cad,0x1ca5,0xfe0,0x111c,0x1c2e,0xf2f,0x72c,0x508,0x1078,0x1080,0x508,0x508,0x508,0x508,0x508,0x508,
-0x1e06,0x118e,0x734,0x508,0x508,0x1d0d,0x1d05,0x1070,0x1250,0x1256,0x125e,0x508,0x508,0x11eb,0x11ef,0x11f7,
-0x1dde,0x1dd6,0x1176,0x1dce,0x1dc6,0x73c,0x1cdd,0x1018,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x10da,0x10df,0x10e7,0x10ee,0x110e,0x1114,0x508,0x508,0x115a,0x115e,0x1166,0x119e,0x11a4,0x744,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x11bc,0x508,0x508,0x508,0x508,0x508,0x748,0x1e4e,0x1238,
-0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,
-0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x1963,0xcd3,0xcda,0xcda,0xcda,
-0x196b,0x196b,0x196b,0xce2,0x1d3a,0x1d3a,0x1d3a,0x1d3a,0x1d3a,0x1d3a,0x750,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,
-0x1b23,0xe64,0xfe8,0x758,0x508,0x508,0x75c,0xf37,0x1ccd,0x1cc5,0x1008,0x1010,0x764,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x1e26,0x1e1e,0x11cc,0x508,0x508,0x508,0x1c12,0x1c12,0xf0f,0x1c0a,0xf17,0x508,0x508,0x1106,
-0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,
-0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dbe,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,
-0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1266,0x126c,0x1286,0x1289,0x1289,0x1289,0x76c,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1c65,0x1c65,0x1c65,
-0xf50,0xf55,0x774,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1752,0x1752,0x1752,
-0x1752,0x1752,0x1752,0x1752,0xaf2,0x1762,0xafa,0x1763,0x175a,0x176b,0x1771,0x1779,0xb02,0x18a1,0x18a1,0x77c,
-0x508,0x508,0x508,0x508,0x11c4,0x1891,0x1891,0xbf9,0xcea,0x508,0x508,0x508,0x508,0x17aa,0x17b1,0xb0a,
-0x17b4,0xb12,0xb1a,0xb22,0x17ae,0xb2a,0xb32,0xb3a,0x17b3,0x17bb,0x17aa,0x17b1,0x17ad,0x17b4,0x17bc,0x17ab,
-0x17b2,0x17ae,0xb41,0x1781,0x1789,0x1790,0x1797,0x1784,0x178c,0x1793,0x179a,0xb49,0x17a2,0x1d62,0x1d62,0x1d62,
-0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d52,0x1d55,0x1d52,
-0x1d5c,0x10ca,0x784,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x10fe,0x78c,0x508,
-0x508,0x508,0x508,0x508,0x508,0x1e46,0x11ff,0x794,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x1e56,0x1240,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1c9d,0x1c9d,0x1c9d,
-0x1c9d,0x1c9d,0x1c9d,0xfd8,0x508,0x1d9a,0x1d92,0x10d2,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x798,0x1e16,0x11b4,0x508,0x508,0x1207,0x1208,0x7a0,0x508,0x508,0x508,0x508,0x508,0xeac,0xeb4,0xebc,
-0xec4,0xecc,0xed4,0xedb,0xedf,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x7a4,0x1048,0x1ced,0x104e,0x1ced,0x1056,0x105b,0x1060,0x1060,0x1d72,0x1d82,0x1d8a,
-0x10ba,0x1d7a,0x1e36,0x10c2,0x1dee,0x1e3e,0x1e3e,0x117e,0x1186,0x121f,0x1225,0x122a,0x1230,0x1e5e,0x1e5e,0x1e5e,
-0x1e5e,0x1274,0x1e5e,0x127a,0x127e,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,
-0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,
-0x7ac,0x7ac,0x7ac,0x7ac,0x7ad,0xb51,0x17c4,0x17c4,0x17c4,0x7b5,0x7b5,0x7b5,0x7b5,0x1899,0x1899,0x1899,
-0x1899,0x1899,0x1899,0x1899,0x7bd,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,
-0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,
-0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,
-0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,
-0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x1a20,0xd52,0x1a28,0x1a28,0xd56,0xe6c,0xe74,0xe7c,0x1ae9,0x1ad1,0x1af1,
-0x1af9,0x1ae1,0xe01,0xe05,0xe0c,0xe14,0xe1b,0xe23,0xe2b,0xe2d,0xe2d,0xe2d,0xe2d,0x1b5a,0x1b62,0x1b5a,
-0x1b68,0x1b70,0x1b3b,0x1b78,0x1b80,0x1b5a,0x1b88,0x1b90,0x1b97,0x1b9f,0x1b43,0x1b5a,0x1ba4,0x1b4b,0x1b52,0x1bac,
-0x1bb2,0x1c4e,0x1c55,0x1c46,0x1bba,0x1bc2,0x1bca,0x1bd2,0x1cbd,0x1bda,0x1be2,0xe84,0xe8c,0x1b2b,0x1b2b,0x1b2b,
-0xe94,0x1c75,0x1c75,0xf65,0xf6d,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,
-0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abe,0x1abc,0x1ac6,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,
-0x1ac9,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0xdf9,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,
-0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d2a,0x1d25,0x1d25,0x1d25,0x1088,0x108a,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,
-0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,
-0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,
-0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,
-0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1142,0x1b33,0x1de6,0x1de6,0x1de6,0x1de6,0x1de6,0x1de6,0x1de6,0x114a,
-0x1152,0x1210,0x1217,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x116e,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
-0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,
-0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,
-0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,
-0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x12d0,0x1299,0x1b01,
-0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,
-0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,
-0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x12a1,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
-0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
-0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
-0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
-0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,
-0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x12d8,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
-0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
-0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
-0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x12a5,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,
-0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,
-0x1e6e,0x12ad,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
-0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
-0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
-0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
-0x1299,0x12a5,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,
-0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,
-0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,
-0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x12e0,0x1bea,0x1bea,0x1bea,0x1bea,
-0x1bea,0x1bea,0x12e8,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,
-0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,
-0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,
-0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,
-0x1d6a,0x1d6a,0x12f0,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1664,0x1664,0x1664,
-0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,
-0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,
-0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,
-0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1654,0x166c,0x166c,0x166c,
-0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,
-0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,
-0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,
-0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x165c,0x1664,0x1664,0x1664,
-0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,
-0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,
-0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,
-0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x166c,0x166c,0x166c,
-0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,
-0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,
-0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,
-0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x17cc,0x17cc,0x17cc,
-0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,
-0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,
-0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,
-0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x1b01,0x1b01,0x1b01,
-0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,
-0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,
-0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,
-0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1d6a,0x1d6a,0x1d6a,
-0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,
-0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,
-0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,
-0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1db2,0x1db2,0x1db2,
-0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,
-0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,
-0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,
-0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1df6,0x1df6,0x1df6,
-0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,
-0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,
-0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,
-0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1e6e,0x1e6e,0x1e6e,
-0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,
-0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,
-0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,
-0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x4e7,0x4e7,0x4e7,
-0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2ca,0x2d3,0x2cd,0x2cd,0x2d0,0x2c7,0x2c7,
-0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,
-0x7fb,0x7f5,0x7da,0x7d1,0x7c8,0x7c5,0x7bc,0x7d7,0x7c2,0x7ce,0x7d1,0x7ec,0x7e3,0x7d4,0x7f8,0x7cb,
-0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7e0,0x7dd,0x7e6,0x7e6,0x7e6,0x7f5,
-0x7bc,0x807,0x807,0x807,0x807,0x807,0x807,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,
-0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x7c2,0x7c8,0x7ce,0x7f2,0x7b6,
-0x7ef,0x804,0x804,0x804,0x804,0x804,0x804,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,
-0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7c2,0x7e9,0x7bf,0x7e6,0x2c7,
+0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
+0xde5,0xdf5,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,
+0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65,
+0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,
+0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x111d,
+0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,
+0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x115d,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0xba4,0xbab,0xbb3,0xbbb,0x1881,0x1881,0x1881,0xbc3,0xbcb,0xbce,0x18b1,0x18a9,0xc01,0xd2a,0xd2e,0xd32,
+0x508,0x508,0x508,0x508,0xd3a,0x1a18,0xd42,0xf3f,0x1735,0xae4,0xaea,0x1000,0xbd6,0x18e9,0xc7b,0x508,
+0x174a,0x173d,0x1742,0x1889,0xbde,0xbe6,0x1134,0x113a,0x1c6d,0xf5d,0x1c5d,0x6f8,0x508,0x508,0x508,0x508,
+0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0xfb0,0xfb8,0xfc0,0x508,0x508,0x508,0x508,
+0xbee,0xbf1,0xdc9,0x1cd5,0xff8,0x700,0x508,0x1092,0xccb,0xd4a,0x508,0x508,0x1c02,0xeff,0xf07,0x1d1d,
+0xc55,0xc5c,0xc64,0x1a94,0x1cb5,0x508,0x1c95,0xfd0,0x1a9c,0xdd1,0xdd9,0xde1,0x1020,0x708,0x508,0x508,
+0x1aa4,0x1aa4,0x710,0x508,0x1d4a,0x10aa,0x1d42,0x10b2,0x1e0e,0x11ac,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0xde9,0x1e66,0x1291,0x508,0x508,0x1e2e,0x11d4,0x11db,0x718,0x508,0x71c,0x1248,0x11e3,
+0x1b19,0x1b1b,0xe55,0xe5c,0x1aac,0x1ab4,0xdf1,0xf1f,0x1bfa,0xee7,0xeef,0xfc8,0x1c1a,0x1c1e,0x1c26,0x1040,
+0xf93,0xf98,0x724,0x508,0x109a,0x10a2,0x1c7d,0xfa0,0xf75,0xf7b,0xf83,0xf8b,0x508,0x508,0x508,0x508,
+0x1daa,0x1da2,0x1124,0x112c,0x1cfd,0x1cf5,0x1068,0x508,0x508,0x508,0x508,0x508,0x1ce5,0x1028,0x1030,0x1038,
+0x1cad,0x1ca5,0xfe0,0x111c,0x1c2e,0xf2f,0x72c,0x508,0x1078,0x1080,0x508,0x508,0x508,0x508,0x508,0x508,
+0x1e06,0x118e,0x734,0x508,0x508,0x1d0d,0x1d05,0x1070,0x1250,0x1256,0x125e,0x508,0x508,0x11eb,0x11ef,0x11f7,
+0x1dde,0x1dd6,0x1176,0x1dce,0x1dc6,0x73c,0x1cdd,0x1018,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x10da,0x10df,0x10e7,0x10ee,0x110e,0x1114,0x508,0x508,0x115a,0x115e,0x1166,0x119e,0x11a4,0x744,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x11bc,0x508,0x508,0x508,0x508,0x508,0x748,0x1e4e,0x1238,
+0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,
+0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x1963,0xcd3,0xcda,0xcda,0xcda,
+0x196b,0x196b,0x196b,0xce2,0x1d3a,0x1d3a,0x1d3a,0x1d3a,0x1d3a,0x1d3a,0x750,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,
+0x1b23,0xe64,0xfe8,0x758,0x508,0x508,0x75c,0xf37,0x1ccd,0x1cc5,0x1008,0x1010,0x764,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x1e26,0x1e1e,0x11cc,0x508,0x508,0x508,0x1c12,0x1c12,0xf0f,0x1c0a,0xf17,0x508,0x508,0x1106,
+0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,
+0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dbe,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,
+0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1266,0x126c,0x1286,0x1289,0x1289,0x1289,0x76c,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1c65,0x1c65,0x1c65,
+0xf50,0xf55,0x774,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1752,0x1752,0x1752,
+0x1752,0x1752,0x1752,0x1752,0xaf2,0x1762,0xafa,0x1763,0x175a,0x176b,0x1771,0x1779,0xb02,0x18a1,0x18a1,0x77c,
+0x508,0x508,0x508,0x508,0x11c4,0x1891,0x1891,0xbf9,0xcea,0x508,0x508,0x508,0x508,0x17aa,0x17b1,0xb0a,
+0x17b4,0xb12,0xb1a,0xb22,0x17ae,0xb2a,0xb32,0xb3a,0x17b3,0x17bb,0x17aa,0x17b1,0x17ad,0x17b4,0x17bc,0x17ab,
+0x17b2,0x17ae,0xb41,0x1781,0x1789,0x1790,0x1797,0x1784,0x178c,0x1793,0x179a,0xb49,0x17a2,0x1d62,0x1d62,0x1d62,
+0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d52,0x1d55,0x1d52,
+0x1d5c,0x10ca,0x784,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x10fe,0x78c,0x508,
+0x508,0x508,0x508,0x508,0x508,0x1e46,0x11ff,0x794,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x1e56,0x1240,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1c9d,0x1c9d,0x1c9d,
+0x1c9d,0x1c9d,0x1c9d,0xfd8,0x508,0x1d9a,0x1d92,0x10d2,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x798,0x1e16,0x11b4,0x508,0x508,0x1207,0x1208,0x7a0,0x508,0x508,0x508,0x508,0x508,0xeac,0xeb4,0xebc,
+0xec4,0xecc,0xed4,0xedb,0xedf,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x7a4,0x1048,0x1ced,0x104e,0x1ced,0x1056,0x105b,0x1060,0x1060,0x1d72,0x1d82,0x1d8a,
+0x10ba,0x1d7a,0x1e36,0x10c2,0x1dee,0x1e3e,0x1e3e,0x117e,0x1186,0x121f,0x1225,0x122a,0x1230,0x1e5e,0x1e5e,0x1e5e,
+0x1e5e,0x1274,0x1e5e,0x127a,0x127e,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,
+0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,
+0x7ac,0x7ac,0x7ac,0x7ac,0x7ad,0xb51,0x17c4,0x17c4,0x17c4,0x7b5,0x7b5,0x7b5,0x7b5,0x1899,0x1899,0x1899,
+0x1899,0x1899,0x1899,0x1899,0x7bd,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,
+0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,
+0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,
+0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,
+0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x1a20,0xd52,0x1a28,0x1a28,0xd56,0xe6c,0xe74,0xe7c,0x1ae9,0x1ad1,0x1af1,
+0x1af9,0x1ae1,0xe01,0xe05,0xe0c,0xe14,0xe1b,0xe23,0xe2b,0xe2d,0xe2d,0xe2d,0xe2d,0x1b5a,0x1b62,0x1b5a,
+0x1b68,0x1b70,0x1b3b,0x1b78,0x1b80,0x1b5a,0x1b88,0x1b90,0x1b97,0x1b9f,0x1b43,0x1b5a,0x1ba4,0x1b4b,0x1b52,0x1bac,
+0x1bb2,0x1c4e,0x1c55,0x1c46,0x1bba,0x1bc2,0x1bca,0x1bd2,0x1cbd,0x1bda,0x1be2,0xe84,0xe8c,0x1b2b,0x1b2b,0x1b2b,
+0xe94,0x1c75,0x1c75,0xf65,0xf6d,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,
+0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abe,0x1abc,0x1ac6,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,
+0x1ac9,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0xdf9,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,
+0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d2a,0x1d25,0x1d25,0x1d25,0x1088,0x108a,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,
+0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,
+0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,
+0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,
+0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1142,0x1b33,0x1de6,0x1de6,0x1de6,0x1de6,0x1de6,0x1de6,0x1de6,0x114a,
+0x1152,0x1210,0x1217,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x116e,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,
+0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,
+0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,
+0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,
+0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x12d0,0x1299,0x1b01,
+0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,
+0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,
+0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x12a1,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
+0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
+0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
+0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
+0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,
+0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x12d8,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
+0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
+0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
+0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x12a5,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,
+0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,
+0x1e6e,0x12ad,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
+0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
+0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
+0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,
+0x1299,0x12a5,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,
+0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,
+0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,
+0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x12e0,0x1bea,0x1bea,0x1bea,0x1bea,
+0x1bea,0x1bea,0x12e8,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,
+0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,
+0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,
+0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,
+0x1d6a,0x1d6a,0x12f0,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1664,0x1664,0x1664,
+0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,
+0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,
+0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,
+0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1654,0x166c,0x166c,0x166c,
+0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,
+0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,
+0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,
+0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x165c,0x1664,0x1664,0x1664,
+0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,
+0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,
+0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,
+0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x166c,0x166c,0x166c,
+0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,
+0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,
+0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,
+0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x17cc,0x17cc,0x17cc,
+0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,
+0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,
+0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,
+0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x1b01,0x1b01,0x1b01,
+0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,
+0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,
+0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,
+0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1d6a,0x1d6a,0x1d6a,
+0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,
+0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,
+0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,
+0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1db2,0x1db2,0x1db2,
+0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,
+0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,
+0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,
+0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1df6,0x1df6,0x1df6,
+0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,
+0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,
+0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,
+0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1e6e,0x1e6e,0x1e6e,
+0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,
+0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,
+0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,
+0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x4e7,0x4e7,0x4e7,
+0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2ca,0x2d3,0x2cd,0x2cd,0x2d0,0x2c7,0x2c7,
+0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,
+0x7fb,0x7f5,0x7da,0x7d1,0x7c8,0x7c5,0x7bc,0x7d7,0x7c2,0x7ce,0x7d1,0x7ec,0x7e3,0x7d4,0x7f8,0x7cb,
+0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7e0,0x7dd,0x7e6,0x7e6,0x7e6,0x7f5,
+0x7bc,0x807,0x807,0x807,0x807,0x807,0x807,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,
+0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x7c2,0x7c8,0x7ce,0x7f2,0x7b6,
+0x7ef,0x804,0x804,0x804,0x804,0x804,0x804,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,
+0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7c2,0x7e9,0x7bf,0x7e6,0x2c7,
+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,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,0,0,0,0,0,0,
+0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2e5,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,
+0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,
+0x2d9,0x651,0x810,0x813,0x657,0x813,0x80d,0x64e,0x645,0x2df,0x663,0x2e2,0x816,0x63c,0x65a,0x80a,
+0x654,0x660,0x642,0x642,0x648,0x2dc,0x64e,0x64b,0x645,0x642,0x663,0x2e2,0x63f,0x63f,0x63f,0x651,
+0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x66c,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,
+0x66c,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x65d,0x66c,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x66c,0x666,
+0x669,0x669,0x2e8,0x2e8,0x2e8,0x2e8,0x666,0x2e8,0x669,0x669,0x669,0x2e8,0x669,0x669,0x2e8,0x2e8,
+0x666,0x2e8,0x669,0x669,0x2e8,0x2e8,0x2e8,0x65d,0x666,0x669,0x669,0x2e8,0x669,0x2e8,0x666,0x2e8,
+0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,
+0x2f4,0x66f,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee,
+0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x678,0x66f,0x2f7,0x2ee,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee,
+0x2f7,0x66f,0x67b,0x675,0x2f7,0x2ee,0x2f7,0x2ee,0x66f,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x67b,
+0x675,0x678,0x66f,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x672,0x67e,0x678,0x66f,0x2f7,0x672,0x2f7,0x2ee,
+0x2f7,0x2ee,0x678,0x66f,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,
+0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x678,0x66f,0x2f7,0x2ee,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee,
+0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f1,
+0x2fa,0x306,0x306,0x2fa,0x306,0x2fa,0x306,0x306,0x2fa,0x306,0x306,0x306,0x2fa,0x2fa,0x306,0x306,
+0x306,0x306,0x2fa,0x306,0x306,0x2fa,0x306,0x306,0x306,0x2fa,0x2fa,0x2fa,0x306,0x306,0x2fa,0x306,
+0x309,0x2fd,0x306,0x2fa,0x306,0x2fa,0x306,0x306,0x2fa,0x306,0x2fa,0x2fa,0x306,0x2fa,0x306,0x309,
+0x2fd,0x306,0x306,0x306,0x2fa,0x306,0x2fa,0x306,0x306,0x2fa,0x2fa,0x303,0x306,0x2fa,0x2fa,0x2fa,
+0x303,0x303,0x303,0x303,0x30c,0x30c,0x300,0x30c,0x30c,0x300,0x30c,0x30c,0x300,0x309,0x681,0x309,
+0x681,0x309,0x681,0x309,0x681,0x309,0x681,0x309,0x681,0x309,0x681,0x309,0x681,0x2fa,0x309,0x2fd,
+0x309,0x2fd,0x309,0x2fd,0x306,0x2fa,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,
+0x2fd,0x30c,0x30c,0x300,0x309,0x2fd,0x9ea,0x9ea,0x9ed,0x9e7,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,
+0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,
+0x309,0x2fd,0x309,0x2fd,0x9ed,0x9e7,0x9ed,0x9e7,0x9ea,0x9e4,0x9ed,0x9e7,0xbaf,0xcb7,0x9ea,0x9e4,
+0x9ea,0x9e4,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7,
+0xcb7,0xcb7,0xcb7,0xdb6,0xdb6,0xdb6,0xdb9,0xdb9,0xdb6,0xdb9,0xdb9,0xdb6,0xdb6,0xdb9,0xefa,0xefd,
+0xefd,0xefd,0xefd,0xefa,0xefd,0xefa,0xefd,0xefa,0xefd,0xefa,0xefd,0xefa,0x30f,0x684,0x30f,0x30f,
+0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x684,0x30f,0x30f,
+0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,
+0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x312,0x30f,0x30f,0x30f,
+0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,
+0x30f,0x9f0,0x9f0,0x9f0,0x9f0,0x9f0,0xcba,0xcba,0x327,0x327,0x327,0x327,0x327,0x327,0x327,0x327,
+0x327,0x31e,0x31e,0x31e,0x31e,0x31e,0x31e,0x31e,0x31b,0x31b,0x318,0x318,0x68a,0x318,0x31e,0x68d,
+0x321,0x68d,0x68d,0x68d,0x321,0x68d,0x31e,0x31e,0x690,0x324,0x318,0x318,0x318,0x318,0x318,0x318,
+0x687,0x687,0x687,0x687,0x315,0x687,0x318,0xb25,0x327,0x327,0x327,0x327,0x327,0x318,0x318,0x318,
+0x318,0x318,0x9f9,0x9f9,0x9f6,0x9f3,0x9f6,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,
+0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,
+0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,
+0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,
+0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,
+0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x696,0x696,0x94b,0x696,0x696,0x94e,0xb28,0xb28,
+0xb28,0xb28,0xb28,0xb28,0xb28,0xb28,0xb28,0xc6c,0xd83,0xd83,0xd83,0xd83,0xd83,0xd83,0xd83,0xd83,
+0xebe,0xebe,0xebe,0xebe,0xec1,0xd86,0xd86,0xd86,0x699,0x699,0xb2b,0xcb4,0xcb4,0xcb4,0xcb4,0xcb4,
+0xcb4,0xcb4,0xcb4,0xcb4,0xcb4,0xcb4,0xcb4,0xcb4,0xfa8,0xfa5,0xfa8,0xfa5,0x333,0x33c,0xfa8,0xfa5,
+9,9,0x342,0xf00,0xf00,0xf00,0x32a,0x14fd,9,9,9,9,0x33f,0x32d,0x351,0x330,
+0x351,0x351,0x351,9,0x351,9,0x351,0x351,0x348,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,
+0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,9,0x69f,0x69f,0x69f,0x69f,0x69f,
+0x69f,0x69f,0x351,0x351,0x348,0x348,0x348,0x348,0x348,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,
+0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x345,0x69c,0x69c,0x69c,0x69c,0x69c,
+0x69c,0x69c,0x348,0x348,0x348,0x348,0x348,0xfa8,0x354,0x354,0x357,0x351,0x351,0x354,0x34b,0x9fc,
+0xbb8,0xbb5,0x34e,0x9fc,0x34e,0x9fc,0x34e,0x9fc,0x34e,0x9fc,0x339,0x336,0x339,0x336,0x339,0x336,
+0x339,0x336,0x339,0x336,0x339,0x336,0x339,0x336,0x354,0x354,0x34b,0x345,0xb67,0xb64,0xbb2,0xcc3,
+0xcc0,0xcc6,0xcc3,0xcc0,0xdbc,0xdbf,0xdbf,0xdbf,0xa0b,0x6ab,0x363,0x366,0x363,0x363,0x363,0x366,
+0x363,0x363,0x363,0x363,0x366,0xa0b,0x366,0x363,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,
+0x6a8,0x6ab,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,
+0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,
+0x6a2,0x6a5,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,
+0x6a2,0x6a2,0x6a2,0x6a2,0xa05,0x6a5,0x35d,0x360,0x35d,0x35d,0x35d,0x360,0x35d,0x35d,0x35d,0x35d,
+0x360,0xa05,0x360,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,
+0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x366,0x360,0x363,0x35d,0x363,0x35d,
+0x363,0x35d,0x363,0x35d,0x363,0x35d,0x35a,0x957,0x95a,0x93c,0x93c,0x114f,0x9ff,0x9ff,0xbbe,0xbbb,
+0xa08,0xa02,0xa08,0xa02,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,
+0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,
+0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,
+0x363,0x35d,0x363,0x35d,0x363,0x366,0x360,0x363,0x35d,0xbbe,0xbbb,0x363,0x35d,0xbbe,0xbbb,0x363,
+0x35d,0xbbe,0xbbb,0xf03,0x366,0x360,0x366,0x360,0x363,0x35d,0x366,0x360,0x363,0x35d,0x366,0x360,
+0x366,0x360,0x366,0x360,0x363,0x35d,0x366,0x360,0x366,0x360,0x366,0x360,0x363,0x35d,0x366,0x360,
+0xa0b,0xa05,0x366,0x360,0x366,0x360,0x366,0x360,0x366,0x360,0xdc5,0xdc2,0x366,0x360,0xf06,0xf03,
+0xf06,0xf03,0xf06,0xf03,0xc2d,0xc2a,0xc2d,0xc2a,0xc2d,0xc2a,0xc2d,0xc2a,0xc2d,0xc2a,0xc2d,0xc2a,
+0xc2d,0xc2a,0xc2d,0xc2a,0xf33,0xf30,0xf33,0xf30,0x1023,0x1020,0x1023,0x1020,0x1023,0x1020,0x1023,0x1020,
+0x1023,0x1020,0x1023,0x1020,0x1023,0x1020,0x1023,0x1020,0x1188,0x1185,0x1371,0x136e,0x1536,0x1533,0x1536,0x1533,
+0x1536,0x1533,0x1536,0x1533,0xc,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,
+0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0xc,
+0xc,0x37b,0x369,0x369,0x369,0x36f,0x369,0x36c,0x1941,0x372,0x372,0x372,0x372,0x372,0x372,0x372,
+0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,
+0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x375,0x1941,0x37e,0xa0e,0xc,
+0xc,0x1500,0x1500,0x141c,0xf,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,
+0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0xdc8,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,
+0x97e,0x97e,0x97e,0x97e,0x381,0x381,0x381,0x381,0x381,0x381,0x381,0x381,0x381,0x381,0xf09,0x381,
+0x381,0x381,0x38d,0x381,0x384,0x381,0x381,0x390,0x981,0xdcb,0xdce,0xdcb,0xf,0xf,0xf,0xf,
+0xf,0xf,0xf,0xf,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,
+0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0xf,
+0xf,0xf,0xf,0x1944,0x393,0x393,0x393,0x38a,0x387,0xf,0xf,0xf,0xf,0xf,0xf,0xf,
+0xf,0xf,0xf,0xf,0xcdb,0xcdb,0xcdb,0xcdb,0x141f,0x1503,0xfb1,0xfb1,0xfb1,0xfae,0xfae,0xdd4,
+0x8c7,0xcd5,0xcd2,0xcd2,0xcc9,0xcc9,0xcc9,0xcc9,0xcc9,0xcc9,0xfab,0xfab,0xfab,0xfab,0xfab,0x8c4,
+0x14fa,0x12,0xdd7,0x8ca,0x1338,0x3ae,0x3b1,0x3b1,0x3b1,0x3b1,0x3b1,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,
+0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0xfb4,
+0xfb4,0xfb4,0xfb4,0xfb4,0x8cd,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x942,
+0x942,0x942,0x942,0x942,0x942,0x942,0x942,0xb5e,0xb5e,0xb5e,0xcc9,0xccf,0xccc,0xdd1,0xdd1,0xdd1,
+0xdd1,0xdd1,0xdd1,0x1335,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x3a8,0x3a5,
+0x3a2,0x39f,0xbc1,0xbc1,0x93f,0x3ae,0x3ae,0x3ba,0x3ae,0x3b4,0x3b4,0x3b4,0x3b4,0x3ae,0x3ae,0x3ae,
+0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,
+0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,
+0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,
+0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0xa14,0xa14,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0xa14,
+0x3b1,0x3ae,0x3b1,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0xa14,
+0x3ae,0x3ae,0x3ae,0x3b1,0x95d,0x3ae,0x399,0x399,0x399,0x399,0x399,0x399,0x399,0x396,0x39f,0x39c,
+0x39c,0x399,0x399,0x399,0x399,0x3b7,0x3b7,0x399,0x399,0x39f,0x39c,0x39c,0x39c,0x399,0xcd8,0xcd8,
+0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0xa14,0xa14,0xa14,0xa11,0xa11,0xcd8,
+0xa29,0xa29,0xa29,0xa23,0xa23,0xa23,0xa23,0xa23,0xa23,0xa23,0xa23,0xa20,0xa23,0xa20,0x15,0xa2c,
+0xa26,0xa17,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,
+0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xcde,0xcde,0xcde,
+0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,
+0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0x15,0x15,0xcde,0xcde,0xcde,
+0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,
+0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0x1035,0x1035,
+0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,
+0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,
+0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,
+0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,
+0xa2f,0xbc4,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,
+0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,
+0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf42,0xf42,0xf42,0xf42,0xf42,
+0xf42,0xf42,0xf42,0xf42,0xf51,0xf51,0xf45,0xf45,0xf48,0xf57,0xf54,0x10b,0x10b,0x1968,0x196b,0x196b,
+0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x252,0x252,0x252,0x252,0x252,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0xb37,0xb37,0xb3a,0xb3a,0xb37,0xb37,0xb37,0xb37,0xb37,0xb37,0xb37,0xb37,0x72,0x72,0x72,0x72,
+0x15ba,0x15ba,0x15ba,0x15ba,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x15b7,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1674,0x1674,0x1674,0x1674,0x1674,0x1674,0x1674,0x1674,0x1674,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x16ad,0x16ad,0x16ad,0x16ad,0x16ad,0x16ad,0x16ad,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x174,0x174,0x174,0x174,0x174,0x174,0x174,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2e5,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,
-0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,
-0x2d9,0x651,0x810,0x813,0x657,0x813,0x80d,0x64e,0x645,0x2df,0x663,0x2e2,0x816,0x63c,0x65a,0x80a,
-0x654,0x660,0x642,0x642,0x648,0x2dc,0x64e,0x64b,0x645,0x642,0x663,0x2e2,0x63f,0x63f,0x63f,0x651,
-0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x66c,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,
-0x66c,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x65d,0x66c,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x66c,0x666,
-0x669,0x669,0x2e8,0x2e8,0x2e8,0x2e8,0x666,0x2e8,0x669,0x669,0x669,0x2e8,0x669,0x669,0x2e8,0x2e8,
-0x666,0x2e8,0x669,0x669,0x2e8,0x2e8,0x2e8,0x65d,0x666,0x669,0x669,0x2e8,0x669,0x2e8,0x666,0x2e8,
-0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,
-0x2f4,0x66f,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee,
-0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x678,0x66f,0x2f7,0x2ee,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee,
-0x2f7,0x66f,0x67b,0x675,0x2f7,0x2ee,0x2f7,0x2ee,0x66f,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x67b,
-0x675,0x678,0x66f,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x672,0x67e,0x678,0x66f,0x2f7,0x672,0x2f7,0x2ee,
-0x2f7,0x2ee,0x678,0x66f,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,
-0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x678,0x66f,0x2f7,0x2ee,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee,
-0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f1,
-0x2fa,0x306,0x306,0x2fa,0x306,0x2fa,0x306,0x306,0x2fa,0x306,0x306,0x306,0x2fa,0x2fa,0x306,0x306,
-0x306,0x306,0x2fa,0x306,0x306,0x2fa,0x306,0x306,0x306,0x2fa,0x2fa,0x2fa,0x306,0x306,0x2fa,0x306,
-0x309,0x2fd,0x306,0x2fa,0x306,0x2fa,0x306,0x306,0x2fa,0x306,0x2fa,0x2fa,0x306,0x2fa,0x306,0x309,
-0x2fd,0x306,0x306,0x306,0x2fa,0x306,0x2fa,0x306,0x306,0x2fa,0x2fa,0x303,0x306,0x2fa,0x2fa,0x2fa,
-0x303,0x303,0x303,0x303,0x30c,0x30c,0x300,0x30c,0x30c,0x300,0x30c,0x30c,0x300,0x309,0x681,0x309,
-0x681,0x309,0x681,0x309,0x681,0x309,0x681,0x309,0x681,0x309,0x681,0x309,0x681,0x2fa,0x309,0x2fd,
-0x309,0x2fd,0x309,0x2fd,0x306,0x2fa,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,
-0x2fd,0x30c,0x30c,0x300,0x309,0x2fd,0x9ea,0x9ea,0x9ed,0x9e7,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,
-0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,
-0x309,0x2fd,0x309,0x2fd,0x9ed,0x9e7,0x9ed,0x9e7,0x9ea,0x9e4,0x9ed,0x9e7,0xbaf,0xcb7,0x9ea,0x9e4,
-0x9ea,0x9e4,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7,
-0xcb7,0xcb7,0xcb7,0xdb6,0xdb6,0xdb6,0xdb9,0xdb9,0xdb6,0xdb9,0xdb9,0xdb6,0xdb6,0xdb9,0xefa,0xefd,
-0xefd,0xefd,0xefd,0xefa,0xefd,0xefa,0xefd,0xefa,0xefd,0xefa,0xefd,0xefa,0x30f,0x684,0x30f,0x30f,
-0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x684,0x30f,0x30f,
-0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,
-0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x312,0x30f,0x30f,0x30f,
-0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,
-0x30f,0x9f0,0x9f0,0x9f0,0x9f0,0x9f0,0xcba,0xcba,0x327,0x327,0x327,0x327,0x327,0x327,0x327,0x327,
-0x327,0x31e,0x31e,0x31e,0x31e,0x31e,0x31e,0x31e,0x31b,0x31b,0x318,0x318,0x68a,0x318,0x31e,0x68d,
-0x321,0x68d,0x68d,0x68d,0x321,0x68d,0x31e,0x31e,0x690,0x324,0x318,0x318,0x318,0x318,0x318,0x318,
-0x687,0x687,0x687,0x687,0x315,0x687,0x318,0xb25,0x327,0x327,0x327,0x327,0x327,0x318,0x318,0x318,
-0x318,0x318,0x9f9,0x9f9,0x9f6,0x9f3,0x9f6,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,
-0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,
-0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,
-0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,
-0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,
-0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x696,0x696,0x94b,0x696,0x696,0x94e,0xb28,0xb28,
-0xb28,0xb28,0xb28,0xb28,0xb28,0xb28,0xb28,0xc6c,0xd83,0xd83,0xd83,0xd83,0xd83,0xd83,0xd83,0xd83,
-0xebe,0xebe,0xebe,0xebe,0xec1,0xd86,0xd86,0xd86,0x699,0x699,0xb2b,0xcb4,0xcb4,0xcb4,0xcb4,0xcb4,
-0xcb4,0xcb4,0xcb4,0xcb4,0xcb4,0xcb4,0xcb4,0xcb4,0xfa8,0xfa5,0xfa8,0xfa5,0x333,0x33c,0xfa8,0xfa5,
-9,9,0x342,0xf00,0xf00,0xf00,0x32a,0x14fd,9,9,9,9,0x33f,0x32d,0x351,0x330,
-0x351,0x351,0x351,9,0x351,9,0x351,0x351,0x348,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,
-0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,9,0x69f,0x69f,0x69f,0x69f,0x69f,
-0x69f,0x69f,0x351,0x351,0x348,0x348,0x348,0x348,0x348,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,
-0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x345,0x69c,0x69c,0x69c,0x69c,0x69c,
-0x69c,0x69c,0x348,0x348,0x348,0x348,0x348,0xfa8,0x354,0x354,0x357,0x351,0x351,0x354,0x34b,0x9fc,
-0xbb8,0xbb5,0x34e,0x9fc,0x34e,0x9fc,0x34e,0x9fc,0x34e,0x9fc,0x339,0x336,0x339,0x336,0x339,0x336,
-0x339,0x336,0x339,0x336,0x339,0x336,0x339,0x336,0x354,0x354,0x34b,0x345,0xb67,0xb64,0xbb2,0xcc3,
-0xcc0,0xcc6,0xcc3,0xcc0,0xdbc,0xdbf,0xdbf,0xdbf,0xa0b,0x6ab,0x363,0x366,0x363,0x363,0x363,0x366,
-0x363,0x363,0x363,0x363,0x366,0xa0b,0x366,0x363,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,
-0x6a8,0x6ab,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,
-0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,
-0x6a2,0x6a5,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,
-0x6a2,0x6a2,0x6a2,0x6a2,0xa05,0x6a5,0x35d,0x360,0x35d,0x35d,0x35d,0x360,0x35d,0x35d,0x35d,0x35d,
-0x360,0xa05,0x360,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,
-0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x366,0x360,0x363,0x35d,0x363,0x35d,
-0x363,0x35d,0x363,0x35d,0x363,0x35d,0x35a,0x957,0x95a,0x93c,0x93c,0x114f,0x9ff,0x9ff,0xbbe,0xbbb,
-0xa08,0xa02,0xa08,0xa02,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,
-0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,
-0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,
-0x363,0x35d,0x363,0x35d,0x363,0x366,0x360,0x363,0x35d,0xbbe,0xbbb,0x363,0x35d,0xbbe,0xbbb,0x363,
-0x35d,0xbbe,0xbbb,0xf03,0x366,0x360,0x366,0x360,0x363,0x35d,0x366,0x360,0x363,0x35d,0x366,0x360,
-0x366,0x360,0x366,0x360,0x363,0x35d,0x366,0x360,0x366,0x360,0x366,0x360,0x363,0x35d,0x366,0x360,
-0xa0b,0xa05,0x366,0x360,0x366,0x360,0x366,0x360,0x366,0x360,0xdc5,0xdc2,0x366,0x360,0xf06,0xf03,
-0xf06,0xf03,0xf06,0xf03,0xc2d,0xc2a,0xc2d,0xc2a,0xc2d,0xc2a,0xc2d,0xc2a,0xc2d,0xc2a,0xc2d,0xc2a,
-0xc2d,0xc2a,0xc2d,0xc2a,0xf33,0xf30,0xf33,0xf30,0x1023,0x1020,0x1023,0x1020,0x1023,0x1020,0x1023,0x1020,
-0x1023,0x1020,0x1023,0x1020,0x1023,0x1020,0x1023,0x1020,0x1188,0x1185,0x1371,0x136e,0x1536,0x1533,0x1536,0x1533,
-0x1536,0x1533,0x1536,0x1533,0xc,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,
-0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0xc,
-0xc,0x37b,0x369,0x369,0x369,0x36f,0x369,0x36c,0x1941,0x372,0x372,0x372,0x372,0x372,0x372,0x372,
-0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,
-0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x375,0x1941,0x37e,0xa0e,0xc,
-0xc,0x1500,0x1500,0x141c,0xf,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,
-0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0xdc8,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,
-0x97e,0x97e,0x97e,0x97e,0x381,0x381,0x381,0x381,0x381,0x381,0x381,0x381,0x381,0x381,0xf09,0x381,
-0x381,0x381,0x38d,0x381,0x384,0x381,0x381,0x390,0x981,0xdcb,0xdce,0xdcb,0xf,0xf,0xf,0xf,
-0xf,0xf,0xf,0xf,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,
-0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0xf,
-0xf,0xf,0xf,0x1944,0x393,0x393,0x393,0x38a,0x387,0xf,0xf,0xf,0xf,0xf,0xf,0xf,
-0xf,0xf,0xf,0xf,0xcdb,0xcdb,0xcdb,0xcdb,0x141f,0x1503,0xfb1,0xfb1,0xfb1,0xfae,0xfae,0xdd4,
-0x8c7,0xcd5,0xcd2,0xcd2,0xcc9,0xcc9,0xcc9,0xcc9,0xcc9,0xcc9,0xfab,0xfab,0xfab,0xfab,0xfab,0x8c4,
-0x14fa,0x12,0xdd7,0x8ca,0x1338,0x3ae,0x3b1,0x3b1,0x3b1,0x3b1,0x3b1,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,
-0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0xfb4,
-0xfb4,0xfb4,0xfb4,0xfb4,0x8cd,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x942,
-0x942,0x942,0x942,0x942,0x942,0x942,0x942,0xb5e,0xb5e,0xb5e,0xcc9,0xccf,0xccc,0xdd1,0xdd1,0xdd1,
-0xdd1,0xdd1,0xdd1,0x1335,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x3a8,0x3a5,
-0x3a2,0x39f,0xbc1,0xbc1,0x93f,0x3ae,0x3ae,0x3ba,0x3ae,0x3b4,0x3b4,0x3b4,0x3b4,0x3ae,0x3ae,0x3ae,
-0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,
-0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,
-0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,
-0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0xa14,0xa14,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0xa14,
-0x3b1,0x3ae,0x3b1,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0xa14,
-0x3ae,0x3ae,0x3ae,0x3b1,0x95d,0x3ae,0x399,0x399,0x399,0x399,0x399,0x399,0x399,0x396,0x39f,0x39c,
-0x39c,0x399,0x399,0x399,0x399,0x3b7,0x3b7,0x399,0x399,0x39f,0x39c,0x39c,0x39c,0x399,0xcd8,0xcd8,
-0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0xa14,0xa14,0xa14,0xa11,0xa11,0xcd8,
-0xa29,0xa29,0xa29,0xa23,0xa23,0xa23,0xa23,0xa23,0xa23,0xa23,0xa23,0xa20,0xa23,0xa20,0x15,0xa2c,
-0xa26,0xa17,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,
-0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xcde,0xcde,0xcde,
-0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,
-0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0x15,0x15,0xcde,0xcde,0xcde,
-0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,
-0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0x1035,0x1035,
-0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,
-0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,
-0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,
-0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,
-0xa2f,0xbc4,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
-0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,
-0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,
-0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf42,0xf42,0xf42,0xf42,0xf42,
-0xf42,0xf42,0xf42,0xf42,0xf51,0xf51,0xf45,0xf45,0xf48,0xf57,0xf54,0x10b,0x10b,0x1968,0x196b,0x196b,
-0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x252,0x252,0x252,0x252,0x252,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0xb37,0xb37,0xb3a,0xb3a,0xb37,0xb37,0xb37,0xb37,0xb37,0xb37,0xb37,0xb37,0x72,0x72,0x72,0x72,
-0x15ba,0x15ba,0x15ba,0x15ba,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x15b7,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1674,0x1674,0x1674,0x1674,0x1674,0x1674,0x1674,0x1674,0x1674,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x16ad,0x16ad,0x16ad,0x16ad,0x16ad,0x16ad,0x16ad,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x174,0x174,0x174,0x174,0x174,0x174,0x174,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,
-0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x18e7,0x18ea,0x18ea,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x261,0x261,0x261,0x261,0x261,0x261,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x1b1b,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,
-0x17a9,0x17a9,0x17a9,0x17a9,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x1e9,0x1e9,0x1e9,0x1e9,0x1665,0x1665,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,
-0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x1713,0x1713,0x1713,0x1713,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0xe2e,0xe2e,0xe2b,0xe2b,0xe2b,0xe2e,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x225,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x1845,0x1845,0x231,0x1845,0x1845,0x231,0x1845,0x1845,0x1845,0x1845,0x1845,0x231,0x231,0x231,0x231,0x231,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x282,0x282,0x282,0x282,0x1a70,0x1a6a,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x267,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,
-0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,
-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,0,0x97b,0x97b,
+0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,
+0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x18e7,0x18ea,0x18ea,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x261,0x261,0x261,0x261,0x261,0x261,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x1b1b,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,
+0x17a9,0x17a9,0x17a9,0x17a9,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x1e9,0x1e9,0x1e9,0x1e9,0x1665,0x1665,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,
+0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x1713,0x1713,0x1713,0x1713,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0xe2e,0xe2e,0xe2b,0xe2b,0xe2b,0xe2e,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x225,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x1845,0x1845,0x231,0x1845,0x1845,0x231,0x1845,0x1845,0x1845,0x1845,0x1845,0x231,0x231,0x231,0x231,0x231,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x282,0x282,0x282,0x282,0x1a70,0x1a6a,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x267,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,
+0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,
+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,0,0x97b,0x97b,
+3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
-3,3,0x97b,0x97b,6,6,6,6,6,6,6,6,6,6,6,6,
+3,3,0x97b,0x97b,6,6,6,6,6,6,6,6,6,6,6,6,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-6,6,6,6,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,
-0xd8c,0xd8c,0xd8c,0xd8c,6,6,6,6,6,6,6,6,6,6,6,6,
-6,6,6,6,0x1509,0x3d5,0x3e4,0x3e4,0x1b,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,
-0x3ea,0x1b,0x1b,0x3ea,0x3ea,0x1b,0x1b,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,
-0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x1b,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x1b,0x3ea,0x1b,
-0x1b,0x1b,0x3ea,0x3ea,0x3ea,0x3ea,0x1b,0x1b,0x3d8,0xce4,0x3d5,0x3e4,0x3e4,0x3d5,0x3d5,0x3d5,
-0x3d5,0x1b,0x1b,0x3e4,0x3e4,0x1b,0x1b,0x3e7,0x3e7,0x3db,0xddd,0x1b,0x1b,0x1b,0x1b,0x1b,
-0x1b,0x1b,0x1b,0x3d5,0x1b,0x1b,0x1b,0x1b,0x3ed,0x3ed,0x1b,0x3ed,0x3ea,0x3ea,0x3d5,0x3d5,
-0x1b,0x1b,0x966,0x966,0x966,0x966,0x966,0x966,0x966,0x966,0x966,0x966,0x3ea,0x3ea,0x3e1,0x3e1,
-0x3de,0x3de,0x3de,0x3de,0x3de,0x3e1,0x3de,0x115e,0x18a2,0x189f,0x1947,0x1b,0x1e,0xce7,0x3f0,0xcea,
-0x1e,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x1e,0x1e,0x1e,0x1e,0x3fc,0x3fc,0x1e,0x1e,0x3fc,
-0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x1e,0x3fc,0x3fc,
-0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x1e,0x3fc,0x3ff,0x1e,0x3fc,0x3ff,0x1e,0x3fc,0x3fc,0x1e,0x1e,
-0x3f3,0x1e,0x3f9,0x3f9,0x3f9,0x3f0,0x3f0,0x1e,0x1e,0x1e,0x1e,0x3f0,0x3f0,0x1e,0x1e,0x3f0,
-0x3f0,0x3f6,0x1e,0x1e,0x1e,0xfbd,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x3ff,0x3ff,0x3ff,
-0x3fc,0x1e,0x3ff,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x969,0x969,0x969,0x969,0x969,0x969,
-0x969,0x969,0x969,0x969,0x3f0,0x3f0,0x3fc,0x3fc,0x3fc,0xfbd,0x194a,0x1e,0x1e,0x1e,0x1e,0x1e,
-0x1e,0x1e,0x1e,0x1e,0x21,0x402,0x402,0x40b,0x21,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,
-0xcf3,0x40e,0x21,0x40e,0x40e,0x40e,0x21,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,
-0x40e,0x40e,0x40e,0x40e,0x40e,0x21,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x21,0x40e,0x40e,
-0x21,0x40e,0x40e,0x40e,0x40e,0x40e,0x21,0x21,0x405,0x40e,0x40b,0x40b,0x40b,0x402,0x402,0x402,
-0x402,0x402,0x21,0x402,0x402,0x40b,0x21,0x40b,0x40b,0x408,0x21,0x21,0x40e,0x21,0x21,0x21,
-0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x40e,0xcf3,0xced,0xced,
-0x21,0x21,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x1422,0xcf0,0x21,0x21,
-0x21,0x21,0x21,0x21,0x21,0x1725,0x18a5,0x18a5,0x18a5,0x18a8,0x18a8,0x18a8,0x24,0x411,0x420,0x420,
-0x24,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x24,0x24,0x426,0x426,0x24,0x24,0x426,
-0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x24,0x426,0x426,
-0x426,0x426,0x426,0x426,0x426,0x24,0x426,0x426,0x24,0xcf6,0x426,0x426,0x426,0x426,0x24,0x24,
-0x414,0x426,0x411,0x411,0x420,0x411,0x411,0x411,0xfc0,0x24,0x24,0x420,0x423,0x24,0x24,0x423,
-0x423,0x417,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x1ab5,0x411,0x411,0x24,0x24,0x24,0x24,
-0x429,0x429,0x24,0x426,0x426,0x426,0xfc0,0xfc0,0x24,0x24,0x41d,0x41d,0x41d,0x41d,0x41d,0x41d,
-0x41d,0x41d,0x41d,0x41d,0x41a,0xcf6,0x1344,0x1344,0x1344,0x1344,0x1344,0x1344,0x24,0x24,0x24,0x24,
-0x24,0x24,0x24,0x24,0x27,0x27,0x42c,0x438,0x27,0x438,0x438,0x438,0x438,0x438,0x438,0x27,
-0x27,0x27,0x438,0x438,0x438,0x27,0x438,0x438,0x43b,0x438,0x27,0x27,0x27,0x438,0x438,0x27,
-0x438,0x27,0x438,0x438,0x27,0x27,0x27,0x438,0x438,0x27,0x27,0x27,0x438,0x438,0x438,0x27,
-0x27,0x27,0x438,0x438,0x438,0x438,0x438,0x438,0x438,0x438,0xde0,0x438,0x438,0x438,0x27,0x27,
-0x27,0x27,0x42c,0x432,0x42c,0x432,0x432,0x27,0x27,0x27,0x432,0x432,0x432,0x27,0x435,0x435,
-0x435,0x42f,0x27,0x27,0xfc3,0x27,0x27,0x27,0x27,0x27,0x27,0x42c,0x27,0x27,0x27,0x27,
-0x27,0x27,0x27,0x27,0x27,0x27,0xef7,0x972,0x972,0x972,0x972,0x972,0x972,0x972,0x972,0x972,
-0x96f,0x96f,0x96f,0xdb0,0xcf9,0xcf9,0xcf9,0xcf9,0xcf9,0xcfc,0xcf9,0x27,0x27,0x27,0x27,0x27,
-0x150c,0x44a,0x44a,0x44a,0x194d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x2a,0x44d,0x44d,
-0x44d,0x2a,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,
-0x44d,0x2a,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x150f,0x44d,0x44d,0x44d,
-0x44d,0x44d,0x2a,0x2a,0x2a,0xfcc,0x43e,0x43e,0x43e,0x44a,0x44a,0x44a,0x44a,0x2a,0x43e,0x43e,
-0x441,0x2a,0x43e,0x43e,0x43e,0x444,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x43e,0x43e,0x2a,
-0xfcc,0xfcc,0x1728,0x2a,0x2a,0x2a,0x2a,0x2a,0x44d,0x44d,0xfc6,0xfc6,0x2a,0x2a,0x447,0x447,
-0x447,0x447,0x447,0x447,0x447,0x447,0x447,0x447,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x1a19,
-0xfc9,0xfc9,0xfc9,0xfc9,0xfc9,0xfc9,0xfc9,0xfc9,0x17e5,0x1512,0x456,0x456,0x1950,0x45c,0x45c,0x45c,
-0x45c,0x45c,0x45c,0x45c,0x45c,0x2d,0x45c,0x45c,0x45c,0x2d,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,
-0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,0x2d,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,
-0x45c,0x45c,0x45c,0x45c,0x2d,0x45c,0x45c,0x45c,0x45c,0x45c,0x2d,0x2d,0xcff,0xd02,0x456,0x450,
-0x459,0x456,0x450,0x456,0x456,0x2d,0x450,0x459,0x459,0x2d,0x459,0x459,0x450,0x453,0x2d,0x2d,
-0x2d,0x2d,0x2d,0x2d,0x2d,0x450,0x450,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x45c,0x2d,
-0x45c,0x45c,0xf0f,0xf0f,0x2d,0x2d,0x975,0x975,0x975,0x975,0x975,0x975,0x975,0x975,0x975,0x975,
-0x2d,0xf12,0xf12,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,
-0x18ab,0x1515,0x468,0x468,0x1ab8,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x30,0x46e,0x46e,
-0x46e,0x30,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,
-0x468,0x45f,0x45f,0x45f,0xfcf,0x30,0x468,0x468,0x468,0x30,0x46b,0x46b,0x46b,0x462,0x134a,0x17e8,
-0x30,0x30,0x30,0x30,0x17eb,0x17eb,0x17eb,0x45f,0x17e8,0x17e8,0x17e8,0x17e8,0x17e8,0x17e8,0x17e8,0x172b,
-0x46e,0x46e,0xfcf,0xfcf,0x30,0x30,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,
-0xfd2,0xfd2,0xfd2,0xfd2,0xfd2,0xfd2,0x17e8,0x17e8,0x17e8,0xfd5,0xfd8,0xfd8,0xfd8,0xfd8,0xfd8,0xfd8,
-0x33,0x1abb,0xa3e,0xa3e,0x33,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,
-0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0x33,0x33,0x33,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,
-0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0x33,0xa44,
-0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0x33,0xa44,0x33,0x33,0xa44,0xa44,0xa44,0xa44,
-0xa44,0xa44,0xa44,0x33,0x33,0x33,0xa38,0x33,0x33,0x33,0x33,0xa35,0xa3e,0xa3e,0xa35,0xa35,
-0xa35,0x33,0xa35,0x33,0xa3e,0xa3e,0xa41,0xa3e,0xa41,0xa41,0xa41,0xa35,0x33,0x33,0x33,0x33,
-0x33,0x33,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x33,0x33,0xa3e,0xa3e,
-0xa3b,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x36,0x489,0x489,0x489,
-0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,
-0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x474,0x489,0x486,
-0x474,0x474,0x474,0x474,0x474,0x474,0x47a,0x36,0x36,0x36,0x36,0x471,0x48f,0x48f,0x48f,0x48f,
-0x48f,0x489,0x48c,0x477,0x477,0x477,0x477,0x477,0x477,0x474,0x477,0x47d,0x483,0x483,0x483,0x483,
-0x483,0x483,0x483,0x483,0x483,0x483,0x480,0x480,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
+6,6,6,6,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,
+0xd8c,0xd8c,0xd8c,0xd8c,6,6,6,6,6,6,6,6,6,6,6,6,
+6,6,6,6,0x1509,0x3d5,0x3e4,0x3e4,0x1b,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,
+0x3ea,0x1b,0x1b,0x3ea,0x3ea,0x1b,0x1b,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,
+0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x1b,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x1b,0x3ea,0x1b,
+0x1b,0x1b,0x3ea,0x3ea,0x3ea,0x3ea,0x1b,0x1b,0x3d8,0xce4,0x3d5,0x3e4,0x3e4,0x3d5,0x3d5,0x3d5,
+0x3d5,0x1b,0x1b,0x3e4,0x3e4,0x1b,0x1b,0x3e7,0x3e7,0x3db,0xddd,0x1b,0x1b,0x1b,0x1b,0x1b,
+0x1b,0x1b,0x1b,0x3d5,0x1b,0x1b,0x1b,0x1b,0x3ed,0x3ed,0x1b,0x3ed,0x3ea,0x3ea,0x3d5,0x3d5,
+0x1b,0x1b,0x966,0x966,0x966,0x966,0x966,0x966,0x966,0x966,0x966,0x966,0x3ea,0x3ea,0x3e1,0x3e1,
+0x3de,0x3de,0x3de,0x3de,0x3de,0x3e1,0x3de,0x115e,0x18a2,0x189f,0x1947,0x1b,0x1e,0xce7,0x3f0,0xcea,
+0x1e,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x1e,0x1e,0x1e,0x1e,0x3fc,0x3fc,0x1e,0x1e,0x3fc,
+0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x1e,0x3fc,0x3fc,
+0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x1e,0x3fc,0x3ff,0x1e,0x3fc,0x3ff,0x1e,0x3fc,0x3fc,0x1e,0x1e,
+0x3f3,0x1e,0x3f9,0x3f9,0x3f9,0x3f0,0x3f0,0x1e,0x1e,0x1e,0x1e,0x3f0,0x3f0,0x1e,0x1e,0x3f0,
+0x3f0,0x3f6,0x1e,0x1e,0x1e,0xfbd,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x3ff,0x3ff,0x3ff,
+0x3fc,0x1e,0x3ff,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x969,0x969,0x969,0x969,0x969,0x969,
+0x969,0x969,0x969,0x969,0x3f0,0x3f0,0x3fc,0x3fc,0x3fc,0xfbd,0x194a,0x1e,0x1e,0x1e,0x1e,0x1e,
+0x1e,0x1e,0x1e,0x1e,0x21,0x402,0x402,0x40b,0x21,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,
+0xcf3,0x40e,0x21,0x40e,0x40e,0x40e,0x21,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,
+0x40e,0x40e,0x40e,0x40e,0x40e,0x21,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x21,0x40e,0x40e,
+0x21,0x40e,0x40e,0x40e,0x40e,0x40e,0x21,0x21,0x405,0x40e,0x40b,0x40b,0x40b,0x402,0x402,0x402,
+0x402,0x402,0x21,0x402,0x402,0x40b,0x21,0x40b,0x40b,0x408,0x21,0x21,0x40e,0x21,0x21,0x21,
+0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x40e,0xcf3,0xced,0xced,
+0x21,0x21,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x1422,0xcf0,0x21,0x21,
+0x21,0x21,0x21,0x21,0x21,0x1725,0x18a5,0x18a5,0x18a5,0x18a8,0x18a8,0x18a8,0x24,0x411,0x420,0x420,
+0x24,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x24,0x24,0x426,0x426,0x24,0x24,0x426,
+0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x24,0x426,0x426,
+0x426,0x426,0x426,0x426,0x426,0x24,0x426,0x426,0x24,0xcf6,0x426,0x426,0x426,0x426,0x24,0x24,
+0x414,0x426,0x411,0x411,0x420,0x411,0x411,0x411,0xfc0,0x24,0x24,0x420,0x423,0x24,0x24,0x423,
+0x423,0x417,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x1ab5,0x411,0x411,0x24,0x24,0x24,0x24,
+0x429,0x429,0x24,0x426,0x426,0x426,0xfc0,0xfc0,0x24,0x24,0x41d,0x41d,0x41d,0x41d,0x41d,0x41d,
+0x41d,0x41d,0x41d,0x41d,0x41a,0xcf6,0x1344,0x1344,0x1344,0x1344,0x1344,0x1344,0x24,0x24,0x24,0x24,
+0x24,0x24,0x24,0x24,0x27,0x27,0x42c,0x438,0x27,0x438,0x438,0x438,0x438,0x438,0x438,0x27,
+0x27,0x27,0x438,0x438,0x438,0x27,0x438,0x438,0x43b,0x438,0x27,0x27,0x27,0x438,0x438,0x27,
+0x438,0x27,0x438,0x438,0x27,0x27,0x27,0x438,0x438,0x27,0x27,0x27,0x438,0x438,0x438,0x27,
+0x27,0x27,0x438,0x438,0x438,0x438,0x438,0x438,0x438,0x438,0xde0,0x438,0x438,0x438,0x27,0x27,
+0x27,0x27,0x42c,0x432,0x42c,0x432,0x432,0x27,0x27,0x27,0x432,0x432,0x432,0x27,0x435,0x435,
+0x435,0x42f,0x27,0x27,0xfc3,0x27,0x27,0x27,0x27,0x27,0x27,0x42c,0x27,0x27,0x27,0x27,
+0x27,0x27,0x27,0x27,0x27,0x27,0xef7,0x972,0x972,0x972,0x972,0x972,0x972,0x972,0x972,0x972,
+0x96f,0x96f,0x96f,0xdb0,0xcf9,0xcf9,0xcf9,0xcf9,0xcf9,0xcfc,0xcf9,0x27,0x27,0x27,0x27,0x27,
+0x150c,0x44a,0x44a,0x44a,0x194d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x2a,0x44d,0x44d,
+0x44d,0x2a,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,
+0x44d,0x2a,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x150f,0x44d,0x44d,0x44d,
+0x44d,0x44d,0x2a,0x2a,0x2a,0xfcc,0x43e,0x43e,0x43e,0x44a,0x44a,0x44a,0x44a,0x2a,0x43e,0x43e,
+0x441,0x2a,0x43e,0x43e,0x43e,0x444,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x43e,0x43e,0x2a,
+0xfcc,0xfcc,0x1728,0x2a,0x2a,0x2a,0x2a,0x2a,0x44d,0x44d,0xfc6,0xfc6,0x2a,0x2a,0x447,0x447,
+0x447,0x447,0x447,0x447,0x447,0x447,0x447,0x447,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x1a19,
+0xfc9,0xfc9,0xfc9,0xfc9,0xfc9,0xfc9,0xfc9,0xfc9,0x17e5,0x1512,0x456,0x456,0x1950,0x45c,0x45c,0x45c,
+0x45c,0x45c,0x45c,0x45c,0x45c,0x2d,0x45c,0x45c,0x45c,0x2d,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,
+0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,0x2d,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,
+0x45c,0x45c,0x45c,0x45c,0x2d,0x45c,0x45c,0x45c,0x45c,0x45c,0x2d,0x2d,0xcff,0xd02,0x456,0x450,
+0x459,0x456,0x450,0x456,0x456,0x2d,0x450,0x459,0x459,0x2d,0x459,0x459,0x450,0x453,0x2d,0x2d,
+0x2d,0x2d,0x2d,0x2d,0x2d,0x450,0x450,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x45c,0x2d,
+0x45c,0x45c,0xf0f,0xf0f,0x2d,0x2d,0x975,0x975,0x975,0x975,0x975,0x975,0x975,0x975,0x975,0x975,
+0x2d,0xf12,0xf12,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,
+0x18ab,0x1515,0x468,0x468,0x1ab8,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x30,0x46e,0x46e,
+0x46e,0x30,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,
+0x468,0x45f,0x45f,0x45f,0xfcf,0x30,0x468,0x468,0x468,0x30,0x46b,0x46b,0x46b,0x462,0x134a,0x17e8,
+0x30,0x30,0x30,0x30,0x17eb,0x17eb,0x17eb,0x45f,0x17e8,0x17e8,0x17e8,0x17e8,0x17e8,0x17e8,0x17e8,0x172b,
+0x46e,0x46e,0xfcf,0xfcf,0x30,0x30,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,
+0xfd2,0xfd2,0xfd2,0xfd2,0xfd2,0xfd2,0x17e8,0x17e8,0x17e8,0xfd5,0xfd8,0xfd8,0xfd8,0xfd8,0xfd8,0xfd8,
+0x33,0x1abb,0xa3e,0xa3e,0x33,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,
+0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0x33,0x33,0x33,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,
+0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0x33,0xa44,
+0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0x33,0xa44,0x33,0x33,0xa44,0xa44,0xa44,0xa44,
+0xa44,0xa44,0xa44,0x33,0x33,0x33,0xa38,0x33,0x33,0x33,0x33,0xa35,0xa3e,0xa3e,0xa35,0xa35,
+0xa35,0x33,0xa35,0x33,0xa3e,0xa3e,0xa41,0xa3e,0xa41,0xa41,0xa41,0xa35,0x33,0x33,0x33,0x33,
+0x33,0x33,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x33,0x33,0xa3e,0xa3e,
+0xa3b,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x36,0x489,0x489,0x489,
+0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,
+0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x474,0x489,0x486,
+0x474,0x474,0x474,0x474,0x474,0x474,0x47a,0x36,0x36,0x36,0x36,0x471,0x48f,0x48f,0x48f,0x48f,
+0x48f,0x489,0x48c,0x477,0x477,0x477,0x477,0x477,0x477,0x474,0x477,0x47d,0x483,0x483,0x483,0x483,
+0x483,0x483,0x483,0x483,0x483,0x483,0x480,0x480,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
-0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x39,0x49e,0x49e,0x39,0x49e,0x39,0x1a1f,0x49e,
-0x49e,0x1a1f,0x49e,0x39,0x1a1f,0x49e,0x1a1f,0x1a1f,0x1a1f,0x1a1f,0x1a1f,0x1a1f,0x49e,0x49e,0x49e,0x49e,
-0x1a1f,0x49e,0x49e,0x49e,0x49e,0x49e,0x49e,0x49e,0x1a1f,0x49e,0x49e,0x49e,0x39,0x49e,0x39,0x49e,
-0x1a1f,0x1a1f,0x49e,0x49e,0x1a1f,0x49e,0x49e,0x49e,0x49e,0x492,0x49e,0x49b,0x492,0x492,0x492,0x492,
-0x492,0x492,0x1a1c,0x492,0x492,0x49e,0x39,0x39,0x4a7,0x4a7,0x4a7,0x4a7,0x4a7,0x39,0x4a4,0x39,
-0x495,0x495,0x495,0x495,0x495,0x492,0x39,0x39,0x498,0x498,0x498,0x498,0x498,0x498,0x498,0x498,
-0x498,0x498,0x39,0x39,0x4a1,0x4a1,0x1425,0x1425,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,
+0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x39,0x49e,0x49e,0x39,0x49e,0x39,0x1a1f,0x49e,
+0x49e,0x1a1f,0x49e,0x39,0x1a1f,0x49e,0x1a1f,0x1a1f,0x1a1f,0x1a1f,0x1a1f,0x1a1f,0x49e,0x49e,0x49e,0x49e,
+0x1a1f,0x49e,0x49e,0x49e,0x49e,0x49e,0x49e,0x49e,0x1a1f,0x49e,0x49e,0x49e,0x39,0x49e,0x39,0x49e,
+0x1a1f,0x1a1f,0x49e,0x49e,0x1a1f,0x49e,0x49e,0x49e,0x49e,0x492,0x49e,0x49b,0x492,0x492,0x492,0x492,
+0x492,0x492,0x1a1c,0x492,0x492,0x49e,0x39,0x39,0x4a7,0x4a7,0x4a7,0x4a7,0x4a7,0x39,0x4a4,0x39,
+0x495,0x495,0x495,0x495,0x495,0x492,0x39,0x39,0x498,0x498,0x498,0x498,0x498,0x498,0x498,0x498,
+0x498,0x498,0x39,0x39,0x4a1,0x4a1,0x1425,0x1425,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,
0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,
-0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x9b7,0x9b7,0x9b7,0x9ba,0x9b7,0x9b7,0x9b7,0x9b7,
-0x3c,0x9b7,0x9b7,0x9b7,0x9b7,0x9ba,0x9b7,0x9b7,0x9b7,0x9b7,0x9ba,0x9b7,0x9b7,0x9b7,0x9b7,0x9ba,
-0x9b7,0x9b7,0x9b7,0x9b7,0x9ba,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,
-0x9b7,0x9ba,0xa53,0xfe4,0xfe4,0x3c,0x3c,0x3c,0x3c,0x984,0x984,0x987,0x984,0x987,0x987,0x990,
-0x987,0x990,0x984,0x984,0x984,0x984,0x984,0x9b1,0x984,0x987,0x98a,0x98a,0x98d,0x996,0x98a,0x98a,
-0x9b7,0x9b7,0x9b7,0x9b7,0x1353,0x134d,0x134d,0x134d,0x984,0x984,0x984,0x987,0x984,0x984,0xa47,0x984,
-0x3c,0x984,0x984,0x984,0x984,0x987,0x984,0x984,0x984,0x984,0x987,0x984,0x984,0x984,0x984,0x987,
-0x984,0x984,0x984,0x984,0x987,0x984,0xa47,0xa47,0xa47,0x984,0x984,0x984,0x984,0x984,0x984,0x984,
-0xa47,0x987,0xa47,0xa47,0xa47,0x3c,0xa50,0xa50,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4a,0xa4d,
-0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0x3c,0xfdb,0xa4d,0xde3,0xde3,0xfde,0xfe1,0xfdb,0x1161,0x1161,0x1161,
-0x1161,0x1350,0x1350,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,
+0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x9b7,0x9b7,0x9b7,0x9ba,0x9b7,0x9b7,0x9b7,0x9b7,
+0x3c,0x9b7,0x9b7,0x9b7,0x9b7,0x9ba,0x9b7,0x9b7,0x9b7,0x9b7,0x9ba,0x9b7,0x9b7,0x9b7,0x9b7,0x9ba,
+0x9b7,0x9b7,0x9b7,0x9b7,0x9ba,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,
+0x9b7,0x9ba,0xa53,0xfe4,0xfe4,0x3c,0x3c,0x3c,0x3c,0x984,0x984,0x987,0x984,0x987,0x987,0x990,
+0x987,0x990,0x984,0x984,0x984,0x984,0x984,0x9b1,0x984,0x987,0x98a,0x98a,0x98d,0x996,0x98a,0x98a,
+0x9b7,0x9b7,0x9b7,0x9b7,0x1353,0x134d,0x134d,0x134d,0x984,0x984,0x984,0x987,0x984,0x984,0xa47,0x984,
+0x3c,0x984,0x984,0x984,0x984,0x987,0x984,0x984,0x984,0x984,0x987,0x984,0x984,0x984,0x984,0x987,
+0x984,0x984,0x984,0x984,0x987,0x984,0xa47,0xa47,0xa47,0x984,0x984,0x984,0x984,0x984,0x984,0x984,
+0xa47,0x987,0xa47,0xa47,0xa47,0x3c,0xa50,0xa50,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4a,0xa4d,
+0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0x3c,0xfdb,0xa4d,0xde3,0xde3,0xfde,0xfe1,0xfdb,0x1161,0x1161,0x1161,
+0x1161,0x1350,0x1350,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,
0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,
-0x3c,0x3c,0x3c,0x3c,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x3f,0x142b,0x3f,0x3f,0x3f,0x3f,
-0x3f,0x142b,0x3f,0x3f,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,
-0x4aa,0x4aa,0x4aa,0x4aa,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0x42,0xa7d,0xa7d,
-0xa7d,0xa7d,0x42,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0xa7d,0x42,0xa7d,0xa7d,
-0xa7d,0xa7d,0x42,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0x42,0xa7d,0xa7d,
-0xa7d,0xa7d,0x42,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,
-0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0x42,
-0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0xa7d,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0x42,
-0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0x42,
-0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,
-0xa7d,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,
-0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,
-0xa7d,0xa7d,0xa7d,0x42,0x42,0x1356,0x1356,0xdec,0xdef,0xa77,0xa80,0xa74,0xa74,0xa74,0xa74,0xa80,
-0xa80,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa71,0xa71,0xa71,0xa71,0xa71,0xa71,
-0xa71,0xa71,0xa71,0xa71,0xa71,0x42,0x42,0x42,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,
-0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0x1731,0x45,0x45,
-0x172e,0x172e,0x172e,0x172e,0x172e,0x172e,0x45,0x45,0xa95,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,
-0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,
-0xa98,0xa98,0xa98,0xa92,0xa8f,0x48,0x48,0x48,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,
-0xa9e,0xa9e,0xa9e,0xa9b,0xa9b,0xa9b,0xa9e,0xa9e,0xa9e,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,
-0x151b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0xabf,0xabf,0xabf,0xabf,0xabf,0xabf,0xaa1,0xabf,
-0xabf,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa7,0xaa4,0xab6,0xab6,0xab9,0xac2,
-0xab0,0xaad,0xab6,0xab3,0xac2,0xd05,0x4e,0x4e,0xabc,0xabc,0xabc,0xabc,0xabc,0xabc,0xabc,0xabc,
-0xabc,0xabc,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0xd08,0xd08,0xd08,0xd08,0xd08,0xd08,0xd08,0xd08,
-0xd08,0xd08,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0xad1,0xad1,0xb52,0xb55,0xad7,0xb4f,0xad4,0xad1,
-0xada,0xae9,0xadd,0xaec,0xaec,0xaec,0xac8,0x51,0xae0,0xae0,0xae0,0xae0,0xae0,0xae0,0xae0,0xae0,
-0xae0,0xae0,0x51,0x51,0x51,0x51,0x51,0x51,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,
-0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,
-0x1953,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,
-0xae3,0xacb,0x1002,0x51,0x51,0x51,0x51,0x51,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,
-0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,
-0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x54,0x54,
-0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x54,0x54,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,
-0x54,0x4ce,0x54,0x4ce,0x54,0x4ce,0x54,0x4ce,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,
-0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,
-0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x54,0x54,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,
-0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x54,0x4cb,0x4cb,
-0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4c5,0x4cb,0x4c5,0x4c5,0x4c2,0x4cb,0x4cb,0x4cb,0x54,0x4cb,0x4cb,
-0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4c2,0x4c2,0x4c2,0x4cb,0x4cb,0x4cb,0x4cb,0x54,0x54,0x4cb,0x4cb,
-0x4ce,0x4ce,0x4ce,0x4ce,0x54,0x4c2,0x4c2,0x4c2,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,
-0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4c2,0x4c2,0x4c2,0x54,0x54,0x4cb,0x4cb,0x4cb,0x54,0x4cb,0x4cb,
-0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4c8,0x4c5,0x54,0xbca,0xbcd,0xbcd,0xbcd,0x100b,0x57,0x14f7,0x14f7,
-0x14f7,0x14f7,0x4d7,0x4d7,0x4d7,0x4d7,0x4d7,0x4d7,0x522,0xbdf,0x5a,0x5a,0x6e1,0x522,0x522,0x522,
-0x522,0x522,0x528,0x53a,0x528,0x534,0x52e,0x6e4,0x51f,0x6de,0x6de,0x6de,0x6de,0x51f,0x51f,0x51f,
-0x51f,0x51f,0x525,0x537,0x525,0x531,0x52b,0x5a,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0x1359,0x1359,0x1359,
-0x1359,0x1359,0x1359,0x1359,0x1359,0x5a,0x5a,0x5a,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,
-0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x549,0x549,0x549,0x549,0x549,0x549,0x549,0x549,
-0x549,0x549,0x549,0x549,0x549,0x546,0x546,0x546,0x546,0x549,0xafb,0xafe,0xbe5,0xbeb,0xbeb,0xbe8,
-0xbe8,0xbe8,0xbe8,0xe01,0xf15,0xf15,0xf15,0xf15,0x114c,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
-0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x579,0x579,0x579,0xb07,0xf1e,0x1011,0x1011,0x1011,
-0x1011,0x12ab,0x1737,0x1737,0x63,0x63,0x63,0x63,0x70b,0x70b,0x70b,0x70b,0x70e,0x70e,0x70e,0x70e,
-0x70e,0x70e,0x585,0x585,0x582,0x582,0x582,0x582,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0xb13,0xb13,0x66,
-0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,
-0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x5af,0x5af,0x5af,0x5af,0x5af,0x5af,0x5af,0x5af,
-0x5af,0x5af,0x5af,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,
-0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,
-0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,
-0xb2e,0xb2e,0x6c,0xb2e,0xb2e,0xb2e,0xb2e,0xb31,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,
-0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb31,0x6c,0x6c,0x6c,0x6c,
-0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,
-0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0x6f,0x6f,
-0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x75,0x843,0x83d,0x843,0x83d,0x843,0x83d,0x843,
-0x83d,0x843,0x83d,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,
-0x840,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x83d,0x83d,0x83d,0x843,0x83d,0x843,0x83d,0x843,
-0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x843,0x83d,0x83d,0x83d,0x83d,0x83d,0x840,0xc93,0xc93,0x75,
-0x75,0x954,0x954,0x91e,0x91e,0x846,0x849,0xc90,0x78,0x78,0x78,0x78,0x78,0x85b,0x85b,0x85b,
-0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,
-0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x113a,0x191a,0x1a01,0x7b,0x85e,0x85e,0x85e,
-0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x7b,
-0x927,0x927,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,
-0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,
-0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0xd98,0xd98,0x7e,
-0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0x81,0x81,0x81,
-0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,
-0xb4c,0xc9c,0xb4c,0xb4c,0xb4c,0xc9c,0xb4c,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,
-0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,
-0x9db,0x9db,0x9db,0x9db,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,
-0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,
-0x60c,0x60c,0x60c,0x60c,0x60c,0x60c,0x60c,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,
-0x8a,0x8a,0x8a,0x5fa,0x5fa,0x5fa,0x5fa,0x5fa,0x8a,0x8a,0x8a,0x8a,0x8a,0xb1f,0x5fd,0x603,
-0x609,0x609,0x609,0x609,0x609,0x609,0x609,0x609,0x609,0x600,0x603,0x603,0x603,0x603,0x603,0x603,
-0x603,0x603,0x603,0x603,0x603,0x603,0x603,0x8a,0x603,0x603,0x603,0x603,0x603,0x8a,0x603,0x8a,
-0x603,0x603,0x8a,0x603,0x603,0x8a,0x603,0x603,0x603,0x603,0x603,0x603,0x603,0x603,0x603,0x606,
-0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,
-0x136b,0x136b,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,
-0x8d,0x8d,0x8d,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x61e,0x618,
-0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,
-0x61b,0x618,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x618,0x61b,0x618,0x618,0x61b,0x61b,0x618,0x618,
-0x618,0x618,0x618,0x61b,0x618,0x618,0x61b,0x618,0x61b,0x61b,0x61b,0x618,0x61b,0x61b,0x61b,0x61b,
-0x8d,0x8d,0x61b,0x61b,0x61b,0x61b,0x618,0x618,0x61b,0x618,0x618,0x618,0x618,0x61b,0x618,0x618,
-0x618,0x618,0x618,0x61b,0x61b,0x61b,0x618,0x618,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,
-0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,
-0x61e,0x61e,0x978,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x615,0x615,0xc24,0xdb3,0x8d,0x8d,
-0x87f,0x891,0x88e,0x891,0x88e,0xcb1,0xcb1,0xda4,0xda1,0x882,0x882,0x882,0x882,0x894,0x894,0x894,
-0x8ac,0x8af,0x8be,0x90,0x8b2,0x8b5,0x8c1,0x8c1,0x8a9,0x8a0,0x89a,0x8a0,0x89a,0x8a0,0x89a,0x89d,
-0x89d,0x8b8,0x8b8,0x8bb,0x8b8,0x8b8,0x8b8,0x90,0x8b8,0x8a6,0x8a3,0x89d,0x90,0x90,0x90,0x90,
-0x62a,0x636,0x62a,0xc27,0x62a,0x93,0x62a,0x636,0x62a,0x636,0x62a,0x636,0x62a,0x636,0x62a,0x636,
-0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633,
-0x62d,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633,0x62d,0x633,0x62d,0x633,0x62d,0x93,0x93,0x627,
-0x77d,0x780,0x795,0x798,0x777,0x780,0x780,0x99,0x75f,0x762,0x762,0x762,0x762,0x75f,0x75f,0x99,
-0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0xb22,0xb22,0xb22,0x9de,0x759,0x639,0x639,
-0x99,0x7a7,0x786,0x777,0x780,0x77d,0x777,0x789,0x77a,0x774,0x777,0x795,0x78c,0x783,0x7a4,0x777,
-0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x792,0x78f,0x795,0x795,0x795,0x7a7,
-0x768,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,
-0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x99,
-0x99,0x99,0x765,0x765,0x765,0x765,0x765,0x765,0x99,0x99,0x765,0x765,0x765,0x765,0x765,0x765,
-0x99,0x99,0x765,0x765,0x765,0x765,0x765,0x765,0x99,0x99,0x765,0x765,0x765,0x99,0x99,0x99,
-0xb6d,0xb6d,0xb6d,0xb6d,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x18b7,0x18b7,0x18b7,
-0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,
-0xb73,0xb73,0xb73,0x9f,0x9f,0x9f,0x9f,0x9f,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,
-0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,
-0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xa2,0xa2,
-0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xa5,
-0xa5,0x101d,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,
-0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0x173d,0x173d,0x173d,0x173d,0x173d,0x173d,0x173d,0x173d,
-0x173d,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,
-0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,
-0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xa8,0xb9d,0xb9d,
-0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
-0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
-0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xa8,0xba0,0xba0,0xa8,0xa8,0xba0,0xa8,0xa8,0xba0,0xba0,0xa8,
-0xa8,0xba0,0xba0,0xba0,0xba0,0xa8,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xb9d,0xb9d,
-0xb9d,0xb9d,0xa8,0xb9d,0xa8,0xb9d,0xb9d,0xb9d,0xb9d,0xd29,0xb9d,0xb9d,0xa8,0xb9d,0xb9d,0xb9d,
-0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,
-0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xa8,0xba0,
-0xba0,0xba0,0xba0,0xa8,0xa8,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xa8,0xba0,0xba0,
-0xba0,0xba0,0xba0,0xba0,0xba0,0xa8,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
-0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
-0xba0,0xba0,0xa8,0xba0,0xba0,0xba0,0xba0,0xa8,0xba0,0xba0,0xba0,0xba0,0xba0,0xa8,0xba0,0xa8,
-0xa8,0xa8,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xa8,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
-0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xe16,0xe16,0xa8,0xa8,0xba0,0xba0,0xba0,0xba0,
-0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,
-0xba0,0xba0,0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb97,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xf2d,0xf2a,
-0xa8,0xa8,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,
-0xb9a,0xb9a,0xb9a,0xb9a,0xab,0xba6,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,
-0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,
-0xab,0xab,0xab,0xab,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,
-0xc36,0xae,0xc36,0xc36,0xc36,0xc36,0xc30,0xc30,0xc33,0xae,0xae,0xae,0xae,0xae,0xae,0xae,
-0xae,0xae,0xae,0xae,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,
-0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc39,0xc39,0xc3c,0xca5,0xca5,0xb1,0xb1,0xb1,0xb1,0xb1,
-0xb1,0xb1,0xb1,0xb1,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,
-0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc42,0xc42,0xb4,0xb4,0xb4,0xb4,0xb4,0xb4,0xb4,0xb4,
-0xb4,0xb4,0xb4,0xb4,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,
-0xc4b,0xb7,0xc4b,0xc4b,0xc4b,0xb7,0xc48,0xc48,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,
-0xb7,0xb7,0xb7,0xb7,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,
-0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,
-0xd3b,0x1539,0x1539,0xba,0xd2c,0xd2c,0xd2c,0xd38,0xd38,0xd38,0xd38,0xd2c,0xd2c,0xd38,0xd38,0xd38,
-0xba,0xba,0xba,0xba,0xd38,0xd38,0xd2c,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd2f,0xd2f,0xd2f,
-0xba,0xba,0xba,0xba,0xd32,0xba,0xba,0xba,0xd3e,0xd3e,0xd35,0xd35,0xd35,0xd35,0xd35,0xd35,
-0xd35,0xd35,0xd35,0xd35,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,
-0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xbd,0xbd,0xd41,0xd41,0xd41,0xd41,0xd41,0xbd,0xbd,0xbd,
-0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,
-0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0xc0,0xc0,0x153c,0x153c,
-0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,
-0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0xc0,0x1abe,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,
-0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xc3,0xd68,0xd68,0xd68,
-0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,
-0xd68,0xd68,0xd68,0xc3,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,
-0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xc3,0xd68,0xd68,0xc3,0xd68,0xd68,0xd68,0xd68,0xd68,
-0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xc3,0xc3,0xd68,0xd68,0xd68,0xd68,
-0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,
-0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,
-0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xd6b,0xd6b,0xd6b,0xd6b,
-0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,
-0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xc6,0xc6,0xc6,0xc6,0xc6,0xdad,0xdad,0xdad,0xc9,
-0xc9,0xc9,0xc9,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,
-0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xc9,0xc9,0xc9,0xdaa,
-0xdaa,0xdaa,0xdaa,0xdaa,0xdaa,0xdaa,0xdaa,0xdaa,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,
-0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,
-0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xcc,0xd6e,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,
-0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,
-0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xcf,0xcf,0xd77,0xd77,0xd77,0xd77,0xd77,0xd77,0xd77,0xd77,
-0xd77,0xd77,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,
-0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd2,0xd2,
-0xd7d,0xd2,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,
-0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd2,0xd7d,0xd7d,0xd2,0xd2,0xd2,
-0xd7d,0xd2,0xd2,0xd7d,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,
-0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd5,0xd5,0xd5,0xd5,0xd5,
-0xd5,0xd5,0xd5,0xd5,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0x153f,
-0x153f,0x17f1,0x17f1,0xdb,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,
-0x1acd,0x132,0x132,0x132,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,
-0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe3a,0xe3a,0xe40,0xe40,0xe3a,
-0xde,0xde,0xe3d,0xe3d,0x1149,0x1149,0x1149,0x1149,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,
-0xe1,0xe1,0xe1,0xe1,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,
-0xca2,0xca2,0xca2,0xca2,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1542,0x1542,0x1542,0x1542,0x1542,
-0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1545,0x18bd,0x18bd,0x193e,0x18bd,0xe4,0x17f4,
-0x1377,0x118b,0xf3c,0xf3c,0xe55,0xe52,0xe55,0xe52,0xe52,0xe49,0xe49,0xe49,0xe49,0xe49,0xe49,0x1194,
-0x1191,0x1194,0x1191,0x118e,0x118e,0x118e,0x1434,0x1431,0xe7,0xe7,0xe7,0xe7,0xe7,0xe4f,0xe4c,0xe4c,
-0xe4c,0xe49,0xe4f,0xe4c,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,
-0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xea,0xea,0xea,0xea,0xea,
-0xea,0xea,0xea,0xea,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xea,0xe58,0xe58,0xe58,0xe58,
-0xe58,0xe58,0xe58,0xea,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xea,0xe58,0xe58,0xe58,0xe58,
-0xe58,0xe58,0xe58,0xea,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,
-0xe5e,0xe5e,0xe5e,0xe5e,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xed,0xed,
-0xed,0xed,0xed,0xed,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xf0,0x1437,0xf0,0xf0,0xf0,0xf0,
-0xf0,0x1437,0xf0,0xf0,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,
-0xeb8,0xeb8,0xeb8,0xeb8,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,
-0xe67,0xe67,0xe67,0xf3,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,
-0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,
-0xe64,0xe64,0xe64,0xf3,0xe79,0xe6d,0xe6d,0xe6d,0xf6,0xe6d,0xe6d,0xf6,0xf6,0xf6,0xf6,0xf6,
-0xe6d,0xe6d,0xe6d,0xe6d,0xe79,0xe79,0xe79,0xe79,0xf6,0xe79,0xe79,0xe79,0xf6,0xe79,0xe79,0xe79,
-0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,
-0xe79,0xe79,0xe79,0xe79,0x195c,0x195c,0xf6,0xf6,0xe6a,0xe6a,0xe6a,0xf6,0xf6,0xf6,0xf6,0xe70,
-0xe73,0xe73,0xe73,0xe73,0xe73,0xe73,0xe73,0xe73,0x1959,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6,
-0xe76,0xe76,0xe76,0xe76,0xe76,0xe76,0xe7c,0xe7c,0xe73,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6,
-0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0x119a,0x119a,0xf9,0xf9,0xf9,0xf9,
-0xe88,0xe88,0xe88,0xe88,0xe88,0xe8b,0xe8b,0xe8b,0xe88,0xe88,0xe8b,0xe88,0xe88,0xe88,0xe88,0xe88,
-0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xe85,0xe85,0xe85,0xe85,
-0xe85,0xe85,0xe85,0xe85,0xe85,0xe85,0x1197,0xf9,0xf9,0xf9,0xe82,0xe82,0xe91,0xe91,0xe91,0xe91,
-0xfc,0xfc,0xfc,0xfc,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe8e,0xe91,0xe91,0xe91,
-0xe91,0xe91,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0x154e,0x1554,0x1551,0x189c,
-0x17f7,0x18c0,0x18c0,0x18c0,0x18c0,0x18c0,0x1962,0x195f,0x1965,0x195f,0x1965,0x1a25,0x1ac1,0x1ac1,0x1ac1,0xff,
-0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
-0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
-0xeb5,0xeb5,0xeb5,0xeb2,0xeb2,0xea9,0xea9,0xeb2,0xeaf,0xeaf,0xeaf,0xeaf,0x1ac4,0x102,0x102,0x102,
-0x1314,0x1314,0x1314,0x1317,0x1317,0x1317,0x130e,0x130e,0x1311,0x130e,0x156,0x156,0x156,0x156,0x156,0x156,
-0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0x1443,0x1443,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0xebb,
-0x137d,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x137a,
-0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc75,
-0xee8,0xed9,0xed3,0xee5,0xee2,0xedc,0xedc,0xeeb,0xed6,0xedf,0x108,0x108,0x108,0x108,0x108,0x108,
-0xf6f,0xf6f,0xf5a,0xf6f,0xf72,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0x10e,0x10e,0x10e,0x10e,
-0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf7b,0xf7b,0xf60,0xf66,0xf7b,0xf7b,
-0xf63,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf5d,0xf5d,0xf5d,0xf5d,0xf5d,
-0xf5d,0xf5d,0xf5d,0xf5d,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0x10e,0x10e,0x10e,
-0x111,0x111,0x1a2b,0x1a28,0x1a2b,0x1a2b,0x1a2b,0x1aca,0x1ac7,0x1aca,0x1ac7,0x111,0x111,0x111,0x111,0x111,
-0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,
-0x111,0x1aca,0x1ac7,0x155d,0x144c,0x144c,0x1380,0x1074,0x1074,0x1074,0x1074,0x1074,0xf8a,0xf8a,0xf8a,0xf8a,
-0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,
-0xf87,0xf87,0xf8d,0xf8d,0x114,0x114,0x114,0x114,0x114,0x114,0x114,0x114,0xf96,0xf96,0xf96,0xf96,
-0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,
-0xf96,0xf96,0xf90,0xf90,0xf90,0xf90,0x11a3,0x11a3,0x117,0x117,0x117,0xf93,0x1563,0x1563,0x1563,0x1563,
-0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,
-0x1563,0x1563,0x1563,0x1563,0x1563,0x174c,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,
-0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,
-0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0xf9f,0xf9f,0xf9f,0x1569,0x1569,0x1569,0x1569,0x1569,
-0x1569,0x1569,0x1569,0x1569,0x1569,0x1569,0x1569,0x11d,0xf9c,0xf9c,0xf9c,0xf9c,0x1566,0x11d,0x11d,0x11d,
-0x11d,0x11d,0x11d,0x11d,0x11d,0x11d,0x11d,0x11d,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,
-0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0x1974,0x1974,0x1974,0x1974,0x1974,0x1974,
-0x1974,0x120,0x120,0x120,0x120,0x120,0x120,0x120,0x109b,0x109b,0x109b,0x109b,0x1098,0x1098,0x1098,0x1098,
-0x1098,0x1098,0x1098,0x1098,0x1089,0x1089,0x1089,0x1089,0x1089,0x1089,0x1089,0x1089,0x1098,0x1098,0x108f,0x108c,
-0x123,0x123,0x123,0x109e,0x109e,0x1092,0x1092,0x1092,0x1095,0x1095,0x1095,0x1095,0x1095,0x1095,0x1095,0x1095,
-0x1095,0x1095,0x123,0x123,0x123,0x109b,0x109b,0x109b,0x10a1,0x10a1,0x10a1,0x10a1,0x10a1,0x10a1,0x10a1,0x10a1,
-0x10a1,0x10a1,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10b6,0x10b6,0x10b6,0x10b6,0x10b6,0x10b6,0x10b6,0x10b6,
-0x10b6,0x10b6,0x10b9,0x10b9,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,
-0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x10e0,0x10e0,0x10e0,0x10e0,0x10da,0x17fd,0x129,0x129,
-0x129,0x129,0x129,0x129,0x129,0x129,0x10e6,0x10e6,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd,
-0x10dd,0x10dd,0x129,0x129,0x129,0x129,0x129,0x129,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x10f8,
-0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10fe,0x1101,0x12c,0x12c,0x12c,0x12c,
-0x12c,0x12c,0x12c,0x12c,0x12c,0x12c,0x12c,0x10fb,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,
-0x1113,0x1107,0x1107,0x1107,0x1107,0x1107,0x1107,0x1110,0x1110,0x1107,0x1107,0x1110,0x1110,0x1107,0x1107,0x12f,
-0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x1113,0x1113,0x1113,0x1107,0x1113,0x1113,0x1113,0x1113,
-0x1113,0x1113,0x1113,0x1113,0x1107,0x1110,0x12f,0x12f,0x110d,0x110d,0x110d,0x110d,0x110d,0x110d,0x110d,0x110d,
-0x110d,0x110d,0x12f,0x12f,0x110a,0x1116,0x1116,0x1116,0x1575,0x132,0x132,0x132,0x132,0x132,0x132,0x132,
-0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,
-0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,
-0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,
-0x111c,0x111c,0x111c,0x111c,0x111c,0x111f,0x135,0x135,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,
-0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,
-0x1122,0x1122,0x1122,0x1122,0x1122,0x138,0x138,0x138,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,
-0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x13b,0x13b,0x13b,0x13b,0x13b,0x13b,0x13b,
-0x13b,0x13b,0x13b,0x13b,0x13b,0x13b,0x13b,0x13b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,
-0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,
-0x112b,0x112b,0x13e,0x13e,0x13e,0x13e,0x13e,0x1128,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,
-0x112e,0x112e,0x112e,0x112e,0x141,0x141,0x141,0x141,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,
-0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x144,0x144,0x144,0x144,
-0x144,0x144,0x144,0x144,0x144,0x144,0x144,0x144,0x11a9,0x11a9,0x11a9,0x11a9,0x11b2,0x11a9,0x11a9,0x11a9,
-0x11b2,0x11a9,0x11a9,0x11a9,0x11a9,0x11a6,0x147,0x147,0x11af,0x11af,0x11af,0x11af,0x11af,0x11af,0x11af,0x11b5,
-0x11af,0x11b5,0x11af,0x11af,0x11af,0x11b5,0x11b5,0x147,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,
-0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x14a,0x14a,
-0x14a,0x14a,0x14a,0x14a,0x14a,0x14a,0x14a,0x14a,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,
-0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d0,0x11bb,0x11d0,
-0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x14d,0x11c4,0x11cd,0x11bb,0x11cd,0x11cd,0x11bb,0x11bb,0x11bb,
-0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11d0,0x11d0,0x11d0,0x11d0,0x11d0,0x11d0,0x11bb,0x11bb,0x11c1,0x11c1,0x11c1,
-0x11c1,0x11c1,0x11c1,0x11c1,0x11c1,0x14d,0x14d,0x11be,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,
-0x11ca,0x11ca,0x14d,0x14d,0x14d,0x14d,0x14d,0x14d,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,
-0x11ca,0x11ca,0x14d,0x14d,0x14d,0x14d,0x14d,0x14d,0x11c7,0x11c7,0x11c7,0x11c7,0x11c7,0x11c7,0x11c7,0x11d6,
-0x11d9,0x11d9,0x11d9,0x11d9,0x11c7,0x11c7,0x14d,0x14d,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,
-0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15bd,0x1adf,0x1329,0x1302,0x1320,0x1320,0x1320,0x1320,0x1320,0x1320,
-0x1320,0x1308,0x1305,0x12fc,0x12fc,0x1326,0x12fc,0x12fc,0x12fc,0x12fc,0x130b,0x14eb,0x14f1,0x14ee,0x14ee,0x193b,
-0x1716,0x1716,0x1aac,0x150,0x150,0x150,0x150,0x150,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,
-0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11e5,0x11e5,0x11e8,0x11f1,0x11eb,0x11eb,0x11eb,0x11f1,
-0x153,0x153,0x153,0x153,0x153,0x153,0x153,0x153,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,
-0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,
-0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x159,0x159,0x159,0x120f,0x1203,0x1203,0x1203,0x1203,0x1203,0x1203,0x1206,
-0x1215,0x1215,0x1203,0x1203,0x1203,0x1203,0x15c,0x131a,0x1209,0x1209,0x1209,0x1209,0x1209,0x1209,0x1209,0x1209,
-0x1209,0x1209,0x15c,0x15c,0x15c,0x15c,0x1203,0x1203,0x1233,0x1227,0x1233,0x15f,0x15f,0x15f,0x15f,0x15f,
-0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,
-0x15f,0x15f,0x15f,0x1230,0x1230,0x1236,0x122a,0x122d,0x124b,0x124b,0x124b,0x1245,0x1245,0x123c,0x1245,0x1245,
-0x123c,0x1245,0x1245,0x124e,0x1248,0x123f,0x162,0x162,0x1242,0x1242,0x1242,0x1242,0x1242,0x1242,0x1242,0x1242,
-0x1242,0x1242,0x162,0x162,0x162,0x162,0x162,0x162,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x165,
-0x165,0x165,0x165,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,
-0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,
-0x165,0x165,0x165,0x165,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,
-0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x168,0x125a,0x1257,0x1257,0x1257,0x1257,
-0x1257,0x1257,0x1257,0x1257,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,
-0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x16b,0x16b,0x16b,0x1266,0x1269,0x1269,
-0x1269,0x1269,0x1269,0x1269,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,
-0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x16e,0x16e,0x126f,0x126f,0x126f,0x126f,
-0x126f,0x126f,0x126f,0x126f,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,
-0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x171,0x171,0x171,0x171,0x171,0x1275,0x1275,0x1275,0x1275,
-0x1275,0x1275,0x1275,0x1275,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,
+0x3c,0x3c,0x3c,0x3c,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x3f,0x142b,0x3f,0x3f,0x3f,0x3f,
+0x3f,0x142b,0x3f,0x3f,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,
+0x4aa,0x4aa,0x4aa,0x4aa,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0x42,0xa7d,0xa7d,
+0xa7d,0xa7d,0x42,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0xa7d,0x42,0xa7d,0xa7d,
+0xa7d,0xa7d,0x42,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0x42,0xa7d,0xa7d,
+0xa7d,0xa7d,0x42,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,
+0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0x42,
+0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0xa7d,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0x42,
+0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0x42,
+0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,
+0xa7d,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,
+0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,
+0xa7d,0xa7d,0xa7d,0x42,0x42,0x1356,0x1356,0xdec,0xdef,0xa77,0xa80,0xa74,0xa74,0xa74,0xa74,0xa80,
+0xa80,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa71,0xa71,0xa71,0xa71,0xa71,0xa71,
+0xa71,0xa71,0xa71,0xa71,0xa71,0x42,0x42,0x42,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,
+0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0x1731,0x45,0x45,
+0x172e,0x172e,0x172e,0x172e,0x172e,0x172e,0x45,0x45,0xa95,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,
+0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,
+0xa98,0xa98,0xa98,0xa92,0xa8f,0x48,0x48,0x48,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,
+0xa9e,0xa9e,0xa9e,0xa9b,0xa9b,0xa9b,0xa9e,0xa9e,0xa9e,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,
+0x151b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0xabf,0xabf,0xabf,0xabf,0xabf,0xabf,0xaa1,0xabf,
+0xabf,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa7,0xaa4,0xab6,0xab6,0xab9,0xac2,
+0xab0,0xaad,0xab6,0xab3,0xac2,0xd05,0x4e,0x4e,0xabc,0xabc,0xabc,0xabc,0xabc,0xabc,0xabc,0xabc,
+0xabc,0xabc,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0xd08,0xd08,0xd08,0xd08,0xd08,0xd08,0xd08,0xd08,
+0xd08,0xd08,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0xad1,0xad1,0xb52,0xb55,0xad7,0xb4f,0xad4,0xad1,
+0xada,0xae9,0xadd,0xaec,0xaec,0xaec,0xac8,0x51,0xae0,0xae0,0xae0,0xae0,0xae0,0xae0,0xae0,0xae0,
+0xae0,0xae0,0x51,0x51,0x51,0x51,0x51,0x51,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,
+0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,
+0x1953,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,
+0xae3,0xacb,0x1002,0x51,0x51,0x51,0x51,0x51,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,
+0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,
+0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x54,0x54,
+0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x54,0x54,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,
+0x54,0x4ce,0x54,0x4ce,0x54,0x4ce,0x54,0x4ce,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,
+0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,
+0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x54,0x54,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,
+0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x54,0x4cb,0x4cb,
+0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4c5,0x4cb,0x4c5,0x4c5,0x4c2,0x4cb,0x4cb,0x4cb,0x54,0x4cb,0x4cb,
+0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4c2,0x4c2,0x4c2,0x4cb,0x4cb,0x4cb,0x4cb,0x54,0x54,0x4cb,0x4cb,
+0x4ce,0x4ce,0x4ce,0x4ce,0x54,0x4c2,0x4c2,0x4c2,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,
+0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4c2,0x4c2,0x4c2,0x54,0x54,0x4cb,0x4cb,0x4cb,0x54,0x4cb,0x4cb,
+0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4c8,0x4c5,0x54,0xbca,0xbcd,0xbcd,0xbcd,0x100b,0x57,0x14f7,0x14f7,
+0x14f7,0x14f7,0x4d7,0x4d7,0x4d7,0x4d7,0x4d7,0x4d7,0x522,0xbdf,0x5a,0x5a,0x6e1,0x522,0x522,0x522,
+0x522,0x522,0x528,0x53a,0x528,0x534,0x52e,0x6e4,0x51f,0x6de,0x6de,0x6de,0x6de,0x51f,0x51f,0x51f,
+0x51f,0x51f,0x525,0x537,0x525,0x531,0x52b,0x5a,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0x1359,0x1359,0x1359,
+0x1359,0x1359,0x1359,0x1359,0x1359,0x5a,0x5a,0x5a,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,
+0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x549,0x549,0x549,0x549,0x549,0x549,0x549,0x549,
+0x549,0x549,0x549,0x549,0x549,0x546,0x546,0x546,0x546,0x549,0xafb,0xafe,0xbe5,0xbeb,0xbeb,0xbe8,
+0xbe8,0xbe8,0xbe8,0xe01,0xf15,0xf15,0xf15,0xf15,0x114c,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
+0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x579,0x579,0x579,0xb07,0xf1e,0x1011,0x1011,0x1011,
+0x1011,0x12ab,0x1737,0x1737,0x63,0x63,0x63,0x63,0x70b,0x70b,0x70b,0x70b,0x70e,0x70e,0x70e,0x70e,
+0x70e,0x70e,0x585,0x585,0x582,0x582,0x582,0x582,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0xb13,0xb13,0x66,
+0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,
+0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x5af,0x5af,0x5af,0x5af,0x5af,0x5af,0x5af,0x5af,
+0x5af,0x5af,0x5af,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,
+0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,
+0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,
+0xb2e,0xb2e,0x6c,0xb2e,0xb2e,0xb2e,0xb2e,0xb31,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,
+0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb31,0x6c,0x6c,0x6c,0x6c,
+0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,
+0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0x6f,0x6f,
+0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x75,0x843,0x83d,0x843,0x83d,0x843,0x83d,0x843,
+0x83d,0x843,0x83d,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,
+0x840,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x83d,0x83d,0x83d,0x843,0x83d,0x843,0x83d,0x843,
+0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x843,0x83d,0x83d,0x83d,0x83d,0x83d,0x840,0xc93,0xc93,0x75,
+0x75,0x954,0x954,0x91e,0x91e,0x846,0x849,0xc90,0x78,0x78,0x78,0x78,0x78,0x85b,0x85b,0x85b,
+0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,
+0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x113a,0x191a,0x1a01,0x7b,0x85e,0x85e,0x85e,
+0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x7b,
+0x927,0x927,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,
+0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,
+0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0xd98,0xd98,0x7e,
+0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0x81,0x81,0x81,
+0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,
+0xb4c,0xc9c,0xb4c,0xb4c,0xb4c,0xc9c,0xb4c,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,
+0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,
+0x9db,0x9db,0x9db,0x9db,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,
+0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,
+0x60c,0x60c,0x60c,0x60c,0x60c,0x60c,0x60c,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,
+0x8a,0x8a,0x8a,0x5fa,0x5fa,0x5fa,0x5fa,0x5fa,0x8a,0x8a,0x8a,0x8a,0x8a,0xb1f,0x5fd,0x603,
+0x609,0x609,0x609,0x609,0x609,0x609,0x609,0x609,0x609,0x600,0x603,0x603,0x603,0x603,0x603,0x603,
+0x603,0x603,0x603,0x603,0x603,0x603,0x603,0x8a,0x603,0x603,0x603,0x603,0x603,0x8a,0x603,0x8a,
+0x603,0x603,0x8a,0x603,0x603,0x8a,0x603,0x603,0x603,0x603,0x603,0x603,0x603,0x603,0x603,0x606,
+0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,
+0x136b,0x136b,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,
+0x8d,0x8d,0x8d,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x61e,0x618,
+0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,
+0x61b,0x618,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x618,0x61b,0x618,0x618,0x61b,0x61b,0x618,0x618,
+0x618,0x618,0x618,0x61b,0x618,0x618,0x61b,0x618,0x61b,0x61b,0x61b,0x618,0x61b,0x61b,0x61b,0x61b,
+0x8d,0x8d,0x61b,0x61b,0x61b,0x61b,0x618,0x618,0x61b,0x618,0x618,0x618,0x618,0x61b,0x618,0x618,
+0x618,0x618,0x618,0x61b,0x61b,0x61b,0x618,0x618,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,
+0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,
+0x61e,0x61e,0x978,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x615,0x615,0xc24,0xdb3,0x8d,0x8d,
+0x87f,0x891,0x88e,0x891,0x88e,0xcb1,0xcb1,0xda4,0xda1,0x882,0x882,0x882,0x882,0x894,0x894,0x894,
+0x8ac,0x8af,0x8be,0x90,0x8b2,0x8b5,0x8c1,0x8c1,0x8a9,0x8a0,0x89a,0x8a0,0x89a,0x8a0,0x89a,0x89d,
+0x89d,0x8b8,0x8b8,0x8bb,0x8b8,0x8b8,0x8b8,0x90,0x8b8,0x8a6,0x8a3,0x89d,0x90,0x90,0x90,0x90,
+0x62a,0x636,0x62a,0xc27,0x62a,0x93,0x62a,0x636,0x62a,0x636,0x62a,0x636,0x62a,0x636,0x62a,0x636,
+0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633,
+0x62d,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633,0x62d,0x633,0x62d,0x633,0x62d,0x93,0x93,0x627,
+0x77d,0x780,0x795,0x798,0x777,0x780,0x780,0x99,0x75f,0x762,0x762,0x762,0x762,0x75f,0x75f,0x99,
+0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0xb22,0xb22,0xb22,0x9de,0x759,0x639,0x639,
+0x99,0x7a7,0x786,0x777,0x780,0x77d,0x777,0x789,0x77a,0x774,0x777,0x795,0x78c,0x783,0x7a4,0x777,
+0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x792,0x78f,0x795,0x795,0x795,0x7a7,
+0x768,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,
+0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x99,
+0x99,0x99,0x765,0x765,0x765,0x765,0x765,0x765,0x99,0x99,0x765,0x765,0x765,0x765,0x765,0x765,
+0x99,0x99,0x765,0x765,0x765,0x765,0x765,0x765,0x99,0x99,0x765,0x765,0x765,0x99,0x99,0x99,
+0xb6d,0xb6d,0xb6d,0xb6d,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x18b7,0x18b7,0x18b7,
+0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,
+0xb73,0xb73,0xb73,0x9f,0x9f,0x9f,0x9f,0x9f,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,
+0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,
+0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xa2,0xa2,
+0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xa5,
+0xa5,0x101d,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,
+0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0x173d,0x173d,0x173d,0x173d,0x173d,0x173d,0x173d,0x173d,
+0x173d,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,
+0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,
+0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xa8,0xb9d,0xb9d,
+0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
+0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
+0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xa8,0xba0,0xba0,0xa8,0xa8,0xba0,0xa8,0xa8,0xba0,0xba0,0xa8,
+0xa8,0xba0,0xba0,0xba0,0xba0,0xa8,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xb9d,0xb9d,
+0xb9d,0xb9d,0xa8,0xb9d,0xa8,0xb9d,0xb9d,0xb9d,0xb9d,0xd29,0xb9d,0xb9d,0xa8,0xb9d,0xb9d,0xb9d,
+0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,
+0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xa8,0xba0,
+0xba0,0xba0,0xba0,0xa8,0xa8,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xa8,0xba0,0xba0,
+0xba0,0xba0,0xba0,0xba0,0xba0,0xa8,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
+0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
+0xba0,0xba0,0xa8,0xba0,0xba0,0xba0,0xba0,0xa8,0xba0,0xba0,0xba0,0xba0,0xba0,0xa8,0xba0,0xa8,
+0xa8,0xa8,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xa8,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
+0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xe16,0xe16,0xa8,0xa8,0xba0,0xba0,0xba0,0xba0,
+0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,
+0xba0,0xba0,0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb97,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xf2d,0xf2a,
+0xa8,0xa8,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,
+0xb9a,0xb9a,0xb9a,0xb9a,0xab,0xba6,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,
+0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,
+0xab,0xab,0xab,0xab,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,
+0xc36,0xae,0xc36,0xc36,0xc36,0xc36,0xc30,0xc30,0xc33,0xae,0xae,0xae,0xae,0xae,0xae,0xae,
+0xae,0xae,0xae,0xae,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,
+0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc39,0xc39,0xc3c,0xca5,0xca5,0xb1,0xb1,0xb1,0xb1,0xb1,
+0xb1,0xb1,0xb1,0xb1,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,
+0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc42,0xc42,0xb4,0xb4,0xb4,0xb4,0xb4,0xb4,0xb4,0xb4,
+0xb4,0xb4,0xb4,0xb4,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,
+0xc4b,0xb7,0xc4b,0xc4b,0xc4b,0xb7,0xc48,0xc48,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,
+0xb7,0xb7,0xb7,0xb7,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,
+0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,
+0xd3b,0x1539,0x1539,0xba,0xd2c,0xd2c,0xd2c,0xd38,0xd38,0xd38,0xd38,0xd2c,0xd2c,0xd38,0xd38,0xd38,
+0xba,0xba,0xba,0xba,0xd38,0xd38,0xd2c,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd2f,0xd2f,0xd2f,
+0xba,0xba,0xba,0xba,0xd32,0xba,0xba,0xba,0xd3e,0xd3e,0xd35,0xd35,0xd35,0xd35,0xd35,0xd35,
+0xd35,0xd35,0xd35,0xd35,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,
+0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xbd,0xbd,0xd41,0xd41,0xd41,0xd41,0xd41,0xbd,0xbd,0xbd,
+0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,
+0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0xc0,0xc0,0x153c,0x153c,
+0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,
+0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0xc0,0x1abe,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,
+0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xc3,0xd68,0xd68,0xd68,
+0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,
+0xd68,0xd68,0xd68,0xc3,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,
+0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xc3,0xd68,0xd68,0xc3,0xd68,0xd68,0xd68,0xd68,0xd68,
+0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xc3,0xc3,0xd68,0xd68,0xd68,0xd68,
+0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,
+0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,
+0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xd6b,0xd6b,0xd6b,0xd6b,
+0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,
+0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xc6,0xc6,0xc6,0xc6,0xc6,0xdad,0xdad,0xdad,0xc9,
+0xc9,0xc9,0xc9,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,
+0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xc9,0xc9,0xc9,0xdaa,
+0xdaa,0xdaa,0xdaa,0xdaa,0xdaa,0xdaa,0xdaa,0xdaa,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,
+0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,
+0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xcc,0xd6e,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,
+0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,
+0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xcf,0xcf,0xd77,0xd77,0xd77,0xd77,0xd77,0xd77,0xd77,0xd77,
+0xd77,0xd77,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,
+0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd2,0xd2,
+0xd7d,0xd2,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,
+0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd2,0xd7d,0xd7d,0xd2,0xd2,0xd2,
+0xd7d,0xd2,0xd2,0xd7d,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,
+0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd5,0xd5,0xd5,0xd5,0xd5,
+0xd5,0xd5,0xd5,0xd5,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0x153f,
+0x153f,0x17f1,0x17f1,0xdb,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,
+0x1acd,0x132,0x132,0x132,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,
+0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe3a,0xe3a,0xe40,0xe40,0xe3a,
+0xde,0xde,0xe3d,0xe3d,0x1149,0x1149,0x1149,0x1149,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,
+0xe1,0xe1,0xe1,0xe1,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,
+0xca2,0xca2,0xca2,0xca2,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1542,0x1542,0x1542,0x1542,0x1542,
+0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1545,0x18bd,0x18bd,0x193e,0x18bd,0xe4,0x17f4,
+0x1377,0x118b,0xf3c,0xf3c,0xe55,0xe52,0xe55,0xe52,0xe52,0xe49,0xe49,0xe49,0xe49,0xe49,0xe49,0x1194,
+0x1191,0x1194,0x1191,0x118e,0x118e,0x118e,0x1434,0x1431,0xe7,0xe7,0xe7,0xe7,0xe7,0xe4f,0xe4c,0xe4c,
+0xe4c,0xe49,0xe4f,0xe4c,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,
+0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xea,0xea,0xea,0xea,0xea,
+0xea,0xea,0xea,0xea,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xea,0xe58,0xe58,0xe58,0xe58,
+0xe58,0xe58,0xe58,0xea,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xea,0xe58,0xe58,0xe58,0xe58,
+0xe58,0xe58,0xe58,0xea,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,
+0xe5e,0xe5e,0xe5e,0xe5e,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xed,0xed,
+0xed,0xed,0xed,0xed,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xf0,0x1437,0xf0,0xf0,0xf0,0xf0,
+0xf0,0x1437,0xf0,0xf0,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,
+0xeb8,0xeb8,0xeb8,0xeb8,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,
+0xe67,0xe67,0xe67,0xf3,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,
+0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,
+0xe64,0xe64,0xe64,0xf3,0xe79,0xe6d,0xe6d,0xe6d,0xf6,0xe6d,0xe6d,0xf6,0xf6,0xf6,0xf6,0xf6,
+0xe6d,0xe6d,0xe6d,0xe6d,0xe79,0xe79,0xe79,0xe79,0xf6,0xe79,0xe79,0xe79,0xf6,0xe79,0xe79,0xe79,
+0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,
+0xe79,0xe79,0xe79,0xe79,0x195c,0x195c,0xf6,0xf6,0xe6a,0xe6a,0xe6a,0xf6,0xf6,0xf6,0xf6,0xe70,
+0xe73,0xe73,0xe73,0xe73,0xe73,0xe73,0xe73,0xe73,0x1959,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6,
+0xe76,0xe76,0xe76,0xe76,0xe76,0xe76,0xe7c,0xe7c,0xe73,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6,
+0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0x119a,0x119a,0xf9,0xf9,0xf9,0xf9,
+0xe88,0xe88,0xe88,0xe88,0xe88,0xe8b,0xe8b,0xe8b,0xe88,0xe88,0xe8b,0xe88,0xe88,0xe88,0xe88,0xe88,
+0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xe85,0xe85,0xe85,0xe85,
+0xe85,0xe85,0xe85,0xe85,0xe85,0xe85,0x1197,0xf9,0xf9,0xf9,0xe82,0xe82,0xe91,0xe91,0xe91,0xe91,
+0xfc,0xfc,0xfc,0xfc,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe8e,0xe91,0xe91,0xe91,
+0xe91,0xe91,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0x154e,0x1554,0x1551,0x189c,
+0x17f7,0x18c0,0x18c0,0x18c0,0x18c0,0x18c0,0x1962,0x195f,0x1965,0x195f,0x1965,0x1a25,0x1ac1,0x1ac1,0x1ac1,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xeb5,0xeb5,0xeb5,0xeb2,0xeb2,0xea9,0xea9,0xeb2,0xeaf,0xeaf,0xeaf,0xeaf,0x1ac4,0x102,0x102,0x102,
+0x1314,0x1314,0x1314,0x1317,0x1317,0x1317,0x130e,0x130e,0x1311,0x130e,0x156,0x156,0x156,0x156,0x156,0x156,
+0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0x1443,0x1443,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0xebb,
+0x137d,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x137a,
+0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc75,
+0xee8,0xed9,0xed3,0xee5,0xee2,0xedc,0xedc,0xeeb,0xed6,0xedf,0x108,0x108,0x108,0x108,0x108,0x108,
+0xf6f,0xf6f,0xf5a,0xf6f,0xf72,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0x10e,0x10e,0x10e,0x10e,
+0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf7b,0xf7b,0xf60,0xf66,0xf7b,0xf7b,
+0xf63,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf5d,0xf5d,0xf5d,0xf5d,0xf5d,
+0xf5d,0xf5d,0xf5d,0xf5d,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0x10e,0x10e,0x10e,
+0x111,0x111,0x1a2b,0x1a28,0x1a2b,0x1a2b,0x1a2b,0x1aca,0x1ac7,0x1aca,0x1ac7,0x111,0x111,0x111,0x111,0x111,
+0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,
+0x111,0x1aca,0x1ac7,0x155d,0x144c,0x144c,0x1380,0x1074,0x1074,0x1074,0x1074,0x1074,0xf8a,0xf8a,0xf8a,0xf8a,
+0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,
+0xf87,0xf87,0xf8d,0xf8d,0x114,0x114,0x114,0x114,0x114,0x114,0x114,0x114,0xf96,0xf96,0xf96,0xf96,
+0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,
+0xf96,0xf96,0xf90,0xf90,0xf90,0xf90,0x11a3,0x11a3,0x117,0x117,0x117,0xf93,0x1563,0x1563,0x1563,0x1563,
+0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,
+0x1563,0x1563,0x1563,0x1563,0x1563,0x174c,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,
+0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,
+0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0xf9f,0xf9f,0xf9f,0x1569,0x1569,0x1569,0x1569,0x1569,
+0x1569,0x1569,0x1569,0x1569,0x1569,0x1569,0x1569,0x11d,0xf9c,0xf9c,0xf9c,0xf9c,0x1566,0x11d,0x11d,0x11d,
+0x11d,0x11d,0x11d,0x11d,0x11d,0x11d,0x11d,0x11d,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,
+0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0x1974,0x1974,0x1974,0x1974,0x1974,0x1974,
+0x1974,0x120,0x120,0x120,0x120,0x120,0x120,0x120,0x109b,0x109b,0x109b,0x109b,0x1098,0x1098,0x1098,0x1098,
+0x1098,0x1098,0x1098,0x1098,0x1089,0x1089,0x1089,0x1089,0x1089,0x1089,0x1089,0x1089,0x1098,0x1098,0x108f,0x108c,
+0x123,0x123,0x123,0x109e,0x109e,0x1092,0x1092,0x1092,0x1095,0x1095,0x1095,0x1095,0x1095,0x1095,0x1095,0x1095,
+0x1095,0x1095,0x123,0x123,0x123,0x109b,0x109b,0x109b,0x10a1,0x10a1,0x10a1,0x10a1,0x10a1,0x10a1,0x10a1,0x10a1,
+0x10a1,0x10a1,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10b6,0x10b6,0x10b6,0x10b6,0x10b6,0x10b6,0x10b6,0x10b6,
+0x10b6,0x10b6,0x10b9,0x10b9,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,
+0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x10e0,0x10e0,0x10e0,0x10e0,0x10da,0x17fd,0x129,0x129,
+0x129,0x129,0x129,0x129,0x129,0x129,0x10e6,0x10e6,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd,
+0x10dd,0x10dd,0x129,0x129,0x129,0x129,0x129,0x129,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x10f8,
+0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10fe,0x1101,0x12c,0x12c,0x12c,0x12c,
+0x12c,0x12c,0x12c,0x12c,0x12c,0x12c,0x12c,0x10fb,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,
+0x1113,0x1107,0x1107,0x1107,0x1107,0x1107,0x1107,0x1110,0x1110,0x1107,0x1107,0x1110,0x1110,0x1107,0x1107,0x12f,
+0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x1113,0x1113,0x1113,0x1107,0x1113,0x1113,0x1113,0x1113,
+0x1113,0x1113,0x1113,0x1113,0x1107,0x1110,0x12f,0x12f,0x110d,0x110d,0x110d,0x110d,0x110d,0x110d,0x110d,0x110d,
+0x110d,0x110d,0x12f,0x12f,0x110a,0x1116,0x1116,0x1116,0x1575,0x132,0x132,0x132,0x132,0x132,0x132,0x132,
+0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,
+0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,
+0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,
+0x111c,0x111c,0x111c,0x111c,0x111c,0x111f,0x135,0x135,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,
+0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,
+0x1122,0x1122,0x1122,0x1122,0x1122,0x138,0x138,0x138,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,
+0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x13b,0x13b,0x13b,0x13b,0x13b,0x13b,0x13b,
+0x13b,0x13b,0x13b,0x13b,0x13b,0x13b,0x13b,0x13b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,
+0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,
+0x112b,0x112b,0x13e,0x13e,0x13e,0x13e,0x13e,0x1128,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,
+0x112e,0x112e,0x112e,0x112e,0x141,0x141,0x141,0x141,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,
+0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x144,0x144,0x144,0x144,
+0x144,0x144,0x144,0x144,0x144,0x144,0x144,0x144,0x11a9,0x11a9,0x11a9,0x11a9,0x11b2,0x11a9,0x11a9,0x11a9,
+0x11b2,0x11a9,0x11a9,0x11a9,0x11a9,0x11a6,0x147,0x147,0x11af,0x11af,0x11af,0x11af,0x11af,0x11af,0x11af,0x11b5,
+0x11af,0x11b5,0x11af,0x11af,0x11af,0x11b5,0x11b5,0x147,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,
+0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x14a,0x14a,
+0x14a,0x14a,0x14a,0x14a,0x14a,0x14a,0x14a,0x14a,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,
+0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d0,0x11bb,0x11d0,
+0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x14d,0x11c4,0x11cd,0x11bb,0x11cd,0x11cd,0x11bb,0x11bb,0x11bb,
+0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11d0,0x11d0,0x11d0,0x11d0,0x11d0,0x11d0,0x11bb,0x11bb,0x11c1,0x11c1,0x11c1,
+0x11c1,0x11c1,0x11c1,0x11c1,0x11c1,0x14d,0x14d,0x11be,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,
+0x11ca,0x11ca,0x14d,0x14d,0x14d,0x14d,0x14d,0x14d,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,
+0x11ca,0x11ca,0x14d,0x14d,0x14d,0x14d,0x14d,0x14d,0x11c7,0x11c7,0x11c7,0x11c7,0x11c7,0x11c7,0x11c7,0x11d6,
+0x11d9,0x11d9,0x11d9,0x11d9,0x11c7,0x11c7,0x14d,0x14d,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,
+0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15bd,0x1adf,0x1329,0x1302,0x1320,0x1320,0x1320,0x1320,0x1320,0x1320,
+0x1320,0x1308,0x1305,0x12fc,0x12fc,0x1326,0x12fc,0x12fc,0x12fc,0x12fc,0x130b,0x14eb,0x14f1,0x14ee,0x14ee,0x193b,
+0x1716,0x1716,0x1aac,0x150,0x150,0x150,0x150,0x150,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,
+0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11e5,0x11e5,0x11e8,0x11f1,0x11eb,0x11eb,0x11eb,0x11f1,
+0x153,0x153,0x153,0x153,0x153,0x153,0x153,0x153,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,
+0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,
+0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x159,0x159,0x159,0x120f,0x1203,0x1203,0x1203,0x1203,0x1203,0x1203,0x1206,
+0x1215,0x1215,0x1203,0x1203,0x1203,0x1203,0x15c,0x131a,0x1209,0x1209,0x1209,0x1209,0x1209,0x1209,0x1209,0x1209,
+0x1209,0x1209,0x15c,0x15c,0x15c,0x15c,0x1203,0x1203,0x1233,0x1227,0x1233,0x15f,0x15f,0x15f,0x15f,0x15f,
+0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,
+0x15f,0x15f,0x15f,0x1230,0x1230,0x1236,0x122a,0x122d,0x124b,0x124b,0x124b,0x1245,0x1245,0x123c,0x1245,0x1245,
+0x123c,0x1245,0x1245,0x124e,0x1248,0x123f,0x162,0x162,0x1242,0x1242,0x1242,0x1242,0x1242,0x1242,0x1242,0x1242,
+0x1242,0x1242,0x162,0x162,0x162,0x162,0x162,0x162,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x165,
+0x165,0x165,0x165,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,
+0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,
+0x165,0x165,0x165,0x165,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,
+0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x168,0x125a,0x1257,0x1257,0x1257,0x1257,
+0x1257,0x1257,0x1257,0x1257,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,
+0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x16b,0x16b,0x16b,0x1266,0x1269,0x1269,
+0x1269,0x1269,0x1269,0x1269,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,
+0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x16e,0x16e,0x126f,0x126f,0x126f,0x126f,
+0x126f,0x126f,0x126f,0x126f,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,
+0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x171,0x171,0x171,0x171,0x171,0x1275,0x1275,0x1275,0x1275,
+0x1275,0x1275,0x1275,0x1275,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,
0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,
-0x127e,0x127e,0x127e,0x177,0x1299,0x1299,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,
-0x17a,0x197d,0x17a,0x17a,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,
-0x14ca,0x14ca,0x14ca,0x14ca,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,
-0x129f,0x129f,0x129f,0x17d,0x1a4f,0x1a4f,0x1a4f,0x1a4f,0x1a4f,0x1a4f,0x1a4f,0x1a52,0x1a4c,0x279,0x279,0x279,
-0x279,0x279,0x279,0x279,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,
-0x187e,0x1ad0,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,
-0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,
-0x180,0x180,0x180,0x180,0x180,0x180,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,
-0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,
-0x12f6,0x13f5,0x13f2,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,
-0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f3,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,
-0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f3,0x12f0,0x12f0,0x13f5,0x13f5,
-0x13f5,0x13f5,0x13f5,0x13f2,0x13f5,0x13f5,0x13f5,0x1881,0x183,0x183,0x183,0x183,0x12ed,0x12ed,0x12ed,0x12ed,
-0x12ed,0x12ed,0x12ed,0x12ed,0x12ed,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x1419,0x1419,0x183,0x183,
-0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x1920,0x1920,0x1920,0x1920,
-0x1920,0x1920,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,
-0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,
-0x183,0x183,0x183,0x183,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,
-0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x138f,0x138f,0x138f,
-0x186,0x186,0x1392,0x186,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x1398,0x13a1,0x139b,0x139b,0x13a1,0x13a1,
-0x13a1,0x139b,0x13a1,0x139b,0x139b,0x139b,0x13a4,0x13a4,0x189,0x189,0x189,0x189,0x189,0x189,0x189,0x189,
-0x139e,0x139e,0x139e,0x139e,0x18c,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x18c,0x18c,0x13aa,0x13aa,0x13aa,
-0x13aa,0x13aa,0x13aa,0x18c,0x18c,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x18c,0x18c,0x18c,0x18c,0x18c,
-0x18c,0x18c,0x18c,0x18c,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x18c,0x13aa,0x13aa,0x13aa,0x13aa,
-0x13aa,0x13aa,0x13aa,0x18c,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,
-0x161d,0x161d,0x161d,0x161d,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13b0,0x13c2,0x13c2,0x13b6,0x13b6,0x13b6,
-0x13b6,0x13b6,0x18f,0x18f,0x18f,0x18f,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,
-0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,
-0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x1584,
-0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,
-0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x192,0x192,0x192,0x192,0x192,0x192,0x192,
-0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x195,
-0x195,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x1587,
-0x195,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13fe,
-0x195,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,
-0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,
-0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x195,0x195,0x195,0x195,0x195,0x195,0x195,0x195,0x195,0x195,
-0x1413,0x1410,0x1410,0x1410,0x1410,0x1410,0x159c,0x159c,0x159c,0x159c,0x159c,0x159f,0x170d,0x159f,0x159f,0x159f,
-0x17d9,0x188a,0x188a,0x18c3,0x18c3,0x1a8e,0x1b39,0x1b39,0x198,0x198,0x198,0x198,0x198,0x198,0x198,0x198,
-0x159f,0x159f,0x159f,0x159f,0x159f,0x159f,0x159c,0x159c,0x159c,0x159f,0x159c,0x170a,0x170a,0x198,0x198,0x198,
-0x159f,0x159c,0x159c,0x159f,0x188a,0x188a,0x188a,0x1926,0x1926,0x1a07,0x1a8e,0x1b39,0x1b39,0x198,0x198,0x198,
-0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,
-0x13cb,0x13cb,0x13cb,0x13cb,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,
-0x1467,0x15a5,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x15a5,0x15a5,0x15a5,
-0x15a5,0x15a5,0x15a5,0x175e,0x175e,0x19e,0x1809,0x1809,0x1809,0x1809,0x1809,0x1809,0x1809,0x1809,0x1ad3,0x1ad3,
-0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x19e,0x19e,0x19e,0x19e,0x19e,0x19e,0x19e,0x19e,
-0x19e,0x19e,0x19e,0x1983,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,
-0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,
-0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,
-0x1a1,0x146d,0x146d,0x1a1,0x146d,0x1a1,0x1a1,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,
-0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x1a1,0x1a1,0x1a1,
-0x1a1,0x1a1,0x146d,0x1a1,0x1a1,0x1a1,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x146d,0x146d,
-0x1a1,0x146d,0x146d,0x1a1,0x146d,0x1a1,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d,
-0x1a1,0x146d,0x146d,0x1a1,0x146d,0x1a1,0x1a1,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,
-0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x1a1,
-0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d,
-0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x1a1,0x1a1,0x1a1,0x1a1,
-0x1a1,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d,
-0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x1a1,0x1a1,0x1a1,0x1a1,
-0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,
-0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x146a,0x146a,0x1a1,0x1a1,
-0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1482,0x1482,0x1482,0x1482,
-0x1482,0x1482,0x1482,0x1470,0x1470,0x1470,0x1470,0x1470,0x147f,0x1470,0x1473,0x1473,0x1470,0x1470,0x1470,0x1476,
-0x1476,0x1a4,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x1479,0x1485,0x1485,0x1485,
-0x1989,0x1986,0x1986,0x1ad6,0x1a4,0x1a4,0x1a4,0x1a4,0x1a4,0x1a4,0x1a4,0x1a4,0x162f,0x162f,0x162f,0x162f,
-0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x1491,0x1491,0x1491,0x1491,
-0x1491,0x1491,0x1491,0x1491,0x1491,0x1491,0x1491,0x148e,0x1488,0x1488,0x148e,0x148e,0x1497,0x1497,0x1491,0x1494,
-0x1494,0x148e,0x148b,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x149a,0x149a,0x149a,0x149a,
-0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,
-0x149a,0x149a,0x149a,0x149a,0x1aa,0x1aa,0x1aa,0x1aa,0x1761,0x1761,0x149a,0x149a,0x1761,0x1761,0x1761,0x1761,
-0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1aa,0x1aa,0x1761,0x1761,
-0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x14a6,0x14a6,0x14a6,0x14a6,
-0x14a6,0x1a37,0x1a37,0x1a37,0x1a37,0x1a37,0x1a37,0x1ad,0x1ad,0x1ad,0x1ad,0x1a31,0x14a6,0x14a3,0x14a3,0x14a3,
-0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x1a34,0x1a34,0x1a34,0x1a34,
-0x1a34,0x1a34,0x1a34,0x1a34,0x1ad,0x1ad,0x1ad,0x1ad,0x1ad,0x1ad,0x1ad,0x14a0,0x14a0,0x14a0,0x14a0,0x14a9,
-0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14ca,0x14ca,0x14ca,0x14ca,
-0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x14c7,0x14c7,0x14c7,0x14c7,
-0x14c7,0x14c7,0x14c7,0x14c7,0x14c7,0x14c7,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x14cd,0x14cd,0x14cd,0x14cd,
-0x14cd,0x14cd,0x14cd,0x14cd,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1323,0x1320,0x1323,0x12ff,
-0x1320,0x1326,0x1326,0x1329,0x1326,0x1329,0x132c,0x1320,0x1329,0x1329,0x1320,0x1320,0x14df,0x14df,0x14df,0x14df,
-0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14d0,0x14d9,0x14d0,0x14d9,0x14d9,0x14d0,0x14d0,0x14d0,0x14d0,
-0x14d0,0x14d0,0x14dc,0x14d3,0x1a3a,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x15b1,0x15b1,0x15b1,0x15b1,
-0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x1b9,0x1b9,0x15ae,0x15ae,0x15ae,0x15ae,
-0x15ae,0x15b4,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1719,0x1710,0x1710,0x1710,
-0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,
-0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1bf,0x1bf,0x1bf,0x1bf,0x1adf,0x1c2,0x1c2,0x1c2,
-0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,
-0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,
-0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x1c5,0x1c5,0x1c5,0x1c5,0x1c5,
-0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x1c5,0x1c5,0x1c5,
-0x1c5,0x1c5,0x1c5,0x1c5,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x1c5,0x1c5,
-0x15c9,0x15c3,0x15c6,0x15cf,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x1c8,0x1c8,0x1c8,0x1c8,
-0x1c8,0x1c8,0x1c8,0x1c8,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,
-0x15ba,0x15ba,0x15ba,0x15ba,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,
-0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x198c,0x198c,0x198c,0x198c,0x1cb,0x1cb,0x1cb,
-0x1cb,0x1cb,0x1cb,0x1cb,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,
-0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,
-0x1cb,0x1cb,0x1cb,0x1cb,0x1776,0x171c,0x15de,0x1722,0x1ce,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,
-0x15e7,0x1ce,0x1ce,0x15e7,0x15e7,0x1ce,0x1ce,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,
-0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x1ce,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x1ce,0x15e7,0x15e7,
-0x1ce,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x1ce,0x1a16,0x171f,0x15e7,0x15d8,0x15de,0x15d8,0x15de,0x15de,0x15de,
-0x15de,0x1ce,0x1ce,0x15de,0x15de,0x1ce,0x1ce,0x15e1,0x15e1,0x15e4,0x1ce,0x1ce,0x1779,0x1ce,0x1ce,0x1ce,
-0x1ce,0x1ce,0x1ce,0x15d8,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x15ea,0x15e7,0x15e7,0x15e7,0x15e7,0x15de,0x15de,
-0x1ce,0x1ce,0x15db,0x15db,0x15db,0x15db,0x15db,0x15db,0x15db,0x1ce,0x1ce,0x1ce,0x15db,0x15db,0x15db,0x15db,
-0x15db,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x15ff,0x15ff,0x15ff,0x15ff,
-0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x1d1,0x15ff,
-0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15f9,0x15f9,0x15f9,0x15ed,
-0x15ed,0x15ed,0x15f9,0x15f9,0x15ed,0x15fc,0x15f0,0x15ed,0x1602,0x1602,0x15f6,0x1602,0x1602,0x15f3,0x180c,0x1d1,
-0x1611,0x1611,0x1611,0x1605,0x1605,0x1605,0x1605,0x1605,0x1605,0x1608,0x160b,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4,
-0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4,
-0x177c,0x177c,0x177c,0x177c,0x161d,0x161a,0x1a3d,0x1a3d,0x1ae5,0x1ae8,0x1ae2,0x1ae2,0x1d7,0x1d7,0x1d7,0x1d7,
-0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,
-0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,
-0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,
-0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,
-0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,
-0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,
+0x127e,0x127e,0x127e,0x177,0x1299,0x1299,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,
+0x17a,0x197d,0x17a,0x17a,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,
+0x14ca,0x14ca,0x14ca,0x14ca,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,
+0x129f,0x129f,0x129f,0x17d,0x1a4f,0x1a4f,0x1a4f,0x1a4f,0x1a4f,0x1a4f,0x1a4f,0x1a52,0x1a4c,0x279,0x279,0x279,
+0x279,0x279,0x279,0x279,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,
+0x187e,0x1ad0,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,
+0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,
+0x180,0x180,0x180,0x180,0x180,0x180,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,
+0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,
+0x12f6,0x13f5,0x13f2,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,
+0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f3,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,
+0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f3,0x12f0,0x12f0,0x13f5,0x13f5,
+0x13f5,0x13f5,0x13f5,0x13f2,0x13f5,0x13f5,0x13f5,0x1881,0x183,0x183,0x183,0x183,0x12ed,0x12ed,0x12ed,0x12ed,
+0x12ed,0x12ed,0x12ed,0x12ed,0x12ed,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x1419,0x1419,0x183,0x183,
+0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x1920,0x1920,0x1920,0x1920,
+0x1920,0x1920,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,
+0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,
+0x183,0x183,0x183,0x183,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,
+0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x138f,0x138f,0x138f,
+0x186,0x186,0x1392,0x186,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x1398,0x13a1,0x139b,0x139b,0x13a1,0x13a1,
+0x13a1,0x139b,0x13a1,0x139b,0x139b,0x139b,0x13a4,0x13a4,0x189,0x189,0x189,0x189,0x189,0x189,0x189,0x189,
+0x139e,0x139e,0x139e,0x139e,0x18c,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x18c,0x18c,0x13aa,0x13aa,0x13aa,
+0x13aa,0x13aa,0x13aa,0x18c,0x18c,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x18c,0x18c,0x18c,0x18c,0x18c,
+0x18c,0x18c,0x18c,0x18c,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x18c,0x13aa,0x13aa,0x13aa,0x13aa,
+0x13aa,0x13aa,0x13aa,0x18c,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,
+0x161d,0x161d,0x161d,0x161d,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13b0,0x13c2,0x13c2,0x13b6,0x13b6,0x13b6,
+0x13b6,0x13b6,0x18f,0x18f,0x18f,0x18f,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,
+0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,
+0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x1584,
+0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,
+0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x192,0x192,0x192,0x192,0x192,0x192,0x192,
+0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x195,
+0x195,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x1587,
+0x195,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13fe,
+0x195,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,
+0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,
+0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x195,0x195,0x195,0x195,0x195,0x195,0x195,0x195,0x195,0x195,
+0x1413,0x1410,0x1410,0x1410,0x1410,0x1410,0x159c,0x159c,0x159c,0x159c,0x159c,0x159f,0x170d,0x159f,0x159f,0x159f,
+0x17d9,0x188a,0x188a,0x18c3,0x18c3,0x1a8e,0x1b39,0x1b39,0x198,0x198,0x198,0x198,0x198,0x198,0x198,0x198,
+0x159f,0x159f,0x159f,0x159f,0x159f,0x159f,0x159c,0x159c,0x159c,0x159f,0x159c,0x170a,0x170a,0x198,0x198,0x198,
+0x159f,0x159c,0x159c,0x159f,0x188a,0x188a,0x188a,0x1926,0x1926,0x1a07,0x1a8e,0x1b39,0x1b39,0x198,0x198,0x198,
+0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,
+0x13cb,0x13cb,0x13cb,0x13cb,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,
+0x1467,0x15a5,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x15a5,0x15a5,0x15a5,
+0x15a5,0x15a5,0x15a5,0x175e,0x175e,0x19e,0x1809,0x1809,0x1809,0x1809,0x1809,0x1809,0x1809,0x1809,0x1ad3,0x1ad3,
+0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x19e,0x19e,0x19e,0x19e,0x19e,0x19e,0x19e,0x19e,
+0x19e,0x19e,0x19e,0x1983,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,
+0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,
+0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,
+0x1a1,0x146d,0x146d,0x1a1,0x146d,0x1a1,0x1a1,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,
+0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x1a1,0x1a1,0x1a1,
+0x1a1,0x1a1,0x146d,0x1a1,0x1a1,0x1a1,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x146d,0x146d,
+0x1a1,0x146d,0x146d,0x1a1,0x146d,0x1a1,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d,
+0x1a1,0x146d,0x146d,0x1a1,0x146d,0x1a1,0x1a1,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,
+0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x1a1,
+0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d,
+0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x1a1,0x1a1,0x1a1,0x1a1,
+0x1a1,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d,
+0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x1a1,0x1a1,0x1a1,0x1a1,
+0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,
+0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x146a,0x146a,0x1a1,0x1a1,
+0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1482,0x1482,0x1482,0x1482,
+0x1482,0x1482,0x1482,0x1470,0x1470,0x1470,0x1470,0x1470,0x147f,0x1470,0x1473,0x1473,0x1470,0x1470,0x1470,0x1476,
+0x1476,0x1a4,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x1479,0x1485,0x1485,0x1485,
+0x1989,0x1986,0x1986,0x1ad6,0x1a4,0x1a4,0x1a4,0x1a4,0x1a4,0x1a4,0x1a4,0x1a4,0x162f,0x162f,0x162f,0x162f,
+0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x1491,0x1491,0x1491,0x1491,
+0x1491,0x1491,0x1491,0x1491,0x1491,0x1491,0x1491,0x148e,0x1488,0x1488,0x148e,0x148e,0x1497,0x1497,0x1491,0x1494,
+0x1494,0x148e,0x148b,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x149a,0x149a,0x149a,0x149a,
+0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,
+0x149a,0x149a,0x149a,0x149a,0x1aa,0x1aa,0x1aa,0x1aa,0x1761,0x1761,0x149a,0x149a,0x1761,0x1761,0x1761,0x1761,
+0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1aa,0x1aa,0x1761,0x1761,
+0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x14a6,0x14a6,0x14a6,0x14a6,
+0x14a6,0x1a37,0x1a37,0x1a37,0x1a37,0x1a37,0x1a37,0x1ad,0x1ad,0x1ad,0x1ad,0x1a31,0x14a6,0x14a3,0x14a3,0x14a3,
+0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x1a34,0x1a34,0x1a34,0x1a34,
+0x1a34,0x1a34,0x1a34,0x1a34,0x1ad,0x1ad,0x1ad,0x1ad,0x1ad,0x1ad,0x1ad,0x14a0,0x14a0,0x14a0,0x14a0,0x14a9,
+0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14ca,0x14ca,0x14ca,0x14ca,
+0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x14c7,0x14c7,0x14c7,0x14c7,
+0x14c7,0x14c7,0x14c7,0x14c7,0x14c7,0x14c7,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x14cd,0x14cd,0x14cd,0x14cd,
+0x14cd,0x14cd,0x14cd,0x14cd,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1323,0x1320,0x1323,0x12ff,
+0x1320,0x1326,0x1326,0x1329,0x1326,0x1329,0x132c,0x1320,0x1329,0x1329,0x1320,0x1320,0x14df,0x14df,0x14df,0x14df,
+0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14d0,0x14d9,0x14d0,0x14d9,0x14d9,0x14d0,0x14d0,0x14d0,0x14d0,
+0x14d0,0x14d0,0x14dc,0x14d3,0x1a3a,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x15b1,0x15b1,0x15b1,0x15b1,
+0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x1b9,0x1b9,0x15ae,0x15ae,0x15ae,0x15ae,
+0x15ae,0x15b4,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1719,0x1710,0x1710,0x1710,
+0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,
+0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1bf,0x1bf,0x1bf,0x1bf,0x1adf,0x1c2,0x1c2,0x1c2,
+0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,
+0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,
+0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x1c5,0x1c5,0x1c5,0x1c5,0x1c5,
+0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x1c5,0x1c5,0x1c5,
+0x1c5,0x1c5,0x1c5,0x1c5,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x1c5,0x1c5,
+0x15c9,0x15c3,0x15c6,0x15cf,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x1c8,0x1c8,0x1c8,0x1c8,
+0x1c8,0x1c8,0x1c8,0x1c8,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,
+0x15ba,0x15ba,0x15ba,0x15ba,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,
+0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x198c,0x198c,0x198c,0x198c,0x1cb,0x1cb,0x1cb,
+0x1cb,0x1cb,0x1cb,0x1cb,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,
+0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,
+0x1cb,0x1cb,0x1cb,0x1cb,0x1776,0x171c,0x15de,0x1722,0x1ce,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,
+0x15e7,0x1ce,0x1ce,0x15e7,0x15e7,0x1ce,0x1ce,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,
+0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x1ce,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x1ce,0x15e7,0x15e7,
+0x1ce,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x1ce,0x1a16,0x171f,0x15e7,0x15d8,0x15de,0x15d8,0x15de,0x15de,0x15de,
+0x15de,0x1ce,0x1ce,0x15de,0x15de,0x1ce,0x1ce,0x15e1,0x15e1,0x15e4,0x1ce,0x1ce,0x1779,0x1ce,0x1ce,0x1ce,
+0x1ce,0x1ce,0x1ce,0x15d8,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x15ea,0x15e7,0x15e7,0x15e7,0x15e7,0x15de,0x15de,
+0x1ce,0x1ce,0x15db,0x15db,0x15db,0x15db,0x15db,0x15db,0x15db,0x1ce,0x1ce,0x1ce,0x15db,0x15db,0x15db,0x15db,
+0x15db,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x15ff,0x15ff,0x15ff,0x15ff,
+0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x1d1,0x15ff,
+0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15f9,0x15f9,0x15f9,0x15ed,
+0x15ed,0x15ed,0x15f9,0x15f9,0x15ed,0x15fc,0x15f0,0x15ed,0x1602,0x1602,0x15f6,0x1602,0x1602,0x15f3,0x180c,0x1d1,
+0x1611,0x1611,0x1611,0x1605,0x1605,0x1605,0x1605,0x1605,0x1605,0x1608,0x160b,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4,
+0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4,
+0x177c,0x177c,0x177c,0x177c,0x161d,0x161a,0x1a3d,0x1a3d,0x1ae5,0x1ae8,0x1ae2,0x1ae2,0x1d7,0x1d7,0x1d7,0x1d7,
+0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,
+0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,
+0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,
+0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,
+0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,
+0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,
0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,
-0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,
-0x162f,0x162f,0x162f,0x1626,0x1629,0x162c,0x162f,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,
-0x163e,0x163e,0x163e,0x163e,0x163e,0x1632,0x1632,0x1e0,0x1e0,0x1e0,0x1e0,0x1635,0x1635,0x1635,0x1635,0x1635,
-0x163b,0x163b,0x163b,0x163b,0x163b,0x163b,0x1638,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0,
-0x1647,0x1647,0x1647,0x1647,0x1647,0x1e3,0x1e3,0x1644,0x1644,0x1644,0x1644,0x1644,0x1644,0x1644,0x1644,0x1644,
-0x1641,0x1641,0x1641,0x1641,0x1641,0x1641,0x1641,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,
-0x164a,0x165c,0x165c,0x1650,0x1659,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,
-0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,
-0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,
-0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1e9,
-0x166e,0x166e,0x166e,0x166e,0x166e,0x1668,0x1671,0x166e,0x166e,0x166e,0x166e,0x166e,0x166e,0x166e,0x166e,0x166e,
-0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166e,0x166e,0x166e,0x166e,0x166e,0x1ec,
-0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,
-0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1ef,
-0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,
-0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1680,0x1680,0x1680,0x1680,0x1680,0x1f2,0x1f2,0x1f2,0x1f2,0x1f2,
-0x169b,0x169b,0x169e,0x169e,0x16a1,0x1692,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,
-0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1f5,0x1692,0x1692,0x1692,0x1692,0x1692,
-0x1692,0x1692,0x1f5,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,
-0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x169b,0x169b,0x169b,
-0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,
-0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x1f8,0x1f8,0x1f8,0x1f8,0x1f8,0x1f8,0x1f8,
-0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,
-0x16b3,0x16b3,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x16b0,0x16b0,0x16b0,0x16b0,0x1fb,0x1fb,0x1fb,
-0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16b6,
-0x16c8,0x16c8,0x16b6,0x16b6,0x16b6,0x16b6,0x201,0x201,0x16c8,0x16c8,0x16cb,0x16cb,0x16b6,0x16b6,0x16c8,0x16bc,
-0x16b9,0x16bf,0x16d1,0x16d1,0x16c2,0x16c2,0x16c5,0x16c5,0x16c5,0x16d1,0x1785,0x1785,0x1785,0x1785,0x1785,0x1785,
-0x1785,0x1785,0x1785,0x1785,0x1785,0x1785,0x1785,0x1785,0x1782,0x1782,0x1782,0x1782,0x177f,0x177f,0x201,0x201,
-0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,
-0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,
-0x204,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,
-0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x204,0x204,0x204,0x204,0x204,0x204,0x204,0x204,0x204,0x204,0x204,
-0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x207,0x207,0x207,0x207,
-0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,
-0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,
-0x16d7,0x16d7,0x207,0x207,0x207,0x207,0x207,0x207,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,
-0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,
-0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x207,0x207,0x1aeb,0x1aeb,0x207,0x207,
-0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,
-0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,
-0x16da,0x16e9,0x16e0,0x16dd,0x16ef,0x16ef,0x16e3,0x16ef,0x20a,0x20a,0x20a,0x20a,0x20a,0x20a,0x20a,0x20a,
-0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x20a,0x20a,0x20a,0x20a,0x20a,0x20a,
-0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f2,0x16f2,0x16f2,0x16f2,0x16f2,0x16f2,
-0x16f2,0x16f2,0x16f2,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x16fb,
-0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,
-0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x198f,0x210,0x210,0x1788,0x1788,0x1788,
-0x1794,0x1794,0x1788,0x1788,0x1788,0x1788,0x1794,0x1788,0x1788,0x1788,0x1788,0x178b,0x210,0x210,0x210,0x210,
-0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x178e,0x178e,0x179a,0x179a,0x179a,0x178e,
-0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,
-0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,
-0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,
-0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x219,0x17af,0x17af,0x219,0x219,
-0x219,0x219,0x219,0x17ac,0x17ac,0x17ac,0x17ac,0x17ac,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x21c,
-0x17b2,0x21c,0x17b2,0x17b2,0x17b2,0x17b2,0x21c,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,
-0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x21c,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,
-0x17b2,0x17b5,0x21c,0x21c,0x21c,0x21c,0x21c,0x21c,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,
-0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,
-0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x21f,0x21f,0x21f,0x21f,0x21f,
-0x21f,0x21f,0x21f,0x21f,0x21f,0x21f,0x21f,0x21f,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,
-0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x21f,0x21f,0x21f,0x21f,0x21f,
-0x21f,0x21f,0x17b8,0x17b8,0x17b8,0x17b8,0x17b8,0x17b8,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,
-0x1929,0x1929,0x1929,0x1929,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a94,0x1b3c,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1b3f,
-0x1b3c,0x222,0x1a0a,0x1a94,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x17df,0x1a0a,0x1a0a,0x1a94,0x1a94,0x1a94,0x1a94,0x1a94,
-0x1a94,0x1a94,0x1a94,0x1b3c,0x222,0x1a97,0x1a97,0x1a97,0x1929,0x192c,0x192c,0x192c,0x192c,0x192c,0x192c,0x192c,
-0x192c,0x192c,0x192c,0x192c,0x192c,0x192c,0x1929,0x1929,0x17c4,0x17c4,0x17c4,0x17c4,0x17c1,0x17c4,0x17c4,0x17c7,
-0x17ca,0x17c7,0x17c7,0x17c4,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,
-0x225,0x225,0x225,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x1821,0x1821,0x1821,0x1821,0x1818,0x1818,0x1818,0x1812,
-0x1815,0x1815,0x1815,0x1a40,0x228,0x228,0x228,0x228,0x181e,0x181e,0x181e,0x181e,0x181e,0x181e,0x181e,0x181e,
-0x181e,0x181e,0x228,0x228,0x228,0x228,0x181b,0x181b,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,
-0x183c,0x22b,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,
-0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x1839,0x1827,0x1827,0x1827,0x1827,
-0x1827,0x1827,0x1827,0x22b,0x1827,0x1827,0x1827,0x1827,0x1827,0x1827,0x1839,0x182a,0x183c,0x183f,0x183f,0x1833,
-0x1830,0x1830,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x1836,0x1836,0x1836,0x1836,
-0x1836,0x1836,0x1836,0x1836,0x1836,0x1836,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d,
-0x182d,0x182d,0x182d,0x182d,0x182d,0x22b,0x22b,0x22b,0x184b,0x184e,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,
-0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1842,0x1842,0x1842,0x1842,0x1842,0x1842,0x1842,0x1842,
-0x1842,0x22e,0x22e,0x22e,0x22e,0x22e,0x22e,0x22e,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,
-0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x231,
-0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,
-0x1845,0x231,0x231,0x1845,0x1845,0x1845,0x1845,0x1845,0x1893,0x192f,0x1a9a,0x1a9d,0x1b45,0x234,0x234,0x234,
-0x234,0x234,0x234,0x234,0x234,0x234,0x234,0x234,0x1b42,0x1b42,0x234,0x234,0x234,0x234,0x234,0x234,
-0x234,0x234,0x234,0x234,0x234,0x234,0x234,0x234,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,
-0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x237,0x237,0x1848,0x1848,0x1848,0x1848,0x1848,0x1848,
-0x1848,0x1848,0x1848,0x1848,0x1848,0x1848,0x1848,0x1848,0x237,0x1851,0x1848,0x1848,0x1848,0x1848,0x1848,0x1848,
-0x1848,0x1851,0x1848,0x1848,0x1851,0x1848,0x1848,0x237,0x237,0x237,0x237,0x237,0x237,0x237,0x237,0x237,
-0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x23a,0x23a,0x23a,
-0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,
-0x186f,0x186f,0x1860,0x185a,0x185a,0x186f,0x185d,0x1872,0x1872,0x1872,0x1872,0x1875,0x1875,0x1869,0x1866,0x1863,
-0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x1aee,0x1869,0x23d,0x1863,0x1992,0x1a43,
-0x1af1,0x1af1,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,
-0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,
-0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,
-0x187b,0x187b,0x187b,0x187b,0x240,0x240,0x240,0x240,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,
-0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,
-0x1878,0x1878,0x1878,0x1878,0x240,0x240,0x240,0x240,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,
-0x1896,0x1896,0x1896,0x1896,0x1896,0x1a13,0x1a13,0x1a13,0x1a13,0x1a13,0x1aa0,0x1aa0,0x1aa0,0x1aa0,0x1aa0,0x1aa0,
-0x243,0x243,0x243,0x243,0x243,0x243,0x243,0x243,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,
-0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,
-0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x246,0x246,0x246,0x246,0x246,0x246,0x246,0x246,0x246,
-0x246,0x246,0x246,0x246,0x246,0x246,0x246,0x246,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,
-0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x249,
-0x18d5,0x18d5,0x249,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,
-0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x249,
-0x249,0x249,0x18c9,0x249,0x18c9,0x18c9,0x249,0x18c9,0x18c9,0x18c9,0x18cc,0x18c9,0x18cf,0x18cf,0x18d8,0x18c9,
-0x249,0x249,0x249,0x249,0x249,0x249,0x249,0x249,0x18d2,0x18d2,0x18d2,0x18d2,0x18d2,0x18d2,0x18d2,0x18d2,
-0x18d2,0x18d2,0x249,0x249,0x249,0x249,0x249,0x249,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,
-0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,
-0x1938,0x1938,0x1938,0x1938,0x24c,0x24c,0x24c,0x24c,0x1905,0x1908,0x1917,0x1917,0x1908,0x190b,0x1905,0x1902,
-0x255,0x255,0x255,0x255,0x255,0x255,0x255,0x255,0x18f0,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18ed,
-0x18ed,0x18db,0x18db,0x18db,0x18f0,0x18f0,0x18f0,0x18f0,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,
-0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x258,0x258,0x258,0x258,
-0x258,0x258,0x258,0x258,0x258,0x258,0x258,0x258,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,
-0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x258,0x258,0x1aa9,0x1aa9,0x1aa9,0x1aa9,0x1b4b,0x28b,0x28b,0x28b,
-0x1aa9,0x1aa9,0x1aa9,0x28b,0x28b,0x28b,0x28b,0x28b,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,
-0x19aa,0x19aa,0x19aa,0x19aa,0x19a7,0x19a7,0x19a7,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,
-0x19a7,0x19a1,0x199e,0x19a4,0x25b,0x25b,0x25b,0x25b,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,
-0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,
-0x19ad,0x19ad,0x19ad,0x25e,0x25e,0x19ad,0x19ad,0x19ad,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x261,0x19bc,
-0x19bc,0x261,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,
-0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19b9,0x19b9,0x19b9,0x19b9,0x19b9,0x261,
-0x19b0,0x19b0,0x261,0x19b9,0x19b9,0x19b0,0x19b9,0x19b3,0x19bc,0x261,0x261,0x261,0x261,0x261,0x261,0x261,
-0x19c5,0x19c5,0x19c8,0x19c8,0x19bf,0x19bf,0x19bf,0x19bf,0x264,0x264,0x264,0x264,0x264,0x264,0x264,0x264,
-0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x264,0x264,0x264,0x264,0x264,0x264,
-0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19ce,0x19cb,0x19cb,0x19cb,
-0x19ce,0x19cb,0x19cb,0x19cb,0x19cb,0x267,0x267,0x267,0x267,0x267,0x267,0x267,0x267,0x267,0x267,0x267,
-0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,
-0x19d7,0x19d7,0x19d7,0x19d1,0x19d1,0x19d4,0x19d4,0x19da,0x19da,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,
-0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,
-0x19dd,0x19dd,0x19dd,0x19dd,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,
-0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,
-0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e3,0x19ec,0x19e0,0x19e0,0x270,0x270,0x270,0x270,0x270,
-0x19ef,0x19ef,0x19ef,0x19ef,0x19ef,0x19ef,0x19ef,0x19f2,0x273,0x273,0x273,0x273,0x273,0x273,0x273,0x273,
-0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,
-0x19fb,0x19fb,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f8,0x19f8,0x19f8,
-0x19f8,0x19fe,0x19fe,0x19fe,0x19fe,0x19fe,0x276,0x276,0x276,0x276,0x276,0x276,0x1a55,0x1a55,0x1a55,0x1a55,
-0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,
-0x1a55,0x1a55,0x1a55,0x27c,0x27c,0x27c,0x27c,0x27c,0x27c,0x27c,0x27c,0x27c,0x1a64,0x1a64,0x1a64,0x1a64,
-0x1a64,0x1a64,0x1a64,0x1a64,0x27f,0x27f,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,
-0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a61,0x1a61,0x1a61,
-0x1a58,0x1a58,0x1a58,0x1a58,0x27f,0x27f,0x1a58,0x1a58,0x1a61,0x1a61,0x1a61,0x1a61,0x1a5b,0x1a64,0x1a5e,0x1a64,
-0x1a61,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,
-0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x1a70,0x1a70,0x1a70,0x1a70,
-0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x282,0x282,0x282,0x1a67,0x1a67,0x1a67,0x1a67,
-0x1a67,0x1a67,0x1a67,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a73,0x1a73,0x282,0x282,0x285,0x1a76,0x1a76,0x1a76,
-0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,
-0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x285,0x285,
-0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,
-0x1aa3,0x1aa3,0x1aa3,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,
-0x1aa6,0x1aa6,0x1aa6,0x1aa6,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x1938,0x1938,0x1938,0x1938,
-0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1aa9,0x1aa9,0x1aa9,0x1b4b,
-0x1b4b,0x1b4b,0x1b4b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x1aa9,0x1aa9,0x1aa9,0x1aa9,
-0x1aa9,0x1aa9,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x28b,0x28b,0x28b,
-0x28b,0x28b,0x28b,0x28b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x28b,0x28b,0x28b,0x28b,0x28b,
-0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x28b,
-0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,
-0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,
-0x1a7f,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,
-0x1a79,0x1a79,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x1a7c,
-0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a82,0x1a82,0x1a82,0x1a82,
-0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x291,0x291,0x291,0x291,0x291,0x1a85,
-0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af4,0x1af4,0x1af4,0x1af4,0x1af4,0x1af4,0x1af4,0x294,0x294,0x294,0x294,
-0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,
-0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x297,0x297,0x1b12,0x297,0x297,0x1b12,0x1b12,0x1b12,0x1b12,
-0x1b12,0x1b12,0x1b12,0x1b12,0x297,0x1b12,0x1b12,0x297,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,
-0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1afa,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x297,0x1b09,
-0x1b0c,0x297,0x297,0x1afa,0x1afa,0x1b0f,0x1b00,0x1b15,0x1b09,0x1b15,0x1b09,0x1afd,0x1b18,0x1b03,0x1b18,0x297,
-0x297,0x297,0x297,0x297,0x297,0x297,0x297,0x297,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,
-0x1b06,0x1b06,0x297,0x297,0x297,0x297,0x297,0x297,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,
-0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x29a,0x29a,
-0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,
-0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,
-0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,
-0x1b1e,0x1b1e,0x1b1e,0x2a0,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,
-0x1b1e,0x1b1e,0x1b1e,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,
-0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,
-0x1b21,0x1b21,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x1b54,0x1b54,0x1b54,0x1b54,0x1b54,0x1b54,0x1b54,0x1b54,
-0x1b54,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,
-0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,
-0x2a3,0x2a3,0x2a3,0x2a3,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x2a6,0x1b24,
-0x1b24,0x1b27,0x2a6,0x2a6,0x1b2a,0x1b2a,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,
-0x2a6,0x2a6,0x2a6,0x2a6,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,
-0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,
-0x2a9,0x2a9,0x2a9,0x2a9,0x1932,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,
-0x2c1,0x2c1,0x2c1,0x2c1,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,
-0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,
-0x2a9,0x2a9,0x97b,0x97b,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x2c4,
-0x2c4,0x2c4,0x2c4,0x2c4,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,
-0x2a9,0x2a9,0x2a9,0x2a9,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x1a04,
-0x1a04,0x1a04,0x1a04,0x1a04,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,
-0x1b33,0x2ac,0x2ac,0x2ac,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0x12e4,
-0x12e4,0x12e4,0x2af,0x2af,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,
-0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0x2af,0x2af,
-0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,
-0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,
-0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,
-0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0x1b36,0x1b36,0x1b36,0x1b36,0x1b36,0x1b36,0x1b36,0x2b2,0x2b2,
-0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,
-0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0x2b5,0x2b5,
-0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,
-0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,
-0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,
-0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x2bb,0x2bb,
-0x17dc,0x17dc,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,
-0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,
-0x3cc,0x3c0,0x3c0,0x3c0,0x3c0,0x3c0,0x3c0,0x3c0,0x3c0,0x3cc,0x3cc,0x3cc,0x3cc,0x3c6,0x1158,0x133e,
-0x3cf,0x945,0x948,0x3bd,0x3bd,0x1155,0x133b,0x133b,0x3d2,0x3d2,0x3d2,0x3d2,0x3d2,0x3d2,0x3d2,0x3d2,
-0x1155,0x3c0,0x3c0,0x3cc,0xce1,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,
-0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,
-0x3cf,0x3cf,0x3c0,0x3c0,0x8d0,0x8d3,0x963,0x963,0x963,0x963,0x963,0x963,0x963,0x963,0x963,0x963,
-0x3c9,0xfba,0xfb7,0x1341,0x1341,0x1341,0x1341,0x1341,0x1506,0x115b,0x115b,0xf0c,0xf0c,0xdda,0xf0c,0xf0c,
-0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3d2,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,
-0x3cf,0x3d2,0x3cf,0x3cf,0x3d2,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x133b,0x133e,0x3c3,0x3cf,0x3cc,0x3cc,
-0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x1347,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,
-0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x1347,0x18ae,0x18ae,0xfd8,0x45f,0x468,
-0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,
-0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0xbc7,0xbc7,0xde6,0xde6,0x8d6,0xde9,0x1428,0x1428,0x1428,
-0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,
-0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,
-0x4b3,0x4b3,0x4b3,0x1170,0x1170,0x1170,0x1170,0x1170,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,
-0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,
-0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x116d,0x116d,0x116d,0x116d,0x116d,0x116d,
-0x4b6,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,
-0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,
-0x4b3,0x4b3,0x4b3,0x4b3,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,
-0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,
-0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4b9,0x4b9,0x4b9,0x4b9,0x4bc,0x9bd,0x1005,0x1005,0x1008,0x1005,
-0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,
-0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x1008,0x1005,0x1008,0x1005,0x1008,0x1005,
-0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,
-0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,
-0x6ae,0x6ae,0x6b1,0x4e9,0x6bd,0x6ba,0x6ba,0x6b7,0x513,0x513,0x4d1,0x4d1,0x4d1,0x4d1,0x4d1,0xb58,
-0x6c0,0x4f5,0x6d8,0x6db,0x50a,0x6c0,0x4f8,0x4f8,0x4e9,0x504,0x504,0x6ae,0x510,0x50d,0x6b4,0x4e3,
-0x4da,0x4da,0x4dd,0x4dd,0x4dd,0x4dd,0x4dd,0x4e0,0x4dd,0x4dd,0x4dd,0x4d4,0x51c,0x519,0x516,0x516,
-0x6cc,0x4fe,0x4fb,0x6c9,0x6c6,0x6c3,0x6d5,0x4ec,0x6d2,0x6d2,0x501,0x504,0x6cf,0x6cf,0x501,0x504,
-0x4e6,0x4e9,0x4e9,0x4e9,0x507,0x4f2,0x4ef,0xbdc,0xaf2,0xaf5,0xaef,0xaef,0xaef,0xaef,0xbd3,0xbd3,
-0xbd3,0xbd3,0xbd9,0xd0e,0xd0b,0xdf5,0xdf8,0xbd6,0xdf8,0xdf8,0xdf8,0xdf8,0xdf5,0xdf8,0xdf8,0xbd0,
-0x540,0x540,0x540,0x540,0x540,0x540,0x540,0x53d,0x543,0x75c,0x540,0x9c0,0x9e1,0xaf8,0xaf8,0xaf8,
-0xbe2,0xbe2,0xdfe,0xdfe,0xdfe,0xdfe,0x1179,0x117c,0x117c,0x135c,0x14f4,0x151e,0x1521,0x1521,0x1734,0x18b1,
-0x54f,0x54f,0x567,0x6ea,0x54c,0x6e7,0x54f,0x564,0x54c,0x6ea,0x55e,0x567,0x567,0x567,0x55e,0x55e,
-0x567,0x567,0x567,0x6f3,0x54c,0x567,0x6ed,0x54c,0x55b,0x567,0x567,0x567,0x567,0x567,0x54c,0x54c,
-0x552,0x6e7,0x6f0,0x54c,0x567,0x54c,0x6f6,0x54c,0x567,0x555,0x56d,0x6f9,0x567,0x567,0x558,0x55e,
-0x567,0x567,0x56a,0x567,0x55e,0x561,0x561,0x561,0x561,0xb04,0xb01,0xd11,0xe07,0xbf7,0xbfa,0xbfa,
-0xbf4,0xbf1,0xbf1,0xbf1,0xbf1,0xbfa,0xbf7,0xbf7,0xbf7,0xbf7,0xbee,0xbf1,0xe04,0xf18,0xf1b,0x100e,
-0x117f,0x117f,0x117f,0x6ff,0x6fc,0x570,0x573,0x573,0x573,0x573,0x573,0x6fc,0x6ff,0x6ff,0x6fc,0x573,
-0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x57c,0x57c,0x57c,0x57c,
-0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x576,0x576,0x576,0x576,0x576,0x576,
-0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x57f,0x588,0x588,0x582,0x582,0x582,0x585,0x57f,
-0x582,0x582,0x57f,0x57f,0x57f,0x57f,0x582,0x582,0x708,0x708,0x57f,0x57f,0x582,0x582,0x582,0x582,
-0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x585,0x585,0x585,0x582,0x582,0x70b,0x582,
-0x70b,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x57f,0x582,0x57f,0x57f,0x57f,0x57f,0x57f,0x57f,
-0x582,0x582,0x57f,0x708,0x57f,0x57f,0x57f,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a,
-0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0x711,0x58b,0x711,0x711,
-0x58e,0x58b,0x58b,0x711,0x711,0x58e,0x58b,0x711,0x58e,0x58b,0x58b,0x711,0x58b,0x711,0x59a,0x597,
-0x58b,0x711,0x58b,0x58b,0x58b,0x58b,0x711,0x58b,0x58b,0x711,0x711,0x711,0x711,0x58b,0x58b,0x711,
-0x58e,0x711,0x58e,0x711,0x711,0x711,0x711,0x711,0x717,0x591,0x711,0x591,0x591,0x58b,0x58b,0x58b,
-0x711,0x711,0x711,0x711,0x58b,0x58b,0x58b,0x58b,0x711,0x711,0x58b,0x58b,0x58b,0x58e,0x58b,0x58b,
-0x58e,0x58b,0x58b,0x58e,0x711,0x58e,0x58b,0x58b,0x711,0x58b,0x58b,0x58b,0x58b,0x58b,0x711,0x58b,
-0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x714,0x711,0x58e,0x58b,
-0x711,0x711,0x711,0x711,0x58b,0x58b,0x711,0x711,0x58b,0x58e,0x714,0x714,0x58e,0x58e,0x58b,0x58b,
-0x58e,0x58e,0x58b,0x58b,0x58e,0x58e,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58e,0x58e,0x711,0x711,
-0x58e,0x58e,0x711,0x711,0x58e,0x58e,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,
-0x58b,0x711,0x58b,0x58b,0x58b,0x711,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x711,0x58b,0x58b,
-0x58b,0x58b,0x58b,0x58b,0x58e,0x58e,0x58e,0x58e,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,
-0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x711,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,
-0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,
-0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58e,0x58e,0x58e,0x58e,0x58b,0x58b,0x58b,0x58b,
-0x58b,0x58b,0x58e,0x58e,0x58e,0x58e,0x58b,0x594,0x58b,0x58b,0xc00,0xc00,0xc00,0xc00,0xc00,0xc00,
-0xc00,0xc00,0xc00,0xc00,0xc00,0xc00,0xc00,0xc00,0x59d,0xb0d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,
-0x5a9,0x5a6,0x5a9,0x5a6,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x71a,0x59d,0x59d,0x59d,0x59d,0x59d,
-0x59d,0x59d,0x81f,0x81f,0x59d,0x59d,0x59d,0x59d,0x5a3,0x5a3,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,
-0x5a0,0x825,0x822,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,
-0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,
-0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0xb0d,0xc06,0xb0d,0xb0d,0xb0d,0x5ac,0x5ac,0x5ac,0x5ac,
-0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,
-0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x723,0x723,0x723,0x723,
-0x723,0x723,0x723,0x723,0x723,0x723,0x5b2,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,
-0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xd89,0x72c,0x72c,0x72c,0x72c,
-0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,
-0x5b5,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x72c,0x72c,0x72c,0x72c,
-0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x5b8,0x5b8,0x5b8,0x5b8,0x72c,0x72c,0x72c,0x72c,
-0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72f,0x72f,0x72f,0x72f,
-0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x5bb,0x5bb,0x72f,0x72f,
-0x72f,0x72f,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0x735,0x735,0x5be,0x732,
-0x732,0x732,0x732,0x732,0x732,0x732,0x5c1,0x5c1,0x5be,0x5be,0x5c4,0x5c4,0x5c4,0x5c4,0x735,0x735,
-0x5c4,0x5c4,0x738,0x735,0x5be,0x5be,0x5be,0x5be,0x735,0x735,0x5c4,0x5c4,0x738,0x735,0x5be,0x5be,
-0x5be,0x5be,0x735,0x735,0x732,0x5be,0x5c4,0x735,0x5be,0x5be,0x732,0x735,0x735,0x735,0x5c4,0x5c4,
-0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x735,0x732,
-0x735,0x732,0x5be,0x5c4,0x5c4,0x5c4,0x5c4,0x5c4,0x5c4,0x5be,0x5be,0x732,0xb16,0xb16,0xb16,0xb16,
-0xb16,0xb16,0xb16,0xb16,0xc0c,0xc0c,0xc0c,0xc0f,0xc0f,0xc8a,0xc8a,0xc0c,0x5d3,0x5d3,0x5d3,0x5d3,
-0x5d0,0x74a,0x747,0x5ca,0x5ca,0x73b,0x5ca,0x5ca,0x5ca,0x5ca,0x741,0x73b,0x5ca,0x5d0,0x5ca,0x5c7,
-0xd92,0xd92,0xc15,0xc15,0xe13,0xb19,0x5cd,0x5cd,0x73e,0x5d6,0x73e,0x5cd,0x5d0,0x5ca,0x5d0,0x5d0,
-0x5ca,0x5ca,0x5d0,0x5ca,0x5ca,0x5ca,0x5d0,0x5ca,0x5ca,0x5ca,0x5d0,0x5d0,0x5ca,0x5ca,0x5ca,0x5ca,
-0x5ca,0x5ca,0x5ca,0x5ca,0x5d0,0x5d3,0x5d3,0x5cd,0x5ca,0x5ca,0x5ca,0x5ca,0x74d,0x5ca,0x74d,0x5ca,
-0x5ca,0x5ca,0x5ca,0x5ca,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,
-0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5d0,0x74d,0x74a,0x5d9,0x74d,
-0x73b,0x741,0x5d0,0x73b,0x744,0x73b,0x73b,0x5ca,0x73b,0x74a,0x5d9,0x74a,0xb19,0xb19,0xc18,0xc18,
-0xc18,0xc18,0xc18,0xc18,0xc18,0xc18,0xc18,0xc1b,0xc18,0xc18,0xe10,0xec7,0x5dc,0x5dc,0x5dc,0x5dc,
-0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,
-0x5df,0x13e6,0x13e6,0x13e6,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x152a,0x5eb,0x5f4,0x5eb,
-0x5eb,0x13e6,0x5df,0x5df,0x5f4,0x5f4,0x13e9,0x13e9,0x5f7,0x5f7,0x5e8,0x5ee,0x5e8,0x5e8,0x5ee,0x5df,
-0x5ee,0x5df,0x5ee,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5ee,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,
-0x13e6,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5ee,0x5ee,0x5df,0x5df,0x5df,
-0x5df,0x5df,0x5df,0x5df,0x5df,0x753,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5ee,0x5df,0x5df,0x5ee,
-0x5df,0x5df,0x5df,0x5df,0x13e6,0x5df,0x13e6,0x5df,0x5df,0x5df,0x5df,0x13e6,0x13e6,0x13e6,0x5df,0x12de,
-0x5df,0x5df,0x5df,0x5e5,0x5e5,0x5e5,0x5e5,0x1368,0x1368,0x5df,0x5e2,0x5f1,0x5f4,0x5e8,0x5e8,0x5e8,
-0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0x750,0x750,
-0x750,0x750,0x750,0x750,0x750,0x750,0x750,0x750,0x5df,0x5ee,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,
-0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x13e6,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,
-0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x13e6,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,
-0x618,0x618,0x618,0x618,0x618,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x621,0x621,0x621,0x621,
-0x621,0x621,0x621,0x621,0x618,0x61e,0x60f,0x612,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,
-0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,
-0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x615,0x615,0x615,0x615,0x615,0x615,0x618,0x618,0x618,0x618,
-0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,
-0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,
-0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,
-0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618,
-0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,
-0x61b,0x621,0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61e,0x618,
-0x61b,0x621,0x61e,0x618,0x61e,0x618,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b,
-0x136b,0x136b,0x136b,0x136b,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61b,0x621,0x61e,0x618,
-0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61b,0x61e,0x618,0x61b,
-0x61e,0x618,0x61b,0x621,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,
-0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x61b,0x61b,0x61b,0x61b,0x61b,
-0x61b,0x61b,0x61b,0x61b,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,
-0x61e,0x61e,0x61e,0x61e,0x61e,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,
-0x618,0x618,0x618,0x618,0x61b,0x61b,0x618,0x61b,0x618,0x61b,0x618,0x618,0x61b,0x618,0x618,0x61b,
-0x618,0x61b,0x618,0x618,0x61b,0x618,0x61b,0x61b,0x618,0x618,0x618,0x61b,0x618,0x618,0x618,0x618,
-0x618,0x61b,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,
-0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x61b,0x61b,0x618,0x618,0x61b,0x618,0x61b,0x618,
-0x618,0x618,0x618,0x618,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,
-0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,
-0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x621,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,
-0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,
-0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,
-0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x61e,0x61e,0x61e,
-0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x624,0x624,0x624,0x624,0x101a,0x101a,0x101a,0x152d,
-0x152d,0x152d,0x152d,0x152d,0x152d,0x152d,0x173a,0x173a,0x885,0x88b,0x88b,0x897,0x897,0x888,0x87f,0x888,
-0x87f,0x888,0x87f,0x888,0x87f,0x888,0x87f,0x888,0x633,0x633,0x62d,0x633,0x62d,0x633,0x62d,0x633,
-0x62d,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633,0x62d,0x630,
-0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633,0x62d,0x633,0x62d,0x633,
-0x62d,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,
-0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,
-0x636,0x633,0x62d,0x630,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,
-0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,
-0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,
-0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x726,0x726,0x726,0x726,0x726,0x726,
-0x726,0x726,0x726,0x726,0x726,0x726,0x729,0x726,0x726,0x726,0x726,0x726,0x726,0x726,0x726,0x726,
-0x726,0x726,0x726,0x726,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,
-0x723,0x723,0x723,0x723,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,
-0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,
-0x72c,0x72c,0x72c,0x72c,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,
-0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,
-0x756,0x756,0x756,0x756,0xc78,0x8e8,0x8e2,0x8df,0x8e5,0x8dc,0x76b,0x76e,0x76e,0x76e,0x76e,0x76e,
-0x76e,0x76e,0x76e,0x76e,0x8ee,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,
-0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,
-0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x8eb,0x8eb,0x771,0x8fd,0x900,0x906,0x82b,0x837,0x91b,0x834,
-0x8f4,0x8f1,0x8f4,0x8f1,0x8fa,0x8f7,0x8fa,0x8f7,0x8f4,0x8f1,0x831,0x906,0x8f4,0x8f1,0x8f4,0x8f1,
-0x8f4,0x8f1,0x8f4,0x8f1,0x909,0x912,0x90f,0x90f,0x777,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x7ad,
-0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,
-0x7ad,0x7ad,0x7ad,0x77a,0x795,0x774,0x79b,0x79e,0x798,0x7b0,0x7b0,0x7b0,0x7b0,0x7b0,0x7b0,0x7aa,
-0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,
-0x7aa,0x7aa,0x7aa,0x77a,0x795,0x774,0x795,0xc7b,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,
+0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,
+0x162f,0x162f,0x162f,0x1626,0x1629,0x162c,0x162f,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,
+0x163e,0x163e,0x163e,0x163e,0x163e,0x1632,0x1632,0x1e0,0x1e0,0x1e0,0x1e0,0x1635,0x1635,0x1635,0x1635,0x1635,
+0x163b,0x163b,0x163b,0x163b,0x163b,0x163b,0x1638,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0,
+0x1647,0x1647,0x1647,0x1647,0x1647,0x1e3,0x1e3,0x1644,0x1644,0x1644,0x1644,0x1644,0x1644,0x1644,0x1644,0x1644,
+0x1641,0x1641,0x1641,0x1641,0x1641,0x1641,0x1641,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,
+0x164a,0x165c,0x165c,0x1650,0x1659,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,
+0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,
+0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,
+0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1e9,
+0x166e,0x166e,0x166e,0x166e,0x166e,0x1668,0x1671,0x166e,0x166e,0x166e,0x166e,0x166e,0x166e,0x166e,0x166e,0x166e,
+0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166e,0x166e,0x166e,0x166e,0x166e,0x1ec,
+0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,
+0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1ef,
+0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,
+0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1680,0x1680,0x1680,0x1680,0x1680,0x1f2,0x1f2,0x1f2,0x1f2,0x1f2,
+0x169b,0x169b,0x169e,0x169e,0x16a1,0x1692,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,
+0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1f5,0x1692,0x1692,0x1692,0x1692,0x1692,
+0x1692,0x1692,0x1f5,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,
+0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x169b,0x169b,0x169b,
+0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,
+0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x1f8,0x1f8,0x1f8,0x1f8,0x1f8,0x1f8,0x1f8,
+0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,
+0x16b3,0x16b3,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x16b0,0x16b0,0x16b0,0x16b0,0x1fb,0x1fb,0x1fb,
+0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16b6,
+0x16c8,0x16c8,0x16b6,0x16b6,0x16b6,0x16b6,0x201,0x201,0x16c8,0x16c8,0x16cb,0x16cb,0x16b6,0x16b6,0x16c8,0x16bc,
+0x16b9,0x16bf,0x16d1,0x16d1,0x16c2,0x16c2,0x16c5,0x16c5,0x16c5,0x16d1,0x1785,0x1785,0x1785,0x1785,0x1785,0x1785,
+0x1785,0x1785,0x1785,0x1785,0x1785,0x1785,0x1785,0x1785,0x1782,0x1782,0x1782,0x1782,0x177f,0x177f,0x201,0x201,
+0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,
+0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,
+0x204,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,
+0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x204,0x204,0x204,0x204,0x204,0x204,0x204,0x204,0x204,0x204,0x204,
+0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x207,0x207,0x207,0x207,
+0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,
+0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,
+0x16d7,0x16d7,0x207,0x207,0x207,0x207,0x207,0x207,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,
+0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,
+0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x207,0x207,0x1aeb,0x1aeb,0x207,0x207,
+0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,
+0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,
+0x16da,0x16e9,0x16e0,0x16dd,0x16ef,0x16ef,0x16e3,0x16ef,0x20a,0x20a,0x20a,0x20a,0x20a,0x20a,0x20a,0x20a,
+0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x20a,0x20a,0x20a,0x20a,0x20a,0x20a,
+0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f2,0x16f2,0x16f2,0x16f2,0x16f2,0x16f2,
+0x16f2,0x16f2,0x16f2,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x16fb,
+0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,
+0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x198f,0x210,0x210,0x1788,0x1788,0x1788,
+0x1794,0x1794,0x1788,0x1788,0x1788,0x1788,0x1794,0x1788,0x1788,0x1788,0x1788,0x178b,0x210,0x210,0x210,0x210,
+0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x178e,0x178e,0x179a,0x179a,0x179a,0x178e,
+0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,
+0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,
+0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,
+0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x219,0x17af,0x17af,0x219,0x219,
+0x219,0x219,0x219,0x17ac,0x17ac,0x17ac,0x17ac,0x17ac,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x21c,
+0x17b2,0x21c,0x17b2,0x17b2,0x17b2,0x17b2,0x21c,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,
+0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x21c,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,
+0x17b2,0x17b5,0x21c,0x21c,0x21c,0x21c,0x21c,0x21c,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,
+0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,
+0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x21f,0x21f,0x21f,0x21f,0x21f,
+0x21f,0x21f,0x21f,0x21f,0x21f,0x21f,0x21f,0x21f,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,
+0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x21f,0x21f,0x21f,0x21f,0x21f,
+0x21f,0x21f,0x17b8,0x17b8,0x17b8,0x17b8,0x17b8,0x17b8,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,
+0x1929,0x1929,0x1929,0x1929,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a94,0x1b3c,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1b3f,
+0x1b3c,0x222,0x1a0a,0x1a94,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x17df,0x1a0a,0x1a0a,0x1a94,0x1a94,0x1a94,0x1a94,0x1a94,
+0x1a94,0x1a94,0x1a94,0x1b3c,0x222,0x1a97,0x1a97,0x1a97,0x1929,0x192c,0x192c,0x192c,0x192c,0x192c,0x192c,0x192c,
+0x192c,0x192c,0x192c,0x192c,0x192c,0x192c,0x1929,0x1929,0x17c4,0x17c4,0x17c4,0x17c4,0x17c1,0x17c4,0x17c4,0x17c7,
+0x17ca,0x17c7,0x17c7,0x17c4,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,
+0x225,0x225,0x225,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x1821,0x1821,0x1821,0x1821,0x1818,0x1818,0x1818,0x1812,
+0x1815,0x1815,0x1815,0x1a40,0x228,0x228,0x228,0x228,0x181e,0x181e,0x181e,0x181e,0x181e,0x181e,0x181e,0x181e,
+0x181e,0x181e,0x228,0x228,0x228,0x228,0x181b,0x181b,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,
+0x183c,0x22b,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,
+0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x1839,0x1827,0x1827,0x1827,0x1827,
+0x1827,0x1827,0x1827,0x22b,0x1827,0x1827,0x1827,0x1827,0x1827,0x1827,0x1839,0x182a,0x183c,0x183f,0x183f,0x1833,
+0x1830,0x1830,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x1836,0x1836,0x1836,0x1836,
+0x1836,0x1836,0x1836,0x1836,0x1836,0x1836,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d,
+0x182d,0x182d,0x182d,0x182d,0x182d,0x22b,0x22b,0x22b,0x184b,0x184e,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,
+0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1842,0x1842,0x1842,0x1842,0x1842,0x1842,0x1842,0x1842,
+0x1842,0x22e,0x22e,0x22e,0x22e,0x22e,0x22e,0x22e,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,
+0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x231,
+0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,
+0x1845,0x231,0x231,0x1845,0x1845,0x1845,0x1845,0x1845,0x1893,0x192f,0x1a9a,0x1a9d,0x1b45,0x234,0x234,0x234,
+0x234,0x234,0x234,0x234,0x234,0x234,0x234,0x234,0x1b42,0x1b42,0x234,0x234,0x234,0x234,0x234,0x234,
+0x234,0x234,0x234,0x234,0x234,0x234,0x234,0x234,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,
+0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x237,0x237,0x1848,0x1848,0x1848,0x1848,0x1848,0x1848,
+0x1848,0x1848,0x1848,0x1848,0x1848,0x1848,0x1848,0x1848,0x237,0x1851,0x1848,0x1848,0x1848,0x1848,0x1848,0x1848,
+0x1848,0x1851,0x1848,0x1848,0x1851,0x1848,0x1848,0x237,0x237,0x237,0x237,0x237,0x237,0x237,0x237,0x237,
+0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x23a,0x23a,0x23a,
+0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,
+0x186f,0x186f,0x1860,0x185a,0x185a,0x186f,0x185d,0x1872,0x1872,0x1872,0x1872,0x1875,0x1875,0x1869,0x1866,0x1863,
+0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x1aee,0x1869,0x23d,0x1863,0x1992,0x1a43,
+0x1af1,0x1af1,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,
+0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,
+0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,
+0x187b,0x187b,0x187b,0x187b,0x240,0x240,0x240,0x240,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,
+0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,
+0x1878,0x1878,0x1878,0x1878,0x240,0x240,0x240,0x240,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,
+0x1896,0x1896,0x1896,0x1896,0x1896,0x1a13,0x1a13,0x1a13,0x1a13,0x1a13,0x1aa0,0x1aa0,0x1aa0,0x1aa0,0x1aa0,0x1aa0,
+0x243,0x243,0x243,0x243,0x243,0x243,0x243,0x243,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,
+0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,
+0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x246,0x246,0x246,0x246,0x246,0x246,0x246,0x246,0x246,
+0x246,0x246,0x246,0x246,0x246,0x246,0x246,0x246,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,
+0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x249,
+0x18d5,0x18d5,0x249,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,
+0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x249,
+0x249,0x249,0x18c9,0x249,0x18c9,0x18c9,0x249,0x18c9,0x18c9,0x18c9,0x18cc,0x18c9,0x18cf,0x18cf,0x18d8,0x18c9,
+0x249,0x249,0x249,0x249,0x249,0x249,0x249,0x249,0x18d2,0x18d2,0x18d2,0x18d2,0x18d2,0x18d2,0x18d2,0x18d2,
+0x18d2,0x18d2,0x249,0x249,0x249,0x249,0x249,0x249,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,
+0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,
+0x1938,0x1938,0x1938,0x1938,0x24c,0x24c,0x24c,0x24c,0x1905,0x1908,0x1917,0x1917,0x1908,0x190b,0x1905,0x1902,
+0x255,0x255,0x255,0x255,0x255,0x255,0x255,0x255,0x18f0,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18ed,
+0x18ed,0x18db,0x18db,0x18db,0x18f0,0x18f0,0x18f0,0x18f0,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,
+0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x258,0x258,0x258,0x258,
+0x258,0x258,0x258,0x258,0x258,0x258,0x258,0x258,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,
+0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x258,0x258,0x1aa9,0x1aa9,0x1aa9,0x1aa9,0x1b4b,0x28b,0x28b,0x28b,
+0x1aa9,0x1aa9,0x1aa9,0x28b,0x28b,0x28b,0x28b,0x28b,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,
+0x19aa,0x19aa,0x19aa,0x19aa,0x19a7,0x19a7,0x19a7,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,
+0x19a7,0x19a1,0x199e,0x19a4,0x25b,0x25b,0x25b,0x25b,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,
+0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,
+0x19ad,0x19ad,0x19ad,0x25e,0x25e,0x19ad,0x19ad,0x19ad,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x261,0x19bc,
+0x19bc,0x261,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,
+0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19b9,0x19b9,0x19b9,0x19b9,0x19b9,0x261,
+0x19b0,0x19b0,0x261,0x19b9,0x19b9,0x19b0,0x19b9,0x19b3,0x19bc,0x261,0x261,0x261,0x261,0x261,0x261,0x261,
+0x19c5,0x19c5,0x19c8,0x19c8,0x19bf,0x19bf,0x19bf,0x19bf,0x264,0x264,0x264,0x264,0x264,0x264,0x264,0x264,
+0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x264,0x264,0x264,0x264,0x264,0x264,
+0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19ce,0x19cb,0x19cb,0x19cb,
+0x19ce,0x19cb,0x19cb,0x19cb,0x19cb,0x267,0x267,0x267,0x267,0x267,0x267,0x267,0x267,0x267,0x267,0x267,
+0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,
+0x19d7,0x19d7,0x19d7,0x19d1,0x19d1,0x19d4,0x19d4,0x19da,0x19da,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,
+0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,
+0x19dd,0x19dd,0x19dd,0x19dd,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,
+0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,
+0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e3,0x19ec,0x19e0,0x19e0,0x270,0x270,0x270,0x270,0x270,
+0x19ef,0x19ef,0x19ef,0x19ef,0x19ef,0x19ef,0x19ef,0x19f2,0x273,0x273,0x273,0x273,0x273,0x273,0x273,0x273,
+0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,
+0x19fb,0x19fb,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f8,0x19f8,0x19f8,
+0x19f8,0x19fe,0x19fe,0x19fe,0x19fe,0x19fe,0x276,0x276,0x276,0x276,0x276,0x276,0x1a55,0x1a55,0x1a55,0x1a55,
+0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,
+0x1a55,0x1a55,0x1a55,0x27c,0x27c,0x27c,0x27c,0x27c,0x27c,0x27c,0x27c,0x27c,0x1a64,0x1a64,0x1a64,0x1a64,
+0x1a64,0x1a64,0x1a64,0x1a64,0x27f,0x27f,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,
+0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a61,0x1a61,0x1a61,
+0x1a58,0x1a58,0x1a58,0x1a58,0x27f,0x27f,0x1a58,0x1a58,0x1a61,0x1a61,0x1a61,0x1a61,0x1a5b,0x1a64,0x1a5e,0x1a64,
+0x1a61,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,
+0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x1a70,0x1a70,0x1a70,0x1a70,
+0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x282,0x282,0x282,0x1a67,0x1a67,0x1a67,0x1a67,
+0x1a67,0x1a67,0x1a67,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a73,0x1a73,0x282,0x282,0x285,0x1a76,0x1a76,0x1a76,
+0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,
+0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x285,0x285,
+0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,
+0x1aa3,0x1aa3,0x1aa3,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,
+0x1aa6,0x1aa6,0x1aa6,0x1aa6,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x1938,0x1938,0x1938,0x1938,
+0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1aa9,0x1aa9,0x1aa9,0x1b4b,
+0x1b4b,0x1b4b,0x1b4b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x1aa9,0x1aa9,0x1aa9,0x1aa9,
+0x1aa9,0x1aa9,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x28b,0x28b,0x28b,
+0x28b,0x28b,0x28b,0x28b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x28b,0x28b,0x28b,0x28b,0x28b,
+0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x28b,
+0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,
+0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,
+0x1a7f,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,
+0x1a79,0x1a79,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x1a7c,
+0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a82,0x1a82,0x1a82,0x1a82,
+0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x291,0x291,0x291,0x291,0x291,0x1a85,
+0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af4,0x1af4,0x1af4,0x1af4,0x1af4,0x1af4,0x1af4,0x294,0x294,0x294,0x294,
+0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,
+0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x297,0x297,0x1b12,0x297,0x297,0x1b12,0x1b12,0x1b12,0x1b12,
+0x1b12,0x1b12,0x1b12,0x1b12,0x297,0x1b12,0x1b12,0x297,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,
+0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1afa,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x297,0x1b09,
+0x1b0c,0x297,0x297,0x1afa,0x1afa,0x1b0f,0x1b00,0x1b15,0x1b09,0x1b15,0x1b09,0x1afd,0x1b18,0x1b03,0x1b18,0x297,
+0x297,0x297,0x297,0x297,0x297,0x297,0x297,0x297,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,
+0x1b06,0x1b06,0x297,0x297,0x297,0x297,0x297,0x297,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,
+0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x29a,0x29a,
+0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,
+0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,
+0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,
+0x1b1e,0x1b1e,0x1b1e,0x2a0,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,
+0x1b1e,0x1b1e,0x1b1e,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,
+0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,
+0x1b21,0x1b21,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x1b54,0x1b54,0x1b54,0x1b54,0x1b54,0x1b54,0x1b54,0x1b54,
+0x1b54,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,
+0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,
+0x2a3,0x2a3,0x2a3,0x2a3,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x2a6,0x1b24,
+0x1b24,0x1b27,0x2a6,0x2a6,0x1b2a,0x1b2a,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,
+0x2a6,0x2a6,0x2a6,0x2a6,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,
+0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,
+0x2a9,0x2a9,0x2a9,0x2a9,0x1932,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,
+0x2c1,0x2c1,0x2c1,0x2c1,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,
+0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,
+0x2a9,0x2a9,0x97b,0x97b,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x2c4,
+0x2c4,0x2c4,0x2c4,0x2c4,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,
+0x2a9,0x2a9,0x2a9,0x2a9,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x1a04,
+0x1a04,0x1a04,0x1a04,0x1a04,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,
+0x1b33,0x2ac,0x2ac,0x2ac,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0x12e4,
+0x12e4,0x12e4,0x2af,0x2af,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,
+0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0x2af,0x2af,
+0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,
+0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,
+0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,
+0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0x1b36,0x1b36,0x1b36,0x1b36,0x1b36,0x1b36,0x1b36,0x2b2,0x2b2,
+0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,
+0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0x2b5,0x2b5,
+0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,
+0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,
+0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,
+0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x2bb,0x2bb,
+0x17dc,0x17dc,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,
+0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,
+0x3cc,0x3c0,0x3c0,0x3c0,0x3c0,0x3c0,0x3c0,0x3c0,0x3c0,0x3cc,0x3cc,0x3cc,0x3cc,0x3c6,0x1158,0x133e,
+0x3cf,0x945,0x948,0x3bd,0x3bd,0x1155,0x133b,0x133b,0x3d2,0x3d2,0x3d2,0x3d2,0x3d2,0x3d2,0x3d2,0x3d2,
+0x1155,0x3c0,0x3c0,0x3cc,0xce1,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,
+0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,
+0x3cf,0x3cf,0x3c0,0x3c0,0x8d0,0x8d3,0x963,0x963,0x963,0x963,0x963,0x963,0x963,0x963,0x963,0x963,
+0x3c9,0xfba,0xfb7,0x1341,0x1341,0x1341,0x1341,0x1341,0x1506,0x115b,0x115b,0xf0c,0xf0c,0xdda,0xf0c,0xf0c,
+0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3d2,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,
+0x3cf,0x3d2,0x3cf,0x3cf,0x3d2,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x133b,0x133e,0x3c3,0x3cf,0x3cc,0x3cc,
+0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x1347,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,
+0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x1347,0x18ae,0x18ae,0xfd8,0x45f,0x468,
+0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,
+0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0xbc7,0xbc7,0xde6,0xde6,0x8d6,0xde9,0x1428,0x1428,0x1428,
+0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,
+0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,
+0x4b3,0x4b3,0x4b3,0x1170,0x1170,0x1170,0x1170,0x1170,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,
+0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,
+0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x116d,0x116d,0x116d,0x116d,0x116d,0x116d,
+0x4b6,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,
+0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,
+0x4b3,0x4b3,0x4b3,0x4b3,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,
+0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,
+0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4b9,0x4b9,0x4b9,0x4b9,0x4bc,0x9bd,0x1005,0x1005,0x1008,0x1005,
+0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,
+0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x1008,0x1005,0x1008,0x1005,0x1008,0x1005,
+0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,
+0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,
+0x6ae,0x6ae,0x6b1,0x4e9,0x6bd,0x6ba,0x6ba,0x6b7,0x513,0x513,0x4d1,0x4d1,0x4d1,0x4d1,0x4d1,0xb58,
+0x6c0,0x4f5,0x6d8,0x6db,0x50a,0x6c0,0x4f8,0x4f8,0x4e9,0x504,0x504,0x6ae,0x510,0x50d,0x6b4,0x4e3,
+0x4da,0x4da,0x4dd,0x4dd,0x4dd,0x4dd,0x4dd,0x4e0,0x4dd,0x4dd,0x4dd,0x4d4,0x51c,0x519,0x516,0x516,
+0x6cc,0x4fe,0x4fb,0x6c9,0x6c6,0x6c3,0x6d5,0x4ec,0x6d2,0x6d2,0x501,0x504,0x6cf,0x6cf,0x501,0x504,
+0x4e6,0x4e9,0x4e9,0x4e9,0x507,0x4f2,0x4ef,0xbdc,0xaf2,0xaf5,0xaef,0xaef,0xaef,0xaef,0xbd3,0xbd3,
+0xbd3,0xbd3,0xbd9,0xd0e,0xd0b,0xdf5,0xdf8,0xbd6,0xdf8,0xdf8,0xdf8,0xdf8,0xdf5,0xdf8,0xdf8,0xbd0,
+0x540,0x540,0x540,0x540,0x540,0x540,0x540,0x53d,0x543,0x75c,0x540,0x9c0,0x9e1,0xaf8,0xaf8,0xaf8,
+0xbe2,0xbe2,0xdfe,0xdfe,0xdfe,0xdfe,0x1179,0x117c,0x117c,0x135c,0x14f4,0x151e,0x1521,0x1521,0x1734,0x18b1,
+0x54f,0x54f,0x567,0x6ea,0x54c,0x6e7,0x54f,0x564,0x54c,0x6ea,0x55e,0x567,0x567,0x567,0x55e,0x55e,
+0x567,0x567,0x567,0x6f3,0x54c,0x567,0x6ed,0x54c,0x55b,0x567,0x567,0x567,0x567,0x567,0x54c,0x54c,
+0x552,0x6e7,0x6f0,0x54c,0x567,0x54c,0x6f6,0x54c,0x567,0x555,0x56d,0x6f9,0x567,0x567,0x558,0x55e,
+0x567,0x567,0x56a,0x567,0x55e,0x561,0x561,0x561,0x561,0xb04,0xb01,0xd11,0xe07,0xbf7,0xbfa,0xbfa,
+0xbf4,0xbf1,0xbf1,0xbf1,0xbf1,0xbfa,0xbf7,0xbf7,0xbf7,0xbf7,0xbee,0xbf1,0xe04,0xf18,0xf1b,0x100e,
+0x117f,0x117f,0x117f,0x6ff,0x6fc,0x570,0x573,0x573,0x573,0x573,0x573,0x6fc,0x6ff,0x6ff,0x6fc,0x573,
+0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x57c,0x57c,0x57c,0x57c,
+0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x576,0x576,0x576,0x576,0x576,0x576,
+0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x57f,0x588,0x588,0x582,0x582,0x582,0x585,0x57f,
+0x582,0x582,0x57f,0x57f,0x57f,0x57f,0x582,0x582,0x708,0x708,0x57f,0x57f,0x582,0x582,0x582,0x582,
+0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x585,0x585,0x585,0x582,0x582,0x70b,0x582,
+0x70b,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x57f,0x582,0x57f,0x57f,0x57f,0x57f,0x57f,0x57f,
+0x582,0x582,0x57f,0x708,0x57f,0x57f,0x57f,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a,
+0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0x711,0x58b,0x711,0x711,
+0x58e,0x58b,0x58b,0x711,0x711,0x58e,0x58b,0x711,0x58e,0x58b,0x58b,0x711,0x58b,0x711,0x59a,0x597,
+0x58b,0x711,0x58b,0x58b,0x58b,0x58b,0x711,0x58b,0x58b,0x711,0x711,0x711,0x711,0x58b,0x58b,0x711,
+0x58e,0x711,0x58e,0x711,0x711,0x711,0x711,0x711,0x717,0x591,0x711,0x591,0x591,0x58b,0x58b,0x58b,
+0x711,0x711,0x711,0x711,0x58b,0x58b,0x58b,0x58b,0x711,0x711,0x58b,0x58b,0x58b,0x58e,0x58b,0x58b,
+0x58e,0x58b,0x58b,0x58e,0x711,0x58e,0x58b,0x58b,0x711,0x58b,0x58b,0x58b,0x58b,0x58b,0x711,0x58b,
+0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x714,0x711,0x58e,0x58b,
+0x711,0x711,0x711,0x711,0x58b,0x58b,0x711,0x711,0x58b,0x58e,0x714,0x714,0x58e,0x58e,0x58b,0x58b,
+0x58e,0x58e,0x58b,0x58b,0x58e,0x58e,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58e,0x58e,0x711,0x711,
+0x58e,0x58e,0x711,0x711,0x58e,0x58e,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,
+0x58b,0x711,0x58b,0x58b,0x58b,0x711,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x711,0x58b,0x58b,
+0x58b,0x58b,0x58b,0x58b,0x58e,0x58e,0x58e,0x58e,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,
+0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x711,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,
+0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,
+0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58e,0x58e,0x58e,0x58e,0x58b,0x58b,0x58b,0x58b,
+0x58b,0x58b,0x58e,0x58e,0x58e,0x58e,0x58b,0x594,0x58b,0x58b,0xc00,0xc00,0xc00,0xc00,0xc00,0xc00,
+0xc00,0xc00,0xc00,0xc00,0xc00,0xc00,0xc00,0xc00,0x59d,0xb0d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,
+0x5a9,0x5a6,0x5a9,0x5a6,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x71a,0x59d,0x59d,0x59d,0x59d,0x59d,
+0x59d,0x59d,0x81f,0x81f,0x59d,0x59d,0x59d,0x59d,0x5a3,0x5a3,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,
+0x5a0,0x825,0x822,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,
+0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,
+0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0xb0d,0xc06,0xb0d,0xb0d,0xb0d,0x5ac,0x5ac,0x5ac,0x5ac,
+0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,
+0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x723,0x723,0x723,0x723,
+0x723,0x723,0x723,0x723,0x723,0x723,0x5b2,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,
+0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xd89,0x72c,0x72c,0x72c,0x72c,
+0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,
+0x5b5,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x72c,0x72c,0x72c,0x72c,
+0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x5b8,0x5b8,0x5b8,0x5b8,0x72c,0x72c,0x72c,0x72c,
+0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72f,0x72f,0x72f,0x72f,
+0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x5bb,0x5bb,0x72f,0x72f,
+0x72f,0x72f,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0x735,0x735,0x5be,0x732,
+0x732,0x732,0x732,0x732,0x732,0x732,0x5c1,0x5c1,0x5be,0x5be,0x5c4,0x5c4,0x5c4,0x5c4,0x735,0x735,
+0x5c4,0x5c4,0x738,0x735,0x5be,0x5be,0x5be,0x5be,0x735,0x735,0x5c4,0x5c4,0x738,0x735,0x5be,0x5be,
+0x5be,0x5be,0x735,0x735,0x732,0x5be,0x5c4,0x735,0x5be,0x5be,0x732,0x735,0x735,0x735,0x5c4,0x5c4,
+0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x735,0x732,
+0x735,0x732,0x5be,0x5c4,0x5c4,0x5c4,0x5c4,0x5c4,0x5c4,0x5be,0x5be,0x732,0xb16,0xb16,0xb16,0xb16,
+0xb16,0xb16,0xb16,0xb16,0xc0c,0xc0c,0xc0c,0xc0f,0xc0f,0xc8a,0xc8a,0xc0c,0x5d3,0x5d3,0x5d3,0x5d3,
+0x5d0,0x74a,0x747,0x5ca,0x5ca,0x73b,0x5ca,0x5ca,0x5ca,0x5ca,0x741,0x73b,0x5ca,0x5d0,0x5ca,0x5c7,
+0xd92,0xd92,0xc15,0xc15,0xe13,0xb19,0x5cd,0x5cd,0x73e,0x5d6,0x73e,0x5cd,0x5d0,0x5ca,0x5d0,0x5d0,
+0x5ca,0x5ca,0x5d0,0x5ca,0x5ca,0x5ca,0x5d0,0x5ca,0x5ca,0x5ca,0x5d0,0x5d0,0x5ca,0x5ca,0x5ca,0x5ca,
+0x5ca,0x5ca,0x5ca,0x5ca,0x5d0,0x5d3,0x5d3,0x5cd,0x5ca,0x5ca,0x5ca,0x5ca,0x74d,0x5ca,0x74d,0x5ca,
+0x5ca,0x5ca,0x5ca,0x5ca,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,
+0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5d0,0x74d,0x74a,0x5d9,0x74d,
+0x73b,0x741,0x5d0,0x73b,0x744,0x73b,0x73b,0x5ca,0x73b,0x74a,0x5d9,0x74a,0xb19,0xb19,0xc18,0xc18,
+0xc18,0xc18,0xc18,0xc18,0xc18,0xc18,0xc18,0xc1b,0xc18,0xc18,0xe10,0xec7,0x5dc,0x5dc,0x5dc,0x5dc,
+0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,
+0x5df,0x13e6,0x13e6,0x13e6,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x152a,0x5eb,0x5f4,0x5eb,
+0x5eb,0x13e6,0x5df,0x5df,0x5f4,0x5f4,0x13e9,0x13e9,0x5f7,0x5f7,0x5e8,0x5ee,0x5e8,0x5e8,0x5ee,0x5df,
+0x5ee,0x5df,0x5ee,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5ee,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,
+0x13e6,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5ee,0x5ee,0x5df,0x5df,0x5df,
+0x5df,0x5df,0x5df,0x5df,0x5df,0x753,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5ee,0x5df,0x5df,0x5ee,
+0x5df,0x5df,0x5df,0x5df,0x13e6,0x5df,0x13e6,0x5df,0x5df,0x5df,0x5df,0x13e6,0x13e6,0x13e6,0x5df,0x12de,
+0x5df,0x5df,0x5df,0x5e5,0x5e5,0x5e5,0x5e5,0x1368,0x1368,0x5df,0x5e2,0x5f1,0x5f4,0x5e8,0x5e8,0x5e8,
+0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0x750,0x750,
+0x750,0x750,0x750,0x750,0x750,0x750,0x750,0x750,0x5df,0x5ee,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,
+0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x13e6,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,
+0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x13e6,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,
+0x618,0x618,0x618,0x618,0x618,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x621,0x621,0x621,0x621,
+0x621,0x621,0x621,0x621,0x618,0x61e,0x60f,0x612,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,
+0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,
+0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x615,0x615,0x615,0x615,0x615,0x615,0x618,0x618,0x618,0x618,
+0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,
+0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,
+0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,
+0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618,
+0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,
+0x61b,0x621,0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61e,0x618,
+0x61b,0x621,0x61e,0x618,0x61e,0x618,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b,
+0x136b,0x136b,0x136b,0x136b,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61b,0x621,0x61e,0x618,
+0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61b,0x61e,0x618,0x61b,
+0x61e,0x618,0x61b,0x621,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,
+0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x61b,0x61b,0x61b,0x61b,0x61b,
+0x61b,0x61b,0x61b,0x61b,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,
+0x61e,0x61e,0x61e,0x61e,0x61e,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,
+0x618,0x618,0x618,0x618,0x61b,0x61b,0x618,0x61b,0x618,0x61b,0x618,0x618,0x61b,0x618,0x618,0x61b,
+0x618,0x61b,0x618,0x618,0x61b,0x618,0x61b,0x61b,0x618,0x618,0x618,0x61b,0x618,0x618,0x618,0x618,
+0x618,0x61b,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,
+0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x61b,0x61b,0x618,0x618,0x61b,0x618,0x61b,0x618,
+0x618,0x618,0x618,0x618,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,
+0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,
+0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x621,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,
+0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,
+0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,
+0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x61e,0x61e,0x61e,
+0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x624,0x624,0x624,0x624,0x101a,0x101a,0x101a,0x152d,
+0x152d,0x152d,0x152d,0x152d,0x152d,0x152d,0x173a,0x173a,0x885,0x88b,0x88b,0x897,0x897,0x888,0x87f,0x888,
+0x87f,0x888,0x87f,0x888,0x87f,0x888,0x87f,0x888,0x633,0x633,0x62d,0x633,0x62d,0x633,0x62d,0x633,
+0x62d,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633,0x62d,0x630,
+0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633,0x62d,0x633,0x62d,0x633,
+0x62d,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,
+0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,
+0x636,0x633,0x62d,0x630,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,
+0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,
+0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,
+0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x726,0x726,0x726,0x726,0x726,0x726,
+0x726,0x726,0x726,0x726,0x726,0x726,0x729,0x726,0x726,0x726,0x726,0x726,0x726,0x726,0x726,0x726,
+0x726,0x726,0x726,0x726,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,
+0x723,0x723,0x723,0x723,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,
+0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,
+0x72c,0x72c,0x72c,0x72c,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,
+0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,
+0x756,0x756,0x756,0x756,0xc78,0x8e8,0x8e2,0x8df,0x8e5,0x8dc,0x76b,0x76e,0x76e,0x76e,0x76e,0x76e,
+0x76e,0x76e,0x76e,0x76e,0x8ee,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,
+0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,
+0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x8eb,0x8eb,0x771,0x8fd,0x900,0x906,0x82b,0x837,0x91b,0x834,
+0x8f4,0x8f1,0x8f4,0x8f1,0x8fa,0x8f7,0x8fa,0x8f7,0x8f4,0x8f1,0x831,0x906,0x8f4,0x8f1,0x8f4,0x8f1,
+0x8f4,0x8f1,0x8f4,0x8f1,0x909,0x912,0x90f,0x90f,0x777,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x7ad,
+0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,
+0x7ad,0x7ad,0x7ad,0x77a,0x795,0x774,0x79b,0x79e,0x798,0x7b0,0x7b0,0x7b0,0x7b0,0x7b0,0x7b0,0x7aa,
+0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,
+0x7aa,0x7aa,0x7aa,0x77a,0x795,0x774,0x795,0xc7b,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,
0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,
-0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x12d8,0x12d8,0x12d8,0x12d8,0x12d8,0x81c,
-0x831,0x834,0x834,0x834,0x834,0x834,0x834,0x834,0x834,0x834,0x951,0x951,0x951,0x951,0x83a,0x83a,
-0x90c,0x918,0x918,0x918,0x918,0x915,0x82e,0x903,0xb3d,0xb3d,0xb3d,0xc8d,0xcab,0xca8,0xb5b,0x8d9,
-0x840,0x83d,0x840,0x843,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,
-0x840,0x840,0x83d,0x840,0x840,0x83d,0x840,0x840,0x83d,0x840,0x840,0x83d,0x840,0x840,0x83d,0x83d,
-0xcae,0x852,0x84c,0x852,0x84c,0x852,0x84c,0x852,0x84c,0x852,0x84c,0x84c,0x84f,0x84c,0x84f,0x84c,
-0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,
-0x84f,0x84c,0x84f,0x852,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,
-0x84f,0x84f,0x84c,0x84f,0x84f,0x84c,0x84f,0x84f,0x84c,0x84f,0x84f,0x84c,0x84f,0x84f,0x84c,0x84c,
-0x84c,0x84c,0x84c,0x852,0x84c,0x852,0x84c,0x852,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x852,0x84c,
-0x84c,0x84c,0x84c,0x84c,0x84f,0x852,0x852,0x84f,0x84f,0x84f,0x84f,0x921,0x924,0x855,0x858,0xc96,
-0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,
-0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,
-0x861,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,
-0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x86a,0x86a,0x86a,0x86a,
-0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,
-0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0xd9b,0xd9b,0xeca,0x864,0x92d,0x92d,0x92d,0x92d,
-0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0xd95,0xd95,0xd95,0xd95,0x86d,0x86d,0x86d,0x86d,
-0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,
-0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x1ab2,0x936,0x936,0x936,0x936,
-0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x870,0x870,0x870,
-0x870,0x870,0x870,0xd9e,0xd9e,0xd9e,0xd9e,0x939,0x939,0x939,0x939,0x939,0x870,0x870,0x870,0x870,
-0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,
-0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0xd9e,0xd9e,
-0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,
-0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,
-0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,
-0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,
-0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,
-0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,
-0x113d,0x113d,0x113d,0x113d,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,
-0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,
-0x879,0x879,0x879,0x879,0x879,0x879,0x87c,0x87c,0x879,0x87c,0x879,0x87c,0x87c,0x879,0x879,0x879,
-0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x87c,0x879,0x87c,0x879,0x87c,0x87c,0x879,0x879,0x87c,
-0x87c,0x87c,0x879,0x879,0x879,0x879,0x14e5,0x14e5,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,
-0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,
-0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,
-0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x131d,0x131d,0x131d,0x131d,0x12bd,0x12bd,0x12bd,0x12bd,
-0x12bd,0x12bd,0x12bd,0x12bd,0xd95,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,
-0xc99,0xc99,0xc99,0xc99,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,
-0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x933,0x930,0x933,0x930,0x930,
-0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,
-0x930,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,
-0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,
-0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0xd9e,
-0x9b7,0x999,0x999,0x999,0x999,0x993,0x999,0x999,0x9ab,0x999,0x999,0x996,0x9a2,0x9a8,0x9a8,0x9a8,
-0x9a8,0x9a8,0x9ab,0x993,0x99f,0x993,0x993,0x993,0x98a,0x98a,0x993,0x993,0x993,0x993,0x993,0x993,
-0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x993,0x993,0x993,0x993,0x993,0x993,
-0x993,0x993,0x993,0x993,0x996,0x98a,0x993,0x98a,0x993,0x98a,0x9a5,0x99c,0x9a5,0x99c,0x9b4,0x9b4,
-0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,
-0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,
-0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,
-0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,
-0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,
-0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,
-0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,
-0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9cc,0x9cc,
-0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,
-0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9cf,0x9cf,
-0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,
-0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,
-0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,
-0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,
-0x9d8,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,
-0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9d8,0x9db,0x9db,0x9db,
-0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,
-0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0xa68,0xa68,0xfff,0xa68,0xa68,0xa68,0xa6b,0xa68,
-0xfff,0xa68,0xa68,0xff6,0xa62,0xa56,0xa56,0xa56,0xa56,0xa65,0xa56,0xfe7,0xfe7,0xfe7,0xa56,0xa59,
-0xa62,0xa5c,0xfed,0xff9,0xff9,0xfe7,0xfe7,0xfff,0xb61,0xb61,0xb61,0xb61,0xb61,0xb61,0xb61,0xb61,
-0xb61,0xb61,0xa6e,0xa6e,0xa5f,0xa5f,0xa5f,0xa5f,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa65,0xa65,
-0xa56,0xa56,0xfff,0xfff,0xfff,0xfff,0xfe7,0xfe7,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,
+0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x12d8,0x12d8,0x12d8,0x12d8,0x12d8,0x81c,
+0x831,0x834,0x834,0x834,0x834,0x834,0x834,0x834,0x834,0x834,0x951,0x951,0x951,0x951,0x83a,0x83a,
+0x90c,0x918,0x918,0x918,0x918,0x915,0x82e,0x903,0xb3d,0xb3d,0xb3d,0xc8d,0xcab,0xca8,0xb5b,0x8d9,
+0x840,0x83d,0x840,0x843,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,
+0x840,0x840,0x83d,0x840,0x840,0x83d,0x840,0x840,0x83d,0x840,0x840,0x83d,0x840,0x840,0x83d,0x83d,
+0xcae,0x852,0x84c,0x852,0x84c,0x852,0x84c,0x852,0x84c,0x852,0x84c,0x84c,0x84f,0x84c,0x84f,0x84c,
+0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,
+0x84f,0x84c,0x84f,0x852,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,
+0x84f,0x84f,0x84c,0x84f,0x84f,0x84c,0x84f,0x84f,0x84c,0x84f,0x84f,0x84c,0x84f,0x84f,0x84c,0x84c,
+0x84c,0x84c,0x84c,0x852,0x84c,0x852,0x84c,0x852,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x852,0x84c,
+0x84c,0x84c,0x84c,0x84c,0x84f,0x852,0x852,0x84f,0x84f,0x84f,0x84f,0x921,0x924,0x855,0x858,0xc96,
+0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,
+0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,
+0x861,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,
+0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x86a,0x86a,0x86a,0x86a,
+0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,
+0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0xd9b,0xd9b,0xeca,0x864,0x92d,0x92d,0x92d,0x92d,
+0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0xd95,0xd95,0xd95,0xd95,0x86d,0x86d,0x86d,0x86d,
+0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,
+0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x1ab2,0x936,0x936,0x936,0x936,
+0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x870,0x870,0x870,
+0x870,0x870,0x870,0xd9e,0xd9e,0xd9e,0xd9e,0x939,0x939,0x939,0x939,0x939,0x870,0x870,0x870,0x870,
+0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,
+0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0xd9e,0xd9e,
+0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,
+0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,
+0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,
+0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,
+0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,
+0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,
+0x113d,0x113d,0x113d,0x113d,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,
+0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,
+0x879,0x879,0x879,0x879,0x879,0x879,0x87c,0x87c,0x879,0x87c,0x879,0x87c,0x87c,0x879,0x879,0x879,
+0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x87c,0x879,0x87c,0x879,0x87c,0x87c,0x879,0x879,0x87c,
+0x87c,0x87c,0x879,0x879,0x879,0x879,0x14e5,0x14e5,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,
+0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,
+0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,
+0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x131d,0x131d,0x131d,0x131d,0x12bd,0x12bd,0x12bd,0x12bd,
+0x12bd,0x12bd,0x12bd,0x12bd,0xd95,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,
+0xc99,0xc99,0xc99,0xc99,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,
+0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x933,0x930,0x933,0x930,0x930,
+0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,
+0x930,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,
+0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,
+0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0xd9e,
+0x9b7,0x999,0x999,0x999,0x999,0x993,0x999,0x999,0x9ab,0x999,0x999,0x996,0x9a2,0x9a8,0x9a8,0x9a8,
+0x9a8,0x9a8,0x9ab,0x993,0x99f,0x993,0x993,0x993,0x98a,0x98a,0x993,0x993,0x993,0x993,0x993,0x993,
+0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x993,0x993,0x993,0x993,0x993,0x993,
+0x993,0x993,0x993,0x993,0x996,0x98a,0x993,0x98a,0x993,0x98a,0x9a5,0x99c,0x9a5,0x99c,0x9b4,0x9b4,
+0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,
+0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,
+0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,
+0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,
+0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,
+0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,
+0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,
+0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9cc,0x9cc,
+0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,
+0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9cf,0x9cf,
+0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,
+0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,
+0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,
+0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,
+0x9d8,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,
+0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9d8,0x9db,0x9db,0x9db,
+0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,
+0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0xa68,0xa68,0xfff,0xa68,0xa68,0xa68,0xa6b,0xa68,
+0xfff,0xa68,0xa68,0xff6,0xa62,0xa56,0xa56,0xa56,0xa56,0xa65,0xa56,0xfe7,0xfe7,0xfe7,0xa56,0xa59,
+0xa62,0xa5c,0xfed,0xff9,0xff9,0xfe7,0xfe7,0xfff,0xb61,0xb61,0xb61,0xb61,0xb61,0xb61,0xb61,0xb61,
+0xb61,0xb61,0xa6e,0xa6e,0xa5f,0xa5f,0xa5f,0xa5f,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa65,0xa65,
+0xa56,0xa56,0xfff,0xfff,0xfff,0xfff,0xfe7,0xfe7,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,
0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,
-0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,
-0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,
-0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,
-0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,
-0xa7d,0xa7d,0xa7d,0xa7d,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,
-0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,
-0xa83,0xa83,0xa83,0xa83,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,
-0xa89,0xa86,0xa8c,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0x1176,0x1176,0x1176,0x1176,0x1176,
-0x1176,0x1176,0x1176,0x1176,0x1173,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,
+0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,
+0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,
+0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,
+0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,
+0xa7d,0xa7d,0xa7d,0xa7d,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,
+0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,
+0xa83,0xa83,0xa83,0xa83,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,
+0xa89,0xa86,0xa8c,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0x1176,0x1176,0x1176,0x1176,0x1176,
+0x1176,0x1176,0x1176,0x1176,0x1173,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,
0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,
-0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,
-0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,
-0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xac2,0xac2,0xac2,0xac5,0xac5,0xac2,0xac2,0xac2,
-0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xaaa,0xaaa,0xabf,0xaa1,
-0xaa1,0xaa1,0xaa1,0xaa1,0xaa1,0xaa1,0xabf,0xabf,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,
-0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,
-0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xae3,0xae3,0xae3,0xae3,0xae3,0xace,0xace,0xae3,
-0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,
-0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,
-0xae3,0xae3,0xae3,0xae6,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,
-0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,
-0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb10,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,
-0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xc06,0xc06,0xc06,0xc06,0xc06,
+0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,
+0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,
+0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xac2,0xac2,0xac2,0xac5,0xac5,0xac2,0xac2,0xac2,
+0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xaaa,0xaaa,0xabf,0xaa1,
+0xaa1,0xaa1,0xaa1,0xaa1,0xaa1,0xaa1,0xabf,0xabf,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,
+0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,
+0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xae3,0xae3,0xae3,0xae3,0xae3,0xace,0xace,0xae3,
+0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,
+0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,
+0xae3,0xae3,0xae3,0xae6,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,
+0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,
+0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb10,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,
+0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xc06,0xc06,0xc06,0xc06,0xc06,
0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,
0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,
-0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,
-0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,
-0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,
-0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,
+0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,
+0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,
+0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,
+0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,
0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,
-0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0x13ec,0x13ec,0x13ec,0x1b2d,0x1b2d,0x1b2d,0x1b2d,0x1b2d,
+0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0x13ec,0x13ec,0x13ec,0x1b2d,0x1b2d,0x1b2d,0x1b2d,0x1b2d,
+0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,
0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,
-0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,
-0xb43,0xb43,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0xb46,0xb46,0xb46,0xb46,
-0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,
-0xb46,0xb49,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,
-0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,
-0xb46,0xb46,0xb46,0xb46,0xb4c,0xb4c,0xc9c,0xc9c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,
-0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xc9c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,
-0xb4c,0xb4c,0xb4c,0xb4c,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,
-0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,
-0xb70,0xb70,0xb70,0x1530,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xd26,0xd26,0xb76,0xb76,0xb76,0xb76,
-0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,
-0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xd23,0xd23,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,
-0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,
-0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,
-0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,
-0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,
-0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb82,0xb8e,0xb94,
-0xb94,0xb94,0xb88,0xb88,0xb88,0xb91,0xb85,0xb85,0xb85,0xb85,0xb85,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,
-0xb7f,0xb7f,0xb7f,0xb94,0xb94,0xb94,0xb94,0xb94,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,
-0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,
-0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb8b,0xb8b,0xb94,0xb94,0xb94,0xb88,
-0xb88,0xb94,0xb94,0xb94,0xb94,0xb94,0xb94,0xb94,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,
-0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb94,0xb94,
-0xb94,0xb94,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb8b,
-0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,
-0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,
-0xb88,0xb88,0x173d,0x173d,0xba0,0xb97,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
-0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb97,
-0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,
-0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xb97,
-0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
-0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb97,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0,
-0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,
-0xba0,0xb97,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
-0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,
-0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,
-0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,
-0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,
-0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
-0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,
-0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,
-0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
-0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0,
-0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,
-0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,
-0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,
-0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,
-0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,
-0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,
-0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,
-0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc03,0xc06,0xc03,0xc03,0xc03,0xc03,0xc03,0xc03,0xc03,0xc03,
-0xc03,0xc03,0xc03,0xc03,0xc03,0xc03,0xc03,0xd14,0xd17,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,
-0xe0a,0xe0a,0xe0a,0xe0a,0xf24,0xf24,0xf24,0xf24,0xc18,0xc18,0xc18,0xc18,0xc18,0xc18,0xc12,0xc12,
-0xc12,0xc12,0xd1a,0xd1a,0xd1a,0xd1a,0xd1a,0xd1a,0xd1d,0xd1d,0xe10,0xec4,0xe10,0xe10,0xe10,0xe10,
-0xe0d,0xe10,0xe0d,0xe10,0xe10,0x1014,0x12ae,0x12ae,0xe19,0xe19,0xe19,0xe19,0xe19,0xe1f,0xe1c,0xf36,
-0xf36,0xf36,0xf36,0x142e,0x1026,0x142e,0x1374,0x1374,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,
-0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc81,0xc7e,0xc81,0xc7e,0xc81,0xc7e,
-0x1137,0x1134,0x102c,0x1029,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,
-0xc51,0xc51,0xc51,0xc51,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,
-0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,
-0xc54,0xc54,0xc54,0xc54,0xc57,0xc57,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,
-0xc5a,0xc5a,0xc5a,0xc60,0xc5d,0xc87,0xc84,0xc60,0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc60,
-0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,
-0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,
-0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc60,0xc5d,0xc60,0xc5d,
-0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,
-0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc60,0xc5d,0xc5a,0xc5a,
-0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc69,0xc63,0xc63,0xc63,
-0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,
-0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,
-0xc69,0xc69,0xc69,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,
-0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,
-0xc66,0xc63,0xc63,0xc63,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,
-0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,
-0xc9f,0xc9f,0xc9f,0xc9f,0xd20,0xd8f,0xe0d,0xe0d,0xe0d,0xe0d,0xe0d,0xe10,0xe0d,0xe0d,0xec4,0xec4,
-0xe0d,0xe0d,0xe0d,0xe0d,0xe10,0xe10,0xf27,0x1014,0x1014,0x1014,0x1014,0x1014,0x1014,0x1014,0x1014,0x1014,
-0x1014,0x12db,0x12db,0x12b1,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,
-0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,
-0xd44,0xd44,0xd44,0xd44,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd4a,0xd4a,0xd4a,0xd4a,0xd4a,0xd47,
-0xd5c,0xd5c,0xd5c,0xd56,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd56,
-0xd5c,0xd5c,0xd5c,0xd5c,0xd50,0xd50,0xd59,0xd59,0xd59,0xd59,0xd4d,0xd4d,0xd4d,0xd4d,0xd4d,0xd53,
-0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe22,0xe25,0xe25,0xe25,
-0xe25,0xe25,0xe25,0xe25,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,
-0xd5c,0xd5c,0xd56,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,
-0xd5c,0xd50,0xd50,0xd50,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,
-0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,
-0xd53,0xd53,0xd53,0xd53,0xd5f,0xd5f,0xd5f,0xd5f,0xd5f,0xd62,0xd62,0xd62,0xd5f,0xd5f,0xd5f,0xd5f,
-0xd5f,0xd5f,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xf39,0xf39,0xf39,0xf39,0xf39,0xf39,0xf39,0x1140,
-0x1140,0x102f,0x102f,0x102f,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,
-0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,
-0xd65,0xd65,0xd65,0xd65,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,
-0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,
-0xd6b,0xd6b,0xd6b,0xd6b,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,
-0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,
-0xd74,0xd74,0xd74,0xd74,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,
-0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,
-0xd80,0xd80,0xd80,0xd80,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,
-0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,
-0xd8c,0xd8c,0xd8c,0xd8c,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,
+0xb43,0xb43,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0xb46,0xb46,0xb46,0xb46,
+0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,
+0xb46,0xb49,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,
+0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,
+0xb46,0xb46,0xb46,0xb46,0xb4c,0xb4c,0xc9c,0xc9c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,
+0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xc9c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,
+0xb4c,0xb4c,0xb4c,0xb4c,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,
+0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,
+0xb70,0xb70,0xb70,0x1530,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xd26,0xd26,0xb76,0xb76,0xb76,0xb76,
+0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,
+0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xd23,0xd23,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,
+0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,
+0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,
+0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,
+0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,
+0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb82,0xb8e,0xb94,
+0xb94,0xb94,0xb88,0xb88,0xb88,0xb91,0xb85,0xb85,0xb85,0xb85,0xb85,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,
+0xb7f,0xb7f,0xb7f,0xb94,0xb94,0xb94,0xb94,0xb94,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,
+0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,
+0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb8b,0xb8b,0xb94,0xb94,0xb94,0xb88,
+0xb88,0xb94,0xb94,0xb94,0xb94,0xb94,0xb94,0xb94,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,
+0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb94,0xb94,
+0xb94,0xb94,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb8b,
+0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,
+0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,
+0xb88,0xb88,0x173d,0x173d,0xba0,0xb97,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
+0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb97,
+0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,
+0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xb97,
+0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
+0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb97,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0,
+0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,
+0xba0,0xb97,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
+0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,
+0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,
+0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,
+0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,
+0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
+0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,
+0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,
+0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,
+0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0,
+0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,
+0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,
+0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,
+0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,
+0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,
+0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,
+0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,
+0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc03,0xc06,0xc03,0xc03,0xc03,0xc03,0xc03,0xc03,0xc03,0xc03,
+0xc03,0xc03,0xc03,0xc03,0xc03,0xc03,0xc03,0xd14,0xd17,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,
+0xe0a,0xe0a,0xe0a,0xe0a,0xf24,0xf24,0xf24,0xf24,0xc18,0xc18,0xc18,0xc18,0xc18,0xc18,0xc12,0xc12,
+0xc12,0xc12,0xd1a,0xd1a,0xd1a,0xd1a,0xd1a,0xd1a,0xd1d,0xd1d,0xe10,0xec4,0xe10,0xe10,0xe10,0xe10,
+0xe0d,0xe10,0xe0d,0xe10,0xe10,0x1014,0x12ae,0x12ae,0xe19,0xe19,0xe19,0xe19,0xe19,0xe1f,0xe1c,0xf36,
+0xf36,0xf36,0xf36,0x142e,0x1026,0x142e,0x1374,0x1374,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,
+0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc81,0xc7e,0xc81,0xc7e,0xc81,0xc7e,
+0x1137,0x1134,0x102c,0x1029,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,
+0xc51,0xc51,0xc51,0xc51,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,
+0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,
+0xc54,0xc54,0xc54,0xc54,0xc57,0xc57,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,
+0xc5a,0xc5a,0xc5a,0xc60,0xc5d,0xc87,0xc84,0xc60,0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc60,
+0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,
+0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,
+0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc60,0xc5d,0xc60,0xc5d,
+0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,
+0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc60,0xc5d,0xc5a,0xc5a,
+0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc69,0xc63,0xc63,0xc63,
+0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,
+0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,
+0xc69,0xc69,0xc69,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,
+0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,
+0xc66,0xc63,0xc63,0xc63,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,
+0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,
+0xc9f,0xc9f,0xc9f,0xc9f,0xd20,0xd8f,0xe0d,0xe0d,0xe0d,0xe0d,0xe0d,0xe10,0xe0d,0xe0d,0xec4,0xec4,
+0xe0d,0xe0d,0xe0d,0xe0d,0xe10,0xe10,0xf27,0x1014,0x1014,0x1014,0x1014,0x1014,0x1014,0x1014,0x1014,0x1014,
+0x1014,0x12db,0x12db,0x12b1,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,
+0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,
+0xd44,0xd44,0xd44,0xd44,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd4a,0xd4a,0xd4a,0xd4a,0xd4a,0xd47,
+0xd5c,0xd5c,0xd5c,0xd56,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd56,
+0xd5c,0xd5c,0xd5c,0xd5c,0xd50,0xd50,0xd59,0xd59,0xd59,0xd59,0xd4d,0xd4d,0xd4d,0xd4d,0xd4d,0xd53,
+0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe22,0xe25,0xe25,0xe25,
+0xe25,0xe25,0xe25,0xe25,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,
+0xd5c,0xd5c,0xd56,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,
+0xd5c,0xd50,0xd50,0xd50,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,
+0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,
+0xd53,0xd53,0xd53,0xd53,0xd5f,0xd5f,0xd5f,0xd5f,0xd5f,0xd62,0xd62,0xd62,0xd5f,0xd5f,0xd5f,0xd5f,
+0xd5f,0xd5f,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xf39,0xf39,0xf39,0xf39,0xf39,0xf39,0xf39,0x1140,
+0x1140,0x102f,0x102f,0x102f,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,
+0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,
+0xd65,0xd65,0xd65,0xd65,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,
+0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,
+0xd6b,0xd6b,0xd6b,0xd6b,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,
+0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,
+0xd74,0xd74,0xd74,0xd74,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,
+0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,
+0xd80,0xd80,0xd80,0xd80,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,
+0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,
+0xd8c,0xd8c,0xd8c,0xd8c,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,
0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,
-0xe2e,0xe2e,0xe2e,0xe2e,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,
-0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,
-0xe31,0xe31,0xe31,0xe31,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,
-0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,
-0xe34,0xe34,0xe34,0xe34,0xef4,0xef4,0xe46,0xe46,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0x103b,
-0x103b,0x103b,0x103b,0x103b,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,
-0x1038,0x1038,0x1038,0x1038,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,
-0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,
-0xe55,0xe52,0xe55,0xe52,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,
-0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,
-0xe61,0xe61,0xe61,0xe61,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,
+0xe2e,0xe2e,0xe2e,0xe2e,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,
+0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,
+0xe31,0xe31,0xe31,0xe31,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,
+0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,
+0xe34,0xe34,0xe34,0xe34,0xef4,0xef4,0xe46,0xe46,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0x103b,
+0x103b,0x103b,0x103b,0x103b,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,
+0x1038,0x1038,0x1038,0x1038,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,
+0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,
+0xe55,0xe52,0xe55,0xe52,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,
+0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,
+0xe61,0xe61,0xe61,0xe61,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,
0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,
-0xe67,0xe67,0xe67,0xe67,0xeee,0xeee,0xeee,0xeee,0xeee,0xeee,0xeee,0xeee,0xe7f,0xe7f,0xe7f,0xe7f,
-0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xf3f,0xf3f,0xf3f,0xf3f,0x103e,
-0x103e,0x103e,0x103e,0x103e,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,
-0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,
-0xe88,0xe88,0xe88,0xe88,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,
-0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,
-0xe91,0xe91,0xe91,0xe91,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,
-0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,
-0xe9a,0xe9a,0xe9a,0xe94,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,
-0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe9a,
-0xe9a,0xe9a,0xe9a,0xe9a,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,
-0xea3,0xea3,0xea0,0xea0,0xea0,0xea0,0xea0,0xea0,0xea0,0xea0,0xe9d,0xea6,0x104a,0x1044,0x1053,0x1041,
-0xea3,0xea3,0x1041,0x1041,0xeb5,0xeb5,0xea9,0xeb5,0xeb5,0xeb5,0xeac,0xeb5,0xeb5,0xeb5,0xeb5,0xea9,
-0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,
-0xeb5,0xeb5,0xeb5,0xeb5,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,
-0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,
-0xeb8,0xeb8,0xeb8,0xeb8,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,
-0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,
-0xed0,0xed0,0xed0,0xed0,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,
-0xef1,0xef1,0xef1,0xef1,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,
-0x1149,0x1149,0x1149,0x1149,0xf24,0xf24,0xf24,0xf21,0xf21,0xf21,0xf21,0xf21,0x1182,0x13dd,0x13dd,0x13dd,
-0x13dd,0x135f,0x135f,0x135f,0x13e0,0x1362,0x1362,0x13e0,0x1524,0x1524,0x1524,0x1524,0x1527,0x1527,0x1527,0x17ee,
-0x17ee,0x17ee,0x17ee,0x18b4,0xf39,0xf39,0xf39,0xf39,0x102f,0x102f,0x102f,0x102f,0x102f,0x102f,0x102f,0x102f,
-0x102f,0x102f,0x102f,0x102f,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,
-0x1032,0x1032,0x1032,0x1032,0xf5a,0xf5a,0xf5a,0xf5a,0xf6c,0xf75,0xf78,0xf75,0xf78,0xf75,0xf78,0xf75,
-0xf78,0xf75,0xf78,0xf75,0xf75,0xf75,0xf78,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,
-0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf5d,0xf5a,0xf5a,0xf5a,
-0xf5a,0xf5a,0xf5a,0xf6f,0xf5a,0xf6f,0xf6c,0xf6c,0xf81,0xf7e,0xf81,0xf81,0xf81,0xf7e,0xf7e,0xf81,
-0xf7e,0xf81,0xf7e,0xf81,0xf7e,0x1065,0x1065,0x1065,0x11a0,0x105c,0x1065,0x105c,0xf7e,0xf81,0xf7e,0xf7e,
-0x105c,0x105c,0x105c,0x105c,0x105f,0x1062,0x11a0,0x11a0,0xf84,0xf84,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,
-0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x106e,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,
-0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,
-0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,
-0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,
-0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,
-0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0x1563,0x1563,0x1563,0x1563,0x1563,
-0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0xf9f,0xf9f,0xf9f,0xf9f,
-0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,
-0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xfe7,0xfff,0xff6,0xffc,
-0xffc,0xfff,0xfff,0xff6,0xff6,0xffc,0xffc,0xffc,0xffc,0xffc,0xfff,0xfff,0xfff,0xfe7,0xfe7,0xfe7,
-0xfe7,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfe7,0xff6,
-0xff9,0xfe7,0xfe7,0xffc,0xffc,0xffc,0xffc,0xffc,0xffc,0xfea,0xfff,0xffc,0xff3,0xff3,0xff3,0xff3,
-0xff3,0xff3,0xff3,0xff3,0xff3,0xff3,0x116a,0x116a,0x1167,0x1164,0xff0,0xff0,0x1017,0x1017,0x1017,0x1017,
-0x12db,0x12db,0x12b1,0x12b1,0x12b7,0x12ae,0x12ae,0x12ae,0x12ae,0x12b1,0x13e3,0x12b7,0x12b1,0x12b7,0x12ae,0x12b7,
-0x12db,0x12ae,0x12ae,0x12ae,0x12b1,0x12b1,0x12ae,0x12ae,0x12b1,0x12ae,0x12ae,0x12b1,0x1032,0x1032,0x1032,0x1032,
-0x1032,0x102f,0x102f,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x153c,0x153c,0x153c,0x1140,0x102f,0x102f,0x102f,
-0x102f,0x12e7,0x12c0,0x12c0,0x12c0,0x12c0,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x1050,0x1050,0x104d,0x1047,
-0x104d,0x1047,0x104d,0x1047,0x104d,0x1047,0x1044,0x1044,0x1044,0x1044,0x1059,0x1056,0x1044,0x119d,0x143a,0x143d,
-0x143d,0x143a,0x143a,0x143a,0x143a,0x143a,0x1440,0x1440,0x1557,0x154b,0x154b,0x1548,0x1077,0x106e,0x1077,0x106e,
-0x1077,0x106e,0x1077,0x106e,0x106b,0x1068,0x1068,0x1077,0x106e,0x1383,0x1380,0x1746,0x1383,0x1380,0x1449,0x1446,
-0x155a,0x155a,0x1560,0x155a,0x1560,0x155a,0x1560,0x155a,0x1560,0x155a,0x1560,0x155a,0x1077,0x106e,0x1077,0x106e,
-0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,
-0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1071,0x106e,0x106e,0x106e,
-0x106e,0x106e,0x106e,0x106e,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x1077,0x106e,0x107a,0x107a,0x1080,0x1086,
-0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,
-0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1080,0x107a,0x107a,
-0x107a,0x107a,0x1080,0x1080,0x107a,0x107a,0x1083,0x1452,0x144f,0x144f,0x1086,0x1086,0x107d,0x107d,0x107d,0x107d,
-0x107d,0x107d,0x107d,0x107d,0x107d,0x107d,0x1455,0x1455,0x1455,0x1455,0x1455,0x1455,0x109b,0x109b,0x109b,0x109b,
-0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,
-0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x10a4,0x10a4,0x10a4,0x10a4,
-0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,
-0x10a4,0x10a4,0x10a4,0x10a4,0x10a7,0x10a7,0x10a7,0x10aa,0x10a7,0x10a7,0x10ad,0x10ad,0x10b0,0x10b0,0x10b0,0x10b0,
-0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,
-0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b9,0x10b9,0x10b9,0x10b9,
-0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10bc,0x10b3,0x10c2,0x10bf,0x10b9,0x10b9,0x10b9,0x10b9,
-0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,
-0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x1389,0x1386,0x10d4,0x10ce,
-0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d1,0x1152,0x10c5,0x10c5,0x10c5,0x10cb,
-0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x10c8,0x10c8,0x10cb,0x10d7,0x10d4,0x10ce,0x10d4,0x10ce,
-0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,
-0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x156f,0x156c,0x156f,0x156c,
-0x1572,0x1572,0x174f,0x1458,0x10e0,0x10e0,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,
-0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,
-0x10e3,0x10e3,0x10e3,0x10e3,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,
-0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10ec,0x10ec,0x10ec,0x1146,0x10f5,
-0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,
-0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,
-0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,
-0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,
-0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,
-0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,
-0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,
-0x112e,0x112e,0x112e,0x112e,0x1143,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,
-0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,
-0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,
-0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,
-0x113d,0x113d,0x113d,0x113d,0x12e1,0x12e1,0x12e1,0x12e1,0x12e1,0x12e1,0x12e1,0x12e1,0x14e2,0x17cd,0x17cd,0x17cd,
-0x17cd,0x17cd,0x17cd,0x17cd,0x17cd,0x17cd,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,
-0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,
-0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11a9,0x11a9,0x11ac,0x11ac,0x11b2,0x11a9,0x11a9,0x11a9,0x11a9,0x11a9,
-0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,
-0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,
-0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,
-0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,
+0xe67,0xe67,0xe67,0xe67,0xeee,0xeee,0xeee,0xeee,0xeee,0xeee,0xeee,0xeee,0xe7f,0xe7f,0xe7f,0xe7f,
+0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xf3f,0xf3f,0xf3f,0xf3f,0x103e,
+0x103e,0x103e,0x103e,0x103e,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,
+0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,
+0xe88,0xe88,0xe88,0xe88,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,
+0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,
+0xe91,0xe91,0xe91,0xe91,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,
+0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,
+0xe9a,0xe9a,0xe9a,0xe94,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,
+0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe9a,
+0xe9a,0xe9a,0xe9a,0xe9a,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,
+0xea3,0xea3,0xea0,0xea0,0xea0,0xea0,0xea0,0xea0,0xea0,0xea0,0xe9d,0xea6,0x104a,0x1044,0x1053,0x1041,
+0xea3,0xea3,0x1041,0x1041,0xeb5,0xeb5,0xea9,0xeb5,0xeb5,0xeb5,0xeac,0xeb5,0xeb5,0xeb5,0xeb5,0xea9,
+0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,
+0xeb5,0xeb5,0xeb5,0xeb5,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,
+0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,
+0xeb8,0xeb8,0xeb8,0xeb8,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,
+0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,
+0xed0,0xed0,0xed0,0xed0,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,
+0xef1,0xef1,0xef1,0xef1,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,
+0x1149,0x1149,0x1149,0x1149,0xf24,0xf24,0xf24,0xf21,0xf21,0xf21,0xf21,0xf21,0x1182,0x13dd,0x13dd,0x13dd,
+0x13dd,0x135f,0x135f,0x135f,0x13e0,0x1362,0x1362,0x13e0,0x1524,0x1524,0x1524,0x1524,0x1527,0x1527,0x1527,0x17ee,
+0x17ee,0x17ee,0x17ee,0x18b4,0xf39,0xf39,0xf39,0xf39,0x102f,0x102f,0x102f,0x102f,0x102f,0x102f,0x102f,0x102f,
+0x102f,0x102f,0x102f,0x102f,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,
+0x1032,0x1032,0x1032,0x1032,0xf5a,0xf5a,0xf5a,0xf5a,0xf6c,0xf75,0xf78,0xf75,0xf78,0xf75,0xf78,0xf75,
+0xf78,0xf75,0xf78,0xf75,0xf75,0xf75,0xf78,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,
+0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf5d,0xf5a,0xf5a,0xf5a,
+0xf5a,0xf5a,0xf5a,0xf6f,0xf5a,0xf6f,0xf6c,0xf6c,0xf81,0xf7e,0xf81,0xf81,0xf81,0xf7e,0xf7e,0xf81,
+0xf7e,0xf81,0xf7e,0xf81,0xf7e,0x1065,0x1065,0x1065,0x11a0,0x105c,0x1065,0x105c,0xf7e,0xf81,0xf7e,0xf7e,
+0x105c,0x105c,0x105c,0x105c,0x105f,0x1062,0x11a0,0x11a0,0xf84,0xf84,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,
+0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x106e,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,
+0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,
+0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,
+0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,
+0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,
+0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0x1563,0x1563,0x1563,0x1563,0x1563,
+0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0xf9f,0xf9f,0xf9f,0xf9f,
+0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,
+0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xfe7,0xfff,0xff6,0xffc,
+0xffc,0xfff,0xfff,0xff6,0xff6,0xffc,0xffc,0xffc,0xffc,0xffc,0xfff,0xfff,0xfff,0xfe7,0xfe7,0xfe7,
+0xfe7,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfe7,0xff6,
+0xff9,0xfe7,0xfe7,0xffc,0xffc,0xffc,0xffc,0xffc,0xffc,0xfea,0xfff,0xffc,0xff3,0xff3,0xff3,0xff3,
+0xff3,0xff3,0xff3,0xff3,0xff3,0xff3,0x116a,0x116a,0x1167,0x1164,0xff0,0xff0,0x1017,0x1017,0x1017,0x1017,
+0x12db,0x12db,0x12b1,0x12b1,0x12b7,0x12ae,0x12ae,0x12ae,0x12ae,0x12b1,0x13e3,0x12b7,0x12b1,0x12b7,0x12ae,0x12b7,
+0x12db,0x12ae,0x12ae,0x12ae,0x12b1,0x12b1,0x12ae,0x12ae,0x12b1,0x12ae,0x12ae,0x12b1,0x1032,0x1032,0x1032,0x1032,
+0x1032,0x102f,0x102f,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x153c,0x153c,0x153c,0x1140,0x102f,0x102f,0x102f,
+0x102f,0x12e7,0x12c0,0x12c0,0x12c0,0x12c0,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x1050,0x1050,0x104d,0x1047,
+0x104d,0x1047,0x104d,0x1047,0x104d,0x1047,0x1044,0x1044,0x1044,0x1044,0x1059,0x1056,0x1044,0x119d,0x143a,0x143d,
+0x143d,0x143a,0x143a,0x143a,0x143a,0x143a,0x1440,0x1440,0x1557,0x154b,0x154b,0x1548,0x1077,0x106e,0x1077,0x106e,
+0x1077,0x106e,0x1077,0x106e,0x106b,0x1068,0x1068,0x1077,0x106e,0x1383,0x1380,0x1746,0x1383,0x1380,0x1449,0x1446,
+0x155a,0x155a,0x1560,0x155a,0x1560,0x155a,0x1560,0x155a,0x1560,0x155a,0x1560,0x155a,0x1077,0x106e,0x1077,0x106e,
+0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,
+0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1071,0x106e,0x106e,0x106e,
+0x106e,0x106e,0x106e,0x106e,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x1077,0x106e,0x107a,0x107a,0x1080,0x1086,
+0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,
+0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1080,0x107a,0x107a,
+0x107a,0x107a,0x1080,0x1080,0x107a,0x107a,0x1083,0x1452,0x144f,0x144f,0x1086,0x1086,0x107d,0x107d,0x107d,0x107d,
+0x107d,0x107d,0x107d,0x107d,0x107d,0x107d,0x1455,0x1455,0x1455,0x1455,0x1455,0x1455,0x109b,0x109b,0x109b,0x109b,
+0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,
+0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x10a4,0x10a4,0x10a4,0x10a4,
+0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,
+0x10a4,0x10a4,0x10a4,0x10a4,0x10a7,0x10a7,0x10a7,0x10aa,0x10a7,0x10a7,0x10ad,0x10ad,0x10b0,0x10b0,0x10b0,0x10b0,
+0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,
+0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b9,0x10b9,0x10b9,0x10b9,
+0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10bc,0x10b3,0x10c2,0x10bf,0x10b9,0x10b9,0x10b9,0x10b9,
+0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,
+0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x1389,0x1386,0x10d4,0x10ce,
+0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d1,0x1152,0x10c5,0x10c5,0x10c5,0x10cb,
+0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x10c8,0x10c8,0x10cb,0x10d7,0x10d4,0x10ce,0x10d4,0x10ce,
+0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,
+0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x156f,0x156c,0x156f,0x156c,
+0x1572,0x1572,0x174f,0x1458,0x10e0,0x10e0,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,
+0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,
+0x10e3,0x10e3,0x10e3,0x10e3,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,
+0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10ec,0x10ec,0x10ec,0x1146,0x10f5,
+0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,
+0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,
+0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,
+0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,
+0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,
+0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,
+0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,
+0x112e,0x112e,0x112e,0x112e,0x1143,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,
+0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,
+0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,
+0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,
+0x113d,0x113d,0x113d,0x113d,0x12e1,0x12e1,0x12e1,0x12e1,0x12e1,0x12e1,0x12e1,0x12e1,0x14e2,0x17cd,0x17cd,0x17cd,
+0x17cd,0x17cd,0x17cd,0x17cd,0x17cd,0x17cd,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,
+0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,
+0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11a9,0x11a9,0x11ac,0x11ac,0x11b2,0x11a9,0x11a9,0x11a9,0x11a9,0x11a9,
+0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,
+0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,
+0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,
+0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,
0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,
-0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11dc,0x11e2,
-0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,
-0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,
-0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,
-0x11f4,0x132f,0x11fa,0x1332,0x11fa,0x11fa,0x11fa,0x11fa,0x11f7,0x11f7,0x11f7,0x11fa,0x1752,0x1755,0x197a,0x1977,
-0x11fd,0x11fd,0x11fd,0x120c,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,
-0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,
-0x1212,0x1212,0x1212,0x1200,0x120c,0x120c,0x11fd,0x11fd,0x11fd,0x11fd,0x120c,0x120c,0x11fd,0x11fd,0x120c,0x120c,
-0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,
-0x1221,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x1218,0x1218,0x1218,0x121e,0x121b,0x1578,0x157b,0x157e,0x157e,
-0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,
-0x1224,0x1230,0x1224,0x1224,0x1224,0x1239,0x1239,0x1224,0x1224,0x1239,0x1230,0x1239,0x1239,0x1230,0x1224,0x1227,
-0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,
-0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,
-0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,
-0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,
-0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,
-0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1260,0x1260,0x1260,
-0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,
-0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,
-0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,
-0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,
-0x1281,0x1281,0x1290,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,
-0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1296,0x1293,0x1296,0x1293,0x1293,0x1293,
-0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1296,0x1293,0x1293,0x1293,0x1293,
-0x1290,0x1290,0x1290,0x1284,0x1284,0x1284,0x1284,0x1290,0x1290,0x128a,0x1287,0x128d,0x128d,0x129c,0x1299,0x1299,
-0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,
-0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,
-0x12a5,0x12a5,0x12a5,0x12a2,0x12a2,0x12a2,0x129f,0x129f,0x129f,0x129f,0x12a2,0x129f,0x129f,0x129f,0x12a5,0x12a2,
-0x12a5,0x12a2,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,
-0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x12a5,0x12a2,0x12a2,
-0x129f,0x129f,0x129f,0x129f,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c9,
-0x12c9,0x12c9,0x12a8,0x1980,0x13d7,0x12d2,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,
-0x13d7,0x12d2,0x13d7,0x12d2,0x12b1,0x12b1,0x1365,0x12ae,0x1365,0x1365,0x1365,0x1365,0x12ae,0x12b4,0x12db,0x12ae,
-0x12ae,0x12ae,0x12ae,0x12ae,0x12b4,0x12b7,0x12db,0x12db,0x12b7,0x12db,0x12ae,0x12b7,0x12b7,0x12ba,0x12db,0x12ae,
-0x12ae,0x12db,0x12b1,0x12b1,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x12c3,0x12c3,
-0x12c3,0x12c3,0x13ef,0x13ce,0x12cc,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x187e,
-0x187e,0x187e,0x187e,0x187e,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x1581,
-0x1581,0x1ad0,0x1ad0,0x1ad0,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,
-0x12c6,0x12c6,0x12c6,0x12c6,0x13d7,0x13d7,0x12d2,0x13d7,0x13d7,0x13d7,0x12d2,0x13d7,0x13d7,0x13d7,0x12cc,0x12cc,
-0x12cc,0x12cc,0x12cc,0x13d1,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x12cf,0x13d4,0x13d4,0x13d4,0x13d4,
-0x13d4,0x13d4,0x13d4,0x12cf,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x145b,0x145b,
-0x1a2e,0x1ad0,0x1ad0,0x1ad0,0x13da,0x13da,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x12cf,0x13d4,0x12cf,
-0x12cf,0x13d4,0x13da,0x12d5,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,
-0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,
-0x12f9,0x12f9,0x12f9,0x12f9,0x1383,0x1380,0x1383,0x1380,0x1383,0x1380,0x1383,0x1380,0x1383,0x1380,0x1449,0x1560,
-0x1560,0x1560,0x17fa,0x196e,0x1560,0x1560,0x1749,0x1749,0x1749,0x1743,0x1749,0x1743,0x1971,0x196e,0x1a2b,0x1a28,
-0x1a2b,0x1a28,0x1a2b,0x1a28,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,
+0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11dc,0x11e2,
+0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,
+0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,
+0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,
+0x11f4,0x132f,0x11fa,0x1332,0x11fa,0x11fa,0x11fa,0x11fa,0x11f7,0x11f7,0x11f7,0x11fa,0x1752,0x1755,0x197a,0x1977,
+0x11fd,0x11fd,0x11fd,0x120c,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,
+0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,
+0x1212,0x1212,0x1212,0x1200,0x120c,0x120c,0x11fd,0x11fd,0x11fd,0x11fd,0x120c,0x120c,0x11fd,0x11fd,0x120c,0x120c,
+0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,
+0x1221,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x1218,0x1218,0x1218,0x121e,0x121b,0x1578,0x157b,0x157e,0x157e,
+0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,
+0x1224,0x1230,0x1224,0x1224,0x1224,0x1239,0x1239,0x1224,0x1224,0x1239,0x1230,0x1239,0x1239,0x1230,0x1224,0x1227,
+0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,
+0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,
+0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,
+0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,
+0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,
+0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1260,0x1260,0x1260,
+0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,
+0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,
+0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,
+0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,
+0x1281,0x1281,0x1290,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,
+0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1296,0x1293,0x1296,0x1293,0x1293,0x1293,
+0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1296,0x1293,0x1293,0x1293,0x1293,
+0x1290,0x1290,0x1290,0x1284,0x1284,0x1284,0x1284,0x1290,0x1290,0x128a,0x1287,0x128d,0x128d,0x129c,0x1299,0x1299,
+0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,
+0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,
+0x12a5,0x12a5,0x12a5,0x12a2,0x12a2,0x12a2,0x129f,0x129f,0x129f,0x129f,0x12a2,0x129f,0x129f,0x129f,0x12a5,0x12a2,
+0x12a5,0x12a2,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,
+0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x12a5,0x12a2,0x12a2,
+0x129f,0x129f,0x129f,0x129f,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c9,
+0x12c9,0x12c9,0x12a8,0x1980,0x13d7,0x12d2,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,
+0x13d7,0x12d2,0x13d7,0x12d2,0x12b1,0x12b1,0x1365,0x12ae,0x1365,0x1365,0x1365,0x1365,0x12ae,0x12b4,0x12db,0x12ae,
+0x12ae,0x12ae,0x12ae,0x12ae,0x12b4,0x12b7,0x12db,0x12db,0x12b7,0x12db,0x12ae,0x12b7,0x12b7,0x12ba,0x12db,0x12ae,
+0x12ae,0x12db,0x12b1,0x12b1,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x12c3,0x12c3,
+0x12c3,0x12c3,0x13ef,0x13ce,0x12cc,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x187e,
+0x187e,0x187e,0x187e,0x187e,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x1581,
+0x1581,0x1ad0,0x1ad0,0x1ad0,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,
+0x12c6,0x12c6,0x12c6,0x12c6,0x13d7,0x13d7,0x12d2,0x13d7,0x13d7,0x13d7,0x12d2,0x13d7,0x13d7,0x13d7,0x12cc,0x12cc,
+0x12cc,0x12cc,0x12cc,0x13d1,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x12cf,0x13d4,0x13d4,0x13d4,0x13d4,
+0x13d4,0x13d4,0x13d4,0x12cf,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x145b,0x145b,
+0x1a2e,0x1ad0,0x1ad0,0x1ad0,0x13da,0x13da,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x12cf,0x13d4,0x12cf,
+0x12cf,0x13d4,0x13da,0x12d5,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,
+0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,
+0x12f9,0x12f9,0x12f9,0x12f9,0x1383,0x1380,0x1383,0x1380,0x1383,0x1380,0x1383,0x1380,0x1383,0x1380,0x1449,0x1560,
+0x1560,0x1560,0x17fa,0x196e,0x1560,0x1560,0x1749,0x1749,0x1749,0x1743,0x1749,0x1743,0x1971,0x196e,0x1a2b,0x1a28,
+0x1a2b,0x1a28,0x1a2b,0x1a28,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,
0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,
-0x13a7,0x13a7,0x13a7,0x13a7,0x13bc,0x13ad,0x13bc,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,
-0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,
-0x13bf,0x13bf,0x13bf,0x13bf,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13c5,0x13c5,0x13c5,0x13c5,
-0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,
-0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13cb,0x13cb,0x13cb,0x13cb,
-0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,
-0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13fb,0x13f8,0x1923,0x1923,
-0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,
-0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1404,0x1404,0x1404,0x1404,
-0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
-0x1404,0x1401,0x1401,0x1404,0x1404,0x1404,0x1404,0x1404,0x1401,0x1404,0x1404,0x1404,0x1401,0x1404,0x1401,0x1404,
-0x1401,0x1404,0x1404,0x1404,0x1404,0x1404,0x1407,0x1404,0x1404,0x1404,0x1404,0x1401,0x1404,0x1401,0x1401,0x1404,
-0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1401,0x1401,0x1401,0x1401,
-0x1401,0x1401,0x1401,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
-0x1404,0x1404,0x1404,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1404,0x1404,0x1404,
-0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,
-0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x158a,0x158a,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
-0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
-0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1596,0x1590,0x1590,0x1596,0x1596,0x1596,0x1596,
-0x1596,0x1596,0x1596,0x1596,0x1596,0x17d0,0x17d0,0x17d0,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1596,0x1404,
-0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
-0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1596,0x17d0,0x17d0,
-0x1404,0x1404,0x1404,0x1404,0x1404,0x1407,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
-0x1404,0x1404,0x1404,0x1404,0x1590,0x1590,0x1596,0x1596,0x1590,0x1596,0x1596,0x1596,0x158d,0x158d,0x1596,0x1596,
-0x1404,0x1404,0x1407,0x1407,0x1407,0x1701,0x1404,0x1407,0x1404,0x1404,0x1407,0x1599,0x1599,0x1596,0x1596,0x17d0,
-0x17d0,0x17d0,0x17d0,0x17d0,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,
-0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
-0x1404,0x1590,0x1590,0x1596,0x1701,0x1596,0x1590,0x1596,0x17d0,0x17d0,0x17d0,0x17d3,0x17d3,0x17d3,0x17d3,0x17d3,
-0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
-0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1596,
-0x1404,0x1596,0x1407,0x1407,0x1404,0x1404,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,
-0x1407,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
-0x1404,0x1404,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,
-0x1407,0x1407,0x1407,0x1407,0x1407,0x1404,0x1404,0x1404,0x1407,0x1404,0x1404,0x1404,0x1404,0x1407,0x1407,0x1407,
-0x1404,0x1407,0x1407,0x1407,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1407,0x1404,0x1407,0x1404,0x1404,
-0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
-0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1701,0x1404,0x1404,0x1404,0x1404,0x1596,0x1590,0x17d0,
-0x145e,0x145e,0x145e,0x145e,0x158a,0x158a,0x158d,0x158d,0x158d,0x1593,0x1596,0x17d0,0x17d0,0x17d0,0x17d0,0x1758,
-0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
-0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1596,0x1590,0x1590,0x1596,0x1599,0x1599,0x1596,0x1596,
-0x1596,0x1596,0x1887,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1590,0x1596,0x1590,0x1590,0x1590,0x1590,
-0x1596,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1590,0x1590,0x1590,0x1596,0x158d,0x158d,0x158d,0x158d,
-0x158d,0x158d,0x1596,0x1404,0x1404,0x1404,0x1404,0x1404,0x14e8,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,
-0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x14e8,0x140a,0x140a,0x140a,0x14e8,0x140a,0x14e8,
-0x140a,0x14e8,0x140a,0x14e8,0x140a,0x140a,0x140a,0x14e8,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x14e8,0x14e8,
-0x140a,0x140a,0x140a,0x140a,0x14e8,0x140a,0x14e8,0x14e8,0x140a,0x140a,0x140a,0x140a,0x14e8,0x140a,0x140a,0x140a,
-0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x1707,0x1707,0x17d6,0x17d6,0x140d,0x140d,0x140d,
-0x140a,0x140a,0x140a,0x140d,0x140d,0x140d,0x140d,0x140d,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,
-0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,
-0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,
-0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1413,0x1410,0x1410,0x1410,0x1410,
-0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1413,0x1413,0x1413,0x1410,
-0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,
-0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,
-0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1803,0x1803,0x1800,0x175b,0x1464,0x1464,0x1464,0x1464,
-0x1464,0x1464,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,
-0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x15a2,0x1470,0x1470,0x1470,0x1482,0x1482,0x1482,0x1482,0x1482,
-0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,
-0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,
-0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,
-0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,
-0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,
-0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x1a34,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,
-0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,
-0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14ac,0x14ac,0x14b8,0x14be,0x14be,0x14be,0x14be,0x14be,
-0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,
-0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14b8,0x14b8,0x14b8,0x14ac,0x14ac,
-0x14ac,0x14ac,0x14ac,0x14ac,0x14ac,0x14ac,0x14ac,0x14b8,0x14bb,0x14be,0x14c1,0x14c1,0x14be,0x14c4,0x14c4,0x14af,
-0x14b2,0x1764,0x1767,0x1767,0x1767,0x15ab,0x1adc,0x1ad9,0x14b5,0x14b5,0x14b5,0x14b5,0x14b5,0x14b5,0x14b5,0x14b5,
-0x14b5,0x14b5,0x15a8,0x176d,0x1770,0x176a,0x1773,0x1773,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,
-0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,
-0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,
-0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,
-0x153c,0x153c,0x1956,0x1956,0x1956,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,
-0x153c,0x1a22,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x18ba,0x1956,0x1956,0x1956,0x1956,0x1956,
-0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1590,0x1590,0x1596,0x1596,0x1596,0x1590,0x1590,0x1590,
-0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1596,0x1596,0x158d,0x158d,0x158d,0x158d,
-0x158d,0x158d,0x158d,0x158d,0x1596,0x1596,0x1596,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,
-0x1590,0x1590,0x1596,0x1596,0x1596,0x1596,0x1590,0x1590,0x1599,0x1590,0x1590,0x1590,0x1590,0x1704,0x1704,0x1590,
-0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1884,0x1596,0x1590,0x1590,0x1596,0x1590,0x1590,0x1590,
-0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1596,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,
-0x1596,0x1590,0x1590,0x1590,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,
+0x13a7,0x13a7,0x13a7,0x13a7,0x13bc,0x13ad,0x13bc,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,
+0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,
+0x13bf,0x13bf,0x13bf,0x13bf,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13c5,0x13c5,0x13c5,0x13c5,
+0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,
+0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13cb,0x13cb,0x13cb,0x13cb,
+0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,
+0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13fb,0x13f8,0x1923,0x1923,
+0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,
+0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1404,0x1404,0x1404,0x1404,
+0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
+0x1404,0x1401,0x1401,0x1404,0x1404,0x1404,0x1404,0x1404,0x1401,0x1404,0x1404,0x1404,0x1401,0x1404,0x1401,0x1404,
+0x1401,0x1404,0x1404,0x1404,0x1404,0x1404,0x1407,0x1404,0x1404,0x1404,0x1404,0x1401,0x1404,0x1401,0x1401,0x1404,
+0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1401,0x1401,0x1401,0x1401,
+0x1401,0x1401,0x1401,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
+0x1404,0x1404,0x1404,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1404,0x1404,0x1404,
+0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,
+0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x158a,0x158a,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
+0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
+0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1596,0x1590,0x1590,0x1596,0x1596,0x1596,0x1596,
+0x1596,0x1596,0x1596,0x1596,0x1596,0x17d0,0x17d0,0x17d0,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1596,0x1404,
+0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
+0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1596,0x17d0,0x17d0,
+0x1404,0x1404,0x1404,0x1404,0x1404,0x1407,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
+0x1404,0x1404,0x1404,0x1404,0x1590,0x1590,0x1596,0x1596,0x1590,0x1596,0x1596,0x1596,0x158d,0x158d,0x1596,0x1596,
+0x1404,0x1404,0x1407,0x1407,0x1407,0x1701,0x1404,0x1407,0x1404,0x1404,0x1407,0x1599,0x1599,0x1596,0x1596,0x17d0,
+0x17d0,0x17d0,0x17d0,0x17d0,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,
+0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
+0x1404,0x1590,0x1590,0x1596,0x1701,0x1596,0x1590,0x1596,0x17d0,0x17d0,0x17d0,0x17d3,0x17d3,0x17d3,0x17d3,0x17d3,
+0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
+0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1596,
+0x1404,0x1596,0x1407,0x1407,0x1404,0x1404,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,
+0x1407,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
+0x1404,0x1404,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,
+0x1407,0x1407,0x1407,0x1407,0x1407,0x1404,0x1404,0x1404,0x1407,0x1404,0x1404,0x1404,0x1404,0x1407,0x1407,0x1407,
+0x1404,0x1407,0x1407,0x1407,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1407,0x1404,0x1407,0x1404,0x1404,
+0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
+0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1701,0x1404,0x1404,0x1404,0x1404,0x1596,0x1590,0x17d0,
+0x145e,0x145e,0x145e,0x145e,0x158a,0x158a,0x158d,0x158d,0x158d,0x1593,0x1596,0x17d0,0x17d0,0x17d0,0x17d0,0x1758,
+0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,
+0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1596,0x1590,0x1590,0x1596,0x1599,0x1599,0x1596,0x1596,
+0x1596,0x1596,0x1887,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1590,0x1596,0x1590,0x1590,0x1590,0x1590,
+0x1596,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1590,0x1590,0x1590,0x1596,0x158d,0x158d,0x158d,0x158d,
+0x158d,0x158d,0x1596,0x1404,0x1404,0x1404,0x1404,0x1404,0x14e8,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,
+0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x14e8,0x140a,0x140a,0x140a,0x14e8,0x140a,0x14e8,
+0x140a,0x14e8,0x140a,0x14e8,0x140a,0x140a,0x140a,0x14e8,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x14e8,0x14e8,
+0x140a,0x140a,0x140a,0x140a,0x14e8,0x140a,0x14e8,0x14e8,0x140a,0x140a,0x140a,0x140a,0x14e8,0x140a,0x140a,0x140a,
+0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x1707,0x1707,0x17d6,0x17d6,0x140d,0x140d,0x140d,
+0x140a,0x140a,0x140a,0x140d,0x140d,0x140d,0x140d,0x140d,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,
+0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,
+0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,
+0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1413,0x1410,0x1410,0x1410,0x1410,
+0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1413,0x1413,0x1413,0x1410,
+0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,
+0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,
+0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1803,0x1803,0x1800,0x175b,0x1464,0x1464,0x1464,0x1464,
+0x1464,0x1464,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,
+0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x15a2,0x1470,0x1470,0x1470,0x1482,0x1482,0x1482,0x1482,0x1482,
+0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,
+0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,
+0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,
+0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,
+0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,
+0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x1a34,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,
+0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,
+0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14ac,0x14ac,0x14b8,0x14be,0x14be,0x14be,0x14be,0x14be,
+0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,
+0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14b8,0x14b8,0x14b8,0x14ac,0x14ac,
+0x14ac,0x14ac,0x14ac,0x14ac,0x14ac,0x14ac,0x14ac,0x14b8,0x14bb,0x14be,0x14c1,0x14c1,0x14be,0x14c4,0x14c4,0x14af,
+0x14b2,0x1764,0x1767,0x1767,0x1767,0x15ab,0x1adc,0x1ad9,0x14b5,0x14b5,0x14b5,0x14b5,0x14b5,0x14b5,0x14b5,0x14b5,
+0x14b5,0x14b5,0x15a8,0x176d,0x1770,0x176a,0x1773,0x1773,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,
+0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,
+0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,
+0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,
+0x153c,0x153c,0x1956,0x1956,0x1956,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,
+0x153c,0x1a22,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x18ba,0x1956,0x1956,0x1956,0x1956,0x1956,
+0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1590,0x1590,0x1596,0x1596,0x1596,0x1590,0x1590,0x1590,
+0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1596,0x1596,0x158d,0x158d,0x158d,0x158d,
+0x158d,0x158d,0x158d,0x158d,0x1596,0x1596,0x1596,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,
+0x1590,0x1590,0x1596,0x1596,0x1596,0x1596,0x1590,0x1590,0x1599,0x1590,0x1590,0x1590,0x1590,0x1704,0x1704,0x1590,
+0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1884,0x1596,0x1590,0x1590,0x1596,0x1590,0x1590,0x1590,
+0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1596,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,
+0x1596,0x1590,0x1590,0x1590,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,
0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,
-0x15ba,0x15ba,0x15ba,0x15ba,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,
-0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,
-0x15cc,0x15cc,0x15cc,0x15cc,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,
-0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,
-0x15d2,0x15d2,0x15d2,0x15d2,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,
+0x15ba,0x15ba,0x15ba,0x15ba,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,
+0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,
+0x15cc,0x15cc,0x15cc,0x15cc,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,
+0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,
+0x15d2,0x15d2,0x15d2,0x15d2,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,
0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,
-0x15d5,0x15d5,0x15d5,0x15d5,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,
+0x15d5,0x15d5,0x15d5,0x15d5,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,
0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,
-0x1614,0x1614,0x1614,0x1605,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,
-0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x1617,
-0x1620,0x1620,0x1620,0x1620,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,
-0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,
-0x1623,0x1623,0x1623,0x1623,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x1635,0x163e,0x163e,0x163e,
-0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,
-0x163e,0x163e,0x163e,0x163e,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,
-0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,
-0x1647,0x1647,0x1647,0x1647,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,
-0x1659,0x1659,0x1659,0x1659,0x1656,0x1656,0x1656,0x164a,0x164a,0x164a,0x164a,0x164a,0x164a,0x164a,0x164a,0x1656,
-0x1656,0x164a,0x1656,0x164d,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,
-0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,
-0x1659,0x1659,0x1659,0x1659,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,
-0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,
-0x167d,0x167a,0x167a,0x167a,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,
-0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x168c,0x168c,0x168c,0x1689,0x1689,0x1689,
-0x1686,0x1686,0x1686,0x1686,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,
-0x169b,0x169b,0x169b,0x169b,0x168f,0x168f,0x168f,0x168f,0x168f,0x168f,0x168f,0x16a1,0x16a1,0x1695,0x1692,0x1692,
-0x1692,0x1692,0x1692,0x1692,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,
-0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,
-0x169b,0x169b,0x169b,0x169b,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,
-0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a4,0x16a4,0x16a4,0x16a4,0x16a4,
-0x16a4,0x16a4,0x16a4,0x16a4,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,
-0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,
-0x16aa,0x16aa,0x16aa,0x16aa,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,
-0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,
-0x16ce,0x16ce,0x16ce,0x16ce,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,
-0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,
-0x16d7,0x16d7,0x16d7,0x16d7,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,
-0x16ef,0x16ef,0x16ef,0x16ef,0x16da,0x16e9,0x16e9,0x16da,0x16da,0x16da,0x16da,0x16da,0x16da,0x16e9,0x16da,0x16ec,
-0x16ec,0x16da,0x16ec,0x16da,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,
-0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,
-0x16ef,0x16ef,0x16ef,0x16ef,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,
-0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,
-0x16f8,0x16f8,0x16f8,0x16f8,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,
-0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,
-0x16fe,0x16fe,0x16fe,0x16fe,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,
-0x1740,0x1740,0x1740,0x1740,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,
-0x1956,0x1956,0x1956,0x1a22,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,
-0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,
-0x1761,0x1761,0x1761,0x1761,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,
-0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,
-0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x17a3,0x17a0,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,
-0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,
-0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,
-0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,
-0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,
-0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,
-0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,
-0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,
-0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,
-0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,
-0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,
-0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c4,0x17c4,0x17c4,0x17c4,0x17c1,
-0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c4,0x17c4,0x17c4,
-0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c1,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,
-0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,
-0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,
-0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,
-0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x18c6,0x18c6,0x18c6,0x18c6,0x18c6,0x18c6,0x18c6,0x18c6,
-0x18c6,0x18c6,0x18c6,0x18c6,0x1b3f,0x1a94,0x1a94,0x1a97,0x17df,0x17df,0x17df,0x17df,0x17df,0x17df,0x17df,0x17df,
-0x17e2,0x1890,0x1890,0x1890,0x1890,0x1890,0x1890,0x192c,0x17df,0x17df,0x17df,0x17df,0x17df,0x188d,0x188d,0x188d,
-0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,
-0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x1890,0x188d,
-0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1890,0x192c,0x192c,0x1890,0x1890,0x1890,0x1890,0x1890,
-0x1890,0x1890,0x188d,0x180f,0x1890,0x1890,0x1890,0x1a94,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x180f,0x188d,
-0x188d,0x188d,0x188d,0x188d,0x1929,0x1a0a,0x1a0a,0x1a0a,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,
-0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x1929,0x1824,0x1824,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,
-0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,
-0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,
-0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,
-0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,
-0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x186f,0x186f,0x186f,
-0x185a,0x185a,0x185a,0x185a,0x185a,0x185a,0x185a,0x185a,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,
-0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,
-0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,
-0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,
-0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,
-0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,
-0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1b48,0x1b48,0x1b48,0x1b48,0x1b48,
-0x1b48,0x1b48,0x1b48,0x1b48,0x1b48,0x1b48,0x1b48,0x1b48,0x18f0,0x18f0,0x18f0,0x18f0,0x1a46,0x1a46,0x18f3,0x18f3,
-0x18f3,0x18f3,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18ed,
-0x18de,0x18e1,0x18e4,0x18f6,0x18f6,0x1995,0x18e7,0x18e7,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,
-0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,
-0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,
-0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x18fc,0x1902,0x18ff,0x18ff,0x18ff,
-0x18ff,0x190e,0x1914,0x18ff,0x18ff,0x18ff,0x18ff,0x190b,0x1911,0x18ff,0x18ff,0x18ff,0x18ff,0x18ff,0x18ff,0x18ff,
-0x18ff,0x18ff,0x18ff,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,
-0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,
-0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,
-0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1a0a,
-0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,
-0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,
-0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,
-0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,
-0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,
-0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,
-0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,
-0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,
-0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,
-0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,
-0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,
-0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,
-0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,
-0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,
-0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,
-0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,
-0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,
-0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19ef,0x19ef,0x19ef,0x1a0a,0x1a0a,0x1a0a,0x1b3c,0x1b3c,0x1a94,0x1a94,0x1a94,
-0x1a94,0x1a94,0x1a94,0x1b3c,0x1b3c,0x1b3c,0x1a94,0x1a94,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0a,0x1a10,0x1a10,0x1a0a,
-0x1a10,0x1a10,0x1a94,0x1a97,0x1a94,0x1a94,0x1a94,0x1a94,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,
-0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,
-0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,
-0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,
-0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,
-0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1aaf,0x1aaf,0x1a79,0x1aaf,0x1a79,0x1a79,0x1a79,0x1a79,
-0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a7f,0x1a7f,0x1a7f,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,
-0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,
-0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,
-0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,
-0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,
-0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,
-0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,
-0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,
-0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,
-0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,
-0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0,0,0,0
+0x1614,0x1614,0x1614,0x1605,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,
+0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x1617,
+0x1620,0x1620,0x1620,0x1620,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,
+0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,
+0x1623,0x1623,0x1623,0x1623,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x1635,0x163e,0x163e,0x163e,
+0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,
+0x163e,0x163e,0x163e,0x163e,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,
+0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,
+0x1647,0x1647,0x1647,0x1647,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,
+0x1659,0x1659,0x1659,0x1659,0x1656,0x1656,0x1656,0x164a,0x164a,0x164a,0x164a,0x164a,0x164a,0x164a,0x164a,0x1656,
+0x1656,0x164a,0x1656,0x164d,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,
+0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,
+0x1659,0x1659,0x1659,0x1659,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,
+0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,
+0x167d,0x167a,0x167a,0x167a,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,
+0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x168c,0x168c,0x168c,0x1689,0x1689,0x1689,
+0x1686,0x1686,0x1686,0x1686,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,
+0x169b,0x169b,0x169b,0x169b,0x168f,0x168f,0x168f,0x168f,0x168f,0x168f,0x168f,0x16a1,0x16a1,0x1695,0x1692,0x1692,
+0x1692,0x1692,0x1692,0x1692,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,
+0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,
+0x169b,0x169b,0x169b,0x169b,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,
+0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a4,0x16a4,0x16a4,0x16a4,0x16a4,
+0x16a4,0x16a4,0x16a4,0x16a4,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,
+0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,
+0x16aa,0x16aa,0x16aa,0x16aa,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,
+0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,
+0x16ce,0x16ce,0x16ce,0x16ce,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,
+0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,
+0x16d7,0x16d7,0x16d7,0x16d7,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,
+0x16ef,0x16ef,0x16ef,0x16ef,0x16da,0x16e9,0x16e9,0x16da,0x16da,0x16da,0x16da,0x16da,0x16da,0x16e9,0x16da,0x16ec,
+0x16ec,0x16da,0x16ec,0x16da,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,
+0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,
+0x16ef,0x16ef,0x16ef,0x16ef,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,
+0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,
+0x16f8,0x16f8,0x16f8,0x16f8,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,
+0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,
+0x16fe,0x16fe,0x16fe,0x16fe,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,
+0x1740,0x1740,0x1740,0x1740,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,
+0x1956,0x1956,0x1956,0x1a22,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,
+0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,
+0x1761,0x1761,0x1761,0x1761,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,
+0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,
+0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x17a3,0x17a0,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,
+0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,
+0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,
+0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,
+0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,
+0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,
+0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,
+0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,
+0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,
+0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,
+0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,
+0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c4,0x17c4,0x17c4,0x17c4,0x17c1,
+0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c4,0x17c4,0x17c4,
+0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c1,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,
+0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,
+0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,
+0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,
+0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x18c6,0x18c6,0x18c6,0x18c6,0x18c6,0x18c6,0x18c6,0x18c6,
+0x18c6,0x18c6,0x18c6,0x18c6,0x1b3f,0x1a94,0x1a94,0x1a97,0x17df,0x17df,0x17df,0x17df,0x17df,0x17df,0x17df,0x17df,
+0x17e2,0x1890,0x1890,0x1890,0x1890,0x1890,0x1890,0x192c,0x17df,0x17df,0x17df,0x17df,0x17df,0x188d,0x188d,0x188d,
+0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,
+0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x1890,0x188d,
+0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1890,0x192c,0x192c,0x1890,0x1890,0x1890,0x1890,0x1890,
+0x1890,0x1890,0x188d,0x180f,0x1890,0x1890,0x1890,0x1a94,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x180f,0x188d,
+0x188d,0x188d,0x188d,0x188d,0x1929,0x1a0a,0x1a0a,0x1a0a,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,
+0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x1929,0x1824,0x1824,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,
+0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,
+0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,
+0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,
+0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,
+0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x186f,0x186f,0x186f,
+0x185a,0x185a,0x185a,0x185a,0x185a,0x185a,0x185a,0x185a,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,
+0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,
+0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,
+0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,
+0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,
+0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,
+0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1b48,0x1b48,0x1b48,0x1b48,0x1b48,
+0x1b48,0x1b48,0x1b48,0x1b48,0x1b48,0x1b48,0x1b48,0x1b48,0x18f0,0x18f0,0x18f0,0x18f0,0x1a46,0x1a46,0x18f3,0x18f3,
+0x18f3,0x18f3,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18ed,
+0x18de,0x18e1,0x18e4,0x18f6,0x18f6,0x1995,0x18e7,0x18e7,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,
+0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,
+0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,
+0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x18fc,0x1902,0x18ff,0x18ff,0x18ff,
+0x18ff,0x190e,0x1914,0x18ff,0x18ff,0x18ff,0x18ff,0x190b,0x1911,0x18ff,0x18ff,0x18ff,0x18ff,0x18ff,0x18ff,0x18ff,
+0x18ff,0x18ff,0x18ff,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,
+0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,
+0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,
+0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1a0a,
+0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,
+0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,
+0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,
+0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,
+0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,
+0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,
+0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,
+0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,
+0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,
+0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,
+0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,
+0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,
+0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,
+0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,
+0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,
+0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,
+0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,
+0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19ef,0x19ef,0x19ef,0x1a0a,0x1a0a,0x1a0a,0x1b3c,0x1b3c,0x1a94,0x1a94,0x1a94,
+0x1a94,0x1a94,0x1a94,0x1b3c,0x1b3c,0x1b3c,0x1a94,0x1a94,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0a,0x1a10,0x1a10,0x1a0a,
+0x1a10,0x1a10,0x1a94,0x1a97,0x1a94,0x1a94,0x1a94,0x1a94,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,
+0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,
+0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,
+0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,
+0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,
+0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1aaf,0x1aaf,0x1a79,0x1aaf,0x1a79,0x1a79,0x1a79,0x1a79,
+0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a7f,0x1a7f,0x1a7f,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,
+0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,
+0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,
+0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,
+0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,
+0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,
+0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,
+0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,
+0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,
+0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,
+0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0,0,0,0
};
static const UTrie2 propsVectorsTrie={
propsVectorsTrie_index,
- propsVectorsTrie_index+5024,
+ propsVectorsTrie_index+5024,
NULL,
- 5024,
- 26204,
+ 5024,
+ 26204,
0xa40,
- 0x1420,
+ 0x1420,
0x0,
0x0,
0x110000,
- 0x79f8,
+ 0x79f8,
NULL, 0, FALSE, FALSE, 0, NULL
};
-static const uint32_t propsVectors[6999]={
-0x67,0,0,0x67,0,0x4e00000,0x67,0x80000,0x20,0x867,0,0,0xa67,0,0,0xb67,
+static const uint32_t propsVectors[6999]={
+0x67,0,0,0x67,0,0x4e00000,0x67,0x80000,0x20,0x867,0,0,0xa67,0,0,0xb67,
0,0,0xc67,0,0,0xd67,0,0,0xe67,0,0,0x1067,0,0,0x1167,0,
0,0x1267,0,0,0x1367,0,0,0x1467,0,0,0x1567,0,0,0x1667,0,0,
0x1767,0,0,0x1867,0,0,0x1967,0,0,0x1a67,0,0,0x1b67,0,0,0x1d67,
0,0,0x1f67,0,0,0x2067,0,0,0x2267,0,0,0x2367,0,0,0x2467,0,
0,0x2567,0,0,0x2767,0,0,0x2867,0x80000,0x20,0x2967,0,0,0x2a67,0,0x1600000,
-0x2b67,0,0,0x2d67,0,0,0x3167,0x20000000,0,0x3267,0x20000000,0,0x3a67,0,0,0x3b67,
-0,0,0x3c67,0,0,0x3e67,0,0,0x4067,0,0,0x4167,0,0,0x4467,0,
-0,0x4867,0,0,0x4967,0,0,0x4a67,0,0,0x5067,0,0,0x5167,0,0,
-0x5467,0,0,0x5567,0,0,0x5667,0x80000,0x20,0x5767,0,0,0x5867,0,0,0x5967,
-0,0,0x5b67,0,0,0x5c67,0,0,0x5d67,0,0,0x6067,0x80000,0x20,0x6267,0,
-0,0x6367,0,0,0x6467,0,0,0x6567,0,0,0x6f67,0,0,0x7067,0,0,
-0x7367,0x20000000,0,0x7567,0,0,0x7667,0,0,0x7767,0,0,0x7867,0,0,0x7a67,
-0,0,0x7b67,0,0,0x7c67,0,0,0x7e67,0,0,0x7f67,0,0,0x8167,0,
-0,0x8267,0,0,0x8367,0,0,0x8467,0,0,0x8567,0,0,0x8667,0,0,
-0x8767,0,0,0x8867,0,0,0x8967,0,0,0x8b67,0,0,0x8c67,0,0,0x8e67,
-0x20000000,0,0x8f67,0,0,0x9067,0,0,0x9167,0,0,0x9267,0,0,0x9367,0,
-0,0x9567,0,0,0x9667,0,0,0x9767,0,0,0x9867,0,0,0x9967,0,0,
-0x9a67,0,0,0x9c67,0,0,0x9f67,0,0,0xa167,0,0,0xa367,0,0,0xa467,
-0,0,0xa567,0,0,0xa667,0,0,0xa767,0,0,0xa867,0,0,0xa967,0,
-0,0xaa67,0,0x4e00000,0xab67,0,0x4e00000,0xac67,0,0,0xad67,0,0,0xae67,0,0,
-0xaf67,0,0,0xb167,0,0,0xb267,0,0,0xb467,0,0,0xb567,0,0,0xb767,
-0,0,0xb867,0,0,0xb967,0,0,0xba67,0,0,0xbc67,0,0,0xbd67,0,
-0,0xbe67,0,0,0xbf67,0,0,0xc067,0,0,0xc167,0,0,0xc267,0,0,
-0xc367,0,0x4e00000,0xc467,0,0x4e00000,0xc667,0,0,0xc767,0,0,0xc867,0,0,0xc967,
-0,0,0xca67,0,0,0xcc67,0,0x4e00000,0xcf67,0,0x4e00000,0xd067,0,0x4e00000,0xd267,0,
-0,0xd367,0,0,0xd467,0,0,0xd567,0,0,0xd667,0,0,0xd867,0,0,
-0xda67,0,0,0xdb67,0,0,0xdc67,0,0,0xdd67,0,0,0xde67,0,0,0xdf67,
-0,0,0xe067,0,0,0xe167,0,0,0xe267,0,0,0xe367,0,0x4e00000,0xe467,0,
-0,0xe567,0,0,0xe667,0,0,0xe767,0,0,0xe867,0,0,0xe967,0,0,
-0xea67,0,0,0xeb67,0,0,0xec67,0,0,0xed67,0,0,0xee67,0,0,0xef67,
-0,0,0xf167,0,0,0xf367,0,0,0xf567,0,0,0xf667,0,0,0xf767,0,
-0,0xf867,0,0,0xf967,0,0,0xfa67,0,0x4e00000,0xfb67,0,0,0xfc67,0,0,
-0xfd67,0,0,0xfe67,0,0,0x10167,0,0,0x10267,0,0,0x10367,0,0,0x10467,
-0,0,0x10567,0,0x4e00000,0x10667,0,0,0x10767,0,0,0x10867,0,0,0x10967,0,
-0,0x10a67,0,0,0x10b67,0,0,0x10c67,0,0,0x10d67,0,0,0x10e67,0,0,
-0x10f67,0,0,0x11067,0,0,0x11367,0,0,0x11467,0,0,0x11567,0,0,0x11667,
-0,0,0x11767,0,0,0x11867,0,0,0x11967,0,0x4e00000,0x11a67,0,0,0x11b67,0,
-0,0x11c67,0,0,0x11d67,0,0,0x11e67,0,0,0x11f67,0,0,0x12067,0,0,
-0x12167,0,0,0x12267,0,0,0x12367,0,0,0x12467,0,0,0x12567,0,0,0x12667,
-0,0,0x12767,0,0,0x12867,0,0,0x12967,0,0,0x12a67,0,0x4e00000,0x12b67,0,
-0,0x12c67,0,0,0x12d67,0,0,0x12f67,0,0,0x13067,0,0,0x13167,0,0,
-0x13267,0,0,0x13367,0,0,0x13467,0,0,0xa0067,0,0xe00000,0xa4767,0,0xe00000,0xa4f67,
-0,0xe00000,0xa5e67,0,0xe00000,0xa5f67,0,0xe00000,0xac567,0,0xe00000,0xad167,0,0xe00000,0xb0067,0,
-0xe00000,0xb1267,0,0xe00000,0xb2e67,0,0xe00000,0x11000100,0,0x900020,0x11000100,0x40000001,0x440020,0x11000100,0x40000001,0x643020,
-0x11000100,0x40000001,0xa5a040,0x11000100,0x40000001,0x116a8a0,0x11000200,0,0x900020,0x11000200,0x4000001,0xc4000b,0x11000200,0x7c00100,0x220402,0x11000200,
-0x24000000,0x14200000,0x11000200,0x24000008,0x1710000,0x11000200,0x40000001,0x1d3b020,0x11000219,0x7c00100,0x220401,0x11000219,0x7c00100,0x250401,0x11000319,0x7c00100,
-0x220401,0x11000319,0x7c00100,0x220402,0x11000319,0x7c00100,0x250400,0x11000319,0x7c00100,0x250401,0x11000419,0x7c00100,0x220400,0x11000419,0x7c00100,0x220401,
-0x11000419,0x7c00100,0x220402,0x11000419,0x7c00100,0x230400,0x11000419,0x7c00100,0x250400,0x11000419,0x7c00100,0x250401,0x11000419,0x7c00100,0x250402,0x11000519,
-0x7c00100,0x220400,0x11000519,0x7c00100,0x230400,0x11000600,0x4000400,0x200002,0x11000600,0x4000400,0x200400,0x11000600,0x7c00500,0x220400,0x11000600,0x7c00500,
-0x230400,0x11000600,0x7c00500,0x530400,0x11000600,0x7c00d00,0x230400,0x11000619,0x7c00500,0x22040f,0x11000800,0x4000010,0x1001401,0x11000800,0x4000400,0x200001,
-0x11000800,0x6800010,0x201001,0x11000800,0x7c00500,0x230401,0x11000807,0x7c00100,0x220400,0x11000807,0x7c00100,0x250400,0x1100080e,0x4000400,0x200000,0x1100080e,
-0x4000400,0x200002,0x1100080e,0x7000500,0x220402,0x1100080e,0x7c00100,0x220400,0x1100080e,0x7c00100,0x220401,0x1100080e,0x7c00100,0x220402,0x1100080e,0x7c00100,
-0x250400,0x1100080e,0x7c00100,0x250401,0x1100080e,0x7c00120,0x220402,0x1100080e,0x7c00120,0x250402,0x11000908,0x4000000,0x200000,0x11000908,0x7c00100,0x220400,
-0x11000908,0x7c00100,0x220401,0x11000908,0x7c00100,0x250400,0x11000908,0x7c00100,0x250401,0x11000a03,0x4000000,0x200400,0x11000a03,0x4000000,0x201000,0x11000a03,
-0x4000000,0x270000,0x11000a03,0x7c00100,0x220400,0x11000a03,0x7c00100,0x220402,0x11000a03,0x7c00100,0x250400,0x11000a03,0x7c00500,0x230400,0x11000a03,0xc000010,
-0x1049400,0x11000b13,0x2802500,0x962460,0x11000b13,0x4000000,0x200000,0x11000b13,0x4000000,0x201000,0x11000b13,0x4000000,0x230400,0x11000b13,0x4000002,0x400000,
-0x11000b13,0x4000010,0x200000,0x11000b13,0x7c00100,0x2633800,0x11000c00,0x80000000,0x218960,0x11000c02,0x2802100,0x962460,0x11000c02,0x2802400,0x962460,0x11000c02,
-0x4000000,0x200000,0x11000c02,0x4000000,0x1329400,0x11000c02,0x4000000,0x1329800,0x11000c02,0x4000000,0x1500000,0x11000c02,0x6800000,0x1329800,0x11000c02,0x7c00100,
-0x230400,0x11000c02,0x7c00100,0x230401,0x11000c02,0x7c00100,0x230402,0x11000c02,0x7c00500,0x230400,0x11000c02,0x7d00100,0x230400,0x11000f01,0x2802400,0x962460,
-0x11000f0a,0x2802100,0x962460,0x11000f0a,0x2802400,0x962460,0x11000f0a,0x2806400,0x962460,0x11000f0a,0x4000000,0x200000,0x11000f0a,0x6800100,0x962540,0x11000f0a,
-0x7c00100,0x230400,0x11000f0a,0x7c00100,0x230401,0x11001004,0x2802100,0x962460,0x11001004,0x2802400,0x962460,0x11001004,0x2806400,0x962460,0x11001004,0x4000000,
-0x200000,0x11001004,0x4000000,0x1500000,0x11001004,0x6800100,0x962540,0x11001004,0x6800100,0x962541,0x11001004,0x7c00100,0x230400,0x11001004,0x7c00100,0x230401,
-0x11001110,0x2802100,0x962460,0x11001110,0x2802400,0x962460,0x11001110,0x2806400,0x962460,0x11001110,0x6800100,0x962540,0x11001110,0x7c00100,0x230400,0x11001110,
-0x7c00100,0x230401,0x1100120f,0x2802100,0x962460,0x1100120f,0x2802400,0x962460,0x1100120f,0x2806400,0x962460,0x1100120f,0x6800100,0x962540,0x1100120f,0x7c00100,
-0x230400,0x1100131f,0x2802100,0x962460,0x1100131f,0x2802400,0x962460,0x1100131f,0x2806400,0x962460,0x1100131f,0x4000000,0x200000,0x1100131f,0x6800000,0x1329800,
-0x1100131f,0x6800100,0x962540,0x1100131f,0x6800100,0x962541,0x1100131f,0x7c00100,0x230400,0x1100131f,0x7c00100,0x230401,0x11001423,0x2802100,0x962460,0x11001423,
-0x2806400,0x962460,0x11001423,0x6800100,0x962540,0x11001423,0x6800100,0x962541,0x11001423,0x7c00100,0x230400,0x11001423,0x7c00100,0x230401,0x11001524,0x2802100,
-0x962460,0x11001524,0x2802100,0x962461,0x11001524,0x2806400,0x962460,0x11001524,0x6800000,0x1329800,0x11001524,0x6800100,0x962540,0x11001524,0x7c00100,0x230400,
-0x11001615,0x2802100,0x962460,0x11001615,0x2806400,0x962460,0x11001615,0x6800100,0x962540,0x11001615,0x6800100,0x962541,0x11001615,0x7c00100,0x230400,0x1100171a,
-0x2802100,0x962460,0x1100171a,0x2806400,0x962460,0x1100171a,0x6800000,0x1329800,0x1100171a,0x6800100,0x962540,0x1100171a,0x6800100,0x962541,0x1100171a,0x7c00100,
-0x230400,0x11001900,0x4000000,0x1600000,0x11001926,0x2802100,0x1862460,0x11001926,0x2802400,0x1862460,0x11001926,0x2806100,0x1862460,0x11001926,0x4000000,0x200000,
-0x11001926,0x4000010,0x400000,0x11001926,0x6800000,0x1329800,0x11001926,0x7800100,0x1830142,0x11001926,0x7c00100,0x1830000,0x11001926,0x7c00900,0x1830000,0x11001926,
-0x7e00100,0x1830000,0x11001a18,0x2802100,0x1862460,0x11001a18,0x2802400,0x1862460,0x11001a18,0x6800000,0x1329800,0x11001a18,0x7800100,0x1830142,0x11001a18,0x7c00100,
-0x1830000,0x11001a18,0x7c00100,0x1830002,0x11001a18,0x7c00900,0x1830000,0x11001a18,0x7e00100,0x1830000,0x11001d0c,0x7c00100,0x230400,0x11001d0c,0x7c00100,0x250400,
-0x11001e12,0x7c00100,0x2230500,0x11001e12,0x7c00100,0x2330520,0x11001e12,0x7c80100,0x2330520,0x11002619,0x7c00100,0x220401,0x11002619,0x7c00100,0x220402,0x11002619,
-0x7c00100,0x250401,0x1100270e,0x4000400,0x200001,0x1100270e,0x4000400,0x200002,0x1100270e,0x4000400,0x500001,0x1100270e,0x7c00100,0x220401,0x1100270e,0x7c00100,
-0x250401,0x11002800,0x80000,0x918820,0x11002800,0x80000,0x1c18020,0x11002800,0x180000,0x918820,0x11002800,0x4000001,0x445801,0x11002800,0x4000001,0x445802,
-0x11002800,0x4000001,0xc4000b,0x11002800,0x6800000,0x201c00,0x11002800,0x6800020,0x201c00,0x11002800,0x24000000,0x200000,0x11002800,0x24000000,0x200002,0x11002800,
-0x24000000,0x810000,0x11002800,0x24000000,0x1410000,0x11002800,0x24000000,0x1500000,0x11002800,0x24000000,0x1500002,0x11002800,0x24000002,0x400000,0x11002800,0x24000006,
-0xc0000b,0x11002800,0x24000008,0x1410000,0x11002800,0x24000008,0x1710000,0x11002800,0x24000020,0x1001400,0x11002800,0x24000020,0x1500002,0x11002800,0x2c000010,0x1248000,
-0x11002800,0x2c000010,0x15248002,0x11002800,0x40000001,0x63b020,0x11002800,0x40080000,0x918820,0x11002801,0x80000,0xaa65620,0x11002801,0x82000,0x962460,0x11002900,
-0x4000000,0x20000e,0x11002900,0x4000000,0x20000f,0x11002900,0x4000020,0x20000e,0x11002900,0x4000020,0x20000f,0x11002900,0x4000020,0x81000e,0x11002900,0x4000020,
-0x81000f,0x11002900,0x4000020,0x141000e,0x11002900,0x4000020,0x141000f,0x11002900,0x4000022,0x20000e,0x11002900,0x4000022,0x20000f,0x11002a00,0x4000000,0x1500000,
-0x11002a00,0x4000000,0x1600000,0x11002a00,0x4000000,0x1600002,0x11002b01,0x2000,0x962460,0x11002b01,0x2802020,0x962460,0x11002c00,0x4000000,0x200000,0x11002c00,
-0x4000000,0x200002,0x11002c00,0x4000000,0x20000f,0x11002c00,0x4000020,0x200000,0x11002c00,0x7c00000,0x200000,0x11002c00,0x7c00020,0x200000,0x11002c00,0x7c00120,
-0x220405,0x11002c00,0x7c00120,0x230402,0x11002c00,0x7c00120,0x250402,0x11002c00,0x7c00120,0x250405,0x11002c19,0x7c00100,0x250400,0x11002c19,0x7c00100,0x250401,
-0x11002d00,0x4000000,0x100006,0x11002d00,0x4000000,0x200006,0x11002d19,0x7c00100,0x220402,0x11002d19,0x7c00100,0x230400,0x11002d19,0x7c00100,0x250402,0x11002e00,
-0x24000000,0x200000,0x11002e00,0x24000020,0x200000,0x11002e00,0x24000020,0x200001,0x11002e00,0x24000020,0x14200000,0x11002f00,0x24000020,0x200000,0x11002f00,0x24000020,
-0x200001,0x11002f00,0x24000020,0x200002,0x11002f00,0x24000020,0xf00000,0x11002f00,0x24000020,0x1600000,0x11002f00,0x24000022,0x1600000,0x11003000,0x24000000,0x200000,
-0x11003000,0x24000000,0x14200000,0x11003000,0x24000020,0x200000,0x11003000,0x24000020,0x810000,0x11003000,0x24000020,0x1410000,0x11003100,0x24000000,0x200000,0x11003200,
-0x24000000,0x200000,0x11003300,0x4000000,0x100003,0x11003400,0x24000000,0x100000,0x11003400,0x24000000,0x200000,0x11003500,0x24000000,0x200000,0x11003600,0x24000000,
-0x200000,0x11003600,0x24000000,0x14200000,0x11003600,0x24000020,0x200000,0x11003700,0x24000000,0x200000,0x11003700,0x24000000,0x4200000,0x11003700,0x24000000,0x4e00000,
-0x11003700,0x24000000,0x14200000,0x11003700,0x24000000,0x14e00000,0x11003700,0x24000000,0x96800000,0x11003700,0x24000020,0x4200000,0x11003800,0x4000000,0x100000,0x11003800,
-0x24000000,0x200000,0x11003800,0x24000000,0xb00000,0x11003800,0x24000000,0x1710000,0x11003800,0x24000000,0x4200000,0x11003800,0x24000000,0x4e00000,0x11003800,0x24000000,
-0x14200000,0x11003800,0x24000000,0x14b00000,0x11003800,0x24000000,0x14e00000,0x11003800,0x24000000,0x96800000,0x11005003,0x7c00100,0x220402,0x11005013,0x2802500,0x962460,
-0x11005013,0x4000020,0x200005,0x11005013,0x7c00100,0x2633801,0x11005013,0x7c00100,0x2633802,0x11005013,0x7c00100,0x2633805,0x11005019,0x7c00100,0x220402,0x11005100,
-0x24000000,0x810000,0x11005100,0x24000000,0x1410000,0x11005102,0x7000100,0x230408,0x11005102,0x7c00100,0x230404,0x11005102,0x7c00100,0x230407,0x11005102,0x7c00100,
-0x230408,0x11005102,0x7c00100,0x230409,0x11005201,0x2802400,0x962460,0x11005500,0x80000,0x1e18820,0x11005502,0x7000100,0x230408,0x11005502,0x7c00100,0x230404,
-0x11005502,0x7c00100,0x230407,0x11005502,0x7c00100,0x230408,0x11005502,0x7c00100,0x230409,0x11005667,0x1000,0,0x11020200,0x80004,0x418820,0x11020200,
-0x4000000,0x100006,0x11020200,0x4000000,0x10000f,0x11020200,0x4000400,0x100002,0x11020200,0x4000400,0x500002,0x11020200,0x6800c00,0x101000,0x11020200,0x24000000,
-0x100000,0x11020200,0x24000000,0x1400000,0x11020200,0x24000000,0x1500000,0x11020200,0x24000000,0x1600000,0x11020200,0x24000000,0x14200000,0x11020200,0x24000020,0x100000,
-0x11020200,0x24000020,0x1600000,0x11020219,0x7c00100,0x12040f,0x11020219,0x7c00100,0x220400,0x11020219,0x7c00100,0x220401,0x11020219,0x7c00100,0x250400,0x11020319,
-0x7c00100,0x220400,0x11020319,0x7c00100,0x220401,0x11020319,0x7c00100,0x220402,0x11020319,0x7c00100,0x250400,0x11020319,0x7c00100,0x250402,0x11020319,0x7d00100,
-0x220402,0x11020419,0x7c00100,0x220401,0x11020519,0x7c00100,0x220400,0x11020600,0x4000400,0x100002,0x11020600,0x4000400,0x200400,0x11020600,0x7c00500,0x130400,
-0x11020600,0x7c00d00,0x130400,0x11020701,0x2802400,0x962460,0x11020701,0x2802400,0x962461,0x11020701,0x2802400,0xc62460,0x1102080e,0x7c00100,0x220400,0x1102080e,
-0x7c00100,0x250400,0x11020908,0x7c00100,0x220400,0x11020908,0x7c00100,0x220401,0x11020908,0x7c00100,0x250400,0x11020908,0x7c00100,0x250401,0x11022800,0x24000000,
-0x100000,0x11022800,0x24000000,0x200000,0x11022800,0x24000000,0x200002,0x11022800,0x24000000,0x401000,0x11022800,0x24000000,0xf00002,0x11022800,0x24000000,0xf0ac02,
-0x11022800,0x24000000,0x1500000,0x11022800,0x24000002,0x100000,0x11022800,0x24000002,0x370000,0x11022800,0x24000002,0x470000,0x11022800,0x24000006,0x400000,0x11022800,
-0x24000008,0x1710000,0x11022800,0x24000008,0x1712c00,0x11022800,0x24000020,0x100000,0x11022800,0x24000020,0x1500000,0x11022800,0x24000020,0x1500002,0x11022900,0x4000000,
-0x10000e,0x11022900,0x4000000,0x10000f,0x11022919,0x7c00100,0x12040f,0x11022c00,0x4000000,0x100002,0x11022c00,0x4000000,0x1500002,0x11022c00,0x4000000,0x1600002,
-0x11022c00,0x4000000,0x1410000f,0x11022c00,0x7c00120,0x120405,0x11022c0e,0x7c00100,0x250401,0x11022c19,0x7c00100,0x150401,0x11022d00,0x4000000,0x100006,0x11022d00,
-0x4000000,0x200006,0x11022d19,0x7c00100,0x120402,0x11022d19,0x7c00100,0x150402,0x11022e00,0x24000000,0x200000,0x11022e00,0x24000020,0x100000,0x11022e00,0x24000020,
-0x14100000,0x11022f00,0x24000020,0x100000,0x11022f00,0x24000020,0x100001,0x11022f00,0x24000020,0x100002,0x11023000,0x24000000,0x100000,0x11023300,0x4000000,0x100002,
-0x11023300,0x4000000,0x100003,0x11023300,0x4000100,0x120403,0x11023300,0x4000100,0x150403,0x11023300,0x4000100,0x14150403,0x11023400,0x24000000,0x100000,0x11023500,
-0x24000000,0x100000,0x11023600,0x24000000,0x100000,0x11023600,0x24000020,0x100000,0x11023600,0x24000020,0x14100000,0x11023700,0x24000000,0x4100000,0x11023700,0x24000000,
-0x4e00000,0x11023700,0x24000000,0x14100000,0x11023700,0x24000000,0x14e00000,0x11023700,0x24000020,0x100000,0x11023700,0x24000020,0x4100000,0x11023700,0x24000020,0x14100000,
-0x11023800,0x4000000,0x100000,0x11023800,0x24000000,0x200000,0x11024e67,0,0,0x11025600,0x4000000,0x100000,0x11042a00,0x4000000,0x1600000,0x11045700,
-0x4000000,0x20000a,0x11045700,0x4000020,0x20000a,0x11045712,0x7c00100,0xe3040a,0x11045712,0x7c80100,0xe3040a,0x11045716,0x7c00100,0xe30c0a,0x11045716,0x7c00100,
-0x2530c0a,0x11063d00,0x4000001,0x445811,0x11065700,0x4000000,0x810011,0x11065700,0x4000000,0xe00011,0x11065700,0x4000000,0x1410011,0x11065700,0x4000000,0x1500011,
-0x11065700,0x4000000,0x1600011,0x11065700,0x4000006,0xe70011,0x11065700,0x4000008,0xe00011,0x11065700,0x4000008,0xe02c11,0x11065700,0x4000010,0x871411,0x11065700,
-0x4000010,0x1201411,0x11065700,0x4000010,0x1271011,0x11065700,0x4000020,0xe00011,0x11065700,0x4000400,0xe00011,0x11065700,0x4000420,0xe00011,0x11065700,0x6800000,
-0xe01c11,0x11065700,0x6800040,0xe29811,0x11065700,0xc000010,0x80ac11,0x11065700,0xc000010,0xb48011,0x11065719,0x7c00100,0xe20411,0x11065719,0x7c00100,0xe50411,
-0x11065719,0x7c00140,0xe20411,0x11065719,0x7c00140,0xe50411,0x11080100,0x6800000,0x201c00,0x11080100,0x68000c0,0x19329800,0x11080100,0x24000000,0x200000,0x11080100,
-0x24000000,0x810000,0x11080100,0x24000000,0x1410000,0x11080100,0x24000000,0x1500000,0x11080100,0x24000000,0x1600000,0x11080100,0x24000000,0x1b00000,0x11080100,0x24000000,
-0x2410000,0x11080100,0x24000000,0x18200000,0x11080100,0x24000006,0xd70000,0x11080100,0x24000008,0x1713c00,0x11080100,0x24000008,0x1714000,0x11080100,0x24000010,0x1001400,
-0x11080100,0x24000010,0x1071000,0x11080100,0x24000010,0x1071400,0x11080100,0x24000020,0x200000,0x11080100,0x24000020,0x400000,0x11080100,0x24000020,0x1600000,0x11080100,
-0x24000400,0x200000,0x11080100,0x24000420,0x200000,0x11080100,0x2c000010,0xb48000,0x11080100,0x2c000010,0x100ac00,0x11080100,0x44000001,0x1a45800,0x11080119,0x7c00100,
-0x220400,0x11080119,0x7c00100,0x250400,0x11080119,0x7c001c0,0x220400,0x11080119,0x7c001c0,0x250400,0x11080200,0x4000400,0x200002,0x11080200,0x24000000,0x200000,
-0x11080200,0x24000000,0x1500000,0x11080200,0x24000000,0x1600000,0x11080200,0x24000020,0x200000,0x110a1e12,0x7c00100,0x2130480,0x110a1e12,0x7c80100,0x2130480,0x110a3000,
-0x24000000,0x34e00000,0x110a3000,0x24100000,0x810001,0x110a3000,0x24100000,0x1410001,0x110a3700,0x24000000,0x34200000,0x110a3d00,0x4000000,0xe00000,0x110a3d00,0x4000000,
-0xe00002,0x110a3d00,0x24000000,0xe00000,0x110a3d11,0x7c00300,0xe30000,0x110a3d11,0x7c00900,0x1230400,0x110a3d12,0x2802400,0x962460,0x110a3e14,0x7c00100,0xe30000,
-0x110a3e14,0x7c00100,0xe30001,0x110a3e14,0x7c00100,0x2530000,0x110a3e14,0x7c00900,0x1230000,0x110a3e14,0x7c00900,0x1230001,0x110a3f16,0x7c00100,0xe30c00,0x110a3f16,
-0x7c00100,0xe30c01,0x110a3f16,0x7c00100,0x2530c00,0x110a3f16,0x7c00900,0x1230c00,0x110a3f16,0x7c00900,0x1230c01,0x110a4005,0x7c00100,0xe30400,0x110a4112,0x7c00100,
-0xe30402,0x110a4112,0x7c80100,0xe30402,0x110a4400,0x4000000,0xe00000,0x110a4412,0x4000000,0xe00002,0x110a4412,0x4000000,0xe00003,0x110a4416,0x4000000,0xe00c03,
-0x110a4500,0x4000000,0xe0000d,0x110a4516,0x4000000,0xe00c0d,0x110a4711,0x7c40300,0xe30000,0x110a4f11,0x7c00300,0xe30001,0x110a4f11,0x7c40300,0xe30000,0x110a5300,
-0x4000000,0x810010,0x110a5300,0x4000000,0xe00002,0x110a5300,0x4000000,0xe00010,0x110a5300,0x4000000,0x1410010,0x110a5300,0x4000002,0xe70010,0x110a5300,0x4000008,
-0x810010,0x110a5300,0x4000008,0x1410010,0x110a5300,0x6800000,0xe01c02,0x110a5300,0x6800000,0xe01c10,0x110a5400,0x4000000,0x81000c,0x110a5400,0x4000000,0xe0000c,
-0x110a5400,0x4000000,0x141000c,0x110a5400,0x4000000,0x150000c,0x110a5400,0x4000000,0x160000c,0x110a5400,0x4000002,0xe7000c,0x110a5400,0x4000010,0x87140c,0x110a5400,
-0x4000010,0xe7000c,0x110a5400,0x4000010,0x120140c,0x110a5400,0x4000010,0x127100c,0x110a5400,0x4000020,0xe0000c,0x110a5400,0x4000026,0xe7000c,0x110a5400,0xc000010,
-0x80ac0c,0x110a5400,0xc000010,0xb4800c,0x11400c0c,0x4000010,0xb00000,0x11400c0c,0x4000010,0x1071400,0x11400c0c,0xc000010,0xb48000,0x11400c16,0x7c00900,0x230400,
-0x11400f40,0xc000010,0x448000,0x11400f54,0xc000010,0x448000,0x11401d89,0x4000000,0x200000,0x11403dbf,0x4000000,0xe00000,0x114457b4,0x4000004,0x120000a,0x114457b4,
-0x4000008,0x81000a,0x114457b4,0x4000008,0x141000a,0x114457b4,0x4000010,0x87000a,0x114457b4,0xc000010,0x84800a,0x114457bd,0x3802500,0x126246a,0x114457bd,0x7c00d00,
-0x2530c0a,0x114a3db4,0x24000000,0x810000,0x114a3db4,0x24000000,0x1410000,0x114a3db4,0x24000008,0x810000,0x114a3db4,0x24000008,0x1410000,0x114a3db4,0x24000010,0x870000,
-0x114a3db4,0x2c000010,0x848000,0x114a3dba,0x4000000,0xe00000,0x114a3dba,0x24000000,0xe00000,0x114a3dba,0x24000002,0x1200000,0x114a3dba,0x24000002,0x14e00000,0x114a3dba,
-0x24000008,0x810000,0x114a3dba,0x24000008,0x1410000,0x114a3dbd,0x7c00900,0x930c00,0x114a3dbd,0x7c00900,0xe30c00,0x114a3dbf,0x7c00300,0xe30000,0x114a3ebd,0x7000400,
-0x1200c02,0x114a3fb4,0x4000004,0x1200000,0x114a3fbd,0x7c00d00,0x2530c00,0x114a42bf,0x4000000,0xe00000,0x114a42bf,0x4000000,0xe0000f,0x114a44bf,0x4000000,0xe00002,
-0x114a44bf,0x4000000,0xe00003,0x114a44bf,0x4000000,0x14e00003,0x114a45bf,0x4000000,0xe00002,0x114a45bf,0x4000000,0xe0000d,0x1180090a,0x2802400,0x962460,0x11800c1e,
-0x2802100,0x962460,0x11800c1e,0x2802500,0x962460,0x11800f27,0x2802400,0x962460,0x11800f34,0x2802400,0x962460,0x11820700,0x2802400,0x962460,0x11820700,0x2802500,
-0x962460,0x118a3dc0,0x2802400,0x962460,0x118a3ebd,0x2802400,0x962460,0x11c00904,0x2802400,0x962460,0x11c00908,0x2802400,0x962460,0x11c00c20,0xc000010,0xb48000,
-0x11c00c23,0x6800000,0x1329800,0x11c00f6d,0x6800000,0x1329800,0x11c01072,0x6800000,0x1329800,0x11c01176,0x6800000,0x1329800,0x11c0127a,0x6800000,0x1329800,0x11c0147e,
-0x4000000,0x200000,0x11c0147e,0x6800000,0x1329800,0x11c01682,0x6800000,0x1329800,0x11c051fa,0x7c00100,0x230408,0x20000067,0x1000,0,0x20000b13,0x2802400,
-0x962460,0x20000b13,0x2802500,0x962460,0x20001b27,0x2802100,0x962460,0x20001b27,0x2802100,0x962461,0x20001b27,0x2802400,0x962460,0x20001b27,0x2806400,0x962460,
-0x20001b27,0x2902100,0x962462,0x20001b27,0x4000000,0x200000,0x20001b27,0x4000000,0x400000,0x20001b27,0x4000000,0x500000,0x20001b27,0x4000000,0x810000,0x20001b27,
-0x4000000,0xb00000,0x20001b27,0x4000000,0xc0000b,0x20001b27,0x4000000,0x1410000,0x20001b27,0x4000010,0xb00000,0x20001b27,0x4000010,0xc00000,0x20001b27,0x6800000,
-0x1329800,0x20001b27,0x6800100,0x462540,0x20001b27,0x6800400,0x962540,0x20001b27,0x7c00100,0x230400,0x20001b27,0x7c00100,0x230401,0x20002619,0x7c00100,0x220401,
-0x20002a00,0x4000000,0x1600000,0x20004b67,0,0x1900000,0x20004c67,0,0x1900000,0x20004d67,0,0x1900000,0x20006d67,0x1000,0,0x20006e67,
-0x1000,0,0x20026d67,0,0,0x20026e67,0,0,0x200a4a12,0x7c00100,0x1f304c1,0x200a4a12,0x7c00100,0x20304e1,0x21005600,0x4000000,
-0x700000,0x21022a00,0x4000000,0x1600000,0x30000419,0x7c00100,0x220400,0x30000419,0x7c00100,0x220401,0x30000419,0x7c00100,0x250400,0x30000419,0x7c00100,0x250401,
-0x30000519,0x7c00100,0x220400,0x30000600,0x4000400,0x200400,0x30000600,0x7c00500,0x230400,0x30000605,0x4000400,0x200400,0x3000080e,0x7c00100,0x220400,0x30000908,
-0x2000,0x962460,0x30000908,0x7c00100,0x220400,0x30000908,0x7c00100,0x220401,0x30000908,0x7c00100,0x250400,0x30000908,0x7c00100,0x250401,0x30000a03,0x4000006,
-0x400400,0x30000c02,0x4000000,0x200000,0x30000c02,0x7c00100,0x230400,0x30000d22,0x2802100,0x962460,0x30000d22,0x2802400,0x962460,0x30000d22,0x2802500,0x962460,
-0x30000d22,0x4000000,0x200000,0x30000d22,0x4000010,0x200000,0x30000d22,0x7c00100,0x230400,0x30000d22,0xc000010,0x248000,0x30000d22,0x80000000,0x218960,0x30000e25,
-0x2802500,0x962460,0x30000e25,0x7c00100,0x230400,0x30001821,0x2802100,0x962460,0x30001821,0x2806400,0x962460,0x30001821,0x4000000,0x200000,0x30001821,0x6800100,
-0x962540,0x30001821,0x6800100,0x962541,0x30001821,0x7c00100,0x230400,0x30001b27,0x2802100,0x962460,0x30001b27,0x2802400,0x962460,0x30001b27,0x4000000,0x200000,
-0x30001b27,0x4000000,0x400000,0x30001b27,0x7c00100,0x230400,0x30001c1c,0x2802100,0x1862460,0x30001c1c,0x2802400,0x1862460,0x30001c1c,0x2806400,0x1862460,0x30001c1c,
-0x4000000,0x200000,0x30001c1c,0x6800100,0x1862400,0x30001c1c,0x6800100,0x1862540,0x30001c1c,0x7c00100,0x1830000,0x30001c1c,0x7c00100,0x1830001,0x30001c1c,0xc000010,
-0x448000,0x30001f0b,0x4000000,0x200000,0x30001f0b,0x4000010,0x200000,0x30001f0b,0x4000010,0x400000,0x30001f0b,0x6800000,0x200000,0x30001f0b,0x7c00100,0x230400,
-0x30001f0b,0xc000010,0x248000,0x30002006,0x7c00100,0x250400,0x30002128,0x4000000,0x200000,0x30002128,0x7c00100,0x230400,0x30002128,0xc000010,0x248000,0x3000221d,
-0x4000000,0x810000,0x3000221d,0x4000000,0x1410000,0x3000221d,0x4000001,0x445800,0x3000221d,0x7c00100,0x230400,0x30002300,0x4000010,0x400000,0x30002320,0x7c00100,
-0x230400,0x30002417,0x2802100,0x1862460,0x30002417,0x2802400,0x1862460,0x30002417,0x2806400,0x1862460,0x30002417,0x2882000,0x1862460,0x30002417,0x4000000,0x200000,
-0x30002417,0x4000000,0x400000,0x30002417,0x4000000,0x1600000,0x30002417,0x4000010,0x400000,0x30002417,0x4000010,0x1200000,0x30002417,0x6800000,0x1329800,0x30002417,
-0x6800100,0x1862540,0x30002417,0x7c00100,0x1830000,0x30002417,0x7d00100,0x1830000,0x3000251b,0x80000,0xc18820,0x3000251b,0x2802100,0x962460,0x3000251b,0x3c02100,
-0x962460,0x3000251b,0x4000000,0x200000,0x3000251b,0x4000006,0x500000,0x3000251b,0x4000010,0x400000,0x3000251b,0x4000010,0xb70000,0x3000251b,0x4000800,0x200000,
-0x3000251b,0x6800000,0x1329800,0x3000251b,0x7c00100,0x230400,0x3000251b,0x7c00900,0x230400,0x3000251b,0xc000010,0xb48000,0x3000251b,0x12882000,0x962460,0x30002800,
-0x24000000,0x200000,0x30002800,0x2c000010,0x1248002,0x30002800,0x2c000010,0x15248002,0x30002a00,0x4000000,0x1600000,0x30002b01,0x2000,0x962460,0x30002b01,0x2000,
-0x8962460,0x30002c00,0x4000000,0x200000,0x30002c00,0x7c00100,0x14220405,0x30002d19,0x7c00100,0x250400,0x30002e00,0x24000000,0x200000,0x30003000,0x24000000,0x200000,
-0x30003000,0x24000000,0x4200000,0x30003100,0x24000000,0x200000,0x30003600,0x24000000,0x200000,0x30003700,0x24000000,0x4200000,0x3000392e,0x24000000,0x200000,0x30005013,
-0x7c00100,0x2633801,0x30005600,0,0x918820,0x30020600,0x4000400,0x500400,0x30020701,0x2802400,0x962460,0x30020701,0x2802400,0xc62460,0x300a3a11,0x4020000,
-0xe00000,0x300a3a11,0x4020000,0xe00002,0x300a3b11,0x4020000,0xe00002,0x300a3c00,0x4008000,0xe00000,0x300a3c00,0x4010000,0xe00000,0x300a3d11,0x7c00300,0xe30002,
-0x300a4305,0x7c00100,0xe30400,0x300a4611,0x7c40300,0xe30000,0x300a4829,0x7c00100,0xe30400,0x300a4829,0x7c00900,0x1230400,0x300a4929,0x4000000,0xe00000,0x3040258f,
-0x4000010,0x400000,0x3040258f,0x4000010,0xb70000,0x3040258f,0xc000010,0xb48000,0x304028af,0x4000001,0xc41c0b,0x304a3dbf,0x4000000,0xe00000,0x30800c1e,0x2802100,
-0x962460,0x30c01c87,0x6800000,0x1329800,0x3100080e,0x7c00120,0x220402,0x3100080e,0x7c00120,0x250402,0x31005167,0x1000,0,0x3100581e,0x4000000,0x200000,
+0x2b67,0,0,0x2d67,0,0,0x3167,0x20000000,0,0x3267,0x20000000,0,0x3a67,0,0,0x3b67,
+0,0,0x3c67,0,0,0x3e67,0,0,0x4067,0,0,0x4167,0,0,0x4467,0,
+0,0x4867,0,0,0x4967,0,0,0x4a67,0,0,0x5067,0,0,0x5167,0,0,
+0x5467,0,0,0x5567,0,0,0x5667,0x80000,0x20,0x5767,0,0,0x5867,0,0,0x5967,
+0,0,0x5b67,0,0,0x5c67,0,0,0x5d67,0,0,0x6067,0x80000,0x20,0x6267,0,
+0,0x6367,0,0,0x6467,0,0,0x6567,0,0,0x6f67,0,0,0x7067,0,0,
+0x7367,0x20000000,0,0x7567,0,0,0x7667,0,0,0x7767,0,0,0x7867,0,0,0x7a67,
+0,0,0x7b67,0,0,0x7c67,0,0,0x7e67,0,0,0x7f67,0,0,0x8167,0,
+0,0x8267,0,0,0x8367,0,0,0x8467,0,0,0x8567,0,0,0x8667,0,0,
+0x8767,0,0,0x8867,0,0,0x8967,0,0,0x8b67,0,0,0x8c67,0,0,0x8e67,
+0x20000000,0,0x8f67,0,0,0x9067,0,0,0x9167,0,0,0x9267,0,0,0x9367,0,
+0,0x9567,0,0,0x9667,0,0,0x9767,0,0,0x9867,0,0,0x9967,0,0,
+0x9a67,0,0,0x9c67,0,0,0x9f67,0,0,0xa167,0,0,0xa367,0,0,0xa467,
+0,0,0xa567,0,0,0xa667,0,0,0xa767,0,0,0xa867,0,0,0xa967,0,
+0,0xaa67,0,0x4e00000,0xab67,0,0x4e00000,0xac67,0,0,0xad67,0,0,0xae67,0,0,
+0xaf67,0,0,0xb167,0,0,0xb267,0,0,0xb467,0,0,0xb567,0,0,0xb767,
+0,0,0xb867,0,0,0xb967,0,0,0xba67,0,0,0xbc67,0,0,0xbd67,0,
+0,0xbe67,0,0,0xbf67,0,0,0xc067,0,0,0xc167,0,0,0xc267,0,0,
+0xc367,0,0x4e00000,0xc467,0,0x4e00000,0xc667,0,0,0xc767,0,0,0xc867,0,0,0xc967,
+0,0,0xca67,0,0,0xcc67,0,0x4e00000,0xcf67,0,0x4e00000,0xd067,0,0x4e00000,0xd267,0,
+0,0xd367,0,0,0xd467,0,0,0xd567,0,0,0xd667,0,0,0xd867,0,0,
+0xda67,0,0,0xdb67,0,0,0xdc67,0,0,0xdd67,0,0,0xde67,0,0,0xdf67,
+0,0,0xe067,0,0,0xe167,0,0,0xe267,0,0,0xe367,0,0x4e00000,0xe467,0,
+0,0xe567,0,0,0xe667,0,0,0xe767,0,0,0xe867,0,0,0xe967,0,0,
+0xea67,0,0,0xeb67,0,0,0xec67,0,0,0xed67,0,0,0xee67,0,0,0xef67,
+0,0,0xf167,0,0,0xf367,0,0,0xf567,0,0,0xf667,0,0,0xf767,0,
+0,0xf867,0,0,0xf967,0,0,0xfa67,0,0x4e00000,0xfb67,0,0,0xfc67,0,0,
+0xfd67,0,0,0xfe67,0,0,0x10167,0,0,0x10267,0,0,0x10367,0,0,0x10467,
+0,0,0x10567,0,0x4e00000,0x10667,0,0,0x10767,0,0,0x10867,0,0,0x10967,0,
+0,0x10a67,0,0,0x10b67,0,0,0x10c67,0,0,0x10d67,0,0,0x10e67,0,0,
+0x10f67,0,0,0x11067,0,0,0x11367,0,0,0x11467,0,0,0x11567,0,0,0x11667,
+0,0,0x11767,0,0,0x11867,0,0,0x11967,0,0x4e00000,0x11a67,0,0,0x11b67,0,
+0,0x11c67,0,0,0x11d67,0,0,0x11e67,0,0,0x11f67,0,0,0x12067,0,0,
+0x12167,0,0,0x12267,0,0,0x12367,0,0,0x12467,0,0,0x12567,0,0,0x12667,
+0,0,0x12767,0,0,0x12867,0,0,0x12967,0,0,0x12a67,0,0x4e00000,0x12b67,0,
+0,0x12c67,0,0,0x12d67,0,0,0x12f67,0,0,0x13067,0,0,0x13167,0,0,
+0x13267,0,0,0x13367,0,0,0x13467,0,0,0xa0067,0,0xe00000,0xa4767,0,0xe00000,0xa4f67,
+0,0xe00000,0xa5e67,0,0xe00000,0xa5f67,0,0xe00000,0xac567,0,0xe00000,0xad167,0,0xe00000,0xb0067,0,
+0xe00000,0xb1267,0,0xe00000,0xb2e67,0,0xe00000,0x11000100,0,0x900020,0x11000100,0x40000001,0x440020,0x11000100,0x40000001,0x643020,
+0x11000100,0x40000001,0xa5a040,0x11000100,0x40000001,0x116a8a0,0x11000200,0,0x900020,0x11000200,0x4000001,0xc4000b,0x11000200,0x7c00100,0x220402,0x11000200,
+0x24000000,0x14200000,0x11000200,0x24000008,0x1710000,0x11000200,0x40000001,0x1d3b020,0x11000219,0x7c00100,0x220401,0x11000219,0x7c00100,0x250401,0x11000319,0x7c00100,
+0x220401,0x11000319,0x7c00100,0x220402,0x11000319,0x7c00100,0x250400,0x11000319,0x7c00100,0x250401,0x11000419,0x7c00100,0x220400,0x11000419,0x7c00100,0x220401,
+0x11000419,0x7c00100,0x220402,0x11000419,0x7c00100,0x230400,0x11000419,0x7c00100,0x250400,0x11000419,0x7c00100,0x250401,0x11000419,0x7c00100,0x250402,0x11000519,
+0x7c00100,0x220400,0x11000519,0x7c00100,0x230400,0x11000600,0x4000400,0x200002,0x11000600,0x4000400,0x200400,0x11000600,0x7c00500,0x220400,0x11000600,0x7c00500,
+0x230400,0x11000600,0x7c00500,0x530400,0x11000600,0x7c00d00,0x230400,0x11000619,0x7c00500,0x22040f,0x11000800,0x4000010,0x1001401,0x11000800,0x4000400,0x200001,
+0x11000800,0x6800010,0x201001,0x11000800,0x7c00500,0x230401,0x11000807,0x7c00100,0x220400,0x11000807,0x7c00100,0x250400,0x1100080e,0x4000400,0x200000,0x1100080e,
+0x4000400,0x200002,0x1100080e,0x7000500,0x220402,0x1100080e,0x7c00100,0x220400,0x1100080e,0x7c00100,0x220401,0x1100080e,0x7c00100,0x220402,0x1100080e,0x7c00100,
+0x250400,0x1100080e,0x7c00100,0x250401,0x1100080e,0x7c00120,0x220402,0x1100080e,0x7c00120,0x250402,0x11000908,0x4000000,0x200000,0x11000908,0x7c00100,0x220400,
+0x11000908,0x7c00100,0x220401,0x11000908,0x7c00100,0x250400,0x11000908,0x7c00100,0x250401,0x11000a03,0x4000000,0x200400,0x11000a03,0x4000000,0x201000,0x11000a03,
+0x4000000,0x270000,0x11000a03,0x7c00100,0x220400,0x11000a03,0x7c00100,0x220402,0x11000a03,0x7c00100,0x250400,0x11000a03,0x7c00500,0x230400,0x11000a03,0xc000010,
+0x1049400,0x11000b13,0x2802500,0x962460,0x11000b13,0x4000000,0x200000,0x11000b13,0x4000000,0x201000,0x11000b13,0x4000000,0x230400,0x11000b13,0x4000002,0x400000,
+0x11000b13,0x4000010,0x200000,0x11000b13,0x7c00100,0x2633800,0x11000c00,0x80000000,0x218960,0x11000c02,0x2802100,0x962460,0x11000c02,0x2802400,0x962460,0x11000c02,
+0x4000000,0x200000,0x11000c02,0x4000000,0x1329400,0x11000c02,0x4000000,0x1329800,0x11000c02,0x4000000,0x1500000,0x11000c02,0x6800000,0x1329800,0x11000c02,0x7c00100,
+0x230400,0x11000c02,0x7c00100,0x230401,0x11000c02,0x7c00100,0x230402,0x11000c02,0x7c00500,0x230400,0x11000c02,0x7d00100,0x230400,0x11000f01,0x2802400,0x962460,
+0x11000f0a,0x2802100,0x962460,0x11000f0a,0x2802400,0x962460,0x11000f0a,0x2806400,0x962460,0x11000f0a,0x4000000,0x200000,0x11000f0a,0x6800100,0x962540,0x11000f0a,
+0x7c00100,0x230400,0x11000f0a,0x7c00100,0x230401,0x11001004,0x2802100,0x962460,0x11001004,0x2802400,0x962460,0x11001004,0x2806400,0x962460,0x11001004,0x4000000,
+0x200000,0x11001004,0x4000000,0x1500000,0x11001004,0x6800100,0x962540,0x11001004,0x6800100,0x962541,0x11001004,0x7c00100,0x230400,0x11001004,0x7c00100,0x230401,
+0x11001110,0x2802100,0x962460,0x11001110,0x2802400,0x962460,0x11001110,0x2806400,0x962460,0x11001110,0x6800100,0x962540,0x11001110,0x7c00100,0x230400,0x11001110,
+0x7c00100,0x230401,0x1100120f,0x2802100,0x962460,0x1100120f,0x2802400,0x962460,0x1100120f,0x2806400,0x962460,0x1100120f,0x6800100,0x962540,0x1100120f,0x7c00100,
+0x230400,0x1100131f,0x2802100,0x962460,0x1100131f,0x2802400,0x962460,0x1100131f,0x2806400,0x962460,0x1100131f,0x4000000,0x200000,0x1100131f,0x6800000,0x1329800,
+0x1100131f,0x6800100,0x962540,0x1100131f,0x6800100,0x962541,0x1100131f,0x7c00100,0x230400,0x1100131f,0x7c00100,0x230401,0x11001423,0x2802100,0x962460,0x11001423,
+0x2806400,0x962460,0x11001423,0x6800100,0x962540,0x11001423,0x6800100,0x962541,0x11001423,0x7c00100,0x230400,0x11001423,0x7c00100,0x230401,0x11001524,0x2802100,
+0x962460,0x11001524,0x2802100,0x962461,0x11001524,0x2806400,0x962460,0x11001524,0x6800000,0x1329800,0x11001524,0x6800100,0x962540,0x11001524,0x7c00100,0x230400,
+0x11001615,0x2802100,0x962460,0x11001615,0x2806400,0x962460,0x11001615,0x6800100,0x962540,0x11001615,0x6800100,0x962541,0x11001615,0x7c00100,0x230400,0x1100171a,
+0x2802100,0x962460,0x1100171a,0x2806400,0x962460,0x1100171a,0x6800000,0x1329800,0x1100171a,0x6800100,0x962540,0x1100171a,0x6800100,0x962541,0x1100171a,0x7c00100,
+0x230400,0x11001900,0x4000000,0x1600000,0x11001926,0x2802100,0x1862460,0x11001926,0x2802400,0x1862460,0x11001926,0x2806100,0x1862460,0x11001926,0x4000000,0x200000,
+0x11001926,0x4000010,0x400000,0x11001926,0x6800000,0x1329800,0x11001926,0x7800100,0x1830142,0x11001926,0x7c00100,0x1830000,0x11001926,0x7c00900,0x1830000,0x11001926,
+0x7e00100,0x1830000,0x11001a18,0x2802100,0x1862460,0x11001a18,0x2802400,0x1862460,0x11001a18,0x6800000,0x1329800,0x11001a18,0x7800100,0x1830142,0x11001a18,0x7c00100,
+0x1830000,0x11001a18,0x7c00100,0x1830002,0x11001a18,0x7c00900,0x1830000,0x11001a18,0x7e00100,0x1830000,0x11001d0c,0x7c00100,0x230400,0x11001d0c,0x7c00100,0x250400,
+0x11001e12,0x7c00100,0x2230500,0x11001e12,0x7c00100,0x2330520,0x11001e12,0x7c80100,0x2330520,0x11002619,0x7c00100,0x220401,0x11002619,0x7c00100,0x220402,0x11002619,
+0x7c00100,0x250401,0x1100270e,0x4000400,0x200001,0x1100270e,0x4000400,0x200002,0x1100270e,0x4000400,0x500001,0x1100270e,0x7c00100,0x220401,0x1100270e,0x7c00100,
+0x250401,0x11002800,0x80000,0x918820,0x11002800,0x80000,0x1c18020,0x11002800,0x180000,0x918820,0x11002800,0x4000001,0x445801,0x11002800,0x4000001,0x445802,
+0x11002800,0x4000001,0xc4000b,0x11002800,0x6800000,0x201c00,0x11002800,0x6800020,0x201c00,0x11002800,0x24000000,0x200000,0x11002800,0x24000000,0x200002,0x11002800,
+0x24000000,0x810000,0x11002800,0x24000000,0x1410000,0x11002800,0x24000000,0x1500000,0x11002800,0x24000000,0x1500002,0x11002800,0x24000002,0x400000,0x11002800,0x24000006,
+0xc0000b,0x11002800,0x24000008,0x1410000,0x11002800,0x24000008,0x1710000,0x11002800,0x24000020,0x1001400,0x11002800,0x24000020,0x1500002,0x11002800,0x2c000010,0x1248000,
+0x11002800,0x2c000010,0x15248002,0x11002800,0x40000001,0x63b020,0x11002800,0x40080000,0x918820,0x11002801,0x80000,0xaa65620,0x11002801,0x82000,0x962460,0x11002900,
+0x4000000,0x20000e,0x11002900,0x4000000,0x20000f,0x11002900,0x4000020,0x20000e,0x11002900,0x4000020,0x20000f,0x11002900,0x4000020,0x81000e,0x11002900,0x4000020,
+0x81000f,0x11002900,0x4000020,0x141000e,0x11002900,0x4000020,0x141000f,0x11002900,0x4000022,0x20000e,0x11002900,0x4000022,0x20000f,0x11002a00,0x4000000,0x1500000,
+0x11002a00,0x4000000,0x1600000,0x11002a00,0x4000000,0x1600002,0x11002b01,0x2000,0x962460,0x11002b01,0x2802020,0x962460,0x11002c00,0x4000000,0x200000,0x11002c00,
+0x4000000,0x200002,0x11002c00,0x4000000,0x20000f,0x11002c00,0x4000020,0x200000,0x11002c00,0x7c00000,0x200000,0x11002c00,0x7c00020,0x200000,0x11002c00,0x7c00120,
+0x220405,0x11002c00,0x7c00120,0x230402,0x11002c00,0x7c00120,0x250402,0x11002c00,0x7c00120,0x250405,0x11002c19,0x7c00100,0x250400,0x11002c19,0x7c00100,0x250401,
+0x11002d00,0x4000000,0x100006,0x11002d00,0x4000000,0x200006,0x11002d19,0x7c00100,0x220402,0x11002d19,0x7c00100,0x230400,0x11002d19,0x7c00100,0x250402,0x11002e00,
+0x24000000,0x200000,0x11002e00,0x24000020,0x200000,0x11002e00,0x24000020,0x200001,0x11002e00,0x24000020,0x14200000,0x11002f00,0x24000020,0x200000,0x11002f00,0x24000020,
+0x200001,0x11002f00,0x24000020,0x200002,0x11002f00,0x24000020,0xf00000,0x11002f00,0x24000020,0x1600000,0x11002f00,0x24000022,0x1600000,0x11003000,0x24000000,0x200000,
+0x11003000,0x24000000,0x14200000,0x11003000,0x24000020,0x200000,0x11003000,0x24000020,0x810000,0x11003000,0x24000020,0x1410000,0x11003100,0x24000000,0x200000,0x11003200,
+0x24000000,0x200000,0x11003300,0x4000000,0x100003,0x11003400,0x24000000,0x100000,0x11003400,0x24000000,0x200000,0x11003500,0x24000000,0x200000,0x11003600,0x24000000,
+0x200000,0x11003600,0x24000000,0x14200000,0x11003600,0x24000020,0x200000,0x11003700,0x24000000,0x200000,0x11003700,0x24000000,0x4200000,0x11003700,0x24000000,0x4e00000,
+0x11003700,0x24000000,0x14200000,0x11003700,0x24000000,0x14e00000,0x11003700,0x24000000,0x96800000,0x11003700,0x24000020,0x4200000,0x11003800,0x4000000,0x100000,0x11003800,
+0x24000000,0x200000,0x11003800,0x24000000,0xb00000,0x11003800,0x24000000,0x1710000,0x11003800,0x24000000,0x4200000,0x11003800,0x24000000,0x4e00000,0x11003800,0x24000000,
+0x14200000,0x11003800,0x24000000,0x14b00000,0x11003800,0x24000000,0x14e00000,0x11003800,0x24000000,0x96800000,0x11005003,0x7c00100,0x220402,0x11005013,0x2802500,0x962460,
+0x11005013,0x4000020,0x200005,0x11005013,0x7c00100,0x2633801,0x11005013,0x7c00100,0x2633802,0x11005013,0x7c00100,0x2633805,0x11005019,0x7c00100,0x220402,0x11005100,
+0x24000000,0x810000,0x11005100,0x24000000,0x1410000,0x11005102,0x7000100,0x230408,0x11005102,0x7c00100,0x230404,0x11005102,0x7c00100,0x230407,0x11005102,0x7c00100,
+0x230408,0x11005102,0x7c00100,0x230409,0x11005201,0x2802400,0x962460,0x11005500,0x80000,0x1e18820,0x11005502,0x7000100,0x230408,0x11005502,0x7c00100,0x230404,
+0x11005502,0x7c00100,0x230407,0x11005502,0x7c00100,0x230408,0x11005502,0x7c00100,0x230409,0x11005667,0x1000,0,0x11020200,0x80004,0x418820,0x11020200,
+0x4000000,0x100006,0x11020200,0x4000000,0x10000f,0x11020200,0x4000400,0x100002,0x11020200,0x4000400,0x500002,0x11020200,0x6800c00,0x101000,0x11020200,0x24000000,
+0x100000,0x11020200,0x24000000,0x1400000,0x11020200,0x24000000,0x1500000,0x11020200,0x24000000,0x1600000,0x11020200,0x24000000,0x14200000,0x11020200,0x24000020,0x100000,
+0x11020200,0x24000020,0x1600000,0x11020219,0x7c00100,0x12040f,0x11020219,0x7c00100,0x220400,0x11020219,0x7c00100,0x220401,0x11020219,0x7c00100,0x250400,0x11020319,
+0x7c00100,0x220400,0x11020319,0x7c00100,0x220401,0x11020319,0x7c00100,0x220402,0x11020319,0x7c00100,0x250400,0x11020319,0x7c00100,0x250402,0x11020319,0x7d00100,
+0x220402,0x11020419,0x7c00100,0x220401,0x11020519,0x7c00100,0x220400,0x11020600,0x4000400,0x100002,0x11020600,0x4000400,0x200400,0x11020600,0x7c00500,0x130400,
+0x11020600,0x7c00d00,0x130400,0x11020701,0x2802400,0x962460,0x11020701,0x2802400,0x962461,0x11020701,0x2802400,0xc62460,0x1102080e,0x7c00100,0x220400,0x1102080e,
+0x7c00100,0x250400,0x11020908,0x7c00100,0x220400,0x11020908,0x7c00100,0x220401,0x11020908,0x7c00100,0x250400,0x11020908,0x7c00100,0x250401,0x11022800,0x24000000,
+0x100000,0x11022800,0x24000000,0x200000,0x11022800,0x24000000,0x200002,0x11022800,0x24000000,0x401000,0x11022800,0x24000000,0xf00002,0x11022800,0x24000000,0xf0ac02,
+0x11022800,0x24000000,0x1500000,0x11022800,0x24000002,0x100000,0x11022800,0x24000002,0x370000,0x11022800,0x24000002,0x470000,0x11022800,0x24000006,0x400000,0x11022800,
+0x24000008,0x1710000,0x11022800,0x24000008,0x1712c00,0x11022800,0x24000020,0x100000,0x11022800,0x24000020,0x1500000,0x11022800,0x24000020,0x1500002,0x11022900,0x4000000,
+0x10000e,0x11022900,0x4000000,0x10000f,0x11022919,0x7c00100,0x12040f,0x11022c00,0x4000000,0x100002,0x11022c00,0x4000000,0x1500002,0x11022c00,0x4000000,0x1600002,
+0x11022c00,0x4000000,0x1410000f,0x11022c00,0x7c00120,0x120405,0x11022c0e,0x7c00100,0x250401,0x11022c19,0x7c00100,0x150401,0x11022d00,0x4000000,0x100006,0x11022d00,
+0x4000000,0x200006,0x11022d19,0x7c00100,0x120402,0x11022d19,0x7c00100,0x150402,0x11022e00,0x24000000,0x200000,0x11022e00,0x24000020,0x100000,0x11022e00,0x24000020,
+0x14100000,0x11022f00,0x24000020,0x100000,0x11022f00,0x24000020,0x100001,0x11022f00,0x24000020,0x100002,0x11023000,0x24000000,0x100000,0x11023300,0x4000000,0x100002,
+0x11023300,0x4000000,0x100003,0x11023300,0x4000100,0x120403,0x11023300,0x4000100,0x150403,0x11023300,0x4000100,0x14150403,0x11023400,0x24000000,0x100000,0x11023500,
+0x24000000,0x100000,0x11023600,0x24000000,0x100000,0x11023600,0x24000020,0x100000,0x11023600,0x24000020,0x14100000,0x11023700,0x24000000,0x4100000,0x11023700,0x24000000,
+0x4e00000,0x11023700,0x24000000,0x14100000,0x11023700,0x24000000,0x14e00000,0x11023700,0x24000020,0x100000,0x11023700,0x24000020,0x4100000,0x11023700,0x24000020,0x14100000,
+0x11023800,0x4000000,0x100000,0x11023800,0x24000000,0x200000,0x11024e67,0,0,0x11025600,0x4000000,0x100000,0x11042a00,0x4000000,0x1600000,0x11045700,
+0x4000000,0x20000a,0x11045700,0x4000020,0x20000a,0x11045712,0x7c00100,0xe3040a,0x11045712,0x7c80100,0xe3040a,0x11045716,0x7c00100,0xe30c0a,0x11045716,0x7c00100,
+0x2530c0a,0x11063d00,0x4000001,0x445811,0x11065700,0x4000000,0x810011,0x11065700,0x4000000,0xe00011,0x11065700,0x4000000,0x1410011,0x11065700,0x4000000,0x1500011,
+0x11065700,0x4000000,0x1600011,0x11065700,0x4000006,0xe70011,0x11065700,0x4000008,0xe00011,0x11065700,0x4000008,0xe02c11,0x11065700,0x4000010,0x871411,0x11065700,
+0x4000010,0x1201411,0x11065700,0x4000010,0x1271011,0x11065700,0x4000020,0xe00011,0x11065700,0x4000400,0xe00011,0x11065700,0x4000420,0xe00011,0x11065700,0x6800000,
+0xe01c11,0x11065700,0x6800040,0xe29811,0x11065700,0xc000010,0x80ac11,0x11065700,0xc000010,0xb48011,0x11065719,0x7c00100,0xe20411,0x11065719,0x7c00100,0xe50411,
+0x11065719,0x7c00140,0xe20411,0x11065719,0x7c00140,0xe50411,0x11080100,0x6800000,0x201c00,0x11080100,0x68000c0,0x19329800,0x11080100,0x24000000,0x200000,0x11080100,
+0x24000000,0x810000,0x11080100,0x24000000,0x1410000,0x11080100,0x24000000,0x1500000,0x11080100,0x24000000,0x1600000,0x11080100,0x24000000,0x1b00000,0x11080100,0x24000000,
+0x2410000,0x11080100,0x24000000,0x18200000,0x11080100,0x24000006,0xd70000,0x11080100,0x24000008,0x1713c00,0x11080100,0x24000008,0x1714000,0x11080100,0x24000010,0x1001400,
+0x11080100,0x24000010,0x1071000,0x11080100,0x24000010,0x1071400,0x11080100,0x24000020,0x200000,0x11080100,0x24000020,0x400000,0x11080100,0x24000020,0x1600000,0x11080100,
+0x24000400,0x200000,0x11080100,0x24000420,0x200000,0x11080100,0x2c000010,0xb48000,0x11080100,0x2c000010,0x100ac00,0x11080100,0x44000001,0x1a45800,0x11080119,0x7c00100,
+0x220400,0x11080119,0x7c00100,0x250400,0x11080119,0x7c001c0,0x220400,0x11080119,0x7c001c0,0x250400,0x11080200,0x4000400,0x200002,0x11080200,0x24000000,0x200000,
+0x11080200,0x24000000,0x1500000,0x11080200,0x24000000,0x1600000,0x11080200,0x24000020,0x200000,0x110a1e12,0x7c00100,0x2130480,0x110a1e12,0x7c80100,0x2130480,0x110a3000,
+0x24000000,0x34e00000,0x110a3000,0x24100000,0x810001,0x110a3000,0x24100000,0x1410001,0x110a3700,0x24000000,0x34200000,0x110a3d00,0x4000000,0xe00000,0x110a3d00,0x4000000,
+0xe00002,0x110a3d00,0x24000000,0xe00000,0x110a3d11,0x7c00300,0xe30000,0x110a3d11,0x7c00900,0x1230400,0x110a3d12,0x2802400,0x962460,0x110a3e14,0x7c00100,0xe30000,
+0x110a3e14,0x7c00100,0xe30001,0x110a3e14,0x7c00100,0x2530000,0x110a3e14,0x7c00900,0x1230000,0x110a3e14,0x7c00900,0x1230001,0x110a3f16,0x7c00100,0xe30c00,0x110a3f16,
+0x7c00100,0xe30c01,0x110a3f16,0x7c00100,0x2530c00,0x110a3f16,0x7c00900,0x1230c00,0x110a3f16,0x7c00900,0x1230c01,0x110a4005,0x7c00100,0xe30400,0x110a4112,0x7c00100,
+0xe30402,0x110a4112,0x7c80100,0xe30402,0x110a4400,0x4000000,0xe00000,0x110a4412,0x4000000,0xe00002,0x110a4412,0x4000000,0xe00003,0x110a4416,0x4000000,0xe00c03,
+0x110a4500,0x4000000,0xe0000d,0x110a4516,0x4000000,0xe00c0d,0x110a4711,0x7c40300,0xe30000,0x110a4f11,0x7c00300,0xe30001,0x110a4f11,0x7c40300,0xe30000,0x110a5300,
+0x4000000,0x810010,0x110a5300,0x4000000,0xe00002,0x110a5300,0x4000000,0xe00010,0x110a5300,0x4000000,0x1410010,0x110a5300,0x4000002,0xe70010,0x110a5300,0x4000008,
+0x810010,0x110a5300,0x4000008,0x1410010,0x110a5300,0x6800000,0xe01c02,0x110a5300,0x6800000,0xe01c10,0x110a5400,0x4000000,0x81000c,0x110a5400,0x4000000,0xe0000c,
+0x110a5400,0x4000000,0x141000c,0x110a5400,0x4000000,0x150000c,0x110a5400,0x4000000,0x160000c,0x110a5400,0x4000002,0xe7000c,0x110a5400,0x4000010,0x87140c,0x110a5400,
+0x4000010,0xe7000c,0x110a5400,0x4000010,0x120140c,0x110a5400,0x4000010,0x127100c,0x110a5400,0x4000020,0xe0000c,0x110a5400,0x4000026,0xe7000c,0x110a5400,0xc000010,
+0x80ac0c,0x110a5400,0xc000010,0xb4800c,0x11400c0c,0x4000010,0xb00000,0x11400c0c,0x4000010,0x1071400,0x11400c0c,0xc000010,0xb48000,0x11400c16,0x7c00900,0x230400,
+0x11400f40,0xc000010,0x448000,0x11400f54,0xc000010,0x448000,0x11401d89,0x4000000,0x200000,0x11403dbf,0x4000000,0xe00000,0x114457b4,0x4000004,0x120000a,0x114457b4,
+0x4000008,0x81000a,0x114457b4,0x4000008,0x141000a,0x114457b4,0x4000010,0x87000a,0x114457b4,0xc000010,0x84800a,0x114457bd,0x3802500,0x126246a,0x114457bd,0x7c00d00,
+0x2530c0a,0x114a3db4,0x24000000,0x810000,0x114a3db4,0x24000000,0x1410000,0x114a3db4,0x24000008,0x810000,0x114a3db4,0x24000008,0x1410000,0x114a3db4,0x24000010,0x870000,
+0x114a3db4,0x2c000010,0x848000,0x114a3dba,0x4000000,0xe00000,0x114a3dba,0x24000000,0xe00000,0x114a3dba,0x24000002,0x1200000,0x114a3dba,0x24000002,0x14e00000,0x114a3dba,
+0x24000008,0x810000,0x114a3dba,0x24000008,0x1410000,0x114a3dbd,0x7c00900,0x930c00,0x114a3dbd,0x7c00900,0xe30c00,0x114a3dbf,0x7c00300,0xe30000,0x114a3ebd,0x7000400,
+0x1200c02,0x114a3fb4,0x4000004,0x1200000,0x114a3fbd,0x7c00d00,0x2530c00,0x114a42bf,0x4000000,0xe00000,0x114a42bf,0x4000000,0xe0000f,0x114a44bf,0x4000000,0xe00002,
+0x114a44bf,0x4000000,0xe00003,0x114a44bf,0x4000000,0x14e00003,0x114a45bf,0x4000000,0xe00002,0x114a45bf,0x4000000,0xe0000d,0x1180090a,0x2802400,0x962460,0x11800c1e,
+0x2802100,0x962460,0x11800c1e,0x2802500,0x962460,0x11800f27,0x2802400,0x962460,0x11800f34,0x2802400,0x962460,0x11820700,0x2802400,0x962460,0x11820700,0x2802500,
+0x962460,0x118a3dc0,0x2802400,0x962460,0x118a3ebd,0x2802400,0x962460,0x11c00904,0x2802400,0x962460,0x11c00908,0x2802400,0x962460,0x11c00c20,0xc000010,0xb48000,
+0x11c00c23,0x6800000,0x1329800,0x11c00f6d,0x6800000,0x1329800,0x11c01072,0x6800000,0x1329800,0x11c01176,0x6800000,0x1329800,0x11c0127a,0x6800000,0x1329800,0x11c0147e,
+0x4000000,0x200000,0x11c0147e,0x6800000,0x1329800,0x11c01682,0x6800000,0x1329800,0x11c051fa,0x7c00100,0x230408,0x20000067,0x1000,0,0x20000b13,0x2802400,
+0x962460,0x20000b13,0x2802500,0x962460,0x20001b27,0x2802100,0x962460,0x20001b27,0x2802100,0x962461,0x20001b27,0x2802400,0x962460,0x20001b27,0x2806400,0x962460,
+0x20001b27,0x2902100,0x962462,0x20001b27,0x4000000,0x200000,0x20001b27,0x4000000,0x400000,0x20001b27,0x4000000,0x500000,0x20001b27,0x4000000,0x810000,0x20001b27,
+0x4000000,0xb00000,0x20001b27,0x4000000,0xc0000b,0x20001b27,0x4000000,0x1410000,0x20001b27,0x4000010,0xb00000,0x20001b27,0x4000010,0xc00000,0x20001b27,0x6800000,
+0x1329800,0x20001b27,0x6800100,0x462540,0x20001b27,0x6800400,0x962540,0x20001b27,0x7c00100,0x230400,0x20001b27,0x7c00100,0x230401,0x20002619,0x7c00100,0x220401,
+0x20002a00,0x4000000,0x1600000,0x20004b67,0,0x1900000,0x20004c67,0,0x1900000,0x20004d67,0,0x1900000,0x20006d67,0x1000,0,0x20006e67,
+0x1000,0,0x20026d67,0,0,0x20026e67,0,0,0x200a4a12,0x7c00100,0x1f304c1,0x200a4a12,0x7c00100,0x20304e1,0x21005600,0x4000000,
+0x700000,0x21022a00,0x4000000,0x1600000,0x30000419,0x7c00100,0x220400,0x30000419,0x7c00100,0x220401,0x30000419,0x7c00100,0x250400,0x30000419,0x7c00100,0x250401,
+0x30000519,0x7c00100,0x220400,0x30000600,0x4000400,0x200400,0x30000600,0x7c00500,0x230400,0x30000605,0x4000400,0x200400,0x3000080e,0x7c00100,0x220400,0x30000908,
+0x2000,0x962460,0x30000908,0x7c00100,0x220400,0x30000908,0x7c00100,0x220401,0x30000908,0x7c00100,0x250400,0x30000908,0x7c00100,0x250401,0x30000a03,0x4000006,
+0x400400,0x30000c02,0x4000000,0x200000,0x30000c02,0x7c00100,0x230400,0x30000d22,0x2802100,0x962460,0x30000d22,0x2802400,0x962460,0x30000d22,0x2802500,0x962460,
+0x30000d22,0x4000000,0x200000,0x30000d22,0x4000010,0x200000,0x30000d22,0x7c00100,0x230400,0x30000d22,0xc000010,0x248000,0x30000d22,0x80000000,0x218960,0x30000e25,
+0x2802500,0x962460,0x30000e25,0x7c00100,0x230400,0x30001821,0x2802100,0x962460,0x30001821,0x2806400,0x962460,0x30001821,0x4000000,0x200000,0x30001821,0x6800100,
+0x962540,0x30001821,0x6800100,0x962541,0x30001821,0x7c00100,0x230400,0x30001b27,0x2802100,0x962460,0x30001b27,0x2802400,0x962460,0x30001b27,0x4000000,0x200000,
+0x30001b27,0x4000000,0x400000,0x30001b27,0x7c00100,0x230400,0x30001c1c,0x2802100,0x1862460,0x30001c1c,0x2802400,0x1862460,0x30001c1c,0x2806400,0x1862460,0x30001c1c,
+0x4000000,0x200000,0x30001c1c,0x6800100,0x1862400,0x30001c1c,0x6800100,0x1862540,0x30001c1c,0x7c00100,0x1830000,0x30001c1c,0x7c00100,0x1830001,0x30001c1c,0xc000010,
+0x448000,0x30001f0b,0x4000000,0x200000,0x30001f0b,0x4000010,0x200000,0x30001f0b,0x4000010,0x400000,0x30001f0b,0x6800000,0x200000,0x30001f0b,0x7c00100,0x230400,
+0x30001f0b,0xc000010,0x248000,0x30002006,0x7c00100,0x250400,0x30002128,0x4000000,0x200000,0x30002128,0x7c00100,0x230400,0x30002128,0xc000010,0x248000,0x3000221d,
+0x4000000,0x810000,0x3000221d,0x4000000,0x1410000,0x3000221d,0x4000001,0x445800,0x3000221d,0x7c00100,0x230400,0x30002300,0x4000010,0x400000,0x30002320,0x7c00100,
+0x230400,0x30002417,0x2802100,0x1862460,0x30002417,0x2802400,0x1862460,0x30002417,0x2806400,0x1862460,0x30002417,0x2882000,0x1862460,0x30002417,0x4000000,0x200000,
+0x30002417,0x4000000,0x400000,0x30002417,0x4000000,0x1600000,0x30002417,0x4000010,0x400000,0x30002417,0x4000010,0x1200000,0x30002417,0x6800000,0x1329800,0x30002417,
+0x6800100,0x1862540,0x30002417,0x7c00100,0x1830000,0x30002417,0x7d00100,0x1830000,0x3000251b,0x80000,0xc18820,0x3000251b,0x2802100,0x962460,0x3000251b,0x3c02100,
+0x962460,0x3000251b,0x4000000,0x200000,0x3000251b,0x4000006,0x500000,0x3000251b,0x4000010,0x400000,0x3000251b,0x4000010,0xb70000,0x3000251b,0x4000800,0x200000,
+0x3000251b,0x6800000,0x1329800,0x3000251b,0x7c00100,0x230400,0x3000251b,0x7c00900,0x230400,0x3000251b,0xc000010,0xb48000,0x3000251b,0x12882000,0x962460,0x30002800,
+0x24000000,0x200000,0x30002800,0x2c000010,0x1248002,0x30002800,0x2c000010,0x15248002,0x30002a00,0x4000000,0x1600000,0x30002b01,0x2000,0x962460,0x30002b01,0x2000,
+0x8962460,0x30002c00,0x4000000,0x200000,0x30002c00,0x7c00100,0x14220405,0x30002d19,0x7c00100,0x250400,0x30002e00,0x24000000,0x200000,0x30003000,0x24000000,0x200000,
+0x30003000,0x24000000,0x4200000,0x30003100,0x24000000,0x200000,0x30003600,0x24000000,0x200000,0x30003700,0x24000000,0x4200000,0x3000392e,0x24000000,0x200000,0x30005013,
+0x7c00100,0x2633801,0x30005600,0,0x918820,0x30020600,0x4000400,0x500400,0x30020701,0x2802400,0x962460,0x30020701,0x2802400,0xc62460,0x300a3a11,0x4020000,
+0xe00000,0x300a3a11,0x4020000,0xe00002,0x300a3b11,0x4020000,0xe00002,0x300a3c00,0x4008000,0xe00000,0x300a3c00,0x4010000,0xe00000,0x300a3d11,0x7c00300,0xe30002,
+0x300a4305,0x7c00100,0xe30400,0x300a4611,0x7c40300,0xe30000,0x300a4829,0x7c00100,0xe30400,0x300a4829,0x7c00900,0x1230400,0x300a4929,0x4000000,0xe00000,0x3040258f,
+0x4000010,0x400000,0x3040258f,0x4000010,0xb70000,0x3040258f,0xc000010,0xb48000,0x304028af,0x4000001,0xc41c0b,0x304a3dbf,0x4000000,0xe00000,0x30800c1e,0x2802100,
+0x962460,0x30c01c87,0x6800000,0x1329800,0x3100080e,0x7c00120,0x220402,0x3100080e,0x7c00120,0x250402,0x31005167,0x1000,0,0x3100581e,0x4000000,0x200000,
0x3100581e,0x7c00100,0x230400,0x3100590d,0x7c00100,0x230400,0x31005a09,0x7c00100,0x220400,0x31005a09,0x7c00100,0x250400,0x31005b00,0x4000000,0x200000,0x31005c00,
0x80000,0x918820,0x31005c00,0x2802000,0x962460,0x31005c00,0x2802400,0x962460,0x31005c00,0x4000000,0x200000,0x31005c00,0x4000000,0x200001,0x31005c00,0x6800000,
0x962540,0x31005c00,0x6800400,0x962540,0x31005c01,0x2802400,0x962460,0x31005d00,0x4000020,0x200005,0x31005d00,0x6800020,0x1329805,0x31005d00,0x7c00120,0x220405,
-0x31005d00,0x7c00120,0x250405,0x31006000,0x82000,0x8962460,0x31006000,0x180000,0x918820,0x310a5e11,0x7c40300,0xe30000,0x310a5f11,0x7c00300,0xe30001,0x32000419,
+0x31005d00,0x7c00120,0x250405,0x31006000,0x82000,0x8962460,0x31006000,0x180000,0x918820,0x310a5e11,0x7c40300,0xe30000,0x310a5f11,0x7c00300,0xe30001,0x32000419,
0x7c00100,0x250400,0x3200080e,0x4000020,0x200000,0x3200080e,0x7c00100,0x220400,0x3200080e,0x7c00100,0x250400,0x32000908,0x7c00100,0x220400,0x32000908,0x7c00100,
0x250400,0x32000c02,0x7c00100,0x230400,0x32000e25,0x7c00100,0x230400,0x32001d0c,0x7c00100,0x230400,0x32002800,0x80000,0x1e18820,0x32002800,0x80020,0x218820,
-0x32002800,0x4000001,0x445802,0x32002800,0x24000000,0x200000,0x32002800,0x24000000,0x200002,0x32002800,0x24000020,0x200000,0x32002800,0x2c000010,0x1248002,0x32002919,
+0x32002800,0x4000001,0x445802,0x32002800,0x24000000,0x200000,0x32002800,0x24000000,0x200002,0x32002800,0x24000020,0x200000,0x32002800,0x2c000010,0x1248002,0x32002919,
0x7c00100,0x22040f,0x32002a00,0x4000000,0x1600000,0x32002b01,0x2000,0x962460,0x32002b01,0x2802000,0x962460,0x32002b01,0x2802020,0x962460,0x32002c00,0x4000000,
0x200000,0x32002c00,0x4000020,0x200000,0x32002c00,0x4000020,0x200005,0x32002c00,0x7c00120,0x220405,0x32002c00,0x7c00120,0x250405,0x32002e00,0x24000020,0x200000,
0x32002f00,0x24000020,0x200000,0x32003000,0x24000000,0x200000,0x32003000,0x24000020,0x200000,0x32003500,0x24000000,0x200000,0x32003600,0x24000020,0x200000,0x32003600,
-0x24000020,0x14200000,0x32003700,0x24000000,0x200000,0x32003700,0x24000000,0x4100000,0x32003700,0x24000000,0x4200000,0x32003700,0x24000000,0x14200000,0x32003800,0x24000000,
-0x810000,0x32003800,0x24000000,0x1410000,0x32005102,0x4000000,0x1500008,0x32005502,0x7c00100,0x230400,0x32006108,0x7c00100,0x220400,0x32006108,0x7c00100,0x250400,
-0x3200622a,0x2802100,0x962460,0x3200622a,0x2806000,0x962460,0x3200622a,0x7c00100,0x230400,0x3200632b,0x2802100,0x962460,0x3200632b,0x2806000,0x962460,0x3200632b,
-0x7c00100,0x230400,0x3200642c,0x2802100,0x962460,0x3200642c,0x7c00100,0x230400,0x3200652d,0x2802100,0x962460,0x3200652d,0x7c00100,0x230400,0x32006600,0x24000020,
-0x200000,0x32006700,0x24000020,0x200000,0x32006800,0x24000020,0x200000,0x32006800,0x24000020,0x14200000,0x32006900,0x24000020,0x200000,0x32006900,0x24000020,0x810000,
-0x32006900,0x24000020,0x1410000,0x32006a00,0x24000020,0x200000,0x32006a00,0x24000020,0x200001,0x32006a00,0x24000020,0x200002,0x32020701,0x2882000,0xc62460,0x32023300,
-0x4000000,0x100000,0x32026c01,0x12882000,0x962460,0x32026c01,0x12882000,0x8962460,0x32065700,0x4000000,0x810011,0x32065700,0x4000000,0x1410011,0x32086600,0x24000020,
-0x810000,0x32086600,0x24000020,0x1410000,0x32086900,0x24000020,0x810000,0x32086900,0x24000020,0x1410000,0x320a3600,0x24000020,0x34200000,0x320a3d11,0x7c00100,0x1230400,
-0x320a3e14,0x7c00100,0xe30010,0x320a3e14,0x7c00100,0x2530000,0x320a3f16,0x7c00100,0xe30c10,0x320a4400,0x4000000,0xe00003,0x320a4929,0x4000000,0xe00000,0x320a4f11,
-0x7c00300,0xe30001,0x320a6b16,0x7c00100,0x2530c00,0x3240638b,0xc000010,0x448000,0x324a3dc2,0x4000000,0x14e00000,0x324a3dc2,0x7c00100,0x1230400,0x324a3fbd,0x4000002,
-0x1200c00,0x324a53ba,0x24000000,0xe00000,0x32820701,0x2802000,0x962460,0x40000419,0x7c00100,0x220400,0x40000519,0x7c00100,0x220400,0x40000600,0x4000400,0x200400,
-0x4000080e,0x7c00100,0x220400,0x4000080e,0x7c00100,0x250400,0x4000080e,0x7c00100,0x250402,0x40000c02,0x2802100,0x962460,0x40000c02,0x2802400,0x962460,0x40000c02,
-0x2802500,0x962460,0x40000c02,0x4000000,0x200000,0x40000c02,0x4000000,0x1071400,0x40000c02,0x7c00100,0x230400,0x40000c02,0x80000000,0x218960,0x40000d22,0x7c00100,
-0x230400,0x40000f0a,0x7c00100,0x230400,0x40001004,0x7c00100,0x230400,0x40001110,0x2802100,0x962460,0x40001110,0x6800100,0x962540,0x4000120f,0x2802100,0x962460,
-0x4000120f,0x4000000,0x1600000,0x4000120f,0x7c00100,0x230400,0x4000131f,0x7c00100,0x230400,0x40001423,0x4000000,0x200000,0x40001423,0x4000000,0x1600000,0x40001615,
-0x2802400,0x962460,0x40001615,0x7c00100,0x230400,0x40002417,0x2802400,0x1862460,0x40002417,0x4000000,0x200000,0x40002800,0x6800000,0x201c00,0x40002800,0x24000002,
-0x200000,0x40002c00,0x4000000,0x200002,0x40003000,0x24000000,0x14200000,0x40003000,0x24000020,0x200000,0x40003700,0x24000000,0x200000,0x40003700,0x24000000,0x4200000,
-0x40003700,0x24000000,0x14200000,0x40005a09,0x7c00100,0x220400,0x40005a09,0x7c00100,0x250400,0x40005d00,0x7c00120,0x220405,0x40006f30,0x2802100,0x962460,0x40006f30,
-0x2802400,0x962460,0x40006f30,0x4000000,0x200000,0x40006f30,0x6800000,0x1329800,0x40006f30,0x6800100,0x962540,0x40006f30,0x7c00100,0x230400,0x40006f30,0xc000010,
-0xb48000,0x40007034,0x7c00100,0x1830000,0x40007117,0x4000000,0x200000,0x40007208,0x7c00100,0x220400,0x4000720e,0x7c00100,0x220400,0x4000720e,0x7c00500,0x22040e,
-0x4000720e,0x7c00500,0x22040f,0x40007219,0x7c00100,0x220400,0x40007219,0x7c00500,0x220400,0x40007219,0x7c00500,0x22040e,0x40007219,0x7c00500,0x22040f,0x40007300,
-0x24000000,0x200000,0x40007300,0x24000000,0x14200000,0x40007400,0x4000000,0x200000,0x40007531,0x7c00100,0x230400,0x40007631,0x7c00100,0x230400,0x40007835,0x4000010,
-0x400000,0x40007835,0x7c00100,0x230400,0x40007933,0x7c00100,0x230400,0x40007a32,0x6800000,0x1329800,0x40007a32,0x7c00100,0x230400,0x40007b2f,0x7c00100,0x230400,
-0x40007c00,0x4000000,0x200000,0x40020701,0x2802400,0x962460,0x40020701,0x2802400,0xc62460,0x40023300,0x4000000,0x200000,0x40027d01,0x12882000,0x962460,0x400a3700,
-0x24000000,0x34200000,0x400a3700,0x24000000,0x34e00000,0x400a4400,0x4000000,0xe0000d,0x400a4412,0x4000000,0xe00002,0x400a4412,0x4000000,0xe00003,0x400a4500,0x4000000,
-0xe0000d,0x400a5300,0x4000000,0x810010,0x400a5300,0x4000000,0x1410010,0x404077fc,0x4000000,0x200000,0x404077ff,0x4000000,0x200000,0x404077ff,0x4000000,0x400000,
-0x40c0147e,0x4000000,0x200000,0x40c051fa,0x4000000,0x200000,0x41000419,0x7c00100,0x220400,0x41000419,0x7c00100,0x250400,0x4100080e,0x7c00100,0x220400,0x4100080e,
-0x7c00100,0x250400,0x41000908,0x7c00100,0x220400,0x41000908,0x7c00100,0x250400,0x41000b13,0x2802000,0x962460,0x41000b13,0x2802100,0x962460,0x41000b13,0x4000000,
-0xb00000,0x41000c02,0x2802100,0x962460,0x41000c02,0x4000000,0x1500000,0x41000c02,0xc000010,0xb48000,0x41000f0a,0x7c00100,0x230400,0x41001004,0x7c00100,0x230400,
-0x41001423,0x7c00100,0x230400,0x41001b27,0x4000000,0x500000,0x41001d0c,0x7c00100,0x230400,0x41001d0c,0x7c00100,0x23040f,0x41001f0b,0x2802400,0x962460,0x41001f0b,
-0x4000000,0x200000,0x41001f0b,0x7c00100,0x230400,0x41002800,0x24000000,0x200000,0x41002800,0x24000000,0x400000,0x41002919,0x7c00100,0x22040e,0x41002a00,0x4000000,
-0x1600000,0x41002b01,0x2802020,0x962460,0x41002c00,0x4000000,0x200000,0x41002c00,0x7c00120,0x220405,0x41003000,0x24000000,0x200000,0x41003700,0x24000000,0x4200000,
-0x41003700,0x24000000,0x14200000,0x41003700,0x24000000,0x14e00000,0x41005d00,0x7c00120,0x220405,0x41006600,0x24000020,0x200000,0x41006600,0x24000020,0x810000,0x41006600,
-0x24000020,0x1410000,0x41007208,0x7c00100,0x22040f,0x41007219,0x7c00100,0x220400,0x41007300,0x24000000,0x200000,0x41007e0e,0x2802000,0x962460,0x41007e0e,0x4000000,
-0x200000,0x41007f0e,0x4000000,0x200000,0x41007f0e,0x7c00100,0x230400,0x41008002,0x7c00100,0x230400,0x41008137,0x2802100,0x962460,0x41008137,0x4000000,0x200000,
-0x41008137,0x6800100,0x962540,0x41008137,0x7c00100,0x230400,0x41008301,0x2802000,0x962460,0x41008407,0x4000000,0x200000,0x41008407,0x4000000,0x400000,0x41008407,
-0x4000000,0xb00000,0x41008407,0x7c00100,0x220400,0x41008407,0x7c00100,0x250400,0x4100850b,0x7c00100,0x230400,0x4100860b,0x4000000,0x200000,0x4100860b,0x7c00100,
-0x230400,0x4100870c,0x7c00100,0x220400,0x41008838,0x7c00100,0x220400,0x41008838,0x7c00100,0x250400,0x41008939,0x2802000,0x962460,0x41008939,0x2802100,0x962460,
-0x41008939,0x2806000,0x962460,0x41008939,0x4000000,0x200000,0x41008939,0x4000000,0x400000,0x41008939,0x7c00100,0x230400,0x41008939,0xc000010,0x448000,0x41008a00,
-0x4000400,0x200400,0x41008b3b,0x4000000,0x1800000,0x41008b3b,0x6800000,0x1329800,0x41008b3b,0x7c00100,0x1830000,0x41008b3b,0x7e00100,0x1830000,0x41008c3d,0x4000010,
-0x400000,0x41008c3d,0x7c00100,0x230400,0x41008d0e,0x7c00100,0x22040f,0x41008d19,0x7c00100,0x220400,0x41008d19,0x7c00100,0x22040f,0x41008e00,0x24000000,0x200000,
-0x41008e00,0x24000000,0x400000,0x41008e00,0x24000000,0x1710000,0x41008e00,0x24000006,0x400000,0x41008f3a,0x2802100,0x962460,0x41008f3a,0x2806000,0x962460,0x41008f3a,
-0x4000000,0x200000,0x41008f3a,0x6800100,0x962540,0x41008f3a,0x7c00100,0x230400,0x4100903c,0x7c00100,0x230400,0x4100903c,0x7c00100,0x23040f,0x41020701,0x2802000,
-0x962460,0x41020701,0x2802000,0xc62460,0x410a3700,0x24000000,0x34200000,0x410a3700,0x24000000,0x34e00000,0x410a4412,0x4000000,0xe00003,0x410a4711,0x7c40300,0xe30000,
-0x410a4f11,0x7c00300,0xe30001,0x410a9100,0x4000000,0x800010,0x410a9100,0x4000000,0x810010,0x410a9100,0x4000000,0x870010,0x410a9100,0x4000000,0xb00010,0x410a9100,
-0x4000000,0xf00010,0x410a9100,0x4000000,0x1001410,0x410a9100,0x4000000,0x1071010,0x410a9100,0x4000000,0x1071410,0x410a9100,0x4000000,0x1410010,0x41408ac5,0x4000400,
-0x200000,0x414a82bf,0x4000000,0xe00000,0x41808300,0x2802000,0x962460,0x41c0147e,0x6800000,0x1329800,0x50000419,0x7c00100,0x220400,0x50000419,0x7c00100,0x250400,
-0x5000080e,0x7c00100,0x220400,0x50000908,0x7c00100,0x220400,0x50000908,0x7c00100,0x250400,0x50000b13,0x2802500,0x962460,0x50000f0a,0x7c00100,0x230400,0x50001615,
-0x2802100,0x962460,0x50001615,0x7c00100,0x230400,0x50002b01,0x2802020,0x962460,0x50002c00,0x4000000,0x200000,0x50002c19,0x7c00100,0x220400,0x50002d19,0x7c00100,
-0x220400,0x50003000,0x24000000,0x200000,0x50003000,0x24000020,0x200000,0x50003700,0x24000000,0x4200000,0x50005d00,0x7c00120,0x220405,0x50005d00,0x7c00120,0x250405,
-0x50006108,0x7c00100,0x220400,0x50006108,0x7c00100,0x250400,0x50006600,0x24000020,0x200000,0x50007300,0x24000000,0x200000,0x50008301,0x2802400,0x962460,0x50008a00,
-0x7c00500,0x230400,0x50009257,0x2802400,0x962460,0x50009257,0x4000000,0x200000,0x50009257,0x4000010,0x1071400,0x50009257,0x6800000,0x1329800,0x50009257,0x7c00100,
-0x230400,0x50009257,0x7c00500,0x230400,0x50009257,0x7c00900,0x230400,0x50009257,0xc000010,0xb48000,0x5000933e,0x2802100,0x962460,0x5000933e,0x2802400,0x962460,
-0x5000933e,0x4000000,0x200000,0x5000933e,0x4000000,0x400000,0x5000933e,0x4000010,0x400000,0x5000933e,0x6800000,0x1329800,0x5000933e,0x6800100,0x962540,0x5000933e,
-0x6800100,0x962541,0x5000933e,0x6804400,0x962540,0x5000933e,0x7c00100,0x230400,0x5000933e,0x7c00100,0x230401,0x5000933e,0xc000010,0x448000,0x50009419,0x7c00100,
-0x220400,0x50009419,0x7c00100,0x250400,0x50009500,0x4000400,0x200400,0x5000965a,0x4000000,0x500000,0x5000965a,0x7c00100,0x230400,0x5000965a,0xc000010,0xb48000,
-0x5000975b,0x4000000,0x200000,0x5000975b,0x4000010,0x400000,0x5000975b,0x7c00100,0x230400,0x50009865,0x7c00100,0x230400,0x50009965,0x4000010,0x400000,0x50009965,
-0x7c00100,0x230400,0x50409abf,0x4000000,0x200000,0x5100080e,0x7c00100,0x220400,0x5100080e,0x7c00100,0x250400,0x51000c02,0x2802100,0x962460,0x51000c02,0x4000000,
-0x1500000,0x51000c02,0x4000020,0x200000,0x51000c02,0x7c00100,0x230400,0x51000f0a,0x7c00100,0x230400,0x51000f0a,0x7c00500,0x230400,0x51001110,0x2802100,0x962460,
-0x5100131f,0x2802100,0x962460,0x51001423,0x7c00100,0x230400,0x51001524,0x2802100,0x962460,0x51001524,0x4000000,0x200000,0x51001524,0x7c00100,0x230400,0x5100171a,
-0x2802100,0x962460,0x5100171a,0x4000000,0x200000,0x5100171a,0x4000000,0x1500000,0x5100171a,0x7c00100,0x230400,0x51001b27,0x4000000,0x200000,0x51001b27,0x4000000,
-0x400000,0x51001b27,0x4000000,0x500000,0x51001b27,0x7c00100,0x230400,0x51001c1c,0x2802100,0x1862460,0x51001c1c,0x2802500,0x1862460,0x51001c1c,0x2806400,0x1862460,
-0x51001c1c,0x4000000,0x1800000,0x51001c1c,0x6800000,0x1329800,0x51001c1c,0x6800100,0x1862400,0x51001c1c,0x6800100,0x1862540,0x51001c1c,0x6800500,0x1862400,0x51001c1c,
-0x7c00100,0x1830000,0x5100251b,0x7c00100,0x230400,0x51002619,0x7c00100,0x220400,0x51002619,0x7c00100,0x250400,0x51002800,0x80020,0x218820,0x51002c00,0x4000000,
-0x200000,0x51002d19,0x7c00100,0x230400,0x51003700,0x24000000,0x4200000,0x51003700,0x24000000,0x4e00000,0x51005201,0x2802400,0x962460,0x51005c00,0x4000000,0x200000,
-0x51006108,0x7c00100,0x220400,0x51006108,0x7c00100,0x250400,0x51006600,0x24000020,0x200000,0x51006600,0x24000020,0x810000,0x51006600,0x24000020,0x1410000,0x51007300,
-0x24000000,0x200000,0x51007300,0x24000020,0x200000,0x51008002,0x7c00100,0x230400,0x51008301,0x2802000,0x962460,0x51008301,0x2802400,0x962460,0x51008a00,0x7c00500,
-0x230400,0x51008e00,0x24000000,0x200000,0x51008e00,0x24000000,0x400000,0x51008e00,0x24000000,0x810000,0x51008e00,0x24000000,0x1400000,0x51008e00,0x24000000,0x1410000,
-0x51008e00,0x24000000,0x1710000,0x51008e00,0x24000002,0x200000,0x51008e00,0x24000500,0x230400,0x51008e00,0x2c000010,0xb48000,0x51009419,0x7c00100,0x220400,0x51009419,
-0x7c00100,0x22040e,0x51009419,0x7c00100,0x22040f,0x51009419,0x7c00100,0x250400,0x51009500,0x4000400,0x200400,0x51009500,0x7c00500,0x230400,0x51009519,0x7c00100,
-0x220400,0x51009519,0x7c00100,0x22040f,0x51009519,0x7c00100,0x230400,0x51009519,0x7c00100,0x250400,0x51009b71,0x2802100,0x962460,0x51009b71,0x6800000,0x1329800,
-0x51009b71,0x6800100,0x962540,0x51009b71,0x6804400,0x962540,0x51009b71,0x7c00100,0x230400,0x51009c52,0x2802100,0x962460,0x51009c52,0x2802400,0x962460,0x51009c52,
-0x2802d00,0x962460,0x51009c52,0x4000010,0x400000,0x51009c52,0x6800000,0x1329800,0x51009c52,0x6800100,0x962540,0x51009c52,0x7c00100,0x230400,0x51009c52,0xc000010,
-0x448000,0x51009d6d,0x6800000,0x1329800,0x51009d6d,0x7c00100,0x230400,0x51009d6d,0x7c00500,0x230400,0x51009d6d,0x7c00d00,0x230400,0x51009d6d,0xc000010,0x448000,
-0x51009e08,0x2802100,0x962460,0x51009f63,0x4000010,0x400000,0x51009f63,0x6800000,0x1329800,0x51009f63,0x7c00100,0x230400,0x51009f63,0x7c00900,0x230400,0x51009f63,
-0xc000010,0x448000,0x51009f63,0xc000010,0xb48000,0x5100a008,0x2000,0x962460,0x5100a008,0x2802400,0x962460,0x5100a008,0x4000000,0x200000,0x5100a008,0x7c00100,
-0x220400,0x5100a008,0x7c00100,0x230400,0x5100a008,0x7c00100,0x250400,0x5100a008,0x7c00500,0x230400,0x5100a16f,0x2806400,0x962460,0x5100a16f,0x6800000,0x1329800,
-0x5100a16f,0x6800100,0x962540,0x5100a16f,0x7c00100,0x230400,0x5100a16f,0xc000010,0x448000,0x5100a24f,0x2802100,0x962460,0x5100a24f,0x2802400,0x962460,0x5100a24f,
-0x6800000,0x1329800,0x5100a24f,0x7c00100,0x230400,0x5100a24f,0xc000010,0x448000,0x5100a36e,0x2802100,0x962460,0x5100a36e,0x4000000,0x200000,0x5100a36e,0x6800100,
-0x962540,0x5100a36e,0x6804400,0x962540,0x5100a36e,0x7c00100,0x230400,0x5100a442,0x2802100,0x962460,0x5100a442,0x4000000,0x200000,0x5100a442,0x6800000,0x1329800,
-0x5100a442,0x6800100,0x962540,0x5100a442,0x7c00100,0x230400,0x5100a442,0xc000010,0x448000,0x5100a500,0x4000000,0x200000,0x5100a600,0x4000000,0x200000,0x5100a601,
-0x2802000,0x962460,0x5100a76b,0x7c00100,0x230400,0x5100a868,0x7c00100,0x230400,0x5100a96c,0x4000000,0x200000,0x5100a96c,0x7c00100,0x230400,0x5100aa00,0x4000000,
-0x4e00000,0x5100ab00,0x4000000,0x4e00000,0x51086600,0x24000020,0x810000,0x51086600,0x24000020,0x1410000,0x510a4005,0x7c00100,0xe30400,0x510a4711,0x7c40300,0xe30000,
-0x510a7300,0x24000000,0x34200000,0x510aaa00,0x4000000,0x34e00000,0x5140a2f3,0x4000400,0x400000,0x514a82bf,0x4000000,0xe00000,0x51802bb1,0x2802000,0x962460,0x51c00908,
-0x2802400,0x962460,0x51c0a008,0x2802400,0x962460,0x52000f0a,0x2802100,0x962460,0x52000f0a,0x6800100,0x962540,0x52000f0a,0x7c00100,0x230400,0x52001004,0x4000000,
-0x1600000,0x52001b00,0x4000000,0x200000,0x52001c1c,0x2802100,0x1862460,0x52001c1c,0x6800100,0x1862400,0x52001c1c,0x6800500,0x1862400,0x52001e12,0x7c00100,0x2230500,
-0x52001e12,0x7c00100,0x2330520,0x52002128,0x4000002,0x400000,0x52002128,0x7c00100,0x230400,0x52002a00,0x4000000,0x1500000,0x52002a00,0x4000000,0x1600000,0x52002d00,
-0x4000000,0x200006,0x52003000,0x24000000,0x200000,0x52006108,0x7c00100,0x220400,0x52006108,0x7c00100,0x250400,0x52008301,0x2802400,0x962460,0x52008407,0x2802400,
-0x962460,0x52008407,0x7c00100,0x220400,0x52008407,0x7c00100,0x250400,0x52008b3b,0x6800000,0x1800000,0x52008b3b,0x7c00100,0x1830000,0x52008e00,0x24000000,0x400000,
-0x52009419,0x7c00100,0x250400,0x5200975b,0x4000000,0x200000,0x5200ac7e,0x2802000,0x962460,0x5200ac7e,0x2802100,0x962460,0x5200ac7e,0x2802400,0x962460,0x5200ac7e,
-0x4000010,0x200000,0x5200ac7e,0x7c00100,0x230400,0x5200ac7e,0xc000010,0x248000,0x5200ad28,0x7c00100,0x230400,0x5200ae6a,0x2802100,0x1862460,0x5200ae6a,0x2802400,
-0x962460,0x5200ae6a,0x2802400,0x1862460,0x5200ae6a,0x2806000,0x1862460,0x5200ae6a,0x4000000,0x1800000,0x5200ae6a,0x6800000,0x1329800,0x5200ae6a,0x6800100,0x1862400,
-0x5200ae6a,0x6800100,0x1862540,0x5200ae6a,0x7c00100,0x1830000,0x5200ae6a,0x7c00900,0x1830000,0x5200ae6a,0xc000010,0x1848000,0x5200b083,0x4000010,0x400000,0x5200b083,
-0x7c00100,0x230400,0x5200b083,0xc000010,0x448000,0x5200b182,0x2802400,0x962460,0x5200b182,0x4000000,0x200000,0x5200b182,0x4000010,0x400000,0x5200b182,0x7c00100,
-0x230400,0x5200b182,0xc000010,0x448000,0x5200b30a,0x2802400,0x962460,0x5200b30a,0x4000000,0x200000,0x5200b30a,0x7c00100,0x230400,0x5200b54e,0x2802100,0x962460,
-0x5200b54e,0x2802400,0x962460,0x5200b54e,0x4000000,0x200000,0x5200b54e,0x4000010,0x400000,0x5200b54e,0x6800000,0x1329800,0x5200b54e,0x6800100,0x962540,0x5200b54e,
-0x6804400,0x962540,0x5200b54e,0x7c00100,0x230400,0x5200b54e,0xc000010,0x448000,0x5200b61c,0x4000000,0x1800000,0x5200b61c,0x6800500,0x1862400,0x5200b61c,0x7c00100,
-0x1830000,0x5200b61c,0x7c00900,0x1830000,0x5200b77f,0x2802100,0x1862460,0x5200b77f,0x2802400,0x1862460,0x5200b77f,0x4000000,0x1800000,0x5200b77f,0x4000010,0x1800000,
-0x5200b77f,0x7c00100,0x1830000,0x5200b77f,0x7c00500,0x1830000,0x5200b77f,0x7c00900,0x1830000,0x5200b77f,0x7e00100,0x1830000,0x5200b873,0x2802100,0x962460,0x5200b873,
-0x2806400,0x962460,0x5200b873,0x6800000,0x1329800,0x5200b873,0x6800100,0x962540,0x5200b873,0x6800400,0x962540,0x5200b873,0x7c00100,0x230400,0x5200b873,0xc000010,
-0x448000,0x5200b912,0x7c00100,0x2230500,0x5200b912,0x7c00100,0x2330520,0x5200ba74,0x4000000,0x200000,0x5200ba74,0x4000010,0x400000,0x5200ba74,0x7c00100,0x230400,
-0x5200bb85,0x4000000,0x200000,0x5200bb85,0x7c00100,0x230400,0x5200bc75,0x4000000,0x400000,0x5200bc75,0x4000010,0x400000,0x5200bc75,0x7c00100,0x230400,0x5200bd7d,
-0x4000000,0x200000,0x5200bd7d,0x7c00100,0x230400,0x5200be7a,0x4000000,0x200000,0x5200be7a,0x7c00100,0x230400,0x5200bf58,0x7c00100,0x230400,0x5200c002,0x4000000,
-0x200000,0x5200c178,0x2802000,0x962460,0x5200c178,0x2802100,0x962460,0x5200c178,0x2802400,0x962460,0x5200c178,0x2806400,0x962460,0x5200c178,0x4000000,0x200000,
-0x5200c178,0x6800100,0x962540,0x5200c178,0x7c00100,0x230400,0x5200c178,0x7c00100,0x230401,0x5200c178,0xc000010,0x448000,0x5200c178,0x80000000,0x218960,0x5200c247,
-0x7c00100,0x230400,0x5200c247,0x7c00100,0x830400,0x5200c247,0x7c00100,0x1430400,0x5200c300,0x4000000,0x200003,0x52022d00,0x4000000,0x100006,0x52023700,0x24000000,
-0x4100000,0x52023700,0x24000000,0x4e00000,0x52023700,0x24000000,0x14100000,0x52023700,0x24000000,0x14e00000,0x52023700,0x24000000,0x96800000,0x52024400,0x4000000,0x100000,
-0x52027300,0x24000000,0x100000,0x5202c300,0x4000000,0x100000,0x5202c300,0x4000000,0x100002,0x5202c300,0x4000000,0x100003,0x5202c300,0x4000000,0x10000d,0x5202c300,
-0x4000100,0x150400,0x5202c300,0x4000100,0x15040d,0x5202c300,0x4000100,0x14150400,0x520a1e12,0x7c00100,0x2130480,0x520a3700,0x24000000,0x34e00000,0x520a3800,0x24000000,
-0x34100000,0x520a4711,0x7c40300,0xe30000,0x520a4f11,0x7c00300,0xe30001,0x520a7300,0x24000000,0x34100000,0x520ab412,0x7c00100,0x2130480,0x520ac400,0x4000000,0xe00002,
-0x520ac400,0x4000000,0xe0000d,0x520ac400,0x4000000,0x34e0000d,0x520ac414,0x4000000,0xe0000d,0x520ac511,0x7c40300,0xe30000,0x5240af91,0x7c00100,0x230400,0x5240af96,
-0x4000400,0x200000,0x5240af98,0x6800400,0x962540,0x5240af98,0x7c00100,0x230400,0x5240afa2,0x7c00100,0x230400,0x5240afa4,0x7c00100,0x230400,0x5240b2c7,0x4000000,
-0x200000,0x5240b2c7,0x4000000,0x1500000,0x5240b2d2,0x4000000,0x200000,0x5240b2e0,0x4000000,0x200000,0x5240b5f6,0x7c00900,0x230400,0x524a44bf,0x4000000,0xe00003,
-0x5280af91,0x2802400,0x962460,0x5280af92,0x2802400,0x962460,0x5280af98,0x2802400,0x962460,0x5280af9a,0x2802400,0x962460,0x5280af9c,0x2802400,0x962460,0x52c0b3ed,
-0x2802400,0x962460,0x52c0b3f1,0x7c00100,0x230400,0x60000c02,0x2802100,0x962460,0x60000c02,0x7c00100,0x230400,0x60000f0a,0x2802100,0x962460,0x60000f0a,0x6800100,
-0x962540,0x60000f0a,0x7c00100,0x230400,0x6000131f,0x4000000,0x200000,0x6000171a,0x7c00100,0x230400,0x6000171a,0x7c00100,0x230560,0x60001b27,0x2802100,0x962460,
-0x60001b27,0x4000000,0xc00000,0x60001b27,0x7c00100,0x230400,0x60001f0b,0x2802400,0x962460,0x60002919,0x7c00100,0x22040e,0x60002a00,0x4000000,0x1600000,0x60003000,
-0x24000000,0x14200000,0x60003000,0x24000000,0x14e00000,0x60003700,0x24000000,0x4200000,0x60003800,0x24000000,0x1710000,0x60005102,0x4000000,0x200000,0x60006108,0x7c00100,
-0x220400,0x60006108,0x7c00100,0x250400,0x60006600,0x24000020,0x200000,0x60008301,0x2802000,0x962460,0x6000903c,0x2806000,0x962460,0x6000903c,0x4000000,0x400000,
-0x60009519,0x7c00100,0x220400,0x60009519,0x7c00100,0x250400,0x6000a008,0x7c00100,0x220400,0x6000a008,0x7c00100,0x250400,0x6000c300,0x4000000,0x3a703580,0x6000c654,
-0x2802000,0x962460,0x6000c654,0x4000010,0x200000,0x6000c654,0x7c00100,0x230400,0x6000c73f,0x2802000,0x962460,0x6000c73f,0x2802100,0x962460,0x6000c73f,0x4000000,
-0x200000,0x6000c73f,0x6800100,0x962540,0x6000c73f,0x6804000,0x962540,0x6000c73f,0x7c00100,0x230400,0x6000c80b,0x7c00100,0x230400,0x6000c941,0x2802100,0x962460,
-0x6000c941,0x2806000,0x962460,0x6000c941,0x4000000,0x200000,0x6000c941,0x4000010,0x200000,0x6000c941,0x6800000,0x1329800,0x6000c941,0x6800100,0x962540,0x6000c941,
-0x7c00100,0x230400,0x6000c941,0xc000010,0x448000,0x6000ca82,0x7c00100,0x230400,0x6000cc00,0x4000000,0x4e00000,0x6000d000,0x4000000,0x200000,0x6002c300,0x4000000,
-0x100000,0x6002c300,0x4000000,0x10000d,0x6002c300,0x4000100,0x150400,0x6002c300,0x4000100,0x15040d,0x6002c300,0x4000100,0x14150400,0x600a3000,0x24000000,0x34200000,
-0x600a3000,0x24000000,0x34e00000,0x600a3700,0x24000000,0x34200000,0x600a3800,0x24000000,0x34200000,0x600a3800,0x24000000,0xb6800000,0x600a4305,0x7c00100,0xe30400,0x600ac300,
-0x4000000,0x34100000,0x600ac400,0x4000000,0x14e0000d,0x600ac400,0x4000000,0x34e0000d,0x600acb14,0x7c00100,0xe30000,0x600acb16,0x7c00100,0xe30c00,0x600acc00,0x4000000,
-0x34e00000,0x600acd00,0x4000000,0x34200000,0x600acd00,0x4000000,0x34e00000,0x600acd00,0x4000000,0xb6800000,0x600ace00,0x4000000,0x34e00000,0x600ace00,0x4000000,0xb6800000,
-0x600acf00,0x4000000,0x34e00000,0x600acf00,0x4000000,0xb6800000,0x600ad111,0x7c40300,0xe30000,0x604ac4bf,0x4000000,0x34e00003,0x61000a03,0x4000000,0x1600000,0x61000c02,
-0x80000000,0x218960,0x6100120f,0x4000000,0x200000,0x61001a18,0x7c00100,0x1830000,0x61001d0c,0x7c00100,0x230400,0x61001d0c,0x7c00100,0x250400,0x61006600,0x24000020,
-0x200000,0x61008407,0x7c00100,0x220400,0x61008407,0x7c00100,0x250400,0x6100870c,0x7c00100,0x220400,0x61008e00,0x24000000,0x200000,0x61008e00,0x24000000,0x400000,
-0x61008e00,0x24000002,0x300000,0x6100903c,0x7c00100,0x230400,0x61009519,0x7c00100,0x220400,0x61009519,0x7c00100,0x250400,0x61009519,0x7c00500,0x22040f,0x61009b71,
-0x2802100,0x962460,0x61009b71,0x2806400,0x962460,0x61009b71,0x7c00100,0x230400,0x6100a008,0x2802100,0x962460,0x6100c300,0x4000000,0x20000f,0x6100cd00,0x4000000,
-0x200000,0x6100d202,0x2802400,0x962460,0x6100d202,0x2802500,0x962460,0x6100d202,0x7c00100,0x230400,0x6100d302,0x4000020,0x200000,0x6100d302,0x7c00120,0x230405,
-0x6100d476,0x2802100,0x962460,0x6100d476,0x2802100,0x962461,0x6100d476,0x2806400,0x962460,0x6100d476,0x4000000,0x400000,0x6100d476,0x6800000,0x1329800,0x6100d476,
-0x6800100,0x962540,0x6100d476,0x7c00100,0x230400,0x6100d476,0xc000010,0x448000,0x6100d573,0x2802100,0x962460,0x6100d573,0x2806400,0x962460,0x6100d573,0x6800100,
-0x962540,0x6100d573,0x7c00100,0x230400,0x6100d573,0x7c00900,0x230400,0x6100d573,0xc000010,0x448000,0x6100d68d,0x7c00100,0x230400,0x6100d756,0x7c00100,0x230400,
-0x6100d85c,0x2802500,0x962460,0x6100d85c,0x6800100,0x962540,0x6100d85c,0x7c00100,0x230400,0x6100d85c,0x7c00500,0x230400,0x6100d997,0x2802100,0x962460,0x6100d997,
-0x4000000,0x200000,0x6100d997,0x4000000,0x400000,0x6100d997,0x6800000,0x1329800,0x6100d997,0x6800100,0x962540,0x6100d997,0x6804400,0x962540,0x6100d997,0x7c00100,
-0x230400,0x6100d997,0x7c00100,0x230560,0x6100d997,0xc000010,0x448000,0x6100da98,0x6800000,0x1329800,0x6100da98,0x7c00100,0x230400,0x6100db71,0x4000000,0x200000,
-0x6100dc99,0x2802100,0x962460,0x6100dc99,0x2802400,0x962460,0x6100dc99,0x6800000,0x1329800,0x6100dc99,0x6800100,0x962540,0x6100dc99,0x6804400,0x962540,0x6100dc99,
-0x7c00100,0x230400,0x610a4711,0x7c40300,0xe30000,0x610a4f11,0x7c00300,0xe30001,0x610ace00,0x4000000,0x34e00000,0x6140af96,0x7c00100,0x230400,0x6140af98,0x7c00100,
-0x230400,0x6180af93,0x2802400,0x962460,0x62002a00,0x4000000,0x1600000,0x63002800,0x80000,0x918820,0x63c00c14,0x80000,0x918820,0x7000080e,0x7c00100,0x250400,
-0x70000a03,0x4000000,0x200000,0x70000c00,0x80000000,0x218960,0x70000f0a,0x7c00100,0x230400,0x70001004,0x7c00100,0x230400,0x70001524,0x2802100,0x962460,0x70001524,
-0x7c00100,0x230400,0x70001615,0x2802100,0x962460,0x7000171a,0x2802100,0x962460,0x70001821,0x6800000,0x1329800,0x70002320,0x7c00100,0x230400,0x70002a00,0x4000000,
-0x1500000,0x70002a00,0x4000000,0x1600000,0x70003000,0x24000000,0x200000,0x70003000,0x24000000,0x14200000,0x70003800,0x24000000,0x4e00000,0x70005201,0x2802400,0x962460,
-0x7000581e,0x7c00100,0x230400,0x70006108,0x7c00100,0x220400,0x70006108,0x7c00100,0x250400,0x70006f30,0x7c00100,0x230400,0x70007300,0x24000000,0x200000,0x70007f0e,
-0x4000000,0x200000,0x70008301,0x2802100,0x962460,0x70008301,0x2802400,0x962460,0x70008e00,0x24000000,0x200000,0x70008e00,0x24000000,0x400000,0x70008e00,0x24000002,
-0x400000,0x70008e00,0x24000008,0x1410000,0x70008e00,0x24000010,0x400000,0x70008e00,0x2c000010,0x448000,0x70009519,0x7c00100,0x220400,0x70009519,0x7c00100,0x230400,
-0x70009519,0x7c00100,0x250400,0x70009865,0x7c00100,0x230400,0x70009965,0x4000010,0x400000,0x70009965,0x7c00100,0x230400,0x7000a008,0x7c00100,0x220400,0x7000a008,
-0x7c00100,0x250400,0x7000a008,0x7c00500,0x22040f,0x7000a50e,0x4000000,0x200000,0x7000b61c,0x2802500,0x1862460,0x7000b61c,0x6800500,0x1862400,0x7000b61c,0x7c00100,
-0x1830000,0x7000c300,0x4000000,0x100000,0x7000c941,0x2806000,0x962460,0x7000cc00,0x4000000,0x4e00000,0x7000cd00,0x4000000,0x200000,0x7000cd00,0x4000000,0x4200000,
-0x7000cd00,0x4000000,0x4e00000,0x7000cd00,0x4000000,0x14200000,0x7000cd00,0x4000000,0x14e00000,0x7000cd00,0x4000000,0x96800000,0x7000cf00,0x4000000,0x4e00000,0x7000cf00,
-0x4000000,0x14e00000,0x7000d202,0x2802100,0x962460,0x7000d202,0x7c00100,0x230400,0x7000d997,0x7c00100,0x230400,0x7000d997,0xc000010,0x248000,0x7000dd86,0x2802400,
-0x962460,0x7000dd86,0x7c00100,0x230400,0x7000dd86,0xc000010,0x448000,0x7000de9f,0x4000000,0x200000,0x7000de9f,0x7c00100,0x230400,0x7000e001,0x2000,0x962460,
-0x7000e001,0x2802400,0x962460,0x7000e187,0x2802000,0x962460,0x7000e187,0x2802100,0x962460,0x7000e187,0x4000000,0x200000,0x7000e187,0x7c00100,0x230400,0x7000e187,
-0xc000010,0x448000,0x7000e288,0x7c00100,0x230400,0x7000e300,0x4000000,0x200000,0x7000e489,0x2802100,0x962460,0x7000e489,0x2802400,0x962460,0x7000e489,0x6800100,
-0x962540,0x7000e489,0x6800100,0x962541,0x7000e489,0x6804400,0x962540,0x7000e489,0x7c00100,0x230400,0x7000e489,0x7c00900,0x230400,0x7000e59d,0x2802100,0x962460,
-0x7000e59d,0x2802400,0x962460,0x7000e59d,0x4000000,0x200000,0x7000e59d,0x4000010,0x200000,0x7000e59d,0x6800100,0x962540,0x7000e59d,0x6804400,0x962540,0x7000e59d,
-0x7c00100,0x230400,0x7000e59d,0xc000010,0x448000,0x7000e691,0x2802100,0x962460,0x7000e691,0x2802400,0x962460,0x7000e691,0x2806400,0x962460,0x7000e691,0x6800000,
-0x1329800,0x7000e691,0x6800100,0x962540,0x7000e691,0x7c00100,0x230400,0x7000e700,0x4000400,0x200400,0x7000e70e,0x7c00100,0x220400,0x7000e719,0x7c00100,0x220400,
-0x7000e719,0x7c00500,0x22040f,0x7000e853,0x7c00100,0x230400,0x7000e9a0,0x2802400,0x962460,0x7000e9a0,0x4000000,0x200000,0x7000e9a0,0x4000000,0x500000,0x7000e9a0,
-0x7c00100,0x230400,0x7000ea79,0x2802400,0x962460,0x7000ea79,0x4000000,0x200000,0x7000ea79,0x4000000,0xf00000,0x7000ea79,0x4000010,0x400000,0x7000ea79,0x7c00100,
-0x230400,0x7000eb8c,0x2802400,0x962460,0x7000eb8c,0x4000000,0x200000,0x7000eb8c,0x7c00100,0x230400,0x7000eca3,0x2802100,0x962460,0x7000eca3,0x2806400,0x962460,
-0x7000eca3,0x4000000,0x200000,0x7000eca3,0x6800000,0x1329800,0x7000eca3,0x6800100,0x962540,0x7000eca3,0x7c00100,0x230400,0x7000eca3,0xc000010,0x448000,0x7000ed95,
-0x6800000,0x1329800,0x7000ed95,0x7c00100,0x230400,0x7000ed95,0xc000010,0x448000,0x7000ee1c,0x2802500,0x1862460,0x7000ee1c,0x6800000,0x1329800,0x7000ee1c,0x7c00100,
-0x1830000,0x7000ee1c,0x7c00900,0x1830000,0x7000ef8f,0x4000000,0x200000,0x7000ef8f,0x7c00100,0x230400,0x7000f08e,0x4000000,0x200000,0x7000f08e,0x7c00100,0x230400,
-0x7000f159,0x2802100,0x962460,0x7000f159,0x7c00100,0x230400,0x7000f200,0x4000000,0x200000,0x7000f200,0x4000000,0x1200000,0x7000f200,0x4000000,0x1710000,0x7000f34b,
-0x2802400,0x962460,0x7000f34b,0x4000000,0x200000,0x7000f34b,0x4000010,0x400000,0x7000f34b,0x6800000,0x1329800,0x7000f34b,0x7c00100,0x230400,0x7000f34b,0x7c00900,
-0x230400,0x7000f34b,0xc000010,0x448000,0x7000f490,0x4000000,0x200000,0x7000f490,0x7c00100,0x230400,0x7000f5a5,0x7c00100,0x230400,0x7000f67b,0x4000000,0x200000,
-0x7000f67b,0x4000010,0x200000,0x7000f67b,0x7c00100,0x230400,0x7000f8a6,0x2802100,0x962460,0x7000f8a6,0x2802400,0x962460,0x7000f8a6,0x2806400,0x962460,0x7000f8a6,
-0x4000000,0x500000,0x7000f8a6,0x4000010,0xb00000,0x7000f8a6,0x4000800,0x200000,0x7000f8a6,0x6800100,0x962540,0x7000f8a6,0x6800100,0x962541,0x7000f8a6,0x7c00100,
-0x230400,0x7000f8a6,0xc000010,0x448000,0x7000f921,0x4000000,0x200000,0x7000fa00,0x4000000,0x200000,0x7000fb9e,0x2802100,0x962460,0x7000fb9e,0x2802400,0x962460,
-0x7000fb9e,0x2806400,0x962460,0x7000fb9e,0x4000000,0x200000,0x7000fb9e,0x6800000,0x1329800,0x7000fb9e,0x6800100,0x962540,0x7000fb9e,0x6800100,0x962541,0x7000fb9e,
-0x7c00100,0x230400,0x7000fc92,0x4000000,0x200000,0x7000fc92,0x6800000,0x1329800,0x7000fc92,0x7c00100,0x220400,0x7000fc92,0x7c00100,0x230400,0x7000fc92,0x7c00100,
-0x250400,0x700acd00,0x4000000,0x34e00000,0x700acd00,0x4000000,0xb6800000,0x700ace00,0x4000000,0x34e00000,0x700acf00,0x4000000,0x34e00000,0x700acf00,0x4000000,0xb6800000,
-0x7050df01,0x4000000,0x200000,0x7050f705,0x80000,0x918820,0x7080af96,0x2802400,0x962460,0x7090df01,0x2802400,0x962460,0x70d0e403,0x2802100,0x962460,0x70d0e403,
-0x2802400,0x962460,0x70d0e403,0x6800100,0x962540,0x8000120f,0x7c00100,0x230400,0x80001524,0x7c00100,0x230400,0x8000171a,0x7c00100,0x230400,0x80002006,0x7c00100,
-0x220400,0x80002006,0x7c00100,0x250400,0x80002a00,0x4000000,0x1500000,0x80002d00,0x4000000,0x200000,0x80005208,0x2802400,0x962460,0x80005c00,0x4000000,0x200000,
-0x80007300,0x24000000,0x200000,0x80009519,0x7c00100,0x220400,0x80009519,0x7c00100,0x230400,0x80009519,0x7c00100,0x250400,0x80009865,0x7c00100,0x230400,0x8000a008,
-0x2802100,0x962460,0x8000b30a,0x4000000,0x500000,0x8000b30a,0x7c00100,0x230400,0x8000cd00,0x4000000,0x4e00000,0x8000d202,0x2802500,0x962460,0x8000d202,0x7c00100,
-0x230400,0x8000d68d,0x4000000,0x200000,0x8000d997,0x2802000,0x962460,0x8000d997,0x2802400,0x962460,0x8000d997,0x4000000,0x400000,0x8000d997,0x4000000,0x500000,
-0x8000d997,0x7c00100,0x230400,0x8000d997,0xc000010,0x448000,0x8000e489,0x2802100,0x962460,0x8000e489,0x7c00100,0x230400,0x8000e719,0x7c00100,0x220400,0x8000f8a6,
-0x2802100,0x962460,0x8000f8a6,0x7c00100,0x230400,0x8000f8a6,0xc000010,0x448000,0x8000fda1,0x2802100,0x1862460,0x8000fda1,0x2806400,0x1862460,0x8000fda1,0x4000000,
-0x1800000,0x8000fda1,0x6800000,0x1329800,0x8000fda1,0x6800100,0x1862540,0x8000fda1,0x7c00100,0x1830000,0x8000fda1,0xc000010,0x448000,0x8000fe9c,0x7c00100,0x230400,
-0x8000fe9c,0x7c00100,0x830400,0x8000fe9c,0x7c00100,0x1430400,0x8000ff06,0x7c00100,0x220400,0x80010165,0x7c00100,0x230400,0x800102a2,0x4000000,0x200000,0x800102a2,
-0x7c00100,0x230400,0x800103a4,0x7c00100,0x230400,0x800103a4,0xc000010,0x448000,0x8001044c,0x4000000,0x200000,0x8001044c,0x7c00100,0x220400,0x8001044c,0x7c00100,
-0x250400,0x80010670,0x2802000,0x962460,0x80010670,0x4000000,0x200000,0x80010670,0x4000010,0x400000,0x80010670,0xc000010,0x448000,0x800a4711,0x7c40300,0xe30000,
-0x800acd00,0x4000000,0x34e00000,0x800acd00,0x4000000,0x7a902460,0x800ace00,0x4000000,0x34e00000,0x800acf00,0x4000000,0x34e00000,0x800b0011,0x7c40300,0xe30000,0x800b0500,
-0x4000000,0x34e00000,0x800b0500,0x4000000,0xb6800000,0x90001615,0x7c00100,0x230400,0x9000171a,0x4000000,0x200000,0x9000171a,0x7c00100,0x230400,0x90003000,0x24000000,
-0x200000,0x90007f0e,0x4000000,0x200000,0x90008301,0x2802000,0x962460,0x90008e00,0x24000000,0x400000,0x90009519,0x7c00100,0x250400,0x9000a16f,0x2802100,0x962460,
-0x9000d200,0x80000000,0x218960,0x9000d202,0x2802000,0x962460,0x9000d202,0x2802100,0x962460,0x9000d202,0x7c00100,0x230400,0x9000e59d,0x2802100,0x962460,0x90010500,
-0x4000000,0xe00000,0x900107a7,0x2802100,0x962460,0x900107a7,0x2802400,0x962460,0x900107a7,0x2802c00,0x962460,0x900107a7,0x4000000,0x1400000,0x900107a7,0x6800000,
-0x1329800,0x900107a7,0x7c00100,0x220400,0x900107a7,0x7c00100,0x250400,0x900108a8,0x2802100,0x962460,0x900108a8,0x2806400,0x962460,0x900108a8,0x4000000,0x200000,
-0x900108a8,0x4000000,0x400000,0x900108a8,0x4000010,0x400000,0x900108a8,0x6800000,0x1329800,0x900108a8,0x6800100,0x962540,0x900108a8,0x7c00100,0x230400,0x900108a8,
-0xc000010,0x448000,0x90010908,0x7c00100,0x220400,0x90010a38,0x2802100,0x962460,0x90010ca9,0x2802100,0x962460,0x90010ca9,0x4000000,0x500000,0x90010ca9,0x4000010,
-0xb00000,0x90010ca9,0x6800100,0x962540,0x90010ca9,0x7c00100,0x230400,0x90010d1b,0x4000000,0x500000,0x90010eaa,0x2802100,0x962460,0x90010eaa,0x2802400,0x962460,
-0x90010eaa,0x2806400,0x962460,0x90010eaa,0x4000000,0x200000,0x90010eaa,0x4000000,0x400000,0x90010eaa,0x4000010,0x400000,0x90010eaa,0x6800000,0x1329800,0x90010eaa,
-0x6800100,0x962540,0x90010eaa,0x7c00100,0x230400,0x90010eaa,0xc000010,0x448000,0x90010fab,0x7c00100,0x220400,0x90010fab,0x7c00100,0x250400,0x9002c300,0x4000000,
-0x100000,0x900ac400,0x4000000,0xe0000d,0x900acd00,0x4000000,0x34e00000,0x900acd00,0x4000000,0xb6800000,0x900acf00,0x4000000,0x34e00000,0x900b0500,0x4000000,0x34e00000,
-0x900b0500,0x4000000,0xb6800000,0x900b0b9a,0x7c00900,0x1230400,0x900b109a,0x7c00300,0xe30000,0x900b119a,0x7c00300,0xe30000,0x90408e06,0x24000000,0x400000,0xa0001004,
-0x4000000,0x200000,0xa0001004,0x7c00100,0x230400,0xa000120f,0x2802100,0x962460,0xa000120f,0x2802400,0x962460,0xa000171a,0x2802100,0x962460,0xa000171a,0x2806400,
-0x962460,0xa0002a00,0x4000000,0x1600000,0xa0003000,0x24000000,0x200000,0xa000581e,0x7c00100,0x230400,0xa0007300,0x24000000,0x200000,0xa0008301,0x2802400,0x962460,
-0xa0008e00,0x24000000,0x400000,0xa000cf00,0x4000000,0x4e00000,0xa0010500,0x4000000,0x200000,0xa00114af,0x2802100,0x962460,0xa00114af,0x2802400,0x962460,0xa00114af,
-0x2806400,0x962460,0xa00114af,0x6800000,0x1329800,0xa00114af,0x7c00100,0x230400,0xa00114af,0x7c00100,0x230560,0xa00116b0,0x2802100,0x962460,0xa00116b0,0x2802800,
-0x962460,0xa00116b0,0x2806400,0x962460,0xa00116b0,0x4000000,0x400000,0xa00116b0,0x4000000,0x500000,0xa00116b0,0x4000010,0x400000,0xa00116b0,0x6800100,0x962540,
-0xa00116b0,0x7c00100,0x230400,0xa00116b0,0x7c00100,0x230560,0xa00116b0,0xc000010,0x448000,0xa0011722,0x7c00100,0x230400,0xa00118b1,0x2802000,0x962460,0xa00118b1,
-0x2802100,0x962460,0xa00118b1,0x2806400,0x962460,0xa00118b1,0x4000000,0x200000,0xa00118b1,0x4000000,0x400000,0xa00118b1,0x4000000,0x500000,0xa00118b1,0x6800100,
-0x962540,0xa00118b1,0x7c00100,0x230400,0xa00118b1,0x7c00100,0x230560,0xa00118b1,0xc000010,0x448000,0xa00a4005,0x7c00100,0xe30400,0xa00a4711,0x7c40300,0xe30000,
-0xa00ac400,0x4000000,0x4e00000,0xa00acb14,0x7c00100,0xe30000,0xa00acf00,0x4000000,0x34e00000,0xa00b0500,0x4000000,0x34e00000,0xa00b0500,0x4000000,0xb6800000,0xa00b0b96,
-0x7c00900,0x1230400,0xa00b1211,0x7c40300,0xe30000,0xa00b1314,0x7c00100,0xe30000,0xa00b1596,0x7c00300,0xe30000,0xa040afac,0x6800400,0x962540,0xa08083ad,0x2802400,
-0x962460,0xb0000a03,0x7c00100,0x220400,0xb0000b13,0x7c00100,0x2633800,0xb0001004,0x2802000,0x962460,0xb0001110,0x4000000,0x200000,0xb0001524,0x2802000,0x962460,
-0xb0001615,0x4000000,0x500000,0xb000251b,0x7c00100,0x230400,0xb0007300,0x24000000,0x200000,0xb0008939,0x4000000,0x200000,0xb0008939,0x7c00100,0x230400,0xb0008e00,
-0x24000000,0x200000,0xb0008e00,0x24000000,0x400000,0xb0008e00,0x24000010,0x400000,0xb0009257,0x2802000,0x962460,0xb0009257,0x4000000,0x1600000,0xb0009519,0x7c00100,
-0x220400,0xb0009519,0x7c00100,0x250400,0xb0009a00,0x4000000,0x200000,0xb000b30a,0x2802100,0x962460,0xb000b30a,0x7c00100,0x230400,0xb000c178,0x80000000,0x218960,
-0xb000c300,0x4000000,0x4200000,0xb000d202,0x2802000,0x962460,0xb000d476,0x6800100,0x962540,0xb000d476,0x7c00100,0x230400,0xb000e300,0x4000000,0x4e00000,0xb000fda1,
-0x7c00100,0x1830000,0xb0010eaa,0x2802000,0x962460,0xb00116b0,0x7c00100,0x230400,0xb0011900,0x4000000,0x4e00000,0xb0011ab2,0x2802100,0x962460,0xb0011ab2,0x2802400,
-0x962460,0xb0011ab2,0x2806400,0x962460,0xb0011ab2,0x4000000,0x200000,0xb0011ab2,0x6800100,0x962540,0xb0011ab2,0x7c00100,0x230400,0xb0011b0c,0x7c00100,0x230400,
-0xb0011cb3,0x2802100,0x962460,0xb0011cb3,0x2806400,0x962460,0xb0011cb3,0x6800000,0x1329800,0xb0011cb3,0x6800100,0x962540,0xb0011cb3,0x7c00100,0x230400,0xb0011db6,
-0x2802500,0x962460,0xb0011db6,0x6800000,0x1329800,0xb0011db6,0x7c00100,0x230400,0xb0011db6,0x7c00500,0x230400,0xb0011e00,0x4000000,0x200000,0xb0011e00,0x4000000,
-0x1500000,0xb0011fb4,0x2802100,0x962460,0xb0011fb4,0x6800100,0x962540,0xb0011fb4,0x7c00100,0x230400,0xb0011fb4,0xc000010,0x248000,0xb0012000,0x4000000,0x200000,
-0xb00121b5,0x4000000,0x200000,0xb00121b5,0x4000010,0x400000,0xb00121b5,0x7c00100,0x220400,0xb00121b5,0x7c00100,0x250400,0xb00121b5,0xc000010,0x448000,0xb00122b8,
-0x4000000,0x200000,0xb00122b8,0x7c00100,0x230400,0xb00123b7,0x2802400,0x962460,0xb00123b7,0x4000000,0x200000,0xb00123b7,0x7c00100,0x230400,0xb00123b7,0xc000010,
-0x248000,0xb00a4005,0x7c00100,0xe30400,0xb00a4711,0x7c40300,0xe30000,0xb00acf00,0x4000000,0x34e00000,0xb00b0500,0x4000000,0x34e00000,0xb00b0500,0x4000000,0x3ce00000,
-0xb00b0500,0x4000000,0xb6800000,0xb00b109a,0x7c00300,0xe30000,0xb080e47c,0x2802000,0x962460,0xc0001524,0x4000000,0x500000,0xc0001a18,0x2806400,0x1862460,0xc0001a18,
-0x7c00100,0x1830000,0xc0007300,0x24000000,0x200000,0xc0008e00,0x24000010,0x400000,0xc0009519,0x7c00100,0x220400,0xc0009519,0x7c00100,0x250400,0xc000c300,0x4000000,
-0x420000f,0xc000d85c,0x2802100,0x962460,0xc000d85c,0x6800100,0x962540,0xc000d85c,0x7c00100,0x230400,0xc000dc99,0x7c00100,0x230400,0xc000e719,0x7c00100,0x220400,
-0xc00107a7,0x7c00100,0x230400,0xc0010eaa,0x7c00100,0x230400,0xc00116b0,0x7c00100,0x230560,0xc0011900,0x4000000,0x4200000,0xc0012447,0,0x818820,0xc0012447,
-0,0xc18820,0xc0012447,0,0x1418820,0xc00125b9,0x7c00100,0x230400,0xc00126bb,0x2802100,0x962460,0xc00126bb,0x2806400,0x962460,0xc00126bb,0x4000000,
-0x500000,0xc00126bb,0x6800100,0x962540,0xc00126bb,0x7c00100,0x230400,0xc00127ba,0x2802400,0x962460,0xc00127ba,0x4000000,0x200000,0xc00127ba,0x6800000,0x1329800,
-0xc00127ba,0x7c00100,0x230400,0xc00127ba,0x7c00900,0x230400,0xc0012800,0x4000000,0x200000,0xc0012b23,0x4000000,0x200000,0xc0012b23,0x4000000,0x400000,0xc0012b23,
-0x4000000,0x1500000,0xc0012cbc,0x2802400,0x962460,0xc0012cbc,0x4000000,0x1600000,0xc0012cbc,0x6800000,0x1329800,0xc0012cbc,0x7c00100,0x230400,0xc00acf00,0x4000000,
-0x34e00000,0xc00ae300,0x4000000,0x34e00000,0xc00b0500,0x4000000,0x34e00000,0xc00b0500,0x4000000,0xb6800000,0xc00b0b00,0x4000000,0x1200000,0xc00b0b00,0x7c00900,0x1230400,
-0xc00b109a,0x7c00300,0xe30000,0xc00b2914,0x7c00100,0x2530000,0xc00b2916,0x7c00100,0x2530c00,0xc00b2a00,0x4000000,0x34e00000,0xc040af53,0x7c00100,0x230400,0xc0c12b7e,
-0x4000000,0x200000,0xc14a44bf,0x4000000,0xe0000d,0xd000131f,0x2802c00,0x962460,0xd000171a,0x7c00100,0x230400,0xd0001821,0x2802100,0x962460,0xd0007300,0x24000000,
-0x200000,0xd0008e00,0x24000000,0x200000,0xd0008f3a,0x2806000,0x962460,0xd0009519,0x7c00100,0x220400,0xd0009519,0x7c00100,0x250400,0xd000a500,0x4000000,0x200000,
-0xd000c300,0x4000000,0x4e00000,0xd000d202,0x7c00100,0x230400,0xd000d476,0x7c00100,0x230400,0xd000d997,0x2802100,0x962460,0xd000d997,0x6800100,0x962540,0xd000e001,
-0x2802100,0x962460,0xd000e700,0x4000400,0x200000,0xd000e719,0x7c00100,0x220400,0xd000e719,0x7c00500,0x23040f,0xd000fa00,0x4000000,0x4e00000,0xd0010eaa,0x4000010,
-0x400000,0xd0010eaa,0x7c00100,0x230400,0xd0012dbd,0x4000000,0x200000,0xd0012dbd,0x7c00100,0x230400,0xd0012fbe,0x2802100,0x962460,0xd0012fbe,0x2802400,0x962460,
-0xd0012fbe,0x2806400,0x962460,0xd0012fbe,0x4000000,0x400000,0xd0012fbe,0x6800000,0x1329800,0xd0012fbe,0x6800100,0x962540,0xd0012fbe,0x6800100,0x962541,0xd0012fbe,
-0x6804400,0x962540,0xd0012fbe,0x7c00100,0x230400,0xd0012fbe,0x7c00100,0x230560,0xd0012fbe,0xc000010,0x448000,0xd0013183,0x7c00100,0x230400,0xd0013200,0x4000000,
-0x200000,0xd0013200,0x6800000,0x1329805,0xd00134c0,0x2802100,0x962460,0xd00134c0,0x4000002,0x400000,0xd00134c0,0x7c00100,0x230400,0xd00a4305,0x7c00100,0xe30400,
-0xd00a4611,0x7c40300,0xe30000,0xd00a4711,0x7c40300,0xe30000,0xd00a5e11,0x7c40300,0xe30000,0xd00acf00,0x4000000,0x34e00000,0xd00b0500,0x4000000,0x34e00000,0xd00b0500,
-0x4000000,0xb6800000,0xd00b0b11,0x6800500,0x962540,0xd00b0bbf,0x2802200,0xc62460,0xd00b119a,0x7c00300,0xe30000,0xd00b2a00,0x4000000,0x34e00000,0xd00b2e11,0x7c40300,
-0xe30000,0xd00b30bf,0x7c00300,0x230000,0xd00b339a,0x7c00300,0xe30000};
+0x24000020,0x14200000,0x32003700,0x24000000,0x200000,0x32003700,0x24000000,0x4100000,0x32003700,0x24000000,0x4200000,0x32003700,0x24000000,0x14200000,0x32003800,0x24000000,
+0x810000,0x32003800,0x24000000,0x1410000,0x32005102,0x4000000,0x1500008,0x32005502,0x7c00100,0x230400,0x32006108,0x7c00100,0x220400,0x32006108,0x7c00100,0x250400,
+0x3200622a,0x2802100,0x962460,0x3200622a,0x2806000,0x962460,0x3200622a,0x7c00100,0x230400,0x3200632b,0x2802100,0x962460,0x3200632b,0x2806000,0x962460,0x3200632b,
+0x7c00100,0x230400,0x3200642c,0x2802100,0x962460,0x3200642c,0x7c00100,0x230400,0x3200652d,0x2802100,0x962460,0x3200652d,0x7c00100,0x230400,0x32006600,0x24000020,
+0x200000,0x32006700,0x24000020,0x200000,0x32006800,0x24000020,0x200000,0x32006800,0x24000020,0x14200000,0x32006900,0x24000020,0x200000,0x32006900,0x24000020,0x810000,
+0x32006900,0x24000020,0x1410000,0x32006a00,0x24000020,0x200000,0x32006a00,0x24000020,0x200001,0x32006a00,0x24000020,0x200002,0x32020701,0x2882000,0xc62460,0x32023300,
+0x4000000,0x100000,0x32026c01,0x12882000,0x962460,0x32026c01,0x12882000,0x8962460,0x32065700,0x4000000,0x810011,0x32065700,0x4000000,0x1410011,0x32086600,0x24000020,
+0x810000,0x32086600,0x24000020,0x1410000,0x32086900,0x24000020,0x810000,0x32086900,0x24000020,0x1410000,0x320a3600,0x24000020,0x34200000,0x320a3d11,0x7c00100,0x1230400,
+0x320a3e14,0x7c00100,0xe30010,0x320a3e14,0x7c00100,0x2530000,0x320a3f16,0x7c00100,0xe30c10,0x320a4400,0x4000000,0xe00003,0x320a4929,0x4000000,0xe00000,0x320a4f11,
+0x7c00300,0xe30001,0x320a6b16,0x7c00100,0x2530c00,0x3240638b,0xc000010,0x448000,0x324a3dc2,0x4000000,0x14e00000,0x324a3dc2,0x7c00100,0x1230400,0x324a3fbd,0x4000002,
+0x1200c00,0x324a53ba,0x24000000,0xe00000,0x32820701,0x2802000,0x962460,0x40000419,0x7c00100,0x220400,0x40000519,0x7c00100,0x220400,0x40000600,0x4000400,0x200400,
+0x4000080e,0x7c00100,0x220400,0x4000080e,0x7c00100,0x250400,0x4000080e,0x7c00100,0x250402,0x40000c02,0x2802100,0x962460,0x40000c02,0x2802400,0x962460,0x40000c02,
+0x2802500,0x962460,0x40000c02,0x4000000,0x200000,0x40000c02,0x4000000,0x1071400,0x40000c02,0x7c00100,0x230400,0x40000c02,0x80000000,0x218960,0x40000d22,0x7c00100,
+0x230400,0x40000f0a,0x7c00100,0x230400,0x40001004,0x7c00100,0x230400,0x40001110,0x2802100,0x962460,0x40001110,0x6800100,0x962540,0x4000120f,0x2802100,0x962460,
+0x4000120f,0x4000000,0x1600000,0x4000120f,0x7c00100,0x230400,0x4000131f,0x7c00100,0x230400,0x40001423,0x4000000,0x200000,0x40001423,0x4000000,0x1600000,0x40001615,
+0x2802400,0x962460,0x40001615,0x7c00100,0x230400,0x40002417,0x2802400,0x1862460,0x40002417,0x4000000,0x200000,0x40002800,0x6800000,0x201c00,0x40002800,0x24000002,
+0x200000,0x40002c00,0x4000000,0x200002,0x40003000,0x24000000,0x14200000,0x40003000,0x24000020,0x200000,0x40003700,0x24000000,0x200000,0x40003700,0x24000000,0x4200000,
+0x40003700,0x24000000,0x14200000,0x40005a09,0x7c00100,0x220400,0x40005a09,0x7c00100,0x250400,0x40005d00,0x7c00120,0x220405,0x40006f30,0x2802100,0x962460,0x40006f30,
+0x2802400,0x962460,0x40006f30,0x4000000,0x200000,0x40006f30,0x6800000,0x1329800,0x40006f30,0x6800100,0x962540,0x40006f30,0x7c00100,0x230400,0x40006f30,0xc000010,
+0xb48000,0x40007034,0x7c00100,0x1830000,0x40007117,0x4000000,0x200000,0x40007208,0x7c00100,0x220400,0x4000720e,0x7c00100,0x220400,0x4000720e,0x7c00500,0x22040e,
+0x4000720e,0x7c00500,0x22040f,0x40007219,0x7c00100,0x220400,0x40007219,0x7c00500,0x220400,0x40007219,0x7c00500,0x22040e,0x40007219,0x7c00500,0x22040f,0x40007300,
+0x24000000,0x200000,0x40007300,0x24000000,0x14200000,0x40007400,0x4000000,0x200000,0x40007531,0x7c00100,0x230400,0x40007631,0x7c00100,0x230400,0x40007835,0x4000010,
+0x400000,0x40007835,0x7c00100,0x230400,0x40007933,0x7c00100,0x230400,0x40007a32,0x6800000,0x1329800,0x40007a32,0x7c00100,0x230400,0x40007b2f,0x7c00100,0x230400,
+0x40007c00,0x4000000,0x200000,0x40020701,0x2802400,0x962460,0x40020701,0x2802400,0xc62460,0x40023300,0x4000000,0x200000,0x40027d01,0x12882000,0x962460,0x400a3700,
+0x24000000,0x34200000,0x400a3700,0x24000000,0x34e00000,0x400a4400,0x4000000,0xe0000d,0x400a4412,0x4000000,0xe00002,0x400a4412,0x4000000,0xe00003,0x400a4500,0x4000000,
+0xe0000d,0x400a5300,0x4000000,0x810010,0x400a5300,0x4000000,0x1410010,0x404077fc,0x4000000,0x200000,0x404077ff,0x4000000,0x200000,0x404077ff,0x4000000,0x400000,
+0x40c0147e,0x4000000,0x200000,0x40c051fa,0x4000000,0x200000,0x41000419,0x7c00100,0x220400,0x41000419,0x7c00100,0x250400,0x4100080e,0x7c00100,0x220400,0x4100080e,
+0x7c00100,0x250400,0x41000908,0x7c00100,0x220400,0x41000908,0x7c00100,0x250400,0x41000b13,0x2802000,0x962460,0x41000b13,0x2802100,0x962460,0x41000b13,0x4000000,
+0xb00000,0x41000c02,0x2802100,0x962460,0x41000c02,0x4000000,0x1500000,0x41000c02,0xc000010,0xb48000,0x41000f0a,0x7c00100,0x230400,0x41001004,0x7c00100,0x230400,
+0x41001423,0x7c00100,0x230400,0x41001b27,0x4000000,0x500000,0x41001d0c,0x7c00100,0x230400,0x41001d0c,0x7c00100,0x23040f,0x41001f0b,0x2802400,0x962460,0x41001f0b,
+0x4000000,0x200000,0x41001f0b,0x7c00100,0x230400,0x41002800,0x24000000,0x200000,0x41002800,0x24000000,0x400000,0x41002919,0x7c00100,0x22040e,0x41002a00,0x4000000,
+0x1600000,0x41002b01,0x2802020,0x962460,0x41002c00,0x4000000,0x200000,0x41002c00,0x7c00120,0x220405,0x41003000,0x24000000,0x200000,0x41003700,0x24000000,0x4200000,
+0x41003700,0x24000000,0x14200000,0x41003700,0x24000000,0x14e00000,0x41005d00,0x7c00120,0x220405,0x41006600,0x24000020,0x200000,0x41006600,0x24000020,0x810000,0x41006600,
+0x24000020,0x1410000,0x41007208,0x7c00100,0x22040f,0x41007219,0x7c00100,0x220400,0x41007300,0x24000000,0x200000,0x41007e0e,0x2802000,0x962460,0x41007e0e,0x4000000,
+0x200000,0x41007f0e,0x4000000,0x200000,0x41007f0e,0x7c00100,0x230400,0x41008002,0x7c00100,0x230400,0x41008137,0x2802100,0x962460,0x41008137,0x4000000,0x200000,
+0x41008137,0x6800100,0x962540,0x41008137,0x7c00100,0x230400,0x41008301,0x2802000,0x962460,0x41008407,0x4000000,0x200000,0x41008407,0x4000000,0x400000,0x41008407,
+0x4000000,0xb00000,0x41008407,0x7c00100,0x220400,0x41008407,0x7c00100,0x250400,0x4100850b,0x7c00100,0x230400,0x4100860b,0x4000000,0x200000,0x4100860b,0x7c00100,
+0x230400,0x4100870c,0x7c00100,0x220400,0x41008838,0x7c00100,0x220400,0x41008838,0x7c00100,0x250400,0x41008939,0x2802000,0x962460,0x41008939,0x2802100,0x962460,
+0x41008939,0x2806000,0x962460,0x41008939,0x4000000,0x200000,0x41008939,0x4000000,0x400000,0x41008939,0x7c00100,0x230400,0x41008939,0xc000010,0x448000,0x41008a00,
+0x4000400,0x200400,0x41008b3b,0x4000000,0x1800000,0x41008b3b,0x6800000,0x1329800,0x41008b3b,0x7c00100,0x1830000,0x41008b3b,0x7e00100,0x1830000,0x41008c3d,0x4000010,
+0x400000,0x41008c3d,0x7c00100,0x230400,0x41008d0e,0x7c00100,0x22040f,0x41008d19,0x7c00100,0x220400,0x41008d19,0x7c00100,0x22040f,0x41008e00,0x24000000,0x200000,
+0x41008e00,0x24000000,0x400000,0x41008e00,0x24000000,0x1710000,0x41008e00,0x24000006,0x400000,0x41008f3a,0x2802100,0x962460,0x41008f3a,0x2806000,0x962460,0x41008f3a,
+0x4000000,0x200000,0x41008f3a,0x6800100,0x962540,0x41008f3a,0x7c00100,0x230400,0x4100903c,0x7c00100,0x230400,0x4100903c,0x7c00100,0x23040f,0x41020701,0x2802000,
+0x962460,0x41020701,0x2802000,0xc62460,0x410a3700,0x24000000,0x34200000,0x410a3700,0x24000000,0x34e00000,0x410a4412,0x4000000,0xe00003,0x410a4711,0x7c40300,0xe30000,
+0x410a4f11,0x7c00300,0xe30001,0x410a9100,0x4000000,0x800010,0x410a9100,0x4000000,0x810010,0x410a9100,0x4000000,0x870010,0x410a9100,0x4000000,0xb00010,0x410a9100,
+0x4000000,0xf00010,0x410a9100,0x4000000,0x1001410,0x410a9100,0x4000000,0x1071010,0x410a9100,0x4000000,0x1071410,0x410a9100,0x4000000,0x1410010,0x41408ac5,0x4000400,
+0x200000,0x414a82bf,0x4000000,0xe00000,0x41808300,0x2802000,0x962460,0x41c0147e,0x6800000,0x1329800,0x50000419,0x7c00100,0x220400,0x50000419,0x7c00100,0x250400,
+0x5000080e,0x7c00100,0x220400,0x50000908,0x7c00100,0x220400,0x50000908,0x7c00100,0x250400,0x50000b13,0x2802500,0x962460,0x50000f0a,0x7c00100,0x230400,0x50001615,
+0x2802100,0x962460,0x50001615,0x7c00100,0x230400,0x50002b01,0x2802020,0x962460,0x50002c00,0x4000000,0x200000,0x50002c19,0x7c00100,0x220400,0x50002d19,0x7c00100,
+0x220400,0x50003000,0x24000000,0x200000,0x50003000,0x24000020,0x200000,0x50003700,0x24000000,0x4200000,0x50005d00,0x7c00120,0x220405,0x50005d00,0x7c00120,0x250405,
+0x50006108,0x7c00100,0x220400,0x50006108,0x7c00100,0x250400,0x50006600,0x24000020,0x200000,0x50007300,0x24000000,0x200000,0x50008301,0x2802400,0x962460,0x50008a00,
+0x7c00500,0x230400,0x50009257,0x2802400,0x962460,0x50009257,0x4000000,0x200000,0x50009257,0x4000010,0x1071400,0x50009257,0x6800000,0x1329800,0x50009257,0x7c00100,
+0x230400,0x50009257,0x7c00500,0x230400,0x50009257,0x7c00900,0x230400,0x50009257,0xc000010,0xb48000,0x5000933e,0x2802100,0x962460,0x5000933e,0x2802400,0x962460,
+0x5000933e,0x4000000,0x200000,0x5000933e,0x4000000,0x400000,0x5000933e,0x4000010,0x400000,0x5000933e,0x6800000,0x1329800,0x5000933e,0x6800100,0x962540,0x5000933e,
+0x6800100,0x962541,0x5000933e,0x6804400,0x962540,0x5000933e,0x7c00100,0x230400,0x5000933e,0x7c00100,0x230401,0x5000933e,0xc000010,0x448000,0x50009419,0x7c00100,
+0x220400,0x50009419,0x7c00100,0x250400,0x50009500,0x4000400,0x200400,0x5000965a,0x4000000,0x500000,0x5000965a,0x7c00100,0x230400,0x5000965a,0xc000010,0xb48000,
+0x5000975b,0x4000000,0x200000,0x5000975b,0x4000010,0x400000,0x5000975b,0x7c00100,0x230400,0x50009865,0x7c00100,0x230400,0x50009965,0x4000010,0x400000,0x50009965,
+0x7c00100,0x230400,0x50409abf,0x4000000,0x200000,0x5100080e,0x7c00100,0x220400,0x5100080e,0x7c00100,0x250400,0x51000c02,0x2802100,0x962460,0x51000c02,0x4000000,
+0x1500000,0x51000c02,0x4000020,0x200000,0x51000c02,0x7c00100,0x230400,0x51000f0a,0x7c00100,0x230400,0x51000f0a,0x7c00500,0x230400,0x51001110,0x2802100,0x962460,
+0x5100131f,0x2802100,0x962460,0x51001423,0x7c00100,0x230400,0x51001524,0x2802100,0x962460,0x51001524,0x4000000,0x200000,0x51001524,0x7c00100,0x230400,0x5100171a,
+0x2802100,0x962460,0x5100171a,0x4000000,0x200000,0x5100171a,0x4000000,0x1500000,0x5100171a,0x7c00100,0x230400,0x51001b27,0x4000000,0x200000,0x51001b27,0x4000000,
+0x400000,0x51001b27,0x4000000,0x500000,0x51001b27,0x7c00100,0x230400,0x51001c1c,0x2802100,0x1862460,0x51001c1c,0x2802500,0x1862460,0x51001c1c,0x2806400,0x1862460,
+0x51001c1c,0x4000000,0x1800000,0x51001c1c,0x6800000,0x1329800,0x51001c1c,0x6800100,0x1862400,0x51001c1c,0x6800100,0x1862540,0x51001c1c,0x6800500,0x1862400,0x51001c1c,
+0x7c00100,0x1830000,0x5100251b,0x7c00100,0x230400,0x51002619,0x7c00100,0x220400,0x51002619,0x7c00100,0x250400,0x51002800,0x80020,0x218820,0x51002c00,0x4000000,
+0x200000,0x51002d19,0x7c00100,0x230400,0x51003700,0x24000000,0x4200000,0x51003700,0x24000000,0x4e00000,0x51005201,0x2802400,0x962460,0x51005c00,0x4000000,0x200000,
+0x51006108,0x7c00100,0x220400,0x51006108,0x7c00100,0x250400,0x51006600,0x24000020,0x200000,0x51006600,0x24000020,0x810000,0x51006600,0x24000020,0x1410000,0x51007300,
+0x24000000,0x200000,0x51007300,0x24000020,0x200000,0x51008002,0x7c00100,0x230400,0x51008301,0x2802000,0x962460,0x51008301,0x2802400,0x962460,0x51008a00,0x7c00500,
+0x230400,0x51008e00,0x24000000,0x200000,0x51008e00,0x24000000,0x400000,0x51008e00,0x24000000,0x810000,0x51008e00,0x24000000,0x1400000,0x51008e00,0x24000000,0x1410000,
+0x51008e00,0x24000000,0x1710000,0x51008e00,0x24000002,0x200000,0x51008e00,0x24000500,0x230400,0x51008e00,0x2c000010,0xb48000,0x51009419,0x7c00100,0x220400,0x51009419,
+0x7c00100,0x22040e,0x51009419,0x7c00100,0x22040f,0x51009419,0x7c00100,0x250400,0x51009500,0x4000400,0x200400,0x51009500,0x7c00500,0x230400,0x51009519,0x7c00100,
+0x220400,0x51009519,0x7c00100,0x22040f,0x51009519,0x7c00100,0x230400,0x51009519,0x7c00100,0x250400,0x51009b71,0x2802100,0x962460,0x51009b71,0x6800000,0x1329800,
+0x51009b71,0x6800100,0x962540,0x51009b71,0x6804400,0x962540,0x51009b71,0x7c00100,0x230400,0x51009c52,0x2802100,0x962460,0x51009c52,0x2802400,0x962460,0x51009c52,
+0x2802d00,0x962460,0x51009c52,0x4000010,0x400000,0x51009c52,0x6800000,0x1329800,0x51009c52,0x6800100,0x962540,0x51009c52,0x7c00100,0x230400,0x51009c52,0xc000010,
+0x448000,0x51009d6d,0x6800000,0x1329800,0x51009d6d,0x7c00100,0x230400,0x51009d6d,0x7c00500,0x230400,0x51009d6d,0x7c00d00,0x230400,0x51009d6d,0xc000010,0x448000,
+0x51009e08,0x2802100,0x962460,0x51009f63,0x4000010,0x400000,0x51009f63,0x6800000,0x1329800,0x51009f63,0x7c00100,0x230400,0x51009f63,0x7c00900,0x230400,0x51009f63,
+0xc000010,0x448000,0x51009f63,0xc000010,0xb48000,0x5100a008,0x2000,0x962460,0x5100a008,0x2802400,0x962460,0x5100a008,0x4000000,0x200000,0x5100a008,0x7c00100,
+0x220400,0x5100a008,0x7c00100,0x230400,0x5100a008,0x7c00100,0x250400,0x5100a008,0x7c00500,0x230400,0x5100a16f,0x2806400,0x962460,0x5100a16f,0x6800000,0x1329800,
+0x5100a16f,0x6800100,0x962540,0x5100a16f,0x7c00100,0x230400,0x5100a16f,0xc000010,0x448000,0x5100a24f,0x2802100,0x962460,0x5100a24f,0x2802400,0x962460,0x5100a24f,
+0x6800000,0x1329800,0x5100a24f,0x7c00100,0x230400,0x5100a24f,0xc000010,0x448000,0x5100a36e,0x2802100,0x962460,0x5100a36e,0x4000000,0x200000,0x5100a36e,0x6800100,
+0x962540,0x5100a36e,0x6804400,0x962540,0x5100a36e,0x7c00100,0x230400,0x5100a442,0x2802100,0x962460,0x5100a442,0x4000000,0x200000,0x5100a442,0x6800000,0x1329800,
+0x5100a442,0x6800100,0x962540,0x5100a442,0x7c00100,0x230400,0x5100a442,0xc000010,0x448000,0x5100a500,0x4000000,0x200000,0x5100a600,0x4000000,0x200000,0x5100a601,
+0x2802000,0x962460,0x5100a76b,0x7c00100,0x230400,0x5100a868,0x7c00100,0x230400,0x5100a96c,0x4000000,0x200000,0x5100a96c,0x7c00100,0x230400,0x5100aa00,0x4000000,
+0x4e00000,0x5100ab00,0x4000000,0x4e00000,0x51086600,0x24000020,0x810000,0x51086600,0x24000020,0x1410000,0x510a4005,0x7c00100,0xe30400,0x510a4711,0x7c40300,0xe30000,
+0x510a7300,0x24000000,0x34200000,0x510aaa00,0x4000000,0x34e00000,0x5140a2f3,0x4000400,0x400000,0x514a82bf,0x4000000,0xe00000,0x51802bb1,0x2802000,0x962460,0x51c00908,
+0x2802400,0x962460,0x51c0a008,0x2802400,0x962460,0x52000f0a,0x2802100,0x962460,0x52000f0a,0x6800100,0x962540,0x52000f0a,0x7c00100,0x230400,0x52001004,0x4000000,
+0x1600000,0x52001b00,0x4000000,0x200000,0x52001c1c,0x2802100,0x1862460,0x52001c1c,0x6800100,0x1862400,0x52001c1c,0x6800500,0x1862400,0x52001e12,0x7c00100,0x2230500,
+0x52001e12,0x7c00100,0x2330520,0x52002128,0x4000002,0x400000,0x52002128,0x7c00100,0x230400,0x52002a00,0x4000000,0x1500000,0x52002a00,0x4000000,0x1600000,0x52002d00,
+0x4000000,0x200006,0x52003000,0x24000000,0x200000,0x52006108,0x7c00100,0x220400,0x52006108,0x7c00100,0x250400,0x52008301,0x2802400,0x962460,0x52008407,0x2802400,
+0x962460,0x52008407,0x7c00100,0x220400,0x52008407,0x7c00100,0x250400,0x52008b3b,0x6800000,0x1800000,0x52008b3b,0x7c00100,0x1830000,0x52008e00,0x24000000,0x400000,
+0x52009419,0x7c00100,0x250400,0x5200975b,0x4000000,0x200000,0x5200ac7e,0x2802000,0x962460,0x5200ac7e,0x2802100,0x962460,0x5200ac7e,0x2802400,0x962460,0x5200ac7e,
+0x4000010,0x200000,0x5200ac7e,0x7c00100,0x230400,0x5200ac7e,0xc000010,0x248000,0x5200ad28,0x7c00100,0x230400,0x5200ae6a,0x2802100,0x1862460,0x5200ae6a,0x2802400,
+0x962460,0x5200ae6a,0x2802400,0x1862460,0x5200ae6a,0x2806000,0x1862460,0x5200ae6a,0x4000000,0x1800000,0x5200ae6a,0x6800000,0x1329800,0x5200ae6a,0x6800100,0x1862400,
+0x5200ae6a,0x6800100,0x1862540,0x5200ae6a,0x7c00100,0x1830000,0x5200ae6a,0x7c00900,0x1830000,0x5200ae6a,0xc000010,0x1848000,0x5200b083,0x4000010,0x400000,0x5200b083,
+0x7c00100,0x230400,0x5200b083,0xc000010,0x448000,0x5200b182,0x2802400,0x962460,0x5200b182,0x4000000,0x200000,0x5200b182,0x4000010,0x400000,0x5200b182,0x7c00100,
+0x230400,0x5200b182,0xc000010,0x448000,0x5200b30a,0x2802400,0x962460,0x5200b30a,0x4000000,0x200000,0x5200b30a,0x7c00100,0x230400,0x5200b54e,0x2802100,0x962460,
+0x5200b54e,0x2802400,0x962460,0x5200b54e,0x4000000,0x200000,0x5200b54e,0x4000010,0x400000,0x5200b54e,0x6800000,0x1329800,0x5200b54e,0x6800100,0x962540,0x5200b54e,
+0x6804400,0x962540,0x5200b54e,0x7c00100,0x230400,0x5200b54e,0xc000010,0x448000,0x5200b61c,0x4000000,0x1800000,0x5200b61c,0x6800500,0x1862400,0x5200b61c,0x7c00100,
+0x1830000,0x5200b61c,0x7c00900,0x1830000,0x5200b77f,0x2802100,0x1862460,0x5200b77f,0x2802400,0x1862460,0x5200b77f,0x4000000,0x1800000,0x5200b77f,0x4000010,0x1800000,
+0x5200b77f,0x7c00100,0x1830000,0x5200b77f,0x7c00500,0x1830000,0x5200b77f,0x7c00900,0x1830000,0x5200b77f,0x7e00100,0x1830000,0x5200b873,0x2802100,0x962460,0x5200b873,
+0x2806400,0x962460,0x5200b873,0x6800000,0x1329800,0x5200b873,0x6800100,0x962540,0x5200b873,0x6800400,0x962540,0x5200b873,0x7c00100,0x230400,0x5200b873,0xc000010,
+0x448000,0x5200b912,0x7c00100,0x2230500,0x5200b912,0x7c00100,0x2330520,0x5200ba74,0x4000000,0x200000,0x5200ba74,0x4000010,0x400000,0x5200ba74,0x7c00100,0x230400,
+0x5200bb85,0x4000000,0x200000,0x5200bb85,0x7c00100,0x230400,0x5200bc75,0x4000000,0x400000,0x5200bc75,0x4000010,0x400000,0x5200bc75,0x7c00100,0x230400,0x5200bd7d,
+0x4000000,0x200000,0x5200bd7d,0x7c00100,0x230400,0x5200be7a,0x4000000,0x200000,0x5200be7a,0x7c00100,0x230400,0x5200bf58,0x7c00100,0x230400,0x5200c002,0x4000000,
+0x200000,0x5200c178,0x2802000,0x962460,0x5200c178,0x2802100,0x962460,0x5200c178,0x2802400,0x962460,0x5200c178,0x2806400,0x962460,0x5200c178,0x4000000,0x200000,
+0x5200c178,0x6800100,0x962540,0x5200c178,0x7c00100,0x230400,0x5200c178,0x7c00100,0x230401,0x5200c178,0xc000010,0x448000,0x5200c178,0x80000000,0x218960,0x5200c247,
+0x7c00100,0x230400,0x5200c247,0x7c00100,0x830400,0x5200c247,0x7c00100,0x1430400,0x5200c300,0x4000000,0x200003,0x52022d00,0x4000000,0x100006,0x52023700,0x24000000,
+0x4100000,0x52023700,0x24000000,0x4e00000,0x52023700,0x24000000,0x14100000,0x52023700,0x24000000,0x14e00000,0x52023700,0x24000000,0x96800000,0x52024400,0x4000000,0x100000,
+0x52027300,0x24000000,0x100000,0x5202c300,0x4000000,0x100000,0x5202c300,0x4000000,0x100002,0x5202c300,0x4000000,0x100003,0x5202c300,0x4000000,0x10000d,0x5202c300,
+0x4000100,0x150400,0x5202c300,0x4000100,0x15040d,0x5202c300,0x4000100,0x14150400,0x520a1e12,0x7c00100,0x2130480,0x520a3700,0x24000000,0x34e00000,0x520a3800,0x24000000,
+0x34100000,0x520a4711,0x7c40300,0xe30000,0x520a4f11,0x7c00300,0xe30001,0x520a7300,0x24000000,0x34100000,0x520ab412,0x7c00100,0x2130480,0x520ac400,0x4000000,0xe00002,
+0x520ac400,0x4000000,0xe0000d,0x520ac400,0x4000000,0x34e0000d,0x520ac414,0x4000000,0xe0000d,0x520ac511,0x7c40300,0xe30000,0x5240af91,0x7c00100,0x230400,0x5240af96,
+0x4000400,0x200000,0x5240af98,0x6800400,0x962540,0x5240af98,0x7c00100,0x230400,0x5240afa2,0x7c00100,0x230400,0x5240afa4,0x7c00100,0x230400,0x5240b2c7,0x4000000,
+0x200000,0x5240b2c7,0x4000000,0x1500000,0x5240b2d2,0x4000000,0x200000,0x5240b2e0,0x4000000,0x200000,0x5240b5f6,0x7c00900,0x230400,0x524a44bf,0x4000000,0xe00003,
+0x5280af91,0x2802400,0x962460,0x5280af92,0x2802400,0x962460,0x5280af98,0x2802400,0x962460,0x5280af9a,0x2802400,0x962460,0x5280af9c,0x2802400,0x962460,0x52c0b3ed,
+0x2802400,0x962460,0x52c0b3f1,0x7c00100,0x230400,0x60000c02,0x2802100,0x962460,0x60000c02,0x7c00100,0x230400,0x60000f0a,0x2802100,0x962460,0x60000f0a,0x6800100,
+0x962540,0x60000f0a,0x7c00100,0x230400,0x6000131f,0x4000000,0x200000,0x6000171a,0x7c00100,0x230400,0x6000171a,0x7c00100,0x230560,0x60001b27,0x2802100,0x962460,
+0x60001b27,0x4000000,0xc00000,0x60001b27,0x7c00100,0x230400,0x60001f0b,0x2802400,0x962460,0x60002919,0x7c00100,0x22040e,0x60002a00,0x4000000,0x1600000,0x60003000,
+0x24000000,0x14200000,0x60003000,0x24000000,0x14e00000,0x60003700,0x24000000,0x4200000,0x60003800,0x24000000,0x1710000,0x60005102,0x4000000,0x200000,0x60006108,0x7c00100,
+0x220400,0x60006108,0x7c00100,0x250400,0x60006600,0x24000020,0x200000,0x60008301,0x2802000,0x962460,0x6000903c,0x2806000,0x962460,0x6000903c,0x4000000,0x400000,
+0x60009519,0x7c00100,0x220400,0x60009519,0x7c00100,0x250400,0x6000a008,0x7c00100,0x220400,0x6000a008,0x7c00100,0x250400,0x6000c300,0x4000000,0x3a703580,0x6000c654,
+0x2802000,0x962460,0x6000c654,0x4000010,0x200000,0x6000c654,0x7c00100,0x230400,0x6000c73f,0x2802000,0x962460,0x6000c73f,0x2802100,0x962460,0x6000c73f,0x4000000,
+0x200000,0x6000c73f,0x6800100,0x962540,0x6000c73f,0x6804000,0x962540,0x6000c73f,0x7c00100,0x230400,0x6000c80b,0x7c00100,0x230400,0x6000c941,0x2802100,0x962460,
+0x6000c941,0x2806000,0x962460,0x6000c941,0x4000000,0x200000,0x6000c941,0x4000010,0x200000,0x6000c941,0x6800000,0x1329800,0x6000c941,0x6800100,0x962540,0x6000c941,
+0x7c00100,0x230400,0x6000c941,0xc000010,0x448000,0x6000ca82,0x7c00100,0x230400,0x6000cc00,0x4000000,0x4e00000,0x6000d000,0x4000000,0x200000,0x6002c300,0x4000000,
+0x100000,0x6002c300,0x4000000,0x10000d,0x6002c300,0x4000100,0x150400,0x6002c300,0x4000100,0x15040d,0x6002c300,0x4000100,0x14150400,0x600a3000,0x24000000,0x34200000,
+0x600a3000,0x24000000,0x34e00000,0x600a3700,0x24000000,0x34200000,0x600a3800,0x24000000,0x34200000,0x600a3800,0x24000000,0xb6800000,0x600a4305,0x7c00100,0xe30400,0x600ac300,
+0x4000000,0x34100000,0x600ac400,0x4000000,0x14e0000d,0x600ac400,0x4000000,0x34e0000d,0x600acb14,0x7c00100,0xe30000,0x600acb16,0x7c00100,0xe30c00,0x600acc00,0x4000000,
+0x34e00000,0x600acd00,0x4000000,0x34200000,0x600acd00,0x4000000,0x34e00000,0x600acd00,0x4000000,0xb6800000,0x600ace00,0x4000000,0x34e00000,0x600ace00,0x4000000,0xb6800000,
+0x600acf00,0x4000000,0x34e00000,0x600acf00,0x4000000,0xb6800000,0x600ad111,0x7c40300,0xe30000,0x604ac4bf,0x4000000,0x34e00003,0x61000a03,0x4000000,0x1600000,0x61000c02,
+0x80000000,0x218960,0x6100120f,0x4000000,0x200000,0x61001a18,0x7c00100,0x1830000,0x61001d0c,0x7c00100,0x230400,0x61001d0c,0x7c00100,0x250400,0x61006600,0x24000020,
+0x200000,0x61008407,0x7c00100,0x220400,0x61008407,0x7c00100,0x250400,0x6100870c,0x7c00100,0x220400,0x61008e00,0x24000000,0x200000,0x61008e00,0x24000000,0x400000,
+0x61008e00,0x24000002,0x300000,0x6100903c,0x7c00100,0x230400,0x61009519,0x7c00100,0x220400,0x61009519,0x7c00100,0x250400,0x61009519,0x7c00500,0x22040f,0x61009b71,
+0x2802100,0x962460,0x61009b71,0x2806400,0x962460,0x61009b71,0x7c00100,0x230400,0x6100a008,0x2802100,0x962460,0x6100c300,0x4000000,0x20000f,0x6100cd00,0x4000000,
+0x200000,0x6100d202,0x2802400,0x962460,0x6100d202,0x2802500,0x962460,0x6100d202,0x7c00100,0x230400,0x6100d302,0x4000020,0x200000,0x6100d302,0x7c00120,0x230405,
+0x6100d476,0x2802100,0x962460,0x6100d476,0x2802100,0x962461,0x6100d476,0x2806400,0x962460,0x6100d476,0x4000000,0x400000,0x6100d476,0x6800000,0x1329800,0x6100d476,
+0x6800100,0x962540,0x6100d476,0x7c00100,0x230400,0x6100d476,0xc000010,0x448000,0x6100d573,0x2802100,0x962460,0x6100d573,0x2806400,0x962460,0x6100d573,0x6800100,
+0x962540,0x6100d573,0x7c00100,0x230400,0x6100d573,0x7c00900,0x230400,0x6100d573,0xc000010,0x448000,0x6100d68d,0x7c00100,0x230400,0x6100d756,0x7c00100,0x230400,
+0x6100d85c,0x2802500,0x962460,0x6100d85c,0x6800100,0x962540,0x6100d85c,0x7c00100,0x230400,0x6100d85c,0x7c00500,0x230400,0x6100d997,0x2802100,0x962460,0x6100d997,
+0x4000000,0x200000,0x6100d997,0x4000000,0x400000,0x6100d997,0x6800000,0x1329800,0x6100d997,0x6800100,0x962540,0x6100d997,0x6804400,0x962540,0x6100d997,0x7c00100,
+0x230400,0x6100d997,0x7c00100,0x230560,0x6100d997,0xc000010,0x448000,0x6100da98,0x6800000,0x1329800,0x6100da98,0x7c00100,0x230400,0x6100db71,0x4000000,0x200000,
+0x6100dc99,0x2802100,0x962460,0x6100dc99,0x2802400,0x962460,0x6100dc99,0x6800000,0x1329800,0x6100dc99,0x6800100,0x962540,0x6100dc99,0x6804400,0x962540,0x6100dc99,
+0x7c00100,0x230400,0x610a4711,0x7c40300,0xe30000,0x610a4f11,0x7c00300,0xe30001,0x610ace00,0x4000000,0x34e00000,0x6140af96,0x7c00100,0x230400,0x6140af98,0x7c00100,
+0x230400,0x6180af93,0x2802400,0x962460,0x62002a00,0x4000000,0x1600000,0x63002800,0x80000,0x918820,0x63c00c14,0x80000,0x918820,0x7000080e,0x7c00100,0x250400,
+0x70000a03,0x4000000,0x200000,0x70000c00,0x80000000,0x218960,0x70000f0a,0x7c00100,0x230400,0x70001004,0x7c00100,0x230400,0x70001524,0x2802100,0x962460,0x70001524,
+0x7c00100,0x230400,0x70001615,0x2802100,0x962460,0x7000171a,0x2802100,0x962460,0x70001821,0x6800000,0x1329800,0x70002320,0x7c00100,0x230400,0x70002a00,0x4000000,
+0x1500000,0x70002a00,0x4000000,0x1600000,0x70003000,0x24000000,0x200000,0x70003000,0x24000000,0x14200000,0x70003800,0x24000000,0x4e00000,0x70005201,0x2802400,0x962460,
+0x7000581e,0x7c00100,0x230400,0x70006108,0x7c00100,0x220400,0x70006108,0x7c00100,0x250400,0x70006f30,0x7c00100,0x230400,0x70007300,0x24000000,0x200000,0x70007f0e,
+0x4000000,0x200000,0x70008301,0x2802100,0x962460,0x70008301,0x2802400,0x962460,0x70008e00,0x24000000,0x200000,0x70008e00,0x24000000,0x400000,0x70008e00,0x24000002,
+0x400000,0x70008e00,0x24000008,0x1410000,0x70008e00,0x24000010,0x400000,0x70008e00,0x2c000010,0x448000,0x70009519,0x7c00100,0x220400,0x70009519,0x7c00100,0x230400,
+0x70009519,0x7c00100,0x250400,0x70009865,0x7c00100,0x230400,0x70009965,0x4000010,0x400000,0x70009965,0x7c00100,0x230400,0x7000a008,0x7c00100,0x220400,0x7000a008,
+0x7c00100,0x250400,0x7000a008,0x7c00500,0x22040f,0x7000a50e,0x4000000,0x200000,0x7000b61c,0x2802500,0x1862460,0x7000b61c,0x6800500,0x1862400,0x7000b61c,0x7c00100,
+0x1830000,0x7000c300,0x4000000,0x100000,0x7000c941,0x2806000,0x962460,0x7000cc00,0x4000000,0x4e00000,0x7000cd00,0x4000000,0x200000,0x7000cd00,0x4000000,0x4200000,
+0x7000cd00,0x4000000,0x4e00000,0x7000cd00,0x4000000,0x14200000,0x7000cd00,0x4000000,0x14e00000,0x7000cd00,0x4000000,0x96800000,0x7000cf00,0x4000000,0x4e00000,0x7000cf00,
+0x4000000,0x14e00000,0x7000d202,0x2802100,0x962460,0x7000d202,0x7c00100,0x230400,0x7000d997,0x7c00100,0x230400,0x7000d997,0xc000010,0x248000,0x7000dd86,0x2802400,
+0x962460,0x7000dd86,0x7c00100,0x230400,0x7000dd86,0xc000010,0x448000,0x7000de9f,0x4000000,0x200000,0x7000de9f,0x7c00100,0x230400,0x7000e001,0x2000,0x962460,
+0x7000e001,0x2802400,0x962460,0x7000e187,0x2802000,0x962460,0x7000e187,0x2802100,0x962460,0x7000e187,0x4000000,0x200000,0x7000e187,0x7c00100,0x230400,0x7000e187,
+0xc000010,0x448000,0x7000e288,0x7c00100,0x230400,0x7000e300,0x4000000,0x200000,0x7000e489,0x2802100,0x962460,0x7000e489,0x2802400,0x962460,0x7000e489,0x6800100,
+0x962540,0x7000e489,0x6800100,0x962541,0x7000e489,0x6804400,0x962540,0x7000e489,0x7c00100,0x230400,0x7000e489,0x7c00900,0x230400,0x7000e59d,0x2802100,0x962460,
+0x7000e59d,0x2802400,0x962460,0x7000e59d,0x4000000,0x200000,0x7000e59d,0x4000010,0x200000,0x7000e59d,0x6800100,0x962540,0x7000e59d,0x6804400,0x962540,0x7000e59d,
+0x7c00100,0x230400,0x7000e59d,0xc000010,0x448000,0x7000e691,0x2802100,0x962460,0x7000e691,0x2802400,0x962460,0x7000e691,0x2806400,0x962460,0x7000e691,0x6800000,
+0x1329800,0x7000e691,0x6800100,0x962540,0x7000e691,0x7c00100,0x230400,0x7000e700,0x4000400,0x200400,0x7000e70e,0x7c00100,0x220400,0x7000e719,0x7c00100,0x220400,
+0x7000e719,0x7c00500,0x22040f,0x7000e853,0x7c00100,0x230400,0x7000e9a0,0x2802400,0x962460,0x7000e9a0,0x4000000,0x200000,0x7000e9a0,0x4000000,0x500000,0x7000e9a0,
+0x7c00100,0x230400,0x7000ea79,0x2802400,0x962460,0x7000ea79,0x4000000,0x200000,0x7000ea79,0x4000000,0xf00000,0x7000ea79,0x4000010,0x400000,0x7000ea79,0x7c00100,
+0x230400,0x7000eb8c,0x2802400,0x962460,0x7000eb8c,0x4000000,0x200000,0x7000eb8c,0x7c00100,0x230400,0x7000eca3,0x2802100,0x962460,0x7000eca3,0x2806400,0x962460,
+0x7000eca3,0x4000000,0x200000,0x7000eca3,0x6800000,0x1329800,0x7000eca3,0x6800100,0x962540,0x7000eca3,0x7c00100,0x230400,0x7000eca3,0xc000010,0x448000,0x7000ed95,
+0x6800000,0x1329800,0x7000ed95,0x7c00100,0x230400,0x7000ed95,0xc000010,0x448000,0x7000ee1c,0x2802500,0x1862460,0x7000ee1c,0x6800000,0x1329800,0x7000ee1c,0x7c00100,
+0x1830000,0x7000ee1c,0x7c00900,0x1830000,0x7000ef8f,0x4000000,0x200000,0x7000ef8f,0x7c00100,0x230400,0x7000f08e,0x4000000,0x200000,0x7000f08e,0x7c00100,0x230400,
+0x7000f159,0x2802100,0x962460,0x7000f159,0x7c00100,0x230400,0x7000f200,0x4000000,0x200000,0x7000f200,0x4000000,0x1200000,0x7000f200,0x4000000,0x1710000,0x7000f34b,
+0x2802400,0x962460,0x7000f34b,0x4000000,0x200000,0x7000f34b,0x4000010,0x400000,0x7000f34b,0x6800000,0x1329800,0x7000f34b,0x7c00100,0x230400,0x7000f34b,0x7c00900,
+0x230400,0x7000f34b,0xc000010,0x448000,0x7000f490,0x4000000,0x200000,0x7000f490,0x7c00100,0x230400,0x7000f5a5,0x7c00100,0x230400,0x7000f67b,0x4000000,0x200000,
+0x7000f67b,0x4000010,0x200000,0x7000f67b,0x7c00100,0x230400,0x7000f8a6,0x2802100,0x962460,0x7000f8a6,0x2802400,0x962460,0x7000f8a6,0x2806400,0x962460,0x7000f8a6,
+0x4000000,0x500000,0x7000f8a6,0x4000010,0xb00000,0x7000f8a6,0x4000800,0x200000,0x7000f8a6,0x6800100,0x962540,0x7000f8a6,0x6800100,0x962541,0x7000f8a6,0x7c00100,
+0x230400,0x7000f8a6,0xc000010,0x448000,0x7000f921,0x4000000,0x200000,0x7000fa00,0x4000000,0x200000,0x7000fb9e,0x2802100,0x962460,0x7000fb9e,0x2802400,0x962460,
+0x7000fb9e,0x2806400,0x962460,0x7000fb9e,0x4000000,0x200000,0x7000fb9e,0x6800000,0x1329800,0x7000fb9e,0x6800100,0x962540,0x7000fb9e,0x6800100,0x962541,0x7000fb9e,
+0x7c00100,0x230400,0x7000fc92,0x4000000,0x200000,0x7000fc92,0x6800000,0x1329800,0x7000fc92,0x7c00100,0x220400,0x7000fc92,0x7c00100,0x230400,0x7000fc92,0x7c00100,
+0x250400,0x700acd00,0x4000000,0x34e00000,0x700acd00,0x4000000,0xb6800000,0x700ace00,0x4000000,0x34e00000,0x700acf00,0x4000000,0x34e00000,0x700acf00,0x4000000,0xb6800000,
+0x7050df01,0x4000000,0x200000,0x7050f705,0x80000,0x918820,0x7080af96,0x2802400,0x962460,0x7090df01,0x2802400,0x962460,0x70d0e403,0x2802100,0x962460,0x70d0e403,
+0x2802400,0x962460,0x70d0e403,0x6800100,0x962540,0x8000120f,0x7c00100,0x230400,0x80001524,0x7c00100,0x230400,0x8000171a,0x7c00100,0x230400,0x80002006,0x7c00100,
+0x220400,0x80002006,0x7c00100,0x250400,0x80002a00,0x4000000,0x1500000,0x80002d00,0x4000000,0x200000,0x80005208,0x2802400,0x962460,0x80005c00,0x4000000,0x200000,
+0x80007300,0x24000000,0x200000,0x80009519,0x7c00100,0x220400,0x80009519,0x7c00100,0x230400,0x80009519,0x7c00100,0x250400,0x80009865,0x7c00100,0x230400,0x8000a008,
+0x2802100,0x962460,0x8000b30a,0x4000000,0x500000,0x8000b30a,0x7c00100,0x230400,0x8000cd00,0x4000000,0x4e00000,0x8000d202,0x2802500,0x962460,0x8000d202,0x7c00100,
+0x230400,0x8000d68d,0x4000000,0x200000,0x8000d997,0x2802000,0x962460,0x8000d997,0x2802400,0x962460,0x8000d997,0x4000000,0x400000,0x8000d997,0x4000000,0x500000,
+0x8000d997,0x7c00100,0x230400,0x8000d997,0xc000010,0x448000,0x8000e489,0x2802100,0x962460,0x8000e489,0x7c00100,0x230400,0x8000e719,0x7c00100,0x220400,0x8000f8a6,
+0x2802100,0x962460,0x8000f8a6,0x7c00100,0x230400,0x8000f8a6,0xc000010,0x448000,0x8000fda1,0x2802100,0x1862460,0x8000fda1,0x2806400,0x1862460,0x8000fda1,0x4000000,
+0x1800000,0x8000fda1,0x6800000,0x1329800,0x8000fda1,0x6800100,0x1862540,0x8000fda1,0x7c00100,0x1830000,0x8000fda1,0xc000010,0x448000,0x8000fe9c,0x7c00100,0x230400,
+0x8000fe9c,0x7c00100,0x830400,0x8000fe9c,0x7c00100,0x1430400,0x8000ff06,0x7c00100,0x220400,0x80010165,0x7c00100,0x230400,0x800102a2,0x4000000,0x200000,0x800102a2,
+0x7c00100,0x230400,0x800103a4,0x7c00100,0x230400,0x800103a4,0xc000010,0x448000,0x8001044c,0x4000000,0x200000,0x8001044c,0x7c00100,0x220400,0x8001044c,0x7c00100,
+0x250400,0x80010670,0x2802000,0x962460,0x80010670,0x4000000,0x200000,0x80010670,0x4000010,0x400000,0x80010670,0xc000010,0x448000,0x800a4711,0x7c40300,0xe30000,
+0x800acd00,0x4000000,0x34e00000,0x800acd00,0x4000000,0x7a902460,0x800ace00,0x4000000,0x34e00000,0x800acf00,0x4000000,0x34e00000,0x800b0011,0x7c40300,0xe30000,0x800b0500,
+0x4000000,0x34e00000,0x800b0500,0x4000000,0xb6800000,0x90001615,0x7c00100,0x230400,0x9000171a,0x4000000,0x200000,0x9000171a,0x7c00100,0x230400,0x90003000,0x24000000,
+0x200000,0x90007f0e,0x4000000,0x200000,0x90008301,0x2802000,0x962460,0x90008e00,0x24000000,0x400000,0x90009519,0x7c00100,0x250400,0x9000a16f,0x2802100,0x962460,
+0x9000d200,0x80000000,0x218960,0x9000d202,0x2802000,0x962460,0x9000d202,0x2802100,0x962460,0x9000d202,0x7c00100,0x230400,0x9000e59d,0x2802100,0x962460,0x90010500,
+0x4000000,0xe00000,0x900107a7,0x2802100,0x962460,0x900107a7,0x2802400,0x962460,0x900107a7,0x2802c00,0x962460,0x900107a7,0x4000000,0x1400000,0x900107a7,0x6800000,
+0x1329800,0x900107a7,0x7c00100,0x220400,0x900107a7,0x7c00100,0x250400,0x900108a8,0x2802100,0x962460,0x900108a8,0x2806400,0x962460,0x900108a8,0x4000000,0x200000,
+0x900108a8,0x4000000,0x400000,0x900108a8,0x4000010,0x400000,0x900108a8,0x6800000,0x1329800,0x900108a8,0x6800100,0x962540,0x900108a8,0x7c00100,0x230400,0x900108a8,
+0xc000010,0x448000,0x90010908,0x7c00100,0x220400,0x90010a38,0x2802100,0x962460,0x90010ca9,0x2802100,0x962460,0x90010ca9,0x4000000,0x500000,0x90010ca9,0x4000010,
+0xb00000,0x90010ca9,0x6800100,0x962540,0x90010ca9,0x7c00100,0x230400,0x90010d1b,0x4000000,0x500000,0x90010eaa,0x2802100,0x962460,0x90010eaa,0x2802400,0x962460,
+0x90010eaa,0x2806400,0x962460,0x90010eaa,0x4000000,0x200000,0x90010eaa,0x4000000,0x400000,0x90010eaa,0x4000010,0x400000,0x90010eaa,0x6800000,0x1329800,0x90010eaa,
+0x6800100,0x962540,0x90010eaa,0x7c00100,0x230400,0x90010eaa,0xc000010,0x448000,0x90010fab,0x7c00100,0x220400,0x90010fab,0x7c00100,0x250400,0x9002c300,0x4000000,
+0x100000,0x900ac400,0x4000000,0xe0000d,0x900acd00,0x4000000,0x34e00000,0x900acd00,0x4000000,0xb6800000,0x900acf00,0x4000000,0x34e00000,0x900b0500,0x4000000,0x34e00000,
+0x900b0500,0x4000000,0xb6800000,0x900b0b9a,0x7c00900,0x1230400,0x900b109a,0x7c00300,0xe30000,0x900b119a,0x7c00300,0xe30000,0x90408e06,0x24000000,0x400000,0xa0001004,
+0x4000000,0x200000,0xa0001004,0x7c00100,0x230400,0xa000120f,0x2802100,0x962460,0xa000120f,0x2802400,0x962460,0xa000171a,0x2802100,0x962460,0xa000171a,0x2806400,
+0x962460,0xa0002a00,0x4000000,0x1600000,0xa0003000,0x24000000,0x200000,0xa000581e,0x7c00100,0x230400,0xa0007300,0x24000000,0x200000,0xa0008301,0x2802400,0x962460,
+0xa0008e00,0x24000000,0x400000,0xa000cf00,0x4000000,0x4e00000,0xa0010500,0x4000000,0x200000,0xa00114af,0x2802100,0x962460,0xa00114af,0x2802400,0x962460,0xa00114af,
+0x2806400,0x962460,0xa00114af,0x6800000,0x1329800,0xa00114af,0x7c00100,0x230400,0xa00114af,0x7c00100,0x230560,0xa00116b0,0x2802100,0x962460,0xa00116b0,0x2802800,
+0x962460,0xa00116b0,0x2806400,0x962460,0xa00116b0,0x4000000,0x400000,0xa00116b0,0x4000000,0x500000,0xa00116b0,0x4000010,0x400000,0xa00116b0,0x6800100,0x962540,
+0xa00116b0,0x7c00100,0x230400,0xa00116b0,0x7c00100,0x230560,0xa00116b0,0xc000010,0x448000,0xa0011722,0x7c00100,0x230400,0xa00118b1,0x2802000,0x962460,0xa00118b1,
+0x2802100,0x962460,0xa00118b1,0x2806400,0x962460,0xa00118b1,0x4000000,0x200000,0xa00118b1,0x4000000,0x400000,0xa00118b1,0x4000000,0x500000,0xa00118b1,0x6800100,
+0x962540,0xa00118b1,0x7c00100,0x230400,0xa00118b1,0x7c00100,0x230560,0xa00118b1,0xc000010,0x448000,0xa00a4005,0x7c00100,0xe30400,0xa00a4711,0x7c40300,0xe30000,
+0xa00ac400,0x4000000,0x4e00000,0xa00acb14,0x7c00100,0xe30000,0xa00acf00,0x4000000,0x34e00000,0xa00b0500,0x4000000,0x34e00000,0xa00b0500,0x4000000,0xb6800000,0xa00b0b96,
+0x7c00900,0x1230400,0xa00b1211,0x7c40300,0xe30000,0xa00b1314,0x7c00100,0xe30000,0xa00b1596,0x7c00300,0xe30000,0xa040afac,0x6800400,0x962540,0xa08083ad,0x2802400,
+0x962460,0xb0000a03,0x7c00100,0x220400,0xb0000b13,0x7c00100,0x2633800,0xb0001004,0x2802000,0x962460,0xb0001110,0x4000000,0x200000,0xb0001524,0x2802000,0x962460,
+0xb0001615,0x4000000,0x500000,0xb000251b,0x7c00100,0x230400,0xb0007300,0x24000000,0x200000,0xb0008939,0x4000000,0x200000,0xb0008939,0x7c00100,0x230400,0xb0008e00,
+0x24000000,0x200000,0xb0008e00,0x24000000,0x400000,0xb0008e00,0x24000010,0x400000,0xb0009257,0x2802000,0x962460,0xb0009257,0x4000000,0x1600000,0xb0009519,0x7c00100,
+0x220400,0xb0009519,0x7c00100,0x250400,0xb0009a00,0x4000000,0x200000,0xb000b30a,0x2802100,0x962460,0xb000b30a,0x7c00100,0x230400,0xb000c178,0x80000000,0x218960,
+0xb000c300,0x4000000,0x4200000,0xb000d202,0x2802000,0x962460,0xb000d476,0x6800100,0x962540,0xb000d476,0x7c00100,0x230400,0xb000e300,0x4000000,0x4e00000,0xb000fda1,
+0x7c00100,0x1830000,0xb0010eaa,0x2802000,0x962460,0xb00116b0,0x7c00100,0x230400,0xb0011900,0x4000000,0x4e00000,0xb0011ab2,0x2802100,0x962460,0xb0011ab2,0x2802400,
+0x962460,0xb0011ab2,0x2806400,0x962460,0xb0011ab2,0x4000000,0x200000,0xb0011ab2,0x6800100,0x962540,0xb0011ab2,0x7c00100,0x230400,0xb0011b0c,0x7c00100,0x230400,
+0xb0011cb3,0x2802100,0x962460,0xb0011cb3,0x2806400,0x962460,0xb0011cb3,0x6800000,0x1329800,0xb0011cb3,0x6800100,0x962540,0xb0011cb3,0x7c00100,0x230400,0xb0011db6,
+0x2802500,0x962460,0xb0011db6,0x6800000,0x1329800,0xb0011db6,0x7c00100,0x230400,0xb0011db6,0x7c00500,0x230400,0xb0011e00,0x4000000,0x200000,0xb0011e00,0x4000000,
+0x1500000,0xb0011fb4,0x2802100,0x962460,0xb0011fb4,0x6800100,0x962540,0xb0011fb4,0x7c00100,0x230400,0xb0011fb4,0xc000010,0x248000,0xb0012000,0x4000000,0x200000,
+0xb00121b5,0x4000000,0x200000,0xb00121b5,0x4000010,0x400000,0xb00121b5,0x7c00100,0x220400,0xb00121b5,0x7c00100,0x250400,0xb00121b5,0xc000010,0x448000,0xb00122b8,
+0x4000000,0x200000,0xb00122b8,0x7c00100,0x230400,0xb00123b7,0x2802400,0x962460,0xb00123b7,0x4000000,0x200000,0xb00123b7,0x7c00100,0x230400,0xb00123b7,0xc000010,
+0x248000,0xb00a4005,0x7c00100,0xe30400,0xb00a4711,0x7c40300,0xe30000,0xb00acf00,0x4000000,0x34e00000,0xb00b0500,0x4000000,0x34e00000,0xb00b0500,0x4000000,0x3ce00000,
+0xb00b0500,0x4000000,0xb6800000,0xb00b109a,0x7c00300,0xe30000,0xb080e47c,0x2802000,0x962460,0xc0001524,0x4000000,0x500000,0xc0001a18,0x2806400,0x1862460,0xc0001a18,
+0x7c00100,0x1830000,0xc0007300,0x24000000,0x200000,0xc0008e00,0x24000010,0x400000,0xc0009519,0x7c00100,0x220400,0xc0009519,0x7c00100,0x250400,0xc000c300,0x4000000,
+0x420000f,0xc000d85c,0x2802100,0x962460,0xc000d85c,0x6800100,0x962540,0xc000d85c,0x7c00100,0x230400,0xc000dc99,0x7c00100,0x230400,0xc000e719,0x7c00100,0x220400,
+0xc00107a7,0x7c00100,0x230400,0xc0010eaa,0x7c00100,0x230400,0xc00116b0,0x7c00100,0x230560,0xc0011900,0x4000000,0x4200000,0xc0012447,0,0x818820,0xc0012447,
+0,0xc18820,0xc0012447,0,0x1418820,0xc00125b9,0x7c00100,0x230400,0xc00126bb,0x2802100,0x962460,0xc00126bb,0x2806400,0x962460,0xc00126bb,0x4000000,
+0x500000,0xc00126bb,0x6800100,0x962540,0xc00126bb,0x7c00100,0x230400,0xc00127ba,0x2802400,0x962460,0xc00127ba,0x4000000,0x200000,0xc00127ba,0x6800000,0x1329800,
+0xc00127ba,0x7c00100,0x230400,0xc00127ba,0x7c00900,0x230400,0xc0012800,0x4000000,0x200000,0xc0012b23,0x4000000,0x200000,0xc0012b23,0x4000000,0x400000,0xc0012b23,
+0x4000000,0x1500000,0xc0012cbc,0x2802400,0x962460,0xc0012cbc,0x4000000,0x1600000,0xc0012cbc,0x6800000,0x1329800,0xc0012cbc,0x7c00100,0x230400,0xc00acf00,0x4000000,
+0x34e00000,0xc00ae300,0x4000000,0x34e00000,0xc00b0500,0x4000000,0x34e00000,0xc00b0500,0x4000000,0xb6800000,0xc00b0b00,0x4000000,0x1200000,0xc00b0b00,0x7c00900,0x1230400,
+0xc00b109a,0x7c00300,0xe30000,0xc00b2914,0x7c00100,0x2530000,0xc00b2916,0x7c00100,0x2530c00,0xc00b2a00,0x4000000,0x34e00000,0xc040af53,0x7c00100,0x230400,0xc0c12b7e,
+0x4000000,0x200000,0xc14a44bf,0x4000000,0xe0000d,0xd000131f,0x2802c00,0x962460,0xd000171a,0x7c00100,0x230400,0xd0001821,0x2802100,0x962460,0xd0007300,0x24000000,
+0x200000,0xd0008e00,0x24000000,0x200000,0xd0008f3a,0x2806000,0x962460,0xd0009519,0x7c00100,0x220400,0xd0009519,0x7c00100,0x250400,0xd000a500,0x4000000,0x200000,
+0xd000c300,0x4000000,0x4e00000,0xd000d202,0x7c00100,0x230400,0xd000d476,0x7c00100,0x230400,0xd000d997,0x2802100,0x962460,0xd000d997,0x6800100,0x962540,0xd000e001,
+0x2802100,0x962460,0xd000e700,0x4000400,0x200000,0xd000e719,0x7c00100,0x220400,0xd000e719,0x7c00500,0x23040f,0xd000fa00,0x4000000,0x4e00000,0xd0010eaa,0x4000010,
+0x400000,0xd0010eaa,0x7c00100,0x230400,0xd0012dbd,0x4000000,0x200000,0xd0012dbd,0x7c00100,0x230400,0xd0012fbe,0x2802100,0x962460,0xd0012fbe,0x2802400,0x962460,
+0xd0012fbe,0x2806400,0x962460,0xd0012fbe,0x4000000,0x400000,0xd0012fbe,0x6800000,0x1329800,0xd0012fbe,0x6800100,0x962540,0xd0012fbe,0x6800100,0x962541,0xd0012fbe,
+0x6804400,0x962540,0xd0012fbe,0x7c00100,0x230400,0xd0012fbe,0x7c00100,0x230560,0xd0012fbe,0xc000010,0x448000,0xd0013183,0x7c00100,0x230400,0xd0013200,0x4000000,
+0x200000,0xd0013200,0x6800000,0x1329805,0xd00134c0,0x2802100,0x962460,0xd00134c0,0x4000002,0x400000,0xd00134c0,0x7c00100,0x230400,0xd00a4305,0x7c00100,0xe30400,
+0xd00a4611,0x7c40300,0xe30000,0xd00a4711,0x7c40300,0xe30000,0xd00a5e11,0x7c40300,0xe30000,0xd00acf00,0x4000000,0x34e00000,0xd00b0500,0x4000000,0x34e00000,0xd00b0500,
+0x4000000,0xb6800000,0xd00b0b11,0x6800500,0x962540,0xd00b0bbf,0x2802200,0xc62460,0xd00b119a,0x7c00300,0xe30000,0xd00b2a00,0x4000000,0x34e00000,0xd00b2e11,0x7c40300,
+0xe30000,0xd00b30bf,0x7c00300,0x230000,0xd00b339a,0x7c00300,0xe30000};
-static const int32_t countPropsVectors=6999;
+static const int32_t countPropsVectors=6999;
static const int32_t propsVectorsColumns=3;
-static const uint16_t scriptExtensions[262]={
-0x800e,0x8019,8,0x8059,8,2,8,0x8038,8,6,8,0x8019,2,0x22,0x25,0xb6,
-0x80c0,2,0x22,0x8025,2,0x11,2,0x22,0x54,0x79,0x7b,0xa7,0xb6,0x80b7,2,0x8022,
-2,0x25,0x80c0,2,0x20,2,0x80b6,4,0xa,0xf,0x10,0x15,0x19,0x1a,0x1f,0x23,
-0x24,0x89,0x97,0x809e,4,0xa,0xf,0x10,0x15,0x19,0x1a,0x1f,0x23,0x24,0x89,0x809e,
-4,0xa,0xf,0x10,0x15,0x1a,0x1f,0x21,0x23,0x24,0x3a,0x89,0x91,0x99,0x9e,0xa0,
-0xaf,0xb2,0xb3,0x80bb,4,0xa,0xf,0x10,0x15,0x1a,0x1f,0x21,0x23,0x24,0x30,0x3a,
-0x89,0x91,0x99,0x9e,0xa0,0xaf,0xb2,0xb3,0x80bb,0xa,0x78,0xa0,0x80b2,0xa,0x69,4,
-0x3a,0x8076,4,0x6f,0x10,0x80a4,0x10,0x74,0xf,0x809d,0xf,0x78,0x23,0x8089,0x23,0x7c,
-0x15,0x80bb,0x15,0x80,0x1c,0x34,0x8076,0x1c,0x84,0xc,0x8019,0x2a,0x2b,0x2c,0x802d,0x1b,
-0x805a,0x800a,4,0xa,0x15,0x8089,0xa,0x8089,4,0x800a,0xa,0x8097,0xa,0x15,0x1a,0x1f,
-0x23,0x8024,0xa,0x80bb,4,0xa,0x15,0x1f,0x24,0x89,0x9e,0x80bb,0x8004,8,0x8022,0x19,
-0x801b,0xa,0x19,0x8089,5,0x11,0x12,0x14,0x16,0x8029,5,0x11,0x12,0x14,0x8016,0x8011,
-5,0x8011,0x11,0x14,0x8016,0x11,0x8019,0xa,0xf,0x10,0x78,0x91,0x99,0x9d,0x9e,0xa0,
-0xa3,0x80b2,0xa,0xf,0x10,0x15,0x1a,0x78,0x91,0x99,0x9d,0x9e,0xa0,0xa3,0xb2,0x80bb,
-0xa,0xf,0x10,0x15,0x78,0x91,0x99,0x9d,0x9e,0xa0,0xa3,0xb2,0x80bb,0xa,0x98,0xa,
-0x8023,0xa,0xef,0x19,0x1c,0x804f,0x37,0x804e,2,0x8025,2,0xf8,0x2f,0x31,0x8053,0x2f,
-0x8031,2,0x8007,0x89,0x7c,0x8087};
+static const uint16_t scriptExtensions[262]={
+0x800e,0x8019,8,0x8059,8,2,8,0x8038,8,6,8,0x8019,2,0x22,0x25,0xb6,
+0x80c0,2,0x22,0x8025,2,0x11,2,0x22,0x54,0x79,0x7b,0xa7,0xb6,0x80b7,2,0x8022,
+2,0x25,0x80c0,2,0x20,2,0x80b6,4,0xa,0xf,0x10,0x15,0x19,0x1a,0x1f,0x23,
+0x24,0x89,0x97,0x809e,4,0xa,0xf,0x10,0x15,0x19,0x1a,0x1f,0x23,0x24,0x89,0x809e,
+4,0xa,0xf,0x10,0x15,0x1a,0x1f,0x21,0x23,0x24,0x3a,0x89,0x91,0x99,0x9e,0xa0,
+0xaf,0xb2,0xb3,0x80bb,4,0xa,0xf,0x10,0x15,0x1a,0x1f,0x21,0x23,0x24,0x30,0x3a,
+0x89,0x91,0x99,0x9e,0xa0,0xaf,0xb2,0xb3,0x80bb,0xa,0x78,0xa0,0x80b2,0xa,0x69,4,
+0x3a,0x8076,4,0x6f,0x10,0x80a4,0x10,0x74,0xf,0x809d,0xf,0x78,0x23,0x8089,0x23,0x7c,
+0x15,0x80bb,0x15,0x80,0x1c,0x34,0x8076,0x1c,0x84,0xc,0x8019,0x2a,0x2b,0x2c,0x802d,0x1b,
+0x805a,0x800a,4,0xa,0x15,0x8089,0xa,0x8089,4,0x800a,0xa,0x8097,0xa,0x15,0x1a,0x1f,
+0x23,0x8024,0xa,0x80bb,4,0xa,0x15,0x1f,0x24,0x89,0x9e,0x80bb,0x8004,8,0x8022,0x19,
+0x801b,0xa,0x19,0x8089,5,0x11,0x12,0x14,0x16,0x8029,5,0x11,0x12,0x14,0x8016,0x8011,
+5,0x8011,0x11,0x14,0x8016,0x11,0x8019,0xa,0xf,0x10,0x78,0x91,0x99,0x9d,0x9e,0xa0,
+0xa3,0x80b2,0xa,0xf,0x10,0x15,0x1a,0x78,0x91,0x99,0x9d,0x9e,0xa0,0xa3,0xb2,0x80bb,
+0xa,0xf,0x10,0x15,0x78,0x91,0x99,0x9d,0x9e,0xa0,0xa3,0xb2,0x80bb,0xa,0x98,0xa,
+0x8023,0xa,0xef,0x19,0x1c,0x804f,0x37,0x804e,2,0x8025,2,0xf8,0x2f,0x31,0x8053,0x2f,
+0x8031,2,0x8007,0x89,0x7c,0x8087};
-static const int32_t indexes[UPROPS_INDEX_COUNT]={0x2b96,0x2b96,0x2b96,0x2b96,0x6898,3,0x83ef,0x8472,0x8472,0x8472,0xb34c0,0x2a75a31,0,0,0,0};
+static const int32_t indexes[UPROPS_INDEX_COUNT]={0x2b96,0x2b96,0x2b96,0x2b96,0x6898,3,0x83ef,0x8472,0x8472,0x8472,0xb34c0,0x2a75a31,0,0,0,0};
#endif // INCLUDED_FROM_UCHAR_C
diff --git a/contrib/libs/icu/common/ucharstrie.cpp b/contrib/libs/icu/common/ucharstrie.cpp
index 52e3ff6712..e0b33af519 100644
--- a/contrib/libs/icu/common/ucharstrie.cpp
+++ b/contrib/libs/icu/common/ucharstrie.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: ucharstrie.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -175,8 +175,8 @@ UCharsTrie::next(int32_t uchar) {
}
UStringTrieResult
-UCharsTrie::next(ConstChar16Ptr ptr, int32_t sLength) {
- const UChar *s=ptr;
+UCharsTrie::next(ConstChar16Ptr ptr, int32_t sLength) {
+ const UChar *s=ptr;
if(sLength<0 ? *s==0 : sLength==0) {
// Empty input.
return current();
diff --git a/contrib/libs/icu/common/ucharstriebuilder.cpp b/contrib/libs/icu/common/ucharstriebuilder.cpp
index 04800dd605..049997a275 100644
--- a/contrib/libs/icu/common/ucharstriebuilder.cpp
+++ b/contrib/libs/icu/common/ucharstriebuilder.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: ucharstriebuilder.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -287,7 +287,7 @@ UCharsTrieBuilder::indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, UCha
UCharsTrieBuilder::UCTLinearMatchNode::UCTLinearMatchNode(const UChar *units, int32_t len, Node *nextNode)
: LinearMatchNode(len, nextNode), s(units) {
- hash=hash*37u+ustr_hashUCharsN(units, len);
+ hash=hash*37u+ustr_hashUCharsN(units, len);
}
UBool
diff --git a/contrib/libs/icu/common/ucharstrieiterator.cpp b/contrib/libs/icu/common/ucharstrieiterator.cpp
index 0614fdb622..b3132241fe 100644
--- a/contrib/libs/icu/common/ucharstrieiterator.cpp
+++ b/contrib/libs/icu/common/ucharstrieiterator.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: ucharstrieiterator.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -21,7 +21,7 @@
U_NAMESPACE_BEGIN
-UCharsTrie::Iterator::Iterator(ConstChar16Ptr trieUChars, int32_t maxStringLength,
+UCharsTrie::Iterator::Iterator(ConstChar16Ptr trieUChars, int32_t maxStringLength,
UErrorCode &errorCode)
: uchars_(trieUChars),
pos_(uchars_), initialPos_(uchars_),
diff --git a/contrib/libs/icu/common/uchriter.cpp b/contrib/libs/icu/common/uchriter.cpp
index e214b2222a..bedbabc74c 100644
--- a/contrib/libs/icu/common/uchriter.cpp
+++ b/contrib/libs/icu/common/uchriter.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -25,14 +25,14 @@ UCharCharacterIterator::UCharCharacterIterator()
// never default construct!
}
-UCharCharacterIterator::UCharCharacterIterator(ConstChar16Ptr textPtr,
+UCharCharacterIterator::UCharCharacterIterator(ConstChar16Ptr textPtr,
int32_t length)
: CharacterIterator(textPtr != 0 ? (length>=0 ? length : u_strlen(textPtr)) : 0),
text(textPtr)
{
}
-UCharCharacterIterator::UCharCharacterIterator(ConstChar16Ptr textPtr,
+UCharCharacterIterator::UCharCharacterIterator(ConstChar16Ptr textPtr,
int32_t length,
int32_t position)
: CharacterIterator(textPtr != 0 ? (length>=0 ? length : u_strlen(textPtr)) : 0, position),
@@ -40,7 +40,7 @@ UCharCharacterIterator::UCharCharacterIterator(ConstChar16Ptr textPtr,
{
}
-UCharCharacterIterator::UCharCharacterIterator(ConstChar16Ptr textPtr,
+UCharCharacterIterator::UCharCharacterIterator(ConstChar16Ptr textPtr,
int32_t length,
int32_t textBegin,
int32_t textEnd,
@@ -89,7 +89,7 @@ UCharCharacterIterator::hashCode() const {
return ustr_hashUCharsN(text, textLength) ^ pos ^ begin ^ end;
}
-UCharCharacterIterator*
+UCharCharacterIterator*
UCharCharacterIterator::clone() const {
return new UCharCharacterIterator(*this);
}
@@ -349,7 +349,7 @@ UCharCharacterIterator::move32(int32_t delta, CharacterIterator::EOrigin origin)
return pos;
}
-void UCharCharacterIterator::setText(ConstChar16Ptr newText,
+void UCharCharacterIterator::setText(ConstChar16Ptr newText,
int32_t newTextLength) {
text = newText;
if(newText == 0 || newTextLength < 0) {
diff --git a/contrib/libs/icu/common/ucln.h b/contrib/libs/icu/common/ucln.h
index db2eb4121a..fe6666efed 100644
--- a/contrib/libs/icu/common/ucln.h
+++ b/contrib/libs/icu/common/ucln.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: ucln.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/ucln_cmn.cpp b/contrib/libs/icu/common/ucln_cmn.cpp
index 9f31bdbf34..f3e07c6b89 100644
--- a/contrib/libs/icu/common/ucln_cmn.cpp
+++ b/contrib/libs/icu/common/ucln_cmn.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
******************************************************************************
* file name: ucln_cmn.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -40,8 +40,8 @@ U_CAPI void U_EXPORT2
u_cleanup(void)
{
UTRACE_ENTRY_OC(UTRACE_U_CLEANUP);
- icu::umtx_lock(NULL); /* Force a memory barrier, so that we are sure to see */
- icu::umtx_unlock(NULL); /* all state left around by any other threads. */
+ icu::umtx_lock(NULL); /* Force a memory barrier, so that we are sure to see */
+ icu::umtx_unlock(NULL); /* all state left around by any other threads. */
ucln_lib_cleanup();
@@ -65,20 +65,20 @@ U_CFUNC void
ucln_common_registerCleanup(ECleanupCommonType type,
cleanupFunc *func)
{
- // Thread safety messiness: From ticket 10295, calls to registerCleanup() may occur
- // concurrently. Although such cases should be storing the same value, they raise errors
- // from the thread sanity checker. Doing the store within a mutex avoids those.
- // BUT that can trigger a recursive entry into std::call_once() in umutex.cpp when this code,
- // running from the call_once function, tries to grab the ICU global mutex, which
- // re-enters the mutex init path. So, work-around by special casing UCLN_COMMON_MUTEX, not
- // using the ICU global mutex for it.
- //
- // No other point in ICU uses std::call_once().
-
+ // Thread safety messiness: From ticket 10295, calls to registerCleanup() may occur
+ // concurrently. Although such cases should be storing the same value, they raise errors
+ // from the thread sanity checker. Doing the store within a mutex avoids those.
+ // BUT that can trigger a recursive entry into std::call_once() in umutex.cpp when this code,
+ // running from the call_once function, tries to grab the ICU global mutex, which
+ // re-enters the mutex init path. So, work-around by special casing UCLN_COMMON_MUTEX, not
+ // using the ICU global mutex for it.
+ //
+ // No other point in ICU uses std::call_once().
+
U_ASSERT(UCLN_COMMON_START < type && type < UCLN_COMMON_COUNT);
- if (type == UCLN_COMMON_MUTEX) {
- gCommonCleanupFunctions[type] = func;
- } else if (UCLN_COMMON_START < type && type < UCLN_COMMON_COUNT) {
+ if (type == UCLN_COMMON_MUTEX) {
+ gCommonCleanupFunctions[type] = func;
+ } else if (UCLN_COMMON_START < type && type < UCLN_COMMON_COUNT) {
icu::Mutex m; // See ticket 10295 for discussion.
gCommonCleanupFunctions[type] = func;
}
diff --git a/contrib/libs/icu/common/ucln_cmn.h b/contrib/libs/icu/common/ucln_cmn.h
index 18d23bf856..b837fb9462 100644
--- a/contrib/libs/icu/common/ucln_cmn.h
+++ b/contrib/libs/icu/common/ucln_cmn.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
******************************************************************************
* file name: ucln_cmn.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -31,21 +31,21 @@ Please keep the order of enums declared in same order
as the cleanup functions are suppose to be called. */
typedef enum ECleanupCommonType {
UCLN_COMMON_START = -1,
- UCLN_COMMON_NUMPARSE_UNISETS,
+ UCLN_COMMON_NUMPARSE_UNISETS,
UCLN_COMMON_USPREP,
UCLN_COMMON_BREAKITERATOR,
- UCLN_COMMON_RBBI,
+ UCLN_COMMON_RBBI,
UCLN_COMMON_SERVICE,
UCLN_COMMON_LOCALE_KEY_TYPE,
UCLN_COMMON_LOCALE,
UCLN_COMMON_LOCALE_AVAILABLE,
- UCLN_COMMON_LIKELY_SUBTAGS,
- UCLN_COMMON_LOCALE_DISTANCE,
+ UCLN_COMMON_LIKELY_SUBTAGS,
+ UCLN_COMMON_LOCALE_DISTANCE,
UCLN_COMMON_ULOC,
UCLN_COMMON_CURRENCY,
UCLN_COMMON_LOADED_NORMALIZER2,
UCLN_COMMON_NORMALIZER2,
- UCLN_COMMON_CHARACTERPROPERTIES,
+ UCLN_COMMON_CHARACTERPROPERTIES,
UCLN_COMMON_USET,
UCLN_COMMON_UNAMES,
UCLN_COMMON_UPROPS,
@@ -62,7 +62,7 @@ typedef enum ECleanupCommonType {
*/
UCLN_COMMON_UNIFIED_CACHE,
UCLN_COMMON_URES,
- UCLN_COMMON_MUTEX, // Mutexes should be the last to be cleaned up.
+ UCLN_COMMON_MUTEX, // Mutexes should be the last to be cleaned up.
UCLN_COMMON_COUNT /* This must be last */
} ECleanupCommonType;
diff --git a/contrib/libs/icu/common/ucln_imp.h b/contrib/libs/icu/common/ucln_imp.h
index 3b62b8f5df..1bfcde0fb8 100644
--- a/contrib/libs/icu/common/ucln_imp.h
+++ b/contrib/libs/icu/common/ucln_imp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: ucln_imp.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -121,9 +121,9 @@ U_CAPI void U_EXPORT2 UCLN_FINI ()
/* READ READ READ READ! Are you getting compilation errors from windows.h?
Any source file which includes this (ucln_imp.h) header MUST
be defined with language extensions ON. */
-#ifndef WIN32_LEAN_AND_MEAN
+#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
-#endif
+#endif
# define VC_EXTRALEAN
# define NOUSER
# define NOSERVICE
diff --git a/contrib/libs/icu/common/ucmndata.cpp b/contrib/libs/icu/common/ucmndata.cpp
index cff4525f9a..ba2310bb7a 100644
--- a/contrib/libs/icu/common/ucmndata.cpp
+++ b/contrib/libs/icu/common/ucmndata.cpp
@@ -1,393 +1,393 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 1999-2011, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************/
-
-
-/*------------------------------------------------------------------------------
- *
- * UCommonData An abstract interface for dealing with ICU Common Data Files.
- * ICU Common Data Files are a grouping of a number of individual
- * data items (resources, converters, tables, anything) into a
- * single file or dll. The combined format includes a table of
- * contents for locating the individual items by name.
- *
- * Two formats for the table of contents are supported, which is
- * why there is an abstract inteface involved.
- *
- */
-
-#include "unicode/utypes.h"
-#include "unicode/udata.h"
-#include "cstring.h"
-#include "ucmndata.h"
-#include "udatamem.h"
-
-#if defined(UDATA_DEBUG) || defined(UDATA_DEBUG_DUMP)
-# include <stdio.h>
-#endif
-
-U_CFUNC uint16_t
-udata_getHeaderSize(const DataHeader *udh) {
- if(udh==NULL) {
- return 0;
- } else if(udh->info.isBigEndian==U_IS_BIG_ENDIAN) {
- /* same endianness */
- return udh->dataHeader.headerSize;
- } else {
- /* opposite endianness */
- uint16_t x=udh->dataHeader.headerSize;
- return (uint16_t)((x<<8)|(x>>8));
- }
-}
-
-U_CFUNC uint16_t
-udata_getInfoSize(const UDataInfo *info) {
- if(info==NULL) {
- return 0;
- } else if(info->isBigEndian==U_IS_BIG_ENDIAN) {
- /* same endianness */
- return info->size;
- } else {
- /* opposite endianness */
- uint16_t x=info->size;
- return (uint16_t)((x<<8)|(x>>8));
- }
-}
-
-/*-----------------------------------------------------------------------------*
- * *
- * Pointer TOCs. TODO: This form of table-of-contents should be removed *
- * because DLLs must be relocated on loading to correct the *
- * pointer values and this operation makes shared memory *
- * mapping of the data much less likely to work. *
- * *
- *-----------------------------------------------------------------------------*/
-typedef struct {
- const char *entryName;
- const DataHeader *pHeader;
-} PointerTOCEntry;
-
-
-typedef struct {
- uint32_t count;
- uint32_t reserved;
- /**
- * Variable-length array declared with length 1 to disable bounds checkers.
- * The actual array length is in the count field.
- */
- PointerTOCEntry entry[1];
-} PointerTOC;
-
-
-/* definition of OffsetTOC struct types moved to ucmndata.h */
-
-/*-----------------------------------------------------------------------------*
- * *
- * entry point lookup implementations *
- * *
- *-----------------------------------------------------------------------------*/
-
-#ifndef MIN
-#define MIN(a,b) (((a)<(b)) ? (a) : (b))
-#endif
-
-/**
- * Compare strings where we know the shared prefix length,
- * and advance the prefix length as we find that the strings share even more characters.
- */
-static int32_t
-strcmpAfterPrefix(const char *s1, const char *s2, int32_t *pPrefixLength) {
- int32_t pl=*pPrefixLength;
- int32_t cmp=0;
- s1+=pl;
- s2+=pl;
- for(;;) {
- int32_t c1=(uint8_t)*s1++;
- int32_t c2=(uint8_t)*s2++;
- cmp=c1-c2;
- if(cmp!=0 || c1==0) { /* different or done */
- break;
- }
- ++pl; /* increment shared same-prefix length */
- }
- *pPrefixLength=pl;
- return cmp;
-}
-
-static int32_t
-offsetTOCPrefixBinarySearch(const char *s, const char *names,
- const UDataOffsetTOCEntry *toc, int32_t count) {
- int32_t start=0;
- int32_t limit=count;
- /*
- * Remember the shared prefix between s, start and limit,
- * and don't compare that shared prefix again.
- * The shared prefix should get longer as we narrow the [start, limit[ range.
- */
- int32_t startPrefixLength=0;
- int32_t limitPrefixLength=0;
- if(count==0) {
- return -1;
- }
- /*
- * Prime the prefix lengths so that we don't keep prefixLength at 0 until
- * both the start and limit indexes have moved.
- * At the same time, we find if s is one of the start and (limit-1) names,
- * and if not, exclude them from the actual binary search.
- */
- if(0==strcmpAfterPrefix(s, names+toc[0].nameOffset, &startPrefixLength)) {
- return 0;
- }
- ++start;
- --limit;
- if(0==strcmpAfterPrefix(s, names+toc[limit].nameOffset, &limitPrefixLength)) {
- return limit;
- }
- while(start<limit) {
- int32_t i=(start+limit)/2;
- int32_t prefixLength=MIN(startPrefixLength, limitPrefixLength);
- int32_t cmp=strcmpAfterPrefix(s, names+toc[i].nameOffset, &prefixLength);
- if(cmp<0) {
- limit=i;
- limitPrefixLength=prefixLength;
- } else if(cmp==0) {
- return i;
- } else {
- start=i+1;
- startPrefixLength=prefixLength;
- }
- }
- return -1;
-}
-
-static int32_t
-pointerTOCPrefixBinarySearch(const char *s, const PointerTOCEntry *toc, int32_t count) {
- int32_t start=0;
- int32_t limit=count;
- /*
- * Remember the shared prefix between s, start and limit,
- * and don't compare that shared prefix again.
- * The shared prefix should get longer as we narrow the [start, limit[ range.
- */
- int32_t startPrefixLength=0;
- int32_t limitPrefixLength=0;
- if(count==0) {
- return -1;
- }
- /*
- * Prime the prefix lengths so that we don't keep prefixLength at 0 until
- * both the start and limit indexes have moved.
- * At the same time, we find if s is one of the start and (limit-1) names,
- * and if not, exclude them from the actual binary search.
- */
- if(0==strcmpAfterPrefix(s, toc[0].entryName, &startPrefixLength)) {
- return 0;
- }
- ++start;
- --limit;
- if(0==strcmpAfterPrefix(s, toc[limit].entryName, &limitPrefixLength)) {
- return limit;
- }
- while(start<limit) {
- int32_t i=(start+limit)/2;
- int32_t prefixLength=MIN(startPrefixLength, limitPrefixLength);
- int32_t cmp=strcmpAfterPrefix(s, toc[i].entryName, &prefixLength);
- if(cmp<0) {
- limit=i;
- limitPrefixLength=prefixLength;
- } else if(cmp==0) {
- return i;
- } else {
- start=i+1;
- startPrefixLength=prefixLength;
- }
- }
- return -1;
-}
-
-U_CDECL_BEGIN
-static uint32_t U_CALLCONV
-offsetTOCEntryCount(const UDataMemory *pData) {
- int32_t retVal=0;
- const UDataOffsetTOC *toc = (UDataOffsetTOC *)pData->toc;
- if (toc != NULL) {
- retVal = toc->count;
- }
- return retVal;
-}
-
-static const DataHeader * U_CALLCONV
-offsetTOCLookupFn(const UDataMemory *pData,
- const char *tocEntryName,
- int32_t *pLength,
- UErrorCode *pErrorCode) {
- (void)pErrorCode;
- const UDataOffsetTOC *toc = (UDataOffsetTOC *)pData->toc;
- if(toc!=NULL) {
- const char *base=(const char *)toc;
- int32_t number, count=(int32_t)toc->count;
-
- /* perform a binary search for the data in the common data's table of contents */
-#if defined (UDATA_DEBUG_DUMP)
- /* list the contents of the TOC each time .. not recommended */
- for(number=0; number<count; ++number) {
- fprintf(stderr, "\tx%d: %s\n", number, &base[toc->entry[number].nameOffset]);
- }
-#endif
- number=offsetTOCPrefixBinarySearch(tocEntryName, base, toc->entry, count);
- if(number>=0) {
- /* found it */
- const UDataOffsetTOCEntry *entry=toc->entry+number;
-#ifdef UDATA_DEBUG
- fprintf(stderr, "%s: Found.\n", tocEntryName);
-#endif
- if((number+1) < count) {
- *pLength = (int32_t)(entry[1].dataOffset - entry->dataOffset);
- } else {
- *pLength = -1;
- }
- return (const DataHeader *)(base+entry->dataOffset);
- } else {
-#ifdef UDATA_DEBUG
- fprintf(stderr, "%s: Not found.\n", tocEntryName);
-#endif
- return NULL;
- }
- } else {
-#ifdef UDATA_DEBUG
- fprintf(stderr, "returning header\n");
-#endif
-
- return pData->pHeader;
- }
-}
-
-
-static uint32_t U_CALLCONV pointerTOCEntryCount(const UDataMemory *pData) {
- const PointerTOC *toc = (PointerTOC *)pData->toc;
- return (uint32_t)((toc != NULL) ? (toc->count) : 0);
-}
-
-static const DataHeader * U_CALLCONV pointerTOCLookupFn(const UDataMemory *pData,
- const char *name,
- int32_t *pLength,
- UErrorCode *pErrorCode) {
- (void)pErrorCode;
- if(pData->toc!=NULL) {
- const PointerTOC *toc = (PointerTOC *)pData->toc;
- int32_t number, count=(int32_t)toc->count;
-
-#if defined (UDATA_DEBUG_DUMP)
- /* list the contents of the TOC each time .. not recommended */
- for(number=0; number<count; ++number) {
- fprintf(stderr, "\tx%d: %s\n", number, toc->entry[number].entryName);
- }
-#endif
- number=pointerTOCPrefixBinarySearch(name, toc->entry, count);
- if(number>=0) {
- /* found it */
-#ifdef UDATA_DEBUG
- fprintf(stderr, "%s: Found.\n", toc->entry[number].entryName);
-#endif
- *pLength=-1;
- return UDataMemory_normalizeDataPointer(toc->entry[number].pHeader);
- } else {
-#ifdef UDATA_DEBUG
- fprintf(stderr, "%s: Not found.\n", name);
-#endif
- return NULL;
- }
- } else {
- return pData->pHeader;
- }
-}
-U_CDECL_END
-
-
-static const commonDataFuncs CmnDFuncs = {offsetTOCLookupFn, offsetTOCEntryCount};
-static const commonDataFuncs ToCPFuncs = {pointerTOCLookupFn, pointerTOCEntryCount};
-
-
-
-/*----------------------------------------------------------------------*
- * *
- * checkCommonData Validate the format of a common data file. *
- * Fill in the virtual function ptr based on TOC type *
- * If the data is invalid, close the UDataMemory *
- * and set the appropriate error code. *
- * *
- *----------------------------------------------------------------------*/
-U_CFUNC void udata_checkCommonData(UDataMemory *udm, UErrorCode *err) {
- if (U_FAILURE(*err)) {
- return;
- }
-
- if(udm==NULL || udm->pHeader==NULL) {
- *err=U_INVALID_FORMAT_ERROR;
- } else if(!(udm->pHeader->dataHeader.magic1==0xda &&
- udm->pHeader->dataHeader.magic2==0x27 &&
- udm->pHeader->info.isBigEndian==U_IS_BIG_ENDIAN &&
- udm->pHeader->info.charsetFamily==U_CHARSET_FAMILY)
- ) {
- /* header not valid */
- *err=U_INVALID_FORMAT_ERROR;
- }
- else if (udm->pHeader->info.dataFormat[0]==0x43 &&
- udm->pHeader->info.dataFormat[1]==0x6d &&
- udm->pHeader->info.dataFormat[2]==0x6e &&
- udm->pHeader->info.dataFormat[3]==0x44 &&
- udm->pHeader->info.formatVersion[0]==1
- ) {
- /* dataFormat="CmnD" */
- udm->vFuncs = &CmnDFuncs;
- udm->toc=(const char *)udm->pHeader+udata_getHeaderSize(udm->pHeader);
- }
- else if(udm->pHeader->info.dataFormat[0]==0x54 &&
- udm->pHeader->info.dataFormat[1]==0x6f &&
- udm->pHeader->info.dataFormat[2]==0x43 &&
- udm->pHeader->info.dataFormat[3]==0x50 &&
- udm->pHeader->info.formatVersion[0]==1
- ) {
- /* dataFormat="ToCP" */
- udm->vFuncs = &ToCPFuncs;
- udm->toc=(const char *)udm->pHeader+udata_getHeaderSize(udm->pHeader);
- }
- else {
- /* dataFormat not recognized */
- *err=U_INVALID_FORMAT_ERROR;
- }
-
- if (U_FAILURE(*err)) {
- /* If the data is no good and we memory-mapped it ourselves,
- * close the memory mapping so it doesn't leak. Note that this has
- * no effect on non-memory mapped data, other than clearing fields in udm.
- */
- udata_close(udm);
- }
-}
-
-/*
- * TODO: Add a udata_swapPackageHeader() function that swaps an ICU .dat package
- * header but not its sub-items.
- * This function will be needed for automatic runtime swapping.
- * Sub-items should not be swapped to limit the swapping to the parts of the
- * package that are actually used.
- *
- * Since lengths of items are implicit in the order and offsets of their
- * ToC entries, and since offsets are relative to the start of the ToC,
- * a swapped version may need to generate a different data structure
- * with pointers to the original data items and with their lengths
- * (-1 for the last one if it is not known), and maybe even pointers to the
- * swapped versions of the items.
- * These pointers to swapped versions would establish a cache;
- * instead, each open data item could simply own the storage for its swapped
- * data. This fits better with the current design.
- *
- * markus 2003sep18 Jitterbug 2235
- */
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 1999-2011, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************/
+
+
+/*------------------------------------------------------------------------------
+ *
+ * UCommonData An abstract interface for dealing with ICU Common Data Files.
+ * ICU Common Data Files are a grouping of a number of individual
+ * data items (resources, converters, tables, anything) into a
+ * single file or dll. The combined format includes a table of
+ * contents for locating the individual items by name.
+ *
+ * Two formats for the table of contents are supported, which is
+ * why there is an abstract inteface involved.
+ *
+ */
+
+#include "unicode/utypes.h"
+#include "unicode/udata.h"
+#include "cstring.h"
+#include "ucmndata.h"
+#include "udatamem.h"
+
+#if defined(UDATA_DEBUG) || defined(UDATA_DEBUG_DUMP)
+# include <stdio.h>
+#endif
+
+U_CFUNC uint16_t
+udata_getHeaderSize(const DataHeader *udh) {
+ if(udh==NULL) {
+ return 0;
+ } else if(udh->info.isBigEndian==U_IS_BIG_ENDIAN) {
+ /* same endianness */
+ return udh->dataHeader.headerSize;
+ } else {
+ /* opposite endianness */
+ uint16_t x=udh->dataHeader.headerSize;
+ return (uint16_t)((x<<8)|(x>>8));
+ }
+}
+
+U_CFUNC uint16_t
+udata_getInfoSize(const UDataInfo *info) {
+ if(info==NULL) {
+ return 0;
+ } else if(info->isBigEndian==U_IS_BIG_ENDIAN) {
+ /* same endianness */
+ return info->size;
+ } else {
+ /* opposite endianness */
+ uint16_t x=info->size;
+ return (uint16_t)((x<<8)|(x>>8));
+ }
+}
+
+/*-----------------------------------------------------------------------------*
+ * *
+ * Pointer TOCs. TODO: This form of table-of-contents should be removed *
+ * because DLLs must be relocated on loading to correct the *
+ * pointer values and this operation makes shared memory *
+ * mapping of the data much less likely to work. *
+ * *
+ *-----------------------------------------------------------------------------*/
+typedef struct {
+ const char *entryName;
+ const DataHeader *pHeader;
+} PointerTOCEntry;
+
+
+typedef struct {
+ uint32_t count;
+ uint32_t reserved;
+ /**
+ * Variable-length array declared with length 1 to disable bounds checkers.
+ * The actual array length is in the count field.
+ */
+ PointerTOCEntry entry[1];
+} PointerTOC;
+
+
+/* definition of OffsetTOC struct types moved to ucmndata.h */
+
+/*-----------------------------------------------------------------------------*
+ * *
+ * entry point lookup implementations *
+ * *
+ *-----------------------------------------------------------------------------*/
+
+#ifndef MIN
+#define MIN(a,b) (((a)<(b)) ? (a) : (b))
+#endif
+
+/**
+ * Compare strings where we know the shared prefix length,
+ * and advance the prefix length as we find that the strings share even more characters.
+ */
+static int32_t
+strcmpAfterPrefix(const char *s1, const char *s2, int32_t *pPrefixLength) {
+ int32_t pl=*pPrefixLength;
+ int32_t cmp=0;
+ s1+=pl;
+ s2+=pl;
+ for(;;) {
+ int32_t c1=(uint8_t)*s1++;
+ int32_t c2=(uint8_t)*s2++;
+ cmp=c1-c2;
+ if(cmp!=0 || c1==0) { /* different or done */
+ break;
+ }
+ ++pl; /* increment shared same-prefix length */
+ }
+ *pPrefixLength=pl;
+ return cmp;
+}
+
+static int32_t
+offsetTOCPrefixBinarySearch(const char *s, const char *names,
+ const UDataOffsetTOCEntry *toc, int32_t count) {
+ int32_t start=0;
+ int32_t limit=count;
+ /*
+ * Remember the shared prefix between s, start and limit,
+ * and don't compare that shared prefix again.
+ * The shared prefix should get longer as we narrow the [start, limit[ range.
+ */
+ int32_t startPrefixLength=0;
+ int32_t limitPrefixLength=0;
+ if(count==0) {
+ return -1;
+ }
+ /*
+ * Prime the prefix lengths so that we don't keep prefixLength at 0 until
+ * both the start and limit indexes have moved.
+ * At the same time, we find if s is one of the start and (limit-1) names,
+ * and if not, exclude them from the actual binary search.
+ */
+ if(0==strcmpAfterPrefix(s, names+toc[0].nameOffset, &startPrefixLength)) {
+ return 0;
+ }
+ ++start;
+ --limit;
+ if(0==strcmpAfterPrefix(s, names+toc[limit].nameOffset, &limitPrefixLength)) {
+ return limit;
+ }
+ while(start<limit) {
+ int32_t i=(start+limit)/2;
+ int32_t prefixLength=MIN(startPrefixLength, limitPrefixLength);
+ int32_t cmp=strcmpAfterPrefix(s, names+toc[i].nameOffset, &prefixLength);
+ if(cmp<0) {
+ limit=i;
+ limitPrefixLength=prefixLength;
+ } else if(cmp==0) {
+ return i;
+ } else {
+ start=i+1;
+ startPrefixLength=prefixLength;
+ }
+ }
+ return -1;
+}
+
+static int32_t
+pointerTOCPrefixBinarySearch(const char *s, const PointerTOCEntry *toc, int32_t count) {
+ int32_t start=0;
+ int32_t limit=count;
+ /*
+ * Remember the shared prefix between s, start and limit,
+ * and don't compare that shared prefix again.
+ * The shared prefix should get longer as we narrow the [start, limit[ range.
+ */
+ int32_t startPrefixLength=0;
+ int32_t limitPrefixLength=0;
+ if(count==0) {
+ return -1;
+ }
+ /*
+ * Prime the prefix lengths so that we don't keep prefixLength at 0 until
+ * both the start and limit indexes have moved.
+ * At the same time, we find if s is one of the start and (limit-1) names,
+ * and if not, exclude them from the actual binary search.
+ */
+ if(0==strcmpAfterPrefix(s, toc[0].entryName, &startPrefixLength)) {
+ return 0;
+ }
+ ++start;
+ --limit;
+ if(0==strcmpAfterPrefix(s, toc[limit].entryName, &limitPrefixLength)) {
+ return limit;
+ }
+ while(start<limit) {
+ int32_t i=(start+limit)/2;
+ int32_t prefixLength=MIN(startPrefixLength, limitPrefixLength);
+ int32_t cmp=strcmpAfterPrefix(s, toc[i].entryName, &prefixLength);
+ if(cmp<0) {
+ limit=i;
+ limitPrefixLength=prefixLength;
+ } else if(cmp==0) {
+ return i;
+ } else {
+ start=i+1;
+ startPrefixLength=prefixLength;
+ }
+ }
+ return -1;
+}
+
+U_CDECL_BEGIN
+static uint32_t U_CALLCONV
+offsetTOCEntryCount(const UDataMemory *pData) {
+ int32_t retVal=0;
+ const UDataOffsetTOC *toc = (UDataOffsetTOC *)pData->toc;
+ if (toc != NULL) {
+ retVal = toc->count;
+ }
+ return retVal;
+}
+
+static const DataHeader * U_CALLCONV
+offsetTOCLookupFn(const UDataMemory *pData,
+ const char *tocEntryName,
+ int32_t *pLength,
+ UErrorCode *pErrorCode) {
+ (void)pErrorCode;
+ const UDataOffsetTOC *toc = (UDataOffsetTOC *)pData->toc;
+ if(toc!=NULL) {
+ const char *base=(const char *)toc;
+ int32_t number, count=(int32_t)toc->count;
+
+ /* perform a binary search for the data in the common data's table of contents */
+#if defined (UDATA_DEBUG_DUMP)
+ /* list the contents of the TOC each time .. not recommended */
+ for(number=0; number<count; ++number) {
+ fprintf(stderr, "\tx%d: %s\n", number, &base[toc->entry[number].nameOffset]);
+ }
+#endif
+ number=offsetTOCPrefixBinarySearch(tocEntryName, base, toc->entry, count);
+ if(number>=0) {
+ /* found it */
+ const UDataOffsetTOCEntry *entry=toc->entry+number;
+#ifdef UDATA_DEBUG
+ fprintf(stderr, "%s: Found.\n", tocEntryName);
+#endif
+ if((number+1) < count) {
+ *pLength = (int32_t)(entry[1].dataOffset - entry->dataOffset);
+ } else {
+ *pLength = -1;
+ }
+ return (const DataHeader *)(base+entry->dataOffset);
+ } else {
+#ifdef UDATA_DEBUG
+ fprintf(stderr, "%s: Not found.\n", tocEntryName);
+#endif
+ return NULL;
+ }
+ } else {
+#ifdef UDATA_DEBUG
+ fprintf(stderr, "returning header\n");
+#endif
+
+ return pData->pHeader;
+ }
+}
+
+
+static uint32_t U_CALLCONV pointerTOCEntryCount(const UDataMemory *pData) {
+ const PointerTOC *toc = (PointerTOC *)pData->toc;
+ return (uint32_t)((toc != NULL) ? (toc->count) : 0);
+}
+
+static const DataHeader * U_CALLCONV pointerTOCLookupFn(const UDataMemory *pData,
+ const char *name,
+ int32_t *pLength,
+ UErrorCode *pErrorCode) {
+ (void)pErrorCode;
+ if(pData->toc!=NULL) {
+ const PointerTOC *toc = (PointerTOC *)pData->toc;
+ int32_t number, count=(int32_t)toc->count;
+
+#if defined (UDATA_DEBUG_DUMP)
+ /* list the contents of the TOC each time .. not recommended */
+ for(number=0; number<count; ++number) {
+ fprintf(stderr, "\tx%d: %s\n", number, toc->entry[number].entryName);
+ }
+#endif
+ number=pointerTOCPrefixBinarySearch(name, toc->entry, count);
+ if(number>=0) {
+ /* found it */
+#ifdef UDATA_DEBUG
+ fprintf(stderr, "%s: Found.\n", toc->entry[number].entryName);
+#endif
+ *pLength=-1;
+ return UDataMemory_normalizeDataPointer(toc->entry[number].pHeader);
+ } else {
+#ifdef UDATA_DEBUG
+ fprintf(stderr, "%s: Not found.\n", name);
+#endif
+ return NULL;
+ }
+ } else {
+ return pData->pHeader;
+ }
+}
+U_CDECL_END
+
+
+static const commonDataFuncs CmnDFuncs = {offsetTOCLookupFn, offsetTOCEntryCount};
+static const commonDataFuncs ToCPFuncs = {pointerTOCLookupFn, pointerTOCEntryCount};
+
+
+
+/*----------------------------------------------------------------------*
+ * *
+ * checkCommonData Validate the format of a common data file. *
+ * Fill in the virtual function ptr based on TOC type *
+ * If the data is invalid, close the UDataMemory *
+ * and set the appropriate error code. *
+ * *
+ *----------------------------------------------------------------------*/
+U_CFUNC void udata_checkCommonData(UDataMemory *udm, UErrorCode *err) {
+ if (U_FAILURE(*err)) {
+ return;
+ }
+
+ if(udm==NULL || udm->pHeader==NULL) {
+ *err=U_INVALID_FORMAT_ERROR;
+ } else if(!(udm->pHeader->dataHeader.magic1==0xda &&
+ udm->pHeader->dataHeader.magic2==0x27 &&
+ udm->pHeader->info.isBigEndian==U_IS_BIG_ENDIAN &&
+ udm->pHeader->info.charsetFamily==U_CHARSET_FAMILY)
+ ) {
+ /* header not valid */
+ *err=U_INVALID_FORMAT_ERROR;
+ }
+ else if (udm->pHeader->info.dataFormat[0]==0x43 &&
+ udm->pHeader->info.dataFormat[1]==0x6d &&
+ udm->pHeader->info.dataFormat[2]==0x6e &&
+ udm->pHeader->info.dataFormat[3]==0x44 &&
+ udm->pHeader->info.formatVersion[0]==1
+ ) {
+ /* dataFormat="CmnD" */
+ udm->vFuncs = &CmnDFuncs;
+ udm->toc=(const char *)udm->pHeader+udata_getHeaderSize(udm->pHeader);
+ }
+ else if(udm->pHeader->info.dataFormat[0]==0x54 &&
+ udm->pHeader->info.dataFormat[1]==0x6f &&
+ udm->pHeader->info.dataFormat[2]==0x43 &&
+ udm->pHeader->info.dataFormat[3]==0x50 &&
+ udm->pHeader->info.formatVersion[0]==1
+ ) {
+ /* dataFormat="ToCP" */
+ udm->vFuncs = &ToCPFuncs;
+ udm->toc=(const char *)udm->pHeader+udata_getHeaderSize(udm->pHeader);
+ }
+ else {
+ /* dataFormat not recognized */
+ *err=U_INVALID_FORMAT_ERROR;
+ }
+
+ if (U_FAILURE(*err)) {
+ /* If the data is no good and we memory-mapped it ourselves,
+ * close the memory mapping so it doesn't leak. Note that this has
+ * no effect on non-memory mapped data, other than clearing fields in udm.
+ */
+ udata_close(udm);
+ }
+}
+
+/*
+ * TODO: Add a udata_swapPackageHeader() function that swaps an ICU .dat package
+ * header but not its sub-items.
+ * This function will be needed for automatic runtime swapping.
+ * Sub-items should not be swapped to limit the swapping to the parts of the
+ * package that are actually used.
+ *
+ * Since lengths of items are implicit in the order and offsets of their
+ * ToC entries, and since offsets are relative to the start of the ToC,
+ * a swapped version may need to generate a different data structure
+ * with pointers to the original data items and with their lengths
+ * (-1 for the last one if it is not known), and maybe even pointers to the
+ * swapped versions of the items.
+ * These pointers to swapped versions would establish a cache;
+ * instead, each open data item could simply own the storage for its swapped
+ * data. This fits better with the current design.
+ *
+ * markus 2003sep18 Jitterbug 2235
+ */
diff --git a/contrib/libs/icu/common/ucmndata.h b/contrib/libs/icu/common/ucmndata.h
index 4f060b8783..c3eba9f4d0 100644
--- a/contrib/libs/icu/common/ucmndata.h
+++ b/contrib/libs/icu/common/ucmndata.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -52,11 +52,11 @@ typedef struct {
typedef struct {
uint32_t count;
- /**
- * Variable-length array declared with length 1 to disable bounds checkers.
- * The actual array length is in the count field.
- */
- UDataOffsetTOCEntry entry[1];
+ /**
+ * Variable-length array declared with length 1 to disable bounds checkers.
+ * The actual array length is in the count field.
+ */
+ UDataOffsetTOCEntry entry[1];
} UDataOffsetTOC;
/**
diff --git a/contrib/libs/icu/common/ucnv.cpp b/contrib/libs/icu/common/ucnv.cpp
index 06e2a272cb..5dcf35e043 100644
--- a/contrib/libs/icu/common/ucnv.cpp
+++ b/contrib/libs/icu/common/ucnv.cpp
@@ -1,2910 +1,2910 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 1998-2016, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-*
-* ucnv.c:
-* Implements APIs for the ICU's codeset conversion library;
-* mostly calls through internal functions;
-* created by Bertrand A. Damiba
-*
-* Modification History:
-*
-* Date Name Description
-* 04/04/99 helena Fixed internal header inclusion.
-* 05/09/00 helena Added implementation to handle fallback mappings.
-* 06/20/2000 helena OS/400 port changes; mostly typecast.
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_CONVERSION
-
-#include <memory>
-
-#include "unicode/ustring.h"
-#include "unicode/ucnv.h"
-#include "unicode/ucnv_err.h"
-#include "unicode/uset.h"
-#include "unicode/utf.h"
-#include "unicode/utf16.h"
-#include "putilimp.h"
-#include "cmemory.h"
-#include "cstring.h"
-#include "uassert.h"
-#include "utracimp.h"
-#include "ustr_imp.h"
-#include "ucnv_imp.h"
-#include "ucnv_cnv.h"
-#include "ucnv_bld.h"
-
-/* size of intermediate and preflighting buffers in ucnv_convert() */
-#define CHUNK_SIZE 1024
-
-typedef struct UAmbiguousConverter {
- const char *name;
- const UChar variant5c;
-} UAmbiguousConverter;
-
-static const UAmbiguousConverter ambiguousConverters[]={
- { "ibm-897_P100-1995", 0xa5 },
- { "ibm-942_P120-1999", 0xa5 },
- { "ibm-943_P130-1999", 0xa5 },
- { "ibm-946_P100-1995", 0xa5 },
- { "ibm-33722_P120-1999", 0xa5 },
- { "ibm-1041_P100-1995", 0xa5 },
- /*{ "ibm-54191_P100-2006", 0xa5 },*/
- /*{ "ibm-62383_P100-2007", 0xa5 },*/
- /*{ "ibm-891_P100-1995", 0x20a9 },*/
- { "ibm-944_P100-1995", 0x20a9 },
- { "ibm-949_P110-1999", 0x20a9 },
- { "ibm-1363_P110-1997", 0x20a9 },
- { "ISO_2022,locale=ko,version=0", 0x20a9 },
- { "ibm-1088_P100-1995", 0x20a9 }
-};
-
-/*Calls through createConverter */
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 1998-2016, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+*
+* ucnv.c:
+* Implements APIs for the ICU's codeset conversion library;
+* mostly calls through internal functions;
+* created by Bertrand A. Damiba
+*
+* Modification History:
+*
+* Date Name Description
+* 04/04/99 helena Fixed internal header inclusion.
+* 05/09/00 helena Added implementation to handle fallback mappings.
+* 06/20/2000 helena OS/400 port changes; mostly typecast.
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include <memory>
+
+#include "unicode/ustring.h"
+#include "unicode/ucnv.h"
+#include "unicode/ucnv_err.h"
+#include "unicode/uset.h"
+#include "unicode/utf.h"
+#include "unicode/utf16.h"
+#include "putilimp.h"
+#include "cmemory.h"
+#include "cstring.h"
+#include "uassert.h"
+#include "utracimp.h"
+#include "ustr_imp.h"
+#include "ucnv_imp.h"
+#include "ucnv_cnv.h"
+#include "ucnv_bld.h"
+
+/* size of intermediate and preflighting buffers in ucnv_convert() */
+#define CHUNK_SIZE 1024
+
+typedef struct UAmbiguousConverter {
+ const char *name;
+ const UChar variant5c;
+} UAmbiguousConverter;
+
+static const UAmbiguousConverter ambiguousConverters[]={
+ { "ibm-897_P100-1995", 0xa5 },
+ { "ibm-942_P120-1999", 0xa5 },
+ { "ibm-943_P130-1999", 0xa5 },
+ { "ibm-946_P100-1995", 0xa5 },
+ { "ibm-33722_P120-1999", 0xa5 },
+ { "ibm-1041_P100-1995", 0xa5 },
+ /*{ "ibm-54191_P100-2006", 0xa5 },*/
+ /*{ "ibm-62383_P100-2007", 0xa5 },*/
+ /*{ "ibm-891_P100-1995", 0x20a9 },*/
+ { "ibm-944_P100-1995", 0x20a9 },
+ { "ibm-949_P110-1999", 0x20a9 },
+ { "ibm-1363_P110-1997", 0x20a9 },
+ { "ISO_2022,locale=ko,version=0", 0x20a9 },
+ { "ibm-1088_P100-1995", 0x20a9 }
+};
+
+/*Calls through createConverter */
+U_CAPI UConverter* U_EXPORT2
+ucnv_open (const char *name,
+ UErrorCode * err)
+{
+ UConverter *r;
+
+ if (err == NULL || U_FAILURE (*err)) {
+ return NULL;
+ }
+
+ r = ucnv_createConverter(NULL, name, err);
+ return r;
+}
+
U_CAPI UConverter* U_EXPORT2
-ucnv_open (const char *name,
- UErrorCode * err)
-{
- UConverter *r;
-
- if (err == NULL || U_FAILURE (*err)) {
- return NULL;
- }
-
- r = ucnv_createConverter(NULL, name, err);
- return r;
-}
-
-U_CAPI UConverter* U_EXPORT2
-ucnv_openPackage (const char *packageName, const char *converterName, UErrorCode * err)
-{
- return ucnv_createConverterFromPackage(packageName, converterName, err);
-}
-
-/*Extracts the UChar* to a char* and calls through createConverter */
-U_CAPI UConverter* U_EXPORT2
-ucnv_openU (const UChar * name,
- UErrorCode * err)
-{
- char asciiName[UCNV_MAX_CONVERTER_NAME_LENGTH];
-
- if (err == NULL || U_FAILURE(*err))
- return NULL;
- if (name == NULL)
- return ucnv_open (NULL, err);
- if (u_strlen(name) >= UCNV_MAX_CONVERTER_NAME_LENGTH)
- {
- *err = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
- }
- return ucnv_open(u_austrcpy(asciiName, name), err);
-}
-
-/* Copy the string that is represented by the UConverterPlatform enum
- * @param platformString An output buffer
- * @param platform An enum representing a platform
- * @return the length of the copied string.
- */
-static int32_t
-ucnv_copyPlatformString(char *platformString, UConverterPlatform pltfrm)
-{
- switch (pltfrm)
- {
- case UCNV_IBM:
- uprv_strcpy(platformString, "ibm-");
- return 4;
- case UCNV_UNKNOWN:
- break;
- }
-
- /* default to empty string */
- *platformString = 0;
- return 0;
-}
-
-/*Assumes a $platform-#codepage.$CONVERTER_FILE_EXTENSION scheme and calls
- *through createConverter*/
-U_CAPI UConverter* U_EXPORT2
-ucnv_openCCSID (int32_t codepage,
- UConverterPlatform platform,
- UErrorCode * err)
-{
- char myName[UCNV_MAX_CONVERTER_NAME_LENGTH];
- int32_t myNameLen;
-
- if (err == NULL || U_FAILURE (*err))
- return NULL;
-
- /* ucnv_copyPlatformString could return "ibm-" or "cp" */
- myNameLen = ucnv_copyPlatformString(myName, platform);
- T_CString_integerToString(myName + myNameLen, codepage, 10);
-
- return ucnv_createConverter(NULL, myName, err);
-}
-
-/* Creating a temporary stack-based object that can be used in one thread,
-and created from a converter that is shared across threads.
-*/
-
-U_CAPI UConverter* U_EXPORT2
-ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, UErrorCode *status)
-{
- UConverter *localConverter, *allocatedConverter;
- int32_t stackBufferSize;
- int32_t bufferSizeNeeded;
- UErrorCode cbErr;
- UConverterToUnicodeArgs toUArgs = {
- sizeof(UConverterToUnicodeArgs),
- TRUE,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
- };
- UConverterFromUnicodeArgs fromUArgs = {
- sizeof(UConverterFromUnicodeArgs),
- TRUE,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
- };
-
- UTRACE_ENTRY_OC(UTRACE_UCNV_CLONE);
-
- if (status == NULL || U_FAILURE(*status)){
- UTRACE_EXIT_STATUS(status? *status: U_ILLEGAL_ARGUMENT_ERROR);
- return NULL;
- }
-
- if (cnv == NULL) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- UTRACE_EXIT_STATUS(*status);
- return NULL;
- }
-
- UTRACE_DATA3(UTRACE_OPEN_CLOSE, "clone converter %s at %p into stackBuffer %p",
- ucnv_getName(cnv, status), cnv, stackBuffer);
-
- if (cnv->sharedData->impl->safeClone != NULL) {
- /* call the custom safeClone function for sizing */
- bufferSizeNeeded = 0;
- cnv->sharedData->impl->safeClone(cnv, NULL, &bufferSizeNeeded, status);
- if (U_FAILURE(*status)) {
- UTRACE_EXIT_STATUS(*status);
- return NULL;
- }
- }
- else
- {
- /* inherent sizing */
- bufferSizeNeeded = sizeof(UConverter);
- }
-
- if (pBufferSize == NULL) {
- stackBufferSize = 1;
- pBufferSize = &stackBufferSize;
- } else {
- stackBufferSize = *pBufferSize;
- if (stackBufferSize <= 0){ /* 'preflighting' request - set needed size into *pBufferSize */
- *pBufferSize = bufferSizeNeeded;
- UTRACE_EXIT_VALUE(bufferSizeNeeded);
- return NULL;
- }
- }
-
- /* Adjust (if necessary) the stackBuffer pointer to be aligned correctly for a UConverter.
- * TODO(Jira ICU-20736) Redo this using std::align() once g++4.9 compatibility is no longer needed.
- */
- if (stackBuffer) {
- uintptr_t p = reinterpret_cast<uintptr_t>(stackBuffer);
- uintptr_t aligned_p = (p + alignof(UConverter) - 1) & ~(alignof(UConverter) - 1);
- ptrdiff_t pointerAdjustment = aligned_p - p;
- if (bufferSizeNeeded + pointerAdjustment <= stackBufferSize) {
- stackBuffer = reinterpret_cast<void *>(aligned_p);
- stackBufferSize -= static_cast<int32_t>(pointerAdjustment);
- } else {
- /* prevent using the stack buffer but keep the size > 0 so that we do not just preflight */
- stackBufferSize = 1;
- }
- }
-
- /* Now, see if we must allocate any memory */
- if (stackBufferSize < bufferSizeNeeded || stackBuffer == NULL)
- {
- /* allocate one here...*/
- localConverter = allocatedConverter = (UConverter *) uprv_malloc (bufferSizeNeeded);
-
- if(localConverter == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- UTRACE_EXIT_STATUS(*status);
- return NULL;
- }
- *status = U_SAFECLONE_ALLOCATED_WARNING;
-
- /* record the fact that memory was allocated */
- *pBufferSize = bufferSizeNeeded;
- } else {
- /* just use the stack buffer */
- localConverter = (UConverter*) stackBuffer;
- allocatedConverter = NULL;
- }
-
- uprv_memset(localConverter, 0, bufferSizeNeeded);
-
- /* Copy initial state */
- uprv_memcpy(localConverter, cnv, sizeof(UConverter));
- localConverter->isCopyLocal = localConverter->isExtraLocal = FALSE;
-
- /* copy the substitution string */
- if (cnv->subChars == (uint8_t *)cnv->subUChars) {
- localConverter->subChars = (uint8_t *)localConverter->subUChars;
- } else {
- localConverter->subChars = (uint8_t *)uprv_malloc(UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR);
- if (localConverter->subChars == NULL) {
- uprv_free(allocatedConverter);
- UTRACE_EXIT_STATUS(*status);
- return NULL;
- }
- uprv_memcpy(localConverter->subChars, cnv->subChars, UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR);
- }
-
- /* now either call the safeclone fcn or not */
- if (cnv->sharedData->impl->safeClone != NULL) {
- /* call the custom safeClone function */
- localConverter = cnv->sharedData->impl->safeClone(cnv, localConverter, pBufferSize, status);
- }
-
- if(localConverter==NULL || U_FAILURE(*status)) {
- if (allocatedConverter != NULL && allocatedConverter->subChars != (uint8_t *)allocatedConverter->subUChars) {
- uprv_free(allocatedConverter->subChars);
- }
- uprv_free(allocatedConverter);
- UTRACE_EXIT_STATUS(*status);
- return NULL;
- }
-
- /* increment refcount of shared data if needed */
- if (cnv->sharedData->isReferenceCounted) {
- ucnv_incrementRefCount(cnv->sharedData);
- }
-
- if(localConverter == (UConverter*)stackBuffer) {
- /* we're using user provided data - set to not destroy */
- localConverter->isCopyLocal = TRUE;
- }
-
- /* allow callback functions to handle any memory allocation */
- toUArgs.converter = fromUArgs.converter = localConverter;
- cbErr = U_ZERO_ERROR;
- cnv->fromCharErrorBehaviour(cnv->toUContext, &toUArgs, NULL, 0, UCNV_CLONE, &cbErr);
- cbErr = U_ZERO_ERROR;
- cnv->fromUCharErrorBehaviour(cnv->fromUContext, &fromUArgs, NULL, 0, 0, UCNV_CLONE, &cbErr);
-
- UTRACE_EXIT_PTR_STATUS(localConverter, *status);
- return localConverter;
-}
-
-
-
-/*Decreases the reference counter in the shared immutable section of the object
- *and frees the mutable part*/
-
-U_CAPI void U_EXPORT2
-ucnv_close (UConverter * converter)
-{
- UErrorCode errorCode = U_ZERO_ERROR;
-
- UTRACE_ENTRY_OC(UTRACE_UCNV_CLOSE);
-
- if (converter == NULL)
- {
- UTRACE_EXIT();
- return;
- }
-
- UTRACE_DATA3(UTRACE_OPEN_CLOSE, "close converter %s at %p, isCopyLocal=%b",
- ucnv_getName(converter, &errorCode), converter, converter->isCopyLocal);
-
- /* In order to speed up the close, only call the callbacks when they have been changed.
- This performance check will only work when the callbacks are set within a shared library
- or from user code that statically links this code. */
- /* first, notify the callback functions that the converter is closed */
- if (converter->fromCharErrorBehaviour != UCNV_TO_U_DEFAULT_CALLBACK) {
- UConverterToUnicodeArgs toUArgs = {
- sizeof(UConverterToUnicodeArgs),
- TRUE,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
- };
-
- toUArgs.converter = converter;
- errorCode = U_ZERO_ERROR;
- converter->fromCharErrorBehaviour(converter->toUContext, &toUArgs, NULL, 0, UCNV_CLOSE, &errorCode);
- }
- if (converter->fromUCharErrorBehaviour != UCNV_FROM_U_DEFAULT_CALLBACK) {
- UConverterFromUnicodeArgs fromUArgs = {
- sizeof(UConverterFromUnicodeArgs),
- TRUE,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
- };
- fromUArgs.converter = converter;
- errorCode = U_ZERO_ERROR;
- converter->fromUCharErrorBehaviour(converter->fromUContext, &fromUArgs, NULL, 0, 0, UCNV_CLOSE, &errorCode);
- }
-
- if (converter->sharedData->impl->close != NULL) {
- converter->sharedData->impl->close(converter);
- }
-
- if (converter->subChars != (uint8_t *)converter->subUChars) {
- uprv_free(converter->subChars);
- }
-
- if (converter->sharedData->isReferenceCounted) {
- ucnv_unloadSharedDataIfReady(converter->sharedData);
- }
-
- if(!converter->isCopyLocal){
- uprv_free(converter);
- }
-
- UTRACE_EXIT();
-}
-
-/*returns a single Name from the list, will return NULL if out of bounds
- */
-U_CAPI const char* U_EXPORT2
-ucnv_getAvailableName (int32_t n)
-{
- if (0 <= n && n <= 0xffff) {
- UErrorCode err = U_ZERO_ERROR;
- const char *name = ucnv_bld_getAvailableConverter((uint16_t)n, &err);
- if (U_SUCCESS(err)) {
- return name;
- }
- }
- return NULL;
-}
-
-U_CAPI int32_t U_EXPORT2
-ucnv_countAvailable ()
-{
- UErrorCode err = U_ZERO_ERROR;
- return ucnv_bld_countAvailableConverters(&err);
-}
-
-U_CAPI void U_EXPORT2
-ucnv_getSubstChars (const UConverter * converter,
- char *mySubChar,
- int8_t * len,
- UErrorCode * err)
-{
- if (U_FAILURE (*err))
- return;
-
- if (converter->subCharLen <= 0) {
- /* Unicode string or empty string from ucnv_setSubstString(). */
- *len = 0;
- return;
- }
-
- if (*len < converter->subCharLen) /*not enough space in subChars */
- {
- *err = U_INDEX_OUTOFBOUNDS_ERROR;
- return;
- }
-
- uprv_memcpy (mySubChar, converter->subChars, converter->subCharLen); /*fills in the subchars */
- *len = converter->subCharLen; /*store # of bytes copied to buffer */
-}
-
-U_CAPI void U_EXPORT2
-ucnv_setSubstChars (UConverter * converter,
- const char *mySubChar,
- int8_t len,
- UErrorCode * err)
-{
- if (U_FAILURE (*err))
- return;
-
- /*Makes sure that the subChar is within the codepages char length boundaries */
- if ((len > converter->sharedData->staticData->maxBytesPerChar)
- || (len < converter->sharedData->staticData->minBytesPerChar))
- {
- *err = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- uprv_memcpy (converter->subChars, mySubChar, len); /*copies the subchars */
- converter->subCharLen = len; /*sets the new len */
-
- /*
- * There is currently (2001Feb) no separate API to set/get subChar1.
- * In order to always have subChar written after it is explicitly set,
- * we set subChar1 to 0.
- */
- converter->subChar1 = 0;
-
- return;
-}
-
-U_CAPI void U_EXPORT2
-ucnv_setSubstString(UConverter *cnv,
- const UChar *s,
- int32_t length,
- UErrorCode *err) {
- alignas(UConverter) char cloneBuffer[U_CNV_SAFECLONE_BUFFERSIZE];
- char chars[UCNV_ERROR_BUFFER_LENGTH];
-
- UConverter *clone;
- uint8_t *subChars;
- int32_t cloneSize, length8;
-
- /* Let the following functions check all arguments. */
- cloneSize = sizeof(cloneBuffer);
- clone = ucnv_safeClone(cnv, cloneBuffer, &cloneSize, err);
- ucnv_setFromUCallBack(clone, UCNV_FROM_U_CALLBACK_STOP, NULL, NULL, NULL, err);
- length8 = ucnv_fromUChars(clone, chars, (int32_t)sizeof(chars), s, length, err);
- ucnv_close(clone);
- if (U_FAILURE(*err)) {
- return;
- }
-
- if (cnv->sharedData->impl->writeSub == NULL
-#if !UCONFIG_NO_LEGACY_CONVERSION
- || (cnv->sharedData->staticData->conversionType == UCNV_MBCS &&
- ucnv_MBCSGetType(cnv) != UCNV_EBCDIC_STATEFUL)
-#endif
- ) {
- /* The converter is not stateful. Store the charset bytes as a fixed string. */
- subChars = (uint8_t *)chars;
- } else {
- /*
- * The converter has a non-default writeSub() function, indicating
- * that it is stateful.
- * Store the Unicode string for on-the-fly conversion for correct
- * state handling.
- */
- if (length > UCNV_ERROR_BUFFER_LENGTH) {
- /*
- * Should not occur. The converter should output at least one byte
- * per UChar, which means that ucnv_fromUChars() should catch all
- * overflows.
- */
- *err = U_BUFFER_OVERFLOW_ERROR;
- return;
- }
- subChars = (uint8_t *)s;
- if (length < 0) {
- length = u_strlen(s);
- }
- length8 = length * U_SIZEOF_UCHAR;
- }
-
- /*
- * For storing the substitution string, select either the small buffer inside
- * UConverter or allocate a subChars buffer.
- */
- if (length8 > UCNV_MAX_SUBCHAR_LEN) {
- /* Use a separate buffer for the string. Outside UConverter to not make it too large. */
- if (cnv->subChars == (uint8_t *)cnv->subUChars) {
- /* Allocate a new buffer for the string. */
- cnv->subChars = (uint8_t *)uprv_malloc(UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR);
- if (cnv->subChars == NULL) {
- cnv->subChars = (uint8_t *)cnv->subUChars;
- *err = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- uprv_memset(cnv->subChars, 0, UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR);
- }
- }
-
- /* Copy the substitution string into the UConverter or its subChars buffer. */
- if (length8 == 0) {
- cnv->subCharLen = 0;
- } else {
- uprv_memcpy(cnv->subChars, subChars, length8);
- if (subChars == (uint8_t *)chars) {
- cnv->subCharLen = (int8_t)length8;
- } else /* subChars == s */ {
- cnv->subCharLen = (int8_t)-length;
- }
- }
-
- /* See comment in ucnv_setSubstChars(). */
- cnv->subChar1 = 0;
-}
-
-/*resets the internal states of a converter
- *goal : have the same behaviour than a freshly created converter
- */
-static void _reset(UConverter *converter, UConverterResetChoice choice,
- UBool callCallback) {
- if(converter == NULL) {
- return;
- }
-
- if(callCallback) {
- /* first, notify the callback functions that the converter is reset */
- UErrorCode errorCode;
-
- if(choice<=UCNV_RESET_TO_UNICODE && converter->fromCharErrorBehaviour != UCNV_TO_U_DEFAULT_CALLBACK) {
- UConverterToUnicodeArgs toUArgs = {
- sizeof(UConverterToUnicodeArgs),
- TRUE,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
- };
- toUArgs.converter = converter;
- errorCode = U_ZERO_ERROR;
- converter->fromCharErrorBehaviour(converter->toUContext, &toUArgs, NULL, 0, UCNV_RESET, &errorCode);
- }
- if(choice!=UCNV_RESET_TO_UNICODE && converter->fromUCharErrorBehaviour != UCNV_FROM_U_DEFAULT_CALLBACK) {
- UConverterFromUnicodeArgs fromUArgs = {
- sizeof(UConverterFromUnicodeArgs),
- TRUE,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
- };
- fromUArgs.converter = converter;
- errorCode = U_ZERO_ERROR;
- converter->fromUCharErrorBehaviour(converter->fromUContext, &fromUArgs, NULL, 0, 0, UCNV_RESET, &errorCode);
- }
- }
-
- /* now reset the converter itself */
- if(choice<=UCNV_RESET_TO_UNICODE) {
- converter->toUnicodeStatus = converter->sharedData->toUnicodeStatus;
- converter->mode = 0;
- converter->toULength = 0;
- converter->invalidCharLength = converter->UCharErrorBufferLength = 0;
- converter->preToULength = 0;
- }
- if(choice!=UCNV_RESET_TO_UNICODE) {
- converter->fromUnicodeStatus = 0;
- converter->fromUChar32 = 0;
- converter->invalidUCharLength = converter->charErrorBufferLength = 0;
- converter->preFromUFirstCP = U_SENTINEL;
- converter->preFromULength = 0;
- }
-
- if (converter->sharedData->impl->reset != NULL) {
- /* call the custom reset function */
- converter->sharedData->impl->reset(converter, choice);
- }
-}
-
-U_CAPI void U_EXPORT2
-ucnv_reset(UConverter *converter)
-{
- _reset(converter, UCNV_RESET_BOTH, TRUE);
-}
-
-U_CAPI void U_EXPORT2
-ucnv_resetToUnicode(UConverter *converter)
-{
- _reset(converter, UCNV_RESET_TO_UNICODE, TRUE);
-}
-
-U_CAPI void U_EXPORT2
-ucnv_resetFromUnicode(UConverter *converter)
-{
- _reset(converter, UCNV_RESET_FROM_UNICODE, TRUE);
-}
-
-U_CAPI int8_t U_EXPORT2
-ucnv_getMaxCharSize (const UConverter * converter)
-{
- return converter->maxBytesPerUChar;
-}
-
-
-U_CAPI int8_t U_EXPORT2
-ucnv_getMinCharSize (const UConverter * converter)
-{
- return converter->sharedData->staticData->minBytesPerChar;
-}
-
-U_CAPI const char* U_EXPORT2
-ucnv_getName (const UConverter * converter, UErrorCode * err)
-
-{
- if (U_FAILURE (*err))
- return NULL;
- if(converter->sharedData->impl->getName){
- const char* temp= converter->sharedData->impl->getName(converter);
- if(temp)
- return temp;
- }
- return converter->sharedData->staticData->name;
-}
-
-U_CAPI int32_t U_EXPORT2
-ucnv_getCCSID(const UConverter * converter,
- UErrorCode * err)
-{
- int32_t ccsid;
- if (U_FAILURE (*err))
- return -1;
-
- ccsid = converter->sharedData->staticData->codepage;
- if (ccsid == 0) {
- /* Rare case. This is for cases like gb18030,
- which doesn't have an IBM canonical name, but does have an IBM alias. */
- const char *standardName = ucnv_getStandardName(ucnv_getName(converter, err), "IBM", err);
- if (U_SUCCESS(*err) && standardName) {
- const char *ccsidStr = uprv_strchr(standardName, '-');
- if (ccsidStr) {
- ccsid = (int32_t)atol(ccsidStr+1); /* +1 to skip '-' */
- }
- }
- }
- return ccsid;
-}
-
-
-U_CAPI UConverterPlatform U_EXPORT2
-ucnv_getPlatform (const UConverter * converter,
- UErrorCode * err)
-{
- if (U_FAILURE (*err))
- return UCNV_UNKNOWN;
-
- return (UConverterPlatform)converter->sharedData->staticData->platform;
-}
-
-U_CAPI void U_EXPORT2
- ucnv_getToUCallBack (const UConverter * converter,
- UConverterToUCallback *action,
- const void **context)
-{
- *action = converter->fromCharErrorBehaviour;
- *context = converter->toUContext;
-}
-
-U_CAPI void U_EXPORT2
- ucnv_getFromUCallBack (const UConverter * converter,
- UConverterFromUCallback *action,
- const void **context)
-{
- *action = converter->fromUCharErrorBehaviour;
- *context = converter->fromUContext;
-}
-
-U_CAPI void U_EXPORT2
-ucnv_setToUCallBack (UConverter * converter,
- UConverterToUCallback newAction,
- const void* newContext,
- UConverterToUCallback *oldAction,
- const void** oldContext,
- UErrorCode * err)
-{
- if (U_FAILURE (*err))
- return;
- if (oldAction) *oldAction = converter->fromCharErrorBehaviour;
- converter->fromCharErrorBehaviour = newAction;
- if (oldContext) *oldContext = converter->toUContext;
- converter->toUContext = newContext;
-}
-
-U_CAPI void U_EXPORT2
-ucnv_setFromUCallBack (UConverter * converter,
- UConverterFromUCallback newAction,
- const void* newContext,
- UConverterFromUCallback *oldAction,
- const void** oldContext,
- UErrorCode * err)
-{
- if (U_FAILURE (*err))
- return;
- if (oldAction) *oldAction = converter->fromUCharErrorBehaviour;
- converter->fromUCharErrorBehaviour = newAction;
- if (oldContext) *oldContext = converter->fromUContext;
- converter->fromUContext = newContext;
-}
-
-static void
-_updateOffsets(int32_t *offsets, int32_t length,
- int32_t sourceIndex, int32_t errorInputLength) {
- int32_t *limit;
- int32_t delta, offset;
-
- if(sourceIndex>=0) {
- /*
- * adjust each offset by adding the previous sourceIndex
- * minus the length of the input sequence that caused an
- * error, if any
- */
- delta=sourceIndex-errorInputLength;
- } else {
- /*
- * set each offset to -1 because this conversion function
- * does not handle offsets
- */
- delta=-1;
- }
-
- limit=offsets+length;
- if(delta==0) {
- /* most common case, nothing to do */
- } else if(delta>0) {
- /* add the delta to each offset (but not if the offset is <0) */
- while(offsets<limit) {
- offset=*offsets;
- if(offset>=0) {
- *offsets=offset+delta;
- }
- ++offsets;
- }
- } else /* delta<0 */ {
- /*
- * set each offset to -1 because this conversion function
- * does not handle offsets
- * or the error input sequence started in a previous buffer
- */
- while(offsets<limit) {
- *offsets++=-1;
- }
- }
-}
-
-/* ucnv_fromUnicode --------------------------------------------------------- */
-
-/*
- * Implementation note for m:n conversions
- *
- * While collecting source units to find the longest match for m:n conversion,
- * some source units may need to be stored for a partial match.
- * When a second buffer does not yield a match on all of the previously stored
- * source units, then they must be "replayed", i.e., fed back into the converter.
- *
- * The code relies on the fact that replaying will not nest -
- * converting a replay buffer will not result in a replay.
- * This is because a replay is necessary only after the _continuation_ of a
- * partial match failed, but a replay buffer is converted as a whole.
- * It may result in some of its units being stored again for a partial match,
- * but there will not be a continuation _during_ the replay which could fail.
- *
- * It is conceivable that a callback function could call the converter
- * recursively in a way that causes another replay to be stored, but that
- * would be an error in the callback function.
- * Such violations will cause assertion failures in a debug build,
- * and wrong output, but they will not cause a crash.
- */
-
-static void
-_fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
- UConverterFromUnicode fromUnicode;
- UConverter *cnv;
- const UChar *s;
- char *t;
- int32_t *offsets;
- int32_t sourceIndex;
- int32_t errorInputLength;
- UBool converterSawEndOfInput, calledCallback;
-
- /* variables for m:n conversion */
- UChar replay[UCNV_EXT_MAX_UCHARS];
- const UChar *realSource, *realSourceLimit;
- int32_t realSourceIndex;
- UBool realFlush;
-
- cnv=pArgs->converter;
- s=pArgs->source;
- t=pArgs->target;
- offsets=pArgs->offsets;
-
- /* get the converter implementation function */
- sourceIndex=0;
- if(offsets==NULL) {
- fromUnicode=cnv->sharedData->impl->fromUnicode;
- } else {
- fromUnicode=cnv->sharedData->impl->fromUnicodeWithOffsets;
- if(fromUnicode==NULL) {
- /* there is no WithOffsets implementation */
- fromUnicode=cnv->sharedData->impl->fromUnicode;
- /* we will write -1 for each offset */
- sourceIndex=-1;
- }
- }
-
- if(cnv->preFromULength>=0) {
- /* normal mode */
- realSource=NULL;
-
- /* avoid compiler warnings - not otherwise necessary, and the values do not matter */
- realSourceLimit=NULL;
- realFlush=FALSE;
- realSourceIndex=0;
- } else {
- /*
- * Previous m:n conversion stored source units from a partial match
- * and failed to consume all of them.
- * We need to "replay" them from a temporary buffer and convert them first.
- */
- realSource=pArgs->source;
- realSourceLimit=pArgs->sourceLimit;
- realFlush=pArgs->flush;
- realSourceIndex=sourceIndex;
-
- uprv_memcpy(replay, cnv->preFromU, -cnv->preFromULength*U_SIZEOF_UCHAR);
- pArgs->source=replay;
- pArgs->sourceLimit=replay-cnv->preFromULength;
- pArgs->flush=FALSE;
- sourceIndex=-1;
-
- cnv->preFromULength=0;
- }
-
- /*
- * loop for conversion and error handling
- *
- * loop {
- * convert
- * loop {
- * update offsets
- * handle end of input
- * handle errors/call callback
- * }
- * }
- */
- for(;;) {
- if(U_SUCCESS(*err)) {
- /* convert */
- fromUnicode(pArgs, err);
-
- /*
- * set a flag for whether the converter
- * successfully processed the end of the input
- *
- * need not check cnv->preFromULength==0 because a replay (<0) will cause
- * s<sourceLimit before converterSawEndOfInput is checked
- */
- converterSawEndOfInput=
- (UBool)(U_SUCCESS(*err) &&
- pArgs->flush && pArgs->source==pArgs->sourceLimit &&
- cnv->fromUChar32==0);
- } else {
- /* handle error from ucnv_convertEx() */
- converterSawEndOfInput=FALSE;
- }
-
- /* no callback called yet for this iteration */
- calledCallback=FALSE;
-
- /* no sourceIndex adjustment for conversion, only for callback output */
- errorInputLength=0;
-
- /*
- * loop for offsets and error handling
- *
- * iterates at most 3 times:
- * 1. to clean up after the conversion function
- * 2. after the callback
- * 3. after the callback again if there was truncated input
- */
- for(;;) {
- /* update offsets if we write any */
- if(offsets!=NULL) {
- int32_t length=(int32_t)(pArgs->target-t);
- if(length>0) {
- _updateOffsets(offsets, length, sourceIndex, errorInputLength);
-
- /*
- * if a converter handles offsets and updates the offsets
- * pointer at the end, then pArgs->offset should not change
- * here;
- * however, some converters do not handle offsets at all
- * (sourceIndex<0) or may not update the offsets pointer
- */
- pArgs->offsets=offsets+=length;
- }
-
- if(sourceIndex>=0) {
- sourceIndex+=(int32_t)(pArgs->source-s);
- }
- }
-
- if(cnv->preFromULength<0) {
- /*
- * switch the source to new replay units (cannot occur while replaying)
- * after offset handling and before end-of-input and callback handling
- */
- if(realSource==NULL) {
- realSource=pArgs->source;
- realSourceLimit=pArgs->sourceLimit;
- realFlush=pArgs->flush;
- realSourceIndex=sourceIndex;
-
- uprv_memcpy(replay, cnv->preFromU, -cnv->preFromULength*U_SIZEOF_UCHAR);
- pArgs->source=replay;
- pArgs->sourceLimit=replay-cnv->preFromULength;
- pArgs->flush=FALSE;
- if((sourceIndex+=cnv->preFromULength)<0) {
- sourceIndex=-1;
- }
-
- cnv->preFromULength=0;
- } else {
- /* see implementation note before _fromUnicodeWithCallback() */
- U_ASSERT(realSource==NULL);
- *err=U_INTERNAL_PROGRAM_ERROR;
- }
- }
-
- /* update pointers */
- s=pArgs->source;
- t=pArgs->target;
-
- if(U_SUCCESS(*err)) {
- if(s<pArgs->sourceLimit) {
- /*
- * continue with the conversion loop while there is still input left
- * (continue converting by breaking out of only the inner loop)
- */
- break;
- } else if(realSource!=NULL) {
- /* switch back from replaying to the real source and continue */
- pArgs->source=realSource;
- pArgs->sourceLimit=realSourceLimit;
- pArgs->flush=realFlush;
- sourceIndex=realSourceIndex;
-
- realSource=NULL;
- break;
- } else if(pArgs->flush && cnv->fromUChar32!=0) {
- /*
- * the entire input stream is consumed
- * and there is a partial, truncated input sequence left
- */
-
- /* inject an error and continue with callback handling */
- *err=U_TRUNCATED_CHAR_FOUND;
- calledCallback=FALSE; /* new error condition */
- } else {
- /* input consumed */
- if(pArgs->flush) {
- /*
- * return to the conversion loop once more if the flush
- * flag is set and the conversion function has not
- * successfully processed the end of the input yet
- *
- * (continue converting by breaking out of only the inner loop)
- */
- if(!converterSawEndOfInput) {
- break;
- }
-
- /* reset the converter without calling the callback function */
- _reset(cnv, UCNV_RESET_FROM_UNICODE, FALSE);
- }
-
- /* done successfully */
- return;
- }
- }
-
- /* U_FAILURE(*err) */
- {
- UErrorCode e;
-
- if( calledCallback ||
- (e=*err)==U_BUFFER_OVERFLOW_ERROR ||
- (e!=U_INVALID_CHAR_FOUND &&
- e!=U_ILLEGAL_CHAR_FOUND &&
- e!=U_TRUNCATED_CHAR_FOUND)
- ) {
- /*
- * the callback did not or cannot resolve the error:
- * set output pointers and return
- *
- * the check for buffer overflow is redundant but it is
- * a high-runner case and hopefully documents the intent
- * well
- *
- * if we were replaying, then the replay buffer must be
- * copied back into the UConverter
- * and the real arguments must be restored
- */
- if(realSource!=NULL) {
- int32_t length;
-
- U_ASSERT(cnv->preFromULength==0);
-
- length=(int32_t)(pArgs->sourceLimit-pArgs->source);
- if(length>0) {
- u_memcpy(cnv->preFromU, pArgs->source, length);
- cnv->preFromULength=(int8_t)-length;
- }
-
- pArgs->source=realSource;
- pArgs->sourceLimit=realSourceLimit;
- pArgs->flush=realFlush;
- }
-
- return;
- }
- }
-
- /* callback handling */
- {
- UChar32 codePoint;
-
- /* get and write the code point */
- codePoint=cnv->fromUChar32;
- errorInputLength=0;
- U16_APPEND_UNSAFE(cnv->invalidUCharBuffer, errorInputLength, codePoint);
- cnv->invalidUCharLength=(int8_t)errorInputLength;
-
- /* set the converter state to deal with the next character */
- cnv->fromUChar32=0;
-
- /* call the callback function */
- cnv->fromUCharErrorBehaviour(cnv->fromUContext, pArgs,
- cnv->invalidUCharBuffer, errorInputLength, codePoint,
- *err==U_INVALID_CHAR_FOUND ? UCNV_UNASSIGNED : UCNV_ILLEGAL,
- err);
- }
-
- /*
- * loop back to the offset handling
- *
- * this flag will indicate after offset handling
- * that a callback was called;
- * if the callback did not resolve the error, then we return
- */
- calledCallback=TRUE;
- }
- }
-}
-
-/*
- * Output the fromUnicode overflow buffer.
- * Call this function if(cnv->charErrorBufferLength>0).
- * @return TRUE if overflow
- */
-static UBool
-ucnv_outputOverflowFromUnicode(UConverter *cnv,
- char **target, const char *targetLimit,
- int32_t **pOffsets,
- UErrorCode *err) {
- int32_t *offsets;
- char *overflow, *t;
- int32_t i, length;
-
- t=*target;
- if(pOffsets!=NULL) {
- offsets=*pOffsets;
- } else {
- offsets=NULL;
- }
-
- overflow=(char *)cnv->charErrorBuffer;
- length=cnv->charErrorBufferLength;
- i=0;
- while(i<length) {
- if(t==targetLimit) {
- /* the overflow buffer contains too much, keep the rest */
- int32_t j=0;
-
- do {
- overflow[j++]=overflow[i++];
- } while(i<length);
-
- cnv->charErrorBufferLength=(int8_t)j;
- *target=t;
- if(offsets!=NULL) {
- *pOffsets=offsets;
- }
- *err=U_BUFFER_OVERFLOW_ERROR;
- return TRUE;
- }
-
- /* copy the overflow contents to the target */
- *t++=overflow[i++];
- if(offsets!=NULL) {
- *offsets++=-1; /* no source index available for old output */
- }
- }
-
- /* the overflow buffer is completely copied to the target */
- cnv->charErrorBufferLength=0;
- *target=t;
- if(offsets!=NULL) {
- *pOffsets=offsets;
- }
- return FALSE;
-}
-
-U_CAPI void U_EXPORT2
-ucnv_fromUnicode(UConverter *cnv,
- char **target, const char *targetLimit,
- const UChar **source, const UChar *sourceLimit,
- int32_t *offsets,
- UBool flush,
- UErrorCode *err) {
- UConverterFromUnicodeArgs args;
- const UChar *s;
- char *t;
-
- /* check parameters */
- if(err==NULL || U_FAILURE(*err)) {
- return;
- }
-
- if(cnv==NULL || target==NULL || source==NULL) {
- *err=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- s=*source;
- t=*target;
-
- if ((const void *)U_MAX_PTR(sourceLimit) == (const void *)sourceLimit) {
- /*
- Prevent code from going into an infinite loop in case we do hit this
- limit. The limit pointer is expected to be on a UChar * boundary.
- This also prevents the next argument check from failing.
- */
- sourceLimit = (const UChar *)(((const char *)sourceLimit) - 1);
- }
-
- /*
- * All these conditions should never happen.
- *
- * 1) Make sure that the limits are >= to the address source or target
- *
- * 2) Make sure that the buffer sizes do not exceed the number range for
- * int32_t because some functions use the size (in units or bytes)
- * rather than comparing pointers, and because offsets are int32_t values.
- *
- * size_t is guaranteed to be unsigned and large enough for the job.
- *
- * Return with an error instead of adjusting the limits because we would
- * not be able to maintain the semantics that either the source must be
- * consumed or the target filled (unless an error occurs).
- * An adjustment would be targetLimit=t+0x7fffffff; for example.
- *
- * 3) Make sure that the user didn't incorrectly cast a UChar * pointer
- * to a char * pointer and provide an incomplete UChar code unit.
- */
- if (sourceLimit<s || targetLimit<t ||
- ((size_t)(sourceLimit-s)>(size_t)0x3fffffff && sourceLimit>s) ||
- ((size_t)(targetLimit-t)>(size_t)0x7fffffff && targetLimit>t) ||
- (((const char *)sourceLimit-(const char *)s) & 1) != 0)
- {
- *err=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- /* output the target overflow buffer */
- if( cnv->charErrorBufferLength>0 &&
- ucnv_outputOverflowFromUnicode(cnv, target, targetLimit, &offsets, err)
- ) {
- /* U_BUFFER_OVERFLOW_ERROR */
- return;
- }
- /* *target may have moved, therefore stop using t */
-
- if(!flush && s==sourceLimit && cnv->preFromULength>=0) {
- /* the overflow buffer is emptied and there is no new input: we are done */
- return;
- }
-
- /*
- * Do not simply return with a buffer overflow error if
- * !flush && t==targetLimit
- * because it is possible that the source will not generate any output.
- * For example, the skip callback may be called;
- * it does not output anything.
- */
-
- /* prepare the converter arguments */
- args.converter=cnv;
- args.flush=flush;
- args.offsets=offsets;
- args.source=s;
- args.sourceLimit=sourceLimit;
- args.target=*target;
- args.targetLimit=targetLimit;
- args.size=sizeof(args);
-
- _fromUnicodeWithCallback(&args, err);
-
- *source=args.source;
- *target=args.target;
-}
-
-/* ucnv_toUnicode() --------------------------------------------------------- */
-
-static void
-_toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
- UConverterToUnicode toUnicode;
- UConverter *cnv;
- const char *s;
- UChar *t;
- int32_t *offsets;
- int32_t sourceIndex;
- int32_t errorInputLength;
- UBool converterSawEndOfInput, calledCallback;
-
- /* variables for m:n conversion */
- char replay[UCNV_EXT_MAX_BYTES];
- const char *realSource, *realSourceLimit;
- int32_t realSourceIndex;
- UBool realFlush;
-
- cnv=pArgs->converter;
- s=pArgs->source;
- t=pArgs->target;
- offsets=pArgs->offsets;
-
- /* get the converter implementation function */
- sourceIndex=0;
- if(offsets==NULL) {
- toUnicode=cnv->sharedData->impl->toUnicode;
- } else {
- toUnicode=cnv->sharedData->impl->toUnicodeWithOffsets;
- if(toUnicode==NULL) {
- /* there is no WithOffsets implementation */
- toUnicode=cnv->sharedData->impl->toUnicode;
- /* we will write -1 for each offset */
- sourceIndex=-1;
- }
- }
-
- if(cnv->preToULength>=0) {
- /* normal mode */
- realSource=NULL;
-
- /* avoid compiler warnings - not otherwise necessary, and the values do not matter */
- realSourceLimit=NULL;
- realFlush=FALSE;
- realSourceIndex=0;
- } else {
- /*
- * Previous m:n conversion stored source units from a partial match
- * and failed to consume all of them.
- * We need to "replay" them from a temporary buffer and convert them first.
- */
- realSource=pArgs->source;
- realSourceLimit=pArgs->sourceLimit;
- realFlush=pArgs->flush;
- realSourceIndex=sourceIndex;
-
- uprv_memcpy(replay, cnv->preToU, -cnv->preToULength);
- pArgs->source=replay;
- pArgs->sourceLimit=replay-cnv->preToULength;
- pArgs->flush=FALSE;
- sourceIndex=-1;
-
- cnv->preToULength=0;
- }
-
- /*
- * loop for conversion and error handling
- *
- * loop {
- * convert
- * loop {
- * update offsets
- * handle end of input
- * handle errors/call callback
- * }
- * }
- */
- for(;;) {
- if(U_SUCCESS(*err)) {
- /* convert */
- toUnicode(pArgs, err);
-
- /*
- * set a flag for whether the converter
- * successfully processed the end of the input
- *
- * need not check cnv->preToULength==0 because a replay (<0) will cause
- * s<sourceLimit before converterSawEndOfInput is checked
- */
- converterSawEndOfInput=
- (UBool)(U_SUCCESS(*err) &&
- pArgs->flush && pArgs->source==pArgs->sourceLimit &&
- cnv->toULength==0);
- } else {
- /* handle error from getNextUChar() or ucnv_convertEx() */
- converterSawEndOfInput=FALSE;
- }
-
- /* no callback called yet for this iteration */
- calledCallback=FALSE;
-
- /* no sourceIndex adjustment for conversion, only for callback output */
- errorInputLength=0;
-
- /*
- * loop for offsets and error handling
- *
- * iterates at most 3 times:
- * 1. to clean up after the conversion function
- * 2. after the callback
- * 3. after the callback again if there was truncated input
- */
- for(;;) {
- /* update offsets if we write any */
- if(offsets!=NULL) {
- int32_t length=(int32_t)(pArgs->target-t);
- if(length>0) {
- _updateOffsets(offsets, length, sourceIndex, errorInputLength);
-
- /*
- * if a converter handles offsets and updates the offsets
- * pointer at the end, then pArgs->offset should not change
- * here;
- * however, some converters do not handle offsets at all
- * (sourceIndex<0) or may not update the offsets pointer
- */
- pArgs->offsets=offsets+=length;
- }
-
- if(sourceIndex>=0) {
- sourceIndex+=(int32_t)(pArgs->source-s);
- }
- }
-
- if(cnv->preToULength<0) {
- /*
- * switch the source to new replay units (cannot occur while replaying)
- * after offset handling and before end-of-input and callback handling
- */
- if(realSource==NULL) {
- realSource=pArgs->source;
- realSourceLimit=pArgs->sourceLimit;
- realFlush=pArgs->flush;
- realSourceIndex=sourceIndex;
-
- uprv_memcpy(replay, cnv->preToU, -cnv->preToULength);
- pArgs->source=replay;
- pArgs->sourceLimit=replay-cnv->preToULength;
- pArgs->flush=FALSE;
- if((sourceIndex+=cnv->preToULength)<0) {
- sourceIndex=-1;
- }
-
- cnv->preToULength=0;
- } else {
- /* see implementation note before _fromUnicodeWithCallback() */
- U_ASSERT(realSource==NULL);
- *err=U_INTERNAL_PROGRAM_ERROR;
- }
- }
-
- /* update pointers */
- s=pArgs->source;
- t=pArgs->target;
-
- if(U_SUCCESS(*err)) {
- if(s<pArgs->sourceLimit) {
- /*
- * continue with the conversion loop while there is still input left
- * (continue converting by breaking out of only the inner loop)
- */
- break;
- } else if(realSource!=NULL) {
- /* switch back from replaying to the real source and continue */
- pArgs->source=realSource;
- pArgs->sourceLimit=realSourceLimit;
- pArgs->flush=realFlush;
- sourceIndex=realSourceIndex;
-
- realSource=NULL;
- break;
- } else if(pArgs->flush && cnv->toULength>0) {
- /*
- * the entire input stream is consumed
- * and there is a partial, truncated input sequence left
- */
-
- /* inject an error and continue with callback handling */
- *err=U_TRUNCATED_CHAR_FOUND;
- calledCallback=FALSE; /* new error condition */
- } else {
- /* input consumed */
- if(pArgs->flush) {
- /*
- * return to the conversion loop once more if the flush
- * flag is set and the conversion function has not
- * successfully processed the end of the input yet
- *
- * (continue converting by breaking out of only the inner loop)
- */
- if(!converterSawEndOfInput) {
- break;
- }
-
- /* reset the converter without calling the callback function */
- _reset(cnv, UCNV_RESET_TO_UNICODE, FALSE);
- }
-
- /* done successfully */
- return;
- }
- }
-
- /* U_FAILURE(*err) */
- {
- UErrorCode e;
-
- if( calledCallback ||
- (e=*err)==U_BUFFER_OVERFLOW_ERROR ||
- (e!=U_INVALID_CHAR_FOUND &&
- e!=U_ILLEGAL_CHAR_FOUND &&
- e!=U_TRUNCATED_CHAR_FOUND &&
- e!=U_ILLEGAL_ESCAPE_SEQUENCE &&
- e!=U_UNSUPPORTED_ESCAPE_SEQUENCE)
- ) {
- /*
- * the callback did not or cannot resolve the error:
- * set output pointers and return
- *
- * the check for buffer overflow is redundant but it is
- * a high-runner case and hopefully documents the intent
- * well
- *
- * if we were replaying, then the replay buffer must be
- * copied back into the UConverter
- * and the real arguments must be restored
- */
- if(realSource!=NULL) {
- int32_t length;
-
- U_ASSERT(cnv->preToULength==0);
-
- length=(int32_t)(pArgs->sourceLimit-pArgs->source);
- if(length>0) {
- uprv_memcpy(cnv->preToU, pArgs->source, length);
- cnv->preToULength=(int8_t)-length;
- }
-
- pArgs->source=realSource;
- pArgs->sourceLimit=realSourceLimit;
- pArgs->flush=realFlush;
- }
-
- return;
- }
- }
-
- /* copy toUBytes[] to invalidCharBuffer[] */
- errorInputLength=cnv->invalidCharLength=cnv->toULength;
- if(errorInputLength>0) {
- uprv_memcpy(cnv->invalidCharBuffer, cnv->toUBytes, errorInputLength);
- }
-
- /* set the converter state to deal with the next character */
- cnv->toULength=0;
-
- /* call the callback function */
- if(cnv->toUCallbackReason==UCNV_ILLEGAL && *err==U_INVALID_CHAR_FOUND) {
- cnv->toUCallbackReason = UCNV_UNASSIGNED;
- }
- cnv->fromCharErrorBehaviour(cnv->toUContext, pArgs,
- cnv->invalidCharBuffer, errorInputLength,
- cnv->toUCallbackReason,
- err);
- cnv->toUCallbackReason = UCNV_ILLEGAL; /* reset to default value */
-
- /*
- * loop back to the offset handling
- *
- * this flag will indicate after offset handling
- * that a callback was called;
- * if the callback did not resolve the error, then we return
- */
- calledCallback=TRUE;
- }
- }
-}
-
-/*
- * Output the toUnicode overflow buffer.
- * Call this function if(cnv->UCharErrorBufferLength>0).
- * @return TRUE if overflow
- */
-static UBool
-ucnv_outputOverflowToUnicode(UConverter *cnv,
- UChar **target, const UChar *targetLimit,
- int32_t **pOffsets,
- UErrorCode *err) {
- int32_t *offsets;
- UChar *overflow, *t;
- int32_t i, length;
-
- t=*target;
- if(pOffsets!=NULL) {
- offsets=*pOffsets;
- } else {
- offsets=NULL;
- }
-
- overflow=cnv->UCharErrorBuffer;
- length=cnv->UCharErrorBufferLength;
- i=0;
- while(i<length) {
- if(t==targetLimit) {
- /* the overflow buffer contains too much, keep the rest */
- int32_t j=0;
-
- do {
- overflow[j++]=overflow[i++];
- } while(i<length);
-
- cnv->UCharErrorBufferLength=(int8_t)j;
- *target=t;
- if(offsets!=NULL) {
- *pOffsets=offsets;
- }
- *err=U_BUFFER_OVERFLOW_ERROR;
- return TRUE;
- }
-
- /* copy the overflow contents to the target */
- *t++=overflow[i++];
- if(offsets!=NULL) {
- *offsets++=-1; /* no source index available for old output */
- }
- }
-
- /* the overflow buffer is completely copied to the target */
- cnv->UCharErrorBufferLength=0;
- *target=t;
- if(offsets!=NULL) {
- *pOffsets=offsets;
- }
- return FALSE;
-}
-
-U_CAPI void U_EXPORT2
-ucnv_toUnicode(UConverter *cnv,
- UChar **target, const UChar *targetLimit,
- const char **source, const char *sourceLimit,
- int32_t *offsets,
- UBool flush,
- UErrorCode *err) {
- UConverterToUnicodeArgs args;
- const char *s;
- UChar *t;
-
- /* check parameters */
- if(err==NULL || U_FAILURE(*err)) {
- return;
- }
-
- if(cnv==NULL || target==NULL || source==NULL) {
- *err=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- s=*source;
- t=*target;
-
- if ((const void *)U_MAX_PTR(targetLimit) == (const void *)targetLimit) {
- /*
- Prevent code from going into an infinite loop in case we do hit this
- limit. The limit pointer is expected to be on a UChar * boundary.
- This also prevents the next argument check from failing.
- */
- targetLimit = (const UChar *)(((const char *)targetLimit) - 1);
- }
-
- /*
- * All these conditions should never happen.
- *
- * 1) Make sure that the limits are >= to the address source or target
- *
- * 2) Make sure that the buffer sizes do not exceed the number range for
- * int32_t because some functions use the size (in units or bytes)
- * rather than comparing pointers, and because offsets are int32_t values.
- *
- * size_t is guaranteed to be unsigned and large enough for the job.
- *
- * Return with an error instead of adjusting the limits because we would
- * not be able to maintain the semantics that either the source must be
- * consumed or the target filled (unless an error occurs).
- * An adjustment would be sourceLimit=t+0x7fffffff; for example.
- *
- * 3) Make sure that the user didn't incorrectly cast a UChar * pointer
- * to a char * pointer and provide an incomplete UChar code unit.
- */
- if (sourceLimit<s || targetLimit<t ||
- ((size_t)(sourceLimit-s)>(size_t)0x7fffffff && sourceLimit>s) ||
- ((size_t)(targetLimit-t)>(size_t)0x3fffffff && targetLimit>t) ||
- (((const char *)targetLimit-(const char *)t) & 1) != 0
- ) {
- *err=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- /* output the target overflow buffer */
- if( cnv->UCharErrorBufferLength>0 &&
- ucnv_outputOverflowToUnicode(cnv, target, targetLimit, &offsets, err)
- ) {
- /* U_BUFFER_OVERFLOW_ERROR */
- return;
- }
- /* *target may have moved, therefore stop using t */
-
- if(!flush && s==sourceLimit && cnv->preToULength>=0) {
- /* the overflow buffer is emptied and there is no new input: we are done */
- return;
- }
-
- /*
- * Do not simply return with a buffer overflow error if
- * !flush && t==targetLimit
- * because it is possible that the source will not generate any output.
- * For example, the skip callback may be called;
- * it does not output anything.
- */
-
- /* prepare the converter arguments */
- args.converter=cnv;
- args.flush=flush;
- args.offsets=offsets;
- args.source=s;
- args.sourceLimit=sourceLimit;
- args.target=*target;
- args.targetLimit=targetLimit;
- args.size=sizeof(args);
-
- _toUnicodeWithCallback(&args, err);
-
- *source=args.source;
- *target=args.target;
-}
-
-/* ucnv_to/fromUChars() ----------------------------------------------------- */
-
-U_CAPI int32_t U_EXPORT2
-ucnv_fromUChars(UConverter *cnv,
- char *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
- UErrorCode *pErrorCode) {
- const UChar *srcLimit;
- char *originalDest, *destLimit;
- int32_t destLength;
-
- /* check arguments */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
-
- if( cnv==NULL ||
- destCapacity<0 || (destCapacity>0 && dest==NULL) ||
- srcLength<-1 || (srcLength!=0 && src==NULL)
- ) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* initialize */
- ucnv_resetFromUnicode(cnv);
- originalDest=dest;
- if(srcLength==-1) {
- srcLength=u_strlen(src);
- }
- if(srcLength>0) {
- srcLimit=src+srcLength;
- destCapacity=pinCapacity(dest, destCapacity);
- destLimit=dest+destCapacity;
-
- /* perform the conversion */
- ucnv_fromUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, TRUE, pErrorCode);
- destLength=(int32_t)(dest-originalDest);
-
- /* if an overflow occurs, then get the preflighting length */
- if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR) {
- char buffer[1024];
-
- destLimit=buffer+sizeof(buffer);
- do {
- dest=buffer;
- *pErrorCode=U_ZERO_ERROR;
- ucnv_fromUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, TRUE, pErrorCode);
- destLength+=(int32_t)(dest-buffer);
- } while(*pErrorCode==U_BUFFER_OVERFLOW_ERROR);
- }
- } else {
- destLength=0;
- }
-
- return u_terminateChars(originalDest, destCapacity, destLength, pErrorCode);
-}
-
-U_CAPI int32_t U_EXPORT2
-ucnv_toUChars(UConverter *cnv,
- UChar *dest, int32_t destCapacity,
- const char *src, int32_t srcLength,
- UErrorCode *pErrorCode) {
- const char *srcLimit;
- UChar *originalDest, *destLimit;
- int32_t destLength;
-
- /* check arguments */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
-
- if( cnv==NULL ||
- destCapacity<0 || (destCapacity>0 && dest==NULL) ||
- srcLength<-1 || (srcLength!=0 && src==NULL))
- {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* initialize */
- ucnv_resetToUnicode(cnv);
- originalDest=dest;
- if(srcLength==-1) {
- srcLength=(int32_t)uprv_strlen(src);
- }
- if(srcLength>0) {
- srcLimit=src+srcLength;
- destCapacity=pinCapacity(dest, destCapacity);
- destLimit=dest+destCapacity;
-
- /* perform the conversion */
- ucnv_toUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, TRUE, pErrorCode);
- destLength=(int32_t)(dest-originalDest);
-
- /* if an overflow occurs, then get the preflighting length */
- if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR)
- {
- UChar buffer[1024];
-
- destLimit=buffer+UPRV_LENGTHOF(buffer);
- do {
- dest=buffer;
- *pErrorCode=U_ZERO_ERROR;
- ucnv_toUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, TRUE, pErrorCode);
- destLength+=(int32_t)(dest-buffer);
- }
- while(*pErrorCode==U_BUFFER_OVERFLOW_ERROR);
- }
- } else {
- destLength=0;
- }
-
- return u_terminateUChars(originalDest, destCapacity, destLength, pErrorCode);
-}
-
-/* ucnv_getNextUChar() ------------------------------------------------------ */
-
-U_CAPI UChar32 U_EXPORT2
-ucnv_getNextUChar(UConverter *cnv,
- const char **source, const char *sourceLimit,
- UErrorCode *err) {
- UConverterToUnicodeArgs args;
- UChar buffer[U16_MAX_LENGTH];
- const char *s;
- UChar32 c;
- int32_t i, length;
-
- /* check parameters */
- if(err==NULL || U_FAILURE(*err)) {
- return 0xffff;
- }
-
- if(cnv==NULL || source==NULL) {
- *err=U_ILLEGAL_ARGUMENT_ERROR;
- return 0xffff;
- }
-
- s=*source;
- if(sourceLimit<s) {
- *err=U_ILLEGAL_ARGUMENT_ERROR;
- return 0xffff;
- }
-
- /*
- * Make sure that the buffer sizes do not exceed the number range for
- * int32_t because some functions use the size (in units or bytes)
- * rather than comparing pointers, and because offsets are int32_t values.
- *
- * size_t is guaranteed to be unsigned and large enough for the job.
- *
- * Return with an error instead of adjusting the limits because we would
- * not be able to maintain the semantics that either the source must be
- * consumed or the target filled (unless an error occurs).
- * An adjustment would be sourceLimit=t+0x7fffffff; for example.
- */
- if(((size_t)(sourceLimit-s)>(size_t)0x7fffffff && sourceLimit>s)) {
- *err=U_ILLEGAL_ARGUMENT_ERROR;
- return 0xffff;
- }
-
- c=U_SENTINEL;
-
- /* flush the target overflow buffer */
- if(cnv->UCharErrorBufferLength>0) {
- UChar *overflow;
-
- overflow=cnv->UCharErrorBuffer;
- i=0;
- length=cnv->UCharErrorBufferLength;
- U16_NEXT(overflow, i, length, c);
-
- /* move the remaining overflow contents up to the beginning */
- if((cnv->UCharErrorBufferLength=(int8_t)(length-i))>0) {
- uprv_memmove(cnv->UCharErrorBuffer, cnv->UCharErrorBuffer+i,
- cnv->UCharErrorBufferLength*U_SIZEOF_UCHAR);
- }
-
- if(!U16_IS_LEAD(c) || i<length) {
- return c;
- }
- /*
- * Continue if the overflow buffer contained only a lead surrogate,
- * in case the converter outputs single surrogates from complete
- * input sequences.
- */
- }
-
- /*
- * flush==TRUE is implied for ucnv_getNextUChar()
- *
- * do not simply return even if s==sourceLimit because the converter may
- * not have seen flush==TRUE before
- */
-
- /* prepare the converter arguments */
- args.converter=cnv;
- args.flush=TRUE;
- args.offsets=NULL;
- args.source=s;
- args.sourceLimit=sourceLimit;
- args.target=buffer;
- args.targetLimit=buffer+1;
- args.size=sizeof(args);
-
- if(c<0) {
- /*
- * call the native getNextUChar() implementation if we are
- * at a character boundary (toULength==0)
- *
- * unlike with _toUnicode(), getNextUChar() implementations must set
- * U_TRUNCATED_CHAR_FOUND for truncated input,
- * in addition to setting toULength/toUBytes[]
- */
- if(cnv->toULength==0 && cnv->sharedData->impl->getNextUChar!=NULL) {
- c=cnv->sharedData->impl->getNextUChar(&args, err);
- *source=s=args.source;
- if(*err==U_INDEX_OUTOFBOUNDS_ERROR) {
- /* reset the converter without calling the callback function */
- _reset(cnv, UCNV_RESET_TO_UNICODE, FALSE);
- return 0xffff; /* no output */
- } else if(U_SUCCESS(*err) && c>=0) {
- return c;
- /*
- * else fall through to use _toUnicode() because
- * UCNV_GET_NEXT_UCHAR_USE_TO_U: the native function did not want to handle it after all
- * U_FAILURE: call _toUnicode() for callback handling (do not output c)
- */
- }
- }
-
- /* convert to one UChar in buffer[0], or handle getNextUChar() errors */
- _toUnicodeWithCallback(&args, err);
-
- if(*err==U_BUFFER_OVERFLOW_ERROR) {
- *err=U_ZERO_ERROR;
- }
-
- i=0;
- length=(int32_t)(args.target-buffer);
- } else {
- /* write the lead surrogate from the overflow buffer */
- buffer[0]=(UChar)c;
- args.target=buffer+1;
- i=0;
- length=1;
- }
-
- /* buffer contents starts at i and ends before length */
-
- if(U_FAILURE(*err)) {
- c=0xffff; /* no output */
- } else if(length==0) {
- /* no input or only state changes */
- *err=U_INDEX_OUTOFBOUNDS_ERROR;
- /* no need to reset explicitly because _toUnicodeWithCallback() did it */
- c=0xffff; /* no output */
- } else {
- c=buffer[0];
- i=1;
- if(!U16_IS_LEAD(c)) {
- /* consume c=buffer[0], done */
- } else {
- /* got a lead surrogate, see if a trail surrogate follows */
- UChar c2;
-
- if(cnv->UCharErrorBufferLength>0) {
- /* got overflow output from the conversion */
- if(U16_IS_TRAIL(c2=cnv->UCharErrorBuffer[0])) {
- /* got a trail surrogate, too */
- c=U16_GET_SUPPLEMENTARY(c, c2);
-
- /* move the remaining overflow contents up to the beginning */
- if((--cnv->UCharErrorBufferLength)>0) {
- uprv_memmove(cnv->UCharErrorBuffer, cnv->UCharErrorBuffer+1,
- cnv->UCharErrorBufferLength*U_SIZEOF_UCHAR);
- }
- } else {
- /* c is an unpaired lead surrogate, just return it */
- }
- } else if(args.source<sourceLimit) {
- /* convert once more, to buffer[1] */
- args.targetLimit=buffer+2;
- _toUnicodeWithCallback(&args, err);
- if(*err==U_BUFFER_OVERFLOW_ERROR) {
- *err=U_ZERO_ERROR;
- }
-
- length=(int32_t)(args.target-buffer);
- if(U_SUCCESS(*err) && length==2 && U16_IS_TRAIL(c2=buffer[1])) {
- /* got a trail surrogate, too */
- c=U16_GET_SUPPLEMENTARY(c, c2);
- i=2;
- }
- }
- }
- }
-
- /*
- * move leftover output from buffer[i..length[
- * into the beginning of the overflow buffer
- */
- if(i<length) {
- /* move further overflow back */
- int32_t delta=length-i;
- if((length=cnv->UCharErrorBufferLength)>0) {
- uprv_memmove(cnv->UCharErrorBuffer+delta, cnv->UCharErrorBuffer,
- length*U_SIZEOF_UCHAR);
- }
- cnv->UCharErrorBufferLength=(int8_t)(length+delta);
-
- cnv->UCharErrorBuffer[0]=buffer[i++];
- if(delta>1) {
- cnv->UCharErrorBuffer[1]=buffer[i];
- }
- }
-
- *source=args.source;
- return c;
-}
-
-/* ucnv_convert() and siblings ---------------------------------------------- */
-
-U_CAPI void U_EXPORT2
-ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
- char **target, const char *targetLimit,
- const char **source, const char *sourceLimit,
- UChar *pivotStart, UChar **pivotSource,
- UChar **pivotTarget, const UChar *pivotLimit,
- UBool reset, UBool flush,
- UErrorCode *pErrorCode) {
- UChar pivotBuffer[CHUNK_SIZE];
- const UChar *myPivotSource;
- UChar *myPivotTarget;
- const char *s;
- char *t;
-
- UConverterToUnicodeArgs toUArgs;
- UConverterFromUnicodeArgs fromUArgs;
- UConverterConvert convert;
-
- /* error checking */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return;
- }
-
- if( targetCnv==NULL || sourceCnv==NULL ||
- source==NULL || *source==NULL ||
- target==NULL || *target==NULL || targetLimit==NULL
- ) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- s=*source;
- t=*target;
- if((sourceLimit!=NULL && sourceLimit<s) || targetLimit<t) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- /*
- * Make sure that the buffer sizes do not exceed the number range for
- * int32_t. See ucnv_toUnicode() for a more detailed comment.
- */
- if(
- (sourceLimit!=NULL && ((size_t)(sourceLimit-s)>(size_t)0x7fffffff && sourceLimit>s)) ||
- ((size_t)(targetLimit-t)>(size_t)0x7fffffff && targetLimit>t)
- ) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- if(pivotStart==NULL) {
- if(!flush) {
- /* streaming conversion requires an explicit pivot buffer */
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- /* use the stack pivot buffer */
- myPivotSource=myPivotTarget=pivotStart=pivotBuffer;
- pivotSource=(UChar **)&myPivotSource;
- pivotTarget=&myPivotTarget;
- pivotLimit=pivotBuffer+CHUNK_SIZE;
- } else if( pivotStart>=pivotLimit ||
- pivotSource==NULL || *pivotSource==NULL ||
- pivotTarget==NULL || *pivotTarget==NULL ||
- pivotLimit==NULL
- ) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- if(sourceLimit==NULL) {
- /* get limit of single-byte-NUL-terminated source string */
- sourceLimit=uprv_strchr(*source, 0);
- }
-
- if(reset) {
- ucnv_resetToUnicode(sourceCnv);
- ucnv_resetFromUnicode(targetCnv);
- *pivotSource=*pivotTarget=pivotStart;
- } else if(targetCnv->charErrorBufferLength>0) {
- /* output the targetCnv overflow buffer */
- if(ucnv_outputOverflowFromUnicode(targetCnv, target, targetLimit, NULL, pErrorCode)) {
- /* U_BUFFER_OVERFLOW_ERROR */
- return;
- }
- /* *target has moved, therefore stop using t */
-
- if( !flush &&
- targetCnv->preFromULength>=0 && *pivotSource==*pivotTarget &&
- sourceCnv->UCharErrorBufferLength==0 && sourceCnv->preToULength>=0 && s==sourceLimit
- ) {
- /* the fromUnicode overflow buffer is emptied and there is no new input: we are done */
- return;
- }
- }
-
- /* Is direct-UTF-8 conversion available? */
- if( sourceCnv->sharedData->staticData->conversionType==UCNV_UTF8 &&
- targetCnv->sharedData->impl->fromUTF8!=NULL
- ) {
- convert=targetCnv->sharedData->impl->fromUTF8;
- } else if( targetCnv->sharedData->staticData->conversionType==UCNV_UTF8 &&
- sourceCnv->sharedData->impl->toUTF8!=NULL
- ) {
- convert=sourceCnv->sharedData->impl->toUTF8;
- } else {
- convert=NULL;
- }
-
- /*
- * If direct-UTF-8 conversion is available, then we use a smaller
- * pivot buffer for error handling and partial matches
- * so that we quickly return to direct conversion.
- *
- * 32 is large enough for UCNV_EXT_MAX_UCHARS and UCNV_ERROR_BUFFER_LENGTH.
- *
- * We could reduce the pivot buffer size further, at the cost of
- * buffer overflows from callbacks.
- * The pivot buffer should not be smaller than the maximum number of
- * fromUnicode extension table input UChars
- * (for m:n conversion, see
- * targetCnv->sharedData->mbcs.extIndexes[UCNV_EXT_COUNT_UCHARS])
- * or 2 for surrogate pairs.
- *
- * Too small a buffer can cause thrashing between pivoting and direct
- * conversion, with function call overhead outweighing the benefits
- * of direct conversion.
- */
- if(convert!=NULL && (pivotLimit-pivotStart)>32) {
- pivotLimit=pivotStart+32;
- }
-
- /* prepare the converter arguments */
- fromUArgs.converter=targetCnv;
- fromUArgs.flush=FALSE;
- fromUArgs.offsets=NULL;
- fromUArgs.target=*target;
- fromUArgs.targetLimit=targetLimit;
- fromUArgs.size=sizeof(fromUArgs);
-
- toUArgs.converter=sourceCnv;
- toUArgs.flush=flush;
- toUArgs.offsets=NULL;
- toUArgs.source=s;
- toUArgs.sourceLimit=sourceLimit;
- toUArgs.targetLimit=pivotLimit;
- toUArgs.size=sizeof(toUArgs);
-
- /*
- * TODO: Consider separating this function into two functions,
- * extracting exactly the conversion loop,
- * for readability and to reduce the set of visible variables.
- *
- * Otherwise stop using s and t from here on.
- */
- s=t=NULL;
-
- /*
- * conversion loop
- *
- * The sequence of steps in the loop may appear backward,
- * but the principle is simple:
- * In the chain of
- * source - sourceCnv overflow - pivot - targetCnv overflow - target
- * empty out later buffers before refilling them from earlier ones.
- *
- * The targetCnv overflow buffer is flushed out only once before the loop.
- */
- for(;;) {
- /*
- * if(pivot not empty or error or replay or flush fromUnicode) {
- * fromUnicode(pivot -> target);
- * }
- *
- * For pivoting conversion; and for direct conversion for
- * error callback handling and flushing the replay buffer.
- */
- if( *pivotSource<*pivotTarget ||
- U_FAILURE(*pErrorCode) ||
- targetCnv->preFromULength<0 ||
- fromUArgs.flush
- ) {
- fromUArgs.source=*pivotSource;
- fromUArgs.sourceLimit=*pivotTarget;
- _fromUnicodeWithCallback(&fromUArgs, pErrorCode);
- if(U_FAILURE(*pErrorCode)) {
- /* target overflow, or conversion error */
- *pivotSource=(UChar *)fromUArgs.source;
- break;
- }
-
- /*
- * _fromUnicodeWithCallback() must have consumed the pivot contents
- * (*pivotSource==*pivotTarget) since it returned with U_SUCCESS()
- */
- }
-
- /* The pivot buffer is empty; reset it so we start at pivotStart. */
- *pivotSource=*pivotTarget=pivotStart;
-
- /*
- * if(sourceCnv overflow buffer not empty) {
- * move(sourceCnv overflow buffer -> pivot);
- * continue;
- * }
- */
- /* output the sourceCnv overflow buffer */
- if(sourceCnv->UCharErrorBufferLength>0) {
- if(ucnv_outputOverflowToUnicode(sourceCnv, pivotTarget, pivotLimit, NULL, pErrorCode)) {
- /* U_BUFFER_OVERFLOW_ERROR */
- *pErrorCode=U_ZERO_ERROR;
- }
- continue;
- }
-
- /*
- * check for end of input and break if done
- *
- * Checking both flush and fromUArgs.flush ensures that the converters
- * have been called with the flush flag set if the ucnv_convertEx()
- * caller set it.
- */
- if( toUArgs.source==sourceLimit &&
- sourceCnv->preToULength>=0 && sourceCnv->toULength==0 &&
- (!flush || fromUArgs.flush)
- ) {
- /* done successfully */
- break;
- }
-
- /*
- * use direct conversion if available
- * but not if continuing a partial match
- * or flushing the toUnicode replay buffer
- */
- if(convert!=NULL && targetCnv->preFromUFirstCP<0 && sourceCnv->preToULength==0) {
- if(*pErrorCode==U_USING_DEFAULT_WARNING) {
- /* remove a warning that may be set by this function */
- *pErrorCode=U_ZERO_ERROR;
- }
- convert(&fromUArgs, &toUArgs, pErrorCode);
- if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR) {
- break;
- } else if(U_FAILURE(*pErrorCode)) {
- if(sourceCnv->toULength>0) {
- /*
- * Fall through to calling _toUnicodeWithCallback()
- * for callback handling.
- *
- * The pivot buffer will be reset with
- * *pivotSource=*pivotTarget=pivotStart;
- * which indicates a toUnicode error to the caller
- * (*pivotSource==pivotStart shows no pivot UChars consumed).
- */
- } else {
- /*
- * Indicate a fromUnicode error to the caller
- * (*pivotSource>pivotStart shows some pivot UChars consumed).
- */
- *pivotSource=*pivotTarget=pivotStart+1;
- /*
- * Loop around to calling _fromUnicodeWithCallbacks()
- * for callback handling.
- */
- continue;
- }
- } else if(*pErrorCode==U_USING_DEFAULT_WARNING) {
- /*
- * No error, but the implementation requested to temporarily
- * fall back to pivoting.
- */
- *pErrorCode=U_ZERO_ERROR;
- /*
- * The following else branches are almost identical to the end-of-input
- * handling in _toUnicodeWithCallback().
- * Avoid calling it just for the end of input.
- */
- } else if(flush && sourceCnv->toULength>0) { /* flush==toUArgs.flush */
- /*
- * the entire input stream is consumed
- * and there is a partial, truncated input sequence left
- */
-
- /* inject an error and continue with callback handling */
- *pErrorCode=U_TRUNCATED_CHAR_FOUND;
- } else {
- /* input consumed */
- if(flush) {
- /* reset the converters without calling the callback functions */
- _reset(sourceCnv, UCNV_RESET_TO_UNICODE, FALSE);
- _reset(targetCnv, UCNV_RESET_FROM_UNICODE, FALSE);
- }
-
- /* done successfully */
- break;
- }
- }
-
- /*
- * toUnicode(source -> pivot);
- *
- * For pivoting conversion; and for direct conversion for
- * error callback handling, continuing partial matches
- * and flushing the replay buffer.
- *
- * The pivot buffer is empty and reset.
- */
- toUArgs.target=pivotStart; /* ==*pivotTarget */
- /* toUArgs.targetLimit=pivotLimit; already set before the loop */
- _toUnicodeWithCallback(&toUArgs, pErrorCode);
- *pivotTarget=toUArgs.target;
- if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR) {
- /* pivot overflow: continue with the conversion loop */
- *pErrorCode=U_ZERO_ERROR;
- } else if(U_FAILURE(*pErrorCode) || (!flush && *pivotTarget==pivotStart)) {
- /* conversion error, or there was nothing left to convert */
- break;
- }
- /*
- * else:
- * _toUnicodeWithCallback() wrote into the pivot buffer,
- * continue with fromUnicode conversion.
- *
- * Set the fromUnicode flush flag if we flush and if toUnicode has
- * processed the end of the input.
- */
- if( flush && toUArgs.source==sourceLimit &&
- sourceCnv->preToULength>=0 &&
- sourceCnv->UCharErrorBufferLength==0
- ) {
- fromUArgs.flush=TRUE;
- }
- }
-
- /*
- * The conversion loop is exited when one of the following is true:
- * - the entire source text has been converted successfully to the target buffer
- * - a target buffer overflow occurred
- * - a conversion error occurred
- */
-
- *source=toUArgs.source;
- *target=fromUArgs.target;
-
- /* terminate the target buffer if possible */
- if(flush && U_SUCCESS(*pErrorCode)) {
- if(*target!=targetLimit) {
- **target=0;
- if(*pErrorCode==U_STRING_NOT_TERMINATED_WARNING) {
- *pErrorCode=U_ZERO_ERROR;
- }
- } else {
- *pErrorCode=U_STRING_NOT_TERMINATED_WARNING;
- }
- }
-}
-
-/* internal implementation of ucnv_convert() etc. with preflighting */
-static int32_t
-ucnv_internalConvert(UConverter *outConverter, UConverter *inConverter,
- char *target, int32_t targetCapacity,
- const char *source, int32_t sourceLength,
- UErrorCode *pErrorCode) {
- UChar pivotBuffer[CHUNK_SIZE];
- UChar *pivot, *pivot2;
-
- char *myTarget;
- const char *sourceLimit;
- const char *targetLimit;
- int32_t targetLength=0;
-
- /* set up */
- if(sourceLength<0) {
- sourceLimit=uprv_strchr(source, 0);
- } else {
- sourceLimit=source+sourceLength;
- }
-
- /* if there is no input data, we're done */
- if(source==sourceLimit) {
- return u_terminateChars(target, targetCapacity, 0, pErrorCode);
- }
-
- pivot=pivot2=pivotBuffer;
- myTarget=target;
- targetLength=0;
-
- if(targetCapacity>0) {
- /* perform real conversion */
- targetLimit=target+targetCapacity;
- ucnv_convertEx(outConverter, inConverter,
- &myTarget, targetLimit,
- &source, sourceLimit,
- pivotBuffer, &pivot, &pivot2, pivotBuffer+CHUNK_SIZE,
- FALSE,
- TRUE,
- pErrorCode);
- targetLength=(int32_t)(myTarget-target);
- }
-
- /*
- * If the output buffer is exhausted (or we are only "preflighting"), we need to stop writing
- * to it but continue the conversion in order to store in targetCapacity
- * the number of bytes that was required.
- */
- if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR || targetCapacity==0)
- {
- char targetBuffer[CHUNK_SIZE];
-
- targetLimit=targetBuffer+CHUNK_SIZE;
- do {
- *pErrorCode=U_ZERO_ERROR;
- myTarget=targetBuffer;
- ucnv_convertEx(outConverter, inConverter,
- &myTarget, targetLimit,
- &source, sourceLimit,
- pivotBuffer, &pivot, &pivot2, pivotBuffer+CHUNK_SIZE,
- FALSE,
- TRUE,
- pErrorCode);
- targetLength+=(int32_t)(myTarget-targetBuffer);
- } while(*pErrorCode==U_BUFFER_OVERFLOW_ERROR);
-
- /* done with preflighting, set warnings and errors as appropriate */
- return u_terminateChars(target, targetCapacity, targetLength, pErrorCode);
- }
-
- /* no need to call u_terminateChars() because ucnv_convertEx() took care of that */
- return targetLength;
-}
-
-U_CAPI int32_t U_EXPORT2
-ucnv_convert(const char *toConverterName, const char *fromConverterName,
- char *target, int32_t targetCapacity,
- const char *source, int32_t sourceLength,
- UErrorCode *pErrorCode) {
- UConverter in, out; /* stack-allocated */
- UConverter *inConverter, *outConverter;
- int32_t targetLength;
-
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
-
- if( source==NULL || sourceLength<-1 ||
- targetCapacity<0 || (targetCapacity>0 && target==NULL)
- ) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* if there is no input data, we're done */
- if(sourceLength==0 || (sourceLength<0 && *source==0)) {
- return u_terminateChars(target, targetCapacity, 0, pErrorCode);
- }
-
- /* create the converters */
- inConverter=ucnv_createConverter(&in, fromConverterName, pErrorCode);
- if(U_FAILURE(*pErrorCode)) {
- return 0;
- }
-
- outConverter=ucnv_createConverter(&out, toConverterName, pErrorCode);
- if(U_FAILURE(*pErrorCode)) {
- ucnv_close(inConverter);
- return 0;
- }
-
- targetLength=ucnv_internalConvert(outConverter, inConverter,
- target, targetCapacity,
- source, sourceLength,
- pErrorCode);
-
- ucnv_close(inConverter);
- ucnv_close(outConverter);
-
- return targetLength;
-}
-
-/* @internal */
-static int32_t
-ucnv_convertAlgorithmic(UBool convertToAlgorithmic,
- UConverterType algorithmicType,
- UConverter *cnv,
- char *target, int32_t targetCapacity,
- const char *source, int32_t sourceLength,
- UErrorCode *pErrorCode) {
- UConverter algoConverterStatic; /* stack-allocated */
- UConverter *algoConverter, *to, *from;
- int32_t targetLength;
-
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
-
- if( cnv==NULL || source==NULL || sourceLength<-1 ||
- targetCapacity<0 || (targetCapacity>0 && target==NULL)
- ) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* if there is no input data, we're done */
- if(sourceLength==0 || (sourceLength<0 && *source==0)) {
- return u_terminateChars(target, targetCapacity, 0, pErrorCode);
- }
-
- /* create the algorithmic converter */
- algoConverter=ucnv_createAlgorithmicConverter(&algoConverterStatic, algorithmicType,
- "", 0, pErrorCode);
- if(U_FAILURE(*pErrorCode)) {
- return 0;
- }
-
- /* reset the other converter */
- if(convertToAlgorithmic) {
- /* cnv->Unicode->algo */
- ucnv_resetToUnicode(cnv);
- to=algoConverter;
- from=cnv;
- } else {
- /* algo->Unicode->cnv */
- ucnv_resetFromUnicode(cnv);
- from=algoConverter;
- to=cnv;
- }
-
- targetLength=ucnv_internalConvert(to, from,
- target, targetCapacity,
- source, sourceLength,
- pErrorCode);
-
- ucnv_close(algoConverter);
-
- return targetLength;
-}
-
-U_CAPI int32_t U_EXPORT2
-ucnv_toAlgorithmic(UConverterType algorithmicType,
- UConverter *cnv,
- char *target, int32_t targetCapacity,
- const char *source, int32_t sourceLength,
- UErrorCode *pErrorCode) {
- return ucnv_convertAlgorithmic(TRUE, algorithmicType, cnv,
- target, targetCapacity,
- source, sourceLength,
- pErrorCode);
-}
-
-U_CAPI int32_t U_EXPORT2
-ucnv_fromAlgorithmic(UConverter *cnv,
- UConverterType algorithmicType,
- char *target, int32_t targetCapacity,
- const char *source, int32_t sourceLength,
- UErrorCode *pErrorCode) {
- return ucnv_convertAlgorithmic(FALSE, algorithmicType, cnv,
- target, targetCapacity,
- source, sourceLength,
- pErrorCode);
-}
-
-U_CAPI UConverterType U_EXPORT2
-ucnv_getType(const UConverter* converter)
-{
- int8_t type = converter->sharedData->staticData->conversionType;
-#if !UCONFIG_NO_LEGACY_CONVERSION
- if(type == UCNV_MBCS) {
- return ucnv_MBCSGetType(converter);
- }
-#endif
- return (UConverterType)type;
-}
-
-U_CAPI void U_EXPORT2
-ucnv_getStarters(const UConverter* converter,
- UBool starters[256],
- UErrorCode* err)
-{
- if (err == NULL || U_FAILURE(*err)) {
- return;
- }
-
- if(converter->sharedData->impl->getStarters != NULL) {
- converter->sharedData->impl->getStarters(converter, starters, err);
- } else {
- *err = U_ILLEGAL_ARGUMENT_ERROR;
- }
-}
-
-static const UAmbiguousConverter *ucnv_getAmbiguous(const UConverter *cnv)
-{
- UErrorCode errorCode;
- const char *name;
- int32_t i;
-
- if(cnv==NULL) {
- return NULL;
- }
-
- errorCode=U_ZERO_ERROR;
- name=ucnv_getName(cnv, &errorCode);
- if(U_FAILURE(errorCode)) {
- return NULL;
- }
-
- for(i=0; i<UPRV_LENGTHOF(ambiguousConverters); ++i)
- {
- if(0==uprv_strcmp(name, ambiguousConverters[i].name))
- {
- return ambiguousConverters+i;
- }
- }
-
- return NULL;
-}
-
-U_CAPI void U_EXPORT2
-ucnv_fixFileSeparator(const UConverter *cnv,
- UChar* source,
- int32_t sourceLength) {
- const UAmbiguousConverter *a;
- int32_t i;
- UChar variant5c;
-
- if(cnv==NULL || source==NULL || sourceLength<=0 || (a=ucnv_getAmbiguous(cnv))==NULL)
- {
- return;
- }
-
- variant5c=a->variant5c;
- for(i=0; i<sourceLength; ++i) {
- if(source[i]==variant5c) {
- source[i]=0x5c;
- }
- }
-}
-
-U_CAPI UBool U_EXPORT2
-ucnv_isAmbiguous(const UConverter *cnv) {
- return (UBool)(ucnv_getAmbiguous(cnv)!=NULL);
-}
-
-U_CAPI void U_EXPORT2
-ucnv_setFallback(UConverter *cnv, UBool usesFallback)
-{
- cnv->useFallback = usesFallback;
-}
-
-U_CAPI UBool U_EXPORT2
-ucnv_usesFallback(const UConverter *cnv)
-{
- return cnv->useFallback;
-}
-
-U_CAPI void U_EXPORT2
-ucnv_getInvalidChars (const UConverter * converter,
- char *errBytes,
- int8_t * len,
- UErrorCode * err)
-{
- if (err == NULL || U_FAILURE(*err))
- {
- return;
- }
- if (len == NULL || errBytes == NULL || converter == NULL)
- {
- *err = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- if (*len < converter->invalidCharLength)
- {
- *err = U_INDEX_OUTOFBOUNDS_ERROR;
- return;
- }
- if ((*len = converter->invalidCharLength) > 0)
- {
- uprv_memcpy (errBytes, converter->invalidCharBuffer, *len);
- }
-}
-
-U_CAPI void U_EXPORT2
-ucnv_getInvalidUChars (const UConverter * converter,
- UChar *errChars,
- int8_t * len,
- UErrorCode * err)
-{
- if (err == NULL || U_FAILURE(*err))
- {
- return;
- }
- if (len == NULL || errChars == NULL || converter == NULL)
- {
- *err = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- if (*len < converter->invalidUCharLength)
- {
- *err = U_INDEX_OUTOFBOUNDS_ERROR;
- return;
- }
- if ((*len = converter->invalidUCharLength) > 0)
- {
- u_memcpy (errChars, converter->invalidUCharBuffer, *len);
- }
-}
-
-#define SIG_MAX_LEN 5
-
-U_CAPI const char* U_EXPORT2
-ucnv_detectUnicodeSignature( const char* source,
- int32_t sourceLength,
- int32_t* signatureLength,
- UErrorCode* pErrorCode) {
- int32_t dummy;
-
- /* initial 0xa5 bytes: make sure that if we read <SIG_MAX_LEN
- * bytes we don't misdetect something
- */
- char start[SIG_MAX_LEN]={ '\xa5', '\xa5', '\xa5', '\xa5', '\xa5' };
- int i = 0;
-
- if((pErrorCode==NULL) || U_FAILURE(*pErrorCode)){
- return NULL;
- }
-
- if(source == NULL || sourceLength < -1){
- *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
- }
-
- if(signatureLength == NULL) {
- signatureLength = &dummy;
- }
-
- if(sourceLength==-1){
- sourceLength=(int32_t)uprv_strlen(source);
- }
-
+ucnv_openPackage (const char *packageName, const char *converterName, UErrorCode * err)
+{
+ return ucnv_createConverterFromPackage(packageName, converterName, err);
+}
+
+/*Extracts the UChar* to a char* and calls through createConverter */
+U_CAPI UConverter* U_EXPORT2
+ucnv_openU (const UChar * name,
+ UErrorCode * err)
+{
+ char asciiName[UCNV_MAX_CONVERTER_NAME_LENGTH];
+
+ if (err == NULL || U_FAILURE(*err))
+ return NULL;
+ if (name == NULL)
+ return ucnv_open (NULL, err);
+ if (u_strlen(name) >= UCNV_MAX_CONVERTER_NAME_LENGTH)
+ {
+ *err = U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
+ }
+ return ucnv_open(u_austrcpy(asciiName, name), err);
+}
+
+/* Copy the string that is represented by the UConverterPlatform enum
+ * @param platformString An output buffer
+ * @param platform An enum representing a platform
+ * @return the length of the copied string.
+ */
+static int32_t
+ucnv_copyPlatformString(char *platformString, UConverterPlatform pltfrm)
+{
+ switch (pltfrm)
+ {
+ case UCNV_IBM:
+ uprv_strcpy(platformString, "ibm-");
+ return 4;
+ case UCNV_UNKNOWN:
+ break;
+ }
+
+ /* default to empty string */
+ *platformString = 0;
+ return 0;
+}
+
+/*Assumes a $platform-#codepage.$CONVERTER_FILE_EXTENSION scheme and calls
+ *through createConverter*/
+U_CAPI UConverter* U_EXPORT2
+ucnv_openCCSID (int32_t codepage,
+ UConverterPlatform platform,
+ UErrorCode * err)
+{
+ char myName[UCNV_MAX_CONVERTER_NAME_LENGTH];
+ int32_t myNameLen;
+
+ if (err == NULL || U_FAILURE (*err))
+ return NULL;
+
+ /* ucnv_copyPlatformString could return "ibm-" or "cp" */
+ myNameLen = ucnv_copyPlatformString(myName, platform);
+ T_CString_integerToString(myName + myNameLen, codepage, 10);
+
+ return ucnv_createConverter(NULL, myName, err);
+}
+
+/* Creating a temporary stack-based object that can be used in one thread,
+and created from a converter that is shared across threads.
+*/
+
+U_CAPI UConverter* U_EXPORT2
+ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, UErrorCode *status)
+{
+ UConverter *localConverter, *allocatedConverter;
+ int32_t stackBufferSize;
+ int32_t bufferSizeNeeded;
+ UErrorCode cbErr;
+ UConverterToUnicodeArgs toUArgs = {
+ sizeof(UConverterToUnicodeArgs),
+ TRUE,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ };
+ UConverterFromUnicodeArgs fromUArgs = {
+ sizeof(UConverterFromUnicodeArgs),
+ TRUE,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ };
+
+ UTRACE_ENTRY_OC(UTRACE_UCNV_CLONE);
+
+ if (status == NULL || U_FAILURE(*status)){
+ UTRACE_EXIT_STATUS(status? *status: U_ILLEGAL_ARGUMENT_ERROR);
+ return NULL;
+ }
+
+ if (cnv == NULL) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ UTRACE_EXIT_STATUS(*status);
+ return NULL;
+ }
+
+ UTRACE_DATA3(UTRACE_OPEN_CLOSE, "clone converter %s at %p into stackBuffer %p",
+ ucnv_getName(cnv, status), cnv, stackBuffer);
+
+ if (cnv->sharedData->impl->safeClone != NULL) {
+ /* call the custom safeClone function for sizing */
+ bufferSizeNeeded = 0;
+ cnv->sharedData->impl->safeClone(cnv, NULL, &bufferSizeNeeded, status);
+ if (U_FAILURE(*status)) {
+ UTRACE_EXIT_STATUS(*status);
+ return NULL;
+ }
+ }
+ else
+ {
+ /* inherent sizing */
+ bufferSizeNeeded = sizeof(UConverter);
+ }
+
+ if (pBufferSize == NULL) {
+ stackBufferSize = 1;
+ pBufferSize = &stackBufferSize;
+ } else {
+ stackBufferSize = *pBufferSize;
+ if (stackBufferSize <= 0){ /* 'preflighting' request - set needed size into *pBufferSize */
+ *pBufferSize = bufferSizeNeeded;
+ UTRACE_EXIT_VALUE(bufferSizeNeeded);
+ return NULL;
+ }
+ }
+
+ /* Adjust (if necessary) the stackBuffer pointer to be aligned correctly for a UConverter.
+ * TODO(Jira ICU-20736) Redo this using std::align() once g++4.9 compatibility is no longer needed.
+ */
+ if (stackBuffer) {
+ uintptr_t p = reinterpret_cast<uintptr_t>(stackBuffer);
+ uintptr_t aligned_p = (p + alignof(UConverter) - 1) & ~(alignof(UConverter) - 1);
+ ptrdiff_t pointerAdjustment = aligned_p - p;
+ if (bufferSizeNeeded + pointerAdjustment <= stackBufferSize) {
+ stackBuffer = reinterpret_cast<void *>(aligned_p);
+ stackBufferSize -= static_cast<int32_t>(pointerAdjustment);
+ } else {
+ /* prevent using the stack buffer but keep the size > 0 so that we do not just preflight */
+ stackBufferSize = 1;
+ }
+ }
+
+ /* Now, see if we must allocate any memory */
+ if (stackBufferSize < bufferSizeNeeded || stackBuffer == NULL)
+ {
+ /* allocate one here...*/
+ localConverter = allocatedConverter = (UConverter *) uprv_malloc (bufferSizeNeeded);
+
+ if(localConverter == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ UTRACE_EXIT_STATUS(*status);
+ return NULL;
+ }
+ *status = U_SAFECLONE_ALLOCATED_WARNING;
+
+ /* record the fact that memory was allocated */
+ *pBufferSize = bufferSizeNeeded;
+ } else {
+ /* just use the stack buffer */
+ localConverter = (UConverter*) stackBuffer;
+ allocatedConverter = NULL;
+ }
+
+ uprv_memset(localConverter, 0, bufferSizeNeeded);
+
+ /* Copy initial state */
+ uprv_memcpy(localConverter, cnv, sizeof(UConverter));
+ localConverter->isCopyLocal = localConverter->isExtraLocal = FALSE;
+
+ /* copy the substitution string */
+ if (cnv->subChars == (uint8_t *)cnv->subUChars) {
+ localConverter->subChars = (uint8_t *)localConverter->subUChars;
+ } else {
+ localConverter->subChars = (uint8_t *)uprv_malloc(UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR);
+ if (localConverter->subChars == NULL) {
+ uprv_free(allocatedConverter);
+ UTRACE_EXIT_STATUS(*status);
+ return NULL;
+ }
+ uprv_memcpy(localConverter->subChars, cnv->subChars, UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR);
+ }
+
+ /* now either call the safeclone fcn or not */
+ if (cnv->sharedData->impl->safeClone != NULL) {
+ /* call the custom safeClone function */
+ localConverter = cnv->sharedData->impl->safeClone(cnv, localConverter, pBufferSize, status);
+ }
+
+ if(localConverter==NULL || U_FAILURE(*status)) {
+ if (allocatedConverter != NULL && allocatedConverter->subChars != (uint8_t *)allocatedConverter->subUChars) {
+ uprv_free(allocatedConverter->subChars);
+ }
+ uprv_free(allocatedConverter);
+ UTRACE_EXIT_STATUS(*status);
+ return NULL;
+ }
+
+ /* increment refcount of shared data if needed */
+ if (cnv->sharedData->isReferenceCounted) {
+ ucnv_incrementRefCount(cnv->sharedData);
+ }
+
+ if(localConverter == (UConverter*)stackBuffer) {
+ /* we're using user provided data - set to not destroy */
+ localConverter->isCopyLocal = TRUE;
+ }
+
+ /* allow callback functions to handle any memory allocation */
+ toUArgs.converter = fromUArgs.converter = localConverter;
+ cbErr = U_ZERO_ERROR;
+ cnv->fromCharErrorBehaviour(cnv->toUContext, &toUArgs, NULL, 0, UCNV_CLONE, &cbErr);
+ cbErr = U_ZERO_ERROR;
+ cnv->fromUCharErrorBehaviour(cnv->fromUContext, &fromUArgs, NULL, 0, 0, UCNV_CLONE, &cbErr);
+
+ UTRACE_EXIT_PTR_STATUS(localConverter, *status);
+ return localConverter;
+}
+
+
+
+/*Decreases the reference counter in the shared immutable section of the object
+ *and frees the mutable part*/
+
+U_CAPI void U_EXPORT2
+ucnv_close (UConverter * converter)
+{
+ UErrorCode errorCode = U_ZERO_ERROR;
+
+ UTRACE_ENTRY_OC(UTRACE_UCNV_CLOSE);
+
+ if (converter == NULL)
+ {
+ UTRACE_EXIT();
+ return;
+ }
+
+ UTRACE_DATA3(UTRACE_OPEN_CLOSE, "close converter %s at %p, isCopyLocal=%b",
+ ucnv_getName(converter, &errorCode), converter, converter->isCopyLocal);
+
+ /* In order to speed up the close, only call the callbacks when they have been changed.
+ This performance check will only work when the callbacks are set within a shared library
+ or from user code that statically links this code. */
+ /* first, notify the callback functions that the converter is closed */
+ if (converter->fromCharErrorBehaviour != UCNV_TO_U_DEFAULT_CALLBACK) {
+ UConverterToUnicodeArgs toUArgs = {
+ sizeof(UConverterToUnicodeArgs),
+ TRUE,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ };
+
+ toUArgs.converter = converter;
+ errorCode = U_ZERO_ERROR;
+ converter->fromCharErrorBehaviour(converter->toUContext, &toUArgs, NULL, 0, UCNV_CLOSE, &errorCode);
+ }
+ if (converter->fromUCharErrorBehaviour != UCNV_FROM_U_DEFAULT_CALLBACK) {
+ UConverterFromUnicodeArgs fromUArgs = {
+ sizeof(UConverterFromUnicodeArgs),
+ TRUE,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ };
+ fromUArgs.converter = converter;
+ errorCode = U_ZERO_ERROR;
+ converter->fromUCharErrorBehaviour(converter->fromUContext, &fromUArgs, NULL, 0, 0, UCNV_CLOSE, &errorCode);
+ }
+
+ if (converter->sharedData->impl->close != NULL) {
+ converter->sharedData->impl->close(converter);
+ }
+
+ if (converter->subChars != (uint8_t *)converter->subUChars) {
+ uprv_free(converter->subChars);
+ }
+
+ if (converter->sharedData->isReferenceCounted) {
+ ucnv_unloadSharedDataIfReady(converter->sharedData);
+ }
+
+ if(!converter->isCopyLocal){
+ uprv_free(converter);
+ }
+
+ UTRACE_EXIT();
+}
+
+/*returns a single Name from the list, will return NULL if out of bounds
+ */
+U_CAPI const char* U_EXPORT2
+ucnv_getAvailableName (int32_t n)
+{
+ if (0 <= n && n <= 0xffff) {
+ UErrorCode err = U_ZERO_ERROR;
+ const char *name = ucnv_bld_getAvailableConverter((uint16_t)n, &err);
+ if (U_SUCCESS(err)) {
+ return name;
+ }
+ }
+ return NULL;
+}
+
+U_CAPI int32_t U_EXPORT2
+ucnv_countAvailable ()
+{
+ UErrorCode err = U_ZERO_ERROR;
+ return ucnv_bld_countAvailableConverters(&err);
+}
+
+U_CAPI void U_EXPORT2
+ucnv_getSubstChars (const UConverter * converter,
+ char *mySubChar,
+ int8_t * len,
+ UErrorCode * err)
+{
+ if (U_FAILURE (*err))
+ return;
+
+ if (converter->subCharLen <= 0) {
+ /* Unicode string or empty string from ucnv_setSubstString(). */
+ *len = 0;
+ return;
+ }
+
+ if (*len < converter->subCharLen) /*not enough space in subChars */
+ {
+ *err = U_INDEX_OUTOFBOUNDS_ERROR;
+ return;
+ }
+
+ uprv_memcpy (mySubChar, converter->subChars, converter->subCharLen); /*fills in the subchars */
+ *len = converter->subCharLen; /*store # of bytes copied to buffer */
+}
+
+U_CAPI void U_EXPORT2
+ucnv_setSubstChars (UConverter * converter,
+ const char *mySubChar,
+ int8_t len,
+ UErrorCode * err)
+{
+ if (U_FAILURE (*err))
+ return;
+
+ /*Makes sure that the subChar is within the codepages char length boundaries */
+ if ((len > converter->sharedData->staticData->maxBytesPerChar)
+ || (len < converter->sharedData->staticData->minBytesPerChar))
+ {
+ *err = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ uprv_memcpy (converter->subChars, mySubChar, len); /*copies the subchars */
+ converter->subCharLen = len; /*sets the new len */
+
+ /*
+ * There is currently (2001Feb) no separate API to set/get subChar1.
+ * In order to always have subChar written after it is explicitly set,
+ * we set subChar1 to 0.
+ */
+ converter->subChar1 = 0;
+
+ return;
+}
+
+U_CAPI void U_EXPORT2
+ucnv_setSubstString(UConverter *cnv,
+ const UChar *s,
+ int32_t length,
+ UErrorCode *err) {
+ alignas(UConverter) char cloneBuffer[U_CNV_SAFECLONE_BUFFERSIZE];
+ char chars[UCNV_ERROR_BUFFER_LENGTH];
+
+ UConverter *clone;
+ uint8_t *subChars;
+ int32_t cloneSize, length8;
+
+ /* Let the following functions check all arguments. */
+ cloneSize = sizeof(cloneBuffer);
+ clone = ucnv_safeClone(cnv, cloneBuffer, &cloneSize, err);
+ ucnv_setFromUCallBack(clone, UCNV_FROM_U_CALLBACK_STOP, NULL, NULL, NULL, err);
+ length8 = ucnv_fromUChars(clone, chars, (int32_t)sizeof(chars), s, length, err);
+ ucnv_close(clone);
+ if (U_FAILURE(*err)) {
+ return;
+ }
+
+ if (cnv->sharedData->impl->writeSub == NULL
+#if !UCONFIG_NO_LEGACY_CONVERSION
+ || (cnv->sharedData->staticData->conversionType == UCNV_MBCS &&
+ ucnv_MBCSGetType(cnv) != UCNV_EBCDIC_STATEFUL)
+#endif
+ ) {
+ /* The converter is not stateful. Store the charset bytes as a fixed string. */
+ subChars = (uint8_t *)chars;
+ } else {
+ /*
+ * The converter has a non-default writeSub() function, indicating
+ * that it is stateful.
+ * Store the Unicode string for on-the-fly conversion for correct
+ * state handling.
+ */
+ if (length > UCNV_ERROR_BUFFER_LENGTH) {
+ /*
+ * Should not occur. The converter should output at least one byte
+ * per UChar, which means that ucnv_fromUChars() should catch all
+ * overflows.
+ */
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ return;
+ }
+ subChars = (uint8_t *)s;
+ if (length < 0) {
+ length = u_strlen(s);
+ }
+ length8 = length * U_SIZEOF_UCHAR;
+ }
+
+ /*
+ * For storing the substitution string, select either the small buffer inside
+ * UConverter or allocate a subChars buffer.
+ */
+ if (length8 > UCNV_MAX_SUBCHAR_LEN) {
+ /* Use a separate buffer for the string. Outside UConverter to not make it too large. */
+ if (cnv->subChars == (uint8_t *)cnv->subUChars) {
+ /* Allocate a new buffer for the string. */
+ cnv->subChars = (uint8_t *)uprv_malloc(UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR);
+ if (cnv->subChars == NULL) {
+ cnv->subChars = (uint8_t *)cnv->subUChars;
+ *err = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ uprv_memset(cnv->subChars, 0, UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR);
+ }
+ }
+
+ /* Copy the substitution string into the UConverter or its subChars buffer. */
+ if (length8 == 0) {
+ cnv->subCharLen = 0;
+ } else {
+ uprv_memcpy(cnv->subChars, subChars, length8);
+ if (subChars == (uint8_t *)chars) {
+ cnv->subCharLen = (int8_t)length8;
+ } else /* subChars == s */ {
+ cnv->subCharLen = (int8_t)-length;
+ }
+ }
+
+ /* See comment in ucnv_setSubstChars(). */
+ cnv->subChar1 = 0;
+}
+
+/*resets the internal states of a converter
+ *goal : have the same behaviour than a freshly created converter
+ */
+static void _reset(UConverter *converter, UConverterResetChoice choice,
+ UBool callCallback) {
+ if(converter == NULL) {
+ return;
+ }
+
+ if(callCallback) {
+ /* first, notify the callback functions that the converter is reset */
+ UErrorCode errorCode;
+
+ if(choice<=UCNV_RESET_TO_UNICODE && converter->fromCharErrorBehaviour != UCNV_TO_U_DEFAULT_CALLBACK) {
+ UConverterToUnicodeArgs toUArgs = {
+ sizeof(UConverterToUnicodeArgs),
+ TRUE,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ };
+ toUArgs.converter = converter;
+ errorCode = U_ZERO_ERROR;
+ converter->fromCharErrorBehaviour(converter->toUContext, &toUArgs, NULL, 0, UCNV_RESET, &errorCode);
+ }
+ if(choice!=UCNV_RESET_TO_UNICODE && converter->fromUCharErrorBehaviour != UCNV_FROM_U_DEFAULT_CALLBACK) {
+ UConverterFromUnicodeArgs fromUArgs = {
+ sizeof(UConverterFromUnicodeArgs),
+ TRUE,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ };
+ fromUArgs.converter = converter;
+ errorCode = U_ZERO_ERROR;
+ converter->fromUCharErrorBehaviour(converter->fromUContext, &fromUArgs, NULL, 0, 0, UCNV_RESET, &errorCode);
+ }
+ }
+
+ /* now reset the converter itself */
+ if(choice<=UCNV_RESET_TO_UNICODE) {
+ converter->toUnicodeStatus = converter->sharedData->toUnicodeStatus;
+ converter->mode = 0;
+ converter->toULength = 0;
+ converter->invalidCharLength = converter->UCharErrorBufferLength = 0;
+ converter->preToULength = 0;
+ }
+ if(choice!=UCNV_RESET_TO_UNICODE) {
+ converter->fromUnicodeStatus = 0;
+ converter->fromUChar32 = 0;
+ converter->invalidUCharLength = converter->charErrorBufferLength = 0;
+ converter->preFromUFirstCP = U_SENTINEL;
+ converter->preFromULength = 0;
+ }
+
+ if (converter->sharedData->impl->reset != NULL) {
+ /* call the custom reset function */
+ converter->sharedData->impl->reset(converter, choice);
+ }
+}
+
+U_CAPI void U_EXPORT2
+ucnv_reset(UConverter *converter)
+{
+ _reset(converter, UCNV_RESET_BOTH, TRUE);
+}
+
+U_CAPI void U_EXPORT2
+ucnv_resetToUnicode(UConverter *converter)
+{
+ _reset(converter, UCNV_RESET_TO_UNICODE, TRUE);
+}
+
+U_CAPI void U_EXPORT2
+ucnv_resetFromUnicode(UConverter *converter)
+{
+ _reset(converter, UCNV_RESET_FROM_UNICODE, TRUE);
+}
+
+U_CAPI int8_t U_EXPORT2
+ucnv_getMaxCharSize (const UConverter * converter)
+{
+ return converter->maxBytesPerUChar;
+}
+
+
+U_CAPI int8_t U_EXPORT2
+ucnv_getMinCharSize (const UConverter * converter)
+{
+ return converter->sharedData->staticData->minBytesPerChar;
+}
+
+U_CAPI const char* U_EXPORT2
+ucnv_getName (const UConverter * converter, UErrorCode * err)
- while(i<sourceLength&& i<SIG_MAX_LEN){
- start[i]=source[i];
- i++;
- }
-
- if(start[0] == '\xFE' && start[1] == '\xFF') {
- *signatureLength=2;
- return "UTF-16BE";
- } else if(start[0] == '\xFF' && start[1] == '\xFE') {
- if(start[2] == '\x00' && start[3] =='\x00') {
- *signatureLength=4;
- return "UTF-32LE";
- } else {
- *signatureLength=2;
- return "UTF-16LE";
- }
- } else if(start[0] == '\xEF' && start[1] == '\xBB' && start[2] == '\xBF') {
- *signatureLength=3;
- return "UTF-8";
- } else if(start[0] == '\x00' && start[1] == '\x00' &&
- start[2] == '\xFE' && start[3]=='\xFF') {
- *signatureLength=4;
- return "UTF-32BE";
- } else if(start[0] == '\x0E' && start[1] == '\xFE' && start[2] == '\xFF') {
- *signatureLength=3;
- return "SCSU";
- } else if(start[0] == '\xFB' && start[1] == '\xEE' && start[2] == '\x28') {
- *signatureLength=3;
- return "BOCU-1";
- } else if(start[0] == '\x2B' && start[1] == '\x2F' && start[2] == '\x76') {
- /*
- * UTF-7: Initial U+FEFF is encoded as +/v8 or +/v9 or +/v+ or +/v/
- * depending on the second UTF-16 code unit.
- * Detect the entire, closed Unicode mode sequence +/v8- for only U+FEFF
- * if it occurs.
- *
- * So far we have +/v
- */
- if(start[3] == '\x38' && start[4] == '\x2D') {
- /* 5 bytes +/v8- */
- *signatureLength=5;
- return "UTF-7";
- } else if(start[3] == '\x38' || start[3] == '\x39' || start[3] == '\x2B' || start[3] == '\x2F') {
- /* 4 bytes +/v8 or +/v9 or +/v+ or +/v/ */
- *signatureLength=4;
- return "UTF-7";
- }
- }else if(start[0]=='\xDD' && start[1]== '\x73'&& start[2]=='\x66' && start[3]=='\x73'){
- *signatureLength=4;
- return "UTF-EBCDIC";
- }
-
-
- /* no known Unicode signature byte sequence recognized */
- *signatureLength=0;
- return NULL;
-}
-
-U_CAPI int32_t U_EXPORT2
-ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status)
-{
- if(status == NULL || U_FAILURE(*status)){
- return -1;
- }
- if(cnv == NULL){
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return -1;
- }
-
- if(cnv->preFromUFirstCP >= 0){
- return U16_LENGTH(cnv->preFromUFirstCP)+cnv->preFromULength ;
- }else if(cnv->preFromULength < 0){
- return -cnv->preFromULength ;
- }else if(cnv->fromUChar32 > 0){
- return 1;
- }
- return 0;
-
-}
-
-U_CAPI int32_t U_EXPORT2
-ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status){
-
- if(status == NULL || U_FAILURE(*status)){
- return -1;
- }
- if(cnv == NULL){
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return -1;
- }
-
- if(cnv->preToULength > 0){
- return cnv->preToULength ;
- }else if(cnv->preToULength < 0){
- return -cnv->preToULength;
- }else if(cnv->toULength > 0){
- return cnv->toULength;
- }
+{
+ if (U_FAILURE (*err))
+ return NULL;
+ if(converter->sharedData->impl->getName){
+ const char* temp= converter->sharedData->impl->getName(converter);
+ if(temp)
+ return temp;
+ }
+ return converter->sharedData->staticData->name;
+}
+
+U_CAPI int32_t U_EXPORT2
+ucnv_getCCSID(const UConverter * converter,
+ UErrorCode * err)
+{
+ int32_t ccsid;
+ if (U_FAILURE (*err))
+ return -1;
+
+ ccsid = converter->sharedData->staticData->codepage;
+ if (ccsid == 0) {
+ /* Rare case. This is for cases like gb18030,
+ which doesn't have an IBM canonical name, but does have an IBM alias. */
+ const char *standardName = ucnv_getStandardName(ucnv_getName(converter, err), "IBM", err);
+ if (U_SUCCESS(*err) && standardName) {
+ const char *ccsidStr = uprv_strchr(standardName, '-');
+ if (ccsidStr) {
+ ccsid = (int32_t)atol(ccsidStr+1); /* +1 to skip '-' */
+ }
+ }
+ }
+ return ccsid;
+}
+
+
+U_CAPI UConverterPlatform U_EXPORT2
+ucnv_getPlatform (const UConverter * converter,
+ UErrorCode * err)
+{
+ if (U_FAILURE (*err))
+ return UCNV_UNKNOWN;
+
+ return (UConverterPlatform)converter->sharedData->staticData->platform;
+}
+
+U_CAPI void U_EXPORT2
+ ucnv_getToUCallBack (const UConverter * converter,
+ UConverterToUCallback *action,
+ const void **context)
+{
+ *action = converter->fromCharErrorBehaviour;
+ *context = converter->toUContext;
+}
+
+U_CAPI void U_EXPORT2
+ ucnv_getFromUCallBack (const UConverter * converter,
+ UConverterFromUCallback *action,
+ const void **context)
+{
+ *action = converter->fromUCharErrorBehaviour;
+ *context = converter->fromUContext;
+}
+
+U_CAPI void U_EXPORT2
+ucnv_setToUCallBack (UConverter * converter,
+ UConverterToUCallback newAction,
+ const void* newContext,
+ UConverterToUCallback *oldAction,
+ const void** oldContext,
+ UErrorCode * err)
+{
+ if (U_FAILURE (*err))
+ return;
+ if (oldAction) *oldAction = converter->fromCharErrorBehaviour;
+ converter->fromCharErrorBehaviour = newAction;
+ if (oldContext) *oldContext = converter->toUContext;
+ converter->toUContext = newContext;
+}
+
+U_CAPI void U_EXPORT2
+ucnv_setFromUCallBack (UConverter * converter,
+ UConverterFromUCallback newAction,
+ const void* newContext,
+ UConverterFromUCallback *oldAction,
+ const void** oldContext,
+ UErrorCode * err)
+{
+ if (U_FAILURE (*err))
+ return;
+ if (oldAction) *oldAction = converter->fromUCharErrorBehaviour;
+ converter->fromUCharErrorBehaviour = newAction;
+ if (oldContext) *oldContext = converter->fromUContext;
+ converter->fromUContext = newContext;
+}
+
+static void
+_updateOffsets(int32_t *offsets, int32_t length,
+ int32_t sourceIndex, int32_t errorInputLength) {
+ int32_t *limit;
+ int32_t delta, offset;
+
+ if(sourceIndex>=0) {
+ /*
+ * adjust each offset by adding the previous sourceIndex
+ * minus the length of the input sequence that caused an
+ * error, if any
+ */
+ delta=sourceIndex-errorInputLength;
+ } else {
+ /*
+ * set each offset to -1 because this conversion function
+ * does not handle offsets
+ */
+ delta=-1;
+ }
+
+ limit=offsets+length;
+ if(delta==0) {
+ /* most common case, nothing to do */
+ } else if(delta>0) {
+ /* add the delta to each offset (but not if the offset is <0) */
+ while(offsets<limit) {
+ offset=*offsets;
+ if(offset>=0) {
+ *offsets=offset+delta;
+ }
+ ++offsets;
+ }
+ } else /* delta<0 */ {
+ /*
+ * set each offset to -1 because this conversion function
+ * does not handle offsets
+ * or the error input sequence started in a previous buffer
+ */
+ while(offsets<limit) {
+ *offsets++=-1;
+ }
+ }
+}
+
+/* ucnv_fromUnicode --------------------------------------------------------- */
+
+/*
+ * Implementation note for m:n conversions
+ *
+ * While collecting source units to find the longest match for m:n conversion,
+ * some source units may need to be stored for a partial match.
+ * When a second buffer does not yield a match on all of the previously stored
+ * source units, then they must be "replayed", i.e., fed back into the converter.
+ *
+ * The code relies on the fact that replaying will not nest -
+ * converting a replay buffer will not result in a replay.
+ * This is because a replay is necessary only after the _continuation_ of a
+ * partial match failed, but a replay buffer is converted as a whole.
+ * It may result in some of its units being stored again for a partial match,
+ * but there will not be a continuation _during_ the replay which could fail.
+ *
+ * It is conceivable that a callback function could call the converter
+ * recursively in a way that causes another replay to be stored, but that
+ * would be an error in the callback function.
+ * Such violations will cause assertion failures in a debug build,
+ * and wrong output, but they will not cause a crash.
+ */
+
+static void
+_fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
+ UConverterFromUnicode fromUnicode;
+ UConverter *cnv;
+ const UChar *s;
+ char *t;
+ int32_t *offsets;
+ int32_t sourceIndex;
+ int32_t errorInputLength;
+ UBool converterSawEndOfInput, calledCallback;
+
+ /* variables for m:n conversion */
+ UChar replay[UCNV_EXT_MAX_UCHARS];
+ const UChar *realSource, *realSourceLimit;
+ int32_t realSourceIndex;
+ UBool realFlush;
+
+ cnv=pArgs->converter;
+ s=pArgs->source;
+ t=pArgs->target;
+ offsets=pArgs->offsets;
+
+ /* get the converter implementation function */
+ sourceIndex=0;
+ if(offsets==NULL) {
+ fromUnicode=cnv->sharedData->impl->fromUnicode;
+ } else {
+ fromUnicode=cnv->sharedData->impl->fromUnicodeWithOffsets;
+ if(fromUnicode==NULL) {
+ /* there is no WithOffsets implementation */
+ fromUnicode=cnv->sharedData->impl->fromUnicode;
+ /* we will write -1 for each offset */
+ sourceIndex=-1;
+ }
+ }
+
+ if(cnv->preFromULength>=0) {
+ /* normal mode */
+ realSource=NULL;
+
+ /* avoid compiler warnings - not otherwise necessary, and the values do not matter */
+ realSourceLimit=NULL;
+ realFlush=FALSE;
+ realSourceIndex=0;
+ } else {
+ /*
+ * Previous m:n conversion stored source units from a partial match
+ * and failed to consume all of them.
+ * We need to "replay" them from a temporary buffer and convert them first.
+ */
+ realSource=pArgs->source;
+ realSourceLimit=pArgs->sourceLimit;
+ realFlush=pArgs->flush;
+ realSourceIndex=sourceIndex;
+
+ uprv_memcpy(replay, cnv->preFromU, -cnv->preFromULength*U_SIZEOF_UCHAR);
+ pArgs->source=replay;
+ pArgs->sourceLimit=replay-cnv->preFromULength;
+ pArgs->flush=FALSE;
+ sourceIndex=-1;
+
+ cnv->preFromULength=0;
+ }
+
+ /*
+ * loop for conversion and error handling
+ *
+ * loop {
+ * convert
+ * loop {
+ * update offsets
+ * handle end of input
+ * handle errors/call callback
+ * }
+ * }
+ */
+ for(;;) {
+ if(U_SUCCESS(*err)) {
+ /* convert */
+ fromUnicode(pArgs, err);
+
+ /*
+ * set a flag for whether the converter
+ * successfully processed the end of the input
+ *
+ * need not check cnv->preFromULength==0 because a replay (<0) will cause
+ * s<sourceLimit before converterSawEndOfInput is checked
+ */
+ converterSawEndOfInput=
+ (UBool)(U_SUCCESS(*err) &&
+ pArgs->flush && pArgs->source==pArgs->sourceLimit &&
+ cnv->fromUChar32==0);
+ } else {
+ /* handle error from ucnv_convertEx() */
+ converterSawEndOfInput=FALSE;
+ }
+
+ /* no callback called yet for this iteration */
+ calledCallback=FALSE;
+
+ /* no sourceIndex adjustment for conversion, only for callback output */
+ errorInputLength=0;
+
+ /*
+ * loop for offsets and error handling
+ *
+ * iterates at most 3 times:
+ * 1. to clean up after the conversion function
+ * 2. after the callback
+ * 3. after the callback again if there was truncated input
+ */
+ for(;;) {
+ /* update offsets if we write any */
+ if(offsets!=NULL) {
+ int32_t length=(int32_t)(pArgs->target-t);
+ if(length>0) {
+ _updateOffsets(offsets, length, sourceIndex, errorInputLength);
+
+ /*
+ * if a converter handles offsets and updates the offsets
+ * pointer at the end, then pArgs->offset should not change
+ * here;
+ * however, some converters do not handle offsets at all
+ * (sourceIndex<0) or may not update the offsets pointer
+ */
+ pArgs->offsets=offsets+=length;
+ }
+
+ if(sourceIndex>=0) {
+ sourceIndex+=(int32_t)(pArgs->source-s);
+ }
+ }
+
+ if(cnv->preFromULength<0) {
+ /*
+ * switch the source to new replay units (cannot occur while replaying)
+ * after offset handling and before end-of-input and callback handling
+ */
+ if(realSource==NULL) {
+ realSource=pArgs->source;
+ realSourceLimit=pArgs->sourceLimit;
+ realFlush=pArgs->flush;
+ realSourceIndex=sourceIndex;
+
+ uprv_memcpy(replay, cnv->preFromU, -cnv->preFromULength*U_SIZEOF_UCHAR);
+ pArgs->source=replay;
+ pArgs->sourceLimit=replay-cnv->preFromULength;
+ pArgs->flush=FALSE;
+ if((sourceIndex+=cnv->preFromULength)<0) {
+ sourceIndex=-1;
+ }
+
+ cnv->preFromULength=0;
+ } else {
+ /* see implementation note before _fromUnicodeWithCallback() */
+ U_ASSERT(realSource==NULL);
+ *err=U_INTERNAL_PROGRAM_ERROR;
+ }
+ }
+
+ /* update pointers */
+ s=pArgs->source;
+ t=pArgs->target;
+
+ if(U_SUCCESS(*err)) {
+ if(s<pArgs->sourceLimit) {
+ /*
+ * continue with the conversion loop while there is still input left
+ * (continue converting by breaking out of only the inner loop)
+ */
+ break;
+ } else if(realSource!=NULL) {
+ /* switch back from replaying to the real source and continue */
+ pArgs->source=realSource;
+ pArgs->sourceLimit=realSourceLimit;
+ pArgs->flush=realFlush;
+ sourceIndex=realSourceIndex;
+
+ realSource=NULL;
+ break;
+ } else if(pArgs->flush && cnv->fromUChar32!=0) {
+ /*
+ * the entire input stream is consumed
+ * and there is a partial, truncated input sequence left
+ */
+
+ /* inject an error and continue with callback handling */
+ *err=U_TRUNCATED_CHAR_FOUND;
+ calledCallback=FALSE; /* new error condition */
+ } else {
+ /* input consumed */
+ if(pArgs->flush) {
+ /*
+ * return to the conversion loop once more if the flush
+ * flag is set and the conversion function has not
+ * successfully processed the end of the input yet
+ *
+ * (continue converting by breaking out of only the inner loop)
+ */
+ if(!converterSawEndOfInput) {
+ break;
+ }
+
+ /* reset the converter without calling the callback function */
+ _reset(cnv, UCNV_RESET_FROM_UNICODE, FALSE);
+ }
+
+ /* done successfully */
+ return;
+ }
+ }
+
+ /* U_FAILURE(*err) */
+ {
+ UErrorCode e;
+
+ if( calledCallback ||
+ (e=*err)==U_BUFFER_OVERFLOW_ERROR ||
+ (e!=U_INVALID_CHAR_FOUND &&
+ e!=U_ILLEGAL_CHAR_FOUND &&
+ e!=U_TRUNCATED_CHAR_FOUND)
+ ) {
+ /*
+ * the callback did not or cannot resolve the error:
+ * set output pointers and return
+ *
+ * the check for buffer overflow is redundant but it is
+ * a high-runner case and hopefully documents the intent
+ * well
+ *
+ * if we were replaying, then the replay buffer must be
+ * copied back into the UConverter
+ * and the real arguments must be restored
+ */
+ if(realSource!=NULL) {
+ int32_t length;
+
+ U_ASSERT(cnv->preFromULength==0);
+
+ length=(int32_t)(pArgs->sourceLimit-pArgs->source);
+ if(length>0) {
+ u_memcpy(cnv->preFromU, pArgs->source, length);
+ cnv->preFromULength=(int8_t)-length;
+ }
+
+ pArgs->source=realSource;
+ pArgs->sourceLimit=realSourceLimit;
+ pArgs->flush=realFlush;
+ }
+
+ return;
+ }
+ }
+
+ /* callback handling */
+ {
+ UChar32 codePoint;
+
+ /* get and write the code point */
+ codePoint=cnv->fromUChar32;
+ errorInputLength=0;
+ U16_APPEND_UNSAFE(cnv->invalidUCharBuffer, errorInputLength, codePoint);
+ cnv->invalidUCharLength=(int8_t)errorInputLength;
+
+ /* set the converter state to deal with the next character */
+ cnv->fromUChar32=0;
+
+ /* call the callback function */
+ cnv->fromUCharErrorBehaviour(cnv->fromUContext, pArgs,
+ cnv->invalidUCharBuffer, errorInputLength, codePoint,
+ *err==U_INVALID_CHAR_FOUND ? UCNV_UNASSIGNED : UCNV_ILLEGAL,
+ err);
+ }
+
+ /*
+ * loop back to the offset handling
+ *
+ * this flag will indicate after offset handling
+ * that a callback was called;
+ * if the callback did not resolve the error, then we return
+ */
+ calledCallback=TRUE;
+ }
+ }
+}
+
+/*
+ * Output the fromUnicode overflow buffer.
+ * Call this function if(cnv->charErrorBufferLength>0).
+ * @return TRUE if overflow
+ */
+static UBool
+ucnv_outputOverflowFromUnicode(UConverter *cnv,
+ char **target, const char *targetLimit,
+ int32_t **pOffsets,
+ UErrorCode *err) {
+ int32_t *offsets;
+ char *overflow, *t;
+ int32_t i, length;
+
+ t=*target;
+ if(pOffsets!=NULL) {
+ offsets=*pOffsets;
+ } else {
+ offsets=NULL;
+ }
+
+ overflow=(char *)cnv->charErrorBuffer;
+ length=cnv->charErrorBufferLength;
+ i=0;
+ while(i<length) {
+ if(t==targetLimit) {
+ /* the overflow buffer contains too much, keep the rest */
+ int32_t j=0;
+
+ do {
+ overflow[j++]=overflow[i++];
+ } while(i<length);
+
+ cnv->charErrorBufferLength=(int8_t)j;
+ *target=t;
+ if(offsets!=NULL) {
+ *pOffsets=offsets;
+ }
+ *err=U_BUFFER_OVERFLOW_ERROR;
+ return TRUE;
+ }
+
+ /* copy the overflow contents to the target */
+ *t++=overflow[i++];
+ if(offsets!=NULL) {
+ *offsets++=-1; /* no source index available for old output */
+ }
+ }
+
+ /* the overflow buffer is completely copied to the target */
+ cnv->charErrorBufferLength=0;
+ *target=t;
+ if(offsets!=NULL) {
+ *pOffsets=offsets;
+ }
+ return FALSE;
+}
+
+U_CAPI void U_EXPORT2
+ucnv_fromUnicode(UConverter *cnv,
+ char **target, const char *targetLimit,
+ const UChar **source, const UChar *sourceLimit,
+ int32_t *offsets,
+ UBool flush,
+ UErrorCode *err) {
+ UConverterFromUnicodeArgs args;
+ const UChar *s;
+ char *t;
+
+ /* check parameters */
+ if(err==NULL || U_FAILURE(*err)) {
+ return;
+ }
+
+ if(cnv==NULL || target==NULL || source==NULL) {
+ *err=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ s=*source;
+ t=*target;
+
+ if ((const void *)U_MAX_PTR(sourceLimit) == (const void *)sourceLimit) {
+ /*
+ Prevent code from going into an infinite loop in case we do hit this
+ limit. The limit pointer is expected to be on a UChar * boundary.
+ This also prevents the next argument check from failing.
+ */
+ sourceLimit = (const UChar *)(((const char *)sourceLimit) - 1);
+ }
+
+ /*
+ * All these conditions should never happen.
+ *
+ * 1) Make sure that the limits are >= to the address source or target
+ *
+ * 2) Make sure that the buffer sizes do not exceed the number range for
+ * int32_t because some functions use the size (in units or bytes)
+ * rather than comparing pointers, and because offsets are int32_t values.
+ *
+ * size_t is guaranteed to be unsigned and large enough for the job.
+ *
+ * Return with an error instead of adjusting the limits because we would
+ * not be able to maintain the semantics that either the source must be
+ * consumed or the target filled (unless an error occurs).
+ * An adjustment would be targetLimit=t+0x7fffffff; for example.
+ *
+ * 3) Make sure that the user didn't incorrectly cast a UChar * pointer
+ * to a char * pointer and provide an incomplete UChar code unit.
+ */
+ if (sourceLimit<s || targetLimit<t ||
+ ((size_t)(sourceLimit-s)>(size_t)0x3fffffff && sourceLimit>s) ||
+ ((size_t)(targetLimit-t)>(size_t)0x7fffffff && targetLimit>t) ||
+ (((const char *)sourceLimit-(const char *)s) & 1) != 0)
+ {
+ *err=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ /* output the target overflow buffer */
+ if( cnv->charErrorBufferLength>0 &&
+ ucnv_outputOverflowFromUnicode(cnv, target, targetLimit, &offsets, err)
+ ) {
+ /* U_BUFFER_OVERFLOW_ERROR */
+ return;
+ }
+ /* *target may have moved, therefore stop using t */
+
+ if(!flush && s==sourceLimit && cnv->preFromULength>=0) {
+ /* the overflow buffer is emptied and there is no new input: we are done */
+ return;
+ }
+
+ /*
+ * Do not simply return with a buffer overflow error if
+ * !flush && t==targetLimit
+ * because it is possible that the source will not generate any output.
+ * For example, the skip callback may be called;
+ * it does not output anything.
+ */
+
+ /* prepare the converter arguments */
+ args.converter=cnv;
+ args.flush=flush;
+ args.offsets=offsets;
+ args.source=s;
+ args.sourceLimit=sourceLimit;
+ args.target=*target;
+ args.targetLimit=targetLimit;
+ args.size=sizeof(args);
+
+ _fromUnicodeWithCallback(&args, err);
+
+ *source=args.source;
+ *target=args.target;
+}
+
+/* ucnv_toUnicode() --------------------------------------------------------- */
+
+static void
+_toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
+ UConverterToUnicode toUnicode;
+ UConverter *cnv;
+ const char *s;
+ UChar *t;
+ int32_t *offsets;
+ int32_t sourceIndex;
+ int32_t errorInputLength;
+ UBool converterSawEndOfInput, calledCallback;
+
+ /* variables for m:n conversion */
+ char replay[UCNV_EXT_MAX_BYTES];
+ const char *realSource, *realSourceLimit;
+ int32_t realSourceIndex;
+ UBool realFlush;
+
+ cnv=pArgs->converter;
+ s=pArgs->source;
+ t=pArgs->target;
+ offsets=pArgs->offsets;
+
+ /* get the converter implementation function */
+ sourceIndex=0;
+ if(offsets==NULL) {
+ toUnicode=cnv->sharedData->impl->toUnicode;
+ } else {
+ toUnicode=cnv->sharedData->impl->toUnicodeWithOffsets;
+ if(toUnicode==NULL) {
+ /* there is no WithOffsets implementation */
+ toUnicode=cnv->sharedData->impl->toUnicode;
+ /* we will write -1 for each offset */
+ sourceIndex=-1;
+ }
+ }
+
+ if(cnv->preToULength>=0) {
+ /* normal mode */
+ realSource=NULL;
+
+ /* avoid compiler warnings - not otherwise necessary, and the values do not matter */
+ realSourceLimit=NULL;
+ realFlush=FALSE;
+ realSourceIndex=0;
+ } else {
+ /*
+ * Previous m:n conversion stored source units from a partial match
+ * and failed to consume all of them.
+ * We need to "replay" them from a temporary buffer and convert them first.
+ */
+ realSource=pArgs->source;
+ realSourceLimit=pArgs->sourceLimit;
+ realFlush=pArgs->flush;
+ realSourceIndex=sourceIndex;
+
+ uprv_memcpy(replay, cnv->preToU, -cnv->preToULength);
+ pArgs->source=replay;
+ pArgs->sourceLimit=replay-cnv->preToULength;
+ pArgs->flush=FALSE;
+ sourceIndex=-1;
+
+ cnv->preToULength=0;
+ }
+
+ /*
+ * loop for conversion and error handling
+ *
+ * loop {
+ * convert
+ * loop {
+ * update offsets
+ * handle end of input
+ * handle errors/call callback
+ * }
+ * }
+ */
+ for(;;) {
+ if(U_SUCCESS(*err)) {
+ /* convert */
+ toUnicode(pArgs, err);
+
+ /*
+ * set a flag for whether the converter
+ * successfully processed the end of the input
+ *
+ * need not check cnv->preToULength==0 because a replay (<0) will cause
+ * s<sourceLimit before converterSawEndOfInput is checked
+ */
+ converterSawEndOfInput=
+ (UBool)(U_SUCCESS(*err) &&
+ pArgs->flush && pArgs->source==pArgs->sourceLimit &&
+ cnv->toULength==0);
+ } else {
+ /* handle error from getNextUChar() or ucnv_convertEx() */
+ converterSawEndOfInput=FALSE;
+ }
+
+ /* no callback called yet for this iteration */
+ calledCallback=FALSE;
+
+ /* no sourceIndex adjustment for conversion, only for callback output */
+ errorInputLength=0;
+
+ /*
+ * loop for offsets and error handling
+ *
+ * iterates at most 3 times:
+ * 1. to clean up after the conversion function
+ * 2. after the callback
+ * 3. after the callback again if there was truncated input
+ */
+ for(;;) {
+ /* update offsets if we write any */
+ if(offsets!=NULL) {
+ int32_t length=(int32_t)(pArgs->target-t);
+ if(length>0) {
+ _updateOffsets(offsets, length, sourceIndex, errorInputLength);
+
+ /*
+ * if a converter handles offsets and updates the offsets
+ * pointer at the end, then pArgs->offset should not change
+ * here;
+ * however, some converters do not handle offsets at all
+ * (sourceIndex<0) or may not update the offsets pointer
+ */
+ pArgs->offsets=offsets+=length;
+ }
+
+ if(sourceIndex>=0) {
+ sourceIndex+=(int32_t)(pArgs->source-s);
+ }
+ }
+
+ if(cnv->preToULength<0) {
+ /*
+ * switch the source to new replay units (cannot occur while replaying)
+ * after offset handling and before end-of-input and callback handling
+ */
+ if(realSource==NULL) {
+ realSource=pArgs->source;
+ realSourceLimit=pArgs->sourceLimit;
+ realFlush=pArgs->flush;
+ realSourceIndex=sourceIndex;
+
+ uprv_memcpy(replay, cnv->preToU, -cnv->preToULength);
+ pArgs->source=replay;
+ pArgs->sourceLimit=replay-cnv->preToULength;
+ pArgs->flush=FALSE;
+ if((sourceIndex+=cnv->preToULength)<0) {
+ sourceIndex=-1;
+ }
+
+ cnv->preToULength=0;
+ } else {
+ /* see implementation note before _fromUnicodeWithCallback() */
+ U_ASSERT(realSource==NULL);
+ *err=U_INTERNAL_PROGRAM_ERROR;
+ }
+ }
+
+ /* update pointers */
+ s=pArgs->source;
+ t=pArgs->target;
+
+ if(U_SUCCESS(*err)) {
+ if(s<pArgs->sourceLimit) {
+ /*
+ * continue with the conversion loop while there is still input left
+ * (continue converting by breaking out of only the inner loop)
+ */
+ break;
+ } else if(realSource!=NULL) {
+ /* switch back from replaying to the real source and continue */
+ pArgs->source=realSource;
+ pArgs->sourceLimit=realSourceLimit;
+ pArgs->flush=realFlush;
+ sourceIndex=realSourceIndex;
+
+ realSource=NULL;
+ break;
+ } else if(pArgs->flush && cnv->toULength>0) {
+ /*
+ * the entire input stream is consumed
+ * and there is a partial, truncated input sequence left
+ */
+
+ /* inject an error and continue with callback handling */
+ *err=U_TRUNCATED_CHAR_FOUND;
+ calledCallback=FALSE; /* new error condition */
+ } else {
+ /* input consumed */
+ if(pArgs->flush) {
+ /*
+ * return to the conversion loop once more if the flush
+ * flag is set and the conversion function has not
+ * successfully processed the end of the input yet
+ *
+ * (continue converting by breaking out of only the inner loop)
+ */
+ if(!converterSawEndOfInput) {
+ break;
+ }
+
+ /* reset the converter without calling the callback function */
+ _reset(cnv, UCNV_RESET_TO_UNICODE, FALSE);
+ }
+
+ /* done successfully */
+ return;
+ }
+ }
+
+ /* U_FAILURE(*err) */
+ {
+ UErrorCode e;
+
+ if( calledCallback ||
+ (e=*err)==U_BUFFER_OVERFLOW_ERROR ||
+ (e!=U_INVALID_CHAR_FOUND &&
+ e!=U_ILLEGAL_CHAR_FOUND &&
+ e!=U_TRUNCATED_CHAR_FOUND &&
+ e!=U_ILLEGAL_ESCAPE_SEQUENCE &&
+ e!=U_UNSUPPORTED_ESCAPE_SEQUENCE)
+ ) {
+ /*
+ * the callback did not or cannot resolve the error:
+ * set output pointers and return
+ *
+ * the check for buffer overflow is redundant but it is
+ * a high-runner case and hopefully documents the intent
+ * well
+ *
+ * if we were replaying, then the replay buffer must be
+ * copied back into the UConverter
+ * and the real arguments must be restored
+ */
+ if(realSource!=NULL) {
+ int32_t length;
+
+ U_ASSERT(cnv->preToULength==0);
+
+ length=(int32_t)(pArgs->sourceLimit-pArgs->source);
+ if(length>0) {
+ uprv_memcpy(cnv->preToU, pArgs->source, length);
+ cnv->preToULength=(int8_t)-length;
+ }
+
+ pArgs->source=realSource;
+ pArgs->sourceLimit=realSourceLimit;
+ pArgs->flush=realFlush;
+ }
+
+ return;
+ }
+ }
+
+ /* copy toUBytes[] to invalidCharBuffer[] */
+ errorInputLength=cnv->invalidCharLength=cnv->toULength;
+ if(errorInputLength>0) {
+ uprv_memcpy(cnv->invalidCharBuffer, cnv->toUBytes, errorInputLength);
+ }
+
+ /* set the converter state to deal with the next character */
+ cnv->toULength=0;
+
+ /* call the callback function */
+ if(cnv->toUCallbackReason==UCNV_ILLEGAL && *err==U_INVALID_CHAR_FOUND) {
+ cnv->toUCallbackReason = UCNV_UNASSIGNED;
+ }
+ cnv->fromCharErrorBehaviour(cnv->toUContext, pArgs,
+ cnv->invalidCharBuffer, errorInputLength,
+ cnv->toUCallbackReason,
+ err);
+ cnv->toUCallbackReason = UCNV_ILLEGAL; /* reset to default value */
+
+ /*
+ * loop back to the offset handling
+ *
+ * this flag will indicate after offset handling
+ * that a callback was called;
+ * if the callback did not resolve the error, then we return
+ */
+ calledCallback=TRUE;
+ }
+ }
+}
+
+/*
+ * Output the toUnicode overflow buffer.
+ * Call this function if(cnv->UCharErrorBufferLength>0).
+ * @return TRUE if overflow
+ */
+static UBool
+ucnv_outputOverflowToUnicode(UConverter *cnv,
+ UChar **target, const UChar *targetLimit,
+ int32_t **pOffsets,
+ UErrorCode *err) {
+ int32_t *offsets;
+ UChar *overflow, *t;
+ int32_t i, length;
+
+ t=*target;
+ if(pOffsets!=NULL) {
+ offsets=*pOffsets;
+ } else {
+ offsets=NULL;
+ }
+
+ overflow=cnv->UCharErrorBuffer;
+ length=cnv->UCharErrorBufferLength;
+ i=0;
+ while(i<length) {
+ if(t==targetLimit) {
+ /* the overflow buffer contains too much, keep the rest */
+ int32_t j=0;
+
+ do {
+ overflow[j++]=overflow[i++];
+ } while(i<length);
+
+ cnv->UCharErrorBufferLength=(int8_t)j;
+ *target=t;
+ if(offsets!=NULL) {
+ *pOffsets=offsets;
+ }
+ *err=U_BUFFER_OVERFLOW_ERROR;
+ return TRUE;
+ }
+
+ /* copy the overflow contents to the target */
+ *t++=overflow[i++];
+ if(offsets!=NULL) {
+ *offsets++=-1; /* no source index available for old output */
+ }
+ }
+
+ /* the overflow buffer is completely copied to the target */
+ cnv->UCharErrorBufferLength=0;
+ *target=t;
+ if(offsets!=NULL) {
+ *pOffsets=offsets;
+ }
+ return FALSE;
+}
+
+U_CAPI void U_EXPORT2
+ucnv_toUnicode(UConverter *cnv,
+ UChar **target, const UChar *targetLimit,
+ const char **source, const char *sourceLimit,
+ int32_t *offsets,
+ UBool flush,
+ UErrorCode *err) {
+ UConverterToUnicodeArgs args;
+ const char *s;
+ UChar *t;
+
+ /* check parameters */
+ if(err==NULL || U_FAILURE(*err)) {
+ return;
+ }
+
+ if(cnv==NULL || target==NULL || source==NULL) {
+ *err=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ s=*source;
+ t=*target;
+
+ if ((const void *)U_MAX_PTR(targetLimit) == (const void *)targetLimit) {
+ /*
+ Prevent code from going into an infinite loop in case we do hit this
+ limit. The limit pointer is expected to be on a UChar * boundary.
+ This also prevents the next argument check from failing.
+ */
+ targetLimit = (const UChar *)(((const char *)targetLimit) - 1);
+ }
+
+ /*
+ * All these conditions should never happen.
+ *
+ * 1) Make sure that the limits are >= to the address source or target
+ *
+ * 2) Make sure that the buffer sizes do not exceed the number range for
+ * int32_t because some functions use the size (in units or bytes)
+ * rather than comparing pointers, and because offsets are int32_t values.
+ *
+ * size_t is guaranteed to be unsigned and large enough for the job.
+ *
+ * Return with an error instead of adjusting the limits because we would
+ * not be able to maintain the semantics that either the source must be
+ * consumed or the target filled (unless an error occurs).
+ * An adjustment would be sourceLimit=t+0x7fffffff; for example.
+ *
+ * 3) Make sure that the user didn't incorrectly cast a UChar * pointer
+ * to a char * pointer and provide an incomplete UChar code unit.
+ */
+ if (sourceLimit<s || targetLimit<t ||
+ ((size_t)(sourceLimit-s)>(size_t)0x7fffffff && sourceLimit>s) ||
+ ((size_t)(targetLimit-t)>(size_t)0x3fffffff && targetLimit>t) ||
+ (((const char *)targetLimit-(const char *)t) & 1) != 0
+ ) {
+ *err=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ /* output the target overflow buffer */
+ if( cnv->UCharErrorBufferLength>0 &&
+ ucnv_outputOverflowToUnicode(cnv, target, targetLimit, &offsets, err)
+ ) {
+ /* U_BUFFER_OVERFLOW_ERROR */
+ return;
+ }
+ /* *target may have moved, therefore stop using t */
+
+ if(!flush && s==sourceLimit && cnv->preToULength>=0) {
+ /* the overflow buffer is emptied and there is no new input: we are done */
+ return;
+ }
+
+ /*
+ * Do not simply return with a buffer overflow error if
+ * !flush && t==targetLimit
+ * because it is possible that the source will not generate any output.
+ * For example, the skip callback may be called;
+ * it does not output anything.
+ */
+
+ /* prepare the converter arguments */
+ args.converter=cnv;
+ args.flush=flush;
+ args.offsets=offsets;
+ args.source=s;
+ args.sourceLimit=sourceLimit;
+ args.target=*target;
+ args.targetLimit=targetLimit;
+ args.size=sizeof(args);
+
+ _toUnicodeWithCallback(&args, err);
+
+ *source=args.source;
+ *target=args.target;
+}
+
+/* ucnv_to/fromUChars() ----------------------------------------------------- */
+
+U_CAPI int32_t U_EXPORT2
+ucnv_fromUChars(UConverter *cnv,
+ char *dest, int32_t destCapacity,
+ const UChar *src, int32_t srcLength,
+ UErrorCode *pErrorCode) {
+ const UChar *srcLimit;
+ char *originalDest, *destLimit;
+ int32_t destLength;
+
+ /* check arguments */
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+
+ if( cnv==NULL ||
+ destCapacity<0 || (destCapacity>0 && dest==NULL) ||
+ srcLength<-1 || (srcLength!=0 && src==NULL)
+ ) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* initialize */
+ ucnv_resetFromUnicode(cnv);
+ originalDest=dest;
+ if(srcLength==-1) {
+ srcLength=u_strlen(src);
+ }
+ if(srcLength>0) {
+ srcLimit=src+srcLength;
+ destCapacity=pinCapacity(dest, destCapacity);
+ destLimit=dest+destCapacity;
+
+ /* perform the conversion */
+ ucnv_fromUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, TRUE, pErrorCode);
+ destLength=(int32_t)(dest-originalDest);
+
+ /* if an overflow occurs, then get the preflighting length */
+ if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR) {
+ char buffer[1024];
+
+ destLimit=buffer+sizeof(buffer);
+ do {
+ dest=buffer;
+ *pErrorCode=U_ZERO_ERROR;
+ ucnv_fromUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, TRUE, pErrorCode);
+ destLength+=(int32_t)(dest-buffer);
+ } while(*pErrorCode==U_BUFFER_OVERFLOW_ERROR);
+ }
+ } else {
+ destLength=0;
+ }
+
+ return u_terminateChars(originalDest, destCapacity, destLength, pErrorCode);
+}
+
+U_CAPI int32_t U_EXPORT2
+ucnv_toUChars(UConverter *cnv,
+ UChar *dest, int32_t destCapacity,
+ const char *src, int32_t srcLength,
+ UErrorCode *pErrorCode) {
+ const char *srcLimit;
+ UChar *originalDest, *destLimit;
+ int32_t destLength;
+
+ /* check arguments */
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+
+ if( cnv==NULL ||
+ destCapacity<0 || (destCapacity>0 && dest==NULL) ||
+ srcLength<-1 || (srcLength!=0 && src==NULL))
+ {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* initialize */
+ ucnv_resetToUnicode(cnv);
+ originalDest=dest;
+ if(srcLength==-1) {
+ srcLength=(int32_t)uprv_strlen(src);
+ }
+ if(srcLength>0) {
+ srcLimit=src+srcLength;
+ destCapacity=pinCapacity(dest, destCapacity);
+ destLimit=dest+destCapacity;
+
+ /* perform the conversion */
+ ucnv_toUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, TRUE, pErrorCode);
+ destLength=(int32_t)(dest-originalDest);
+
+ /* if an overflow occurs, then get the preflighting length */
+ if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR)
+ {
+ UChar buffer[1024];
+
+ destLimit=buffer+UPRV_LENGTHOF(buffer);
+ do {
+ dest=buffer;
+ *pErrorCode=U_ZERO_ERROR;
+ ucnv_toUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, TRUE, pErrorCode);
+ destLength+=(int32_t)(dest-buffer);
+ }
+ while(*pErrorCode==U_BUFFER_OVERFLOW_ERROR);
+ }
+ } else {
+ destLength=0;
+ }
+
+ return u_terminateUChars(originalDest, destCapacity, destLength, pErrorCode);
+}
+
+/* ucnv_getNextUChar() ------------------------------------------------------ */
+
+U_CAPI UChar32 U_EXPORT2
+ucnv_getNextUChar(UConverter *cnv,
+ const char **source, const char *sourceLimit,
+ UErrorCode *err) {
+ UConverterToUnicodeArgs args;
+ UChar buffer[U16_MAX_LENGTH];
+ const char *s;
+ UChar32 c;
+ int32_t i, length;
+
+ /* check parameters */
+ if(err==NULL || U_FAILURE(*err)) {
+ return 0xffff;
+ }
+
+ if(cnv==NULL || source==NULL) {
+ *err=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0xffff;
+ }
+
+ s=*source;
+ if(sourceLimit<s) {
+ *err=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0xffff;
+ }
+
+ /*
+ * Make sure that the buffer sizes do not exceed the number range for
+ * int32_t because some functions use the size (in units or bytes)
+ * rather than comparing pointers, and because offsets are int32_t values.
+ *
+ * size_t is guaranteed to be unsigned and large enough for the job.
+ *
+ * Return with an error instead of adjusting the limits because we would
+ * not be able to maintain the semantics that either the source must be
+ * consumed or the target filled (unless an error occurs).
+ * An adjustment would be sourceLimit=t+0x7fffffff; for example.
+ */
+ if(((size_t)(sourceLimit-s)>(size_t)0x7fffffff && sourceLimit>s)) {
+ *err=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0xffff;
+ }
+
+ c=U_SENTINEL;
+
+ /* flush the target overflow buffer */
+ if(cnv->UCharErrorBufferLength>0) {
+ UChar *overflow;
+
+ overflow=cnv->UCharErrorBuffer;
+ i=0;
+ length=cnv->UCharErrorBufferLength;
+ U16_NEXT(overflow, i, length, c);
+
+ /* move the remaining overflow contents up to the beginning */
+ if((cnv->UCharErrorBufferLength=(int8_t)(length-i))>0) {
+ uprv_memmove(cnv->UCharErrorBuffer, cnv->UCharErrorBuffer+i,
+ cnv->UCharErrorBufferLength*U_SIZEOF_UCHAR);
+ }
+
+ if(!U16_IS_LEAD(c) || i<length) {
+ return c;
+ }
+ /*
+ * Continue if the overflow buffer contained only a lead surrogate,
+ * in case the converter outputs single surrogates from complete
+ * input sequences.
+ */
+ }
+
+ /*
+ * flush==TRUE is implied for ucnv_getNextUChar()
+ *
+ * do not simply return even if s==sourceLimit because the converter may
+ * not have seen flush==TRUE before
+ */
+
+ /* prepare the converter arguments */
+ args.converter=cnv;
+ args.flush=TRUE;
+ args.offsets=NULL;
+ args.source=s;
+ args.sourceLimit=sourceLimit;
+ args.target=buffer;
+ args.targetLimit=buffer+1;
+ args.size=sizeof(args);
+
+ if(c<0) {
+ /*
+ * call the native getNextUChar() implementation if we are
+ * at a character boundary (toULength==0)
+ *
+ * unlike with _toUnicode(), getNextUChar() implementations must set
+ * U_TRUNCATED_CHAR_FOUND for truncated input,
+ * in addition to setting toULength/toUBytes[]
+ */
+ if(cnv->toULength==0 && cnv->sharedData->impl->getNextUChar!=NULL) {
+ c=cnv->sharedData->impl->getNextUChar(&args, err);
+ *source=s=args.source;
+ if(*err==U_INDEX_OUTOFBOUNDS_ERROR) {
+ /* reset the converter without calling the callback function */
+ _reset(cnv, UCNV_RESET_TO_UNICODE, FALSE);
+ return 0xffff; /* no output */
+ } else if(U_SUCCESS(*err) && c>=0) {
+ return c;
+ /*
+ * else fall through to use _toUnicode() because
+ * UCNV_GET_NEXT_UCHAR_USE_TO_U: the native function did not want to handle it after all
+ * U_FAILURE: call _toUnicode() for callback handling (do not output c)
+ */
+ }
+ }
+
+ /* convert to one UChar in buffer[0], or handle getNextUChar() errors */
+ _toUnicodeWithCallback(&args, err);
+
+ if(*err==U_BUFFER_OVERFLOW_ERROR) {
+ *err=U_ZERO_ERROR;
+ }
+
+ i=0;
+ length=(int32_t)(args.target-buffer);
+ } else {
+ /* write the lead surrogate from the overflow buffer */
+ buffer[0]=(UChar)c;
+ args.target=buffer+1;
+ i=0;
+ length=1;
+ }
+
+ /* buffer contents starts at i and ends before length */
+
+ if(U_FAILURE(*err)) {
+ c=0xffff; /* no output */
+ } else if(length==0) {
+ /* no input or only state changes */
+ *err=U_INDEX_OUTOFBOUNDS_ERROR;
+ /* no need to reset explicitly because _toUnicodeWithCallback() did it */
+ c=0xffff; /* no output */
+ } else {
+ c=buffer[0];
+ i=1;
+ if(!U16_IS_LEAD(c)) {
+ /* consume c=buffer[0], done */
+ } else {
+ /* got a lead surrogate, see if a trail surrogate follows */
+ UChar c2;
+
+ if(cnv->UCharErrorBufferLength>0) {
+ /* got overflow output from the conversion */
+ if(U16_IS_TRAIL(c2=cnv->UCharErrorBuffer[0])) {
+ /* got a trail surrogate, too */
+ c=U16_GET_SUPPLEMENTARY(c, c2);
+
+ /* move the remaining overflow contents up to the beginning */
+ if((--cnv->UCharErrorBufferLength)>0) {
+ uprv_memmove(cnv->UCharErrorBuffer, cnv->UCharErrorBuffer+1,
+ cnv->UCharErrorBufferLength*U_SIZEOF_UCHAR);
+ }
+ } else {
+ /* c is an unpaired lead surrogate, just return it */
+ }
+ } else if(args.source<sourceLimit) {
+ /* convert once more, to buffer[1] */
+ args.targetLimit=buffer+2;
+ _toUnicodeWithCallback(&args, err);
+ if(*err==U_BUFFER_OVERFLOW_ERROR) {
+ *err=U_ZERO_ERROR;
+ }
+
+ length=(int32_t)(args.target-buffer);
+ if(U_SUCCESS(*err) && length==2 && U16_IS_TRAIL(c2=buffer[1])) {
+ /* got a trail surrogate, too */
+ c=U16_GET_SUPPLEMENTARY(c, c2);
+ i=2;
+ }
+ }
+ }
+ }
+
+ /*
+ * move leftover output from buffer[i..length[
+ * into the beginning of the overflow buffer
+ */
+ if(i<length) {
+ /* move further overflow back */
+ int32_t delta=length-i;
+ if((length=cnv->UCharErrorBufferLength)>0) {
+ uprv_memmove(cnv->UCharErrorBuffer+delta, cnv->UCharErrorBuffer,
+ length*U_SIZEOF_UCHAR);
+ }
+ cnv->UCharErrorBufferLength=(int8_t)(length+delta);
+
+ cnv->UCharErrorBuffer[0]=buffer[i++];
+ if(delta>1) {
+ cnv->UCharErrorBuffer[1]=buffer[i];
+ }
+ }
+
+ *source=args.source;
+ return c;
+}
+
+/* ucnv_convert() and siblings ---------------------------------------------- */
+
+U_CAPI void U_EXPORT2
+ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
+ char **target, const char *targetLimit,
+ const char **source, const char *sourceLimit,
+ UChar *pivotStart, UChar **pivotSource,
+ UChar **pivotTarget, const UChar *pivotLimit,
+ UBool reset, UBool flush,
+ UErrorCode *pErrorCode) {
+ UChar pivotBuffer[CHUNK_SIZE];
+ const UChar *myPivotSource;
+ UChar *myPivotTarget;
+ const char *s;
+ char *t;
+
+ UConverterToUnicodeArgs toUArgs;
+ UConverterFromUnicodeArgs fromUArgs;
+ UConverterConvert convert;
+
+ /* error checking */
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return;
+ }
+
+ if( targetCnv==NULL || sourceCnv==NULL ||
+ source==NULL || *source==NULL ||
+ target==NULL || *target==NULL || targetLimit==NULL
+ ) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ s=*source;
+ t=*target;
+ if((sourceLimit!=NULL && sourceLimit<s) || targetLimit<t) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ /*
+ * Make sure that the buffer sizes do not exceed the number range for
+ * int32_t. See ucnv_toUnicode() for a more detailed comment.
+ */
+ if(
+ (sourceLimit!=NULL && ((size_t)(sourceLimit-s)>(size_t)0x7fffffff && sourceLimit>s)) ||
+ ((size_t)(targetLimit-t)>(size_t)0x7fffffff && targetLimit>t)
+ ) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ if(pivotStart==NULL) {
+ if(!flush) {
+ /* streaming conversion requires an explicit pivot buffer */
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ /* use the stack pivot buffer */
+ myPivotSource=myPivotTarget=pivotStart=pivotBuffer;
+ pivotSource=(UChar **)&myPivotSource;
+ pivotTarget=&myPivotTarget;
+ pivotLimit=pivotBuffer+CHUNK_SIZE;
+ } else if( pivotStart>=pivotLimit ||
+ pivotSource==NULL || *pivotSource==NULL ||
+ pivotTarget==NULL || *pivotTarget==NULL ||
+ pivotLimit==NULL
+ ) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ if(sourceLimit==NULL) {
+ /* get limit of single-byte-NUL-terminated source string */
+ sourceLimit=uprv_strchr(*source, 0);
+ }
+
+ if(reset) {
+ ucnv_resetToUnicode(sourceCnv);
+ ucnv_resetFromUnicode(targetCnv);
+ *pivotSource=*pivotTarget=pivotStart;
+ } else if(targetCnv->charErrorBufferLength>0) {
+ /* output the targetCnv overflow buffer */
+ if(ucnv_outputOverflowFromUnicode(targetCnv, target, targetLimit, NULL, pErrorCode)) {
+ /* U_BUFFER_OVERFLOW_ERROR */
+ return;
+ }
+ /* *target has moved, therefore stop using t */
+
+ if( !flush &&
+ targetCnv->preFromULength>=0 && *pivotSource==*pivotTarget &&
+ sourceCnv->UCharErrorBufferLength==0 && sourceCnv->preToULength>=0 && s==sourceLimit
+ ) {
+ /* the fromUnicode overflow buffer is emptied and there is no new input: we are done */
+ return;
+ }
+ }
+
+ /* Is direct-UTF-8 conversion available? */
+ if( sourceCnv->sharedData->staticData->conversionType==UCNV_UTF8 &&
+ targetCnv->sharedData->impl->fromUTF8!=NULL
+ ) {
+ convert=targetCnv->sharedData->impl->fromUTF8;
+ } else if( targetCnv->sharedData->staticData->conversionType==UCNV_UTF8 &&
+ sourceCnv->sharedData->impl->toUTF8!=NULL
+ ) {
+ convert=sourceCnv->sharedData->impl->toUTF8;
+ } else {
+ convert=NULL;
+ }
+
+ /*
+ * If direct-UTF-8 conversion is available, then we use a smaller
+ * pivot buffer for error handling and partial matches
+ * so that we quickly return to direct conversion.
+ *
+ * 32 is large enough for UCNV_EXT_MAX_UCHARS and UCNV_ERROR_BUFFER_LENGTH.
+ *
+ * We could reduce the pivot buffer size further, at the cost of
+ * buffer overflows from callbacks.
+ * The pivot buffer should not be smaller than the maximum number of
+ * fromUnicode extension table input UChars
+ * (for m:n conversion, see
+ * targetCnv->sharedData->mbcs.extIndexes[UCNV_EXT_COUNT_UCHARS])
+ * or 2 for surrogate pairs.
+ *
+ * Too small a buffer can cause thrashing between pivoting and direct
+ * conversion, with function call overhead outweighing the benefits
+ * of direct conversion.
+ */
+ if(convert!=NULL && (pivotLimit-pivotStart)>32) {
+ pivotLimit=pivotStart+32;
+ }
+
+ /* prepare the converter arguments */
+ fromUArgs.converter=targetCnv;
+ fromUArgs.flush=FALSE;
+ fromUArgs.offsets=NULL;
+ fromUArgs.target=*target;
+ fromUArgs.targetLimit=targetLimit;
+ fromUArgs.size=sizeof(fromUArgs);
+
+ toUArgs.converter=sourceCnv;
+ toUArgs.flush=flush;
+ toUArgs.offsets=NULL;
+ toUArgs.source=s;
+ toUArgs.sourceLimit=sourceLimit;
+ toUArgs.targetLimit=pivotLimit;
+ toUArgs.size=sizeof(toUArgs);
+
+ /*
+ * TODO: Consider separating this function into two functions,
+ * extracting exactly the conversion loop,
+ * for readability and to reduce the set of visible variables.
+ *
+ * Otherwise stop using s and t from here on.
+ */
+ s=t=NULL;
+
+ /*
+ * conversion loop
+ *
+ * The sequence of steps in the loop may appear backward,
+ * but the principle is simple:
+ * In the chain of
+ * source - sourceCnv overflow - pivot - targetCnv overflow - target
+ * empty out later buffers before refilling them from earlier ones.
+ *
+ * The targetCnv overflow buffer is flushed out only once before the loop.
+ */
+ for(;;) {
+ /*
+ * if(pivot not empty or error or replay or flush fromUnicode) {
+ * fromUnicode(pivot -> target);
+ * }
+ *
+ * For pivoting conversion; and for direct conversion for
+ * error callback handling and flushing the replay buffer.
+ */
+ if( *pivotSource<*pivotTarget ||
+ U_FAILURE(*pErrorCode) ||
+ targetCnv->preFromULength<0 ||
+ fromUArgs.flush
+ ) {
+ fromUArgs.source=*pivotSource;
+ fromUArgs.sourceLimit=*pivotTarget;
+ _fromUnicodeWithCallback(&fromUArgs, pErrorCode);
+ if(U_FAILURE(*pErrorCode)) {
+ /* target overflow, or conversion error */
+ *pivotSource=(UChar *)fromUArgs.source;
+ break;
+ }
+
+ /*
+ * _fromUnicodeWithCallback() must have consumed the pivot contents
+ * (*pivotSource==*pivotTarget) since it returned with U_SUCCESS()
+ */
+ }
+
+ /* The pivot buffer is empty; reset it so we start at pivotStart. */
+ *pivotSource=*pivotTarget=pivotStart;
+
+ /*
+ * if(sourceCnv overflow buffer not empty) {
+ * move(sourceCnv overflow buffer -> pivot);
+ * continue;
+ * }
+ */
+ /* output the sourceCnv overflow buffer */
+ if(sourceCnv->UCharErrorBufferLength>0) {
+ if(ucnv_outputOverflowToUnicode(sourceCnv, pivotTarget, pivotLimit, NULL, pErrorCode)) {
+ /* U_BUFFER_OVERFLOW_ERROR */
+ *pErrorCode=U_ZERO_ERROR;
+ }
+ continue;
+ }
+
+ /*
+ * check for end of input and break if done
+ *
+ * Checking both flush and fromUArgs.flush ensures that the converters
+ * have been called with the flush flag set if the ucnv_convertEx()
+ * caller set it.
+ */
+ if( toUArgs.source==sourceLimit &&
+ sourceCnv->preToULength>=0 && sourceCnv->toULength==0 &&
+ (!flush || fromUArgs.flush)
+ ) {
+ /* done successfully */
+ break;
+ }
+
+ /*
+ * use direct conversion if available
+ * but not if continuing a partial match
+ * or flushing the toUnicode replay buffer
+ */
+ if(convert!=NULL && targetCnv->preFromUFirstCP<0 && sourceCnv->preToULength==0) {
+ if(*pErrorCode==U_USING_DEFAULT_WARNING) {
+ /* remove a warning that may be set by this function */
+ *pErrorCode=U_ZERO_ERROR;
+ }
+ convert(&fromUArgs, &toUArgs, pErrorCode);
+ if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR) {
+ break;
+ } else if(U_FAILURE(*pErrorCode)) {
+ if(sourceCnv->toULength>0) {
+ /*
+ * Fall through to calling _toUnicodeWithCallback()
+ * for callback handling.
+ *
+ * The pivot buffer will be reset with
+ * *pivotSource=*pivotTarget=pivotStart;
+ * which indicates a toUnicode error to the caller
+ * (*pivotSource==pivotStart shows no pivot UChars consumed).
+ */
+ } else {
+ /*
+ * Indicate a fromUnicode error to the caller
+ * (*pivotSource>pivotStart shows some pivot UChars consumed).
+ */
+ *pivotSource=*pivotTarget=pivotStart+1;
+ /*
+ * Loop around to calling _fromUnicodeWithCallbacks()
+ * for callback handling.
+ */
+ continue;
+ }
+ } else if(*pErrorCode==U_USING_DEFAULT_WARNING) {
+ /*
+ * No error, but the implementation requested to temporarily
+ * fall back to pivoting.
+ */
+ *pErrorCode=U_ZERO_ERROR;
+ /*
+ * The following else branches are almost identical to the end-of-input
+ * handling in _toUnicodeWithCallback().
+ * Avoid calling it just for the end of input.
+ */
+ } else if(flush && sourceCnv->toULength>0) { /* flush==toUArgs.flush */
+ /*
+ * the entire input stream is consumed
+ * and there is a partial, truncated input sequence left
+ */
+
+ /* inject an error and continue with callback handling */
+ *pErrorCode=U_TRUNCATED_CHAR_FOUND;
+ } else {
+ /* input consumed */
+ if(flush) {
+ /* reset the converters without calling the callback functions */
+ _reset(sourceCnv, UCNV_RESET_TO_UNICODE, FALSE);
+ _reset(targetCnv, UCNV_RESET_FROM_UNICODE, FALSE);
+ }
+
+ /* done successfully */
+ break;
+ }
+ }
+
+ /*
+ * toUnicode(source -> pivot);
+ *
+ * For pivoting conversion; and for direct conversion for
+ * error callback handling, continuing partial matches
+ * and flushing the replay buffer.
+ *
+ * The pivot buffer is empty and reset.
+ */
+ toUArgs.target=pivotStart; /* ==*pivotTarget */
+ /* toUArgs.targetLimit=pivotLimit; already set before the loop */
+ _toUnicodeWithCallback(&toUArgs, pErrorCode);
+ *pivotTarget=toUArgs.target;
+ if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR) {
+ /* pivot overflow: continue with the conversion loop */
+ *pErrorCode=U_ZERO_ERROR;
+ } else if(U_FAILURE(*pErrorCode) || (!flush && *pivotTarget==pivotStart)) {
+ /* conversion error, or there was nothing left to convert */
+ break;
+ }
+ /*
+ * else:
+ * _toUnicodeWithCallback() wrote into the pivot buffer,
+ * continue with fromUnicode conversion.
+ *
+ * Set the fromUnicode flush flag if we flush and if toUnicode has
+ * processed the end of the input.
+ */
+ if( flush && toUArgs.source==sourceLimit &&
+ sourceCnv->preToULength>=0 &&
+ sourceCnv->UCharErrorBufferLength==0
+ ) {
+ fromUArgs.flush=TRUE;
+ }
+ }
+
+ /*
+ * The conversion loop is exited when one of the following is true:
+ * - the entire source text has been converted successfully to the target buffer
+ * - a target buffer overflow occurred
+ * - a conversion error occurred
+ */
+
+ *source=toUArgs.source;
+ *target=fromUArgs.target;
+
+ /* terminate the target buffer if possible */
+ if(flush && U_SUCCESS(*pErrorCode)) {
+ if(*target!=targetLimit) {
+ **target=0;
+ if(*pErrorCode==U_STRING_NOT_TERMINATED_WARNING) {
+ *pErrorCode=U_ZERO_ERROR;
+ }
+ } else {
+ *pErrorCode=U_STRING_NOT_TERMINATED_WARNING;
+ }
+ }
+}
+
+/* internal implementation of ucnv_convert() etc. with preflighting */
+static int32_t
+ucnv_internalConvert(UConverter *outConverter, UConverter *inConverter,
+ char *target, int32_t targetCapacity,
+ const char *source, int32_t sourceLength,
+ UErrorCode *pErrorCode) {
+ UChar pivotBuffer[CHUNK_SIZE];
+ UChar *pivot, *pivot2;
+
+ char *myTarget;
+ const char *sourceLimit;
+ const char *targetLimit;
+ int32_t targetLength=0;
+
+ /* set up */
+ if(sourceLength<0) {
+ sourceLimit=uprv_strchr(source, 0);
+ } else {
+ sourceLimit=source+sourceLength;
+ }
+
+ /* if there is no input data, we're done */
+ if(source==sourceLimit) {
+ return u_terminateChars(target, targetCapacity, 0, pErrorCode);
+ }
+
+ pivot=pivot2=pivotBuffer;
+ myTarget=target;
+ targetLength=0;
+
+ if(targetCapacity>0) {
+ /* perform real conversion */
+ targetLimit=target+targetCapacity;
+ ucnv_convertEx(outConverter, inConverter,
+ &myTarget, targetLimit,
+ &source, sourceLimit,
+ pivotBuffer, &pivot, &pivot2, pivotBuffer+CHUNK_SIZE,
+ FALSE,
+ TRUE,
+ pErrorCode);
+ targetLength=(int32_t)(myTarget-target);
+ }
+
+ /*
+ * If the output buffer is exhausted (or we are only "preflighting"), we need to stop writing
+ * to it but continue the conversion in order to store in targetCapacity
+ * the number of bytes that was required.
+ */
+ if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR || targetCapacity==0)
+ {
+ char targetBuffer[CHUNK_SIZE];
+
+ targetLimit=targetBuffer+CHUNK_SIZE;
+ do {
+ *pErrorCode=U_ZERO_ERROR;
+ myTarget=targetBuffer;
+ ucnv_convertEx(outConverter, inConverter,
+ &myTarget, targetLimit,
+ &source, sourceLimit,
+ pivotBuffer, &pivot, &pivot2, pivotBuffer+CHUNK_SIZE,
+ FALSE,
+ TRUE,
+ pErrorCode);
+ targetLength+=(int32_t)(myTarget-targetBuffer);
+ } while(*pErrorCode==U_BUFFER_OVERFLOW_ERROR);
+
+ /* done with preflighting, set warnings and errors as appropriate */
+ return u_terminateChars(target, targetCapacity, targetLength, pErrorCode);
+ }
+
+ /* no need to call u_terminateChars() because ucnv_convertEx() took care of that */
+ return targetLength;
+}
+
+U_CAPI int32_t U_EXPORT2
+ucnv_convert(const char *toConverterName, const char *fromConverterName,
+ char *target, int32_t targetCapacity,
+ const char *source, int32_t sourceLength,
+ UErrorCode *pErrorCode) {
+ UConverter in, out; /* stack-allocated */
+ UConverter *inConverter, *outConverter;
+ int32_t targetLength;
+
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+
+ if( source==NULL || sourceLength<-1 ||
+ targetCapacity<0 || (targetCapacity>0 && target==NULL)
+ ) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* if there is no input data, we're done */
+ if(sourceLength==0 || (sourceLength<0 && *source==0)) {
+ return u_terminateChars(target, targetCapacity, 0, pErrorCode);
+ }
+
+ /* create the converters */
+ inConverter=ucnv_createConverter(&in, fromConverterName, pErrorCode);
+ if(U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+
+ outConverter=ucnv_createConverter(&out, toConverterName, pErrorCode);
+ if(U_FAILURE(*pErrorCode)) {
+ ucnv_close(inConverter);
+ return 0;
+ }
+
+ targetLength=ucnv_internalConvert(outConverter, inConverter,
+ target, targetCapacity,
+ source, sourceLength,
+ pErrorCode);
+
+ ucnv_close(inConverter);
+ ucnv_close(outConverter);
+
+ return targetLength;
+}
+
+/* @internal */
+static int32_t
+ucnv_convertAlgorithmic(UBool convertToAlgorithmic,
+ UConverterType algorithmicType,
+ UConverter *cnv,
+ char *target, int32_t targetCapacity,
+ const char *source, int32_t sourceLength,
+ UErrorCode *pErrorCode) {
+ UConverter algoConverterStatic; /* stack-allocated */
+ UConverter *algoConverter, *to, *from;
+ int32_t targetLength;
+
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+
+ if( cnv==NULL || source==NULL || sourceLength<-1 ||
+ targetCapacity<0 || (targetCapacity>0 && target==NULL)
+ ) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* if there is no input data, we're done */
+ if(sourceLength==0 || (sourceLength<0 && *source==0)) {
+ return u_terminateChars(target, targetCapacity, 0, pErrorCode);
+ }
+
+ /* create the algorithmic converter */
+ algoConverter=ucnv_createAlgorithmicConverter(&algoConverterStatic, algorithmicType,
+ "", 0, pErrorCode);
+ if(U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+
+ /* reset the other converter */
+ if(convertToAlgorithmic) {
+ /* cnv->Unicode->algo */
+ ucnv_resetToUnicode(cnv);
+ to=algoConverter;
+ from=cnv;
+ } else {
+ /* algo->Unicode->cnv */
+ ucnv_resetFromUnicode(cnv);
+ from=algoConverter;
+ to=cnv;
+ }
+
+ targetLength=ucnv_internalConvert(to, from,
+ target, targetCapacity,
+ source, sourceLength,
+ pErrorCode);
+
+ ucnv_close(algoConverter);
+
+ return targetLength;
+}
+
+U_CAPI int32_t U_EXPORT2
+ucnv_toAlgorithmic(UConverterType algorithmicType,
+ UConverter *cnv,
+ char *target, int32_t targetCapacity,
+ const char *source, int32_t sourceLength,
+ UErrorCode *pErrorCode) {
+ return ucnv_convertAlgorithmic(TRUE, algorithmicType, cnv,
+ target, targetCapacity,
+ source, sourceLength,
+ pErrorCode);
+}
+
+U_CAPI int32_t U_EXPORT2
+ucnv_fromAlgorithmic(UConverter *cnv,
+ UConverterType algorithmicType,
+ char *target, int32_t targetCapacity,
+ const char *source, int32_t sourceLength,
+ UErrorCode *pErrorCode) {
+ return ucnv_convertAlgorithmic(FALSE, algorithmicType, cnv,
+ target, targetCapacity,
+ source, sourceLength,
+ pErrorCode);
+}
+
+U_CAPI UConverterType U_EXPORT2
+ucnv_getType(const UConverter* converter)
+{
+ int8_t type = converter->sharedData->staticData->conversionType;
+#if !UCONFIG_NO_LEGACY_CONVERSION
+ if(type == UCNV_MBCS) {
+ return ucnv_MBCSGetType(converter);
+ }
+#endif
+ return (UConverterType)type;
+}
+
+U_CAPI void U_EXPORT2
+ucnv_getStarters(const UConverter* converter,
+ UBool starters[256],
+ UErrorCode* err)
+{
+ if (err == NULL || U_FAILURE(*err)) {
+ return;
+ }
+
+ if(converter->sharedData->impl->getStarters != NULL) {
+ converter->sharedData->impl->getStarters(converter, starters, err);
+ } else {
+ *err = U_ILLEGAL_ARGUMENT_ERROR;
+ }
+}
+
+static const UAmbiguousConverter *ucnv_getAmbiguous(const UConverter *cnv)
+{
+ UErrorCode errorCode;
+ const char *name;
+ int32_t i;
+
+ if(cnv==NULL) {
+ return NULL;
+ }
+
+ errorCode=U_ZERO_ERROR;
+ name=ucnv_getName(cnv, &errorCode);
+ if(U_FAILURE(errorCode)) {
+ return NULL;
+ }
+
+ for(i=0; i<UPRV_LENGTHOF(ambiguousConverters); ++i)
+ {
+ if(0==uprv_strcmp(name, ambiguousConverters[i].name))
+ {
+ return ambiguousConverters+i;
+ }
+ }
+
+ return NULL;
+}
+
+U_CAPI void U_EXPORT2
+ucnv_fixFileSeparator(const UConverter *cnv,
+ UChar* source,
+ int32_t sourceLength) {
+ const UAmbiguousConverter *a;
+ int32_t i;
+ UChar variant5c;
+
+ if(cnv==NULL || source==NULL || sourceLength<=0 || (a=ucnv_getAmbiguous(cnv))==NULL)
+ {
+ return;
+ }
+
+ variant5c=a->variant5c;
+ for(i=0; i<sourceLength; ++i) {
+ if(source[i]==variant5c) {
+ source[i]=0x5c;
+ }
+ }
+}
+
+U_CAPI UBool U_EXPORT2
+ucnv_isAmbiguous(const UConverter *cnv) {
+ return (UBool)(ucnv_getAmbiguous(cnv)!=NULL);
+}
+
+U_CAPI void U_EXPORT2
+ucnv_setFallback(UConverter *cnv, UBool usesFallback)
+{
+ cnv->useFallback = usesFallback;
+}
+
+U_CAPI UBool U_EXPORT2
+ucnv_usesFallback(const UConverter *cnv)
+{
+ return cnv->useFallback;
+}
+
+U_CAPI void U_EXPORT2
+ucnv_getInvalidChars (const UConverter * converter,
+ char *errBytes,
+ int8_t * len,
+ UErrorCode * err)
+{
+ if (err == NULL || U_FAILURE(*err))
+ {
+ return;
+ }
+ if (len == NULL || errBytes == NULL || converter == NULL)
+ {
+ *err = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ if (*len < converter->invalidCharLength)
+ {
+ *err = U_INDEX_OUTOFBOUNDS_ERROR;
+ return;
+ }
+ if ((*len = converter->invalidCharLength) > 0)
+ {
+ uprv_memcpy (errBytes, converter->invalidCharBuffer, *len);
+ }
+}
+
+U_CAPI void U_EXPORT2
+ucnv_getInvalidUChars (const UConverter * converter,
+ UChar *errChars,
+ int8_t * len,
+ UErrorCode * err)
+{
+ if (err == NULL || U_FAILURE(*err))
+ {
+ return;
+ }
+ if (len == NULL || errChars == NULL || converter == NULL)
+ {
+ *err = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ if (*len < converter->invalidUCharLength)
+ {
+ *err = U_INDEX_OUTOFBOUNDS_ERROR;
+ return;
+ }
+ if ((*len = converter->invalidUCharLength) > 0)
+ {
+ u_memcpy (errChars, converter->invalidUCharBuffer, *len);
+ }
+}
+
+#define SIG_MAX_LEN 5
+
+U_CAPI const char* U_EXPORT2
+ucnv_detectUnicodeSignature( const char* source,
+ int32_t sourceLength,
+ int32_t* signatureLength,
+ UErrorCode* pErrorCode) {
+ int32_t dummy;
+
+ /* initial 0xa5 bytes: make sure that if we read <SIG_MAX_LEN
+ * bytes we don't misdetect something
+ */
+ char start[SIG_MAX_LEN]={ '\xa5', '\xa5', '\xa5', '\xa5', '\xa5' };
+ int i = 0;
+
+ if((pErrorCode==NULL) || U_FAILURE(*pErrorCode)){
+ return NULL;
+ }
+
+ if(source == NULL || sourceLength < -1){
+ *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
+ }
+
+ if(signatureLength == NULL) {
+ signatureLength = &dummy;
+ }
+
+ if(sourceLength==-1){
+ sourceLength=(int32_t)uprv_strlen(source);
+ }
+
+
+ while(i<sourceLength&& i<SIG_MAX_LEN){
+ start[i]=source[i];
+ i++;
+ }
+
+ if(start[0] == '\xFE' && start[1] == '\xFF') {
+ *signatureLength=2;
+ return "UTF-16BE";
+ } else if(start[0] == '\xFF' && start[1] == '\xFE') {
+ if(start[2] == '\x00' && start[3] =='\x00') {
+ *signatureLength=4;
+ return "UTF-32LE";
+ } else {
+ *signatureLength=2;
+ return "UTF-16LE";
+ }
+ } else if(start[0] == '\xEF' && start[1] == '\xBB' && start[2] == '\xBF') {
+ *signatureLength=3;
+ return "UTF-8";
+ } else if(start[0] == '\x00' && start[1] == '\x00' &&
+ start[2] == '\xFE' && start[3]=='\xFF') {
+ *signatureLength=4;
+ return "UTF-32BE";
+ } else if(start[0] == '\x0E' && start[1] == '\xFE' && start[2] == '\xFF') {
+ *signatureLength=3;
+ return "SCSU";
+ } else if(start[0] == '\xFB' && start[1] == '\xEE' && start[2] == '\x28') {
+ *signatureLength=3;
+ return "BOCU-1";
+ } else if(start[0] == '\x2B' && start[1] == '\x2F' && start[2] == '\x76') {
+ /*
+ * UTF-7: Initial U+FEFF is encoded as +/v8 or +/v9 or +/v+ or +/v/
+ * depending on the second UTF-16 code unit.
+ * Detect the entire, closed Unicode mode sequence +/v8- for only U+FEFF
+ * if it occurs.
+ *
+ * So far we have +/v
+ */
+ if(start[3] == '\x38' && start[4] == '\x2D') {
+ /* 5 bytes +/v8- */
+ *signatureLength=5;
+ return "UTF-7";
+ } else if(start[3] == '\x38' || start[3] == '\x39' || start[3] == '\x2B' || start[3] == '\x2F') {
+ /* 4 bytes +/v8 or +/v9 or +/v+ or +/v/ */
+ *signatureLength=4;
+ return "UTF-7";
+ }
+ }else if(start[0]=='\xDD' && start[1]== '\x73'&& start[2]=='\x66' && start[3]=='\x73'){
+ *signatureLength=4;
+ return "UTF-EBCDIC";
+ }
+
+
+ /* no known Unicode signature byte sequence recognized */
+ *signatureLength=0;
+ return NULL;
+}
+
+U_CAPI int32_t U_EXPORT2
+ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status)
+{
+ if(status == NULL || U_FAILURE(*status)){
+ return -1;
+ }
+ if(cnv == NULL){
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return -1;
+ }
+
+ if(cnv->preFromUFirstCP >= 0){
+ return U16_LENGTH(cnv->preFromUFirstCP)+cnv->preFromULength ;
+ }else if(cnv->preFromULength < 0){
+ return -cnv->preFromULength ;
+ }else if(cnv->fromUChar32 > 0){
+ return 1;
+ }
return 0;
-}
-
-U_CAPI UBool U_EXPORT2
-ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status){
- if (U_FAILURE(*status)) {
- return FALSE;
- }
-
- if (cnv == NULL) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return FALSE;
- }
-
- switch (ucnv_getType(cnv)) {
- case UCNV_SBCS:
- case UCNV_DBCS:
- case UCNV_UTF32_BigEndian:
- case UCNV_UTF32_LittleEndian:
- case UCNV_UTF32:
- case UCNV_US_ASCII:
- return TRUE;
- default:
- return FALSE;
- }
-}
-#endif
-
-/*
- * Hey, Emacs, please set the following:
- *
- * Local Variables:
- * indent-tabs-mode: nil
- * End:
- *
- */
+
+}
+
+U_CAPI int32_t U_EXPORT2
+ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status){
+
+ if(status == NULL || U_FAILURE(*status)){
+ return -1;
+ }
+ if(cnv == NULL){
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return -1;
+ }
+
+ if(cnv->preToULength > 0){
+ return cnv->preToULength ;
+ }else if(cnv->preToULength < 0){
+ return -cnv->preToULength;
+ }else if(cnv->toULength > 0){
+ return cnv->toULength;
+ }
+ return 0;
+}
+
+U_CAPI UBool U_EXPORT2
+ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status){
+ if (U_FAILURE(*status)) {
+ return FALSE;
+ }
+
+ if (cnv == NULL) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return FALSE;
+ }
+
+ switch (ucnv_getType(cnv)) {
+ case UCNV_SBCS:
+ case UCNV_DBCS:
+ case UCNV_UTF32_BigEndian:
+ case UCNV_UTF32_LittleEndian:
+ case UCNV_UTF32:
+ case UCNV_US_ASCII:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+#endif
+
+/*
+ * Hey, Emacs, please set the following:
+ *
+ * Local Variables:
+ * indent-tabs-mode: nil
+ * End:
+ *
+ */
diff --git a/contrib/libs/icu/common/ucnv2022.cpp b/contrib/libs/icu/common/ucnv2022.cpp
index e704e1a776..169ad4c526 100644
--- a/contrib/libs/icu/common/ucnv2022.cpp
+++ b/contrib/libs/icu/common/ucnv2022.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: ucnv2022.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -478,7 +478,7 @@ setInitialStateFromUnicodeKR(UConverter* converter,UConverterDataISO2022 *myConv
static void U_CALLCONV
_ISO2022Open(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){
- char myLocale[7]={' ',' ',' ',' ',' ',' ', '\0'};
+ char myLocale[7]={' ',' ',' ',' ',' ',' ', '\0'};
cnv->extraInfo = uprv_malloc (sizeof (UConverterDataISO2022));
if(cnv->extraInfo != NULL) {
@@ -493,7 +493,7 @@ _ISO2022Open(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){
myConverterData->currentType = ASCII1;
cnv->fromUnicodeStatus =FALSE;
if(pArgs->locale){
- uprv_strncpy(myLocale, pArgs->locale, sizeof(myLocale)-1);
+ uprv_strncpy(myLocale, pArgs->locale, sizeof(myLocale)-1);
}
version = pArgs->options & UCNV_OPTIONS_VERSION_MASK;
myConverterData->version = version;
@@ -2772,7 +2772,7 @@ getTrailByte:
/* report a pair of illegal bytes if the second byte is not a DBCS starter */
++mySource;
/* add another bit so that the code below writes 2 bytes in case of error */
- mySourceChar = static_cast<UChar>(0x10000 | (mySourceChar << 8) | trailByte);
+ mySourceChar = static_cast<UChar>(0x10000 | (mySourceChar << 8) | trailByte);
}
} else {
args->converter->toUBytes[0] = (uint8_t)mySourceChar;
@@ -3304,7 +3304,7 @@ UConverter_toUnicode_ISO_2022_CN_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
myData->isEmptySegment = FALSE; /* we are handling it, reset to avoid future spurious errors */
*err = U_ILLEGAL_ESCAPE_SEQUENCE;
args->converter->toUCallbackReason = UCNV_IRREGULAR;
- args->converter->toUBytes[0] = static_cast<uint8_t>(mySourceChar);
+ args->converter->toUBytes[0] = static_cast<uint8_t>(mySourceChar);
args->converter->toULength = 1;
args->target = myTarget;
args->source = mySource;
@@ -3512,14 +3512,14 @@ _ISO_2022_WriteSub(UConverterFromUnicodeArgs *args, int32_t offsetIndex, UErrorC
case 'k':
if(myConverterData->version == 0) {
if(length == 1) {
- if(args->converter->fromUnicodeStatus) {
+ if(args->converter->fromUnicodeStatus) {
/* in DBCS mode: switch to SBCS */
args->converter->fromUnicodeStatus = 0;
*p++ = UCNV_SI;
}
*p++ = subchar[0];
} else /* length == 2*/ {
- if(!args->converter->fromUnicodeStatus) {
+ if(!args->converter->fromUnicodeStatus) {
/* in SBCS mode: switch to DBCS */
args->converter->fromUnicodeStatus = 1;
*p++ = UCNV_SO;
@@ -3593,10 +3593,10 @@ _ISO_2022_SafeClone(
UConverterDataISO2022 *cnvData;
int32_t i, size;
- if (U_FAILURE(*status)){
- return nullptr;
- }
-
+ if (U_FAILURE(*status)){
+ return nullptr;
+ }
+
if (*pBufferSize == 0) { /* 'preflighting' request - set needed size into *pBufferSize */
*pBufferSize = (int32_t)sizeof(struct cloneStruct);
return NULL;
@@ -3614,7 +3614,7 @@ _ISO_2022_SafeClone(
/* share the subconverters */
if(cnvData->currentConverter != NULL) {
- size = (int32_t)sizeof(UConverter);
+ size = (int32_t)sizeof(UConverter);
localClone->mydata.currentConverter =
ucnv_safeClone(cnvData->currentConverter,
&localClone->currentConverter,
diff --git a/contrib/libs/icu/common/ucnv_bld.cpp b/contrib/libs/icu/common/ucnv_bld.cpp
index 83c84bb4db..56fc3d6822 100644
--- a/contrib/libs/icu/common/ucnv_bld.cpp
+++ b/contrib/libs/icu/common/ucnv_bld.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************
@@ -194,9 +194,9 @@ static struct {
/*initializes some global variables */
static UHashtable *SHARED_DATA_HASHTABLE = NULL;
-static icu::UMutex cnvCacheMutex;
-/* Note: the global mutex is used for */
-/* reference count updates. */
+static icu::UMutex cnvCacheMutex;
+/* Note: the global mutex is used for */
+/* reference count updates. */
static const char **gAvailableConverters = NULL;
static uint16_t gAvailableConverterCount = 0;
@@ -261,11 +261,11 @@ static UBool U_CALLCONV ucnv_cleanup(void) {
return (SHARED_DATA_HASHTABLE == NULL);
}
-U_CAPI void U_EXPORT2
-ucnv_enableCleanup() {
- ucln_common_registerCleanup(UCLN_COMMON_UCNV, ucnv_cleanup);
-}
-
+U_CAPI void U_EXPORT2
+ucnv_enableCleanup() {
+ ucln_common_registerCleanup(UCLN_COMMON_UCNV, ucnv_cleanup);
+}
+
static UBool U_CALLCONV
isCnvAcceptable(void * /*context*/,
const char * /*type*/, const char * /*name*/,
@@ -444,7 +444,7 @@ ucnv_shareConverterData(UConverterSharedData * data)
SHARED_DATA_HASHTABLE = uhash_openSize(uhash_hashChars, uhash_compareChars, NULL,
ucnv_io_countKnownConverters(&err)*UCNV_CACHE_LOAD_FACTOR,
&err);
- ucnv_enableCleanup();
+ ucnv_enableCleanup();
if (U_FAILURE(err))
return;
@@ -1104,7 +1104,7 @@ static void U_CALLCONV initAvailableConvertersList(UErrorCode &errCode) {
U_ASSERT(gAvailableConverterCount == 0);
U_ASSERT(gAvailableConverters == NULL);
- ucnv_enableCleanup();
+ ucnv_enableCleanup();
UEnumeration *allConvEnum = ucnv_openAllNames(&errCode);
int32_t allConverterCount = uenum_count(allConvEnum, &errCode);
if (U_FAILURE(errCode)) {
@@ -1210,7 +1210,7 @@ internalSetName(const char *name, UErrorCode *status) {
// -- Andy
gDefaultConverterName = gDefaultConverterNameBuffer;
- ucnv_enableCleanup();
+ ucnv_enableCleanup();
umtx_unlock(&cnvCacheMutex);
}
diff --git a/contrib/libs/icu/common/ucnv_bld.h b/contrib/libs/icu/common/ucnv_bld.h
index 48338d3a95..18b3795e4d 100644
--- a/contrib/libs/icu/common/ucnv_bld.h
+++ b/contrib/libs/icu/common/ucnv_bld.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -288,9 +288,9 @@ ucnv_swap(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode);
-U_CAPI void U_EXPORT2
-ucnv_enableCleanup();
-
+U_CAPI void U_EXPORT2
+ucnv_enableCleanup();
+
#endif
#endif /* _UCNV_BLD */
diff --git a/contrib/libs/icu/common/ucnv_cb.cpp b/contrib/libs/icu/common/ucnv_cb.cpp
index eb73621938..1bb0012014 100644
--- a/contrib/libs/icu/common/ucnv_cb.cpp
+++ b/contrib/libs/icu/common/ucnv_cb.cpp
@@ -1,261 +1,261 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-**********************************************************************
-* Copyright (C) 2000-2006, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
- * ucnv_cb.c:
- * External APIs for the ICU's codeset conversion library
- * Helena Shih
- *
- * Modification History:
- *
- * Date Name Description
- * 7/28/2000 srl Implementation
- */
-
-/**
- * @name Character Conversion C API
- *
- */
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_CONVERSION
-
-#include "unicode/ucnv_cb.h"
-#include "ucnv_bld.h"
-#include "ucnv_cnv.h"
-#include "cmemory.h"
-
-/* need to update the offsets when the target moves. */
-/* Note: Recursion may occur in the cb functions, be sure to update the offsets correctly
-if you don't use ucnv_cbXXX functions. Make sure you don't use the same callback within
-the same call stack if the complexity arises. */
-U_CAPI void U_EXPORT2
-ucnv_cbFromUWriteBytes (UConverterFromUnicodeArgs *args,
- const char* source,
- int32_t length,
- int32_t offsetIndex,
- UErrorCode * err)
-{
- if(U_FAILURE(*err)) {
- return;
- }
-
- ucnv_fromUWriteBytes(
- args->converter,
- source, length,
- &args->target, args->targetLimit,
- &args->offsets, offsetIndex,
- err);
-}
-
-U_CAPI void U_EXPORT2
-ucnv_cbFromUWriteUChars(UConverterFromUnicodeArgs *args,
- const UChar** source,
- const UChar* sourceLimit,
- int32_t offsetIndex,
- UErrorCode * err)
-{
- /*
- This is a fun one. Recursion can occur - we're basically going to
- just retry shoving data through the same converter. Note, if you got
- here through some kind of invalid sequence, you maybe should emit a
- reset sequence of some kind and/or call ucnv_reset(). Since this
- IS an actual conversion, take care that you've changed the callback
- or the data, or you'll get an infinite loop.
-
- Please set the err value to something reasonable before calling
- into this.
- */
-
- char *oldTarget;
-
- if(U_FAILURE(*err))
- {
- return;
- }
-
- oldTarget = args->target;
-
- ucnv_fromUnicode(args->converter,
- &args->target,
- args->targetLimit,
- source,
- sourceLimit,
- NULL, /* no offsets */
- FALSE, /* no flush */
- err);
-
- if(args->offsets)
- {
- while (args->target != oldTarget) /* if it moved at all.. */
- {
- *(args->offsets)++ = offsetIndex;
- oldTarget++;
- }
- }
-
- /*
- Note, if you did something like used a Stop subcallback, things would get interesting.
- In fact, here's where we want to return the partially consumed in-source!
- */
- if(*err == U_BUFFER_OVERFLOW_ERROR)
- /* && (*source < sourceLimit && args->target >= args->targetLimit)
- -- S. Hrcek */
- {
- /* Overflowed the target. Now, we'll write into the charErrorBuffer.
- It's a fixed size. If we overflow it... Hmm */
- char *newTarget;
- const char *newTargetLimit;
- UErrorCode err2 = U_ZERO_ERROR;
-
- int8_t errBuffLen;
-
- errBuffLen = args->converter->charErrorBufferLength;
-
- /* start the new target at the first free slot in the errbuff.. */
- newTarget = (char *)(args->converter->charErrorBuffer + errBuffLen);
-
- newTargetLimit = (char *)(args->converter->charErrorBuffer +
- sizeof(args->converter->charErrorBuffer));
-
- if(newTarget >= newTargetLimit)
- {
- *err = U_INTERNAL_PROGRAM_ERROR;
- return;
- }
-
- /* We're going to tell the converter that the errbuff len is empty.
- This prevents the existing errbuff from being 'flushed' out onto
- itself. If the errbuff is needed by the converter this time,
- we're hosed - we're out of space! */
-
- args->converter->charErrorBufferLength = 0;
-
- ucnv_fromUnicode(args->converter,
- &newTarget,
- newTargetLimit,
- source,
- sourceLimit,
- NULL,
- FALSE,
- &err2);
-
- /* We can go ahead and overwrite the length here. We know just how
- to recalculate it. */
-
- args->converter->charErrorBufferLength = (int8_t)(
- newTarget - (char*)args->converter->charErrorBuffer);
-
- if((newTarget >= newTargetLimit) || (err2 == U_BUFFER_OVERFLOW_ERROR))
- {
- /* now we're REALLY in trouble.
- Internal program error - callback shouldn't have written this much
- data!
- */
- *err = U_INTERNAL_PROGRAM_ERROR;
- return;
- }
- /*else {*/
- /* sub errs could be invalid/truncated/illegal chars or w/e.
- These might want to be passed on up.. But the problem is, we already
- need to pass U_BUFFER_OVERFLOW_ERROR. That has to override these
- other errs.. */
-
- /*
- if(U_FAILURE(err2))
- ??
- */
- /*}*/
- }
-}
-
-U_CAPI void U_EXPORT2
-ucnv_cbFromUWriteSub (UConverterFromUnicodeArgs *args,
- int32_t offsetIndex,
- UErrorCode * err)
-{
- UConverter *converter;
- int32_t length;
-
- if(U_FAILURE(*err)) {
- return;
- }
- converter = args->converter;
- length = converter->subCharLen;
-
- if(length == 0) {
- return;
- }
-
- if(length < 0) {
- /*
- * Write/convert the substitution string. Its real length is -length.
- * Unlike the escape callback, we need not change the converter's
- * callback function because ucnv_setSubstString() verified that
- * the string can be converted, so we will not get a conversion error
- * and will not recurse.
- * At worst we should get a U_BUFFER_OVERFLOW_ERROR.
- */
- const UChar *source = (const UChar *)converter->subChars;
- ucnv_cbFromUWriteUChars(args, &source, source - length, offsetIndex, err);
- return;
- }
-
- if(converter->sharedData->impl->writeSub!=NULL) {
- converter->sharedData->impl->writeSub(args, offsetIndex, err);
- }
- else if(converter->subChar1!=0 && (uint16_t)converter->invalidUCharBuffer[0]<=(uint16_t)0xffu) {
- /*
- TODO: Is this untestable because the MBCS converter has a writeSub function to call
- and the other converters don't use subChar1?
- */
- ucnv_cbFromUWriteBytes(args,
- (const char *)&converter->subChar1, 1,
- offsetIndex, err);
- }
- else {
- ucnv_cbFromUWriteBytes(args,
- (const char *)converter->subChars, length,
- offsetIndex, err);
- }
-}
-
-U_CAPI void U_EXPORT2
-ucnv_cbToUWriteUChars (UConverterToUnicodeArgs *args,
- const UChar* source,
- int32_t length,
- int32_t offsetIndex,
- UErrorCode * err)
-{
- if(U_FAILURE(*err)) {
- return;
- }
-
- ucnv_toUWriteUChars(
- args->converter,
- source, length,
- &args->target, args->targetLimit,
- &args->offsets, offsetIndex,
- err);
-}
-
-U_CAPI void U_EXPORT2
-ucnv_cbToUWriteSub (UConverterToUnicodeArgs *args,
- int32_t offsetIndex,
- UErrorCode * err)
-{
- static const UChar kSubstituteChar1 = 0x1A, kSubstituteChar = 0xFFFD;
-
- /* could optimize this case, just one uchar */
- if(args->converter->invalidCharLength == 1 && args->converter->subChar1 != 0) {
- ucnv_cbToUWriteUChars(args, &kSubstituteChar1, 1, offsetIndex, err);
- } else {
- ucnv_cbToUWriteUChars(args, &kSubstituteChar, 1, offsetIndex, err);
- }
-}
-
-#endif
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+**********************************************************************
+* Copyright (C) 2000-2006, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+ * ucnv_cb.c:
+ * External APIs for the ICU's codeset conversion library
+ * Helena Shih
+ *
+ * Modification History:
+ *
+ * Date Name Description
+ * 7/28/2000 srl Implementation
+ */
+
+/**
+ * @name Character Conversion C API
+ *
+ */
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "unicode/ucnv_cb.h"
+#include "ucnv_bld.h"
+#include "ucnv_cnv.h"
+#include "cmemory.h"
+
+/* need to update the offsets when the target moves. */
+/* Note: Recursion may occur in the cb functions, be sure to update the offsets correctly
+if you don't use ucnv_cbXXX functions. Make sure you don't use the same callback within
+the same call stack if the complexity arises. */
+U_CAPI void U_EXPORT2
+ucnv_cbFromUWriteBytes (UConverterFromUnicodeArgs *args,
+ const char* source,
+ int32_t length,
+ int32_t offsetIndex,
+ UErrorCode * err)
+{
+ if(U_FAILURE(*err)) {
+ return;
+ }
+
+ ucnv_fromUWriteBytes(
+ args->converter,
+ source, length,
+ &args->target, args->targetLimit,
+ &args->offsets, offsetIndex,
+ err);
+}
+
+U_CAPI void U_EXPORT2
+ucnv_cbFromUWriteUChars(UConverterFromUnicodeArgs *args,
+ const UChar** source,
+ const UChar* sourceLimit,
+ int32_t offsetIndex,
+ UErrorCode * err)
+{
+ /*
+ This is a fun one. Recursion can occur - we're basically going to
+ just retry shoving data through the same converter. Note, if you got
+ here through some kind of invalid sequence, you maybe should emit a
+ reset sequence of some kind and/or call ucnv_reset(). Since this
+ IS an actual conversion, take care that you've changed the callback
+ or the data, or you'll get an infinite loop.
+
+ Please set the err value to something reasonable before calling
+ into this.
+ */
+
+ char *oldTarget;
+
+ if(U_FAILURE(*err))
+ {
+ return;
+ }
+
+ oldTarget = args->target;
+
+ ucnv_fromUnicode(args->converter,
+ &args->target,
+ args->targetLimit,
+ source,
+ sourceLimit,
+ NULL, /* no offsets */
+ FALSE, /* no flush */
+ err);
+
+ if(args->offsets)
+ {
+ while (args->target != oldTarget) /* if it moved at all.. */
+ {
+ *(args->offsets)++ = offsetIndex;
+ oldTarget++;
+ }
+ }
+
+ /*
+ Note, if you did something like used a Stop subcallback, things would get interesting.
+ In fact, here's where we want to return the partially consumed in-source!
+ */
+ if(*err == U_BUFFER_OVERFLOW_ERROR)
+ /* && (*source < sourceLimit && args->target >= args->targetLimit)
+ -- S. Hrcek */
+ {
+ /* Overflowed the target. Now, we'll write into the charErrorBuffer.
+ It's a fixed size. If we overflow it... Hmm */
+ char *newTarget;
+ const char *newTargetLimit;
+ UErrorCode err2 = U_ZERO_ERROR;
+
+ int8_t errBuffLen;
+
+ errBuffLen = args->converter->charErrorBufferLength;
+
+ /* start the new target at the first free slot in the errbuff.. */
+ newTarget = (char *)(args->converter->charErrorBuffer + errBuffLen);
+
+ newTargetLimit = (char *)(args->converter->charErrorBuffer +
+ sizeof(args->converter->charErrorBuffer));
+
+ if(newTarget >= newTargetLimit)
+ {
+ *err = U_INTERNAL_PROGRAM_ERROR;
+ return;
+ }
+
+ /* We're going to tell the converter that the errbuff len is empty.
+ This prevents the existing errbuff from being 'flushed' out onto
+ itself. If the errbuff is needed by the converter this time,
+ we're hosed - we're out of space! */
+
+ args->converter->charErrorBufferLength = 0;
+
+ ucnv_fromUnicode(args->converter,
+ &newTarget,
+ newTargetLimit,
+ source,
+ sourceLimit,
+ NULL,
+ FALSE,
+ &err2);
+
+ /* We can go ahead and overwrite the length here. We know just how
+ to recalculate it. */
+
+ args->converter->charErrorBufferLength = (int8_t)(
+ newTarget - (char*)args->converter->charErrorBuffer);
+
+ if((newTarget >= newTargetLimit) || (err2 == U_BUFFER_OVERFLOW_ERROR))
+ {
+ /* now we're REALLY in trouble.
+ Internal program error - callback shouldn't have written this much
+ data!
+ */
+ *err = U_INTERNAL_PROGRAM_ERROR;
+ return;
+ }
+ /*else {*/
+ /* sub errs could be invalid/truncated/illegal chars or w/e.
+ These might want to be passed on up.. But the problem is, we already
+ need to pass U_BUFFER_OVERFLOW_ERROR. That has to override these
+ other errs.. */
+
+ /*
+ if(U_FAILURE(err2))
+ ??
+ */
+ /*}*/
+ }
+}
+
+U_CAPI void U_EXPORT2
+ucnv_cbFromUWriteSub (UConverterFromUnicodeArgs *args,
+ int32_t offsetIndex,
+ UErrorCode * err)
+{
+ UConverter *converter;
+ int32_t length;
+
+ if(U_FAILURE(*err)) {
+ return;
+ }
+ converter = args->converter;
+ length = converter->subCharLen;
+
+ if(length == 0) {
+ return;
+ }
+
+ if(length < 0) {
+ /*
+ * Write/convert the substitution string. Its real length is -length.
+ * Unlike the escape callback, we need not change the converter's
+ * callback function because ucnv_setSubstString() verified that
+ * the string can be converted, so we will not get a conversion error
+ * and will not recurse.
+ * At worst we should get a U_BUFFER_OVERFLOW_ERROR.
+ */
+ const UChar *source = (const UChar *)converter->subChars;
+ ucnv_cbFromUWriteUChars(args, &source, source - length, offsetIndex, err);
+ return;
+ }
+
+ if(converter->sharedData->impl->writeSub!=NULL) {
+ converter->sharedData->impl->writeSub(args, offsetIndex, err);
+ }
+ else if(converter->subChar1!=0 && (uint16_t)converter->invalidUCharBuffer[0]<=(uint16_t)0xffu) {
+ /*
+ TODO: Is this untestable because the MBCS converter has a writeSub function to call
+ and the other converters don't use subChar1?
+ */
+ ucnv_cbFromUWriteBytes(args,
+ (const char *)&converter->subChar1, 1,
+ offsetIndex, err);
+ }
+ else {
+ ucnv_cbFromUWriteBytes(args,
+ (const char *)converter->subChars, length,
+ offsetIndex, err);
+ }
+}
+
+U_CAPI void U_EXPORT2
+ucnv_cbToUWriteUChars (UConverterToUnicodeArgs *args,
+ const UChar* source,
+ int32_t length,
+ int32_t offsetIndex,
+ UErrorCode * err)
+{
+ if(U_FAILURE(*err)) {
+ return;
+ }
+
+ ucnv_toUWriteUChars(
+ args->converter,
+ source, length,
+ &args->target, args->targetLimit,
+ &args->offsets, offsetIndex,
+ err);
+}
+
+U_CAPI void U_EXPORT2
+ucnv_cbToUWriteSub (UConverterToUnicodeArgs *args,
+ int32_t offsetIndex,
+ UErrorCode * err)
+{
+ static const UChar kSubstituteChar1 = 0x1A, kSubstituteChar = 0xFFFD;
+
+ /* could optimize this case, just one uchar */
+ if(args->converter->invalidCharLength == 1 && args->converter->subChar1 != 0) {
+ ucnv_cbToUWriteUChars(args, &kSubstituteChar1, 1, offsetIndex, err);
+ } else {
+ ucnv_cbToUWriteUChars(args, &kSubstituteChar, 1, offsetIndex, err);
+ }
+}
+
+#endif
diff --git a/contrib/libs/icu/common/ucnv_cnv.cpp b/contrib/libs/icu/common/ucnv_cnv.cpp
index 7c893a679f..ea71acf92c 100644
--- a/contrib/libs/icu/common/ucnv_cnv.cpp
+++ b/contrib/libs/icu/common/ucnv_cnv.cpp
@@ -1,182 +1,182 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 1999-2004, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-*
-* uconv_cnv.c:
-* Implements all the low level conversion functions
-* T_UnicodeConverter_{to,from}Unicode_$ConversionType
-*
-* Change history:
-*
-* 06/29/2000 helena Major rewrite of the callback APIs.
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_CONVERSION
-
-#include "unicode/ucnv_err.h"
-#include "unicode/ucnv.h"
-#include "unicode/uset.h"
-#include "ucnv_cnv.h"
-#include "ucnv_bld.h"
-#include "cmemory.h"
-
-U_CFUNC void
-ucnv_getCompleteUnicodeSet(const UConverter *cnv,
- const USetAdder *sa,
- UConverterUnicodeSet which,
- UErrorCode *pErrorCode) {
- (void)cnv;
- (void)which;
- (void)pErrorCode;
- sa->addRange(sa->set, 0, 0x10ffff);
-}
-
-U_CFUNC void
-ucnv_getNonSurrogateUnicodeSet(const UConverter *cnv,
- const USetAdder *sa,
- UConverterUnicodeSet which,
- UErrorCode *pErrorCode) {
- (void)cnv;
- (void)which;
- (void)pErrorCode;
- sa->addRange(sa->set, 0, 0xd7ff);
- sa->addRange(sa->set, 0xe000, 0x10ffff);
-}
-
-U_CFUNC void
-ucnv_fromUWriteBytes(UConverter *cnv,
- const char *bytes, int32_t length,
- char **target, const char *targetLimit,
- int32_t **offsets,
- int32_t sourceIndex,
- UErrorCode *pErrorCode) {
- char *t=*target;
- int32_t *o;
-
- /* write bytes */
- if(offsets==NULL || (o=*offsets)==NULL) {
- while(length>0 && t<targetLimit) {
- *t++=*bytes++;
- --length;
- }
- } else {
- /* output with offsets */
- while(length>0 && t<targetLimit) {
- *t++=*bytes++;
- *o++=sourceIndex;
- --length;
- }
- *offsets=o;
- }
- *target=t;
-
- /* write overflow */
- if(length>0) {
- if(cnv!=NULL) {
- t=(char *)cnv->charErrorBuffer;
- cnv->charErrorBufferLength=(int8_t)length;
- do {
- *t++=(uint8_t)*bytes++;
- } while(--length>0);
- }
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
-}
-
-U_CFUNC void
-ucnv_toUWriteUChars(UConverter *cnv,
- const UChar *uchars, int32_t length,
- UChar **target, const UChar *targetLimit,
- int32_t **offsets,
- int32_t sourceIndex,
- UErrorCode *pErrorCode) {
- UChar *t=*target;
- int32_t *o;
-
- /* write UChars */
- if(offsets==NULL || (o=*offsets)==NULL) {
- while(length>0 && t<targetLimit) {
- *t++=*uchars++;
- --length;
- }
- } else {
- /* output with offsets */
- while(length>0 && t<targetLimit) {
- *t++=*uchars++;
- *o++=sourceIndex;
- --length;
- }
- *offsets=o;
- }
- *target=t;
-
- /* write overflow */
- if(length>0) {
- if(cnv!=NULL) {
- t=cnv->UCharErrorBuffer;
- cnv->UCharErrorBufferLength=(int8_t)length;
- do {
- *t++=*uchars++;
- } while(--length>0);
- }
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
-}
-
-U_CFUNC void
-ucnv_toUWriteCodePoint(UConverter *cnv,
- UChar32 c,
- UChar **target, const UChar *targetLimit,
- int32_t **offsets,
- int32_t sourceIndex,
- UErrorCode *pErrorCode) {
- UChar *t;
- int32_t *o;
-
- t=*target;
-
- if(t<targetLimit) {
- if(c<=0xffff) {
- *t++=(UChar)c;
- c=U_SENTINEL;
- } else /* c is a supplementary code point */ {
- *t++=U16_LEAD(c);
- c=U16_TRAIL(c);
- if(t<targetLimit) {
- *t++=(UChar)c;
- c=U_SENTINEL;
- }
- }
-
- /* write offsets */
- if(offsets!=NULL && (o=*offsets)!=NULL) {
- *o++=sourceIndex;
- if((*target+1)<t) {
- *o++=sourceIndex;
- }
- *offsets=o;
- }
- }
-
- *target=t;
-
- /* write overflow from c */
- if(c>=0) {
- if(cnv!=NULL) {
- int8_t i=0;
- U16_APPEND_UNSAFE(cnv->UCharErrorBuffer, i, c);
- cnv->UCharErrorBufferLength=i;
- }
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
-}
-
-#endif
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 1999-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+*
+* uconv_cnv.c:
+* Implements all the low level conversion functions
+* T_UnicodeConverter_{to,from}Unicode_$ConversionType
+*
+* Change history:
+*
+* 06/29/2000 helena Major rewrite of the callback APIs.
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "unicode/ucnv_err.h"
+#include "unicode/ucnv.h"
+#include "unicode/uset.h"
+#include "ucnv_cnv.h"
+#include "ucnv_bld.h"
+#include "cmemory.h"
+
+U_CFUNC void
+ucnv_getCompleteUnicodeSet(const UConverter *cnv,
+ const USetAdder *sa,
+ UConverterUnicodeSet which,
+ UErrorCode *pErrorCode) {
+ (void)cnv;
+ (void)which;
+ (void)pErrorCode;
+ sa->addRange(sa->set, 0, 0x10ffff);
+}
+
+U_CFUNC void
+ucnv_getNonSurrogateUnicodeSet(const UConverter *cnv,
+ const USetAdder *sa,
+ UConverterUnicodeSet which,
+ UErrorCode *pErrorCode) {
+ (void)cnv;
+ (void)which;
+ (void)pErrorCode;
+ sa->addRange(sa->set, 0, 0xd7ff);
+ sa->addRange(sa->set, 0xe000, 0x10ffff);
+}
+
+U_CFUNC void
+ucnv_fromUWriteBytes(UConverter *cnv,
+ const char *bytes, int32_t length,
+ char **target, const char *targetLimit,
+ int32_t **offsets,
+ int32_t sourceIndex,
+ UErrorCode *pErrorCode) {
+ char *t=*target;
+ int32_t *o;
+
+ /* write bytes */
+ if(offsets==NULL || (o=*offsets)==NULL) {
+ while(length>0 && t<targetLimit) {
+ *t++=*bytes++;
+ --length;
+ }
+ } else {
+ /* output with offsets */
+ while(length>0 && t<targetLimit) {
+ *t++=*bytes++;
+ *o++=sourceIndex;
+ --length;
+ }
+ *offsets=o;
+ }
+ *target=t;
+
+ /* write overflow */
+ if(length>0) {
+ if(cnv!=NULL) {
+ t=(char *)cnv->charErrorBuffer;
+ cnv->charErrorBufferLength=(int8_t)length;
+ do {
+ *t++=(uint8_t)*bytes++;
+ } while(--length>0);
+ }
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+}
+
+U_CFUNC void
+ucnv_toUWriteUChars(UConverter *cnv,
+ const UChar *uchars, int32_t length,
+ UChar **target, const UChar *targetLimit,
+ int32_t **offsets,
+ int32_t sourceIndex,
+ UErrorCode *pErrorCode) {
+ UChar *t=*target;
+ int32_t *o;
+
+ /* write UChars */
+ if(offsets==NULL || (o=*offsets)==NULL) {
+ while(length>0 && t<targetLimit) {
+ *t++=*uchars++;
+ --length;
+ }
+ } else {
+ /* output with offsets */
+ while(length>0 && t<targetLimit) {
+ *t++=*uchars++;
+ *o++=sourceIndex;
+ --length;
+ }
+ *offsets=o;
+ }
+ *target=t;
+
+ /* write overflow */
+ if(length>0) {
+ if(cnv!=NULL) {
+ t=cnv->UCharErrorBuffer;
+ cnv->UCharErrorBufferLength=(int8_t)length;
+ do {
+ *t++=*uchars++;
+ } while(--length>0);
+ }
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+}
+
+U_CFUNC void
+ucnv_toUWriteCodePoint(UConverter *cnv,
+ UChar32 c,
+ UChar **target, const UChar *targetLimit,
+ int32_t **offsets,
+ int32_t sourceIndex,
+ UErrorCode *pErrorCode) {
+ UChar *t;
+ int32_t *o;
+
+ t=*target;
+
+ if(t<targetLimit) {
+ if(c<=0xffff) {
+ *t++=(UChar)c;
+ c=U_SENTINEL;
+ } else /* c is a supplementary code point */ {
+ *t++=U16_LEAD(c);
+ c=U16_TRAIL(c);
+ if(t<targetLimit) {
+ *t++=(UChar)c;
+ c=U_SENTINEL;
+ }
+ }
+
+ /* write offsets */
+ if(offsets!=NULL && (o=*offsets)!=NULL) {
+ *o++=sourceIndex;
+ if((*target+1)<t) {
+ *o++=sourceIndex;
+ }
+ *offsets=o;
+ }
+ }
+
+ *target=t;
+
+ /* write overflow from c */
+ if(c>=0) {
+ if(cnv!=NULL) {
+ int8_t i=0;
+ U16_APPEND_UNSAFE(cnv->UCharErrorBuffer, i, c);
+ cnv->UCharErrorBufferLength=i;
+ }
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+}
+
+#endif
diff --git a/contrib/libs/icu/common/ucnv_cnv.h b/contrib/libs/icu/common/ucnv_cnv.h
index 6968ef617c..2eed2c60df 100644
--- a/contrib/libs/icu/common/ucnv_cnv.h
+++ b/contrib/libs/icu/common/ucnv_cnv.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/ucnv_ct.cpp b/contrib/libs/icu/common/ucnv_ct.cpp
index 24e597c302..b40e1b2c97 100644
--- a/contrib/libs/icu/common/ucnv_ct.cpp
+++ b/contrib/libs/icu/common/ucnv_ct.cpp
@@ -1,646 +1,646 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-**********************************************************************
-* Copyright (C) 2010-2015, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
-* file name: ucnv_ct.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 2010Dec09
-* created by: Michael Ow
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION
-
-#include "unicode/ucnv.h"
-#include "unicode/uset.h"
-#include "unicode/ucnv_err.h"
-#include "unicode/ucnv_cb.h"
-#include "unicode/utf16.h"
-#include "ucnv_imp.h"
-#include "ucnv_bld.h"
-#include "ucnv_cnv.h"
-#include "ucnvmbcs.h"
-#include "cstring.h"
-#include "cmemory.h"
-
-typedef enum {
- INVALID = -2,
- DO_SEARCH = -1,
-
- COMPOUND_TEXT_SINGLE_0 = 0,
- COMPOUND_TEXT_SINGLE_1 = 1,
- COMPOUND_TEXT_SINGLE_2 = 2,
- COMPOUND_TEXT_SINGLE_3 = 3,
-
- COMPOUND_TEXT_DOUBLE_1 = 4,
- COMPOUND_TEXT_DOUBLE_2 = 5,
- COMPOUND_TEXT_DOUBLE_3 = 6,
- COMPOUND_TEXT_DOUBLE_4 = 7,
- COMPOUND_TEXT_DOUBLE_5 = 8,
- COMPOUND_TEXT_DOUBLE_6 = 9,
- COMPOUND_TEXT_DOUBLE_7 = 10,
-
- COMPOUND_TEXT_TRIPLE_DOUBLE = 11,
-
- IBM_915 = 12,
- IBM_916 = 13,
- IBM_914 = 14,
- IBM_874 = 15,
- IBM_912 = 16,
- IBM_913 = 17,
- ISO_8859_14 = 18,
- IBM_923 = 19,
- NUM_OF_CONVERTERS = 20
-} COMPOUND_TEXT_CONVERTERS;
-
-#define SEARCH_LENGTH 12
-
-static const uint8_t escSeqCompoundText[NUM_OF_CONVERTERS][5] = {
- /* Single */
- { 0x1B, 0x2D, 0x41, 0, 0 },
- { 0x1B, 0x2D, 0x4D, 0, 0 },
- { 0x1B, 0x2D, 0x46, 0, 0 },
- { 0x1B, 0x2D, 0x47, 0, 0 },
-
- /* Double */
- { 0x1B, 0x24, 0x29, 0x41, 0 },
- { 0x1B, 0x24, 0x29, 0x42, 0 },
- { 0x1B, 0x24, 0x29, 0x43, 0 },
- { 0x1B, 0x24, 0x29, 0x44, 0 },
- { 0x1B, 0x24, 0x29, 0x47, 0 },
- { 0x1B, 0x24, 0x29, 0x48, 0 },
- { 0x1B, 0x24, 0x29, 0x49, 0 },
-
- /* Triple/Double */
- { 0x1B, 0x25, 0x47, 0, 0 },
-
- /*IBM-915*/
- { 0x1B, 0x2D, 0x4C, 0, 0 },
- /*IBM-916*/
- { 0x1B, 0x2D, 0x48, 0, 0 },
- /*IBM-914*/
- { 0x1B, 0x2D, 0x44, 0, 0 },
- /*IBM-874*/
- { 0x1B, 0x2D, 0x54, 0, 0 },
- /*IBM-912*/
- { 0x1B, 0x2D, 0x42, 0, 0 },
- /* IBM-913 */
- { 0x1B, 0x2D, 0x43, 0, 0 },
- /* ISO-8859_14 */
- { 0x1B, 0x2D, 0x5F, 0, 0 },
- /* IBM-923 */
- { 0x1B, 0x2D, 0x62, 0, 0 },
-};
-
-#define ESC_START 0x1B
-
-#define isASCIIRange(codepoint) \
- ((codepoint == 0x0000) || (codepoint == 0x0009) || (codepoint == 0x000A) || \
- (codepoint >= 0x0020 && codepoint <= 0x007f) || (codepoint >= 0x00A0 && codepoint <= 0x00FF))
-
-#define isIBM915(codepoint) \
- ((codepoint >= 0x0401 && codepoint <= 0x045F) || (codepoint == 0x2116))
-
-#define isIBM916(codepoint) \
- ((codepoint >= 0x05D0 && codepoint <= 0x05EA) || (codepoint == 0x2017) || (codepoint == 0x203E))
-
-#define isCompoundS3(codepoint) \
- ((codepoint == 0x060C) || (codepoint == 0x061B) || (codepoint == 0x061F) || (codepoint >= 0x0621 && codepoint <= 0x063A) || \
- (codepoint >= 0x0640 && codepoint <= 0x0652) || (codepoint >= 0x0660 && codepoint <= 0x066D) || (codepoint == 0x200B) || \
- (codepoint >= 0x0FE70 && codepoint <= 0x0FE72) || (codepoint == 0x0FE74) || (codepoint >= 0x0FE76 && codepoint <= 0x0FEBE))
-
-#define isCompoundS2(codepoint) \
- ((codepoint == 0x02BC) || (codepoint == 0x02BD) || (codepoint >= 0x0384 && codepoint <= 0x03CE) || (codepoint == 0x2015))
-
-#define isIBM914(codepoint) \
- ((codepoint == 0x0100) || (codepoint == 0x0101) || (codepoint == 0x0112) || (codepoint == 0x0113) || (codepoint == 0x0116) || (codepoint == 0x0117) || \
- (codepoint == 0x0122) || (codepoint == 0x0123) || (codepoint >= 0x0128 && codepoint <= 0x012B) || (codepoint == 0x012E) || (codepoint == 0x012F) || \
- (codepoint >= 0x0136 && codepoint <= 0x0138) || (codepoint == 0x013B) || (codepoint == 0x013C) || (codepoint == 0x0145) || (codepoint == 0x0146) || \
- (codepoint >= 0x014A && codepoint <= 0x014D) || (codepoint == 0x0156) || (codepoint == 0x0157) || (codepoint >= 0x0166 && codepoint <= 0x016B) || \
- (codepoint == 0x0172) || (codepoint == 0x0173))
-
-#define isIBM874(codepoint) \
- ((codepoint >= 0x0E01 && codepoint <= 0x0E3A) || (codepoint >= 0x0E3F && codepoint <= 0x0E5B))
-
-#define isIBM912(codepoint) \
- ((codepoint >= 0x0102 && codepoint <= 0x0107) || (codepoint >= 0x010C && codepoint <= 0x0111) || (codepoint >= 0x0118 && codepoint <= 0x011B) || \
- (codepoint == 0x0139) || (codepoint == 0x013A) || (codepoint == 0x013D) || (codepoint == 0x013E) || (codepoint >= 0x0141 && codepoint <= 0x0144) || \
- (codepoint == 0x0147) || (codepoint == 0x0147) || (codepoint == 0x0150) || (codepoint == 0x0151) || (codepoint == 0x0154) || (codepoint == 0x0155) || \
- (codepoint >= 0x0158 && codepoint <= 0x015B) || (codepoint == 0x015E) || (codepoint == 0x015F) || (codepoint >= 0x0160 && codepoint <= 0x0165) || \
- (codepoint == 0x016E) || (codepoint == 0x016F) || (codepoint == 0x0170) || (codepoint == 0x0171) || (codepoint >= 0x0179 && codepoint <= 0x017E) || \
- (codepoint == 0x02C7) || (codepoint == 0x02D8) || (codepoint == 0x02D9) || (codepoint == 0x02DB) || (codepoint == 0x02DD))
-
-#define isIBM913(codepoint) \
- ((codepoint >= 0x0108 && codepoint <= 0x010B) || (codepoint == 0x011C) || \
- (codepoint == 0x011D) || (codepoint == 0x0120) || (codepoint == 0x0121) || \
- (codepoint >= 0x0124 && codepoint <= 0x0127) || (codepoint == 0x0134) || (codepoint == 0x0135) || \
- (codepoint == 0x015C) || (codepoint == 0x015D) || (codepoint == 0x016C) || (codepoint == 0x016D))
-
-#define isCompoundS1(codepoint) \
- ((codepoint == 0x011E) || (codepoint == 0x011F) || (codepoint == 0x0130) || \
- (codepoint == 0x0131) || (codepoint >= 0x0218 && codepoint <= 0x021B))
-
-#define isISO8859_14(codepoint) \
- ((codepoint >= 0x0174 && codepoint <= 0x0177) || (codepoint == 0x1E0A) || \
- (codepoint == 0x1E0B) || (codepoint == 0x1E1E) || (codepoint == 0x1E1F) || \
- (codepoint == 0x1E40) || (codepoint == 0x1E41) || (codepoint == 0x1E56) || \
- (codepoint == 0x1E57) || (codepoint == 0x1E60) || (codepoint == 0x1E61) || \
- (codepoint == 0x1E6A) || (codepoint == 0x1E6B) || (codepoint == 0x1EF2) || \
- (codepoint == 0x1EF3) || (codepoint >= 0x1E80 && codepoint <= 0x1E85))
-
-#define isIBM923(codepoint) \
- ((codepoint == 0x0152) || (codepoint == 0x0153) || (codepoint == 0x0178) || (codepoint == 0x20AC))
-
-
-typedef struct{
- UConverterSharedData *myConverterArray[NUM_OF_CONVERTERS];
- COMPOUND_TEXT_CONVERTERS state;
-} UConverterDataCompoundText;
-
-/*********** Compound Text Converter Protos ***********/
-U_CDECL_BEGIN
-static void U_CALLCONV
-_CompoundTextOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode);
-
-static void U_CALLCONV
- _CompoundTextClose(UConverter *converter);
-
-static void U_CALLCONV
-_CompoundTextReset(UConverter *converter, UConverterResetChoice choice);
-
-static const char* U_CALLCONV
-_CompoundTextgetName(const UConverter* cnv);
-
-
-static int32_t findNextEsc(const char *source, const char *sourceLimit) {
- int32_t length = static_cast<int32_t>(sourceLimit - source);
- int32_t i;
- for (i = 1; i < length; i++) {
- if (*(source + i) == 0x1B) {
- return i;
- }
- }
-
- return length;
-}
-
-static COMPOUND_TEXT_CONVERTERS getState(int codepoint) {
- COMPOUND_TEXT_CONVERTERS state = DO_SEARCH;
-
- if (isASCIIRange(codepoint)) {
- state = COMPOUND_TEXT_SINGLE_0;
- } else if (isIBM912(codepoint)) {
- state = IBM_912;
- }else if (isIBM913(codepoint)) {
- state = IBM_913;
- } else if (isISO8859_14(codepoint)) {
- state = ISO_8859_14;
- } else if (isIBM923(codepoint)) {
- state = IBM_923;
- } else if (isIBM874(codepoint)) {
- state = IBM_874;
- } else if (isIBM914(codepoint)) {
- state = IBM_914;
- } else if (isCompoundS2(codepoint)) {
- state = COMPOUND_TEXT_SINGLE_2;
- } else if (isCompoundS3(codepoint)) {
- state = COMPOUND_TEXT_SINGLE_3;
- } else if (isIBM916(codepoint)) {
- state = IBM_916;
- } else if (isIBM915(codepoint)) {
- state = IBM_915;
- } else if (isCompoundS1(codepoint)) {
- state = COMPOUND_TEXT_SINGLE_1;
- }
-
- return state;
-}
-
-static COMPOUND_TEXT_CONVERTERS findStateFromEscSeq(const char* source, const char* sourceLimit, const uint8_t* toUBytesBuffer, int32_t toUBytesBufferLength, UErrorCode *err) {
- COMPOUND_TEXT_CONVERTERS state = INVALID;
- UBool matchFound = FALSE;
- int32_t i, n, offset = toUBytesBufferLength;
-
- for (i = 0; i < NUM_OF_CONVERTERS; i++) {
- matchFound = TRUE;
- for (n = 0; escSeqCompoundText[i][n] != 0; n++) {
- if (n < toUBytesBufferLength) {
- if (toUBytesBuffer[n] != escSeqCompoundText[i][n]) {
- matchFound = FALSE;
- break;
- }
- } else if ((source + (n - offset)) >= sourceLimit) {
- *err = U_TRUNCATED_CHAR_FOUND;
- matchFound = FALSE;
- break;
- } else if (*(source + (n - offset)) != escSeqCompoundText[i][n]) {
- matchFound = FALSE;
- break;
- }
- }
-
- if (matchFound) {
- break;
- }
- }
-
- if (matchFound) {
- state = (COMPOUND_TEXT_CONVERTERS)i;
- }
-
- return state;
-}
-
-static void U_CALLCONV
-_CompoundTextOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){
- cnv->extraInfo = uprv_malloc (sizeof (UConverterDataCompoundText));
- if (cnv->extraInfo != NULL) {
- UConverterDataCompoundText *myConverterData = (UConverterDataCompoundText *) cnv->extraInfo;
-
- UConverterNamePieces stackPieces;
- UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER;
-
- myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_0] = NULL;
- myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_1] = ucnv_loadSharedData("icu-internal-compound-s1", &stackPieces, &stackArgs, errorCode);
- myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_2] = ucnv_loadSharedData("icu-internal-compound-s2", &stackPieces, &stackArgs, errorCode);
- myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_3] = ucnv_loadSharedData("icu-internal-compound-s3", &stackPieces, &stackArgs, errorCode);
- myConverterData->myConverterArray[COMPOUND_TEXT_DOUBLE_1] = ucnv_loadSharedData("icu-internal-compound-d1", &stackPieces, &stackArgs, errorCode);
- myConverterData->myConverterArray[COMPOUND_TEXT_DOUBLE_2] = ucnv_loadSharedData("icu-internal-compound-d2", &stackPieces, &stackArgs, errorCode);
- myConverterData->myConverterArray[COMPOUND_TEXT_DOUBLE_3] = ucnv_loadSharedData("icu-internal-compound-d3", &stackPieces, &stackArgs, errorCode);
- myConverterData->myConverterArray[COMPOUND_TEXT_DOUBLE_4] = ucnv_loadSharedData("icu-internal-compound-d4", &stackPieces, &stackArgs, errorCode);
- myConverterData->myConverterArray[COMPOUND_TEXT_DOUBLE_5] = ucnv_loadSharedData("icu-internal-compound-d5", &stackPieces, &stackArgs, errorCode);
- myConverterData->myConverterArray[COMPOUND_TEXT_DOUBLE_6] = ucnv_loadSharedData("icu-internal-compound-d6", &stackPieces, &stackArgs, errorCode);
- myConverterData->myConverterArray[COMPOUND_TEXT_DOUBLE_7] = ucnv_loadSharedData("icu-internal-compound-d7", &stackPieces, &stackArgs, errorCode);
- myConverterData->myConverterArray[COMPOUND_TEXT_TRIPLE_DOUBLE] = ucnv_loadSharedData("icu-internal-compound-t", &stackPieces, &stackArgs, errorCode);
-
- myConverterData->myConverterArray[IBM_915] = ucnv_loadSharedData("ibm-915_P100-1995", &stackPieces, &stackArgs, errorCode);
- myConverterData->myConverterArray[IBM_916] = ucnv_loadSharedData("ibm-916_P100-1995", &stackPieces, &stackArgs, errorCode);
- myConverterData->myConverterArray[IBM_914] = ucnv_loadSharedData("ibm-914_P100-1995", &stackPieces, &stackArgs, errorCode);
- myConverterData->myConverterArray[IBM_874] = ucnv_loadSharedData("ibm-874_P100-1995", &stackPieces, &stackArgs, errorCode);
- myConverterData->myConverterArray[IBM_912] = ucnv_loadSharedData("ibm-912_P100-1995", &stackPieces, &stackArgs, errorCode);
- myConverterData->myConverterArray[IBM_913] = ucnv_loadSharedData("ibm-913_P100-2000", &stackPieces, &stackArgs, errorCode);
- myConverterData->myConverterArray[ISO_8859_14] = ucnv_loadSharedData("iso-8859_14-1998", &stackPieces, &stackArgs, errorCode);
- myConverterData->myConverterArray[IBM_923] = ucnv_loadSharedData("ibm-923_P100-1998", &stackPieces, &stackArgs, errorCode);
-
- if (U_FAILURE(*errorCode) || pArgs->onlyTestIsLoadable) {
- _CompoundTextClose(cnv);
- return;
- }
-
- myConverterData->state = (COMPOUND_TEXT_CONVERTERS)0;
- } else {
- *errorCode = U_MEMORY_ALLOCATION_ERROR;
- }
-}
-
-
-static void U_CALLCONV
-_CompoundTextClose(UConverter *converter) {
- UConverterDataCompoundText* myConverterData = (UConverterDataCompoundText*)(converter->extraInfo);
- int32_t i;
-
- if (converter->extraInfo != NULL) {
- /*close the array of converter pointers and free the memory*/
- for (i = 0; i < NUM_OF_CONVERTERS; i++) {
- if (myConverterData->myConverterArray[i] != NULL) {
- ucnv_unloadSharedDataIfReady(myConverterData->myConverterArray[i]);
- }
- }
-
- uprv_free(converter->extraInfo);
- converter->extraInfo = NULL;
- }
-}
-
-static void U_CALLCONV
-_CompoundTextReset(UConverter *converter, UConverterResetChoice choice) {
- (void)converter;
- (void)choice;
-}
-
-static const char* U_CALLCONV
-_CompoundTextgetName(const UConverter* cnv){
- (void)cnv;
- return "x11-compound-text";
-}
-
-static void U_CALLCONV
-UConverter_fromUnicode_CompoundText_OFFSETS(UConverterFromUnicodeArgs* args, UErrorCode* err){
- UConverter *cnv = args->converter;
- uint8_t *target = (uint8_t *) args->target;
- const uint8_t *targetLimit = (const uint8_t *) args->targetLimit;
- const UChar* source = args->source;
- const UChar* sourceLimit = args->sourceLimit;
- /* int32_t* offsets = args->offsets; */
- UChar32 sourceChar;
- UBool useFallback = cnv->useFallback;
- uint8_t tmpTargetBuffer[7];
- int32_t tmpTargetBufferLength = 0;
- COMPOUND_TEXT_CONVERTERS currentState, tmpState;
- uint32_t pValue;
- int32_t pValueLength = 0;
- int32_t i, n, j;
-
- UConverterDataCompoundText *myConverterData = (UConverterDataCompoundText *) cnv->extraInfo;
-
- currentState = myConverterData->state;
-
- /* check if the last codepoint of previous buffer was a lead surrogate*/
- if((sourceChar = cnv->fromUChar32)!=0 && target< targetLimit) {
- goto getTrail;
- }
-
- while( source < sourceLimit){
- if(target < targetLimit){
-
- sourceChar = *(source++);
- /*check if the char is a First surrogate*/
- if(U16_IS_SURROGATE(sourceChar)) {
- if(U16_IS_SURROGATE_LEAD(sourceChar)) {
-getTrail:
- /*look ahead to find the trail surrogate*/
- if(source < sourceLimit) {
- /* test the following code unit */
- UChar trail=(UChar) *source;
- if(U16_IS_TRAIL(trail)) {
- source++;
- sourceChar=U16_GET_SUPPLEMENTARY(sourceChar, trail);
- cnv->fromUChar32=0x00;
- /* convert this supplementary code point */
- /* exit this condition tree */
- } else {
- /* this is an unmatched lead code unit (1st surrogate) */
- /* callback(illegal) */
- *err=U_ILLEGAL_CHAR_FOUND;
- cnv->fromUChar32=sourceChar;
- break;
- }
- } else {
- /* no more input */
- cnv->fromUChar32=sourceChar;
- break;
- }
- } else {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- *err=U_ILLEGAL_CHAR_FOUND;
- cnv->fromUChar32=sourceChar;
- break;
- }
- }
-
- tmpTargetBufferLength = 0;
- tmpState = getState(sourceChar);
-
- if (tmpState != DO_SEARCH && currentState != tmpState) {
- /* Get escape sequence if necessary */
- currentState = tmpState;
- for (i = 0; escSeqCompoundText[currentState][i] != 0; i++) {
- tmpTargetBuffer[tmpTargetBufferLength++] = escSeqCompoundText[currentState][i];
- }
- }
-
- if (tmpState == DO_SEARCH) {
- /* Test all available converters */
- for (i = 1; i < SEARCH_LENGTH; i++) {
- pValueLength = ucnv_MBCSFromUChar32(myConverterData->myConverterArray[i], sourceChar, &pValue, useFallback);
- if (pValueLength > 0) {
- tmpState = (COMPOUND_TEXT_CONVERTERS)i;
- if (currentState != tmpState) {
- currentState = tmpState;
- for (j = 0; escSeqCompoundText[currentState][j] != 0; j++) {
- tmpTargetBuffer[tmpTargetBufferLength++] = escSeqCompoundText[currentState][j];
- }
- }
- for (n = (pValueLength - 1); n >= 0; n--) {
- tmpTargetBuffer[tmpTargetBufferLength++] = (uint8_t)(pValue >> (n * 8));
- }
- break;
- }
- }
- } else if (tmpState == COMPOUND_TEXT_SINGLE_0) {
- tmpTargetBuffer[tmpTargetBufferLength++] = (uint8_t)sourceChar;
- } else {
- pValueLength = ucnv_MBCSFromUChar32(myConverterData->myConverterArray[currentState], sourceChar, &pValue, useFallback);
- if (pValueLength > 0) {
- for (n = (pValueLength - 1); n >= 0; n--) {
- tmpTargetBuffer[tmpTargetBufferLength++] = (uint8_t)(pValue >> (n * 8));
- }
- }
- }
-
- for (i = 0; i < tmpTargetBufferLength; i++) {
- if (target < targetLimit) {
- *target++ = tmpTargetBuffer[i];
- } else {
- *err = U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- }
-
- if (*err == U_BUFFER_OVERFLOW_ERROR) {
- for (; i < tmpTargetBufferLength; i++) {
- args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = tmpTargetBuffer[i];
- }
- }
- } else {
- *err = U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- }
-
- /*save the state and return */
- myConverterData->state = currentState;
- args->source = source;
- args->target = (char*)target;
-}
-
-
-static void U_CALLCONV
-UConverter_toUnicode_CompoundText_OFFSETS(UConverterToUnicodeArgs *args,
- UErrorCode* err){
- const char *mySource = (char *) args->source;
- UChar *myTarget = args->target;
- const char *mySourceLimit = args->sourceLimit;
- const char *tmpSourceLimit = mySourceLimit;
- uint32_t mySourceChar = 0x0000;
- COMPOUND_TEXT_CONVERTERS currentState, tmpState;
- int32_t sourceOffset = 0;
- UConverterDataCompoundText *myConverterData = (UConverterDataCompoundText *) args->converter->extraInfo;
- UConverterSharedData* savedSharedData = NULL;
-
- UConverterToUnicodeArgs subArgs;
- int32_t minArgsSize;
-
- /* set up the subconverter arguments */
- if(args->size<sizeof(UConverterToUnicodeArgs)) {
- minArgsSize = args->size;
- } else {
- minArgsSize = (int32_t)sizeof(UConverterToUnicodeArgs);
- }
-
- uprv_memcpy(&subArgs, args, minArgsSize);
- subArgs.size = (uint16_t)minArgsSize;
-
- currentState = tmpState = myConverterData->state;
-
- while(mySource < mySourceLimit){
- if(myTarget < args->targetLimit){
- if (args->converter->toULength > 0) {
- mySourceChar = args->converter->toUBytes[0];
- } else {
- mySourceChar = (uint8_t)*mySource;
- }
-
- if (mySourceChar == ESC_START) {
- tmpState = findStateFromEscSeq(mySource, mySourceLimit, args->converter->toUBytes, args->converter->toULength, err);
-
- if (*err == U_TRUNCATED_CHAR_FOUND) {
- for (; mySource < mySourceLimit;) {
- args->converter->toUBytes[args->converter->toULength++] = *mySource++;
- }
- *err = U_ZERO_ERROR;
- break;
- } else if (tmpState == INVALID) {
- if (args->converter->toULength == 0) {
- mySource++; /* skip over the 0x1b byte */
- }
- *err = U_ILLEGAL_CHAR_FOUND;
- break;
- }
-
- if (tmpState != currentState) {
- currentState = tmpState;
- }
-
- sourceOffset = static_cast<int32_t>(uprv_strlen((char*)escSeqCompoundText[currentState]) - args->converter->toULength);
-
- mySource += sourceOffset;
-
- args->converter->toULength = 0;
- }
-
- if (currentState == COMPOUND_TEXT_SINGLE_0) {
- while (mySource < mySourceLimit) {
- if (*mySource == ESC_START) {
- break;
- }
- if (myTarget < args->targetLimit) {
- *myTarget++ = 0x00ff&(*mySource++);
- } else {
- *err = U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- }
- } else if (mySource < mySourceLimit){
- sourceOffset = findNextEsc(mySource, mySourceLimit);
-
- tmpSourceLimit = mySource + sourceOffset;
-
- subArgs.source = mySource;
- subArgs.sourceLimit = tmpSourceLimit;
- subArgs.target = myTarget;
- savedSharedData = subArgs.converter->sharedData;
- subArgs.converter->sharedData = myConverterData->myConverterArray[currentState];
-
- ucnv_MBCSToUnicodeWithOffsets(&subArgs, err);
-
- subArgs.converter->sharedData = savedSharedData;
-
- mySource = subArgs.source;
- myTarget = subArgs.target;
-
- if (U_FAILURE(*err)) {
- if(*err == U_BUFFER_OVERFLOW_ERROR) {
- if(subArgs.converter->UCharErrorBufferLength > 0) {
- uprv_memcpy(args->converter->UCharErrorBuffer, subArgs.converter->UCharErrorBuffer,
- subArgs.converter->UCharErrorBufferLength);
- }
- args->converter->UCharErrorBufferLength=subArgs.converter->UCharErrorBufferLength;
- subArgs.converter->UCharErrorBufferLength = 0;
- }
- break;
- }
- }
- } else {
- *err = U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- }
- myConverterData->state = currentState;
- args->target = myTarget;
- args->source = mySource;
-}
-
-static void U_CALLCONV
-_CompoundText_GetUnicodeSet(const UConverter *cnv,
- const USetAdder *sa,
- UConverterUnicodeSet which,
- UErrorCode *pErrorCode) {
- UConverterDataCompoundText *myConverterData = (UConverterDataCompoundText *)cnv->extraInfo;
- int32_t i;
-
- for (i = 1; i < NUM_OF_CONVERTERS; i++) {
- ucnv_MBCSGetUnicodeSetForUnicode(myConverterData->myConverterArray[i], sa, which, pErrorCode);
- }
- sa->add(sa->set, 0x0000);
- sa->add(sa->set, 0x0009);
- sa->add(sa->set, 0x000A);
- sa->addRange(sa->set, 0x0020, 0x007F);
- sa->addRange(sa->set, 0x00A0, 0x00FF);
-}
-U_CDECL_END
-
-static const UConverterImpl _CompoundTextImpl = {
-
- UCNV_COMPOUND_TEXT,
-
- NULL,
- NULL,
-
- _CompoundTextOpen,
- _CompoundTextClose,
- _CompoundTextReset,
-
- UConverter_toUnicode_CompoundText_OFFSETS,
- UConverter_toUnicode_CompoundText_OFFSETS,
- UConverter_fromUnicode_CompoundText_OFFSETS,
- UConverter_fromUnicode_CompoundText_OFFSETS,
- NULL,
-
- NULL,
- _CompoundTextgetName,
- NULL,
- NULL,
- _CompoundText_GetUnicodeSet,
- NULL,
- NULL
-};
-
-static const UConverterStaticData _CompoundTextStaticData = {
- sizeof(UConverterStaticData),
- "COMPOUND_TEXT",
- 0,
- UCNV_IBM,
- UCNV_COMPOUND_TEXT,
- 1,
- 6,
- { 0xef, 0, 0, 0 },
- 1,
- FALSE,
- FALSE,
- 0,
- 0,
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
-};
-const UConverterSharedData _CompoundTextData =
- UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_CompoundTextStaticData, &_CompoundTextImpl);
-
-#endif /* #if !UCONFIG_NO_LEGACY_CONVERSION */
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+**********************************************************************
+* Copyright (C) 2010-2015, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* file name: ucnv_ct.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2010Dec09
+* created by: Michael Ow
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION
+
+#include "unicode/ucnv.h"
+#include "unicode/uset.h"
+#include "unicode/ucnv_err.h"
+#include "unicode/ucnv_cb.h"
+#include "unicode/utf16.h"
+#include "ucnv_imp.h"
+#include "ucnv_bld.h"
+#include "ucnv_cnv.h"
+#include "ucnvmbcs.h"
+#include "cstring.h"
+#include "cmemory.h"
+
+typedef enum {
+ INVALID = -2,
+ DO_SEARCH = -1,
+
+ COMPOUND_TEXT_SINGLE_0 = 0,
+ COMPOUND_TEXT_SINGLE_1 = 1,
+ COMPOUND_TEXT_SINGLE_2 = 2,
+ COMPOUND_TEXT_SINGLE_3 = 3,
+
+ COMPOUND_TEXT_DOUBLE_1 = 4,
+ COMPOUND_TEXT_DOUBLE_2 = 5,
+ COMPOUND_TEXT_DOUBLE_3 = 6,
+ COMPOUND_TEXT_DOUBLE_4 = 7,
+ COMPOUND_TEXT_DOUBLE_5 = 8,
+ COMPOUND_TEXT_DOUBLE_6 = 9,
+ COMPOUND_TEXT_DOUBLE_7 = 10,
+
+ COMPOUND_TEXT_TRIPLE_DOUBLE = 11,
+
+ IBM_915 = 12,
+ IBM_916 = 13,
+ IBM_914 = 14,
+ IBM_874 = 15,
+ IBM_912 = 16,
+ IBM_913 = 17,
+ ISO_8859_14 = 18,
+ IBM_923 = 19,
+ NUM_OF_CONVERTERS = 20
+} COMPOUND_TEXT_CONVERTERS;
+
+#define SEARCH_LENGTH 12
+
+static const uint8_t escSeqCompoundText[NUM_OF_CONVERTERS][5] = {
+ /* Single */
+ { 0x1B, 0x2D, 0x41, 0, 0 },
+ { 0x1B, 0x2D, 0x4D, 0, 0 },
+ { 0x1B, 0x2D, 0x46, 0, 0 },
+ { 0x1B, 0x2D, 0x47, 0, 0 },
+
+ /* Double */
+ { 0x1B, 0x24, 0x29, 0x41, 0 },
+ { 0x1B, 0x24, 0x29, 0x42, 0 },
+ { 0x1B, 0x24, 0x29, 0x43, 0 },
+ { 0x1B, 0x24, 0x29, 0x44, 0 },
+ { 0x1B, 0x24, 0x29, 0x47, 0 },
+ { 0x1B, 0x24, 0x29, 0x48, 0 },
+ { 0x1B, 0x24, 0x29, 0x49, 0 },
+
+ /* Triple/Double */
+ { 0x1B, 0x25, 0x47, 0, 0 },
+
+ /*IBM-915*/
+ { 0x1B, 0x2D, 0x4C, 0, 0 },
+ /*IBM-916*/
+ { 0x1B, 0x2D, 0x48, 0, 0 },
+ /*IBM-914*/
+ { 0x1B, 0x2D, 0x44, 0, 0 },
+ /*IBM-874*/
+ { 0x1B, 0x2D, 0x54, 0, 0 },
+ /*IBM-912*/
+ { 0x1B, 0x2D, 0x42, 0, 0 },
+ /* IBM-913 */
+ { 0x1B, 0x2D, 0x43, 0, 0 },
+ /* ISO-8859_14 */
+ { 0x1B, 0x2D, 0x5F, 0, 0 },
+ /* IBM-923 */
+ { 0x1B, 0x2D, 0x62, 0, 0 },
+};
+
+#define ESC_START 0x1B
+
+#define isASCIIRange(codepoint) \
+ ((codepoint == 0x0000) || (codepoint == 0x0009) || (codepoint == 0x000A) || \
+ (codepoint >= 0x0020 && codepoint <= 0x007f) || (codepoint >= 0x00A0 && codepoint <= 0x00FF))
+
+#define isIBM915(codepoint) \
+ ((codepoint >= 0x0401 && codepoint <= 0x045F) || (codepoint == 0x2116))
+
+#define isIBM916(codepoint) \
+ ((codepoint >= 0x05D0 && codepoint <= 0x05EA) || (codepoint == 0x2017) || (codepoint == 0x203E))
+
+#define isCompoundS3(codepoint) \
+ ((codepoint == 0x060C) || (codepoint == 0x061B) || (codepoint == 0x061F) || (codepoint >= 0x0621 && codepoint <= 0x063A) || \
+ (codepoint >= 0x0640 && codepoint <= 0x0652) || (codepoint >= 0x0660 && codepoint <= 0x066D) || (codepoint == 0x200B) || \
+ (codepoint >= 0x0FE70 && codepoint <= 0x0FE72) || (codepoint == 0x0FE74) || (codepoint >= 0x0FE76 && codepoint <= 0x0FEBE))
+
+#define isCompoundS2(codepoint) \
+ ((codepoint == 0x02BC) || (codepoint == 0x02BD) || (codepoint >= 0x0384 && codepoint <= 0x03CE) || (codepoint == 0x2015))
+
+#define isIBM914(codepoint) \
+ ((codepoint == 0x0100) || (codepoint == 0x0101) || (codepoint == 0x0112) || (codepoint == 0x0113) || (codepoint == 0x0116) || (codepoint == 0x0117) || \
+ (codepoint == 0x0122) || (codepoint == 0x0123) || (codepoint >= 0x0128 && codepoint <= 0x012B) || (codepoint == 0x012E) || (codepoint == 0x012F) || \
+ (codepoint >= 0x0136 && codepoint <= 0x0138) || (codepoint == 0x013B) || (codepoint == 0x013C) || (codepoint == 0x0145) || (codepoint == 0x0146) || \
+ (codepoint >= 0x014A && codepoint <= 0x014D) || (codepoint == 0x0156) || (codepoint == 0x0157) || (codepoint >= 0x0166 && codepoint <= 0x016B) || \
+ (codepoint == 0x0172) || (codepoint == 0x0173))
+
+#define isIBM874(codepoint) \
+ ((codepoint >= 0x0E01 && codepoint <= 0x0E3A) || (codepoint >= 0x0E3F && codepoint <= 0x0E5B))
+
+#define isIBM912(codepoint) \
+ ((codepoint >= 0x0102 && codepoint <= 0x0107) || (codepoint >= 0x010C && codepoint <= 0x0111) || (codepoint >= 0x0118 && codepoint <= 0x011B) || \
+ (codepoint == 0x0139) || (codepoint == 0x013A) || (codepoint == 0x013D) || (codepoint == 0x013E) || (codepoint >= 0x0141 && codepoint <= 0x0144) || \
+ (codepoint == 0x0147) || (codepoint == 0x0147) || (codepoint == 0x0150) || (codepoint == 0x0151) || (codepoint == 0x0154) || (codepoint == 0x0155) || \
+ (codepoint >= 0x0158 && codepoint <= 0x015B) || (codepoint == 0x015E) || (codepoint == 0x015F) || (codepoint >= 0x0160 && codepoint <= 0x0165) || \
+ (codepoint == 0x016E) || (codepoint == 0x016F) || (codepoint == 0x0170) || (codepoint == 0x0171) || (codepoint >= 0x0179 && codepoint <= 0x017E) || \
+ (codepoint == 0x02C7) || (codepoint == 0x02D8) || (codepoint == 0x02D9) || (codepoint == 0x02DB) || (codepoint == 0x02DD))
+
+#define isIBM913(codepoint) \
+ ((codepoint >= 0x0108 && codepoint <= 0x010B) || (codepoint == 0x011C) || \
+ (codepoint == 0x011D) || (codepoint == 0x0120) || (codepoint == 0x0121) || \
+ (codepoint >= 0x0124 && codepoint <= 0x0127) || (codepoint == 0x0134) || (codepoint == 0x0135) || \
+ (codepoint == 0x015C) || (codepoint == 0x015D) || (codepoint == 0x016C) || (codepoint == 0x016D))
+
+#define isCompoundS1(codepoint) \
+ ((codepoint == 0x011E) || (codepoint == 0x011F) || (codepoint == 0x0130) || \
+ (codepoint == 0x0131) || (codepoint >= 0x0218 && codepoint <= 0x021B))
+
+#define isISO8859_14(codepoint) \
+ ((codepoint >= 0x0174 && codepoint <= 0x0177) || (codepoint == 0x1E0A) || \
+ (codepoint == 0x1E0B) || (codepoint == 0x1E1E) || (codepoint == 0x1E1F) || \
+ (codepoint == 0x1E40) || (codepoint == 0x1E41) || (codepoint == 0x1E56) || \
+ (codepoint == 0x1E57) || (codepoint == 0x1E60) || (codepoint == 0x1E61) || \
+ (codepoint == 0x1E6A) || (codepoint == 0x1E6B) || (codepoint == 0x1EF2) || \
+ (codepoint == 0x1EF3) || (codepoint >= 0x1E80 && codepoint <= 0x1E85))
+
+#define isIBM923(codepoint) \
+ ((codepoint == 0x0152) || (codepoint == 0x0153) || (codepoint == 0x0178) || (codepoint == 0x20AC))
+
+
+typedef struct{
+ UConverterSharedData *myConverterArray[NUM_OF_CONVERTERS];
+ COMPOUND_TEXT_CONVERTERS state;
+} UConverterDataCompoundText;
+
+/*********** Compound Text Converter Protos ***********/
+U_CDECL_BEGIN
+static void U_CALLCONV
+_CompoundTextOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode);
+
+static void U_CALLCONV
+ _CompoundTextClose(UConverter *converter);
+
+static void U_CALLCONV
+_CompoundTextReset(UConverter *converter, UConverterResetChoice choice);
+
+static const char* U_CALLCONV
+_CompoundTextgetName(const UConverter* cnv);
+
+
+static int32_t findNextEsc(const char *source, const char *sourceLimit) {
+ int32_t length = static_cast<int32_t>(sourceLimit - source);
+ int32_t i;
+ for (i = 1; i < length; i++) {
+ if (*(source + i) == 0x1B) {
+ return i;
+ }
+ }
+
+ return length;
+}
+
+static COMPOUND_TEXT_CONVERTERS getState(int codepoint) {
+ COMPOUND_TEXT_CONVERTERS state = DO_SEARCH;
+
+ if (isASCIIRange(codepoint)) {
+ state = COMPOUND_TEXT_SINGLE_0;
+ } else if (isIBM912(codepoint)) {
+ state = IBM_912;
+ }else if (isIBM913(codepoint)) {
+ state = IBM_913;
+ } else if (isISO8859_14(codepoint)) {
+ state = ISO_8859_14;
+ } else if (isIBM923(codepoint)) {
+ state = IBM_923;
+ } else if (isIBM874(codepoint)) {
+ state = IBM_874;
+ } else if (isIBM914(codepoint)) {
+ state = IBM_914;
+ } else if (isCompoundS2(codepoint)) {
+ state = COMPOUND_TEXT_SINGLE_2;
+ } else if (isCompoundS3(codepoint)) {
+ state = COMPOUND_TEXT_SINGLE_3;
+ } else if (isIBM916(codepoint)) {
+ state = IBM_916;
+ } else if (isIBM915(codepoint)) {
+ state = IBM_915;
+ } else if (isCompoundS1(codepoint)) {
+ state = COMPOUND_TEXT_SINGLE_1;
+ }
+
+ return state;
+}
+
+static COMPOUND_TEXT_CONVERTERS findStateFromEscSeq(const char* source, const char* sourceLimit, const uint8_t* toUBytesBuffer, int32_t toUBytesBufferLength, UErrorCode *err) {
+ COMPOUND_TEXT_CONVERTERS state = INVALID;
+ UBool matchFound = FALSE;
+ int32_t i, n, offset = toUBytesBufferLength;
+
+ for (i = 0; i < NUM_OF_CONVERTERS; i++) {
+ matchFound = TRUE;
+ for (n = 0; escSeqCompoundText[i][n] != 0; n++) {
+ if (n < toUBytesBufferLength) {
+ if (toUBytesBuffer[n] != escSeqCompoundText[i][n]) {
+ matchFound = FALSE;
+ break;
+ }
+ } else if ((source + (n - offset)) >= sourceLimit) {
+ *err = U_TRUNCATED_CHAR_FOUND;
+ matchFound = FALSE;
+ break;
+ } else if (*(source + (n - offset)) != escSeqCompoundText[i][n]) {
+ matchFound = FALSE;
+ break;
+ }
+ }
+
+ if (matchFound) {
+ break;
+ }
+ }
+
+ if (matchFound) {
+ state = (COMPOUND_TEXT_CONVERTERS)i;
+ }
+
+ return state;
+}
+
+static void U_CALLCONV
+_CompoundTextOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){
+ cnv->extraInfo = uprv_malloc (sizeof (UConverterDataCompoundText));
+ if (cnv->extraInfo != NULL) {
+ UConverterDataCompoundText *myConverterData = (UConverterDataCompoundText *) cnv->extraInfo;
+
+ UConverterNamePieces stackPieces;
+ UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER;
+
+ myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_0] = NULL;
+ myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_1] = ucnv_loadSharedData("icu-internal-compound-s1", &stackPieces, &stackArgs, errorCode);
+ myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_2] = ucnv_loadSharedData("icu-internal-compound-s2", &stackPieces, &stackArgs, errorCode);
+ myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_3] = ucnv_loadSharedData("icu-internal-compound-s3", &stackPieces, &stackArgs, errorCode);
+ myConverterData->myConverterArray[COMPOUND_TEXT_DOUBLE_1] = ucnv_loadSharedData("icu-internal-compound-d1", &stackPieces, &stackArgs, errorCode);
+ myConverterData->myConverterArray[COMPOUND_TEXT_DOUBLE_2] = ucnv_loadSharedData("icu-internal-compound-d2", &stackPieces, &stackArgs, errorCode);
+ myConverterData->myConverterArray[COMPOUND_TEXT_DOUBLE_3] = ucnv_loadSharedData("icu-internal-compound-d3", &stackPieces, &stackArgs, errorCode);
+ myConverterData->myConverterArray[COMPOUND_TEXT_DOUBLE_4] = ucnv_loadSharedData("icu-internal-compound-d4", &stackPieces, &stackArgs, errorCode);
+ myConverterData->myConverterArray[COMPOUND_TEXT_DOUBLE_5] = ucnv_loadSharedData("icu-internal-compound-d5", &stackPieces, &stackArgs, errorCode);
+ myConverterData->myConverterArray[COMPOUND_TEXT_DOUBLE_6] = ucnv_loadSharedData("icu-internal-compound-d6", &stackPieces, &stackArgs, errorCode);
+ myConverterData->myConverterArray[COMPOUND_TEXT_DOUBLE_7] = ucnv_loadSharedData("icu-internal-compound-d7", &stackPieces, &stackArgs, errorCode);
+ myConverterData->myConverterArray[COMPOUND_TEXT_TRIPLE_DOUBLE] = ucnv_loadSharedData("icu-internal-compound-t", &stackPieces, &stackArgs, errorCode);
+
+ myConverterData->myConverterArray[IBM_915] = ucnv_loadSharedData("ibm-915_P100-1995", &stackPieces, &stackArgs, errorCode);
+ myConverterData->myConverterArray[IBM_916] = ucnv_loadSharedData("ibm-916_P100-1995", &stackPieces, &stackArgs, errorCode);
+ myConverterData->myConverterArray[IBM_914] = ucnv_loadSharedData("ibm-914_P100-1995", &stackPieces, &stackArgs, errorCode);
+ myConverterData->myConverterArray[IBM_874] = ucnv_loadSharedData("ibm-874_P100-1995", &stackPieces, &stackArgs, errorCode);
+ myConverterData->myConverterArray[IBM_912] = ucnv_loadSharedData("ibm-912_P100-1995", &stackPieces, &stackArgs, errorCode);
+ myConverterData->myConverterArray[IBM_913] = ucnv_loadSharedData("ibm-913_P100-2000", &stackPieces, &stackArgs, errorCode);
+ myConverterData->myConverterArray[ISO_8859_14] = ucnv_loadSharedData("iso-8859_14-1998", &stackPieces, &stackArgs, errorCode);
+ myConverterData->myConverterArray[IBM_923] = ucnv_loadSharedData("ibm-923_P100-1998", &stackPieces, &stackArgs, errorCode);
+
+ if (U_FAILURE(*errorCode) || pArgs->onlyTestIsLoadable) {
+ _CompoundTextClose(cnv);
+ return;
+ }
+
+ myConverterData->state = (COMPOUND_TEXT_CONVERTERS)0;
+ } else {
+ *errorCode = U_MEMORY_ALLOCATION_ERROR;
+ }
+}
+
+
+static void U_CALLCONV
+_CompoundTextClose(UConverter *converter) {
+ UConverterDataCompoundText* myConverterData = (UConverterDataCompoundText*)(converter->extraInfo);
+ int32_t i;
+
+ if (converter->extraInfo != NULL) {
+ /*close the array of converter pointers and free the memory*/
+ for (i = 0; i < NUM_OF_CONVERTERS; i++) {
+ if (myConverterData->myConverterArray[i] != NULL) {
+ ucnv_unloadSharedDataIfReady(myConverterData->myConverterArray[i]);
+ }
+ }
+
+ uprv_free(converter->extraInfo);
+ converter->extraInfo = NULL;
+ }
+}
+
+static void U_CALLCONV
+_CompoundTextReset(UConverter *converter, UConverterResetChoice choice) {
+ (void)converter;
+ (void)choice;
+}
+
+static const char* U_CALLCONV
+_CompoundTextgetName(const UConverter* cnv){
+ (void)cnv;
+ return "x11-compound-text";
+}
+
+static void U_CALLCONV
+UConverter_fromUnicode_CompoundText_OFFSETS(UConverterFromUnicodeArgs* args, UErrorCode* err){
+ UConverter *cnv = args->converter;
+ uint8_t *target = (uint8_t *) args->target;
+ const uint8_t *targetLimit = (const uint8_t *) args->targetLimit;
+ const UChar* source = args->source;
+ const UChar* sourceLimit = args->sourceLimit;
+ /* int32_t* offsets = args->offsets; */
+ UChar32 sourceChar;
+ UBool useFallback = cnv->useFallback;
+ uint8_t tmpTargetBuffer[7];
+ int32_t tmpTargetBufferLength = 0;
+ COMPOUND_TEXT_CONVERTERS currentState, tmpState;
+ uint32_t pValue;
+ int32_t pValueLength = 0;
+ int32_t i, n, j;
+
+ UConverterDataCompoundText *myConverterData = (UConverterDataCompoundText *) cnv->extraInfo;
+
+ currentState = myConverterData->state;
+
+ /* check if the last codepoint of previous buffer was a lead surrogate*/
+ if((sourceChar = cnv->fromUChar32)!=0 && target< targetLimit) {
+ goto getTrail;
+ }
+
+ while( source < sourceLimit){
+ if(target < targetLimit){
+
+ sourceChar = *(source++);
+ /*check if the char is a First surrogate*/
+ if(U16_IS_SURROGATE(sourceChar)) {
+ if(U16_IS_SURROGATE_LEAD(sourceChar)) {
+getTrail:
+ /*look ahead to find the trail surrogate*/
+ if(source < sourceLimit) {
+ /* test the following code unit */
+ UChar trail=(UChar) *source;
+ if(U16_IS_TRAIL(trail)) {
+ source++;
+ sourceChar=U16_GET_SUPPLEMENTARY(sourceChar, trail);
+ cnv->fromUChar32=0x00;
+ /* convert this supplementary code point */
+ /* exit this condition tree */
+ } else {
+ /* this is an unmatched lead code unit (1st surrogate) */
+ /* callback(illegal) */
+ *err=U_ILLEGAL_CHAR_FOUND;
+ cnv->fromUChar32=sourceChar;
+ break;
+ }
+ } else {
+ /* no more input */
+ cnv->fromUChar32=sourceChar;
+ break;
+ }
+ } else {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ *err=U_ILLEGAL_CHAR_FOUND;
+ cnv->fromUChar32=sourceChar;
+ break;
+ }
+ }
+
+ tmpTargetBufferLength = 0;
+ tmpState = getState(sourceChar);
+
+ if (tmpState != DO_SEARCH && currentState != tmpState) {
+ /* Get escape sequence if necessary */
+ currentState = tmpState;
+ for (i = 0; escSeqCompoundText[currentState][i] != 0; i++) {
+ tmpTargetBuffer[tmpTargetBufferLength++] = escSeqCompoundText[currentState][i];
+ }
+ }
+
+ if (tmpState == DO_SEARCH) {
+ /* Test all available converters */
+ for (i = 1; i < SEARCH_LENGTH; i++) {
+ pValueLength = ucnv_MBCSFromUChar32(myConverterData->myConverterArray[i], sourceChar, &pValue, useFallback);
+ if (pValueLength > 0) {
+ tmpState = (COMPOUND_TEXT_CONVERTERS)i;
+ if (currentState != tmpState) {
+ currentState = tmpState;
+ for (j = 0; escSeqCompoundText[currentState][j] != 0; j++) {
+ tmpTargetBuffer[tmpTargetBufferLength++] = escSeqCompoundText[currentState][j];
+ }
+ }
+ for (n = (pValueLength - 1); n >= 0; n--) {
+ tmpTargetBuffer[tmpTargetBufferLength++] = (uint8_t)(pValue >> (n * 8));
+ }
+ break;
+ }
+ }
+ } else if (tmpState == COMPOUND_TEXT_SINGLE_0) {
+ tmpTargetBuffer[tmpTargetBufferLength++] = (uint8_t)sourceChar;
+ } else {
+ pValueLength = ucnv_MBCSFromUChar32(myConverterData->myConverterArray[currentState], sourceChar, &pValue, useFallback);
+ if (pValueLength > 0) {
+ for (n = (pValueLength - 1); n >= 0; n--) {
+ tmpTargetBuffer[tmpTargetBufferLength++] = (uint8_t)(pValue >> (n * 8));
+ }
+ }
+ }
+
+ for (i = 0; i < tmpTargetBufferLength; i++) {
+ if (target < targetLimit) {
+ *target++ = tmpTargetBuffer[i];
+ } else {
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ }
+
+ if (*err == U_BUFFER_OVERFLOW_ERROR) {
+ for (; i < tmpTargetBufferLength; i++) {
+ args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = tmpTargetBuffer[i];
+ }
+ }
+ } else {
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ }
+
+ /*save the state and return */
+ myConverterData->state = currentState;
+ args->source = source;
+ args->target = (char*)target;
+}
+
+
+static void U_CALLCONV
+UConverter_toUnicode_CompoundText_OFFSETS(UConverterToUnicodeArgs *args,
+ UErrorCode* err){
+ const char *mySource = (char *) args->source;
+ UChar *myTarget = args->target;
+ const char *mySourceLimit = args->sourceLimit;
+ const char *tmpSourceLimit = mySourceLimit;
+ uint32_t mySourceChar = 0x0000;
+ COMPOUND_TEXT_CONVERTERS currentState, tmpState;
+ int32_t sourceOffset = 0;
+ UConverterDataCompoundText *myConverterData = (UConverterDataCompoundText *) args->converter->extraInfo;
+ UConverterSharedData* savedSharedData = NULL;
+
+ UConverterToUnicodeArgs subArgs;
+ int32_t minArgsSize;
+
+ /* set up the subconverter arguments */
+ if(args->size<sizeof(UConverterToUnicodeArgs)) {
+ minArgsSize = args->size;
+ } else {
+ minArgsSize = (int32_t)sizeof(UConverterToUnicodeArgs);
+ }
+
+ uprv_memcpy(&subArgs, args, minArgsSize);
+ subArgs.size = (uint16_t)minArgsSize;
+
+ currentState = tmpState = myConverterData->state;
+
+ while(mySource < mySourceLimit){
+ if(myTarget < args->targetLimit){
+ if (args->converter->toULength > 0) {
+ mySourceChar = args->converter->toUBytes[0];
+ } else {
+ mySourceChar = (uint8_t)*mySource;
+ }
+
+ if (mySourceChar == ESC_START) {
+ tmpState = findStateFromEscSeq(mySource, mySourceLimit, args->converter->toUBytes, args->converter->toULength, err);
+
+ if (*err == U_TRUNCATED_CHAR_FOUND) {
+ for (; mySource < mySourceLimit;) {
+ args->converter->toUBytes[args->converter->toULength++] = *mySource++;
+ }
+ *err = U_ZERO_ERROR;
+ break;
+ } else if (tmpState == INVALID) {
+ if (args->converter->toULength == 0) {
+ mySource++; /* skip over the 0x1b byte */
+ }
+ *err = U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+
+ if (tmpState != currentState) {
+ currentState = tmpState;
+ }
+
+ sourceOffset = static_cast<int32_t>(uprv_strlen((char*)escSeqCompoundText[currentState]) - args->converter->toULength);
+
+ mySource += sourceOffset;
+
+ args->converter->toULength = 0;
+ }
+
+ if (currentState == COMPOUND_TEXT_SINGLE_0) {
+ while (mySource < mySourceLimit) {
+ if (*mySource == ESC_START) {
+ break;
+ }
+ if (myTarget < args->targetLimit) {
+ *myTarget++ = 0x00ff&(*mySource++);
+ } else {
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ }
+ } else if (mySource < mySourceLimit){
+ sourceOffset = findNextEsc(mySource, mySourceLimit);
+
+ tmpSourceLimit = mySource + sourceOffset;
+
+ subArgs.source = mySource;
+ subArgs.sourceLimit = tmpSourceLimit;
+ subArgs.target = myTarget;
+ savedSharedData = subArgs.converter->sharedData;
+ subArgs.converter->sharedData = myConverterData->myConverterArray[currentState];
+
+ ucnv_MBCSToUnicodeWithOffsets(&subArgs, err);
+
+ subArgs.converter->sharedData = savedSharedData;
+
+ mySource = subArgs.source;
+ myTarget = subArgs.target;
+
+ if (U_FAILURE(*err)) {
+ if(*err == U_BUFFER_OVERFLOW_ERROR) {
+ if(subArgs.converter->UCharErrorBufferLength > 0) {
+ uprv_memcpy(args->converter->UCharErrorBuffer, subArgs.converter->UCharErrorBuffer,
+ subArgs.converter->UCharErrorBufferLength);
+ }
+ args->converter->UCharErrorBufferLength=subArgs.converter->UCharErrorBufferLength;
+ subArgs.converter->UCharErrorBufferLength = 0;
+ }
+ break;
+ }
+ }
+ } else {
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ }
+ myConverterData->state = currentState;
+ args->target = myTarget;
+ args->source = mySource;
+}
+
+static void U_CALLCONV
+_CompoundText_GetUnicodeSet(const UConverter *cnv,
+ const USetAdder *sa,
+ UConverterUnicodeSet which,
+ UErrorCode *pErrorCode) {
+ UConverterDataCompoundText *myConverterData = (UConverterDataCompoundText *)cnv->extraInfo;
+ int32_t i;
+
+ for (i = 1; i < NUM_OF_CONVERTERS; i++) {
+ ucnv_MBCSGetUnicodeSetForUnicode(myConverterData->myConverterArray[i], sa, which, pErrorCode);
+ }
+ sa->add(sa->set, 0x0000);
+ sa->add(sa->set, 0x0009);
+ sa->add(sa->set, 0x000A);
+ sa->addRange(sa->set, 0x0020, 0x007F);
+ sa->addRange(sa->set, 0x00A0, 0x00FF);
+}
+U_CDECL_END
+
+static const UConverterImpl _CompoundTextImpl = {
+
+ UCNV_COMPOUND_TEXT,
+
+ NULL,
+ NULL,
+
+ _CompoundTextOpen,
+ _CompoundTextClose,
+ _CompoundTextReset,
+
+ UConverter_toUnicode_CompoundText_OFFSETS,
+ UConverter_toUnicode_CompoundText_OFFSETS,
+ UConverter_fromUnicode_CompoundText_OFFSETS,
+ UConverter_fromUnicode_CompoundText_OFFSETS,
+ NULL,
+
+ NULL,
+ _CompoundTextgetName,
+ NULL,
+ NULL,
+ _CompoundText_GetUnicodeSet,
+ NULL,
+ NULL
+};
+
+static const UConverterStaticData _CompoundTextStaticData = {
+ sizeof(UConverterStaticData),
+ "COMPOUND_TEXT",
+ 0,
+ UCNV_IBM,
+ UCNV_COMPOUND_TEXT,
+ 1,
+ 6,
+ { 0xef, 0, 0, 0 },
+ 1,
+ FALSE,
+ FALSE,
+ 0,
+ 0,
+ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
+};
+const UConverterSharedData _CompoundTextData =
+ UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_CompoundTextStaticData, &_CompoundTextImpl);
+
+#endif /* #if !UCONFIG_NO_LEGACY_CONVERSION */
diff --git a/contrib/libs/icu/common/ucnv_err.cpp b/contrib/libs/icu/common/ucnv_err.cpp
index b37da9b41b..6b738face5 100644
--- a/contrib/libs/icu/common/ucnv_err.cpp
+++ b/contrib/libs/icu/common/ucnv_err.cpp
@@ -1,486 +1,486 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
- *****************************************************************************
- *
- * Copyright (C) 1998-2016, International Business Machines
- * Corporation and others. All Rights Reserved.
- *
- *****************************************************************************
- *
- * ucnv_err.c
- * Implements error behaviour functions called by T_UConverter_{from,to}Unicode
- *
- *
-* Change history:
-*
-* 06/29/2000 helena Major rewrite of the callback APIs.
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_CONVERSION
-
-#include "unicode/ucnv_err.h"
-#include "unicode/ucnv_cb.h"
-#include "ucnv_cnv.h"
-#include "cmemory.h"
-#include "unicode/ucnv.h"
-#include "ustrfmt.h"
-
-#define VALUE_STRING_LENGTH 48
-/*Magic # 32 = 4(number of char in value string) * 8(max number of bytes per char for any converter) */
-#define UNICODE_PERCENT_SIGN_CODEPOINT 0x0025
-#define UNICODE_U_CODEPOINT 0x0055
-#define UNICODE_X_CODEPOINT 0x0058
-#define UNICODE_RS_CODEPOINT 0x005C
-#define UNICODE_U_LOW_CODEPOINT 0x0075
-#define UNICODE_X_LOW_CODEPOINT 0x0078
-#define UNICODE_AMP_CODEPOINT 0x0026
-#define UNICODE_HASH_CODEPOINT 0x0023
-#define UNICODE_SEMICOLON_CODEPOINT 0x003B
-#define UNICODE_PLUS_CODEPOINT 0x002B
-#define UNICODE_LEFT_CURLY_CODEPOINT 0x007B
-#define UNICODE_RIGHT_CURLY_CODEPOINT 0x007D
-#define UNICODE_SPACE_CODEPOINT 0x0020
-#define UCNV_PRV_ESCAPE_ICU 0
-#define UCNV_PRV_ESCAPE_C 'C'
-#define UCNV_PRV_ESCAPE_XML_DEC 'D'
-#define UCNV_PRV_ESCAPE_XML_HEX 'X'
-#define UCNV_PRV_ESCAPE_JAVA 'J'
-#define UCNV_PRV_ESCAPE_UNICODE 'U'
-#define UCNV_PRV_ESCAPE_CSS2 'S'
-#define UCNV_PRV_STOP_ON_ILLEGAL 'i'
-
-/*
- * IS_DEFAULT_IGNORABLE_CODE_POINT
- * This is to check if a code point has the default ignorable unicode property.
- * As such, this list needs to be updated if the ignorable code point list ever
- * changes.
- * To avoid dependency on other code, this list is hard coded here.
- * When an ignorable code point is found and is unmappable, the default callbacks
- * will ignore them.
- * For a list of the default ignorable code points, use this link:
- * https://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3ADI%3A%5D&abb=on&g=&i=
- *
- * This list should be sync with the one in CharsetCallback.java
- */
-#define IS_DEFAULT_IGNORABLE_CODE_POINT(c) ( \
- (c == 0x00AD) || \
- (c == 0x034F) || \
- (c == 0x061C) || \
- (c == 0x115F) || \
- (c == 0x1160) || \
- (0x17B4 <= c && c <= 0x17B5) || \
- (0x180B <= c && c <= 0x180E) || \
- (0x200B <= c && c <= 0x200F) || \
- (0x202A <= c && c <= 0x202E) || \
- (0x2060 <= c && c <= 0x206F) || \
- (c == 0x3164) || \
- (0xFE00 <= c && c <= 0xFE0F) || \
- (c == 0xFEFF) || \
- (c == 0xFFA0) || \
- (0xFFF0 <= c && c <= 0xFFF8) || \
- (0x1BCA0 <= c && c <= 0x1BCA3) || \
- (0x1D173 <= c && c <= 0x1D17A) || \
- (0xE0000 <= c && c <= 0xE0FFF))
-
-
-/*Function Pointer STOPS at the ILLEGAL_SEQUENCE */
-U_CAPI void U_EXPORT2
-UCNV_FROM_U_CALLBACK_STOP (
- const void *context,
- UConverterFromUnicodeArgs *fromUArgs,
- const UChar* codeUnits,
- int32_t length,
- UChar32 codePoint,
- UConverterCallbackReason reason,
- UErrorCode * err)
-{
- (void)context;
- (void)fromUArgs;
- (void)codeUnits;
- (void)length;
- if (reason == UCNV_UNASSIGNED && IS_DEFAULT_IGNORABLE_CODE_POINT(codePoint))
- {
- /*
- * Skip if the codepoint has unicode property of default ignorable.
- */
- *err = U_ZERO_ERROR;
- }
- /* the caller must have set the error code accordingly */
- return;
-}
-
-
-/*Function Pointer STOPS at the ILLEGAL_SEQUENCE */
-U_CAPI void U_EXPORT2
-UCNV_TO_U_CALLBACK_STOP (
- const void *context,
- UConverterToUnicodeArgs *toUArgs,
- const char* codePoints,
- int32_t length,
- UConverterCallbackReason reason,
- UErrorCode * err)
-{
- /* the caller must have set the error code accordingly */
- (void)context; (void)toUArgs; (void)codePoints; (void)length; (void)reason; (void)err;
- return;
-}
-
-U_CAPI void U_EXPORT2
-UCNV_FROM_U_CALLBACK_SKIP (
- const void *context,
- UConverterFromUnicodeArgs *fromUArgs,
- const UChar* codeUnits,
- int32_t length,
- UChar32 codePoint,
- UConverterCallbackReason reason,
- UErrorCode * err)
-{
- (void)fromUArgs;
- (void)codeUnits;
- (void)length;
- if (reason <= UCNV_IRREGULAR)
- {
- if (reason == UCNV_UNASSIGNED && IS_DEFAULT_IGNORABLE_CODE_POINT(codePoint))
- {
- /*
- * Skip if the codepoint has unicode property of default ignorable.
- */
- *err = U_ZERO_ERROR;
- }
- else if (context == NULL || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
- {
- *err = U_ZERO_ERROR;
- }
- /* else the caller must have set the error code accordingly. */
- }
- /* else ignore the reset, close and clone calls. */
-}
-
-U_CAPI void U_EXPORT2
-UCNV_FROM_U_CALLBACK_SUBSTITUTE (
- const void *context,
- UConverterFromUnicodeArgs *fromArgs,
- const UChar* codeUnits,
- int32_t length,
- UChar32 codePoint,
- UConverterCallbackReason reason,
- UErrorCode * err)
-{
- (void)codeUnits;
- (void)length;
- if (reason <= UCNV_IRREGULAR)
- {
- if (reason == UCNV_UNASSIGNED && IS_DEFAULT_IGNORABLE_CODE_POINT(codePoint))
- {
- /*
- * Skip if the codepoint has unicode property of default ignorable.
- */
- *err = U_ZERO_ERROR;
- }
- else if (context == NULL || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
- {
- *err = U_ZERO_ERROR;
- ucnv_cbFromUWriteSub(fromArgs, 0, err);
- }
- /* else the caller must have set the error code accordingly. */
- }
- /* else ignore the reset, close and clone calls. */
-}
-
-/*uses uprv_itou to get a unicode escape sequence of the offensive sequence,
- *uses a clean copy (resetted) of the converter, to convert that unicode
- *escape sequence to the target codepage (if conversion failure happens then
- *we revert to substituting with subchar)
- */
-U_CAPI void U_EXPORT2
-UCNV_FROM_U_CALLBACK_ESCAPE (
- const void *context,
- UConverterFromUnicodeArgs *fromArgs,
- const UChar *codeUnits,
- int32_t length,
- UChar32 codePoint,
- UConverterCallbackReason reason,
- UErrorCode * err)
-{
-
- UChar valueString[VALUE_STRING_LENGTH];
- int32_t valueStringLength = 0;
- int32_t i = 0;
-
- const UChar *myValueSource = NULL;
- UErrorCode err2 = U_ZERO_ERROR;
- UConverterFromUCallback original = NULL;
- const void *originalContext;
-
- UConverterFromUCallback ignoredCallback = NULL;
- const void *ignoredContext;
-
- if (reason > UCNV_IRREGULAR)
- {
- return;
- }
- else if (reason == UCNV_UNASSIGNED && IS_DEFAULT_IGNORABLE_CODE_POINT(codePoint))
- {
- /*
- * Skip if the codepoint has unicode property of default ignorable.
- */
- *err = U_ZERO_ERROR;
- return;
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+ *****************************************************************************
+ *
+ * Copyright (C) 1998-2016, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ *
+ *****************************************************************************
+ *
+ * ucnv_err.c
+ * Implements error behaviour functions called by T_UConverter_{from,to}Unicode
+ *
+ *
+* Change history:
+*
+* 06/29/2000 helena Major rewrite of the callback APIs.
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "unicode/ucnv_err.h"
+#include "unicode/ucnv_cb.h"
+#include "ucnv_cnv.h"
+#include "cmemory.h"
+#include "unicode/ucnv.h"
+#include "ustrfmt.h"
+
+#define VALUE_STRING_LENGTH 48
+/*Magic # 32 = 4(number of char in value string) * 8(max number of bytes per char for any converter) */
+#define UNICODE_PERCENT_SIGN_CODEPOINT 0x0025
+#define UNICODE_U_CODEPOINT 0x0055
+#define UNICODE_X_CODEPOINT 0x0058
+#define UNICODE_RS_CODEPOINT 0x005C
+#define UNICODE_U_LOW_CODEPOINT 0x0075
+#define UNICODE_X_LOW_CODEPOINT 0x0078
+#define UNICODE_AMP_CODEPOINT 0x0026
+#define UNICODE_HASH_CODEPOINT 0x0023
+#define UNICODE_SEMICOLON_CODEPOINT 0x003B
+#define UNICODE_PLUS_CODEPOINT 0x002B
+#define UNICODE_LEFT_CURLY_CODEPOINT 0x007B
+#define UNICODE_RIGHT_CURLY_CODEPOINT 0x007D
+#define UNICODE_SPACE_CODEPOINT 0x0020
+#define UCNV_PRV_ESCAPE_ICU 0
+#define UCNV_PRV_ESCAPE_C 'C'
+#define UCNV_PRV_ESCAPE_XML_DEC 'D'
+#define UCNV_PRV_ESCAPE_XML_HEX 'X'
+#define UCNV_PRV_ESCAPE_JAVA 'J'
+#define UCNV_PRV_ESCAPE_UNICODE 'U'
+#define UCNV_PRV_ESCAPE_CSS2 'S'
+#define UCNV_PRV_STOP_ON_ILLEGAL 'i'
+
+/*
+ * IS_DEFAULT_IGNORABLE_CODE_POINT
+ * This is to check if a code point has the default ignorable unicode property.
+ * As such, this list needs to be updated if the ignorable code point list ever
+ * changes.
+ * To avoid dependency on other code, this list is hard coded here.
+ * When an ignorable code point is found and is unmappable, the default callbacks
+ * will ignore them.
+ * For a list of the default ignorable code points, use this link:
+ * https://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3ADI%3A%5D&abb=on&g=&i=
+ *
+ * This list should be sync with the one in CharsetCallback.java
+ */
+#define IS_DEFAULT_IGNORABLE_CODE_POINT(c) ( \
+ (c == 0x00AD) || \
+ (c == 0x034F) || \
+ (c == 0x061C) || \
+ (c == 0x115F) || \
+ (c == 0x1160) || \
+ (0x17B4 <= c && c <= 0x17B5) || \
+ (0x180B <= c && c <= 0x180E) || \
+ (0x200B <= c && c <= 0x200F) || \
+ (0x202A <= c && c <= 0x202E) || \
+ (0x2060 <= c && c <= 0x206F) || \
+ (c == 0x3164) || \
+ (0xFE00 <= c && c <= 0xFE0F) || \
+ (c == 0xFEFF) || \
+ (c == 0xFFA0) || \
+ (0xFFF0 <= c && c <= 0xFFF8) || \
+ (0x1BCA0 <= c && c <= 0x1BCA3) || \
+ (0x1D173 <= c && c <= 0x1D17A) || \
+ (0xE0000 <= c && c <= 0xE0FFF))
+
+
+/*Function Pointer STOPS at the ILLEGAL_SEQUENCE */
+U_CAPI void U_EXPORT2
+UCNV_FROM_U_CALLBACK_STOP (
+ const void *context,
+ UConverterFromUnicodeArgs *fromUArgs,
+ const UChar* codeUnits,
+ int32_t length,
+ UChar32 codePoint,
+ UConverterCallbackReason reason,
+ UErrorCode * err)
+{
+ (void)context;
+ (void)fromUArgs;
+ (void)codeUnits;
+ (void)length;
+ if (reason == UCNV_UNASSIGNED && IS_DEFAULT_IGNORABLE_CODE_POINT(codePoint))
+ {
+ /*
+ * Skip if the codepoint has unicode property of default ignorable.
+ */
+ *err = U_ZERO_ERROR;
+ }
+ /* the caller must have set the error code accordingly */
+ return;
+}
+
+
+/*Function Pointer STOPS at the ILLEGAL_SEQUENCE */
+U_CAPI void U_EXPORT2
+UCNV_TO_U_CALLBACK_STOP (
+ const void *context,
+ UConverterToUnicodeArgs *toUArgs,
+ const char* codePoints,
+ int32_t length,
+ UConverterCallbackReason reason,
+ UErrorCode * err)
+{
+ /* the caller must have set the error code accordingly */
+ (void)context; (void)toUArgs; (void)codePoints; (void)length; (void)reason; (void)err;
+ return;
+}
+
+U_CAPI void U_EXPORT2
+UCNV_FROM_U_CALLBACK_SKIP (
+ const void *context,
+ UConverterFromUnicodeArgs *fromUArgs,
+ const UChar* codeUnits,
+ int32_t length,
+ UChar32 codePoint,
+ UConverterCallbackReason reason,
+ UErrorCode * err)
+{
+ (void)fromUArgs;
+ (void)codeUnits;
+ (void)length;
+ if (reason <= UCNV_IRREGULAR)
+ {
+ if (reason == UCNV_UNASSIGNED && IS_DEFAULT_IGNORABLE_CODE_POINT(codePoint))
+ {
+ /*
+ * Skip if the codepoint has unicode property of default ignorable.
+ */
+ *err = U_ZERO_ERROR;
+ }
+ else if (context == NULL || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
+ {
+ *err = U_ZERO_ERROR;
+ }
+ /* else the caller must have set the error code accordingly. */
+ }
+ /* else ignore the reset, close and clone calls. */
+}
+
+U_CAPI void U_EXPORT2
+UCNV_FROM_U_CALLBACK_SUBSTITUTE (
+ const void *context,
+ UConverterFromUnicodeArgs *fromArgs,
+ const UChar* codeUnits,
+ int32_t length,
+ UChar32 codePoint,
+ UConverterCallbackReason reason,
+ UErrorCode * err)
+{
+ (void)codeUnits;
+ (void)length;
+ if (reason <= UCNV_IRREGULAR)
+ {
+ if (reason == UCNV_UNASSIGNED && IS_DEFAULT_IGNORABLE_CODE_POINT(codePoint))
+ {
+ /*
+ * Skip if the codepoint has unicode property of default ignorable.
+ */
+ *err = U_ZERO_ERROR;
+ }
+ else if (context == NULL || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
+ {
+ *err = U_ZERO_ERROR;
+ ucnv_cbFromUWriteSub(fromArgs, 0, err);
+ }
+ /* else the caller must have set the error code accordingly. */
+ }
+ /* else ignore the reset, close and clone calls. */
+}
+
+/*uses uprv_itou to get a unicode escape sequence of the offensive sequence,
+ *uses a clean copy (resetted) of the converter, to convert that unicode
+ *escape sequence to the target codepage (if conversion failure happens then
+ *we revert to substituting with subchar)
+ */
+U_CAPI void U_EXPORT2
+UCNV_FROM_U_CALLBACK_ESCAPE (
+ const void *context,
+ UConverterFromUnicodeArgs *fromArgs,
+ const UChar *codeUnits,
+ int32_t length,
+ UChar32 codePoint,
+ UConverterCallbackReason reason,
+ UErrorCode * err)
+{
+
+ UChar valueString[VALUE_STRING_LENGTH];
+ int32_t valueStringLength = 0;
+ int32_t i = 0;
+
+ const UChar *myValueSource = NULL;
+ UErrorCode err2 = U_ZERO_ERROR;
+ UConverterFromUCallback original = NULL;
+ const void *originalContext;
+
+ UConverterFromUCallback ignoredCallback = NULL;
+ const void *ignoredContext;
+
+ if (reason > UCNV_IRREGULAR)
+ {
+ return;
+ }
+ else if (reason == UCNV_UNASSIGNED && IS_DEFAULT_IGNORABLE_CODE_POINT(codePoint))
+ {
+ /*
+ * Skip if the codepoint has unicode property of default ignorable.
+ */
+ *err = U_ZERO_ERROR;
+ return;
+ }
+
+ ucnv_setFromUCallBack (fromArgs->converter,
+ (UConverterFromUCallback) UCNV_FROM_U_CALLBACK_SUBSTITUTE,
+ NULL,
+ &original,
+ &originalContext,
+ &err2);
+
+ if (U_FAILURE (err2))
+ {
+ *err = err2;
+ return;
}
-
- ucnv_setFromUCallBack (fromArgs->converter,
- (UConverterFromUCallback) UCNV_FROM_U_CALLBACK_SUBSTITUTE,
- NULL,
- &original,
- &originalContext,
- &err2);
-
- if (U_FAILURE (err2))
+ if(context==NULL)
{
- *err = err2;
- return;
+ while (i < length)
+ {
+ valueString[valueStringLength++] = (UChar) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
+ valueString[valueStringLength++] = (UChar) UNICODE_U_CODEPOINT; /* adding U */
+ valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[i++], 16, 4);
+ }
+ }
+ else
+ {
+ switch(*((char*)context))
+ {
+ case UCNV_PRV_ESCAPE_JAVA:
+ while (i < length)
+ {
+ valueString[valueStringLength++] = (UChar) UNICODE_RS_CODEPOINT; /* adding \ */
+ valueString[valueStringLength++] = (UChar) UNICODE_U_LOW_CODEPOINT; /* adding u */
+ valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[i++], 16, 4);
+ }
+ break;
+
+ case UCNV_PRV_ESCAPE_C:
+ valueString[valueStringLength++] = (UChar) UNICODE_RS_CODEPOINT; /* adding \ */
+
+ if(length==2){
+ valueString[valueStringLength++] = (UChar) UNICODE_U_CODEPOINT; /* adding U */
+ valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 16, 8);
+
+ }
+ else{
+ valueString[valueStringLength++] = (UChar) UNICODE_U_LOW_CODEPOINT; /* adding u */
+ valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[0], 16, 4);
+ }
+ break;
+
+ case UCNV_PRV_ESCAPE_XML_DEC:
+
+ valueString[valueStringLength++] = (UChar) UNICODE_AMP_CODEPOINT; /* adding & */
+ valueString[valueStringLength++] = (UChar) UNICODE_HASH_CODEPOINT; /* adding # */
+ if(length==2){
+ valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 10, 0);
+ }
+ else{
+ valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[0], 10, 0);
+ }
+ valueString[valueStringLength++] = (UChar) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
+ break;
+
+ case UCNV_PRV_ESCAPE_XML_HEX:
+
+ valueString[valueStringLength++] = (UChar) UNICODE_AMP_CODEPOINT; /* adding & */
+ valueString[valueStringLength++] = (UChar) UNICODE_HASH_CODEPOINT; /* adding # */
+ valueString[valueStringLength++] = (UChar) UNICODE_X_LOW_CODEPOINT; /* adding x */
+ if(length==2){
+ valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 16, 0);
+ }
+ else{
+ valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[0], 16, 0);
+ }
+ valueString[valueStringLength++] = (UChar) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
+ break;
+
+ case UCNV_PRV_ESCAPE_UNICODE:
+ valueString[valueStringLength++] = (UChar) UNICODE_LEFT_CURLY_CODEPOINT; /* adding { */
+ valueString[valueStringLength++] = (UChar) UNICODE_U_CODEPOINT; /* adding U */
+ valueString[valueStringLength++] = (UChar) UNICODE_PLUS_CODEPOINT; /* adding + */
+ if (length == 2) {
+ valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 16, 4);
+ } else {
+ valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[0], 16, 4);
+ }
+ valueString[valueStringLength++] = (UChar) UNICODE_RIGHT_CURLY_CODEPOINT; /* adding } */
+ break;
+
+ case UCNV_PRV_ESCAPE_CSS2:
+ valueString[valueStringLength++] = (UChar) UNICODE_RS_CODEPOINT; /* adding \ */
+ valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 16, 0);
+ /* Always add space character, becase the next character might be whitespace,
+ which would erroneously be considered the termination of the escape sequence. */
+ valueString[valueStringLength++] = (UChar) UNICODE_SPACE_CODEPOINT;
+ break;
+
+ default:
+ while (i < length)
+ {
+ valueString[valueStringLength++] = (UChar) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
+ valueString[valueStringLength++] = (UChar) UNICODE_U_CODEPOINT; /* adding U */
+ valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[i++], 16, 4);
+ }
+ }
}
- if(context==NULL)
- {
- while (i < length)
- {
- valueString[valueStringLength++] = (UChar) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
- valueString[valueStringLength++] = (UChar) UNICODE_U_CODEPOINT; /* adding U */
- valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[i++], 16, 4);
- }
- }
- else
- {
- switch(*((char*)context))
- {
- case UCNV_PRV_ESCAPE_JAVA:
- while (i < length)
- {
- valueString[valueStringLength++] = (UChar) UNICODE_RS_CODEPOINT; /* adding \ */
- valueString[valueStringLength++] = (UChar) UNICODE_U_LOW_CODEPOINT; /* adding u */
- valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[i++], 16, 4);
- }
- break;
-
- case UCNV_PRV_ESCAPE_C:
- valueString[valueStringLength++] = (UChar) UNICODE_RS_CODEPOINT; /* adding \ */
-
- if(length==2){
- valueString[valueStringLength++] = (UChar) UNICODE_U_CODEPOINT; /* adding U */
- valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 16, 8);
-
- }
- else{
- valueString[valueStringLength++] = (UChar) UNICODE_U_LOW_CODEPOINT; /* adding u */
- valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[0], 16, 4);
- }
- break;
-
- case UCNV_PRV_ESCAPE_XML_DEC:
-
- valueString[valueStringLength++] = (UChar) UNICODE_AMP_CODEPOINT; /* adding & */
- valueString[valueStringLength++] = (UChar) UNICODE_HASH_CODEPOINT; /* adding # */
- if(length==2){
- valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 10, 0);
- }
- else{
- valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[0], 10, 0);
- }
- valueString[valueStringLength++] = (UChar) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
- break;
-
- case UCNV_PRV_ESCAPE_XML_HEX:
-
- valueString[valueStringLength++] = (UChar) UNICODE_AMP_CODEPOINT; /* adding & */
- valueString[valueStringLength++] = (UChar) UNICODE_HASH_CODEPOINT; /* adding # */
- valueString[valueStringLength++] = (UChar) UNICODE_X_LOW_CODEPOINT; /* adding x */
- if(length==2){
- valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 16, 0);
- }
- else{
- valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[0], 16, 0);
- }
- valueString[valueStringLength++] = (UChar) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
- break;
-
- case UCNV_PRV_ESCAPE_UNICODE:
- valueString[valueStringLength++] = (UChar) UNICODE_LEFT_CURLY_CODEPOINT; /* adding { */
- valueString[valueStringLength++] = (UChar) UNICODE_U_CODEPOINT; /* adding U */
- valueString[valueStringLength++] = (UChar) UNICODE_PLUS_CODEPOINT; /* adding + */
- if (length == 2) {
- valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 16, 4);
- } else {
- valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[0], 16, 4);
- }
- valueString[valueStringLength++] = (UChar) UNICODE_RIGHT_CURLY_CODEPOINT; /* adding } */
- break;
-
- case UCNV_PRV_ESCAPE_CSS2:
- valueString[valueStringLength++] = (UChar) UNICODE_RS_CODEPOINT; /* adding \ */
- valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 16, 0);
- /* Always add space character, becase the next character might be whitespace,
- which would erroneously be considered the termination of the escape sequence. */
- valueString[valueStringLength++] = (UChar) UNICODE_SPACE_CODEPOINT;
- break;
-
- default:
- while (i < length)
- {
- valueString[valueStringLength++] = (UChar) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
- valueString[valueStringLength++] = (UChar) UNICODE_U_CODEPOINT; /* adding U */
- valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[i++], 16, 4);
- }
- }
- }
- myValueSource = valueString;
-
- /* reset the error */
- *err = U_ZERO_ERROR;
-
- ucnv_cbFromUWriteUChars(fromArgs, &myValueSource, myValueSource+valueStringLength, 0, err);
-
- ucnv_setFromUCallBack (fromArgs->converter,
- original,
- originalContext,
- &ignoredCallback,
- &ignoredContext,
- &err2);
- if (U_FAILURE (err2))
- {
- *err = err2;
- return;
- }
-
- return;
-}
-
-
-
-U_CAPI void U_EXPORT2
-UCNV_TO_U_CALLBACK_SKIP (
- const void *context,
- UConverterToUnicodeArgs *toArgs,
- const char* codeUnits,
- int32_t length,
- UConverterCallbackReason reason,
- UErrorCode * err)
-{
- (void)toArgs;
- (void)codeUnits;
- (void)length;
- if (reason <= UCNV_IRREGULAR)
- {
- if (context == NULL || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
- {
- *err = U_ZERO_ERROR;
- }
- /* else the caller must have set the error code accordingly. */
- }
- /* else ignore the reset, close and clone calls. */
-}
-
-U_CAPI void U_EXPORT2
-UCNV_TO_U_CALLBACK_SUBSTITUTE (
- const void *context,
- UConverterToUnicodeArgs *toArgs,
- const char* codeUnits,
- int32_t length,
- UConverterCallbackReason reason,
- UErrorCode * err)
-{
- (void)codeUnits;
- (void)length;
- if (reason <= UCNV_IRREGULAR)
- {
- if (context == NULL || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
- {
- *err = U_ZERO_ERROR;
- ucnv_cbToUWriteSub(toArgs,0,err);
- }
- /* else the caller must have set the error code accordingly. */
- }
- /* else ignore the reset, close and clone calls. */
-}
-
-/*uses uprv_itou to get a unicode escape sequence of the offensive sequence,
- *and uses that as the substitution sequence
- */
-U_CAPI void U_EXPORT2
-UCNV_TO_U_CALLBACK_ESCAPE (
- const void *context,
- UConverterToUnicodeArgs *toArgs,
- const char* codeUnits,
- int32_t length,
- UConverterCallbackReason reason,
- UErrorCode * err)
-{
- UChar uniValueString[VALUE_STRING_LENGTH];
- int32_t valueStringLength = 0;
- int32_t i = 0;
-
- if (reason > UCNV_IRREGULAR)
- {
- return;
- }
-
- if(context==NULL)
- {
- while (i < length)
- {
- uniValueString[valueStringLength++] = (UChar) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
- uniValueString[valueStringLength++] = (UChar) UNICODE_X_CODEPOINT; /* adding X */
- valueStringLength += uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint8_t) codeUnits[i++], 16, 2);
- }
- }
- else
- {
- switch(*((char*)context))
- {
- case UCNV_PRV_ESCAPE_XML_DEC:
- while (i < length)
- {
- uniValueString[valueStringLength++] = (UChar) UNICODE_AMP_CODEPOINT; /* adding & */
- uniValueString[valueStringLength++] = (UChar) UNICODE_HASH_CODEPOINT; /* adding # */
- valueStringLength += uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint8_t)codeUnits[i++], 10, 0);
- uniValueString[valueStringLength++] = (UChar) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
- }
- break;
-
- case UCNV_PRV_ESCAPE_XML_HEX:
- while (i < length)
- {
- uniValueString[valueStringLength++] = (UChar) UNICODE_AMP_CODEPOINT; /* adding & */
- uniValueString[valueStringLength++] = (UChar) UNICODE_HASH_CODEPOINT; /* adding # */
- uniValueString[valueStringLength++] = (UChar) UNICODE_X_LOW_CODEPOINT; /* adding x */
- valueStringLength += uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint8_t)codeUnits[i++], 16, 0);
- uniValueString[valueStringLength++] = (UChar) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
- }
- break;
- case UCNV_PRV_ESCAPE_C:
- while (i < length)
- {
- uniValueString[valueStringLength++] = (UChar) UNICODE_RS_CODEPOINT; /* adding \ */
- uniValueString[valueStringLength++] = (UChar) UNICODE_X_LOW_CODEPOINT; /* adding x */
- valueStringLength += uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint8_t)codeUnits[i++], 16, 2);
- }
- break;
- default:
- while (i < length)
- {
- uniValueString[valueStringLength++] = (UChar) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
- uniValueString[valueStringLength++] = (UChar) UNICODE_X_CODEPOINT; /* adding X */
- uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint8_t) codeUnits[i++], 16, 2);
- valueStringLength += 2;
- }
- }
- }
- /* reset the error */
- *err = U_ZERO_ERROR;
-
- ucnv_cbToUWriteUChars(toArgs, uniValueString, valueStringLength, 0, err);
-}
-
-#endif
+ myValueSource = valueString;
+
+ /* reset the error */
+ *err = U_ZERO_ERROR;
+
+ ucnv_cbFromUWriteUChars(fromArgs, &myValueSource, myValueSource+valueStringLength, 0, err);
+
+ ucnv_setFromUCallBack (fromArgs->converter,
+ original,
+ originalContext,
+ &ignoredCallback,
+ &ignoredContext,
+ &err2);
+ if (U_FAILURE (err2))
+ {
+ *err = err2;
+ return;
+ }
+
+ return;
+}
+
+
+
+U_CAPI void U_EXPORT2
+UCNV_TO_U_CALLBACK_SKIP (
+ const void *context,
+ UConverterToUnicodeArgs *toArgs,
+ const char* codeUnits,
+ int32_t length,
+ UConverterCallbackReason reason,
+ UErrorCode * err)
+{
+ (void)toArgs;
+ (void)codeUnits;
+ (void)length;
+ if (reason <= UCNV_IRREGULAR)
+ {
+ if (context == NULL || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
+ {
+ *err = U_ZERO_ERROR;
+ }
+ /* else the caller must have set the error code accordingly. */
+ }
+ /* else ignore the reset, close and clone calls. */
+}
+
+U_CAPI void U_EXPORT2
+UCNV_TO_U_CALLBACK_SUBSTITUTE (
+ const void *context,
+ UConverterToUnicodeArgs *toArgs,
+ const char* codeUnits,
+ int32_t length,
+ UConverterCallbackReason reason,
+ UErrorCode * err)
+{
+ (void)codeUnits;
+ (void)length;
+ if (reason <= UCNV_IRREGULAR)
+ {
+ if (context == NULL || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
+ {
+ *err = U_ZERO_ERROR;
+ ucnv_cbToUWriteSub(toArgs,0,err);
+ }
+ /* else the caller must have set the error code accordingly. */
+ }
+ /* else ignore the reset, close and clone calls. */
+}
+
+/*uses uprv_itou to get a unicode escape sequence of the offensive sequence,
+ *and uses that as the substitution sequence
+ */
+U_CAPI void U_EXPORT2
+UCNV_TO_U_CALLBACK_ESCAPE (
+ const void *context,
+ UConverterToUnicodeArgs *toArgs,
+ const char* codeUnits,
+ int32_t length,
+ UConverterCallbackReason reason,
+ UErrorCode * err)
+{
+ UChar uniValueString[VALUE_STRING_LENGTH];
+ int32_t valueStringLength = 0;
+ int32_t i = 0;
+
+ if (reason > UCNV_IRREGULAR)
+ {
+ return;
+ }
+
+ if(context==NULL)
+ {
+ while (i < length)
+ {
+ uniValueString[valueStringLength++] = (UChar) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
+ uniValueString[valueStringLength++] = (UChar) UNICODE_X_CODEPOINT; /* adding X */
+ valueStringLength += uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint8_t) codeUnits[i++], 16, 2);
+ }
+ }
+ else
+ {
+ switch(*((char*)context))
+ {
+ case UCNV_PRV_ESCAPE_XML_DEC:
+ while (i < length)
+ {
+ uniValueString[valueStringLength++] = (UChar) UNICODE_AMP_CODEPOINT; /* adding & */
+ uniValueString[valueStringLength++] = (UChar) UNICODE_HASH_CODEPOINT; /* adding # */
+ valueStringLength += uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint8_t)codeUnits[i++], 10, 0);
+ uniValueString[valueStringLength++] = (UChar) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
+ }
+ break;
+
+ case UCNV_PRV_ESCAPE_XML_HEX:
+ while (i < length)
+ {
+ uniValueString[valueStringLength++] = (UChar) UNICODE_AMP_CODEPOINT; /* adding & */
+ uniValueString[valueStringLength++] = (UChar) UNICODE_HASH_CODEPOINT; /* adding # */
+ uniValueString[valueStringLength++] = (UChar) UNICODE_X_LOW_CODEPOINT; /* adding x */
+ valueStringLength += uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint8_t)codeUnits[i++], 16, 0);
+ uniValueString[valueStringLength++] = (UChar) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
+ }
+ break;
+ case UCNV_PRV_ESCAPE_C:
+ while (i < length)
+ {
+ uniValueString[valueStringLength++] = (UChar) UNICODE_RS_CODEPOINT; /* adding \ */
+ uniValueString[valueStringLength++] = (UChar) UNICODE_X_LOW_CODEPOINT; /* adding x */
+ valueStringLength += uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint8_t)codeUnits[i++], 16, 2);
+ }
+ break;
+ default:
+ while (i < length)
+ {
+ uniValueString[valueStringLength++] = (UChar) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
+ uniValueString[valueStringLength++] = (UChar) UNICODE_X_CODEPOINT; /* adding X */
+ uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint8_t) codeUnits[i++], 16, 2);
+ valueStringLength += 2;
+ }
+ }
+ }
+ /* reset the error */
+ *err = U_ZERO_ERROR;
+
+ ucnv_cbToUWriteUChars(toArgs, uniValueString, valueStringLength, 0, err);
+}
+
+#endif
diff --git a/contrib/libs/icu/common/ucnv_ext.cpp b/contrib/libs/icu/common/ucnv_ext.cpp
index 77ae6866af..7dea4eef41 100644
--- a/contrib/libs/icu/common/ucnv_ext.cpp
+++ b/contrib/libs/icu/common/ucnv_ext.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: ucnv_ext.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -23,7 +23,7 @@
#if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION
#include "unicode/uset.h"
-#include "unicode/ustring.h"
+#include "unicode/ustring.h"
#include "ucnv_bld.h"
#include "ucnv_cnv.h"
#include "ucnv_ext.h"
diff --git a/contrib/libs/icu/common/ucnv_ext.h b/contrib/libs/icu/common/ucnv_ext.h
index 7c28f6aec9..dceea7ef12 100644
--- a/contrib/libs/icu/common/ucnv_ext.h
+++ b/contrib/libs/icu/common/ucnv_ext.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: ucnv_ext.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/ucnv_imp.h b/contrib/libs/icu/common/ucnv_imp.h
index 6d61f4f912..c5e6aeb47e 100644
--- a/contrib/libs/icu/common/ucnv_imp.h
+++ b/contrib/libs/icu/common/ucnv_imp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/ucnv_io.cpp b/contrib/libs/icu/common/ucnv_io.cpp
index cf02f3afd3..7a95a3f1e6 100644
--- a/contrib/libs/icu/common/ucnv_io.cpp
+++ b/contrib/libs/icu/common/ucnv_io.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/common/ucnv_io.h b/contrib/libs/icu/common/ucnv_io.h
index 17321688a9..8f2d7b5a02 100644
--- a/contrib/libs/icu/common/ucnv_io.h
+++ b/contrib/libs/icu/common/ucnv_io.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/ucnv_lmb.cpp b/contrib/libs/icu/common/ucnv_lmb.cpp
index 7170890c75..168392837b 100644
--- a/contrib/libs/icu/common/ucnv_lmb.cpp
+++ b/contrib/libs/icu/common/ucnv_lmb.cpp
@@ -1,1388 +1,1388 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-**********************************************************************
-* Copyright (C) 2000-2016, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
-* file name: ucnv_lmb.cpp
-* encoding: UTF-8
-* tab size: 4 (not used)
-* indentation:4
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+**********************************************************************
+* Copyright (C) 2000-2016, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* file name: ucnv_lmb.cpp
+* encoding: UTF-8
+* tab size: 4 (not used)
+* indentation:4
+*
+* created on: 2000feb09
+* created by: Brendan Murray
+* extensively hacked up by: Jim Snyder-Grant
+*
+* Modification History:
*
-* created on: 2000feb09
-* created by: Brendan Murray
-* extensively hacked up by: Jim Snyder-Grant
+* Date Name Description
*
-* Modification History:
-*
-* Date Name Description
-*
-* 06/20/2000 helena OS/400 port changes; mostly typecast.
-* 06/27/2000 Jim Snyder-Grant Deal with partial characters and small buffers.
-* Add comments to document LMBCS format and implementation
-* restructured order & breakdown of functions
-* 06/28/2000 helena Major rewrite for the callback API changes.
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION
-
-#include "unicode/ucnv_err.h"
-#include "unicode/ucnv.h"
-#include "unicode/uset.h"
-#include "cmemory.h"
-#include "cstring.h"
-#include "uassert.h"
-#include "ucnv_imp.h"
-#include "ucnv_bld.h"
-#include "ucnv_cnv.h"
-
-#ifdef EBCDIC_RTL
- #include "ascii_a.h"
-#endif
-
+* 06/20/2000 helena OS/400 port changes; mostly typecast.
+* 06/27/2000 Jim Snyder-Grant Deal with partial characters and small buffers.
+* Add comments to document LMBCS format and implementation
+* restructured order & breakdown of functions
+* 06/28/2000 helena Major rewrite for the callback API changes.
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION
+
+#include "unicode/ucnv_err.h"
+#include "unicode/ucnv.h"
+#include "unicode/uset.h"
+#include "cmemory.h"
+#include "cstring.h"
+#include "uassert.h"
+#include "ucnv_imp.h"
+#include "ucnv_bld.h"
+#include "ucnv_cnv.h"
+
+#ifdef EBCDIC_RTL
+ #include "ascii_a.h"
+#endif
+
+/*
+ LMBCS
+
+ (Lotus Multi-Byte Character Set)
+
+ LMBCS was invented in the late 1980's and is primarily used in Lotus Notes
+ databases and in Lotus 1-2-3 files. Programmers who work with the APIs
+ into these products will sometimes need to deal with strings in this format.
+
+ The code in this file provides an implementation for an ICU converter of
+ LMBCS to and from Unicode.
+
+ Since the LMBCS character set is only sparsely documented in existing
+ printed or online material, we have added extensive annotation to this
+ file to serve as a guide to understanding LMBCS.
+
+ LMBCS was originally designed with these four sometimes-competing design goals:
+
+ -Provide encodings for the characters in 12 existing national standards
+ (plus a few other characters)
+ -Minimal memory footprint
+ -Maximal speed of conversion into the existing national character sets
+ -No need to track a changing state as you interpret a string.
+
+
+ All of the national character sets LMBCS was trying to encode are 'ANSI'
+ based, in that the bytes from 0x20 - 0x7F are almost exactly the
+ same common Latin unaccented characters and symbols in all character sets.
+
+ So, in order to help meet the speed & memory design goals, the common ANSI
+ bytes from 0x20-0x7F are represented by the same single-byte values in LMBCS.
+
+ The general LMBCS code unit is from 1-3 bytes. We can describe the 3 bytes as
+ follows:
+
+ [G] D1 [D2]
+
+ That is, a sometimes-optional 'group' byte, followed by 1 and sometimes 2
+ data bytes. The maximum size of a LMBCS chjaracter is 3 bytes:
+*/
+#define ULMBCS_CHARSIZE_MAX 3
+/*
+ The single-byte values from 0x20 to 0x7F are examples of single D1 bytes.
+ We often have to figure out if byte values are below or above this, so we
+ use the ANSI nomenclature 'C0' and 'C1' to refer to the range of control
+ characters just above & below the common lower-ANSI range */
+#define ULMBCS_C0END 0x1F
+#define ULMBCS_C1START 0x80
+/*
+ Since LMBCS is always dealing in byte units. we create a local type here for
+ dealing with these units of LMBCS code units:
+
+*/
+typedef uint8_t ulmbcs_byte_t;
+
/*
- LMBCS
-
- (Lotus Multi-Byte Character Set)
-
- LMBCS was invented in the late 1980's and is primarily used in Lotus Notes
- databases and in Lotus 1-2-3 files. Programmers who work with the APIs
- into these products will sometimes need to deal with strings in this format.
-
- The code in this file provides an implementation for an ICU converter of
- LMBCS to and from Unicode.
-
- Since the LMBCS character set is only sparsely documented in existing
- printed or online material, we have added extensive annotation to this
- file to serve as a guide to understanding LMBCS.
-
- LMBCS was originally designed with these four sometimes-competing design goals:
-
- -Provide encodings for the characters in 12 existing national standards
- (plus a few other characters)
- -Minimal memory footprint
- -Maximal speed of conversion into the existing national character sets
- -No need to track a changing state as you interpret a string.
-
-
- All of the national character sets LMBCS was trying to encode are 'ANSI'
- based, in that the bytes from 0x20 - 0x7F are almost exactly the
- same common Latin unaccented characters and symbols in all character sets.
-
- So, in order to help meet the speed & memory design goals, the common ANSI
- bytes from 0x20-0x7F are represented by the same single-byte values in LMBCS.
-
- The general LMBCS code unit is from 1-3 bytes. We can describe the 3 bytes as
- follows:
-
- [G] D1 [D2]
-
- That is, a sometimes-optional 'group' byte, followed by 1 and sometimes 2
- data bytes. The maximum size of a LMBCS chjaracter is 3 bytes:
-*/
-#define ULMBCS_CHARSIZE_MAX 3
+ Most of the values less than 0x20 are reserved in LMBCS to announce
+ which national character standard is being used for the 'D' bytes.
+ In the comments we show the common name and the IBM character-set ID
+ for these character-set announcers:
+*/
+
+#define ULMBCS_GRP_L1 0x01 /* Latin-1 :ibm-850 */
+#define ULMBCS_GRP_GR 0x02 /* Greek :ibm-851 */
+#define ULMBCS_GRP_HE 0x03 /* Hebrew :ibm-1255 */
+#define ULMBCS_GRP_AR 0x04 /* Arabic :ibm-1256 */
+#define ULMBCS_GRP_RU 0x05 /* Cyrillic :ibm-1251 */
+#define ULMBCS_GRP_L2 0x06 /* Latin-2 :ibm-852 */
+#define ULMBCS_GRP_TR 0x08 /* Turkish :ibm-1254 */
+#define ULMBCS_GRP_TH 0x0B /* Thai :ibm-874 */
+#define ULMBCS_GRP_JA 0x10 /* Japanese :ibm-943 */
+#define ULMBCS_GRP_KO 0x11 /* Korean :ibm-1261 */
+#define ULMBCS_GRP_TW 0x12 /* Chinese SC :ibm-950 */
+#define ULMBCS_GRP_CN 0x13 /* Chinese TC :ibm-1386 */
+
+/*
+ So, the beginning of understanding LMBCS is that IF the first byte of a LMBCS
+ character is one of those 12 values, you can interpret the remaining bytes of
+ that character as coming from one of those character sets. Since the lower
+ ANSI bytes already are represented in single bytes, using one of the character
+ set announcers is used to announce a character that starts with a byte of
+ 0x80 or greater.
+
+ The character sets are arranged so that the single byte sets all appear
+ before the multi-byte character sets. When we need to tell whether a
+ group byte is for a single byte char set or not we use this define: */
+
+#define ULMBCS_DOUBLEOPTGROUP_START 0x10
+
/*
- The single-byte values from 0x20 to 0x7F are examples of single D1 bytes.
- We often have to figure out if byte values are below or above this, so we
- use the ANSI nomenclature 'C0' and 'C1' to refer to the range of control
- characters just above & below the common lower-ANSI range */
-#define ULMBCS_C0END 0x1F
-#define ULMBCS_C1START 0x80
+However, to fully understand LMBCS, you must also understand a series of
+exceptions & optimizations made in service of the design goals.
+
+First, those of you who are character set mavens may have noticed that
+the 'double-byte' character sets are actually multi-byte character sets
+that can have 1 or two bytes, even in the upper-ascii range. To force
+each group byte to introduce a fixed-width encoding (to make it faster to
+count characters), we use a convention of doubling up on the group byte
+to introduce any single-byte character > 0x80 in an otherwise double-byte
+character set. So, for example, the LMBCS sequence x10 x10 xAE is the
+same as '0xAE' in the Japanese code page 943.
+
+Next, you will notice that the list of group bytes has some gaps.
+These are used in various ways.
+
+We reserve a few special single byte values for common control
+characters. These are in the same place as their ANSI eqivalents for speed.
+*/
+
+#define ULMBCS_HT 0x09 /* Fixed control char - Horizontal Tab */
+#define ULMBCS_LF 0x0A /* Fixed control char - Line Feed */
+#define ULMBCS_CR 0x0D /* Fixed control char - Carriage Return */
+
+/* Then, 1-2-3 reserved a special single-byte character to put at the
+beginning of internal 'system' range names: */
+
+#define ULMBCS_123SYSTEMRANGE 0x19
+
+/* Then we needed a place to put all the other ansi control characters
+that must be moved to different values because LMBCS reserves those
+values for other purposes. To represent the control characters, we start
+with a first byte of 0xF & add the control chaarcter value as the
+second byte */
+#define ULMBCS_GRP_CTRL 0x0F
+
+/* For the C0 controls (less than 0x20), we add 0x20 to preserve the
+useful doctrine that any byte less than 0x20 in a LMBCS char must be
+the first byte of a character:*/
+#define ULMBCS_CTRLOFFSET 0x20
+
/*
- Since LMBCS is always dealing in byte units. we create a local type here for
- dealing with these units of LMBCS code units:
-
-*/
-typedef uint8_t ulmbcs_byte_t;
-
-/*
- Most of the values less than 0x20 are reserved in LMBCS to announce
- which national character standard is being used for the 'D' bytes.
- In the comments we show the common name and the IBM character-set ID
- for these character-set announcers:
-*/
-
-#define ULMBCS_GRP_L1 0x01 /* Latin-1 :ibm-850 */
-#define ULMBCS_GRP_GR 0x02 /* Greek :ibm-851 */
-#define ULMBCS_GRP_HE 0x03 /* Hebrew :ibm-1255 */
-#define ULMBCS_GRP_AR 0x04 /* Arabic :ibm-1256 */
-#define ULMBCS_GRP_RU 0x05 /* Cyrillic :ibm-1251 */
-#define ULMBCS_GRP_L2 0x06 /* Latin-2 :ibm-852 */
-#define ULMBCS_GRP_TR 0x08 /* Turkish :ibm-1254 */
-#define ULMBCS_GRP_TH 0x0B /* Thai :ibm-874 */
-#define ULMBCS_GRP_JA 0x10 /* Japanese :ibm-943 */
-#define ULMBCS_GRP_KO 0x11 /* Korean :ibm-1261 */
-#define ULMBCS_GRP_TW 0x12 /* Chinese SC :ibm-950 */
-#define ULMBCS_GRP_CN 0x13 /* Chinese TC :ibm-1386 */
-
+Where to put the characters that aren't part of any of the 12 national
+character sets? The first thing that was done, in the earlier years of
+LMBCS, was to use up the spaces of the form
+
+ [G] D1,
+
+ where 'G' was one of the single-byte character groups, and
+ D1 was less than 0x80. These sequences are gathered together
+ into a Lotus-invented doublebyte character set to represent a
+ lot of stray values. Internally, in this implementation, we track this
+ as group '0', as a place to tuck this exceptions list.*/
+
+#define ULMBCS_GRP_EXCEPT 0x00
+/*
+ Finally, as the durability and usefulness of UNICODE became clear,
+ LOTUS added a new group 0x14 to hold Unicode values not otherwise
+ represented in LMBCS: */
+#define ULMBCS_GRP_UNICODE 0x14
+/* The two bytes appearing after a 0x14 are intrepreted as UFT-16 BE
+(Big-Endian) characters. The exception comes when the UTF16
+representation would have a zero as the second byte. In that case,
+'F6' is used in its place, and the bytes are swapped. (This prevents
+LMBCS from encoding any Unicode values of the form U+F6xx, but that's OK:
+0xF6xx is in the middle of the Private Use Area.)*/
+#define ULMBCS_UNICOMPATZERO 0xF6
+
+/* It is also useful in our code to have a constant for the size of
+a LMBCS char that holds a literal Unicode value */
+#define ULMBCS_UNICODE_SIZE 3
+
/*
- So, the beginning of understanding LMBCS is that IF the first byte of a LMBCS
- character is one of those 12 values, you can interpret the remaining bytes of
- that character as coming from one of those character sets. Since the lower
- ANSI bytes already are represented in single bytes, using one of the character
- set announcers is used to announce a character that starts with a byte of
- 0x80 or greater.
-
- The character sets are arranged so that the single byte sets all appear
- before the multi-byte character sets. When we need to tell whether a
- group byte is for a single byte char set or not we use this define: */
-
-#define ULMBCS_DOUBLEOPTGROUP_START 0x10
-
-/*
-However, to fully understand LMBCS, you must also understand a series of
-exceptions & optimizations made in service of the design goals.
-
-First, those of you who are character set mavens may have noticed that
-the 'double-byte' character sets are actually multi-byte character sets
-that can have 1 or two bytes, even in the upper-ascii range. To force
-each group byte to introduce a fixed-width encoding (to make it faster to
-count characters), we use a convention of doubling up on the group byte
-to introduce any single-byte character > 0x80 in an otherwise double-byte
-character set. So, for example, the LMBCS sequence x10 x10 xAE is the
-same as '0xAE' in the Japanese code page 943.
-
-Next, you will notice that the list of group bytes has some gaps.
-These are used in various ways.
-
-We reserve a few special single byte values for common control
-characters. These are in the same place as their ANSI eqivalents for speed.
-*/
-
-#define ULMBCS_HT 0x09 /* Fixed control char - Horizontal Tab */
-#define ULMBCS_LF 0x0A /* Fixed control char - Line Feed */
-#define ULMBCS_CR 0x0D /* Fixed control char - Carriage Return */
-
-/* Then, 1-2-3 reserved a special single-byte character to put at the
-beginning of internal 'system' range names: */
-
-#define ULMBCS_123SYSTEMRANGE 0x19
-
-/* Then we needed a place to put all the other ansi control characters
-that must be moved to different values because LMBCS reserves those
-values for other purposes. To represent the control characters, we start
-with a first byte of 0xF & add the control chaarcter value as the
-second byte */
-#define ULMBCS_GRP_CTRL 0x0F
-
-/* For the C0 controls (less than 0x20), we add 0x20 to preserve the
-useful doctrine that any byte less than 0x20 in a LMBCS char must be
-the first byte of a character:*/
-#define ULMBCS_CTRLOFFSET 0x20
-
-/*
-Where to put the characters that aren't part of any of the 12 national
-character sets? The first thing that was done, in the earlier years of
-LMBCS, was to use up the spaces of the form
-
- [G] D1,
+To squish the LMBCS representations down even further, and to make
+translations even faster,sometimes the optimization group byte can be dropped
+from a LMBCS character. This is decided on a process-by-process basis. The
+group byte that is dropped is called the 'optimization group'.
+
+For Notes, the optimzation group is always 0x1.*/
+#define ULMBCS_DEFAULTOPTGROUP 0x1
+/* For 1-2-3 files, the optimzation group is stored in the header of the 1-2-3
+file.
+
+ In any case, when using ICU, you either pass in the
+optimization group as part of the name of the converter (LMBCS-1, LMBCS-2,
+etc.). Using plain 'LMBCS' as the name of the converter will give you
+LMBCS-1.
+
+
+*** Implementation strategy ***
+
+
+Because of the extensive use of other character sets, the LMBCS converter
+keeps a mapping between optimization groups and IBM character sets, so that
+ICU converters can be created and used as needed. */
+
+/* As you can see, even though any byte below 0x20 could be an optimization
+byte, only those at 0x13 or below can map to an actual converter. To limit
+some loops and searches, we define a value for that last group converter:*/
+
+#define ULMBCS_GRP_LAST 0x13 /* last LMBCS group that has a converter */
+
+static const char * const OptGroupByteToCPName[ULMBCS_GRP_LAST + 1] = {
+ /* 0x0000 */ "lmb-excp", /* internal home for the LOTUS exceptions list */
+ /* 0x0001 */ "ibm-850",
+ /* 0x0002 */ "ibm-851",
+ /* 0x0003 */ "windows-1255",
+ /* 0x0004 */ "windows-1256",
+ /* 0x0005 */ "windows-1251",
+ /* 0x0006 */ "ibm-852",
+ /* 0x0007 */ NULL, /* Unused */
+ /* 0x0008 */ "windows-1254",
+ /* 0x0009 */ NULL, /* Control char HT */
+ /* 0x000A */ NULL, /* Control char LF */
+ /* 0x000B */ "windows-874",
+ /* 0x000C */ NULL, /* Unused */
+ /* 0x000D */ NULL, /* Control char CR */
+ /* 0x000E */ NULL, /* Unused */
+ /* 0x000F */ NULL, /* Control chars: 0x0F20 + C0/C1 character: algorithmic */
+ /* 0x0010 */ "windows-932",
+ /* 0x0011 */ "windows-949",
+ /* 0x0012 */ "windows-950",
+ /* 0x0013 */ "windows-936"
+
+ /* The rest are null, including the 0x0014 Unicode compatibility region
+ and 0x0019, the 1-2-3 system range control char */
+};
+
+
+/* That's approximately all the data that's needed for translating
+ LMBCS to Unicode.
+
+
+However, to translate Unicode to LMBCS, we need some more support.
+
+That's because there are often more than one possible mappings from a Unicode
+code point back into LMBCS. The first thing we do is look up into a table
+to figure out if there are more than one possible mappings. This table,
+arranged by Unicode values (including ranges) either lists which group
+to use, or says that it could go into one or more of the SBCS sets, or
+into one or more of the DBCS sets. (If the character exists in both DBCS &
+SBCS, the table will place it in the SBCS sets, to make the LMBCS code point
+length as small as possible. Here's the two special markers we use to indicate
+ambiguous mappings: */
+
+#define ULMBCS_AMBIGUOUS_SBCS 0x80 /* could fit in more than one
+ LMBCS sbcs native encoding
+ (example: most accented latin) */
+#define ULMBCS_AMBIGUOUS_MBCS 0x81 /* could fit in more than one
+ LMBCS mbcs native encoding
+ (example: Unihan) */
+#define ULMBCS_AMBIGUOUS_ALL 0x82
+/* And here's a simple way to see if a group falls in an appropriate range */
+#define ULMBCS_AMBIGUOUS_MATCH(agroup, xgroup) \
+ ((((agroup) == ULMBCS_AMBIGUOUS_SBCS) && \
+ (xgroup) < ULMBCS_DOUBLEOPTGROUP_START) || \
+ (((agroup) == ULMBCS_AMBIGUOUS_MBCS) && \
+ (xgroup) >= ULMBCS_DOUBLEOPTGROUP_START)) || \
+ ((agroup) == ULMBCS_AMBIGUOUS_ALL)
+
+
+/* The table & some code to use it: */
+
+
+static const struct _UniLMBCSGrpMap
+{
+ const UChar uniStartRange;
+ const UChar uniEndRange;
+ const ulmbcs_byte_t GrpType;
+} UniLMBCSGrpMap[]
+=
+{
+
+ {0x0001, 0x001F, ULMBCS_GRP_CTRL},
+ {0x0080, 0x009F, ULMBCS_GRP_CTRL},
+ {0x00A0, 0x00A6, ULMBCS_AMBIGUOUS_SBCS},
+ {0x00A7, 0x00A8, ULMBCS_AMBIGUOUS_ALL},
+ {0x00A9, 0x00AF, ULMBCS_AMBIGUOUS_SBCS},
+ {0x00B0, 0x00B1, ULMBCS_AMBIGUOUS_ALL},
+ {0x00B2, 0x00B3, ULMBCS_AMBIGUOUS_SBCS},
+ {0x00B4, 0x00B4, ULMBCS_AMBIGUOUS_ALL},
+ {0x00B5, 0x00B5, ULMBCS_AMBIGUOUS_SBCS},
+ {0x00B6, 0x00B6, ULMBCS_AMBIGUOUS_ALL},
+ {0x00B7, 0x00D6, ULMBCS_AMBIGUOUS_SBCS},
+ {0x00D7, 0x00D7, ULMBCS_AMBIGUOUS_ALL},
+ {0x00D8, 0x00F6, ULMBCS_AMBIGUOUS_SBCS},
+ {0x00F7, 0x00F7, ULMBCS_AMBIGUOUS_ALL},
+ {0x00F8, 0x01CD, ULMBCS_AMBIGUOUS_SBCS},
+ {0x01CE, 0x01CE, ULMBCS_GRP_TW },
+ {0x01CF, 0x02B9, ULMBCS_AMBIGUOUS_SBCS},
+ {0x02BA, 0x02BA, ULMBCS_GRP_CN},
+ {0x02BC, 0x02C8, ULMBCS_AMBIGUOUS_SBCS},
+ {0x02C9, 0x02D0, ULMBCS_AMBIGUOUS_MBCS},
+ {0x02D8, 0x02DD, ULMBCS_AMBIGUOUS_SBCS},
+ {0x0384, 0x0390, ULMBCS_AMBIGUOUS_SBCS},
+ {0x0391, 0x03A9, ULMBCS_AMBIGUOUS_ALL},
+ {0x03AA, 0x03B0, ULMBCS_AMBIGUOUS_SBCS},
+ {0x03B1, 0x03C9, ULMBCS_AMBIGUOUS_ALL},
+ {0x03CA, 0x03CE, ULMBCS_AMBIGUOUS_SBCS},
+ {0x0400, 0x0400, ULMBCS_GRP_RU},
+ {0x0401, 0x0401, ULMBCS_AMBIGUOUS_ALL},
+ {0x0402, 0x040F, ULMBCS_GRP_RU},
+ {0x0410, 0x0431, ULMBCS_AMBIGUOUS_ALL},
+ {0x0432, 0x044E, ULMBCS_GRP_RU},
+ {0x044F, 0x044F, ULMBCS_AMBIGUOUS_ALL},
+ {0x0450, 0x0491, ULMBCS_GRP_RU},
+ {0x05B0, 0x05F2, ULMBCS_GRP_HE},
+ {0x060C, 0x06AF, ULMBCS_GRP_AR},
+ {0x0E01, 0x0E5B, ULMBCS_GRP_TH},
+ {0x200C, 0x200F, ULMBCS_AMBIGUOUS_SBCS},
+ {0x2010, 0x2010, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2013, 0x2014, ULMBCS_AMBIGUOUS_SBCS},
+ {0x2015, 0x2015, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2016, 0x2016, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2017, 0x2017, ULMBCS_AMBIGUOUS_SBCS},
+ {0x2018, 0x2019, ULMBCS_AMBIGUOUS_ALL},
+ {0x201A, 0x201B, ULMBCS_AMBIGUOUS_SBCS},
+ {0x201C, 0x201D, ULMBCS_AMBIGUOUS_ALL},
+ {0x201E, 0x201F, ULMBCS_AMBIGUOUS_SBCS},
+ {0x2020, 0x2021, ULMBCS_AMBIGUOUS_ALL},
+ {0x2022, 0x2024, ULMBCS_AMBIGUOUS_SBCS},
+ {0x2025, 0x2025, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2026, 0x2026, ULMBCS_AMBIGUOUS_ALL},
+ {0x2027, 0x2027, ULMBCS_GRP_TW},
+ {0x2030, 0x2030, ULMBCS_AMBIGUOUS_ALL},
+ {0x2031, 0x2031, ULMBCS_AMBIGUOUS_SBCS},
+ {0x2032, 0x2033, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2035, 0x2035, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2039, 0x203A, ULMBCS_AMBIGUOUS_SBCS},
+ {0x203B, 0x203B, ULMBCS_AMBIGUOUS_MBCS},
+ {0x203C, 0x203C, ULMBCS_GRP_EXCEPT},
+ {0x2074, 0x2074, ULMBCS_GRP_KO},
+ {0x207F, 0x207F, ULMBCS_GRP_EXCEPT},
+ {0x2081, 0x2084, ULMBCS_GRP_KO},
+ {0x20A4, 0x20AC, ULMBCS_AMBIGUOUS_SBCS},
+ {0x2103, 0x2109, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2111, 0x2120, ULMBCS_AMBIGUOUS_SBCS},
+ /*zhujin: upgrade, for regressiont test, spr HKIA4YHTSU*/
+ {0x2121, 0x2121, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2122, 0x2126, ULMBCS_AMBIGUOUS_SBCS},
+ {0x212B, 0x212B, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2135, 0x2135, ULMBCS_AMBIGUOUS_SBCS},
+ {0x2153, 0x2154, ULMBCS_GRP_KO},
+ {0x215B, 0x215E, ULMBCS_GRP_EXCEPT},
+ {0x2160, 0x2179, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2190, 0x2193, ULMBCS_AMBIGUOUS_ALL},
+ {0x2194, 0x2195, ULMBCS_GRP_EXCEPT},
+ {0x2196, 0x2199, ULMBCS_AMBIGUOUS_MBCS},
+ {0x21A8, 0x21A8, ULMBCS_GRP_EXCEPT},
+ {0x21B8, 0x21B9, ULMBCS_GRP_CN},
+ {0x21D0, 0x21D1, ULMBCS_GRP_EXCEPT},
+ {0x21D2, 0x21D2, ULMBCS_AMBIGUOUS_MBCS},
+ {0x21D3, 0x21D3, ULMBCS_GRP_EXCEPT},
+ {0x21D4, 0x21D4, ULMBCS_AMBIGUOUS_MBCS},
+ {0x21D5, 0x21D5, ULMBCS_GRP_EXCEPT},
+ {0x21E7, 0x21E7, ULMBCS_GRP_CN},
+ {0x2200, 0x2200, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2201, 0x2201, ULMBCS_GRP_EXCEPT},
+ {0x2202, 0x2202, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2203, 0x2203, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2204, 0x2206, ULMBCS_GRP_EXCEPT},
+ {0x2207, 0x2208, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2209, 0x220A, ULMBCS_GRP_EXCEPT},
+ {0x220B, 0x220B, ULMBCS_AMBIGUOUS_MBCS},
+ {0x220F, 0x2215, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2219, 0x2219, ULMBCS_GRP_EXCEPT},
+ {0x221A, 0x221A, ULMBCS_AMBIGUOUS_MBCS},
+ {0x221B, 0x221C, ULMBCS_GRP_EXCEPT},
+ {0x221D, 0x221E, ULMBCS_AMBIGUOUS_MBCS},
+ {0x221F, 0x221F, ULMBCS_GRP_EXCEPT},
+ {0x2220, 0x2220, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2223, 0x222A, ULMBCS_AMBIGUOUS_MBCS},
+ {0x222B, 0x223D, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2245, 0x2248, ULMBCS_GRP_EXCEPT},
+ {0x224C, 0x224C, ULMBCS_GRP_TW},
+ {0x2252, 0x2252, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2260, 0x2261, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2262, 0x2265, ULMBCS_GRP_EXCEPT},
+ {0x2266, 0x226F, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2282, 0x2283, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2284, 0x2285, ULMBCS_GRP_EXCEPT},
+ {0x2286, 0x2287, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2288, 0x2297, ULMBCS_GRP_EXCEPT},
+ {0x2299, 0x22BF, ULMBCS_AMBIGUOUS_MBCS},
+ {0x22C0, 0x22C0, ULMBCS_GRP_EXCEPT},
+ {0x2310, 0x2310, ULMBCS_GRP_EXCEPT},
+ {0x2312, 0x2312, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2318, 0x2321, ULMBCS_GRP_EXCEPT},
+ {0x2318, 0x2321, ULMBCS_GRP_CN},
+ {0x2460, 0x24E9, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2500, 0x2500, ULMBCS_AMBIGUOUS_SBCS},
+ {0x2501, 0x2501, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2502, 0x2502, ULMBCS_AMBIGUOUS_ALL},
+ {0x2503, 0x2503, ULMBCS_AMBIGUOUS_MBCS},
+ {0x2504, 0x2505, ULMBCS_GRP_TW},
+ {0x2506, 0x2665, ULMBCS_AMBIGUOUS_ALL},
+ {0x2666, 0x2666, ULMBCS_GRP_EXCEPT},
+ {0x2667, 0x2669, ULMBCS_AMBIGUOUS_SBCS},
+ {0x266A, 0x266A, ULMBCS_AMBIGUOUS_ALL},
+ {0x266B, 0x266C, ULMBCS_AMBIGUOUS_SBCS},
+ {0x266D, 0x266D, ULMBCS_AMBIGUOUS_MBCS},
+ {0x266E, 0x266E, ULMBCS_AMBIGUOUS_SBCS},
+ {0x266F, 0x266F, ULMBCS_GRP_JA},
+ {0x2670, 0x2E7F, ULMBCS_AMBIGUOUS_SBCS},
+ {0x2E80, 0xF861, ULMBCS_AMBIGUOUS_MBCS},
+ {0xF862, 0xF8FF, ULMBCS_GRP_EXCEPT},
+ {0xF900, 0xFA2D, ULMBCS_AMBIGUOUS_MBCS},
+ {0xFB00, 0xFEFF, ULMBCS_AMBIGUOUS_SBCS},
+ {0xFF01, 0xFFEE, ULMBCS_AMBIGUOUS_MBCS},
+ {0xFFFF, 0xFFFF, ULMBCS_GRP_UNICODE}
+};
- where 'G' was one of the single-byte character groups, and
- D1 was less than 0x80. These sequences are gathered together
- into a Lotus-invented doublebyte character set to represent a
- lot of stray values. Internally, in this implementation, we track this
- as group '0', as a place to tuck this exceptions list.*/
-
-#define ULMBCS_GRP_EXCEPT 0x00
+static ulmbcs_byte_t
+FindLMBCSUniRange(UChar uniChar)
+{
+ const struct _UniLMBCSGrpMap * pTable = UniLMBCSGrpMap;
+
+ while (uniChar > pTable->uniEndRange)
+ {
+ pTable++;
+ }
+
+ if (uniChar >= pTable->uniStartRange)
+ {
+ return pTable->GrpType;
+ }
+ return ULMBCS_GRP_UNICODE;
+}
+
/*
- Finally, as the durability and usefulness of UNICODE became clear,
- LOTUS added a new group 0x14 to hold Unicode values not otherwise
- represented in LMBCS: */
-#define ULMBCS_GRP_UNICODE 0x14
-/* The two bytes appearing after a 0x14 are intrepreted as UFT-16 BE
-(Big-Endian) characters. The exception comes when the UTF16
-representation would have a zero as the second byte. In that case,
-'F6' is used in its place, and the bytes are swapped. (This prevents
-LMBCS from encoding any Unicode values of the form U+F6xx, but that's OK:
-0xF6xx is in the middle of the Private Use Area.)*/
-#define ULMBCS_UNICOMPATZERO 0xF6
-
-/* It is also useful in our code to have a constant for the size of
-a LMBCS char that holds a literal Unicode value */
-#define ULMBCS_UNICODE_SIZE 3
-
-/*
-To squish the LMBCS representations down even further, and to make
-translations even faster,sometimes the optimization group byte can be dropped
-from a LMBCS character. This is decided on a process-by-process basis. The
-group byte that is dropped is called the 'optimization group'.
-
-For Notes, the optimzation group is always 0x1.*/
-#define ULMBCS_DEFAULTOPTGROUP 0x1
-/* For 1-2-3 files, the optimzation group is stored in the header of the 1-2-3
-file.
-
- In any case, when using ICU, you either pass in the
-optimization group as part of the name of the converter (LMBCS-1, LMBCS-2,
-etc.). Using plain 'LMBCS' as the name of the converter will give you
-LMBCS-1.
-
-
-*** Implementation strategy ***
-
-
-Because of the extensive use of other character sets, the LMBCS converter
-keeps a mapping between optimization groups and IBM character sets, so that
-ICU converters can be created and used as needed. */
-
-/* As you can see, even though any byte below 0x20 could be an optimization
-byte, only those at 0x13 or below can map to an actual converter. To limit
-some loops and searches, we define a value for that last group converter:*/
-
-#define ULMBCS_GRP_LAST 0x13 /* last LMBCS group that has a converter */
-
-static const char * const OptGroupByteToCPName[ULMBCS_GRP_LAST + 1] = {
- /* 0x0000 */ "lmb-excp", /* internal home for the LOTUS exceptions list */
- /* 0x0001 */ "ibm-850",
- /* 0x0002 */ "ibm-851",
- /* 0x0003 */ "windows-1255",
- /* 0x0004 */ "windows-1256",
- /* 0x0005 */ "windows-1251",
- /* 0x0006 */ "ibm-852",
- /* 0x0007 */ NULL, /* Unused */
- /* 0x0008 */ "windows-1254",
- /* 0x0009 */ NULL, /* Control char HT */
- /* 0x000A */ NULL, /* Control char LF */
- /* 0x000B */ "windows-874",
- /* 0x000C */ NULL, /* Unused */
- /* 0x000D */ NULL, /* Control char CR */
- /* 0x000E */ NULL, /* Unused */
- /* 0x000F */ NULL, /* Control chars: 0x0F20 + C0/C1 character: algorithmic */
- /* 0x0010 */ "windows-932",
- /* 0x0011 */ "windows-949",
- /* 0x0012 */ "windows-950",
- /* 0x0013 */ "windows-936"
-
- /* The rest are null, including the 0x0014 Unicode compatibility region
- and 0x0019, the 1-2-3 system range control char */
-};
-
-
-/* That's approximately all the data that's needed for translating
- LMBCS to Unicode.
-
-
-However, to translate Unicode to LMBCS, we need some more support.
-
-That's because there are often more than one possible mappings from a Unicode
-code point back into LMBCS. The first thing we do is look up into a table
-to figure out if there are more than one possible mappings. This table,
-arranged by Unicode values (including ranges) either lists which group
-to use, or says that it could go into one or more of the SBCS sets, or
-into one or more of the DBCS sets. (If the character exists in both DBCS &
-SBCS, the table will place it in the SBCS sets, to make the LMBCS code point
-length as small as possible. Here's the two special markers we use to indicate
-ambiguous mappings: */
-
-#define ULMBCS_AMBIGUOUS_SBCS 0x80 /* could fit in more than one
- LMBCS sbcs native encoding
- (example: most accented latin) */
-#define ULMBCS_AMBIGUOUS_MBCS 0x81 /* could fit in more than one
- LMBCS mbcs native encoding
- (example: Unihan) */
-#define ULMBCS_AMBIGUOUS_ALL 0x82
-/* And here's a simple way to see if a group falls in an appropriate range */
-#define ULMBCS_AMBIGUOUS_MATCH(agroup, xgroup) \
- ((((agroup) == ULMBCS_AMBIGUOUS_SBCS) && \
- (xgroup) < ULMBCS_DOUBLEOPTGROUP_START) || \
- (((agroup) == ULMBCS_AMBIGUOUS_MBCS) && \
- (xgroup) >= ULMBCS_DOUBLEOPTGROUP_START)) || \
- ((agroup) == ULMBCS_AMBIGUOUS_ALL)
-
-
-/* The table & some code to use it: */
-
-
-static const struct _UniLMBCSGrpMap
-{
- const UChar uniStartRange;
- const UChar uniEndRange;
- const ulmbcs_byte_t GrpType;
-} UniLMBCSGrpMap[]
-=
-{
-
- {0x0001, 0x001F, ULMBCS_GRP_CTRL},
- {0x0080, 0x009F, ULMBCS_GRP_CTRL},
- {0x00A0, 0x00A6, ULMBCS_AMBIGUOUS_SBCS},
- {0x00A7, 0x00A8, ULMBCS_AMBIGUOUS_ALL},
- {0x00A9, 0x00AF, ULMBCS_AMBIGUOUS_SBCS},
- {0x00B0, 0x00B1, ULMBCS_AMBIGUOUS_ALL},
- {0x00B2, 0x00B3, ULMBCS_AMBIGUOUS_SBCS},
- {0x00B4, 0x00B4, ULMBCS_AMBIGUOUS_ALL},
- {0x00B5, 0x00B5, ULMBCS_AMBIGUOUS_SBCS},
- {0x00B6, 0x00B6, ULMBCS_AMBIGUOUS_ALL},
- {0x00B7, 0x00D6, ULMBCS_AMBIGUOUS_SBCS},
- {0x00D7, 0x00D7, ULMBCS_AMBIGUOUS_ALL},
- {0x00D8, 0x00F6, ULMBCS_AMBIGUOUS_SBCS},
- {0x00F7, 0x00F7, ULMBCS_AMBIGUOUS_ALL},
- {0x00F8, 0x01CD, ULMBCS_AMBIGUOUS_SBCS},
- {0x01CE, 0x01CE, ULMBCS_GRP_TW },
- {0x01CF, 0x02B9, ULMBCS_AMBIGUOUS_SBCS},
- {0x02BA, 0x02BA, ULMBCS_GRP_CN},
- {0x02BC, 0x02C8, ULMBCS_AMBIGUOUS_SBCS},
- {0x02C9, 0x02D0, ULMBCS_AMBIGUOUS_MBCS},
- {0x02D8, 0x02DD, ULMBCS_AMBIGUOUS_SBCS},
- {0x0384, 0x0390, ULMBCS_AMBIGUOUS_SBCS},
- {0x0391, 0x03A9, ULMBCS_AMBIGUOUS_ALL},
- {0x03AA, 0x03B0, ULMBCS_AMBIGUOUS_SBCS},
- {0x03B1, 0x03C9, ULMBCS_AMBIGUOUS_ALL},
- {0x03CA, 0x03CE, ULMBCS_AMBIGUOUS_SBCS},
- {0x0400, 0x0400, ULMBCS_GRP_RU},
- {0x0401, 0x0401, ULMBCS_AMBIGUOUS_ALL},
- {0x0402, 0x040F, ULMBCS_GRP_RU},
- {0x0410, 0x0431, ULMBCS_AMBIGUOUS_ALL},
- {0x0432, 0x044E, ULMBCS_GRP_RU},
- {0x044F, 0x044F, ULMBCS_AMBIGUOUS_ALL},
- {0x0450, 0x0491, ULMBCS_GRP_RU},
- {0x05B0, 0x05F2, ULMBCS_GRP_HE},
- {0x060C, 0x06AF, ULMBCS_GRP_AR},
- {0x0E01, 0x0E5B, ULMBCS_GRP_TH},
- {0x200C, 0x200F, ULMBCS_AMBIGUOUS_SBCS},
- {0x2010, 0x2010, ULMBCS_AMBIGUOUS_MBCS},
- {0x2013, 0x2014, ULMBCS_AMBIGUOUS_SBCS},
- {0x2015, 0x2015, ULMBCS_AMBIGUOUS_MBCS},
- {0x2016, 0x2016, ULMBCS_AMBIGUOUS_MBCS},
- {0x2017, 0x2017, ULMBCS_AMBIGUOUS_SBCS},
- {0x2018, 0x2019, ULMBCS_AMBIGUOUS_ALL},
- {0x201A, 0x201B, ULMBCS_AMBIGUOUS_SBCS},
- {0x201C, 0x201D, ULMBCS_AMBIGUOUS_ALL},
- {0x201E, 0x201F, ULMBCS_AMBIGUOUS_SBCS},
- {0x2020, 0x2021, ULMBCS_AMBIGUOUS_ALL},
- {0x2022, 0x2024, ULMBCS_AMBIGUOUS_SBCS},
- {0x2025, 0x2025, ULMBCS_AMBIGUOUS_MBCS},
- {0x2026, 0x2026, ULMBCS_AMBIGUOUS_ALL},
- {0x2027, 0x2027, ULMBCS_GRP_TW},
- {0x2030, 0x2030, ULMBCS_AMBIGUOUS_ALL},
- {0x2031, 0x2031, ULMBCS_AMBIGUOUS_SBCS},
- {0x2032, 0x2033, ULMBCS_AMBIGUOUS_MBCS},
- {0x2035, 0x2035, ULMBCS_AMBIGUOUS_MBCS},
- {0x2039, 0x203A, ULMBCS_AMBIGUOUS_SBCS},
- {0x203B, 0x203B, ULMBCS_AMBIGUOUS_MBCS},
- {0x203C, 0x203C, ULMBCS_GRP_EXCEPT},
- {0x2074, 0x2074, ULMBCS_GRP_KO},
- {0x207F, 0x207F, ULMBCS_GRP_EXCEPT},
- {0x2081, 0x2084, ULMBCS_GRP_KO},
- {0x20A4, 0x20AC, ULMBCS_AMBIGUOUS_SBCS},
- {0x2103, 0x2109, ULMBCS_AMBIGUOUS_MBCS},
- {0x2111, 0x2120, ULMBCS_AMBIGUOUS_SBCS},
- /*zhujin: upgrade, for regressiont test, spr HKIA4YHTSU*/
- {0x2121, 0x2121, ULMBCS_AMBIGUOUS_MBCS},
- {0x2122, 0x2126, ULMBCS_AMBIGUOUS_SBCS},
- {0x212B, 0x212B, ULMBCS_AMBIGUOUS_MBCS},
- {0x2135, 0x2135, ULMBCS_AMBIGUOUS_SBCS},
- {0x2153, 0x2154, ULMBCS_GRP_KO},
- {0x215B, 0x215E, ULMBCS_GRP_EXCEPT},
- {0x2160, 0x2179, ULMBCS_AMBIGUOUS_MBCS},
- {0x2190, 0x2193, ULMBCS_AMBIGUOUS_ALL},
- {0x2194, 0x2195, ULMBCS_GRP_EXCEPT},
- {0x2196, 0x2199, ULMBCS_AMBIGUOUS_MBCS},
- {0x21A8, 0x21A8, ULMBCS_GRP_EXCEPT},
- {0x21B8, 0x21B9, ULMBCS_GRP_CN},
- {0x21D0, 0x21D1, ULMBCS_GRP_EXCEPT},
- {0x21D2, 0x21D2, ULMBCS_AMBIGUOUS_MBCS},
- {0x21D3, 0x21D3, ULMBCS_GRP_EXCEPT},
- {0x21D4, 0x21D4, ULMBCS_AMBIGUOUS_MBCS},
- {0x21D5, 0x21D5, ULMBCS_GRP_EXCEPT},
- {0x21E7, 0x21E7, ULMBCS_GRP_CN},
- {0x2200, 0x2200, ULMBCS_AMBIGUOUS_MBCS},
- {0x2201, 0x2201, ULMBCS_GRP_EXCEPT},
- {0x2202, 0x2202, ULMBCS_AMBIGUOUS_MBCS},
- {0x2203, 0x2203, ULMBCS_AMBIGUOUS_MBCS},
- {0x2204, 0x2206, ULMBCS_GRP_EXCEPT},
- {0x2207, 0x2208, ULMBCS_AMBIGUOUS_MBCS},
- {0x2209, 0x220A, ULMBCS_GRP_EXCEPT},
- {0x220B, 0x220B, ULMBCS_AMBIGUOUS_MBCS},
- {0x220F, 0x2215, ULMBCS_AMBIGUOUS_MBCS},
- {0x2219, 0x2219, ULMBCS_GRP_EXCEPT},
- {0x221A, 0x221A, ULMBCS_AMBIGUOUS_MBCS},
- {0x221B, 0x221C, ULMBCS_GRP_EXCEPT},
- {0x221D, 0x221E, ULMBCS_AMBIGUOUS_MBCS},
- {0x221F, 0x221F, ULMBCS_GRP_EXCEPT},
- {0x2220, 0x2220, ULMBCS_AMBIGUOUS_MBCS},
- {0x2223, 0x222A, ULMBCS_AMBIGUOUS_MBCS},
- {0x222B, 0x223D, ULMBCS_AMBIGUOUS_MBCS},
- {0x2245, 0x2248, ULMBCS_GRP_EXCEPT},
- {0x224C, 0x224C, ULMBCS_GRP_TW},
- {0x2252, 0x2252, ULMBCS_AMBIGUOUS_MBCS},
- {0x2260, 0x2261, ULMBCS_AMBIGUOUS_MBCS},
- {0x2262, 0x2265, ULMBCS_GRP_EXCEPT},
- {0x2266, 0x226F, ULMBCS_AMBIGUOUS_MBCS},
- {0x2282, 0x2283, ULMBCS_AMBIGUOUS_MBCS},
- {0x2284, 0x2285, ULMBCS_GRP_EXCEPT},
- {0x2286, 0x2287, ULMBCS_AMBIGUOUS_MBCS},
- {0x2288, 0x2297, ULMBCS_GRP_EXCEPT},
- {0x2299, 0x22BF, ULMBCS_AMBIGUOUS_MBCS},
- {0x22C0, 0x22C0, ULMBCS_GRP_EXCEPT},
- {0x2310, 0x2310, ULMBCS_GRP_EXCEPT},
- {0x2312, 0x2312, ULMBCS_AMBIGUOUS_MBCS},
- {0x2318, 0x2321, ULMBCS_GRP_EXCEPT},
- {0x2318, 0x2321, ULMBCS_GRP_CN},
- {0x2460, 0x24E9, ULMBCS_AMBIGUOUS_MBCS},
- {0x2500, 0x2500, ULMBCS_AMBIGUOUS_SBCS},
- {0x2501, 0x2501, ULMBCS_AMBIGUOUS_MBCS},
- {0x2502, 0x2502, ULMBCS_AMBIGUOUS_ALL},
- {0x2503, 0x2503, ULMBCS_AMBIGUOUS_MBCS},
- {0x2504, 0x2505, ULMBCS_GRP_TW},
- {0x2506, 0x2665, ULMBCS_AMBIGUOUS_ALL},
- {0x2666, 0x2666, ULMBCS_GRP_EXCEPT},
- {0x2667, 0x2669, ULMBCS_AMBIGUOUS_SBCS},
- {0x266A, 0x266A, ULMBCS_AMBIGUOUS_ALL},
- {0x266B, 0x266C, ULMBCS_AMBIGUOUS_SBCS},
- {0x266D, 0x266D, ULMBCS_AMBIGUOUS_MBCS},
- {0x266E, 0x266E, ULMBCS_AMBIGUOUS_SBCS},
- {0x266F, 0x266F, ULMBCS_GRP_JA},
- {0x2670, 0x2E7F, ULMBCS_AMBIGUOUS_SBCS},
- {0x2E80, 0xF861, ULMBCS_AMBIGUOUS_MBCS},
- {0xF862, 0xF8FF, ULMBCS_GRP_EXCEPT},
- {0xF900, 0xFA2D, ULMBCS_AMBIGUOUS_MBCS},
- {0xFB00, 0xFEFF, ULMBCS_AMBIGUOUS_SBCS},
- {0xFF01, 0xFFEE, ULMBCS_AMBIGUOUS_MBCS},
- {0xFFFF, 0xFFFF, ULMBCS_GRP_UNICODE}
-};
-
-static ulmbcs_byte_t
-FindLMBCSUniRange(UChar uniChar)
-{
- const struct _UniLMBCSGrpMap * pTable = UniLMBCSGrpMap;
-
- while (uniChar > pTable->uniEndRange)
- {
- pTable++;
- }
-
- if (uniChar >= pTable->uniStartRange)
- {
- return pTable->GrpType;
- }
- return ULMBCS_GRP_UNICODE;
-}
-
-/*
-We also ask the creator of a converter to send in a preferred locale
-that we can use in resolving ambiguous mappings. They send the locale
-in as a string, and we map it, if possible, to one of the
-LMBCS groups. We use this table, and the associated code, to
-do the lookup: */
-
-/**************************************************
- This table maps locale ID's to LMBCS opt groups.
- The default return is group 0x01. Note that for
- performance reasons, the table is sorted in
- increasing alphabetic order, with the notable
- exception of zhTW. This is to force the check
- for Traditonal Chinese before dropping back to
- Simplified.
-
- Note too that the Latin-1 groups have been
- commented out because it's the default, and
- this shortens the table, allowing a serial
- search to go quickly.
- *************************************************/
-
-static const struct _LocaleLMBCSGrpMap
-{
- const char *LocaleID;
- const ulmbcs_byte_t OptGroup;
-} LocaleLMBCSGrpMap[] =
-{
- {"ar", ULMBCS_GRP_AR},
- {"be", ULMBCS_GRP_RU},
- {"bg", ULMBCS_GRP_L2},
- /* {"ca", ULMBCS_GRP_L1}, */
- {"cs", ULMBCS_GRP_L2},
- /* {"da", ULMBCS_GRP_L1}, */
- /* {"de", ULMBCS_GRP_L1}, */
- {"el", ULMBCS_GRP_GR},
- /* {"en", ULMBCS_GRP_L1}, */
- /* {"es", ULMBCS_GRP_L1}, */
- /* {"et", ULMBCS_GRP_L1}, */
- /* {"fi", ULMBCS_GRP_L1}, */
- /* {"fr", ULMBCS_GRP_L1}, */
- {"he", ULMBCS_GRP_HE},
- {"hu", ULMBCS_GRP_L2},
- /* {"is", ULMBCS_GRP_L1}, */
- /* {"it", ULMBCS_GRP_L1}, */
- {"iw", ULMBCS_GRP_HE},
- {"ja", ULMBCS_GRP_JA},
- {"ko", ULMBCS_GRP_KO},
- /* {"lt", ULMBCS_GRP_L1}, */
- /* {"lv", ULMBCS_GRP_L1}, */
- {"mk", ULMBCS_GRP_RU},
- /* {"nl", ULMBCS_GRP_L1}, */
- /* {"no", ULMBCS_GRP_L1}, */
- {"pl", ULMBCS_GRP_L2},
- /* {"pt", ULMBCS_GRP_L1}, */
- {"ro", ULMBCS_GRP_L2},
- {"ru", ULMBCS_GRP_RU},
- {"sh", ULMBCS_GRP_L2},
- {"sk", ULMBCS_GRP_L2},
- {"sl", ULMBCS_GRP_L2},
- {"sq", ULMBCS_GRP_L2},
- {"sr", ULMBCS_GRP_RU},
- /* {"sv", ULMBCS_GRP_L1}, */
- {"th", ULMBCS_GRP_TH},
- {"tr", ULMBCS_GRP_TR},
- {"uk", ULMBCS_GRP_RU},
- /* {"vi", ULMBCS_GRP_L1}, */
- {"zhTW", ULMBCS_GRP_TW},
- {"zh", ULMBCS_GRP_CN},
- {NULL, ULMBCS_GRP_L1}
-};
-
-
-static ulmbcs_byte_t
-FindLMBCSLocale(const char *LocaleID)
-{
- const struct _LocaleLMBCSGrpMap *pTable = LocaleLMBCSGrpMap;
-
- if ((!LocaleID) || (!*LocaleID))
- {
- return 0;
- }
-
- while (pTable->LocaleID)
- {
- if (*pTable->LocaleID == *LocaleID) /* Check only first char for speed */
- {
- /* First char matches - check whole name, for entry-length */
- if (uprv_strncmp(pTable->LocaleID, LocaleID, strlen(pTable->LocaleID)) == 0)
- return pTable->OptGroup;
- }
- else
- if (*pTable->LocaleID > *LocaleID) /* Sorted alphabetically - exit */
- break;
- pTable++;
- }
- return ULMBCS_GRP_L1;
-}
-
-
-/*
- Before we get to the main body of code, here's how we hook up to the rest
- of ICU. ICU converters are required to define a structure that includes
- some function pointers, and some common data, in the style of a C++
- vtable. There is also room in there for converter-specific data. LMBCS
- uses that converter-specific data to keep track of the 12 subconverters
- we use, the optimization group, and the group (if any) that matches the
- locale. We have one structure instantiated for each of the 12 possible
- optimization groups. To avoid typos & to avoid boring the reader, we
- put the declarations of these structures and functions into macros. To see
- the definitions of these structures, see unicode\ucnv_bld.h
-*/
-
-typedef struct
- {
- UConverterSharedData *OptGrpConverter[ULMBCS_GRP_LAST+1]; /* Converter per Opt. grp. */
- uint8_t OptGroup; /* default Opt. grp. for this LMBCS session */
- uint8_t localeConverterIndex; /* reasonable locale match for index */
- }
-UConverterDataLMBCS;
-
-U_CDECL_BEGIN
-static void U_CALLCONV _LMBCSClose(UConverter * _this);
-U_CDECL_END
-
-#define DECLARE_LMBCS_DATA(n) \
-static const UConverterImpl _LMBCSImpl##n={\
- UCNV_LMBCS_##n,\
- NULL,NULL,\
- _LMBCSOpen##n,\
- _LMBCSClose,\
- NULL,\
- _LMBCSToUnicodeWithOffsets,\
- _LMBCSToUnicodeWithOffsets,\
- _LMBCSFromUnicode,\
- _LMBCSFromUnicode,\
- NULL,\
- NULL,\
- NULL,\
- NULL,\
- _LMBCSSafeClone,\
- ucnv_getCompleteUnicodeSet,\
- NULL,\
- NULL\
-};\
-static const UConverterStaticData _LMBCSStaticData##n={\
- sizeof(UConverterStaticData),\
- "LMBCS-" #n,\
- 0, UCNV_IBM, UCNV_LMBCS_##n, 1, 3,\
- { 0x3f, 0, 0, 0 },1,FALSE,FALSE,0,0,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} \
-};\
-const UConverterSharedData _LMBCSData##n= \
- UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_LMBCSStaticData##n, &_LMBCSImpl##n);
-
- /* The only function we needed to duplicate 12 times was the 'open'
-function, which will do basically the same thing except set a different
-optimization group. So, we put the common stuff into a worker function,
-and set up another macro to stamp out the 12 open functions:*/
-#define DEFINE_LMBCS_OPEN(n) \
-static void U_CALLCONV \
- _LMBCSOpen##n(UConverter* _this, UConverterLoadArgs* pArgs, UErrorCode* err) \
-{ _LMBCSOpenWorker(_this, pArgs, err, n); }
-
-
-
-/* Here's the open worker & the common close function */
-static void
-_LMBCSOpenWorker(UConverter* _this,
- UConverterLoadArgs *pArgs,
- UErrorCode* err,
- ulmbcs_byte_t OptGroup)
-{
- UConverterDataLMBCS * extraInfo = (UConverterDataLMBCS*)uprv_malloc (sizeof (UConverterDataLMBCS));
- _this->extraInfo = extraInfo;
- if(extraInfo != NULL)
- {
- UConverterNamePieces stackPieces;
- UConverterLoadArgs stackArgs= UCNV_LOAD_ARGS_INITIALIZER;
- ulmbcs_byte_t i;
-
- uprv_memset(extraInfo, 0, sizeof(UConverterDataLMBCS));
-
- stackArgs.onlyTestIsLoadable = pArgs->onlyTestIsLoadable;
-
- for (i=0; i <= ULMBCS_GRP_LAST && U_SUCCESS(*err); i++)
- {
- if(OptGroupByteToCPName[i] != NULL) {
- extraInfo->OptGrpConverter[i] = ucnv_loadSharedData(OptGroupByteToCPName[i], &stackPieces, &stackArgs, err);
- }
- }
-
- if(U_FAILURE(*err) || pArgs->onlyTestIsLoadable) {
- _LMBCSClose(_this);
- return;
- }
- extraInfo->OptGroup = OptGroup;
- extraInfo->localeConverterIndex = FindLMBCSLocale(pArgs->locale);
- }
- else
- {
- *err = U_MEMORY_ALLOCATION_ERROR;
- }
-}
-
-U_CDECL_BEGIN
-static void U_CALLCONV
-_LMBCSClose(UConverter * _this)
-{
- if (_this->extraInfo != NULL)
- {
- ulmbcs_byte_t Ix;
- UConverterDataLMBCS * extraInfo = (UConverterDataLMBCS *) _this->extraInfo;
-
- for (Ix=0; Ix <= ULMBCS_GRP_LAST; Ix++)
- {
- if (extraInfo->OptGrpConverter[Ix] != NULL)
- ucnv_unloadSharedDataIfReady(extraInfo->OptGrpConverter[Ix]);
- }
- if (!_this->isExtraLocal) {
- uprv_free (_this->extraInfo);
- _this->extraInfo = NULL;
- }
- }
-}
-
-typedef struct LMBCSClone {
- UConverter cnv;
- UConverterDataLMBCS lmbcs;
-} LMBCSClone;
-
-static UConverter * U_CALLCONV
-_LMBCSSafeClone(const UConverter *cnv,
- void *stackBuffer,
- int32_t *pBufferSize,
- UErrorCode *status) {
- (void)status;
- LMBCSClone *newLMBCS;
- UConverterDataLMBCS *extraInfo;
- int32_t i;
-
- if(*pBufferSize<=0) {
- *pBufferSize=(int32_t)sizeof(LMBCSClone);
- return NULL;
- }
-
- extraInfo=(UConverterDataLMBCS *)cnv->extraInfo;
- newLMBCS=(LMBCSClone *)stackBuffer;
-
- /* ucnv.c/ucnv_safeClone() copied the main UConverter already */
-
- uprv_memcpy(&newLMBCS->lmbcs, extraInfo, sizeof(UConverterDataLMBCS));
-
- /* share the subconverters */
- for(i = 0; i <= ULMBCS_GRP_LAST; ++i) {
- if(extraInfo->OptGrpConverter[i] != NULL) {
- ucnv_incrementRefCount(extraInfo->OptGrpConverter[i]);
- }
- }
-
- newLMBCS->cnv.extraInfo = &newLMBCS->lmbcs;
- newLMBCS->cnv.isExtraLocal = TRUE;
- return &newLMBCS->cnv;
-}
-
+We also ask the creator of a converter to send in a preferred locale
+that we can use in resolving ambiguous mappings. They send the locale
+in as a string, and we map it, if possible, to one of the
+LMBCS groups. We use this table, and the associated code, to
+do the lookup: */
+
+/**************************************************
+ This table maps locale ID's to LMBCS opt groups.
+ The default return is group 0x01. Note that for
+ performance reasons, the table is sorted in
+ increasing alphabetic order, with the notable
+ exception of zhTW. This is to force the check
+ for Traditonal Chinese before dropping back to
+ Simplified.
+
+ Note too that the Latin-1 groups have been
+ commented out because it's the default, and
+ this shortens the table, allowing a serial
+ search to go quickly.
+ *************************************************/
+
+static const struct _LocaleLMBCSGrpMap
+{
+ const char *LocaleID;
+ const ulmbcs_byte_t OptGroup;
+} LocaleLMBCSGrpMap[] =
+{
+ {"ar", ULMBCS_GRP_AR},
+ {"be", ULMBCS_GRP_RU},
+ {"bg", ULMBCS_GRP_L2},
+ /* {"ca", ULMBCS_GRP_L1}, */
+ {"cs", ULMBCS_GRP_L2},
+ /* {"da", ULMBCS_GRP_L1}, */
+ /* {"de", ULMBCS_GRP_L1}, */
+ {"el", ULMBCS_GRP_GR},
+ /* {"en", ULMBCS_GRP_L1}, */
+ /* {"es", ULMBCS_GRP_L1}, */
+ /* {"et", ULMBCS_GRP_L1}, */
+ /* {"fi", ULMBCS_GRP_L1}, */
+ /* {"fr", ULMBCS_GRP_L1}, */
+ {"he", ULMBCS_GRP_HE},
+ {"hu", ULMBCS_GRP_L2},
+ /* {"is", ULMBCS_GRP_L1}, */
+ /* {"it", ULMBCS_GRP_L1}, */
+ {"iw", ULMBCS_GRP_HE},
+ {"ja", ULMBCS_GRP_JA},
+ {"ko", ULMBCS_GRP_KO},
+ /* {"lt", ULMBCS_GRP_L1}, */
+ /* {"lv", ULMBCS_GRP_L1}, */
+ {"mk", ULMBCS_GRP_RU},
+ /* {"nl", ULMBCS_GRP_L1}, */
+ /* {"no", ULMBCS_GRP_L1}, */
+ {"pl", ULMBCS_GRP_L2},
+ /* {"pt", ULMBCS_GRP_L1}, */
+ {"ro", ULMBCS_GRP_L2},
+ {"ru", ULMBCS_GRP_RU},
+ {"sh", ULMBCS_GRP_L2},
+ {"sk", ULMBCS_GRP_L2},
+ {"sl", ULMBCS_GRP_L2},
+ {"sq", ULMBCS_GRP_L2},
+ {"sr", ULMBCS_GRP_RU},
+ /* {"sv", ULMBCS_GRP_L1}, */
+ {"th", ULMBCS_GRP_TH},
+ {"tr", ULMBCS_GRP_TR},
+ {"uk", ULMBCS_GRP_RU},
+ /* {"vi", ULMBCS_GRP_L1}, */
+ {"zhTW", ULMBCS_GRP_TW},
+ {"zh", ULMBCS_GRP_CN},
+ {NULL, ULMBCS_GRP_L1}
+};
+
+
+static ulmbcs_byte_t
+FindLMBCSLocale(const char *LocaleID)
+{
+ const struct _LocaleLMBCSGrpMap *pTable = LocaleLMBCSGrpMap;
+
+ if ((!LocaleID) || (!*LocaleID))
+ {
+ return 0;
+ }
+
+ while (pTable->LocaleID)
+ {
+ if (*pTable->LocaleID == *LocaleID) /* Check only first char for speed */
+ {
+ /* First char matches - check whole name, for entry-length */
+ if (uprv_strncmp(pTable->LocaleID, LocaleID, strlen(pTable->LocaleID)) == 0)
+ return pTable->OptGroup;
+ }
+ else
+ if (*pTable->LocaleID > *LocaleID) /* Sorted alphabetically - exit */
+ break;
+ pTable++;
+ }
+ return ULMBCS_GRP_L1;
+}
+
+
/*
- * There used to be a _LMBCSGetUnicodeSet() function here (up to svn revision 20117)
- * which added all code points except for U+F6xx
- * because those cannot be represented in the Unicode group.
- * However, it turns out that windows-950 has roundtrips for all of U+F6xx
- * which means that LMBCS can convert all Unicode code points after all.
- * We now simply use ucnv_getCompleteUnicodeSet().
- *
- * This may need to be looked at again as Lotus uses _LMBCSGetUnicodeSet(). (091216)
- */
-
-/*
- Here's the basic helper function that we use when converting from
- Unicode to LMBCS, and we suspect that a Unicode character will fit into
- one of the 12 groups. The return value is the number of bytes written
- starting at pStartLMBCS (if any).
-*/
-
+ Before we get to the main body of code, here's how we hook up to the rest
+ of ICU. ICU converters are required to define a structure that includes
+ some function pointers, and some common data, in the style of a C++
+ vtable. There is also room in there for converter-specific data. LMBCS
+ uses that converter-specific data to keep track of the 12 subconverters
+ we use, the optimization group, and the group (if any) that matches the
+ locale. We have one structure instantiated for each of the 12 possible
+ optimization groups. To avoid typos & to avoid boring the reader, we
+ put the declarations of these structures and functions into macros. To see
+ the definitions of these structures, see unicode\ucnv_bld.h
+*/
+
+typedef struct
+ {
+ UConverterSharedData *OptGrpConverter[ULMBCS_GRP_LAST+1]; /* Converter per Opt. grp. */
+ uint8_t OptGroup; /* default Opt. grp. for this LMBCS session */
+ uint8_t localeConverterIndex; /* reasonable locale match for index */
+ }
+UConverterDataLMBCS;
+
+U_CDECL_BEGIN
+static void U_CALLCONV _LMBCSClose(UConverter * _this);
+U_CDECL_END
+
+#define DECLARE_LMBCS_DATA(n) \
+static const UConverterImpl _LMBCSImpl##n={\
+ UCNV_LMBCS_##n,\
+ NULL,NULL,\
+ _LMBCSOpen##n,\
+ _LMBCSClose,\
+ NULL,\
+ _LMBCSToUnicodeWithOffsets,\
+ _LMBCSToUnicodeWithOffsets,\
+ _LMBCSFromUnicode,\
+ _LMBCSFromUnicode,\
+ NULL,\
+ NULL,\
+ NULL,\
+ NULL,\
+ _LMBCSSafeClone,\
+ ucnv_getCompleteUnicodeSet,\
+ NULL,\
+ NULL\
+};\
+static const UConverterStaticData _LMBCSStaticData##n={\
+ sizeof(UConverterStaticData),\
+ "LMBCS-" #n,\
+ 0, UCNV_IBM, UCNV_LMBCS_##n, 1, 3,\
+ { 0x3f, 0, 0, 0 },1,FALSE,FALSE,0,0,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} \
+};\
+const UConverterSharedData _LMBCSData##n= \
+ UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_LMBCSStaticData##n, &_LMBCSImpl##n);
+
+ /* The only function we needed to duplicate 12 times was the 'open'
+function, which will do basically the same thing except set a different
+optimization group. So, we put the common stuff into a worker function,
+and set up another macro to stamp out the 12 open functions:*/
+#define DEFINE_LMBCS_OPEN(n) \
+static void U_CALLCONV \
+ _LMBCSOpen##n(UConverter* _this, UConverterLoadArgs* pArgs, UErrorCode* err) \
+{ _LMBCSOpenWorker(_this, pArgs, err, n); }
+
+
+
+/* Here's the open worker & the common close function */
+static void
+_LMBCSOpenWorker(UConverter* _this,
+ UConverterLoadArgs *pArgs,
+ UErrorCode* err,
+ ulmbcs_byte_t OptGroup)
+{
+ UConverterDataLMBCS * extraInfo = (UConverterDataLMBCS*)uprv_malloc (sizeof (UConverterDataLMBCS));
+ _this->extraInfo = extraInfo;
+ if(extraInfo != NULL)
+ {
+ UConverterNamePieces stackPieces;
+ UConverterLoadArgs stackArgs= UCNV_LOAD_ARGS_INITIALIZER;
+ ulmbcs_byte_t i;
+
+ uprv_memset(extraInfo, 0, sizeof(UConverterDataLMBCS));
+
+ stackArgs.onlyTestIsLoadable = pArgs->onlyTestIsLoadable;
+
+ for (i=0; i <= ULMBCS_GRP_LAST && U_SUCCESS(*err); i++)
+ {
+ if(OptGroupByteToCPName[i] != NULL) {
+ extraInfo->OptGrpConverter[i] = ucnv_loadSharedData(OptGroupByteToCPName[i], &stackPieces, &stackArgs, err);
+ }
+ }
+
+ if(U_FAILURE(*err) || pArgs->onlyTestIsLoadable) {
+ _LMBCSClose(_this);
+ return;
+ }
+ extraInfo->OptGroup = OptGroup;
+ extraInfo->localeConverterIndex = FindLMBCSLocale(pArgs->locale);
+ }
+ else
+ {
+ *err = U_MEMORY_ALLOCATION_ERROR;
+ }
+}
+
+U_CDECL_BEGIN
+static void U_CALLCONV
+_LMBCSClose(UConverter * _this)
+{
+ if (_this->extraInfo != NULL)
+ {
+ ulmbcs_byte_t Ix;
+ UConverterDataLMBCS * extraInfo = (UConverterDataLMBCS *) _this->extraInfo;
+
+ for (Ix=0; Ix <= ULMBCS_GRP_LAST; Ix++)
+ {
+ if (extraInfo->OptGrpConverter[Ix] != NULL)
+ ucnv_unloadSharedDataIfReady(extraInfo->OptGrpConverter[Ix]);
+ }
+ if (!_this->isExtraLocal) {
+ uprv_free (_this->extraInfo);
+ _this->extraInfo = NULL;
+ }
+ }
+}
+
+typedef struct LMBCSClone {
+ UConverter cnv;
+ UConverterDataLMBCS lmbcs;
+} LMBCSClone;
+
+static UConverter * U_CALLCONV
+_LMBCSSafeClone(const UConverter *cnv,
+ void *stackBuffer,
+ int32_t *pBufferSize,
+ UErrorCode *status) {
+ (void)status;
+ LMBCSClone *newLMBCS;
+ UConverterDataLMBCS *extraInfo;
+ int32_t i;
+
+ if(*pBufferSize<=0) {
+ *pBufferSize=(int32_t)sizeof(LMBCSClone);
+ return NULL;
+ }
+
+ extraInfo=(UConverterDataLMBCS *)cnv->extraInfo;
+ newLMBCS=(LMBCSClone *)stackBuffer;
+
+ /* ucnv.c/ucnv_safeClone() copied the main UConverter already */
+
+ uprv_memcpy(&newLMBCS->lmbcs, extraInfo, sizeof(UConverterDataLMBCS));
+
+ /* share the subconverters */
+ for(i = 0; i <= ULMBCS_GRP_LAST; ++i) {
+ if(extraInfo->OptGrpConverter[i] != NULL) {
+ ucnv_incrementRefCount(extraInfo->OptGrpConverter[i]);
+ }
+ }
+
+ newLMBCS->cnv.extraInfo = &newLMBCS->lmbcs;
+ newLMBCS->cnv.isExtraLocal = TRUE;
+ return &newLMBCS->cnv;
+}
+
+/*
+ * There used to be a _LMBCSGetUnicodeSet() function here (up to svn revision 20117)
+ * which added all code points except for U+F6xx
+ * because those cannot be represented in the Unicode group.
+ * However, it turns out that windows-950 has roundtrips for all of U+F6xx
+ * which means that LMBCS can convert all Unicode code points after all.
+ * We now simply use ucnv_getCompleteUnicodeSet().
+ *
+ * This may need to be looked at again as Lotus uses _LMBCSGetUnicodeSet(). (091216)
+ */
+
+/*
+ Here's the basic helper function that we use when converting from
+ Unicode to LMBCS, and we suspect that a Unicode character will fit into
+ one of the 12 groups. The return value is the number of bytes written
+ starting at pStartLMBCS (if any).
+*/
+
+static size_t
+LMBCSConversionWorker (
+ UConverterDataLMBCS * extraInfo, /* subconverters, opt & locale groups */
+ ulmbcs_byte_t group, /* The group to try */
+ ulmbcs_byte_t * pStartLMBCS, /* where to put the results */
+ UChar * pUniChar, /* The input unicode character */
+ ulmbcs_byte_t * lastConverterIndex, /* output: track last successful group used */
+ UBool * groups_tried /* output: track any unsuccessful groups */
+)
+{
+ ulmbcs_byte_t * pLMBCS = pStartLMBCS;
+ UConverterSharedData * xcnv = extraInfo->OptGrpConverter[group];
+
+ int bytesConverted;
+ uint32_t value;
+ ulmbcs_byte_t firstByte;
+
+ U_ASSERT(xcnv);
+ U_ASSERT(group<ULMBCS_GRP_UNICODE);
+
+ bytesConverted = ucnv_MBCSFromUChar32(xcnv, *pUniChar, &value, FALSE);
+
+ /* get the first result byte */
+ if(bytesConverted > 0) {
+ firstByte = (ulmbcs_byte_t)(value >> ((bytesConverted - 1) * 8));
+ } else {
+ /* most common failure mode is an unassigned character */
+ groups_tried[group] = TRUE;
+ return 0;
+ }
+
+ *lastConverterIndex = group;
+
+ /* All initial byte values in lower ascii range should have been caught by now,
+ except with the exception group.
+ */
+ U_ASSERT((firstByte <= ULMBCS_C0END) || (firstByte >= ULMBCS_C1START) || (group == ULMBCS_GRP_EXCEPT));
+
+ /* use converted data: first write 0, 1 or two group bytes */
+ if (group != ULMBCS_GRP_EXCEPT && extraInfo->OptGroup != group)
+ {
+ *pLMBCS++ = group;
+ if (bytesConverted == 1 && group >= ULMBCS_DOUBLEOPTGROUP_START)
+ {
+ *pLMBCS++ = group;
+ }
+ }
+
+ /* don't emit control chars */
+ if ( bytesConverted == 1 && firstByte < 0x20 )
+ return 0;
+
+
+ /* then move over the converted data */
+ switch(bytesConverted)
+ {
+ case 4:
+ *pLMBCS++ = (ulmbcs_byte_t)(value >> 24);
+ U_FALLTHROUGH;
+ case 3:
+ *pLMBCS++ = (ulmbcs_byte_t)(value >> 16);
+ U_FALLTHROUGH;
+ case 2:
+ *pLMBCS++ = (ulmbcs_byte_t)(value >> 8);
+ U_FALLTHROUGH;
+ case 1:
+ *pLMBCS++ = (ulmbcs_byte_t)value;
+ U_FALLTHROUGH;
+ default:
+ /* will never occur */
+ break;
+ }
+
+ return (pLMBCS - pStartLMBCS);
+}
+
+
+/* This is a much simpler version of above, when we
+know we are writing LMBCS using the Unicode group
+*/
static size_t
-LMBCSConversionWorker (
- UConverterDataLMBCS * extraInfo, /* subconverters, opt & locale groups */
- ulmbcs_byte_t group, /* The group to try */
- ulmbcs_byte_t * pStartLMBCS, /* where to put the results */
- UChar * pUniChar, /* The input unicode character */
- ulmbcs_byte_t * lastConverterIndex, /* output: track last successful group used */
- UBool * groups_tried /* output: track any unsuccessful groups */
-)
-{
- ulmbcs_byte_t * pLMBCS = pStartLMBCS;
- UConverterSharedData * xcnv = extraInfo->OptGrpConverter[group];
-
- int bytesConverted;
- uint32_t value;
- ulmbcs_byte_t firstByte;
-
- U_ASSERT(xcnv);
- U_ASSERT(group<ULMBCS_GRP_UNICODE);
-
- bytesConverted = ucnv_MBCSFromUChar32(xcnv, *pUniChar, &value, FALSE);
-
- /* get the first result byte */
- if(bytesConverted > 0) {
- firstByte = (ulmbcs_byte_t)(value >> ((bytesConverted - 1) * 8));
- } else {
- /* most common failure mode is an unassigned character */
- groups_tried[group] = TRUE;
- return 0;
- }
-
- *lastConverterIndex = group;
-
- /* All initial byte values in lower ascii range should have been caught by now,
- except with the exception group.
- */
- U_ASSERT((firstByte <= ULMBCS_C0END) || (firstByte >= ULMBCS_C1START) || (group == ULMBCS_GRP_EXCEPT));
-
- /* use converted data: first write 0, 1 or two group bytes */
- if (group != ULMBCS_GRP_EXCEPT && extraInfo->OptGroup != group)
- {
- *pLMBCS++ = group;
- if (bytesConverted == 1 && group >= ULMBCS_DOUBLEOPTGROUP_START)
- {
- *pLMBCS++ = group;
- }
- }
-
- /* don't emit control chars */
- if ( bytesConverted == 1 && firstByte < 0x20 )
- return 0;
-
-
- /* then move over the converted data */
- switch(bytesConverted)
- {
- case 4:
- *pLMBCS++ = (ulmbcs_byte_t)(value >> 24);
- U_FALLTHROUGH;
- case 3:
- *pLMBCS++ = (ulmbcs_byte_t)(value >> 16);
- U_FALLTHROUGH;
- case 2:
- *pLMBCS++ = (ulmbcs_byte_t)(value >> 8);
- U_FALLTHROUGH;
- case 1:
- *pLMBCS++ = (ulmbcs_byte_t)value;
- U_FALLTHROUGH;
- default:
- /* will never occur */
- break;
- }
-
- return (pLMBCS - pStartLMBCS);
-}
-
-
-/* This is a much simpler version of above, when we
-know we are writing LMBCS using the Unicode group
-*/
-static size_t
-LMBCSConvertUni(ulmbcs_byte_t * pLMBCS, UChar uniChar)
-{
- /* encode into LMBCS Unicode range */
- uint8_t LowCh = (uint8_t)(uniChar & 0x00FF);
- uint8_t HighCh = (uint8_t)(uniChar >> 8);
-
- *pLMBCS++ = ULMBCS_GRP_UNICODE;
-
- if (LowCh == 0)
- {
- *pLMBCS++ = ULMBCS_UNICOMPATZERO;
- *pLMBCS++ = HighCh;
- }
- else
- {
- *pLMBCS++ = HighCh;
- *pLMBCS++ = LowCh;
- }
- return ULMBCS_UNICODE_SIZE;
-}
-
-
-
-/* The main Unicode to LMBCS conversion function */
-static void U_CALLCONV
-_LMBCSFromUnicode(UConverterFromUnicodeArgs* args,
- UErrorCode* err)
-{
- ulmbcs_byte_t lastConverterIndex = 0;
- UChar uniChar;
- ulmbcs_byte_t LMBCS[ULMBCS_CHARSIZE_MAX];
- ulmbcs_byte_t * pLMBCS;
- int32_t bytes_written;
- UBool groups_tried[ULMBCS_GRP_LAST+1];
- UConverterDataLMBCS * extraInfo = (UConverterDataLMBCS *) args->converter->extraInfo;
- int sourceIndex = 0;
-
- /* Basic strategy: attempt to fill in local LMBCS 1-char buffer.(LMBCS)
- If that succeeds, see if it will all fit into the target & copy it over
- if it does.
-
- We try conversions in the following order:
-
- 1. Single-byte ascii & special fixed control chars (&null)
- 2. Look up group in table & try that (could be
- A) Unicode group
- B) control group,
- C) national encoding,
- or ambiguous SBCS or MBCS group (on to step 4...)
+LMBCSConvertUni(ulmbcs_byte_t * pLMBCS, UChar uniChar)
+{
+ /* encode into LMBCS Unicode range */
+ uint8_t LowCh = (uint8_t)(uniChar & 0x00FF);
+ uint8_t HighCh = (uint8_t)(uniChar >> 8);
+
+ *pLMBCS++ = ULMBCS_GRP_UNICODE;
+
+ if (LowCh == 0)
+ {
+ *pLMBCS++ = ULMBCS_UNICOMPATZERO;
+ *pLMBCS++ = HighCh;
+ }
+ else
+ {
+ *pLMBCS++ = HighCh;
+ *pLMBCS++ = LowCh;
+ }
+ return ULMBCS_UNICODE_SIZE;
+}
+
+
+
+/* The main Unicode to LMBCS conversion function */
+static void U_CALLCONV
+_LMBCSFromUnicode(UConverterFromUnicodeArgs* args,
+ UErrorCode* err)
+{
+ ulmbcs_byte_t lastConverterIndex = 0;
+ UChar uniChar;
+ ulmbcs_byte_t LMBCS[ULMBCS_CHARSIZE_MAX];
+ ulmbcs_byte_t * pLMBCS;
+ int32_t bytes_written;
+ UBool groups_tried[ULMBCS_GRP_LAST+1];
+ UConverterDataLMBCS * extraInfo = (UConverterDataLMBCS *) args->converter->extraInfo;
+ int sourceIndex = 0;
+
+ /* Basic strategy: attempt to fill in local LMBCS 1-char buffer.(LMBCS)
+ If that succeeds, see if it will all fit into the target & copy it over
+ if it does.
+
+ We try conversions in the following order:
+
+ 1. Single-byte ascii & special fixed control chars (&null)
+ 2. Look up group in table & try that (could be
+ A) Unicode group
+ B) control group,
+ C) national encoding,
+ or ambiguous SBCS or MBCS group (on to step 4...)
+
+ 3. If its ambiguous, try this order:
+ A) The optimization group
+ B) The locale group
+ C) The last group that succeeded with this string.
+ D) every other group that's relevent (single or double)
+ E) If its single-byte ambiguous, try the exceptions group
+
+ 4. And as a grand fallback: Unicode
+ */
+
+ /*Fix for SPR#DJOE66JFN3 (Lotus)*/
+ ulmbcs_byte_t OldConverterIndex = 0;
+
+ while (args->source < args->sourceLimit && !U_FAILURE(*err))
+ {
+ /*Fix for SPR#DJOE66JFN3 (Lotus)*/
+ OldConverterIndex = extraInfo->localeConverterIndex;
+
+ if (args->target >= args->targetLimit)
+ {
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ uniChar = *(args->source);
+ bytes_written = 0;
+ pLMBCS = LMBCS;
+
+ /* check cases in rough order of how common they are, for speed */
+
+ /* single byte matches: strategy 1 */
+ /*Fix for SPR#DJOE66JFN3 (Lotus)*/
+ if((uniChar>=0x80) && (uniChar<=0xff)
+ /*Fix for SPR#JUYA6XAERU and TSAO7GL5NK (Lotus)*/ &&(uniChar!=0xB1) &&(uniChar!=0xD7) &&(uniChar!=0xF7)
+ &&(uniChar!=0xB0) &&(uniChar!=0xB4) &&(uniChar!=0xB6) &&(uniChar!=0xA7) &&(uniChar!=0xA8))
+ {
+ extraInfo->localeConverterIndex = ULMBCS_GRP_L1;
+ }
+ if (((uniChar > ULMBCS_C0END) && (uniChar < ULMBCS_C1START)) ||
+ uniChar == 0 || uniChar == ULMBCS_HT || uniChar == ULMBCS_CR ||
+ uniChar == ULMBCS_LF || uniChar == ULMBCS_123SYSTEMRANGE
+ )
+ {
+ *pLMBCS++ = (ulmbcs_byte_t ) uniChar;
+ bytes_written = 1;
+ }
+
+
+ if (!bytes_written)
+ {
+ /* Check by UNICODE range (Strategy 2) */
+ ulmbcs_byte_t group = FindLMBCSUniRange(uniChar);
- 3. If its ambiguous, try this order:
- A) The optimization group
- B) The locale group
- C) The last group that succeeded with this string.
- D) every other group that's relevent (single or double)
- E) If its single-byte ambiguous, try the exceptions group
-
- 4. And as a grand fallback: Unicode
- */
-
- /*Fix for SPR#DJOE66JFN3 (Lotus)*/
- ulmbcs_byte_t OldConverterIndex = 0;
-
- while (args->source < args->sourceLimit && !U_FAILURE(*err))
- {
- /*Fix for SPR#DJOE66JFN3 (Lotus)*/
- OldConverterIndex = extraInfo->localeConverterIndex;
-
- if (args->target >= args->targetLimit)
- {
- *err = U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- uniChar = *(args->source);
- bytes_written = 0;
- pLMBCS = LMBCS;
-
- /* check cases in rough order of how common they are, for speed */
-
- /* single byte matches: strategy 1 */
- /*Fix for SPR#DJOE66JFN3 (Lotus)*/
- if((uniChar>=0x80) && (uniChar<=0xff)
- /*Fix for SPR#JUYA6XAERU and TSAO7GL5NK (Lotus)*/ &&(uniChar!=0xB1) &&(uniChar!=0xD7) &&(uniChar!=0xF7)
- &&(uniChar!=0xB0) &&(uniChar!=0xB4) &&(uniChar!=0xB6) &&(uniChar!=0xA7) &&(uniChar!=0xA8))
- {
- extraInfo->localeConverterIndex = ULMBCS_GRP_L1;
- }
- if (((uniChar > ULMBCS_C0END) && (uniChar < ULMBCS_C1START)) ||
- uniChar == 0 || uniChar == ULMBCS_HT || uniChar == ULMBCS_CR ||
- uniChar == ULMBCS_LF || uniChar == ULMBCS_123SYSTEMRANGE
- )
- {
- *pLMBCS++ = (ulmbcs_byte_t ) uniChar;
- bytes_written = 1;
- }
-
-
- if (!bytes_written)
- {
- /* Check by UNICODE range (Strategy 2) */
- ulmbcs_byte_t group = FindLMBCSUniRange(uniChar);
-
- if (group == ULMBCS_GRP_UNICODE) /* (Strategy 2A) */
- {
- pLMBCS += LMBCSConvertUni(pLMBCS,uniChar);
-
- bytes_written = (int32_t)(pLMBCS - LMBCS);
- }
- else if (group == ULMBCS_GRP_CTRL) /* (Strategy 2B) */
- {
- /* Handle control characters here */
- if (uniChar <= ULMBCS_C0END)
- {
- *pLMBCS++ = ULMBCS_GRP_CTRL;
- *pLMBCS++ = (ulmbcs_byte_t)(ULMBCS_CTRLOFFSET + uniChar);
- }
- else if (uniChar >= ULMBCS_C1START && uniChar <= ULMBCS_C1START + ULMBCS_CTRLOFFSET)
- {
- *pLMBCS++ = ULMBCS_GRP_CTRL;
- *pLMBCS++ = (ulmbcs_byte_t ) (uniChar & 0x00FF);
- }
- bytes_written = (int32_t)(pLMBCS - LMBCS);
- }
- else if (group < ULMBCS_GRP_UNICODE) /* (Strategy 2C) */
- {
- /* a specific converter has been identified - use it */
- bytes_written = (int32_t)LMBCSConversionWorker (
- extraInfo, group, pLMBCS, &uniChar,
- &lastConverterIndex, groups_tried);
- }
- if (!bytes_written) /* the ambiguous group cases (Strategy 3) */
- {
- uprv_memset(groups_tried, 0, sizeof(groups_tried));
-
- /* check for non-default optimization group (Strategy 3A )*/
- if ((extraInfo->OptGroup != 1) && (ULMBCS_AMBIGUOUS_MATCH(group, extraInfo->OptGroup)))
- {
- /*zhujin: upgrade, merge #39299 here (Lotus) */
- /*To make R5 compatible translation, look for exceptional group first for non-DBCS*/
-
- if(extraInfo->localeConverterIndex < ULMBCS_DOUBLEOPTGROUP_START)
- {
- bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
- ULMBCS_GRP_L1, pLMBCS, &uniChar,
- &lastConverterIndex, groups_tried);
-
- if(!bytes_written)
- {
- bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
- ULMBCS_GRP_EXCEPT, pLMBCS, &uniChar,
- &lastConverterIndex, groups_tried);
- }
- if(!bytes_written)
- {
- bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
- extraInfo->localeConverterIndex, pLMBCS, &uniChar,
- &lastConverterIndex, groups_tried);
- }
- }
- else
- {
- bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
- extraInfo->localeConverterIndex, pLMBCS, &uniChar,
- &lastConverterIndex, groups_tried);
- }
- }
- /* check for locale optimization group (Strategy 3B) */
- if (!bytes_written && (extraInfo->localeConverterIndex) && (ULMBCS_AMBIGUOUS_MATCH(group, extraInfo->localeConverterIndex)))
- {
- bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
- extraInfo->localeConverterIndex, pLMBCS, &uniChar, &lastConverterIndex, groups_tried);
- }
- /* check for last optimization group used for this string (Strategy 3C) */
- if (!bytes_written && (lastConverterIndex) && (ULMBCS_AMBIGUOUS_MATCH(group, lastConverterIndex)))
- {
- bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
- lastConverterIndex, pLMBCS, &uniChar, &lastConverterIndex, groups_tried);
- }
- if (!bytes_written)
- {
- /* just check every possible matching converter (Strategy 3D) */
- ulmbcs_byte_t grp_start;
- ulmbcs_byte_t grp_end;
- ulmbcs_byte_t grp_ix;
- grp_start = (ulmbcs_byte_t)((group == ULMBCS_AMBIGUOUS_MBCS)
- ? ULMBCS_DOUBLEOPTGROUP_START
- : ULMBCS_GRP_L1);
- grp_end = (ulmbcs_byte_t)((group == ULMBCS_AMBIGUOUS_MBCS)
- ? ULMBCS_GRP_LAST
- : ULMBCS_GRP_TH);
- if(group == ULMBCS_AMBIGUOUS_ALL)
- {
- grp_start = ULMBCS_GRP_L1;
- grp_end = ULMBCS_GRP_LAST;
- }
- for (grp_ix = grp_start;
- grp_ix <= grp_end && !bytes_written;
- grp_ix++)
- {
- if (extraInfo->OptGrpConverter [grp_ix] && !groups_tried [grp_ix])
- {
- bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
- grp_ix, pLMBCS, &uniChar,
- &lastConverterIndex, groups_tried);
- }
- }
- /* a final conversion fallback to the exceptions group if its likely
- to be single byte (Strategy 3E) */
- if (!bytes_written && grp_start == ULMBCS_GRP_L1)
- {
- bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
- ULMBCS_GRP_EXCEPT, pLMBCS, &uniChar,
- &lastConverterIndex, groups_tried);
- }
- }
- /* all of our other strategies failed. Fallback to Unicode. (Strategy 4)*/
- if (!bytes_written)
- {
-
- pLMBCS += LMBCSConvertUni(pLMBCS, uniChar);
- bytes_written = (int32_t)(pLMBCS - LMBCS);
- }
- }
- }
+ if (group == ULMBCS_GRP_UNICODE) /* (Strategy 2A) */
+ {
+ pLMBCS += LMBCSConvertUni(pLMBCS,uniChar);
+
+ bytes_written = (int32_t)(pLMBCS - LMBCS);
+ }
+ else if (group == ULMBCS_GRP_CTRL) /* (Strategy 2B) */
+ {
+ /* Handle control characters here */
+ if (uniChar <= ULMBCS_C0END)
+ {
+ *pLMBCS++ = ULMBCS_GRP_CTRL;
+ *pLMBCS++ = (ulmbcs_byte_t)(ULMBCS_CTRLOFFSET + uniChar);
+ }
+ else if (uniChar >= ULMBCS_C1START && uniChar <= ULMBCS_C1START + ULMBCS_CTRLOFFSET)
+ {
+ *pLMBCS++ = ULMBCS_GRP_CTRL;
+ *pLMBCS++ = (ulmbcs_byte_t ) (uniChar & 0x00FF);
+ }
+ bytes_written = (int32_t)(pLMBCS - LMBCS);
+ }
+ else if (group < ULMBCS_GRP_UNICODE) /* (Strategy 2C) */
+ {
+ /* a specific converter has been identified - use it */
+ bytes_written = (int32_t)LMBCSConversionWorker (
+ extraInfo, group, pLMBCS, &uniChar,
+ &lastConverterIndex, groups_tried);
+ }
+ if (!bytes_written) /* the ambiguous group cases (Strategy 3) */
+ {
+ uprv_memset(groups_tried, 0, sizeof(groups_tried));
+
+ /* check for non-default optimization group (Strategy 3A )*/
+ if ((extraInfo->OptGroup != 1) && (ULMBCS_AMBIGUOUS_MATCH(group, extraInfo->OptGroup)))
+ {
+ /*zhujin: upgrade, merge #39299 here (Lotus) */
+ /*To make R5 compatible translation, look for exceptional group first for non-DBCS*/
+
+ if(extraInfo->localeConverterIndex < ULMBCS_DOUBLEOPTGROUP_START)
+ {
+ bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
+ ULMBCS_GRP_L1, pLMBCS, &uniChar,
+ &lastConverterIndex, groups_tried);
+
+ if(!bytes_written)
+ {
+ bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
+ ULMBCS_GRP_EXCEPT, pLMBCS, &uniChar,
+ &lastConverterIndex, groups_tried);
+ }
+ if(!bytes_written)
+ {
+ bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
+ extraInfo->localeConverterIndex, pLMBCS, &uniChar,
+ &lastConverterIndex, groups_tried);
+ }
+ }
+ else
+ {
+ bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
+ extraInfo->localeConverterIndex, pLMBCS, &uniChar,
+ &lastConverterIndex, groups_tried);
+ }
+ }
+ /* check for locale optimization group (Strategy 3B) */
+ if (!bytes_written && (extraInfo->localeConverterIndex) && (ULMBCS_AMBIGUOUS_MATCH(group, extraInfo->localeConverterIndex)))
+ {
+ bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
+ extraInfo->localeConverterIndex, pLMBCS, &uniChar, &lastConverterIndex, groups_tried);
+ }
+ /* check for last optimization group used for this string (Strategy 3C) */
+ if (!bytes_written && (lastConverterIndex) && (ULMBCS_AMBIGUOUS_MATCH(group, lastConverterIndex)))
+ {
+ bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
+ lastConverterIndex, pLMBCS, &uniChar, &lastConverterIndex, groups_tried);
+ }
+ if (!bytes_written)
+ {
+ /* just check every possible matching converter (Strategy 3D) */
+ ulmbcs_byte_t grp_start;
+ ulmbcs_byte_t grp_end;
+ ulmbcs_byte_t grp_ix;
+ grp_start = (ulmbcs_byte_t)((group == ULMBCS_AMBIGUOUS_MBCS)
+ ? ULMBCS_DOUBLEOPTGROUP_START
+ : ULMBCS_GRP_L1);
+ grp_end = (ulmbcs_byte_t)((group == ULMBCS_AMBIGUOUS_MBCS)
+ ? ULMBCS_GRP_LAST
+ : ULMBCS_GRP_TH);
+ if(group == ULMBCS_AMBIGUOUS_ALL)
+ {
+ grp_start = ULMBCS_GRP_L1;
+ grp_end = ULMBCS_GRP_LAST;
+ }
+ for (grp_ix = grp_start;
+ grp_ix <= grp_end && !bytes_written;
+ grp_ix++)
+ {
+ if (extraInfo->OptGrpConverter [grp_ix] && !groups_tried [grp_ix])
+ {
+ bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
+ grp_ix, pLMBCS, &uniChar,
+ &lastConverterIndex, groups_tried);
+ }
+ }
+ /* a final conversion fallback to the exceptions group if its likely
+ to be single byte (Strategy 3E) */
+ if (!bytes_written && grp_start == ULMBCS_GRP_L1)
+ {
+ bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
+ ULMBCS_GRP_EXCEPT, pLMBCS, &uniChar,
+ &lastConverterIndex, groups_tried);
+ }
+ }
+ /* all of our other strategies failed. Fallback to Unicode. (Strategy 4)*/
+ if (!bytes_written)
+ {
+
+ pLMBCS += LMBCSConvertUni(pLMBCS, uniChar);
+ bytes_written = (int32_t)(pLMBCS - LMBCS);
+ }
+ }
+ }
+
+ /* we have a translation. increment source and write as much as posible to target */
+ args->source++;
+ pLMBCS = LMBCS;
+ while (args->target < args->targetLimit && bytes_written--)
+ {
+ *(args->target)++ = *pLMBCS++;
+ if (args->offsets)
+ {
+ *(args->offsets)++ = sourceIndex;
+ }
+ }
+ sourceIndex++;
+ if (bytes_written > 0)
+ {
+ /* write any bytes that didn't fit in target to the error buffer,
+ common code will move this to target if we get called back with
+ enough target room
+ */
+ uint8_t * pErrorBuffer = args->converter->charErrorBuffer;
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ args->converter->charErrorBufferLength = (int8_t)bytes_written;
+ while (bytes_written--)
+ {
+ *pErrorBuffer++ = *pLMBCS++;
+ }
+ }
+ /*Fix for SPR#DJOE66JFN3 (Lotus)*/
+ extraInfo->localeConverterIndex = OldConverterIndex;
+ }
+}
+
+
+/* Now, the Unicode from LMBCS section */
+
+
+/* A function to call when we are looking at the Unicode group byte in LMBCS */
+static UChar
+GetUniFromLMBCSUni(char const ** ppLMBCSin) /* Called with LMBCS-style Unicode byte stream */
+{
+ uint8_t HighCh = *(*ppLMBCSin)++; /* Big-endian Unicode in LMBCS compatibility group*/
+ uint8_t LowCh = *(*ppLMBCSin)++;
+
+ if (HighCh == ULMBCS_UNICOMPATZERO )
+ {
+ HighCh = LowCh;
+ LowCh = 0; /* zero-byte in LSB special character */
+ }
+ return (UChar)((HighCh << 8) | LowCh);
+}
+
+
+
+/* CHECK_SOURCE_LIMIT: Helper macro to verify that there are at least'index'
+ bytes left in source up to sourceLimit.Errors appropriately if not.
+ If we reach the limit, then update the source pointer to there to consume
+ all input as required by ICU converter semantics.
+*/
+
+#define CHECK_SOURCE_LIMIT(index) UPRV_BLOCK_MACRO_BEGIN { \
+ if (args->source+index > args->sourceLimit) { \
+ *err = U_TRUNCATED_CHAR_FOUND; \
+ args->source = args->sourceLimit; \
+ return 0xffff; \
+ } \
+} UPRV_BLOCK_MACRO_END
+
+/* Return the Unicode representation for the current LMBCS character */
+
+static UChar32 U_CALLCONV
+_LMBCSGetNextUCharWorker(UConverterToUnicodeArgs* args,
+ UErrorCode* err)
+{
+ UChar32 uniChar = 0; /* an output UNICODE char */
+ ulmbcs_byte_t CurByte; /* A byte from the input stream */
+
+ /* error check */
+ if (args->source >= args->sourceLimit)
+ {
+ *err = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0xffff;
+ }
+ /* Grab first byte & save address for error recovery */
+ CurByte = *((ulmbcs_byte_t *) (args->source++));
- /* we have a translation. increment source and write as much as posible to target */
- args->source++;
- pLMBCS = LMBCS;
- while (args->target < args->targetLimit && bytes_written--)
- {
- *(args->target)++ = *pLMBCS++;
- if (args->offsets)
- {
- *(args->offsets)++ = sourceIndex;
- }
- }
- sourceIndex++;
- if (bytes_written > 0)
- {
- /* write any bytes that didn't fit in target to the error buffer,
- common code will move this to target if we get called back with
- enough target room
- */
- uint8_t * pErrorBuffer = args->converter->charErrorBuffer;
- *err = U_BUFFER_OVERFLOW_ERROR;
- args->converter->charErrorBufferLength = (int8_t)bytes_written;
- while (bytes_written--)
- {
- *pErrorBuffer++ = *pLMBCS++;
- }
- }
- /*Fix for SPR#DJOE66JFN3 (Lotus)*/
- extraInfo->localeConverterIndex = OldConverterIndex;
- }
-}
-
-
-/* Now, the Unicode from LMBCS section */
-
-
-/* A function to call when we are looking at the Unicode group byte in LMBCS */
-static UChar
-GetUniFromLMBCSUni(char const ** ppLMBCSin) /* Called with LMBCS-style Unicode byte stream */
-{
- uint8_t HighCh = *(*ppLMBCSin)++; /* Big-endian Unicode in LMBCS compatibility group*/
- uint8_t LowCh = *(*ppLMBCSin)++;
-
- if (HighCh == ULMBCS_UNICOMPATZERO )
- {
- HighCh = LowCh;
- LowCh = 0; /* zero-byte in LSB special character */
- }
- return (UChar)((HighCh << 8) | LowCh);
-}
-
-
-
-/* CHECK_SOURCE_LIMIT: Helper macro to verify that there are at least'index'
- bytes left in source up to sourceLimit.Errors appropriately if not.
- If we reach the limit, then update the source pointer to there to consume
- all input as required by ICU converter semantics.
-*/
-
-#define CHECK_SOURCE_LIMIT(index) UPRV_BLOCK_MACRO_BEGIN { \
- if (args->source+index > args->sourceLimit) { \
- *err = U_TRUNCATED_CHAR_FOUND; \
- args->source = args->sourceLimit; \
- return 0xffff; \
- } \
-} UPRV_BLOCK_MACRO_END
-
-/* Return the Unicode representation for the current LMBCS character */
-
-static UChar32 U_CALLCONV
-_LMBCSGetNextUCharWorker(UConverterToUnicodeArgs* args,
- UErrorCode* err)
-{
- UChar32 uniChar = 0; /* an output UNICODE char */
- ulmbcs_byte_t CurByte; /* A byte from the input stream */
-
- /* error check */
- if (args->source >= args->sourceLimit)
- {
- *err = U_ILLEGAL_ARGUMENT_ERROR;
- return 0xffff;
- }
- /* Grab first byte & save address for error recovery */
- CurByte = *((ulmbcs_byte_t *) (args->source++));
-
- /*
- * at entry of each if clause:
- * 1. 'CurByte' points at the first byte of a LMBCS character
- * 2. '*source'points to the next byte of the source stream after 'CurByte'
- *
- * the job of each if clause is:
- * 1. set '*source' to point at the beginning of next char (nop if LMBCS char is only 1 byte)
- * 2. set 'uniChar' up with the right Unicode value, or set 'err' appropriately
- */
-
- /* First lets check the simple fixed values. */
-
- if(((CurByte > ULMBCS_C0END) && (CurByte < ULMBCS_C1START)) /* ascii range */
- || (CurByte == 0)
- || CurByte == ULMBCS_HT || CurByte == ULMBCS_CR
- || CurByte == ULMBCS_LF || CurByte == ULMBCS_123SYSTEMRANGE)
- {
- uniChar = CurByte;
- }
- else
- {
- UConverterDataLMBCS * extraInfo;
- ulmbcs_byte_t group;
- UConverterSharedData *cnv;
+ /*
+ * at entry of each if clause:
+ * 1. 'CurByte' points at the first byte of a LMBCS character
+ * 2. '*source'points to the next byte of the source stream after 'CurByte'
+ *
+ * the job of each if clause is:
+ * 1. set '*source' to point at the beginning of next char (nop if LMBCS char is only 1 byte)
+ * 2. set 'uniChar' up with the right Unicode value, or set 'err' appropriately
+ */
+
+ /* First lets check the simple fixed values. */
+
+ if(((CurByte > ULMBCS_C0END) && (CurByte < ULMBCS_C1START)) /* ascii range */
+ || (CurByte == 0)
+ || CurByte == ULMBCS_HT || CurByte == ULMBCS_CR
+ || CurByte == ULMBCS_LF || CurByte == ULMBCS_123SYSTEMRANGE)
+ {
+ uniChar = CurByte;
+ }
+ else
+ {
+ UConverterDataLMBCS * extraInfo;
+ ulmbcs_byte_t group;
+ UConverterSharedData *cnv;
+
+ if (CurByte == ULMBCS_GRP_CTRL) /* Control character group - no opt group update */
+ {
+ ulmbcs_byte_t C0C1byte;
+ CHECK_SOURCE_LIMIT(1);
+ C0C1byte = *(args->source)++;
+ uniChar = (C0C1byte < ULMBCS_C1START) ? C0C1byte - ULMBCS_CTRLOFFSET : C0C1byte;
+ }
+ else
+ if (CurByte == ULMBCS_GRP_UNICODE) /* Unicode compatibility group: BigEndian UTF16 */
+ {
+ CHECK_SOURCE_LIMIT(2);
+
+ /* don't check for error indicators fffe/ffff below */
+ return GetUniFromLMBCSUni(&(args->source));
+ }
+ else if (CurByte <= ULMBCS_CTRLOFFSET)
+ {
+ group = CurByte; /* group byte is in the source */
+ extraInfo = (UConverterDataLMBCS *) args->converter->extraInfo;
+ if (group > ULMBCS_GRP_LAST || (cnv = extraInfo->OptGrpConverter[group]) == NULL)
+ {
+ /* this is not a valid group byte - no converter*/
+ *err = U_INVALID_CHAR_FOUND;
+ }
+ else if (group >= ULMBCS_DOUBLEOPTGROUP_START) /* double byte conversion */
+ {
+
+ CHECK_SOURCE_LIMIT(2);
+
+ /* check for LMBCS doubled-group-byte case */
+ if (*args->source == group) {
+ /* single byte */
+ ++args->source;
+ uniChar = ucnv_MBCSSimpleGetNextUChar(cnv, args->source, 1, FALSE);
+ ++args->source;
+ } else {
+ /* double byte */
+ uniChar = ucnv_MBCSSimpleGetNextUChar(cnv, args->source, 2, FALSE);
+ args->source += 2;
+ }
+ }
+ else { /* single byte conversion */
+ CHECK_SOURCE_LIMIT(1);
+ CurByte = *(args->source)++;
+
+ if (CurByte >= ULMBCS_C1START)
+ {
+ uniChar = _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP(cnv, CurByte);
+ }
+ else
+ {
+ /* The non-optimizable oddballs where there is an explicit byte
+ * AND the second byte is not in the upper ascii range
+ */
+ char bytes[2];
+
+ extraInfo = (UConverterDataLMBCS *) args->converter->extraInfo;
+ cnv = extraInfo->OptGrpConverter [ULMBCS_GRP_EXCEPT];
+
+ /* Lookup value must include opt group */
+ bytes[0] = group;
+ bytes[1] = CurByte;
+ uniChar = ucnv_MBCSSimpleGetNextUChar(cnv, bytes, 2, FALSE);
+ }
+ }
+ }
+ else if (CurByte >= ULMBCS_C1START) /* group byte is implicit */
+ {
+ extraInfo = (UConverterDataLMBCS *) args->converter->extraInfo;
+ group = extraInfo->OptGroup;
+ cnv = extraInfo->OptGrpConverter[group];
+ if (group >= ULMBCS_DOUBLEOPTGROUP_START) /* double byte conversion */
+ {
+ if (!ucnv_MBCSIsLeadByte(cnv, CurByte))
+ {
+ CHECK_SOURCE_LIMIT(0);
+
+ /* let the MBCS conversion consume CurByte again */
+ uniChar = ucnv_MBCSSimpleGetNextUChar(cnv, args->source - 1, 1, FALSE);
+ }
+ else
+ {
+ CHECK_SOURCE_LIMIT(1);
+ /* let the MBCS conversion consume CurByte again */
+ uniChar = ucnv_MBCSSimpleGetNextUChar(cnv, args->source - 1, 2, FALSE);
+ ++args->source;
+ }
+ }
+ else /* single byte conversion */
+ {
+ uniChar = _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP(cnv, CurByte);
+ }
+ }
+ }
+ return uniChar;
+}
+
+
+/* The exported function that converts lmbcs to one or more
+ UChars - currently UTF-16
+*/
+static void U_CALLCONV
+_LMBCSToUnicodeWithOffsets(UConverterToUnicodeArgs* args,
+ UErrorCode* err)
+{
+ char LMBCS [ULMBCS_CHARSIZE_MAX];
+ UChar uniChar; /* one output UNICODE char */
+ const char * saveSource; /* beginning of current code point */
+ const char * pStartLMBCS = args->source; /* beginning of whole string */
+ const char * errSource = NULL; /* pointer to actual input in case an error occurs */
+ int8_t savebytes = 0;
+
+ /* Process from source to limit, or until error */
+ while (U_SUCCESS(*err) && args->sourceLimit > args->source && args->targetLimit > args->target)
+ {
+ saveSource = args->source; /* beginning of current code point */
+
+ if (args->converter->toULength) /* reassemble char from previous call */
+ {
+ const char *saveSourceLimit;
+ size_t size_old = args->converter->toULength;
+
+ /* limit from source is either remainder of temp buffer, or user limit on source */
+ size_t size_new_maybe_1 = sizeof(LMBCS) - size_old;
+ size_t size_new_maybe_2 = args->sourceLimit - args->source;
+ size_t size_new = (size_new_maybe_1 < size_new_maybe_2) ? size_new_maybe_1 : size_new_maybe_2;
- if (CurByte == ULMBCS_GRP_CTRL) /* Control character group - no opt group update */
- {
- ulmbcs_byte_t C0C1byte;
- CHECK_SOURCE_LIMIT(1);
- C0C1byte = *(args->source)++;
- uniChar = (C0C1byte < ULMBCS_C1START) ? C0C1byte - ULMBCS_CTRLOFFSET : C0C1byte;
- }
- else
- if (CurByte == ULMBCS_GRP_UNICODE) /* Unicode compatibility group: BigEndian UTF16 */
- {
- CHECK_SOURCE_LIMIT(2);
- /* don't check for error indicators fffe/ffff below */
- return GetUniFromLMBCSUni(&(args->source));
- }
- else if (CurByte <= ULMBCS_CTRLOFFSET)
- {
- group = CurByte; /* group byte is in the source */
- extraInfo = (UConverterDataLMBCS *) args->converter->extraInfo;
- if (group > ULMBCS_GRP_LAST || (cnv = extraInfo->OptGrpConverter[group]) == NULL)
- {
- /* this is not a valid group byte - no converter*/
- *err = U_INVALID_CHAR_FOUND;
- }
- else if (group >= ULMBCS_DOUBLEOPTGROUP_START) /* double byte conversion */
- {
-
- CHECK_SOURCE_LIMIT(2);
-
- /* check for LMBCS doubled-group-byte case */
- if (*args->source == group) {
- /* single byte */
- ++args->source;
- uniChar = ucnv_MBCSSimpleGetNextUChar(cnv, args->source, 1, FALSE);
- ++args->source;
- } else {
- /* double byte */
- uniChar = ucnv_MBCSSimpleGetNextUChar(cnv, args->source, 2, FALSE);
- args->source += 2;
- }
- }
- else { /* single byte conversion */
- CHECK_SOURCE_LIMIT(1);
- CurByte = *(args->source)++;
-
- if (CurByte >= ULMBCS_C1START)
- {
- uniChar = _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP(cnv, CurByte);
- }
- else
- {
- /* The non-optimizable oddballs where there is an explicit byte
- * AND the second byte is not in the upper ascii range
- */
- char bytes[2];
-
- extraInfo = (UConverterDataLMBCS *) args->converter->extraInfo;
- cnv = extraInfo->OptGrpConverter [ULMBCS_GRP_EXCEPT];
-
- /* Lookup value must include opt group */
- bytes[0] = group;
- bytes[1] = CurByte;
- uniChar = ucnv_MBCSSimpleGetNextUChar(cnv, bytes, 2, FALSE);
- }
- }
- }
- else if (CurByte >= ULMBCS_C1START) /* group byte is implicit */
- {
- extraInfo = (UConverterDataLMBCS *) args->converter->extraInfo;
- group = extraInfo->OptGroup;
- cnv = extraInfo->OptGrpConverter[group];
- if (group >= ULMBCS_DOUBLEOPTGROUP_START) /* double byte conversion */
- {
- if (!ucnv_MBCSIsLeadByte(cnv, CurByte))
- {
- CHECK_SOURCE_LIMIT(0);
-
- /* let the MBCS conversion consume CurByte again */
- uniChar = ucnv_MBCSSimpleGetNextUChar(cnv, args->source - 1, 1, FALSE);
- }
- else
- {
- CHECK_SOURCE_LIMIT(1);
- /* let the MBCS conversion consume CurByte again */
- uniChar = ucnv_MBCSSimpleGetNextUChar(cnv, args->source - 1, 2, FALSE);
- ++args->source;
- }
- }
- else /* single byte conversion */
- {
- uniChar = _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP(cnv, CurByte);
- }
- }
- }
- return uniChar;
-}
-
-
-/* The exported function that converts lmbcs to one or more
- UChars - currently UTF-16
-*/
-static void U_CALLCONV
-_LMBCSToUnicodeWithOffsets(UConverterToUnicodeArgs* args,
- UErrorCode* err)
-{
- char LMBCS [ULMBCS_CHARSIZE_MAX];
- UChar uniChar; /* one output UNICODE char */
- const char * saveSource; /* beginning of current code point */
- const char * pStartLMBCS = args->source; /* beginning of whole string */
- const char * errSource = NULL; /* pointer to actual input in case an error occurs */
- int8_t savebytes = 0;
-
- /* Process from source to limit, or until error */
- while (U_SUCCESS(*err) && args->sourceLimit > args->source && args->targetLimit > args->target)
- {
- saveSource = args->source; /* beginning of current code point */
-
- if (args->converter->toULength) /* reassemble char from previous call */
- {
- const char *saveSourceLimit;
- size_t size_old = args->converter->toULength;
-
- /* limit from source is either remainder of temp buffer, or user limit on source */
- size_t size_new_maybe_1 = sizeof(LMBCS) - size_old;
- size_t size_new_maybe_2 = args->sourceLimit - args->source;
- size_t size_new = (size_new_maybe_1 < size_new_maybe_2) ? size_new_maybe_1 : size_new_maybe_2;
-
-
- uprv_memcpy(LMBCS, args->converter->toUBytes, size_old);
- uprv_memcpy(LMBCS + size_old, args->source, size_new);
- saveSourceLimit = args->sourceLimit;
- args->source = errSource = LMBCS;
- args->sourceLimit = LMBCS+size_old+size_new;
- savebytes = (int8_t)(size_old+size_new);
- uniChar = (UChar) _LMBCSGetNextUCharWorker(args, err);
- args->source = saveSource + ((args->source - LMBCS) - size_old);
- args->sourceLimit = saveSourceLimit;
-
- if (*err == U_TRUNCATED_CHAR_FOUND)
- {
- /* evil special case: source buffers so small a char spans more than 2 buffers */
- args->converter->toULength = savebytes;
- uprv_memcpy(args->converter->toUBytes, LMBCS, savebytes);
- args->source = args->sourceLimit;
- *err = U_ZERO_ERROR;
- return;
- }
- else
- {
- /* clear the partial-char marker */
- args->converter->toULength = 0;
- }
- }
- else
- {
- errSource = saveSource;
- uniChar = (UChar) _LMBCSGetNextUCharWorker(args, err);
- savebytes = (int8_t)(args->source - saveSource);
- }
- if (U_SUCCESS(*err))
- {
- if (uniChar < 0xfffe)
- {
- *(args->target)++ = uniChar;
- if(args->offsets)
- {
- *(args->offsets)++ = (int32_t)(saveSource - pStartLMBCS);
- }
- }
- else if (uniChar == 0xfffe)
- {
- *err = U_INVALID_CHAR_FOUND;
- }
- else /* if (uniChar == 0xffff) */
- {
- *err = U_ILLEGAL_CHAR_FOUND;
- }
- }
- }
- /* if target ran out before source, return U_BUFFER_OVERFLOW_ERROR */
- if (U_SUCCESS(*err) && args->sourceLimit > args->source && args->targetLimit <= args->target)
- {
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
- else if (U_FAILURE(*err))
- {
- /* If character incomplete or unmappable/illegal, store it in toUBytes[] */
- args->converter->toULength = savebytes;
- if (savebytes > 0) {
- uprv_memcpy(args->converter->toUBytes, errSource, savebytes);
- }
- if (*err == U_TRUNCATED_CHAR_FOUND) {
- *err = U_ZERO_ERROR;
- }
- }
-}
-
-/* And now, the macroized declarations of data & functions: */
-DEFINE_LMBCS_OPEN(1)
-DEFINE_LMBCS_OPEN(2)
-DEFINE_LMBCS_OPEN(3)
-DEFINE_LMBCS_OPEN(4)
-DEFINE_LMBCS_OPEN(5)
-DEFINE_LMBCS_OPEN(6)
-DEFINE_LMBCS_OPEN(8)
-DEFINE_LMBCS_OPEN(11)
-DEFINE_LMBCS_OPEN(16)
-DEFINE_LMBCS_OPEN(17)
-DEFINE_LMBCS_OPEN(18)
-DEFINE_LMBCS_OPEN(19)
-
-
-DECLARE_LMBCS_DATA(1)
-DECLARE_LMBCS_DATA(2)
-DECLARE_LMBCS_DATA(3)
-DECLARE_LMBCS_DATA(4)
-DECLARE_LMBCS_DATA(5)
-DECLARE_LMBCS_DATA(6)
-DECLARE_LMBCS_DATA(8)
-DECLARE_LMBCS_DATA(11)
-DECLARE_LMBCS_DATA(16)
-DECLARE_LMBCS_DATA(17)
-DECLARE_LMBCS_DATA(18)
-DECLARE_LMBCS_DATA(19)
-
-U_CDECL_END
-
-#endif /* #if !UCONFIG_NO_LEGACY_CONVERSION */
+ uprv_memcpy(LMBCS, args->converter->toUBytes, size_old);
+ uprv_memcpy(LMBCS + size_old, args->source, size_new);
+ saveSourceLimit = args->sourceLimit;
+ args->source = errSource = LMBCS;
+ args->sourceLimit = LMBCS+size_old+size_new;
+ savebytes = (int8_t)(size_old+size_new);
+ uniChar = (UChar) _LMBCSGetNextUCharWorker(args, err);
+ args->source = saveSource + ((args->source - LMBCS) - size_old);
+ args->sourceLimit = saveSourceLimit;
+
+ if (*err == U_TRUNCATED_CHAR_FOUND)
+ {
+ /* evil special case: source buffers so small a char spans more than 2 buffers */
+ args->converter->toULength = savebytes;
+ uprv_memcpy(args->converter->toUBytes, LMBCS, savebytes);
+ args->source = args->sourceLimit;
+ *err = U_ZERO_ERROR;
+ return;
+ }
+ else
+ {
+ /* clear the partial-char marker */
+ args->converter->toULength = 0;
+ }
+ }
+ else
+ {
+ errSource = saveSource;
+ uniChar = (UChar) _LMBCSGetNextUCharWorker(args, err);
+ savebytes = (int8_t)(args->source - saveSource);
+ }
+ if (U_SUCCESS(*err))
+ {
+ if (uniChar < 0xfffe)
+ {
+ *(args->target)++ = uniChar;
+ if(args->offsets)
+ {
+ *(args->offsets)++ = (int32_t)(saveSource - pStartLMBCS);
+ }
+ }
+ else if (uniChar == 0xfffe)
+ {
+ *err = U_INVALID_CHAR_FOUND;
+ }
+ else /* if (uniChar == 0xffff) */
+ {
+ *err = U_ILLEGAL_CHAR_FOUND;
+ }
+ }
+ }
+ /* if target ran out before source, return U_BUFFER_OVERFLOW_ERROR */
+ if (U_SUCCESS(*err) && args->sourceLimit > args->source && args->targetLimit <= args->target)
+ {
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+ else if (U_FAILURE(*err))
+ {
+ /* If character incomplete or unmappable/illegal, store it in toUBytes[] */
+ args->converter->toULength = savebytes;
+ if (savebytes > 0) {
+ uprv_memcpy(args->converter->toUBytes, errSource, savebytes);
+ }
+ if (*err == U_TRUNCATED_CHAR_FOUND) {
+ *err = U_ZERO_ERROR;
+ }
+ }
+}
+
+/* And now, the macroized declarations of data & functions: */
+DEFINE_LMBCS_OPEN(1)
+DEFINE_LMBCS_OPEN(2)
+DEFINE_LMBCS_OPEN(3)
+DEFINE_LMBCS_OPEN(4)
+DEFINE_LMBCS_OPEN(5)
+DEFINE_LMBCS_OPEN(6)
+DEFINE_LMBCS_OPEN(8)
+DEFINE_LMBCS_OPEN(11)
+DEFINE_LMBCS_OPEN(16)
+DEFINE_LMBCS_OPEN(17)
+DEFINE_LMBCS_OPEN(18)
+DEFINE_LMBCS_OPEN(19)
+
+
+DECLARE_LMBCS_DATA(1)
+DECLARE_LMBCS_DATA(2)
+DECLARE_LMBCS_DATA(3)
+DECLARE_LMBCS_DATA(4)
+DECLARE_LMBCS_DATA(5)
+DECLARE_LMBCS_DATA(6)
+DECLARE_LMBCS_DATA(8)
+DECLARE_LMBCS_DATA(11)
+DECLARE_LMBCS_DATA(16)
+DECLARE_LMBCS_DATA(17)
+DECLARE_LMBCS_DATA(18)
+DECLARE_LMBCS_DATA(19)
+
+U_CDECL_END
+
+#endif /* #if !UCONFIG_NO_LEGACY_CONVERSION */
diff --git a/contrib/libs/icu/common/ucnv_set.cpp b/contrib/libs/icu/common/ucnv_set.cpp
index ea6d8eca9c..926cee0de8 100644
--- a/contrib/libs/icu/common/ucnv_set.cpp
+++ b/contrib/libs/icu/common/ucnv_set.cpp
@@ -1,70 +1,70 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-*******************************************************************************
-*
-* Copyright (C) 2003-2007, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-*******************************************************************************
-* file name: ucnv_set.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 2004sep07
-* created by: Markus W. Scherer
-*
-* Conversion API functions using USet (ucnv_getUnicodeSet())
-* moved here from ucnv.c for removing the dependency of other ucnv_
-* implementation functions on the USet implementation.
-*/
-
-#include "unicode/utypes.h"
-#include "unicode/uset.h"
-#include "unicode/ucnv.h"
-#include "ucnv_bld.h"
-#include "uset_imp.h"
-
-#if !UCONFIG_NO_CONVERSION
-
-U_CAPI void U_EXPORT2
-ucnv_getUnicodeSet(const UConverter *cnv,
- USet *setFillIn,
- UConverterUnicodeSet whichSet,
- UErrorCode *pErrorCode) {
- /* argument checking */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return;
- }
- if(cnv==NULL || setFillIn==NULL || whichSet<UCNV_ROUNDTRIP_SET || UCNV_SET_COUNT<=whichSet) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- /* does this converter support this function? */
- if(cnv->sharedData->impl->getUnicodeSet==NULL) {
- *pErrorCode=U_UNSUPPORTED_ERROR;
- return;
- }
-
- {
- USetAdder sa={
- NULL,
- uset_add,
- uset_addRange,
- uset_addString,
- uset_remove,
- uset_removeRange
- };
- sa.set=setFillIn;
-
- /* empty the set */
- uset_clear(setFillIn);
-
- /* call the converter to add the code points it supports */
- cnv->sharedData->impl->getUnicodeSet(cnv, &sa, whichSet, pErrorCode);
- }
-}
-
-#endif
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+* Copyright (C) 2003-2007, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: ucnv_set.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2004sep07
+* created by: Markus W. Scherer
+*
+* Conversion API functions using USet (ucnv_getUnicodeSet())
+* moved here from ucnv.c for removing the dependency of other ucnv_
+* implementation functions on the USet implementation.
+*/
+
+#include "unicode/utypes.h"
+#include "unicode/uset.h"
+#include "unicode/ucnv.h"
+#include "ucnv_bld.h"
+#include "uset_imp.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+U_CAPI void U_EXPORT2
+ucnv_getUnicodeSet(const UConverter *cnv,
+ USet *setFillIn,
+ UConverterUnicodeSet whichSet,
+ UErrorCode *pErrorCode) {
+ /* argument checking */
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return;
+ }
+ if(cnv==NULL || setFillIn==NULL || whichSet<UCNV_ROUNDTRIP_SET || UCNV_SET_COUNT<=whichSet) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ /* does this converter support this function? */
+ if(cnv->sharedData->impl->getUnicodeSet==NULL) {
+ *pErrorCode=U_UNSUPPORTED_ERROR;
+ return;
+ }
+
+ {
+ USetAdder sa={
+ NULL,
+ uset_add,
+ uset_addRange,
+ uset_addString,
+ uset_remove,
+ uset_removeRange
+ };
+ sa.set=setFillIn;
+
+ /* empty the set */
+ uset_clear(setFillIn);
+
+ /* call the converter to add the code points it supports */
+ cnv->sharedData->impl->getUnicodeSet(cnv, &sa, whichSet, pErrorCode);
+ }
+}
+
+#endif
diff --git a/contrib/libs/icu/common/ucnv_u16.cpp b/contrib/libs/icu/common/ucnv_u16.cpp
index 0f76feb25e..a5e8367400 100644
--- a/contrib/libs/icu/common/ucnv_u16.cpp
+++ b/contrib/libs/icu/common/ucnv_u16.cpp
@@ -1,1579 +1,1579 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-**********************************************************************
-* Copyright (C) 2002-2015, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
-* file name: ucnv_u16.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 2002jul01
-* created by: Markus W. Scherer
-*
-* UTF-16 converter implementation. Used to be in ucnv_utf.c.
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_CONVERSION
-
-#include "unicode/ucnv.h"
-#include "unicode/uversion.h"
-#include "ucnv_bld.h"
-#include "ucnv_cnv.h"
-#include "cmemory.h"
-
-enum {
- UCNV_NEED_TO_WRITE_BOM=1
-};
-
-U_CDECL_BEGIN
-/*
- * The UTF-16 toUnicode implementation is also used for the Java-specific
- * "with BOM" variants of UTF-16BE and UTF-16LE.
- */
-static void U_CALLCONV
-_UTF16ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
- UErrorCode *pErrorCode);
-
-/* UTF-16BE ----------------------------------------------------------------- */
-
-#if U_IS_BIG_ENDIAN
-# define _UTF16PEFromUnicodeWithOffsets _UTF16BEFromUnicodeWithOffsets
-#else
-# define _UTF16PEFromUnicodeWithOffsets _UTF16LEFromUnicodeWithOffsets
-#endif
-
-
-static void U_CALLCONV
-_UTF16BEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- UConverter *cnv;
- const UChar *source;
- char *target;
- int32_t *offsets;
-
- uint32_t targetCapacity, length, sourceIndex;
- UChar c, trail;
- char overflow[4];
-
- source=pArgs->source;
- length=(int32_t)(pArgs->sourceLimit-source);
- if(length<=0) {
- /* no input, nothing to do */
- return;
- }
-
- cnv=pArgs->converter;
-
- /* write the BOM if necessary */
- if(cnv->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) {
- static const char bom[]={ (char)0xfeu, (char)0xffu };
- ucnv_fromUWriteBytes(cnv,
- bom, 2,
- &pArgs->target, pArgs->targetLimit,
- &pArgs->offsets, -1,
- pErrorCode);
- cnv->fromUnicodeStatus=0;
- }
-
- target=pArgs->target;
- if(target >= pArgs->targetLimit) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- return;
- }
-
- targetCapacity=(uint32_t)(pArgs->targetLimit-target);
- offsets=pArgs->offsets;
- sourceIndex=0;
-
- /* c!=0 indicates in several places outside the main loops that a surrogate was found */
-
- if((c=(UChar)cnv->fromUChar32)!=0 && U16_IS_TRAIL(trail=*source) && targetCapacity>=4) {
- /* the last buffer ended with a lead surrogate, output the surrogate pair */
- ++source;
- --length;
- target[0]=(uint8_t)(c>>8);
- target[1]=(uint8_t)c;
- target[2]=(uint8_t)(trail>>8);
- target[3]=(uint8_t)trail;
- target+=4;
- targetCapacity-=4;
- if(offsets!=NULL) {
- *offsets++=-1;
- *offsets++=-1;
- *offsets++=-1;
- *offsets++=-1;
- }
- sourceIndex=1;
- cnv->fromUChar32=c=0;
- }
-
- if(c==0) {
- /* copy an even number of bytes for complete UChars */
- uint32_t count=2*length;
- if(count>targetCapacity) {
- count=targetCapacity&~1;
- }
- /* count is even */
- targetCapacity-=count;
- count>>=1;
- length-=count;
-
- if(offsets==NULL) {
- while(count>0) {
- c=*source++;
- if(U16_IS_SINGLE(c)) {
- target[0]=(uint8_t)(c>>8);
- target[1]=(uint8_t)c;
- target+=2;
- } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 && U16_IS_TRAIL(trail=*source)) {
- ++source;
- --count;
- target[0]=(uint8_t)(c>>8);
- target[1]=(uint8_t)c;
- target[2]=(uint8_t)(trail>>8);
- target[3]=(uint8_t)trail;
- target+=4;
- } else {
- break;
- }
- --count;
- }
- } else {
- while(count>0) {
- c=*source++;
- if(U16_IS_SINGLE(c)) {
- target[0]=(uint8_t)(c>>8);
- target[1]=(uint8_t)c;
- target+=2;
- *offsets++=sourceIndex;
- *offsets++=sourceIndex++;
- } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 && U16_IS_TRAIL(trail=*source)) {
- ++source;
- --count;
- target[0]=(uint8_t)(c>>8);
- target[1]=(uint8_t)c;
- target[2]=(uint8_t)(trail>>8);
- target[3]=(uint8_t)trail;
- target+=4;
- *offsets++=sourceIndex;
- *offsets++=sourceIndex;
- *offsets++=sourceIndex;
- *offsets++=sourceIndex;
- sourceIndex+=2;
- } else {
- break;
- }
- --count;
- }
- }
-
- if(count==0) {
- /* done with the loop for complete UChars */
- if(length>0 && targetCapacity>0) {
- /*
- * there is more input and some target capacity -
- * it must be targetCapacity==1 because otherwise
- * the above would have copied more;
- * prepare for overflow output
- */
- if(U16_IS_SINGLE(c=*source++)) {
- overflow[0]=(char)(c>>8);
- overflow[1]=(char)c;
- length=2; /* 2 bytes to output */
- c=0;
- /* } else { keep c for surrogate handling, length will be set there */
- }
- } else {
- length=0;
- c=0;
- }
- } else {
- /* keep c for surrogate handling, length will be set there */
- targetCapacity+=2*count;
- }
- } else {
- length=0; /* from here on, length counts the bytes in overflow[] */
- }
-
- if(c!=0) {
- /*
- * c is a surrogate, and
- * - source or target too short
- * - or the surrogate is unmatched
- */
- length=0;
- if(U16_IS_SURROGATE_LEAD(c)) {
- if(source<pArgs->sourceLimit) {
- if(U16_IS_TRAIL(trail=*source)) {
- /* output the surrogate pair, will overflow (see conditions comment above) */
- ++source;
- overflow[0]=(char)(c>>8);
- overflow[1]=(char)c;
- overflow[2]=(char)(trail>>8);
- overflow[3]=(char)trail;
- length=4; /* 4 bytes to output */
- c=0;
- } else {
- /* unmatched lead surrogate */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- }
- } else {
- /* see if the trail surrogate is in the next buffer */
- }
- } else {
- /* unmatched trail surrogate */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- }
- cnv->fromUChar32=c;
- }
-
- if(length>0) {
- /* output length bytes with overflow (length>targetCapacity>0) */
- ucnv_fromUWriteBytes(cnv,
- overflow, length,
- (char **)&target, pArgs->targetLimit,
- &offsets, sourceIndex,
- pErrorCode);
- targetCapacity=(uint32_t)(pArgs->targetLimit-(char *)target);
- }
-
- if(U_SUCCESS(*pErrorCode) && source<pArgs->sourceLimit && targetCapacity==0) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
-
- /* write back the updated pointers */
- pArgs->source=source;
- pArgs->target=(char *)target;
- pArgs->offsets=offsets;
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+**********************************************************************
+* Copyright (C) 2002-2015, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* file name: ucnv_u16.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2002jul01
+* created by: Markus W. Scherer
+*
+* UTF-16 converter implementation. Used to be in ucnv_utf.c.
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "unicode/ucnv.h"
+#include "unicode/uversion.h"
+#include "ucnv_bld.h"
+#include "ucnv_cnv.h"
+#include "cmemory.h"
+
+enum {
+ UCNV_NEED_TO_WRITE_BOM=1
+};
+
+U_CDECL_BEGIN
+/*
+ * The UTF-16 toUnicode implementation is also used for the Java-specific
+ * "with BOM" variants of UTF-16BE and UTF-16LE.
+ */
+static void U_CALLCONV
+_UTF16ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode);
+
+/* UTF-16BE ----------------------------------------------------------------- */
+
+#if U_IS_BIG_ENDIAN
+# define _UTF16PEFromUnicodeWithOffsets _UTF16BEFromUnicodeWithOffsets
+#else
+# define _UTF16PEFromUnicodeWithOffsets _UTF16LEFromUnicodeWithOffsets
+#endif
+
+
+static void U_CALLCONV
+_UTF16BEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ UConverter *cnv;
+ const UChar *source;
+ char *target;
+ int32_t *offsets;
+
+ uint32_t targetCapacity, length, sourceIndex;
+ UChar c, trail;
+ char overflow[4];
+
+ source=pArgs->source;
+ length=(int32_t)(pArgs->sourceLimit-source);
+ if(length<=0) {
+ /* no input, nothing to do */
+ return;
+ }
+
+ cnv=pArgs->converter;
+
+ /* write the BOM if necessary */
+ if(cnv->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) {
+ static const char bom[]={ (char)0xfeu, (char)0xffu };
+ ucnv_fromUWriteBytes(cnv,
+ bom, 2,
+ &pArgs->target, pArgs->targetLimit,
+ &pArgs->offsets, -1,
+ pErrorCode);
+ cnv->fromUnicodeStatus=0;
+ }
+
+ target=pArgs->target;
+ if(target >= pArgs->targetLimit) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ return;
+ }
+
+ targetCapacity=(uint32_t)(pArgs->targetLimit-target);
+ offsets=pArgs->offsets;
+ sourceIndex=0;
+
+ /* c!=0 indicates in several places outside the main loops that a surrogate was found */
+
+ if((c=(UChar)cnv->fromUChar32)!=0 && U16_IS_TRAIL(trail=*source) && targetCapacity>=4) {
+ /* the last buffer ended with a lead surrogate, output the surrogate pair */
+ ++source;
+ --length;
+ target[0]=(uint8_t)(c>>8);
+ target[1]=(uint8_t)c;
+ target[2]=(uint8_t)(trail>>8);
+ target[3]=(uint8_t)trail;
+ target+=4;
+ targetCapacity-=4;
+ if(offsets!=NULL) {
+ *offsets++=-1;
+ *offsets++=-1;
+ *offsets++=-1;
+ *offsets++=-1;
+ }
+ sourceIndex=1;
+ cnv->fromUChar32=c=0;
+ }
+
+ if(c==0) {
+ /* copy an even number of bytes for complete UChars */
+ uint32_t count=2*length;
+ if(count>targetCapacity) {
+ count=targetCapacity&~1;
+ }
+ /* count is even */
+ targetCapacity-=count;
+ count>>=1;
+ length-=count;
+
+ if(offsets==NULL) {
+ while(count>0) {
+ c=*source++;
+ if(U16_IS_SINGLE(c)) {
+ target[0]=(uint8_t)(c>>8);
+ target[1]=(uint8_t)c;
+ target+=2;
+ } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 && U16_IS_TRAIL(trail=*source)) {
+ ++source;
+ --count;
+ target[0]=(uint8_t)(c>>8);
+ target[1]=(uint8_t)c;
+ target[2]=(uint8_t)(trail>>8);
+ target[3]=(uint8_t)trail;
+ target+=4;
+ } else {
+ break;
+ }
+ --count;
+ }
+ } else {
+ while(count>0) {
+ c=*source++;
+ if(U16_IS_SINGLE(c)) {
+ target[0]=(uint8_t)(c>>8);
+ target[1]=(uint8_t)c;
+ target+=2;
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex++;
+ } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 && U16_IS_TRAIL(trail=*source)) {
+ ++source;
+ --count;
+ target[0]=(uint8_t)(c>>8);
+ target[1]=(uint8_t)c;
+ target[2]=(uint8_t)(trail>>8);
+ target[3]=(uint8_t)trail;
+ target+=4;
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex;
+ sourceIndex+=2;
+ } else {
+ break;
+ }
+ --count;
+ }
+ }
+
+ if(count==0) {
+ /* done with the loop for complete UChars */
+ if(length>0 && targetCapacity>0) {
+ /*
+ * there is more input and some target capacity -
+ * it must be targetCapacity==1 because otherwise
+ * the above would have copied more;
+ * prepare for overflow output
+ */
+ if(U16_IS_SINGLE(c=*source++)) {
+ overflow[0]=(char)(c>>8);
+ overflow[1]=(char)c;
+ length=2; /* 2 bytes to output */
+ c=0;
+ /* } else { keep c for surrogate handling, length will be set there */
+ }
+ } else {
+ length=0;
+ c=0;
+ }
+ } else {
+ /* keep c for surrogate handling, length will be set there */
+ targetCapacity+=2*count;
+ }
+ } else {
+ length=0; /* from here on, length counts the bytes in overflow[] */
+ }
+
+ if(c!=0) {
+ /*
+ * c is a surrogate, and
+ * - source or target too short
+ * - or the surrogate is unmatched
+ */
+ length=0;
+ if(U16_IS_SURROGATE_LEAD(c)) {
+ if(source<pArgs->sourceLimit) {
+ if(U16_IS_TRAIL(trail=*source)) {
+ /* output the surrogate pair, will overflow (see conditions comment above) */
+ ++source;
+ overflow[0]=(char)(c>>8);
+ overflow[1]=(char)c;
+ overflow[2]=(char)(trail>>8);
+ overflow[3]=(char)trail;
+ length=4; /* 4 bytes to output */
+ c=0;
+ } else {
+ /* unmatched lead surrogate */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ }
+ } else {
+ /* see if the trail surrogate is in the next buffer */
+ }
+ } else {
+ /* unmatched trail surrogate */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ }
+ cnv->fromUChar32=c;
+ }
+
+ if(length>0) {
+ /* output length bytes with overflow (length>targetCapacity>0) */
+ ucnv_fromUWriteBytes(cnv,
+ overflow, length,
+ (char **)&target, pArgs->targetLimit,
+ &offsets, sourceIndex,
+ pErrorCode);
+ targetCapacity=(uint32_t)(pArgs->targetLimit-(char *)target);
+ }
+
+ if(U_SUCCESS(*pErrorCode) && source<pArgs->sourceLimit && targetCapacity==0) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+
+ /* write back the updated pointers */
+ pArgs->source=source;
+ pArgs->target=(char *)target;
+ pArgs->offsets=offsets;
+}
+
+static void U_CALLCONV
+_UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ UConverter *cnv;
+ const uint8_t *source;
+ UChar *target;
+ int32_t *offsets;
+
+ uint32_t targetCapacity, length, count, sourceIndex;
+ UChar c, trail;
+
+ if(pArgs->converter->mode<8) {
+ _UTF16ToUnicodeWithOffsets(pArgs, pErrorCode);
+ return;
+ }
+
+ cnv=pArgs->converter;
+ source=(const uint8_t *)pArgs->source;
+ length=(int32_t)((const uint8_t *)pArgs->sourceLimit-source);
+ if(length<=0 && cnv->toUnicodeStatus==0) {
+ /* no input, nothing to do */
+ return;
+ }
+
+ target=pArgs->target;
+ if(target >= pArgs->targetLimit) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ return;
+ }
+
+ targetCapacity=(uint32_t)(pArgs->targetLimit-target);
+ offsets=pArgs->offsets;
+ sourceIndex=0;
+ c=0;
+
+ /* complete a partial UChar or pair from the last call */
+ if(cnv->toUnicodeStatus!=0) {
+ /*
+ * special case: single byte from a previous buffer,
+ * where the byte turned out not to belong to a trail surrogate
+ * and the preceding, unmatched lead surrogate was put into toUBytes[]
+ * for error handling
+ */
+ cnv->toUBytes[0]=(uint8_t)cnv->toUnicodeStatus;
+ cnv->toULength=1;
+ cnv->toUnicodeStatus=0;
+ }
+ if((count=cnv->toULength)!=0) {
+ uint8_t *p=cnv->toUBytes;
+ do {
+ p[count++]=*source++;
+ ++sourceIndex;
+ --length;
+ if(count==2) {
+ c=((UChar)p[0]<<8)|p[1];
+ if(U16_IS_SINGLE(c)) {
+ /* output the BMP code point */
+ *target++=c;
+ if(offsets!=NULL) {
+ *offsets++=-1;
+ }
+ --targetCapacity;
+ count=0;
+ c=0;
+ break;
+ } else if(U16_IS_SURROGATE_LEAD(c)) {
+ /* continue collecting bytes for the trail surrogate */
+ c=0; /* avoid unnecessary surrogate handling below */
+ } else {
+ /* fall through to error handling for an unmatched trail surrogate */
+ break;
+ }
+ } else if(count==4) {
+ c=((UChar)p[0]<<8)|p[1];
+ trail=((UChar)p[2]<<8)|p[3];
+ if(U16_IS_TRAIL(trail)) {
+ /* output the surrogate pair */
+ *target++=c;
+ if(targetCapacity>=2) {
+ *target++=trail;
+ if(offsets!=NULL) {
+ *offsets++=-1;
+ *offsets++=-1;
+ }
+ targetCapacity-=2;
+ } else /* targetCapacity==1 */ {
+ targetCapacity=0;
+ cnv->UCharErrorBuffer[0]=trail;
+ cnv->UCharErrorBufferLength=1;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ count=0;
+ c=0;
+ break;
+ } else {
+ /* unmatched lead surrogate, handle here for consistent toUBytes[] */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+
+ /* back out reading the code unit after it */
+ if(((const uint8_t *)pArgs->source-source)>=2) {
+ source-=2;
+ } else {
+ /*
+ * if the trail unit's first byte was in a previous buffer, then
+ * we need to put it into a special place because toUBytes[] will be
+ * used for the lead unit's bytes
+ */
+ cnv->toUnicodeStatus=0x100|p[2];
+ --source;
+ }
+ cnv->toULength=2;
+
+ /* write back the updated pointers */
+ pArgs->source=(const char *)source;
+ pArgs->target=target;
+ pArgs->offsets=offsets;
+ return;
+ }
+ }
+ } while(length>0);
+ cnv->toULength=(int8_t)count;
+ }
+
+ /* copy an even number of bytes for complete UChars */
+ count=2*targetCapacity;
+ if(count>length) {
+ count=length&~1;
+ }
+ if(c==0 && count>0) {
+ length-=count;
+ count>>=1;
+ targetCapacity-=count;
+ if(offsets==NULL) {
+ do {
+ c=((UChar)source[0]<<8)|source[1];
+ source+=2;
+ if(U16_IS_SINGLE(c)) {
+ *target++=c;
+ } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 &&
+ U16_IS_TRAIL(trail=((UChar)source[0]<<8)|source[1])
+ ) {
+ source+=2;
+ --count;
+ *target++=c;
+ *target++=trail;
+ } else {
+ break;
+ }
+ } while(--count>0);
+ } else {
+ do {
+ c=((UChar)source[0]<<8)|source[1];
+ source+=2;
+ if(U16_IS_SINGLE(c)) {
+ *target++=c;
+ *offsets++=sourceIndex;
+ sourceIndex+=2;
+ } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 &&
+ U16_IS_TRAIL(trail=((UChar)source[0]<<8)|source[1])
+ ) {
+ source+=2;
+ --count;
+ *target++=c;
+ *target++=trail;
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex;
+ sourceIndex+=4;
+ } else {
+ break;
+ }
+ } while(--count>0);
+ }
+
+ if(count==0) {
+ /* done with the loop for complete UChars */
+ c=0;
+ } else {
+ /* keep c for surrogate handling, trail will be set there */
+ length+=2*(count-1); /* one more byte pair was consumed than count decremented */
+ targetCapacity+=count;
+ }
+ }
+
+ if(c!=0) {
+ /*
+ * c is a surrogate, and
+ * - source or target too short
+ * - or the surrogate is unmatched
+ */
+ cnv->toUBytes[0]=(uint8_t)(c>>8);
+ cnv->toUBytes[1]=(uint8_t)c;
+ cnv->toULength=2;
+
+ if(U16_IS_SURROGATE_LEAD(c)) {
+ if(length>=2) {
+ if(U16_IS_TRAIL(trail=((UChar)source[0]<<8)|source[1])) {
+ /* output the surrogate pair, will overflow (see conditions comment above) */
+ source+=2;
+ length-=2;
+ *target++=c;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ cnv->UCharErrorBuffer[0]=trail;
+ cnv->UCharErrorBufferLength=1;
+ cnv->toULength=0;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ } else {
+ /* unmatched lead surrogate */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ }
+ } else {
+ /* see if the trail surrogate is in the next buffer */
+ }
+ } else {
+ /* unmatched trail surrogate */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ }
+ }
+
+ if(U_SUCCESS(*pErrorCode)) {
+ /* check for a remaining source byte */
+ if(length>0) {
+ if(targetCapacity==0) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ } else {
+ /* it must be length==1 because otherwise the above would have copied more */
+ cnv->toUBytes[cnv->toULength++]=*source++;
+ }
+ }
+ }
+
+ /* write back the updated pointers */
+ pArgs->source=(const char *)source;
+ pArgs->target=target;
+ pArgs->offsets=offsets;
+}
+
+static UChar32 U_CALLCONV
+_UTF16BEGetNextUChar(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
+ const uint8_t *s, *sourceLimit;
+ UChar32 c;
+
+ if(pArgs->converter->mode<8) {
+ return UCNV_GET_NEXT_UCHAR_USE_TO_U;
+ }
+
+ s=(const uint8_t *)pArgs->source;
+ sourceLimit=(const uint8_t *)pArgs->sourceLimit;
+
+ if(s>=sourceLimit) {
+ /* no input */
+ *err=U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0xffff;
+ }
+
+ if(s+2>sourceLimit) {
+ /* only one byte: truncated UChar */
+ pArgs->converter->toUBytes[0]=*s++;
+ pArgs->converter->toULength=1;
+ pArgs->source=(const char *)s;
+ *err = U_TRUNCATED_CHAR_FOUND;
+ return 0xffff;
+ }
+
+ /* get one UChar */
+ c=((UChar32)*s<<8)|s[1];
+ s+=2;
+
+ /* check for a surrogate pair */
+ if(U_IS_SURROGATE(c)) {
+ if(U16_IS_SURROGATE_LEAD(c)) {
+ if(s+2<=sourceLimit) {
+ UChar trail;
+
+ /* get a second UChar and see if it is a trail surrogate */
+ trail=((UChar)*s<<8)|s[1];
+ if(U16_IS_TRAIL(trail)) {
+ c=U16_GET_SUPPLEMENTARY(c, trail);
+ s+=2;
+ } else {
+ /* unmatched lead surrogate */
+ c=-2;
+ }
+ } else {
+ /* too few (2 or 3) bytes for a surrogate pair: truncated code point */
+ uint8_t *bytes=pArgs->converter->toUBytes;
+ s-=2;
+ pArgs->converter->toULength=(int8_t)(sourceLimit-s);
+ do {
+ *bytes++=*s++;
+ } while(s<sourceLimit);
+
+ c=0xffff;
+ *err=U_TRUNCATED_CHAR_FOUND;
+ }
+ } else {
+ /* unmatched trail surrogate */
+ c=-2;
+ }
+
+ if(c<0) {
+ /* write the unmatched surrogate */
+ uint8_t *bytes=pArgs->converter->toUBytes;
+ pArgs->converter->toULength=2;
+ *bytes=*(s-2);
+ bytes[1]=*(s-1);
+
+ c=0xffff;
+ *err=U_ILLEGAL_CHAR_FOUND;
+ }
+ }
+
+ pArgs->source=(const char *)s;
+ return c;
}
-
-static void U_CALLCONV
-_UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- UConverter *cnv;
- const uint8_t *source;
- UChar *target;
- int32_t *offsets;
-
- uint32_t targetCapacity, length, count, sourceIndex;
- UChar c, trail;
-
- if(pArgs->converter->mode<8) {
- _UTF16ToUnicodeWithOffsets(pArgs, pErrorCode);
- return;
- }
-
- cnv=pArgs->converter;
- source=(const uint8_t *)pArgs->source;
- length=(int32_t)((const uint8_t *)pArgs->sourceLimit-source);
- if(length<=0 && cnv->toUnicodeStatus==0) {
- /* no input, nothing to do */
- return;
- }
-
- target=pArgs->target;
- if(target >= pArgs->targetLimit) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- return;
- }
-
- targetCapacity=(uint32_t)(pArgs->targetLimit-target);
- offsets=pArgs->offsets;
- sourceIndex=0;
- c=0;
-
- /* complete a partial UChar or pair from the last call */
- if(cnv->toUnicodeStatus!=0) {
- /*
- * special case: single byte from a previous buffer,
- * where the byte turned out not to belong to a trail surrogate
- * and the preceding, unmatched lead surrogate was put into toUBytes[]
- * for error handling
- */
- cnv->toUBytes[0]=(uint8_t)cnv->toUnicodeStatus;
- cnv->toULength=1;
- cnv->toUnicodeStatus=0;
- }
- if((count=cnv->toULength)!=0) {
- uint8_t *p=cnv->toUBytes;
- do {
- p[count++]=*source++;
- ++sourceIndex;
- --length;
- if(count==2) {
- c=((UChar)p[0]<<8)|p[1];
- if(U16_IS_SINGLE(c)) {
- /* output the BMP code point */
- *target++=c;
- if(offsets!=NULL) {
- *offsets++=-1;
- }
- --targetCapacity;
- count=0;
- c=0;
- break;
- } else if(U16_IS_SURROGATE_LEAD(c)) {
- /* continue collecting bytes for the trail surrogate */
- c=0; /* avoid unnecessary surrogate handling below */
- } else {
- /* fall through to error handling for an unmatched trail surrogate */
- break;
- }
- } else if(count==4) {
- c=((UChar)p[0]<<8)|p[1];
- trail=((UChar)p[2]<<8)|p[3];
- if(U16_IS_TRAIL(trail)) {
- /* output the surrogate pair */
- *target++=c;
- if(targetCapacity>=2) {
- *target++=trail;
- if(offsets!=NULL) {
- *offsets++=-1;
- *offsets++=-1;
- }
- targetCapacity-=2;
- } else /* targetCapacity==1 */ {
- targetCapacity=0;
- cnv->UCharErrorBuffer[0]=trail;
- cnv->UCharErrorBufferLength=1;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- count=0;
- c=0;
- break;
- } else {
- /* unmatched lead surrogate, handle here for consistent toUBytes[] */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
-
- /* back out reading the code unit after it */
- if(((const uint8_t *)pArgs->source-source)>=2) {
- source-=2;
- } else {
- /*
- * if the trail unit's first byte was in a previous buffer, then
- * we need to put it into a special place because toUBytes[] will be
- * used for the lead unit's bytes
- */
- cnv->toUnicodeStatus=0x100|p[2];
- --source;
- }
- cnv->toULength=2;
-
- /* write back the updated pointers */
- pArgs->source=(const char *)source;
- pArgs->target=target;
- pArgs->offsets=offsets;
- return;
- }
- }
- } while(length>0);
- cnv->toULength=(int8_t)count;
- }
-
- /* copy an even number of bytes for complete UChars */
- count=2*targetCapacity;
- if(count>length) {
- count=length&~1;
- }
- if(c==0 && count>0) {
- length-=count;
- count>>=1;
- targetCapacity-=count;
- if(offsets==NULL) {
- do {
- c=((UChar)source[0]<<8)|source[1];
- source+=2;
- if(U16_IS_SINGLE(c)) {
- *target++=c;
- } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 &&
- U16_IS_TRAIL(trail=((UChar)source[0]<<8)|source[1])
- ) {
- source+=2;
- --count;
- *target++=c;
- *target++=trail;
- } else {
- break;
- }
- } while(--count>0);
- } else {
- do {
- c=((UChar)source[0]<<8)|source[1];
- source+=2;
- if(U16_IS_SINGLE(c)) {
- *target++=c;
- *offsets++=sourceIndex;
- sourceIndex+=2;
- } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 &&
- U16_IS_TRAIL(trail=((UChar)source[0]<<8)|source[1])
- ) {
- source+=2;
- --count;
- *target++=c;
- *target++=trail;
- *offsets++=sourceIndex;
- *offsets++=sourceIndex;
- sourceIndex+=4;
- } else {
- break;
- }
- } while(--count>0);
- }
-
- if(count==0) {
- /* done with the loop for complete UChars */
- c=0;
- } else {
- /* keep c for surrogate handling, trail will be set there */
- length+=2*(count-1); /* one more byte pair was consumed than count decremented */
- targetCapacity+=count;
- }
- }
-
- if(c!=0) {
- /*
- * c is a surrogate, and
- * - source or target too short
- * - or the surrogate is unmatched
- */
- cnv->toUBytes[0]=(uint8_t)(c>>8);
- cnv->toUBytes[1]=(uint8_t)c;
- cnv->toULength=2;
-
- if(U16_IS_SURROGATE_LEAD(c)) {
- if(length>=2) {
- if(U16_IS_TRAIL(trail=((UChar)source[0]<<8)|source[1])) {
- /* output the surrogate pair, will overflow (see conditions comment above) */
- source+=2;
- length-=2;
- *target++=c;
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- cnv->UCharErrorBuffer[0]=trail;
- cnv->UCharErrorBufferLength=1;
- cnv->toULength=0;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- } else {
- /* unmatched lead surrogate */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- }
- } else {
- /* see if the trail surrogate is in the next buffer */
- }
- } else {
- /* unmatched trail surrogate */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- }
- }
-
- if(U_SUCCESS(*pErrorCode)) {
- /* check for a remaining source byte */
- if(length>0) {
- if(targetCapacity==0) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- } else {
- /* it must be length==1 because otherwise the above would have copied more */
- cnv->toUBytes[cnv->toULength++]=*source++;
- }
- }
- }
-
- /* write back the updated pointers */
- pArgs->source=(const char *)source;
- pArgs->target=target;
- pArgs->offsets=offsets;
+
+static void U_CALLCONV
+_UTF16BEReset(UConverter *cnv, UConverterResetChoice choice) {
+ if(choice<=UCNV_RESET_TO_UNICODE) {
+ /* reset toUnicode state */
+ if(UCNV_GET_VERSION(cnv)==0) {
+ cnv->mode=8; /* no BOM handling */
+ } else {
+ cnv->mode=0; /* Java-specific "UnicodeBig" requires BE BOM or no BOM */
+ }
+ }
+ if(choice!=UCNV_RESET_TO_UNICODE && UCNV_GET_VERSION(cnv)==1) {
+ /* reset fromUnicode for "UnicodeBig": prepare to output the UTF-16BE BOM */
+ cnv->fromUnicodeStatus=UCNV_NEED_TO_WRITE_BOM;
+ }
+}
+
+static void U_CALLCONV
+_UTF16BEOpen(UConverter *cnv,
+ UConverterLoadArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ (void)pArgs;
+ if(UCNV_GET_VERSION(cnv)<=1) {
+ _UTF16BEReset(cnv, UCNV_RESET_BOTH);
+ } else {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ }
+}
+
+static const char * U_CALLCONV
+_UTF16BEGetName(const UConverter *cnv) {
+ if(UCNV_GET_VERSION(cnv)==0) {
+ return "UTF-16BE";
+ } else {
+ return "UTF-16BE,version=1";
+ }
+}
+U_CDECL_END
+
+static const UConverterImpl _UTF16BEImpl={
+ UCNV_UTF16_BigEndian,
+
+ NULL,
+ NULL,
+
+ _UTF16BEOpen,
+ NULL,
+ _UTF16BEReset,
+
+ _UTF16BEToUnicodeWithOffsets,
+ _UTF16BEToUnicodeWithOffsets,
+ _UTF16BEFromUnicodeWithOffsets,
+ _UTF16BEFromUnicodeWithOffsets,
+ _UTF16BEGetNextUChar,
+
+ NULL,
+ _UTF16BEGetName,
+ NULL,
+ NULL,
+ ucnv_getNonSurrogateUnicodeSet,
+
+ NULL,
+ NULL
+};
+
+static const UConverterStaticData _UTF16BEStaticData={
+ sizeof(UConverterStaticData),
+ "UTF-16BE",
+ 1200, UCNV_IBM, UCNV_UTF16_BigEndian, 2, 2,
+ { 0xff, 0xfd, 0, 0 },2,FALSE,FALSE,
+ 0,
+ 0,
+ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
+};
+
+
+const UConverterSharedData _UTF16BEData=
+ UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF16BEStaticData, &_UTF16BEImpl);
+
+/* UTF-16LE ----------------------------------------------------------------- */
+U_CDECL_BEGIN
+static void U_CALLCONV
+_UTF16LEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ UConverter *cnv;
+ const UChar *source;
+ char *target;
+ int32_t *offsets;
+
+ uint32_t targetCapacity, length, sourceIndex;
+ UChar c, trail;
+ char overflow[4];
+
+ source=pArgs->source;
+ length=(int32_t)(pArgs->sourceLimit-source);
+ if(length<=0) {
+ /* no input, nothing to do */
+ return;
+ }
+
+ cnv=pArgs->converter;
+
+ /* write the BOM if necessary */
+ if(cnv->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) {
+ static const char bom[]={ (char)0xffu, (char)0xfeu };
+ ucnv_fromUWriteBytes(cnv,
+ bom, 2,
+ &pArgs->target, pArgs->targetLimit,
+ &pArgs->offsets, -1,
+ pErrorCode);
+ cnv->fromUnicodeStatus=0;
+ }
+
+ target=pArgs->target;
+ if(target >= pArgs->targetLimit) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ return;
+ }
+
+ targetCapacity=(uint32_t)(pArgs->targetLimit-pArgs->target);
+ offsets=pArgs->offsets;
+ sourceIndex=0;
+
+ /* c!=0 indicates in several places outside the main loops that a surrogate was found */
+
+ if((c=(UChar)cnv->fromUChar32)!=0 && U16_IS_TRAIL(trail=*source) && targetCapacity>=4) {
+ /* the last buffer ended with a lead surrogate, output the surrogate pair */
+ ++source;
+ --length;
+ target[0]=(uint8_t)c;
+ target[1]=(uint8_t)(c>>8);
+ target[2]=(uint8_t)trail;
+ target[3]=(uint8_t)(trail>>8);
+ target+=4;
+ targetCapacity-=4;
+ if(offsets!=NULL) {
+ *offsets++=-1;
+ *offsets++=-1;
+ *offsets++=-1;
+ *offsets++=-1;
+ }
+ sourceIndex=1;
+ cnv->fromUChar32=c=0;
+ }
+
+ if(c==0) {
+ /* copy an even number of bytes for complete UChars */
+ uint32_t count=2*length;
+ if(count>targetCapacity) {
+ count=targetCapacity&~1;
+ }
+ /* count is even */
+ targetCapacity-=count;
+ count>>=1;
+ length-=count;
+
+ if(offsets==NULL) {
+ while(count>0) {
+ c=*source++;
+ if(U16_IS_SINGLE(c)) {
+ target[0]=(uint8_t)c;
+ target[1]=(uint8_t)(c>>8);
+ target+=2;
+ } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 && U16_IS_TRAIL(trail=*source)) {
+ ++source;
+ --count;
+ target[0]=(uint8_t)c;
+ target[1]=(uint8_t)(c>>8);
+ target[2]=(uint8_t)trail;
+ target[3]=(uint8_t)(trail>>8);
+ target+=4;
+ } else {
+ break;
+ }
+ --count;
+ }
+ } else {
+ while(count>0) {
+ c=*source++;
+ if(U16_IS_SINGLE(c)) {
+ target[0]=(uint8_t)c;
+ target[1]=(uint8_t)(c>>8);
+ target+=2;
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex++;
+ } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 && U16_IS_TRAIL(trail=*source)) {
+ ++source;
+ --count;
+ target[0]=(uint8_t)c;
+ target[1]=(uint8_t)(c>>8);
+ target[2]=(uint8_t)trail;
+ target[3]=(uint8_t)(trail>>8);
+ target+=4;
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex;
+ sourceIndex+=2;
+ } else {
+ break;
+ }
+ --count;
+ }
+ }
+
+ if(count==0) {
+ /* done with the loop for complete UChars */
+ if(length>0 && targetCapacity>0) {
+ /*
+ * there is more input and some target capacity -
+ * it must be targetCapacity==1 because otherwise
+ * the above would have copied more;
+ * prepare for overflow output
+ */
+ if(U16_IS_SINGLE(c=*source++)) {
+ overflow[0]=(char)c;
+ overflow[1]=(char)(c>>8);
+ length=2; /* 2 bytes to output */
+ c=0;
+ /* } else { keep c for surrogate handling, length will be set there */
+ }
+ } else {
+ length=0;
+ c=0;
+ }
+ } else {
+ /* keep c for surrogate handling, length will be set there */
+ targetCapacity+=2*count;
+ }
+ } else {
+ length=0; /* from here on, length counts the bytes in overflow[] */
+ }
+
+ if(c!=0) {
+ /*
+ * c is a surrogate, and
+ * - source or target too short
+ * - or the surrogate is unmatched
+ */
+ length=0;
+ if(U16_IS_SURROGATE_LEAD(c)) {
+ if(source<pArgs->sourceLimit) {
+ if(U16_IS_TRAIL(trail=*source)) {
+ /* output the surrogate pair, will overflow (see conditions comment above) */
+ ++source;
+ overflow[0]=(char)c;
+ overflow[1]=(char)(c>>8);
+ overflow[2]=(char)trail;
+ overflow[3]=(char)(trail>>8);
+ length=4; /* 4 bytes to output */
+ c=0;
+ } else {
+ /* unmatched lead surrogate */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ }
+ } else {
+ /* see if the trail surrogate is in the next buffer */
+ }
+ } else {
+ /* unmatched trail surrogate */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ }
+ cnv->fromUChar32=c;
+ }
+
+ if(length>0) {
+ /* output length bytes with overflow (length>targetCapacity>0) */
+ ucnv_fromUWriteBytes(cnv,
+ overflow, length,
+ &target, pArgs->targetLimit,
+ &offsets, sourceIndex,
+ pErrorCode);
+ targetCapacity=(uint32_t)(pArgs->targetLimit-(char *)target);
+ }
+
+ if(U_SUCCESS(*pErrorCode) && source<pArgs->sourceLimit && targetCapacity==0) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+
+ /* write back the updated pointers */
+ pArgs->source=source;
+ pArgs->target=target;
+ pArgs->offsets=offsets;
+}
+
+static void U_CALLCONV
+_UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ UConverter *cnv;
+ const uint8_t *source;
+ UChar *target;
+ int32_t *offsets;
+
+ uint32_t targetCapacity, length, count, sourceIndex;
+ UChar c, trail;
+
+ if(pArgs->converter->mode<8) {
+ _UTF16ToUnicodeWithOffsets(pArgs, pErrorCode);
+ return;
+ }
+
+ cnv=pArgs->converter;
+ source=(const uint8_t *)pArgs->source;
+ length=(int32_t)((const uint8_t *)pArgs->sourceLimit-source);
+ if(length<=0 && cnv->toUnicodeStatus==0) {
+ /* no input, nothing to do */
+ return;
+ }
+
+ target=pArgs->target;
+ if(target >= pArgs->targetLimit) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ return;
+ }
+
+ targetCapacity=(uint32_t)(pArgs->targetLimit-pArgs->target);
+ offsets=pArgs->offsets;
+ sourceIndex=0;
+ c=0;
+
+ /* complete a partial UChar or pair from the last call */
+ if(cnv->toUnicodeStatus!=0) {
+ /*
+ * special case: single byte from a previous buffer,
+ * where the byte turned out not to belong to a trail surrogate
+ * and the preceding, unmatched lead surrogate was put into toUBytes[]
+ * for error handling
+ */
+ cnv->toUBytes[0]=(uint8_t)cnv->toUnicodeStatus;
+ cnv->toULength=1;
+ cnv->toUnicodeStatus=0;
+ }
+ if((count=cnv->toULength)!=0) {
+ uint8_t *p=cnv->toUBytes;
+ do {
+ p[count++]=*source++;
+ ++sourceIndex;
+ --length;
+ if(count==2) {
+ c=((UChar)p[1]<<8)|p[0];
+ if(U16_IS_SINGLE(c)) {
+ /* output the BMP code point */
+ *target++=c;
+ if(offsets!=NULL) {
+ *offsets++=-1;
+ }
+ --targetCapacity;
+ count=0;
+ c=0;
+ break;
+ } else if(U16_IS_SURROGATE_LEAD(c)) {
+ /* continue collecting bytes for the trail surrogate */
+ c=0; /* avoid unnecessary surrogate handling below */
+ } else {
+ /* fall through to error handling for an unmatched trail surrogate */
+ break;
+ }
+ } else if(count==4) {
+ c=((UChar)p[1]<<8)|p[0];
+ trail=((UChar)p[3]<<8)|p[2];
+ if(U16_IS_TRAIL(trail)) {
+ /* output the surrogate pair */
+ *target++=c;
+ if(targetCapacity>=2) {
+ *target++=trail;
+ if(offsets!=NULL) {
+ *offsets++=-1;
+ *offsets++=-1;
+ }
+ targetCapacity-=2;
+ } else /* targetCapacity==1 */ {
+ targetCapacity=0;
+ cnv->UCharErrorBuffer[0]=trail;
+ cnv->UCharErrorBufferLength=1;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ count=0;
+ c=0;
+ break;
+ } else {
+ /* unmatched lead surrogate, handle here for consistent toUBytes[] */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+
+ /* back out reading the code unit after it */
+ if(((const uint8_t *)pArgs->source-source)>=2) {
+ source-=2;
+ } else {
+ /*
+ * if the trail unit's first byte was in a previous buffer, then
+ * we need to put it into a special place because toUBytes[] will be
+ * used for the lead unit's bytes
+ */
+ cnv->toUnicodeStatus=0x100|p[2];
+ --source;
+ }
+ cnv->toULength=2;
+
+ /* write back the updated pointers */
+ pArgs->source=(const char *)source;
+ pArgs->target=target;
+ pArgs->offsets=offsets;
+ return;
+ }
+ }
+ } while(length>0);
+ cnv->toULength=(int8_t)count;
+ }
+
+ /* copy an even number of bytes for complete UChars */
+ count=2*targetCapacity;
+ if(count>length) {
+ count=length&~1;
+ }
+ if(c==0 && count>0) {
+ length-=count;
+ count>>=1;
+ targetCapacity-=count;
+ if(offsets==NULL) {
+ do {
+ c=((UChar)source[1]<<8)|source[0];
+ source+=2;
+ if(U16_IS_SINGLE(c)) {
+ *target++=c;
+ } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 &&
+ U16_IS_TRAIL(trail=((UChar)source[1]<<8)|source[0])
+ ) {
+ source+=2;
+ --count;
+ *target++=c;
+ *target++=trail;
+ } else {
+ break;
+ }
+ } while(--count>0);
+ } else {
+ do {
+ c=((UChar)source[1]<<8)|source[0];
+ source+=2;
+ if(U16_IS_SINGLE(c)) {
+ *target++=c;
+ *offsets++=sourceIndex;
+ sourceIndex+=2;
+ } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 &&
+ U16_IS_TRAIL(trail=((UChar)source[1]<<8)|source[0])
+ ) {
+ source+=2;
+ --count;
+ *target++=c;
+ *target++=trail;
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex;
+ sourceIndex+=4;
+ } else {
+ break;
+ }
+ } while(--count>0);
+ }
+
+ if(count==0) {
+ /* done with the loop for complete UChars */
+ c=0;
+ } else {
+ /* keep c for surrogate handling, trail will be set there */
+ length+=2*(count-1); /* one more byte pair was consumed than count decremented */
+ targetCapacity+=count;
+ }
+ }
+
+ if(c!=0) {
+ /*
+ * c is a surrogate, and
+ * - source or target too short
+ * - or the surrogate is unmatched
+ */
+ cnv->toUBytes[0]=(uint8_t)c;
+ cnv->toUBytes[1]=(uint8_t)(c>>8);
+ cnv->toULength=2;
+
+ if(U16_IS_SURROGATE_LEAD(c)) {
+ if(length>=2) {
+ if(U16_IS_TRAIL(trail=((UChar)source[1]<<8)|source[0])) {
+ /* output the surrogate pair, will overflow (see conditions comment above) */
+ source+=2;
+ length-=2;
+ *target++=c;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ cnv->UCharErrorBuffer[0]=trail;
+ cnv->UCharErrorBufferLength=1;
+ cnv->toULength=0;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ } else {
+ /* unmatched lead surrogate */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ }
+ } else {
+ /* see if the trail surrogate is in the next buffer */
+ }
+ } else {
+ /* unmatched trail surrogate */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ }
+ }
+
+ if(U_SUCCESS(*pErrorCode)) {
+ /* check for a remaining source byte */
+ if(length>0) {
+ if(targetCapacity==0) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ } else {
+ /* it must be length==1 because otherwise the above would have copied more */
+ cnv->toUBytes[cnv->toULength++]=*source++;
+ }
+ }
+ }
+
+ /* write back the updated pointers */
+ pArgs->source=(const char *)source;
+ pArgs->target=target;
+ pArgs->offsets=offsets;
+}
+
+static UChar32 U_CALLCONV
+_UTF16LEGetNextUChar(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
+ const uint8_t *s, *sourceLimit;
+ UChar32 c;
+
+ if(pArgs->converter->mode<8) {
+ return UCNV_GET_NEXT_UCHAR_USE_TO_U;
+ }
+
+ s=(const uint8_t *)pArgs->source;
+ sourceLimit=(const uint8_t *)pArgs->sourceLimit;
+
+ if(s>=sourceLimit) {
+ /* no input */
+ *err=U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0xffff;
+ }
+
+ if(s+2>sourceLimit) {
+ /* only one byte: truncated UChar */
+ pArgs->converter->toUBytes[0]=*s++;
+ pArgs->converter->toULength=1;
+ pArgs->source=(const char *)s;
+ *err = U_TRUNCATED_CHAR_FOUND;
+ return 0xffff;
+ }
+
+ /* get one UChar */
+ c=((UChar32)s[1]<<8)|*s;
+ s+=2;
+
+ /* check for a surrogate pair */
+ if(U_IS_SURROGATE(c)) {
+ if(U16_IS_SURROGATE_LEAD(c)) {
+ if(s+2<=sourceLimit) {
+ UChar trail;
+
+ /* get a second UChar and see if it is a trail surrogate */
+ trail=((UChar)s[1]<<8)|*s;
+ if(U16_IS_TRAIL(trail)) {
+ c=U16_GET_SUPPLEMENTARY(c, trail);
+ s+=2;
+ } else {
+ /* unmatched lead surrogate */
+ c=-2;
+ }
+ } else {
+ /* too few (2 or 3) bytes for a surrogate pair: truncated code point */
+ uint8_t *bytes=pArgs->converter->toUBytes;
+ s-=2;
+ pArgs->converter->toULength=(int8_t)(sourceLimit-s);
+ do {
+ *bytes++=*s++;
+ } while(s<sourceLimit);
+
+ c=0xffff;
+ *err=U_TRUNCATED_CHAR_FOUND;
+ }
+ } else {
+ /* unmatched trail surrogate */
+ c=-2;
+ }
+
+ if(c<0) {
+ /* write the unmatched surrogate */
+ uint8_t *bytes=pArgs->converter->toUBytes;
+ pArgs->converter->toULength=2;
+ *bytes=*(s-2);
+ bytes[1]=*(s-1);
+
+ c=0xffff;
+ *err=U_ILLEGAL_CHAR_FOUND;
+ }
+ }
+
+ pArgs->source=(const char *)s;
+ return c;
}
-
-static UChar32 U_CALLCONV
-_UTF16BEGetNextUChar(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
- const uint8_t *s, *sourceLimit;
- UChar32 c;
-
- if(pArgs->converter->mode<8) {
- return UCNV_GET_NEXT_UCHAR_USE_TO_U;
- }
-
- s=(const uint8_t *)pArgs->source;
- sourceLimit=(const uint8_t *)pArgs->sourceLimit;
-
- if(s>=sourceLimit) {
- /* no input */
- *err=U_INDEX_OUTOFBOUNDS_ERROR;
- return 0xffff;
- }
-
- if(s+2>sourceLimit) {
- /* only one byte: truncated UChar */
- pArgs->converter->toUBytes[0]=*s++;
- pArgs->converter->toULength=1;
- pArgs->source=(const char *)s;
- *err = U_TRUNCATED_CHAR_FOUND;
- return 0xffff;
- }
-
- /* get one UChar */
- c=((UChar32)*s<<8)|s[1];
- s+=2;
-
- /* check for a surrogate pair */
- if(U_IS_SURROGATE(c)) {
- if(U16_IS_SURROGATE_LEAD(c)) {
- if(s+2<=sourceLimit) {
- UChar trail;
-
- /* get a second UChar and see if it is a trail surrogate */
- trail=((UChar)*s<<8)|s[1];
- if(U16_IS_TRAIL(trail)) {
- c=U16_GET_SUPPLEMENTARY(c, trail);
- s+=2;
- } else {
- /* unmatched lead surrogate */
- c=-2;
- }
- } else {
- /* too few (2 or 3) bytes for a surrogate pair: truncated code point */
- uint8_t *bytes=pArgs->converter->toUBytes;
- s-=2;
- pArgs->converter->toULength=(int8_t)(sourceLimit-s);
- do {
- *bytes++=*s++;
- } while(s<sourceLimit);
-
- c=0xffff;
- *err=U_TRUNCATED_CHAR_FOUND;
- }
- } else {
- /* unmatched trail surrogate */
- c=-2;
- }
-
- if(c<0) {
- /* write the unmatched surrogate */
- uint8_t *bytes=pArgs->converter->toUBytes;
- pArgs->converter->toULength=2;
- *bytes=*(s-2);
- bytes[1]=*(s-1);
-
- c=0xffff;
- *err=U_ILLEGAL_CHAR_FOUND;
- }
- }
-
- pArgs->source=(const char *)s;
- return c;
-}
-
-static void U_CALLCONV
-_UTF16BEReset(UConverter *cnv, UConverterResetChoice choice) {
- if(choice<=UCNV_RESET_TO_UNICODE) {
- /* reset toUnicode state */
- if(UCNV_GET_VERSION(cnv)==0) {
- cnv->mode=8; /* no BOM handling */
- } else {
- cnv->mode=0; /* Java-specific "UnicodeBig" requires BE BOM or no BOM */
- }
- }
- if(choice!=UCNV_RESET_TO_UNICODE && UCNV_GET_VERSION(cnv)==1) {
- /* reset fromUnicode for "UnicodeBig": prepare to output the UTF-16BE BOM */
- cnv->fromUnicodeStatus=UCNV_NEED_TO_WRITE_BOM;
- }
-}
-
-static void U_CALLCONV
-_UTF16BEOpen(UConverter *cnv,
- UConverterLoadArgs *pArgs,
- UErrorCode *pErrorCode) {
- (void)pArgs;
- if(UCNV_GET_VERSION(cnv)<=1) {
- _UTF16BEReset(cnv, UCNV_RESET_BOTH);
- } else {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- }
-}
-
-static const char * U_CALLCONV
-_UTF16BEGetName(const UConverter *cnv) {
- if(UCNV_GET_VERSION(cnv)==0) {
- return "UTF-16BE";
- } else {
- return "UTF-16BE,version=1";
- }
-}
-U_CDECL_END
-
-static const UConverterImpl _UTF16BEImpl={
- UCNV_UTF16_BigEndian,
-
- NULL,
- NULL,
-
- _UTF16BEOpen,
- NULL,
- _UTF16BEReset,
-
- _UTF16BEToUnicodeWithOffsets,
- _UTF16BEToUnicodeWithOffsets,
- _UTF16BEFromUnicodeWithOffsets,
- _UTF16BEFromUnicodeWithOffsets,
- _UTF16BEGetNextUChar,
-
- NULL,
- _UTF16BEGetName,
- NULL,
- NULL,
- ucnv_getNonSurrogateUnicodeSet,
-
- NULL,
- NULL
-};
-
-static const UConverterStaticData _UTF16BEStaticData={
- sizeof(UConverterStaticData),
- "UTF-16BE",
- 1200, UCNV_IBM, UCNV_UTF16_BigEndian, 2, 2,
- { 0xff, 0xfd, 0, 0 },2,FALSE,FALSE,
- 0,
- 0,
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
-};
-
-
-const UConverterSharedData _UTF16BEData=
- UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF16BEStaticData, &_UTF16BEImpl);
-
-/* UTF-16LE ----------------------------------------------------------------- */
-U_CDECL_BEGIN
-static void U_CALLCONV
-_UTF16LEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- UConverter *cnv;
- const UChar *source;
- char *target;
- int32_t *offsets;
-
- uint32_t targetCapacity, length, sourceIndex;
- UChar c, trail;
- char overflow[4];
-
- source=pArgs->source;
- length=(int32_t)(pArgs->sourceLimit-source);
- if(length<=0) {
- /* no input, nothing to do */
- return;
- }
-
- cnv=pArgs->converter;
-
- /* write the BOM if necessary */
- if(cnv->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) {
- static const char bom[]={ (char)0xffu, (char)0xfeu };
- ucnv_fromUWriteBytes(cnv,
- bom, 2,
- &pArgs->target, pArgs->targetLimit,
- &pArgs->offsets, -1,
- pErrorCode);
- cnv->fromUnicodeStatus=0;
- }
-
- target=pArgs->target;
- if(target >= pArgs->targetLimit) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- return;
- }
-
- targetCapacity=(uint32_t)(pArgs->targetLimit-pArgs->target);
- offsets=pArgs->offsets;
- sourceIndex=0;
-
- /* c!=0 indicates in several places outside the main loops that a surrogate was found */
-
- if((c=(UChar)cnv->fromUChar32)!=0 && U16_IS_TRAIL(trail=*source) && targetCapacity>=4) {
- /* the last buffer ended with a lead surrogate, output the surrogate pair */
- ++source;
- --length;
- target[0]=(uint8_t)c;
- target[1]=(uint8_t)(c>>8);
- target[2]=(uint8_t)trail;
- target[3]=(uint8_t)(trail>>8);
- target+=4;
- targetCapacity-=4;
- if(offsets!=NULL) {
- *offsets++=-1;
- *offsets++=-1;
- *offsets++=-1;
- *offsets++=-1;
- }
- sourceIndex=1;
- cnv->fromUChar32=c=0;
- }
-
- if(c==0) {
- /* copy an even number of bytes for complete UChars */
- uint32_t count=2*length;
- if(count>targetCapacity) {
- count=targetCapacity&~1;
- }
- /* count is even */
- targetCapacity-=count;
- count>>=1;
- length-=count;
-
- if(offsets==NULL) {
- while(count>0) {
- c=*source++;
- if(U16_IS_SINGLE(c)) {
- target[0]=(uint8_t)c;
- target[1]=(uint8_t)(c>>8);
- target+=2;
- } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 && U16_IS_TRAIL(trail=*source)) {
- ++source;
- --count;
- target[0]=(uint8_t)c;
- target[1]=(uint8_t)(c>>8);
- target[2]=(uint8_t)trail;
- target[3]=(uint8_t)(trail>>8);
- target+=4;
- } else {
- break;
- }
- --count;
- }
- } else {
- while(count>0) {
- c=*source++;
- if(U16_IS_SINGLE(c)) {
- target[0]=(uint8_t)c;
- target[1]=(uint8_t)(c>>8);
- target+=2;
- *offsets++=sourceIndex;
- *offsets++=sourceIndex++;
- } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 && U16_IS_TRAIL(trail=*source)) {
- ++source;
- --count;
- target[0]=(uint8_t)c;
- target[1]=(uint8_t)(c>>8);
- target[2]=(uint8_t)trail;
- target[3]=(uint8_t)(trail>>8);
- target+=4;
- *offsets++=sourceIndex;
- *offsets++=sourceIndex;
- *offsets++=sourceIndex;
- *offsets++=sourceIndex;
- sourceIndex+=2;
- } else {
- break;
- }
- --count;
- }
- }
-
- if(count==0) {
- /* done with the loop for complete UChars */
- if(length>0 && targetCapacity>0) {
- /*
- * there is more input and some target capacity -
- * it must be targetCapacity==1 because otherwise
- * the above would have copied more;
- * prepare for overflow output
- */
- if(U16_IS_SINGLE(c=*source++)) {
- overflow[0]=(char)c;
- overflow[1]=(char)(c>>8);
- length=2; /* 2 bytes to output */
- c=0;
- /* } else { keep c for surrogate handling, length will be set there */
- }
- } else {
- length=0;
- c=0;
- }
- } else {
- /* keep c for surrogate handling, length will be set there */
- targetCapacity+=2*count;
- }
- } else {
- length=0; /* from here on, length counts the bytes in overflow[] */
- }
-
- if(c!=0) {
- /*
- * c is a surrogate, and
- * - source or target too short
- * - or the surrogate is unmatched
- */
- length=0;
- if(U16_IS_SURROGATE_LEAD(c)) {
- if(source<pArgs->sourceLimit) {
- if(U16_IS_TRAIL(trail=*source)) {
- /* output the surrogate pair, will overflow (see conditions comment above) */
- ++source;
- overflow[0]=(char)c;
- overflow[1]=(char)(c>>8);
- overflow[2]=(char)trail;
- overflow[3]=(char)(trail>>8);
- length=4; /* 4 bytes to output */
- c=0;
- } else {
- /* unmatched lead surrogate */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- }
- } else {
- /* see if the trail surrogate is in the next buffer */
- }
- } else {
- /* unmatched trail surrogate */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- }
- cnv->fromUChar32=c;
- }
-
- if(length>0) {
- /* output length bytes with overflow (length>targetCapacity>0) */
- ucnv_fromUWriteBytes(cnv,
- overflow, length,
- &target, pArgs->targetLimit,
- &offsets, sourceIndex,
- pErrorCode);
- targetCapacity=(uint32_t)(pArgs->targetLimit-(char *)target);
- }
-
- if(U_SUCCESS(*pErrorCode) && source<pArgs->sourceLimit && targetCapacity==0) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
-
- /* write back the updated pointers */
- pArgs->source=source;
- pArgs->target=target;
- pArgs->offsets=offsets;
-}
-
-static void U_CALLCONV
-_UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- UConverter *cnv;
- const uint8_t *source;
- UChar *target;
- int32_t *offsets;
-
- uint32_t targetCapacity, length, count, sourceIndex;
- UChar c, trail;
-
- if(pArgs->converter->mode<8) {
- _UTF16ToUnicodeWithOffsets(pArgs, pErrorCode);
- return;
- }
-
- cnv=pArgs->converter;
- source=(const uint8_t *)pArgs->source;
- length=(int32_t)((const uint8_t *)pArgs->sourceLimit-source);
- if(length<=0 && cnv->toUnicodeStatus==0) {
- /* no input, nothing to do */
- return;
- }
-
- target=pArgs->target;
- if(target >= pArgs->targetLimit) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- return;
- }
-
- targetCapacity=(uint32_t)(pArgs->targetLimit-pArgs->target);
- offsets=pArgs->offsets;
- sourceIndex=0;
- c=0;
-
- /* complete a partial UChar or pair from the last call */
- if(cnv->toUnicodeStatus!=0) {
- /*
- * special case: single byte from a previous buffer,
- * where the byte turned out not to belong to a trail surrogate
- * and the preceding, unmatched lead surrogate was put into toUBytes[]
- * for error handling
- */
- cnv->toUBytes[0]=(uint8_t)cnv->toUnicodeStatus;
- cnv->toULength=1;
- cnv->toUnicodeStatus=0;
- }
- if((count=cnv->toULength)!=0) {
- uint8_t *p=cnv->toUBytes;
- do {
- p[count++]=*source++;
- ++sourceIndex;
- --length;
- if(count==2) {
- c=((UChar)p[1]<<8)|p[0];
- if(U16_IS_SINGLE(c)) {
- /* output the BMP code point */
- *target++=c;
- if(offsets!=NULL) {
- *offsets++=-1;
- }
- --targetCapacity;
- count=0;
- c=0;
- break;
- } else if(U16_IS_SURROGATE_LEAD(c)) {
- /* continue collecting bytes for the trail surrogate */
- c=0; /* avoid unnecessary surrogate handling below */
- } else {
- /* fall through to error handling for an unmatched trail surrogate */
- break;
- }
- } else if(count==4) {
- c=((UChar)p[1]<<8)|p[0];
- trail=((UChar)p[3]<<8)|p[2];
- if(U16_IS_TRAIL(trail)) {
- /* output the surrogate pair */
- *target++=c;
- if(targetCapacity>=2) {
- *target++=trail;
- if(offsets!=NULL) {
- *offsets++=-1;
- *offsets++=-1;
- }
- targetCapacity-=2;
- } else /* targetCapacity==1 */ {
- targetCapacity=0;
- cnv->UCharErrorBuffer[0]=trail;
- cnv->UCharErrorBufferLength=1;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- count=0;
- c=0;
- break;
- } else {
- /* unmatched lead surrogate, handle here for consistent toUBytes[] */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
-
- /* back out reading the code unit after it */
- if(((const uint8_t *)pArgs->source-source)>=2) {
- source-=2;
- } else {
- /*
- * if the trail unit's first byte was in a previous buffer, then
- * we need to put it into a special place because toUBytes[] will be
- * used for the lead unit's bytes
- */
- cnv->toUnicodeStatus=0x100|p[2];
- --source;
- }
- cnv->toULength=2;
-
- /* write back the updated pointers */
- pArgs->source=(const char *)source;
- pArgs->target=target;
- pArgs->offsets=offsets;
- return;
- }
- }
- } while(length>0);
- cnv->toULength=(int8_t)count;
- }
-
- /* copy an even number of bytes for complete UChars */
- count=2*targetCapacity;
- if(count>length) {
- count=length&~1;
- }
- if(c==0 && count>0) {
- length-=count;
- count>>=1;
- targetCapacity-=count;
- if(offsets==NULL) {
- do {
- c=((UChar)source[1]<<8)|source[0];
- source+=2;
- if(U16_IS_SINGLE(c)) {
- *target++=c;
- } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 &&
- U16_IS_TRAIL(trail=((UChar)source[1]<<8)|source[0])
- ) {
- source+=2;
- --count;
- *target++=c;
- *target++=trail;
- } else {
- break;
- }
- } while(--count>0);
- } else {
- do {
- c=((UChar)source[1]<<8)|source[0];
- source+=2;
- if(U16_IS_SINGLE(c)) {
- *target++=c;
- *offsets++=sourceIndex;
- sourceIndex+=2;
- } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 &&
- U16_IS_TRAIL(trail=((UChar)source[1]<<8)|source[0])
- ) {
- source+=2;
- --count;
- *target++=c;
- *target++=trail;
- *offsets++=sourceIndex;
- *offsets++=sourceIndex;
- sourceIndex+=4;
- } else {
- break;
- }
- } while(--count>0);
- }
-
- if(count==0) {
- /* done with the loop for complete UChars */
- c=0;
- } else {
- /* keep c for surrogate handling, trail will be set there */
- length+=2*(count-1); /* one more byte pair was consumed than count decremented */
- targetCapacity+=count;
- }
- }
-
- if(c!=0) {
- /*
- * c is a surrogate, and
- * - source or target too short
- * - or the surrogate is unmatched
- */
- cnv->toUBytes[0]=(uint8_t)c;
- cnv->toUBytes[1]=(uint8_t)(c>>8);
- cnv->toULength=2;
-
- if(U16_IS_SURROGATE_LEAD(c)) {
- if(length>=2) {
- if(U16_IS_TRAIL(trail=((UChar)source[1]<<8)|source[0])) {
- /* output the surrogate pair, will overflow (see conditions comment above) */
- source+=2;
- length-=2;
- *target++=c;
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- cnv->UCharErrorBuffer[0]=trail;
- cnv->UCharErrorBufferLength=1;
- cnv->toULength=0;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- } else {
- /* unmatched lead surrogate */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- }
- } else {
- /* see if the trail surrogate is in the next buffer */
- }
- } else {
- /* unmatched trail surrogate */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- }
- }
-
- if(U_SUCCESS(*pErrorCode)) {
- /* check for a remaining source byte */
- if(length>0) {
- if(targetCapacity==0) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- } else {
- /* it must be length==1 because otherwise the above would have copied more */
- cnv->toUBytes[cnv->toULength++]=*source++;
- }
- }
- }
-
- /* write back the updated pointers */
- pArgs->source=(const char *)source;
- pArgs->target=target;
- pArgs->offsets=offsets;
-}
-
-static UChar32 U_CALLCONV
-_UTF16LEGetNextUChar(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
- const uint8_t *s, *sourceLimit;
- UChar32 c;
-
- if(pArgs->converter->mode<8) {
- return UCNV_GET_NEXT_UCHAR_USE_TO_U;
- }
-
- s=(const uint8_t *)pArgs->source;
- sourceLimit=(const uint8_t *)pArgs->sourceLimit;
-
- if(s>=sourceLimit) {
- /* no input */
- *err=U_INDEX_OUTOFBOUNDS_ERROR;
- return 0xffff;
- }
-
- if(s+2>sourceLimit) {
- /* only one byte: truncated UChar */
- pArgs->converter->toUBytes[0]=*s++;
- pArgs->converter->toULength=1;
- pArgs->source=(const char *)s;
- *err = U_TRUNCATED_CHAR_FOUND;
- return 0xffff;
- }
-
- /* get one UChar */
- c=((UChar32)s[1]<<8)|*s;
- s+=2;
-
- /* check for a surrogate pair */
- if(U_IS_SURROGATE(c)) {
- if(U16_IS_SURROGATE_LEAD(c)) {
- if(s+2<=sourceLimit) {
- UChar trail;
-
- /* get a second UChar and see if it is a trail surrogate */
- trail=((UChar)s[1]<<8)|*s;
- if(U16_IS_TRAIL(trail)) {
- c=U16_GET_SUPPLEMENTARY(c, trail);
- s+=2;
- } else {
- /* unmatched lead surrogate */
- c=-2;
- }
- } else {
- /* too few (2 or 3) bytes for a surrogate pair: truncated code point */
- uint8_t *bytes=pArgs->converter->toUBytes;
- s-=2;
- pArgs->converter->toULength=(int8_t)(sourceLimit-s);
- do {
- *bytes++=*s++;
- } while(s<sourceLimit);
-
- c=0xffff;
- *err=U_TRUNCATED_CHAR_FOUND;
- }
- } else {
- /* unmatched trail surrogate */
- c=-2;
- }
-
- if(c<0) {
- /* write the unmatched surrogate */
- uint8_t *bytes=pArgs->converter->toUBytes;
- pArgs->converter->toULength=2;
- *bytes=*(s-2);
- bytes[1]=*(s-1);
-
- c=0xffff;
- *err=U_ILLEGAL_CHAR_FOUND;
- }
- }
-
- pArgs->source=(const char *)s;
- return c;
-}
-
-static void U_CALLCONV
-_UTF16LEReset(UConverter *cnv, UConverterResetChoice choice) {
- if(choice<=UCNV_RESET_TO_UNICODE) {
- /* reset toUnicode state */
- if(UCNV_GET_VERSION(cnv)==0) {
- cnv->mode=8; /* no BOM handling */
- } else {
- cnv->mode=0; /* Java-specific "UnicodeLittle" requires LE BOM or no BOM */
- }
- }
- if(choice!=UCNV_RESET_TO_UNICODE && UCNV_GET_VERSION(cnv)==1) {
- /* reset fromUnicode for "UnicodeLittle": prepare to output the UTF-16LE BOM */
- cnv->fromUnicodeStatus=UCNV_NEED_TO_WRITE_BOM;
- }
-}
-
-static void U_CALLCONV
-_UTF16LEOpen(UConverter *cnv,
- UConverterLoadArgs *pArgs,
- UErrorCode *pErrorCode) {
- (void)pArgs;
- if(UCNV_GET_VERSION(cnv)<=1) {
- _UTF16LEReset(cnv, UCNV_RESET_BOTH);
- } else {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- }
-}
-
-static const char * U_CALLCONV
-_UTF16LEGetName(const UConverter *cnv) {
- if(UCNV_GET_VERSION(cnv)==0) {
- return "UTF-16LE";
- } else {
- return "UTF-16LE,version=1";
- }
-}
-U_CDECL_END
-
-static const UConverterImpl _UTF16LEImpl={
- UCNV_UTF16_LittleEndian,
-
- NULL,
- NULL,
-
- _UTF16LEOpen,
- NULL,
- _UTF16LEReset,
-
- _UTF16LEToUnicodeWithOffsets,
- _UTF16LEToUnicodeWithOffsets,
- _UTF16LEFromUnicodeWithOffsets,
- _UTF16LEFromUnicodeWithOffsets,
- _UTF16LEGetNextUChar,
-
- NULL,
- _UTF16LEGetName,
- NULL,
- NULL,
- ucnv_getNonSurrogateUnicodeSet,
-
- NULL,
- NULL
-};
-
-
-static const UConverterStaticData _UTF16LEStaticData={
- sizeof(UConverterStaticData),
- "UTF-16LE",
- 1202, UCNV_IBM, UCNV_UTF16_LittleEndian, 2, 2,
- { 0xfd, 0xff, 0, 0 },2,FALSE,FALSE,
- 0,
- 0,
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
-};
-
-
-const UConverterSharedData _UTF16LEData=
- UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF16LEStaticData, &_UTF16LEImpl);
-
-/* UTF-16 (Detect BOM) ------------------------------------------------------ */
-
-/*
- * Detect a BOM at the beginning of the stream and select UTF-16BE or UTF-16LE
- * accordingly.
- * This is a simpler version of the UTF-32 converter, with
- * fewer states for shorter BOMs.
- *
- * State values:
- * 0 initial state
- * 1 saw first byte
- * 2..5 -
- * 6..7 see _UTF16ToUnicodeWithOffsets() comments in state 1
- * 8 UTF-16BE mode
- * 9 UTF-16LE mode
- *
- * During detection: state==number of initial bytes seen so far.
- *
- * On output, emit U+FEFF as the first code point.
- *
- * Variants:
- * - UTF-16,version=1 (Java "Unicode" encoding) treats a missing BOM as an error.
- * - UTF-16BE,version=1 (Java "UnicodeBig" encoding) and
- * UTF-16LE,version=1 (Java "UnicodeLittle" encoding) treat a reverse BOM as an error.
- */
-U_CDECL_BEGIN
-static void U_CALLCONV
-_UTF16Reset(UConverter *cnv, UConverterResetChoice choice) {
- if(choice<=UCNV_RESET_TO_UNICODE) {
- /* reset toUnicode: state=0 */
- cnv->mode=0;
- }
- if(choice!=UCNV_RESET_TO_UNICODE) {
- /* reset fromUnicode: prepare to output the UTF-16PE BOM */
- cnv->fromUnicodeStatus=UCNV_NEED_TO_WRITE_BOM;
- }
-}
-U_CDECL_END
-extern const UConverterSharedData _UTF16v2Data;
-U_CDECL_BEGIN
-static void U_CALLCONV
-_UTF16Open(UConverter *cnv,
- UConverterLoadArgs *pArgs,
- UErrorCode *pErrorCode) {
- if(UCNV_GET_VERSION(cnv)<=2) {
- if(UCNV_GET_VERSION(cnv)==2 && !pArgs->onlyTestIsLoadable) {
- /*
- * Switch implementation, and switch the staticData that's different
- * and was copied into the UConverter.
- * (See ucnv_createConverterFromSharedData() in ucnv_bld.c.)
- * UTF-16,version=2 fromUnicode() always writes a big-endian byte stream.
- */
- cnv->sharedData=(UConverterSharedData*)&_UTF16v2Data;
- uprv_memcpy(cnv->subChars, _UTF16v2Data.staticData->subChar, UCNV_MAX_SUBCHAR_LEN);
- }
- _UTF16Reset(cnv, UCNV_RESET_BOTH);
- } else {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- }
-}
-
-static const char * U_CALLCONV
-_UTF16GetName(const UConverter *cnv) {
- if(UCNV_GET_VERSION(cnv)==0) {
- return "UTF-16";
- } else if(UCNV_GET_VERSION(cnv)==1) {
- return "UTF-16,version=1";
- } else {
- return "UTF-16,version=2";
- }
-}
-U_CDECL_END
-extern const UConverterSharedData _UTF16Data;
-
-static inline bool IS_UTF16BE(const UConverter *cnv) {
- return ((cnv)->sharedData == &_UTF16BEData);
-}
-
-static inline bool IS_UTF16LE(const UConverter *cnv) {
- return ((cnv)->sharedData == &_UTF16LEData);
-}
-
-static inline bool IS_UTF16(const UConverter *cnv) {
- return ((cnv)->sharedData==&_UTF16Data) || ((cnv)->sharedData == &_UTF16v2Data);
-}
-
-U_CDECL_BEGIN
-static void U_CALLCONV
-_UTF16ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- UConverter *cnv=pArgs->converter;
- const char *source=pArgs->source;
- const char *sourceLimit=pArgs->sourceLimit;
- int32_t *offsets=pArgs->offsets;
-
- int32_t state, offsetDelta;
- uint8_t b;
-
- state=cnv->mode;
-
- /*
- * If we detect a BOM in this buffer, then we must add the BOM size to the
- * offsets because the actual converter function will not see and count the BOM.
- * offsetDelta will have the number of the BOM bytes that are in the current buffer.
- */
- offsetDelta=0;
-
- while(source<sourceLimit && U_SUCCESS(*pErrorCode)) {
- switch(state) {
- case 0:
- cnv->toUBytes[0]=(uint8_t)*source++;
- cnv->toULength=1;
- state=1;
- break;
- case 1:
- /*
- * Only inside this switch case can the state variable
- * temporarily take two additional values:
- * 6: BOM error, continue with BE
- * 7: BOM error, continue with LE
- */
- b=*source;
- if(cnv->toUBytes[0]==0xfe && b==0xff) {
- if(IS_UTF16LE(cnv)) {
- state=7; /* illegal reverse BOM for Java "UnicodeLittle" */
- } else {
- state=8; /* detect UTF-16BE */
- }
- } else if(cnv->toUBytes[0]==0xff && b==0xfe) {
- if(IS_UTF16BE(cnv)) {
- state=6; /* illegal reverse BOM for Java "UnicodeBig" */
- } else {
- state=9; /* detect UTF-16LE */
- }
- } else if((IS_UTF16(cnv) && UCNV_GET_VERSION(cnv)==1)) {
- state=6; /* illegal missing BOM for Java "Unicode" */
- }
- if(state>=8) {
- /* BOM detected, consume it */
- ++source;
- cnv->toULength=0;
- offsetDelta=(int32_t)(source-pArgs->source);
- } else if(state<6) {
- /* ok: no BOM, and not a reverse BOM */
- if(source!=pArgs->source) {
- /* reset the source for a correct first offset */
- source=pArgs->source;
- cnv->toULength=0;
- }
- if(IS_UTF16LE(cnv)) {
- /* Make Java "UnicodeLittle" default to LE. */
- state=9;
- } else {
- /* Make standard UTF-16 and Java "UnicodeBig" default to BE. */
- state=8;
- }
- } else {
- /*
- * error: missing BOM, or reverse BOM
- * UTF-16,version=1: Java-specific "Unicode" requires a BOM.
- * UTF-16BE,version=1: Java-specific "UnicodeBig" requires a BE BOM or no BOM.
- * UTF-16LE,version=1: Java-specific "UnicodeLittle" requires an LE BOM or no BOM.
- */
- /* report the non-BOM or reverse BOM as an illegal sequence */
- cnv->toUBytes[1]=b;
- cnv->toULength=2;
- pArgs->source=source+1;
- /* continue with conversion if the callback resets the error */
- /*
- * Make Java "Unicode" default to BE like standard UTF-16.
- * Make Java "UnicodeBig" and "UnicodeLittle" default
- * to their normal endiannesses.
- */
- cnv->mode=state+2;
- *pErrorCode=U_ILLEGAL_ESCAPE_SEQUENCE;
- return;
- }
- /* convert the rest of the stream */
- cnv->mode=state;
- continue;
- case 8:
- /* call UTF-16BE */
- pArgs->source=source;
- _UTF16BEToUnicodeWithOffsets(pArgs, pErrorCode);
- source=pArgs->source;
- break;
- case 9:
- /* call UTF-16LE */
- pArgs->source=source;
- _UTF16LEToUnicodeWithOffsets(pArgs, pErrorCode);
- source=pArgs->source;
- break;
- default:
- break; /* does not occur */
- }
- }
-
- /* add BOM size to offsets - see comment at offsetDelta declaration */
- if(offsets!=NULL && offsetDelta!=0) {
- int32_t *offsetsLimit=pArgs->offsets;
- while(offsets<offsetsLimit) {
- *offsets++ += offsetDelta;
- }
- }
-
- pArgs->source=source;
-
- if(source==sourceLimit && pArgs->flush) {
- /* handle truncated input */
- switch(state) {
- case 0:
- break; /* no input at all, nothing to do */
- case 8:
- _UTF16BEToUnicodeWithOffsets(pArgs, pErrorCode);
- break;
- case 9:
- _UTF16LEToUnicodeWithOffsets(pArgs, pErrorCode);
- break;
- default:
- /* 0<state<8: framework will report truncation, nothing to do here */
- break;
- }
- }
-
- cnv->mode=state;
-}
-
-static UChar32 U_CALLCONV
-_UTF16GetNextUChar(UConverterToUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- switch(pArgs->converter->mode) {
- case 8:
- return _UTF16BEGetNextUChar(pArgs, pErrorCode);
- case 9:
- return _UTF16LEGetNextUChar(pArgs, pErrorCode);
- default:
- return UCNV_GET_NEXT_UCHAR_USE_TO_U;
- }
-}
-U_CDECL_END
-
-static const UConverterImpl _UTF16Impl = {
- UCNV_UTF16,
-
- NULL,
- NULL,
-
- _UTF16Open,
- NULL,
- _UTF16Reset,
-
- _UTF16ToUnicodeWithOffsets,
- _UTF16ToUnicodeWithOffsets,
- _UTF16PEFromUnicodeWithOffsets,
- _UTF16PEFromUnicodeWithOffsets,
- _UTF16GetNextUChar,
-
- NULL, /* ### TODO implement getStarters for all Unicode encodings?! */
- _UTF16GetName,
- NULL,
- NULL,
- ucnv_getNonSurrogateUnicodeSet,
-
- NULL,
- NULL
-};
-
-static const UConverterStaticData _UTF16StaticData = {
- sizeof(UConverterStaticData),
- "UTF-16",
- 1204, /* CCSID for BOM sensitive UTF-16 */
- UCNV_IBM, UCNV_UTF16, 2, 2,
-#if U_IS_BIG_ENDIAN
- { 0xff, 0xfd, 0, 0 }, 2,
-#else
- { 0xfd, 0xff, 0, 0 }, 2,
-#endif
- FALSE, FALSE,
- 0,
- 0,
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
-};
-
-const UConverterSharedData _UTF16Data =
- UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF16StaticData, &_UTF16Impl);
-
-static const UConverterImpl _UTF16v2Impl = {
- UCNV_UTF16,
-
- NULL,
- NULL,
-
- _UTF16Open,
- NULL,
- _UTF16Reset,
-
- _UTF16ToUnicodeWithOffsets,
- _UTF16ToUnicodeWithOffsets,
- _UTF16BEFromUnicodeWithOffsets,
- _UTF16BEFromUnicodeWithOffsets,
- _UTF16GetNextUChar,
-
- NULL, /* ### TODO implement getStarters for all Unicode encodings?! */
- _UTF16GetName,
- NULL,
- NULL,
- ucnv_getNonSurrogateUnicodeSet,
-
- NULL,
- NULL
-};
-
-static const UConverterStaticData _UTF16v2StaticData = {
- sizeof(UConverterStaticData),
- "UTF-16,version=2",
- 1204, /* CCSID for BOM sensitive UTF-16 */
- UCNV_IBM, UCNV_UTF16, 2, 2,
- { 0xff, 0xfd, 0, 0 }, 2,
- FALSE, FALSE,
- 0,
- 0,
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
-};
-
-const UConverterSharedData _UTF16v2Data =
- UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF16v2StaticData, &_UTF16v2Impl);
-
-#endif
+
+static void U_CALLCONV
+_UTF16LEReset(UConverter *cnv, UConverterResetChoice choice) {
+ if(choice<=UCNV_RESET_TO_UNICODE) {
+ /* reset toUnicode state */
+ if(UCNV_GET_VERSION(cnv)==0) {
+ cnv->mode=8; /* no BOM handling */
+ } else {
+ cnv->mode=0; /* Java-specific "UnicodeLittle" requires LE BOM or no BOM */
+ }
+ }
+ if(choice!=UCNV_RESET_TO_UNICODE && UCNV_GET_VERSION(cnv)==1) {
+ /* reset fromUnicode for "UnicodeLittle": prepare to output the UTF-16LE BOM */
+ cnv->fromUnicodeStatus=UCNV_NEED_TO_WRITE_BOM;
+ }
+}
+
+static void U_CALLCONV
+_UTF16LEOpen(UConverter *cnv,
+ UConverterLoadArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ (void)pArgs;
+ if(UCNV_GET_VERSION(cnv)<=1) {
+ _UTF16LEReset(cnv, UCNV_RESET_BOTH);
+ } else {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ }
+}
+
+static const char * U_CALLCONV
+_UTF16LEGetName(const UConverter *cnv) {
+ if(UCNV_GET_VERSION(cnv)==0) {
+ return "UTF-16LE";
+ } else {
+ return "UTF-16LE,version=1";
+ }
+}
+U_CDECL_END
+
+static const UConverterImpl _UTF16LEImpl={
+ UCNV_UTF16_LittleEndian,
+
+ NULL,
+ NULL,
+
+ _UTF16LEOpen,
+ NULL,
+ _UTF16LEReset,
+
+ _UTF16LEToUnicodeWithOffsets,
+ _UTF16LEToUnicodeWithOffsets,
+ _UTF16LEFromUnicodeWithOffsets,
+ _UTF16LEFromUnicodeWithOffsets,
+ _UTF16LEGetNextUChar,
+
+ NULL,
+ _UTF16LEGetName,
+ NULL,
+ NULL,
+ ucnv_getNonSurrogateUnicodeSet,
+
+ NULL,
+ NULL
+};
+
+
+static const UConverterStaticData _UTF16LEStaticData={
+ sizeof(UConverterStaticData),
+ "UTF-16LE",
+ 1202, UCNV_IBM, UCNV_UTF16_LittleEndian, 2, 2,
+ { 0xfd, 0xff, 0, 0 },2,FALSE,FALSE,
+ 0,
+ 0,
+ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
+};
+
+
+const UConverterSharedData _UTF16LEData=
+ UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF16LEStaticData, &_UTF16LEImpl);
+
+/* UTF-16 (Detect BOM) ------------------------------------------------------ */
+
+/*
+ * Detect a BOM at the beginning of the stream and select UTF-16BE or UTF-16LE
+ * accordingly.
+ * This is a simpler version of the UTF-32 converter, with
+ * fewer states for shorter BOMs.
+ *
+ * State values:
+ * 0 initial state
+ * 1 saw first byte
+ * 2..5 -
+ * 6..7 see _UTF16ToUnicodeWithOffsets() comments in state 1
+ * 8 UTF-16BE mode
+ * 9 UTF-16LE mode
+ *
+ * During detection: state==number of initial bytes seen so far.
+ *
+ * On output, emit U+FEFF as the first code point.
+ *
+ * Variants:
+ * - UTF-16,version=1 (Java "Unicode" encoding) treats a missing BOM as an error.
+ * - UTF-16BE,version=1 (Java "UnicodeBig" encoding) and
+ * UTF-16LE,version=1 (Java "UnicodeLittle" encoding) treat a reverse BOM as an error.
+ */
+U_CDECL_BEGIN
+static void U_CALLCONV
+_UTF16Reset(UConverter *cnv, UConverterResetChoice choice) {
+ if(choice<=UCNV_RESET_TO_UNICODE) {
+ /* reset toUnicode: state=0 */
+ cnv->mode=0;
+ }
+ if(choice!=UCNV_RESET_TO_UNICODE) {
+ /* reset fromUnicode: prepare to output the UTF-16PE BOM */
+ cnv->fromUnicodeStatus=UCNV_NEED_TO_WRITE_BOM;
+ }
+}
+U_CDECL_END
+extern const UConverterSharedData _UTF16v2Data;
+U_CDECL_BEGIN
+static void U_CALLCONV
+_UTF16Open(UConverter *cnv,
+ UConverterLoadArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ if(UCNV_GET_VERSION(cnv)<=2) {
+ if(UCNV_GET_VERSION(cnv)==2 && !pArgs->onlyTestIsLoadable) {
+ /*
+ * Switch implementation, and switch the staticData that's different
+ * and was copied into the UConverter.
+ * (See ucnv_createConverterFromSharedData() in ucnv_bld.c.)
+ * UTF-16,version=2 fromUnicode() always writes a big-endian byte stream.
+ */
+ cnv->sharedData=(UConverterSharedData*)&_UTF16v2Data;
+ uprv_memcpy(cnv->subChars, _UTF16v2Data.staticData->subChar, UCNV_MAX_SUBCHAR_LEN);
+ }
+ _UTF16Reset(cnv, UCNV_RESET_BOTH);
+ } else {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ }
+}
+
+static const char * U_CALLCONV
+_UTF16GetName(const UConverter *cnv) {
+ if(UCNV_GET_VERSION(cnv)==0) {
+ return "UTF-16";
+ } else if(UCNV_GET_VERSION(cnv)==1) {
+ return "UTF-16,version=1";
+ } else {
+ return "UTF-16,version=2";
+ }
+}
+U_CDECL_END
+extern const UConverterSharedData _UTF16Data;
+
+static inline bool IS_UTF16BE(const UConverter *cnv) {
+ return ((cnv)->sharedData == &_UTF16BEData);
+}
+
+static inline bool IS_UTF16LE(const UConverter *cnv) {
+ return ((cnv)->sharedData == &_UTF16LEData);
+}
+
+static inline bool IS_UTF16(const UConverter *cnv) {
+ return ((cnv)->sharedData==&_UTF16Data) || ((cnv)->sharedData == &_UTF16v2Data);
+}
+
+U_CDECL_BEGIN
+static void U_CALLCONV
+_UTF16ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ UConverter *cnv=pArgs->converter;
+ const char *source=pArgs->source;
+ const char *sourceLimit=pArgs->sourceLimit;
+ int32_t *offsets=pArgs->offsets;
+
+ int32_t state, offsetDelta;
+ uint8_t b;
+
+ state=cnv->mode;
+
+ /*
+ * If we detect a BOM in this buffer, then we must add the BOM size to the
+ * offsets because the actual converter function will not see and count the BOM.
+ * offsetDelta will have the number of the BOM bytes that are in the current buffer.
+ */
+ offsetDelta=0;
+
+ while(source<sourceLimit && U_SUCCESS(*pErrorCode)) {
+ switch(state) {
+ case 0:
+ cnv->toUBytes[0]=(uint8_t)*source++;
+ cnv->toULength=1;
+ state=1;
+ break;
+ case 1:
+ /*
+ * Only inside this switch case can the state variable
+ * temporarily take two additional values:
+ * 6: BOM error, continue with BE
+ * 7: BOM error, continue with LE
+ */
+ b=*source;
+ if(cnv->toUBytes[0]==0xfe && b==0xff) {
+ if(IS_UTF16LE(cnv)) {
+ state=7; /* illegal reverse BOM for Java "UnicodeLittle" */
+ } else {
+ state=8; /* detect UTF-16BE */
+ }
+ } else if(cnv->toUBytes[0]==0xff && b==0xfe) {
+ if(IS_UTF16BE(cnv)) {
+ state=6; /* illegal reverse BOM for Java "UnicodeBig" */
+ } else {
+ state=9; /* detect UTF-16LE */
+ }
+ } else if((IS_UTF16(cnv) && UCNV_GET_VERSION(cnv)==1)) {
+ state=6; /* illegal missing BOM for Java "Unicode" */
+ }
+ if(state>=8) {
+ /* BOM detected, consume it */
+ ++source;
+ cnv->toULength=0;
+ offsetDelta=(int32_t)(source-pArgs->source);
+ } else if(state<6) {
+ /* ok: no BOM, and not a reverse BOM */
+ if(source!=pArgs->source) {
+ /* reset the source for a correct first offset */
+ source=pArgs->source;
+ cnv->toULength=0;
+ }
+ if(IS_UTF16LE(cnv)) {
+ /* Make Java "UnicodeLittle" default to LE. */
+ state=9;
+ } else {
+ /* Make standard UTF-16 and Java "UnicodeBig" default to BE. */
+ state=8;
+ }
+ } else {
+ /*
+ * error: missing BOM, or reverse BOM
+ * UTF-16,version=1: Java-specific "Unicode" requires a BOM.
+ * UTF-16BE,version=1: Java-specific "UnicodeBig" requires a BE BOM or no BOM.
+ * UTF-16LE,version=1: Java-specific "UnicodeLittle" requires an LE BOM or no BOM.
+ */
+ /* report the non-BOM or reverse BOM as an illegal sequence */
+ cnv->toUBytes[1]=b;
+ cnv->toULength=2;
+ pArgs->source=source+1;
+ /* continue with conversion if the callback resets the error */
+ /*
+ * Make Java "Unicode" default to BE like standard UTF-16.
+ * Make Java "UnicodeBig" and "UnicodeLittle" default
+ * to their normal endiannesses.
+ */
+ cnv->mode=state+2;
+ *pErrorCode=U_ILLEGAL_ESCAPE_SEQUENCE;
+ return;
+ }
+ /* convert the rest of the stream */
+ cnv->mode=state;
+ continue;
+ case 8:
+ /* call UTF-16BE */
+ pArgs->source=source;
+ _UTF16BEToUnicodeWithOffsets(pArgs, pErrorCode);
+ source=pArgs->source;
+ break;
+ case 9:
+ /* call UTF-16LE */
+ pArgs->source=source;
+ _UTF16LEToUnicodeWithOffsets(pArgs, pErrorCode);
+ source=pArgs->source;
+ break;
+ default:
+ break; /* does not occur */
+ }
+ }
+
+ /* add BOM size to offsets - see comment at offsetDelta declaration */
+ if(offsets!=NULL && offsetDelta!=0) {
+ int32_t *offsetsLimit=pArgs->offsets;
+ while(offsets<offsetsLimit) {
+ *offsets++ += offsetDelta;
+ }
+ }
+
+ pArgs->source=source;
+
+ if(source==sourceLimit && pArgs->flush) {
+ /* handle truncated input */
+ switch(state) {
+ case 0:
+ break; /* no input at all, nothing to do */
+ case 8:
+ _UTF16BEToUnicodeWithOffsets(pArgs, pErrorCode);
+ break;
+ case 9:
+ _UTF16LEToUnicodeWithOffsets(pArgs, pErrorCode);
+ break;
+ default:
+ /* 0<state<8: framework will report truncation, nothing to do here */
+ break;
+ }
+ }
+
+ cnv->mode=state;
+}
+
+static UChar32 U_CALLCONV
+_UTF16GetNextUChar(UConverterToUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ switch(pArgs->converter->mode) {
+ case 8:
+ return _UTF16BEGetNextUChar(pArgs, pErrorCode);
+ case 9:
+ return _UTF16LEGetNextUChar(pArgs, pErrorCode);
+ default:
+ return UCNV_GET_NEXT_UCHAR_USE_TO_U;
+ }
+}
+U_CDECL_END
+
+static const UConverterImpl _UTF16Impl = {
+ UCNV_UTF16,
+
+ NULL,
+ NULL,
+
+ _UTF16Open,
+ NULL,
+ _UTF16Reset,
+
+ _UTF16ToUnicodeWithOffsets,
+ _UTF16ToUnicodeWithOffsets,
+ _UTF16PEFromUnicodeWithOffsets,
+ _UTF16PEFromUnicodeWithOffsets,
+ _UTF16GetNextUChar,
+
+ NULL, /* ### TODO implement getStarters for all Unicode encodings?! */
+ _UTF16GetName,
+ NULL,
+ NULL,
+ ucnv_getNonSurrogateUnicodeSet,
+
+ NULL,
+ NULL
+};
+
+static const UConverterStaticData _UTF16StaticData = {
+ sizeof(UConverterStaticData),
+ "UTF-16",
+ 1204, /* CCSID for BOM sensitive UTF-16 */
+ UCNV_IBM, UCNV_UTF16, 2, 2,
+#if U_IS_BIG_ENDIAN
+ { 0xff, 0xfd, 0, 0 }, 2,
+#else
+ { 0xfd, 0xff, 0, 0 }, 2,
+#endif
+ FALSE, FALSE,
+ 0,
+ 0,
+ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
+};
+
+const UConverterSharedData _UTF16Data =
+ UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF16StaticData, &_UTF16Impl);
+
+static const UConverterImpl _UTF16v2Impl = {
+ UCNV_UTF16,
+
+ NULL,
+ NULL,
+
+ _UTF16Open,
+ NULL,
+ _UTF16Reset,
+
+ _UTF16ToUnicodeWithOffsets,
+ _UTF16ToUnicodeWithOffsets,
+ _UTF16BEFromUnicodeWithOffsets,
+ _UTF16BEFromUnicodeWithOffsets,
+ _UTF16GetNextUChar,
+
+ NULL, /* ### TODO implement getStarters for all Unicode encodings?! */
+ _UTF16GetName,
+ NULL,
+ NULL,
+ ucnv_getNonSurrogateUnicodeSet,
+
+ NULL,
+ NULL
+};
+
+static const UConverterStaticData _UTF16v2StaticData = {
+ sizeof(UConverterStaticData),
+ "UTF-16,version=2",
+ 1204, /* CCSID for BOM sensitive UTF-16 */
+ UCNV_IBM, UCNV_UTF16, 2, 2,
+ { 0xff, 0xfd, 0, 0 }, 2,
+ FALSE, FALSE,
+ 0,
+ 0,
+ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
+};
+
+const UConverterSharedData _UTF16v2Data =
+ UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF16v2StaticData, &_UTF16v2Impl);
+
+#endif
diff --git a/contrib/libs/icu/common/ucnv_u32.cpp b/contrib/libs/icu/common/ucnv_u32.cpp
index 3f366898ba..9f98914b9d 100644
--- a/contrib/libs/icu/common/ucnv_u32.cpp
+++ b/contrib/libs/icu/common/ucnv_u32.cpp
@@ -1,1253 +1,1253 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-**********************************************************************
-* Copyright (C) 2002-2015, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
-* file name: ucnv_u32.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 2002jul01
-* created by: Markus W. Scherer
-*
-* UTF-32 converter implementation. Used to be in ucnv_utf.c.
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION
-
-#include "unicode/ucnv.h"
-#include "unicode/utf.h"
-#include "ucnv_bld.h"
-#include "ucnv_cnv.h"
-#include "cmemory.h"
-
-#define MAXIMUM_UCS2 0x0000FFFF
-#define MAXIMUM_UTF 0x0010FFFF
-#define HALF_SHIFT 10
-#define HALF_BASE 0x0010000
-#define HALF_MASK 0x3FF
-#define SURROGATE_HIGH_START 0xD800
-#define SURROGATE_LOW_START 0xDC00
-
-/* -SURROGATE_LOW_START + HALF_BASE */
-#define SURROGATE_LOW_BASE 9216
-
-enum {
- UCNV_NEED_TO_WRITE_BOM=1
-};
-
-/* UTF-32BE ----------------------------------------------------------------- */
-U_CDECL_BEGIN
-static void U_CALLCONV
-T_UConverter_toUnicode_UTF32_BE(UConverterToUnicodeArgs * args,
- UErrorCode * err)
-{
- const unsigned char *mySource = (unsigned char *) args->source;
- UChar *myTarget = args->target;
- const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit;
- const UChar *targetLimit = args->targetLimit;
- unsigned char *toUBytes = args->converter->toUBytes;
- uint32_t ch, i;
-
- /* Restore state of current sequence */
- if (args->converter->toULength > 0 && myTarget < targetLimit) {
- i = args->converter->toULength; /* restore # of bytes consumed */
- args->converter->toULength = 0;
-
- ch = args->converter->toUnicodeStatus - 1;/*Stores the previously calculated ch from a previous call*/
- args->converter->toUnicodeStatus = 0;
- goto morebytes;
- }
-
- while (mySource < sourceLimit && myTarget < targetLimit) {
- i = 0;
- ch = 0;
-morebytes:
- while (i < sizeof(uint32_t)) {
- if (mySource < sourceLimit) {
- ch = (ch << 8) | (uint8_t)(*mySource);
- toUBytes[i++] = (char) *(mySource++);
- }
- else {
- /* stores a partially calculated target*/
- /* + 1 to make 0 a valid character */
- args->converter->toUnicodeStatus = ch + 1;
- args->converter->toULength = (int8_t) i;
- goto donefornow;
- }
- }
-
- if (ch <= MAXIMUM_UTF && !U_IS_SURROGATE(ch)) {
- /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
- if (ch <= MAXIMUM_UCS2)
- {
- /* fits in 16 bits */
- *(myTarget++) = (UChar) ch;
- }
- else {
- /* write out the surrogates */
- *(myTarget++) = U16_LEAD(ch);
- ch = U16_TRAIL(ch);
- if (myTarget < targetLimit) {
- *(myTarget++) = (UChar)ch;
- }
- else {
- /* Put in overflow buffer (not handled here) */
- args->converter->UCharErrorBuffer[0] = (UChar) ch;
- args->converter->UCharErrorBufferLength = 1;
- *err = U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- }
- }
- else {
- args->converter->toULength = (int8_t)i;
- *err = U_ILLEGAL_CHAR_FOUND;
- break;
- }
- }
-
-donefornow:
- if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err)) {
- /* End of target buffer */
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
-
- args->target = myTarget;
- args->source = (const char *) mySource;
-}
-
-static void U_CALLCONV
-T_UConverter_toUnicode_UTF32_BE_OFFSET_LOGIC(UConverterToUnicodeArgs * args,
- UErrorCode * err)
-{
- const unsigned char *mySource = (unsigned char *) args->source;
- UChar *myTarget = args->target;
- int32_t *myOffsets = args->offsets;
- const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit;
- const UChar *targetLimit = args->targetLimit;
- unsigned char *toUBytes = args->converter->toUBytes;
- uint32_t ch, i;
- int32_t offsetNum = 0;
-
- /* Restore state of current sequence */
- if (args->converter->toULength > 0 && myTarget < targetLimit) {
- i = args->converter->toULength; /* restore # of bytes consumed */
- args->converter->toULength = 0;
-
- ch = args->converter->toUnicodeStatus - 1;/*Stores the previously calculated ch from a previous call*/
- args->converter->toUnicodeStatus = 0;
- goto morebytes;
- }
-
- while (mySource < sourceLimit && myTarget < targetLimit) {
- i = 0;
- ch = 0;
-morebytes:
- while (i < sizeof(uint32_t)) {
- if (mySource < sourceLimit) {
- ch = (ch << 8) | (uint8_t)(*mySource);
- toUBytes[i++] = (char) *(mySource++);
- }
- else {
- /* stores a partially calculated target*/
- /* + 1 to make 0 a valid character */
- args->converter->toUnicodeStatus = ch + 1;
- args->converter->toULength = (int8_t) i;
- goto donefornow;
- }
- }
-
- if (ch <= MAXIMUM_UTF && !U_IS_SURROGATE(ch)) {
- /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
- if (ch <= MAXIMUM_UCS2) {
- /* fits in 16 bits */
- *(myTarget++) = (UChar) ch;
- *(myOffsets++) = offsetNum;
- }
- else {
- /* write out the surrogates */
- *(myTarget++) = U16_LEAD(ch);
- *myOffsets++ = offsetNum;
- ch = U16_TRAIL(ch);
- if (myTarget < targetLimit)
- {
- *(myTarget++) = (UChar)ch;
- *(myOffsets++) = offsetNum;
- }
- else {
- /* Put in overflow buffer (not handled here) */
- args->converter->UCharErrorBuffer[0] = (UChar) ch;
- args->converter->UCharErrorBufferLength = 1;
- *err = U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- }
- }
- else {
- args->converter->toULength = (int8_t)i;
- *err = U_ILLEGAL_CHAR_FOUND;
- break;
- }
- offsetNum += i;
- }
-
-donefornow:
- if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err))
- {
- /* End of target buffer */
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
-
- args->target = myTarget;
- args->source = (const char *) mySource;
- args->offsets = myOffsets;
-}
-
-static void U_CALLCONV
-T_UConverter_fromUnicode_UTF32_BE(UConverterFromUnicodeArgs * args,
- UErrorCode * err)
-{
- const UChar *mySource = args->source;
- unsigned char *myTarget;
- const UChar *sourceLimit = args->sourceLimit;
- const unsigned char *targetLimit = (unsigned char *) args->targetLimit;
- UChar32 ch, ch2;
- unsigned int indexToWrite;
- unsigned char temp[sizeof(uint32_t)];
-
- if(mySource >= sourceLimit) {
- /* no input, nothing to do */
- return;
- }
-
- /* write the BOM if necessary */
- if(args->converter->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) {
- static const char bom[]={ 0, 0, (char)0xfeu, (char)0xffu };
- ucnv_fromUWriteBytes(args->converter,
- bom, 4,
- &args->target, args->targetLimit,
- &args->offsets, -1,
- err);
- args->converter->fromUnicodeStatus=0;
- }
-
- myTarget = (unsigned char *) args->target;
- temp[0] = 0;
-
- if (args->converter->fromUChar32) {
- ch = args->converter->fromUChar32;
- args->converter->fromUChar32 = 0;
- goto lowsurogate;
- }
-
- while (mySource < sourceLimit && myTarget < targetLimit) {
- ch = *(mySource++);
-
- if (U_IS_SURROGATE(ch)) {
- if (U_IS_LEAD(ch)) {
-lowsurogate:
- if (mySource < sourceLimit) {
- ch2 = *mySource;
- if (U_IS_TRAIL(ch2)) {
- ch = ((ch - SURROGATE_HIGH_START) << HALF_SHIFT) + ch2 + SURROGATE_LOW_BASE;
- mySource++;
- }
- else {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- args->converter->fromUChar32 = ch;
- *err = U_ILLEGAL_CHAR_FOUND;
- break;
- }
- }
- else {
- /* ran out of source */
- args->converter->fromUChar32 = ch;
- if (args->flush) {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- *err = U_ILLEGAL_CHAR_FOUND;
- }
- break;
- }
- }
- else {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- args->converter->fromUChar32 = ch;
- *err = U_ILLEGAL_CHAR_FOUND;
- break;
- }
- }
-
- /* We cannot get any larger than 10FFFF because we are coming from UTF-16 */
- temp[1] = (uint8_t) (ch >> 16 & 0x1F);
- temp[2] = (uint8_t) (ch >> 8); /* unsigned cast implicitly does (ch & FF) */
- temp[3] = (uint8_t) (ch); /* unsigned cast implicitly does (ch & FF) */
-
- for (indexToWrite = 0; indexToWrite <= sizeof(uint32_t) - 1; indexToWrite++) {
- if (myTarget < targetLimit) {
- *(myTarget++) = temp[indexToWrite];
- }
- else {
- args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = temp[indexToWrite];
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
- }
- }
-
- if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err)) {
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
-
- args->target = (char *) myTarget;
- args->source = mySource;
-}
-
-static void U_CALLCONV
-T_UConverter_fromUnicode_UTF32_BE_OFFSET_LOGIC(UConverterFromUnicodeArgs * args,
- UErrorCode * err)
-{
- const UChar *mySource = args->source;
- unsigned char *myTarget;
- int32_t *myOffsets;
- const UChar *sourceLimit = args->sourceLimit;
- const unsigned char *targetLimit = (unsigned char *) args->targetLimit;
- UChar32 ch, ch2;
- int32_t offsetNum = 0;
- unsigned int indexToWrite;
- unsigned char temp[sizeof(uint32_t)];
-
- if(mySource >= sourceLimit) {
- /* no input, nothing to do */
- return;
- }
-
- /* write the BOM if necessary */
- if(args->converter->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) {
- static const char bom[]={ 0, 0, (char)0xfeu, (char)0xffu };
- ucnv_fromUWriteBytes(args->converter,
- bom, 4,
- &args->target, args->targetLimit,
- &args->offsets, -1,
- err);
- args->converter->fromUnicodeStatus=0;
- }
-
- myTarget = (unsigned char *) args->target;
- myOffsets = args->offsets;
- temp[0] = 0;
-
- if (args->converter->fromUChar32) {
- ch = args->converter->fromUChar32;
- args->converter->fromUChar32 = 0;
- goto lowsurogate;
- }
-
- while (mySource < sourceLimit && myTarget < targetLimit) {
- ch = *(mySource++);
-
- if (U_IS_SURROGATE(ch)) {
- if (U_IS_LEAD(ch)) {
-lowsurogate:
- if (mySource < sourceLimit) {
- ch2 = *mySource;
- if (U_IS_TRAIL(ch2)) {
- ch = ((ch - SURROGATE_HIGH_START) << HALF_SHIFT) + ch2 + SURROGATE_LOW_BASE;
- mySource++;
- }
- else {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- args->converter->fromUChar32 = ch;
- *err = U_ILLEGAL_CHAR_FOUND;
- break;
- }
- }
- else {
- /* ran out of source */
- args->converter->fromUChar32 = ch;
- if (args->flush) {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- *err = U_ILLEGAL_CHAR_FOUND;
- }
- break;
- }
- }
- else {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- args->converter->fromUChar32 = ch;
- *err = U_ILLEGAL_CHAR_FOUND;
- break;
- }
- }
-
- /* We cannot get any larger than 10FFFF because we are coming from UTF-16 */
- temp[1] = (uint8_t) (ch >> 16 & 0x1F);
- temp[2] = (uint8_t) (ch >> 8); /* unsigned cast implicitly does (ch & FF) */
- temp[3] = (uint8_t) (ch); /* unsigned cast implicitly does (ch & FF) */
-
- for (indexToWrite = 0; indexToWrite <= sizeof(uint32_t) - 1; indexToWrite++) {
- if (myTarget < targetLimit) {
- *(myTarget++) = temp[indexToWrite];
- *(myOffsets++) = offsetNum;
- }
- else {
- args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = temp[indexToWrite];
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
- }
- offsetNum = offsetNum + 1 + (temp[1] != 0);
- }
-
- if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err)) {
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
-
- args->target = (char *) myTarget;
- args->source = mySource;
- args->offsets = myOffsets;
-}
-
-static UChar32 U_CALLCONV
-T_UConverter_getNextUChar_UTF32_BE(UConverterToUnicodeArgs* args,
- UErrorCode* err)
-{
- const uint8_t *mySource;
- UChar32 myUChar;
- int32_t length;
-
- mySource = (const uint8_t *)args->source;
- if (mySource >= (const uint8_t *)args->sourceLimit)
- {
- /* no input */
- *err = U_INDEX_OUTOFBOUNDS_ERROR;
- return 0xffff;
- }
-
- length = (int32_t)((const uint8_t *)args->sourceLimit - mySource);
- if (length < 4)
- {
- /* got a partial character */
- uprv_memcpy(args->converter->toUBytes, mySource, length);
- args->converter->toULength = (int8_t)length;
- args->source = (const char *)(mySource + length);
- *err = U_TRUNCATED_CHAR_FOUND;
- return 0xffff;
- }
-
- /* Don't even try to do a direct cast because the value may be on an odd address. */
- myUChar = ((UChar32)mySource[0] << 24)
- | ((UChar32)mySource[1] << 16)
- | ((UChar32)mySource[2] << 8)
- | ((UChar32)mySource[3]);
-
- args->source = (const char *)(mySource + 4);
- if ((uint32_t)myUChar <= MAXIMUM_UTF && !U_IS_SURROGATE(myUChar)) {
- return myUChar;
- }
-
- uprv_memcpy(args->converter->toUBytes, mySource, 4);
- args->converter->toULength = 4;
-
- *err = U_ILLEGAL_CHAR_FOUND;
- return 0xffff;
-}
-U_CDECL_END
-static const UConverterImpl _UTF32BEImpl = {
- UCNV_UTF32_BigEndian,
-
- NULL,
- NULL,
-
- NULL,
- NULL,
- NULL,
-
- T_UConverter_toUnicode_UTF32_BE,
- T_UConverter_toUnicode_UTF32_BE_OFFSET_LOGIC,
- T_UConverter_fromUnicode_UTF32_BE,
- T_UConverter_fromUnicode_UTF32_BE_OFFSET_LOGIC,
- T_UConverter_getNextUChar_UTF32_BE,
-
- NULL,
- NULL,
- NULL,
- NULL,
- ucnv_getNonSurrogateUnicodeSet,
-
- NULL,
- NULL
-};
-
-/* The 1232 CCSID refers to any version of Unicode with any endianess of UTF-32 */
-static const UConverterStaticData _UTF32BEStaticData = {
- sizeof(UConverterStaticData),
- "UTF-32BE",
- 1232,
- UCNV_IBM, UCNV_UTF32_BigEndian, 4, 4,
- { 0, 0, 0xff, 0xfd }, 4, FALSE, FALSE,
- 0,
- 0,
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
-};
-
-const UConverterSharedData _UTF32BEData =
- UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF32BEStaticData, &_UTF32BEImpl);
-
-/* UTF-32LE ---------------------------------------------------------- */
-U_CDECL_BEGIN
-static void U_CALLCONV
-T_UConverter_toUnicode_UTF32_LE(UConverterToUnicodeArgs * args,
- UErrorCode * err)
-{
- const unsigned char *mySource = (unsigned char *) args->source;
- UChar *myTarget = args->target;
- const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit;
- const UChar *targetLimit = args->targetLimit;
- unsigned char *toUBytes = args->converter->toUBytes;
- uint32_t ch, i;
-
- /* Restore state of current sequence */
- if (args->converter->toULength > 0 && myTarget < targetLimit)
- {
- i = args->converter->toULength; /* restore # of bytes consumed */
- args->converter->toULength = 0;
-
- /* Stores the previously calculated ch from a previous call*/
- ch = args->converter->toUnicodeStatus - 1;
- args->converter->toUnicodeStatus = 0;
- goto morebytes;
- }
-
- while (mySource < sourceLimit && myTarget < targetLimit)
- {
- i = 0;
- ch = 0;
-morebytes:
- while (i < sizeof(uint32_t))
- {
- if (mySource < sourceLimit)
- {
- ch |= ((uint8_t)(*mySource)) << (i * 8);
- toUBytes[i++] = (char) *(mySource++);
- }
- else
- {
- /* stores a partially calculated target*/
- /* + 1 to make 0 a valid character */
- args->converter->toUnicodeStatus = ch + 1;
- args->converter->toULength = (int8_t) i;
- goto donefornow;
- }
- }
-
- if (ch <= MAXIMUM_UTF && !U_IS_SURROGATE(ch)) {
- /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
- if (ch <= MAXIMUM_UCS2) {
- /* fits in 16 bits */
- *(myTarget++) = (UChar) ch;
- }
- else {
- /* write out the surrogates */
- *(myTarget++) = U16_LEAD(ch);
- ch = U16_TRAIL(ch);
- if (myTarget < targetLimit) {
- *(myTarget++) = (UChar)ch;
- }
- else {
- /* Put in overflow buffer (not handled here) */
- args->converter->UCharErrorBuffer[0] = (UChar) ch;
- args->converter->UCharErrorBufferLength = 1;
- *err = U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- }
- }
- else {
- args->converter->toULength = (int8_t)i;
- *err = U_ILLEGAL_CHAR_FOUND;
- break;
- }
- }
-
-donefornow:
- if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err))
- {
- /* End of target buffer */
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
-
- args->target = myTarget;
- args->source = (const char *) mySource;
-}
-
-static void U_CALLCONV
-T_UConverter_toUnicode_UTF32_LE_OFFSET_LOGIC(UConverterToUnicodeArgs * args,
- UErrorCode * err)
-{
- const unsigned char *mySource = (unsigned char *) args->source;
- UChar *myTarget = args->target;
- int32_t *myOffsets = args->offsets;
- const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit;
- const UChar *targetLimit = args->targetLimit;
- unsigned char *toUBytes = args->converter->toUBytes;
- uint32_t ch, i;
- int32_t offsetNum = 0;
-
- /* Restore state of current sequence */
- if (args->converter->toULength > 0 && myTarget < targetLimit)
- {
- i = args->converter->toULength; /* restore # of bytes consumed */
- args->converter->toULength = 0;
-
- /* Stores the previously calculated ch from a previous call*/
- ch = args->converter->toUnicodeStatus - 1;
- args->converter->toUnicodeStatus = 0;
- goto morebytes;
- }
-
- while (mySource < sourceLimit && myTarget < targetLimit)
- {
- i = 0;
- ch = 0;
-morebytes:
- while (i < sizeof(uint32_t))
- {
- if (mySource < sourceLimit)
- {
- ch |= ((uint8_t)(*mySource)) << (i * 8);
- toUBytes[i++] = (char) *(mySource++);
- }
- else
- {
- /* stores a partially calculated target*/
- /* + 1 to make 0 a valid character */
- args->converter->toUnicodeStatus = ch + 1;
- args->converter->toULength = (int8_t) i;
- goto donefornow;
- }
- }
-
- if (ch <= MAXIMUM_UTF && !U_IS_SURROGATE(ch))
- {
- /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
- if (ch <= MAXIMUM_UCS2)
- {
- /* fits in 16 bits */
- *(myTarget++) = (UChar) ch;
- *(myOffsets++) = offsetNum;
- }
- else {
- /* write out the surrogates */
- *(myTarget++) = U16_LEAD(ch);
- *(myOffsets++) = offsetNum;
- ch = U16_TRAIL(ch);
- if (myTarget < targetLimit)
- {
- *(myTarget++) = (UChar)ch;
- *(myOffsets++) = offsetNum;
- }
- else
- {
- /* Put in overflow buffer (not handled here) */
- args->converter->UCharErrorBuffer[0] = (UChar) ch;
- args->converter->UCharErrorBufferLength = 1;
- *err = U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- }
- }
- else
- {
- args->converter->toULength = (int8_t)i;
- *err = U_ILLEGAL_CHAR_FOUND;
- break;
- }
- offsetNum += i;
- }
-
-donefornow:
- if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err))
- {
- /* End of target buffer */
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
-
- args->target = myTarget;
- args->source = (const char *) mySource;
- args->offsets = myOffsets;
-}
-
-static void U_CALLCONV
-T_UConverter_fromUnicode_UTF32_LE(UConverterFromUnicodeArgs * args,
- UErrorCode * err)
-{
- const UChar *mySource = args->source;
- unsigned char *myTarget;
- const UChar *sourceLimit = args->sourceLimit;
- const unsigned char *targetLimit = (unsigned char *) args->targetLimit;
- UChar32 ch, ch2;
- unsigned int indexToWrite;
- unsigned char temp[sizeof(uint32_t)];
-
- if(mySource >= sourceLimit) {
- /* no input, nothing to do */
- return;
- }
-
- /* write the BOM if necessary */
- if(args->converter->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) {
- static const char bom[]={ (char)0xffu, (char)0xfeu, 0, 0 };
- ucnv_fromUWriteBytes(args->converter,
- bom, 4,
- &args->target, args->targetLimit,
- &args->offsets, -1,
- err);
- args->converter->fromUnicodeStatus=0;
- }
-
- myTarget = (unsigned char *) args->target;
- temp[3] = 0;
-
- if (args->converter->fromUChar32)
- {
- ch = args->converter->fromUChar32;
- args->converter->fromUChar32 = 0;
- goto lowsurogate;
- }
-
- while (mySource < sourceLimit && myTarget < targetLimit)
- {
- ch = *(mySource++);
-
- if (U16_IS_SURROGATE(ch)) {
- if (U16_IS_LEAD(ch))
- {
-lowsurogate:
- if (mySource < sourceLimit)
- {
- ch2 = *mySource;
- if (U16_IS_TRAIL(ch2)) {
- ch = ((ch - SURROGATE_HIGH_START) << HALF_SHIFT) + ch2 + SURROGATE_LOW_BASE;
- mySource++;
- }
- else {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- args->converter->fromUChar32 = ch;
- *err = U_ILLEGAL_CHAR_FOUND;
- break;
- }
- }
- else {
- /* ran out of source */
- args->converter->fromUChar32 = ch;
- if (args->flush) {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- *err = U_ILLEGAL_CHAR_FOUND;
- }
- break;
- }
- }
- else {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- args->converter->fromUChar32 = ch;
- *err = U_ILLEGAL_CHAR_FOUND;
- break;
- }
- }
-
- /* We cannot get any larger than 10FFFF because we are coming from UTF-16 */
- temp[2] = (uint8_t) (ch >> 16 & 0x1F);
- temp[1] = (uint8_t) (ch >> 8); /* unsigned cast implicitly does (ch & FF) */
- temp[0] = (uint8_t) (ch); /* unsigned cast implicitly does (ch & FF) */
-
- for (indexToWrite = 0; indexToWrite <= sizeof(uint32_t) - 1; indexToWrite++)
- {
- if (myTarget < targetLimit)
- {
- *(myTarget++) = temp[indexToWrite];
- }
- else
- {
- args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = temp[indexToWrite];
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
- }
- }
-
- if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err))
- {
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
-
- args->target = (char *) myTarget;
- args->source = mySource;
-}
-
-static void U_CALLCONV
-T_UConverter_fromUnicode_UTF32_LE_OFFSET_LOGIC(UConverterFromUnicodeArgs * args,
- UErrorCode * err)
-{
- const UChar *mySource = args->source;
- unsigned char *myTarget;
- int32_t *myOffsets;
- const UChar *sourceLimit = args->sourceLimit;
- const unsigned char *targetLimit = (unsigned char *) args->targetLimit;
- UChar32 ch, ch2;
- unsigned int indexToWrite;
- unsigned char temp[sizeof(uint32_t)];
- int32_t offsetNum = 0;
-
- if(mySource >= sourceLimit) {
- /* no input, nothing to do */
- return;
- }
-
- /* write the BOM if necessary */
- if(args->converter->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) {
- static const char bom[]={ (char)0xffu, (char)0xfeu, 0, 0 };
- ucnv_fromUWriteBytes(args->converter,
- bom, 4,
- &args->target, args->targetLimit,
- &args->offsets, -1,
- err);
- args->converter->fromUnicodeStatus=0;
- }
-
- myTarget = (unsigned char *) args->target;
- myOffsets = args->offsets;
- temp[3] = 0;
-
- if (args->converter->fromUChar32)
- {
- ch = args->converter->fromUChar32;
- args->converter->fromUChar32 = 0;
- goto lowsurogate;
- }
-
- while (mySource < sourceLimit && myTarget < targetLimit)
- {
- ch = *(mySource++);
-
- if (U16_IS_SURROGATE(ch)) {
- if (U16_IS_LEAD(ch))
- {
-lowsurogate:
- if (mySource < sourceLimit)
- {
- ch2 = *mySource;
- if (U16_IS_TRAIL(ch2))
- {
- ch = ((ch - SURROGATE_HIGH_START) << HALF_SHIFT) + ch2 + SURROGATE_LOW_BASE;
- mySource++;
- }
- else {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- args->converter->fromUChar32 = ch;
- *err = U_ILLEGAL_CHAR_FOUND;
- break;
- }
- }
- else {
- /* ran out of source */
- args->converter->fromUChar32 = ch;
- if (args->flush) {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- *err = U_ILLEGAL_CHAR_FOUND;
- }
- break;
- }
- }
- else {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- args->converter->fromUChar32 = ch;
- *err = U_ILLEGAL_CHAR_FOUND;
- break;
- }
- }
-
- /* We cannot get any larger than 10FFFF because we are coming from UTF-16 */
- temp[2] = (uint8_t) (ch >> 16 & 0x1F);
- temp[1] = (uint8_t) (ch >> 8); /* unsigned cast implicitly does (ch & FF) */
- temp[0] = (uint8_t) (ch); /* unsigned cast implicitly does (ch & FF) */
-
- for (indexToWrite = 0; indexToWrite <= sizeof(uint32_t) - 1; indexToWrite++)
- {
- if (myTarget < targetLimit)
- {
- *(myTarget++) = temp[indexToWrite];
- *(myOffsets++) = offsetNum;
- }
- else
- {
- args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = temp[indexToWrite];
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
- }
- offsetNum = offsetNum + 1 + (temp[2] != 0);
- }
-
- if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err))
- {
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
-
- args->target = (char *) myTarget;
- args->source = mySource;
- args->offsets = myOffsets;
-}
-
-static UChar32 U_CALLCONV
-T_UConverter_getNextUChar_UTF32_LE(UConverterToUnicodeArgs* args,
- UErrorCode* err)
-{
- const uint8_t *mySource;
- UChar32 myUChar;
- int32_t length;
-
- mySource = (const uint8_t *)args->source;
- if (mySource >= (const uint8_t *)args->sourceLimit)
- {
- /* no input */
- *err = U_INDEX_OUTOFBOUNDS_ERROR;
- return 0xffff;
- }
-
- length = (int32_t)((const uint8_t *)args->sourceLimit - mySource);
- if (length < 4)
- {
- /* got a partial character */
- uprv_memcpy(args->converter->toUBytes, mySource, length);
- args->converter->toULength = (int8_t)length;
- args->source = (const char *)(mySource + length);
- *err = U_TRUNCATED_CHAR_FOUND;
- return 0xffff;
- }
-
- /* Don't even try to do a direct cast because the value may be on an odd address. */
- myUChar = ((UChar32)mySource[3] << 24)
- | ((UChar32)mySource[2] << 16)
- | ((UChar32)mySource[1] << 8)
- | ((UChar32)mySource[0]);
-
- args->source = (const char *)(mySource + 4);
- if ((uint32_t)myUChar <= MAXIMUM_UTF && !U_IS_SURROGATE(myUChar)) {
- return myUChar;
- }
-
- uprv_memcpy(args->converter->toUBytes, mySource, 4);
- args->converter->toULength = 4;
-
- *err = U_ILLEGAL_CHAR_FOUND;
- return 0xffff;
-}
-U_CDECL_END
-static const UConverterImpl _UTF32LEImpl = {
- UCNV_UTF32_LittleEndian,
-
- NULL,
- NULL,
-
- NULL,
- NULL,
- NULL,
-
- T_UConverter_toUnicode_UTF32_LE,
- T_UConverter_toUnicode_UTF32_LE_OFFSET_LOGIC,
- T_UConverter_fromUnicode_UTF32_LE,
- T_UConverter_fromUnicode_UTF32_LE_OFFSET_LOGIC,
- T_UConverter_getNextUChar_UTF32_LE,
-
- NULL,
- NULL,
- NULL,
- NULL,
- ucnv_getNonSurrogateUnicodeSet,
-
- NULL,
- NULL
-};
-
-/* The 1232 CCSID refers to any version of Unicode with any endianess of UTF-32 */
-static const UConverterStaticData _UTF32LEStaticData = {
- sizeof(UConverterStaticData),
- "UTF-32LE",
- 1234,
- UCNV_IBM, UCNV_UTF32_LittleEndian, 4, 4,
- { 0xfd, 0xff, 0, 0 }, 4, FALSE, FALSE,
- 0,
- 0,
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
-};
-
-
-const UConverterSharedData _UTF32LEData =
- UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF32LEStaticData, &_UTF32LEImpl);
-
-/* UTF-32 (Detect BOM) ------------------------------------------------------ */
-
-/*
- * Detect a BOM at the beginning of the stream and select UTF-32BE or UTF-32LE
- * accordingly.
- *
- * State values:
- * 0 initial state
- * 1 saw 00
- * 2 saw 00 00
- * 3 saw 00 00 FE
- * 4 -
- * 5 saw FF
- * 6 saw FF FE
- * 7 saw FF FE 00
- * 8 UTF-32BE mode
- * 9 UTF-32LE mode
- *
- * During detection: state&3==number of matching bytes so far.
- *
- * On output, emit U+FEFF as the first code point.
- */
-U_CDECL_BEGIN
-static void U_CALLCONV
-_UTF32Reset(UConverter *cnv, UConverterResetChoice choice) {
- if(choice<=UCNV_RESET_TO_UNICODE) {
- /* reset toUnicode: state=0 */
- cnv->mode=0;
- }
- if(choice!=UCNV_RESET_TO_UNICODE) {
- /* reset fromUnicode: prepare to output the UTF-32PE BOM */
- cnv->fromUnicodeStatus=UCNV_NEED_TO_WRITE_BOM;
- }
-}
-
-static void U_CALLCONV
-_UTF32Open(UConverter *cnv,
- UConverterLoadArgs *pArgs,
- UErrorCode *pErrorCode) {
- (void)pArgs;
- (void)pErrorCode;
- _UTF32Reset(cnv, UCNV_RESET_BOTH);
-}
-
-static const char utf32BOM[8]={ 0, 0, (char)0xfeu, (char)0xffu, (char)0xffu, (char)0xfeu, 0, 0 };
-
-static void U_CALLCONV
-_UTF32ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- UConverter *cnv=pArgs->converter;
- const char *source=pArgs->source;
- const char *sourceLimit=pArgs->sourceLimit;
- int32_t *offsets=pArgs->offsets;
-
- int32_t state, offsetDelta;
- char b;
-
- state=cnv->mode;
-
- /*
- * If we detect a BOM in this buffer, then we must add the BOM size to the
- * offsets because the actual converter function will not see and count the BOM.
- * offsetDelta will have the number of the BOM bytes that are in the current buffer.
- */
- offsetDelta=0;
-
- while(source<sourceLimit && U_SUCCESS(*pErrorCode)) {
- switch(state) {
- case 0:
- b=*source;
- if(b==0) {
- state=1; /* could be 00 00 FE FF */
- } else if(b==(char)0xffu) {
- state=5; /* could be FF FE 00 00 */
- } else {
- state=8; /* default to UTF-32BE */
- continue;
- }
- ++source;
- break;
- case 1:
- case 2:
- case 3:
- case 5:
- case 6:
- case 7:
- if(*source==utf32BOM[state]) {
- ++state;
- ++source;
- if(state==4) {
- state=8; /* detect UTF-32BE */
- offsetDelta=(int32_t)(source-pArgs->source);
- } else if(state==8) {
- state=9; /* detect UTF-32LE */
- offsetDelta=(int32_t)(source-pArgs->source);
- }
- } else {
- /* switch to UTF-32BE and pass the previous bytes */
- int32_t count=(int32_t)(source-pArgs->source); /* number of bytes from this buffer */
-
- /* reset the source */
- source=pArgs->source;
-
- if(count==(state&3)) {
- /* simple: all in the same buffer, just reset source */
- } else {
- UBool oldFlush=pArgs->flush;
-
- /* some of the bytes are from a previous buffer, replay those first */
- pArgs->source=utf32BOM+(state&4); /* select the correct BOM */
- pArgs->sourceLimit=pArgs->source+((state&3)-count); /* replay previous bytes */
- pArgs->flush=FALSE; /* this sourceLimit is not the real source stream limit */
-
- /* no offsets: bytes from previous buffer, and not enough for output */
- T_UConverter_toUnicode_UTF32_BE(pArgs, pErrorCode);
-
- /* restore real pointers; pArgs->source will be set in case 8/9 */
- pArgs->sourceLimit=sourceLimit;
- pArgs->flush=oldFlush;
- }
- state=8;
- continue;
- }
- break;
- case 8:
- /* call UTF-32BE */
- pArgs->source=source;
- if(offsets==NULL) {
- T_UConverter_toUnicode_UTF32_BE(pArgs, pErrorCode);
- } else {
- T_UConverter_toUnicode_UTF32_BE_OFFSET_LOGIC(pArgs, pErrorCode);
- }
- source=pArgs->source;
- break;
- case 9:
- /* call UTF-32LE */
- pArgs->source=source;
- if(offsets==NULL) {
- T_UConverter_toUnicode_UTF32_LE(pArgs, pErrorCode);
- } else {
- T_UConverter_toUnicode_UTF32_LE_OFFSET_LOGIC(pArgs, pErrorCode);
- }
- source=pArgs->source;
- break;
- default:
- break; /* does not occur */
- }
- }
-
- /* add BOM size to offsets - see comment at offsetDelta declaration */
- if(offsets!=NULL && offsetDelta!=0) {
- int32_t *offsetsLimit=pArgs->offsets;
- while(offsets<offsetsLimit) {
- *offsets++ += offsetDelta;
- }
- }
-
- pArgs->source=source;
-
- if(source==sourceLimit && pArgs->flush) {
- /* handle truncated input */
- switch(state) {
- case 0:
- break; /* no input at all, nothing to do */
- case 8:
- T_UConverter_toUnicode_UTF32_BE(pArgs, pErrorCode);
- break;
- case 9:
- T_UConverter_toUnicode_UTF32_LE(pArgs, pErrorCode);
- break;
- default:
- /* handle 0<state<8: call UTF-32BE with too-short input */
- pArgs->source=utf32BOM+(state&4); /* select the correct BOM */
- pArgs->sourceLimit=pArgs->source+(state&3); /* replay bytes */
-
- /* no offsets: not enough for output */
- T_UConverter_toUnicode_UTF32_BE(pArgs, pErrorCode);
- pArgs->source=source;
- pArgs->sourceLimit=sourceLimit;
- state=8;
- break;
- }
- }
-
- cnv->mode=state;
-}
-
-static UChar32 U_CALLCONV
-_UTF32GetNextUChar(UConverterToUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- switch(pArgs->converter->mode) {
- case 8:
- return T_UConverter_getNextUChar_UTF32_BE(pArgs, pErrorCode);
- case 9:
- return T_UConverter_getNextUChar_UTF32_LE(pArgs, pErrorCode);
- default:
- return UCNV_GET_NEXT_UCHAR_USE_TO_U;
- }
-}
-U_CDECL_END
-static const UConverterImpl _UTF32Impl = {
- UCNV_UTF32,
-
- NULL,
- NULL,
-
- _UTF32Open,
- NULL,
- _UTF32Reset,
-
- _UTF32ToUnicodeWithOffsets,
- _UTF32ToUnicodeWithOffsets,
-#if U_IS_BIG_ENDIAN
- T_UConverter_fromUnicode_UTF32_BE,
- T_UConverter_fromUnicode_UTF32_BE_OFFSET_LOGIC,
-#else
- T_UConverter_fromUnicode_UTF32_LE,
- T_UConverter_fromUnicode_UTF32_LE_OFFSET_LOGIC,
-#endif
- _UTF32GetNextUChar,
-
- NULL, /* ### TODO implement getStarters for all Unicode encodings?! */
- NULL,
- NULL,
- NULL,
- ucnv_getNonSurrogateUnicodeSet,
-
- NULL,
- NULL
-};
-
-/* The 1236 CCSID refers to any version of Unicode with a BOM sensitive endianess of UTF-32 */
-static const UConverterStaticData _UTF32StaticData = {
- sizeof(UConverterStaticData),
- "UTF-32",
- 1236,
- UCNV_IBM, UCNV_UTF32, 4, 4,
-#if U_IS_BIG_ENDIAN
- { 0, 0, 0xff, 0xfd }, 4,
-#else
- { 0xfd, 0xff, 0, 0 }, 4,
-#endif
- FALSE, FALSE,
- 0,
- 0,
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
-};
-
-const UConverterSharedData _UTF32Data =
- UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF32StaticData, &_UTF32Impl);
-
-#endif
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+**********************************************************************
+* Copyright (C) 2002-2015, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* file name: ucnv_u32.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2002jul01
+* created by: Markus W. Scherer
+*
+* UTF-32 converter implementation. Used to be in ucnv_utf.c.
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION
+
+#include "unicode/ucnv.h"
+#include "unicode/utf.h"
+#include "ucnv_bld.h"
+#include "ucnv_cnv.h"
+#include "cmemory.h"
+
+#define MAXIMUM_UCS2 0x0000FFFF
+#define MAXIMUM_UTF 0x0010FFFF
+#define HALF_SHIFT 10
+#define HALF_BASE 0x0010000
+#define HALF_MASK 0x3FF
+#define SURROGATE_HIGH_START 0xD800
+#define SURROGATE_LOW_START 0xDC00
+
+/* -SURROGATE_LOW_START + HALF_BASE */
+#define SURROGATE_LOW_BASE 9216
+
+enum {
+ UCNV_NEED_TO_WRITE_BOM=1
+};
+
+/* UTF-32BE ----------------------------------------------------------------- */
+U_CDECL_BEGIN
+static void U_CALLCONV
+T_UConverter_toUnicode_UTF32_BE(UConverterToUnicodeArgs * args,
+ UErrorCode * err)
+{
+ const unsigned char *mySource = (unsigned char *) args->source;
+ UChar *myTarget = args->target;
+ const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit;
+ const UChar *targetLimit = args->targetLimit;
+ unsigned char *toUBytes = args->converter->toUBytes;
+ uint32_t ch, i;
+
+ /* Restore state of current sequence */
+ if (args->converter->toULength > 0 && myTarget < targetLimit) {
+ i = args->converter->toULength; /* restore # of bytes consumed */
+ args->converter->toULength = 0;
+
+ ch = args->converter->toUnicodeStatus - 1;/*Stores the previously calculated ch from a previous call*/
+ args->converter->toUnicodeStatus = 0;
+ goto morebytes;
+ }
+
+ while (mySource < sourceLimit && myTarget < targetLimit) {
+ i = 0;
+ ch = 0;
+morebytes:
+ while (i < sizeof(uint32_t)) {
+ if (mySource < sourceLimit) {
+ ch = (ch << 8) | (uint8_t)(*mySource);
+ toUBytes[i++] = (char) *(mySource++);
+ }
+ else {
+ /* stores a partially calculated target*/
+ /* + 1 to make 0 a valid character */
+ args->converter->toUnicodeStatus = ch + 1;
+ args->converter->toULength = (int8_t) i;
+ goto donefornow;
+ }
+ }
+
+ if (ch <= MAXIMUM_UTF && !U_IS_SURROGATE(ch)) {
+ /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
+ if (ch <= MAXIMUM_UCS2)
+ {
+ /* fits in 16 bits */
+ *(myTarget++) = (UChar) ch;
+ }
+ else {
+ /* write out the surrogates */
+ *(myTarget++) = U16_LEAD(ch);
+ ch = U16_TRAIL(ch);
+ if (myTarget < targetLimit) {
+ *(myTarget++) = (UChar)ch;
+ }
+ else {
+ /* Put in overflow buffer (not handled here) */
+ args->converter->UCharErrorBuffer[0] = (UChar) ch;
+ args->converter->UCharErrorBufferLength = 1;
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ }
+ }
+ else {
+ args->converter->toULength = (int8_t)i;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ }
+
+donefornow:
+ if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err)) {
+ /* End of target buffer */
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+
+ args->target = myTarget;
+ args->source = (const char *) mySource;
+}
+
+static void U_CALLCONV
+T_UConverter_toUnicode_UTF32_BE_OFFSET_LOGIC(UConverterToUnicodeArgs * args,
+ UErrorCode * err)
+{
+ const unsigned char *mySource = (unsigned char *) args->source;
+ UChar *myTarget = args->target;
+ int32_t *myOffsets = args->offsets;
+ const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit;
+ const UChar *targetLimit = args->targetLimit;
+ unsigned char *toUBytes = args->converter->toUBytes;
+ uint32_t ch, i;
+ int32_t offsetNum = 0;
+
+ /* Restore state of current sequence */
+ if (args->converter->toULength > 0 && myTarget < targetLimit) {
+ i = args->converter->toULength; /* restore # of bytes consumed */
+ args->converter->toULength = 0;
+
+ ch = args->converter->toUnicodeStatus - 1;/*Stores the previously calculated ch from a previous call*/
+ args->converter->toUnicodeStatus = 0;
+ goto morebytes;
+ }
+
+ while (mySource < sourceLimit && myTarget < targetLimit) {
+ i = 0;
+ ch = 0;
+morebytes:
+ while (i < sizeof(uint32_t)) {
+ if (mySource < sourceLimit) {
+ ch = (ch << 8) | (uint8_t)(*mySource);
+ toUBytes[i++] = (char) *(mySource++);
+ }
+ else {
+ /* stores a partially calculated target*/
+ /* + 1 to make 0 a valid character */
+ args->converter->toUnicodeStatus = ch + 1;
+ args->converter->toULength = (int8_t) i;
+ goto donefornow;
+ }
+ }
+
+ if (ch <= MAXIMUM_UTF && !U_IS_SURROGATE(ch)) {
+ /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
+ if (ch <= MAXIMUM_UCS2) {
+ /* fits in 16 bits */
+ *(myTarget++) = (UChar) ch;
+ *(myOffsets++) = offsetNum;
+ }
+ else {
+ /* write out the surrogates */
+ *(myTarget++) = U16_LEAD(ch);
+ *myOffsets++ = offsetNum;
+ ch = U16_TRAIL(ch);
+ if (myTarget < targetLimit)
+ {
+ *(myTarget++) = (UChar)ch;
+ *(myOffsets++) = offsetNum;
+ }
+ else {
+ /* Put in overflow buffer (not handled here) */
+ args->converter->UCharErrorBuffer[0] = (UChar) ch;
+ args->converter->UCharErrorBufferLength = 1;
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ }
+ }
+ else {
+ args->converter->toULength = (int8_t)i;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ offsetNum += i;
+ }
+
+donefornow:
+ if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err))
+ {
+ /* End of target buffer */
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+
+ args->target = myTarget;
+ args->source = (const char *) mySource;
+ args->offsets = myOffsets;
+}
+
+static void U_CALLCONV
+T_UConverter_fromUnicode_UTF32_BE(UConverterFromUnicodeArgs * args,
+ UErrorCode * err)
+{
+ const UChar *mySource = args->source;
+ unsigned char *myTarget;
+ const UChar *sourceLimit = args->sourceLimit;
+ const unsigned char *targetLimit = (unsigned char *) args->targetLimit;
+ UChar32 ch, ch2;
+ unsigned int indexToWrite;
+ unsigned char temp[sizeof(uint32_t)];
+
+ if(mySource >= sourceLimit) {
+ /* no input, nothing to do */
+ return;
+ }
+
+ /* write the BOM if necessary */
+ if(args->converter->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) {
+ static const char bom[]={ 0, 0, (char)0xfeu, (char)0xffu };
+ ucnv_fromUWriteBytes(args->converter,
+ bom, 4,
+ &args->target, args->targetLimit,
+ &args->offsets, -1,
+ err);
+ args->converter->fromUnicodeStatus=0;
+ }
+
+ myTarget = (unsigned char *) args->target;
+ temp[0] = 0;
+
+ if (args->converter->fromUChar32) {
+ ch = args->converter->fromUChar32;
+ args->converter->fromUChar32 = 0;
+ goto lowsurogate;
+ }
+
+ while (mySource < sourceLimit && myTarget < targetLimit) {
+ ch = *(mySource++);
+
+ if (U_IS_SURROGATE(ch)) {
+ if (U_IS_LEAD(ch)) {
+lowsurogate:
+ if (mySource < sourceLimit) {
+ ch2 = *mySource;
+ if (U_IS_TRAIL(ch2)) {
+ ch = ((ch - SURROGATE_HIGH_START) << HALF_SHIFT) + ch2 + SURROGATE_LOW_BASE;
+ mySource++;
+ }
+ else {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ args->converter->fromUChar32 = ch;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ }
+ else {
+ /* ran out of source */
+ args->converter->fromUChar32 = ch;
+ if (args->flush) {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ *err = U_ILLEGAL_CHAR_FOUND;
+ }
+ break;
+ }
+ }
+ else {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ args->converter->fromUChar32 = ch;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ }
+
+ /* We cannot get any larger than 10FFFF because we are coming from UTF-16 */
+ temp[1] = (uint8_t) (ch >> 16 & 0x1F);
+ temp[2] = (uint8_t) (ch >> 8); /* unsigned cast implicitly does (ch & FF) */
+ temp[3] = (uint8_t) (ch); /* unsigned cast implicitly does (ch & FF) */
+
+ for (indexToWrite = 0; indexToWrite <= sizeof(uint32_t) - 1; indexToWrite++) {
+ if (myTarget < targetLimit) {
+ *(myTarget++) = temp[indexToWrite];
+ }
+ else {
+ args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = temp[indexToWrite];
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+ }
+ }
+
+ if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err)) {
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+
+ args->target = (char *) myTarget;
+ args->source = mySource;
+}
+
+static void U_CALLCONV
+T_UConverter_fromUnicode_UTF32_BE_OFFSET_LOGIC(UConverterFromUnicodeArgs * args,
+ UErrorCode * err)
+{
+ const UChar *mySource = args->source;
+ unsigned char *myTarget;
+ int32_t *myOffsets;
+ const UChar *sourceLimit = args->sourceLimit;
+ const unsigned char *targetLimit = (unsigned char *) args->targetLimit;
+ UChar32 ch, ch2;
+ int32_t offsetNum = 0;
+ unsigned int indexToWrite;
+ unsigned char temp[sizeof(uint32_t)];
+
+ if(mySource >= sourceLimit) {
+ /* no input, nothing to do */
+ return;
+ }
+
+ /* write the BOM if necessary */
+ if(args->converter->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) {
+ static const char bom[]={ 0, 0, (char)0xfeu, (char)0xffu };
+ ucnv_fromUWriteBytes(args->converter,
+ bom, 4,
+ &args->target, args->targetLimit,
+ &args->offsets, -1,
+ err);
+ args->converter->fromUnicodeStatus=0;
+ }
+
+ myTarget = (unsigned char *) args->target;
+ myOffsets = args->offsets;
+ temp[0] = 0;
+
+ if (args->converter->fromUChar32) {
+ ch = args->converter->fromUChar32;
+ args->converter->fromUChar32 = 0;
+ goto lowsurogate;
+ }
+
+ while (mySource < sourceLimit && myTarget < targetLimit) {
+ ch = *(mySource++);
+
+ if (U_IS_SURROGATE(ch)) {
+ if (U_IS_LEAD(ch)) {
+lowsurogate:
+ if (mySource < sourceLimit) {
+ ch2 = *mySource;
+ if (U_IS_TRAIL(ch2)) {
+ ch = ((ch - SURROGATE_HIGH_START) << HALF_SHIFT) + ch2 + SURROGATE_LOW_BASE;
+ mySource++;
+ }
+ else {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ args->converter->fromUChar32 = ch;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ }
+ else {
+ /* ran out of source */
+ args->converter->fromUChar32 = ch;
+ if (args->flush) {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ *err = U_ILLEGAL_CHAR_FOUND;
+ }
+ break;
+ }
+ }
+ else {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ args->converter->fromUChar32 = ch;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ }
+
+ /* We cannot get any larger than 10FFFF because we are coming from UTF-16 */
+ temp[1] = (uint8_t) (ch >> 16 & 0x1F);
+ temp[2] = (uint8_t) (ch >> 8); /* unsigned cast implicitly does (ch & FF) */
+ temp[3] = (uint8_t) (ch); /* unsigned cast implicitly does (ch & FF) */
+
+ for (indexToWrite = 0; indexToWrite <= sizeof(uint32_t) - 1; indexToWrite++) {
+ if (myTarget < targetLimit) {
+ *(myTarget++) = temp[indexToWrite];
+ *(myOffsets++) = offsetNum;
+ }
+ else {
+ args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = temp[indexToWrite];
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+ }
+ offsetNum = offsetNum + 1 + (temp[1] != 0);
+ }
+
+ if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err)) {
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+
+ args->target = (char *) myTarget;
+ args->source = mySource;
+ args->offsets = myOffsets;
+}
+
+static UChar32 U_CALLCONV
+T_UConverter_getNextUChar_UTF32_BE(UConverterToUnicodeArgs* args,
+ UErrorCode* err)
+{
+ const uint8_t *mySource;
+ UChar32 myUChar;
+ int32_t length;
+
+ mySource = (const uint8_t *)args->source;
+ if (mySource >= (const uint8_t *)args->sourceLimit)
+ {
+ /* no input */
+ *err = U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0xffff;
+ }
+
+ length = (int32_t)((const uint8_t *)args->sourceLimit - mySource);
+ if (length < 4)
+ {
+ /* got a partial character */
+ uprv_memcpy(args->converter->toUBytes, mySource, length);
+ args->converter->toULength = (int8_t)length;
+ args->source = (const char *)(mySource + length);
+ *err = U_TRUNCATED_CHAR_FOUND;
+ return 0xffff;
+ }
+
+ /* Don't even try to do a direct cast because the value may be on an odd address. */
+ myUChar = ((UChar32)mySource[0] << 24)
+ | ((UChar32)mySource[1] << 16)
+ | ((UChar32)mySource[2] << 8)
+ | ((UChar32)mySource[3]);
+
+ args->source = (const char *)(mySource + 4);
+ if ((uint32_t)myUChar <= MAXIMUM_UTF && !U_IS_SURROGATE(myUChar)) {
+ return myUChar;
+ }
+
+ uprv_memcpy(args->converter->toUBytes, mySource, 4);
+ args->converter->toULength = 4;
+
+ *err = U_ILLEGAL_CHAR_FOUND;
+ return 0xffff;
+}
+U_CDECL_END
+static const UConverterImpl _UTF32BEImpl = {
+ UCNV_UTF32_BigEndian,
+
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+ NULL,
+
+ T_UConverter_toUnicode_UTF32_BE,
+ T_UConverter_toUnicode_UTF32_BE_OFFSET_LOGIC,
+ T_UConverter_fromUnicode_UTF32_BE,
+ T_UConverter_fromUnicode_UTF32_BE_OFFSET_LOGIC,
+ T_UConverter_getNextUChar_UTF32_BE,
+
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ ucnv_getNonSurrogateUnicodeSet,
+
+ NULL,
+ NULL
+};
+
+/* The 1232 CCSID refers to any version of Unicode with any endianess of UTF-32 */
+static const UConverterStaticData _UTF32BEStaticData = {
+ sizeof(UConverterStaticData),
+ "UTF-32BE",
+ 1232,
+ UCNV_IBM, UCNV_UTF32_BigEndian, 4, 4,
+ { 0, 0, 0xff, 0xfd }, 4, FALSE, FALSE,
+ 0,
+ 0,
+ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
+};
+
+const UConverterSharedData _UTF32BEData =
+ UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF32BEStaticData, &_UTF32BEImpl);
+
+/* UTF-32LE ---------------------------------------------------------- */
+U_CDECL_BEGIN
+static void U_CALLCONV
+T_UConverter_toUnicode_UTF32_LE(UConverterToUnicodeArgs * args,
+ UErrorCode * err)
+{
+ const unsigned char *mySource = (unsigned char *) args->source;
+ UChar *myTarget = args->target;
+ const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit;
+ const UChar *targetLimit = args->targetLimit;
+ unsigned char *toUBytes = args->converter->toUBytes;
+ uint32_t ch, i;
+
+ /* Restore state of current sequence */
+ if (args->converter->toULength > 0 && myTarget < targetLimit)
+ {
+ i = args->converter->toULength; /* restore # of bytes consumed */
+ args->converter->toULength = 0;
+
+ /* Stores the previously calculated ch from a previous call*/
+ ch = args->converter->toUnicodeStatus - 1;
+ args->converter->toUnicodeStatus = 0;
+ goto morebytes;
+ }
+
+ while (mySource < sourceLimit && myTarget < targetLimit)
+ {
+ i = 0;
+ ch = 0;
+morebytes:
+ while (i < sizeof(uint32_t))
+ {
+ if (mySource < sourceLimit)
+ {
+ ch |= ((uint8_t)(*mySource)) << (i * 8);
+ toUBytes[i++] = (char) *(mySource++);
+ }
+ else
+ {
+ /* stores a partially calculated target*/
+ /* + 1 to make 0 a valid character */
+ args->converter->toUnicodeStatus = ch + 1;
+ args->converter->toULength = (int8_t) i;
+ goto donefornow;
+ }
+ }
+
+ if (ch <= MAXIMUM_UTF && !U_IS_SURROGATE(ch)) {
+ /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
+ if (ch <= MAXIMUM_UCS2) {
+ /* fits in 16 bits */
+ *(myTarget++) = (UChar) ch;
+ }
+ else {
+ /* write out the surrogates */
+ *(myTarget++) = U16_LEAD(ch);
+ ch = U16_TRAIL(ch);
+ if (myTarget < targetLimit) {
+ *(myTarget++) = (UChar)ch;
+ }
+ else {
+ /* Put in overflow buffer (not handled here) */
+ args->converter->UCharErrorBuffer[0] = (UChar) ch;
+ args->converter->UCharErrorBufferLength = 1;
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ }
+ }
+ else {
+ args->converter->toULength = (int8_t)i;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ }
+
+donefornow:
+ if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err))
+ {
+ /* End of target buffer */
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+
+ args->target = myTarget;
+ args->source = (const char *) mySource;
+}
+
+static void U_CALLCONV
+T_UConverter_toUnicode_UTF32_LE_OFFSET_LOGIC(UConverterToUnicodeArgs * args,
+ UErrorCode * err)
+{
+ const unsigned char *mySource = (unsigned char *) args->source;
+ UChar *myTarget = args->target;
+ int32_t *myOffsets = args->offsets;
+ const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit;
+ const UChar *targetLimit = args->targetLimit;
+ unsigned char *toUBytes = args->converter->toUBytes;
+ uint32_t ch, i;
+ int32_t offsetNum = 0;
+
+ /* Restore state of current sequence */
+ if (args->converter->toULength > 0 && myTarget < targetLimit)
+ {
+ i = args->converter->toULength; /* restore # of bytes consumed */
+ args->converter->toULength = 0;
+
+ /* Stores the previously calculated ch from a previous call*/
+ ch = args->converter->toUnicodeStatus - 1;
+ args->converter->toUnicodeStatus = 0;
+ goto morebytes;
+ }
+
+ while (mySource < sourceLimit && myTarget < targetLimit)
+ {
+ i = 0;
+ ch = 0;
+morebytes:
+ while (i < sizeof(uint32_t))
+ {
+ if (mySource < sourceLimit)
+ {
+ ch |= ((uint8_t)(*mySource)) << (i * 8);
+ toUBytes[i++] = (char) *(mySource++);
+ }
+ else
+ {
+ /* stores a partially calculated target*/
+ /* + 1 to make 0 a valid character */
+ args->converter->toUnicodeStatus = ch + 1;
+ args->converter->toULength = (int8_t) i;
+ goto donefornow;
+ }
+ }
+
+ if (ch <= MAXIMUM_UTF && !U_IS_SURROGATE(ch))
+ {
+ /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
+ if (ch <= MAXIMUM_UCS2)
+ {
+ /* fits in 16 bits */
+ *(myTarget++) = (UChar) ch;
+ *(myOffsets++) = offsetNum;
+ }
+ else {
+ /* write out the surrogates */
+ *(myTarget++) = U16_LEAD(ch);
+ *(myOffsets++) = offsetNum;
+ ch = U16_TRAIL(ch);
+ if (myTarget < targetLimit)
+ {
+ *(myTarget++) = (UChar)ch;
+ *(myOffsets++) = offsetNum;
+ }
+ else
+ {
+ /* Put in overflow buffer (not handled here) */
+ args->converter->UCharErrorBuffer[0] = (UChar) ch;
+ args->converter->UCharErrorBufferLength = 1;
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ }
+ }
+ else
+ {
+ args->converter->toULength = (int8_t)i;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ offsetNum += i;
+ }
+
+donefornow:
+ if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err))
+ {
+ /* End of target buffer */
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+
+ args->target = myTarget;
+ args->source = (const char *) mySource;
+ args->offsets = myOffsets;
+}
+
+static void U_CALLCONV
+T_UConverter_fromUnicode_UTF32_LE(UConverterFromUnicodeArgs * args,
+ UErrorCode * err)
+{
+ const UChar *mySource = args->source;
+ unsigned char *myTarget;
+ const UChar *sourceLimit = args->sourceLimit;
+ const unsigned char *targetLimit = (unsigned char *) args->targetLimit;
+ UChar32 ch, ch2;
+ unsigned int indexToWrite;
+ unsigned char temp[sizeof(uint32_t)];
+
+ if(mySource >= sourceLimit) {
+ /* no input, nothing to do */
+ return;
+ }
+
+ /* write the BOM if necessary */
+ if(args->converter->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) {
+ static const char bom[]={ (char)0xffu, (char)0xfeu, 0, 0 };
+ ucnv_fromUWriteBytes(args->converter,
+ bom, 4,
+ &args->target, args->targetLimit,
+ &args->offsets, -1,
+ err);
+ args->converter->fromUnicodeStatus=0;
+ }
+
+ myTarget = (unsigned char *) args->target;
+ temp[3] = 0;
+
+ if (args->converter->fromUChar32)
+ {
+ ch = args->converter->fromUChar32;
+ args->converter->fromUChar32 = 0;
+ goto lowsurogate;
+ }
+
+ while (mySource < sourceLimit && myTarget < targetLimit)
+ {
+ ch = *(mySource++);
+
+ if (U16_IS_SURROGATE(ch)) {
+ if (U16_IS_LEAD(ch))
+ {
+lowsurogate:
+ if (mySource < sourceLimit)
+ {
+ ch2 = *mySource;
+ if (U16_IS_TRAIL(ch2)) {
+ ch = ((ch - SURROGATE_HIGH_START) << HALF_SHIFT) + ch2 + SURROGATE_LOW_BASE;
+ mySource++;
+ }
+ else {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ args->converter->fromUChar32 = ch;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ }
+ else {
+ /* ran out of source */
+ args->converter->fromUChar32 = ch;
+ if (args->flush) {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ *err = U_ILLEGAL_CHAR_FOUND;
+ }
+ break;
+ }
+ }
+ else {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ args->converter->fromUChar32 = ch;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ }
+
+ /* We cannot get any larger than 10FFFF because we are coming from UTF-16 */
+ temp[2] = (uint8_t) (ch >> 16 & 0x1F);
+ temp[1] = (uint8_t) (ch >> 8); /* unsigned cast implicitly does (ch & FF) */
+ temp[0] = (uint8_t) (ch); /* unsigned cast implicitly does (ch & FF) */
+
+ for (indexToWrite = 0; indexToWrite <= sizeof(uint32_t) - 1; indexToWrite++)
+ {
+ if (myTarget < targetLimit)
+ {
+ *(myTarget++) = temp[indexToWrite];
+ }
+ else
+ {
+ args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = temp[indexToWrite];
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+ }
+ }
+
+ if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err))
+ {
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+
+ args->target = (char *) myTarget;
+ args->source = mySource;
+}
+
+static void U_CALLCONV
+T_UConverter_fromUnicode_UTF32_LE_OFFSET_LOGIC(UConverterFromUnicodeArgs * args,
+ UErrorCode * err)
+{
+ const UChar *mySource = args->source;
+ unsigned char *myTarget;
+ int32_t *myOffsets;
+ const UChar *sourceLimit = args->sourceLimit;
+ const unsigned char *targetLimit = (unsigned char *) args->targetLimit;
+ UChar32 ch, ch2;
+ unsigned int indexToWrite;
+ unsigned char temp[sizeof(uint32_t)];
+ int32_t offsetNum = 0;
+
+ if(mySource >= sourceLimit) {
+ /* no input, nothing to do */
+ return;
+ }
+
+ /* write the BOM if necessary */
+ if(args->converter->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) {
+ static const char bom[]={ (char)0xffu, (char)0xfeu, 0, 0 };
+ ucnv_fromUWriteBytes(args->converter,
+ bom, 4,
+ &args->target, args->targetLimit,
+ &args->offsets, -1,
+ err);
+ args->converter->fromUnicodeStatus=0;
+ }
+
+ myTarget = (unsigned char *) args->target;
+ myOffsets = args->offsets;
+ temp[3] = 0;
+
+ if (args->converter->fromUChar32)
+ {
+ ch = args->converter->fromUChar32;
+ args->converter->fromUChar32 = 0;
+ goto lowsurogate;
+ }
+
+ while (mySource < sourceLimit && myTarget < targetLimit)
+ {
+ ch = *(mySource++);
+
+ if (U16_IS_SURROGATE(ch)) {
+ if (U16_IS_LEAD(ch))
+ {
+lowsurogate:
+ if (mySource < sourceLimit)
+ {
+ ch2 = *mySource;
+ if (U16_IS_TRAIL(ch2))
+ {
+ ch = ((ch - SURROGATE_HIGH_START) << HALF_SHIFT) + ch2 + SURROGATE_LOW_BASE;
+ mySource++;
+ }
+ else {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ args->converter->fromUChar32 = ch;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ }
+ else {
+ /* ran out of source */
+ args->converter->fromUChar32 = ch;
+ if (args->flush) {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ *err = U_ILLEGAL_CHAR_FOUND;
+ }
+ break;
+ }
+ }
+ else {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ args->converter->fromUChar32 = ch;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ }
+
+ /* We cannot get any larger than 10FFFF because we are coming from UTF-16 */
+ temp[2] = (uint8_t) (ch >> 16 & 0x1F);
+ temp[1] = (uint8_t) (ch >> 8); /* unsigned cast implicitly does (ch & FF) */
+ temp[0] = (uint8_t) (ch); /* unsigned cast implicitly does (ch & FF) */
+
+ for (indexToWrite = 0; indexToWrite <= sizeof(uint32_t) - 1; indexToWrite++)
+ {
+ if (myTarget < targetLimit)
+ {
+ *(myTarget++) = temp[indexToWrite];
+ *(myOffsets++) = offsetNum;
+ }
+ else
+ {
+ args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = temp[indexToWrite];
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+ }
+ offsetNum = offsetNum + 1 + (temp[2] != 0);
+ }
+
+ if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err))
+ {
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+
+ args->target = (char *) myTarget;
+ args->source = mySource;
+ args->offsets = myOffsets;
+}
+
+static UChar32 U_CALLCONV
+T_UConverter_getNextUChar_UTF32_LE(UConverterToUnicodeArgs* args,
+ UErrorCode* err)
+{
+ const uint8_t *mySource;
+ UChar32 myUChar;
+ int32_t length;
+
+ mySource = (const uint8_t *)args->source;
+ if (mySource >= (const uint8_t *)args->sourceLimit)
+ {
+ /* no input */
+ *err = U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0xffff;
+ }
+
+ length = (int32_t)((const uint8_t *)args->sourceLimit - mySource);
+ if (length < 4)
+ {
+ /* got a partial character */
+ uprv_memcpy(args->converter->toUBytes, mySource, length);
+ args->converter->toULength = (int8_t)length;
+ args->source = (const char *)(mySource + length);
+ *err = U_TRUNCATED_CHAR_FOUND;
+ return 0xffff;
+ }
+
+ /* Don't even try to do a direct cast because the value may be on an odd address. */
+ myUChar = ((UChar32)mySource[3] << 24)
+ | ((UChar32)mySource[2] << 16)
+ | ((UChar32)mySource[1] << 8)
+ | ((UChar32)mySource[0]);
+
+ args->source = (const char *)(mySource + 4);
+ if ((uint32_t)myUChar <= MAXIMUM_UTF && !U_IS_SURROGATE(myUChar)) {
+ return myUChar;
+ }
+
+ uprv_memcpy(args->converter->toUBytes, mySource, 4);
+ args->converter->toULength = 4;
+
+ *err = U_ILLEGAL_CHAR_FOUND;
+ return 0xffff;
+}
+U_CDECL_END
+static const UConverterImpl _UTF32LEImpl = {
+ UCNV_UTF32_LittleEndian,
+
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+ NULL,
+
+ T_UConverter_toUnicode_UTF32_LE,
+ T_UConverter_toUnicode_UTF32_LE_OFFSET_LOGIC,
+ T_UConverter_fromUnicode_UTF32_LE,
+ T_UConverter_fromUnicode_UTF32_LE_OFFSET_LOGIC,
+ T_UConverter_getNextUChar_UTF32_LE,
+
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ ucnv_getNonSurrogateUnicodeSet,
+
+ NULL,
+ NULL
+};
+
+/* The 1232 CCSID refers to any version of Unicode with any endianess of UTF-32 */
+static const UConverterStaticData _UTF32LEStaticData = {
+ sizeof(UConverterStaticData),
+ "UTF-32LE",
+ 1234,
+ UCNV_IBM, UCNV_UTF32_LittleEndian, 4, 4,
+ { 0xfd, 0xff, 0, 0 }, 4, FALSE, FALSE,
+ 0,
+ 0,
+ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
+};
+
+
+const UConverterSharedData _UTF32LEData =
+ UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF32LEStaticData, &_UTF32LEImpl);
+
+/* UTF-32 (Detect BOM) ------------------------------------------------------ */
+
+/*
+ * Detect a BOM at the beginning of the stream and select UTF-32BE or UTF-32LE
+ * accordingly.
+ *
+ * State values:
+ * 0 initial state
+ * 1 saw 00
+ * 2 saw 00 00
+ * 3 saw 00 00 FE
+ * 4 -
+ * 5 saw FF
+ * 6 saw FF FE
+ * 7 saw FF FE 00
+ * 8 UTF-32BE mode
+ * 9 UTF-32LE mode
+ *
+ * During detection: state&3==number of matching bytes so far.
+ *
+ * On output, emit U+FEFF as the first code point.
+ */
+U_CDECL_BEGIN
+static void U_CALLCONV
+_UTF32Reset(UConverter *cnv, UConverterResetChoice choice) {
+ if(choice<=UCNV_RESET_TO_UNICODE) {
+ /* reset toUnicode: state=0 */
+ cnv->mode=0;
+ }
+ if(choice!=UCNV_RESET_TO_UNICODE) {
+ /* reset fromUnicode: prepare to output the UTF-32PE BOM */
+ cnv->fromUnicodeStatus=UCNV_NEED_TO_WRITE_BOM;
+ }
+}
+
+static void U_CALLCONV
+_UTF32Open(UConverter *cnv,
+ UConverterLoadArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ (void)pArgs;
+ (void)pErrorCode;
+ _UTF32Reset(cnv, UCNV_RESET_BOTH);
+}
+
+static const char utf32BOM[8]={ 0, 0, (char)0xfeu, (char)0xffu, (char)0xffu, (char)0xfeu, 0, 0 };
+
+static void U_CALLCONV
+_UTF32ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ UConverter *cnv=pArgs->converter;
+ const char *source=pArgs->source;
+ const char *sourceLimit=pArgs->sourceLimit;
+ int32_t *offsets=pArgs->offsets;
+
+ int32_t state, offsetDelta;
+ char b;
+
+ state=cnv->mode;
+
+ /*
+ * If we detect a BOM in this buffer, then we must add the BOM size to the
+ * offsets because the actual converter function will not see and count the BOM.
+ * offsetDelta will have the number of the BOM bytes that are in the current buffer.
+ */
+ offsetDelta=0;
+
+ while(source<sourceLimit && U_SUCCESS(*pErrorCode)) {
+ switch(state) {
+ case 0:
+ b=*source;
+ if(b==0) {
+ state=1; /* could be 00 00 FE FF */
+ } else if(b==(char)0xffu) {
+ state=5; /* could be FF FE 00 00 */
+ } else {
+ state=8; /* default to UTF-32BE */
+ continue;
+ }
+ ++source;
+ break;
+ case 1:
+ case 2:
+ case 3:
+ case 5:
+ case 6:
+ case 7:
+ if(*source==utf32BOM[state]) {
+ ++state;
+ ++source;
+ if(state==4) {
+ state=8; /* detect UTF-32BE */
+ offsetDelta=(int32_t)(source-pArgs->source);
+ } else if(state==8) {
+ state=9; /* detect UTF-32LE */
+ offsetDelta=(int32_t)(source-pArgs->source);
+ }
+ } else {
+ /* switch to UTF-32BE and pass the previous bytes */
+ int32_t count=(int32_t)(source-pArgs->source); /* number of bytes from this buffer */
+
+ /* reset the source */
+ source=pArgs->source;
+
+ if(count==(state&3)) {
+ /* simple: all in the same buffer, just reset source */
+ } else {
+ UBool oldFlush=pArgs->flush;
+
+ /* some of the bytes are from a previous buffer, replay those first */
+ pArgs->source=utf32BOM+(state&4); /* select the correct BOM */
+ pArgs->sourceLimit=pArgs->source+((state&3)-count); /* replay previous bytes */
+ pArgs->flush=FALSE; /* this sourceLimit is not the real source stream limit */
+
+ /* no offsets: bytes from previous buffer, and not enough for output */
+ T_UConverter_toUnicode_UTF32_BE(pArgs, pErrorCode);
+
+ /* restore real pointers; pArgs->source will be set in case 8/9 */
+ pArgs->sourceLimit=sourceLimit;
+ pArgs->flush=oldFlush;
+ }
+ state=8;
+ continue;
+ }
+ break;
+ case 8:
+ /* call UTF-32BE */
+ pArgs->source=source;
+ if(offsets==NULL) {
+ T_UConverter_toUnicode_UTF32_BE(pArgs, pErrorCode);
+ } else {
+ T_UConverter_toUnicode_UTF32_BE_OFFSET_LOGIC(pArgs, pErrorCode);
+ }
+ source=pArgs->source;
+ break;
+ case 9:
+ /* call UTF-32LE */
+ pArgs->source=source;
+ if(offsets==NULL) {
+ T_UConverter_toUnicode_UTF32_LE(pArgs, pErrorCode);
+ } else {
+ T_UConverter_toUnicode_UTF32_LE_OFFSET_LOGIC(pArgs, pErrorCode);
+ }
+ source=pArgs->source;
+ break;
+ default:
+ break; /* does not occur */
+ }
+ }
+
+ /* add BOM size to offsets - see comment at offsetDelta declaration */
+ if(offsets!=NULL && offsetDelta!=0) {
+ int32_t *offsetsLimit=pArgs->offsets;
+ while(offsets<offsetsLimit) {
+ *offsets++ += offsetDelta;
+ }
+ }
+
+ pArgs->source=source;
+
+ if(source==sourceLimit && pArgs->flush) {
+ /* handle truncated input */
+ switch(state) {
+ case 0:
+ break; /* no input at all, nothing to do */
+ case 8:
+ T_UConverter_toUnicode_UTF32_BE(pArgs, pErrorCode);
+ break;
+ case 9:
+ T_UConverter_toUnicode_UTF32_LE(pArgs, pErrorCode);
+ break;
+ default:
+ /* handle 0<state<8: call UTF-32BE with too-short input */
+ pArgs->source=utf32BOM+(state&4); /* select the correct BOM */
+ pArgs->sourceLimit=pArgs->source+(state&3); /* replay bytes */
+
+ /* no offsets: not enough for output */
+ T_UConverter_toUnicode_UTF32_BE(pArgs, pErrorCode);
+ pArgs->source=source;
+ pArgs->sourceLimit=sourceLimit;
+ state=8;
+ break;
+ }
+ }
+
+ cnv->mode=state;
+}
+
+static UChar32 U_CALLCONV
+_UTF32GetNextUChar(UConverterToUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ switch(pArgs->converter->mode) {
+ case 8:
+ return T_UConverter_getNextUChar_UTF32_BE(pArgs, pErrorCode);
+ case 9:
+ return T_UConverter_getNextUChar_UTF32_LE(pArgs, pErrorCode);
+ default:
+ return UCNV_GET_NEXT_UCHAR_USE_TO_U;
+ }
+}
+U_CDECL_END
+static const UConverterImpl _UTF32Impl = {
+ UCNV_UTF32,
+
+ NULL,
+ NULL,
+
+ _UTF32Open,
+ NULL,
+ _UTF32Reset,
+
+ _UTF32ToUnicodeWithOffsets,
+ _UTF32ToUnicodeWithOffsets,
+#if U_IS_BIG_ENDIAN
+ T_UConverter_fromUnicode_UTF32_BE,
+ T_UConverter_fromUnicode_UTF32_BE_OFFSET_LOGIC,
+#else
+ T_UConverter_fromUnicode_UTF32_LE,
+ T_UConverter_fromUnicode_UTF32_LE_OFFSET_LOGIC,
+#endif
+ _UTF32GetNextUChar,
+
+ NULL, /* ### TODO implement getStarters for all Unicode encodings?! */
+ NULL,
+ NULL,
+ NULL,
+ ucnv_getNonSurrogateUnicodeSet,
+
+ NULL,
+ NULL
+};
+
+/* The 1236 CCSID refers to any version of Unicode with a BOM sensitive endianess of UTF-32 */
+static const UConverterStaticData _UTF32StaticData = {
+ sizeof(UConverterStaticData),
+ "UTF-32",
+ 1236,
+ UCNV_IBM, UCNV_UTF32, 4, 4,
+#if U_IS_BIG_ENDIAN
+ { 0, 0, 0xff, 0xfd }, 4,
+#else
+ { 0xfd, 0xff, 0, 0 }, 4,
+#endif
+ FALSE, FALSE,
+ 0,
+ 0,
+ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
+};
+
+const UConverterSharedData _UTF32Data =
+ UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF32StaticData, &_UTF32Impl);
+
+#endif
diff --git a/contrib/libs/icu/common/ucnv_u7.cpp b/contrib/libs/icu/common/ucnv_u7.cpp
index e388f949f1..87ba8cf37e 100644
--- a/contrib/libs/icu/common/ucnv_u7.cpp
+++ b/contrib/libs/icu/common/ucnv_u7.cpp
@@ -1,1491 +1,1491 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-**********************************************************************
-* Copyright (C) 2002-2016, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
-* file name: ucnv_u7.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 2002jul01
-* created by: Markus W. Scherer
-*
-* UTF-7 converter implementation. Used to be in ucnv_utf.c.
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION
-
-#include "cmemory.h"
-#include "unicode/ucnv.h"
-#include "ucnv_bld.h"
-#include "ucnv_cnv.h"
-#include "uassert.h"
-
-/* UTF-7 -------------------------------------------------------------------- */
-
-/*
- * UTF-7 is a stateful encoding of Unicode.
- * It is defined in RFC 2152. (http://www.ietf.org/rfc/rfc2152.txt)
- * It was intended for use in Internet email systems, using in its bytewise
- * encoding only a subset of 7-bit US-ASCII.
- * UTF-7 is deprecated in favor of UTF-8/16/32 and SCSU, but still
- * occasionally used.
- *
- * For converting Unicode to UTF-7, the RFC allows to encode some US-ASCII
- * characters directly or in base64. Especially, the characters in set O
- * as defined in the RFC (see below) may be encoded directly but are not
- * allowed in, e.g., email headers.
- * By default, the ICU UTF-7 converter encodes set O directly.
- * By choosing the option "version=1", set O will be escaped instead.
- * For example:
- * utf7Converter=ucnv_open("UTF-7,version=1");
- *
- * For details about email headers see RFC 2047.
- */
-
-/*
- * Tests for US-ASCII characters belonging to character classes
- * defined in UTF-7.
- *
- * Set D (directly encoded characters) consists of the following
- * characters: the upper and lower case letters A through Z
- * and a through z, the 10 digits 0-9, and the following nine special
- * characters (note that "+" and "=" are omitted):
- * '(),-./:?
- *
- * Set O (optional direct characters) consists of the following
- * characters (note that "\" and "~" are omitted):
- * !"#$%&*;<=>@[]^_`{|}
- *
- * According to the rules in RFC 2152, the byte values for the following
- * US-ASCII characters are not used in UTF-7 and are therefore illegal:
- * - all C0 control codes except for CR LF TAB
- * - BACKSLASH
- * - TILDE
- * - DEL
- * - all codes beyond US-ASCII, i.e. all >127
- */
-#define inSetD(c) \
- ((uint8_t)((c)-97)<26 || (uint8_t)((c)-65)<26 || /* letters */ \
- (uint8_t)((c)-48)<10 || /* digits */ \
- (uint8_t)((c)-39)<3 || /* '() */ \
- (uint8_t)((c)-44)<4 || /* ,-./ */ \
- (c)==58 || (c)==63 /* :? */ \
- )
-
-#define inSetO(c) \
- ((uint8_t)((c)-33)<6 || /* !"#$%& */ \
- (uint8_t)((c)-59)<4 || /* ;<=> */ \
- (uint8_t)((c)-93)<4 || /* ]^_` */ \
- (uint8_t)((c)-123)<3 || /* {|} */ \
- (c)==42 || (c)==64 || (c)==91 /* *@[ */ \
- )
-
-#define isCRLFTAB(c) ((c)==13 || (c)==10 || (c)==9)
-#define isCRLFSPTAB(c) ((c)==32 || (c)==13 || (c)==10 || (c)==9)
-
-#define PLUS 43
-#define MINUS 45
-#define BACKSLASH 92
-#define TILDE 126
-
-/* legal byte values: all US-ASCII graphic characters from space to before tilde, and CR LF TAB */
-#define isLegalUTF7(c) (((uint8_t)((c)-32)<94 && (c)!=BACKSLASH) || isCRLFTAB(c))
-
-/* encode directly sets D and O and CR LF SP TAB */
-static const UBool encodeDirectlyMaximum[128]={
- /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 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, 0, 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, 0, 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, 0, 0
-};
-
-/* encode directly set D and CR LF SP TAB but not set O */
-static const UBool encodeDirectlyRestricted[128]={
- /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,
-
- 0, 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, 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, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
-};
-
-static const uint8_t
-toBase64[64]={
- /* A-Z */
- 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
- 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
- /* a-z */
- 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
- 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
- /* 0-9 */
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
- /* +/ */
- 43, 47
-};
-
-static const int8_t
-fromBase64[128]={
- /* C0 controls, -1 for legal ones (CR LF TAB), -3 for illegal ones */
- -3, -3, -3, -3, -3, -3, -3, -3, -3, -1, -1, -3, -3, -1, -3, -3,
- -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
-
- /* general punctuation with + and / and a special value (-2) for - */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -2, -1, 63,
- /* digits */
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
-
- /* A-Z */
- -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, -3, -1, -1, -1,
-
- /* a-z */
- -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -3, -3
-};
-
-/*
- * converter status values:
- *
- * toUnicodeStatus:
- * 24 inDirectMode (boolean)
- * 23..16 base64Counter (-1..7)
- * 15..0 bits (up to 14 bits incoming base64)
- *
- * fromUnicodeStatus:
- * 31..28 version (0: set O direct 1: set O escaped)
- * 24 inDirectMode (boolean)
- * 23..16 base64Counter (0..2)
- * 7..0 bits (6 bits outgoing base64)
- *
- */
-
-U_CDECL_BEGIN
-static void U_CALLCONV
-_UTF7Reset(UConverter *cnv, UConverterResetChoice choice) {
- if(choice<=UCNV_RESET_TO_UNICODE) {
- /* reset toUnicode */
- cnv->toUnicodeStatus=0x1000000; /* inDirectMode=TRUE */
- cnv->toULength=0;
- }
- if(choice!=UCNV_RESET_TO_UNICODE) {
- /* reset fromUnicode */
- cnv->fromUnicodeStatus=(cnv->fromUnicodeStatus&0xf0000000)|0x1000000; /* keep version, inDirectMode=TRUE */
- }
-}
-
-static void U_CALLCONV
-_UTF7Open(UConverter *cnv,
- UConverterLoadArgs *pArgs,
- UErrorCode *pErrorCode) {
- (void)pArgs;
- if(UCNV_GET_VERSION(cnv)<=1) {
- /* TODO(markus): Should just use cnv->options rather than copying the version number. */
- cnv->fromUnicodeStatus=UCNV_GET_VERSION(cnv)<<28;
- _UTF7Reset(cnv, UCNV_RESET_BOTH);
- } else {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- }
-}
-
-static void U_CALLCONV
-_UTF7ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- UConverter *cnv;
- const uint8_t *source, *sourceLimit;
- UChar *target;
- const UChar *targetLimit;
- int32_t *offsets;
-
- uint8_t *bytes;
- uint8_t byteIndex;
-
- int32_t length, targetCapacity;
-
- /* UTF-7 state */
- uint16_t bits;
- int8_t base64Counter;
- UBool inDirectMode;
-
- int8_t base64Value;
-
- int32_t sourceIndex, nextSourceIndex;
-
- uint8_t b;
- /* set up the local pointers */
- cnv=pArgs->converter;
-
- source=(const uint8_t *)pArgs->source;
- sourceLimit=(const uint8_t *)pArgs->sourceLimit;
- target=pArgs->target;
- targetLimit=pArgs->targetLimit;
- offsets=pArgs->offsets;
- /* get the state machine state */
- {
- uint32_t status=cnv->toUnicodeStatus;
- inDirectMode=(UBool)((status>>24)&1);
- base64Counter=(int8_t)(status>>16);
- bits=(uint16_t)status;
- }
- bytes=cnv->toUBytes;
- byteIndex=cnv->toULength;
-
- /* sourceIndex=-1 if the current character began in the previous buffer */
- sourceIndex=byteIndex==0 ? 0 : -1;
- nextSourceIndex=0;
-
- if(inDirectMode) {
-directMode:
- /*
- * In Direct Mode, most US-ASCII characters are encoded directly, i.e.,
- * with their US-ASCII byte values.
- * Backslash and Tilde and most control characters are not allowed in UTF-7.
- * A plus sign starts Unicode (or "escape") Mode.
- *
- * In Direct Mode, only the sourceIndex is used.
- */
- byteIndex=0;
- length=(int32_t)(sourceLimit-source);
- targetCapacity=(int32_t)(targetLimit-target);
- if(length>targetCapacity) {
- length=targetCapacity;
- }
- while(length>0) {
- b=*source++;
- if(!isLegalUTF7(b)) {
- /* illegal */
- bytes[0]=b;
- byteIndex=1;
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- break;
- } else if(b!=PLUS) {
- /* write directly encoded character */
- *target++=b;
- if(offsets!=NULL) {
- *offsets++=sourceIndex++;
- }
- } else /* PLUS */ {
- /* switch to Unicode mode */
- nextSourceIndex=++sourceIndex;
- inDirectMode=FALSE;
- byteIndex=0;
- bits=0;
- base64Counter=-1;
- goto unicodeMode;
- }
- --length;
- }
- if(source<sourceLimit && target>=targetLimit) {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- } else {
-unicodeMode:
- /*
- * In Unicode (or "escape") Mode, UTF-16BE is base64-encoded.
- * The base64 sequence ends with any character that is not in the base64 alphabet.
- * A terminating minus sign is consumed.
- *
- * In Unicode Mode, the sourceIndex has the index to the start of the current
- * base64 bytes, while nextSourceIndex is precisely parallel to source,
- * keeping the index to the following byte.
- * Note that in 2 out of 3 cases, UChars overlap within a base64 byte.
- */
- while(source<sourceLimit) {
- if(target<targetLimit) {
- bytes[byteIndex++]=b=*source++;
- ++nextSourceIndex;
- base64Value = -3; /* initialize as illegal */
- if(b>=126 || (base64Value=fromBase64[b])==-3 || base64Value==-1) {
- /* either
- * base64Value==-1 for any legal character except base64 and minus sign, or
- * base64Value==-3 for illegal characters:
- * 1. In either case, leave Unicode mode.
- * 2.1. If we ended with an incomplete UChar or none after the +, then
- * generate an error for the preceding erroneous sequence and deal with
- * the current (possibly illegal) character next time through.
- * 2.2. Else the current char comes after a complete UChar, which was already
- * pushed to the output buf, so:
- * 2.2.1. If the current char is legal, just save it for processing next time.
- * It may be for example, a plus which we need to deal with in direct mode.
- * 2.2.2. Else if the current char is illegal, we might as well deal with it here.
- */
- inDirectMode=TRUE;
- if(base64Counter==-1) {
- /* illegal: + immediately followed by something other than base64 or minus sign */
- /* include the plus sign in the reported sequence, but not the subsequent char */
- --source;
- bytes[0]=PLUS;
- byteIndex=1;
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- break;
- } else if(bits!=0) {
- /* bits are illegally left over, a UChar is incomplete */
- /* don't include current char (legal or illegal) in error seq */
- --source;
- --byteIndex;
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- break;
- } else {
- /* previous UChar was complete */
- if(base64Value==-3) {
- /* current character is illegal, deal with it here */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- break;
- } else {
- /* un-read the current character in case it is a plus sign */
- --source;
- sourceIndex=nextSourceIndex-1;
- goto directMode;
- }
- }
- } else if(base64Value>=0) {
- /* collect base64 bytes into UChars */
- switch(base64Counter) {
- case -1: /* -1 is immediately after the + */
- case 0:
- bits=base64Value;
- base64Counter=1;
- break;
- case 1:
- case 3:
- case 4:
- case 6:
- bits=(uint16_t)((bits<<6)|base64Value);
- ++base64Counter;
- break;
- case 2:
- *target++=(UChar)((bits<<4)|(base64Value>>2));
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- sourceIndex=nextSourceIndex-1;
- }
- bytes[0]=b; /* keep this byte in case an error occurs */
- byteIndex=1;
- bits=(uint16_t)(base64Value&3);
- base64Counter=3;
- break;
- case 5:
- *target++=(UChar)((bits<<2)|(base64Value>>4));
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- sourceIndex=nextSourceIndex-1;
- }
- bytes[0]=b; /* keep this byte in case an error occurs */
- byteIndex=1;
- bits=(uint16_t)(base64Value&15);
- base64Counter=6;
- break;
- case 7:
- *target++=(UChar)((bits<<6)|base64Value);
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- sourceIndex=nextSourceIndex;
- }
- byteIndex=0;
- bits=0;
- base64Counter=0;
- break;
- default:
- /* will never occur */
- break;
- }
- } else /*base64Value==-2*/ {
- /* minus sign terminates the base64 sequence */
- inDirectMode=TRUE;
- if(base64Counter==-1) {
- /* +- i.e. a minus immediately following a plus */
- *target++=PLUS;
- if(offsets!=NULL) {
- *offsets++=sourceIndex-1;
- }
- } else {
- /* absorb the minus and leave the Unicode Mode */
- if(bits!=0) {
- /* bits are illegally left over, a UChar is incomplete */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- break;
- }
- }
- sourceIndex=nextSourceIndex;
- goto directMode;
- }
- } else {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- }
- }
-
- if(U_SUCCESS(*pErrorCode) && pArgs->flush && source==sourceLimit && bits==0) {
- /*
- * if we are in Unicode mode, then the byteIndex might not be 0,
- * but that is ok if bits==0
- * -> we set byteIndex=0 at the end of the stream to avoid a truncated error
- * (not true for IMAP-mailbox-name where we must end in direct mode)
- */
- byteIndex=0;
- }
-
- /* set the converter state back into UConverter */
- cnv->toUnicodeStatus=((uint32_t)inDirectMode<<24)|((uint32_t)((uint8_t)base64Counter)<<16)|(uint32_t)bits;
- cnv->toULength=byteIndex;
-
- /* write back the updated pointers */
- pArgs->source=(const char *)source;
- pArgs->target=target;
- pArgs->offsets=offsets;
- return;
-}
-
-static void U_CALLCONV
-_UTF7FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- UConverter *cnv;
- const UChar *source, *sourceLimit;
- uint8_t *target, *targetLimit;
- int32_t *offsets;
-
- int32_t length, targetCapacity, sourceIndex;
- UChar c;
-
- /* UTF-7 state */
- const UBool *encodeDirectly;
- uint8_t bits;
- int8_t base64Counter;
- UBool inDirectMode;
-
- /* set up the local pointers */
- cnv=pArgs->converter;
-
- /* set up the local pointers */
- source=pArgs->source;
- sourceLimit=pArgs->sourceLimit;
- target=(uint8_t *)pArgs->target;
- targetLimit=(uint8_t *)pArgs->targetLimit;
- offsets=pArgs->offsets;
-
- /* get the state machine state */
- {
- uint32_t status=cnv->fromUnicodeStatus;
- encodeDirectly= status<0x10000000 ? encodeDirectlyMaximum : encodeDirectlyRestricted;
- inDirectMode=(UBool)((status>>24)&1);
- base64Counter=(int8_t)(status>>16);
- bits=(uint8_t)status;
- U_ASSERT(bits<=UPRV_LENGTHOF(toBase64));
- }
-
- /* UTF-7 always encodes UTF-16 code units, therefore we need only a simple sourceIndex */
- sourceIndex=0;
-
- if(inDirectMode) {
-directMode:
- length=(int32_t)(sourceLimit-source);
- targetCapacity=(int32_t)(targetLimit-target);
- if(length>targetCapacity) {
- length=targetCapacity;
- }
- while(length>0) {
- c=*source++;
- /* currently always encode CR LF SP TAB directly */
- if(c<=127 && encodeDirectly[c]) {
- /* encode directly */
- *target++=(uint8_t)c;
- if(offsets!=NULL) {
- *offsets++=sourceIndex++;
- }
- } else if(c==PLUS) {
- /* output +- for + */
- *target++=PLUS;
- if(target<targetLimit) {
- *target++=MINUS;
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- *offsets++=sourceIndex++;
- }
- /* realign length and targetCapacity */
- goto directMode;
- } else {
- if(offsets!=NULL) {
- *offsets++=sourceIndex++;
- }
- cnv->charErrorBuffer[0]=MINUS;
- cnv->charErrorBufferLength=1;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- } else {
- /* un-read this character and switch to Unicode Mode */
- --source;
- *target++=PLUS;
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- inDirectMode=FALSE;
- base64Counter=0;
- goto unicodeMode;
- }
- --length;
- }
- if(source<sourceLimit && target>=targetLimit) {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- } else {
-unicodeMode:
- while(source<sourceLimit) {
- if(target<targetLimit) {
- c=*source++;
- if(c<=127 && encodeDirectly[c]) {
- /* encode directly */
- inDirectMode=TRUE;
-
- /* trick: back out this character to make this easier */
- --source;
-
- /* terminate the base64 sequence */
- if(base64Counter!=0) {
- /* write remaining bits for the previous character */
- *target++=toBase64[bits];
- if(offsets!=NULL) {
- *offsets++=sourceIndex-1;
- }
- }
- if(fromBase64[c]!=-1) {
- /* need to terminate with a minus */
- if(target<targetLimit) {
- *target++=MINUS;
- if(offsets!=NULL) {
- *offsets++=sourceIndex-1;
- }
- } else {
- cnv->charErrorBuffer[0]=MINUS;
- cnv->charErrorBufferLength=1;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- }
- goto directMode;
- } else {
- /*
- * base64 this character:
- * Output 2 or 3 base64 bytes for the remaining bits of the previous character
- * and the bits of this character, each implicitly in UTF-16BE.
- *
- * Here, bits is an 8-bit variable because only 6 bits need to be kept from one
- * character to the next. The actual 2 or 4 bits are shifted to the left edge
- * of the 6-bits field 5..0 to make the termination of the base64 sequence easier.
- */
- switch(base64Counter) {
- case 0:
- *target++=toBase64[c>>10];
- if(target<targetLimit) {
- *target++=toBase64[(c>>4)&0x3f];
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- *offsets++=sourceIndex++;
- }
- } else {
- if(offsets!=NULL) {
- *offsets++=sourceIndex++;
- }
- cnv->charErrorBuffer[0]=toBase64[(c>>4)&0x3f];
- cnv->charErrorBufferLength=1;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- bits=(uint8_t)((c&15)<<2);
- base64Counter=1;
- break;
- case 1:
- *target++=toBase64[bits|(c>>14)];
- if(target<targetLimit) {
- *target++=toBase64[(c>>8)&0x3f];
- if(target<targetLimit) {
- *target++=toBase64[(c>>2)&0x3f];
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- *offsets++=sourceIndex;
- *offsets++=sourceIndex++;
- }
- } else {
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- *offsets++=sourceIndex++;
- }
- cnv->charErrorBuffer[0]=toBase64[(c>>2)&0x3f];
- cnv->charErrorBufferLength=1;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- } else {
- if(offsets!=NULL) {
- *offsets++=sourceIndex++;
- }
- cnv->charErrorBuffer[0]=toBase64[(c>>8)&0x3f];
- cnv->charErrorBuffer[1]=toBase64[(c>>2)&0x3f];
- cnv->charErrorBufferLength=2;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- bits=(uint8_t)((c&3)<<4);
- base64Counter=2;
- break;
- case 2:
- *target++=toBase64[bits|(c>>12)];
- if(target<targetLimit) {
- *target++=toBase64[(c>>6)&0x3f];
- if(target<targetLimit) {
- *target++=toBase64[c&0x3f];
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- *offsets++=sourceIndex;
- *offsets++=sourceIndex++;
- }
- } else {
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- *offsets++=sourceIndex++;
- }
- cnv->charErrorBuffer[0]=toBase64[c&0x3f];
- cnv->charErrorBufferLength=1;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- } else {
- if(offsets!=NULL) {
- *offsets++=sourceIndex++;
- }
- cnv->charErrorBuffer[0]=toBase64[(c>>6)&0x3f];
- cnv->charErrorBuffer[1]=toBase64[c&0x3f];
- cnv->charErrorBufferLength=2;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- bits=0;
- base64Counter=0;
- break;
- default:
- /* will never occur */
- break;
- }
- }
- } else {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- }
- }
-
- if(pArgs->flush && source>=sourceLimit) {
- /* flush remaining bits to the target */
- if(!inDirectMode) {
- if (base64Counter!=0) {
- if(target<targetLimit) {
- *target++=toBase64[bits];
- if(offsets!=NULL) {
- *offsets++=sourceIndex-1;
- }
- } else {
- cnv->charErrorBuffer[cnv->charErrorBufferLength++]=toBase64[bits];
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- }
- /* Add final MINUS to terminate unicodeMode */
- if(target<targetLimit) {
- *target++=MINUS;
- if(offsets!=NULL) {
- *offsets++=sourceIndex-1;
- }
- } else {
- cnv->charErrorBuffer[cnv->charErrorBufferLength++]=MINUS;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- }
- /* reset the state for the next conversion */
- cnv->fromUnicodeStatus=(cnv->fromUnicodeStatus&0xf0000000)|0x1000000; /* keep version, inDirectMode=TRUE */
- } else {
- /* set the converter state back into UConverter */
- cnv->fromUnicodeStatus=
- (cnv->fromUnicodeStatus&0xf0000000)| /* keep version*/
- ((uint32_t)inDirectMode<<24)|((uint32_t)base64Counter<<16)|(uint32_t)bits;
- }
-
- /* write back the updated pointers */
- pArgs->source=source;
- pArgs->target=(char *)target;
- pArgs->offsets=offsets;
- return;
-}
-
-static const char * U_CALLCONV
-_UTF7GetName(const UConverter *cnv) {
- switch(cnv->fromUnicodeStatus>>28) {
- case 1:
- return "UTF-7,version=1";
- default:
- return "UTF-7";
- }
-}
-U_CDECL_END
-
-static const UConverterImpl _UTF7Impl={
- UCNV_UTF7,
-
- NULL,
- NULL,
-
- _UTF7Open,
- NULL,
- _UTF7Reset,
-
- _UTF7ToUnicodeWithOffsets,
- _UTF7ToUnicodeWithOffsets,
- _UTF7FromUnicodeWithOffsets,
- _UTF7FromUnicodeWithOffsets,
- NULL,
-
- NULL,
- _UTF7GetName,
- NULL, /* we don't need writeSub() because we never call a callback at fromUnicode() */
- NULL,
- ucnv_getCompleteUnicodeSet,
-
- NULL,
- NULL
-};
-
-static const UConverterStaticData _UTF7StaticData={
- sizeof(UConverterStaticData),
- "UTF-7",
- 0, /* TODO CCSID for UTF-7 */
- UCNV_IBM, UCNV_UTF7,
- 1, 4,
- { 0x3f, 0, 0, 0 }, 1, /* the subchar is not used */
- FALSE, FALSE,
- 0,
- 0,
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
-};
-
-const UConverterSharedData _UTF7Data=
- UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF7StaticData, &_UTF7Impl);
-
-/* IMAP mailbox name encoding ----------------------------------------------- */
-
-/*
- * RFC 2060: INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1
- * http://www.ietf.org/rfc/rfc2060.txt
- *
- * 5.1.3. Mailbox International Naming Convention
- *
- * By convention, international mailbox names are specified using a
- * modified version of the UTF-7 encoding described in [UTF-7]. The
- * purpose of these modifications is to correct the following problems
- * with UTF-7:
- *
- * 1) UTF-7 uses the "+" character for shifting; this conflicts with
- * the common use of "+" in mailbox names, in particular USENET
- * newsgroup names.
- *
- * 2) UTF-7's encoding is BASE64 which uses the "/" character; this
- * conflicts with the use of "/" as a popular hierarchy delimiter.
- *
- * 3) UTF-7 prohibits the unencoded usage of "\"; this conflicts with
- * the use of "\" as a popular hierarchy delimiter.
- *
- * 4) UTF-7 prohibits the unencoded usage of "~"; this conflicts with
- * the use of "~" in some servers as a home directory indicator.
- *
- * 5) UTF-7 permits multiple alternate forms to represent the same
- * string; in particular, printable US-ASCII chararacters can be
- * represented in encoded form.
- *
- * In modified UTF-7, printable US-ASCII characters except for "&"
- * represent themselves; that is, characters with octet values 0x20-0x25
- * and 0x27-0x7e. The character "&" (0x26) is represented by the two-
- * octet sequence "&-".
- *
- * All other characters (octet values 0x00-0x1f, 0x7f-0xff, and all
- * Unicode 16-bit octets) are represented in modified BASE64, with a
- * further modification from [UTF-7] that "," is used instead of "/".
- * Modified BASE64 MUST NOT be used to represent any printing US-ASCII
- * character which can represent itself.
- *
- * "&" is used to shift to modified BASE64 and "-" to shift back to US-
- * ASCII. All names start in US-ASCII, and MUST end in US-ASCII (that
- * is, a name that ends with a Unicode 16-bit octet MUST end with a "-
- * ").
- *
- * For example, here is a mailbox name which mixes English, Japanese,
- * and Chinese text: ~peter/mail/&ZeVnLIqe-/&U,BTFw-
- */
-
-/*
- * Tests for US-ASCII characters belonging to character classes
- * defined in UTF-7.
- *
- * Set D (directly encoded characters) consists of the following
- * characters: the upper and lower case letters A through Z
- * and a through z, the 10 digits 0-9, and the following nine special
- * characters (note that "+" and "=" are omitted):
- * '(),-./:?
- *
- * Set O (optional direct characters) consists of the following
- * characters (note that "\" and "~" are omitted):
- * !"#$%&*;<=>@[]^_`{|}
- *
- * According to the rules in RFC 2152, the byte values for the following
- * US-ASCII characters are not used in UTF-7 and are therefore illegal:
- * - all C0 control codes except for CR LF TAB
- * - BACKSLASH
- * - TILDE
- * - DEL
- * - all codes beyond US-ASCII, i.e. all >127
- */
-
-/* uses '&' not '+' to start a base64 sequence */
-#define AMPERSAND 0x26
-#define COMMA 0x2c
-#define SLASH 0x2f
-
-/* legal byte values: all US-ASCII graphic characters 0x20..0x7e */
-#define isLegalIMAP(c) (0x20<=(c) && (c)<=0x7e)
-
-/* direct-encode all of printable ASCII 0x20..0x7e except '&' 0x26 */
-#define inSetDIMAP(c) (isLegalIMAP(c) && c!=AMPERSAND)
-
-#define TO_BASE64_IMAP(n) ((n)<63 ? toBase64[n] : COMMA)
-#define FROM_BASE64_IMAP(c) ((c)==COMMA ? 63 : (c)==SLASH ? -1 : fromBase64[c])
-
-/*
- * converter status values:
- *
- * toUnicodeStatus:
- * 24 inDirectMode (boolean)
- * 23..16 base64Counter (-1..7)
- * 15..0 bits (up to 14 bits incoming base64)
- *
- * fromUnicodeStatus:
- * 24 inDirectMode (boolean)
- * 23..16 base64Counter (0..2)
- * 7..0 bits (6 bits outgoing base64)
- *
- * ignore bits 31..25
- */
-
-U_CDECL_BEGIN
-static void U_CALLCONV
-_IMAPToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- UConverter *cnv;
- const uint8_t *source, *sourceLimit;
- UChar *target;
- const UChar *targetLimit;
- int32_t *offsets;
-
- uint8_t *bytes;
- uint8_t byteIndex;
-
- int32_t length, targetCapacity;
-
- /* UTF-7 state */
- uint16_t bits;
- int8_t base64Counter;
- UBool inDirectMode;
-
- int8_t base64Value;
-
- int32_t sourceIndex, nextSourceIndex;
-
- UChar c;
- uint8_t b;
-
- /* set up the local pointers */
- cnv=pArgs->converter;
-
- source=(const uint8_t *)pArgs->source;
- sourceLimit=(const uint8_t *)pArgs->sourceLimit;
- target=pArgs->target;
- targetLimit=pArgs->targetLimit;
- offsets=pArgs->offsets;
- /* get the state machine state */
- {
- uint32_t status=cnv->toUnicodeStatus;
- inDirectMode=(UBool)((status>>24)&1);
- base64Counter=(int8_t)(status>>16);
- bits=(uint16_t)status;
- }
- bytes=cnv->toUBytes;
- byteIndex=cnv->toULength;
-
- /* sourceIndex=-1 if the current character began in the previous buffer */
- sourceIndex=byteIndex==0 ? 0 : -1;
- nextSourceIndex=0;
-
- if(inDirectMode) {
-directMode:
- /*
- * In Direct Mode, US-ASCII characters are encoded directly, i.e.,
- * with their US-ASCII byte values.
- * An ampersand starts Unicode (or "escape") Mode.
- *
- * In Direct Mode, only the sourceIndex is used.
- */
- byteIndex=0;
- length=(int32_t)(sourceLimit-source);
- targetCapacity=(int32_t)(targetLimit-target);
- if(length>targetCapacity) {
- length=targetCapacity;
- }
- while(length>0) {
- b=*source++;
- if(!isLegalIMAP(b)) {
- /* illegal */
- bytes[0]=b;
- byteIndex=1;
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- break;
- } else if(b!=AMPERSAND) {
- /* write directly encoded character */
- *target++=b;
- if(offsets!=NULL) {
- *offsets++=sourceIndex++;
- }
- } else /* AMPERSAND */ {
- /* switch to Unicode mode */
- nextSourceIndex=++sourceIndex;
- inDirectMode=FALSE;
- byteIndex=0;
- bits=0;
- base64Counter=-1;
- goto unicodeMode;
- }
- --length;
- }
- if(source<sourceLimit && target>=targetLimit) {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- } else {
-unicodeMode:
- /*
- * In Unicode (or "escape") Mode, UTF-16BE is base64-encoded.
- * The base64 sequence ends with any character that is not in the base64 alphabet.
- * A terminating minus sign is consumed.
- * US-ASCII must not be base64-ed.
- *
- * In Unicode Mode, the sourceIndex has the index to the start of the current
- * base64 bytes, while nextSourceIndex is precisely parallel to source,
- * keeping the index to the following byte.
- * Note that in 2 out of 3 cases, UChars overlap within a base64 byte.
- */
- while(source<sourceLimit) {
- if(target<targetLimit) {
- bytes[byteIndex++]=b=*source++;
- ++nextSourceIndex;
- if(b>0x7e) {
- /* illegal - test other illegal US-ASCII values by base64Value==-3 */
- inDirectMode=TRUE;
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- break;
- } else if((base64Value=FROM_BASE64_IMAP(b))>=0) {
- /* collect base64 bytes into UChars */
- switch(base64Counter) {
- case -1: /* -1 is immediately after the & */
- case 0:
- bits=base64Value;
- base64Counter=1;
- break;
- case 1:
- case 3:
- case 4:
- case 6:
- bits=(uint16_t)((bits<<6)|base64Value);
- ++base64Counter;
- break;
- case 2:
- c=(UChar)((bits<<4)|(base64Value>>2));
- if(isLegalIMAP(c)) {
- /* illegal */
- inDirectMode=TRUE;
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- goto endloop;
- }
- *target++=c;
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- sourceIndex=nextSourceIndex-1;
- }
- bytes[0]=b; /* keep this byte in case an error occurs */
- byteIndex=1;
- bits=(uint16_t)(base64Value&3);
- base64Counter=3;
- break;
- case 5:
- c=(UChar)((bits<<2)|(base64Value>>4));
- if(isLegalIMAP(c)) {
- /* illegal */
- inDirectMode=TRUE;
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- goto endloop;
- }
- *target++=c;
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- sourceIndex=nextSourceIndex-1;
- }
- bytes[0]=b; /* keep this byte in case an error occurs */
- byteIndex=1;
- bits=(uint16_t)(base64Value&15);
- base64Counter=6;
- break;
- case 7:
- c=(UChar)((bits<<6)|base64Value);
- if(isLegalIMAP(c)) {
- /* illegal */
- inDirectMode=TRUE;
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- goto endloop;
- }
- *target++=c;
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- sourceIndex=nextSourceIndex;
- }
- byteIndex=0;
- bits=0;
- base64Counter=0;
- break;
- default:
- /* will never occur */
- break;
- }
- } else if(base64Value==-2) {
- /* minus sign terminates the base64 sequence */
- inDirectMode=TRUE;
- if(base64Counter==-1) {
- /* &- i.e. a minus immediately following an ampersand */
- *target++=AMPERSAND;
- if(offsets!=NULL) {
- *offsets++=sourceIndex-1;
- }
- } else {
- /* absorb the minus and leave the Unicode Mode */
- if(bits!=0 || (base64Counter!=0 && base64Counter!=3 && base64Counter!=6)) {
- /* bits are illegally left over, a UChar is incomplete */
- /* base64Counter other than 0, 3, 6 means non-minimal zero-padding, also illegal */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- break;
- }
- }
- sourceIndex=nextSourceIndex;
- goto directMode;
- } else {
- if(base64Counter==-1) {
- /* illegal: & immediately followed by something other than base64 or minus sign */
- /* include the ampersand in the reported sequence */
- --sourceIndex;
- bytes[0]=AMPERSAND;
- bytes[1]=b;
- byteIndex=2;
- }
- /* base64Value==-1 for characters that are illegal only in Unicode mode */
- /* base64Value==-3 for illegal characters */
- /* illegal */
- inDirectMode=TRUE;
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- break;
- }
- } else {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- }
- }
-endloop:
-
- /*
- * the end of the input stream and detection of truncated input
- * are handled by the framework, but here we must check if we are in Unicode
- * mode and byteIndex==0 because we must end in direct mode
- *
- * conditions:
- * successful
- * in Unicode mode and byteIndex==0
- * end of input and no truncated input
- */
- if( U_SUCCESS(*pErrorCode) &&
- !inDirectMode && byteIndex==0 &&
- pArgs->flush && source>=sourceLimit
- ) {
- if(base64Counter==-1) {
- /* & at the very end of the input */
- /* make the ampersand the reported sequence */
- bytes[0]=AMPERSAND;
- byteIndex=1;
- }
- /* else if(base64Counter!=-1) byteIndex remains 0 because there is no particular byte sequence */
-
- inDirectMode=TRUE; /* avoid looping */
- *pErrorCode=U_TRUNCATED_CHAR_FOUND;
- }
-
- /* set the converter state back into UConverter */
- cnv->toUnicodeStatus=((uint32_t)inDirectMode<<24)|((uint32_t)((uint8_t)base64Counter)<<16)|(uint32_t)bits;
- cnv->toULength=byteIndex;
-
- /* write back the updated pointers */
- pArgs->source=(const char *)source;
- pArgs->target=target;
- pArgs->offsets=offsets;
- return;
-}
-
-static void U_CALLCONV
-_IMAPFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- UConverter *cnv;
- const UChar *source, *sourceLimit;
- uint8_t *target, *targetLimit;
- int32_t *offsets;
-
- int32_t length, targetCapacity, sourceIndex;
- UChar c;
- uint8_t b;
-
- /* UTF-7 state */
- uint8_t bits;
- int8_t base64Counter;
- UBool inDirectMode;
-
- /* set up the local pointers */
- cnv=pArgs->converter;
-
- /* set up the local pointers */
- source=pArgs->source;
- sourceLimit=pArgs->sourceLimit;
- target=(uint8_t *)pArgs->target;
- targetLimit=(uint8_t *)pArgs->targetLimit;
- offsets=pArgs->offsets;
-
- /* get the state machine state */
- {
- uint32_t status=cnv->fromUnicodeStatus;
- inDirectMode=(UBool)((status>>24)&1);
- base64Counter=(int8_t)(status>>16);
- bits=(uint8_t)status;
- }
-
- /* UTF-7 always encodes UTF-16 code units, therefore we need only a simple sourceIndex */
- sourceIndex=0;
-
- if(inDirectMode) {
-directMode:
- length=(int32_t)(sourceLimit-source);
- targetCapacity=(int32_t)(targetLimit-target);
- if(length>targetCapacity) {
- length=targetCapacity;
- }
- while(length>0) {
- c=*source++;
- /* encode 0x20..0x7e except '&' directly */
- if(inSetDIMAP(c)) {
- /* encode directly */
- *target++=(uint8_t)c;
- if(offsets!=NULL) {
- *offsets++=sourceIndex++;
- }
- } else if(c==AMPERSAND) {
- /* output &- for & */
- *target++=AMPERSAND;
- if(target<targetLimit) {
- *target++=MINUS;
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- *offsets++=sourceIndex++;
- }
- /* realign length and targetCapacity */
- goto directMode;
- } else {
- if(offsets!=NULL) {
- *offsets++=sourceIndex++;
- }
- cnv->charErrorBuffer[0]=MINUS;
- cnv->charErrorBufferLength=1;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- } else {
- /* un-read this character and switch to Unicode Mode */
- --source;
- *target++=AMPERSAND;
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- inDirectMode=FALSE;
- base64Counter=0;
- goto unicodeMode;
- }
- --length;
- }
- if(source<sourceLimit && target>=targetLimit) {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- } else {
-unicodeMode:
- while(source<sourceLimit) {
- if(target<targetLimit) {
- c=*source++;
- if(isLegalIMAP(c)) {
- /* encode directly */
- inDirectMode=TRUE;
-
- /* trick: back out this character to make this easier */
- --source;
-
- /* terminate the base64 sequence */
- if(base64Counter!=0) {
- /* write remaining bits for the previous character */
- *target++=TO_BASE64_IMAP(bits);
- if(offsets!=NULL) {
- *offsets++=sourceIndex-1;
- }
- }
- /* need to terminate with a minus */
- if(target<targetLimit) {
- *target++=MINUS;
- if(offsets!=NULL) {
- *offsets++=sourceIndex-1;
- }
- } else {
- cnv->charErrorBuffer[0]=MINUS;
- cnv->charErrorBufferLength=1;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- goto directMode;
- } else {
- /*
- * base64 this character:
- * Output 2 or 3 base64 bytes for the remaining bits of the previous character
- * and the bits of this character, each implicitly in UTF-16BE.
- *
- * Here, bits is an 8-bit variable because only 6 bits need to be kept from one
- * character to the next. The actual 2 or 4 bits are shifted to the left edge
- * of the 6-bits field 5..0 to make the termination of the base64 sequence easier.
- */
- switch(base64Counter) {
- case 0:
- b=(uint8_t)(c>>10);
- *target++=TO_BASE64_IMAP(b);
- if(target<targetLimit) {
- b=(uint8_t)((c>>4)&0x3f);
- *target++=TO_BASE64_IMAP(b);
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- *offsets++=sourceIndex++;
- }
- } else {
- if(offsets!=NULL) {
- *offsets++=sourceIndex++;
- }
- b=(uint8_t)((c>>4)&0x3f);
- cnv->charErrorBuffer[0]=TO_BASE64_IMAP(b);
- cnv->charErrorBufferLength=1;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- bits=(uint8_t)((c&15)<<2);
- base64Counter=1;
- break;
- case 1:
- b=(uint8_t)(bits|(c>>14));
- *target++=TO_BASE64_IMAP(b);
- if(target<targetLimit) {
- b=(uint8_t)((c>>8)&0x3f);
- *target++=TO_BASE64_IMAP(b);
- if(target<targetLimit) {
- b=(uint8_t)((c>>2)&0x3f);
- *target++=TO_BASE64_IMAP(b);
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- *offsets++=sourceIndex;
- *offsets++=sourceIndex++;
- }
- } else {
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- *offsets++=sourceIndex++;
- }
- b=(uint8_t)((c>>2)&0x3f);
- cnv->charErrorBuffer[0]=TO_BASE64_IMAP(b);
- cnv->charErrorBufferLength=1;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- } else {
- if(offsets!=NULL) {
- *offsets++=sourceIndex++;
- }
- b=(uint8_t)((c>>8)&0x3f);
- cnv->charErrorBuffer[0]=TO_BASE64_IMAP(b);
- b=(uint8_t)((c>>2)&0x3f);
- cnv->charErrorBuffer[1]=TO_BASE64_IMAP(b);
- cnv->charErrorBufferLength=2;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- bits=(uint8_t)((c&3)<<4);
- base64Counter=2;
- break;
- case 2:
- b=(uint8_t)(bits|(c>>12));
- *target++=TO_BASE64_IMAP(b);
- if(target<targetLimit) {
- b=(uint8_t)((c>>6)&0x3f);
- *target++=TO_BASE64_IMAP(b);
- if(target<targetLimit) {
- b=(uint8_t)(c&0x3f);
- *target++=TO_BASE64_IMAP(b);
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- *offsets++=sourceIndex;
- *offsets++=sourceIndex++;
- }
- } else {
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- *offsets++=sourceIndex++;
- }
- b=(uint8_t)(c&0x3f);
- cnv->charErrorBuffer[0]=TO_BASE64_IMAP(b);
- cnv->charErrorBufferLength=1;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- } else {
- if(offsets!=NULL) {
- *offsets++=sourceIndex++;
- }
- b=(uint8_t)((c>>6)&0x3f);
- cnv->charErrorBuffer[0]=TO_BASE64_IMAP(b);
- b=(uint8_t)(c&0x3f);
- cnv->charErrorBuffer[1]=TO_BASE64_IMAP(b);
- cnv->charErrorBufferLength=2;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- bits=0;
- base64Counter=0;
- break;
- default:
- /* will never occur */
- break;
- }
- }
- } else {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- }
- }
-
- if(pArgs->flush && source>=sourceLimit) {
- /* flush remaining bits to the target */
- if(!inDirectMode) {
- if(base64Counter!=0) {
- if(target<targetLimit) {
- *target++=TO_BASE64_IMAP(bits);
- if(offsets!=NULL) {
- *offsets++=sourceIndex-1;
- }
- } else {
- cnv->charErrorBuffer[cnv->charErrorBufferLength++]=TO_BASE64_IMAP(bits);
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- }
- /* need to terminate with a minus */
- if(target<targetLimit) {
- *target++=MINUS;
- if(offsets!=NULL) {
- *offsets++=sourceIndex-1;
- }
- } else {
- cnv->charErrorBuffer[cnv->charErrorBufferLength++]=MINUS;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
- }
- /* reset the state for the next conversion */
- cnv->fromUnicodeStatus=(cnv->fromUnicodeStatus&0xf0000000)|0x1000000; /* keep version, inDirectMode=TRUE */
- } else {
- /* set the converter state back into UConverter */
- cnv->fromUnicodeStatus=
- (cnv->fromUnicodeStatus&0xf0000000)| /* keep version*/
- ((uint32_t)inDirectMode<<24)|((uint32_t)base64Counter<<16)|(uint32_t)bits;
- }
-
- /* write back the updated pointers */
- pArgs->source=source;
- pArgs->target=(char *)target;
- pArgs->offsets=offsets;
- return;
-}
-U_CDECL_END
-
-static const UConverterImpl _IMAPImpl={
- UCNV_IMAP_MAILBOX,
-
- NULL,
- NULL,
-
- _UTF7Open,
- NULL,
- _UTF7Reset,
-
- _IMAPToUnicodeWithOffsets,
- _IMAPToUnicodeWithOffsets,
- _IMAPFromUnicodeWithOffsets,
- _IMAPFromUnicodeWithOffsets,
- NULL,
-
- NULL,
- NULL,
- NULL, /* we don't need writeSub() because we never call a callback at fromUnicode() */
- NULL,
- ucnv_getCompleteUnicodeSet,
- NULL,
- NULL
-};
-
-static const UConverterStaticData _IMAPStaticData={
- sizeof(UConverterStaticData),
- "IMAP-mailbox-name",
- 0, /* TODO CCSID for IMAP-mailbox-name */
- UCNV_IBM, UCNV_IMAP_MAILBOX,
- 1, 4,
- { 0x3f, 0, 0, 0 }, 1, /* the subchar is not used */
- FALSE, FALSE,
- 0,
- 0,
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
-};
-
-const UConverterSharedData _IMAPData=
- UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_IMAPStaticData, &_IMAPImpl);
-
-#endif
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+**********************************************************************
+* Copyright (C) 2002-2016, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* file name: ucnv_u7.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2002jul01
+* created by: Markus W. Scherer
+*
+* UTF-7 converter implementation. Used to be in ucnv_utf.c.
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION
+
+#include "cmemory.h"
+#include "unicode/ucnv.h"
+#include "ucnv_bld.h"
+#include "ucnv_cnv.h"
+#include "uassert.h"
+
+/* UTF-7 -------------------------------------------------------------------- */
+
+/*
+ * UTF-7 is a stateful encoding of Unicode.
+ * It is defined in RFC 2152. (http://www.ietf.org/rfc/rfc2152.txt)
+ * It was intended for use in Internet email systems, using in its bytewise
+ * encoding only a subset of 7-bit US-ASCII.
+ * UTF-7 is deprecated in favor of UTF-8/16/32 and SCSU, but still
+ * occasionally used.
+ *
+ * For converting Unicode to UTF-7, the RFC allows to encode some US-ASCII
+ * characters directly or in base64. Especially, the characters in set O
+ * as defined in the RFC (see below) may be encoded directly but are not
+ * allowed in, e.g., email headers.
+ * By default, the ICU UTF-7 converter encodes set O directly.
+ * By choosing the option "version=1", set O will be escaped instead.
+ * For example:
+ * utf7Converter=ucnv_open("UTF-7,version=1");
+ *
+ * For details about email headers see RFC 2047.
+ */
+
+/*
+ * Tests for US-ASCII characters belonging to character classes
+ * defined in UTF-7.
+ *
+ * Set D (directly encoded characters) consists of the following
+ * characters: the upper and lower case letters A through Z
+ * and a through z, the 10 digits 0-9, and the following nine special
+ * characters (note that "+" and "=" are omitted):
+ * '(),-./:?
+ *
+ * Set O (optional direct characters) consists of the following
+ * characters (note that "\" and "~" are omitted):
+ * !"#$%&*;<=>@[]^_`{|}
+ *
+ * According to the rules in RFC 2152, the byte values for the following
+ * US-ASCII characters are not used in UTF-7 and are therefore illegal:
+ * - all C0 control codes except for CR LF TAB
+ * - BACKSLASH
+ * - TILDE
+ * - DEL
+ * - all codes beyond US-ASCII, i.e. all >127
+ */
+#define inSetD(c) \
+ ((uint8_t)((c)-97)<26 || (uint8_t)((c)-65)<26 || /* letters */ \
+ (uint8_t)((c)-48)<10 || /* digits */ \
+ (uint8_t)((c)-39)<3 || /* '() */ \
+ (uint8_t)((c)-44)<4 || /* ,-./ */ \
+ (c)==58 || (c)==63 /* :? */ \
+ )
+
+#define inSetO(c) \
+ ((uint8_t)((c)-33)<6 || /* !"#$%& */ \
+ (uint8_t)((c)-59)<4 || /* ;<=> */ \
+ (uint8_t)((c)-93)<4 || /* ]^_` */ \
+ (uint8_t)((c)-123)<3 || /* {|} */ \
+ (c)==42 || (c)==64 || (c)==91 /* *@[ */ \
+ )
+
+#define isCRLFTAB(c) ((c)==13 || (c)==10 || (c)==9)
+#define isCRLFSPTAB(c) ((c)==32 || (c)==13 || (c)==10 || (c)==9)
+
+#define PLUS 43
+#define MINUS 45
+#define BACKSLASH 92
+#define TILDE 126
+
+/* legal byte values: all US-ASCII graphic characters from space to before tilde, and CR LF TAB */
+#define isLegalUTF7(c) (((uint8_t)((c)-32)<94 && (c)!=BACKSLASH) || isCRLFTAB(c))
+
+/* encode directly sets D and O and CR LF SP TAB */
+static const UBool encodeDirectlyMaximum[128]={
+ /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 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, 0, 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, 0, 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, 0, 0
+};
+
+/* encode directly set D and CR LF SP TAB but not set O */
+static const UBool encodeDirectlyRestricted[128]={
+ /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
+ 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,
+
+ 0, 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, 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, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
+};
+
+static const uint8_t
+toBase64[64]={
+ /* A-Z */
+ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
+ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
+ /* a-z */
+ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
+ 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
+ /* 0-9 */
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
+ /* +/ */
+ 43, 47
+};
+
+static const int8_t
+fromBase64[128]={
+ /* C0 controls, -1 for legal ones (CR LF TAB), -3 for illegal ones */
+ -3, -3, -3, -3, -3, -3, -3, -3, -3, -1, -1, -3, -3, -1, -3, -3,
+ -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
+
+ /* general punctuation with + and / and a special value (-2) for - */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -2, -1, 63,
+ /* digits */
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
+
+ /* A-Z */
+ -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, -3, -1, -1, -1,
+
+ /* a-z */
+ -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -3, -3
+};
+
+/*
+ * converter status values:
+ *
+ * toUnicodeStatus:
+ * 24 inDirectMode (boolean)
+ * 23..16 base64Counter (-1..7)
+ * 15..0 bits (up to 14 bits incoming base64)
+ *
+ * fromUnicodeStatus:
+ * 31..28 version (0: set O direct 1: set O escaped)
+ * 24 inDirectMode (boolean)
+ * 23..16 base64Counter (0..2)
+ * 7..0 bits (6 bits outgoing base64)
+ *
+ */
+
+U_CDECL_BEGIN
+static void U_CALLCONV
+_UTF7Reset(UConverter *cnv, UConverterResetChoice choice) {
+ if(choice<=UCNV_RESET_TO_UNICODE) {
+ /* reset toUnicode */
+ cnv->toUnicodeStatus=0x1000000; /* inDirectMode=TRUE */
+ cnv->toULength=0;
+ }
+ if(choice!=UCNV_RESET_TO_UNICODE) {
+ /* reset fromUnicode */
+ cnv->fromUnicodeStatus=(cnv->fromUnicodeStatus&0xf0000000)|0x1000000; /* keep version, inDirectMode=TRUE */
+ }
+}
+
+static void U_CALLCONV
+_UTF7Open(UConverter *cnv,
+ UConverterLoadArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ (void)pArgs;
+ if(UCNV_GET_VERSION(cnv)<=1) {
+ /* TODO(markus): Should just use cnv->options rather than copying the version number. */
+ cnv->fromUnicodeStatus=UCNV_GET_VERSION(cnv)<<28;
+ _UTF7Reset(cnv, UCNV_RESET_BOTH);
+ } else {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ }
+}
+
+static void U_CALLCONV
+_UTF7ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ UConverter *cnv;
+ const uint8_t *source, *sourceLimit;
+ UChar *target;
+ const UChar *targetLimit;
+ int32_t *offsets;
+
+ uint8_t *bytes;
+ uint8_t byteIndex;
+
+ int32_t length, targetCapacity;
+
+ /* UTF-7 state */
+ uint16_t bits;
+ int8_t base64Counter;
+ UBool inDirectMode;
+
+ int8_t base64Value;
+
+ int32_t sourceIndex, nextSourceIndex;
+
+ uint8_t b;
+ /* set up the local pointers */
+ cnv=pArgs->converter;
+
+ source=(const uint8_t *)pArgs->source;
+ sourceLimit=(const uint8_t *)pArgs->sourceLimit;
+ target=pArgs->target;
+ targetLimit=pArgs->targetLimit;
+ offsets=pArgs->offsets;
+ /* get the state machine state */
+ {
+ uint32_t status=cnv->toUnicodeStatus;
+ inDirectMode=(UBool)((status>>24)&1);
+ base64Counter=(int8_t)(status>>16);
+ bits=(uint16_t)status;
+ }
+ bytes=cnv->toUBytes;
+ byteIndex=cnv->toULength;
+
+ /* sourceIndex=-1 if the current character began in the previous buffer */
+ sourceIndex=byteIndex==0 ? 0 : -1;
+ nextSourceIndex=0;
+
+ if(inDirectMode) {
+directMode:
+ /*
+ * In Direct Mode, most US-ASCII characters are encoded directly, i.e.,
+ * with their US-ASCII byte values.
+ * Backslash and Tilde and most control characters are not allowed in UTF-7.
+ * A plus sign starts Unicode (or "escape") Mode.
+ *
+ * In Direct Mode, only the sourceIndex is used.
+ */
+ byteIndex=0;
+ length=(int32_t)(sourceLimit-source);
+ targetCapacity=(int32_t)(targetLimit-target);
+ if(length>targetCapacity) {
+ length=targetCapacity;
+ }
+ while(length>0) {
+ b=*source++;
+ if(!isLegalUTF7(b)) {
+ /* illegal */
+ bytes[0]=b;
+ byteIndex=1;
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ break;
+ } else if(b!=PLUS) {
+ /* write directly encoded character */
+ *target++=b;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex++;
+ }
+ } else /* PLUS */ {
+ /* switch to Unicode mode */
+ nextSourceIndex=++sourceIndex;
+ inDirectMode=FALSE;
+ byteIndex=0;
+ bits=0;
+ base64Counter=-1;
+ goto unicodeMode;
+ }
+ --length;
+ }
+ if(source<sourceLimit && target>=targetLimit) {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ } else {
+unicodeMode:
+ /*
+ * In Unicode (or "escape") Mode, UTF-16BE is base64-encoded.
+ * The base64 sequence ends with any character that is not in the base64 alphabet.
+ * A terminating minus sign is consumed.
+ *
+ * In Unicode Mode, the sourceIndex has the index to the start of the current
+ * base64 bytes, while nextSourceIndex is precisely parallel to source,
+ * keeping the index to the following byte.
+ * Note that in 2 out of 3 cases, UChars overlap within a base64 byte.
+ */
+ while(source<sourceLimit) {
+ if(target<targetLimit) {
+ bytes[byteIndex++]=b=*source++;
+ ++nextSourceIndex;
+ base64Value = -3; /* initialize as illegal */
+ if(b>=126 || (base64Value=fromBase64[b])==-3 || base64Value==-1) {
+ /* either
+ * base64Value==-1 for any legal character except base64 and minus sign, or
+ * base64Value==-3 for illegal characters:
+ * 1. In either case, leave Unicode mode.
+ * 2.1. If we ended with an incomplete UChar or none after the +, then
+ * generate an error for the preceding erroneous sequence and deal with
+ * the current (possibly illegal) character next time through.
+ * 2.2. Else the current char comes after a complete UChar, which was already
+ * pushed to the output buf, so:
+ * 2.2.1. If the current char is legal, just save it for processing next time.
+ * It may be for example, a plus which we need to deal with in direct mode.
+ * 2.2.2. Else if the current char is illegal, we might as well deal with it here.
+ */
+ inDirectMode=TRUE;
+ if(base64Counter==-1) {
+ /* illegal: + immediately followed by something other than base64 or minus sign */
+ /* include the plus sign in the reported sequence, but not the subsequent char */
+ --source;
+ bytes[0]=PLUS;
+ byteIndex=1;
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ break;
+ } else if(bits!=0) {
+ /* bits are illegally left over, a UChar is incomplete */
+ /* don't include current char (legal or illegal) in error seq */
+ --source;
+ --byteIndex;
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ break;
+ } else {
+ /* previous UChar was complete */
+ if(base64Value==-3) {
+ /* current character is illegal, deal with it here */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ break;
+ } else {
+ /* un-read the current character in case it is a plus sign */
+ --source;
+ sourceIndex=nextSourceIndex-1;
+ goto directMode;
+ }
+ }
+ } else if(base64Value>=0) {
+ /* collect base64 bytes into UChars */
+ switch(base64Counter) {
+ case -1: /* -1 is immediately after the + */
+ case 0:
+ bits=base64Value;
+ base64Counter=1;
+ break;
+ case 1:
+ case 3:
+ case 4:
+ case 6:
+ bits=(uint16_t)((bits<<6)|base64Value);
+ ++base64Counter;
+ break;
+ case 2:
+ *target++=(UChar)((bits<<4)|(base64Value>>2));
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ sourceIndex=nextSourceIndex-1;
+ }
+ bytes[0]=b; /* keep this byte in case an error occurs */
+ byteIndex=1;
+ bits=(uint16_t)(base64Value&3);
+ base64Counter=3;
+ break;
+ case 5:
+ *target++=(UChar)((bits<<2)|(base64Value>>4));
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ sourceIndex=nextSourceIndex-1;
+ }
+ bytes[0]=b; /* keep this byte in case an error occurs */
+ byteIndex=1;
+ bits=(uint16_t)(base64Value&15);
+ base64Counter=6;
+ break;
+ case 7:
+ *target++=(UChar)((bits<<6)|base64Value);
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ sourceIndex=nextSourceIndex;
+ }
+ byteIndex=0;
+ bits=0;
+ base64Counter=0;
+ break;
+ default:
+ /* will never occur */
+ break;
+ }
+ } else /*base64Value==-2*/ {
+ /* minus sign terminates the base64 sequence */
+ inDirectMode=TRUE;
+ if(base64Counter==-1) {
+ /* +- i.e. a minus immediately following a plus */
+ *target++=PLUS;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex-1;
+ }
+ } else {
+ /* absorb the minus and leave the Unicode Mode */
+ if(bits!=0) {
+ /* bits are illegally left over, a UChar is incomplete */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ }
+ sourceIndex=nextSourceIndex;
+ goto directMode;
+ }
+ } else {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ }
+ }
+
+ if(U_SUCCESS(*pErrorCode) && pArgs->flush && source==sourceLimit && bits==0) {
+ /*
+ * if we are in Unicode mode, then the byteIndex might not be 0,
+ * but that is ok if bits==0
+ * -> we set byteIndex=0 at the end of the stream to avoid a truncated error
+ * (not true for IMAP-mailbox-name where we must end in direct mode)
+ */
+ byteIndex=0;
+ }
+
+ /* set the converter state back into UConverter */
+ cnv->toUnicodeStatus=((uint32_t)inDirectMode<<24)|((uint32_t)((uint8_t)base64Counter)<<16)|(uint32_t)bits;
+ cnv->toULength=byteIndex;
+
+ /* write back the updated pointers */
+ pArgs->source=(const char *)source;
+ pArgs->target=target;
+ pArgs->offsets=offsets;
+ return;
+}
+
+static void U_CALLCONV
+_UTF7FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ UConverter *cnv;
+ const UChar *source, *sourceLimit;
+ uint8_t *target, *targetLimit;
+ int32_t *offsets;
+
+ int32_t length, targetCapacity, sourceIndex;
+ UChar c;
+
+ /* UTF-7 state */
+ const UBool *encodeDirectly;
+ uint8_t bits;
+ int8_t base64Counter;
+ UBool inDirectMode;
+
+ /* set up the local pointers */
+ cnv=pArgs->converter;
+
+ /* set up the local pointers */
+ source=pArgs->source;
+ sourceLimit=pArgs->sourceLimit;
+ target=(uint8_t *)pArgs->target;
+ targetLimit=(uint8_t *)pArgs->targetLimit;
+ offsets=pArgs->offsets;
+
+ /* get the state machine state */
+ {
+ uint32_t status=cnv->fromUnicodeStatus;
+ encodeDirectly= status<0x10000000 ? encodeDirectlyMaximum : encodeDirectlyRestricted;
+ inDirectMode=(UBool)((status>>24)&1);
+ base64Counter=(int8_t)(status>>16);
+ bits=(uint8_t)status;
+ U_ASSERT(bits<=UPRV_LENGTHOF(toBase64));
+ }
+
+ /* UTF-7 always encodes UTF-16 code units, therefore we need only a simple sourceIndex */
+ sourceIndex=0;
+
+ if(inDirectMode) {
+directMode:
+ length=(int32_t)(sourceLimit-source);
+ targetCapacity=(int32_t)(targetLimit-target);
+ if(length>targetCapacity) {
+ length=targetCapacity;
+ }
+ while(length>0) {
+ c=*source++;
+ /* currently always encode CR LF SP TAB directly */
+ if(c<=127 && encodeDirectly[c]) {
+ /* encode directly */
+ *target++=(uint8_t)c;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex++;
+ }
+ } else if(c==PLUS) {
+ /* output +- for + */
+ *target++=PLUS;
+ if(target<targetLimit) {
+ *target++=MINUS;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex++;
+ }
+ /* realign length and targetCapacity */
+ goto directMode;
+ } else {
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex++;
+ }
+ cnv->charErrorBuffer[0]=MINUS;
+ cnv->charErrorBufferLength=1;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ } else {
+ /* un-read this character and switch to Unicode Mode */
+ --source;
+ *target++=PLUS;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ inDirectMode=FALSE;
+ base64Counter=0;
+ goto unicodeMode;
+ }
+ --length;
+ }
+ if(source<sourceLimit && target>=targetLimit) {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ } else {
+unicodeMode:
+ while(source<sourceLimit) {
+ if(target<targetLimit) {
+ c=*source++;
+ if(c<=127 && encodeDirectly[c]) {
+ /* encode directly */
+ inDirectMode=TRUE;
+
+ /* trick: back out this character to make this easier */
+ --source;
+
+ /* terminate the base64 sequence */
+ if(base64Counter!=0) {
+ /* write remaining bits for the previous character */
+ *target++=toBase64[bits];
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex-1;
+ }
+ }
+ if(fromBase64[c]!=-1) {
+ /* need to terminate with a minus */
+ if(target<targetLimit) {
+ *target++=MINUS;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex-1;
+ }
+ } else {
+ cnv->charErrorBuffer[0]=MINUS;
+ cnv->charErrorBufferLength=1;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ }
+ goto directMode;
+ } else {
+ /*
+ * base64 this character:
+ * Output 2 or 3 base64 bytes for the remaining bits of the previous character
+ * and the bits of this character, each implicitly in UTF-16BE.
+ *
+ * Here, bits is an 8-bit variable because only 6 bits need to be kept from one
+ * character to the next. The actual 2 or 4 bits are shifted to the left edge
+ * of the 6-bits field 5..0 to make the termination of the base64 sequence easier.
+ */
+ switch(base64Counter) {
+ case 0:
+ *target++=toBase64[c>>10];
+ if(target<targetLimit) {
+ *target++=toBase64[(c>>4)&0x3f];
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex++;
+ }
+ } else {
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex++;
+ }
+ cnv->charErrorBuffer[0]=toBase64[(c>>4)&0x3f];
+ cnv->charErrorBufferLength=1;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ bits=(uint8_t)((c&15)<<2);
+ base64Counter=1;
+ break;
+ case 1:
+ *target++=toBase64[bits|(c>>14)];
+ if(target<targetLimit) {
+ *target++=toBase64[(c>>8)&0x3f];
+ if(target<targetLimit) {
+ *target++=toBase64[(c>>2)&0x3f];
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex++;
+ }
+ } else {
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex++;
+ }
+ cnv->charErrorBuffer[0]=toBase64[(c>>2)&0x3f];
+ cnv->charErrorBufferLength=1;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ } else {
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex++;
+ }
+ cnv->charErrorBuffer[0]=toBase64[(c>>8)&0x3f];
+ cnv->charErrorBuffer[1]=toBase64[(c>>2)&0x3f];
+ cnv->charErrorBufferLength=2;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ bits=(uint8_t)((c&3)<<4);
+ base64Counter=2;
+ break;
+ case 2:
+ *target++=toBase64[bits|(c>>12)];
+ if(target<targetLimit) {
+ *target++=toBase64[(c>>6)&0x3f];
+ if(target<targetLimit) {
+ *target++=toBase64[c&0x3f];
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex++;
+ }
+ } else {
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex++;
+ }
+ cnv->charErrorBuffer[0]=toBase64[c&0x3f];
+ cnv->charErrorBufferLength=1;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ } else {
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex++;
+ }
+ cnv->charErrorBuffer[0]=toBase64[(c>>6)&0x3f];
+ cnv->charErrorBuffer[1]=toBase64[c&0x3f];
+ cnv->charErrorBufferLength=2;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ bits=0;
+ base64Counter=0;
+ break;
+ default:
+ /* will never occur */
+ break;
+ }
+ }
+ } else {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ }
+ }
+
+ if(pArgs->flush && source>=sourceLimit) {
+ /* flush remaining bits to the target */
+ if(!inDirectMode) {
+ if (base64Counter!=0) {
+ if(target<targetLimit) {
+ *target++=toBase64[bits];
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex-1;
+ }
+ } else {
+ cnv->charErrorBuffer[cnv->charErrorBufferLength++]=toBase64[bits];
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ }
+ /* Add final MINUS to terminate unicodeMode */
+ if(target<targetLimit) {
+ *target++=MINUS;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex-1;
+ }
+ } else {
+ cnv->charErrorBuffer[cnv->charErrorBufferLength++]=MINUS;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ }
+ /* reset the state for the next conversion */
+ cnv->fromUnicodeStatus=(cnv->fromUnicodeStatus&0xf0000000)|0x1000000; /* keep version, inDirectMode=TRUE */
+ } else {
+ /* set the converter state back into UConverter */
+ cnv->fromUnicodeStatus=
+ (cnv->fromUnicodeStatus&0xf0000000)| /* keep version*/
+ ((uint32_t)inDirectMode<<24)|((uint32_t)base64Counter<<16)|(uint32_t)bits;
+ }
+
+ /* write back the updated pointers */
+ pArgs->source=source;
+ pArgs->target=(char *)target;
+ pArgs->offsets=offsets;
+ return;
+}
+
+static const char * U_CALLCONV
+_UTF7GetName(const UConverter *cnv) {
+ switch(cnv->fromUnicodeStatus>>28) {
+ case 1:
+ return "UTF-7,version=1";
+ default:
+ return "UTF-7";
+ }
+}
+U_CDECL_END
+
+static const UConverterImpl _UTF7Impl={
+ UCNV_UTF7,
+
+ NULL,
+ NULL,
+
+ _UTF7Open,
+ NULL,
+ _UTF7Reset,
+
+ _UTF7ToUnicodeWithOffsets,
+ _UTF7ToUnicodeWithOffsets,
+ _UTF7FromUnicodeWithOffsets,
+ _UTF7FromUnicodeWithOffsets,
+ NULL,
+
+ NULL,
+ _UTF7GetName,
+ NULL, /* we don't need writeSub() because we never call a callback at fromUnicode() */
+ NULL,
+ ucnv_getCompleteUnicodeSet,
+
+ NULL,
+ NULL
+};
+
+static const UConverterStaticData _UTF7StaticData={
+ sizeof(UConverterStaticData),
+ "UTF-7",
+ 0, /* TODO CCSID for UTF-7 */
+ UCNV_IBM, UCNV_UTF7,
+ 1, 4,
+ { 0x3f, 0, 0, 0 }, 1, /* the subchar is not used */
+ FALSE, FALSE,
+ 0,
+ 0,
+ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
+};
+
+const UConverterSharedData _UTF7Data=
+ UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF7StaticData, &_UTF7Impl);
+
+/* IMAP mailbox name encoding ----------------------------------------------- */
+
+/*
+ * RFC 2060: INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1
+ * http://www.ietf.org/rfc/rfc2060.txt
+ *
+ * 5.1.3. Mailbox International Naming Convention
+ *
+ * By convention, international mailbox names are specified using a
+ * modified version of the UTF-7 encoding described in [UTF-7]. The
+ * purpose of these modifications is to correct the following problems
+ * with UTF-7:
+ *
+ * 1) UTF-7 uses the "+" character for shifting; this conflicts with
+ * the common use of "+" in mailbox names, in particular USENET
+ * newsgroup names.
+ *
+ * 2) UTF-7's encoding is BASE64 which uses the "/" character; this
+ * conflicts with the use of "/" as a popular hierarchy delimiter.
+ *
+ * 3) UTF-7 prohibits the unencoded usage of "\"; this conflicts with
+ * the use of "\" as a popular hierarchy delimiter.
+ *
+ * 4) UTF-7 prohibits the unencoded usage of "~"; this conflicts with
+ * the use of "~" in some servers as a home directory indicator.
+ *
+ * 5) UTF-7 permits multiple alternate forms to represent the same
+ * string; in particular, printable US-ASCII chararacters can be
+ * represented in encoded form.
+ *
+ * In modified UTF-7, printable US-ASCII characters except for "&"
+ * represent themselves; that is, characters with octet values 0x20-0x25
+ * and 0x27-0x7e. The character "&" (0x26) is represented by the two-
+ * octet sequence "&-".
+ *
+ * All other characters (octet values 0x00-0x1f, 0x7f-0xff, and all
+ * Unicode 16-bit octets) are represented in modified BASE64, with a
+ * further modification from [UTF-7] that "," is used instead of "/".
+ * Modified BASE64 MUST NOT be used to represent any printing US-ASCII
+ * character which can represent itself.
+ *
+ * "&" is used to shift to modified BASE64 and "-" to shift back to US-
+ * ASCII. All names start in US-ASCII, and MUST end in US-ASCII (that
+ * is, a name that ends with a Unicode 16-bit octet MUST end with a "-
+ * ").
+ *
+ * For example, here is a mailbox name which mixes English, Japanese,
+ * and Chinese text: ~peter/mail/&ZeVnLIqe-/&U,BTFw-
+ */
+
+/*
+ * Tests for US-ASCII characters belonging to character classes
+ * defined in UTF-7.
+ *
+ * Set D (directly encoded characters) consists of the following
+ * characters: the upper and lower case letters A through Z
+ * and a through z, the 10 digits 0-9, and the following nine special
+ * characters (note that "+" and "=" are omitted):
+ * '(),-./:?
+ *
+ * Set O (optional direct characters) consists of the following
+ * characters (note that "\" and "~" are omitted):
+ * !"#$%&*;<=>@[]^_`{|}
+ *
+ * According to the rules in RFC 2152, the byte values for the following
+ * US-ASCII characters are not used in UTF-7 and are therefore illegal:
+ * - all C0 control codes except for CR LF TAB
+ * - BACKSLASH
+ * - TILDE
+ * - DEL
+ * - all codes beyond US-ASCII, i.e. all >127
+ */
+
+/* uses '&' not '+' to start a base64 sequence */
+#define AMPERSAND 0x26
+#define COMMA 0x2c
+#define SLASH 0x2f
+
+/* legal byte values: all US-ASCII graphic characters 0x20..0x7e */
+#define isLegalIMAP(c) (0x20<=(c) && (c)<=0x7e)
+
+/* direct-encode all of printable ASCII 0x20..0x7e except '&' 0x26 */
+#define inSetDIMAP(c) (isLegalIMAP(c) && c!=AMPERSAND)
+
+#define TO_BASE64_IMAP(n) ((n)<63 ? toBase64[n] : COMMA)
+#define FROM_BASE64_IMAP(c) ((c)==COMMA ? 63 : (c)==SLASH ? -1 : fromBase64[c])
+
+/*
+ * converter status values:
+ *
+ * toUnicodeStatus:
+ * 24 inDirectMode (boolean)
+ * 23..16 base64Counter (-1..7)
+ * 15..0 bits (up to 14 bits incoming base64)
+ *
+ * fromUnicodeStatus:
+ * 24 inDirectMode (boolean)
+ * 23..16 base64Counter (0..2)
+ * 7..0 bits (6 bits outgoing base64)
+ *
+ * ignore bits 31..25
+ */
+
+U_CDECL_BEGIN
+static void U_CALLCONV
+_IMAPToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ UConverter *cnv;
+ const uint8_t *source, *sourceLimit;
+ UChar *target;
+ const UChar *targetLimit;
+ int32_t *offsets;
+
+ uint8_t *bytes;
+ uint8_t byteIndex;
+
+ int32_t length, targetCapacity;
+
+ /* UTF-7 state */
+ uint16_t bits;
+ int8_t base64Counter;
+ UBool inDirectMode;
+
+ int8_t base64Value;
+
+ int32_t sourceIndex, nextSourceIndex;
+
+ UChar c;
+ uint8_t b;
+
+ /* set up the local pointers */
+ cnv=pArgs->converter;
+
+ source=(const uint8_t *)pArgs->source;
+ sourceLimit=(const uint8_t *)pArgs->sourceLimit;
+ target=pArgs->target;
+ targetLimit=pArgs->targetLimit;
+ offsets=pArgs->offsets;
+ /* get the state machine state */
+ {
+ uint32_t status=cnv->toUnicodeStatus;
+ inDirectMode=(UBool)((status>>24)&1);
+ base64Counter=(int8_t)(status>>16);
+ bits=(uint16_t)status;
+ }
+ bytes=cnv->toUBytes;
+ byteIndex=cnv->toULength;
+
+ /* sourceIndex=-1 if the current character began in the previous buffer */
+ sourceIndex=byteIndex==0 ? 0 : -1;
+ nextSourceIndex=0;
+
+ if(inDirectMode) {
+directMode:
+ /*
+ * In Direct Mode, US-ASCII characters are encoded directly, i.e.,
+ * with their US-ASCII byte values.
+ * An ampersand starts Unicode (or "escape") Mode.
+ *
+ * In Direct Mode, only the sourceIndex is used.
+ */
+ byteIndex=0;
+ length=(int32_t)(sourceLimit-source);
+ targetCapacity=(int32_t)(targetLimit-target);
+ if(length>targetCapacity) {
+ length=targetCapacity;
+ }
+ while(length>0) {
+ b=*source++;
+ if(!isLegalIMAP(b)) {
+ /* illegal */
+ bytes[0]=b;
+ byteIndex=1;
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ break;
+ } else if(b!=AMPERSAND) {
+ /* write directly encoded character */
+ *target++=b;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex++;
+ }
+ } else /* AMPERSAND */ {
+ /* switch to Unicode mode */
+ nextSourceIndex=++sourceIndex;
+ inDirectMode=FALSE;
+ byteIndex=0;
+ bits=0;
+ base64Counter=-1;
+ goto unicodeMode;
+ }
+ --length;
+ }
+ if(source<sourceLimit && target>=targetLimit) {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ } else {
+unicodeMode:
+ /*
+ * In Unicode (or "escape") Mode, UTF-16BE is base64-encoded.
+ * The base64 sequence ends with any character that is not in the base64 alphabet.
+ * A terminating minus sign is consumed.
+ * US-ASCII must not be base64-ed.
+ *
+ * In Unicode Mode, the sourceIndex has the index to the start of the current
+ * base64 bytes, while nextSourceIndex is precisely parallel to source,
+ * keeping the index to the following byte.
+ * Note that in 2 out of 3 cases, UChars overlap within a base64 byte.
+ */
+ while(source<sourceLimit) {
+ if(target<targetLimit) {
+ bytes[byteIndex++]=b=*source++;
+ ++nextSourceIndex;
+ if(b>0x7e) {
+ /* illegal - test other illegal US-ASCII values by base64Value==-3 */
+ inDirectMode=TRUE;
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ break;
+ } else if((base64Value=FROM_BASE64_IMAP(b))>=0) {
+ /* collect base64 bytes into UChars */
+ switch(base64Counter) {
+ case -1: /* -1 is immediately after the & */
+ case 0:
+ bits=base64Value;
+ base64Counter=1;
+ break;
+ case 1:
+ case 3:
+ case 4:
+ case 6:
+ bits=(uint16_t)((bits<<6)|base64Value);
+ ++base64Counter;
+ break;
+ case 2:
+ c=(UChar)((bits<<4)|(base64Value>>2));
+ if(isLegalIMAP(c)) {
+ /* illegal */
+ inDirectMode=TRUE;
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ goto endloop;
+ }
+ *target++=c;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ sourceIndex=nextSourceIndex-1;
+ }
+ bytes[0]=b; /* keep this byte in case an error occurs */
+ byteIndex=1;
+ bits=(uint16_t)(base64Value&3);
+ base64Counter=3;
+ break;
+ case 5:
+ c=(UChar)((bits<<2)|(base64Value>>4));
+ if(isLegalIMAP(c)) {
+ /* illegal */
+ inDirectMode=TRUE;
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ goto endloop;
+ }
+ *target++=c;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ sourceIndex=nextSourceIndex-1;
+ }
+ bytes[0]=b; /* keep this byte in case an error occurs */
+ byteIndex=1;
+ bits=(uint16_t)(base64Value&15);
+ base64Counter=6;
+ break;
+ case 7:
+ c=(UChar)((bits<<6)|base64Value);
+ if(isLegalIMAP(c)) {
+ /* illegal */
+ inDirectMode=TRUE;
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ goto endloop;
+ }
+ *target++=c;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ sourceIndex=nextSourceIndex;
+ }
+ byteIndex=0;
+ bits=0;
+ base64Counter=0;
+ break;
+ default:
+ /* will never occur */
+ break;
+ }
+ } else if(base64Value==-2) {
+ /* minus sign terminates the base64 sequence */
+ inDirectMode=TRUE;
+ if(base64Counter==-1) {
+ /* &- i.e. a minus immediately following an ampersand */
+ *target++=AMPERSAND;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex-1;
+ }
+ } else {
+ /* absorb the minus and leave the Unicode Mode */
+ if(bits!=0 || (base64Counter!=0 && base64Counter!=3 && base64Counter!=6)) {
+ /* bits are illegally left over, a UChar is incomplete */
+ /* base64Counter other than 0, 3, 6 means non-minimal zero-padding, also illegal */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ }
+ sourceIndex=nextSourceIndex;
+ goto directMode;
+ } else {
+ if(base64Counter==-1) {
+ /* illegal: & immediately followed by something other than base64 or minus sign */
+ /* include the ampersand in the reported sequence */
+ --sourceIndex;
+ bytes[0]=AMPERSAND;
+ bytes[1]=b;
+ byteIndex=2;
+ }
+ /* base64Value==-1 for characters that are illegal only in Unicode mode */
+ /* base64Value==-3 for illegal characters */
+ /* illegal */
+ inDirectMode=TRUE;
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ } else {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ }
+ }
+endloop:
+
+ /*
+ * the end of the input stream and detection of truncated input
+ * are handled by the framework, but here we must check if we are in Unicode
+ * mode and byteIndex==0 because we must end in direct mode
+ *
+ * conditions:
+ * successful
+ * in Unicode mode and byteIndex==0
+ * end of input and no truncated input
+ */
+ if( U_SUCCESS(*pErrorCode) &&
+ !inDirectMode && byteIndex==0 &&
+ pArgs->flush && source>=sourceLimit
+ ) {
+ if(base64Counter==-1) {
+ /* & at the very end of the input */
+ /* make the ampersand the reported sequence */
+ bytes[0]=AMPERSAND;
+ byteIndex=1;
+ }
+ /* else if(base64Counter!=-1) byteIndex remains 0 because there is no particular byte sequence */
+
+ inDirectMode=TRUE; /* avoid looping */
+ *pErrorCode=U_TRUNCATED_CHAR_FOUND;
+ }
+
+ /* set the converter state back into UConverter */
+ cnv->toUnicodeStatus=((uint32_t)inDirectMode<<24)|((uint32_t)((uint8_t)base64Counter)<<16)|(uint32_t)bits;
+ cnv->toULength=byteIndex;
+
+ /* write back the updated pointers */
+ pArgs->source=(const char *)source;
+ pArgs->target=target;
+ pArgs->offsets=offsets;
+ return;
+}
+
+static void U_CALLCONV
+_IMAPFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ UConverter *cnv;
+ const UChar *source, *sourceLimit;
+ uint8_t *target, *targetLimit;
+ int32_t *offsets;
+
+ int32_t length, targetCapacity, sourceIndex;
+ UChar c;
+ uint8_t b;
+
+ /* UTF-7 state */
+ uint8_t bits;
+ int8_t base64Counter;
+ UBool inDirectMode;
+
+ /* set up the local pointers */
+ cnv=pArgs->converter;
+
+ /* set up the local pointers */
+ source=pArgs->source;
+ sourceLimit=pArgs->sourceLimit;
+ target=(uint8_t *)pArgs->target;
+ targetLimit=(uint8_t *)pArgs->targetLimit;
+ offsets=pArgs->offsets;
+
+ /* get the state machine state */
+ {
+ uint32_t status=cnv->fromUnicodeStatus;
+ inDirectMode=(UBool)((status>>24)&1);
+ base64Counter=(int8_t)(status>>16);
+ bits=(uint8_t)status;
+ }
+
+ /* UTF-7 always encodes UTF-16 code units, therefore we need only a simple sourceIndex */
+ sourceIndex=0;
+
+ if(inDirectMode) {
+directMode:
+ length=(int32_t)(sourceLimit-source);
+ targetCapacity=(int32_t)(targetLimit-target);
+ if(length>targetCapacity) {
+ length=targetCapacity;
+ }
+ while(length>0) {
+ c=*source++;
+ /* encode 0x20..0x7e except '&' directly */
+ if(inSetDIMAP(c)) {
+ /* encode directly */
+ *target++=(uint8_t)c;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex++;
+ }
+ } else if(c==AMPERSAND) {
+ /* output &- for & */
+ *target++=AMPERSAND;
+ if(target<targetLimit) {
+ *target++=MINUS;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex++;
+ }
+ /* realign length and targetCapacity */
+ goto directMode;
+ } else {
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex++;
+ }
+ cnv->charErrorBuffer[0]=MINUS;
+ cnv->charErrorBufferLength=1;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ } else {
+ /* un-read this character and switch to Unicode Mode */
+ --source;
+ *target++=AMPERSAND;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ inDirectMode=FALSE;
+ base64Counter=0;
+ goto unicodeMode;
+ }
+ --length;
+ }
+ if(source<sourceLimit && target>=targetLimit) {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ } else {
+unicodeMode:
+ while(source<sourceLimit) {
+ if(target<targetLimit) {
+ c=*source++;
+ if(isLegalIMAP(c)) {
+ /* encode directly */
+ inDirectMode=TRUE;
+
+ /* trick: back out this character to make this easier */
+ --source;
+
+ /* terminate the base64 sequence */
+ if(base64Counter!=0) {
+ /* write remaining bits for the previous character */
+ *target++=TO_BASE64_IMAP(bits);
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex-1;
+ }
+ }
+ /* need to terminate with a minus */
+ if(target<targetLimit) {
+ *target++=MINUS;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex-1;
+ }
+ } else {
+ cnv->charErrorBuffer[0]=MINUS;
+ cnv->charErrorBufferLength=1;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ goto directMode;
+ } else {
+ /*
+ * base64 this character:
+ * Output 2 or 3 base64 bytes for the remaining bits of the previous character
+ * and the bits of this character, each implicitly in UTF-16BE.
+ *
+ * Here, bits is an 8-bit variable because only 6 bits need to be kept from one
+ * character to the next. The actual 2 or 4 bits are shifted to the left edge
+ * of the 6-bits field 5..0 to make the termination of the base64 sequence easier.
+ */
+ switch(base64Counter) {
+ case 0:
+ b=(uint8_t)(c>>10);
+ *target++=TO_BASE64_IMAP(b);
+ if(target<targetLimit) {
+ b=(uint8_t)((c>>4)&0x3f);
+ *target++=TO_BASE64_IMAP(b);
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex++;
+ }
+ } else {
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex++;
+ }
+ b=(uint8_t)((c>>4)&0x3f);
+ cnv->charErrorBuffer[0]=TO_BASE64_IMAP(b);
+ cnv->charErrorBufferLength=1;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ bits=(uint8_t)((c&15)<<2);
+ base64Counter=1;
+ break;
+ case 1:
+ b=(uint8_t)(bits|(c>>14));
+ *target++=TO_BASE64_IMAP(b);
+ if(target<targetLimit) {
+ b=(uint8_t)((c>>8)&0x3f);
+ *target++=TO_BASE64_IMAP(b);
+ if(target<targetLimit) {
+ b=(uint8_t)((c>>2)&0x3f);
+ *target++=TO_BASE64_IMAP(b);
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex++;
+ }
+ } else {
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex++;
+ }
+ b=(uint8_t)((c>>2)&0x3f);
+ cnv->charErrorBuffer[0]=TO_BASE64_IMAP(b);
+ cnv->charErrorBufferLength=1;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ } else {
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex++;
+ }
+ b=(uint8_t)((c>>8)&0x3f);
+ cnv->charErrorBuffer[0]=TO_BASE64_IMAP(b);
+ b=(uint8_t)((c>>2)&0x3f);
+ cnv->charErrorBuffer[1]=TO_BASE64_IMAP(b);
+ cnv->charErrorBufferLength=2;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ bits=(uint8_t)((c&3)<<4);
+ base64Counter=2;
+ break;
+ case 2:
+ b=(uint8_t)(bits|(c>>12));
+ *target++=TO_BASE64_IMAP(b);
+ if(target<targetLimit) {
+ b=(uint8_t)((c>>6)&0x3f);
+ *target++=TO_BASE64_IMAP(b);
+ if(target<targetLimit) {
+ b=(uint8_t)(c&0x3f);
+ *target++=TO_BASE64_IMAP(b);
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex++;
+ }
+ } else {
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex++;
+ }
+ b=(uint8_t)(c&0x3f);
+ cnv->charErrorBuffer[0]=TO_BASE64_IMAP(b);
+ cnv->charErrorBufferLength=1;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ } else {
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex++;
+ }
+ b=(uint8_t)((c>>6)&0x3f);
+ cnv->charErrorBuffer[0]=TO_BASE64_IMAP(b);
+ b=(uint8_t)(c&0x3f);
+ cnv->charErrorBuffer[1]=TO_BASE64_IMAP(b);
+ cnv->charErrorBufferLength=2;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ bits=0;
+ base64Counter=0;
+ break;
+ default:
+ /* will never occur */
+ break;
+ }
+ }
+ } else {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ }
+ }
+
+ if(pArgs->flush && source>=sourceLimit) {
+ /* flush remaining bits to the target */
+ if(!inDirectMode) {
+ if(base64Counter!=0) {
+ if(target<targetLimit) {
+ *target++=TO_BASE64_IMAP(bits);
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex-1;
+ }
+ } else {
+ cnv->charErrorBuffer[cnv->charErrorBufferLength++]=TO_BASE64_IMAP(bits);
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ }
+ /* need to terminate with a minus */
+ if(target<targetLimit) {
+ *target++=MINUS;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex-1;
+ }
+ } else {
+ cnv->charErrorBuffer[cnv->charErrorBufferLength++]=MINUS;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+ }
+ /* reset the state for the next conversion */
+ cnv->fromUnicodeStatus=(cnv->fromUnicodeStatus&0xf0000000)|0x1000000; /* keep version, inDirectMode=TRUE */
+ } else {
+ /* set the converter state back into UConverter */
+ cnv->fromUnicodeStatus=
+ (cnv->fromUnicodeStatus&0xf0000000)| /* keep version*/
+ ((uint32_t)inDirectMode<<24)|((uint32_t)base64Counter<<16)|(uint32_t)bits;
+ }
+
+ /* write back the updated pointers */
+ pArgs->source=source;
+ pArgs->target=(char *)target;
+ pArgs->offsets=offsets;
+ return;
+}
+U_CDECL_END
+
+static const UConverterImpl _IMAPImpl={
+ UCNV_IMAP_MAILBOX,
+
+ NULL,
+ NULL,
+
+ _UTF7Open,
+ NULL,
+ _UTF7Reset,
+
+ _IMAPToUnicodeWithOffsets,
+ _IMAPToUnicodeWithOffsets,
+ _IMAPFromUnicodeWithOffsets,
+ _IMAPFromUnicodeWithOffsets,
+ NULL,
+
+ NULL,
+ NULL,
+ NULL, /* we don't need writeSub() because we never call a callback at fromUnicode() */
+ NULL,
+ ucnv_getCompleteUnicodeSet,
+ NULL,
+ NULL
+};
+
+static const UConverterStaticData _IMAPStaticData={
+ sizeof(UConverterStaticData),
+ "IMAP-mailbox-name",
+ 0, /* TODO CCSID for IMAP-mailbox-name */
+ UCNV_IBM, UCNV_IMAP_MAILBOX,
+ 1, 4,
+ { 0x3f, 0, 0, 0 }, 1, /* the subchar is not used */
+ FALSE, FALSE,
+ 0,
+ 0,
+ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
+};
+
+const UConverterSharedData _IMAPData=
+ UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_IMAPStaticData, &_IMAPImpl);
+
+#endif
diff --git a/contrib/libs/icu/common/ucnv_u8.cpp b/contrib/libs/icu/common/ucnv_u8.cpp
index 4cc2fb181a..9b518e08df 100644
--- a/contrib/libs/icu/common/ucnv_u8.cpp
+++ b/contrib/libs/icu/common/ucnv_u8.cpp
@@ -1,944 +1,944 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-**********************************************************************
-* Copyright (C) 2002-2016, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
-* file name: ucnv_u8.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 2002jul01
-* created by: Markus W. Scherer
-*
-* UTF-8 converter implementation. Used to be in ucnv_utf.c.
-*
-* Also, CESU-8 implementation, see UTR 26.
-* The CESU-8 converter uses all the same functions as the
-* UTF-8 converter, with a branch for converting supplementary code points.
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_CONVERSION
-
-#include "unicode/ucnv.h"
-#include "unicode/utf.h"
-#include "unicode/utf8.h"
-#include "unicode/utf16.h"
-#include "uassert.h"
-#include "ucnv_bld.h"
-#include "ucnv_cnv.h"
-#include "cmemory.h"
-#include "ustr_imp.h"
-
-/* Prototypes --------------------------------------------------------------- */
-
-/* Keep these here to make finicky compilers happy */
-
-U_CFUNC void ucnv_fromUnicode_UTF8(UConverterFromUnicodeArgs *args,
- UErrorCode *err);
-U_CFUNC void ucnv_fromUnicode_UTF8_OFFSETS_LOGIC(UConverterFromUnicodeArgs *args,
- UErrorCode *err);
-
-
-/* UTF-8 -------------------------------------------------------------------- */
-
-#define MAXIMUM_UCS2 0x0000FFFF
-
-static const uint32_t offsetsFromUTF8[5] = {0,
- (uint32_t) 0x00000000, (uint32_t) 0x00003080, (uint32_t) 0x000E2080,
- (uint32_t) 0x03C82080
-};
-
-static UBool hasCESU8Data(const UConverter *cnv)
-{
-#if UCONFIG_ONLY_HTML_CONVERSION
- return FALSE;
-#else
- return (UBool)(cnv->sharedData == &_CESU8Data);
-#endif
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+**********************************************************************
+* Copyright (C) 2002-2016, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* file name: ucnv_u8.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2002jul01
+* created by: Markus W. Scherer
+*
+* UTF-8 converter implementation. Used to be in ucnv_utf.c.
+*
+* Also, CESU-8 implementation, see UTR 26.
+* The CESU-8 converter uses all the same functions as the
+* UTF-8 converter, with a branch for converting supplementary code points.
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "unicode/ucnv.h"
+#include "unicode/utf.h"
+#include "unicode/utf8.h"
+#include "unicode/utf16.h"
+#include "uassert.h"
+#include "ucnv_bld.h"
+#include "ucnv_cnv.h"
+#include "cmemory.h"
+#include "ustr_imp.h"
+
+/* Prototypes --------------------------------------------------------------- */
+
+/* Keep these here to make finicky compilers happy */
+
+U_CFUNC void ucnv_fromUnicode_UTF8(UConverterFromUnicodeArgs *args,
+ UErrorCode *err);
+U_CFUNC void ucnv_fromUnicode_UTF8_OFFSETS_LOGIC(UConverterFromUnicodeArgs *args,
+ UErrorCode *err);
+
+
+/* UTF-8 -------------------------------------------------------------------- */
+
+#define MAXIMUM_UCS2 0x0000FFFF
+
+static const uint32_t offsetsFromUTF8[5] = {0,
+ (uint32_t) 0x00000000, (uint32_t) 0x00003080, (uint32_t) 0x000E2080,
+ (uint32_t) 0x03C82080
+};
+
+static UBool hasCESU8Data(const UConverter *cnv)
+{
+#if UCONFIG_ONLY_HTML_CONVERSION
+ return FALSE;
+#else
+ return (UBool)(cnv->sharedData == &_CESU8Data);
+#endif
+}
+U_CDECL_BEGIN
+static void U_CALLCONV ucnv_toUnicode_UTF8 (UConverterToUnicodeArgs * args,
+ UErrorCode * err)
+{
+ UConverter *cnv = args->converter;
+ const unsigned char *mySource = (unsigned char *) args->source;
+ UChar *myTarget = args->target;
+ const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit;
+ const UChar *targetLimit = args->targetLimit;
+ unsigned char *toUBytes = cnv->toUBytes;
+ UBool isCESU8 = hasCESU8Data(cnv);
+ uint32_t ch, ch2 = 0;
+ int32_t i, inBytes;
+
+ /* Restore size of current sequence */
+ if (cnv->toULength > 0 && myTarget < targetLimit)
+ {
+ inBytes = cnv->mode; /* restore # of bytes to consume */
+ i = cnv->toULength; /* restore # of bytes consumed */
+ cnv->toULength = 0;
+
+ ch = cnv->toUnicodeStatus;/*Stores the previously calculated ch from a previous call*/
+ cnv->toUnicodeStatus = 0;
+ goto morebytes;
+ }
+
+
+ while (mySource < sourceLimit && myTarget < targetLimit)
+ {
+ ch = *(mySource++);
+ if (U8_IS_SINGLE(ch)) /* Simple case */
+ {
+ *(myTarget++) = (UChar) ch;
+ }
+ else
+ {
+ /* store the first char */
+ toUBytes[0] = (char)ch;
+ inBytes = U8_COUNT_BYTES_NON_ASCII(ch); /* lookup current sequence length */
+ i = 1;
+
+morebytes:
+ while (i < inBytes)
+ {
+ if (mySource < sourceLimit)
+ {
+ toUBytes[i] = (char) (ch2 = *mySource);
+ if (!icu::UTF8::isValidTrail(ch, static_cast<uint8_t>(ch2), i, inBytes) &&
+ !(isCESU8 && i == 1 && ch == 0xed && U8_IS_TRAIL(ch2)))
+ {
+ break; /* i < inBytes */
+ }
+ ch = (ch << 6) + ch2;
+ ++mySource;
+ i++;
+ }
+ else
+ {
+ /* stores a partially calculated target*/
+ cnv->toUnicodeStatus = ch;
+ cnv->mode = inBytes;
+ cnv->toULength = (int8_t) i;
+ goto donefornow;
+ }
+ }
+
+ // In CESU-8, only surrogates, not supplementary code points, are encoded directly.
+ if (i == inBytes && (!isCESU8 || i <= 3))
+ {
+ /* Remove the accumulated high bits */
+ ch -= offsetsFromUTF8[inBytes];
+
+ /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
+ if (ch <= MAXIMUM_UCS2)
+ {
+ /* fits in 16 bits */
+ *(myTarget++) = (UChar) ch;
+ }
+ else
+ {
+ /* write out the surrogates */
+ *(myTarget++) = U16_LEAD(ch);
+ ch = U16_TRAIL(ch);
+ if (myTarget < targetLimit)
+ {
+ *(myTarget++) = (UChar)ch;
+ }
+ else
+ {
+ /* Put in overflow buffer (not handled here) */
+ cnv->UCharErrorBuffer[0] = (UChar) ch;
+ cnv->UCharErrorBufferLength = 1;
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ }
+ }
+ else
+ {
+ cnv->toULength = (int8_t)i;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ }
+ }
+
+donefornow:
+ if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err))
+ {
+ /* End of target buffer */
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+
+ args->target = myTarget;
+ args->source = (const char *) mySource;
+}
+
+static void U_CALLCONV ucnv_toUnicode_UTF8_OFFSETS_LOGIC (UConverterToUnicodeArgs * args,
+ UErrorCode * err)
+{
+ UConverter *cnv = args->converter;
+ const unsigned char *mySource = (unsigned char *) args->source;
+ UChar *myTarget = args->target;
+ int32_t *myOffsets = args->offsets;
+ int32_t offsetNum = 0;
+ const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit;
+ const UChar *targetLimit = args->targetLimit;
+ unsigned char *toUBytes = cnv->toUBytes;
+ UBool isCESU8 = hasCESU8Data(cnv);
+ uint32_t ch, ch2 = 0;
+ int32_t i, inBytes;
+
+ /* Restore size of current sequence */
+ if (cnv->toULength > 0 && myTarget < targetLimit)
+ {
+ inBytes = cnv->mode; /* restore # of bytes to consume */
+ i = cnv->toULength; /* restore # of bytes consumed */
+ cnv->toULength = 0;
+
+ ch = cnv->toUnicodeStatus;/*Stores the previously calculated ch from a previous call*/
+ cnv->toUnicodeStatus = 0;
+ goto morebytes;
+ }
+
+ while (mySource < sourceLimit && myTarget < targetLimit)
+ {
+ ch = *(mySource++);
+ if (U8_IS_SINGLE(ch)) /* Simple case */
+ {
+ *(myTarget++) = (UChar) ch;
+ *(myOffsets++) = offsetNum++;
+ }
+ else
+ {
+ toUBytes[0] = (char)ch;
+ inBytes = U8_COUNT_BYTES_NON_ASCII(ch);
+ i = 1;
+
+morebytes:
+ while (i < inBytes)
+ {
+ if (mySource < sourceLimit)
+ {
+ toUBytes[i] = (char) (ch2 = *mySource);
+ if (!icu::UTF8::isValidTrail(ch, static_cast<uint8_t>(ch2), i, inBytes) &&
+ !(isCESU8 && i == 1 && ch == 0xed && U8_IS_TRAIL(ch2)))
+ {
+ break; /* i < inBytes */
+ }
+ ch = (ch << 6) + ch2;
+ ++mySource;
+ i++;
+ }
+ else
+ {
+ cnv->toUnicodeStatus = ch;
+ cnv->mode = inBytes;
+ cnv->toULength = (int8_t)i;
+ goto donefornow;
+ }
+ }
+
+ // In CESU-8, only surrogates, not supplementary code points, are encoded directly.
+ if (i == inBytes && (!isCESU8 || i <= 3))
+ {
+ /* Remove the accumulated high bits */
+ ch -= offsetsFromUTF8[inBytes];
+
+ /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
+ if (ch <= MAXIMUM_UCS2)
+ {
+ /* fits in 16 bits */
+ *(myTarget++) = (UChar) ch;
+ *(myOffsets++) = offsetNum;
+ }
+ else
+ {
+ /* write out the surrogates */
+ *(myTarget++) = U16_LEAD(ch);
+ *(myOffsets++) = offsetNum;
+ ch = U16_TRAIL(ch);
+ if (myTarget < targetLimit)
+ {
+ *(myTarget++) = (UChar)ch;
+ *(myOffsets++) = offsetNum;
+ }
+ else
+ {
+ cnv->UCharErrorBuffer[0] = (UChar) ch;
+ cnv->UCharErrorBufferLength = 1;
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+ }
+ offsetNum += i;
+ }
+ else
+ {
+ cnv->toULength = (int8_t)i;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ }
+ }
+
+donefornow:
+ if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err))
+ { /* End of target buffer */
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+
+ args->target = myTarget;
+ args->source = (const char *) mySource;
+ args->offsets = myOffsets;
+}
+U_CDECL_END
+
+U_CFUNC void U_CALLCONV ucnv_fromUnicode_UTF8 (UConverterFromUnicodeArgs * args,
+ UErrorCode * err)
+{
+ UConverter *cnv = args->converter;
+ const UChar *mySource = args->source;
+ const UChar *sourceLimit = args->sourceLimit;
+ uint8_t *myTarget = (uint8_t *) args->target;
+ const uint8_t *targetLimit = (uint8_t *) args->targetLimit;
+ uint8_t *tempPtr;
+ UChar32 ch;
+ uint8_t tempBuf[4];
+ int32_t indexToWrite;
+ UBool isNotCESU8 = !hasCESU8Data(cnv);
+
+ if (cnv->fromUChar32 && myTarget < targetLimit)
+ {
+ ch = cnv->fromUChar32;
+ cnv->fromUChar32 = 0;
+ goto lowsurrogate;
+ }
+
+ while (mySource < sourceLimit && myTarget < targetLimit)
+ {
+ ch = *(mySource++);
+
+ if (ch < 0x80) /* Single byte */
+ {
+ *(myTarget++) = (uint8_t) ch;
+ }
+ else if (ch < 0x800) /* Double byte */
+ {
+ *(myTarget++) = (uint8_t) ((ch >> 6) | 0xc0);
+ if (myTarget < targetLimit)
+ {
+ *(myTarget++) = (uint8_t) ((ch & 0x3f) | 0x80);
+ }
+ else
+ {
+ cnv->charErrorBuffer[0] = (uint8_t) ((ch & 0x3f) | 0x80);
+ cnv->charErrorBufferLength = 1;
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+ }
+ else {
+ /* Check for surrogates */
+ if(U16_IS_SURROGATE(ch) && isNotCESU8) {
+lowsurrogate:
+ if (mySource < sourceLimit) {
+ /* test both code units */
+ if(U16_IS_SURROGATE_LEAD(ch) && U16_IS_TRAIL(*mySource)) {
+ /* convert and consume this supplementary code point */
+ ch=U16_GET_SUPPLEMENTARY(ch, *mySource);
+ ++mySource;
+ /* exit this condition tree */
+ }
+ else {
+ /* this is an unpaired trail or lead code unit */
+ /* callback(illegal) */
+ cnv->fromUChar32 = ch;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ }
+ else {
+ /* no more input */
+ cnv->fromUChar32 = ch;
+ break;
+ }
+ }
+
+ /* Do we write the buffer directly for speed,
+ or do we have to be careful about target buffer space? */
+ tempPtr = (((targetLimit - myTarget) >= 4) ? myTarget : tempBuf);
+
+ if (ch <= MAXIMUM_UCS2) {
+ indexToWrite = 2;
+ tempPtr[0] = (uint8_t) ((ch >> 12) | 0xe0);
+ }
+ else {
+ indexToWrite = 3;
+ tempPtr[0] = (uint8_t) ((ch >> 18) | 0xf0);
+ tempPtr[1] = (uint8_t) (((ch >> 12) & 0x3f) | 0x80);
+ }
+ tempPtr[indexToWrite-1] = (uint8_t) (((ch >> 6) & 0x3f) | 0x80);
+ tempPtr[indexToWrite] = (uint8_t) ((ch & 0x3f) | 0x80);
+
+ if (tempPtr == myTarget) {
+ /* There was enough space to write the codepoint directly. */
+ myTarget += (indexToWrite + 1);
+ }
+ else {
+ /* We might run out of room soon. Write it slowly. */
+ for (; tempPtr <= (tempBuf + indexToWrite); tempPtr++) {
+ if (myTarget < targetLimit) {
+ *(myTarget++) = *tempPtr;
+ }
+ else {
+ cnv->charErrorBuffer[cnv->charErrorBufferLength++] = *tempPtr;
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+ }
+ }
+ }
+ }
+
+ if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err))
+ {
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+
+ args->target = (char *) myTarget;
+ args->source = mySource;
+}
+
+U_CFUNC void U_CALLCONV ucnv_fromUnicode_UTF8_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
+ UErrorCode * err)
+{
+ UConverter *cnv = args->converter;
+ const UChar *mySource = args->source;
+ int32_t *myOffsets = args->offsets;
+ const UChar *sourceLimit = args->sourceLimit;
+ uint8_t *myTarget = (uint8_t *) args->target;
+ const uint8_t *targetLimit = (uint8_t *) args->targetLimit;
+ uint8_t *tempPtr;
+ UChar32 ch;
+ int32_t offsetNum, nextSourceIndex;
+ int32_t indexToWrite;
+ uint8_t tempBuf[4];
+ UBool isNotCESU8 = !hasCESU8Data(cnv);
+
+ if (cnv->fromUChar32 && myTarget < targetLimit)
+ {
+ ch = cnv->fromUChar32;
+ cnv->fromUChar32 = 0;
+ offsetNum = -1;
+ nextSourceIndex = 0;
+ goto lowsurrogate;
+ } else {
+ offsetNum = 0;
+ }
+
+ while (mySource < sourceLimit && myTarget < targetLimit)
+ {
+ ch = *(mySource++);
+
+ if (ch < 0x80) /* Single byte */
+ {
+ *(myOffsets++) = offsetNum++;
+ *(myTarget++) = (char) ch;
+ }
+ else if (ch < 0x800) /* Double byte */
+ {
+ *(myOffsets++) = offsetNum;
+ *(myTarget++) = (uint8_t) ((ch >> 6) | 0xc0);
+ if (myTarget < targetLimit)
+ {
+ *(myOffsets++) = offsetNum++;
+ *(myTarget++) = (uint8_t) ((ch & 0x3f) | 0x80);
+ }
+ else
+ {
+ cnv->charErrorBuffer[0] = (uint8_t) ((ch & 0x3f) | 0x80);
+ cnv->charErrorBufferLength = 1;
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+ }
+ else
+ /* Check for surrogates */
+ {
+ nextSourceIndex = offsetNum + 1;
+
+ if(U16_IS_SURROGATE(ch) && isNotCESU8) {
+lowsurrogate:
+ if (mySource < sourceLimit) {
+ /* test both code units */
+ if(U16_IS_SURROGATE_LEAD(ch) && U16_IS_TRAIL(*mySource)) {
+ /* convert and consume this supplementary code point */
+ ch=U16_GET_SUPPLEMENTARY(ch, *mySource);
+ ++mySource;
+ ++nextSourceIndex;
+ /* exit this condition tree */
+ }
+ else {
+ /* this is an unpaired trail or lead code unit */
+ /* callback(illegal) */
+ cnv->fromUChar32 = ch;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ }
+ else {
+ /* no more input */
+ cnv->fromUChar32 = ch;
+ break;
+ }
+ }
+
+ /* Do we write the buffer directly for speed,
+ or do we have to be careful about target buffer space? */
+ tempPtr = (((targetLimit - myTarget) >= 4) ? myTarget : tempBuf);
+
+ if (ch <= MAXIMUM_UCS2) {
+ indexToWrite = 2;
+ tempPtr[0] = (uint8_t) ((ch >> 12) | 0xe0);
+ }
+ else {
+ indexToWrite = 3;
+ tempPtr[0] = (uint8_t) ((ch >> 18) | 0xf0);
+ tempPtr[1] = (uint8_t) (((ch >> 12) & 0x3f) | 0x80);
+ }
+ tempPtr[indexToWrite-1] = (uint8_t) (((ch >> 6) & 0x3f) | 0x80);
+ tempPtr[indexToWrite] = (uint8_t) ((ch & 0x3f) | 0x80);
+
+ if (tempPtr == myTarget) {
+ /* There was enough space to write the codepoint directly. */
+ myTarget += (indexToWrite + 1);
+ myOffsets[0] = offsetNum;
+ myOffsets[1] = offsetNum;
+ myOffsets[2] = offsetNum;
+ if (indexToWrite >= 3) {
+ myOffsets[3] = offsetNum;
+ }
+ myOffsets += (indexToWrite + 1);
+ }
+ else {
+ /* We might run out of room soon. Write it slowly. */
+ for (; tempPtr <= (tempBuf + indexToWrite); tempPtr++) {
+ if (myTarget < targetLimit)
+ {
+ *(myOffsets++) = offsetNum;
+ *(myTarget++) = *tempPtr;
+ }
+ else
+ {
+ cnv->charErrorBuffer[cnv->charErrorBufferLength++] = *tempPtr;
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+ }
+ }
+ offsetNum = nextSourceIndex;
+ }
+ }
+
+ if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err))
+ {
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+
+ args->target = (char *) myTarget;
+ args->source = mySource;
+ args->offsets = myOffsets;
+}
+
+U_CDECL_BEGIN
+static UChar32 U_CALLCONV ucnv_getNextUChar_UTF8(UConverterToUnicodeArgs *args,
+ UErrorCode *err) {
+ UConverter *cnv;
+ const uint8_t *sourceInitial;
+ const uint8_t *source;
+ uint8_t myByte;
+ UChar32 ch;
+ int8_t i;
+
+ /* UTF-8 only here, the framework handles CESU-8 to combine surrogate pairs */
+
+ cnv = args->converter;
+ sourceInitial = source = (const uint8_t *)args->source;
+ if (source >= (const uint8_t *)args->sourceLimit)
+ {
+ /* no input */
+ *err = U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0xffff;
+ }
+
+ myByte = (uint8_t)*(source++);
+ if (U8_IS_SINGLE(myByte))
+ {
+ args->source = (const char *)source;
+ return (UChar32)myByte;
+ }
+
+ uint16_t countTrailBytes = U8_COUNT_TRAIL_BYTES(myByte);
+ if (countTrailBytes == 0) {
+ cnv->toUBytes[0] = myByte;
+ cnv->toULength = 1;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ args->source = (const char *)source;
+ return 0xffff;
+ }
+
+ /*The byte sequence is longer than the buffer area passed*/
+ if (((const char *)source + countTrailBytes) > args->sourceLimit)
+ {
+ /* check if all of the remaining bytes are trail bytes */
+ uint16_t extraBytesToWrite = countTrailBytes + 1;
+ cnv->toUBytes[0] = myByte;
+ i = 1;
+ *err = U_TRUNCATED_CHAR_FOUND;
+ while(source < (const uint8_t *)args->sourceLimit) {
+ uint8_t b = *source;
+ if(icu::UTF8::isValidTrail(myByte, b, i, extraBytesToWrite)) {
+ cnv->toUBytes[i++] = b;
+ ++source;
+ } else {
+ /* error even before we run out of input */
+ *err = U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ }
+ cnv->toULength = i;
+ args->source = (const char *)source;
+ return 0xffff;
+ }
+
+ ch = myByte << 6;
+ if(countTrailBytes == 2) {
+ uint8_t t1 = *source, t2;
+ if(U8_IS_VALID_LEAD3_AND_T1(myByte, t1) && U8_IS_TRAIL(t2 = *++source)) {
+ args->source = (const char *)(source + 1);
+ return (((ch + t1) << 6) + t2) - offsetsFromUTF8[3];
+ }
+ } else if(countTrailBytes == 1) {
+ uint8_t t1 = *source;
+ if(U8_IS_TRAIL(t1)) {
+ args->source = (const char *)(source + 1);
+ return (ch + t1) - offsetsFromUTF8[2];
+ }
+ } else { // countTrailBytes == 3
+ uint8_t t1 = *source, t2, t3;
+ if(U8_IS_VALID_LEAD4_AND_T1(myByte, t1) && U8_IS_TRAIL(t2 = *++source) &&
+ U8_IS_TRAIL(t3 = *++source)) {
+ args->source = (const char *)(source + 1);
+ return (((((ch + t1) << 6) + t2) << 6) + t3) - offsetsFromUTF8[4];
+ }
+ }
+ args->source = (const char *)source;
+
+ for(i = 0; sourceInitial < source; ++i) {
+ cnv->toUBytes[i] = *sourceInitial++;
+ }
+ cnv->toULength = i;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ return 0xffff;
}
-U_CDECL_BEGIN
-static void U_CALLCONV ucnv_toUnicode_UTF8 (UConverterToUnicodeArgs * args,
- UErrorCode * err)
-{
- UConverter *cnv = args->converter;
- const unsigned char *mySource = (unsigned char *) args->source;
- UChar *myTarget = args->target;
- const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit;
- const UChar *targetLimit = args->targetLimit;
- unsigned char *toUBytes = cnv->toUBytes;
- UBool isCESU8 = hasCESU8Data(cnv);
- uint32_t ch, ch2 = 0;
- int32_t i, inBytes;
-
- /* Restore size of current sequence */
- if (cnv->toULength > 0 && myTarget < targetLimit)
- {
- inBytes = cnv->mode; /* restore # of bytes to consume */
- i = cnv->toULength; /* restore # of bytes consumed */
- cnv->toULength = 0;
-
- ch = cnv->toUnicodeStatus;/*Stores the previously calculated ch from a previous call*/
- cnv->toUnicodeStatus = 0;
- goto morebytes;
- }
-
-
- while (mySource < sourceLimit && myTarget < targetLimit)
- {
- ch = *(mySource++);
- if (U8_IS_SINGLE(ch)) /* Simple case */
- {
- *(myTarget++) = (UChar) ch;
- }
- else
- {
- /* store the first char */
- toUBytes[0] = (char)ch;
- inBytes = U8_COUNT_BYTES_NON_ASCII(ch); /* lookup current sequence length */
- i = 1;
-
-morebytes:
- while (i < inBytes)
- {
- if (mySource < sourceLimit)
- {
- toUBytes[i] = (char) (ch2 = *mySource);
- if (!icu::UTF8::isValidTrail(ch, static_cast<uint8_t>(ch2), i, inBytes) &&
- !(isCESU8 && i == 1 && ch == 0xed && U8_IS_TRAIL(ch2)))
- {
- break; /* i < inBytes */
- }
- ch = (ch << 6) + ch2;
- ++mySource;
- i++;
- }
- else
- {
- /* stores a partially calculated target*/
- cnv->toUnicodeStatus = ch;
- cnv->mode = inBytes;
- cnv->toULength = (int8_t) i;
- goto donefornow;
- }
- }
-
- // In CESU-8, only surrogates, not supplementary code points, are encoded directly.
- if (i == inBytes && (!isCESU8 || i <= 3))
- {
- /* Remove the accumulated high bits */
- ch -= offsetsFromUTF8[inBytes];
-
- /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
- if (ch <= MAXIMUM_UCS2)
- {
- /* fits in 16 bits */
- *(myTarget++) = (UChar) ch;
- }
- else
- {
- /* write out the surrogates */
- *(myTarget++) = U16_LEAD(ch);
- ch = U16_TRAIL(ch);
- if (myTarget < targetLimit)
- {
- *(myTarget++) = (UChar)ch;
- }
- else
- {
- /* Put in overflow buffer (not handled here) */
- cnv->UCharErrorBuffer[0] = (UChar) ch;
- cnv->UCharErrorBufferLength = 1;
- *err = U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- }
- }
- else
- {
- cnv->toULength = (int8_t)i;
- *err = U_ILLEGAL_CHAR_FOUND;
- break;
- }
- }
- }
-
-donefornow:
- if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err))
- {
- /* End of target buffer */
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
-
- args->target = myTarget;
- args->source = (const char *) mySource;
-}
-
-static void U_CALLCONV ucnv_toUnicode_UTF8_OFFSETS_LOGIC (UConverterToUnicodeArgs * args,
- UErrorCode * err)
-{
- UConverter *cnv = args->converter;
- const unsigned char *mySource = (unsigned char *) args->source;
- UChar *myTarget = args->target;
- int32_t *myOffsets = args->offsets;
- int32_t offsetNum = 0;
- const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit;
- const UChar *targetLimit = args->targetLimit;
- unsigned char *toUBytes = cnv->toUBytes;
- UBool isCESU8 = hasCESU8Data(cnv);
- uint32_t ch, ch2 = 0;
- int32_t i, inBytes;
-
- /* Restore size of current sequence */
- if (cnv->toULength > 0 && myTarget < targetLimit)
- {
- inBytes = cnv->mode; /* restore # of bytes to consume */
- i = cnv->toULength; /* restore # of bytes consumed */
- cnv->toULength = 0;
-
- ch = cnv->toUnicodeStatus;/*Stores the previously calculated ch from a previous call*/
- cnv->toUnicodeStatus = 0;
- goto morebytes;
- }
-
- while (mySource < sourceLimit && myTarget < targetLimit)
- {
- ch = *(mySource++);
- if (U8_IS_SINGLE(ch)) /* Simple case */
- {
- *(myTarget++) = (UChar) ch;
- *(myOffsets++) = offsetNum++;
- }
- else
- {
- toUBytes[0] = (char)ch;
- inBytes = U8_COUNT_BYTES_NON_ASCII(ch);
- i = 1;
-
-morebytes:
- while (i < inBytes)
- {
- if (mySource < sourceLimit)
- {
- toUBytes[i] = (char) (ch2 = *mySource);
- if (!icu::UTF8::isValidTrail(ch, static_cast<uint8_t>(ch2), i, inBytes) &&
- !(isCESU8 && i == 1 && ch == 0xed && U8_IS_TRAIL(ch2)))
- {
- break; /* i < inBytes */
- }
- ch = (ch << 6) + ch2;
- ++mySource;
- i++;
- }
- else
- {
- cnv->toUnicodeStatus = ch;
- cnv->mode = inBytes;
- cnv->toULength = (int8_t)i;
- goto donefornow;
- }
- }
-
- // In CESU-8, only surrogates, not supplementary code points, are encoded directly.
- if (i == inBytes && (!isCESU8 || i <= 3))
- {
- /* Remove the accumulated high bits */
- ch -= offsetsFromUTF8[inBytes];
-
- /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
- if (ch <= MAXIMUM_UCS2)
- {
- /* fits in 16 bits */
- *(myTarget++) = (UChar) ch;
- *(myOffsets++) = offsetNum;
- }
- else
- {
- /* write out the surrogates */
- *(myTarget++) = U16_LEAD(ch);
- *(myOffsets++) = offsetNum;
- ch = U16_TRAIL(ch);
- if (myTarget < targetLimit)
- {
- *(myTarget++) = (UChar)ch;
- *(myOffsets++) = offsetNum;
- }
- else
- {
- cnv->UCharErrorBuffer[0] = (UChar) ch;
- cnv->UCharErrorBufferLength = 1;
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
- }
- offsetNum += i;
- }
- else
- {
- cnv->toULength = (int8_t)i;
- *err = U_ILLEGAL_CHAR_FOUND;
- break;
- }
- }
- }
-
-donefornow:
- if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err))
- { /* End of target buffer */
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
-
- args->target = myTarget;
- args->source = (const char *) mySource;
- args->offsets = myOffsets;
-}
-U_CDECL_END
-
-U_CFUNC void U_CALLCONV ucnv_fromUnicode_UTF8 (UConverterFromUnicodeArgs * args,
- UErrorCode * err)
-{
- UConverter *cnv = args->converter;
- const UChar *mySource = args->source;
- const UChar *sourceLimit = args->sourceLimit;
- uint8_t *myTarget = (uint8_t *) args->target;
- const uint8_t *targetLimit = (uint8_t *) args->targetLimit;
- uint8_t *tempPtr;
- UChar32 ch;
- uint8_t tempBuf[4];
- int32_t indexToWrite;
- UBool isNotCESU8 = !hasCESU8Data(cnv);
-
- if (cnv->fromUChar32 && myTarget < targetLimit)
- {
- ch = cnv->fromUChar32;
- cnv->fromUChar32 = 0;
- goto lowsurrogate;
- }
-
- while (mySource < sourceLimit && myTarget < targetLimit)
- {
- ch = *(mySource++);
-
- if (ch < 0x80) /* Single byte */
- {
- *(myTarget++) = (uint8_t) ch;
- }
- else if (ch < 0x800) /* Double byte */
- {
- *(myTarget++) = (uint8_t) ((ch >> 6) | 0xc0);
- if (myTarget < targetLimit)
- {
- *(myTarget++) = (uint8_t) ((ch & 0x3f) | 0x80);
- }
- else
- {
- cnv->charErrorBuffer[0] = (uint8_t) ((ch & 0x3f) | 0x80);
- cnv->charErrorBufferLength = 1;
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
- }
- else {
- /* Check for surrogates */
- if(U16_IS_SURROGATE(ch) && isNotCESU8) {
-lowsurrogate:
- if (mySource < sourceLimit) {
- /* test both code units */
- if(U16_IS_SURROGATE_LEAD(ch) && U16_IS_TRAIL(*mySource)) {
- /* convert and consume this supplementary code point */
- ch=U16_GET_SUPPLEMENTARY(ch, *mySource);
- ++mySource;
- /* exit this condition tree */
- }
- else {
- /* this is an unpaired trail or lead code unit */
- /* callback(illegal) */
- cnv->fromUChar32 = ch;
- *err = U_ILLEGAL_CHAR_FOUND;
- break;
- }
- }
- else {
- /* no more input */
- cnv->fromUChar32 = ch;
- break;
- }
- }
-
- /* Do we write the buffer directly for speed,
- or do we have to be careful about target buffer space? */
- tempPtr = (((targetLimit - myTarget) >= 4) ? myTarget : tempBuf);
-
- if (ch <= MAXIMUM_UCS2) {
- indexToWrite = 2;
- tempPtr[0] = (uint8_t) ((ch >> 12) | 0xe0);
- }
- else {
- indexToWrite = 3;
- tempPtr[0] = (uint8_t) ((ch >> 18) | 0xf0);
- tempPtr[1] = (uint8_t) (((ch >> 12) & 0x3f) | 0x80);
- }
- tempPtr[indexToWrite-1] = (uint8_t) (((ch >> 6) & 0x3f) | 0x80);
- tempPtr[indexToWrite] = (uint8_t) ((ch & 0x3f) | 0x80);
-
- if (tempPtr == myTarget) {
- /* There was enough space to write the codepoint directly. */
- myTarget += (indexToWrite + 1);
- }
- else {
- /* We might run out of room soon. Write it slowly. */
- for (; tempPtr <= (tempBuf + indexToWrite); tempPtr++) {
- if (myTarget < targetLimit) {
- *(myTarget++) = *tempPtr;
- }
- else {
- cnv->charErrorBuffer[cnv->charErrorBufferLength++] = *tempPtr;
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
- }
- }
- }
- }
-
- if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err))
- {
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
-
- args->target = (char *) myTarget;
- args->source = mySource;
-}
-
-U_CFUNC void U_CALLCONV ucnv_fromUnicode_UTF8_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
- UErrorCode * err)
-{
- UConverter *cnv = args->converter;
- const UChar *mySource = args->source;
- int32_t *myOffsets = args->offsets;
- const UChar *sourceLimit = args->sourceLimit;
- uint8_t *myTarget = (uint8_t *) args->target;
- const uint8_t *targetLimit = (uint8_t *) args->targetLimit;
- uint8_t *tempPtr;
- UChar32 ch;
- int32_t offsetNum, nextSourceIndex;
- int32_t indexToWrite;
- uint8_t tempBuf[4];
- UBool isNotCESU8 = !hasCESU8Data(cnv);
-
- if (cnv->fromUChar32 && myTarget < targetLimit)
- {
- ch = cnv->fromUChar32;
- cnv->fromUChar32 = 0;
- offsetNum = -1;
- nextSourceIndex = 0;
- goto lowsurrogate;
- } else {
- offsetNum = 0;
- }
-
- while (mySource < sourceLimit && myTarget < targetLimit)
- {
- ch = *(mySource++);
-
- if (ch < 0x80) /* Single byte */
- {
- *(myOffsets++) = offsetNum++;
- *(myTarget++) = (char) ch;
- }
- else if (ch < 0x800) /* Double byte */
- {
- *(myOffsets++) = offsetNum;
- *(myTarget++) = (uint8_t) ((ch >> 6) | 0xc0);
- if (myTarget < targetLimit)
- {
- *(myOffsets++) = offsetNum++;
- *(myTarget++) = (uint8_t) ((ch & 0x3f) | 0x80);
- }
- else
- {
- cnv->charErrorBuffer[0] = (uint8_t) ((ch & 0x3f) | 0x80);
- cnv->charErrorBufferLength = 1;
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
- }
- else
- /* Check for surrogates */
- {
- nextSourceIndex = offsetNum + 1;
-
- if(U16_IS_SURROGATE(ch) && isNotCESU8) {
-lowsurrogate:
- if (mySource < sourceLimit) {
- /* test both code units */
- if(U16_IS_SURROGATE_LEAD(ch) && U16_IS_TRAIL(*mySource)) {
- /* convert and consume this supplementary code point */
- ch=U16_GET_SUPPLEMENTARY(ch, *mySource);
- ++mySource;
- ++nextSourceIndex;
- /* exit this condition tree */
- }
- else {
- /* this is an unpaired trail or lead code unit */
- /* callback(illegal) */
- cnv->fromUChar32 = ch;
- *err = U_ILLEGAL_CHAR_FOUND;
- break;
- }
- }
- else {
- /* no more input */
- cnv->fromUChar32 = ch;
- break;
- }
- }
-
- /* Do we write the buffer directly for speed,
- or do we have to be careful about target buffer space? */
- tempPtr = (((targetLimit - myTarget) >= 4) ? myTarget : tempBuf);
-
- if (ch <= MAXIMUM_UCS2) {
- indexToWrite = 2;
- tempPtr[0] = (uint8_t) ((ch >> 12) | 0xe0);
- }
- else {
- indexToWrite = 3;
- tempPtr[0] = (uint8_t) ((ch >> 18) | 0xf0);
- tempPtr[1] = (uint8_t) (((ch >> 12) & 0x3f) | 0x80);
- }
- tempPtr[indexToWrite-1] = (uint8_t) (((ch >> 6) & 0x3f) | 0x80);
- tempPtr[indexToWrite] = (uint8_t) ((ch & 0x3f) | 0x80);
-
- if (tempPtr == myTarget) {
- /* There was enough space to write the codepoint directly. */
- myTarget += (indexToWrite + 1);
- myOffsets[0] = offsetNum;
- myOffsets[1] = offsetNum;
- myOffsets[2] = offsetNum;
- if (indexToWrite >= 3) {
- myOffsets[3] = offsetNum;
- }
- myOffsets += (indexToWrite + 1);
- }
- else {
- /* We might run out of room soon. Write it slowly. */
- for (; tempPtr <= (tempBuf + indexToWrite); tempPtr++) {
- if (myTarget < targetLimit)
- {
- *(myOffsets++) = offsetNum;
- *(myTarget++) = *tempPtr;
- }
- else
- {
- cnv->charErrorBuffer[cnv->charErrorBufferLength++] = *tempPtr;
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
- }
- }
- offsetNum = nextSourceIndex;
- }
- }
-
- if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err))
- {
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
-
- args->target = (char *) myTarget;
- args->source = mySource;
- args->offsets = myOffsets;
-}
-
-U_CDECL_BEGIN
-static UChar32 U_CALLCONV ucnv_getNextUChar_UTF8(UConverterToUnicodeArgs *args,
- UErrorCode *err) {
- UConverter *cnv;
- const uint8_t *sourceInitial;
- const uint8_t *source;
- uint8_t myByte;
- UChar32 ch;
- int8_t i;
-
- /* UTF-8 only here, the framework handles CESU-8 to combine surrogate pairs */
-
- cnv = args->converter;
- sourceInitial = source = (const uint8_t *)args->source;
- if (source >= (const uint8_t *)args->sourceLimit)
- {
- /* no input */
- *err = U_INDEX_OUTOFBOUNDS_ERROR;
- return 0xffff;
- }
-
- myByte = (uint8_t)*(source++);
- if (U8_IS_SINGLE(myByte))
- {
- args->source = (const char *)source;
- return (UChar32)myByte;
- }
-
- uint16_t countTrailBytes = U8_COUNT_TRAIL_BYTES(myByte);
- if (countTrailBytes == 0) {
- cnv->toUBytes[0] = myByte;
- cnv->toULength = 1;
- *err = U_ILLEGAL_CHAR_FOUND;
- args->source = (const char *)source;
- return 0xffff;
- }
-
- /*The byte sequence is longer than the buffer area passed*/
- if (((const char *)source + countTrailBytes) > args->sourceLimit)
- {
- /* check if all of the remaining bytes are trail bytes */
- uint16_t extraBytesToWrite = countTrailBytes + 1;
- cnv->toUBytes[0] = myByte;
- i = 1;
- *err = U_TRUNCATED_CHAR_FOUND;
- while(source < (const uint8_t *)args->sourceLimit) {
- uint8_t b = *source;
- if(icu::UTF8::isValidTrail(myByte, b, i, extraBytesToWrite)) {
- cnv->toUBytes[i++] = b;
- ++source;
- } else {
- /* error even before we run out of input */
- *err = U_ILLEGAL_CHAR_FOUND;
- break;
- }
- }
- cnv->toULength = i;
- args->source = (const char *)source;
- return 0xffff;
- }
-
- ch = myByte << 6;
- if(countTrailBytes == 2) {
- uint8_t t1 = *source, t2;
- if(U8_IS_VALID_LEAD3_AND_T1(myByte, t1) && U8_IS_TRAIL(t2 = *++source)) {
- args->source = (const char *)(source + 1);
- return (((ch + t1) << 6) + t2) - offsetsFromUTF8[3];
- }
- } else if(countTrailBytes == 1) {
- uint8_t t1 = *source;
- if(U8_IS_TRAIL(t1)) {
- args->source = (const char *)(source + 1);
- return (ch + t1) - offsetsFromUTF8[2];
- }
- } else { // countTrailBytes == 3
- uint8_t t1 = *source, t2, t3;
- if(U8_IS_VALID_LEAD4_AND_T1(myByte, t1) && U8_IS_TRAIL(t2 = *++source) &&
- U8_IS_TRAIL(t3 = *++source)) {
- args->source = (const char *)(source + 1);
- return (((((ch + t1) << 6) + t2) << 6) + t3) - offsetsFromUTF8[4];
- }
- }
- args->source = (const char *)source;
-
- for(i = 0; sourceInitial < source; ++i) {
- cnv->toUBytes[i] = *sourceInitial++;
- }
- cnv->toULength = i;
- *err = U_ILLEGAL_CHAR_FOUND;
- return 0xffff;
-}
-U_CDECL_END
-
-/* UTF-8-from-UTF-8 conversion functions ------------------------------------ */
-
-U_CDECL_BEGIN
-/* "Convert" UTF-8 to UTF-8: Validate and copy. Modified from ucnv_DBCSFromUTF8(). */
-static void U_CALLCONV
-ucnv_UTF8FromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
- UConverterToUnicodeArgs *pToUArgs,
- UErrorCode *pErrorCode) {
- UConverter *utf8;
- const uint8_t *source, *sourceLimit;
- uint8_t *target;
- int32_t targetCapacity;
- int32_t count;
-
- int8_t oldToULength, toULength, toULimit;
-
- UChar32 c;
- uint8_t b, t1, t2;
-
- /* set up the local pointers */
- utf8=pToUArgs->converter;
- source=(uint8_t *)pToUArgs->source;
- sourceLimit=(uint8_t *)pToUArgs->sourceLimit;
- target=(uint8_t *)pFromUArgs->target;
- targetCapacity=(int32_t)(pFromUArgs->targetLimit-pFromUArgs->target);
-
- /* get the converter state from the UTF-8 UConverter */
- if(utf8->toULength > 0) {
- toULength=oldToULength=utf8->toULength;
- toULimit=(int8_t)utf8->mode;
- c=(UChar32)utf8->toUnicodeStatus;
- } else {
- toULength=oldToULength=toULimit=0;
- c = 0;
- }
-
- count=(int32_t)(sourceLimit-source)+oldToULength;
- if(count<toULimit) {
- /*
- * Not enough input to complete the partial character.
- * Jump to moreBytes below - it will not output to target.
- */
- } else if(targetCapacity<toULimit) {
- /*
- * Not enough target capacity to output the partial character.
- * Let the standard converter handle this.
- */
- *pErrorCode=U_USING_DEFAULT_WARNING;
- return;
- } else {
- // Use a single counter for source and target, counting the minimum of
- // the source length and the target capacity.
- // Let the standard converter handle edge cases.
- if(count>targetCapacity) {
- count=targetCapacity;
- }
-
- // The conversion loop checks count>0 only once per character.
- // If the buffer ends with a truncated sequence,
- // then we reduce the count to stop before that,
- // and collect the remaining bytes after the conversion loop.
-
- // 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;
- U8_TRUNCATE_IF_INCOMPLETE(source, 0, length);
- count=toULimit+length;
- }
-
- if(c!=0) {
- utf8->toUnicodeStatus=0;
- utf8->toULength=0;
- goto moreBytes;
- /* See note in ucnv_SBCSFromUTF8() about this goto. */
- }
-
- /* conversion loop */
- while(count>0) {
- b=*source++;
- if(U8_IS_SINGLE(b)) {
- /* convert ASCII */
- *target++=b;
- --count;
- continue;
- } else {
- if(b>=0xe0) {
- if( /* handle U+0800..U+FFFF inline */
- b<0xf0 &&
- U8_IS_VALID_LEAD3_AND_T1(b, t1=source[0]) &&
- U8_IS_TRAIL(t2=source[1])
- ) {
- source+=2;
- *target++=b;
- *target++=t1;
- *target++=t2;
- count-=3;
- continue;
- }
- } else {
- if( /* handle U+0080..U+07FF inline */
- b>=0xc2 &&
- U8_IS_TRAIL(t1=*source)
- ) {
- ++source;
- *target++=b;
- *target++=t1;
- count-=2;
- continue;
- }
- }
-
- /* handle "complicated" and error cases, and continuing partial characters */
- oldToULength=0;
- toULength=1;
- toULimit=U8_COUNT_BYTES_NON_ASCII(b);
- c=b;
-moreBytes:
- while(toULength<toULimit) {
- if(source<sourceLimit) {
- b=*source;
- if(icu::UTF8::isValidTrail(c, b, toULength, toULimit)) {
- ++source;
- ++toULength;
- c=(c<<6)+b;
- } else {
- break; /* sequence too short, stop with toULength<toULimit */
- }
- } else {
- /* store the partial UTF-8 character, compatible with the regular UTF-8 converter */
- source-=(toULength-oldToULength);
- while(oldToULength<toULength) {
- utf8->toUBytes[oldToULength++]=*source++;
- }
- utf8->toUnicodeStatus=c;
- utf8->toULength=toULength;
- utf8->mode=toULimit;
- pToUArgs->source=(char *)source;
- pFromUArgs->target=(char *)target;
- return;
- }
- }
-
- if(toULength!=toULimit) {
- /* error handling: illegal UTF-8 byte sequence */
- source-=(toULength-oldToULength);
- while(oldToULength<toULength) {
- utf8->toUBytes[oldToULength++]=*source++;
- }
- utf8->toULength=toULength;
- pToUArgs->source=(char *)source;
- pFromUArgs->target=(char *)target;
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- return;
- }
-
- /* copy the legal byte sequence to the target */
- {
- int8_t i;
-
- for(i=0; i<oldToULength; ++i) {
- *target++=utf8->toUBytes[i];
- }
- source-=(toULength-oldToULength);
- for(; i<toULength; ++i) {
- *target++=*source++;
- }
- count-=toULength;
- }
- }
- }
- U_ASSERT(count>=0);
-
- if(U_SUCCESS(*pErrorCode) && source<sourceLimit) {
- if(target==(const uint8_t *)pFromUArgs->targetLimit) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- } else {
- b=*source;
- toULimit=U8_COUNT_BYTES(b);
- if(toULimit>(sourceLimit-source)) {
- /* collect a truncated byte sequence */
- toULength=0;
- c=b;
- for(;;) {
- utf8->toUBytes[toULength++]=b;
- if(++source==sourceLimit) {
- /* partial byte sequence at end of source */
- utf8->toUnicodeStatus=c;
- utf8->toULength=toULength;
- utf8->mode=toULimit;
- break;
- } else if(!icu::UTF8::isValidTrail(c, b=*source, toULength, toULimit)) {
- utf8->toULength=toULength;
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- break;
- }
- c=(c<<6)+b;
- }
- } else {
- /* partial-sequence target overflow: fall back to the pivoting implementation */
- *pErrorCode=U_USING_DEFAULT_WARNING;
- }
- }
- }
-
- /* write back the updated pointers */
- pToUArgs->source=(char *)source;
- pFromUArgs->target=(char *)target;
-}
-
-U_CDECL_END
-
-/* UTF-8 converter data ----------------------------------------------------- */
-
-static const UConverterImpl _UTF8Impl={
- UCNV_UTF8,
-
- NULL,
- NULL,
-
- NULL,
- NULL,
- NULL,
-
- ucnv_toUnicode_UTF8,
- ucnv_toUnicode_UTF8_OFFSETS_LOGIC,
- ucnv_fromUnicode_UTF8,
- ucnv_fromUnicode_UTF8_OFFSETS_LOGIC,
- ucnv_getNextUChar_UTF8,
-
- NULL,
- NULL,
- NULL,
- NULL,
- ucnv_getNonSurrogateUnicodeSet,
-
- ucnv_UTF8FromUTF8,
- ucnv_UTF8FromUTF8
-};
-
-/* The 1208 CCSID refers to any version of Unicode of UTF-8 */
-static const UConverterStaticData _UTF8StaticData={
- sizeof(UConverterStaticData),
- "UTF-8",
- 1208, UCNV_IBM, UCNV_UTF8,
- 1, 3, /* max 3 bytes per UChar from UTF-8 (4 bytes from surrogate _pair_) */
- { 0xef, 0xbf, 0xbd, 0 },3,FALSE,FALSE,
- 0,
- 0,
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
-};
-
-
-const UConverterSharedData _UTF8Data=
- UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF8StaticData, &_UTF8Impl);
-
-/* CESU-8 converter data ---------------------------------------------------- */
-
-static const UConverterImpl _CESU8Impl={
- UCNV_CESU8,
-
- NULL,
- NULL,
-
- NULL,
- NULL,
- NULL,
-
- ucnv_toUnicode_UTF8,
- ucnv_toUnicode_UTF8_OFFSETS_LOGIC,
- ucnv_fromUnicode_UTF8,
- ucnv_fromUnicode_UTF8_OFFSETS_LOGIC,
- NULL,
-
- NULL,
- NULL,
- NULL,
- NULL,
- ucnv_getCompleteUnicodeSet,
-
- NULL,
- NULL
-};
-
-static const UConverterStaticData _CESU8StaticData={
- sizeof(UConverterStaticData),
- "CESU-8",
- 9400, /* CCSID for CESU-8 */
- UCNV_UNKNOWN, UCNV_CESU8, 1, 3,
- { 0xef, 0xbf, 0xbd, 0 },3,FALSE,FALSE,
- 0,
- 0,
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
-};
-
-
-const UConverterSharedData _CESU8Data=
- UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_CESU8StaticData, &_CESU8Impl);
-
-#endif
+U_CDECL_END
+
+/* UTF-8-from-UTF-8 conversion functions ------------------------------------ */
+
+U_CDECL_BEGIN
+/* "Convert" UTF-8 to UTF-8: Validate and copy. Modified from ucnv_DBCSFromUTF8(). */
+static void U_CALLCONV
+ucnv_UTF8FromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
+ UConverterToUnicodeArgs *pToUArgs,
+ UErrorCode *pErrorCode) {
+ UConverter *utf8;
+ const uint8_t *source, *sourceLimit;
+ uint8_t *target;
+ int32_t targetCapacity;
+ int32_t count;
+
+ int8_t oldToULength, toULength, toULimit;
+
+ UChar32 c;
+ uint8_t b, t1, t2;
+
+ /* set up the local pointers */
+ utf8=pToUArgs->converter;
+ source=(uint8_t *)pToUArgs->source;
+ sourceLimit=(uint8_t *)pToUArgs->sourceLimit;
+ target=(uint8_t *)pFromUArgs->target;
+ targetCapacity=(int32_t)(pFromUArgs->targetLimit-pFromUArgs->target);
+
+ /* get the converter state from the UTF-8 UConverter */
+ if(utf8->toULength > 0) {
+ toULength=oldToULength=utf8->toULength;
+ toULimit=(int8_t)utf8->mode;
+ c=(UChar32)utf8->toUnicodeStatus;
+ } else {
+ toULength=oldToULength=toULimit=0;
+ c = 0;
+ }
+
+ count=(int32_t)(sourceLimit-source)+oldToULength;
+ if(count<toULimit) {
+ /*
+ * Not enough input to complete the partial character.
+ * Jump to moreBytes below - it will not output to target.
+ */
+ } else if(targetCapacity<toULimit) {
+ /*
+ * Not enough target capacity to output the partial character.
+ * Let the standard converter handle this.
+ */
+ *pErrorCode=U_USING_DEFAULT_WARNING;
+ return;
+ } else {
+ // Use a single counter for source and target, counting the minimum of
+ // the source length and the target capacity.
+ // Let the standard converter handle edge cases.
+ if(count>targetCapacity) {
+ count=targetCapacity;
+ }
+
+ // The conversion loop checks count>0 only once per character.
+ // If the buffer ends with a truncated sequence,
+ // then we reduce the count to stop before that,
+ // and collect the remaining bytes after the conversion loop.
+
+ // 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;
+ U8_TRUNCATE_IF_INCOMPLETE(source, 0, length);
+ count=toULimit+length;
+ }
+
+ if(c!=0) {
+ utf8->toUnicodeStatus=0;
+ utf8->toULength=0;
+ goto moreBytes;
+ /* See note in ucnv_SBCSFromUTF8() about this goto. */
+ }
+
+ /* conversion loop */
+ while(count>0) {
+ b=*source++;
+ if(U8_IS_SINGLE(b)) {
+ /* convert ASCII */
+ *target++=b;
+ --count;
+ continue;
+ } else {
+ if(b>=0xe0) {
+ if( /* handle U+0800..U+FFFF inline */
+ b<0xf0 &&
+ U8_IS_VALID_LEAD3_AND_T1(b, t1=source[0]) &&
+ U8_IS_TRAIL(t2=source[1])
+ ) {
+ source+=2;
+ *target++=b;
+ *target++=t1;
+ *target++=t2;
+ count-=3;
+ continue;
+ }
+ } else {
+ if( /* handle U+0080..U+07FF inline */
+ b>=0xc2 &&
+ U8_IS_TRAIL(t1=*source)
+ ) {
+ ++source;
+ *target++=b;
+ *target++=t1;
+ count-=2;
+ continue;
+ }
+ }
+
+ /* handle "complicated" and error cases, and continuing partial characters */
+ oldToULength=0;
+ toULength=1;
+ toULimit=U8_COUNT_BYTES_NON_ASCII(b);
+ c=b;
+moreBytes:
+ while(toULength<toULimit) {
+ if(source<sourceLimit) {
+ b=*source;
+ if(icu::UTF8::isValidTrail(c, b, toULength, toULimit)) {
+ ++source;
+ ++toULength;
+ c=(c<<6)+b;
+ } else {
+ break; /* sequence too short, stop with toULength<toULimit */
+ }
+ } else {
+ /* store the partial UTF-8 character, compatible with the regular UTF-8 converter */
+ source-=(toULength-oldToULength);
+ while(oldToULength<toULength) {
+ utf8->toUBytes[oldToULength++]=*source++;
+ }
+ utf8->toUnicodeStatus=c;
+ utf8->toULength=toULength;
+ utf8->mode=toULimit;
+ pToUArgs->source=(char *)source;
+ pFromUArgs->target=(char *)target;
+ return;
+ }
+ }
+
+ if(toULength!=toULimit) {
+ /* error handling: illegal UTF-8 byte sequence */
+ source-=(toULength-oldToULength);
+ while(oldToULength<toULength) {
+ utf8->toUBytes[oldToULength++]=*source++;
+ }
+ utf8->toULength=toULength;
+ pToUArgs->source=(char *)source;
+ pFromUArgs->target=(char *)target;
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ return;
+ }
+
+ /* copy the legal byte sequence to the target */
+ {
+ int8_t i;
+
+ for(i=0; i<oldToULength; ++i) {
+ *target++=utf8->toUBytes[i];
+ }
+ source-=(toULength-oldToULength);
+ for(; i<toULength; ++i) {
+ *target++=*source++;
+ }
+ count-=toULength;
+ }
+ }
+ }
+ U_ASSERT(count>=0);
+
+ if(U_SUCCESS(*pErrorCode) && source<sourceLimit) {
+ if(target==(const uint8_t *)pFromUArgs->targetLimit) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ } else {
+ b=*source;
+ toULimit=U8_COUNT_BYTES(b);
+ if(toULimit>(sourceLimit-source)) {
+ /* collect a truncated byte sequence */
+ toULength=0;
+ c=b;
+ for(;;) {
+ utf8->toUBytes[toULength++]=b;
+ if(++source==sourceLimit) {
+ /* partial byte sequence at end of source */
+ utf8->toUnicodeStatus=c;
+ utf8->toULength=toULength;
+ utf8->mode=toULimit;
+ break;
+ } else if(!icu::UTF8::isValidTrail(c, b=*source, toULength, toULimit)) {
+ utf8->toULength=toULength;
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ break;
+ }
+ c=(c<<6)+b;
+ }
+ } else {
+ /* partial-sequence target overflow: fall back to the pivoting implementation */
+ *pErrorCode=U_USING_DEFAULT_WARNING;
+ }
+ }
+ }
+
+ /* write back the updated pointers */
+ pToUArgs->source=(char *)source;
+ pFromUArgs->target=(char *)target;
+}
+
+U_CDECL_END
+
+/* UTF-8 converter data ----------------------------------------------------- */
+
+static const UConverterImpl _UTF8Impl={
+ UCNV_UTF8,
+
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+ NULL,
+
+ ucnv_toUnicode_UTF8,
+ ucnv_toUnicode_UTF8_OFFSETS_LOGIC,
+ ucnv_fromUnicode_UTF8,
+ ucnv_fromUnicode_UTF8_OFFSETS_LOGIC,
+ ucnv_getNextUChar_UTF8,
+
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ ucnv_getNonSurrogateUnicodeSet,
+
+ ucnv_UTF8FromUTF8,
+ ucnv_UTF8FromUTF8
+};
+
+/* The 1208 CCSID refers to any version of Unicode of UTF-8 */
+static const UConverterStaticData _UTF8StaticData={
+ sizeof(UConverterStaticData),
+ "UTF-8",
+ 1208, UCNV_IBM, UCNV_UTF8,
+ 1, 3, /* max 3 bytes per UChar from UTF-8 (4 bytes from surrogate _pair_) */
+ { 0xef, 0xbf, 0xbd, 0 },3,FALSE,FALSE,
+ 0,
+ 0,
+ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
+};
+
+
+const UConverterSharedData _UTF8Data=
+ UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF8StaticData, &_UTF8Impl);
+
+/* CESU-8 converter data ---------------------------------------------------- */
+
+static const UConverterImpl _CESU8Impl={
+ UCNV_CESU8,
+
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+ NULL,
+
+ ucnv_toUnicode_UTF8,
+ ucnv_toUnicode_UTF8_OFFSETS_LOGIC,
+ ucnv_fromUnicode_UTF8,
+ ucnv_fromUnicode_UTF8_OFFSETS_LOGIC,
+ NULL,
+
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ ucnv_getCompleteUnicodeSet,
+
+ NULL,
+ NULL
+};
+
+static const UConverterStaticData _CESU8StaticData={
+ sizeof(UConverterStaticData),
+ "CESU-8",
+ 9400, /* CCSID for CESU-8 */
+ UCNV_UNKNOWN, UCNV_CESU8, 1, 3,
+ { 0xef, 0xbf, 0xbd, 0 },3,FALSE,FALSE,
+ 0,
+ 0,
+ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
+};
+
+
+const UConverterSharedData _CESU8Data=
+ UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_CESU8StaticData, &_CESU8Impl);
+
+#endif
diff --git a/contrib/libs/icu/common/ucnvbocu.cpp b/contrib/libs/icu/common/ucnvbocu.cpp
index d1f542800e..7c2aab5655 100644
--- a/contrib/libs/icu/common/ucnvbocu.cpp
+++ b/contrib/libs/icu/common/ucnvbocu.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: ucnvbocu.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -202,14 +202,14 @@ bocu1TrailToByte[BOCU1_TRAIL_CONTROLS_COUNT]={
* @param d Divisor.
* @param m Output variable for the rest (modulo result).
*/
-#define NEGDIVMOD(n, d, m) UPRV_BLOCK_MACRO_BEGIN { \
+#define NEGDIVMOD(n, d, m) UPRV_BLOCK_MACRO_BEGIN { \
(m)=(n)%(d); \
(n)/=(d); \
if((m)<0) { \
--(n); \
(m)+=(d); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/* Faster versions of packDiff() for single-byte-encoded diff values. */
diff --git a/contrib/libs/icu/common/ucnvdisp.cpp b/contrib/libs/icu/common/ucnvdisp.cpp
index a4c95a651f..ac86b98597 100644
--- a/contrib/libs/icu/common/ucnvdisp.cpp
+++ b/contrib/libs/icu/common/ucnvdisp.cpp
@@ -1,88 +1,88 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 1998-2004, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-*
-* ucnvdisp.c:
-* Implements APIs for the ICU's codeset conversion library display names.
-*
-* Modification History:
-*
-* Date Name Description
-* 04/04/99 helena Fixed internal header inclusion.
-* 05/09/00 helena Added implementation to handle fallback mappings.
-* 06/20/2000 helena OS/400 port changes; mostly typecast.
-* 09/08/2004 grhoten split from ucnv.c
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_CONVERSION
-
-#include "unicode/ustring.h"
-#include "unicode/ures.h"
-#include "unicode/ucnv.h"
-#include "cstring.h"
-#include "ustr_imp.h"
-#include "ucnv_imp.h"
-#include "putilimp.h"
-
-U_CAPI int32_t U_EXPORT2
-ucnv_getDisplayName(const UConverter *cnv,
- const char *displayLocale,
- UChar *displayName, int32_t displayNameCapacity,
- UErrorCode *pErrorCode) {
- UResourceBundle *rb;
- const UChar *name;
- int32_t length;
- UErrorCode localStatus = U_ZERO_ERROR;
-
- /* check arguments */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
-
- if(cnv==NULL || displayNameCapacity<0 || (displayNameCapacity>0 && displayName==NULL)) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* open the resource bundle and get the display name string */
- rb=ures_open(NULL, displayLocale, pErrorCode);
- if(U_FAILURE(*pErrorCode)) {
- return 0;
- }
-
- /* use the internal name as the key */
- name=ures_getStringByKey(rb, cnv->sharedData->staticData->name, &length, &localStatus);
- ures_close(rb);
-
- if(U_SUCCESS(localStatus)) {
- /* copy the string */
- if (*pErrorCode == U_ZERO_ERROR) {
- *pErrorCode = localStatus;
- }
- u_memcpy(displayName, name, uprv_min(length, displayNameCapacity)*U_SIZEOF_UCHAR);
- } else {
- /* convert the internal name into a Unicode string */
- length=(int32_t)uprv_strlen(cnv->sharedData->staticData->name);
- u_charsToUChars(cnv->sharedData->staticData->name, displayName, uprv_min(length, displayNameCapacity));
- }
- return u_terminateUChars(displayName, displayNameCapacity, length, pErrorCode);
-}
-
-#endif
-
-/*
- * Hey, Emacs, please set the following:
- *
- * Local Variables:
- * indent-tabs-mode: nil
- * End:
- *
- */
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 1998-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+*
+* ucnvdisp.c:
+* Implements APIs for the ICU's codeset conversion library display names.
+*
+* Modification History:
+*
+* Date Name Description
+* 04/04/99 helena Fixed internal header inclusion.
+* 05/09/00 helena Added implementation to handle fallback mappings.
+* 06/20/2000 helena OS/400 port changes; mostly typecast.
+* 09/08/2004 grhoten split from ucnv.c
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "unicode/ustring.h"
+#include "unicode/ures.h"
+#include "unicode/ucnv.h"
+#include "cstring.h"
+#include "ustr_imp.h"
+#include "ucnv_imp.h"
+#include "putilimp.h"
+
+U_CAPI int32_t U_EXPORT2
+ucnv_getDisplayName(const UConverter *cnv,
+ const char *displayLocale,
+ UChar *displayName, int32_t displayNameCapacity,
+ UErrorCode *pErrorCode) {
+ UResourceBundle *rb;
+ const UChar *name;
+ int32_t length;
+ UErrorCode localStatus = U_ZERO_ERROR;
+
+ /* check arguments */
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+
+ if(cnv==NULL || displayNameCapacity<0 || (displayNameCapacity>0 && displayName==NULL)) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* open the resource bundle and get the display name string */
+ rb=ures_open(NULL, displayLocale, pErrorCode);
+ if(U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+
+ /* use the internal name as the key */
+ name=ures_getStringByKey(rb, cnv->sharedData->staticData->name, &length, &localStatus);
+ ures_close(rb);
+
+ if(U_SUCCESS(localStatus)) {
+ /* copy the string */
+ if (*pErrorCode == U_ZERO_ERROR) {
+ *pErrorCode = localStatus;
+ }
+ u_memcpy(displayName, name, uprv_min(length, displayNameCapacity)*U_SIZEOF_UCHAR);
+ } else {
+ /* convert the internal name into a Unicode string */
+ length=(int32_t)uprv_strlen(cnv->sharedData->staticData->name);
+ u_charsToUChars(cnv->sharedData->staticData->name, displayName, uprv_min(length, displayNameCapacity));
+ }
+ return u_terminateUChars(displayName, displayNameCapacity, length, pErrorCode);
+}
+
+#endif
+
+/*
+ * Hey, Emacs, please set the following:
+ *
+ * Local Variables:
+ * indent-tabs-mode: nil
+ * End:
+ *
+ */
diff --git a/contrib/libs/icu/common/ucnvhz.cpp b/contrib/libs/icu/common/ucnvhz.cpp
index 676ff7691a..6b2f5faaf0 100644
--- a/contrib/libs/icu/common/ucnvhz.cpp
+++ b/contrib/libs/icu/common/ucnvhz.cpp
@@ -1,625 +1,625 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-**********************************************************************
-* Copyright (C) 2000-2015, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
-* file name: ucnvhz.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+**********************************************************************
+* Copyright (C) 2000-2015, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* file name: ucnvhz.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2000oct16
+* created by: Ram Viswanadha
+* 10/31/2000 Ram Implemented offsets logic function
+*
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION
+
+#include "cmemory.h"
+#include "unicode/ucnv.h"
+#include "unicode/ucnv_cb.h"
+#include "unicode/uset.h"
+#include "unicode/utf16.h"
+#include "ucnv_bld.h"
+#include "ucnv_cnv.h"
+#include "ucnv_imp.h"
+
+#define UCNV_TILDE 0x7E /* ~ */
+#define UCNV_OPEN_BRACE 0x7B /* { */
+#define UCNV_CLOSE_BRACE 0x7D /* } */
+#define SB_ESCAPE "\x7E\x7D"
+#define DB_ESCAPE "\x7E\x7B"
+#define TILDE_ESCAPE "\x7E\x7E"
+#define ESC_LEN 2
+
+
+#define CONCAT_ESCAPE_MACRO(args, targetIndex,targetLength,strToAppend, err, len,sourceIndex) UPRV_BLOCK_MACRO_BEGIN { \
+ while(len-->0){ \
+ if(targetIndex < targetLength){ \
+ args->target[targetIndex] = (unsigned char) *strToAppend; \
+ if(args->offsets!=NULL){ \
+ *(offsets++) = sourceIndex-1; \
+ } \
+ targetIndex++; \
+ } \
+ else{ \
+ args->converter->charErrorBuffer[(int)args->converter->charErrorBufferLength++] = (unsigned char) *strToAppend; \
+ *err =U_BUFFER_OVERFLOW_ERROR; \
+ } \
+ strToAppend++; \
+ } \
+} UPRV_BLOCK_MACRO_END
+
+
+typedef struct{
+ UConverter* gbConverter;
+ int32_t targetIndex;
+ int32_t sourceIndex;
+ UBool isEscapeAppended;
+ UBool isStateDBCS;
+ UBool isTargetUCharDBCS;
+ UBool isEmptySegment;
+}UConverterDataHZ;
+
+
+U_CDECL_BEGIN
+static void U_CALLCONV
+_HZOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){
+ UConverter *gbConverter;
+ if(pArgs->onlyTestIsLoadable) {
+ ucnv_canCreateConverter("GBK", errorCode); /* errorCode carries result */
+ return;
+ }
+ gbConverter = ucnv_open("GBK", errorCode);
+ if(U_FAILURE(*errorCode)) {
+ return;
+ }
+ cnv->toUnicodeStatus = 0;
+ cnv->fromUnicodeStatus= 0;
+ cnv->mode=0;
+ cnv->fromUChar32=0x0000;
+ cnv->extraInfo = uprv_calloc(1, sizeof(UConverterDataHZ));
+ if(cnv->extraInfo != NULL){
+ ((UConverterDataHZ*)cnv->extraInfo)->gbConverter = gbConverter;
+ }
+ else {
+ ucnv_close(gbConverter);
+ *errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+}
+
+static void U_CALLCONV
+_HZClose(UConverter *cnv){
+ if(cnv->extraInfo != NULL) {
+ ucnv_close (((UConverterDataHZ *) (cnv->extraInfo))->gbConverter);
+ if(!cnv->isExtraLocal) {
+ uprv_free(cnv->extraInfo);
+ }
+ cnv->extraInfo = NULL;
+ }
+}
+
+static void U_CALLCONV
+_HZReset(UConverter *cnv, UConverterResetChoice choice){
+ if(choice<=UCNV_RESET_TO_UNICODE) {
+ cnv->toUnicodeStatus = 0;
+ cnv->mode=0;
+ if(cnv->extraInfo != NULL){
+ ((UConverterDataHZ*)cnv->extraInfo)->isStateDBCS = FALSE;
+ ((UConverterDataHZ*)cnv->extraInfo)->isEmptySegment = FALSE;
+ }
+ }
+ if(choice!=UCNV_RESET_TO_UNICODE) {
+ cnv->fromUnicodeStatus= 0;
+ cnv->fromUChar32=0x0000;
+ if(cnv->extraInfo != NULL){
+ ((UConverterDataHZ*)cnv->extraInfo)->isEscapeAppended = FALSE;
+ ((UConverterDataHZ*)cnv->extraInfo)->targetIndex = 0;
+ ((UConverterDataHZ*)cnv->extraInfo)->sourceIndex = 0;
+ ((UConverterDataHZ*)cnv->extraInfo)->isTargetUCharDBCS = FALSE;
+ }
+ }
+}
+
+/**************************************HZ Encoding*************************************************
+* Rules for HZ encoding
*
-* created on: 2000oct16
-* created by: Ram Viswanadha
-* 10/31/2000 Ram Implemented offsets logic function
-*
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION
-
-#include "cmemory.h"
-#include "unicode/ucnv.h"
-#include "unicode/ucnv_cb.h"
-#include "unicode/uset.h"
-#include "unicode/utf16.h"
-#include "ucnv_bld.h"
-#include "ucnv_cnv.h"
-#include "ucnv_imp.h"
-
-#define UCNV_TILDE 0x7E /* ~ */
-#define UCNV_OPEN_BRACE 0x7B /* { */
-#define UCNV_CLOSE_BRACE 0x7D /* } */
-#define SB_ESCAPE "\x7E\x7D"
-#define DB_ESCAPE "\x7E\x7B"
-#define TILDE_ESCAPE "\x7E\x7E"
-#define ESC_LEN 2
-
-
-#define CONCAT_ESCAPE_MACRO(args, targetIndex,targetLength,strToAppend, err, len,sourceIndex) UPRV_BLOCK_MACRO_BEGIN { \
- while(len-->0){ \
- if(targetIndex < targetLength){ \
- args->target[targetIndex] = (unsigned char) *strToAppend; \
- if(args->offsets!=NULL){ \
- *(offsets++) = sourceIndex-1; \
- } \
- targetIndex++; \
- } \
- else{ \
- args->converter->charErrorBuffer[(int)args->converter->charErrorBufferLength++] = (unsigned char) *strToAppend; \
- *err =U_BUFFER_OVERFLOW_ERROR; \
- } \
- strToAppend++; \
- } \
-} UPRV_BLOCK_MACRO_END
-
-
-typedef struct{
- UConverter* gbConverter;
- int32_t targetIndex;
- int32_t sourceIndex;
- UBool isEscapeAppended;
- UBool isStateDBCS;
- UBool isTargetUCharDBCS;
- UBool isEmptySegment;
-}UConverterDataHZ;
-
-
-U_CDECL_BEGIN
-static void U_CALLCONV
-_HZOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){
- UConverter *gbConverter;
- if(pArgs->onlyTestIsLoadable) {
- ucnv_canCreateConverter("GBK", errorCode); /* errorCode carries result */
- return;
- }
- gbConverter = ucnv_open("GBK", errorCode);
- if(U_FAILURE(*errorCode)) {
- return;
- }
- cnv->toUnicodeStatus = 0;
- cnv->fromUnicodeStatus= 0;
- cnv->mode=0;
- cnv->fromUChar32=0x0000;
- cnv->extraInfo = uprv_calloc(1, sizeof(UConverterDataHZ));
- if(cnv->extraInfo != NULL){
- ((UConverterDataHZ*)cnv->extraInfo)->gbConverter = gbConverter;
- }
- else {
- ucnv_close(gbConverter);
- *errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
-}
-
-static void U_CALLCONV
-_HZClose(UConverter *cnv){
- if(cnv->extraInfo != NULL) {
- ucnv_close (((UConverterDataHZ *) (cnv->extraInfo))->gbConverter);
- if(!cnv->isExtraLocal) {
- uprv_free(cnv->extraInfo);
- }
- cnv->extraInfo = NULL;
- }
-}
-
-static void U_CALLCONV
-_HZReset(UConverter *cnv, UConverterResetChoice choice){
- if(choice<=UCNV_RESET_TO_UNICODE) {
- cnv->toUnicodeStatus = 0;
- cnv->mode=0;
- if(cnv->extraInfo != NULL){
- ((UConverterDataHZ*)cnv->extraInfo)->isStateDBCS = FALSE;
- ((UConverterDataHZ*)cnv->extraInfo)->isEmptySegment = FALSE;
- }
- }
- if(choice!=UCNV_RESET_TO_UNICODE) {
- cnv->fromUnicodeStatus= 0;
- cnv->fromUChar32=0x0000;
- if(cnv->extraInfo != NULL){
- ((UConverterDataHZ*)cnv->extraInfo)->isEscapeAppended = FALSE;
- ((UConverterDataHZ*)cnv->extraInfo)->targetIndex = 0;
- ((UConverterDataHZ*)cnv->extraInfo)->sourceIndex = 0;
- ((UConverterDataHZ*)cnv->extraInfo)->isTargetUCharDBCS = FALSE;
- }
- }
-}
-
-/**************************************HZ Encoding*************************************************
-* Rules for HZ encoding
-*
-* In ASCII mode, a byte is interpreted as an ASCII character, unless a
-* '~' is encountered. The character '~' is an escape character. By
-* convention, it must be immediately followed ONLY by '~', '{' or '\n'
-* (<LF>), with the following special meaning.
-
-* 1. The escape sequence '~~' is interpreted as a '~'.
-* 2. The escape-to-GB sequence '~{' switches the mode from ASCII to GB.
-* 3. The escape sequence '~\n' is a line-continuation marker to be
-* consumed with no output produced.
-* In GB mode, characters are interpreted two bytes at a time as (pure)
-* GB codes until the escape-from-GB code '~}' is read. This code
-* switches the mode from GB back to ASCII. (Note that the escape-
-* from-GB code '~}' ($7E7D) is outside the defined GB range.)
-*
-* Source: RFC 1842
-*
-* Note that the formal syntax in RFC 1842 is invalid. I assume that the
-* intended definition of single-byte-segment is as follows (pedberg):
-* single-byte-segment = single-byte-seq 1*single-byte-char
-*/
-
-
-static void U_CALLCONV
-UConverter_toUnicode_HZ_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
- UErrorCode* err){
- char tempBuf[2];
- const char *mySource = ( char *) args->source;
- UChar *myTarget = args->target;
- const char *mySourceLimit = args->sourceLimit;
- UChar32 targetUniChar = 0x0000;
- int32_t mySourceChar = 0x0000;
- UConverterDataHZ* myData=(UConverterDataHZ*)(args->converter->extraInfo);
- tempBuf[0]=0;
- tempBuf[1]=0;
-
- /* Calling code already handles this situation. */
- /*if ((args->converter == NULL) || (args->targetLimit < args->target) || (mySourceLimit < args->source)){
- *err = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }*/
-
- while(mySource< mySourceLimit){
-
- if(myTarget < args->targetLimit){
-
- mySourceChar= (unsigned char) *mySource++;
-
- if(args->converter->mode == UCNV_TILDE) {
- /* second byte after ~ */
- args->converter->mode=0;
- switch(mySourceChar) {
- case 0x0A:
- /* no output for ~\n (line-continuation marker) */
- continue;
- case UCNV_TILDE:
- if(args->offsets) {
- args->offsets[myTarget - args->target]=(int32_t)(mySource - args->source - 2);
- }
- *(myTarget++)=(UChar)mySourceChar;
- myData->isEmptySegment = FALSE;
- continue;
- case UCNV_OPEN_BRACE:
- case UCNV_CLOSE_BRACE:
- myData->isStateDBCS = (mySourceChar == UCNV_OPEN_BRACE);
- if (myData->isEmptySegment) {
- myData->isEmptySegment = FALSE; /* we are handling it, reset to avoid future spurious errors */
- *err = U_ILLEGAL_ESCAPE_SEQUENCE;
- args->converter->toUCallbackReason = UCNV_IRREGULAR;
- args->converter->toUBytes[0] = UCNV_TILDE;
- args->converter->toUBytes[1] = static_cast<uint8_t>(mySourceChar);
- args->converter->toULength = 2;
- args->target = myTarget;
- args->source = mySource;
- return;
- }
- myData->isEmptySegment = TRUE;
- continue;
- default:
- /* if the first byte is equal to TILDE and the trail byte
- * is not a valid byte then it is an error condition
- */
- /*
- * Ticket 5691: consistent illegal sequences:
- * - We include at least the first byte in the illegal sequence.
- * - If any of the non-initial bytes could be the start of a character,
- * we stop the illegal sequence before the first one of those.
- */
- myData->isEmptySegment = FALSE; /* different error here, reset this to avoid spurious future error */
- *err = U_ILLEGAL_ESCAPE_SEQUENCE;
- args->converter->toUBytes[0] = UCNV_TILDE;
- if( myData->isStateDBCS ?
- (0x21 <= mySourceChar && mySourceChar <= 0x7e) :
- mySourceChar <= 0x7f
- ) {
- /* The current byte could be the start of a character: Back it out. */
- args->converter->toULength = 1;
- --mySource;
- } else {
- /* Include the current byte in the illegal sequence. */
- args->converter->toUBytes[1] = static_cast<uint8_t>(mySourceChar);
- args->converter->toULength = 2;
- }
- args->target = myTarget;
- args->source = mySource;
- return;
- }
- } else if(myData->isStateDBCS) {
- if(args->converter->toUnicodeStatus == 0x00){
- /* lead byte */
- if(mySourceChar == UCNV_TILDE) {
- args->converter->mode = UCNV_TILDE;
- } else {
- /* add another bit to distinguish a 0 byte from not having seen a lead byte */
- args->converter->toUnicodeStatus = (uint32_t) (mySourceChar | 0x100);
- myData->isEmptySegment = FALSE; /* the segment has something, either valid or will produce a different error, so reset this */
- }
- continue;
- }
- else{
- /* trail byte */
- int leadIsOk, trailIsOk;
- uint32_t leadByte = args->converter->toUnicodeStatus & 0xff;
- targetUniChar = 0xffff;
- /*
- * Ticket 5691: consistent illegal sequences:
- * - We include at least the first byte in the illegal sequence.
- * - If any of the non-initial bytes could be the start of a character,
- * we stop the illegal sequence before the first one of those.
- *
- * In HZ DBCS, if the second byte is in the 21..7e range,
- * we report only the first byte as the illegal sequence.
- * Otherwise we convert or report the pair of bytes.
- */
- leadIsOk = (uint8_t)(leadByte - 0x21) <= (0x7d - 0x21);
- trailIsOk = (uint8_t)(mySourceChar - 0x21) <= (0x7e - 0x21);
- if (leadIsOk && trailIsOk) {
- tempBuf[0] = (char) (leadByte+0x80) ;
- tempBuf[1] = (char) (mySourceChar+0x80);
- targetUniChar = ucnv_MBCSSimpleGetNextUChar(myData->gbConverter->sharedData,
- tempBuf, 2, args->converter->useFallback);
- mySourceChar= (leadByte << 8) | mySourceChar;
- } else if (trailIsOk) {
- /* report a single illegal byte and continue with the following DBCS starter byte */
- --mySource;
- mySourceChar = (int32_t)leadByte;
- } else {
- /* report a pair of illegal bytes if the second byte is not a DBCS starter */
- /* add another bit so that the code below writes 2 bytes in case of error */
- mySourceChar= 0x10000 | (leadByte << 8) | mySourceChar;
- }
- args->converter->toUnicodeStatus =0x00;
- }
- }
- else{
- if(mySourceChar == UCNV_TILDE) {
- args->converter->mode = UCNV_TILDE;
- continue;
- } else if(mySourceChar <= 0x7f) {
- targetUniChar = (UChar)mySourceChar; /* ASCII */
- myData->isEmptySegment = FALSE; /* the segment has something valid */
- } else {
- targetUniChar = 0xffff;
- myData->isEmptySegment = FALSE; /* different error here, reset this to avoid spurious future error */
- }
- }
- if(targetUniChar < 0xfffe){
- if(args->offsets) {
- args->offsets[myTarget - args->target]=(int32_t)(mySource - args->source - 1-(myData->isStateDBCS));
- }
-
- *(myTarget++)=(UChar)targetUniChar;
- }
- else /* targetUniChar>=0xfffe */ {
- if(targetUniChar == 0xfffe){
- *err = U_INVALID_CHAR_FOUND;
- }
- else{
- *err = U_ILLEGAL_CHAR_FOUND;
- }
- if(mySourceChar > 0xff){
- args->converter->toUBytes[0] = (uint8_t)(mySourceChar >> 8);
- args->converter->toUBytes[1] = (uint8_t)mySourceChar;
- args->converter->toULength=2;
- }
- else{
- args->converter->toUBytes[0] = (uint8_t)mySourceChar;
- args->converter->toULength=1;
- }
- break;
- }
- }
- else{
- *err =U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- }
-
- args->target = myTarget;
- args->source = mySource;
-}
-
-
-static void U_CALLCONV
-UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
- UErrorCode * err){
- const UChar *mySource = args->source;
- char *myTarget = args->target;
- int32_t* offsets = args->offsets;
- int32_t mySourceIndex = 0;
- int32_t myTargetIndex = 0;
- int32_t targetLength = (int32_t)(args->targetLimit - myTarget);
- int32_t mySourceLength = (int32_t)(args->sourceLimit - args->source);
- uint32_t targetUniChar = 0x0000;
- UChar32 mySourceChar = 0x0000;
- UConverterDataHZ *myConverterData=(UConverterDataHZ*)args->converter->extraInfo;
- UBool isTargetUCharDBCS = (UBool) myConverterData->isTargetUCharDBCS;
- UBool oldIsTargetUCharDBCS;
- int len =0;
- const char* escSeq=NULL;
-
- /* Calling code already handles this situation. */
- /*if ((args->converter == NULL) || (args->targetLimit < myTarget) || (args->sourceLimit < args->source)){
- *err = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }*/
- if(args->converter->fromUChar32!=0 && myTargetIndex < targetLength) {
- goto getTrail;
- }
- /*writing the char to the output stream */
- while (mySourceIndex < mySourceLength){
- targetUniChar = missingCharMarker;
- if (myTargetIndex < targetLength){
-
- mySourceChar = (UChar) mySource[mySourceIndex++];
-
-
- oldIsTargetUCharDBCS = isTargetUCharDBCS;
- if(mySourceChar ==UCNV_TILDE){
- /*concatEscape(args, &myTargetIndex, &targetLength,"\x7E\x7E",err,2,&mySourceIndex);*/
- len = ESC_LEN;
- escSeq = TILDE_ESCAPE;
- CONCAT_ESCAPE_MACRO(args, myTargetIndex, targetLength, escSeq,err,len,mySourceIndex);
- continue;
- } else if(mySourceChar <= 0x7f) {
- targetUniChar = mySourceChar;
- } else {
- int32_t length= ucnv_MBCSFromUChar32(myConverterData->gbConverter->sharedData,
- mySourceChar,&targetUniChar,args->converter->useFallback);
- /* we can only use lead bytes 21..7D and trail bytes 21..7E */
- if( length == 2 &&
- (uint16_t)(targetUniChar - 0xa1a1) <= (0xfdfe - 0xa1a1) &&
- (uint8_t)(targetUniChar - 0xa1) <= (0xfe - 0xa1)
- ) {
- targetUniChar -= 0x8080;
- } else {
- targetUniChar = missingCharMarker;
- }
- }
- if (targetUniChar != missingCharMarker){
- myConverterData->isTargetUCharDBCS = isTargetUCharDBCS = (UBool)(targetUniChar>0x00FF);
- if(oldIsTargetUCharDBCS != isTargetUCharDBCS || !myConverterData->isEscapeAppended ){
- /*Shifting from a double byte to single byte mode*/
- if(!isTargetUCharDBCS){
- len =ESC_LEN;
- escSeq = SB_ESCAPE;
- CONCAT_ESCAPE_MACRO(args, myTargetIndex, targetLength, escSeq,err,len,mySourceIndex);
- myConverterData->isEscapeAppended = TRUE;
- }
- else{ /* Shifting from a single byte to double byte mode*/
- len =ESC_LEN;
- escSeq = DB_ESCAPE;
- CONCAT_ESCAPE_MACRO(args, myTargetIndex, targetLength, escSeq,err,len,mySourceIndex);
- myConverterData->isEscapeAppended = TRUE;
-
- }
- }
-
- if(isTargetUCharDBCS){
- if( myTargetIndex <targetLength){
- myTarget[myTargetIndex++] =(char) (targetUniChar >> 8);
- if(offsets){
- *(offsets++) = mySourceIndex-1;
- }
- if(myTargetIndex < targetLength){
- myTarget[myTargetIndex++] =(char) targetUniChar;
- if(offsets){
- *(offsets++) = mySourceIndex-1;
- }
- }else{
- args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = (char) targetUniChar;
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
- }else{
- args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] =(char) (targetUniChar >> 8);
- args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = (char) targetUniChar;
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
-
- }else{
- if( myTargetIndex <targetLength){
- myTarget[myTargetIndex++] = (char) (targetUniChar );
- if(offsets){
- *(offsets++) = mySourceIndex-1;
- }
-
- }else{
- args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = (char) targetUniChar;
- *err = U_BUFFER_OVERFLOW_ERROR;
- }
- }
-
- }
- else{
- /* oops.. the code point is unassigned */
- /*Handle surrogates */
- /*check if the char is a First surrogate*/
- if(U16_IS_SURROGATE(mySourceChar)) {
- if(U16_IS_SURROGATE_LEAD(mySourceChar)) {
- args->converter->fromUChar32=mySourceChar;
-getTrail:
- /*look ahead to find the trail surrogate*/
- if(mySourceIndex < mySourceLength) {
- /* test the following code unit */
- UChar trail=(UChar) args->source[mySourceIndex];
- if(U16_IS_TRAIL(trail)) {
- ++mySourceIndex;
- mySourceChar=U16_GET_SUPPLEMENTARY(args->converter->fromUChar32, trail);
- args->converter->fromUChar32=0x00;
- /* there are no surrogates in GB2312*/
- *err = U_INVALID_CHAR_FOUND;
- /* exit this condition tree */
- } else {
- /* this is an unmatched lead code unit (1st surrogate) */
- /* callback(illegal) */
- *err=U_ILLEGAL_CHAR_FOUND;
- }
- } else {
- /* no more input */
- *err = U_ZERO_ERROR;
+* In ASCII mode, a byte is interpreted as an ASCII character, unless a
+* '~' is encountered. The character '~' is an escape character. By
+* convention, it must be immediately followed ONLY by '~', '{' or '\n'
+* (<LF>), with the following special meaning.
+
+* 1. The escape sequence '~~' is interpreted as a '~'.
+* 2. The escape-to-GB sequence '~{' switches the mode from ASCII to GB.
+* 3. The escape sequence '~\n' is a line-continuation marker to be
+* consumed with no output produced.
+* In GB mode, characters are interpreted two bytes at a time as (pure)
+* GB codes until the escape-from-GB code '~}' is read. This code
+* switches the mode from GB back to ASCII. (Note that the escape-
+* from-GB code '~}' ($7E7D) is outside the defined GB range.)
+*
+* Source: RFC 1842
+*
+* Note that the formal syntax in RFC 1842 is invalid. I assume that the
+* intended definition of single-byte-segment is as follows (pedberg):
+* single-byte-segment = single-byte-seq 1*single-byte-char
+*/
+
+
+static void U_CALLCONV
+UConverter_toUnicode_HZ_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
+ UErrorCode* err){
+ char tempBuf[2];
+ const char *mySource = ( char *) args->source;
+ UChar *myTarget = args->target;
+ const char *mySourceLimit = args->sourceLimit;
+ UChar32 targetUniChar = 0x0000;
+ int32_t mySourceChar = 0x0000;
+ UConverterDataHZ* myData=(UConverterDataHZ*)(args->converter->extraInfo);
+ tempBuf[0]=0;
+ tempBuf[1]=0;
+
+ /* Calling code already handles this situation. */
+ /*if ((args->converter == NULL) || (args->targetLimit < args->target) || (mySourceLimit < args->source)){
+ *err = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }*/
+
+ while(mySource< mySourceLimit){
+
+ if(myTarget < args->targetLimit){
+
+ mySourceChar= (unsigned char) *mySource++;
+
+ if(args->converter->mode == UCNV_TILDE) {
+ /* second byte after ~ */
+ args->converter->mode=0;
+ switch(mySourceChar) {
+ case 0x0A:
+ /* no output for ~\n (line-continuation marker) */
+ continue;
+ case UCNV_TILDE:
+ if(args->offsets) {
+ args->offsets[myTarget - args->target]=(int32_t)(mySource - args->source - 2);
+ }
+ *(myTarget++)=(UChar)mySourceChar;
+ myData->isEmptySegment = FALSE;
+ continue;
+ case UCNV_OPEN_BRACE:
+ case UCNV_CLOSE_BRACE:
+ myData->isStateDBCS = (mySourceChar == UCNV_OPEN_BRACE);
+ if (myData->isEmptySegment) {
+ myData->isEmptySegment = FALSE; /* we are handling it, reset to avoid future spurious errors */
+ *err = U_ILLEGAL_ESCAPE_SEQUENCE;
+ args->converter->toUCallbackReason = UCNV_IRREGULAR;
+ args->converter->toUBytes[0] = UCNV_TILDE;
+ args->converter->toUBytes[1] = static_cast<uint8_t>(mySourceChar);
+ args->converter->toULength = 2;
+ args->target = myTarget;
+ args->source = mySource;
+ return;
+ }
+ myData->isEmptySegment = TRUE;
+ continue;
+ default:
+ /* if the first byte is equal to TILDE and the trail byte
+ * is not a valid byte then it is an error condition
+ */
+ /*
+ * Ticket 5691: consistent illegal sequences:
+ * - We include at least the first byte in the illegal sequence.
+ * - If any of the non-initial bytes could be the start of a character,
+ * we stop the illegal sequence before the first one of those.
+ */
+ myData->isEmptySegment = FALSE; /* different error here, reset this to avoid spurious future error */
+ *err = U_ILLEGAL_ESCAPE_SEQUENCE;
+ args->converter->toUBytes[0] = UCNV_TILDE;
+ if( myData->isStateDBCS ?
+ (0x21 <= mySourceChar && mySourceChar <= 0x7e) :
+ mySourceChar <= 0x7f
+ ) {
+ /* The current byte could be the start of a character: Back it out. */
+ args->converter->toULength = 1;
+ --mySource;
+ } else {
+ /* Include the current byte in the illegal sequence. */
+ args->converter->toUBytes[1] = static_cast<uint8_t>(mySourceChar);
+ args->converter->toULength = 2;
+ }
+ args->target = myTarget;
+ args->source = mySource;
+ return;
+ }
+ } else if(myData->isStateDBCS) {
+ if(args->converter->toUnicodeStatus == 0x00){
+ /* lead byte */
+ if(mySourceChar == UCNV_TILDE) {
+ args->converter->mode = UCNV_TILDE;
+ } else {
+ /* add another bit to distinguish a 0 byte from not having seen a lead byte */
+ args->converter->toUnicodeStatus = (uint32_t) (mySourceChar | 0x100);
+ myData->isEmptySegment = FALSE; /* the segment has something, either valid or will produce a different error, so reset this */
+ }
+ continue;
+ }
+ else{
+ /* trail byte */
+ int leadIsOk, trailIsOk;
+ uint32_t leadByte = args->converter->toUnicodeStatus & 0xff;
+ targetUniChar = 0xffff;
+ /*
+ * Ticket 5691: consistent illegal sequences:
+ * - We include at least the first byte in the illegal sequence.
+ * - If any of the non-initial bytes could be the start of a character,
+ * we stop the illegal sequence before the first one of those.
+ *
+ * In HZ DBCS, if the second byte is in the 21..7e range,
+ * we report only the first byte as the illegal sequence.
+ * Otherwise we convert or report the pair of bytes.
+ */
+ leadIsOk = (uint8_t)(leadByte - 0x21) <= (0x7d - 0x21);
+ trailIsOk = (uint8_t)(mySourceChar - 0x21) <= (0x7e - 0x21);
+ if (leadIsOk && trailIsOk) {
+ tempBuf[0] = (char) (leadByte+0x80) ;
+ tempBuf[1] = (char) (mySourceChar+0x80);
+ targetUniChar = ucnv_MBCSSimpleGetNextUChar(myData->gbConverter->sharedData,
+ tempBuf, 2, args->converter->useFallback);
+ mySourceChar= (leadByte << 8) | mySourceChar;
+ } else if (trailIsOk) {
+ /* report a single illegal byte and continue with the following DBCS starter byte */
+ --mySource;
+ mySourceChar = (int32_t)leadByte;
+ } else {
+ /* report a pair of illegal bytes if the second byte is not a DBCS starter */
+ /* add another bit so that the code below writes 2 bytes in case of error */
+ mySourceChar= 0x10000 | (leadByte << 8) | mySourceChar;
+ }
+ args->converter->toUnicodeStatus =0x00;
+ }
+ }
+ else{
+ if(mySourceChar == UCNV_TILDE) {
+ args->converter->mode = UCNV_TILDE;
+ continue;
+ } else if(mySourceChar <= 0x7f) {
+ targetUniChar = (UChar)mySourceChar; /* ASCII */
+ myData->isEmptySegment = FALSE; /* the segment has something valid */
+ } else {
+ targetUniChar = 0xffff;
+ myData->isEmptySegment = FALSE; /* different error here, reset this to avoid spurious future error */
+ }
+ }
+ if(targetUniChar < 0xfffe){
+ if(args->offsets) {
+ args->offsets[myTarget - args->target]=(int32_t)(mySource - args->source - 1-(myData->isStateDBCS));
+ }
+
+ *(myTarget++)=(UChar)targetUniChar;
+ }
+ else /* targetUniChar>=0xfffe */ {
+ if(targetUniChar == 0xfffe){
+ *err = U_INVALID_CHAR_FOUND;
+ }
+ else{
+ *err = U_ILLEGAL_CHAR_FOUND;
+ }
+ if(mySourceChar > 0xff){
+ args->converter->toUBytes[0] = (uint8_t)(mySourceChar >> 8);
+ args->converter->toUBytes[1] = (uint8_t)mySourceChar;
+ args->converter->toULength=2;
+ }
+ else{
+ args->converter->toUBytes[0] = (uint8_t)mySourceChar;
+ args->converter->toULength=1;
+ }
+ break;
+ }
+ }
+ else{
+ *err =U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ }
+
+ args->target = myTarget;
+ args->source = mySource;
+}
+
+
+static void U_CALLCONV
+UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
+ UErrorCode * err){
+ const UChar *mySource = args->source;
+ char *myTarget = args->target;
+ int32_t* offsets = args->offsets;
+ int32_t mySourceIndex = 0;
+ int32_t myTargetIndex = 0;
+ int32_t targetLength = (int32_t)(args->targetLimit - myTarget);
+ int32_t mySourceLength = (int32_t)(args->sourceLimit - args->source);
+ uint32_t targetUniChar = 0x0000;
+ UChar32 mySourceChar = 0x0000;
+ UConverterDataHZ *myConverterData=(UConverterDataHZ*)args->converter->extraInfo;
+ UBool isTargetUCharDBCS = (UBool) myConverterData->isTargetUCharDBCS;
+ UBool oldIsTargetUCharDBCS;
+ int len =0;
+ const char* escSeq=NULL;
+
+ /* Calling code already handles this situation. */
+ /*if ((args->converter == NULL) || (args->targetLimit < myTarget) || (args->sourceLimit < args->source)){
+ *err = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }*/
+ if(args->converter->fromUChar32!=0 && myTargetIndex < targetLength) {
+ goto getTrail;
+ }
+ /*writing the char to the output stream */
+ while (mySourceIndex < mySourceLength){
+ targetUniChar = missingCharMarker;
+ if (myTargetIndex < targetLength){
+
+ mySourceChar = (UChar) mySource[mySourceIndex++];
+
+
+ oldIsTargetUCharDBCS = isTargetUCharDBCS;
+ if(mySourceChar ==UCNV_TILDE){
+ /*concatEscape(args, &myTargetIndex, &targetLength,"\x7E\x7E",err,2,&mySourceIndex);*/
+ len = ESC_LEN;
+ escSeq = TILDE_ESCAPE;
+ CONCAT_ESCAPE_MACRO(args, myTargetIndex, targetLength, escSeq,err,len,mySourceIndex);
+ continue;
+ } else if(mySourceChar <= 0x7f) {
+ targetUniChar = mySourceChar;
+ } else {
+ int32_t length= ucnv_MBCSFromUChar32(myConverterData->gbConverter->sharedData,
+ mySourceChar,&targetUniChar,args->converter->useFallback);
+ /* we can only use lead bytes 21..7D and trail bytes 21..7E */
+ if( length == 2 &&
+ (uint16_t)(targetUniChar - 0xa1a1) <= (0xfdfe - 0xa1a1) &&
+ (uint8_t)(targetUniChar - 0xa1) <= (0xfe - 0xa1)
+ ) {
+ targetUniChar -= 0x8080;
+ } else {
+ targetUniChar = missingCharMarker;
+ }
+ }
+ if (targetUniChar != missingCharMarker){
+ myConverterData->isTargetUCharDBCS = isTargetUCharDBCS = (UBool)(targetUniChar>0x00FF);
+ if(oldIsTargetUCharDBCS != isTargetUCharDBCS || !myConverterData->isEscapeAppended ){
+ /*Shifting from a double byte to single byte mode*/
+ if(!isTargetUCharDBCS){
+ len =ESC_LEN;
+ escSeq = SB_ESCAPE;
+ CONCAT_ESCAPE_MACRO(args, myTargetIndex, targetLength, escSeq,err,len,mySourceIndex);
+ myConverterData->isEscapeAppended = TRUE;
+ }
+ else{ /* Shifting from a single byte to double byte mode*/
+ len =ESC_LEN;
+ escSeq = DB_ESCAPE;
+ CONCAT_ESCAPE_MACRO(args, myTargetIndex, targetLength, escSeq,err,len,mySourceIndex);
+ myConverterData->isEscapeAppended = TRUE;
+
+ }
+ }
+
+ if(isTargetUCharDBCS){
+ if( myTargetIndex <targetLength){
+ myTarget[myTargetIndex++] =(char) (targetUniChar >> 8);
+ if(offsets){
+ *(offsets++) = mySourceIndex-1;
+ }
+ if(myTargetIndex < targetLength){
+ myTarget[myTargetIndex++] =(char) targetUniChar;
+ if(offsets){
+ *(offsets++) = mySourceIndex-1;
+ }
+ }else{
+ args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = (char) targetUniChar;
+ *err = U_BUFFER_OVERFLOW_ERROR;
}
- } else {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- *err=U_ILLEGAL_CHAR_FOUND;
- }
- } else {
- /* callback(unassigned) for a BMP code point */
- *err = U_INVALID_CHAR_FOUND;
- }
-
- args->converter->fromUChar32=mySourceChar;
- break;
- }
- }
- else{
- *err = U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- targetUniChar=missingCharMarker;
- }
-
- args->target += myTargetIndex;
- args->source += mySourceIndex;
- myConverterData->isTargetUCharDBCS = isTargetUCharDBCS;
-}
-
-static void U_CALLCONV
-_HZ_WriteSub(UConverterFromUnicodeArgs *args, int32_t offsetIndex, UErrorCode *err) {
- UConverter *cnv = args->converter;
- UConverterDataHZ *convData=(UConverterDataHZ *) cnv->extraInfo;
- char *p;
- char buffer[4];
- p = buffer;
-
- if( convData->isTargetUCharDBCS){
- *p++= UCNV_TILDE;
- *p++= UCNV_CLOSE_BRACE;
- convData->isTargetUCharDBCS=FALSE;
- }
- *p++= (char)cnv->subChars[0];
-
- ucnv_cbFromUWriteBytes(args,
- buffer, (int32_t)(p - buffer),
- offsetIndex, err);
-}
-
-/*
- * Structure for cloning an HZ converter into a single memory block.
- */
-struct cloneHZStruct
-{
- UConverter cnv;
- UConverter subCnv;
- UConverterDataHZ mydata;
-};
-
-
-static UConverter * U_CALLCONV
-_HZ_SafeClone(const UConverter *cnv,
- void *stackBuffer,
- int32_t *pBufferSize,
- UErrorCode *status)
-{
- struct cloneHZStruct * localClone;
- int32_t size, bufferSizeNeeded = sizeof(struct cloneHZStruct);
-
- if (U_FAILURE(*status)){
- return nullptr;
- }
-
- if (*pBufferSize == 0){ /* 'preflighting' request - set needed size into *pBufferSize */
- *pBufferSize = bufferSizeNeeded;
- return nullptr;
- }
-
- localClone = (struct cloneHZStruct *)stackBuffer;
- /* ucnv.c/ucnv_safeClone() copied the main UConverter already */
-
- uprv_memcpy(&localClone->mydata, cnv->extraInfo, sizeof(UConverterDataHZ));
- localClone->cnv.extraInfo = &localClone->mydata;
- localClone->cnv.isExtraLocal = TRUE;
-
- /* deep-clone the sub-converter */
- size = (int32_t)sizeof(UConverter);
- ((UConverterDataHZ*)localClone->cnv.extraInfo)->gbConverter =
- ucnv_safeClone(((UConverterDataHZ*)cnv->extraInfo)->gbConverter, &localClone->subCnv, &size, status);
-
- return &localClone->cnv;
-}
-
-static void U_CALLCONV
-_HZ_GetUnicodeSet(const UConverter *cnv,
- const USetAdder *sa,
- UConverterUnicodeSet which,
- UErrorCode *pErrorCode) {
- /* HZ converts all of ASCII */
- sa->addRange(sa->set, 0, 0x7f);
-
- /* add all of the code points that the sub-converter handles */
- ucnv_MBCSGetFilteredUnicodeSetForUnicode(
- ((UConverterDataHZ*)cnv->extraInfo)->gbConverter->sharedData,
- sa, which, UCNV_SET_FILTER_HZ,
- pErrorCode);
-}
-U_CDECL_END
-static const UConverterImpl _HZImpl={
-
- UCNV_HZ,
-
- NULL,
- NULL,
-
- _HZOpen,
- _HZClose,
- _HZReset,
-
- UConverter_toUnicode_HZ_OFFSETS_LOGIC,
- UConverter_toUnicode_HZ_OFFSETS_LOGIC,
- UConverter_fromUnicode_HZ_OFFSETS_LOGIC,
- UConverter_fromUnicode_HZ_OFFSETS_LOGIC,
- NULL,
-
- NULL,
- NULL,
- _HZ_WriteSub,
- _HZ_SafeClone,
- _HZ_GetUnicodeSet,
- NULL,
- NULL
-};
-
-static const UConverterStaticData _HZStaticData={
- sizeof(UConverterStaticData),
- "HZ",
- 0,
- UCNV_IBM,
- UCNV_HZ,
- 1,
- 4,
- { 0x1a, 0, 0, 0 },
- 1,
- FALSE,
+ }else{
+ args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] =(char) (targetUniChar >> 8);
+ args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = (char) targetUniChar;
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+
+ }else{
+ if( myTargetIndex <targetLength){
+ myTarget[myTargetIndex++] = (char) (targetUniChar );
+ if(offsets){
+ *(offsets++) = mySourceIndex-1;
+ }
+
+ }else{
+ args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = (char) targetUniChar;
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ }
+ }
+
+ }
+ else{
+ /* oops.. the code point is unassigned */
+ /*Handle surrogates */
+ /*check if the char is a First surrogate*/
+ if(U16_IS_SURROGATE(mySourceChar)) {
+ if(U16_IS_SURROGATE_LEAD(mySourceChar)) {
+ args->converter->fromUChar32=mySourceChar;
+getTrail:
+ /*look ahead to find the trail surrogate*/
+ if(mySourceIndex < mySourceLength) {
+ /* test the following code unit */
+ UChar trail=(UChar) args->source[mySourceIndex];
+ if(U16_IS_TRAIL(trail)) {
+ ++mySourceIndex;
+ mySourceChar=U16_GET_SUPPLEMENTARY(args->converter->fromUChar32, trail);
+ args->converter->fromUChar32=0x00;
+ /* there are no surrogates in GB2312*/
+ *err = U_INVALID_CHAR_FOUND;
+ /* exit this condition tree */
+ } else {
+ /* this is an unmatched lead code unit (1st surrogate) */
+ /* callback(illegal) */
+ *err=U_ILLEGAL_CHAR_FOUND;
+ }
+ } else {
+ /* no more input */
+ *err = U_ZERO_ERROR;
+ }
+ } else {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ *err=U_ILLEGAL_CHAR_FOUND;
+ }
+ } else {
+ /* callback(unassigned) for a BMP code point */
+ *err = U_INVALID_CHAR_FOUND;
+ }
+
+ args->converter->fromUChar32=mySourceChar;
+ break;
+ }
+ }
+ else{
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ targetUniChar=missingCharMarker;
+ }
+
+ args->target += myTargetIndex;
+ args->source += mySourceIndex;
+ myConverterData->isTargetUCharDBCS = isTargetUCharDBCS;
+}
+
+static void U_CALLCONV
+_HZ_WriteSub(UConverterFromUnicodeArgs *args, int32_t offsetIndex, UErrorCode *err) {
+ UConverter *cnv = args->converter;
+ UConverterDataHZ *convData=(UConverterDataHZ *) cnv->extraInfo;
+ char *p;
+ char buffer[4];
+ p = buffer;
+
+ if( convData->isTargetUCharDBCS){
+ *p++= UCNV_TILDE;
+ *p++= UCNV_CLOSE_BRACE;
+ convData->isTargetUCharDBCS=FALSE;
+ }
+ *p++= (char)cnv->subChars[0];
+
+ ucnv_cbFromUWriteBytes(args,
+ buffer, (int32_t)(p - buffer),
+ offsetIndex, err);
+}
+
+/*
+ * Structure for cloning an HZ converter into a single memory block.
+ */
+struct cloneHZStruct
+{
+ UConverter cnv;
+ UConverter subCnv;
+ UConverterDataHZ mydata;
+};
+
+
+static UConverter * U_CALLCONV
+_HZ_SafeClone(const UConverter *cnv,
+ void *stackBuffer,
+ int32_t *pBufferSize,
+ UErrorCode *status)
+{
+ struct cloneHZStruct * localClone;
+ int32_t size, bufferSizeNeeded = sizeof(struct cloneHZStruct);
+
+ if (U_FAILURE(*status)){
+ return nullptr;
+ }
+
+ if (*pBufferSize == 0){ /* 'preflighting' request - set needed size into *pBufferSize */
+ *pBufferSize = bufferSizeNeeded;
+ return nullptr;
+ }
+
+ localClone = (struct cloneHZStruct *)stackBuffer;
+ /* ucnv.c/ucnv_safeClone() copied the main UConverter already */
+
+ uprv_memcpy(&localClone->mydata, cnv->extraInfo, sizeof(UConverterDataHZ));
+ localClone->cnv.extraInfo = &localClone->mydata;
+ localClone->cnv.isExtraLocal = TRUE;
+
+ /* deep-clone the sub-converter */
+ size = (int32_t)sizeof(UConverter);
+ ((UConverterDataHZ*)localClone->cnv.extraInfo)->gbConverter =
+ ucnv_safeClone(((UConverterDataHZ*)cnv->extraInfo)->gbConverter, &localClone->subCnv, &size, status);
+
+ return &localClone->cnv;
+}
+
+static void U_CALLCONV
+_HZ_GetUnicodeSet(const UConverter *cnv,
+ const USetAdder *sa,
+ UConverterUnicodeSet which,
+ UErrorCode *pErrorCode) {
+ /* HZ converts all of ASCII */
+ sa->addRange(sa->set, 0, 0x7f);
+
+ /* add all of the code points that the sub-converter handles */
+ ucnv_MBCSGetFilteredUnicodeSetForUnicode(
+ ((UConverterDataHZ*)cnv->extraInfo)->gbConverter->sharedData,
+ sa, which, UCNV_SET_FILTER_HZ,
+ pErrorCode);
+}
+U_CDECL_END
+static const UConverterImpl _HZImpl={
+
+ UCNV_HZ,
+
+ NULL,
+ NULL,
+
+ _HZOpen,
+ _HZClose,
+ _HZReset,
+
+ UConverter_toUnicode_HZ_OFFSETS_LOGIC,
+ UConverter_toUnicode_HZ_OFFSETS_LOGIC,
+ UConverter_fromUnicode_HZ_OFFSETS_LOGIC,
+ UConverter_fromUnicode_HZ_OFFSETS_LOGIC,
+ NULL,
+
+ NULL,
+ NULL,
+ _HZ_WriteSub,
+ _HZ_SafeClone,
+ _HZ_GetUnicodeSet,
+ NULL,
+ NULL
+};
+
+static const UConverterStaticData _HZStaticData={
+ sizeof(UConverterStaticData),
+ "HZ",
+ 0,
+ UCNV_IBM,
+ UCNV_HZ,
+ 1,
+ 4,
+ { 0x1a, 0, 0, 0 },
+ 1,
FALSE,
- 0,
- 0,
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, /* reserved */
-
-};
-
-const UConverterSharedData _HZData=
- UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_HZStaticData, &_HZImpl);
-
-#endif /* #if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION */
+ FALSE,
+ 0,
+ 0,
+ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, /* reserved */
+
+};
+
+const UConverterSharedData _HZData=
+ UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_HZStaticData, &_HZImpl);
+
+#endif /* #if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION */
diff --git a/contrib/libs/icu/common/ucnvisci.cpp b/contrib/libs/icu/common/ucnvisci.cpp
index ed76af1474..44a7c05a3c 100644
--- a/contrib/libs/icu/common/ucnvisci.cpp
+++ b/contrib/libs/icu/common/ucnvisci.cpp
@@ -1,1635 +1,1635 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-**********************************************************************
-* Copyright (C) 2000-2016, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
-* file name: ucnvisci.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 2001JUN26
-* created by: Ram Viswanadha
-*
-* Date Name Description
-* 24/7/2001 Ram Added support for EXT character handling
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION
-
-#include "unicode/ucnv.h"
-#include "unicode/ucnv_cb.h"
-#include "unicode/utf16.h"
-#include "cmemory.h"
-#include "ucnv_bld.h"
-#include "ucnv_cnv.h"
-#include "cstring.h"
-#include "uassert.h"
-
-#define UCNV_OPTIONS_VERSION_MASK 0xf
-#define NUKTA 0x093c
-#define HALANT 0x094d
-#define ZWNJ 0x200c /* Zero Width Non Joiner */
-#define ZWJ 0x200d /* Zero width Joiner */
-#define INVALID_CHAR 0xffff
-#define ATR 0xEF /* Attribute code */
-#define EXT 0xF0 /* Extension code */
-#define DANDA 0x0964
-#define DOUBLE_DANDA 0x0965
-#define ISCII_NUKTA 0xE9
-#define ISCII_HALANT 0xE8
-#define ISCII_DANDA 0xEA
-#define ISCII_INV 0xD9
-#define ISCII_VOWEL_SIGN_E 0xE0
-#define INDIC_BLOCK_BEGIN 0x0900
-#define INDIC_BLOCK_END 0x0D7F
-#define INDIC_RANGE (INDIC_BLOCK_END - INDIC_BLOCK_BEGIN)
-#define VOCALLIC_RR 0x0931
-#define LF 0x0A
-#define ASCII_END 0xA0
-#define NO_CHAR_MARKER 0xFFFE
-#define TELUGU_DELTA DELTA * TELUGU
-#define DEV_ABBR_SIGN 0x0970
-#define DEV_ANUDATTA 0x0952
-#define EXT_RANGE_BEGIN 0xA1
-#define EXT_RANGE_END 0xEE
-
-#define PNJ_DELTA 0x0100
-#define PNJ_BINDI 0x0A02
-#define PNJ_TIPPI 0x0A70
-#define PNJ_SIGN_VIRAMA 0x0A4D
-#define PNJ_ADHAK 0x0A71
-#define PNJ_HA 0x0A39
-#define PNJ_RRA 0x0A5C
-
-typedef enum {
- DEVANAGARI =0,
- BENGALI,
- GURMUKHI,
- GUJARATI,
- ORIYA,
- TAMIL,
- TELUGU,
- KANNADA,
- MALAYALAM,
- DELTA=0x80
-}UniLang;
-
-/**
- * Enumeration for switching code pages if <ATR>+<one of below values>
- * is encountered
- */
-typedef enum {
- DEF = 0x40,
- RMN = 0x41,
- DEV = 0x42,
- BNG = 0x43,
- TML = 0x44,
- TLG = 0x45,
- ASM = 0x46,
- ORI = 0x47,
- KND = 0x48,
- MLM = 0x49,
- GJR = 0x4A,
- PNJ = 0x4B,
- ARB = 0x71,
- PES = 0x72,
- URD = 0x73,
- SND = 0x74,
- KSM = 0x75,
- PST = 0x76
-}ISCIILang;
-
-typedef enum {
- DEV_MASK =0x80,
- PNJ_MASK =0x40,
- GJR_MASK =0x20,
- ORI_MASK =0x10,
- BNG_MASK =0x08,
- KND_MASK =0x04,
- MLM_MASK =0x02,
- TML_MASK =0x01,
- ZERO =0x00
-}MaskEnum;
-
-#define ISCII_CNV_PREFIX "ISCII,version="
-
-typedef struct {
- UChar contextCharToUnicode; /* previous Unicode codepoint for contextual analysis */
- UChar contextCharFromUnicode; /* previous Unicode codepoint for contextual analysis */
- uint16_t defDeltaToUnicode; /* delta for switching to default state when DEF is encountered */
- uint16_t currentDeltaFromUnicode; /* current delta in Indic block */
- uint16_t currentDeltaToUnicode; /* current delta in Indic block */
- MaskEnum currentMaskFromUnicode; /* mask for current state in toUnicode */
- MaskEnum currentMaskToUnicode; /* mask for current state in toUnicode */
- MaskEnum defMaskToUnicode; /* mask for default state in toUnicode */
- UBool isFirstBuffer; /* boolean for fromUnicode to see if we need to announce the first script */
- UBool resetToDefaultToUnicode; /* boolean for reseting to default delta and mask when a newline is encountered*/
- char name[sizeof(ISCII_CNV_PREFIX) + 1];
- UChar32 prevToUnicodeStatus; /* Hold the previous toUnicodeStatus. This is necessary because we may need to know the last two code points. */
-} UConverterDataISCII;
-
-typedef struct LookupDataStruct {
- UniLang uniLang;
- MaskEnum maskEnum;
- ISCIILang isciiLang;
-} LookupDataStruct;
-
-static const LookupDataStruct lookupInitialData[]={
- { DEVANAGARI, DEV_MASK, DEV },
- { BENGALI, BNG_MASK, BNG },
- { GURMUKHI, PNJ_MASK, PNJ },
- { GUJARATI, GJR_MASK, GJR },
- { ORIYA, ORI_MASK, ORI },
- { TAMIL, TML_MASK, TML },
- { TELUGU, KND_MASK, TLG },
- { KANNADA, KND_MASK, KND },
- { MALAYALAM, MLM_MASK, MLM }
-};
-
-/*
- * For special handling of certain Gurmukhi characters.
- * Bit 0 (value 1): PNJ consonant
- * Bit 1 (value 2): PNJ Bindi Tippi
- */
-static const uint8_t pnjMap[80] = {
- /* 0A00..0A0F */
- 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
- /* 0A10..0A1F */
- 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- /* 0A20..0A2F */
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3,
- /* 0A30..0A3F */
- 3, 0, 0, 0, 0, 3, 3, 0, 3, 3, 0, 0, 0, 0, 0, 2,
- /* 0A40..0A4F */
- 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-static UBool
-isPNJConsonant(UChar32 c) {
- if (c < 0xa00 || 0xa50 <= c) {
- return FALSE;
- } else {
- return (UBool)(pnjMap[c - 0xa00] & 1);
- }
-}
-
-static UBool
-isPNJBindiTippi(UChar32 c) {
- if (c < 0xa00 || 0xa50 <= c) {
- return FALSE;
- } else {
- return (UBool)(pnjMap[c - 0xa00] >> 1);
- }
-}
-U_CDECL_BEGIN
-static void U_CALLCONV
-_ISCIIOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode) {
- if(pArgs->onlyTestIsLoadable) {
- return;
- }
-
- cnv->extraInfo = uprv_malloc(sizeof(UConverterDataISCII));
-
- if (cnv->extraInfo != NULL) {
- int32_t len=0;
- UConverterDataISCII *converterData=
- (UConverterDataISCII *) cnv->extraInfo;
- converterData->contextCharToUnicode=NO_CHAR_MARKER;
- cnv->toUnicodeStatus = missingCharMarker;
- converterData->contextCharFromUnicode=0x0000;
- converterData->resetToDefaultToUnicode=FALSE;
- /* check if the version requested is supported */
- if ((pArgs->options & UCNV_OPTIONS_VERSION_MASK) < 9) {
- /* initialize state variables */
- converterData->currentDeltaFromUnicode
- = converterData->currentDeltaToUnicode
- = converterData->defDeltaToUnicode = (uint16_t)(lookupInitialData[pArgs->options & UCNV_OPTIONS_VERSION_MASK].uniLang * DELTA);
-
- converterData->currentMaskFromUnicode
- = converterData->currentMaskToUnicode
- = converterData->defMaskToUnicode = lookupInitialData[pArgs->options & UCNV_OPTIONS_VERSION_MASK].maskEnum;
-
- converterData->isFirstBuffer=TRUE;
- (void)uprv_strcpy(converterData->name, ISCII_CNV_PREFIX);
- len = (int32_t)uprv_strlen(converterData->name);
- converterData->name[len]= (char)((pArgs->options & UCNV_OPTIONS_VERSION_MASK) + '0');
- converterData->name[len+1]=0;
-
- converterData->prevToUnicodeStatus = 0x0000;
- } else {
- uprv_free(cnv->extraInfo);
- cnv->extraInfo = NULL;
- *errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- }
-
- } else {
- *errorCode =U_MEMORY_ALLOCATION_ERROR;
- }
-}
-
-static void U_CALLCONV
-_ISCIIClose(UConverter *cnv) {
- if (cnv->extraInfo!=NULL) {
- if (!cnv->isExtraLocal) {
- uprv_free(cnv->extraInfo);
- }
- cnv->extraInfo=NULL;
- }
-}
-
-static const char* U_CALLCONV
-_ISCIIgetName(const UConverter* cnv) {
- if (cnv->extraInfo) {
- UConverterDataISCII* myData= (UConverterDataISCII*)cnv->extraInfo;
- return myData->name;
- }
- return NULL;
-}
-
-static void U_CALLCONV
-_ISCIIReset(UConverter *cnv, UConverterResetChoice choice) {
- UConverterDataISCII* data =(UConverterDataISCII *) (cnv->extraInfo);
- if (choice<=UCNV_RESET_TO_UNICODE) {
- cnv->toUnicodeStatus = missingCharMarker;
- cnv->mode=0;
- data->currentDeltaToUnicode=data->defDeltaToUnicode;
- data->currentMaskToUnicode = data->defMaskToUnicode;
- data->contextCharToUnicode=NO_CHAR_MARKER;
- data->prevToUnicodeStatus = 0x0000;
- }
- if (choice!=UCNV_RESET_TO_UNICODE) {
- cnv->fromUChar32=0x0000;
- data->contextCharFromUnicode=0x00;
- data->currentMaskFromUnicode=data->defMaskToUnicode;
- data->currentDeltaFromUnicode=data->defDeltaToUnicode;
- data->isFirstBuffer=TRUE;
- data->resetToDefaultToUnicode=FALSE;
- }
-}
-
-/**
- * The values in validity table are indexed by the lower bits of Unicode
- * range 0x0900 - 0x09ff. The values have a structure like:
- * ---------------------------------------------------------------
- * | DEV | PNJ | GJR | ORI | BNG | TLG | MLM | TML |
- * | | | | | ASM | KND | | |
- * ---------------------------------------------------------------
- * If a code point is valid in a particular script
- * then that bit is turned on
- *
- * Unicode does not distinguish between Bengali and Assamese so we use 1 bit for
- * to represent these languages
- *
- * Telugu and Kannada have same codepoints except for Vocallic_RR which we special case
- * and combine and use 1 bit to represent these languages.
- *
- * TODO: It is probably easier to understand and maintain to change this
- * to use uint16_t and give each of the 9 Unicode/script blocks its own bit.
- */
-
-static const uint8_t validityTable[128] = {
-/* This state table is tool generated please do not edit unless you know exactly what you are doing */
-/* Note: This table was edited to mirror the Windows XP implementation */
-/*ISCII:Valid:Unicode */
-/*0xa0 : 0x00: 0x900 */ ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0xa1 : 0xb8: 0x901 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + ZERO + ZERO + ZERO ,
-/*0xa2 : 0xfe: 0x902 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xa3 : 0xbf: 0x903 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0x00 : 0x00: 0x904 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0xa4 : 0xff: 0x905 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xa5 : 0xff: 0x906 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xa6 : 0xff: 0x907 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xa7 : 0xff: 0x908 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xa8 : 0xff: 0x909 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xa9 : 0xff: 0x90a */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xaa : 0xfe: 0x90b */ DEV_MASK + ZERO + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0x00 : 0x00: 0x90c */ DEV_MASK + ZERO + ZERO + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0xae : 0x80: 0x90d */ DEV_MASK + ZERO + GJR_MASK + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0xab : 0x87: 0x90e */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xac : 0xff: 0x90f */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xad : 0xff: 0x910 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xb2 : 0x80: 0x911 */ DEV_MASK + ZERO + GJR_MASK + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0xaf : 0x87: 0x912 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xb0 : 0xff: 0x913 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xb1 : 0xff: 0x914 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xb3 : 0xff: 0x915 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xb4 : 0xfe: 0x916 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0xb5 : 0xfe: 0x917 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0xb6 : 0xfe: 0x918 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0xb7 : 0xff: 0x919 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xb8 : 0xff: 0x91a */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xb9 : 0xfe: 0x91b */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0xba : 0xff: 0x91c */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xbb : 0xfe: 0x91d */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0xbc : 0xff: 0x91e */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xbd : 0xff: 0x91f */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xbe : 0xfe: 0x920 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0xbf : 0xfe: 0x921 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0xc0 : 0xfe: 0x922 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0xc1 : 0xff: 0x923 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xc2 : 0xff: 0x924 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xc3 : 0xfe: 0x925 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0xc4 : 0xfe: 0x926 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0xc5 : 0xfe: 0x927 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0xc6 : 0xff: 0x928 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xc7 : 0x81: 0x929 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + TML_MASK ,
-/*0xc8 : 0xff: 0x92a */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xc9 : 0xfe: 0x92b */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0xca : 0xfe: 0x92c */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0xcb : 0xfe: 0x92d */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0xcc : 0xfe: 0x92e */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xcd : 0xff: 0x92f */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xcf : 0xff: 0x930 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xd0 : 0x87: 0x931 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + MLM_MASK + TML_MASK ,
-/*0xd1 : 0xff: 0x932 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xd2 : 0xb7: 0x933 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + ZERO + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xd3 : 0x83: 0x934 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + MLM_MASK + TML_MASK ,
-/*0xd4 : 0xff: 0x935 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + ZERO + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xd5 : 0xfe: 0x936 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0xd6 : 0xbf: 0x937 */ DEV_MASK + ZERO + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xd7 : 0xff: 0x938 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xd8 : 0xff: 0x939 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0x00 : 0x00: 0x93A */ ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0x00 : 0x00: 0x93B */ ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0xe9 : 0xda: 0x93c */ DEV_MASK + PNJ_MASK + ZERO + ORI_MASK + BNG_MASK + ZERO + ZERO + ZERO ,
-/*0x00 : 0x00: 0x93d */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0xda : 0xff: 0x93e */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xdb : 0xff: 0x93f */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xdc : 0xff: 0x940 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xdd : 0xff: 0x941 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xde : 0xff: 0x942 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xdf : 0xbe: 0x943 */ DEV_MASK + ZERO + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0x00 : 0x00: 0x944 */ DEV_MASK + ZERO + GJR_MASK + ZERO + BNG_MASK + KND_MASK + ZERO + ZERO ,
-/*0xe3 : 0x80: 0x945 */ DEV_MASK + ZERO + GJR_MASK + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0xe0 : 0x87: 0x946 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xe1 : 0xff: 0x947 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xe2 : 0xff: 0x948 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xe7 : 0x80: 0x949 */ DEV_MASK + ZERO + GJR_MASK + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0xe4 : 0x87: 0x94a */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xe5 : 0xff: 0x94b */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xe6 : 0xff: 0x94c */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xe8 : 0xff: 0x94d */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xec : 0x00: 0x94e */ ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0xed : 0x00: 0x94f */ ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0x00 : 0x00: 0x950 */ DEV_MASK + ZERO + GJR_MASK + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0x00 : 0x00: 0x951 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0x00 : 0x00: 0x952 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0x00 : 0x00: 0x953 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0x00 : 0x00: 0x954 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0x00 : 0x00: 0x955 */ ZERO + ZERO + ZERO + ZERO + ZERO + KND_MASK + ZERO + ZERO ,
-/*0x00 : 0x00: 0x956 */ ZERO + ZERO + ZERO + ORI_MASK + ZERO + KND_MASK + ZERO + ZERO ,
-/*0x00 : 0x00: 0x957 */ ZERO + ZERO + ZERO + ORI_MASK + BNG_MASK + ZERO + MLM_MASK + ZERO ,
-/*0x00 : 0x00: 0x958 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0x00 : 0x00: 0x959 */ DEV_MASK + PNJ_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0x00 : 0x00: 0x95a */ DEV_MASK + PNJ_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0x00 : 0x00: 0x95b */ DEV_MASK + PNJ_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0x00 : 0x00: 0x95c */ DEV_MASK + PNJ_MASK + ZERO + ZERO + BNG_MASK + ZERO + ZERO + ZERO ,
-/*0x00 : 0x00: 0x95d */ DEV_MASK + ZERO + ZERO + ORI_MASK + BNG_MASK + ZERO + ZERO + ZERO ,
-/*0x00 : 0x00: 0x95e */ DEV_MASK + PNJ_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0xce : 0x98: 0x95f */ DEV_MASK + ZERO + ZERO + ORI_MASK + BNG_MASK + ZERO + ZERO + ZERO ,
-/*0x00 : 0x00: 0x960 */ DEV_MASK + ZERO + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0x00 : 0x00: 0x961 */ DEV_MASK + ZERO + ZERO + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
-/*0x00 : 0x00: 0x962 */ DEV_MASK + ZERO + ZERO + ZERO + BNG_MASK + ZERO + ZERO + ZERO ,
-/*0x00 : 0x00: 0x963 */ DEV_MASK + ZERO + ZERO + ZERO + BNG_MASK + ZERO + ZERO + ZERO ,
-/*0xea : 0xf8: 0x964 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0xeaea : 0x00: 0x965*/ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*0xf1 : 0xff: 0x966 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xf2 : 0xff: 0x967 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xf3 : 0xff: 0x968 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xf4 : 0xff: 0x969 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xf5 : 0xff: 0x96a */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xf6 : 0xff: 0x96b */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xf7 : 0xff: 0x96c */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xf8 : 0xff: 0x96d */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xf9 : 0xff: 0x96e */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0xfa : 0xff: 0x96f */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
-/*0x00 : 0x80: 0x970 */ DEV_MASK + PNJ_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
-/*
- * The length of the array is 128 to provide values for 0x900..0x97f.
- * The last 15 entries for 0x971..0x97f of the validity table are all zero
- * because no Indic script uses such Unicode code points.
- */
-/*0x00 : 0x00: 0x9yz */ ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO
-};
-
-static const uint16_t fromUnicodeTable[128]={
- 0x00a0 ,/* 0x0900 */
- 0x00a1 ,/* 0x0901 */
- 0x00a2 ,/* 0x0902 */
- 0x00a3 ,/* 0x0903 */
- 0xa4e0 ,/* 0x0904 */
- 0x00a4 ,/* 0x0905 */
- 0x00a5 ,/* 0x0906 */
- 0x00a6 ,/* 0x0907 */
- 0x00a7 ,/* 0x0908 */
- 0x00a8 ,/* 0x0909 */
- 0x00a9 ,/* 0x090a */
- 0x00aa ,/* 0x090b */
- 0xA6E9 ,/* 0x090c */
- 0x00ae ,/* 0x090d */
- 0x00ab ,/* 0x090e */
- 0x00ac ,/* 0x090f */
- 0x00ad ,/* 0x0910 */
- 0x00b2 ,/* 0x0911 */
- 0x00af ,/* 0x0912 */
- 0x00b0 ,/* 0x0913 */
- 0x00b1 ,/* 0x0914 */
- 0x00b3 ,/* 0x0915 */
- 0x00b4 ,/* 0x0916 */
- 0x00b5 ,/* 0x0917 */
- 0x00b6 ,/* 0x0918 */
- 0x00b7 ,/* 0x0919 */
- 0x00b8 ,/* 0x091a */
- 0x00b9 ,/* 0x091b */
- 0x00ba ,/* 0x091c */
- 0x00bb ,/* 0x091d */
- 0x00bc ,/* 0x091e */
- 0x00bd ,/* 0x091f */
- 0x00be ,/* 0x0920 */
- 0x00bf ,/* 0x0921 */
- 0x00c0 ,/* 0x0922 */
- 0x00c1 ,/* 0x0923 */
- 0x00c2 ,/* 0x0924 */
- 0x00c3 ,/* 0x0925 */
- 0x00c4 ,/* 0x0926 */
- 0x00c5 ,/* 0x0927 */
- 0x00c6 ,/* 0x0928 */
- 0x00c7 ,/* 0x0929 */
- 0x00c8 ,/* 0x092a */
- 0x00c9 ,/* 0x092b */
- 0x00ca ,/* 0x092c */
- 0x00cb ,/* 0x092d */
- 0x00cc ,/* 0x092e */
- 0x00cd ,/* 0x092f */
- 0x00cf ,/* 0x0930 */
- 0x00d0 ,/* 0x0931 */
- 0x00d1 ,/* 0x0932 */
- 0x00d2 ,/* 0x0933 */
- 0x00d3 ,/* 0x0934 */
- 0x00d4 ,/* 0x0935 */
- 0x00d5 ,/* 0x0936 */
- 0x00d6 ,/* 0x0937 */
- 0x00d7 ,/* 0x0938 */
- 0x00d8 ,/* 0x0939 */
- 0xFFFF ,/* 0x093A */
- 0xFFFF ,/* 0x093B */
- 0x00e9 ,/* 0x093c */
- 0xEAE9 ,/* 0x093d */
- 0x00da ,/* 0x093e */
- 0x00db ,/* 0x093f */
- 0x00dc ,/* 0x0940 */
- 0x00dd ,/* 0x0941 */
- 0x00de ,/* 0x0942 */
- 0x00df ,/* 0x0943 */
- 0xDFE9 ,/* 0x0944 */
- 0x00e3 ,/* 0x0945 */
- 0x00e0 ,/* 0x0946 */
- 0x00e1 ,/* 0x0947 */
- 0x00e2 ,/* 0x0948 */
- 0x00e7 ,/* 0x0949 */
- 0x00e4 ,/* 0x094a */
- 0x00e5 ,/* 0x094b */
- 0x00e6 ,/* 0x094c */
- 0x00e8 ,/* 0x094d */
- 0x00ec ,/* 0x094e */
- 0x00ed ,/* 0x094f */
- 0xA1E9 ,/* 0x0950 */ /* OM Symbol */
- 0xFFFF ,/* 0x0951 */
- 0xF0B8 ,/* 0x0952 */
- 0xFFFF ,/* 0x0953 */
- 0xFFFF ,/* 0x0954 */
- 0xFFFF ,/* 0x0955 */
- 0xFFFF ,/* 0x0956 */
- 0xFFFF ,/* 0x0957 */
- 0xb3e9 ,/* 0x0958 */
- 0xb4e9 ,/* 0x0959 */
- 0xb5e9 ,/* 0x095a */
- 0xbae9 ,/* 0x095b */
- 0xbfe9 ,/* 0x095c */
- 0xC0E9 ,/* 0x095d */
- 0xc9e9 ,/* 0x095e */
- 0x00ce ,/* 0x095f */
- 0xAAe9 ,/* 0x0960 */
- 0xA7E9 ,/* 0x0961 */
- 0xDBE9 ,/* 0x0962 */
- 0xDCE9 ,/* 0x0963 */
- 0x00ea ,/* 0x0964 */
- 0xeaea ,/* 0x0965 */
- 0x00f1 ,/* 0x0966 */
- 0x00f2 ,/* 0x0967 */
- 0x00f3 ,/* 0x0968 */
- 0x00f4 ,/* 0x0969 */
- 0x00f5 ,/* 0x096a */
- 0x00f6 ,/* 0x096b */
- 0x00f7 ,/* 0x096c */
- 0x00f8 ,/* 0x096d */
- 0x00f9 ,/* 0x096e */
- 0x00fa ,/* 0x096f */
- 0xF0BF ,/* 0x0970 */
- 0xFFFF ,/* 0x0971 */
- 0xFFFF ,/* 0x0972 */
- 0xFFFF ,/* 0x0973 */
- 0xFFFF ,/* 0x0974 */
- 0xFFFF ,/* 0x0975 */
- 0xFFFF ,/* 0x0976 */
- 0xFFFF ,/* 0x0977 */
- 0xFFFF ,/* 0x0978 */
- 0xFFFF ,/* 0x0979 */
- 0xFFFF ,/* 0x097a */
- 0xFFFF ,/* 0x097b */
- 0xFFFF ,/* 0x097c */
- 0xFFFF ,/* 0x097d */
- 0xFFFF ,/* 0x097e */
- 0xFFFF ,/* 0x097f */
-};
-static const uint16_t toUnicodeTable[256]={
- 0x0000,/* 0x00 */
- 0x0001,/* 0x01 */
- 0x0002,/* 0x02 */
- 0x0003,/* 0x03 */
- 0x0004,/* 0x04 */
- 0x0005,/* 0x05 */
- 0x0006,/* 0x06 */
- 0x0007,/* 0x07 */
- 0x0008,/* 0x08 */
- 0x0009,/* 0x09 */
- 0x000a,/* 0x0a */
- 0x000b,/* 0x0b */
- 0x000c,/* 0x0c */
- 0x000d,/* 0x0d */
- 0x000e,/* 0x0e */
- 0x000f,/* 0x0f */
- 0x0010,/* 0x10 */
- 0x0011,/* 0x11 */
- 0x0012,/* 0x12 */
- 0x0013,/* 0x13 */
- 0x0014,/* 0x14 */
- 0x0015,/* 0x15 */
- 0x0016,/* 0x16 */
- 0x0017,/* 0x17 */
- 0x0018,/* 0x18 */
- 0x0019,/* 0x19 */
- 0x001a,/* 0x1a */
- 0x001b,/* 0x1b */
- 0x001c,/* 0x1c */
- 0x001d,/* 0x1d */
- 0x001e,/* 0x1e */
- 0x001f,/* 0x1f */
- 0x0020,/* 0x20 */
- 0x0021,/* 0x21 */
- 0x0022,/* 0x22 */
- 0x0023,/* 0x23 */
- 0x0024,/* 0x24 */
- 0x0025,/* 0x25 */
- 0x0026,/* 0x26 */
- 0x0027,/* 0x27 */
- 0x0028,/* 0x28 */
- 0x0029,/* 0x29 */
- 0x002a,/* 0x2a */
- 0x002b,/* 0x2b */
- 0x002c,/* 0x2c */
- 0x002d,/* 0x2d */
- 0x002e,/* 0x2e */
- 0x002f,/* 0x2f */
- 0x0030,/* 0x30 */
- 0x0031,/* 0x31 */
- 0x0032,/* 0x32 */
- 0x0033,/* 0x33 */
- 0x0034,/* 0x34 */
- 0x0035,/* 0x35 */
- 0x0036,/* 0x36 */
- 0x0037,/* 0x37 */
- 0x0038,/* 0x38 */
- 0x0039,/* 0x39 */
- 0x003A,/* 0x3A */
- 0x003B,/* 0x3B */
- 0x003c,/* 0x3c */
- 0x003d,/* 0x3d */
- 0x003e,/* 0x3e */
- 0x003f,/* 0x3f */
- 0x0040,/* 0x40 */
- 0x0041,/* 0x41 */
- 0x0042,/* 0x42 */
- 0x0043,/* 0x43 */
- 0x0044,/* 0x44 */
- 0x0045,/* 0x45 */
- 0x0046,/* 0x46 */
- 0x0047,/* 0x47 */
- 0x0048,/* 0x48 */
- 0x0049,/* 0x49 */
- 0x004a,/* 0x4a */
- 0x004b,/* 0x4b */
- 0x004c,/* 0x4c */
- 0x004d,/* 0x4d */
- 0x004e,/* 0x4e */
- 0x004f,/* 0x4f */
- 0x0050,/* 0x50 */
- 0x0051,/* 0x51 */
- 0x0052,/* 0x52 */
- 0x0053,/* 0x53 */
- 0x0054,/* 0x54 */
- 0x0055,/* 0x55 */
- 0x0056,/* 0x56 */
- 0x0057,/* 0x57 */
- 0x0058,/* 0x58 */
- 0x0059,/* 0x59 */
- 0x005a,/* 0x5a */
- 0x005b,/* 0x5b */
- 0x005c,/* 0x5c */
- 0x005d,/* 0x5d */
- 0x005e,/* 0x5e */
- 0x005f,/* 0x5f */
- 0x0060,/* 0x60 */
- 0x0061,/* 0x61 */
- 0x0062,/* 0x62 */
- 0x0063,/* 0x63 */
- 0x0064,/* 0x64 */
- 0x0065,/* 0x65 */
- 0x0066,/* 0x66 */
- 0x0067,/* 0x67 */
- 0x0068,/* 0x68 */
- 0x0069,/* 0x69 */
- 0x006a,/* 0x6a */
- 0x006b,/* 0x6b */
- 0x006c,/* 0x6c */
- 0x006d,/* 0x6d */
- 0x006e,/* 0x6e */
- 0x006f,/* 0x6f */
- 0x0070,/* 0x70 */
- 0x0071,/* 0x71 */
- 0x0072,/* 0x72 */
- 0x0073,/* 0x73 */
- 0x0074,/* 0x74 */
- 0x0075,/* 0x75 */
- 0x0076,/* 0x76 */
- 0x0077,/* 0x77 */
- 0x0078,/* 0x78 */
- 0x0079,/* 0x79 */
- 0x007a,/* 0x7a */
- 0x007b,/* 0x7b */
- 0x007c,/* 0x7c */
- 0x007d,/* 0x7d */
- 0x007e,/* 0x7e */
- 0x007f,/* 0x7f */
- 0x0080,/* 0x80 */
- 0x0081,/* 0x81 */
- 0x0082,/* 0x82 */
- 0x0083,/* 0x83 */
- 0x0084,/* 0x84 */
- 0x0085,/* 0x85 */
- 0x0086,/* 0x86 */
- 0x0087,/* 0x87 */
- 0x0088,/* 0x88 */
- 0x0089,/* 0x89 */
- 0x008a,/* 0x8a */
- 0x008b,/* 0x8b */
- 0x008c,/* 0x8c */
- 0x008d,/* 0x8d */
- 0x008e,/* 0x8e */
- 0x008f,/* 0x8f */
- 0x0090,/* 0x90 */
- 0x0091,/* 0x91 */
- 0x0092,/* 0x92 */
- 0x0093,/* 0x93 */
- 0x0094,/* 0x94 */
- 0x0095,/* 0x95 */
- 0x0096,/* 0x96 */
- 0x0097,/* 0x97 */
- 0x0098,/* 0x98 */
- 0x0099,/* 0x99 */
- 0x009a,/* 0x9a */
- 0x009b,/* 0x9b */
- 0x009c,/* 0x9c */
- 0x009d,/* 0x9d */
- 0x009e,/* 0x9e */
- 0x009f,/* 0x9f */
- 0x00A0,/* 0xa0 */
- 0x0901,/* 0xa1 */
- 0x0902,/* 0xa2 */
- 0x0903,/* 0xa3 */
- 0x0905,/* 0xa4 */
- 0x0906,/* 0xa5 */
- 0x0907,/* 0xa6 */
- 0x0908,/* 0xa7 */
- 0x0909,/* 0xa8 */
- 0x090a,/* 0xa9 */
- 0x090b,/* 0xaa */
- 0x090e,/* 0xab */
- 0x090f,/* 0xac */
- 0x0910,/* 0xad */
- 0x090d,/* 0xae */
- 0x0912,/* 0xaf */
- 0x0913,/* 0xb0 */
- 0x0914,/* 0xb1 */
- 0x0911,/* 0xb2 */
- 0x0915,/* 0xb3 */
- 0x0916,/* 0xb4 */
- 0x0917,/* 0xb5 */
- 0x0918,/* 0xb6 */
- 0x0919,/* 0xb7 */
- 0x091a,/* 0xb8 */
- 0x091b,/* 0xb9 */
- 0x091c,/* 0xba */
- 0x091d,/* 0xbb */
- 0x091e,/* 0xbc */
- 0x091f,/* 0xbd */
- 0x0920,/* 0xbe */
- 0x0921,/* 0xbf */
- 0x0922,/* 0xc0 */
- 0x0923,/* 0xc1 */
- 0x0924,/* 0xc2 */
- 0x0925,/* 0xc3 */
- 0x0926,/* 0xc4 */
- 0x0927,/* 0xc5 */
- 0x0928,/* 0xc6 */
- 0x0929,/* 0xc7 */
- 0x092a,/* 0xc8 */
- 0x092b,/* 0xc9 */
- 0x092c,/* 0xca */
- 0x092d,/* 0xcb */
- 0x092e,/* 0xcc */
- 0x092f,/* 0xcd */
- 0x095f,/* 0xce */
- 0x0930,/* 0xcf */
- 0x0931,/* 0xd0 */
- 0x0932,/* 0xd1 */
- 0x0933,/* 0xd2 */
- 0x0934,/* 0xd3 */
- 0x0935,/* 0xd4 */
- 0x0936,/* 0xd5 */
- 0x0937,/* 0xd6 */
- 0x0938,/* 0xd7 */
- 0x0939,/* 0xd8 */
- 0x200D,/* 0xd9 */
- 0x093e,/* 0xda */
- 0x093f,/* 0xdb */
- 0x0940,/* 0xdc */
- 0x0941,/* 0xdd */
- 0x0942,/* 0xde */
- 0x0943,/* 0xdf */
- 0x0946,/* 0xe0 */
- 0x0947,/* 0xe1 */
- 0x0948,/* 0xe2 */
- 0x0945,/* 0xe3 */
- 0x094a,/* 0xe4 */
- 0x094b,/* 0xe5 */
- 0x094c,/* 0xe6 */
- 0x0949,/* 0xe7 */
- 0x094d,/* 0xe8 */
- 0x093c,/* 0xe9 */
- 0x0964,/* 0xea */
- 0xFFFF,/* 0xeb */
- 0xFFFF,/* 0xec */
- 0xFFFF,/* 0xed */
- 0xFFFF,/* 0xee */
- 0xFFFF,/* 0xef */
- 0xFFFF,/* 0xf0 */
- 0x0966,/* 0xf1 */
- 0x0967,/* 0xf2 */
- 0x0968,/* 0xf3 */
- 0x0969,/* 0xf4 */
- 0x096a,/* 0xf5 */
- 0x096b,/* 0xf6 */
- 0x096c,/* 0xf7 */
- 0x096d,/* 0xf8 */
- 0x096e,/* 0xf9 */
- 0x096f,/* 0xfa */
- 0xFFFF,/* 0xfb */
- 0xFFFF,/* 0xfc */
- 0xFFFF,/* 0xfd */
- 0xFFFF,/* 0xfe */
- 0xFFFF /* 0xff */
-};
-
-static const uint16_t vowelSignESpecialCases[][2]={
- { 2 /*length of array*/ , 0 },
- { 0xA4 , 0x0904 },
-};
-
-static const uint16_t nuktaSpecialCases[][2]={
- { 16 /*length of array*/ , 0 },
- { 0xA6 , 0x090c },
- { 0xEA , 0x093D },
- { 0xDF , 0x0944 },
- { 0xA1 , 0x0950 },
- { 0xb3 , 0x0958 },
- { 0xb4 , 0x0959 },
- { 0xb5 , 0x095a },
- { 0xba , 0x095b },
- { 0xbf , 0x095c },
- { 0xC0 , 0x095d },
- { 0xc9 , 0x095e },
- { 0xAA , 0x0960 },
- { 0xA7 , 0x0961 },
- { 0xDB , 0x0962 },
- { 0xDC , 0x0963 },
-};
-
-
-#define WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,targetByteUnit,err) UPRV_BLOCK_MACRO_BEGIN { \
- int32_t offset = (int32_t)(source - args->source-1); \
- /* write the targetUniChar to target */ \
- if(target < targetLimit){ \
- if(targetByteUnit <= 0xFF){ \
- *(target)++ = (uint8_t)(targetByteUnit); \
- if(offsets){ \
- *(offsets++) = offset; \
- } \
- }else{ \
- if (targetByteUnit > 0xFFFF) { \
- *(target)++ = (uint8_t)(targetByteUnit>>16); \
- if (offsets) { \
- --offset; \
- *(offsets++) = offset; \
- } \
- } \
- if (!(target < targetLimit)) { \
- args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = \
- (uint8_t)(targetByteUnit >> 8); \
- args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = \
- (uint8_t)targetByteUnit; \
- *err = U_BUFFER_OVERFLOW_ERROR; \
- } else { \
- *(target)++ = (uint8_t)(targetByteUnit>>8); \
- if(offsets){ \
- *(offsets++) = offset; \
- } \
- if(target < targetLimit){ \
- *(target)++ = (uint8_t) targetByteUnit; \
- if(offsets){ \
- *(offsets++) = offset ; \
- } \
- }else{ \
- args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] =\
- (uint8_t) (targetByteUnit); \
- *err = U_BUFFER_OVERFLOW_ERROR; \
- } \
- } \
- } \
- }else{ \
- if (targetByteUnit & 0xFF0000) { \
- args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = \
- (uint8_t) (targetByteUnit >>16); \
- } \
- if(targetByteUnit & 0xFF00){ \
- args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = \
- (uint8_t) (targetByteUnit >>8); \
- } \
- args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = \
- (uint8_t) (targetByteUnit); \
- *err = U_BUFFER_OVERFLOW_ERROR; \
- } \
-} UPRV_BLOCK_MACRO_END
-
-/* Rules:
- * Explicit Halant :
- * <HALANT> + <ZWNJ>
- * Soft Halant :
- * <HALANT> + <ZWJ>
- */
-static void U_CALLCONV
-UConverter_fromUnicode_ISCII_OFFSETS_LOGIC(
- UConverterFromUnicodeArgs * args, UErrorCode * err) {
- const UChar *source = args->source;
- const UChar *sourceLimit = args->sourceLimit;
- unsigned char *target = (unsigned char *) args->target;
- unsigned char *targetLimit = (unsigned char *) args->targetLimit;
- int32_t* offsets = args->offsets;
- uint32_t targetByteUnit = 0x0000;
- UChar32 sourceChar = 0x0000;
- UChar32 tempContextFromUnicode = 0x0000; /* For special handling of the Gurmukhi script. */
- UConverterDataISCII *converterData;
- uint16_t newDelta=0;
- uint16_t range = 0;
- UBool deltaChanged = FALSE;
-
- if ((args->converter == NULL) || (args->targetLimit < args->target) || (args->sourceLimit < args->source)) {
- *err = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- /* initialize data */
- converterData=(UConverterDataISCII*)args->converter->extraInfo;
- newDelta=converterData->currentDeltaFromUnicode;
- range = (uint16_t)(newDelta/DELTA);
-
- if ((sourceChar = args->converter->fromUChar32)!=0) {
- goto getTrail;
- }
-
- /*writing the char to the output stream */
- while (source < sourceLimit) {
- /* Write the language code following LF only if LF is not the last character. */
- if (args->converter->fromUnicodeStatus == LF) {
- targetByteUnit = ATR<<8;
- targetByteUnit += (uint8_t) lookupInitialData[range].isciiLang;
- args->converter->fromUnicodeStatus = 0x0000;
- /* now append ATR and language code */
- WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,targetByteUnit,err);
- if (U_FAILURE(*err)) {
- break;
- }
- }
-
- sourceChar = *source++;
- tempContextFromUnicode = converterData->contextCharFromUnicode;
-
- targetByteUnit = missingCharMarker;
-
- /*check if input is in ASCII and C0 control codes range*/
- if (sourceChar <= ASCII_END) {
- args->converter->fromUnicodeStatus = sourceChar;
- WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,sourceChar,err);
- if (U_FAILURE(*err)) {
- break;
- }
- continue;
- }
- switch (sourceChar) {
- case ZWNJ:
- /* contextChar has HALANT */
- if (converterData->contextCharFromUnicode) {
- converterData->contextCharFromUnicode = 0x00;
- targetByteUnit = ISCII_HALANT;
- } else {
- /* consume ZWNJ and continue */
- converterData->contextCharFromUnicode = 0x00;
- continue;
- }
- break;
- case ZWJ:
- /* contextChar has HALANT */
- if (converterData->contextCharFromUnicode) {
- targetByteUnit = ISCII_NUKTA;
- } else {
- targetByteUnit =ISCII_INV;
- }
- converterData->contextCharFromUnicode = 0x00;
- break;
- default:
- /* is the sourceChar in the INDIC_RANGE? */
- if ((uint16_t)(INDIC_BLOCK_END-sourceChar) <= INDIC_RANGE) {
- /* Danda and Double Danda are valid in Northern scripts.. since Unicode
- * does not include these codepoints in all Northern scrips we need to
- * filter them out
- */
- if (sourceChar!= DANDA && sourceChar != DOUBLE_DANDA) {
- /* find out to which block the souceChar belongs*/
- range =(uint16_t)((sourceChar-INDIC_BLOCK_BEGIN)/DELTA);
- newDelta =(uint16_t)(range*DELTA);
-
- /* Now are we in the same block as the previous? */
- if (newDelta!= converterData->currentDeltaFromUnicode || converterData->isFirstBuffer) {
- converterData->currentDeltaFromUnicode = newDelta;
- converterData->currentMaskFromUnicode = lookupInitialData[range].maskEnum;
- deltaChanged =TRUE;
- converterData->isFirstBuffer=FALSE;
- }
-
- if (converterData->currentDeltaFromUnicode == PNJ_DELTA) {
- if (sourceChar == PNJ_TIPPI) {
- /* Make sure Tippi is converterd to Bindi. */
- sourceChar = PNJ_BINDI;
- } else if (sourceChar == PNJ_ADHAK) {
- /* This is for consonant cluster handling. */
- converterData->contextCharFromUnicode = PNJ_ADHAK;
- }
-
- }
- /* Normalize all Indic codepoints to Devanagari and map them to ISCII */
- /* now subtract the new delta from sourceChar*/
- sourceChar -= converterData->currentDeltaFromUnicode;
- }
-
- /* get the target byte unit */
- targetByteUnit=fromUnicodeTable[(uint8_t)sourceChar];
-
- /* is the code point valid in current script? */
- if ((validityTable[(uint8_t)sourceChar] & converterData->currentMaskFromUnicode)==0) {
- /* Vocallic RR is assigned in ISCII Telugu and Unicode */
- if (converterData->currentDeltaFromUnicode!=(TELUGU_DELTA) || sourceChar!=VOCALLIC_RR) {
- targetByteUnit=missingCharMarker;
- }
- }
-
- if (deltaChanged) {
- /* we are in a script block which is different than
- * previous sourceChar's script block write ATR and language codes
- */
- uint32_t temp=0;
- temp =(uint16_t)(ATR<<8);
- temp += (uint16_t)((uint8_t) lookupInitialData[range].isciiLang);
- /* reset */
- deltaChanged=FALSE;
- /* now append ATR and language code */
- WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,temp,err);
- if (U_FAILURE(*err)) {
- break;
- }
- }
-
- if (converterData->currentDeltaFromUnicode == PNJ_DELTA && (sourceChar + PNJ_DELTA) == PNJ_ADHAK) {
- continue;
- }
- }
- /* reset context char */
- converterData->contextCharFromUnicode = 0x00;
- break;
- }
- if (converterData->currentDeltaFromUnicode == PNJ_DELTA && tempContextFromUnicode == PNJ_ADHAK && isPNJConsonant((sourceChar + PNJ_DELTA))) {
- /* If the previous codepoint is Adhak and the current codepoint is a consonant, the targetByteUnit should be C + Halant + C. */
- /* reset context char */
- converterData->contextCharFromUnicode = 0x0000;
- targetByteUnit = targetByteUnit << 16 | ISCII_HALANT << 8 | targetByteUnit;
- /* write targetByteUnit to target */
- WRITE_TO_TARGET_FROM_U(args, offsets, source, target, targetLimit, targetByteUnit,err);
- if (U_FAILURE(*err)) {
- break;
- }
- } else if (targetByteUnit != missingCharMarker) {
- if (targetByteUnit==ISCII_HALANT) {
- converterData->contextCharFromUnicode = (UChar)targetByteUnit;
- }
- /* write targetByteUnit to target*/
- WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,targetByteUnit,err);
- if (U_FAILURE(*err)) {
- break;
- }
- } else {
- /* oops.. the code point is unassigned */
- /*check if the char is a First surrogate*/
- if (U16_IS_SURROGATE(sourceChar)) {
- if (U16_IS_SURROGATE_LEAD(sourceChar)) {
-getTrail:
- /*look ahead to find the trail surrogate*/
- if (source < sourceLimit) {
- /* test the following code unit */
- UChar trail= (*source);
- if (U16_IS_TRAIL(trail)) {
- source++;
- sourceChar=U16_GET_SUPPLEMENTARY(sourceChar, trail);
- *err =U_INVALID_CHAR_FOUND;
- /* convert this surrogate code point */
- /* exit this condition tree */
- } else {
- /* this is an unmatched lead code unit (1st surrogate) */
- /* callback(illegal) */
- *err=U_ILLEGAL_CHAR_FOUND;
- }
- } else {
- /* no more input */
- *err = U_ZERO_ERROR;
- }
- } else {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- *err=U_ILLEGAL_CHAR_FOUND;
- }
- } else {
- /* callback(unassigned) for a BMP code point */
- *err = U_INVALID_CHAR_FOUND;
- }
-
- args->converter->fromUChar32=sourceChar;
- break;
- }
- }/* end while(mySourceIndex<mySourceLength) */
-
- /*save the state and return */
- args->source = source;
- args->target = (char*)target;
-}
-
-static const uint16_t lookupTable[][2]={
- { ZERO, ZERO }, /*DEFALT*/
- { ZERO, ZERO }, /*ROMAN*/
- { DEVANAGARI, DEV_MASK },
- { BENGALI, BNG_MASK },
- { TAMIL, TML_MASK },
- { TELUGU, KND_MASK },
- { BENGALI, BNG_MASK },
- { ORIYA, ORI_MASK },
- { KANNADA, KND_MASK },
- { MALAYALAM, MLM_MASK },
- { GUJARATI, GJR_MASK },
- { GURMUKHI, PNJ_MASK }
-};
-
-#define WRITE_TO_TARGET_TO_U(args,source,target,offsets,offset,targetUniChar,delta, err) UPRV_BLOCK_MACRO_BEGIN { \
- /* add offset to current Indic Block */ \
- if(targetUniChar>ASCII_END && \
- targetUniChar != ZWJ && \
- targetUniChar != ZWNJ && \
- targetUniChar != DANDA && \
- targetUniChar != DOUBLE_DANDA){ \
- \
- targetUniChar+=(uint16_t)(delta); \
- } \
- /* now write the targetUniChar */ \
- if(target<args->targetLimit){ \
- *(target)++ = (UChar)targetUniChar; \
- if(offsets){ \
- *(offsets)++ = (int32_t)(offset); \
- } \
- }else{ \
- args->converter->UCharErrorBuffer[args->converter->UCharErrorBufferLength++] = \
- (UChar)targetUniChar; \
- *err = U_BUFFER_OVERFLOW_ERROR; \
- } \
-} UPRV_BLOCK_MACRO_END
-
-#define GET_MAPPING(sourceChar,targetUniChar,data) UPRV_BLOCK_MACRO_BEGIN { \
- targetUniChar = toUnicodeTable[(sourceChar)] ; \
- /* is the code point valid in current script? */ \
- if(sourceChar> ASCII_END && \
- (validityTable[(targetUniChar & 0x7F)] & data->currentMaskToUnicode)==0){ \
- /* Vocallic RR is assigne in ISCII Telugu and Unicode */ \
- if(data->currentDeltaToUnicode!=(TELUGU_DELTA) || \
- targetUniChar!=VOCALLIC_RR){ \
- targetUniChar=missingCharMarker; \
- } \
- } \
-} UPRV_BLOCK_MACRO_END
-
-/***********
- * Rules for ISCII to Unicode converter
- * ISCII is stateful encoding. To convert ISCII bytes to Unicode,
- * which has both precomposed and decomposed forms characters
- * pre-context and post-context need to be considered.
- *
- * Post context
- * i) ATR : Attribute code is used to declare the font and script switching.
- * Currently we only switch scripts and font codes consumed without generating an error
- * ii) EXT : Extention code is used to declare switching to Sanskrit and for obscure,
- * obsolete characters
- * Pre context
- * i) Halant: if preceeded by a halant then it is a explicit halant
- * ii) Nukta :
- * a) if preceeded by a halant then it is a soft halant
- * b) if preceeded by specific consonants and the ligatures have pre-composed
- * characters in Unicode then convert to pre-composed characters
- * iii) Danda: If Danda is preceeded by a Danda then convert to Double Danda
- *
- */
-
-static void U_CALLCONV
-UConverter_toUnicode_ISCII_OFFSETS_LOGIC(UConverterToUnicodeArgs *args, UErrorCode* err) {
- const char *source = ( char *) args->source;
- UChar *target = args->target;
- const char *sourceLimit = args->sourceLimit;
- const UChar* targetLimit = args->targetLimit;
- uint32_t targetUniChar = 0x0000;
- uint8_t sourceChar = 0x0000;
- UConverterDataISCII* data;
- UChar32* toUnicodeStatus=NULL;
- UChar32 tempTargetUniChar = 0x0000;
- UChar* contextCharToUnicode= NULL;
- UBool found;
- int i;
- int offset = 0;
-
- if ((args->converter == NULL) || (target < args->target) || (source < args->source)) {
- *err = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- data = (UConverterDataISCII*)(args->converter->extraInfo);
- contextCharToUnicode = &data->contextCharToUnicode; /* contains previous ISCII codepoint visited */
- toUnicodeStatus = (UChar32*)&args->converter->toUnicodeStatus;/* contains the mapping to Unicode of the above codepoint*/
-
- while (U_SUCCESS(*err) && source<sourceLimit) {
-
- targetUniChar = missingCharMarker;
-
- if (target < targetLimit) {
- sourceChar = (unsigned char)*(source)++;
-
- /* look at the post-context preform special processing */
- if (*contextCharToUnicode==ATR) {
-
- /* If we have ATR in *contextCharToUnicode then we need to change our
- * state to the Indic Script specified by sourceChar
- */
-
- /* check if the sourceChar is supported script range*/
- if ((uint8_t)(PNJ-sourceChar)<=PNJ-DEV) {
- data->currentDeltaToUnicode = (uint16_t)(lookupTable[sourceChar & 0x0F][0] * DELTA);
- data->currentMaskToUnicode = (MaskEnum)lookupTable[sourceChar & 0x0F][1];
- } else if (sourceChar==DEF) {
- /* switch back to default */
- data->currentDeltaToUnicode = data->defDeltaToUnicode;
- data->currentMaskToUnicode = data->defMaskToUnicode;
- } else {
- if ((sourceChar >= 0x21 && sourceChar <= 0x3F)) {
- /* these are display codes consume and continue */
- } else {
- *err =U_ILLEGAL_CHAR_FOUND;
- /* reset */
- *contextCharToUnicode=NO_CHAR_MARKER;
- goto CALLBACK;
- }
- }
-
- /* reset */
- *contextCharToUnicode=NO_CHAR_MARKER;
-
- continue;
-
- } else if (*contextCharToUnicode==EXT) {
- /* check if sourceChar is in 0xA1-0xEE range */
- if ((uint8_t) (EXT_RANGE_END - sourceChar) <= (EXT_RANGE_END - EXT_RANGE_BEGIN)) {
- /* We currently support only Anudatta and Devanagari abbreviation sign */
- if (sourceChar==0xBF || sourceChar == 0xB8) {
- targetUniChar = (sourceChar==0xBF) ? DEV_ABBR_SIGN : DEV_ANUDATTA;
-
- /* find out if the mapping is valid in this state */
- if (validityTable[(uint8_t)targetUniChar] & data->currentMaskToUnicode) {
- *contextCharToUnicode= NO_CHAR_MARKER;
-
- /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
- if (data->prevToUnicodeStatus) {
- WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
- data->prevToUnicodeStatus = 0x0000;
- }
- /* write to target */
- WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -2),targetUniChar,data->currentDeltaToUnicode,err);
-
- continue;
- }
- }
- /* byte unit is unassigned */
- targetUniChar = missingCharMarker;
- *err= U_INVALID_CHAR_FOUND;
- } else {
- /* only 0xA1 - 0xEE are legal after EXT char */
- *contextCharToUnicode= NO_CHAR_MARKER;
- *err = U_ILLEGAL_CHAR_FOUND;
- }
- goto CALLBACK;
- } else if (*contextCharToUnicode==ISCII_INV) {
- if (sourceChar==ISCII_HALANT) {
- targetUniChar = 0x0020; /* replace with space accoding to Indic FAQ */
- } else {
- targetUniChar = ZWJ;
- }
-
- /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
- if (data->prevToUnicodeStatus) {
- WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
- data->prevToUnicodeStatus = 0x0000;
- }
- /* write to target */
- WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -2),targetUniChar,data->currentDeltaToUnicode,err);
- /* reset */
- *contextCharToUnicode=NO_CHAR_MARKER;
- }
-
- /* look at the pre-context and perform special processing */
- switch (sourceChar) {
- case ISCII_INV:
- case EXT:
- case ATR:
- *contextCharToUnicode = (UChar)sourceChar;
-
- if (*toUnicodeStatus != missingCharMarker) {
- /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
- if (data->prevToUnicodeStatus) {
- WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
- data->prevToUnicodeStatus = 0x0000;
- }
- WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -2),*toUnicodeStatus,data->currentDeltaToUnicode,err);
- *toUnicodeStatus = missingCharMarker;
- }
- continue;
- case ISCII_DANDA:
- /* handle double danda*/
- if (*contextCharToUnicode== ISCII_DANDA) {
- targetUniChar = DOUBLE_DANDA;
- /* clear the context */
- *contextCharToUnicode = NO_CHAR_MARKER;
- *toUnicodeStatus = missingCharMarker;
- } else {
- GET_MAPPING(sourceChar,targetUniChar,data);
- *contextCharToUnicode = sourceChar;
- }
- break;
- case ISCII_HALANT:
- /* handle explicit halant */
- if (*contextCharToUnicode == ISCII_HALANT) {
- targetUniChar = ZWNJ;
- /* clear the context */
- *contextCharToUnicode = NO_CHAR_MARKER;
- } else {
- GET_MAPPING(sourceChar,targetUniChar,data);
- *contextCharToUnicode = sourceChar;
- }
- break;
- case 0x0A:
- case 0x0D:
- data->resetToDefaultToUnicode = TRUE;
- GET_MAPPING(sourceChar,targetUniChar,data)
- ;
- *contextCharToUnicode = sourceChar;
- break;
-
- case ISCII_VOWEL_SIGN_E:
- i=1;
- found=FALSE;
- for (; i<vowelSignESpecialCases[0][0]; i++) {
- U_ASSERT(i<UPRV_LENGTHOF(vowelSignESpecialCases));
- if (vowelSignESpecialCases[i][0]==(uint8_t)*contextCharToUnicode) {
- targetUniChar=vowelSignESpecialCases[i][1];
- found=TRUE;
- break;
- }
- }
- if (found) {
- /* find out if the mapping is valid in this state */
- if (validityTable[(uint8_t)targetUniChar] & data->currentMaskToUnicode) {
- /*targetUniChar += data->currentDeltaToUnicode ;*/
- *contextCharToUnicode= NO_CHAR_MARKER;
- *toUnicodeStatus = missingCharMarker;
- break;
- }
- }
- GET_MAPPING(sourceChar,targetUniChar,data);
- *contextCharToUnicode = sourceChar;
- break;
-
- case ISCII_NUKTA:
- /* handle soft halant */
- if (*contextCharToUnicode == ISCII_HALANT) {
- targetUniChar = ZWJ;
- /* clear the context */
- *contextCharToUnicode = NO_CHAR_MARKER;
- break;
- } else if (data->currentDeltaToUnicode == PNJ_DELTA && data->contextCharToUnicode == 0xc0) {
- /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
- if (data->prevToUnicodeStatus) {
- WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
- data->prevToUnicodeStatus = 0x0000;
- }
- /* We got here because ISCII_NUKTA was preceded by 0xc0 and we are converting Gurmukhi.
- * In that case we must convert (0xc0 0xe9) to (\u0a5c\u0a4d\u0a39).
- */
- targetUniChar = PNJ_RRA;
- WRITE_TO_TARGET_TO_U(args, source, target, args->offsets, (source-args->source)-2, targetUniChar, 0, err);
- if (U_SUCCESS(*err)) {
- targetUniChar = PNJ_SIGN_VIRAMA;
- WRITE_TO_TARGET_TO_U(args, source, target, args->offsets, (source-args->source)-2, targetUniChar, 0, err);
- if (U_SUCCESS(*err)) {
- targetUniChar = PNJ_HA;
- WRITE_TO_TARGET_TO_U(args, source, target, args->offsets, (source-args->source)-2, targetUniChar, 0, err);
- } else {
- args->converter->UCharErrorBuffer[args->converter->UCharErrorBufferLength++]= PNJ_HA;
- }
- } else {
- args->converter->UCharErrorBuffer[args->converter->UCharErrorBufferLength++]= PNJ_SIGN_VIRAMA;
- args->converter->UCharErrorBuffer[args->converter->UCharErrorBufferLength++]= PNJ_HA;
- }
- *toUnicodeStatus = missingCharMarker;
- data->contextCharToUnicode = NO_CHAR_MARKER;
- continue;
- } else {
- /* try to handle <CHAR> + ISCII_NUKTA special mappings */
- i=1;
- found =FALSE;
- for (; i<nuktaSpecialCases[0][0]; i++) {
- if (nuktaSpecialCases[i][0]==(uint8_t)
- *contextCharToUnicode) {
- targetUniChar=nuktaSpecialCases[i][1];
- found =TRUE;
- break;
- }
- }
- if (found) {
- /* find out if the mapping is valid in this state */
- if (validityTable[(uint8_t)targetUniChar] & data->currentMaskToUnicode) {
- /*targetUniChar += data->currentDeltaToUnicode ;*/
- *contextCharToUnicode= NO_CHAR_MARKER;
- *toUnicodeStatus = missingCharMarker;
- if (data->currentDeltaToUnicode == PNJ_DELTA) {
- /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
- if (data->prevToUnicodeStatus) {
- WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
- data->prevToUnicodeStatus = 0x0000;
- }
- WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -2),targetUniChar,data->currentDeltaToUnicode,err);
- continue;
- }
- break;
- }
- /* else fall through to default */
- }
- /* else fall through to default */
- U_FALLTHROUGH;
- }
- default:GET_MAPPING(sourceChar,targetUniChar,data)
- ;
- *contextCharToUnicode = sourceChar;
- break;
- }
-
- if (*toUnicodeStatus != missingCharMarker) {
- /* Check to make sure that consonant clusters are handled correct for Gurmukhi script. */
- if (data->currentDeltaToUnicode == PNJ_DELTA && data->prevToUnicodeStatus != 0 && isPNJConsonant(data->prevToUnicodeStatus) &&
- (*toUnicodeStatus + PNJ_DELTA) == PNJ_SIGN_VIRAMA && ((UChar32)(targetUniChar + PNJ_DELTA) == data->prevToUnicodeStatus)) {
- /* Consonant clusters C + HALANT + C should be encoded as ADHAK + C */
- offset = (int)(source-args->source - 3);
- tempTargetUniChar = PNJ_ADHAK; /* This is necessary to avoid some compiler warnings. */
- WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,offset,tempTargetUniChar,0,err);
- WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,offset,data->prevToUnicodeStatus,0,err);
- data->prevToUnicodeStatus = 0x0000; /* reset the previous unicode code point */
- *toUnicodeStatus = missingCharMarker;
- continue;
- } else {
- /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
- if (data->prevToUnicodeStatus) {
- WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
- data->prevToUnicodeStatus = 0x0000;
- }
- /* Check to make sure that Bindi and Tippi are handled correctly for Gurmukhi script.
- * If 0xA2 is preceded by a codepoint in the PNJ_BINDI_TIPPI_SET then the target codepoint should be Tippi instead of Bindi.
- */
- if (data->currentDeltaToUnicode == PNJ_DELTA && (targetUniChar + PNJ_DELTA) == PNJ_BINDI && isPNJBindiTippi((*toUnicodeStatus + PNJ_DELTA))) {
- targetUniChar = PNJ_TIPPI - PNJ_DELTA;
- WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -2),*toUnicodeStatus,PNJ_DELTA,err);
- } else if (data->currentDeltaToUnicode == PNJ_DELTA && (targetUniChar + PNJ_DELTA) == PNJ_SIGN_VIRAMA && isPNJConsonant((*toUnicodeStatus + PNJ_DELTA))) {
- /* Store the current toUnicodeStatus code point for later handling of consonant cluster in Gurmukhi. */
- data->prevToUnicodeStatus = *toUnicodeStatus + PNJ_DELTA;
- } else {
- /* write the previously mapped codepoint */
- WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -2),*toUnicodeStatus,data->currentDeltaToUnicode,err);
- }
- }
- *toUnicodeStatus = missingCharMarker;
- }
-
- if (targetUniChar != missingCharMarker) {
- /* now save the targetUniChar for delayed write */
- *toUnicodeStatus = (UChar) targetUniChar;
- if (data->resetToDefaultToUnicode==TRUE) {
- data->currentDeltaToUnicode = data->defDeltaToUnicode;
- data->currentMaskToUnicode = data->defMaskToUnicode;
- data->resetToDefaultToUnicode=FALSE;
- }
- } else {
-
- /* we reach here only if targetUniChar == missingCharMarker
- * so assign codes to reason and err
- */
- *err = U_INVALID_CHAR_FOUND;
-CALLBACK:
- args->converter->toUBytes[0] = (uint8_t) sourceChar;
- args->converter->toULength = 1;
- break;
- }
-
- } else {
- *err =U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- }
-
- if (U_SUCCESS(*err) && args->flush && source == sourceLimit) {
- /* end of the input stream */
- UConverter *cnv = args->converter;
-
- if (*contextCharToUnicode==ATR || *contextCharToUnicode==EXT || *contextCharToUnicode==ISCII_INV) {
- /* set toUBytes[] */
- cnv->toUBytes[0] = (uint8_t)*contextCharToUnicode;
- cnv->toULength = 1;
-
- /* avoid looping on truncated sequences */
- *contextCharToUnicode = NO_CHAR_MARKER;
- } else {
- cnv->toULength = 0;
- }
-
- if (*toUnicodeStatus != missingCharMarker) {
- /* output a remaining target character */
- WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source - args->source -1),*toUnicodeStatus,data->currentDeltaToUnicode,err);
- *toUnicodeStatus = missingCharMarker;
- }
- }
-
- args->target = target;
- args->source = source;
-}
-
-/* structure for SafeClone calculations */
-struct cloneISCIIStruct {
- UConverter cnv;
- UConverterDataISCII mydata;
-};
-
-static UConverter * U_CALLCONV
-_ISCII_SafeClone(const UConverter *cnv,
- void *stackBuffer,
- int32_t *pBufferSize,
- UErrorCode *status)
-{
- struct cloneISCIIStruct * localClone;
- int32_t bufferSizeNeeded = sizeof(struct cloneISCIIStruct);
-
- if (U_FAILURE(*status)) {
- return 0;
- }
-
- if (*pBufferSize == 0) { /* 'preflighting' request - set needed size into *pBufferSize */
- *pBufferSize = bufferSizeNeeded;
- return 0;
- }
-
- localClone = (struct cloneISCIIStruct *)stackBuffer;
- /* ucnv.c/ucnv_safeClone() copied the main UConverter already */
-
- uprv_memcpy(&localClone->mydata, cnv->extraInfo, sizeof(UConverterDataISCII));
- localClone->cnv.extraInfo = &localClone->mydata;
- localClone->cnv.isExtraLocal = TRUE;
-
- return &localClone->cnv;
-}
-
-static void U_CALLCONV
-_ISCIIGetUnicodeSet(const UConverter *cnv,
- const USetAdder *sa,
- UConverterUnicodeSet which,
- UErrorCode *pErrorCode)
-{
- (void)cnv;
- (void)which;
- (void)pErrorCode;
- int32_t idx, script;
- uint8_t mask;
-
- /* Since all ISCII versions allow switching to other ISCII
- scripts, we add all roundtrippable characters to this set. */
- sa->addRange(sa->set, 0, ASCII_END);
- for (script = DEVANAGARI; script <= MALAYALAM; script++) {
- mask = (uint8_t)(lookupInitialData[script].maskEnum);
- for (idx = 0; idx < DELTA; idx++) {
- /* added check for TELUGU character */
- if ((validityTable[idx] & mask) || (script==TELUGU && idx==0x31)) {
- sa->add(sa->set, idx + (script * DELTA) + INDIC_BLOCK_BEGIN);
- }
- }
- }
- sa->add(sa->set, DANDA);
- sa->add(sa->set, DOUBLE_DANDA);
- sa->add(sa->set, ZWNJ);
- sa->add(sa->set, ZWJ);
-}
-U_CDECL_END
-static const UConverterImpl _ISCIIImpl={
-
- UCNV_ISCII,
-
- NULL,
- NULL,
-
- _ISCIIOpen,
- _ISCIIClose,
- _ISCIIReset,
-
- UConverter_toUnicode_ISCII_OFFSETS_LOGIC,
- UConverter_toUnicode_ISCII_OFFSETS_LOGIC,
- UConverter_fromUnicode_ISCII_OFFSETS_LOGIC,
- UConverter_fromUnicode_ISCII_OFFSETS_LOGIC,
- NULL,
-
- NULL,
- _ISCIIgetName,
- NULL,
- _ISCII_SafeClone,
- _ISCIIGetUnicodeSet,
- NULL,
- NULL
-};
-
-static const UConverterStaticData _ISCIIStaticData={
- sizeof(UConverterStaticData),
- "ISCII",
- 0,
- UCNV_IBM,
- UCNV_ISCII,
- 1,
- 4,
- { 0x1a, 0, 0, 0 },
- 0x1,
- FALSE,
- FALSE,
- 0x0,
- 0x0,
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, /* reserved */
-
-};
-
-const UConverterSharedData _ISCIIData=
- UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_ISCIIStaticData, &_ISCIIImpl);
-
-#endif /* #if !UCONFIG_NO_LEGACY_CONVERSION */
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+**********************************************************************
+* Copyright (C) 2000-2016, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* file name: ucnvisci.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2001JUN26
+* created by: Ram Viswanadha
+*
+* Date Name Description
+* 24/7/2001 Ram Added support for EXT character handling
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION
+
+#include "unicode/ucnv.h"
+#include "unicode/ucnv_cb.h"
+#include "unicode/utf16.h"
+#include "cmemory.h"
+#include "ucnv_bld.h"
+#include "ucnv_cnv.h"
+#include "cstring.h"
+#include "uassert.h"
+
+#define UCNV_OPTIONS_VERSION_MASK 0xf
+#define NUKTA 0x093c
+#define HALANT 0x094d
+#define ZWNJ 0x200c /* Zero Width Non Joiner */
+#define ZWJ 0x200d /* Zero width Joiner */
+#define INVALID_CHAR 0xffff
+#define ATR 0xEF /* Attribute code */
+#define EXT 0xF0 /* Extension code */
+#define DANDA 0x0964
+#define DOUBLE_DANDA 0x0965
+#define ISCII_NUKTA 0xE9
+#define ISCII_HALANT 0xE8
+#define ISCII_DANDA 0xEA
+#define ISCII_INV 0xD9
+#define ISCII_VOWEL_SIGN_E 0xE0
+#define INDIC_BLOCK_BEGIN 0x0900
+#define INDIC_BLOCK_END 0x0D7F
+#define INDIC_RANGE (INDIC_BLOCK_END - INDIC_BLOCK_BEGIN)
+#define VOCALLIC_RR 0x0931
+#define LF 0x0A
+#define ASCII_END 0xA0
+#define NO_CHAR_MARKER 0xFFFE
+#define TELUGU_DELTA DELTA * TELUGU
+#define DEV_ABBR_SIGN 0x0970
+#define DEV_ANUDATTA 0x0952
+#define EXT_RANGE_BEGIN 0xA1
+#define EXT_RANGE_END 0xEE
+
+#define PNJ_DELTA 0x0100
+#define PNJ_BINDI 0x0A02
+#define PNJ_TIPPI 0x0A70
+#define PNJ_SIGN_VIRAMA 0x0A4D
+#define PNJ_ADHAK 0x0A71
+#define PNJ_HA 0x0A39
+#define PNJ_RRA 0x0A5C
+
+typedef enum {
+ DEVANAGARI =0,
+ BENGALI,
+ GURMUKHI,
+ GUJARATI,
+ ORIYA,
+ TAMIL,
+ TELUGU,
+ KANNADA,
+ MALAYALAM,
+ DELTA=0x80
+}UniLang;
+
+/**
+ * Enumeration for switching code pages if <ATR>+<one of below values>
+ * is encountered
+ */
+typedef enum {
+ DEF = 0x40,
+ RMN = 0x41,
+ DEV = 0x42,
+ BNG = 0x43,
+ TML = 0x44,
+ TLG = 0x45,
+ ASM = 0x46,
+ ORI = 0x47,
+ KND = 0x48,
+ MLM = 0x49,
+ GJR = 0x4A,
+ PNJ = 0x4B,
+ ARB = 0x71,
+ PES = 0x72,
+ URD = 0x73,
+ SND = 0x74,
+ KSM = 0x75,
+ PST = 0x76
+}ISCIILang;
+
+typedef enum {
+ DEV_MASK =0x80,
+ PNJ_MASK =0x40,
+ GJR_MASK =0x20,
+ ORI_MASK =0x10,
+ BNG_MASK =0x08,
+ KND_MASK =0x04,
+ MLM_MASK =0x02,
+ TML_MASK =0x01,
+ ZERO =0x00
+}MaskEnum;
+
+#define ISCII_CNV_PREFIX "ISCII,version="
+
+typedef struct {
+ UChar contextCharToUnicode; /* previous Unicode codepoint for contextual analysis */
+ UChar contextCharFromUnicode; /* previous Unicode codepoint for contextual analysis */
+ uint16_t defDeltaToUnicode; /* delta for switching to default state when DEF is encountered */
+ uint16_t currentDeltaFromUnicode; /* current delta in Indic block */
+ uint16_t currentDeltaToUnicode; /* current delta in Indic block */
+ MaskEnum currentMaskFromUnicode; /* mask for current state in toUnicode */
+ MaskEnum currentMaskToUnicode; /* mask for current state in toUnicode */
+ MaskEnum defMaskToUnicode; /* mask for default state in toUnicode */
+ UBool isFirstBuffer; /* boolean for fromUnicode to see if we need to announce the first script */
+ UBool resetToDefaultToUnicode; /* boolean for reseting to default delta and mask when a newline is encountered*/
+ char name[sizeof(ISCII_CNV_PREFIX) + 1];
+ UChar32 prevToUnicodeStatus; /* Hold the previous toUnicodeStatus. This is necessary because we may need to know the last two code points. */
+} UConverterDataISCII;
+
+typedef struct LookupDataStruct {
+ UniLang uniLang;
+ MaskEnum maskEnum;
+ ISCIILang isciiLang;
+} LookupDataStruct;
+
+static const LookupDataStruct lookupInitialData[]={
+ { DEVANAGARI, DEV_MASK, DEV },
+ { BENGALI, BNG_MASK, BNG },
+ { GURMUKHI, PNJ_MASK, PNJ },
+ { GUJARATI, GJR_MASK, GJR },
+ { ORIYA, ORI_MASK, ORI },
+ { TAMIL, TML_MASK, TML },
+ { TELUGU, KND_MASK, TLG },
+ { KANNADA, KND_MASK, KND },
+ { MALAYALAM, MLM_MASK, MLM }
+};
+
+/*
+ * For special handling of certain Gurmukhi characters.
+ * Bit 0 (value 1): PNJ consonant
+ * Bit 1 (value 2): PNJ Bindi Tippi
+ */
+static const uint8_t pnjMap[80] = {
+ /* 0A00..0A0F */
+ 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0A10..0A1F */
+ 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ /* 0A20..0A2F */
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3,
+ /* 0A30..0A3F */
+ 3, 0, 0, 0, 0, 3, 3, 0, 3, 3, 0, 0, 0, 0, 0, 2,
+ /* 0A40..0A4F */
+ 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+static UBool
+isPNJConsonant(UChar32 c) {
+ if (c < 0xa00 || 0xa50 <= c) {
+ return FALSE;
+ } else {
+ return (UBool)(pnjMap[c - 0xa00] & 1);
+ }
+}
+
+static UBool
+isPNJBindiTippi(UChar32 c) {
+ if (c < 0xa00 || 0xa50 <= c) {
+ return FALSE;
+ } else {
+ return (UBool)(pnjMap[c - 0xa00] >> 1);
+ }
+}
+U_CDECL_BEGIN
+static void U_CALLCONV
+_ISCIIOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode) {
+ if(pArgs->onlyTestIsLoadable) {
+ return;
+ }
+
+ cnv->extraInfo = uprv_malloc(sizeof(UConverterDataISCII));
+
+ if (cnv->extraInfo != NULL) {
+ int32_t len=0;
+ UConverterDataISCII *converterData=
+ (UConverterDataISCII *) cnv->extraInfo;
+ converterData->contextCharToUnicode=NO_CHAR_MARKER;
+ cnv->toUnicodeStatus = missingCharMarker;
+ converterData->contextCharFromUnicode=0x0000;
+ converterData->resetToDefaultToUnicode=FALSE;
+ /* check if the version requested is supported */
+ if ((pArgs->options & UCNV_OPTIONS_VERSION_MASK) < 9) {
+ /* initialize state variables */
+ converterData->currentDeltaFromUnicode
+ = converterData->currentDeltaToUnicode
+ = converterData->defDeltaToUnicode = (uint16_t)(lookupInitialData[pArgs->options & UCNV_OPTIONS_VERSION_MASK].uniLang * DELTA);
+
+ converterData->currentMaskFromUnicode
+ = converterData->currentMaskToUnicode
+ = converterData->defMaskToUnicode = lookupInitialData[pArgs->options & UCNV_OPTIONS_VERSION_MASK].maskEnum;
+
+ converterData->isFirstBuffer=TRUE;
+ (void)uprv_strcpy(converterData->name, ISCII_CNV_PREFIX);
+ len = (int32_t)uprv_strlen(converterData->name);
+ converterData->name[len]= (char)((pArgs->options & UCNV_OPTIONS_VERSION_MASK) + '0');
+ converterData->name[len+1]=0;
+
+ converterData->prevToUnicodeStatus = 0x0000;
+ } else {
+ uprv_free(cnv->extraInfo);
+ cnv->extraInfo = NULL;
+ *errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ }
+
+ } else {
+ *errorCode =U_MEMORY_ALLOCATION_ERROR;
+ }
+}
+
+static void U_CALLCONV
+_ISCIIClose(UConverter *cnv) {
+ if (cnv->extraInfo!=NULL) {
+ if (!cnv->isExtraLocal) {
+ uprv_free(cnv->extraInfo);
+ }
+ cnv->extraInfo=NULL;
+ }
+}
+
+static const char* U_CALLCONV
+_ISCIIgetName(const UConverter* cnv) {
+ if (cnv->extraInfo) {
+ UConverterDataISCII* myData= (UConverterDataISCII*)cnv->extraInfo;
+ return myData->name;
+ }
+ return NULL;
+}
+
+static void U_CALLCONV
+_ISCIIReset(UConverter *cnv, UConverterResetChoice choice) {
+ UConverterDataISCII* data =(UConverterDataISCII *) (cnv->extraInfo);
+ if (choice<=UCNV_RESET_TO_UNICODE) {
+ cnv->toUnicodeStatus = missingCharMarker;
+ cnv->mode=0;
+ data->currentDeltaToUnicode=data->defDeltaToUnicode;
+ data->currentMaskToUnicode = data->defMaskToUnicode;
+ data->contextCharToUnicode=NO_CHAR_MARKER;
+ data->prevToUnicodeStatus = 0x0000;
+ }
+ if (choice!=UCNV_RESET_TO_UNICODE) {
+ cnv->fromUChar32=0x0000;
+ data->contextCharFromUnicode=0x00;
+ data->currentMaskFromUnicode=data->defMaskToUnicode;
+ data->currentDeltaFromUnicode=data->defDeltaToUnicode;
+ data->isFirstBuffer=TRUE;
+ data->resetToDefaultToUnicode=FALSE;
+ }
+}
+
+/**
+ * The values in validity table are indexed by the lower bits of Unicode
+ * range 0x0900 - 0x09ff. The values have a structure like:
+ * ---------------------------------------------------------------
+ * | DEV | PNJ | GJR | ORI | BNG | TLG | MLM | TML |
+ * | | | | | ASM | KND | | |
+ * ---------------------------------------------------------------
+ * If a code point is valid in a particular script
+ * then that bit is turned on
+ *
+ * Unicode does not distinguish between Bengali and Assamese so we use 1 bit for
+ * to represent these languages
+ *
+ * Telugu and Kannada have same codepoints except for Vocallic_RR which we special case
+ * and combine and use 1 bit to represent these languages.
+ *
+ * TODO: It is probably easier to understand and maintain to change this
+ * to use uint16_t and give each of the 9 Unicode/script blocks its own bit.
+ */
+
+static const uint8_t validityTable[128] = {
+/* This state table is tool generated please do not edit unless you know exactly what you are doing */
+/* Note: This table was edited to mirror the Windows XP implementation */
+/*ISCII:Valid:Unicode */
+/*0xa0 : 0x00: 0x900 */ ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0xa1 : 0xb8: 0x901 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + ZERO + ZERO + ZERO ,
+/*0xa2 : 0xfe: 0x902 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xa3 : 0xbf: 0x903 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0x00 : 0x00: 0x904 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0xa4 : 0xff: 0x905 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xa5 : 0xff: 0x906 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xa6 : 0xff: 0x907 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xa7 : 0xff: 0x908 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xa8 : 0xff: 0x909 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xa9 : 0xff: 0x90a */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xaa : 0xfe: 0x90b */ DEV_MASK + ZERO + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0x00 : 0x00: 0x90c */ DEV_MASK + ZERO + ZERO + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0xae : 0x80: 0x90d */ DEV_MASK + ZERO + GJR_MASK + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0xab : 0x87: 0x90e */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xac : 0xff: 0x90f */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xad : 0xff: 0x910 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xb2 : 0x80: 0x911 */ DEV_MASK + ZERO + GJR_MASK + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0xaf : 0x87: 0x912 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xb0 : 0xff: 0x913 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xb1 : 0xff: 0x914 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xb3 : 0xff: 0x915 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xb4 : 0xfe: 0x916 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0xb5 : 0xfe: 0x917 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0xb6 : 0xfe: 0x918 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0xb7 : 0xff: 0x919 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xb8 : 0xff: 0x91a */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xb9 : 0xfe: 0x91b */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0xba : 0xff: 0x91c */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xbb : 0xfe: 0x91d */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0xbc : 0xff: 0x91e */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xbd : 0xff: 0x91f */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xbe : 0xfe: 0x920 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0xbf : 0xfe: 0x921 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0xc0 : 0xfe: 0x922 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0xc1 : 0xff: 0x923 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xc2 : 0xff: 0x924 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xc3 : 0xfe: 0x925 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0xc4 : 0xfe: 0x926 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0xc5 : 0xfe: 0x927 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0xc6 : 0xff: 0x928 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xc7 : 0x81: 0x929 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + TML_MASK ,
+/*0xc8 : 0xff: 0x92a */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xc9 : 0xfe: 0x92b */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0xca : 0xfe: 0x92c */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0xcb : 0xfe: 0x92d */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0xcc : 0xfe: 0x92e */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xcd : 0xff: 0x92f */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xcf : 0xff: 0x930 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xd0 : 0x87: 0x931 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + MLM_MASK + TML_MASK ,
+/*0xd1 : 0xff: 0x932 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xd2 : 0xb7: 0x933 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + ZERO + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xd3 : 0x83: 0x934 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + MLM_MASK + TML_MASK ,
+/*0xd4 : 0xff: 0x935 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + ZERO + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xd5 : 0xfe: 0x936 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0xd6 : 0xbf: 0x937 */ DEV_MASK + ZERO + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xd7 : 0xff: 0x938 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xd8 : 0xff: 0x939 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0x00 : 0x00: 0x93A */ ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0x00 : 0x00: 0x93B */ ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0xe9 : 0xda: 0x93c */ DEV_MASK + PNJ_MASK + ZERO + ORI_MASK + BNG_MASK + ZERO + ZERO + ZERO ,
+/*0x00 : 0x00: 0x93d */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0xda : 0xff: 0x93e */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xdb : 0xff: 0x93f */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xdc : 0xff: 0x940 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xdd : 0xff: 0x941 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xde : 0xff: 0x942 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xdf : 0xbe: 0x943 */ DEV_MASK + ZERO + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0x00 : 0x00: 0x944 */ DEV_MASK + ZERO + GJR_MASK + ZERO + BNG_MASK + KND_MASK + ZERO + ZERO ,
+/*0xe3 : 0x80: 0x945 */ DEV_MASK + ZERO + GJR_MASK + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0xe0 : 0x87: 0x946 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xe1 : 0xff: 0x947 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xe2 : 0xff: 0x948 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xe7 : 0x80: 0x949 */ DEV_MASK + ZERO + GJR_MASK + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0xe4 : 0x87: 0x94a */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xe5 : 0xff: 0x94b */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xe6 : 0xff: 0x94c */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xe8 : 0xff: 0x94d */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xec : 0x00: 0x94e */ ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0xed : 0x00: 0x94f */ ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0x00 : 0x00: 0x950 */ DEV_MASK + ZERO + GJR_MASK + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0x00 : 0x00: 0x951 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0x00 : 0x00: 0x952 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0x00 : 0x00: 0x953 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0x00 : 0x00: 0x954 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0x00 : 0x00: 0x955 */ ZERO + ZERO + ZERO + ZERO + ZERO + KND_MASK + ZERO + ZERO ,
+/*0x00 : 0x00: 0x956 */ ZERO + ZERO + ZERO + ORI_MASK + ZERO + KND_MASK + ZERO + ZERO ,
+/*0x00 : 0x00: 0x957 */ ZERO + ZERO + ZERO + ORI_MASK + BNG_MASK + ZERO + MLM_MASK + ZERO ,
+/*0x00 : 0x00: 0x958 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0x00 : 0x00: 0x959 */ DEV_MASK + PNJ_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0x00 : 0x00: 0x95a */ DEV_MASK + PNJ_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0x00 : 0x00: 0x95b */ DEV_MASK + PNJ_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0x00 : 0x00: 0x95c */ DEV_MASK + PNJ_MASK + ZERO + ZERO + BNG_MASK + ZERO + ZERO + ZERO ,
+/*0x00 : 0x00: 0x95d */ DEV_MASK + ZERO + ZERO + ORI_MASK + BNG_MASK + ZERO + ZERO + ZERO ,
+/*0x00 : 0x00: 0x95e */ DEV_MASK + PNJ_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0xce : 0x98: 0x95f */ DEV_MASK + ZERO + ZERO + ORI_MASK + BNG_MASK + ZERO + ZERO + ZERO ,
+/*0x00 : 0x00: 0x960 */ DEV_MASK + ZERO + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0x00 : 0x00: 0x961 */ DEV_MASK + ZERO + ZERO + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + ZERO ,
+/*0x00 : 0x00: 0x962 */ DEV_MASK + ZERO + ZERO + ZERO + BNG_MASK + ZERO + ZERO + ZERO ,
+/*0x00 : 0x00: 0x963 */ DEV_MASK + ZERO + ZERO + ZERO + BNG_MASK + ZERO + ZERO + ZERO ,
+/*0xea : 0xf8: 0x964 */ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0xeaea : 0x00: 0x965*/ DEV_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*0xf1 : 0xff: 0x966 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xf2 : 0xff: 0x967 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xf3 : 0xff: 0x968 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xf4 : 0xff: 0x969 */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xf5 : 0xff: 0x96a */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xf6 : 0xff: 0x96b */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xf7 : 0xff: 0x96c */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xf8 : 0xff: 0x96d */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xf9 : 0xff: 0x96e */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0xfa : 0xff: 0x96f */ DEV_MASK + PNJ_MASK + GJR_MASK + ORI_MASK + BNG_MASK + KND_MASK + MLM_MASK + TML_MASK ,
+/*0x00 : 0x80: 0x970 */ DEV_MASK + PNJ_MASK + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO ,
+/*
+ * The length of the array is 128 to provide values for 0x900..0x97f.
+ * The last 15 entries for 0x971..0x97f of the validity table are all zero
+ * because no Indic script uses such Unicode code points.
+ */
+/*0x00 : 0x00: 0x9yz */ ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO + ZERO
+};
+
+static const uint16_t fromUnicodeTable[128]={
+ 0x00a0 ,/* 0x0900 */
+ 0x00a1 ,/* 0x0901 */
+ 0x00a2 ,/* 0x0902 */
+ 0x00a3 ,/* 0x0903 */
+ 0xa4e0 ,/* 0x0904 */
+ 0x00a4 ,/* 0x0905 */
+ 0x00a5 ,/* 0x0906 */
+ 0x00a6 ,/* 0x0907 */
+ 0x00a7 ,/* 0x0908 */
+ 0x00a8 ,/* 0x0909 */
+ 0x00a9 ,/* 0x090a */
+ 0x00aa ,/* 0x090b */
+ 0xA6E9 ,/* 0x090c */
+ 0x00ae ,/* 0x090d */
+ 0x00ab ,/* 0x090e */
+ 0x00ac ,/* 0x090f */
+ 0x00ad ,/* 0x0910 */
+ 0x00b2 ,/* 0x0911 */
+ 0x00af ,/* 0x0912 */
+ 0x00b0 ,/* 0x0913 */
+ 0x00b1 ,/* 0x0914 */
+ 0x00b3 ,/* 0x0915 */
+ 0x00b4 ,/* 0x0916 */
+ 0x00b5 ,/* 0x0917 */
+ 0x00b6 ,/* 0x0918 */
+ 0x00b7 ,/* 0x0919 */
+ 0x00b8 ,/* 0x091a */
+ 0x00b9 ,/* 0x091b */
+ 0x00ba ,/* 0x091c */
+ 0x00bb ,/* 0x091d */
+ 0x00bc ,/* 0x091e */
+ 0x00bd ,/* 0x091f */
+ 0x00be ,/* 0x0920 */
+ 0x00bf ,/* 0x0921 */
+ 0x00c0 ,/* 0x0922 */
+ 0x00c1 ,/* 0x0923 */
+ 0x00c2 ,/* 0x0924 */
+ 0x00c3 ,/* 0x0925 */
+ 0x00c4 ,/* 0x0926 */
+ 0x00c5 ,/* 0x0927 */
+ 0x00c6 ,/* 0x0928 */
+ 0x00c7 ,/* 0x0929 */
+ 0x00c8 ,/* 0x092a */
+ 0x00c9 ,/* 0x092b */
+ 0x00ca ,/* 0x092c */
+ 0x00cb ,/* 0x092d */
+ 0x00cc ,/* 0x092e */
+ 0x00cd ,/* 0x092f */
+ 0x00cf ,/* 0x0930 */
+ 0x00d0 ,/* 0x0931 */
+ 0x00d1 ,/* 0x0932 */
+ 0x00d2 ,/* 0x0933 */
+ 0x00d3 ,/* 0x0934 */
+ 0x00d4 ,/* 0x0935 */
+ 0x00d5 ,/* 0x0936 */
+ 0x00d6 ,/* 0x0937 */
+ 0x00d7 ,/* 0x0938 */
+ 0x00d8 ,/* 0x0939 */
+ 0xFFFF ,/* 0x093A */
+ 0xFFFF ,/* 0x093B */
+ 0x00e9 ,/* 0x093c */
+ 0xEAE9 ,/* 0x093d */
+ 0x00da ,/* 0x093e */
+ 0x00db ,/* 0x093f */
+ 0x00dc ,/* 0x0940 */
+ 0x00dd ,/* 0x0941 */
+ 0x00de ,/* 0x0942 */
+ 0x00df ,/* 0x0943 */
+ 0xDFE9 ,/* 0x0944 */
+ 0x00e3 ,/* 0x0945 */
+ 0x00e0 ,/* 0x0946 */
+ 0x00e1 ,/* 0x0947 */
+ 0x00e2 ,/* 0x0948 */
+ 0x00e7 ,/* 0x0949 */
+ 0x00e4 ,/* 0x094a */
+ 0x00e5 ,/* 0x094b */
+ 0x00e6 ,/* 0x094c */
+ 0x00e8 ,/* 0x094d */
+ 0x00ec ,/* 0x094e */
+ 0x00ed ,/* 0x094f */
+ 0xA1E9 ,/* 0x0950 */ /* OM Symbol */
+ 0xFFFF ,/* 0x0951 */
+ 0xF0B8 ,/* 0x0952 */
+ 0xFFFF ,/* 0x0953 */
+ 0xFFFF ,/* 0x0954 */
+ 0xFFFF ,/* 0x0955 */
+ 0xFFFF ,/* 0x0956 */
+ 0xFFFF ,/* 0x0957 */
+ 0xb3e9 ,/* 0x0958 */
+ 0xb4e9 ,/* 0x0959 */
+ 0xb5e9 ,/* 0x095a */
+ 0xbae9 ,/* 0x095b */
+ 0xbfe9 ,/* 0x095c */
+ 0xC0E9 ,/* 0x095d */
+ 0xc9e9 ,/* 0x095e */
+ 0x00ce ,/* 0x095f */
+ 0xAAe9 ,/* 0x0960 */
+ 0xA7E9 ,/* 0x0961 */
+ 0xDBE9 ,/* 0x0962 */
+ 0xDCE9 ,/* 0x0963 */
+ 0x00ea ,/* 0x0964 */
+ 0xeaea ,/* 0x0965 */
+ 0x00f1 ,/* 0x0966 */
+ 0x00f2 ,/* 0x0967 */
+ 0x00f3 ,/* 0x0968 */
+ 0x00f4 ,/* 0x0969 */
+ 0x00f5 ,/* 0x096a */
+ 0x00f6 ,/* 0x096b */
+ 0x00f7 ,/* 0x096c */
+ 0x00f8 ,/* 0x096d */
+ 0x00f9 ,/* 0x096e */
+ 0x00fa ,/* 0x096f */
+ 0xF0BF ,/* 0x0970 */
+ 0xFFFF ,/* 0x0971 */
+ 0xFFFF ,/* 0x0972 */
+ 0xFFFF ,/* 0x0973 */
+ 0xFFFF ,/* 0x0974 */
+ 0xFFFF ,/* 0x0975 */
+ 0xFFFF ,/* 0x0976 */
+ 0xFFFF ,/* 0x0977 */
+ 0xFFFF ,/* 0x0978 */
+ 0xFFFF ,/* 0x0979 */
+ 0xFFFF ,/* 0x097a */
+ 0xFFFF ,/* 0x097b */
+ 0xFFFF ,/* 0x097c */
+ 0xFFFF ,/* 0x097d */
+ 0xFFFF ,/* 0x097e */
+ 0xFFFF ,/* 0x097f */
+};
+static const uint16_t toUnicodeTable[256]={
+ 0x0000,/* 0x00 */
+ 0x0001,/* 0x01 */
+ 0x0002,/* 0x02 */
+ 0x0003,/* 0x03 */
+ 0x0004,/* 0x04 */
+ 0x0005,/* 0x05 */
+ 0x0006,/* 0x06 */
+ 0x0007,/* 0x07 */
+ 0x0008,/* 0x08 */
+ 0x0009,/* 0x09 */
+ 0x000a,/* 0x0a */
+ 0x000b,/* 0x0b */
+ 0x000c,/* 0x0c */
+ 0x000d,/* 0x0d */
+ 0x000e,/* 0x0e */
+ 0x000f,/* 0x0f */
+ 0x0010,/* 0x10 */
+ 0x0011,/* 0x11 */
+ 0x0012,/* 0x12 */
+ 0x0013,/* 0x13 */
+ 0x0014,/* 0x14 */
+ 0x0015,/* 0x15 */
+ 0x0016,/* 0x16 */
+ 0x0017,/* 0x17 */
+ 0x0018,/* 0x18 */
+ 0x0019,/* 0x19 */
+ 0x001a,/* 0x1a */
+ 0x001b,/* 0x1b */
+ 0x001c,/* 0x1c */
+ 0x001d,/* 0x1d */
+ 0x001e,/* 0x1e */
+ 0x001f,/* 0x1f */
+ 0x0020,/* 0x20 */
+ 0x0021,/* 0x21 */
+ 0x0022,/* 0x22 */
+ 0x0023,/* 0x23 */
+ 0x0024,/* 0x24 */
+ 0x0025,/* 0x25 */
+ 0x0026,/* 0x26 */
+ 0x0027,/* 0x27 */
+ 0x0028,/* 0x28 */
+ 0x0029,/* 0x29 */
+ 0x002a,/* 0x2a */
+ 0x002b,/* 0x2b */
+ 0x002c,/* 0x2c */
+ 0x002d,/* 0x2d */
+ 0x002e,/* 0x2e */
+ 0x002f,/* 0x2f */
+ 0x0030,/* 0x30 */
+ 0x0031,/* 0x31 */
+ 0x0032,/* 0x32 */
+ 0x0033,/* 0x33 */
+ 0x0034,/* 0x34 */
+ 0x0035,/* 0x35 */
+ 0x0036,/* 0x36 */
+ 0x0037,/* 0x37 */
+ 0x0038,/* 0x38 */
+ 0x0039,/* 0x39 */
+ 0x003A,/* 0x3A */
+ 0x003B,/* 0x3B */
+ 0x003c,/* 0x3c */
+ 0x003d,/* 0x3d */
+ 0x003e,/* 0x3e */
+ 0x003f,/* 0x3f */
+ 0x0040,/* 0x40 */
+ 0x0041,/* 0x41 */
+ 0x0042,/* 0x42 */
+ 0x0043,/* 0x43 */
+ 0x0044,/* 0x44 */
+ 0x0045,/* 0x45 */
+ 0x0046,/* 0x46 */
+ 0x0047,/* 0x47 */
+ 0x0048,/* 0x48 */
+ 0x0049,/* 0x49 */
+ 0x004a,/* 0x4a */
+ 0x004b,/* 0x4b */
+ 0x004c,/* 0x4c */
+ 0x004d,/* 0x4d */
+ 0x004e,/* 0x4e */
+ 0x004f,/* 0x4f */
+ 0x0050,/* 0x50 */
+ 0x0051,/* 0x51 */
+ 0x0052,/* 0x52 */
+ 0x0053,/* 0x53 */
+ 0x0054,/* 0x54 */
+ 0x0055,/* 0x55 */
+ 0x0056,/* 0x56 */
+ 0x0057,/* 0x57 */
+ 0x0058,/* 0x58 */
+ 0x0059,/* 0x59 */
+ 0x005a,/* 0x5a */
+ 0x005b,/* 0x5b */
+ 0x005c,/* 0x5c */
+ 0x005d,/* 0x5d */
+ 0x005e,/* 0x5e */
+ 0x005f,/* 0x5f */
+ 0x0060,/* 0x60 */
+ 0x0061,/* 0x61 */
+ 0x0062,/* 0x62 */
+ 0x0063,/* 0x63 */
+ 0x0064,/* 0x64 */
+ 0x0065,/* 0x65 */
+ 0x0066,/* 0x66 */
+ 0x0067,/* 0x67 */
+ 0x0068,/* 0x68 */
+ 0x0069,/* 0x69 */
+ 0x006a,/* 0x6a */
+ 0x006b,/* 0x6b */
+ 0x006c,/* 0x6c */
+ 0x006d,/* 0x6d */
+ 0x006e,/* 0x6e */
+ 0x006f,/* 0x6f */
+ 0x0070,/* 0x70 */
+ 0x0071,/* 0x71 */
+ 0x0072,/* 0x72 */
+ 0x0073,/* 0x73 */
+ 0x0074,/* 0x74 */
+ 0x0075,/* 0x75 */
+ 0x0076,/* 0x76 */
+ 0x0077,/* 0x77 */
+ 0x0078,/* 0x78 */
+ 0x0079,/* 0x79 */
+ 0x007a,/* 0x7a */
+ 0x007b,/* 0x7b */
+ 0x007c,/* 0x7c */
+ 0x007d,/* 0x7d */
+ 0x007e,/* 0x7e */
+ 0x007f,/* 0x7f */
+ 0x0080,/* 0x80 */
+ 0x0081,/* 0x81 */
+ 0x0082,/* 0x82 */
+ 0x0083,/* 0x83 */
+ 0x0084,/* 0x84 */
+ 0x0085,/* 0x85 */
+ 0x0086,/* 0x86 */
+ 0x0087,/* 0x87 */
+ 0x0088,/* 0x88 */
+ 0x0089,/* 0x89 */
+ 0x008a,/* 0x8a */
+ 0x008b,/* 0x8b */
+ 0x008c,/* 0x8c */
+ 0x008d,/* 0x8d */
+ 0x008e,/* 0x8e */
+ 0x008f,/* 0x8f */
+ 0x0090,/* 0x90 */
+ 0x0091,/* 0x91 */
+ 0x0092,/* 0x92 */
+ 0x0093,/* 0x93 */
+ 0x0094,/* 0x94 */
+ 0x0095,/* 0x95 */
+ 0x0096,/* 0x96 */
+ 0x0097,/* 0x97 */
+ 0x0098,/* 0x98 */
+ 0x0099,/* 0x99 */
+ 0x009a,/* 0x9a */
+ 0x009b,/* 0x9b */
+ 0x009c,/* 0x9c */
+ 0x009d,/* 0x9d */
+ 0x009e,/* 0x9e */
+ 0x009f,/* 0x9f */
+ 0x00A0,/* 0xa0 */
+ 0x0901,/* 0xa1 */
+ 0x0902,/* 0xa2 */
+ 0x0903,/* 0xa3 */
+ 0x0905,/* 0xa4 */
+ 0x0906,/* 0xa5 */
+ 0x0907,/* 0xa6 */
+ 0x0908,/* 0xa7 */
+ 0x0909,/* 0xa8 */
+ 0x090a,/* 0xa9 */
+ 0x090b,/* 0xaa */
+ 0x090e,/* 0xab */
+ 0x090f,/* 0xac */
+ 0x0910,/* 0xad */
+ 0x090d,/* 0xae */
+ 0x0912,/* 0xaf */
+ 0x0913,/* 0xb0 */
+ 0x0914,/* 0xb1 */
+ 0x0911,/* 0xb2 */
+ 0x0915,/* 0xb3 */
+ 0x0916,/* 0xb4 */
+ 0x0917,/* 0xb5 */
+ 0x0918,/* 0xb6 */
+ 0x0919,/* 0xb7 */
+ 0x091a,/* 0xb8 */
+ 0x091b,/* 0xb9 */
+ 0x091c,/* 0xba */
+ 0x091d,/* 0xbb */
+ 0x091e,/* 0xbc */
+ 0x091f,/* 0xbd */
+ 0x0920,/* 0xbe */
+ 0x0921,/* 0xbf */
+ 0x0922,/* 0xc0 */
+ 0x0923,/* 0xc1 */
+ 0x0924,/* 0xc2 */
+ 0x0925,/* 0xc3 */
+ 0x0926,/* 0xc4 */
+ 0x0927,/* 0xc5 */
+ 0x0928,/* 0xc6 */
+ 0x0929,/* 0xc7 */
+ 0x092a,/* 0xc8 */
+ 0x092b,/* 0xc9 */
+ 0x092c,/* 0xca */
+ 0x092d,/* 0xcb */
+ 0x092e,/* 0xcc */
+ 0x092f,/* 0xcd */
+ 0x095f,/* 0xce */
+ 0x0930,/* 0xcf */
+ 0x0931,/* 0xd0 */
+ 0x0932,/* 0xd1 */
+ 0x0933,/* 0xd2 */
+ 0x0934,/* 0xd3 */
+ 0x0935,/* 0xd4 */
+ 0x0936,/* 0xd5 */
+ 0x0937,/* 0xd6 */
+ 0x0938,/* 0xd7 */
+ 0x0939,/* 0xd8 */
+ 0x200D,/* 0xd9 */
+ 0x093e,/* 0xda */
+ 0x093f,/* 0xdb */
+ 0x0940,/* 0xdc */
+ 0x0941,/* 0xdd */
+ 0x0942,/* 0xde */
+ 0x0943,/* 0xdf */
+ 0x0946,/* 0xe0 */
+ 0x0947,/* 0xe1 */
+ 0x0948,/* 0xe2 */
+ 0x0945,/* 0xe3 */
+ 0x094a,/* 0xe4 */
+ 0x094b,/* 0xe5 */
+ 0x094c,/* 0xe6 */
+ 0x0949,/* 0xe7 */
+ 0x094d,/* 0xe8 */
+ 0x093c,/* 0xe9 */
+ 0x0964,/* 0xea */
+ 0xFFFF,/* 0xeb */
+ 0xFFFF,/* 0xec */
+ 0xFFFF,/* 0xed */
+ 0xFFFF,/* 0xee */
+ 0xFFFF,/* 0xef */
+ 0xFFFF,/* 0xf0 */
+ 0x0966,/* 0xf1 */
+ 0x0967,/* 0xf2 */
+ 0x0968,/* 0xf3 */
+ 0x0969,/* 0xf4 */
+ 0x096a,/* 0xf5 */
+ 0x096b,/* 0xf6 */
+ 0x096c,/* 0xf7 */
+ 0x096d,/* 0xf8 */
+ 0x096e,/* 0xf9 */
+ 0x096f,/* 0xfa */
+ 0xFFFF,/* 0xfb */
+ 0xFFFF,/* 0xfc */
+ 0xFFFF,/* 0xfd */
+ 0xFFFF,/* 0xfe */
+ 0xFFFF /* 0xff */
+};
+
+static const uint16_t vowelSignESpecialCases[][2]={
+ { 2 /*length of array*/ , 0 },
+ { 0xA4 , 0x0904 },
+};
+
+static const uint16_t nuktaSpecialCases[][2]={
+ { 16 /*length of array*/ , 0 },
+ { 0xA6 , 0x090c },
+ { 0xEA , 0x093D },
+ { 0xDF , 0x0944 },
+ { 0xA1 , 0x0950 },
+ { 0xb3 , 0x0958 },
+ { 0xb4 , 0x0959 },
+ { 0xb5 , 0x095a },
+ { 0xba , 0x095b },
+ { 0xbf , 0x095c },
+ { 0xC0 , 0x095d },
+ { 0xc9 , 0x095e },
+ { 0xAA , 0x0960 },
+ { 0xA7 , 0x0961 },
+ { 0xDB , 0x0962 },
+ { 0xDC , 0x0963 },
+};
+
+
+#define WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,targetByteUnit,err) UPRV_BLOCK_MACRO_BEGIN { \
+ int32_t offset = (int32_t)(source - args->source-1); \
+ /* write the targetUniChar to target */ \
+ if(target < targetLimit){ \
+ if(targetByteUnit <= 0xFF){ \
+ *(target)++ = (uint8_t)(targetByteUnit); \
+ if(offsets){ \
+ *(offsets++) = offset; \
+ } \
+ }else{ \
+ if (targetByteUnit > 0xFFFF) { \
+ *(target)++ = (uint8_t)(targetByteUnit>>16); \
+ if (offsets) { \
+ --offset; \
+ *(offsets++) = offset; \
+ } \
+ } \
+ if (!(target < targetLimit)) { \
+ args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = \
+ (uint8_t)(targetByteUnit >> 8); \
+ args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = \
+ (uint8_t)targetByteUnit; \
+ *err = U_BUFFER_OVERFLOW_ERROR; \
+ } else { \
+ *(target)++ = (uint8_t)(targetByteUnit>>8); \
+ if(offsets){ \
+ *(offsets++) = offset; \
+ } \
+ if(target < targetLimit){ \
+ *(target)++ = (uint8_t) targetByteUnit; \
+ if(offsets){ \
+ *(offsets++) = offset ; \
+ } \
+ }else{ \
+ args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] =\
+ (uint8_t) (targetByteUnit); \
+ *err = U_BUFFER_OVERFLOW_ERROR; \
+ } \
+ } \
+ } \
+ }else{ \
+ if (targetByteUnit & 0xFF0000) { \
+ args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = \
+ (uint8_t) (targetByteUnit >>16); \
+ } \
+ if(targetByteUnit & 0xFF00){ \
+ args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = \
+ (uint8_t) (targetByteUnit >>8); \
+ } \
+ args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = \
+ (uint8_t) (targetByteUnit); \
+ *err = U_BUFFER_OVERFLOW_ERROR; \
+ } \
+} UPRV_BLOCK_MACRO_END
+
+/* Rules:
+ * Explicit Halant :
+ * <HALANT> + <ZWNJ>
+ * Soft Halant :
+ * <HALANT> + <ZWJ>
+ */
+static void U_CALLCONV
+UConverter_fromUnicode_ISCII_OFFSETS_LOGIC(
+ UConverterFromUnicodeArgs * args, UErrorCode * err) {
+ const UChar *source = args->source;
+ const UChar *sourceLimit = args->sourceLimit;
+ unsigned char *target = (unsigned char *) args->target;
+ unsigned char *targetLimit = (unsigned char *) args->targetLimit;
+ int32_t* offsets = args->offsets;
+ uint32_t targetByteUnit = 0x0000;
+ UChar32 sourceChar = 0x0000;
+ UChar32 tempContextFromUnicode = 0x0000; /* For special handling of the Gurmukhi script. */
+ UConverterDataISCII *converterData;
+ uint16_t newDelta=0;
+ uint16_t range = 0;
+ UBool deltaChanged = FALSE;
+
+ if ((args->converter == NULL) || (args->targetLimit < args->target) || (args->sourceLimit < args->source)) {
+ *err = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ /* initialize data */
+ converterData=(UConverterDataISCII*)args->converter->extraInfo;
+ newDelta=converterData->currentDeltaFromUnicode;
+ range = (uint16_t)(newDelta/DELTA);
+
+ if ((sourceChar = args->converter->fromUChar32)!=0) {
+ goto getTrail;
+ }
+
+ /*writing the char to the output stream */
+ while (source < sourceLimit) {
+ /* Write the language code following LF only if LF is not the last character. */
+ if (args->converter->fromUnicodeStatus == LF) {
+ targetByteUnit = ATR<<8;
+ targetByteUnit += (uint8_t) lookupInitialData[range].isciiLang;
+ args->converter->fromUnicodeStatus = 0x0000;
+ /* now append ATR and language code */
+ WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,targetByteUnit,err);
+ if (U_FAILURE(*err)) {
+ break;
+ }
+ }
+
+ sourceChar = *source++;
+ tempContextFromUnicode = converterData->contextCharFromUnicode;
+
+ targetByteUnit = missingCharMarker;
+
+ /*check if input is in ASCII and C0 control codes range*/
+ if (sourceChar <= ASCII_END) {
+ args->converter->fromUnicodeStatus = sourceChar;
+ WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,sourceChar,err);
+ if (U_FAILURE(*err)) {
+ break;
+ }
+ continue;
+ }
+ switch (sourceChar) {
+ case ZWNJ:
+ /* contextChar has HALANT */
+ if (converterData->contextCharFromUnicode) {
+ converterData->contextCharFromUnicode = 0x00;
+ targetByteUnit = ISCII_HALANT;
+ } else {
+ /* consume ZWNJ and continue */
+ converterData->contextCharFromUnicode = 0x00;
+ continue;
+ }
+ break;
+ case ZWJ:
+ /* contextChar has HALANT */
+ if (converterData->contextCharFromUnicode) {
+ targetByteUnit = ISCII_NUKTA;
+ } else {
+ targetByteUnit =ISCII_INV;
+ }
+ converterData->contextCharFromUnicode = 0x00;
+ break;
+ default:
+ /* is the sourceChar in the INDIC_RANGE? */
+ if ((uint16_t)(INDIC_BLOCK_END-sourceChar) <= INDIC_RANGE) {
+ /* Danda and Double Danda are valid in Northern scripts.. since Unicode
+ * does not include these codepoints in all Northern scrips we need to
+ * filter them out
+ */
+ if (sourceChar!= DANDA && sourceChar != DOUBLE_DANDA) {
+ /* find out to which block the souceChar belongs*/
+ range =(uint16_t)((sourceChar-INDIC_BLOCK_BEGIN)/DELTA);
+ newDelta =(uint16_t)(range*DELTA);
+
+ /* Now are we in the same block as the previous? */
+ if (newDelta!= converterData->currentDeltaFromUnicode || converterData->isFirstBuffer) {
+ converterData->currentDeltaFromUnicode = newDelta;
+ converterData->currentMaskFromUnicode = lookupInitialData[range].maskEnum;
+ deltaChanged =TRUE;
+ converterData->isFirstBuffer=FALSE;
+ }
+
+ if (converterData->currentDeltaFromUnicode == PNJ_DELTA) {
+ if (sourceChar == PNJ_TIPPI) {
+ /* Make sure Tippi is converterd to Bindi. */
+ sourceChar = PNJ_BINDI;
+ } else if (sourceChar == PNJ_ADHAK) {
+ /* This is for consonant cluster handling. */
+ converterData->contextCharFromUnicode = PNJ_ADHAK;
+ }
+
+ }
+ /* Normalize all Indic codepoints to Devanagari and map them to ISCII */
+ /* now subtract the new delta from sourceChar*/
+ sourceChar -= converterData->currentDeltaFromUnicode;
+ }
+
+ /* get the target byte unit */
+ targetByteUnit=fromUnicodeTable[(uint8_t)sourceChar];
+
+ /* is the code point valid in current script? */
+ if ((validityTable[(uint8_t)sourceChar] & converterData->currentMaskFromUnicode)==0) {
+ /* Vocallic RR is assigned in ISCII Telugu and Unicode */
+ if (converterData->currentDeltaFromUnicode!=(TELUGU_DELTA) || sourceChar!=VOCALLIC_RR) {
+ targetByteUnit=missingCharMarker;
+ }
+ }
+
+ if (deltaChanged) {
+ /* we are in a script block which is different than
+ * previous sourceChar's script block write ATR and language codes
+ */
+ uint32_t temp=0;
+ temp =(uint16_t)(ATR<<8);
+ temp += (uint16_t)((uint8_t) lookupInitialData[range].isciiLang);
+ /* reset */
+ deltaChanged=FALSE;
+ /* now append ATR and language code */
+ WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,temp,err);
+ if (U_FAILURE(*err)) {
+ break;
+ }
+ }
+
+ if (converterData->currentDeltaFromUnicode == PNJ_DELTA && (sourceChar + PNJ_DELTA) == PNJ_ADHAK) {
+ continue;
+ }
+ }
+ /* reset context char */
+ converterData->contextCharFromUnicode = 0x00;
+ break;
+ }
+ if (converterData->currentDeltaFromUnicode == PNJ_DELTA && tempContextFromUnicode == PNJ_ADHAK && isPNJConsonant((sourceChar + PNJ_DELTA))) {
+ /* If the previous codepoint is Adhak and the current codepoint is a consonant, the targetByteUnit should be C + Halant + C. */
+ /* reset context char */
+ converterData->contextCharFromUnicode = 0x0000;
+ targetByteUnit = targetByteUnit << 16 | ISCII_HALANT << 8 | targetByteUnit;
+ /* write targetByteUnit to target */
+ WRITE_TO_TARGET_FROM_U(args, offsets, source, target, targetLimit, targetByteUnit,err);
+ if (U_FAILURE(*err)) {
+ break;
+ }
+ } else if (targetByteUnit != missingCharMarker) {
+ if (targetByteUnit==ISCII_HALANT) {
+ converterData->contextCharFromUnicode = (UChar)targetByteUnit;
+ }
+ /* write targetByteUnit to target*/
+ WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,targetByteUnit,err);
+ if (U_FAILURE(*err)) {
+ break;
+ }
+ } else {
+ /* oops.. the code point is unassigned */
+ /*check if the char is a First surrogate*/
+ if (U16_IS_SURROGATE(sourceChar)) {
+ if (U16_IS_SURROGATE_LEAD(sourceChar)) {
+getTrail:
+ /*look ahead to find the trail surrogate*/
+ if (source < sourceLimit) {
+ /* test the following code unit */
+ UChar trail= (*source);
+ if (U16_IS_TRAIL(trail)) {
+ source++;
+ sourceChar=U16_GET_SUPPLEMENTARY(sourceChar, trail);
+ *err =U_INVALID_CHAR_FOUND;
+ /* convert this surrogate code point */
+ /* exit this condition tree */
+ } else {
+ /* this is an unmatched lead code unit (1st surrogate) */
+ /* callback(illegal) */
+ *err=U_ILLEGAL_CHAR_FOUND;
+ }
+ } else {
+ /* no more input */
+ *err = U_ZERO_ERROR;
+ }
+ } else {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ *err=U_ILLEGAL_CHAR_FOUND;
+ }
+ } else {
+ /* callback(unassigned) for a BMP code point */
+ *err = U_INVALID_CHAR_FOUND;
+ }
+
+ args->converter->fromUChar32=sourceChar;
+ break;
+ }
+ }/* end while(mySourceIndex<mySourceLength) */
+
+ /*save the state and return */
+ args->source = source;
+ args->target = (char*)target;
+}
+
+static const uint16_t lookupTable[][2]={
+ { ZERO, ZERO }, /*DEFALT*/
+ { ZERO, ZERO }, /*ROMAN*/
+ { DEVANAGARI, DEV_MASK },
+ { BENGALI, BNG_MASK },
+ { TAMIL, TML_MASK },
+ { TELUGU, KND_MASK },
+ { BENGALI, BNG_MASK },
+ { ORIYA, ORI_MASK },
+ { KANNADA, KND_MASK },
+ { MALAYALAM, MLM_MASK },
+ { GUJARATI, GJR_MASK },
+ { GURMUKHI, PNJ_MASK }
+};
+
+#define WRITE_TO_TARGET_TO_U(args,source,target,offsets,offset,targetUniChar,delta, err) UPRV_BLOCK_MACRO_BEGIN { \
+ /* add offset to current Indic Block */ \
+ if(targetUniChar>ASCII_END && \
+ targetUniChar != ZWJ && \
+ targetUniChar != ZWNJ && \
+ targetUniChar != DANDA && \
+ targetUniChar != DOUBLE_DANDA){ \
+ \
+ targetUniChar+=(uint16_t)(delta); \
+ } \
+ /* now write the targetUniChar */ \
+ if(target<args->targetLimit){ \
+ *(target)++ = (UChar)targetUniChar; \
+ if(offsets){ \
+ *(offsets)++ = (int32_t)(offset); \
+ } \
+ }else{ \
+ args->converter->UCharErrorBuffer[args->converter->UCharErrorBufferLength++] = \
+ (UChar)targetUniChar; \
+ *err = U_BUFFER_OVERFLOW_ERROR; \
+ } \
+} UPRV_BLOCK_MACRO_END
+
+#define GET_MAPPING(sourceChar,targetUniChar,data) UPRV_BLOCK_MACRO_BEGIN { \
+ targetUniChar = toUnicodeTable[(sourceChar)] ; \
+ /* is the code point valid in current script? */ \
+ if(sourceChar> ASCII_END && \
+ (validityTable[(targetUniChar & 0x7F)] & data->currentMaskToUnicode)==0){ \
+ /* Vocallic RR is assigne in ISCII Telugu and Unicode */ \
+ if(data->currentDeltaToUnicode!=(TELUGU_DELTA) || \
+ targetUniChar!=VOCALLIC_RR){ \
+ targetUniChar=missingCharMarker; \
+ } \
+ } \
+} UPRV_BLOCK_MACRO_END
+
+/***********
+ * Rules for ISCII to Unicode converter
+ * ISCII is stateful encoding. To convert ISCII bytes to Unicode,
+ * which has both precomposed and decomposed forms characters
+ * pre-context and post-context need to be considered.
+ *
+ * Post context
+ * i) ATR : Attribute code is used to declare the font and script switching.
+ * Currently we only switch scripts and font codes consumed without generating an error
+ * ii) EXT : Extention code is used to declare switching to Sanskrit and for obscure,
+ * obsolete characters
+ * Pre context
+ * i) Halant: if preceeded by a halant then it is a explicit halant
+ * ii) Nukta :
+ * a) if preceeded by a halant then it is a soft halant
+ * b) if preceeded by specific consonants and the ligatures have pre-composed
+ * characters in Unicode then convert to pre-composed characters
+ * iii) Danda: If Danda is preceeded by a Danda then convert to Double Danda
+ *
+ */
+
+static void U_CALLCONV
+UConverter_toUnicode_ISCII_OFFSETS_LOGIC(UConverterToUnicodeArgs *args, UErrorCode* err) {
+ const char *source = ( char *) args->source;
+ UChar *target = args->target;
+ const char *sourceLimit = args->sourceLimit;
+ const UChar* targetLimit = args->targetLimit;
+ uint32_t targetUniChar = 0x0000;
+ uint8_t sourceChar = 0x0000;
+ UConverterDataISCII* data;
+ UChar32* toUnicodeStatus=NULL;
+ UChar32 tempTargetUniChar = 0x0000;
+ UChar* contextCharToUnicode= NULL;
+ UBool found;
+ int i;
+ int offset = 0;
+
+ if ((args->converter == NULL) || (target < args->target) || (source < args->source)) {
+ *err = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ data = (UConverterDataISCII*)(args->converter->extraInfo);
+ contextCharToUnicode = &data->contextCharToUnicode; /* contains previous ISCII codepoint visited */
+ toUnicodeStatus = (UChar32*)&args->converter->toUnicodeStatus;/* contains the mapping to Unicode of the above codepoint*/
+
+ while (U_SUCCESS(*err) && source<sourceLimit) {
+
+ targetUniChar = missingCharMarker;
+
+ if (target < targetLimit) {
+ sourceChar = (unsigned char)*(source)++;
+
+ /* look at the post-context preform special processing */
+ if (*contextCharToUnicode==ATR) {
+
+ /* If we have ATR in *contextCharToUnicode then we need to change our
+ * state to the Indic Script specified by sourceChar
+ */
+
+ /* check if the sourceChar is supported script range*/
+ if ((uint8_t)(PNJ-sourceChar)<=PNJ-DEV) {
+ data->currentDeltaToUnicode = (uint16_t)(lookupTable[sourceChar & 0x0F][0] * DELTA);
+ data->currentMaskToUnicode = (MaskEnum)lookupTable[sourceChar & 0x0F][1];
+ } else if (sourceChar==DEF) {
+ /* switch back to default */
+ data->currentDeltaToUnicode = data->defDeltaToUnicode;
+ data->currentMaskToUnicode = data->defMaskToUnicode;
+ } else {
+ if ((sourceChar >= 0x21 && sourceChar <= 0x3F)) {
+ /* these are display codes consume and continue */
+ } else {
+ *err =U_ILLEGAL_CHAR_FOUND;
+ /* reset */
+ *contextCharToUnicode=NO_CHAR_MARKER;
+ goto CALLBACK;
+ }
+ }
+
+ /* reset */
+ *contextCharToUnicode=NO_CHAR_MARKER;
+
+ continue;
+
+ } else if (*contextCharToUnicode==EXT) {
+ /* check if sourceChar is in 0xA1-0xEE range */
+ if ((uint8_t) (EXT_RANGE_END - sourceChar) <= (EXT_RANGE_END - EXT_RANGE_BEGIN)) {
+ /* We currently support only Anudatta and Devanagari abbreviation sign */
+ if (sourceChar==0xBF || sourceChar == 0xB8) {
+ targetUniChar = (sourceChar==0xBF) ? DEV_ABBR_SIGN : DEV_ANUDATTA;
+
+ /* find out if the mapping is valid in this state */
+ if (validityTable[(uint8_t)targetUniChar] & data->currentMaskToUnicode) {
+ *contextCharToUnicode= NO_CHAR_MARKER;
+
+ /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
+ if (data->prevToUnicodeStatus) {
+ WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
+ data->prevToUnicodeStatus = 0x0000;
+ }
+ /* write to target */
+ WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -2),targetUniChar,data->currentDeltaToUnicode,err);
+
+ continue;
+ }
+ }
+ /* byte unit is unassigned */
+ targetUniChar = missingCharMarker;
+ *err= U_INVALID_CHAR_FOUND;
+ } else {
+ /* only 0xA1 - 0xEE are legal after EXT char */
+ *contextCharToUnicode= NO_CHAR_MARKER;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ }
+ goto CALLBACK;
+ } else if (*contextCharToUnicode==ISCII_INV) {
+ if (sourceChar==ISCII_HALANT) {
+ targetUniChar = 0x0020; /* replace with space accoding to Indic FAQ */
+ } else {
+ targetUniChar = ZWJ;
+ }
+
+ /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
+ if (data->prevToUnicodeStatus) {
+ WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
+ data->prevToUnicodeStatus = 0x0000;
+ }
+ /* write to target */
+ WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -2),targetUniChar,data->currentDeltaToUnicode,err);
+ /* reset */
+ *contextCharToUnicode=NO_CHAR_MARKER;
+ }
+
+ /* look at the pre-context and perform special processing */
+ switch (sourceChar) {
+ case ISCII_INV:
+ case EXT:
+ case ATR:
+ *contextCharToUnicode = (UChar)sourceChar;
+
+ if (*toUnicodeStatus != missingCharMarker) {
+ /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
+ if (data->prevToUnicodeStatus) {
+ WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
+ data->prevToUnicodeStatus = 0x0000;
+ }
+ WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -2),*toUnicodeStatus,data->currentDeltaToUnicode,err);
+ *toUnicodeStatus = missingCharMarker;
+ }
+ continue;
+ case ISCII_DANDA:
+ /* handle double danda*/
+ if (*contextCharToUnicode== ISCII_DANDA) {
+ targetUniChar = DOUBLE_DANDA;
+ /* clear the context */
+ *contextCharToUnicode = NO_CHAR_MARKER;
+ *toUnicodeStatus = missingCharMarker;
+ } else {
+ GET_MAPPING(sourceChar,targetUniChar,data);
+ *contextCharToUnicode = sourceChar;
+ }
+ break;
+ case ISCII_HALANT:
+ /* handle explicit halant */
+ if (*contextCharToUnicode == ISCII_HALANT) {
+ targetUniChar = ZWNJ;
+ /* clear the context */
+ *contextCharToUnicode = NO_CHAR_MARKER;
+ } else {
+ GET_MAPPING(sourceChar,targetUniChar,data);
+ *contextCharToUnicode = sourceChar;
+ }
+ break;
+ case 0x0A:
+ case 0x0D:
+ data->resetToDefaultToUnicode = TRUE;
+ GET_MAPPING(sourceChar,targetUniChar,data)
+ ;
+ *contextCharToUnicode = sourceChar;
+ break;
+
+ case ISCII_VOWEL_SIGN_E:
+ i=1;
+ found=FALSE;
+ for (; i<vowelSignESpecialCases[0][0]; i++) {
+ U_ASSERT(i<UPRV_LENGTHOF(vowelSignESpecialCases));
+ if (vowelSignESpecialCases[i][0]==(uint8_t)*contextCharToUnicode) {
+ targetUniChar=vowelSignESpecialCases[i][1];
+ found=TRUE;
+ break;
+ }
+ }
+ if (found) {
+ /* find out if the mapping is valid in this state */
+ if (validityTable[(uint8_t)targetUniChar] & data->currentMaskToUnicode) {
+ /*targetUniChar += data->currentDeltaToUnicode ;*/
+ *contextCharToUnicode= NO_CHAR_MARKER;
+ *toUnicodeStatus = missingCharMarker;
+ break;
+ }
+ }
+ GET_MAPPING(sourceChar,targetUniChar,data);
+ *contextCharToUnicode = sourceChar;
+ break;
+
+ case ISCII_NUKTA:
+ /* handle soft halant */
+ if (*contextCharToUnicode == ISCII_HALANT) {
+ targetUniChar = ZWJ;
+ /* clear the context */
+ *contextCharToUnicode = NO_CHAR_MARKER;
+ break;
+ } else if (data->currentDeltaToUnicode == PNJ_DELTA && data->contextCharToUnicode == 0xc0) {
+ /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
+ if (data->prevToUnicodeStatus) {
+ WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
+ data->prevToUnicodeStatus = 0x0000;
+ }
+ /* We got here because ISCII_NUKTA was preceded by 0xc0 and we are converting Gurmukhi.
+ * In that case we must convert (0xc0 0xe9) to (\u0a5c\u0a4d\u0a39).
+ */
+ targetUniChar = PNJ_RRA;
+ WRITE_TO_TARGET_TO_U(args, source, target, args->offsets, (source-args->source)-2, targetUniChar, 0, err);
+ if (U_SUCCESS(*err)) {
+ targetUniChar = PNJ_SIGN_VIRAMA;
+ WRITE_TO_TARGET_TO_U(args, source, target, args->offsets, (source-args->source)-2, targetUniChar, 0, err);
+ if (U_SUCCESS(*err)) {
+ targetUniChar = PNJ_HA;
+ WRITE_TO_TARGET_TO_U(args, source, target, args->offsets, (source-args->source)-2, targetUniChar, 0, err);
+ } else {
+ args->converter->UCharErrorBuffer[args->converter->UCharErrorBufferLength++]= PNJ_HA;
+ }
+ } else {
+ args->converter->UCharErrorBuffer[args->converter->UCharErrorBufferLength++]= PNJ_SIGN_VIRAMA;
+ args->converter->UCharErrorBuffer[args->converter->UCharErrorBufferLength++]= PNJ_HA;
+ }
+ *toUnicodeStatus = missingCharMarker;
+ data->contextCharToUnicode = NO_CHAR_MARKER;
+ continue;
+ } else {
+ /* try to handle <CHAR> + ISCII_NUKTA special mappings */
+ i=1;
+ found =FALSE;
+ for (; i<nuktaSpecialCases[0][0]; i++) {
+ if (nuktaSpecialCases[i][0]==(uint8_t)
+ *contextCharToUnicode) {
+ targetUniChar=nuktaSpecialCases[i][1];
+ found =TRUE;
+ break;
+ }
+ }
+ if (found) {
+ /* find out if the mapping is valid in this state */
+ if (validityTable[(uint8_t)targetUniChar] & data->currentMaskToUnicode) {
+ /*targetUniChar += data->currentDeltaToUnicode ;*/
+ *contextCharToUnicode= NO_CHAR_MARKER;
+ *toUnicodeStatus = missingCharMarker;
+ if (data->currentDeltaToUnicode == PNJ_DELTA) {
+ /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
+ if (data->prevToUnicodeStatus) {
+ WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
+ data->prevToUnicodeStatus = 0x0000;
+ }
+ WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -2),targetUniChar,data->currentDeltaToUnicode,err);
+ continue;
+ }
+ break;
+ }
+ /* else fall through to default */
+ }
+ /* else fall through to default */
+ U_FALLTHROUGH;
+ }
+ default:GET_MAPPING(sourceChar,targetUniChar,data)
+ ;
+ *contextCharToUnicode = sourceChar;
+ break;
+ }
+
+ if (*toUnicodeStatus != missingCharMarker) {
+ /* Check to make sure that consonant clusters are handled correct for Gurmukhi script. */
+ if (data->currentDeltaToUnicode == PNJ_DELTA && data->prevToUnicodeStatus != 0 && isPNJConsonant(data->prevToUnicodeStatus) &&
+ (*toUnicodeStatus + PNJ_DELTA) == PNJ_SIGN_VIRAMA && ((UChar32)(targetUniChar + PNJ_DELTA) == data->prevToUnicodeStatus)) {
+ /* Consonant clusters C + HALANT + C should be encoded as ADHAK + C */
+ offset = (int)(source-args->source - 3);
+ tempTargetUniChar = PNJ_ADHAK; /* This is necessary to avoid some compiler warnings. */
+ WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,offset,tempTargetUniChar,0,err);
+ WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,offset,data->prevToUnicodeStatus,0,err);
+ data->prevToUnicodeStatus = 0x0000; /* reset the previous unicode code point */
+ *toUnicodeStatus = missingCharMarker;
+ continue;
+ } else {
+ /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
+ if (data->prevToUnicodeStatus) {
+ WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
+ data->prevToUnicodeStatus = 0x0000;
+ }
+ /* Check to make sure that Bindi and Tippi are handled correctly for Gurmukhi script.
+ * If 0xA2 is preceded by a codepoint in the PNJ_BINDI_TIPPI_SET then the target codepoint should be Tippi instead of Bindi.
+ */
+ if (data->currentDeltaToUnicode == PNJ_DELTA && (targetUniChar + PNJ_DELTA) == PNJ_BINDI && isPNJBindiTippi((*toUnicodeStatus + PNJ_DELTA))) {
+ targetUniChar = PNJ_TIPPI - PNJ_DELTA;
+ WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -2),*toUnicodeStatus,PNJ_DELTA,err);
+ } else if (data->currentDeltaToUnicode == PNJ_DELTA && (targetUniChar + PNJ_DELTA) == PNJ_SIGN_VIRAMA && isPNJConsonant((*toUnicodeStatus + PNJ_DELTA))) {
+ /* Store the current toUnicodeStatus code point for later handling of consonant cluster in Gurmukhi. */
+ data->prevToUnicodeStatus = *toUnicodeStatus + PNJ_DELTA;
+ } else {
+ /* write the previously mapped codepoint */
+ WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -2),*toUnicodeStatus,data->currentDeltaToUnicode,err);
+ }
+ }
+ *toUnicodeStatus = missingCharMarker;
+ }
+
+ if (targetUniChar != missingCharMarker) {
+ /* now save the targetUniChar for delayed write */
+ *toUnicodeStatus = (UChar) targetUniChar;
+ if (data->resetToDefaultToUnicode==TRUE) {
+ data->currentDeltaToUnicode = data->defDeltaToUnicode;
+ data->currentMaskToUnicode = data->defMaskToUnicode;
+ data->resetToDefaultToUnicode=FALSE;
+ }
+ } else {
+
+ /* we reach here only if targetUniChar == missingCharMarker
+ * so assign codes to reason and err
+ */
+ *err = U_INVALID_CHAR_FOUND;
+CALLBACK:
+ args->converter->toUBytes[0] = (uint8_t) sourceChar;
+ args->converter->toULength = 1;
+ break;
+ }
+
+ } else {
+ *err =U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ }
+
+ if (U_SUCCESS(*err) && args->flush && source == sourceLimit) {
+ /* end of the input stream */
+ UConverter *cnv = args->converter;
+
+ if (*contextCharToUnicode==ATR || *contextCharToUnicode==EXT || *contextCharToUnicode==ISCII_INV) {
+ /* set toUBytes[] */
+ cnv->toUBytes[0] = (uint8_t)*contextCharToUnicode;
+ cnv->toULength = 1;
+
+ /* avoid looping on truncated sequences */
+ *contextCharToUnicode = NO_CHAR_MARKER;
+ } else {
+ cnv->toULength = 0;
+ }
+
+ if (*toUnicodeStatus != missingCharMarker) {
+ /* output a remaining target character */
+ WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source - args->source -1),*toUnicodeStatus,data->currentDeltaToUnicode,err);
+ *toUnicodeStatus = missingCharMarker;
+ }
+ }
+
+ args->target = target;
+ args->source = source;
+}
+
+/* structure for SafeClone calculations */
+struct cloneISCIIStruct {
+ UConverter cnv;
+ UConverterDataISCII mydata;
+};
+
+static UConverter * U_CALLCONV
+_ISCII_SafeClone(const UConverter *cnv,
+ void *stackBuffer,
+ int32_t *pBufferSize,
+ UErrorCode *status)
+{
+ struct cloneISCIIStruct * localClone;
+ int32_t bufferSizeNeeded = sizeof(struct cloneISCIIStruct);
+
+ if (U_FAILURE(*status)) {
+ return 0;
+ }
+
+ if (*pBufferSize == 0) { /* 'preflighting' request - set needed size into *pBufferSize */
+ *pBufferSize = bufferSizeNeeded;
+ return 0;
+ }
+
+ localClone = (struct cloneISCIIStruct *)stackBuffer;
+ /* ucnv.c/ucnv_safeClone() copied the main UConverter already */
+
+ uprv_memcpy(&localClone->mydata, cnv->extraInfo, sizeof(UConverterDataISCII));
+ localClone->cnv.extraInfo = &localClone->mydata;
+ localClone->cnv.isExtraLocal = TRUE;
+
+ return &localClone->cnv;
+}
+
+static void U_CALLCONV
+_ISCIIGetUnicodeSet(const UConverter *cnv,
+ const USetAdder *sa,
+ UConverterUnicodeSet which,
+ UErrorCode *pErrorCode)
+{
+ (void)cnv;
+ (void)which;
+ (void)pErrorCode;
+ int32_t idx, script;
+ uint8_t mask;
+
+ /* Since all ISCII versions allow switching to other ISCII
+ scripts, we add all roundtrippable characters to this set. */
+ sa->addRange(sa->set, 0, ASCII_END);
+ for (script = DEVANAGARI; script <= MALAYALAM; script++) {
+ mask = (uint8_t)(lookupInitialData[script].maskEnum);
+ for (idx = 0; idx < DELTA; idx++) {
+ /* added check for TELUGU character */
+ if ((validityTable[idx] & mask) || (script==TELUGU && idx==0x31)) {
+ sa->add(sa->set, idx + (script * DELTA) + INDIC_BLOCK_BEGIN);
+ }
+ }
+ }
+ sa->add(sa->set, DANDA);
+ sa->add(sa->set, DOUBLE_DANDA);
+ sa->add(sa->set, ZWNJ);
+ sa->add(sa->set, ZWJ);
+}
+U_CDECL_END
+static const UConverterImpl _ISCIIImpl={
+
+ UCNV_ISCII,
+
+ NULL,
+ NULL,
+
+ _ISCIIOpen,
+ _ISCIIClose,
+ _ISCIIReset,
+
+ UConverter_toUnicode_ISCII_OFFSETS_LOGIC,
+ UConverter_toUnicode_ISCII_OFFSETS_LOGIC,
+ UConverter_fromUnicode_ISCII_OFFSETS_LOGIC,
+ UConverter_fromUnicode_ISCII_OFFSETS_LOGIC,
+ NULL,
+
+ NULL,
+ _ISCIIgetName,
+ NULL,
+ _ISCII_SafeClone,
+ _ISCIIGetUnicodeSet,
+ NULL,
+ NULL
+};
+
+static const UConverterStaticData _ISCIIStaticData={
+ sizeof(UConverterStaticData),
+ "ISCII",
+ 0,
+ UCNV_IBM,
+ UCNV_ISCII,
+ 1,
+ 4,
+ { 0x1a, 0, 0, 0 },
+ 0x1,
+ FALSE,
+ FALSE,
+ 0x0,
+ 0x0,
+ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, /* reserved */
+
+};
+
+const UConverterSharedData _ISCIIData=
+ UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_ISCIIStaticData, &_ISCIIImpl);
+
+#endif /* #if !UCONFIG_NO_LEGACY_CONVERSION */
diff --git a/contrib/libs/icu/common/ucnvlat1.cpp b/contrib/libs/icu/common/ucnvlat1.cpp
index d936cd11ca..358bc0caa2 100644
--- a/contrib/libs/icu/common/ucnvlat1.cpp
+++ b/contrib/libs/icu/common/ucnvlat1.cpp
@@ -1,756 +1,756 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-**********************************************************************
-* Copyright (C) 2000-2015, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
-* file name: ucnvlat1.cpp
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 2000feb07
-* created by: Markus W. Scherer
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_CONVERSION
-
-#include "unicode/ucnv.h"
-#include "unicode/uset.h"
-#include "unicode/utf8.h"
-#include "ucnv_bld.h"
-#include "ucnv_cnv.h"
-#include "ustr_imp.h"
-
-/* control optimizations according to the platform */
-#define LATIN1_UNROLL_FROM_UNICODE 1
-
-/* ISO 8859-1 --------------------------------------------------------------- */
-
-/* This is a table-less and callback-less version of ucnv_MBCSSingleToBMPWithOffsets(). */
-U_CDECL_BEGIN
-static void U_CALLCONV
-_Latin1ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- const uint8_t *source;
- UChar *target;
- int32_t targetCapacity, length;
- int32_t *offsets;
-
- int32_t sourceIndex;
-
- /* set up the local pointers */
- source=(const uint8_t *)pArgs->source;
- target=pArgs->target;
- targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
- offsets=pArgs->offsets;
-
- sourceIndex=0;
-
- /*
- * since the conversion here is 1:1 UChar:uint8_t, we need only one counter
- * for the minimum of the sourceLength and targetCapacity
- */
- length=(int32_t)((const uint8_t *)pArgs->sourceLimit-source);
- if(length<=targetCapacity) {
- targetCapacity=length;
- } else {
- /* target will be full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- length=targetCapacity;
- }
-
- if(targetCapacity>=8) {
- /* This loop is unrolled for speed and improved pipelining. */
- int32_t count, loops;
-
- loops=count=targetCapacity>>3;
- length=targetCapacity&=0x7;
- do {
- target[0]=source[0];
- target[1]=source[1];
- target[2]=source[2];
- target[3]=source[3];
- target[4]=source[4];
- target[5]=source[5];
- target[6]=source[6];
- target[7]=source[7];
- target+=8;
- source+=8;
- } while(--count>0);
-
- if(offsets!=NULL) {
- do {
- offsets[0]=sourceIndex++;
- offsets[1]=sourceIndex++;
- offsets[2]=sourceIndex++;
- offsets[3]=sourceIndex++;
- offsets[4]=sourceIndex++;
- offsets[5]=sourceIndex++;
- offsets[6]=sourceIndex++;
- offsets[7]=sourceIndex++;
- offsets+=8;
- } while(--loops>0);
- }
- }
-
- /* conversion loop */
- while(targetCapacity>0) {
- *target++=*source++;
- --targetCapacity;
- }
-
- /* write back the updated pointers */
- pArgs->source=(const char *)source;
- pArgs->target=target;
-
- /* set offsets */
- if(offsets!=NULL) {
- while(length>0) {
- *offsets++=sourceIndex++;
- --length;
- }
- pArgs->offsets=offsets;
- }
-}
-
-/* This is a table-less and callback-less version of ucnv_MBCSSingleGetNextUChar(). */
-static UChar32 U_CALLCONV
-_Latin1GetNextUChar(UConverterToUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- const uint8_t *source=(const uint8_t *)pArgs->source;
- if(source<(const uint8_t *)pArgs->sourceLimit) {
- pArgs->source=(const char *)(source+1);
- return *source;
- }
-
- /* no output because of empty input */
- *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
- return 0xffff;
-}
-
-/* This is a table-less version of ucnv_MBCSSingleFromBMPWithOffsets(). */
-static void U_CALLCONV
-_Latin1FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- UConverter *cnv;
- const UChar *source, *sourceLimit;
- uint8_t *target, *oldTarget;
- int32_t targetCapacity, length;
- int32_t *offsets;
-
- UChar32 cp;
- UChar c, max;
-
- int32_t sourceIndex;
-
- /* set up the local pointers */
- cnv=pArgs->converter;
- source=pArgs->source;
- sourceLimit=pArgs->sourceLimit;
- target=oldTarget=(uint8_t *)pArgs->target;
- targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
- offsets=pArgs->offsets;
-
- if(cnv->sharedData==&_Latin1Data) {
- max=0xff; /* Latin-1 */
- } else {
- max=0x7f; /* US-ASCII */
- }
-
- /* get the converter state from UConverter */
- cp=cnv->fromUChar32;
-
- /* sourceIndex=-1 if the current character began in the previous buffer */
- sourceIndex= cp==0 ? 0 : -1;
-
- /*
- * since the conversion here is 1:1 UChar:uint8_t, we need only one counter
- * for the minimum of the sourceLength and targetCapacity
- */
- length=(int32_t)(sourceLimit-source);
- if(length<targetCapacity) {
- targetCapacity=length;
- }
-
- /* conversion loop */
- if(cp!=0 && targetCapacity>0) {
- goto getTrail;
- }
-
-#if LATIN1_UNROLL_FROM_UNICODE
- /* unroll the loop with the most common case */
- if(targetCapacity>=16) {
- int32_t count, loops;
- UChar u, oredChars;
-
- loops=count=targetCapacity>>4;
- do {
- oredChars=u=*source++;
- *target++=(uint8_t)u;
- oredChars|=u=*source++;
- *target++=(uint8_t)u;
- oredChars|=u=*source++;
- *target++=(uint8_t)u;
- oredChars|=u=*source++;
- *target++=(uint8_t)u;
- oredChars|=u=*source++;
- *target++=(uint8_t)u;
- oredChars|=u=*source++;
- *target++=(uint8_t)u;
- oredChars|=u=*source++;
- *target++=(uint8_t)u;
- oredChars|=u=*source++;
- *target++=(uint8_t)u;
- oredChars|=u=*source++;
- *target++=(uint8_t)u;
- oredChars|=u=*source++;
- *target++=(uint8_t)u;
- oredChars|=u=*source++;
- *target++=(uint8_t)u;
- oredChars|=u=*source++;
- *target++=(uint8_t)u;
- oredChars|=u=*source++;
- *target++=(uint8_t)u;
- oredChars|=u=*source++;
- *target++=(uint8_t)u;
- oredChars|=u=*source++;
- *target++=(uint8_t)u;
- oredChars|=u=*source++;
- *target++=(uint8_t)u;
-
- /* were all 16 entries really valid? */
- if(oredChars>max) {
- /* no, return to the first of these 16 */
- source-=16;
- target-=16;
- break;
- }
- } while(--count>0);
- count=loops-count;
- targetCapacity-=16*count;
-
- if(offsets!=NULL) {
- oldTarget+=16*count;
- while(count>0) {
- *offsets++=sourceIndex++;
- *offsets++=sourceIndex++;
- *offsets++=sourceIndex++;
- *offsets++=sourceIndex++;
- *offsets++=sourceIndex++;
- *offsets++=sourceIndex++;
- *offsets++=sourceIndex++;
- *offsets++=sourceIndex++;
- *offsets++=sourceIndex++;
- *offsets++=sourceIndex++;
- *offsets++=sourceIndex++;
- *offsets++=sourceIndex++;
- *offsets++=sourceIndex++;
- *offsets++=sourceIndex++;
- *offsets++=sourceIndex++;
- *offsets++=sourceIndex++;
- --count;
- }
- }
- }
-#endif
-
- /* conversion loop */
- c=0;
- while(targetCapacity>0 && (c=*source++)<=max) {
- /* convert the Unicode code point */
- *target++=(uint8_t)c;
- --targetCapacity;
- }
-
- if(c>max) {
- cp=c;
- if(!U_IS_SURROGATE(cp)) {
- /* callback(unassigned) */
- } else if(U_IS_SURROGATE_LEAD(cp)) {
-getTrail:
- if(source<sourceLimit) {
- /* test the following code unit */
- UChar trail=*source;
- if(U16_IS_TRAIL(trail)) {
- ++source;
- cp=U16_GET_SUPPLEMENTARY(cp, trail);
- /* this codepage does not map supplementary code points */
- /* callback(unassigned) */
- } else {
- /* this is an unmatched lead code unit (1st surrogate) */
- /* callback(illegal) */
- }
- } else {
- /* no more input */
- cnv->fromUChar32=cp;
- goto noMoreInput;
- }
- } else {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- }
-
- *pErrorCode= U_IS_SURROGATE(cp) ? U_ILLEGAL_CHAR_FOUND : U_INVALID_CHAR_FOUND;
- cnv->fromUChar32=cp;
- }
-noMoreInput:
-
- /* set offsets since the start */
- if(offsets!=NULL) {
- size_t count=target-oldTarget;
- while(count>0) {
- *offsets++=sourceIndex++;
- --count;
- }
- }
-
- if(U_SUCCESS(*pErrorCode) && source<sourceLimit && target>=(uint8_t *)pArgs->targetLimit) {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
-
- /* write back the updated pointers */
- pArgs->source=source;
- pArgs->target=(char *)target;
- pArgs->offsets=offsets;
-}
-
-/* Convert UTF-8 to Latin-1. Adapted from ucnv_SBCSFromUTF8(). */
-static void U_CALLCONV
-ucnv_Latin1FromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
- UConverterToUnicodeArgs *pToUArgs,
- UErrorCode *pErrorCode) {
- UConverter *utf8;
- const uint8_t *source, *sourceLimit;
- uint8_t *target;
- int32_t targetCapacity;
-
- UChar32 c;
- uint8_t b, t1;
-
- /* set up the local pointers */
- utf8=pToUArgs->converter;
- source=(uint8_t *)pToUArgs->source;
- sourceLimit=(uint8_t *)pToUArgs->sourceLimit;
- target=(uint8_t *)pFromUArgs->target;
- targetCapacity=(int32_t)(pFromUArgs->targetLimit-pFromUArgs->target);
-
- /* get the converter state from the UTF-8 UConverter */
- if (utf8->toULength > 0) {
- c=(UChar32)utf8->toUnicodeStatus;
- } else {
- c = 0;
- }
- if(c!=0 && source<sourceLimit) {
- if(targetCapacity==0) {
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- return;
- } else if(c>=0xc2 && c<=0xc3 && (t1=(uint8_t)(*source-0x80)) <= 0x3f) {
- ++source;
- *target++=(uint8_t)(((c&3)<<6)|t1);
- --targetCapacity;
-
- utf8->toUnicodeStatus=0;
- utf8->toULength=0;
- } else {
- /* complicated, illegal or unmappable input: fall back to the pivoting implementation */
- *pErrorCode=U_USING_DEFAULT_WARNING;
- return;
- }
- }
-
- /*
- * Make sure that the last byte sequence before sourceLimit is complete
- * or runs into a lead byte.
- * In the conversion loop compare source with sourceLimit only once
- * per multi-byte character.
- * For Latin-1, adjust sourceLimit only for 1 trail byte because
- * the conversion loop handles at most 2-byte sequences.
- */
- if(source<sourceLimit && U8_IS_LEAD(*(sourceLimit-1))) {
- --sourceLimit;
- }
-
- /* conversion loop */
- while(source<sourceLimit) {
- if(targetCapacity>0) {
- b=*source++;
- if(U8_IS_SINGLE(b)) {
- /* convert ASCII */
- *target++=(uint8_t)b;
- --targetCapacity;
- } else if( /* handle U+0080..U+00FF inline */
- b>=0xc2 && b<=0xc3 &&
- (t1=(uint8_t)(*source-0x80)) <= 0x3f
- ) {
- ++source;
- *target++=(uint8_t)(((b&3)<<6)|t1);
- --targetCapacity;
- } else {
- /* complicated, illegal or unmappable input: fall back to the pivoting implementation */
- pToUArgs->source=(char *)(source-1);
- pFromUArgs->target=(char *)target;
- *pErrorCode=U_USING_DEFAULT_WARNING;
- return;
- }
- } else {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- }
-
- /*
- * The sourceLimit may have been adjusted before the conversion loop
- * to stop before a truncated sequence.
- * If so, then collect the truncated sequence now.
- * For Latin-1, there is at most exactly one lead byte because of the
- * smaller sourceLimit adjustment logic.
- */
- if(U_SUCCESS(*pErrorCode) && source<(sourceLimit=(uint8_t *)pToUArgs->sourceLimit)) {
- utf8->toUnicodeStatus=utf8->toUBytes[0]=b=*source++;
- utf8->toULength=1;
- utf8->mode=U8_COUNT_BYTES(b);
- }
-
- /* write back the updated pointers */
- pToUArgs->source=(char *)source;
- pFromUArgs->target=(char *)target;
-}
-
-static void U_CALLCONV
-_Latin1GetUnicodeSet(const UConverter *cnv,
- const USetAdder *sa,
- UConverterUnicodeSet which,
- UErrorCode *pErrorCode) {
- (void)cnv;
- (void)which;
- (void)pErrorCode;
- sa->addRange(sa->set, 0, 0xff);
-}
-U_CDECL_END
-
-
-static const UConverterImpl _Latin1Impl={
- UCNV_LATIN_1,
-
- NULL,
- NULL,
-
- NULL,
- NULL,
- NULL,
-
- _Latin1ToUnicodeWithOffsets,
- _Latin1ToUnicodeWithOffsets,
- _Latin1FromUnicodeWithOffsets,
- _Latin1FromUnicodeWithOffsets,
- _Latin1GetNextUChar,
-
- NULL,
- NULL,
- NULL,
- NULL,
- _Latin1GetUnicodeSet,
-
- NULL,
- ucnv_Latin1FromUTF8
-};
-
-static const UConverterStaticData _Latin1StaticData={
- sizeof(UConverterStaticData),
- "ISO-8859-1",
- 819, UCNV_IBM, UCNV_LATIN_1, 1, 1,
- { 0x1a, 0, 0, 0 }, 1, FALSE, FALSE,
- 0,
- 0,
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
-};
-
-const UConverterSharedData _Latin1Data=
- UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_Latin1StaticData, &_Latin1Impl);
-
-/* US-ASCII ----------------------------------------------------------------- */
-
-U_CDECL_BEGIN
-/* This is a table-less version of ucnv_MBCSSingleToBMPWithOffsets(). */
-static void U_CALLCONV
-_ASCIIToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- const uint8_t *source, *sourceLimit;
- UChar *target, *oldTarget;
- int32_t targetCapacity, length;
- int32_t *offsets;
-
- int32_t sourceIndex;
-
- uint8_t c;
-
- /* set up the local pointers */
- source=(const uint8_t *)pArgs->source;
- sourceLimit=(const uint8_t *)pArgs->sourceLimit;
- target=oldTarget=pArgs->target;
- targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
- offsets=pArgs->offsets;
-
- /* sourceIndex=-1 if the current character began in the previous buffer */
- sourceIndex=0;
-
- /*
- * since the conversion here is 1:1 UChar:uint8_t, we need only one counter
- * for the minimum of the sourceLength and targetCapacity
- */
- length=(int32_t)(sourceLimit-source);
- if(length<targetCapacity) {
- targetCapacity=length;
- }
-
- if(targetCapacity>=8) {
- /* This loop is unrolled for speed and improved pipelining. */
- int32_t count, loops;
- UChar oredChars;
-
- loops=count=targetCapacity>>3;
- do {
- oredChars=target[0]=source[0];
- oredChars|=target[1]=source[1];
- oredChars|=target[2]=source[2];
- oredChars|=target[3]=source[3];
- oredChars|=target[4]=source[4];
- oredChars|=target[5]=source[5];
- oredChars|=target[6]=source[6];
- oredChars|=target[7]=source[7];
-
- /* were all 16 entries really valid? */
- if(oredChars>0x7f) {
- /* no, return to the first of these 16 */
- break;
- }
- source+=8;
- target+=8;
- } while(--count>0);
- count=loops-count;
- targetCapacity-=count*8;
-
- if(offsets!=NULL) {
- oldTarget+=count*8;
- while(count>0) {
- offsets[0]=sourceIndex++;
- offsets[1]=sourceIndex++;
- offsets[2]=sourceIndex++;
- offsets[3]=sourceIndex++;
- offsets[4]=sourceIndex++;
- offsets[5]=sourceIndex++;
- offsets[6]=sourceIndex++;
- offsets[7]=sourceIndex++;
- offsets+=8;
- --count;
- }
- }
- }
-
- /* conversion loop */
- c=0;
- while(targetCapacity>0 && (c=*source++)<=0x7f) {
- *target++=c;
- --targetCapacity;
- }
-
- if(c>0x7f) {
- /* callback(illegal); copy the current bytes to toUBytes[] */
- UConverter *cnv=pArgs->converter;
- cnv->toUBytes[0]=c;
- cnv->toULength=1;
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- } else if(source<sourceLimit && target>=pArgs->targetLimit) {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
-
- /* set offsets since the start */
- if(offsets!=NULL) {
- size_t count=target-oldTarget;
- while(count>0) {
- *offsets++=sourceIndex++;
- --count;
- }
- }
-
- /* write back the updated pointers */
- pArgs->source=(const char *)source;
- pArgs->target=target;
- pArgs->offsets=offsets;
-}
-
-/* This is a table-less version of ucnv_MBCSSingleGetNextUChar(). */
-static UChar32 U_CALLCONV
-_ASCIIGetNextUChar(UConverterToUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- const uint8_t *source;
- uint8_t b;
-
- source=(const uint8_t *)pArgs->source;
- if(source<(const uint8_t *)pArgs->sourceLimit) {
- b=*source++;
- pArgs->source=(const char *)source;
- if(b<=0x7f) {
- return b;
- } else {
- UConverter *cnv=pArgs->converter;
- cnv->toUBytes[0]=b;
- cnv->toULength=1;
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- return 0xffff;
- }
- }
-
- /* no output because of empty input */
- *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
- return 0xffff;
-}
-
-/* "Convert" UTF-8 to US-ASCII: Validate and copy. */
-static void U_CALLCONV
-ucnv_ASCIIFromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
- UConverterToUnicodeArgs *pToUArgs,
- UErrorCode *pErrorCode) {
- const uint8_t *source, *sourceLimit;
- uint8_t *target;
- int32_t targetCapacity, length;
-
- uint8_t c;
-
- if(pToUArgs->converter->toULength > 0) {
- /* no handling of partial UTF-8 characters here, fall back to pivoting */
- *pErrorCode=U_USING_DEFAULT_WARNING;
- return;
- }
-
- /* set up the local pointers */
- source=(const uint8_t *)pToUArgs->source;
- sourceLimit=(const uint8_t *)pToUArgs->sourceLimit;
- target=(uint8_t *)pFromUArgs->target;
- targetCapacity=(int32_t)(pFromUArgs->targetLimit-pFromUArgs->target);
-
- /*
- * since the conversion here is 1:1 uint8_t:uint8_t, we need only one counter
- * for the minimum of the sourceLength and targetCapacity
- */
- length=(int32_t)(sourceLimit-source);
- if(length<targetCapacity) {
- targetCapacity=length;
- }
-
- /* unroll the loop with the most common case */
- if(targetCapacity>=16) {
- int32_t count, loops;
- uint8_t oredChars;
-
- loops=count=targetCapacity>>4;
- do {
- oredChars=*target++=*source++;
- oredChars|=*target++=*source++;
- oredChars|=*target++=*source++;
- oredChars|=*target++=*source++;
- oredChars|=*target++=*source++;
- oredChars|=*target++=*source++;
- oredChars|=*target++=*source++;
- oredChars|=*target++=*source++;
- oredChars|=*target++=*source++;
- oredChars|=*target++=*source++;
- oredChars|=*target++=*source++;
- oredChars|=*target++=*source++;
- oredChars|=*target++=*source++;
- oredChars|=*target++=*source++;
- oredChars|=*target++=*source++;
- oredChars|=*target++=*source++;
-
- /* were all 16 entries really valid? */
- if(oredChars>0x7f) {
- /* no, return to the first of these 16 */
- source-=16;
- target-=16;
- break;
- }
- } while(--count>0);
- count=loops-count;
- targetCapacity-=16*count;
- }
-
- /* conversion loop */
- c=0;
- while(targetCapacity>0 && (c=*source)<=0x7f) {
- ++source;
- *target++=c;
- --targetCapacity;
- }
-
- if(c>0x7f) {
- /* non-ASCII character, handle in standard converter */
- *pErrorCode=U_USING_DEFAULT_WARNING;
- } else if(source<sourceLimit && target>=(const uint8_t *)pFromUArgs->targetLimit) {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- }
-
- /* write back the updated pointers */
- pToUArgs->source=(const char *)source;
- pFromUArgs->target=(char *)target;
-}
-
-static void U_CALLCONV
-_ASCIIGetUnicodeSet(const UConverter *cnv,
- const USetAdder *sa,
- UConverterUnicodeSet which,
- UErrorCode *pErrorCode) {
- (void)cnv;
- (void)which;
- (void)pErrorCode;
- sa->addRange(sa->set, 0, 0x7f);
-}
-U_CDECL_END
-
-static const UConverterImpl _ASCIIImpl={
- UCNV_US_ASCII,
-
- NULL,
- NULL,
-
- NULL,
- NULL,
- NULL,
-
- _ASCIIToUnicodeWithOffsets,
- _ASCIIToUnicodeWithOffsets,
- _Latin1FromUnicodeWithOffsets,
- _Latin1FromUnicodeWithOffsets,
- _ASCIIGetNextUChar,
-
- NULL,
- NULL,
- NULL,
- NULL,
- _ASCIIGetUnicodeSet,
-
- NULL,
- ucnv_ASCIIFromUTF8
-};
-
-static const UConverterStaticData _ASCIIStaticData={
- sizeof(UConverterStaticData),
- "US-ASCII",
- 367, UCNV_IBM, UCNV_US_ASCII, 1, 1,
- { 0x1a, 0, 0, 0 }, 1, FALSE, FALSE,
- 0,
- 0,
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
-};
-
-const UConverterSharedData _ASCIIData=
- UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_ASCIIStaticData, &_ASCIIImpl);
-
-#endif
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+**********************************************************************
+* Copyright (C) 2000-2015, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* file name: ucnvlat1.cpp
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2000feb07
+* created by: Markus W. Scherer
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "unicode/ucnv.h"
+#include "unicode/uset.h"
+#include "unicode/utf8.h"
+#include "ucnv_bld.h"
+#include "ucnv_cnv.h"
+#include "ustr_imp.h"
+
+/* control optimizations according to the platform */
+#define LATIN1_UNROLL_FROM_UNICODE 1
+
+/* ISO 8859-1 --------------------------------------------------------------- */
+
+/* This is a table-less and callback-less version of ucnv_MBCSSingleToBMPWithOffsets(). */
+U_CDECL_BEGIN
+static void U_CALLCONV
+_Latin1ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ const uint8_t *source;
+ UChar *target;
+ int32_t targetCapacity, length;
+ int32_t *offsets;
+
+ int32_t sourceIndex;
+
+ /* set up the local pointers */
+ source=(const uint8_t *)pArgs->source;
+ target=pArgs->target;
+ targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
+ offsets=pArgs->offsets;
+
+ sourceIndex=0;
+
+ /*
+ * since the conversion here is 1:1 UChar:uint8_t, we need only one counter
+ * for the minimum of the sourceLength and targetCapacity
+ */
+ length=(int32_t)((const uint8_t *)pArgs->sourceLimit-source);
+ if(length<=targetCapacity) {
+ targetCapacity=length;
+ } else {
+ /* target will be full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ length=targetCapacity;
+ }
+
+ if(targetCapacity>=8) {
+ /* This loop is unrolled for speed and improved pipelining. */
+ int32_t count, loops;
+
+ loops=count=targetCapacity>>3;
+ length=targetCapacity&=0x7;
+ do {
+ target[0]=source[0];
+ target[1]=source[1];
+ target[2]=source[2];
+ target[3]=source[3];
+ target[4]=source[4];
+ target[5]=source[5];
+ target[6]=source[6];
+ target[7]=source[7];
+ target+=8;
+ source+=8;
+ } while(--count>0);
+
+ if(offsets!=NULL) {
+ do {
+ offsets[0]=sourceIndex++;
+ offsets[1]=sourceIndex++;
+ offsets[2]=sourceIndex++;
+ offsets[3]=sourceIndex++;
+ offsets[4]=sourceIndex++;
+ offsets[5]=sourceIndex++;
+ offsets[6]=sourceIndex++;
+ offsets[7]=sourceIndex++;
+ offsets+=8;
+ } while(--loops>0);
+ }
+ }
+
+ /* conversion loop */
+ while(targetCapacity>0) {
+ *target++=*source++;
+ --targetCapacity;
+ }
+
+ /* write back the updated pointers */
+ pArgs->source=(const char *)source;
+ pArgs->target=target;
+
+ /* set offsets */
+ if(offsets!=NULL) {
+ while(length>0) {
+ *offsets++=sourceIndex++;
+ --length;
+ }
+ pArgs->offsets=offsets;
+ }
+}
+
+/* This is a table-less and callback-less version of ucnv_MBCSSingleGetNextUChar(). */
+static UChar32 U_CALLCONV
+_Latin1GetNextUChar(UConverterToUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ const uint8_t *source=(const uint8_t *)pArgs->source;
+ if(source<(const uint8_t *)pArgs->sourceLimit) {
+ pArgs->source=(const char *)(source+1);
+ return *source;
+ }
+
+ /* no output because of empty input */
+ *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0xffff;
+}
+
+/* This is a table-less version of ucnv_MBCSSingleFromBMPWithOffsets(). */
+static void U_CALLCONV
+_Latin1FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ UConverter *cnv;
+ const UChar *source, *sourceLimit;
+ uint8_t *target, *oldTarget;
+ int32_t targetCapacity, length;
+ int32_t *offsets;
+
+ UChar32 cp;
+ UChar c, max;
+
+ int32_t sourceIndex;
+
+ /* set up the local pointers */
+ cnv=pArgs->converter;
+ source=pArgs->source;
+ sourceLimit=pArgs->sourceLimit;
+ target=oldTarget=(uint8_t *)pArgs->target;
+ targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
+ offsets=pArgs->offsets;
+
+ if(cnv->sharedData==&_Latin1Data) {
+ max=0xff; /* Latin-1 */
+ } else {
+ max=0x7f; /* US-ASCII */
+ }
+
+ /* get the converter state from UConverter */
+ cp=cnv->fromUChar32;
+
+ /* sourceIndex=-1 if the current character began in the previous buffer */
+ sourceIndex= cp==0 ? 0 : -1;
+
+ /*
+ * since the conversion here is 1:1 UChar:uint8_t, we need only one counter
+ * for the minimum of the sourceLength and targetCapacity
+ */
+ length=(int32_t)(sourceLimit-source);
+ if(length<targetCapacity) {
+ targetCapacity=length;
+ }
+
+ /* conversion loop */
+ if(cp!=0 && targetCapacity>0) {
+ goto getTrail;
+ }
+
+#if LATIN1_UNROLL_FROM_UNICODE
+ /* unroll the loop with the most common case */
+ if(targetCapacity>=16) {
+ int32_t count, loops;
+ UChar u, oredChars;
+
+ loops=count=targetCapacity>>4;
+ do {
+ oredChars=u=*source++;
+ *target++=(uint8_t)u;
+ oredChars|=u=*source++;
+ *target++=(uint8_t)u;
+ oredChars|=u=*source++;
+ *target++=(uint8_t)u;
+ oredChars|=u=*source++;
+ *target++=(uint8_t)u;
+ oredChars|=u=*source++;
+ *target++=(uint8_t)u;
+ oredChars|=u=*source++;
+ *target++=(uint8_t)u;
+ oredChars|=u=*source++;
+ *target++=(uint8_t)u;
+ oredChars|=u=*source++;
+ *target++=(uint8_t)u;
+ oredChars|=u=*source++;
+ *target++=(uint8_t)u;
+ oredChars|=u=*source++;
+ *target++=(uint8_t)u;
+ oredChars|=u=*source++;
+ *target++=(uint8_t)u;
+ oredChars|=u=*source++;
+ *target++=(uint8_t)u;
+ oredChars|=u=*source++;
+ *target++=(uint8_t)u;
+ oredChars|=u=*source++;
+ *target++=(uint8_t)u;
+ oredChars|=u=*source++;
+ *target++=(uint8_t)u;
+ oredChars|=u=*source++;
+ *target++=(uint8_t)u;
+
+ /* were all 16 entries really valid? */
+ if(oredChars>max) {
+ /* no, return to the first of these 16 */
+ source-=16;
+ target-=16;
+ break;
+ }
+ } while(--count>0);
+ count=loops-count;
+ targetCapacity-=16*count;
+
+ if(offsets!=NULL) {
+ oldTarget+=16*count;
+ while(count>0) {
+ *offsets++=sourceIndex++;
+ *offsets++=sourceIndex++;
+ *offsets++=sourceIndex++;
+ *offsets++=sourceIndex++;
+ *offsets++=sourceIndex++;
+ *offsets++=sourceIndex++;
+ *offsets++=sourceIndex++;
+ *offsets++=sourceIndex++;
+ *offsets++=sourceIndex++;
+ *offsets++=sourceIndex++;
+ *offsets++=sourceIndex++;
+ *offsets++=sourceIndex++;
+ *offsets++=sourceIndex++;
+ *offsets++=sourceIndex++;
+ *offsets++=sourceIndex++;
+ *offsets++=sourceIndex++;
+ --count;
+ }
+ }
+ }
+#endif
+
+ /* conversion loop */
+ c=0;
+ while(targetCapacity>0 && (c=*source++)<=max) {
+ /* convert the Unicode code point */
+ *target++=(uint8_t)c;
+ --targetCapacity;
+ }
+
+ if(c>max) {
+ cp=c;
+ if(!U_IS_SURROGATE(cp)) {
+ /* callback(unassigned) */
+ } else if(U_IS_SURROGATE_LEAD(cp)) {
+getTrail:
+ if(source<sourceLimit) {
+ /* test the following code unit */
+ UChar trail=*source;
+ if(U16_IS_TRAIL(trail)) {
+ ++source;
+ cp=U16_GET_SUPPLEMENTARY(cp, trail);
+ /* this codepage does not map supplementary code points */
+ /* callback(unassigned) */
+ } else {
+ /* this is an unmatched lead code unit (1st surrogate) */
+ /* callback(illegal) */
+ }
+ } else {
+ /* no more input */
+ cnv->fromUChar32=cp;
+ goto noMoreInput;
+ }
+ } else {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ }
+
+ *pErrorCode= U_IS_SURROGATE(cp) ? U_ILLEGAL_CHAR_FOUND : U_INVALID_CHAR_FOUND;
+ cnv->fromUChar32=cp;
+ }
+noMoreInput:
+
+ /* set offsets since the start */
+ if(offsets!=NULL) {
+ size_t count=target-oldTarget;
+ while(count>0) {
+ *offsets++=sourceIndex++;
+ --count;
+ }
+ }
+
+ if(U_SUCCESS(*pErrorCode) && source<sourceLimit && target>=(uint8_t *)pArgs->targetLimit) {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+
+ /* write back the updated pointers */
+ pArgs->source=source;
+ pArgs->target=(char *)target;
+ pArgs->offsets=offsets;
+}
+
+/* Convert UTF-8 to Latin-1. Adapted from ucnv_SBCSFromUTF8(). */
+static void U_CALLCONV
+ucnv_Latin1FromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
+ UConverterToUnicodeArgs *pToUArgs,
+ UErrorCode *pErrorCode) {
+ UConverter *utf8;
+ const uint8_t *source, *sourceLimit;
+ uint8_t *target;
+ int32_t targetCapacity;
+
+ UChar32 c;
+ uint8_t b, t1;
+
+ /* set up the local pointers */
+ utf8=pToUArgs->converter;
+ source=(uint8_t *)pToUArgs->source;
+ sourceLimit=(uint8_t *)pToUArgs->sourceLimit;
+ target=(uint8_t *)pFromUArgs->target;
+ targetCapacity=(int32_t)(pFromUArgs->targetLimit-pFromUArgs->target);
+
+ /* get the converter state from the UTF-8 UConverter */
+ if (utf8->toULength > 0) {
+ c=(UChar32)utf8->toUnicodeStatus;
+ } else {
+ c = 0;
+ }
+ if(c!=0 && source<sourceLimit) {
+ if(targetCapacity==0) {
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ return;
+ } else if(c>=0xc2 && c<=0xc3 && (t1=(uint8_t)(*source-0x80)) <= 0x3f) {
+ ++source;
+ *target++=(uint8_t)(((c&3)<<6)|t1);
+ --targetCapacity;
+
+ utf8->toUnicodeStatus=0;
+ utf8->toULength=0;
+ } else {
+ /* complicated, illegal or unmappable input: fall back to the pivoting implementation */
+ *pErrorCode=U_USING_DEFAULT_WARNING;
+ return;
+ }
+ }
+
+ /*
+ * Make sure that the last byte sequence before sourceLimit is complete
+ * or runs into a lead byte.
+ * In the conversion loop compare source with sourceLimit only once
+ * per multi-byte character.
+ * For Latin-1, adjust sourceLimit only for 1 trail byte because
+ * the conversion loop handles at most 2-byte sequences.
+ */
+ if(source<sourceLimit && U8_IS_LEAD(*(sourceLimit-1))) {
+ --sourceLimit;
+ }
+
+ /* conversion loop */
+ while(source<sourceLimit) {
+ if(targetCapacity>0) {
+ b=*source++;
+ if(U8_IS_SINGLE(b)) {
+ /* convert ASCII */
+ *target++=(uint8_t)b;
+ --targetCapacity;
+ } else if( /* handle U+0080..U+00FF inline */
+ b>=0xc2 && b<=0xc3 &&
+ (t1=(uint8_t)(*source-0x80)) <= 0x3f
+ ) {
+ ++source;
+ *target++=(uint8_t)(((b&3)<<6)|t1);
+ --targetCapacity;
+ } else {
+ /* complicated, illegal or unmappable input: fall back to the pivoting implementation */
+ pToUArgs->source=(char *)(source-1);
+ pFromUArgs->target=(char *)target;
+ *pErrorCode=U_USING_DEFAULT_WARNING;
+ return;
+ }
+ } else {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ }
+
+ /*
+ * The sourceLimit may have been adjusted before the conversion loop
+ * to stop before a truncated sequence.
+ * If so, then collect the truncated sequence now.
+ * For Latin-1, there is at most exactly one lead byte because of the
+ * smaller sourceLimit adjustment logic.
+ */
+ if(U_SUCCESS(*pErrorCode) && source<(sourceLimit=(uint8_t *)pToUArgs->sourceLimit)) {
+ utf8->toUnicodeStatus=utf8->toUBytes[0]=b=*source++;
+ utf8->toULength=1;
+ utf8->mode=U8_COUNT_BYTES(b);
+ }
+
+ /* write back the updated pointers */
+ pToUArgs->source=(char *)source;
+ pFromUArgs->target=(char *)target;
+}
+
+static void U_CALLCONV
+_Latin1GetUnicodeSet(const UConverter *cnv,
+ const USetAdder *sa,
+ UConverterUnicodeSet which,
+ UErrorCode *pErrorCode) {
+ (void)cnv;
+ (void)which;
+ (void)pErrorCode;
+ sa->addRange(sa->set, 0, 0xff);
+}
+U_CDECL_END
+
+
+static const UConverterImpl _Latin1Impl={
+ UCNV_LATIN_1,
+
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+ NULL,
+
+ _Latin1ToUnicodeWithOffsets,
+ _Latin1ToUnicodeWithOffsets,
+ _Latin1FromUnicodeWithOffsets,
+ _Latin1FromUnicodeWithOffsets,
+ _Latin1GetNextUChar,
+
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ _Latin1GetUnicodeSet,
+
+ NULL,
+ ucnv_Latin1FromUTF8
+};
+
+static const UConverterStaticData _Latin1StaticData={
+ sizeof(UConverterStaticData),
+ "ISO-8859-1",
+ 819, UCNV_IBM, UCNV_LATIN_1, 1, 1,
+ { 0x1a, 0, 0, 0 }, 1, FALSE, FALSE,
+ 0,
+ 0,
+ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
+};
+
+const UConverterSharedData _Latin1Data=
+ UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_Latin1StaticData, &_Latin1Impl);
+
+/* US-ASCII ----------------------------------------------------------------- */
+
+U_CDECL_BEGIN
+/* This is a table-less version of ucnv_MBCSSingleToBMPWithOffsets(). */
+static void U_CALLCONV
+_ASCIIToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ const uint8_t *source, *sourceLimit;
+ UChar *target, *oldTarget;
+ int32_t targetCapacity, length;
+ int32_t *offsets;
+
+ int32_t sourceIndex;
+
+ uint8_t c;
+
+ /* set up the local pointers */
+ source=(const uint8_t *)pArgs->source;
+ sourceLimit=(const uint8_t *)pArgs->sourceLimit;
+ target=oldTarget=pArgs->target;
+ targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
+ offsets=pArgs->offsets;
+
+ /* sourceIndex=-1 if the current character began in the previous buffer */
+ sourceIndex=0;
+
+ /*
+ * since the conversion here is 1:1 UChar:uint8_t, we need only one counter
+ * for the minimum of the sourceLength and targetCapacity
+ */
+ length=(int32_t)(sourceLimit-source);
+ if(length<targetCapacity) {
+ targetCapacity=length;
+ }
+
+ if(targetCapacity>=8) {
+ /* This loop is unrolled for speed and improved pipelining. */
+ int32_t count, loops;
+ UChar oredChars;
+
+ loops=count=targetCapacity>>3;
+ do {
+ oredChars=target[0]=source[0];
+ oredChars|=target[1]=source[1];
+ oredChars|=target[2]=source[2];
+ oredChars|=target[3]=source[3];
+ oredChars|=target[4]=source[4];
+ oredChars|=target[5]=source[5];
+ oredChars|=target[6]=source[6];
+ oredChars|=target[7]=source[7];
+
+ /* were all 16 entries really valid? */
+ if(oredChars>0x7f) {
+ /* no, return to the first of these 16 */
+ break;
+ }
+ source+=8;
+ target+=8;
+ } while(--count>0);
+ count=loops-count;
+ targetCapacity-=count*8;
+
+ if(offsets!=NULL) {
+ oldTarget+=count*8;
+ while(count>0) {
+ offsets[0]=sourceIndex++;
+ offsets[1]=sourceIndex++;
+ offsets[2]=sourceIndex++;
+ offsets[3]=sourceIndex++;
+ offsets[4]=sourceIndex++;
+ offsets[5]=sourceIndex++;
+ offsets[6]=sourceIndex++;
+ offsets[7]=sourceIndex++;
+ offsets+=8;
+ --count;
+ }
+ }
+ }
+
+ /* conversion loop */
+ c=0;
+ while(targetCapacity>0 && (c=*source++)<=0x7f) {
+ *target++=c;
+ --targetCapacity;
+ }
+
+ if(c>0x7f) {
+ /* callback(illegal); copy the current bytes to toUBytes[] */
+ UConverter *cnv=pArgs->converter;
+ cnv->toUBytes[0]=c;
+ cnv->toULength=1;
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ } else if(source<sourceLimit && target>=pArgs->targetLimit) {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+
+ /* set offsets since the start */
+ if(offsets!=NULL) {
+ size_t count=target-oldTarget;
+ while(count>0) {
+ *offsets++=sourceIndex++;
+ --count;
+ }
+ }
+
+ /* write back the updated pointers */
+ pArgs->source=(const char *)source;
+ pArgs->target=target;
+ pArgs->offsets=offsets;
+}
+
+/* This is a table-less version of ucnv_MBCSSingleGetNextUChar(). */
+static UChar32 U_CALLCONV
+_ASCIIGetNextUChar(UConverterToUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ const uint8_t *source;
+ uint8_t b;
+
+ source=(const uint8_t *)pArgs->source;
+ if(source<(const uint8_t *)pArgs->sourceLimit) {
+ b=*source++;
+ pArgs->source=(const char *)source;
+ if(b<=0x7f) {
+ return b;
+ } else {
+ UConverter *cnv=pArgs->converter;
+ cnv->toUBytes[0]=b;
+ cnv->toULength=1;
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ return 0xffff;
+ }
+ }
+
+ /* no output because of empty input */
+ *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0xffff;
+}
+
+/* "Convert" UTF-8 to US-ASCII: Validate and copy. */
+static void U_CALLCONV
+ucnv_ASCIIFromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
+ UConverterToUnicodeArgs *pToUArgs,
+ UErrorCode *pErrorCode) {
+ const uint8_t *source, *sourceLimit;
+ uint8_t *target;
+ int32_t targetCapacity, length;
+
+ uint8_t c;
+
+ if(pToUArgs->converter->toULength > 0) {
+ /* no handling of partial UTF-8 characters here, fall back to pivoting */
+ *pErrorCode=U_USING_DEFAULT_WARNING;
+ return;
+ }
+
+ /* set up the local pointers */
+ source=(const uint8_t *)pToUArgs->source;
+ sourceLimit=(const uint8_t *)pToUArgs->sourceLimit;
+ target=(uint8_t *)pFromUArgs->target;
+ targetCapacity=(int32_t)(pFromUArgs->targetLimit-pFromUArgs->target);
+
+ /*
+ * since the conversion here is 1:1 uint8_t:uint8_t, we need only one counter
+ * for the minimum of the sourceLength and targetCapacity
+ */
+ length=(int32_t)(sourceLimit-source);
+ if(length<targetCapacity) {
+ targetCapacity=length;
+ }
+
+ /* unroll the loop with the most common case */
+ if(targetCapacity>=16) {
+ int32_t count, loops;
+ uint8_t oredChars;
+
+ loops=count=targetCapacity>>4;
+ do {
+ oredChars=*target++=*source++;
+ oredChars|=*target++=*source++;
+ oredChars|=*target++=*source++;
+ oredChars|=*target++=*source++;
+ oredChars|=*target++=*source++;
+ oredChars|=*target++=*source++;
+ oredChars|=*target++=*source++;
+ oredChars|=*target++=*source++;
+ oredChars|=*target++=*source++;
+ oredChars|=*target++=*source++;
+ oredChars|=*target++=*source++;
+ oredChars|=*target++=*source++;
+ oredChars|=*target++=*source++;
+ oredChars|=*target++=*source++;
+ oredChars|=*target++=*source++;
+ oredChars|=*target++=*source++;
+
+ /* were all 16 entries really valid? */
+ if(oredChars>0x7f) {
+ /* no, return to the first of these 16 */
+ source-=16;
+ target-=16;
+ break;
+ }
+ } while(--count>0);
+ count=loops-count;
+ targetCapacity-=16*count;
+ }
+
+ /* conversion loop */
+ c=0;
+ while(targetCapacity>0 && (c=*source)<=0x7f) {
+ ++source;
+ *target++=c;
+ --targetCapacity;
+ }
+
+ if(c>0x7f) {
+ /* non-ASCII character, handle in standard converter */
+ *pErrorCode=U_USING_DEFAULT_WARNING;
+ } else if(source<sourceLimit && target>=(const uint8_t *)pFromUArgs->targetLimit) {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ }
+
+ /* write back the updated pointers */
+ pToUArgs->source=(const char *)source;
+ pFromUArgs->target=(char *)target;
+}
+
+static void U_CALLCONV
+_ASCIIGetUnicodeSet(const UConverter *cnv,
+ const USetAdder *sa,
+ UConverterUnicodeSet which,
+ UErrorCode *pErrorCode) {
+ (void)cnv;
+ (void)which;
+ (void)pErrorCode;
+ sa->addRange(sa->set, 0, 0x7f);
+}
+U_CDECL_END
+
+static const UConverterImpl _ASCIIImpl={
+ UCNV_US_ASCII,
+
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+ NULL,
+
+ _ASCIIToUnicodeWithOffsets,
+ _ASCIIToUnicodeWithOffsets,
+ _Latin1FromUnicodeWithOffsets,
+ _Latin1FromUnicodeWithOffsets,
+ _ASCIIGetNextUChar,
+
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ _ASCIIGetUnicodeSet,
+
+ NULL,
+ ucnv_ASCIIFromUTF8
+};
+
+static const UConverterStaticData _ASCIIStaticData={
+ sizeof(UConverterStaticData),
+ "US-ASCII",
+ 367, UCNV_IBM, UCNV_US_ASCII, 1, 1,
+ { 0x1a, 0, 0, 0 }, 1, FALSE, FALSE,
+ 0,
+ 0,
+ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
+};
+
+const UConverterSharedData _ASCIIData=
+ UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_ASCIIStaticData, &_ASCIIImpl);
+
+#endif
diff --git a/contrib/libs/icu/common/ucnvmbcs.cpp b/contrib/libs/icu/common/ucnvmbcs.cpp
index 31115d228e..ca9b0a335a 100644
--- a/contrib/libs/icu/common/ucnvmbcs.cpp
+++ b/contrib/libs/icu/common/ucnvmbcs.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: ucnvmbcs.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -59,7 +59,7 @@
#include "cmemory.h"
#include "cstring.h"
#include "umutex.h"
-#include "ustr_imp.h"
+#include "ustr_imp.h"
/* control optimizations according to the platform */
#define MBCS_UNROLL_SINGLE_TO_BMP 1
@@ -1383,7 +1383,7 @@ _EBCDICSwapLFNL(UConverterSharedData *sharedData, UErrorCode *pErrorCode) {
uprv_strcat(name, UCNV_SWAP_LFNL_OPTION_STRING);
/* set the pointers */
- icu::umtx_lock(NULL);
+ icu::umtx_lock(NULL);
if(mbcsTable->swapLFNLStateTable==NULL) {
mbcsTable->swapLFNLStateTable=newStateTable;
mbcsTable->swapLFNLFromUnicodeBytes=(uint8_t *)newResults;
@@ -1391,7 +1391,7 @@ _EBCDICSwapLFNL(UConverterSharedData *sharedData, UErrorCode *pErrorCode) {
newStateTable=NULL;
}
- icu::umtx_unlock(NULL);
+ icu::umtx_unlock(NULL);
/* release the allocated memory if another thread beat us to it */
if(newStateTable!=NULL) {
@@ -1919,9 +1919,9 @@ ucnv_MBCSOpen(UConverter *cnv,
/* do this because double-checked locking is broken */
UBool isCached;
- icu::umtx_lock(NULL);
+ icu::umtx_lock(NULL);
isCached=mbcsTable->swapLFNLStateTable!=NULL;
- icu::umtx_unlock(NULL);
+ icu::umtx_unlock(NULL);
if(!isCached) {
if(!_EBCDICSwapLFNL(cnv->sharedData, pErrorCode)) {
@@ -4164,8 +4164,8 @@ ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
nextSourceIndex=0;
/* Get the SI/SO character for the converter */
- siLength = static_cast<uint8_t>(getSISOBytes(SI, cnv->options, siBytes));
- soLength = static_cast<uint8_t>(getSISOBytes(SO, cnv->options, soBytes));
+ siLength = static_cast<uint8_t>(getSISOBytes(SI, cnv->options, siBytes));
+ soLength = static_cast<uint8_t>(getSISOBytes(SO, cnv->options, soBytes));
/* conversion loop */
/*
@@ -5014,7 +5014,7 @@ ucnv_MBCSSingleFromUChar32(UConverterSharedData *sharedData,
/* offsets for n-byte UTF-8 sequences that were calculated with ((lead<<6)+trail)<<6+trail... */
static const UChar32
-utf8_offsets[5]={ 0, 0, 0x3080, 0xE2080, 0x3C82080 };
+utf8_offsets[5]={ 0, 0, 0x3080, 0xE2080, 0x3C82080 };
static void U_CALLCONV
ucnv_SBCSFromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
@@ -5034,7 +5034,7 @@ ucnv_SBCSFromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
uint8_t b, t1, t2;
uint32_t asciiRoundtrips;
- uint16_t value, minValue = 0;
+ uint16_t value, minValue = 0;
UBool hasSupplementary;
/* set up the local pointers */
@@ -5064,36 +5064,36 @@ ucnv_SBCSFromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
hasSupplementary=(UBool)(cnv->sharedData->mbcs.unicodeMask&UCNV_HAS_SUPPLEMENTARY);
/* get the converter state from the UTF-8 UConverter */
- if(utf8->toULength > 0) {
+ if(utf8->toULength > 0) {
toULength=oldToULength=utf8->toULength;
toULimit=(int8_t)utf8->mode;
- c=(UChar32)utf8->toUnicodeStatus;
+ c=(UChar32)utf8->toUnicodeStatus;
} else {
toULength=oldToULength=toULimit=0;
- c = 0;
+ c = 0;
}
- // The conversion loop checks source<sourceLimit only once per 1/2/3-byte character.
- // If the buffer ends with a truncated 2- or 3-byte sequence,
- // then we reduce the sourceLimit to before that,
- // and collect the remaining bytes after the conversion loop.
+ // The conversion loop checks source<sourceLimit only once per 1/2/3-byte character.
+ // If the buffer ends with a truncated 2- or 3-byte sequence,
+ // then we reduce the sourceLimit to before that,
+ // and collect the remaining bytes after the conversion loop.
{
- // Do not go back into the bytes that will be read for finishing a partial
- // sequence from the previous buffer.
- int32_t length=(int32_t)(sourceLimit-source) - (toULimit-oldToULength);
- if(length>0) {
- uint8_t b1=*(sourceLimit-1);
- if(U8_IS_SINGLE(b1)) {
- // common ASCII character
- } else if(U8_IS_TRAIL(b1) && length>=2) {
- uint8_t b2=*(sourceLimit-2);
- if(0xe0<=b2 && b2<0xf0 && U8_IS_VALID_LEAD3_AND_T1(b2, b1)) {
- // truncated 3-byte sequence
- sourceLimit-=2;
+ // Do not go back into the bytes that will be read for finishing a partial
+ // sequence from the previous buffer.
+ int32_t length=(int32_t)(sourceLimit-source) - (toULimit-oldToULength);
+ if(length>0) {
+ uint8_t b1=*(sourceLimit-1);
+ if(U8_IS_SINGLE(b1)) {
+ // common ASCII character
+ } else if(U8_IS_TRAIL(b1) && length>=2) {
+ uint8_t b2=*(sourceLimit-2);
+ if(0xe0<=b2 && b2<0xf0 && U8_IS_VALID_LEAD3_AND_T1(b2, b1)) {
+ // truncated 3-byte sequence
+ sourceLimit-=2;
}
- } else if(0xc2<=b1 && b1<0xf0) {
- // truncated 2- or 3-byte sequence
- --sourceLimit;
+ } else if(0xc2<=b1 && b1<0xf0) {
+ // truncated 2- or 3-byte sequence
+ --sourceLimit;
}
}
}
@@ -5127,7 +5127,7 @@ ucnv_SBCSFromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
while(source<sourceLimit) {
if(targetCapacity>0) {
b=*source++;
- if(U8_IS_SINGLE(b)) {
+ if(U8_IS_SINGLE(b)) {
/* convert ASCII */
if(IS_ASCII_ROUNDTRIP(b, asciiRoundtrips)) {
*target++=(uint8_t)b;
@@ -5182,7 +5182,7 @@ ucnv_SBCSFromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
/* handle "complicated" and error cases, and continuing partial characters */
oldToULength=0;
toULength=1;
- toULimit=U8_COUNT_BYTES_NON_ASCII(b);
+ toULimit=U8_COUNT_BYTES_NON_ASCII(b);
c=b;
moreBytes:
while(toULength<toULimit) {
@@ -5195,7 +5195,7 @@ moreBytes:
*/
if(source<(uint8_t *)pToUArgs->sourceLimit) {
b=*source;
- if(icu::UTF8::isValidTrail(c, b, toULength, toULimit)) {
+ if(icu::UTF8::isValidTrail(c, b, toULength, toULimit)) {
++source;
++toULength;
c=(c<<6)+b;
@@ -5217,18 +5217,18 @@ moreBytes:
}
}
- if(toULength==toULimit) {
- c-=utf8_offsets[toULength];
- if(toULength<=3) { /* BMP */
- value=MBCS_SINGLE_RESULT_FROM_U(table, results, c);
+ if(toULength==toULimit) {
+ c-=utf8_offsets[toULength];
+ if(toULength<=3) { /* BMP */
+ value=MBCS_SINGLE_RESULT_FROM_U(table, results, c);
} else {
- /* supplementary code point */
- if(!hasSupplementary) {
- /* BMP-only codepages are stored without stage 1 entries for supplementary code points */
- value=0;
- } else {
- value=MBCS_SINGLE_RESULT_FROM_U(table, results, c);
- }
+ /* supplementary code point */
+ if(!hasSupplementary) {
+ /* BMP-only codepages are stored without stage 1 entries for supplementary code points */
+ value=0;
+ } else {
+ value=MBCS_SINGLE_RESULT_FROM_U(table, results, c);
+ }
}
} else {
/* error handling: illegal UTF-8 byte sequence */
@@ -5303,7 +5303,7 @@ moreBytes:
source<(sourceLimit=(uint8_t *)pToUArgs->sourceLimit)) {
c=utf8->toUBytes[0]=b=*source++;
toULength=1;
- toULimit=U8_COUNT_BYTES(b);
+ toULimit=U8_COUNT_BYTES(b);
while(source<sourceLimit) {
utf8->toUBytes[toULength++]=b=*source++;
c=(c<<6)+b;
@@ -5337,7 +5337,7 @@ ucnv_DBCSFromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
uint32_t stage2Entry;
uint32_t asciiRoundtrips;
- uint16_t value = 0;
+ uint16_t value = 0;
UBool hasSupplementary;
/* set up the local pointers */
@@ -5360,36 +5360,36 @@ ucnv_DBCSFromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
hasSupplementary=(UBool)(cnv->sharedData->mbcs.unicodeMask&UCNV_HAS_SUPPLEMENTARY);
/* get the converter state from the UTF-8 UConverter */
- if(utf8->toULength > 0) {
+ if(utf8->toULength > 0) {
toULength=oldToULength=utf8->toULength;
toULimit=(int8_t)utf8->mode;
- c=(UChar32)utf8->toUnicodeStatus;
+ c=(UChar32)utf8->toUnicodeStatus;
} else {
toULength=oldToULength=toULimit=0;
- c = 0;
+ c = 0;
}
- // The conversion loop checks source<sourceLimit only once per 1/2/3-byte character.
- // If the buffer ends with a truncated 2- or 3-byte sequence,
- // then we reduce the sourceLimit to before that,
- // and collect the remaining bytes after the conversion loop.
+ // The conversion loop checks source<sourceLimit only once per 1/2/3-byte character.
+ // If the buffer ends with a truncated 2- or 3-byte sequence,
+ // then we reduce the sourceLimit to before that,
+ // and collect the remaining bytes after the conversion loop.
{
- // Do not go back into the bytes that will be read for finishing a partial
- // sequence from the previous buffer.
- int32_t length=(int32_t)(sourceLimit-source) - (toULimit-oldToULength);
- if(length>0) {
- uint8_t b1=*(sourceLimit-1);
- if(U8_IS_SINGLE(b1)) {
- // common ASCII character
- } else if(U8_IS_TRAIL(b1) && length>=2) {
- uint8_t b2=*(sourceLimit-2);
- if(0xe0<=b2 && b2<0xf0 && U8_IS_VALID_LEAD3_AND_T1(b2, b1)) {
- // truncated 3-byte sequence
- sourceLimit-=2;
+ // Do not go back into the bytes that will be read for finishing a partial
+ // sequence from the previous buffer.
+ int32_t length=(int32_t)(sourceLimit-source) - (toULimit-oldToULength);
+ if(length>0) {
+ uint8_t b1=*(sourceLimit-1);
+ if(U8_IS_SINGLE(b1)) {
+ // common ASCII character
+ } else if(U8_IS_TRAIL(b1) && length>=2) {
+ uint8_t b2=*(sourceLimit-2);
+ if(0xe0<=b2 && b2<0xf0 && U8_IS_VALID_LEAD3_AND_T1(b2, b1)) {
+ // truncated 3-byte sequence
+ sourceLimit-=2;
}
- } else if(0xc2<=b1 && b1<0xf0) {
- // truncated 2- or 3-byte sequence
- --sourceLimit;
+ } else if(0xc2<=b1 && b1<0xf0) {
+ // truncated 2- or 3-byte sequence
+ --sourceLimit;
}
}
}
@@ -5405,7 +5405,7 @@ ucnv_DBCSFromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
while(source<sourceLimit) {
if(targetCapacity>0) {
b=*source++;
- if(U8_IS_SINGLE(b)) {
+ if(U8_IS_SINGLE(b)) {
/* convert ASCII */
if(IS_ASCII_ROUNDTRIP(b, asciiRoundtrips)) {
*target++=b;
@@ -5419,13 +5419,13 @@ ucnv_DBCSFromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
}
}
} else {
- if(b>=0xe0) {
- if( /* handle U+0800..U+D7FF inline */
- b<=0xed && // do not assume maxFastUChar>0xd7ff
- U8_IS_VALID_LEAD3_AND_T1(b, t1=source[0]) &&
+ if(b>=0xe0) {
+ if( /* handle U+0800..U+D7FF inline */
+ b<=0xed && // do not assume maxFastUChar>0xd7ff
+ U8_IS_VALID_LEAD3_AND_T1(b, t1=source[0]) &&
(t2=(uint8_t)(source[1]-0x80)) <= 0x3f
) {
- c=((b&0xf)<<6)|(t1&0x3f);
+ c=((b&0xf)<<6)|(t1&0x3f);
source+=2;
value=DBCS_RESULT_FROM_UTF8(mbcsIndex, results, c, t2);
if(value==0) {
@@ -5435,7 +5435,7 @@ ucnv_DBCSFromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
} else {
c=-1;
}
- } else {
+ } else {
if( /* handle U+0080..U+07FF inline */
b>=0xc2 &&
(t1=(uint8_t)(*source-0x80)) <= 0x3f
@@ -5456,7 +5456,7 @@ ucnv_DBCSFromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
/* handle "complicated" and error cases, and continuing partial characters */
oldToULength=0;
toULength=1;
- toULimit=U8_COUNT_BYTES_NON_ASCII(b);
+ toULimit=U8_COUNT_BYTES_NON_ASCII(b);
c=b;
moreBytes:
while(toULength<toULimit) {
@@ -5469,7 +5469,7 @@ moreBytes:
*/
if(source<(uint8_t *)pToUArgs->sourceLimit) {
b=*source;
- if(icu::UTF8::isValidTrail(c, b, toULength, toULimit)) {
+ if(icu::UTF8::isValidTrail(c, b, toULength, toULimit)) {
++source;
++toULength;
c=(c<<6)+b;
@@ -5491,18 +5491,18 @@ moreBytes:
}
}
- if(toULength==toULimit) {
- c-=utf8_offsets[toULength];
- if(toULength<=3) { /* BMP */
- stage2Entry=MBCS_STAGE_2_FROM_U(table, c);
+ if(toULength==toULimit) {
+ c-=utf8_offsets[toULength];
+ if(toULength<=3) { /* BMP */
+ stage2Entry=MBCS_STAGE_2_FROM_U(table, c);
} else {
- /* supplementary code point */
- if(!hasSupplementary) {
- /* BMP-only codepages are stored without stage 1 entries for supplementary code points */
- stage2Entry=0;
- } else {
- stage2Entry=MBCS_STAGE_2_FROM_U(table, c);
- }
+ /* supplementary code point */
+ if(!hasSupplementary) {
+ /* BMP-only codepages are stored without stage 1 entries for supplementary code points */
+ stage2Entry=0;
+ } else {
+ stage2Entry=MBCS_STAGE_2_FROM_U(table, c);
+ }
}
} else {
/* error handling: illegal UTF-8 byte sequence */
@@ -5607,7 +5607,7 @@ unassigned:
source<(sourceLimit=(uint8_t *)pToUArgs->sourceLimit)) {
c=utf8->toUBytes[0]=b=*source++;
toULength=1;
- toULimit=U8_COUNT_BYTES(b);
+ toULimit=U8_COUNT_BYTES(b);
while(source<sourceLimit) {
utf8->toUBytes[toULength++]=b=*source++;
c=(c<<6)+b;
diff --git a/contrib/libs/icu/common/ucnvmbcs.h b/contrib/libs/icu/common/ucnvmbcs.h
index 0026d23d75..209cdc532d 100644
--- a/contrib/libs/icu/common/ucnvmbcs.h
+++ b/contrib/libs/icu/common/ucnvmbcs.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: ucnvmbcs.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/ucnvscsu.cpp b/contrib/libs/icu/common/ucnvscsu.cpp
index cc818188f0..74b5722b97 100644
--- a/contrib/libs/icu/common/ucnvscsu.cpp
+++ b/contrib/libs/icu/common/ucnvscsu.cpp
@@ -1,2045 +1,2045 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 2000-2016, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-* file name: ucnvscsu.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 2000nov18
-* created by: Markus W. Scherer
-*
-* This is an implementation of the Standard Compression Scheme for Unicode
-* as defined in http://www.unicode.org/unicode/reports/tr6/ .
-* Reserved commands and window settings are treated as illegal sequences and
-* will result in callback calls.
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION
-
-#include "unicode/ucnv.h"
-#include "unicode/ucnv_cb.h"
-#include "unicode/utf16.h"
-#include "ucnv_bld.h"
-#include "ucnv_cnv.h"
-#include "cmemory.h"
-
-/* SCSU definitions --------------------------------------------------------- */
-
-/* SCSU command byte values */
-enum {
- SQ0=0x01, /* Quote from window pair 0 */
- SQ7=0x08, /* Quote from window pair 7 */
- SDX=0x0B, /* Define a window as extended */
- Srs=0x0C, /* reserved */
- SQU=0x0E, /* Quote a single Unicode character */
- SCU=0x0F, /* Change to Unicode mode */
- SC0=0x10, /* Select window 0 */
- SC7=0x17, /* Select window 7 */
- SD0=0x18, /* Define and select window 0 */
- SD7=0x1F, /* Define and select window 7 */
-
- UC0=0xE0, /* Select window 0 */
- UC7=0xE7, /* Select window 7 */
- UD0=0xE8, /* Define and select window 0 */
- UD7=0xEF, /* Define and select window 7 */
- UQU=0xF0, /* Quote a single Unicode character */
- UDX=0xF1, /* Define a Window as extended */
- Urs=0xF2 /* reserved */
-};
-
-enum {
- /*
- * Unicode code points from 3400 to E000 are not adressible by
- * dynamic window, since in these areas no short run alphabets are
- * found. Therefore add gapOffset to all values from gapThreshold.
- */
- gapThreshold=0x68,
- gapOffset=0xAC00,
-
- /* values between reservedStart and fixedThreshold are reserved */
- reservedStart=0xA8,
-
- /* use table of predefined fixed offsets for values from fixedThreshold */
- fixedThreshold=0xF9
-};
-
-/* constant offsets for the 8 static windows */
-static const uint32_t staticOffsets[8]={
- 0x0000, /* ASCII for quoted tags */
- 0x0080, /* Latin - 1 Supplement (for access to punctuation) */
- 0x0100, /* Latin Extended-A */
- 0x0300, /* Combining Diacritical Marks */
- 0x2000, /* General Punctuation */
- 0x2080, /* Currency Symbols */
- 0x2100, /* Letterlike Symbols and Number Forms */
- 0x3000 /* CJK Symbols and punctuation */
-};
-
-/* initial offsets for the 8 dynamic (sliding) windows */
-static const uint32_t initialDynamicOffsets[8]={
- 0x0080, /* Latin-1 */
- 0x00C0, /* Latin Extended A */
- 0x0400, /* Cyrillic */
- 0x0600, /* Arabic */
- 0x0900, /* Devanagari */
- 0x3040, /* Hiragana */
- 0x30A0, /* Katakana */
- 0xFF00 /* Fullwidth ASCII */
-};
-
-/* Table of fixed predefined Offsets */
-static const uint32_t fixedOffsets[]={
- /* 0xF9 */ 0x00C0, /* Latin-1 Letters + half of Latin Extended A */
- /* 0xFA */ 0x0250, /* IPA extensions */
- /* 0xFB */ 0x0370, /* Greek */
- /* 0xFC */ 0x0530, /* Armenian */
- /* 0xFD */ 0x3040, /* Hiragana */
- /* 0xFE */ 0x30A0, /* Katakana */
- /* 0xFF */ 0xFF60 /* Halfwidth Katakana */
-};
-
-/* state values */
-enum {
- readCommand,
- quotePairOne,
- quotePairTwo,
- quoteOne,
- definePairOne,
- definePairTwo,
- defineOne
-};
-
-typedef struct SCSUData {
- /* dynamic window offsets, intitialize to default values from initialDynamicOffsets */
- uint32_t toUDynamicOffsets[8];
- uint32_t fromUDynamicOffsets[8];
-
- /* state machine state - toUnicode */
- UBool toUIsSingleByteMode;
- uint8_t toUState;
- int8_t toUQuoteWindow, toUDynamicWindow;
- uint8_t toUByteOne;
- uint8_t toUPadding[3];
-
- /* state machine state - fromUnicode */
- UBool fromUIsSingleByteMode;
- int8_t fromUDynamicWindow;
-
- /*
- * windowUse[] keeps track of the use of the dynamic windows:
- * At nextWindowUseIndex there is the least recently used window,
- * and the following windows (in a wrapping manner) are more and more
- * recently used.
- * At nextWindowUseIndex-1 there is the most recently used window.
- */
- uint8_t locale;
- int8_t nextWindowUseIndex;
- int8_t windowUse[8];
-} SCSUData;
-
-static const int8_t initialWindowUse[8]={ 7, 0, 3, 2, 4, 5, 6, 1 };
-static const int8_t initialWindowUse_ja[8]={ 3, 2, 4, 1, 0, 7, 5, 6 };
-
-enum {
- lGeneric, l_ja
-};
-
-/* SCSU setup functions ----------------------------------------------------- */
-U_CDECL_BEGIN
-static void U_CALLCONV
-_SCSUReset(UConverter *cnv, UConverterResetChoice choice) {
- SCSUData *scsu=(SCSUData *)cnv->extraInfo;
-
- if(choice<=UCNV_RESET_TO_UNICODE) {
- /* reset toUnicode */
- uprv_memcpy(scsu->toUDynamicOffsets, initialDynamicOffsets, 32);
-
- scsu->toUIsSingleByteMode=TRUE;
- scsu->toUState=readCommand;
- scsu->toUQuoteWindow=scsu->toUDynamicWindow=0;
- scsu->toUByteOne=0;
-
- cnv->toULength=0;
- }
- if(choice!=UCNV_RESET_TO_UNICODE) {
- /* reset fromUnicode */
- uprv_memcpy(scsu->fromUDynamicOffsets, initialDynamicOffsets, 32);
-
- scsu->fromUIsSingleByteMode=TRUE;
- scsu->fromUDynamicWindow=0;
-
- scsu->nextWindowUseIndex=0;
- switch(scsu->locale) {
- case l_ja:
- uprv_memcpy(scsu->windowUse, initialWindowUse_ja, 8);
- break;
- default:
- uprv_memcpy(scsu->windowUse, initialWindowUse, 8);
- break;
- }
-
- cnv->fromUChar32=0;
- }
-}
-
-static void U_CALLCONV
-_SCSUOpen(UConverter *cnv,
- UConverterLoadArgs *pArgs,
- UErrorCode *pErrorCode) {
- const char *locale=pArgs->locale;
- if(pArgs->onlyTestIsLoadable) {
- return;
- }
- cnv->extraInfo=uprv_malloc(sizeof(SCSUData));
- if(cnv->extraInfo!=NULL) {
- if(locale!=NULL && locale[0]=='j' && locale[1]=='a' && (locale[2]==0 || locale[2]=='_')) {
- ((SCSUData *)cnv->extraInfo)->locale=l_ja;
- } else {
- ((SCSUData *)cnv->extraInfo)->locale=lGeneric;
- }
- _SCSUReset(cnv, UCNV_RESET_BOTH);
- } else {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- }
-
- /* Set the substitution character U+fffd as a Unicode string. */
- cnv->subUChars[0]=0xfffd;
- cnv->subCharLen=-1;
-}
-
-static void U_CALLCONV
-_SCSUClose(UConverter *cnv) {
- if(cnv->extraInfo!=NULL) {
- if(!cnv->isExtraLocal) {
- uprv_free(cnv->extraInfo);
- }
- cnv->extraInfo=NULL;
- }
-}
-
-/* SCSU-to-Unicode conversion functions ------------------------------------- */
-
-static void U_CALLCONV
-_SCSUToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- UConverter *cnv;
- SCSUData *scsu;
- const uint8_t *source, *sourceLimit;
- UChar *target;
- const UChar *targetLimit;
- int32_t *offsets;
- UBool isSingleByteMode;
- uint8_t state, byteOne;
- int8_t quoteWindow, dynamicWindow;
-
- int32_t sourceIndex, nextSourceIndex;
-
- uint8_t b;
-
- /* set up the local pointers */
- cnv=pArgs->converter;
- scsu=(SCSUData *)cnv->extraInfo;
-
- source=(const uint8_t *)pArgs->source;
- sourceLimit=(const uint8_t *)pArgs->sourceLimit;
- target=pArgs->target;
- targetLimit=pArgs->targetLimit;
- offsets=pArgs->offsets;
-
- /* get the state machine state */
- isSingleByteMode=scsu->toUIsSingleByteMode;
- state=scsu->toUState;
- quoteWindow=scsu->toUQuoteWindow;
- dynamicWindow=scsu->toUDynamicWindow;
- byteOne=scsu->toUByteOne;
-
- /* sourceIndex=-1 if the current character began in the previous buffer */
- sourceIndex=state==readCommand ? 0 : -1;
- nextSourceIndex=0;
-
- /*
- * conversion "loop"
- *
- * For performance, this is not a normal C loop.
- * Instead, there are two code blocks for the two SCSU modes.
- * The function branches to either one, and a change of the mode is done with a goto to
- * the other branch.
- *
- * Each branch has two conventional loops:
- * - a fast-path loop for the most common codes in the mode
- * - a loop for all other codes in the mode
- * When the fast-path runs into a code that it cannot handle, its loop ends and it
- * runs into the following loop to handle the other codes.
- * The end of the input or output buffer is also handled by the slower loop.
- * The slow loop jumps (goto) to the fast-path loop again as soon as possible.
- *
- * The callback handling is done by returning with an error code.
- * The conversion framework actually calls the callback function.
- */
- if(isSingleByteMode) {
- /* fast path for single-byte mode */
- if(state==readCommand) {
-fastSingle:
- while(source<sourceLimit && target<targetLimit && (b=*source)>=0x20) {
- ++source;
- ++nextSourceIndex;
- if(b<=0x7f) {
- /* write US-ASCII graphic character or DEL */
- *target++=(UChar)b;
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- } else {
- /* write from dynamic window */
- uint32_t c=scsu->toUDynamicOffsets[dynamicWindow]+(b&0x7f);
- if(c<=0xffff) {
- *target++=(UChar)c;
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- } else {
- /* output surrogate pair */
- *target++=(UChar)(0xd7c0+(c>>10));
- if(target<targetLimit) {
- *target++=(UChar)(0xdc00|(c&0x3ff));
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- *offsets++=sourceIndex;
- }
- } else {
- /* target overflow */
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- cnv->UCharErrorBuffer[0]=(UChar)(0xdc00|(c&0x3ff));
- cnv->UCharErrorBufferLength=1;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- goto endloop;
- }
- }
- }
- sourceIndex=nextSourceIndex;
- }
- }
-
- /* normal state machine for single-byte mode, minus handling for what fastSingle covers */
-singleByteMode:
- while(source<sourceLimit) {
- if(target>=targetLimit) {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- b=*source++;
- ++nextSourceIndex;
- switch(state) {
- case readCommand:
- /* redundant conditions are commented out */
- /* here: b<0x20 because otherwise we would be in fastSingle */
- if((1UL<<b)&0x2601 /* binary 0010 0110 0000 0001, check for b==0xd || b==0xa || b==9 || b==0 */) {
- /* CR/LF/TAB/NUL */
- *target++=(UChar)b;
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- sourceIndex=nextSourceIndex;
- goto fastSingle;
- } else if(SC0<=b) {
- if(b<=SC7) {
- dynamicWindow=(int8_t)(b-SC0);
- sourceIndex=nextSourceIndex;
- goto fastSingle;
- } else /* if(SD0<=b && b<=SD7) */ {
- dynamicWindow=(int8_t)(b-SD0);
- state=defineOne;
- }
- } else if(/* SQ0<=b && */ b<=SQ7) {
- quoteWindow=(int8_t)(b-SQ0);
- state=quoteOne;
- } else if(b==SDX) {
- state=definePairOne;
- } else if(b==SQU) {
- state=quotePairOne;
- } else if(b==SCU) {
- sourceIndex=nextSourceIndex;
- isSingleByteMode=FALSE;
- goto fastUnicode;
- } else /* Srs */ {
- /* callback(illegal) */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- cnv->toUBytes[0]=b;
- cnv->toULength=1;
- goto endloop;
- }
-
- /* store the first byte of a multibyte sequence in toUBytes[] */
- cnv->toUBytes[0]=b;
- cnv->toULength=1;
- break;
- case quotePairOne:
- byteOne=b;
- cnv->toUBytes[1]=b;
- cnv->toULength=2;
- state=quotePairTwo;
- break;
- case quotePairTwo:
- *target++=(UChar)((byteOne<<8)|b);
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- sourceIndex=nextSourceIndex;
- state=readCommand;
- goto fastSingle;
- case quoteOne:
- if(b<0x80) {
- /* all static offsets are in the BMP */
- *target++=(UChar)(staticOffsets[quoteWindow]+b);
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- } else {
- /* write from dynamic window */
- uint32_t c=scsu->toUDynamicOffsets[quoteWindow]+(b&0x7f);
- if(c<=0xffff) {
- *target++=(UChar)c;
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- } else {
- /* output surrogate pair */
- *target++=(UChar)(0xd7c0+(c>>10));
- if(target<targetLimit) {
- *target++=(UChar)(0xdc00|(c&0x3ff));
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- *offsets++=sourceIndex;
- }
- } else {
- /* target overflow */
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- cnv->UCharErrorBuffer[0]=(UChar)(0xdc00|(c&0x3ff));
- cnv->UCharErrorBufferLength=1;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- goto endloop;
- }
- }
- }
- sourceIndex=nextSourceIndex;
- state=readCommand;
- goto fastSingle;
- case definePairOne:
- dynamicWindow=(int8_t)((b>>5)&7);
- byteOne=(uint8_t)(b&0x1f);
- cnv->toUBytes[1]=b;
- cnv->toULength=2;
- state=definePairTwo;
- break;
- case definePairTwo:
- scsu->toUDynamicOffsets[dynamicWindow]=0x10000+(byteOne<<15UL | b<<7UL);
- sourceIndex=nextSourceIndex;
- state=readCommand;
- goto fastSingle;
- case defineOne:
- if(b==0) {
- /* callback(illegal): Reserved window offset value 0 */
- cnv->toUBytes[1]=b;
- cnv->toULength=2;
- goto endloop;
- } else if(b<gapThreshold) {
- scsu->toUDynamicOffsets[dynamicWindow]=b<<7UL;
- } else if((uint8_t)(b-gapThreshold)<(reservedStart-gapThreshold)) {
- scsu->toUDynamicOffsets[dynamicWindow]=(b<<7UL)+gapOffset;
- } else if(b>=fixedThreshold) {
- scsu->toUDynamicOffsets[dynamicWindow]=fixedOffsets[b-fixedThreshold];
- } else {
- /* callback(illegal): Reserved window offset value 0xa8..0xf8 */
- cnv->toUBytes[1]=b;
- cnv->toULength=2;
- goto endloop;
- }
- sourceIndex=nextSourceIndex;
- state=readCommand;
- goto fastSingle;
- }
- }
- } else {
- /* fast path for Unicode mode */
- if(state==readCommand) {
-fastUnicode:
- while(source+1<sourceLimit && target<targetLimit && (uint8_t)((b=*source)-UC0)>(Urs-UC0)) {
- *target++=(UChar)((b<<8)|source[1]);
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- sourceIndex=nextSourceIndex;
- nextSourceIndex+=2;
- source+=2;
- }
- }
-
- /* normal state machine for Unicode mode */
-/* unicodeByteMode: */
- while(source<sourceLimit) {
- if(target>=targetLimit) {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- b=*source++;
- ++nextSourceIndex;
- switch(state) {
- case readCommand:
- if((uint8_t)(b-UC0)>(Urs-UC0)) {
- byteOne=b;
- cnv->toUBytes[0]=b;
- cnv->toULength=1;
- state=quotePairTwo;
- } else if(/* UC0<=b && */ b<=UC7) {
- dynamicWindow=(int8_t)(b-UC0);
- sourceIndex=nextSourceIndex;
- isSingleByteMode=TRUE;
- goto fastSingle;
- } else if(/* UD0<=b && */ b<=UD7) {
- dynamicWindow=(int8_t)(b-UD0);
- isSingleByteMode=TRUE;
- cnv->toUBytes[0]=b;
- cnv->toULength=1;
- state=defineOne;
- goto singleByteMode;
- } else if(b==UDX) {
- isSingleByteMode=TRUE;
- cnv->toUBytes[0]=b;
- cnv->toULength=1;
- state=definePairOne;
- goto singleByteMode;
- } else if(b==UQU) {
- cnv->toUBytes[0]=b;
- cnv->toULength=1;
- state=quotePairOne;
- } else /* Urs */ {
- /* callback(illegal) */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- cnv->toUBytes[0]=b;
- cnv->toULength=1;
- goto endloop;
- }
- break;
- case quotePairOne:
- byteOne=b;
- cnv->toUBytes[1]=b;
- cnv->toULength=2;
- state=quotePairTwo;
- break;
- case quotePairTwo:
- *target++=(UChar)((byteOne<<8)|b);
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- sourceIndex=nextSourceIndex;
- state=readCommand;
- goto fastUnicode;
- }
- }
- }
-endloop:
-
- /* set the converter state back into UConverter */
- if(U_FAILURE(*pErrorCode) && *pErrorCode!=U_BUFFER_OVERFLOW_ERROR) {
- /* reset to deal with the next character */
- state=readCommand;
- } else if(state==readCommand) {
- /* not in a multi-byte sequence, reset toULength */
- cnv->toULength=0;
- }
- scsu->toUIsSingleByteMode=isSingleByteMode;
- scsu->toUState=state;
- scsu->toUQuoteWindow=quoteWindow;
- scsu->toUDynamicWindow=dynamicWindow;
- scsu->toUByteOne=byteOne;
-
- /* write back the updated pointers */
- pArgs->source=(const char *)source;
- pArgs->target=target;
- pArgs->offsets=offsets;
- return;
-}
-
-/*
- * Identical to _SCSUToUnicodeWithOffsets but without offset handling.
- * If a change is made in the original function, then either
- * change this function the same way or
- * re-copy the original function and remove the variables
- * offsets, sourceIndex, and nextSourceIndex.
- */
-static void U_CALLCONV
-_SCSUToUnicode(UConverterToUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- UConverter *cnv;
- SCSUData *scsu;
- const uint8_t *source, *sourceLimit;
- UChar *target;
- const UChar *targetLimit;
- UBool isSingleByteMode;
- uint8_t state, byteOne;
- int8_t quoteWindow, dynamicWindow;
-
- uint8_t b;
-
- /* set up the local pointers */
- cnv=pArgs->converter;
- scsu=(SCSUData *)cnv->extraInfo;
-
- source=(const uint8_t *)pArgs->source;
- sourceLimit=(const uint8_t *)pArgs->sourceLimit;
- target=pArgs->target;
- targetLimit=pArgs->targetLimit;
-
- /* get the state machine state */
- isSingleByteMode=scsu->toUIsSingleByteMode;
- state=scsu->toUState;
- quoteWindow=scsu->toUQuoteWindow;
- dynamicWindow=scsu->toUDynamicWindow;
- byteOne=scsu->toUByteOne;
-
- /*
- * conversion "loop"
- *
- * For performance, this is not a normal C loop.
- * Instead, there are two code blocks for the two SCSU modes.
- * The function branches to either one, and a change of the mode is done with a goto to
- * the other branch.
- *
- * Each branch has two conventional loops:
- * - a fast-path loop for the most common codes in the mode
- * - a loop for all other codes in the mode
- * When the fast-path runs into a code that it cannot handle, its loop ends and it
- * runs into the following loop to handle the other codes.
- * The end of the input or output buffer is also handled by the slower loop.
- * The slow loop jumps (goto) to the fast-path loop again as soon as possible.
- *
- * The callback handling is done by returning with an error code.
- * The conversion framework actually calls the callback function.
- */
- if(isSingleByteMode) {
- /* fast path for single-byte mode */
- if(state==readCommand) {
-fastSingle:
- while(source<sourceLimit && target<targetLimit && (b=*source)>=0x20) {
- ++source;
- if(b<=0x7f) {
- /* write US-ASCII graphic character or DEL */
- *target++=(UChar)b;
- } else {
- /* write from dynamic window */
- uint32_t c=scsu->toUDynamicOffsets[dynamicWindow]+(b&0x7f);
- if(c<=0xffff) {
- *target++=(UChar)c;
- } else {
- /* output surrogate pair */
- *target++=(UChar)(0xd7c0+(c>>10));
- if(target<targetLimit) {
- *target++=(UChar)(0xdc00|(c&0x3ff));
- } else {
- /* target overflow */
- cnv->UCharErrorBuffer[0]=(UChar)(0xdc00|(c&0x3ff));
- cnv->UCharErrorBufferLength=1;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- goto endloop;
- }
- }
- }
- }
- }
-
- /* normal state machine for single-byte mode, minus handling for what fastSingle covers */
-singleByteMode:
- while(source<sourceLimit) {
- if(target>=targetLimit) {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- b=*source++;
- switch(state) {
- case readCommand:
- /* redundant conditions are commented out */
- /* here: b<0x20 because otherwise we would be in fastSingle */
- if((1UL<<b)&0x2601 /* binary 0010 0110 0000 0001, check for b==0xd || b==0xa || b==9 || b==0 */) {
- /* CR/LF/TAB/NUL */
- *target++=(UChar)b;
- goto fastSingle;
- } else if(SC0<=b) {
- if(b<=SC7) {
- dynamicWindow=(int8_t)(b-SC0);
- goto fastSingle;
- } else /* if(SD0<=b && b<=SD7) */ {
- dynamicWindow=(int8_t)(b-SD0);
- state=defineOne;
- }
- } else if(/* SQ0<=b && */ b<=SQ7) {
- quoteWindow=(int8_t)(b-SQ0);
- state=quoteOne;
- } else if(b==SDX) {
- state=definePairOne;
- } else if(b==SQU) {
- state=quotePairOne;
- } else if(b==SCU) {
- isSingleByteMode=FALSE;
- goto fastUnicode;
- } else /* Srs */ {
- /* callback(illegal) */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- cnv->toUBytes[0]=b;
- cnv->toULength=1;
- goto endloop;
- }
-
- /* store the first byte of a multibyte sequence in toUBytes[] */
- cnv->toUBytes[0]=b;
- cnv->toULength=1;
- break;
- case quotePairOne:
- byteOne=b;
- cnv->toUBytes[1]=b;
- cnv->toULength=2;
- state=quotePairTwo;
- break;
- case quotePairTwo:
- *target++=(UChar)((byteOne<<8)|b);
- state=readCommand;
- goto fastSingle;
- case quoteOne:
- if(b<0x80) {
- /* all static offsets are in the BMP */
- *target++=(UChar)(staticOffsets[quoteWindow]+b);
- } else {
- /* write from dynamic window */
- uint32_t c=scsu->toUDynamicOffsets[quoteWindow]+(b&0x7f);
- if(c<=0xffff) {
- *target++=(UChar)c;
- } else {
- /* output surrogate pair */
- *target++=(UChar)(0xd7c0+(c>>10));
- if(target<targetLimit) {
- *target++=(UChar)(0xdc00|(c&0x3ff));
- } else {
- /* target overflow */
- cnv->UCharErrorBuffer[0]=(UChar)(0xdc00|(c&0x3ff));
- cnv->UCharErrorBufferLength=1;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- goto endloop;
- }
- }
- }
- state=readCommand;
- goto fastSingle;
- case definePairOne:
- dynamicWindow=(int8_t)((b>>5)&7);
- byteOne=(uint8_t)(b&0x1f);
- cnv->toUBytes[1]=b;
- cnv->toULength=2;
- state=definePairTwo;
- break;
- case definePairTwo:
- scsu->toUDynamicOffsets[dynamicWindow]=0x10000+(byteOne<<15UL | b<<7UL);
- state=readCommand;
- goto fastSingle;
- case defineOne:
- if(b==0) {
- /* callback(illegal): Reserved window offset value 0 */
- cnv->toUBytes[1]=b;
- cnv->toULength=2;
- goto endloop;
- } else if(b<gapThreshold) {
- scsu->toUDynamicOffsets[dynamicWindow]=b<<7UL;
- } else if((uint8_t)(b-gapThreshold)<(reservedStart-gapThreshold)) {
- scsu->toUDynamicOffsets[dynamicWindow]=(b<<7UL)+gapOffset;
- } else if(b>=fixedThreshold) {
- scsu->toUDynamicOffsets[dynamicWindow]=fixedOffsets[b-fixedThreshold];
- } else {
- /* callback(illegal): Reserved window offset value 0xa8..0xf8 */
- cnv->toUBytes[1]=b;
- cnv->toULength=2;
- goto endloop;
- }
- state=readCommand;
- goto fastSingle;
- }
- }
- } else {
- /* fast path for Unicode mode */
- if(state==readCommand) {
-fastUnicode:
- while(source+1<sourceLimit && target<targetLimit && (uint8_t)((b=*source)-UC0)>(Urs-UC0)) {
- *target++=(UChar)((b<<8)|source[1]);
- source+=2;
- }
- }
-
- /* normal state machine for Unicode mode */
-/* unicodeByteMode: */
- while(source<sourceLimit) {
- if(target>=targetLimit) {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- b=*source++;
- switch(state) {
- case readCommand:
- if((uint8_t)(b-UC0)>(Urs-UC0)) {
- byteOne=b;
- cnv->toUBytes[0]=b;
- cnv->toULength=1;
- state=quotePairTwo;
- } else if(/* UC0<=b && */ b<=UC7) {
- dynamicWindow=(int8_t)(b-UC0);
- isSingleByteMode=TRUE;
- goto fastSingle;
- } else if(/* UD0<=b && */ b<=UD7) {
- dynamicWindow=(int8_t)(b-UD0);
- isSingleByteMode=TRUE;
- cnv->toUBytes[0]=b;
- cnv->toULength=1;
- state=defineOne;
- goto singleByteMode;
- } else if(b==UDX) {
- isSingleByteMode=TRUE;
- cnv->toUBytes[0]=b;
- cnv->toULength=1;
- state=definePairOne;
- goto singleByteMode;
- } else if(b==UQU) {
- cnv->toUBytes[0]=b;
- cnv->toULength=1;
- state=quotePairOne;
- } else /* Urs */ {
- /* callback(illegal) */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- cnv->toUBytes[0]=b;
- cnv->toULength=1;
- goto endloop;
- }
- break;
- case quotePairOne:
- byteOne=b;
- cnv->toUBytes[1]=b;
- cnv->toULength=2;
- state=quotePairTwo;
- break;
- case quotePairTwo:
- *target++=(UChar)((byteOne<<8)|b);
- state=readCommand;
- goto fastUnicode;
- }
- }
- }
-endloop:
-
- /* set the converter state back into UConverter */
- if(U_FAILURE(*pErrorCode) && *pErrorCode!=U_BUFFER_OVERFLOW_ERROR) {
- /* reset to deal with the next character */
- state=readCommand;
- } else if(state==readCommand) {
- /* not in a multi-byte sequence, reset toULength */
- cnv->toULength=0;
- }
- scsu->toUIsSingleByteMode=isSingleByteMode;
- scsu->toUState=state;
- scsu->toUQuoteWindow=quoteWindow;
- scsu->toUDynamicWindow=dynamicWindow;
- scsu->toUByteOne=byteOne;
-
- /* write back the updated pointers */
- pArgs->source=(const char *)source;
- pArgs->target=target;
- return;
-}
-U_CDECL_END
-/* SCSU-from-Unicode conversion functions ----------------------------------- */
-
-/*
- * This SCSU Encoder is fairly simple but uses all SCSU commands to achieve
- * reasonable results. The lookahead is minimal.
- * Many cases are simple:
- * A character fits directly into the current mode, a dynamic or static window,
- * or is not compressible. These cases are tested first.
- * Real compression heuristics are applied to the rest, in code branches for
- * single/Unicode mode and BMP/supplementary code points.
- * The heuristics used here are extremely simple.
- */
-
-/* get the number of the window that this character is in, or -1 */
-static int8_t
-getWindow(const uint32_t offsets[8], uint32_t c) {
- int i;
- for(i=0; i<8; ++i) {
- if((uint32_t)(c-offsets[i])<=0x7f) {
- return (int8_t)(i);
- }
- }
- return -1;
-}
-
-/* is the character in the dynamic window starting at the offset, or in the direct-encoded range? */
-static UBool
-isInOffsetWindowOrDirect(uint32_t offset, uint32_t c) {
- return (UBool)(c<=offset+0x7f &&
- (c>=offset || (c<=0x7f &&
- (c>=0x20 || (1UL<<c)&0x2601))));
- /* binary 0010 0110 0000 0001,
- check for b==0xd || b==0xa || b==9 || b==0 */
-}
-
-/*
- * getNextDynamicWindow returns the next dynamic window to be redefined
- */
-static int8_t
-getNextDynamicWindow(SCSUData *scsu) {
- int8_t window=scsu->windowUse[scsu->nextWindowUseIndex];
- if(++scsu->nextWindowUseIndex==8) {
- scsu->nextWindowUseIndex=0;
- }
- return window;
-}
-
-/*
- * useDynamicWindow() adjusts
- * windowUse[] and nextWindowUseIndex for the algorithm to choose
- * the next dynamic window to be defined;
- * a subclass may override it and provide its own algorithm.
- */
-static void
-useDynamicWindow(SCSUData *scsu, int8_t window) {
- /*
- * move the existing window, which just became the most recently used one,
- * up in windowUse[] to nextWindowUseIndex-1
- */
-
- /* first, find the index of the window - backwards to favor the more recently used windows */
- int i, j;
-
- i=scsu->nextWindowUseIndex;
- do {
- if(--i<0) {
- i=7;
- }
- } while(scsu->windowUse[i]!=window);
-
- /* now copy each windowUse[i+1] to [i] */
- j=i+1;
- if(j==8) {
- j=0;
- }
- while(j!=scsu->nextWindowUseIndex) {
- scsu->windowUse[i]=scsu->windowUse[j];
- i=j;
- if(++j==8) { j=0; }
- }
-
- /* finally, set the window into the most recently used index */
- scsu->windowUse[i]=window;
-}
-
-/*
- * calculate the offset and the code for a dynamic window that contains the character
- * takes fixed offsets into account
- * the offset of the window is stored in the offset variable,
- * the code is returned
- *
- * return offset code: -1 none <=0xff code for SDn/UDn else code for SDX/UDX, subtract 0x200 to get the true code
- */
-static int
-getDynamicOffset(uint32_t c, uint32_t *pOffset) {
- int i;
-
- for(i=0; i<7; ++i) {
- if((uint32_t)(c-fixedOffsets[i])<=0x7f) {
- *pOffset=fixedOffsets[i];
- return 0xf9+i;
- }
- }
-
- if(c<0x80) {
- /* No dynamic window for US-ASCII. */
- return -1;
- } else if(c<0x3400 ||
- (uint32_t)(c-0x10000)<(0x14000-0x10000) ||
- (uint32_t)(c-0x1d000)<=(0x1ffff-0x1d000)
- ) {
- /* This character is in a code range for a "small", i.e., reasonably windowable, script. */
- *pOffset=c&0x7fffff80;
- return (int)(c>>7);
- } else if(0xe000<=c && c!=0xfeff && c<0xfff0) {
- /* For these characters we need to take the gapOffset into account. */
- *pOffset=c&0x7fffff80;
- return (int)((c-gapOffset)>>7);
- } else {
- return -1;
- }
-}
-U_CDECL_BEGIN
-/*
- * Idea for compression:
- * - save SCSUData and other state before really starting work
- * - at endloop, see if compression could be better with just unicode mode
- * - don't do this if a callback has been called
- * - if unicode mode would be smaller, then override the results with it - may need SCU at the beginning
- * - different buffer handling!
- *
- * Drawback or need for corrective handling:
- * it is desirable to encode U+feff as SQU fe ff for the SCSU signature, and
- * it is desirable to start a document in US-ASCII/Latin-1 for as long as possible
- * not only for compression but also for HTML/XML documents with following charset/encoding announcers.
- *
- * How to achieve both?
- * - Only replace the result after an SDX or SCU?
- */
-
-static void U_CALLCONV
-_SCSUFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- UConverter *cnv;
- SCSUData *scsu;
- const UChar *source, *sourceLimit;
- uint8_t *target;
- int32_t targetCapacity;
- int32_t *offsets;
-
- UBool isSingleByteMode;
- uint8_t dynamicWindow;
- uint32_t currentOffset;
-
- uint32_t c, delta;
-
- int32_t sourceIndex, nextSourceIndex;
-
- int32_t length;
-
- /* variables for compression heuristics */
- uint32_t offset;
- UChar lead, trail;
- int code;
- int8_t window;
-
- /* set up the local pointers */
- cnv=pArgs->converter;
- scsu=(SCSUData *)cnv->extraInfo;
-
- /* set up the local pointers */
- source=pArgs->source;
- sourceLimit=pArgs->sourceLimit;
- target=(uint8_t *)pArgs->target;
- targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
- offsets=pArgs->offsets;
-
- /* get the state machine state */
- isSingleByteMode=scsu->fromUIsSingleByteMode;
- dynamicWindow=scsu->fromUDynamicWindow;
- currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
-
- c=cnv->fromUChar32;
-
- /* sourceIndex=-1 if the current character began in the previous buffer */
- sourceIndex= c==0 ? 0 : -1;
- nextSourceIndex=0;
-
- /* similar conversion "loop" as in toUnicode */
-loop:
- if(isSingleByteMode) {
- if(c!=0 && targetCapacity>0) {
- goto getTrailSingle;
- }
-
- /* state machine for single-byte mode */
-/* singleByteMode: */
- while(source<sourceLimit) {
- if(targetCapacity<=0) {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- c=*source++;
- ++nextSourceIndex;
-
- if((c-0x20)<=0x5f) {
- /* pass US-ASCII graphic character through */
- *target++=(uint8_t)c;
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- --targetCapacity;
- } else if(c<0x20) {
- if((1UL<<c)&0x2601 /* binary 0010 0110 0000 0001, check for b==0xd || b==0xa || b==9 || b==0 */) {
- /* CR/LF/TAB/NUL */
- *target++=(uint8_t)c;
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- --targetCapacity;
- } else {
- /* quote C0 control character */
- c|=SQ0<<8;
- length=2;
- goto outputBytes;
- }
- } else if((delta=c-currentOffset)<=0x7f) {
- /* use the current dynamic window */
- *target++=(uint8_t)(delta|0x80);
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- --targetCapacity;
- } else if(U16_IS_SURROGATE(c)) {
- if(U16_IS_SURROGATE_LEAD(c)) {
-getTrailSingle:
- lead=(UChar)c;
- if(source<sourceLimit) {
- /* test the following code unit */
- trail=*source;
- if(U16_IS_TRAIL(trail)) {
- ++source;
- ++nextSourceIndex;
- c=U16_GET_SUPPLEMENTARY(c, trail);
- /* convert this surrogate code point */
- /* exit this condition tree */
- } else {
- /* this is an unmatched lead code unit (1st surrogate) */
- /* callback(illegal) */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- goto endloop;
- }
- } else {
- /* no more input */
- break;
- }
- } else {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- goto endloop;
- }
-
- /* compress supplementary character U+10000..U+10ffff */
- if((delta=c-currentOffset)<=0x7f) {
- /* use the current dynamic window */
- *target++=(uint8_t)(delta|0x80);
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- --targetCapacity;
- } else if((window=getWindow(scsu->fromUDynamicOffsets, c))>=0) {
- /* there is a dynamic window that contains this character, change to it */
- dynamicWindow=window;
- currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
- useDynamicWindow(scsu, dynamicWindow);
- c=((uint32_t)(SC0+dynamicWindow)<<8)|(c-currentOffset)|0x80;
- length=2;
- goto outputBytes;
- } else if((code=getDynamicOffset(c, &offset))>=0) {
- /* might check if there are more characters in this window to come */
- /* define an extended window with this character */
- code-=0x200;
- dynamicWindow=getNextDynamicWindow(scsu);
- currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset;
- useDynamicWindow(scsu, dynamicWindow);
- c=((uint32_t)SDX<<24)|((uint32_t)dynamicWindow<<21)|((uint32_t)code<<8)|(c-currentOffset)|0x80;
- length=4;
- goto outputBytes;
- } else {
- /* change to Unicode mode and output this (lead, trail) pair */
- isSingleByteMode=FALSE;
- *target++=(uint8_t)SCU;
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- --targetCapacity;
- c=((uint32_t)lead<<16)|trail;
- length=4;
- goto outputBytes;
- }
- } else if(c<0xa0) {
- /* quote C1 control character */
- c=(c&0x7f)|(SQ0+1)<<8; /* SQ0+1==SQ1 */
- length=2;
- goto outputBytes;
- } else if(c==0xfeff || c>=0xfff0) {
- /* quote signature character=byte order mark and specials */
- c|=SQU<<16;
- length=3;
- goto outputBytes;
- } else {
- /* compress all other BMP characters */
- if((window=getWindow(scsu->fromUDynamicOffsets, c))>=0) {
- /* there is a window defined that contains this character - switch to it or quote from it? */
- if(source>=sourceLimit || isInOffsetWindowOrDirect(scsu->fromUDynamicOffsets[window], *source)) {
- /* change to dynamic window */
- dynamicWindow=window;
- currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
- useDynamicWindow(scsu, dynamicWindow);
- c=((uint32_t)(SC0+dynamicWindow)<<8)|(c-currentOffset)|0x80;
- length=2;
- goto outputBytes;
- } else {
- /* quote from dynamic window */
- c=((uint32_t)(SQ0+window)<<8)|(c-scsu->fromUDynamicOffsets[window])|0x80;
- length=2;
- goto outputBytes;
- }
- } else if((window=getWindow(staticOffsets, c))>=0) {
- /* quote from static window */
- c=((uint32_t)(SQ0+window)<<8)|(c-staticOffsets[window]);
- length=2;
- goto outputBytes;
- } else if((code=getDynamicOffset(c, &offset))>=0) {
- /* define a dynamic window with this character */
- dynamicWindow=getNextDynamicWindow(scsu);
- currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset;
- useDynamicWindow(scsu, dynamicWindow);
- c=((uint32_t)(SD0+dynamicWindow)<<16)|((uint32_t)code<<8)|(c-currentOffset)|0x80;
- length=3;
- goto outputBytes;
- } else if((uint32_t)(c-0x3400)<(0xd800-0x3400) &&
- (source>=sourceLimit || (uint32_t)(*source-0x3400)<(0xd800-0x3400))
- ) {
- /*
- * this character is not compressible (a BMP ideograph or similar);
- * switch to Unicode mode if this is the last character in the block
- * or there is at least one more ideograph following immediately
- */
- isSingleByteMode=FALSE;
- c|=SCU<<16;
- length=3;
- goto outputBytes;
- } else {
- /* quote Unicode */
- c|=SQU<<16;
- length=3;
- goto outputBytes;
- }
- }
-
- /* normal end of conversion: prepare for a new character */
- c=0;
- sourceIndex=nextSourceIndex;
- }
- } else {
- if(c!=0 && targetCapacity>0) {
- goto getTrailUnicode;
- }
-
- /* state machine for Unicode mode */
-/* unicodeByteMode: */
- while(source<sourceLimit) {
- if(targetCapacity<=0) {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- c=*source++;
- ++nextSourceIndex;
-
- if((uint32_t)(c-0x3400)<(0xd800-0x3400)) {
- /* not compressible, write character directly */
- if(targetCapacity>=2) {
- *target++=(uint8_t)(c>>8);
- *target++=(uint8_t)c;
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- *offsets++=sourceIndex;
- }
- targetCapacity-=2;
- } else {
- length=2;
- goto outputBytes;
- }
- } else if((uint32_t)(c-0x3400)>=(0xf300-0x3400) /* c<0x3400 || c>=0xf300 */) {
- /* compress BMP character if the following one is not an uncompressible ideograph */
- if(!(source<sourceLimit && (uint32_t)(*source-0x3400)<(0xd800-0x3400))) {
- if(((uint32_t)(c-0x30)<10 || (uint32_t)(c-0x61)<26 || (uint32_t)(c-0x41)<26)) {
- /* ASCII digit or letter */
- isSingleByteMode=TRUE;
- c|=((uint32_t)(UC0+dynamicWindow)<<8)|c;
- length=2;
- goto outputBytes;
- } else if((window=getWindow(scsu->fromUDynamicOffsets, c))>=0) {
- /* there is a dynamic window that contains this character, change to it */
- isSingleByteMode=TRUE;
- dynamicWindow=window;
- currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
- useDynamicWindow(scsu, dynamicWindow);
- c=((uint32_t)(UC0+dynamicWindow)<<8)|(c-currentOffset)|0x80;
- length=2;
- goto outputBytes;
- } else if((code=getDynamicOffset(c, &offset))>=0) {
- /* define a dynamic window with this character */
- isSingleByteMode=TRUE;
- dynamicWindow=getNextDynamicWindow(scsu);
- currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset;
- useDynamicWindow(scsu, dynamicWindow);
- c=((uint32_t)(UD0+dynamicWindow)<<16)|((uint32_t)code<<8)|(c-currentOffset)|0x80;
- length=3;
- goto outputBytes;
- }
- }
-
- /* don't know how to compress this character, just write it directly */
- length=2;
- goto outputBytes;
- } else if(c<0xe000) {
- /* c is a surrogate */
- if(U16_IS_SURROGATE_LEAD(c)) {
-getTrailUnicode:
- lead=(UChar)c;
- if(source<sourceLimit) {
- /* test the following code unit */
- trail=*source;
- if(U16_IS_TRAIL(trail)) {
- ++source;
- ++nextSourceIndex;
- c=U16_GET_SUPPLEMENTARY(c, trail);
- /* convert this surrogate code point */
- /* exit this condition tree */
- } else {
- /* this is an unmatched lead code unit (1st surrogate) */
- /* callback(illegal) */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- goto endloop;
- }
- } else {
- /* no more input */
- break;
- }
- } else {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- goto endloop;
- }
-
- /* compress supplementary character */
- if( (window=getWindow(scsu->fromUDynamicOffsets, c))>=0 &&
- !(source<sourceLimit && (uint32_t)(*source-0x3400)<(0xd800-0x3400))
- ) {
- /*
- * there is a dynamic window that contains this character and
- * the following character is not uncompressible,
- * change to the window
- */
- isSingleByteMode=TRUE;
- dynamicWindow=window;
- currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
- useDynamicWindow(scsu, dynamicWindow);
- c=((uint32_t)(UC0+dynamicWindow)<<8)|(c-currentOffset)|0x80;
- length=2;
- goto outputBytes;
- } else if(source<sourceLimit && lead==*source && /* too lazy to check trail in same window as source[1] */
- (code=getDynamicOffset(c, &offset))>=0
- ) {
- /* two supplementary characters in (probably) the same window - define an extended one */
- isSingleByteMode=TRUE;
- code-=0x200;
- dynamicWindow=getNextDynamicWindow(scsu);
- currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset;
- useDynamicWindow(scsu, dynamicWindow);
- c=((uint32_t)UDX<<24)|((uint32_t)dynamicWindow<<21)|((uint32_t)code<<8)|(c-currentOffset)|0x80;
- length=4;
- goto outputBytes;
- } else {
- /* don't know how to compress this character, just write it directly */
- c=((uint32_t)lead<<16)|trail;
- length=4;
- goto outputBytes;
- }
- } else /* 0xe000<=c<0xf300 */ {
- /* quote to avoid SCSU tags */
- c|=UQU<<16;
- length=3;
- goto outputBytes;
- }
-
- /* normal end of conversion: prepare for a new character */
- c=0;
- sourceIndex=nextSourceIndex;
- }
- }
-endloop:
-
- /* set the converter state back into UConverter */
- scsu->fromUIsSingleByteMode=isSingleByteMode;
- scsu->fromUDynamicWindow=dynamicWindow;
-
- cnv->fromUChar32=c;
-
- /* write back the updated pointers */
- pArgs->source=source;
- pArgs->target=(char *)target;
- pArgs->offsets=offsets;
- return;
-
-outputBytes:
- /* write the output character bytes from c and length [code copied from ucnvmbcs.c] */
- /* from the first if in the loop we know that targetCapacity>0 */
- if(length<=targetCapacity) {
- if(offsets==NULL) {
- switch(length) {
- /* each branch falls through to the next one */
- case 4:
- *target++=(uint8_t)(c>>24);
- U_FALLTHROUGH;
- case 3:
- *target++=(uint8_t)(c>>16);
- U_FALLTHROUGH;
- case 2:
- *target++=(uint8_t)(c>>8);
- U_FALLTHROUGH;
- case 1:
- *target++=(uint8_t)c;
- U_FALLTHROUGH;
- default:
- /* will never occur */
- break;
- }
- } else {
- switch(length) {
- /* each branch falls through to the next one */
- case 4:
- *target++=(uint8_t)(c>>24);
- *offsets++=sourceIndex;
- U_FALLTHROUGH;
- case 3:
- *target++=(uint8_t)(c>>16);
- *offsets++=sourceIndex;
- U_FALLTHROUGH;
- case 2:
- *target++=(uint8_t)(c>>8);
- *offsets++=sourceIndex;
- U_FALLTHROUGH;
- case 1:
- *target++=(uint8_t)c;
- *offsets++=sourceIndex;
- U_FALLTHROUGH;
- default:
- /* will never occur */
- break;
- }
- }
- targetCapacity-=length;
-
- /* normal end of conversion: prepare for a new character */
- c=0;
- sourceIndex=nextSourceIndex;
- goto loop;
- } else {
- uint8_t *p;
-
- /*
- * We actually do this backwards here:
- * In order to save an intermediate variable, we output
- * first to the overflow buffer what does not fit into the
- * regular target.
- */
- /* we know that 0<=targetCapacity<length<=4 */
- /* targetCapacity==0 when SCU+supplementary where SCU used up targetCapacity==1 */
- length-=targetCapacity;
- p=(uint8_t *)cnv->charErrorBuffer;
- switch(length) {
- /* each branch falls through to the next one */
- case 4:
- *p++=(uint8_t)(c>>24);
- U_FALLTHROUGH;
- case 3:
- *p++=(uint8_t)(c>>16);
- U_FALLTHROUGH;
- case 2:
- *p++=(uint8_t)(c>>8);
- U_FALLTHROUGH;
- case 1:
- *p=(uint8_t)c;
- U_FALLTHROUGH;
- default:
- /* will never occur */
- break;
- }
- cnv->charErrorBufferLength=(int8_t)length;
-
- /* now output what fits into the regular target */
- c>>=8*length; /* length was reduced by targetCapacity */
- switch(targetCapacity) {
- /* each branch falls through to the next one */
- case 3:
- *target++=(uint8_t)(c>>16);
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- U_FALLTHROUGH;
- case 2:
- *target++=(uint8_t)(c>>8);
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- U_FALLTHROUGH;
- case 1:
- *target++=(uint8_t)c;
- if(offsets!=NULL) {
- *offsets++=sourceIndex;
- }
- U_FALLTHROUGH;
- default:
- break;
- }
-
- /* target overflow */
- targetCapacity=0;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- c=0;
- goto endloop;
- }
-}
-
-/*
- * Identical to _SCSUFromUnicodeWithOffsets but without offset handling.
- * If a change is made in the original function, then either
- * change this function the same way or
- * re-copy the original function and remove the variables
- * offsets, sourceIndex, and nextSourceIndex.
- */
-static void U_CALLCONV
-_SCSUFromUnicode(UConverterFromUnicodeArgs *pArgs,
- UErrorCode *pErrorCode) {
- UConverter *cnv;
- SCSUData *scsu;
- const UChar *source, *sourceLimit;
- uint8_t *target;
- int32_t targetCapacity;
-
- UBool isSingleByteMode;
- uint8_t dynamicWindow;
- uint32_t currentOffset;
-
- uint32_t c, delta;
-
- int32_t length;
-
- /* variables for compression heuristics */
- uint32_t offset;
- UChar lead, trail;
- int code;
- int8_t window;
-
- /* set up the local pointers */
- cnv=pArgs->converter;
- scsu=(SCSUData *)cnv->extraInfo;
-
- /* set up the local pointers */
- source=pArgs->source;
- sourceLimit=pArgs->sourceLimit;
- target=(uint8_t *)pArgs->target;
- targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
-
- /* get the state machine state */
- isSingleByteMode=scsu->fromUIsSingleByteMode;
- dynamicWindow=scsu->fromUDynamicWindow;
- currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
-
- c=cnv->fromUChar32;
-
- /* similar conversion "loop" as in toUnicode */
-loop:
- if(isSingleByteMode) {
- if(c!=0 && targetCapacity>0) {
- goto getTrailSingle;
- }
-
- /* state machine for single-byte mode */
-/* singleByteMode: */
- while(source<sourceLimit) {
- if(targetCapacity<=0) {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- c=*source++;
-
- if((c-0x20)<=0x5f) {
- /* pass US-ASCII graphic character through */
- *target++=(uint8_t)c;
- --targetCapacity;
- } else if(c<0x20) {
- if((1UL<<c)&0x2601 /* binary 0010 0110 0000 0001, check for b==0xd || b==0xa || b==9 || b==0 */) {
- /* CR/LF/TAB/NUL */
- *target++=(uint8_t)c;
- --targetCapacity;
- } else {
- /* quote C0 control character */
- c|=SQ0<<8;
- length=2;
- goto outputBytes;
- }
- } else if((delta=c-currentOffset)<=0x7f) {
- /* use the current dynamic window */
- *target++=(uint8_t)(delta|0x80);
- --targetCapacity;
- } else if(U16_IS_SURROGATE(c)) {
- if(U16_IS_SURROGATE_LEAD(c)) {
-getTrailSingle:
- lead=(UChar)c;
- if(source<sourceLimit) {
- /* test the following code unit */
- trail=*source;
- if(U16_IS_TRAIL(trail)) {
- ++source;
- c=U16_GET_SUPPLEMENTARY(c, trail);
- /* convert this surrogate code point */
- /* exit this condition tree */
- } else {
- /* this is an unmatched lead code unit (1st surrogate) */
- /* callback(illegal) */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- goto endloop;
- }
- } else {
- /* no more input */
- break;
- }
- } else {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- goto endloop;
- }
-
- /* compress supplementary character U+10000..U+10ffff */
- if((delta=c-currentOffset)<=0x7f) {
- /* use the current dynamic window */
- *target++=(uint8_t)(delta|0x80);
- --targetCapacity;
- } else if((window=getWindow(scsu->fromUDynamicOffsets, c))>=0) {
- /* there is a dynamic window that contains this character, change to it */
- dynamicWindow=window;
- currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
- useDynamicWindow(scsu, dynamicWindow);
- c=((uint32_t)(SC0+dynamicWindow)<<8)|(c-currentOffset)|0x80;
- length=2;
- goto outputBytes;
- } else if((code=getDynamicOffset(c, &offset))>=0) {
- /* might check if there are more characters in this window to come */
- /* define an extended window with this character */
- code-=0x200;
- dynamicWindow=getNextDynamicWindow(scsu);
- currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset;
- useDynamicWindow(scsu, dynamicWindow);
- c=((uint32_t)SDX<<24)|((uint32_t)dynamicWindow<<21)|((uint32_t)code<<8)|(c-currentOffset)|0x80;
- length=4;
- goto outputBytes;
- } else {
- /* change to Unicode mode and output this (lead, trail) pair */
- isSingleByteMode=FALSE;
- *target++=(uint8_t)SCU;
- --targetCapacity;
- c=((uint32_t)lead<<16)|trail;
- length=4;
- goto outputBytes;
- }
- } else if(c<0xa0) {
- /* quote C1 control character */
- c=(c&0x7f)|(SQ0+1)<<8; /* SQ0+1==SQ1 */
- length=2;
- goto outputBytes;
- } else if(c==0xfeff || c>=0xfff0) {
- /* quote signature character=byte order mark and specials */
- c|=SQU<<16;
- length=3;
- goto outputBytes;
- } else {
- /* compress all other BMP characters */
- if((window=getWindow(scsu->fromUDynamicOffsets, c))>=0) {
- /* there is a window defined that contains this character - switch to it or quote from it? */
- if(source>=sourceLimit || isInOffsetWindowOrDirect(scsu->fromUDynamicOffsets[window], *source)) {
- /* change to dynamic window */
- dynamicWindow=window;
- currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
- useDynamicWindow(scsu, dynamicWindow);
- c=((uint32_t)(SC0+dynamicWindow)<<8)|(c-currentOffset)|0x80;
- length=2;
- goto outputBytes;
- } else {
- /* quote from dynamic window */
- c=((uint32_t)(SQ0+window)<<8)|(c-scsu->fromUDynamicOffsets[window])|0x80;
- length=2;
- goto outputBytes;
- }
- } else if((window=getWindow(staticOffsets, c))>=0) {
- /* quote from static window */
- c=((uint32_t)(SQ0+window)<<8)|(c-staticOffsets[window]);
- length=2;
- goto outputBytes;
- } else if((code=getDynamicOffset(c, &offset))>=0) {
- /* define a dynamic window with this character */
- dynamicWindow=getNextDynamicWindow(scsu);
- currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset;
- useDynamicWindow(scsu, dynamicWindow);
- c=((uint32_t)(SD0+dynamicWindow)<<16)|((uint32_t)code<<8)|(c-currentOffset)|0x80;
- length=3;
- goto outputBytes;
- } else if((uint32_t)(c-0x3400)<(0xd800-0x3400) &&
- (source>=sourceLimit || (uint32_t)(*source-0x3400)<(0xd800-0x3400))
- ) {
- /*
- * this character is not compressible (a BMP ideograph or similar);
- * switch to Unicode mode if this is the last character in the block
- * or there is at least one more ideograph following immediately
- */
- isSingleByteMode=FALSE;
- c|=SCU<<16;
- length=3;
- goto outputBytes;
- } else {
- /* quote Unicode */
- c|=SQU<<16;
- length=3;
- goto outputBytes;
- }
- }
-
- /* normal end of conversion: prepare for a new character */
- c=0;
- }
- } else {
- if(c!=0 && targetCapacity>0) {
- goto getTrailUnicode;
- }
-
- /* state machine for Unicode mode */
-/* unicodeByteMode: */
- while(source<sourceLimit) {
- if(targetCapacity<=0) {
- /* target is full */
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- break;
- }
- c=*source++;
-
- if((uint32_t)(c-0x3400)<(0xd800-0x3400)) {
- /* not compressible, write character directly */
- if(targetCapacity>=2) {
- *target++=(uint8_t)(c>>8);
- *target++=(uint8_t)c;
- targetCapacity-=2;
- } else {
- length=2;
- goto outputBytes;
- }
- } else if((uint32_t)(c-0x3400)>=(0xf300-0x3400) /* c<0x3400 || c>=0xf300 */) {
- /* compress BMP character if the following one is not an uncompressible ideograph */
- if(!(source<sourceLimit && (uint32_t)(*source-0x3400)<(0xd800-0x3400))) {
- if(((uint32_t)(c-0x30)<10 || (uint32_t)(c-0x61)<26 || (uint32_t)(c-0x41)<26)) {
- /* ASCII digit or letter */
- isSingleByteMode=TRUE;
- c|=((uint32_t)(UC0+dynamicWindow)<<8)|c;
- length=2;
- goto outputBytes;
- } else if((window=getWindow(scsu->fromUDynamicOffsets, c))>=0) {
- /* there is a dynamic window that contains this character, change to it */
- isSingleByteMode=TRUE;
- dynamicWindow=window;
- currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
- useDynamicWindow(scsu, dynamicWindow);
- c=((uint32_t)(UC0+dynamicWindow)<<8)|(c-currentOffset)|0x80;
- length=2;
- goto outputBytes;
- } else if((code=getDynamicOffset(c, &offset))>=0) {
- /* define a dynamic window with this character */
- isSingleByteMode=TRUE;
- dynamicWindow=getNextDynamicWindow(scsu);
- currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset;
- useDynamicWindow(scsu, dynamicWindow);
- c=((uint32_t)(UD0+dynamicWindow)<<16)|((uint32_t)code<<8)|(c-currentOffset)|0x80;
- length=3;
- goto outputBytes;
- }
- }
-
- /* don't know how to compress this character, just write it directly */
- length=2;
- goto outputBytes;
- } else if(c<0xe000) {
- /* c is a surrogate */
- if(U16_IS_SURROGATE_LEAD(c)) {
-getTrailUnicode:
- lead=(UChar)c;
- if(source<sourceLimit) {
- /* test the following code unit */
- trail=*source;
- if(U16_IS_TRAIL(trail)) {
- ++source;
- c=U16_GET_SUPPLEMENTARY(c, trail);
- /* convert this surrogate code point */
- /* exit this condition tree */
- } else {
- /* this is an unmatched lead code unit (1st surrogate) */
- /* callback(illegal) */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- goto endloop;
- }
- } else {
- /* no more input */
- break;
- }
- } else {
- /* this is an unmatched trail code unit (2nd surrogate) */
- /* callback(illegal) */
- *pErrorCode=U_ILLEGAL_CHAR_FOUND;
- goto endloop;
- }
-
- /* compress supplementary character */
- if( (window=getWindow(scsu->fromUDynamicOffsets, c))>=0 &&
- !(source<sourceLimit && (uint32_t)(*source-0x3400)<(0xd800-0x3400))
- ) {
- /*
- * there is a dynamic window that contains this character and
- * the following character is not uncompressible,
- * change to the window
- */
- isSingleByteMode=TRUE;
- dynamicWindow=window;
- currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
- useDynamicWindow(scsu, dynamicWindow);
- c=((uint32_t)(UC0+dynamicWindow)<<8)|(c-currentOffset)|0x80;
- length=2;
- goto outputBytes;
- } else if(source<sourceLimit && lead==*source && /* too lazy to check trail in same window as source[1] */
- (code=getDynamicOffset(c, &offset))>=0
- ) {
- /* two supplementary characters in (probably) the same window - define an extended one */
- isSingleByteMode=TRUE;
- code-=0x200;
- dynamicWindow=getNextDynamicWindow(scsu);
- currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset;
- useDynamicWindow(scsu, dynamicWindow);
- c=((uint32_t)UDX<<24)|((uint32_t)dynamicWindow<<21)|((uint32_t)code<<8)|(c-currentOffset)|0x80;
- length=4;
- goto outputBytes;
- } else {
- /* don't know how to compress this character, just write it directly */
- c=((uint32_t)lead<<16)|trail;
- length=4;
- goto outputBytes;
- }
- } else /* 0xe000<=c<0xf300 */ {
- /* quote to avoid SCSU tags */
- c|=UQU<<16;
- length=3;
- goto outputBytes;
- }
-
- /* normal end of conversion: prepare for a new character */
- c=0;
- }
- }
-endloop:
-
- /* set the converter state back into UConverter */
- scsu->fromUIsSingleByteMode=isSingleByteMode;
- scsu->fromUDynamicWindow=dynamicWindow;
-
- cnv->fromUChar32=c;
-
- /* write back the updated pointers */
- pArgs->source=source;
- pArgs->target=(char *)target;
- return;
-
-outputBytes:
- /* write the output character bytes from c and length [code copied from ucnvmbcs.c] */
- /* from the first if in the loop we know that targetCapacity>0 */
- if(length<=targetCapacity) {
- switch(length) {
- /* each branch falls through to the next one */
- case 4:
- *target++=(uint8_t)(c>>24);
- U_FALLTHROUGH;
- case 3:
- *target++=(uint8_t)(c>>16);
- U_FALLTHROUGH;
- case 2:
- *target++=(uint8_t)(c>>8);
- U_FALLTHROUGH;
- case 1:
- *target++=(uint8_t)c;
- U_FALLTHROUGH;
- default:
- /* will never occur */
- break;
- }
- targetCapacity-=length;
-
- /* normal end of conversion: prepare for a new character */
- c=0;
- goto loop;
- } else {
- uint8_t *p;
-
- /*
- * We actually do this backwards here:
- * In order to save an intermediate variable, we output
- * first to the overflow buffer what does not fit into the
- * regular target.
- */
- /* we know that 0<=targetCapacity<length<=4 */
- /* targetCapacity==0 when SCU+supplementary where SCU used up targetCapacity==1 */
- length-=targetCapacity;
- p=(uint8_t *)cnv->charErrorBuffer;
- switch(length) {
- /* each branch falls through to the next one */
- case 4:
- *p++=(uint8_t)(c>>24);
- U_FALLTHROUGH;
- case 3:
- *p++=(uint8_t)(c>>16);
- U_FALLTHROUGH;
- case 2:
- *p++=(uint8_t)(c>>8);
- U_FALLTHROUGH;
- case 1:
- *p=(uint8_t)c;
- U_FALLTHROUGH;
- default:
- /* will never occur */
- break;
- }
- cnv->charErrorBufferLength=(int8_t)length;
-
- /* now output what fits into the regular target */
- c>>=8*length; /* length was reduced by targetCapacity */
- switch(targetCapacity) {
- /* each branch falls through to the next one */
- case 3:
- *target++=(uint8_t)(c>>16);
- U_FALLTHROUGH;
- case 2:
- *target++=(uint8_t)(c>>8);
- U_FALLTHROUGH;
- case 1:
- *target++=(uint8_t)c;
- U_FALLTHROUGH;
- default:
- break;
- }
-
- /* target overflow */
- targetCapacity=0;
- *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- c=0;
- goto endloop;
- }
-}
-
-/* miscellaneous ------------------------------------------------------------ */
-
-static const char * U_CALLCONV
-_SCSUGetName(const UConverter *cnv) {
- SCSUData *scsu=(SCSUData *)cnv->extraInfo;
-
- switch(scsu->locale) {
- case l_ja:
- return "SCSU,locale=ja";
- default:
- return "SCSU";
- }
-}
-
-/* structure for SafeClone calculations */
-struct cloneSCSUStruct
-{
- UConverter cnv;
- SCSUData mydata;
-};
-
-static UConverter * U_CALLCONV
-_SCSUSafeClone(const UConverter *cnv,
- void *stackBuffer,
- int32_t *pBufferSize,
- UErrorCode *status)
-{
- struct cloneSCSUStruct * localClone;
- int32_t bufferSizeNeeded = sizeof(struct cloneSCSUStruct);
-
- if (U_FAILURE(*status)){
- return 0;
- }
-
- if (*pBufferSize == 0){ /* 'preflighting' request - set needed size into *pBufferSize */
- *pBufferSize = bufferSizeNeeded;
- return 0;
- }
-
- localClone = (struct cloneSCSUStruct *)stackBuffer;
- /* ucnv.c/ucnv_safeClone() copied the main UConverter already */
-
- uprv_memcpy(&localClone->mydata, cnv->extraInfo, sizeof(SCSUData));
- localClone->cnv.extraInfo = &localClone->mydata;
- localClone->cnv.isExtraLocal = TRUE;
-
- return &localClone->cnv;
-}
-U_CDECL_END
-
-static const UConverterImpl _SCSUImpl={
- UCNV_SCSU,
-
- NULL,
- NULL,
-
- _SCSUOpen,
- _SCSUClose,
- _SCSUReset,
-
- _SCSUToUnicode,
- _SCSUToUnicodeWithOffsets,
- _SCSUFromUnicode,
- _SCSUFromUnicodeWithOffsets,
- NULL,
-
- NULL,
- _SCSUGetName,
- NULL,
- _SCSUSafeClone,
- ucnv_getCompleteUnicodeSet,
- NULL,
- NULL
-};
-
-static const UConverterStaticData _SCSUStaticData={
- sizeof(UConverterStaticData),
- "SCSU",
- 1212, /* CCSID for SCSU */
- UCNV_IBM, UCNV_SCSU,
- 1, 3, /* one UChar generates at least 1 byte and at most 3 bytes */
- /*
- * The subchar here is ignored because _SCSUOpen() sets U+fffd as a Unicode
- * substitution string.
- */
- { 0x0e, 0xff, 0xfd, 0 }, 3,
- FALSE, FALSE,
- 0,
- 0,
- { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
-};
-
-const UConverterSharedData _SCSUData=
- UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_SCSUStaticData, &_SCSUImpl);
-
-#endif
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 2000-2016, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+* file name: ucnvscsu.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2000nov18
+* created by: Markus W. Scherer
+*
+* This is an implementation of the Standard Compression Scheme for Unicode
+* as defined in http://www.unicode.org/unicode/reports/tr6/ .
+* Reserved commands and window settings are treated as illegal sequences and
+* will result in callback calls.
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION
+
+#include "unicode/ucnv.h"
+#include "unicode/ucnv_cb.h"
+#include "unicode/utf16.h"
+#include "ucnv_bld.h"
+#include "ucnv_cnv.h"
+#include "cmemory.h"
+
+/* SCSU definitions --------------------------------------------------------- */
+
+/* SCSU command byte values */
+enum {
+ SQ0=0x01, /* Quote from window pair 0 */
+ SQ7=0x08, /* Quote from window pair 7 */
+ SDX=0x0B, /* Define a window as extended */
+ Srs=0x0C, /* reserved */
+ SQU=0x0E, /* Quote a single Unicode character */
+ SCU=0x0F, /* Change to Unicode mode */
+ SC0=0x10, /* Select window 0 */
+ SC7=0x17, /* Select window 7 */
+ SD0=0x18, /* Define and select window 0 */
+ SD7=0x1F, /* Define and select window 7 */
+
+ UC0=0xE0, /* Select window 0 */
+ UC7=0xE7, /* Select window 7 */
+ UD0=0xE8, /* Define and select window 0 */
+ UD7=0xEF, /* Define and select window 7 */
+ UQU=0xF0, /* Quote a single Unicode character */
+ UDX=0xF1, /* Define a Window as extended */
+ Urs=0xF2 /* reserved */
+};
+
+enum {
+ /*
+ * Unicode code points from 3400 to E000 are not adressible by
+ * dynamic window, since in these areas no short run alphabets are
+ * found. Therefore add gapOffset to all values from gapThreshold.
+ */
+ gapThreshold=0x68,
+ gapOffset=0xAC00,
+
+ /* values between reservedStart and fixedThreshold are reserved */
+ reservedStart=0xA8,
+
+ /* use table of predefined fixed offsets for values from fixedThreshold */
+ fixedThreshold=0xF9
+};
+
+/* constant offsets for the 8 static windows */
+static const uint32_t staticOffsets[8]={
+ 0x0000, /* ASCII for quoted tags */
+ 0x0080, /* Latin - 1 Supplement (for access to punctuation) */
+ 0x0100, /* Latin Extended-A */
+ 0x0300, /* Combining Diacritical Marks */
+ 0x2000, /* General Punctuation */
+ 0x2080, /* Currency Symbols */
+ 0x2100, /* Letterlike Symbols and Number Forms */
+ 0x3000 /* CJK Symbols and punctuation */
+};
+
+/* initial offsets for the 8 dynamic (sliding) windows */
+static const uint32_t initialDynamicOffsets[8]={
+ 0x0080, /* Latin-1 */
+ 0x00C0, /* Latin Extended A */
+ 0x0400, /* Cyrillic */
+ 0x0600, /* Arabic */
+ 0x0900, /* Devanagari */
+ 0x3040, /* Hiragana */
+ 0x30A0, /* Katakana */
+ 0xFF00 /* Fullwidth ASCII */
+};
+
+/* Table of fixed predefined Offsets */
+static const uint32_t fixedOffsets[]={
+ /* 0xF9 */ 0x00C0, /* Latin-1 Letters + half of Latin Extended A */
+ /* 0xFA */ 0x0250, /* IPA extensions */
+ /* 0xFB */ 0x0370, /* Greek */
+ /* 0xFC */ 0x0530, /* Armenian */
+ /* 0xFD */ 0x3040, /* Hiragana */
+ /* 0xFE */ 0x30A0, /* Katakana */
+ /* 0xFF */ 0xFF60 /* Halfwidth Katakana */
+};
+
+/* state values */
+enum {
+ readCommand,
+ quotePairOne,
+ quotePairTwo,
+ quoteOne,
+ definePairOne,
+ definePairTwo,
+ defineOne
+};
+
+typedef struct SCSUData {
+ /* dynamic window offsets, intitialize to default values from initialDynamicOffsets */
+ uint32_t toUDynamicOffsets[8];
+ uint32_t fromUDynamicOffsets[8];
+
+ /* state machine state - toUnicode */
+ UBool toUIsSingleByteMode;
+ uint8_t toUState;
+ int8_t toUQuoteWindow, toUDynamicWindow;
+ uint8_t toUByteOne;
+ uint8_t toUPadding[3];
+
+ /* state machine state - fromUnicode */
+ UBool fromUIsSingleByteMode;
+ int8_t fromUDynamicWindow;
+
+ /*
+ * windowUse[] keeps track of the use of the dynamic windows:
+ * At nextWindowUseIndex there is the least recently used window,
+ * and the following windows (in a wrapping manner) are more and more
+ * recently used.
+ * At nextWindowUseIndex-1 there is the most recently used window.
+ */
+ uint8_t locale;
+ int8_t nextWindowUseIndex;
+ int8_t windowUse[8];
+} SCSUData;
+
+static const int8_t initialWindowUse[8]={ 7, 0, 3, 2, 4, 5, 6, 1 };
+static const int8_t initialWindowUse_ja[8]={ 3, 2, 4, 1, 0, 7, 5, 6 };
+
+enum {
+ lGeneric, l_ja
+};
+
+/* SCSU setup functions ----------------------------------------------------- */
+U_CDECL_BEGIN
+static void U_CALLCONV
+_SCSUReset(UConverter *cnv, UConverterResetChoice choice) {
+ SCSUData *scsu=(SCSUData *)cnv->extraInfo;
+
+ if(choice<=UCNV_RESET_TO_UNICODE) {
+ /* reset toUnicode */
+ uprv_memcpy(scsu->toUDynamicOffsets, initialDynamicOffsets, 32);
+
+ scsu->toUIsSingleByteMode=TRUE;
+ scsu->toUState=readCommand;
+ scsu->toUQuoteWindow=scsu->toUDynamicWindow=0;
+ scsu->toUByteOne=0;
+
+ cnv->toULength=0;
+ }
+ if(choice!=UCNV_RESET_TO_UNICODE) {
+ /* reset fromUnicode */
+ uprv_memcpy(scsu->fromUDynamicOffsets, initialDynamicOffsets, 32);
+
+ scsu->fromUIsSingleByteMode=TRUE;
+ scsu->fromUDynamicWindow=0;
+
+ scsu->nextWindowUseIndex=0;
+ switch(scsu->locale) {
+ case l_ja:
+ uprv_memcpy(scsu->windowUse, initialWindowUse_ja, 8);
+ break;
+ default:
+ uprv_memcpy(scsu->windowUse, initialWindowUse, 8);
+ break;
+ }
+
+ cnv->fromUChar32=0;
+ }
+}
+
+static void U_CALLCONV
+_SCSUOpen(UConverter *cnv,
+ UConverterLoadArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ const char *locale=pArgs->locale;
+ if(pArgs->onlyTestIsLoadable) {
+ return;
+ }
+ cnv->extraInfo=uprv_malloc(sizeof(SCSUData));
+ if(cnv->extraInfo!=NULL) {
+ if(locale!=NULL && locale[0]=='j' && locale[1]=='a' && (locale[2]==0 || locale[2]=='_')) {
+ ((SCSUData *)cnv->extraInfo)->locale=l_ja;
+ } else {
+ ((SCSUData *)cnv->extraInfo)->locale=lGeneric;
+ }
+ _SCSUReset(cnv, UCNV_RESET_BOTH);
+ } else {
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ }
+
+ /* Set the substitution character U+fffd as a Unicode string. */
+ cnv->subUChars[0]=0xfffd;
+ cnv->subCharLen=-1;
+}
+
+static void U_CALLCONV
+_SCSUClose(UConverter *cnv) {
+ if(cnv->extraInfo!=NULL) {
+ if(!cnv->isExtraLocal) {
+ uprv_free(cnv->extraInfo);
+ }
+ cnv->extraInfo=NULL;
+ }
+}
+
+/* SCSU-to-Unicode conversion functions ------------------------------------- */
+
+static void U_CALLCONV
+_SCSUToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ UConverter *cnv;
+ SCSUData *scsu;
+ const uint8_t *source, *sourceLimit;
+ UChar *target;
+ const UChar *targetLimit;
+ int32_t *offsets;
+ UBool isSingleByteMode;
+ uint8_t state, byteOne;
+ int8_t quoteWindow, dynamicWindow;
+
+ int32_t sourceIndex, nextSourceIndex;
+
+ uint8_t b;
+
+ /* set up the local pointers */
+ cnv=pArgs->converter;
+ scsu=(SCSUData *)cnv->extraInfo;
+
+ source=(const uint8_t *)pArgs->source;
+ sourceLimit=(const uint8_t *)pArgs->sourceLimit;
+ target=pArgs->target;
+ targetLimit=pArgs->targetLimit;
+ offsets=pArgs->offsets;
+
+ /* get the state machine state */
+ isSingleByteMode=scsu->toUIsSingleByteMode;
+ state=scsu->toUState;
+ quoteWindow=scsu->toUQuoteWindow;
+ dynamicWindow=scsu->toUDynamicWindow;
+ byteOne=scsu->toUByteOne;
+
+ /* sourceIndex=-1 if the current character began in the previous buffer */
+ sourceIndex=state==readCommand ? 0 : -1;
+ nextSourceIndex=0;
+
+ /*
+ * conversion "loop"
+ *
+ * For performance, this is not a normal C loop.
+ * Instead, there are two code blocks for the two SCSU modes.
+ * The function branches to either one, and a change of the mode is done with a goto to
+ * the other branch.
+ *
+ * Each branch has two conventional loops:
+ * - a fast-path loop for the most common codes in the mode
+ * - a loop for all other codes in the mode
+ * When the fast-path runs into a code that it cannot handle, its loop ends and it
+ * runs into the following loop to handle the other codes.
+ * The end of the input or output buffer is also handled by the slower loop.
+ * The slow loop jumps (goto) to the fast-path loop again as soon as possible.
+ *
+ * The callback handling is done by returning with an error code.
+ * The conversion framework actually calls the callback function.
+ */
+ if(isSingleByteMode) {
+ /* fast path for single-byte mode */
+ if(state==readCommand) {
+fastSingle:
+ while(source<sourceLimit && target<targetLimit && (b=*source)>=0x20) {
+ ++source;
+ ++nextSourceIndex;
+ if(b<=0x7f) {
+ /* write US-ASCII graphic character or DEL */
+ *target++=(UChar)b;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ } else {
+ /* write from dynamic window */
+ uint32_t c=scsu->toUDynamicOffsets[dynamicWindow]+(b&0x7f);
+ if(c<=0xffff) {
+ *target++=(UChar)c;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ } else {
+ /* output surrogate pair */
+ *target++=(UChar)(0xd7c0+(c>>10));
+ if(target<targetLimit) {
+ *target++=(UChar)(0xdc00|(c&0x3ff));
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex;
+ }
+ } else {
+ /* target overflow */
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ cnv->UCharErrorBuffer[0]=(UChar)(0xdc00|(c&0x3ff));
+ cnv->UCharErrorBufferLength=1;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ goto endloop;
+ }
+ }
+ }
+ sourceIndex=nextSourceIndex;
+ }
+ }
+
+ /* normal state machine for single-byte mode, minus handling for what fastSingle covers */
+singleByteMode:
+ while(source<sourceLimit) {
+ if(target>=targetLimit) {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ b=*source++;
+ ++nextSourceIndex;
+ switch(state) {
+ case readCommand:
+ /* redundant conditions are commented out */
+ /* here: b<0x20 because otherwise we would be in fastSingle */
+ if((1UL<<b)&0x2601 /* binary 0010 0110 0000 0001, check for b==0xd || b==0xa || b==9 || b==0 */) {
+ /* CR/LF/TAB/NUL */
+ *target++=(UChar)b;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ sourceIndex=nextSourceIndex;
+ goto fastSingle;
+ } else if(SC0<=b) {
+ if(b<=SC7) {
+ dynamicWindow=(int8_t)(b-SC0);
+ sourceIndex=nextSourceIndex;
+ goto fastSingle;
+ } else /* if(SD0<=b && b<=SD7) */ {
+ dynamicWindow=(int8_t)(b-SD0);
+ state=defineOne;
+ }
+ } else if(/* SQ0<=b && */ b<=SQ7) {
+ quoteWindow=(int8_t)(b-SQ0);
+ state=quoteOne;
+ } else if(b==SDX) {
+ state=definePairOne;
+ } else if(b==SQU) {
+ state=quotePairOne;
+ } else if(b==SCU) {
+ sourceIndex=nextSourceIndex;
+ isSingleByteMode=FALSE;
+ goto fastUnicode;
+ } else /* Srs */ {
+ /* callback(illegal) */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ cnv->toUBytes[0]=b;
+ cnv->toULength=1;
+ goto endloop;
+ }
+
+ /* store the first byte of a multibyte sequence in toUBytes[] */
+ cnv->toUBytes[0]=b;
+ cnv->toULength=1;
+ break;
+ case quotePairOne:
+ byteOne=b;
+ cnv->toUBytes[1]=b;
+ cnv->toULength=2;
+ state=quotePairTwo;
+ break;
+ case quotePairTwo:
+ *target++=(UChar)((byteOne<<8)|b);
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ sourceIndex=nextSourceIndex;
+ state=readCommand;
+ goto fastSingle;
+ case quoteOne:
+ if(b<0x80) {
+ /* all static offsets are in the BMP */
+ *target++=(UChar)(staticOffsets[quoteWindow]+b);
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ } else {
+ /* write from dynamic window */
+ uint32_t c=scsu->toUDynamicOffsets[quoteWindow]+(b&0x7f);
+ if(c<=0xffff) {
+ *target++=(UChar)c;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ } else {
+ /* output surrogate pair */
+ *target++=(UChar)(0xd7c0+(c>>10));
+ if(target<targetLimit) {
+ *target++=(UChar)(0xdc00|(c&0x3ff));
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex;
+ }
+ } else {
+ /* target overflow */
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ cnv->UCharErrorBuffer[0]=(UChar)(0xdc00|(c&0x3ff));
+ cnv->UCharErrorBufferLength=1;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ goto endloop;
+ }
+ }
+ }
+ sourceIndex=nextSourceIndex;
+ state=readCommand;
+ goto fastSingle;
+ case definePairOne:
+ dynamicWindow=(int8_t)((b>>5)&7);
+ byteOne=(uint8_t)(b&0x1f);
+ cnv->toUBytes[1]=b;
+ cnv->toULength=2;
+ state=definePairTwo;
+ break;
+ case definePairTwo:
+ scsu->toUDynamicOffsets[dynamicWindow]=0x10000+(byteOne<<15UL | b<<7UL);
+ sourceIndex=nextSourceIndex;
+ state=readCommand;
+ goto fastSingle;
+ case defineOne:
+ if(b==0) {
+ /* callback(illegal): Reserved window offset value 0 */
+ cnv->toUBytes[1]=b;
+ cnv->toULength=2;
+ goto endloop;
+ } else if(b<gapThreshold) {
+ scsu->toUDynamicOffsets[dynamicWindow]=b<<7UL;
+ } else if((uint8_t)(b-gapThreshold)<(reservedStart-gapThreshold)) {
+ scsu->toUDynamicOffsets[dynamicWindow]=(b<<7UL)+gapOffset;
+ } else if(b>=fixedThreshold) {
+ scsu->toUDynamicOffsets[dynamicWindow]=fixedOffsets[b-fixedThreshold];
+ } else {
+ /* callback(illegal): Reserved window offset value 0xa8..0xf8 */
+ cnv->toUBytes[1]=b;
+ cnv->toULength=2;
+ goto endloop;
+ }
+ sourceIndex=nextSourceIndex;
+ state=readCommand;
+ goto fastSingle;
+ }
+ }
+ } else {
+ /* fast path for Unicode mode */
+ if(state==readCommand) {
+fastUnicode:
+ while(source+1<sourceLimit && target<targetLimit && (uint8_t)((b=*source)-UC0)>(Urs-UC0)) {
+ *target++=(UChar)((b<<8)|source[1]);
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ sourceIndex=nextSourceIndex;
+ nextSourceIndex+=2;
+ source+=2;
+ }
+ }
+
+ /* normal state machine for Unicode mode */
+/* unicodeByteMode: */
+ while(source<sourceLimit) {
+ if(target>=targetLimit) {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ b=*source++;
+ ++nextSourceIndex;
+ switch(state) {
+ case readCommand:
+ if((uint8_t)(b-UC0)>(Urs-UC0)) {
+ byteOne=b;
+ cnv->toUBytes[0]=b;
+ cnv->toULength=1;
+ state=quotePairTwo;
+ } else if(/* UC0<=b && */ b<=UC7) {
+ dynamicWindow=(int8_t)(b-UC0);
+ sourceIndex=nextSourceIndex;
+ isSingleByteMode=TRUE;
+ goto fastSingle;
+ } else if(/* UD0<=b && */ b<=UD7) {
+ dynamicWindow=(int8_t)(b-UD0);
+ isSingleByteMode=TRUE;
+ cnv->toUBytes[0]=b;
+ cnv->toULength=1;
+ state=defineOne;
+ goto singleByteMode;
+ } else if(b==UDX) {
+ isSingleByteMode=TRUE;
+ cnv->toUBytes[0]=b;
+ cnv->toULength=1;
+ state=definePairOne;
+ goto singleByteMode;
+ } else if(b==UQU) {
+ cnv->toUBytes[0]=b;
+ cnv->toULength=1;
+ state=quotePairOne;
+ } else /* Urs */ {
+ /* callback(illegal) */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ cnv->toUBytes[0]=b;
+ cnv->toULength=1;
+ goto endloop;
+ }
+ break;
+ case quotePairOne:
+ byteOne=b;
+ cnv->toUBytes[1]=b;
+ cnv->toULength=2;
+ state=quotePairTwo;
+ break;
+ case quotePairTwo:
+ *target++=(UChar)((byteOne<<8)|b);
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ sourceIndex=nextSourceIndex;
+ state=readCommand;
+ goto fastUnicode;
+ }
+ }
+ }
+endloop:
+
+ /* set the converter state back into UConverter */
+ if(U_FAILURE(*pErrorCode) && *pErrorCode!=U_BUFFER_OVERFLOW_ERROR) {
+ /* reset to deal with the next character */
+ state=readCommand;
+ } else if(state==readCommand) {
+ /* not in a multi-byte sequence, reset toULength */
+ cnv->toULength=0;
+ }
+ scsu->toUIsSingleByteMode=isSingleByteMode;
+ scsu->toUState=state;
+ scsu->toUQuoteWindow=quoteWindow;
+ scsu->toUDynamicWindow=dynamicWindow;
+ scsu->toUByteOne=byteOne;
+
+ /* write back the updated pointers */
+ pArgs->source=(const char *)source;
+ pArgs->target=target;
+ pArgs->offsets=offsets;
+ return;
+}
+
+/*
+ * Identical to _SCSUToUnicodeWithOffsets but without offset handling.
+ * If a change is made in the original function, then either
+ * change this function the same way or
+ * re-copy the original function and remove the variables
+ * offsets, sourceIndex, and nextSourceIndex.
+ */
+static void U_CALLCONV
+_SCSUToUnicode(UConverterToUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ UConverter *cnv;
+ SCSUData *scsu;
+ const uint8_t *source, *sourceLimit;
+ UChar *target;
+ const UChar *targetLimit;
+ UBool isSingleByteMode;
+ uint8_t state, byteOne;
+ int8_t quoteWindow, dynamicWindow;
+
+ uint8_t b;
+
+ /* set up the local pointers */
+ cnv=pArgs->converter;
+ scsu=(SCSUData *)cnv->extraInfo;
+
+ source=(const uint8_t *)pArgs->source;
+ sourceLimit=(const uint8_t *)pArgs->sourceLimit;
+ target=pArgs->target;
+ targetLimit=pArgs->targetLimit;
+
+ /* get the state machine state */
+ isSingleByteMode=scsu->toUIsSingleByteMode;
+ state=scsu->toUState;
+ quoteWindow=scsu->toUQuoteWindow;
+ dynamicWindow=scsu->toUDynamicWindow;
+ byteOne=scsu->toUByteOne;
+
+ /*
+ * conversion "loop"
+ *
+ * For performance, this is not a normal C loop.
+ * Instead, there are two code blocks for the two SCSU modes.
+ * The function branches to either one, and a change of the mode is done with a goto to
+ * the other branch.
+ *
+ * Each branch has two conventional loops:
+ * - a fast-path loop for the most common codes in the mode
+ * - a loop for all other codes in the mode
+ * When the fast-path runs into a code that it cannot handle, its loop ends and it
+ * runs into the following loop to handle the other codes.
+ * The end of the input or output buffer is also handled by the slower loop.
+ * The slow loop jumps (goto) to the fast-path loop again as soon as possible.
+ *
+ * The callback handling is done by returning with an error code.
+ * The conversion framework actually calls the callback function.
+ */
+ if(isSingleByteMode) {
+ /* fast path for single-byte mode */
+ if(state==readCommand) {
+fastSingle:
+ while(source<sourceLimit && target<targetLimit && (b=*source)>=0x20) {
+ ++source;
+ if(b<=0x7f) {
+ /* write US-ASCII graphic character or DEL */
+ *target++=(UChar)b;
+ } else {
+ /* write from dynamic window */
+ uint32_t c=scsu->toUDynamicOffsets[dynamicWindow]+(b&0x7f);
+ if(c<=0xffff) {
+ *target++=(UChar)c;
+ } else {
+ /* output surrogate pair */
+ *target++=(UChar)(0xd7c0+(c>>10));
+ if(target<targetLimit) {
+ *target++=(UChar)(0xdc00|(c&0x3ff));
+ } else {
+ /* target overflow */
+ cnv->UCharErrorBuffer[0]=(UChar)(0xdc00|(c&0x3ff));
+ cnv->UCharErrorBufferLength=1;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ goto endloop;
+ }
+ }
+ }
+ }
+ }
+
+ /* normal state machine for single-byte mode, minus handling for what fastSingle covers */
+singleByteMode:
+ while(source<sourceLimit) {
+ if(target>=targetLimit) {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ b=*source++;
+ switch(state) {
+ case readCommand:
+ /* redundant conditions are commented out */
+ /* here: b<0x20 because otherwise we would be in fastSingle */
+ if((1UL<<b)&0x2601 /* binary 0010 0110 0000 0001, check for b==0xd || b==0xa || b==9 || b==0 */) {
+ /* CR/LF/TAB/NUL */
+ *target++=(UChar)b;
+ goto fastSingle;
+ } else if(SC0<=b) {
+ if(b<=SC7) {
+ dynamicWindow=(int8_t)(b-SC0);
+ goto fastSingle;
+ } else /* if(SD0<=b && b<=SD7) */ {
+ dynamicWindow=(int8_t)(b-SD0);
+ state=defineOne;
+ }
+ } else if(/* SQ0<=b && */ b<=SQ7) {
+ quoteWindow=(int8_t)(b-SQ0);
+ state=quoteOne;
+ } else if(b==SDX) {
+ state=definePairOne;
+ } else if(b==SQU) {
+ state=quotePairOne;
+ } else if(b==SCU) {
+ isSingleByteMode=FALSE;
+ goto fastUnicode;
+ } else /* Srs */ {
+ /* callback(illegal) */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ cnv->toUBytes[0]=b;
+ cnv->toULength=1;
+ goto endloop;
+ }
+
+ /* store the first byte of a multibyte sequence in toUBytes[] */
+ cnv->toUBytes[0]=b;
+ cnv->toULength=1;
+ break;
+ case quotePairOne:
+ byteOne=b;
+ cnv->toUBytes[1]=b;
+ cnv->toULength=2;
+ state=quotePairTwo;
+ break;
+ case quotePairTwo:
+ *target++=(UChar)((byteOne<<8)|b);
+ state=readCommand;
+ goto fastSingle;
+ case quoteOne:
+ if(b<0x80) {
+ /* all static offsets are in the BMP */
+ *target++=(UChar)(staticOffsets[quoteWindow]+b);
+ } else {
+ /* write from dynamic window */
+ uint32_t c=scsu->toUDynamicOffsets[quoteWindow]+(b&0x7f);
+ if(c<=0xffff) {
+ *target++=(UChar)c;
+ } else {
+ /* output surrogate pair */
+ *target++=(UChar)(0xd7c0+(c>>10));
+ if(target<targetLimit) {
+ *target++=(UChar)(0xdc00|(c&0x3ff));
+ } else {
+ /* target overflow */
+ cnv->UCharErrorBuffer[0]=(UChar)(0xdc00|(c&0x3ff));
+ cnv->UCharErrorBufferLength=1;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ goto endloop;
+ }
+ }
+ }
+ state=readCommand;
+ goto fastSingle;
+ case definePairOne:
+ dynamicWindow=(int8_t)((b>>5)&7);
+ byteOne=(uint8_t)(b&0x1f);
+ cnv->toUBytes[1]=b;
+ cnv->toULength=2;
+ state=definePairTwo;
+ break;
+ case definePairTwo:
+ scsu->toUDynamicOffsets[dynamicWindow]=0x10000+(byteOne<<15UL | b<<7UL);
+ state=readCommand;
+ goto fastSingle;
+ case defineOne:
+ if(b==0) {
+ /* callback(illegal): Reserved window offset value 0 */
+ cnv->toUBytes[1]=b;
+ cnv->toULength=2;
+ goto endloop;
+ } else if(b<gapThreshold) {
+ scsu->toUDynamicOffsets[dynamicWindow]=b<<7UL;
+ } else if((uint8_t)(b-gapThreshold)<(reservedStart-gapThreshold)) {
+ scsu->toUDynamicOffsets[dynamicWindow]=(b<<7UL)+gapOffset;
+ } else if(b>=fixedThreshold) {
+ scsu->toUDynamicOffsets[dynamicWindow]=fixedOffsets[b-fixedThreshold];
+ } else {
+ /* callback(illegal): Reserved window offset value 0xa8..0xf8 */
+ cnv->toUBytes[1]=b;
+ cnv->toULength=2;
+ goto endloop;
+ }
+ state=readCommand;
+ goto fastSingle;
+ }
+ }
+ } else {
+ /* fast path for Unicode mode */
+ if(state==readCommand) {
+fastUnicode:
+ while(source+1<sourceLimit && target<targetLimit && (uint8_t)((b=*source)-UC0)>(Urs-UC0)) {
+ *target++=(UChar)((b<<8)|source[1]);
+ source+=2;
+ }
+ }
+
+ /* normal state machine for Unicode mode */
+/* unicodeByteMode: */
+ while(source<sourceLimit) {
+ if(target>=targetLimit) {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ b=*source++;
+ switch(state) {
+ case readCommand:
+ if((uint8_t)(b-UC0)>(Urs-UC0)) {
+ byteOne=b;
+ cnv->toUBytes[0]=b;
+ cnv->toULength=1;
+ state=quotePairTwo;
+ } else if(/* UC0<=b && */ b<=UC7) {
+ dynamicWindow=(int8_t)(b-UC0);
+ isSingleByteMode=TRUE;
+ goto fastSingle;
+ } else if(/* UD0<=b && */ b<=UD7) {
+ dynamicWindow=(int8_t)(b-UD0);
+ isSingleByteMode=TRUE;
+ cnv->toUBytes[0]=b;
+ cnv->toULength=1;
+ state=defineOne;
+ goto singleByteMode;
+ } else if(b==UDX) {
+ isSingleByteMode=TRUE;
+ cnv->toUBytes[0]=b;
+ cnv->toULength=1;
+ state=definePairOne;
+ goto singleByteMode;
+ } else if(b==UQU) {
+ cnv->toUBytes[0]=b;
+ cnv->toULength=1;
+ state=quotePairOne;
+ } else /* Urs */ {
+ /* callback(illegal) */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ cnv->toUBytes[0]=b;
+ cnv->toULength=1;
+ goto endloop;
+ }
+ break;
+ case quotePairOne:
+ byteOne=b;
+ cnv->toUBytes[1]=b;
+ cnv->toULength=2;
+ state=quotePairTwo;
+ break;
+ case quotePairTwo:
+ *target++=(UChar)((byteOne<<8)|b);
+ state=readCommand;
+ goto fastUnicode;
+ }
+ }
+ }
+endloop:
+
+ /* set the converter state back into UConverter */
+ if(U_FAILURE(*pErrorCode) && *pErrorCode!=U_BUFFER_OVERFLOW_ERROR) {
+ /* reset to deal with the next character */
+ state=readCommand;
+ } else if(state==readCommand) {
+ /* not in a multi-byte sequence, reset toULength */
+ cnv->toULength=0;
+ }
+ scsu->toUIsSingleByteMode=isSingleByteMode;
+ scsu->toUState=state;
+ scsu->toUQuoteWindow=quoteWindow;
+ scsu->toUDynamicWindow=dynamicWindow;
+ scsu->toUByteOne=byteOne;
+
+ /* write back the updated pointers */
+ pArgs->source=(const char *)source;
+ pArgs->target=target;
+ return;
+}
+U_CDECL_END
+/* SCSU-from-Unicode conversion functions ----------------------------------- */
+
+/*
+ * This SCSU Encoder is fairly simple but uses all SCSU commands to achieve
+ * reasonable results. The lookahead is minimal.
+ * Many cases are simple:
+ * A character fits directly into the current mode, a dynamic or static window,
+ * or is not compressible. These cases are tested first.
+ * Real compression heuristics are applied to the rest, in code branches for
+ * single/Unicode mode and BMP/supplementary code points.
+ * The heuristics used here are extremely simple.
+ */
+
+/* get the number of the window that this character is in, or -1 */
+static int8_t
+getWindow(const uint32_t offsets[8], uint32_t c) {
+ int i;
+ for(i=0; i<8; ++i) {
+ if((uint32_t)(c-offsets[i])<=0x7f) {
+ return (int8_t)(i);
+ }
+ }
+ return -1;
+}
+
+/* is the character in the dynamic window starting at the offset, or in the direct-encoded range? */
+static UBool
+isInOffsetWindowOrDirect(uint32_t offset, uint32_t c) {
+ return (UBool)(c<=offset+0x7f &&
+ (c>=offset || (c<=0x7f &&
+ (c>=0x20 || (1UL<<c)&0x2601))));
+ /* binary 0010 0110 0000 0001,
+ check for b==0xd || b==0xa || b==9 || b==0 */
+}
+
+/*
+ * getNextDynamicWindow returns the next dynamic window to be redefined
+ */
+static int8_t
+getNextDynamicWindow(SCSUData *scsu) {
+ int8_t window=scsu->windowUse[scsu->nextWindowUseIndex];
+ if(++scsu->nextWindowUseIndex==8) {
+ scsu->nextWindowUseIndex=0;
+ }
+ return window;
+}
+
+/*
+ * useDynamicWindow() adjusts
+ * windowUse[] and nextWindowUseIndex for the algorithm to choose
+ * the next dynamic window to be defined;
+ * a subclass may override it and provide its own algorithm.
+ */
+static void
+useDynamicWindow(SCSUData *scsu, int8_t window) {
+ /*
+ * move the existing window, which just became the most recently used one,
+ * up in windowUse[] to nextWindowUseIndex-1
+ */
+
+ /* first, find the index of the window - backwards to favor the more recently used windows */
+ int i, j;
+
+ i=scsu->nextWindowUseIndex;
+ do {
+ if(--i<0) {
+ i=7;
+ }
+ } while(scsu->windowUse[i]!=window);
+
+ /* now copy each windowUse[i+1] to [i] */
+ j=i+1;
+ if(j==8) {
+ j=0;
+ }
+ while(j!=scsu->nextWindowUseIndex) {
+ scsu->windowUse[i]=scsu->windowUse[j];
+ i=j;
+ if(++j==8) { j=0; }
+ }
+
+ /* finally, set the window into the most recently used index */
+ scsu->windowUse[i]=window;
+}
+
+/*
+ * calculate the offset and the code for a dynamic window that contains the character
+ * takes fixed offsets into account
+ * the offset of the window is stored in the offset variable,
+ * the code is returned
+ *
+ * return offset code: -1 none <=0xff code for SDn/UDn else code for SDX/UDX, subtract 0x200 to get the true code
+ */
+static int
+getDynamicOffset(uint32_t c, uint32_t *pOffset) {
+ int i;
+
+ for(i=0; i<7; ++i) {
+ if((uint32_t)(c-fixedOffsets[i])<=0x7f) {
+ *pOffset=fixedOffsets[i];
+ return 0xf9+i;
+ }
+ }
+
+ if(c<0x80) {
+ /* No dynamic window for US-ASCII. */
+ return -1;
+ } else if(c<0x3400 ||
+ (uint32_t)(c-0x10000)<(0x14000-0x10000) ||
+ (uint32_t)(c-0x1d000)<=(0x1ffff-0x1d000)
+ ) {
+ /* This character is in a code range for a "small", i.e., reasonably windowable, script. */
+ *pOffset=c&0x7fffff80;
+ return (int)(c>>7);
+ } else if(0xe000<=c && c!=0xfeff && c<0xfff0) {
+ /* For these characters we need to take the gapOffset into account. */
+ *pOffset=c&0x7fffff80;
+ return (int)((c-gapOffset)>>7);
+ } else {
+ return -1;
+ }
+}
+U_CDECL_BEGIN
+/*
+ * Idea for compression:
+ * - save SCSUData and other state before really starting work
+ * - at endloop, see if compression could be better with just unicode mode
+ * - don't do this if a callback has been called
+ * - if unicode mode would be smaller, then override the results with it - may need SCU at the beginning
+ * - different buffer handling!
+ *
+ * Drawback or need for corrective handling:
+ * it is desirable to encode U+feff as SQU fe ff for the SCSU signature, and
+ * it is desirable to start a document in US-ASCII/Latin-1 for as long as possible
+ * not only for compression but also for HTML/XML documents with following charset/encoding announcers.
+ *
+ * How to achieve both?
+ * - Only replace the result after an SDX or SCU?
+ */
+
+static void U_CALLCONV
+_SCSUFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ UConverter *cnv;
+ SCSUData *scsu;
+ const UChar *source, *sourceLimit;
+ uint8_t *target;
+ int32_t targetCapacity;
+ int32_t *offsets;
+
+ UBool isSingleByteMode;
+ uint8_t dynamicWindow;
+ uint32_t currentOffset;
+
+ uint32_t c, delta;
+
+ int32_t sourceIndex, nextSourceIndex;
+
+ int32_t length;
+
+ /* variables for compression heuristics */
+ uint32_t offset;
+ UChar lead, trail;
+ int code;
+ int8_t window;
+
+ /* set up the local pointers */
+ cnv=pArgs->converter;
+ scsu=(SCSUData *)cnv->extraInfo;
+
+ /* set up the local pointers */
+ source=pArgs->source;
+ sourceLimit=pArgs->sourceLimit;
+ target=(uint8_t *)pArgs->target;
+ targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
+ offsets=pArgs->offsets;
+
+ /* get the state machine state */
+ isSingleByteMode=scsu->fromUIsSingleByteMode;
+ dynamicWindow=scsu->fromUDynamicWindow;
+ currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
+
+ c=cnv->fromUChar32;
+
+ /* sourceIndex=-1 if the current character began in the previous buffer */
+ sourceIndex= c==0 ? 0 : -1;
+ nextSourceIndex=0;
+
+ /* similar conversion "loop" as in toUnicode */
+loop:
+ if(isSingleByteMode) {
+ if(c!=0 && targetCapacity>0) {
+ goto getTrailSingle;
+ }
+
+ /* state machine for single-byte mode */
+/* singleByteMode: */
+ while(source<sourceLimit) {
+ if(targetCapacity<=0) {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ c=*source++;
+ ++nextSourceIndex;
+
+ if((c-0x20)<=0x5f) {
+ /* pass US-ASCII graphic character through */
+ *target++=(uint8_t)c;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ --targetCapacity;
+ } else if(c<0x20) {
+ if((1UL<<c)&0x2601 /* binary 0010 0110 0000 0001, check for b==0xd || b==0xa || b==9 || b==0 */) {
+ /* CR/LF/TAB/NUL */
+ *target++=(uint8_t)c;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ --targetCapacity;
+ } else {
+ /* quote C0 control character */
+ c|=SQ0<<8;
+ length=2;
+ goto outputBytes;
+ }
+ } else if((delta=c-currentOffset)<=0x7f) {
+ /* use the current dynamic window */
+ *target++=(uint8_t)(delta|0x80);
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ --targetCapacity;
+ } else if(U16_IS_SURROGATE(c)) {
+ if(U16_IS_SURROGATE_LEAD(c)) {
+getTrailSingle:
+ lead=(UChar)c;
+ if(source<sourceLimit) {
+ /* test the following code unit */
+ trail=*source;
+ if(U16_IS_TRAIL(trail)) {
+ ++source;
+ ++nextSourceIndex;
+ c=U16_GET_SUPPLEMENTARY(c, trail);
+ /* convert this surrogate code point */
+ /* exit this condition tree */
+ } else {
+ /* this is an unmatched lead code unit (1st surrogate) */
+ /* callback(illegal) */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ goto endloop;
+ }
+ } else {
+ /* no more input */
+ break;
+ }
+ } else {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ goto endloop;
+ }
+
+ /* compress supplementary character U+10000..U+10ffff */
+ if((delta=c-currentOffset)<=0x7f) {
+ /* use the current dynamic window */
+ *target++=(uint8_t)(delta|0x80);
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ --targetCapacity;
+ } else if((window=getWindow(scsu->fromUDynamicOffsets, c))>=0) {
+ /* there is a dynamic window that contains this character, change to it */
+ dynamicWindow=window;
+ currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
+ useDynamicWindow(scsu, dynamicWindow);
+ c=((uint32_t)(SC0+dynamicWindow)<<8)|(c-currentOffset)|0x80;
+ length=2;
+ goto outputBytes;
+ } else if((code=getDynamicOffset(c, &offset))>=0) {
+ /* might check if there are more characters in this window to come */
+ /* define an extended window with this character */
+ code-=0x200;
+ dynamicWindow=getNextDynamicWindow(scsu);
+ currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset;
+ useDynamicWindow(scsu, dynamicWindow);
+ c=((uint32_t)SDX<<24)|((uint32_t)dynamicWindow<<21)|((uint32_t)code<<8)|(c-currentOffset)|0x80;
+ length=4;
+ goto outputBytes;
+ } else {
+ /* change to Unicode mode and output this (lead, trail) pair */
+ isSingleByteMode=FALSE;
+ *target++=(uint8_t)SCU;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ --targetCapacity;
+ c=((uint32_t)lead<<16)|trail;
+ length=4;
+ goto outputBytes;
+ }
+ } else if(c<0xa0) {
+ /* quote C1 control character */
+ c=(c&0x7f)|(SQ0+1)<<8; /* SQ0+1==SQ1 */
+ length=2;
+ goto outputBytes;
+ } else if(c==0xfeff || c>=0xfff0) {
+ /* quote signature character=byte order mark and specials */
+ c|=SQU<<16;
+ length=3;
+ goto outputBytes;
+ } else {
+ /* compress all other BMP characters */
+ if((window=getWindow(scsu->fromUDynamicOffsets, c))>=0) {
+ /* there is a window defined that contains this character - switch to it or quote from it? */
+ if(source>=sourceLimit || isInOffsetWindowOrDirect(scsu->fromUDynamicOffsets[window], *source)) {
+ /* change to dynamic window */
+ dynamicWindow=window;
+ currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
+ useDynamicWindow(scsu, dynamicWindow);
+ c=((uint32_t)(SC0+dynamicWindow)<<8)|(c-currentOffset)|0x80;
+ length=2;
+ goto outputBytes;
+ } else {
+ /* quote from dynamic window */
+ c=((uint32_t)(SQ0+window)<<8)|(c-scsu->fromUDynamicOffsets[window])|0x80;
+ length=2;
+ goto outputBytes;
+ }
+ } else if((window=getWindow(staticOffsets, c))>=0) {
+ /* quote from static window */
+ c=((uint32_t)(SQ0+window)<<8)|(c-staticOffsets[window]);
+ length=2;
+ goto outputBytes;
+ } else if((code=getDynamicOffset(c, &offset))>=0) {
+ /* define a dynamic window with this character */
+ dynamicWindow=getNextDynamicWindow(scsu);
+ currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset;
+ useDynamicWindow(scsu, dynamicWindow);
+ c=((uint32_t)(SD0+dynamicWindow)<<16)|((uint32_t)code<<8)|(c-currentOffset)|0x80;
+ length=3;
+ goto outputBytes;
+ } else if((uint32_t)(c-0x3400)<(0xd800-0x3400) &&
+ (source>=sourceLimit || (uint32_t)(*source-0x3400)<(0xd800-0x3400))
+ ) {
+ /*
+ * this character is not compressible (a BMP ideograph or similar);
+ * switch to Unicode mode if this is the last character in the block
+ * or there is at least one more ideograph following immediately
+ */
+ isSingleByteMode=FALSE;
+ c|=SCU<<16;
+ length=3;
+ goto outputBytes;
+ } else {
+ /* quote Unicode */
+ c|=SQU<<16;
+ length=3;
+ goto outputBytes;
+ }
+ }
+
+ /* normal end of conversion: prepare for a new character */
+ c=0;
+ sourceIndex=nextSourceIndex;
+ }
+ } else {
+ if(c!=0 && targetCapacity>0) {
+ goto getTrailUnicode;
+ }
+
+ /* state machine for Unicode mode */
+/* unicodeByteMode: */
+ while(source<sourceLimit) {
+ if(targetCapacity<=0) {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ c=*source++;
+ ++nextSourceIndex;
+
+ if((uint32_t)(c-0x3400)<(0xd800-0x3400)) {
+ /* not compressible, write character directly */
+ if(targetCapacity>=2) {
+ *target++=(uint8_t)(c>>8);
+ *target++=(uint8_t)c;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ *offsets++=sourceIndex;
+ }
+ targetCapacity-=2;
+ } else {
+ length=2;
+ goto outputBytes;
+ }
+ } else if((uint32_t)(c-0x3400)>=(0xf300-0x3400) /* c<0x3400 || c>=0xf300 */) {
+ /* compress BMP character if the following one is not an uncompressible ideograph */
+ if(!(source<sourceLimit && (uint32_t)(*source-0x3400)<(0xd800-0x3400))) {
+ if(((uint32_t)(c-0x30)<10 || (uint32_t)(c-0x61)<26 || (uint32_t)(c-0x41)<26)) {
+ /* ASCII digit or letter */
+ isSingleByteMode=TRUE;
+ c|=((uint32_t)(UC0+dynamicWindow)<<8)|c;
+ length=2;
+ goto outputBytes;
+ } else if((window=getWindow(scsu->fromUDynamicOffsets, c))>=0) {
+ /* there is a dynamic window that contains this character, change to it */
+ isSingleByteMode=TRUE;
+ dynamicWindow=window;
+ currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
+ useDynamicWindow(scsu, dynamicWindow);
+ c=((uint32_t)(UC0+dynamicWindow)<<8)|(c-currentOffset)|0x80;
+ length=2;
+ goto outputBytes;
+ } else if((code=getDynamicOffset(c, &offset))>=0) {
+ /* define a dynamic window with this character */
+ isSingleByteMode=TRUE;
+ dynamicWindow=getNextDynamicWindow(scsu);
+ currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset;
+ useDynamicWindow(scsu, dynamicWindow);
+ c=((uint32_t)(UD0+dynamicWindow)<<16)|((uint32_t)code<<8)|(c-currentOffset)|0x80;
+ length=3;
+ goto outputBytes;
+ }
+ }
+
+ /* don't know how to compress this character, just write it directly */
+ length=2;
+ goto outputBytes;
+ } else if(c<0xe000) {
+ /* c is a surrogate */
+ if(U16_IS_SURROGATE_LEAD(c)) {
+getTrailUnicode:
+ lead=(UChar)c;
+ if(source<sourceLimit) {
+ /* test the following code unit */
+ trail=*source;
+ if(U16_IS_TRAIL(trail)) {
+ ++source;
+ ++nextSourceIndex;
+ c=U16_GET_SUPPLEMENTARY(c, trail);
+ /* convert this surrogate code point */
+ /* exit this condition tree */
+ } else {
+ /* this is an unmatched lead code unit (1st surrogate) */
+ /* callback(illegal) */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ goto endloop;
+ }
+ } else {
+ /* no more input */
+ break;
+ }
+ } else {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ goto endloop;
+ }
+
+ /* compress supplementary character */
+ if( (window=getWindow(scsu->fromUDynamicOffsets, c))>=0 &&
+ !(source<sourceLimit && (uint32_t)(*source-0x3400)<(0xd800-0x3400))
+ ) {
+ /*
+ * there is a dynamic window that contains this character and
+ * the following character is not uncompressible,
+ * change to the window
+ */
+ isSingleByteMode=TRUE;
+ dynamicWindow=window;
+ currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
+ useDynamicWindow(scsu, dynamicWindow);
+ c=((uint32_t)(UC0+dynamicWindow)<<8)|(c-currentOffset)|0x80;
+ length=2;
+ goto outputBytes;
+ } else if(source<sourceLimit && lead==*source && /* too lazy to check trail in same window as source[1] */
+ (code=getDynamicOffset(c, &offset))>=0
+ ) {
+ /* two supplementary characters in (probably) the same window - define an extended one */
+ isSingleByteMode=TRUE;
+ code-=0x200;
+ dynamicWindow=getNextDynamicWindow(scsu);
+ currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset;
+ useDynamicWindow(scsu, dynamicWindow);
+ c=((uint32_t)UDX<<24)|((uint32_t)dynamicWindow<<21)|((uint32_t)code<<8)|(c-currentOffset)|0x80;
+ length=4;
+ goto outputBytes;
+ } else {
+ /* don't know how to compress this character, just write it directly */
+ c=((uint32_t)lead<<16)|trail;
+ length=4;
+ goto outputBytes;
+ }
+ } else /* 0xe000<=c<0xf300 */ {
+ /* quote to avoid SCSU tags */
+ c|=UQU<<16;
+ length=3;
+ goto outputBytes;
+ }
+
+ /* normal end of conversion: prepare for a new character */
+ c=0;
+ sourceIndex=nextSourceIndex;
+ }
+ }
+endloop:
+
+ /* set the converter state back into UConverter */
+ scsu->fromUIsSingleByteMode=isSingleByteMode;
+ scsu->fromUDynamicWindow=dynamicWindow;
+
+ cnv->fromUChar32=c;
+
+ /* write back the updated pointers */
+ pArgs->source=source;
+ pArgs->target=(char *)target;
+ pArgs->offsets=offsets;
+ return;
+
+outputBytes:
+ /* write the output character bytes from c and length [code copied from ucnvmbcs.c] */
+ /* from the first if in the loop we know that targetCapacity>0 */
+ if(length<=targetCapacity) {
+ if(offsets==NULL) {
+ switch(length) {
+ /* each branch falls through to the next one */
+ case 4:
+ *target++=(uint8_t)(c>>24);
+ U_FALLTHROUGH;
+ case 3:
+ *target++=(uint8_t)(c>>16);
+ U_FALLTHROUGH;
+ case 2:
+ *target++=(uint8_t)(c>>8);
+ U_FALLTHROUGH;
+ case 1:
+ *target++=(uint8_t)c;
+ U_FALLTHROUGH;
+ default:
+ /* will never occur */
+ break;
+ }
+ } else {
+ switch(length) {
+ /* each branch falls through to the next one */
+ case 4:
+ *target++=(uint8_t)(c>>24);
+ *offsets++=sourceIndex;
+ U_FALLTHROUGH;
+ case 3:
+ *target++=(uint8_t)(c>>16);
+ *offsets++=sourceIndex;
+ U_FALLTHROUGH;
+ case 2:
+ *target++=(uint8_t)(c>>8);
+ *offsets++=sourceIndex;
+ U_FALLTHROUGH;
+ case 1:
+ *target++=(uint8_t)c;
+ *offsets++=sourceIndex;
+ U_FALLTHROUGH;
+ default:
+ /* will never occur */
+ break;
+ }
+ }
+ targetCapacity-=length;
+
+ /* normal end of conversion: prepare for a new character */
+ c=0;
+ sourceIndex=nextSourceIndex;
+ goto loop;
+ } else {
+ uint8_t *p;
+
+ /*
+ * We actually do this backwards here:
+ * In order to save an intermediate variable, we output
+ * first to the overflow buffer what does not fit into the
+ * regular target.
+ */
+ /* we know that 0<=targetCapacity<length<=4 */
+ /* targetCapacity==0 when SCU+supplementary where SCU used up targetCapacity==1 */
+ length-=targetCapacity;
+ p=(uint8_t *)cnv->charErrorBuffer;
+ switch(length) {
+ /* each branch falls through to the next one */
+ case 4:
+ *p++=(uint8_t)(c>>24);
+ U_FALLTHROUGH;
+ case 3:
+ *p++=(uint8_t)(c>>16);
+ U_FALLTHROUGH;
+ case 2:
+ *p++=(uint8_t)(c>>8);
+ U_FALLTHROUGH;
+ case 1:
+ *p=(uint8_t)c;
+ U_FALLTHROUGH;
+ default:
+ /* will never occur */
+ break;
+ }
+ cnv->charErrorBufferLength=(int8_t)length;
+
+ /* now output what fits into the regular target */
+ c>>=8*length; /* length was reduced by targetCapacity */
+ switch(targetCapacity) {
+ /* each branch falls through to the next one */
+ case 3:
+ *target++=(uint8_t)(c>>16);
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ U_FALLTHROUGH;
+ case 2:
+ *target++=(uint8_t)(c>>8);
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ U_FALLTHROUGH;
+ case 1:
+ *target++=(uint8_t)c;
+ if(offsets!=NULL) {
+ *offsets++=sourceIndex;
+ }
+ U_FALLTHROUGH;
+ default:
+ break;
+ }
+
+ /* target overflow */
+ targetCapacity=0;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ c=0;
+ goto endloop;
+ }
+}
+
+/*
+ * Identical to _SCSUFromUnicodeWithOffsets but without offset handling.
+ * If a change is made in the original function, then either
+ * change this function the same way or
+ * re-copy the original function and remove the variables
+ * offsets, sourceIndex, and nextSourceIndex.
+ */
+static void U_CALLCONV
+_SCSUFromUnicode(UConverterFromUnicodeArgs *pArgs,
+ UErrorCode *pErrorCode) {
+ UConverter *cnv;
+ SCSUData *scsu;
+ const UChar *source, *sourceLimit;
+ uint8_t *target;
+ int32_t targetCapacity;
+
+ UBool isSingleByteMode;
+ uint8_t dynamicWindow;
+ uint32_t currentOffset;
+
+ uint32_t c, delta;
+
+ int32_t length;
+
+ /* variables for compression heuristics */
+ uint32_t offset;
+ UChar lead, trail;
+ int code;
+ int8_t window;
+
+ /* set up the local pointers */
+ cnv=pArgs->converter;
+ scsu=(SCSUData *)cnv->extraInfo;
+
+ /* set up the local pointers */
+ source=pArgs->source;
+ sourceLimit=pArgs->sourceLimit;
+ target=(uint8_t *)pArgs->target;
+ targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
+
+ /* get the state machine state */
+ isSingleByteMode=scsu->fromUIsSingleByteMode;
+ dynamicWindow=scsu->fromUDynamicWindow;
+ currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
+
+ c=cnv->fromUChar32;
+
+ /* similar conversion "loop" as in toUnicode */
+loop:
+ if(isSingleByteMode) {
+ if(c!=0 && targetCapacity>0) {
+ goto getTrailSingle;
+ }
+
+ /* state machine for single-byte mode */
+/* singleByteMode: */
+ while(source<sourceLimit) {
+ if(targetCapacity<=0) {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ c=*source++;
+
+ if((c-0x20)<=0x5f) {
+ /* pass US-ASCII graphic character through */
+ *target++=(uint8_t)c;
+ --targetCapacity;
+ } else if(c<0x20) {
+ if((1UL<<c)&0x2601 /* binary 0010 0110 0000 0001, check for b==0xd || b==0xa || b==9 || b==0 */) {
+ /* CR/LF/TAB/NUL */
+ *target++=(uint8_t)c;
+ --targetCapacity;
+ } else {
+ /* quote C0 control character */
+ c|=SQ0<<8;
+ length=2;
+ goto outputBytes;
+ }
+ } else if((delta=c-currentOffset)<=0x7f) {
+ /* use the current dynamic window */
+ *target++=(uint8_t)(delta|0x80);
+ --targetCapacity;
+ } else if(U16_IS_SURROGATE(c)) {
+ if(U16_IS_SURROGATE_LEAD(c)) {
+getTrailSingle:
+ lead=(UChar)c;
+ if(source<sourceLimit) {
+ /* test the following code unit */
+ trail=*source;
+ if(U16_IS_TRAIL(trail)) {
+ ++source;
+ c=U16_GET_SUPPLEMENTARY(c, trail);
+ /* convert this surrogate code point */
+ /* exit this condition tree */
+ } else {
+ /* this is an unmatched lead code unit (1st surrogate) */
+ /* callback(illegal) */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ goto endloop;
+ }
+ } else {
+ /* no more input */
+ break;
+ }
+ } else {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ goto endloop;
+ }
+
+ /* compress supplementary character U+10000..U+10ffff */
+ if((delta=c-currentOffset)<=0x7f) {
+ /* use the current dynamic window */
+ *target++=(uint8_t)(delta|0x80);
+ --targetCapacity;
+ } else if((window=getWindow(scsu->fromUDynamicOffsets, c))>=0) {
+ /* there is a dynamic window that contains this character, change to it */
+ dynamicWindow=window;
+ currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
+ useDynamicWindow(scsu, dynamicWindow);
+ c=((uint32_t)(SC0+dynamicWindow)<<8)|(c-currentOffset)|0x80;
+ length=2;
+ goto outputBytes;
+ } else if((code=getDynamicOffset(c, &offset))>=0) {
+ /* might check if there are more characters in this window to come */
+ /* define an extended window with this character */
+ code-=0x200;
+ dynamicWindow=getNextDynamicWindow(scsu);
+ currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset;
+ useDynamicWindow(scsu, dynamicWindow);
+ c=((uint32_t)SDX<<24)|((uint32_t)dynamicWindow<<21)|((uint32_t)code<<8)|(c-currentOffset)|0x80;
+ length=4;
+ goto outputBytes;
+ } else {
+ /* change to Unicode mode and output this (lead, trail) pair */
+ isSingleByteMode=FALSE;
+ *target++=(uint8_t)SCU;
+ --targetCapacity;
+ c=((uint32_t)lead<<16)|trail;
+ length=4;
+ goto outputBytes;
+ }
+ } else if(c<0xa0) {
+ /* quote C1 control character */
+ c=(c&0x7f)|(SQ0+1)<<8; /* SQ0+1==SQ1 */
+ length=2;
+ goto outputBytes;
+ } else if(c==0xfeff || c>=0xfff0) {
+ /* quote signature character=byte order mark and specials */
+ c|=SQU<<16;
+ length=3;
+ goto outputBytes;
+ } else {
+ /* compress all other BMP characters */
+ if((window=getWindow(scsu->fromUDynamicOffsets, c))>=0) {
+ /* there is a window defined that contains this character - switch to it or quote from it? */
+ if(source>=sourceLimit || isInOffsetWindowOrDirect(scsu->fromUDynamicOffsets[window], *source)) {
+ /* change to dynamic window */
+ dynamicWindow=window;
+ currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
+ useDynamicWindow(scsu, dynamicWindow);
+ c=((uint32_t)(SC0+dynamicWindow)<<8)|(c-currentOffset)|0x80;
+ length=2;
+ goto outputBytes;
+ } else {
+ /* quote from dynamic window */
+ c=((uint32_t)(SQ0+window)<<8)|(c-scsu->fromUDynamicOffsets[window])|0x80;
+ length=2;
+ goto outputBytes;
+ }
+ } else if((window=getWindow(staticOffsets, c))>=0) {
+ /* quote from static window */
+ c=((uint32_t)(SQ0+window)<<8)|(c-staticOffsets[window]);
+ length=2;
+ goto outputBytes;
+ } else if((code=getDynamicOffset(c, &offset))>=0) {
+ /* define a dynamic window with this character */
+ dynamicWindow=getNextDynamicWindow(scsu);
+ currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset;
+ useDynamicWindow(scsu, dynamicWindow);
+ c=((uint32_t)(SD0+dynamicWindow)<<16)|((uint32_t)code<<8)|(c-currentOffset)|0x80;
+ length=3;
+ goto outputBytes;
+ } else if((uint32_t)(c-0x3400)<(0xd800-0x3400) &&
+ (source>=sourceLimit || (uint32_t)(*source-0x3400)<(0xd800-0x3400))
+ ) {
+ /*
+ * this character is not compressible (a BMP ideograph or similar);
+ * switch to Unicode mode if this is the last character in the block
+ * or there is at least one more ideograph following immediately
+ */
+ isSingleByteMode=FALSE;
+ c|=SCU<<16;
+ length=3;
+ goto outputBytes;
+ } else {
+ /* quote Unicode */
+ c|=SQU<<16;
+ length=3;
+ goto outputBytes;
+ }
+ }
+
+ /* normal end of conversion: prepare for a new character */
+ c=0;
+ }
+ } else {
+ if(c!=0 && targetCapacity>0) {
+ goto getTrailUnicode;
+ }
+
+ /* state machine for Unicode mode */
+/* unicodeByteMode: */
+ while(source<sourceLimit) {
+ if(targetCapacity<=0) {
+ /* target is full */
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ break;
+ }
+ c=*source++;
+
+ if((uint32_t)(c-0x3400)<(0xd800-0x3400)) {
+ /* not compressible, write character directly */
+ if(targetCapacity>=2) {
+ *target++=(uint8_t)(c>>8);
+ *target++=(uint8_t)c;
+ targetCapacity-=2;
+ } else {
+ length=2;
+ goto outputBytes;
+ }
+ } else if((uint32_t)(c-0x3400)>=(0xf300-0x3400) /* c<0x3400 || c>=0xf300 */) {
+ /* compress BMP character if the following one is not an uncompressible ideograph */
+ if(!(source<sourceLimit && (uint32_t)(*source-0x3400)<(0xd800-0x3400))) {
+ if(((uint32_t)(c-0x30)<10 || (uint32_t)(c-0x61)<26 || (uint32_t)(c-0x41)<26)) {
+ /* ASCII digit or letter */
+ isSingleByteMode=TRUE;
+ c|=((uint32_t)(UC0+dynamicWindow)<<8)|c;
+ length=2;
+ goto outputBytes;
+ } else if((window=getWindow(scsu->fromUDynamicOffsets, c))>=0) {
+ /* there is a dynamic window that contains this character, change to it */
+ isSingleByteMode=TRUE;
+ dynamicWindow=window;
+ currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
+ useDynamicWindow(scsu, dynamicWindow);
+ c=((uint32_t)(UC0+dynamicWindow)<<8)|(c-currentOffset)|0x80;
+ length=2;
+ goto outputBytes;
+ } else if((code=getDynamicOffset(c, &offset))>=0) {
+ /* define a dynamic window with this character */
+ isSingleByteMode=TRUE;
+ dynamicWindow=getNextDynamicWindow(scsu);
+ currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset;
+ useDynamicWindow(scsu, dynamicWindow);
+ c=((uint32_t)(UD0+dynamicWindow)<<16)|((uint32_t)code<<8)|(c-currentOffset)|0x80;
+ length=3;
+ goto outputBytes;
+ }
+ }
+
+ /* don't know how to compress this character, just write it directly */
+ length=2;
+ goto outputBytes;
+ } else if(c<0xe000) {
+ /* c is a surrogate */
+ if(U16_IS_SURROGATE_LEAD(c)) {
+getTrailUnicode:
+ lead=(UChar)c;
+ if(source<sourceLimit) {
+ /* test the following code unit */
+ trail=*source;
+ if(U16_IS_TRAIL(trail)) {
+ ++source;
+ c=U16_GET_SUPPLEMENTARY(c, trail);
+ /* convert this surrogate code point */
+ /* exit this condition tree */
+ } else {
+ /* this is an unmatched lead code unit (1st surrogate) */
+ /* callback(illegal) */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ goto endloop;
+ }
+ } else {
+ /* no more input */
+ break;
+ }
+ } else {
+ /* this is an unmatched trail code unit (2nd surrogate) */
+ /* callback(illegal) */
+ *pErrorCode=U_ILLEGAL_CHAR_FOUND;
+ goto endloop;
+ }
+
+ /* compress supplementary character */
+ if( (window=getWindow(scsu->fromUDynamicOffsets, c))>=0 &&
+ !(source<sourceLimit && (uint32_t)(*source-0x3400)<(0xd800-0x3400))
+ ) {
+ /*
+ * there is a dynamic window that contains this character and
+ * the following character is not uncompressible,
+ * change to the window
+ */
+ isSingleByteMode=TRUE;
+ dynamicWindow=window;
+ currentOffset=scsu->fromUDynamicOffsets[dynamicWindow];
+ useDynamicWindow(scsu, dynamicWindow);
+ c=((uint32_t)(UC0+dynamicWindow)<<8)|(c-currentOffset)|0x80;
+ length=2;
+ goto outputBytes;
+ } else if(source<sourceLimit && lead==*source && /* too lazy to check trail in same window as source[1] */
+ (code=getDynamicOffset(c, &offset))>=0
+ ) {
+ /* two supplementary characters in (probably) the same window - define an extended one */
+ isSingleByteMode=TRUE;
+ code-=0x200;
+ dynamicWindow=getNextDynamicWindow(scsu);
+ currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset;
+ useDynamicWindow(scsu, dynamicWindow);
+ c=((uint32_t)UDX<<24)|((uint32_t)dynamicWindow<<21)|((uint32_t)code<<8)|(c-currentOffset)|0x80;
+ length=4;
+ goto outputBytes;
+ } else {
+ /* don't know how to compress this character, just write it directly */
+ c=((uint32_t)lead<<16)|trail;
+ length=4;
+ goto outputBytes;
+ }
+ } else /* 0xe000<=c<0xf300 */ {
+ /* quote to avoid SCSU tags */
+ c|=UQU<<16;
+ length=3;
+ goto outputBytes;
+ }
+
+ /* normal end of conversion: prepare for a new character */
+ c=0;
+ }
+ }
+endloop:
+
+ /* set the converter state back into UConverter */
+ scsu->fromUIsSingleByteMode=isSingleByteMode;
+ scsu->fromUDynamicWindow=dynamicWindow;
+
+ cnv->fromUChar32=c;
+
+ /* write back the updated pointers */
+ pArgs->source=source;
+ pArgs->target=(char *)target;
+ return;
+
+outputBytes:
+ /* write the output character bytes from c and length [code copied from ucnvmbcs.c] */
+ /* from the first if in the loop we know that targetCapacity>0 */
+ if(length<=targetCapacity) {
+ switch(length) {
+ /* each branch falls through to the next one */
+ case 4:
+ *target++=(uint8_t)(c>>24);
+ U_FALLTHROUGH;
+ case 3:
+ *target++=(uint8_t)(c>>16);
+ U_FALLTHROUGH;
+ case 2:
+ *target++=(uint8_t)(c>>8);
+ U_FALLTHROUGH;
+ case 1:
+ *target++=(uint8_t)c;
+ U_FALLTHROUGH;
+ default:
+ /* will never occur */
+ break;
+ }
+ targetCapacity-=length;
+
+ /* normal end of conversion: prepare for a new character */
+ c=0;
+ goto loop;
+ } else {
+ uint8_t *p;
+
+ /*
+ * We actually do this backwards here:
+ * In order to save an intermediate variable, we output
+ * first to the overflow buffer what does not fit into the
+ * regular target.
+ */
+ /* we know that 0<=targetCapacity<length<=4 */
+ /* targetCapacity==0 when SCU+supplementary where SCU used up targetCapacity==1 */
+ length-=targetCapacity;
+ p=(uint8_t *)cnv->charErrorBuffer;
+ switch(length) {
+ /* each branch falls through to the next one */
+ case 4:
+ *p++=(uint8_t)(c>>24);
+ U_FALLTHROUGH;
+ case 3:
+ *p++=(uint8_t)(c>>16);
+ U_FALLTHROUGH;
+ case 2:
+ *p++=(uint8_t)(c>>8);
+ U_FALLTHROUGH;
+ case 1:
+ *p=(uint8_t)c;
+ U_FALLTHROUGH;
+ default:
+ /* will never occur */
+ break;
+ }
+ cnv->charErrorBufferLength=(int8_t)length;
+
+ /* now output what fits into the regular target */
+ c>>=8*length; /* length was reduced by targetCapacity */
+ switch(targetCapacity) {
+ /* each branch falls through to the next one */
+ case 3:
+ *target++=(uint8_t)(c>>16);
+ U_FALLTHROUGH;
+ case 2:
+ *target++=(uint8_t)(c>>8);
+ U_FALLTHROUGH;
+ case 1:
+ *target++=(uint8_t)c;
+ U_FALLTHROUGH;
+ default:
+ break;
+ }
+
+ /* target overflow */
+ targetCapacity=0;
+ *pErrorCode=U_BUFFER_OVERFLOW_ERROR;
+ c=0;
+ goto endloop;
+ }
+}
+
+/* miscellaneous ------------------------------------------------------------ */
+
+static const char * U_CALLCONV
+_SCSUGetName(const UConverter *cnv) {
+ SCSUData *scsu=(SCSUData *)cnv->extraInfo;
+
+ switch(scsu->locale) {
+ case l_ja:
+ return "SCSU,locale=ja";
+ default:
+ return "SCSU";
+ }
+}
+
+/* structure for SafeClone calculations */
+struct cloneSCSUStruct
+{
+ UConverter cnv;
+ SCSUData mydata;
+};
+
+static UConverter * U_CALLCONV
+_SCSUSafeClone(const UConverter *cnv,
+ void *stackBuffer,
+ int32_t *pBufferSize,
+ UErrorCode *status)
+{
+ struct cloneSCSUStruct * localClone;
+ int32_t bufferSizeNeeded = sizeof(struct cloneSCSUStruct);
+
+ if (U_FAILURE(*status)){
+ return 0;
+ }
+
+ if (*pBufferSize == 0){ /* 'preflighting' request - set needed size into *pBufferSize */
+ *pBufferSize = bufferSizeNeeded;
+ return 0;
+ }
+
+ localClone = (struct cloneSCSUStruct *)stackBuffer;
+ /* ucnv.c/ucnv_safeClone() copied the main UConverter already */
+
+ uprv_memcpy(&localClone->mydata, cnv->extraInfo, sizeof(SCSUData));
+ localClone->cnv.extraInfo = &localClone->mydata;
+ localClone->cnv.isExtraLocal = TRUE;
+
+ return &localClone->cnv;
+}
+U_CDECL_END
+
+static const UConverterImpl _SCSUImpl={
+ UCNV_SCSU,
+
+ NULL,
+ NULL,
+
+ _SCSUOpen,
+ _SCSUClose,
+ _SCSUReset,
+
+ _SCSUToUnicode,
+ _SCSUToUnicodeWithOffsets,
+ _SCSUFromUnicode,
+ _SCSUFromUnicodeWithOffsets,
+ NULL,
+
+ NULL,
+ _SCSUGetName,
+ NULL,
+ _SCSUSafeClone,
+ ucnv_getCompleteUnicodeSet,
+ NULL,
+ NULL
+};
+
+static const UConverterStaticData _SCSUStaticData={
+ sizeof(UConverterStaticData),
+ "SCSU",
+ 1212, /* CCSID for SCSU */
+ UCNV_IBM, UCNV_SCSU,
+ 1, 3, /* one UChar generates at least 1 byte and at most 3 bytes */
+ /*
+ * The subchar here is ignored because _SCSUOpen() sets U+fffd as a Unicode
+ * substitution string.
+ */
+ { 0x0e, 0xff, 0xfd, 0 }, 3,
+ FALSE, FALSE,
+ 0,
+ 0,
+ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
+};
+
+const UConverterSharedData _SCSUData=
+ UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_SCSUStaticData, &_SCSUImpl);
+
+#endif
diff --git a/contrib/libs/icu/common/ucnvsel.cpp b/contrib/libs/icu/common/ucnvsel.cpp
index 2e2c6fb46b..2dff5ac1bc 100644
--- a/contrib/libs/icu/common/ucnvsel.cpp
+++ b/contrib/libs/icu/common/ucnvsel.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -41,7 +41,7 @@
#include "propsvec.h"
#include "uassert.h"
#include "ucmndata.h"
-#include "udataswp.h"
+#include "udataswp.h"
#include "uenumimp.h"
#include "cmemory.h"
#include "cstring.h"
@@ -73,7 +73,7 @@ static void generateSelectorData(UConverterSelector* result,
// set errorValue to all-ones
for (int32_t col = 0; col < columns; col++) {
upvec_setValue(upvec, UPVEC_ERROR_VALUE_CP, UPVEC_ERROR_VALUE_CP,
- col, static_cast<uint32_t>(~0), static_cast<uint32_t>(~0), status);
+ col, static_cast<uint32_t>(~0), static_cast<uint32_t>(~0), status);
}
for (int32_t i = 0; i < result->encodingsCount; ++i) {
@@ -110,7 +110,7 @@ static void generateSelectorData(UConverterSelector* result,
// this will be reached for the converters that fill the set with
// strings. Those should be ignored by our system
} else {
- upvec_setValue(upvec, start_char, end_char, column, static_cast<uint32_t>(~0), mask,
+ upvec_setValue(upvec, start_char, end_char, column, static_cast<uint32_t>(~0), mask,
status);
}
}
@@ -131,7 +131,7 @@ static void generateSelectorData(UConverterSelector* result,
uset_getItem(excludedCodePoints, j, &start_char, &end_char, NULL, 0,
status);
for (int32_t col = 0; col < columns; col++) {
- upvec_setValue(upvec, start_char, end_char, col, static_cast<uint32_t>(~0), static_cast<uint32_t>(~0),
+ upvec_setValue(upvec, start_char, end_char, col, static_cast<uint32_t>(~0), static_cast<uint32_t>(~0),
status);
}
}
@@ -685,42 +685,42 @@ static int16_t countOnes(uint32_t* mask, int32_t len) {
ent &= ent - 1; // clear the least significant bit set
}
}
- return static_cast<int16_t>(totalOnes);
+ return static_cast<int16_t>(totalOnes);
}
/* internal function! */
static UEnumeration *selectForMask(const UConverterSelector* sel,
- uint32_t *theMask, UErrorCode *status) {
- LocalMemory<uint32_t> mask(theMask);
+ uint32_t *theMask, UErrorCode *status) {
+ LocalMemory<uint32_t> mask(theMask);
// this is the context we will use. Store a table of indices to which
// encodings are legit.
- LocalMemory<Enumerator> result(static_cast<Enumerator *>(uprv_malloc(sizeof(Enumerator))));
- if (result.isNull()) {
+ LocalMemory<Enumerator> result(static_cast<Enumerator *>(uprv_malloc(sizeof(Enumerator))));
+ if (result.isNull()) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
+ return nullptr;
}
- result->index = nullptr; // this will be allocated later!
+ result->index = nullptr; // this will be allocated later!
result->length = result->cur = 0;
result->sel = sel;
- LocalMemory<UEnumeration> en(static_cast<UEnumeration *>(uprv_malloc(sizeof(UEnumeration))));
- if (en.isNull()) {
+ LocalMemory<UEnumeration> en(static_cast<UEnumeration *>(uprv_malloc(sizeof(UEnumeration))));
+ if (en.isNull()) {
// TODO(markus): Combine Enumerator and UEnumeration into one struct.
*status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
+ return nullptr;
}
- memcpy(en.getAlias(), &defaultEncodings, sizeof(UEnumeration));
-
+ memcpy(en.getAlias(), &defaultEncodings, sizeof(UEnumeration));
+
int32_t columns = (sel->encodingsCount+31)/32;
- int16_t numOnes = countOnes(mask.getAlias(), columns);
+ int16_t numOnes = countOnes(mask.getAlias(), columns);
// now, we know the exact space we need for index
if (numOnes > 0) {
- result->index = static_cast<int16_t*>(uprv_malloc(numOnes * sizeof(int16_t)));
- if (result->index == nullptr) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
+ result->index = static_cast<int16_t*>(uprv_malloc(numOnes * sizeof(int16_t)));
+ if (result->index == nullptr) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
int32_t i, j;
int16_t k = 0;
for (j = 0 ; j < columns; j++) {
@@ -734,8 +734,8 @@ static UEnumeration *selectForMask(const UConverterSelector* sel,
}
} //otherwise, index will remain NULL (and will never be touched by
//the enumerator code anyway)
- en->context = result.orphan();
- return en.orphan();
+ en->context = result.orphan();
+ return en.orphan();
}
/* check a string against the selector - UTF16 version */
diff --git a/contrib/libs/icu/common/ucol_data.h b/contrib/libs/icu/common/ucol_data.h
index 8873f49ee5..83f54abba1 100644
--- a/contrib/libs/icu/common/ucol_data.h
+++ b/contrib/libs/icu/common/ucol_data.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: ucol_data.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/ucol_swp.cpp b/contrib/libs/icu/common/ucol_swp.cpp
index ccb96d7d21..1af19863fa 100644
--- a/contrib/libs/icu/common/ucol_swp.cpp
+++ b/contrib/libs/icu/common/ucol_swp.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: ucol_swp.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/ucol_swp.h b/contrib/libs/icu/common/ucol_swp.h
index 25b969b0be..fd8be9aa54 100644
--- a/contrib/libs/icu/common/ucol_swp.h
+++ b/contrib/libs/icu/common/ucol_swp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: ucol_swp.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/ucptrie.cpp b/contrib/libs/icu/common/ucptrie.cpp
index fd4d942ecd..0004160a23 100644
--- a/contrib/libs/icu/common/ucptrie.cpp
+++ b/contrib/libs/icu/common/ucptrie.cpp
@@ -1,601 +1,601 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// ucptrie.cpp (modified from utrie2.cpp)
-// created: 2017dec29 Markus W. Scherer
-
-// #define UCPTRIE_DEBUG
-#ifdef UCPTRIE_DEBUG
-# include <stdio.h>
-#endif
-
-#include "unicode/utypes.h"
-#include "unicode/ucptrie.h"
-#include "unicode/utf.h"
-#include "unicode/utf8.h"
-#include "unicode/utf16.h"
-#include "cmemory.h"
-#include "uassert.h"
-#include "ucptrie_impl.h"
-
-U_CAPI UCPTrie * U_EXPORT2
-ucptrie_openFromBinary(UCPTrieType type, UCPTrieValueWidth valueWidth,
- const void *data, int32_t length, int32_t *pActualLength,
- UErrorCode *pErrorCode) {
- if (U_FAILURE(*pErrorCode)) {
- return nullptr;
- }
-
- if (length <= 0 || (U_POINTER_MASK_LSB(data, 3) != 0) ||
- type < UCPTRIE_TYPE_ANY || UCPTRIE_TYPE_SMALL < type ||
- valueWidth < UCPTRIE_VALUE_BITS_ANY || UCPTRIE_VALUE_BITS_8 < valueWidth) {
- *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
- }
-
- // Enough data for a trie header?
- if (length < (int32_t)sizeof(UCPTrieHeader)) {
- *pErrorCode = U_INVALID_FORMAT_ERROR;
- return nullptr;
- }
-
- // Check the signature.
- const UCPTrieHeader *header = (const UCPTrieHeader *)data;
- if (header->signature != UCPTRIE_SIG) {
- *pErrorCode = U_INVALID_FORMAT_ERROR;
- return nullptr;
- }
-
- int32_t options = header->options;
- int32_t typeInt = (options >> 6) & 3;
- int32_t valueWidthInt = options & UCPTRIE_OPTIONS_VALUE_BITS_MASK;
- if (typeInt > UCPTRIE_TYPE_SMALL || valueWidthInt > UCPTRIE_VALUE_BITS_8 ||
- (options & UCPTRIE_OPTIONS_RESERVED_MASK) != 0) {
- *pErrorCode = U_INVALID_FORMAT_ERROR;
- return nullptr;
- }
- UCPTrieType actualType = (UCPTrieType)typeInt;
- UCPTrieValueWidth actualValueWidth = (UCPTrieValueWidth)valueWidthInt;
- if (type < 0) {
- type = actualType;
- }
- if (valueWidth < 0) {
- valueWidth = actualValueWidth;
- }
- if (type != actualType || valueWidth != actualValueWidth) {
- *pErrorCode = U_INVALID_FORMAT_ERROR;
- return nullptr;
- }
-
- // Get the length values and offsets.
- UCPTrie tempTrie;
- uprv_memset(&tempTrie, 0, sizeof(tempTrie));
- tempTrie.indexLength = header->indexLength;
- tempTrie.dataLength =
- ((options & UCPTRIE_OPTIONS_DATA_LENGTH_MASK) << 4) | header->dataLength;
- tempTrie.index3NullOffset = header->index3NullOffset;
- tempTrie.dataNullOffset =
- ((options & UCPTRIE_OPTIONS_DATA_NULL_OFFSET_MASK) << 8) | header->dataNullOffset;
-
- tempTrie.highStart = header->shiftedHighStart << UCPTRIE_SHIFT_2;
- tempTrie.shifted12HighStart = (tempTrie.highStart + 0xfff) >> 12;
- tempTrie.type = type;
- tempTrie.valueWidth = valueWidth;
-
- // Calculate the actual length.
- int32_t actualLength = (int32_t)sizeof(UCPTrieHeader) + tempTrie.indexLength * 2;
- if (valueWidth == UCPTRIE_VALUE_BITS_16) {
- actualLength += tempTrie.dataLength * 2;
- } else if (valueWidth == UCPTRIE_VALUE_BITS_32) {
- actualLength += tempTrie.dataLength * 4;
- } else {
- actualLength += tempTrie.dataLength;
- }
- if (length < actualLength) {
- *pErrorCode = U_INVALID_FORMAT_ERROR; // Not enough bytes.
- return nullptr;
- }
-
- // Allocate the trie.
- UCPTrie *trie = (UCPTrie *)uprv_malloc(sizeof(UCPTrie));
- if (trie == nullptr) {
- *pErrorCode = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
- uprv_memcpy(trie, &tempTrie, sizeof(tempTrie));
-#ifdef UCPTRIE_DEBUG
- trie->name = "fromSerialized";
-#endif
-
- // Set the pointers to its index and data arrays.
- const uint16_t *p16 = (const uint16_t *)(header + 1);
- trie->index = p16;
- p16 += trie->indexLength;
-
- // Get the data.
- int32_t nullValueOffset = trie->dataNullOffset;
- if (nullValueOffset >= trie->dataLength) {
- nullValueOffset = trie->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET;
- }
- switch (valueWidth) {
- case UCPTRIE_VALUE_BITS_16:
- trie->data.ptr16 = p16;
- trie->nullValue = trie->data.ptr16[nullValueOffset];
- break;
- case UCPTRIE_VALUE_BITS_32:
- trie->data.ptr32 = (const uint32_t *)p16;
- trie->nullValue = trie->data.ptr32[nullValueOffset];
- break;
- case UCPTRIE_VALUE_BITS_8:
- trie->data.ptr8 = (const uint8_t *)p16;
- trie->nullValue = trie->data.ptr8[nullValueOffset];
- break;
- default:
- // Unreachable because valueWidth was checked above.
- *pErrorCode = U_INVALID_FORMAT_ERROR;
- return nullptr;
- }
-
- if (pActualLength != nullptr) {
- *pActualLength = actualLength;
- }
- return trie;
-}
-
-U_CAPI void U_EXPORT2
-ucptrie_close(UCPTrie *trie) {
- uprv_free(trie);
-}
-
-U_CAPI UCPTrieType U_EXPORT2
-ucptrie_getType(const UCPTrie *trie) {
- return (UCPTrieType)trie->type;
-}
-
-U_CAPI UCPTrieValueWidth U_EXPORT2
-ucptrie_getValueWidth(const UCPTrie *trie) {
- return (UCPTrieValueWidth)trie->valueWidth;
-}
-
-U_CAPI int32_t U_EXPORT2
-ucptrie_internalSmallIndex(const UCPTrie *trie, UChar32 c) {
- int32_t i1 = c >> UCPTRIE_SHIFT_1;
- if (trie->type == UCPTRIE_TYPE_FAST) {
- U_ASSERT(0xffff < c && c < trie->highStart);
- i1 += UCPTRIE_BMP_INDEX_LENGTH - UCPTRIE_OMITTED_BMP_INDEX_1_LENGTH;
- } else {
- U_ASSERT((uint32_t)c < (uint32_t)trie->highStart && trie->highStart > UCPTRIE_SMALL_LIMIT);
- i1 += UCPTRIE_SMALL_INDEX_LENGTH;
- }
- int32_t i3Block = trie->index[
- (int32_t)trie->index[i1] + ((c >> UCPTRIE_SHIFT_2) & UCPTRIE_INDEX_2_MASK)];
- int32_t i3 = (c >> UCPTRIE_SHIFT_3) & UCPTRIE_INDEX_3_MASK;
- int32_t dataBlock;
- if ((i3Block & 0x8000) == 0) {
- // 16-bit indexes
- dataBlock = trie->index[i3Block + i3];
- } else {
- // 18-bit indexes stored in groups of 9 entries per 8 indexes.
- i3Block = (i3Block & 0x7fff) + (i3 & ~7) + (i3 >> 3);
- i3 &= 7;
- dataBlock = ((int32_t)trie->index[i3Block++] << (2 + (2 * i3))) & 0x30000;
- dataBlock |= trie->index[i3Block + i3];
- }
- return dataBlock + (c & UCPTRIE_SMALL_DATA_MASK);
-}
-
-U_CAPI int32_t U_EXPORT2
-ucptrie_internalSmallU8Index(const UCPTrie *trie, int32_t lt1, uint8_t t2, uint8_t t3) {
- UChar32 c = (lt1 << 12) | (t2 << 6) | t3;
- if (c >= trie->highStart) {
- // Possible because the UTF-8 macro compares with shifted12HighStart which may be higher.
- return trie->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET;
- }
- return ucptrie_internalSmallIndex(trie, c);
-}
-
-U_CAPI int32_t U_EXPORT2
-ucptrie_internalU8PrevIndex(const UCPTrie *trie, UChar32 c,
- const uint8_t *start, const uint8_t *src) {
- int32_t i, length;
- // Support 64-bit pointers by avoiding cast of arbitrary difference.
- if ((src - start) <= 7) {
- i = length = (int32_t)(src - start);
- } else {
- i = length = 7;
- start = src - 7;
- }
- c = utf8_prevCharSafeBody(start, 0, &i, c, -1);
- i = length - i; // Number of bytes read backward from src.
- int32_t idx = _UCPTRIE_CP_INDEX(trie, 0xffff, c);
- return (idx << 3) | i;
-}
-
-namespace {
-
-inline uint32_t getValue(UCPTrieData data, UCPTrieValueWidth valueWidth, int32_t dataIndex) {
- switch (valueWidth) {
- case UCPTRIE_VALUE_BITS_16:
- return data.ptr16[dataIndex];
- case UCPTRIE_VALUE_BITS_32:
- return data.ptr32[dataIndex];
- case UCPTRIE_VALUE_BITS_8:
- return data.ptr8[dataIndex];
- default:
- // Unreachable if the trie is properly initialized.
- return 0xffffffff;
- }
-}
-
-} // namespace
-
-U_CAPI uint32_t U_EXPORT2
-ucptrie_get(const UCPTrie *trie, UChar32 c) {
- int32_t dataIndex;
- if ((uint32_t)c <= 0x7f) {
- // linear ASCII
- dataIndex = c;
- } else {
- UChar32 fastMax = trie->type == UCPTRIE_TYPE_FAST ? 0xffff : UCPTRIE_SMALL_MAX;
- dataIndex = _UCPTRIE_CP_INDEX(trie, fastMax, c);
- }
- return getValue(trie->data, (UCPTrieValueWidth)trie->valueWidth, dataIndex);
-}
-
-namespace {
-
-constexpr int32_t MAX_UNICODE = 0x10ffff;
-
-inline uint32_t maybeFilterValue(uint32_t value, uint32_t trieNullValue, uint32_t nullValue,
- UCPMapValueFilter *filter, const void *context) {
- if (value == trieNullValue) {
- value = nullValue;
- } else if (filter != nullptr) {
- value = filter(context, value);
- }
- return value;
-}
-
-UChar32 getRange(const void *t, UChar32 start,
- UCPMapValueFilter *filter, const void *context, uint32_t *pValue) {
- if ((uint32_t)start > MAX_UNICODE) {
- return U_SENTINEL;
- }
- const UCPTrie *trie = reinterpret_cast<const UCPTrie *>(t);
- UCPTrieValueWidth valueWidth = (UCPTrieValueWidth)trie->valueWidth;
- if (start >= trie->highStart) {
- if (pValue != nullptr) {
- int32_t di = trie->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET;
- uint32_t value = getValue(trie->data, valueWidth, di);
- if (filter != nullptr) { value = filter(context, value); }
- *pValue = value;
- }
- return MAX_UNICODE;
- }
-
- uint32_t nullValue = trie->nullValue;
- if (filter != nullptr) { nullValue = filter(context, nullValue); }
- const uint16_t *index = trie->index;
-
- int32_t prevI3Block = -1;
- int32_t prevBlock = -1;
- UChar32 c = start;
- uint32_t trieValue, value = nullValue;
- bool haveValue = false;
- do {
- int32_t i3Block;
- int32_t i3;
- int32_t i3BlockLength;
- int32_t dataBlockLength;
- if (c <= 0xffff && (trie->type == UCPTRIE_TYPE_FAST || c <= UCPTRIE_SMALL_MAX)) {
- i3Block = 0;
- i3 = c >> UCPTRIE_FAST_SHIFT;
- i3BlockLength = trie->type == UCPTRIE_TYPE_FAST ?
- UCPTRIE_BMP_INDEX_LENGTH : UCPTRIE_SMALL_INDEX_LENGTH;
- dataBlockLength = UCPTRIE_FAST_DATA_BLOCK_LENGTH;
- } else {
- // Use the multi-stage index.
- int32_t i1 = c >> UCPTRIE_SHIFT_1;
- if (trie->type == UCPTRIE_TYPE_FAST) {
- U_ASSERT(0xffff < c && c < trie->highStart);
- i1 += UCPTRIE_BMP_INDEX_LENGTH - UCPTRIE_OMITTED_BMP_INDEX_1_LENGTH;
- } else {
- U_ASSERT(c < trie->highStart && trie->highStart > UCPTRIE_SMALL_LIMIT);
- i1 += UCPTRIE_SMALL_INDEX_LENGTH;
- }
- i3Block = trie->index[
- (int32_t)trie->index[i1] + ((c >> UCPTRIE_SHIFT_2) & UCPTRIE_INDEX_2_MASK)];
- if (i3Block == prevI3Block && (c - start) >= UCPTRIE_CP_PER_INDEX_2_ENTRY) {
- // The index-3 block is the same as the previous one, and filled with value.
- U_ASSERT((c & (UCPTRIE_CP_PER_INDEX_2_ENTRY - 1)) == 0);
- c += UCPTRIE_CP_PER_INDEX_2_ENTRY;
- continue;
- }
- prevI3Block = i3Block;
- if (i3Block == trie->index3NullOffset) {
- // This is the index-3 null block.
- if (haveValue) {
- if (nullValue != value) {
- return c - 1;
- }
- } else {
- trieValue = trie->nullValue;
- value = nullValue;
- if (pValue != nullptr) { *pValue = nullValue; }
- haveValue = true;
- }
- prevBlock = trie->dataNullOffset;
- c = (c + UCPTRIE_CP_PER_INDEX_2_ENTRY) & ~(UCPTRIE_CP_PER_INDEX_2_ENTRY - 1);
- continue;
- }
- i3 = (c >> UCPTRIE_SHIFT_3) & UCPTRIE_INDEX_3_MASK;
- i3BlockLength = UCPTRIE_INDEX_3_BLOCK_LENGTH;
- dataBlockLength = UCPTRIE_SMALL_DATA_BLOCK_LENGTH;
- }
- // Enumerate data blocks for one index-3 block.
- do {
- int32_t block;
- if ((i3Block & 0x8000) == 0) {
- block = index[i3Block + i3];
- } else {
- // 18-bit indexes stored in groups of 9 entries per 8 indexes.
- int32_t group = (i3Block & 0x7fff) + (i3 & ~7) + (i3 >> 3);
- int32_t gi = i3 & 7;
- block = ((int32_t)index[group++] << (2 + (2 * gi))) & 0x30000;
- block |= index[group + gi];
- }
- if (block == prevBlock && (c - start) >= dataBlockLength) {
- // The block is the same as the previous one, and filled with value.
- U_ASSERT((c & (dataBlockLength - 1)) == 0);
- c += dataBlockLength;
- } else {
- int32_t dataMask = dataBlockLength - 1;
- prevBlock = block;
- if (block == trie->dataNullOffset) {
- // This is the data null block.
- if (haveValue) {
- if (nullValue != value) {
- return c - 1;
- }
- } else {
- trieValue = trie->nullValue;
- value = nullValue;
- if (pValue != nullptr) { *pValue = nullValue; }
- haveValue = true;
- }
- c = (c + dataBlockLength) & ~dataMask;
- } else {
- int32_t di = block + (c & dataMask);
- uint32_t trieValue2 = getValue(trie->data, valueWidth, di);
- if (haveValue) {
- if (trieValue2 != trieValue) {
- if (filter == nullptr ||
- maybeFilterValue(trieValue2, trie->nullValue, nullValue,
- filter, context) != value) {
- return c - 1;
- }
- trieValue = trieValue2; // may or may not help
- }
- } else {
- trieValue = trieValue2;
- value = maybeFilterValue(trieValue2, trie->nullValue, nullValue,
- filter, context);
- if (pValue != nullptr) { *pValue = value; }
- haveValue = true;
- }
- while ((++c & dataMask) != 0) {
- trieValue2 = getValue(trie->data, valueWidth, ++di);
- if (trieValue2 != trieValue) {
- if (filter == nullptr ||
- maybeFilterValue(trieValue2, trie->nullValue, nullValue,
- filter, context) != value) {
- return c - 1;
- }
- trieValue = trieValue2; // may or may not help
- }
- }
- }
- }
- } while (++i3 < i3BlockLength);
- } while (c < trie->highStart);
- U_ASSERT(haveValue);
- int32_t di = trie->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET;
- uint32_t highValue = getValue(trie->data, valueWidth, di);
- if (maybeFilterValue(highValue, trie->nullValue, nullValue,
- filter, context) != value) {
- return c - 1;
- } else {
- return MAX_UNICODE;
- }
-}
-
-} // namespace
-
-U_CFUNC UChar32
-ucptrie_internalGetRange(UCPTrieGetRange *getRange,
- const void *trie, UChar32 start,
- UCPMapRangeOption option, uint32_t surrogateValue,
- UCPMapValueFilter *filter, const void *context, uint32_t *pValue) {
- if (option == UCPMAP_RANGE_NORMAL) {
- return getRange(trie, start, filter, context, pValue);
- }
- uint32_t value;
- if (pValue == nullptr) {
- // We need to examine the range value even if the caller does not want it.
- pValue = &value;
- }
- UChar32 surrEnd = option == UCPMAP_RANGE_FIXED_ALL_SURROGATES ? 0xdfff : 0xdbff;
- UChar32 end = getRange(trie, start, filter, context, pValue);
- if (end < 0xd7ff || start > surrEnd) {
- return end;
- }
- // The range overlaps with surrogates, or ends just before the first one.
- if (*pValue == surrogateValue) {
- if (end >= surrEnd) {
- // Surrogates followed by a non-surrogateValue range,
- // or surrogates are part of a larger surrogateValue range.
- return end;
- }
- } else {
- if (start <= 0xd7ff) {
- return 0xd7ff; // Non-surrogateValue range ends before surrogateValue surrogates.
- }
- // Start is a surrogate with a non-surrogateValue code *unit* value.
- // Return a surrogateValue code *point* range.
- *pValue = surrogateValue;
- if (end > surrEnd) {
- return surrEnd; // Surrogate range ends before non-surrogateValue rest of range.
- }
- }
- // See if the surrogateValue surrogate range can be merged with
- // an immediately following range.
- uint32_t value2;
- UChar32 end2 = getRange(trie, surrEnd + 1, filter, context, &value2);
- if (value2 == surrogateValue) {
- return end2;
- }
- return surrEnd;
-}
-
-U_CAPI UChar32 U_EXPORT2
-ucptrie_getRange(const UCPTrie *trie, UChar32 start,
- UCPMapRangeOption option, uint32_t surrogateValue,
- UCPMapValueFilter *filter, const void *context, uint32_t *pValue) {
- return ucptrie_internalGetRange(getRange, trie, start,
- option, surrogateValue,
- filter, context, pValue);
-}
-
-U_CAPI int32_t U_EXPORT2
-ucptrie_toBinary(const UCPTrie *trie,
- void *data, int32_t capacity,
- UErrorCode *pErrorCode) {
- if (U_FAILURE(*pErrorCode)) {
- return 0;
- }
-
- UCPTrieType type = (UCPTrieType)trie->type;
- UCPTrieValueWidth valueWidth = (UCPTrieValueWidth)trie->valueWidth;
- if (type < UCPTRIE_TYPE_FAST || UCPTRIE_TYPE_SMALL < type ||
- valueWidth < UCPTRIE_VALUE_BITS_16 || UCPTRIE_VALUE_BITS_8 < valueWidth ||
- capacity < 0 ||
- (capacity > 0 && (data == nullptr || (U_POINTER_MASK_LSB(data, 3) != 0)))) {
- *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- int32_t length = (int32_t)sizeof(UCPTrieHeader) + trie->indexLength * 2;
- switch (valueWidth) {
- case UCPTRIE_VALUE_BITS_16:
- length += trie->dataLength * 2;
- break;
- case UCPTRIE_VALUE_BITS_32:
- length += trie->dataLength * 4;
- break;
- case UCPTRIE_VALUE_BITS_8:
- length += trie->dataLength;
- break;
- default:
- // unreachable
- break;
- }
- if (capacity < length) {
- *pErrorCode = U_BUFFER_OVERFLOW_ERROR;
- return length;
- }
-
- char *bytes = (char *)data;
- UCPTrieHeader *header = (UCPTrieHeader *)bytes;
- header->signature = UCPTRIE_SIG; // "Tri3"
- header->options = (uint16_t)(
- ((trie->dataLength & 0xf0000) >> 4) |
- ((trie->dataNullOffset & 0xf0000) >> 8) |
- (trie->type << 6) |
- valueWidth);
- header->indexLength = (uint16_t)trie->indexLength;
- header->dataLength = (uint16_t)trie->dataLength;
- header->index3NullOffset = trie->index3NullOffset;
- header->dataNullOffset = (uint16_t)trie->dataNullOffset;
- header->shiftedHighStart = trie->highStart >> UCPTRIE_SHIFT_2;
- bytes += sizeof(UCPTrieHeader);
-
- uprv_memcpy(bytes, trie->index, trie->indexLength * 2);
- bytes += trie->indexLength * 2;
-
- switch (valueWidth) {
- case UCPTRIE_VALUE_BITS_16:
- uprv_memcpy(bytes, trie->data.ptr16, trie->dataLength * 2);
- break;
- case UCPTRIE_VALUE_BITS_32:
- uprv_memcpy(bytes, trie->data.ptr32, trie->dataLength * 4);
- break;
- case UCPTRIE_VALUE_BITS_8:
- uprv_memcpy(bytes, trie->data.ptr8, trie->dataLength);
- break;
- default:
- // unreachable
- break;
- }
- return length;
-}
-
-namespace {
-
-#ifdef UCPTRIE_DEBUG
-long countNull(const UCPTrie *trie) {
- uint32_t nullValue=trie->nullValue;
- int32_t length=trie->dataLength;
- long count=0;
- switch (trie->valueWidth) {
- case UCPTRIE_VALUE_BITS_16:
- for(int32_t i=0; i<length; ++i) {
- if(trie->data.ptr16[i]==nullValue) { ++count; }
- }
- break;
- case UCPTRIE_VALUE_BITS_32:
- for(int32_t i=0; i<length; ++i) {
- if(trie->data.ptr32[i]==nullValue) { ++count; }
- }
- break;
- case UCPTRIE_VALUE_BITS_8:
- for(int32_t i=0; i<length; ++i) {
- if(trie->data.ptr8[i]==nullValue) { ++count; }
- }
- break;
- default:
- // unreachable
- break;
- }
- return count;
-}
-
-U_CFUNC void
-ucptrie_printLengths(const UCPTrie *trie, const char *which) {
- long indexLength=trie->indexLength;
- long dataLength=(long)trie->dataLength;
- long totalLength=(long)sizeof(UCPTrieHeader)+indexLength*2+
- dataLength*(trie->valueWidth==UCPTRIE_VALUE_BITS_16 ? 2 :
- trie->valueWidth==UCPTRIE_VALUE_BITS_32 ? 4 : 1);
- printf("**UCPTrieLengths(%s %s)** index:%6ld data:%6ld countNull:%6ld serialized:%6ld\n",
- which, trie->name, indexLength, dataLength, countNull(trie), totalLength);
-}
-#endif
-
-} // namespace
-
-// UCPMap ----
-// Initially, this is the same as UCPTrie. This may well change.
-
-U_CAPI uint32_t U_EXPORT2
-ucpmap_get(const UCPMap *map, UChar32 c) {
- return ucptrie_get(reinterpret_cast<const UCPTrie *>(map), c);
-}
-
-U_CAPI UChar32 U_EXPORT2
-ucpmap_getRange(const UCPMap *map, UChar32 start,
- UCPMapRangeOption option, uint32_t surrogateValue,
- UCPMapValueFilter *filter, const void *context, uint32_t *pValue) {
- return ucptrie_getRange(reinterpret_cast<const UCPTrie *>(map), start,
- option, surrogateValue,
- filter, context, pValue);
-}
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// ucptrie.cpp (modified from utrie2.cpp)
+// created: 2017dec29 Markus W. Scherer
+
+// #define UCPTRIE_DEBUG
+#ifdef UCPTRIE_DEBUG
+# include <stdio.h>
+#endif
+
+#include "unicode/utypes.h"
+#include "unicode/ucptrie.h"
+#include "unicode/utf.h"
+#include "unicode/utf8.h"
+#include "unicode/utf16.h"
+#include "cmemory.h"
+#include "uassert.h"
+#include "ucptrie_impl.h"
+
+U_CAPI UCPTrie * U_EXPORT2
+ucptrie_openFromBinary(UCPTrieType type, UCPTrieValueWidth valueWidth,
+ const void *data, int32_t length, int32_t *pActualLength,
+ UErrorCode *pErrorCode) {
+ if (U_FAILURE(*pErrorCode)) {
+ return nullptr;
+ }
+
+ if (length <= 0 || (U_POINTER_MASK_LSB(data, 3) != 0) ||
+ type < UCPTRIE_TYPE_ANY || UCPTRIE_TYPE_SMALL < type ||
+ valueWidth < UCPTRIE_VALUE_BITS_ANY || UCPTRIE_VALUE_BITS_8 < valueWidth) {
+ *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return nullptr;
+ }
+
+ // Enough data for a trie header?
+ if (length < (int32_t)sizeof(UCPTrieHeader)) {
+ *pErrorCode = U_INVALID_FORMAT_ERROR;
+ return nullptr;
+ }
+
+ // Check the signature.
+ const UCPTrieHeader *header = (const UCPTrieHeader *)data;
+ if (header->signature != UCPTRIE_SIG) {
+ *pErrorCode = U_INVALID_FORMAT_ERROR;
+ return nullptr;
+ }
+
+ int32_t options = header->options;
+ int32_t typeInt = (options >> 6) & 3;
+ int32_t valueWidthInt = options & UCPTRIE_OPTIONS_VALUE_BITS_MASK;
+ if (typeInt > UCPTRIE_TYPE_SMALL || valueWidthInt > UCPTRIE_VALUE_BITS_8 ||
+ (options & UCPTRIE_OPTIONS_RESERVED_MASK) != 0) {
+ *pErrorCode = U_INVALID_FORMAT_ERROR;
+ return nullptr;
+ }
+ UCPTrieType actualType = (UCPTrieType)typeInt;
+ UCPTrieValueWidth actualValueWidth = (UCPTrieValueWidth)valueWidthInt;
+ if (type < 0) {
+ type = actualType;
+ }
+ if (valueWidth < 0) {
+ valueWidth = actualValueWidth;
+ }
+ if (type != actualType || valueWidth != actualValueWidth) {
+ *pErrorCode = U_INVALID_FORMAT_ERROR;
+ return nullptr;
+ }
+
+ // Get the length values and offsets.
+ UCPTrie tempTrie;
+ uprv_memset(&tempTrie, 0, sizeof(tempTrie));
+ tempTrie.indexLength = header->indexLength;
+ tempTrie.dataLength =
+ ((options & UCPTRIE_OPTIONS_DATA_LENGTH_MASK) << 4) | header->dataLength;
+ tempTrie.index3NullOffset = header->index3NullOffset;
+ tempTrie.dataNullOffset =
+ ((options & UCPTRIE_OPTIONS_DATA_NULL_OFFSET_MASK) << 8) | header->dataNullOffset;
+
+ tempTrie.highStart = header->shiftedHighStart << UCPTRIE_SHIFT_2;
+ tempTrie.shifted12HighStart = (tempTrie.highStart + 0xfff) >> 12;
+ tempTrie.type = type;
+ tempTrie.valueWidth = valueWidth;
+
+ // Calculate the actual length.
+ int32_t actualLength = (int32_t)sizeof(UCPTrieHeader) + tempTrie.indexLength * 2;
+ if (valueWidth == UCPTRIE_VALUE_BITS_16) {
+ actualLength += tempTrie.dataLength * 2;
+ } else if (valueWidth == UCPTRIE_VALUE_BITS_32) {
+ actualLength += tempTrie.dataLength * 4;
+ } else {
+ actualLength += tempTrie.dataLength;
+ }
+ if (length < actualLength) {
+ *pErrorCode = U_INVALID_FORMAT_ERROR; // Not enough bytes.
+ return nullptr;
+ }
+
+ // Allocate the trie.
+ UCPTrie *trie = (UCPTrie *)uprv_malloc(sizeof(UCPTrie));
+ if (trie == nullptr) {
+ *pErrorCode = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+ uprv_memcpy(trie, &tempTrie, sizeof(tempTrie));
+#ifdef UCPTRIE_DEBUG
+ trie->name = "fromSerialized";
+#endif
+
+ // Set the pointers to its index and data arrays.
+ const uint16_t *p16 = (const uint16_t *)(header + 1);
+ trie->index = p16;
+ p16 += trie->indexLength;
+
+ // Get the data.
+ int32_t nullValueOffset = trie->dataNullOffset;
+ if (nullValueOffset >= trie->dataLength) {
+ nullValueOffset = trie->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET;
+ }
+ switch (valueWidth) {
+ case UCPTRIE_VALUE_BITS_16:
+ trie->data.ptr16 = p16;
+ trie->nullValue = trie->data.ptr16[nullValueOffset];
+ break;
+ case UCPTRIE_VALUE_BITS_32:
+ trie->data.ptr32 = (const uint32_t *)p16;
+ trie->nullValue = trie->data.ptr32[nullValueOffset];
+ break;
+ case UCPTRIE_VALUE_BITS_8:
+ trie->data.ptr8 = (const uint8_t *)p16;
+ trie->nullValue = trie->data.ptr8[nullValueOffset];
+ break;
+ default:
+ // Unreachable because valueWidth was checked above.
+ *pErrorCode = U_INVALID_FORMAT_ERROR;
+ return nullptr;
+ }
+
+ if (pActualLength != nullptr) {
+ *pActualLength = actualLength;
+ }
+ return trie;
+}
+
+U_CAPI void U_EXPORT2
+ucptrie_close(UCPTrie *trie) {
+ uprv_free(trie);
+}
+
+U_CAPI UCPTrieType U_EXPORT2
+ucptrie_getType(const UCPTrie *trie) {
+ return (UCPTrieType)trie->type;
+}
+
+U_CAPI UCPTrieValueWidth U_EXPORT2
+ucptrie_getValueWidth(const UCPTrie *trie) {
+ return (UCPTrieValueWidth)trie->valueWidth;
+}
+
+U_CAPI int32_t U_EXPORT2
+ucptrie_internalSmallIndex(const UCPTrie *trie, UChar32 c) {
+ int32_t i1 = c >> UCPTRIE_SHIFT_1;
+ if (trie->type == UCPTRIE_TYPE_FAST) {
+ U_ASSERT(0xffff < c && c < trie->highStart);
+ i1 += UCPTRIE_BMP_INDEX_LENGTH - UCPTRIE_OMITTED_BMP_INDEX_1_LENGTH;
+ } else {
+ U_ASSERT((uint32_t)c < (uint32_t)trie->highStart && trie->highStart > UCPTRIE_SMALL_LIMIT);
+ i1 += UCPTRIE_SMALL_INDEX_LENGTH;
+ }
+ int32_t i3Block = trie->index[
+ (int32_t)trie->index[i1] + ((c >> UCPTRIE_SHIFT_2) & UCPTRIE_INDEX_2_MASK)];
+ int32_t i3 = (c >> UCPTRIE_SHIFT_3) & UCPTRIE_INDEX_3_MASK;
+ int32_t dataBlock;
+ if ((i3Block & 0x8000) == 0) {
+ // 16-bit indexes
+ dataBlock = trie->index[i3Block + i3];
+ } else {
+ // 18-bit indexes stored in groups of 9 entries per 8 indexes.
+ i3Block = (i3Block & 0x7fff) + (i3 & ~7) + (i3 >> 3);
+ i3 &= 7;
+ dataBlock = ((int32_t)trie->index[i3Block++] << (2 + (2 * i3))) & 0x30000;
+ dataBlock |= trie->index[i3Block + i3];
+ }
+ return dataBlock + (c & UCPTRIE_SMALL_DATA_MASK);
+}
+
+U_CAPI int32_t U_EXPORT2
+ucptrie_internalSmallU8Index(const UCPTrie *trie, int32_t lt1, uint8_t t2, uint8_t t3) {
+ UChar32 c = (lt1 << 12) | (t2 << 6) | t3;
+ if (c >= trie->highStart) {
+ // Possible because the UTF-8 macro compares with shifted12HighStart which may be higher.
+ return trie->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET;
+ }
+ return ucptrie_internalSmallIndex(trie, c);
+}
+
+U_CAPI int32_t U_EXPORT2
+ucptrie_internalU8PrevIndex(const UCPTrie *trie, UChar32 c,
+ const uint8_t *start, const uint8_t *src) {
+ int32_t i, length;
+ // Support 64-bit pointers by avoiding cast of arbitrary difference.
+ if ((src - start) <= 7) {
+ i = length = (int32_t)(src - start);
+ } else {
+ i = length = 7;
+ start = src - 7;
+ }
+ c = utf8_prevCharSafeBody(start, 0, &i, c, -1);
+ i = length - i; // Number of bytes read backward from src.
+ int32_t idx = _UCPTRIE_CP_INDEX(trie, 0xffff, c);
+ return (idx << 3) | i;
+}
+
+namespace {
+
+inline uint32_t getValue(UCPTrieData data, UCPTrieValueWidth valueWidth, int32_t dataIndex) {
+ switch (valueWidth) {
+ case UCPTRIE_VALUE_BITS_16:
+ return data.ptr16[dataIndex];
+ case UCPTRIE_VALUE_BITS_32:
+ return data.ptr32[dataIndex];
+ case UCPTRIE_VALUE_BITS_8:
+ return data.ptr8[dataIndex];
+ default:
+ // Unreachable if the trie is properly initialized.
+ return 0xffffffff;
+ }
+}
+
+} // namespace
+
+U_CAPI uint32_t U_EXPORT2
+ucptrie_get(const UCPTrie *trie, UChar32 c) {
+ int32_t dataIndex;
+ if ((uint32_t)c <= 0x7f) {
+ // linear ASCII
+ dataIndex = c;
+ } else {
+ UChar32 fastMax = trie->type == UCPTRIE_TYPE_FAST ? 0xffff : UCPTRIE_SMALL_MAX;
+ dataIndex = _UCPTRIE_CP_INDEX(trie, fastMax, c);
+ }
+ return getValue(trie->data, (UCPTrieValueWidth)trie->valueWidth, dataIndex);
+}
+
+namespace {
+
+constexpr int32_t MAX_UNICODE = 0x10ffff;
+
+inline uint32_t maybeFilterValue(uint32_t value, uint32_t trieNullValue, uint32_t nullValue,
+ UCPMapValueFilter *filter, const void *context) {
+ if (value == trieNullValue) {
+ value = nullValue;
+ } else if (filter != nullptr) {
+ value = filter(context, value);
+ }
+ return value;
+}
+
+UChar32 getRange(const void *t, UChar32 start,
+ UCPMapValueFilter *filter, const void *context, uint32_t *pValue) {
+ if ((uint32_t)start > MAX_UNICODE) {
+ return U_SENTINEL;
+ }
+ const UCPTrie *trie = reinterpret_cast<const UCPTrie *>(t);
+ UCPTrieValueWidth valueWidth = (UCPTrieValueWidth)trie->valueWidth;
+ if (start >= trie->highStart) {
+ if (pValue != nullptr) {
+ int32_t di = trie->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET;
+ uint32_t value = getValue(trie->data, valueWidth, di);
+ if (filter != nullptr) { value = filter(context, value); }
+ *pValue = value;
+ }
+ return MAX_UNICODE;
+ }
+
+ uint32_t nullValue = trie->nullValue;
+ if (filter != nullptr) { nullValue = filter(context, nullValue); }
+ const uint16_t *index = trie->index;
+
+ int32_t prevI3Block = -1;
+ int32_t prevBlock = -1;
+ UChar32 c = start;
+ uint32_t trieValue, value = nullValue;
+ bool haveValue = false;
+ do {
+ int32_t i3Block;
+ int32_t i3;
+ int32_t i3BlockLength;
+ int32_t dataBlockLength;
+ if (c <= 0xffff && (trie->type == UCPTRIE_TYPE_FAST || c <= UCPTRIE_SMALL_MAX)) {
+ i3Block = 0;
+ i3 = c >> UCPTRIE_FAST_SHIFT;
+ i3BlockLength = trie->type == UCPTRIE_TYPE_FAST ?
+ UCPTRIE_BMP_INDEX_LENGTH : UCPTRIE_SMALL_INDEX_LENGTH;
+ dataBlockLength = UCPTRIE_FAST_DATA_BLOCK_LENGTH;
+ } else {
+ // Use the multi-stage index.
+ int32_t i1 = c >> UCPTRIE_SHIFT_1;
+ if (trie->type == UCPTRIE_TYPE_FAST) {
+ U_ASSERT(0xffff < c && c < trie->highStart);
+ i1 += UCPTRIE_BMP_INDEX_LENGTH - UCPTRIE_OMITTED_BMP_INDEX_1_LENGTH;
+ } else {
+ U_ASSERT(c < trie->highStart && trie->highStart > UCPTRIE_SMALL_LIMIT);
+ i1 += UCPTRIE_SMALL_INDEX_LENGTH;
+ }
+ i3Block = trie->index[
+ (int32_t)trie->index[i1] + ((c >> UCPTRIE_SHIFT_2) & UCPTRIE_INDEX_2_MASK)];
+ if (i3Block == prevI3Block && (c - start) >= UCPTRIE_CP_PER_INDEX_2_ENTRY) {
+ // The index-3 block is the same as the previous one, and filled with value.
+ U_ASSERT((c & (UCPTRIE_CP_PER_INDEX_2_ENTRY - 1)) == 0);
+ c += UCPTRIE_CP_PER_INDEX_2_ENTRY;
+ continue;
+ }
+ prevI3Block = i3Block;
+ if (i3Block == trie->index3NullOffset) {
+ // This is the index-3 null block.
+ if (haveValue) {
+ if (nullValue != value) {
+ return c - 1;
+ }
+ } else {
+ trieValue = trie->nullValue;
+ value = nullValue;
+ if (pValue != nullptr) { *pValue = nullValue; }
+ haveValue = true;
+ }
+ prevBlock = trie->dataNullOffset;
+ c = (c + UCPTRIE_CP_PER_INDEX_2_ENTRY) & ~(UCPTRIE_CP_PER_INDEX_2_ENTRY - 1);
+ continue;
+ }
+ i3 = (c >> UCPTRIE_SHIFT_3) & UCPTRIE_INDEX_3_MASK;
+ i3BlockLength = UCPTRIE_INDEX_3_BLOCK_LENGTH;
+ dataBlockLength = UCPTRIE_SMALL_DATA_BLOCK_LENGTH;
+ }
+ // Enumerate data blocks for one index-3 block.
+ do {
+ int32_t block;
+ if ((i3Block & 0x8000) == 0) {
+ block = index[i3Block + i3];
+ } else {
+ // 18-bit indexes stored in groups of 9 entries per 8 indexes.
+ int32_t group = (i3Block & 0x7fff) + (i3 & ~7) + (i3 >> 3);
+ int32_t gi = i3 & 7;
+ block = ((int32_t)index[group++] << (2 + (2 * gi))) & 0x30000;
+ block |= index[group + gi];
+ }
+ if (block == prevBlock && (c - start) >= dataBlockLength) {
+ // The block is the same as the previous one, and filled with value.
+ U_ASSERT((c & (dataBlockLength - 1)) == 0);
+ c += dataBlockLength;
+ } else {
+ int32_t dataMask = dataBlockLength - 1;
+ prevBlock = block;
+ if (block == trie->dataNullOffset) {
+ // This is the data null block.
+ if (haveValue) {
+ if (nullValue != value) {
+ return c - 1;
+ }
+ } else {
+ trieValue = trie->nullValue;
+ value = nullValue;
+ if (pValue != nullptr) { *pValue = nullValue; }
+ haveValue = true;
+ }
+ c = (c + dataBlockLength) & ~dataMask;
+ } else {
+ int32_t di = block + (c & dataMask);
+ uint32_t trieValue2 = getValue(trie->data, valueWidth, di);
+ if (haveValue) {
+ if (trieValue2 != trieValue) {
+ if (filter == nullptr ||
+ maybeFilterValue(trieValue2, trie->nullValue, nullValue,
+ filter, context) != value) {
+ return c - 1;
+ }
+ trieValue = trieValue2; // may or may not help
+ }
+ } else {
+ trieValue = trieValue2;
+ value = maybeFilterValue(trieValue2, trie->nullValue, nullValue,
+ filter, context);
+ if (pValue != nullptr) { *pValue = value; }
+ haveValue = true;
+ }
+ while ((++c & dataMask) != 0) {
+ trieValue2 = getValue(trie->data, valueWidth, ++di);
+ if (trieValue2 != trieValue) {
+ if (filter == nullptr ||
+ maybeFilterValue(trieValue2, trie->nullValue, nullValue,
+ filter, context) != value) {
+ return c - 1;
+ }
+ trieValue = trieValue2; // may or may not help
+ }
+ }
+ }
+ }
+ } while (++i3 < i3BlockLength);
+ } while (c < trie->highStart);
+ U_ASSERT(haveValue);
+ int32_t di = trie->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET;
+ uint32_t highValue = getValue(trie->data, valueWidth, di);
+ if (maybeFilterValue(highValue, trie->nullValue, nullValue,
+ filter, context) != value) {
+ return c - 1;
+ } else {
+ return MAX_UNICODE;
+ }
+}
+
+} // namespace
+
+U_CFUNC UChar32
+ucptrie_internalGetRange(UCPTrieGetRange *getRange,
+ const void *trie, UChar32 start,
+ UCPMapRangeOption option, uint32_t surrogateValue,
+ UCPMapValueFilter *filter, const void *context, uint32_t *pValue) {
+ if (option == UCPMAP_RANGE_NORMAL) {
+ return getRange(trie, start, filter, context, pValue);
+ }
+ uint32_t value;
+ if (pValue == nullptr) {
+ // We need to examine the range value even if the caller does not want it.
+ pValue = &value;
+ }
+ UChar32 surrEnd = option == UCPMAP_RANGE_FIXED_ALL_SURROGATES ? 0xdfff : 0xdbff;
+ UChar32 end = getRange(trie, start, filter, context, pValue);
+ if (end < 0xd7ff || start > surrEnd) {
+ return end;
+ }
+ // The range overlaps with surrogates, or ends just before the first one.
+ if (*pValue == surrogateValue) {
+ if (end >= surrEnd) {
+ // Surrogates followed by a non-surrogateValue range,
+ // or surrogates are part of a larger surrogateValue range.
+ return end;
+ }
+ } else {
+ if (start <= 0xd7ff) {
+ return 0xd7ff; // Non-surrogateValue range ends before surrogateValue surrogates.
+ }
+ // Start is a surrogate with a non-surrogateValue code *unit* value.
+ // Return a surrogateValue code *point* range.
+ *pValue = surrogateValue;
+ if (end > surrEnd) {
+ return surrEnd; // Surrogate range ends before non-surrogateValue rest of range.
+ }
+ }
+ // See if the surrogateValue surrogate range can be merged with
+ // an immediately following range.
+ uint32_t value2;
+ UChar32 end2 = getRange(trie, surrEnd + 1, filter, context, &value2);
+ if (value2 == surrogateValue) {
+ return end2;
+ }
+ return surrEnd;
+}
+
+U_CAPI UChar32 U_EXPORT2
+ucptrie_getRange(const UCPTrie *trie, UChar32 start,
+ UCPMapRangeOption option, uint32_t surrogateValue,
+ UCPMapValueFilter *filter, const void *context, uint32_t *pValue) {
+ return ucptrie_internalGetRange(getRange, trie, start,
+ option, surrogateValue,
+ filter, context, pValue);
+}
+
+U_CAPI int32_t U_EXPORT2
+ucptrie_toBinary(const UCPTrie *trie,
+ void *data, int32_t capacity,
+ UErrorCode *pErrorCode) {
+ if (U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+
+ UCPTrieType type = (UCPTrieType)trie->type;
+ UCPTrieValueWidth valueWidth = (UCPTrieValueWidth)trie->valueWidth;
+ if (type < UCPTRIE_TYPE_FAST || UCPTRIE_TYPE_SMALL < type ||
+ valueWidth < UCPTRIE_VALUE_BITS_16 || UCPTRIE_VALUE_BITS_8 < valueWidth ||
+ capacity < 0 ||
+ (capacity > 0 && (data == nullptr || (U_POINTER_MASK_LSB(data, 3) != 0)))) {
+ *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ int32_t length = (int32_t)sizeof(UCPTrieHeader) + trie->indexLength * 2;
+ switch (valueWidth) {
+ case UCPTRIE_VALUE_BITS_16:
+ length += trie->dataLength * 2;
+ break;
+ case UCPTRIE_VALUE_BITS_32:
+ length += trie->dataLength * 4;
+ break;
+ case UCPTRIE_VALUE_BITS_8:
+ length += trie->dataLength;
+ break;
+ default:
+ // unreachable
+ break;
+ }
+ if (capacity < length) {
+ *pErrorCode = U_BUFFER_OVERFLOW_ERROR;
+ return length;
+ }
+
+ char *bytes = (char *)data;
+ UCPTrieHeader *header = (UCPTrieHeader *)bytes;
+ header->signature = UCPTRIE_SIG; // "Tri3"
+ header->options = (uint16_t)(
+ ((trie->dataLength & 0xf0000) >> 4) |
+ ((trie->dataNullOffset & 0xf0000) >> 8) |
+ (trie->type << 6) |
+ valueWidth);
+ header->indexLength = (uint16_t)trie->indexLength;
+ header->dataLength = (uint16_t)trie->dataLength;
+ header->index3NullOffset = trie->index3NullOffset;
+ header->dataNullOffset = (uint16_t)trie->dataNullOffset;
+ header->shiftedHighStart = trie->highStart >> UCPTRIE_SHIFT_2;
+ bytes += sizeof(UCPTrieHeader);
+
+ uprv_memcpy(bytes, trie->index, trie->indexLength * 2);
+ bytes += trie->indexLength * 2;
+
+ switch (valueWidth) {
+ case UCPTRIE_VALUE_BITS_16:
+ uprv_memcpy(bytes, trie->data.ptr16, trie->dataLength * 2);
+ break;
+ case UCPTRIE_VALUE_BITS_32:
+ uprv_memcpy(bytes, trie->data.ptr32, trie->dataLength * 4);
+ break;
+ case UCPTRIE_VALUE_BITS_8:
+ uprv_memcpy(bytes, trie->data.ptr8, trie->dataLength);
+ break;
+ default:
+ // unreachable
+ break;
+ }
+ return length;
+}
+
+namespace {
+
+#ifdef UCPTRIE_DEBUG
+long countNull(const UCPTrie *trie) {
+ uint32_t nullValue=trie->nullValue;
+ int32_t length=trie->dataLength;
+ long count=0;
+ switch (trie->valueWidth) {
+ case UCPTRIE_VALUE_BITS_16:
+ for(int32_t i=0; i<length; ++i) {
+ if(trie->data.ptr16[i]==nullValue) { ++count; }
+ }
+ break;
+ case UCPTRIE_VALUE_BITS_32:
+ for(int32_t i=0; i<length; ++i) {
+ if(trie->data.ptr32[i]==nullValue) { ++count; }
+ }
+ break;
+ case UCPTRIE_VALUE_BITS_8:
+ for(int32_t i=0; i<length; ++i) {
+ if(trie->data.ptr8[i]==nullValue) { ++count; }
+ }
+ break;
+ default:
+ // unreachable
+ break;
+ }
+ return count;
+}
+
+U_CFUNC void
+ucptrie_printLengths(const UCPTrie *trie, const char *which) {
+ long indexLength=trie->indexLength;
+ long dataLength=(long)trie->dataLength;
+ long totalLength=(long)sizeof(UCPTrieHeader)+indexLength*2+
+ dataLength*(trie->valueWidth==UCPTRIE_VALUE_BITS_16 ? 2 :
+ trie->valueWidth==UCPTRIE_VALUE_BITS_32 ? 4 : 1);
+ printf("**UCPTrieLengths(%s %s)** index:%6ld data:%6ld countNull:%6ld serialized:%6ld\n",
+ which, trie->name, indexLength, dataLength, countNull(trie), totalLength);
+}
+#endif
+
+} // namespace
+
+// UCPMap ----
+// Initially, this is the same as UCPTrie. This may well change.
+
+U_CAPI uint32_t U_EXPORT2
+ucpmap_get(const UCPMap *map, UChar32 c) {
+ return ucptrie_get(reinterpret_cast<const UCPTrie *>(map), c);
+}
+
+U_CAPI UChar32 U_EXPORT2
+ucpmap_getRange(const UCPMap *map, UChar32 start,
+ UCPMapRangeOption option, uint32_t surrogateValue,
+ UCPMapValueFilter *filter, const void *context, uint32_t *pValue) {
+ return ucptrie_getRange(reinterpret_cast<const UCPTrie *>(map), start,
+ option, surrogateValue,
+ filter, context, pValue);
+}
diff --git a/contrib/libs/icu/common/ucptrie_impl.h b/contrib/libs/icu/common/ucptrie_impl.h
index c35f98e766..1fe6a18ac5 100644
--- a/contrib/libs/icu/common/ucptrie_impl.h
+++ b/contrib/libs/icu/common/ucptrie_impl.h
@@ -1,289 +1,289 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// ucptrie_impl.h (modified from utrie2_impl.h)
-// created: 2017dec29 Markus W. Scherer
-
-#ifndef __UCPTRIE_IMPL_H__
-#define __UCPTRIE_IMPL_H__
-
-#include "unicode/ucptrie.h"
-#ifdef UCPTRIE_DEBUG
-#include "unicode/umutablecptrie.h"
-#endif
-
-// UCPTrie signature values, in platform endianness and opposite endianness.
-// The UCPTrie signature ASCII byte values spell "Tri3".
-#define UCPTRIE_SIG 0x54726933
-#define UCPTRIE_OE_SIG 0x33697254
-
-/**
- * Header data for the binary, memory-mappable representation of a UCPTrie/CodePointTrie.
- * @internal
- */
-struct UCPTrieHeader {
- /** "Tri3" in big-endian US-ASCII (0x54726933) */
- uint32_t signature;
-
- /**
- * Options bit field:
- * Bits 15..12: Data length bits 19..16.
- * Bits 11..8: Data null block offset bits 19..16.
- * Bits 7..6: UCPTrieType
- * Bits 5..3: Reserved (0).
- * Bits 2..0: UCPTrieValueWidth
- */
- uint16_t options;
-
- /** Total length of the index tables. */
- uint16_t indexLength;
-
- /** Data length bits 15..0. */
- uint16_t dataLength;
-
- /** Index-3 null block offset, 0x7fff or 0xffff if none. */
- uint16_t index3NullOffset;
-
- /** Data null block offset bits 15..0, 0xfffff if none. */
- uint16_t dataNullOffset;
-
- /**
- * First code point of the single-value range ending with U+10ffff,
- * rounded up and then shifted right by UCPTRIE_SHIFT_2.
- */
- uint16_t shiftedHighStart;
-};
-
-/**
- * Constants for use with UCPTrieHeader.options.
- * @internal
- */
-enum {
- UCPTRIE_OPTIONS_DATA_LENGTH_MASK = 0xf000,
- UCPTRIE_OPTIONS_DATA_NULL_OFFSET_MASK = 0xf00,
- UCPTRIE_OPTIONS_RESERVED_MASK = 0x38,
- UCPTRIE_OPTIONS_VALUE_BITS_MASK = 7,
- /**
- * Value for index3NullOffset which indicates that there is no index-3 null block.
- * Bit 15 is unused for this value because this bit is used if the index-3 contains
- * 18-bit indexes.
- */
- UCPTRIE_NO_INDEX3_NULL_OFFSET = 0x7fff,
- UCPTRIE_NO_DATA_NULL_OFFSET = 0xfffff
-};
-
-// Internal constants.
-enum {
- /** The length of the BMP index table. 1024=0x400 */
- UCPTRIE_BMP_INDEX_LENGTH = 0x10000 >> UCPTRIE_FAST_SHIFT,
-
- UCPTRIE_SMALL_LIMIT = 0x1000,
- UCPTRIE_SMALL_INDEX_LENGTH = UCPTRIE_SMALL_LIMIT >> UCPTRIE_FAST_SHIFT,
-
- /** Shift size for getting the index-3 table offset. */
- UCPTRIE_SHIFT_3 = 4,
-
- /** Shift size for getting the index-2 table offset. */
- UCPTRIE_SHIFT_2 = 5 + UCPTRIE_SHIFT_3,
-
- /** Shift size for getting the index-1 table offset. */
- UCPTRIE_SHIFT_1 = 5 + UCPTRIE_SHIFT_2,
-
- /**
- * Difference between two shift sizes,
- * for getting an index-2 offset from an index-3 offset. 5=9-4
- */
- UCPTRIE_SHIFT_2_3 = UCPTRIE_SHIFT_2 - UCPTRIE_SHIFT_3,
-
- /**
- * Difference between two shift sizes,
- * for getting an index-1 offset from an index-2 offset. 5=14-9
- */
- UCPTRIE_SHIFT_1_2 = UCPTRIE_SHIFT_1 - UCPTRIE_SHIFT_2,
-
- /**
- * Number of index-1 entries for the BMP. (4)
- * This part of the index-1 table is omitted from the serialized form.
- */
- UCPTRIE_OMITTED_BMP_INDEX_1_LENGTH = 0x10000 >> UCPTRIE_SHIFT_1,
-
- /** Number of entries in an index-2 block. 32=0x20 */
- UCPTRIE_INDEX_2_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_1_2,
-
- /** Mask for getting the lower bits for the in-index-2-block offset. */
- UCPTRIE_INDEX_2_MASK = UCPTRIE_INDEX_2_BLOCK_LENGTH - 1,
-
- /** Number of code points per index-2 table entry. 512=0x200 */
- UCPTRIE_CP_PER_INDEX_2_ENTRY = 1 << UCPTRIE_SHIFT_2,
-
- /** Number of entries in an index-3 block. 32=0x20 */
- UCPTRIE_INDEX_3_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_2_3,
-
- /** Mask for getting the lower bits for the in-index-3-block offset. */
- UCPTRIE_INDEX_3_MASK = UCPTRIE_INDEX_3_BLOCK_LENGTH - 1,
-
- /** Number of entries in a small data block. 16=0x10 */
- UCPTRIE_SMALL_DATA_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_3,
-
- /** Mask for getting the lower bits for the in-small-data-block offset. */
- UCPTRIE_SMALL_DATA_MASK = UCPTRIE_SMALL_DATA_BLOCK_LENGTH - 1
-};
-
-typedef UChar32
-UCPTrieGetRange(const void *trie, UChar32 start,
- UCPMapValueFilter *filter, const void *context, uint32_t *pValue);
-
-U_CFUNC UChar32
-ucptrie_internalGetRange(UCPTrieGetRange *getRange,
- const void *trie, UChar32 start,
- UCPMapRangeOption option, uint32_t surrogateValue,
- UCPMapValueFilter *filter, const void *context, uint32_t *pValue);
-
-#ifdef UCPTRIE_DEBUG
-U_CFUNC void
-ucptrie_printLengths(const UCPTrie *trie, const char *which);
-
-U_CFUNC void umutablecptrie_setName(UMutableCPTrie *builder, const char *name);
-#endif
-
-/*
- * Format of the binary, memory-mappable representation of a UCPTrie/CodePointTrie.
- * For overview information see http://site.icu-project.org/design/struct/utrie
- *
- * The binary trie data should be 32-bit-aligned.
- * The overall layout is:
- *
- * UCPTrieHeader header; -- 16 bytes, see struct definition above
- * uint16_t index[header.indexLength];
- * uintXY_t data[header.dataLength];
- *
- * The trie data array is an array of uint16_t, uint32_t, or uint8_t,
- * specified via the UCPTrieValueWidth when building the trie.
- * The data array is 32-bit-aligned for uint32_t, otherwise 16-bit-aligned.
- * The overall length of the trie data is a multiple of 4 bytes.
- * (Padding is added at the end of the index array and/or near the end of the data array as needed.)
- *
- * The length of the data array (dataLength) is stored as an integer split across two fields
- * of the header struct (high bits in header.options).
- *
- * The trie type can be "fast" or "small" which determines the index structure,
- * specified via the UCPTrieType when building the trie.
- *
- * The type and valueWidth are stored in the header.options.
- * There are reserved type and valueWidth values, and reserved header.options bits.
- * They could be used in future format extensions.
- * Code reading the trie structure must fail with an error when unknown values or options are set.
- *
- * Values for ASCII character (U+0000..U+007F) can always be found at the start of the data array.
- *
- * Values for code points below a type-specific fast-indexing limit are found via two-stage lookup.
- * For a "fast" trie, the limit is the BMP/supplementary boundary at U+10000.
- * For a "small" trie, the limit is UCPTRIE_SMALL_MAX+1=U+1000.
- *
- * All code points in the range highStart..U+10FFFF map to a single highValue
- * which is stored at the second-to-last position of the data array.
- * (See UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET.)
- * The highStart value is header.shiftedHighStart<<UCPTRIE_SHIFT_2.
- * (UCPTRIE_SHIFT_2=9)
- *
- * Values for code points fast_limit..highStart-1 are found via four-stage lookup.
- * The data block size is smaller for this range than for the fast range.
- * This together with more index stages with small blocks makes this range
- * more easily compactable.
- *
- * There is also a trie error value stored at the last position of the data array.
- * (See UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET.)
- * It is intended to be returned for inputs that are not Unicode code points
- * (outside U+0000..U+10FFFF), or in string processing for ill-formed input
- * (unpaired surrogate in UTF-16, ill-formed UTF-8 subsequence).
- *
- * For a "fast" trie:
- *
- * The index array starts with the BMP index table for BMP code point lookup.
- * Its length is 1024=0x400.
- *
- * The supplementary index-1 table follows the BMP index table.
- * Variable length, for code points up to highStart-1.
- * Maximum length 64=0x40=0x100000>>UCPTRIE_SHIFT_1.
- * (For 0x100000 supplementary code points U+10000..U+10ffff.)
- *
- * After this index-1 table follow the variable-length index-3 and index-2 tables.
- *
- * The supplementary index tables are omitted completely
- * if there is only BMP data (highStart<=U+10000).
- *
- * For a "small" trie:
- *
- * The index array starts with a fast-index table for lookup of code points U+0000..U+0FFF.
- *
- * The "supplementary" index tables are always stored.
- * The index-1 table starts from U+0000, its maximum length is 68=0x44=0x110000>>UCPTRIE_SHIFT_1.
- *
- * For both trie types:
- *
- * The last index-2 block may be a partial block, storing indexes only for code points
- * below highStart.
- *
- * Lookup for ASCII code point c:
- *
- * Linear access from the start of the data array.
- *
- * value = data[c];
- *
- * Lookup for fast-range code point c:
- *
- * Shift the code point right by UCPTRIE_FAST_SHIFT=6 bits,
- * fetch the index array value at that offset,
- * add the lower code point bits, index into the data array.
- *
- * value = data[index[c>>6] + (c&0x3f)];
- *
- * (This works for ASCII as well.)
- *
- * Lookup for small-range code point c below highStart:
- *
- * Split the code point into four bit fields using several sets of shifts & masks
- * to read consecutive values from the index-1, index-2, index-3 and data tables.
- *
- * If all of the data block offsets in an index-3 block fit within 16 bits (up to 0xffff),
- * then the data block offsets are stored directly as uint16_t.
- *
- * Otherwise (this is very unusual but possible), the index-2 entry for the index-3 block
- * has bit 15 (0x8000) set, and each set of 8 index-3 entries is preceded by
- * an additional uint16_t word. Data block offsets are 18 bits wide, with the top 2 bits stored
- * in the additional word.
- *
- * See ucptrie_internalSmallIndex() for details.
- *
- * (In a "small" trie, this works for ASCII and below-fast_limit code points as well.)
- *
- * Compaction:
- *
- * Multiple code point ranges ("blocks") that are aligned on certain boundaries
- * (determined by the shifting/bit fields of code points) and
- * map to the same data values normally share a single subsequence of the data array.
- * Data blocks can also overlap partially.
- * (Depending on the builder code finding duplicate and overlapping blocks.)
- *
- * Iteration over same-value ranges:
- *
- * Range iteration (ucptrie_getRange()) walks the structure from a start code point
- * until some code point is found that maps to a different value;
- * the end of the returned range is just before that.
- *
- * The header.dataNullOffset (split across two header fields, high bits in header.options)
- * is the offset of a widely shared data block filled with one single value.
- * It helps quickly skip over large ranges of data with that value.
- * The builder must ensure that if the start of any data block (fast or small)
- * matches the dataNullOffset, then the whole block must be filled with the null value.
- * Special care must be taken if there is no fast null data block
- * but a small one, which is shorter, and it matches the *start* of some fast data block.
- *
- * Similarly, the header.index3NullOffset is the index-array offset of an index-3 block
- * where all index entries point to the dataNullOffset.
- * If there is no such data or index-3 block, then these offsets are set to
- * values that cannot be reached (data offset out of range/reserved index offset),
- * normally UCPTRIE_NO_DATA_NULL_OFFSET or UCPTRIE_NO_INDEX3_NULL_OFFSET respectively.
- */
-
-#endif
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// ucptrie_impl.h (modified from utrie2_impl.h)
+// created: 2017dec29 Markus W. Scherer
+
+#ifndef __UCPTRIE_IMPL_H__
+#define __UCPTRIE_IMPL_H__
+
+#include "unicode/ucptrie.h"
+#ifdef UCPTRIE_DEBUG
+#include "unicode/umutablecptrie.h"
+#endif
+
+// UCPTrie signature values, in platform endianness and opposite endianness.
+// The UCPTrie signature ASCII byte values spell "Tri3".
+#define UCPTRIE_SIG 0x54726933
+#define UCPTRIE_OE_SIG 0x33697254
+
+/**
+ * Header data for the binary, memory-mappable representation of a UCPTrie/CodePointTrie.
+ * @internal
+ */
+struct UCPTrieHeader {
+ /** "Tri3" in big-endian US-ASCII (0x54726933) */
+ uint32_t signature;
+
+ /**
+ * Options bit field:
+ * Bits 15..12: Data length bits 19..16.
+ * Bits 11..8: Data null block offset bits 19..16.
+ * Bits 7..6: UCPTrieType
+ * Bits 5..3: Reserved (0).
+ * Bits 2..0: UCPTrieValueWidth
+ */
+ uint16_t options;
+
+ /** Total length of the index tables. */
+ uint16_t indexLength;
+
+ /** Data length bits 15..0. */
+ uint16_t dataLength;
+
+ /** Index-3 null block offset, 0x7fff or 0xffff if none. */
+ uint16_t index3NullOffset;
+
+ /** Data null block offset bits 15..0, 0xfffff if none. */
+ uint16_t dataNullOffset;
+
+ /**
+ * First code point of the single-value range ending with U+10ffff,
+ * rounded up and then shifted right by UCPTRIE_SHIFT_2.
+ */
+ uint16_t shiftedHighStart;
+};
+
+/**
+ * Constants for use with UCPTrieHeader.options.
+ * @internal
+ */
+enum {
+ UCPTRIE_OPTIONS_DATA_LENGTH_MASK = 0xf000,
+ UCPTRIE_OPTIONS_DATA_NULL_OFFSET_MASK = 0xf00,
+ UCPTRIE_OPTIONS_RESERVED_MASK = 0x38,
+ UCPTRIE_OPTIONS_VALUE_BITS_MASK = 7,
+ /**
+ * Value for index3NullOffset which indicates that there is no index-3 null block.
+ * Bit 15 is unused for this value because this bit is used if the index-3 contains
+ * 18-bit indexes.
+ */
+ UCPTRIE_NO_INDEX3_NULL_OFFSET = 0x7fff,
+ UCPTRIE_NO_DATA_NULL_OFFSET = 0xfffff
+};
+
+// Internal constants.
+enum {
+ /** The length of the BMP index table. 1024=0x400 */
+ UCPTRIE_BMP_INDEX_LENGTH = 0x10000 >> UCPTRIE_FAST_SHIFT,
+
+ UCPTRIE_SMALL_LIMIT = 0x1000,
+ UCPTRIE_SMALL_INDEX_LENGTH = UCPTRIE_SMALL_LIMIT >> UCPTRIE_FAST_SHIFT,
+
+ /** Shift size for getting the index-3 table offset. */
+ UCPTRIE_SHIFT_3 = 4,
+
+ /** Shift size for getting the index-2 table offset. */
+ UCPTRIE_SHIFT_2 = 5 + UCPTRIE_SHIFT_3,
+
+ /** Shift size for getting the index-1 table offset. */
+ UCPTRIE_SHIFT_1 = 5 + UCPTRIE_SHIFT_2,
+
+ /**
+ * Difference between two shift sizes,
+ * for getting an index-2 offset from an index-3 offset. 5=9-4
+ */
+ UCPTRIE_SHIFT_2_3 = UCPTRIE_SHIFT_2 - UCPTRIE_SHIFT_3,
+
+ /**
+ * Difference between two shift sizes,
+ * for getting an index-1 offset from an index-2 offset. 5=14-9
+ */
+ UCPTRIE_SHIFT_1_2 = UCPTRIE_SHIFT_1 - UCPTRIE_SHIFT_2,
+
+ /**
+ * Number of index-1 entries for the BMP. (4)
+ * This part of the index-1 table is omitted from the serialized form.
+ */
+ UCPTRIE_OMITTED_BMP_INDEX_1_LENGTH = 0x10000 >> UCPTRIE_SHIFT_1,
+
+ /** Number of entries in an index-2 block. 32=0x20 */
+ UCPTRIE_INDEX_2_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_1_2,
+
+ /** Mask for getting the lower bits for the in-index-2-block offset. */
+ UCPTRIE_INDEX_2_MASK = UCPTRIE_INDEX_2_BLOCK_LENGTH - 1,
+
+ /** Number of code points per index-2 table entry. 512=0x200 */
+ UCPTRIE_CP_PER_INDEX_2_ENTRY = 1 << UCPTRIE_SHIFT_2,
+
+ /** Number of entries in an index-3 block. 32=0x20 */
+ UCPTRIE_INDEX_3_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_2_3,
+
+ /** Mask for getting the lower bits for the in-index-3-block offset. */
+ UCPTRIE_INDEX_3_MASK = UCPTRIE_INDEX_3_BLOCK_LENGTH - 1,
+
+ /** Number of entries in a small data block. 16=0x10 */
+ UCPTRIE_SMALL_DATA_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_3,
+
+ /** Mask for getting the lower bits for the in-small-data-block offset. */
+ UCPTRIE_SMALL_DATA_MASK = UCPTRIE_SMALL_DATA_BLOCK_LENGTH - 1
+};
+
+typedef UChar32
+UCPTrieGetRange(const void *trie, UChar32 start,
+ UCPMapValueFilter *filter, const void *context, uint32_t *pValue);
+
+U_CFUNC UChar32
+ucptrie_internalGetRange(UCPTrieGetRange *getRange,
+ const void *trie, UChar32 start,
+ UCPMapRangeOption option, uint32_t surrogateValue,
+ UCPMapValueFilter *filter, const void *context, uint32_t *pValue);
+
+#ifdef UCPTRIE_DEBUG
+U_CFUNC void
+ucptrie_printLengths(const UCPTrie *trie, const char *which);
+
+U_CFUNC void umutablecptrie_setName(UMutableCPTrie *builder, const char *name);
+#endif
+
+/*
+ * Format of the binary, memory-mappable representation of a UCPTrie/CodePointTrie.
+ * For overview information see http://site.icu-project.org/design/struct/utrie
+ *
+ * The binary trie data should be 32-bit-aligned.
+ * The overall layout is:
+ *
+ * UCPTrieHeader header; -- 16 bytes, see struct definition above
+ * uint16_t index[header.indexLength];
+ * uintXY_t data[header.dataLength];
+ *
+ * The trie data array is an array of uint16_t, uint32_t, or uint8_t,
+ * specified via the UCPTrieValueWidth when building the trie.
+ * The data array is 32-bit-aligned for uint32_t, otherwise 16-bit-aligned.
+ * The overall length of the trie data is a multiple of 4 bytes.
+ * (Padding is added at the end of the index array and/or near the end of the data array as needed.)
+ *
+ * The length of the data array (dataLength) is stored as an integer split across two fields
+ * of the header struct (high bits in header.options).
+ *
+ * The trie type can be "fast" or "small" which determines the index structure,
+ * specified via the UCPTrieType when building the trie.
+ *
+ * The type and valueWidth are stored in the header.options.
+ * There are reserved type and valueWidth values, and reserved header.options bits.
+ * They could be used in future format extensions.
+ * Code reading the trie structure must fail with an error when unknown values or options are set.
+ *
+ * Values for ASCII character (U+0000..U+007F) can always be found at the start of the data array.
+ *
+ * Values for code points below a type-specific fast-indexing limit are found via two-stage lookup.
+ * For a "fast" trie, the limit is the BMP/supplementary boundary at U+10000.
+ * For a "small" trie, the limit is UCPTRIE_SMALL_MAX+1=U+1000.
+ *
+ * All code points in the range highStart..U+10FFFF map to a single highValue
+ * which is stored at the second-to-last position of the data array.
+ * (See UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET.)
+ * The highStart value is header.shiftedHighStart<<UCPTRIE_SHIFT_2.
+ * (UCPTRIE_SHIFT_2=9)
+ *
+ * Values for code points fast_limit..highStart-1 are found via four-stage lookup.
+ * The data block size is smaller for this range than for the fast range.
+ * This together with more index stages with small blocks makes this range
+ * more easily compactable.
+ *
+ * There is also a trie error value stored at the last position of the data array.
+ * (See UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET.)
+ * It is intended to be returned for inputs that are not Unicode code points
+ * (outside U+0000..U+10FFFF), or in string processing for ill-formed input
+ * (unpaired surrogate in UTF-16, ill-formed UTF-8 subsequence).
+ *
+ * For a "fast" trie:
+ *
+ * The index array starts with the BMP index table for BMP code point lookup.
+ * Its length is 1024=0x400.
+ *
+ * The supplementary index-1 table follows the BMP index table.
+ * Variable length, for code points up to highStart-1.
+ * Maximum length 64=0x40=0x100000>>UCPTRIE_SHIFT_1.
+ * (For 0x100000 supplementary code points U+10000..U+10ffff.)
+ *
+ * After this index-1 table follow the variable-length index-3 and index-2 tables.
+ *
+ * The supplementary index tables are omitted completely
+ * if there is only BMP data (highStart<=U+10000).
+ *
+ * For a "small" trie:
+ *
+ * The index array starts with a fast-index table for lookup of code points U+0000..U+0FFF.
+ *
+ * The "supplementary" index tables are always stored.
+ * The index-1 table starts from U+0000, its maximum length is 68=0x44=0x110000>>UCPTRIE_SHIFT_1.
+ *
+ * For both trie types:
+ *
+ * The last index-2 block may be a partial block, storing indexes only for code points
+ * below highStart.
+ *
+ * Lookup for ASCII code point c:
+ *
+ * Linear access from the start of the data array.
+ *
+ * value = data[c];
+ *
+ * Lookup for fast-range code point c:
+ *
+ * Shift the code point right by UCPTRIE_FAST_SHIFT=6 bits,
+ * fetch the index array value at that offset,
+ * add the lower code point bits, index into the data array.
+ *
+ * value = data[index[c>>6] + (c&0x3f)];
+ *
+ * (This works for ASCII as well.)
+ *
+ * Lookup for small-range code point c below highStart:
+ *
+ * Split the code point into four bit fields using several sets of shifts & masks
+ * to read consecutive values from the index-1, index-2, index-3 and data tables.
+ *
+ * If all of the data block offsets in an index-3 block fit within 16 bits (up to 0xffff),
+ * then the data block offsets are stored directly as uint16_t.
+ *
+ * Otherwise (this is very unusual but possible), the index-2 entry for the index-3 block
+ * has bit 15 (0x8000) set, and each set of 8 index-3 entries is preceded by
+ * an additional uint16_t word. Data block offsets are 18 bits wide, with the top 2 bits stored
+ * in the additional word.
+ *
+ * See ucptrie_internalSmallIndex() for details.
+ *
+ * (In a "small" trie, this works for ASCII and below-fast_limit code points as well.)
+ *
+ * Compaction:
+ *
+ * Multiple code point ranges ("blocks") that are aligned on certain boundaries
+ * (determined by the shifting/bit fields of code points) and
+ * map to the same data values normally share a single subsequence of the data array.
+ * Data blocks can also overlap partially.
+ * (Depending on the builder code finding duplicate and overlapping blocks.)
+ *
+ * Iteration over same-value ranges:
+ *
+ * Range iteration (ucptrie_getRange()) walks the structure from a start code point
+ * until some code point is found that maps to a different value;
+ * the end of the returned range is just before that.
+ *
+ * The header.dataNullOffset (split across two header fields, high bits in header.options)
+ * is the offset of a widely shared data block filled with one single value.
+ * It helps quickly skip over large ranges of data with that value.
+ * The builder must ensure that if the start of any data block (fast or small)
+ * matches the dataNullOffset, then the whole block must be filled with the null value.
+ * Special care must be taken if there is no fast null data block
+ * but a small one, which is shorter, and it matches the *start* of some fast data block.
+ *
+ * Similarly, the header.index3NullOffset is the index-array offset of an index-3 block
+ * where all index entries point to the dataNullOffset.
+ * If there is no such data or index-3 block, then these offsets are set to
+ * values that cannot be reached (data offset out of range/reserved index offset),
+ * normally UCPTRIE_NO_DATA_NULL_OFFSET or UCPTRIE_NO_INDEX3_NULL_OFFSET respectively.
+ */
+
+#endif
diff --git a/contrib/libs/icu/common/ucurr.cpp b/contrib/libs/icu/common/ucurr.cpp
index 665424a0f2..5eacc4a99b 100644
--- a/contrib/libs/icu/common/ucurr.cpp
+++ b/contrib/libs/icu/common/ucurr.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -16,29 +16,29 @@
#include "unicode/ures.h"
#include "unicode/ustring.h"
#include "unicode/parsepos.h"
-#include "unicode/uniset.h"
-#include "unicode/usetiter.h"
-#include "unicode/utf16.h"
+#include "unicode/uniset.h"
+#include "unicode/usetiter.h"
+#include "unicode/utf16.h"
#include "ustr_imp.h"
-#include "charstr.h"
+#include "charstr.h"
#include "cmemory.h"
#include "cstring.h"
-#include "static_unicode_sets.h"
+#include "static_unicode_sets.h"
#include "uassert.h"
#include "umutex.h"
#include "ucln_cmn.h"
#include "uenumimp.h"
#include "uhash.h"
#include "hash.h"
-#include "uinvchar.h"
+#include "uinvchar.h"
#include "uresimp.h"
#include "ulist.h"
-#include "uresimp.h"
+#include "uresimp.h"
#include "ureslocs.h"
#include "ulocimp.h"
-using namespace icu;
-
+using namespace icu;
+
//#define UCURR_DEBUG_EQUIV 1
#ifdef UCURR_DEBUG_EQUIV
#include "stdio.h"
@@ -90,7 +90,7 @@ 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_NARROW[] = "Currencies%narrow";
static const char CURRENCYPLURALS[] = "CurrencyPlurals";
// ISO codes mapping table
@@ -344,7 +344,7 @@ _findMetaData(const UChar* currency, UErrorCode& ec) {
// -------------------------------------
-static void
+static void
idForLocale(const char* locale, char* countryAndVariant, int capacity, UErrorCode* ec)
{
ulocimp_getRegionForSupplementalData(locale, FALSE, countryAndVariant, capacity, ec);
@@ -365,7 +365,7 @@ U_CDECL_END
#if !UCONFIG_NO_SERVICE
struct CReg;
-static UMutex gCRegLock;
+static UMutex gCRegLock;
static CReg* gCRegHead = 0;
struct CReg : public icu::UMemory {
@@ -511,83 +511,83 @@ U_CAPI int32_t U_EXPORT2
ucurr_forLocale(const char* locale,
UChar* buff,
int32_t buffCapacity,
- UErrorCode* ec) {
- if (U_FAILURE(*ec)) { return 0; }
- if (buffCapacity < 0 || (buff == nullptr && buffCapacity > 0)) {
- *ec = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
+ UErrorCode* ec) {
+ if (U_FAILURE(*ec)) { return 0; }
+ if (buffCapacity < 0 || (buff == nullptr && buffCapacity > 0)) {
+ *ec = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
- char currency[4]; // ISO currency codes are alpha3 codes.
- UErrorCode localStatus = U_ZERO_ERROR;
- int32_t resLen = uloc_getKeywordValue(locale, "currency",
- currency, UPRV_LENGTHOF(currency), &localStatus);
- if (U_SUCCESS(localStatus) && resLen == 3 && uprv_isInvariantString(currency, resLen)) {
- if (resLen < buffCapacity) {
- T_CString_toUpperCase(currency);
- u_charsToUChars(currency, buff, resLen);
- }
- return u_terminateUChars(buff, buffCapacity, resLen, ec);
- }
+ char currency[4]; // ISO currency codes are alpha3 codes.
+ UErrorCode localStatus = U_ZERO_ERROR;
+ int32_t resLen = uloc_getKeywordValue(locale, "currency",
+ currency, UPRV_LENGTHOF(currency), &localStatus);
+ if (U_SUCCESS(localStatus) && resLen == 3 && uprv_isInvariantString(currency, resLen)) {
+ if (resLen < buffCapacity) {
+ T_CString_toUpperCase(currency);
+ u_charsToUChars(currency, buff, resLen);
+ }
+ return u_terminateUChars(buff, buffCapacity, resLen, ec);
+ }
+
+ // get country or country_variant in `id'
+ char id[ULOC_FULLNAME_CAPACITY];
+ idForLocale(locale, id, UPRV_LENGTHOF(id), ec);
+ if (U_FAILURE(*ec)) {
+ return 0;
+ }
- // get country or country_variant in `id'
- char id[ULOC_FULLNAME_CAPACITY];
- idForLocale(locale, id, UPRV_LENGTHOF(id), ec);
- if (U_FAILURE(*ec)) {
- return 0;
- }
-
#if !UCONFIG_NO_SERVICE
- const UChar* result = CReg::get(id);
- if (result) {
- if(buffCapacity > u_strlen(result)) {
- u_strcpy(buff, result);
- }
- resLen = u_strlen(result);
- return u_terminateUChars(buff, buffCapacity, resLen, ec);
- }
+ const UChar* result = CReg::get(id);
+ if (result) {
+ if(buffCapacity > u_strlen(result)) {
+ u_strcpy(buff, result);
+ }
+ resLen = u_strlen(result);
+ return u_terminateUChars(buff, buffCapacity, resLen, ec);
+ }
#endif
- // Remove variants, which is only needed for registration.
- char *idDelim = uprv_strchr(id, VAR_DELIM);
- if (idDelim) {
- idDelim[0] = 0;
- }
+ // Remove variants, which is only needed for registration.
+ char *idDelim = uprv_strchr(id, VAR_DELIM);
+ if (idDelim) {
+ idDelim[0] = 0;
+ }
- const UChar* s = NULL; // Currency code from data file.
- if (id[0] == 0) {
- // No point looking in the data for an empty string.
- // This is what we would get.
- localStatus = U_MISSING_RESOURCE_ERROR;
- } else {
- // Look up the CurrencyMap element in the root bundle.
- localStatus = U_ZERO_ERROR;
- UResourceBundle *rb = ures_openDirect(U_ICUDATA_CURR, CURRENCY_DATA, &localStatus);
- UResourceBundle *cm = ures_getByKey(rb, CURRENCY_MAP, rb, &localStatus);
- UResourceBundle *countryArray = ures_getByKey(rb, id, cm, &localStatus);
- UResourceBundle *currencyReq = ures_getByIndex(countryArray, 0, NULL, &localStatus);
- s = ures_getStringByKey(currencyReq, "id", &resLen, &localStatus);
- ures_close(currencyReq);
- ures_close(countryArray);
- }
+ const UChar* s = NULL; // Currency code from data file.
+ if (id[0] == 0) {
+ // No point looking in the data for an empty string.
+ // This is what we would get.
+ localStatus = U_MISSING_RESOURCE_ERROR;
+ } else {
+ // Look up the CurrencyMap element in the root bundle.
+ localStatus = U_ZERO_ERROR;
+ UResourceBundle *rb = ures_openDirect(U_ICUDATA_CURR, CURRENCY_DATA, &localStatus);
+ UResourceBundle *cm = ures_getByKey(rb, CURRENCY_MAP, rb, &localStatus);
+ UResourceBundle *countryArray = ures_getByKey(rb, id, cm, &localStatus);
+ UResourceBundle *currencyReq = ures_getByIndex(countryArray, 0, NULL, &localStatus);
+ s = ures_getStringByKey(currencyReq, "id", &resLen, &localStatus);
+ ures_close(currencyReq);
+ ures_close(countryArray);
+ }
- if ((U_FAILURE(localStatus)) && strchr(id, '_') != 0) {
- // We don't know about it. Check to see if we support the variant.
- uloc_getParent(locale, id, UPRV_LENGTHOF(id), ec);
- *ec = U_USING_FALLBACK_WARNING;
- // TODO: Loop over the shortened id rather than recursing and
- // looking again for a currency keyword.
- return ucurr_forLocale(id, buff, buffCapacity, ec);
- }
- if (*ec == U_ZERO_ERROR || localStatus != U_ZERO_ERROR) {
- // There is nothing to fallback to. Report the failure/warning if possible.
- *ec = localStatus;
- }
- if (U_SUCCESS(*ec)) {
- if(buffCapacity > resLen) {
- u_strcpy(buff, s);
+ if ((U_FAILURE(localStatus)) && strchr(id, '_') != 0) {
+ // We don't know about it. Check to see if we support the variant.
+ uloc_getParent(locale, id, UPRV_LENGTHOF(id), ec);
+ *ec = U_USING_FALLBACK_WARNING;
+ // TODO: Loop over the shortened id rather than recursing and
+ // looking again for a currency keyword.
+ return ucurr_forLocale(id, buff, buffCapacity, ec);
+ }
+ if (*ec == U_ZERO_ERROR || localStatus != U_ZERO_ERROR) {
+ // There is nothing to fallback to. Report the failure/warning if possible.
+ *ec = localStatus;
+ }
+ if (U_SUCCESS(*ec)) {
+ if(buffCapacity > resLen) {
+ u_strcpy(buff, s);
}
}
- return u_terminateUChars(buff, buffCapacity, resLen, ec);
+ return u_terminateUChars(buff, buffCapacity, resLen, ec);
}
// end registration
@@ -604,16 +604,16 @@ static UBool fallback(char *loc) {
return FALSE;
}
UErrorCode status = U_ZERO_ERROR;
- if (uprv_strcmp(loc, "en_GB") == 0) {
- // HACK: See #13368. We need "en_GB" to fall back to "en_001" instead of "en"
- // in order to consume the correct data strings. This hack will be removed
- // when proper data sink loading is implemented here.
- // NOTE: "001" adds 1 char over "GB". However, both call sites allocate
- // arrays with length ULOC_FULLNAME_CAPACITY (plenty of room for en_001).
- uprv_strcpy(loc + 3, "001");
- } else {
- uloc_getParent(loc, loc, (int32_t)uprv_strlen(loc), &status);
- }
+ if (uprv_strcmp(loc, "en_GB") == 0) {
+ // HACK: See #13368. We need "en_GB" to fall back to "en_001" instead of "en"
+ // in order to consume the correct data strings. This hack will be removed
+ // when proper data sink loading is implemented here.
+ // NOTE: "001" adds 1 char over "GB". However, both call sites allocate
+ // arrays with length ULOC_FULLNAME_CAPACITY (plenty of room for en_001).
+ uprv_strcpy(loc + 3, "001");
+ } else {
+ uloc_getParent(loc, loc, (int32_t)uprv_strlen(loc), &status);
+ }
/*
char *i = uprv_strrchr(loc, '_');
if (i == NULL) {
@@ -649,7 +649,7 @@ ucurr_getName(const UChar* currency,
}
int32_t choice = (int32_t) nameStyle;
- if (choice < 0 || choice > 2) {
+ if (choice < 0 || choice > 2) {
*ec = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -682,25 +682,25 @@ ucurr_getName(const UChar* currency,
const UChar* s = NULL;
ec2 = U_ZERO_ERROR;
- LocalUResourceBundlePointer rb(ures_open(U_ICUDATA_CURR, loc, &ec2));
-
- if (nameStyle == UCURR_NARROW_SYMBOL_NAME) {
- CharString key;
- key.append(CURRENCIES_NARROW, ec2);
- key.append("/", ec2);
- key.append(buf, ec2);
- s = ures_getStringByKeyWithFallback(rb.getAlias(), key.data(), len, &ec2);
- if (ec2 == U_MISSING_RESOURCE_ERROR) {
- *ec = U_USING_FALLBACK_WARNING;
- ec2 = U_ZERO_ERROR;
- choice = UCURR_SYMBOL_NAME;
- }
- }
- if (s == NULL) {
- ures_getByKey(rb.getAlias(), CURRENCIES, rb.getAlias(), &ec2);
- ures_getByKeyWithFallback(rb.getAlias(), buf, rb.getAlias(), &ec2);
- s = ures_getStringByIndex(rb.getAlias(), choice, len, &ec2);
- }
+ LocalUResourceBundlePointer rb(ures_open(U_ICUDATA_CURR, loc, &ec2));
+
+ if (nameStyle == UCURR_NARROW_SYMBOL_NAME) {
+ CharString key;
+ key.append(CURRENCIES_NARROW, ec2);
+ key.append("/", ec2);
+ key.append(buf, ec2);
+ s = ures_getStringByKeyWithFallback(rb.getAlias(), key.data(), len, &ec2);
+ if (ec2 == U_MISSING_RESOURCE_ERROR) {
+ *ec = U_USING_FALLBACK_WARNING;
+ ec2 = U_ZERO_ERROR;
+ choice = UCURR_SYMBOL_NAME;
+ }
+ }
+ if (s == NULL) {
+ ures_getByKey(rb.getAlias(), CURRENCIES, rb.getAlias(), &ec2);
+ ures_getByKeyWithFallback(rb.getAlias(), buf, rb.getAlias(), &ec2);
+ s = ures_getStringByIndex(rb.getAlias(), choice, len, &ec2);
+ }
// If we've succeeded we're done. Otherwise, try to fallback.
// If that fails (because we are already at root) then exit.
@@ -713,9 +713,9 @@ ucurr_getName(const UChar* currency,
// We no longer support choice format data in names. Data should not contain
// choice patterns.
- if (isChoiceFormat != NULL) {
- *isChoiceFormat = FALSE;
- }
+ if (isChoiceFormat != NULL) {
+ *isChoiceFormat = FALSE;
+ }
if (U_SUCCESS(ec2)) {
U_ASSERT(s != NULL);
return s;
@@ -866,7 +866,7 @@ getCurrencyNameCount(const char* loc, int32_t* total_currency_name_count, int32_
*total_currency_name_count = 0;
*total_currency_symbol_count = 0;
const UChar* s = NULL;
- char locale[ULOC_FULLNAME_CAPACITY] = "";
+ char locale[ULOC_FULLNAME_CAPACITY] = "";
uprv_strcpy(locale, loc);
const icu::Hashtable *currencySymbolsEquiv = getCurrSymbolsEquiv();
for (;;) {
@@ -941,7 +941,7 @@ collectCurrencyNames(const char* locale,
// Look up the Currencies resource for the given locale.
UErrorCode ec2 = U_ZERO_ERROR;
- char loc[ULOC_FULLNAME_CAPACITY] = "";
+ char loc[ULOC_FULLNAME_CAPACITY] = "";
uloc_getName(locale, loc, sizeof(loc), &ec2);
if (U_FAILURE(ec2) || ec2 == U_STRING_NOT_TERMINATED_WARNING) {
ec = U_ILLEGAL_ARGUMENT_ERROR;
@@ -1007,8 +1007,8 @@ collectCurrencyNames(const char* locale,
const UnicodeString *symbol;
while ((symbol = iter.next()) != NULL) {
(*currencySymbols)[*total_currency_symbol_count].IsoCode = iso;
- (*currencySymbols)[*total_currency_symbol_count].currencyName =
- const_cast<UChar*>(symbol->getBuffer());
+ (*currencySymbols)[*total_currency_symbol_count].currencyName =
+ const_cast<UChar*>(symbol->getBuffer());
(*currencySymbols)[*total_currency_symbol_count].flag = 0;
(*currencySymbols)[(*total_currency_symbol_count)++].currencyNameLen = symbol->length();
}
@@ -1035,11 +1035,11 @@ collectCurrencyNames(const char* locale,
}
// currency plurals
- UErrorCode ec5 = U_ZERO_ERROR;
- UResourceBundle* curr_p = ures_getByKey(rb, CURRENCYPLURALS, NULL, &ec5);
+ UErrorCode ec5 = U_ZERO_ERROR;
+ UResourceBundle* curr_p = ures_getByKey(rb, CURRENCYPLURALS, NULL, &ec5);
n = ures_getSize(curr_p);
for (int32_t i=0; i<n; ++i) {
- UResourceBundle* names = ures_getByIndex(curr_p, i, NULL, &ec5);
+ UResourceBundle* names = ures_getByIndex(curr_p, i, NULL, &ec5);
iso = (char*)ures_getKey(names);
// Using hash to remove duplicated ISO codes in fallback chain.
if (localeLevel == 0) {
@@ -1057,7 +1057,7 @@ collectCurrencyNames(const char* locale,
for (int32_t j = 0; j < num; ++j) {
// TODO: remove duplicates between singular name and
// currency long name?
- s = ures_getStringByIndex(names, j, &len, &ec5);
+ s = ures_getStringByIndex(names, j, &len, &ec5);
(*currencyNames)[*total_currency_name_count].IsoCode = iso;
UChar* upperName = toUpperCase(s, len, locale);
(*currencyNames)[*total_currency_name_count].currencyName = upperName;
@@ -1241,28 +1241,28 @@ static void
linearSearch(const CurrencyNameStruct* currencyNames,
int32_t begin, int32_t end,
const UChar* text, int32_t textLen,
- int32_t *partialMatchLen,
+ int32_t *partialMatchLen,
int32_t *maxMatchLen, int32_t* maxMatchIndex) {
- int32_t initialPartialMatchLen = *partialMatchLen;
+ int32_t initialPartialMatchLen = *partialMatchLen;
for (int32_t index = begin; index <= end; ++index) {
int32_t len = currencyNames[index].currencyNameLen;
if (len > *maxMatchLen && len <= textLen &&
uprv_memcmp(currencyNames[index].currencyName, text, len * sizeof(UChar)) == 0) {
- *partialMatchLen = MAX(*partialMatchLen, len);
+ *partialMatchLen = MAX(*partialMatchLen, len);
*maxMatchIndex = index;
*maxMatchLen = len;
#ifdef UCURR_DEBUG
printf("maxMatchIndex = %d, maxMatchLen = %d\n",
*maxMatchIndex, *maxMatchLen);
#endif
- } else {
- // Check for partial matches.
- for (int32_t i=initialPartialMatchLen; i<MIN(len, textLen); i++) {
- if (currencyNames[index].currencyName[i] != text[i]) {
- break;
- }
- *partialMatchLen = MAX(*partialMatchLen, i + 1);
- }
+ } else {
+ // Check for partial matches.
+ for (int32_t i=initialPartialMatchLen; i<MIN(len, textLen); i++) {
+ if (currencyNames[index].currencyName[i] != text[i]) {
+ break;
+ }
+ *partialMatchLen = MAX(*partialMatchLen, i + 1);
+ }
}
}
}
@@ -1279,8 +1279,8 @@ linearSearch(const CurrencyNameStruct* currencyNames,
static void
searchCurrencyName(const CurrencyNameStruct* currencyNames,
int32_t total_currency_count,
- const UChar* text, int32_t textLen,
- int32_t *partialMatchLen,
+ const UChar* text, int32_t textLen,
+ int32_t *partialMatchLen,
int32_t* maxMatchLen, int32_t* maxMatchIndex) {
*maxMatchIndex = -1;
*maxMatchLen = 0;
@@ -1310,7 +1310,7 @@ searchCurrencyName(const CurrencyNameStruct* currencyNames,
if (binarySearchBegin == -1) { // did not find the range
break;
}
- *partialMatchLen = MAX(*partialMatchLen, index + 1);
+ *partialMatchLen = MAX(*partialMatchLen, index + 1);
if (matchIndex != -1) {
// find an exact match for text from text[0] to text[index]
// in currencyNames array.
@@ -1321,7 +1321,7 @@ searchCurrencyName(const CurrencyNameStruct* currencyNames,
// linear search if within threshold.
linearSearch(currencyNames, binarySearchBegin, binarySearchEnd,
text, textLen,
- partialMatchLen,
+ partialMatchLen,
maxMatchLen, maxMatchIndex);
break;
}
@@ -1355,7 +1355,7 @@ static CurrencyNameCacheEntry* currCache[CURRENCY_NAME_CACHE_NUM] = {NULL};
// It is a simple round-robin replacement strategy.
static int8_t currentCacheEntryIndex = 0;
-static UMutex gCurrencyCacheMutex;
+static UMutex gCurrencyCacheMutex;
// Cache deletion
static void
@@ -1390,13 +1390,13 @@ currency_cache_cleanup(void) {
}
-/**
- * Loads the currency name data from the cache, or from resource bundles if necessary.
- * The refCount is automatically incremented. It is the caller's responsibility
- * to decrement it when done!
- */
-static CurrencyNameCacheEntry*
-getCacheEntry(const char* locale, UErrorCode& ec) {
+/**
+ * Loads the currency name data from the cache, or from resource bundles if necessary.
+ * The refCount is automatically incremented. It is the caller's responsibility
+ * to decrement it when done!
+ */
+static CurrencyNameCacheEntry*
+getCacheEntry(const char* locale, UErrorCode& ec) {
int32_t total_currency_name_count = 0;
CurrencyNameStruct* currencyNames = NULL;
@@ -1407,7 +1407,7 @@ getCacheEntry(const char* locale, UErrorCode& ec) {
umtx_lock(&gCurrencyCacheMutex);
// in order to handle racing correctly,
// not putting 'search' in a separate function.
- int8_t found = -1;
+ int8_t found = -1;
for (int8_t i = 0; i < CURRENCY_NAME_CACHE_NUM; ++i) {
if (currCache[i]!= NULL &&
uprv_strcmp(locale, currCache[i]->locale) == 0) {
@@ -1423,7 +1423,7 @@ getCacheEntry(const char* locale, UErrorCode& ec) {
if (found == -1) {
collectCurrencyNames(locale, &currencyNames, &total_currency_name_count, &currencySymbols, &total_currency_symbol_count, ec);
if (U_FAILURE(ec)) {
- return NULL;
+ return NULL;
}
umtx_lock(&gCurrencyCacheMutex);
// check again.
@@ -1457,7 +1457,7 @@ getCacheEntry(const char* locale, UErrorCode& ec) {
cacheEntry->totalCurrencySymbolCount = total_currency_symbol_count;
cacheEntry->refCount = 2; // one for cache, one for reference
currentCacheEntryIndex = (currentCacheEntryIndex + 1) % CURRENCY_NAME_CACHE_NUM;
- ucln_common_registerCleanup(UCLN_COMMON_CURRENCY, currency_cleanup);
+ ucln_common_registerCleanup(UCLN_COMMON_CURRENCY, currency_cleanup);
} else {
deleteCurrencyNames(currencyNames, total_currency_name_count);
deleteCurrencyNames(currencySymbols, total_currency_symbol_count);
@@ -1467,40 +1467,40 @@ getCacheEntry(const char* locale, UErrorCode& ec) {
umtx_unlock(&gCurrencyCacheMutex);
}
- return cacheEntry;
-}
-
-static void releaseCacheEntry(CurrencyNameCacheEntry* cacheEntry) {
- umtx_lock(&gCurrencyCacheMutex);
- --(cacheEntry->refCount);
- if (cacheEntry->refCount == 0) { // remove
- deleteCacheEntry(cacheEntry);
- }
- umtx_unlock(&gCurrencyCacheMutex);
-}
-
-U_CAPI void
-uprv_parseCurrency(const char* locale,
- const icu::UnicodeString& text,
- icu::ParsePosition& pos,
- int8_t type,
- int32_t* partialMatchLen,
- UChar* result,
- UErrorCode& ec) {
- U_NAMESPACE_USE
- if (U_FAILURE(ec)) {
- return;
- }
- CurrencyNameCacheEntry* cacheEntry = getCacheEntry(locale, ec);
- if (U_FAILURE(ec)) {
- return;
- }
-
- int32_t total_currency_name_count = cacheEntry->totalCurrencyNameCount;
- CurrencyNameStruct* currencyNames = cacheEntry->currencyNames;
- int32_t total_currency_symbol_count = cacheEntry->totalCurrencySymbolCount;
- CurrencyNameStruct* currencySymbols = cacheEntry->currencySymbols;
-
+ return cacheEntry;
+}
+
+static void releaseCacheEntry(CurrencyNameCacheEntry* cacheEntry) {
+ umtx_lock(&gCurrencyCacheMutex);
+ --(cacheEntry->refCount);
+ if (cacheEntry->refCount == 0) { // remove
+ deleteCacheEntry(cacheEntry);
+ }
+ umtx_unlock(&gCurrencyCacheMutex);
+}
+
+U_CAPI void
+uprv_parseCurrency(const char* locale,
+ const icu::UnicodeString& text,
+ icu::ParsePosition& pos,
+ int8_t type,
+ int32_t* partialMatchLen,
+ UChar* result,
+ UErrorCode& ec) {
+ U_NAMESPACE_USE
+ if (U_FAILURE(ec)) {
+ return;
+ }
+ CurrencyNameCacheEntry* cacheEntry = getCacheEntry(locale, ec);
+ if (U_FAILURE(ec)) {
+ return;
+ }
+
+ int32_t total_currency_name_count = cacheEntry->totalCurrencyNameCount;
+ CurrencyNameStruct* currencyNames = cacheEntry->currencyNames;
+ int32_t total_currency_symbol_count = cacheEntry->totalCurrencySymbolCount;
+ CurrencyNameStruct* currencySymbols = cacheEntry->currencySymbols;
+
int32_t start = pos.getIndex();
UChar inputText[MAX_CURRENCY_NAME_LEN];
@@ -1510,14 +1510,14 @@ uprv_parseCurrency(const char* locale,
UErrorCode ec1 = U_ZERO_ERROR;
textLen = u_strToUpper(upperText, MAX_CURRENCY_NAME_LEN, inputText, textLen, locale, &ec1);
- // Make sure partialMatchLen is initialized
- *partialMatchLen = 0;
-
+ // Make sure partialMatchLen is initialized
+ *partialMatchLen = 0;
+
int32_t max = 0;
int32_t matchIndex = -1;
// case in-sensitive comparision against currency names
searchCurrencyName(currencyNames, total_currency_name_count,
- upperText, textLen, partialMatchLen, &max, &matchIndex);
+ upperText, textLen, partialMatchLen, &max, &matchIndex);
#ifdef UCURR_DEBUG
printf("search in names, max = %d, matchIndex = %d\n", max, matchIndex);
@@ -1528,8 +1528,8 @@ uprv_parseCurrency(const char* locale,
if (type != UCURR_LONG_NAME) { // not name only
// case sensitive comparison against currency symbols and ISO code.
searchCurrencyName(currencySymbols, total_currency_symbol_count,
- inputText, textLen,
- partialMatchLen,
+ inputText, textLen,
+ partialMatchLen,
&maxInSymbol, &matchIndexInSymbol);
}
@@ -1546,38 +1546,38 @@ uprv_parseCurrency(const char* locale,
} else if (maxInSymbol >= max && matchIndexInSymbol != -1) {
u_charsToUChars(currencySymbols[matchIndexInSymbol].IsoCode, result, 4);
pos.setIndex(start + maxInSymbol);
- }
+ }
// decrease reference count
- releaseCacheEntry(cacheEntry);
-}
-
-void uprv_currencyLeads(const char* locale, icu::UnicodeSet& result, UErrorCode& ec) {
- U_NAMESPACE_USE
- if (U_FAILURE(ec)) {
- return;
- }
- CurrencyNameCacheEntry* cacheEntry = getCacheEntry(locale, ec);
- if (U_FAILURE(ec)) {
- return;
- }
-
- for (int32_t i=0; i<cacheEntry->totalCurrencySymbolCount; i++) {
- const CurrencyNameStruct& info = cacheEntry->currencySymbols[i];
- UChar32 cp;
- U16_GET(info.currencyName, 0, 0, info.currencyNameLen, cp);
- result.add(cp);
- }
-
- for (int32_t i=0; i<cacheEntry->totalCurrencyNameCount; i++) {
- const CurrencyNameStruct& info = cacheEntry->currencyNames[i];
- UChar32 cp;
- U16_GET(info.currencyName, 0, 0, info.currencyNameLen, cp);
- result.add(cp);
- }
-
- // decrease reference count
- releaseCacheEntry(cacheEntry);
+ releaseCacheEntry(cacheEntry);
+}
+
+void uprv_currencyLeads(const char* locale, icu::UnicodeSet& result, UErrorCode& ec) {
+ U_NAMESPACE_USE
+ if (U_FAILURE(ec)) {
+ return;
+ }
+ CurrencyNameCacheEntry* cacheEntry = getCacheEntry(locale, ec);
+ if (U_FAILURE(ec)) {
+ return;
+ }
+
+ for (int32_t i=0; i<cacheEntry->totalCurrencySymbolCount; i++) {
+ const CurrencyNameStruct& info = cacheEntry->currencySymbols[i];
+ UChar32 cp;
+ U16_GET(info.currencyName, 0, 0, info.currencyNameLen, cp);
+ result.add(cp);
+ }
+
+ for (int32_t i=0; i<cacheEntry->totalCurrencyNameCount; i++) {
+ const CurrencyNameStruct& info = cacheEntry->currencyNames[i];
+ UChar32 cp;
+ U16_GET(info.currencyName, 0, 0, info.currencyNameLen, cp);
+ result.add(cp);
+ }
+
+ // decrease reference count
+ releaseCacheEntry(cacheEntry);
}
@@ -1599,7 +1599,7 @@ uprv_getStaticCurrencyName(const UChar* iso, const char* loc,
int32_t len;
const UChar* currname = ucurr_getName(iso, loc, UCURR_SYMBOL_NAME,
- nullptr /* isChoiceFormat */, &len, &ec);
+ nullptr /* isChoiceFormat */, &len, &ec);
if (U_SUCCESS(ec)) {
result.setTo(currname, len);
}
@@ -1742,8 +1742,8 @@ static const struct CurrencyList {
{"BUK", UCURR_COMMON|UCURR_DEPRECATED},
{"BWP", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"BYB", UCURR_COMMON|UCURR_DEPRECATED},
- {"BYN", UCURR_COMMON|UCURR_NON_DEPRECATED},
- {"BYR", UCURR_COMMON|UCURR_DEPRECATED},
+ {"BYN", UCURR_COMMON|UCURR_NON_DEPRECATED},
+ {"BYR", UCURR_COMMON|UCURR_DEPRECATED},
{"BZD", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"CAD", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"CDF", UCURR_COMMON|UCURR_NON_DEPRECATED},
@@ -1753,7 +1753,7 @@ static const struct CurrencyList {
{"CLE", UCURR_COMMON|UCURR_DEPRECATED},
{"CLF", UCURR_UNCOMMON|UCURR_NON_DEPRECATED},
{"CLP", UCURR_COMMON|UCURR_NON_DEPRECATED},
- {"CNH", UCURR_UNCOMMON|UCURR_NON_DEPRECATED},
+ {"CNH", UCURR_UNCOMMON|UCURR_NON_DEPRECATED},
{"CNX", UCURR_UNCOMMON|UCURR_DEPRECATED},
{"CNY", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"COP", UCURR_COMMON|UCURR_NON_DEPRECATED},
@@ -1776,7 +1776,7 @@ static const struct CurrencyList {
{"ECV", UCURR_UNCOMMON|UCURR_DEPRECATED},
{"EEK", UCURR_COMMON|UCURR_DEPRECATED},
{"EGP", UCURR_COMMON|UCURR_NON_DEPRECATED},
- {"EQE", UCURR_COMMON|UCURR_DEPRECATED}, // questionable, remove?
+ {"EQE", UCURR_COMMON|UCURR_DEPRECATED}, // questionable, remove?
{"ERN", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"ESA", UCURR_UNCOMMON|UCURR_DEPRECATED},
{"ESB", UCURR_UNCOMMON|UCURR_DEPRECATED},
@@ -1800,7 +1800,7 @@ static const struct CurrencyList {
{"GRD", UCURR_COMMON|UCURR_DEPRECATED},
{"GTQ", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"GWE", UCURR_COMMON|UCURR_DEPRECATED},
- {"GWP", UCURR_COMMON|UCURR_DEPRECATED},
+ {"GWP", UCURR_COMMON|UCURR_DEPRECATED},
{"GYD", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"HKD", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"HNL", UCURR_COMMON|UCURR_NON_DEPRECATED},
@@ -1838,13 +1838,13 @@ static const struct CurrencyList {
{"LKR", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"LRD", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"LSL", UCURR_COMMON|UCURR_NON_DEPRECATED},
- {"LSM", UCURR_COMMON|UCURR_DEPRECATED}, // questionable, remove?
- {"LTL", UCURR_COMMON|UCURR_DEPRECATED},
+ {"LSM", UCURR_COMMON|UCURR_DEPRECATED}, // questionable, remove?
+ {"LTL", UCURR_COMMON|UCURR_DEPRECATED},
{"LTT", UCURR_COMMON|UCURR_DEPRECATED},
{"LUC", UCURR_UNCOMMON|UCURR_DEPRECATED},
{"LUF", UCURR_COMMON|UCURR_DEPRECATED},
{"LUL", UCURR_UNCOMMON|UCURR_DEPRECATED},
- {"LVL", UCURR_COMMON|UCURR_DEPRECATED},
+ {"LVL", UCURR_COMMON|UCURR_DEPRECATED},
{"LVR", UCURR_COMMON|UCURR_DEPRECATED},
{"LYD", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"MAD", UCURR_COMMON|UCURR_NON_DEPRECATED},
@@ -1860,19 +1860,19 @@ static const struct CurrencyList {
{"MMK", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"MNT", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"MOP", UCURR_COMMON|UCURR_NON_DEPRECATED},
- {"MRO", UCURR_COMMON|UCURR_DEPRECATED},
- {"MRU", UCURR_COMMON|UCURR_NON_DEPRECATED},
+ {"MRO", UCURR_COMMON|UCURR_DEPRECATED},
+ {"MRU", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"MTL", UCURR_COMMON|UCURR_DEPRECATED},
{"MTP", UCURR_COMMON|UCURR_DEPRECATED},
{"MUR", UCURR_COMMON|UCURR_NON_DEPRECATED},
- {"MVP", UCURR_COMMON|UCURR_DEPRECATED}, // questionable, remove?
+ {"MVP", UCURR_COMMON|UCURR_DEPRECATED}, // questionable, remove?
{"MVR", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"MWK", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"MXN", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"MXP", UCURR_COMMON|UCURR_DEPRECATED},
{"MXV", UCURR_UNCOMMON|UCURR_NON_DEPRECATED},
{"MYR", UCURR_COMMON|UCURR_NON_DEPRECATED},
- {"MZE", UCURR_COMMON|UCURR_DEPRECATED},
+ {"MZE", UCURR_COMMON|UCURR_DEPRECATED},
{"MZM", UCURR_COMMON|UCURR_DEPRECATED},
{"MZN", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"NAD", UCURR_COMMON|UCURR_NON_DEPRECATED},
@@ -1913,16 +1913,16 @@ static const struct CurrencyList {
{"SGD", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"SHP", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"SIT", UCURR_COMMON|UCURR_DEPRECATED},
- {"SKK", UCURR_COMMON|UCURR_DEPRECATED},
+ {"SKK", UCURR_COMMON|UCURR_DEPRECATED},
{"SLL", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"SOS", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"SRD", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"SRG", UCURR_COMMON|UCURR_DEPRECATED},
{"SSP", UCURR_COMMON|UCURR_NON_DEPRECATED},
- {"STD", UCURR_COMMON|UCURR_DEPRECATED},
- {"STN", UCURR_COMMON|UCURR_NON_DEPRECATED},
+ {"STD", UCURR_COMMON|UCURR_DEPRECATED},
+ {"STN", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"SUR", UCURR_COMMON|UCURR_DEPRECATED},
- {"SVC", UCURR_COMMON|UCURR_DEPRECATED},
+ {"SVC", UCURR_COMMON|UCURR_DEPRECATED},
{"SYP", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"SZL", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"THB", UCURR_COMMON|UCURR_NON_DEPRECATED},
@@ -1971,7 +1971,7 @@ static const struct CurrencyList {
{"XPD", UCURR_UNCOMMON|UCURR_NON_DEPRECATED},
{"XPF", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"XPT", UCURR_UNCOMMON|UCURR_NON_DEPRECATED},
- {"XRE", UCURR_UNCOMMON|UCURR_DEPRECATED},
+ {"XRE", UCURR_UNCOMMON|UCURR_DEPRECATED},
{"XSU", UCURR_UNCOMMON|UCURR_NON_DEPRECATED},
{"XTS", UCURR_UNCOMMON|UCURR_NON_DEPRECATED},
{"XUA", UCURR_UNCOMMON|UCURR_NON_DEPRECATED},
@@ -1982,13 +1982,13 @@ static const struct CurrencyList {
{"YUM", UCURR_COMMON|UCURR_DEPRECATED},
{"YUN", UCURR_COMMON|UCURR_DEPRECATED},
{"YUR", UCURR_COMMON|UCURR_DEPRECATED},
- {"ZAL", UCURR_UNCOMMON|UCURR_DEPRECATED},
+ {"ZAL", UCURR_UNCOMMON|UCURR_DEPRECATED},
{"ZAR", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"ZMK", UCURR_COMMON|UCURR_DEPRECATED},
{"ZMW", UCURR_COMMON|UCURR_NON_DEPRECATED},
{"ZRN", UCURR_COMMON|UCURR_DEPRECATED},
{"ZRZ", UCURR_COMMON|UCURR_DEPRECATED},
- {"ZWD", UCURR_COMMON|UCURR_DEPRECATED},
+ {"ZWD", UCURR_COMMON|UCURR_DEPRECATED},
{"ZWL", UCURR_COMMON|UCURR_DEPRECATED},
{"ZWR", UCURR_COMMON|UCURR_DEPRECATED},
{ NULL, 0 } // Leave here to denote the end of the list.
@@ -2161,20 +2161,20 @@ static void U_CALLCONV initIsoCodes(UErrorCode &status) {
}
static void populateCurrSymbolsEquiv(icu::Hashtable *hash, UErrorCode &status) {
- if (U_FAILURE(status)) { return; }
- for (auto& entry : unisets::kCurrencyEntries) {
- UnicodeString exemplar(entry.exemplar);
- const UnicodeSet* set = unisets::get(entry.key);
- if (set == nullptr) { return; }
- UnicodeSetIterator it(*set);
- while (it.next()) {
- UnicodeString value = it.getString();
- if (value == exemplar) {
- // No need to mark the exemplar character as an equivalent
- continue;
- }
- makeEquivalent(exemplar, value, hash, status);
- if (U_FAILURE(status)) { return; }
+ if (U_FAILURE(status)) { return; }
+ for (auto& entry : unisets::kCurrencyEntries) {
+ UnicodeString exemplar(entry.exemplar);
+ const UnicodeSet* set = unisets::get(entry.key);
+ if (set == nullptr) { return; }
+ UnicodeSetIterator it(*set);
+ while (it.next()) {
+ UnicodeString value = it.getString();
+ if (value == exemplar) {
+ // No need to mark the exemplar character as an equivalent
+ continue;
+ }
+ makeEquivalent(exemplar, value, hash, status);
+ if (U_FAILURE(status)) { return; }
}
}
}
@@ -2260,9 +2260,9 @@ ucurr_countCurrencies(const char* locale,
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);
+ idForLocale(locale, id, sizeof(id), ec);
if (U_FAILURE(*ec))
{
@@ -2378,7 +2378,7 @@ ucurr_forLocaleAndDate(const char* locale,
resLen = uloc_getKeywordValue(locale, "currency", id, ULOC_FULLNAME_CAPACITY, &localStatus);
// get country or country_variant in `id'
- idForLocale(locale, id, sizeof(id), ec);
+ idForLocale(locale, id, sizeof(id), ec);
if (U_FAILURE(*ec))
{
return 0;
diff --git a/contrib/libs/icu/common/ucurrimp.h b/contrib/libs/icu/common/ucurrimp.h
index 7d2ed7e108..6d9588295d 100644
--- a/contrib/libs/icu/common/ucurrimp.h
+++ b/contrib/libs/icu/common/ucurrimp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -13,7 +13,7 @@
#include "unicode/utypes.h"
#include "unicode/unistr.h"
#include "unicode/parsepos.h"
-#include "unicode/uniset.h"
+#include "unicode/uniset.h"
/**
* Internal method. Given a currency ISO code and a locale, return
@@ -37,8 +37,8 @@ uprv_getStaticCurrencyName(const UChar* iso, const char* loc,
* match, then the display name is preferred, unless it's length
* is less than 3.
*
- * The parameters must not be NULL.
- *
+ * The parameters must not be NULL.
+ *
* @param locale the locale of the display names to match
* @param text the text to parse
* @param pos input-output position; on input, the position within
@@ -46,8 +46,8 @@ uprv_getStaticCurrencyName(const UChar* iso, const char* loc,
* on output, the position after the last matched character. If
* the parse fails, the position in unchanged upon output.
* @param type currency type to parse against, LONG_NAME only or not
- * @param partialMatchLen The length of the longest matching prefix;
- * this may be nonzero even if no full currency was matched.
+ * @param partialMatchLen The length of the longest matching prefix;
+ * this may be nonzero even if no full currency was matched.
* @return the ISO 4217 code, as a string, of the best match, or
* null if there is no match
*
@@ -58,21 +58,21 @@ uprv_parseCurrency(const char* locale,
const icu::UnicodeString& text,
icu::ParsePosition& pos,
int8_t type,
- int32_t* partialMatchLen,
+ int32_t* partialMatchLen,
UChar* result,
UErrorCode& ec);
-/**
- * Puts all possible first-characters of a currency into the
- * specified UnicodeSet.
- *
- * @param locale the locale of the display names of interest
- * @param result the UnicodeSet to which to add the starting characters
- */
-void uprv_currencyLeads(const char* locale, icu::UnicodeSet& result, UErrorCode& ec);
-
-
-
+/**
+ * Puts all possible first-characters of a currency into the
+ * specified UnicodeSet.
+ *
+ * @param locale the locale of the display names of interest
+ * @param result the UnicodeSet to which to add the starting characters
+ */
+void uprv_currencyLeads(const char* locale, icu::UnicodeSet& result, UErrorCode& ec);
+
+
+
#endif /* #ifndef _UCURR_IMP_H_ */
//eof
diff --git a/contrib/libs/icu/common/udata.cpp b/contrib/libs/icu/common/udata.cpp
index ca5f85a73a..ec9c999cea 100644
--- a/contrib/libs/icu/common/udata.cpp
+++ b/contrib/libs/icu/common/udata.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: udata.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -33,7 +33,7 @@ might have to #include some other header
#include "cstring.h"
#include "mutex.h"
#include "putilimp.h"
-#include "restrace.h"
+#include "restrace.h"
#include "uassert.h"
#include "ucln_cmn.h"
#include "ucmndata.h"
@@ -111,13 +111,13 @@ static u_atomic_int32_t gHaveTriedToLoadCommonData = ATOMIC_INT32_T_INITIALIZER(
static UHashtable *gCommonDataCache = NULL; /* Global hash table of opened ICU data files. */
static icu::UInitOnce gCommonDataCacheInitOnce = U_INITONCE_INITIALIZER;
-#if !defined(ICU_DATA_DIR_WINDOWS)
+#if !defined(ICU_DATA_DIR_WINDOWS)
static UDataFileAccess gDataFileAccess = UDATA_DEFAULT_ACCESS; // Access not synchronized.
// Modifying is documented as thread-unsafe.
-#else
-// If we are using the Windows data directory, then look in one spot only.
-static UDataFileAccess gDataFileAccess = UDATA_NO_FILES;
-#endif
+#else
+// If we are using the Windows data directory, then look in one spot only.
+static UDataFileAccess gDataFileAccess = UDATA_NO_FILES;
+#endif
static UBool U_CALLCONV
udata_cleanup(void)
@@ -208,8 +208,8 @@ setCommonICUData(UDataMemory *pData, /* The new common data. Belongs to ca
return didUpdate;
}
-#if !defined(ICU_DATA_DIR_WINDOWS)
-
+#if !defined(ICU_DATA_DIR_WINDOWS)
+
static UBool
setCommonICUDataPointer(const void *pData, UBool /*warn*/, UErrorCode *pErrorCode) {
UDataMemory tData;
@@ -219,8 +219,8 @@ setCommonICUDataPointer(const void *pData, UBool /*warn*/, UErrorCode *pErrorCod
return setCommonICUData(&tData, FALSE, pErrorCode);
}
-#endif
-
+#endif
+
static const char *
findBasename(const char *path) {
const char *basename=uprv_strrchr(path, U_FILE_SEP_CHAR);
@@ -322,7 +322,7 @@ static UDataMemory *udata_findCachedData(const char *path, UErrorCode &err)
retVal = el->item;
}
#ifdef UDATA_DEBUG
- fprintf(stderr, "Cache: [%s] -> %p\n", baseName, (void*) retVal);
+ fprintf(stderr, "Cache: [%s] -> %p\n", baseName, (void*) retVal);
#endif
return retVal;
}
@@ -385,7 +385,7 @@ static UDataMemory *udata_cacheDataItem(const char *path, UDataMemory *item, UEr
#ifdef UDATA_DEBUG
fprintf(stderr, "Cache: [%s] <<< %p : %s. vFunc=%p\n", newElement->name,
- (void*) newElement->item, u_errorName(subErr), (void*) newElement->item->vFuncs);
+ (void*) newElement->item, u_errorName(subErr), (void*) newElement->item->vFuncs);
#endif
if (subErr == U_USING_DEFAULT_WARNING || U_FAILURE(subErr)) {
@@ -421,8 +421,8 @@ private:
const char *nextPath; /* path following this one */
const char *basename; /* item's basename (icudt22e_mt.res)*/
- StringPiece suffix; /* item suffix (can be null) */
-
+ StringPiece suffix; /* item suffix (can be null) */
+
uint32_t basenameLen; /* length of basename */
CharString itemPath; /* path passed in with item name */
@@ -435,15 +435,15 @@ private:
};
/**
- * @param iter The iterator to be initialized. Its current state does not matter.
- * @param inPath The full pathname to be iterated over. If NULL, defaults to U_ICUDATA_NAME
- * @param pkg Package which is being searched for, ex "icudt28l". Will ignore leaf directories such as /icudt28l
- * @param item Item to be searched for. Can include full path, such as /a/b/foo.dat
- * @param inSuffix Optional item suffix, if not-null (ex. ".dat") then 'path' can contain 'item' explicitly.
- * Ex: 'stuff.dat' would be found in '/a/foo:/tmp/stuff.dat:/bar/baz' as item #2.
- * '/blarg/stuff.dat' would also be found.
- * Note: inSuffix may also be the 'item' being searched for as well, (ex: "ibm-5348_P100-1997.cnv"), in which case
- * the 'item' parameter is often the same as pkg. (Though sometimes might have a tree part as well, ex: "icudt62l-curr").
+ * @param iter The iterator to be initialized. Its current state does not matter.
+ * @param inPath The full pathname to be iterated over. If NULL, defaults to U_ICUDATA_NAME
+ * @param pkg Package which is being searched for, ex "icudt28l". Will ignore leaf directories such as /icudt28l
+ * @param item Item to be searched for. Can include full path, such as /a/b/foo.dat
+ * @param inSuffix Optional item suffix, if not-null (ex. ".dat") then 'path' can contain 'item' explicitly.
+ * Ex: 'stuff.dat' would be found in '/a/foo:/tmp/stuff.dat:/bar/baz' as item #2.
+ * '/blarg/stuff.dat' would also be found.
+ * Note: inSuffix may also be the 'item' being searched for as well, (ex: "ibm-5348_P100-1997.cnv"), in which case
+ * the 'item' parameter is often the same as pkg. (Though sometimes might have a tree part as well, ex: "icudt62l-curr").
*/
UDataPathIterator::UDataPathIterator(const char *inPath, const char *pkg,
const char *item, const char *inSuffix, UBool doCheckLastFour,
@@ -479,7 +479,7 @@ UDataPathIterator::UDataPathIterator(const char *inPath, const char *pkg,
nextPath = itemPath.data();
}
#ifdef UDATA_DEBUG
- fprintf(stderr, "SUFFIX=%s [%p]\n", inSuffix, (void*) inSuffix);
+ fprintf(stderr, "SUFFIX=%s [%p]\n", inSuffix, (void*) inSuffix);
#endif
/** Suffix **/
@@ -494,11 +494,11 @@ UDataPathIterator::UDataPathIterator(const char *inPath, const char *pkg,
/* pathBuffer will hold the output path strings returned by this iterator */
#ifdef UDATA_DEBUG
- fprintf(stderr, "0: init %s -> [path=%s], [base=%s], [suff=%s], [itempath=%s], [nextpath=%s], [checklast4=%s]\n",
+ fprintf(stderr, "0: init %s -> [path=%s], [base=%s], [suff=%s], [itempath=%s], [nextpath=%s], [checklast4=%s]\n",
item,
path,
basename,
- suffix.data(),
+ suffix.data(),
itemPath.data(),
nextPath,
checkLastFour?"TRUE":"false");
@@ -554,7 +554,7 @@ const char *UDataPathIterator::next(UErrorCode *pErrorCode)
fprintf(stderr, "rest of path (IDD) = %s\n", currentPath);
fprintf(stderr, " ");
{
- int32_t qqq;
+ int32_t qqq;
for(qqq=0;qqq<pathLen;qqq++)
{
fprintf(stderr, " ");
@@ -570,12 +570,12 @@ const char *UDataPathIterator::next(UErrorCode *pErrorCode)
if(checkLastFour == TRUE &&
(pathLen>=4) &&
- uprv_strncmp(pathBuffer.data() +(pathLen-4), suffix.data(), 4)==0 && /* suffix matches */
+ uprv_strncmp(pathBuffer.data() +(pathLen-4), suffix.data(), 4)==0 && /* suffix matches */
uprv_strncmp(findBasename(pathBuffer.data()), basename, basenameLen)==0 && /* base matches */
uprv_strlen(pathBasename)==(basenameLen+4)) { /* base+suffix = full len */
#ifdef UDATA_DEBUG
- fprintf(stderr, "Have %s file on the path: %s\n", suffix.data(), pathBuffer.data());
+ fprintf(stderr, "Have %s file on the path: %s\n", suffix.data(), pathBuffer.data());
#endif
/* do nothing */
}
@@ -606,13 +606,13 @@ const char *UDataPathIterator::next(UErrorCode *pErrorCode)
/* + basename */
pathBuffer.append(packageStub.data()+1, packageStub.length()-1, *pErrorCode);
- if (!suffix.empty()) /* tack on suffix */
+ if (!suffix.empty()) /* tack on suffix */
{
- if (suffix.length() > 4) {
- // If the suffix is actually an item ("ibm-5348_P100-1997.cnv") and not an extension (".res")
- // then we need to ensure that the path ends with a separator.
- pathBuffer.ensureEndsWithFileSeparator(*pErrorCode);
- }
+ if (suffix.length() > 4) {
+ // If the suffix is actually an item ("ibm-5348_P100-1997.cnv") and not an extension (".res")
+ // then we need to ensure that the path ends with a separator.
+ pathBuffer.ensureEndsWithFileSeparator(*pErrorCode);
+ }
pathBuffer.append(suffix, *pErrorCode);
}
}
@@ -636,15 +636,15 @@ U_NAMESPACE_END
/*----------------------------------------------------------------------*
* *
- * Add a static reference to the common data library *
+ * Add a static reference to the common data library *
* Unless overridden by an explicit udata_setCommonData, this will be *
* our common data. *
* *
*----------------------------------------------------------------------*/
-#if !defined(ICU_DATA_DIR_WINDOWS)
-// When using the Windows system data, we expect only a single data file.
+#if !defined(ICU_DATA_DIR_WINDOWS)
+// When using the Windows system data, we expect only a single data file.
extern "C" const DataHeader U_DATA_API U_ICUDATA_ENTRY_POINT;
-#endif
+#endif
/*
* This would be a good place for weak-linkage declarations of
@@ -692,8 +692,8 @@ openCommonData(const char *path, /* Path from OpenChoice? */
if(gCommonICUDataArray[commonDataIndex] != NULL) {
return gCommonICUDataArray[commonDataIndex];
}
-#if !defined(ICU_DATA_DIR_WINDOWS)
-// When using the Windows system data, we expect only a single data file.
+#if !defined(ICU_DATA_DIR_WINDOWS)
+// When using the Windows system data, we expect only a single data file.
int32_t i;
for(i = 0; i < commonDataIndex; ++i) {
if(gCommonICUDataArray[i]->pHeader == &U_ICUDATA_ENTRY_POINT) {
@@ -701,7 +701,7 @@ openCommonData(const char *path, /* Path from OpenChoice? */
return NULL;
}
}
-#endif
+#endif
}
/* Add the linked-in data to the list. */
@@ -717,14 +717,14 @@ openCommonData(const char *path, /* Path from OpenChoice? */
setCommonICUDataPointer(uprv_getICUData_conversion(), FALSE, pErrorCode);
}
*/
-#if !defined(ICU_DATA_DIR_WINDOWS)
-// When using the Windows system data, we expect only a single data file.
+#if !defined(ICU_DATA_DIR_WINDOWS)
+// When using the Windows system data, we expect only a single data file.
setCommonICUDataPointer(&U_ICUDATA_ENTRY_POINT, FALSE, pErrorCode);
{
Mutex lock;
return gCommonICUDataArray[commonDataIndex];
}
-#endif
+#endif
}
@@ -763,19 +763,19 @@ openCommonData(const char *path, /* Path from OpenChoice? */
UDataPathIterator iter(u_getDataDirectory(), inBasename, path, ".dat", TRUE, pErrorCode);
- while ((UDataMemory_isLoaded(&tData)==FALSE) && (pathBuffer = iter.next(pErrorCode)) != NULL)
+ while ((UDataMemory_isLoaded(&tData)==FALSE) && (pathBuffer = iter.next(pErrorCode)) != NULL)
{
#ifdef UDATA_DEBUG
fprintf(stderr, "ocd: trying path %s - ", pathBuffer);
#endif
- uprv_mapFile(&tData, pathBuffer, pErrorCode);
+ uprv_mapFile(&tData, pathBuffer, pErrorCode);
#ifdef UDATA_DEBUG
fprintf(stderr, "%s\n", UDataMemory_isLoaded(&tData)?"LOADED":"not loaded");
#endif
}
- if (U_FAILURE(*pErrorCode)) {
- return NULL;
- }
+ if (U_FAILURE(*pErrorCode)) {
+ return NULL;
+ }
#if defined(OS390_STUBDATA) && defined(OS390BATCH)
if (!UDataMemory_isLoaded(&tData)) {
@@ -784,7 +784,7 @@ openCommonData(const char *path, /* Path from OpenChoice? */
uprv_strncpy(ourPathBuffer, path, 1019);
ourPathBuffer[1019]=0;
uprv_strcat(ourPathBuffer, ".dat");
- uprv_mapFile(&tData, ourPathBuffer, pErrorCode);
+ uprv_mapFile(&tData, ourPathBuffer, pErrorCode);
}
#endif
@@ -835,7 +835,7 @@ static UBool extendICUData(UErrorCode *pErr)
* Use a specific mutex to avoid nested locks of the global mutex.
*/
#if MAP_IMPLEMENTATION==MAP_STDIO
- static UMutex extendICUDataMutex;
+ static UMutex extendICUDataMutex;
umtx_lock(&extendICUDataMutex);
#endif
if(!umtx_loadAcquire(gHaveTriedToLoadCommonData)) {
@@ -875,7 +875,7 @@ static UBool extendICUData(UErrorCode *pErr)
umtx_unlock(&extendICUDataMutex);
#endif
return didUpdate; /* Return true if ICUData pointer was updated. */
- /* (Could potentially have been done by another thread racing */
+ /* (Could potentially have been done by another thread racing */
/* us through here, but that's fine, we still return true */
/* so that current thread will also examine extended data. */
}
@@ -1001,12 +1001,12 @@ static UDataMemory *doLoadFromIndividualFiles(const char *pkgName,
/* init path iterator for individual files */
UDataPathIterator iter(dataPath, pkgName, path, tocEntryPathSuffix, FALSE, pErrorCode);
- while ((pathBuffer = iter.next(pErrorCode)) != NULL)
+ while ((pathBuffer = iter.next(pErrorCode)) != NULL)
{
#ifdef UDATA_DEBUG
fprintf(stderr, "UDATA: trying individual file %s\n", pathBuffer);
#endif
- if (uprv_mapFile(&dataMemory, pathBuffer, pErrorCode))
+ if (uprv_mapFile(&dataMemory, pathBuffer, pErrorCode))
{
pEntryData = checkDataItem(dataMemory.pHeader, isAcceptable, context, type, name, subErrorCode, pErrorCode);
if (pEntryData != NULL) {
@@ -1022,7 +1022,7 @@ static UDataMemory *doLoadFromIndividualFiles(const char *pkgName,
return pEntryData;
}
- /* the data is not acceptable, or some error occurred. Either way, unmap the memory */
+ /* the data is not acceptable, or some error occurred. Either way, unmap the memory */
udata_close(&dataMemory);
/* If we had a nasty error, bail out completely. */
@@ -1074,13 +1074,13 @@ static UDataMemory *doLoadFromCommonData(UBool isICUData, const char * /*pkgName
/* look up the data piece in the common data */
pHeader=pCommonData->vFuncs->Lookup(pCommonData, tocEntryName, &length, subErrorCode);
#ifdef UDATA_DEBUG
- fprintf(stderr, "%s: pHeader=%p - %s\n", tocEntryName, (void*) pHeader, u_errorName(*subErrorCode));
+ fprintf(stderr, "%s: pHeader=%p - %s\n", tocEntryName, (void*) pHeader, u_errorName(*subErrorCode));
#endif
if(pHeader!=NULL) {
pEntryData = checkDataItem(pHeader, isAcceptable, context, type, name, subErrorCode, pErrorCode);
#ifdef UDATA_DEBUG
- fprintf(stderr, "pEntryData=%p\n", (void*) pEntryData);
+ fprintf(stderr, "pEntryData=%p\n", (void*) pEntryData);
#endif
if (U_FAILURE(*pErrorCode)) {
return NULL;
@@ -1091,11 +1091,11 @@ static UDataMemory *doLoadFromCommonData(UBool isICUData, const char * /*pkgName
}
}
}
- // If we failed due to being out-of-memory, then stop early and report the error.
- if (*subErrorCode == U_MEMORY_ALLOCATION_ERROR) {
- *pErrorCode = *subErrorCode;
- return NULL;
- }
+ // If we failed due to being out-of-memory, then stop early and report the error.
+ if (*subErrorCode == U_MEMORY_ALLOCATION_ERROR) {
+ *pErrorCode = *subErrorCode;
+ return NULL;
+ }
/* Data wasn't found. If we were looking for an ICUData item and there is
* more data available, load it and try again,
* otherwise break out of this loop. */
@@ -1172,9 +1172,9 @@ doOpenChoice(const char *path, const char *type, const char *name,
UBool isICUData = FALSE;
- FileTracer::traceOpen(path, type, name);
-
-
+ FileTracer::traceOpen(path, type, name);
+
+
/* Is this path ICU data? */
if(path == NULL ||
!strcmp(path, U_ICUDATA_ALIAS) || /* "ICUDATA" */
@@ -1192,7 +1192,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
if(uprv_strchr(path,U_FILE_ALT_SEP_CHAR) != NULL) {
altSepPath.append(path, *pErrorCode);
char *p;
- while ((p = uprv_strchr(altSepPath.data(), U_FILE_ALT_SEP_CHAR)) != NULL) {
+ while ((p = uprv_strchr(altSepPath.data(), U_FILE_ALT_SEP_CHAR)) != NULL) {
*p = U_FILE_SEP_CHAR;
}
#if defined (UDATA_DEBUG)
@@ -1275,22 +1275,22 @@ doOpenChoice(const char *path, const char *type, const char *name,
tocEntryName.append(".", *pErrorCode).append(type, *pErrorCode);
tocEntryPath.append(".", *pErrorCode).append(type, *pErrorCode);
}
- // The +1 is for the U_FILE_SEP_CHAR that is always appended above.
- tocEntryPathSuffix = tocEntryPath.data() + tocEntrySuffixIndex + 1; /* suffix starts here */
+ // The +1 is for the U_FILE_SEP_CHAR that is always appended above.
+ tocEntryPathSuffix = tocEntryPath.data() + tocEntrySuffixIndex + 1; /* suffix starts here */
#ifdef UDATA_DEBUG
fprintf(stderr, " tocEntryName = %s\n", tocEntryName.data());
fprintf(stderr, " tocEntryPath = %s\n", tocEntryName.data());
#endif
-#if !defined(ICU_DATA_DIR_WINDOWS)
+#if !defined(ICU_DATA_DIR_WINDOWS)
if(path == NULL) {
path = COMMON_DATA_NAME; /* "icudt26e" */
}
-#else
- // When using the Windows system data, we expects only a single data file.
- path = COMMON_DATA_NAME; /* "icudt26e" */
-#endif
+#else
+ // When using the Windows system data, we expects only a single data file.
+ path = COMMON_DATA_NAME; /* "icudt26e" */
+#endif
/************************ Begin loop looking for ind. files ***************/
#ifdef UDATA_DEBUG
diff --git a/contrib/libs/icu/common/udatamem.cpp b/contrib/libs/icu/common/udatamem.cpp
index ac2e160709..6bf7c01235 100644
--- a/contrib/libs/icu/common/udatamem.cpp
+++ b/contrib/libs/icu/common/udatamem.cpp
@@ -1,161 +1,161 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 1999-2011, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************/
-
-
-/*----------------------------------------------------------------------------------
- *
- * UDataMemory A class-like struct that serves as a handle to a piece of memory
- * that contains some ICU data (resource, converters, whatever.)
- *
- * When an application opens ICU data (with udata_open, for example,
- * a UDataMemory * is returned.
- *
- *----------------------------------------------------------------------------------*/
-
-#include "unicode/utypes.h"
-#include "cmemory.h"
-#include "unicode/udata.h"
-
-#include "udatamem.h"
-
-U_CFUNC void UDataMemory_init(UDataMemory *This) {
- uprv_memset(This, 0, sizeof(UDataMemory));
- This->length=-1;
-}
-
-
-U_CFUNC void UDatamemory_assign(UDataMemory *dest, UDataMemory *source) {
- /* UDataMemory Assignment. Destination UDataMemory must be initialized first. */
- UBool mallocedFlag = dest->heapAllocated;
- uprv_memcpy(dest, source, sizeof(UDataMemory));
- dest->heapAllocated = mallocedFlag;
-}
-
-U_CFUNC UDataMemory *UDataMemory_createNewInstance(UErrorCode *pErr) {
- UDataMemory *This;
-
- if (U_FAILURE(*pErr)) {
- return NULL;
- }
- This = (UDataMemory *)uprv_malloc(sizeof(UDataMemory));
- if (This == NULL) {
- *pErr = U_MEMORY_ALLOCATION_ERROR; }
- else {
- UDataMemory_init(This);
- This->heapAllocated = TRUE;
- }
- return This;
-}
-
-
-U_CFUNC const DataHeader *
-UDataMemory_normalizeDataPointer(const void *p) {
- /* allow the data to be optionally prepended with an alignment-forcing double value */
- const DataHeader *pdh = (const DataHeader *)p;
- if(pdh==NULL || (pdh->dataHeader.magic1==0xda && pdh->dataHeader.magic2==0x27)) {
- return pdh;
- } else {
-#if U_PLATFORM == U_PF_OS400
- /*
- TODO: Fix this once the compiler implements this feature. Keep in sync with genccode.c
-
- This is here because this platform can't currently put
- const data into the read-only pages of an object or
- shared library (service program). Only strings are allowed in read-only
- pages, so we use char * strings to store the data.
-
- In order to prevent the beginning of the data from ever matching the
- magic numbers we must skip the initial double.
- [grhoten 4/24/2003]
- */
- return (const DataHeader *)*((const void **)p+1);
-#else
- return (const DataHeader *)((const double *)p+1);
-#endif
- }
-}
-
-
-U_CFUNC void UDataMemory_setData (UDataMemory *This, const void *dataAddr) {
- This->pHeader = UDataMemory_normalizeDataPointer(dataAddr);
-}
-
-
-U_CAPI void U_EXPORT2
-udata_close(UDataMemory *pData) {
- if(pData!=NULL) {
- uprv_unmapFile(pData);
- if(pData->heapAllocated ) {
- uprv_free(pData);
- } else {
- UDataMemory_init(pData);
- }
- }
-}
-
-U_CAPI const void * U_EXPORT2
-udata_getMemory(UDataMemory *pData) {
- if(pData!=NULL && pData->pHeader!=NULL) {
- return (char *)(pData->pHeader)+udata_getHeaderSize(pData->pHeader);
- } else {
- return NULL;
- }
-}
-
-/**
- * Get the length of the data item if possible.
- * The length may be up to 15 bytes larger than the actual data.
- *
- * TODO Consider making this function public.
- * It would have to return the actual length in more cases.
- * For example, the length of the last item in a .dat package could be
- * computed from the size of the whole .dat package minus the offset of the
- * last item.
- * The size of a file that was directly memory-mapped could be determined
- * using some system API.
- *
- * In order to get perfect values for all data items, we may have to add a
- * length field to UDataInfo, but that complicates data generation
- * and may be overkill.
- *
- * @param pData The data item.
- * @return the length of the data item, or -1 if not known
- * @internal Currently used only in cintltst/udatatst.c
- */
-U_CAPI int32_t U_EXPORT2
-udata_getLength(const UDataMemory *pData) {
- if(pData!=NULL && pData->pHeader!=NULL && pData->length>=0) {
- /*
- * subtract the header size,
- * return only the size of the actual data starting at udata_getMemory()
- */
- return pData->length-udata_getHeaderSize(pData->pHeader);
- } else {
- return -1;
- }
-}
-
-/**
- * Get the memory including the data header.
- * Used in cintltst/udatatst.c
- * @internal
- */
-U_CAPI const void * U_EXPORT2
-udata_getRawMemory(const UDataMemory *pData) {
- if(pData!=NULL && pData->pHeader!=NULL) {
- return pData->pHeader;
- } else {
- return NULL;
- }
-}
-
-U_CFUNC UBool UDataMemory_isLoaded(const UDataMemory *This) {
- return This->pHeader != NULL;
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 1999-2011, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************/
+
+
+/*----------------------------------------------------------------------------------
+ *
+ * UDataMemory A class-like struct that serves as a handle to a piece of memory
+ * that contains some ICU data (resource, converters, whatever.)
+ *
+ * When an application opens ICU data (with udata_open, for example,
+ * a UDataMemory * is returned.
+ *
+ *----------------------------------------------------------------------------------*/
+
+#include "unicode/utypes.h"
+#include "cmemory.h"
+#include "unicode/udata.h"
+
+#include "udatamem.h"
+
+U_CFUNC void UDataMemory_init(UDataMemory *This) {
+ uprv_memset(This, 0, sizeof(UDataMemory));
+ This->length=-1;
+}
+
+
+U_CFUNC void UDatamemory_assign(UDataMemory *dest, UDataMemory *source) {
+ /* UDataMemory Assignment. Destination UDataMemory must be initialized first. */
+ UBool mallocedFlag = dest->heapAllocated;
+ uprv_memcpy(dest, source, sizeof(UDataMemory));
+ dest->heapAllocated = mallocedFlag;
+}
+
+U_CFUNC UDataMemory *UDataMemory_createNewInstance(UErrorCode *pErr) {
+ UDataMemory *This;
+
+ if (U_FAILURE(*pErr)) {
+ return NULL;
+ }
+ This = (UDataMemory *)uprv_malloc(sizeof(UDataMemory));
+ if (This == NULL) {
+ *pErr = U_MEMORY_ALLOCATION_ERROR; }
+ else {
+ UDataMemory_init(This);
+ This->heapAllocated = TRUE;
+ }
+ return This;
+}
+
+
+U_CFUNC const DataHeader *
+UDataMemory_normalizeDataPointer(const void *p) {
+ /* allow the data to be optionally prepended with an alignment-forcing double value */
+ const DataHeader *pdh = (const DataHeader *)p;
+ if(pdh==NULL || (pdh->dataHeader.magic1==0xda && pdh->dataHeader.magic2==0x27)) {
+ return pdh;
+ } else {
+#if U_PLATFORM == U_PF_OS400
+ /*
+ TODO: Fix this once the compiler implements this feature. Keep in sync with genccode.c
+
+ This is here because this platform can't currently put
+ const data into the read-only pages of an object or
+ shared library (service program). Only strings are allowed in read-only
+ pages, so we use char * strings to store the data.
+
+ In order to prevent the beginning of the data from ever matching the
+ magic numbers we must skip the initial double.
+ [grhoten 4/24/2003]
+ */
+ return (const DataHeader *)*((const void **)p+1);
+#else
+ return (const DataHeader *)((const double *)p+1);
+#endif
+ }
+}
+
+
+U_CFUNC void UDataMemory_setData (UDataMemory *This, const void *dataAddr) {
+ This->pHeader = UDataMemory_normalizeDataPointer(dataAddr);
+}
+
+
+U_CAPI void U_EXPORT2
+udata_close(UDataMemory *pData) {
+ if(pData!=NULL) {
+ uprv_unmapFile(pData);
+ if(pData->heapAllocated ) {
+ uprv_free(pData);
+ } else {
+ UDataMemory_init(pData);
+ }
+ }
+}
+
+U_CAPI const void * U_EXPORT2
+udata_getMemory(UDataMemory *pData) {
+ if(pData!=NULL && pData->pHeader!=NULL) {
+ return (char *)(pData->pHeader)+udata_getHeaderSize(pData->pHeader);
+ } else {
+ return NULL;
+ }
+}
+
+/**
+ * Get the length of the data item if possible.
+ * The length may be up to 15 bytes larger than the actual data.
+ *
+ * TODO Consider making this function public.
+ * It would have to return the actual length in more cases.
+ * For example, the length of the last item in a .dat package could be
+ * computed from the size of the whole .dat package minus the offset of the
+ * last item.
+ * The size of a file that was directly memory-mapped could be determined
+ * using some system API.
+ *
+ * In order to get perfect values for all data items, we may have to add a
+ * length field to UDataInfo, but that complicates data generation
+ * and may be overkill.
+ *
+ * @param pData The data item.
+ * @return the length of the data item, or -1 if not known
+ * @internal Currently used only in cintltst/udatatst.c
+ */
+U_CAPI int32_t U_EXPORT2
+udata_getLength(const UDataMemory *pData) {
+ if(pData!=NULL && pData->pHeader!=NULL && pData->length>=0) {
+ /*
+ * subtract the header size,
+ * return only the size of the actual data starting at udata_getMemory()
+ */
+ return pData->length-udata_getHeaderSize(pData->pHeader);
+ } else {
+ return -1;
+ }
+}
+
+/**
+ * Get the memory including the data header.
+ * Used in cintltst/udatatst.c
+ * @internal
+ */
+U_CAPI const void * U_EXPORT2
+udata_getRawMemory(const UDataMemory *pData) {
+ if(pData!=NULL && pData->pHeader!=NULL) {
+ return pData->pHeader;
+ } else {
+ return NULL;
+ }
+}
+
+U_CFUNC UBool UDataMemory_isLoaded(const UDataMemory *This) {
+ return This->pHeader != NULL;
+}
diff --git a/contrib/libs/icu/common/udatamem.h b/contrib/libs/icu/common/udatamem.h
index 2b08c049e1..a05dd69756 100644
--- a/contrib/libs/icu/common/udatamem.h
+++ b/contrib/libs/icu/common/udatamem.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/common/udataswp.cpp b/contrib/libs/icu/common/udataswp.cpp
index afb6f87070..86f302bd9c 100644
--- a/contrib/libs/icu/common/udataswp.cpp
+++ b/contrib/libs/icu/common/udataswp.cpp
@@ -1,473 +1,473 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-*******************************************************************************
-*
-* Copyright (C) 2003-2014, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-*******************************************************************************
-* file name: udataswp.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 2003jun05
-* created by: Markus W. Scherer
-*
-* Definitions for ICU data transformations for different platforms,
-* changing between big- and little-endian data and/or between
-* charset families (ASCII<->EBCDIC).
-*/
-
-#include <stdarg.h>
-#include "unicode/utypes.h"
-#include "unicode/udata.h" /* UDataInfo */
-#include "ucmndata.h" /* DataHeader */
-#include "cmemory.h"
-#include "udataswp.h"
-
-/* swapping primitives ------------------------------------------------------ */
-
-static int32_t U_CALLCONV
-uprv_swapArray16(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode) {
- const uint16_t *p;
- uint16_t *q;
- int32_t count;
- uint16_t x;
-
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
- if(ds==NULL || inData==NULL || length<0 || (length&1)!=0 || outData==NULL) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* setup and swapping */
- p=(const uint16_t *)inData;
- q=(uint16_t *)outData;
- count=length/2;
- while(count>0) {
- x=*p++;
- *q++=(uint16_t)((x<<8)|(x>>8));
- --count;
- }
-
- return length;
-}
-
-static int32_t U_CALLCONV
-uprv_copyArray16(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode) {
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
- if(ds==NULL || inData==NULL || length<0 || (length&1)!=0 || outData==NULL) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- if(length>0 && inData!=outData) {
- uprv_memcpy(outData, inData, length);
- }
- return length;
-}
-
-static int32_t U_CALLCONV
-uprv_swapArray32(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode) {
- const uint32_t *p;
- uint32_t *q;
- int32_t count;
- uint32_t x;
-
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
- if(ds==NULL || inData==NULL || length<0 || (length&3)!=0 || outData==NULL) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* setup and swapping */
- p=(const uint32_t *)inData;
- q=(uint32_t *)outData;
- count=length/4;
- while(count>0) {
- x=*p++;
- *q++=(uint32_t)((x<<24)|((x<<8)&0xff0000)|((x>>8)&0xff00)|(x>>24));
- --count;
- }
-
- return length;
-}
-
-static int32_t U_CALLCONV
-uprv_copyArray32(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode) {
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
- if(ds==NULL || inData==NULL || length<0 || (length&3)!=0 || outData==NULL) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- if(length>0 && inData!=outData) {
- uprv_memcpy(outData, inData, length);
- }
- return length;
-}
-
-static int32_t U_CALLCONV
-uprv_swapArray64(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode) {
- const uint64_t *p;
- uint64_t *q;
- int32_t count;
-
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
- if(ds==NULL || inData==NULL || length<0 || (length&7)!=0 || outData==NULL) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* setup and swapping */
- p=(const uint64_t *)inData;
- q=(uint64_t *)outData;
- count=length/8;
- while(count>0) {
- uint64_t x=*p++;
- x=(x<<56)|((x&0xff00)<<40)|((x&0xff0000)<<24)|((x&0xff000000)<<8)|
- ((x>>8)&0xff000000)|((x>>24)&0xff0000)|((x>>40)&0xff00)|(x>>56);
- *q++=x;
- --count;
- }
-
- return length;
-}
-
-static int32_t U_CALLCONV
-uprv_copyArray64(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode) {
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
- if(ds==NULL || inData==NULL || length<0 || (length&7)!=0 || outData==NULL) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- if(length>0 && inData!=outData) {
- uprv_memcpy(outData, inData, length);
- }
- return length;
-}
-
-static uint16_t U_CALLCONV
-uprv_readSwapUInt16(uint16_t x) {
- return (uint16_t)((x<<8)|(x>>8));
-}
-
-static uint16_t U_CALLCONV
-uprv_readDirectUInt16(uint16_t x) {
- return x;
-}
-
-static uint32_t U_CALLCONV
-uprv_readSwapUInt32(uint32_t x) {
- return (uint32_t)((x<<24)|((x<<8)&0xff0000)|((x>>8)&0xff00)|(x>>24));
-}
-
-static uint32_t U_CALLCONV
-uprv_readDirectUInt32(uint32_t x) {
- return x;
-}
-
-static void U_CALLCONV
-uprv_writeSwapUInt16(uint16_t *p, uint16_t x) {
- *p=(uint16_t)((x<<8)|(x>>8));
-}
-
-static void U_CALLCONV
-uprv_writeDirectUInt16(uint16_t *p, uint16_t x) {
- *p=x;
-}
-
-static void U_CALLCONV
-uprv_writeSwapUInt32(uint32_t *p, uint32_t x) {
- *p=(uint32_t)((x<<24)|((x<<8)&0xff0000)|((x>>8)&0xff00)|(x>>24));
-}
-
-static void U_CALLCONV
-uprv_writeDirectUInt32(uint32_t *p, uint32_t x) {
- *p=x;
-}
-
-U_CAPI int16_t U_EXPORT2
-udata_readInt16(const UDataSwapper *ds, int16_t x) {
- return (int16_t)ds->readUInt16((uint16_t)x);
-}
-
-U_CAPI int32_t U_EXPORT2
-udata_readInt32(const UDataSwapper *ds, int32_t x) {
- return (int32_t)ds->readUInt32((uint32_t)x);
-}
-
-/**
- * Swap a block of invariant, NUL-terminated strings, but not padding
- * bytes after the last string.
- * @internal
- */
-U_CAPI int32_t U_EXPORT2
-udata_swapInvStringBlock(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode) {
- const char *inChars;
- int32_t stringsLength;
-
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
- if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* reduce the strings length to not include bytes after the last NUL */
- inChars=(const char *)inData;
- stringsLength=length;
- while(stringsLength>0 && inChars[stringsLength-1]!=0) {
- --stringsLength;
- }
-
- /* swap up to the last NUL */
- ds->swapInvChars(ds, inData, stringsLength, outData, pErrorCode);
-
- /* copy the bytes after the last NUL */
- if(inData!=outData && length>stringsLength) {
- uprv_memcpy((char *)outData+stringsLength, inChars+stringsLength, length-stringsLength);
- }
-
- /* return the length including padding bytes */
- if(U_SUCCESS(*pErrorCode)) {
- return length;
- } else {
- return 0;
- }
-}
-
-U_CAPI void U_EXPORT2
-udata_printError(const UDataSwapper *ds,
- const char *fmt,
- ...) {
- va_list args;
-
- if(ds->printError!=NULL) {
- va_start(args, fmt);
- ds->printError(ds->printErrorContext, fmt, args);
- va_end(args);
- }
-}
-
-/* swap a data header ------------------------------------------------------- */
-
-U_CAPI int32_t U_EXPORT2
-udata_swapDataHeader(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode) {
- const DataHeader *pHeader;
- uint16_t headerSize, infoSize;
-
- /* argument checking */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
- if(ds==NULL || inData==NULL || length<-1 || (length>0 && outData==NULL)) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* check minimum length and magic bytes */
- pHeader=(const DataHeader *)inData;
- if( (length>=0 && length<(int32_t)sizeof(DataHeader)) ||
- pHeader->dataHeader.magic1!=0xda ||
- pHeader->dataHeader.magic2!=0x27 ||
- pHeader->info.sizeofUChar!=2
- ) {
- udata_printError(ds, "udata_swapDataHeader(): initial bytes do not look like ICU data\n");
- *pErrorCode=U_UNSUPPORTED_ERROR;
- return 0;
- }
-
- headerSize=ds->readUInt16(pHeader->dataHeader.headerSize);
- infoSize=ds->readUInt16(pHeader->info.size);
-
- if( headerSize<sizeof(DataHeader) ||
- infoSize<sizeof(UDataInfo) ||
- headerSize<(sizeof(pHeader->dataHeader)+infoSize) ||
- (length>=0 && length<headerSize)
- ) {
- udata_printError(ds, "udata_swapDataHeader(): header size mismatch - headerSize %d infoSize %d length %d\n",
- headerSize, infoSize, length);
- *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
- }
-
- if(length>0) {
- DataHeader *outHeader;
- const char *s;
- int32_t maxLength;
-
- /* Most of the fields are just bytes and need no swapping. */
- if(inData!=outData) {
- uprv_memcpy(outData, inData, headerSize);
- }
- outHeader=(DataHeader *)outData;
-
- outHeader->info.isBigEndian = ds->outIsBigEndian;
- outHeader->info.charsetFamily = ds->outCharset;
-
- /* swap headerSize */
- ds->swapArray16(ds, &pHeader->dataHeader.headerSize, 2, &outHeader->dataHeader.headerSize, pErrorCode);
-
- /* swap UDataInfo size and reservedWord */
- ds->swapArray16(ds, &pHeader->info.size, 4, &outHeader->info.size, pErrorCode);
-
- /* swap copyright statement after the UDataInfo */
- infoSize+=sizeof(pHeader->dataHeader);
- s=(const char *)inData+infoSize;
- maxLength=headerSize-infoSize;
- /* get the length of the string */
- for(length=0; length<maxLength && s[length]!=0; ++length) {}
- /* swap the string contents */
- ds->swapInvChars(ds, s, length, (char *)outData+infoSize, pErrorCode);
- }
-
- return headerSize;
-}
-
-/* API functions ------------------------------------------------------------ */
-
-U_CAPI UDataSwapper * U_EXPORT2
-udata_openSwapper(UBool inIsBigEndian, uint8_t inCharset,
- UBool outIsBigEndian, uint8_t outCharset,
- UErrorCode *pErrorCode) {
- UDataSwapper *swapper;
-
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return NULL;
- }
- if(inCharset>U_EBCDIC_FAMILY || outCharset>U_EBCDIC_FAMILY) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
- }
-
- /* allocate the swapper */
- swapper=(UDataSwapper *)uprv_malloc(sizeof(UDataSwapper));
- if(swapper==NULL) {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
- uprv_memset(swapper, 0, sizeof(UDataSwapper));
-
- /* set values and functions pointers according to in/out parameters */
- swapper->inIsBigEndian=inIsBigEndian;
- swapper->inCharset=inCharset;
- swapper->outIsBigEndian=outIsBigEndian;
- swapper->outCharset=outCharset;
-
- swapper->readUInt16= inIsBigEndian==U_IS_BIG_ENDIAN ? uprv_readDirectUInt16 : uprv_readSwapUInt16;
- swapper->readUInt32= inIsBigEndian==U_IS_BIG_ENDIAN ? uprv_readDirectUInt32 : uprv_readSwapUInt32;
-
- swapper->writeUInt16= outIsBigEndian==U_IS_BIG_ENDIAN ? uprv_writeDirectUInt16 : uprv_writeSwapUInt16;
- swapper->writeUInt32= outIsBigEndian==U_IS_BIG_ENDIAN ? uprv_writeDirectUInt32 : uprv_writeSwapUInt32;
-
- swapper->compareInvChars= outCharset==U_ASCII_FAMILY ? uprv_compareInvAscii : uprv_compareInvEbcdic;
-
- if(inIsBigEndian==outIsBigEndian) {
- swapper->swapArray16=uprv_copyArray16;
- swapper->swapArray32=uprv_copyArray32;
- swapper->swapArray64=uprv_copyArray64;
- } else {
- swapper->swapArray16=uprv_swapArray16;
- swapper->swapArray32=uprv_swapArray32;
- swapper->swapArray64=uprv_swapArray64;
- }
-
- if(inCharset==U_ASCII_FAMILY) {
- swapper->swapInvChars= outCharset==U_ASCII_FAMILY ? uprv_copyAscii : uprv_ebcdicFromAscii;
- } else /* U_EBCDIC_FAMILY */ {
- swapper->swapInvChars= outCharset==U_EBCDIC_FAMILY ? uprv_copyEbcdic : uprv_asciiFromEbcdic;
- }
-
- return swapper;
-}
-
-U_CAPI UDataSwapper * U_EXPORT2
-udata_openSwapperForInputData(const void *data, int32_t length,
- UBool outIsBigEndian, uint8_t outCharset,
- UErrorCode *pErrorCode) {
- const DataHeader *pHeader;
- uint16_t headerSize, infoSize;
- UBool inIsBigEndian;
- int8_t inCharset;
-
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return NULL;
- }
- if( data==NULL ||
- (length>=0 && length<(int32_t)sizeof(DataHeader)) ||
- outCharset>U_EBCDIC_FAMILY
- ) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
- }
-
- pHeader=(const DataHeader *)data;
- if( (length>=0 && length<(int32_t)sizeof(DataHeader)) ||
- pHeader->dataHeader.magic1!=0xda ||
- pHeader->dataHeader.magic2!=0x27 ||
- pHeader->info.sizeofUChar!=2
- ) {
- *pErrorCode=U_UNSUPPORTED_ERROR;
- return 0;
- }
-
- inIsBigEndian=(UBool)pHeader->info.isBigEndian;
- inCharset=pHeader->info.charsetFamily;
-
- if(inIsBigEndian==U_IS_BIG_ENDIAN) {
- headerSize=pHeader->dataHeader.headerSize;
- infoSize=pHeader->info.size;
- } else {
- headerSize=uprv_readSwapUInt16(pHeader->dataHeader.headerSize);
- infoSize=uprv_readSwapUInt16(pHeader->info.size);
- }
-
- if( headerSize<sizeof(DataHeader) ||
- infoSize<sizeof(UDataInfo) ||
- headerSize<(sizeof(pHeader->dataHeader)+infoSize) ||
- (length>=0 && length<headerSize)
- ) {
- *pErrorCode=U_UNSUPPORTED_ERROR;
- return 0;
- }
-
- return udata_openSwapper(inIsBigEndian, inCharset, outIsBigEndian, outCharset, pErrorCode);
-}
-
-U_CAPI void U_EXPORT2
-udata_closeSwapper(UDataSwapper *ds) {
- uprv_free(ds);
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+* Copyright (C) 2003-2014, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: udataswp.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2003jun05
+* created by: Markus W. Scherer
+*
+* Definitions for ICU data transformations for different platforms,
+* changing between big- and little-endian data and/or between
+* charset families (ASCII<->EBCDIC).
+*/
+
+#include <stdarg.h>
+#include "unicode/utypes.h"
+#include "unicode/udata.h" /* UDataInfo */
+#include "ucmndata.h" /* DataHeader */
+#include "cmemory.h"
+#include "udataswp.h"
+
+/* swapping primitives ------------------------------------------------------ */
+
+static int32_t U_CALLCONV
+uprv_swapArray16(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode) {
+ const uint16_t *p;
+ uint16_t *q;
+ int32_t count;
+ uint16_t x;
+
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ if(ds==NULL || inData==NULL || length<0 || (length&1)!=0 || outData==NULL) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* setup and swapping */
+ p=(const uint16_t *)inData;
+ q=(uint16_t *)outData;
+ count=length/2;
+ while(count>0) {
+ x=*p++;
+ *q++=(uint16_t)((x<<8)|(x>>8));
+ --count;
+ }
+
+ return length;
+}
+
+static int32_t U_CALLCONV
+uprv_copyArray16(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode) {
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ if(ds==NULL || inData==NULL || length<0 || (length&1)!=0 || outData==NULL) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ if(length>0 && inData!=outData) {
+ uprv_memcpy(outData, inData, length);
+ }
+ return length;
+}
+
+static int32_t U_CALLCONV
+uprv_swapArray32(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode) {
+ const uint32_t *p;
+ uint32_t *q;
+ int32_t count;
+ uint32_t x;
+
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ if(ds==NULL || inData==NULL || length<0 || (length&3)!=0 || outData==NULL) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* setup and swapping */
+ p=(const uint32_t *)inData;
+ q=(uint32_t *)outData;
+ count=length/4;
+ while(count>0) {
+ x=*p++;
+ *q++=(uint32_t)((x<<24)|((x<<8)&0xff0000)|((x>>8)&0xff00)|(x>>24));
+ --count;
+ }
+
+ return length;
+}
+
+static int32_t U_CALLCONV
+uprv_copyArray32(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode) {
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ if(ds==NULL || inData==NULL || length<0 || (length&3)!=0 || outData==NULL) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ if(length>0 && inData!=outData) {
+ uprv_memcpy(outData, inData, length);
+ }
+ return length;
+}
+
+static int32_t U_CALLCONV
+uprv_swapArray64(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode) {
+ const uint64_t *p;
+ uint64_t *q;
+ int32_t count;
+
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ if(ds==NULL || inData==NULL || length<0 || (length&7)!=0 || outData==NULL) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* setup and swapping */
+ p=(const uint64_t *)inData;
+ q=(uint64_t *)outData;
+ count=length/8;
+ while(count>0) {
+ uint64_t x=*p++;
+ x=(x<<56)|((x&0xff00)<<40)|((x&0xff0000)<<24)|((x&0xff000000)<<8)|
+ ((x>>8)&0xff000000)|((x>>24)&0xff0000)|((x>>40)&0xff00)|(x>>56);
+ *q++=x;
+ --count;
+ }
+
+ return length;
+}
+
+static int32_t U_CALLCONV
+uprv_copyArray64(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode) {
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ if(ds==NULL || inData==NULL || length<0 || (length&7)!=0 || outData==NULL) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ if(length>0 && inData!=outData) {
+ uprv_memcpy(outData, inData, length);
+ }
+ return length;
+}
+
+static uint16_t U_CALLCONV
+uprv_readSwapUInt16(uint16_t x) {
+ return (uint16_t)((x<<8)|(x>>8));
+}
+
+static uint16_t U_CALLCONV
+uprv_readDirectUInt16(uint16_t x) {
+ return x;
+}
+
+static uint32_t U_CALLCONV
+uprv_readSwapUInt32(uint32_t x) {
+ return (uint32_t)((x<<24)|((x<<8)&0xff0000)|((x>>8)&0xff00)|(x>>24));
+}
+
+static uint32_t U_CALLCONV
+uprv_readDirectUInt32(uint32_t x) {
+ return x;
+}
+
+static void U_CALLCONV
+uprv_writeSwapUInt16(uint16_t *p, uint16_t x) {
+ *p=(uint16_t)((x<<8)|(x>>8));
+}
+
+static void U_CALLCONV
+uprv_writeDirectUInt16(uint16_t *p, uint16_t x) {
+ *p=x;
+}
+
+static void U_CALLCONV
+uprv_writeSwapUInt32(uint32_t *p, uint32_t x) {
+ *p=(uint32_t)((x<<24)|((x<<8)&0xff0000)|((x>>8)&0xff00)|(x>>24));
+}
+
+static void U_CALLCONV
+uprv_writeDirectUInt32(uint32_t *p, uint32_t x) {
+ *p=x;
+}
+
+U_CAPI int16_t U_EXPORT2
+udata_readInt16(const UDataSwapper *ds, int16_t x) {
+ return (int16_t)ds->readUInt16((uint16_t)x);
+}
+
+U_CAPI int32_t U_EXPORT2
+udata_readInt32(const UDataSwapper *ds, int32_t x) {
+ return (int32_t)ds->readUInt32((uint32_t)x);
+}
+
+/**
+ * Swap a block of invariant, NUL-terminated strings, but not padding
+ * bytes after the last string.
+ * @internal
+ */
+U_CAPI int32_t U_EXPORT2
+udata_swapInvStringBlock(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode) {
+ const char *inChars;
+ int32_t stringsLength;
+
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* reduce the strings length to not include bytes after the last NUL */
+ inChars=(const char *)inData;
+ stringsLength=length;
+ while(stringsLength>0 && inChars[stringsLength-1]!=0) {
+ --stringsLength;
+ }
+
+ /* swap up to the last NUL */
+ ds->swapInvChars(ds, inData, stringsLength, outData, pErrorCode);
+
+ /* copy the bytes after the last NUL */
+ if(inData!=outData && length>stringsLength) {
+ uprv_memcpy((char *)outData+stringsLength, inChars+stringsLength, length-stringsLength);
+ }
+
+ /* return the length including padding bytes */
+ if(U_SUCCESS(*pErrorCode)) {
+ return length;
+ } else {
+ return 0;
+ }
+}
+
+U_CAPI void U_EXPORT2
+udata_printError(const UDataSwapper *ds,
+ const char *fmt,
+ ...) {
+ va_list args;
+
+ if(ds->printError!=NULL) {
+ va_start(args, fmt);
+ ds->printError(ds->printErrorContext, fmt, args);
+ va_end(args);
+ }
+}
+
+/* swap a data header ------------------------------------------------------- */
+
+U_CAPI int32_t U_EXPORT2
+udata_swapDataHeader(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode) {
+ const DataHeader *pHeader;
+ uint16_t headerSize, infoSize;
+
+ /* argument checking */
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ if(ds==NULL || inData==NULL || length<-1 || (length>0 && outData==NULL)) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* check minimum length and magic bytes */
+ pHeader=(const DataHeader *)inData;
+ if( (length>=0 && length<(int32_t)sizeof(DataHeader)) ||
+ pHeader->dataHeader.magic1!=0xda ||
+ pHeader->dataHeader.magic2!=0x27 ||
+ pHeader->info.sizeofUChar!=2
+ ) {
+ udata_printError(ds, "udata_swapDataHeader(): initial bytes do not look like ICU data\n");
+ *pErrorCode=U_UNSUPPORTED_ERROR;
+ return 0;
+ }
+
+ headerSize=ds->readUInt16(pHeader->dataHeader.headerSize);
+ infoSize=ds->readUInt16(pHeader->info.size);
+
+ if( headerSize<sizeof(DataHeader) ||
+ infoSize<sizeof(UDataInfo) ||
+ headerSize<(sizeof(pHeader->dataHeader)+infoSize) ||
+ (length>=0 && length<headerSize)
+ ) {
+ udata_printError(ds, "udata_swapDataHeader(): header size mismatch - headerSize %d infoSize %d length %d\n",
+ headerSize, infoSize, length);
+ *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
+ }
+
+ if(length>0) {
+ DataHeader *outHeader;
+ const char *s;
+ int32_t maxLength;
+
+ /* Most of the fields are just bytes and need no swapping. */
+ if(inData!=outData) {
+ uprv_memcpy(outData, inData, headerSize);
+ }
+ outHeader=(DataHeader *)outData;
+
+ outHeader->info.isBigEndian = ds->outIsBigEndian;
+ outHeader->info.charsetFamily = ds->outCharset;
+
+ /* swap headerSize */
+ ds->swapArray16(ds, &pHeader->dataHeader.headerSize, 2, &outHeader->dataHeader.headerSize, pErrorCode);
+
+ /* swap UDataInfo size and reservedWord */
+ ds->swapArray16(ds, &pHeader->info.size, 4, &outHeader->info.size, pErrorCode);
+
+ /* swap copyright statement after the UDataInfo */
+ infoSize+=sizeof(pHeader->dataHeader);
+ s=(const char *)inData+infoSize;
+ maxLength=headerSize-infoSize;
+ /* get the length of the string */
+ for(length=0; length<maxLength && s[length]!=0; ++length) {}
+ /* swap the string contents */
+ ds->swapInvChars(ds, s, length, (char *)outData+infoSize, pErrorCode);
+ }
+
+ return headerSize;
+}
+
+/* API functions ------------------------------------------------------------ */
+
+U_CAPI UDataSwapper * U_EXPORT2
+udata_openSwapper(UBool inIsBigEndian, uint8_t inCharset,
+ UBool outIsBigEndian, uint8_t outCharset,
+ UErrorCode *pErrorCode) {
+ UDataSwapper *swapper;
+
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return NULL;
+ }
+ if(inCharset>U_EBCDIC_FAMILY || outCharset>U_EBCDIC_FAMILY) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
+ }
+
+ /* allocate the swapper */
+ swapper=(UDataSwapper *)uprv_malloc(sizeof(UDataSwapper));
+ if(swapper==NULL) {
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+ uprv_memset(swapper, 0, sizeof(UDataSwapper));
+
+ /* set values and functions pointers according to in/out parameters */
+ swapper->inIsBigEndian=inIsBigEndian;
+ swapper->inCharset=inCharset;
+ swapper->outIsBigEndian=outIsBigEndian;
+ swapper->outCharset=outCharset;
+
+ swapper->readUInt16= inIsBigEndian==U_IS_BIG_ENDIAN ? uprv_readDirectUInt16 : uprv_readSwapUInt16;
+ swapper->readUInt32= inIsBigEndian==U_IS_BIG_ENDIAN ? uprv_readDirectUInt32 : uprv_readSwapUInt32;
+
+ swapper->writeUInt16= outIsBigEndian==U_IS_BIG_ENDIAN ? uprv_writeDirectUInt16 : uprv_writeSwapUInt16;
+ swapper->writeUInt32= outIsBigEndian==U_IS_BIG_ENDIAN ? uprv_writeDirectUInt32 : uprv_writeSwapUInt32;
+
+ swapper->compareInvChars= outCharset==U_ASCII_FAMILY ? uprv_compareInvAscii : uprv_compareInvEbcdic;
+
+ if(inIsBigEndian==outIsBigEndian) {
+ swapper->swapArray16=uprv_copyArray16;
+ swapper->swapArray32=uprv_copyArray32;
+ swapper->swapArray64=uprv_copyArray64;
+ } else {
+ swapper->swapArray16=uprv_swapArray16;
+ swapper->swapArray32=uprv_swapArray32;
+ swapper->swapArray64=uprv_swapArray64;
+ }
+
+ if(inCharset==U_ASCII_FAMILY) {
+ swapper->swapInvChars= outCharset==U_ASCII_FAMILY ? uprv_copyAscii : uprv_ebcdicFromAscii;
+ } else /* U_EBCDIC_FAMILY */ {
+ swapper->swapInvChars= outCharset==U_EBCDIC_FAMILY ? uprv_copyEbcdic : uprv_asciiFromEbcdic;
+ }
+
+ return swapper;
+}
+
+U_CAPI UDataSwapper * U_EXPORT2
+udata_openSwapperForInputData(const void *data, int32_t length,
+ UBool outIsBigEndian, uint8_t outCharset,
+ UErrorCode *pErrorCode) {
+ const DataHeader *pHeader;
+ uint16_t headerSize, infoSize;
+ UBool inIsBigEndian;
+ int8_t inCharset;
+
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return NULL;
+ }
+ if( data==NULL ||
+ (length>=0 && length<(int32_t)sizeof(DataHeader)) ||
+ outCharset>U_EBCDIC_FAMILY
+ ) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
+ }
+
+ pHeader=(const DataHeader *)data;
+ if( (length>=0 && length<(int32_t)sizeof(DataHeader)) ||
+ pHeader->dataHeader.magic1!=0xda ||
+ pHeader->dataHeader.magic2!=0x27 ||
+ pHeader->info.sizeofUChar!=2
+ ) {
+ *pErrorCode=U_UNSUPPORTED_ERROR;
+ return 0;
+ }
+
+ inIsBigEndian=(UBool)pHeader->info.isBigEndian;
+ inCharset=pHeader->info.charsetFamily;
+
+ if(inIsBigEndian==U_IS_BIG_ENDIAN) {
+ headerSize=pHeader->dataHeader.headerSize;
+ infoSize=pHeader->info.size;
+ } else {
+ headerSize=uprv_readSwapUInt16(pHeader->dataHeader.headerSize);
+ infoSize=uprv_readSwapUInt16(pHeader->info.size);
+ }
+
+ if( headerSize<sizeof(DataHeader) ||
+ infoSize<sizeof(UDataInfo) ||
+ headerSize<(sizeof(pHeader->dataHeader)+infoSize) ||
+ (length>=0 && length<headerSize)
+ ) {
+ *pErrorCode=U_UNSUPPORTED_ERROR;
+ return 0;
+ }
+
+ return udata_openSwapper(inIsBigEndian, inCharset, outIsBigEndian, outCharset, pErrorCode);
+}
+
+U_CAPI void U_EXPORT2
+udata_closeSwapper(UDataSwapper *ds) {
+ uprv_free(ds);
+}
diff --git a/contrib/libs/icu/common/udataswp.h b/contrib/libs/icu/common/udataswp.h
index 9d254e096b..5e7b043c4c 100644
--- a/contrib/libs/icu/common/udataswp.h
+++ b/contrib/libs/icu/common/udataswp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: udataswp.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -333,44 +333,44 @@ uprv_compareInvEbcdic(const UDataSwapper *ds,
# error Unknown charset family!
#endif
-// utrie_swap.cpp -----------------------------------------------------------***
-
-/**
- * Swaps a serialized UTrie.
- * @internal
- */
-U_CAPI int32_t U_EXPORT2
-utrie_swap(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode);
-
-/**
- * Swaps a serialized UTrie2.
- * @internal
- */
-U_CAPI int32_t U_EXPORT2
-utrie2_swap(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode);
-
-/**
- * Swaps a serialized UCPTrie.
- * @internal
- */
-U_CAPI int32_t U_EXPORT2
-ucptrie_swap(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode);
-
-/**
- * Swaps a serialized UTrie, UTrie2, or UCPTrie.
- * @internal
- */
-U_CAPI int32_t U_EXPORT2
-utrie_swapAnyVersion(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode);
-
+// utrie_swap.cpp -----------------------------------------------------------***
+
+/**
+ * Swaps a serialized UTrie.
+ * @internal
+ */
+U_CAPI int32_t U_EXPORT2
+utrie_swap(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode);
+
+/**
+ * Swaps a serialized UTrie2.
+ * @internal
+ */
+U_CAPI int32_t U_EXPORT2
+utrie2_swap(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode);
+
+/**
+ * Swaps a serialized UCPTrie.
+ * @internal
+ */
+U_CAPI int32_t U_EXPORT2
+ucptrie_swap(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode);
+
+/**
+ * Swaps a serialized UTrie, UTrie2, or UCPTrie.
+ * @internal
+ */
+U_CAPI int32_t U_EXPORT2
+utrie_swapAnyVersion(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode);
+
/* material... -------------------------------------------------------------- */
#if 0
diff --git a/contrib/libs/icu/common/uelement.h b/contrib/libs/icu/common/uelement.h
index 6ea17918a3..05f36a0982 100644
--- a/contrib/libs/icu/common/uelement.h
+++ b/contrib/libs/icu/common/uelement.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: uelement.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/uenum.cpp b/contrib/libs/icu/common/uenum.cpp
index c8af245939..11d895ebcd 100644
--- a/contrib/libs/icu/common/uenum.cpp
+++ b/contrib/libs/icu/common/uenum.cpp
@@ -1,189 +1,189 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-*******************************************************************************
-*
-* Copyright (C) 2002-2012, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-*******************************************************************************
-* file name: uenum.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:2
-*
-* created on: 2002jul08
-* created by: Vladimir Weinstein
-*/
-
-#include "unicode/putil.h"
-#include "uenumimp.h"
-#include "cmemory.h"
-
-/* Layout of the baseContext buffer. */
-typedef struct {
- int32_t len; /* number of bytes available starting at 'data' */
- char data; /* actual data starts here */
-} _UEnumBuffer;
-
-/* Extra bytes to allocate in the baseContext buffer. */
-static const int32_t PAD = 8;
-
-/* Return a pointer to the baseContext buffer, possibly allocating
- or reallocating it if at least 'capacity' bytes are not available. */
-static void* _getBuffer(UEnumeration* en, int32_t capacity) {
-
- if (en->baseContext != NULL) {
- if (((_UEnumBuffer*) en->baseContext)->len < capacity) {
- capacity += PAD;
- en->baseContext = uprv_realloc(en->baseContext,
- sizeof(int32_t) + capacity);
- if (en->baseContext == NULL) {
- return NULL;
- }
- ((_UEnumBuffer*) en->baseContext)->len = capacity;
- }
- } else {
- capacity += PAD;
- en->baseContext = uprv_malloc(sizeof(int32_t) + capacity);
- if (en->baseContext == NULL) {
- return NULL;
- }
- ((_UEnumBuffer*) en->baseContext)->len = capacity;
- }
-
- return (void*) & ((_UEnumBuffer*) en->baseContext)->data;
-}
-
-U_CAPI void U_EXPORT2
-uenum_close(UEnumeration* en)
-{
- if (en) {
- if (en->close != NULL) {
- if (en->baseContext) {
- uprv_free(en->baseContext);
- }
- en->close(en);
- } else { /* this seems dangerous, but we better kill the object */
- uprv_free(en);
- }
- }
-}
-
-U_CAPI int32_t U_EXPORT2
-uenum_count(UEnumeration* en, UErrorCode* status)
-{
- if (!en || U_FAILURE(*status)) {
- return -1;
- }
- if (en->count != NULL) {
- return en->count(en, status);
- } else {
- *status = U_UNSUPPORTED_ERROR;
- return -1;
- }
-}
-
-/* Don't call this directly. Only uenum_unext should be calling this. */
-U_CAPI const UChar* U_EXPORT2
-uenum_unextDefault(UEnumeration* en,
- int32_t* resultLength,
- UErrorCode* status)
-{
- UChar *ustr = NULL;
- int32_t len = 0;
- if (en->next != NULL) {
- const char *cstr = en->next(en, &len, status);
- if (cstr != NULL) {
- ustr = (UChar*) _getBuffer(en, (len+1) * sizeof(UChar));
- if (ustr == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- } else {
- u_charsToUChars(cstr, ustr, len+1);
- }
- }
- } else {
- *status = U_UNSUPPORTED_ERROR;
- }
- if (resultLength) {
- *resultLength = len;
- }
- return ustr;
-}
-
-/* Don't call this directly. Only uenum_next should be calling this. */
-U_CAPI const char* U_EXPORT2
-uenum_nextDefault(UEnumeration* en,
- int32_t* resultLength,
- UErrorCode* status)
-{
- if (en->uNext != NULL) {
- char *tempCharVal;
- const UChar *tempUCharVal = en->uNext(en, resultLength, status);
- if (tempUCharVal == NULL) {
- return NULL;
- }
- tempCharVal = (char*)
- _getBuffer(en, (*resultLength+1) * sizeof(char));
- if (!tempCharVal) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
- u_UCharsToChars(tempUCharVal, tempCharVal, *resultLength + 1);
- return tempCharVal;
- } else {
- *status = U_UNSUPPORTED_ERROR;
- return NULL;
- }
-}
-
-U_CAPI const UChar* U_EXPORT2
-uenum_unext(UEnumeration* en,
- int32_t* resultLength,
- UErrorCode* status)
-{
- if (!en || U_FAILURE(*status)) {
- return NULL;
- }
- if (en->uNext != NULL) {
- return en->uNext(en, resultLength, status);
- } else {
- *status = U_UNSUPPORTED_ERROR;
- return NULL;
- }
-}
-
-U_CAPI const char* U_EXPORT2
-uenum_next(UEnumeration* en,
- int32_t* resultLength,
- UErrorCode* status)
-{
- if (!en || U_FAILURE(*status)) {
- return NULL;
- }
- if (en->next != NULL) {
- if (resultLength != NULL) {
- return en->next(en, resultLength, status);
- }
- else {
- int32_t dummyLength=0;
- return en->next(en, &dummyLength, status);
- }
- } else {
- *status = U_UNSUPPORTED_ERROR;
- return NULL;
- }
-}
-
-U_CAPI void U_EXPORT2
-uenum_reset(UEnumeration* en, UErrorCode* status)
-{
- if (!en || U_FAILURE(*status)) {
- return;
- }
- if (en->reset != NULL) {
- en->reset(en, status);
- } else {
- *status = U_UNSUPPORTED_ERROR;
- }
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+* Copyright (C) 2002-2012, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: uenum.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:2
+*
+* created on: 2002jul08
+* created by: Vladimir Weinstein
+*/
+
+#include "unicode/putil.h"
+#include "uenumimp.h"
+#include "cmemory.h"
+
+/* Layout of the baseContext buffer. */
+typedef struct {
+ int32_t len; /* number of bytes available starting at 'data' */
+ char data; /* actual data starts here */
+} _UEnumBuffer;
+
+/* Extra bytes to allocate in the baseContext buffer. */
+static const int32_t PAD = 8;
+
+/* Return a pointer to the baseContext buffer, possibly allocating
+ or reallocating it if at least 'capacity' bytes are not available. */
+static void* _getBuffer(UEnumeration* en, int32_t capacity) {
+
+ if (en->baseContext != NULL) {
+ if (((_UEnumBuffer*) en->baseContext)->len < capacity) {
+ capacity += PAD;
+ en->baseContext = uprv_realloc(en->baseContext,
+ sizeof(int32_t) + capacity);
+ if (en->baseContext == NULL) {
+ return NULL;
+ }
+ ((_UEnumBuffer*) en->baseContext)->len = capacity;
+ }
+ } else {
+ capacity += PAD;
+ en->baseContext = uprv_malloc(sizeof(int32_t) + capacity);
+ if (en->baseContext == NULL) {
+ return NULL;
+ }
+ ((_UEnumBuffer*) en->baseContext)->len = capacity;
+ }
+
+ return (void*) & ((_UEnumBuffer*) en->baseContext)->data;
+}
+
+U_CAPI void U_EXPORT2
+uenum_close(UEnumeration* en)
+{
+ if (en) {
+ if (en->close != NULL) {
+ if (en->baseContext) {
+ uprv_free(en->baseContext);
+ }
+ en->close(en);
+ } else { /* this seems dangerous, but we better kill the object */
+ uprv_free(en);
+ }
+ }
+}
+
+U_CAPI int32_t U_EXPORT2
+uenum_count(UEnumeration* en, UErrorCode* status)
+{
+ if (!en || U_FAILURE(*status)) {
+ return -1;
+ }
+ if (en->count != NULL) {
+ return en->count(en, status);
+ } else {
+ *status = U_UNSUPPORTED_ERROR;
+ return -1;
+ }
+}
+
+/* Don't call this directly. Only uenum_unext should be calling this. */
+U_CAPI const UChar* U_EXPORT2
+uenum_unextDefault(UEnumeration* en,
+ int32_t* resultLength,
+ UErrorCode* status)
+{
+ UChar *ustr = NULL;
+ int32_t len = 0;
+ if (en->next != NULL) {
+ const char *cstr = en->next(en, &len, status);
+ if (cstr != NULL) {
+ ustr = (UChar*) _getBuffer(en, (len+1) * sizeof(UChar));
+ if (ustr == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ } else {
+ u_charsToUChars(cstr, ustr, len+1);
+ }
+ }
+ } else {
+ *status = U_UNSUPPORTED_ERROR;
+ }
+ if (resultLength) {
+ *resultLength = len;
+ }
+ return ustr;
+}
+
+/* Don't call this directly. Only uenum_next should be calling this. */
+U_CAPI const char* U_EXPORT2
+uenum_nextDefault(UEnumeration* en,
+ int32_t* resultLength,
+ UErrorCode* status)
+{
+ if (en->uNext != NULL) {
+ char *tempCharVal;
+ const UChar *tempUCharVal = en->uNext(en, resultLength, status);
+ if (tempUCharVal == NULL) {
+ return NULL;
+ }
+ tempCharVal = (char*)
+ _getBuffer(en, (*resultLength+1) * sizeof(char));
+ if (!tempCharVal) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+ u_UCharsToChars(tempUCharVal, tempCharVal, *resultLength + 1);
+ return tempCharVal;
+ } else {
+ *status = U_UNSUPPORTED_ERROR;
+ return NULL;
+ }
+}
+
+U_CAPI const UChar* U_EXPORT2
+uenum_unext(UEnumeration* en,
+ int32_t* resultLength,
+ UErrorCode* status)
+{
+ if (!en || U_FAILURE(*status)) {
+ return NULL;
+ }
+ if (en->uNext != NULL) {
+ return en->uNext(en, resultLength, status);
+ } else {
+ *status = U_UNSUPPORTED_ERROR;
+ return NULL;
+ }
+}
+
+U_CAPI const char* U_EXPORT2
+uenum_next(UEnumeration* en,
+ int32_t* resultLength,
+ UErrorCode* status)
+{
+ if (!en || U_FAILURE(*status)) {
+ return NULL;
+ }
+ if (en->next != NULL) {
+ if (resultLength != NULL) {
+ return en->next(en, resultLength, status);
+ }
+ else {
+ int32_t dummyLength=0;
+ return en->next(en, &dummyLength, status);
+ }
+ } else {
+ *status = U_UNSUPPORTED_ERROR;
+ return NULL;
+ }
+}
+
+U_CAPI void U_EXPORT2
+uenum_reset(UEnumeration* en, UErrorCode* status)
+{
+ if (!en || U_FAILURE(*status)) {
+ return;
+ }
+ if (en->reset != NULL) {
+ en->reset(en, status);
+ } else {
+ *status = U_UNSUPPORTED_ERROR;
+ }
+}
diff --git a/contrib/libs/icu/common/uenumimp.h b/contrib/libs/icu/common/uenumimp.h
index 31be0f1d06..9c9df75ae0 100644
--- a/contrib/libs/icu/common/uenumimp.h
+++ b/contrib/libs/icu/common/uenumimp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: uenumimp.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:2
*
diff --git a/contrib/libs/icu/common/uhash.cpp b/contrib/libs/icu/common/uhash.cpp
index 16c4f2dc21..86311ceb0b 100644
--- a/contrib/libs/icu/common/uhash.cpp
+++ b/contrib/libs/icu/common/uhash.cpp
@@ -1,991 +1,991 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-* Copyright (C) 1997-2016, International Business Machines
-* Corporation and others. All Rights Reserved.
-******************************************************************************
-* Date Name Description
-* 03/22/00 aliu Adapted from original C++ ICU Hashtable.
-* 07/06/01 aliu Modified to support int32_t keys on
-* platforms with sizeof(void*) < 32.
-******************************************************************************
-*/
-
-#include "uhash.h"
-#include "unicode/ustring.h"
-#include "cstring.h"
-#include "cmemory.h"
-#include "uassert.h"
-#include "ustr_imp.h"
-
-/* This hashtable is implemented as a double hash. All elements are
- * stored in a single array with no secondary storage for collision
- * resolution (no linked list, etc.). When there is a hash collision
- * (when two unequal keys have the same hashcode) we resolve this by
- * using a secondary hash. The secondary hash is an increment
- * computed as a hash function (a different one) of the primary
- * hashcode. This increment is added to the initial hash value to
- * obtain further slots assigned to the same hash code. For this to
- * work, the length of the array and the increment must be relatively
- * prime. The easiest way to achieve this is to have the length of
- * the array be prime, and the increment be any value from
- * 1..length-1.
- *
- * Hashcodes are 32-bit integers. We make sure all hashcodes are
- * non-negative by masking off the top bit. This has two effects: (1)
- * modulo arithmetic is simplified. If we allowed negative hashcodes,
- * then when we computed hashcode % length, we could get a negative
- * result, which we would then have to adjust back into range. It's
- * simpler to just make hashcodes non-negative. (2) It makes it easy
- * to check for empty vs. occupied slots in the table. We just mark
- * empty or deleted slots with a negative hashcode.
- *
- * The central function is _uhash_find(). This function looks for a
- * slot matching the given key and hashcode. If one is found, it
- * returns a pointer to that slot. If the table is full, and no match
- * is found, it returns NULL -- in theory. This would make the code
- * more complicated, since all callers of _uhash_find() would then
- * have to check for a NULL result. To keep this from happening, we
- * don't allow the table to fill. When there is only one
- * empty/deleted slot left, uhash_put() will refuse to increase the
- * count, and fail. This simplifies the code. In practice, one will
- * seldom encounter this using default UHashtables. However, if a
- * hashtable is set to a U_FIXED resize policy, or if memory is
- * exhausted, then the table may fill.
- *
- * High and low water ratios control rehashing. They establish levels
- * of fullness (from 0 to 1) outside of which the data array is
- * reallocated and repopulated. Setting the low water ratio to zero
- * means the table will never shrink. Setting the high water ratio to
- * one means the table will never grow. The ratios should be
- * coordinated with the ratio between successive elements of the
- * PRIMES table, so that when the primeIndex is incremented or
- * decremented during rehashing, it brings the ratio of count / length
- * back into the desired range (between low and high water ratios).
- */
-
-/********************************************************************
- * PRIVATE Constants, Macros
- ********************************************************************/
-
-/* This is a list of non-consecutive primes chosen such that
- * PRIMES[i+1] ~ 2*PRIMES[i]. (Currently, the ratio ranges from 1.81
- * to 2.18; the inverse ratio ranges from 0.459 to 0.552.) If this
- * ratio is changed, the low and high water ratios should also be
- * adjusted to suit.
- *
- * These prime numbers were also chosen so that they are the largest
- * prime number while being less than a power of two.
- */
-static const int32_t PRIMES[] = {
- 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749,
- 65521, 131071, 262139, 524287, 1048573, 2097143, 4194301, 8388593,
- 16777213, 33554393, 67108859, 134217689, 268435399, 536870909,
- 1073741789, 2147483647 /*, 4294967291 */
-};
-
-#define PRIMES_LENGTH UPRV_LENGTHOF(PRIMES)
-#define DEFAULT_PRIME_INDEX 4
-
-/* These ratios are tuned to the PRIMES array such that a resize
- * places the table back into the zone of non-resizing. That is,
- * after a call to _uhash_rehash(), a subsequent call to
- * _uhash_rehash() should do nothing (should not churn). This is only
- * a potential problem with U_GROW_AND_SHRINK.
- */
-static const float RESIZE_POLICY_RATIO_TABLE[6] = {
- /* low, high water ratio */
- 0.0F, 0.5F, /* U_GROW: Grow on demand, do not shrink */
- 0.1F, 0.5F, /* U_GROW_AND_SHRINK: Grow and shrink on demand */
- 0.0F, 1.0F /* U_FIXED: Never change size */
-};
-
-/*
- Invariants for hashcode values:
-
- * DELETED < 0
- * EMPTY < 0
- * Real hashes >= 0
-
- Hashcodes may not start out this way, but internally they are
- adjusted so that they are always positive. We assume 32-bit
- hashcodes; adjust these constants for other hashcode sizes.
-*/
-#define HASH_DELETED ((int32_t) 0x80000000)
-#define HASH_EMPTY ((int32_t) HASH_DELETED + 1)
-
-#define IS_EMPTY_OR_DELETED(x) ((x) < 0)
-
-/* This macro expects a UHashTok.pointer as its keypointer and
- valuepointer parameters */
-#define HASH_DELETE_KEY_VALUE(hash, keypointer, valuepointer) UPRV_BLOCK_MACRO_BEGIN { \
- if (hash->keyDeleter != NULL && keypointer != NULL) { \
- (*hash->keyDeleter)(keypointer); \
- } \
- if (hash->valueDeleter != NULL && valuepointer != NULL) { \
- (*hash->valueDeleter)(valuepointer); \
- } \
-} UPRV_BLOCK_MACRO_END
-
-/*
- * Constants for hinting whether a key or value is an integer
- * or a pointer. If a hint bit is zero, then the associated
- * token is assumed to be an integer.
- */
-#define HINT_KEY_POINTER (1)
-#define HINT_VALUE_POINTER (2)
-
-/********************************************************************
- * PRIVATE Implementation
- ********************************************************************/
-
-static UHashTok
-_uhash_setElement(UHashtable *hash, UHashElement* e,
- int32_t hashcode,
- UHashTok key, UHashTok value, int8_t hint) {
-
- UHashTok oldValue = e->value;
- if (hash->keyDeleter != NULL && e->key.pointer != NULL &&
- e->key.pointer != key.pointer) { /* Avoid double deletion */
- (*hash->keyDeleter)(e->key.pointer);
- }
- if (hash->valueDeleter != NULL) {
- if (oldValue.pointer != NULL &&
- oldValue.pointer != value.pointer) { /* Avoid double deletion */
- (*hash->valueDeleter)(oldValue.pointer);
- }
- oldValue.pointer = NULL;
- }
- /* Compilers should copy the UHashTok union correctly, but even if
- * they do, memory heap tools (e.g. BoundsChecker) can get
- * confused when a pointer is cloaked in a union and then copied.
- * TO ALLEVIATE THIS, we use hints (based on what API the user is
- * calling) to copy pointers when we know the user thinks
- * something is a pointer. */
- if (hint & HINT_KEY_POINTER) {
- e->key.pointer = key.pointer;
- } else {
- e->key = key;
- }
- if (hint & HINT_VALUE_POINTER) {
- e->value.pointer = value.pointer;
- } else {
- e->value = value;
- }
- e->hashcode = hashcode;
- return oldValue;
-}
-
-/**
- * Assumes that the given element is not empty or deleted.
- */
-static UHashTok
-_uhash_internalRemoveElement(UHashtable *hash, UHashElement* e) {
- UHashTok empty;
- U_ASSERT(!IS_EMPTY_OR_DELETED(e->hashcode));
- --hash->count;
- empty.pointer = NULL; empty.integer = 0;
- return _uhash_setElement(hash, e, HASH_DELETED, empty, empty, 0);
-}
-
-static void
-_uhash_internalSetResizePolicy(UHashtable *hash, enum UHashResizePolicy policy) {
- U_ASSERT(hash != NULL);
- U_ASSERT(((int32_t)policy) >= 0);
- U_ASSERT(((int32_t)policy) < 3);
- hash->lowWaterRatio = RESIZE_POLICY_RATIO_TABLE[policy * 2];
- hash->highWaterRatio = RESIZE_POLICY_RATIO_TABLE[policy * 2 + 1];
-}
-
-/**
- * Allocate internal data array of a size determined by the given
- * prime index. If the index is out of range it is pinned into range.
- * If the allocation fails the status is set to
- * U_MEMORY_ALLOCATION_ERROR and all array storage is freed. In
- * either case the previous array pointer is overwritten.
- *
- * Caller must ensure primeIndex is in range 0..PRIME_LENGTH-1.
- */
-static void
-_uhash_allocate(UHashtable *hash,
- int32_t primeIndex,
- UErrorCode *status) {
-
- UHashElement *p, *limit;
- UHashTok emptytok;
-
- if (U_FAILURE(*status)) return;
-
- U_ASSERT(primeIndex >= 0 && primeIndex < PRIMES_LENGTH);
-
- hash->primeIndex = static_cast<int8_t>(primeIndex);
- hash->length = PRIMES[primeIndex];
-
- p = hash->elements = (UHashElement*)
- uprv_malloc(sizeof(UHashElement) * hash->length);
-
- if (hash->elements == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
-
- emptytok.pointer = NULL; /* Only one of these two is needed */
- emptytok.integer = 0; /* but we don't know which one. */
-
- limit = p + hash->length;
- while (p < limit) {
- p->key = emptytok;
- p->value = emptytok;
- p->hashcode = HASH_EMPTY;
- ++p;
- }
-
- hash->count = 0;
- hash->lowWaterMark = (int32_t)(hash->length * hash->lowWaterRatio);
- hash->highWaterMark = (int32_t)(hash->length * hash->highWaterRatio);
-}
-
-static UHashtable*
-_uhash_init(UHashtable *result,
- UHashFunction *keyHash,
- UKeyComparator *keyComp,
- UValueComparator *valueComp,
- int32_t primeIndex,
- UErrorCode *status)
-{
- if (U_FAILURE(*status)) return NULL;
- U_ASSERT(keyHash != NULL);
- U_ASSERT(keyComp != NULL);
-
- result->keyHasher = keyHash;
- result->keyComparator = keyComp;
- result->valueComparator = valueComp;
- result->keyDeleter = NULL;
- result->valueDeleter = NULL;
- result->allocated = FALSE;
- _uhash_internalSetResizePolicy(result, U_GROW);
-
- _uhash_allocate(result, primeIndex, status);
-
- if (U_FAILURE(*status)) {
- return NULL;
- }
-
- return result;
-}
-
-static UHashtable*
-_uhash_create(UHashFunction *keyHash,
- UKeyComparator *keyComp,
- UValueComparator *valueComp,
- int32_t primeIndex,
- UErrorCode *status) {
- UHashtable *result;
-
- if (U_FAILURE(*status)) return NULL;
-
- result = (UHashtable*) uprv_malloc(sizeof(UHashtable));
- if (result == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
-
- _uhash_init(result, keyHash, keyComp, valueComp, primeIndex, status);
- result->allocated = TRUE;
-
- if (U_FAILURE(*status)) {
- uprv_free(result);
- return NULL;
- }
-
- return result;
-}
-
-/**
- * Look for a key in the table, or if no such key exists, the first
- * empty slot matching the given hashcode. Keys are compared using
- * the keyComparator function.
- *
- * First find the start position, which is the hashcode modulo
- * the length. Test it to see if it is:
- *
- * a. identical: First check the hash values for a quick check,
- * then compare keys for equality using keyComparator.
- * b. deleted
- * c. empty
- *
- * Stop if it is identical or empty, otherwise continue by adding a
- * "jump" value (moduloing by the length again to keep it within
- * range) and retesting. For efficiency, there need enough empty
- * values so that the searchs stop within a reasonable amount of time.
- * This can be changed by changing the high/low water marks.
- *
- * In theory, this function can return NULL, if it is full (no empty
- * or deleted slots) and if no matching key is found. In practice, we
- * prevent this elsewhere (in uhash_put) by making sure the last slot
- * in the table is never filled.
- *
- * The size of the table should be prime for this algorithm to work;
- * otherwise we are not guaranteed that the jump value (the secondary
- * hash) is relatively prime to the table length.
- */
-static UHashElement*
-_uhash_find(const UHashtable *hash, UHashTok key,
- int32_t hashcode) {
-
- int32_t firstDeleted = -1; /* assume invalid index */
- int32_t theIndex, startIndex;
- int32_t jump = 0; /* lazy evaluate */
- int32_t tableHash;
- UHashElement *elements = hash->elements;
-
- hashcode &= 0x7FFFFFFF; /* must be positive */
- startIndex = theIndex = (hashcode ^ 0x4000000) % hash->length;
-
- do {
- tableHash = elements[theIndex].hashcode;
- if (tableHash == hashcode) { /* quick check */
- if ((*hash->keyComparator)(key, elements[theIndex].key)) {
- return &(elements[theIndex]);
- }
- } else if (!IS_EMPTY_OR_DELETED(tableHash)) {
- /* We have hit a slot which contains a key-value pair,
- * but for which the hash code does not match. Keep
- * looking.
- */
- } else if (tableHash == HASH_EMPTY) { /* empty, end o' the line */
- break;
- } else if (firstDeleted < 0) { /* remember first deleted */
- firstDeleted = theIndex;
- }
- if (jump == 0) { /* lazy compute jump */
- /* The jump value must be relatively prime to the table
- * length. As long as the length is prime, then any value
- * 1..length-1 will be relatively prime to it.
- */
- jump = (hashcode % (hash->length - 1)) + 1;
- }
- theIndex = (theIndex + jump) % hash->length;
- } while (theIndex != startIndex);
-
- if (firstDeleted >= 0) {
- theIndex = firstDeleted; /* reset if had deleted slot */
- } else if (tableHash != HASH_EMPTY) {
- /* We get to this point if the hashtable is full (no empty or
- * deleted slots), and we've failed to find a match. THIS
- * WILL NEVER HAPPEN as long as uhash_put() makes sure that
- * count is always < length.
- */
- UPRV_UNREACHABLE;
- }
- return &(elements[theIndex]);
-}
-
-/**
- * Attempt to grow or shrink the data arrays in order to make the
- * count fit between the high and low water marks. hash_put() and
- * hash_remove() call this method when the count exceeds the high or
- * low water marks. This method may do nothing, if memory allocation
- * fails, or if the count is already in range, or if the length is
- * already at the low or high limit. In any case, upon return the
- * arrays will be valid.
- */
-static void
-_uhash_rehash(UHashtable *hash, UErrorCode *status) {
-
- UHashElement *old = hash->elements;
- int32_t oldLength = hash->length;
- int32_t newPrimeIndex = hash->primeIndex;
- int32_t i;
-
- if (hash->count > hash->highWaterMark) {
- if (++newPrimeIndex >= PRIMES_LENGTH) {
- return;
- }
- } else if (hash->count < hash->lowWaterMark) {
- if (--newPrimeIndex < 0) {
- return;
- }
- } else {
- return;
- }
-
- _uhash_allocate(hash, newPrimeIndex, status);
-
- if (U_FAILURE(*status)) {
- hash->elements = old;
- hash->length = oldLength;
- return;
- }
-
- for (i = oldLength - 1; i >= 0; --i) {
- if (!IS_EMPTY_OR_DELETED(old[i].hashcode)) {
- UHashElement *e = _uhash_find(hash, old[i].key, old[i].hashcode);
- U_ASSERT(e != NULL);
- U_ASSERT(e->hashcode == HASH_EMPTY);
- e->key = old[i].key;
- e->value = old[i].value;
- e->hashcode = old[i].hashcode;
- ++hash->count;
- }
- }
-
- uprv_free(old);
-}
-
-static UHashTok
-_uhash_remove(UHashtable *hash,
- UHashTok key) {
- /* First find the position of the key in the table. If the object
- * has not been removed already, remove it. If the user wanted
- * keys deleted, then delete it also. We have to put a special
- * hashcode in that position that means that something has been
- * deleted, since when we do a find, we have to continue PAST any
- * deleted values.
- */
- UHashTok result;
- UHashElement* e = _uhash_find(hash, key, hash->keyHasher(key));
- U_ASSERT(e != NULL);
- result.pointer = NULL;
- result.integer = 0;
- if (!IS_EMPTY_OR_DELETED(e->hashcode)) {
- result = _uhash_internalRemoveElement(hash, e);
- if (hash->count < hash->lowWaterMark) {
- UErrorCode status = U_ZERO_ERROR;
- _uhash_rehash(hash, &status);
- }
- }
- return result;
-}
-
-static UHashTok
-_uhash_put(UHashtable *hash,
- UHashTok key,
- UHashTok value,
- int8_t hint,
- UErrorCode *status) {
-
- /* Put finds the position in the table for the new value. If the
- * key is already in the table, it is deleted, if there is a
- * non-NULL keyDeleter. Then the key, the hash and the value are
- * all put at the position in their respective arrays.
- */
- int32_t hashcode;
- UHashElement* e;
- UHashTok emptytok;
-
- if (U_FAILURE(*status)) {
- goto err;
- }
- U_ASSERT(hash != NULL);
- /* Cannot always check pointer here or iSeries sees NULL every time. */
- if ((hint & HINT_VALUE_POINTER) && value.pointer == NULL) {
- /* Disallow storage of NULL values, since NULL is returned by
- * get() to indicate an absent key. Storing NULL == removing.
- */
- return _uhash_remove(hash, key);
- }
- if (hash->count > hash->highWaterMark) {
- _uhash_rehash(hash, status);
- if (U_FAILURE(*status)) {
- goto err;
- }
- }
-
- hashcode = (*hash->keyHasher)(key);
- e = _uhash_find(hash, key, hashcode);
- U_ASSERT(e != NULL);
-
- if (IS_EMPTY_OR_DELETED(e->hashcode)) {
- /* Important: We must never actually fill the table up. If we
- * do so, then _uhash_find() will return NULL, and we'll have
- * to check for NULL after every call to _uhash_find(). To
- * avoid this we make sure there is always at least one empty
- * or deleted slot in the table. This only is a problem if we
- * are out of memory and rehash isn't working.
- */
- ++hash->count;
- if (hash->count == hash->length) {
- /* Don't allow count to reach length */
- --hash->count;
- *status = U_MEMORY_ALLOCATION_ERROR;
- goto err;
- }
- }
-
- /* We must in all cases handle storage properly. If there was an
- * old key, then it must be deleted (if the deleter != NULL).
- * Make hashcodes stored in table positive.
- */
- return _uhash_setElement(hash, e, hashcode & 0x7FFFFFFF, key, value, hint);
-
- err:
- /* If the deleters are non-NULL, this method adopts its key and/or
- * value arguments, and we must be sure to delete the key and/or
- * value in all cases, even upon failure.
- */
- HASH_DELETE_KEY_VALUE(hash, key.pointer, value.pointer);
- emptytok.pointer = NULL; emptytok.integer = 0;
- return emptytok;
-}
-
-
-/********************************************************************
- * PUBLIC API
- ********************************************************************/
-
-U_CAPI UHashtable* U_EXPORT2
-uhash_open(UHashFunction *keyHash,
- UKeyComparator *keyComp,
- UValueComparator *valueComp,
- UErrorCode *status) {
-
- return _uhash_create(keyHash, keyComp, valueComp, DEFAULT_PRIME_INDEX, status);
-}
-
-U_CAPI UHashtable* U_EXPORT2
-uhash_openSize(UHashFunction *keyHash,
- UKeyComparator *keyComp,
- UValueComparator *valueComp,
- int32_t size,
- UErrorCode *status) {
-
- /* Find the smallest index i for which PRIMES[i] >= size. */
- int32_t i = 0;
- while (i<(PRIMES_LENGTH-1) && PRIMES[i]<size) {
- ++i;
- }
-
- return _uhash_create(keyHash, keyComp, valueComp, i, status);
-}
-
-U_CAPI UHashtable* U_EXPORT2
-uhash_init(UHashtable *fillinResult,
- UHashFunction *keyHash,
- UKeyComparator *keyComp,
- UValueComparator *valueComp,
- UErrorCode *status) {
-
- return _uhash_init(fillinResult, keyHash, keyComp, valueComp, DEFAULT_PRIME_INDEX, status);
-}
-
-U_CAPI UHashtable* U_EXPORT2
-uhash_initSize(UHashtable *fillinResult,
- UHashFunction *keyHash,
- UKeyComparator *keyComp,
- UValueComparator *valueComp,
- int32_t size,
- UErrorCode *status) {
-
- // Find the smallest index i for which PRIMES[i] >= size.
- int32_t i = 0;
- while (i<(PRIMES_LENGTH-1) && PRIMES[i]<size) {
- ++i;
- }
- return _uhash_init(fillinResult, keyHash, keyComp, valueComp, i, status);
-}
-
-U_CAPI void U_EXPORT2
-uhash_close(UHashtable *hash) {
- if (hash == NULL) {
- return;
- }
- if (hash->elements != NULL) {
- if (hash->keyDeleter != NULL || hash->valueDeleter != NULL) {
- int32_t pos=UHASH_FIRST;
- UHashElement *e;
- while ((e = (UHashElement*) uhash_nextElement(hash, &pos)) != NULL) {
- HASH_DELETE_KEY_VALUE(hash, e->key.pointer, e->value.pointer);
- }
- }
- uprv_free(hash->elements);
- hash->elements = NULL;
- }
- if (hash->allocated) {
- uprv_free(hash);
- }
-}
-
-U_CAPI UHashFunction *U_EXPORT2
-uhash_setKeyHasher(UHashtable *hash, UHashFunction *fn) {
- UHashFunction *result = hash->keyHasher;
- hash->keyHasher = fn;
- return result;
-}
-
-U_CAPI UKeyComparator *U_EXPORT2
-uhash_setKeyComparator(UHashtable *hash, UKeyComparator *fn) {
- UKeyComparator *result = hash->keyComparator;
- hash->keyComparator = fn;
- return result;
-}
-U_CAPI UValueComparator *U_EXPORT2
-uhash_setValueComparator(UHashtable *hash, UValueComparator *fn){
- UValueComparator *result = hash->valueComparator;
- hash->valueComparator = fn;
- return result;
-}
-
-U_CAPI UObjectDeleter *U_EXPORT2
-uhash_setKeyDeleter(UHashtable *hash, UObjectDeleter *fn) {
- UObjectDeleter *result = hash->keyDeleter;
- hash->keyDeleter = fn;
- return result;
-}
-
-U_CAPI UObjectDeleter *U_EXPORT2
-uhash_setValueDeleter(UHashtable *hash, UObjectDeleter *fn) {
- UObjectDeleter *result = hash->valueDeleter;
- hash->valueDeleter = fn;
- return result;
-}
-
-U_CAPI void U_EXPORT2
-uhash_setResizePolicy(UHashtable *hash, enum UHashResizePolicy policy) {
- UErrorCode status = U_ZERO_ERROR;
- _uhash_internalSetResizePolicy(hash, policy);
- hash->lowWaterMark = (int32_t)(hash->length * hash->lowWaterRatio);
- hash->highWaterMark = (int32_t)(hash->length * hash->highWaterRatio);
- _uhash_rehash(hash, &status);
-}
-
-U_CAPI int32_t U_EXPORT2
-uhash_count(const UHashtable *hash) {
- return hash->count;
-}
-
-U_CAPI void* U_EXPORT2
-uhash_get(const UHashtable *hash,
- const void* key) {
- UHashTok keyholder;
- keyholder.pointer = (void*) key;
- return _uhash_find(hash, keyholder, hash->keyHasher(keyholder))->value.pointer;
-}
-
-U_CAPI void* U_EXPORT2
-uhash_iget(const UHashtable *hash,
- int32_t key) {
- UHashTok keyholder;
- keyholder.integer = key;
- return _uhash_find(hash, keyholder, hash->keyHasher(keyholder))->value.pointer;
-}
-
-U_CAPI int32_t U_EXPORT2
-uhash_geti(const UHashtable *hash,
- const void* key) {
- UHashTok keyholder;
- keyholder.pointer = (void*) key;
- return _uhash_find(hash, keyholder, hash->keyHasher(keyholder))->value.integer;
-}
-
-U_CAPI int32_t U_EXPORT2
-uhash_igeti(const UHashtable *hash,
- int32_t key) {
- UHashTok keyholder;
- keyholder.integer = key;
- return _uhash_find(hash, keyholder, hash->keyHasher(keyholder))->value.integer;
-}
-
-U_CAPI void* U_EXPORT2
-uhash_put(UHashtable *hash,
- void* key,
- void* value,
- UErrorCode *status) {
- UHashTok keyholder, valueholder;
- keyholder.pointer = key;
- valueholder.pointer = value;
- return _uhash_put(hash, keyholder, valueholder,
- HINT_KEY_POINTER | HINT_VALUE_POINTER,
- status).pointer;
-}
-
-U_CAPI void* U_EXPORT2
-uhash_iput(UHashtable *hash,
- int32_t key,
- void* value,
- UErrorCode *status) {
- UHashTok keyholder, valueholder;
- keyholder.integer = key;
- valueholder.pointer = value;
- return _uhash_put(hash, keyholder, valueholder,
- HINT_VALUE_POINTER,
- status).pointer;
-}
-
-U_CAPI int32_t U_EXPORT2
-uhash_puti(UHashtable *hash,
- void* key,
- int32_t value,
- UErrorCode *status) {
- UHashTok keyholder, valueholder;
- keyholder.pointer = key;
- valueholder.integer = value;
- return _uhash_put(hash, keyholder, valueholder,
- HINT_KEY_POINTER,
- status).integer;
-}
-
-
-U_CAPI int32_t U_EXPORT2
-uhash_iputi(UHashtable *hash,
- int32_t key,
- int32_t value,
- UErrorCode *status) {
- UHashTok keyholder, valueholder;
- keyholder.integer = key;
- valueholder.integer = value;
- return _uhash_put(hash, keyholder, valueholder,
- 0, /* neither is a ptr */
- status).integer;
-}
-
-U_CAPI void* U_EXPORT2
-uhash_remove(UHashtable *hash,
- const void* key) {
- UHashTok keyholder;
- keyholder.pointer = (void*) key;
- return _uhash_remove(hash, keyholder).pointer;
-}
-
-U_CAPI void* U_EXPORT2
-uhash_iremove(UHashtable *hash,
- int32_t key) {
- UHashTok keyholder;
- keyholder.integer = key;
- return _uhash_remove(hash, keyholder).pointer;
-}
-
-U_CAPI int32_t U_EXPORT2
-uhash_removei(UHashtable *hash,
- const void* key) {
- UHashTok keyholder;
- keyholder.pointer = (void*) key;
- return _uhash_remove(hash, keyholder).integer;
-}
-
-U_CAPI int32_t U_EXPORT2
-uhash_iremovei(UHashtable *hash,
- int32_t key) {
- UHashTok keyholder;
- keyholder.integer = key;
- return _uhash_remove(hash, keyholder).integer;
-}
-
-U_CAPI void U_EXPORT2
-uhash_removeAll(UHashtable *hash) {
- int32_t pos = UHASH_FIRST;
- const UHashElement *e;
- U_ASSERT(hash != NULL);
- if (hash->count != 0) {
- while ((e = uhash_nextElement(hash, &pos)) != NULL) {
- uhash_removeElement(hash, e);
- }
- }
- U_ASSERT(hash->count == 0);
-}
-
-U_CAPI const UHashElement* U_EXPORT2
-uhash_find(const UHashtable *hash, const void* key) {
- UHashTok keyholder;
- const UHashElement *e;
- keyholder.pointer = (void*) key;
- e = _uhash_find(hash, keyholder, hash->keyHasher(keyholder));
- return IS_EMPTY_OR_DELETED(e->hashcode) ? NULL : e;
-}
-
-U_CAPI const UHashElement* U_EXPORT2
-uhash_nextElement(const UHashtable *hash, int32_t *pos) {
- /* Walk through the array until we find an element that is not
- * EMPTY and not DELETED.
- */
- int32_t i;
- U_ASSERT(hash != NULL);
- for (i = *pos + 1; i < hash->length; ++i) {
- if (!IS_EMPTY_OR_DELETED(hash->elements[i].hashcode)) {
- *pos = i;
- return &(hash->elements[i]);
- }
- }
-
- /* No more elements */
- return NULL;
-}
-
-U_CAPI void* U_EXPORT2
-uhash_removeElement(UHashtable *hash, const UHashElement* e) {
- U_ASSERT(hash != NULL);
- U_ASSERT(e != NULL);
- if (!IS_EMPTY_OR_DELETED(e->hashcode)) {
- UHashElement *nce = (UHashElement *)e;
- return _uhash_internalRemoveElement(hash, nce).pointer;
- }
- return NULL;
-}
-
-/********************************************************************
- * UHashTok convenience
- ********************************************************************/
-
-/**
- * Return a UHashTok for an integer.
- */
-/*U_CAPI UHashTok U_EXPORT2
-uhash_toki(int32_t i) {
- UHashTok tok;
- tok.integer = i;
- return tok;
-}*/
-
-/**
- * Return a UHashTok for a pointer.
- */
-/*U_CAPI UHashTok U_EXPORT2
-uhash_tokp(void* p) {
- UHashTok tok;
- tok.pointer = p;
- return tok;
-}*/
-
-/********************************************************************
- * PUBLIC Key Hash Functions
- ********************************************************************/
-
-U_CAPI int32_t U_EXPORT2
-uhash_hashUChars(const UHashTok key) {
- const UChar *s = (const UChar *)key.pointer;
- return s == NULL ? 0 : ustr_hashUCharsN(s, u_strlen(s));
-}
-
-U_CAPI int32_t U_EXPORT2
-uhash_hashChars(const UHashTok key) {
- const char *s = (const char *)key.pointer;
- return s == NULL ? 0 : static_cast<int32_t>(ustr_hashCharsN(s, static_cast<int32_t>(uprv_strlen(s))));
-}
-
-U_CAPI int32_t U_EXPORT2
-uhash_hashIChars(const UHashTok key) {
- const char *s = (const char *)key.pointer;
- return s == NULL ? 0 : ustr_hashICharsN(s, static_cast<int32_t>(uprv_strlen(s)));
-}
-
-U_CAPI UBool U_EXPORT2
-uhash_equals(const UHashtable* hash1, const UHashtable* hash2){
- int32_t count1, count2, pos, i;
-
- if(hash1==hash2){
- return TRUE;
- }
-
- /*
- * Make sure that we are comparing 2 valid hashes of the same type
- * with valid comparison functions.
- * Without valid comparison functions, a binary comparison
- * of the hash values will yield random results on machines
- * with 64-bit pointers and 32-bit integer hashes.
- * A valueComparator is normally optional.
- */
- if (hash1==NULL || hash2==NULL ||
- hash1->keyComparator != hash2->keyComparator ||
- hash1->valueComparator != hash2->valueComparator ||
- hash1->valueComparator == NULL)
- {
- /*
- Normally we would return an error here about incompatible hash tables,
- but we return FALSE instead.
- */
- return FALSE;
- }
-
- count1 = uhash_count(hash1);
- count2 = uhash_count(hash2);
- if(count1!=count2){
- return FALSE;
- }
-
- pos=UHASH_FIRST;
- for(i=0; i<count1; i++){
- const UHashElement* elem1 = uhash_nextElement(hash1, &pos);
- const UHashTok key1 = elem1->key;
- const UHashTok val1 = elem1->value;
- /* here the keys are not compared, instead the key form hash1 is used to fetch
- * value from hash2. If the hashes are equal then then both hashes should
- * contain equal values for the same key!
- */
- const UHashElement* elem2 = _uhash_find(hash2, key1, hash2->keyHasher(key1));
- const UHashTok val2 = elem2->value;
- if(hash1->valueComparator(val1, val2)==FALSE){
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/********************************************************************
- * PUBLIC Comparator Functions
- ********************************************************************/
-
-U_CAPI UBool U_EXPORT2
-uhash_compareUChars(const UHashTok key1, const UHashTok key2) {
- const UChar *p1 = (const UChar*) key1.pointer;
- const UChar *p2 = (const UChar*) key2.pointer;
- if (p1 == p2) {
- return TRUE;
- }
- if (p1 == NULL || p2 == NULL) {
- return FALSE;
- }
- while (*p1 != 0 && *p1 == *p2) {
- ++p1;
- ++p2;
- }
- return (UBool)(*p1 == *p2);
-}
-
-U_CAPI UBool U_EXPORT2
-uhash_compareChars(const UHashTok key1, const UHashTok key2) {
- const char *p1 = (const char*) key1.pointer;
- const char *p2 = (const char*) key2.pointer;
- if (p1 == p2) {
- return TRUE;
- }
- if (p1 == NULL || p2 == NULL) {
- return FALSE;
- }
- while (*p1 != 0 && *p1 == *p2) {
- ++p1;
- ++p2;
- }
- return (UBool)(*p1 == *p2);
-}
-
-U_CAPI UBool U_EXPORT2
-uhash_compareIChars(const UHashTok key1, const UHashTok key2) {
- const char *p1 = (const char*) key1.pointer;
- const char *p2 = (const char*) key2.pointer;
- if (p1 == p2) {
- return TRUE;
- }
- if (p1 == NULL || p2 == NULL) {
- return FALSE;
- }
- while (*p1 != 0 && uprv_tolower(*p1) == uprv_tolower(*p2)) {
- ++p1;
- ++p2;
- }
- return (UBool)(*p1 == *p2);
-}
-
-/********************************************************************
- * PUBLIC int32_t Support Functions
- ********************************************************************/
-
-U_CAPI int32_t U_EXPORT2
-uhash_hashLong(const UHashTok key) {
- return key.integer;
-}
-
-U_CAPI UBool U_EXPORT2
-uhash_compareLong(const UHashTok key1, const UHashTok key2) {
- return (UBool)(key1.integer == key2.integer);
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+* Copyright (C) 1997-2016, International Business Machines
+* Corporation and others. All Rights Reserved.
+******************************************************************************
+* Date Name Description
+* 03/22/00 aliu Adapted from original C++ ICU Hashtable.
+* 07/06/01 aliu Modified to support int32_t keys on
+* platforms with sizeof(void*) < 32.
+******************************************************************************
+*/
+
+#include "uhash.h"
+#include "unicode/ustring.h"
+#include "cstring.h"
+#include "cmemory.h"
+#include "uassert.h"
+#include "ustr_imp.h"
+
+/* This hashtable is implemented as a double hash. All elements are
+ * stored in a single array with no secondary storage for collision
+ * resolution (no linked list, etc.). When there is a hash collision
+ * (when two unequal keys have the same hashcode) we resolve this by
+ * using a secondary hash. The secondary hash is an increment
+ * computed as a hash function (a different one) of the primary
+ * hashcode. This increment is added to the initial hash value to
+ * obtain further slots assigned to the same hash code. For this to
+ * work, the length of the array and the increment must be relatively
+ * prime. The easiest way to achieve this is to have the length of
+ * the array be prime, and the increment be any value from
+ * 1..length-1.
+ *
+ * Hashcodes are 32-bit integers. We make sure all hashcodes are
+ * non-negative by masking off the top bit. This has two effects: (1)
+ * modulo arithmetic is simplified. If we allowed negative hashcodes,
+ * then when we computed hashcode % length, we could get a negative
+ * result, which we would then have to adjust back into range. It's
+ * simpler to just make hashcodes non-negative. (2) It makes it easy
+ * to check for empty vs. occupied slots in the table. We just mark
+ * empty or deleted slots with a negative hashcode.
+ *
+ * The central function is _uhash_find(). This function looks for a
+ * slot matching the given key and hashcode. If one is found, it
+ * returns a pointer to that slot. If the table is full, and no match
+ * is found, it returns NULL -- in theory. This would make the code
+ * more complicated, since all callers of _uhash_find() would then
+ * have to check for a NULL result. To keep this from happening, we
+ * don't allow the table to fill. When there is only one
+ * empty/deleted slot left, uhash_put() will refuse to increase the
+ * count, and fail. This simplifies the code. In practice, one will
+ * seldom encounter this using default UHashtables. However, if a
+ * hashtable is set to a U_FIXED resize policy, or if memory is
+ * exhausted, then the table may fill.
+ *
+ * High and low water ratios control rehashing. They establish levels
+ * of fullness (from 0 to 1) outside of which the data array is
+ * reallocated and repopulated. Setting the low water ratio to zero
+ * means the table will never shrink. Setting the high water ratio to
+ * one means the table will never grow. The ratios should be
+ * coordinated with the ratio between successive elements of the
+ * PRIMES table, so that when the primeIndex is incremented or
+ * decremented during rehashing, it brings the ratio of count / length
+ * back into the desired range (between low and high water ratios).
+ */
+
+/********************************************************************
+ * PRIVATE Constants, Macros
+ ********************************************************************/
+
+/* This is a list of non-consecutive primes chosen such that
+ * PRIMES[i+1] ~ 2*PRIMES[i]. (Currently, the ratio ranges from 1.81
+ * to 2.18; the inverse ratio ranges from 0.459 to 0.552.) If this
+ * ratio is changed, the low and high water ratios should also be
+ * adjusted to suit.
+ *
+ * These prime numbers were also chosen so that they are the largest
+ * prime number while being less than a power of two.
+ */
+static const int32_t PRIMES[] = {
+ 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749,
+ 65521, 131071, 262139, 524287, 1048573, 2097143, 4194301, 8388593,
+ 16777213, 33554393, 67108859, 134217689, 268435399, 536870909,
+ 1073741789, 2147483647 /*, 4294967291 */
+};
+
+#define PRIMES_LENGTH UPRV_LENGTHOF(PRIMES)
+#define DEFAULT_PRIME_INDEX 4
+
+/* These ratios are tuned to the PRIMES array such that a resize
+ * places the table back into the zone of non-resizing. That is,
+ * after a call to _uhash_rehash(), a subsequent call to
+ * _uhash_rehash() should do nothing (should not churn). This is only
+ * a potential problem with U_GROW_AND_SHRINK.
+ */
+static const float RESIZE_POLICY_RATIO_TABLE[6] = {
+ /* low, high water ratio */
+ 0.0F, 0.5F, /* U_GROW: Grow on demand, do not shrink */
+ 0.1F, 0.5F, /* U_GROW_AND_SHRINK: Grow and shrink on demand */
+ 0.0F, 1.0F /* U_FIXED: Never change size */
+};
+
+/*
+ Invariants for hashcode values:
+
+ * DELETED < 0
+ * EMPTY < 0
+ * Real hashes >= 0
+
+ Hashcodes may not start out this way, but internally they are
+ adjusted so that they are always positive. We assume 32-bit
+ hashcodes; adjust these constants for other hashcode sizes.
+*/
+#define HASH_DELETED ((int32_t) 0x80000000)
+#define HASH_EMPTY ((int32_t) HASH_DELETED + 1)
+
+#define IS_EMPTY_OR_DELETED(x) ((x) < 0)
+
+/* This macro expects a UHashTok.pointer as its keypointer and
+ valuepointer parameters */
+#define HASH_DELETE_KEY_VALUE(hash, keypointer, valuepointer) UPRV_BLOCK_MACRO_BEGIN { \
+ if (hash->keyDeleter != NULL && keypointer != NULL) { \
+ (*hash->keyDeleter)(keypointer); \
+ } \
+ if (hash->valueDeleter != NULL && valuepointer != NULL) { \
+ (*hash->valueDeleter)(valuepointer); \
+ } \
+} UPRV_BLOCK_MACRO_END
+
+/*
+ * Constants for hinting whether a key or value is an integer
+ * or a pointer. If a hint bit is zero, then the associated
+ * token is assumed to be an integer.
+ */
+#define HINT_KEY_POINTER (1)
+#define HINT_VALUE_POINTER (2)
+
+/********************************************************************
+ * PRIVATE Implementation
+ ********************************************************************/
+
+static UHashTok
+_uhash_setElement(UHashtable *hash, UHashElement* e,
+ int32_t hashcode,
+ UHashTok key, UHashTok value, int8_t hint) {
+
+ UHashTok oldValue = e->value;
+ if (hash->keyDeleter != NULL && e->key.pointer != NULL &&
+ e->key.pointer != key.pointer) { /* Avoid double deletion */
+ (*hash->keyDeleter)(e->key.pointer);
+ }
+ if (hash->valueDeleter != NULL) {
+ if (oldValue.pointer != NULL &&
+ oldValue.pointer != value.pointer) { /* Avoid double deletion */
+ (*hash->valueDeleter)(oldValue.pointer);
+ }
+ oldValue.pointer = NULL;
+ }
+ /* Compilers should copy the UHashTok union correctly, but even if
+ * they do, memory heap tools (e.g. BoundsChecker) can get
+ * confused when a pointer is cloaked in a union and then copied.
+ * TO ALLEVIATE THIS, we use hints (based on what API the user is
+ * calling) to copy pointers when we know the user thinks
+ * something is a pointer. */
+ if (hint & HINT_KEY_POINTER) {
+ e->key.pointer = key.pointer;
+ } else {
+ e->key = key;
+ }
+ if (hint & HINT_VALUE_POINTER) {
+ e->value.pointer = value.pointer;
+ } else {
+ e->value = value;
+ }
+ e->hashcode = hashcode;
+ return oldValue;
+}
+
+/**
+ * Assumes that the given element is not empty or deleted.
+ */
+static UHashTok
+_uhash_internalRemoveElement(UHashtable *hash, UHashElement* e) {
+ UHashTok empty;
+ U_ASSERT(!IS_EMPTY_OR_DELETED(e->hashcode));
+ --hash->count;
+ empty.pointer = NULL; empty.integer = 0;
+ return _uhash_setElement(hash, e, HASH_DELETED, empty, empty, 0);
+}
+
+static void
+_uhash_internalSetResizePolicy(UHashtable *hash, enum UHashResizePolicy policy) {
+ U_ASSERT(hash != NULL);
+ U_ASSERT(((int32_t)policy) >= 0);
+ U_ASSERT(((int32_t)policy) < 3);
+ hash->lowWaterRatio = RESIZE_POLICY_RATIO_TABLE[policy * 2];
+ hash->highWaterRatio = RESIZE_POLICY_RATIO_TABLE[policy * 2 + 1];
+}
+
+/**
+ * Allocate internal data array of a size determined by the given
+ * prime index. If the index is out of range it is pinned into range.
+ * If the allocation fails the status is set to
+ * U_MEMORY_ALLOCATION_ERROR and all array storage is freed. In
+ * either case the previous array pointer is overwritten.
+ *
+ * Caller must ensure primeIndex is in range 0..PRIME_LENGTH-1.
+ */
+static void
+_uhash_allocate(UHashtable *hash,
+ int32_t primeIndex,
+ UErrorCode *status) {
+
+ UHashElement *p, *limit;
+ UHashTok emptytok;
+
+ if (U_FAILURE(*status)) return;
+
+ U_ASSERT(primeIndex >= 0 && primeIndex < PRIMES_LENGTH);
+
+ hash->primeIndex = static_cast<int8_t>(primeIndex);
+ hash->length = PRIMES[primeIndex];
+
+ p = hash->elements = (UHashElement*)
+ uprv_malloc(sizeof(UHashElement) * hash->length);
+
+ if (hash->elements == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+
+ emptytok.pointer = NULL; /* Only one of these two is needed */
+ emptytok.integer = 0; /* but we don't know which one. */
+
+ limit = p + hash->length;
+ while (p < limit) {
+ p->key = emptytok;
+ p->value = emptytok;
+ p->hashcode = HASH_EMPTY;
+ ++p;
+ }
+
+ hash->count = 0;
+ hash->lowWaterMark = (int32_t)(hash->length * hash->lowWaterRatio);
+ hash->highWaterMark = (int32_t)(hash->length * hash->highWaterRatio);
+}
+
+static UHashtable*
+_uhash_init(UHashtable *result,
+ UHashFunction *keyHash,
+ UKeyComparator *keyComp,
+ UValueComparator *valueComp,
+ int32_t primeIndex,
+ UErrorCode *status)
+{
+ if (U_FAILURE(*status)) return NULL;
+ U_ASSERT(keyHash != NULL);
+ U_ASSERT(keyComp != NULL);
+
+ result->keyHasher = keyHash;
+ result->keyComparator = keyComp;
+ result->valueComparator = valueComp;
+ result->keyDeleter = NULL;
+ result->valueDeleter = NULL;
+ result->allocated = FALSE;
+ _uhash_internalSetResizePolicy(result, U_GROW);
+
+ _uhash_allocate(result, primeIndex, status);
+
+ if (U_FAILURE(*status)) {
+ return NULL;
+ }
+
+ return result;
+}
+
+static UHashtable*
+_uhash_create(UHashFunction *keyHash,
+ UKeyComparator *keyComp,
+ UValueComparator *valueComp,
+ int32_t primeIndex,
+ UErrorCode *status) {
+ UHashtable *result;
+
+ if (U_FAILURE(*status)) return NULL;
+
+ result = (UHashtable*) uprv_malloc(sizeof(UHashtable));
+ if (result == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+
+ _uhash_init(result, keyHash, keyComp, valueComp, primeIndex, status);
+ result->allocated = TRUE;
+
+ if (U_FAILURE(*status)) {
+ uprv_free(result);
+ return NULL;
+ }
+
+ return result;
+}
+
+/**
+ * Look for a key in the table, or if no such key exists, the first
+ * empty slot matching the given hashcode. Keys are compared using
+ * the keyComparator function.
+ *
+ * First find the start position, which is the hashcode modulo
+ * the length. Test it to see if it is:
+ *
+ * a. identical: First check the hash values for a quick check,
+ * then compare keys for equality using keyComparator.
+ * b. deleted
+ * c. empty
+ *
+ * Stop if it is identical or empty, otherwise continue by adding a
+ * "jump" value (moduloing by the length again to keep it within
+ * range) and retesting. For efficiency, there need enough empty
+ * values so that the searchs stop within a reasonable amount of time.
+ * This can be changed by changing the high/low water marks.
+ *
+ * In theory, this function can return NULL, if it is full (no empty
+ * or deleted slots) and if no matching key is found. In practice, we
+ * prevent this elsewhere (in uhash_put) by making sure the last slot
+ * in the table is never filled.
+ *
+ * The size of the table should be prime for this algorithm to work;
+ * otherwise we are not guaranteed that the jump value (the secondary
+ * hash) is relatively prime to the table length.
+ */
+static UHashElement*
+_uhash_find(const UHashtable *hash, UHashTok key,
+ int32_t hashcode) {
+
+ int32_t firstDeleted = -1; /* assume invalid index */
+ int32_t theIndex, startIndex;
+ int32_t jump = 0; /* lazy evaluate */
+ int32_t tableHash;
+ UHashElement *elements = hash->elements;
+
+ hashcode &= 0x7FFFFFFF; /* must be positive */
+ startIndex = theIndex = (hashcode ^ 0x4000000) % hash->length;
+
+ do {
+ tableHash = elements[theIndex].hashcode;
+ if (tableHash == hashcode) { /* quick check */
+ if ((*hash->keyComparator)(key, elements[theIndex].key)) {
+ return &(elements[theIndex]);
+ }
+ } else if (!IS_EMPTY_OR_DELETED(tableHash)) {
+ /* We have hit a slot which contains a key-value pair,
+ * but for which the hash code does not match. Keep
+ * looking.
+ */
+ } else if (tableHash == HASH_EMPTY) { /* empty, end o' the line */
+ break;
+ } else if (firstDeleted < 0) { /* remember first deleted */
+ firstDeleted = theIndex;
+ }
+ if (jump == 0) { /* lazy compute jump */
+ /* The jump value must be relatively prime to the table
+ * length. As long as the length is prime, then any value
+ * 1..length-1 will be relatively prime to it.
+ */
+ jump = (hashcode % (hash->length - 1)) + 1;
+ }
+ theIndex = (theIndex + jump) % hash->length;
+ } while (theIndex != startIndex);
+
+ if (firstDeleted >= 0) {
+ theIndex = firstDeleted; /* reset if had deleted slot */
+ } else if (tableHash != HASH_EMPTY) {
+ /* We get to this point if the hashtable is full (no empty or
+ * deleted slots), and we've failed to find a match. THIS
+ * WILL NEVER HAPPEN as long as uhash_put() makes sure that
+ * count is always < length.
+ */
+ UPRV_UNREACHABLE;
+ }
+ return &(elements[theIndex]);
+}
+
+/**
+ * Attempt to grow or shrink the data arrays in order to make the
+ * count fit between the high and low water marks. hash_put() and
+ * hash_remove() call this method when the count exceeds the high or
+ * low water marks. This method may do nothing, if memory allocation
+ * fails, or if the count is already in range, or if the length is
+ * already at the low or high limit. In any case, upon return the
+ * arrays will be valid.
+ */
+static void
+_uhash_rehash(UHashtable *hash, UErrorCode *status) {
+
+ UHashElement *old = hash->elements;
+ int32_t oldLength = hash->length;
+ int32_t newPrimeIndex = hash->primeIndex;
+ int32_t i;
+
+ if (hash->count > hash->highWaterMark) {
+ if (++newPrimeIndex >= PRIMES_LENGTH) {
+ return;
+ }
+ } else if (hash->count < hash->lowWaterMark) {
+ if (--newPrimeIndex < 0) {
+ return;
+ }
+ } else {
+ return;
+ }
+
+ _uhash_allocate(hash, newPrimeIndex, status);
+
+ if (U_FAILURE(*status)) {
+ hash->elements = old;
+ hash->length = oldLength;
+ return;
+ }
+
+ for (i = oldLength - 1; i >= 0; --i) {
+ if (!IS_EMPTY_OR_DELETED(old[i].hashcode)) {
+ UHashElement *e = _uhash_find(hash, old[i].key, old[i].hashcode);
+ U_ASSERT(e != NULL);
+ U_ASSERT(e->hashcode == HASH_EMPTY);
+ e->key = old[i].key;
+ e->value = old[i].value;
+ e->hashcode = old[i].hashcode;
+ ++hash->count;
+ }
+ }
+
+ uprv_free(old);
+}
+
+static UHashTok
+_uhash_remove(UHashtable *hash,
+ UHashTok key) {
+ /* First find the position of the key in the table. If the object
+ * has not been removed already, remove it. If the user wanted
+ * keys deleted, then delete it also. We have to put a special
+ * hashcode in that position that means that something has been
+ * deleted, since when we do a find, we have to continue PAST any
+ * deleted values.
+ */
+ UHashTok result;
+ UHashElement* e = _uhash_find(hash, key, hash->keyHasher(key));
+ U_ASSERT(e != NULL);
+ result.pointer = NULL;
+ result.integer = 0;
+ if (!IS_EMPTY_OR_DELETED(e->hashcode)) {
+ result = _uhash_internalRemoveElement(hash, e);
+ if (hash->count < hash->lowWaterMark) {
+ UErrorCode status = U_ZERO_ERROR;
+ _uhash_rehash(hash, &status);
+ }
+ }
+ return result;
+}
+
+static UHashTok
+_uhash_put(UHashtable *hash,
+ UHashTok key,
+ UHashTok value,
+ int8_t hint,
+ UErrorCode *status) {
+
+ /* Put finds the position in the table for the new value. If the
+ * key is already in the table, it is deleted, if there is a
+ * non-NULL keyDeleter. Then the key, the hash and the value are
+ * all put at the position in their respective arrays.
+ */
+ int32_t hashcode;
+ UHashElement* e;
+ UHashTok emptytok;
+
+ if (U_FAILURE(*status)) {
+ goto err;
+ }
+ U_ASSERT(hash != NULL);
+ /* Cannot always check pointer here or iSeries sees NULL every time. */
+ if ((hint & HINT_VALUE_POINTER) && value.pointer == NULL) {
+ /* Disallow storage of NULL values, since NULL is returned by
+ * get() to indicate an absent key. Storing NULL == removing.
+ */
+ return _uhash_remove(hash, key);
+ }
+ if (hash->count > hash->highWaterMark) {
+ _uhash_rehash(hash, status);
+ if (U_FAILURE(*status)) {
+ goto err;
+ }
+ }
+
+ hashcode = (*hash->keyHasher)(key);
+ e = _uhash_find(hash, key, hashcode);
+ U_ASSERT(e != NULL);
+
+ if (IS_EMPTY_OR_DELETED(e->hashcode)) {
+ /* Important: We must never actually fill the table up. If we
+ * do so, then _uhash_find() will return NULL, and we'll have
+ * to check for NULL after every call to _uhash_find(). To
+ * avoid this we make sure there is always at least one empty
+ * or deleted slot in the table. This only is a problem if we
+ * are out of memory and rehash isn't working.
+ */
+ ++hash->count;
+ if (hash->count == hash->length) {
+ /* Don't allow count to reach length */
+ --hash->count;
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ goto err;
+ }
+ }
+
+ /* We must in all cases handle storage properly. If there was an
+ * old key, then it must be deleted (if the deleter != NULL).
+ * Make hashcodes stored in table positive.
+ */
+ return _uhash_setElement(hash, e, hashcode & 0x7FFFFFFF, key, value, hint);
+
+ err:
+ /* If the deleters are non-NULL, this method adopts its key and/or
+ * value arguments, and we must be sure to delete the key and/or
+ * value in all cases, even upon failure.
+ */
+ HASH_DELETE_KEY_VALUE(hash, key.pointer, value.pointer);
+ emptytok.pointer = NULL; emptytok.integer = 0;
+ return emptytok;
+}
+
+
+/********************************************************************
+ * PUBLIC API
+ ********************************************************************/
+
+U_CAPI UHashtable* U_EXPORT2
+uhash_open(UHashFunction *keyHash,
+ UKeyComparator *keyComp,
+ UValueComparator *valueComp,
+ UErrorCode *status) {
+
+ return _uhash_create(keyHash, keyComp, valueComp, DEFAULT_PRIME_INDEX, status);
+}
+
+U_CAPI UHashtable* U_EXPORT2
+uhash_openSize(UHashFunction *keyHash,
+ UKeyComparator *keyComp,
+ UValueComparator *valueComp,
+ int32_t size,
+ UErrorCode *status) {
+
+ /* Find the smallest index i for which PRIMES[i] >= size. */
+ int32_t i = 0;
+ while (i<(PRIMES_LENGTH-1) && PRIMES[i]<size) {
+ ++i;
+ }
+
+ return _uhash_create(keyHash, keyComp, valueComp, i, status);
+}
+
+U_CAPI UHashtable* U_EXPORT2
+uhash_init(UHashtable *fillinResult,
+ UHashFunction *keyHash,
+ UKeyComparator *keyComp,
+ UValueComparator *valueComp,
+ UErrorCode *status) {
+
+ return _uhash_init(fillinResult, keyHash, keyComp, valueComp, DEFAULT_PRIME_INDEX, status);
+}
+
+U_CAPI UHashtable* U_EXPORT2
+uhash_initSize(UHashtable *fillinResult,
+ UHashFunction *keyHash,
+ UKeyComparator *keyComp,
+ UValueComparator *valueComp,
+ int32_t size,
+ UErrorCode *status) {
+
+ // Find the smallest index i for which PRIMES[i] >= size.
+ int32_t i = 0;
+ while (i<(PRIMES_LENGTH-1) && PRIMES[i]<size) {
+ ++i;
+ }
+ return _uhash_init(fillinResult, keyHash, keyComp, valueComp, i, status);
+}
+
+U_CAPI void U_EXPORT2
+uhash_close(UHashtable *hash) {
+ if (hash == NULL) {
+ return;
+ }
+ if (hash->elements != NULL) {
+ if (hash->keyDeleter != NULL || hash->valueDeleter != NULL) {
+ int32_t pos=UHASH_FIRST;
+ UHashElement *e;
+ while ((e = (UHashElement*) uhash_nextElement(hash, &pos)) != NULL) {
+ HASH_DELETE_KEY_VALUE(hash, e->key.pointer, e->value.pointer);
+ }
+ }
+ uprv_free(hash->elements);
+ hash->elements = NULL;
+ }
+ if (hash->allocated) {
+ uprv_free(hash);
+ }
+}
+
+U_CAPI UHashFunction *U_EXPORT2
+uhash_setKeyHasher(UHashtable *hash, UHashFunction *fn) {
+ UHashFunction *result = hash->keyHasher;
+ hash->keyHasher = fn;
+ return result;
+}
+
+U_CAPI UKeyComparator *U_EXPORT2
+uhash_setKeyComparator(UHashtable *hash, UKeyComparator *fn) {
+ UKeyComparator *result = hash->keyComparator;
+ hash->keyComparator = fn;
+ return result;
+}
+U_CAPI UValueComparator *U_EXPORT2
+uhash_setValueComparator(UHashtable *hash, UValueComparator *fn){
+ UValueComparator *result = hash->valueComparator;
+ hash->valueComparator = fn;
+ return result;
+}
+
+U_CAPI UObjectDeleter *U_EXPORT2
+uhash_setKeyDeleter(UHashtable *hash, UObjectDeleter *fn) {
+ UObjectDeleter *result = hash->keyDeleter;
+ hash->keyDeleter = fn;
+ return result;
+}
+
+U_CAPI UObjectDeleter *U_EXPORT2
+uhash_setValueDeleter(UHashtable *hash, UObjectDeleter *fn) {
+ UObjectDeleter *result = hash->valueDeleter;
+ hash->valueDeleter = fn;
+ return result;
+}
+
+U_CAPI void U_EXPORT2
+uhash_setResizePolicy(UHashtable *hash, enum UHashResizePolicy policy) {
+ UErrorCode status = U_ZERO_ERROR;
+ _uhash_internalSetResizePolicy(hash, policy);
+ hash->lowWaterMark = (int32_t)(hash->length * hash->lowWaterRatio);
+ hash->highWaterMark = (int32_t)(hash->length * hash->highWaterRatio);
+ _uhash_rehash(hash, &status);
+}
+
+U_CAPI int32_t U_EXPORT2
+uhash_count(const UHashtable *hash) {
+ return hash->count;
+}
+
+U_CAPI void* U_EXPORT2
+uhash_get(const UHashtable *hash,
+ const void* key) {
+ UHashTok keyholder;
+ keyholder.pointer = (void*) key;
+ return _uhash_find(hash, keyholder, hash->keyHasher(keyholder))->value.pointer;
+}
+
+U_CAPI void* U_EXPORT2
+uhash_iget(const UHashtable *hash,
+ int32_t key) {
+ UHashTok keyholder;
+ keyholder.integer = key;
+ return _uhash_find(hash, keyholder, hash->keyHasher(keyholder))->value.pointer;
+}
+
+U_CAPI int32_t U_EXPORT2
+uhash_geti(const UHashtable *hash,
+ const void* key) {
+ UHashTok keyholder;
+ keyholder.pointer = (void*) key;
+ return _uhash_find(hash, keyholder, hash->keyHasher(keyholder))->value.integer;
+}
+
+U_CAPI int32_t U_EXPORT2
+uhash_igeti(const UHashtable *hash,
+ int32_t key) {
+ UHashTok keyholder;
+ keyholder.integer = key;
+ return _uhash_find(hash, keyholder, hash->keyHasher(keyholder))->value.integer;
+}
+
+U_CAPI void* U_EXPORT2
+uhash_put(UHashtable *hash,
+ void* key,
+ void* value,
+ UErrorCode *status) {
+ UHashTok keyholder, valueholder;
+ keyholder.pointer = key;
+ valueholder.pointer = value;
+ return _uhash_put(hash, keyholder, valueholder,
+ HINT_KEY_POINTER | HINT_VALUE_POINTER,
+ status).pointer;
+}
+
+U_CAPI void* U_EXPORT2
+uhash_iput(UHashtable *hash,
+ int32_t key,
+ void* value,
+ UErrorCode *status) {
+ UHashTok keyholder, valueholder;
+ keyholder.integer = key;
+ valueholder.pointer = value;
+ return _uhash_put(hash, keyholder, valueholder,
+ HINT_VALUE_POINTER,
+ status).pointer;
+}
+
+U_CAPI int32_t U_EXPORT2
+uhash_puti(UHashtable *hash,
+ void* key,
+ int32_t value,
+ UErrorCode *status) {
+ UHashTok keyholder, valueholder;
+ keyholder.pointer = key;
+ valueholder.integer = value;
+ return _uhash_put(hash, keyholder, valueholder,
+ HINT_KEY_POINTER,
+ status).integer;
+}
+
+
+U_CAPI int32_t U_EXPORT2
+uhash_iputi(UHashtable *hash,
+ int32_t key,
+ int32_t value,
+ UErrorCode *status) {
+ UHashTok keyholder, valueholder;
+ keyholder.integer = key;
+ valueholder.integer = value;
+ return _uhash_put(hash, keyholder, valueholder,
+ 0, /* neither is a ptr */
+ status).integer;
+}
+
+U_CAPI void* U_EXPORT2
+uhash_remove(UHashtable *hash,
+ const void* key) {
+ UHashTok keyholder;
+ keyholder.pointer = (void*) key;
+ return _uhash_remove(hash, keyholder).pointer;
+}
+
+U_CAPI void* U_EXPORT2
+uhash_iremove(UHashtable *hash,
+ int32_t key) {
+ UHashTok keyholder;
+ keyholder.integer = key;
+ return _uhash_remove(hash, keyholder).pointer;
+}
+
+U_CAPI int32_t U_EXPORT2
+uhash_removei(UHashtable *hash,
+ const void* key) {
+ UHashTok keyholder;
+ keyholder.pointer = (void*) key;
+ return _uhash_remove(hash, keyholder).integer;
+}
+
+U_CAPI int32_t U_EXPORT2
+uhash_iremovei(UHashtable *hash,
+ int32_t key) {
+ UHashTok keyholder;
+ keyholder.integer = key;
+ return _uhash_remove(hash, keyholder).integer;
+}
+
+U_CAPI void U_EXPORT2
+uhash_removeAll(UHashtable *hash) {
+ int32_t pos = UHASH_FIRST;
+ const UHashElement *e;
+ U_ASSERT(hash != NULL);
+ if (hash->count != 0) {
+ while ((e = uhash_nextElement(hash, &pos)) != NULL) {
+ uhash_removeElement(hash, e);
+ }
+ }
+ U_ASSERT(hash->count == 0);
+}
+
+U_CAPI const UHashElement* U_EXPORT2
+uhash_find(const UHashtable *hash, const void* key) {
+ UHashTok keyholder;
+ const UHashElement *e;
+ keyholder.pointer = (void*) key;
+ e = _uhash_find(hash, keyholder, hash->keyHasher(keyholder));
+ return IS_EMPTY_OR_DELETED(e->hashcode) ? NULL : e;
+}
+
+U_CAPI const UHashElement* U_EXPORT2
+uhash_nextElement(const UHashtable *hash, int32_t *pos) {
+ /* Walk through the array until we find an element that is not
+ * EMPTY and not DELETED.
+ */
+ int32_t i;
+ U_ASSERT(hash != NULL);
+ for (i = *pos + 1; i < hash->length; ++i) {
+ if (!IS_EMPTY_OR_DELETED(hash->elements[i].hashcode)) {
+ *pos = i;
+ return &(hash->elements[i]);
+ }
+ }
+
+ /* No more elements */
+ return NULL;
+}
+
+U_CAPI void* U_EXPORT2
+uhash_removeElement(UHashtable *hash, const UHashElement* e) {
+ U_ASSERT(hash != NULL);
+ U_ASSERT(e != NULL);
+ if (!IS_EMPTY_OR_DELETED(e->hashcode)) {
+ UHashElement *nce = (UHashElement *)e;
+ return _uhash_internalRemoveElement(hash, nce).pointer;
+ }
+ return NULL;
+}
+
+/********************************************************************
+ * UHashTok convenience
+ ********************************************************************/
+
+/**
+ * Return a UHashTok for an integer.
+ */
+/*U_CAPI UHashTok U_EXPORT2
+uhash_toki(int32_t i) {
+ UHashTok tok;
+ tok.integer = i;
+ return tok;
+}*/
+
+/**
+ * Return a UHashTok for a pointer.
+ */
+/*U_CAPI UHashTok U_EXPORT2
+uhash_tokp(void* p) {
+ UHashTok tok;
+ tok.pointer = p;
+ return tok;
+}*/
+
+/********************************************************************
+ * PUBLIC Key Hash Functions
+ ********************************************************************/
+
+U_CAPI int32_t U_EXPORT2
+uhash_hashUChars(const UHashTok key) {
+ const UChar *s = (const UChar *)key.pointer;
+ return s == NULL ? 0 : ustr_hashUCharsN(s, u_strlen(s));
+}
+
+U_CAPI int32_t U_EXPORT2
+uhash_hashChars(const UHashTok key) {
+ const char *s = (const char *)key.pointer;
+ return s == NULL ? 0 : static_cast<int32_t>(ustr_hashCharsN(s, static_cast<int32_t>(uprv_strlen(s))));
+}
+
+U_CAPI int32_t U_EXPORT2
+uhash_hashIChars(const UHashTok key) {
+ const char *s = (const char *)key.pointer;
+ return s == NULL ? 0 : ustr_hashICharsN(s, static_cast<int32_t>(uprv_strlen(s)));
+}
+
+U_CAPI UBool U_EXPORT2
+uhash_equals(const UHashtable* hash1, const UHashtable* hash2){
+ int32_t count1, count2, pos, i;
+
+ if(hash1==hash2){
+ return TRUE;
+ }
+
+ /*
+ * Make sure that we are comparing 2 valid hashes of the same type
+ * with valid comparison functions.
+ * Without valid comparison functions, a binary comparison
+ * of the hash values will yield random results on machines
+ * with 64-bit pointers and 32-bit integer hashes.
+ * A valueComparator is normally optional.
+ */
+ if (hash1==NULL || hash2==NULL ||
+ hash1->keyComparator != hash2->keyComparator ||
+ hash1->valueComparator != hash2->valueComparator ||
+ hash1->valueComparator == NULL)
+ {
+ /*
+ Normally we would return an error here about incompatible hash tables,
+ but we return FALSE instead.
+ */
+ return FALSE;
+ }
+
+ count1 = uhash_count(hash1);
+ count2 = uhash_count(hash2);
+ if(count1!=count2){
+ return FALSE;
+ }
+
+ pos=UHASH_FIRST;
+ for(i=0; i<count1; i++){
+ const UHashElement* elem1 = uhash_nextElement(hash1, &pos);
+ const UHashTok key1 = elem1->key;
+ const UHashTok val1 = elem1->value;
+ /* here the keys are not compared, instead the key form hash1 is used to fetch
+ * value from hash2. If the hashes are equal then then both hashes should
+ * contain equal values for the same key!
+ */
+ const UHashElement* elem2 = _uhash_find(hash2, key1, hash2->keyHasher(key1));
+ const UHashTok val2 = elem2->value;
+ if(hash1->valueComparator(val1, val2)==FALSE){
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+/********************************************************************
+ * PUBLIC Comparator Functions
+ ********************************************************************/
+
+U_CAPI UBool U_EXPORT2
+uhash_compareUChars(const UHashTok key1, const UHashTok key2) {
+ const UChar *p1 = (const UChar*) key1.pointer;
+ const UChar *p2 = (const UChar*) key2.pointer;
+ if (p1 == p2) {
+ return TRUE;
+ }
+ if (p1 == NULL || p2 == NULL) {
+ return FALSE;
+ }
+ while (*p1 != 0 && *p1 == *p2) {
+ ++p1;
+ ++p2;
+ }
+ return (UBool)(*p1 == *p2);
+}
+
+U_CAPI UBool U_EXPORT2
+uhash_compareChars(const UHashTok key1, const UHashTok key2) {
+ const char *p1 = (const char*) key1.pointer;
+ const char *p2 = (const char*) key2.pointer;
+ if (p1 == p2) {
+ return TRUE;
+ }
+ if (p1 == NULL || p2 == NULL) {
+ return FALSE;
+ }
+ while (*p1 != 0 && *p1 == *p2) {
+ ++p1;
+ ++p2;
+ }
+ return (UBool)(*p1 == *p2);
+}
+
+U_CAPI UBool U_EXPORT2
+uhash_compareIChars(const UHashTok key1, const UHashTok key2) {
+ const char *p1 = (const char*) key1.pointer;
+ const char *p2 = (const char*) key2.pointer;
+ if (p1 == p2) {
+ return TRUE;
+ }
+ if (p1 == NULL || p2 == NULL) {
+ return FALSE;
+ }
+ while (*p1 != 0 && uprv_tolower(*p1) == uprv_tolower(*p2)) {
+ ++p1;
+ ++p2;
+ }
+ return (UBool)(*p1 == *p2);
+}
+
+/********************************************************************
+ * PUBLIC int32_t Support Functions
+ ********************************************************************/
+
+U_CAPI int32_t U_EXPORT2
+uhash_hashLong(const UHashTok key) {
+ return key.integer;
+}
+
+U_CAPI UBool U_EXPORT2
+uhash_compareLong(const UHashTok key1, const UHashTok key2) {
+ return (UBool)(key1.integer == key2.integer);
+}
diff --git a/contrib/libs/icu/common/uhash.h b/contrib/libs/icu/common/uhash.h
index 9d22dbd14d..b59d2711bb 100644
--- a/contrib/libs/icu/common/uhash.h
+++ b/contrib/libs/icu/common/uhash.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -154,7 +154,7 @@ struct UHashtable {
* If NULL won't do anything */
/* Size parameters */
-
+
int32_t count; /* The number of key-value pairs in this table.
* 0 <= count <= length. In practice we
* never let count == length (see code). */
@@ -162,12 +162,12 @@ struct UHashtable {
* and values. Must be prime. */
/* Rehashing thresholds */
-
+
int32_t highWaterMark; /* If count > highWaterMark, rehash */
int32_t lowWaterMark; /* If count < lowWaterMark, rehash */
float highWaterRatio; /* 0..1; high water as a fraction of length */
float lowWaterRatio; /* 0..1; low water as a fraction of length */
-
+
int8_t primeIndex; /* Index into our prime table for length.
* length == PRIMES[primeIndex] */
UBool allocated; /* Was this UHashtable allocated? */
@@ -190,7 +190,7 @@ U_CDECL_END
* @return A pointer to a UHashtable, or 0 if an error occurred.
* @see uhash_openSize
*/
-U_CAPI UHashtable* U_EXPORT2
+U_CAPI UHashtable* U_EXPORT2
uhash_open(UHashFunction *keyHash,
UKeyComparator *keyComp,
UValueComparator *valueComp,
@@ -207,7 +207,7 @@ uhash_open(UHashFunction *keyHash,
* @return A pointer to a UHashtable, or 0 if an error occurred.
* @see uhash_open
*/
-U_CAPI UHashtable* U_EXPORT2
+U_CAPI UHashtable* U_EXPORT2
uhash_openSize(UHashFunction *keyHash,
UKeyComparator *keyComp,
UValueComparator *valueComp,
@@ -224,7 +224,7 @@ uhash_openSize(UHashFunction *keyHash,
* @return A pointer to a UHashtable, or 0 if an error occurred.
* @see uhash_openSize
*/
-U_CAPI UHashtable* U_EXPORT2
+U_CAPI UHashtable* U_EXPORT2
uhash_init(UHashtable *hash,
UHashFunction *keyHash,
UKeyComparator *keyComp,
@@ -232,29 +232,29 @@ uhash_init(UHashtable *hash,
UErrorCode *status);
/**
- * Initialize an existing UHashtable.
- * @param keyHash A pointer to the key hashing function. Must not be
- * NULL.
- * @param keyComp A pointer to the function that compares keys. Must
- * not be NULL.
- * @param size The initial capacity of this hash table.
- * @param status A pointer to an UErrorCode to receive any errors.
- * @return A pointer to a UHashtable, or 0 if an error occurred.
- * @see uhash_openSize
- */
-U_CAPI UHashtable* U_EXPORT2
-uhash_initSize(UHashtable *hash,
- UHashFunction *keyHash,
- UKeyComparator *keyComp,
- UValueComparator *valueComp,
- int32_t size,
- UErrorCode *status);
-
-/**
+ * Initialize an existing UHashtable.
+ * @param keyHash A pointer to the key hashing function. Must not be
+ * NULL.
+ * @param keyComp A pointer to the function that compares keys. Must
+ * not be NULL.
+ * @param size The initial capacity of this hash table.
+ * @param status A pointer to an UErrorCode to receive any errors.
+ * @return A pointer to a UHashtable, or 0 if an error occurred.
+ * @see uhash_openSize
+ */
+U_CAPI UHashtable* U_EXPORT2
+uhash_initSize(UHashtable *hash,
+ UHashFunction *keyHash,
+ UKeyComparator *keyComp,
+ UValueComparator *valueComp,
+ int32_t size,
+ UErrorCode *status);
+
+/**
* Close a UHashtable, releasing the memory used.
* @param hash The UHashtable to close. If hash is NULL no operation is performed.
*/
-U_CAPI void U_EXPORT2
+U_CAPI void U_EXPORT2
uhash_close(UHashtable *hash);
@@ -265,7 +265,7 @@ uhash_close(UHashtable *hash);
* @param fn the function to be used hash keys; must not be NULL
* @return the previous key hasher; non-NULL
*/
-U_CAPI UHashFunction *U_EXPORT2
+U_CAPI UHashFunction *U_EXPORT2
uhash_setKeyHasher(UHashtable *hash, UHashFunction *fn);
/**
@@ -275,7 +275,7 @@ uhash_setKeyHasher(UHashtable *hash, UHashFunction *fn);
* @param fn the function to be used compare keys; must not be NULL
* @return the previous key comparator; non-NULL
*/
-U_CAPI UKeyComparator *U_EXPORT2
+U_CAPI UKeyComparator *U_EXPORT2
uhash_setKeyComparator(UHashtable *hash, UKeyComparator *fn);
/**
@@ -285,7 +285,7 @@ uhash_setKeyComparator(UHashtable *hash, UKeyComparator *fn);
* @param fn the function to be used compare keys; must not be NULL
* @return the previous key comparator; non-NULL
*/
-U_CAPI UValueComparator *U_EXPORT2
+U_CAPI UValueComparator *U_EXPORT2
uhash_setValueComparator(UHashtable *hash, UValueComparator *fn);
/**
@@ -298,7 +298,7 @@ uhash_setValueComparator(UHashtable *hash, UValueComparator *fn);
* @param fn the function to be used delete keys, or NULL
* @return the previous key deleter; may be NULL
*/
-U_CAPI UObjectDeleter *U_EXPORT2
+U_CAPI UObjectDeleter *U_EXPORT2
uhash_setKeyDeleter(UHashtable *hash, UObjectDeleter *fn);
/**
@@ -311,7 +311,7 @@ uhash_setKeyDeleter(UHashtable *hash, UObjectDeleter *fn);
* @param fn the function to be used delete values, or NULL
* @return the previous value deleter; may be NULL
*/
-U_CAPI UObjectDeleter *U_EXPORT2
+U_CAPI UObjectDeleter *U_EXPORT2
uhash_setValueDeleter(UHashtable *hash, UObjectDeleter *fn);
/**
@@ -321,7 +321,7 @@ uhash_setValueDeleter(UHashtable *hash, UObjectDeleter *fn);
* @param hash The UHashtable to set
* @param policy The way the hashtable resizes itself, {U_GROW, U_GROW_AND_SHRINK, U_FIXED}
*/
-U_CAPI void U_EXPORT2
+U_CAPI void U_EXPORT2
uhash_setResizePolicy(UHashtable *hash, enum UHashResizePolicy policy);
/**
@@ -329,7 +329,7 @@ uhash_setResizePolicy(UHashtable *hash, enum UHashResizePolicy policy);
* @param hash The UHashtable to query.
* @return The number of key-value pairs stored in hash.
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
uhash_count(const UHashtable *hash);
/**
@@ -345,7 +345,7 @@ uhash_count(const UHashtable *hash);
* @return The previous value, or NULL if none.
* @see uhash_get
*/
-U_CAPI void* U_EXPORT2
+U_CAPI void* U_EXPORT2
uhash_put(UHashtable *hash,
void *key,
void *value,
@@ -363,7 +363,7 @@ uhash_put(UHashtable *hash,
* @return The previous value, or NULL if none.
* @see uhash_get
*/
-U_CAPI void* U_EXPORT2
+U_CAPI void* U_EXPORT2
uhash_iput(UHashtable *hash,
int32_t key,
void* value,
@@ -381,7 +381,7 @@ uhash_iput(UHashtable *hash,
* @return The previous value, or 0 if none.
* @see uhash_get
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
uhash_puti(UHashtable *hash,
void* key,
int32_t value,
@@ -399,7 +399,7 @@ uhash_puti(UHashtable *hash,
* @return The previous value, or 0 if none.
* @see uhash_get
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
uhash_iputi(UHashtable *hash,
int32_t key,
int32_t value,
@@ -412,8 +412,8 @@ uhash_iputi(UHashtable *hash,
* @param key A pointer key stored in a hashtable
* @return The requested item, or NULL if not found.
*/
-U_CAPI void* U_EXPORT2
-uhash_get(const UHashtable *hash,
+U_CAPI void* U_EXPORT2
+uhash_get(const UHashtable *hash,
const void *key);
/**
@@ -423,7 +423,7 @@ uhash_get(const UHashtable *hash,
* @param key An integer key stored in a hashtable
* @return The requested item, or NULL if not found.
*/
-U_CAPI void* U_EXPORT2
+U_CAPI void* U_EXPORT2
uhash_iget(const UHashtable *hash,
int32_t key);
@@ -434,7 +434,7 @@ uhash_iget(const UHashtable *hash,
* @param key A pointer key stored in a hashtable
* @return The requested item, or 0 if not found.
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
uhash_geti(const UHashtable *hash,
const void* key);
/**
@@ -444,7 +444,7 @@ uhash_geti(const UHashtable *hash,
* @param key An integer key stored in a hashtable
* @return The requested item, or 0 if not found.
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
uhash_igeti(const UHashtable *hash,
int32_t key);
@@ -454,7 +454,7 @@ uhash_igeti(const UHashtable *hash,
* @param key A key stored in a hashtable
* @return The item removed, or NULL if not found.
*/
-U_CAPI void* U_EXPORT2
+U_CAPI void* U_EXPORT2
uhash_remove(UHashtable *hash,
const void *key);
@@ -464,7 +464,7 @@ uhash_remove(UHashtable *hash,
* @param key An integer key stored in a hashtable
* @return The item removed, or NULL if not found.
*/
-U_CAPI void* U_EXPORT2
+U_CAPI void* U_EXPORT2
uhash_iremove(UHashtable *hash,
int32_t key);
@@ -474,7 +474,7 @@ uhash_iremove(UHashtable *hash,
* @param key An key stored in a hashtable
* @return The item removed, or 0 if not found.
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
uhash_removei(UHashtable *hash,
const void* key);
@@ -484,7 +484,7 @@ uhash_removei(UHashtable *hash,
* @param key An integer key stored in a hashtable
* @return The item removed, or 0 if not found.
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
uhash_iremovei(UHashtable *hash,
int32_t key);
@@ -492,7 +492,7 @@ uhash_iremovei(UHashtable *hash,
* Remove all items from a UHashtable.
* @param hash The target UHashtable.
*/
-U_CAPI void U_EXPORT2
+U_CAPI void U_EXPORT2
uhash_removeAll(UHashtable *hash);
/**
@@ -506,7 +506,7 @@ uhash_removeAll(UHashtable *hash);
* @param key A key stored in a hashtable
* @return a hash element, or NULL if the key is not found.
*/
-U_CAPI const UHashElement* U_EXPORT2
+U_CAPI const UHashElement* U_EXPORT2
uhash_find(const UHashtable *hash, const void* key);
/**
@@ -529,7 +529,7 @@ uhash_find(const UHashtable *hash, const void* key);
* @return a hash element, or NULL if no further key-value pairs
* exist in the table.
*/
-U_CAPI const UHashElement* U_EXPORT2
+U_CAPI const UHashElement* U_EXPORT2
uhash_nextElement(const UHashtable *hash,
int32_t *pos);
@@ -544,7 +544,7 @@ uhash_nextElement(const UHashtable *hash,
* modified.
* @return the value that was removed.
*/
-U_CAPI void* U_EXPORT2
+U_CAPI void* U_EXPORT2
uhash_removeElement(UHashtable *hash, const UHashElement* e);
/********************************************************************
@@ -556,7 +556,7 @@ uhash_removeElement(UHashtable *hash, const UHashElement* e);
* @param i The given integer
* @return a UHashTok for an integer.
*/
-/*U_CAPI UHashTok U_EXPORT2
+/*U_CAPI UHashTok U_EXPORT2
uhash_toki(int32_t i);*/
/**
@@ -564,7 +564,7 @@ uhash_toki(int32_t i);*/
* @param p The given pointer
* @return a UHashTok for a pointer.
*/
-/*U_CAPI UHashTok U_EXPORT2
+/*U_CAPI UHashTok U_EXPORT2
uhash_tokp(void* p);*/
/********************************************************************
@@ -578,7 +578,7 @@ uhash_tokp(void* p);*/
* @param key The string (const UChar*) to hash.
* @return A hash code for the key.
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
uhash_hashUChars(const UHashTok key);
/**
@@ -588,7 +588,7 @@ uhash_hashUChars(const UHashTok key);
* @param key The string (const char*) to hash.
* @return A hash code for the key.
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
uhash_hashChars(const UHashTok key);
/**
@@ -608,7 +608,7 @@ uhash_hashIChars(const UHashTok key);
* @param key2 The string for comparison
* @return true if key1 and key2 are equal, return false otherwise.
*/
-U_CAPI UBool U_EXPORT2
+U_CAPI UBool U_EXPORT2
uhash_compareUChars(const UHashTok key1, const UHashTok key2);
/**
@@ -618,7 +618,7 @@ uhash_compareUChars(const UHashTok key1, const UHashTok key2);
* @param key2 The string for comparison
* @return true if key1 and key2 are equal, return false otherwise.
*/
-U_CAPI UBool U_EXPORT2
+U_CAPI UBool U_EXPORT2
uhash_compareChars(const UHashTok key1, const UHashTok key2);
/**
@@ -628,7 +628,7 @@ uhash_compareChars(const UHashTok key1, const UHashTok key2);
* @param key2 The string for comparison
* @return true if key1 and key2 are equal, return false otherwise.
*/
-U_CAPI UBool U_EXPORT2
+U_CAPI UBool U_EXPORT2
uhash_compareIChars(const UHashTok key1, const UHashTok key2);
/********************************************************************
@@ -640,7 +640,7 @@ uhash_compareIChars(const UHashTok key1, const UHashTok key2);
* @param key The string (const char*) to hash.
* @return A hash code for the key.
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
uhash_hashUnicodeString(const UElement key);
/**
@@ -649,7 +649,7 @@ uhash_hashUnicodeString(const UElement key);
* @param key The string (const char*) to hash.
* @return A hash code for the key.
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
uhash_hashCaselessUnicodeString(const UElement key);
/********************************************************************
@@ -661,7 +661,7 @@ uhash_hashCaselessUnicodeString(const UElement key);
* @param key The string (const char*) to hash.
* @return A hash code for the key.
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
uhash_hashLong(const UHashTok key);
/**
@@ -670,7 +670,7 @@ uhash_hashLong(const UHashTok key);
* @param Key2 The integer for comparison
* @return true if key1 and key2 are equal, return false otherwise
*/
-U_CAPI UBool U_EXPORT2
+U_CAPI UBool U_EXPORT2
uhash_compareLong(const UHashTok key1, const UHashTok key2);
/********************************************************************
@@ -681,7 +681,7 @@ uhash_compareLong(const UHashTok key1, const UHashTok key2);
* Deleter for Hashtable objects.
* @param obj The object to be deleted
*/
-U_CAPI void U_EXPORT2
+U_CAPI void U_EXPORT2
uhash_deleteHashtable(void *obj);
/* Use uprv_free() itself as a deleter for any key or value allocated using uprv_malloc. */
@@ -692,7 +692,7 @@ uhash_deleteHashtable(void *obj);
* @param hash2
* @return true if the hashtables are equal and false if not.
*/
-U_CAPI UBool U_EXPORT2
+U_CAPI UBool U_EXPORT2
uhash_equals(const UHashtable* hash1, const UHashtable* hash2);
diff --git a/contrib/libs/icu/common/uhash_us.cpp b/contrib/libs/icu/common/uhash_us.cpp
index 368e7065c9..ef482c2746 100644
--- a/contrib/libs/icu/common/uhash_us.cpp
+++ b/contrib/libs/icu/common/uhash_us.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/common/uidna.cpp b/contrib/libs/icu/common/uidna.cpp
index f051e35a93..ac2f9c3c8c 100644
--- a/contrib/libs/icu/common/uidna.cpp
+++ b/contrib/libs/icu/common/uidna.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: uidna.cpp
- * encoding: UTF-8
+ * encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -63,10 +63,10 @@ startsWithPrefix(const UChar* src , int32_t srcLength){
for(int8_t i=0; i< ACE_PREFIX_LENGTH; i++){
if(toASCIILower(src[i]) != ACE_PREFIX[i]){
- return FALSE;
+ return FALSE;
}
}
- return TRUE;
+ return TRUE;
}
@@ -439,7 +439,7 @@ _internal_toUnicode(const UChar* src, int32_t srcLength,
for(int32_t j=0; j<srcLength; j++){
if(src[j]> 0x7f){
srcIsASCII = FALSE;
- break;
+ break;
}/*else if(isLDHChar(src[j])==FALSE){
// here we do not assemble surrogates
// since we know that LDH code points
diff --git a/contrib/libs/icu/common/uinit.cpp b/contrib/libs/icu/common/uinit.cpp
index d65fc70529..624431be02 100644
--- a/contrib/libs/icu/common/uinit.cpp
+++ b/contrib/libs/icu/common/uinit.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
******************************************************************************
* file name: uinit.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/uinvchar.cpp b/contrib/libs/icu/common/uinvchar.cpp
index a1b1d7d252..05bcf10df4 100644
--- a/contrib/libs/icu/common/uinvchar.cpp
+++ b/contrib/libs/icu/common/uinvchar.cpp
@@ -1,627 +1,627 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-*******************************************************************************
-*
-* Copyright (C) 1999-2010, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-*******************************************************************************
-* file name: uinvchar.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:2
-*
-* created on: 2004sep14
-* created by: Markus W. Scherer
-*
-* Functions for handling invariant characters, moved here from putil.c
-* for better modularization.
-*/
-
-#include "unicode/utypes.h"
-#include "unicode/ustring.h"
-#include "udataswp.h"
-#include "cstring.h"
-#include "cmemory.h"
-#include "uassert.h"
-#include "uinvchar.h"
-
-/* invariant-character handling --------------------------------------------- */
-
-/*
- * These maps for ASCII to/from EBCDIC map invariant characters (see utypes.h)
- * appropriately for most EBCDIC codepages.
- *
- * They currently also map most other ASCII graphic characters,
- * appropriately for codepages 37 and 1047.
- * Exceptions: The characters for []^ have different codes in 37 & 1047.
- * Both versions are mapped to ASCII.
- *
- * ASCII 37 1047
- * [ 5B BA AD
- * ] 5D BB BD
- * ^ 5E B0 5F
- *
- * There are no mappings for variant characters from Unicode to EBCDIC.
- *
- * Currently, C0 control codes are also included in these maps.
- * Exceptions: S/390 Open Edition swaps LF and NEL codes compared with other
- * EBCDIC platforms; both codes (15 and 25) are mapped to ASCII LF (0A),
- * but there is no mapping for ASCII LF back to EBCDIC.
- *
- * ASCII EBCDIC S/390-OE
- * LF 0A 25 15
- * NEL 85 15 25
- *
- * The maps below explicitly exclude the variant
- * control and graphical characters that are in ASCII-based
- * codepages at 0x80 and above.
- * "No mapping" is expressed by mapping to a 00 byte.
- *
- * These tables do not establish a converter or a codepage.
- */
-
-static const uint8_t asciiFromEbcdic[256]={
- 0x00, 0x01, 0x02, 0x03, 0x00, 0x09, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x00, 0x0a, 0x08, 0x00, 0x18, 0x19, 0x00, 0x00, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x17, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x06, 0x07,
- 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x14, 0x15, 0x00, 0x1a,
-
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x3c, 0x28, 0x2b, 0x7c,
- 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e,
- 0x2d, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22,
-
- 0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00,
- 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x5d, 0x00, 0x5d, 0x00, 0x00,
-
- 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x5c, 0x00, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-static const uint8_t ebcdicFromAscii[256]={
- 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, 0x16, 0x05, 0x00, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x40, 0x00, 0x7f, 0x00, 0x00, 0x6c, 0x50, 0x7d, 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,
-
- 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
- 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0x00, 0x00, 0x00, 0x00, 0x6d,
- 0x00, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
- 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0x00, 0x00, 0x00, 0x00, 0x07,
-
- 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, 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, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-/* Same as asciiFromEbcdic[] except maps all letters to lowercase. */
-static const uint8_t lowercaseAsciiFromEbcdic[256]={
- 0x00, 0x01, 0x02, 0x03, 0x00, 0x09, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x00, 0x0a, 0x08, 0x00, 0x18, 0x19, 0x00, 0x00, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x17, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x06, 0x07,
- 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x14, 0x15, 0x00, 0x1a,
-
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x3c, 0x28, 0x2b, 0x7c,
- 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e,
- 0x2d, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22,
-
- 0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00,
- 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x5d, 0x00, 0x5d, 0x00, 0x00,
-
- 0x7b, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x7d, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x7c, 0x00, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-/*
- * Bit sets indicating which characters of the ASCII repertoire
- * (by ASCII/Unicode code) are "invariant".
- * See utypes.h for more details.
- *
- * As invariant are considered the characters of the ASCII repertoire except
- * for the following:
- * 21 '!' <exclamation mark>
- * 23 '#' <number sign>
- * 24 '$' <dollar sign>
- *
- * 40 '@' <commercial at>
- *
- * 5b '[' <left bracket>
- * 5c '\' <backslash>
- * 5d ']' <right bracket>
- * 5e '^' <circumflex>
- *
- * 60 '`' <grave accent>
- *
- * 7b '{' <left brace>
- * 7c '|' <vertical line>
- * 7d '}' <right brace>
- * 7e '~' <tilde>
- */
-static const uint32_t invariantChars[4]={
- 0xfffffbff, /* 00..1f but not 0a */
- 0xffffffe5, /* 20..3f but not 21 23 24 */
- 0x87fffffe, /* 40..5f but not 40 5b..5e */
- 0x87fffffe /* 60..7f but not 60 7b..7e */
-};
-
-/*
- * test unsigned types (or values known to be non-negative) for invariant characters,
- * tests ASCII-family character values
- */
-#define UCHAR_IS_INVARIANT(c) (((c)<=0x7f) && (invariantChars[(c)>>5]&((uint32_t)1<<((c)&0x1f)))!=0)
-
-/* test signed types for invariant characters, adds test for positive values */
-#define SCHAR_IS_INVARIANT(c) ((0<=(c)) && UCHAR_IS_INVARIANT(c))
-
-#if U_CHARSET_FAMILY==U_ASCII_FAMILY
-#define CHAR_TO_UCHAR(c) c
-#define UCHAR_TO_CHAR(c) c
-#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
-#define CHAR_TO_UCHAR(u) asciiFromEbcdic[u]
-#define UCHAR_TO_CHAR(u) ebcdicFromAscii[u]
-#else
-# error U_CHARSET_FAMILY is not valid
-#endif
-
-
-U_CAPI void U_EXPORT2
-u_charsToUChars(const char *cs, UChar *us, int32_t length) {
- UChar u;
- uint8_t c;
-
- /*
- * Allow the entire ASCII repertoire to be mapped _to_ Unicode.
- * For EBCDIC systems, this works for characters with codes from
- * codepages 37 and 1047 or compatible.
- */
- while(length>0) {
- c=(uint8_t)(*cs++);
- u=(UChar)CHAR_TO_UCHAR(c);
- U_ASSERT((u!=0 || c==0)); /* only invariant chars converted? */
- *us++=u;
- --length;
- }
-}
-
-U_CAPI void U_EXPORT2
-u_UCharsToChars(const UChar *us, char *cs, int32_t length) {
- UChar u;
-
- while(length>0) {
- u=*us++;
- if(!UCHAR_IS_INVARIANT(u)) {
- U_ASSERT(FALSE); /* Variant characters were used. These are not portable in ICU. */
- u=0;
- }
- *cs++=(char)UCHAR_TO_CHAR(u);
- --length;
- }
-}
-
-U_CAPI UBool U_EXPORT2
-uprv_isInvariantString(const char *s, int32_t length) {
- uint8_t c;
-
- for(;;) {
- if(length<0) {
- /* NUL-terminated */
- c=(uint8_t)*s++;
- if(c==0) {
- break;
- }
- } else {
- /* count length */
- if(length==0) {
- break;
- }
- --length;
- c=(uint8_t)*s++;
- if(c==0) {
- continue; /* NUL is invariant */
- }
- }
- /* c!=0 now, one branch below checks c==0 for variant characters */
-
- /*
- * no assertions here because these functions are legitimately called
- * for strings with variant characters
- */
-#if U_CHARSET_FAMILY==U_ASCII_FAMILY
- if(!UCHAR_IS_INVARIANT(c)) {
- return FALSE; /* found a variant char */
- }
-#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
- c=CHAR_TO_UCHAR(c);
- if(c==0 || !UCHAR_IS_INVARIANT(c)) {
- return FALSE; /* found a variant char */
- }
-#else
-# error U_CHARSET_FAMILY is not valid
-#endif
- }
- return TRUE;
-}
-
-U_CAPI UBool U_EXPORT2
-uprv_isInvariantUString(const UChar *s, int32_t length) {
- UChar c;
-
- for(;;) {
- if(length<0) {
- /* NUL-terminated */
- c=*s++;
- if(c==0) {
- break;
- }
- } else {
- /* count length */
- if(length==0) {
- break;
- }
- --length;
- c=*s++;
- }
-
- /*
- * no assertions here because these functions are legitimately called
- * for strings with variant characters
- */
- if(!UCHAR_IS_INVARIANT(c)) {
- return FALSE; /* found a variant char */
- }
- }
- return TRUE;
-}
-
-/* UDataSwapFn implementations used in udataswp.c ------- */
-
-/* convert ASCII to EBCDIC and verify that all characters are invariant */
-U_CAPI int32_t U_EXPORT2
-uprv_ebcdicFromAscii(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode) {
- const uint8_t *s;
- uint8_t *t;
- uint8_t c;
-
- int32_t count;
-
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
- if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* setup and swapping */
- s=(const uint8_t *)inData;
- t=(uint8_t *)outData;
- count=length;
- while(count>0) {
- c=*s++;
- if(!UCHAR_IS_INVARIANT(c)) {
- udata_printError(ds, "uprv_ebcdicFromAscii() string[%d] contains a variant character in position %d\n",
- length, length-count);
- *pErrorCode=U_INVALID_CHAR_FOUND;
- return 0;
- }
- *t++=ebcdicFromAscii[c];
- --count;
- }
-
- return length;
-}
-
-/* this function only checks and copies ASCII strings without conversion */
-U_CFUNC int32_t
-uprv_copyAscii(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode) {
- const uint8_t *s;
- uint8_t c;
-
- int32_t count;
-
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
- if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* setup and checking */
- s=(const uint8_t *)inData;
- count=length;
- while(count>0) {
- c=*s++;
- if(!UCHAR_IS_INVARIANT(c)) {
- udata_printError(ds, "uprv_copyFromAscii() string[%d] contains a variant character in position %d\n",
- length, length-count);
- *pErrorCode=U_INVALID_CHAR_FOUND;
- return 0;
- }
- --count;
- }
-
- if(length>0 && inData!=outData) {
- uprv_memcpy(outData, inData, length);
- }
-
- return length;
-}
-
-/* convert EBCDIC to ASCII and verify that all characters are invariant */
-U_CFUNC int32_t
-uprv_asciiFromEbcdic(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode) {
- const uint8_t *s;
- uint8_t *t;
- uint8_t c;
-
- int32_t count;
-
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
- if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* setup and swapping */
- s=(const uint8_t *)inData;
- t=(uint8_t *)outData;
- count=length;
- while(count>0) {
- c=*s++;
- if(c!=0 && ((c=asciiFromEbcdic[c])==0 || !UCHAR_IS_INVARIANT(c))) {
- udata_printError(ds, "uprv_asciiFromEbcdic() string[%d] contains a variant character in position %d\n",
- length, length-count);
- *pErrorCode=U_INVALID_CHAR_FOUND;
- return 0;
- }
- *t++=c;
- --count;
- }
-
- return length;
-}
-
-/* this function only checks and copies EBCDIC strings without conversion */
-U_CFUNC int32_t
-uprv_copyEbcdic(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode) {
- const uint8_t *s;
- uint8_t c;
-
- int32_t count;
-
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
- if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* setup and checking */
- s=(const uint8_t *)inData;
- count=length;
- while(count>0) {
- c=*s++;
- if(c!=0 && ((c=asciiFromEbcdic[c])==0 || !UCHAR_IS_INVARIANT(c))) {
- udata_printError(ds, "uprv_copyEbcdic() string[%] contains a variant character in position %d\n",
- length, length-count);
- *pErrorCode=U_INVALID_CHAR_FOUND;
- return 0;
- }
- --count;
- }
-
- if(length>0 && inData!=outData) {
- uprv_memcpy(outData, inData, length);
- }
-
- return length;
-}
-
-U_CFUNC UBool
-uprv_isEbcdicAtSign(char c) {
- static const uint8_t ebcdicAtSigns[] = {
- 0x7C, 0x44, 0x66, 0x80, 0xAC, 0xAE, 0xAF, 0xB5, 0xEC, 0xEF, 0x00 };
- return c != 0 && uprv_strchr((const char *)ebcdicAtSigns, c) != nullptr;
-}
-
-/* compare invariant strings; variant characters compare less than others and unlike each other */
-U_CFUNC int32_t
-uprv_compareInvAscii(const UDataSwapper *ds,
- const char *outString, int32_t outLength,
- const UChar *localString, int32_t localLength) {
- (void)ds;
- int32_t minLength;
- UChar32 c1, c2;
- uint8_t c;
-
- if(outString==NULL || outLength<-1 || localString==NULL || localLength<-1) {
- return 0;
- }
-
- if(outLength<0) {
- outLength=(int32_t)uprv_strlen(outString);
- }
- if(localLength<0) {
- localLength=u_strlen(localString);
- }
-
- minLength= outLength<localLength ? outLength : localLength;
-
- while(minLength>0) {
- c=(uint8_t)*outString++;
- if(UCHAR_IS_INVARIANT(c)) {
- c1=c;
- } else {
- c1=-1;
- }
-
- c2=*localString++;
- if(!UCHAR_IS_INVARIANT(c2)) {
- c2=-2;
- }
-
- if((c1-=c2)!=0) {
- return c1;
- }
-
- --minLength;
- }
-
- /* strings start with same prefix, compare lengths */
- return outLength-localLength;
-}
-
-U_CFUNC int32_t
-uprv_compareInvEbcdic(const UDataSwapper *ds,
- const char *outString, int32_t outLength,
- const UChar *localString, int32_t localLength) {
- (void)ds;
- int32_t minLength;
- UChar32 c1, c2;
- uint8_t c;
-
- if(outString==NULL || outLength<-1 || localString==NULL || localLength<-1) {
- return 0;
- }
-
- if(outLength<0) {
- outLength=(int32_t)uprv_strlen(outString);
- }
- if(localLength<0) {
- localLength=u_strlen(localString);
- }
-
- minLength= outLength<localLength ? outLength : localLength;
-
- while(minLength>0) {
- c=(uint8_t)*outString++;
- if(c==0) {
- c1=0;
- } else if((c1=asciiFromEbcdic[c])!=0 && UCHAR_IS_INVARIANT(c1)) {
- /* c1 is set */
- } else {
- c1=-1;
- }
-
- c2=*localString++;
- if(!UCHAR_IS_INVARIANT(c2)) {
- c2=-2;
- }
-
- if((c1-=c2)!=0) {
- return c1;
- }
-
- --minLength;
- }
-
- /* strings start with same prefix, compare lengths */
- return outLength-localLength;
-}
-
-U_CAPI int32_t U_EXPORT2
-uprv_compareInvEbcdicAsAscii(const char *s1, const char *s2) {
- int32_t c1, c2;
-
- for(;; ++s1, ++s2) {
- c1=(uint8_t)*s1;
- c2=(uint8_t)*s2;
- if(c1!=c2) {
- if(c1!=0 && ((c1=asciiFromEbcdic[c1])==0 || !UCHAR_IS_INVARIANT(c1))) {
- c1=-(int32_t)(uint8_t)*s1;
- }
- if(c2!=0 && ((c2=asciiFromEbcdic[c2])==0 || !UCHAR_IS_INVARIANT(c2))) {
- c2=-(int32_t)(uint8_t)*s2;
- }
- return c1-c2;
- } else if(c1==0) {
- return 0;
- }
- }
-}
-
-U_CAPI char U_EXPORT2
-uprv_ebcdicToAscii(char c) {
- return (char)asciiFromEbcdic[(uint8_t)c];
-}
-
-U_CAPI char U_EXPORT2
-uprv_ebcdicToLowercaseAscii(char c) {
- return (char)lowercaseAsciiFromEbcdic[(uint8_t)c];
-}
-
-U_INTERNAL uint8_t* U_EXPORT2
-uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n)
-{
- uint8_t *orig_dst = dst;
-
- if(n==-1) {
- n = static_cast<int32_t>(uprv_strlen((const char*)src)+1); /* copy NUL */
- }
- /* copy non-null */
- while(*src && n>0) {
- *(dst++) = asciiFromEbcdic[*(src++)];
- n--;
- }
- /* pad */
- while(n>0) {
- *(dst++) = 0;
- n--;
- }
- return orig_dst;
-}
-
-U_INTERNAL uint8_t* U_EXPORT2
-uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n)
-{
- uint8_t *orig_dst = dst;
-
- if(n==-1) {
- n = static_cast<int32_t>(uprv_strlen((const char*)src)+1); /* copy NUL */
- }
- /* copy non-null */
- while(*src && n>0) {
- char ch = ebcdicFromAscii[*(src++)];
- if(ch == 0) {
- ch = ebcdicFromAscii[0x3f]; /* questionmark (subchar) */
- }
- *(dst++) = ch;
- n--;
- }
- /* pad */
- while(n>0) {
- *(dst++) = 0;
- n--;
- }
- return orig_dst;
-}
-
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+* Copyright (C) 1999-2010, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: uinvchar.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:2
+*
+* created on: 2004sep14
+* created by: Markus W. Scherer
+*
+* Functions for handling invariant characters, moved here from putil.c
+* for better modularization.
+*/
+
+#include "unicode/utypes.h"
+#include "unicode/ustring.h"
+#include "udataswp.h"
+#include "cstring.h"
+#include "cmemory.h"
+#include "uassert.h"
+#include "uinvchar.h"
+
+/* invariant-character handling --------------------------------------------- */
+
+/*
+ * These maps for ASCII to/from EBCDIC map invariant characters (see utypes.h)
+ * appropriately for most EBCDIC codepages.
+ *
+ * They currently also map most other ASCII graphic characters,
+ * appropriately for codepages 37 and 1047.
+ * Exceptions: The characters for []^ have different codes in 37 & 1047.
+ * Both versions are mapped to ASCII.
+ *
+ * ASCII 37 1047
+ * [ 5B BA AD
+ * ] 5D BB BD
+ * ^ 5E B0 5F
+ *
+ * There are no mappings for variant characters from Unicode to EBCDIC.
+ *
+ * Currently, C0 control codes are also included in these maps.
+ * Exceptions: S/390 Open Edition swaps LF and NEL codes compared with other
+ * EBCDIC platforms; both codes (15 and 25) are mapped to ASCII LF (0A),
+ * but there is no mapping for ASCII LF back to EBCDIC.
+ *
+ * ASCII EBCDIC S/390-OE
+ * LF 0A 25 15
+ * NEL 85 15 25
+ *
+ * The maps below explicitly exclude the variant
+ * control and graphical characters that are in ASCII-based
+ * codepages at 0x80 and above.
+ * "No mapping" is expressed by mapping to a 00 byte.
+ *
+ * These tables do not establish a converter or a codepage.
+ */
+
+static const uint8_t asciiFromEbcdic[256]={
+ 0x00, 0x01, 0x02, 0x03, 0x00, 0x09, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x00, 0x0a, 0x08, 0x00, 0x18, 0x19, 0x00, 0x00, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x17, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x06, 0x07,
+ 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x14, 0x15, 0x00, 0x1a,
+
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x3c, 0x28, 0x2b, 0x7c,
+ 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e,
+ 0x2d, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22,
+
+ 0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00,
+ 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x5d, 0x00, 0x5d, 0x00, 0x00,
+
+ 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x5c, 0x00, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const uint8_t ebcdicFromAscii[256]={
+ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, 0x16, 0x05, 0x00, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x40, 0x00, 0x7f, 0x00, 0x00, 0x6c, 0x50, 0x7d, 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
+ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,
+
+ 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
+ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0x00, 0x00, 0x00, 0x00, 0x6d,
+ 0x00, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
+ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0x00, 0x00, 0x00, 0x00, 0x07,
+
+ 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, 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, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+/* Same as asciiFromEbcdic[] except maps all letters to lowercase. */
+static const uint8_t lowercaseAsciiFromEbcdic[256]={
+ 0x00, 0x01, 0x02, 0x03, 0x00, 0x09, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x00, 0x0a, 0x08, 0x00, 0x18, 0x19, 0x00, 0x00, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x17, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x06, 0x07,
+ 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x14, 0x15, 0x00, 0x1a,
+
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x3c, 0x28, 0x2b, 0x7c,
+ 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e,
+ 0x2d, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22,
+
+ 0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00,
+ 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x5d, 0x00, 0x5d, 0x00, 0x00,
+
+ 0x7b, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x7d, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x7c, 0x00, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+/*
+ * Bit sets indicating which characters of the ASCII repertoire
+ * (by ASCII/Unicode code) are "invariant".
+ * See utypes.h for more details.
+ *
+ * As invariant are considered the characters of the ASCII repertoire except
+ * for the following:
+ * 21 '!' <exclamation mark>
+ * 23 '#' <number sign>
+ * 24 '$' <dollar sign>
+ *
+ * 40 '@' <commercial at>
+ *
+ * 5b '[' <left bracket>
+ * 5c '\' <backslash>
+ * 5d ']' <right bracket>
+ * 5e '^' <circumflex>
+ *
+ * 60 '`' <grave accent>
+ *
+ * 7b '{' <left brace>
+ * 7c '|' <vertical line>
+ * 7d '}' <right brace>
+ * 7e '~' <tilde>
+ */
+static const uint32_t invariantChars[4]={
+ 0xfffffbff, /* 00..1f but not 0a */
+ 0xffffffe5, /* 20..3f but not 21 23 24 */
+ 0x87fffffe, /* 40..5f but not 40 5b..5e */
+ 0x87fffffe /* 60..7f but not 60 7b..7e */
+};
+
+/*
+ * test unsigned types (or values known to be non-negative) for invariant characters,
+ * tests ASCII-family character values
+ */
+#define UCHAR_IS_INVARIANT(c) (((c)<=0x7f) && (invariantChars[(c)>>5]&((uint32_t)1<<((c)&0x1f)))!=0)
+
+/* test signed types for invariant characters, adds test for positive values */
+#define SCHAR_IS_INVARIANT(c) ((0<=(c)) && UCHAR_IS_INVARIANT(c))
+
+#if U_CHARSET_FAMILY==U_ASCII_FAMILY
+#define CHAR_TO_UCHAR(c) c
+#define UCHAR_TO_CHAR(c) c
+#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
+#define CHAR_TO_UCHAR(u) asciiFromEbcdic[u]
+#define UCHAR_TO_CHAR(u) ebcdicFromAscii[u]
+#else
+# error U_CHARSET_FAMILY is not valid
+#endif
+
+
+U_CAPI void U_EXPORT2
+u_charsToUChars(const char *cs, UChar *us, int32_t length) {
+ UChar u;
+ uint8_t c;
+
+ /*
+ * Allow the entire ASCII repertoire to be mapped _to_ Unicode.
+ * For EBCDIC systems, this works for characters with codes from
+ * codepages 37 and 1047 or compatible.
+ */
+ while(length>0) {
+ c=(uint8_t)(*cs++);
+ u=(UChar)CHAR_TO_UCHAR(c);
+ U_ASSERT((u!=0 || c==0)); /* only invariant chars converted? */
+ *us++=u;
+ --length;
+ }
+}
+
+U_CAPI void U_EXPORT2
+u_UCharsToChars(const UChar *us, char *cs, int32_t length) {
+ UChar u;
+
+ while(length>0) {
+ u=*us++;
+ if(!UCHAR_IS_INVARIANT(u)) {
+ U_ASSERT(FALSE); /* Variant characters were used. These are not portable in ICU. */
+ u=0;
+ }
+ *cs++=(char)UCHAR_TO_CHAR(u);
+ --length;
+ }
+}
+
+U_CAPI UBool U_EXPORT2
+uprv_isInvariantString(const char *s, int32_t length) {
+ uint8_t c;
+
+ for(;;) {
+ if(length<0) {
+ /* NUL-terminated */
+ c=(uint8_t)*s++;
+ if(c==0) {
+ break;
+ }
+ } else {
+ /* count length */
+ if(length==0) {
+ break;
+ }
+ --length;
+ c=(uint8_t)*s++;
+ if(c==0) {
+ continue; /* NUL is invariant */
+ }
+ }
+ /* c!=0 now, one branch below checks c==0 for variant characters */
+
+ /*
+ * no assertions here because these functions are legitimately called
+ * for strings with variant characters
+ */
+#if U_CHARSET_FAMILY==U_ASCII_FAMILY
+ if(!UCHAR_IS_INVARIANT(c)) {
+ return FALSE; /* found a variant char */
+ }
+#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
+ c=CHAR_TO_UCHAR(c);
+ if(c==0 || !UCHAR_IS_INVARIANT(c)) {
+ return FALSE; /* found a variant char */
+ }
+#else
+# error U_CHARSET_FAMILY is not valid
+#endif
+ }
+ return TRUE;
+}
+
+U_CAPI UBool U_EXPORT2
+uprv_isInvariantUString(const UChar *s, int32_t length) {
+ UChar c;
+
+ for(;;) {
+ if(length<0) {
+ /* NUL-terminated */
+ c=*s++;
+ if(c==0) {
+ break;
+ }
+ } else {
+ /* count length */
+ if(length==0) {
+ break;
+ }
+ --length;
+ c=*s++;
+ }
+
+ /*
+ * no assertions here because these functions are legitimately called
+ * for strings with variant characters
+ */
+ if(!UCHAR_IS_INVARIANT(c)) {
+ return FALSE; /* found a variant char */
+ }
+ }
+ return TRUE;
+}
+
+/* UDataSwapFn implementations used in udataswp.c ------- */
+
+/* convert ASCII to EBCDIC and verify that all characters are invariant */
+U_CAPI int32_t U_EXPORT2
+uprv_ebcdicFromAscii(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode) {
+ const uint8_t *s;
+ uint8_t *t;
+ uint8_t c;
+
+ int32_t count;
+
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* setup and swapping */
+ s=(const uint8_t *)inData;
+ t=(uint8_t *)outData;
+ count=length;
+ while(count>0) {
+ c=*s++;
+ if(!UCHAR_IS_INVARIANT(c)) {
+ udata_printError(ds, "uprv_ebcdicFromAscii() string[%d] contains a variant character in position %d\n",
+ length, length-count);
+ *pErrorCode=U_INVALID_CHAR_FOUND;
+ return 0;
+ }
+ *t++=ebcdicFromAscii[c];
+ --count;
+ }
+
+ return length;
+}
+
+/* this function only checks and copies ASCII strings without conversion */
+U_CFUNC int32_t
+uprv_copyAscii(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode) {
+ const uint8_t *s;
+ uint8_t c;
+
+ int32_t count;
+
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* setup and checking */
+ s=(const uint8_t *)inData;
+ count=length;
+ while(count>0) {
+ c=*s++;
+ if(!UCHAR_IS_INVARIANT(c)) {
+ udata_printError(ds, "uprv_copyFromAscii() string[%d] contains a variant character in position %d\n",
+ length, length-count);
+ *pErrorCode=U_INVALID_CHAR_FOUND;
+ return 0;
+ }
+ --count;
+ }
+
+ if(length>0 && inData!=outData) {
+ uprv_memcpy(outData, inData, length);
+ }
+
+ return length;
+}
+
+/* convert EBCDIC to ASCII and verify that all characters are invariant */
+U_CFUNC int32_t
+uprv_asciiFromEbcdic(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode) {
+ const uint8_t *s;
+ uint8_t *t;
+ uint8_t c;
+
+ int32_t count;
+
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* setup and swapping */
+ s=(const uint8_t *)inData;
+ t=(uint8_t *)outData;
+ count=length;
+ while(count>0) {
+ c=*s++;
+ if(c!=0 && ((c=asciiFromEbcdic[c])==0 || !UCHAR_IS_INVARIANT(c))) {
+ udata_printError(ds, "uprv_asciiFromEbcdic() string[%d] contains a variant character in position %d\n",
+ length, length-count);
+ *pErrorCode=U_INVALID_CHAR_FOUND;
+ return 0;
+ }
+ *t++=c;
+ --count;
+ }
+
+ return length;
+}
+
+/* this function only checks and copies EBCDIC strings without conversion */
+U_CFUNC int32_t
+uprv_copyEbcdic(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode) {
+ const uint8_t *s;
+ uint8_t c;
+
+ int32_t count;
+
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* setup and checking */
+ s=(const uint8_t *)inData;
+ count=length;
+ while(count>0) {
+ c=*s++;
+ if(c!=0 && ((c=asciiFromEbcdic[c])==0 || !UCHAR_IS_INVARIANT(c))) {
+ udata_printError(ds, "uprv_copyEbcdic() string[%] contains a variant character in position %d\n",
+ length, length-count);
+ *pErrorCode=U_INVALID_CHAR_FOUND;
+ return 0;
+ }
+ --count;
+ }
+
+ if(length>0 && inData!=outData) {
+ uprv_memcpy(outData, inData, length);
+ }
+
+ return length;
+}
+
+U_CFUNC UBool
+uprv_isEbcdicAtSign(char c) {
+ static const uint8_t ebcdicAtSigns[] = {
+ 0x7C, 0x44, 0x66, 0x80, 0xAC, 0xAE, 0xAF, 0xB5, 0xEC, 0xEF, 0x00 };
+ return c != 0 && uprv_strchr((const char *)ebcdicAtSigns, c) != nullptr;
+}
+
+/* compare invariant strings; variant characters compare less than others and unlike each other */
+U_CFUNC int32_t
+uprv_compareInvAscii(const UDataSwapper *ds,
+ const char *outString, int32_t outLength,
+ const UChar *localString, int32_t localLength) {
+ (void)ds;
+ int32_t minLength;
+ UChar32 c1, c2;
+ uint8_t c;
+
+ if(outString==NULL || outLength<-1 || localString==NULL || localLength<-1) {
+ return 0;
+ }
+
+ if(outLength<0) {
+ outLength=(int32_t)uprv_strlen(outString);
+ }
+ if(localLength<0) {
+ localLength=u_strlen(localString);
+ }
+
+ minLength= outLength<localLength ? outLength : localLength;
+
+ while(minLength>0) {
+ c=(uint8_t)*outString++;
+ if(UCHAR_IS_INVARIANT(c)) {
+ c1=c;
+ } else {
+ c1=-1;
+ }
+
+ c2=*localString++;
+ if(!UCHAR_IS_INVARIANT(c2)) {
+ c2=-2;
+ }
+
+ if((c1-=c2)!=0) {
+ return c1;
+ }
+
+ --minLength;
+ }
+
+ /* strings start with same prefix, compare lengths */
+ return outLength-localLength;
+}
+
+U_CFUNC int32_t
+uprv_compareInvEbcdic(const UDataSwapper *ds,
+ const char *outString, int32_t outLength,
+ const UChar *localString, int32_t localLength) {
+ (void)ds;
+ int32_t minLength;
+ UChar32 c1, c2;
+ uint8_t c;
+
+ if(outString==NULL || outLength<-1 || localString==NULL || localLength<-1) {
+ return 0;
+ }
+
+ if(outLength<0) {
+ outLength=(int32_t)uprv_strlen(outString);
+ }
+ if(localLength<0) {
+ localLength=u_strlen(localString);
+ }
+
+ minLength= outLength<localLength ? outLength : localLength;
+
+ while(minLength>0) {
+ c=(uint8_t)*outString++;
+ if(c==0) {
+ c1=0;
+ } else if((c1=asciiFromEbcdic[c])!=0 && UCHAR_IS_INVARIANT(c1)) {
+ /* c1 is set */
+ } else {
+ c1=-1;
+ }
+
+ c2=*localString++;
+ if(!UCHAR_IS_INVARIANT(c2)) {
+ c2=-2;
+ }
+
+ if((c1-=c2)!=0) {
+ return c1;
+ }
+
+ --minLength;
+ }
+
+ /* strings start with same prefix, compare lengths */
+ return outLength-localLength;
+}
+
+U_CAPI int32_t U_EXPORT2
+uprv_compareInvEbcdicAsAscii(const char *s1, const char *s2) {
+ int32_t c1, c2;
+
+ for(;; ++s1, ++s2) {
+ c1=(uint8_t)*s1;
+ c2=(uint8_t)*s2;
+ if(c1!=c2) {
+ if(c1!=0 && ((c1=asciiFromEbcdic[c1])==0 || !UCHAR_IS_INVARIANT(c1))) {
+ c1=-(int32_t)(uint8_t)*s1;
+ }
+ if(c2!=0 && ((c2=asciiFromEbcdic[c2])==0 || !UCHAR_IS_INVARIANT(c2))) {
+ c2=-(int32_t)(uint8_t)*s2;
+ }
+ return c1-c2;
+ } else if(c1==0) {
+ return 0;
+ }
+ }
+}
+
+U_CAPI char U_EXPORT2
+uprv_ebcdicToAscii(char c) {
+ return (char)asciiFromEbcdic[(uint8_t)c];
+}
+
+U_CAPI char U_EXPORT2
+uprv_ebcdicToLowercaseAscii(char c) {
+ return (char)lowercaseAsciiFromEbcdic[(uint8_t)c];
+}
+
+U_INTERNAL uint8_t* U_EXPORT2
+uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n)
+{
+ uint8_t *orig_dst = dst;
+
+ if(n==-1) {
+ n = static_cast<int32_t>(uprv_strlen((const char*)src)+1); /* copy NUL */
+ }
+ /* copy non-null */
+ while(*src && n>0) {
+ *(dst++) = asciiFromEbcdic[*(src++)];
+ n--;
+ }
+ /* pad */
+ while(n>0) {
+ *(dst++) = 0;
+ n--;
+ }
+ return orig_dst;
+}
+
+U_INTERNAL uint8_t* U_EXPORT2
+uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n)
+{
+ uint8_t *orig_dst = dst;
+
+ if(n==-1) {
+ n = static_cast<int32_t>(uprv_strlen((const char*)src)+1); /* copy NUL */
+ }
+ /* copy non-null */
+ while(*src && n>0) {
+ char ch = ebcdicFromAscii[*(src++)];
+ if(ch == 0) {
+ ch = ebcdicFromAscii[0x3f]; /* questionmark (subchar) */
+ }
+ *(dst++) = ch;
+ n--;
+ }
+ /* pad */
+ while(n>0) {
+ *(dst++) = 0;
+ n--;
+ }
+ return orig_dst;
+}
+
diff --git a/contrib/libs/icu/common/uinvchar.h b/contrib/libs/icu/common/uinvchar.h
index c16f55d487..a43cfcd982 100644
--- a/contrib/libs/icu/common/uinvchar.h
+++ b/contrib/libs/icu/common/uinvchar.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: uinvchar.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:2
*
@@ -53,86 +53,86 @@ uprv_isInvariantString(const char *s, int32_t length);
U_INTERNAL UBool U_EXPORT2
uprv_isInvariantUString(const UChar *s, int32_t length);
-/**
- * \def U_UPPER_ORDINAL
- * Get the ordinal number of an uppercase invariant character
- * @internal
- */
-#if U_CHARSET_FAMILY==U_ASCII_FAMILY
-# define U_UPPER_ORDINAL(x) ((x)-'A')
-#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
-# define U_UPPER_ORDINAL(x) (((x) < 'J') ? ((x)-'A') : \
- (((x) < 'S') ? ((x)-'J'+9) : \
- ((x)-'S'+18)))
-#else
-# error Unknown charset family!
-#endif
-
+/**
+ * \def U_UPPER_ORDINAL
+ * Get the ordinal number of an uppercase invariant character
+ * @internal
+ */
+#if U_CHARSET_FAMILY==U_ASCII_FAMILY
+# define U_UPPER_ORDINAL(x) ((x)-'A')
+#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
+# define U_UPPER_ORDINAL(x) (((x) < 'J') ? ((x)-'A') : \
+ (((x) < 'S') ? ((x)-'J'+9) : \
+ ((x)-'S'+18)))
+#else
+# error Unknown charset family!
+#endif
+
#ifdef __cplusplus
-U_NAMESPACE_BEGIN
-
+U_NAMESPACE_BEGIN
+
/**
- * Like U_UPPER_ORDINAL(x) but with validation.
- * Returns 0..25 for A..Z else a value outside 0..25.
+ * Like U_UPPER_ORDINAL(x) but with validation.
+ * Returns 0..25 for A..Z else a value outside 0..25.
*/
-inline int32_t uprv_upperOrdinal(int32_t c) {
-#if U_CHARSET_FAMILY==U_ASCII_FAMILY
- return c - 'A';
-#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
- // EBCDIC: A-Z (26 letters) is split into three ranges A-I (9 letters), J-R (9), S-Z (8).
- // https://en.wikipedia.org/wiki/EBCDIC_037#Codepage_layout
- if (c <= 'I') { return c - 'A'; } // A-I --> 0-8
- if (c < 'J') { return -1; }
- if (c <= 'R') { return c - 'J' + 9; } // J-R --> 9..17
- if (c < 'S') { return -1; }
- return c - 'S' + 18; // S-Z --> 18..25
-#else
-# error Unknown charset family!
-#endif
+inline int32_t uprv_upperOrdinal(int32_t c) {
+#if U_CHARSET_FAMILY==U_ASCII_FAMILY
+ return c - 'A';
+#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
+ // EBCDIC: A-Z (26 letters) is split into three ranges A-I (9 letters), J-R (9), S-Z (8).
+ // https://en.wikipedia.org/wiki/EBCDIC_037#Codepage_layout
+ if (c <= 'I') { return c - 'A'; } // A-I --> 0-8
+ if (c < 'J') { return -1; }
+ if (c <= 'R') { return c - 'J' + 9; } // J-R --> 9..17
+ if (c < 'S') { return -1; }
+ return c - 'S' + 18; // S-Z --> 18..25
+#else
+# error Unknown charset family!
+#endif
+}
+
+// Like U_UPPER_ORDINAL(x) but for lowercase and with validation.
+// Returns 0..25 for a..z else a value outside 0..25.
+inline int32_t uprv_lowerOrdinal(int32_t c) {
+#if U_CHARSET_FAMILY==U_ASCII_FAMILY
+ return c - 'a';
+#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
+ // EBCDIC: a-z (26 letters) is split into three ranges a-i (9 letters), j-r (9), s-z (8).
+ // https://en.wikipedia.org/wiki/EBCDIC_037#Codepage_layout
+ if (c <= 'i') { return c - 'a'; } // a-i --> 0-8
+ if (c < 'j') { return -1; }
+ if (c <= 'r') { return c - 'j' + 9; } // j-r --> 9..17
+ if (c < 's') { return -1; }
+ return c - 's' + 18; // s-z --> 18..25
+#else
+# error Unknown charset family!
+#endif
}
-// Like U_UPPER_ORDINAL(x) but for lowercase and with validation.
-// Returns 0..25 for a..z else a value outside 0..25.
-inline int32_t uprv_lowerOrdinal(int32_t c) {
-#if U_CHARSET_FAMILY==U_ASCII_FAMILY
- return c - 'a';
-#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
- // EBCDIC: a-z (26 letters) is split into three ranges a-i (9 letters), j-r (9), s-z (8).
- // https://en.wikipedia.org/wiki/EBCDIC_037#Codepage_layout
- if (c <= 'i') { return c - 'a'; } // a-i --> 0-8
- if (c < 'j') { return -1; }
- if (c <= 'r') { return c - 'j' + 9; } // j-r --> 9..17
- if (c < 's') { return -1; }
- return c - 's' + 18; // s-z --> 18..25
-#else
-# error Unknown charset family!
-#endif
-}
-
-U_NAMESPACE_END
-
-#endif
-
+U_NAMESPACE_END
+
+#endif
+
/**
- * Returns true if c == '@' is possible.
- * The @ sign is variant, and the @ sign used on one
- * EBCDIC machine won't be compiled the same way on other EBCDIC based machines.
+ * Returns true if c == '@' is possible.
+ * The @ sign is variant, and the @ sign used on one
+ * EBCDIC machine won't be compiled the same way on other EBCDIC based machines.
+ * @internal
+ */
+U_CFUNC UBool
+uprv_isEbcdicAtSign(char c);
+
+/**
+ * \def uprv_isAtSign
+ * Returns true if c == '@' is possible.
+ * For ASCII, checks for exactly '@'. For EBCDIC, calls uprv_isEbcdicAtSign().
* @internal
*/
-U_CFUNC UBool
-uprv_isEbcdicAtSign(char c);
-
-/**
- * \def uprv_isAtSign
- * Returns true if c == '@' is possible.
- * For ASCII, checks for exactly '@'. For EBCDIC, calls uprv_isEbcdicAtSign().
- * @internal
- */
#if U_CHARSET_FAMILY==U_ASCII_FAMILY
-# define uprv_isAtSign(c) ((c)=='@')
+# define uprv_isAtSign(c) ((c)=='@')
#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
-# define uprv_isAtSign(c) uprv_isEbcdicAtSign(c)
+# define uprv_isAtSign(c) uprv_isEbcdicAtSign(c)
#else
# error Unknown charset family!
#endif
@@ -158,26 +158,26 @@ uprv_compareInvEbcdicAsAscii(const char *s1, const char *s2);
#endif
/**
- * Converts an EBCDIC invariant character to ASCII.
- * @internal
- */
-U_INTERNAL char U_EXPORT2
-uprv_ebcdicToAscii(char c);
-
-/**
- * \def uprv_invCharToAscii
- * Converts an invariant character to ASCII.
- * @internal
- */
-#if U_CHARSET_FAMILY==U_ASCII_FAMILY
-# define uprv_invCharToAscii(c) (c)
-#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
-# define uprv_invCharToAscii(c) uprv_ebcdicToAscii(c)
-#else
-# error Unknown charset family!
-#endif
-
-/**
+ * Converts an EBCDIC invariant character to ASCII.
+ * @internal
+ */
+U_INTERNAL char U_EXPORT2
+uprv_ebcdicToAscii(char c);
+
+/**
+ * \def uprv_invCharToAscii
+ * Converts an invariant character to ASCII.
+ * @internal
+ */
+#if U_CHARSET_FAMILY==U_ASCII_FAMILY
+# define uprv_invCharToAscii(c) (c)
+#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
+# define uprv_invCharToAscii(c) uprv_ebcdicToAscii(c)
+#else
+# error Unknown charset family!
+#endif
+
+/**
* Converts an EBCDIC invariant character to lowercase ASCII.
* @internal
*/
diff --git a/contrib/libs/icu/common/uiter.cpp b/contrib/libs/icu/common/uiter.cpp
index b6b215ec21..b9252d81c2 100644
--- a/contrib/libs/icu/common/uiter.cpp
+++ b/contrib/libs/icu/common/uiter.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: uiter.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/ulayout_props.h b/contrib/libs/icu/common/ulayout_props.h
index d4b9ffb421..c0f028c713 100644
--- a/contrib/libs/icu/common/ulayout_props.h
+++ b/contrib/libs/icu/common/ulayout_props.h
@@ -1,46 +1,46 @@
-// © 2019 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// ulayout_props.h
-// created: 2019feb12 Markus W. Scherer
-
-#ifndef __ULAYOUT_PROPS_H__
-#define __ULAYOUT_PROPS_H__
-
-#include "unicode/utypes.h"
-
-// file definitions ------------------------------------------------------------
-
-#define ULAYOUT_DATA_NAME "ulayout"
-#define ULAYOUT_DATA_TYPE "icu"
-
-// data format "Layo"
-#define ULAYOUT_FMT_0 0x4c
-#define ULAYOUT_FMT_1 0x61
-#define ULAYOUT_FMT_2 0x79
-#define ULAYOUT_FMT_3 0x6f
-
-// indexes into indexes[]
-enum {
- // Element 0 stores the length of the indexes[] array.
- ULAYOUT_IX_INDEXES_LENGTH,
- // Elements 1..7 store the tops of consecutive code point tries.
- // No trie is stored if the difference between two of these is less than 16.
- ULAYOUT_IX_INPC_TRIE_TOP,
- ULAYOUT_IX_INSC_TRIE_TOP,
- ULAYOUT_IX_VO_TRIE_TOP,
- ULAYOUT_IX_RESERVED_TOP,
-
- ULAYOUT_IX_TRIES_TOP = 7,
-
- ULAYOUT_IX_MAX_VALUES = 9,
-
- // Length of indexes[]. Multiple of 4 to 16-align the tries.
- ULAYOUT_IX_COUNT = 12
-};
-
-constexpr int32_t ULAYOUT_MAX_INPC_SHIFT = 24;
-constexpr int32_t ULAYOUT_MAX_INSC_SHIFT = 16;
-constexpr int32_t ULAYOUT_MAX_VO_SHIFT = 8;
-
-#endif // __ULAYOUT_PROPS_H__
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// ulayout_props.h
+// created: 2019feb12 Markus W. Scherer
+
+#ifndef __ULAYOUT_PROPS_H__
+#define __ULAYOUT_PROPS_H__
+
+#include "unicode/utypes.h"
+
+// file definitions ------------------------------------------------------------
+
+#define ULAYOUT_DATA_NAME "ulayout"
+#define ULAYOUT_DATA_TYPE "icu"
+
+// data format "Layo"
+#define ULAYOUT_FMT_0 0x4c
+#define ULAYOUT_FMT_1 0x61
+#define ULAYOUT_FMT_2 0x79
+#define ULAYOUT_FMT_3 0x6f
+
+// indexes into indexes[]
+enum {
+ // Element 0 stores the length of the indexes[] array.
+ ULAYOUT_IX_INDEXES_LENGTH,
+ // Elements 1..7 store the tops of consecutive code point tries.
+ // No trie is stored if the difference between two of these is less than 16.
+ ULAYOUT_IX_INPC_TRIE_TOP,
+ ULAYOUT_IX_INSC_TRIE_TOP,
+ ULAYOUT_IX_VO_TRIE_TOP,
+ ULAYOUT_IX_RESERVED_TOP,
+
+ ULAYOUT_IX_TRIES_TOP = 7,
+
+ ULAYOUT_IX_MAX_VALUES = 9,
+
+ // Length of indexes[]. Multiple of 4 to 16-align the tries.
+ ULAYOUT_IX_COUNT = 12
+};
+
+constexpr int32_t ULAYOUT_MAX_INPC_SHIFT = 24;
+constexpr int32_t ULAYOUT_MAX_INSC_SHIFT = 16;
+constexpr int32_t ULAYOUT_MAX_VO_SHIFT = 8;
+
+#endif // __ULAYOUT_PROPS_H__
diff --git a/contrib/libs/icu/common/ulist.cpp b/contrib/libs/icu/common/ulist.cpp
index 7bf9bb745e..c5180431c3 100644
--- a/contrib/libs/icu/common/ulist.cpp
+++ b/contrib/libs/icu/common/ulist.cpp
@@ -1,270 +1,270 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-* Copyright (C) 2009-2016, International Business Machines
-* Corporation and others. All Rights Reserved.
-******************************************************************************
-*/
-
-#include "ulist.h"
-#include "cmemory.h"
-#include "cstring.h"
-#include "uenumimp.h"
-
-typedef struct UListNode UListNode;
-struct UListNode {
- void *data;
-
- UListNode *next;
- UListNode *previous;
-
- /* When data is created with uprv_malloc, needs to be freed during deleteList function. */
- UBool forceDelete;
-};
-
-struct UList {
- UListNode *curr;
- UListNode *head;
- UListNode *tail;
-
- int32_t size;
-};
-
-static void ulist_addFirstItem(UList *list, UListNode *newItem);
-
-U_CAPI UList *U_EXPORT2 ulist_createEmptyList(UErrorCode *status) {
- UList *newList = NULL;
-
- if (U_FAILURE(*status)) {
- return NULL;
- }
-
- newList = (UList *)uprv_malloc(sizeof(UList));
- if (newList == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
-
- newList->curr = NULL;
- newList->head = NULL;
- newList->tail = NULL;
- newList->size = 0;
-
- return newList;
-}
-
-/*
- * Function called by addItemEndList or addItemBeginList when the first item is added to the list.
- * This function properly sets the pointers for the first item added.
- */
-static void ulist_addFirstItem(UList *list, UListNode *newItem) {
- newItem->next = NULL;
- newItem->previous = NULL;
- list->head = newItem;
- list->tail = newItem;
-}
-
-static void ulist_removeItem(UList *list, UListNode *p) {
- if (p->previous == NULL) {
- // p is the list head.
- list->head = p->next;
- } else {
- p->previous->next = p->next;
- }
- if (p->next == NULL) {
- // p is the list tail.
- list->tail = p->previous;
- } else {
- p->next->previous = p->previous;
- }
- if (p == list->curr) {
- list->curr = p->next;
- }
- --list->size;
- if (p->forceDelete) {
- uprv_free(p->data);
- }
- uprv_free(p);
-}
-
-U_CAPI void U_EXPORT2 ulist_addItemEndList(UList *list, const void *data, UBool forceDelete, UErrorCode *status) {
- UListNode *newItem = NULL;
-
- if (U_FAILURE(*status) || list == NULL || data == NULL) {
- if (forceDelete) {
- uprv_free((void *)data);
- }
- return;
- }
-
- newItem = (UListNode *)uprv_malloc(sizeof(UListNode));
- if (newItem == NULL) {
- if (forceDelete) {
- uprv_free((void *)data);
- }
- *status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- newItem->data = (void *)(data);
- newItem->forceDelete = forceDelete;
-
- if (list->size == 0) {
- ulist_addFirstItem(list, newItem);
- } else {
- newItem->next = NULL;
- newItem->previous = list->tail;
- list->tail->next = newItem;
- list->tail = newItem;
- }
-
- list->size++;
-}
-
-U_CAPI void U_EXPORT2 ulist_addItemBeginList(UList *list, const void *data, UBool forceDelete, UErrorCode *status) {
- UListNode *newItem = NULL;
-
- if (U_FAILURE(*status) || list == NULL || data == NULL) {
- if (forceDelete) {
- uprv_free((void *)data);
- }
- return;
- }
-
- newItem = (UListNode *)uprv_malloc(sizeof(UListNode));
- if (newItem == NULL) {
- if (forceDelete) {
- uprv_free((void *)data);
- }
- *status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- newItem->data = (void *)(data);
- newItem->forceDelete = forceDelete;
-
- if (list->size == 0) {
- ulist_addFirstItem(list, newItem);
- } else {
- newItem->previous = NULL;
- newItem->next = list->head;
- list->head->previous = newItem;
- list->head = newItem;
- }
-
- list->size++;
-}
-
-U_CAPI UBool U_EXPORT2 ulist_containsString(const UList *list, const char *data, int32_t length) {
- if (list != NULL) {
- const UListNode *pointer;
- for (pointer = list->head; pointer != NULL; pointer = pointer->next) {
- if (length == (int32_t)uprv_strlen((const char *)pointer->data)) {
- if (uprv_memcmp(data, pointer->data, length) == 0) {
- return TRUE;
- }
- }
- }
- }
- return FALSE;
-}
-
-U_CAPI UBool U_EXPORT2 ulist_removeString(UList *list, const char *data) {
- if (list != NULL) {
- UListNode *pointer;
- for (pointer = list->head; pointer != NULL; pointer = pointer->next) {
- if (uprv_strcmp(data, (const char *)pointer->data) == 0) {
- ulist_removeItem(list, pointer);
- // Remove only the first occurrence, like Java LinkedList.remove(Object).
- return TRUE;
- }
- }
- }
- return FALSE;
-}
-
-U_CAPI void *U_EXPORT2 ulist_getNext(UList *list) {
- UListNode *curr = NULL;
-
- if (list == NULL || list->curr == NULL) {
- return NULL;
- }
-
- curr = list->curr;
- list->curr = curr->next;
-
- return curr->data;
-}
-
-U_CAPI int32_t U_EXPORT2 ulist_getListSize(const UList *list) {
- if (list != NULL) {
- return list->size;
- }
-
- return -1;
-}
-
-U_CAPI void U_EXPORT2 ulist_resetList(UList *list) {
- if (list != NULL) {
- list->curr = list->head;
- }
-}
-
-U_CAPI void U_EXPORT2 ulist_deleteList(UList *list) {
- UListNode *listHead = NULL;
-
- if (list != NULL) {
- listHead = list->head;
- while (listHead != NULL) {
- UListNode *listPointer = listHead->next;
-
- if (listHead->forceDelete) {
- uprv_free(listHead->data);
- }
-
- uprv_free(listHead);
- listHead = listPointer;
- }
- uprv_free(list);
- list = NULL;
- }
-}
-
-U_CAPI void U_EXPORT2 ulist_close_keyword_values_iterator(UEnumeration *en) {
- if (en != NULL) {
- ulist_deleteList((UList *)(en->context));
- uprv_free(en);
- }
-}
-
-U_CAPI int32_t U_EXPORT2 ulist_count_keyword_values(UEnumeration *en, UErrorCode *status) {
- if (U_FAILURE(*status)) {
- return -1;
- }
-
- return ulist_getListSize((UList *)(en->context));
-}
-
-U_CAPI const char * U_EXPORT2 ulist_next_keyword_value(UEnumeration *en, int32_t *resultLength, UErrorCode *status) {
- const char *s;
- if (U_FAILURE(*status)) {
- return NULL;
- }
-
- s = (const char *)ulist_getNext((UList *)(en->context));
- if (s != NULL && resultLength != NULL) {
- *resultLength = static_cast<int32_t>(uprv_strlen(s));
- }
- return s;
-}
-
-U_CAPI void U_EXPORT2 ulist_reset_keyword_values_iterator(UEnumeration *en, UErrorCode *status) {
- if (U_FAILURE(*status)) {
- return ;
- }
-
- ulist_resetList((UList *)(en->context));
-}
-
-U_CAPI UList * U_EXPORT2 ulist_getListFromEnum(UEnumeration *en) {
- return (UList *)(en->context);
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+* Copyright (C) 2009-2016, International Business Machines
+* Corporation and others. All Rights Reserved.
+******************************************************************************
+*/
+
+#include "ulist.h"
+#include "cmemory.h"
+#include "cstring.h"
+#include "uenumimp.h"
+
+typedef struct UListNode UListNode;
+struct UListNode {
+ void *data;
+
+ UListNode *next;
+ UListNode *previous;
+
+ /* When data is created with uprv_malloc, needs to be freed during deleteList function. */
+ UBool forceDelete;
+};
+
+struct UList {
+ UListNode *curr;
+ UListNode *head;
+ UListNode *tail;
+
+ int32_t size;
+};
+
+static void ulist_addFirstItem(UList *list, UListNode *newItem);
+
+U_CAPI UList *U_EXPORT2 ulist_createEmptyList(UErrorCode *status) {
+ UList *newList = NULL;
+
+ if (U_FAILURE(*status)) {
+ return NULL;
+ }
+
+ newList = (UList *)uprv_malloc(sizeof(UList));
+ if (newList == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+
+ newList->curr = NULL;
+ newList->head = NULL;
+ newList->tail = NULL;
+ newList->size = 0;
+
+ return newList;
+}
+
+/*
+ * Function called by addItemEndList or addItemBeginList when the first item is added to the list.
+ * This function properly sets the pointers for the first item added.
+ */
+static void ulist_addFirstItem(UList *list, UListNode *newItem) {
+ newItem->next = NULL;
+ newItem->previous = NULL;
+ list->head = newItem;
+ list->tail = newItem;
+}
+
+static void ulist_removeItem(UList *list, UListNode *p) {
+ if (p->previous == NULL) {
+ // p is the list head.
+ list->head = p->next;
+ } else {
+ p->previous->next = p->next;
+ }
+ if (p->next == NULL) {
+ // p is the list tail.
+ list->tail = p->previous;
+ } else {
+ p->next->previous = p->previous;
+ }
+ if (p == list->curr) {
+ list->curr = p->next;
+ }
+ --list->size;
+ if (p->forceDelete) {
+ uprv_free(p->data);
+ }
+ uprv_free(p);
+}
+
+U_CAPI void U_EXPORT2 ulist_addItemEndList(UList *list, const void *data, UBool forceDelete, UErrorCode *status) {
+ UListNode *newItem = NULL;
+
+ if (U_FAILURE(*status) || list == NULL || data == NULL) {
+ if (forceDelete) {
+ uprv_free((void *)data);
+ }
+ return;
+ }
+
+ newItem = (UListNode *)uprv_malloc(sizeof(UListNode));
+ if (newItem == NULL) {
+ if (forceDelete) {
+ uprv_free((void *)data);
+ }
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ newItem->data = (void *)(data);
+ newItem->forceDelete = forceDelete;
+
+ if (list->size == 0) {
+ ulist_addFirstItem(list, newItem);
+ } else {
+ newItem->next = NULL;
+ newItem->previous = list->tail;
+ list->tail->next = newItem;
+ list->tail = newItem;
+ }
+
+ list->size++;
+}
+
+U_CAPI void U_EXPORT2 ulist_addItemBeginList(UList *list, const void *data, UBool forceDelete, UErrorCode *status) {
+ UListNode *newItem = NULL;
+
+ if (U_FAILURE(*status) || list == NULL || data == NULL) {
+ if (forceDelete) {
+ uprv_free((void *)data);
+ }
+ return;
+ }
+
+ newItem = (UListNode *)uprv_malloc(sizeof(UListNode));
+ if (newItem == NULL) {
+ if (forceDelete) {
+ uprv_free((void *)data);
+ }
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ newItem->data = (void *)(data);
+ newItem->forceDelete = forceDelete;
+
+ if (list->size == 0) {
+ ulist_addFirstItem(list, newItem);
+ } else {
+ newItem->previous = NULL;
+ newItem->next = list->head;
+ list->head->previous = newItem;
+ list->head = newItem;
+ }
+
+ list->size++;
+}
+
+U_CAPI UBool U_EXPORT2 ulist_containsString(const UList *list, const char *data, int32_t length) {
+ if (list != NULL) {
+ const UListNode *pointer;
+ for (pointer = list->head; pointer != NULL; pointer = pointer->next) {
+ if (length == (int32_t)uprv_strlen((const char *)pointer->data)) {
+ if (uprv_memcmp(data, pointer->data, length) == 0) {
+ return TRUE;
+ }
+ }
+ }
+ }
+ return FALSE;
+}
+
+U_CAPI UBool U_EXPORT2 ulist_removeString(UList *list, const char *data) {
+ if (list != NULL) {
+ UListNode *pointer;
+ for (pointer = list->head; pointer != NULL; pointer = pointer->next) {
+ if (uprv_strcmp(data, (const char *)pointer->data) == 0) {
+ ulist_removeItem(list, pointer);
+ // Remove only the first occurrence, like Java LinkedList.remove(Object).
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+
+U_CAPI void *U_EXPORT2 ulist_getNext(UList *list) {
+ UListNode *curr = NULL;
+
+ if (list == NULL || list->curr == NULL) {
+ return NULL;
+ }
+
+ curr = list->curr;
+ list->curr = curr->next;
+
+ return curr->data;
+}
+
+U_CAPI int32_t U_EXPORT2 ulist_getListSize(const UList *list) {
+ if (list != NULL) {
+ return list->size;
+ }
+
+ return -1;
+}
+
+U_CAPI void U_EXPORT2 ulist_resetList(UList *list) {
+ if (list != NULL) {
+ list->curr = list->head;
+ }
+}
+
+U_CAPI void U_EXPORT2 ulist_deleteList(UList *list) {
+ UListNode *listHead = NULL;
+
+ if (list != NULL) {
+ listHead = list->head;
+ while (listHead != NULL) {
+ UListNode *listPointer = listHead->next;
+
+ if (listHead->forceDelete) {
+ uprv_free(listHead->data);
+ }
+
+ uprv_free(listHead);
+ listHead = listPointer;
+ }
+ uprv_free(list);
+ list = NULL;
+ }
+}
+
+U_CAPI void U_EXPORT2 ulist_close_keyword_values_iterator(UEnumeration *en) {
+ if (en != NULL) {
+ ulist_deleteList((UList *)(en->context));
+ uprv_free(en);
+ }
+}
+
+U_CAPI int32_t U_EXPORT2 ulist_count_keyword_values(UEnumeration *en, UErrorCode *status) {
+ if (U_FAILURE(*status)) {
+ return -1;
+ }
+
+ return ulist_getListSize((UList *)(en->context));
+}
+
+U_CAPI const char * U_EXPORT2 ulist_next_keyword_value(UEnumeration *en, int32_t *resultLength, UErrorCode *status) {
+ const char *s;
+ if (U_FAILURE(*status)) {
+ return NULL;
+ }
+
+ s = (const char *)ulist_getNext((UList *)(en->context));
+ if (s != NULL && resultLength != NULL) {
+ *resultLength = static_cast<int32_t>(uprv_strlen(s));
+ }
+ return s;
+}
+
+U_CAPI void U_EXPORT2 ulist_reset_keyword_values_iterator(UEnumeration *en, UErrorCode *status) {
+ if (U_FAILURE(*status)) {
+ return ;
+ }
+
+ ulist_resetList((UList *)(en->context));
+}
+
+U_CAPI UList * U_EXPORT2 ulist_getListFromEnum(UEnumeration *en) {
+ return (UList *)(en->context);
+}
diff --git a/contrib/libs/icu/common/ulist.h b/contrib/libs/icu/common/ulist.h
index e498c8abab..de58a4ad02 100644
--- a/contrib/libs/icu/common/ulist.h
+++ b/contrib/libs/icu/common/ulist.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/common/uloc.cpp b/contrib/libs/icu/common/uloc.cpp
index 98110c333f..0e235d7958 100644
--- a/contrib/libs/icu/common/uloc.cpp
+++ b/contrib/libs/icu/common/uloc.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -30,14 +30,14 @@
l = lang, C = ctry, M = charmap, V = variant
*/
-#include "unicode/bytestream.h"
-#include "unicode/errorcode.h"
-#include "unicode/stringpiece.h"
+#include "unicode/bytestream.h"
+#include "unicode/errorcode.h"
+#include "unicode/stringpiece.h"
#include "unicode/utypes.h"
#include "unicode/ustring.h"
#include "unicode/uloc.h"
-#include "bytesinkutil.h"
+#include "bytesinkutil.h"
#include "putilimp.h"
#include "ustr_imp.h"
#include "ulocimp.h"
@@ -48,12 +48,12 @@
#include "uarrsort.h"
#include "uenumimp.h"
#include "uassert.h"
-#include "charstr.h"
+#include "charstr.h"
-#include <algorithm>
+#include <algorithm>
#include <stdio.h> /* for sprintf */
-U_NAMESPACE_USE
+U_NAMESPACE_USE
/* ### Declarations **************************************************/
@@ -102,19 +102,19 @@ locale_getKeywords(const char *localeID,
*/
/* Generated using org.unicode.cldr.icu.GenerateISO639LanguageTables */
/* ISO639 table version is 20150505 */
-/* Subsequent hand addition of selected languages */
+/* Subsequent hand addition of selected languages */
static const char * const LANGUAGES[] = {
"aa", "ab", "ace", "ach", "ada", "ady", "ae", "aeb",
"af", "afh", "agq", "ain", "ak", "akk", "akz", "ale",
"aln", "alt", "am", "an", "ang", "anp", "ar", "arc",
- "arn", "aro", "arp", "arq", "ars", "arw", "ary", "arz", "as",
+ "arn", "aro", "arp", "arq", "ars", "arw", "ary", "arz", "as",
"asa", "ase", "ast", "av", "avk", "awa", "ay", "az",
"ba", "bal", "ban", "bar", "bas", "bax", "bbc", "bbj",
"be", "bej", "bem", "bew", "bez", "bfd", "bfq", "bg",
"bgn", "bho", "bi", "bik", "bin", "bjn", "bkm", "bla",
"bm", "bn", "bo", "bpy", "bqi", "br", "bra", "brh",
"brx", "bs", "bss", "bua", "bug", "bum", "byn", "byv",
- "ca", "cad", "car", "cay", "cch", "ccp", "ce", "ceb", "cgg",
+ "ca", "cad", "car", "cay", "cch", "ccp", "ce", "ceb", "cgg",
"ch", "chb", "chg", "chk", "chm", "chn", "cho", "chp",
"chr", "chy", "ckb", "co", "cop", "cps", "cr", "crh",
"cs", "csb", "cu", "cv", "cy",
@@ -152,8 +152,8 @@ static const char * const LANGUAGES[] = {
"mad", "maf", "mag", "mai", "mak", "man", "mas", "mde",
"mdf", "mdh", "mdr", "men", "mer", "mfe", "mg", "mga",
"mgh", "mgo", "mh", "mi", "mic", "min", "mis", "mk",
- "ml", "mn", "mnc", "mni", "mo",
- "moh", "mos", "mr", "mrj",
+ "ml", "mn", "mnc", "mni", "mo",
+ "moh", "mos", "mr", "mrj",
"ms", "mt", "mua", "mul", "mus", "mwl", "mwr", "mwv",
"my", "mye", "myv", "mzn",
"na", "nan", "nap", "naq", "nb", "nd", "nds", "ne",
@@ -161,7 +161,7 @@ static const char * const LANGUAGES[] = {
"nnh", "no", "nog", "non", "nov", "nqo", "nr", "nso",
"nus", "nv", "nwc", "ny", "nym", "nyn", "nyo", "nzi",
"oc", "oj", "om", "or", "os", "osa", "ota",
- "pa", "pag", "pal", "pam", "pap", "pau", "pcd", "pcm", "pdc",
+ "pa", "pag", "pal", "pam", "pap", "pau", "pcd", "pcm", "pdc",
"pdt", "peo", "pfl", "phn", "pi", "pl", "pms", "pnt",
"pon", "prg", "pro", "ps", "pt",
"qu", "quc", "qug",
@@ -219,19 +219,19 @@ static const char* const REPLACEMENT_LANGUAGES[]={
*/
/* Generated using org.unicode.cldr.icu.GenerateISO639LanguageTables */
/* ISO639 table version is 20150505 */
-/* Subsequent hand addition of selected languages */
+/* Subsequent hand addition of selected languages */
static const char * const LANGUAGES_3[] = {
"aar", "abk", "ace", "ach", "ada", "ady", "ave", "aeb",
"afr", "afh", "agq", "ain", "aka", "akk", "akz", "ale",
"aln", "alt", "amh", "arg", "ang", "anp", "ara", "arc",
- "arn", "aro", "arp", "arq", "ars", "arw", "ary", "arz", "asm",
+ "arn", "aro", "arp", "arq", "ars", "arw", "ary", "arz", "asm",
"asa", "ase", "ast", "ava", "avk", "awa", "aym", "aze",
"bak", "bal", "ban", "bar", "bas", "bax", "bbc", "bbj",
"bel", "bej", "bem", "bew", "bez", "bfd", "bfq", "bul",
"bgn", "bho", "bis", "bik", "bin", "bjn", "bkm", "bla",
"bam", "ben", "bod", "bpy", "bqi", "bre", "bra", "brh",
"brx", "bos", "bss", "bua", "bug", "bum", "byn", "byv",
- "cat", "cad", "car", "cay", "cch", "ccp", "che", "ceb", "cgg",
+ "cat", "cad", "car", "cay", "cch", "ccp", "che", "ceb", "cgg",
"cha", "chb", "chg", "chk", "chm", "chn", "cho", "chp",
"chr", "chy", "ckb", "cos", "cop", "cps", "cre", "crh",
"ces", "csb", "chu", "chv", "cym",
@@ -269,8 +269,8 @@ static const char * const LANGUAGES_3[] = {
"mad", "maf", "mag", "mai", "mak", "man", "mas", "mde",
"mdf", "mdh", "mdr", "men", "mer", "mfe", "mlg", "mga",
"mgh", "mgo", "mah", "mri", "mic", "min", "mis", "mkd",
- "mal", "mon", "mnc", "mni", "mol",
- "moh", "mos", "mar", "mrj",
+ "mal", "mon", "mnc", "mni", "mol",
+ "moh", "mos", "mar", "mrj",
"msa", "mlt", "mua", "mul", "mus", "mwl", "mwr", "mwv",
"mya", "mye", "myv", "mzn",
"nau", "nan", "nap", "naq", "nob", "nde", "nds", "nep",
@@ -278,7 +278,7 @@ static const char * const LANGUAGES_3[] = {
"nnh", "nor", "nog", "non", "nov", "nqo", "nbl", "nso",
"nus", "nav", "nwc", "nya", "nym", "nyn", "nyo", "nzi",
"oci", "oji", "orm", "ori", "oss", "osa", "ota",
- "pan", "pag", "pal", "pam", "pap", "pau", "pcd", "pcm", "pdc",
+ "pan", "pag", "pal", "pam", "pap", "pau", "pcd", "pcm", "pdc",
"pdt", "peo", "pfl", "phn", "pli", "pol", "pms", "pnt",
"pon", "prg", "pro", "pus", "por",
"que", "quc", "qug",
@@ -470,35 +470,35 @@ typedef struct CanonicalizationMap {
* different semantic kinds of transformations.
*/
static const CanonicalizationMap CANONICALIZE_MAP[] = {
- { "art__LOJBAN", "jbo" }, /* registered name */
- { "hy__AREVELA", "hy" }, /* Registered IANA variant */
- { "hy__AREVMDA", "hyw" }, /* Registered IANA variant */
- { "zh__GUOYU", "zh" }, /* registered name */
- { "zh__HAKKA", "hak" }, /* registered name */
- { "zh__XIANG", "hsn" }, /* registered name */
- // subtags with 3 chars won't be treated as variants.
- { "zh_GAN", "gan" }, /* registered name */
- { "zh_MIN_NAN", "nan" }, /* registered name */
- { "zh_WUU", "wuu" }, /* registered name */
- { "zh_YUE", "yue" }, /* registered name */
+ { "art__LOJBAN", "jbo" }, /* registered name */
+ { "hy__AREVELA", "hy" }, /* Registered IANA variant */
+ { "hy__AREVMDA", "hyw" }, /* Registered IANA variant */
+ { "zh__GUOYU", "zh" }, /* registered name */
+ { "zh__HAKKA", "hak" }, /* registered name */
+ { "zh__XIANG", "hsn" }, /* registered name */
+ // subtags with 3 chars won't be treated as variants.
+ { "zh_GAN", "gan" }, /* registered name */
+ { "zh_MIN_NAN", "nan" }, /* registered name */
+ { "zh_WUU", "wuu" }, /* registered name */
+ { "zh_YUE", "yue" }, /* registered name */
};
/* ### BCP47 Conversion *******************************************/
/* Test if the locale id has BCP47 u extension and does not have '@' */
#define _hasBCP47Extension(id) (id && uprv_strstr(id, "@") == NULL && getShortestSubtagLength(localeID) == 1)
/* Converts the BCP47 id to Unicode id. Does nothing to id if conversion fails */
-#define _ConvertBCP47(finalID, id, buffer, length,err) UPRV_BLOCK_MACRO_BEGIN { \
- if (uloc_forLanguageTag(id, buffer, length, NULL, err) <= 0 || \
- U_FAILURE(*err) || *err == U_STRING_NOT_TERMINATED_WARNING) { \
- finalID=id; \
- if (*err == U_STRING_NOT_TERMINATED_WARNING) { *err = U_BUFFER_OVERFLOW_ERROR; } \
- } else { \
- finalID=buffer; \
- } \
-} UPRV_BLOCK_MACRO_END
+#define _ConvertBCP47(finalID, id, buffer, length,err) UPRV_BLOCK_MACRO_BEGIN { \
+ if (uloc_forLanguageTag(id, buffer, length, NULL, err) <= 0 || \
+ U_FAILURE(*err) || *err == U_STRING_NOT_TERMINATED_WARNING) { \
+ finalID=id; \
+ if (*err == U_STRING_NOT_TERMINATED_WARNING) { *err = U_BUFFER_OVERFLOW_ERROR; } \
+ } else { \
+ finalID=buffer; \
+ } \
+} UPRV_BLOCK_MACRO_END
/* Gets the size of the shortest subtag in the given localeID. */
static int32_t getShortestSubtagLength(const char *localeID) {
- int32_t localeIDLength = static_cast<int32_t>(uprv_strlen(localeID));
+ int32_t localeIDLength = static_cast<int32_t>(uprv_strlen(localeID));
int32_t length = localeIDLength;
int32_t tmpLength = 0;
int32_t i;
@@ -523,10 +523,10 @@ static int32_t getShortestSubtagLength(const char *localeID) {
}
/* ### Keywords **************************************************/
-#define UPRV_ISDIGIT(c) (((c) >= '0') && ((c) <= '9'))
-#define UPRV_ISALPHANUM(c) (uprv_isASCIILetter(c) || UPRV_ISDIGIT(c) )
-/* Punctuation/symbols allowed in legacy key values */
-#define UPRV_OK_VALUE_PUNCTUATION(c) ((c) == '_' || (c) == '-' || (c) == '+' || (c) == '/')
+#define UPRV_ISDIGIT(c) (((c) >= '0') && ((c) <= '9'))
+#define UPRV_ISALPHANUM(c) (uprv_isASCIILetter(c) || UPRV_ISDIGIT(c) )
+/* Punctuation/symbols allowed in legacy key values */
+#define UPRV_OK_VALUE_PUNCTUATION(c) ((c) == '_' || (c) == '-' || (c) == '+' || (c) == '/')
#define ULOC_KEYWORD_BUFFER_LEN 25
#define ULOC_MAX_NO_KEYWORDS 25
@@ -563,26 +563,26 @@ locale_getKeywordsStart(const char *localeID) {
*/
static int32_t locale_canonKeywordName(char *buf, const char *keywordName, UErrorCode *status)
{
- int32_t keywordNameLen = 0;
-
- for (; *keywordName != 0; keywordName++) {
- if (!UPRV_ISALPHANUM(*keywordName)) {
- *status = U_ILLEGAL_ARGUMENT_ERROR; /* malformed keyword name */
- return 0;
- }
- if (keywordNameLen < ULOC_KEYWORD_BUFFER_LEN - 1) {
- buf[keywordNameLen++] = uprv_tolower(*keywordName);
- } else {
- /* keyword name too long for internal buffer */
- *status = U_INTERNAL_PROGRAM_ERROR;
- return 0;
- }
+ int32_t keywordNameLen = 0;
+
+ for (; *keywordName != 0; keywordName++) {
+ if (!UPRV_ISALPHANUM(*keywordName)) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR; /* malformed keyword name */
+ return 0;
+ }
+ if (keywordNameLen < ULOC_KEYWORD_BUFFER_LEN - 1) {
+ buf[keywordNameLen++] = uprv_tolower(*keywordName);
+ } else {
+ /* keyword name too long for internal buffer */
+ *status = U_INTERNAL_PROGRAM_ERROR;
+ return 0;
+ }
}
- if (keywordNameLen == 0) {
- *status = U_ILLEGAL_ARGUMENT_ERROR; /* empty keyword name */
- return 0;
+ if (keywordNameLen == 0) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR; /* empty keyword name */
+ return 0;
}
- buf[keywordNameLen] = 0; /* terminate */
+ buf[keywordNameLen] = 0; /* terminate */
return keywordNameLen;
}
@@ -601,10 +601,10 @@ compareKeywordStructs(const void * /*context*/, const void *left, const void *ri
return uprv_strcmp(leftString, rightString);
}
-static void
+static void
_getKeywords(const char *localeID,
char prev,
- ByteSink& sink,
+ ByteSink& sink,
UBool valuesToo,
UErrorCode *status)
{
@@ -630,7 +630,7 @@ _getKeywords(const char *localeID,
}
if(numKeywords == maxKeywords) {
*status = U_INTERNAL_PROGRAM_ERROR;
- return;
+ return;
}
equalSign = uprv_strchr(pos, '=');
semicolon = uprv_strchr(pos, ';');
@@ -638,13 +638,13 @@ _getKeywords(const char *localeID,
/* ';' before '=' [foo@currency;collation=pinyin] is illegal */
if(!equalSign || (semicolon && semicolon<equalSign)) {
*status = U_INVALID_FORMAT_ERROR;
- return;
+ return;
}
/* need to normalize both keyword and keyword name */
if(equalSign - pos >= ULOC_KEYWORD_BUFFER_LEN) {
/* keyword name too long for internal buffer */
*status = U_INTERNAL_PROGRAM_ERROR;
- return;
+ return;
}
for(i = 0, n = 0; i < equalSign - pos; ++i) {
if (pos[i] != ' ') {
@@ -655,7 +655,7 @@ _getKeywords(const char *localeID,
/* zero-length keyword is an error. */
if (n == 0) {
*status = U_INVALID_FORMAT_ERROR;
- return;
+ return;
}
keywordList[numKeywords].keyword[n] = 0;
@@ -670,7 +670,7 @@ _getKeywords(const char *localeID,
/* Premature end or zero-length value */
if (!*equalSign || equalSign == semicolon) {
*status = U_INVALID_FORMAT_ERROR;
- return;
+ return;
}
keywordList[numKeywords].valueStart = equalSign;
@@ -708,15 +708,15 @@ _getKeywords(const char *localeID,
/* Now construct the keyword part */
for(i = 0; i < numKeywords; i++) {
- sink.Append(keywordList[i].keyword, keywordList[i].keywordLen);
+ sink.Append(keywordList[i].keyword, keywordList[i].keywordLen);
if(valuesToo) {
- sink.Append("=", 1);
- sink.Append(keywordList[i].valueStart, keywordList[i].valueLen);
+ sink.Append("=", 1);
+ sink.Append(keywordList[i].valueStart, keywordList[i].valueLen);
if(i < numKeywords - 1) {
- sink.Append(";", 1);
+ sink.Append(";", 1);
}
- } else {
- sink.Append("\0", 1);
+ } else {
+ sink.Append("\0", 1);
}
}
}
@@ -728,26 +728,26 @@ locale_getKeywords(const char *localeID,
char *keywords, int32_t keywordCapacity,
UBool valuesToo,
UErrorCode *status) {
- if (U_FAILURE(*status)) {
- return 0;
- }
-
- CheckedArrayByteSink sink(keywords, keywordCapacity);
- _getKeywords(localeID, prev, sink, valuesToo, status);
-
- int32_t reslen = sink.NumberOfBytesAppended();
-
- if (U_FAILURE(*status)) {
- return reslen;
- }
-
- if (sink.Overflowed()) {
- *status = U_BUFFER_OVERFLOW_ERROR;
- } else {
- u_terminateChars(keywords, keywordCapacity, reslen, status);
- }
-
- return reslen;
+ if (U_FAILURE(*status)) {
+ return 0;
+ }
+
+ CheckedArrayByteSink sink(keywords, keywordCapacity);
+ _getKeywords(localeID, prev, sink, valuesToo, status);
+
+ int32_t reslen = sink.NumberOfBytesAppended();
+
+ if (U_FAILURE(*status)) {
+ return reslen;
+ }
+
+ if (sink.Overflowed()) {
+ *status = U_BUFFER_OVERFLOW_ERROR;
+ } else {
+ u_terminateChars(keywords, keywordCapacity, reslen, status);
+ }
+
+ return reslen;
}
U_CAPI int32_t U_EXPORT2
@@ -756,9 +756,9 @@ uloc_getKeywordValue(const char* localeID,
char* buffer, int32_t bufferCapacity,
UErrorCode* status)
{
- if (buffer != nullptr) {
- buffer[0] = '\0';
- }
+ if (buffer != nullptr) {
+ buffer[0] = '\0';
+ }
const char* startSearchHere = NULL;
const char* nextSeparator = NULL;
char keywordNameBuffer[ULOC_KEYWORD_BUFFER_LEN];
@@ -769,23 +769,23 @@ uloc_getKeywordValue(const char* localeID,
char tempBuffer[ULOC_FULLNAME_CAPACITY];
const char* tmpLocaleID;
- if (keywordName == NULL || keywordName[0] == 0) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- locale_canonKeywordName(keywordNameBuffer, keywordName, status);
- if(U_FAILURE(*status)) {
- return 0;
- }
-
+ if (keywordName == NULL || keywordName[0] == 0) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ locale_canonKeywordName(keywordNameBuffer, keywordName, status);
+ if(U_FAILURE(*status)) {
+ return 0;
+ }
+
if (_hasBCP47Extension(localeID)) {
_ConvertBCP47(tmpLocaleID, localeID, tempBuffer, sizeof(tempBuffer), status);
} else {
tmpLocaleID=localeID;
}
- startSearchHere = locale_getKeywordsStart(tmpLocaleID);
+ startSearchHere = locale_getKeywordsStart(tmpLocaleID);
if(startSearchHere == NULL) {
/* no keywords, return at once */
return 0;
@@ -793,78 +793,78 @@ uloc_getKeywordValue(const char* localeID,
/* find the first keyword */
while(startSearchHere) {
- const char* keyValueTail;
- int32_t keyValueLen;
-
- startSearchHere++; /* skip @ or ; */
- nextSeparator = uprv_strchr(startSearchHere, '=');
- if(!nextSeparator) {
- *status = U_ILLEGAL_ARGUMENT_ERROR; /* key must have =value */
- return 0;
- }
- /* strip leading & trailing spaces (TC decided to tolerate these) */
+ const char* keyValueTail;
+ int32_t keyValueLen;
+
+ startSearchHere++; /* skip @ or ; */
+ nextSeparator = uprv_strchr(startSearchHere, '=');
+ if(!nextSeparator) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR; /* key must have =value */
+ return 0;
+ }
+ /* strip leading & trailing spaces (TC decided to tolerate these) */
while(*startSearchHere == ' ') {
startSearchHere++;
}
- keyValueTail = nextSeparator;
- while (keyValueTail > startSearchHere && *(keyValueTail-1) == ' ') {
- keyValueTail--;
+ keyValueTail = nextSeparator;
+ while (keyValueTail > startSearchHere && *(keyValueTail-1) == ' ') {
+ keyValueTail--;
+ }
+ /* now keyValueTail points to first char after the keyName */
+ /* copy & normalize keyName from locale */
+ if (startSearchHere == keyValueTail) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR; /* empty keyword name in passed-in locale */
+ return 0;
}
- /* now keyValueTail points to first char after the keyName */
- /* copy & normalize keyName from locale */
- if (startSearchHere == keyValueTail) {
- *status = U_ILLEGAL_ARGUMENT_ERROR; /* empty keyword name in passed-in locale */
- return 0;
- }
- keyValueLen = 0;
- while (startSearchHere < keyValueTail) {
- if (!UPRV_ISALPHANUM(*startSearchHere)) {
- *status = U_ILLEGAL_ARGUMENT_ERROR; /* malformed keyword name */
- return 0;
- }
- if (keyValueLen < ULOC_KEYWORD_BUFFER_LEN - 1) {
- localeKeywordNameBuffer[keyValueLen++] = uprv_tolower(*startSearchHere++);
- } else {
+ keyValueLen = 0;
+ while (startSearchHere < keyValueTail) {
+ if (!UPRV_ISALPHANUM(*startSearchHere)) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR; /* malformed keyword name */
+ return 0;
+ }
+ 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;
- }
+ }
}
- localeKeywordNameBuffer[keyValueLen] = 0; /* terminate */
+ localeKeywordNameBuffer[keyValueLen] = 0; /* terminate */
startSearchHere = uprv_strchr(nextSeparator, ';');
if(uprv_strcmp(keywordNameBuffer, localeKeywordNameBuffer) == 0) {
- /* current entry matches the keyword. */
- nextSeparator++; /* skip '=' */
- /* First strip leading & trailing spaces (TC decided to tolerate these) */
+ /* current entry matches the keyword. */
+ nextSeparator++; /* skip '=' */
+ /* First strip leading & trailing spaces (TC decided to tolerate these) */
while(*nextSeparator == ' ') {
- nextSeparator++;
- }
- keyValueTail = (startSearchHere)? startSearchHere: nextSeparator + uprv_strlen(nextSeparator);
- while(keyValueTail > nextSeparator && *(keyValueTail-1) == ' ') {
- keyValueTail--;
- }
- /* 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;
- }
- 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++;
+ }
+ keyValueTail = (startSearchHere)? startSearchHere: nextSeparator + uprv_strlen(nextSeparator);
+ while(keyValueTail > nextSeparator && *(keyValueTail-1) == ' ') {
+ keyValueTail--;
+ }
+ /* 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;
+ }
+ 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++;
- }
+ }
}
- result = u_terminateChars(buffer, bufferCapacity, keyValueLen, status);
+ result = u_terminateChars(buffer, bufferCapacity, keyValueLen, status);
return result;
}
}
@@ -884,26 +884,26 @@ uloc_setKeywordValue(const char* keywordName,
int32_t bufLen;
int32_t needLen = 0;
char keywordNameBuffer[ULOC_KEYWORD_BUFFER_LEN];
- char keywordValueBuffer[ULOC_KEYWORDS_CAPACITY+1];
+ char keywordValueBuffer[ULOC_KEYWORDS_CAPACITY+1];
char localeKeywordNameBuffer[ULOC_KEYWORD_BUFFER_LEN];
int32_t rc;
char* nextSeparator = NULL;
char* nextEqualsign = NULL;
char* startSearchHere = NULL;
char* keywordStart = NULL;
- CharString updatedKeysAndValues;
- int32_t updatedKeysAndValuesLen;
- UBool handledInputKeyAndValue = FALSE;
- char keyValuePrefix = '@';
-
+ CharString updatedKeysAndValues;
+ int32_t updatedKeysAndValuesLen;
+ UBool handledInputKeyAndValue = FALSE;
+ char keyValuePrefix = '@';
+
if(U_FAILURE(*status)) {
return -1;
}
- if (keywordName == NULL || keywordName[0] == 0 || bufferCapacity <= 1) {
+ if (keywordName == NULL || keywordName[0] == 0 || bufferCapacity <= 1) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
- bufLen = (int32_t)uprv_strlen(buffer);
+ bufLen = (int32_t)uprv_strlen(buffer);
if(bufferCapacity<bufLen) {
/* The capacity is less than the length?! Is this NULL terminated? */
*status = U_ILLEGAL_ARGUMENT_ERROR;
@@ -913,29 +913,29 @@ uloc_setKeywordValue(const char* keywordName,
if(U_FAILURE(*status)) {
return 0;
}
-
- keywordValueLen = 0;
- if(keywordValue) {
- while (*keywordValue != 0) {
- if (!UPRV_ISALPHANUM(*keywordValue) && !UPRV_OK_VALUE_PUNCTUATION(*keywordValue)) {
- *status = U_ILLEGAL_ARGUMENT_ERROR; /* malformed key value */
- return 0;
- }
- if (keywordValueLen < ULOC_KEYWORDS_CAPACITY) {
- /* Should we force lowercase in value to set? */
- keywordValueBuffer[keywordValueLen++] = *keywordValue++;
- } else {
- /* keywordValue too long for internal buffer */
- *status = U_INTERNAL_PROGRAM_ERROR;
- return 0;
- }
- }
- }
- keywordValueBuffer[keywordValueLen] = 0; /* terminate */
-
+
+ keywordValueLen = 0;
+ if(keywordValue) {
+ while (*keywordValue != 0) {
+ if (!UPRV_ISALPHANUM(*keywordValue) && !UPRV_OK_VALUE_PUNCTUATION(*keywordValue)) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR; /* malformed key value */
+ return 0;
+ }
+ if (keywordValueLen < ULOC_KEYWORDS_CAPACITY) {
+ /* Should we force lowercase in value to set? */
+ keywordValueBuffer[keywordValueLen++] = *keywordValue++;
+ } else {
+ /* keywordValue too long for internal buffer */
+ *status = U_INTERNAL_PROGRAM_ERROR;
+ return 0;
+ }
+ }
+ }
+ keywordValueBuffer[keywordValueLen] = 0; /* terminate */
+
startSearchHere = (char*)locale_getKeywordsStart(buffer);
if(startSearchHere == NULL || (startSearchHere[1]==0)) {
- if(keywordValueLen == 0) { /* no keywords = nothing to remove */
+ if(keywordValueLen == 0) { /* no keywords = nothing to remove */
return bufLen;
}
@@ -950,137 +950,137 @@ uloc_setKeywordValue(const char* keywordName,
*status = U_BUFFER_OVERFLOW_ERROR;
return needLen; /* no change */
}
- *startSearchHere++ = '@';
+ *startSearchHere++ = '@';
uprv_strcpy(startSearchHere, keywordNameBuffer);
startSearchHere += keywordNameLen;
- *startSearchHere++ = '=';
- uprv_strcpy(startSearchHere, keywordValueBuffer);
+ *startSearchHere++ = '=';
+ uprv_strcpy(startSearchHere, keywordValueBuffer);
return needLen;
} /* end shortcut - no @ */
keywordStart = startSearchHere;
/* search for keyword */
while(keywordStart) {
- const char* keyValueTail;
- int32_t keyValueLen;
-
- keywordStart++; /* skip @ or ; */
- nextEqualsign = uprv_strchr(keywordStart, '=');
- if (!nextEqualsign) {
- *status = U_ILLEGAL_ARGUMENT_ERROR; /* key must have =value */
- return 0;
- }
- /* strip leading & trailing spaces (TC decided to tolerate these) */
+ const char* keyValueTail;
+ int32_t keyValueLen;
+
+ keywordStart++; /* skip @ or ; */
+ nextEqualsign = uprv_strchr(keywordStart, '=');
+ if (!nextEqualsign) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR; /* key must have =value */
+ return 0;
+ }
+ /* strip leading & trailing spaces (TC decided to tolerate these) */
while(*keywordStart == ' ') {
keywordStart++;
}
- keyValueTail = nextEqualsign;
- while (keyValueTail > keywordStart && *(keyValueTail-1) == ' ') {
- keyValueTail--;
+ keyValueTail = nextEqualsign;
+ while (keyValueTail > keywordStart && *(keyValueTail-1) == ' ') {
+ keyValueTail--;
}
- /* now keyValueTail points to first char after the keyName */
- /* copy & normalize keyName from locale */
- if (keywordStart == keyValueTail) {
- *status = U_ILLEGAL_ARGUMENT_ERROR; /* empty keyword name in passed-in locale */
+ /* now keyValueTail points to first char after the keyName */
+ /* copy & normalize keyName from locale */
+ if (keywordStart == keyValueTail) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR; /* empty keyword name in passed-in locale */
return 0;
}
- keyValueLen = 0;
- while (keywordStart < keyValueTail) {
- if (!UPRV_ISALPHANUM(*keywordStart)) {
- *status = U_ILLEGAL_ARGUMENT_ERROR; /* malformed keyword name */
- return 0;
- }
- if (keyValueLen < ULOC_KEYWORD_BUFFER_LEN - 1) {
- localeKeywordNameBuffer[keyValueLen++] = uprv_tolower(*keywordStart++);
- } else {
- /* keyword name too long for internal buffer */
- *status = U_INTERNAL_PROGRAM_ERROR;
- return 0;
- }
+ keyValueLen = 0;
+ while (keywordStart < keyValueTail) {
+ if (!UPRV_ISALPHANUM(*keywordStart)) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR; /* malformed keyword name */
+ return 0;
+ }
+ if (keyValueLen < ULOC_KEYWORD_BUFFER_LEN - 1) {
+ localeKeywordNameBuffer[keyValueLen++] = uprv_tolower(*keywordStart++);
+ } else {
+ /* keyword name too long for internal buffer */
+ *status = U_INTERNAL_PROGRAM_ERROR;
+ return 0;
+ }
+ }
+ localeKeywordNameBuffer[keyValueLen] = 0; /* terminate */
+
+ nextSeparator = uprv_strchr(nextEqualsign, ';');
+
+ /* start processing the value part */
+ nextEqualsign++; /* skip '=' */
+ /* First strip leading & trailing spaces (TC decided to tolerate these) */
+ while(*nextEqualsign == ' ') {
+ nextEqualsign++;
}
- localeKeywordNameBuffer[keyValueLen] = 0; /* terminate */
-
- nextSeparator = uprv_strchr(nextEqualsign, ';');
-
- /* start processing the value part */
- nextEqualsign++; /* skip '=' */
- /* First strip leading & trailing spaces (TC decided to tolerate these) */
- while(*nextEqualsign == ' ') {
- nextEqualsign++;
+ keyValueTail = (nextSeparator)? nextSeparator: nextEqualsign + uprv_strlen(nextEqualsign);
+ while(keyValueTail > nextEqualsign && *(keyValueTail-1) == ' ') {
+ keyValueTail--;
+ }
+ if (nextEqualsign == keyValueTail) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR; /* empty key value in passed-in locale */
+ return 0;
}
- keyValueTail = (nextSeparator)? nextSeparator: nextEqualsign + uprv_strlen(nextEqualsign);
- while(keyValueTail > nextEqualsign && *(keyValueTail-1) == ' ') {
- keyValueTail--;
- }
- if (nextEqualsign == keyValueTail) {
- *status = U_ILLEGAL_ARGUMENT_ERROR; /* empty key value in passed-in locale */
- return 0;
- }
rc = uprv_strcmp(keywordNameBuffer, localeKeywordNameBuffer);
if(rc == 0) {
- /* Current entry matches the input keyword. Update the entry */
- if(keywordValueLen > 0) { /* updating a value */
- updatedKeysAndValues.append(keyValuePrefix, *status);
- keyValuePrefix = ';'; /* for any subsequent key-value pair */
- updatedKeysAndValues.append(keywordNameBuffer, keywordNameLen, *status);
- updatedKeysAndValues.append('=', *status);
- updatedKeysAndValues.append(keywordValueBuffer, keywordValueLen, *status);
- } /* else removing this entry, don't emit anything */
- handledInputKeyAndValue = TRUE;
- } else {
- /* input keyword sorts earlier than current entry, add before current entry */
- if (rc < 0 && keywordValueLen > 0 && !handledInputKeyAndValue) {
- /* insert new entry at this location */
- updatedKeysAndValues.append(keyValuePrefix, *status);
- keyValuePrefix = ';'; /* for any subsequent key-value pair */
- updatedKeysAndValues.append(keywordNameBuffer, keywordNameLen, *status);
- updatedKeysAndValues.append('=', *status);
- updatedKeysAndValues.append(keywordValueBuffer, keywordValueLen, *status);
- handledInputKeyAndValue = TRUE;
+ /* Current entry matches the input keyword. Update the entry */
+ if(keywordValueLen > 0) { /* updating a value */
+ updatedKeysAndValues.append(keyValuePrefix, *status);
+ keyValuePrefix = ';'; /* for any subsequent key-value pair */
+ updatedKeysAndValues.append(keywordNameBuffer, keywordNameLen, *status);
+ updatedKeysAndValues.append('=', *status);
+ updatedKeysAndValues.append(keywordValueBuffer, keywordValueLen, *status);
+ } /* else removing this entry, don't emit anything */
+ handledInputKeyAndValue = TRUE;
+ } else {
+ /* input keyword sorts earlier than current entry, add before current entry */
+ if (rc < 0 && keywordValueLen > 0 && !handledInputKeyAndValue) {
+ /* insert new entry at this location */
+ updatedKeysAndValues.append(keyValuePrefix, *status);
+ keyValuePrefix = ';'; /* for any subsequent key-value pair */
+ updatedKeysAndValues.append(keywordNameBuffer, keywordNameLen, *status);
+ updatedKeysAndValues.append('=', *status);
+ updatedKeysAndValues.append(keywordValueBuffer, keywordValueLen, *status);
+ handledInputKeyAndValue = TRUE;
}
- /* copy the current entry */
- updatedKeysAndValues.append(keyValuePrefix, *status);
- keyValuePrefix = ';'; /* for any subsequent key-value pair */
- updatedKeysAndValues.append(localeKeywordNameBuffer, keyValueLen, *status);
- updatedKeysAndValues.append('=', *status);
- updatedKeysAndValues.append(nextEqualsign, static_cast<int32_t>(keyValueTail-nextEqualsign), *status);
+ /* copy the current entry */
+ updatedKeysAndValues.append(keyValuePrefix, *status);
+ keyValuePrefix = ';'; /* for any subsequent key-value pair */
+ updatedKeysAndValues.append(localeKeywordNameBuffer, keyValueLen, *status);
+ updatedKeysAndValues.append('=', *status);
+ updatedKeysAndValues.append(nextEqualsign, static_cast<int32_t>(keyValueTail-nextEqualsign), *status);
+ }
+ if (!nextSeparator && keywordValueLen > 0 && !handledInputKeyAndValue) {
+ /* append new entry at the end, it sorts later than existing entries */
+ updatedKeysAndValues.append(keyValuePrefix, *status);
+ /* skip keyValuePrefix update, no subsequent key-value pair */
+ updatedKeysAndValues.append(keywordNameBuffer, keywordNameLen, *status);
+ updatedKeysAndValues.append('=', *status);
+ updatedKeysAndValues.append(keywordValueBuffer, keywordValueLen, *status);
+ handledInputKeyAndValue = TRUE;
}
- if (!nextSeparator && keywordValueLen > 0 && !handledInputKeyAndValue) {
- /* append new entry at the end, it sorts later than existing entries */
- updatedKeysAndValues.append(keyValuePrefix, *status);
- /* skip keyValuePrefix update, no subsequent key-value pair */
- updatedKeysAndValues.append(keywordNameBuffer, keywordNameLen, *status);
- updatedKeysAndValues.append('=', *status);
- updatedKeysAndValues.append(keywordValueBuffer, keywordValueLen, *status);
- handledInputKeyAndValue = TRUE;
- }
keywordStart = nextSeparator;
} /* end loop searching */
- /* Any error from updatedKeysAndValues.append above would be internal and not due to
- * problems with the passed-in locale. So if we did encounter problems with the
- * passed-in locale above, those errors took precedence and overrode any error
- * status from updatedKeysAndValues.append, and also caused a return of 0. If there
- * are errors here they are from updatedKeysAndValues.append; they do cause an
- * error return but the passed-in locale is unmodified and the original bufLen is
- * returned.
- */
- if (!handledInputKeyAndValue || U_FAILURE(*status)) {
- /* if input key/value specified removal of a keyword not present in locale, or
- * there was an error in CharString.append, leave original locale alone. */
- return bufLen;
- }
-
- updatedKeysAndValuesLen = updatedKeysAndValues.length();
- /* needLen = length of the part before '@' + length of updated key-value part including '@' */
- needLen = (int32_t)(startSearchHere - buffer) + updatedKeysAndValuesLen;
+ /* Any error from updatedKeysAndValues.append above would be internal and not due to
+ * problems with the passed-in locale. So if we did encounter problems with the
+ * passed-in locale above, those errors took precedence and overrode any error
+ * status from updatedKeysAndValues.append, and also caused a return of 0. If there
+ * are errors here they are from updatedKeysAndValues.append; they do cause an
+ * error return but the passed-in locale is unmodified and the original bufLen is
+ * returned.
+ */
+ if (!handledInputKeyAndValue || U_FAILURE(*status)) {
+ /* if input key/value specified removal of a keyword not present in locale, or
+ * there was an error in CharString.append, leave original locale alone. */
+ 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);
+ if (updatedKeysAndValuesLen > 0) {
+ uprv_strncpy(startSearchHere, updatedKeysAndValues.data(), updatedKeysAndValuesLen);
}
buffer[needLen]=0;
return needLen;
@@ -1148,70 +1148,70 @@ uloc_getCurrentLanguageID(const char* oldID){
*
* TODO try to use this in Locale
*/
-static CharString
+static CharString
ulocimp_getLanguage(const char *localeID,
- const char **pEnd,
- UErrorCode &status) {
- CharString result;
-
- if (uprv_stricmp(localeID, "root") == 0) {
- localeID += 4;
- } else if (uprv_strnicmp(localeID, "und", 3) == 0 &&
- (localeID[3] == '\0' ||
- localeID[3] == '-' ||
- localeID[3] == '_' ||
- localeID[3] == '@')) {
- localeID += 3;
- }
-
+ const char **pEnd,
+ UErrorCode &status) {
+ CharString result;
+
+ if (uprv_stricmp(localeID, "root") == 0) {
+ localeID += 4;
+ } else if (uprv_strnicmp(localeID, "und", 3) == 0 &&
+ (localeID[3] == '\0' ||
+ localeID[3] == '-' ||
+ localeID[3] == '_' ||
+ localeID[3] == '@')) {
+ localeID += 3;
+ }
+
/* if it starts with i- or x- then copy that prefix */
if(_isIDPrefix(localeID)) {
- result.append((char)uprv_tolower(*localeID), status);
- result.append('-', status);
+ result.append((char)uprv_tolower(*localeID), status);
+ result.append('-', status);
localeID+=2;
}
/* copy the language as far as possible and count its length */
while(!_isTerminator(*localeID) && !_isIDSeparator(*localeID)) {
- result.append((char)uprv_tolower(*localeID), status);
+ result.append((char)uprv_tolower(*localeID), status);
localeID++;
}
- if(result.length()==3) {
+ if(result.length()==3) {
/* convert 3 character code to 2 character code if possible *CWB*/
- int32_t offset = _findIndex(LANGUAGES_3, result.data());
+ int32_t offset = _findIndex(LANGUAGES_3, result.data());
if(offset>=0) {
- result.clear();
- result.append(LANGUAGES[offset], status);
+ result.clear();
+ result.append(LANGUAGES[offset], status);
}
}
if(pEnd!=NULL) {
*pEnd=localeID;
}
-
- return result;
+
+ 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
+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
ulocimp_getScript(const char *localeID,
- const char **pEnd,
- UErrorCode &status) {
- CharString result;
+ const char **pEnd,
+ UErrorCode &status) {
+ CharString result;
int32_t idLen = 0;
if (pEnd != NULL) {
@@ -1231,40 +1231,40 @@ ulocimp_getScript(const char *localeID,
*pEnd = localeID+idLen;
}
if (idLen >= 1) {
- result.append((char)uprv_toupper(*(localeID++)), status);
+ result.append((char)uprv_toupper(*(localeID++)), status);
}
for (i = 1; i < idLen; i++) {
- result.append((char)uprv_tolower(*(localeID++)), status);
+ result.append((char)uprv_tolower(*(localeID++)), status);
}
}
-
- 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;
+
+ return result;
}
-static CharString
+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
ulocimp_getCountry(const char *localeID,
- const char **pEnd,
- UErrorCode &status) {
- CharString result;
+ const char **pEnd,
+ UErrorCode &status) {
+ CharString result;
int32_t idLen=0;
/* copy the country as far as possible and count its length */
while(!_isTerminator(localeID[idLen]) && !_isIDSeparator(localeID[idLen])) {
- result.append((char)uprv_toupper(localeID[idLen]), status);
+ result.append((char)uprv_toupper(localeID[idLen]), status);
idLen++;
}
@@ -1272,95 +1272,95 @@ ulocimp_getCountry(const char *localeID,
if (idLen == 2 || idLen == 3) {
/* convert 3 character code to 2 character code if possible *CWB*/
if(idLen==3) {
- int32_t offset = _findIndex(COUNTRIES_3, result.data());
+ int32_t offset = _findIndex(COUNTRIES_3, result.data());
if(offset>=0) {
- result.clear();
- result.append(COUNTRIES[offset], status);
+ result.clear();
+ result.append(COUNTRIES[offset], status);
}
}
localeID+=idLen;
} else {
- result.clear();
+ result.clear();
}
if(pEnd!=NULL) {
*pEnd=localeID;
}
- return result;
+ 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;
}
-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
+static void
_getVariantEx(const char *localeID,
char prev,
- ByteSink& sink,
+ ByteSink& sink,
UBool needSeparator) {
- UBool hasVariant = FALSE;
+ UBool hasVariant = FALSE;
/* get one or more variant tags and separate them with '_' */
if(_isIDSeparator(prev)) {
/* get a variant string after a '-' or '_' */
while(!_isTerminator(*localeID)) {
if (needSeparator) {
- sink.Append("_", 1);
+ sink.Append("_", 1);
needSeparator = FALSE;
}
- char c = (char)uprv_toupper(*localeID);
- if (c == '-') c = '_';
- sink.Append(&c, 1);
- hasVariant = TRUE;
+ char c = (char)uprv_toupper(*localeID);
+ if (c == '-') c = '_';
+ sink.Append(&c, 1);
+ hasVariant = TRUE;
localeID++;
}
}
/* if there is no variant tag after a '-' or '_' then look for '@' */
- if(!hasVariant) {
+ if(!hasVariant) {
if(prev=='@') {
/* keep localeID */
} else if((localeID=locale_getKeywordsStart(localeID))!=NULL) {
++localeID; /* point after the '@' */
} else {
- return;
+ return;
}
while(!_isTerminator(*localeID)) {
if (needSeparator) {
- sink.Append("_", 1);
+ sink.Append("_", 1);
needSeparator = FALSE;
}
- char c = (char)uprv_toupper(*localeID);
- if (c == '-' || c == ',') c = '_';
- sink.Append(&c, 1);
+ char c = (char)uprv_toupper(*localeID);
+ if (c == '-' || c == ',') c = '_';
+ sink.Append(&c, 1);
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
+_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
@@ -1437,29 +1437,29 @@ static const UEnumeration gKeywordsEnum = {
U_CAPI UEnumeration* U_EXPORT2
uloc_openKeywordList(const char *keywordList, int32_t keywordListSize, UErrorCode* status)
{
- LocalMemory<UKeywordsContext> myContext;
- LocalMemory<UEnumeration> result;
+ LocalMemory<UKeywordsContext> myContext;
+ LocalMemory<UEnumeration> result;
- if (U_FAILURE(*status)) {
- return nullptr;
+ if (U_FAILURE(*status)) {
+ return nullptr;
}
- myContext.adoptInstead(static_cast<UKeywordsContext *>(uprv_malloc(sizeof(UKeywordsContext))));
- result.adoptInstead(static_cast<UEnumeration *>(uprv_malloc(sizeof(UEnumeration))));
- if (myContext.isNull() || result.isNull()) {
+ myContext.adoptInstead(static_cast<UKeywordsContext *>(uprv_malloc(sizeof(UKeywordsContext))));
+ result.adoptInstead(static_cast<UEnumeration *>(uprv_malloc(sizeof(UEnumeration))));
+ if (myContext.isNull() || result.isNull()) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
+ return nullptr;
}
- uprv_memcpy(result.getAlias(), &gKeywordsEnum, sizeof(UEnumeration));
- myContext->keywords = static_cast<char *>(uprv_malloc(keywordListSize+1));
- if (myContext->keywords == nullptr) {
+ uprv_memcpy(result.getAlias(), &gKeywordsEnum, sizeof(UEnumeration));
+ myContext->keywords = static_cast<char *>(uprv_malloc(keywordListSize+1));
+ if (myContext->keywords == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
+ return nullptr;
}
uprv_memcpy(myContext->keywords, keywordList, keywordListSize);
myContext->keywords[keywordListSize] = 0;
myContext->current = myContext->keywords;
- result->context = myContext.orphan();
- return result.orphan();
+ result->context = myContext.orphan();
+ return result.orphan();
}
U_CAPI UEnumeration* U_EXPORT2
@@ -1506,7 +1506,7 @@ uloc_openKeywords(const char* localeID,
/* keywords are located after '@' */
if((tmpLocaleID = locale_getKeywordsStart(tmpLocaleID)) != NULL) {
- i=locale_getKeywords(tmpLocaleID+1, '@', keywords, keywordsCapacity, FALSE, status);
+ i=locale_getKeywords(tmpLocaleID+1, '@', keywords, keywordsCapacity, FALSE, status);
}
if(i) {
@@ -1533,12 +1533,12 @@ static const char i_default[] = {'i', '-', 'd', 'e', 'f', 'a', 'u', 'l', 't'};
*
* This is the code underlying uloc_getName and uloc_canonicalize.
*/
-static void
+static void
_canonicalize(const char* localeID,
- ByteSink& sink,
+ ByteSink& sink,
uint32_t options,
UErrorCode* err) {
- int32_t j, fieldCount=0, scriptSize=0, variantSize=0;
+ int32_t j, fieldCount=0, scriptSize=0, variantSize=0;
char tempBuffer[ULOC_FULLNAME_CAPACITY];
const char* origLocaleID;
const char* tmpLocaleID;
@@ -1546,7 +1546,7 @@ _canonicalize(const char* localeID,
const char* separatorIndicator = NULL;
if (U_FAILURE(*err)) {
- return;
+ return;
}
if (_hasBCP47Extension(localeID)) {
@@ -1561,53 +1561,53 @@ _canonicalize(const char* localeID,
origLocaleID=tmpLocaleID;
/* get all pieces, one after another, and separate with '_' */
- CharString tag = ulocimp_getLanguage(tmpLocaleID, &tmpLocaleID, *err);
+ CharString tag = ulocimp_getLanguage(tmpLocaleID, &tmpLocaleID, *err);
- if (tag.length() == I_DEFAULT_LENGTH &&
- uprv_strncmp(origLocaleID, i_default, I_DEFAULT_LENGTH) == 0) {
- tag.clear();
- tag.append(uloc_getDefault(), *err);
+ if (tag.length() == I_DEFAULT_LENGTH &&
+ uprv_strncmp(origLocaleID, i_default, I_DEFAULT_LENGTH) == 0) {
+ tag.clear();
+ tag.append(uloc_getDefault(), *err);
} else if(_isIDSeparator(*tmpLocaleID)) {
const char *scriptID;
++fieldCount;
- tag.append('_', *err);
+ tag.append('_', *err);
- CharString script = ulocimp_getScript(tmpLocaleID+1, &scriptID, *err);
- tag.append(script, *err);
- scriptSize = script.length();
+ CharString script = ulocimp_getScript(tmpLocaleID+1, &scriptID, *err);
+ tag.append(script, *err);
+ scriptSize = script.length();
if(scriptSize > 0) {
/* Found optional script */
tmpLocaleID = scriptID;
++fieldCount;
if (_isIDSeparator(*tmpLocaleID)) {
/* If there is something else, then we add the _ */
- tag.append('_', *err);
+ tag.append('_', *err);
}
}
if (_isIDSeparator(*tmpLocaleID)) {
const char *cntryID;
-
- CharString country = ulocimp_getCountry(tmpLocaleID+1, &cntryID, *err);
- tag.append(country, *err);
- if (!country.isEmpty()) {
+
+ CharString country = ulocimp_getCountry(tmpLocaleID+1, &cntryID, *err);
+ tag.append(country, *err);
+ if (!country.isEmpty()) {
/* Found optional country */
tmpLocaleID = cntryID;
}
if(_isIDSeparator(*tmpLocaleID)) {
/* If there is something else, then we add the _ if we found country before. */
- if (!_isIDSeparator(*(tmpLocaleID+1))) {
+ if (!_isIDSeparator(*(tmpLocaleID+1))) {
++fieldCount;
- tag.append('_', *err);
+ tag.append('_', *err);
}
- variantSize = -tag.length();
- {
- CharStringByteSink s(&tag);
- _getVariantEx(tmpLocaleID+1, *tmpLocaleID, s, FALSE);
- }
- variantSize += tag.length();
+ variantSize = -tag.length();
+ {
+ CharStringByteSink s(&tag);
+ _getVariantEx(tmpLocaleID+1, *tmpLocaleID, s, FALSE);
+ }
+ variantSize += tag.length();
if (variantSize > 0) {
tmpLocaleID += variantSize + 1; /* skip '_' and variant */
}
@@ -1626,7 +1626,7 @@ _canonicalize(const char* localeID,
done = TRUE;
break;
default:
- tag.append(c, *err);
+ tag.append(c, *err);
++tmpLocaleID;
break;
}
@@ -1648,7 +1648,7 @@ _canonicalize(const char* localeID,
if (c == 0) {
break;
}
- tag.append(c, *err);
+ tag.append(c, *err);
++tmpLocaleID;
}
}
@@ -1659,17 +1659,17 @@ _canonicalize(const char* localeID,
/* Add missing '_' if needed */
if (fieldCount < 2 || (fieldCount < 3 && scriptSize > 0)) {
do {
- tag.append('_', *err);
+ tag.append('_', *err);
++fieldCount;
} while(fieldCount<2);
}
-
- int32_t posixVariantSize = -tag.length();
- {
- CharStringByteSink s(&tag);
- _getVariantEx(tmpLocaleID+1, '@', s, (UBool)(variantSize > 0));
- }
- posixVariantSize += tag.length();
+
+ int32_t posixVariantSize = -tag.length();
+ {
+ CharStringByteSink s(&tag);
+ _getVariantEx(tmpLocaleID+1, '@', s, (UBool)(variantSize > 0));
+ }
+ posixVariantSize += tag.length();
if (posixVariantSize > 0) {
variantSize += posixVariantSize;
}
@@ -1677,26 +1677,26 @@ _canonicalize(const char* localeID,
/* Look up the ID in the canonicalization map */
for (j=0; j<UPRV_LENGTHOF(CANONICALIZE_MAP); j++) {
- StringPiece id(CANONICALIZE_MAP[j].id);
- if (tag == id) {
- if (id.empty() && tmpLocaleID != NULL) {
+ StringPiece id(CANONICALIZE_MAP[j].id);
+ if (tag == id) {
+ if (id.empty() && tmpLocaleID != NULL) {
break; /* Don't remap "" if keywords present */
}
- tag.clear();
- tag.append(CANONICALIZE_MAP[j].canonicalID, *err);
+ tag.clear();
+ tag.append(CANONICALIZE_MAP[j].canonicalID, *err);
break;
}
}
}
- sink.Append(tag.data(), tag.length());
-
+ sink.Append(tag.data(), tag.length());
+
if (!OPTION_SET(options, _ULOC_STRIP_KEYWORDS)) {
if (tmpLocaleID!=NULL && keywordAssign!=NULL &&
(!separatorIndicator || separatorIndicator > keywordAssign)) {
- sink.Append("@", 1);
+ sink.Append("@", 1);
++fieldCount;
- _getKeywords(tmpLocaleID+1, '@', sink, TRUE, err);
+ _getKeywords(tmpLocaleID+1, '@', sink, TRUE, err);
}
}
}
@@ -1725,16 +1725,16 @@ uloc_getParent(const char* localeID,
i=0;
}
- if (i > 0) {
- if (uprv_strnicmp(localeID, "und_", 4) == 0) {
- localeID += 3;
- i -= 3;
- uprv_memmove(parent, localeID, uprv_min(i, parentCapacity));
- } else if (parent != localeID) {
- uprv_memcpy(parent, localeID, uprv_min(i, parentCapacity));
- }
+ if (i > 0) {
+ if (uprv_strnicmp(localeID, "und_", 4) == 0) {
+ localeID += 3;
+ i -= 3;
+ uprv_memmove(parent, localeID, uprv_min(i, parentCapacity));
+ } else if (parent != localeID) {
+ uprv_memcpy(parent, localeID, uprv_min(i, parentCapacity));
+ }
}
-
+
return u_terminateChars(parent, parentCapacity, i, err);
}
@@ -1883,108 +1883,108 @@ uloc_getName(const char* localeID,
int32_t nameCapacity,
UErrorCode* err)
{
- if (U_FAILURE(*err)) {
- return 0;
- }
-
- CheckedArrayByteSink sink(name, nameCapacity);
- ulocimp_getName(localeID, sink, err);
-
- int32_t reslen = sink.NumberOfBytesAppended();
-
- if (U_FAILURE(*err)) {
- return reslen;
- }
-
- if (sink.Overflowed()) {
- *err = U_BUFFER_OVERFLOW_ERROR;
- } else {
- u_terminateChars(name, nameCapacity, reslen, err);
- }
-
- return reslen;
+ if (U_FAILURE(*err)) {
+ return 0;
+ }
+
+ CheckedArrayByteSink sink(name, nameCapacity);
+ ulocimp_getName(localeID, sink, err);
+
+ int32_t reslen = sink.NumberOfBytesAppended();
+
+ if (U_FAILURE(*err)) {
+ return reslen;
+ }
+
+ if (sink.Overflowed()) {
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ } else {
+ u_terminateChars(name, nameCapacity, reslen, err);
+ }
+
+ return reslen;
+}
+
+U_STABLE void U_EXPORT2
+ulocimp_getName(const char* localeID,
+ ByteSink& sink,
+ UErrorCode* err)
+{
+ _canonicalize(localeID, sink, 0, err);
}
-U_STABLE void U_EXPORT2
-ulocimp_getName(const char* localeID,
- ByteSink& sink,
- UErrorCode* err)
-{
- _canonicalize(localeID, sink, 0, err);
-}
-
U_CAPI int32_t U_EXPORT2
uloc_getBaseName(const char* localeID,
char* name,
int32_t nameCapacity,
UErrorCode* err)
{
- if (U_FAILURE(*err)) {
- return 0;
- }
-
- CheckedArrayByteSink sink(name, nameCapacity);
- ulocimp_getBaseName(localeID, sink, err);
-
- int32_t reslen = sink.NumberOfBytesAppended();
-
- if (U_FAILURE(*err)) {
- return reslen;
- }
-
- if (sink.Overflowed()) {
- *err = U_BUFFER_OVERFLOW_ERROR;
- } else {
- u_terminateChars(name, nameCapacity, reslen, err);
- }
-
- return reslen;
+ if (U_FAILURE(*err)) {
+ return 0;
+ }
+
+ CheckedArrayByteSink sink(name, nameCapacity);
+ ulocimp_getBaseName(localeID, sink, err);
+
+ int32_t reslen = sink.NumberOfBytesAppended();
+
+ if (U_FAILURE(*err)) {
+ return reslen;
+ }
+
+ if (sink.Overflowed()) {
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ } else {
+ u_terminateChars(name, nameCapacity, reslen, err);
+ }
+
+ return reslen;
+}
+
+U_STABLE void U_EXPORT2
+ulocimp_getBaseName(const char* localeID,
+ ByteSink& sink,
+ UErrorCode* err)
+{
+ _canonicalize(localeID, sink, _ULOC_STRIP_KEYWORDS, err);
}
-U_STABLE void U_EXPORT2
-ulocimp_getBaseName(const char* localeID,
- ByteSink& sink,
- UErrorCode* err)
-{
- _canonicalize(localeID, sink, _ULOC_STRIP_KEYWORDS, err);
-}
-
U_CAPI int32_t U_EXPORT2
uloc_canonicalize(const char* localeID,
char* name,
int32_t nameCapacity,
UErrorCode* err)
{
- if (U_FAILURE(*err)) {
- return 0;
- }
-
- CheckedArrayByteSink sink(name, nameCapacity);
- ulocimp_canonicalize(localeID, sink, err);
-
- int32_t reslen = sink.NumberOfBytesAppended();
-
- if (U_FAILURE(*err)) {
- return reslen;
- }
-
- if (sink.Overflowed()) {
- *err = U_BUFFER_OVERFLOW_ERROR;
- } else {
- u_terminateChars(name, nameCapacity, reslen, err);
- }
-
- return reslen;
+ if (U_FAILURE(*err)) {
+ return 0;
+ }
+
+ CheckedArrayByteSink sink(name, nameCapacity);
+ ulocimp_canonicalize(localeID, sink, err);
+
+ int32_t reslen = sink.NumberOfBytesAppended();
+
+ if (U_FAILURE(*err)) {
+ return reslen;
+ }
+
+ if (sink.Overflowed()) {
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ } else {
+ u_terminateChars(name, nameCapacity, reslen, err);
+ }
+
+ return reslen;
+}
+
+U_STABLE void U_EXPORT2
+ulocimp_canonicalize(const char* localeID,
+ ByteSink& sink,
+ UErrorCode* err)
+{
+ _canonicalize(localeID, sink, _ULOC_CANONICALIZE, err);
}
-U_STABLE void U_EXPORT2
-ulocimp_canonicalize(const char* localeID,
- ByteSink& sink,
- UErrorCode* err)
-{
- _canonicalize(localeID, sink, _ULOC_CANONICALIZE, err);
-}
-
U_CAPI const char* U_EXPORT2
uloc_getISO3Language(const char* localeID)
{
@@ -2031,29 +2031,29 @@ uloc_getLCID(const char* localeID)
{
UErrorCode status = U_ZERO_ERROR;
char langID[ULOC_FULLNAME_CAPACITY];
- uint32_t lcid = 0;
-
- /* Check for incomplete id. */
- if (!localeID || uprv_strlen(localeID) < 2) {
- return 0;
- }
-
- // First, attempt Windows platform lookup if available, but fall
- // through to catch any special cases (ICU vs Windows name differences).
- lcid = uprv_convertToLCIDPlatform(localeID, &status);
+ uint32_t lcid = 0;
+
+ /* Check for incomplete id. */
+ if (!localeID || uprv_strlen(localeID) < 2) {
+ return 0;
+ }
+
+ // First, attempt Windows platform lookup if available, but fall
+ // through to catch any special cases (ICU vs Windows name differences).
+ lcid = uprv_convertToLCIDPlatform(localeID, &status);
if (U_FAILURE(status)) {
return 0;
}
- if (lcid > 0) {
- // Windows found an LCID, return that
- return lcid;
- }
+ if (lcid > 0) {
+ // Windows found an LCID, return that
+ return lcid;
+ }
+
+ uloc_getLanguage(localeID, langID, sizeof(langID), &status);
+ if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING) {
+ return 0;
+ }
- uloc_getLanguage(localeID, langID, sizeof(langID), &status);
- if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING) {
- return 0;
- }
-
if (uprv_strchr(localeID, '@')) {
// uprv_convertToLCID does not support keywords other than collation.
// Remove all keywords except collation.
@@ -2205,10 +2205,10 @@ uloc_toLegacyKey(const char* keyword)
// Checks if the specified locale key is well-formed with the legacy locale syntax.
//
// Note:
- // LDML/CLDR provides some definition of keyword syntax in
- // * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier and
- // * http://www.unicode.org/reports/tr35/#Old_Locale_Extension_Syntax
- // Keys can only consist of [0-9a-zA-Z].
+ // LDML/CLDR provides some definition of keyword syntax in
+ // * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier and
+ // * http://www.unicode.org/reports/tr35/#Old_Locale_Extension_Syntax
+ // Keys can only consist of [0-9a-zA-Z].
if (isWellFormedLegacyKey(keyword)) {
return keyword;
}
@@ -2224,11 +2224,11 @@ uloc_toLegacyType(const char* keyword, const char* value)
// Checks if the specified locale type is well-formed with the legacy locale syntax.
//
// Note:
- // LDML/CLDR provides some definition of keyword syntax in
- // * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier and
- // * http://www.unicode.org/reports/tr35/#Old_Locale_Extension_Syntax
- // Values (types) can only consist of [0-9a-zA-Z], plus for legacy values
- // we allow [/_-+] in the middle (e.g. "Etc/GMT+1", "Asia/Tel_Aviv")
+ // LDML/CLDR provides some definition of keyword syntax in
+ // * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier and
+ // * http://www.unicode.org/reports/tr35/#Old_Locale_Extension_Syntax
+ // Values (types) can only consist of [0-9a-zA-Z], plus for legacy values
+ // we allow [/_-+] in the middle (e.g. "Etc/GMT+1", "Asia/Tel_Aviv")
if (isWellFormedLegacyType(value)) {
return value;
}
diff --git a/contrib/libs/icu/common/uloc_keytype.cpp b/contrib/libs/icu/common/uloc_keytype.cpp
index 53632be700..019da058cf 100644
--- a/contrib/libs/icu/common/uloc_keytype.cpp
+++ b/contrib/libs/icu/common/uloc_keytype.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -6,14 +6,14 @@
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
-#include <algorithm>
-
+#include <algorithm>
+
#include "unicode/utypes.h"
-#include "unicode/unistr.h"
-#include "unicode/uobject.h"
+#include "unicode/unistr.h"
+#include "unicode/uobject.h"
-#include "charstr.h"
-#include "cmemory.h"
+#include "charstr.h"
+#include "cmemory.h"
#include "cstring.h"
#include "uassert.h"
#include "ucln_cmn.h"
@@ -34,22 +34,22 @@ typedef enum {
SPECIALTYPE_RG_KEY_VALUE = 4
} SpecialType;
-struct LocExtKeyData : public icu::UMemory {
+struct LocExtKeyData : public icu::UMemory {
const char* legacyId;
const char* bcpId;
- icu::LocalUHashtablePointer typeMap;
+ icu::LocalUHashtablePointer typeMap;
uint32_t specialTypes;
-};
+};
-struct LocExtType : public icu::UMemory {
+struct LocExtType : public icu::UMemory {
const char* legacyId;
const char* bcpId;
-};
+};
+
+static icu::MemoryPool<icu::CharString>* gKeyTypeStringPool = NULL;
+static icu::MemoryPool<LocExtKeyData>* gLocExtKeyDataEntries = NULL;
+static icu::MemoryPool<LocExtType>* gLocExtTypeEntries = NULL;
-static icu::MemoryPool<icu::CharString>* gKeyTypeStringPool = NULL;
-static icu::MemoryPool<LocExtKeyData>* gLocExtKeyDataEntries = NULL;
-static icu::MemoryPool<LocExtType>* gLocExtTypeEntries = NULL;
-
U_CDECL_BEGIN
static UBool U_CALLCONV
@@ -95,20 +95,20 @@ initFromResourceBundle(UErrorCode& sts) {
tmpSts = U_ZERO_ERROR;
LocalUResourceBundlePointer bcpTypeAliasRes(ures_getByKey(keyTypeDataRes.getAlias(), "bcpTypeAlias", NULL, &tmpSts));
- // initialize pools storing dynamically allocated objects
- gKeyTypeStringPool = new icu::MemoryPool<icu::CharString>;
+ // initialize pools storing dynamically allocated objects
+ gKeyTypeStringPool = new icu::MemoryPool<icu::CharString>;
if (gKeyTypeStringPool == NULL) {
- sts = U_MEMORY_ALLOCATION_ERROR;
+ sts = U_MEMORY_ALLOCATION_ERROR;
return;
}
- gLocExtKeyDataEntries = new icu::MemoryPool<LocExtKeyData>;
+ gLocExtKeyDataEntries = new icu::MemoryPool<LocExtKeyData>;
if (gLocExtKeyDataEntries == NULL) {
- sts = U_MEMORY_ALLOCATION_ERROR;
+ sts = U_MEMORY_ALLOCATION_ERROR;
return;
}
- gLocExtTypeEntries = new icu::MemoryPool<LocExtType>;
+ gLocExtTypeEntries = new icu::MemoryPool<LocExtType>;
if (gLocExtTypeEntries == NULL) {
- sts = U_MEMORY_ALLOCATION_ERROR;
+ sts = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -121,24 +121,24 @@ initFromResourceBundle(UErrorCode& sts) {
break;
}
const char* legacyKeyId = ures_getKey(keyMapEntry.getAlias());
- UnicodeString uBcpKeyId = ures_getUnicodeString(keyMapEntry.getAlias(), &sts);
+ UnicodeString uBcpKeyId = ures_getUnicodeString(keyMapEntry.getAlias(), &sts);
if (U_FAILURE(sts)) {
break;
}
// empty value indicates that BCP key is same with the legacy key.
const char* bcpKeyId = legacyKeyId;
- if (!uBcpKeyId.isEmpty()) {
- icu::CharString* bcpKeyIdBuf = gKeyTypeStringPool->create();
+ if (!uBcpKeyId.isEmpty()) {
+ icu::CharString* bcpKeyIdBuf = gKeyTypeStringPool->create();
if (bcpKeyIdBuf == NULL) {
sts = U_MEMORY_ALLOCATION_ERROR;
break;
}
- bcpKeyIdBuf->appendInvariantChars(uBcpKeyId, sts);
+ bcpKeyIdBuf->appendInvariantChars(uBcpKeyId, sts);
if (U_FAILURE(sts)) {
break;
}
- bcpKeyId = bcpKeyIdBuf->data();
+ bcpKeyId = bcpKeyIdBuf->data();
}
UBool isTZ = uprv_strcmp(legacyKeyId, "timezone") == 0;
@@ -172,7 +172,7 @@ initFromResourceBundle(UErrorCode& sts) {
LocalUResourceBundlePointer typeMapResByKey(ures_getByKey(typeMapRes.getAlias(), legacyKeyId, NULL, &tmpSts));
if (U_FAILURE(tmpSts)) {
// type map for each key must exist
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
} else {
LocalUResourceBundlePointer typeMapEntry;
@@ -201,8 +201,8 @@ initFromResourceBundle(UErrorCode& sts) {
// a timezone key uses a colon instead of a slash in the resource.
// e.g. America:Los_Angeles
if (uprv_strchr(legacyTypeId, ':') != NULL) {
- icu::CharString* legacyTypeIdBuf =
- gKeyTypeStringPool->create(legacyTypeId, sts);
+ icu::CharString* legacyTypeIdBuf =
+ gKeyTypeStringPool->create(legacyTypeId, sts);
if (legacyTypeIdBuf == NULL) {
sts = U_MEMORY_ALLOCATION_ERROR;
break;
@@ -210,39 +210,39 @@ initFromResourceBundle(UErrorCode& sts) {
if (U_FAILURE(sts)) {
break;
}
- std::replace(
- legacyTypeIdBuf->data(),
- legacyTypeIdBuf->data() + legacyTypeIdBuf->length(),
- ':', '/');
- legacyTypeId = legacyTypeIdBuf->data();
+ std::replace(
+ legacyTypeIdBuf->data(),
+ legacyTypeIdBuf->data() + legacyTypeIdBuf->length(),
+ ':', '/');
+ legacyTypeId = legacyTypeIdBuf->data();
}
}
- UnicodeString uBcpTypeId = ures_getUnicodeString(typeMapEntry.getAlias(), &sts);
+ UnicodeString uBcpTypeId = ures_getUnicodeString(typeMapEntry.getAlias(), &sts);
if (U_FAILURE(sts)) {
break;
}
// empty value indicates that BCP type is same with the legacy type.
const char* bcpTypeId = legacyTypeId;
- if (!uBcpTypeId.isEmpty()) {
- icu::CharString* bcpTypeIdBuf = gKeyTypeStringPool->create();
+ if (!uBcpTypeId.isEmpty()) {
+ icu::CharString* bcpTypeIdBuf = gKeyTypeStringPool->create();
if (bcpTypeIdBuf == NULL) {
sts = U_MEMORY_ALLOCATION_ERROR;
break;
}
- bcpTypeIdBuf->appendInvariantChars(uBcpTypeId, sts);
+ bcpTypeIdBuf->appendInvariantChars(uBcpTypeId, sts);
if (U_FAILURE(sts)) {
break;
}
- bcpTypeId = bcpTypeIdBuf->data();
+ bcpTypeId = bcpTypeIdBuf->data();
}
// Note: legacy type value should never be
// equivalent to bcp type value of a different
// type under the same key. So we use a single
// map for lookup.
- LocExtType* t = gLocExtTypeEntries->create();
+ LocExtType* t = gLocExtTypeEntries->create();
if (t == NULL) {
sts = U_MEMORY_ALLOCATION_ERROR;
break;
@@ -277,8 +277,8 @@ initFromResourceBundle(UErrorCode& sts) {
if (isTZ) {
// replace colon with slash if necessary
if (uprv_strchr(from, ':') != NULL) {
- icu::CharString* fromBuf =
- gKeyTypeStringPool->create(from, sts);
+ icu::CharString* fromBuf =
+ gKeyTypeStringPool->create(from, sts);
if (fromBuf == NULL) {
sts = U_MEMORY_ALLOCATION_ERROR;
break;
@@ -286,11 +286,11 @@ initFromResourceBundle(UErrorCode& sts) {
if (U_FAILURE(sts)) {
break;
}
- std::replace(
- fromBuf->data(),
- fromBuf->data() + fromBuf->length(),
- ':', '/');
- from = fromBuf->data();
+ std::replace(
+ fromBuf->data(),
+ fromBuf->data() + fromBuf->length(),
+ ':', '/');
+ from = fromBuf->data();
}
}
uhash_put(typeDataMap, (void*)from, t, &sts);
@@ -328,7 +328,7 @@ initFromResourceBundle(UErrorCode& sts) {
break;
}
- LocExtKeyData* keyData = gLocExtKeyDataEntries->create();
+ LocExtKeyData* keyData = gLocExtKeyDataEntries->create();
if (keyData == NULL) {
sts = U_MEMORY_ALLOCATION_ERROR;
break;
@@ -336,7 +336,7 @@ initFromResourceBundle(UErrorCode& sts) {
keyData->bcpId = bcpKeyId;
keyData->legacyId = legacyKeyId;
keyData->specialTypes = specialTypes;
- keyData->typeMap.adoptInstead(typeDataMap);
+ keyData->typeMap.adoptInstead(typeDataMap);
uhash_put(gLocExtKeyMap, (void*)legacyKeyId, keyData, &sts);
if (legacyKeyId != bcpKeyId) {
@@ -461,7 +461,7 @@ ulocimp_toBcpType(const char* key, const char* type, UBool* isKnownKey, UBool* i
if (isKnownKey != NULL) {
*isKnownKey = TRUE;
}
- LocExtType* t = (LocExtType*)uhash_get(keyData->typeMap.getAlias(), type);
+ LocExtType* t = (LocExtType*)uhash_get(keyData->typeMap.getAlias(), type);
if (t != NULL) {
return t->bcpId;
}
@@ -506,7 +506,7 @@ ulocimp_toLegacyType(const char* key, const char* type, UBool* isKnownKey, UBool
if (isKnownKey != NULL) {
*isKnownKey = TRUE;
}
- LocExtType* t = (LocExtType*)uhash_get(keyData->typeMap.getAlias(), type);
+ LocExtType* t = (LocExtType*)uhash_get(keyData->typeMap.getAlias(), type);
if (t != NULL) {
return t->legacyId;
}
diff --git a/contrib/libs/icu/common/uloc_tag.cpp b/contrib/libs/icu/common/uloc_tag.cpp
index 84bdc22d66..ad5dd6430c 100644
--- a/contrib/libs/icu/common/uloc_tag.cpp
+++ b/contrib/libs/icu/common/uloc_tag.cpp
@@ -1,2877 +1,2877 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-**********************************************************************
-* Copyright (C) 2009-2015, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
-*/
-
-#include "unicode/bytestream.h"
-#include "unicode/utypes.h"
-#include "unicode/ures.h"
-#include "unicode/localpointer.h"
-#include "unicode/putil.h"
-#include "unicode/uenum.h"
-#include "unicode/uloc.h"
-#include "ustr_imp.h"
-#include "charstr.h"
-#include "cmemory.h"
-#include "cstring.h"
-#include "putilimp.h"
-#include "uinvchar.h"
-#include "ulocimp.h"
-#include "uassert.h"
-
-
-/* struct holding a single variant */
-typedef struct VariantListEntry {
- const char *variant;
- struct VariantListEntry *next;
-} VariantListEntry;
-
-/* struct holding a single attribute value */
-struct AttributeListEntry : public icu::UMemory {
- const char *attribute;
- struct AttributeListEntry *next;
-};
-
-/* struct holding a single extension */
-struct ExtensionListEntry : public icu::UMemory {
- const char *key;
- const char *value;
- struct ExtensionListEntry *next;
-};
-
-#define MAXEXTLANG 3
-typedef struct ULanguageTag {
- char *buf; /* holding parsed subtags */
- const char *language;
- const char *extlang[MAXEXTLANG];
- const char *script;
- const char *region;
- VariantListEntry *variants;
- ExtensionListEntry *extensions;
- const char *privateuse;
- const char *grandfathered;
-} ULanguageTag;
-
-#define MINLEN 2
-#define SEP '-'
-#define PRIVATEUSE 'x'
-#define LDMLEXT 'u'
-
-#define LOCALE_SEP '_'
-#define LOCALE_EXT_SEP '@'
-#define LOCALE_KEYWORD_SEP ';'
-#define LOCALE_KEY_TYPE_SEP '='
-
-#define ISALPHA(c) uprv_isASCIILetter(c)
-#define ISNUMERIC(c) ((c)>='0' && (c)<='9')
-
-static const char EMPTY[] = "";
-static const char LANG_UND[] = "und";
-static const char PRIVATEUSE_KEY[] = "x";
-static const char _POSIX[] = "_POSIX";
-static const char POSIX_KEY[] = "va";
-static const char POSIX_VALUE[] = "posix";
-static const char LOCALE_ATTRIBUTE_KEY[] = "attribute";
-static const char PRIVUSE_VARIANT_PREFIX[] = "lvariant";
-static const char LOCALE_TYPE_YES[] = "yes";
-
-#define LANG_UND_LEN 3
-
-/*
- 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.
-
- curl https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry |\
- egrep -A 7 'Type: grandfathered' | \
- egrep 'Tag|Prefe' | grep -B1 'Preferred' | grep -v '^--' | \
- awk -n '/Tag/ {printf(" \"%s\", ", $2);} /Preferred/ {printf("\"%s\",\n", $2);}' |\
- tr 'A-Z' 'a-z'
-
-
- The 2nd part is made of five ICU-specific entries. They're kept for
- the backward compatibility for now, even though there are no preferred
- values. They may have to be removed for the strict BCP 47 compliance.
-
-*/
-static const char* const GRANDFATHERED[] = {
-/* grandfathered preferred */
- "art-lojban", "jbo",
- "en-gb-oed", "en-gb-oxendict",
- "i-ami", "ami",
- "i-bnn", "bnn",
- "i-hak", "hak",
- "i-klingon", "tlh",
- "i-lux", "lb",
- "i-navajo", "nv",
- "i-pwn", "pwn",
- "i-tao", "tao",
- "i-tay", "tay",
- "i-tsu", "tsu",
- "no-bok", "nb",
- "no-nyn", "nn",
- "sgn-be-fr", "sfb",
- "sgn-be-nl", "vgt",
- "sgn-ch-de", "sgg",
- "zh-guoyu", "cmn",
- "zh-hakka", "hak",
- "zh-min-nan", "nan",
- "zh-xiang", "hsn",
-
- // Grandfathered 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",
- "i-default", "en-x-i-default",
- "i-enochian", "und-x-i-enochian",
- "i-mingo", "see-x-i-mingo",
- "zh-min", "nan-x-zh-min",
-};
-
-/*
- Updated on 2018-09-12 from
- https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry .
-
- The table lists redundant tags with preferred value in the IANA languate tag registry.
- It's generated with the following command:
-
- curl https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry |\
- grep 'Type: redundant' -A 5 | egrep '^(Tag:|Prefer)' | grep -B1 'Preferred' | \
- awk -n '/Tag/ {printf(" \"%s\", ", $2);} /Preferred/ {printf("\"%s\",\n", $2);}' | \
- tr 'A-Z' 'a-z'
-
- In addition, ja-latn-hepburn-heploc is mapped to ja-latn-alalc97 because
- a variant tag 'hepburn-heploc' has the preferred subtag, 'alaic97'.
-*/
-
-static const char* const REDUNDANT[] = {
-// redundant preferred
- "sgn-br", "bzs",
- "sgn-co", "csn",
- "sgn-de", "gsg",
- "sgn-dk", "dsl",
- "sgn-es", "ssp",
- "sgn-fr", "fsl",
- "sgn-gb", "bfi",
- "sgn-gr", "gss",
- "sgn-ie", "isg",
- "sgn-it", "ise",
- "sgn-jp", "jsl",
- "sgn-mx", "mfs",
- "sgn-ni", "ncs",
- "sgn-nl", "dse",
- "sgn-no", "nsl",
- "sgn-pt", "psr",
- "sgn-se", "swl",
- "sgn-us", "ase",
- "sgn-za", "sfs",
- "zh-cmn", "cmn",
- "zh-cmn-hans", "cmn-hans",
- "zh-cmn-hant", "cmn-hant",
- "zh-gan", "gan",
- "zh-wuu", "wuu",
- "zh-yue", "yue",
-
- // variant tag with preferred value
- "ja-latn-hepburn-heploc", "ja-latn-alalc97",
-};
-
-/*
- Updated on 2018-09-12 from
- https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry .
-
- grep 'Type: language' -A 7 language-subtag-registry | egrep 'Subtag|Prefe' | \
- grep -B1 'Preferred' | grep -v '^--' | \
- awk -n '/Subtag/ {printf(" \"%s\", ", $2);} /Preferred/ {printf("\"%s\",\n", $2);}'
-
- Make sure that 2-letter language subtags come before 3-letter subtags.
-*/
-static const char DEPRECATEDLANGS[][4] = {
-/* deprecated new */
- "in", "id",
- "iw", "he",
- "ji", "yi",
- "jw", "jv",
- "mo", "ro",
- "aam", "aas",
- "adp", "dz",
- "aue", "ktz",
- "ayx", "nun",
- "bgm", "bcg",
- "bjd", "drl",
- "ccq", "rki",
- "cjr", "mom",
- "cka", "cmr",
- "cmk", "xch",
- "coy", "pij",
- "cqu", "quh",
- "drh", "khk",
- "drw", "prs",
- "gav", "dev",
- "gfx", "vaj",
- "ggn", "gvr",
- "gti", "nyc",
- "guv", "duz",
- "hrr", "jal",
- "ibi", "opa",
- "ilw", "gal",
- "jeg", "oyb",
- "kgc", "tdf",
- "kgh", "kml",
- "koj", "kwv",
- "krm", "bmf",
- "ktr", "dtp",
- "kvs", "gdj",
- "kwq", "yam",
- "kxe", "tvd",
- "kzj", "dtp",
- "kzt", "dtp",
- "lii", "raq",
- "lmm", "rmx",
- "meg", "cir",
- "mst", "mry",
- "mwj", "vaj",
- "myt", "mry",
- "nad", "xny",
- "ncp", "kdz",
- "nnx", "ngv",
- "nts", "pij",
- "oun", "vaj",
- "pcr", "adx",
- "pmc", "huw",
- "pmu", "phr",
- "ppa", "bfy",
- "ppr", "lcq",
- "pry", "prt",
- "puz", "pub",
- "sca", "hle",
- "skk", "oyb",
- "tdu", "dtp",
- "thc", "tpo",
- "thx", "oyb",
- "tie", "ras",
- "tkk", "twm",
- "tlw", "weo",
- "tmp", "tyj",
- "tne", "kak",
- "tnf", "prs",
- "tsf", "taj",
- "uok", "ema",
- "xba", "cax",
- "xia", "acn",
- "xkh", "waw",
- "xsj", "suj",
- "ybd", "rki",
- "yma", "lrr",
- "ymt", "mtm",
- "yos", "zom",
- "yuu", "yug",
-};
-
-/*
- Updated on 2018-04-24 from
-
- curl https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry | \
- grep 'Type: region' -A 7 | egrep 'Subtag|Prefe' | \
- grep -B1 'Preferred' | \
- awk -n '/Subtag/ {printf(" \"%s\", ", $2);} /Preferred/ {printf("\"%s\",\n", $2);}'
-*/
-static const char DEPRECATEDREGIONS[][3] = {
-/* deprecated new */
- "BU", "MM",
- "DD", "DE",
- "FX", "FR",
- "TP", "TL",
- "YD", "YE",
- "ZR", "CD",
-};
-
-/*
-* -------------------------------------------------
-*
-* These ultag_ functions may be exposed as APIs later
-*
-* -------------------------------------------------
-*/
-
-static ULanguageTag*
-ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* status);
-
-static void
-ultag_close(ULanguageTag* langtag);
-
-static const char*
-ultag_getLanguage(const ULanguageTag* langtag);
-
-#if 0
-static const char*
-ultag_getJDKLanguage(const ULanguageTag* langtag);
-#endif
-
-static const char*
-ultag_getExtlang(const ULanguageTag* langtag, int32_t idx);
-
-static int32_t
-ultag_getExtlangSize(const ULanguageTag* langtag);
-
-static const char*
-ultag_getScript(const ULanguageTag* langtag);
-
-static const char*
-ultag_getRegion(const ULanguageTag* langtag);
-
-static const char*
-ultag_getVariant(const ULanguageTag* langtag, int32_t idx);
-
-static int32_t
-ultag_getVariantsSize(const ULanguageTag* langtag);
-
-static const char*
-ultag_getExtensionKey(const ULanguageTag* langtag, int32_t idx);
-
-static const char*
-ultag_getExtensionValue(const ULanguageTag* langtag, int32_t idx);
-
-static int32_t
-ultag_getExtensionsSize(const ULanguageTag* langtag);
-
-static const char*
-ultag_getPrivateUse(const ULanguageTag* langtag);
-
-#if 0
-static const char*
-ultag_getGrandfathered(const ULanguageTag* langtag);
-#endif
-
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalULanguageTagPointer
- * "Smart pointer" class, closes a ULanguageTag via ultag_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @internal
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalULanguageTagPointer, ULanguageTag, ultag_close);
-
-U_NAMESPACE_END
-
-/*
-* -------------------------------------------------
-*
-* Language subtag syntax validation functions
-*
-* -------------------------------------------------
-*/
-
-static UBool
-_isAlphaString(const char* s, int32_t len) {
- int32_t i;
- for (i = 0; i < len; i++) {
- if (!ISALPHA(*(s + i))) {
- return FALSE;
- }
- }
- return TRUE;
-}
-
-static UBool
-_isNumericString(const char* s, int32_t len) {
- int32_t i;
- for (i = 0; i < len; i++) {
- if (!ISNUMERIC(*(s + i))) {
- return FALSE;
- }
- }
- return TRUE;
-}
-
-static UBool
-_isAlphaNumericString(const char* s, int32_t len) {
- int32_t i;
- for (i = 0; i < len; i++) {
- if (!ISALPHA(*(s + i)) && !ISNUMERIC(*(s + i))) {
- return FALSE;
- }
- }
- return TRUE;
-}
-
-static UBool
-_isAlphaNumericStringLimitedLength(const char* s, int32_t len, int32_t min, int32_t max) {
- if (len < 0) {
- len = (int32_t)uprv_strlen(s);
- }
- if (len >= min && len <= max && _isAlphaNumericString(s, len)) {
- return TRUE;
- }
- return FALSE;
-}
-
-U_CFUNC UBool
-ultag_isLanguageSubtag(const char* s, int32_t len) {
- /*
- * unicode_language_subtag = alpha{2,3} | alpha{5,8};
- * NOTE: Per ICUTC 2019/01/23- accepting alpha 4
- * See ICU-20372
- */
- if (len < 0) {
- len = (int32_t)uprv_strlen(s);
- }
- if (len >= 2 && len <= 8 && _isAlphaString(s, len)) {
- return TRUE;
- }
- return FALSE;
-}
-
-static UBool
-_isExtlangSubtag(const char* s, int32_t len) {
- /*
- * extlang = 3ALPHA ; selected ISO 639 codes
- * *2("-" 3ALPHA) ; permanently reserved
- */
- if (len < 0) {
- len = (int32_t)uprv_strlen(s);
- }
- if (len == 3 && _isAlphaString(s, len)) {
- return TRUE;
- }
- return FALSE;
-}
-
-U_CFUNC UBool
-ultag_isScriptSubtag(const char* s, int32_t len) {
- /*
- * script = 4ALPHA ; ISO 15924 code
- */
- if (len < 0) {
- len = (int32_t)uprv_strlen(s);
- }
- if (len == 4 && _isAlphaString(s, len)) {
- return TRUE;
- }
- return FALSE;
-}
-
-U_CFUNC UBool
-ultag_isRegionSubtag(const char* s, int32_t len) {
- /*
- * region = 2ALPHA ; ISO 3166-1 code
- * / 3DIGIT ; UN M.49 code
- */
- if (len < 0) {
- len = (int32_t)uprv_strlen(s);
- }
- if (len == 2 && _isAlphaString(s, len)) {
- return TRUE;
- }
- if (len == 3 && _isNumericString(s, len)) {
- return TRUE;
- }
- return FALSE;
-}
-
-static UBool
-_isVariantSubtag(const char* s, int32_t len) {
- /*
- * variant = 5*8alphanum ; registered variants
- * / (DIGIT 3alphanum)
- */
- if (len < 0) {
- len = (int32_t)uprv_strlen(s);
- }
- if (_isAlphaNumericStringLimitedLength(s, len, 5, 8)) {
- return TRUE;
- }
- if (len == 4 && ISNUMERIC(*s) && _isAlphaNumericString(s + 1, 3)) {
- return TRUE;
- }
- return FALSE;
-}
-
-static UBool
-_isSepListOf(UBool (*test)(const char*, int32_t), const char* s, int32_t len) {
- const char *p = s;
- const char *pSubtag = NULL;
-
- if (len < 0) {
- len = (int32_t)uprv_strlen(s);
- }
-
- while ((p - s) < len) {
- if (*p == SEP) {
- if (pSubtag == NULL) {
- return FALSE;
- }
- if (!test(pSubtag, (int32_t)(p - pSubtag))) {
- return FALSE;
- }
- pSubtag = NULL;
- } else if (pSubtag == NULL) {
- pSubtag = p;
- }
- p++;
- }
- if (pSubtag == NULL) {
- return FALSE;
- }
- return test(pSubtag, (int32_t)(p - pSubtag));
-}
-
-U_CFUNC UBool
-ultag_isVariantSubtags(const char* s, int32_t len) {
- return _isSepListOf(&_isVariantSubtag, s, len);
-}
-
-// This is for the ICU-specific "lvariant" handling.
-static UBool
-_isPrivateuseVariantSubtag(const char* s, int32_t len) {
- /*
- * variant = 1*8alphanum ; registered variants
- * / (DIGIT 3alphanum)
- */
- return _isAlphaNumericStringLimitedLength(s, len , 1, 8);
-}
-
-static UBool
-_isExtensionSingleton(const char* s, int32_t len) {
- /*
- * extension = singleton 1*("-" (2*8alphanum))
- *
- * singleton = DIGIT ; 0 - 9
- * / %x41-57 ; A - W
- * / %x59-5A ; Y - Z
- * / %x61-77 ; a - w
- * / %x79-7A ; y - z
- */
- if (len < 0) {
- len = (int32_t)uprv_strlen(s);
- }
- if (len == 1 && (ISALPHA(*s) || ISNUMERIC(*s)) && (uprv_tolower(*s) != PRIVATEUSE)) {
- return TRUE;
- }
- return FALSE;
-}
-
-static UBool
-_isExtensionSubtag(const char* s, int32_t len) {
- /*
- * extension = singleton 1*("-" (2*8alphanum))
- */
- return _isAlphaNumericStringLimitedLength(s, len, 2, 8);
-}
-
-U_CFUNC UBool
-ultag_isExtensionSubtags(const char* s, int32_t len) {
- return _isSepListOf(&_isExtensionSubtag, s, len);
-}
-
-static UBool
-_isPrivateuseValueSubtag(const char* s, int32_t len) {
- /*
- * privateuse = "x" 1*("-" (1*8alphanum))
- */
- return _isAlphaNumericStringLimitedLength(s, len, 1, 8);
-}
-
-U_CFUNC UBool
-ultag_isPrivateuseValueSubtags(const char* s, int32_t len) {
- return _isSepListOf(&_isPrivateuseValueSubtag, s, len);
-}
-
-U_CFUNC UBool
-ultag_isUnicodeLocaleAttribute(const char* s, int32_t len) {
- /*
- * attribute = alphanum{3,8} ;
- */
- return _isAlphaNumericStringLimitedLength(s, len , 3, 8);
-}
-
-U_CFUNC UBool
-ultag_isUnicodeLocaleAttributes(const char* s, int32_t len) {
- return _isSepListOf(&ultag_isUnicodeLocaleAttribute, s, len);
-}
-
-U_CFUNC UBool
-ultag_isUnicodeLocaleKey(const char* s, int32_t len) {
- /*
- * key = alphanum alpha ;
- */
- if (len < 0) {
- len = (int32_t)uprv_strlen(s);
- }
- if (len == 2 && (ISALPHA(*s) || ISNUMERIC(*s)) && ISALPHA(s[1])) {
- return TRUE;
- }
- return FALSE;
-}
-
-U_CFUNC UBool
-_isUnicodeLocaleTypeSubtag(const char*s, int32_t len) {
- /*
- * alphanum{3,8}
- */
- return _isAlphaNumericStringLimitedLength(s, len , 3, 8);
-}
-
-U_CFUNC UBool
-ultag_isUnicodeLocaleType(const char*s, int32_t len) {
- /*
- * type = alphanum{3,8} (sep alphanum{3,8})* ;
- */
- return _isSepListOf(&_isUnicodeLocaleTypeSubtag, s, len);
-}
-
-static UBool
-_isTKey(const char* s, int32_t len)
-{
- /*
- * tkey = alpha digit ;
- */
- if (len < 0) {
- len = (int32_t)uprv_strlen(s);
- }
- if (len == 2 && ISALPHA(*s) && ISNUMERIC(*(s + 1))) {
- return TRUE;
- }
- return FALSE;
-}
-
-static UBool
-_isTValue(const char* s, int32_t len)
-{
- /*
- * tvalue = (sep alphanum{3,8})+ ;
- */
- return _isAlphaNumericStringLimitedLength(s, len , 3, 8);
-}
-
-static UBool
-_isTransformedExtensionSubtag(int32_t& state, const char* s, int32_t len)
-{
- const int32_t kStart = 0; // Start, wait for unicode_language_subtag, tkey or end
- const int32_t kGotLanguage = 1; // Got unicode_language_subtag, wait for unicode_script_subtag,
- // unicode_region_subtag, unicode_variant_subtag, tkey or end
- const int32_t kGotScript = 2; // Got unicode_script_subtag, wait for unicode_region_subtag,
- // unicode_variant_subtag, tkey, or end
- const int32_t kGotRegion = 3; // Got unicode_region_subtag, wait for unicode_variant_subtag,
- // tkey, or end.
- const int32_t kGotVariant = 4; // Got unicode_variant_subtag, wait for unicode_variant_subtag
- // tkey or end.
- const int32_t kGotTKey = -1; // Got tkey, wait for tvalue. ERROR if stop here.
- const int32_t kGotTValue = 6; // Got tvalue, wait for tkey, tvalue or end
-
- switch (state) {
- case kStart:
- if (ultag_isLanguageSubtag(s, len)) {
- state = kGotLanguage;
- return TRUE;
- }
- if (_isTKey(s, len)) {
- state = kGotTKey;
- return TRUE;
- }
- return FALSE;
- case kGotLanguage:
- if (ultag_isScriptSubtag(s, len)) {
- state = kGotScript;
- return TRUE;
- }
- U_FALLTHROUGH;
- case kGotScript:
- if (ultag_isRegionSubtag(s, len)) {
- state = kGotRegion;
- return TRUE;
- }
- U_FALLTHROUGH;
- case kGotRegion:
- U_FALLTHROUGH;
- case kGotVariant:
- if (_isVariantSubtag(s, len)) {
- state = kGotVariant;
- return TRUE;
- }
- if (_isTKey(s, len)) {
- state = kGotTKey;
- return TRUE;
- }
- return FALSE;
- case kGotTKey:
- if (_isTValue(s, len)) {
- state = kGotTValue;
- return TRUE;
- }
- return FALSE;
- case kGotTValue:
- if (_isTKey(s, len)) {
- state = kGotTKey;
- return TRUE;
- }
- if (_isTValue(s, len)) {
- return TRUE;
- }
- return FALSE;
- }
- return FALSE;
-}
-
-static UBool
-_isUnicodeExtensionSubtag(int32_t& state, const char* s, int32_t len)
-{
- const int32_t kStart = 0; // Start, wait for a key or attribute or end
- const int32_t kGotKey = 1; // Got a key, wait for type or key or end
- const int32_t kGotType = 2; // Got a type, wait for key or end
-
- switch (state) {
- case kStart:
- if (ultag_isUnicodeLocaleKey(s, len)) {
- state = kGotKey;
- return TRUE;
- }
- if (ultag_isUnicodeLocaleAttribute(s, len)) {
- return TRUE;
- }
- return FALSE;
- case kGotKey:
- if (ultag_isUnicodeLocaleKey(s, len)) {
- return TRUE;
- }
- if (_isUnicodeLocaleTypeSubtag(s, len)) {
- state = kGotType;
- return TRUE;
- }
- return FALSE;
- case kGotType:
- if (ultag_isUnicodeLocaleKey(s, len)) {
- state = kGotKey;
- return TRUE;
- }
- if (_isUnicodeLocaleTypeSubtag(s, len)) {
- return TRUE;
- }
- return FALSE;
- }
- return FALSE;
-}
-
-static UBool
-_isStatefulSepListOf(UBool (*test)(int32_t&, const char*, int32_t), const char* s, int32_t len)
-{
- int32_t state = 0;
- const char* p;
- const char* start = s;
- int32_t subtagLen = 0;
-
- if (len < 0) {
- len = (int32_t)uprv_strlen(s);
- }
-
- for (p = s; len > 0; p++, len--) {
- if (*p == SEP) {
- if (!test(state, start, subtagLen)) {
- return FALSE;
- }
- subtagLen = 0;
- start = p + 1;
- } else {
- subtagLen++;
- }
- }
-
- if (test(state, start, subtagLen) && state >= 0) {
- return TRUE;
- }
- return FALSE;
-}
-
-U_CFUNC UBool
-ultag_isTransformedExtensionSubtags(const char* s, int32_t len)
-{
- return _isStatefulSepListOf(&_isTransformedExtensionSubtag, s, len);
-}
-
-U_CFUNC UBool
-ultag_isUnicodeExtensionSubtags(const char* s, int32_t len) {
- return _isStatefulSepListOf(&_isUnicodeExtensionSubtag, s, len);
-}
-
-
-/*
-* -------------------------------------------------
-*
-* Helper functions
-*
-* -------------------------------------------------
-*/
-
-static UBool
-_addVariantToList(VariantListEntry **first, VariantListEntry *var) {
- UBool bAdded = TRUE;
-
- if (*first == NULL) {
- var->next = NULL;
- *first = var;
- } else {
- VariantListEntry *prev, *cur;
- int32_t cmp;
-
- /* variants order should be preserved */
- prev = NULL;
- cur = *first;
- while (TRUE) {
- if (cur == NULL) {
- prev->next = var;
- var->next = NULL;
- break;
- }
-
- /* Checking for duplicate variant */
- cmp = uprv_compareInvCharsAsAscii(var->variant, cur->variant);
- if (cmp == 0) {
- /* duplicated variant */
- bAdded = FALSE;
- break;
- }
- prev = cur;
- cur = cur->next;
- }
- }
-
- return bAdded;
-}
-
-static UBool
-_addAttributeToList(AttributeListEntry **first, AttributeListEntry *attr) {
- UBool bAdded = TRUE;
-
- if (*first == NULL) {
- attr->next = NULL;
- *first = attr;
- } else {
- AttributeListEntry *prev, *cur;
- int32_t cmp;
-
- /* reorder variants in alphabetical order */
- prev = NULL;
- cur = *first;
- while (TRUE) {
- if (cur == NULL) {
- prev->next = attr;
- attr->next = NULL;
- break;
- }
- cmp = uprv_compareInvCharsAsAscii(attr->attribute, cur->attribute);
- if (cmp < 0) {
- if (prev == NULL) {
- *first = attr;
- } else {
- prev->next = attr;
- }
- attr->next = cur;
- break;
- }
- if (cmp == 0) {
- /* duplicated variant */
- bAdded = FALSE;
- break;
- }
- prev = cur;
- cur = cur->next;
- }
- }
-
- return bAdded;
-}
-
-
-static UBool
-_addExtensionToList(ExtensionListEntry **first, ExtensionListEntry *ext, UBool localeToBCP) {
- UBool bAdded = TRUE;
-
- if (*first == NULL) {
- ext->next = NULL;
- *first = ext;
- } else {
- ExtensionListEntry *prev, *cur;
- int32_t cmp;
-
- /* reorder variants in alphabetical order */
- prev = NULL;
- cur = *first;
- while (TRUE) {
- if (cur == NULL) {
- prev->next = ext;
- ext->next = NULL;
- break;
- }
- if (localeToBCP) {
- /* special handling for locale to bcp conversion */
- int32_t len, curlen;
-
- len = (int32_t)uprv_strlen(ext->key);
- curlen = (int32_t)uprv_strlen(cur->key);
-
- if (len == 1 && curlen == 1) {
- if (*(ext->key) == *(cur->key)) {
- cmp = 0;
- } else if (*(ext->key) == PRIVATEUSE) {
- cmp = 1;
- } else if (*(cur->key) == PRIVATEUSE) {
- cmp = -1;
- } else {
- cmp = *(ext->key) - *(cur->key);
- }
- } else if (len == 1) {
- cmp = *(ext->key) - LDMLEXT;
- } else if (curlen == 1) {
- cmp = LDMLEXT - *(cur->key);
- } else {
- cmp = uprv_compareInvCharsAsAscii(ext->key, cur->key);
- /* Both are u extension keys - we need special handling for 'attribute' */
- if (cmp != 0) {
- if (uprv_strcmp(cur->key, LOCALE_ATTRIBUTE_KEY) == 0) {
- cmp = 1;
- } else if (uprv_strcmp(ext->key, LOCALE_ATTRIBUTE_KEY) == 0) {
- cmp = -1;
- }
- }
- }
- } else {
- cmp = uprv_compareInvCharsAsAscii(ext->key, cur->key);
- }
- if (cmp < 0) {
- if (prev == NULL) {
- *first = ext;
- } else {
- prev->next = ext;
- }
- ext->next = cur;
- break;
- }
- if (cmp == 0) {
- /* duplicated extension key */
- bAdded = FALSE;
- break;
- }
- prev = cur;
- cur = cur->next;
- }
- }
-
- return bAdded;
-}
-
-static void
-_initializeULanguageTag(ULanguageTag* langtag) {
- int32_t i;
-
- langtag->buf = NULL;
-
- langtag->language = EMPTY;
- for (i = 0; i < MAXEXTLANG; i++) {
- langtag->extlang[i] = NULL;
- }
-
- langtag->script = EMPTY;
- langtag->region = EMPTY;
-
- langtag->variants = NULL;
- langtag->extensions = NULL;
-
- langtag->grandfathered = EMPTY;
- langtag->privateuse = EMPTY;
-}
-
-static void
-_appendLanguageToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UErrorCode* status) {
- char buf[ULOC_LANG_CAPACITY];
- UErrorCode tmpStatus = U_ZERO_ERROR;
- int32_t len, i;
-
- if (U_FAILURE(*status)) {
- return;
- }
-
- len = uloc_getLanguage(localeID, buf, sizeof(buf), &tmpStatus);
- if (U_FAILURE(tmpStatus) || tmpStatus == U_STRING_NOT_TERMINATED_WARNING) {
- if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- len = 0;
- }
-
- /* Note: returned language code is in lower case letters */
-
- if (len == 0) {
- sink.Append(LANG_UND, LANG_UND_LEN);
- } else if (!ultag_isLanguageSubtag(buf, len)) {
- /* invalid language code */
- if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- sink.Append(LANG_UND, LANG_UND_LEN);
- } else {
- /* resolve deprecated */
- for (i = 0; i < UPRV_LENGTHOF(DEPRECATEDLANGS); i += 2) {
- // 2-letter deprecated subtags are listede before 3-letter
- // ones in DEPRECATEDLANGS[]. Get out of loop on coming
- // across the 1st 3-letter subtag, if the input is a 2-letter code.
- // to avoid continuing to try when there's no match.
- if (uprv_strlen(buf) < uprv_strlen(DEPRECATEDLANGS[i])) break;
- if (uprv_compareInvCharsAsAscii(buf, DEPRECATEDLANGS[i]) == 0) {
- uprv_strcpy(buf, DEPRECATEDLANGS[i + 1]);
- len = (int32_t)uprv_strlen(buf);
- break;
- }
- }
- sink.Append(buf, len);
- }
-}
-
-static void
-_appendScriptToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UErrorCode* status) {
- char buf[ULOC_SCRIPT_CAPACITY];
- UErrorCode tmpStatus = U_ZERO_ERROR;
- int32_t len;
-
- if (U_FAILURE(*status)) {
- return;
- }
-
- len = uloc_getScript(localeID, buf, sizeof(buf), &tmpStatus);
- if (U_FAILURE(tmpStatus) || tmpStatus == U_STRING_NOT_TERMINATED_WARNING) {
- if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- }
- return;
- }
-
- if (len > 0) {
- if (!ultag_isScriptSubtag(buf, len)) {
- /* invalid script code */
- if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- }
- return;
- } else {
- sink.Append("-", 1);
- sink.Append(buf, len);
- }
- }
-}
-
-static void
-_appendRegionToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UErrorCode* status) {
- char buf[ULOC_COUNTRY_CAPACITY];
- UErrorCode tmpStatus = U_ZERO_ERROR;
- int32_t len;
-
- if (U_FAILURE(*status)) {
- return;
- }
-
- len = uloc_getCountry(localeID, buf, sizeof(buf), &tmpStatus);
- if (U_FAILURE(tmpStatus) || tmpStatus == U_STRING_NOT_TERMINATED_WARNING) {
- if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- }
- return;
- }
-
- if (len > 0) {
- if (!ultag_isRegionSubtag(buf, len)) {
- /* invalid region code */
- if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- }
- return;
- } else {
- sink.Append("-", 1);
- /* resolve deprecated */
- for (int i = 0; i < UPRV_LENGTHOF(DEPRECATEDREGIONS); i += 2) {
- if (uprv_compareInvCharsAsAscii(buf, DEPRECATEDREGIONS[i]) == 0) {
- uprv_strcpy(buf, DEPRECATEDREGIONS[i + 1]);
- len = (int32_t)uprv_strlen(buf);
- break;
- }
- }
- sink.Append(buf, len);
- }
- }
-}
-
-static void _sortVariants(VariantListEntry* first) {
- for (VariantListEntry* var1 = first; var1 != NULL; var1 = var1->next) {
- for (VariantListEntry* var2 = var1->next; var2 != NULL; var2 = var2->next) {
- // Swap var1->variant and var2->variant.
- if (uprv_compareInvCharsAsAscii(var1->variant, var2->variant) > 0) {
- const char* temp = var1->variant;
- var1->variant = var2->variant;
- var2->variant = temp;
- }
- }
- }
-}
-
-static void
-_appendVariantsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UBool *hadPosix, UErrorCode* status) {
- char buf[ULOC_FULLNAME_CAPACITY];
- UErrorCode tmpStatus = U_ZERO_ERROR;
- int32_t len, i;
-
- if (U_FAILURE(*status)) {
- return;
- }
-
- len = uloc_getVariant(localeID, buf, sizeof(buf), &tmpStatus);
- if (U_FAILURE(tmpStatus) || tmpStatus == U_STRING_NOT_TERMINATED_WARNING) {
- if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- }
- return;
- }
-
- if (len > 0) {
- char *p, *pVar;
- UBool bNext = TRUE;
- VariantListEntry *var;
- VariantListEntry *varFirst = NULL;
-
- pVar = NULL;
- p = buf;
- while (bNext) {
- if (*p == SEP || *p == LOCALE_SEP || *p == 0) {
- if (*p == 0) {
- bNext = FALSE;
- } else {
- *p = 0; /* terminate */
- }
- if (pVar == NULL) {
- if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- break;
- }
- /* ignore empty variant */
- } else {
- /* ICU uses upper case letters for variants, but
- the canonical format is lowercase in BCP47 */
- for (i = 0; *(pVar + i) != 0; i++) {
- *(pVar + i) = uprv_tolower(*(pVar + i));
- }
-
- /* validate */
- if (_isVariantSubtag(pVar, -1)) {
- if (uprv_strcmp(pVar,POSIX_VALUE) || len != (int32_t)uprv_strlen(POSIX_VALUE)) {
- /* emit the variant to the list */
- var = (VariantListEntry*)uprv_malloc(sizeof(VariantListEntry));
- if (var == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- break;
- }
- var->variant = pVar;
- if (!_addVariantToList(&varFirst, var)) {
- /* duplicated variant */
- uprv_free(var);
- if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- break;
- }
- }
- } else {
- /* Special handling for POSIX variant, need to remember that we had it and then */
- /* treat it like an extension later. */
- *hadPosix = TRUE;
- }
- } else if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- break;
- } else if (_isPrivateuseValueSubtag(pVar, -1)) {
- /* Handle private use subtags separately */
- break;
- }
- }
- /* reset variant starting position */
- pVar = NULL;
- } else if (pVar == NULL) {
- pVar = p;
- }
- p++;
- }
-
- if (U_SUCCESS(*status)) {
- if (varFirst != NULL) {
- int32_t varLen;
-
- /* per UTS35, we should sort the variants */
- _sortVariants(varFirst);
-
- /* write out validated/normalized variants to the target */
- var = varFirst;
- while (var != NULL) {
- sink.Append("-", 1);
- varLen = (int32_t)uprv_strlen(var->variant);
- sink.Append(var->variant, varLen);
- var = var->next;
- }
- }
- }
-
- /* clean up */
- var = varFirst;
- while (var != NULL) {
- VariantListEntry *tmpVar = var->next;
- uprv_free(var);
- var = tmpVar;
- }
-
- if (U_FAILURE(*status)) {
- return;
- }
- }
-}
-
-static void
-_appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UBool hadPosix, UErrorCode* status) {
- char attrBuf[ULOC_KEYWORD_AND_VALUES_CAPACITY] = { 0 };
- int32_t attrBufLength = 0;
-
- icu::MemoryPool<AttributeListEntry> attrPool;
- icu::MemoryPool<ExtensionListEntry> extPool;
- icu::MemoryPool<icu::CharString> strPool;
-
- icu::LocalUEnumerationPointer keywordEnum(uloc_openKeywords(localeID, status));
- if (U_FAILURE(*status) && !hadPosix) {
- return;
- }
- if (keywordEnum.isValid() || hadPosix) {
- /* reorder extensions */
- int32_t len;
- const char *key;
- ExtensionListEntry *firstExt = NULL;
- ExtensionListEntry *ext;
- AttributeListEntry *firstAttr = NULL;
- AttributeListEntry *attr;
- icu::MemoryPool<icu::CharString> extBufPool;
- const char *bcpKey=nullptr, *bcpValue=nullptr;
- UErrorCode tmpStatus = U_ZERO_ERROR;
- int32_t keylen;
- 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;
- }
-
- if (U_FAILURE(tmpStatus)) {
- if (tmpStatus == U_MEMORY_ALLOCATION_ERROR) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- break;
- }
- if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- break;
- }
- /* ignore this keyword */
- tmpStatus = U_ZERO_ERROR;
- 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);
-
- /* special keyword used for representing Unicode locale attributes */
- if (uprv_strcmp(key, LOCALE_ATTRIBUTE_KEY) == 0) {
- if (len > 0) {
- int32_t i = 0;
- while (TRUE) {
- attrBufLength = 0;
- for (; i < len; i++) {
- if (buf[i] != '-') {
- attrBuf[attrBufLength++] = buf[i];
- } else {
- i++;
- break;
- }
- }
- if (attrBufLength > 0) {
- attrBuf[attrBufLength] = 0;
-
- } else if (i >= len){
- break;
- }
-
- /* create AttributeListEntry */
- attr = attrPool.create();
- if (attr == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- break;
- }
- icu::CharString* attrValue =
- strPool.create(attrBuf, attrBufLength, *status);
- if (attrValue == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- break;
- }
- if (U_FAILURE(*status)) {
- break;
- }
- attr->attribute = attrValue->data();
-
- if (!_addAttributeToList(&firstAttr, attr)) {
- if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- break;
- }
- }
- }
- /* for a place holder ExtensionListEntry */
- bcpKey = LOCALE_ATTRIBUTE_KEY;
- bcpValue = NULL;
- }
- } else if (isBcpUExt) {
- bcpKey = uloc_toUnicodeLocaleKey(key);
- if (bcpKey == NULL) {
- if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- break;
- }
- continue;
- }
-
- /* we've checked buf is null-terminated above */
- bcpValue = uloc_toUnicodeLocaleType(key, buf.data());
- if (bcpValue == NULL) {
- if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- break;
- }
- continue;
- }
- if (bcpValue == buf.data()) {
- /*
- When uloc_toUnicodeLocaleType(key, buf) returns the
- input value as is, the value is well-formed, but has
- no known mapping. This implementation normalizes the
- value to lower case
- */
- icu::CharString* extBuf = extBufPool.create();
- 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;
- }
-
- bcpValue = extBuf->data();
- }
- } else {
- if (*key == PRIVATEUSE) {
- if (!ultag_isPrivateuseValueSubtags(buf.data(), len)) {
- if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- break;
- }
- continue;
- }
- } else {
- if (!_isExtensionSingleton(key, keylen) || !ultag_isExtensionSubtags(buf.data(), len)) {
- if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- break;
- }
- continue;
- }
- }
- bcpKey = key;
- icu::CharString* extBuf =
- extBufPool.create(buf.data(), len, tmpStatus);
- if (extBuf == nullptr) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- break;
- }
- if (U_FAILURE(tmpStatus)) {
- *status = tmpStatus;
- break;
- }
- bcpValue = extBuf->data();
- }
-
- /* create ExtensionListEntry */
- ext = extPool.create();
- if (ext == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- break;
- }
- ext->key = bcpKey;
- ext->value = bcpValue;
-
- if (!_addExtensionToList(&firstExt, ext, TRUE)) {
- if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- break;
- }
- }
- }
-
- /* Special handling for POSIX variant - add the keywords for POSIX */
- if (hadPosix) {
- /* create ExtensionListEntry for POSIX */
- ext = extPool.create();
- if (ext == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- ext->key = POSIX_KEY;
- ext->value = POSIX_VALUE;
-
- if (!_addExtensionToList(&firstExt, ext, TRUE)) {
- // Silently ignore errors.
- }
- }
-
- if (U_SUCCESS(*status) && (firstExt != NULL || firstAttr != NULL)) {
- UBool startLDMLExtension = FALSE;
- for (ext = firstExt; ext; ext = ext->next) {
- if (!startLDMLExtension && uprv_strlen(ext->key) > 1) {
- /* first LDML u singlton extension */
- sink.Append("-u", 2);
- startLDMLExtension = TRUE;
- }
-
- /* write out the sorted BCP47 attributes, extensions and private use */
- if (uprv_strcmp(ext->key, LOCALE_ATTRIBUTE_KEY) == 0) {
- /* write the value for the attributes */
- for (attr = firstAttr; attr; attr = attr->next) {
- sink.Append("-", 1);
- sink.Append(
- attr->attribute, static_cast<int32_t>(uprv_strlen(attr->attribute)));
- }
- } else {
- sink.Append("-", 1);
- sink.Append(ext->key, static_cast<int32_t>(uprv_strlen(ext->key)));
- if (uprv_strcmp(ext->value, "true") != 0 &&
- uprv_strcmp(ext->value, "yes") != 0) {
- sink.Append("-", 1);
- sink.Append(ext->value, static_cast<int32_t>(uprv_strlen(ext->value)));
- }
- }
- }
- }
- }
-}
-
-/**
- * Append keywords parsed from LDML extension value
- * e.g. "u-ca-gregory-co-trad" -> {calendar = gregorian} {collation = traditional}
- * Note: char* buf is used for storing keywords
- */
-static void
-_appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendTo, icu::MemoryPool<ExtensionListEntry>& extPool, icu::MemoryPool<icu::CharString>& kwdBuf, UBool *posixVariant, UErrorCode *status) {
- const char *pTag; /* beginning of current subtag */
- const char *pKwds; /* beginning of key-type pairs */
- UBool variantExists = *posixVariant;
-
- ExtensionListEntry *kwdFirst = NULL; /* first LDML keyword */
- ExtensionListEntry *kwd, *nextKwd;
-
- int32_t len;
-
- /* Reset the posixVariant value */
- *posixVariant = FALSE;
-
- pTag = ldmlext;
- pKwds = NULL;
-
- {
- AttributeListEntry *attrFirst = NULL; /* first attribute */
- AttributeListEntry *attr, *nextAttr;
-
- char attrBuf[ULOC_KEYWORD_AND_VALUES_CAPACITY];
- int32_t attrBufIdx = 0;
-
- icu::MemoryPool<AttributeListEntry> attrPool;
-
- /* Iterate through u extension attributes */
- while (*pTag) {
- /* locate next separator char */
- for (len = 0; *(pTag + len) && *(pTag + len) != SEP; len++);
-
- if (ultag_isUnicodeLocaleKey(pTag, len)) {
- pKwds = pTag;
- break;
- }
-
- /* add this attribute to the list */
- attr = attrPool.create();
- if (attr == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
-
- if (len < (int32_t)sizeof(attrBuf) - attrBufIdx) {
- uprv_memcpy(&attrBuf[attrBufIdx], pTag, len);
- attrBuf[attrBufIdx + len] = 0;
- attr->attribute = &attrBuf[attrBufIdx];
- attrBufIdx += (len + 1);
- } else {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- // duplicate attribute is ignored, causes no error.
- _addAttributeToList(&attrFirst, attr);
-
- /* next tag */
- pTag += len;
- if (*pTag) {
- /* next to the separator */
- pTag++;
- }
- }
-
- if (attrFirst) {
- /* emit attributes as an LDML keyword, e.g. attribute=attr1-attr2 */
-
- kwd = extPool.create();
- if (kwd == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
-
- icu::CharString* value = kwdBuf.create();
- if (value == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
-
- /* attribute subtags sorted in alphabetical order as type */
- attr = attrFirst;
- while (attr != NULL) {
- nextAttr = attr->next;
- if (attr != attrFirst) {
- value->append('-', *status);
- }
- value->append(attr->attribute, *status);
- attr = nextAttr;
- }
- if (U_FAILURE(*status)) {
- return;
- }
-
- kwd->key = LOCALE_ATTRIBUTE_KEY;
- kwd->value = value->data();
-
- if (!_addExtensionToList(&kwdFirst, kwd, FALSE)) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- }
- }
-
- if (pKwds) {
- const char *pBcpKey = NULL; /* u extenstion key subtag */
- const char *pBcpType = NULL; /* beginning of u extension type subtag(s) */
- int32_t bcpKeyLen = 0;
- int32_t bcpTypeLen = 0;
- UBool isDone = FALSE;
-
- pTag = pKwds;
- /* BCP47 representation of LDML key/type pairs */
- while (!isDone) {
- const char *pNextBcpKey = NULL;
- int32_t nextBcpKeyLen = 0;
- UBool emitKeyword = FALSE;
-
- if (*pTag) {
- /* locate next separator char */
- for (len = 0; *(pTag + len) && *(pTag + len) != SEP; len++);
-
- if (ultag_isUnicodeLocaleKey(pTag, len)) {
- if (pBcpKey) {
- emitKeyword = TRUE;
- pNextBcpKey = pTag;
- nextBcpKeyLen = len;
- } else {
- pBcpKey = pTag;
- bcpKeyLen = len;
- }
- } else {
- U_ASSERT(pBcpKey != NULL);
- /* within LDML type subtags */
- if (pBcpType) {
- bcpTypeLen += (len + 1);
- } else {
- pBcpType = pTag;
- bcpTypeLen = len;
- }
- }
-
- /* next tag */
- pTag += len;
- if (*pTag) {
- /* next to the separator */
- pTag++;
- }
- } else {
- /* processing last one */
- emitKeyword = TRUE;
- isDone = TRUE;
- }
-
- if (emitKeyword) {
- const char *pKey = NULL; /* LDML key */
- const char *pType = NULL; /* LDML type */
-
- char bcpKeyBuf[3]; /* BCP key length is always 2 for now */
-
- U_ASSERT(pBcpKey != NULL);
-
- if (bcpKeyLen >= (int32_t)sizeof(bcpKeyBuf)) {
- /* the BCP key is invalid */
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- U_ASSERT(bcpKeyLen <= 2);
-
- uprv_strncpy(bcpKeyBuf, pBcpKey, bcpKeyLen);
- bcpKeyBuf[bcpKeyLen] = 0;
-
- /* u extension key to LDML key */
- pKey = uloc_toLegacyKey(bcpKeyBuf);
- if (pKey == NULL) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- if (pKey == bcpKeyBuf) {
- /*
- The key returned by toLegacyKey points to the input buffer.
- We normalize the result key to lower case.
- */
- T_CString_toLowerCase(bcpKeyBuf);
- icu::CharString* key = kwdBuf.create(bcpKeyBuf, bcpKeyLen, *status);
- if (key == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- if (U_FAILURE(*status)) {
- return;
- }
- pKey = key->data();
- }
-
- if (pBcpType) {
- char bcpTypeBuf[128]; /* practically long enough even considering multiple subtag type */
- if (bcpTypeLen >= (int32_t)sizeof(bcpTypeBuf)) {
- /* the BCP type is too long */
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- uprv_strncpy(bcpTypeBuf, pBcpType, bcpTypeLen);
- bcpTypeBuf[bcpTypeLen] = 0;
-
- /* BCP type to locale type */
- pType = uloc_toLegacyType(pKey, bcpTypeBuf);
- if (pType == NULL) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- if (pType == bcpTypeBuf) {
- /*
- The type returned by toLegacyType points to the input buffer.
- We normalize the result type to lower case.
- */
- /* normalize to lower case */
- T_CString_toLowerCase(bcpTypeBuf);
- icu::CharString* type = kwdBuf.create(bcpTypeBuf, bcpTypeLen, *status);
- if (type == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- if (U_FAILURE(*status)) {
- return;
- }
- pType = type->data();
- }
- } else {
- /* typeless - default type value is "yes" */
- pType = LOCALE_TYPE_YES;
- }
-
- /* Special handling for u-va-posix, since we want to treat this as a variant,
- not as a keyword */
- if (!variantExists && !uprv_strcmp(pKey, POSIX_KEY) && !uprv_strcmp(pType, POSIX_VALUE) ) {
- *posixVariant = TRUE;
- } else {
- /* create an ExtensionListEntry for this keyword */
- kwd = extPool.create();
- if (kwd == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
-
- kwd->key = pKey;
- kwd->value = pType;
-
- if (!_addExtensionToList(&kwdFirst, kwd, FALSE)) {
- // duplicate keyword is allowed, Only the first
- // is honored.
- }
- }
-
- pBcpKey = pNextBcpKey;
- bcpKeyLen = pNextBcpKey != NULL ? nextBcpKeyLen : 0;
- pBcpType = NULL;
- bcpTypeLen = 0;
- }
- }
- }
-
- kwd = kwdFirst;
- while (kwd != NULL) {
- nextKwd = kwd->next;
- _addExtensionToList(appendTo, kwd, FALSE);
- kwd = nextKwd;
- }
-}
-
-
-static void
-_appendKeywords(ULanguageTag* langtag, icu::ByteSink& sink, UErrorCode* status) {
- int32_t i, n;
- int32_t len;
- ExtensionListEntry *kwdFirst = NULL;
- ExtensionListEntry *kwd;
- const char *key, *type;
- icu::MemoryPool<ExtensionListEntry> extPool;
- icu::MemoryPool<icu::CharString> kwdBuf;
- UBool posixVariant = FALSE;
-
- if (U_FAILURE(*status)) {
- return;
- }
-
- /* Determine if variants already exists */
- if (ultag_getVariantsSize(langtag)) {
- posixVariant = TRUE;
- }
-
- n = ultag_getExtensionsSize(langtag);
-
- /* resolve locale keywords and reordering keys */
- for (i = 0; i < n; i++) {
- key = ultag_getExtensionKey(langtag, i);
- type = ultag_getExtensionValue(langtag, i);
- if (*key == LDMLEXT) {
- _appendLDMLExtensionAsKeywords(type, &kwdFirst, extPool, kwdBuf, &posixVariant, status);
- if (U_FAILURE(*status)) {
- break;
- }
- } else {
- kwd = extPool.create();
- if (kwd == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- break;
- }
- kwd->key = key;
- kwd->value = type;
- if (!_addExtensionToList(&kwdFirst, kwd, FALSE)) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- break;
- }
- }
- }
-
- if (U_SUCCESS(*status)) {
- type = ultag_getPrivateUse(langtag);
- if ((int32_t)uprv_strlen(type) > 0) {
- /* add private use as a keyword */
- kwd = extPool.create();
- if (kwd == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- } else {
- kwd->key = PRIVATEUSE_KEY;
- kwd->value = type;
- if (!_addExtensionToList(&kwdFirst, kwd, FALSE)) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- }
- }
- }
- }
-
- /* If a POSIX variant was in the extensions, write it out before writing the keywords. */
-
- if (U_SUCCESS(*status) && posixVariant) {
- len = (int32_t) uprv_strlen(_POSIX);
- sink.Append(_POSIX, len);
- }
-
- if (U_SUCCESS(*status) && kwdFirst != NULL) {
- /* write out the sorted keywords */
- UBool firstValue = TRUE;
- kwd = kwdFirst;
- do {
- if (firstValue) {
- sink.Append("@", 1);
- firstValue = FALSE;
- } else {
- sink.Append(";", 1);
- }
-
- /* key */
- len = (int32_t)uprv_strlen(kwd->key);
- sink.Append(kwd->key, len);
- sink.Append("=", 1);
-
- /* type */
- len = (int32_t)uprv_strlen(kwd->value);
- sink.Append(kwd->value, len);
-
- kwd = kwd->next;
- } while (kwd);
- }
-}
-
-static void
-_appendPrivateuseToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UBool hadPosix, UErrorCode* status) {
- (void)hadPosix;
- char buf[ULOC_FULLNAME_CAPACITY];
- char tmpAppend[ULOC_FULLNAME_CAPACITY];
- UErrorCode tmpStatus = U_ZERO_ERROR;
- int32_t len, i;
- int32_t reslen = 0;
- int32_t capacity = sizeof tmpAppend;
-
- if (U_FAILURE(*status)) {
- return;
- }
-
- len = uloc_getVariant(localeID, buf, sizeof(buf), &tmpStatus);
- if (U_FAILURE(tmpStatus) || tmpStatus == U_STRING_NOT_TERMINATED_WARNING) {
- if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- }
- return;
- }
-
- if (len > 0) {
- char *p, *pPriv;
- UBool bNext = TRUE;
- UBool firstValue = TRUE;
- UBool writeValue;
-
- pPriv = NULL;
- p = buf;
- while (bNext) {
- writeValue = FALSE;
- if (*p == SEP || *p == LOCALE_SEP || *p == 0) {
- if (*p == 0) {
- bNext = FALSE;
- } else {
- *p = 0; /* terminate */
- }
- if (pPriv != NULL) {
- /* Private use in the canonical format is lowercase in BCP47 */
- for (i = 0; *(pPriv + i) != 0; i++) {
- *(pPriv + i) = uprv_tolower(*(pPriv + i));
- }
-
- /* validate */
- if (_isPrivateuseValueSubtag(pPriv, -1)) {
- if (firstValue) {
- if (!_isVariantSubtag(pPriv, -1)) {
- writeValue = TRUE;
- }
- } else {
- writeValue = TRUE;
- }
- } else if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- break;
- } else {
- break;
- }
-
- if (writeValue) {
- if (reslen < capacity) {
- tmpAppend[reslen++] = SEP;
- }
-
- if (firstValue) {
- if (reslen < capacity) {
- tmpAppend[reslen++] = *PRIVATEUSE_KEY;
- }
-
- if (reslen < capacity) {
- tmpAppend[reslen++] = SEP;
- }
-
- len = (int32_t)uprv_strlen(PRIVUSE_VARIANT_PREFIX);
- if (reslen < capacity) {
- uprv_memcpy(tmpAppend + reslen, PRIVUSE_VARIANT_PREFIX, uprv_min(len, capacity - reslen));
- }
- reslen += len;
-
- if (reslen < capacity) {
- tmpAppend[reslen++] = SEP;
- }
-
- firstValue = FALSE;
- }
-
- len = (int32_t)uprv_strlen(pPriv);
- if (reslen < capacity) {
- uprv_memcpy(tmpAppend + reslen, pPriv, uprv_min(len, capacity - reslen));
- }
- reslen += len;
- }
- }
- /* reset private use starting position */
- pPriv = NULL;
- } else if (pPriv == NULL) {
- pPriv = p;
- }
- p++;
- }
-
- if (U_FAILURE(*status)) {
- return;
- }
- }
-
- if (U_SUCCESS(*status)) {
- len = reslen;
- sink.Append(tmpAppend, len);
- }
-}
-
-/*
-* -------------------------------------------------
-*
-* ultag_ functions
-*
-* -------------------------------------------------
-*/
-
-/* Bit flags used by the parser */
-#define LANG 0x0001
-#define EXTL 0x0002
-#define SCRT 0x0004
-#define REGN 0x0008
-#define VART 0x0010
-#define EXTS 0x0020
-#define EXTV 0x0040
-#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.
- */
-#if (defined(_MSC_VER) && (_MSC_VER >= 1900) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 190024210))
-#pragma optimize( "", off )
-#endif
-
-static ULanguageTag*
-ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* status) {
- char *tagBuf;
- int16_t next;
- char *pSubtag, *pNext, *pLastGoodPosition;
- int32_t subtagLen;
- int32_t extlangIdx;
- ExtensionListEntry *pExtension;
- char *pExtValueSubtag, *pExtValueSubtagEnd;
- int32_t i;
- UBool privateuseVar = FALSE;
- int32_t grandfatheredLen = 0;
-
- if (parsedLen != NULL) {
- *parsedLen = 0;
- }
-
- if (U_FAILURE(*status)) {
- return NULL;
- }
-
- if (tagLen < 0) {
- tagLen = (int32_t)uprv_strlen(tag);
- }
-
- /* copy the entire string */
- tagBuf = (char*)uprv_malloc(tagLen + 1);
- if (tagBuf == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
- uprv_memcpy(tagBuf, tag, tagLen);
- *(tagBuf + tagLen) = 0;
-
- /* create a ULanguageTag */
- icu::LocalULanguageTagPointer t(
- (ULanguageTag*)uprv_malloc(sizeof(ULanguageTag)));
- if (t.isNull()) {
- uprv_free(tagBuf);
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
- _initializeULanguageTag(t.getAlias());
- t->buf = tagBuf;
-
- if (tagLen < MINLEN) {
- /* the input tag is too short - return empty ULanguageTag */
- return t.orphan();
- }
-
- size_t parsedLenDelta = 0;
- // Grandfathered tag will be consider together. Grandfathered 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) {
- continue;
- }
- if (tagLen > checkGrandfatheredLen && tagBuf[checkGrandfatheredLen] != '-') {
- // make sure next char is '-'.
- continue;
- }
- if (uprv_strnicmp(GRANDFATHERED[i], tagBuf, checkGrandfatheredLen) == 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;
- if (tagLen < newTagLength) {
- uprv_free(tagBuf);
- tagBuf = (char*)uprv_malloc(newTagLength + 1);
- if (tagBuf == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
- 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);
- }
- break;
- }
- }
-
- if (grandfatheredLen == 0) {
- for (i = 0; i < UPRV_LENGTHOF(REDUNDANT); i += 2) {
- const char* redundantTag = REDUNDANT[i];
- size_t redundantTagLen = uprv_strlen(redundantTag);
- // The preferred tag for a redundant tag is always shorter than redundant
- // tag. A redundant tag may or may not be followed by other subtags.
- // (i.e. "zh-yue" or "zh-yue-u-co-pinyin").
- if (uprv_strnicmp(redundantTag, tagBuf, static_cast<uint32_t>(redundantTagLen)) == 0) {
- const char* redundantTagEnd = tagBuf + redundantTagLen;
- if (*redundantTagEnd == '\0' || *redundantTagEnd == SEP) {
- const char* preferredTag = REDUNDANT[i + 1];
- size_t preferredTagLen = uprv_strlen(preferredTag);
- uprv_strncpy(t->buf, preferredTag, preferredTagLen);
- if (*redundantTagEnd == SEP) {
- uprv_memmove(tagBuf + preferredTagLen,
- redundantTagEnd,
- tagLen - redundantTagLen + 1);
- } else {
- tagBuf[preferredTagLen] = '\0';
- }
- // parsedLen should be the length of the input
- // before redundantTag is replaced by preferredTag.
- // Save the delta to add it back later.
- parsedLenDelta = redundantTagLen - preferredTagLen;
- break;
- }
- }
- }
- }
-
- /*
- * langtag = language
- * ["-" script]
- * ["-" region]
- * *("-" variant)
- * *("-" extension)
- * ["-" privateuse]
- */
-
- next = LANG | PRIV;
- pNext = pLastGoodPosition = tagBuf;
- extlangIdx = 0;
- pExtension = NULL;
- pExtValueSubtag = NULL;
- pExtValueSubtagEnd = NULL;
-
- while (pNext) {
- char *pSep;
-
- pSubtag = pNext;
-
- /* locate next separator char */
- pSep = pSubtag;
- while (*pSep) {
- if (*pSep == SEP) {
- break;
- }
- pSep++;
- }
- if (*pSep == 0) {
- /* last subtag */
- pNext = NULL;
- } else {
- pNext = pSep + 1;
- }
- subtagLen = (int32_t)(pSep - pSubtag);
-
- if (next & LANG) {
- if (ultag_isLanguageSubtag(pSubtag, subtagLen)) {
- *pSep = 0; /* terminate */
- // TODO: move deprecated language code handling here.
- t->language = T_CString_toLowerCase(pSubtag);
-
- pLastGoodPosition = pSep;
- next = SCRT | REGN | VART | EXTS | PRIV;
- if (subtagLen <= 3)
- next |= EXTL;
- continue;
- }
- }
- if (next & EXTL) {
- if (_isExtlangSubtag(pSubtag, subtagLen)) {
- *pSep = 0;
- t->extlang[extlangIdx++] = T_CString_toLowerCase(pSubtag);
-
- pLastGoodPosition = pSep;
- if (extlangIdx < 3) {
- next = EXTL | SCRT | REGN | VART | EXTS | PRIV;
- } else {
- next = SCRT | REGN | VART | EXTS | PRIV;
- }
- continue;
- }
- }
- if (next & SCRT) {
- if (ultag_isScriptSubtag(pSubtag, subtagLen)) {
- char *p = pSubtag;
-
- *pSep = 0;
-
- /* to title case */
- *p = uprv_toupper(*p);
- p++;
- for (; *p; p++) {
- *p = uprv_tolower(*p);
- }
-
- t->script = pSubtag;
-
- pLastGoodPosition = pSep;
- next = REGN | VART | EXTS | PRIV;
- continue;
- }
- }
- if (next & REGN) {
- if (ultag_isRegionSubtag(pSubtag, subtagLen)) {
- *pSep = 0;
- // TODO: move deprecated region code handling here.
- t->region = T_CString_toUpperCase(pSubtag);
-
- pLastGoodPosition = pSep;
- next = VART | EXTS | PRIV;
- continue;
- }
- }
- if (next & VART) {
- if (_isVariantSubtag(pSubtag, subtagLen) ||
- (privateuseVar && _isPrivateuseVariantSubtag(pSubtag, subtagLen))) {
- VariantListEntry *var;
- UBool isAdded;
-
- var = (VariantListEntry*)uprv_malloc(sizeof(VariantListEntry));
- if (var == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
- *pSep = 0;
- var->variant = T_CString_toUpperCase(pSubtag);
- isAdded = _addVariantToList(&(t->variants), var);
- if (!isAdded) {
- /* duplicated variant entry */
- uprv_free(var);
- break;
- }
- pLastGoodPosition = pSep;
- next = VART | EXTS | PRIV;
- continue;
- }
- }
- if (next & EXTS) {
- if (_isExtensionSingleton(pSubtag, subtagLen)) {
- if (pExtension != NULL) {
- if (pExtValueSubtag == NULL || pExtValueSubtagEnd == NULL) {
- /* the previous extension is incomplete */
- uprv_free(pExtension);
- pExtension = NULL;
- break;
- }
-
- /* terminate the previous extension value */
- *pExtValueSubtagEnd = 0;
- pExtension->value = T_CString_toLowerCase(pExtValueSubtag);
-
- /* insert the extension to the list */
- if (_addExtensionToList(&(t->extensions), pExtension, FALSE)) {
- pLastGoodPosition = pExtValueSubtagEnd;
- } else {
- /* stop parsing here */
- uprv_free(pExtension);
- pExtension = NULL;
- break;
- }
- }
-
- /* create a new extension */
- pExtension = (ExtensionListEntry*)uprv_malloc(sizeof(ExtensionListEntry));
- if (pExtension == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
- *pSep = 0;
- pExtension->key = T_CString_toLowerCase(pSubtag);
- pExtension->value = NULL; /* will be set later */
-
- /*
- * reset the start and the end location of extension value
- * subtags for this extension
- */
- pExtValueSubtag = NULL;
- pExtValueSubtagEnd = NULL;
-
- next = EXTV;
- continue;
- }
- }
- if (next & EXTV) {
- if (_isExtensionSubtag(pSubtag, subtagLen)) {
- if (pExtValueSubtag == NULL) {
- /* if the start postion of this extension's value is not yet,
- this one is the first value subtag */
- pExtValueSubtag = pSubtag;
- }
-
- /* Mark the end of this subtag */
- pExtValueSubtagEnd = pSep;
- next = EXTS | EXTV | PRIV;
-
- continue;
- }
- }
- if (next & PRIV) {
- if (uprv_tolower(*pSubtag) == PRIVATEUSE && subtagLen == 1) {
- char *pPrivuseVal;
-
- if (pExtension != NULL) {
- /* Process the last extension */
- if (pExtValueSubtag == NULL || pExtValueSubtagEnd == NULL) {
- /* the previous extension is incomplete */
- uprv_free(pExtension);
- pExtension = NULL;
- break;
- } else {
- /* terminate the previous extension value */
- *pExtValueSubtagEnd = 0;
- pExtension->value = T_CString_toLowerCase(pExtValueSubtag);
-
- /* insert the extension to the list */
- if (_addExtensionToList(&(t->extensions), pExtension, FALSE)) {
- pLastGoodPosition = pExtValueSubtagEnd;
- pExtension = NULL;
- } else {
- /* stop parsing here */
- uprv_free(pExtension);
- pExtension = NULL;
- break;
- }
- }
- }
-
- /* The rest of part will be private use value subtags */
- if (pNext == NULL) {
- /* empty private use subtag */
- break;
- }
- /* back up the private use value start position */
- pPrivuseVal = pNext;
-
- /* validate private use value subtags */
- while (pNext) {
- pSubtag = pNext;
- pSep = pSubtag;
- while (*pSep) {
- if (*pSep == SEP) {
- break;
- }
- pSep++;
- }
- if (*pSep == 0) {
- /* last subtag */
- pNext = NULL;
- } else {
- pNext = pSep + 1;
- }
- subtagLen = (int32_t)(pSep - pSubtag);
-
- if (uprv_strncmp(pSubtag, PRIVUSE_VARIANT_PREFIX, uprv_strlen(PRIVUSE_VARIANT_PREFIX)) == 0) {
- *pSep = 0;
- next = VART;
- privateuseVar = TRUE;
- break;
- } else if (_isPrivateuseValueSubtag(pSubtag, subtagLen)) {
- pLastGoodPosition = pSep;
- } else {
- break;
- }
- }
-
- if (next == VART) {
- continue;
- }
-
- if (pLastGoodPosition - pPrivuseVal > 0) {
- *pLastGoodPosition = 0;
- t->privateuse = T_CString_toLowerCase(pPrivuseVal);
- }
- /* No more subtags, exiting the parse loop */
- break;
- }
- break;
- }
-
- /* If we fell through here, it means this subtag is illegal - quit parsing */
- break;
- }
-
- if (pExtension != NULL) {
- /* Process the last extension */
- if (pExtValueSubtag == NULL || pExtValueSubtagEnd == NULL) {
- /* the previous extension is incomplete */
- uprv_free(pExtension);
- } else {
- /* terminate the previous extension value */
- *pExtValueSubtagEnd = 0;
- pExtension->value = T_CString_toLowerCase(pExtValueSubtag);
- /* insert the extension to the list */
- if (_addExtensionToList(&(t->extensions), pExtension, FALSE)) {
- pLastGoodPosition = pExtValueSubtagEnd;
- } else {
- uprv_free(pExtension);
- }
- }
- }
-
- if (parsedLen != NULL) {
- *parsedLen = (int32_t)(pLastGoodPosition - t->buf + parsedLenDelta);
- }
-
- return t.orphan();
-}
-
-/**
-* Ticket #12705 - Turn optimization back on.
-*/
-#if (defined(_MSC_VER) && (_MSC_VER >= 1900) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 190024210))
-#pragma optimize( "", on )
-#endif
-
-static void
-ultag_close(ULanguageTag* langtag) {
-
- if (langtag == NULL) {
- return;
- }
-
- uprv_free(langtag->buf);
-
- if (langtag->variants) {
- VariantListEntry *curVar = langtag->variants;
- while (curVar) {
- VariantListEntry *nextVar = curVar->next;
- uprv_free(curVar);
- curVar = nextVar;
- }
- }
-
- if (langtag->extensions) {
- ExtensionListEntry *curExt = langtag->extensions;
- while (curExt) {
- ExtensionListEntry *nextExt = curExt->next;
- uprv_free(curExt);
- curExt = nextExt;
- }
- }
-
- uprv_free(langtag);
-}
-
-static const char*
-ultag_getLanguage(const ULanguageTag* langtag) {
- return langtag->language;
-}
-
-#if 0
-static const char*
-ultag_getJDKLanguage(const ULanguageTag* langtag) {
- int32_t i;
- for (i = 0; DEPRECATEDLANGS[i] != NULL; i += 2) {
- if (uprv_compareInvCharsAsAscii(DEPRECATEDLANGS[i], langtag->language) == 0) {
- return DEPRECATEDLANGS[i + 1];
- }
- }
- return langtag->language;
-}
-#endif
-
-static const char*
-ultag_getExtlang(const ULanguageTag* langtag, int32_t idx) {
- if (idx >= 0 && idx < MAXEXTLANG) {
- return langtag->extlang[idx];
- }
- return NULL;
-}
-
-static int32_t
-ultag_getExtlangSize(const ULanguageTag* langtag) {
- int32_t size = 0;
- int32_t i;
- for (i = 0; i < MAXEXTLANG; i++) {
- if (langtag->extlang[i]) {
- size++;
- }
- }
- return size;
-}
-
-static const char*
-ultag_getScript(const ULanguageTag* langtag) {
- return langtag->script;
-}
-
-static const char*
-ultag_getRegion(const ULanguageTag* langtag) {
- return langtag->region;
-}
-
-static const char*
-ultag_getVariant(const ULanguageTag* langtag, int32_t idx) {
- const char *var = NULL;
- VariantListEntry *cur = langtag->variants;
- int32_t i = 0;
- while (cur) {
- if (i == idx) {
- var = cur->variant;
- break;
- }
- cur = cur->next;
- i++;
- }
- return var;
-}
-
-static int32_t
-ultag_getVariantsSize(const ULanguageTag* langtag) {
- int32_t size = 0;
- VariantListEntry *cur = langtag->variants;
- while (TRUE) {
- if (cur == NULL) {
- break;
- }
- size++;
- cur = cur->next;
- }
- return size;
-}
-
-static const char*
-ultag_getExtensionKey(const ULanguageTag* langtag, int32_t idx) {
- const char *key = NULL;
- ExtensionListEntry *cur = langtag->extensions;
- int32_t i = 0;
- while (cur) {
- if (i == idx) {
- key = cur->key;
- break;
- }
- cur = cur->next;
- i++;
- }
- return key;
-}
-
-static const char*
-ultag_getExtensionValue(const ULanguageTag* langtag, int32_t idx) {
- const char *val = NULL;
- ExtensionListEntry *cur = langtag->extensions;
- int32_t i = 0;
- while (cur) {
- if (i == idx) {
- val = cur->value;
- break;
- }
- cur = cur->next;
- i++;
- }
- return val;
-}
-
-static int32_t
-ultag_getExtensionsSize(const ULanguageTag* langtag) {
- int32_t size = 0;
- ExtensionListEntry *cur = langtag->extensions;
- while (TRUE) {
- if (cur == NULL) {
- break;
- }
- size++;
- cur = cur->next;
- }
- return size;
-}
-
-static const char*
-ultag_getPrivateUse(const ULanguageTag* langtag) {
- return langtag->privateuse;
-}
-
-#if 0
-static const char*
-ultag_getGrandfathered(const ULanguageTag* langtag) {
- return langtag->grandfathered;
-}
-#endif
-
-
-/*
-* -------------------------------------------------
-*
-* Locale/BCP47 conversion APIs, exposed as uloc_*
-*
-* -------------------------------------------------
-*/
-U_CAPI int32_t U_EXPORT2
-uloc_toLanguageTag(const char* localeID,
- char* langtag,
- int32_t langtagCapacity,
- UBool strict,
- UErrorCode* status) {
- if (U_FAILURE(*status)) {
- return 0;
- }
-
- icu::CheckedArrayByteSink sink(langtag, langtagCapacity);
- ulocimp_toLanguageTag(localeID, sink, strict, status);
-
- int32_t reslen = sink.NumberOfBytesAppended();
-
- if (U_FAILURE(*status)) {
- return reslen;
- }
-
- if (sink.Overflowed()) {
- *status = U_BUFFER_OVERFLOW_ERROR;
- } else {
- u_terminateChars(langtag, langtagCapacity, reslen, status);
- }
-
- return reslen;
-}
-
-
-U_CAPI void U_EXPORT2
-ulocimp_toLanguageTag(const char* localeID,
- icu::ByteSink& sink,
- UBool strict,
- UErrorCode* status) {
- icu::CharString canonical;
- int32_t reslen;
- UErrorCode tmpStatus = U_ZERO_ERROR;
- UBool hadPosix = FALSE;
- const char* pKeywordStart;
-
- /* Note: uloc_canonicalize returns "en_US_POSIX" for input locale ID "". See #6835 */
- int32_t resultCapacity = static_cast<int32_t>(uprv_strlen(localeID));
- if (resultCapacity > 0) {
- char* buffer;
-
- for (;;) {
- buffer = canonical.getAppendBuffer(
- /*minCapacity=*/resultCapacity,
- /*desiredCapacityHint=*/resultCapacity,
- resultCapacity,
- tmpStatus);
-
- if (U_FAILURE(tmpStatus)) {
- *status = tmpStatus;
- return;
- }
-
- reslen =
- uloc_canonicalize(localeID, buffer, resultCapacity, &tmpStatus);
-
- if (tmpStatus != U_BUFFER_OVERFLOW_ERROR) {
- break;
- }
-
- resultCapacity = reslen;
- tmpStatus = U_ZERO_ERROR;
- }
-
- if (U_FAILURE(tmpStatus)) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- canonical.append(buffer, reslen, tmpStatus);
- if (tmpStatus == U_STRING_NOT_TERMINATED_WARNING) {
- tmpStatus = U_ZERO_ERROR; // Terminators provided by CharString.
- }
-
- if (U_FAILURE(tmpStatus)) {
- *status = tmpStatus;
- return;
- }
- }
-
- /* For handling special case - private use only tag */
- pKeywordStart = locale_getKeywordsStart(canonical.data());
- if (pKeywordStart == canonical.data()) {
- int kwdCnt = 0;
- UBool done = FALSE;
-
- icu::LocalUEnumerationPointer kwdEnum(uloc_openKeywords(canonical.data(), &tmpStatus));
- if (U_SUCCESS(tmpStatus)) {
- kwdCnt = uenum_count(kwdEnum.getAlias(), &tmpStatus);
- if (kwdCnt == 1) {
- const char *key;
- int32_t len = 0;
-
- 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);
- if (U_SUCCESS(tmpStatus)) {
- if (ultag_isPrivateuseValueSubtags(&buf[2], len)) {
- /* return private use only tag */
- sink.Append(buf, len + 2);
- done = TRUE;
- } else if (strict) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- done = TRUE;
- }
- /* if not strict mode, then "und" will be returned */
- } else {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- done = TRUE;
- }
- }
- }
- if (done) {
- return;
- }
- }
- }
-
- _appendLanguageToLanguageTag(canonical.data(), sink, strict, status);
- _appendScriptToLanguageTag(canonical.data(), sink, strict, status);
- _appendRegionToLanguageTag(canonical.data(), sink, strict, status);
- _appendVariantsToLanguageTag(canonical.data(), sink, strict, &hadPosix, status);
- _appendKeywordsToLanguageTag(canonical.data(), sink, strict, hadPosix, status);
- _appendPrivateuseToLanguageTag(canonical.data(), sink, strict, hadPosix, status);
-}
-
-
-U_CAPI int32_t U_EXPORT2
-uloc_forLanguageTag(const char* langtag,
- char* localeID,
- int32_t localeIDCapacity,
- int32_t* parsedLength,
- UErrorCode* status) {
- if (U_FAILURE(*status)) {
- return 0;
- }
-
- icu::CheckedArrayByteSink sink(localeID, localeIDCapacity);
- ulocimp_forLanguageTag(langtag, -1, sink, parsedLength, status);
-
- int32_t reslen = sink.NumberOfBytesAppended();
-
- if (U_FAILURE(*status)) {
- return reslen;
- }
-
- if (sink.Overflowed()) {
- *status = U_BUFFER_OVERFLOW_ERROR;
- } else {
- u_terminateChars(localeID, localeIDCapacity, reslen, status);
- }
-
- return reslen;
-}
-
-
-U_CAPI void U_EXPORT2
-ulocimp_forLanguageTag(const char* langtag,
- int32_t tagLen,
- icu::ByteSink& sink,
- int32_t* parsedLength,
- UErrorCode* status) {
- UBool isEmpty = TRUE;
- const char *subtag, *p;
- int32_t len;
- int32_t i, n;
- UBool noRegion = TRUE;
-
- icu::LocalULanguageTagPointer lt(ultag_parse(langtag, tagLen, parsedLength, status));
- if (U_FAILURE(*status)) {
- return;
- }
-
- /* language */
- subtag = ultag_getExtlangSize(lt.getAlias()) > 0 ? ultag_getExtlang(lt.getAlias(), 0) : ultag_getLanguage(lt.getAlias());
- if (uprv_compareInvCharsAsAscii(subtag, LANG_UND) != 0) {
- len = (int32_t)uprv_strlen(subtag);
- if (len > 0) {
- sink.Append(subtag, len);
- isEmpty = FALSE;
- }
- }
-
- /* script */
- subtag = ultag_getScript(lt.getAlias());
- len = (int32_t)uprv_strlen(subtag);
- if (len > 0) {
- sink.Append("_", 1);
- isEmpty = FALSE;
-
- /* write out the script in title case */
- char c = uprv_toupper(*subtag);
- sink.Append(&c, 1);
- sink.Append(subtag + 1, len - 1);
- }
-
- /* region */
- subtag = ultag_getRegion(lt.getAlias());
- len = (int32_t)uprv_strlen(subtag);
- if (len > 0) {
- sink.Append("_", 1);
- isEmpty = FALSE;
-
- /* write out the region in upper case */
- p = subtag;
- while (*p) {
- char c = uprv_toupper(*p);
- sink.Append(&c, 1);
- p++;
- }
- noRegion = FALSE;
- }
-
- /* variants */
- _sortVariants(lt.getAlias()->variants);
- n = ultag_getVariantsSize(lt.getAlias());
- if (n > 0) {
- if (noRegion) {
- sink.Append("_", 1);
- isEmpty = FALSE;
- }
-
- for (i = 0; i < n; i++) {
- subtag = ultag_getVariant(lt.getAlias(), i);
- sink.Append("_", 1);
-
- /* write out the variant in upper case */
- p = subtag;
- while (*p) {
- char c = uprv_toupper(*p);
- sink.Append(&c, 1);
- p++;
- }
- }
- }
-
- /* keywords */
- n = ultag_getExtensionsSize(lt.getAlias());
- subtag = ultag_getPrivateUse(lt.getAlias());
- if (n > 0 || uprv_strlen(subtag) > 0) {
- if (isEmpty && n > 0) {
- /* need a language */
- sink.Append(LANG_UND, LANG_UND_LEN);
- }
- _appendKeywords(lt.getAlias(), sink, status);
- }
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+**********************************************************************
+* Copyright (C) 2009-2015, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+*/
+
+#include "unicode/bytestream.h"
+#include "unicode/utypes.h"
+#include "unicode/ures.h"
+#include "unicode/localpointer.h"
+#include "unicode/putil.h"
+#include "unicode/uenum.h"
+#include "unicode/uloc.h"
+#include "ustr_imp.h"
+#include "charstr.h"
+#include "cmemory.h"
+#include "cstring.h"
+#include "putilimp.h"
+#include "uinvchar.h"
+#include "ulocimp.h"
+#include "uassert.h"
+
+
+/* struct holding a single variant */
+typedef struct VariantListEntry {
+ const char *variant;
+ struct VariantListEntry *next;
+} VariantListEntry;
+
+/* struct holding a single attribute value */
+struct AttributeListEntry : public icu::UMemory {
+ const char *attribute;
+ struct AttributeListEntry *next;
+};
+
+/* struct holding a single extension */
+struct ExtensionListEntry : public icu::UMemory {
+ const char *key;
+ const char *value;
+ struct ExtensionListEntry *next;
+};
+
+#define MAXEXTLANG 3
+typedef struct ULanguageTag {
+ char *buf; /* holding parsed subtags */
+ const char *language;
+ const char *extlang[MAXEXTLANG];
+ const char *script;
+ const char *region;
+ VariantListEntry *variants;
+ ExtensionListEntry *extensions;
+ const char *privateuse;
+ const char *grandfathered;
+} ULanguageTag;
+
+#define MINLEN 2
+#define SEP '-'
+#define PRIVATEUSE 'x'
+#define LDMLEXT 'u'
+
+#define LOCALE_SEP '_'
+#define LOCALE_EXT_SEP '@'
+#define LOCALE_KEYWORD_SEP ';'
+#define LOCALE_KEY_TYPE_SEP '='
+
+#define ISALPHA(c) uprv_isASCIILetter(c)
+#define ISNUMERIC(c) ((c)>='0' && (c)<='9')
+
+static const char EMPTY[] = "";
+static const char LANG_UND[] = "und";
+static const char PRIVATEUSE_KEY[] = "x";
+static const char _POSIX[] = "_POSIX";
+static const char POSIX_KEY[] = "va";
+static const char POSIX_VALUE[] = "posix";
+static const char LOCALE_ATTRIBUTE_KEY[] = "attribute";
+static const char PRIVUSE_VARIANT_PREFIX[] = "lvariant";
+static const char LOCALE_TYPE_YES[] = "yes";
+
+#define LANG_UND_LEN 3
+
+/*
+ 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.
+
+ curl https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry |\
+ egrep -A 7 'Type: grandfathered' | \
+ egrep 'Tag|Prefe' | grep -B1 'Preferred' | grep -v '^--' | \
+ awk -n '/Tag/ {printf(" \"%s\", ", $2);} /Preferred/ {printf("\"%s\",\n", $2);}' |\
+ tr 'A-Z' 'a-z'
+
+
+ The 2nd part is made of five ICU-specific entries. They're kept for
+ the backward compatibility for now, even though there are no preferred
+ values. They may have to be removed for the strict BCP 47 compliance.
+
+*/
+static const char* const GRANDFATHERED[] = {
+/* grandfathered preferred */
+ "art-lojban", "jbo",
+ "en-gb-oed", "en-gb-oxendict",
+ "i-ami", "ami",
+ "i-bnn", "bnn",
+ "i-hak", "hak",
+ "i-klingon", "tlh",
+ "i-lux", "lb",
+ "i-navajo", "nv",
+ "i-pwn", "pwn",
+ "i-tao", "tao",
+ "i-tay", "tay",
+ "i-tsu", "tsu",
+ "no-bok", "nb",
+ "no-nyn", "nn",
+ "sgn-be-fr", "sfb",
+ "sgn-be-nl", "vgt",
+ "sgn-ch-de", "sgg",
+ "zh-guoyu", "cmn",
+ "zh-hakka", "hak",
+ "zh-min-nan", "nan",
+ "zh-xiang", "hsn",
+
+ // Grandfathered 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",
+ "i-default", "en-x-i-default",
+ "i-enochian", "und-x-i-enochian",
+ "i-mingo", "see-x-i-mingo",
+ "zh-min", "nan-x-zh-min",
+};
+
+/*
+ Updated on 2018-09-12 from
+ https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry .
+
+ The table lists redundant tags with preferred value in the IANA languate tag registry.
+ It's generated with the following command:
+
+ curl https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry |\
+ grep 'Type: redundant' -A 5 | egrep '^(Tag:|Prefer)' | grep -B1 'Preferred' | \
+ awk -n '/Tag/ {printf(" \"%s\", ", $2);} /Preferred/ {printf("\"%s\",\n", $2);}' | \
+ tr 'A-Z' 'a-z'
+
+ In addition, ja-latn-hepburn-heploc is mapped to ja-latn-alalc97 because
+ a variant tag 'hepburn-heploc' has the preferred subtag, 'alaic97'.
+*/
+
+static const char* const REDUNDANT[] = {
+// redundant preferred
+ "sgn-br", "bzs",
+ "sgn-co", "csn",
+ "sgn-de", "gsg",
+ "sgn-dk", "dsl",
+ "sgn-es", "ssp",
+ "sgn-fr", "fsl",
+ "sgn-gb", "bfi",
+ "sgn-gr", "gss",
+ "sgn-ie", "isg",
+ "sgn-it", "ise",
+ "sgn-jp", "jsl",
+ "sgn-mx", "mfs",
+ "sgn-ni", "ncs",
+ "sgn-nl", "dse",
+ "sgn-no", "nsl",
+ "sgn-pt", "psr",
+ "sgn-se", "swl",
+ "sgn-us", "ase",
+ "sgn-za", "sfs",
+ "zh-cmn", "cmn",
+ "zh-cmn-hans", "cmn-hans",
+ "zh-cmn-hant", "cmn-hant",
+ "zh-gan", "gan",
+ "zh-wuu", "wuu",
+ "zh-yue", "yue",
+
+ // variant tag with preferred value
+ "ja-latn-hepburn-heploc", "ja-latn-alalc97",
+};
+
+/*
+ Updated on 2018-09-12 from
+ https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry .
+
+ grep 'Type: language' -A 7 language-subtag-registry | egrep 'Subtag|Prefe' | \
+ grep -B1 'Preferred' | grep -v '^--' | \
+ awk -n '/Subtag/ {printf(" \"%s\", ", $2);} /Preferred/ {printf("\"%s\",\n", $2);}'
+
+ Make sure that 2-letter language subtags come before 3-letter subtags.
+*/
+static const char DEPRECATEDLANGS[][4] = {
+/* deprecated new */
+ "in", "id",
+ "iw", "he",
+ "ji", "yi",
+ "jw", "jv",
+ "mo", "ro",
+ "aam", "aas",
+ "adp", "dz",
+ "aue", "ktz",
+ "ayx", "nun",
+ "bgm", "bcg",
+ "bjd", "drl",
+ "ccq", "rki",
+ "cjr", "mom",
+ "cka", "cmr",
+ "cmk", "xch",
+ "coy", "pij",
+ "cqu", "quh",
+ "drh", "khk",
+ "drw", "prs",
+ "gav", "dev",
+ "gfx", "vaj",
+ "ggn", "gvr",
+ "gti", "nyc",
+ "guv", "duz",
+ "hrr", "jal",
+ "ibi", "opa",
+ "ilw", "gal",
+ "jeg", "oyb",
+ "kgc", "tdf",
+ "kgh", "kml",
+ "koj", "kwv",
+ "krm", "bmf",
+ "ktr", "dtp",
+ "kvs", "gdj",
+ "kwq", "yam",
+ "kxe", "tvd",
+ "kzj", "dtp",
+ "kzt", "dtp",
+ "lii", "raq",
+ "lmm", "rmx",
+ "meg", "cir",
+ "mst", "mry",
+ "mwj", "vaj",
+ "myt", "mry",
+ "nad", "xny",
+ "ncp", "kdz",
+ "nnx", "ngv",
+ "nts", "pij",
+ "oun", "vaj",
+ "pcr", "adx",
+ "pmc", "huw",
+ "pmu", "phr",
+ "ppa", "bfy",
+ "ppr", "lcq",
+ "pry", "prt",
+ "puz", "pub",
+ "sca", "hle",
+ "skk", "oyb",
+ "tdu", "dtp",
+ "thc", "tpo",
+ "thx", "oyb",
+ "tie", "ras",
+ "tkk", "twm",
+ "tlw", "weo",
+ "tmp", "tyj",
+ "tne", "kak",
+ "tnf", "prs",
+ "tsf", "taj",
+ "uok", "ema",
+ "xba", "cax",
+ "xia", "acn",
+ "xkh", "waw",
+ "xsj", "suj",
+ "ybd", "rki",
+ "yma", "lrr",
+ "ymt", "mtm",
+ "yos", "zom",
+ "yuu", "yug",
+};
+
+/*
+ Updated on 2018-04-24 from
+
+ curl https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry | \
+ grep 'Type: region' -A 7 | egrep 'Subtag|Prefe' | \
+ grep -B1 'Preferred' | \
+ awk -n '/Subtag/ {printf(" \"%s\", ", $2);} /Preferred/ {printf("\"%s\",\n", $2);}'
+*/
+static const char DEPRECATEDREGIONS[][3] = {
+/* deprecated new */
+ "BU", "MM",
+ "DD", "DE",
+ "FX", "FR",
+ "TP", "TL",
+ "YD", "YE",
+ "ZR", "CD",
+};
+
+/*
+* -------------------------------------------------
+*
+* These ultag_ functions may be exposed as APIs later
+*
+* -------------------------------------------------
+*/
+
+static ULanguageTag*
+ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* status);
+
+static void
+ultag_close(ULanguageTag* langtag);
+
+static const char*
+ultag_getLanguage(const ULanguageTag* langtag);
+
+#if 0
+static const char*
+ultag_getJDKLanguage(const ULanguageTag* langtag);
+#endif
+
+static const char*
+ultag_getExtlang(const ULanguageTag* langtag, int32_t idx);
+
+static int32_t
+ultag_getExtlangSize(const ULanguageTag* langtag);
+
+static const char*
+ultag_getScript(const ULanguageTag* langtag);
+
+static const char*
+ultag_getRegion(const ULanguageTag* langtag);
+
+static const char*
+ultag_getVariant(const ULanguageTag* langtag, int32_t idx);
+
+static int32_t
+ultag_getVariantsSize(const ULanguageTag* langtag);
+
+static const char*
+ultag_getExtensionKey(const ULanguageTag* langtag, int32_t idx);
+
+static const char*
+ultag_getExtensionValue(const ULanguageTag* langtag, int32_t idx);
+
+static int32_t
+ultag_getExtensionsSize(const ULanguageTag* langtag);
+
+static const char*
+ultag_getPrivateUse(const ULanguageTag* langtag);
+
+#if 0
+static const char*
+ultag_getGrandfathered(const ULanguageTag* langtag);
+#endif
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \class LocalULanguageTagPointer
+ * "Smart pointer" class, closes a ULanguageTag via ultag_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @internal
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalULanguageTagPointer, ULanguageTag, ultag_close);
+
+U_NAMESPACE_END
+
+/*
+* -------------------------------------------------
+*
+* Language subtag syntax validation functions
+*
+* -------------------------------------------------
+*/
+
+static UBool
+_isAlphaString(const char* s, int32_t len) {
+ int32_t i;
+ for (i = 0; i < len; i++) {
+ if (!ISALPHA(*(s + i))) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+static UBool
+_isNumericString(const char* s, int32_t len) {
+ int32_t i;
+ for (i = 0; i < len; i++) {
+ if (!ISNUMERIC(*(s + i))) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+static UBool
+_isAlphaNumericString(const char* s, int32_t len) {
+ int32_t i;
+ for (i = 0; i < len; i++) {
+ if (!ISALPHA(*(s + i)) && !ISNUMERIC(*(s + i))) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+static UBool
+_isAlphaNumericStringLimitedLength(const char* s, int32_t len, int32_t min, int32_t max) {
+ if (len < 0) {
+ len = (int32_t)uprv_strlen(s);
+ }
+ if (len >= min && len <= max && _isAlphaNumericString(s, len)) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+U_CFUNC UBool
+ultag_isLanguageSubtag(const char* s, int32_t len) {
+ /*
+ * unicode_language_subtag = alpha{2,3} | alpha{5,8};
+ * NOTE: Per ICUTC 2019/01/23- accepting alpha 4
+ * See ICU-20372
+ */
+ if (len < 0) {
+ len = (int32_t)uprv_strlen(s);
+ }
+ if (len >= 2 && len <= 8 && _isAlphaString(s, len)) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static UBool
+_isExtlangSubtag(const char* s, int32_t len) {
+ /*
+ * extlang = 3ALPHA ; selected ISO 639 codes
+ * *2("-" 3ALPHA) ; permanently reserved
+ */
+ if (len < 0) {
+ len = (int32_t)uprv_strlen(s);
+ }
+ if (len == 3 && _isAlphaString(s, len)) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+U_CFUNC UBool
+ultag_isScriptSubtag(const char* s, int32_t len) {
+ /*
+ * script = 4ALPHA ; ISO 15924 code
+ */
+ if (len < 0) {
+ len = (int32_t)uprv_strlen(s);
+ }
+ if (len == 4 && _isAlphaString(s, len)) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+U_CFUNC UBool
+ultag_isRegionSubtag(const char* s, int32_t len) {
+ /*
+ * region = 2ALPHA ; ISO 3166-1 code
+ * / 3DIGIT ; UN M.49 code
+ */
+ if (len < 0) {
+ len = (int32_t)uprv_strlen(s);
+ }
+ if (len == 2 && _isAlphaString(s, len)) {
+ return TRUE;
+ }
+ if (len == 3 && _isNumericString(s, len)) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static UBool
+_isVariantSubtag(const char* s, int32_t len) {
+ /*
+ * variant = 5*8alphanum ; registered variants
+ * / (DIGIT 3alphanum)
+ */
+ if (len < 0) {
+ len = (int32_t)uprv_strlen(s);
+ }
+ if (_isAlphaNumericStringLimitedLength(s, len, 5, 8)) {
+ return TRUE;
+ }
+ if (len == 4 && ISNUMERIC(*s) && _isAlphaNumericString(s + 1, 3)) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static UBool
+_isSepListOf(UBool (*test)(const char*, int32_t), const char* s, int32_t len) {
+ const char *p = s;
+ const char *pSubtag = NULL;
+
+ if (len < 0) {
+ len = (int32_t)uprv_strlen(s);
+ }
+
+ while ((p - s) < len) {
+ if (*p == SEP) {
+ if (pSubtag == NULL) {
+ return FALSE;
+ }
+ if (!test(pSubtag, (int32_t)(p - pSubtag))) {
+ return FALSE;
+ }
+ pSubtag = NULL;
+ } else if (pSubtag == NULL) {
+ pSubtag = p;
+ }
+ p++;
+ }
+ if (pSubtag == NULL) {
+ return FALSE;
+ }
+ return test(pSubtag, (int32_t)(p - pSubtag));
+}
+
+U_CFUNC UBool
+ultag_isVariantSubtags(const char* s, int32_t len) {
+ return _isSepListOf(&_isVariantSubtag, s, len);
+}
+
+// This is for the ICU-specific "lvariant" handling.
+static UBool
+_isPrivateuseVariantSubtag(const char* s, int32_t len) {
+ /*
+ * variant = 1*8alphanum ; registered variants
+ * / (DIGIT 3alphanum)
+ */
+ return _isAlphaNumericStringLimitedLength(s, len , 1, 8);
+}
+
+static UBool
+_isExtensionSingleton(const char* s, int32_t len) {
+ /*
+ * extension = singleton 1*("-" (2*8alphanum))
+ *
+ * singleton = DIGIT ; 0 - 9
+ * / %x41-57 ; A - W
+ * / %x59-5A ; Y - Z
+ * / %x61-77 ; a - w
+ * / %x79-7A ; y - z
+ */
+ if (len < 0) {
+ len = (int32_t)uprv_strlen(s);
+ }
+ if (len == 1 && (ISALPHA(*s) || ISNUMERIC(*s)) && (uprv_tolower(*s) != PRIVATEUSE)) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static UBool
+_isExtensionSubtag(const char* s, int32_t len) {
+ /*
+ * extension = singleton 1*("-" (2*8alphanum))
+ */
+ return _isAlphaNumericStringLimitedLength(s, len, 2, 8);
+}
+
+U_CFUNC UBool
+ultag_isExtensionSubtags(const char* s, int32_t len) {
+ return _isSepListOf(&_isExtensionSubtag, s, len);
+}
+
+static UBool
+_isPrivateuseValueSubtag(const char* s, int32_t len) {
+ /*
+ * privateuse = "x" 1*("-" (1*8alphanum))
+ */
+ return _isAlphaNumericStringLimitedLength(s, len, 1, 8);
+}
+
+U_CFUNC UBool
+ultag_isPrivateuseValueSubtags(const char* s, int32_t len) {
+ return _isSepListOf(&_isPrivateuseValueSubtag, s, len);
+}
+
+U_CFUNC UBool
+ultag_isUnicodeLocaleAttribute(const char* s, int32_t len) {
+ /*
+ * attribute = alphanum{3,8} ;
+ */
+ return _isAlphaNumericStringLimitedLength(s, len , 3, 8);
+}
+
+U_CFUNC UBool
+ultag_isUnicodeLocaleAttributes(const char* s, int32_t len) {
+ return _isSepListOf(&ultag_isUnicodeLocaleAttribute, s, len);
+}
+
+U_CFUNC UBool
+ultag_isUnicodeLocaleKey(const char* s, int32_t len) {
+ /*
+ * key = alphanum alpha ;
+ */
+ if (len < 0) {
+ len = (int32_t)uprv_strlen(s);
+ }
+ if (len == 2 && (ISALPHA(*s) || ISNUMERIC(*s)) && ISALPHA(s[1])) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+U_CFUNC UBool
+_isUnicodeLocaleTypeSubtag(const char*s, int32_t len) {
+ /*
+ * alphanum{3,8}
+ */
+ return _isAlphaNumericStringLimitedLength(s, len , 3, 8);
+}
+
+U_CFUNC UBool
+ultag_isUnicodeLocaleType(const char*s, int32_t len) {
+ /*
+ * type = alphanum{3,8} (sep alphanum{3,8})* ;
+ */
+ return _isSepListOf(&_isUnicodeLocaleTypeSubtag, s, len);
+}
+
+static UBool
+_isTKey(const char* s, int32_t len)
+{
+ /*
+ * tkey = alpha digit ;
+ */
+ if (len < 0) {
+ len = (int32_t)uprv_strlen(s);
+ }
+ if (len == 2 && ISALPHA(*s) && ISNUMERIC(*(s + 1))) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static UBool
+_isTValue(const char* s, int32_t len)
+{
+ /*
+ * tvalue = (sep alphanum{3,8})+ ;
+ */
+ return _isAlphaNumericStringLimitedLength(s, len , 3, 8);
+}
+
+static UBool
+_isTransformedExtensionSubtag(int32_t& state, const char* s, int32_t len)
+{
+ const int32_t kStart = 0; // Start, wait for unicode_language_subtag, tkey or end
+ const int32_t kGotLanguage = 1; // Got unicode_language_subtag, wait for unicode_script_subtag,
+ // unicode_region_subtag, unicode_variant_subtag, tkey or end
+ const int32_t kGotScript = 2; // Got unicode_script_subtag, wait for unicode_region_subtag,
+ // unicode_variant_subtag, tkey, or end
+ const int32_t kGotRegion = 3; // Got unicode_region_subtag, wait for unicode_variant_subtag,
+ // tkey, or end.
+ const int32_t kGotVariant = 4; // Got unicode_variant_subtag, wait for unicode_variant_subtag
+ // tkey or end.
+ const int32_t kGotTKey = -1; // Got tkey, wait for tvalue. ERROR if stop here.
+ const int32_t kGotTValue = 6; // Got tvalue, wait for tkey, tvalue or end
+
+ switch (state) {
+ case kStart:
+ if (ultag_isLanguageSubtag(s, len)) {
+ state = kGotLanguage;
+ return TRUE;
+ }
+ if (_isTKey(s, len)) {
+ state = kGotTKey;
+ return TRUE;
+ }
+ return FALSE;
+ case kGotLanguage:
+ if (ultag_isScriptSubtag(s, len)) {
+ state = kGotScript;
+ return TRUE;
+ }
+ U_FALLTHROUGH;
+ case kGotScript:
+ if (ultag_isRegionSubtag(s, len)) {
+ state = kGotRegion;
+ return TRUE;
+ }
+ U_FALLTHROUGH;
+ case kGotRegion:
+ U_FALLTHROUGH;
+ case kGotVariant:
+ if (_isVariantSubtag(s, len)) {
+ state = kGotVariant;
+ return TRUE;
+ }
+ if (_isTKey(s, len)) {
+ state = kGotTKey;
+ return TRUE;
+ }
+ return FALSE;
+ case kGotTKey:
+ if (_isTValue(s, len)) {
+ state = kGotTValue;
+ return TRUE;
+ }
+ return FALSE;
+ case kGotTValue:
+ if (_isTKey(s, len)) {
+ state = kGotTKey;
+ return TRUE;
+ }
+ if (_isTValue(s, len)) {
+ return TRUE;
+ }
+ return FALSE;
+ }
+ return FALSE;
+}
+
+static UBool
+_isUnicodeExtensionSubtag(int32_t& state, const char* s, int32_t len)
+{
+ const int32_t kStart = 0; // Start, wait for a key or attribute or end
+ const int32_t kGotKey = 1; // Got a key, wait for type or key or end
+ const int32_t kGotType = 2; // Got a type, wait for key or end
+
+ switch (state) {
+ case kStart:
+ if (ultag_isUnicodeLocaleKey(s, len)) {
+ state = kGotKey;
+ return TRUE;
+ }
+ if (ultag_isUnicodeLocaleAttribute(s, len)) {
+ return TRUE;
+ }
+ return FALSE;
+ case kGotKey:
+ if (ultag_isUnicodeLocaleKey(s, len)) {
+ return TRUE;
+ }
+ if (_isUnicodeLocaleTypeSubtag(s, len)) {
+ state = kGotType;
+ return TRUE;
+ }
+ return FALSE;
+ case kGotType:
+ if (ultag_isUnicodeLocaleKey(s, len)) {
+ state = kGotKey;
+ return TRUE;
+ }
+ if (_isUnicodeLocaleTypeSubtag(s, len)) {
+ return TRUE;
+ }
+ return FALSE;
+ }
+ return FALSE;
+}
+
+static UBool
+_isStatefulSepListOf(UBool (*test)(int32_t&, const char*, int32_t), const char* s, int32_t len)
+{
+ int32_t state = 0;
+ const char* p;
+ const char* start = s;
+ int32_t subtagLen = 0;
+
+ if (len < 0) {
+ len = (int32_t)uprv_strlen(s);
+ }
+
+ for (p = s; len > 0; p++, len--) {
+ if (*p == SEP) {
+ if (!test(state, start, subtagLen)) {
+ return FALSE;
+ }
+ subtagLen = 0;
+ start = p + 1;
+ } else {
+ subtagLen++;
+ }
+ }
+
+ if (test(state, start, subtagLen) && state >= 0) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+U_CFUNC UBool
+ultag_isTransformedExtensionSubtags(const char* s, int32_t len)
+{
+ return _isStatefulSepListOf(&_isTransformedExtensionSubtag, s, len);
+}
+
+U_CFUNC UBool
+ultag_isUnicodeExtensionSubtags(const char* s, int32_t len) {
+ return _isStatefulSepListOf(&_isUnicodeExtensionSubtag, s, len);
+}
+
+
+/*
+* -------------------------------------------------
+*
+* Helper functions
+*
+* -------------------------------------------------
+*/
+
+static UBool
+_addVariantToList(VariantListEntry **first, VariantListEntry *var) {
+ UBool bAdded = TRUE;
+
+ if (*first == NULL) {
+ var->next = NULL;
+ *first = var;
+ } else {
+ VariantListEntry *prev, *cur;
+ int32_t cmp;
+
+ /* variants order should be preserved */
+ prev = NULL;
+ cur = *first;
+ while (TRUE) {
+ if (cur == NULL) {
+ prev->next = var;
+ var->next = NULL;
+ break;
+ }
+
+ /* Checking for duplicate variant */
+ cmp = uprv_compareInvCharsAsAscii(var->variant, cur->variant);
+ if (cmp == 0) {
+ /* duplicated variant */
+ bAdded = FALSE;
+ break;
+ }
+ prev = cur;
+ cur = cur->next;
+ }
+ }
+
+ return bAdded;
+}
+
+static UBool
+_addAttributeToList(AttributeListEntry **first, AttributeListEntry *attr) {
+ UBool bAdded = TRUE;
+
+ if (*first == NULL) {
+ attr->next = NULL;
+ *first = attr;
+ } else {
+ AttributeListEntry *prev, *cur;
+ int32_t cmp;
+
+ /* reorder variants in alphabetical order */
+ prev = NULL;
+ cur = *first;
+ while (TRUE) {
+ if (cur == NULL) {
+ prev->next = attr;
+ attr->next = NULL;
+ break;
+ }
+ cmp = uprv_compareInvCharsAsAscii(attr->attribute, cur->attribute);
+ if (cmp < 0) {
+ if (prev == NULL) {
+ *first = attr;
+ } else {
+ prev->next = attr;
+ }
+ attr->next = cur;
+ break;
+ }
+ if (cmp == 0) {
+ /* duplicated variant */
+ bAdded = FALSE;
+ break;
+ }
+ prev = cur;
+ cur = cur->next;
+ }
+ }
+
+ return bAdded;
+}
+
+
+static UBool
+_addExtensionToList(ExtensionListEntry **first, ExtensionListEntry *ext, UBool localeToBCP) {
+ UBool bAdded = TRUE;
+
+ if (*first == NULL) {
+ ext->next = NULL;
+ *first = ext;
+ } else {
+ ExtensionListEntry *prev, *cur;
+ int32_t cmp;
+
+ /* reorder variants in alphabetical order */
+ prev = NULL;
+ cur = *first;
+ while (TRUE) {
+ if (cur == NULL) {
+ prev->next = ext;
+ ext->next = NULL;
+ break;
+ }
+ if (localeToBCP) {
+ /* special handling for locale to bcp conversion */
+ int32_t len, curlen;
+
+ len = (int32_t)uprv_strlen(ext->key);
+ curlen = (int32_t)uprv_strlen(cur->key);
+
+ if (len == 1 && curlen == 1) {
+ if (*(ext->key) == *(cur->key)) {
+ cmp = 0;
+ } else if (*(ext->key) == PRIVATEUSE) {
+ cmp = 1;
+ } else if (*(cur->key) == PRIVATEUSE) {
+ cmp = -1;
+ } else {
+ cmp = *(ext->key) - *(cur->key);
+ }
+ } else if (len == 1) {
+ cmp = *(ext->key) - LDMLEXT;
+ } else if (curlen == 1) {
+ cmp = LDMLEXT - *(cur->key);
+ } else {
+ cmp = uprv_compareInvCharsAsAscii(ext->key, cur->key);
+ /* Both are u extension keys - we need special handling for 'attribute' */
+ if (cmp != 0) {
+ if (uprv_strcmp(cur->key, LOCALE_ATTRIBUTE_KEY) == 0) {
+ cmp = 1;
+ } else if (uprv_strcmp(ext->key, LOCALE_ATTRIBUTE_KEY) == 0) {
+ cmp = -1;
+ }
+ }
+ }
+ } else {
+ cmp = uprv_compareInvCharsAsAscii(ext->key, cur->key);
+ }
+ if (cmp < 0) {
+ if (prev == NULL) {
+ *first = ext;
+ } else {
+ prev->next = ext;
+ }
+ ext->next = cur;
+ break;
+ }
+ if (cmp == 0) {
+ /* duplicated extension key */
+ bAdded = FALSE;
+ break;
+ }
+ prev = cur;
+ cur = cur->next;
+ }
+ }
+
+ return bAdded;
+}
+
+static void
+_initializeULanguageTag(ULanguageTag* langtag) {
+ int32_t i;
+
+ langtag->buf = NULL;
+
+ langtag->language = EMPTY;
+ for (i = 0; i < MAXEXTLANG; i++) {
+ langtag->extlang[i] = NULL;
+ }
+
+ langtag->script = EMPTY;
+ langtag->region = EMPTY;
+
+ langtag->variants = NULL;
+ langtag->extensions = NULL;
+
+ langtag->grandfathered = EMPTY;
+ langtag->privateuse = EMPTY;
+}
+
+static void
+_appendLanguageToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UErrorCode* status) {
+ char buf[ULOC_LANG_CAPACITY];
+ UErrorCode tmpStatus = U_ZERO_ERROR;
+ int32_t len, i;
+
+ if (U_FAILURE(*status)) {
+ return;
+ }
+
+ len = uloc_getLanguage(localeID, buf, sizeof(buf), &tmpStatus);
+ if (U_FAILURE(tmpStatus) || tmpStatus == U_STRING_NOT_TERMINATED_WARNING) {
+ if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ len = 0;
+ }
+
+ /* Note: returned language code is in lower case letters */
+
+ if (len == 0) {
+ sink.Append(LANG_UND, LANG_UND_LEN);
+ } else if (!ultag_isLanguageSubtag(buf, len)) {
+ /* invalid language code */
+ if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ sink.Append(LANG_UND, LANG_UND_LEN);
+ } else {
+ /* resolve deprecated */
+ for (i = 0; i < UPRV_LENGTHOF(DEPRECATEDLANGS); i += 2) {
+ // 2-letter deprecated subtags are listede before 3-letter
+ // ones in DEPRECATEDLANGS[]. Get out of loop on coming
+ // across the 1st 3-letter subtag, if the input is a 2-letter code.
+ // to avoid continuing to try when there's no match.
+ if (uprv_strlen(buf) < uprv_strlen(DEPRECATEDLANGS[i])) break;
+ if (uprv_compareInvCharsAsAscii(buf, DEPRECATEDLANGS[i]) == 0) {
+ uprv_strcpy(buf, DEPRECATEDLANGS[i + 1]);
+ len = (int32_t)uprv_strlen(buf);
+ break;
+ }
+ }
+ sink.Append(buf, len);
+ }
+}
+
+static void
+_appendScriptToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UErrorCode* status) {
+ char buf[ULOC_SCRIPT_CAPACITY];
+ UErrorCode tmpStatus = U_ZERO_ERROR;
+ int32_t len;
+
+ if (U_FAILURE(*status)) {
+ return;
+ }
+
+ len = uloc_getScript(localeID, buf, sizeof(buf), &tmpStatus);
+ if (U_FAILURE(tmpStatus) || tmpStatus == U_STRING_NOT_TERMINATED_WARNING) {
+ if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ }
+ return;
+ }
+
+ if (len > 0) {
+ if (!ultag_isScriptSubtag(buf, len)) {
+ /* invalid script code */
+ if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ }
+ return;
+ } else {
+ sink.Append("-", 1);
+ sink.Append(buf, len);
+ }
+ }
+}
+
+static void
+_appendRegionToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UErrorCode* status) {
+ char buf[ULOC_COUNTRY_CAPACITY];
+ UErrorCode tmpStatus = U_ZERO_ERROR;
+ int32_t len;
+
+ if (U_FAILURE(*status)) {
+ return;
+ }
+
+ len = uloc_getCountry(localeID, buf, sizeof(buf), &tmpStatus);
+ if (U_FAILURE(tmpStatus) || tmpStatus == U_STRING_NOT_TERMINATED_WARNING) {
+ if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ }
+ return;
+ }
+
+ if (len > 0) {
+ if (!ultag_isRegionSubtag(buf, len)) {
+ /* invalid region code */
+ if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ }
+ return;
+ } else {
+ sink.Append("-", 1);
+ /* resolve deprecated */
+ for (int i = 0; i < UPRV_LENGTHOF(DEPRECATEDREGIONS); i += 2) {
+ if (uprv_compareInvCharsAsAscii(buf, DEPRECATEDREGIONS[i]) == 0) {
+ uprv_strcpy(buf, DEPRECATEDREGIONS[i + 1]);
+ len = (int32_t)uprv_strlen(buf);
+ break;
+ }
+ }
+ sink.Append(buf, len);
+ }
+ }
+}
+
+static void _sortVariants(VariantListEntry* first) {
+ for (VariantListEntry* var1 = first; var1 != NULL; var1 = var1->next) {
+ for (VariantListEntry* var2 = var1->next; var2 != NULL; var2 = var2->next) {
+ // Swap var1->variant and var2->variant.
+ if (uprv_compareInvCharsAsAscii(var1->variant, var2->variant) > 0) {
+ const char* temp = var1->variant;
+ var1->variant = var2->variant;
+ var2->variant = temp;
+ }
+ }
+ }
+}
+
+static void
+_appendVariantsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UBool *hadPosix, UErrorCode* status) {
+ char buf[ULOC_FULLNAME_CAPACITY];
+ UErrorCode tmpStatus = U_ZERO_ERROR;
+ int32_t len, i;
+
+ if (U_FAILURE(*status)) {
+ return;
+ }
+
+ len = uloc_getVariant(localeID, buf, sizeof(buf), &tmpStatus);
+ if (U_FAILURE(tmpStatus) || tmpStatus == U_STRING_NOT_TERMINATED_WARNING) {
+ if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ }
+ return;
+ }
+
+ if (len > 0) {
+ char *p, *pVar;
+ UBool bNext = TRUE;
+ VariantListEntry *var;
+ VariantListEntry *varFirst = NULL;
+
+ pVar = NULL;
+ p = buf;
+ while (bNext) {
+ if (*p == SEP || *p == LOCALE_SEP || *p == 0) {
+ if (*p == 0) {
+ bNext = FALSE;
+ } else {
+ *p = 0; /* terminate */
+ }
+ if (pVar == NULL) {
+ if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ break;
+ }
+ /* ignore empty variant */
+ } else {
+ /* ICU uses upper case letters for variants, but
+ the canonical format is lowercase in BCP47 */
+ for (i = 0; *(pVar + i) != 0; i++) {
+ *(pVar + i) = uprv_tolower(*(pVar + i));
+ }
+
+ /* validate */
+ if (_isVariantSubtag(pVar, -1)) {
+ if (uprv_strcmp(pVar,POSIX_VALUE) || len != (int32_t)uprv_strlen(POSIX_VALUE)) {
+ /* emit the variant to the list */
+ var = (VariantListEntry*)uprv_malloc(sizeof(VariantListEntry));
+ if (var == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ break;
+ }
+ var->variant = pVar;
+ if (!_addVariantToList(&varFirst, var)) {
+ /* duplicated variant */
+ uprv_free(var);
+ if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ break;
+ }
+ }
+ } else {
+ /* Special handling for POSIX variant, need to remember that we had it and then */
+ /* treat it like an extension later. */
+ *hadPosix = TRUE;
+ }
+ } else if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ break;
+ } else if (_isPrivateuseValueSubtag(pVar, -1)) {
+ /* Handle private use subtags separately */
+ break;
+ }
+ }
+ /* reset variant starting position */
+ pVar = NULL;
+ } else if (pVar == NULL) {
+ pVar = p;
+ }
+ p++;
+ }
+
+ if (U_SUCCESS(*status)) {
+ if (varFirst != NULL) {
+ int32_t varLen;
+
+ /* per UTS35, we should sort the variants */
+ _sortVariants(varFirst);
+
+ /* write out validated/normalized variants to the target */
+ var = varFirst;
+ while (var != NULL) {
+ sink.Append("-", 1);
+ varLen = (int32_t)uprv_strlen(var->variant);
+ sink.Append(var->variant, varLen);
+ var = var->next;
+ }
+ }
+ }
+
+ /* clean up */
+ var = varFirst;
+ while (var != NULL) {
+ VariantListEntry *tmpVar = var->next;
+ uprv_free(var);
+ var = tmpVar;
+ }
+
+ if (U_FAILURE(*status)) {
+ return;
+ }
+ }
+}
+
+static void
+_appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UBool hadPosix, UErrorCode* status) {
+ char attrBuf[ULOC_KEYWORD_AND_VALUES_CAPACITY] = { 0 };
+ int32_t attrBufLength = 0;
+
+ icu::MemoryPool<AttributeListEntry> attrPool;
+ icu::MemoryPool<ExtensionListEntry> extPool;
+ icu::MemoryPool<icu::CharString> strPool;
+
+ icu::LocalUEnumerationPointer keywordEnum(uloc_openKeywords(localeID, status));
+ if (U_FAILURE(*status) && !hadPosix) {
+ return;
+ }
+ if (keywordEnum.isValid() || hadPosix) {
+ /* reorder extensions */
+ int32_t len;
+ const char *key;
+ ExtensionListEntry *firstExt = NULL;
+ ExtensionListEntry *ext;
+ AttributeListEntry *firstAttr = NULL;
+ AttributeListEntry *attr;
+ icu::MemoryPool<icu::CharString> extBufPool;
+ const char *bcpKey=nullptr, *bcpValue=nullptr;
+ UErrorCode tmpStatus = U_ZERO_ERROR;
+ int32_t keylen;
+ 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;
+ }
+
+ if (U_FAILURE(tmpStatus)) {
+ if (tmpStatus == U_MEMORY_ALLOCATION_ERROR) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ break;
+ }
+ if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ break;
+ }
+ /* ignore this keyword */
+ tmpStatus = U_ZERO_ERROR;
+ 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);
+
+ /* special keyword used for representing Unicode locale attributes */
+ if (uprv_strcmp(key, LOCALE_ATTRIBUTE_KEY) == 0) {
+ if (len > 0) {
+ int32_t i = 0;
+ while (TRUE) {
+ attrBufLength = 0;
+ for (; i < len; i++) {
+ if (buf[i] != '-') {
+ attrBuf[attrBufLength++] = buf[i];
+ } else {
+ i++;
+ break;
+ }
+ }
+ if (attrBufLength > 0) {
+ attrBuf[attrBufLength] = 0;
+
+ } else if (i >= len){
+ break;
+ }
+
+ /* create AttributeListEntry */
+ attr = attrPool.create();
+ if (attr == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ break;
+ }
+ icu::CharString* attrValue =
+ strPool.create(attrBuf, attrBufLength, *status);
+ if (attrValue == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ break;
+ }
+ if (U_FAILURE(*status)) {
+ break;
+ }
+ attr->attribute = attrValue->data();
+
+ if (!_addAttributeToList(&firstAttr, attr)) {
+ if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ break;
+ }
+ }
+ }
+ /* for a place holder ExtensionListEntry */
+ bcpKey = LOCALE_ATTRIBUTE_KEY;
+ bcpValue = NULL;
+ }
+ } else if (isBcpUExt) {
+ bcpKey = uloc_toUnicodeLocaleKey(key);
+ if (bcpKey == NULL) {
+ if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ break;
+ }
+ continue;
+ }
+
+ /* we've checked buf is null-terminated above */
+ bcpValue = uloc_toUnicodeLocaleType(key, buf.data());
+ if (bcpValue == NULL) {
+ if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ break;
+ }
+ continue;
+ }
+ if (bcpValue == buf.data()) {
+ /*
+ When uloc_toUnicodeLocaleType(key, buf) returns the
+ input value as is, the value is well-formed, but has
+ no known mapping. This implementation normalizes the
+ value to lower case
+ */
+ icu::CharString* extBuf = extBufPool.create();
+ 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;
+ }
+
+ bcpValue = extBuf->data();
+ }
+ } else {
+ if (*key == PRIVATEUSE) {
+ if (!ultag_isPrivateuseValueSubtags(buf.data(), len)) {
+ if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ break;
+ }
+ continue;
+ }
+ } else {
+ if (!_isExtensionSingleton(key, keylen) || !ultag_isExtensionSubtags(buf.data(), len)) {
+ if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ break;
+ }
+ continue;
+ }
+ }
+ bcpKey = key;
+ icu::CharString* extBuf =
+ extBufPool.create(buf.data(), len, tmpStatus);
+ if (extBuf == nullptr) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ break;
+ }
+ if (U_FAILURE(tmpStatus)) {
+ *status = tmpStatus;
+ break;
+ }
+ bcpValue = extBuf->data();
+ }
+
+ /* create ExtensionListEntry */
+ ext = extPool.create();
+ if (ext == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ break;
+ }
+ ext->key = bcpKey;
+ ext->value = bcpValue;
+
+ if (!_addExtensionToList(&firstExt, ext, TRUE)) {
+ if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ break;
+ }
+ }
+ }
+
+ /* Special handling for POSIX variant - add the keywords for POSIX */
+ if (hadPosix) {
+ /* create ExtensionListEntry for POSIX */
+ ext = extPool.create();
+ if (ext == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ ext->key = POSIX_KEY;
+ ext->value = POSIX_VALUE;
+
+ if (!_addExtensionToList(&firstExt, ext, TRUE)) {
+ // Silently ignore errors.
+ }
+ }
+
+ if (U_SUCCESS(*status) && (firstExt != NULL || firstAttr != NULL)) {
+ UBool startLDMLExtension = FALSE;
+ for (ext = firstExt; ext; ext = ext->next) {
+ if (!startLDMLExtension && uprv_strlen(ext->key) > 1) {
+ /* first LDML u singlton extension */
+ sink.Append("-u", 2);
+ startLDMLExtension = TRUE;
+ }
+
+ /* write out the sorted BCP47 attributes, extensions and private use */
+ if (uprv_strcmp(ext->key, LOCALE_ATTRIBUTE_KEY) == 0) {
+ /* write the value for the attributes */
+ for (attr = firstAttr; attr; attr = attr->next) {
+ sink.Append("-", 1);
+ sink.Append(
+ attr->attribute, static_cast<int32_t>(uprv_strlen(attr->attribute)));
+ }
+ } else {
+ sink.Append("-", 1);
+ sink.Append(ext->key, static_cast<int32_t>(uprv_strlen(ext->key)));
+ if (uprv_strcmp(ext->value, "true") != 0 &&
+ uprv_strcmp(ext->value, "yes") != 0) {
+ sink.Append("-", 1);
+ sink.Append(ext->value, static_cast<int32_t>(uprv_strlen(ext->value)));
+ }
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Append keywords parsed from LDML extension value
+ * e.g. "u-ca-gregory-co-trad" -> {calendar = gregorian} {collation = traditional}
+ * Note: char* buf is used for storing keywords
+ */
+static void
+_appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendTo, icu::MemoryPool<ExtensionListEntry>& extPool, icu::MemoryPool<icu::CharString>& kwdBuf, UBool *posixVariant, UErrorCode *status) {
+ const char *pTag; /* beginning of current subtag */
+ const char *pKwds; /* beginning of key-type pairs */
+ UBool variantExists = *posixVariant;
+
+ ExtensionListEntry *kwdFirst = NULL; /* first LDML keyword */
+ ExtensionListEntry *kwd, *nextKwd;
+
+ int32_t len;
+
+ /* Reset the posixVariant value */
+ *posixVariant = FALSE;
+
+ pTag = ldmlext;
+ pKwds = NULL;
+
+ {
+ AttributeListEntry *attrFirst = NULL; /* first attribute */
+ AttributeListEntry *attr, *nextAttr;
+
+ char attrBuf[ULOC_KEYWORD_AND_VALUES_CAPACITY];
+ int32_t attrBufIdx = 0;
+
+ icu::MemoryPool<AttributeListEntry> attrPool;
+
+ /* Iterate through u extension attributes */
+ while (*pTag) {
+ /* locate next separator char */
+ for (len = 0; *(pTag + len) && *(pTag + len) != SEP; len++);
+
+ if (ultag_isUnicodeLocaleKey(pTag, len)) {
+ pKwds = pTag;
+ break;
+ }
+
+ /* add this attribute to the list */
+ attr = attrPool.create();
+ if (attr == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+
+ if (len < (int32_t)sizeof(attrBuf) - attrBufIdx) {
+ uprv_memcpy(&attrBuf[attrBufIdx], pTag, len);
+ attrBuf[attrBufIdx + len] = 0;
+ attr->attribute = &attrBuf[attrBufIdx];
+ attrBufIdx += (len + 1);
+ } else {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ // duplicate attribute is ignored, causes no error.
+ _addAttributeToList(&attrFirst, attr);
+
+ /* next tag */
+ pTag += len;
+ if (*pTag) {
+ /* next to the separator */
+ pTag++;
+ }
+ }
+
+ if (attrFirst) {
+ /* emit attributes as an LDML keyword, e.g. attribute=attr1-attr2 */
+
+ kwd = extPool.create();
+ if (kwd == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+
+ icu::CharString* value = kwdBuf.create();
+ if (value == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+
+ /* attribute subtags sorted in alphabetical order as type */
+ attr = attrFirst;
+ while (attr != NULL) {
+ nextAttr = attr->next;
+ if (attr != attrFirst) {
+ value->append('-', *status);
+ }
+ value->append(attr->attribute, *status);
+ attr = nextAttr;
+ }
+ if (U_FAILURE(*status)) {
+ return;
+ }
+
+ kwd->key = LOCALE_ATTRIBUTE_KEY;
+ kwd->value = value->data();
+
+ if (!_addExtensionToList(&kwdFirst, kwd, FALSE)) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ }
+ }
+
+ if (pKwds) {
+ const char *pBcpKey = NULL; /* u extenstion key subtag */
+ const char *pBcpType = NULL; /* beginning of u extension type subtag(s) */
+ int32_t bcpKeyLen = 0;
+ int32_t bcpTypeLen = 0;
+ UBool isDone = FALSE;
+
+ pTag = pKwds;
+ /* BCP47 representation of LDML key/type pairs */
+ while (!isDone) {
+ const char *pNextBcpKey = NULL;
+ int32_t nextBcpKeyLen = 0;
+ UBool emitKeyword = FALSE;
+
+ if (*pTag) {
+ /* locate next separator char */
+ for (len = 0; *(pTag + len) && *(pTag + len) != SEP; len++);
+
+ if (ultag_isUnicodeLocaleKey(pTag, len)) {
+ if (pBcpKey) {
+ emitKeyword = TRUE;
+ pNextBcpKey = pTag;
+ nextBcpKeyLen = len;
+ } else {
+ pBcpKey = pTag;
+ bcpKeyLen = len;
+ }
+ } else {
+ U_ASSERT(pBcpKey != NULL);
+ /* within LDML type subtags */
+ if (pBcpType) {
+ bcpTypeLen += (len + 1);
+ } else {
+ pBcpType = pTag;
+ bcpTypeLen = len;
+ }
+ }
+
+ /* next tag */
+ pTag += len;
+ if (*pTag) {
+ /* next to the separator */
+ pTag++;
+ }
+ } else {
+ /* processing last one */
+ emitKeyword = TRUE;
+ isDone = TRUE;
+ }
+
+ if (emitKeyword) {
+ const char *pKey = NULL; /* LDML key */
+ const char *pType = NULL; /* LDML type */
+
+ char bcpKeyBuf[3]; /* BCP key length is always 2 for now */
+
+ U_ASSERT(pBcpKey != NULL);
+
+ if (bcpKeyLen >= (int32_t)sizeof(bcpKeyBuf)) {
+ /* the BCP key is invalid */
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ U_ASSERT(bcpKeyLen <= 2);
+
+ uprv_strncpy(bcpKeyBuf, pBcpKey, bcpKeyLen);
+ bcpKeyBuf[bcpKeyLen] = 0;
+
+ /* u extension key to LDML key */
+ pKey = uloc_toLegacyKey(bcpKeyBuf);
+ if (pKey == NULL) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ if (pKey == bcpKeyBuf) {
+ /*
+ The key returned by toLegacyKey points to the input buffer.
+ We normalize the result key to lower case.
+ */
+ T_CString_toLowerCase(bcpKeyBuf);
+ icu::CharString* key = kwdBuf.create(bcpKeyBuf, bcpKeyLen, *status);
+ if (key == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ if (U_FAILURE(*status)) {
+ return;
+ }
+ pKey = key->data();
+ }
+
+ if (pBcpType) {
+ char bcpTypeBuf[128]; /* practically long enough even considering multiple subtag type */
+ if (bcpTypeLen >= (int32_t)sizeof(bcpTypeBuf)) {
+ /* the BCP type is too long */
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ uprv_strncpy(bcpTypeBuf, pBcpType, bcpTypeLen);
+ bcpTypeBuf[bcpTypeLen] = 0;
+
+ /* BCP type to locale type */
+ pType = uloc_toLegacyType(pKey, bcpTypeBuf);
+ if (pType == NULL) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ if (pType == bcpTypeBuf) {
+ /*
+ The type returned by toLegacyType points to the input buffer.
+ We normalize the result type to lower case.
+ */
+ /* normalize to lower case */
+ T_CString_toLowerCase(bcpTypeBuf);
+ icu::CharString* type = kwdBuf.create(bcpTypeBuf, bcpTypeLen, *status);
+ if (type == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ if (U_FAILURE(*status)) {
+ return;
+ }
+ pType = type->data();
+ }
+ } else {
+ /* typeless - default type value is "yes" */
+ pType = LOCALE_TYPE_YES;
+ }
+
+ /* Special handling for u-va-posix, since we want to treat this as a variant,
+ not as a keyword */
+ if (!variantExists && !uprv_strcmp(pKey, POSIX_KEY) && !uprv_strcmp(pType, POSIX_VALUE) ) {
+ *posixVariant = TRUE;
+ } else {
+ /* create an ExtensionListEntry for this keyword */
+ kwd = extPool.create();
+ if (kwd == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+
+ kwd->key = pKey;
+ kwd->value = pType;
+
+ if (!_addExtensionToList(&kwdFirst, kwd, FALSE)) {
+ // duplicate keyword is allowed, Only the first
+ // is honored.
+ }
+ }
+
+ pBcpKey = pNextBcpKey;
+ bcpKeyLen = pNextBcpKey != NULL ? nextBcpKeyLen : 0;
+ pBcpType = NULL;
+ bcpTypeLen = 0;
+ }
+ }
+ }
+
+ kwd = kwdFirst;
+ while (kwd != NULL) {
+ nextKwd = kwd->next;
+ _addExtensionToList(appendTo, kwd, FALSE);
+ kwd = nextKwd;
+ }
+}
+
+
+static void
+_appendKeywords(ULanguageTag* langtag, icu::ByteSink& sink, UErrorCode* status) {
+ int32_t i, n;
+ int32_t len;
+ ExtensionListEntry *kwdFirst = NULL;
+ ExtensionListEntry *kwd;
+ const char *key, *type;
+ icu::MemoryPool<ExtensionListEntry> extPool;
+ icu::MemoryPool<icu::CharString> kwdBuf;
+ UBool posixVariant = FALSE;
+
+ if (U_FAILURE(*status)) {
+ return;
+ }
+
+ /* Determine if variants already exists */
+ if (ultag_getVariantsSize(langtag)) {
+ posixVariant = TRUE;
+ }
+
+ n = ultag_getExtensionsSize(langtag);
+
+ /* resolve locale keywords and reordering keys */
+ for (i = 0; i < n; i++) {
+ key = ultag_getExtensionKey(langtag, i);
+ type = ultag_getExtensionValue(langtag, i);
+ if (*key == LDMLEXT) {
+ _appendLDMLExtensionAsKeywords(type, &kwdFirst, extPool, kwdBuf, &posixVariant, status);
+ if (U_FAILURE(*status)) {
+ break;
+ }
+ } else {
+ kwd = extPool.create();
+ if (kwd == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ break;
+ }
+ kwd->key = key;
+ kwd->value = type;
+ if (!_addExtensionToList(&kwdFirst, kwd, FALSE)) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ break;
+ }
+ }
+ }
+
+ if (U_SUCCESS(*status)) {
+ type = ultag_getPrivateUse(langtag);
+ if ((int32_t)uprv_strlen(type) > 0) {
+ /* add private use as a keyword */
+ kwd = extPool.create();
+ if (kwd == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ } else {
+ kwd->key = PRIVATEUSE_KEY;
+ kwd->value = type;
+ if (!_addExtensionToList(&kwdFirst, kwd, FALSE)) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ }
+ }
+ }
+ }
+
+ /* If a POSIX variant was in the extensions, write it out before writing the keywords. */
+
+ if (U_SUCCESS(*status) && posixVariant) {
+ len = (int32_t) uprv_strlen(_POSIX);
+ sink.Append(_POSIX, len);
+ }
+
+ if (U_SUCCESS(*status) && kwdFirst != NULL) {
+ /* write out the sorted keywords */
+ UBool firstValue = TRUE;
+ kwd = kwdFirst;
+ do {
+ if (firstValue) {
+ sink.Append("@", 1);
+ firstValue = FALSE;
+ } else {
+ sink.Append(";", 1);
+ }
+
+ /* key */
+ len = (int32_t)uprv_strlen(kwd->key);
+ sink.Append(kwd->key, len);
+ sink.Append("=", 1);
+
+ /* type */
+ len = (int32_t)uprv_strlen(kwd->value);
+ sink.Append(kwd->value, len);
+
+ kwd = kwd->next;
+ } while (kwd);
+ }
+}
+
+static void
+_appendPrivateuseToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UBool hadPosix, UErrorCode* status) {
+ (void)hadPosix;
+ char buf[ULOC_FULLNAME_CAPACITY];
+ char tmpAppend[ULOC_FULLNAME_CAPACITY];
+ UErrorCode tmpStatus = U_ZERO_ERROR;
+ int32_t len, i;
+ int32_t reslen = 0;
+ int32_t capacity = sizeof tmpAppend;
+
+ if (U_FAILURE(*status)) {
+ return;
+ }
+
+ len = uloc_getVariant(localeID, buf, sizeof(buf), &tmpStatus);
+ if (U_FAILURE(tmpStatus) || tmpStatus == U_STRING_NOT_TERMINATED_WARNING) {
+ if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ }
+ return;
+ }
+
+ if (len > 0) {
+ char *p, *pPriv;
+ UBool bNext = TRUE;
+ UBool firstValue = TRUE;
+ UBool writeValue;
+
+ pPriv = NULL;
+ p = buf;
+ while (bNext) {
+ writeValue = FALSE;
+ if (*p == SEP || *p == LOCALE_SEP || *p == 0) {
+ if (*p == 0) {
+ bNext = FALSE;
+ } else {
+ *p = 0; /* terminate */
+ }
+ if (pPriv != NULL) {
+ /* Private use in the canonical format is lowercase in BCP47 */
+ for (i = 0; *(pPriv + i) != 0; i++) {
+ *(pPriv + i) = uprv_tolower(*(pPriv + i));
+ }
+
+ /* validate */
+ if (_isPrivateuseValueSubtag(pPriv, -1)) {
+ if (firstValue) {
+ if (!_isVariantSubtag(pPriv, -1)) {
+ writeValue = TRUE;
+ }
+ } else {
+ writeValue = TRUE;
+ }
+ } else if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ break;
+ } else {
+ break;
+ }
+
+ if (writeValue) {
+ if (reslen < capacity) {
+ tmpAppend[reslen++] = SEP;
+ }
+
+ if (firstValue) {
+ if (reslen < capacity) {
+ tmpAppend[reslen++] = *PRIVATEUSE_KEY;
+ }
+
+ if (reslen < capacity) {
+ tmpAppend[reslen++] = SEP;
+ }
+
+ len = (int32_t)uprv_strlen(PRIVUSE_VARIANT_PREFIX);
+ if (reslen < capacity) {
+ uprv_memcpy(tmpAppend + reslen, PRIVUSE_VARIANT_PREFIX, uprv_min(len, capacity - reslen));
+ }
+ reslen += len;
+
+ if (reslen < capacity) {
+ tmpAppend[reslen++] = SEP;
+ }
+
+ firstValue = FALSE;
+ }
+
+ len = (int32_t)uprv_strlen(pPriv);
+ if (reslen < capacity) {
+ uprv_memcpy(tmpAppend + reslen, pPriv, uprv_min(len, capacity - reslen));
+ }
+ reslen += len;
+ }
+ }
+ /* reset private use starting position */
+ pPriv = NULL;
+ } else if (pPriv == NULL) {
+ pPriv = p;
+ }
+ p++;
+ }
+
+ if (U_FAILURE(*status)) {
+ return;
+ }
+ }
+
+ if (U_SUCCESS(*status)) {
+ len = reslen;
+ sink.Append(tmpAppend, len);
+ }
+}
+
+/*
+* -------------------------------------------------
+*
+* ultag_ functions
+*
+* -------------------------------------------------
+*/
+
+/* Bit flags used by the parser */
+#define LANG 0x0001
+#define EXTL 0x0002
+#define SCRT 0x0004
+#define REGN 0x0008
+#define VART 0x0010
+#define EXTS 0x0020
+#define EXTV 0x0040
+#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.
+ */
+#if (defined(_MSC_VER) && (_MSC_VER >= 1900) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 190024210))
+#pragma optimize( "", off )
+#endif
+
+static ULanguageTag*
+ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* status) {
+ char *tagBuf;
+ int16_t next;
+ char *pSubtag, *pNext, *pLastGoodPosition;
+ int32_t subtagLen;
+ int32_t extlangIdx;
+ ExtensionListEntry *pExtension;
+ char *pExtValueSubtag, *pExtValueSubtagEnd;
+ int32_t i;
+ UBool privateuseVar = FALSE;
+ int32_t grandfatheredLen = 0;
+
+ if (parsedLen != NULL) {
+ *parsedLen = 0;
+ }
+
+ if (U_FAILURE(*status)) {
+ return NULL;
+ }
+
+ if (tagLen < 0) {
+ tagLen = (int32_t)uprv_strlen(tag);
+ }
+
+ /* copy the entire string */
+ tagBuf = (char*)uprv_malloc(tagLen + 1);
+ if (tagBuf == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+ uprv_memcpy(tagBuf, tag, tagLen);
+ *(tagBuf + tagLen) = 0;
+
+ /* create a ULanguageTag */
+ icu::LocalULanguageTagPointer t(
+ (ULanguageTag*)uprv_malloc(sizeof(ULanguageTag)));
+ if (t.isNull()) {
+ uprv_free(tagBuf);
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+ _initializeULanguageTag(t.getAlias());
+ t->buf = tagBuf;
+
+ if (tagLen < MINLEN) {
+ /* the input tag is too short - return empty ULanguageTag */
+ return t.orphan();
+ }
+
+ size_t parsedLenDelta = 0;
+ // Grandfathered tag will be consider together. Grandfathered 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) {
+ continue;
+ }
+ if (tagLen > checkGrandfatheredLen && tagBuf[checkGrandfatheredLen] != '-') {
+ // make sure next char is '-'.
+ continue;
+ }
+ if (uprv_strnicmp(GRANDFATHERED[i], tagBuf, checkGrandfatheredLen) == 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;
+ if (tagLen < newTagLength) {
+ uprv_free(tagBuf);
+ tagBuf = (char*)uprv_malloc(newTagLength + 1);
+ if (tagBuf == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+ 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);
+ }
+ break;
+ }
+ }
+
+ if (grandfatheredLen == 0) {
+ for (i = 0; i < UPRV_LENGTHOF(REDUNDANT); i += 2) {
+ const char* redundantTag = REDUNDANT[i];
+ size_t redundantTagLen = uprv_strlen(redundantTag);
+ // The preferred tag for a redundant tag is always shorter than redundant
+ // tag. A redundant tag may or may not be followed by other subtags.
+ // (i.e. "zh-yue" or "zh-yue-u-co-pinyin").
+ if (uprv_strnicmp(redundantTag, tagBuf, static_cast<uint32_t>(redundantTagLen)) == 0) {
+ const char* redundantTagEnd = tagBuf + redundantTagLen;
+ if (*redundantTagEnd == '\0' || *redundantTagEnd == SEP) {
+ const char* preferredTag = REDUNDANT[i + 1];
+ size_t preferredTagLen = uprv_strlen(preferredTag);
+ uprv_strncpy(t->buf, preferredTag, preferredTagLen);
+ if (*redundantTagEnd == SEP) {
+ uprv_memmove(tagBuf + preferredTagLen,
+ redundantTagEnd,
+ tagLen - redundantTagLen + 1);
+ } else {
+ tagBuf[preferredTagLen] = '\0';
+ }
+ // parsedLen should be the length of the input
+ // before redundantTag is replaced by preferredTag.
+ // Save the delta to add it back later.
+ parsedLenDelta = redundantTagLen - preferredTagLen;
+ break;
+ }
+ }
+ }
+ }
+
+ /*
+ * langtag = language
+ * ["-" script]
+ * ["-" region]
+ * *("-" variant)
+ * *("-" extension)
+ * ["-" privateuse]
+ */
+
+ next = LANG | PRIV;
+ pNext = pLastGoodPosition = tagBuf;
+ extlangIdx = 0;
+ pExtension = NULL;
+ pExtValueSubtag = NULL;
+ pExtValueSubtagEnd = NULL;
+
+ while (pNext) {
+ char *pSep;
+
+ pSubtag = pNext;
+
+ /* locate next separator char */
+ pSep = pSubtag;
+ while (*pSep) {
+ if (*pSep == SEP) {
+ break;
+ }
+ pSep++;
+ }
+ if (*pSep == 0) {
+ /* last subtag */
+ pNext = NULL;
+ } else {
+ pNext = pSep + 1;
+ }
+ subtagLen = (int32_t)(pSep - pSubtag);
+
+ if (next & LANG) {
+ if (ultag_isLanguageSubtag(pSubtag, subtagLen)) {
+ *pSep = 0; /* terminate */
+ // TODO: move deprecated language code handling here.
+ t->language = T_CString_toLowerCase(pSubtag);
+
+ pLastGoodPosition = pSep;
+ next = SCRT | REGN | VART | EXTS | PRIV;
+ if (subtagLen <= 3)
+ next |= EXTL;
+ continue;
+ }
+ }
+ if (next & EXTL) {
+ if (_isExtlangSubtag(pSubtag, subtagLen)) {
+ *pSep = 0;
+ t->extlang[extlangIdx++] = T_CString_toLowerCase(pSubtag);
+
+ pLastGoodPosition = pSep;
+ if (extlangIdx < 3) {
+ next = EXTL | SCRT | REGN | VART | EXTS | PRIV;
+ } else {
+ next = SCRT | REGN | VART | EXTS | PRIV;
+ }
+ continue;
+ }
+ }
+ if (next & SCRT) {
+ if (ultag_isScriptSubtag(pSubtag, subtagLen)) {
+ char *p = pSubtag;
+
+ *pSep = 0;
+
+ /* to title case */
+ *p = uprv_toupper(*p);
+ p++;
+ for (; *p; p++) {
+ *p = uprv_tolower(*p);
+ }
+
+ t->script = pSubtag;
+
+ pLastGoodPosition = pSep;
+ next = REGN | VART | EXTS | PRIV;
+ continue;
+ }
+ }
+ if (next & REGN) {
+ if (ultag_isRegionSubtag(pSubtag, subtagLen)) {
+ *pSep = 0;
+ // TODO: move deprecated region code handling here.
+ t->region = T_CString_toUpperCase(pSubtag);
+
+ pLastGoodPosition = pSep;
+ next = VART | EXTS | PRIV;
+ continue;
+ }
+ }
+ if (next & VART) {
+ if (_isVariantSubtag(pSubtag, subtagLen) ||
+ (privateuseVar && _isPrivateuseVariantSubtag(pSubtag, subtagLen))) {
+ VariantListEntry *var;
+ UBool isAdded;
+
+ var = (VariantListEntry*)uprv_malloc(sizeof(VariantListEntry));
+ if (var == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+ *pSep = 0;
+ var->variant = T_CString_toUpperCase(pSubtag);
+ isAdded = _addVariantToList(&(t->variants), var);
+ if (!isAdded) {
+ /* duplicated variant entry */
+ uprv_free(var);
+ break;
+ }
+ pLastGoodPosition = pSep;
+ next = VART | EXTS | PRIV;
+ continue;
+ }
+ }
+ if (next & EXTS) {
+ if (_isExtensionSingleton(pSubtag, subtagLen)) {
+ if (pExtension != NULL) {
+ if (pExtValueSubtag == NULL || pExtValueSubtagEnd == NULL) {
+ /* the previous extension is incomplete */
+ uprv_free(pExtension);
+ pExtension = NULL;
+ break;
+ }
+
+ /* terminate the previous extension value */
+ *pExtValueSubtagEnd = 0;
+ pExtension->value = T_CString_toLowerCase(pExtValueSubtag);
+
+ /* insert the extension to the list */
+ if (_addExtensionToList(&(t->extensions), pExtension, FALSE)) {
+ pLastGoodPosition = pExtValueSubtagEnd;
+ } else {
+ /* stop parsing here */
+ uprv_free(pExtension);
+ pExtension = NULL;
+ break;
+ }
+ }
+
+ /* create a new extension */
+ pExtension = (ExtensionListEntry*)uprv_malloc(sizeof(ExtensionListEntry));
+ if (pExtension == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+ *pSep = 0;
+ pExtension->key = T_CString_toLowerCase(pSubtag);
+ pExtension->value = NULL; /* will be set later */
+
+ /*
+ * reset the start and the end location of extension value
+ * subtags for this extension
+ */
+ pExtValueSubtag = NULL;
+ pExtValueSubtagEnd = NULL;
+
+ next = EXTV;
+ continue;
+ }
+ }
+ if (next & EXTV) {
+ if (_isExtensionSubtag(pSubtag, subtagLen)) {
+ if (pExtValueSubtag == NULL) {
+ /* if the start postion of this extension's value is not yet,
+ this one is the first value subtag */
+ pExtValueSubtag = pSubtag;
+ }
+
+ /* Mark the end of this subtag */
+ pExtValueSubtagEnd = pSep;
+ next = EXTS | EXTV | PRIV;
+
+ continue;
+ }
+ }
+ if (next & PRIV) {
+ if (uprv_tolower(*pSubtag) == PRIVATEUSE && subtagLen == 1) {
+ char *pPrivuseVal;
+
+ if (pExtension != NULL) {
+ /* Process the last extension */
+ if (pExtValueSubtag == NULL || pExtValueSubtagEnd == NULL) {
+ /* the previous extension is incomplete */
+ uprv_free(pExtension);
+ pExtension = NULL;
+ break;
+ } else {
+ /* terminate the previous extension value */
+ *pExtValueSubtagEnd = 0;
+ pExtension->value = T_CString_toLowerCase(pExtValueSubtag);
+
+ /* insert the extension to the list */
+ if (_addExtensionToList(&(t->extensions), pExtension, FALSE)) {
+ pLastGoodPosition = pExtValueSubtagEnd;
+ pExtension = NULL;
+ } else {
+ /* stop parsing here */
+ uprv_free(pExtension);
+ pExtension = NULL;
+ break;
+ }
+ }
+ }
+
+ /* The rest of part will be private use value subtags */
+ if (pNext == NULL) {
+ /* empty private use subtag */
+ break;
+ }
+ /* back up the private use value start position */
+ pPrivuseVal = pNext;
+
+ /* validate private use value subtags */
+ while (pNext) {
+ pSubtag = pNext;
+ pSep = pSubtag;
+ while (*pSep) {
+ if (*pSep == SEP) {
+ break;
+ }
+ pSep++;
+ }
+ if (*pSep == 0) {
+ /* last subtag */
+ pNext = NULL;
+ } else {
+ pNext = pSep + 1;
+ }
+ subtagLen = (int32_t)(pSep - pSubtag);
+
+ if (uprv_strncmp(pSubtag, PRIVUSE_VARIANT_PREFIX, uprv_strlen(PRIVUSE_VARIANT_PREFIX)) == 0) {
+ *pSep = 0;
+ next = VART;
+ privateuseVar = TRUE;
+ break;
+ } else if (_isPrivateuseValueSubtag(pSubtag, subtagLen)) {
+ pLastGoodPosition = pSep;
+ } else {
+ break;
+ }
+ }
+
+ if (next == VART) {
+ continue;
+ }
+
+ if (pLastGoodPosition - pPrivuseVal > 0) {
+ *pLastGoodPosition = 0;
+ t->privateuse = T_CString_toLowerCase(pPrivuseVal);
+ }
+ /* No more subtags, exiting the parse loop */
+ break;
+ }
+ break;
+ }
+
+ /* If we fell through here, it means this subtag is illegal - quit parsing */
+ break;
+ }
+
+ if (pExtension != NULL) {
+ /* Process the last extension */
+ if (pExtValueSubtag == NULL || pExtValueSubtagEnd == NULL) {
+ /* the previous extension is incomplete */
+ uprv_free(pExtension);
+ } else {
+ /* terminate the previous extension value */
+ *pExtValueSubtagEnd = 0;
+ pExtension->value = T_CString_toLowerCase(pExtValueSubtag);
+ /* insert the extension to the list */
+ if (_addExtensionToList(&(t->extensions), pExtension, FALSE)) {
+ pLastGoodPosition = pExtValueSubtagEnd;
+ } else {
+ uprv_free(pExtension);
+ }
+ }
+ }
+
+ if (parsedLen != NULL) {
+ *parsedLen = (int32_t)(pLastGoodPosition - t->buf + parsedLenDelta);
+ }
+
+ return t.orphan();
+}
+
+/**
+* Ticket #12705 - Turn optimization back on.
+*/
+#if (defined(_MSC_VER) && (_MSC_VER >= 1900) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 190024210))
+#pragma optimize( "", on )
+#endif
+
+static void
+ultag_close(ULanguageTag* langtag) {
+
+ if (langtag == NULL) {
+ return;
+ }
+
+ uprv_free(langtag->buf);
+
+ if (langtag->variants) {
+ VariantListEntry *curVar = langtag->variants;
+ while (curVar) {
+ VariantListEntry *nextVar = curVar->next;
+ uprv_free(curVar);
+ curVar = nextVar;
+ }
+ }
+
+ if (langtag->extensions) {
+ ExtensionListEntry *curExt = langtag->extensions;
+ while (curExt) {
+ ExtensionListEntry *nextExt = curExt->next;
+ uprv_free(curExt);
+ curExt = nextExt;
+ }
+ }
+
+ uprv_free(langtag);
+}
+
+static const char*
+ultag_getLanguage(const ULanguageTag* langtag) {
+ return langtag->language;
+}
+
+#if 0
+static const char*
+ultag_getJDKLanguage(const ULanguageTag* langtag) {
+ int32_t i;
+ for (i = 0; DEPRECATEDLANGS[i] != NULL; i += 2) {
+ if (uprv_compareInvCharsAsAscii(DEPRECATEDLANGS[i], langtag->language) == 0) {
+ return DEPRECATEDLANGS[i + 1];
+ }
+ }
+ return langtag->language;
+}
+#endif
+
+static const char*
+ultag_getExtlang(const ULanguageTag* langtag, int32_t idx) {
+ if (idx >= 0 && idx < MAXEXTLANG) {
+ return langtag->extlang[idx];
+ }
+ return NULL;
+}
+
+static int32_t
+ultag_getExtlangSize(const ULanguageTag* langtag) {
+ int32_t size = 0;
+ int32_t i;
+ for (i = 0; i < MAXEXTLANG; i++) {
+ if (langtag->extlang[i]) {
+ size++;
+ }
+ }
+ return size;
+}
+
+static const char*
+ultag_getScript(const ULanguageTag* langtag) {
+ return langtag->script;
+}
+
+static const char*
+ultag_getRegion(const ULanguageTag* langtag) {
+ return langtag->region;
+}
+
+static const char*
+ultag_getVariant(const ULanguageTag* langtag, int32_t idx) {
+ const char *var = NULL;
+ VariantListEntry *cur = langtag->variants;
+ int32_t i = 0;
+ while (cur) {
+ if (i == idx) {
+ var = cur->variant;
+ break;
+ }
+ cur = cur->next;
+ i++;
+ }
+ return var;
+}
+
+static int32_t
+ultag_getVariantsSize(const ULanguageTag* langtag) {
+ int32_t size = 0;
+ VariantListEntry *cur = langtag->variants;
+ while (TRUE) {
+ if (cur == NULL) {
+ break;
+ }
+ size++;
+ cur = cur->next;
+ }
+ return size;
+}
+
+static const char*
+ultag_getExtensionKey(const ULanguageTag* langtag, int32_t idx) {
+ const char *key = NULL;
+ ExtensionListEntry *cur = langtag->extensions;
+ int32_t i = 0;
+ while (cur) {
+ if (i == idx) {
+ key = cur->key;
+ break;
+ }
+ cur = cur->next;
+ i++;
+ }
+ return key;
+}
+
+static const char*
+ultag_getExtensionValue(const ULanguageTag* langtag, int32_t idx) {
+ const char *val = NULL;
+ ExtensionListEntry *cur = langtag->extensions;
+ int32_t i = 0;
+ while (cur) {
+ if (i == idx) {
+ val = cur->value;
+ break;
+ }
+ cur = cur->next;
+ i++;
+ }
+ return val;
+}
+
+static int32_t
+ultag_getExtensionsSize(const ULanguageTag* langtag) {
+ int32_t size = 0;
+ ExtensionListEntry *cur = langtag->extensions;
+ while (TRUE) {
+ if (cur == NULL) {
+ break;
+ }
+ size++;
+ cur = cur->next;
+ }
+ return size;
+}
+
+static const char*
+ultag_getPrivateUse(const ULanguageTag* langtag) {
+ return langtag->privateuse;
+}
+
+#if 0
+static const char*
+ultag_getGrandfathered(const ULanguageTag* langtag) {
+ return langtag->grandfathered;
+}
+#endif
+
+
+/*
+* -------------------------------------------------
+*
+* Locale/BCP47 conversion APIs, exposed as uloc_*
+*
+* -------------------------------------------------
+*/
+U_CAPI int32_t U_EXPORT2
+uloc_toLanguageTag(const char* localeID,
+ char* langtag,
+ int32_t langtagCapacity,
+ UBool strict,
+ UErrorCode* status) {
+ if (U_FAILURE(*status)) {
+ return 0;
+ }
+
+ icu::CheckedArrayByteSink sink(langtag, langtagCapacity);
+ ulocimp_toLanguageTag(localeID, sink, strict, status);
+
+ int32_t reslen = sink.NumberOfBytesAppended();
+
+ if (U_FAILURE(*status)) {
+ return reslen;
+ }
+
+ if (sink.Overflowed()) {
+ *status = U_BUFFER_OVERFLOW_ERROR;
+ } else {
+ u_terminateChars(langtag, langtagCapacity, reslen, status);
+ }
+
+ return reslen;
+}
+
+
+U_CAPI void U_EXPORT2
+ulocimp_toLanguageTag(const char* localeID,
+ icu::ByteSink& sink,
+ UBool strict,
+ UErrorCode* status) {
+ icu::CharString canonical;
+ int32_t reslen;
+ UErrorCode tmpStatus = U_ZERO_ERROR;
+ UBool hadPosix = FALSE;
+ const char* pKeywordStart;
+
+ /* Note: uloc_canonicalize returns "en_US_POSIX" for input locale ID "". See #6835 */
+ int32_t resultCapacity = static_cast<int32_t>(uprv_strlen(localeID));
+ if (resultCapacity > 0) {
+ char* buffer;
+
+ for (;;) {
+ buffer = canonical.getAppendBuffer(
+ /*minCapacity=*/resultCapacity,
+ /*desiredCapacityHint=*/resultCapacity,
+ resultCapacity,
+ tmpStatus);
+
+ if (U_FAILURE(tmpStatus)) {
+ *status = tmpStatus;
+ return;
+ }
+
+ reslen =
+ uloc_canonicalize(localeID, buffer, resultCapacity, &tmpStatus);
+
+ if (tmpStatus != U_BUFFER_OVERFLOW_ERROR) {
+ break;
+ }
+
+ resultCapacity = reslen;
+ tmpStatus = U_ZERO_ERROR;
+ }
+
+ if (U_FAILURE(tmpStatus)) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ canonical.append(buffer, reslen, tmpStatus);
+ if (tmpStatus == U_STRING_NOT_TERMINATED_WARNING) {
+ tmpStatus = U_ZERO_ERROR; // Terminators provided by CharString.
+ }
+
+ if (U_FAILURE(tmpStatus)) {
+ *status = tmpStatus;
+ return;
+ }
+ }
+
+ /* For handling special case - private use only tag */
+ pKeywordStart = locale_getKeywordsStart(canonical.data());
+ if (pKeywordStart == canonical.data()) {
+ int kwdCnt = 0;
+ UBool done = FALSE;
+
+ icu::LocalUEnumerationPointer kwdEnum(uloc_openKeywords(canonical.data(), &tmpStatus));
+ if (U_SUCCESS(tmpStatus)) {
+ kwdCnt = uenum_count(kwdEnum.getAlias(), &tmpStatus);
+ if (kwdCnt == 1) {
+ const char *key;
+ int32_t len = 0;
+
+ 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);
+ if (U_SUCCESS(tmpStatus)) {
+ if (ultag_isPrivateuseValueSubtags(&buf[2], len)) {
+ /* return private use only tag */
+ sink.Append(buf, len + 2);
+ done = TRUE;
+ } else if (strict) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ done = TRUE;
+ }
+ /* if not strict mode, then "und" will be returned */
+ } else {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ done = TRUE;
+ }
+ }
+ }
+ if (done) {
+ return;
+ }
+ }
+ }
+
+ _appendLanguageToLanguageTag(canonical.data(), sink, strict, status);
+ _appendScriptToLanguageTag(canonical.data(), sink, strict, status);
+ _appendRegionToLanguageTag(canonical.data(), sink, strict, status);
+ _appendVariantsToLanguageTag(canonical.data(), sink, strict, &hadPosix, status);
+ _appendKeywordsToLanguageTag(canonical.data(), sink, strict, hadPosix, status);
+ _appendPrivateuseToLanguageTag(canonical.data(), sink, strict, hadPosix, status);
+}
+
+
+U_CAPI int32_t U_EXPORT2
+uloc_forLanguageTag(const char* langtag,
+ char* localeID,
+ int32_t localeIDCapacity,
+ int32_t* parsedLength,
+ UErrorCode* status) {
+ if (U_FAILURE(*status)) {
+ return 0;
+ }
+
+ icu::CheckedArrayByteSink sink(localeID, localeIDCapacity);
+ ulocimp_forLanguageTag(langtag, -1, sink, parsedLength, status);
+
+ int32_t reslen = sink.NumberOfBytesAppended();
+
+ if (U_FAILURE(*status)) {
+ return reslen;
+ }
+
+ if (sink.Overflowed()) {
+ *status = U_BUFFER_OVERFLOW_ERROR;
+ } else {
+ u_terminateChars(localeID, localeIDCapacity, reslen, status);
+ }
+
+ return reslen;
+}
+
+
+U_CAPI void U_EXPORT2
+ulocimp_forLanguageTag(const char* langtag,
+ int32_t tagLen,
+ icu::ByteSink& sink,
+ int32_t* parsedLength,
+ UErrorCode* status) {
+ UBool isEmpty = TRUE;
+ const char *subtag, *p;
+ int32_t len;
+ int32_t i, n;
+ UBool noRegion = TRUE;
+
+ icu::LocalULanguageTagPointer lt(ultag_parse(langtag, tagLen, parsedLength, status));
+ if (U_FAILURE(*status)) {
+ return;
+ }
+
+ /* language */
+ subtag = ultag_getExtlangSize(lt.getAlias()) > 0 ? ultag_getExtlang(lt.getAlias(), 0) : ultag_getLanguage(lt.getAlias());
+ if (uprv_compareInvCharsAsAscii(subtag, LANG_UND) != 0) {
+ len = (int32_t)uprv_strlen(subtag);
+ if (len > 0) {
+ sink.Append(subtag, len);
+ isEmpty = FALSE;
+ }
+ }
+
+ /* script */
+ subtag = ultag_getScript(lt.getAlias());
+ len = (int32_t)uprv_strlen(subtag);
+ if (len > 0) {
+ sink.Append("_", 1);
+ isEmpty = FALSE;
+
+ /* write out the script in title case */
+ char c = uprv_toupper(*subtag);
+ sink.Append(&c, 1);
+ sink.Append(subtag + 1, len - 1);
+ }
+
+ /* region */
+ subtag = ultag_getRegion(lt.getAlias());
+ len = (int32_t)uprv_strlen(subtag);
+ if (len > 0) {
+ sink.Append("_", 1);
+ isEmpty = FALSE;
+
+ /* write out the region in upper case */
+ p = subtag;
+ while (*p) {
+ char c = uprv_toupper(*p);
+ sink.Append(&c, 1);
+ p++;
+ }
+ noRegion = FALSE;
+ }
+
+ /* variants */
+ _sortVariants(lt.getAlias()->variants);
+ n = ultag_getVariantsSize(lt.getAlias());
+ if (n > 0) {
+ if (noRegion) {
+ sink.Append("_", 1);
+ isEmpty = FALSE;
+ }
+
+ for (i = 0; i < n; i++) {
+ subtag = ultag_getVariant(lt.getAlias(), i);
+ sink.Append("_", 1);
+
+ /* write out the variant in upper case */
+ p = subtag;
+ while (*p) {
+ char c = uprv_toupper(*p);
+ sink.Append(&c, 1);
+ p++;
+ }
+ }
+ }
+
+ /* keywords */
+ n = ultag_getExtensionsSize(lt.getAlias());
+ subtag = ultag_getPrivateUse(lt.getAlias());
+ if (n > 0 || uprv_strlen(subtag) > 0) {
+ if (isEmpty && n > 0) {
+ /* need a language */
+ sink.Append(LANG_UND, LANG_UND_LEN);
+ }
+ _appendKeywords(lt.getAlias(), sink, status);
+ }
+}
diff --git a/contrib/libs/icu/common/ulocimp.h b/contrib/libs/icu/common/ulocimp.h
index ed45b5add5..b9e2eb4bfe 100644
--- a/contrib/libs/icu/common/ulocimp.h
+++ b/contrib/libs/icu/common/ulocimp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -10,7 +10,7 @@
#ifndef ULOCIMP_H
#define ULOCIMP_H
-#include "unicode/bytestream.h"
+#include "unicode/bytestream.h"
#include "unicode/uloc.h"
/**
@@ -62,76 +62,76 @@ ulocimp_getCountry(const char *localeID,
char *country, int32_t countryCapacity,
const char **pEnd);
-U_STABLE void U_EXPORT2
-ulocimp_getName(const char* localeID,
- icu::ByteSink& sink,
- UErrorCode* err);
-
-U_STABLE void U_EXPORT2
-ulocimp_getBaseName(const char* localeID,
- icu::ByteSink& sink,
- UErrorCode* err);
-
-U_STABLE void U_EXPORT2
-ulocimp_canonicalize(const char* localeID,
- icu::ByteSink& sink,
- UErrorCode* err);
-
+U_STABLE void U_EXPORT2
+ulocimp_getName(const char* localeID,
+ icu::ByteSink& sink,
+ UErrorCode* err);
+
+U_STABLE void U_EXPORT2
+ulocimp_getBaseName(const char* localeID,
+ icu::ByteSink& sink,
+ UErrorCode* err);
+
+U_STABLE void U_EXPORT2
+ulocimp_canonicalize(const char* localeID,
+ icu::ByteSink& sink,
+ UErrorCode* err);
+
+/**
+ * Writes a well-formed language tag for this locale ID.
+ *
+ * **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
+ * fields do not satisfy the BCP47 syntax requirement.
+ *
+ * @param localeID the input locale ID
+ * @param sink the output sink receiving the BCP47 language
+ * tag for this Locale.
+ * @param strict boolean value indicating if the function returns
+ * an error for an ill-formed input locale ID.
+ * @param err error information if receiving the language
+ * tag failed.
+ * @return The length of the BCP47 language tag.
+ *
+ * @internal ICU 64
+ */
+U_STABLE void U_EXPORT2
+ulocimp_toLanguageTag(const char* localeID,
+ icu::ByteSink& sink,
+ UBool strict,
+ UErrorCode* err);
+
+/**
+ * Returns a locale ID for the specified BCP47 language tag string.
+ * 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
+ * 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
+ * specified BCP47 language tag.
+ * @param parsedLength if not NULL, successfully parsed length
+ * for the input language tag is set.
+ * @param err error information if receiving the locald ID
+ * failed.
+ * @internal ICU 63
+ */
+U_CAPI void U_EXPORT2
+ulocimp_forLanguageTag(const char* langtag,
+ int32_t tagLen,
+ icu::ByteSink& sink,
+ int32_t* parsedLength,
+ UErrorCode* err);
+
/**
- * Writes a well-formed language tag for this locale ID.
- *
- * **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
- * fields do not satisfy the BCP47 syntax requirement.
- *
- * @param localeID the input locale ID
- * @param sink the output sink receiving the BCP47 language
- * tag for this Locale.
- * @param strict boolean value indicating if the function returns
- * an error for an ill-formed input locale ID.
- * @param err error information if receiving the language
- * tag failed.
- * @return The length of the BCP47 language tag.
- *
- * @internal ICU 64
- */
-U_STABLE void U_EXPORT2
-ulocimp_toLanguageTag(const char* localeID,
- icu::ByteSink& sink,
- UBool strict,
- UErrorCode* err);
-
-/**
- * Returns a locale ID for the specified BCP47 language tag string.
- * 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
- * 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
- * specified BCP47 language tag.
- * @param parsedLength if not NULL, successfully parsed length
- * for the input language tag is set.
- * @param err error information if receiving the locald ID
- * failed.
- * @internal ICU 63
- */
-U_CAPI void U_EXPORT2
-ulocimp_forLanguageTag(const char* langtag,
- int32_t tagLen,
- icu::ByteSink& sink,
- int32_t* parsedLength,
- UErrorCode* err);
-
-/**
* 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
@@ -160,113 +160,113 @@ U_CAPI int32_t U_EXPORT2
ulocimp_getRegionForSupplementalData(const char *localeID, UBool inferRegion,
char *region, int32_t regionCapacity, UErrorCode* status);
-/**
- * Add the likely subtags for a provided locale ID, per the algorithm described
- * in the following CLDR technical report:
- *
- * http://www.unicode.org/reports/tr35/#Likely_Subtags
- *
- * If localeID is already in the maximal form, or there is no data available
- * for maximization, it will be copied to the output buffer. For example,
- * "und-Zzzz" cannot be maximized, since there is no reasonable maximization.
- *
- * Examples:
- *
- * "en" maximizes to "en_Latn_US"
- *
- * "de" maximizes to "de_Latn_US"
- *
- * "sr" maximizes to "sr_Cyrl_RS"
- *
- * "sh" maximizes to "sr_Latn_RS" (Note this will not reverse.)
- *
- * "zh_Hani" maximizes to "zh_Hans_CN" (Note this will not reverse.)
- *
- * @param localeID The locale to maximize
- * @param sink The output sink receiving the maximized locale
- * @param err Error information if maximizing the locale failed. If the length
- * of the localeID and the null-terminator is greater than the maximum allowed size,
- * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR.
- * @internal ICU 64
- */
-U_STABLE void U_EXPORT2
-ulocimp_addLikelySubtags(const char* localeID,
- icu::ByteSink& sink,
- UErrorCode* err);
-
-/**
- * Minimize the subtags for a provided locale ID, per the algorithm described
- * in the following CLDR technical report:
- *
- * http://www.unicode.org/reports/tr35/#Likely_Subtags
- *
- * If localeID is already in the minimal form, or there is no data available
- * for minimization, it will be copied to the output buffer. Since the
- * minimization algorithm relies on proper maximization, see the comments
- * for ulocimp_addLikelySubtags for reasons why there might not be any data.
- *
- * Examples:
- *
- * "en_Latn_US" minimizes to "en"
- *
- * "de_Latn_US" minimizes to "de"
- *
- * "sr_Cyrl_RS" minimizes to "sr"
- *
- * "zh_Hant_TW" minimizes to "zh_TW" (The region is preferred to the
- * script, and minimizing to "zh" would imply "zh_Hans_CN".)
- *
- * @param localeID The locale to minimize
- * @param sink The output sink receiving the maximized locale
- * @param err Error information if minimizing the locale failed. If the length
- * of the localeID and the null-terminator is greater than the maximum allowed size,
- * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR.
- * @internal ICU 64
- */
-U_STABLE void U_EXPORT2
-ulocimp_minimizeSubtags(const char* localeID,
- icu::ByteSink& sink,
- UErrorCode* err);
-
+/**
+ * Add the likely subtags for a provided locale ID, per the algorithm described
+ * in the following CLDR technical report:
+ *
+ * http://www.unicode.org/reports/tr35/#Likely_Subtags
+ *
+ * If localeID is already in the maximal form, or there is no data available
+ * for maximization, it will be copied to the output buffer. For example,
+ * "und-Zzzz" cannot be maximized, since there is no reasonable maximization.
+ *
+ * Examples:
+ *
+ * "en" maximizes to "en_Latn_US"
+ *
+ * "de" maximizes to "de_Latn_US"
+ *
+ * "sr" maximizes to "sr_Cyrl_RS"
+ *
+ * "sh" maximizes to "sr_Latn_RS" (Note this will not reverse.)
+ *
+ * "zh_Hani" maximizes to "zh_Hans_CN" (Note this will not reverse.)
+ *
+ * @param localeID The locale to maximize
+ * @param sink The output sink receiving the maximized locale
+ * @param err Error information if maximizing the locale failed. If the length
+ * of the localeID and the null-terminator is greater than the maximum allowed size,
+ * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR.
+ * @internal ICU 64
+ */
+U_STABLE void U_EXPORT2
+ulocimp_addLikelySubtags(const char* localeID,
+ icu::ByteSink& sink,
+ UErrorCode* err);
+
+/**
+ * Minimize the subtags for a provided locale ID, per the algorithm described
+ * in the following CLDR technical report:
+ *
+ * http://www.unicode.org/reports/tr35/#Likely_Subtags
+ *
+ * If localeID is already in the minimal form, or there is no data available
+ * for minimization, it will be copied to the output buffer. Since the
+ * minimization algorithm relies on proper maximization, see the comments
+ * for ulocimp_addLikelySubtags for reasons why there might not be any data.
+ *
+ * Examples:
+ *
+ * "en_Latn_US" minimizes to "en"
+ *
+ * "de_Latn_US" minimizes to "de"
+ *
+ * "sr_Cyrl_RS" minimizes to "sr"
+ *
+ * "zh_Hant_TW" minimizes to "zh_TW" (The region is preferred to the
+ * script, and minimizing to "zh" would imply "zh_Hans_CN".)
+ *
+ * @param localeID The locale to minimize
+ * @param sink The output sink receiving the maximized locale
+ * @param err Error information if minimizing the locale failed. If the length
+ * of the localeID and the null-terminator is greater than the maximum allowed size,
+ * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR.
+ * @internal ICU 64
+ */
+U_STABLE void U_EXPORT2
+ulocimp_minimizeSubtags(const char* localeID,
+ icu::ByteSink& sink,
+ UErrorCode* err);
+
U_CAPI const char * U_EXPORT2
locale_getKeywordsStart(const char *localeID);
-U_CFUNC UBool
-ultag_isExtensionSubtags(const char* s, int32_t len);
+U_CFUNC UBool
+ultag_isExtensionSubtags(const char* s, int32_t len);
+
+U_CFUNC UBool
+ultag_isLanguageSubtag(const char* s, int32_t len);
+
+U_CFUNC UBool
+ultag_isPrivateuseValueSubtags(const char* s, int32_t len);
+
+U_CFUNC UBool
+ultag_isRegionSubtag(const char* s, int32_t len);
+
+U_CFUNC UBool
+ultag_isScriptSubtag(const char* s, int32_t len);
+
+U_CFUNC UBool
+ultag_isTransformedExtensionSubtags(const char* s, int32_t len);
+
+U_CFUNC UBool
+ultag_isUnicodeExtensionSubtags(const char* s, int32_t len);
+
+U_CFUNC UBool
+ultag_isUnicodeLocaleAttribute(const char* s, int32_t len);
+
+U_CFUNC UBool
+ultag_isUnicodeLocaleAttributes(const char* s, int32_t len);
U_CFUNC UBool
-ultag_isLanguageSubtag(const char* s, int32_t len);
-
-U_CFUNC UBool
-ultag_isPrivateuseValueSubtags(const char* s, int32_t len);
-
-U_CFUNC UBool
-ultag_isRegionSubtag(const char* s, int32_t len);
-
-U_CFUNC UBool
-ultag_isScriptSubtag(const char* s, int32_t len);
-
-U_CFUNC UBool
-ultag_isTransformedExtensionSubtags(const char* s, int32_t len);
-
-U_CFUNC UBool
-ultag_isUnicodeExtensionSubtags(const char* s, int32_t len);
-
-U_CFUNC UBool
-ultag_isUnicodeLocaleAttribute(const char* s, int32_t len);
-
-U_CFUNC UBool
-ultag_isUnicodeLocaleAttributes(const char* s, int32_t len);
-
-U_CFUNC UBool
ultag_isUnicodeLocaleKey(const char* s, int32_t len);
U_CFUNC UBool
ultag_isUnicodeLocaleType(const char* s, int32_t len);
-U_CFUNC UBool
-ultag_isVariantSubtags(const char* s, int32_t len);
-
+U_CFUNC UBool
+ultag_isVariantSubtags(const char* s, int32_t len);
+
U_CFUNC const char*
ulocimp_toBcpKey(const char* key);
diff --git a/contrib/libs/icu/common/umapfile.cpp b/contrib/libs/icu/common/umapfile.cpp
index 2f495c83e5..3e714876a4 100644
--- a/contrib/libs/icu/common/umapfile.cpp
+++ b/contrib/libs/icu/common/umapfile.cpp
@@ -1,530 +1,530 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 1999-2013, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************/
-
-
-/*----------------------------------------------------------------------------
- *
- * Memory mapped file wrappers for use by the ICU Data Implementation
- * All of the platform-specific implementation for mapping data files
- * is here. The rest of the ICU Data implementation uses only the
- * wrapper functions.
- *
- *----------------------------------------------------------------------------*/
-/* Defines _XOPEN_SOURCE for access to POSIX functions.
- * Must be before any other #includes. */
-#include "uposixdefs.h"
-
-#include "unicode/putil.h"
-#include "unicode/ustring.h"
-#include "udatamem.h"
-#include "umapfile.h"
-
-/* memory-mapping base definitions ------------------------------------------ */
-
-#if MAP_IMPLEMENTATION==MAP_WIN32
-#ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-#endif
-# define VC_EXTRALEAN
-# define NOUSER
-# define NOSERVICE
-# define NOIME
-# define NOMCX
-
-# if U_PLATFORM_HAS_WINUWP_API == 1
- // Some previous versions of the Windows 10 SDK don't expose various APIs for UWP applications
- // to use, even though UWP apps are allowed to call and use them. Temporarily change the
- // WINAPI family partition below to Desktop, so that function declarations are visible for UWP.
-# include <winapifamily.h>
-# if !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM))
-# pragma push_macro("WINAPI_PARTITION_DESKTOP")
-# undef WINAPI_PARTITION_DESKTOP
-# define WINAPI_PARTITION_DESKTOP 1
-# define CHANGED_WINAPI_PARTITION_DESKTOP_VALUE
-# endif
-# endif
-
-# include <windows.h>
-
-# if U_PLATFORM_HAS_WINUWP_API == 1 && defined(CHANGED_WINAPI_PARTITION_DESKTOP_VALUE)
-# pragma pop_macro("WINAPI_PARTITION_DESKTOP")
-# endif
-
-# include "cmemory.h"
-
-typedef HANDLE MemoryMap;
-
-# define IS_MAP(map) ((map)!=nullptr)
-
-#elif MAP_IMPLEMENTATION==MAP_POSIX || MAP_IMPLEMENTATION==MAP_390DLL
- typedef size_t MemoryMap;
-
-# define IS_MAP(map) ((map)!=0)
-
-# include <unistd.h>
-# include <sys/mman.h>
-# include <sys/stat.h>
-# include <fcntl.h>
-
-# ifndef MAP_FAILED
-# define MAP_FAILED ((void*)-1)
-# endif
-
-# if MAP_IMPLEMENTATION==MAP_390DLL
- /* No memory mapping for 390 batch mode. Fake it using dll loading. */
-# include <dll.h>
-# include "cstring.h"
-# include "cmemory.h"
-# include "unicode/udata.h"
-# define LIB_PREFIX "lib"
-# define LIB_SUFFIX ".dll"
- /* This is inconvenient until we figure out what to do with U_ICUDATA_NAME in utypes.h */
-# define U_ICUDATA_ENTRY_NAME "icudt" U_ICU_VERSION_SHORT U_LIB_SUFFIX_C_NAME_STRING "_dat"
-# endif
-#elif MAP_IMPLEMENTATION==MAP_STDIO
-# include <stdio.h>
-# include "cmemory.h"
-
- typedef void *MemoryMap;
-
-# define IS_MAP(map) ((map)!=nullptr)
-#endif
-
-/*----------------------------------------------------------------------------*
- * *
- * Memory Mapped File support. Platform dependent implementation of *
- * functions used by the rest of the implementation.*
- * *
- *----------------------------------------------------------------------------*/
-#if MAP_IMPLEMENTATION==MAP_NONE
- U_CFUNC UBool
- uprv_mapFile(UDataMemory *pData, const char *path, UErrorCode *status) {
- if (U_FAILURE(*status)) {
- return FALSE;
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 1999-2013, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************/
+
+
+/*----------------------------------------------------------------------------
+ *
+ * Memory mapped file wrappers for use by the ICU Data Implementation
+ * All of the platform-specific implementation for mapping data files
+ * is here. The rest of the ICU Data implementation uses only the
+ * wrapper functions.
+ *
+ *----------------------------------------------------------------------------*/
+/* Defines _XOPEN_SOURCE for access to POSIX functions.
+ * Must be before any other #includes. */
+#include "uposixdefs.h"
+
+#include "unicode/putil.h"
+#include "unicode/ustring.h"
+#include "udatamem.h"
+#include "umapfile.h"
+
+/* memory-mapping base definitions ------------------------------------------ */
+
+#if MAP_IMPLEMENTATION==MAP_WIN32
+#ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
+# define VC_EXTRALEAN
+# define NOUSER
+# define NOSERVICE
+# define NOIME
+# define NOMCX
+
+# if U_PLATFORM_HAS_WINUWP_API == 1
+ // Some previous versions of the Windows 10 SDK don't expose various APIs for UWP applications
+ // to use, even though UWP apps are allowed to call and use them. Temporarily change the
+ // WINAPI family partition below to Desktop, so that function declarations are visible for UWP.
+# include <winapifamily.h>
+# if !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM))
+# pragma push_macro("WINAPI_PARTITION_DESKTOP")
+# undef WINAPI_PARTITION_DESKTOP
+# define WINAPI_PARTITION_DESKTOP 1
+# define CHANGED_WINAPI_PARTITION_DESKTOP_VALUE
+# endif
+# endif
+
+# include <windows.h>
+
+# if U_PLATFORM_HAS_WINUWP_API == 1 && defined(CHANGED_WINAPI_PARTITION_DESKTOP_VALUE)
+# pragma pop_macro("WINAPI_PARTITION_DESKTOP")
+# endif
+
+# include "cmemory.h"
+
+typedef HANDLE MemoryMap;
+
+# define IS_MAP(map) ((map)!=nullptr)
+
+#elif MAP_IMPLEMENTATION==MAP_POSIX || MAP_IMPLEMENTATION==MAP_390DLL
+ typedef size_t MemoryMap;
+
+# define IS_MAP(map) ((map)!=0)
+
+# include <unistd.h>
+# include <sys/mman.h>
+# include <sys/stat.h>
+# include <fcntl.h>
+
+# ifndef MAP_FAILED
+# define MAP_FAILED ((void*)-1)
+# endif
+
+# if MAP_IMPLEMENTATION==MAP_390DLL
+ /* No memory mapping for 390 batch mode. Fake it using dll loading. */
+# include <dll.h>
+# include "cstring.h"
+# include "cmemory.h"
+# include "unicode/udata.h"
+# define LIB_PREFIX "lib"
+# define LIB_SUFFIX ".dll"
+ /* This is inconvenient until we figure out what to do with U_ICUDATA_NAME in utypes.h */
+# define U_ICUDATA_ENTRY_NAME "icudt" U_ICU_VERSION_SHORT U_LIB_SUFFIX_C_NAME_STRING "_dat"
+# endif
+#elif MAP_IMPLEMENTATION==MAP_STDIO
+# include <stdio.h>
+# include "cmemory.h"
+
+ typedef void *MemoryMap;
+
+# define IS_MAP(map) ((map)!=nullptr)
+#endif
+
+/*----------------------------------------------------------------------------*
+ * *
+ * Memory Mapped File support. Platform dependent implementation of *
+ * functions used by the rest of the implementation.*
+ * *
+ *----------------------------------------------------------------------------*/
+#if MAP_IMPLEMENTATION==MAP_NONE
+ U_CFUNC UBool
+ uprv_mapFile(UDataMemory *pData, const char *path, UErrorCode *status) {
+ if (U_FAILURE(*status)) {
+ return FALSE;
+ }
+ UDataMemory_init(pData); /* Clear the output struct. */
+ return FALSE; /* no file access */
+ }
+
+ U_CFUNC void uprv_unmapFile(UDataMemory *pData) {
+ /* nothing to do */
+ }
+#elif MAP_IMPLEMENTATION==MAP_WIN32
+ U_CFUNC UBool
+ uprv_mapFile(
+ UDataMemory *pData, /* Fill in with info on the result doing the mapping. */
+ /* Output only; any original contents are cleared. */
+ const char *path, /* File path to be opened/mapped. */
+ UErrorCode *status /* Error status, used to report out-of-memory errors. */
+ )
+ {
+ if (U_FAILURE(*status)) {
+ return FALSE;
+ }
+
+ HANDLE map = nullptr;
+ HANDLE file = INVALID_HANDLE_VALUE;
+
+ UDataMemory_init(pData); /* Clear the output struct. */
+
+ /* open the input file */
+#if U_PLATFORM_HAS_WINUWP_API == 0
+ // Note: In the non-UWP code-path (ie: Win32), the value of the path variable might have come from
+ // the CRT 'getenv' function, and would be therefore be encoded in the default ANSI code page.
+ // This means that we can't call the *W version of API below, whereas in the UWP code-path
+ // there is no 'getenv' call, and thus the string will be only UTF-8/Invariant characters.
+ file=CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, nullptr,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL|FILE_FLAG_RANDOM_ACCESS, nullptr);
+#else
+ // Convert from UTF-8 string to UTF-16 string.
+ wchar_t utf16Path[MAX_PATH];
+ int32_t pathUtf16Len = 0;
+ u_strFromUTF8(reinterpret_cast<UChar*>(utf16Path), static_cast<int32_t>(UPRV_LENGTHOF(utf16Path)), &pathUtf16Len, path, -1, status);
+
+ if (U_FAILURE(*status)) {
+ return FALSE;
+ }
+ if (*status == U_STRING_NOT_TERMINATED_WARNING) {
+ // Report back an error instead of a warning.
+ *status = U_BUFFER_OVERFLOW_ERROR;
+ return FALSE;
+ }
+
+ file = CreateFileW(utf16Path, GENERIC_READ, FILE_SHARE_READ, nullptr,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, nullptr);
+#endif
+ if (file == INVALID_HANDLE_VALUE) {
+ // If we failed to open the file due to an out-of-memory error, then we want
+ // to report that error back to the caller.
+ if (HRESULT_FROM_WIN32(GetLastError()) == E_OUTOFMEMORY) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ }
+ return FALSE;
+ }
+
+ // Note: We use NULL/nullptr for lpAttributes parameter below.
+ // This means our handle cannot be inherited and we will get the default security descriptor.
+ /* create an unnamed Windows file-mapping object for the specified file */
+ map = CreateFileMappingW(file, nullptr, PAGE_READONLY, 0, 0, nullptr);
+
+ CloseHandle(file);
+ if (map == nullptr) {
+ // If we failed to create the mapping due to an out-of-memory error, then
+ // we want to report that error back to the caller.
+ if (HRESULT_FROM_WIN32(GetLastError()) == E_OUTOFMEMORY) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ }
+ return FALSE;
+ }
+
+ /* map a view of the file into our address space */
+ pData->pHeader = reinterpret_cast<const DataHeader *>(MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0));
+ if (pData->pHeader == nullptr) {
+ CloseHandle(map);
+ return FALSE;
+ }
+ pData->map = map;
+ return TRUE;
+ }
+
+ U_CFUNC void
+ uprv_unmapFile(UDataMemory *pData) {
+ if (pData != nullptr && pData->map != nullptr) {
+ UnmapViewOfFile(pData->pHeader);
+ CloseHandle(pData->map);
+ pData->pHeader = nullptr;
+ pData->map = nullptr;
+ }
+ }
+
+
+
+#elif MAP_IMPLEMENTATION==MAP_POSIX
+ U_CFUNC UBool
+ uprv_mapFile(UDataMemory *pData, const char *path, UErrorCode *status) {
+ int fd;
+ int length;
+ struct stat mystat;
+ void *data;
+
+ if (U_FAILURE(*status)) {
+ return FALSE;
+ }
+
+ UDataMemory_init(pData); /* Clear the output struct. */
+
+ /* determine the length of the file */
+ if(stat(path, &mystat)!=0 || mystat.st_size<=0) {
+ return FALSE;
+ }
+ length=mystat.st_size;
+
+ /* open the file */
+ fd=open(path, O_RDONLY);
+ if(fd==-1) {
+ return FALSE;
+ }
+
+ /* get a view of the mapping */
+#if U_PLATFORM != U_PF_HPUX
+ data=mmap(0, length, PROT_READ, MAP_SHARED, fd, 0);
+#else
+ data=mmap(0, length, PROT_READ, MAP_PRIVATE, fd, 0);
+#endif
+ close(fd); /* no longer needed */
+ if(data==MAP_FAILED) {
+ // Possibly check the errno value for ENOMEM, and report U_MEMORY_ALLOCATION_ERROR?
+ return FALSE;
+ }
+
+ pData->map = (char *)data + length;
+ pData->pHeader=(const DataHeader *)data;
+ pData->mapAddr = data;
+#if U_PLATFORM == U_PF_IPHONE
+ posix_madvise(data, length, POSIX_MADV_RANDOM);
+#endif
+ return TRUE;
+ }
+
+ U_CFUNC void
+ uprv_unmapFile(UDataMemory *pData) {
+ if(pData!=nullptr && pData->map!=nullptr) {
+ size_t dataLen = (char *)pData->map - (char *)pData->mapAddr;
+ if(munmap(pData->mapAddr, dataLen)==-1) {
+ }
+ pData->pHeader=nullptr;
+ pData->map=0;
+ pData->mapAddr=nullptr;
+ }
+ }
+
+
+
+#elif MAP_IMPLEMENTATION==MAP_STDIO
+ /* copy of the filestrm.c/T_FileStream_size() implementation */
+ static int32_t
+ umap_fsize(FILE *f) {
+ int32_t savedPos = ftell(f);
+ int32_t size = 0;
+
+ /*Changes by Bertrand A. D. doesn't affect the current position
+ goes to the end of the file before ftell*/
+ fseek(f, 0, SEEK_END);
+ size = (int32_t)ftell(f);
+ fseek(f, savedPos, SEEK_SET);
+ return size;
+ }
+
+ U_CFUNC UBool
+ uprv_mapFile(UDataMemory *pData, const char *path, UErrorCode *status) {
+ FILE *file;
+ int32_t fileLength;
+ void *p;
+
+ if (U_FAILURE(*status)) {
+ return FALSE;
+ }
+
+ UDataMemory_init(pData); /* Clear the output struct. */
+ /* open the input file */
+ file=fopen(path, "rb");
+ if(file==nullptr) {
+ return FALSE;
+ }
+
+ /* get the file length */
+ fileLength=umap_fsize(file);
+ if(ferror(file) || fileLength<=20) {
+ fclose(file);
+ return FALSE;
+ }
+
+ /* allocate the memory to hold the file data */
+ p=uprv_malloc(fileLength);
+ if(p==nullptr) {
+ fclose(file);
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return FALSE;
+ }
+
+ /* read the file */
+ if(fileLength!=fread(p, 1, fileLength, file)) {
+ uprv_free(p);
+ fclose(file);
+ return FALSE;
+ }
+
+ fclose(file);
+ pData->map=p;
+ pData->pHeader=(const DataHeader *)p;
+ pData->mapAddr=p;
+ return TRUE;
+ }
+
+ U_CFUNC void
+ uprv_unmapFile(UDataMemory *pData) {
+ if(pData!=nullptr && pData->map!=nullptr) {
+ uprv_free(pData->map);
+ pData->map = nullptr;
+ pData->mapAddr = nullptr;
+ pData->pHeader = nullptr;
+ }
+ }
+
+
+#elif MAP_IMPLEMENTATION==MAP_390DLL
+ /* 390 specific Library Loading.
+ * This is the only platform left that dynamically loads an ICU Data Library.
+ * All other platforms use .data files when dynamic loading is required, but
+ * this turn out to be awkward to support in 390 batch mode.
+ *
+ * The idea here is to hide the fact that 390 is using dll loading from the
+ * rest of ICU, and make it look like there is file loading happening.
+ *
+ */
+
+ static char *strcpy_returnEnd(char *dest, const char *src)
+ {
+ while((*dest=*src)!=0) {
+ ++dest;
+ ++src;
+ }
+ return dest;
+ }
+
+ /*------------------------------------------------------------------------------
+ *
+ * computeDirPath given a user-supplied path of an item to be opened,
+ * compute and return
+ * - the full directory path to be used
+ * when opening the file.
+ * - Pointer to null at end of above returned path
+ *
+ * Parameters:
+ * path: input path. Buffer is not altered.
+ * pathBuffer: Output buffer. Any contents are overwritten.
+ *
+ * Returns:
+ * Pointer to null termination in returned pathBuffer.
+ *
+ * TODO: This works the way ICU historically has, but the
+ * whole data fallback search path is so complicated that
+ * probably almost no one will ever really understand it,
+ * the potential for confusion is large. (It's not just
+ * this one function, but the whole scheme.)
+ *
+ *------------------------------------------------------------------------------*/
+ static char *uprv_computeDirPath(const char *path, char *pathBuffer)
+ {
+ char *finalSlash; /* Ptr to last dir separator in input path, or null if none. */
+ int32_t pathLen; /* Length of the returned directory path */
+
+ finalSlash = 0;
+ if (path != 0) {
+ finalSlash = uprv_strrchr(path, U_FILE_SEP_CHAR);
+ }
+
+ *pathBuffer = 0;
+ if (finalSlash == 0) {
+ /* No user-supplied path.
+ * Copy the ICU_DATA path to the path buffer and return that*/
+ const char *icuDataDir;
+ icuDataDir=u_getDataDirectory();
+ if(icuDataDir!=nullptr && *icuDataDir!=0) {
+ return strcpy_returnEnd(pathBuffer, icuDataDir);
+ } else {
+ /* there is no icuDataDir either. Just return the empty pathBuffer. */
+ return pathBuffer;
+ }
}
- UDataMemory_init(pData); /* Clear the output struct. */
- return FALSE; /* no file access */
- }
-
- U_CFUNC void uprv_unmapFile(UDataMemory *pData) {
- /* nothing to do */
- }
-#elif MAP_IMPLEMENTATION==MAP_WIN32
- U_CFUNC UBool
- uprv_mapFile(
- UDataMemory *pData, /* Fill in with info on the result doing the mapping. */
- /* Output only; any original contents are cleared. */
- const char *path, /* File path to be opened/mapped. */
- UErrorCode *status /* Error status, used to report out-of-memory errors. */
- )
- {
- if (U_FAILURE(*status)) {
- return FALSE;
- }
-
- HANDLE map = nullptr;
- HANDLE file = INVALID_HANDLE_VALUE;
-
- UDataMemory_init(pData); /* Clear the output struct. */
-
- /* open the input file */
-#if U_PLATFORM_HAS_WINUWP_API == 0
- // Note: In the non-UWP code-path (ie: Win32), the value of the path variable might have come from
- // the CRT 'getenv' function, and would be therefore be encoded in the default ANSI code page.
- // This means that we can't call the *W version of API below, whereas in the UWP code-path
- // there is no 'getenv' call, and thus the string will be only UTF-8/Invariant characters.
- file=CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, nullptr,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL|FILE_FLAG_RANDOM_ACCESS, nullptr);
-#else
- // Convert from UTF-8 string to UTF-16 string.
- wchar_t utf16Path[MAX_PATH];
- int32_t pathUtf16Len = 0;
- u_strFromUTF8(reinterpret_cast<UChar*>(utf16Path), static_cast<int32_t>(UPRV_LENGTHOF(utf16Path)), &pathUtf16Len, path, -1, status);
-
- if (U_FAILURE(*status)) {
- return FALSE;
- }
- if (*status == U_STRING_NOT_TERMINATED_WARNING) {
- // Report back an error instead of a warning.
- *status = U_BUFFER_OVERFLOW_ERROR;
- return FALSE;
- }
-
- file = CreateFileW(utf16Path, GENERIC_READ, FILE_SHARE_READ, nullptr,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, nullptr);
-#endif
- if (file == INVALID_HANDLE_VALUE) {
- // If we failed to open the file due to an out-of-memory error, then we want
- // to report that error back to the caller.
- if (HRESULT_FROM_WIN32(GetLastError()) == E_OUTOFMEMORY) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- }
- return FALSE;
- }
-
- // Note: We use NULL/nullptr for lpAttributes parameter below.
- // This means our handle cannot be inherited and we will get the default security descriptor.
- /* create an unnamed Windows file-mapping object for the specified file */
- map = CreateFileMappingW(file, nullptr, PAGE_READONLY, 0, 0, nullptr);
-
- CloseHandle(file);
- if (map == nullptr) {
- // If we failed to create the mapping due to an out-of-memory error, then
- // we want to report that error back to the caller.
- if (HRESULT_FROM_WIN32(GetLastError()) == E_OUTOFMEMORY) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- }
- return FALSE;
- }
-
- /* map a view of the file into our address space */
- pData->pHeader = reinterpret_cast<const DataHeader *>(MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0));
- if (pData->pHeader == nullptr) {
- CloseHandle(map);
- return FALSE;
- }
- pData->map = map;
- return TRUE;
- }
-
- U_CFUNC void
- uprv_unmapFile(UDataMemory *pData) {
- if (pData != nullptr && pData->map != nullptr) {
- UnmapViewOfFile(pData->pHeader);
- CloseHandle(pData->map);
- pData->pHeader = nullptr;
- pData->map = nullptr;
- }
- }
-
-
-
-#elif MAP_IMPLEMENTATION==MAP_POSIX
- U_CFUNC UBool
- uprv_mapFile(UDataMemory *pData, const char *path, UErrorCode *status) {
- int fd;
- int length;
- struct stat mystat;
- void *data;
-
- if (U_FAILURE(*status)) {
- return FALSE;
- }
-
- UDataMemory_init(pData); /* Clear the output struct. */
-
- /* determine the length of the file */
- if(stat(path, &mystat)!=0 || mystat.st_size<=0) {
- return FALSE;
- }
- length=mystat.st_size;
-
- /* open the file */
- fd=open(path, O_RDONLY);
- if(fd==-1) {
- return FALSE;
- }
-
- /* get a view of the mapping */
-#if U_PLATFORM != U_PF_HPUX
- data=mmap(0, length, PROT_READ, MAP_SHARED, fd, 0);
-#else
- data=mmap(0, length, PROT_READ, MAP_PRIVATE, fd, 0);
-#endif
- close(fd); /* no longer needed */
- if(data==MAP_FAILED) {
- // Possibly check the errno value for ENOMEM, and report U_MEMORY_ALLOCATION_ERROR?
- return FALSE;
- }
-
- pData->map = (char *)data + length;
- pData->pHeader=(const DataHeader *)data;
- pData->mapAddr = data;
-#if U_PLATFORM == U_PF_IPHONE
- posix_madvise(data, length, POSIX_MADV_RANDOM);
-#endif
- return TRUE;
- }
-
- U_CFUNC void
- uprv_unmapFile(UDataMemory *pData) {
- if(pData!=nullptr && pData->map!=nullptr) {
- size_t dataLen = (char *)pData->map - (char *)pData->mapAddr;
- if(munmap(pData->mapAddr, dataLen)==-1) {
- }
- pData->pHeader=nullptr;
- pData->map=0;
- pData->mapAddr=nullptr;
- }
- }
-
-
-
-#elif MAP_IMPLEMENTATION==MAP_STDIO
- /* copy of the filestrm.c/T_FileStream_size() implementation */
- static int32_t
- umap_fsize(FILE *f) {
- int32_t savedPos = ftell(f);
- int32_t size = 0;
-
- /*Changes by Bertrand A. D. doesn't affect the current position
- goes to the end of the file before ftell*/
- fseek(f, 0, SEEK_END);
- size = (int32_t)ftell(f);
- fseek(f, savedPos, SEEK_SET);
- return size;
- }
-
- U_CFUNC UBool
- uprv_mapFile(UDataMemory *pData, const char *path, UErrorCode *status) {
- FILE *file;
- int32_t fileLength;
- void *p;
-
- if (U_FAILURE(*status)) {
- return FALSE;
- }
-
- UDataMemory_init(pData); /* Clear the output struct. */
- /* open the input file */
- file=fopen(path, "rb");
- if(file==nullptr) {
- return FALSE;
- }
-
- /* get the file length */
- fileLength=umap_fsize(file);
- if(ferror(file) || fileLength<=20) {
- fclose(file);
- return FALSE;
- }
-
- /* allocate the memory to hold the file data */
- p=uprv_malloc(fileLength);
- if(p==nullptr) {
- fclose(file);
- *status = U_MEMORY_ALLOCATION_ERROR;
- return FALSE;
- }
-
- /* read the file */
- if(fileLength!=fread(p, 1, fileLength, file)) {
- uprv_free(p);
- fclose(file);
- return FALSE;
- }
-
- fclose(file);
- pData->map=p;
- pData->pHeader=(const DataHeader *)p;
- pData->mapAddr=p;
- return TRUE;
- }
-
- U_CFUNC void
- uprv_unmapFile(UDataMemory *pData) {
- if(pData!=nullptr && pData->map!=nullptr) {
- uprv_free(pData->map);
- pData->map = nullptr;
- pData->mapAddr = nullptr;
- pData->pHeader = nullptr;
- }
- }
-
-
-#elif MAP_IMPLEMENTATION==MAP_390DLL
- /* 390 specific Library Loading.
- * This is the only platform left that dynamically loads an ICU Data Library.
- * All other platforms use .data files when dynamic loading is required, but
- * this turn out to be awkward to support in 390 batch mode.
- *
- * The idea here is to hide the fact that 390 is using dll loading from the
- * rest of ICU, and make it look like there is file loading happening.
- *
- */
-
- static char *strcpy_returnEnd(char *dest, const char *src)
- {
- while((*dest=*src)!=0) {
- ++dest;
- ++src;
- }
- return dest;
- }
-
- /*------------------------------------------------------------------------------
- *
- * computeDirPath given a user-supplied path of an item to be opened,
- * compute and return
- * - the full directory path to be used
- * when opening the file.
- * - Pointer to null at end of above returned path
- *
- * Parameters:
- * path: input path. Buffer is not altered.
- * pathBuffer: Output buffer. Any contents are overwritten.
- *
- * Returns:
- * Pointer to null termination in returned pathBuffer.
- *
- * TODO: This works the way ICU historically has, but the
- * whole data fallback search path is so complicated that
- * probably almost no one will ever really understand it,
- * the potential for confusion is large. (It's not just
- * this one function, but the whole scheme.)
- *
- *------------------------------------------------------------------------------*/
- static char *uprv_computeDirPath(const char *path, char *pathBuffer)
- {
- char *finalSlash; /* Ptr to last dir separator in input path, or null if none. */
- int32_t pathLen; /* Length of the returned directory path */
-
- finalSlash = 0;
- if (path != 0) {
- finalSlash = uprv_strrchr(path, U_FILE_SEP_CHAR);
- }
-
- *pathBuffer = 0;
- if (finalSlash == 0) {
- /* No user-supplied path.
- * Copy the ICU_DATA path to the path buffer and return that*/
- const char *icuDataDir;
- icuDataDir=u_getDataDirectory();
- if(icuDataDir!=nullptr && *icuDataDir!=0) {
- return strcpy_returnEnd(pathBuffer, icuDataDir);
- } else {
- /* there is no icuDataDir either. Just return the empty pathBuffer. */
- return pathBuffer;
- }
- }
-
- /* User supplied path did contain a directory portion.
- * Copy it to the output path buffer */
- pathLen = (int32_t)(finalSlash - path + 1);
- uprv_memcpy(pathBuffer, path, pathLen);
- *(pathBuffer+pathLen) = 0;
- return pathBuffer+pathLen;
- }
-
-
-# define DATA_TYPE "dat"
-
- U_CFUNC UBool uprv_mapFile(UDataMemory *pData, const char *path, UErrorCode *status) {
- const char *inBasename;
- char *basename;
- char pathBuffer[1024];
- const DataHeader *pHeader;
- dllhandle *handle;
- void *val=0;
-
- if (U_FAILURE(*status)) {
- return FALSE;
- }
-
- inBasename=uprv_strrchr(path, U_FILE_SEP_CHAR);
- if(inBasename==nullptr) {
- inBasename = path;
- } else {
- inBasename++;
- }
- basename=uprv_computeDirPath(path, pathBuffer);
- if(uprv_strcmp(inBasename, U_ICUDATA_NAME".dat") != 0) {
- /* must mmap file... for build */
- int fd;
- int length;
- struct stat mystat;
- void *data;
- UDataMemory_init(pData); /* Clear the output struct. */
-
- /* determine the length of the file */
- if(stat(path, &mystat)!=0 || mystat.st_size<=0) {
- return FALSE;
- }
- length=mystat.st_size;
-
- /* open the file */
- fd=open(path, O_RDONLY);
- if(fd==-1) {
- return FALSE;
- }
-
- /* get a view of the mapping */
- data=mmap(0, length, PROT_READ, MAP_PRIVATE, fd, 0);
- close(fd); /* no longer needed */
- if(data==MAP_FAILED) {
- // Possibly check the errorno value for ENOMEM, and report U_MEMORY_ALLOCATION_ERROR?
- return FALSE;
- }
- pData->map = (char *)data + length;
- pData->pHeader=(const DataHeader *)data;
- pData->mapAddr = data;
- return TRUE;
- }
-
-# ifdef OS390BATCH
- /* ### hack: we still need to get u_getDataDirectory() fixed
- for OS/390 (batch mode - always return "//"? )
- and this here straightened out with LIB_PREFIX and LIB_SUFFIX (both empty?!)
- This is probably due to the strange file system on OS/390. It's more like
- a database with short entry names than a typical file system. */
- /* U_ICUDATA_NAME should always have the correct name */
- /* BUT FOR BATCH MODE IT IS AN EXCEPTION BECAUSE */
- /* THE FIRST THREE LETTERS ARE PREASSIGNED TO THE */
- /* PROJECT!!!!! */
- uprv_strcpy(pathBuffer, "IXMI" U_ICU_VERSION_SHORT "DA");
-# else
- /* set up the library name */
- uprv_strcpy(basename, LIB_PREFIX U_LIBICUDATA_NAME U_ICU_VERSION_SHORT LIB_SUFFIX);
-# endif
-
-# ifdef UDATA_DEBUG
- fprintf(stderr, "dllload: %s ", pathBuffer);
-# endif
-
- handle=dllload(pathBuffer);
-
-# ifdef UDATA_DEBUG
- fprintf(stderr, " -> %08X\n", handle );
-# endif
-
- if(handle != nullptr) {
- /* we have a data DLL - what kind of lookup do we need here? */
- /* try to find the Table of Contents */
- UDataMemory_init(pData); /* Clear the output struct. */
- val=dllqueryvar((dllhandle*)handle, U_ICUDATA_ENTRY_NAME);
- if(val == 0) {
- /* failed... so keep looking */
- return FALSE;
- }
-# ifdef UDATA_DEBUG
- fprintf(stderr, "dllqueryvar(%08X, %s) -> %08X\n", handle, U_ICUDATA_ENTRY_NAME, val);
-# endif
-
- pData->pHeader=(const DataHeader *)val;
- return TRUE;
- } else {
- return FALSE; /* no handle */
- }
- }
-
- U_CFUNC void uprv_unmapFile(UDataMemory *pData) {
- if(pData!=nullptr && pData->map!=nullptr) {
- uprv_free(pData->map);
- pData->map = nullptr;
- pData->mapAddr = nullptr;
- pData->pHeader = nullptr;
- }
- }
-
-#else
-# error MAP_IMPLEMENTATION is set incorrectly
-#endif
+
+ /* User supplied path did contain a directory portion.
+ * Copy it to the output path buffer */
+ pathLen = (int32_t)(finalSlash - path + 1);
+ uprv_memcpy(pathBuffer, path, pathLen);
+ *(pathBuffer+pathLen) = 0;
+ return pathBuffer+pathLen;
+ }
+
+
+# define DATA_TYPE "dat"
+
+ U_CFUNC UBool uprv_mapFile(UDataMemory *pData, const char *path, UErrorCode *status) {
+ const char *inBasename;
+ char *basename;
+ char pathBuffer[1024];
+ const DataHeader *pHeader;
+ dllhandle *handle;
+ void *val=0;
+
+ if (U_FAILURE(*status)) {
+ return FALSE;
+ }
+
+ inBasename=uprv_strrchr(path, U_FILE_SEP_CHAR);
+ if(inBasename==nullptr) {
+ inBasename = path;
+ } else {
+ inBasename++;
+ }
+ basename=uprv_computeDirPath(path, pathBuffer);
+ if(uprv_strcmp(inBasename, U_ICUDATA_NAME".dat") != 0) {
+ /* must mmap file... for build */
+ int fd;
+ int length;
+ struct stat mystat;
+ void *data;
+ UDataMemory_init(pData); /* Clear the output struct. */
+
+ /* determine the length of the file */
+ if(stat(path, &mystat)!=0 || mystat.st_size<=0) {
+ return FALSE;
+ }
+ length=mystat.st_size;
+
+ /* open the file */
+ fd=open(path, O_RDONLY);
+ if(fd==-1) {
+ return FALSE;
+ }
+
+ /* get a view of the mapping */
+ data=mmap(0, length, PROT_READ, MAP_PRIVATE, fd, 0);
+ close(fd); /* no longer needed */
+ if(data==MAP_FAILED) {
+ // Possibly check the errorno value for ENOMEM, and report U_MEMORY_ALLOCATION_ERROR?
+ return FALSE;
+ }
+ pData->map = (char *)data + length;
+ pData->pHeader=(const DataHeader *)data;
+ pData->mapAddr = data;
+ return TRUE;
+ }
+
+# ifdef OS390BATCH
+ /* ### hack: we still need to get u_getDataDirectory() fixed
+ for OS/390 (batch mode - always return "//"? )
+ and this here straightened out with LIB_PREFIX and LIB_SUFFIX (both empty?!)
+ This is probably due to the strange file system on OS/390. It's more like
+ a database with short entry names than a typical file system. */
+ /* U_ICUDATA_NAME should always have the correct name */
+ /* BUT FOR BATCH MODE IT IS AN EXCEPTION BECAUSE */
+ /* THE FIRST THREE LETTERS ARE PREASSIGNED TO THE */
+ /* PROJECT!!!!! */
+ uprv_strcpy(pathBuffer, "IXMI" U_ICU_VERSION_SHORT "DA");
+# else
+ /* set up the library name */
+ uprv_strcpy(basename, LIB_PREFIX U_LIBICUDATA_NAME U_ICU_VERSION_SHORT LIB_SUFFIX);
+# endif
+
+# ifdef UDATA_DEBUG
+ fprintf(stderr, "dllload: %s ", pathBuffer);
+# endif
+
+ handle=dllload(pathBuffer);
+
+# ifdef UDATA_DEBUG
+ fprintf(stderr, " -> %08X\n", handle );
+# endif
+
+ if(handle != nullptr) {
+ /* we have a data DLL - what kind of lookup do we need here? */
+ /* try to find the Table of Contents */
+ UDataMemory_init(pData); /* Clear the output struct. */
+ val=dllqueryvar((dllhandle*)handle, U_ICUDATA_ENTRY_NAME);
+ if(val == 0) {
+ /* failed... so keep looking */
+ return FALSE;
+ }
+# ifdef UDATA_DEBUG
+ fprintf(stderr, "dllqueryvar(%08X, %s) -> %08X\n", handle, U_ICUDATA_ENTRY_NAME, val);
+# endif
+
+ pData->pHeader=(const DataHeader *)val;
+ return TRUE;
+ } else {
+ return FALSE; /* no handle */
+ }
+ }
+
+ U_CFUNC void uprv_unmapFile(UDataMemory *pData) {
+ if(pData!=nullptr && pData->map!=nullptr) {
+ uprv_free(pData->map);
+ pData->map = nullptr;
+ pData->mapAddr = nullptr;
+ pData->pHeader = nullptr;
+ }
+ }
+
+#else
+# error MAP_IMPLEMENTATION is set incorrectly
+#endif
diff --git a/contrib/libs/icu/common/umapfile.h b/contrib/libs/icu/common/umapfile.h
index a397137150..92bd567a2a 100644
--- a/contrib/libs/icu/common/umapfile.h
+++ b/contrib/libs/icu/common/umapfile.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -29,7 +29,7 @@
#include "unicode/udata.h"
#include "putilimp.h"
-U_CFUNC UBool uprv_mapFile(UDataMemory *pdm, const char *path, UErrorCode *status);
+U_CFUNC UBool uprv_mapFile(UDataMemory *pdm, const char *path, UErrorCode *status);
U_CFUNC void uprv_unmapFile(UDataMemory *pData);
/* MAP_NONE: no memory mapping, no file access at all */
diff --git a/contrib/libs/icu/common/umath.cpp b/contrib/libs/icu/common/umath.cpp
index 41ad48af77..7cf4b31749 100644
--- a/contrib/libs/icu/common/umath.cpp
+++ b/contrib/libs/icu/common/umath.cpp
@@ -1,26 +1,26 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 1997-2006, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-* This file contains platform independent math.
-*/
-
-#include "putilimp.h"
-
-U_CAPI int32_t U_EXPORT2
-uprv_max(int32_t x, int32_t y)
-{
- return (x > y ? x : y);
-}
-
-U_CAPI int32_t U_EXPORT2
-uprv_min(int32_t x, int32_t y)
-{
- return (x > y ? y : x);
-}
-
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 1997-2006, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+* This file contains platform independent math.
+*/
+
+#include "putilimp.h"
+
+U_CAPI int32_t U_EXPORT2
+uprv_max(int32_t x, int32_t y)
+{
+ return (x > y ? x : y);
+}
+
+U_CAPI int32_t U_EXPORT2
+uprv_min(int32_t x, int32_t y)
+{
+ return (x > y ? y : x);
+}
+
diff --git a/contrib/libs/icu/common/umutablecptrie.cpp b/contrib/libs/icu/common/umutablecptrie.cpp
index 6ef717a172..cdbe27080b 100644
--- a/contrib/libs/icu/common/umutablecptrie.cpp
+++ b/contrib/libs/icu/common/umutablecptrie.cpp
@@ -1,1852 +1,1852 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// umutablecptrie.cpp (inspired by utrie2_builder.cpp)
-// created: 2017dec29 Markus W. Scherer
-
-// #define UCPTRIE_DEBUG
-#ifdef UCPTRIE_DEBUG
-# include <stdio.h>
-#endif
-
-#include "unicode/utypes.h"
-#include "unicode/ucptrie.h"
-#include "unicode/umutablecptrie.h"
-#include "unicode/uobject.h"
-#include "unicode/utf16.h"
-#include "cmemory.h"
-#include "uassert.h"
-#include "ucptrie_impl.h"
-
-// ICU-20235 In case Microsoft math.h has defined this, undefine it.
-#ifdef OVERFLOW
-#undef OVERFLOW
-#endif
-
-U_NAMESPACE_BEGIN
-
-namespace {
-
-constexpr int32_t MAX_UNICODE = 0x10ffff;
-
-constexpr int32_t UNICODE_LIMIT = 0x110000;
-constexpr int32_t BMP_LIMIT = 0x10000;
-constexpr int32_t ASCII_LIMIT = 0x80;
-
-constexpr int32_t I_LIMIT = UNICODE_LIMIT >> UCPTRIE_SHIFT_3;
-constexpr int32_t BMP_I_LIMIT = BMP_LIMIT >> UCPTRIE_SHIFT_3;
-constexpr int32_t ASCII_I_LIMIT = ASCII_LIMIT >> UCPTRIE_SHIFT_3;
-
-constexpr int32_t SMALL_DATA_BLOCKS_PER_BMP_BLOCK = (1 << (UCPTRIE_FAST_SHIFT - UCPTRIE_SHIFT_3));
-
-// Flag values for data blocks.
-constexpr uint8_t ALL_SAME = 0;
-constexpr uint8_t MIXED = 1;
-constexpr uint8_t SAME_AS = 2;
-
-/** Start with allocation of 16k data entries. */
-constexpr int32_t INITIAL_DATA_LENGTH = ((int32_t)1 << 14);
-
-/** Grow about 8x each time. */
-constexpr int32_t MEDIUM_DATA_LENGTH = ((int32_t)1 << 17);
-
-/**
- * Maximum length of the build-time data array.
- * One entry per 0x110000 code points.
- */
-constexpr int32_t MAX_DATA_LENGTH = UNICODE_LIMIT;
-
-// Flag values for index-3 blocks while compacting/building.
-constexpr uint8_t I3_NULL = 0;
-constexpr uint8_t I3_BMP = 1;
-constexpr uint8_t I3_16 = 2;
-constexpr uint8_t I3_18 = 3;
-
-constexpr int32_t INDEX_3_18BIT_BLOCK_LENGTH = UCPTRIE_INDEX_3_BLOCK_LENGTH + UCPTRIE_INDEX_3_BLOCK_LENGTH / 8;
-
-class AllSameBlocks;
-class MixedBlocks;
-
-class MutableCodePointTrie : public UMemory {
-public:
- MutableCodePointTrie(uint32_t initialValue, uint32_t errorValue, UErrorCode &errorCode);
- MutableCodePointTrie(const MutableCodePointTrie &other, UErrorCode &errorCode);
- MutableCodePointTrie(const MutableCodePointTrie &other) = delete;
- ~MutableCodePointTrie();
-
- MutableCodePointTrie &operator=(const MutableCodePointTrie &other) = delete;
-
- static MutableCodePointTrie *fromUCPMap(const UCPMap *map, UErrorCode &errorCode);
- static MutableCodePointTrie *fromUCPTrie(const UCPTrie *trie, UErrorCode &errorCode);
-
- uint32_t get(UChar32 c) const;
- int32_t getRange(UChar32 start, UCPMapValueFilter *filter, const void *context,
- uint32_t *pValue) const;
-
- void set(UChar32 c, uint32_t value, UErrorCode &errorCode);
- void setRange(UChar32 start, UChar32 end, uint32_t value, UErrorCode &errorCode);
-
- UCPTrie *build(UCPTrieType type, UCPTrieValueWidth valueWidth, UErrorCode &errorCode);
-
-private:
- void clear();
-
- bool ensureHighStart(UChar32 c);
- int32_t allocDataBlock(int32_t blockLength);
- int32_t getDataBlock(int32_t i);
-
- void maskValues(uint32_t mask);
- UChar32 findHighStart() const;
- int32_t compactWholeDataBlocks(int32_t fastILimit, AllSameBlocks &allSameBlocks);
- int32_t compactData(
- int32_t fastILimit, uint32_t *newData, int32_t newDataCapacity,
- int32_t dataNullIndex, MixedBlocks &mixedBlocks, UErrorCode &errorCode);
- int32_t compactIndex(int32_t fastILimit, MixedBlocks &mixedBlocks, UErrorCode &errorCode);
- int32_t compactTrie(int32_t fastILimit, UErrorCode &errorCode);
-
- uint32_t *index = nullptr;
- int32_t indexCapacity = 0;
- int32_t index3NullOffset = -1;
- uint32_t *data = nullptr;
- int32_t dataCapacity = 0;
- int32_t dataLength = 0;
- int32_t dataNullOffset = -1;
-
- uint32_t origInitialValue;
- uint32_t initialValue;
- uint32_t errorValue;
- UChar32 highStart;
- uint32_t highValue;
-#ifdef UCPTRIE_DEBUG
-public:
- const char *name;
-#endif
-private:
- /** Temporary array while building the final data. */
- uint16_t *index16 = nullptr;
- uint8_t flags[UNICODE_LIMIT >> UCPTRIE_SHIFT_3];
-};
-
-MutableCodePointTrie::MutableCodePointTrie(uint32_t iniValue, uint32_t errValue, UErrorCode &errorCode) :
- origInitialValue(iniValue), initialValue(iniValue), errorValue(errValue),
- highStart(0), highValue(initialValue)
-#ifdef UCPTRIE_DEBUG
- , name("open")
-#endif
- {
- if (U_FAILURE(errorCode)) { return; }
- index = (uint32_t *)uprv_malloc(BMP_I_LIMIT * 4);
- data = (uint32_t *)uprv_malloc(INITIAL_DATA_LENGTH * 4);
- if (index == nullptr || data == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- indexCapacity = BMP_I_LIMIT;
- dataCapacity = INITIAL_DATA_LENGTH;
-}
-
-MutableCodePointTrie::MutableCodePointTrie(const MutableCodePointTrie &other, UErrorCode &errorCode) :
- index3NullOffset(other.index3NullOffset),
- dataNullOffset(other.dataNullOffset),
- origInitialValue(other.origInitialValue), initialValue(other.initialValue),
- errorValue(other.errorValue),
- highStart(other.highStart), highValue(other.highValue)
-#ifdef UCPTRIE_DEBUG
- , name("mutable clone")
-#endif
- {
- if (U_FAILURE(errorCode)) { return; }
- int32_t iCapacity = highStart <= BMP_LIMIT ? BMP_I_LIMIT : I_LIMIT;
- index = (uint32_t *)uprv_malloc(iCapacity * 4);
- data = (uint32_t *)uprv_malloc(other.dataCapacity * 4);
- if (index == nullptr || data == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- indexCapacity = iCapacity;
- dataCapacity = other.dataCapacity;
-
- int32_t iLimit = highStart >> UCPTRIE_SHIFT_3;
- uprv_memcpy(flags, other.flags, iLimit);
- uprv_memcpy(index, other.index, iLimit * 4);
- uprv_memcpy(data, other.data, (size_t)other.dataLength * 4);
- dataLength = other.dataLength;
- U_ASSERT(other.index16 == nullptr);
-}
-
-MutableCodePointTrie::~MutableCodePointTrie() {
- uprv_free(index);
- uprv_free(data);
- uprv_free(index16);
-}
-
-MutableCodePointTrie *MutableCodePointTrie::fromUCPMap(const UCPMap *map, UErrorCode &errorCode) {
- // Use the highValue as the initialValue to reduce the highStart.
- uint32_t errorValue = ucpmap_get(map, -1);
- uint32_t initialValue = ucpmap_get(map, 0x10ffff);
- LocalPointer<MutableCodePointTrie> mutableTrie(
- new MutableCodePointTrie(initialValue, errorValue, errorCode),
- errorCode);
- if (U_FAILURE(errorCode)) {
- return nullptr;
- }
- UChar32 start = 0, end;
- uint32_t value;
- while ((end = ucpmap_getRange(map, start, UCPMAP_RANGE_NORMAL, 0,
- nullptr, nullptr, &value)) >= 0) {
- if (value != initialValue) {
- if (start == end) {
- mutableTrie->set(start, value, errorCode);
- } else {
- mutableTrie->setRange(start, end, value, errorCode);
- }
- }
- start = end + 1;
- }
- if (U_SUCCESS(errorCode)) {
- return mutableTrie.orphan();
- } else {
- return nullptr;
- }
-}
-
-MutableCodePointTrie *MutableCodePointTrie::fromUCPTrie(const UCPTrie *trie, UErrorCode &errorCode) {
- // Use the highValue as the initialValue to reduce the highStart.
- uint32_t errorValue;
- uint32_t initialValue;
- switch (trie->valueWidth) {
- case UCPTRIE_VALUE_BITS_16:
- errorValue = trie->data.ptr16[trie->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET];
- initialValue = trie->data.ptr16[trie->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET];
- break;
- case UCPTRIE_VALUE_BITS_32:
- errorValue = trie->data.ptr32[trie->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET];
- initialValue = trie->data.ptr32[trie->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET];
- break;
- case UCPTRIE_VALUE_BITS_8:
- errorValue = trie->data.ptr8[trie->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET];
- initialValue = trie->data.ptr8[trie->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET];
- break;
- default:
- // Unreachable if the trie is properly initialized.
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
- }
- LocalPointer<MutableCodePointTrie> mutableTrie(
- new MutableCodePointTrie(initialValue, errorValue, errorCode),
- errorCode);
- if (U_FAILURE(errorCode)) {
- return nullptr;
- }
- UChar32 start = 0, end;
- uint32_t value;
- while ((end = ucptrie_getRange(trie, start, UCPMAP_RANGE_NORMAL, 0,
- nullptr, nullptr, &value)) >= 0) {
- if (value != initialValue) {
- if (start == end) {
- mutableTrie->set(start, value, errorCode);
- } else {
- mutableTrie->setRange(start, end, value, errorCode);
- }
- }
- start = end + 1;
- }
- if (U_SUCCESS(errorCode)) {
- return mutableTrie.orphan();
- } else {
- return nullptr;
- }
-}
-
-void MutableCodePointTrie::clear() {
- index3NullOffset = dataNullOffset = -1;
- dataLength = 0;
- highValue = initialValue = origInitialValue;
- highStart = 0;
- uprv_free(index16);
- index16 = nullptr;
-}
-
-uint32_t MutableCodePointTrie::get(UChar32 c) const {
- if ((uint32_t)c > MAX_UNICODE) {
- return errorValue;
- }
- if (c >= highStart) {
- return highValue;
- }
- int32_t i = c >> UCPTRIE_SHIFT_3;
- if (flags[i] == ALL_SAME) {
- return index[i];
- } else {
- return data[index[i] + (c & UCPTRIE_SMALL_DATA_MASK)];
- }
-}
-
-inline uint32_t maybeFilterValue(uint32_t value, uint32_t initialValue, uint32_t nullValue,
- UCPMapValueFilter *filter, const void *context) {
- if (value == initialValue) {
- value = nullValue;
- } else if (filter != nullptr) {
- value = filter(context, value);
- }
- return value;
-}
-
-UChar32 MutableCodePointTrie::getRange(
- UChar32 start, UCPMapValueFilter *filter, const void *context,
- uint32_t *pValue) const {
- if ((uint32_t)start > MAX_UNICODE) {
- return U_SENTINEL;
- }
- if (start >= highStart) {
- if (pValue != nullptr) {
- uint32_t value = highValue;
- if (filter != nullptr) { value = filter(context, value); }
- *pValue = value;
- }
- return MAX_UNICODE;
- }
- uint32_t nullValue = initialValue;
- if (filter != nullptr) { nullValue = filter(context, nullValue); }
- UChar32 c = start;
- uint32_t trieValue, value;
- bool haveValue = false;
- int32_t i = c >> UCPTRIE_SHIFT_3;
- do {
- if (flags[i] == ALL_SAME) {
- uint32_t trieValue2 = index[i];
- if (haveValue) {
- if (trieValue2 != trieValue) {
- if (filter == nullptr ||
- maybeFilterValue(trieValue2, initialValue, nullValue,
- filter, context) != value) {
- return c - 1;
- }
- trieValue = trieValue2; // may or may not help
- }
- } else {
- trieValue = trieValue2;
- value = maybeFilterValue(trieValue2, initialValue, nullValue, filter, context);
- if (pValue != nullptr) { *pValue = value; }
- haveValue = true;
- }
- c = (c + UCPTRIE_SMALL_DATA_BLOCK_LENGTH) & ~UCPTRIE_SMALL_DATA_MASK;
- } else /* MIXED */ {
- int32_t di = index[i] + (c & UCPTRIE_SMALL_DATA_MASK);
- uint32_t trieValue2 = data[di];
- if (haveValue) {
- if (trieValue2 != trieValue) {
- if (filter == nullptr ||
- maybeFilterValue(trieValue2, initialValue, nullValue,
- filter, context) != value) {
- return c - 1;
- }
- trieValue = trieValue2; // may or may not help
- }
- } else {
- trieValue = trieValue2;
- value = maybeFilterValue(trieValue2, initialValue, nullValue, filter, context);
- if (pValue != nullptr) { *pValue = value; }
- haveValue = true;
- }
- while ((++c & UCPTRIE_SMALL_DATA_MASK) != 0) {
- trieValue2 = data[++di];
- if (trieValue2 != trieValue) {
- if (filter == nullptr ||
- maybeFilterValue(trieValue2, initialValue, nullValue,
- filter, context) != value) {
- return c - 1;
- }
- }
- trieValue = trieValue2; // may or may not help
- }
- }
- ++i;
- } while (c < highStart);
- U_ASSERT(haveValue);
- if (maybeFilterValue(highValue, initialValue, nullValue,
- filter, context) != value) {
- return c - 1;
- } else {
- return MAX_UNICODE;
- }
-}
-
-void
-writeBlock(uint32_t *block, uint32_t value) {
- uint32_t *limit = block + UCPTRIE_SMALL_DATA_BLOCK_LENGTH;
- while (block < limit) {
- *block++ = value;
- }
-}
-
-bool MutableCodePointTrie::ensureHighStart(UChar32 c) {
- if (c >= highStart) {
- // Round up to a UCPTRIE_CP_PER_INDEX_2_ENTRY boundary to simplify compaction.
- c = (c + UCPTRIE_CP_PER_INDEX_2_ENTRY) & ~(UCPTRIE_CP_PER_INDEX_2_ENTRY - 1);
- int32_t i = highStart >> UCPTRIE_SHIFT_3;
- int32_t iLimit = c >> UCPTRIE_SHIFT_3;
- if (iLimit > indexCapacity) {
- uint32_t *newIndex = (uint32_t *)uprv_malloc(I_LIMIT * 4);
- if (newIndex == nullptr) { return false; }
- uprv_memcpy(newIndex, index, i * 4);
- uprv_free(index);
- index = newIndex;
- indexCapacity = I_LIMIT;
- }
- do {
- flags[i] = ALL_SAME;
- index[i] = initialValue;
- } while(++i < iLimit);
- highStart = c;
- }
- return true;
-}
-
-int32_t MutableCodePointTrie::allocDataBlock(int32_t blockLength) {
- int32_t newBlock = dataLength;
- int32_t newTop = newBlock + blockLength;
- if (newTop > dataCapacity) {
- int32_t capacity;
- if (dataCapacity < MEDIUM_DATA_LENGTH) {
- capacity = MEDIUM_DATA_LENGTH;
- } else if (dataCapacity < MAX_DATA_LENGTH) {
- capacity = MAX_DATA_LENGTH;
- } else {
- // Should never occur.
- // Either MAX_DATA_LENGTH is incorrect,
- // or the code writes more values than should be possible.
- return -1;
- }
- uint32_t *newData = (uint32_t *)uprv_malloc(capacity * 4);
- if (newData == nullptr) {
- return -1;
- }
- uprv_memcpy(newData, data, (size_t)dataLength * 4);
- uprv_free(data);
- data = newData;
- dataCapacity = capacity;
- }
- dataLength = newTop;
- return newBlock;
-}
-
-/**
- * No error checking for illegal arguments.
- *
- * @return -1 if no new data block available (out of memory in data array)
- * @internal
- */
-int32_t MutableCodePointTrie::getDataBlock(int32_t i) {
- if (flags[i] == MIXED) {
- return index[i];
- }
- if (i < BMP_I_LIMIT) {
- int32_t newBlock = allocDataBlock(UCPTRIE_FAST_DATA_BLOCK_LENGTH);
- if (newBlock < 0) { return newBlock; }
- int32_t iStart = i & ~(SMALL_DATA_BLOCKS_PER_BMP_BLOCK -1);
- int32_t iLimit = iStart + SMALL_DATA_BLOCKS_PER_BMP_BLOCK;
- do {
- U_ASSERT(flags[iStart] == ALL_SAME);
- writeBlock(data + newBlock, index[iStart]);
- flags[iStart] = MIXED;
- index[iStart++] = newBlock;
- newBlock += UCPTRIE_SMALL_DATA_BLOCK_LENGTH;
- } while (iStart < iLimit);
- return index[i];
- } else {
- int32_t newBlock = allocDataBlock(UCPTRIE_SMALL_DATA_BLOCK_LENGTH);
- if (newBlock < 0) { return newBlock; }
- writeBlock(data + newBlock, index[i]);
- flags[i] = MIXED;
- index[i] = newBlock;
- return newBlock;
- }
-}
-
-void MutableCodePointTrie::set(UChar32 c, uint32_t value, UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) {
- return;
- }
- if ((uint32_t)c > MAX_UNICODE) {
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- int32_t block;
- if (!ensureHighStart(c) || (block = getDataBlock(c >> UCPTRIE_SHIFT_3)) < 0) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
-
- data[block + (c & UCPTRIE_SMALL_DATA_MASK)] = value;
-}
-
-void
-fillBlock(uint32_t *block, UChar32 start, UChar32 limit, uint32_t value) {
- uint32_t *pLimit = block + limit;
- block += start;
- while (block < pLimit) {
- *block++ = value;
- }
-}
-
-void MutableCodePointTrie::setRange(UChar32 start, UChar32 end, uint32_t value, UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) {
- return;
- }
- if ((uint32_t)start > MAX_UNICODE || (uint32_t)end > MAX_UNICODE || start > end) {
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- if (!ensureHighStart(end)) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
-
- UChar32 limit = end + 1;
- if (start & UCPTRIE_SMALL_DATA_MASK) {
- // Set partial block at [start..following block boundary[.
- int32_t block = getDataBlock(start >> UCPTRIE_SHIFT_3);
- if (block < 0) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
-
- UChar32 nextStart = (start + UCPTRIE_SMALL_DATA_MASK) & ~UCPTRIE_SMALL_DATA_MASK;
- if (nextStart <= limit) {
- fillBlock(data + block, start & UCPTRIE_SMALL_DATA_MASK, UCPTRIE_SMALL_DATA_BLOCK_LENGTH,
- value);
- start = nextStart;
- } else {
- fillBlock(data + block, start & UCPTRIE_SMALL_DATA_MASK, limit & UCPTRIE_SMALL_DATA_MASK,
- value);
- return;
- }
- }
-
- // Number of positions in the last, partial block.
- int32_t rest = limit & UCPTRIE_SMALL_DATA_MASK;
-
- // Round down limit to a block boundary.
- limit &= ~UCPTRIE_SMALL_DATA_MASK;
-
- // Iterate over all-value blocks.
- while (start < limit) {
- int32_t i = start >> UCPTRIE_SHIFT_3;
- if (flags[i] == ALL_SAME) {
- index[i] = value;
- } else /* MIXED */ {
- fillBlock(data + index[i], 0, UCPTRIE_SMALL_DATA_BLOCK_LENGTH, value);
- }
- start += UCPTRIE_SMALL_DATA_BLOCK_LENGTH;
- }
-
- if (rest > 0) {
- // Set partial block at [last block boundary..limit[.
- int32_t block = getDataBlock(start >> UCPTRIE_SHIFT_3);
- if (block < 0) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
-
- fillBlock(data + block, 0, rest, value);
- }
-}
-
-/* compaction --------------------------------------------------------------- */
-
-void MutableCodePointTrie::maskValues(uint32_t mask) {
- initialValue &= mask;
- errorValue &= mask;
- highValue &= mask;
- int32_t iLimit = highStart >> UCPTRIE_SHIFT_3;
- for (int32_t i = 0; i < iLimit; ++i) {
- if (flags[i] == ALL_SAME) {
- index[i] &= mask;
- }
- }
- for (int32_t i = 0; i < dataLength; ++i) {
- data[i] &= mask;
- }
-}
-
-template<typename UIntA, typename UIntB>
-bool equalBlocks(const UIntA *s, const UIntB *t, int32_t length) {
- while (length > 0 && *s == *t) {
- ++s;
- ++t;
- --length;
- }
- return length == 0;
-}
-
-bool allValuesSameAs(const uint32_t *p, int32_t length, uint32_t value) {
- const uint32_t *pLimit = p + length;
- while (p < pLimit && *p == value) { ++p; }
- return p == pLimit;
-}
-
-/** Search for an identical block. */
-int32_t findSameBlock(const uint16_t *p, int32_t pStart, int32_t length,
- const uint16_t *q, int32_t qStart, int32_t blockLength) {
- // Ensure that we do not even partially get past length.
- length -= blockLength;
-
- q += qStart;
- while (pStart <= length) {
- if (equalBlocks(p + pStart, q, blockLength)) {
- return pStart;
- }
- ++pStart;
- }
- return -1;
-}
-
-int32_t findAllSameBlock(const uint32_t *p, int32_t start, int32_t limit,
- uint32_t value, int32_t blockLength) {
- // Ensure that we do not even partially get past limit.
- limit -= blockLength;
-
- for (int32_t block = start; block <= limit; ++block) {
- if (p[block] == value) {
- for (int32_t i = 1;; ++i) {
- if (i == blockLength) {
- return block;
- }
- if (p[block + i] != value) {
- block += i;
- break;
- }
- }
- }
- }
- return -1;
-}
-
-/**
- * Look for maximum overlap of the beginning of the other block
- * with the previous, adjacent block.
- */
-template<typename UIntA, typename UIntB>
-int32_t getOverlap(const UIntA *p, int32_t length,
- const UIntB *q, int32_t qStart, int32_t blockLength) {
- int32_t overlap = blockLength - 1;
- U_ASSERT(overlap <= length);
- q += qStart;
- while (overlap > 0 && !equalBlocks(p + (length - overlap), q, overlap)) {
- --overlap;
- }
- return overlap;
-}
-
-int32_t getAllSameOverlap(const uint32_t *p, int32_t length, uint32_t value,
- int32_t blockLength) {
- int32_t min = length - (blockLength - 1);
- int32_t i = length;
- while (min < i && p[i - 1] == value) { --i; }
- return length - i;
-}
-
-bool isStartOfSomeFastBlock(uint32_t dataOffset, const uint32_t index[], int32_t fastILimit) {
- for (int32_t i = 0; i < fastILimit; i += SMALL_DATA_BLOCKS_PER_BMP_BLOCK) {
- if (index[i] == dataOffset) {
- return true;
- }
- }
- return false;
-}
-
-/**
- * Finds the start of the last range in the trie by enumerating backward.
- * Indexes for code points higher than this will be omitted.
- */
-UChar32 MutableCodePointTrie::findHighStart() const {
- int32_t i = highStart >> UCPTRIE_SHIFT_3;
- while (i > 0) {
- bool match;
- if (flags[--i] == ALL_SAME) {
- match = index[i] == highValue;
- } else /* MIXED */ {
- const uint32_t *p = data + index[i];
- for (int32_t j = 0;; ++j) {
- if (j == UCPTRIE_SMALL_DATA_BLOCK_LENGTH) {
- match = true;
- break;
- }
- if (p[j] != highValue) {
- match = false;
- break;
- }
- }
- }
- if (!match) {
- return (i + 1) << UCPTRIE_SHIFT_3;
- }
- }
- return 0;
-}
-
-class AllSameBlocks {
-public:
- static constexpr int32_t NEW_UNIQUE = -1;
- static constexpr int32_t OVERFLOW = -2;
-
- AllSameBlocks() : length(0), mostRecent(-1) {}
-
- int32_t findOrAdd(int32_t index, int32_t count, uint32_t value) {
- if (mostRecent >= 0 && values[mostRecent] == value) {
- refCounts[mostRecent] += count;
- return indexes[mostRecent];
- }
- for (int32_t i = 0; i < length; ++i) {
- if (values[i] == value) {
- mostRecent = i;
- refCounts[i] += count;
- return indexes[i];
- }
- }
- if (length == CAPACITY) {
- return OVERFLOW;
- }
- mostRecent = length;
- indexes[length] = index;
- values[length] = value;
- refCounts[length++] = count;
- return NEW_UNIQUE;
- }
-
- /** Replaces the block which has the lowest reference count. */
- void add(int32_t index, int32_t count, uint32_t value) {
- U_ASSERT(length == CAPACITY);
- int32_t least = -1;
- int32_t leastCount = I_LIMIT;
- for (int32_t i = 0; i < length; ++i) {
- U_ASSERT(values[i] != value);
- if (refCounts[i] < leastCount) {
- least = i;
- leastCount = refCounts[i];
- }
- }
- U_ASSERT(least >= 0);
- mostRecent = least;
- indexes[least] = index;
- values[least] = value;
- refCounts[least] = count;
- }
-
- int32_t findMostUsed() const {
- if (length == 0) { return -1; }
- int32_t max = -1;
- int32_t maxCount = 0;
- for (int32_t i = 0; i < length; ++i) {
- if (refCounts[i] > maxCount) {
- max = i;
- maxCount = refCounts[i];
- }
- }
- return indexes[max];
- }
-
-private:
- static constexpr int32_t CAPACITY = 32;
-
- int32_t length;
- int32_t mostRecent;
-
- int32_t indexes[CAPACITY];
- uint32_t values[CAPACITY];
- int32_t refCounts[CAPACITY];
-};
-
-// Custom hash table for mixed-value blocks to be found anywhere in the
-// compacted data or index so far.
-class MixedBlocks {
-public:
- MixedBlocks() {}
- ~MixedBlocks() {
- uprv_free(table);
- }
-
- bool init(int32_t maxLength, int32_t newBlockLength) {
- // We store actual data indexes + 1 to reserve 0 for empty entries.
- int32_t maxDataIndex = maxLength - newBlockLength + 1;
- int32_t newLength;
- if (maxDataIndex <= 0xfff) { // 4k
- newLength = 6007;
- shift = 12;
- mask = 0xfff;
- } else if (maxDataIndex <= 0x7fff) { // 32k
- newLength = 50021;
- shift = 15;
- mask = 0x7fff;
- } else if (maxDataIndex <= 0x1ffff) { // 128k
- newLength = 200003;
- shift = 17;
- mask = 0x1ffff;
- } else {
- // maxDataIndex up to around MAX_DATA_LENGTH, ca. 1.1M
- newLength = 1500007;
- shift = 21;
- mask = 0x1fffff;
- }
- if (newLength > capacity) {
- uprv_free(table);
- table = (uint32_t *)uprv_malloc(newLength * 4);
- if (table == nullptr) {
- return false;
- }
- capacity = newLength;
- }
- length = newLength;
- uprv_memset(table, 0, length * 4);
-
- blockLength = newBlockLength;
- return true;
- }
-
- template<typename UInt>
- void extend(const UInt *data, int32_t minStart, int32_t prevDataLength, int32_t newDataLength) {
- int32_t start = prevDataLength - blockLength;
- if (start >= minStart) {
- ++start; // Skip the last block that we added last time.
- } else {
- start = minStart; // Begin with the first full block.
- }
- for (int32_t end = newDataLength - blockLength; start <= end; ++start) {
- uint32_t hashCode = makeHashCode(data, start);
- addEntry(data, start, hashCode, start);
- }
- }
-
- template<typename UIntA, typename UIntB>
- int32_t findBlock(const UIntA *data, const UIntB *blockData, int32_t blockStart) const {
- uint32_t hashCode = makeHashCode(blockData, blockStart);
- int32_t entryIndex = findEntry(data, blockData, blockStart, hashCode);
- if (entryIndex >= 0) {
- return (table[entryIndex] & mask) - 1;
- } else {
- return -1;
- }
- }
-
- int32_t findAllSameBlock(const uint32_t *data, uint32_t blockValue) const {
- uint32_t hashCode = makeHashCode(blockValue);
- int32_t entryIndex = findEntry(data, blockValue, hashCode);
- if (entryIndex >= 0) {
- return (table[entryIndex] & mask) - 1;
- } else {
- return -1;
- }
- }
-
-private:
- template<typename UInt>
- uint32_t makeHashCode(const UInt *blockData, int32_t blockStart) const {
- int32_t blockLimit = blockStart + blockLength;
- uint32_t hashCode = blockData[blockStart++];
- do {
- hashCode = 37 * hashCode + blockData[blockStart++];
- } while (blockStart < blockLimit);
- return hashCode;
- }
-
- uint32_t makeHashCode(uint32_t blockValue) const {
- uint32_t hashCode = blockValue;
- for (int32_t i = 1; i < blockLength; ++i) {
- hashCode = 37 * hashCode + blockValue;
- }
- return hashCode;
- }
-
- template<typename UInt>
- void addEntry(const UInt *data, int32_t blockStart, uint32_t hashCode, int32_t dataIndex) {
- U_ASSERT(0 <= dataIndex && dataIndex < (int32_t)mask);
- int32_t entryIndex = findEntry(data, data, blockStart, hashCode);
- if (entryIndex < 0) {
- table[~entryIndex] = (hashCode << shift) | (dataIndex + 1);
- }
- }
-
- template<typename UIntA, typename UIntB>
- int32_t findEntry(const UIntA *data, const UIntB *blockData, int32_t blockStart,
- uint32_t hashCode) const {
- uint32_t shiftedHashCode = hashCode << shift;
- int32_t initialEntryIndex = (hashCode % (length - 1)) + 1; // 1..length-1
- for (int32_t entryIndex = initialEntryIndex;;) {
- uint32_t entry = table[entryIndex];
- if (entry == 0) {
- return ~entryIndex;
- }
- if ((entry & ~mask) == shiftedHashCode) {
- int32_t dataIndex = (entry & mask) - 1;
- if (equalBlocks(data + dataIndex, blockData + blockStart, blockLength)) {
- return entryIndex;
- }
- }
- entryIndex = nextIndex(initialEntryIndex, entryIndex);
- }
- }
-
- int32_t findEntry(const uint32_t *data, uint32_t blockValue, uint32_t hashCode) const {
- uint32_t shiftedHashCode = hashCode << shift;
- int32_t initialEntryIndex = (hashCode % (length - 1)) + 1; // 1..length-1
- for (int32_t entryIndex = initialEntryIndex;;) {
- uint32_t entry = table[entryIndex];
- if (entry == 0) {
- return ~entryIndex;
- }
- if ((entry & ~mask) == shiftedHashCode) {
- int32_t dataIndex = (entry & mask) - 1;
- if (allValuesSameAs(data + dataIndex, blockLength, blockValue)) {
- return entryIndex;
- }
- }
- entryIndex = nextIndex(initialEntryIndex, entryIndex);
- }
- }
-
- inline int32_t nextIndex(int32_t initialEntryIndex, int32_t entryIndex) const {
- // U_ASSERT(0 < initialEntryIndex && initialEntryIndex < length);
- return (entryIndex + initialEntryIndex) % length;
- }
-
- // Hash table.
- // The length is a prime number, larger than the maximum data length.
- // The "shift" lower bits store a data index + 1.
- // The remaining upper bits store a partial hashCode of the block data values.
- uint32_t *table = nullptr;
- int32_t capacity = 0;
- int32_t length = 0;
- int32_t shift = 0;
- uint32_t mask = 0;
-
- int32_t blockLength = 0;
-};
-
-int32_t MutableCodePointTrie::compactWholeDataBlocks(int32_t fastILimit, AllSameBlocks &allSameBlocks) {
-#ifdef UCPTRIE_DEBUG
- bool overflow = false;
-#endif
-
- // ASCII data will be stored as a linear table, even if the following code
- // does not yet count it that way.
- int32_t newDataCapacity = ASCII_LIMIT;
- // Add room for a small data null block in case it would match the start of
- // a fast data block where dataNullOffset must not be set in that case.
- newDataCapacity += UCPTRIE_SMALL_DATA_BLOCK_LENGTH;
- // Add room for special values (errorValue, highValue) and padding.
- newDataCapacity += 4;
- int32_t iLimit = highStart >> UCPTRIE_SHIFT_3;
- int32_t blockLength = UCPTRIE_FAST_DATA_BLOCK_LENGTH;
- int32_t inc = SMALL_DATA_BLOCKS_PER_BMP_BLOCK;
- for (int32_t i = 0; i < iLimit; i += inc) {
- if (i == fastILimit) {
- blockLength = UCPTRIE_SMALL_DATA_BLOCK_LENGTH;
- inc = 1;
- }
- uint32_t value = index[i];
- if (flags[i] == MIXED) {
- // Really mixed?
- const uint32_t *p = data + value;
- value = *p;
- if (allValuesSameAs(p + 1, blockLength - 1, value)) {
- flags[i] = ALL_SAME;
- index[i] = value;
- // Fall through to ALL_SAME handling.
- } else {
- newDataCapacity += blockLength;
- continue;
- }
- } else {
- U_ASSERT(flags[i] == ALL_SAME);
- if (inc > 1) {
- // Do all of the fast-range data block's ALL_SAME parts have the same value?
- bool allSame = true;
- int32_t next_i = i + inc;
- for (int32_t j = i + 1; j < next_i; ++j) {
- U_ASSERT(flags[j] == ALL_SAME);
- if (index[j] != value) {
- allSame = false;
- break;
- }
- }
- if (!allSame) {
- // Turn it into a MIXED block.
- if (getDataBlock(i) < 0) {
- return -1;
- }
- newDataCapacity += blockLength;
- continue;
- }
- }
- }
- // Is there another ALL_SAME block with the same value?
- int32_t other = allSameBlocks.findOrAdd(i, inc, value);
- if (other == AllSameBlocks::OVERFLOW) {
- // The fixed-size array overflowed. Slow check for a duplicate block.
-#ifdef UCPTRIE_DEBUG
- if (!overflow) {
- puts("UCPTrie AllSameBlocks overflow");
- overflow = true;
- }
-#endif
- int32_t jInc = SMALL_DATA_BLOCKS_PER_BMP_BLOCK;
- for (int32_t j = 0;; j += jInc) {
- if (j == i) {
- allSameBlocks.add(i, inc, value);
- break;
- }
- if (j == fastILimit) {
- jInc = 1;
- }
- if (flags[j] == ALL_SAME && index[j] == value) {
- allSameBlocks.add(j, jInc + inc, value);
- other = j;
- break;
- // We could keep counting blocks with the same value
- // before we add the first one, which may improve compaction in rare cases,
- // but it would make it slower.
- }
- }
- }
- if (other >= 0) {
- flags[i] = SAME_AS;
- index[i] = other;
- } else {
- // New unique same-value block.
- newDataCapacity += blockLength;
- }
- }
- return newDataCapacity;
-}
-
-#ifdef UCPTRIE_DEBUG
-# define DEBUG_DO(expr) expr
-#else
-# define DEBUG_DO(expr)
-#endif
-
-#ifdef UCPTRIE_DEBUG
-// Braille symbols: U+28xx = UTF-8 E2 A0 80..E2 A3 BF
-int32_t appendValue(char s[], int32_t length, uint32_t value) {
- value ^= value >> 16;
- value ^= value >> 8;
- s[length] = 0xE2;
- s[length + 1] = (char)(0xA0 + ((value >> 6) & 3));
- s[length + 2] = (char)(0x80 + (value & 0x3F));
- return length + 3;
-}
-
-void printBlock(const uint32_t *block, int32_t blockLength, uint32_t value,
- UChar32 start, int32_t overlap, uint32_t initialValue) {
- char s[UCPTRIE_FAST_DATA_BLOCK_LENGTH * 3 + 3];
- int32_t length = 0;
- int32_t i;
- for (i = 0; i < overlap; ++i) {
- length = appendValue(s, length, 0); // Braille blank
- }
- s[length++] = '|';
- for (; i < blockLength; ++i) {
- if (block != nullptr) {
- value = block[i];
- }
- if (value == initialValue) {
- value = 0x40; // Braille lower left dot
- }
- length = appendValue(s, length, value);
- }
- s[length] = 0;
- start += overlap;
- if (start <= 0xffff) {
- printf(" %04lX %s|\n", (long)start, s);
- } else if (start <= 0xfffff) {
- printf(" %5lX %s|\n", (long)start, s);
- } else {
- printf(" %6lX %s|\n", (long)start, s);
- }
-}
-#endif
-
-/**
- * Compacts a build-time trie.
- *
- * The compaction
- * - removes blocks that are identical with earlier ones
- * - overlaps each new non-duplicate block as much as possible with the previously-written one
- * - works with fast-range data blocks whose length is a multiple of that of
- * higher-code-point data blocks
- *
- * It does not try to find an optimal order of writing, deduplicating, and overlapping blocks.
- */
-int32_t MutableCodePointTrie::compactData(
- int32_t fastILimit, uint32_t *newData, int32_t newDataCapacity,
- int32_t dataNullIndex, MixedBlocks &mixedBlocks, UErrorCode &errorCode) {
-#ifdef UCPTRIE_DEBUG
- int32_t countSame=0, sumOverlaps=0;
- bool printData = dataLength == 29088 /* line.brk */ ||
- // dataLength == 30048 /* CanonIterData */ ||
- dataLength == 50400 /* zh.txt~stroke */;
-#endif
-
- // The linear ASCII data has been copied into newData already.
- int32_t newDataLength = 0;
- for (int32_t i = 0; newDataLength < ASCII_LIMIT;
- newDataLength += UCPTRIE_FAST_DATA_BLOCK_LENGTH, i += SMALL_DATA_BLOCKS_PER_BMP_BLOCK) {
- index[i] = newDataLength;
-#ifdef UCPTRIE_DEBUG
- if (printData) {
- printBlock(newData + newDataLength, UCPTRIE_FAST_DATA_BLOCK_LENGTH, 0, newDataLength, 0, initialValue);
- }
-#endif
- }
-
- int32_t blockLength = UCPTRIE_FAST_DATA_BLOCK_LENGTH;
- if (!mixedBlocks.init(newDataCapacity, blockLength)) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return 0;
- }
- mixedBlocks.extend(newData, 0, 0, newDataLength);
-
- int32_t iLimit = highStart >> UCPTRIE_SHIFT_3;
- int32_t inc = SMALL_DATA_BLOCKS_PER_BMP_BLOCK;
- int32_t fastLength = 0;
- for (int32_t i = ASCII_I_LIMIT; i < iLimit; i += inc) {
- if (i == fastILimit) {
- blockLength = UCPTRIE_SMALL_DATA_BLOCK_LENGTH;
- inc = 1;
- fastLength = newDataLength;
- if (!mixedBlocks.init(newDataCapacity, blockLength)) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return 0;
- }
- mixedBlocks.extend(newData, 0, 0, newDataLength);
- }
- if (flags[i] == ALL_SAME) {
- uint32_t value = index[i];
- // Find an earlier part of the data array of length blockLength
- // that is filled with this value.
- int32_t n = mixedBlocks.findAllSameBlock(newData, value);
- // If we find a match, and the current block is the data null block,
- // and it is not a fast block but matches the start of a fast block,
- // then we need to continue looking.
- // This is because this small block is shorter than the fast block,
- // and not all of the rest of the fast block is filled with this value.
- // Otherwise trie.getRange() would detect that the fast block starts at
- // dataNullOffset and assume incorrectly that it is filled with the null value.
- while (n >= 0 && i == dataNullIndex && i >= fastILimit && n < fastLength &&
- isStartOfSomeFastBlock(n, index, fastILimit)) {
- n = findAllSameBlock(newData, n + 1, newDataLength, value, blockLength);
- }
- if (n >= 0) {
- DEBUG_DO(++countSame);
- index[i] = n;
- } else {
- n = getAllSameOverlap(newData, newDataLength, value, blockLength);
- DEBUG_DO(sumOverlaps += n);
-#ifdef UCPTRIE_DEBUG
- if (printData) {
- printBlock(nullptr, blockLength, value, i << UCPTRIE_SHIFT_3, n, initialValue);
- }
-#endif
- index[i] = newDataLength - n;
- int32_t prevDataLength = newDataLength;
- while (n < blockLength) {
- newData[newDataLength++] = value;
- ++n;
- }
- mixedBlocks.extend(newData, 0, prevDataLength, newDataLength);
- }
- } else if (flags[i] == MIXED) {
- const uint32_t *block = data + index[i];
- int32_t n = mixedBlocks.findBlock(newData, block, 0);
- if (n >= 0) {
- DEBUG_DO(++countSame);
- index[i] = n;
- } else {
- n = getOverlap(newData, newDataLength, block, 0, blockLength);
- DEBUG_DO(sumOverlaps += n);
-#ifdef UCPTRIE_DEBUG
- if (printData) {
- printBlock(block, blockLength, 0, i << UCPTRIE_SHIFT_3, n, initialValue);
- }
-#endif
- index[i] = newDataLength - n;
- int32_t prevDataLength = newDataLength;
- while (n < blockLength) {
- newData[newDataLength++] = block[n++];
- }
- mixedBlocks.extend(newData, 0, prevDataLength, newDataLength);
- }
- } else /* SAME_AS */ {
- uint32_t j = index[i];
- index[i] = index[j];
- }
- }
-
-#ifdef UCPTRIE_DEBUG
- /* we saved some space */
- printf("compacting UCPTrie: count of 32-bit data words %lu->%lu countSame=%ld sumOverlaps=%ld\n",
- (long)dataLength, (long)newDataLength, (long)countSame, (long)sumOverlaps);
-#endif
- return newDataLength;
-}
-
-int32_t MutableCodePointTrie::compactIndex(int32_t fastILimit, MixedBlocks &mixedBlocks,
- UErrorCode &errorCode) {
- int32_t fastIndexLength = fastILimit >> (UCPTRIE_FAST_SHIFT - UCPTRIE_SHIFT_3);
- if ((highStart >> UCPTRIE_FAST_SHIFT) <= fastIndexLength) {
- // Only the linear fast index, no multi-stage index tables.
- index3NullOffset = UCPTRIE_NO_INDEX3_NULL_OFFSET;
- return fastIndexLength;
- }
-
- // Condense the fast index table.
- // Also, does it contain an index-3 block with all dataNullOffset?
- uint16_t fastIndex[UCPTRIE_BMP_INDEX_LENGTH]; // fastIndexLength
- int32_t i3FirstNull = -1;
- for (int32_t i = 0, j = 0; i < fastILimit; ++j) {
- uint32_t i3 = index[i];
- fastIndex[j] = (uint16_t)i3;
- if (i3 == (uint32_t)dataNullOffset) {
- if (i3FirstNull < 0) {
- i3FirstNull = j;
- } else if (index3NullOffset < 0 &&
- (j - i3FirstNull + 1) == UCPTRIE_INDEX_3_BLOCK_LENGTH) {
- index3NullOffset = i3FirstNull;
- }
- } else {
- i3FirstNull = -1;
- }
- // Set the index entries that compactData() skipped.
- // Needed when the multi-stage index covers the fast index range as well.
- int32_t iNext = i + SMALL_DATA_BLOCKS_PER_BMP_BLOCK;
- while (++i < iNext) {
- i3 += UCPTRIE_SMALL_DATA_BLOCK_LENGTH;
- index[i] = i3;
- }
- }
-
- if (!mixedBlocks.init(fastIndexLength, UCPTRIE_INDEX_3_BLOCK_LENGTH)) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return 0;
- }
- mixedBlocks.extend(fastIndex, 0, 0, fastIndexLength);
-
- // Examine index-3 blocks. For each determine one of:
- // - same as the index-3 null block
- // - same as a fast-index block
- // - 16-bit indexes
- // - 18-bit indexes
- // We store this in the first flags entry for the index-3 block.
- //
- // Also determine an upper limit for the index-3 table length.
- int32_t index3Capacity = 0;
- i3FirstNull = index3NullOffset;
- bool hasLongI3Blocks = false;
- // If the fast index covers the whole BMP, then
- // the multi-stage index is only for supplementary code points.
- // Otherwise, the multi-stage index covers all of Unicode.
- int32_t iStart = fastILimit < BMP_I_LIMIT ? 0 : BMP_I_LIMIT;
- int32_t iLimit = highStart >> UCPTRIE_SHIFT_3;
- for (int32_t i = iStart; i < iLimit;) {
- int32_t j = i;
- int32_t jLimit = i + UCPTRIE_INDEX_3_BLOCK_LENGTH;
- uint32_t oredI3 = 0;
- bool isNull = true;
- do {
- uint32_t i3 = index[j];
- oredI3 |= i3;
- if (i3 != (uint32_t)dataNullOffset) {
- isNull = false;
- }
- } while (++j < jLimit);
- if (isNull) {
- flags[i] = I3_NULL;
- if (i3FirstNull < 0) {
- if (oredI3 <= 0xffff) {
- index3Capacity += UCPTRIE_INDEX_3_BLOCK_LENGTH;
- } else {
- index3Capacity += INDEX_3_18BIT_BLOCK_LENGTH;
- hasLongI3Blocks = true;
- }
- i3FirstNull = 0;
- }
- } else {
- if (oredI3 <= 0xffff) {
- int32_t n = mixedBlocks.findBlock(fastIndex, index, i);
- if (n >= 0) {
- flags[i] = I3_BMP;
- index[i] = n;
- } else {
- flags[i] = I3_16;
- index3Capacity += UCPTRIE_INDEX_3_BLOCK_LENGTH;
- }
- } else {
- flags[i] = I3_18;
- index3Capacity += INDEX_3_18BIT_BLOCK_LENGTH;
- hasLongI3Blocks = true;
- }
- }
- i = j;
- }
-
- int32_t index2Capacity = (iLimit - iStart) >> UCPTRIE_SHIFT_2_3;
-
- // Length of the index-1 table, rounded up.
- int32_t index1Length = (index2Capacity + UCPTRIE_INDEX_2_MASK) >> UCPTRIE_SHIFT_1_2;
-
- // Index table: Fast index, index-1, index-3, index-2.
- // +1 for possible index table padding.
- int32_t index16Capacity = fastIndexLength + index1Length + index3Capacity + index2Capacity + 1;
- index16 = (uint16_t *)uprv_malloc(index16Capacity * 2);
- if (index16 == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return 0;
- }
- uprv_memcpy(index16, fastIndex, fastIndexLength * 2);
-
- if (!mixedBlocks.init(index16Capacity, UCPTRIE_INDEX_3_BLOCK_LENGTH)) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return 0;
- }
- MixedBlocks longI3Blocks;
- if (hasLongI3Blocks) {
- if (!longI3Blocks.init(index16Capacity, INDEX_3_18BIT_BLOCK_LENGTH)) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return 0;
- }
- }
-
- // Compact the index-3 table and write an uncompacted version of the index-2 table.
- uint16_t index2[UNICODE_LIMIT >> UCPTRIE_SHIFT_2]; // index2Capacity
- int32_t i2Length = 0;
- i3FirstNull = index3NullOffset;
- int32_t index3Start = fastIndexLength + index1Length;
- int32_t indexLength = index3Start;
- for (int32_t i = iStart; i < iLimit; i += UCPTRIE_INDEX_3_BLOCK_LENGTH) {
- int32_t i3;
- uint8_t f = flags[i];
- if (f == I3_NULL && i3FirstNull < 0) {
- // First index-3 null block. Write & overlap it like a normal block, then remember it.
- f = dataNullOffset <= 0xffff ? I3_16 : I3_18;
- i3FirstNull = 0;
- }
- if (f == I3_NULL) {
- i3 = index3NullOffset;
- } else if (f == I3_BMP) {
- i3 = index[i];
- } else if (f == I3_16) {
- int32_t n = mixedBlocks.findBlock(index16, index, i);
- if (n >= 0) {
- i3 = n;
- } else {
- if (indexLength == index3Start) {
- // No overlap at the boundary between the index-1 and index-3 tables.
- n = 0;
- } else {
- n = getOverlap(index16, indexLength,
- index, i, UCPTRIE_INDEX_3_BLOCK_LENGTH);
- }
- i3 = indexLength - n;
- int32_t prevIndexLength = indexLength;
- while (n < UCPTRIE_INDEX_3_BLOCK_LENGTH) {
- index16[indexLength++] = index[i + n++];
- }
- mixedBlocks.extend(index16, index3Start, prevIndexLength, indexLength);
- if (hasLongI3Blocks) {
- longI3Blocks.extend(index16, index3Start, prevIndexLength, indexLength);
- }
- }
- } else {
- U_ASSERT(f == I3_18);
- U_ASSERT(hasLongI3Blocks);
- // Encode an index-3 block that contains one or more data indexes exceeding 16 bits.
- int32_t j = i;
- int32_t jLimit = i + UCPTRIE_INDEX_3_BLOCK_LENGTH;
- int32_t k = indexLength;
- do {
- ++k;
- uint32_t v = index[j++];
- uint32_t upperBits = (v & 0x30000) >> 2;
- index16[k++] = v;
- v = index[j++];
- upperBits |= (v & 0x30000) >> 4;
- index16[k++] = v;
- v = index[j++];
- upperBits |= (v & 0x30000) >> 6;
- index16[k++] = v;
- v = index[j++];
- upperBits |= (v & 0x30000) >> 8;
- index16[k++] = v;
- v = index[j++];
- upperBits |= (v & 0x30000) >> 10;
- index16[k++] = v;
- v = index[j++];
- upperBits |= (v & 0x30000) >> 12;
- index16[k++] = v;
- v = index[j++];
- upperBits |= (v & 0x30000) >> 14;
- index16[k++] = v;
- v = index[j++];
- upperBits |= (v & 0x30000) >> 16;
- index16[k++] = v;
- index16[k - 9] = upperBits;
- } while (j < jLimit);
- int32_t n = longI3Blocks.findBlock(index16, index16, indexLength);
- if (n >= 0) {
- i3 = n | 0x8000;
- } else {
- if (indexLength == index3Start) {
- // No overlap at the boundary between the index-1 and index-3 tables.
- n = 0;
- } else {
- n = getOverlap(index16, indexLength,
- index16, indexLength, INDEX_3_18BIT_BLOCK_LENGTH);
- }
- i3 = (indexLength - n) | 0x8000;
- int32_t prevIndexLength = indexLength;
- if (n > 0) {
- int32_t start = indexLength;
- while (n < INDEX_3_18BIT_BLOCK_LENGTH) {
- index16[indexLength++] = index16[start + n++];
- }
- } else {
- indexLength += INDEX_3_18BIT_BLOCK_LENGTH;
- }
- mixedBlocks.extend(index16, index3Start, prevIndexLength, indexLength);
- if (hasLongI3Blocks) {
- longI3Blocks.extend(index16, index3Start, prevIndexLength, indexLength);
- }
- }
- }
- if (index3NullOffset < 0 && i3FirstNull >= 0) {
- index3NullOffset = i3;
- }
- // Set the index-2 table entry.
- index2[i2Length++] = i3;
- }
- U_ASSERT(i2Length == index2Capacity);
- U_ASSERT(indexLength <= index3Start + index3Capacity);
-
- if (index3NullOffset < 0) {
- index3NullOffset = UCPTRIE_NO_INDEX3_NULL_OFFSET;
- }
- if (indexLength >= (UCPTRIE_NO_INDEX3_NULL_OFFSET + UCPTRIE_INDEX_3_BLOCK_LENGTH)) {
- // The index-3 offsets exceed 15 bits, or
- // the last one cannot be distinguished from the no-null-block value.
- errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
- }
-
- // Compact the index-2 table and write the index-1 table.
- static_assert(UCPTRIE_INDEX_2_BLOCK_LENGTH == UCPTRIE_INDEX_3_BLOCK_LENGTH,
- "must re-init mixedBlocks");
- int32_t blockLength = UCPTRIE_INDEX_2_BLOCK_LENGTH;
- int32_t i1 = fastIndexLength;
- for (int32_t i = 0; i < i2Length; i += blockLength) {
- int32_t n;
- if ((i2Length - i) >= blockLength) {
- // normal block
- U_ASSERT(blockLength == UCPTRIE_INDEX_2_BLOCK_LENGTH);
- n = mixedBlocks.findBlock(index16, index2, i);
- } else {
- // highStart is inside the last index-2 block. Shorten it.
- blockLength = i2Length - i;
- n = findSameBlock(index16, index3Start, indexLength,
- index2, i, blockLength);
- }
- int32_t i2;
- if (n >= 0) {
- i2 = n;
- } else {
- if (indexLength == index3Start) {
- // No overlap at the boundary between the index-1 and index-3/2 tables.
- n = 0;
- } else {
- n = getOverlap(index16, indexLength, index2, i, blockLength);
- }
- i2 = indexLength - n;
- int32_t prevIndexLength = indexLength;
- while (n < blockLength) {
- index16[indexLength++] = index2[i + n++];
- }
- mixedBlocks.extend(index16, index3Start, prevIndexLength, indexLength);
- }
- // Set the index-1 table entry.
- index16[i1++] = i2;
- }
- U_ASSERT(i1 == index3Start);
- U_ASSERT(indexLength <= index16Capacity);
-
-#ifdef UCPTRIE_DEBUG
- /* we saved some space */
- printf("compacting UCPTrie: count of 16-bit index words %lu->%lu\n",
- (long)iLimit, (long)indexLength);
-#endif
-
- return indexLength;
-}
-
-int32_t MutableCodePointTrie::compactTrie(int32_t fastILimit, UErrorCode &errorCode) {
- // Find the real highStart and round it up.
- U_ASSERT((highStart & (UCPTRIE_CP_PER_INDEX_2_ENTRY - 1)) == 0);
- highValue = get(MAX_UNICODE);
- int32_t realHighStart = findHighStart();
- realHighStart = (realHighStart + (UCPTRIE_CP_PER_INDEX_2_ENTRY - 1)) &
- ~(UCPTRIE_CP_PER_INDEX_2_ENTRY - 1);
- if (realHighStart == UNICODE_LIMIT) {
- highValue = initialValue;
- }
-
-#ifdef UCPTRIE_DEBUG
- printf("UCPTrie: highStart U+%06lx highValue 0x%lx initialValue 0x%lx\n",
- (long)realHighStart, (long)highValue, (long)initialValue);
-#endif
-
- // We always store indexes and data values for the fast range.
- // Pin highStart to the top of that range while building.
- UChar32 fastLimit = fastILimit << UCPTRIE_SHIFT_3;
- if (realHighStart < fastLimit) {
- for (int32_t i = (realHighStart >> UCPTRIE_SHIFT_3); i < fastILimit; ++i) {
- flags[i] = ALL_SAME;
- index[i] = highValue;
- }
- highStart = fastLimit;
- } else {
- highStart = realHighStart;
- }
-
- uint32_t asciiData[ASCII_LIMIT];
- for (int32_t i = 0; i < ASCII_LIMIT; ++i) {
- asciiData[i] = get(i);
- }
-
- // First we look for which data blocks have the same value repeated over the whole block,
- // deduplicate such blocks, find a good null data block (for faster enumeration),
- // and get an upper bound for the necessary data array length.
- AllSameBlocks allSameBlocks;
- int32_t newDataCapacity = compactWholeDataBlocks(fastILimit, allSameBlocks);
- if (newDataCapacity < 0) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return 0;
- }
- uint32_t *newData = (uint32_t *)uprv_malloc(newDataCapacity * 4);
- if (newData == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return 0;
- }
- uprv_memcpy(newData, asciiData, sizeof(asciiData));
-
- int32_t dataNullIndex = allSameBlocks.findMostUsed();
-
- MixedBlocks mixedBlocks;
- int32_t newDataLength = compactData(fastILimit, newData, newDataCapacity,
- dataNullIndex, mixedBlocks, errorCode);
- if (U_FAILURE(errorCode)) { return 0; }
- U_ASSERT(newDataLength <= newDataCapacity);
- uprv_free(data);
- data = newData;
- dataCapacity = newDataCapacity;
- dataLength = newDataLength;
- if (dataLength > (0x3ffff + UCPTRIE_SMALL_DATA_BLOCK_LENGTH)) {
- // The offset of the last data block is too high to be stored in the index table.
- errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
- }
-
- if (dataNullIndex >= 0) {
- dataNullOffset = index[dataNullIndex];
-#ifdef UCPTRIE_DEBUG
- if (data[dataNullOffset] != initialValue) {
- printf("UCPTrie initialValue %lx -> more common nullValue %lx\n",
- (long)initialValue, (long)data[dataNullOffset]);
- }
-#endif
- initialValue = data[dataNullOffset];
- } else {
- dataNullOffset = UCPTRIE_NO_DATA_NULL_OFFSET;
- }
-
- int32_t indexLength = compactIndex(fastILimit, mixedBlocks, errorCode);
- highStart = realHighStart;
- return indexLength;
-}
-
-UCPTrie *MutableCodePointTrie::build(UCPTrieType type, UCPTrieValueWidth valueWidth, UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) {
- return nullptr;
- }
- if (type < UCPTRIE_TYPE_FAST || UCPTRIE_TYPE_SMALL < type ||
- valueWidth < UCPTRIE_VALUE_BITS_16 || UCPTRIE_VALUE_BITS_8 < valueWidth) {
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
- }
-
- // The mutable trie always stores 32-bit values.
- // When we build a UCPTrie for a smaller value width, we first mask off unused bits
- // before compacting the data.
- switch (valueWidth) {
- case UCPTRIE_VALUE_BITS_32:
- break;
- case UCPTRIE_VALUE_BITS_16:
- maskValues(0xffff);
- break;
- case UCPTRIE_VALUE_BITS_8:
- maskValues(0xff);
- break;
- default:
- break;
- }
-
- UChar32 fastLimit = type == UCPTRIE_TYPE_FAST ? BMP_LIMIT : UCPTRIE_SMALL_LIMIT;
- int32_t indexLength = compactTrie(fastLimit >> UCPTRIE_SHIFT_3, errorCode);
- if (U_FAILURE(errorCode)) {
- clear();
- return nullptr;
- }
-
- // Ensure data table alignment: The index length must be even for uint32_t data.
- if (valueWidth == UCPTRIE_VALUE_BITS_32 && (indexLength & 1) != 0) {
- index16[indexLength++] = 0xffee; // arbitrary value
- }
-
- // Make the total trie structure length a multiple of 4 bytes by padding the data table,
- // and store special values as the last two data values.
- int32_t length = indexLength * 2;
- if (valueWidth == UCPTRIE_VALUE_BITS_16) {
- if (((indexLength ^ dataLength) & 1) != 0) {
- // padding
- data[dataLength++] = errorValue;
- }
- if (data[dataLength - 1] != errorValue || data[dataLength - 2] != highValue) {
- data[dataLength++] = highValue;
- data[dataLength++] = errorValue;
- }
- length += dataLength * 2;
- } else if (valueWidth == UCPTRIE_VALUE_BITS_32) {
- // 32-bit data words never need padding to a multiple of 4 bytes.
- if (data[dataLength - 1] != errorValue || data[dataLength - 2] != highValue) {
- if (data[dataLength - 1] != highValue) {
- data[dataLength++] = highValue;
- }
- data[dataLength++] = errorValue;
- }
- length += dataLength * 4;
- } else {
- int32_t and3 = (length + dataLength) & 3;
- if (and3 == 0 && data[dataLength - 1] == errorValue && data[dataLength - 2] == highValue) {
- // all set
- } else if(and3 == 3 && data[dataLength - 1] == highValue) {
- data[dataLength++] = errorValue;
- } else {
- while (and3 != 2) {
- data[dataLength++] = highValue;
- and3 = (and3 + 1) & 3;
- }
- data[dataLength++] = highValue;
- data[dataLength++] = errorValue;
- }
- length += dataLength;
- }
-
- // Calculate the total length of the UCPTrie as a single memory block.
- length += sizeof(UCPTrie);
- U_ASSERT((length & 3) == 0);
-
- uint8_t *bytes = (uint8_t *)uprv_malloc(length);
- if (bytes == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- clear();
- return nullptr;
- }
- UCPTrie *trie = reinterpret_cast<UCPTrie *>(bytes);
- uprv_memset(trie, 0, sizeof(UCPTrie));
- trie->indexLength = indexLength;
- trie->dataLength = dataLength;
-
- trie->highStart = highStart;
- // Round up shifted12HighStart to a multiple of 0x1000 for easy testing from UTF-8 lead bytes.
- // Runtime code needs to then test for the real highStart as well.
- trie->shifted12HighStart = (highStart + 0xfff) >> 12;
- trie->type = type;
- trie->valueWidth = valueWidth;
-
- trie->index3NullOffset = index3NullOffset;
- trie->dataNullOffset = dataNullOffset;
- trie->nullValue = initialValue;
-
- bytes += sizeof(UCPTrie);
-
- // Fill the index and data arrays.
- uint16_t *dest16 = (uint16_t *)bytes;
- trie->index = dest16;
-
- if (highStart <= fastLimit) {
- // Condense only the fast index from the mutable-trie index.
- for (int32_t i = 0, j = 0; j < indexLength; i += SMALL_DATA_BLOCKS_PER_BMP_BLOCK, ++j) {
- *dest16++ = (uint16_t)index[i]; // dest16[j]
- }
- } else {
- uprv_memcpy(dest16, index16, indexLength * 2);
- dest16 += indexLength;
- }
- bytes += indexLength * 2;
-
- // Write the data array.
- const uint32_t *p = data;
- switch (valueWidth) {
- case UCPTRIE_VALUE_BITS_16:
- // Write 16-bit data values.
- trie->data.ptr16 = dest16;
- for (int32_t i = dataLength; i > 0; --i) {
- *dest16++ = (uint16_t)*p++;
- }
- break;
- case UCPTRIE_VALUE_BITS_32:
- // Write 32-bit data values.
- trie->data.ptr32 = (uint32_t *)bytes;
- uprv_memcpy(bytes, p, (size_t)dataLength * 4);
- break;
- case UCPTRIE_VALUE_BITS_8:
- // Write 8-bit data values.
- trie->data.ptr8 = bytes;
- for (int32_t i = dataLength; i > 0; --i) {
- *bytes++ = (uint8_t)*p++;
- }
- break;
- default:
- // Will not occur, valueWidth checked at the beginning.
- break;
- }
-
-#ifdef UCPTRIE_DEBUG
- trie->name = name;
-
- ucptrie_printLengths(trie, "");
-#endif
-
- clear();
- return trie;
-}
-
-} // namespace
-
-U_NAMESPACE_END
-
-U_NAMESPACE_USE
-
-U_CAPI UMutableCPTrie * U_EXPORT2
-umutablecptrie_open(uint32_t initialValue, uint32_t errorValue, UErrorCode *pErrorCode) {
- if (U_FAILURE(*pErrorCode)) {
- return nullptr;
- }
- LocalPointer<MutableCodePointTrie> trie(
- new MutableCodePointTrie(initialValue, errorValue, *pErrorCode), *pErrorCode);
- if (U_FAILURE(*pErrorCode)) {
- return nullptr;
- }
- return reinterpret_cast<UMutableCPTrie *>(trie.orphan());
-}
-
-U_CAPI UMutableCPTrie * U_EXPORT2
-umutablecptrie_clone(const UMutableCPTrie *other, UErrorCode *pErrorCode) {
- if (U_FAILURE(*pErrorCode)) {
- return nullptr;
- }
- if (other == nullptr) {
- return nullptr;
- }
- LocalPointer<MutableCodePointTrie> clone(
- new MutableCodePointTrie(*reinterpret_cast<const MutableCodePointTrie *>(other), *pErrorCode), *pErrorCode);
- if (U_FAILURE(*pErrorCode)) {
- return nullptr;
- }
- return reinterpret_cast<UMutableCPTrie *>(clone.orphan());
-}
-
-U_CAPI void U_EXPORT2
-umutablecptrie_close(UMutableCPTrie *trie) {
- delete reinterpret_cast<MutableCodePointTrie *>(trie);
-}
-
-U_CAPI UMutableCPTrie * U_EXPORT2
-umutablecptrie_fromUCPMap(const UCPMap *map, UErrorCode *pErrorCode) {
- if (U_FAILURE(*pErrorCode)) {
- return nullptr;
- }
- if (map == nullptr) {
- *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
- }
- return reinterpret_cast<UMutableCPTrie *>(MutableCodePointTrie::fromUCPMap(map, *pErrorCode));
-}
-
-U_CAPI UMutableCPTrie * U_EXPORT2
-umutablecptrie_fromUCPTrie(const UCPTrie *trie, UErrorCode *pErrorCode) {
- if (U_FAILURE(*pErrorCode)) {
- return nullptr;
- }
- if (trie == nullptr) {
- *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
- }
- return reinterpret_cast<UMutableCPTrie *>(MutableCodePointTrie::fromUCPTrie(trie, *pErrorCode));
-}
-
-U_CAPI uint32_t U_EXPORT2
-umutablecptrie_get(const UMutableCPTrie *trie, UChar32 c) {
- return reinterpret_cast<const MutableCodePointTrie *>(trie)->get(c);
-}
-
-namespace {
-
-UChar32 getRange(const void *trie, UChar32 start,
- UCPMapValueFilter *filter, const void *context, uint32_t *pValue) {
- return reinterpret_cast<const MutableCodePointTrie *>(trie)->
- getRange(start, filter, context, pValue);
-}
-
-} // namespace
-
-U_CAPI UChar32 U_EXPORT2
-umutablecptrie_getRange(const UMutableCPTrie *trie, UChar32 start,
- UCPMapRangeOption option, uint32_t surrogateValue,
- UCPMapValueFilter *filter, const void *context, uint32_t *pValue) {
- return ucptrie_internalGetRange(getRange, trie, start,
- option, surrogateValue,
- filter, context, pValue);
-}
-
-U_CAPI void U_EXPORT2
-umutablecptrie_set(UMutableCPTrie *trie, UChar32 c, uint32_t value, UErrorCode *pErrorCode) {
- if (U_FAILURE(*pErrorCode)) {
- return;
- }
- reinterpret_cast<MutableCodePointTrie *>(trie)->set(c, value, *pErrorCode);
-}
-
-U_CAPI void U_EXPORT2
-umutablecptrie_setRange(UMutableCPTrie *trie, UChar32 start, UChar32 end,
- uint32_t value, UErrorCode *pErrorCode) {
- if (U_FAILURE(*pErrorCode)) {
- return;
- }
- reinterpret_cast<MutableCodePointTrie *>(trie)->setRange(start, end, value, *pErrorCode);
-}
-
-/* Compact and internally serialize the trie. */
-U_CAPI UCPTrie * U_EXPORT2
-umutablecptrie_buildImmutable(UMutableCPTrie *trie, UCPTrieType type, UCPTrieValueWidth valueWidth,
- UErrorCode *pErrorCode) {
- if (U_FAILURE(*pErrorCode)) {
- return nullptr;
- }
- return reinterpret_cast<MutableCodePointTrie *>(trie)->build(type, valueWidth, *pErrorCode);
-}
-
-#ifdef UCPTRIE_DEBUG
-U_CFUNC void umutablecptrie_setName(UMutableCPTrie *trie, const char *name) {
- reinterpret_cast<MutableCodePointTrie *>(trie)->name = name;
-}
-#endif
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// umutablecptrie.cpp (inspired by utrie2_builder.cpp)
+// created: 2017dec29 Markus W. Scherer
+
+// #define UCPTRIE_DEBUG
+#ifdef UCPTRIE_DEBUG
+# include <stdio.h>
+#endif
+
+#include "unicode/utypes.h"
+#include "unicode/ucptrie.h"
+#include "unicode/umutablecptrie.h"
+#include "unicode/uobject.h"
+#include "unicode/utf16.h"
+#include "cmemory.h"
+#include "uassert.h"
+#include "ucptrie_impl.h"
+
+// ICU-20235 In case Microsoft math.h has defined this, undefine it.
+#ifdef OVERFLOW
+#undef OVERFLOW
+#endif
+
+U_NAMESPACE_BEGIN
+
+namespace {
+
+constexpr int32_t MAX_UNICODE = 0x10ffff;
+
+constexpr int32_t UNICODE_LIMIT = 0x110000;
+constexpr int32_t BMP_LIMIT = 0x10000;
+constexpr int32_t ASCII_LIMIT = 0x80;
+
+constexpr int32_t I_LIMIT = UNICODE_LIMIT >> UCPTRIE_SHIFT_3;
+constexpr int32_t BMP_I_LIMIT = BMP_LIMIT >> UCPTRIE_SHIFT_3;
+constexpr int32_t ASCII_I_LIMIT = ASCII_LIMIT >> UCPTRIE_SHIFT_3;
+
+constexpr int32_t SMALL_DATA_BLOCKS_PER_BMP_BLOCK = (1 << (UCPTRIE_FAST_SHIFT - UCPTRIE_SHIFT_3));
+
+// Flag values for data blocks.
+constexpr uint8_t ALL_SAME = 0;
+constexpr uint8_t MIXED = 1;
+constexpr uint8_t SAME_AS = 2;
+
+/** Start with allocation of 16k data entries. */
+constexpr int32_t INITIAL_DATA_LENGTH = ((int32_t)1 << 14);
+
+/** Grow about 8x each time. */
+constexpr int32_t MEDIUM_DATA_LENGTH = ((int32_t)1 << 17);
+
+/**
+ * Maximum length of the build-time data array.
+ * One entry per 0x110000 code points.
+ */
+constexpr int32_t MAX_DATA_LENGTH = UNICODE_LIMIT;
+
+// Flag values for index-3 blocks while compacting/building.
+constexpr uint8_t I3_NULL = 0;
+constexpr uint8_t I3_BMP = 1;
+constexpr uint8_t I3_16 = 2;
+constexpr uint8_t I3_18 = 3;
+
+constexpr int32_t INDEX_3_18BIT_BLOCK_LENGTH = UCPTRIE_INDEX_3_BLOCK_LENGTH + UCPTRIE_INDEX_3_BLOCK_LENGTH / 8;
+
+class AllSameBlocks;
+class MixedBlocks;
+
+class MutableCodePointTrie : public UMemory {
+public:
+ MutableCodePointTrie(uint32_t initialValue, uint32_t errorValue, UErrorCode &errorCode);
+ MutableCodePointTrie(const MutableCodePointTrie &other, UErrorCode &errorCode);
+ MutableCodePointTrie(const MutableCodePointTrie &other) = delete;
+ ~MutableCodePointTrie();
+
+ MutableCodePointTrie &operator=(const MutableCodePointTrie &other) = delete;
+
+ static MutableCodePointTrie *fromUCPMap(const UCPMap *map, UErrorCode &errorCode);
+ static MutableCodePointTrie *fromUCPTrie(const UCPTrie *trie, UErrorCode &errorCode);
+
+ uint32_t get(UChar32 c) const;
+ int32_t getRange(UChar32 start, UCPMapValueFilter *filter, const void *context,
+ uint32_t *pValue) const;
+
+ void set(UChar32 c, uint32_t value, UErrorCode &errorCode);
+ void setRange(UChar32 start, UChar32 end, uint32_t value, UErrorCode &errorCode);
+
+ UCPTrie *build(UCPTrieType type, UCPTrieValueWidth valueWidth, UErrorCode &errorCode);
+
+private:
+ void clear();
+
+ bool ensureHighStart(UChar32 c);
+ int32_t allocDataBlock(int32_t blockLength);
+ int32_t getDataBlock(int32_t i);
+
+ void maskValues(uint32_t mask);
+ UChar32 findHighStart() const;
+ int32_t compactWholeDataBlocks(int32_t fastILimit, AllSameBlocks &allSameBlocks);
+ int32_t compactData(
+ int32_t fastILimit, uint32_t *newData, int32_t newDataCapacity,
+ int32_t dataNullIndex, MixedBlocks &mixedBlocks, UErrorCode &errorCode);
+ int32_t compactIndex(int32_t fastILimit, MixedBlocks &mixedBlocks, UErrorCode &errorCode);
+ int32_t compactTrie(int32_t fastILimit, UErrorCode &errorCode);
+
+ uint32_t *index = nullptr;
+ int32_t indexCapacity = 0;
+ int32_t index3NullOffset = -1;
+ uint32_t *data = nullptr;
+ int32_t dataCapacity = 0;
+ int32_t dataLength = 0;
+ int32_t dataNullOffset = -1;
+
+ uint32_t origInitialValue;
+ uint32_t initialValue;
+ uint32_t errorValue;
+ UChar32 highStart;
+ uint32_t highValue;
+#ifdef UCPTRIE_DEBUG
+public:
+ const char *name;
+#endif
+private:
+ /** Temporary array while building the final data. */
+ uint16_t *index16 = nullptr;
+ uint8_t flags[UNICODE_LIMIT >> UCPTRIE_SHIFT_3];
+};
+
+MutableCodePointTrie::MutableCodePointTrie(uint32_t iniValue, uint32_t errValue, UErrorCode &errorCode) :
+ origInitialValue(iniValue), initialValue(iniValue), errorValue(errValue),
+ highStart(0), highValue(initialValue)
+#ifdef UCPTRIE_DEBUG
+ , name("open")
+#endif
+ {
+ if (U_FAILURE(errorCode)) { return; }
+ index = (uint32_t *)uprv_malloc(BMP_I_LIMIT * 4);
+ data = (uint32_t *)uprv_malloc(INITIAL_DATA_LENGTH * 4);
+ if (index == nullptr || data == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ indexCapacity = BMP_I_LIMIT;
+ dataCapacity = INITIAL_DATA_LENGTH;
+}
+
+MutableCodePointTrie::MutableCodePointTrie(const MutableCodePointTrie &other, UErrorCode &errorCode) :
+ index3NullOffset(other.index3NullOffset),
+ dataNullOffset(other.dataNullOffset),
+ origInitialValue(other.origInitialValue), initialValue(other.initialValue),
+ errorValue(other.errorValue),
+ highStart(other.highStart), highValue(other.highValue)
+#ifdef UCPTRIE_DEBUG
+ , name("mutable clone")
+#endif
+ {
+ if (U_FAILURE(errorCode)) { return; }
+ int32_t iCapacity = highStart <= BMP_LIMIT ? BMP_I_LIMIT : I_LIMIT;
+ index = (uint32_t *)uprv_malloc(iCapacity * 4);
+ data = (uint32_t *)uprv_malloc(other.dataCapacity * 4);
+ if (index == nullptr || data == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ indexCapacity = iCapacity;
+ dataCapacity = other.dataCapacity;
+
+ int32_t iLimit = highStart >> UCPTRIE_SHIFT_3;
+ uprv_memcpy(flags, other.flags, iLimit);
+ uprv_memcpy(index, other.index, iLimit * 4);
+ uprv_memcpy(data, other.data, (size_t)other.dataLength * 4);
+ dataLength = other.dataLength;
+ U_ASSERT(other.index16 == nullptr);
+}
+
+MutableCodePointTrie::~MutableCodePointTrie() {
+ uprv_free(index);
+ uprv_free(data);
+ uprv_free(index16);
+}
+
+MutableCodePointTrie *MutableCodePointTrie::fromUCPMap(const UCPMap *map, UErrorCode &errorCode) {
+ // Use the highValue as the initialValue to reduce the highStart.
+ uint32_t errorValue = ucpmap_get(map, -1);
+ uint32_t initialValue = ucpmap_get(map, 0x10ffff);
+ LocalPointer<MutableCodePointTrie> mutableTrie(
+ new MutableCodePointTrie(initialValue, errorValue, errorCode),
+ errorCode);
+ if (U_FAILURE(errorCode)) {
+ return nullptr;
+ }
+ UChar32 start = 0, end;
+ uint32_t value;
+ while ((end = ucpmap_getRange(map, start, UCPMAP_RANGE_NORMAL, 0,
+ nullptr, nullptr, &value)) >= 0) {
+ if (value != initialValue) {
+ if (start == end) {
+ mutableTrie->set(start, value, errorCode);
+ } else {
+ mutableTrie->setRange(start, end, value, errorCode);
+ }
+ }
+ start = end + 1;
+ }
+ if (U_SUCCESS(errorCode)) {
+ return mutableTrie.orphan();
+ } else {
+ return nullptr;
+ }
+}
+
+MutableCodePointTrie *MutableCodePointTrie::fromUCPTrie(const UCPTrie *trie, UErrorCode &errorCode) {
+ // Use the highValue as the initialValue to reduce the highStart.
+ uint32_t errorValue;
+ uint32_t initialValue;
+ switch (trie->valueWidth) {
+ case UCPTRIE_VALUE_BITS_16:
+ errorValue = trie->data.ptr16[trie->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET];
+ initialValue = trie->data.ptr16[trie->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET];
+ break;
+ case UCPTRIE_VALUE_BITS_32:
+ errorValue = trie->data.ptr32[trie->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET];
+ initialValue = trie->data.ptr32[trie->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET];
+ break;
+ case UCPTRIE_VALUE_BITS_8:
+ errorValue = trie->data.ptr8[trie->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET];
+ initialValue = trie->data.ptr8[trie->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET];
+ break;
+ default:
+ // Unreachable if the trie is properly initialized.
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return nullptr;
+ }
+ LocalPointer<MutableCodePointTrie> mutableTrie(
+ new MutableCodePointTrie(initialValue, errorValue, errorCode),
+ errorCode);
+ if (U_FAILURE(errorCode)) {
+ return nullptr;
+ }
+ UChar32 start = 0, end;
+ uint32_t value;
+ while ((end = ucptrie_getRange(trie, start, UCPMAP_RANGE_NORMAL, 0,
+ nullptr, nullptr, &value)) >= 0) {
+ if (value != initialValue) {
+ if (start == end) {
+ mutableTrie->set(start, value, errorCode);
+ } else {
+ mutableTrie->setRange(start, end, value, errorCode);
+ }
+ }
+ start = end + 1;
+ }
+ if (U_SUCCESS(errorCode)) {
+ return mutableTrie.orphan();
+ } else {
+ return nullptr;
+ }
+}
+
+void MutableCodePointTrie::clear() {
+ index3NullOffset = dataNullOffset = -1;
+ dataLength = 0;
+ highValue = initialValue = origInitialValue;
+ highStart = 0;
+ uprv_free(index16);
+ index16 = nullptr;
+}
+
+uint32_t MutableCodePointTrie::get(UChar32 c) const {
+ if ((uint32_t)c > MAX_UNICODE) {
+ return errorValue;
+ }
+ if (c >= highStart) {
+ return highValue;
+ }
+ int32_t i = c >> UCPTRIE_SHIFT_3;
+ if (flags[i] == ALL_SAME) {
+ return index[i];
+ } else {
+ return data[index[i] + (c & UCPTRIE_SMALL_DATA_MASK)];
+ }
+}
+
+inline uint32_t maybeFilterValue(uint32_t value, uint32_t initialValue, uint32_t nullValue,
+ UCPMapValueFilter *filter, const void *context) {
+ if (value == initialValue) {
+ value = nullValue;
+ } else if (filter != nullptr) {
+ value = filter(context, value);
+ }
+ return value;
+}
+
+UChar32 MutableCodePointTrie::getRange(
+ UChar32 start, UCPMapValueFilter *filter, const void *context,
+ uint32_t *pValue) const {
+ if ((uint32_t)start > MAX_UNICODE) {
+ return U_SENTINEL;
+ }
+ if (start >= highStart) {
+ if (pValue != nullptr) {
+ uint32_t value = highValue;
+ if (filter != nullptr) { value = filter(context, value); }
+ *pValue = value;
+ }
+ return MAX_UNICODE;
+ }
+ uint32_t nullValue = initialValue;
+ if (filter != nullptr) { nullValue = filter(context, nullValue); }
+ UChar32 c = start;
+ uint32_t trieValue, value;
+ bool haveValue = false;
+ int32_t i = c >> UCPTRIE_SHIFT_3;
+ do {
+ if (flags[i] == ALL_SAME) {
+ uint32_t trieValue2 = index[i];
+ if (haveValue) {
+ if (trieValue2 != trieValue) {
+ if (filter == nullptr ||
+ maybeFilterValue(trieValue2, initialValue, nullValue,
+ filter, context) != value) {
+ return c - 1;
+ }
+ trieValue = trieValue2; // may or may not help
+ }
+ } else {
+ trieValue = trieValue2;
+ value = maybeFilterValue(trieValue2, initialValue, nullValue, filter, context);
+ if (pValue != nullptr) { *pValue = value; }
+ haveValue = true;
+ }
+ c = (c + UCPTRIE_SMALL_DATA_BLOCK_LENGTH) & ~UCPTRIE_SMALL_DATA_MASK;
+ } else /* MIXED */ {
+ int32_t di = index[i] + (c & UCPTRIE_SMALL_DATA_MASK);
+ uint32_t trieValue2 = data[di];
+ if (haveValue) {
+ if (trieValue2 != trieValue) {
+ if (filter == nullptr ||
+ maybeFilterValue(trieValue2, initialValue, nullValue,
+ filter, context) != value) {
+ return c - 1;
+ }
+ trieValue = trieValue2; // may or may not help
+ }
+ } else {
+ trieValue = trieValue2;
+ value = maybeFilterValue(trieValue2, initialValue, nullValue, filter, context);
+ if (pValue != nullptr) { *pValue = value; }
+ haveValue = true;
+ }
+ while ((++c & UCPTRIE_SMALL_DATA_MASK) != 0) {
+ trieValue2 = data[++di];
+ if (trieValue2 != trieValue) {
+ if (filter == nullptr ||
+ maybeFilterValue(trieValue2, initialValue, nullValue,
+ filter, context) != value) {
+ return c - 1;
+ }
+ }
+ trieValue = trieValue2; // may or may not help
+ }
+ }
+ ++i;
+ } while (c < highStart);
+ U_ASSERT(haveValue);
+ if (maybeFilterValue(highValue, initialValue, nullValue,
+ filter, context) != value) {
+ return c - 1;
+ } else {
+ return MAX_UNICODE;
+ }
+}
+
+void
+writeBlock(uint32_t *block, uint32_t value) {
+ uint32_t *limit = block + UCPTRIE_SMALL_DATA_BLOCK_LENGTH;
+ while (block < limit) {
+ *block++ = value;
+ }
+}
+
+bool MutableCodePointTrie::ensureHighStart(UChar32 c) {
+ if (c >= highStart) {
+ // Round up to a UCPTRIE_CP_PER_INDEX_2_ENTRY boundary to simplify compaction.
+ c = (c + UCPTRIE_CP_PER_INDEX_2_ENTRY) & ~(UCPTRIE_CP_PER_INDEX_2_ENTRY - 1);
+ int32_t i = highStart >> UCPTRIE_SHIFT_3;
+ int32_t iLimit = c >> UCPTRIE_SHIFT_3;
+ if (iLimit > indexCapacity) {
+ uint32_t *newIndex = (uint32_t *)uprv_malloc(I_LIMIT * 4);
+ if (newIndex == nullptr) { return false; }
+ uprv_memcpy(newIndex, index, i * 4);
+ uprv_free(index);
+ index = newIndex;
+ indexCapacity = I_LIMIT;
+ }
+ do {
+ flags[i] = ALL_SAME;
+ index[i] = initialValue;
+ } while(++i < iLimit);
+ highStart = c;
+ }
+ return true;
+}
+
+int32_t MutableCodePointTrie::allocDataBlock(int32_t blockLength) {
+ int32_t newBlock = dataLength;
+ int32_t newTop = newBlock + blockLength;
+ if (newTop > dataCapacity) {
+ int32_t capacity;
+ if (dataCapacity < MEDIUM_DATA_LENGTH) {
+ capacity = MEDIUM_DATA_LENGTH;
+ } else if (dataCapacity < MAX_DATA_LENGTH) {
+ capacity = MAX_DATA_LENGTH;
+ } else {
+ // Should never occur.
+ // Either MAX_DATA_LENGTH is incorrect,
+ // or the code writes more values than should be possible.
+ return -1;
+ }
+ uint32_t *newData = (uint32_t *)uprv_malloc(capacity * 4);
+ if (newData == nullptr) {
+ return -1;
+ }
+ uprv_memcpy(newData, data, (size_t)dataLength * 4);
+ uprv_free(data);
+ data = newData;
+ dataCapacity = capacity;
+ }
+ dataLength = newTop;
+ return newBlock;
+}
+
+/**
+ * No error checking for illegal arguments.
+ *
+ * @return -1 if no new data block available (out of memory in data array)
+ * @internal
+ */
+int32_t MutableCodePointTrie::getDataBlock(int32_t i) {
+ if (flags[i] == MIXED) {
+ return index[i];
+ }
+ if (i < BMP_I_LIMIT) {
+ int32_t newBlock = allocDataBlock(UCPTRIE_FAST_DATA_BLOCK_LENGTH);
+ if (newBlock < 0) { return newBlock; }
+ int32_t iStart = i & ~(SMALL_DATA_BLOCKS_PER_BMP_BLOCK -1);
+ int32_t iLimit = iStart + SMALL_DATA_BLOCKS_PER_BMP_BLOCK;
+ do {
+ U_ASSERT(flags[iStart] == ALL_SAME);
+ writeBlock(data + newBlock, index[iStart]);
+ flags[iStart] = MIXED;
+ index[iStart++] = newBlock;
+ newBlock += UCPTRIE_SMALL_DATA_BLOCK_LENGTH;
+ } while (iStart < iLimit);
+ return index[i];
+ } else {
+ int32_t newBlock = allocDataBlock(UCPTRIE_SMALL_DATA_BLOCK_LENGTH);
+ if (newBlock < 0) { return newBlock; }
+ writeBlock(data + newBlock, index[i]);
+ flags[i] = MIXED;
+ index[i] = newBlock;
+ return newBlock;
+ }
+}
+
+void MutableCodePointTrie::set(UChar32 c, uint32_t value, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) {
+ return;
+ }
+ if ((uint32_t)c > MAX_UNICODE) {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ int32_t block;
+ if (!ensureHighStart(c) || (block = getDataBlock(c >> UCPTRIE_SHIFT_3)) < 0) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+
+ data[block + (c & UCPTRIE_SMALL_DATA_MASK)] = value;
+}
+
+void
+fillBlock(uint32_t *block, UChar32 start, UChar32 limit, uint32_t value) {
+ uint32_t *pLimit = block + limit;
+ block += start;
+ while (block < pLimit) {
+ *block++ = value;
+ }
+}
+
+void MutableCodePointTrie::setRange(UChar32 start, UChar32 end, uint32_t value, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) {
+ return;
+ }
+ if ((uint32_t)start > MAX_UNICODE || (uint32_t)end > MAX_UNICODE || start > end) {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ if (!ensureHighStart(end)) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+
+ UChar32 limit = end + 1;
+ if (start & UCPTRIE_SMALL_DATA_MASK) {
+ // Set partial block at [start..following block boundary[.
+ int32_t block = getDataBlock(start >> UCPTRIE_SHIFT_3);
+ if (block < 0) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+
+ UChar32 nextStart = (start + UCPTRIE_SMALL_DATA_MASK) & ~UCPTRIE_SMALL_DATA_MASK;
+ if (nextStart <= limit) {
+ fillBlock(data + block, start & UCPTRIE_SMALL_DATA_MASK, UCPTRIE_SMALL_DATA_BLOCK_LENGTH,
+ value);
+ start = nextStart;
+ } else {
+ fillBlock(data + block, start & UCPTRIE_SMALL_DATA_MASK, limit & UCPTRIE_SMALL_DATA_MASK,
+ value);
+ return;
+ }
+ }
+
+ // Number of positions in the last, partial block.
+ int32_t rest = limit & UCPTRIE_SMALL_DATA_MASK;
+
+ // Round down limit to a block boundary.
+ limit &= ~UCPTRIE_SMALL_DATA_MASK;
+
+ // Iterate over all-value blocks.
+ while (start < limit) {
+ int32_t i = start >> UCPTRIE_SHIFT_3;
+ if (flags[i] == ALL_SAME) {
+ index[i] = value;
+ } else /* MIXED */ {
+ fillBlock(data + index[i], 0, UCPTRIE_SMALL_DATA_BLOCK_LENGTH, value);
+ }
+ start += UCPTRIE_SMALL_DATA_BLOCK_LENGTH;
+ }
+
+ if (rest > 0) {
+ // Set partial block at [last block boundary..limit[.
+ int32_t block = getDataBlock(start >> UCPTRIE_SHIFT_3);
+ if (block < 0) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+
+ fillBlock(data + block, 0, rest, value);
+ }
+}
+
+/* compaction --------------------------------------------------------------- */
+
+void MutableCodePointTrie::maskValues(uint32_t mask) {
+ initialValue &= mask;
+ errorValue &= mask;
+ highValue &= mask;
+ int32_t iLimit = highStart >> UCPTRIE_SHIFT_3;
+ for (int32_t i = 0; i < iLimit; ++i) {
+ if (flags[i] == ALL_SAME) {
+ index[i] &= mask;
+ }
+ }
+ for (int32_t i = 0; i < dataLength; ++i) {
+ data[i] &= mask;
+ }
+}
+
+template<typename UIntA, typename UIntB>
+bool equalBlocks(const UIntA *s, const UIntB *t, int32_t length) {
+ while (length > 0 && *s == *t) {
+ ++s;
+ ++t;
+ --length;
+ }
+ return length == 0;
+}
+
+bool allValuesSameAs(const uint32_t *p, int32_t length, uint32_t value) {
+ const uint32_t *pLimit = p + length;
+ while (p < pLimit && *p == value) { ++p; }
+ return p == pLimit;
+}
+
+/** Search for an identical block. */
+int32_t findSameBlock(const uint16_t *p, int32_t pStart, int32_t length,
+ const uint16_t *q, int32_t qStart, int32_t blockLength) {
+ // Ensure that we do not even partially get past length.
+ length -= blockLength;
+
+ q += qStart;
+ while (pStart <= length) {
+ if (equalBlocks(p + pStart, q, blockLength)) {
+ return pStart;
+ }
+ ++pStart;
+ }
+ return -1;
+}
+
+int32_t findAllSameBlock(const uint32_t *p, int32_t start, int32_t limit,
+ uint32_t value, int32_t blockLength) {
+ // Ensure that we do not even partially get past limit.
+ limit -= blockLength;
+
+ for (int32_t block = start; block <= limit; ++block) {
+ if (p[block] == value) {
+ for (int32_t i = 1;; ++i) {
+ if (i == blockLength) {
+ return block;
+ }
+ if (p[block + i] != value) {
+ block += i;
+ break;
+ }
+ }
+ }
+ }
+ return -1;
+}
+
+/**
+ * Look for maximum overlap of the beginning of the other block
+ * with the previous, adjacent block.
+ */
+template<typename UIntA, typename UIntB>
+int32_t getOverlap(const UIntA *p, int32_t length,
+ const UIntB *q, int32_t qStart, int32_t blockLength) {
+ int32_t overlap = blockLength - 1;
+ U_ASSERT(overlap <= length);
+ q += qStart;
+ while (overlap > 0 && !equalBlocks(p + (length - overlap), q, overlap)) {
+ --overlap;
+ }
+ return overlap;
+}
+
+int32_t getAllSameOverlap(const uint32_t *p, int32_t length, uint32_t value,
+ int32_t blockLength) {
+ int32_t min = length - (blockLength - 1);
+ int32_t i = length;
+ while (min < i && p[i - 1] == value) { --i; }
+ return length - i;
+}
+
+bool isStartOfSomeFastBlock(uint32_t dataOffset, const uint32_t index[], int32_t fastILimit) {
+ for (int32_t i = 0; i < fastILimit; i += SMALL_DATA_BLOCKS_PER_BMP_BLOCK) {
+ if (index[i] == dataOffset) {
+ return true;
+ }
+ }
+ return false;
+}
+
+/**
+ * Finds the start of the last range in the trie by enumerating backward.
+ * Indexes for code points higher than this will be omitted.
+ */
+UChar32 MutableCodePointTrie::findHighStart() const {
+ int32_t i = highStart >> UCPTRIE_SHIFT_3;
+ while (i > 0) {
+ bool match;
+ if (flags[--i] == ALL_SAME) {
+ match = index[i] == highValue;
+ } else /* MIXED */ {
+ const uint32_t *p = data + index[i];
+ for (int32_t j = 0;; ++j) {
+ if (j == UCPTRIE_SMALL_DATA_BLOCK_LENGTH) {
+ match = true;
+ break;
+ }
+ if (p[j] != highValue) {
+ match = false;
+ break;
+ }
+ }
+ }
+ if (!match) {
+ return (i + 1) << UCPTRIE_SHIFT_3;
+ }
+ }
+ return 0;
+}
+
+class AllSameBlocks {
+public:
+ static constexpr int32_t NEW_UNIQUE = -1;
+ static constexpr int32_t OVERFLOW = -2;
+
+ AllSameBlocks() : length(0), mostRecent(-1) {}
+
+ int32_t findOrAdd(int32_t index, int32_t count, uint32_t value) {
+ if (mostRecent >= 0 && values[mostRecent] == value) {
+ refCounts[mostRecent] += count;
+ return indexes[mostRecent];
+ }
+ for (int32_t i = 0; i < length; ++i) {
+ if (values[i] == value) {
+ mostRecent = i;
+ refCounts[i] += count;
+ return indexes[i];
+ }
+ }
+ if (length == CAPACITY) {
+ return OVERFLOW;
+ }
+ mostRecent = length;
+ indexes[length] = index;
+ values[length] = value;
+ refCounts[length++] = count;
+ return NEW_UNIQUE;
+ }
+
+ /** Replaces the block which has the lowest reference count. */
+ void add(int32_t index, int32_t count, uint32_t value) {
+ U_ASSERT(length == CAPACITY);
+ int32_t least = -1;
+ int32_t leastCount = I_LIMIT;
+ for (int32_t i = 0; i < length; ++i) {
+ U_ASSERT(values[i] != value);
+ if (refCounts[i] < leastCount) {
+ least = i;
+ leastCount = refCounts[i];
+ }
+ }
+ U_ASSERT(least >= 0);
+ mostRecent = least;
+ indexes[least] = index;
+ values[least] = value;
+ refCounts[least] = count;
+ }
+
+ int32_t findMostUsed() const {
+ if (length == 0) { return -1; }
+ int32_t max = -1;
+ int32_t maxCount = 0;
+ for (int32_t i = 0; i < length; ++i) {
+ if (refCounts[i] > maxCount) {
+ max = i;
+ maxCount = refCounts[i];
+ }
+ }
+ return indexes[max];
+ }
+
+private:
+ static constexpr int32_t CAPACITY = 32;
+
+ int32_t length;
+ int32_t mostRecent;
+
+ int32_t indexes[CAPACITY];
+ uint32_t values[CAPACITY];
+ int32_t refCounts[CAPACITY];
+};
+
+// Custom hash table for mixed-value blocks to be found anywhere in the
+// compacted data or index so far.
+class MixedBlocks {
+public:
+ MixedBlocks() {}
+ ~MixedBlocks() {
+ uprv_free(table);
+ }
+
+ bool init(int32_t maxLength, int32_t newBlockLength) {
+ // We store actual data indexes + 1 to reserve 0 for empty entries.
+ int32_t maxDataIndex = maxLength - newBlockLength + 1;
+ int32_t newLength;
+ if (maxDataIndex <= 0xfff) { // 4k
+ newLength = 6007;
+ shift = 12;
+ mask = 0xfff;
+ } else if (maxDataIndex <= 0x7fff) { // 32k
+ newLength = 50021;
+ shift = 15;
+ mask = 0x7fff;
+ } else if (maxDataIndex <= 0x1ffff) { // 128k
+ newLength = 200003;
+ shift = 17;
+ mask = 0x1ffff;
+ } else {
+ // maxDataIndex up to around MAX_DATA_LENGTH, ca. 1.1M
+ newLength = 1500007;
+ shift = 21;
+ mask = 0x1fffff;
+ }
+ if (newLength > capacity) {
+ uprv_free(table);
+ table = (uint32_t *)uprv_malloc(newLength * 4);
+ if (table == nullptr) {
+ return false;
+ }
+ capacity = newLength;
+ }
+ length = newLength;
+ uprv_memset(table, 0, length * 4);
+
+ blockLength = newBlockLength;
+ return true;
+ }
+
+ template<typename UInt>
+ void extend(const UInt *data, int32_t minStart, int32_t prevDataLength, int32_t newDataLength) {
+ int32_t start = prevDataLength - blockLength;
+ if (start >= minStart) {
+ ++start; // Skip the last block that we added last time.
+ } else {
+ start = minStart; // Begin with the first full block.
+ }
+ for (int32_t end = newDataLength - blockLength; start <= end; ++start) {
+ uint32_t hashCode = makeHashCode(data, start);
+ addEntry(data, start, hashCode, start);
+ }
+ }
+
+ template<typename UIntA, typename UIntB>
+ int32_t findBlock(const UIntA *data, const UIntB *blockData, int32_t blockStart) const {
+ uint32_t hashCode = makeHashCode(blockData, blockStart);
+ int32_t entryIndex = findEntry(data, blockData, blockStart, hashCode);
+ if (entryIndex >= 0) {
+ return (table[entryIndex] & mask) - 1;
+ } else {
+ return -1;
+ }
+ }
+
+ int32_t findAllSameBlock(const uint32_t *data, uint32_t blockValue) const {
+ uint32_t hashCode = makeHashCode(blockValue);
+ int32_t entryIndex = findEntry(data, blockValue, hashCode);
+ if (entryIndex >= 0) {
+ return (table[entryIndex] & mask) - 1;
+ } else {
+ return -1;
+ }
+ }
+
+private:
+ template<typename UInt>
+ uint32_t makeHashCode(const UInt *blockData, int32_t blockStart) const {
+ int32_t blockLimit = blockStart + blockLength;
+ uint32_t hashCode = blockData[blockStart++];
+ do {
+ hashCode = 37 * hashCode + blockData[blockStart++];
+ } while (blockStart < blockLimit);
+ return hashCode;
+ }
+
+ uint32_t makeHashCode(uint32_t blockValue) const {
+ uint32_t hashCode = blockValue;
+ for (int32_t i = 1; i < blockLength; ++i) {
+ hashCode = 37 * hashCode + blockValue;
+ }
+ return hashCode;
+ }
+
+ template<typename UInt>
+ void addEntry(const UInt *data, int32_t blockStart, uint32_t hashCode, int32_t dataIndex) {
+ U_ASSERT(0 <= dataIndex && dataIndex < (int32_t)mask);
+ int32_t entryIndex = findEntry(data, data, blockStart, hashCode);
+ if (entryIndex < 0) {
+ table[~entryIndex] = (hashCode << shift) | (dataIndex + 1);
+ }
+ }
+
+ template<typename UIntA, typename UIntB>
+ int32_t findEntry(const UIntA *data, const UIntB *blockData, int32_t blockStart,
+ uint32_t hashCode) const {
+ uint32_t shiftedHashCode = hashCode << shift;
+ int32_t initialEntryIndex = (hashCode % (length - 1)) + 1; // 1..length-1
+ for (int32_t entryIndex = initialEntryIndex;;) {
+ uint32_t entry = table[entryIndex];
+ if (entry == 0) {
+ return ~entryIndex;
+ }
+ if ((entry & ~mask) == shiftedHashCode) {
+ int32_t dataIndex = (entry & mask) - 1;
+ if (equalBlocks(data + dataIndex, blockData + blockStart, blockLength)) {
+ return entryIndex;
+ }
+ }
+ entryIndex = nextIndex(initialEntryIndex, entryIndex);
+ }
+ }
+
+ int32_t findEntry(const uint32_t *data, uint32_t blockValue, uint32_t hashCode) const {
+ uint32_t shiftedHashCode = hashCode << shift;
+ int32_t initialEntryIndex = (hashCode % (length - 1)) + 1; // 1..length-1
+ for (int32_t entryIndex = initialEntryIndex;;) {
+ uint32_t entry = table[entryIndex];
+ if (entry == 0) {
+ return ~entryIndex;
+ }
+ if ((entry & ~mask) == shiftedHashCode) {
+ int32_t dataIndex = (entry & mask) - 1;
+ if (allValuesSameAs(data + dataIndex, blockLength, blockValue)) {
+ return entryIndex;
+ }
+ }
+ entryIndex = nextIndex(initialEntryIndex, entryIndex);
+ }
+ }
+
+ inline int32_t nextIndex(int32_t initialEntryIndex, int32_t entryIndex) const {
+ // U_ASSERT(0 < initialEntryIndex && initialEntryIndex < length);
+ return (entryIndex + initialEntryIndex) % length;
+ }
+
+ // Hash table.
+ // The length is a prime number, larger than the maximum data length.
+ // The "shift" lower bits store a data index + 1.
+ // The remaining upper bits store a partial hashCode of the block data values.
+ uint32_t *table = nullptr;
+ int32_t capacity = 0;
+ int32_t length = 0;
+ int32_t shift = 0;
+ uint32_t mask = 0;
+
+ int32_t blockLength = 0;
+};
+
+int32_t MutableCodePointTrie::compactWholeDataBlocks(int32_t fastILimit, AllSameBlocks &allSameBlocks) {
+#ifdef UCPTRIE_DEBUG
+ bool overflow = false;
+#endif
+
+ // ASCII data will be stored as a linear table, even if the following code
+ // does not yet count it that way.
+ int32_t newDataCapacity = ASCII_LIMIT;
+ // Add room for a small data null block in case it would match the start of
+ // a fast data block where dataNullOffset must not be set in that case.
+ newDataCapacity += UCPTRIE_SMALL_DATA_BLOCK_LENGTH;
+ // Add room for special values (errorValue, highValue) and padding.
+ newDataCapacity += 4;
+ int32_t iLimit = highStart >> UCPTRIE_SHIFT_3;
+ int32_t blockLength = UCPTRIE_FAST_DATA_BLOCK_LENGTH;
+ int32_t inc = SMALL_DATA_BLOCKS_PER_BMP_BLOCK;
+ for (int32_t i = 0; i < iLimit; i += inc) {
+ if (i == fastILimit) {
+ blockLength = UCPTRIE_SMALL_DATA_BLOCK_LENGTH;
+ inc = 1;
+ }
+ uint32_t value = index[i];
+ if (flags[i] == MIXED) {
+ // Really mixed?
+ const uint32_t *p = data + value;
+ value = *p;
+ if (allValuesSameAs(p + 1, blockLength - 1, value)) {
+ flags[i] = ALL_SAME;
+ index[i] = value;
+ // Fall through to ALL_SAME handling.
+ } else {
+ newDataCapacity += blockLength;
+ continue;
+ }
+ } else {
+ U_ASSERT(flags[i] == ALL_SAME);
+ if (inc > 1) {
+ // Do all of the fast-range data block's ALL_SAME parts have the same value?
+ bool allSame = true;
+ int32_t next_i = i + inc;
+ for (int32_t j = i + 1; j < next_i; ++j) {
+ U_ASSERT(flags[j] == ALL_SAME);
+ if (index[j] != value) {
+ allSame = false;
+ break;
+ }
+ }
+ if (!allSame) {
+ // Turn it into a MIXED block.
+ if (getDataBlock(i) < 0) {
+ return -1;
+ }
+ newDataCapacity += blockLength;
+ continue;
+ }
+ }
+ }
+ // Is there another ALL_SAME block with the same value?
+ int32_t other = allSameBlocks.findOrAdd(i, inc, value);
+ if (other == AllSameBlocks::OVERFLOW) {
+ // The fixed-size array overflowed. Slow check for a duplicate block.
+#ifdef UCPTRIE_DEBUG
+ if (!overflow) {
+ puts("UCPTrie AllSameBlocks overflow");
+ overflow = true;
+ }
+#endif
+ int32_t jInc = SMALL_DATA_BLOCKS_PER_BMP_BLOCK;
+ for (int32_t j = 0;; j += jInc) {
+ if (j == i) {
+ allSameBlocks.add(i, inc, value);
+ break;
+ }
+ if (j == fastILimit) {
+ jInc = 1;
+ }
+ if (flags[j] == ALL_SAME && index[j] == value) {
+ allSameBlocks.add(j, jInc + inc, value);
+ other = j;
+ break;
+ // We could keep counting blocks with the same value
+ // before we add the first one, which may improve compaction in rare cases,
+ // but it would make it slower.
+ }
+ }
+ }
+ if (other >= 0) {
+ flags[i] = SAME_AS;
+ index[i] = other;
+ } else {
+ // New unique same-value block.
+ newDataCapacity += blockLength;
+ }
+ }
+ return newDataCapacity;
+}
+
+#ifdef UCPTRIE_DEBUG
+# define DEBUG_DO(expr) expr
+#else
+# define DEBUG_DO(expr)
+#endif
+
+#ifdef UCPTRIE_DEBUG
+// Braille symbols: U+28xx = UTF-8 E2 A0 80..E2 A3 BF
+int32_t appendValue(char s[], int32_t length, uint32_t value) {
+ value ^= value >> 16;
+ value ^= value >> 8;
+ s[length] = 0xE2;
+ s[length + 1] = (char)(0xA0 + ((value >> 6) & 3));
+ s[length + 2] = (char)(0x80 + (value & 0x3F));
+ return length + 3;
+}
+
+void printBlock(const uint32_t *block, int32_t blockLength, uint32_t value,
+ UChar32 start, int32_t overlap, uint32_t initialValue) {
+ char s[UCPTRIE_FAST_DATA_BLOCK_LENGTH * 3 + 3];
+ int32_t length = 0;
+ int32_t i;
+ for (i = 0; i < overlap; ++i) {
+ length = appendValue(s, length, 0); // Braille blank
+ }
+ s[length++] = '|';
+ for (; i < blockLength; ++i) {
+ if (block != nullptr) {
+ value = block[i];
+ }
+ if (value == initialValue) {
+ value = 0x40; // Braille lower left dot
+ }
+ length = appendValue(s, length, value);
+ }
+ s[length] = 0;
+ start += overlap;
+ if (start <= 0xffff) {
+ printf(" %04lX %s|\n", (long)start, s);
+ } else if (start <= 0xfffff) {
+ printf(" %5lX %s|\n", (long)start, s);
+ } else {
+ printf(" %6lX %s|\n", (long)start, s);
+ }
+}
+#endif
+
+/**
+ * Compacts a build-time trie.
+ *
+ * The compaction
+ * - removes blocks that are identical with earlier ones
+ * - overlaps each new non-duplicate block as much as possible with the previously-written one
+ * - works with fast-range data blocks whose length is a multiple of that of
+ * higher-code-point data blocks
+ *
+ * It does not try to find an optimal order of writing, deduplicating, and overlapping blocks.
+ */
+int32_t MutableCodePointTrie::compactData(
+ int32_t fastILimit, uint32_t *newData, int32_t newDataCapacity,
+ int32_t dataNullIndex, MixedBlocks &mixedBlocks, UErrorCode &errorCode) {
+#ifdef UCPTRIE_DEBUG
+ int32_t countSame=0, sumOverlaps=0;
+ bool printData = dataLength == 29088 /* line.brk */ ||
+ // dataLength == 30048 /* CanonIterData */ ||
+ dataLength == 50400 /* zh.txt~stroke */;
+#endif
+
+ // The linear ASCII data has been copied into newData already.
+ int32_t newDataLength = 0;
+ for (int32_t i = 0; newDataLength < ASCII_LIMIT;
+ newDataLength += UCPTRIE_FAST_DATA_BLOCK_LENGTH, i += SMALL_DATA_BLOCKS_PER_BMP_BLOCK) {
+ index[i] = newDataLength;
+#ifdef UCPTRIE_DEBUG
+ if (printData) {
+ printBlock(newData + newDataLength, UCPTRIE_FAST_DATA_BLOCK_LENGTH, 0, newDataLength, 0, initialValue);
+ }
+#endif
+ }
+
+ int32_t blockLength = UCPTRIE_FAST_DATA_BLOCK_LENGTH;
+ if (!mixedBlocks.init(newDataCapacity, blockLength)) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return 0;
+ }
+ mixedBlocks.extend(newData, 0, 0, newDataLength);
+
+ int32_t iLimit = highStart >> UCPTRIE_SHIFT_3;
+ int32_t inc = SMALL_DATA_BLOCKS_PER_BMP_BLOCK;
+ int32_t fastLength = 0;
+ for (int32_t i = ASCII_I_LIMIT; i < iLimit; i += inc) {
+ if (i == fastILimit) {
+ blockLength = UCPTRIE_SMALL_DATA_BLOCK_LENGTH;
+ inc = 1;
+ fastLength = newDataLength;
+ if (!mixedBlocks.init(newDataCapacity, blockLength)) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return 0;
+ }
+ mixedBlocks.extend(newData, 0, 0, newDataLength);
+ }
+ if (flags[i] == ALL_SAME) {
+ uint32_t value = index[i];
+ // Find an earlier part of the data array of length blockLength
+ // that is filled with this value.
+ int32_t n = mixedBlocks.findAllSameBlock(newData, value);
+ // If we find a match, and the current block is the data null block,
+ // and it is not a fast block but matches the start of a fast block,
+ // then we need to continue looking.
+ // This is because this small block is shorter than the fast block,
+ // and not all of the rest of the fast block is filled with this value.
+ // Otherwise trie.getRange() would detect that the fast block starts at
+ // dataNullOffset and assume incorrectly that it is filled with the null value.
+ while (n >= 0 && i == dataNullIndex && i >= fastILimit && n < fastLength &&
+ isStartOfSomeFastBlock(n, index, fastILimit)) {
+ n = findAllSameBlock(newData, n + 1, newDataLength, value, blockLength);
+ }
+ if (n >= 0) {
+ DEBUG_DO(++countSame);
+ index[i] = n;
+ } else {
+ n = getAllSameOverlap(newData, newDataLength, value, blockLength);
+ DEBUG_DO(sumOverlaps += n);
+#ifdef UCPTRIE_DEBUG
+ if (printData) {
+ printBlock(nullptr, blockLength, value, i << UCPTRIE_SHIFT_3, n, initialValue);
+ }
+#endif
+ index[i] = newDataLength - n;
+ int32_t prevDataLength = newDataLength;
+ while (n < blockLength) {
+ newData[newDataLength++] = value;
+ ++n;
+ }
+ mixedBlocks.extend(newData, 0, prevDataLength, newDataLength);
+ }
+ } else if (flags[i] == MIXED) {
+ const uint32_t *block = data + index[i];
+ int32_t n = mixedBlocks.findBlock(newData, block, 0);
+ if (n >= 0) {
+ DEBUG_DO(++countSame);
+ index[i] = n;
+ } else {
+ n = getOverlap(newData, newDataLength, block, 0, blockLength);
+ DEBUG_DO(sumOverlaps += n);
+#ifdef UCPTRIE_DEBUG
+ if (printData) {
+ printBlock(block, blockLength, 0, i << UCPTRIE_SHIFT_3, n, initialValue);
+ }
+#endif
+ index[i] = newDataLength - n;
+ int32_t prevDataLength = newDataLength;
+ while (n < blockLength) {
+ newData[newDataLength++] = block[n++];
+ }
+ mixedBlocks.extend(newData, 0, prevDataLength, newDataLength);
+ }
+ } else /* SAME_AS */ {
+ uint32_t j = index[i];
+ index[i] = index[j];
+ }
+ }
+
+#ifdef UCPTRIE_DEBUG
+ /* we saved some space */
+ printf("compacting UCPTrie: count of 32-bit data words %lu->%lu countSame=%ld sumOverlaps=%ld\n",
+ (long)dataLength, (long)newDataLength, (long)countSame, (long)sumOverlaps);
+#endif
+ return newDataLength;
+}
+
+int32_t MutableCodePointTrie::compactIndex(int32_t fastILimit, MixedBlocks &mixedBlocks,
+ UErrorCode &errorCode) {
+ int32_t fastIndexLength = fastILimit >> (UCPTRIE_FAST_SHIFT - UCPTRIE_SHIFT_3);
+ if ((highStart >> UCPTRIE_FAST_SHIFT) <= fastIndexLength) {
+ // Only the linear fast index, no multi-stage index tables.
+ index3NullOffset = UCPTRIE_NO_INDEX3_NULL_OFFSET;
+ return fastIndexLength;
+ }
+
+ // Condense the fast index table.
+ // Also, does it contain an index-3 block with all dataNullOffset?
+ uint16_t fastIndex[UCPTRIE_BMP_INDEX_LENGTH]; // fastIndexLength
+ int32_t i3FirstNull = -1;
+ for (int32_t i = 0, j = 0; i < fastILimit; ++j) {
+ uint32_t i3 = index[i];
+ fastIndex[j] = (uint16_t)i3;
+ if (i3 == (uint32_t)dataNullOffset) {
+ if (i3FirstNull < 0) {
+ i3FirstNull = j;
+ } else if (index3NullOffset < 0 &&
+ (j - i3FirstNull + 1) == UCPTRIE_INDEX_3_BLOCK_LENGTH) {
+ index3NullOffset = i3FirstNull;
+ }
+ } else {
+ i3FirstNull = -1;
+ }
+ // Set the index entries that compactData() skipped.
+ // Needed when the multi-stage index covers the fast index range as well.
+ int32_t iNext = i + SMALL_DATA_BLOCKS_PER_BMP_BLOCK;
+ while (++i < iNext) {
+ i3 += UCPTRIE_SMALL_DATA_BLOCK_LENGTH;
+ index[i] = i3;
+ }
+ }
+
+ if (!mixedBlocks.init(fastIndexLength, UCPTRIE_INDEX_3_BLOCK_LENGTH)) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return 0;
+ }
+ mixedBlocks.extend(fastIndex, 0, 0, fastIndexLength);
+
+ // Examine index-3 blocks. For each determine one of:
+ // - same as the index-3 null block
+ // - same as a fast-index block
+ // - 16-bit indexes
+ // - 18-bit indexes
+ // We store this in the first flags entry for the index-3 block.
+ //
+ // Also determine an upper limit for the index-3 table length.
+ int32_t index3Capacity = 0;
+ i3FirstNull = index3NullOffset;
+ bool hasLongI3Blocks = false;
+ // If the fast index covers the whole BMP, then
+ // the multi-stage index is only for supplementary code points.
+ // Otherwise, the multi-stage index covers all of Unicode.
+ int32_t iStart = fastILimit < BMP_I_LIMIT ? 0 : BMP_I_LIMIT;
+ int32_t iLimit = highStart >> UCPTRIE_SHIFT_3;
+ for (int32_t i = iStart; i < iLimit;) {
+ int32_t j = i;
+ int32_t jLimit = i + UCPTRIE_INDEX_3_BLOCK_LENGTH;
+ uint32_t oredI3 = 0;
+ bool isNull = true;
+ do {
+ uint32_t i3 = index[j];
+ oredI3 |= i3;
+ if (i3 != (uint32_t)dataNullOffset) {
+ isNull = false;
+ }
+ } while (++j < jLimit);
+ if (isNull) {
+ flags[i] = I3_NULL;
+ if (i3FirstNull < 0) {
+ if (oredI3 <= 0xffff) {
+ index3Capacity += UCPTRIE_INDEX_3_BLOCK_LENGTH;
+ } else {
+ index3Capacity += INDEX_3_18BIT_BLOCK_LENGTH;
+ hasLongI3Blocks = true;
+ }
+ i3FirstNull = 0;
+ }
+ } else {
+ if (oredI3 <= 0xffff) {
+ int32_t n = mixedBlocks.findBlock(fastIndex, index, i);
+ if (n >= 0) {
+ flags[i] = I3_BMP;
+ index[i] = n;
+ } else {
+ flags[i] = I3_16;
+ index3Capacity += UCPTRIE_INDEX_3_BLOCK_LENGTH;
+ }
+ } else {
+ flags[i] = I3_18;
+ index3Capacity += INDEX_3_18BIT_BLOCK_LENGTH;
+ hasLongI3Blocks = true;
+ }
+ }
+ i = j;
+ }
+
+ int32_t index2Capacity = (iLimit - iStart) >> UCPTRIE_SHIFT_2_3;
+
+ // Length of the index-1 table, rounded up.
+ int32_t index1Length = (index2Capacity + UCPTRIE_INDEX_2_MASK) >> UCPTRIE_SHIFT_1_2;
+
+ // Index table: Fast index, index-1, index-3, index-2.
+ // +1 for possible index table padding.
+ int32_t index16Capacity = fastIndexLength + index1Length + index3Capacity + index2Capacity + 1;
+ index16 = (uint16_t *)uprv_malloc(index16Capacity * 2);
+ if (index16 == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return 0;
+ }
+ uprv_memcpy(index16, fastIndex, fastIndexLength * 2);
+
+ if (!mixedBlocks.init(index16Capacity, UCPTRIE_INDEX_3_BLOCK_LENGTH)) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return 0;
+ }
+ MixedBlocks longI3Blocks;
+ if (hasLongI3Blocks) {
+ if (!longI3Blocks.init(index16Capacity, INDEX_3_18BIT_BLOCK_LENGTH)) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return 0;
+ }
+ }
+
+ // Compact the index-3 table and write an uncompacted version of the index-2 table.
+ uint16_t index2[UNICODE_LIMIT >> UCPTRIE_SHIFT_2]; // index2Capacity
+ int32_t i2Length = 0;
+ i3FirstNull = index3NullOffset;
+ int32_t index3Start = fastIndexLength + index1Length;
+ int32_t indexLength = index3Start;
+ for (int32_t i = iStart; i < iLimit; i += UCPTRIE_INDEX_3_BLOCK_LENGTH) {
+ int32_t i3;
+ uint8_t f = flags[i];
+ if (f == I3_NULL && i3FirstNull < 0) {
+ // First index-3 null block. Write & overlap it like a normal block, then remember it.
+ f = dataNullOffset <= 0xffff ? I3_16 : I3_18;
+ i3FirstNull = 0;
+ }
+ if (f == I3_NULL) {
+ i3 = index3NullOffset;
+ } else if (f == I3_BMP) {
+ i3 = index[i];
+ } else if (f == I3_16) {
+ int32_t n = mixedBlocks.findBlock(index16, index, i);
+ if (n >= 0) {
+ i3 = n;
+ } else {
+ if (indexLength == index3Start) {
+ // No overlap at the boundary between the index-1 and index-3 tables.
+ n = 0;
+ } else {
+ n = getOverlap(index16, indexLength,
+ index, i, UCPTRIE_INDEX_3_BLOCK_LENGTH);
+ }
+ i3 = indexLength - n;
+ int32_t prevIndexLength = indexLength;
+ while (n < UCPTRIE_INDEX_3_BLOCK_LENGTH) {
+ index16[indexLength++] = index[i + n++];
+ }
+ mixedBlocks.extend(index16, index3Start, prevIndexLength, indexLength);
+ if (hasLongI3Blocks) {
+ longI3Blocks.extend(index16, index3Start, prevIndexLength, indexLength);
+ }
+ }
+ } else {
+ U_ASSERT(f == I3_18);
+ U_ASSERT(hasLongI3Blocks);
+ // Encode an index-3 block that contains one or more data indexes exceeding 16 bits.
+ int32_t j = i;
+ int32_t jLimit = i + UCPTRIE_INDEX_3_BLOCK_LENGTH;
+ int32_t k = indexLength;
+ do {
+ ++k;
+ uint32_t v = index[j++];
+ uint32_t upperBits = (v & 0x30000) >> 2;
+ index16[k++] = v;
+ v = index[j++];
+ upperBits |= (v & 0x30000) >> 4;
+ index16[k++] = v;
+ v = index[j++];
+ upperBits |= (v & 0x30000) >> 6;
+ index16[k++] = v;
+ v = index[j++];
+ upperBits |= (v & 0x30000) >> 8;
+ index16[k++] = v;
+ v = index[j++];
+ upperBits |= (v & 0x30000) >> 10;
+ index16[k++] = v;
+ v = index[j++];
+ upperBits |= (v & 0x30000) >> 12;
+ index16[k++] = v;
+ v = index[j++];
+ upperBits |= (v & 0x30000) >> 14;
+ index16[k++] = v;
+ v = index[j++];
+ upperBits |= (v & 0x30000) >> 16;
+ index16[k++] = v;
+ index16[k - 9] = upperBits;
+ } while (j < jLimit);
+ int32_t n = longI3Blocks.findBlock(index16, index16, indexLength);
+ if (n >= 0) {
+ i3 = n | 0x8000;
+ } else {
+ if (indexLength == index3Start) {
+ // No overlap at the boundary between the index-1 and index-3 tables.
+ n = 0;
+ } else {
+ n = getOverlap(index16, indexLength,
+ index16, indexLength, INDEX_3_18BIT_BLOCK_LENGTH);
+ }
+ i3 = (indexLength - n) | 0x8000;
+ int32_t prevIndexLength = indexLength;
+ if (n > 0) {
+ int32_t start = indexLength;
+ while (n < INDEX_3_18BIT_BLOCK_LENGTH) {
+ index16[indexLength++] = index16[start + n++];
+ }
+ } else {
+ indexLength += INDEX_3_18BIT_BLOCK_LENGTH;
+ }
+ mixedBlocks.extend(index16, index3Start, prevIndexLength, indexLength);
+ if (hasLongI3Blocks) {
+ longI3Blocks.extend(index16, index3Start, prevIndexLength, indexLength);
+ }
+ }
+ }
+ if (index3NullOffset < 0 && i3FirstNull >= 0) {
+ index3NullOffset = i3;
+ }
+ // Set the index-2 table entry.
+ index2[i2Length++] = i3;
+ }
+ U_ASSERT(i2Length == index2Capacity);
+ U_ASSERT(indexLength <= index3Start + index3Capacity);
+
+ if (index3NullOffset < 0) {
+ index3NullOffset = UCPTRIE_NO_INDEX3_NULL_OFFSET;
+ }
+ if (indexLength >= (UCPTRIE_NO_INDEX3_NULL_OFFSET + UCPTRIE_INDEX_3_BLOCK_LENGTH)) {
+ // The index-3 offsets exceed 15 bits, or
+ // the last one cannot be distinguished from the no-null-block value.
+ errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
+ }
+
+ // Compact the index-2 table and write the index-1 table.
+ static_assert(UCPTRIE_INDEX_2_BLOCK_LENGTH == UCPTRIE_INDEX_3_BLOCK_LENGTH,
+ "must re-init mixedBlocks");
+ int32_t blockLength = UCPTRIE_INDEX_2_BLOCK_LENGTH;
+ int32_t i1 = fastIndexLength;
+ for (int32_t i = 0; i < i2Length; i += blockLength) {
+ int32_t n;
+ if ((i2Length - i) >= blockLength) {
+ // normal block
+ U_ASSERT(blockLength == UCPTRIE_INDEX_2_BLOCK_LENGTH);
+ n = mixedBlocks.findBlock(index16, index2, i);
+ } else {
+ // highStart is inside the last index-2 block. Shorten it.
+ blockLength = i2Length - i;
+ n = findSameBlock(index16, index3Start, indexLength,
+ index2, i, blockLength);
+ }
+ int32_t i2;
+ if (n >= 0) {
+ i2 = n;
+ } else {
+ if (indexLength == index3Start) {
+ // No overlap at the boundary between the index-1 and index-3/2 tables.
+ n = 0;
+ } else {
+ n = getOverlap(index16, indexLength, index2, i, blockLength);
+ }
+ i2 = indexLength - n;
+ int32_t prevIndexLength = indexLength;
+ while (n < blockLength) {
+ index16[indexLength++] = index2[i + n++];
+ }
+ mixedBlocks.extend(index16, index3Start, prevIndexLength, indexLength);
+ }
+ // Set the index-1 table entry.
+ index16[i1++] = i2;
+ }
+ U_ASSERT(i1 == index3Start);
+ U_ASSERT(indexLength <= index16Capacity);
+
+#ifdef UCPTRIE_DEBUG
+ /* we saved some space */
+ printf("compacting UCPTrie: count of 16-bit index words %lu->%lu\n",
+ (long)iLimit, (long)indexLength);
+#endif
+
+ return indexLength;
+}
+
+int32_t MutableCodePointTrie::compactTrie(int32_t fastILimit, UErrorCode &errorCode) {
+ // Find the real highStart and round it up.
+ U_ASSERT((highStart & (UCPTRIE_CP_PER_INDEX_2_ENTRY - 1)) == 0);
+ highValue = get(MAX_UNICODE);
+ int32_t realHighStart = findHighStart();
+ realHighStart = (realHighStart + (UCPTRIE_CP_PER_INDEX_2_ENTRY - 1)) &
+ ~(UCPTRIE_CP_PER_INDEX_2_ENTRY - 1);
+ if (realHighStart == UNICODE_LIMIT) {
+ highValue = initialValue;
+ }
+
+#ifdef UCPTRIE_DEBUG
+ printf("UCPTrie: highStart U+%06lx highValue 0x%lx initialValue 0x%lx\n",
+ (long)realHighStart, (long)highValue, (long)initialValue);
+#endif
+
+ // We always store indexes and data values for the fast range.
+ // Pin highStart to the top of that range while building.
+ UChar32 fastLimit = fastILimit << UCPTRIE_SHIFT_3;
+ if (realHighStart < fastLimit) {
+ for (int32_t i = (realHighStart >> UCPTRIE_SHIFT_3); i < fastILimit; ++i) {
+ flags[i] = ALL_SAME;
+ index[i] = highValue;
+ }
+ highStart = fastLimit;
+ } else {
+ highStart = realHighStart;
+ }
+
+ uint32_t asciiData[ASCII_LIMIT];
+ for (int32_t i = 0; i < ASCII_LIMIT; ++i) {
+ asciiData[i] = get(i);
+ }
+
+ // First we look for which data blocks have the same value repeated over the whole block,
+ // deduplicate such blocks, find a good null data block (for faster enumeration),
+ // and get an upper bound for the necessary data array length.
+ AllSameBlocks allSameBlocks;
+ int32_t newDataCapacity = compactWholeDataBlocks(fastILimit, allSameBlocks);
+ if (newDataCapacity < 0) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return 0;
+ }
+ uint32_t *newData = (uint32_t *)uprv_malloc(newDataCapacity * 4);
+ if (newData == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return 0;
+ }
+ uprv_memcpy(newData, asciiData, sizeof(asciiData));
+
+ int32_t dataNullIndex = allSameBlocks.findMostUsed();
+
+ MixedBlocks mixedBlocks;
+ int32_t newDataLength = compactData(fastILimit, newData, newDataCapacity,
+ dataNullIndex, mixedBlocks, errorCode);
+ if (U_FAILURE(errorCode)) { return 0; }
+ U_ASSERT(newDataLength <= newDataCapacity);
+ uprv_free(data);
+ data = newData;
+ dataCapacity = newDataCapacity;
+ dataLength = newDataLength;
+ if (dataLength > (0x3ffff + UCPTRIE_SMALL_DATA_BLOCK_LENGTH)) {
+ // The offset of the last data block is too high to be stored in the index table.
+ errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
+ }
+
+ if (dataNullIndex >= 0) {
+ dataNullOffset = index[dataNullIndex];
+#ifdef UCPTRIE_DEBUG
+ if (data[dataNullOffset] != initialValue) {
+ printf("UCPTrie initialValue %lx -> more common nullValue %lx\n",
+ (long)initialValue, (long)data[dataNullOffset]);
+ }
+#endif
+ initialValue = data[dataNullOffset];
+ } else {
+ dataNullOffset = UCPTRIE_NO_DATA_NULL_OFFSET;
+ }
+
+ int32_t indexLength = compactIndex(fastILimit, mixedBlocks, errorCode);
+ highStart = realHighStart;
+ return indexLength;
+}
+
+UCPTrie *MutableCodePointTrie::build(UCPTrieType type, UCPTrieValueWidth valueWidth, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) {
+ return nullptr;
+ }
+ if (type < UCPTRIE_TYPE_FAST || UCPTRIE_TYPE_SMALL < type ||
+ valueWidth < UCPTRIE_VALUE_BITS_16 || UCPTRIE_VALUE_BITS_8 < valueWidth) {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return nullptr;
+ }
+
+ // The mutable trie always stores 32-bit values.
+ // When we build a UCPTrie for a smaller value width, we first mask off unused bits
+ // before compacting the data.
+ switch (valueWidth) {
+ case UCPTRIE_VALUE_BITS_32:
+ break;
+ case UCPTRIE_VALUE_BITS_16:
+ maskValues(0xffff);
+ break;
+ case UCPTRIE_VALUE_BITS_8:
+ maskValues(0xff);
+ break;
+ default:
+ break;
+ }
+
+ UChar32 fastLimit = type == UCPTRIE_TYPE_FAST ? BMP_LIMIT : UCPTRIE_SMALL_LIMIT;
+ int32_t indexLength = compactTrie(fastLimit >> UCPTRIE_SHIFT_3, errorCode);
+ if (U_FAILURE(errorCode)) {
+ clear();
+ return nullptr;
+ }
+
+ // Ensure data table alignment: The index length must be even for uint32_t data.
+ if (valueWidth == UCPTRIE_VALUE_BITS_32 && (indexLength & 1) != 0) {
+ index16[indexLength++] = 0xffee; // arbitrary value
+ }
+
+ // Make the total trie structure length a multiple of 4 bytes by padding the data table,
+ // and store special values as the last two data values.
+ int32_t length = indexLength * 2;
+ if (valueWidth == UCPTRIE_VALUE_BITS_16) {
+ if (((indexLength ^ dataLength) & 1) != 0) {
+ // padding
+ data[dataLength++] = errorValue;
+ }
+ if (data[dataLength - 1] != errorValue || data[dataLength - 2] != highValue) {
+ data[dataLength++] = highValue;
+ data[dataLength++] = errorValue;
+ }
+ length += dataLength * 2;
+ } else if (valueWidth == UCPTRIE_VALUE_BITS_32) {
+ // 32-bit data words never need padding to a multiple of 4 bytes.
+ if (data[dataLength - 1] != errorValue || data[dataLength - 2] != highValue) {
+ if (data[dataLength - 1] != highValue) {
+ data[dataLength++] = highValue;
+ }
+ data[dataLength++] = errorValue;
+ }
+ length += dataLength * 4;
+ } else {
+ int32_t and3 = (length + dataLength) & 3;
+ if (and3 == 0 && data[dataLength - 1] == errorValue && data[dataLength - 2] == highValue) {
+ // all set
+ } else if(and3 == 3 && data[dataLength - 1] == highValue) {
+ data[dataLength++] = errorValue;
+ } else {
+ while (and3 != 2) {
+ data[dataLength++] = highValue;
+ and3 = (and3 + 1) & 3;
+ }
+ data[dataLength++] = highValue;
+ data[dataLength++] = errorValue;
+ }
+ length += dataLength;
+ }
+
+ // Calculate the total length of the UCPTrie as a single memory block.
+ length += sizeof(UCPTrie);
+ U_ASSERT((length & 3) == 0);
+
+ uint8_t *bytes = (uint8_t *)uprv_malloc(length);
+ if (bytes == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ clear();
+ return nullptr;
+ }
+ UCPTrie *trie = reinterpret_cast<UCPTrie *>(bytes);
+ uprv_memset(trie, 0, sizeof(UCPTrie));
+ trie->indexLength = indexLength;
+ trie->dataLength = dataLength;
+
+ trie->highStart = highStart;
+ // Round up shifted12HighStart to a multiple of 0x1000 for easy testing from UTF-8 lead bytes.
+ // Runtime code needs to then test for the real highStart as well.
+ trie->shifted12HighStart = (highStart + 0xfff) >> 12;
+ trie->type = type;
+ trie->valueWidth = valueWidth;
+
+ trie->index3NullOffset = index3NullOffset;
+ trie->dataNullOffset = dataNullOffset;
+ trie->nullValue = initialValue;
+
+ bytes += sizeof(UCPTrie);
+
+ // Fill the index and data arrays.
+ uint16_t *dest16 = (uint16_t *)bytes;
+ trie->index = dest16;
+
+ if (highStart <= fastLimit) {
+ // Condense only the fast index from the mutable-trie index.
+ for (int32_t i = 0, j = 0; j < indexLength; i += SMALL_DATA_BLOCKS_PER_BMP_BLOCK, ++j) {
+ *dest16++ = (uint16_t)index[i]; // dest16[j]
+ }
+ } else {
+ uprv_memcpy(dest16, index16, indexLength * 2);
+ dest16 += indexLength;
+ }
+ bytes += indexLength * 2;
+
+ // Write the data array.
+ const uint32_t *p = data;
+ switch (valueWidth) {
+ case UCPTRIE_VALUE_BITS_16:
+ // Write 16-bit data values.
+ trie->data.ptr16 = dest16;
+ for (int32_t i = dataLength; i > 0; --i) {
+ *dest16++ = (uint16_t)*p++;
+ }
+ break;
+ case UCPTRIE_VALUE_BITS_32:
+ // Write 32-bit data values.
+ trie->data.ptr32 = (uint32_t *)bytes;
+ uprv_memcpy(bytes, p, (size_t)dataLength * 4);
+ break;
+ case UCPTRIE_VALUE_BITS_8:
+ // Write 8-bit data values.
+ trie->data.ptr8 = bytes;
+ for (int32_t i = dataLength; i > 0; --i) {
+ *bytes++ = (uint8_t)*p++;
+ }
+ break;
+ default:
+ // Will not occur, valueWidth checked at the beginning.
+ break;
+ }
+
+#ifdef UCPTRIE_DEBUG
+ trie->name = name;
+
+ ucptrie_printLengths(trie, "");
+#endif
+
+ clear();
+ return trie;
+}
+
+} // namespace
+
+U_NAMESPACE_END
+
+U_NAMESPACE_USE
+
+U_CAPI UMutableCPTrie * U_EXPORT2
+umutablecptrie_open(uint32_t initialValue, uint32_t errorValue, UErrorCode *pErrorCode) {
+ if (U_FAILURE(*pErrorCode)) {
+ return nullptr;
+ }
+ LocalPointer<MutableCodePointTrie> trie(
+ new MutableCodePointTrie(initialValue, errorValue, *pErrorCode), *pErrorCode);
+ if (U_FAILURE(*pErrorCode)) {
+ return nullptr;
+ }
+ return reinterpret_cast<UMutableCPTrie *>(trie.orphan());
+}
+
+U_CAPI UMutableCPTrie * U_EXPORT2
+umutablecptrie_clone(const UMutableCPTrie *other, UErrorCode *pErrorCode) {
+ if (U_FAILURE(*pErrorCode)) {
+ return nullptr;
+ }
+ if (other == nullptr) {
+ return nullptr;
+ }
+ LocalPointer<MutableCodePointTrie> clone(
+ new MutableCodePointTrie(*reinterpret_cast<const MutableCodePointTrie *>(other), *pErrorCode), *pErrorCode);
+ if (U_FAILURE(*pErrorCode)) {
+ return nullptr;
+ }
+ return reinterpret_cast<UMutableCPTrie *>(clone.orphan());
+}
+
+U_CAPI void U_EXPORT2
+umutablecptrie_close(UMutableCPTrie *trie) {
+ delete reinterpret_cast<MutableCodePointTrie *>(trie);
+}
+
+U_CAPI UMutableCPTrie * U_EXPORT2
+umutablecptrie_fromUCPMap(const UCPMap *map, UErrorCode *pErrorCode) {
+ if (U_FAILURE(*pErrorCode)) {
+ return nullptr;
+ }
+ if (map == nullptr) {
+ *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return nullptr;
+ }
+ return reinterpret_cast<UMutableCPTrie *>(MutableCodePointTrie::fromUCPMap(map, *pErrorCode));
+}
+
+U_CAPI UMutableCPTrie * U_EXPORT2
+umutablecptrie_fromUCPTrie(const UCPTrie *trie, UErrorCode *pErrorCode) {
+ if (U_FAILURE(*pErrorCode)) {
+ return nullptr;
+ }
+ if (trie == nullptr) {
+ *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return nullptr;
+ }
+ return reinterpret_cast<UMutableCPTrie *>(MutableCodePointTrie::fromUCPTrie(trie, *pErrorCode));
+}
+
+U_CAPI uint32_t U_EXPORT2
+umutablecptrie_get(const UMutableCPTrie *trie, UChar32 c) {
+ return reinterpret_cast<const MutableCodePointTrie *>(trie)->get(c);
+}
+
+namespace {
+
+UChar32 getRange(const void *trie, UChar32 start,
+ UCPMapValueFilter *filter, const void *context, uint32_t *pValue) {
+ return reinterpret_cast<const MutableCodePointTrie *>(trie)->
+ getRange(start, filter, context, pValue);
+}
+
+} // namespace
+
+U_CAPI UChar32 U_EXPORT2
+umutablecptrie_getRange(const UMutableCPTrie *trie, UChar32 start,
+ UCPMapRangeOption option, uint32_t surrogateValue,
+ UCPMapValueFilter *filter, const void *context, uint32_t *pValue) {
+ return ucptrie_internalGetRange(getRange, trie, start,
+ option, surrogateValue,
+ filter, context, pValue);
+}
+
+U_CAPI void U_EXPORT2
+umutablecptrie_set(UMutableCPTrie *trie, UChar32 c, uint32_t value, UErrorCode *pErrorCode) {
+ if (U_FAILURE(*pErrorCode)) {
+ return;
+ }
+ reinterpret_cast<MutableCodePointTrie *>(trie)->set(c, value, *pErrorCode);
+}
+
+U_CAPI void U_EXPORT2
+umutablecptrie_setRange(UMutableCPTrie *trie, UChar32 start, UChar32 end,
+ uint32_t value, UErrorCode *pErrorCode) {
+ if (U_FAILURE(*pErrorCode)) {
+ return;
+ }
+ reinterpret_cast<MutableCodePointTrie *>(trie)->setRange(start, end, value, *pErrorCode);
+}
+
+/* Compact and internally serialize the trie. */
+U_CAPI UCPTrie * U_EXPORT2
+umutablecptrie_buildImmutable(UMutableCPTrie *trie, UCPTrieType type, UCPTrieValueWidth valueWidth,
+ UErrorCode *pErrorCode) {
+ if (U_FAILURE(*pErrorCode)) {
+ return nullptr;
+ }
+ return reinterpret_cast<MutableCodePointTrie *>(trie)->build(type, valueWidth, *pErrorCode);
+}
+
+#ifdef UCPTRIE_DEBUG
+U_CFUNC void umutablecptrie_setName(UMutableCPTrie *trie, const char *name) {
+ reinterpret_cast<MutableCodePointTrie *>(trie)->name = name;
+}
+#endif
diff --git a/contrib/libs/icu/common/umutex.cpp b/contrib/libs/icu/common/umutex.cpp
index 6a283a15fe..ccbee9960a 100644
--- a/contrib/libs/icu/common/umutex.cpp
+++ b/contrib/libs/icu/common/umutex.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -24,138 +24,138 @@
#include "unicode/utypes.h"
#include "uassert.h"
-#include "ucln_cmn.h"
+#include "ucln_cmn.h"
#include "cmemory.h"
-U_NAMESPACE_BEGIN
+U_NAMESPACE_BEGIN
#if defined(U_USER_MUTEX_CPP)
-// Support for including an alternate implementation of mutexes has been withdrawn.
-// See issue ICU-20185.
-#error U_USER_MUTEX_CPP not supported
+// Support for including an alternate implementation of mutexes has been withdrawn.
+// See issue ICU-20185.
+#error U_USER_MUTEX_CPP not supported
#endif
-/*************************************************************************************************
- *
- * ICU Mutex wrappers.
- *
- *************************************************************************************************/
+/*************************************************************************************************
+ *
+ * ICU Mutex wrappers.
+ *
+ *************************************************************************************************/
-namespace {
-std::mutex *initMutex;
-std::condition_variable *initCondition;
+namespace {
+std::mutex *initMutex;
+std::condition_variable *initCondition;
-// The ICU global mutex.
-// Used when ICU implementation code passes nullptr for the mutex pointer.
-UMutex globalMutex;
+// The ICU global mutex.
+// Used when ICU implementation code passes nullptr for the mutex pointer.
+UMutex globalMutex;
-std::once_flag initFlag;
-std::once_flag *pInitFlag = &initFlag;
+std::once_flag initFlag;
+std::once_flag *pInitFlag = &initFlag;
-} // Anonymous namespace
+} // Anonymous namespace
-U_CDECL_BEGIN
-static UBool U_CALLCONV umtx_cleanup() {
- initMutex->~mutex();
- initCondition->~condition_variable();
- UMutex::cleanup();
+U_CDECL_BEGIN
+static UBool U_CALLCONV umtx_cleanup() {
+ initMutex->~mutex();
+ initCondition->~condition_variable();
+ UMutex::cleanup();
- // Reset the once_flag, by destructing it and creating a fresh one in its place.
- // Do not use this trick anywhere else in ICU; use umtx_initOnce, not std::call_once().
- pInitFlag->~once_flag();
- pInitFlag = new(&initFlag) std::once_flag();
- return true;
+ // Reset the once_flag, by destructing it and creating a fresh one in its place.
+ // Do not use this trick anywhere else in ICU; use umtx_initOnce, not std::call_once().
+ pInitFlag->~once_flag();
+ pInitFlag = new(&initFlag) std::once_flag();
+ return true;
}
-static void U_CALLCONV umtx_init() {
- initMutex = STATIC_NEW(std::mutex);
- initCondition = STATIC_NEW(std::condition_variable);
- ucln_common_registerCleanup(UCLN_COMMON_MUTEX, umtx_cleanup);
+static void U_CALLCONV umtx_init() {
+ initMutex = STATIC_NEW(std::mutex);
+ initCondition = STATIC_NEW(std::condition_variable);
+ ucln_common_registerCleanup(UCLN_COMMON_MUTEX, umtx_cleanup);
}
-U_CDECL_END
-
-
-std::mutex *UMutex::getMutex() {
- std::mutex *retPtr = fMutex.load(std::memory_order_acquire);
- if (retPtr == nullptr) {
- std::call_once(*pInitFlag, umtx_init);
- std::lock_guard<std::mutex> guard(*initMutex);
- retPtr = fMutex.load(std::memory_order_acquire);
- if (retPtr == nullptr) {
- fMutex = new(fStorage) std::mutex();
- retPtr = fMutex;
- fListLink = gListHead;
- gListHead = this;
- }
+U_CDECL_END
+
+
+std::mutex *UMutex::getMutex() {
+ std::mutex *retPtr = fMutex.load(std::memory_order_acquire);
+ if (retPtr == nullptr) {
+ std::call_once(*pInitFlag, umtx_init);
+ std::lock_guard<std::mutex> guard(*initMutex);
+ retPtr = fMutex.load(std::memory_order_acquire);
+ if (retPtr == nullptr) {
+ fMutex = new(fStorage) std::mutex();
+ retPtr = fMutex;
+ fListLink = gListHead;
+ gListHead = this;
+ }
}
- U_ASSERT(retPtr != nullptr);
- return retPtr;
+ U_ASSERT(retPtr != nullptr);
+ return retPtr;
}
-UMutex *UMutex::gListHead = nullptr;
+UMutex *UMutex::gListHead = nullptr;
-void UMutex::cleanup() {
- UMutex *next = nullptr;
- for (UMutex *m = gListHead; m != nullptr; m = next) {
- (*m->fMutex).~mutex();
- m->fMutex = nullptr;
- next = m->fListLink;
- m->fListLink = nullptr;
+void UMutex::cleanup() {
+ UMutex *next = nullptr;
+ for (UMutex *m = gListHead; m != nullptr; m = next) {
+ (*m->fMutex).~mutex();
+ m->fMutex = nullptr;
+ next = m->fListLink;
+ m->fListLink = nullptr;
}
- gListHead = nullptr;
+ gListHead = nullptr;
}
U_CAPI void U_EXPORT2
umtx_lock(UMutex *mutex) {
- if (mutex == nullptr) {
+ if (mutex == nullptr) {
mutex = &globalMutex;
}
- mutex->lock();
+ mutex->lock();
}
U_CAPI void U_EXPORT2
umtx_unlock(UMutex* mutex)
{
- if (mutex == nullptr) {
+ if (mutex == nullptr) {
mutex = &globalMutex;
}
- mutex->unlock();
+ mutex->unlock();
}
-/*************************************************************************************************
- *
- * UInitOnce Implementation
- *
- *************************************************************************************************/
+/*************************************************************************************************
+ *
+ * UInitOnce Implementation
+ *
+ *************************************************************************************************/
// This function is called when a test of a UInitOnce::fState reveals that
-// initialization has not completed, that we either need to call the init
+// initialization has not completed, that we either need to call the init
// function on this thread, or wait for some other thread to complete.
//
// The actual call to the init function is made inline by template code
-// that knows the C++ types involved. This function returns true if
+// that knows the C++ types involved. This function returns true if
// the caller needs to call the Init function.
//
U_COMMON_API UBool U_EXPORT2
umtx_initImplPreInit(UInitOnce &uio) {
- std::call_once(*pInitFlag, umtx_init);
- std::unique_lock<std::mutex> lock(*initMutex);
- if (umtx_loadAcquire(uio.fState) == 0) {
+ std::call_once(*pInitFlag, umtx_init);
+ std::unique_lock<std::mutex> lock(*initMutex);
+ if (umtx_loadAcquire(uio.fState) == 0) {
umtx_storeRelease(uio.fState, 1);
- return true; // Caller will next call the init function.
+ return true; // Caller will next call the init function.
} else {
- while (umtx_loadAcquire(uio.fState) == 1) {
+ while (umtx_loadAcquire(uio.fState) == 1) {
// Another thread is currently running the initialization.
// Wait until it completes.
- initCondition->wait(lock);
+ initCondition->wait(lock);
}
U_ASSERT(uio.fState == 2);
- return false;
+ return false;
}
}
@@ -168,20 +168,20 @@ umtx_initImplPreInit(UInitOnce &uio) {
U_COMMON_API void U_EXPORT2
umtx_initImplPostInit(UInitOnce &uio) {
- {
- std::unique_lock<std::mutex> lock(*initMutex);
- umtx_storeRelease(uio.fState, 2);
- }
- initCondition->notify_all();
+ {
+ std::unique_lock<std::mutex> lock(*initMutex);
+ umtx_storeRelease(uio.fState, 2);
+ }
+ initCondition->notify_all();
}
U_NAMESPACE_END
-/*************************************************************************************************
- *
- * Deprecated functions for setting user mutexes.
- *
- *************************************************************************************************/
+/*************************************************************************************************
+ *
+ * Deprecated functions for setting user mutexes.
+ *
+ *************************************************************************************************/
U_DEPRECATED void U_EXPORT2
u_setMutexFunctions(const void * /*context */, UMtxInitFn *, UMtxFn *,
diff --git a/contrib/libs/icu/common/umutex.h b/contrib/libs/icu/common/umutex.h
index e45aa5012b..2503aa4a29 100644
--- a/contrib/libs/icu/common/umutex.h
+++ b/contrib/libs/icu/common/umutex.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -20,53 +20,53 @@
#ifndef UMUTEX_H
#define UMUTEX_H
-#include <atomic>
-#include <condition_variable>
-#include <mutex>
-#include <type_traits>
-
+#include <atomic>
+#include <condition_variable>
+#include <mutex>
+#include <type_traits>
+
#include "unicode/utypes.h"
#include "unicode/uclean.h"
-#include "unicode/uobject.h"
-
+#include "unicode/uobject.h"
+
#include "putilimp.h"
-#if defined(U_USER_ATOMICS_H) || defined(U_USER_MUTEX_H)
-// Support for including an alternate implementation of atomic & mutex operations has been withdrawn.
-// See issue ICU-20185.
-#error U_USER_ATOMICS and U_USER_MUTEX_H are not supported
-#endif
-
-// Export an explicit template instantiation of std::atomic<int32_t>.
-// When building DLLs for Windows this is required as it is used as a data member of the exported SharedObject class.
-// See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.
-//
-// Similar story for std::atomic<std::mutex *>, and the exported UMutex class.
-#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN && !defined(U_IN_DOXYGEN)
-#if defined(__clang__) || defined(_MSC_VER)
- #if defined(__clang__)
- // Suppress the warning that the explicit instantiation after explicit specialization has no effect.
- #pragma clang diagnostic push
- #pragma clang diagnostic ignored "-Winstantiation-after-specialization"
- #endif
-template struct U_COMMON_API std::atomic<int32_t>;
-template struct U_COMMON_API std::atomic<std::mutex *>;
- #if defined(__clang__)
- #pragma clang diagnostic pop
- #endif
-#elif defined(__GNUC__)
-// For GCC this class is already exported/visible, so no need for U_COMMON_API.
-template struct std::atomic<int32_t>;
-template struct std::atomic<std::mutex *>;
-#endif
-#endif
+#if defined(U_USER_ATOMICS_H) || defined(U_USER_MUTEX_H)
+// Support for including an alternate implementation of atomic & mutex operations has been withdrawn.
+// See issue ICU-20185.
+#error U_USER_ATOMICS and U_USER_MUTEX_H are not supported
+#endif
+
+// Export an explicit template instantiation of std::atomic<int32_t>.
+// When building DLLs for Windows this is required as it is used as a data member of the exported SharedObject class.
+// See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.
+//
+// Similar story for std::atomic<std::mutex *>, and the exported UMutex class.
+#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN && !defined(U_IN_DOXYGEN)
+#if defined(__clang__) || defined(_MSC_VER)
+ #if defined(__clang__)
+ // Suppress the warning that the explicit instantiation after explicit specialization has no effect.
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Winstantiation-after-specialization"
+ #endif
+template struct U_COMMON_API std::atomic<int32_t>;
+template struct U_COMMON_API std::atomic<std::mutex *>;
+ #if defined(__clang__)
+ #pragma clang diagnostic pop
+ #endif
+#elif defined(__GNUC__)
+// For GCC this class is already exported/visible, so no need for U_COMMON_API.
+template struct std::atomic<int32_t>;
+template struct std::atomic<std::mutex *>;
+#endif
+#endif
U_NAMESPACE_BEGIN
/****************************************************************************
*
- * Low Level Atomic Operations, ICU wrappers for.
+ * Low Level Atomic Operations, ICU wrappers for.
*
****************************************************************************/
@@ -99,8 +99,8 @@ inline int32_t umtx_atomic_dec(u_atomic_int32_t *var) {
struct UInitOnce {
u_atomic_int32_t fState;
UErrorCode fErrCode;
- void reset() {fState = 0;}
- UBool isReset() {return umtx_loadAcquire(fState) == 0;}
+ void reset() {fState = 0;}
+ UBool isReset() {return umtx_loadAcquire(fState) == 0;}
// Note: isReset() is used by service registration code.
// Thread safety of this usage needs review.
};
@@ -184,76 +184,76 @@ template<class T> void umtx_initOnce(UInitOnce &uio, void (U_CALLCONV *fp)(T, UE
}
}
-// UMutex should be constexpr-constructible, so that no initialization code
-// is run during startup.
-// This works on all C++ libraries except MS VS before VS2019.
-#if (defined(_CPPLIB_VER) && !defined(_MSVC_STL_VERSION)) || \
- (defined(_MSVC_STL_VERSION) && _MSVC_STL_VERSION < 142)
- // (VS std lib older than VS2017) || (VS std lib version < VS2019)
-# define UMUTEX_CONSTEXPR
-#else
-# define UMUTEX_CONSTEXPR constexpr
-#endif
-
-/**
- * UMutex - ICU Mutex class.
+// UMutex should be constexpr-constructible, so that no initialization code
+// is run during startup.
+// This works on all C++ libraries except MS VS before VS2019.
+#if (defined(_CPPLIB_VER) && !defined(_MSVC_STL_VERSION)) || \
+ (defined(_MSVC_STL_VERSION) && _MSVC_STL_VERSION < 142)
+ // (VS std lib older than VS2017) || (VS std lib version < VS2019)
+# define UMUTEX_CONSTEXPR
+#else
+# define UMUTEX_CONSTEXPR constexpr
+#endif
+
+/**
+ * UMutex - ICU Mutex class.
+ *
+ * This is the preferred Mutex class for use within ICU implementation code.
+ * It is a thin wrapper over C++ std::mutex, with these additions:
+ * - Static instances are safe, not triggering static construction or destruction,
+ * and the associated order of construction or destruction issues.
+ * - Plumbed into u_cleanup() for destructing the underlying std::mutex,
+ * which frees any OS level resources they may be holding.
*
- * This is the preferred Mutex class for use within ICU implementation code.
- * It is a thin wrapper over C++ std::mutex, with these additions:
- * - Static instances are safe, not triggering static construction or destruction,
- * and the associated order of construction or destruction issues.
- * - Plumbed into u_cleanup() for destructing the underlying std::mutex,
- * which frees any OS level resources they may be holding.
+ * Limitations:
+ * - Static or global instances only. Cannot be heap allocated. Cannot appear as a
+ * member of another class.
+ * - No condition variables or other advanced features. If needed, you will need to use
+ * std::mutex and std::condition_variable directly. For an example, see unifiedcache.cpp
*
- * Limitations:
- * - Static or global instances only. Cannot be heap allocated. Cannot appear as a
- * member of another class.
- * - No condition variables or other advanced features. If needed, you will need to use
- * std::mutex and std::condition_variable directly. For an example, see unifiedcache.cpp
- *
- * Typical Usage:
- * static UMutex myMutex;
- *
- * {
- * Mutex lock(myMutex);
- * ... // Do stuff that is protected by myMutex;
- * } // myMutex is released when lock goes out of scope.
+ * Typical Usage:
+ * static UMutex myMutex;
+ *
+ * {
+ * Mutex lock(myMutex);
+ * ... // Do stuff that is protected by myMutex;
+ * } // myMutex is released when lock goes out of scope.
*/
-class U_COMMON_API UMutex {
-public:
- UMUTEX_CONSTEXPR UMutex() {}
- ~UMutex() = default;
-
- UMutex(const UMutex &other) = delete;
- UMutex &operator =(const UMutex &other) = delete;
- void *operator new(size_t) = delete;
-
- // requirements for C++ BasicLockable, allows UMutex to work with std::lock_guard
- void lock() {
- std::mutex *m = fMutex.load(std::memory_order_acquire);
- if (m == nullptr) { m = getMutex(); }
- m->lock();
- }
- void unlock() { fMutex.load(std::memory_order_relaxed)->unlock(); }
-
- static void cleanup();
-
-private:
- alignas(std::mutex) char fStorage[sizeof(std::mutex)] {};
- std::atomic<std::mutex *> fMutex { nullptr };
-
- /** All initialized UMutexes are kept in a linked list, so that they can be found,
- * and the underlying std::mutex destructed, by u_cleanup().
- */
- UMutex *fListLink { nullptr };
- static UMutex *gListHead;
-
- /** Out-of-line function to lazily initialize a UMutex on first use.
- * Initial fast check is inline, in lock(). The returned value may never
- * be nullptr.
- */
- std::mutex *getMutex();
+class U_COMMON_API UMutex {
+public:
+ UMUTEX_CONSTEXPR UMutex() {}
+ ~UMutex() = default;
+
+ UMutex(const UMutex &other) = delete;
+ UMutex &operator =(const UMutex &other) = delete;
+ void *operator new(size_t) = delete;
+
+ // requirements for C++ BasicLockable, allows UMutex to work with std::lock_guard
+ void lock() {
+ std::mutex *m = fMutex.load(std::memory_order_acquire);
+ if (m == nullptr) { m = getMutex(); }
+ m->lock();
+ }
+ void unlock() { fMutex.load(std::memory_order_relaxed)->unlock(); }
+
+ static void cleanup();
+
+private:
+ alignas(std::mutex) char fStorage[sizeof(std::mutex)] {};
+ std::atomic<std::mutex *> fMutex { nullptr };
+
+ /** All initialized UMutexes are kept in a linked list, so that they can be found,
+ * and the underlying std::mutex destructed, by u_cleanup().
+ */
+ UMutex *fListLink { nullptr };
+ static UMutex *gListHead;
+
+ /** Out-of-line function to lazily initialize a UMutex on first use.
+ * Initial fast check is inline, in lock(). The returned value may never
+ * be nullptr.
+ */
+ std::mutex *getMutex();
};
@@ -271,7 +271,7 @@ U_INTERNAL void U_EXPORT2 umtx_lock(UMutex* mutex);
U_INTERNAL void U_EXPORT2 umtx_unlock (UMutex* mutex);
-U_NAMESPACE_END
+U_NAMESPACE_END
#endif /* UMUTEX_H */
/*eof*/
diff --git a/contrib/libs/icu/common/unames.cpp b/contrib/libs/icu/common/unames.cpp
index 8edf868c41..5776058f95 100644
--- a/contrib/libs/icu/common/unames.cpp
+++ b/contrib/libs/icu/common/unames.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: unames.c
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -212,13 +212,13 @@ isDataLoaded(UErrorCode *pErrorCode) {
return U_SUCCESS(*pErrorCode);
}
-#define WRITE_CHAR(buffer, bufferLength, bufferPos, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define WRITE_CHAR(buffer, bufferLength, bufferPos, c) UPRV_BLOCK_MACRO_BEGIN { \
if((bufferLength)>0) { \
*(buffer)++=c; \
--(bufferLength); \
} \
++(bufferPos); \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
#define U_ISO_COMMENT U_CHAR_NAME_CHOICE_COUNT
@@ -466,7 +466,7 @@ static uint16_t getExtName(uint32_t code, char *buffer, uint16_t bufferLength) {
buffer[--i] = (v < 10 ? '0' + v : 'A' + v - 10);
}
buffer += ndigits;
- length += static_cast<uint16_t>(ndigits);
+ length += static_cast<uint16_t>(ndigits);
WRITE_CHAR(buffer, bufferLength, length, '>');
return length;
@@ -1519,15 +1519,15 @@ U_CAPI UChar32 U_EXPORT2
u_charFromName(UCharNameChoice nameChoice,
const char *name,
UErrorCode *pErrorCode) {
- char upper[120] = {0};
- char lower[120] = {0};
+ char upper[120] = {0};
+ char lower[120] = {0};
FindName findName;
AlgorithmicRange *algRange;
uint32_t *p;
uint32_t i;
UChar32 cp = 0;
char c0;
- static constexpr UChar32 error = 0xffff; /* Undefined, but use this for backwards compatibility. */
+ static constexpr UChar32 error = 0xffff; /* Undefined, but use this for backwards compatibility. */
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
return error;
@@ -1561,45 +1561,45 @@ u_charFromName(UCharNameChoice nameChoice,
/* try extended names first */
if (lower[0] == '<') {
- if (nameChoice == U_EXTENDED_CHAR_NAME && lower[--i] == '>') {
+ if (nameChoice == U_EXTENDED_CHAR_NAME && lower[--i] == '>') {
// Parse a string like "<category-HHHH>" where HHHH is a hex code point.
- uint32_t limit = i;
- while (i >= 3 && lower[--i] != '-') {}
-
- // There should be 1 to 8 hex digits.
- int32_t hexLength = limit - (i + 1);
- if (i >= 2 && lower[i] == '-' && 1 <= hexLength && hexLength <= 8) {
- uint32_t cIdx;
-
- lower[i] = 0;
-
- for (++i; i < limit; ++i) {
- if (lower[i] >= '0' && lower[i] <= '9') {
- cp = (cp << 4) + lower[i] - '0';
- } else if (lower[i] >= 'a' && lower[i] <= 'f') {
- cp = (cp << 4) + lower[i] - 'a' + 10;
- } else {
- *pErrorCode = U_ILLEGAL_CHAR_FOUND;
- return error;
+ uint32_t limit = i;
+ while (i >= 3 && lower[--i] != '-') {}
+
+ // There should be 1 to 8 hex digits.
+ int32_t hexLength = limit - (i + 1);
+ if (i >= 2 && lower[i] == '-' && 1 <= hexLength && hexLength <= 8) {
+ uint32_t cIdx;
+
+ lower[i] = 0;
+
+ for (++i; i < limit; ++i) {
+ if (lower[i] >= '0' && lower[i] <= '9') {
+ cp = (cp << 4) + lower[i] - '0';
+ } else if (lower[i] >= 'a' && lower[i] <= 'f') {
+ cp = (cp << 4) + lower[i] - 'a' + 10;
+ } else {
+ *pErrorCode = U_ILLEGAL_CHAR_FOUND;
+ return error;
+ }
+ // Prevent signed-integer overflow and out-of-range code points.
+ if (cp > UCHAR_MAX_VALUE) {
+ *pErrorCode = U_ILLEGAL_CHAR_FOUND;
+ return error;
}
- // Prevent signed-integer overflow and out-of-range code points.
- if (cp > UCHAR_MAX_VALUE) {
- *pErrorCode = U_ILLEGAL_CHAR_FOUND;
- return error;
- }
- }
-
- /* Now validate the category name.
- We could use a binary search, or a trie, if
- we really wanted to. */
- uint8_t cat = getCharCat(cp);
- for (lower[i] = 0, cIdx = 0; cIdx < UPRV_LENGTHOF(charCatNames); ++cIdx) {
-
- if (!uprv_strcmp(lower + 1, charCatNames[cIdx])) {
- if (cat == cIdx) {
- return cp;
+ }
+
+ /* Now validate the category name.
+ We could use a binary search, or a trie, if
+ we really wanted to. */
+ uint8_t cat = getCharCat(cp);
+ for (lower[i] = 0, cIdx = 0; cIdx < UPRV_LENGTHOF(charCatNames); ++cIdx) {
+
+ if (!uprv_strcmp(lower + 1, charCatNames[cIdx])) {
+ if (cat == cIdx) {
+ return cp;
}
- break;
+ break;
}
}
}
diff --git a/contrib/libs/icu/common/unifiedcache.cpp b/contrib/libs/icu/common/unifiedcache.cpp
index b224caf8c1..f2dd916559 100644
--- a/contrib/libs/icu/common/unifiedcache.cpp
+++ b/contrib/libs/icu/common/unifiedcache.cpp
@@ -1,43 +1,43 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
-* Copyright (C) 2015, International Business Machines Corporation and
-* others. All Rights Reserved.
+* Copyright (C) 2015, International Business Machines Corporation and
+* others. All Rights Reserved.
******************************************************************************
-*
-* File unifiedcache.cpp
+*
+* File unifiedcache.cpp
******************************************************************************
*/
#include "unifiedcache.h"
-
-#include <algorithm> // For std::max()
-#include <mutex>
-
+
+#include <algorithm> // For std::max()
+#include <mutex>
+
#include "uassert.h"
-#include "uhash.h"
+#include "uhash.h"
#include "ucln_cmn.h"
static icu::UnifiedCache *gCache = NULL;
-static std::mutex *gCacheMutex = nullptr;
-static std::condition_variable *gInProgressValueAddedCond;
+static std::mutex *gCacheMutex = nullptr;
+static std::condition_variable *gInProgressValueAddedCond;
static icu::UInitOnce gCacheInitOnce = U_INITONCE_INITIALIZER;
-
+
static const int32_t MAX_EVICT_ITERATIONS = 10;
-static const int32_t DEFAULT_MAX_UNUSED = 1000;
-static const int32_t DEFAULT_PERCENTAGE_OF_IN_USE = 100;
+static const int32_t DEFAULT_MAX_UNUSED = 1000;
+static const int32_t DEFAULT_PERCENTAGE_OF_IN_USE = 100;
U_CDECL_BEGIN
static UBool U_CALLCONV unifiedcache_cleanup() {
gCacheInitOnce.reset();
- delete gCache;
- gCache = nullptr;
- gCacheMutex->~mutex();
- gCacheMutex = nullptr;
- gInProgressValueAddedCond->~condition_variable();
- gInProgressValueAddedCond = nullptr;
+ delete gCache;
+ gCache = nullptr;
+ gCacheMutex->~mutex();
+ gCacheMutex = nullptr;
+ gInProgressValueAddedCond->~condition_variable();
+ gInProgressValueAddedCond = nullptr;
return TRUE;
}
U_CDECL_END
@@ -72,8 +72,8 @@ static void U_CALLCONV cacheInit(UErrorCode &status) {
ucln_common_registerCleanup(
UCLN_COMMON_UNIFIED_CACHE, unifiedcache_cleanup);
- gCacheMutex = STATIC_NEW(std::mutex);
- gInProgressValueAddedCond = STATIC_NEW(std::condition_variable);
+ gCacheMutex = STATIC_NEW(std::mutex);
+ gInProgressValueAddedCond = STATIC_NEW(std::condition_variable);
gCache = new UnifiedCache(status);
if (gCache == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
@@ -97,24 +97,24 @@ UnifiedCache *UnifiedCache::getInstance(UErrorCode &status) {
UnifiedCache::UnifiedCache(UErrorCode &status) :
fHashtable(NULL),
fEvictPos(UHASH_FIRST),
- fNumValuesTotal(0),
- fNumValuesInUse(0),
+ fNumValuesTotal(0),
+ fNumValuesInUse(0),
fMaxUnused(DEFAULT_MAX_UNUSED),
fMaxPercentageOfInUse(DEFAULT_PERCENTAGE_OF_IN_USE),
- fAutoEvictedCount(0),
- fNoValue(nullptr) {
+ fAutoEvictedCount(0),
+ fNoValue(nullptr) {
if (U_FAILURE(status)) {
return;
}
- fNoValue = new SharedObject();
- if (fNoValue == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- fNoValue->softRefCount = 1; // Add fake references to prevent fNoValue from being deleted
- fNoValue->hardRefCount = 1; // when other references to it are removed.
- fNoValue->cachePtr = this;
-
+ fNoValue = new SharedObject();
+ if (fNoValue == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ fNoValue->softRefCount = 1; // Add fake references to prevent fNoValue from being deleted
+ fNoValue->hardRefCount = 1; // when other references to it are removed.
+ fNoValue->cachePtr = this;
+
fHashtable = uhash_open(
&ucache_hashKeys,
&ucache_compareKeys,
@@ -135,28 +135,28 @@ void UnifiedCache::setEvictionPolicy(
status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
- std::lock_guard<std::mutex> lock(*gCacheMutex);
+ std::lock_guard<std::mutex> lock(*gCacheMutex);
fMaxUnused = count;
fMaxPercentageOfInUse = percentageOfInUseItems;
}
int32_t UnifiedCache::unusedCount() const {
- std::lock_guard<std::mutex> lock(*gCacheMutex);
- return uhash_count(fHashtable) - fNumValuesInUse;
+ std::lock_guard<std::mutex> lock(*gCacheMutex);
+ return uhash_count(fHashtable) - fNumValuesInUse;
}
int64_t UnifiedCache::autoEvictedCount() const {
- std::lock_guard<std::mutex> lock(*gCacheMutex);
+ std::lock_guard<std::mutex> lock(*gCacheMutex);
return fAutoEvictedCount;
}
int32_t UnifiedCache::keyCount() const {
- std::lock_guard<std::mutex> lock(*gCacheMutex);
+ std::lock_guard<std::mutex> lock(*gCacheMutex);
return uhash_count(fHashtable);
}
void UnifiedCache::flush() const {
- std::lock_guard<std::mutex> lock(*gCacheMutex);
+ std::lock_guard<std::mutex> lock(*gCacheMutex);
// Use a loop in case cache items that are flushed held hard references to
// other cache items making those additional cache items eligible for
@@ -164,12 +164,12 @@ void UnifiedCache::flush() const {
while (_flush(FALSE));
}
-void UnifiedCache::handleUnreferencedObject() const {
- std::lock_guard<std::mutex> lock(*gCacheMutex);
- --fNumValuesInUse;
- _runEvictionSlice();
-}
-
+void UnifiedCache::handleUnreferencedObject() const {
+ std::lock_guard<std::mutex> lock(*gCacheMutex);
+ --fNumValuesInUse;
+ _runEvictionSlice();
+}
+
#ifdef UNIFIED_CACHE_DEBUG
#include <stdio.h>
@@ -184,7 +184,7 @@ void UnifiedCache::dump() {
}
void UnifiedCache::dumpContents() const {
- std::lock_guard<std::mutex> lock(*gCacheMutex);
+ std::lock_guard<std::mutex> lock(*gCacheMutex);
_dumpContents();
}
@@ -205,10 +205,10 @@ void UnifiedCache::_dumpContents() const {
++cnt;
fprintf(
stderr,
- "Unified Cache: Key '%s', error %d, value %p, total refcount %d, soft refcount %d\n",
+ "Unified Cache: Key '%s', error %d, value %p, total refcount %d, soft refcount %d\n",
key->writeDescription(buffer, 256),
key->creationStatus,
- sharedObject == fNoValue ? NULL :sharedObject,
+ sharedObject == fNoValue ? NULL :sharedObject,
sharedObject->getRefCount(),
sharedObject->getSoftRefCount());
}
@@ -222,15 +222,15 @@ UnifiedCache::~UnifiedCache() {
flush();
{
// Now all that should be left in the cache are entries that refer to
- // each other and entries with hard references from outside the cache.
+ // each other and entries with hard references from outside the cache.
// Nothing we can do about these so proceed to wipe out the cache.
- std::lock_guard<std::mutex> lock(*gCacheMutex);
+ std::lock_guard<std::mutex> lock(*gCacheMutex);
_flush(TRUE);
}
uhash_close(fHashtable);
- fHashtable = nullptr;
- delete fNoValue;
- fNoValue = nullptr;
+ fHashtable = nullptr;
+ delete fNoValue;
+ fNoValue = nullptr;
}
const UHashElement *
@@ -248,15 +248,15 @@ UBool UnifiedCache::_flush(UBool all) const {
int32_t origSize = uhash_count(fHashtable);
for (int32_t i = 0; i < origSize; ++i) {
const UHashElement *element = _nextElement();
- if (element == nullptr) {
- break;
- }
+ if (element == nullptr) {
+ break;
+ }
if (all || _isEvictable(element)) {
const SharedObject *sharedObject =
(const SharedObject *) element->value.pointer;
- U_ASSERT(sharedObject->cachePtr == this);
+ U_ASSERT(sharedObject->cachePtr == this);
uhash_removeElement(fHashtable, element);
- removeSoftRef(sharedObject); // Deletes the sharedObject when softRefCount goes to zero.
+ removeSoftRef(sharedObject); // Deletes the sharedObject when softRefCount goes to zero.
result = TRUE;
}
}
@@ -264,13 +264,13 @@ UBool UnifiedCache::_flush(UBool all) const {
}
int32_t UnifiedCache::_computeCountOfItemsToEvict() const {
- int32_t totalItems = uhash_count(fHashtable);
- int32_t evictableItems = totalItems - fNumValuesInUse;
-
- int32_t unusedLimitByPercentage = fNumValuesInUse * fMaxPercentageOfInUse / 100;
- int32_t unusedLimit = std::max(unusedLimitByPercentage, fMaxUnused);
- int32_t countOfItemsToEvict = std::max(0, evictableItems - unusedLimit);
- return countOfItemsToEvict;
+ int32_t totalItems = uhash_count(fHashtable);
+ int32_t evictableItems = totalItems - fNumValuesInUse;
+
+ int32_t unusedLimitByPercentage = fNumValuesInUse * fMaxPercentageOfInUse / 100;
+ int32_t unusedLimit = std::max(unusedLimitByPercentage, fMaxUnused);
+ int32_t countOfItemsToEvict = std::max(0, evictableItems - unusedLimit);
+ return countOfItemsToEvict;
}
void UnifiedCache::_runEvictionSlice() const {
@@ -280,14 +280,14 @@ void UnifiedCache::_runEvictionSlice() const {
}
for (int32_t i = 0; i < MAX_EVICT_ITERATIONS; ++i) {
const UHashElement *element = _nextElement();
- if (element == nullptr) {
- break;
- }
+ if (element == nullptr) {
+ break;
+ }
if (_isEvictable(element)) {
const SharedObject *sharedObject =
(const SharedObject *) element->value.pointer;
uhash_removeElement(fHashtable, element);
- removeSoftRef(sharedObject); // Deletes sharedObject when SoftRefCount goes to zero.
+ removeSoftRef(sharedObject); // Deletes sharedObject when SoftRefCount goes to zero.
++fAutoEvictedCount;
if (--maxItemsToEvict == 0) {
break;
@@ -297,7 +297,7 @@ void UnifiedCache::_runEvictionSlice() const {
}
void UnifiedCache::_putNew(
- const CacheKeyBase &key,
+ const CacheKeyBase &key,
const SharedObject *value,
const UErrorCode creationStatus,
UErrorCode &status) const {
@@ -310,14 +310,14 @@ void UnifiedCache::_putNew(
return;
}
keyToAdopt->fCreationStatus = creationStatus;
- if (value->softRefCount == 0) {
+ if (value->softRefCount == 0) {
_registerMaster(keyToAdopt, value);
}
- void *oldValue = uhash_put(fHashtable, keyToAdopt, (void *) value, &status);
- U_ASSERT(oldValue == nullptr);
- (void)oldValue;
+ void *oldValue = uhash_put(fHashtable, keyToAdopt, (void *) value, &status);
+ U_ASSERT(oldValue == nullptr);
+ (void)oldValue;
if (U_SUCCESS(status)) {
- value->softRefCount++;
+ value->softRefCount++;
}
}
@@ -325,7 +325,7 @@ void UnifiedCache::_putIfAbsentAndGet(
const CacheKeyBase &key,
const SharedObject *&value,
UErrorCode &status) const {
- std::lock_guard<std::mutex> lock(*gCacheMutex);
+ std::lock_guard<std::mutex> lock(*gCacheMutex);
const UHashElement *element = uhash_find(fHashtable, &key);
if (element != NULL && !_inProgress(element)) {
_fetch(element, value, status);
@@ -343,35 +343,35 @@ void UnifiedCache::_putIfAbsentAndGet(
_runEvictionSlice();
}
-
+
UBool UnifiedCache::_poll(
const CacheKeyBase &key,
const SharedObject *&value,
UErrorCode &status) const {
U_ASSERT(value == NULL);
U_ASSERT(status == U_ZERO_ERROR);
- std::unique_lock<std::mutex> lock(*gCacheMutex);
+ std::unique_lock<std::mutex> lock(*gCacheMutex);
const UHashElement *element = uhash_find(fHashtable, &key);
-
- // If the hash table contains an inProgress placeholder entry for this key,
- // this means that another thread is currently constructing the value object.
- // Loop, waiting for that construction to complete.
- while (element != NULL && _inProgress(element)) {
- gInProgressValueAddedCond->wait(lock);
- element = uhash_find(fHashtable, &key);
- }
-
- // If the hash table contains an entry for the key,
- // fetch out the contents and return them.
+
+ // If the hash table contains an inProgress placeholder entry for this key,
+ // this means that another thread is currently constructing the value object.
+ // Loop, waiting for that construction to complete.
+ while (element != NULL && _inProgress(element)) {
+ gInProgressValueAddedCond->wait(lock);
+ element = uhash_find(fHashtable, &key);
+ }
+
+ // If the hash table contains an entry for the key,
+ // fetch out the contents and return them.
if (element != NULL) {
- _fetch(element, value, status);
+ _fetch(element, value, status);
return TRUE;
}
-
- // The hash table contained nothing for this key.
- // Insert an inProgress place holder value.
- // Our caller will create the final value and update the hash table.
- _putNew(key, fNoValue, U_ZERO_ERROR, status);
+
+ // The hash table contained nothing for this key.
+ // Insert an inProgress place holder value.
+ // Our caller will create the final value and update the hash table.
+ _putNew(key, fNoValue, U_ZERO_ERROR, status);
return FALSE;
}
@@ -383,7 +383,7 @@ void UnifiedCache::_get(
U_ASSERT(value == NULL);
U_ASSERT(status == U_ZERO_ERROR);
if (_poll(key, value, status)) {
- if (value == fNoValue) {
+ if (value == fNoValue) {
SharedObject::clearPtr(value);
}
return;
@@ -395,76 +395,76 @@ void UnifiedCache::_get(
U_ASSERT(value == NULL || value->hasHardReferences());
U_ASSERT(value != NULL || status != U_ZERO_ERROR);
if (value == NULL) {
- SharedObject::copyPtr(fNoValue, value);
+ SharedObject::copyPtr(fNoValue, value);
}
_putIfAbsentAndGet(key, value, status);
- if (value == fNoValue) {
+ if (value == fNoValue) {
SharedObject::clearPtr(value);
}
}
void UnifiedCache::_registerMaster(
- const CacheKeyBase *theKey, const SharedObject *value) const {
- theKey->fIsMaster = true;
- value->cachePtr = this;
- ++fNumValuesTotal;
- ++fNumValuesInUse;
+ const CacheKeyBase *theKey, const SharedObject *value) const {
+ theKey->fIsMaster = true;
+ value->cachePtr = this;
+ ++fNumValuesTotal;
+ ++fNumValuesInUse;
}
void UnifiedCache::_put(
- const UHashElement *element,
+ const UHashElement *element,
const SharedObject *value,
const UErrorCode status) const {
U_ASSERT(_inProgress(element));
const CacheKeyBase *theKey = (const CacheKeyBase *) element->key.pointer;
const SharedObject *oldValue = (const SharedObject *) element->value.pointer;
theKey->fCreationStatus = status;
- if (value->softRefCount == 0) {
+ if (value->softRefCount == 0) {
_registerMaster(theKey, value);
}
- value->softRefCount++;
+ value->softRefCount++;
UHashElement *ptr = const_cast<UHashElement *>(element);
ptr->value.pointer = (void *) value;
- U_ASSERT(oldValue == fNoValue);
- removeSoftRef(oldValue);
+ U_ASSERT(oldValue == fNoValue);
+ removeSoftRef(oldValue);
// Tell waiting threads that we replace in-progress status with
// an error.
- gInProgressValueAddedCond->notify_all();
+ gInProgressValueAddedCond->notify_all();
}
void UnifiedCache::_fetch(
const UHashElement *element,
const SharedObject *&value,
- UErrorCode &status) const {
+ UErrorCode &status) const {
const CacheKeyBase *theKey = (const CacheKeyBase *) element->key.pointer;
status = theKey->fCreationStatus;
- // Since we have the cache lock, calling regular SharedObject add/removeRef
+ // Since we have the cache lock, calling regular SharedObject add/removeRef
// could cause us to deadlock on ourselves since they may need to lock
// the cache mutex.
- removeHardRef(value);
- value = static_cast<const SharedObject *>(element->value.pointer);
- addHardRef(value);
+ removeHardRef(value);
+ value = static_cast<const SharedObject *>(element->value.pointer);
+ addHardRef(value);
}
-
-UBool UnifiedCache::_inProgress(const UHashElement* element) const {
+
+UBool UnifiedCache::_inProgress(const UHashElement* element) const {
UErrorCode status = U_ZERO_ERROR;
- const SharedObject * value = NULL;
+ const SharedObject * value = NULL;
_fetch(element, value, status);
UBool result = _inProgress(value, status);
- removeHardRef(value);
+ removeHardRef(value);
return result;
}
UBool UnifiedCache::_inProgress(
- const SharedObject* theValue, UErrorCode creationStatus) const {
- return (theValue == fNoValue && creationStatus == U_ZERO_ERROR);
+ const SharedObject* theValue, UErrorCode creationStatus) const {
+ return (theValue == fNoValue && creationStatus == U_ZERO_ERROR);
}
-UBool UnifiedCache::_isEvictable(const UHashElement *element) const
-{
+UBool UnifiedCache::_isEvictable(const UHashElement *element) const
+{
const CacheKeyBase *theKey = (const CacheKeyBase *) element->key.pointer;
const SharedObject *theValue =
(const SharedObject *) element->value.pointer;
@@ -476,47 +476,47 @@ UBool UnifiedCache::_isEvictable(const UHashElement *element) const
// We can evict entries that are either not a master or have just
// one reference (The one reference being from the cache itself).
- return (!theKey->fIsMaster || (theValue->softRefCount == 1 && theValue->noHardReferences()));
-}
-
-void UnifiedCache::removeSoftRef(const SharedObject *value) const {
- U_ASSERT(value->cachePtr == this);
- U_ASSERT(value->softRefCount > 0);
- if (--value->softRefCount == 0) {
- --fNumValuesTotal;
- if (value->noHardReferences()) {
- delete value;
- } else {
- // This path only happens from flush(all). Which only happens from the
- // UnifiedCache destructor. Nulling out value.cacheptr changes the behavior
- // of value.removeRef(), causing the deletion to be done there.
- value->cachePtr = nullptr;
- }
- }
-}
-
-int32_t UnifiedCache::removeHardRef(const SharedObject *value) const {
- int refCount = 0;
- if (value) {
- refCount = umtx_atomic_dec(&value->hardRefCount);
- U_ASSERT(refCount >= 0);
- if (refCount == 0) {
- --fNumValuesInUse;
- }
- }
- return refCount;
-}
-
-int32_t UnifiedCache::addHardRef(const SharedObject *value) const {
- int refCount = 0;
- if (value) {
- refCount = umtx_atomic_inc(&value->hardRefCount);
- U_ASSERT(refCount >= 1);
- if (refCount == 1) {
- fNumValuesInUse++;
- }
- }
- return refCount;
-}
-
+ return (!theKey->fIsMaster || (theValue->softRefCount == 1 && theValue->noHardReferences()));
+}
+
+void UnifiedCache::removeSoftRef(const SharedObject *value) const {
+ U_ASSERT(value->cachePtr == this);
+ U_ASSERT(value->softRefCount > 0);
+ if (--value->softRefCount == 0) {
+ --fNumValuesTotal;
+ if (value->noHardReferences()) {
+ delete value;
+ } else {
+ // This path only happens from flush(all). Which only happens from the
+ // UnifiedCache destructor. Nulling out value.cacheptr changes the behavior
+ // of value.removeRef(), causing the deletion to be done there.
+ value->cachePtr = nullptr;
+ }
+ }
+}
+
+int32_t UnifiedCache::removeHardRef(const SharedObject *value) const {
+ int refCount = 0;
+ if (value) {
+ refCount = umtx_atomic_dec(&value->hardRefCount);
+ U_ASSERT(refCount >= 0);
+ if (refCount == 0) {
+ --fNumValuesInUse;
+ }
+ }
+ return refCount;
+}
+
+int32_t UnifiedCache::addHardRef(const SharedObject *value) const {
+ int refCount = 0;
+ if (value) {
+ refCount = umtx_atomic_inc(&value->hardRefCount);
+ U_ASSERT(refCount >= 1);
+ if (refCount == 1) {
+ fNumValuesInUse++;
+ }
+ }
+ return refCount;
+}
+
U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/unifiedcache.h b/contrib/libs/icu/common/unifiedcache.h
index b8dcae90a0..d6c9945126 100644
--- a/contrib/libs/icu/common/unifiedcache.h
+++ b/contrib/libs/icu/common/unifiedcache.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -107,7 +107,7 @@ class CacheKey : public CacheKeyBase {
*/
virtual int32_t hashCode() const {
const char *s = typeid(T).name();
- return ustr_hashCharsN(s, static_cast<int32_t>(uprv_strlen(s)));
+ return ustr_hashCharsN(s, static_cast<int32_t>(uprv_strlen(s)));
}
/**
@@ -137,7 +137,7 @@ class LocaleCacheKey : public CacheKey<T> {
protected:
Locale fLoc;
public:
- LocaleCacheKey(const Locale &loc) : fLoc(loc) {}
+ LocaleCacheKey(const Locale &loc) : fLoc(loc) {}
LocaleCacheKey(const LocaleCacheKey<T> &other)
: CacheKey<T>(other), fLoc(other.fLoc) { }
virtual ~LocaleCacheKey() { }
@@ -190,7 +190,7 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
UnifiedCache(UErrorCode &status);
/**
- * Return a pointer to the global cache instance.
+ * Return a pointer to the global cache instance.
*/
static UnifiedCache *getInstance(UErrorCode &status);
@@ -294,7 +294,7 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
/**
* Configures at what point evcition of unused entries will begin.
- * Eviction is triggered whenever the number of evictable keys exeeds
+ * Eviction is triggered whenever the number of evictable keys exeeds
* BOTH count AND (number of in-use items) * (percentageOfInUseItems / 100).
* Once the number of unused entries drops below one of these,
* eviction ceases. Because eviction happens incrementally,
@@ -341,214 +341,214 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
*/
int32_t unusedCount() const;
- virtual void handleUnreferencedObject() const;
+ virtual void handleUnreferencedObject() const;
virtual ~UnifiedCache();
-
+
private:
UHashtable *fHashtable;
mutable int32_t fEvictPos;
- mutable int32_t fNumValuesTotal;
- mutable int32_t fNumValuesInUse;
+ mutable int32_t fNumValuesTotal;
+ mutable int32_t fNumValuesInUse;
int32_t fMaxUnused;
int32_t fMaxPercentageOfInUse;
mutable int64_t fAutoEvictedCount;
- SharedObject *fNoValue;
-
+ SharedObject *fNoValue;
+
UnifiedCache(const UnifiedCache &other);
UnifiedCache &operator=(const UnifiedCache &other);
-
- /**
- * Flushes the contents of the cache. If cache values hold references to other
- * cache values then _flush should be called in a loop until it returns FALSE.
- *
- * On entry, gCacheMutex must be held.
- * On exit, those values with are evictable are flushed.
- *
- * @param all if false flush evictable items only, which are those with no external
- * references, plus those that can be safely recreated.<br>
- * if true, flush all elements. Any values (sharedObjects) with remaining
- * hard (external) references are not deleted, but are detached from
- * the cache, so that a subsequent removeRefs can delete them.
- * _flush is not thread safe when all is true.
- * @return TRUE if any value in cache was flushed or FALSE otherwise.
- */
+
+ /**
+ * Flushes the contents of the cache. If cache values hold references to other
+ * cache values then _flush should be called in a loop until it returns FALSE.
+ *
+ * On entry, gCacheMutex must be held.
+ * On exit, those values with are evictable are flushed.
+ *
+ * @param all if false flush evictable items only, which are those with no external
+ * references, plus those that can be safely recreated.<br>
+ * if true, flush all elements. Any values (sharedObjects) with remaining
+ * hard (external) references are not deleted, but are detached from
+ * the cache, so that a subsequent removeRefs can delete them.
+ * _flush is not thread safe when all is true.
+ * @return TRUE if any value in cache was flushed or FALSE otherwise.
+ */
UBool _flush(UBool all) const;
-
- /**
- * Gets value out of cache.
- * On entry. gCacheMutex must not be held. value must be NULL. status
- * must be U_ZERO_ERROR.
- * On exit. value and status set to what is in cache at key or on cache
- * miss the key's createObject() is called and value and status are set to
- * the result of that. In this latter case, best effort is made to add the
- * value and status to the cache. If createObject() fails to create a value,
- * fNoValue is stored in cache, and value is set to NULL. Caller must call
- * removeRef on value if non NULL.
- */
+
+ /**
+ * Gets value out of cache.
+ * On entry. gCacheMutex must not be held. value must be NULL. status
+ * must be U_ZERO_ERROR.
+ * On exit. value and status set to what is in cache at key or on cache
+ * miss the key's createObject() is called and value and status are set to
+ * the result of that. In this latter case, best effort is made to add the
+ * value and status to the cache. If createObject() fails to create a value,
+ * fNoValue is stored in cache, and value is set to NULL. Caller must call
+ * removeRef on value if non NULL.
+ */
void _get(
const CacheKeyBase &key,
const SharedObject *&value,
const void *creationContext,
UErrorCode &status) const;
-
- /**
- * Attempts to fetch value and status for key from cache.
- * On entry, gCacheMutex must not be held value must be NULL and status must
- * be U_ZERO_ERROR.
- * On exit, either returns FALSE (In this
- * case caller should try to create the object) or returns TRUE with value
- * pointing to the fetched value and status set to fetched status. When
- * FALSE is returned status may be set to failure if an in progress hash
- * entry could not be made but value will remain unchanged. When TRUE is
- * returned, caller must call removeRef() on value.
- */
- UBool _poll(
- const CacheKeyBase &key,
- const SharedObject *&value,
- UErrorCode &status) const;
-
- /**
- * Places a new value and creationStatus in the cache for the given key.
- * On entry, gCacheMutex must be held. key must not exist in the cache.
- * On exit, value and creation status placed under key. Soft reference added
- * to value on successful add. On error sets status.
- */
- void _putNew(
- const CacheKeyBase &key,
- const SharedObject *value,
- const UErrorCode creationStatus,
- UErrorCode &status) const;
-
- /**
- * Places value and status at key if there is no value at key or if cache
- * entry for key is in progress. Otherwise, it leaves the current value and
- * status there.
- *
- * On entry. gCacheMutex must not be held. Value must be
- * included in the reference count of the object to which it points.
- *
- * On exit, value and status are changed to what was already in the cache if
- * something was there and not in progress. Otherwise, value and status are left
- * unchanged in which case they are placed in the cache on a best-effort basis.
- * Caller must call removeRef() on value.
- */
+
+ /**
+ * Attempts to fetch value and status for key from cache.
+ * On entry, gCacheMutex must not be held value must be NULL and status must
+ * be U_ZERO_ERROR.
+ * On exit, either returns FALSE (In this
+ * case caller should try to create the object) or returns TRUE with value
+ * pointing to the fetched value and status set to fetched status. When
+ * FALSE is returned status may be set to failure if an in progress hash
+ * entry could not be made but value will remain unchanged. When TRUE is
+ * returned, caller must call removeRef() on value.
+ */
+ UBool _poll(
+ const CacheKeyBase &key,
+ const SharedObject *&value,
+ UErrorCode &status) const;
+
+ /**
+ * Places a new value and creationStatus in the cache for the given key.
+ * On entry, gCacheMutex must be held. key must not exist in the cache.
+ * On exit, value and creation status placed under key. Soft reference added
+ * to value on successful add. On error sets status.
+ */
+ void _putNew(
+ const CacheKeyBase &key,
+ const SharedObject *value,
+ const UErrorCode creationStatus,
+ UErrorCode &status) const;
+
+ /**
+ * Places value and status at key if there is no value at key or if cache
+ * entry for key is in progress. Otherwise, it leaves the current value and
+ * status there.
+ *
+ * On entry. gCacheMutex must not be held. Value must be
+ * included in the reference count of the object to which it points.
+ *
+ * On exit, value and status are changed to what was already in the cache if
+ * something was there and not in progress. Otherwise, value and status are left
+ * unchanged in which case they are placed in the cache on a best-effort basis.
+ * Caller must call removeRef() on value.
+ */
void _putIfAbsentAndGet(
const CacheKeyBase &key,
const SharedObject *&value,
UErrorCode &status) const;
-
- /**
- * Returns the next element in the cache round robin style.
- * Returns nullptr if the cache is empty.
- * On entry, gCacheMutex must be held.
- */
- const UHashElement *_nextElement() const;
-
- /**
- * Return the number of cache items that would need to be evicted
- * to bring usage into conformance with eviction policy.
- *
- * An item corresponds to an entry in the hash table, a hash table element.
- *
- * On entry, gCacheMutex must be held.
- */
+
+ /**
+ * Returns the next element in the cache round robin style.
+ * Returns nullptr if the cache is empty.
+ * On entry, gCacheMutex must be held.
+ */
+ const UHashElement *_nextElement() const;
+
+ /**
+ * Return the number of cache items that would need to be evicted
+ * to bring usage into conformance with eviction policy.
+ *
+ * An item corresponds to an entry in the hash table, a hash table element.
+ *
+ * On entry, gCacheMutex must be held.
+ */
int32_t _computeCountOfItemsToEvict() const;
-
- /**
- * Run an eviction slice.
- * On entry, gCacheMutex must be held.
- * _runEvictionSlice runs a slice of the evict pipeline by examining the next
- * 10 entries in the cache round robin style evicting them if they are eligible.
- */
+
+ /**
+ * Run an eviction slice.
+ * On entry, gCacheMutex must be held.
+ * _runEvictionSlice runs a slice of the evict pipeline by examining the next
+ * 10 entries in the cache round robin style evicting them if they are eligible.
+ */
void _runEvictionSlice() const;
-
- /**
- * Register a master cache entry. A master key is the first key to create
- * a given SharedObject value. Subsequent keys whose create function
- * produce referneces to an already existing SharedObject are not masters -
- * they can be evicted and subsequently recreated.
- *
- * On entry, gCacheMutex must be held.
- * On exit, items in use count incremented, entry is marked as a master
- * entry, and value registered with cache so that subsequent calls to
- * addRef() and removeRef() on it correctly interact with the cache.
- */
- void _registerMaster(const CacheKeyBase *theKey, const SharedObject *value) const;
-
- /**
- * Store a value and creation error status in given hash entry.
- * On entry, gCacheMutex must be held. Hash entry element must be in progress.
- * value must be non NULL.
- * On Exit, soft reference added to value. value and status stored in hash
- * entry. Soft reference removed from previous stored value. Waiting
- * threads notified.
- */
+
+ /**
+ * Register a master cache entry. A master key is the first key to create
+ * a given SharedObject value. Subsequent keys whose create function
+ * produce referneces to an already existing SharedObject are not masters -
+ * they can be evicted and subsequently recreated.
+ *
+ * On entry, gCacheMutex must be held.
+ * On exit, items in use count incremented, entry is marked as a master
+ * entry, and value registered with cache so that subsequent calls to
+ * addRef() and removeRef() on it correctly interact with the cache.
+ */
+ void _registerMaster(const CacheKeyBase *theKey, const SharedObject *value) const;
+
+ /**
+ * Store a value and creation error status in given hash entry.
+ * On entry, gCacheMutex must be held. Hash entry element must be in progress.
+ * value must be non NULL.
+ * On Exit, soft reference added to value. value and status stored in hash
+ * entry. Soft reference removed from previous stored value. Waiting
+ * threads notified.
+ */
void _put(
const UHashElement *element,
const SharedObject *value,
const UErrorCode status) const;
- /**
- * Remove a soft reference, and delete the SharedObject if no references remain.
- * To be used from within the UnifiedCache implementation only.
- * gCacheMutex must be held by caller.
- * @param value the SharedObject to be acted on.
- */
- void removeSoftRef(const SharedObject *value) const;
-
- /**
- * Increment the hard reference count of the given SharedObject.
- * gCacheMutex must be held by the caller.
- * Update numValuesEvictable on transitions between zero and one reference.
- *
- * @param value The SharedObject to be referenced.
- * @return the hard reference count after the addition.
- */
- int32_t addHardRef(const SharedObject *value) const;
-
- /**
- * Decrement the hard reference count of the given SharedObject.
- * gCacheMutex must be held by the caller.
- * Update numValuesEvictable on transitions between one and zero reference.
- *
- * @param value The SharedObject to be referenced.
- * @return the hard reference count after the removal.
- */
- int32_t removeHardRef(const SharedObject *value) const;
-
-
+ /**
+ * Remove a soft reference, and delete the SharedObject if no references remain.
+ * To be used from within the UnifiedCache implementation only.
+ * gCacheMutex must be held by caller.
+ * @param value the SharedObject to be acted on.
+ */
+ void removeSoftRef(const SharedObject *value) const;
+
+ /**
+ * Increment the hard reference count of the given SharedObject.
+ * gCacheMutex must be held by the caller.
+ * Update numValuesEvictable on transitions between zero and one reference.
+ *
+ * @param value The SharedObject to be referenced.
+ * @return the hard reference count after the addition.
+ */
+ int32_t addHardRef(const SharedObject *value) const;
+
+ /**
+ * Decrement the hard reference count of the given SharedObject.
+ * gCacheMutex must be held by the caller.
+ * Update numValuesEvictable on transitions between one and zero reference.
+ *
+ * @param value The SharedObject to be referenced.
+ * @return the hard reference count after the removal.
+ */
+ int32_t removeHardRef(const SharedObject *value) const;
+
+
#ifdef UNIFIED_CACHE_DEBUG
void _dumpContents() const;
#endif
-
- /**
- * Fetch value and error code from a particular hash entry.
- * On entry, gCacheMutex must be held. value must be either NULL or must be
- * included in the ref count of the object to which it points.
- * On exit, value and status set to what is in the hash entry. Caller must
- * eventually call removeRef on value.
- * If hash entry is in progress, value will be set to gNoValue and status will
- * be set to U_ZERO_ERROR.
- */
- void _fetch(const UHashElement *element, const SharedObject *&value,
- UErrorCode &status) const;
-
- /**
- * Determine if given hash entry is in progress.
- * On entry, gCacheMutex must be held.
- */
- UBool _inProgress(const UHashElement *element) const;
-
- /**
- * Determine if given hash entry is in progress.
- * On entry, gCacheMutex must be held.
- */
- UBool _inProgress(const SharedObject *theValue, UErrorCode creationStatus) const;
-
- /**
- * Determine if given hash entry is eligible for eviction.
- * On entry, gCacheMutex must be held.
- */
- UBool _isEvictable(const UHashElement *element) const;
+
+ /**
+ * Fetch value and error code from a particular hash entry.
+ * On entry, gCacheMutex must be held. value must be either NULL or must be
+ * included in the ref count of the object to which it points.
+ * On exit, value and status set to what is in the hash entry. Caller must
+ * eventually call removeRef on value.
+ * If hash entry is in progress, value will be set to gNoValue and status will
+ * be set to U_ZERO_ERROR.
+ */
+ void _fetch(const UHashElement *element, const SharedObject *&value,
+ UErrorCode &status) const;
+
+ /**
+ * Determine if given hash entry is in progress.
+ * On entry, gCacheMutex must be held.
+ */
+ UBool _inProgress(const UHashElement *element) const;
+
+ /**
+ * Determine if given hash entry is in progress.
+ * On entry, gCacheMutex must be held.
+ */
+ UBool _inProgress(const SharedObject *theValue, UErrorCode creationStatus) const;
+
+ /**
+ * Determine if given hash entry is eligible for eviction.
+ * On entry, gCacheMutex must be held.
+ */
+ UBool _isEvictable(const UHashElement *element) const;
};
U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/unifilt.cpp b/contrib/libs/icu/common/unifilt.cpp
index 17577f138e..4ab0d9b5f9 100644
--- a/contrib/libs/icu/common/unifilt.cpp
+++ b/contrib/libs/icu/common/unifilt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/unifunct.cpp b/contrib/libs/icu/common/unifunct.cpp
index fc66ac67cf..f3995b298d 100644
--- a/contrib/libs/icu/common/unifunct.cpp
+++ b/contrib/libs/icu/common/unifunct.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/uniset.cpp b/contrib/libs/icu/common/uniset.cpp
index c0021fd0b1..b73d612f24 100644
--- a/contrib/libs/icu/common/uniset.cpp
+++ b/contrib/libs/icu/common/uniset.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -14,7 +14,7 @@
#include "unicode/parsepos.h"
#include "unicode/symtable.h"
#include "unicode/uniset.h"
-#include "unicode/ustring.h"
+#include "unicode/ustring.h"
#include "unicode/utf8.h"
#include "unicode/utf16.h"
#include "ruleiter.h"
@@ -54,8 +54,8 @@
// LOW <= all valid values. ZERO for codepoints
#define UNICODESET_LOW 0x000000
-/** Max list [0, 1, 2, ..., max code point, HIGH] */
-constexpr int32_t MAX_LENGTH = UNICODESET_HIGH + 1;
+/** Max list [0, 1, 2, ..., max code point, HIGH] */
+constexpr int32_t MAX_LENGTH = UNICODESET_HIGH + 1;
U_NAMESPACE_BEGIN
@@ -135,18 +135,18 @@ static int8_t U_CALLCONV compareUnicodeString(UElement t1, UElement t2) {
return a.compare(b);
}
-UBool UnicodeSet::hasStrings() const {
- return strings != nullptr && !strings->isEmpty();
-}
-
-int32_t UnicodeSet::stringsSize() const {
- return strings == nullptr ? 0 : strings->size();
-}
-
-UBool UnicodeSet::stringsContains(const UnicodeString &s) const {
- return strings != nullptr && strings->contains((void*) &s);
-}
-
+UBool UnicodeSet::hasStrings() const {
+ return strings != nullptr && !strings->isEmpty();
+}
+
+int32_t UnicodeSet::stringsSize() const {
+ return strings == nullptr ? 0 : strings->size();
+}
+
+UBool UnicodeSet::stringsContains(const UnicodeString &s) const {
+ return strings != nullptr && strings->contains((void*) &s);
+}
+
//----------------------------------------------------------------
// Constructors &c
//----------------------------------------------------------------
@@ -154,8 +154,8 @@ UBool UnicodeSet::stringsContains(const UnicodeString &s) const {
/**
* Constructs an empty set.
*/
-UnicodeSet::UnicodeSet() {
- list[0] = UNICODESET_HIGH;
+UnicodeSet::UnicodeSet() {
+ list[0] = UNICODESET_HIGH;
_dbgct(this);
}
@@ -166,38 +166,38 @@ UnicodeSet::UnicodeSet() {
* @param start first character, inclusive, of range
* @param end last character, inclusive, of range
*/
-UnicodeSet::UnicodeSet(UChar32 start, UChar32 end) {
- list[0] = UNICODESET_HIGH;
- add(start, end);
+UnicodeSet::UnicodeSet(UChar32 start, UChar32 end) {
+ list[0] = UNICODESET_HIGH;
+ add(start, end);
_dbgct(this);
}
/**
* Constructs a set that is identical to the given UnicodeSet.
*/
-UnicodeSet::UnicodeSet(const UnicodeSet& o) : UnicodeFilter(o) {
- *this = o;
+UnicodeSet::UnicodeSet(const UnicodeSet& o) : UnicodeFilter(o) {
+ *this = o;
_dbgct(this);
}
// Copy-construct as thawed.
-UnicodeSet::UnicodeSet(const UnicodeSet& o, UBool /* asThawed */) : UnicodeFilter(o) {
- if (ensureCapacity(o.len)) {
+UnicodeSet::UnicodeSet(const UnicodeSet& o, UBool /* asThawed */) : UnicodeFilter(o) {
+ if (ensureCapacity(o.len)) {
// *this = o except for bmpSet and stringSpan
len = o.len;
uprv_memcpy(list, o.list, (size_t)len*sizeof(UChar32));
- if (o.hasStrings()) {
- UErrorCode status = U_ZERO_ERROR;
- if (!allocateStrings(status) ||
- (strings->assign(*o.strings, cloneUnicodeString, status), U_FAILURE(status))) {
- setToBogus();
- return;
- }
+ if (o.hasStrings()) {
+ UErrorCode status = U_ZERO_ERROR;
+ if (!allocateStrings(status) ||
+ (strings->assign(*o.strings, cloneUnicodeString, status), U_FAILURE(status))) {
+ setToBogus();
+ return;
+ }
}
if (o.pat) {
- setPattern(o.pat, o.patLen);
+ setPattern(o.pat, o.patLen);
}
- _dbgct(this);
+ _dbgct(this);
}
}
@@ -206,11 +206,11 @@ UnicodeSet::UnicodeSet(const UnicodeSet& o, UBool /* asThawed */) : UnicodeFilte
*/
UnicodeSet::~UnicodeSet() {
_dbgdt(this); // first!
- if (list != stackList) {
- uprv_free(list);
- }
+ if (list != stackList) {
+ uprv_free(list);
+ }
delete bmpSet;
- if (buffer != stackList) {
+ if (buffer != stackList) {
uprv_free(buffer);
}
delete strings;
@@ -222,10 +222,10 @@ UnicodeSet::~UnicodeSet() {
* Assigns this object to be a copy of another.
*/
UnicodeSet& UnicodeSet::operator=(const UnicodeSet& o) {
- return copyFrom(o, FALSE);
-}
-
-UnicodeSet& UnicodeSet::copyFrom(const UnicodeSet& o, UBool asThawed) {
+ return copyFrom(o, FALSE);
+}
+
+UnicodeSet& UnicodeSet::copyFrom(const UnicodeSet& o, UBool asThawed) {
if (this == &o) {
return *this;
}
@@ -236,30 +236,30 @@ UnicodeSet& UnicodeSet::copyFrom(const UnicodeSet& o, UBool asThawed) {
setToBogus();
return *this;
}
- if (!ensureCapacity(o.len)) {
- // ensureCapacity will mark the UnicodeSet as Bogus if OOM failure happens.
- return *this;
+ if (!ensureCapacity(o.len)) {
+ // ensureCapacity will mark the UnicodeSet as Bogus if OOM failure happens.
+ return *this;
}
len = o.len;
uprv_memcpy(list, o.list, (size_t)len*sizeof(UChar32));
- if (o.bmpSet != nullptr && !asThawed) {
+ if (o.bmpSet != nullptr && !asThawed) {
bmpSet = new BMPSet(*o.bmpSet, list, len);
if (bmpSet == NULL) { // Check for memory allocation error.
setToBogus();
return *this;
}
}
- if (o.hasStrings()) {
- UErrorCode status = U_ZERO_ERROR;
- if ((strings == nullptr && !allocateStrings(status)) ||
- (strings->assign(*o.strings, cloneUnicodeString, status), U_FAILURE(status))) {
- setToBogus();
- return *this;
- }
- } else if (hasStrings()) {
- strings->removeAllElements();
- }
- if (o.stringSpan != nullptr && !asThawed) {
+ if (o.hasStrings()) {
+ UErrorCode status = U_ZERO_ERROR;
+ if ((strings == nullptr && !allocateStrings(status)) ||
+ (strings->assign(*o.strings, cloneUnicodeString, status), U_FAILURE(status))) {
+ setToBogus();
+ return *this;
+ }
+ } else if (hasStrings()) {
+ strings->removeAllElements();
+ }
+ if (o.stringSpan != nullptr && !asThawed) {
stringSpan = new UnicodeSetStringSpan(*o.stringSpan, *strings);
if (stringSpan == NULL) { // Check for memory allocation error.
setToBogus();
@@ -268,7 +268,7 @@ UnicodeSet& UnicodeSet::copyFrom(const UnicodeSet& o, UBool asThawed) {
}
releasePattern();
if (o.pat) {
- setPattern(o.pat, o.patLen);
+ setPattern(o.pat, o.patLen);
}
return *this;
}
@@ -278,11 +278,11 @@ UnicodeSet& UnicodeSet::copyFrom(const UnicodeSet& o, UBool asThawed) {
* to support cloning in order to allow classes using
* UnicodeMatchers, such as Transliterator, to implement cloning.
*/
-UnicodeSet* UnicodeSet::clone() const {
+UnicodeSet* UnicodeSet::clone() const {
return new UnicodeSet(*this);
}
-UnicodeSet *UnicodeSet::cloneAsThawed() const {
+UnicodeSet *UnicodeSet::cloneAsThawed() const {
return new UnicodeSet(*this, TRUE);
}
@@ -301,8 +301,8 @@ UBool UnicodeSet::operator==(const UnicodeSet& o) const {
for (int32_t i = 0; i < len; ++i) {
if (list[i] != o.list[i]) return FALSE;
}
- if (hasStrings() != o.hasStrings()) { return FALSE; }
- if (hasStrings() && *strings != *o.strings) return FALSE;
+ if (hasStrings() != o.hasStrings()) { return FALSE; }
+ if (hasStrings() && *strings != *o.strings) return FALSE;
return TRUE;
}
@@ -313,12 +313,12 @@ UBool UnicodeSet::operator==(const UnicodeSet& o) const {
* @see Object#hashCode()
*/
int32_t UnicodeSet::hashCode(void) const {
- uint32_t result = static_cast<uint32_t>(len);
+ uint32_t result = static_cast<uint32_t>(len);
for (int32_t i = 0; i < len; ++i) {
- result *= 1000003u;
+ result *= 1000003u;
result += list[i];
}
- return static_cast<int32_t>(result);
+ return static_cast<int32_t>(result);
}
//----------------------------------------------------------------
@@ -338,7 +338,7 @@ int32_t UnicodeSet::size(void) const {
for (int32_t i = 0; i < count; ++i) {
n += getRangeEnd(i) - getRangeStart(i) + 1;
}
- return n + stringsSize();
+ return n + stringsSize();
}
/**
@@ -347,7 +347,7 @@ int32_t UnicodeSet::size(void) const {
* @return <tt>true</tt> if this set contains no elements.
*/
UBool UnicodeSet::isEmpty(void) const {
- return len == 1 && !hasStrings();
+ return len == 1 && !hasStrings();
}
/**
@@ -447,7 +447,7 @@ UBool UnicodeSet::contains(const UnicodeString& s) const {
if (s.length() == 0) return FALSE;
int32_t cp = getSingleCP(s);
if (cp < 0) {
- return stringsContains(s);
+ return stringsContains(s);
} else {
return contains((UChar32) cp);
}
@@ -469,7 +469,7 @@ UBool UnicodeSet::containsAll(const UnicodeSet& c) const {
return FALSE;
}
}
- return !c.hasStrings() || (strings != nullptr && strings->containsAll(*c.strings));
+ return !c.hasStrings() || (strings != nullptr && strings->containsAll(*c.strings));
}
/**
@@ -515,7 +515,7 @@ UBool UnicodeSet::containsNone(const UnicodeSet& c) const {
return FALSE;
}
}
- return strings == nullptr || !c.hasStrings() || strings->containsNone(*c.strings);
+ return strings == nullptr || !c.hasStrings() || strings->containsNone(*c.strings);
}
/**
@@ -556,7 +556,7 @@ UBool UnicodeSet::matchesIndexValue(uint8_t v) const {
return TRUE;
}
}
- if (hasStrings()) {
+ if (hasStrings()) {
for (i=0; i<strings->size(); ++i) {
const UnicodeString& s = *(const UnicodeString*)strings->elementAt(i);
//if (s.length() == 0) {
@@ -591,7 +591,7 @@ UMatchDegree UnicodeSet::matches(const Replaceable& text,
return U_MISMATCH;
}
} else {
- if (hasStrings()) { // try strings first
+ if (hasStrings()) { // try strings first
// might separate forward and backward loops later
// for now they are combined
@@ -792,39 +792,39 @@ UnicodeSet& UnicodeSet::set(UChar32 start, UChar32 end) {
*/
UnicodeSet& UnicodeSet::add(UChar32 start, UChar32 end) {
if (pinCodePoint(start) < pinCodePoint(end)) {
- UChar32 limit = end + 1;
- // Fast path for adding a new range after the last one.
- // Odd list length: [..., lastStart, lastLimit, HIGH]
- if ((len & 1) != 0) {
- // If the list is empty, set lastLimit low enough to not be adjacent to 0.
- UChar32 lastLimit = len == 1 ? -2 : list[len - 2];
- if (lastLimit <= start && !isFrozen() && !isBogus()) {
- if (lastLimit == start) {
- // Extend the last range.
- list[len - 2] = limit;
- if (limit == UNICODESET_HIGH) {
- --len;
- }
- } else {
- list[len - 1] = start;
- if (limit < UNICODESET_HIGH) {
- if (ensureCapacity(len + 2)) {
- list[len++] = limit;
- list[len++] = UNICODESET_HIGH;
- }
- } else { // limit == UNICODESET_HIGH
- if (ensureCapacity(len + 1)) {
- list[len++] = UNICODESET_HIGH;
- }
- }
- }
- releasePattern();
- return *this;
- }
- }
- // This is slow. Could be much faster using findCodePoint(start)
- // and modifying the list, dealing with adjacent & overlapping ranges.
- UChar32 range[3] = { start, limit, UNICODESET_HIGH };
+ UChar32 limit = end + 1;
+ // Fast path for adding a new range after the last one.
+ // Odd list length: [..., lastStart, lastLimit, HIGH]
+ if ((len & 1) != 0) {
+ // If the list is empty, set lastLimit low enough to not be adjacent to 0.
+ UChar32 lastLimit = len == 1 ? -2 : list[len - 2];
+ if (lastLimit <= start && !isFrozen() && !isBogus()) {
+ if (lastLimit == start) {
+ // Extend the last range.
+ list[len - 2] = limit;
+ if (limit == UNICODESET_HIGH) {
+ --len;
+ }
+ } else {
+ list[len - 1] = start;
+ if (limit < UNICODESET_HIGH) {
+ if (ensureCapacity(len + 2)) {
+ list[len++] = limit;
+ list[len++] = UNICODESET_HIGH;
+ }
+ } else { // limit == UNICODESET_HIGH
+ if (ensureCapacity(len + 1)) {
+ list[len++] = UNICODESET_HIGH;
+ }
+ }
+ }
+ releasePattern();
+ return *this;
+ }
+ }
+ // This is slow. Could be much faster using findCodePoint(start)
+ // and modifying the list, dealing with adjacent & overlapping ranges.
+ UChar32 range[3] = { start, limit, UNICODESET_HIGH };
add(range, 2, 0);
} else if (start == end) {
add(start);
@@ -893,9 +893,9 @@ UnicodeSet& UnicodeSet::add(UChar32 c) {
list[i] = c;
// if we touched the HIGH mark, then add a new one
if (c == (UNICODESET_HIGH - 1)) {
- if (!ensureCapacity(len+1)) {
- // ensureCapacity will mark the object as Bogus if OOM failure happens.
- return *this;
+ if (!ensureCapacity(len+1)) {
+ // ensureCapacity will mark the object as Bogus if OOM failure happens.
+ return *this;
}
list[len++] = UNICODESET_HIGH;
}
@@ -937,13 +937,13 @@ UnicodeSet& UnicodeSet::add(UChar32 c) {
// ^
// list[i]
- if (!ensureCapacity(len+2)) {
- // ensureCapacity will mark the object as Bogus if OOM failure happens.
- return *this;
+ if (!ensureCapacity(len+2)) {
+ // ensureCapacity will mark the object as Bogus if OOM failure happens.
+ return *this;
}
- UChar32 *p = list + i;
- uprv_memmove(p + 2, p, (len - i) * sizeof(*p));
+ UChar32 *p = list + i;
+ uprv_memmove(p + 2, p, (len - i) * sizeof(*p));
list[i] = c;
list[i+1] = c+1;
len += 2;
@@ -979,7 +979,7 @@ UnicodeSet& UnicodeSet::add(const UnicodeString& s) {
if (s.length() == 0 || isFrozen() || isBogus()) return *this;
int32_t cp = getSingleCP(s);
if (cp < 0) {
- if (!stringsContains(s)) {
+ if (!stringsContains(s)) {
_add(s);
releasePattern();
}
@@ -998,11 +998,11 @@ void UnicodeSet::_add(const UnicodeString& s) {
if (isFrozen() || isBogus()) {
return;
}
- UErrorCode ec = U_ZERO_ERROR;
- if (strings == nullptr && !allocateStrings(ec)) {
- setToBogus();
- return;
- }
+ UErrorCode ec = U_ZERO_ERROR;
+ if (strings == nullptr && !allocateStrings(ec)) {
+ setToBogus();
+ return;
+ }
UnicodeString* t = new UnicodeString(s);
if (t == NULL) { // Check for memory allocation error.
setToBogus();
@@ -1090,10 +1090,10 @@ UnicodeSet& UnicodeSet::removeAll(const UnicodeString& s) {
}
UnicodeSet& UnicodeSet::removeAllStrings() {
- if (!isFrozen() && hasStrings()) {
- strings->removeAllElements();
- releasePattern();
- }
+ if (!isFrozen() && hasStrings()) {
+ strings->removeAllElements();
+ releasePattern();
+ }
return *this;
}
@@ -1189,9 +1189,9 @@ UnicodeSet& UnicodeSet::remove(const UnicodeString& s) {
if (s.length() == 0 || isFrozen() || isBogus()) return *this;
int32_t cp = getSingleCP(s);
if (cp < 0) {
- if (strings != nullptr && strings->removeElement((void*) &s)) {
- releasePattern();
- }
+ if (strings != nullptr && strings->removeElement((void*) &s)) {
+ releasePattern();
+ }
} else {
remove((UChar32)cp, (UChar32)cp);
}
@@ -1234,14 +1234,14 @@ UnicodeSet& UnicodeSet::complement(void) {
return *this;
}
if (list[0] == UNICODESET_LOW) {
- uprv_memmove(list, list + 1, (size_t)(len-1)*sizeof(UChar32));
+ uprv_memmove(list, list + 1, (size_t)(len-1)*sizeof(UChar32));
--len;
} else {
- if (!ensureCapacity(len+1)) {
+ if (!ensureCapacity(len+1)) {
return *this;
}
- uprv_memmove(list + 1, list, (size_t)len*sizeof(UChar32));
- list[0] = UNICODESET_LOW;
+ uprv_memmove(list + 1, list, (size_t)len*sizeof(UChar32));
+ list[0] = UNICODESET_LOW;
++len;
}
releasePattern();
@@ -1260,7 +1260,7 @@ UnicodeSet& UnicodeSet::complement(const UnicodeString& s) {
if (s.length() == 0 || isFrozen() || isBogus()) return *this;
int32_t cp = getSingleCP(s);
if (cp < 0) {
- if (stringsContains(s)) {
+ if (stringsContains(s)) {
strings->removeElement((void*) &s);
} else {
_add(s);
@@ -1291,7 +1291,7 @@ UnicodeSet& UnicodeSet::addAll(const UnicodeSet& c) {
if ( c.strings!=NULL ) {
for (int32_t i=0; i<c.strings->size(); ++i) {
const UnicodeString* s = (const UnicodeString*)c.strings->elementAt(i);
- if (!stringsContains(*s)) {
+ if (!stringsContains(*s)) {
_add(*s);
}
}
@@ -1313,13 +1313,13 @@ UnicodeSet& UnicodeSet::retainAll(const UnicodeSet& c) {
return *this;
}
retain(c.list, c.len, 0);
- if (hasStrings()) {
- if (!c.hasStrings()) {
- strings->removeAllElements();
- } else {
- strings->retainAll(*c.strings);
- }
- }
+ if (hasStrings()) {
+ if (!c.hasStrings()) {
+ strings->removeAllElements();
+ } else {
+ strings->retainAll(*c.strings);
+ }
+ }
return *this;
}
@@ -1337,9 +1337,9 @@ UnicodeSet& UnicodeSet::removeAll(const UnicodeSet& c) {
return *this;
}
retain(c.list, c.len, 2);
- if (hasStrings() && c.hasStrings()) {
- strings->removeAll(*c.strings);
- }
+ if (hasStrings() && c.hasStrings()) {
+ strings->removeAll(*c.strings);
+ }
return *this;
}
@@ -1357,12 +1357,12 @@ UnicodeSet& UnicodeSet::complementAll(const UnicodeSet& c) {
}
exclusiveOr(c.list, c.len, 0);
- if (c.strings != nullptr) {
- for (int32_t i=0; i<c.strings->size(); ++i) {
- void* e = c.strings->elementAt(i);
- if (strings == nullptr || !strings->removeElement(e)) {
- _add(*(const UnicodeString*)e);
- }
+ if (c.strings != nullptr) {
+ for (int32_t i=0; i<c.strings->size(); ++i) {
+ void* e = c.strings->elementAt(i);
+ if (strings == nullptr || !strings->removeElement(e)) {
+ _add(*(const UnicodeString*)e);
+ }
}
}
return *this;
@@ -1376,14 +1376,14 @@ UnicodeSet& UnicodeSet::clear(void) {
if (isFrozen()) {
return *this;
}
- list[0] = UNICODESET_HIGH;
+ list[0] = UNICODESET_HIGH;
len = 1;
releasePattern();
if (strings != NULL) {
strings->removeAllElements();
}
- // Remove bogus
- fFlags = 0;
+ // Remove bogus
+ fFlags = 0;
return *this;
}
@@ -1430,32 +1430,32 @@ UnicodeSet& UnicodeSet::compact() {
return *this;
}
// Delete buffer first to defragment memory less.
- if (buffer != stackList) {
+ if (buffer != stackList) {
uprv_free(buffer);
buffer = NULL;
- bufferCapacity = 0;
- }
- if (list == stackList) {
- // pass
- } else if (len <= INITIAL_CAPACITY) {
- uprv_memcpy(stackList, list, len * sizeof(UChar32));
- uprv_free(list);
- list = stackList;
- capacity = INITIAL_CAPACITY;
- } else if ((len + 7) < capacity) {
- // If we have more than a little unused capacity, shrink it to len.
- UChar32* temp = (UChar32*) uprv_realloc(list, sizeof(UChar32) * len);
+ bufferCapacity = 0;
+ }
+ if (list == stackList) {
+ // pass
+ } else if (len <= INITIAL_CAPACITY) {
+ uprv_memcpy(stackList, list, len * sizeof(UChar32));
+ uprv_free(list);
+ list = stackList;
+ capacity = INITIAL_CAPACITY;
+ } else if ((len + 7) < capacity) {
+ // If we have more than a little unused capacity, shrink it to len.
+ UChar32* temp = (UChar32*) uprv_realloc(list, sizeof(UChar32) * len);
if (temp) {
list = temp;
- capacity = len;
+ capacity = len;
}
// else what the heck happened?! We allocated less memory!
// Oh well. We'll keep our original array.
}
- if (strings != nullptr && strings->isEmpty()) {
- delete strings;
- strings = nullptr;
- }
+ if (strings != nullptr && strings->isEmpty()) {
+ delete strings;
+ strings = nullptr;
+ }
return *this;
}
@@ -1466,8 +1466,8 @@ UnicodeSet& UnicodeSet::compact() {
/**
* Deserialize constructor.
*/
-UnicodeSet::UnicodeSet(const uint16_t data[], int32_t dataLen, ESerialization serialization,
- UErrorCode &ec) {
+UnicodeSet::UnicodeSet(const uint16_t data[], int32_t dataLen, ESerialization serialization,
+ UErrorCode &ec) {
if(U_FAILURE(ec)) {
setToBogus();
@@ -1486,11 +1486,11 @@ UnicodeSet::UnicodeSet(const uint16_t data[], int32_t dataLen, ESerialization se
int32_t headerSize = ((data[0]&0x8000)) ?2:1;
int32_t bmpLength = (headerSize==1)?data[0]:data[1];
- int32_t newLength = (((data[0]&0x7FFF)-bmpLength)/2)+bmpLength;
+ int32_t newLength = (((data[0]&0x7FFF)-bmpLength)/2)+bmpLength;
#ifdef DEBUG_SERIALIZE
- printf("dataLen %d headerSize %d bmpLen %d len %d. data[0]=%X/%X/%X/%X\n", dataLen,headerSize,bmpLength,newLength, data[0],data[1],data[2],data[3]);
+ printf("dataLen %d headerSize %d bmpLen %d len %d. data[0]=%X/%X/%X/%X\n", dataLen,headerSize,bmpLength,newLength, data[0],data[1],data[2],data[3]);
#endif
- if(!ensureCapacity(newLength + 1)) { // +1 for HIGH
+ if(!ensureCapacity(newLength + 1)) { // +1 for HIGH
return;
}
// copy bmp
@@ -1502,18 +1502,18 @@ UnicodeSet::UnicodeSet(const uint16_t data[], int32_t dataLen, ESerialization se
#endif
}
// copy smp
- for(i=bmpLength;i<newLength;i++) {
+ for(i=bmpLength;i<newLength;i++) {
list[i] = ((UChar32)data[headerSize+bmpLength+(i-bmpLength)*2+0] << 16) +
((UChar32)data[headerSize+bmpLength+(i-bmpLength)*2+1]);
#ifdef DEBUG_SERIALIZE
printf("<<32@%d+[%d] %lX\n", headerSize+bmpLength+i, i, list[i]);
#endif
}
- U_ASSERT(i == newLength);
- if (i == 0 || list[i - 1] != UNICODESET_HIGH) {
- list[i++] = UNICODESET_HIGH;
- }
- len = i;
+ U_ASSERT(i == newLength);
+ if (i == 0 || list[i - 1] != UNICODESET_HIGH) {
+ list[i++] = UNICODESET_HIGH;
+ }
+ len = i;
}
@@ -1634,65 +1634,65 @@ UBool UnicodeSet::allocateStrings(UErrorCode &status) {
return TRUE;
}
-int32_t UnicodeSet::nextCapacity(int32_t minCapacity) {
- // Grow exponentially to reduce the frequency of allocations.
- if (minCapacity < INITIAL_CAPACITY) {
- return minCapacity + INITIAL_CAPACITY;
- } else if (minCapacity <= 2500) {
- return 5 * minCapacity;
- } else {
- int32_t newCapacity = 2 * minCapacity;
- if (newCapacity > MAX_LENGTH) {
- newCapacity = MAX_LENGTH;
- }
- return newCapacity;
- }
-}
-
-bool UnicodeSet::ensureCapacity(int32_t newLen) {
- if (newLen > MAX_LENGTH) {
- newLen = MAX_LENGTH;
- }
- if (newLen <= capacity) {
- return true;
- }
- int32_t newCapacity = nextCapacity(newLen);
- UChar32* temp = (UChar32*) uprv_malloc(newCapacity * sizeof(UChar32));
+int32_t UnicodeSet::nextCapacity(int32_t minCapacity) {
+ // Grow exponentially to reduce the frequency of allocations.
+ if (minCapacity < INITIAL_CAPACITY) {
+ return minCapacity + INITIAL_CAPACITY;
+ } else if (minCapacity <= 2500) {
+ return 5 * minCapacity;
+ } else {
+ int32_t newCapacity = 2 * minCapacity;
+ if (newCapacity > MAX_LENGTH) {
+ newCapacity = MAX_LENGTH;
+ }
+ return newCapacity;
+ }
+}
+
+bool UnicodeSet::ensureCapacity(int32_t newLen) {
+ if (newLen > MAX_LENGTH) {
+ newLen = MAX_LENGTH;
+ }
+ if (newLen <= capacity) {
+ return true;
+ }
+ int32_t newCapacity = nextCapacity(newLen);
+ UChar32* temp = (UChar32*) uprv_malloc(newCapacity * sizeof(UChar32));
if (temp == NULL) {
- setToBogus(); // set the object to bogus state if an OOM failure occurred.
- return false;
+ setToBogus(); // set the object to bogus state if an OOM failure occurred.
+ return false;
+ }
+ // Copy only the actual contents.
+ uprv_memcpy(temp, list, len * sizeof(UChar32));
+ if (list != stackList) {
+ uprv_free(list);
}
- // Copy only the actual contents.
- uprv_memcpy(temp, list, len * sizeof(UChar32));
- if (list != stackList) {
- uprv_free(list);
- }
list = temp;
- capacity = newCapacity;
- return true;
+ capacity = newCapacity;
+ return true;
}
-bool UnicodeSet::ensureBufferCapacity(int32_t newLen) {
- if (newLen > MAX_LENGTH) {
- newLen = MAX_LENGTH;
- }
- if (newLen <= bufferCapacity) {
- return true;
- }
- int32_t newCapacity = nextCapacity(newLen);
- UChar32* temp = (UChar32*) uprv_malloc(newCapacity * sizeof(UChar32));
+bool UnicodeSet::ensureBufferCapacity(int32_t newLen) {
+ if (newLen > MAX_LENGTH) {
+ newLen = MAX_LENGTH;
+ }
+ if (newLen <= bufferCapacity) {
+ return true;
+ }
+ int32_t newCapacity = nextCapacity(newLen);
+ UChar32* temp = (UChar32*) uprv_malloc(newCapacity * sizeof(UChar32));
if (temp == NULL) {
setToBogus();
- return false;
+ return false;
+ }
+ // The buffer has no contents to be copied.
+ // It is always filled from scratch after this call.
+ if (buffer != stackList) {
+ uprv_free(buffer);
}
- // The buffer has no contents to be copied.
- // It is always filled from scratch after this call.
- if (buffer != stackList) {
- uprv_free(buffer);
- }
buffer = temp;
- bufferCapacity = newCapacity;
- return true;
+ bufferCapacity = newCapacity;
+ return true;
}
/**
@@ -1729,7 +1729,7 @@ void UnicodeSet::exclusiveOr(const UChar32* other, int32_t otherLen, int8_t pola
if (isFrozen() || isBogus()) {
return;
}
- if (!ensureBufferCapacity(len + otherLen)) {
+ if (!ensureBufferCapacity(len + otherLen)) {
return;
}
@@ -1777,7 +1777,7 @@ void UnicodeSet::add(const UChar32* other, int32_t otherLen, int8_t polarity) {
if (isFrozen() || isBogus() || other==NULL) {
return;
}
- if (!ensureBufferCapacity(len + otherLen)) {
+ if (!ensureBufferCapacity(len + otherLen)) {
return;
}
@@ -1888,7 +1888,7 @@ void UnicodeSet::retain(const UChar32* other, int32_t otherLen, int8_t polarity)
if (isFrozen() || isBogus()) {
return;
}
- if (!ensureBufferCapacity(len + otherLen)) {
+ if (!ensureBufferCapacity(len + otherLen)) {
return;
}
@@ -2134,14 +2134,14 @@ UnicodeString& UnicodeSet::_generatePattern(UnicodeString& result,
}
}
- if (strings != nullptr) {
- for (int32_t i = 0; i<strings->size(); ++i) {
- result.append(OPEN_BRACE);
- _appendToPat(result,
- *(const UnicodeString*) strings->elementAt(i),
- escapeUnprintable);
- result.append(CLOSE_BRACE);
- }
+ if (strings != nullptr) {
+ for (int32_t i = 0; i<strings->size(); ++i) {
+ result.append(OPEN_BRACE);
+ _appendToPat(result,
+ *(const UnicodeString*) strings->elementAt(i),
+ escapeUnprintable);
+ result.append(CLOSE_BRACE);
+ }
}
return result.append(SET_CLOSE);
}
@@ -2160,29 +2160,29 @@ void UnicodeSet::releasePattern() {
/**
* Set the new pattern to cache.
*/
-void UnicodeSet::setPattern(const char16_t *newPat, int32_t newPatLen) {
+void UnicodeSet::setPattern(const char16_t *newPat, int32_t newPatLen) {
releasePattern();
pat = (UChar *)uprv_malloc((newPatLen + 1) * sizeof(UChar));
if (pat) {
patLen = newPatLen;
- u_memcpy(pat, newPat, patLen);
+ u_memcpy(pat, newPat, patLen);
pat[patLen] = 0;
}
// else we don't care if malloc failed. This was just a nice cache.
// We can regenerate an equivalent pattern later when requested.
}
-UnicodeSet *UnicodeSet::freeze() {
+UnicodeSet *UnicodeSet::freeze() {
if(!isFrozen() && !isBogus()) {
- compact();
+ compact();
- // Optimize contains() and span() and similar functions.
- if (hasStrings()) {
- stringSpan = new UnicodeSetStringSpan(*this, *strings, UnicodeSetStringSpan::ALL);
- if (stringSpan == nullptr) {
+ // Optimize contains() and span() and similar functions.
+ if (hasStrings()) {
+ stringSpan = new UnicodeSetStringSpan(*this, *strings, UnicodeSetStringSpan::ALL);
+ if (stringSpan == nullptr) {
setToBogus();
return this;
- } else if (!stringSpan->needsStringSpanUTF16()) {
+ } else if (!stringSpan->needsStringSpanUTF16()) {
// All strings are irrelevant for span() etc. because
// all of each string's code points are contained in this set.
// Do not check needsStringSpanUTF8() because UTF-8 has at most as
@@ -2215,7 +2215,7 @@ int32_t UnicodeSet::span(const UChar *s, int32_t length, USetSpanCondition spanC
}
if(stringSpan!=NULL) {
return stringSpan->span(s, length, spanCondition);
- } else if(hasStrings()) {
+ } else if(hasStrings()) {
uint32_t which= spanCondition==USET_SPAN_NOT_CONTAINED ?
UnicodeSetStringSpan::FWD_UTF16_NOT_CONTAINED :
UnicodeSetStringSpan::FWD_UTF16_CONTAINED;
@@ -2252,7 +2252,7 @@ int32_t UnicodeSet::spanBack(const UChar *s, int32_t length, USetSpanCondition s
}
if(stringSpan!=NULL) {
return stringSpan->spanBack(s, length, spanCondition);
- } else if(hasStrings()) {
+ } else if(hasStrings()) {
uint32_t which= spanCondition==USET_SPAN_NOT_CONTAINED ?
UnicodeSetStringSpan::BACK_UTF16_NOT_CONTAINED :
UnicodeSetStringSpan::BACK_UTF16_CONTAINED;
@@ -2290,7 +2290,7 @@ int32_t UnicodeSet::spanUTF8(const char *s, int32_t length, USetSpanCondition sp
}
if(stringSpan!=NULL) {
return stringSpan->spanUTF8((const uint8_t *)s, length, spanCondition);
- } else if(hasStrings()) {
+ } else if(hasStrings()) {
uint32_t which= spanCondition==USET_SPAN_NOT_CONTAINED ?
UnicodeSetStringSpan::FWD_UTF8_NOT_CONTAINED :
UnicodeSetStringSpan::FWD_UTF8_CONTAINED;
@@ -2328,7 +2328,7 @@ int32_t UnicodeSet::spanBackUTF8(const char *s, int32_t length, USetSpanConditio
}
if(stringSpan!=NULL) {
return stringSpan->spanBackUTF8((const uint8_t *)s, length, spanCondition);
- } else if(hasStrings()) {
+ } else if(hasStrings()) {
uint32_t which= spanCondition==USET_SPAN_NOT_CONTAINED ?
UnicodeSetStringSpan::BACK_UTF8_NOT_CONTAINED :
UnicodeSetStringSpan::BACK_UTF8_CONTAINED;
diff --git a/contrib/libs/icu/common/uniset_closure.cpp b/contrib/libs/icu/common/uniset_closure.cpp
index c5e578bd2b..882231ba1a 100644
--- a/contrib/libs/icu/common/uniset_closure.cpp
+++ b/contrib/libs/icu/common/uniset_closure.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: uniset_closure.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -45,16 +45,16 @@ U_NAMESPACE_BEGIN
UnicodeSet::UnicodeSet(const UnicodeString& pattern,
uint32_t options,
const SymbolTable* symbols,
- UErrorCode& status) {
- applyPattern(pattern, options, symbols, status);
+ UErrorCode& status) {
+ applyPattern(pattern, options, symbols, status);
_dbgct(this);
}
UnicodeSet::UnicodeSet(const UnicodeString& pattern, ParsePosition& pos,
uint32_t options,
const SymbolTable* symbols,
- UErrorCode& status) {
- applyPattern(pattern, pos, options, symbols, status);
+ UErrorCode& status) {
+ applyPattern(pattern, pos, options, symbols, status);
_dbgct(this);
}
@@ -99,7 +99,7 @@ UnicodeSet& UnicodeSet::applyPattern(const UnicodeString& pattern,
// _applyPattern calls add() etc., which set pat to empty.
UnicodeString rebuiltPat;
RuleCharacterIterator chars(pattern, symbols, pos);
- applyPattern(chars, symbols, rebuiltPat, options, &UnicodeSet::closeOver, 0, status);
+ applyPattern(chars, symbols, rebuiltPat, options, &UnicodeSet::closeOver, 0, status);
if (U_FAILURE(status)) return *this;
if (chars.inVariable()) {
// syntaxError(chars, "Extra chars in variable value");
@@ -169,7 +169,7 @@ UnicodeSet& UnicodeSet::closeOver(int32_t attribute) {
// start with input set to guarantee inclusion
// USET_CASE: remove strings because the strings will actually be reduced (folded);
// therefore, start with no strings and add only those needed
- if ((attribute & USET_CASE_INSENSITIVE) && foldSet.hasStrings()) {
+ if ((attribute & USET_CASE_INSENSITIVE) && foldSet.hasStrings()) {
foldSet.strings->removeAllElements();
}
@@ -184,32 +184,32 @@ UnicodeSet& UnicodeSet::closeOver(int32_t attribute) {
if (attribute & USET_CASE_INSENSITIVE) {
// full case closure
for (UChar32 cp=start; cp<=end; ++cp) {
- ucase_addCaseClosure(cp, &sa);
+ ucase_addCaseClosure(cp, &sa);
}
} else {
// add case mappings
// (does not add long s for regular s, or Kelvin for k, for example)
for (UChar32 cp=start; cp<=end; ++cp) {
- result = ucase_toFullLower(cp, NULL, NULL, &full, UCASE_LOC_ROOT);
+ result = ucase_toFullLower(cp, NULL, NULL, &full, UCASE_LOC_ROOT);
addCaseMapping(foldSet, result, full, str);
- result = ucase_toFullTitle(cp, NULL, NULL, &full, UCASE_LOC_ROOT);
+ result = ucase_toFullTitle(cp, NULL, NULL, &full, UCASE_LOC_ROOT);
addCaseMapping(foldSet, result, full, str);
- result = ucase_toFullUpper(cp, NULL, NULL, &full, UCASE_LOC_ROOT);
+ result = ucase_toFullUpper(cp, NULL, NULL, &full, UCASE_LOC_ROOT);
addCaseMapping(foldSet, result, full, str);
- result = ucase_toFullFolding(cp, &full, 0);
+ result = ucase_toFullFolding(cp, &full, 0);
addCaseMapping(foldSet, result, full, str);
}
}
}
- if (hasStrings()) {
+ if (hasStrings()) {
if (attribute & USET_CASE_INSENSITIVE) {
for (int32_t j=0; j<strings->size(); ++j) {
str = *(const UnicodeString *) strings->elementAt(j);
str.foldCase();
- if(!ucase_addStringCaseClosure(str.getBuffer(), str.length(), &sa)) {
+ if(!ucase_addStringCaseClosure(str.getBuffer(), str.length(), &sa)) {
foldSet.add(str); // does not map to code points: add the folded string itself
}
}
diff --git a/contrib/libs/icu/common/uniset_props.cpp b/contrib/libs/icu/common/uniset_props.cpp
index 585688c3ed..37277fcb75 100644
--- a/contrib/libs/icu/common/uniset_props.cpp
+++ b/contrib/libs/icu/common/uniset_props.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: uniset_props.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -109,7 +109,7 @@ U_CDECL_END
U_NAMESPACE_BEGIN
-namespace {
+namespace {
// Cache some sets for other services -------------------------------------- ***
void U_CALLCONV createUni32Set(UErrorCode &errorCode) {
@@ -168,8 +168,8 @@ isPOSIXClose(const UnicodeString &pattern, int32_t pos) {
// memory leak checker tools
#define _dbgct(me)
-} // namespace
-
+} // namespace
+
//----------------------------------------------------------------
// Constructors &c
//----------------------------------------------------------------
@@ -181,8 +181,8 @@ isPOSIXClose(const UnicodeString &pattern, int32_t pos) {
* @param pattern a string specifying what characters are in the set
*/
UnicodeSet::UnicodeSet(const UnicodeString& pattern,
- UErrorCode& status) {
- applyPattern(pattern, status);
+ UErrorCode& status) {
+ applyPattern(pattern, status);
_dbgct(this);
}
@@ -224,7 +224,7 @@ UnicodeSet::applyPatternIgnoreSpace(const UnicodeString& pattern,
// _applyPattern calls add() etc., which set pat to empty.
UnicodeString rebuiltPat;
RuleCharacterIterator chars(pattern, symbols, pos);
- applyPattern(chars, symbols, rebuiltPat, USET_IGNORE_SPACE, NULL, 0, status);
+ applyPattern(chars, symbols, rebuiltPat, USET_IGNORE_SPACE, NULL, 0, status);
if (U_FAILURE(status)) return;
if (chars.inVariable()) {
// syntaxError(chars, "Extra chars in variable value");
@@ -248,8 +248,8 @@ UBool UnicodeSet::resemblesPattern(const UnicodeString& pattern, int32_t pos) {
// Implementation: Pattern parsing
//----------------------------------------------------------------
-namespace {
-
+namespace {
+
/**
* A small all-inline class to manage a UnicodeSet pointer. Add
* operator->() etc. as needed.
@@ -268,10 +268,10 @@ public:
}
};
-constexpr int32_t MAX_DEPTH = 100;
-
-} // namespace
-
+constexpr int32_t MAX_DEPTH = 100;
+
+} // namespace
+
/**
* Parse the pattern from the given RuleCharacterIterator. The
* iterator is advanced over the parsed pattern.
@@ -291,13 +291,13 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars,
UnicodeString& rebuiltPat,
uint32_t options,
UnicodeSet& (UnicodeSet::*caseClosure)(int32_t attribute),
- int32_t depth,
+ int32_t depth,
UErrorCode& ec) {
if (U_FAILURE(ec)) return;
- if (depth > MAX_DEPTH) {
- ec = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
+ if (depth > MAX_DEPTH) {
+ ec = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
// Syntax characters: [ ] ^ - & { }
@@ -432,7 +432,7 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars,
}
switch (setMode) {
case 1:
- nested->applyPattern(chars, symbols, patLocal, options, caseClosure, depth + 1, ec);
+ nested->applyPattern(chars, symbols, patLocal, options, caseClosure, depth + 1, ec);
break;
case 2:
chars.skipIgnored(opts);
@@ -690,8 +690,8 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars,
// Property set implementation
//----------------------------------------------------------------
-namespace {
-
+namespace {
+
static UBool numericValueFilter(UChar32 ch, void* context) {
return u_getNumericValue(ch) == *(double*)context;
}
@@ -723,14 +723,14 @@ static UBool scriptExtensionsFilter(UChar32 ch, void* context) {
return uscript_hasScript(ch, *(UScriptCode*)context);
}
-} // namespace
-
+} // namespace
+
/**
* Generic filter-based scanning code for UCD property UnicodeSets.
*/
void UnicodeSet::applyFilter(UnicodeSet::Filter filter,
void* context,
- const UnicodeSet* inclusions,
+ const UnicodeSet* inclusions,
UErrorCode &status) {
if (U_FAILURE(status)) return;
@@ -741,8 +741,8 @@ void UnicodeSet::applyFilter(UnicodeSet::Filter filter,
// To improve performance, use an inclusions set which
// encodes information about character ranges that are known
// to have identical properties.
- // inclusions contains the first characters of
- // same-value ranges for the given property.
+ // inclusions contains the first characters of
+ // same-value ranges for the given property.
clear();
@@ -777,8 +777,8 @@ void UnicodeSet::applyFilter(UnicodeSet::Filter filter,
}
}
-namespace {
-
+namespace {
+
static UBool mungeCharName(char* dst, const char* src, int32_t dstCapacity) {
/* Note: we use ' ' in compiler code page */
int32_t j = 0;
@@ -796,44 +796,44 @@ static UBool mungeCharName(char* dst, const char* src, int32_t dstCapacity) {
return TRUE;
}
-} // namespace
-
+} // namespace
+
//----------------------------------------------------------------
// Property set API
//----------------------------------------------------------------
-#define FAIL(ec) UPRV_BLOCK_MACRO_BEGIN { \
- ec=U_ILLEGAL_ARGUMENT_ERROR; \
- return *this; \
-} UPRV_BLOCK_MACRO_END
+#define FAIL(ec) UPRV_BLOCK_MACRO_BEGIN { \
+ ec=U_ILLEGAL_ARGUMENT_ERROR; \
+ return *this; \
+} UPRV_BLOCK_MACRO_END
UnicodeSet&
UnicodeSet::applyIntPropertyValue(UProperty prop, int32_t value, UErrorCode& ec) {
- if (U_FAILURE(ec) || isFrozen()) { return *this; }
+ if (U_FAILURE(ec) || isFrozen()) { return *this; }
if (prop == UCHAR_GENERAL_CATEGORY_MASK) {
- const UnicodeSet* inclusions = CharacterProperties::getInclusionsForProperty(prop, ec);
- applyFilter(generalCategoryMaskFilter, &value, inclusions, ec);
+ const UnicodeSet* inclusions = CharacterProperties::getInclusionsForProperty(prop, ec);
+ applyFilter(generalCategoryMaskFilter, &value, inclusions, ec);
} else if (prop == UCHAR_SCRIPT_EXTENSIONS) {
- const UnicodeSet* inclusions = CharacterProperties::getInclusionsForProperty(prop, ec);
+ const UnicodeSet* inclusions = CharacterProperties::getInclusionsForProperty(prop, ec);
UScriptCode script = (UScriptCode)value;
- applyFilter(scriptExtensionsFilter, &script, inclusions, ec);
- } else if (0 <= prop && prop < UCHAR_BINARY_LIMIT) {
- if (value == 0 || value == 1) {
- const USet *set = u_getBinaryPropertySet(prop, &ec);
- if (U_FAILURE(ec)) { return *this; }
- copyFrom(*UnicodeSet::fromUSet(set), TRUE);
- if (value == 0) {
- complement();
- }
- } else {
- clear();
- }
- } else if (UCHAR_INT_START <= prop && prop < UCHAR_INT_LIMIT) {
- const UnicodeSet* inclusions = CharacterProperties::getInclusionsForProperty(prop, ec);
- IntPropertyContext c = {prop, value};
- applyFilter(intPropertyFilter, &c, inclusions, ec);
+ applyFilter(scriptExtensionsFilter, &script, inclusions, ec);
+ } else if (0 <= prop && prop < UCHAR_BINARY_LIMIT) {
+ if (value == 0 || value == 1) {
+ const USet *set = u_getBinaryPropertySet(prop, &ec);
+ if (U_FAILURE(ec)) { return *this; }
+ copyFrom(*UnicodeSet::fromUSet(set), TRUE);
+ if (value == 0) {
+ complement();
+ }
+ } else {
+ clear();
+ }
+ } else if (UCHAR_INT_START <= prop && prop < UCHAR_INT_LIMIT) {
+ const UnicodeSet* inclusions = CharacterProperties::getInclusionsForProperty(prop, ec);
+ IntPropertyContext c = {prop, value};
+ applyFilter(intPropertyFilter, &c, inclusions, ec);
} else {
- ec = U_ILLEGAL_ARGUMENT_ERROR;
+ ec = U_ILLEGAL_ARGUMENT_ERROR;
}
return *this;
}
@@ -862,7 +862,7 @@ UnicodeSet::applyPropertyAlias(const UnicodeString& prop,
UProperty p;
int32_t v;
- UBool invert = FALSE;
+ UBool invert = FALSE;
if (value.length() > 0) {
p = u_getPropertyEnum(pname.data());
@@ -883,14 +883,14 @@ UnicodeSet::applyPropertyAlias(const UnicodeString& prop,
p == UCHAR_TRAIL_CANONICAL_COMBINING_CLASS ||
p == UCHAR_LEAD_CANONICAL_COMBINING_CLASS) {
char* end;
- double val = uprv_strtod(vname.data(), &end);
- // Anything between 0 and 255 is valid even if unused.
- // Cast double->int only after range check.
- // We catch NaN here because comparing it with both 0 and 255 will be false
- // (as are all comparisons with NaN).
- if (*end != 0 || !(0 <= val && val <= 255) ||
- (v = (int32_t)val) != val) {
- // non-integral value or outside 0..255, or trailing junk
+ double val = uprv_strtod(vname.data(), &end);
+ // Anything between 0 and 255 is valid even if unused.
+ // Cast double->int only after range check.
+ // We catch NaN here because comparing it with both 0 and 255 will be false
+ // (as are all comparisons with NaN).
+ if (*end != 0 || !(0 <= val && val <= 255) ||
+ (v = (int32_t)val) != val) {
+ // non-integral value or outside 0..255, or trailing junk
FAIL(ec);
}
} else {
@@ -905,12 +905,12 @@ UnicodeSet::applyPropertyAlias(const UnicodeString& prop,
case UCHAR_NUMERIC_VALUE:
{
char* end;
- double val = uprv_strtod(vname.data(), &end);
+ double val = uprv_strtod(vname.data(), &end);
if (*end != 0) {
FAIL(ec);
}
- applyFilter(numericValueFilter, &val,
- CharacterProperties::getInclusionsForProperty(p, ec), ec);
+ applyFilter(numericValueFilter, &val,
+ CharacterProperties::getInclusionsForProperty(p, ec), ec);
return *this;
}
case UCHAR_NAME:
@@ -939,8 +939,8 @@ UnicodeSet::applyPropertyAlias(const UnicodeString& prop,
if (!mungeCharName(buf, vname.data(), sizeof(buf))) FAIL(ec);
UVersionInfo version;
u_versionFromString(version, buf);
- applyFilter(versionFilter, &version,
- CharacterProperties::getInclusionsForProperty(p, ec), ec);
+ applyFilter(versionFilter, &version,
+ CharacterProperties::getInclusionsForProperty(p, ec), ec);
return *this;
}
case UCHAR_SCRIPT_EXTENSIONS:
diff --git a/contrib/libs/icu/common/unisetspan.cpp b/contrib/libs/icu/common/unisetspan.cpp
index 0421e65413..68e44d91ee 100644
--- a/contrib/libs/icu/common/unisetspan.cpp
+++ b/contrib/libs/icu/common/unisetspan.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: unisetspan.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -400,7 +400,7 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSetStringSpan &otherStri
if(otherStringSpan.pSpanNotSet==&otherStringSpan.spanSet) {
pSpanNotSet=&spanSet;
} else {
- pSpanNotSet=otherStringSpan.pSpanNotSet->clone();
+ pSpanNotSet=otherStringSpan.pSpanNotSet->clone();
}
// Allocate a block of meta data.
@@ -436,7 +436,7 @@ void UnicodeSetStringSpan::addToSpanNotSet(UChar32 c) {
if(spanSet.contains(c)) {
return; // Nothing to do.
}
- UnicodeSet *newSet=spanSet.cloneAsThawed();
+ UnicodeSet *newSet=spanSet.cloneAsThawed();
if(newSet==NULL) {
return; // Out of memory.
} else {
@@ -502,7 +502,7 @@ spanOneBack(const UnicodeSet &set, const UChar *s, int32_t length) {
static inline int32_t
spanOneUTF8(const UnicodeSet &set, const uint8_t *s, int32_t length) {
UChar32 c=*s;
- if(U8_IS_SINGLE(c)) {
+ if(U8_IS_SINGLE(c)) {
return set.contains(c) ? 1 : -1;
}
// Take advantage of non-ASCII fastpaths in U8_NEXT_OR_FFFD().
@@ -514,7 +514,7 @@ spanOneUTF8(const UnicodeSet &set, const uint8_t *s, int32_t length) {
static inline int32_t
spanOneBackUTF8(const UnicodeSet &set, const uint8_t *s, int32_t length) {
UChar32 c=s[length-1];
- if(U8_IS_SINGLE(c)) {
+ if(U8_IS_SINGLE(c)) {
return set.contains(c) ? 1 : -1;
}
int32_t i=length-1;
@@ -1006,9 +1006,9 @@ int32_t UnicodeSetStringSpan::spanUTF8(const uint8_t *s, int32_t length, USetSpa
// Try to match if the increment is not listed already.
// Match at code point boundaries. (The UTF-8 strings were converted
// from UTF-16 and are guaranteed to be well-formed.)
- if(!U8_IS_TRAIL(s[pos-overlap]) &&
- !offsets.containsOffset(inc) &&
- matches8(s+pos-overlap, s8, length8)) {
+ if(!U8_IS_TRAIL(s[pos-overlap]) &&
+ !offsets.containsOffset(inc) &&
+ matches8(s+pos-overlap, s8, length8)) {
if(inc==rest) {
return length; // Reached the end of the string.
}
@@ -1050,10 +1050,10 @@ int32_t UnicodeSetStringSpan::spanUTF8(const uint8_t *s, int32_t length, USetSpa
// Try to match if the string is longer or starts earlier.
// Match at code point boundaries. (The UTF-8 strings were converted
// from UTF-16 and are guaranteed to be well-formed.)
- if(!U8_IS_TRAIL(s[pos-overlap]) &&
- (overlap>maxOverlap ||
- /* redundant overlap==maxOverlap && */ inc>maxInc) &&
- matches8(s+pos-overlap, s8, length8)) {
+ if(!U8_IS_TRAIL(s[pos-overlap]) &&
+ (overlap>maxOverlap ||
+ /* redundant overlap==maxOverlap && */ inc>maxInc) &&
+ matches8(s+pos-overlap, s8, length8)) {
maxInc=inc; // Longest match from earliest start.
maxOverlap=overlap;
break;
diff --git a/contrib/libs/icu/common/unisetspan.h b/contrib/libs/icu/common/unisetspan.h
index 5767b623a6..f1e78ff3ee 100644
--- a/contrib/libs/icu/common/unisetspan.h
+++ b/contrib/libs/icu/common/unisetspan.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: unisetspan.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/unistr.cpp b/contrib/libs/icu/common/unistr.cpp
index cd70e644ed..077b4d6ef2 100644
--- a/contrib/libs/icu/common/unistr.cpp
+++ b/contrib/libs/icu/common/unistr.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -218,10 +218,10 @@ UnicodeString::UnicodeString(const UChar *text,
}
UnicodeString::UnicodeString(UBool isTerminated,
- ConstChar16Ptr textPtr,
+ ConstChar16Ptr textPtr,
int32_t textLength) {
fUnion.fFields.fLengthAndFlags = kReadonlyAlias;
- const UChar *text = textPtr;
+ const UChar *text = textPtr;
if(text == NULL) {
// treat as an empty string, do not alias
setToEmpty();
@@ -235,8 +235,8 @@ UnicodeString::UnicodeString(UBool isTerminated,
// text is terminated, or else it would have failed the above test
textLength = u_strlen(text);
}
- setArray(const_cast<UChar *>(text), textLength,
- isTerminated ? textLength + 1 : textLength);
+ setArray(const_cast<UChar *>(text), textLength,
+ isTerminated ? textLength + 1 : textLength);
}
}
@@ -309,7 +309,7 @@ UnicodeString::UnicodeString(const UnicodeString& that) {
}
UnicodeString::UnicodeString(UnicodeString &&src) U_NOEXCEPT {
- copyFieldsFrom(src, TRUE);
+ copyFieldsFrom(src, TRUE);
}
UnicodeString::UnicodeString(const UnicodeString& that,
@@ -332,7 +332,7 @@ Replaceable::clone() const {
}
// UnicodeString overrides clone() with a real implementation
-UnicodeString *
+UnicodeString *
UnicodeString::clone() const {
return new UnicodeString(*this);
}
@@ -571,7 +571,7 @@ UnicodeString::copyFrom(const UnicodeString &src, UBool fastCopy) {
return *this;
}
-UnicodeString &UnicodeString::operator=(UnicodeString &&src) U_NOEXCEPT {
+UnicodeString &UnicodeString::operator=(UnicodeString &&src) U_NOEXCEPT {
// No explicit check for self move assignment, consistent with standard library.
// Self move assignment causes no crash nor leak but might make the object bogus.
releaseArray();
@@ -579,7 +579,7 @@ UnicodeString &UnicodeString::operator=(UnicodeString &&src) U_NOEXCEPT {
return *this;
}
-// Same as move assignment except without memory management.
+// Same as move assignment except without memory management.
void UnicodeString::copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) U_NOEXCEPT {
int16_t lengthAndFlags = fUnion.fFields.fLengthAndFlags = src.fUnion.fFields.fLengthAndFlags;
if(lengthAndFlags & kUsingStackBuffer) {
@@ -872,7 +872,7 @@ UnicodeString::doExtract(int32_t start,
}
int32_t
-UnicodeString::extract(Char16Ptr dest, int32_t destCapacity,
+UnicodeString::extract(Char16Ptr dest, int32_t destCapacity,
UErrorCode &errorCode) const {
int32_t len = length();
if(U_SUCCESS(errorCode)) {
@@ -1214,10 +1214,10 @@ UnicodeString::unBogus() {
}
}
-const char16_t *
+const char16_t *
UnicodeString::getTerminatedBuffer() {
if(!isWritable()) {
- return nullptr;
+ return nullptr;
}
UChar *array = getArrayStart();
int32_t len = length();
@@ -1248,14 +1248,14 @@ UnicodeString::getTerminatedBuffer() {
array[len] = 0;
return array;
} else {
- return nullptr;
+ return nullptr;
}
}
// setTo() analogous to the readonly-aliasing constructor with the same signature
UnicodeString &
UnicodeString::setTo(UBool isTerminated,
- ConstChar16Ptr textPtr,
+ ConstChar16Ptr textPtr,
int32_t textLength)
{
if(fUnion.fFields.fLengthAndFlags & kOpenGetBuffer) {
@@ -1263,7 +1263,7 @@ UnicodeString::setTo(UBool isTerminated,
return *this;
}
- const UChar *text = textPtr;
+ const UChar *text = textPtr;
if(text == NULL) {
// treat as an empty string, do not alias
releaseArray();
@@ -1446,15 +1446,15 @@ UnicodeString::doReplace(int32_t start,
}
if(srcChars == 0) {
- srcLength = 0;
- } else {
- // Perform all remaining operations relative to srcChars + srcStart.
- // From this point forward, do not use srcStart.
- srcChars += srcStart;
- if (srcLength < 0) {
- // get the srcLength if necessary
- srcLength = u_strlen(srcChars);
- }
+ srcLength = 0;
+ } else {
+ // Perform all remaining operations relative to srcChars + srcStart.
+ // From this point forward, do not use srcStart.
+ srcChars += srcStart;
+ if (srcLength < 0) {
+ // get the srcLength if necessary
+ srcLength = u_strlen(srcChars);
+ }
}
// pin the indices to legal values
@@ -1469,27 +1469,27 @@ UnicodeString::doReplace(int32_t start,
}
newLength += srcLength;
- // Check for insertion into ourself
- const UChar *oldArray = getArrayStart();
- if (isBufferWritable() &&
- oldArray < srcChars + srcLength &&
- srcChars < oldArray + oldLength) {
- // Copy into a new UnicodeString and start over
- UnicodeString copy(srcChars, srcLength);
- if (copy.isBogus()) {
- setToBogus();
- return *this;
- }
- return doReplace(start, length, copy.getArrayStart(), 0, srcLength);
- }
-
+ // Check for insertion into ourself
+ const UChar *oldArray = getArrayStart();
+ if (isBufferWritable() &&
+ oldArray < srcChars + srcLength &&
+ srcChars < oldArray + oldLength) {
+ // Copy into a new UnicodeString and start over
+ UnicodeString copy(srcChars, srcLength);
+ if (copy.isBogus()) {
+ setToBogus();
+ return *this;
+ }
+ return doReplace(start, length, copy.getArrayStart(), 0, srcLength);
+ }
+
// cloneArrayIfNeeded(doCopyArray=FALSE) may change fArray but will not copy the current contents;
// therefore we need to keep the current fArray
UChar oldStackBuffer[US_STACKBUF_SIZE];
if((fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) && (newLength > US_STACKBUF_SIZE)) {
// copy the stack buffer contents because it will be overwritten with
// fUnion.fFields values
- u_memcpy(oldStackBuffer, oldArray, oldLength);
+ u_memcpy(oldStackBuffer, oldArray, oldLength);
oldArray = oldStackBuffer;
}
@@ -1518,7 +1518,7 @@ UnicodeString::doReplace(int32_t start,
}
// now fill in the hole with the new string
- us_arrayCopy(srcChars, 0, newArray, start, srcLength);
+ us_arrayCopy(srcChars, 0, newArray, start, srcLength);
setLength(newLength);
@@ -1551,38 +1551,38 @@ UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLeng
return *this;
}
- // Perform all remaining operations relative to srcChars + srcStart.
- // From this point forward, do not use srcStart.
- srcChars += srcStart;
-
+ // Perform all remaining operations relative to srcChars + srcStart.
+ // From this point forward, do not use srcStart.
+ srcChars += srcStart;
+
if(srcLength < 0) {
// get the srcLength if necessary
- if((srcLength = u_strlen(srcChars)) == 0) {
+ if((srcLength = u_strlen(srcChars)) == 0) {
return *this;
}
}
int32_t oldLength = length();
- int32_t newLength;
- if (uprv_add32_overflow(oldLength, srcLength, &newLength)) {
- setToBogus();
- return *this;
- }
-
- // Check for append onto ourself
- const UChar* oldArray = getArrayStart();
- if (isBufferWritable() &&
- oldArray < srcChars + srcLength &&
- srcChars < oldArray + oldLength) {
- // Copy into a new UnicodeString and start over
- UnicodeString copy(srcChars, srcLength);
- if (copy.isBogus()) {
- setToBogus();
- return *this;
- }
- return doAppend(copy.getArrayStart(), 0, srcLength);
- }
-
+ int32_t newLength;
+ if (uprv_add32_overflow(oldLength, srcLength, &newLength)) {
+ setToBogus();
+ return *this;
+ }
+
+ // Check for append onto ourself
+ const UChar* oldArray = getArrayStart();
+ if (isBufferWritable() &&
+ oldArray < srcChars + srcLength &&
+ srcChars < oldArray + oldLength) {
+ // Copy into a new UnicodeString and start over
+ UnicodeString copy(srcChars, srcLength);
+ if (copy.isBogus()) {
+ setToBogus();
+ return *this;
+ }
+ return doAppend(copy.getArrayStart(), 0, srcLength);
+ }
+
// optimize append() onto a large-enough, owned string
if((newLength <= getCapacity() && isBufferWritable()) ||
cloneArrayIfNeeded(newLength, getGrowCapacity(newLength))) {
@@ -1594,8 +1594,8 @@ UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLeng
// or
// str.appendString(buffer, length)
// or similar.
- if(srcChars != newArray + oldLength) {
- us_arrayCopy(srcChars, 0, newArray, oldLength, srcLength);
+ if(srcChars != newArray + oldLength) {
+ us_arrayCopy(srcChars, 0, newArray, oldLength, srcLength);
}
setLength(newLength);
}
@@ -1752,14 +1752,14 @@ UnicodeString::doHashCode() const
// External Buffer
//========================================
-char16_t *
+char16_t *
UnicodeString::getBuffer(int32_t minCapacity) {
if(minCapacity>=-1 && cloneArrayIfNeeded(minCapacity)) {
fUnion.fFields.fLengthAndFlags|=kOpenGetBuffer;
setZeroLength();
return getArrayStart();
} else {
- return nullptr;
+ return nullptr;
}
}
diff --git a/contrib/libs/icu/common/unistr_case.cpp b/contrib/libs/icu/common/unistr_case.cpp
index 2bd9b35cde..2138d60c01 100644
--- a/contrib/libs/icu/common/unistr_case.cpp
+++ b/contrib/libs/icu/common/unistr_case.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: unistr_case.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:2
*
@@ -19,17 +19,17 @@
*/
#include "unicode/utypes.h"
-#include "unicode/brkiter.h"
-#include "unicode/casemap.h"
-#include "unicode/edits.h"
+#include "unicode/brkiter.h"
+#include "unicode/casemap.h"
+#include "unicode/edits.h"
#include "unicode/putil.h"
#include "cstring.h"
#include "cmemory.h"
#include "unicode/ustring.h"
#include "unicode/unistr.h"
#include "unicode/uchar.h"
-#include "uassert.h"
-#include "ucasemap_imp.h"
+#include "uassert.h"
+#include "ucasemap_imp.h"
#include "uelement.h"
U_NAMESPACE_BEGIN
@@ -91,123 +91,123 @@ UnicodeString::doCaseCompare(int32_t start,
//========================================
UnicodeString &
-UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
+UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
UStringCaseMapper *stringCaseMapper) {
if(isEmpty() || !isWritable()) {
// nothing to do
return *this;
}
- UChar oldBuffer[2 * US_STACKBUF_SIZE];
+ UChar oldBuffer[2 * US_STACKBUF_SIZE];
UChar *oldArray;
- int32_t oldLength = length();
- int32_t newLength;
- UBool writable = isBufferWritable();
- UErrorCode errorCode = U_ZERO_ERROR;
-
-#if !UCONFIG_NO_BREAK_ITERATION
- // Read-only alias to the original string contents for the titlecasing BreakIterator.
- // We cannot set the iterator simply to *this because *this is being modified.
- UnicodeString oldString;
-#endif
-
- // Try to avoid heap-allocating a new character array for this string.
- if (writable ? oldLength <= UPRV_LENGTHOF(oldBuffer) : oldLength < US_STACKBUF_SIZE) {
- // Short string: Copy the contents into a temporary buffer and
- // case-map back into the current array, or into the stack buffer.
- UChar *buffer = getArrayStart();
- int32_t capacity;
- oldArray = oldBuffer;
- u_memcpy(oldBuffer, buffer, oldLength);
- if (writable) {
- capacity = getCapacity();
- } else {
- // Switch from the read-only alias or shared heap buffer to the stack buffer.
- if (!cloneArrayIfNeeded(US_STACKBUF_SIZE, US_STACKBUF_SIZE, /* doCopyArray= */ FALSE)) {
- return *this;
- }
- U_ASSERT(fUnion.fFields.fLengthAndFlags & kUsingStackBuffer);
- buffer = fUnion.fStackFields.fBuffer;
- capacity = US_STACKBUF_SIZE;
- }
-#if !UCONFIG_NO_BREAK_ITERATION
- if (iter != nullptr) {
- oldString.setTo(FALSE, oldArray, oldLength);
- iter->setText(oldString);
- }
-#endif
- newLength = stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR
- buffer, capacity,
- oldArray, oldLength, NULL, errorCode);
- if (U_SUCCESS(errorCode)) {
- setLength(newLength);
- return *this;
- } else if (errorCode == U_BUFFER_OVERFLOW_ERROR) {
- // common overflow handling below
- } else {
- setToBogus();
- return *this;
- }
+ int32_t oldLength = length();
+ int32_t newLength;
+ UBool writable = isBufferWritable();
+ UErrorCode errorCode = U_ZERO_ERROR;
+
+#if !UCONFIG_NO_BREAK_ITERATION
+ // Read-only alias to the original string contents for the titlecasing BreakIterator.
+ // We cannot set the iterator simply to *this because *this is being modified.
+ UnicodeString oldString;
+#endif
+
+ // Try to avoid heap-allocating a new character array for this string.
+ if (writable ? oldLength <= UPRV_LENGTHOF(oldBuffer) : oldLength < US_STACKBUF_SIZE) {
+ // Short string: Copy the contents into a temporary buffer and
+ // case-map back into the current array, or into the stack buffer.
+ UChar *buffer = getArrayStart();
+ int32_t capacity;
+ oldArray = oldBuffer;
+ u_memcpy(oldBuffer, buffer, oldLength);
+ if (writable) {
+ capacity = getCapacity();
+ } else {
+ // Switch from the read-only alias or shared heap buffer to the stack buffer.
+ if (!cloneArrayIfNeeded(US_STACKBUF_SIZE, US_STACKBUF_SIZE, /* doCopyArray= */ FALSE)) {
+ return *this;
+ }
+ U_ASSERT(fUnion.fFields.fLengthAndFlags & kUsingStackBuffer);
+ buffer = fUnion.fStackFields.fBuffer;
+ capacity = US_STACKBUF_SIZE;
+ }
+#if !UCONFIG_NO_BREAK_ITERATION
+ if (iter != nullptr) {
+ oldString.setTo(FALSE, oldArray, oldLength);
+ iter->setText(oldString);
+ }
+#endif
+ newLength = stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR
+ buffer, capacity,
+ oldArray, oldLength, NULL, errorCode);
+ if (U_SUCCESS(errorCode)) {
+ setLength(newLength);
+ return *this;
+ } else if (errorCode == U_BUFFER_OVERFLOW_ERROR) {
+ // common overflow handling below
+ } else {
+ setToBogus();
+ return *this;
+ }
} else {
- // Longer string or read-only buffer:
- // Collect only changes and then apply them to this string.
- // Case mapping often changes only small parts of a string,
- // and often does not change its length.
+ // Longer string or read-only buffer:
+ // Collect only changes and then apply them to this string.
+ // Case mapping often changes only small parts of a string,
+ // and often does not change its length.
oldArray = getArrayStart();
- Edits edits;
- UChar replacementChars[200];
-#if !UCONFIG_NO_BREAK_ITERATION
- if (iter != nullptr) {
- oldString.setTo(FALSE, oldArray, oldLength);
- iter->setText(oldString);
- }
-#endif
- stringCaseMapper(caseLocale, options | U_OMIT_UNCHANGED_TEXT, UCASEMAP_BREAK_ITERATOR
- replacementChars, UPRV_LENGTHOF(replacementChars),
- oldArray, oldLength, &edits, errorCode);
- if (U_SUCCESS(errorCode)) {
- // Grow the buffer at most once, not for multiple doReplace() calls.
- newLength = oldLength + edits.lengthDelta();
- if (newLength > oldLength && !cloneArrayIfNeeded(newLength, newLength)) {
- return *this;
- }
- for (Edits::Iterator ei = edits.getCoarseChangesIterator(); ei.next(errorCode);) {
- doReplace(ei.destinationIndex(), ei.oldLength(),
- replacementChars, ei.replacementIndex(), ei.newLength());
- }
- if (U_FAILURE(errorCode)) {
- setToBogus();
- }
- return *this;
- } else if (errorCode == U_BUFFER_OVERFLOW_ERROR) {
- // common overflow handling below
- newLength = oldLength + edits.lengthDelta();
- } else {
- setToBogus();
- return *this;
- }
+ Edits edits;
+ UChar replacementChars[200];
+#if !UCONFIG_NO_BREAK_ITERATION
+ if (iter != nullptr) {
+ oldString.setTo(FALSE, oldArray, oldLength);
+ iter->setText(oldString);
+ }
+#endif
+ stringCaseMapper(caseLocale, options | U_OMIT_UNCHANGED_TEXT, UCASEMAP_BREAK_ITERATOR
+ replacementChars, UPRV_LENGTHOF(replacementChars),
+ oldArray, oldLength, &edits, errorCode);
+ if (U_SUCCESS(errorCode)) {
+ // Grow the buffer at most once, not for multiple doReplace() calls.
+ newLength = oldLength + edits.lengthDelta();
+ if (newLength > oldLength && !cloneArrayIfNeeded(newLength, newLength)) {
+ return *this;
+ }
+ for (Edits::Iterator ei = edits.getCoarseChangesIterator(); ei.next(errorCode);) {
+ doReplace(ei.destinationIndex(), ei.oldLength(),
+ replacementChars, ei.replacementIndex(), ei.newLength());
+ }
+ if (U_FAILURE(errorCode)) {
+ setToBogus();
+ }
+ return *this;
+ } else if (errorCode == U_BUFFER_OVERFLOW_ERROR) {
+ // common overflow handling below
+ newLength = oldLength + edits.lengthDelta();
+ } else {
+ setToBogus();
+ return *this;
+ }
}
- // Handle buffer overflow, newLength is known.
- // We need to allocate a new buffer for the internal string case mapping function.
- // This is very similar to how doReplace() keeps the old array pointer
- // and deletes the old array itself after it is done.
- // In addition, we are forcing cloneArrayIfNeeded() to always allocate a new array.
+ // Handle buffer overflow, newLength is known.
+ // We need to allocate a new buffer for the internal string case mapping function.
+ // This is very similar to how doReplace() keeps the old array pointer
+ // and deletes the old array itself after it is done.
+ // In addition, we are forcing cloneArrayIfNeeded() to always allocate a new array.
int32_t *bufferToDelete = 0;
- if (!cloneArrayIfNeeded(newLength, newLength, FALSE, &bufferToDelete, TRUE)) {
+ if (!cloneArrayIfNeeded(newLength, newLength, FALSE, &bufferToDelete, TRUE)) {
return *this;
}
- errorCode = U_ZERO_ERROR;
- // No need to iter->setText() again: The case mapper restarts via iter->first().
- newLength = stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR
- getArrayStart(), getCapacity(),
- oldArray, oldLength, NULL, errorCode);
+ errorCode = U_ZERO_ERROR;
+ // No need to iter->setText() again: The case mapper restarts via iter->first().
+ newLength = stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR
+ getArrayStart(), getCapacity(),
+ oldArray, oldLength, NULL, errorCode);
if (bufferToDelete) {
uprv_free(bufferToDelete);
}
- if (U_SUCCESS(errorCode)) {
- setLength(newLength);
- } else {
+ if (U_SUCCESS(errorCode)) {
+ setLength(newLength);
+ } else {
setToBogus();
}
return *this;
@@ -215,7 +215,7 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER
UnicodeString &
UnicodeString::foldCase(uint32_t options) {
- return caseMap(UCASE_LOC_ROOT, options, UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalFold);
+ return caseMap(UCASE_LOC_ROOT, options, UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalFold);
}
U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/unistr_case_locale.cpp b/contrib/libs/icu/common/unistr_case_locale.cpp
index 0cbec252b3..f0f3048d06 100644
--- a/contrib/libs/icu/common/unistr_case_locale.cpp
+++ b/contrib/libs/icu/common/unistr_case_locale.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: unistr_case_locale.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -19,9 +19,9 @@
#include "unicode/utypes.h"
#include "unicode/locid.h"
-#include "unicode/ucasemap.h"
+#include "unicode/ucasemap.h"
#include "unicode/unistr.h"
-#include "ucasemap_imp.h"
+#include "ucasemap_imp.h"
U_NAMESPACE_BEGIN
@@ -31,26 +31,26 @@ U_NAMESPACE_BEGIN
UnicodeString &
UnicodeString::toLower() {
- return caseMap(ustrcase_getCaseLocale(NULL), 0,
- UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToLower);
+ return caseMap(ustrcase_getCaseLocale(NULL), 0,
+ UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToLower);
}
UnicodeString &
UnicodeString::toLower(const Locale &locale) {
- return caseMap(ustrcase_getCaseLocale(locale.getBaseName()), 0,
- UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToLower);
+ return caseMap(ustrcase_getCaseLocale(locale.getBaseName()), 0,
+ UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToLower);
}
UnicodeString &
UnicodeString::toUpper() {
- return caseMap(ustrcase_getCaseLocale(NULL), 0,
- UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToUpper);
+ return caseMap(ustrcase_getCaseLocale(NULL), 0,
+ UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToUpper);
}
UnicodeString &
UnicodeString::toUpper(const Locale &locale) {
- return caseMap(ustrcase_getCaseLocale(locale.getBaseName()), 0,
- UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToUpper);
+ return caseMap(ustrcase_getCaseLocale(locale.getBaseName()), 0,
+ UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToUpper);
}
U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/unistr_cnv.cpp b/contrib/libs/icu/common/unistr_cnv.cpp
index 4e50a35324..64d3c16801 100644
--- a/contrib/libs/icu/common/unistr_cnv.cpp
+++ b/contrib/libs/icu/common/unistr_cnv.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: unistr_cnv.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:2
*
diff --git a/contrib/libs/icu/common/unistr_props.cpp b/contrib/libs/icu/common/unistr_props.cpp
index b4c4a70b3a..4006475790 100644
--- a/contrib/libs/icu/common/unistr_props.cpp
+++ b/contrib/libs/icu/common/unistr_props.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: unistr_props.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:2
*
diff --git a/contrib/libs/icu/common/unistr_titlecase_brkiter.cpp b/contrib/libs/icu/common/unistr_titlecase_brkiter.cpp
index cb91dfc8f7..4969884b0d 100644
--- a/contrib/libs/icu/common/unistr_titlecase_brkiter.cpp
+++ b/contrib/libs/icu/common/unistr_titlecase_brkiter.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: unistr_titlecase_brkiter.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:2
*
@@ -22,34 +22,34 @@
#if !UCONFIG_NO_BREAK_ITERATION
#include "unicode/brkiter.h"
-#include "unicode/locid.h"
-#include "unicode/ucasemap.h"
+#include "unicode/locid.h"
+#include "unicode/ucasemap.h"
#include "unicode/unistr.h"
-#include "ucasemap_imp.h"
+#include "ucasemap_imp.h"
U_NAMESPACE_BEGIN
UnicodeString &
-UnicodeString::toTitle(BreakIterator *iter) {
- return toTitle(iter, Locale::getDefault(), 0);
+UnicodeString::toTitle(BreakIterator *iter) {
+ return toTitle(iter, Locale::getDefault(), 0);
}
UnicodeString &
-UnicodeString::toTitle(BreakIterator *iter, const Locale &locale) {
- return toTitle(iter, locale, 0);
+UnicodeString::toTitle(BreakIterator *iter, const Locale &locale) {
+ return toTitle(iter, locale, 0);
}
UnicodeString &
-UnicodeString::toTitle(BreakIterator *iter, const Locale &locale, uint32_t options) {
- LocalPointer<BreakIterator> ownedIter;
- UErrorCode errorCode = U_ZERO_ERROR;
- iter = ustrcase_getTitleBreakIterator(&locale, "", options, iter, ownedIter, errorCode);
- if (iter == nullptr) {
- setToBogus();
- return *this;
+UnicodeString::toTitle(BreakIterator *iter, const Locale &locale, uint32_t options) {
+ LocalPointer<BreakIterator> ownedIter;
+ UErrorCode errorCode = U_ZERO_ERROR;
+ iter = ustrcase_getTitleBreakIterator(&locale, "", options, iter, ownedIter, errorCode);
+ if (iter == nullptr) {
+ setToBogus();
+ return *this;
}
- caseMap(ustrcase_getCaseLocale(locale.getBaseName()), options, iter, ustrcase_internalToTitle);
- return *this;
+ caseMap(ustrcase_getCaseLocale(locale.getBaseName()), options, iter, ustrcase_internalToTitle);
+ return *this;
}
U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/unistrappender.h b/contrib/libs/icu/common/unistrappender.h
index 57ba1d9125..75fcb9e775 100644
--- a/contrib/libs/icu/common/unistrappender.h
+++ b/contrib/libs/icu/common/unistrappender.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/common/unorm.cpp b/contrib/libs/icu/common/unorm.cpp
index 75406734ed..2d9f46052f 100644
--- a/contrib/libs/icu/common/unorm.cpp
+++ b/contrib/libs/icu/common/unorm.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/common/unormcmp.cpp b/contrib/libs/icu/common/unormcmp.cpp
index 43ea5cea1e..689b0b53b2 100644
--- a/contrib/libs/icu/common/unormcmp.cpp
+++ b/contrib/libs/icu/common/unormcmp.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: unormcmp.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -313,7 +313,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
*/
if( level1==0 && (options&U_COMPARE_IGNORE_CASE) &&
- (length=ucase_toFullFolding((UChar32)cp1, &p, options))>=0
+ (length=ucase_toFullFolding((UChar32)cp1, &p, options))>=0
) {
/* cp1 case-folds to the code point "length" or to p[length] */
if(U_IS_SURROGATE(c1)) {
@@ -358,7 +358,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
}
if( level2==0 && (options&U_COMPARE_IGNORE_CASE) &&
- (length=ucase_toFullFolding((UChar32)cp2, &p, options))>=0
+ (length=ucase_toFullFolding((UChar32)cp2, &p, options))>=0
) {
/* cp2 case-folds to the code point "length" or to p[length] */
if(U_IS_SURROGATE(c2)) {
diff --git a/contrib/libs/icu/common/unormimp.h b/contrib/libs/icu/common/unormimp.h
index a57867bcf4..88c7975cc4 100644
--- a/contrib/libs/icu/common/unormimp.h
+++ b/contrib/libs/icu/common/unormimp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: unormimp.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/uobject.cpp b/contrib/libs/icu/common/uobject.cpp
index 818741946b..e222b2ce9b 100644
--- a/contrib/libs/icu/common/uobject.cpp
+++ b/contrib/libs/icu/common/uobject.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: uobject.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -58,32 +58,32 @@ U_NAMESPACE_BEGIN
* and replace with uprv_malloc/uprv_free.
*/
-void * U_EXPORT2 UMemory::operator new(size_t size) U_NOEXCEPT {
+void * U_EXPORT2 UMemory::operator new(size_t size) U_NOEXCEPT {
return uprv_malloc(size);
}
-void U_EXPORT2 UMemory::operator delete(void *p) U_NOEXCEPT {
+void U_EXPORT2 UMemory::operator delete(void *p) U_NOEXCEPT {
if(p!=NULL) {
uprv_free(p);
}
}
-void * U_EXPORT2 UMemory::operator new[](size_t size) U_NOEXCEPT {
+void * U_EXPORT2 UMemory::operator new[](size_t size) U_NOEXCEPT {
return uprv_malloc(size);
}
-void U_EXPORT2 UMemory::operator delete[](void *p) U_NOEXCEPT {
+void U_EXPORT2 UMemory::operator delete[](void *p) U_NOEXCEPT {
if(p!=NULL) {
uprv_free(p);
}
}
#if U_HAVE_DEBUG_LOCATION_NEW
-void * U_EXPORT2 UMemory::operator new(size_t size, const char* /*file*/, int /*line*/) U_NOEXCEPT {
+void * U_EXPORT2 UMemory::operator new(size_t size, const char* /*file*/, int /*line*/) U_NOEXCEPT {
return UMemory::operator new(size);
}
-void U_EXPORT2 UMemory::operator delete(void* p, const char* /*file*/, int /*line*/) U_NOEXCEPT {
+void U_EXPORT2 UMemory::operator delete(void* p, const char* /*file*/, int /*line*/) U_NOEXCEPT {
UMemory::operator delete(p);
}
#endif /* U_HAVE_DEBUG_LOCATION_NEW */
diff --git a/contrib/libs/icu/common/uposixdefs.h b/contrib/libs/icu/common/uposixdefs.h
index ad813dd649..23c3f6d466 100644
--- a/contrib/libs/icu/common/uposixdefs.h
+++ b/contrib/libs/icu/common/uposixdefs.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: uposixdefs.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -54,24 +54,24 @@
*
* z/OS needs this definition for timeval and to get usleep.
*/
-#if !defined(_XOPEN_SOURCE_EXTENDED) && defined(__TOS_MVS__)
+#if !defined(_XOPEN_SOURCE_EXTENDED) && defined(__TOS_MVS__)
# define _XOPEN_SOURCE_EXTENDED 1
#endif
-/**
- * Solaris says:
- * "...it is invalid to compile an XPG6 or a POSIX.1-2001 application with anything other
- * than a c99 or later compiler."
- * Apparently C++11 is not "or later". Work around this.
+/**
+ * Solaris says:
+ * "...it is invalid to compile an XPG6 or a POSIX.1-2001 application with anything other
+ * than a c99 or later compiler."
+ * Apparently C++11 is not "or later". Work around this.
*/
-#if defined(__cplusplus) && (defined(sun) || defined(__sun)) && !defined (_STDC_C99)
-# define _STDC_C99
+#if defined(__cplusplus) && (defined(sun) || defined(__sun)) && !defined (_STDC_C99)
+# define _STDC_C99
+#endif
+
+#if !defined _POSIX_C_SOURCE && \
+ defined(__APPLE__) && defined(__MACH__) && !defined(__clang__)
+// Needed to prevent EOWNERDEAD issues with GCC on Mac
+#define _POSIX_C_SOURCE 200809L
#endif
-#if !defined _POSIX_C_SOURCE && \
- defined(__APPLE__) && defined(__MACH__) && !defined(__clang__)
-// Needed to prevent EOWNERDEAD issues with GCC on Mac
-#define _POSIX_C_SOURCE 200809L
-#endif
-
#endif /* __UPOSIXDEFS_H__ */
diff --git a/contrib/libs/icu/common/uprops.cpp b/contrib/libs/icu/common/uprops.cpp
index ae24644cb0..1604ad9a17 100644
--- a/contrib/libs/icu/common/uprops.cpp
+++ b/contrib/libs/icu/common/uprops.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: uprops.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -25,132 +25,132 @@
#include "unicode/utypes.h"
#include "unicode/uchar.h"
-#include "unicode/ucptrie.h"
-#include "unicode/udata.h"
+#include "unicode/ucptrie.h"
+#include "unicode/udata.h"
#include "unicode/unorm2.h"
#include "unicode/uscript.h"
#include "unicode/ustring.h"
#include "cstring.h"
-#include "mutex.h"
+#include "mutex.h"
#include "normalizer2impl.h"
#include "umutex.h"
#include "ubidi_props.h"
#include "uprops.h"
#include "ucase.h"
-#include "ucln_cmn.h"
-#include "ulayout_props.h"
+#include "ucln_cmn.h"
+#include "ulayout_props.h"
#include "ustr_imp.h"
U_NAMESPACE_USE
-// Unicode text layout properties data -----------------------------------------
-
-namespace {
-
-icu::UInitOnce gLayoutInitOnce = U_INITONCE_INITIALIZER;
-UDataMemory *gLayoutMemory = nullptr;
-
-UCPTrie *gInpcTrie = nullptr; // Indic_Positional_Category
-UCPTrie *gInscTrie = nullptr; // Indic_Syllabic_Category
-UCPTrie *gVoTrie = nullptr; // Vertical_Orientation
-
-int32_t gMaxInpcValue = 0;
-int32_t gMaxInscValue = 0;
-int32_t gMaxVoValue = 0;
-
-UBool U_CALLCONV uprops_cleanup() {
- udata_close(gLayoutMemory);
- gLayoutMemory = nullptr;
-
- ucptrie_close(gInpcTrie);
- gInpcTrie = nullptr;
- ucptrie_close(gInscTrie);
- gInscTrie = nullptr;
- ucptrie_close(gVoTrie);
- gVoTrie = nullptr;
-
- gMaxInpcValue = 0;
- gMaxInscValue = 0;
- gMaxVoValue = 0;
-
- gLayoutInitOnce.reset();
- return TRUE;
-}
-
-UBool U_CALLCONV
-ulayout_isAcceptable(void * /*context*/,
- const char * /* type */, const char * /*name*/,
- const UDataInfo *pInfo) {
- return pInfo->size >= 20 &&
- pInfo->isBigEndian == U_IS_BIG_ENDIAN &&
- pInfo->charsetFamily == U_CHARSET_FAMILY &&
- pInfo->dataFormat[0] == ULAYOUT_FMT_0 &&
- pInfo->dataFormat[1] == ULAYOUT_FMT_1 &&
- pInfo->dataFormat[2] == ULAYOUT_FMT_2 &&
- pInfo->dataFormat[3] == ULAYOUT_FMT_3 &&
- pInfo->formatVersion[0] == 1;
-}
-
-// UInitOnce singleton initialization function
-void U_CALLCONV ulayout_load(UErrorCode &errorCode) {
- gLayoutMemory = udata_openChoice(
- nullptr, ULAYOUT_DATA_TYPE, ULAYOUT_DATA_NAME,
- ulayout_isAcceptable, nullptr, &errorCode);
- if (U_FAILURE(errorCode)) { return; }
-
- const uint8_t *inBytes = (const uint8_t *)udata_getMemory(gLayoutMemory);
- const int32_t *inIndexes = (const int32_t *)inBytes;
- int32_t indexesLength = inIndexes[ULAYOUT_IX_INDEXES_LENGTH];
- if (indexesLength < 12) {
- errorCode = U_INVALID_FORMAT_ERROR; // Not enough indexes.
- return;
- }
- int32_t offset = indexesLength * 4;
- int32_t top = inIndexes[ULAYOUT_IX_INPC_TRIE_TOP];
- int32_t trieSize = top - offset;
- if (trieSize >= 16) {
- gInpcTrie = ucptrie_openFromBinary(
- UCPTRIE_TYPE_ANY, UCPTRIE_VALUE_BITS_ANY,
- inBytes + offset, trieSize, nullptr, &errorCode);
- }
- offset = top;
- top = inIndexes[ULAYOUT_IX_INSC_TRIE_TOP];
- trieSize = top - offset;
- if (trieSize >= 16) {
- gInscTrie = ucptrie_openFromBinary(
- UCPTRIE_TYPE_ANY, UCPTRIE_VALUE_BITS_ANY,
- inBytes + offset, trieSize, nullptr, &errorCode);
- }
- offset = top;
- top = inIndexes[ULAYOUT_IX_VO_TRIE_TOP];
- trieSize = top - offset;
- if (trieSize >= 16) {
- gVoTrie = ucptrie_openFromBinary(
- UCPTRIE_TYPE_ANY, UCPTRIE_VALUE_BITS_ANY,
- inBytes + offset, trieSize, nullptr, &errorCode);
- }
-
- uint32_t maxValues = inIndexes[ULAYOUT_IX_MAX_VALUES];
- gMaxInpcValue = maxValues >> ULAYOUT_MAX_INPC_SHIFT;
- gMaxInscValue = (maxValues >> ULAYOUT_MAX_INSC_SHIFT) & 0xff;
- gMaxVoValue = (maxValues >> ULAYOUT_MAX_VO_SHIFT) & 0xff;
-
- ucln_common_registerCleanup(UCLN_COMMON_UPROPS, uprops_cleanup);
-}
-
-UBool ulayout_ensureData(UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) { return FALSE; }
- umtx_initOnce(gLayoutInitOnce, &ulayout_load, errorCode);
- return U_SUCCESS(errorCode);
-}
-
-UBool ulayout_ensureData() {
- UErrorCode errorCode = U_ZERO_ERROR;
- return ulayout_ensureData(errorCode);
-}
-
-} // namespace
-
+// Unicode text layout properties data -----------------------------------------
+
+namespace {
+
+icu::UInitOnce gLayoutInitOnce = U_INITONCE_INITIALIZER;
+UDataMemory *gLayoutMemory = nullptr;
+
+UCPTrie *gInpcTrie = nullptr; // Indic_Positional_Category
+UCPTrie *gInscTrie = nullptr; // Indic_Syllabic_Category
+UCPTrie *gVoTrie = nullptr; // Vertical_Orientation
+
+int32_t gMaxInpcValue = 0;
+int32_t gMaxInscValue = 0;
+int32_t gMaxVoValue = 0;
+
+UBool U_CALLCONV uprops_cleanup() {
+ udata_close(gLayoutMemory);
+ gLayoutMemory = nullptr;
+
+ ucptrie_close(gInpcTrie);
+ gInpcTrie = nullptr;
+ ucptrie_close(gInscTrie);
+ gInscTrie = nullptr;
+ ucptrie_close(gVoTrie);
+ gVoTrie = nullptr;
+
+ gMaxInpcValue = 0;
+ gMaxInscValue = 0;
+ gMaxVoValue = 0;
+
+ gLayoutInitOnce.reset();
+ return TRUE;
+}
+
+UBool U_CALLCONV
+ulayout_isAcceptable(void * /*context*/,
+ const char * /* type */, const char * /*name*/,
+ const UDataInfo *pInfo) {
+ return pInfo->size >= 20 &&
+ pInfo->isBigEndian == U_IS_BIG_ENDIAN &&
+ pInfo->charsetFamily == U_CHARSET_FAMILY &&
+ pInfo->dataFormat[0] == ULAYOUT_FMT_0 &&
+ pInfo->dataFormat[1] == ULAYOUT_FMT_1 &&
+ pInfo->dataFormat[2] == ULAYOUT_FMT_2 &&
+ pInfo->dataFormat[3] == ULAYOUT_FMT_3 &&
+ pInfo->formatVersion[0] == 1;
+}
+
+// UInitOnce singleton initialization function
+void U_CALLCONV ulayout_load(UErrorCode &errorCode) {
+ gLayoutMemory = udata_openChoice(
+ nullptr, ULAYOUT_DATA_TYPE, ULAYOUT_DATA_NAME,
+ ulayout_isAcceptable, nullptr, &errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+
+ const uint8_t *inBytes = (const uint8_t *)udata_getMemory(gLayoutMemory);
+ const int32_t *inIndexes = (const int32_t *)inBytes;
+ int32_t indexesLength = inIndexes[ULAYOUT_IX_INDEXES_LENGTH];
+ if (indexesLength < 12) {
+ errorCode = U_INVALID_FORMAT_ERROR; // Not enough indexes.
+ return;
+ }
+ int32_t offset = indexesLength * 4;
+ int32_t top = inIndexes[ULAYOUT_IX_INPC_TRIE_TOP];
+ int32_t trieSize = top - offset;
+ if (trieSize >= 16) {
+ gInpcTrie = ucptrie_openFromBinary(
+ UCPTRIE_TYPE_ANY, UCPTRIE_VALUE_BITS_ANY,
+ inBytes + offset, trieSize, nullptr, &errorCode);
+ }
+ offset = top;
+ top = inIndexes[ULAYOUT_IX_INSC_TRIE_TOP];
+ trieSize = top - offset;
+ if (trieSize >= 16) {
+ gInscTrie = ucptrie_openFromBinary(
+ UCPTRIE_TYPE_ANY, UCPTRIE_VALUE_BITS_ANY,
+ inBytes + offset, trieSize, nullptr, &errorCode);
+ }
+ offset = top;
+ top = inIndexes[ULAYOUT_IX_VO_TRIE_TOP];
+ trieSize = top - offset;
+ if (trieSize >= 16) {
+ gVoTrie = ucptrie_openFromBinary(
+ UCPTRIE_TYPE_ANY, UCPTRIE_VALUE_BITS_ANY,
+ inBytes + offset, trieSize, nullptr, &errorCode);
+ }
+
+ uint32_t maxValues = inIndexes[ULAYOUT_IX_MAX_VALUES];
+ gMaxInpcValue = maxValues >> ULAYOUT_MAX_INPC_SHIFT;
+ gMaxInscValue = (maxValues >> ULAYOUT_MAX_INSC_SHIFT) & 0xff;
+ gMaxVoValue = (maxValues >> ULAYOUT_MAX_VO_SHIFT) & 0xff;
+
+ ucln_common_registerCleanup(UCLN_COMMON_UPROPS, uprops_cleanup);
+}
+
+UBool ulayout_ensureData(UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return FALSE; }
+ umtx_initOnce(gLayoutInitOnce, &ulayout_load, errorCode);
+ return U_SUCCESS(errorCode);
+}
+
+UBool ulayout_ensureData() {
+ UErrorCode errorCode = U_ZERO_ERROR;
+ return ulayout_ensureData(errorCode);
+}
+
+} // namespace
+
/* general properties API functions ----------------------------------------- */
struct BinaryProperty;
@@ -169,19 +169,19 @@ static UBool defaultContains(const BinaryProperty &prop, UChar32 c, UProperty /*
}
static UBool caseBinaryPropertyContains(const BinaryProperty &/*prop*/, UChar32 c, UProperty which) {
- return static_cast<UBool>(ucase_hasBinaryProperty(c, which));
+ return static_cast<UBool>(ucase_hasBinaryProperty(c, which));
}
static UBool isBidiControl(const BinaryProperty &/*prop*/, UChar32 c, UProperty /*which*/) {
- return ubidi_isBidiControl(c);
+ return ubidi_isBidiControl(c);
}
static UBool isMirrored(const BinaryProperty &/*prop*/, UChar32 c, UProperty /*which*/) {
- return ubidi_isMirrored(c);
+ return ubidi_isMirrored(c);
}
static UBool isJoinControl(const BinaryProperty &/*prop*/, UChar32 c, UProperty /*which*/) {
- return ubidi_isJoinControl(c);
+ return ubidi_isJoinControl(c);
}
#if UCONFIG_NO_NORMALIZATION
@@ -240,7 +240,7 @@ static UBool changesWhenCasefolded(const BinaryProperty &/*prop*/, UChar32 c, UP
if(c>=0) {
/* single code point */
const UChar *resultString;
- return (UBool)(ucase_toFullFolding(c, &resultString, U_FOLD_CASE_DEFAULT)>=0);
+ return (UBool)(ucase_toFullFolding(c, &resultString, U_FOLD_CASE_DEFAULT)>=0);
} else {
/* guess some large but stack-friendly capacity */
UChar dest[2*UCASE_MAX_STRING_LENGTH];
@@ -317,11 +317,11 @@ static UBool isPOSIX_xdigit(const BinaryProperty &/*prop*/, UChar32 c, UProperty
return u_isxdigit(c);
}
-static UBool isRegionalIndicator(const BinaryProperty &/*prop*/, UChar32 c, UProperty /*which*/) {
- // Property starts are a subset of lb=RI etc.
- return 0x1F1E6<=c && c<=0x1F1FF;
-}
-
+static UBool isRegionalIndicator(const BinaryProperty &/*prop*/, UChar32 c, UProperty /*which*/) {
+ // Property starts are a subset of lb=RI etc.
+ return 0x1F1E6<=c && c<=0x1F1FF;
+}
+
static const BinaryProperty binProps[UCHAR_BINARY_LIMIT]={
/*
* column and mask values for binary properties from u_getUnicodeProperties().
@@ -392,10 +392,10 @@ static const BinaryProperty binProps[UCHAR_BINARY_LIMIT]={
{ 2, U_MASK(UPROPS_2_EMOJI_PRESENTATION), defaultContains },
{ 2, U_MASK(UPROPS_2_EMOJI_MODIFIER), defaultContains },
{ 2, U_MASK(UPROPS_2_EMOJI_MODIFIER_BASE), defaultContains },
- { 2, U_MASK(UPROPS_2_EMOJI_COMPONENT), defaultContains },
- { 2, 0, isRegionalIndicator },
- { 1, U_MASK(UPROPS_PREPENDED_CONCATENATION_MARK), defaultContains },
- { 2, U_MASK(UPROPS_2_EXTENDED_PICTOGRAPHIC), defaultContains },
+ { 2, U_MASK(UPROPS_2_EMOJI_COMPONENT), defaultContains },
+ { 2, 0, isRegionalIndicator },
+ { 1, U_MASK(UPROPS_PREPENDED_CONCATENATION_MARK), defaultContains },
+ { 2, U_MASK(UPROPS_2_EXTENDED_PICTOGRAPHIC), defaultContains },
};
U_CAPI UBool U_EXPORT2
@@ -441,11 +441,11 @@ static int32_t getBiDiClass(const IntProperty &/*prop*/, UChar32 c, UProperty /*
}
static int32_t getBiDiPairedBracketType(const IntProperty &/*prop*/, UChar32 c, UProperty /*which*/) {
- return (int32_t)ubidi_getPairedBracketType(c);
+ return (int32_t)ubidi_getPairedBracketType(c);
}
static int32_t biDiGetMaxValue(const IntProperty &/*prop*/, UProperty which) {
- return ubidi_getMaxValue(which);
+ return ubidi_getMaxValue(which);
}
#if UCONFIG_NO_NORMALIZATION
@@ -463,11 +463,11 @@ static int32_t getGeneralCategory(const IntProperty &/*prop*/, UChar32 c, UPrope
}
static int32_t getJoiningGroup(const IntProperty &/*prop*/, UChar32 c, UProperty /*which*/) {
- return ubidi_getJoiningGroup(c);
+ return ubidi_getJoiningGroup(c);
}
static int32_t getJoiningType(const IntProperty &/*prop*/, UChar32 c, UProperty /*which*/) {
- return ubidi_getJoiningType(c);
+ return ubidi_getJoiningType(c);
}
static int32_t getNumericType(const IntProperty &/*prop*/, UChar32 c, UProperty /*which*/) {
@@ -480,11 +480,11 @@ static int32_t getScript(const IntProperty &/*prop*/, UChar32 c, UProperty /*whi
return (int32_t)uscript_getScript(c, &errorCode);
}
-static int32_t scriptGetMaxValue(const IntProperty &/*prop*/, UProperty /*which*/) {
- uint32_t scriptX=uprv_getMaxValues(0)&UPROPS_SCRIPT_X_MASK;
- return uprops_mergeScriptCodeOrIndex(scriptX);
-}
-
+static int32_t scriptGetMaxValue(const IntProperty &/*prop*/, UProperty /*which*/) {
+ uint32_t scriptX=uprv_getMaxValues(0)&UPROPS_SCRIPT_X_MASK;
+ return uprops_mergeScriptCodeOrIndex(scriptX);
+}
+
/*
* Map some of the Grapheme Cluster Break values to Hangul Syllable Types.
* Hangul_Syllable_Type is fully redundant with a subset of Grapheme_Cluster_Break.
@@ -546,32 +546,32 @@ static int32_t getTrailCombiningClass(const IntProperty &/*prop*/, UChar32 c, UP
}
#endif
-static int32_t getInPC(const IntProperty &, UChar32 c, UProperty) {
- return ulayout_ensureData() && gInpcTrie != nullptr ? ucptrie_get(gInpcTrie, c) : 0;
-}
-
-static int32_t getInSC(const IntProperty &, UChar32 c, UProperty) {
- return ulayout_ensureData() && gInscTrie != nullptr ? ucptrie_get(gInscTrie, c) : 0;
-}
-
-static int32_t getVo(const IntProperty &, UChar32 c, UProperty) {
- return ulayout_ensureData() && gVoTrie != nullptr ? ucptrie_get(gVoTrie, c) : 0;
-}
-
-static int32_t layoutGetMaxValue(const IntProperty &/*prop*/, UProperty which) {
- if (!ulayout_ensureData()) { return 0; }
- switch (which) {
- case UCHAR_INDIC_POSITIONAL_CATEGORY:
- return gMaxInpcValue;
- case UCHAR_INDIC_SYLLABIC_CATEGORY:
- return gMaxInscValue;
- case UCHAR_VERTICAL_ORIENTATION:
- return gMaxVoValue;
- default:
- return 0;
- }
-}
-
+static int32_t getInPC(const IntProperty &, UChar32 c, UProperty) {
+ return ulayout_ensureData() && gInpcTrie != nullptr ? ucptrie_get(gInpcTrie, c) : 0;
+}
+
+static int32_t getInSC(const IntProperty &, UChar32 c, UProperty) {
+ return ulayout_ensureData() && gInscTrie != nullptr ? ucptrie_get(gInscTrie, c) : 0;
+}
+
+static int32_t getVo(const IntProperty &, UChar32 c, UProperty) {
+ return ulayout_ensureData() && gVoTrie != nullptr ? ucptrie_get(gVoTrie, c) : 0;
+}
+
+static int32_t layoutGetMaxValue(const IntProperty &/*prop*/, UProperty which) {
+ if (!ulayout_ensureData()) { return 0; }
+ switch (which) {
+ case UCHAR_INDIC_POSITIONAL_CATEGORY:
+ return gMaxInpcValue;
+ case UCHAR_INDIC_SYLLABIC_CATEGORY:
+ return gMaxInscValue;
+ case UCHAR_VERTICAL_ORIENTATION:
+ return gMaxVoValue;
+ default:
+ return 0;
+ }
+}
+
static const IntProperty intProps[UCHAR_INT_LIMIT-UCHAR_INT_START]={
/*
* column, mask and shift values for int-value properties from u_getUnicodeProperties().
@@ -591,7 +591,7 @@ static const IntProperty intProps[UCHAR_INT_LIMIT-UCHAR_INT_START]={
{ UPROPS_SRC_BIDI, 0, 0, getJoiningType, biDiGetMaxValue },
{ 2, UPROPS_LB_MASK, UPROPS_LB_SHIFT, defaultGetValue, defaultGetMaxValue },
{ UPROPS_SRC_CHAR, 0, (int32_t)U_NT_COUNT-1, getNumericType, getMaxValueFromShift },
- { UPROPS_SRC_PROPSVEC, 0, 0, getScript, scriptGetMaxValue },
+ { UPROPS_SRC_PROPSVEC, 0, 0, getScript, scriptGetMaxValue },
{ UPROPS_SRC_PROPSVEC, 0, (int32_t)U_HST_COUNT-1, getHangulSyllableType, getMaxValueFromShift },
// UCHAR_NFD_QUICK_CHECK: max=1=YES -- never "maybe", only "no" or "yes"
{ UPROPS_SRC_NFC, 0, (int32_t)UNORM_YES, getNormQuickCheck, getMaxValueFromShift },
@@ -607,9 +607,9 @@ static const IntProperty intProps[UCHAR_INT_LIMIT-UCHAR_INT_START]={
{ 2, UPROPS_SB_MASK, UPROPS_SB_SHIFT, defaultGetValue, defaultGetMaxValue },
{ 2, UPROPS_WB_MASK, UPROPS_WB_SHIFT, defaultGetValue, defaultGetMaxValue },
{ UPROPS_SRC_BIDI, 0, 0, getBiDiPairedBracketType, biDiGetMaxValue },
- { UPROPS_SRC_INPC, 0, 0, getInPC, layoutGetMaxValue },
- { UPROPS_SRC_INSC, 0, 0, getInSC, layoutGetMaxValue },
- { UPROPS_SRC_VO, 0, 0, getVo, layoutGetMaxValue },
+ { UPROPS_SRC_INPC, 0, 0, getInPC, layoutGetMaxValue },
+ { UPROPS_SRC_INSC, 0, 0, getInSC, layoutGetMaxValue },
+ { UPROPS_SRC_VO, 0, 0, getVo, layoutGetMaxValue },
};
U_CAPI int32_t U_EXPORT2
@@ -711,39 +711,39 @@ uprops_getSource(UProperty which) {
}
}
-U_CFUNC void U_EXPORT2
-uprops_addPropertyStarts(UPropertySource src, const USetAdder *sa, UErrorCode *pErrorCode) {
- if (!ulayout_ensureData(*pErrorCode)) { return; }
- const UCPTrie *trie;
- switch (src) {
- case UPROPS_SRC_INPC:
- trie = gInpcTrie;
- break;
- case UPROPS_SRC_INSC:
- trie = gInscTrie;
- break;
- case UPROPS_SRC_VO:
- trie = gVoTrie;
- break;
- default:
- *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- if (trie == nullptr) {
- *pErrorCode = U_MISSING_RESOURCE_ERROR;
- return;
- }
-
- // Add the start code point of each same-value range of the trie.
- UChar32 start = 0, end;
- while ((end = ucptrie_getRange(trie, start, UCPMAP_RANGE_NORMAL, 0,
- nullptr, nullptr, nullptr)) >= 0) {
- sa->add(sa->set, start);
- start = end + 1;
- }
-}
-
+U_CFUNC void U_EXPORT2
+uprops_addPropertyStarts(UPropertySource src, const USetAdder *sa, UErrorCode *pErrorCode) {
+ if (!ulayout_ensureData(*pErrorCode)) { return; }
+ const UCPTrie *trie;
+ switch (src) {
+ case UPROPS_SRC_INPC:
+ trie = gInpcTrie;
+ break;
+ case UPROPS_SRC_INSC:
+ trie = gInscTrie;
+ break;
+ case UPROPS_SRC_VO:
+ trie = gVoTrie;
+ break;
+ default:
+ *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ if (trie == nullptr) {
+ *pErrorCode = U_MISSING_RESOURCE_ERROR;
+ return;
+ }
+
+ // Add the start code point of each same-value range of the trie.
+ UChar32 start = 0, end;
+ while ((end = ucptrie_getRange(trie, start, UCPMAP_RANGE_NORMAL, 0,
+ nullptr, nullptr, nullptr)) >= 0) {
+ sa->add(sa->set, start);
+ start = end + 1;
+ }
+}
+
#if !UCONFIG_NO_NORMALIZATION
U_CAPI int32_t U_EXPORT2
@@ -768,7 +768,7 @@ u_getFC_NFKC_Closure(UChar32 c, UChar *dest, int32_t destCapacity, UErrorCode *p
// first: b = NFKC(Fold(a))
UnicodeString folded1String;
const UChar *folded1;
- int32_t folded1Length=ucase_toFullFolding(c, &folded1, U_FOLD_CASE_DEFAULT);
+ int32_t folded1Length=ucase_toFullFolding(c, &folded1, U_FOLD_CASE_DEFAULT);
if(folded1Length<0) {
const Normalizer2Impl *nfkcImpl=Normalizer2Factory::getImpl(nfkc);
if(nfkcImpl->getCompQuickCheck(nfkcImpl->getNorm16(c))!=UNORM_NO) {
diff --git a/contrib/libs/icu/common/uprops.h b/contrib/libs/icu/common/uprops.h
index 575fb40086..8bf929919f 100644
--- a/contrib/libs/icu/common/uprops.h
+++ b/contrib/libs/icu/common/uprops.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: uprops.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -95,15 +95,15 @@ enum {
* denominator: den = 20<<(frac20>>2)
*/
UPROPS_NTV_FRACTION20_START=UPROPS_NTV_BASE60_START+36, // 0x300+9*4=0x324
- /**
- * Fraction-32 values:
- * frac32 = ntv-0x34c = 0..15 -> 1|3|5|7 / 32|64|128|256
- * numerator: num = 2*(frac32&3)+1
- * denominator: den = 32<<(frac32>>2)
- */
- UPROPS_NTV_FRACTION32_START=UPROPS_NTV_FRACTION20_START+24, // 0x324+6*4=0x34c
+ /**
+ * Fraction-32 values:
+ * frac32 = ntv-0x34c = 0..15 -> 1|3|5|7 / 32|64|128|256
+ * numerator: num = 2*(frac32&3)+1
+ * denominator: den = 32<<(frac32>>2)
+ */
+ UPROPS_NTV_FRACTION32_START=UPROPS_NTV_FRACTION20_START+24, // 0x324+6*4=0x34c
/** No numeric value (yet). */
- UPROPS_NTV_RESERVED_START=UPROPS_NTV_FRACTION32_START+16, // 0x34c+4*4=0x35c
+ UPROPS_NTV_RESERVED_START=UPROPS_NTV_FRACTION32_START+16, // 0x34c+4*4=0x35c
UPROPS_NTV_MAX_SMALL_INT=UPROPS_NTV_FRACTION_START-UPROPS_NTV_NUMERIC_START-1
};
@@ -121,12 +121,12 @@ enum {
* Properties in vector word 0
* Bits
* 31..24 DerivedAge version major/minor one nibble each
- * 23..22 3..1: Bits 21..20 & 7..0 = Script_Extensions index
+ * 23..22 3..1: Bits 21..20 & 7..0 = Script_Extensions index
* 3: Script value from Script_Extensions
* 2: Script=Inherited
* 1: Script=Common
- * 0: Script=bits 21..20 & 7..0
- * 21..20 Bits 9..8 of the UScriptCode, or index to Script_Extensions
+ * 0: Script=bits 21..20 & 7..0
+ * 21..20 Bits 9..8 of the UScriptCode, or index to Script_Extensions
* 19..17 East Asian Width
* 16.. 8 UBlockCode
* 7.. 0 UScriptCode, or index to Script_Extensions
@@ -137,43 +137,43 @@ enum {
#define UPROPS_AGE_SHIFT 24
/* Script_Extensions: mask includes Script */
-#define UPROPS_SCRIPT_X_MASK 0x00f000ff
+#define UPROPS_SCRIPT_X_MASK 0x00f000ff
#define UPROPS_SCRIPT_X_SHIFT 22
-// The UScriptCode or Script_Extensions index is split across two bit fields.
-// (Starting with Unicode 13/ICU 66/2019 due to more varied Script_Extensions.)
-// Shift the high bits right by 12 to assemble the full value.
-#define UPROPS_SCRIPT_HIGH_MASK 0x00300000
-#define UPROPS_SCRIPT_HIGH_SHIFT 12
-#define UPROPS_MAX_SCRIPT 0x3ff
-
+// The UScriptCode or Script_Extensions index is split across two bit fields.
+// (Starting with Unicode 13/ICU 66/2019 due to more varied Script_Extensions.)
+// Shift the high bits right by 12 to assemble the full value.
+#define UPROPS_SCRIPT_HIGH_MASK 0x00300000
+#define UPROPS_SCRIPT_HIGH_SHIFT 12
+#define UPROPS_MAX_SCRIPT 0x3ff
+
#define UPROPS_EA_MASK 0x000e0000
#define UPROPS_EA_SHIFT 17
#define UPROPS_BLOCK_MASK 0x0001ff00
#define UPROPS_BLOCK_SHIFT 8
-#define UPROPS_SCRIPT_LOW_MASK 0x000000ff
+#define UPROPS_SCRIPT_LOW_MASK 0x000000ff
/* UPROPS_SCRIPT_X_WITH_COMMON must be the lowest value that involves Script_Extensions. */
#define UPROPS_SCRIPT_X_WITH_COMMON 0x400000
#define UPROPS_SCRIPT_X_WITH_INHERITED 0x800000
#define UPROPS_SCRIPT_X_WITH_OTHER 0xc00000
-#ifdef __cplusplus
-
-namespace {
-
-inline uint32_t uprops_mergeScriptCodeOrIndex(uint32_t scriptX) {
- return
- ((scriptX & UPROPS_SCRIPT_HIGH_MASK) >> UPROPS_SCRIPT_HIGH_SHIFT) |
- (scriptX & UPROPS_SCRIPT_LOW_MASK);
-}
-
-} // namespace
-
-#endif // __cplusplus
-
+#ifdef __cplusplus
+
+namespace {
+
+inline uint32_t uprops_mergeScriptCodeOrIndex(uint32_t scriptX) {
+ return
+ ((scriptX & UPROPS_SCRIPT_HIGH_MASK) >> UPROPS_SCRIPT_HIGH_SHIFT) |
+ (scriptX & UPROPS_SCRIPT_LOW_MASK);
+}
+
+} // namespace
+
+#endif // __cplusplus
+
/*
* Properties in vector word 1
* Each bit encodes one binary property.
@@ -217,14 +217,14 @@ enum {
UPROPS_VARIATION_SELECTOR,
UPROPS_PATTERN_SYNTAX, /* new in ICU 3.4 and Unicode 4.1 */
UPROPS_PATTERN_WHITE_SPACE,
- UPROPS_PREPENDED_CONCATENATION_MARK, // new in ICU 60 and Unicode 10
+ UPROPS_PREPENDED_CONCATENATION_MARK, // new in ICU 60 and Unicode 10
UPROPS_BINARY_1_TOP /* ==32 - full! */
};
/*
* Properties in vector word 2
* Bits
- * 31..26 http://www.unicode.org/reports/tr51/#Emoji_Properties
+ * 31..26 http://www.unicode.org/reports/tr51/#Emoji_Properties
* 25..20 Line Break
* 19..15 Sentence Break
* 14..10 Word Break
@@ -232,9 +232,9 @@ enum {
* 4.. 0 Decomposition Type
*/
enum {
- UPROPS_2_EXTENDED_PICTOGRAPHIC=26,
- UPROPS_2_EMOJI_COMPONENT,
- UPROPS_2_EMOJI,
+ UPROPS_2_EXTENDED_PICTOGRAPHIC=26,
+ UPROPS_2_EMOJI_COMPONENT,
+ UPROPS_2_EMOJI,
UPROPS_2_EMOJI_PRESENTATION,
UPROPS_2_EMOJI_MODIFIER,
UPROPS_2_EMOJI_MODIFIER_BASE
@@ -425,10 +425,10 @@ enum UPropertySource {
UPROPS_SRC_NFKC_CF,
/** From normalizer2impl.cpp/nfc.nrm canonical iterator data */
UPROPS_SRC_NFC_CANON_ITER,
- // Text layout properties.
- UPROPS_SRC_INPC,
- UPROPS_SRC_INSC,
- UPROPS_SRC_VO,
+ // Text layout properties.
+ UPROPS_SRC_INPC,
+ UPROPS_SRC_INSC,
+ UPROPS_SRC_VO,
/** One more than the highest UPropertySource (UPROPS_SRC_) constant. */
UPROPS_SRC_COUNT
};
@@ -457,9 +457,9 @@ uchar_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode);
U_CFUNC void U_EXPORT2
upropsvec_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode);
-U_CFUNC void U_EXPORT2
-uprops_addPropertyStarts(UPropertySource src, const USetAdder *sa, UErrorCode *pErrorCode);
-
+U_CFUNC void U_EXPORT2
+uprops_addPropertyStarts(UPropertySource src, const USetAdder *sa, UErrorCode *pErrorCode);
+
/**
* Return a set of characters for property enumeration.
* For each two consecutive characters (start, limit) in the set,
@@ -487,12 +487,12 @@ U_NAMESPACE_BEGIN
class UnicodeSet;
-class CharacterProperties {
-public:
- CharacterProperties() = delete;
- static const UnicodeSet *getInclusionsForProperty(UProperty prop, UErrorCode &errorCode);
-};
-
+class CharacterProperties {
+public:
+ CharacterProperties() = delete;
+ static const UnicodeSet *getInclusionsForProperty(UProperty prop, UErrorCode &errorCode);
+};
+
// implemented in uniset_props.cpp
U_CFUNC UnicodeSet *
uniset_getUnicode32Instance(UErrorCode &errorCode);
diff --git a/contrib/libs/icu/common/ures_cnv.cpp b/contrib/libs/icu/common/ures_cnv.cpp
index cb2ee28cbf..1aa58e753c 100644
--- a/contrib/libs/icu/common/ures_cnv.cpp
+++ b/contrib/libs/icu/common/ures_cnv.cpp
@@ -1,78 +1,78 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-*******************************************************************************
-*
-* Copyright (C) 1997-2006, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-*******************************************************************************
-* file name: ures_cnv.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 2004aug25
-* created by: Markus W. Scherer
-*
-* Character conversion functions moved here from uresbund.c
-*/
-
-#include "unicode/utypes.h"
-#include "unicode/putil.h"
-#include "unicode/ustring.h"
-#include "unicode/ucnv.h"
-#include "unicode/ures.h"
-#include "uinvchar.h"
-#include "ustr_cnv.h"
-
-U_CAPI UResourceBundle * U_EXPORT2
-ures_openU(const UChar *myPath,
- const char *localeID,
- UErrorCode *status)
-{
- char pathBuffer[1024];
- int32_t length;
- char *path = pathBuffer;
-
- if(status==NULL || U_FAILURE(*status)) {
- return NULL;
- }
- if(myPath==NULL) {
- path = NULL;
- }
- else {
- length=u_strlen(myPath);
- if(length>=(int32_t)sizeof(pathBuffer)) {
- *status=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
- } else if(uprv_isInvariantUString(myPath, length)) {
- /*
- * the invariant converter is sufficient for package and tree names
- * and is more efficient
- */
- u_UCharsToChars(myPath, path, length+1); /* length+1 to include the NUL */
- } else {
-#if !UCONFIG_NO_CONVERSION
- /* use the default converter to support variant-character paths */
- UConverter *cnv=u_getDefaultConverter(status);
- length=ucnv_fromUChars(cnv, path, (int32_t)sizeof(pathBuffer), myPath, length, status);
- u_releaseDefaultConverter(cnv);
- if(U_FAILURE(*status)) {
- return NULL;
- }
- if(length>=(int32_t)sizeof(pathBuffer)) {
- /* not NUL-terminated - path too long */
- *status=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
- }
-#else
- /* the default converter is not available */
- *status=U_UNSUPPORTED_ERROR;
- return NULL;
-#endif
- }
- }
-
- return ures_open(path, localeID, status);
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+* Copyright (C) 1997-2006, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: ures_cnv.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2004aug25
+* created by: Markus W. Scherer
+*
+* Character conversion functions moved here from uresbund.c
+*/
+
+#include "unicode/utypes.h"
+#include "unicode/putil.h"
+#include "unicode/ustring.h"
+#include "unicode/ucnv.h"
+#include "unicode/ures.h"
+#include "uinvchar.h"
+#include "ustr_cnv.h"
+
+U_CAPI UResourceBundle * U_EXPORT2
+ures_openU(const UChar *myPath,
+ const char *localeID,
+ UErrorCode *status)
+{
+ char pathBuffer[1024];
+ int32_t length;
+ char *path = pathBuffer;
+
+ if(status==NULL || U_FAILURE(*status)) {
+ return NULL;
+ }
+ if(myPath==NULL) {
+ path = NULL;
+ }
+ else {
+ length=u_strlen(myPath);
+ if(length>=(int32_t)sizeof(pathBuffer)) {
+ *status=U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
+ } else if(uprv_isInvariantUString(myPath, length)) {
+ /*
+ * the invariant converter is sufficient for package and tree names
+ * and is more efficient
+ */
+ u_UCharsToChars(myPath, path, length+1); /* length+1 to include the NUL */
+ } else {
+#if !UCONFIG_NO_CONVERSION
+ /* use the default converter to support variant-character paths */
+ UConverter *cnv=u_getDefaultConverter(status);
+ length=ucnv_fromUChars(cnv, path, (int32_t)sizeof(pathBuffer), myPath, length, status);
+ u_releaseDefaultConverter(cnv);
+ if(U_FAILURE(*status)) {
+ return NULL;
+ }
+ if(length>=(int32_t)sizeof(pathBuffer)) {
+ /* not NUL-terminated - path too long */
+ *status=U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
+ }
+#else
+ /* the default converter is not available */
+ *status=U_UNSUPPORTED_ERROR;
+ return NULL;
+#endif
+ }
+ }
+
+ return ures_open(path, localeID, status);
+}
diff --git a/contrib/libs/icu/common/uresbund.cpp b/contrib/libs/icu/common/uresbund.cpp
index 87ef6e8853..97df4a85eb 100644
--- a/contrib/libs/icu/common/uresbund.cpp
+++ b/contrib/libs/icu/common/uresbund.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -21,7 +21,7 @@
******************************************************************************
*/
-#include "unicode/ures.h"
+#include "unicode/ures.h"
#include "unicode/ustring.h"
#include "unicode/ucnv.h"
#include "charstr.h"
@@ -31,7 +31,7 @@
#include "ucln_cmn.h"
#include "cmemory.h"
#include "cstring.h"
-#include "mutex.h"
+#include "mutex.h"
#include "uhash.h"
#include "unicode/uenum.h"
#include "uenumimp.h"
@@ -39,7 +39,7 @@
#include "umutex.h"
#include "putilimp.h"
#include "uassert.h"
-#include "uresdata.h"
+#include "uresdata.h"
using namespace icu;
@@ -49,9 +49,9 @@ TODO: This cache should probably be removed when the deprecated code is
completely removed.
*/
static UHashtable *cache = NULL;
-static icu::UInitOnce gCacheInitOnce = U_INITONCE_INITIALIZER;
+static icu::UInitOnce gCacheInitOnce = U_INITONCE_INITIALIZER;
-static UMutex resbMutex;
+static UMutex resbMutex;
/* INTERNAL: hashes an entry */
static int32_t U_CALLCONV hashEntry(const UHashTok parm) {
@@ -95,7 +95,7 @@ static UBool chopLocale(char *name) {
* Internal function
*/
static void entryIncrease(UResourceDataEntry *entry) {
- Mutex lock(&resbMutex);
+ Mutex lock(&resbMutex);
entry->fCountExisting++;
while(entry->fParent != NULL) {
entry = entry->fParent;
@@ -182,7 +182,7 @@ static int32_t ures_flushCache()
/*if shared data hasn't even been lazy evaluated yet
* return 0
*/
- Mutex lock(&resbMutex);
+ Mutex lock(&resbMutex);
if (cache == NULL) {
return 0;
}
@@ -228,7 +228,7 @@ U_CAPI UBool U_EXPORT2 ures_dumpCacheContents(void) {
const UHashElement *e;
UResourceDataEntry *resB;
- Mutex lock(&resbMutex);
+ Mutex lock(&resbMutex);
if (cache == NULL) {
fprintf(stderr,"%s:%d: RB Cache is NULL.\n", __FILE__, __LINE__);
return FALSE;
@@ -363,12 +363,12 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE
/* this is the actual loading */
res_load(&(r->fData), r->fPath, r->fName, status);
- if (U_FAILURE(*status)) {
- /* if we failed to load due to an out-of-memory error, exit early. */
- if (*status == U_MEMORY_ALLOCATION_ERROR) {
- uprv_free(r);
- return NULL;
- }
+ if (U_FAILURE(*status)) {
+ /* if we failed to load due to an out-of-memory error, exit early. */
+ if (*status == U_MEMORY_ALLOCATION_ERROR) {
+ uprv_free(r);
+ return NULL;
+ }
/* we have no such entry in dll, so it will always use fallback */
*status = U_USING_FALLBACK_WARNING;
r->fBogus = U_USING_FALLBACK_WARNING;
@@ -393,8 +393,8 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE
/* We'll try to get alias string from the bundle */
aliasres = res_getResource(&(r->fData), "%%ALIAS");
if (aliasres != RES_BOGUS) {
- // No tracing: called during initial data loading
- const UChar *alias = res_getStringNoTrace(&(r->fData), aliasres, &aliasLen);
+ // No tracing: called during initial data loading
+ const UChar *alias = res_getStringNoTrace(&(r->fData), aliasres, &aliasLen);
if(alias != NULL && aliasLen > 0) { /* if there is actual alias - unload and load new data */
u_UCharsToChars(alias, aliasName, aliasLen+1);
r->fAlias = init_entry(aliasName, path, status);
@@ -485,9 +485,9 @@ findFirstExisting(const char* path, char* name,
/*Fallback data stuff*/
*hasChopped = chopLocale(name);
- if (*hasChopped && *name == '\0') {
- uprv_strcpy(name, "und");
- }
+ if (*hasChopped && *name == '\0') {
+ uprv_strcpy(name, "und");
+ }
}
return r;
}
@@ -512,18 +512,18 @@ U_CFUNC void ures_initStackObject(UResourceBundle* resB) {
ures_setIsStackObject(resB, TRUE);
}
-U_NAMESPACE_BEGIN
-
-StackUResourceBundle::StackUResourceBundle() {
- ures_initStackObject(&bundle);
-}
-
-StackUResourceBundle::~StackUResourceBundle() {
- ures_close(&bundle);
-}
-
-U_NAMESPACE_END
-
+U_NAMESPACE_BEGIN
+
+StackUResourceBundle::StackUResourceBundle() {
+ ures_initStackObject(&bundle);
+}
+
+StackUResourceBundle::~StackUResourceBundle() {
+ ures_close(&bundle);
+}
+
+U_NAMESPACE_END
+
static UBool // returns U_SUCCESS(*status)
loadParentsExceptRoot(UResourceDataEntry *&t1,
char name[], int32_t nameCapacity,
@@ -535,8 +535,8 @@ loadParentsExceptRoot(UResourceDataEntry *&t1,
Resource parentRes = res_getResource(&t1->fData, "%%Parent");
if (parentRes != RES_BOGUS) { // An explicit parent was found.
int32_t parentLocaleLen = 0;
- // No tracing: called during initial data loading
- const UChar *parentLocaleName = res_getStringNoTrace(&(t1->fData), parentRes, &parentLocaleLen);
+ // No tracing: called during initial data loading
+ const UChar *parentLocaleName = res_getStringNoTrace(&(t1->fData), parentRes, &parentLocaleLen);
if(parentLocaleName != NULL && 0 < parentLocaleLen && parentLocaleLen < nameCapacity) {
u_UCharsToChars(parentLocaleName, name, parentLocaleLen + 1);
if (uprv_strcmp(name, kRootLocaleName) == 0) {
@@ -555,11 +555,11 @@ loadParentsExceptRoot(UResourceDataEntry *&t1,
UErrorCode usrStatus = U_ZERO_ERROR;
if (usingUSRData) { // This code inserts user override data into the inheritance chain.
u2 = init_entry(name, usrDataPath, &usrStatus);
- // If we failed due to out-of-memory, report that to the caller and exit early.
- if (usrStatus == U_MEMORY_ALLOCATION_ERROR) {
- *status = usrStatus;
- return FALSE;
- }
+ // If we failed due to out-of-memory, report that to the caller and exit early.
+ if (usrStatus == U_MEMORY_ALLOCATION_ERROR) {
+ *status = usrStatus;
+ return FALSE;
+ }
}
if (usingUSRData && U_SUCCESS(usrStatus) && u2->fBogus == U_ZERO_ERROR) {
@@ -660,105 +660,105 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID,
}
}
- Mutex lock(&resbMutex); // Lock resbMutex until the end of this function.
-
- /* We're going to skip all the locales that do not have any data */
- r = findFirstExisting(path, name, &isRoot, &hasChopped, &isDefault, &intStatus);
-
- // If we failed due to out-of-memory, report the failure and exit early.
- if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
- *status = intStatus;
- goto finish;
- }
-
- if(r != NULL) { /* if there is one real locale, we can look for parents. */
- t1 = r;
- hasRealData = TRUE;
- if ( usingUSRData ) { /* This code inserts user override data into the inheritance chain */
- UErrorCode usrStatus = U_ZERO_ERROR;
- UResourceDataEntry *u1 = init_entry(t1->fName, usrDataPath, &usrStatus);
- // If we failed due to out-of-memory, report the failure and exit early.
- if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
- *status = intStatus;
- goto finish;
- }
- if ( u1 != NULL ) {
- if(u1->fBogus == U_ZERO_ERROR) {
- u1->fParent = t1;
- r = u1;
- } else {
- /* the USR override data wasn't found, set it to be deleted */
- u1->fCountExisting = 0;
- }
- }
- }
- if (hasChopped && !isRoot) {
- if (!loadParentsExceptRoot(t1, name, UPRV_LENGTHOF(name), usingUSRData, usrDataPath, status)) {
- goto finish;
- }
- }
- }
-
- /* we could have reached this point without having any real data */
- /* if that is the case, we need to chain in the default locale */
- if(r==NULL && openType == URES_OPEN_LOCALE_DEFAULT_ROOT && !isDefault && !isRoot) {
- /* insert default locale */
- uprv_strcpy(name, uloc_getDefault());
+ Mutex lock(&resbMutex); // Lock resbMutex until the end of this function.
+
+ /* We're going to skip all the locales that do not have any data */
+ r = findFirstExisting(path, name, &isRoot, &hasChopped, &isDefault, &intStatus);
+
+ // If we failed due to out-of-memory, report the failure and exit early.
+ if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
+ *status = intStatus;
+ goto finish;
+ }
+
+ if(r != NULL) { /* if there is one real locale, we can look for parents. */
+ t1 = r;
+ hasRealData = TRUE;
+ if ( usingUSRData ) { /* This code inserts user override data into the inheritance chain */
+ UErrorCode usrStatus = U_ZERO_ERROR;
+ UResourceDataEntry *u1 = init_entry(t1->fName, usrDataPath, &usrStatus);
+ // If we failed due to out-of-memory, report the failure and exit early.
+ if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
+ *status = intStatus;
+ goto finish;
+ }
+ if ( u1 != NULL ) {
+ if(u1->fBogus == U_ZERO_ERROR) {
+ u1->fParent = t1;
+ r = u1;
+ } else {
+ /* the USR override data wasn't found, set it to be deleted */
+ u1->fCountExisting = 0;
+ }
+ }
+ }
+ if (hasChopped && !isRoot) {
+ if (!loadParentsExceptRoot(t1, name, UPRV_LENGTHOF(name), usingUSRData, usrDataPath, status)) {
+ goto finish;
+ }
+ }
+ }
+
+ /* we could have reached this point without having any real data */
+ /* if that is the case, we need to chain in the default locale */
+ if(r==NULL && openType == URES_OPEN_LOCALE_DEFAULT_ROOT && !isDefault && !isRoot) {
+ /* insert default locale */
+ uprv_strcpy(name, uloc_getDefault());
r = findFirstExisting(path, name, &isRoot, &hasChopped, &isDefault, &intStatus);
- // If we failed due to out-of-memory, report the failure and exit early.
- if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
- *status = intStatus;
- goto finish;
- }
- intStatus = U_USING_DEFAULT_WARNING;
- if(r != NULL) { /* the default locale exists */
+ // If we failed due to out-of-memory, report the failure and exit early.
+ if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
+ *status = intStatus;
+ goto finish;
+ }
+ intStatus = U_USING_DEFAULT_WARNING;
+ if(r != NULL) { /* the default locale exists */
t1 = r;
hasRealData = TRUE;
- isDefault = TRUE;
- // TODO: Why not if (usingUSRData) { ... } like in the non-default-locale code path?
+ isDefault = TRUE;
+ // TODO: Why not if (usingUSRData) { ... } like in the non-default-locale code path?
if (hasChopped && !isRoot) {
if (!loadParentsExceptRoot(t1, name, UPRV_LENGTHOF(name), usingUSRData, usrDataPath, status)) {
- goto finish;
+ goto finish;
}
}
}
- }
+ }
- /* we could still have r == NULL at this point - maybe even default locale is not */
- /* present */
- if(r == NULL) {
- uprv_strcpy(name, kRootLocaleName);
- r = findFirstExisting(path, name, &isRoot, &hasChopped, &isDefault, &intStatus);
- // If we failed due to out-of-memory, report the failure and exit early.
- if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
- *status = intStatus;
- goto finish;
- }
- if(r != NULL) {
- t1 = r;
+ /* we could still have r == NULL at this point - maybe even default locale is not */
+ /* present */
+ if(r == NULL) {
+ uprv_strcpy(name, kRootLocaleName);
+ r = findFirstExisting(path, name, &isRoot, &hasChopped, &isDefault, &intStatus);
+ // If we failed due to out-of-memory, report the failure and exit early.
+ if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
+ *status = intStatus;
+ goto finish;
+ }
+ if(r != NULL) {
+ t1 = r;
intStatus = U_USING_DEFAULT_WARNING;
- hasRealData = TRUE;
- } else { /* we don't even have the root locale */
- *status = U_MISSING_RESOURCE_ERROR;
- goto finish;
+ hasRealData = TRUE;
+ } else { /* we don't even have the root locale */
+ *status = U_MISSING_RESOURCE_ERROR;
+ goto finish;
}
- } else if(!isRoot && uprv_strcmp(t1->fName, kRootLocaleName) != 0 &&
- t1->fParent == NULL && !r->fData.noFallback) {
- if (!insertRootBundle(t1, status)) {
- goto finish;
+ } else if(!isRoot && uprv_strcmp(t1->fName, kRootLocaleName) != 0 &&
+ t1->fParent == NULL && !r->fData.noFallback) {
+ if (!insertRootBundle(t1, status)) {
+ goto finish;
}
- if(!hasRealData) {
- r->fBogus = U_USING_DEFAULT_WARNING;
+ if(!hasRealData) {
+ r->fBogus = U_USING_DEFAULT_WARNING;
}
- }
+ }
- // TODO: Does this ever loop?
- while(r != NULL && !isRoot && t1->fParent != NULL) {
- t1->fParent->fCountExisting++;
- t1 = t1->fParent;
- }
-
-finish:
+ // TODO: Does this ever loop?
+ while(r != NULL && !isRoot && t1->fParent != NULL) {
+ t1->fParent->fCountExisting++;
+ t1 = t1->fParent;
+ }
+
+finish:
if(U_SUCCESS(*status)) {
if(intStatus != U_ZERO_ERROR) {
*status = intStatus;
@@ -782,7 +782,7 @@ entryOpenDirect(const char* path, const char* localeID, UErrorCode* status) {
return NULL;
}
- Mutex lock(&resbMutex);
+ Mutex lock(&resbMutex);
// findFirstExisting() without fallbacks.
UResourceDataEntry *r = init_entry(localeID, path, status);
if(U_SUCCESS(*status)) {
@@ -862,7 +862,7 @@ static void entryCloseInt(UResourceDataEntry *resB) {
*/
static void entryClose(UResourceDataEntry *resB) {
- Mutex lock(&resbMutex);
+ Mutex lock(&resbMutex);
entryCloseInt(resB);
}
@@ -1119,11 +1119,11 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
UResourceDataEntry *dataEntry = mainRes->fData;
char stackPath[URES_MAX_BUFFER_SIZE];
char *pathBuf = stackPath, *myPath = pathBuf;
- if(uprv_strlen(keyPath) >= UPRV_LENGTHOF(stackPath)) {
+ if(uprv_strlen(keyPath) >= UPRV_LENGTHOF(stackPath)) {
pathBuf = (char *)uprv_malloc((uprv_strlen(keyPath)+1)*sizeof(char));
if(pathBuf == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
- ures_close(mainRes);
+ ures_close(mainRes);
return NULL;
}
}
@@ -1167,7 +1167,7 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
if(mainRes != result) {
ures_close(mainRes);
}
- ResourceTracer(resB).maybeTrace("getalias");
+ ResourceTracer(resB).maybeTrace("getalias");
return result;
}
} else {
@@ -1247,7 +1247,7 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
/*resB->fParent = parent->fRes;*/
uprv_memmove(&resB->fResData, rdata, sizeof(ResourceData));
resB->fSize = res_countArrayItems(&(resB->fResData), resB->fRes);
- ResourceTracer(resB).trace("get");
+ ResourceTracer(resB).trace("get");
return resB;
}
@@ -1296,7 +1296,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getString(const UResourceBundle* resB, int32_
*status = U_ILLEGAL_ARGUMENT_ERROR;
return NULL;
}
- s = res_getString({resB}, &(resB->fResData), resB->fRes, len);
+ s = res_getString({resB}, &(resB->fResData), resB->fRes, len);
if (s == NULL) {
*status = U_RESOURCE_TYPE_MISMATCH;
}
@@ -1385,7 +1385,7 @@ U_CAPI const uint8_t* U_EXPORT2 ures_getBinary(const UResourceBundle* resB, int3
*status = U_ILLEGAL_ARGUMENT_ERROR;
return NULL;
}
- p = res_getBinary({resB}, &(resB->fResData), resB->fRes, len);
+ p = res_getBinary({resB}, &(resB->fResData), resB->fRes, len);
if (p == NULL) {
*status = U_RESOURCE_TYPE_MISMATCH;
}
@@ -1402,7 +1402,7 @@ U_CAPI const int32_t* U_EXPORT2 ures_getIntVector(const UResourceBundle* resB, i
*status = U_ILLEGAL_ARGUMENT_ERROR;
return NULL;
}
- p = res_getIntVector({resB}, &(resB->fResData), resB->fRes, len);
+ p = res_getIntVector({resB}, &(resB->fResData), resB->fRes, len);
if (p == NULL) {
*status = U_RESOURCE_TYPE_MISMATCH;
}
@@ -1423,7 +1423,7 @@ U_CAPI int32_t U_EXPORT2 ures_getInt(const UResourceBundle* resB, UErrorCode *st
*status = U_RESOURCE_TYPE_MISMATCH;
return 0xffffffff;
}
- return res_getInt({resB}, resB->fRes);
+ return res_getInt({resB}, resB->fRes);
}
U_CAPI uint32_t U_EXPORT2 ures_getUInt(const UResourceBundle* resB, UErrorCode *status) {
@@ -1438,7 +1438,7 @@ U_CAPI uint32_t U_EXPORT2 ures_getUInt(const UResourceBundle* resB, UErrorCode *
*status = U_RESOURCE_TYPE_MISMATCH;
return 0xffffffff;
}
- return res_getUInt({resB}, resB->fRes);
+ return res_getUInt({resB}, resB->fRes);
}
U_CAPI UResType U_EXPORT2 ures_getType(const UResourceBundle *resB) {
@@ -1449,15 +1449,15 @@ U_CAPI UResType U_EXPORT2 ures_getType(const UResourceBundle *resB) {
}
U_CAPI const char * U_EXPORT2 ures_getKey(const UResourceBundle *resB) {
- //
- // TODO: Trace ures_getKey? I guess not usually.
- //
- // We usually get the key string to decide whether we want the value, or to
- // make a key-value pair. Tracing the value should suffice.
- //
- // However, I believe we have some data (e.g., in res_index) where the key
- // strings are the data. Tracing the enclosing table should suffice.
- //
+ //
+ // TODO: Trace ures_getKey? I guess not usually.
+ //
+ // We usually get the key string to decide whether we want the value, or to
+ // make a key-value pair. Tracing the value should suffice.
+ //
+ // However, I believe we have some data (e.g., in res_index) where the key
+ // strings are the data. Tracing the enclosing table should suffice.
+ //
if(resB == NULL) {
return NULL;
}
@@ -1480,7 +1480,7 @@ static const UChar* ures_getStringWithAlias(const UResourceBundle *resB, Resourc
ures_close(tempRes);
return result;
} else {
- return res_getString({resB, sIndex}, &(resB->fResData), r, len);
+ return res_getString({resB, sIndex}, &(resB->fResData), r, len);
}
}
@@ -1516,7 +1516,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resB, int32_t*
switch(RES_GET_TYPE(resB->fRes)) {
case URES_STRING:
case URES_STRING_V2:
- return res_getString({resB}, &(resB->fResData), resB->fRes, len);
+ return res_getString({resB}, &(resB->fResData), resB->fRes, len);
case URES_TABLE:
case URES_TABLE16:
case URES_TABLE32:
@@ -1661,7 +1661,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByIndex(const UResourceBundle *resB,
switch(RES_GET_TYPE(resB->fRes)) {
case URES_STRING:
case URES_STRING_V2:
- return res_getString({resB}, &(resB->fResData), resB->fRes, len);
+ return res_getString({resB}, &(resB->fResData), resB->fRes, len);
case URES_TABLE:
case URES_TABLE16:
case URES_TABLE32:
@@ -1953,10 +1953,10 @@ void getAllItemsWithFallback(
// When the sink sees the no-fallback/no-inheritance marker,
// then it would remove the parent's item.
// We would deserialize parent values even though they are overridden in a child bundle.
- value.setData(&bundle->fResData);
+ value.setData(&bundle->fResData);
UResourceDataEntry *parentEntry = bundle->fData->fParent;
UBool hasParent = parentEntry != NULL && U_SUCCESS(parentEntry->fBogus);
- value.setResource(bundle->fRes, ResourceTracer(bundle));
+ value.setResource(bundle->fRes, ResourceTracer(bundle));
sink.put(bundle->fKey, value, !hasParent, errorCode);
if (hasParent) {
// We might try to query the sink whether
@@ -2001,53 +2001,53 @@ void getAllItemsWithFallback(
} // namespace
-// Requires a ResourceDataValue fill-in, so that we need not cast from a ResourceValue.
-// Unfortunately, the caller must know which subclass to make and pass in.
-// Alternatively, we could make it as polymorphic as in Java by
-// returning a ResourceValue pointer (possibly wrapped into a LocalPointer)
-// that the caller then owns.
-//
-// Also requires a UResourceBundle fill-in, so that the value's ResourceTracer
-// can point to a non-local bundle.
-// Without tracing, the child bundle could be a function-local object.
+// Requires a ResourceDataValue fill-in, so that we need not cast from a ResourceValue.
+// Unfortunately, the caller must know which subclass to make and pass in.
+// Alternatively, we could make it as polymorphic as in Java by
+// returning a ResourceValue pointer (possibly wrapped into a LocalPointer)
+// that the caller then owns.
+//
+// Also requires a UResourceBundle fill-in, so that the value's ResourceTracer
+// can point to a non-local bundle.
+// Without tracing, the child bundle could be a function-local object.
+U_CAPI void U_EXPORT2
+ures_getValueWithFallback(const UResourceBundle *bundle, const char *path,
+ UResourceBundle *tempFillIn,
+ ResourceDataValue &value, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return; }
+ if (path == nullptr) {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ const UResourceBundle *rb;
+ if (*path == 0) {
+ // empty path
+ rb = bundle;
+ } else {
+ rb = ures_getByKeyWithFallback(bundle, path, tempFillIn, &errorCode);
+ if (U_FAILURE(errorCode)) {
+ return;
+ }
+ }
+ value.setData(&rb->fResData);
+ value.setResource(rb->fRes, ResourceTracer(rb));
+}
+
U_CAPI void U_EXPORT2
-ures_getValueWithFallback(const UResourceBundle *bundle, const char *path,
- UResourceBundle *tempFillIn,
- ResourceDataValue &value, UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) { return; }
- if (path == nullptr) {
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- const UResourceBundle *rb;
- if (*path == 0) {
- // empty path
- rb = bundle;
- } else {
- rb = ures_getByKeyWithFallback(bundle, path, tempFillIn, &errorCode);
- if (U_FAILURE(errorCode)) {
- return;
- }
- }
- value.setData(&rb->fResData);
- value.setResource(rb->fRes, ResourceTracer(rb));
-}
-
-U_CAPI void U_EXPORT2
ures_getAllItemsWithFallback(const UResourceBundle *bundle, const char *path,
icu::ResourceSink &sink, UErrorCode &errorCode) {
if (U_FAILURE(errorCode)) { return; }
- if (path == nullptr) {
+ if (path == nullptr) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
- StackUResourceBundle stackBundle;
+ StackUResourceBundle stackBundle;
const UResourceBundle *rb;
if (*path == 0) {
// empty path
rb = bundle;
} else {
- rb = ures_getByKeyWithFallback(bundle, path, stackBundle.getAlias(), &errorCode);
+ rb = ures_getByKeyWithFallback(bundle, path, stackBundle.getAlias(), &errorCode);
if (U_FAILURE(errorCode)) {
return;
}
@@ -2137,7 +2137,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
switch (RES_GET_TYPE(res)) {
case URES_STRING:
case URES_STRING_V2:
- return res_getString({resB, key}, rd, res, len);
+ return res_getString({resB, key}, rd, res, len);
case URES_ALIAS:
{
const UChar* result = 0;
@@ -2159,7 +2159,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
switch (RES_GET_TYPE(res)) {
case URES_STRING:
case URES_STRING_V2:
- return res_getString({resB, key}, &(resB->fResData), res, len);
+ return res_getString({resB, key}, &(resB->fResData), res, len);
case URES_ALIAS:
{
const UChar* result = 0;
@@ -2180,7 +2180,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
/* here should go a first attempt to locate the key using index table */
const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
if(U_SUCCESS(*status)) {
- // TODO: Tracing
+ // TODO: Tracing
return res_getString(rd, res, len);
} else {
*status = U_MISSING_RESOURCE_ERROR;
@@ -2326,8 +2326,8 @@ ures_openWithType(UResourceBundle *r, const char* path, const char* localeID,
r->fSize = res_countArrayItems(&(r->fResData), r->fRes);
r->fIndex = -1;
- ResourceTracer(r).traceOpen();
-
+ ResourceTracer(r).traceOpen();
+
return r;
}
@@ -2351,13 +2351,13 @@ ures_openDirect(const char* path, const char* localeID, UErrorCode* status) {
}
/**
- * Internal API: This function is used to open a resource bundle
+ * Internal API: This function is used to open a resource bundle
* proper fallback chaining is executed while initialization.
* The result is stored in cache for later fallback search.
- *
- * Same as ures_open(), but uses the fill-in parameter and does not allocate a new bundle.
+ *
+ * Same as ures_open(), but uses the fill-in parameter and does not allocate a new bundle.
*/
-U_INTERNAL void U_EXPORT2
+U_INTERNAL void U_EXPORT2
ures_openFillIn(UResourceBundle *r, const char* path,
const char* localeID, UErrorCode* status) {
if(U_SUCCESS(*status) && r == NULL) {
@@ -2368,18 +2368,18 @@ ures_openFillIn(UResourceBundle *r, const char* path,
}
/**
- * Same as ures_openDirect(), but uses the fill-in parameter and does not allocate a new bundle.
- */
-U_INTERNAL void U_EXPORT2
-ures_openDirectFillIn(UResourceBundle *r, const char* path, const char* localeID, UErrorCode* status) {
- if(U_SUCCESS(*status) && r == NULL) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- ures_openWithType(r, path, localeID, URES_OPEN_DIRECT, status);
-}
-
-/**
+ * Same as ures_openDirect(), but uses the fill-in parameter and does not allocate a new bundle.
+ */
+U_INTERNAL void U_EXPORT2
+ures_openDirectFillIn(UResourceBundle *r, const char* path, const char* localeID, UErrorCode* status) {
+ if(U_SUCCESS(*status) && r == NULL) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ ures_openWithType(r, path, localeID, URES_OPEN_DIRECT, status);
+}
+
+/**
* API: Counts members. For arrays and tables, returns number of resources.
* For strings, returns 1.
*/
@@ -2517,7 +2517,7 @@ ures_loc_nextLocale(UEnumeration* en,
UResourceBundle *k = NULL;
const char *result = NULL;
int32_t len = 0;
- if(ures_hasNext(res) && (k = ures_getNextResource(res, &ctx->curr, status)) != 0) {
+ if(ures_hasNext(res) && (k = ures_getNextResource(res, &ctx->curr, status)) != 0) {
result = ures_getKey(k);
len = (int32_t)uprv_strlen(result);
}
@@ -2611,8 +2611,8 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
char defVal[1024] = ""; /* default value for given locale */
char defLoc[1024] = ""; /* default value for given locale */
char base[1024] = ""; /* base locale */
- char found[1024] = "";
- char parent[1024] = "";
+ char found[1024] = "";
+ char parent[1024] = "";
char full[1024] = "";
UResourceBundle bund1, bund2;
UResourceBundle *res = NULL;
@@ -2939,7 +2939,7 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
valuesBuf[0]=0;
valuesBuf[1]=0;
- while((locale = uenum_next(locs, &locLen, status)) != 0) {
+ while((locale = uenum_next(locs, &locLen, status)) != 0) {
UResourceBundle *bund = NULL;
UResourceBundle *subPtr = NULL;
UErrorCode subStatus = U_ZERO_ERROR; /* don't fail if a bundle is unopenable */
@@ -2964,7 +2964,7 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
continue;
}
- while((subPtr = ures_getNextResource(&item,&subItem,&subStatus)) != 0
+ while((subPtr = ures_getNextResource(&item,&subItem,&subStatus)) != 0
&& U_SUCCESS(subStatus)) {
const char *k;
int32_t i;
diff --git a/contrib/libs/icu/common/uresdata.cpp b/contrib/libs/icu/common/uresdata.cpp
index b65ea1ff69..b3c2e2e27c 100644
--- a/contrib/libs/icu/common/uresdata.cpp
+++ b/contrib/libs/icu/common/uresdata.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* and others. All Rights Reserved.
*******************************************************************************
* file name: uresdata.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -33,7 +33,7 @@
#include "uinvchar.h"
#include "uresdata.h"
#include "uresimp.h"
-#include "utracimp.h"
+#include "utracimp.h"
/*
* Resource access helpers
@@ -308,7 +308,7 @@ res_getPublicType(Resource res) {
}
U_CAPI const UChar * U_EXPORT2
-res_getStringNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength) {
+res_getStringNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength) {
const UChar *p;
uint32_t offset=RES_GET_OFFSET(res);
int32_t length;
@@ -403,8 +403,8 @@ int32_t getStringArray(const ResourceData *pResData, const icu::ResourceArray &a
}
for(int32_t i = 0; i < length; ++i) {
int32_t sLength;
- // No tracing: handled by the caller
- const UChar *s = res_getStringNoTrace(pResData, array.internalGetResource(pResData, i), &sLength);
+ // No tracing: handled by the caller
+ const UChar *s = res_getStringNoTrace(pResData, array.internalGetResource(pResData, i), &sLength);
if(s == NULL) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
return 0;
@@ -436,7 +436,7 @@ res_getAlias(const ResourceData *pResData, Resource res, int32_t *pLength) {
}
U_CAPI const uint8_t * U_EXPORT2
-res_getBinaryNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength) {
+res_getBinaryNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength) {
const uint8_t *p;
uint32_t offset=RES_GET_OFFSET(res);
int32_t length;
@@ -456,7 +456,7 @@ res_getBinaryNoTrace(const ResourceData *pResData, Resource res, int32_t *pLengt
U_CAPI const int32_t * U_EXPORT2
-res_getIntVectorNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength) {
+res_getIntVectorNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength) {
const int32_t *p;
uint32_t offset=RES_GET_OFFSET(res);
int32_t length;
@@ -509,7 +509,7 @@ const UChar *ResourceDataValue::getString(int32_t &length, UErrorCode &errorCode
if(U_FAILURE(errorCode)) {
return NULL;
}
- const UChar *s = res_getString(fTraceInfo, &getData(), res, &length);
+ const UChar *s = res_getString(fTraceInfo, &getData(), res, &length);
if(s == NULL) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
}
@@ -520,7 +520,7 @@ const UChar *ResourceDataValue::getAliasString(int32_t &length, UErrorCode &erro
if(U_FAILURE(errorCode)) {
return NULL;
}
- const UChar *s = res_getAlias(&getData(), res, &length);
+ const UChar *s = res_getAlias(&getData(), res, &length);
if(s == NULL) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
}
@@ -534,7 +534,7 @@ int32_t ResourceDataValue::getInt(UErrorCode &errorCode) const {
if(RES_GET_TYPE(res) != URES_INT) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
}
- return res_getInt(fTraceInfo, res);
+ return res_getInt(fTraceInfo, res);
}
uint32_t ResourceDataValue::getUInt(UErrorCode &errorCode) const {
@@ -544,14 +544,14 @@ uint32_t ResourceDataValue::getUInt(UErrorCode &errorCode) const {
if(RES_GET_TYPE(res) != URES_INT) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
}
- return res_getUInt(fTraceInfo, res);
+ return res_getUInt(fTraceInfo, res);
}
const int32_t *ResourceDataValue::getIntVector(int32_t &length, UErrorCode &errorCode) const {
if(U_FAILURE(errorCode)) {
return NULL;
}
- const int32_t *iv = res_getIntVector(fTraceInfo, &getData(), res, &length);
+ const int32_t *iv = res_getIntVector(fTraceInfo, &getData(), res, &length);
if(iv == NULL) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
}
@@ -562,7 +562,7 @@ const uint8_t *ResourceDataValue::getBinary(int32_t &length, UErrorCode &errorCo
if(U_FAILURE(errorCode)) {
return NULL;
}
- const uint8_t *b = res_getBinary(fTraceInfo, &getData(), res, &length);
+ const uint8_t *b = res_getBinary(fTraceInfo, &getData(), res, &length);
if(b == NULL) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
}
@@ -580,19 +580,19 @@ ResourceArray ResourceDataValue::getArray(UErrorCode &errorCode) const {
switch(RES_GET_TYPE(res)) {
case URES_ARRAY:
if (offset!=0) { // empty if offset==0
- items32 = (const Resource *)getData().pRoot+offset;
+ items32 = (const Resource *)getData().pRoot+offset;
length = *items32++;
}
break;
case URES_ARRAY16:
- items16 = getData().p16BitUnits+offset;
+ items16 = getData().p16BitUnits+offset;
length = *items16++;
break;
default:
errorCode = U_RESOURCE_TYPE_MISMATCH;
return ResourceArray();
}
- return ResourceArray(items16, items32, length, fTraceInfo);
+ return ResourceArray(items16, items32, length, fTraceInfo);
}
ResourceTable ResourceDataValue::getTable(UErrorCode &errorCode) const {
@@ -608,19 +608,19 @@ ResourceTable ResourceDataValue::getTable(UErrorCode &errorCode) const {
switch(RES_GET_TYPE(res)) {
case URES_TABLE:
if (offset != 0) { // empty if offset==0
- keys16 = (const uint16_t *)(getData().pRoot+offset);
+ keys16 = (const uint16_t *)(getData().pRoot+offset);
length = *keys16++;
items32 = (const Resource *)(keys16+length+(~length&1));
}
break;
case URES_TABLE16:
- keys16 = getData().p16BitUnits+offset;
+ keys16 = getData().p16BitUnits+offset;
length = *keys16++;
items16 = keys16 + length;
break;
case URES_TABLE32:
if (offset != 0) { // empty if offset==0
- keys32 = getData().pRoot+offset;
+ keys32 = getData().pRoot+offset;
length = *keys32++;
items32 = (const Resource *)keys32 + length;
}
@@ -629,22 +629,22 @@ ResourceTable ResourceDataValue::getTable(UErrorCode &errorCode) const {
errorCode = U_RESOURCE_TYPE_MISMATCH;
return ResourceTable();
}
- return ResourceTable(keys16, keys32, items16, items32, length, fTraceInfo);
+ return ResourceTable(keys16, keys32, items16, items32, length, fTraceInfo);
}
UBool ResourceDataValue::isNoInheritanceMarker() const {
- return ::isNoInheritanceMarker(&getData(), res);
+ return ::isNoInheritanceMarker(&getData(), res);
}
int32_t ResourceDataValue::getStringArray(UnicodeString *dest, int32_t capacity,
UErrorCode &errorCode) const {
- return ::getStringArray(&getData(), getArray(errorCode), dest, capacity, errorCode);
+ return ::getStringArray(&getData(), getArray(errorCode), dest, capacity, errorCode);
}
int32_t ResourceDataValue::getStringArrayOrStringAsArray(UnicodeString *dest, int32_t capacity,
UErrorCode &errorCode) const {
if(URES_IS_ARRAY(res)) {
- return ::getStringArray(&getData(), getArray(errorCode), dest, capacity, errorCode);
+ return ::getStringArray(&getData(), getArray(errorCode), dest, capacity, errorCode);
}
if(U_FAILURE(errorCode)) {
return 0;
@@ -658,7 +658,7 @@ int32_t ResourceDataValue::getStringArrayOrStringAsArray(UnicodeString *dest, in
return 1;
}
int32_t sLength;
- const UChar *s = res_getString(fTraceInfo, &getData(), res, &sLength);
+ const UChar *s = res_getString(fTraceInfo, &getData(), res, &sLength);
if(s != NULL) {
dest[0].setTo(TRUE, s, sLength);
return 1;
@@ -673,7 +673,7 @@ UnicodeString ResourceDataValue::getStringOrFirstOfArray(UErrorCode &errorCode)
return us;
}
int32_t sLength;
- const UChar *s = res_getString(fTraceInfo, &getData(), res, &sLength);
+ const UChar *s = res_getString(fTraceInfo, &getData(), res, &sLength);
if(s != NULL) {
us.setTo(TRUE, s, sLength);
return us;
@@ -683,8 +683,8 @@ UnicodeString ResourceDataValue::getStringOrFirstOfArray(UErrorCode &errorCode)
return us;
}
if(array.getSize() > 0) {
- // Tracing is already performed above (unimportant for trace that this is an array)
- s = res_getStringNoTrace(&getData(), array.internalGetResource(&getData(), 0), &sLength);
+ // Tracing is already performed above (unimportant for trace that this is an array)
+ s = res_getStringNoTrace(&getData(), array.internalGetResource(&getData(), 0), &sLength);
if(s != NULL) {
us.setTo(TRUE, s, sLength);
return us;
@@ -761,9 +761,9 @@ res_getTableItemByIndex(const ResourceData *pResData, Resource table,
int32_t indexR, const char **key) {
uint32_t offset=RES_GET_OFFSET(table);
int32_t length;
- if (indexR < 0) {
- return RES_BOGUS;
- }
+ if (indexR < 0) {
+ return RES_BOGUS;
+ }
switch(RES_GET_TYPE(table)) {
case URES_TABLE: {
if (offset != 0) { /* empty if offset==0 */
@@ -821,56 +821,56 @@ UBool icu::ResourceTable::getKeyAndValue(int32_t i,
const char *&key, icu::ResourceValue &value) const {
if(0 <= i && i < length) {
icu::ResourceDataValue &rdValue = static_cast<icu::ResourceDataValue &>(value);
- if (keys16 != nullptr) {
- key = RES_GET_KEY16(&rdValue.getData(), keys16[i]);
+ if (keys16 != nullptr) {
+ key = RES_GET_KEY16(&rdValue.getData(), keys16[i]);
} else {
- key = RES_GET_KEY32(&rdValue.getData(), keys32[i]);
+ key = RES_GET_KEY32(&rdValue.getData(), keys32[i]);
}
Resource res;
- if (items16 != nullptr) {
- res = makeResourceFrom16(&rdValue.getData(), items16[i]);
+ if (items16 != nullptr) {
+ res = makeResourceFrom16(&rdValue.getData(), items16[i]);
} else {
res = items32[i];
}
- // Note: the ResourceTracer keeps a reference to the field of this
- // ResourceTable. This is OK because the ResourceTable should remain
- // alive for the duration that fields are being read from it
- // (including nested fields).
- rdValue.setResource(res, ResourceTracer(fTraceInfo, key));
+ // Note: the ResourceTracer keeps a reference to the field of this
+ // ResourceTable. This is OK because the ResourceTable should remain
+ // alive for the duration that fields are being read from it
+ // (including nested fields).
+ rdValue.setResource(res, ResourceTracer(fTraceInfo, key));
+ return TRUE;
+ }
+ return FALSE;
+}
+
+UBool icu::ResourceTable::findValue(const char *key, ResourceValue &value) const {
+ icu::ResourceDataValue &rdValue = static_cast<icu::ResourceDataValue &>(value);
+ const char *realKey = nullptr;
+ int32_t i;
+ if (keys16 != nullptr) {
+ i = _res_findTableItem(&rdValue.getData(), keys16, length, key, &realKey);
+ } else {
+ i = _res_findTable32Item(&rdValue.getData(), keys32, length, key, &realKey);
+ }
+ if (i >= 0) {
+ Resource res;
+ if (items16 != nullptr) {
+ res = makeResourceFrom16(&rdValue.getData(), items16[i]);
+ } else {
+ res = items32[i];
+ }
+ // Same note about lifetime as in getKeyAndValue().
+ rdValue.setResource(res, ResourceTracer(fTraceInfo, key));
return TRUE;
}
return FALSE;
}
-UBool icu::ResourceTable::findValue(const char *key, ResourceValue &value) const {
- icu::ResourceDataValue &rdValue = static_cast<icu::ResourceDataValue &>(value);
- const char *realKey = nullptr;
- int32_t i;
- if (keys16 != nullptr) {
- i = _res_findTableItem(&rdValue.getData(), keys16, length, key, &realKey);
- } else {
- i = _res_findTable32Item(&rdValue.getData(), keys32, length, key, &realKey);
- }
- if (i >= 0) {
- Resource res;
- if (items16 != nullptr) {
- res = makeResourceFrom16(&rdValue.getData(), items16[i]);
- } else {
- res = items32[i];
- }
- // Same note about lifetime as in getKeyAndValue().
- rdValue.setResource(res, ResourceTracer(fTraceInfo, key));
- return TRUE;
- }
- return FALSE;
-}
-
U_CAPI Resource U_EXPORT2
res_getArrayItem(const ResourceData *pResData, Resource array, int32_t indexR) {
uint32_t offset=RES_GET_OFFSET(array);
- if (indexR < 0) {
- return RES_BOGUS;
- }
+ if (indexR < 0) {
+ return RES_BOGUS;
+ }
switch(RES_GET_TYPE(array)) {
case URES_ARRAY: {
if (offset!=0) { /* empty if offset==0 */
@@ -905,13 +905,13 @@ uint32_t icu::ResourceArray::internalGetResource(const ResourceData *pResData, i
UBool icu::ResourceArray::getValue(int32_t i, icu::ResourceValue &value) const {
if(0 <= i && i < length) {
icu::ResourceDataValue &rdValue = static_cast<icu::ResourceDataValue &>(value);
- // Note: the ResourceTracer keeps a reference to the field of this
- // ResourceArray. This is OK because the ResourceArray should remain
- // alive for the duration that fields are being read from it
- // (including nested fields).
- rdValue.setResource(
- internalGetResource(&rdValue.getData(), i),
- ResourceTracer(fTraceInfo, i));
+ // Note: the ResourceTracer keeps a reference to the field of this
+ // ResourceArray. This is OK because the ResourceArray should remain
+ // alive for the duration that fields are being read from it
+ // (including nested fields).
+ rdValue.setResource(
+ internalGetResource(&rdValue.getData(), i),
+ ResourceTracer(fTraceInfo, i));
return TRUE;
}
return FALSE;
@@ -963,14 +963,14 @@ res_findResource(const ResourceData *pResData, Resource r, char** path, const ch
if(t2 == RES_BOGUS) {
/* if we fail to get the resource by key, maybe we got an index */
indexR = uprv_strtol(pathP, &closeIndex, 10);
- if(indexR >= 0 && *closeIndex == 0) {
+ if(indexR >= 0 && *closeIndex == 0) {
/* if we indeed have an index, try to get the item by index */
t2 = res_getTableItemByIndex(pResData, t1, indexR, key);
- } // else t2 is already RES_BOGUS
+ } // else t2 is already RES_BOGUS
}
} else if(URES_IS_ARRAY(type)) {
indexR = uprv_strtol(pathP, &closeIndex, 10);
- if(indexR >= 0 && *closeIndex == 0) {
+ if(indexR >= 0 && *closeIndex == 0) {
t2 = res_getArrayItem(pResData, t1, indexR);
} else {
t2 = RES_BOGUS; /* have an array, but don't have a valid index */
diff --git a/contrib/libs/icu/common/uresdata.h b/contrib/libs/icu/common/uresdata.h
index 23d04432bc..d1b67babf2 100644
--- a/contrib/libs/icu/common/uresdata.h
+++ b/contrib/libs/icu/common/uresdata.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
******************************************************************************
* file name: uresdata.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -69,16 +69,16 @@ typedef uint32_t Resource;
#define RES_GET_OFFSET(res) ((res)&0x0fffffff)
#define RES_GET_POINTER(pRoot, res) ((pRoot)+RES_GET_OFFSET(res))
-/* get signed and unsigned integer values directly from the Resource handle
- * NOTE: For proper logging, please use the res_getInt() constexpr
- */
+/* get signed and unsigned integer values directly from the Resource handle
+ * NOTE: For proper logging, please use the res_getInt() constexpr
+ */
#if U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC
-# define RES_GET_INT_NO_TRACE(res) (((int32_t)((res)<<4L))>>4L)
+# define RES_GET_INT_NO_TRACE(res) (((int32_t)((res)<<4L))>>4L)
#else
-# define RES_GET_INT_NO_TRACE(res) (int32_t)(((res)&0x08000000) ? (res)|0xf0000000 : (res)&0x07ffffff)
+# define RES_GET_INT_NO_TRACE(res) (int32_t)(((res)&0x08000000) ? (res)|0xf0000000 : (res)&0x07ffffff)
#endif
-#define RES_GET_UINT_NO_TRACE(res) ((res)&0x0fffffff)
+#define RES_GET_UINT_NO_TRACE(res) ((res)&0x0fffffff)
#define URES_IS_ARRAY(type) ((int32_t)(type)==URES_ARRAY || (int32_t)(type)==URES_ARRAY16)
#define URES_IS_TABLE(type) ((int32_t)(type)==URES_TABLE || (int32_t)(type)==URES_TABLE16 || (int32_t)(type)==URES_TABLE32)
@@ -425,27 +425,27 @@ res_unload(ResourceData *pResData);
U_INTERNAL UResType U_EXPORT2
res_getPublicType(Resource res);
-///////////////////////////////////////////////////////////////////////////
-// To enable tracing, use the inline versions of the res_get* functions. //
-///////////////////////////////////////////////////////////////////////////
-
+///////////////////////////////////////////////////////////////////////////
+// To enable tracing, use the inline versions of the res_get* functions. //
+///////////////////////////////////////////////////////////////////////////
+
/*
* Return a pointer to a zero-terminated, const UChar* string
* and set its length in *pLength.
* Returns NULL if not found.
*/
U_INTERNAL const UChar * U_EXPORT2
-res_getStringNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength);
+res_getStringNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength);
U_INTERNAL const uint8_t * U_EXPORT2
-res_getBinaryNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength);
+res_getBinaryNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength);
U_INTERNAL const int32_t * U_EXPORT2
-res_getIntVectorNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength);
+res_getIntVectorNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength);
+
+U_INTERNAL const UChar * U_EXPORT2
+res_getAlias(const ResourceData *pResData, Resource res, int32_t *pLength);
-U_INTERNAL const UChar * U_EXPORT2
-res_getAlias(const ResourceData *pResData, Resource res, int32_t *pLength);
-
U_INTERNAL Resource U_EXPORT2
res_getResource(const ResourceData *pResData, const char *key);
@@ -476,55 +476,55 @@ U_CFUNC Resource res_findResource(const ResourceData *pResData, Resource r,
#ifdef __cplusplus
#include "resource.h"
-#include "restrace.h"
+#include "restrace.h"
U_NAMESPACE_BEGIN
-inline const UChar* res_getString(const ResourceTracer& traceInfo,
- const ResourceData *pResData, Resource res, int32_t *pLength) {
- traceInfo.trace("string");
- return res_getStringNoTrace(pResData, res, pLength);
-}
-
-inline const uint8_t* res_getBinary(const ResourceTracer& traceInfo,
- const ResourceData *pResData, Resource res, int32_t *pLength) {
- traceInfo.trace("binary");
- return res_getBinaryNoTrace(pResData, res, pLength);
-}
-
-inline const int32_t* res_getIntVector(const ResourceTracer& traceInfo,
- const ResourceData *pResData, Resource res, int32_t *pLength) {
- traceInfo.trace("intvector");
- return res_getIntVectorNoTrace(pResData, res, pLength);
-}
-
-inline int32_t res_getInt(const ResourceTracer& traceInfo, Resource res) {
- traceInfo.trace("int");
- return RES_GET_INT_NO_TRACE(res);
-}
-
-inline uint32_t res_getUInt(const ResourceTracer& traceInfo, Resource res) {
- traceInfo.trace("uint");
- return RES_GET_UINT_NO_TRACE(res);
-}
-
+inline const UChar* res_getString(const ResourceTracer& traceInfo,
+ const ResourceData *pResData, Resource res, int32_t *pLength) {
+ traceInfo.trace("string");
+ return res_getStringNoTrace(pResData, res, pLength);
+}
+
+inline const uint8_t* res_getBinary(const ResourceTracer& traceInfo,
+ const ResourceData *pResData, Resource res, int32_t *pLength) {
+ traceInfo.trace("binary");
+ return res_getBinaryNoTrace(pResData, res, pLength);
+}
+
+inline const int32_t* res_getIntVector(const ResourceTracer& traceInfo,
+ const ResourceData *pResData, Resource res, int32_t *pLength) {
+ traceInfo.trace("intvector");
+ return res_getIntVectorNoTrace(pResData, res, pLength);
+}
+
+inline int32_t res_getInt(const ResourceTracer& traceInfo, Resource res) {
+ traceInfo.trace("int");
+ return RES_GET_INT_NO_TRACE(res);
+}
+
+inline uint32_t res_getUInt(const ResourceTracer& traceInfo, Resource res) {
+ traceInfo.trace("uint");
+ return RES_GET_UINT_NO_TRACE(res);
+}
+
class ResourceDataValue : public ResourceValue {
public:
- ResourceDataValue() :
- res(static_cast<Resource>(URES_NONE)),
- fTraceInfo() {}
+ ResourceDataValue() :
+ res(static_cast<Resource>(URES_NONE)),
+ fTraceInfo() {}
virtual ~ResourceDataValue();
- void setData(const ResourceData *data) {
- resData = *data;
- }
+ void setData(const ResourceData *data) {
+ resData = *data;
+ }
+
+ void setResource(Resource r, ResourceTracer&& traceInfo) {
+ res = r;
+ fTraceInfo = traceInfo;
+ }
- void setResource(Resource r, ResourceTracer&& traceInfo) {
- res = r;
- fTraceInfo = traceInfo;
- }
-
- const ResourceData &getData() const { return resData; }
+ const ResourceData &getData() const { return resData; }
virtual UResType getType() const;
virtual const UChar *getString(int32_t &length, UErrorCode &errorCode) const;
virtual const UChar *getAliasString(int32_t &length, UErrorCode &errorCode) const;
@@ -542,11 +542,11 @@ public:
virtual UnicodeString getStringOrFirstOfArray(UErrorCode &errorCode) const;
private:
- // TODO(ICU-20769): If UResourceBundle.fResData becomes a pointer,
- // then remove this value field again and just store a pResData pointer.
- ResourceData resData;
+ // TODO(ICU-20769): If UResourceBundle.fResData becomes a pointer,
+ // then remove this value field again and just store a pResData pointer.
+ ResourceData resData;
Resource res;
- ResourceTracer fTraceInfo;
+ ResourceTracer fTraceInfo;
};
U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/uresimp.h b/contrib/libs/icu/common/uresimp.h
index 57bca87ea3..f453ddc004 100644
--- a/contrib/libs/icu/common/uresimp.h
+++ b/contrib/libs/icu/common/uresimp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -11,7 +11,7 @@
#define URESIMP_H
#include "unicode/ures.h"
-#include "unicode/utypes.h"
+#include "unicode/utypes.h"
#include "uresdata.h"
@@ -67,9 +67,9 @@ struct UResourceBundle {
char *fVersion;
UResourceDataEntry *fTopLevelData; /* for getting the valid locale */
char *fResPath; /* full path to the resource: "zh_TW/CollationElements/Sequence" */
- // TODO(ICU-20769): Try to change the by-value fResData into a pointer,
- // with the struct in only one place for each bundle.
- // Also replace class ResourceDataValue.resData with a pResData pointer again.
+ // TODO(ICU-20769): Try to change the by-value fResData into a pointer,
+ // with the struct in only one place for each bundle.
+ // Also replace class ResourceDataValue.resData with a pResData pointer again.
ResourceData fResData;
char fResBuf[RES_BUFSIZE];
int32_t fResPathLen;
@@ -86,61 +86,61 @@ struct UResourceBundle {
U_CAPI void U_EXPORT2 ures_initStackObject(UResourceBundle* resB);
-#ifdef __cplusplus
-
-U_NAMESPACE_BEGIN
-
+#ifdef __cplusplus
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \class StackUResourceBundle
+ * "Smart pointer" like class, closes a UResourceBundle via ures_close().
+ *
+ * This code:
+ *
+ * StackUResourceBundle bundle;
+ * foo(bundle.getAlias());
+ *
+ * Is equivalent to this code:
+ *
+ * UResourceBundle bundle;
+ * ures_initStackObject(&bundle);
+ * foo(&bundle);
+ * ures_close(&bundle);
+ *
+ * @see LocalUResourceBundlePointer
+ * @internal
+ */
+class U_COMMON_API StackUResourceBundle {
+public:
+ // No heap allocation. Use only on the stack.
+ static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete;
+ static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete;
+#if U_HAVE_PLACEMENT_NEW
+ static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete;
+#endif
+
+ StackUResourceBundle();
+ ~StackUResourceBundle();
+
+ UResourceBundle* getAlias() { return &bundle; }
+
+ UResourceBundle& ref() { return bundle; }
+ const UResourceBundle& ref() const { return bundle; }
+
+ StackUResourceBundle(const StackUResourceBundle&) = delete;
+ StackUResourceBundle& operator=(const StackUResourceBundle&) = delete;
+
+ StackUResourceBundle(StackUResourceBundle&&) = delete;
+ StackUResourceBundle& operator=(StackUResourceBundle&&) = delete;
+
+private:
+ UResourceBundle bundle;
+};
+
+U_NAMESPACE_END
+
+#endif /* __cplusplus */
+
/**
- * \class StackUResourceBundle
- * "Smart pointer" like class, closes a UResourceBundle via ures_close().
- *
- * This code:
- *
- * StackUResourceBundle bundle;
- * foo(bundle.getAlias());
- *
- * Is equivalent to this code:
- *
- * UResourceBundle bundle;
- * ures_initStackObject(&bundle);
- * foo(&bundle);
- * ures_close(&bundle);
- *
- * @see LocalUResourceBundlePointer
- * @internal
- */
-class U_COMMON_API StackUResourceBundle {
-public:
- // No heap allocation. Use only on the stack.
- static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete;
- static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete;
-#if U_HAVE_PLACEMENT_NEW
- static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete;
-#endif
-
- StackUResourceBundle();
- ~StackUResourceBundle();
-
- UResourceBundle* getAlias() { return &bundle; }
-
- UResourceBundle& ref() { return bundle; }
- const UResourceBundle& ref() const { return bundle; }
-
- StackUResourceBundle(const StackUResourceBundle&) = delete;
- StackUResourceBundle& operator=(const StackUResourceBundle&) = delete;
-
- StackUResourceBundle(StackUResourceBundle&&) = delete;
- StackUResourceBundle& operator=(StackUResourceBundle&&) = delete;
-
-private:
- UResourceBundle bundle;
-};
-
-U_NAMESPACE_END
-
-#endif /* __cplusplus */
-
-/**
* Opens a resource bundle for the locale;
* if there is not even a base language bundle, then loads the root bundle;
* never falls back to the default locale.
@@ -285,11 +285,11 @@ ures_getStringByKeyWithFallback(const UResourceBundle *resB,
#ifdef __cplusplus
U_CAPI void U_EXPORT2
-ures_getValueWithFallback(const UResourceBundle *bundle, const char *path,
- UResourceBundle *tempFillIn,
- icu::ResourceDataValue &value, UErrorCode &errorCode);
-
-U_CAPI void U_EXPORT2
+ures_getValueWithFallback(const UResourceBundle *bundle, const char *path,
+ UResourceBundle *tempFillIn,
+ icu::ResourceDataValue &value, UErrorCode &errorCode);
+
+U_CAPI void U_EXPORT2
ures_getAllItemsWithFallback(const UResourceBundle *bundle, const char *path,
icu::ResourceSink &sink, UErrorCode &errorCode);
@@ -338,27 +338,27 @@ U_CAPI const char* U_EXPORT2
ures_getLocaleInternal(const UResourceBundle* resourceBundle,
UErrorCode* status);
-/**
- * Same as ures_openDirect() but uses the fill-in parameter instead of allocating a new bundle.
- *
- * @param r The existing UResourceBundle to fill in. If NULL then status will be
- * set to U_ILLEGAL_ARGUMENT_ERROR.
- * @param packageName The packageName and locale together point to an ICU udata object,
- * as defined by <code> udata_open( packageName, "res", locale, err) </code>
- * or equivalent. Typically, packageName will refer to a (.dat) file, or to
- * a package registered with udata_setAppData(). Using a full file or directory
- * pathname for packageName is deprecated. If NULL, ICU data will be used.
- * @param locale specifies the locale for which we want to open the resource
- * if NULL, the default locale will be used. If strlen(locale) == 0
- * root locale will be used.
- * @param status The error code.
- * @see ures_openDirect
- * @internal
- */
-U_CAPI void U_EXPORT2
-ures_openDirectFillIn(UResourceBundle *r,
- const char *packageName,
- const char *locale,
- UErrorCode *status);
-
+/**
+ * Same as ures_openDirect() but uses the fill-in parameter instead of allocating a new bundle.
+ *
+ * @param r The existing UResourceBundle to fill in. If NULL then status will be
+ * set to U_ILLEGAL_ARGUMENT_ERROR.
+ * @param packageName The packageName and locale together point to an ICU udata object,
+ * as defined by <code> udata_open( packageName, "res", locale, err) </code>
+ * or equivalent. Typically, packageName will refer to a (.dat) file, or to
+ * a package registered with udata_setAppData(). Using a full file or directory
+ * pathname for packageName is deprecated. If NULL, ICU data will be used.
+ * @param locale specifies the locale for which we want to open the resource
+ * if NULL, the default locale will be used. If strlen(locale) == 0
+ * root locale will be used.
+ * @param status The error code.
+ * @see ures_openDirect
+ * @internal
+ */
+U_CAPI void U_EXPORT2
+ures_openDirectFillIn(UResourceBundle *r,
+ const char *packageName,
+ const char *locale,
+ UErrorCode *status);
+
#endif /*URESIMP_H*/
diff --git a/contrib/libs/icu/common/ureslocs.h b/contrib/libs/icu/common/ureslocs.h
index 6a2558423d..f7c3344ef2 100644
--- a/contrib/libs/icu/common/ureslocs.h
+++ b/contrib/libs/icu/common/ureslocs.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/usc_impl.cpp b/contrib/libs/icu/common/usc_impl.cpp
index 5594962637..111029b974 100644
--- a/contrib/libs/icu/common/usc_impl.cpp
+++ b/contrib/libs/icu/common/usc_impl.cpp
@@ -1,361 +1,361 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-**********************************************************************
-* Copyright (C) 1999-2016, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
-*
-* File USC_IMPL.C
-*
-* Modification History:
-*
-* Date Name Description
-* 07/08/2002 Eric Mader Creation.
-******************************************************************************
-*/
-
-#include "unicode/uscript.h"
-#include "usc_impl.h"
-#include "cmemory.h"
-
-#define PAREN_STACK_DEPTH 32
-
-#define MOD(sp) ((sp) % PAREN_STACK_DEPTH)
-#define LIMIT_INC(sp) (((sp) < PAREN_STACK_DEPTH)? (sp) + 1 : PAREN_STACK_DEPTH)
-#define INC(sp,count) (MOD((sp) + (count)))
-#define INC1(sp) (INC(sp, 1))
-#define DEC(sp,count) (MOD((sp) + PAREN_STACK_DEPTH - (count)))
-#define DEC1(sp) (DEC(sp, 1))
-#define STACK_IS_EMPTY(scriptRun) ((scriptRun)->pushCount <= 0)
-#define STACK_IS_NOT_EMPTY(scriptRun) (! STACK_IS_EMPTY(scriptRun))
-#define TOP(scriptRun) ((scriptRun)->parenStack[(scriptRun)->parenSP])
-#define SYNC_FIXUP(scriptRun) ((scriptRun)->fixupCount = 0)
-
-struct ParenStackEntry
-{
- int32_t pairIndex;
- UScriptCode scriptCode;
-};
-
-struct UScriptRun
-{
- int32_t textLength;
- const UChar *textArray;
-
- int32_t scriptStart;
- int32_t scriptLimit;
- UScriptCode scriptCode;
-
- struct ParenStackEntry parenStack[PAREN_STACK_DEPTH];
- int32_t parenSP;
- int32_t pushCount;
- int32_t fixupCount;
-};
-
-static int8_t highBit(int32_t value);
-
-static const UChar32 pairedChars[] = {
- 0x0028, 0x0029, /* ascii paired punctuation */
- 0x003c, 0x003e,
- 0x005b, 0x005d,
- 0x007b, 0x007d,
- 0x00ab, 0x00bb, /* guillemets */
- 0x2018, 0x2019, /* general punctuation */
- 0x201c, 0x201d,
- 0x2039, 0x203a,
- 0x3008, 0x3009, /* chinese paired punctuation */
- 0x300a, 0x300b,
- 0x300c, 0x300d,
- 0x300e, 0x300f,
- 0x3010, 0x3011,
- 0x3014, 0x3015,
- 0x3016, 0x3017,
- 0x3018, 0x3019,
- 0x301a, 0x301b
-};
-
-static void push(UScriptRun *scriptRun, int32_t pairIndex, UScriptCode scriptCode)
-{
- scriptRun->pushCount = LIMIT_INC(scriptRun->pushCount);
- scriptRun->fixupCount = LIMIT_INC(scriptRun->fixupCount);
-
- scriptRun->parenSP = INC1(scriptRun->parenSP);
- scriptRun->parenStack[scriptRun->parenSP].pairIndex = pairIndex;
- scriptRun->parenStack[scriptRun->parenSP].scriptCode = scriptCode;
-}
-
-static void pop(UScriptRun *scriptRun)
-{
- if (STACK_IS_EMPTY(scriptRun)) {
- return;
- }
-
- if (scriptRun->fixupCount > 0) {
- scriptRun->fixupCount -= 1;
- }
-
- scriptRun->pushCount -= 1;
- scriptRun->parenSP = DEC1(scriptRun->parenSP);
-
- /* If the stack is now empty, reset the stack
- pointers to their initial values.
- */
- if (STACK_IS_EMPTY(scriptRun)) {
- scriptRun->parenSP = -1;
- }
-}
-
-static void fixup(UScriptRun *scriptRun, UScriptCode scriptCode)
-{
- int32_t fixupSP = DEC(scriptRun->parenSP, scriptRun->fixupCount);
-
- while (scriptRun->fixupCount-- > 0) {
- fixupSP = INC1(fixupSP);
- scriptRun->parenStack[fixupSP].scriptCode = scriptCode;
- }
-}
-
-static int8_t
-highBit(int32_t value)
-{
- int8_t bit = 0;
-
- if (value <= 0) {
- return -32;
- }
-
- if (value >= 1 << 16) {
- value >>= 16;
- bit += 16;
- }
-
- if (value >= 1 << 8) {
- value >>= 8;
- bit += 8;
- }
-
- if (value >= 1 << 4) {
- value >>= 4;
- bit += 4;
- }
-
- if (value >= 1 << 2) {
- value >>= 2;
- bit += 2;
- }
-
- if (value >= 1 << 1) {
- //value >>= 1;
- bit += 1;
- }
-
- return bit;
-}
-
-static int32_t
-getPairIndex(UChar32 ch)
-{
- int32_t pairedCharCount = UPRV_LENGTHOF(pairedChars);
- int32_t pairedCharPower = 1 << highBit(pairedCharCount);
- int32_t pairedCharExtra = pairedCharCount - pairedCharPower;
-
- int32_t probe = pairedCharPower;
- int32_t pairIndex = 0;
-
- if (ch >= pairedChars[pairedCharExtra]) {
- pairIndex = pairedCharExtra;
- }
-
- while (probe > (1 << 0)) {
- probe >>= 1;
-
- if (ch >= pairedChars[pairIndex + probe]) {
- pairIndex += probe;
- }
- }
-
- if (pairedChars[pairIndex] != ch) {
- pairIndex = -1;
- }
-
- return pairIndex;
-}
-
-static UBool
-sameScript(UScriptCode scriptOne, UScriptCode scriptTwo)
-{
- return scriptOne <= USCRIPT_INHERITED || scriptTwo <= USCRIPT_INHERITED || scriptOne == scriptTwo;
-}
-
-U_CAPI UScriptRun * U_EXPORT2
-uscript_openRun(const UChar *src, int32_t length, UErrorCode *pErrorCode)
-{
- UScriptRun *result = NULL;
-
- if (pErrorCode == NULL || U_FAILURE(*pErrorCode)) {
- return NULL;
- }
-
- result = (UScriptRun *)uprv_malloc(sizeof (UScriptRun));
-
- if (result == NULL) {
- *pErrorCode = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
-
- uscript_setRunText(result, src, length, pErrorCode);
-
- /* Release the UScriptRun if uscript_setRunText() returns an error */
- if (U_FAILURE(*pErrorCode)) {
- uprv_free(result);
- result = NULL;
- }
-
- return result;
-}
-
-U_CAPI void U_EXPORT2
-uscript_closeRun(UScriptRun *scriptRun)
-{
- if (scriptRun != NULL) {
- uprv_free(scriptRun);
- }
-}
-
-U_CAPI void U_EXPORT2
-uscript_resetRun(UScriptRun *scriptRun)
-{
- if (scriptRun != NULL) {
- scriptRun->scriptStart = 0;
- scriptRun->scriptLimit = 0;
- scriptRun->scriptCode = USCRIPT_INVALID_CODE;
- scriptRun->parenSP = -1;
- scriptRun->pushCount = 0;
- scriptRun->fixupCount = 0;
- }
-}
-
-U_CAPI void U_EXPORT2
-uscript_setRunText(UScriptRun *scriptRun, const UChar *src, int32_t length, UErrorCode *pErrorCode)
-{
- if (pErrorCode == NULL || U_FAILURE(*pErrorCode)) {
- return;
- }
-
- if (scriptRun == NULL || length < 0 || ((src == NULL) != (length == 0))) {
- *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- scriptRun->textArray = src;
- scriptRun->textLength = length;
-
- uscript_resetRun(scriptRun);
-}
-
-U_CAPI UBool U_EXPORT2
-uscript_nextRun(UScriptRun *scriptRun, int32_t *pRunStart, int32_t *pRunLimit, UScriptCode *pRunScript)
-{
- UErrorCode error = U_ZERO_ERROR;
-
- /* if we've fallen off the end of the text, we're done */
- if (scriptRun == NULL || scriptRun->scriptLimit >= scriptRun->textLength) {
- return FALSE;
- }
-
- SYNC_FIXUP(scriptRun);
- scriptRun->scriptCode = USCRIPT_COMMON;
-
- for (scriptRun->scriptStart = scriptRun->scriptLimit; scriptRun->scriptLimit < scriptRun->textLength; scriptRun->scriptLimit += 1) {
- UChar high = scriptRun->textArray[scriptRun->scriptLimit];
- UChar32 ch = high;
- UScriptCode sc;
- int32_t pairIndex;
-
- /*
- * if the character is a high surrogate and it's not the last one
- * in the text, see if it's followed by a low surrogate
- */
- if (high >= 0xD800 && high <= 0xDBFF && scriptRun->scriptLimit < scriptRun->textLength - 1) {
- UChar low = scriptRun->textArray[scriptRun->scriptLimit + 1];
-
- /*
- * if it is followed by a low surrogate,
- * consume it and form the full character
- */
- if (low >= 0xDC00 && low <= 0xDFFF) {
- ch = (high - 0xD800) * 0x0400 + low - 0xDC00 + 0x10000;
- scriptRun->scriptLimit += 1;
- }
- }
-
- sc = uscript_getScript(ch, &error);
- pairIndex = getPairIndex(ch);
-
- /*
- * Paired character handling:
- *
- * if it's an open character, push it onto the stack.
- * if it's a close character, find the matching open on the
- * stack, and use that script code. Any non-matching open
- * characters above it on the stack will be poped.
- */
- if (pairIndex >= 0) {
- if ((pairIndex & 1) == 0) {
- push(scriptRun, pairIndex, scriptRun->scriptCode);
- } else {
- int32_t pi = pairIndex & ~1;
-
- while (STACK_IS_NOT_EMPTY(scriptRun) && TOP(scriptRun).pairIndex != pi) {
- pop(scriptRun);
- }
-
- if (STACK_IS_NOT_EMPTY(scriptRun)) {
- sc = TOP(scriptRun).scriptCode;
- }
- }
- }
-
- if (sameScript(scriptRun->scriptCode, sc)) {
- if (scriptRun->scriptCode <= USCRIPT_INHERITED && sc > USCRIPT_INHERITED) {
- scriptRun->scriptCode = sc;
-
- fixup(scriptRun, scriptRun->scriptCode);
- }
-
- /*
- * if this character is a close paired character,
- * pop the matching open character from the stack
- */
- if (pairIndex >= 0 && (pairIndex & 1) != 0) {
- pop(scriptRun);
- }
- } else {
- /*
- * if the run broke on a surrogate pair,
- * end it before the high surrogate
- */
- if (ch >= 0x10000) {
- scriptRun->scriptLimit -= 1;
- }
-
- break;
- }
- }
-
-
- if (pRunStart != NULL) {
- *pRunStart = scriptRun->scriptStart;
- }
-
- if (pRunLimit != NULL) {
- *pRunLimit = scriptRun->scriptLimit;
- }
-
- if (pRunScript != NULL) {
- *pRunScript = scriptRun->scriptCode;
- }
-
- return TRUE;
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+**********************************************************************
+* Copyright (C) 1999-2016, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+*
+* File USC_IMPL.C
+*
+* Modification History:
+*
+* Date Name Description
+* 07/08/2002 Eric Mader Creation.
+******************************************************************************
+*/
+
+#include "unicode/uscript.h"
+#include "usc_impl.h"
+#include "cmemory.h"
+
+#define PAREN_STACK_DEPTH 32
+
+#define MOD(sp) ((sp) % PAREN_STACK_DEPTH)
+#define LIMIT_INC(sp) (((sp) < PAREN_STACK_DEPTH)? (sp) + 1 : PAREN_STACK_DEPTH)
+#define INC(sp,count) (MOD((sp) + (count)))
+#define INC1(sp) (INC(sp, 1))
+#define DEC(sp,count) (MOD((sp) + PAREN_STACK_DEPTH - (count)))
+#define DEC1(sp) (DEC(sp, 1))
+#define STACK_IS_EMPTY(scriptRun) ((scriptRun)->pushCount <= 0)
+#define STACK_IS_NOT_EMPTY(scriptRun) (! STACK_IS_EMPTY(scriptRun))
+#define TOP(scriptRun) ((scriptRun)->parenStack[(scriptRun)->parenSP])
+#define SYNC_FIXUP(scriptRun) ((scriptRun)->fixupCount = 0)
+
+struct ParenStackEntry
+{
+ int32_t pairIndex;
+ UScriptCode scriptCode;
+};
+
+struct UScriptRun
+{
+ int32_t textLength;
+ const UChar *textArray;
+
+ int32_t scriptStart;
+ int32_t scriptLimit;
+ UScriptCode scriptCode;
+
+ struct ParenStackEntry parenStack[PAREN_STACK_DEPTH];
+ int32_t parenSP;
+ int32_t pushCount;
+ int32_t fixupCount;
+};
+
+static int8_t highBit(int32_t value);
+
+static const UChar32 pairedChars[] = {
+ 0x0028, 0x0029, /* ascii paired punctuation */
+ 0x003c, 0x003e,
+ 0x005b, 0x005d,
+ 0x007b, 0x007d,
+ 0x00ab, 0x00bb, /* guillemets */
+ 0x2018, 0x2019, /* general punctuation */
+ 0x201c, 0x201d,
+ 0x2039, 0x203a,
+ 0x3008, 0x3009, /* chinese paired punctuation */
+ 0x300a, 0x300b,
+ 0x300c, 0x300d,
+ 0x300e, 0x300f,
+ 0x3010, 0x3011,
+ 0x3014, 0x3015,
+ 0x3016, 0x3017,
+ 0x3018, 0x3019,
+ 0x301a, 0x301b
+};
+
+static void push(UScriptRun *scriptRun, int32_t pairIndex, UScriptCode scriptCode)
+{
+ scriptRun->pushCount = LIMIT_INC(scriptRun->pushCount);
+ scriptRun->fixupCount = LIMIT_INC(scriptRun->fixupCount);
+
+ scriptRun->parenSP = INC1(scriptRun->parenSP);
+ scriptRun->parenStack[scriptRun->parenSP].pairIndex = pairIndex;
+ scriptRun->parenStack[scriptRun->parenSP].scriptCode = scriptCode;
+}
+
+static void pop(UScriptRun *scriptRun)
+{
+ if (STACK_IS_EMPTY(scriptRun)) {
+ return;
+ }
+
+ if (scriptRun->fixupCount > 0) {
+ scriptRun->fixupCount -= 1;
+ }
+
+ scriptRun->pushCount -= 1;
+ scriptRun->parenSP = DEC1(scriptRun->parenSP);
+
+ /* If the stack is now empty, reset the stack
+ pointers to their initial values.
+ */
+ if (STACK_IS_EMPTY(scriptRun)) {
+ scriptRun->parenSP = -1;
+ }
+}
+
+static void fixup(UScriptRun *scriptRun, UScriptCode scriptCode)
+{
+ int32_t fixupSP = DEC(scriptRun->parenSP, scriptRun->fixupCount);
+
+ while (scriptRun->fixupCount-- > 0) {
+ fixupSP = INC1(fixupSP);
+ scriptRun->parenStack[fixupSP].scriptCode = scriptCode;
+ }
+}
+
+static int8_t
+highBit(int32_t value)
+{
+ int8_t bit = 0;
+
+ if (value <= 0) {
+ return -32;
+ }
+
+ if (value >= 1 << 16) {
+ value >>= 16;
+ bit += 16;
+ }
+
+ if (value >= 1 << 8) {
+ value >>= 8;
+ bit += 8;
+ }
+
+ if (value >= 1 << 4) {
+ value >>= 4;
+ bit += 4;
+ }
+
+ if (value >= 1 << 2) {
+ value >>= 2;
+ bit += 2;
+ }
+
+ if (value >= 1 << 1) {
+ //value >>= 1;
+ bit += 1;
+ }
+
+ return bit;
+}
+
+static int32_t
+getPairIndex(UChar32 ch)
+{
+ int32_t pairedCharCount = UPRV_LENGTHOF(pairedChars);
+ int32_t pairedCharPower = 1 << highBit(pairedCharCount);
+ int32_t pairedCharExtra = pairedCharCount - pairedCharPower;
+
+ int32_t probe = pairedCharPower;
+ int32_t pairIndex = 0;
+
+ if (ch >= pairedChars[pairedCharExtra]) {
+ pairIndex = pairedCharExtra;
+ }
+
+ while (probe > (1 << 0)) {
+ probe >>= 1;
+
+ if (ch >= pairedChars[pairIndex + probe]) {
+ pairIndex += probe;
+ }
+ }
+
+ if (pairedChars[pairIndex] != ch) {
+ pairIndex = -1;
+ }
+
+ return pairIndex;
+}
+
+static UBool
+sameScript(UScriptCode scriptOne, UScriptCode scriptTwo)
+{
+ return scriptOne <= USCRIPT_INHERITED || scriptTwo <= USCRIPT_INHERITED || scriptOne == scriptTwo;
+}
+
+U_CAPI UScriptRun * U_EXPORT2
+uscript_openRun(const UChar *src, int32_t length, UErrorCode *pErrorCode)
+{
+ UScriptRun *result = NULL;
+
+ if (pErrorCode == NULL || U_FAILURE(*pErrorCode)) {
+ return NULL;
+ }
+
+ result = (UScriptRun *)uprv_malloc(sizeof (UScriptRun));
+
+ if (result == NULL) {
+ *pErrorCode = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+
+ uscript_setRunText(result, src, length, pErrorCode);
+
+ /* Release the UScriptRun if uscript_setRunText() returns an error */
+ if (U_FAILURE(*pErrorCode)) {
+ uprv_free(result);
+ result = NULL;
+ }
+
+ return result;
+}
+
+U_CAPI void U_EXPORT2
+uscript_closeRun(UScriptRun *scriptRun)
+{
+ if (scriptRun != NULL) {
+ uprv_free(scriptRun);
+ }
+}
+
+U_CAPI void U_EXPORT2
+uscript_resetRun(UScriptRun *scriptRun)
+{
+ if (scriptRun != NULL) {
+ scriptRun->scriptStart = 0;
+ scriptRun->scriptLimit = 0;
+ scriptRun->scriptCode = USCRIPT_INVALID_CODE;
+ scriptRun->parenSP = -1;
+ scriptRun->pushCount = 0;
+ scriptRun->fixupCount = 0;
+ }
+}
+
+U_CAPI void U_EXPORT2
+uscript_setRunText(UScriptRun *scriptRun, const UChar *src, int32_t length, UErrorCode *pErrorCode)
+{
+ if (pErrorCode == NULL || U_FAILURE(*pErrorCode)) {
+ return;
+ }
+
+ if (scriptRun == NULL || length < 0 || ((src == NULL) != (length == 0))) {
+ *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ scriptRun->textArray = src;
+ scriptRun->textLength = length;
+
+ uscript_resetRun(scriptRun);
+}
+
+U_CAPI UBool U_EXPORT2
+uscript_nextRun(UScriptRun *scriptRun, int32_t *pRunStart, int32_t *pRunLimit, UScriptCode *pRunScript)
+{
+ UErrorCode error = U_ZERO_ERROR;
+
+ /* if we've fallen off the end of the text, we're done */
+ if (scriptRun == NULL || scriptRun->scriptLimit >= scriptRun->textLength) {
+ return FALSE;
+ }
+
+ SYNC_FIXUP(scriptRun);
+ scriptRun->scriptCode = USCRIPT_COMMON;
+
+ for (scriptRun->scriptStart = scriptRun->scriptLimit; scriptRun->scriptLimit < scriptRun->textLength; scriptRun->scriptLimit += 1) {
+ UChar high = scriptRun->textArray[scriptRun->scriptLimit];
+ UChar32 ch = high;
+ UScriptCode sc;
+ int32_t pairIndex;
+
+ /*
+ * if the character is a high surrogate and it's not the last one
+ * in the text, see if it's followed by a low surrogate
+ */
+ if (high >= 0xD800 && high <= 0xDBFF && scriptRun->scriptLimit < scriptRun->textLength - 1) {
+ UChar low = scriptRun->textArray[scriptRun->scriptLimit + 1];
+
+ /*
+ * if it is followed by a low surrogate,
+ * consume it and form the full character
+ */
+ if (low >= 0xDC00 && low <= 0xDFFF) {
+ ch = (high - 0xD800) * 0x0400 + low - 0xDC00 + 0x10000;
+ scriptRun->scriptLimit += 1;
+ }
+ }
+
+ sc = uscript_getScript(ch, &error);
+ pairIndex = getPairIndex(ch);
+
+ /*
+ * Paired character handling:
+ *
+ * if it's an open character, push it onto the stack.
+ * if it's a close character, find the matching open on the
+ * stack, and use that script code. Any non-matching open
+ * characters above it on the stack will be poped.
+ */
+ if (pairIndex >= 0) {
+ if ((pairIndex & 1) == 0) {
+ push(scriptRun, pairIndex, scriptRun->scriptCode);
+ } else {
+ int32_t pi = pairIndex & ~1;
+
+ while (STACK_IS_NOT_EMPTY(scriptRun) && TOP(scriptRun).pairIndex != pi) {
+ pop(scriptRun);
+ }
+
+ if (STACK_IS_NOT_EMPTY(scriptRun)) {
+ sc = TOP(scriptRun).scriptCode;
+ }
+ }
+ }
+
+ if (sameScript(scriptRun->scriptCode, sc)) {
+ if (scriptRun->scriptCode <= USCRIPT_INHERITED && sc > USCRIPT_INHERITED) {
+ scriptRun->scriptCode = sc;
+
+ fixup(scriptRun, scriptRun->scriptCode);
+ }
+
+ /*
+ * if this character is a close paired character,
+ * pop the matching open character from the stack
+ */
+ if (pairIndex >= 0 && (pairIndex & 1) != 0) {
+ pop(scriptRun);
+ }
+ } else {
+ /*
+ * if the run broke on a surrogate pair,
+ * end it before the high surrogate
+ */
+ if (ch >= 0x10000) {
+ scriptRun->scriptLimit -= 1;
+ }
+
+ break;
+ }
+ }
+
+
+ if (pRunStart != NULL) {
+ *pRunStart = scriptRun->scriptStart;
+ }
+
+ if (pRunLimit != NULL) {
+ *pRunLimit = scriptRun->scriptLimit;
+ }
+
+ if (pRunScript != NULL) {
+ *pRunScript = scriptRun->scriptCode;
+ }
+
+ return TRUE;
+}
diff --git a/contrib/libs/icu/common/usc_impl.h b/contrib/libs/icu/common/usc_impl.h
index 74dc57a974..44899649d4 100644
--- a/contrib/libs/icu/common/usc_impl.h
+++ b/contrib/libs/icu/common/usc_impl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/uscript.cpp b/contrib/libs/icu/common/uscript.cpp
index 84a44ff57a..f8bd7e7fdd 100644
--- a/contrib/libs/icu/common/uscript.cpp
+++ b/contrib/libs/icu/common/uscript.cpp
@@ -1,149 +1,149 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-**********************************************************************
-* Copyright (C) 1997-2014, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
-*
-* File USCRIPT.C
-*
-* Modification History:
-*
-* Date Name Description
-* 07/06/2001 Ram Creation.
-******************************************************************************
-*/
-
-#include "unicode/uchar.h"
-#include "unicode/uscript.h"
-#include "unicode/uloc.h"
-#include "bytesinkutil.h"
-#include "charstr.h"
-#include "cmemory.h"
-#include "cstring.h"
-#include "ulocimp.h"
-
-static const UScriptCode JAPANESE[3] = { USCRIPT_KATAKANA, USCRIPT_HIRAGANA, USCRIPT_HAN };
-static const UScriptCode KOREAN[2] = { USCRIPT_HANGUL, USCRIPT_HAN };
-static const UScriptCode HAN_BOPO[2] = { USCRIPT_HAN, USCRIPT_BOPOMOFO };
-
-static int32_t
-setCodes(const UScriptCode *src, int32_t length,
- UScriptCode *dest, int32_t capacity, UErrorCode *err) {
- int32_t i;
- if(U_FAILURE(*err)) { return 0; }
- if(length > capacity) {
- *err = U_BUFFER_OVERFLOW_ERROR;
- return length;
- }
- for(i = 0; i < length; ++i) {
- dest[i] = src[i];
- }
- return length;
-}
-
-static int32_t
-setOneCode(UScriptCode script, UScriptCode *scripts, int32_t capacity, UErrorCode *err) {
- if(U_FAILURE(*err)) { return 0; }
- if(1 > capacity) {
- *err = U_BUFFER_OVERFLOW_ERROR;
- return 1;
- }
- scripts[0] = script;
- return 1;
-}
-
-static int32_t
-getCodesFromLocale(const char *locale,
- UScriptCode *scripts, int32_t capacity, UErrorCode *err) {
- UErrorCode internalErrorCode = U_ZERO_ERROR;
- char lang[8] = {0};
- char script[8] = {0};
- int32_t scriptLength;
- if(U_FAILURE(*err)) { return 0; }
- // Multi-script languages, equivalent to the LocaleScript data
- // that we used to load from locale resource bundles.
- /*length = */ uloc_getLanguage(locale, lang, UPRV_LENGTHOF(lang), &internalErrorCode);
- if(U_FAILURE(internalErrorCode) || internalErrorCode == U_STRING_NOT_TERMINATED_WARNING) {
- return 0;
- }
- if(0 == uprv_strcmp(lang, "ja")) {
- return setCodes(JAPANESE, UPRV_LENGTHOF(JAPANESE), scripts, capacity, err);
- }
- if(0 == uprv_strcmp(lang, "ko")) {
- return setCodes(KOREAN, UPRV_LENGTHOF(KOREAN), scripts, capacity, err);
- }
- scriptLength = uloc_getScript(locale, script, UPRV_LENGTHOF(script), &internalErrorCode);
- if(U_FAILURE(internalErrorCode) || internalErrorCode == U_STRING_NOT_TERMINATED_WARNING) {
- return 0;
- }
- if(0 == uprv_strcmp(lang, "zh") && 0 == uprv_strcmp(script, "Hant")) {
- return setCodes(HAN_BOPO, UPRV_LENGTHOF(HAN_BOPO), scripts, capacity, err);
- }
- // Explicit script code.
- if(scriptLength != 0) {
- UScriptCode scriptCode = (UScriptCode)u_getPropertyValueEnum(UCHAR_SCRIPT, script);
- if(scriptCode != USCRIPT_INVALID_CODE) {
- if(scriptCode == USCRIPT_SIMPLIFIED_HAN || scriptCode == USCRIPT_TRADITIONAL_HAN) {
- scriptCode = USCRIPT_HAN;
- }
- return setOneCode(scriptCode, scripts, capacity, err);
- }
- }
- return 0;
-}
-
-/* TODO: this is a bad API and should be deprecated, ticket #11141 */
-U_CAPI int32_t U_EXPORT2
-uscript_getCode(const char* nameOrAbbrOrLocale,
- UScriptCode* fillIn,
- int32_t capacity,
- UErrorCode* err){
- UBool triedCode;
- UErrorCode internalErrorCode;
- int32_t length;
-
- if(U_FAILURE(*err)) {
- return 0;
- }
- if(nameOrAbbrOrLocale==NULL ||
- (fillIn == NULL ? capacity != 0 : capacity < 0)) {
- *err = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- triedCode = FALSE;
- if(uprv_strchr(nameOrAbbrOrLocale, '-')==NULL && uprv_strchr(nameOrAbbrOrLocale, '_')==NULL ){
- /* try long and abbreviated script names first */
- UScriptCode code = (UScriptCode) u_getPropertyValueEnum(UCHAR_SCRIPT, nameOrAbbrOrLocale);
- if(code!=USCRIPT_INVALID_CODE) {
- return setOneCode(code, fillIn, capacity, err);
- }
- triedCode = TRUE;
- }
- internalErrorCode = U_ZERO_ERROR;
- length = getCodesFromLocale(nameOrAbbrOrLocale, fillIn, capacity, err);
- if(U_FAILURE(*err) || length != 0) {
- return length;
- }
- icu::CharString likely;
- {
- icu::CharStringByteSink sink(&likely);
- ulocimp_addLikelySubtags(nameOrAbbrOrLocale, sink, &internalErrorCode);
- }
- if(U_SUCCESS(internalErrorCode) && internalErrorCode != U_STRING_NOT_TERMINATED_WARNING) {
- length = getCodesFromLocale(likely.data(), fillIn, capacity, err);
- if(U_FAILURE(*err) || length != 0) {
- return length;
- }
- }
- if(!triedCode) {
- /* still not found .. try long and abbreviated script names again */
- UScriptCode code = (UScriptCode) u_getPropertyValueEnum(UCHAR_SCRIPT, nameOrAbbrOrLocale);
- if(code!=USCRIPT_INVALID_CODE) {
- return setOneCode(code, fillIn, capacity, err);
- }
- }
- return 0;
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+**********************************************************************
+* Copyright (C) 1997-2014, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+*
+* File USCRIPT.C
+*
+* Modification History:
+*
+* Date Name Description
+* 07/06/2001 Ram Creation.
+******************************************************************************
+*/
+
+#include "unicode/uchar.h"
+#include "unicode/uscript.h"
+#include "unicode/uloc.h"
+#include "bytesinkutil.h"
+#include "charstr.h"
+#include "cmemory.h"
+#include "cstring.h"
+#include "ulocimp.h"
+
+static const UScriptCode JAPANESE[3] = { USCRIPT_KATAKANA, USCRIPT_HIRAGANA, USCRIPT_HAN };
+static const UScriptCode KOREAN[2] = { USCRIPT_HANGUL, USCRIPT_HAN };
+static const UScriptCode HAN_BOPO[2] = { USCRIPT_HAN, USCRIPT_BOPOMOFO };
+
+static int32_t
+setCodes(const UScriptCode *src, int32_t length,
+ UScriptCode *dest, int32_t capacity, UErrorCode *err) {
+ int32_t i;
+ if(U_FAILURE(*err)) { return 0; }
+ if(length > capacity) {
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ return length;
+ }
+ for(i = 0; i < length; ++i) {
+ dest[i] = src[i];
+ }
+ return length;
+}
+
+static int32_t
+setOneCode(UScriptCode script, UScriptCode *scripts, int32_t capacity, UErrorCode *err) {
+ if(U_FAILURE(*err)) { return 0; }
+ if(1 > capacity) {
+ *err = U_BUFFER_OVERFLOW_ERROR;
+ return 1;
+ }
+ scripts[0] = script;
+ return 1;
+}
+
+static int32_t
+getCodesFromLocale(const char *locale,
+ UScriptCode *scripts, int32_t capacity, UErrorCode *err) {
+ UErrorCode internalErrorCode = U_ZERO_ERROR;
+ char lang[8] = {0};
+ char script[8] = {0};
+ int32_t scriptLength;
+ if(U_FAILURE(*err)) { return 0; }
+ // Multi-script languages, equivalent to the LocaleScript data
+ // that we used to load from locale resource bundles.
+ /*length = */ uloc_getLanguage(locale, lang, UPRV_LENGTHOF(lang), &internalErrorCode);
+ if(U_FAILURE(internalErrorCode) || internalErrorCode == U_STRING_NOT_TERMINATED_WARNING) {
+ return 0;
+ }
+ if(0 == uprv_strcmp(lang, "ja")) {
+ return setCodes(JAPANESE, UPRV_LENGTHOF(JAPANESE), scripts, capacity, err);
+ }
+ if(0 == uprv_strcmp(lang, "ko")) {
+ return setCodes(KOREAN, UPRV_LENGTHOF(KOREAN), scripts, capacity, err);
+ }
+ scriptLength = uloc_getScript(locale, script, UPRV_LENGTHOF(script), &internalErrorCode);
+ if(U_FAILURE(internalErrorCode) || internalErrorCode == U_STRING_NOT_TERMINATED_WARNING) {
+ return 0;
+ }
+ if(0 == uprv_strcmp(lang, "zh") && 0 == uprv_strcmp(script, "Hant")) {
+ return setCodes(HAN_BOPO, UPRV_LENGTHOF(HAN_BOPO), scripts, capacity, err);
+ }
+ // Explicit script code.
+ if(scriptLength != 0) {
+ UScriptCode scriptCode = (UScriptCode)u_getPropertyValueEnum(UCHAR_SCRIPT, script);
+ if(scriptCode != USCRIPT_INVALID_CODE) {
+ if(scriptCode == USCRIPT_SIMPLIFIED_HAN || scriptCode == USCRIPT_TRADITIONAL_HAN) {
+ scriptCode = USCRIPT_HAN;
+ }
+ return setOneCode(scriptCode, scripts, capacity, err);
+ }
+ }
+ return 0;
+}
+
+/* TODO: this is a bad API and should be deprecated, ticket #11141 */
+U_CAPI int32_t U_EXPORT2
+uscript_getCode(const char* nameOrAbbrOrLocale,
+ UScriptCode* fillIn,
+ int32_t capacity,
+ UErrorCode* err){
+ UBool triedCode;
+ UErrorCode internalErrorCode;
+ int32_t length;
+
+ if(U_FAILURE(*err)) {
+ return 0;
+ }
+ if(nameOrAbbrOrLocale==NULL ||
+ (fillIn == NULL ? capacity != 0 : capacity < 0)) {
+ *err = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ triedCode = FALSE;
+ if(uprv_strchr(nameOrAbbrOrLocale, '-')==NULL && uprv_strchr(nameOrAbbrOrLocale, '_')==NULL ){
+ /* try long and abbreviated script names first */
+ UScriptCode code = (UScriptCode) u_getPropertyValueEnum(UCHAR_SCRIPT, nameOrAbbrOrLocale);
+ if(code!=USCRIPT_INVALID_CODE) {
+ return setOneCode(code, fillIn, capacity, err);
+ }
+ triedCode = TRUE;
+ }
+ internalErrorCode = U_ZERO_ERROR;
+ length = getCodesFromLocale(nameOrAbbrOrLocale, fillIn, capacity, err);
+ if(U_FAILURE(*err) || length != 0) {
+ return length;
+ }
+ icu::CharString likely;
+ {
+ icu::CharStringByteSink sink(&likely);
+ ulocimp_addLikelySubtags(nameOrAbbrOrLocale, sink, &internalErrorCode);
+ }
+ if(U_SUCCESS(internalErrorCode) && internalErrorCode != U_STRING_NOT_TERMINATED_WARNING) {
+ length = getCodesFromLocale(likely.data(), fillIn, capacity, err);
+ if(U_FAILURE(*err) || length != 0) {
+ return length;
+ }
+ }
+ if(!triedCode) {
+ /* still not found .. try long and abbreviated script names again */
+ UScriptCode code = (UScriptCode) u_getPropertyValueEnum(UCHAR_SCRIPT, nameOrAbbrOrLocale);
+ if(code!=USCRIPT_INVALID_CODE) {
+ return setOneCode(code, fillIn, capacity, err);
+ }
+ }
+ return 0;
+}
diff --git a/contrib/libs/icu/common/uscript_props.cpp b/contrib/libs/icu/common/uscript_props.cpp
index d04fd2e85e..25d287b57a 100644
--- a/contrib/libs/icu/common/uscript_props.cpp
+++ b/contrib/libs/icu/common/uscript_props.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: uscript_props.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -33,7 +33,7 @@ namespace {
const int32_t UNKNOWN = 1 << 21;
const int32_t EXCLUSION = 2 << 21;
const int32_t LIMITED_USE = 3 << 21;
-// st int32_t ASPIRATIONAL = 4 << 21; -- not used any more since Unicode 10
+// st int32_t ASPIRATIONAL = 4 << 21; -- not used any more since Unicode 10
const int32_t RECOMMENDED = 5 << 21;
// Bits 31..24: Single-bit flags
@@ -71,7 +71,7 @@ const int32_t SCRIPT_PROPS[] = {
0x0EA5 | RECOMMENDED | LB_LETTERS, // Laoo
0x004C | RECOMMENDED | CASED, // Latn
0x0D15 | RECOMMENDED, // Mlym
- 0x1826 | EXCLUSION, // Mong
+ 0x1826 | EXCLUSION, // Mong
0x1000 | RECOMMENDED | LB_LETTERS, // Mymr
0x168F | EXCLUSION, // Ogam
0x10300 | EXCLUSION, // Ital
@@ -84,8 +84,8 @@ const int32_t SCRIPT_PROPS[] = {
0x078C | RECOMMENDED | RTL, // Thaa
0x0E17 | RECOMMENDED | LB_LETTERS, // Thai
0x0F40 | RECOMMENDED, // Tibt
- 0x14C0 | LIMITED_USE, // Cans
- 0xA288 | LIMITED_USE | LB_LETTERS, // Yiii
+ 0x14C0 | LIMITED_USE, // Cans
+ 0xA288 | LIMITED_USE | LB_LETTERS, // Yiii
0x1703 | EXCLUSION, // Tglg
0x1723 | EXCLUSION, // Hano
0x1743 | EXCLUSION, // Buhd
@@ -104,7 +104,7 @@ const int32_t SCRIPT_PROPS[] = {
0x10A00 | EXCLUSION | RTL, // Khar
0xA800 | LIMITED_USE, // Sylo
0x1980 | LIMITED_USE | LB_LETTERS, // Talu
- 0x2D30 | LIMITED_USE, // Tfng
+ 0x2D30 | LIMITED_USE, // Tfng
0x103A0 | EXCLUSION, // Xpeo
0x1B05 | LIMITED_USE, // Bali
0x1BC0 | LIMITED_USE, // Batk
@@ -136,7 +136,7 @@ const int32_t SCRIPT_PROPS[] = {
0x1036B | EXCLUSION, // Perm
0xA840 | EXCLUSION, // Phag
0x10900 | EXCLUSION | RTL, // Phnx
- 0x16F00 | LIMITED_USE, // Plrd
+ 0x16F00 | LIMITED_USE, // Plrd
0,
0,
0,
@@ -194,7 +194,7 @@ const int32_t SCRIPT_PROPS[] = {
0,
0,
0x16A4F | EXCLUSION, // Mroo
- 0x1B1C4 | EXCLUSION | LB_LETTERS, // Nshu
+ 0x1B1C4 | EXCLUSION | LB_LETTERS, // Nshu
0x11183 | EXCLUSION, // Shrd
0x110D0 | EXCLUSION, // Sora
0x11680 | EXCLUSION, // Takr
@@ -219,24 +219,24 @@ const int32_t SCRIPT_PROPS[] = {
0x5B57 | RECOMMENDED | LB_LETTERS, // Hanb
0x1112 | RECOMMENDED, // Jamo
0,
- 0x11D10 | EXCLUSION, // Gonm
- 0x11A5C | EXCLUSION, // Soyo
- 0x11A0B | EXCLUSION, // Zanb
- 0x1180B | EXCLUSION, // Dogr
- 0x11D71 | LIMITED_USE, // Gong
- 0x11EE5 | EXCLUSION, // Maka
- 0x16E40 | EXCLUSION | CASED, // Medf
- 0x10D12 | LIMITED_USE | RTL, // Rohg
- 0x10F42 | EXCLUSION | RTL, // Sogd
- 0x10F19 | EXCLUSION | RTL, // Sogo
- 0x10FF1 | EXCLUSION | RTL, // Elym
- 0x1E108 | LIMITED_USE, // Hmnp
- 0x119CE | EXCLUSION, // Nand
- 0x1E2E1 | LIMITED_USE, // Wcho
- 0x10FBF | EXCLUSION | RTL, // Chrs
- 0x1190C | EXCLUSION, // Diak
- 0x18C65 | EXCLUSION | LB_LETTERS, // Kits
- 0x10E88 | EXCLUSION | RTL, // Yezi
+ 0x11D10 | EXCLUSION, // Gonm
+ 0x11A5C | EXCLUSION, // Soyo
+ 0x11A0B | EXCLUSION, // Zanb
+ 0x1180B | EXCLUSION, // Dogr
+ 0x11D71 | LIMITED_USE, // Gong
+ 0x11EE5 | EXCLUSION, // Maka
+ 0x16E40 | EXCLUSION | CASED, // Medf
+ 0x10D12 | LIMITED_USE | RTL, // Rohg
+ 0x10F42 | EXCLUSION | RTL, // Sogd
+ 0x10F19 | EXCLUSION | RTL, // Sogo
+ 0x10FF1 | EXCLUSION | RTL, // Elym
+ 0x1E108 | LIMITED_USE, // Hmnp
+ 0x119CE | EXCLUSION, // Nand
+ 0x1E2E1 | LIMITED_USE, // Wcho
+ 0x10FBF | EXCLUSION | RTL, // Chrs
+ 0x1190C | EXCLUSION, // Diak
+ 0x18C65 | EXCLUSION | LB_LETTERS, // Kits
+ 0x10E88 | EXCLUSION | RTL, // Yezi
// End copy-paste from parsescriptmetadata.py
};
diff --git a/contrib/libs/icu/common/uset.cpp b/contrib/libs/icu/common/uset.cpp
index d1c2de42c3..eae7981d52 100644
--- a/contrib/libs/icu/common/uset.cpp
+++ b/contrib/libs/icu/common/uset.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: uset.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -249,7 +249,7 @@ class USetAccess /* not : public UObject because all methods are static */ {
public:
/* Try to have the compiler inline these*/
inline static int32_t getStringCount(const UnicodeSet& set) {
- return set.stringsSize();
+ return set.stringsSize();
}
inline static const UnicodeString* getString(const UnicodeSet& set,
int32_t i) {
diff --git a/contrib/libs/icu/common/uset_imp.h b/contrib/libs/icu/common/uset_imp.h
index 034708420f..7233b9303c 100644
--- a/contrib/libs/icu/common/uset_imp.h
+++ b/contrib/libs/icu/common/uset_imp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: uset_imp.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/uset_props.cpp b/contrib/libs/icu/common/uset_props.cpp
index dbdcca9f1d..f08e760b10 100644
--- a/contrib/libs/icu/common/uset_props.cpp
+++ b/contrib/libs/icu/common/uset_props.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: uset_props.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/usetiter.cpp b/contrib/libs/icu/common/usetiter.cpp
index bce0d71585..7915169049 100644
--- a/contrib/libs/icu/common/usetiter.cpp
+++ b/contrib/libs/icu/common/usetiter.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -116,7 +116,7 @@ void UnicodeSetIterator::reset() {
stringCount = 0;
} else {
endRange = set->getRangeCount() - 1;
- stringCount = set->stringsSize();
+ stringCount = set->stringsSize();
}
range = 0;
endElement = -1;
diff --git a/contrib/libs/icu/common/ushape.cpp b/contrib/libs/icu/common/ushape.cpp
index 859e7c4783..ae13b5c118 100644
--- a/contrib/libs/icu/common/ushape.cpp
+++ b/contrib/libs/icu/common/ushape.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: ushape.cpp
- * encoding: UTF-8
+ * encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -351,7 +351,7 @@ _shapeToArabicDigitsWithContext(UChar *s, int32_t length,
if(isLogical) {
for(i=0; i<length; ++i) {
c=s[i];
- switch(ubidi_getClass(c)) {
+ switch(ubidi_getClass(c)) {
case U_LEFT_TO_RIGHT: /* L */
case U_RIGHT_TO_LEFT: /* R */
lastStrongWasAL=FALSE;
@@ -371,7 +371,7 @@ _shapeToArabicDigitsWithContext(UChar *s, int32_t length,
} else {
for(i=length; i>0; /* pre-decrement in the body */) {
c=s[--i];
- switch(ubidi_getClass(c)) {
+ switch(ubidi_getClass(c)) {
case U_LEFT_TO_RIGHT: /* L */
case U_RIGHT_TO_LEFT: /* R */
lastStrongWasAL=FALSE;
@@ -1323,7 +1323,7 @@ shapeUnicode(UChar *dest, int32_t sourceLength,
/* to ensure the array index is within the range */
U_ASSERT(dest[i] >= 0x064Bu
&& dest[i]-0x064Bu < UPRV_LENGTHOF(IrrelevantPos));
- dest[i] = 0xFE70 + IrrelevantPos[(dest[i] - 0x064B)] + static_cast<UChar>(Shape);
+ dest[i] = 0xFE70 + IrrelevantPos[(dest[i] - 0x064B)] + static_cast<UChar>(Shape);
}
}else if ((currLink & APRESENT) > 0) {
dest[i] = (UChar)(0xFB50 + (currLink >> 8) + Shape);
diff --git a/contrib/libs/icu/common/usprep.cpp b/contrib/libs/icu/common/usprep.cpp
index 8369c91265..8351a77370 100644
--- a/contrib/libs/icu/common/usprep.cpp
+++ b/contrib/libs/icu/common/usprep.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: usprep.cpp
- * encoding: UTF-8
+ * encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -45,9 +45,9 @@ U_CDECL_BEGIN
Static cache for already opened StringPrep profiles
*/
static UHashtable *SHARED_DATA_HASHTABLE = NULL;
-static icu::UInitOnce gSharedDataInitOnce = U_INITONCE_INITIALIZER;
+static icu::UInitOnce gSharedDataInitOnce = U_INITONCE_INITIALIZER;
-static UMutex usprepMutex;
+static UMutex usprepMutex;
/* format version of spp file */
//static uint8_t formatVersion[4]={ 0, 0, 0, 0 };
@@ -111,9 +111,9 @@ hashEntry(const UHashTok parm) {
UHashTok namekey, pathkey;
namekey.pointer = b->name;
pathkey.pointer = b->path;
- uint32_t unsignedHash = static_cast<uint32_t>(uhash_hashChars(namekey)) +
- 37u * static_cast<uint32_t>(uhash_hashChars(pathkey));
- return static_cast<int32_t>(unsignedHash);
+ uint32_t unsignedHash = static_cast<uint32_t>(uhash_hashChars(namekey)) +
+ 37u * static_cast<uint32_t>(uhash_hashChars(pathkey));
+ return static_cast<int32_t>(unsignedHash);
}
/* compares two entries */
@@ -352,9 +352,9 @@ usprep_getProfile(const char* path,
LocalMemory<char> keyName;
LocalMemory<char> keyPath;
if( key.allocateInsteadAndReset() == NULL ||
- keyName.allocateInsteadAndCopy(static_cast<int32_t>(uprv_strlen(name)+1)) == NULL ||
+ keyName.allocateInsteadAndCopy(static_cast<int32_t>(uprv_strlen(name)+1)) == NULL ||
(path != NULL &&
- keyPath.allocateInsteadAndCopy(static_cast<int32_t>(uprv_strlen(path)+1)) == NULL)
+ keyPath.allocateInsteadAndCopy(static_cast<int32_t>(uprv_strlen(path)+1)) == NULL)
) {
*status = U_MEMORY_ALLOCATION_ERROR;
usprep_unload(newProfile.getAlias());
@@ -727,12 +727,12 @@ usprep_prepare( const UStringPrepProfile* profile,
((result < _SPREP_TYPE_THRESHOLD) && (result & 0x01) /* first bit says it the code point is prohibited*/)
){
*status = U_STRINGPREP_PROHIBITED_ERROR;
- uprv_syntaxError(b2, b2Index-U16_LENGTH(ch), b2Len, parseError);
+ uprv_syntaxError(b2, b2Index-U16_LENGTH(ch), b2Len, parseError);
return 0;
}
if(profile->checkBiDi) {
- direction = ubidi_getClass(ch);
+ direction = ubidi_getClass(ch);
if(firstCharDir == U_CHAR_DIRECTION_COUNT){
firstCharDir = direction;
}
diff --git a/contrib/libs/icu/common/ustack.cpp b/contrib/libs/icu/common/ustack.cpp
index b9c7aa2ba3..fb314b0ebe 100644
--- a/contrib/libs/icu/common/ustack.cpp
+++ b/contrib/libs/icu/common/ustack.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/ustr_cnv.cpp b/contrib/libs/icu/common/ustr_cnv.cpp
index 55113093ae..9a25a9905a 100644
--- a/contrib/libs/icu/common/ustr_cnv.cpp
+++ b/contrib/libs/icu/common/ustr_cnv.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: ustr_cnv.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -28,7 +28,7 @@
#include "cmemory.h"
#include "umutex.h"
#include "ustr_cnv.h"
-#include "ucnv_bld.h"
+#include "ucnv_bld.h"
/* mutexed access to a shared default converter ----------------------------- */
@@ -40,14 +40,14 @@ u_getDefaultConverter(UErrorCode *status)
UConverter *converter = NULL;
if (gDefaultConverter != NULL) {
- icu::umtx_lock(NULL);
+ icu::umtx_lock(NULL);
/* need to check to make sure it wasn't taken out from under us */
if (gDefaultConverter != NULL) {
converter = gDefaultConverter;
gDefaultConverter = NULL;
}
- icu::umtx_unlock(NULL);
+ icu::umtx_unlock(NULL);
}
/* if the cache was empty, create a converter */
@@ -69,13 +69,13 @@ u_releaseDefaultConverter(UConverter *converter)
if (converter != NULL) {
ucnv_reset(converter);
}
- ucnv_enableCleanup();
- icu::umtx_lock(NULL);
+ ucnv_enableCleanup();
+ icu::umtx_lock(NULL);
if(gDefaultConverter == NULL) {
gDefaultConverter = converter;
converter = NULL;
}
- icu::umtx_unlock(NULL);
+ icu::umtx_unlock(NULL);
}
if(converter != NULL) {
@@ -89,14 +89,14 @@ u_flushDefaultConverter()
UConverter *converter = NULL;
if (gDefaultConverter != NULL) {
- icu::umtx_lock(NULL);
+ icu::umtx_lock(NULL);
/* need to check to make sure it wasn't taken out from under us */
if (gDefaultConverter != NULL) {
converter = gDefaultConverter;
gDefaultConverter = NULL;
}
- icu::umtx_unlock(NULL);
+ icu::umtx_unlock(NULL);
}
/* if the cache was populated, flush it */
diff --git a/contrib/libs/icu/common/ustr_cnv.h b/contrib/libs/icu/common/ustr_cnv.h
index f0cec4554c..861e3ebff0 100644
--- a/contrib/libs/icu/common/ustr_cnv.h
+++ b/contrib/libs/icu/common/ustr_cnv.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: ustr_cnv.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/ustr_imp.h b/contrib/libs/icu/common/ustr_imp.h
index db439a5a60..07170922d2 100644
--- a/contrib/libs/icu/common/ustr_imp.h
+++ b/contrib/libs/icu/common/ustr_imp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: ustr_imp.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -18,7 +18,7 @@
#define __USTR_IMP_H__
#include "unicode/utypes.h"
-#include "unicode/utf8.h"
+#include "unicode/utf8.h"
/**
* Internal option for unorm_cmpEquivFold() for strncmp style.
@@ -37,26 +37,26 @@ uprv_strCompare(const UChar *s1, int32_t length1,
const UChar *s2, int32_t length2,
UBool strncmpStyle, UBool codePointOrder);
-U_INTERNAL int32_t U_EXPORT2
-ustr_hashUCharsN(const UChar *str, int32_t length);
-
-U_INTERNAL int32_t U_EXPORT2
-ustr_hashCharsN(const char *str, int32_t length);
+U_INTERNAL int32_t U_EXPORT2
+ustr_hashUCharsN(const UChar *str, int32_t length);
U_INTERNAL int32_t U_EXPORT2
-ustr_hashICharsN(const char *str, int32_t length);
+ustr_hashCharsN(const char *str, int32_t length);
+
+U_INTERNAL int32_t U_EXPORT2
+ustr_hashICharsN(const char *str, int32_t length);
/**
- * Convert an ASCII-range lowercase character to uppercase.
- *
- * @param c A UChar.
- * @return If UChar is a lowercase ASCII character, returns the uppercase version.
- * Otherwise, returns the input character.
+ * Convert an ASCII-range lowercase character to uppercase.
+ *
+ * @param c A UChar.
+ * @return If UChar is a lowercase ASCII character, returns the uppercase version.
+ * Otherwise, returns the input character.
*/
-U_INTERNAL UChar U_EXPORT2
-u_asciiToUpper(UChar c);
+U_INTERNAL UChar U_EXPORT2
+u_asciiToUpper(UChar c);
-// TODO: Add u_asciiToLower if/when there is a need for it.
+// TODO: Add u_asciiToLower if/when there is a need for it.
/**
* NUL-terminate a UChar * string if possible.
@@ -70,86 +70,86 @@ u_asciiToUpper(UChar c);
* @param pErrorCode ICU error code.
* @return length
*/
-U_INTERNAL int32_t U_EXPORT2
+U_INTERNAL int32_t U_EXPORT2
u_terminateUChars(UChar *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode);
/**
* NUL-terminate a char * string if possible.
* Same as u_terminateUChars() but for a different string type.
*/
-U_INTERNAL int32_t U_EXPORT2
+U_INTERNAL int32_t U_EXPORT2
u_terminateChars(char *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode);
/**
* NUL-terminate a UChar32 * string if possible.
* Same as u_terminateUChars() but for a different string type.
*/
-U_INTERNAL int32_t U_EXPORT2
+U_INTERNAL int32_t U_EXPORT2
u_terminateUChar32s(UChar32 *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode);
/**
* NUL-terminate a wchar_t * string if possible.
* Same as u_terminateUChars() but for a different string type.
*/
-U_INTERNAL int32_t U_EXPORT2
+U_INTERNAL int32_t U_EXPORT2
u_terminateWChars(wchar_t *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode);
-/**
- * Counts the bytes of any whole valid sequence for a UTF-8 lead byte.
- * Returns 1 for ASCII 0..0x7f.
- * Returns 0 for 0x80..0xc1 as well as for 0xf5..0xff.
- * leadByte might be evaluated multiple times.
- *
- * @param leadByte The first byte of a UTF-8 sequence. Must be 0..0xff.
- * @return 0..4
- */
-#define U8_COUNT_BYTES(leadByte) \
- (U8_IS_SINGLE(leadByte) ? 1 : U8_COUNT_BYTES_NON_ASCII(leadByte))
-
-/**
- * Counts the bytes of any whole valid sequence for a UTF-8 lead byte.
- * Returns 0 for 0x00..0xc1 as well as for 0xf5..0xff.
- * leadByte might be evaluated multiple times.
- *
- * @param leadByte The first byte of a UTF-8 sequence. Must be 0..0xff.
- * @return 0 or 2..4
- */
-#define U8_COUNT_BYTES_NON_ASCII(leadByte) \
- (U8_IS_LEAD(leadByte) ? ((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0)+2 : 0)
-
-#ifdef __cplusplus
-
-U_NAMESPACE_BEGIN
-
-class UTF8 {
-public:
- UTF8() = delete; // all static
-
- /**
- * Is t a valid UTF-8 trail byte?
- *
- * @param prev Must be the preceding lead byte if i==1 and length>=3;
- * otherwise ignored.
- * @param t The i-th byte following the lead byte.
- * @param i The index (1..3) of byte t in the byte sequence. 0<i<length
- * @param length The length (2..4) of the byte sequence according to the lead byte.
- * @return TRUE if t is a valid trail byte in this context.
- */
- static inline UBool isValidTrail(int32_t prev, uint8_t t, int32_t i, int32_t length) {
- // The first trail byte after a 3- or 4-byte lead byte
- // needs to be validated together with its lead byte.
- if (length <= 2 || i > 1) {
- return U8_IS_TRAIL(t);
- } else if (length == 3) {
- return U8_IS_VALID_LEAD3_AND_T1(prev, t);
- } else { // length == 4
- return U8_IS_VALID_LEAD4_AND_T1(prev, t);
- }
- }
-};
-
-U_NAMESPACE_END
-
-#endif // __cplusplus
-
+/**
+ * Counts the bytes of any whole valid sequence for a UTF-8 lead byte.
+ * Returns 1 for ASCII 0..0x7f.
+ * Returns 0 for 0x80..0xc1 as well as for 0xf5..0xff.
+ * leadByte might be evaluated multiple times.
+ *
+ * @param leadByte The first byte of a UTF-8 sequence. Must be 0..0xff.
+ * @return 0..4
+ */
+#define U8_COUNT_BYTES(leadByte) \
+ (U8_IS_SINGLE(leadByte) ? 1 : U8_COUNT_BYTES_NON_ASCII(leadByte))
+
+/**
+ * Counts the bytes of any whole valid sequence for a UTF-8 lead byte.
+ * Returns 0 for 0x00..0xc1 as well as for 0xf5..0xff.
+ * leadByte might be evaluated multiple times.
+ *
+ * @param leadByte The first byte of a UTF-8 sequence. Must be 0..0xff.
+ * @return 0 or 2..4
+ */
+#define U8_COUNT_BYTES_NON_ASCII(leadByte) \
+ (U8_IS_LEAD(leadByte) ? ((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0)+2 : 0)
+
+#ifdef __cplusplus
+
+U_NAMESPACE_BEGIN
+
+class UTF8 {
+public:
+ UTF8() = delete; // all static
+
+ /**
+ * Is t a valid UTF-8 trail byte?
+ *
+ * @param prev Must be the preceding lead byte if i==1 and length>=3;
+ * otherwise ignored.
+ * @param t The i-th byte following the lead byte.
+ * @param i The index (1..3) of byte t in the byte sequence. 0<i<length
+ * @param length The length (2..4) of the byte sequence according to the lead byte.
+ * @return TRUE if t is a valid trail byte in this context.
+ */
+ static inline UBool isValidTrail(int32_t prev, uint8_t t, int32_t i, int32_t length) {
+ // The first trail byte after a 3- or 4-byte lead byte
+ // needs to be validated together with its lead byte.
+ if (length <= 2 || i > 1) {
+ return U8_IS_TRAIL(t);
+ } else if (length == 3) {
+ return U8_IS_VALID_LEAD3_AND_T1(prev, t);
+ } else { // length == 4
+ return U8_IS_VALID_LEAD4_AND_T1(prev, t);
+ }
+ }
+};
+
+U_NAMESPACE_END
+
+#endif // __cplusplus
+
#endif
diff --git a/contrib/libs/icu/common/ustr_titlecase_brkiter.cpp b/contrib/libs/icu/common/ustr_titlecase_brkiter.cpp
index ae0b1a67ce..457905eb60 100644
--- a/contrib/libs/icu/common/ustr_titlecase_brkiter.cpp
+++ b/contrib/libs/icu/common/ustr_titlecase_brkiter.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: ustr_titlecase_brkiter.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -22,190 +22,190 @@
#if !UCONFIG_NO_BREAK_ITERATION
#include "unicode/brkiter.h"
-#include "unicode/casemap.h"
-#include "unicode/chariter.h"
-#include "unicode/localpointer.h"
+#include "unicode/casemap.h"
+#include "unicode/chariter.h"
+#include "unicode/localpointer.h"
#include "unicode/ubrk.h"
#include "unicode/ucasemap.h"
-#include "unicode/utext.h"
+#include "unicode/utext.h"
#include "cmemory.h"
-#include "uassert.h"
+#include "uassert.h"
#include "ucase.h"
-#include "ucasemap_imp.h"
+#include "ucasemap_imp.h"
-U_NAMESPACE_BEGIN
+U_NAMESPACE_BEGIN
-/**
- * Whole-string BreakIterator.
- * Titlecasing only calls setText(), first(), and next().
- * We implement the rest only to satisfy the abstract interface.
+/**
+ * Whole-string BreakIterator.
+ * Titlecasing only calls setText(), first(), and next().
+ * We implement the rest only to satisfy the abstract interface.
*/
-class WholeStringBreakIterator : public BreakIterator {
-public:
- WholeStringBreakIterator() : BreakIterator(), length(0) {}
- ~WholeStringBreakIterator() U_OVERRIDE;
- UBool operator==(const BreakIterator&) const U_OVERRIDE;
- WholeStringBreakIterator *clone() const U_OVERRIDE;
- static UClassID U_EXPORT2 getStaticClassID();
- UClassID getDynamicClassID() const U_OVERRIDE;
- CharacterIterator &getText() const U_OVERRIDE;
- UText *getUText(UText *fillIn, UErrorCode &errorCode) const U_OVERRIDE;
- void setText(const UnicodeString &text) U_OVERRIDE;
- void setText(UText *text, UErrorCode &errorCode) U_OVERRIDE;
- void adoptText(CharacterIterator* it) U_OVERRIDE;
- int32_t first() U_OVERRIDE;
- int32_t last() U_OVERRIDE;
- int32_t previous() U_OVERRIDE;
- int32_t next() U_OVERRIDE;
- int32_t current() const U_OVERRIDE;
- int32_t following(int32_t offset) U_OVERRIDE;
- int32_t preceding(int32_t offset) U_OVERRIDE;
- UBool isBoundary(int32_t offset) U_OVERRIDE;
- int32_t next(int32_t n) U_OVERRIDE;
- WholeStringBreakIterator *createBufferClone(void *stackBuffer, int32_t &BufferSize,
- UErrorCode &errorCode) U_OVERRIDE;
- WholeStringBreakIterator &refreshInputText(UText *input, UErrorCode &errorCode) U_OVERRIDE;
-
-private:
- int32_t length;
-};
-
-UOBJECT_DEFINE_RTTI_IMPLEMENTATION(WholeStringBreakIterator)
-
-WholeStringBreakIterator::~WholeStringBreakIterator() {}
-UBool WholeStringBreakIterator::operator==(const BreakIterator&) const { return FALSE; }
-WholeStringBreakIterator *WholeStringBreakIterator::clone() const { return nullptr; }
-
-CharacterIterator &WholeStringBreakIterator::getText() const {
- UPRV_UNREACHABLE; // really should not be called
-}
-UText *WholeStringBreakIterator::getUText(UText * /*fillIn*/, UErrorCode &errorCode) const {
- if (U_SUCCESS(errorCode)) {
- errorCode = U_UNSUPPORTED_ERROR;
+class WholeStringBreakIterator : public BreakIterator {
+public:
+ WholeStringBreakIterator() : BreakIterator(), length(0) {}
+ ~WholeStringBreakIterator() U_OVERRIDE;
+ UBool operator==(const BreakIterator&) const U_OVERRIDE;
+ WholeStringBreakIterator *clone() const U_OVERRIDE;
+ static UClassID U_EXPORT2 getStaticClassID();
+ UClassID getDynamicClassID() const U_OVERRIDE;
+ CharacterIterator &getText() const U_OVERRIDE;
+ UText *getUText(UText *fillIn, UErrorCode &errorCode) const U_OVERRIDE;
+ void setText(const UnicodeString &text) U_OVERRIDE;
+ void setText(UText *text, UErrorCode &errorCode) U_OVERRIDE;
+ void adoptText(CharacterIterator* it) U_OVERRIDE;
+ int32_t first() U_OVERRIDE;
+ int32_t last() U_OVERRIDE;
+ int32_t previous() U_OVERRIDE;
+ int32_t next() U_OVERRIDE;
+ int32_t current() const U_OVERRIDE;
+ int32_t following(int32_t offset) U_OVERRIDE;
+ int32_t preceding(int32_t offset) U_OVERRIDE;
+ UBool isBoundary(int32_t offset) U_OVERRIDE;
+ int32_t next(int32_t n) U_OVERRIDE;
+ WholeStringBreakIterator *createBufferClone(void *stackBuffer, int32_t &BufferSize,
+ UErrorCode &errorCode) U_OVERRIDE;
+ WholeStringBreakIterator &refreshInputText(UText *input, UErrorCode &errorCode) U_OVERRIDE;
+
+private:
+ int32_t length;
+};
+
+UOBJECT_DEFINE_RTTI_IMPLEMENTATION(WholeStringBreakIterator)
+
+WholeStringBreakIterator::~WholeStringBreakIterator() {}
+UBool WholeStringBreakIterator::operator==(const BreakIterator&) const { return FALSE; }
+WholeStringBreakIterator *WholeStringBreakIterator::clone() const { return nullptr; }
+
+CharacterIterator &WholeStringBreakIterator::getText() const {
+ UPRV_UNREACHABLE; // really should not be called
+}
+UText *WholeStringBreakIterator::getUText(UText * /*fillIn*/, UErrorCode &errorCode) const {
+ if (U_SUCCESS(errorCode)) {
+ errorCode = U_UNSUPPORTED_ERROR;
}
- return nullptr;
-}
-
-void WholeStringBreakIterator::setText(const UnicodeString &text) {
- length = text.length();
-}
-void WholeStringBreakIterator::setText(UText *text, UErrorCode &errorCode) {
- if (U_SUCCESS(errorCode)) {
- int64_t length64 = utext_nativeLength(text);
- if (length64 <= INT32_MAX) {
- length = (int32_t)length64;
- } else {
- errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
- }
+ return nullptr;
+}
+
+void WholeStringBreakIterator::setText(const UnicodeString &text) {
+ length = text.length();
+}
+void WholeStringBreakIterator::setText(UText *text, UErrorCode &errorCode) {
+ if (U_SUCCESS(errorCode)) {
+ int64_t length64 = utext_nativeLength(text);
+ if (length64 <= INT32_MAX) {
+ length = (int32_t)length64;
+ } else {
+ errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
+ }
+ }
+}
+void WholeStringBreakIterator::adoptText(CharacterIterator*) {
+ UPRV_UNREACHABLE; // should not be called
+}
+
+int32_t WholeStringBreakIterator::first() { return 0; }
+int32_t WholeStringBreakIterator::last() { return length; }
+int32_t WholeStringBreakIterator::previous() { return 0; }
+int32_t WholeStringBreakIterator::next() { return length; }
+int32_t WholeStringBreakIterator::current() const { return 0; }
+int32_t WholeStringBreakIterator::following(int32_t /*offset*/) { return length; }
+int32_t WholeStringBreakIterator::preceding(int32_t /*offset*/) { return 0; }
+UBool WholeStringBreakIterator::isBoundary(int32_t /*offset*/) { return FALSE; }
+int32_t WholeStringBreakIterator::next(int32_t /*n*/) { return length; }
+
+WholeStringBreakIterator *WholeStringBreakIterator::createBufferClone(
+ void * /*stackBuffer*/, int32_t & /*BufferSize*/, UErrorCode &errorCode) {
+ if (U_SUCCESS(errorCode)) {
+ errorCode = U_UNSUPPORTED_ERROR;
+ }
+ return nullptr;
+}
+WholeStringBreakIterator &WholeStringBreakIterator::refreshInputText(
+ UText * /*input*/, UErrorCode &errorCode) {
+ if (U_SUCCESS(errorCode)) {
+ errorCode = U_UNSUPPORTED_ERROR;
}
+ return *this;
}
-void WholeStringBreakIterator::adoptText(CharacterIterator*) {
- UPRV_UNREACHABLE; // should not be called
-}
-
-int32_t WholeStringBreakIterator::first() { return 0; }
-int32_t WholeStringBreakIterator::last() { return length; }
-int32_t WholeStringBreakIterator::previous() { return 0; }
-int32_t WholeStringBreakIterator::next() { return length; }
-int32_t WholeStringBreakIterator::current() const { return 0; }
-int32_t WholeStringBreakIterator::following(int32_t /*offset*/) { return length; }
-int32_t WholeStringBreakIterator::preceding(int32_t /*offset*/) { return 0; }
-UBool WholeStringBreakIterator::isBoundary(int32_t /*offset*/) { return FALSE; }
-int32_t WholeStringBreakIterator::next(int32_t /*n*/) { return length; }
-
-WholeStringBreakIterator *WholeStringBreakIterator::createBufferClone(
- void * /*stackBuffer*/, int32_t & /*BufferSize*/, UErrorCode &errorCode) {
- if (U_SUCCESS(errorCode)) {
- errorCode = U_UNSUPPORTED_ERROR;
- }
- return nullptr;
-}
-WholeStringBreakIterator &WholeStringBreakIterator::refreshInputText(
- UText * /*input*/, UErrorCode &errorCode) {
- if (U_SUCCESS(errorCode)) {
- errorCode = U_UNSUPPORTED_ERROR;
- }
- return *this;
-}
-
-U_CFUNC
-BreakIterator *ustrcase_getTitleBreakIterator(
- const Locale *locale, const char *locID, uint32_t options, BreakIterator *iter,
- LocalPointer<BreakIterator> &ownedIter, UErrorCode &errorCode) {
- if (U_FAILURE(errorCode)) { return nullptr; }
- options &= U_TITLECASE_ITERATOR_MASK;
- if (options != 0 && iter != nullptr) {
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
- }
- if (iter == nullptr) {
- switch (options) {
- case 0:
- iter = BreakIterator::createWordInstance(
- locale != nullptr ? *locale : Locale(locID), errorCode);
- break;
- case U_TITLECASE_WHOLE_STRING:
- iter = new WholeStringBreakIterator();
- if (iter == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- }
- break;
- case U_TITLECASE_SENTENCES:
- iter = BreakIterator::createSentenceInstance(
- locale != nullptr ? *locale : Locale(locID), errorCode);
- break;
- default:
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- break;
- }
- ownedIter.adoptInstead(iter);
- }
- return iter;
-}
-
-int32_t CaseMap::toTitle(
- const char *locale, uint32_t options, BreakIterator *iter,
- const UChar *src, int32_t srcLength,
- UChar *dest, int32_t destCapacity, Edits *edits,
- UErrorCode &errorCode) {
- LocalPointer<BreakIterator> ownedIter;
- iter = ustrcase_getTitleBreakIterator(nullptr, locale, options, iter, ownedIter, errorCode);
- if(iter==NULL) {
- return 0;
- }
- UnicodeString s(srcLength<0, src, srcLength);
- iter->setText(s);
- return ustrcase_map(
- ustrcase_getCaseLocale(locale), options, iter,
- dest, destCapacity,
- src, srcLength,
- ustrcase_internalToTitle, edits, errorCode);
-}
-
-U_NAMESPACE_END
-
-U_NAMESPACE_USE
-
+
+U_CFUNC
+BreakIterator *ustrcase_getTitleBreakIterator(
+ const Locale *locale, const char *locID, uint32_t options, BreakIterator *iter,
+ LocalPointer<BreakIterator> &ownedIter, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return nullptr; }
+ options &= U_TITLECASE_ITERATOR_MASK;
+ if (options != 0 && iter != nullptr) {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return nullptr;
+ }
+ if (iter == nullptr) {
+ switch (options) {
+ case 0:
+ iter = BreakIterator::createWordInstance(
+ locale != nullptr ? *locale : Locale(locID), errorCode);
+ break;
+ case U_TITLECASE_WHOLE_STRING:
+ iter = new WholeStringBreakIterator();
+ if (iter == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ }
+ break;
+ case U_TITLECASE_SENTENCES:
+ iter = BreakIterator::createSentenceInstance(
+ locale != nullptr ? *locale : Locale(locID), errorCode);
+ break;
+ default:
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ break;
+ }
+ ownedIter.adoptInstead(iter);
+ }
+ return iter;
+}
+
+int32_t CaseMap::toTitle(
+ const char *locale, uint32_t options, BreakIterator *iter,
+ const UChar *src, int32_t srcLength,
+ UChar *dest, int32_t destCapacity, Edits *edits,
+ UErrorCode &errorCode) {
+ LocalPointer<BreakIterator> ownedIter;
+ iter = ustrcase_getTitleBreakIterator(nullptr, locale, options, iter, ownedIter, errorCode);
+ if(iter==NULL) {
+ return 0;
+ }
+ UnicodeString s(srcLength<0, src, srcLength);
+ iter->setText(s);
+ return ustrcase_map(
+ ustrcase_getCaseLocale(locale), options, iter,
+ dest, destCapacity,
+ src, srcLength,
+ ustrcase_internalToTitle, edits, errorCode);
+}
+
+U_NAMESPACE_END
+
+U_NAMESPACE_USE
+
U_CAPI int32_t U_EXPORT2
u_strToTitle(UChar *dest, int32_t destCapacity,
const UChar *src, int32_t srcLength,
UBreakIterator *titleIter,
const char *locale,
UErrorCode *pErrorCode) {
- LocalPointer<BreakIterator> ownedIter;
- BreakIterator *iter = ustrcase_getTitleBreakIterator(
- nullptr, locale, 0, reinterpret_cast<BreakIterator *>(titleIter),
- ownedIter, *pErrorCode);
- if (iter == nullptr) {
- return 0;
+ LocalPointer<BreakIterator> ownedIter;
+ BreakIterator *iter = ustrcase_getTitleBreakIterator(
+ nullptr, locale, 0, reinterpret_cast<BreakIterator *>(titleIter),
+ ownedIter, *pErrorCode);
+ if (iter == nullptr) {
+ return 0;
}
- UnicodeString s(srcLength<0, src, srcLength);
- iter->setText(s);
- return ustrcase_mapWithOverlap(
- ustrcase_getCaseLocale(locale), 0, iter,
+ UnicodeString s(srcLength<0, src, srcLength);
+ iter->setText(s);
+ return ustrcase_mapWithOverlap(
+ ustrcase_getCaseLocale(locale), 0, iter,
dest, destCapacity,
src, srcLength,
- ustrcase_internalToTitle, *pErrorCode);
+ ustrcase_internalToTitle, *pErrorCode);
}
U_CAPI int32_t U_EXPORT2
@@ -213,25 +213,25 @@ ucasemap_toTitle(UCaseMap *csm,
UChar *dest, int32_t destCapacity,
const UChar *src, int32_t srcLength,
UErrorCode *pErrorCode) {
- if (U_FAILURE(*pErrorCode)) {
- return 0;
+ if (U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ if (csm->iter == NULL) {
+ LocalPointer<BreakIterator> ownedIter;
+ BreakIterator *iter = ustrcase_getTitleBreakIterator(
+ nullptr, csm->locale, csm->options, nullptr, ownedIter, *pErrorCode);
+ if (iter == nullptr) {
+ return 0;
+ }
+ csm->iter = ownedIter.orphan();
}
- if (csm->iter == NULL) {
- LocalPointer<BreakIterator> ownedIter;
- BreakIterator *iter = ustrcase_getTitleBreakIterator(
- nullptr, csm->locale, csm->options, nullptr, ownedIter, *pErrorCode);
- if (iter == nullptr) {
- return 0;
- }
- csm->iter = ownedIter.orphan();
- }
- UnicodeString s(srcLength<0, src, srcLength);
- csm->iter->setText(s);
+ UnicodeString s(srcLength<0, src, srcLength);
+ csm->iter->setText(s);
return ustrcase_map(
- csm->caseLocale, csm->options, csm->iter,
+ csm->caseLocale, csm->options, csm->iter,
dest, destCapacity,
src, srcLength,
- ustrcase_internalToTitle, NULL, *pErrorCode);
+ ustrcase_internalToTitle, NULL, *pErrorCode);
}
#endif // !UCONFIG_NO_BREAK_ITERATION
diff --git a/contrib/libs/icu/common/ustr_wcs.cpp b/contrib/libs/icu/common/ustr_wcs.cpp
index b33200f9d5..e9f278e969 100644
--- a/contrib/libs/icu/common/ustr_wcs.cpp
+++ b/contrib/libs/icu/common/ustr_wcs.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: ustr_wcs.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -254,7 +254,7 @@ u_strToWCS(wchar_t *dest,
srcLength = u_strlen(src);
}
if(0 < srcLength && srcLength <= destCapacity){
- u_memcpy((UChar *)dest, src, srcLength);
+ u_memcpy((UChar *)dest, src, srcLength);
}
if(pDestLength){
*pDestLength = srcLength;
@@ -342,7 +342,7 @@ _strFromWCS( UChar *dest,
pSrcLimit = src + srcLength;
for(;;){
- int32_t nulLen = 0;
+ int32_t nulLen = 0;
/* find nulls in the string */
while(nulLen<srcLength && pSrc[nulLen++]!=0){
@@ -509,7 +509,7 @@ u_strFromWCS(UChar *dest,
srcLength = u_strlen((const UChar *)src);
}
if(0 < srcLength && srcLength <= destCapacity){
- u_memcpy(dest, (const UChar *)src, srcLength);
+ u_memcpy(dest, (const UChar *)src, srcLength);
}
if(pDestLength){
*pDestLength = srcLength;
diff --git a/contrib/libs/icu/common/ustrcase.cpp b/contrib/libs/icu/common/ustrcase.cpp
index e807c52839..618e847c65 100644
--- a/contrib/libs/icu/common/ustrcase.cpp
+++ b/contrib/libs/icu/common/ustrcase.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: ustrcase.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -22,9 +22,9 @@
#include "unicode/utypes.h"
#include "unicode/brkiter.h"
-#include "unicode/casemap.h"
-#include "unicode/edits.h"
-#include "unicode/stringoptions.h"
+#include "unicode/casemap.h"
+#include "unicode/edits.h"
+#include "unicode/stringoptions.h"
#include "unicode/ustring.h"
#include "unicode/ucasemap.h"
#include "unicode/ubrk.h"
@@ -32,66 +32,66 @@
#include "unicode/utf16.h"
#include "cmemory.h"
#include "ucase.h"
-#include "ucasemap_imp.h"
+#include "ucasemap_imp.h"
#include "ustr_imp.h"
#include "uassert.h"
-U_NAMESPACE_BEGIN
-
-namespace {
-
-int32_t checkOverflowAndEditsError(int32_t destIndex, int32_t destCapacity,
- Edits *edits, UErrorCode &errorCode) {
- if (U_SUCCESS(errorCode)) {
- if (destIndex > destCapacity) {
- errorCode = U_BUFFER_OVERFLOW_ERROR;
- } else if (edits != NULL) {
- edits->copyErrorTo(errorCode);
- }
- }
- return destIndex;
-}
-
+U_NAMESPACE_BEGIN
+
+namespace {
+
+int32_t checkOverflowAndEditsError(int32_t destIndex, int32_t destCapacity,
+ Edits *edits, UErrorCode &errorCode) {
+ if (U_SUCCESS(errorCode)) {
+ if (destIndex > destCapacity) {
+ errorCode = U_BUFFER_OVERFLOW_ERROR;
+ } else if (edits != NULL) {
+ edits->copyErrorTo(errorCode);
+ }
+ }
+ return destIndex;
+}
+
/* Appends a full case mapping result, see UCASE_MAX_STRING_LENGTH. */
-inline int32_t
+inline int32_t
appendResult(UChar *dest, int32_t destIndex, int32_t destCapacity,
- int32_t result, const UChar *s,
- int32_t cpLength, uint32_t options, icu::Edits *edits) {
+ int32_t result, const UChar *s,
+ int32_t cpLength, uint32_t options, icu::Edits *edits) {
UChar32 c;
int32_t length;
/* decode the result */
if(result<0) {
/* (not) original code point */
- if(edits!=NULL) {
- edits->addUnchanged(cpLength);
- }
- if(options & U_OMIT_UNCHANGED_TEXT) {
- return destIndex;
- }
+ if(edits!=NULL) {
+ edits->addUnchanged(cpLength);
+ }
+ if(options & U_OMIT_UNCHANGED_TEXT) {
+ return destIndex;
+ }
c=~result;
- if(destIndex<destCapacity && c<=0xffff) { // BMP slightly-fastpath
- dest[destIndex++]=(UChar)c;
- return destIndex;
- }
- length=cpLength;
+ if(destIndex<destCapacity && c<=0xffff) { // BMP slightly-fastpath
+ dest[destIndex++]=(UChar)c;
+ return destIndex;
+ }
+ length=cpLength;
} else {
- if(result<=UCASE_MAX_STRING_LENGTH) {
- c=U_SENTINEL;
- length=result;
- } else if(destIndex<destCapacity && result<=0xffff) { // BMP slightly-fastpath
- dest[destIndex++]=(UChar)result;
- if(edits!=NULL) {
- edits->addReplace(cpLength, 1);
- }
- return destIndex;
- } else {
- c=result;
- length=U16_LENGTH(c);
- }
- if(edits!=NULL) {
- edits->addReplace(cpLength, length);
- }
+ if(result<=UCASE_MAX_STRING_LENGTH) {
+ c=U_SENTINEL;
+ length=result;
+ } else if(destIndex<destCapacity && result<=0xffff) { // BMP slightly-fastpath
+ dest[destIndex++]=(UChar)result;
+ if(edits!=NULL) {
+ edits->addReplace(cpLength, 1);
+ }
+ return destIndex;
+ } else {
+ c=result;
+ length=U16_LENGTH(c);
+ }
+ if(edits!=NULL) {
+ edits->addReplace(cpLength, length);
+ }
}
if(length>(INT32_MAX-destIndex)) {
return -1; // integer overflow
@@ -126,7 +126,7 @@ appendResult(UChar *dest, int32_t destIndex, int32_t destCapacity,
return destIndex;
}
-inline int32_t
+inline int32_t
appendUChar(UChar *dest, int32_t destIndex, int32_t destCapacity, UChar c) {
if(destIndex<destCapacity) {
dest[destIndex]=c;
@@ -136,34 +136,34 @@ appendUChar(UChar *dest, int32_t destIndex, int32_t destCapacity, UChar c) {
return destIndex+1;
}
-int32_t
-appendNonEmptyUnchanged(UChar *dest, int32_t destIndex, int32_t destCapacity,
- const UChar *s, int32_t length, uint32_t options, icu::Edits *edits) {
- if(edits!=NULL) {
- edits->addUnchanged(length);
+int32_t
+appendNonEmptyUnchanged(UChar *dest, int32_t destIndex, int32_t destCapacity,
+ const UChar *s, int32_t length, uint32_t options, icu::Edits *edits) {
+ if(edits!=NULL) {
+ edits->addUnchanged(length);
+ }
+ if(options & U_OMIT_UNCHANGED_TEXT) {
+ return destIndex;
+ }
+ if(length>(INT32_MAX-destIndex)) {
+ return -1; // integer overflow
+ }
+ if((destIndex+length)<=destCapacity) {
+ u_memcpy(dest+destIndex, s, length);
+ }
+ return destIndex + length;
+}
+
+inline int32_t
+appendUnchanged(UChar *dest, int32_t destIndex, int32_t destCapacity,
+ const UChar *s, int32_t length, uint32_t options, icu::Edits *edits) {
+ if (length <= 0) {
+ return destIndex;
}
- if(options & U_OMIT_UNCHANGED_TEXT) {
- return destIndex;
- }
- if(length>(INT32_MAX-destIndex)) {
- return -1; // integer overflow
- }
- if((destIndex+length)<=destCapacity) {
- u_memcpy(dest+destIndex, s, length);
- }
- return destIndex + length;
+ return appendNonEmptyUnchanged(dest, destIndex, destCapacity, s, length, options, edits);
}
-inline int32_t
-appendUnchanged(UChar *dest, int32_t destIndex, int32_t destCapacity,
- const UChar *s, int32_t length, uint32_t options, icu::Edits *edits) {
- if (length <= 0) {
- return destIndex;
- }
- return appendNonEmptyUnchanged(dest, destIndex, destCapacity, s, length, options, edits);
-}
-
-UChar32 U_CALLCONV
+UChar32 U_CALLCONV
utf16_caseContextIterator(void *context, int8_t dir) {
UCaseContext *csc=(UCaseContext *)context;
UChar32 c;
@@ -195,214 +195,214 @@ utf16_caseContextIterator(void *context, int8_t dir) {
return U_SENTINEL;
}
-/**
- * caseLocale >= 0: Lowercases [srcStart..srcLimit[ but takes context [0..srcLength[ into account.
- * caseLocale < 0: Case-folds [srcStart..srcLimit[.
+/**
+ * caseLocale >= 0: Lowercases [srcStart..srcLimit[ but takes context [0..srcLength[ into account.
+ * caseLocale < 0: Case-folds [srcStart..srcLimit[.
*/
-int32_t toLower(int32_t caseLocale, uint32_t options,
- UChar *dest, int32_t destCapacity,
- const UChar *src, UCaseContext *csc, int32_t srcStart, int32_t srcLimit,
- icu::Edits *edits, UErrorCode &errorCode) {
- const int8_t *latinToLower;
- if (caseLocale == UCASE_LOC_ROOT ||
- (caseLocale >= 0 ?
- !(caseLocale == UCASE_LOC_TURKISH || caseLocale == UCASE_LOC_LITHUANIAN) :
- (options & _FOLD_CASE_OPTIONS_MASK) == U_FOLD_CASE_DEFAULT)) {
- latinToLower = LatinCase::TO_LOWER_NORMAL;
- } else {
- latinToLower = LatinCase::TO_LOWER_TR_LT;
- }
- const UTrie2 *trie = ucase_getTrie();
- int32_t destIndex = 0;
- int32_t prev = srcStart;
- int32_t srcIndex = srcStart;
- for (;;) {
- // fast path for simple cases
- UChar lead = 0;
- while (srcIndex < srcLimit) {
- lead = src[srcIndex];
- int32_t delta;
- if (lead < LatinCase::LONG_S) {
- int8_t d = latinToLower[lead];
- if (d == LatinCase::EXC) { break; }
- ++srcIndex;
- if (d == 0) { continue; }
- delta = d;
- } else if (lead >= 0xd800) {
- break; // surrogate or higher
- } else {
- uint16_t props = UTRIE2_GET16_FROM_U16_SINGLE_LEAD(trie, lead);
- if (UCASE_HAS_EXCEPTION(props)) { break; }
- ++srcIndex;
- if (!UCASE_IS_UPPER_OR_TITLE(props) || (delta = UCASE_GET_DELTA(props)) == 0) {
- continue;
- }
- }
- lead += static_cast<UChar>(delta);
- destIndex = appendUnchanged(dest, destIndex, destCapacity,
- src + prev, srcIndex - 1 - prev, options, edits);
- if (destIndex >= 0) {
- destIndex = appendUChar(dest, destIndex, destCapacity, lead);
- if (edits != nullptr) {
- edits->addReplace(1, 1);
- }
- }
- if (destIndex < 0) {
- errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
- }
- prev = srcIndex;
- }
- if (srcIndex >= srcLimit) {
- break;
- }
- // slow path
- int32_t cpStart = srcIndex++;
- UChar trail;
- UChar32 c;
- if (U16_IS_LEAD(lead) && srcIndex < srcLimit && U16_IS_TRAIL(trail = src[srcIndex])) {
- c = U16_GET_SUPPLEMENTARY(lead, trail);
- ++srcIndex;
+int32_t toLower(int32_t caseLocale, uint32_t options,
+ UChar *dest, int32_t destCapacity,
+ const UChar *src, UCaseContext *csc, int32_t srcStart, int32_t srcLimit,
+ icu::Edits *edits, UErrorCode &errorCode) {
+ const int8_t *latinToLower;
+ if (caseLocale == UCASE_LOC_ROOT ||
+ (caseLocale >= 0 ?
+ !(caseLocale == UCASE_LOC_TURKISH || caseLocale == UCASE_LOC_LITHUANIAN) :
+ (options & _FOLD_CASE_OPTIONS_MASK) == U_FOLD_CASE_DEFAULT)) {
+ latinToLower = LatinCase::TO_LOWER_NORMAL;
+ } else {
+ latinToLower = LatinCase::TO_LOWER_TR_LT;
+ }
+ const UTrie2 *trie = ucase_getTrie();
+ int32_t destIndex = 0;
+ int32_t prev = srcStart;
+ int32_t srcIndex = srcStart;
+ for (;;) {
+ // fast path for simple cases
+ UChar lead = 0;
+ while (srcIndex < srcLimit) {
+ lead = src[srcIndex];
+ int32_t delta;
+ if (lead < LatinCase::LONG_S) {
+ int8_t d = latinToLower[lead];
+ if (d == LatinCase::EXC) { break; }
+ ++srcIndex;
+ if (d == 0) { continue; }
+ delta = d;
+ } else if (lead >= 0xd800) {
+ break; // surrogate or higher
+ } else {
+ uint16_t props = UTRIE2_GET16_FROM_U16_SINGLE_LEAD(trie, lead);
+ if (UCASE_HAS_EXCEPTION(props)) { break; }
+ ++srcIndex;
+ if (!UCASE_IS_UPPER_OR_TITLE(props) || (delta = UCASE_GET_DELTA(props)) == 0) {
+ continue;
+ }
+ }
+ lead += static_cast<UChar>(delta);
+ destIndex = appendUnchanged(dest, destIndex, destCapacity,
+ src + prev, srcIndex - 1 - prev, options, edits);
+ if (destIndex >= 0) {
+ destIndex = appendUChar(dest, destIndex, destCapacity, lead);
+ if (edits != nullptr) {
+ edits->addReplace(1, 1);
+ }
+ }
+ if (destIndex < 0) {
+ errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
+ }
+ prev = srcIndex;
+ }
+ if (srcIndex >= srcLimit) {
+ break;
+ }
+ // slow path
+ int32_t cpStart = srcIndex++;
+ UChar trail;
+ UChar32 c;
+ if (U16_IS_LEAD(lead) && srcIndex < srcLimit && U16_IS_TRAIL(trail = src[srcIndex])) {
+ c = U16_GET_SUPPLEMENTARY(lead, trail);
+ ++srcIndex;
} else {
- c = lead;
- }
- const UChar *s;
- if (caseLocale >= 0) {
- csc->cpStart = cpStart;
- csc->cpLimit = srcIndex;
- c = ucase_toFullLower(c, utf16_caseContextIterator, csc, &s, caseLocale);
- } else {
- c = ucase_toFullFolding(c, &s, options);
- }
- if (c >= 0) {
- destIndex = appendUnchanged(dest, destIndex, destCapacity,
- src + prev, cpStart - prev, options, edits);
- if (destIndex >= 0) {
- destIndex = appendResult(dest, destIndex, destCapacity, c, s,
- srcIndex - cpStart, options, edits);
- }
- if (destIndex < 0) {
- errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
+ c = lead;
+ }
+ const UChar *s;
+ if (caseLocale >= 0) {
+ csc->cpStart = cpStart;
+ csc->cpLimit = srcIndex;
+ c = ucase_toFullLower(c, utf16_caseContextIterator, csc, &s, caseLocale);
+ } else {
+ c = ucase_toFullFolding(c, &s, options);
+ }
+ if (c >= 0) {
+ destIndex = appendUnchanged(dest, destIndex, destCapacity,
+ src + prev, cpStart - prev, options, edits);
+ if (destIndex >= 0) {
+ destIndex = appendResult(dest, destIndex, destCapacity, c, s,
+ srcIndex - cpStart, options, edits);
+ }
+ if (destIndex < 0) {
+ errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
+ }
+ prev = srcIndex;
+ }
+ }
+ destIndex = appendUnchanged(dest, destIndex, destCapacity,
+ src + prev, srcIndex - prev, options, edits);
+ if (destIndex < 0) {
+ errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
+ }
+ return destIndex;
+}
+
+int32_t toUpper(int32_t caseLocale, uint32_t options,
+ UChar *dest, int32_t destCapacity,
+ const UChar *src, UCaseContext *csc, int32_t srcLength,
+ icu::Edits *edits, UErrorCode &errorCode) {
+ const int8_t *latinToUpper;
+ if (caseLocale == UCASE_LOC_TURKISH) {
+ latinToUpper = LatinCase::TO_UPPER_TR;
+ } else {
+ latinToUpper = LatinCase::TO_UPPER_NORMAL;
+ }
+ const UTrie2 *trie = ucase_getTrie();
+ int32_t destIndex = 0;
+ int32_t prev = 0;
+ int32_t srcIndex = 0;
+ for (;;) {
+ // fast path for simple cases
+ UChar lead = 0;
+ while (srcIndex < srcLength) {
+ lead = src[srcIndex];
+ int32_t delta;
+ if (lead < LatinCase::LONG_S) {
+ int8_t d = latinToUpper[lead];
+ if (d == LatinCase::EXC) { break; }
+ ++srcIndex;
+ if (d == 0) { continue; }
+ delta = d;
+ } else if (lead >= 0xd800) {
+ break; // surrogate or higher
+ } else {
+ uint16_t props = UTRIE2_GET16_FROM_U16_SINGLE_LEAD(trie, lead);
+ if (UCASE_HAS_EXCEPTION(props)) { break; }
+ ++srcIndex;
+ if (UCASE_GET_TYPE(props) != UCASE_LOWER || (delta = UCASE_GET_DELTA(props)) == 0) {
+ continue;
+ }
+ }
+ lead += static_cast<UChar>(delta);
+ destIndex = appendUnchanged(dest, destIndex, destCapacity,
+ src + prev, srcIndex - 1 - prev, options, edits);
+ if (destIndex >= 0) {
+ destIndex = appendUChar(dest, destIndex, destCapacity, lead);
+ if (edits != nullptr) {
+ edits->addReplace(1, 1);
+ }
+ }
+ if (destIndex < 0) {
+ errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
+ }
+ prev = srcIndex;
+ }
+ if (srcIndex >= srcLength) {
+ break;
+ }
+ // slow path
+ int32_t cpStart;
+ csc->cpStart = cpStart = srcIndex++;
+ UChar trail;
+ UChar32 c;
+ if (U16_IS_LEAD(lead) && srcIndex < srcLength && U16_IS_TRAIL(trail = src[srcIndex])) {
+ c = U16_GET_SUPPLEMENTARY(lead, trail);
+ ++srcIndex;
+ } else {
+ c = lead;
+ }
+ csc->cpLimit = srcIndex;
+ const UChar *s;
+ c = ucase_toFullUpper(c, utf16_caseContextIterator, csc, &s, caseLocale);
+ if (c >= 0) {
+ destIndex = appendUnchanged(dest, destIndex, destCapacity,
+ src + prev, cpStart - prev, options, edits);
+ if (destIndex >= 0) {
+ destIndex = appendResult(dest, destIndex, destCapacity, c, s,
+ srcIndex - cpStart, options, edits);
+ }
+ if (destIndex < 0) {
+ errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
return 0;
}
- prev = srcIndex;
+ prev = srcIndex;
}
}
- destIndex = appendUnchanged(dest, destIndex, destCapacity,
- src + prev, srcIndex - prev, options, edits);
- if (destIndex < 0) {
- errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
- }
- return destIndex;
-}
-
-int32_t toUpper(int32_t caseLocale, uint32_t options,
- UChar *dest, int32_t destCapacity,
- const UChar *src, UCaseContext *csc, int32_t srcLength,
- icu::Edits *edits, UErrorCode &errorCode) {
- const int8_t *latinToUpper;
- if (caseLocale == UCASE_LOC_TURKISH) {
- latinToUpper = LatinCase::TO_UPPER_TR;
- } else {
- latinToUpper = LatinCase::TO_UPPER_NORMAL;
+ destIndex = appendUnchanged(dest, destIndex, destCapacity,
+ src + prev, srcIndex - prev, options, edits);
+ if (destIndex < 0) {
+ errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
}
- const UTrie2 *trie = ucase_getTrie();
- int32_t destIndex = 0;
- int32_t prev = 0;
- int32_t srcIndex = 0;
- for (;;) {
- // fast path for simple cases
- UChar lead = 0;
- while (srcIndex < srcLength) {
- lead = src[srcIndex];
- int32_t delta;
- if (lead < LatinCase::LONG_S) {
- int8_t d = latinToUpper[lead];
- if (d == LatinCase::EXC) { break; }
- ++srcIndex;
- if (d == 0) { continue; }
- delta = d;
- } else if (lead >= 0xd800) {
- break; // surrogate or higher
- } else {
- uint16_t props = UTRIE2_GET16_FROM_U16_SINGLE_LEAD(trie, lead);
- if (UCASE_HAS_EXCEPTION(props)) { break; }
- ++srcIndex;
- if (UCASE_GET_TYPE(props) != UCASE_LOWER || (delta = UCASE_GET_DELTA(props)) == 0) {
- continue;
- }
- }
- lead += static_cast<UChar>(delta);
- destIndex = appendUnchanged(dest, destIndex, destCapacity,
- src + prev, srcIndex - 1 - prev, options, edits);
- if (destIndex >= 0) {
- destIndex = appendUChar(dest, destIndex, destCapacity, lead);
- if (edits != nullptr) {
- edits->addReplace(1, 1);
- }
- }
- if (destIndex < 0) {
- errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
- }
- prev = srcIndex;
- }
- if (srcIndex >= srcLength) {
- break;
- }
- // slow path
- int32_t cpStart;
- csc->cpStart = cpStart = srcIndex++;
- UChar trail;
- UChar32 c;
- if (U16_IS_LEAD(lead) && srcIndex < srcLength && U16_IS_TRAIL(trail = src[srcIndex])) {
- c = U16_GET_SUPPLEMENTARY(lead, trail);
- ++srcIndex;
- } else {
- c = lead;
- }
- csc->cpLimit = srcIndex;
- const UChar *s;
- c = ucase_toFullUpper(c, utf16_caseContextIterator, csc, &s, caseLocale);
- if (c >= 0) {
- destIndex = appendUnchanged(dest, destIndex, destCapacity,
- src + prev, cpStart - prev, options, edits);
- if (destIndex >= 0) {
- destIndex = appendResult(dest, destIndex, destCapacity, c, s,
- srcIndex - cpStart, options, edits);
- }
- if (destIndex < 0) {
- errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
- }
- prev = srcIndex;
- }
- }
- destIndex = appendUnchanged(dest, destIndex, destCapacity,
- src + prev, srcIndex - prev, options, edits);
- if (destIndex < 0) {
- errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
- }
return destIndex;
}
-} // namespace
-
-U_NAMESPACE_END
-
-U_NAMESPACE_USE
-
+} // namespace
+
+U_NAMESPACE_END
+
+U_NAMESPACE_USE
+
#if !UCONFIG_NO_BREAK_ITERATION
U_CFUNC int32_t U_CALLCONV
-ustrcase_internalToTitle(int32_t caseLocale, uint32_t options, BreakIterator *iter,
+ustrcase_internalToTitle(int32_t caseLocale, uint32_t options, BreakIterator *iter,
UChar *dest, int32_t destCapacity,
const UChar *src, int32_t srcLength,
- icu::Edits *edits,
- UErrorCode &errorCode) {
- if (!ustrcase_checkTitleAdjustmentOptions(options, errorCode)) {
+ icu::Edits *edits,
+ UErrorCode &errorCode) {
+ if (!ustrcase_checkTitleAdjustmentOptions(options, errorCode)) {
return 0;
}
@@ -410,56 +410,56 @@ ustrcase_internalToTitle(int32_t caseLocale, uint32_t options, BreakIterator *it
UCaseContext csc=UCASECONTEXT_INITIALIZER;
csc.p=(void *)src;
csc.limit=srcLength;
- int32_t destIndex=0;
- int32_t prev=0;
- UBool isFirstIndex=TRUE;
+ int32_t destIndex=0;
+ int32_t prev=0;
+ UBool isFirstIndex=TRUE;
/* titlecasing loop */
while(prev<srcLength) {
/* find next index where to titlecase */
- int32_t index;
+ int32_t index;
if(isFirstIndex) {
isFirstIndex=FALSE;
- index=iter->first();
+ index=iter->first();
} else {
- index=iter->next();
+ index=iter->next();
}
- if(index==UBRK_DONE || index>srcLength) {
- index=srcLength;
+ if(index==UBRK_DONE || index>srcLength) {
+ index=srcLength;
}
/*
- * Segment [prev..index[ into 3 parts:
- * a) skipped characters (copy as-is) [prev..titleStart[
- * b) first letter (titlecase) [titleStart..titleLimit[
+ * Segment [prev..index[ into 3 parts:
+ * a) skipped characters (copy as-is) [prev..titleStart[
+ * b) first letter (titlecase) [titleStart..titleLimit[
* c) subsequent characters (lowercase) [titleLimit..index[
*/
- if(prev<index) {
- // Find and copy skipped characters [prev..titleStart[
- int32_t titleStart=prev;
- int32_t titleLimit=prev;
- UChar32 c;
- U16_NEXT(src, titleLimit, index, c);
- if ((options&U_TITLECASE_NO_BREAK_ADJUSTMENT)==0) {
- // Adjust the titlecasing index to the next cased character,
- // or to the next letter/number/symbol/private use.
- // Stop with titleStart<titleLimit<=index
- // if there is a character to be titlecased,
- // or else stop with titleStart==titleLimit==index.
- UBool toCased = (options&U_TITLECASE_ADJUST_TO_CASED) != 0;
- while (toCased ? UCASE_NONE==ucase_getType(c) : !ustrcase_isLNS(c)) {
+ if(prev<index) {
+ // Find and copy skipped characters [prev..titleStart[
+ int32_t titleStart=prev;
+ int32_t titleLimit=prev;
+ UChar32 c;
+ U16_NEXT(src, titleLimit, index, c);
+ if ((options&U_TITLECASE_NO_BREAK_ADJUSTMENT)==0) {
+ // Adjust the titlecasing index to the next cased character,
+ // or to the next letter/number/symbol/private use.
+ // Stop with titleStart<titleLimit<=index
+ // if there is a character to be titlecased,
+ // or else stop with titleStart==titleLimit==index.
+ UBool toCased = (options&U_TITLECASE_ADJUST_TO_CASED) != 0;
+ while (toCased ? UCASE_NONE==ucase_getType(c) : !ustrcase_isLNS(c)) {
titleStart=titleLimit;
- if(titleLimit==index) {
+ if(titleLimit==index) {
break;
}
- U16_NEXT(src, titleLimit, index, c);
- }
- if (prev < titleStart) {
- destIndex=appendUnchanged(dest, destIndex, destCapacity,
- src+prev, titleStart-prev, options, edits);
- if(destIndex<0) {
- errorCode=U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
+ U16_NEXT(src, titleLimit, index, c);
+ }
+ if (prev < titleStart) {
+ destIndex=appendUnchanged(dest, destIndex, destCapacity,
+ src+prev, titleStart-prev, options, edits);
+ if(destIndex<0) {
+ errorCode=U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
}
}
}
@@ -468,63 +468,63 @@ ustrcase_internalToTitle(int32_t caseLocale, uint32_t options, BreakIterator *it
/* titlecase c which is from [titleStart..titleLimit[ */
csc.cpStart=titleStart;
csc.cpLimit=titleLimit;
- const UChar *s;
- c=ucase_toFullTitle(c, utf16_caseContextIterator, &csc, &s, caseLocale);
- destIndex=appendResult(dest, destIndex, destCapacity, c, s,
- titleLimit-titleStart, options, edits);
+ const UChar *s;
+ c=ucase_toFullTitle(c, utf16_caseContextIterator, &csc, &s, caseLocale);
+ destIndex=appendResult(dest, destIndex, destCapacity, c, s,
+ titleLimit-titleStart, options, edits);
if(destIndex<0) {
- errorCode=U_INDEX_OUTOFBOUNDS_ERROR;
+ errorCode=U_INDEX_OUTOFBOUNDS_ERROR;
return 0;
}
/* Special case Dutch IJ titlecasing */
- if (titleStart+1 < index &&
- caseLocale == UCASE_LOC_DUTCH &&
- (src[titleStart] == 0x0049 || src[titleStart] == 0x0069)) {
- if (src[titleStart+1] == 0x006A) {
- destIndex=appendUChar(dest, destIndex, destCapacity, 0x004A);
- if(destIndex<0) {
- errorCode=U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
- }
- if(edits!=NULL) {
- edits->addReplace(1, 1);
- }
- titleLimit++;
- } else if (src[titleStart+1] == 0x004A) {
- // Keep the capital J from getting lowercased.
- destIndex=appendUnchanged(dest, destIndex, destCapacity,
- src+titleStart+1, 1, options, edits);
- if(destIndex<0) {
- errorCode=U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
- }
- titleLimit++;
+ if (titleStart+1 < index &&
+ caseLocale == UCASE_LOC_DUTCH &&
+ (src[titleStart] == 0x0049 || src[titleStart] == 0x0069)) {
+ if (src[titleStart+1] == 0x006A) {
+ destIndex=appendUChar(dest, destIndex, destCapacity, 0x004A);
+ if(destIndex<0) {
+ errorCode=U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
+ }
+ if(edits!=NULL) {
+ edits->addReplace(1, 1);
+ }
+ titleLimit++;
+ } else if (src[titleStart+1] == 0x004A) {
+ // Keep the capital J from getting lowercased.
+ destIndex=appendUnchanged(dest, destIndex, destCapacity,
+ src+titleStart+1, 1, options, edits);
+ if(destIndex<0) {
+ errorCode=U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
+ }
+ titleLimit++;
}
}
/* lowercase [titleLimit..index[ */
- if(titleLimit<index) {
- if((options&U_TITLECASE_NO_LOWERCASE)==0) {
+ if(titleLimit<index) {
+ if((options&U_TITLECASE_NO_LOWERCASE)==0) {
/* Normal operation: Lowercase the rest of the word. */
destIndex+=
- toLower(
- caseLocale, options,
+ toLower(
+ caseLocale, options,
dest+destIndex, destCapacity-destIndex,
- src, &csc, titleLimit, index,
- edits, errorCode);
- if(errorCode==U_BUFFER_OVERFLOW_ERROR) {
- errorCode=U_ZERO_ERROR;
- }
- if(U_FAILURE(errorCode)) {
+ src, &csc, titleLimit, index,
+ edits, errorCode);
+ if(errorCode==U_BUFFER_OVERFLOW_ERROR) {
+ errorCode=U_ZERO_ERROR;
+ }
+ if(U_FAILURE(errorCode)) {
return destIndex;
}
} else {
/* Optionally just copy the rest of the word unchanged. */
- destIndex=appendUnchanged(dest, destIndex, destCapacity,
- src+titleLimit, index-titleLimit, options, edits);
+ destIndex=appendUnchanged(dest, destIndex, destCapacity,
+ src+titleLimit, index-titleLimit, options, edits);
if(destIndex<0) {
- errorCode=U_INDEX_OUTOFBOUNDS_ERROR;
+ errorCode=U_INDEX_OUTOFBOUNDS_ERROR;
return 0;
}
}
@@ -532,10 +532,10 @@ ustrcase_internalToTitle(int32_t caseLocale, uint32_t options, BreakIterator *it
}
}
- prev=index;
+ prev=index;
}
- return checkOverflowAndEditsError(destIndex, destCapacity, edits, errorCode);
+ return checkOverflowAndEditsError(destIndex, destCapacity, edits, errorCode);
}
#endif // !UCONFIG_NO_BREAK_ITERATION
@@ -997,11 +997,11 @@ uint32_t getDiacriticData(UChar32 c) {
}
}
-UBool isFollowedByCasedLetter(const UChar *s, int32_t i, int32_t length) {
+UBool isFollowedByCasedLetter(const UChar *s, int32_t i, int32_t length) {
while (i < length) {
UChar32 c;
U16_NEXT(s, i, length, c);
- int32_t type = ucase_getTypeOrIgnorable(c);
+ int32_t type = ucase_getTypeOrIgnorable(c);
if ((type & UCASE_IGNORABLE) != 0) {
// Case-ignorable, continue with the loop.
} else if (type != UCASE_NONE) {
@@ -1019,11 +1019,11 @@ UBool isFollowedByCasedLetter(const UChar *s, int32_t i, int32_t length) {
* for each character.
* TODO: Try to re-consolidate one way or another with the non-Greek function.
*/
-int32_t toUpper(uint32_t options,
+int32_t toUpper(uint32_t options,
UChar *dest, int32_t destCapacity,
const UChar *src, int32_t srcLength,
- Edits *edits,
- UErrorCode &errorCode) {
+ Edits *edits,
+ UErrorCode &errorCode) {
int32_t destIndex=0;
uint32_t state = 0;
for (int32_t i = 0; i < srcLength;) {
@@ -1031,7 +1031,7 @@ int32_t toUpper(uint32_t options,
UChar32 c;
U16_NEXT(src, nextIndex, srcLength, c);
uint32_t nextState = 0;
- int32_t type = ucase_getTypeOrIgnorable(c);
+ int32_t type = ucase_getTypeOrIgnorable(c);
if ((type & UCASE_IGNORABLE) != 0) {
// c is case-ignorable
nextState |= (state & AFTER_CASED);
@@ -1078,7 +1078,7 @@ int32_t toUpper(uint32_t options,
(data & HAS_ACCENT) != 0 &&
numYpogegrammeni == 0 &&
(state & AFTER_CASED) == 0 &&
- !isFollowedByCasedLetter(src, nextIndex, srcLength)) {
+ !isFollowedByCasedLetter(src, nextIndex, srcLength)) {
// Keep disjunctive "or" with (only) a tonos.
// We use the same "word boundary" conditions as for the Final_Sigma test.
if (i == nextIndex) {
@@ -1096,64 +1096,64 @@ int32_t toUpper(uint32_t options,
data &= ~HAS_EITHER_DIALYTIKA;
}
}
-
- UBool change;
- if (edits == nullptr && (options & U_OMIT_UNCHANGED_TEXT) == 0) {
- change = TRUE; // common, simple usage
- } else {
- // Find out first whether we are changing the text.
- change = src[i] != upper || numYpogegrammeni > 0;
- int32_t i2 = i + 1;
- if ((data & HAS_EITHER_DIALYTIKA) != 0) {
- change |= i2 >= nextIndex || src[i2] != 0x308;
- ++i2;
- }
- if (addTonos) {
- change |= i2 >= nextIndex || src[i2] != 0x301;
- ++i2;
- }
- int32_t oldLength = nextIndex - i;
- int32_t newLength = (i2 - i) + numYpogegrammeni;
- change |= oldLength != newLength;
- if (change) {
- if (edits != NULL) {
- edits->addReplace(oldLength, newLength);
- }
- } else {
- if (edits != NULL) {
- edits->addUnchanged(oldLength);
- }
- // Write unchanged text?
- change = (options & U_OMIT_UNCHANGED_TEXT) == 0;
- }
+
+ UBool change;
+ if (edits == nullptr && (options & U_OMIT_UNCHANGED_TEXT) == 0) {
+ change = TRUE; // common, simple usage
+ } else {
+ // Find out first whether we are changing the text.
+ change = src[i] != upper || numYpogegrammeni > 0;
+ int32_t i2 = i + 1;
+ if ((data & HAS_EITHER_DIALYTIKA) != 0) {
+ change |= i2 >= nextIndex || src[i2] != 0x308;
+ ++i2;
+ }
+ if (addTonos) {
+ change |= i2 >= nextIndex || src[i2] != 0x301;
+ ++i2;
+ }
+ int32_t oldLength = nextIndex - i;
+ int32_t newLength = (i2 - i) + numYpogegrammeni;
+ change |= oldLength != newLength;
+ if (change) {
+ if (edits != NULL) {
+ edits->addReplace(oldLength, newLength);
+ }
+ } else {
+ if (edits != NULL) {
+ edits->addUnchanged(oldLength);
+ }
+ // Write unchanged text?
+ change = (options & U_OMIT_UNCHANGED_TEXT) == 0;
+ }
}
-
- if (change) {
- destIndex=appendUChar(dest, destIndex, destCapacity, (UChar)upper);
- if (destIndex >= 0 && (data & HAS_EITHER_DIALYTIKA) != 0) {
- destIndex=appendUChar(dest, destIndex, destCapacity, 0x308); // restore or add a dialytika
- }
- if (destIndex >= 0 && addTonos) {
- destIndex=appendUChar(dest, destIndex, destCapacity, 0x301);
- }
- while (destIndex >= 0 && numYpogegrammeni > 0) {
- destIndex=appendUChar(dest, destIndex, destCapacity, 0x399);
- --numYpogegrammeni;
- }
+
+ if (change) {
+ destIndex=appendUChar(dest, destIndex, destCapacity, (UChar)upper);
+ if (destIndex >= 0 && (data & HAS_EITHER_DIALYTIKA) != 0) {
+ destIndex=appendUChar(dest, destIndex, destCapacity, 0x308); // restore or add a dialytika
+ }
+ if (destIndex >= 0 && addTonos) {
+ destIndex=appendUChar(dest, destIndex, destCapacity, 0x301);
+ }
+ while (destIndex >= 0 && numYpogegrammeni > 0) {
+ destIndex=appendUChar(dest, destIndex, destCapacity, 0x399);
+ --numYpogegrammeni;
+ }
if(destIndex<0) {
- errorCode=U_INDEX_OUTOFBOUNDS_ERROR;
+ errorCode=U_INDEX_OUTOFBOUNDS_ERROR;
return 0;
}
}
- } else {
- const UChar *s;
- c=ucase_toFullUpper(c, NULL, NULL, &s, UCASE_LOC_GREEK);
- destIndex = appendResult(dest, destIndex, destCapacity, c, s,
- nextIndex - i, options, edits);
- if (destIndex < 0) {
- errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
- }
+ } else {
+ const UChar *s;
+ c=ucase_toFullUpper(c, NULL, NULL, &s, UCASE_LOC_GREEK);
+ destIndex = appendResult(dest, destIndex, destCapacity, c, s,
+ nextIndex - i, options, edits);
+ if (destIndex < 0) {
+ errorCode = U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
+ }
}
i = nextIndex;
state = nextState;
@@ -1168,116 +1168,116 @@ U_NAMESPACE_END
/* functions available in the common library (for unistr_case.cpp) */
U_CFUNC int32_t U_CALLCONV
-ustrcase_internalToLower(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_UNUSED
+ustrcase_internalToLower(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_UNUSED
UChar *dest, int32_t destCapacity,
const UChar *src, int32_t srcLength,
- icu::Edits *edits,
- UErrorCode &errorCode) {
+ icu::Edits *edits,
+ UErrorCode &errorCode) {
UCaseContext csc=UCASECONTEXT_INITIALIZER;
csc.p=(void *)src;
csc.limit=srcLength;
- int32_t destIndex = toLower(
- caseLocale, options,
+ int32_t destIndex = toLower(
+ caseLocale, options,
dest, destCapacity,
src, &csc, 0, srcLength,
- edits, errorCode);
- return checkOverflowAndEditsError(destIndex, destCapacity, edits, errorCode);
+ edits, errorCode);
+ return checkOverflowAndEditsError(destIndex, destCapacity, edits, errorCode);
}
U_CFUNC int32_t U_CALLCONV
-ustrcase_internalToUpper(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_UNUSED
+ustrcase_internalToUpper(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_UNUSED
UChar *dest, int32_t destCapacity,
const UChar *src, int32_t srcLength,
- icu::Edits *edits,
- UErrorCode &errorCode) {
- int32_t destIndex;
- if (caseLocale == UCASE_LOC_GREEK) {
- destIndex = GreekUpper::toUpper(options, dest, destCapacity,
- src, srcLength, edits, errorCode);
- } else {
- UCaseContext csc=UCASECONTEXT_INITIALIZER;
- csc.p=(void *)src;
- csc.limit=srcLength;
- destIndex = toUpper(
- caseLocale, options,
- dest, destCapacity,
- src, &csc, srcLength,
- edits, errorCode);
+ icu::Edits *edits,
+ UErrorCode &errorCode) {
+ int32_t destIndex;
+ if (caseLocale == UCASE_LOC_GREEK) {
+ destIndex = GreekUpper::toUpper(options, dest, destCapacity,
+ src, srcLength, edits, errorCode);
+ } else {
+ UCaseContext csc=UCASECONTEXT_INITIALIZER;
+ csc.p=(void *)src;
+ csc.limit=srcLength;
+ destIndex = toUpper(
+ caseLocale, options,
+ dest, destCapacity,
+ src, &csc, srcLength,
+ edits, errorCode);
}
- return checkOverflowAndEditsError(destIndex, destCapacity, edits, errorCode);
-}
-
-U_CFUNC int32_t U_CALLCONV
-ustrcase_internalFold(int32_t /* caseLocale */, uint32_t options, UCASEMAP_BREAK_ITERATOR_UNUSED
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
- icu::Edits *edits,
- UErrorCode &errorCode) {
- int32_t destIndex = toLower(
- -1, options,
+ return checkOverflowAndEditsError(destIndex, destCapacity, edits, errorCode);
+}
+
+U_CFUNC int32_t U_CALLCONV
+ustrcase_internalFold(int32_t /* caseLocale */, uint32_t options, UCASEMAP_BREAK_ITERATOR_UNUSED
+ UChar *dest, int32_t destCapacity,
+ const UChar *src, int32_t srcLength,
+ icu::Edits *edits,
+ UErrorCode &errorCode) {
+ int32_t destIndex = toLower(
+ -1, options,
dest, destCapacity,
- src, nullptr, 0, srcLength,
- edits, errorCode);
- return checkOverflowAndEditsError(destIndex, destCapacity, edits, errorCode);
+ src, nullptr, 0, srcLength,
+ edits, errorCode);
+ return checkOverflowAndEditsError(destIndex, destCapacity, edits, errorCode);
}
-U_CFUNC int32_t
-ustrcase_map(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
- UStringCaseMapper *stringCaseMapper,
- icu::Edits *edits,
- UErrorCode &errorCode) {
- int32_t destLength;
-
- /* check argument values */
- if(U_FAILURE(errorCode)) {
- return 0;
- }
- if( destCapacity<0 ||
- (dest==NULL && destCapacity>0) ||
- src==NULL ||
- srcLength<-1
- ) {
- errorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* get the string length */
- if(srcLength==-1) {
- srcLength=u_strlen(src);
+U_CFUNC int32_t
+ustrcase_map(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
+ UChar *dest, int32_t destCapacity,
+ const UChar *src, int32_t srcLength,
+ UStringCaseMapper *stringCaseMapper,
+ icu::Edits *edits,
+ UErrorCode &errorCode) {
+ int32_t destLength;
+
+ /* check argument values */
+ if(U_FAILURE(errorCode)) {
+ return 0;
+ }
+ if( destCapacity<0 ||
+ (dest==NULL && destCapacity>0) ||
+ src==NULL ||
+ srcLength<-1
+ ) {
+ errorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
}
- /* check for overlapping source and destination */
- if( dest!=NULL &&
- ((src>=dest && src<(dest+destCapacity)) ||
- (dest>=src && dest<(src+srcLength)))
- ) {
- errorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
+ /* get the string length */
+ if(srcLength==-1) {
+ srcLength=u_strlen(src);
}
- if (edits != nullptr && (options & U_EDITS_NO_RESET) == 0) {
- edits->reset();
- }
- destLength=stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR
- dest, destCapacity, src, srcLength, edits, errorCode);
- return u_terminateUChars(dest, destCapacity, destLength, &errorCode);
+ /* check for overlapping source and destination */
+ if( dest!=NULL &&
+ ((src>=dest && src<(dest+destCapacity)) ||
+ (dest>=src && dest<(src+srcLength)))
+ ) {
+ errorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ if (edits != nullptr && (options & U_EDITS_NO_RESET) == 0) {
+ edits->reset();
+ }
+ destLength=stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR
+ dest, destCapacity, src, srcLength, edits, errorCode);
+ return u_terminateUChars(dest, destCapacity, destLength, &errorCode);
}
U_CFUNC int32_t
-ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
- UStringCaseMapper *stringCaseMapper,
- UErrorCode &errorCode) {
+ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
+ UChar *dest, int32_t destCapacity,
+ const UChar *src, int32_t srcLength,
+ UStringCaseMapper *stringCaseMapper,
+ UErrorCode &errorCode) {
UChar buffer[300];
UChar *temp;
int32_t destLength;
/* check argument values */
- if(U_FAILURE(errorCode)) {
+ if(U_FAILURE(errorCode)) {
return 0;
}
if( destCapacity<0 ||
@@ -1285,7 +1285,7 @@ ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITE
src==NULL ||
srcLength<-1
) {
- errorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ errorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -1307,7 +1307,7 @@ ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITE
/* allocate a buffer */
temp=(UChar *)uprv_malloc(destCapacity*U_SIZEOF_UCHAR);
if(temp==NULL) {
- errorCode=U_MEMORY_ALLOCATION_ERROR;
+ errorCode=U_MEMORY_ALLOCATION_ERROR;
return 0;
}
}
@@ -1315,19 +1315,19 @@ ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITE
temp=dest;
}
- destLength=stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR
- temp, destCapacity, src, srcLength, NULL, errorCode);
+ destLength=stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR
+ temp, destCapacity, src, srcLength, NULL, errorCode);
if(temp!=dest) {
/* copy the result string to the destination buffer */
- if (U_SUCCESS(errorCode) && 0 < destLength && destLength <= destCapacity) {
- u_memmove(dest, temp, destLength);
+ if (U_SUCCESS(errorCode) && 0 < destLength && destLength <= destCapacity) {
+ u_memmove(dest, temp, destLength);
}
if(temp!=buffer) {
uprv_free(temp);
}
}
- return u_terminateUChars(dest, destCapacity, destLength, &errorCode);
+ return u_terminateUChars(dest, destCapacity, destLength, &errorCode);
}
/* public API functions */
@@ -1337,29 +1337,29 @@ u_strFoldCase(UChar *dest, int32_t destCapacity,
const UChar *src, int32_t srcLength,
uint32_t options,
UErrorCode *pErrorCode) {
- return ustrcase_mapWithOverlap(
- UCASE_LOC_ROOT, options, UCASEMAP_BREAK_ITERATOR_NULL
- dest, destCapacity,
- src, srcLength,
- ustrcase_internalFold, *pErrorCode);
-}
-
-U_NAMESPACE_BEGIN
-
-int32_t CaseMap::fold(
- uint32_t options,
- const UChar *src, int32_t srcLength,
- UChar *dest, int32_t destCapacity, Edits *edits,
- UErrorCode &errorCode) {
+ return ustrcase_mapWithOverlap(
+ UCASE_LOC_ROOT, options, UCASEMAP_BREAK_ITERATOR_NULL
+ dest, destCapacity,
+ src, srcLength,
+ ustrcase_internalFold, *pErrorCode);
+}
+
+U_NAMESPACE_BEGIN
+
+int32_t CaseMap::fold(
+ uint32_t options,
+ const UChar *src, int32_t srcLength,
+ UChar *dest, int32_t destCapacity, Edits *edits,
+ UErrorCode &errorCode) {
return ustrcase_map(
- UCASE_LOC_ROOT, options, UCASEMAP_BREAK_ITERATOR_NULL
+ UCASE_LOC_ROOT, options, UCASEMAP_BREAK_ITERATOR_NULL
dest, destCapacity,
src, srcLength,
- ustrcase_internalFold, edits, errorCode);
+ ustrcase_internalFold, edits, errorCode);
}
-U_NAMESPACE_END
-
+U_NAMESPACE_END
+
/* case-insensitive string comparisons -------------------------------------- */
/*
@@ -1611,7 +1611,7 @@ static int32_t _cmpFold(
*/
if( level1==0 &&
- (length=ucase_toFullFolding((UChar32)cp1, &p, options))>=0
+ (length=ucase_toFullFolding((UChar32)cp1, &p, options))>=0
) {
/* cp1 case-folds to the code point "length" or to p[length] */
if(U_IS_SURROGATE(c1)) {
@@ -1657,7 +1657,7 @@ static int32_t _cmpFold(
}
if( level2==0 &&
- (length=ucase_toFullFolding((UChar32)cp2, &p, options))>=0
+ (length=ucase_toFullFolding((UChar32)cp2, &p, options))>=0
) {
/* cp2 case-folds to the code point "length" or to p[length] */
if(U_IS_SURROGATE(c2)) {
@@ -1747,8 +1747,8 @@ static int32_t _cmpFold(
}
if(matchLen1) {
- *matchLen1=static_cast<int32_t>(m1-org1);
- *matchLen2=static_cast<int32_t>(m2-org2);
+ *matchLen1=static_cast<int32_t>(m1-org1);
+ *matchLen2=static_cast<int32_t>(m2-org2);
}
return cmpRes;
}
diff --git a/contrib/libs/icu/common/ustrcase_locale.cpp b/contrib/libs/icu/common/ustrcase_locale.cpp
index aaedbc01e3..2ecd24f03e 100644
--- a/contrib/libs/icu/common/ustrcase_locale.cpp
+++ b/contrib/libs/icu/common/ustrcase_locale.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: ustrcase_locale.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -18,24 +18,24 @@
*/
#include "unicode/utypes.h"
-#include "uassert.h"
-#include "unicode/brkiter.h"
-#include "unicode/casemap.h"
+#include "uassert.h"
+#include "unicode/brkiter.h"
+#include "unicode/casemap.h"
#include "unicode/ucasemap.h"
#include "unicode/uloc.h"
#include "unicode/ustring.h"
#include "ucase.h"
-#include "ucasemap_imp.h"
+#include "ucasemap_imp.h"
-U_CFUNC int32_t
-ustrcase_getCaseLocale(const char *locale) {
- if (locale == NULL) {
- locale = uloc_getDefault();
+U_CFUNC int32_t
+ustrcase_getCaseLocale(const char *locale) {
+ if (locale == NULL) {
+ locale = uloc_getDefault();
}
- if (*locale == 0) {
- return UCASE_LOC_ROOT;
+ if (*locale == 0) {
+ return UCASE_LOC_ROOT;
} else {
- return ucase_getCaseLocale(locale);
+ return ucase_getCaseLocale(locale);
}
}
@@ -46,11 +46,11 @@ u_strToLower(UChar *dest, int32_t destCapacity,
const UChar *src, int32_t srcLength,
const char *locale,
UErrorCode *pErrorCode) {
- return ustrcase_mapWithOverlap(
- ustrcase_getCaseLocale(locale), 0, UCASEMAP_BREAK_ITERATOR_NULL
+ return ustrcase_mapWithOverlap(
+ ustrcase_getCaseLocale(locale), 0, UCASEMAP_BREAK_ITERATOR_NULL
dest, destCapacity,
src, srcLength,
- ustrcase_internalToLower, *pErrorCode);
+ ustrcase_internalToLower, *pErrorCode);
}
U_CAPI int32_t U_EXPORT2
@@ -58,37 +58,37 @@ u_strToUpper(UChar *dest, int32_t destCapacity,
const UChar *src, int32_t srcLength,
const char *locale,
UErrorCode *pErrorCode) {
- return ustrcase_mapWithOverlap(
- ustrcase_getCaseLocale(locale), 0, UCASEMAP_BREAK_ITERATOR_NULL
- dest, destCapacity,
- src, srcLength,
- ustrcase_internalToUpper, *pErrorCode);
-}
-
-U_NAMESPACE_BEGIN
-
-int32_t CaseMap::toLower(
- const char *locale, uint32_t options,
- const UChar *src, int32_t srcLength,
- UChar *dest, int32_t destCapacity, Edits *edits,
- UErrorCode &errorCode) {
+ return ustrcase_mapWithOverlap(
+ ustrcase_getCaseLocale(locale), 0, UCASEMAP_BREAK_ITERATOR_NULL
+ dest, destCapacity,
+ src, srcLength,
+ ustrcase_internalToUpper, *pErrorCode);
+}
+
+U_NAMESPACE_BEGIN
+
+int32_t CaseMap::toLower(
+ const char *locale, uint32_t options,
+ const UChar *src, int32_t srcLength,
+ UChar *dest, int32_t destCapacity, Edits *edits,
+ UErrorCode &errorCode) {
return ustrcase_map(
- ustrcase_getCaseLocale(locale), options, UCASEMAP_BREAK_ITERATOR_NULL
+ ustrcase_getCaseLocale(locale), options, UCASEMAP_BREAK_ITERATOR_NULL
dest, destCapacity,
src, srcLength,
- ustrcase_internalToLower, edits, errorCode);
+ ustrcase_internalToLower, edits, errorCode);
}
-
-int32_t CaseMap::toUpper(
- const char *locale, uint32_t options,
- const UChar *src, int32_t srcLength,
- UChar *dest, int32_t destCapacity, Edits *edits,
- UErrorCode &errorCode) {
- return ustrcase_map(
- ustrcase_getCaseLocale(locale), options, UCASEMAP_BREAK_ITERATOR_NULL
- dest, destCapacity,
- src, srcLength,
- ustrcase_internalToUpper, edits, errorCode);
-}
-
-U_NAMESPACE_END
+
+int32_t CaseMap::toUpper(
+ const char *locale, uint32_t options,
+ const UChar *src, int32_t srcLength,
+ UChar *dest, int32_t destCapacity, Edits *edits,
+ UErrorCode &errorCode) {
+ return ustrcase_map(
+ ustrcase_getCaseLocale(locale), options, UCASEMAP_BREAK_ITERATOR_NULL
+ dest, destCapacity,
+ src, srcLength,
+ ustrcase_internalToUpper, edits, errorCode);
+}
+
+U_NAMESPACE_END
diff --git a/contrib/libs/icu/common/ustrenum.cpp b/contrib/libs/icu/common/ustrenum.cpp
index 70fa0de21b..ed23eaa232 100644
--- a/contrib/libs/icu/common/ustrenum.cpp
+++ b/contrib/libs/icu/common/ustrenum.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/ustrenum.h b/contrib/libs/icu/common/ustrenum.h
index 1a02b4430d..a82162e2bd 100644
--- a/contrib/libs/icu/common/ustrenum.h
+++ b/contrib/libs/icu/common/ustrenum.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/ustrfmt.cpp b/contrib/libs/icu/common/ustrfmt.cpp
index 775c38db82..1a9b15a59f 100644
--- a/contrib/libs/icu/common/ustrfmt.cpp
+++ b/contrib/libs/icu/common/ustrfmt.cpp
@@ -1,59 +1,59 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-**********************************************************************
-* Copyright (C) 2001-2006, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
-*/
-
-#include "cstring.h"
-#include "ustrfmt.h"
-
-
-/***
- * Fills in a UChar* string with the radix-based representation of a
- * uint32_t number padded with zeroes to minwidth. The result
- * will be null terminated if there is room.
- *
- * @param buffer UChar buffer to receive result
- * @param capacity capacity of buffer
- * @param i the unsigned number to be formatted
- * @param radix the radix from 2..36
- * @param minwidth the minimum width. If the result is narrower than
- * this, '0's will be added on the left. Must be <=
- * capacity.
- * @return the length of the result, not including any terminating
- * null
- */
-U_CAPI int32_t U_EXPORT2
-uprv_itou (UChar * buffer, int32_t capacity,
- uint32_t i, uint32_t radix, int32_t minwidth)
-{
- int32_t length = 0;
- int digit;
- int32_t j;
- UChar temp;
-
- do{
- digit = (int)(i % radix);
- buffer[length++]=(UChar)(digit<=9?(0x0030+digit):(0x0030+digit+7));
- i=i/radix;
- } while(i && length<capacity);
-
- while (length < minwidth){
- buffer[length++] = (UChar) 0x0030;/*zero padding */
- }
- /* null terminate the buffer */
- if(length<capacity){
- buffer[length] = (UChar) 0x0000;
- }
-
- /* Reverses the string */
- for (j = 0; j < (length / 2); j++){
- temp = buffer[(length-1) - j];
- buffer[(length-1) - j] = buffer[j];
- buffer[j] = temp;
- }
- return length;
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+**********************************************************************
+* Copyright (C) 2001-2006, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+*/
+
+#include "cstring.h"
+#include "ustrfmt.h"
+
+
+/***
+ * Fills in a UChar* string with the radix-based representation of a
+ * uint32_t number padded with zeroes to minwidth. The result
+ * will be null terminated if there is room.
+ *
+ * @param buffer UChar buffer to receive result
+ * @param capacity capacity of buffer
+ * @param i the unsigned number to be formatted
+ * @param radix the radix from 2..36
+ * @param minwidth the minimum width. If the result is narrower than
+ * this, '0's will be added on the left. Must be <=
+ * capacity.
+ * @return the length of the result, not including any terminating
+ * null
+ */
+U_CAPI int32_t U_EXPORT2
+uprv_itou (UChar * buffer, int32_t capacity,
+ uint32_t i, uint32_t radix, int32_t minwidth)
+{
+ int32_t length = 0;
+ int digit;
+ int32_t j;
+ UChar temp;
+
+ do{
+ digit = (int)(i % radix);
+ buffer[length++]=(UChar)(digit<=9?(0x0030+digit):(0x0030+digit+7));
+ i=i/radix;
+ } while(i && length<capacity);
+
+ while (length < minwidth){
+ buffer[length++] = (UChar) 0x0030;/*zero padding */
+ }
+ /* null terminate the buffer */
+ if(length<capacity){
+ buffer[length] = (UChar) 0x0000;
+ }
+
+ /* Reverses the string */
+ for (j = 0; j < (length / 2); j++){
+ temp = buffer[(length-1) - j];
+ buffer[(length-1) - j] = buffer[j];
+ buffer[j] = temp;
+ }
+ return length;
+}
diff --git a/contrib/libs/icu/common/ustrfmt.h b/contrib/libs/icu/common/ustrfmt.h
index 6290fb9216..53eb0557e4 100644
--- a/contrib/libs/icu/common/ustrfmt.h
+++ b/contrib/libs/icu/common/ustrfmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/ustring.cpp b/contrib/libs/icu/common/ustring.cpp
index fd490e3e31..de43d22ccc 100644
--- a/contrib/libs/icu/common/ustring.cpp
+++ b/contrib/libs/icu/common/ustring.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -19,7 +19,7 @@
#include "unicode/utypes.h"
#include "unicode/putil.h"
-#include "unicode/uchar.h"
+#include "unicode/uchar.h"
#include "unicode/ustring.h"
#include "unicode/utf16.h"
#include "cstring.h"
@@ -1428,7 +1428,7 @@ u_unescape(const char *src, UChar *dest, int32_t destCapacity) {
* NUL-terminate a string no matter what its type.
* Set warning and error codes accordingly.
*/
-#define __TERMINATE_STRING(dest, destCapacity, length, pErrorCode) UPRV_BLOCK_MACRO_BEGIN { \
+#define __TERMINATE_STRING(dest, destCapacity, length, pErrorCode) UPRV_BLOCK_MACRO_BEGIN { \
if(pErrorCode!=NULL && U_SUCCESS(*pErrorCode)) { \
/* not a public function, so no complete argument checking */ \
\
@@ -1448,16 +1448,16 @@ u_unescape(const char *src, UChar *dest, int32_t destCapacity) {
/* even the string itself did not fit - set an error code */ \
*pErrorCode=U_BUFFER_OVERFLOW_ERROR; \
} \
- } \
-} UPRV_BLOCK_MACRO_END
-
-U_CAPI UChar U_EXPORT2
-u_asciiToUpper(UChar c) {
- if (u'a' <= c && c <= u'z') {
- c = c + u'A' - u'a';
+ } \
+} UPRV_BLOCK_MACRO_END
+
+U_CAPI UChar U_EXPORT2
+u_asciiToUpper(UChar c) {
+ if (u'a' <= c && c <= u'z') {
+ c = c + u'A' - u'a';
}
- return c;
-}
+ return c;
+}
U_CAPI int32_t U_EXPORT2
u_terminateUChars(UChar *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode) {
@@ -1497,7 +1497,7 @@ u_terminateWChars(wchar_t *dest, int32_t destCapacity, int32_t length, UErrorCod
the output range. [LIU]
*/
-#define STRING_HASH(TYPE, STR, STRLEN, DEREF) UPRV_BLOCK_MACRO_BEGIN { \
+#define STRING_HASH(TYPE, STR, STRLEN, DEREF) UPRV_BLOCK_MACRO_BEGIN { \
uint32_t hash = 0; \
const TYPE *p = (const TYPE*) STR; \
if (p != NULL) { \
@@ -1509,8 +1509,8 @@ u_terminateWChars(wchar_t *dest, int32_t destCapacity, int32_t length, UErrorCod
p += inc; \
} \
} \
- return static_cast<int32_t>(hash); \
-} UPRV_BLOCK_MACRO_END
+ return static_cast<int32_t>(hash); \
+} UPRV_BLOCK_MACRO_END
/* Used by UnicodeString to compute its hashcode - Not public API. */
U_CAPI int32_t U_EXPORT2
diff --git a/contrib/libs/icu/common/ustrtrns.cpp b/contrib/libs/icu/common/ustrtrns.cpp
index 6efe6191d0..5dc032c02f 100644
--- a/contrib/libs/icu/common/ustrtrns.cpp
+++ b/contrib/libs/icu/common/ustrtrns.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -265,7 +265,7 @@ u_strFromUTF8WithSub(UChar *dest,
UChar32 subchar, int32_t *pNumSubstitutions,
UErrorCode *pErrorCode){
/* args check */
- if(U_FAILURE(*pErrorCode)) {
+ if(U_FAILURE(*pErrorCode)) {
return NULL;
}
if( (src==NULL && srcLength!=0) || srcLength < -1 ||
@@ -279,10 +279,10 @@ u_strFromUTF8WithSub(UChar *dest,
if(pNumSubstitutions!=NULL) {
*pNumSubstitutions=0;
}
- UChar *pDest = dest;
- UChar *pDestLimit = dest+destCapacity;
- int32_t reqLength = 0;
- int32_t numSubstitutions=0;
+ UChar *pDest = dest;
+ UChar *pDestLimit = dest+destCapacity;
+ int32_t reqLength = 0;
+ int32_t numSubstitutions=0;
/*
* Inline processing of UTF-8 byte sequences:
@@ -303,81 +303,81 @@ u_strFromUTF8WithSub(UChar *dest,
* The code explicitly checks for NULs only in the lead byte position.
* A NUL byte in the trail byte position fails the trail byte range check anyway.
*/
- int32_t i;
- UChar32 c;
- for(i = 0; (c = (uint8_t)src[i]) != 0 && (pDest < pDestLimit);) {
- // modified copy of U8_NEXT()
- ++i;
- if(U8_IS_SINGLE(c)) {
- *pDest++=(UChar)c;
+ int32_t i;
+ UChar32 c;
+ for(i = 0; (c = (uint8_t)src[i]) != 0 && (pDest < pDestLimit);) {
+ // modified copy of U8_NEXT()
+ ++i;
+ if(U8_IS_SINGLE(c)) {
+ *pDest++=(UChar)c;
} else {
- uint8_t __t1, __t2;
- if( /* handle U+0800..U+FFFF inline */
- (0xe0<=(c) && (c)<0xf0) &&
- U8_IS_VALID_LEAD3_AND_T1((c), src[i]) &&
- (__t2=src[(i)+1]-0x80)<=0x3f) {
- *pDest++ = (((c)&0xf)<<12)|((src[i]&0x3f)<<6)|__t2;
- i+=2;
- } else if( /* handle U+0080..U+07FF inline */
- ((c)<0xe0 && (c)>=0xc2) &&
- (__t1=src[i]-0x80)<=0x3f) {
- *pDest++ = (((c)&0x1f)<<6)|__t1;
- ++(i);
+ uint8_t __t1, __t2;
+ if( /* handle U+0800..U+FFFF inline */
+ (0xe0<=(c) && (c)<0xf0) &&
+ U8_IS_VALID_LEAD3_AND_T1((c), src[i]) &&
+ (__t2=src[(i)+1]-0x80)<=0x3f) {
+ *pDest++ = (((c)&0xf)<<12)|((src[i]&0x3f)<<6)|__t2;
+ i+=2;
+ } else if( /* handle U+0080..U+07FF inline */
+ ((c)<0xe0 && (c)>=0xc2) &&
+ (__t1=src[i]-0x80)<=0x3f) {
+ *pDest++ = (((c)&0x1f)<<6)|__t1;
+ ++(i);
} else {
- /* function call for "complicated" and error cases */
- (c)=utf8_nextCharSafeBody((const uint8_t *)src, &(i), -1, c, -1);
- if(c<0 && (++numSubstitutions, c = subchar) < 0) {
- *pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
- } else if(c<=0xFFFF) {
- *(pDest++)=(UChar)c;
+ /* function call for "complicated" and error cases */
+ (c)=utf8_nextCharSafeBody((const uint8_t *)src, &(i), -1, c, -1);
+ if(c<0 && (++numSubstitutions, c = subchar) < 0) {
+ *pErrorCode = U_INVALID_CHAR_FOUND;
+ return NULL;
+ } else if(c<=0xFFFF) {
+ *(pDest++)=(UChar)c;
} else {
- *(pDest++)=U16_LEAD(c);
- if(pDest<pDestLimit) {
- *(pDest++)=U16_TRAIL(c);
- } else {
- reqLength++;
- break;
- }
+ *(pDest++)=U16_LEAD(c);
+ if(pDest<pDestLimit) {
+ *(pDest++)=U16_TRAIL(c);
+ } else {
+ reqLength++;
+ break;
+ }
}
}
}
}
/* Pre-flight the rest of the string. */
- while((c = (uint8_t)src[i]) != 0) {
- // modified copy of U8_NEXT()
- ++i;
- if(U8_IS_SINGLE(c)) {
+ while((c = (uint8_t)src[i]) != 0) {
+ // modified copy of U8_NEXT()
+ ++i;
+ if(U8_IS_SINGLE(c)) {
++reqLength;
} else {
- uint8_t __t1, __t2;
- if( /* handle U+0800..U+FFFF inline */
- (0xe0<=(c) && (c)<0xf0) &&
- U8_IS_VALID_LEAD3_AND_T1((c), src[i]) &&
- (__t2=src[(i)+1]-0x80)<=0x3f) {
- ++reqLength;
- i+=2;
- } else if( /* handle U+0080..U+07FF inline */
- ((c)<0xe0 && (c)>=0xc2) &&
- (__t1=src[i]-0x80)<=0x3f) {
- ++reqLength;
- ++(i);
- } else {
- /* function call for "complicated" and error cases */
- (c)=utf8_nextCharSafeBody((const uint8_t *)src, &(i), -1, c, -1);
- if(c<0 && (++numSubstitutions, c = subchar) < 0) {
- *pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
+ uint8_t __t1, __t2;
+ if( /* handle U+0800..U+FFFF inline */
+ (0xe0<=(c) && (c)<0xf0) &&
+ U8_IS_VALID_LEAD3_AND_T1((c), src[i]) &&
+ (__t2=src[(i)+1]-0x80)<=0x3f) {
+ ++reqLength;
+ i+=2;
+ } else if( /* handle U+0080..U+07FF inline */
+ ((c)<0xe0 && (c)>=0xc2) &&
+ (__t1=src[i]-0x80)<=0x3f) {
+ ++reqLength;
+ ++(i);
+ } else {
+ /* function call for "complicated" and error cases */
+ (c)=utf8_nextCharSafeBody((const uint8_t *)src, &(i), -1, c, -1);
+ if(c<0 && (++numSubstitutions, c = subchar) < 0) {
+ *pErrorCode = U_INVALID_CHAR_FOUND;
+ return NULL;
}
- reqLength += U16_LENGTH(c);
+ reqLength += U16_LENGTH(c);
}
}
}
} else /* srcLength >= 0 */ {
- /* Faster loop without ongoing checking for srcLength and pDestLimit. */
- int32_t i = 0;
- UChar32 c;
+ /* Faster loop without ongoing checking for srcLength and pDestLimit. */
+ int32_t i = 0;
+ UChar32 c;
for(;;) {
/*
* Each iteration of the inner loop progresses by at most 3 UTF-8
@@ -385,10 +385,10 @@ u_strFromUTF8WithSub(UChar *dest,
* For supplementary code points (4 & 2), which are rare,
* there is an additional adjustment.
*/
- int32_t count = (int32_t)(pDestLimit - pDest);
- int32_t count2 = (srcLength - i) / 3;
- if(count > count2) {
- count = count2; /* min(remaining dest, remaining src/3) */
+ int32_t count = (int32_t)(pDestLimit - pDest);
+ int32_t count2 = (srcLength - i) / 3;
+ if(count > count2) {
+ count = count2; /* min(remaining dest, remaining src/3) */
}
if(count < 3) {
/*
@@ -399,122 +399,122 @@ u_strFromUTF8WithSub(UChar *dest,
}
do {
- // modified copy of U8_NEXT()
- c = (uint8_t)src[i++];
- if(U8_IS_SINGLE(c)) {
- *pDest++=(UChar)c;
+ // modified copy of U8_NEXT()
+ c = (uint8_t)src[i++];
+ if(U8_IS_SINGLE(c)) {
+ *pDest++=(UChar)c;
} else {
- uint8_t __t1, __t2;
- if( /* handle U+0800..U+FFFF inline */
- (0xe0<=(c) && (c)<0xf0) &&
- ((i)+1)<srcLength &&
- U8_IS_VALID_LEAD3_AND_T1((c), src[i]) &&
- (__t2=src[(i)+1]-0x80)<=0x3f) {
- *pDest++ = (((c)&0xf)<<12)|((src[i]&0x3f)<<6)|__t2;
- i+=2;
- } else if( /* handle U+0080..U+07FF inline */
- ((c)<0xe0 && (c)>=0xc2) &&
- ((i)!=srcLength) &&
- (__t1=src[i]-0x80)<=0x3f) {
- *pDest++ = (((c)&0x1f)<<6)|__t1;
- ++(i);
- } else {
- if(c >= 0xf0 || subchar > 0xffff) {
- // We may read up to four bytes and write up to two UChars,
- // which we didn't account for with computing count,
- // so we adjust it here.
- if(--count == 0) {
- --i; // back out byte c
- break;
- }
+ uint8_t __t1, __t2;
+ if( /* handle U+0800..U+FFFF inline */
+ (0xe0<=(c) && (c)<0xf0) &&
+ ((i)+1)<srcLength &&
+ U8_IS_VALID_LEAD3_AND_T1((c), src[i]) &&
+ (__t2=src[(i)+1]-0x80)<=0x3f) {
+ *pDest++ = (((c)&0xf)<<12)|((src[i]&0x3f)<<6)|__t2;
+ i+=2;
+ } else if( /* handle U+0080..U+07FF inline */
+ ((c)<0xe0 && (c)>=0xc2) &&
+ ((i)!=srcLength) &&
+ (__t1=src[i]-0x80)<=0x3f) {
+ *pDest++ = (((c)&0x1f)<<6)|__t1;
+ ++(i);
+ } else {
+ if(c >= 0xf0 || subchar > 0xffff) {
+ // We may read up to four bytes and write up to two UChars,
+ // which we didn't account for with computing count,
+ // so we adjust it here.
+ if(--count == 0) {
+ --i; // back out byte c
+ break;
+ }
}
- /* function call for "complicated" and error cases */
- (c)=utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, c, -1);
- if(c<0 && (++numSubstitutions, c = subchar) < 0) {
- *pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
- } else if(c<=0xFFFF) {
- *(pDest++)=(UChar)c;
- } else {
- *(pDest++)=U16_LEAD(c);
- *(pDest++)=U16_TRAIL(c);
+ /* function call for "complicated" and error cases */
+ (c)=utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, c, -1);
+ if(c<0 && (++numSubstitutions, c = subchar) < 0) {
+ *pErrorCode = U_INVALID_CHAR_FOUND;
+ return NULL;
+ } else if(c<=0xFFFF) {
+ *(pDest++)=(UChar)c;
+ } else {
+ *(pDest++)=U16_LEAD(c);
+ *(pDest++)=U16_TRAIL(c);
}
}
}
} while(--count > 0);
}
- while(i < srcLength && (pDest < pDestLimit)) {
- // modified copy of U8_NEXT()
- c = (uint8_t)src[i++];
- if(U8_IS_SINGLE(c)) {
- *pDest++=(UChar)c;
+ while(i < srcLength && (pDest < pDestLimit)) {
+ // modified copy of U8_NEXT()
+ c = (uint8_t)src[i++];
+ if(U8_IS_SINGLE(c)) {
+ *pDest++=(UChar)c;
} else {
- uint8_t __t1, __t2;
- if( /* handle U+0800..U+FFFF inline */
- (0xe0<=(c) && (c)<0xf0) &&
- ((i)+1)<srcLength &&
- U8_IS_VALID_LEAD3_AND_T1((c), src[i]) &&
- (__t2=src[(i)+1]-0x80)<=0x3f) {
- *pDest++ = (((c)&0xf)<<12)|((src[i]&0x3f)<<6)|__t2;
- i+=2;
- } else if( /* handle U+0080..U+07FF inline */
- ((c)<0xe0 && (c)>=0xc2) &&
- ((i)!=srcLength) &&
- (__t1=src[i]-0x80)<=0x3f) {
- *pDest++ = (((c)&0x1f)<<6)|__t1;
- ++(i);
- } else {
- /* function call for "complicated" and error cases */
- (c)=utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, c, -1);
- if(c<0 && (++numSubstitutions, c = subchar) < 0) {
- *pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
- } else if(c<=0xFFFF) {
- *(pDest++)=(UChar)c;
- } else {
- *(pDest++)=U16_LEAD(c);
- if(pDest<pDestLimit) {
- *(pDest++)=U16_TRAIL(c);
- } else {
- reqLength++;
- break;
- }
+ uint8_t __t1, __t2;
+ if( /* handle U+0800..U+FFFF inline */
+ (0xe0<=(c) && (c)<0xf0) &&
+ ((i)+1)<srcLength &&
+ U8_IS_VALID_LEAD3_AND_T1((c), src[i]) &&
+ (__t2=src[(i)+1]-0x80)<=0x3f) {
+ *pDest++ = (((c)&0xf)<<12)|((src[i]&0x3f)<<6)|__t2;
+ i+=2;
+ } else if( /* handle U+0080..U+07FF inline */
+ ((c)<0xe0 && (c)>=0xc2) &&
+ ((i)!=srcLength) &&
+ (__t1=src[i]-0x80)<=0x3f) {
+ *pDest++ = (((c)&0x1f)<<6)|__t1;
+ ++(i);
+ } else {
+ /* function call for "complicated" and error cases */
+ (c)=utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, c, -1);
+ if(c<0 && (++numSubstitutions, c = subchar) < 0) {
+ *pErrorCode = U_INVALID_CHAR_FOUND;
+ return NULL;
+ } else if(c<=0xFFFF) {
+ *(pDest++)=(UChar)c;
+ } else {
+ *(pDest++)=U16_LEAD(c);
+ if(pDest<pDestLimit) {
+ *(pDest++)=U16_TRAIL(c);
+ } else {
+ reqLength++;
+ break;
+ }
}
}
}
}
-
- /* Pre-flight the rest of the string. */
- while(i < srcLength) {
- // modified copy of U8_NEXT()
- c = (uint8_t)src[i++];
- if(U8_IS_SINGLE(c)) {
- ++reqLength;
+
+ /* Pre-flight the rest of the string. */
+ while(i < srcLength) {
+ // modified copy of U8_NEXT()
+ c = (uint8_t)src[i++];
+ if(U8_IS_SINGLE(c)) {
+ ++reqLength;
} else {
- uint8_t __t1, __t2;
- if( /* handle U+0800..U+FFFF inline */
- (0xe0<=(c) && (c)<0xf0) &&
- ((i)+1)<srcLength &&
- U8_IS_VALID_LEAD3_AND_T1((c), src[i]) &&
- (__t2=src[(i)+1]-0x80)<=0x3f) {
- ++reqLength;
- i+=2;
- } else if( /* handle U+0080..U+07FF inline */
- ((c)<0xe0 && (c)>=0xc2) &&
- ((i)!=srcLength) &&
- (__t1=src[i]-0x80)<=0x3f) {
- ++reqLength;
- ++(i);
- } else {
- /* function call for "complicated" and error cases */
- (c)=utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, c, -1);
- if(c<0 && (++numSubstitutions, c = subchar) < 0) {
- *pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
+ uint8_t __t1, __t2;
+ if( /* handle U+0800..U+FFFF inline */
+ (0xe0<=(c) && (c)<0xf0) &&
+ ((i)+1)<srcLength &&
+ U8_IS_VALID_LEAD3_AND_T1((c), src[i]) &&
+ (__t2=src[(i)+1]-0x80)<=0x3f) {
+ ++reqLength;
+ i+=2;
+ } else if( /* handle U+0080..U+07FF inline */
+ ((c)<0xe0 && (c)>=0xc2) &&
+ ((i)!=srcLength) &&
+ (__t1=src[i]-0x80)<=0x3f) {
+ ++reqLength;
+ ++(i);
+ } else {
+ /* function call for "complicated" and error cases */
+ (c)=utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, c, -1);
+ if(c<0 && (++numSubstitutions, c = subchar) < 0) {
+ *pErrorCode = U_INVALID_CHAR_FOUND;
+ return NULL;
}
- reqLength += U16_LENGTH(c);
+ reqLength += U16_LENGTH(c);
}
}
}
@@ -563,7 +563,7 @@ u_strFromUTF8Lenient(UChar *dest,
uint8_t* pSrc = (uint8_t*) src;
/* args check */
- if(U_FAILURE(*pErrorCode)){
+ if(U_FAILURE(*pErrorCode)){
return NULL;
}
@@ -804,7 +804,7 @@ u_strToUTF8WithSub(char *dest,
int32_t numSubstitutions;
/* args check */
- if(U_FAILURE(*pErrorCode)){
+ if(U_FAILURE(*pErrorCode)){
return NULL;
}
@@ -1077,7 +1077,7 @@ u_strFromJavaModifiedUTF8WithSub(
UChar32 subchar, int32_t *pNumSubstitutions,
UErrorCode *pErrorCode) {
/* args check */
- if(U_FAILURE(*pErrorCode)) {
+ if(U_FAILURE(*pErrorCode)) {
return NULL;
}
if( (src==NULL && srcLength!=0) || srcLength < -1 ||
@@ -1091,22 +1091,22 @@ u_strFromJavaModifiedUTF8WithSub(
if(pNumSubstitutions!=NULL) {
*pNumSubstitutions=0;
}
- UChar *pDest = dest;
- UChar *pDestLimit = dest+destCapacity;
- int32_t reqLength = 0;
- int32_t numSubstitutions=0;
+ UChar *pDest = dest;
+ UChar *pDestLimit = dest+destCapacity;
+ int32_t reqLength = 0;
+ int32_t numSubstitutions=0;
if(srcLength < 0) {
/*
* Transform a NUL-terminated ASCII string.
* Handle non-ASCII strings with slower code.
*/
- UChar32 c;
- while(((c = (uint8_t)*src) != 0) && c <= 0x7f && (pDest < pDestLimit)) {
- *pDest++=(UChar)c;
- ++src;
+ UChar32 c;
+ while(((c = (uint8_t)*src) != 0) && c <= 0x7f && (pDest < pDestLimit)) {
+ *pDest++=(UChar)c;
+ ++src;
}
- if(c == 0) {
+ if(c == 0) {
reqLength=(int32_t)(pDest - dest);
if(pDestLength) {
*pDestLength = reqLength;
@@ -1116,39 +1116,39 @@ u_strFromJavaModifiedUTF8WithSub(
u_terminateUChars(dest, destCapacity, reqLength, pErrorCode);
return dest;
}
- srcLength = static_cast<int32_t>(uprv_strlen(src));
+ srcLength = static_cast<int32_t>(uprv_strlen(src));
}
- /* Faster loop without ongoing checking for srcLength and pDestLimit. */
- UChar32 ch;
- uint8_t t1, t2;
- int32_t i = 0;
+ /* Faster loop without ongoing checking for srcLength and pDestLimit. */
+ UChar32 ch;
+ uint8_t t1, t2;
+ int32_t i = 0;
for(;;) {
- int32_t count = (int32_t)(pDestLimit - pDest);
- int32_t count2 = srcLength - i;
- if(count >= count2 && srcLength > 0 && U8_IS_SINGLE(*src)) {
+ int32_t count = (int32_t)(pDestLimit - pDest);
+ int32_t count2 = srcLength - i;
+ if(count >= count2 && srcLength > 0 && U8_IS_SINGLE(*src)) {
/* fast ASCII loop */
- int32_t start = i;
- uint8_t b;
- while(i < srcLength && U8_IS_SINGLE(b = src[i])) {
- *pDest++=b;
- ++i;
+ int32_t start = i;
+ uint8_t b;
+ while(i < srcLength && U8_IS_SINGLE(b = src[i])) {
+ *pDest++=b;
+ ++i;
}
- int32_t delta = i - start;
+ int32_t delta = i - start;
count -= delta;
- count2 -= delta;
+ count2 -= delta;
}
/*
* Each iteration of the inner loop progresses by at most 3 UTF-8
* bytes and one UChar.
*/
- if(subchar > 0xFFFF) {
- break;
+ if(subchar > 0xFFFF) {
+ break;
+ }
+ count2 /= 3;
+ if(count > count2) {
+ count = count2; /* min(remaining dest, remaining src/3) */
}
- count2 /= 3;
- if(count > count2) {
- count = count2; /* min(remaining dest, remaining src/3) */
- }
if(count < 3) {
/*
* Too much overhead if we get near the end of the string,
@@ -1157,28 +1157,28 @@ u_strFromJavaModifiedUTF8WithSub(
break;
}
do {
- ch = (uint8_t)src[i++];
- if(U8_IS_SINGLE(ch)) {
+ ch = (uint8_t)src[i++];
+ if(U8_IS_SINGLE(ch)) {
*pDest++=(UChar)ch;
} else {
if(ch >= 0xe0) {
if( /* handle U+0000..U+FFFF inline */
ch <= 0xef &&
- (t1 = (uint8_t)(src[i] - 0x80)) <= 0x3f &&
- (t2 = (uint8_t)(src[i+1] - 0x80)) <= 0x3f
+ (t1 = (uint8_t)(src[i] - 0x80)) <= 0x3f &&
+ (t2 = (uint8_t)(src[i+1] - 0x80)) <= 0x3f
) {
/* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (UChar) */
*pDest++ = (UChar)((ch << 12) | (t1 << 6) | t2);
- i += 2;
+ i += 2;
continue;
}
} else {
if( /* handle U+0000..U+07FF inline */
ch >= 0xc0 &&
- (t1 = (uint8_t)(src[i] - 0x80)) <= 0x3f
+ (t1 = (uint8_t)(src[i] - 0x80)) <= 0x3f
) {
*pDest++ = (UChar)(((ch & 0x1f) << 6) | t1);
- ++i;
+ ++i;
continue;
}
}
@@ -1191,43 +1191,43 @@ u_strFromJavaModifiedUTF8WithSub(
* We need to write two UChars, adjusted count for that,
* and ran out of space.
*/
- --i; // back out byte ch
+ --i; // back out byte ch
break;
} else {
/* function call for error cases */
- utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, ch, -1);
+ utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, ch, -1);
++numSubstitutions;
- *(pDest++)=(UChar)subchar;
+ *(pDest++)=(UChar)subchar;
}
}
} while(--count > 0);
}
- while(i < srcLength && (pDest < pDestLimit)) {
- ch = (uint8_t)src[i++];
- if(U8_IS_SINGLE(ch)){
+ while(i < srcLength && (pDest < pDestLimit)) {
+ ch = (uint8_t)src[i++];
+ if(U8_IS_SINGLE(ch)){
*pDest++=(UChar)ch;
} else {
if(ch >= 0xe0) {
if( /* handle U+0000..U+FFFF inline */
ch <= 0xef &&
- (i+1) < srcLength &&
- (t1 = (uint8_t)(src[i] - 0x80)) <= 0x3f &&
- (t2 = (uint8_t)(src[i+1] - 0x80)) <= 0x3f
+ (i+1) < srcLength &&
+ (t1 = (uint8_t)(src[i] - 0x80)) <= 0x3f &&
+ (t2 = (uint8_t)(src[i+1] - 0x80)) <= 0x3f
) {
/* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (UChar) */
*pDest++ = (UChar)((ch << 12) | (t1 << 6) | t2);
- i += 2;
+ i += 2;
continue;
}
} else {
if( /* handle U+0000..U+07FF inline */
ch >= 0xc0 &&
- i < srcLength &&
- (t1 = (uint8_t)(src[i] - 0x80)) <= 0x3f
+ i < srcLength &&
+ (t1 = (uint8_t)(src[i] - 0x80)) <= 0x3f
) {
*pDest++ = (UChar)(((ch & 0x1f) << 6) | t1);
- ++i;
+ ++i;
continue;
}
}
@@ -1237,7 +1237,7 @@ u_strFromJavaModifiedUTF8WithSub(
return NULL;
} else {
/* function call for error cases */
- utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, ch, -1);
+ utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, ch, -1);
++numSubstitutions;
if(subchar<=0xFFFF) {
*(pDest++)=(UChar)subchar;
@@ -1254,31 +1254,31 @@ u_strFromJavaModifiedUTF8WithSub(
}
}
- /* Pre-flight the rest of the string. */
- while(i < srcLength) {
- ch = (uint8_t)src[i++];
- if(U8_IS_SINGLE(ch)) {
+ /* Pre-flight the rest of the string. */
+ while(i < srcLength) {
+ ch = (uint8_t)src[i++];
+ if(U8_IS_SINGLE(ch)) {
reqLength++;
} else {
if(ch >= 0xe0) {
if( /* handle U+0000..U+FFFF inline */
ch <= 0xef &&
- (i+1) < srcLength &&
- (uint8_t)(src[i] - 0x80) <= 0x3f &&
- (uint8_t)(src[i+1] - 0x80) <= 0x3f
+ (i+1) < srcLength &&
+ (uint8_t)(src[i] - 0x80) <= 0x3f &&
+ (uint8_t)(src[i+1] - 0x80) <= 0x3f
) {
reqLength++;
- i += 2;
+ i += 2;
continue;
}
} else {
if( /* handle U+0000..U+07FF inline */
ch >= 0xc0 &&
- i < srcLength &&
- (uint8_t)(src[i] - 0x80) <= 0x3f
+ i < srcLength &&
+ (uint8_t)(src[i] - 0x80) <= 0x3f
) {
reqLength++;
- ++i;
+ ++i;
continue;
}
}
@@ -1288,7 +1288,7 @@ u_strFromJavaModifiedUTF8WithSub(
return NULL;
} else {
/* function call for error cases */
- utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, ch, -1);
+ utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, ch, -1);
++numSubstitutions;
reqLength+=U16_LENGTH(ch);
}
diff --git a/contrib/libs/icu/common/utext.cpp b/contrib/libs/icu/common/utext.cpp
index 6284db5ac0..763b6684fb 100644
--- a/contrib/libs/icu/common/utext.cpp
+++ b/contrib/libs/icu/common/utext.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: utext.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -16,8 +16,8 @@
* created by: Markus W. Scherer
*/
-#include <cstddef>
-
+#include <cstddef>
+
#include "unicode/utypes.h"
#include "unicode/ustring.h"
#include "unicode/unistr.h"
@@ -568,8 +568,8 @@ enum {
// when a provider asks for a UText to be allocated with extra storage.
struct ExtendedUText {
- UText ut;
- std::max_align_t extension;
+ UText ut;
+ std::max_align_t extension;
};
static const UText emptyText = UTEXT_INITIALIZER;
@@ -584,7 +584,7 @@ utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) {
// We need to heap-allocate storage for the new UText
int32_t spaceRequired = sizeof(UText);
if (extraSpace > 0) {
- spaceRequired = sizeof(ExtendedUText) + extraSpace - sizeof(std::max_align_t);
+ spaceRequired = sizeof(ExtendedUText) + extraSpace - sizeof(std::max_align_t);
}
ut = (UText *)uprv_malloc(spaceRequired);
if (ut == NULL) {
@@ -849,11 +849,11 @@ U_CDECL_END
//------------------------------------------------------------------------------
// Chunk size.
-// Must be less than 85 (256/3), because of byte mapping from UChar indexes to native indexes.
+// Must be less than 85 (256/3), because of byte mapping from UChar indexes to native indexes.
// Worst case is three native bytes to one UChar. (Supplemenaries are 4 native bytes
// to two UChars.)
-// The longest illegal byte sequence treated as a single error (and converted to U+FFFD)
-// is a three-byte sequence (truncated four-byte sequence).
+// The longest illegal byte sequence treated as a single error (and converted to U+FFFD)
+// is a three-byte sequence (truncated four-byte sequence).
//
enum { UTF8_TEXT_CHUNK_SIZE=32 };
@@ -1036,7 +1036,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) {
// Requested index is in this buffer.
u8b = (UTF8Buf *)ut->p; // the current buffer
mapIndex = ix - u8b->toUCharsMapStart;
- U_ASSERT(mapIndex < (int32_t)sizeof(UTF8Buf::mapToUChars));
+ U_ASSERT(mapIndex < (int32_t)sizeof(UTF8Buf::mapToUChars));
ut->chunkOffset = u8b->mapToUChars[mapIndex] - u8b->bufStartIdx;
return TRUE;
@@ -1198,9 +1198,9 @@ fillForward:
// Swap the UText buffers.
// We want to fill what was previously the alternate buffer,
// and make what was the current buffer be the new alternate.
- UTF8Buf *u8b_swap = (UTF8Buf *)ut->q;
+ UTF8Buf *u8b_swap = (UTF8Buf *)ut->q;
ut->q = ut->p;
- ut->p = u8b_swap;
+ ut->p = u8b_swap;
int32_t strLen = ut->b;
UBool nulTerminated = FALSE;
@@ -1209,9 +1209,9 @@ fillForward:
nulTerminated = TRUE;
}
- UChar *buf = u8b_swap->buf;
- uint8_t *mapToNative = u8b_swap->mapToNative;
- uint8_t *mapToUChars = u8b_swap->mapToUChars;
+ UChar *buf = u8b_swap->buf;
+ uint8_t *mapToNative = u8b_swap->mapToNative;
+ uint8_t *mapToUChars = u8b_swap->mapToUChars;
int32_t destIx = 0;
int32_t srcIx = ix;
UBool seenNonAscii = FALSE;
@@ -1232,7 +1232,7 @@ fillForward:
// General case, handle everything.
if (seenNonAscii == FALSE) {
seenNonAscii = TRUE;
- u8b_swap->bufNILimit = destIx;
+ u8b_swap->bufNILimit = destIx;
}
int32_t cIx = srcIx;
@@ -1265,22 +1265,22 @@ fillForward:
mapToUChars[srcIx - ix] = (uint8_t)destIx;
// fill in Buffer descriptor
- u8b_swap->bufNativeStart = ix;
- u8b_swap->bufNativeLimit = srcIx;
- u8b_swap->bufStartIdx = 0;
- u8b_swap->bufLimitIdx = destIx;
+ u8b_swap->bufNativeStart = ix;
+ u8b_swap->bufNativeLimit = srcIx;
+ u8b_swap->bufStartIdx = 0;
+ u8b_swap->bufLimitIdx = destIx;
if (seenNonAscii == FALSE) {
- u8b_swap->bufNILimit = destIx;
+ u8b_swap->bufNILimit = destIx;
}
- u8b_swap->toUCharsMapStart = u8b_swap->bufNativeStart;
+ u8b_swap->toUCharsMapStart = u8b_swap->bufNativeStart;
// Set UText chunk to refer to this buffer.
ut->chunkContents = buf;
ut->chunkOffset = 0;
- ut->chunkLength = u8b_swap->bufLimitIdx;
- ut->chunkNativeStart = u8b_swap->bufNativeStart;
- ut->chunkNativeLimit = u8b_swap->bufNativeLimit;
- ut->nativeIndexingLimit = u8b_swap->bufNILimit;
+ ut->chunkLength = u8b_swap->bufLimitIdx;
+ ut->chunkNativeStart = u8b_swap->bufNativeStart;
+ ut->chunkNativeLimit = u8b_swap->bufNativeLimit;
+ ut->nativeIndexingLimit = u8b_swap->bufNILimit;
// For zero terminated strings, keep track of the maximum point
// scanned so far.
@@ -1303,27 +1303,27 @@ fillReverse:
// Can only do this if the incoming index is somewhere in the interior of the string.
// If index is at the end, there is no character there to look at.
if (ix != ut->b) {
- // Note: this function will only move the index back if it is on a trail byte
- // and there is a preceding lead byte and the sequence from the lead
- // through this trail could be part of a valid UTF-8 sequence
- // Otherwise the index remains unchanged.
+ // Note: this function will only move the index back if it is on a trail byte
+ // and there is a preceding lead byte and the sequence from the lead
+ // through this trail could be part of a valid UTF-8 sequence
+ // Otherwise the index remains unchanged.
U8_SET_CP_START(s8, 0, ix);
}
// Swap the UText buffers.
// We want to fill what was previously the alternate buffer,
// and make what was the current buffer be the new alternate.
- UTF8Buf *u8b_swap = (UTF8Buf *)ut->q;
+ UTF8Buf *u8b_swap = (UTF8Buf *)ut->q;
ut->q = ut->p;
- ut->p = u8b_swap;
-
- UChar *buf = u8b_swap->buf;
- uint8_t *mapToNative = u8b_swap->mapToNative;
- uint8_t *mapToUChars = u8b_swap->mapToUChars;
- int32_t toUCharsMapStart = ix - sizeof(UTF8Buf::mapToUChars) + 1;
- // Note that toUCharsMapStart can be negative. Happens when the remaining
- // text from current position to the beginning is less than the buffer size.
- // + 1 because mapToUChars must have a slot at the end for the bufNativeLimit entry.
+ ut->p = u8b_swap;
+
+ UChar *buf = u8b_swap->buf;
+ uint8_t *mapToNative = u8b_swap->mapToNative;
+ uint8_t *mapToUChars = u8b_swap->mapToUChars;
+ int32_t toUCharsMapStart = ix - sizeof(UTF8Buf::mapToUChars) + 1;
+ // Note that toUCharsMapStart can be negative. Happens when the remaining
+ // text from current position to the beginning is less than the buffer size.
+ // + 1 because mapToUChars must have a slot at the end for the bufNativeLimit entry.
int32_t destIx = UTF8_TEXT_CHUNK_SIZE+2; // Start in the overflow region
// at end of buffer to leave room
// for a surrogate pair at the
@@ -1350,7 +1350,7 @@ fillReverse:
if (c<0x80) {
// Special case ASCII range for speed.
buf[destIx] = (UChar)c;
- U_ASSERT(toUCharsMapStart <= srcIx);
+ U_ASSERT(toUCharsMapStart <= srcIx);
mapToUChars[srcIx - toUCharsMapStart] = (uint8_t)destIx;
mapToNative[destIx] = (uint8_t)(srcIx - toUCharsMapStart);
} else {
@@ -1380,7 +1380,7 @@ fillReverse:
do {
mapToUChars[sIx-- - toUCharsMapStart] = (uint8_t)destIx;
} while (sIx >= srcIx);
- U_ASSERT(toUCharsMapStart <= (srcIx+1));
+ U_ASSERT(toUCharsMapStart <= (srcIx+1));
// Set native indexing limit to be the current position.
// We are processing a non-ascii, non-native-indexing char now;
@@ -1389,19 +1389,19 @@ fillReverse:
bufNILimit = destIx;
}
}
- u8b_swap->bufNativeStart = srcIx;
- u8b_swap->bufNativeLimit = ix;
- u8b_swap->bufStartIdx = destIx;
- u8b_swap->bufLimitIdx = UTF8_TEXT_CHUNK_SIZE+2;
- u8b_swap->bufNILimit = bufNILimit - u8b_swap->bufStartIdx;
- u8b_swap->toUCharsMapStart = toUCharsMapStart;
-
- ut->chunkContents = &buf[u8b_swap->bufStartIdx];
- ut->chunkLength = u8b_swap->bufLimitIdx - u8b_swap->bufStartIdx;
+ u8b_swap->bufNativeStart = srcIx;
+ u8b_swap->bufNativeLimit = ix;
+ u8b_swap->bufStartIdx = destIx;
+ u8b_swap->bufLimitIdx = UTF8_TEXT_CHUNK_SIZE+2;
+ u8b_swap->bufNILimit = bufNILimit - u8b_swap->bufStartIdx;
+ u8b_swap->toUCharsMapStart = toUCharsMapStart;
+
+ ut->chunkContents = &buf[u8b_swap->bufStartIdx];
+ ut->chunkLength = u8b_swap->bufLimitIdx - u8b_swap->bufStartIdx;
ut->chunkOffset = ut->chunkLength;
- ut->chunkNativeStart = u8b_swap->bufNativeStart;
- ut->chunkNativeLimit = u8b_swap->bufNativeLimit;
- ut->nativeIndexingLimit = u8b_swap->bufNILimit;
+ ut->chunkNativeStart = u8b_swap->bufNativeStart;
+ ut->chunkNativeLimit = u8b_swap->bufNativeLimit;
+ ut->nativeIndexingLimit = u8b_swap->bufNILimit;
return TRUE;
}
@@ -1555,7 +1555,7 @@ utf8TextMapIndexToUTF16(const UText *ut, int64_t index64) {
U_ASSERT(index>=ut->chunkNativeStart+ut->nativeIndexingLimit);
U_ASSERT(index<=ut->chunkNativeLimit);
int32_t mapIndex = index - u8b->toUCharsMapStart;
- U_ASSERT(mapIndex < (int32_t)sizeof(UTF8Buf::mapToUChars));
+ U_ASSERT(mapIndex < (int32_t)sizeof(UTF8Buf::mapToUChars));
int32_t offset = u8b->mapToUChars[mapIndex] - u8b->bufStartIdx;
U_ASSERT(offset>=0 && offset<=ut->chunkLength);
return offset;
@@ -2240,13 +2240,13 @@ unistrTextCopy(UText *ut,
}
if(move) {
- // move: copy to destIndex, then remove original
+ // move: copy to destIndex, then remove original
int32_t segLength=limit32-start32;
us->copy(start32, limit32, destIndex32);
if(destIndex32<start32) {
start32+=segLength;
}
- us->remove(start32, segLength);
+ us->remove(start32, segLength);
} else {
// copy
us->copy(start32, limit32, destIndex32);
diff --git a/contrib/libs/icu/common/utf_impl.cpp b/contrib/libs/icu/common/utf_impl.cpp
index bfcdb2c3fc..9dd241a12b 100644
--- a/contrib/libs/icu/common/utf_impl.cpp
+++ b/contrib/libs/icu/common/utf_impl.cpp
@@ -1,329 +1,329 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 1999-2012, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-* file name: utf_impl.cpp
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 1999sep13
-* created by: Markus W. Scherer
-*
-* This file provides implementation functions for macros in the utfXX.h
-* that would otherwise be too long as macros.
-*/
-
-/* set import/export definitions */
-#ifndef U_UTF8_IMPL
-# define U_UTF8_IMPL
-#endif
-
-#include "unicode/utypes.h"
-#include "unicode/utf.h"
-#include "unicode/utf8.h"
-#include "uassert.h"
-
-/*
- * Table of the number of utf8 trail bytes, indexed by the lead byte.
- * Used by the deprecated macro UTF8_COUNT_TRAIL_BYTES, defined in utf_old.h
- *
- * The current macro, U8_COUNT_TRAIL_BYTES, does _not_ use this table.
- *
- * Note that this table cannot be removed, even if UTF8_COUNT_TRAIL_BYTES were
- * changed to no longer use it. References to the table from expansions of UTF8_COUNT_TRAIL_BYTES
- * may exist in old client code that must continue to run with newer icu library versions.
- *
- * This table could be replaced on many machines by
- * a few lines of assembler code using an
- * "index of first 0-bit from msb" instruction and
- * one or two more integer instructions.
- *
- * For example, on an i386, do something like
- * - MOV AL, leadByte
- * - NOT AL (8-bit, leave b15..b8==0..0, reverse only b7..b0)
- * - MOV AH, 0
- * - BSR BX, AX (16-bit)
- * - MOV AX, 6 (result)
- * - JZ finish (ZF==1 if leadByte==0xff)
- * - SUB AX, BX (result)
- * -finish:
- * (BSR: Bit Scan Reverse, scans for a 1-bit, starting from the MSB)
- */
-extern "C" U_EXPORT const uint8_t
-utf8_countTrailBytes[256]={
- 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, 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, 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, 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, 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, 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, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- // illegal C0 & C1
- // 2-byte lead bytes C2..DF
- 0, 0, 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,
-
- // 3-byte lead bytes E0..EF
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- // 4-byte lead bytes F0..F4
- // illegal F5..FF
- 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-static const UChar32
-utf8_errorValue[6]={
- // Same values as UTF8_ERROR_VALUE_1, UTF8_ERROR_VALUE_2, UTF_ERROR_VALUE,
- // but without relying on the obsolete unicode/utf_old.h.
- 0x15, 0x9f, 0xffff,
- 0x10ffff
-};
-
-static UChar32
-errorValue(int32_t count, int8_t strict) {
- if(strict>=0) {
- return utf8_errorValue[count];
- } else if(strict==-3) {
- return 0xfffd;
- } else {
- return U_SENTINEL;
- }
-}
-
-/*
- * Handle the non-inline part of the U8_NEXT() and U8_NEXT_FFFD() macros
- * and their obsolete sibling UTF8_NEXT_CHAR_SAFE().
- *
- * U8_NEXT() supports NUL-terminated strings indicated via length<0.
- *
- * The "strict" parameter controls the error behavior:
- * <0 "Safe" behavior of U8_NEXT():
- * -1: All illegal byte sequences yield U_SENTINEL=-1.
- * -2: Same as -1, except for lenient treatment of surrogate code points as legal.
- * Some implementations use this for roundtripping of
- * Unicode 16-bit strings that are not well-formed UTF-16, that is, they
- * contain unpaired surrogates.
- * -3: All illegal byte sequences yield U+FFFD.
- * 0 Obsolete "safe" behavior of UTF8_NEXT_CHAR_SAFE(..., FALSE):
- * All illegal byte sequences yield a positive code point such that this
- * result code point would be encoded with the same number of bytes as
- * the illegal sequence.
- * >0 Obsolete "strict" behavior of UTF8_NEXT_CHAR_SAFE(..., TRUE):
- * Same as the obsolete "safe" behavior, but non-characters are also treated
- * like illegal sequences.
- *
- * Note that a UBool is the same as an int8_t.
- */
-U_CAPI UChar32 U_EXPORT2
-utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c, UBool strict) {
- // *pi is one after byte c.
- int32_t i=*pi;
- // length can be negative for NUL-terminated strings: Read and validate one byte at a time.
- if(i==length || c>0xf4) {
- // end of string, or not a lead byte
- } else if(c>=0xf0) {
- // Test for 4-byte sequences first because
- // U8_NEXT() handles shorter valid sequences inline.
- uint8_t t1=s[i], t2, t3;
- c&=7;
- if(U8_IS_VALID_LEAD4_AND_T1(c, t1) &&
- ++i!=length && (t2=s[i]-0x80)<=0x3f &&
- ++i!=length && (t3=s[i]-0x80)<=0x3f) {
- ++i;
- c=(c<<18)|((t1&0x3f)<<12)|(t2<<6)|t3;
- // strict: forbid non-characters like U+fffe
- if(strict<=0 || !U_IS_UNICODE_NONCHAR(c)) {
- *pi=i;
- return c;
- }
- }
- } else if(c>=0xe0) {
- c&=0xf;
- if(strict!=-2) {
- uint8_t t1=s[i], t2;
- if(U8_IS_VALID_LEAD3_AND_T1(c, t1) &&
- ++i!=length && (t2=s[i]-0x80)<=0x3f) {
- ++i;
- c=(c<<12)|((t1&0x3f)<<6)|t2;
- // strict: forbid non-characters like U+fffe
- if(strict<=0 || !U_IS_UNICODE_NONCHAR(c)) {
- *pi=i;
- return c;
- }
- }
- } else {
- // strict=-2 -> lenient: allow surrogates
- uint8_t t1=s[i]-0x80, t2;
- if(t1<=0x3f && (c>0 || t1>=0x20) &&
- ++i!=length && (t2=s[i]-0x80)<=0x3f) {
- *pi=i+1;
- return (c<<12)|(t1<<6)|t2;
- }
- }
- } else if(c>=0xc2) {
- uint8_t t1=s[i]-0x80;
- if(t1<=0x3f) {
- *pi=i+1;
- return ((c-0xc0)<<6)|t1;
- }
- } // else 0x80<=c<0xc2 is not a lead byte
-
- /* error handling */
- c=errorValue(i-*pi, strict);
- *pi=i;
- return c;
-}
-
-U_CAPI int32_t U_EXPORT2
-utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool *pIsError) {
- if((uint32_t)(c)<=0x7ff) {
- if((i)+1<(length)) {
- (s)[(i)++]=(uint8_t)(((c)>>6)|0xc0);
- (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80);
- return i;
- }
- } else if((uint32_t)(c)<=0xffff) {
- /* Starting with Unicode 3.2, surrogate code points must not be encoded in UTF-8. */
- if((i)+2<(length) && !U_IS_SURROGATE(c)) {
- (s)[(i)++]=(uint8_t)(((c)>>12)|0xe0);
- (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80);
- (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80);
- return i;
- }
- } else if((uint32_t)(c)<=0x10ffff) {
- if((i)+3<(length)) {
- (s)[(i)++]=(uint8_t)(((c)>>18)|0xf0);
- (s)[(i)++]=(uint8_t)((((c)>>12)&0x3f)|0x80);
- (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80);
- (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80);
- return i;
- }
- }
- /* c>0x10ffff or not enough space, write an error value */
- if(pIsError!=NULL) {
- *pIsError=TRUE;
- } else {
- length-=i;
- if(length>0) {
- int32_t offset;
- if(length>3) {
- length=3;
- }
- s+=i;
- offset=0;
- c=utf8_errorValue[length-1];
- U8_APPEND_UNSAFE(s, offset, c);
- i=i+offset;
- }
- }
- return i;
-}
-
-U_CAPI UChar32 U_EXPORT2
-utf8_prevCharSafeBody(const uint8_t *s, int32_t start, int32_t *pi, UChar32 c, UBool strict) {
- // *pi is the index of byte c.
- int32_t i=*pi;
- if(U8_IS_TRAIL(c) && i>start) {
- uint8_t b1=s[--i];
- if(U8_IS_LEAD(b1)) {
- if(b1<0xe0) {
- *pi=i;
- return ((b1-0xc0)<<6)|(c&0x3f);
- } else if(b1<0xf0 ? U8_IS_VALID_LEAD3_AND_T1(b1, c) : U8_IS_VALID_LEAD4_AND_T1(b1, c)) {
- // Truncated 3- or 4-byte sequence.
- *pi=i;
- return errorValue(1, strict);
- }
- } else if(U8_IS_TRAIL(b1) && i>start) {
- // Extract the value bits from the last trail byte.
- c&=0x3f;
- uint8_t b2=s[--i];
- if(0xe0<=b2 && b2<=0xf4) {
- if(b2<0xf0) {
- b2&=0xf;
- if(strict!=-2) {
- if(U8_IS_VALID_LEAD3_AND_T1(b2, b1)) {
- *pi=i;
- c=(b2<<12)|((b1&0x3f)<<6)|c;
- if(strict<=0 || !U_IS_UNICODE_NONCHAR(c)) {
- return c;
- } else {
- // strict: forbid non-characters like U+fffe
- return errorValue(2, strict);
- }
- }
- } else {
- // strict=-2 -> lenient: allow surrogates
- b1-=0x80;
- if((b2>0 || b1>=0x20)) {
- *pi=i;
- return (b2<<12)|(b1<<6)|c;
- }
- }
- } else if(U8_IS_VALID_LEAD4_AND_T1(b2, b1)) {
- // Truncated 4-byte sequence.
- *pi=i;
- return errorValue(2, strict);
- }
- } else if(U8_IS_TRAIL(b2) && i>start) {
- uint8_t b3=s[--i];
- if(0xf0<=b3 && b3<=0xf4) {
- b3&=7;
- if(U8_IS_VALID_LEAD4_AND_T1(b3, b2)) {
- *pi=i;
- c=(b3<<18)|((b2&0x3f)<<12)|((b1&0x3f)<<6)|c;
- if(strict<=0 || !U_IS_UNICODE_NONCHAR(c)) {
- return c;
- } else {
- // strict: forbid non-characters like U+fffe
- return errorValue(3, strict);
- }
- }
- }
- }
- }
- }
- return errorValue(0, strict);
-}
-
-U_CAPI int32_t U_EXPORT2
-utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i) {
- // Same as utf8_prevCharSafeBody(..., strict=-1) minus assembling code points.
- int32_t orig_i=i;
- uint8_t c=s[i];
- if(U8_IS_TRAIL(c) && i>start) {
- uint8_t b1=s[--i];
- if(U8_IS_LEAD(b1)) {
- if(b1<0xe0 ||
- (b1<0xf0 ? U8_IS_VALID_LEAD3_AND_T1(b1, c) : U8_IS_VALID_LEAD4_AND_T1(b1, c))) {
- return i;
- }
- } else if(U8_IS_TRAIL(b1) && i>start) {
- uint8_t b2=s[--i];
- if(0xe0<=b2 && b2<=0xf4) {
- if(b2<0xf0 ? U8_IS_VALID_LEAD3_AND_T1(b2, b1) : U8_IS_VALID_LEAD4_AND_T1(b2, b1)) {
- return i;
- }
- } else if(U8_IS_TRAIL(b2) && i>start) {
- uint8_t b3=s[--i];
- if(0xf0<=b3 && b3<=0xf4 && U8_IS_VALID_LEAD4_AND_T1(b3, b2)) {
- return i;
- }
- }
- }
- }
- return orig_i;
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 1999-2012, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+* file name: utf_impl.cpp
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 1999sep13
+* created by: Markus W. Scherer
+*
+* This file provides implementation functions for macros in the utfXX.h
+* that would otherwise be too long as macros.
+*/
+
+/* set import/export definitions */
+#ifndef U_UTF8_IMPL
+# define U_UTF8_IMPL
+#endif
+
+#include "unicode/utypes.h"
+#include "unicode/utf.h"
+#include "unicode/utf8.h"
+#include "uassert.h"
+
+/*
+ * Table of the number of utf8 trail bytes, indexed by the lead byte.
+ * Used by the deprecated macro UTF8_COUNT_TRAIL_BYTES, defined in utf_old.h
+ *
+ * The current macro, U8_COUNT_TRAIL_BYTES, does _not_ use this table.
+ *
+ * Note that this table cannot be removed, even if UTF8_COUNT_TRAIL_BYTES were
+ * changed to no longer use it. References to the table from expansions of UTF8_COUNT_TRAIL_BYTES
+ * may exist in old client code that must continue to run with newer icu library versions.
+ *
+ * This table could be replaced on many machines by
+ * a few lines of assembler code using an
+ * "index of first 0-bit from msb" instruction and
+ * one or two more integer instructions.
+ *
+ * For example, on an i386, do something like
+ * - MOV AL, leadByte
+ * - NOT AL (8-bit, leave b15..b8==0..0, reverse only b7..b0)
+ * - MOV AH, 0
+ * - BSR BX, AX (16-bit)
+ * - MOV AX, 6 (result)
+ * - JZ finish (ZF==1 if leadByte==0xff)
+ * - SUB AX, BX (result)
+ * -finish:
+ * (BSR: Bit Scan Reverse, scans for a 1-bit, starting from the MSB)
+ */
+extern "C" U_EXPORT const uint8_t
+utf8_countTrailBytes[256]={
+ 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, 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, 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, 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, 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, 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, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
+ // illegal C0 & C1
+ // 2-byte lead bytes C2..DF
+ 0, 0, 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,
+
+ // 3-byte lead bytes E0..EF
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ // 4-byte lead bytes F0..F4
+ // illegal F5..FF
+ 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+static const UChar32
+utf8_errorValue[6]={
+ // Same values as UTF8_ERROR_VALUE_1, UTF8_ERROR_VALUE_2, UTF_ERROR_VALUE,
+ // but without relying on the obsolete unicode/utf_old.h.
+ 0x15, 0x9f, 0xffff,
+ 0x10ffff
+};
+
+static UChar32
+errorValue(int32_t count, int8_t strict) {
+ if(strict>=0) {
+ return utf8_errorValue[count];
+ } else if(strict==-3) {
+ return 0xfffd;
+ } else {
+ return U_SENTINEL;
+ }
+}
+
+/*
+ * Handle the non-inline part of the U8_NEXT() and U8_NEXT_FFFD() macros
+ * and their obsolete sibling UTF8_NEXT_CHAR_SAFE().
+ *
+ * U8_NEXT() supports NUL-terminated strings indicated via length<0.
+ *
+ * The "strict" parameter controls the error behavior:
+ * <0 "Safe" behavior of U8_NEXT():
+ * -1: All illegal byte sequences yield U_SENTINEL=-1.
+ * -2: Same as -1, except for lenient treatment of surrogate code points as legal.
+ * Some implementations use this for roundtripping of
+ * Unicode 16-bit strings that are not well-formed UTF-16, that is, they
+ * contain unpaired surrogates.
+ * -3: All illegal byte sequences yield U+FFFD.
+ * 0 Obsolete "safe" behavior of UTF8_NEXT_CHAR_SAFE(..., FALSE):
+ * All illegal byte sequences yield a positive code point such that this
+ * result code point would be encoded with the same number of bytes as
+ * the illegal sequence.
+ * >0 Obsolete "strict" behavior of UTF8_NEXT_CHAR_SAFE(..., TRUE):
+ * Same as the obsolete "safe" behavior, but non-characters are also treated
+ * like illegal sequences.
+ *
+ * Note that a UBool is the same as an int8_t.
+ */
+U_CAPI UChar32 U_EXPORT2
+utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c, UBool strict) {
+ // *pi is one after byte c.
+ int32_t i=*pi;
+ // length can be negative for NUL-terminated strings: Read and validate one byte at a time.
+ if(i==length || c>0xf4) {
+ // end of string, or not a lead byte
+ } else if(c>=0xf0) {
+ // Test for 4-byte sequences first because
+ // U8_NEXT() handles shorter valid sequences inline.
+ uint8_t t1=s[i], t2, t3;
+ c&=7;
+ if(U8_IS_VALID_LEAD4_AND_T1(c, t1) &&
+ ++i!=length && (t2=s[i]-0x80)<=0x3f &&
+ ++i!=length && (t3=s[i]-0x80)<=0x3f) {
+ ++i;
+ c=(c<<18)|((t1&0x3f)<<12)|(t2<<6)|t3;
+ // strict: forbid non-characters like U+fffe
+ if(strict<=0 || !U_IS_UNICODE_NONCHAR(c)) {
+ *pi=i;
+ return c;
+ }
+ }
+ } else if(c>=0xe0) {
+ c&=0xf;
+ if(strict!=-2) {
+ uint8_t t1=s[i], t2;
+ if(U8_IS_VALID_LEAD3_AND_T1(c, t1) &&
+ ++i!=length && (t2=s[i]-0x80)<=0x3f) {
+ ++i;
+ c=(c<<12)|((t1&0x3f)<<6)|t2;
+ // strict: forbid non-characters like U+fffe
+ if(strict<=0 || !U_IS_UNICODE_NONCHAR(c)) {
+ *pi=i;
+ return c;
+ }
+ }
+ } else {
+ // strict=-2 -> lenient: allow surrogates
+ uint8_t t1=s[i]-0x80, t2;
+ if(t1<=0x3f && (c>0 || t1>=0x20) &&
+ ++i!=length && (t2=s[i]-0x80)<=0x3f) {
+ *pi=i+1;
+ return (c<<12)|(t1<<6)|t2;
+ }
+ }
+ } else if(c>=0xc2) {
+ uint8_t t1=s[i]-0x80;
+ if(t1<=0x3f) {
+ *pi=i+1;
+ return ((c-0xc0)<<6)|t1;
+ }
+ } // else 0x80<=c<0xc2 is not a lead byte
+
+ /* error handling */
+ c=errorValue(i-*pi, strict);
+ *pi=i;
+ return c;
+}
+
+U_CAPI int32_t U_EXPORT2
+utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool *pIsError) {
+ if((uint32_t)(c)<=0x7ff) {
+ if((i)+1<(length)) {
+ (s)[(i)++]=(uint8_t)(((c)>>6)|0xc0);
+ (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80);
+ return i;
+ }
+ } else if((uint32_t)(c)<=0xffff) {
+ /* Starting with Unicode 3.2, surrogate code points must not be encoded in UTF-8. */
+ if((i)+2<(length) && !U_IS_SURROGATE(c)) {
+ (s)[(i)++]=(uint8_t)(((c)>>12)|0xe0);
+ (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80);
+ (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80);
+ return i;
+ }
+ } else if((uint32_t)(c)<=0x10ffff) {
+ if((i)+3<(length)) {
+ (s)[(i)++]=(uint8_t)(((c)>>18)|0xf0);
+ (s)[(i)++]=(uint8_t)((((c)>>12)&0x3f)|0x80);
+ (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80);
+ (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80);
+ return i;
+ }
+ }
+ /* c>0x10ffff or not enough space, write an error value */
+ if(pIsError!=NULL) {
+ *pIsError=TRUE;
+ } else {
+ length-=i;
+ if(length>0) {
+ int32_t offset;
+ if(length>3) {
+ length=3;
+ }
+ s+=i;
+ offset=0;
+ c=utf8_errorValue[length-1];
+ U8_APPEND_UNSAFE(s, offset, c);
+ i=i+offset;
+ }
+ }
+ return i;
+}
+
+U_CAPI UChar32 U_EXPORT2
+utf8_prevCharSafeBody(const uint8_t *s, int32_t start, int32_t *pi, UChar32 c, UBool strict) {
+ // *pi is the index of byte c.
+ int32_t i=*pi;
+ if(U8_IS_TRAIL(c) && i>start) {
+ uint8_t b1=s[--i];
+ if(U8_IS_LEAD(b1)) {
+ if(b1<0xe0) {
+ *pi=i;
+ return ((b1-0xc0)<<6)|(c&0x3f);
+ } else if(b1<0xf0 ? U8_IS_VALID_LEAD3_AND_T1(b1, c) : U8_IS_VALID_LEAD4_AND_T1(b1, c)) {
+ // Truncated 3- or 4-byte sequence.
+ *pi=i;
+ return errorValue(1, strict);
+ }
+ } else if(U8_IS_TRAIL(b1) && i>start) {
+ // Extract the value bits from the last trail byte.
+ c&=0x3f;
+ uint8_t b2=s[--i];
+ if(0xe0<=b2 && b2<=0xf4) {
+ if(b2<0xf0) {
+ b2&=0xf;
+ if(strict!=-2) {
+ if(U8_IS_VALID_LEAD3_AND_T1(b2, b1)) {
+ *pi=i;
+ c=(b2<<12)|((b1&0x3f)<<6)|c;
+ if(strict<=0 || !U_IS_UNICODE_NONCHAR(c)) {
+ return c;
+ } else {
+ // strict: forbid non-characters like U+fffe
+ return errorValue(2, strict);
+ }
+ }
+ } else {
+ // strict=-2 -> lenient: allow surrogates
+ b1-=0x80;
+ if((b2>0 || b1>=0x20)) {
+ *pi=i;
+ return (b2<<12)|(b1<<6)|c;
+ }
+ }
+ } else if(U8_IS_VALID_LEAD4_AND_T1(b2, b1)) {
+ // Truncated 4-byte sequence.
+ *pi=i;
+ return errorValue(2, strict);
+ }
+ } else if(U8_IS_TRAIL(b2) && i>start) {
+ uint8_t b3=s[--i];
+ if(0xf0<=b3 && b3<=0xf4) {
+ b3&=7;
+ if(U8_IS_VALID_LEAD4_AND_T1(b3, b2)) {
+ *pi=i;
+ c=(b3<<18)|((b2&0x3f)<<12)|((b1&0x3f)<<6)|c;
+ if(strict<=0 || !U_IS_UNICODE_NONCHAR(c)) {
+ return c;
+ } else {
+ // strict: forbid non-characters like U+fffe
+ return errorValue(3, strict);
+ }
+ }
+ }
+ }
+ }
+ }
+ return errorValue(0, strict);
+}
+
+U_CAPI int32_t U_EXPORT2
+utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i) {
+ // Same as utf8_prevCharSafeBody(..., strict=-1) minus assembling code points.
+ int32_t orig_i=i;
+ uint8_t c=s[i];
+ if(U8_IS_TRAIL(c) && i>start) {
+ uint8_t b1=s[--i];
+ if(U8_IS_LEAD(b1)) {
+ if(b1<0xe0 ||
+ (b1<0xf0 ? U8_IS_VALID_LEAD3_AND_T1(b1, c) : U8_IS_VALID_LEAD4_AND_T1(b1, c))) {
+ return i;
+ }
+ } else if(U8_IS_TRAIL(b1) && i>start) {
+ uint8_t b2=s[--i];
+ if(0xe0<=b2 && b2<=0xf4) {
+ if(b2<0xf0 ? U8_IS_VALID_LEAD3_AND_T1(b2, b1) : U8_IS_VALID_LEAD4_AND_T1(b2, b1)) {
+ return i;
+ }
+ } else if(U8_IS_TRAIL(b2) && i>start) {
+ uint8_t b3=s[--i];
+ if(0xf0<=b3 && b3<=0xf4 && U8_IS_VALID_LEAD4_AND_T1(b3, b2)) {
+ return i;
+ }
+ }
+ }
+ }
+ return orig_i;
+}
diff --git a/contrib/libs/icu/common/util.cpp b/contrib/libs/icu/common/util.cpp
index 3be68576fa..86e5c791ba 100644
--- a/contrib/libs/icu/common/util.cpp
+++ b/contrib/libs/icu/common/util.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -276,16 +276,16 @@ int32_t ICU_Utility::parsePattern(const UnicodeString& pat,
return -1; // text ended before end of pat
}
-int32_t ICU_Utility::parseAsciiInteger(const UnicodeString& str, int32_t& pos) {
- int32_t result = 0;
- UChar c;
- while (pos < str.length() && (c = str.charAt(pos)) >= u'0' && c <= u'9') {
- result = result * 10 + (c - u'0');
- pos++;
- }
- return result;
-}
-
+int32_t ICU_Utility::parseAsciiInteger(const UnicodeString& str, int32_t& pos) {
+ int32_t result = 0;
+ UChar c;
+ while (pos < str.length() && (c = str.charAt(pos)) >= u'0' && c <= u'9') {
+ result = result * 10 + (c - u'0');
+ pos++;
+ }
+ return result;
+}
+
/**
* Append a character to a rule that is being built up. To flush
* the quoteBuf to rule, make one final call with isLiteral == TRUE.
diff --git a/contrib/libs/icu/common/util.h b/contrib/libs/icu/common/util.h
index 671e7aea24..f3f71dce45 100644
--- a/contrib/libs/icu/common/util.h
+++ b/contrib/libs/icu/common/util.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -46,13 +46,13 @@ class U_COMMON_API ICU_Utility /* not : public UObject because all methods are s
int32_t radix = 10,
int32_t minDigits = 1);
- /** Returns a bogus UnicodeString by value. */
- static inline UnicodeString makeBogusString() {
- UnicodeString result;
- result.setToBogus();
- return result;
- }
-
+ /** Returns a bogus UnicodeString by value. */
+ static inline UnicodeString makeBogusString() {
+ UnicodeString result;
+ result.setToBogus();
+ return result;
+ }
+
/**
* Return true if the character is NOT printable ASCII.
*
@@ -179,22 +179,22 @@ class U_COMMON_API ICU_Utility /* not : public UObject because all methods are s
* Parse an integer at pos, either of the form \d+ or of the form
* 0x[0-9A-Fa-f]+ or 0[0-7]+, that is, in standard decimal, hex,
* or octal format.
- * @param pos INPUT-OUTPUT parameter. On input, the index of the first
- * character to parse. On output, the index of the character after the
- * last parsed character.
+ * @param pos INPUT-OUTPUT parameter. On input, the index of the first
+ * character to parse. On output, the index of the character after the
+ * last parsed character.
*/
static int32_t parseInteger(const UnicodeString& rule, int32_t& pos, int32_t limit);
/**
- * Parse an integer at pos using only ASCII digits.
- * Base 10 only.
- * @param pos INPUT-OUTPUT parameter. On input, the index of the first
- * character to parse. On output, the index of the character after the
- * last parsed character.
- */
- static int32_t parseAsciiInteger(const UnicodeString& str, int32_t& pos);
-
- /**
+ * Parse an integer at pos using only ASCII digits.
+ * Base 10 only.
+ * @param pos INPUT-OUTPUT parameter. On input, the index of the first
+ * character to parse. On output, the index of the character after the
+ * last parsed character.
+ */
+ static int32_t parseAsciiInteger(const UnicodeString& str, int32_t& pos);
+
+ /**
* Parse a Unicode identifier from the given string at the given
* position. Return the identifier, or an empty string if there
* is no identifier.
diff --git a/contrib/libs/icu/common/util_props.cpp b/contrib/libs/icu/common/util_props.cpp
index 9fd13db5fd..95a112bc91 100644
--- a/contrib/libs/icu/common/util_props.cpp
+++ b/contrib/libs/icu/common/util_props.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/common/utrace.cpp b/contrib/libs/icu/common/utrace.cpp
index f642199f25..c981546594 100644
--- a/contrib/libs/icu/common/utrace.cpp
+++ b/contrib/libs/icu/common/utrace.cpp
@@ -1,504 +1,504 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-*******************************************************************************
-* Copyright (C) 2003-2014, International Business Machines
-* Corporation and others. All Rights Reserved.
-*******************************************************************************
-* file name: utrace.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*/
-
-#include "unicode/utrace.h"
-#include "utracimp.h"
-#include "cstring.h"
-#include "uassert.h"
-#include "ucln_cmn.h"
-
-
-static UTraceEntry *pTraceEntryFunc = NULL;
-static UTraceExit *pTraceExitFunc = NULL;
-static UTraceData *pTraceDataFunc = NULL;
-static const void *gTraceContext = NULL;
-
-/**
- * \var utrace_level
- * Trace level variable. Negative for "off".
- */
-static int32_t
-utrace_level = UTRACE_ERROR;
-
-U_CAPI void U_EXPORT2
-utrace_entry(int32_t fnNumber) {
- if (pTraceEntryFunc != NULL) {
- (*pTraceEntryFunc)(gTraceContext, fnNumber);
- }
-}
-
-
-static const char gExitFmt[] = "Returns.";
-static const char gExitFmtValue[] = "Returns %d.";
-static const char gExitFmtStatus[] = "Returns. Status = %d.";
-static const char gExitFmtValueStatus[] = "Returns %d. Status = %d.";
-static const char gExitFmtPtrStatus[] = "Returns %d. Status = %p.";
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+* Copyright (C) 2003-2014, International Business Machines
+* Corporation and others. All Rights Reserved.
+*******************************************************************************
+* file name: utrace.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*/
+
+#include "unicode/utrace.h"
+#include "utracimp.h"
+#include "cstring.h"
+#include "uassert.h"
+#include "ucln_cmn.h"
+
+
+static UTraceEntry *pTraceEntryFunc = NULL;
+static UTraceExit *pTraceExitFunc = NULL;
+static UTraceData *pTraceDataFunc = NULL;
+static const void *gTraceContext = NULL;
+
+/**
+ * \var utrace_level
+ * Trace level variable. Negative for "off".
+ */
+static int32_t
+utrace_level = UTRACE_ERROR;
+
+U_CAPI void U_EXPORT2
+utrace_entry(int32_t fnNumber) {
+ if (pTraceEntryFunc != NULL) {
+ (*pTraceEntryFunc)(gTraceContext, fnNumber);
+ }
+}
+
+
+static const char gExitFmt[] = "Returns.";
+static const char gExitFmtValue[] = "Returns %d.";
+static const char gExitFmtStatus[] = "Returns. Status = %d.";
+static const char gExitFmtValueStatus[] = "Returns %d. Status = %d.";
+static const char gExitFmtPtrStatus[] = "Returns %d. Status = %p.";
+
+U_CAPI void U_EXPORT2
+utrace_exit(int32_t fnNumber, int32_t returnType, ...) {
+ if (pTraceExitFunc != NULL) {
+ va_list args;
+ const char *fmt;
+
+ switch (returnType) {
+ case 0:
+ fmt = gExitFmt;
+ break;
+ case UTRACE_EXITV_I32:
+ fmt = gExitFmtValue;
+ break;
+ case UTRACE_EXITV_STATUS:
+ fmt = gExitFmtStatus;
+ break;
+ case UTRACE_EXITV_I32 | UTRACE_EXITV_STATUS:
+ fmt = gExitFmtValueStatus;
+ break;
+ case UTRACE_EXITV_PTR | UTRACE_EXITV_STATUS:
+ fmt = gExitFmtPtrStatus;
+ break;
+ default:
+ UPRV_UNREACHABLE;
+ }
+
+ va_start(args, returnType);
+ (*pTraceExitFunc)(gTraceContext, fnNumber, fmt, args);
+ va_end(args);
+ }
+}
+
+
U_CAPI void U_EXPORT2
-utrace_exit(int32_t fnNumber, int32_t returnType, ...) {
- if (pTraceExitFunc != NULL) {
- va_list args;
- const char *fmt;
-
- switch (returnType) {
- case 0:
- fmt = gExitFmt;
- break;
- case UTRACE_EXITV_I32:
- fmt = gExitFmtValue;
- break;
- case UTRACE_EXITV_STATUS:
- fmt = gExitFmtStatus;
- break;
- case UTRACE_EXITV_I32 | UTRACE_EXITV_STATUS:
- fmt = gExitFmtValueStatus;
- break;
- case UTRACE_EXITV_PTR | UTRACE_EXITV_STATUS:
- fmt = gExitFmtPtrStatus;
- break;
- default:
- UPRV_UNREACHABLE;
- }
-
- va_start(args, returnType);
- (*pTraceExitFunc)(gTraceContext, fnNumber, fmt, args);
- va_end(args);
- }
-}
-
-
-
-U_CAPI void U_EXPORT2
-utrace_data(int32_t fnNumber, int32_t level, const char *fmt, ...) {
- if (pTraceDataFunc != NULL) {
- va_list args;
- va_start(args, fmt );
- (*pTraceDataFunc)(gTraceContext, fnNumber, level, fmt, args);
- va_end(args);
- }
-}
-
-
-static void outputChar(char c, char *outBuf, int32_t *outIx, int32_t capacity, int32_t indent) {
- int32_t i;
- /* Check whether a start of line indenting is needed. Three cases:
- * 1. At the start of the first line (output index == 0).
- * 2. At the start of subsequent lines (preceeding char in buffer == '\n')
- * 3. When preflighting buffer len (buffer capacity is exceeded), when
- * a \n is output. Ideally we wouldn't do the indent until the following char
- * is received, but that won't work because there's no place to remember that
- * the preceding char was \n. Meaning that we may overstimate the
- * buffer size needed. No harm done.
- */
- if (*outIx==0 || /* case 1. */
- (c!='\n' && c!=0 && *outIx < capacity && outBuf[(*outIx)-1]=='\n') || /* case 2. */
- (c=='\n' && *outIx>=capacity)) /* case 3 */
- {
- /* At the start of a line. Indent. */
- for(i=0; i<indent; i++) {
- if (*outIx < capacity) {
- outBuf[*outIx] = ' ';
- }
- (*outIx)++;
- }
- }
-
- if (*outIx < capacity) {
- outBuf[*outIx] = c;
- }
- if (c != 0) {
- /* Nulls only appear as end-of-string terminators. Move them to the output
- * buffer, but do not update the length of the buffer, so that any
- * following output will overwrite the null. */
- (*outIx)++;
- }
-}
-
-static void outputHexBytes(int64_t val, int32_t charsToOutput,
- char *outBuf, int32_t *outIx, int32_t capacity) {
- static const char gHexChars[] = "0123456789abcdef";
- int32_t shiftCount;
- for (shiftCount=(charsToOutput-1)*4; shiftCount >= 0; shiftCount-=4) {
- char c = gHexChars[(val >> shiftCount) & 0xf];
- outputChar(c, outBuf, outIx, capacity, 0);
- }
-}
-
-/* Output a pointer value in hex. Work with any size of pointer */
-static void outputPtrBytes(void *val, char *outBuf, int32_t *outIx, int32_t capacity) {
- uint32_t i;
- int32_t incVal = 1; /* +1 for big endian, -1 for little endian */
- char *p = (char *)&val; /* point to current byte to output in the ptr val */
-
-#if !U_IS_BIG_ENDIAN
- /* Little Endian. Move p to most significant end of the value */
- incVal = -1;
- p += sizeof(void *) - 1;
-#endif
-
- /* Loop through the bytes of the ptr as it sits in memory, from
- * most significant to least significant end */
- for (i=0; i<sizeof(void *); i++) {
- outputHexBytes(*p, 2, outBuf, outIx, capacity);
- p += incVal;
- }
-}
-
-static void outputString(const char *s, char *outBuf, int32_t *outIx, int32_t capacity, int32_t indent) {
- int32_t i = 0;
- char c;
- if (s==NULL) {
- s = "*NULL*";
- }
- do {
- c = s[i++];
- outputChar(c, outBuf, outIx, capacity, indent);
- } while (c != 0);
-}
-
-
-
-static void outputUString(const UChar *s, int32_t len,
- char *outBuf, int32_t *outIx, int32_t capacity, int32_t indent) {
- int32_t i = 0;
- UChar c;
- if (s==NULL) {
- outputString(NULL, outBuf, outIx, capacity, indent);
- return;
- }
-
- for (i=0; i<len || len==-1; i++) {
- c = s[i];
- outputHexBytes(c, 4, outBuf, outIx, capacity);
- outputChar(' ', outBuf, outIx, capacity, indent);
- if (len == -1 && c==0) {
- break;
- }
- }
-}
-
-U_CAPI int32_t U_EXPORT2
-utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt, va_list args) {
- int32_t outIx = 0;
- int32_t fmtIx = 0;
- char fmtC;
- char c;
- int32_t intArg;
- int64_t longArg = 0;
- char *ptrArg;
-
- /* Loop runs once for each character in the format string.
- */
- for (;;) {
- fmtC = fmt[fmtIx++];
- if (fmtC != '%') {
- /* Literal character, not part of a %sequence. Just copy it to the output. */
- outputChar(fmtC, outBuf, &outIx, capacity, indent);
- if (fmtC == 0) {
- /* We hit the null that terminates the format string.
- * This is the normal (and only) exit from the loop that
- * interprets the format
- */
- break;
- }
- continue;
- }
-
- /* We encountered a '%'. Pick up the following format char */
- fmtC = fmt[fmtIx++];
-
- switch (fmtC) {
- case 'c':
- /* single 8 bit char */
- c = (char)va_arg(args, int32_t);
- outputChar(c, outBuf, &outIx, capacity, indent);
- break;
-
- case 's':
- /* char * string, null terminated. */
- ptrArg = va_arg(args, char *);
- outputString((const char *)ptrArg, outBuf, &outIx, capacity, indent);
- break;
-
- case 'S':
- /* UChar * string, with length, len==-1 for null terminated. */
- ptrArg = va_arg(args, char *); /* Ptr */
- intArg =(int32_t)va_arg(args, int32_t); /* Length */
- outputUString((const UChar *)ptrArg, intArg, outBuf, &outIx, capacity, indent);
- break;
-
- case 'b':
- /* 8 bit int */
- intArg = va_arg(args, int);
- outputHexBytes(intArg, 2, outBuf, &outIx, capacity);
- break;
-
- case 'h':
- /* 16 bit int */
- intArg = va_arg(args, int);
- outputHexBytes(intArg, 4, outBuf, &outIx, capacity);
- break;
-
- case 'd':
- /* 32 bit int */
- intArg = va_arg(args, int);
- outputHexBytes(intArg, 8, outBuf, &outIx, capacity);
- break;
-
- case 'l':
- /* 64 bit long */
- longArg = va_arg(args, int64_t);
- outputHexBytes(longArg, 16, outBuf, &outIx, capacity);
- break;
-
- case 'p':
- /* Pointers. */
- ptrArg = va_arg(args, char *);
- outputPtrBytes(ptrArg, outBuf, &outIx, capacity);
- break;
-
- case 0:
- /* Single '%' at end of fmt string. Output as literal '%'.
- * Back up index into format string so that the terminating null will be
- * re-fetched in the outer loop, causing it to terminate.
- */
- outputChar('%', outBuf, &outIx, capacity, indent);
- fmtIx--;
- break;
-
- case 'v':
- {
- /* Vector of values, e.g. %vh */
- char vectorType;
- int32_t vectorLen;
- const char *i8Ptr;
- int16_t *i16Ptr;
- int32_t *i32Ptr;
- int64_t *i64Ptr;
- void **ptrPtr;
- int32_t charsToOutput = 0;
- int32_t i;
-
- vectorType = fmt[fmtIx]; /* b, h, d, l, p, etc. */
- if (vectorType != 0) {
- fmtIx++;
- }
- i8Ptr = (const char *)va_arg(args, void*);
- i16Ptr = (int16_t *)i8Ptr;
- i32Ptr = (int32_t *)i8Ptr;
- i64Ptr = (int64_t *)i8Ptr;
- ptrPtr = (void **)i8Ptr;
- vectorLen =(int32_t)va_arg(args, int32_t);
- if (ptrPtr == NULL) {
- outputString("*NULL* ", outBuf, &outIx, capacity, indent);
- } else {
- for (i=0; i<vectorLen || vectorLen==-1; i++) {
- switch (vectorType) {
- case 'b':
- charsToOutput = 2;
- longArg = *i8Ptr++;
- break;
- case 'h':
- charsToOutput = 4;
- longArg = *i16Ptr++;
- break;
- case 'd':
- charsToOutput = 8;
- longArg = *i32Ptr++;
- break;
- case 'l':
- charsToOutput = 16;
- longArg = *i64Ptr++;
- break;
- case 'p':
- charsToOutput = 0;
- outputPtrBytes(*ptrPtr, outBuf, &outIx, capacity);
- longArg = *ptrPtr==NULL? 0: 1; /* test for null terminated array. */
- ptrPtr++;
- break;
- case 'c':
- charsToOutput = 0;
- outputChar(*i8Ptr, outBuf, &outIx, capacity, indent);
- longArg = *i8Ptr; /* for test for null terminated array. */
- i8Ptr++;
- break;
- case 's':
- charsToOutput = 0;
- outputString((const char *)*ptrPtr, outBuf, &outIx, capacity, indent);
- outputChar('\n', outBuf, &outIx, capacity, indent);
- longArg = *ptrPtr==NULL? 0: 1; /* for test for null term. array. */
- ptrPtr++;
- break;
-
- case 'S':
- charsToOutput = 0;
- outputUString((const UChar *)*ptrPtr, -1, outBuf, &outIx, capacity, indent);
- outputChar('\n', outBuf, &outIx, capacity, indent);
- longArg = *ptrPtr==NULL? 0: 1; /* for test for null term. array. */
- ptrPtr++;
- break;
-
-
- }
- if (charsToOutput > 0) {
- outputHexBytes(longArg, charsToOutput, outBuf, &outIx, capacity);
- outputChar(' ', outBuf, &outIx, capacity, indent);
- }
- if (vectorLen == -1 && longArg == 0) {
- break;
- }
- }
- }
- outputChar('[', outBuf, &outIx, capacity, indent);
- outputHexBytes(vectorLen, 8, outBuf, &outIx, capacity);
- outputChar(']', outBuf, &outIx, capacity, indent);
- }
- break;
-
-
- default:
- /* %. in format string, where . is some character not in the set
- * of recognized format chars. Just output it as if % wasn't there.
- * (Covers "%%" outputing a single '%')
- */
- outputChar(fmtC, outBuf, &outIx, capacity, indent);
- }
- }
- outputChar(0, outBuf, &outIx, capacity, indent); /* Make sure that output is null terminated */
- return outIx + 1; /* outIx + 1 because outIx does not increment when outputing final null. */
-}
-
-
-
-
-U_CAPI int32_t U_EXPORT2
-utrace_format(char *outBuf, int32_t capacity,
- int32_t indent, const char *fmt, ...) {
- int32_t retVal;
- va_list args;
- va_start(args, fmt );
- retVal = utrace_vformat(outBuf, capacity, indent, fmt, args);
- va_end(args);
- return retVal;
-}
-
-
-U_CAPI void U_EXPORT2
-utrace_setFunctions(const void *context,
- UTraceEntry *e, UTraceExit *x, UTraceData *d) {
- pTraceEntryFunc = e;
- pTraceExitFunc = x;
- pTraceDataFunc = d;
- gTraceContext = context;
-}
-
-
-U_CAPI void U_EXPORT2
-utrace_getFunctions(const void **context,
- UTraceEntry **e, UTraceExit **x, UTraceData **d) {
- *e = pTraceEntryFunc;
- *x = pTraceExitFunc;
- *d = pTraceDataFunc;
- *context = gTraceContext;
-}
-
-U_CAPI void U_EXPORT2
-utrace_setLevel(int32_t level) {
- if (level < UTRACE_OFF) {
- level = UTRACE_OFF;
- }
- if (level > UTRACE_VERBOSE) {
- level = UTRACE_VERBOSE;
- }
- utrace_level = level;
-}
-
-U_CAPI int32_t U_EXPORT2
-utrace_getLevel() {
- return utrace_level;
-}
-
-
-U_CFUNC UBool
-utrace_cleanup() {
- pTraceEntryFunc = NULL;
- pTraceExitFunc = NULL;
- pTraceDataFunc = NULL;
- utrace_level = UTRACE_OFF;
- gTraceContext = NULL;
- return TRUE;
-}
-
-
-static const char * const
-trFnName[] = {
- "u_init",
- "u_cleanup",
- NULL
-};
-
-
-static const char * const
-trConvNames[] = {
- "ucnv_open",
- "ucnv_openPackage",
- "ucnv_openAlgorithmic",
- "ucnv_clone",
- "ucnv_close",
- "ucnv_flushCache",
- "ucnv_load",
- "ucnv_unload",
- NULL
-};
-
-
-static const char * const
-trCollNames[] = {
- "ucol_open",
- "ucol_close",
- "ucol_strcoll",
- "ucol_getSortKey",
- "ucol_getLocale",
- "ucol_nextSortKeyPart",
- "ucol_strcollIter",
- "ucol_openFromShortString",
- "ucol_strcollUTF8",
- NULL
-};
-
-
-static const char* const
-trResDataNames[] = {
- "resc",
- "bundle-open",
- "file-open",
- "res-open",
- NULL
-};
-
-
-U_CAPI const char * U_EXPORT2
-utrace_functionName(int32_t fnNumber) {
- if(UTRACE_FUNCTION_START <= fnNumber && fnNumber < UTRACE_FUNCTION_LIMIT) {
- return trFnName[fnNumber];
- } else if(UTRACE_CONVERSION_START <= fnNumber && fnNumber < UTRACE_CONVERSION_LIMIT) {
- return trConvNames[fnNumber - UTRACE_CONVERSION_START];
- } else if(UTRACE_COLLATION_START <= fnNumber && fnNumber < UTRACE_COLLATION_LIMIT){
- return trCollNames[fnNumber - UTRACE_COLLATION_START];
- } else if(UTRACE_UDATA_START <= fnNumber && fnNumber < UTRACE_RES_DATA_LIMIT){
- return trResDataNames[fnNumber - UTRACE_UDATA_START];
- } else {
- return "[BOGUS Trace Function Number]";
- }
-}
-
+utrace_data(int32_t fnNumber, int32_t level, const char *fmt, ...) {
+ if (pTraceDataFunc != NULL) {
+ va_list args;
+ va_start(args, fmt );
+ (*pTraceDataFunc)(gTraceContext, fnNumber, level, fmt, args);
+ va_end(args);
+ }
+}
+
+
+static void outputChar(char c, char *outBuf, int32_t *outIx, int32_t capacity, int32_t indent) {
+ int32_t i;
+ /* Check whether a start of line indenting is needed. Three cases:
+ * 1. At the start of the first line (output index == 0).
+ * 2. At the start of subsequent lines (preceeding char in buffer == '\n')
+ * 3. When preflighting buffer len (buffer capacity is exceeded), when
+ * a \n is output. Ideally we wouldn't do the indent until the following char
+ * is received, but that won't work because there's no place to remember that
+ * the preceding char was \n. Meaning that we may overstimate the
+ * buffer size needed. No harm done.
+ */
+ if (*outIx==0 || /* case 1. */
+ (c!='\n' && c!=0 && *outIx < capacity && outBuf[(*outIx)-1]=='\n') || /* case 2. */
+ (c=='\n' && *outIx>=capacity)) /* case 3 */
+ {
+ /* At the start of a line. Indent. */
+ for(i=0; i<indent; i++) {
+ if (*outIx < capacity) {
+ outBuf[*outIx] = ' ';
+ }
+ (*outIx)++;
+ }
+ }
+
+ if (*outIx < capacity) {
+ outBuf[*outIx] = c;
+ }
+ if (c != 0) {
+ /* Nulls only appear as end-of-string terminators. Move them to the output
+ * buffer, but do not update the length of the buffer, so that any
+ * following output will overwrite the null. */
+ (*outIx)++;
+ }
+}
+
+static void outputHexBytes(int64_t val, int32_t charsToOutput,
+ char *outBuf, int32_t *outIx, int32_t capacity) {
+ static const char gHexChars[] = "0123456789abcdef";
+ int32_t shiftCount;
+ for (shiftCount=(charsToOutput-1)*4; shiftCount >= 0; shiftCount-=4) {
+ char c = gHexChars[(val >> shiftCount) & 0xf];
+ outputChar(c, outBuf, outIx, capacity, 0);
+ }
+}
+
+/* Output a pointer value in hex. Work with any size of pointer */
+static void outputPtrBytes(void *val, char *outBuf, int32_t *outIx, int32_t capacity) {
+ uint32_t i;
+ int32_t incVal = 1; /* +1 for big endian, -1 for little endian */
+ char *p = (char *)&val; /* point to current byte to output in the ptr val */
+
+#if !U_IS_BIG_ENDIAN
+ /* Little Endian. Move p to most significant end of the value */
+ incVal = -1;
+ p += sizeof(void *) - 1;
+#endif
+
+ /* Loop through the bytes of the ptr as it sits in memory, from
+ * most significant to least significant end */
+ for (i=0; i<sizeof(void *); i++) {
+ outputHexBytes(*p, 2, outBuf, outIx, capacity);
+ p += incVal;
+ }
+}
+
+static void outputString(const char *s, char *outBuf, int32_t *outIx, int32_t capacity, int32_t indent) {
+ int32_t i = 0;
+ char c;
+ if (s==NULL) {
+ s = "*NULL*";
+ }
+ do {
+ c = s[i++];
+ outputChar(c, outBuf, outIx, capacity, indent);
+ } while (c != 0);
+}
+
+
+
+static void outputUString(const UChar *s, int32_t len,
+ char *outBuf, int32_t *outIx, int32_t capacity, int32_t indent) {
+ int32_t i = 0;
+ UChar c;
+ if (s==NULL) {
+ outputString(NULL, outBuf, outIx, capacity, indent);
+ return;
+ }
+
+ for (i=0; i<len || len==-1; i++) {
+ c = s[i];
+ outputHexBytes(c, 4, outBuf, outIx, capacity);
+ outputChar(' ', outBuf, outIx, capacity, indent);
+ if (len == -1 && c==0) {
+ break;
+ }
+ }
+}
+
+U_CAPI int32_t U_EXPORT2
+utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt, va_list args) {
+ int32_t outIx = 0;
+ int32_t fmtIx = 0;
+ char fmtC;
+ char c;
+ int32_t intArg;
+ int64_t longArg = 0;
+ char *ptrArg;
+
+ /* Loop runs once for each character in the format string.
+ */
+ for (;;) {
+ fmtC = fmt[fmtIx++];
+ if (fmtC != '%') {
+ /* Literal character, not part of a %sequence. Just copy it to the output. */
+ outputChar(fmtC, outBuf, &outIx, capacity, indent);
+ if (fmtC == 0) {
+ /* We hit the null that terminates the format string.
+ * This is the normal (and only) exit from the loop that
+ * interprets the format
+ */
+ break;
+ }
+ continue;
+ }
+
+ /* We encountered a '%'. Pick up the following format char */
+ fmtC = fmt[fmtIx++];
+
+ switch (fmtC) {
+ case 'c':
+ /* single 8 bit char */
+ c = (char)va_arg(args, int32_t);
+ outputChar(c, outBuf, &outIx, capacity, indent);
+ break;
+
+ case 's':
+ /* char * string, null terminated. */
+ ptrArg = va_arg(args, char *);
+ outputString((const char *)ptrArg, outBuf, &outIx, capacity, indent);
+ break;
+
+ case 'S':
+ /* UChar * string, with length, len==-1 for null terminated. */
+ ptrArg = va_arg(args, char *); /* Ptr */
+ intArg =(int32_t)va_arg(args, int32_t); /* Length */
+ outputUString((const UChar *)ptrArg, intArg, outBuf, &outIx, capacity, indent);
+ break;
+
+ case 'b':
+ /* 8 bit int */
+ intArg = va_arg(args, int);
+ outputHexBytes(intArg, 2, outBuf, &outIx, capacity);
+ break;
+
+ case 'h':
+ /* 16 bit int */
+ intArg = va_arg(args, int);
+ outputHexBytes(intArg, 4, outBuf, &outIx, capacity);
+ break;
+
+ case 'd':
+ /* 32 bit int */
+ intArg = va_arg(args, int);
+ outputHexBytes(intArg, 8, outBuf, &outIx, capacity);
+ break;
+
+ case 'l':
+ /* 64 bit long */
+ longArg = va_arg(args, int64_t);
+ outputHexBytes(longArg, 16, outBuf, &outIx, capacity);
+ break;
+
+ case 'p':
+ /* Pointers. */
+ ptrArg = va_arg(args, char *);
+ outputPtrBytes(ptrArg, outBuf, &outIx, capacity);
+ break;
+
+ case 0:
+ /* Single '%' at end of fmt string. Output as literal '%'.
+ * Back up index into format string so that the terminating null will be
+ * re-fetched in the outer loop, causing it to terminate.
+ */
+ outputChar('%', outBuf, &outIx, capacity, indent);
+ fmtIx--;
+ break;
+
+ case 'v':
+ {
+ /* Vector of values, e.g. %vh */
+ char vectorType;
+ int32_t vectorLen;
+ const char *i8Ptr;
+ int16_t *i16Ptr;
+ int32_t *i32Ptr;
+ int64_t *i64Ptr;
+ void **ptrPtr;
+ int32_t charsToOutput = 0;
+ int32_t i;
+
+ vectorType = fmt[fmtIx]; /* b, h, d, l, p, etc. */
+ if (vectorType != 0) {
+ fmtIx++;
+ }
+ i8Ptr = (const char *)va_arg(args, void*);
+ i16Ptr = (int16_t *)i8Ptr;
+ i32Ptr = (int32_t *)i8Ptr;
+ i64Ptr = (int64_t *)i8Ptr;
+ ptrPtr = (void **)i8Ptr;
+ vectorLen =(int32_t)va_arg(args, int32_t);
+ if (ptrPtr == NULL) {
+ outputString("*NULL* ", outBuf, &outIx, capacity, indent);
+ } else {
+ for (i=0; i<vectorLen || vectorLen==-1; i++) {
+ switch (vectorType) {
+ case 'b':
+ charsToOutput = 2;
+ longArg = *i8Ptr++;
+ break;
+ case 'h':
+ charsToOutput = 4;
+ longArg = *i16Ptr++;
+ break;
+ case 'd':
+ charsToOutput = 8;
+ longArg = *i32Ptr++;
+ break;
+ case 'l':
+ charsToOutput = 16;
+ longArg = *i64Ptr++;
+ break;
+ case 'p':
+ charsToOutput = 0;
+ outputPtrBytes(*ptrPtr, outBuf, &outIx, capacity);
+ longArg = *ptrPtr==NULL? 0: 1; /* test for null terminated array. */
+ ptrPtr++;
+ break;
+ case 'c':
+ charsToOutput = 0;
+ outputChar(*i8Ptr, outBuf, &outIx, capacity, indent);
+ longArg = *i8Ptr; /* for test for null terminated array. */
+ i8Ptr++;
+ break;
+ case 's':
+ charsToOutput = 0;
+ outputString((const char *)*ptrPtr, outBuf, &outIx, capacity, indent);
+ outputChar('\n', outBuf, &outIx, capacity, indent);
+ longArg = *ptrPtr==NULL? 0: 1; /* for test for null term. array. */
+ ptrPtr++;
+ break;
+
+ case 'S':
+ charsToOutput = 0;
+ outputUString((const UChar *)*ptrPtr, -1, outBuf, &outIx, capacity, indent);
+ outputChar('\n', outBuf, &outIx, capacity, indent);
+ longArg = *ptrPtr==NULL? 0: 1; /* for test for null term. array. */
+ ptrPtr++;
+ break;
+
+
+ }
+ if (charsToOutput > 0) {
+ outputHexBytes(longArg, charsToOutput, outBuf, &outIx, capacity);
+ outputChar(' ', outBuf, &outIx, capacity, indent);
+ }
+ if (vectorLen == -1 && longArg == 0) {
+ break;
+ }
+ }
+ }
+ outputChar('[', outBuf, &outIx, capacity, indent);
+ outputHexBytes(vectorLen, 8, outBuf, &outIx, capacity);
+ outputChar(']', outBuf, &outIx, capacity, indent);
+ }
+ break;
+
+
+ default:
+ /* %. in format string, where . is some character not in the set
+ * of recognized format chars. Just output it as if % wasn't there.
+ * (Covers "%%" outputing a single '%')
+ */
+ outputChar(fmtC, outBuf, &outIx, capacity, indent);
+ }
+ }
+ outputChar(0, outBuf, &outIx, capacity, indent); /* Make sure that output is null terminated */
+ return outIx + 1; /* outIx + 1 because outIx does not increment when outputing final null. */
+}
+
+
+
+
+U_CAPI int32_t U_EXPORT2
+utrace_format(char *outBuf, int32_t capacity,
+ int32_t indent, const char *fmt, ...) {
+ int32_t retVal;
+ va_list args;
+ va_start(args, fmt );
+ retVal = utrace_vformat(outBuf, capacity, indent, fmt, args);
+ va_end(args);
+ return retVal;
+}
+
+
+U_CAPI void U_EXPORT2
+utrace_setFunctions(const void *context,
+ UTraceEntry *e, UTraceExit *x, UTraceData *d) {
+ pTraceEntryFunc = e;
+ pTraceExitFunc = x;
+ pTraceDataFunc = d;
+ gTraceContext = context;
+}
+
+
+U_CAPI void U_EXPORT2
+utrace_getFunctions(const void **context,
+ UTraceEntry **e, UTraceExit **x, UTraceData **d) {
+ *e = pTraceEntryFunc;
+ *x = pTraceExitFunc;
+ *d = pTraceDataFunc;
+ *context = gTraceContext;
+}
+
+U_CAPI void U_EXPORT2
+utrace_setLevel(int32_t level) {
+ if (level < UTRACE_OFF) {
+ level = UTRACE_OFF;
+ }
+ if (level > UTRACE_VERBOSE) {
+ level = UTRACE_VERBOSE;
+ }
+ utrace_level = level;
+}
+
+U_CAPI int32_t U_EXPORT2
+utrace_getLevel() {
+ return utrace_level;
+}
+
+
+U_CFUNC UBool
+utrace_cleanup() {
+ pTraceEntryFunc = NULL;
+ pTraceExitFunc = NULL;
+ pTraceDataFunc = NULL;
+ utrace_level = UTRACE_OFF;
+ gTraceContext = NULL;
+ return TRUE;
+}
+
+
+static const char * const
+trFnName[] = {
+ "u_init",
+ "u_cleanup",
+ NULL
+};
+
+
+static const char * const
+trConvNames[] = {
+ "ucnv_open",
+ "ucnv_openPackage",
+ "ucnv_openAlgorithmic",
+ "ucnv_clone",
+ "ucnv_close",
+ "ucnv_flushCache",
+ "ucnv_load",
+ "ucnv_unload",
+ NULL
+};
+
+
+static const char * const
+trCollNames[] = {
+ "ucol_open",
+ "ucol_close",
+ "ucol_strcoll",
+ "ucol_getSortKey",
+ "ucol_getLocale",
+ "ucol_nextSortKeyPart",
+ "ucol_strcollIter",
+ "ucol_openFromShortString",
+ "ucol_strcollUTF8",
+ NULL
+};
+
+
+static const char* const
+trResDataNames[] = {
+ "resc",
+ "bundle-open",
+ "file-open",
+ "res-open",
+ NULL
+};
+
+
+U_CAPI const char * U_EXPORT2
+utrace_functionName(int32_t fnNumber) {
+ if(UTRACE_FUNCTION_START <= fnNumber && fnNumber < UTRACE_FUNCTION_LIMIT) {
+ return trFnName[fnNumber];
+ } else if(UTRACE_CONVERSION_START <= fnNumber && fnNumber < UTRACE_CONVERSION_LIMIT) {
+ return trConvNames[fnNumber - UTRACE_CONVERSION_START];
+ } else if(UTRACE_COLLATION_START <= fnNumber && fnNumber < UTRACE_COLLATION_LIMIT){
+ return trCollNames[fnNumber - UTRACE_COLLATION_START];
+ } else if(UTRACE_UDATA_START <= fnNumber && fnNumber < UTRACE_RES_DATA_LIMIT){
+ return trResDataNames[fnNumber - UTRACE_UDATA_START];
+ } else {
+ return "[BOGUS Trace Function Number]";
+ }
+}
+
diff --git a/contrib/libs/icu/common/utracimp.h b/contrib/libs/icu/common/utracimp.h
index 417fe11f47..f32fe1db39 100644
--- a/contrib/libs/icu/common/utracimp.h
+++ b/contrib/libs/icu/common/utracimp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: utracimp.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -144,12 +144,12 @@ U_CDECL_END
*/
#define UTRACE_ENTRY(fnNumber) \
int32_t utraceFnNumber=(fnNumber); \
-UPRV_BLOCK_MACRO_BEGIN { \
+UPRV_BLOCK_MACRO_BEGIN { \
if(utrace_getLevel()>=UTRACE_INFO) { \
utrace_entry(fnNumber); \
utraceFnNumber |= UTRACE_TRACED_ENTRY; \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
/**
@@ -164,12 +164,12 @@ UPRV_BLOCK_MACRO_BEGIN { \
*/
#define UTRACE_ENTRY_OC(fnNumber) \
int32_t utraceFnNumber=(fnNumber); \
-UPRV_BLOCK_MACRO_BEGIN { \
+UPRV_BLOCK_MACRO_BEGIN { \
if(utrace_getLevel()>=UTRACE_OPEN_CLOSE) { \
utrace_entry(fnNumber); \
utraceFnNumber |= UTRACE_TRACED_ENTRY; \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement for each exit point of a function that has a UTRACE_ENTRY()
@@ -183,11 +183,11 @@ UPRV_BLOCK_MACRO_BEGIN { \
*
* @internal
*/
-#define UTRACE_EXIT() UPRV_BLOCK_MACRO_BEGIN { \
- if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
+#define UTRACE_EXIT() UPRV_BLOCK_MACRO_BEGIN { \
+ if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
utrace_exit(utraceFnNumber & ~UTRACE_TRACED_ENTRY, UTRACE_EXITV_NONE); \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement for each exit point of a function that has a UTRACE_ENTRY()
@@ -197,29 +197,29 @@ UPRV_BLOCK_MACRO_BEGIN { \
*
* @internal
*/
-#define UTRACE_EXIT_VALUE(val) UPRV_BLOCK_MACRO_BEGIN { \
- if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
+#define UTRACE_EXIT_VALUE(val) UPRV_BLOCK_MACRO_BEGIN { \
+ if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
utrace_exit(utraceFnNumber & ~UTRACE_TRACED_ENTRY, UTRACE_EXITV_I32, val); \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
-#define UTRACE_EXIT_STATUS(status) UPRV_BLOCK_MACRO_BEGIN { \
- if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
+#define UTRACE_EXIT_STATUS(status) UPRV_BLOCK_MACRO_BEGIN { \
+ if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
utrace_exit(utraceFnNumber & ~UTRACE_TRACED_ENTRY, UTRACE_EXITV_STATUS, status); \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
-#define UTRACE_EXIT_VALUE_STATUS(val, status) UPRV_BLOCK_MACRO_BEGIN { \
- if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
+#define UTRACE_EXIT_VALUE_STATUS(val, status) UPRV_BLOCK_MACRO_BEGIN { \
+ if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
utrace_exit(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (UTRACE_EXITV_I32 | UTRACE_EXITV_STATUS), val, status); \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
-#define UTRACE_EXIT_PTR_STATUS(ptr, status) UPRV_BLOCK_MACRO_BEGIN { \
- if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
+#define UTRACE_EXIT_PTR_STATUS(ptr, status) UPRV_BLOCK_MACRO_BEGIN { \
+ if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
utrace_exit(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (UTRACE_EXITV_PTR | UTRACE_EXITV_STATUS), ptr, status); \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -229,11 +229,11 @@ UPRV_BLOCK_MACRO_BEGIN { \
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA0(level, fmt) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTRACE_DATA0(level, fmt) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt)); \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -243,11 +243,11 @@ UPRV_BLOCK_MACRO_BEGIN { \
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA1(level, fmt, a) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTRACE_DATA1(level, fmt, a) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY , (level), (fmt), (a)); \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -257,11 +257,11 @@ UPRV_BLOCK_MACRO_BEGIN { \
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA2(level, fmt, a, b) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTRACE_DATA2(level, fmt, a, b) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY , (level), (fmt), (a), (b)); \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -271,11 +271,11 @@ UPRV_BLOCK_MACRO_BEGIN { \
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA3(level, fmt, a, b, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTRACE_DATA3(level, fmt, a, b, c) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c)); \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -285,11 +285,11 @@ UPRV_BLOCK_MACRO_BEGIN { \
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA4(level, fmt, a, b, c, d) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTRACE_DATA4(level, fmt, a, b, c, d) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c), (d)); \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -299,11 +299,11 @@ UPRV_BLOCK_MACRO_BEGIN { \
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA5(level, fmt, a, b, c, d, e) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTRACE_DATA5(level, fmt, a, b, c, d, e) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c), (d), (e)); \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -313,11 +313,11 @@ UPRV_BLOCK_MACRO_BEGIN { \
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA6(level, fmt, a, b, c, d, e, f) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTRACE_DATA6(level, fmt, a, b, c, d, e, f) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c), (d), (e), (f)); \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -327,11 +327,11 @@ UPRV_BLOCK_MACRO_BEGIN { \
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA7(level, fmt, a, b, c, d, e, f, g) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTRACE_DATA7(level, fmt, a, b, c, d, e, f, g) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c), (d), (e), (f), (g)); \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -341,11 +341,11 @@ UPRV_BLOCK_MACRO_BEGIN { \
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA8(level, fmt, a, b, c, d, e, f, g, h) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTRACE_DATA8(level, fmt, a, b, c, d, e, f, g, h) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c), (d), (e), (f), (g), (h)); \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -355,11 +355,11 @@ UPRV_BLOCK_MACRO_BEGIN { \
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA9(level, fmt, a, b, c, d, e, f, g, h, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTRACE_DATA9(level, fmt, a, b, c, d, e, f, g, h, i) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c), (d), (e), (f), (g), (h), (i)); \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
#else
diff --git a/contrib/libs/icu/common/utrie.cpp b/contrib/libs/icu/common/utrie.cpp
index 00699d0df2..ecf9b1cba7 100644
--- a/contrib/libs/icu/common/utrie.cpp
+++ b/contrib/libs/icu/common/utrie.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: utrie.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/common/utrie.h b/contrib/libs/icu/common/utrie.h
index b68d2dcf0c..532ba778eb 100644
--- a/contrib/libs/icu/common/utrie.h
+++ b/contrib/libs/icu/common/utrie.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: utrie.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -182,7 +182,7 @@ typedef struct UTrie UTrie;
]
/** Internal trie getter from a pair of surrogates */
-#define _UTRIE_GET_FROM_PAIR(trie, data, c, c2, result, resultType) UPRV_BLOCK_MACRO_BEGIN { \
+#define _UTRIE_GET_FROM_PAIR(trie, data, c, c2, result, resultType) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __offset; \
\
/* get data for lead surrogate */ \
@@ -195,18 +195,18 @@ typedef struct UTrie UTrie;
} else { \
(result)=(resultType)((trie)->initialValue); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** Internal trie getter from a BMP code point, treating a lead surrogate as a normal code point */
#define _UTRIE_GET_FROM_BMP(trie, data, c16) \
- _UTRIE_GET_RAW(trie, data, 0xd800<=(c16) && (c16)<=0xdbff ? UTRIE_LEAD_INDEX_DISP : 0, c16)
+ _UTRIE_GET_RAW(trie, data, 0xd800<=(c16) && (c16)<=0xdbff ? UTRIE_LEAD_INDEX_DISP : 0, c16)
/**
* Internal trie getter from a code point.
* Could be faster(?) but longer with
* if((c32)<=0xd7ff) { (result)=_UTRIE_GET_RAW(trie, data, 0, c32); }
*/
-#define _UTRIE_GET(trie, data, c32, result, resultType) UPRV_BLOCK_MACRO_BEGIN { \
+#define _UTRIE_GET(trie, data, c32, result, resultType) UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c32)<=0xffff) { \
/* BMP code points */ \
(result)=_UTRIE_GET_FROM_BMP(trie, data, c32); \
@@ -217,11 +217,11 @@ typedef struct UTrie UTrie;
} else { \
/* out of range */ \
(result)=(resultType)((trie)->initialValue); \
- } \
-} UPRV_BLOCK_MACRO_END
+ } \
+} UPRV_BLOCK_MACRO_END
/** Internal next-post-increment: get the next code point (c, c2) and its data */
-#define _UTRIE_NEXT(trie, data, src, limit, c, c2, result, resultType) UPRV_BLOCK_MACRO_BEGIN { \
+#define _UTRIE_NEXT(trie, data, src, limit, c, c2, result, resultType) UPRV_BLOCK_MACRO_BEGIN { \
(c)=*(src)++; \
if(!U16_IS_LEAD(c)) { \
(c2)=0; \
@@ -234,10 +234,10 @@ typedef struct UTrie UTrie;
(c2)=0; \
(result)=_UTRIE_GET_RAW((trie), data, UTRIE_LEAD_INDEX_DISP, (c)); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** Internal previous: get the previous code point (c, c2) and its data */
-#define _UTRIE_PREVIOUS(trie, data, start, src, c, c2, result, resultType) UPRV_BLOCK_MACRO_BEGIN { \
+#define _UTRIE_PREVIOUS(trie, data, start, src, c, c2, result, resultType) UPRV_BLOCK_MACRO_BEGIN { \
(c)=*--(src); \
if(!U16_IS_SURROGATE(c)) { \
(c2)=0; \
@@ -258,7 +258,7 @@ typedef struct UTrie UTrie;
(c2)=0; \
(result)=_UTRIE_GET_RAW((trie), data, UTRIE_LEAD_INDEX_DISP, (c)); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/* Public UTrie API ---------------------------------------------------------*/
@@ -556,7 +556,7 @@ struct UNewTrie {
* Index values at build-time are 32 bits wide for easier processing.
* Bit 31 is set if the data block is used by multiple index values (from utrie_setRange()).
*/
- int32_t index[UTRIE_MAX_INDEX_LENGTH+UTRIE_SURROGATE_BLOCK_COUNT];
+ int32_t index[UTRIE_MAX_INDEX_LENGTH+UTRIE_SURROGATE_BLOCK_COUNT];
uint32_t *data;
uint32_t leadUnitValue;
@@ -734,11 +734,11 @@ utrie_serialize(UNewTrie *trie, void *data, int32_t capacity,
/* serialization ------------------------------------------------------------ */
-// UTrie signature values, in platform endianness and opposite endianness.
-// The UTrie signature ASCII byte values spell "Trie".
-#define UTRIE_SIG 0x54726965
-#define UTRIE_OE_SIG 0x65697254
-
+// UTrie signature values, in platform endianness and opposite endianness.
+// The UTrie signature ASCII byte values spell "Trie".
+#define UTRIE_SIG 0x54726965
+#define UTRIE_OE_SIG 0x65697254
+
/**
* Trie data structure in serialized form:
*
diff --git a/contrib/libs/icu/common/utrie2.cpp b/contrib/libs/icu/common/utrie2.cpp
index 4a0923a444..24ef5782c9 100644
--- a/contrib/libs/icu/common/utrie2.cpp
+++ b/contrib/libs/icu/common/utrie2.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: utrie2.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -24,9 +24,9 @@
* This file contains only the runtime and enumeration code, for read-only access.
* See utrie2_builder.c for the builder code.
*/
-#include "unicode/utypes.h"
-#ifdef UCPTRIE_DEBUG
-#include "unicode/umutablecptrie.h"
+#include "unicode/utypes.h"
+#ifdef UCPTRIE_DEBUG
+#include "unicode/umutablecptrie.h"
#endif
#include "unicode/utf.h"
#include "unicode/utf8.h"
@@ -201,9 +201,9 @@ utrie2_openFromSerialized(UTrie2ValueBits valueBits,
trie->memory=(uint32_t *)data;
trie->length=actualLength;
trie->isMemoryOwned=FALSE;
-#ifdef UTRIE2_DEBUG
- trie->name="fromSerialized";
-#endif
+#ifdef UTRIE2_DEBUG
+ trie->name="fromSerialized";
+#endif
/* set the pointers to its index and data arrays */
p16=(const uint16_t *)(header+1);
@@ -296,9 +296,9 @@ utrie2_openDummy(UTrie2ValueBits valueBits,
trie->errorValue=errorValue;
trie->highStart=0;
trie->highValueIndex=dataMove+UTRIE2_DATA_START_OFFSET;
-#ifdef UTRIE2_DEBUG
- trie->name="dummy";
-#endif
+#ifdef UTRIE2_DEBUG
+ trie->name="dummy";
+#endif
/* set the header fields */
header=(UTrie2Header *)trie->memory;
@@ -378,9 +378,9 @@ utrie2_close(UTrie2 *trie) {
}
if(trie->newTrie!=NULL) {
uprv_free(trie->newTrie->data);
-#ifdef UCPTRIE_DEBUG
- umutablecptrie_close(trie->newTrie->t3);
-#endif
+#ifdef UCPTRIE_DEBUG
+ umutablecptrie_close(trie->newTrie->t3);
+#endif
uprv_free(trie->newTrie);
}
uprv_free(trie);
@@ -642,7 +642,7 @@ uint16_t BackwardUTrie2StringIterator::previous16() {
codePointLimit=codePointStart;
if(start>=codePointStart) {
codePoint=U_SENTINEL;
- return static_cast<uint16_t>(trie->errorValue);
+ return static_cast<uint16_t>(trie->errorValue);
}
uint16_t result;
UTRIE2_U16_PREV16(trie, start, codePointStart, codePoint, result);
@@ -653,7 +653,7 @@ uint16_t ForwardUTrie2StringIterator::next16() {
codePointStart=codePointLimit;
if(codePointLimit==limit) {
codePoint=U_SENTINEL;
- return static_cast<uint16_t>(trie->errorValue);
+ return static_cast<uint16_t>(trie->errorValue);
}
uint16_t result;
UTRIE2_U16_NEXT16(trie, codePointLimit, limit, codePoint, result);
diff --git a/contrib/libs/icu/common/utrie2.h b/contrib/libs/icu/common/utrie2.h
index 08738dcb6a..671f44e16a 100644
--- a/contrib/libs/icu/common/utrie2.h
+++ b/contrib/libs/icu/common/utrie2.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: utrie2.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -20,7 +20,7 @@
#define __UTRIE2_H__
#include "unicode/utypes.h"
-#include "unicode/utf8.h"
+#include "unicode/utf8.h"
#include "putilimp.h"
U_CDECL_BEGIN
@@ -54,8 +54,8 @@ typedef struct UTrie UTrie;
* is truncated, omitting both the BMP portion and the high range.
* - There is a special small index for 2-byte UTF-8, and the initial data
* entries are designed for fast 1/2-byte UTF-8 lookup.
- * Starting with ICU 60, C0 and C1 are not recognized as UTF-8 lead bytes any more at all,
- * and the associated 2-byte indexes are unused.
+ * Starting with ICU 60, C0 and C1 are not recognized as UTF-8 lead bytes any more at all,
+ * and the associated 2-byte indexes are unused.
*/
/**
@@ -674,10 +674,10 @@ struct UTrie2 {
UBool padding1;
int16_t padding2;
UNewTrie2 *newTrie; /* builder object; NULL when frozen */
-
-#ifdef UTRIE2_DEBUG
- const char *name;
-#endif
+
+#ifdef UTRIE2_DEBUG
+ const char *name;
+#endif
};
/**
@@ -871,7 +871,7 @@ utrie2_internalU8PrevIndex(const UTrie2 *trie, UChar32 c,
(trie)->data[_UTRIE2_INDEX_FROM_CP(trie, asciiOffset, c)]
/** Internal next-post-increment: get the next code point (c) and its data. */
-#define _UTRIE2_U16_NEXT(trie, data, src, limit, c, result) UPRV_BLOCK_MACRO_BEGIN { \
+#define _UTRIE2_U16_NEXT(trie, data, src, limit, c, result) UPRV_BLOCK_MACRO_BEGIN { \
{ \
uint16_t __c2; \
(c)=*(src)++; \
@@ -885,10 +885,10 @@ utrie2_internalU8PrevIndex(const UTrie2 *trie, UChar32 c,
(result)=_UTRIE2_GET_FROM_SUPP((trie), data, (c)); \
} \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** Internal pre-decrement-previous: get the previous code point (c) and its data */
-#define _UTRIE2_U16_PREV(trie, data, start, src, c, result) UPRV_BLOCK_MACRO_BEGIN { \
+#define _UTRIE2_U16_PREV(trie, data, start, src, c, result) UPRV_BLOCK_MACRO_BEGIN { \
{ \
uint16_t __c2; \
(c)=*--(src); \
@@ -900,34 +900,34 @@ utrie2_internalU8PrevIndex(const UTrie2 *trie, UChar32 c,
(result)=_UTRIE2_GET_FROM_SUPP((trie), data, (c)); \
} \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** Internal UTF-8 next-post-increment: get the next code point's data. */
-#define _UTRIE2_U8_NEXT(trie, ascii, data, src, limit, result) UPRV_BLOCK_MACRO_BEGIN { \
+#define _UTRIE2_U8_NEXT(trie, ascii, data, src, limit, result) UPRV_BLOCK_MACRO_BEGIN { \
uint8_t __lead=(uint8_t)*(src)++; \
- if(U8_IS_SINGLE(__lead)) { \
+ if(U8_IS_SINGLE(__lead)) { \
(result)=(trie)->ascii[__lead]; \
} else { \
uint8_t __t1, __t2; \
- if( /* handle U+0800..U+FFFF inline */ \
- 0xe0<=__lead && __lead<0xf0 && ((src)+1)<(limit) && \
- U8_IS_VALID_LEAD3_AND_T1(__lead, __t1=(uint8_t)*(src)) && \
+ if( /* handle U+0800..U+FFFF inline */ \
+ 0xe0<=__lead && __lead<0xf0 && ((src)+1)<(limit) && \
+ U8_IS_VALID_LEAD3_AND_T1(__lead, __t1=(uint8_t)*(src)) && \
(__t2=(uint8_t)(*((src)+1)-0x80))<= 0x3f \
) { \
(src)+=2; \
(result)=(trie)->data[ \
((int32_t)((trie)->index[((__lead-0xe0)<<(12-UTRIE2_SHIFT_2))+ \
- ((__t1&0x3f)<<(6-UTRIE2_SHIFT_2))+(__t2>>UTRIE2_SHIFT_2)]) \
+ ((__t1&0x3f)<<(6-UTRIE2_SHIFT_2))+(__t2>>UTRIE2_SHIFT_2)]) \
<<UTRIE2_INDEX_SHIFT)+ \
(__t2&UTRIE2_DATA_MASK)]; \
- } else if( /* handle U+0080..U+07FF inline */ \
- __lead<0xe0 && __lead>=0xc2 && (src)<(limit) && \
- (__t1=(uint8_t)(*(src)-0x80))<=0x3f \
- ) { \
- ++(src); \
- (result)=(trie)->data[ \
- (trie)->index[(UTRIE2_UTF8_2B_INDEX_2_OFFSET-0xc0)+__lead]+ \
- __t1]; \
+ } else if( /* handle U+0080..U+07FF inline */ \
+ __lead<0xe0 && __lead>=0xc2 && (src)<(limit) && \
+ (__t1=(uint8_t)(*(src)-0x80))<=0x3f \
+ ) { \
+ ++(src); \
+ (result)=(trie)->data[ \
+ (trie)->index[(UTRIE2_UTF8_2B_INDEX_2_OFFSET-0xc0)+__lead]+ \
+ __t1]; \
} else { \
int32_t __index=utrie2_internalU8NextIndex((trie), __lead, (const uint8_t *)(src), \
(const uint8_t *)(limit)); \
@@ -935,12 +935,12 @@ utrie2_internalU8PrevIndex(const UTrie2 *trie, UChar32 c,
(result)=(trie)->data[__index>>3]; \
} \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** Internal UTF-8 pre-decrement-previous: get the previous code point's data. */
-#define _UTRIE2_U8_PREV(trie, ascii, data, start, src, result) UPRV_BLOCK_MACRO_BEGIN { \
+#define _UTRIE2_U8_PREV(trie, ascii, data, start, src, result) UPRV_BLOCK_MACRO_BEGIN { \
uint8_t __b=(uint8_t)*--(src); \
- if(U8_IS_SINGLE(__b)) { \
+ if(U8_IS_SINGLE(__b)) { \
(result)=(trie)->ascii[__b]; \
} else { \
int32_t __index=utrie2_internalU8PrevIndex((trie), __b, (const uint8_t *)(start), \
@@ -948,7 +948,7 @@ utrie2_internalU8PrevIndex(const UTrie2 *trie, UChar32 c,
(src)-=__index&7; \
(result)=(trie)->data[__index>>3]; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
U_CDECL_END
diff --git a/contrib/libs/icu/common/utrie2_builder.cpp b/contrib/libs/icu/common/utrie2_builder.cpp
index fbcd80041f..8de824cc3d 100644
--- a/contrib/libs/icu/common/utrie2_builder.cpp
+++ b/contrib/libs/icu/common/utrie2_builder.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: utrie2_builder.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -24,23 +24,23 @@
* This file contains only the builder code.
* See utrie2.c for the runtime and enumeration code.
*/
-// #define UTRIE2_DEBUG
+// #define UTRIE2_DEBUG
#ifdef UTRIE2_DEBUG
# include <stdio.h>
#endif
-// #define UCPTRIE_DEBUG
+// #define UCPTRIE_DEBUG
#include "unicode/utypes.h"
-#ifdef UCPTRIE_DEBUG
-#include "unicode/ucptrie.h"
-#include "unicode/umutablecptrie.h"
-#include "ucptrie_impl.h"
-#endif
+#ifdef UCPTRIE_DEBUG
+#include "unicode/ucptrie.h"
+#include "unicode/umutablecptrie.h"
+#include "ucptrie_impl.h"
+#endif
#include "cmemory.h"
#include "utrie2.h"
#include "utrie2_impl.h"
-#include "utrie.h" // for utrie2_fromUTrie()
+#include "utrie.h" // for utrie2_fromUTrie()
/* Implementation notes ----------------------------------------------------- */
@@ -139,14 +139,14 @@ utrie2_open(uint32_t initialValue, uint32_t errorValue, UErrorCode *pErrorCode)
trie->errorValue=errorValue;
trie->highStart=0x110000;
trie->newTrie=newTrie;
-#ifdef UTRIE2_DEBUG
- trie->name="open";
-#endif
+#ifdef UTRIE2_DEBUG
+ trie->name="open";
+#endif
newTrie->data=data;
-#ifdef UCPTRIE_DEBUG
- newTrie->t3=umutablecptrie_open(initialValue, errorValue, pErrorCode);
-#endif
+#ifdef UCPTRIE_DEBUG
+ newTrie->t3=umutablecptrie_open(initialValue, errorValue, pErrorCode);
+#endif
newTrie->dataCapacity=UNEWTRIE2_INITIAL_DATA_LENGTH;
newTrie->initialValue=initialValue;
newTrie->errorValue=errorValue;
@@ -259,14 +259,14 @@ cloneBuilder(const UNewTrie2 *other) {
uprv_free(trie);
return NULL;
}
-#ifdef UCPTRIE_DEBUG
- if(other->t3==nullptr) {
- trie->t3=nullptr;
- } else {
- UErrorCode errorCode=U_ZERO_ERROR;
- trie->t3=umutablecptrie_clone(other->t3, &errorCode);
- }
-#endif
+#ifdef UCPTRIE_DEBUG
+ if(other->t3==nullptr) {
+ trie->t3=nullptr;
+ } else {
+ UErrorCode errorCode=U_ZERO_ERROR;
+ trie->t3=umutablecptrie_clone(other->t3, &errorCode);
+ }
+#endif
trie->dataCapacity=other->dataCapacity;
/* clone data */
@@ -309,7 +309,7 @@ utrie2_clone(const UTrie2 *other, UErrorCode *pErrorCode) {
trie=(UTrie2 *)uprv_malloc(sizeof(UTrie2));
if(trie==NULL) {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
return NULL;
}
uprv_memcpy(trie, other, sizeof(UTrie2));
@@ -334,7 +334,7 @@ utrie2_clone(const UTrie2 *other, UErrorCode *pErrorCode) {
}
if(trie->memory==NULL && trie->newTrie==NULL) {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
uprv_free(trie);
trie=NULL;
}
@@ -366,22 +366,22 @@ copyEnumRange(const void *context, UChar32 start, UChar32 end, uint32_t value) {
}
#ifdef UTRIE2_DEBUG
-static long countInitial(const UTrie2 *trie) {
- uint32_t initialValue=trie->initialValue;
- int32_t length=trie->dataLength;
- long count=0;
- if(trie->data16!=nullptr) {
- for(int32_t i=0; i<length; ++i) {
- if(trie->data16[i]==initialValue) { ++count; }
- }
- } else {
- for(int32_t i=0; i<length; ++i) {
- if(trie->data32[i]==initialValue) { ++count; }
- }
- }
- return count;
-}
-
+static long countInitial(const UTrie2 *trie) {
+ uint32_t initialValue=trie->initialValue;
+ int32_t length=trie->dataLength;
+ long count=0;
+ if(trie->data16!=nullptr) {
+ for(int32_t i=0; i<length; ++i) {
+ if(trie->data16[i]==initialValue) { ++count; }
+ }
+ } else {
+ for(int32_t i=0; i<length; ++i) {
+ if(trie->data32[i]==initialValue) { ++count; }
+ }
+ }
+ return count;
+}
+
static void
utrie_printLengths(const UTrie *trie) {
long indexLength=trie->indexLength;
@@ -396,8 +396,8 @@ utrie2_printLengths(const UTrie2 *trie, const char *which) {
long indexLength=trie->indexLength;
long dataLength=(long)trie->dataLength;
long totalLength=(long)sizeof(UTrie2Header)+indexLength*2+dataLength*(trie->data32!=NULL ? 4 : 2);
- printf("**UTrie2Lengths(%s %s)** index:%6ld data:%6ld countInitial:%6ld serialized:%6ld\n",
- which, trie->name, indexLength, dataLength, countInitial(trie), totalLength);
+ printf("**UTrie2Lengths(%s %s)** index:%6ld data:%6ld countInitial:%6ld serialized:%6ld\n",
+ which, trie->name, indexLength, dataLength, countInitial(trie), totalLength);
}
#endif
@@ -661,9 +661,9 @@ set32(UNewTrie2 *trie,
*pErrorCode=U_NO_WRITE_PERMISSION;
return;
}
-#ifdef UCPTRIE_DEBUG
- umutablecptrie_set(trie->t3, c, value, pErrorCode);
-#endif
+#ifdef UCPTRIE_DEBUG
+ umutablecptrie_set(trie->t3, c, value, pErrorCode);
+#endif
block=getDataBlock(trie, c, forLSCP);
if(block<0) {
@@ -759,9 +759,9 @@ utrie2_setRange32(UTrie2 *trie,
*pErrorCode=U_NO_WRITE_PERMISSION;
return;
}
-#ifdef UCPTRIE_DEBUG
- umutablecptrie_setRange(newTrie->t3, start, end, value, pErrorCode);
-#endif
+#ifdef UCPTRIE_DEBUG
+ umutablecptrie_setRange(newTrie->t3, start, end, value, pErrorCode);
+#endif
if(!overwrite && value==newTrie->initialValue) {
return; /* nothing to do */
}
@@ -777,7 +777,7 @@ utrie2_setRange32(UTrie2 *trie,
return;
}
- nextStart=(start+UTRIE2_DATA_MASK)&~UTRIE2_DATA_MASK;
+ nextStart=(start+UTRIE2_DATA_MASK)&~UTRIE2_DATA_MASK;
if(nextStart<=limit) {
fillBlock(newTrie->data+block, start&UTRIE2_DATA_MASK, UTRIE2_DATA_BLOCK_LENGTH,
value, newTrie->initialValue, overwrite);
@@ -1028,10 +1028,10 @@ findHighStart(UNewTrie2 *trie, uint32_t highValue) {
*/
static void
compactData(UNewTrie2 *trie) {
-#ifdef UTRIE2_DEBUG
- int32_t countSame=0, sumOverlaps=0;
-#endif
-
+#ifdef UTRIE2_DEBUG
+ int32_t countSame=0, sumOverlaps=0;
+#endif
+
int32_t start, newStart, movedStart;
int32_t blockLength, overlap;
int32_t i, mapIndex, blockCount;
@@ -1072,9 +1072,9 @@ compactData(UNewTrie2 *trie) {
if( (movedStart=findSameDataBlock(trie->data, newStart, start, blockLength))
>=0
) {
-#ifdef UTRIE2_DEBUG
- ++countSame;
-#endif
+#ifdef UTRIE2_DEBUG
+ ++countSame;
+#endif
/* found an identical block, set the other block's index value for the current block */
for(i=blockCount, mapIndex=start>>UTRIE2_SHIFT_2; i>0; --i) {
trie->map[mapIndex++]=movedStart;
@@ -1094,9 +1094,9 @@ compactData(UNewTrie2 *trie) {
overlap>0 && !equal_uint32(trie->data+(newStart-overlap), trie->data+start, overlap);
overlap-=UTRIE2_DATA_GRANULARITY) {}
-#ifdef UTRIE2_DEBUG
- sumOverlaps+=overlap;
-#endif
+#ifdef UTRIE2_DEBUG
+ sumOverlaps+=overlap;
+#endif
if(overlap>0 || newStart<start) {
/* some overlap, or just move the whole block */
movedStart=newStart-overlap;
@@ -1136,8 +1136,8 @@ compactData(UNewTrie2 *trie) {
#ifdef UTRIE2_DEBUG
/* we saved some space */
- printf("compacting UTrie2: count of 32-bit data words %lu->%lu countSame=%ld sumOverlaps=%ld\n",
- (long)trie->dataLength, (long)newStart, (long)countSame, (long)sumOverlaps);
+ printf("compacting UTrie2: count of 32-bit data words %lu->%lu countSame=%ld sumOverlaps=%ld\n",
+ (long)trie->dataLength, (long)newStart, (long)countSame, (long)sumOverlaps);
#endif
trie->dataLength=newStart;
@@ -1218,7 +1218,7 @@ compactIndex2(UNewTrie2 *trie) {
#ifdef UTRIE2_DEBUG
/* we saved some space */
- printf("compacting UTrie2: count of 16-bit index words %lu->%lu\n",
+ printf("compacting UTrie2: count of 16-bit index words %lu->%lu\n",
(long)trie->index2Length, (long)newStart);
#endif
@@ -1248,7 +1248,7 @@ compactTrie(UTrie2 *trie, UErrorCode *pErrorCode) {
trie->highStart=newTrie->highStart=highStart;
#ifdef UTRIE2_DEBUG
- printf("UTrie2: highStart U+%06lx highValue 0x%lx initialValue 0x%lx\n",
+ printf("UTrie2: highStart U+%06lx highValue 0x%lx initialValue 0x%lx\n",
(long)highStart, (long)highValue, (long)trie->initialValue);
#endif
@@ -1266,7 +1266,7 @@ compactTrie(UTrie2 *trie, UErrorCode *pErrorCode) {
compactIndex2(newTrie);
#ifdef UTRIE2_DEBUG
} else {
- printf("UTrie2: highStart U+%04lx count of 16-bit index words %lu->%lu\n",
+ printf("UTrie2: highStart U+%04lx count of 16-bit index words %lu->%lu\n",
(long)highStart, (long)trie->newTrie->index2Length, (long)UTRIE2_INDEX_1_OFFSET);
#endif
}
@@ -1389,7 +1389,7 @@ utrie2_freeze(UTrie2 *trie, UTrie2ValueBits valueBits, UErrorCode *pErrorCode) {
if(highStart<=0x10000) {
trie->index2NullOffset=0xffff;
} else {
- trie->index2NullOffset=static_cast<uint16_t>(UTRIE2_INDEX_2_OFFSET+newTrie->index2NullOffset);
+ trie->index2NullOffset=static_cast<uint16_t>(UTRIE2_INDEX_2_OFFSET+newTrie->index2NullOffset);
}
trie->dataNullOffset=(uint16_t)(dataMove+newTrie->dataNullOffset);
trie->highValueIndex=dataMove+trie->dataLength-UTRIE2_DATA_GRANULARITY;
@@ -1466,16 +1466,16 @@ utrie2_freeze(UTrie2 *trie, UTrie2ValueBits valueBits, UErrorCode *pErrorCode) {
return;
}
-#ifdef UTRIE2_DEBUG
- utrie2_printLengths(trie, "");
-#endif
-
-#ifdef UCPTRIE_DEBUG
- umutablecptrie_setName(newTrie->t3, trie->name);
- ucptrie_close(
- umutablecptrie_buildImmutable(
- newTrie->t3, UCPTRIE_TYPE_FAST, (UCPTrieValueWidth)valueBits, pErrorCode));
-#endif
+#ifdef UTRIE2_DEBUG
+ utrie2_printLengths(trie, "");
+#endif
+
+#ifdef UCPTRIE_DEBUG
+ umutablecptrie_setName(newTrie->t3, trie->name);
+ ucptrie_close(
+ umutablecptrie_buildImmutable(
+ newTrie->t3, UCPTRIE_TYPE_FAST, (UCPTrieValueWidth)valueBits, pErrorCode));
+#endif
/* Delete the UNewTrie2. */
uprv_free(newTrie->data);
uprv_free(newTrie);
diff --git a/contrib/libs/icu/common/utrie2_impl.h b/contrib/libs/icu/common/utrie2_impl.h
index 9b4d2f92e6..2a14db3a6b 100644
--- a/contrib/libs/icu/common/utrie2_impl.h
+++ b/contrib/libs/icu/common/utrie2_impl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: utrie2_impl.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -22,20 +22,20 @@
#ifndef __UTRIE2_IMPL_H__
#define __UTRIE2_IMPL_H__
-#ifdef UCPTRIE_DEBUG
-#include "unicode/umutablecptrie.h"
-#endif
+#ifdef UCPTRIE_DEBUG
+#include "unicode/umutablecptrie.h"
+#endif
#include "utrie2.h"
/* Public UTrie2 API implementation ----------------------------------------- */
/*
- * These definitions are mostly needed by utrie2.cpp,
+ * These definitions are mostly needed by utrie2.cpp,
* but also by utrie2_serialize() and utrie2_swap().
*/
-// UTrie2 signature values, in platform endianness and opposite endianness.
-// The UTrie2 signature ASCII byte values spell "Tri2".
+// UTrie2 signature values, in platform endianness and opposite endianness.
+// The UTrie2 signature ASCII byte values spell "Tri2".
#define UTRIE2_SIG 0x54726932
#define UTRIE2_OE_SIG 0x32697254
@@ -143,9 +143,9 @@ struct UNewTrie2 {
int32_t index1[UNEWTRIE2_INDEX_1_LENGTH];
int32_t index2[UNEWTRIE2_MAX_INDEX_2_LENGTH];
uint32_t *data;
-#ifdef UCPTRIE_DEBUG
- UMutableCPTrie *t3;
-#endif
+#ifdef UCPTRIE_DEBUG
+ UMutableCPTrie *t3;
+#endif
uint32_t initialValue, errorValue;
int32_t index2Length, dataCapacity, dataLength;
diff --git a/contrib/libs/icu/common/utrie_swap.cpp b/contrib/libs/icu/common/utrie_swap.cpp
index 0fb67d6333..5abe7bd5d7 100644
--- a/contrib/libs/icu/common/utrie_swap.cpp
+++ b/contrib/libs/icu/common/utrie_swap.cpp
@@ -1,344 +1,344 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// utrie_swap.cpp
-// created: 2018aug08 Markus W. Scherer
-
-#include "unicode/utypes.h"
-#include "cmemory.h"
-#include "ucptrie_impl.h"
-#include "udataswp.h"
-#include "utrie.h"
-#include "utrie2_impl.h"
-
-// These functions for swapping different generations of ICU code point tries are here
-// so that their implementation files need not depend on swapper code,
-// need not depend on each other, and so that other swapper code
-// need not depend on other trie code.
-
-namespace {
-
-constexpr int32_t ASCII_LIMIT = 0x80;
-
-} // namespace
-
-U_CAPI int32_t U_EXPORT2
-utrie_swap(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode) {
- const UTrieHeader *inTrie;
- UTrieHeader trie;
- int32_t size;
- UBool dataIs32;
-
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return 0;
- }
- if(ds==NULL || inData==NULL || (length>=0 && outData==NULL)) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* setup and swapping */
- if(length>=0 && (uint32_t)length<sizeof(UTrieHeader)) {
- *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
- }
-
- inTrie=(const UTrieHeader *)inData;
- trie.signature=ds->readUInt32(inTrie->signature);
- trie.options=ds->readUInt32(inTrie->options);
- trie.indexLength=udata_readInt32(ds, inTrie->indexLength);
- trie.dataLength=udata_readInt32(ds, inTrie->dataLength);
-
- if( trie.signature!=0x54726965 ||
- (trie.options&UTRIE_OPTIONS_SHIFT_MASK)!=UTRIE_SHIFT ||
- ((trie.options>>UTRIE_OPTIONS_INDEX_SHIFT)&UTRIE_OPTIONS_SHIFT_MASK)!=UTRIE_INDEX_SHIFT ||
- trie.indexLength<UTRIE_BMP_INDEX_LENGTH ||
- (trie.indexLength&(UTRIE_SURROGATE_BLOCK_COUNT-1))!=0 ||
- trie.dataLength<UTRIE_DATA_BLOCK_LENGTH ||
- (trie.dataLength&(UTRIE_DATA_GRANULARITY-1))!=0 ||
- ((trie.options&UTRIE_OPTIONS_LATIN1_IS_LINEAR)!=0 && trie.dataLength<(UTRIE_DATA_BLOCK_LENGTH+0x100))
- ) {
- *pErrorCode=U_INVALID_FORMAT_ERROR; /* not a UTrie */
- return 0;
- }
-
- dataIs32=(UBool)((trie.options&UTRIE_OPTIONS_DATA_IS_32_BIT)!=0);
- size=sizeof(UTrieHeader)+trie.indexLength*2+trie.dataLength*(dataIs32?4:2);
-
- if(length>=0) {
- UTrieHeader *outTrie;
-
- if(length<size) {
- *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
- }
-
- outTrie=(UTrieHeader *)outData;
-
- /* swap the header */
- ds->swapArray32(ds, inTrie, sizeof(UTrieHeader), outTrie, pErrorCode);
-
- /* swap the index and the data */
- if(dataIs32) {
- ds->swapArray16(ds, inTrie+1, trie.indexLength*2, outTrie+1, pErrorCode);
- ds->swapArray32(ds, (const uint16_t *)(inTrie+1)+trie.indexLength, trie.dataLength*4,
- (uint16_t *)(outTrie+1)+trie.indexLength, pErrorCode);
- } else {
- ds->swapArray16(ds, inTrie+1, (trie.indexLength+trie.dataLength)*2, outTrie+1, pErrorCode);
- }
- }
-
- return size;
-}
-
-U_CAPI int32_t U_EXPORT2
-utrie2_swap(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode) {
- const UTrie2Header *inTrie;
- UTrie2Header trie;
- int32_t dataLength, size;
- UTrie2ValueBits valueBits;
-
- if(U_FAILURE(*pErrorCode)) {
- return 0;
- }
- if(ds==NULL || inData==NULL || (length>=0 && outData==NULL)) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* setup and swapping */
- if(length>=0 && length<(int32_t)sizeof(UTrie2Header)) {
- *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
- }
-
- inTrie=(const UTrie2Header *)inData;
- trie.signature=ds->readUInt32(inTrie->signature);
- trie.options=ds->readUInt16(inTrie->options);
- trie.indexLength=ds->readUInt16(inTrie->indexLength);
- trie.shiftedDataLength=ds->readUInt16(inTrie->shiftedDataLength);
-
- valueBits=(UTrie2ValueBits)(trie.options&UTRIE2_OPTIONS_VALUE_BITS_MASK);
- dataLength=(int32_t)trie.shiftedDataLength<<UTRIE2_INDEX_SHIFT;
-
- if( trie.signature!=UTRIE2_SIG ||
- valueBits<0 || UTRIE2_COUNT_VALUE_BITS<=valueBits ||
- trie.indexLength<UTRIE2_INDEX_1_OFFSET ||
- dataLength<UTRIE2_DATA_START_OFFSET
- ) {
- *pErrorCode=U_INVALID_FORMAT_ERROR; /* not a UTrie */
- return 0;
- }
-
- size=sizeof(UTrie2Header)+trie.indexLength*2;
- switch(valueBits) {
- case UTRIE2_16_VALUE_BITS:
- size+=dataLength*2;
- break;
- case UTRIE2_32_VALUE_BITS:
- size+=dataLength*4;
- break;
- default:
- *pErrorCode=U_INVALID_FORMAT_ERROR;
- return 0;
- }
-
- if(length>=0) {
- UTrie2Header *outTrie;
-
- if(length<size) {
- *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
- }
-
- outTrie=(UTrie2Header *)outData;
-
- /* swap the header */
- ds->swapArray32(ds, &inTrie->signature, 4, &outTrie->signature, pErrorCode);
- ds->swapArray16(ds, &inTrie->options, 12, &outTrie->options, pErrorCode);
-
- /* swap the index and the data */
- switch(valueBits) {
- case UTRIE2_16_VALUE_BITS:
- ds->swapArray16(ds, inTrie+1, (trie.indexLength+dataLength)*2, outTrie+1, pErrorCode);
- break;
- case UTRIE2_32_VALUE_BITS:
- ds->swapArray16(ds, inTrie+1, trie.indexLength*2, outTrie+1, pErrorCode);
- ds->swapArray32(ds, (const uint16_t *)(inTrie+1)+trie.indexLength, dataLength*4,
- (uint16_t *)(outTrie+1)+trie.indexLength, pErrorCode);
- break;
- default:
- *pErrorCode=U_INVALID_FORMAT_ERROR;
- return 0;
- }
- }
-
- return size;
-}
-
-U_CAPI int32_t U_EXPORT2
-ucptrie_swap(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode) {
- const UCPTrieHeader *inTrie;
- UCPTrieHeader trie;
- int32_t dataLength, size;
- UCPTrieValueWidth valueWidth;
-
- if(U_FAILURE(*pErrorCode)) {
- return 0;
- }
- if(ds==nullptr || inData==nullptr || (length>=0 && outData==nullptr)) {
- *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- /* setup and swapping */
- if(length>=0 && length<(int32_t)sizeof(UCPTrieHeader)) {
- *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
- }
-
- inTrie=(const UCPTrieHeader *)inData;
- trie.signature=ds->readUInt32(inTrie->signature);
- trie.options=ds->readUInt16(inTrie->options);
- trie.indexLength=ds->readUInt16(inTrie->indexLength);
- trie.dataLength = ds->readUInt16(inTrie->dataLength);
-
- UCPTrieType type = (UCPTrieType)((trie.options >> 6) & 3);
- valueWidth = (UCPTrieValueWidth)(trie.options & UCPTRIE_OPTIONS_VALUE_BITS_MASK);
- dataLength = ((int32_t)(trie.options & UCPTRIE_OPTIONS_DATA_LENGTH_MASK) << 4) | trie.dataLength;
-
- int32_t minIndexLength = type == UCPTRIE_TYPE_FAST ?
- UCPTRIE_BMP_INDEX_LENGTH : UCPTRIE_SMALL_INDEX_LENGTH;
- if( trie.signature!=UCPTRIE_SIG ||
- type > UCPTRIE_TYPE_SMALL ||
- (trie.options & UCPTRIE_OPTIONS_RESERVED_MASK) != 0 ||
- valueWidth > UCPTRIE_VALUE_BITS_8 ||
- trie.indexLength < minIndexLength ||
- dataLength < ASCII_LIMIT
- ) {
- *pErrorCode=U_INVALID_FORMAT_ERROR; /* not a UCPTrie */
- return 0;
- }
-
- size=sizeof(UCPTrieHeader)+trie.indexLength*2;
- switch(valueWidth) {
- case UCPTRIE_VALUE_BITS_16:
- size+=dataLength*2;
- break;
- case UCPTRIE_VALUE_BITS_32:
- size+=dataLength*4;
- break;
- case UCPTRIE_VALUE_BITS_8:
- size+=dataLength;
- break;
- default:
- *pErrorCode=U_INVALID_FORMAT_ERROR;
- return 0;
- }
-
- if(length>=0) {
- UCPTrieHeader *outTrie;
-
- if(length<size) {
- *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
- return 0;
- }
-
- outTrie=(UCPTrieHeader *)outData;
-
- /* swap the header */
- ds->swapArray32(ds, &inTrie->signature, 4, &outTrie->signature, pErrorCode);
- ds->swapArray16(ds, &inTrie->options, 12, &outTrie->options, pErrorCode);
-
- /* swap the index and the data */
- switch(valueWidth) {
- case UCPTRIE_VALUE_BITS_16:
- ds->swapArray16(ds, inTrie+1, (trie.indexLength+dataLength)*2, outTrie+1, pErrorCode);
- break;
- case UCPTRIE_VALUE_BITS_32:
- ds->swapArray16(ds, inTrie+1, trie.indexLength*2, outTrie+1, pErrorCode);
- ds->swapArray32(ds, (const uint16_t *)(inTrie+1)+trie.indexLength, dataLength*4,
- (uint16_t *)(outTrie+1)+trie.indexLength, pErrorCode);
- break;
- case UCPTRIE_VALUE_BITS_8:
- ds->swapArray16(ds, inTrie+1, trie.indexLength*2, outTrie+1, pErrorCode);
- if(inTrie!=outTrie) {
- uprv_memmove((outTrie+1)+trie.indexLength, (inTrie+1)+trie.indexLength, dataLength);
- }
- break;
- default:
- *pErrorCode=U_INVALID_FORMAT_ERROR;
- return 0;
- }
- }
-
- return size;
-}
-
-namespace {
-
-/**
- * Gets the trie version from 32-bit-aligned memory containing the serialized form
- * of a UTrie (version 1), a UTrie2 (version 2), or a UCPTrie (version 3).
- *
- * @param data a pointer to 32-bit-aligned memory containing the serialized form of a trie
- * @param length the number of bytes available at data;
- * can be more than necessary (see return value)
- * @param anyEndianOk If FALSE, only platform-endian serialized forms are recognized.
- * If TRUE, opposite-endian serialized forms are recognized as well.
- * @return the trie version of the serialized form, or 0 if it is not
- * recognized as a serialized trie
- */
-int32_t
-getVersion(const void *data, int32_t length, UBool anyEndianOk) {
- uint32_t signature;
- if(length<16 || data==nullptr || (U_POINTER_MASK_LSB(data, 3)!=0)) {
- return 0;
- }
- signature=*(const uint32_t *)data;
- if(signature==UCPTRIE_SIG) {
- return 3;
- }
- if(anyEndianOk && signature==UCPTRIE_OE_SIG) {
- return 3;
- }
- if(signature==UTRIE2_SIG) {
- return 2;
- }
- if(anyEndianOk && signature==UTRIE2_OE_SIG) {
- return 2;
- }
- if(signature==UTRIE_SIG) {
- return 1;
- }
- if(anyEndianOk && signature==UTRIE_OE_SIG) {
- return 1;
- }
- return 0;
-}
-
-} // namespace
-
-U_CAPI int32_t U_EXPORT2
-utrie_swapAnyVersion(const UDataSwapper *ds,
- const void *inData, int32_t length, void *outData,
- UErrorCode *pErrorCode) {
- if(U_FAILURE(*pErrorCode)) { return 0; }
- switch(getVersion(inData, length, TRUE)) {
- case 1:
- return utrie_swap(ds, inData, length, outData, pErrorCode);
- case 2:
- return utrie2_swap(ds, inData, length, outData, pErrorCode);
- case 3:
- return ucptrie_swap(ds, inData, length, outData, pErrorCode);
- default:
- *pErrorCode=U_INVALID_FORMAT_ERROR;
- return 0;
- }
-}
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// utrie_swap.cpp
+// created: 2018aug08 Markus W. Scherer
+
+#include "unicode/utypes.h"
+#include "cmemory.h"
+#include "ucptrie_impl.h"
+#include "udataswp.h"
+#include "utrie.h"
+#include "utrie2_impl.h"
+
+// These functions for swapping different generations of ICU code point tries are here
+// so that their implementation files need not depend on swapper code,
+// need not depend on each other, and so that other swapper code
+// need not depend on other trie code.
+
+namespace {
+
+constexpr int32_t ASCII_LIMIT = 0x80;
+
+} // namespace
+
+U_CAPI int32_t U_EXPORT2
+utrie_swap(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode) {
+ const UTrieHeader *inTrie;
+ UTrieHeader trie;
+ int32_t size;
+ UBool dataIs32;
+
+ if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ if(ds==NULL || inData==NULL || (length>=0 && outData==NULL)) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* setup and swapping */
+ if(length>=0 && (uint32_t)length<sizeof(UTrieHeader)) {
+ *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
+ }
+
+ inTrie=(const UTrieHeader *)inData;
+ trie.signature=ds->readUInt32(inTrie->signature);
+ trie.options=ds->readUInt32(inTrie->options);
+ trie.indexLength=udata_readInt32(ds, inTrie->indexLength);
+ trie.dataLength=udata_readInt32(ds, inTrie->dataLength);
+
+ if( trie.signature!=0x54726965 ||
+ (trie.options&UTRIE_OPTIONS_SHIFT_MASK)!=UTRIE_SHIFT ||
+ ((trie.options>>UTRIE_OPTIONS_INDEX_SHIFT)&UTRIE_OPTIONS_SHIFT_MASK)!=UTRIE_INDEX_SHIFT ||
+ trie.indexLength<UTRIE_BMP_INDEX_LENGTH ||
+ (trie.indexLength&(UTRIE_SURROGATE_BLOCK_COUNT-1))!=0 ||
+ trie.dataLength<UTRIE_DATA_BLOCK_LENGTH ||
+ (trie.dataLength&(UTRIE_DATA_GRANULARITY-1))!=0 ||
+ ((trie.options&UTRIE_OPTIONS_LATIN1_IS_LINEAR)!=0 && trie.dataLength<(UTRIE_DATA_BLOCK_LENGTH+0x100))
+ ) {
+ *pErrorCode=U_INVALID_FORMAT_ERROR; /* not a UTrie */
+ return 0;
+ }
+
+ dataIs32=(UBool)((trie.options&UTRIE_OPTIONS_DATA_IS_32_BIT)!=0);
+ size=sizeof(UTrieHeader)+trie.indexLength*2+trie.dataLength*(dataIs32?4:2);
+
+ if(length>=0) {
+ UTrieHeader *outTrie;
+
+ if(length<size) {
+ *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
+ }
+
+ outTrie=(UTrieHeader *)outData;
+
+ /* swap the header */
+ ds->swapArray32(ds, inTrie, sizeof(UTrieHeader), outTrie, pErrorCode);
+
+ /* swap the index and the data */
+ if(dataIs32) {
+ ds->swapArray16(ds, inTrie+1, trie.indexLength*2, outTrie+1, pErrorCode);
+ ds->swapArray32(ds, (const uint16_t *)(inTrie+1)+trie.indexLength, trie.dataLength*4,
+ (uint16_t *)(outTrie+1)+trie.indexLength, pErrorCode);
+ } else {
+ ds->swapArray16(ds, inTrie+1, (trie.indexLength+trie.dataLength)*2, outTrie+1, pErrorCode);
+ }
+ }
+
+ return size;
+}
+
+U_CAPI int32_t U_EXPORT2
+utrie2_swap(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode) {
+ const UTrie2Header *inTrie;
+ UTrie2Header trie;
+ int32_t dataLength, size;
+ UTrie2ValueBits valueBits;
+
+ if(U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ if(ds==NULL || inData==NULL || (length>=0 && outData==NULL)) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* setup and swapping */
+ if(length>=0 && length<(int32_t)sizeof(UTrie2Header)) {
+ *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
+ }
+
+ inTrie=(const UTrie2Header *)inData;
+ trie.signature=ds->readUInt32(inTrie->signature);
+ trie.options=ds->readUInt16(inTrie->options);
+ trie.indexLength=ds->readUInt16(inTrie->indexLength);
+ trie.shiftedDataLength=ds->readUInt16(inTrie->shiftedDataLength);
+
+ valueBits=(UTrie2ValueBits)(trie.options&UTRIE2_OPTIONS_VALUE_BITS_MASK);
+ dataLength=(int32_t)trie.shiftedDataLength<<UTRIE2_INDEX_SHIFT;
+
+ if( trie.signature!=UTRIE2_SIG ||
+ valueBits<0 || UTRIE2_COUNT_VALUE_BITS<=valueBits ||
+ trie.indexLength<UTRIE2_INDEX_1_OFFSET ||
+ dataLength<UTRIE2_DATA_START_OFFSET
+ ) {
+ *pErrorCode=U_INVALID_FORMAT_ERROR; /* not a UTrie */
+ return 0;
+ }
+
+ size=sizeof(UTrie2Header)+trie.indexLength*2;
+ switch(valueBits) {
+ case UTRIE2_16_VALUE_BITS:
+ size+=dataLength*2;
+ break;
+ case UTRIE2_32_VALUE_BITS:
+ size+=dataLength*4;
+ break;
+ default:
+ *pErrorCode=U_INVALID_FORMAT_ERROR;
+ return 0;
+ }
+
+ if(length>=0) {
+ UTrie2Header *outTrie;
+
+ if(length<size) {
+ *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
+ }
+
+ outTrie=(UTrie2Header *)outData;
+
+ /* swap the header */
+ ds->swapArray32(ds, &inTrie->signature, 4, &outTrie->signature, pErrorCode);
+ ds->swapArray16(ds, &inTrie->options, 12, &outTrie->options, pErrorCode);
+
+ /* swap the index and the data */
+ switch(valueBits) {
+ case UTRIE2_16_VALUE_BITS:
+ ds->swapArray16(ds, inTrie+1, (trie.indexLength+dataLength)*2, outTrie+1, pErrorCode);
+ break;
+ case UTRIE2_32_VALUE_BITS:
+ ds->swapArray16(ds, inTrie+1, trie.indexLength*2, outTrie+1, pErrorCode);
+ ds->swapArray32(ds, (const uint16_t *)(inTrie+1)+trie.indexLength, dataLength*4,
+ (uint16_t *)(outTrie+1)+trie.indexLength, pErrorCode);
+ break;
+ default:
+ *pErrorCode=U_INVALID_FORMAT_ERROR;
+ return 0;
+ }
+ }
+
+ return size;
+}
+
+U_CAPI int32_t U_EXPORT2
+ucptrie_swap(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode) {
+ const UCPTrieHeader *inTrie;
+ UCPTrieHeader trie;
+ int32_t dataLength, size;
+ UCPTrieValueWidth valueWidth;
+
+ if(U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+ if(ds==nullptr || inData==nullptr || (length>=0 && outData==nullptr)) {
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ /* setup and swapping */
+ if(length>=0 && length<(int32_t)sizeof(UCPTrieHeader)) {
+ *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
+ }
+
+ inTrie=(const UCPTrieHeader *)inData;
+ trie.signature=ds->readUInt32(inTrie->signature);
+ trie.options=ds->readUInt16(inTrie->options);
+ trie.indexLength=ds->readUInt16(inTrie->indexLength);
+ trie.dataLength = ds->readUInt16(inTrie->dataLength);
+
+ UCPTrieType type = (UCPTrieType)((trie.options >> 6) & 3);
+ valueWidth = (UCPTrieValueWidth)(trie.options & UCPTRIE_OPTIONS_VALUE_BITS_MASK);
+ dataLength = ((int32_t)(trie.options & UCPTRIE_OPTIONS_DATA_LENGTH_MASK) << 4) | trie.dataLength;
+
+ int32_t minIndexLength = type == UCPTRIE_TYPE_FAST ?
+ UCPTRIE_BMP_INDEX_LENGTH : UCPTRIE_SMALL_INDEX_LENGTH;
+ if( trie.signature!=UCPTRIE_SIG ||
+ type > UCPTRIE_TYPE_SMALL ||
+ (trie.options & UCPTRIE_OPTIONS_RESERVED_MASK) != 0 ||
+ valueWidth > UCPTRIE_VALUE_BITS_8 ||
+ trie.indexLength < minIndexLength ||
+ dataLength < ASCII_LIMIT
+ ) {
+ *pErrorCode=U_INVALID_FORMAT_ERROR; /* not a UCPTrie */
+ return 0;
+ }
+
+ size=sizeof(UCPTrieHeader)+trie.indexLength*2;
+ switch(valueWidth) {
+ case UCPTRIE_VALUE_BITS_16:
+ size+=dataLength*2;
+ break;
+ case UCPTRIE_VALUE_BITS_32:
+ size+=dataLength*4;
+ break;
+ case UCPTRIE_VALUE_BITS_8:
+ size+=dataLength;
+ break;
+ default:
+ *pErrorCode=U_INVALID_FORMAT_ERROR;
+ return 0;
+ }
+
+ if(length>=0) {
+ UCPTrieHeader *outTrie;
+
+ if(length<size) {
+ *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
+ return 0;
+ }
+
+ outTrie=(UCPTrieHeader *)outData;
+
+ /* swap the header */
+ ds->swapArray32(ds, &inTrie->signature, 4, &outTrie->signature, pErrorCode);
+ ds->swapArray16(ds, &inTrie->options, 12, &outTrie->options, pErrorCode);
+
+ /* swap the index and the data */
+ switch(valueWidth) {
+ case UCPTRIE_VALUE_BITS_16:
+ ds->swapArray16(ds, inTrie+1, (trie.indexLength+dataLength)*2, outTrie+1, pErrorCode);
+ break;
+ case UCPTRIE_VALUE_BITS_32:
+ ds->swapArray16(ds, inTrie+1, trie.indexLength*2, outTrie+1, pErrorCode);
+ ds->swapArray32(ds, (const uint16_t *)(inTrie+1)+trie.indexLength, dataLength*4,
+ (uint16_t *)(outTrie+1)+trie.indexLength, pErrorCode);
+ break;
+ case UCPTRIE_VALUE_BITS_8:
+ ds->swapArray16(ds, inTrie+1, trie.indexLength*2, outTrie+1, pErrorCode);
+ if(inTrie!=outTrie) {
+ uprv_memmove((outTrie+1)+trie.indexLength, (inTrie+1)+trie.indexLength, dataLength);
+ }
+ break;
+ default:
+ *pErrorCode=U_INVALID_FORMAT_ERROR;
+ return 0;
+ }
+ }
+
+ return size;
+}
+
+namespace {
+
+/**
+ * Gets the trie version from 32-bit-aligned memory containing the serialized form
+ * of a UTrie (version 1), a UTrie2 (version 2), or a UCPTrie (version 3).
+ *
+ * @param data a pointer to 32-bit-aligned memory containing the serialized form of a trie
+ * @param length the number of bytes available at data;
+ * can be more than necessary (see return value)
+ * @param anyEndianOk If FALSE, only platform-endian serialized forms are recognized.
+ * If TRUE, opposite-endian serialized forms are recognized as well.
+ * @return the trie version of the serialized form, or 0 if it is not
+ * recognized as a serialized trie
+ */
+int32_t
+getVersion(const void *data, int32_t length, UBool anyEndianOk) {
+ uint32_t signature;
+ if(length<16 || data==nullptr || (U_POINTER_MASK_LSB(data, 3)!=0)) {
+ return 0;
+ }
+ signature=*(const uint32_t *)data;
+ if(signature==UCPTRIE_SIG) {
+ return 3;
+ }
+ if(anyEndianOk && signature==UCPTRIE_OE_SIG) {
+ return 3;
+ }
+ if(signature==UTRIE2_SIG) {
+ return 2;
+ }
+ if(anyEndianOk && signature==UTRIE2_OE_SIG) {
+ return 2;
+ }
+ if(signature==UTRIE_SIG) {
+ return 1;
+ }
+ if(anyEndianOk && signature==UTRIE_OE_SIG) {
+ return 1;
+ }
+ return 0;
+}
+
+} // namespace
+
+U_CAPI int32_t U_EXPORT2
+utrie_swapAnyVersion(const UDataSwapper *ds,
+ const void *inData, int32_t length, void *outData,
+ UErrorCode *pErrorCode) {
+ if(U_FAILURE(*pErrorCode)) { return 0; }
+ switch(getVersion(inData, length, TRUE)) {
+ case 1:
+ return utrie_swap(ds, inData, length, outData, pErrorCode);
+ case 2:
+ return utrie2_swap(ds, inData, length, outData, pErrorCode);
+ case 3:
+ return ucptrie_swap(ds, inData, length, outData, pErrorCode);
+ default:
+ *pErrorCode=U_INVALID_FORMAT_ERROR;
+ return 0;
+ }
+}
diff --git a/contrib/libs/icu/common/uts46.cpp b/contrib/libs/icu/common/uts46.cpp
index d6f06f6509..b9e6cb023b 100644
--- a/contrib/libs/icu/common/uts46.cpp
+++ b/contrib/libs/icu/common/uts46.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: uts46.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -557,10 +557,10 @@ UTS46::processUnicode(const UnicodeString &src,
destArray=dest.getBuffer();
destLength+=newLength-labelLength;
labelLimit=labelStart+=newLength+1;
- continue;
- } else if(c<0xdf) {
- // pass
- } else if(c<=0x200d && (c==0xdf || c==0x3c2 || c>=0x200c)) {
+ continue;
+ } else if(c<0xdf) {
+ // pass
+ } else if(c<=0x200d && (c==0xdf || c==0x3c2 || c>=0x200c)) {
info.isTransDiff=TRUE;
if(doMapDevChars) {
destLength=mapDevChars(dest, labelStart, labelLimit, errorCode);
@@ -570,21 +570,21 @@ UTS46::processUnicode(const UnicodeString &src,
destArray=dest.getBuffer();
// All deviation characters have been mapped, no need to check for them again.
doMapDevChars=FALSE;
- // Do not increment labelLimit in case c was removed.
- continue;
+ // Do not increment labelLimit in case c was removed.
+ continue;
+ }
+ } else if(U16_IS_SURROGATE(c)) {
+ if(U16_IS_SURROGATE_LEAD(c) ?
+ (labelLimit+1)==destLength || !U16_IS_TRAIL(destArray[labelLimit+1]) :
+ labelLimit==labelStart || !U16_IS_LEAD(destArray[labelLimit-1])) {
+ // Map an unpaired surrogate to U+FFFD before normalization so that when
+ // that removes characters we do not turn two unpaired ones into a pair.
+ info.labelErrors|=UIDNA_ERROR_DISALLOWED;
+ dest.setCharAt(labelLimit, 0xfffd);
+ destArray=dest.getBuffer();
}
- } else if(U16_IS_SURROGATE(c)) {
- if(U16_IS_SURROGATE_LEAD(c) ?
- (labelLimit+1)==destLength || !U16_IS_TRAIL(destArray[labelLimit+1]) :
- labelLimit==labelStart || !U16_IS_LEAD(destArray[labelLimit-1])) {
- // Map an unpaired surrogate to U+FFFD before normalization so that when
- // that removes characters we do not turn two unpaired ones into a pair.
- info.labelErrors|=UIDNA_ERROR_DISALLOWED;
- dest.setCharAt(labelLimit, 0xfffd);
- destArray=dest.getBuffer();
- }
}
- ++labelLimit;
+ ++labelLimit;
}
// Permit an empty label at the end (0<labelStart==labelLimit==destLength is ok)
// but not an empty label elsewhere nor a completely empty domain name.
@@ -1026,8 +1026,8 @@ UTS46::checkLabelBiDi(const UChar *label, int32_t labelLength, IDNAInfo &info) c
) {
info.isOkBiDi=FALSE;
}
- // Add the directionalities of the intervening characters.
- uint32_t mask=firstMask|lastMask;
+ // Add the directionalities of the intervening characters.
+ uint32_t mask=firstMask|lastMask;
while(i<labelLength) {
U16_NEXT_UNSAFE(label, i, c);
mask|=U_MASK(u_charDirection(c));
@@ -1056,7 +1056,7 @@ UTS46::checkLabelBiDi(const UChar *label, int32_t labelLength, IDNAInfo &info) c
// label. [...]
// The following rule, consisting of six conditions, applies to labels
// in BIDI domain names.
- if((mask&R_AL_AN_MASK)!=0) {
+ if((mask&R_AL_AN_MASK)!=0) {
info.isBiDi=TRUE;
}
}
@@ -1158,7 +1158,7 @@ UTS46::isLabelOkContextJ(const UChar *label, int32_t labelLength) const {
}
// check precontext (Joining_Type:{L,D})(Joining_Type:T)*
for(;;) {
- UJoiningType type=ubidi_getJoiningType(c);
+ UJoiningType type=ubidi_getJoiningType(c);
if(type==U_JT_TRANSPARENT) {
if(j==0) {
return FALSE;
@@ -1176,7 +1176,7 @@ UTS46::isLabelOkContextJ(const UChar *label, int32_t labelLength) const {
return FALSE;
}
U16_NEXT_UNSAFE(label, j, c);
- UJoiningType type=ubidi_getJoiningType(c);
+ UJoiningType type=ubidi_getJoiningType(c);
if(type==U_JT_TRANSPARENT) {
// just skip this character
} else if(type==U_JT_RIGHT_JOINING || type==U_JT_DUAL_JOINING) {
@@ -1425,7 +1425,7 @@ uidna_labelToASCII_UTF8(const UIDNA *idna,
if(!checkArgs(label, length, dest, capacity, pInfo, pErrorCode)) {
return 0;
}
- StringPiece src(label, length<0 ? static_cast<int32_t>(uprv_strlen(label)) : length);
+ StringPiece src(label, length<0 ? static_cast<int32_t>(uprv_strlen(label)) : length);
CheckedArrayByteSink sink(dest, capacity);
IDNAInfo info;
reinterpret_cast<const IDNA *>(idna)->labelToASCII_UTF8(src, sink, info, *pErrorCode);
@@ -1441,7 +1441,7 @@ uidna_labelToUnicodeUTF8(const UIDNA *idna,
if(!checkArgs(label, length, dest, capacity, pInfo, pErrorCode)) {
return 0;
}
- StringPiece src(label, length<0 ? static_cast<int32_t>(uprv_strlen(label)) : length);
+ StringPiece src(label, length<0 ? static_cast<int32_t>(uprv_strlen(label)) : length);
CheckedArrayByteSink sink(dest, capacity);
IDNAInfo info;
reinterpret_cast<const IDNA *>(idna)->labelToUnicodeUTF8(src, sink, info, *pErrorCode);
@@ -1457,7 +1457,7 @@ uidna_nameToASCII_UTF8(const UIDNA *idna,
if(!checkArgs(name, length, dest, capacity, pInfo, pErrorCode)) {
return 0;
}
- StringPiece src(name, length<0 ? static_cast<int32_t>(uprv_strlen(name)) : length);
+ StringPiece src(name, length<0 ? static_cast<int32_t>(uprv_strlen(name)) : length);
CheckedArrayByteSink sink(dest, capacity);
IDNAInfo info;
reinterpret_cast<const IDNA *>(idna)->nameToASCII_UTF8(src, sink, info, *pErrorCode);
@@ -1473,7 +1473,7 @@ uidna_nameToUnicodeUTF8(const UIDNA *idna,
if(!checkArgs(name, length, dest, capacity, pInfo, pErrorCode)) {
return 0;
}
- StringPiece src(name, length<0 ? static_cast<int32_t>(uprv_strlen(name)) : length);
+ StringPiece src(name, length<0 ? static_cast<int32_t>(uprv_strlen(name)) : length);
CheckedArrayByteSink sink(dest, capacity);
IDNAInfo info;
reinterpret_cast<const IDNA *>(idna)->nameToUnicodeUTF8(src, sink, info, *pErrorCode);
diff --git a/contrib/libs/icu/common/utypeinfo.h b/contrib/libs/icu/common/utypeinfo.h
index 1c73f8a685..c6663734fc 100644
--- a/contrib/libs/icu/common/utypeinfo.h
+++ b/contrib/libs/icu/common/utypeinfo.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -24,7 +24,7 @@
#include <exception>
using std::exception;
#endif
-#if defined(__GLIBCXX__)
+#if defined(__GLIBCXX__)
namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364
#endif
#include <typeinfo> // for 'typeid' to work
diff --git a/contrib/libs/icu/common/utypes.cpp b/contrib/libs/icu/common/utypes.cpp
index 481e3de9d2..7531e46568 100644
--- a/contrib/libs/icu/common/utypes.cpp
+++ b/contrib/libs/icu/common/utypes.cpp
@@ -1,226 +1,226 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 1997-2015, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-*
-* FILE NAME : utypes.c (previously putil.c)
-*
-* Date Name Description
-* 10/07/2004 grhoten split from putil.c
-******************************************************************************
-*/
-
-#include "unicode/utypes.h"
-
-/* u_errorName() ------------------------------------------------------------ */
-
-static const char * const
-_uErrorInfoName[U_ERROR_WARNING_LIMIT-U_ERROR_WARNING_START]={
- "U_USING_FALLBACK_WARNING",
- "U_USING_DEFAULT_WARNING",
- "U_SAFECLONE_ALLOCATED_WARNING",
- "U_STATE_OLD_WARNING",
- "U_STRING_NOT_TERMINATED_WARNING",
- "U_SORT_KEY_TOO_SHORT_WARNING",
- "U_AMBIGUOUS_ALIAS_WARNING",
- "U_DIFFERENT_UCA_VERSION",
- "U_PLUGIN_CHANGED_LEVEL_WARNING",
-};
-
-static const char * const
-_uTransErrorName[U_PARSE_ERROR_LIMIT - U_PARSE_ERROR_START]={
- "U_BAD_VARIABLE_DEFINITION",
- "U_MALFORMED_RULE",
- "U_MALFORMED_SET",
- "U_MALFORMED_SYMBOL_REFERENCE",
- "U_MALFORMED_UNICODE_ESCAPE",
- "U_MALFORMED_VARIABLE_DEFINITION",
- "U_MALFORMED_VARIABLE_REFERENCE",
- "U_MISMATCHED_SEGMENT_DELIMITERS",
- "U_MISPLACED_ANCHOR_START",
- "U_MISPLACED_CURSOR_OFFSET",
- "U_MISPLACED_QUANTIFIER",
- "U_MISSING_OPERATOR",
- "U_MISSING_SEGMENT_CLOSE",
- "U_MULTIPLE_ANTE_CONTEXTS",
- "U_MULTIPLE_CURSORS",
- "U_MULTIPLE_POST_CONTEXTS",
- "U_TRAILING_BACKSLASH",
- "U_UNDEFINED_SEGMENT_REFERENCE",
- "U_UNDEFINED_VARIABLE",
- "U_UNQUOTED_SPECIAL",
- "U_UNTERMINATED_QUOTE",
- "U_RULE_MASK_ERROR",
- "U_MISPLACED_COMPOUND_FILTER",
- "U_MULTIPLE_COMPOUND_FILTERS",
- "U_INVALID_RBT_SYNTAX",
- "U_INVALID_PROPERTY_PATTERN",
- "U_MALFORMED_PRAGMA",
- "U_UNCLOSED_SEGMENT",
- "U_ILLEGAL_CHAR_IN_SEGMENT",
- "U_VARIABLE_RANGE_EXHAUSTED",
- "U_VARIABLE_RANGE_OVERLAP",
- "U_ILLEGAL_CHARACTER",
- "U_INTERNAL_TRANSLITERATOR_ERROR",
- "U_INVALID_ID",
- "U_INVALID_FUNCTION"
-};
-
-static const char * const
-_uErrorName[U_STANDARD_ERROR_LIMIT]={
- "U_ZERO_ERROR",
-
- "U_ILLEGAL_ARGUMENT_ERROR",
- "U_MISSING_RESOURCE_ERROR",
- "U_INVALID_FORMAT_ERROR",
- "U_FILE_ACCESS_ERROR",
- "U_INTERNAL_PROGRAM_ERROR",
- "U_MESSAGE_PARSE_ERROR",
- "U_MEMORY_ALLOCATION_ERROR",
- "U_INDEX_OUTOFBOUNDS_ERROR",
- "U_PARSE_ERROR",
- "U_INVALID_CHAR_FOUND",
- "U_TRUNCATED_CHAR_FOUND",
- "U_ILLEGAL_CHAR_FOUND",
- "U_INVALID_TABLE_FORMAT",
- "U_INVALID_TABLE_FILE",
- "U_BUFFER_OVERFLOW_ERROR",
- "U_UNSUPPORTED_ERROR",
- "U_RESOURCE_TYPE_MISMATCH",
- "U_ILLEGAL_ESCAPE_SEQUENCE",
- "U_UNSUPPORTED_ESCAPE_SEQUENCE",
- "U_NO_SPACE_AVAILABLE",
- "U_CE_NOT_FOUND_ERROR",
- "U_PRIMARY_TOO_LONG_ERROR",
- "U_STATE_TOO_OLD_ERROR",
- "U_TOO_MANY_ALIASES_ERROR",
- "U_ENUM_OUT_OF_SYNC_ERROR",
- "U_INVARIANT_CONVERSION_ERROR",
- "U_INVALID_STATE_ERROR",
- "U_COLLATOR_VERSION_MISMATCH",
- "U_USELESS_COLLATOR_ERROR",
- "U_NO_WRITE_PERMISSION"
-};
-static const char * const
-_uFmtErrorName[U_FMT_PARSE_ERROR_LIMIT - U_FMT_PARSE_ERROR_START] = {
- "U_UNEXPECTED_TOKEN",
- "U_MULTIPLE_DECIMAL_SEPARATORS",
- "U_MULTIPLE_EXPONENTIAL_SYMBOLS",
- "U_MALFORMED_EXPONENTIAL_PATTERN",
- "U_MULTIPLE_PERCENT_SYMBOLS",
- "U_MULTIPLE_PERMILL_SYMBOLS",
- "U_MULTIPLE_PAD_SPECIFIERS",
- "U_PATTERN_SYNTAX_ERROR",
- "U_ILLEGAL_PAD_POSITION",
- "U_UNMATCHED_BRACES",
- "U_UNSUPPORTED_PROPERTY",
- "U_UNSUPPORTED_ATTRIBUTE",
- "U_ARGUMENT_TYPE_MISMATCH",
- "U_DUPLICATE_KEYWORD",
- "U_UNDEFINED_KEYWORD",
- "U_DEFAULT_KEYWORD_MISSING",
- "U_DECIMAL_NUMBER_SYNTAX_ERROR",
- "U_FORMAT_INEXACT_ERROR",
- "U_NUMBER_ARG_OUTOFBOUNDS_ERROR",
- "U_NUMBER_SKELETON_SYNTAX_ERROR",
-};
-
-static const char * const
-_uBrkErrorName[U_BRK_ERROR_LIMIT - U_BRK_ERROR_START] = {
- "U_BRK_INTERNAL_ERROR",
- "U_BRK_HEX_DIGITS_EXPECTED",
- "U_BRK_SEMICOLON_EXPECTED",
- "U_BRK_RULE_SYNTAX",
- "U_BRK_UNCLOSED_SET",
- "U_BRK_ASSIGN_ERROR",
- "U_BRK_VARIABLE_REDFINITION",
- "U_BRK_MISMATCHED_PAREN",
- "U_BRK_NEW_LINE_IN_QUOTED_STRING",
- "U_BRK_UNDEFINED_VARIABLE",
- "U_BRK_INIT_ERROR",
- "U_BRK_RULE_EMPTY_SET",
- "U_BRK_UNRECOGNIZED_OPTION",
- "U_BRK_MALFORMED_RULE_TAG"
-};
-
-static const char * const
-_uRegexErrorName[U_REGEX_ERROR_LIMIT - U_REGEX_ERROR_START] = {
- "U_REGEX_INTERNAL_ERROR",
- "U_REGEX_RULE_SYNTAX",
- "U_REGEX_INVALID_STATE",
- "U_REGEX_BAD_ESCAPE_SEQUENCE",
- "U_REGEX_PROPERTY_SYNTAX",
- "U_REGEX_UNIMPLEMENTED",
- "U_REGEX_MISMATCHED_PAREN",
- "U_REGEX_NUMBER_TOO_BIG",
- "U_REGEX_BAD_INTERVAL",
- "U_REGEX_MAX_LT_MIN",
- "U_REGEX_INVALID_BACK_REF",
- "U_REGEX_INVALID_FLAG",
- "U_REGEX_LOOK_BEHIND_LIMIT",
- "U_REGEX_SET_CONTAINS_STRING",
- "U_REGEX_OCTAL_TOO_BIG",
- "U_REGEX_MISSING_CLOSE_BRACKET",
- "U_REGEX_INVALID_RANGE",
- "U_REGEX_STACK_OVERFLOW",
- "U_REGEX_TIME_OUT",
- "U_REGEX_STOPPED_BY_CALLER",
- "U_REGEX_PATTERN_TOO_BIG",
- "U_REGEX_INVALID_CAPTURE_GROUP_NAME"
-};
-
-static const char * const
-_uIDNAErrorName[U_IDNA_ERROR_LIMIT - U_IDNA_ERROR_START] = {
- "U_STRINGPREP_PROHIBITED_ERROR",
- "U_STRINGPREP_UNASSIGNED_ERROR",
- "U_STRINGPREP_CHECK_BIDI_ERROR",
- "U_IDNA_STD3_ASCII_RULES_ERROR",
- "U_IDNA_ACE_PREFIX_ERROR",
- "U_IDNA_VERIFICATION_ERROR",
- "U_IDNA_LABEL_TOO_LONG_ERROR",
- "U_IDNA_ZERO_LENGTH_LABEL_ERROR",
- "U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR"
-};
-
-static const char * const
-_uPluginErrorName[U_PLUGIN_ERROR_LIMIT - U_PLUGIN_ERROR_START] = {
- "U_PLUGIN_TOO_HIGH",
- "U_PLUGIN_DIDNT_SET_LEVEL",
-};
-
-U_CAPI const char * U_EXPORT2
-u_errorName(UErrorCode code) {
- if(U_ZERO_ERROR <= code && code < U_STANDARD_ERROR_LIMIT) {
- return _uErrorName[code];
- } else if(U_ERROR_WARNING_START <= code && code < U_ERROR_WARNING_LIMIT) {
- return _uErrorInfoName[code - U_ERROR_WARNING_START];
- } else if(U_PARSE_ERROR_START <= code && code < U_PARSE_ERROR_LIMIT){
- return _uTransErrorName[code - U_PARSE_ERROR_START];
- } else if(U_FMT_PARSE_ERROR_START <= code && code < U_FMT_PARSE_ERROR_LIMIT){
- return _uFmtErrorName[code - U_FMT_PARSE_ERROR_START];
- } else if (U_BRK_ERROR_START <= code && code < U_BRK_ERROR_LIMIT){
- return _uBrkErrorName[code - U_BRK_ERROR_START];
- } else if (U_REGEX_ERROR_START <= code && code < U_REGEX_ERROR_LIMIT) {
- return _uRegexErrorName[code - U_REGEX_ERROR_START];
- } else if(U_IDNA_ERROR_START <= code && code < U_IDNA_ERROR_LIMIT) {
- return _uIDNAErrorName[code - U_IDNA_ERROR_START];
- } else if(U_PLUGIN_ERROR_START <= code && code < U_PLUGIN_ERROR_LIMIT) {
- return _uPluginErrorName[code - U_PLUGIN_ERROR_START];
- } else {
- return "[BOGUS UErrorCode]";
- }
-}
-
-/*
- * Hey, Emacs, please set the following:
- *
- * Local Variables:
- * indent-tabs-mode: nil
- * End:
- *
- */
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 1997-2015, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+*
+* FILE NAME : utypes.c (previously putil.c)
+*
+* Date Name Description
+* 10/07/2004 grhoten split from putil.c
+******************************************************************************
+*/
+
+#include "unicode/utypes.h"
+
+/* u_errorName() ------------------------------------------------------------ */
+
+static const char * const
+_uErrorInfoName[U_ERROR_WARNING_LIMIT-U_ERROR_WARNING_START]={
+ "U_USING_FALLBACK_WARNING",
+ "U_USING_DEFAULT_WARNING",
+ "U_SAFECLONE_ALLOCATED_WARNING",
+ "U_STATE_OLD_WARNING",
+ "U_STRING_NOT_TERMINATED_WARNING",
+ "U_SORT_KEY_TOO_SHORT_WARNING",
+ "U_AMBIGUOUS_ALIAS_WARNING",
+ "U_DIFFERENT_UCA_VERSION",
+ "U_PLUGIN_CHANGED_LEVEL_WARNING",
+};
+
+static const char * const
+_uTransErrorName[U_PARSE_ERROR_LIMIT - U_PARSE_ERROR_START]={
+ "U_BAD_VARIABLE_DEFINITION",
+ "U_MALFORMED_RULE",
+ "U_MALFORMED_SET",
+ "U_MALFORMED_SYMBOL_REFERENCE",
+ "U_MALFORMED_UNICODE_ESCAPE",
+ "U_MALFORMED_VARIABLE_DEFINITION",
+ "U_MALFORMED_VARIABLE_REFERENCE",
+ "U_MISMATCHED_SEGMENT_DELIMITERS",
+ "U_MISPLACED_ANCHOR_START",
+ "U_MISPLACED_CURSOR_OFFSET",
+ "U_MISPLACED_QUANTIFIER",
+ "U_MISSING_OPERATOR",
+ "U_MISSING_SEGMENT_CLOSE",
+ "U_MULTIPLE_ANTE_CONTEXTS",
+ "U_MULTIPLE_CURSORS",
+ "U_MULTIPLE_POST_CONTEXTS",
+ "U_TRAILING_BACKSLASH",
+ "U_UNDEFINED_SEGMENT_REFERENCE",
+ "U_UNDEFINED_VARIABLE",
+ "U_UNQUOTED_SPECIAL",
+ "U_UNTERMINATED_QUOTE",
+ "U_RULE_MASK_ERROR",
+ "U_MISPLACED_COMPOUND_FILTER",
+ "U_MULTIPLE_COMPOUND_FILTERS",
+ "U_INVALID_RBT_SYNTAX",
+ "U_INVALID_PROPERTY_PATTERN",
+ "U_MALFORMED_PRAGMA",
+ "U_UNCLOSED_SEGMENT",
+ "U_ILLEGAL_CHAR_IN_SEGMENT",
+ "U_VARIABLE_RANGE_EXHAUSTED",
+ "U_VARIABLE_RANGE_OVERLAP",
+ "U_ILLEGAL_CHARACTER",
+ "U_INTERNAL_TRANSLITERATOR_ERROR",
+ "U_INVALID_ID",
+ "U_INVALID_FUNCTION"
+};
+
+static const char * const
+_uErrorName[U_STANDARD_ERROR_LIMIT]={
+ "U_ZERO_ERROR",
+
+ "U_ILLEGAL_ARGUMENT_ERROR",
+ "U_MISSING_RESOURCE_ERROR",
+ "U_INVALID_FORMAT_ERROR",
+ "U_FILE_ACCESS_ERROR",
+ "U_INTERNAL_PROGRAM_ERROR",
+ "U_MESSAGE_PARSE_ERROR",
+ "U_MEMORY_ALLOCATION_ERROR",
+ "U_INDEX_OUTOFBOUNDS_ERROR",
+ "U_PARSE_ERROR",
+ "U_INVALID_CHAR_FOUND",
+ "U_TRUNCATED_CHAR_FOUND",
+ "U_ILLEGAL_CHAR_FOUND",
+ "U_INVALID_TABLE_FORMAT",
+ "U_INVALID_TABLE_FILE",
+ "U_BUFFER_OVERFLOW_ERROR",
+ "U_UNSUPPORTED_ERROR",
+ "U_RESOURCE_TYPE_MISMATCH",
+ "U_ILLEGAL_ESCAPE_SEQUENCE",
+ "U_UNSUPPORTED_ESCAPE_SEQUENCE",
+ "U_NO_SPACE_AVAILABLE",
+ "U_CE_NOT_FOUND_ERROR",
+ "U_PRIMARY_TOO_LONG_ERROR",
+ "U_STATE_TOO_OLD_ERROR",
+ "U_TOO_MANY_ALIASES_ERROR",
+ "U_ENUM_OUT_OF_SYNC_ERROR",
+ "U_INVARIANT_CONVERSION_ERROR",
+ "U_INVALID_STATE_ERROR",
+ "U_COLLATOR_VERSION_MISMATCH",
+ "U_USELESS_COLLATOR_ERROR",
+ "U_NO_WRITE_PERMISSION"
+};
+static const char * const
+_uFmtErrorName[U_FMT_PARSE_ERROR_LIMIT - U_FMT_PARSE_ERROR_START] = {
+ "U_UNEXPECTED_TOKEN",
+ "U_MULTIPLE_DECIMAL_SEPARATORS",
+ "U_MULTIPLE_EXPONENTIAL_SYMBOLS",
+ "U_MALFORMED_EXPONENTIAL_PATTERN",
+ "U_MULTIPLE_PERCENT_SYMBOLS",
+ "U_MULTIPLE_PERMILL_SYMBOLS",
+ "U_MULTIPLE_PAD_SPECIFIERS",
+ "U_PATTERN_SYNTAX_ERROR",
+ "U_ILLEGAL_PAD_POSITION",
+ "U_UNMATCHED_BRACES",
+ "U_UNSUPPORTED_PROPERTY",
+ "U_UNSUPPORTED_ATTRIBUTE",
+ "U_ARGUMENT_TYPE_MISMATCH",
+ "U_DUPLICATE_KEYWORD",
+ "U_UNDEFINED_KEYWORD",
+ "U_DEFAULT_KEYWORD_MISSING",
+ "U_DECIMAL_NUMBER_SYNTAX_ERROR",
+ "U_FORMAT_INEXACT_ERROR",
+ "U_NUMBER_ARG_OUTOFBOUNDS_ERROR",
+ "U_NUMBER_SKELETON_SYNTAX_ERROR",
+};
+
+static const char * const
+_uBrkErrorName[U_BRK_ERROR_LIMIT - U_BRK_ERROR_START] = {
+ "U_BRK_INTERNAL_ERROR",
+ "U_BRK_HEX_DIGITS_EXPECTED",
+ "U_BRK_SEMICOLON_EXPECTED",
+ "U_BRK_RULE_SYNTAX",
+ "U_BRK_UNCLOSED_SET",
+ "U_BRK_ASSIGN_ERROR",
+ "U_BRK_VARIABLE_REDFINITION",
+ "U_BRK_MISMATCHED_PAREN",
+ "U_BRK_NEW_LINE_IN_QUOTED_STRING",
+ "U_BRK_UNDEFINED_VARIABLE",
+ "U_BRK_INIT_ERROR",
+ "U_BRK_RULE_EMPTY_SET",
+ "U_BRK_UNRECOGNIZED_OPTION",
+ "U_BRK_MALFORMED_RULE_TAG"
+};
+
+static const char * const
+_uRegexErrorName[U_REGEX_ERROR_LIMIT - U_REGEX_ERROR_START] = {
+ "U_REGEX_INTERNAL_ERROR",
+ "U_REGEX_RULE_SYNTAX",
+ "U_REGEX_INVALID_STATE",
+ "U_REGEX_BAD_ESCAPE_SEQUENCE",
+ "U_REGEX_PROPERTY_SYNTAX",
+ "U_REGEX_UNIMPLEMENTED",
+ "U_REGEX_MISMATCHED_PAREN",
+ "U_REGEX_NUMBER_TOO_BIG",
+ "U_REGEX_BAD_INTERVAL",
+ "U_REGEX_MAX_LT_MIN",
+ "U_REGEX_INVALID_BACK_REF",
+ "U_REGEX_INVALID_FLAG",
+ "U_REGEX_LOOK_BEHIND_LIMIT",
+ "U_REGEX_SET_CONTAINS_STRING",
+ "U_REGEX_OCTAL_TOO_BIG",
+ "U_REGEX_MISSING_CLOSE_BRACKET",
+ "U_REGEX_INVALID_RANGE",
+ "U_REGEX_STACK_OVERFLOW",
+ "U_REGEX_TIME_OUT",
+ "U_REGEX_STOPPED_BY_CALLER",
+ "U_REGEX_PATTERN_TOO_BIG",
+ "U_REGEX_INVALID_CAPTURE_GROUP_NAME"
+};
+
+static const char * const
+_uIDNAErrorName[U_IDNA_ERROR_LIMIT - U_IDNA_ERROR_START] = {
+ "U_STRINGPREP_PROHIBITED_ERROR",
+ "U_STRINGPREP_UNASSIGNED_ERROR",
+ "U_STRINGPREP_CHECK_BIDI_ERROR",
+ "U_IDNA_STD3_ASCII_RULES_ERROR",
+ "U_IDNA_ACE_PREFIX_ERROR",
+ "U_IDNA_VERIFICATION_ERROR",
+ "U_IDNA_LABEL_TOO_LONG_ERROR",
+ "U_IDNA_ZERO_LENGTH_LABEL_ERROR",
+ "U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR"
+};
+
+static const char * const
+_uPluginErrorName[U_PLUGIN_ERROR_LIMIT - U_PLUGIN_ERROR_START] = {
+ "U_PLUGIN_TOO_HIGH",
+ "U_PLUGIN_DIDNT_SET_LEVEL",
+};
+
+U_CAPI const char * U_EXPORT2
+u_errorName(UErrorCode code) {
+ if(U_ZERO_ERROR <= code && code < U_STANDARD_ERROR_LIMIT) {
+ return _uErrorName[code];
+ } else if(U_ERROR_WARNING_START <= code && code < U_ERROR_WARNING_LIMIT) {
+ return _uErrorInfoName[code - U_ERROR_WARNING_START];
+ } else if(U_PARSE_ERROR_START <= code && code < U_PARSE_ERROR_LIMIT){
+ return _uTransErrorName[code - U_PARSE_ERROR_START];
+ } else if(U_FMT_PARSE_ERROR_START <= code && code < U_FMT_PARSE_ERROR_LIMIT){
+ return _uFmtErrorName[code - U_FMT_PARSE_ERROR_START];
+ } else if (U_BRK_ERROR_START <= code && code < U_BRK_ERROR_LIMIT){
+ return _uBrkErrorName[code - U_BRK_ERROR_START];
+ } else if (U_REGEX_ERROR_START <= code && code < U_REGEX_ERROR_LIMIT) {
+ return _uRegexErrorName[code - U_REGEX_ERROR_START];
+ } else if(U_IDNA_ERROR_START <= code && code < U_IDNA_ERROR_LIMIT) {
+ return _uIDNAErrorName[code - U_IDNA_ERROR_START];
+ } else if(U_PLUGIN_ERROR_START <= code && code < U_PLUGIN_ERROR_LIMIT) {
+ return _uPluginErrorName[code - U_PLUGIN_ERROR_START];
+ } else {
+ return "[BOGUS UErrorCode]";
+ }
+}
+
+/*
+ * Hey, Emacs, please set the following:
+ *
+ * Local Variables:
+ * indent-tabs-mode: nil
+ * End:
+ *
+ */
diff --git a/contrib/libs/icu/common/uvector.cpp b/contrib/libs/icu/common/uvector.cpp
index 3727f87378..cf19edf646 100644
--- a/contrib/libs/icu/common/uvector.cpp
+++ b/contrib/libs/icu/common/uvector.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/common/uvector.h b/contrib/libs/icu/common/uvector.h
index 50bc37b277..98318d14c6 100644
--- a/contrib/libs/icu/common/uvector.h
+++ b/contrib/libs/icu/common/uvector.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -142,19 +142,19 @@ public:
UBool equals(const UVector &other) const;
- inline void* firstElement(void) const;
+ inline void* firstElement(void) const;
- inline void* lastElement(void) const;
+ inline void* lastElement(void) const;
- inline int32_t lastElementi(void) const;
+ inline int32_t lastElementi(void) const;
int32_t indexOf(void* obj, int32_t startIndex = 0) const;
int32_t indexOf(int32_t obj, int32_t startIndex = 0) const;
- inline UBool contains(void* obj) const;
+ inline UBool contains(void* obj) const;
- inline UBool contains(int32_t obj) const;
+ inline UBool contains(int32_t obj) const;
UBool containsAll(const UVector& other) const;
@@ -168,9 +168,9 @@ public:
void removeAllElements();
- inline int32_t size(void) const;
+ inline int32_t size(void) const;
- inline UBool isEmpty(void) const;
+ inline UBool isEmpty(void) const;
UBool ensureCapacity(int32_t minimumCapacity, UErrorCode &status);
@@ -195,7 +195,7 @@ public:
UElementsAreEqual *setComparer(UElementsAreEqual *c);
- inline void* operator[](int32_t index) const;
+ inline void* operator[](int32_t index) const;
/**
* Removes the element at the given index from this vector and
@@ -309,19 +309,19 @@ public:
// It's okay not to have a virtual destructor (in UVector)
// because UStack has no special cleanup to do.
- inline UBool empty(void) const;
+ inline UBool empty(void) const;
- inline void* peek(void) const;
+ inline void* peek(void) const;
- inline int32_t peeki(void) const;
+ inline int32_t peeki(void) const;
void* pop(void);
int32_t popi(void);
- inline void* push(void* obj, UErrorCode &status);
+ inline void* push(void* obj, UErrorCode &status);
- inline int32_t push(int32_t i, UErrorCode &status);
+ inline int32_t push(int32_t i, UErrorCode &status);
/*
If the object o occurs as an item in this stack,
diff --git a/contrib/libs/icu/common/uvectr32.cpp b/contrib/libs/icu/common/uvectr32.cpp
index 9b8243f95b..d1ae659958 100644
--- a/contrib/libs/icu/common/uvectr32.cpp
+++ b/contrib/libs/icu/common/uvectr32.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/common/uvectr32.h b/contrib/libs/icu/common/uvectr32.h
index f70a9970f0..ba47daa75f 100644
--- a/contrib/libs/icu/common/uvectr32.h
+++ b/contrib/libs/icu/common/uvectr32.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -97,21 +97,21 @@ public:
// java.util.Vector API
//------------------------------------------------------------
- inline void addElement(int32_t elem, UErrorCode &status);
+ inline void addElement(int32_t elem, UErrorCode &status);
void setElementAt(int32_t elem, int32_t index);
void insertElementAt(int32_t elem, int32_t index, UErrorCode &status);
- inline int32_t elementAti(int32_t index) const;
+ inline int32_t elementAti(int32_t index) const;
UBool equals(const UVector32 &other) const;
- inline int32_t lastElementi(void) const;
+ inline int32_t lastElementi(void) const;
int32_t indexOf(int32_t elem, int32_t startIndex = 0) const;
- inline UBool contains(int32_t elem) const;
+ inline UBool contains(int32_t elem) const;
UBool containsAll(const UVector32& other) const;
@@ -123,9 +123,9 @@ public:
void removeAllElements();
- inline int32_t size(void) const;
+ inline int32_t size(void) const;
- inline UBool isEmpty(void) const;
+ inline UBool isEmpty(void) const;
// Inline. Use this one for speedy size check.
inline UBool ensureCapacity(int32_t minimumCapacity, UErrorCode &status);
@@ -163,7 +163,7 @@ public:
/**
* Returns a pointer to the internal array holding the vector.
*/
- inline int32_t *getBuffer() const;
+ inline int32_t *getBuffer() const;
/**
* Set the maximum allowed buffer capacity for this vector/stack.
@@ -197,16 +197,16 @@ private:
// In the original UVector, these were in a separate derived class, UStack.
// Here in UVector32, they are all together.
public:
- inline UBool empty(void) const; // TODO: redundant, same as empty(). Remove it?
+ inline UBool empty(void) const; // TODO: redundant, same as empty(). Remove it?
- inline int32_t peeki(void) const;
+ inline int32_t peeki(void) const;
- inline int32_t popi(void);
+ inline int32_t popi(void);
- inline int32_t push(int32_t i, UErrorCode &status);
+ inline int32_t push(int32_t i, UErrorCode &status);
- inline int32_t *reserveBlock(int32_t size, UErrorCode &status);
- inline int32_t *popFrame(int32_t size);
+ inline int32_t *reserveBlock(int32_t size, UErrorCode &status);
+ inline int32_t *popFrame(int32_t size);
};
diff --git a/contrib/libs/icu/common/uvectr64.cpp b/contrib/libs/icu/common/uvectr64.cpp
index 6135d0f1c1..081565959c 100644
--- a/contrib/libs/icu/common/uvectr64.cpp
+++ b/contrib/libs/icu/common/uvectr64.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/common/uvectr64.h b/contrib/libs/icu/common/uvectr64.h
index dec0d40988..1cc9a50191 100644
--- a/contrib/libs/icu/common/uvectr64.h
+++ b/contrib/libs/icu/common/uvectr64.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -96,17 +96,17 @@ public:
// subset of java.util.Vector API
//------------------------------------------------------------
- inline void addElement(int64_t elem, UErrorCode &status);
+ inline void addElement(int64_t elem, UErrorCode &status);
void setElementAt(int64_t elem, int32_t index);
void insertElementAt(int64_t elem, int32_t index, UErrorCode &status);
- inline int64_t elementAti(int32_t index) const;
+ inline int64_t elementAti(int32_t index) const;
//UBool equals(const UVector64 &other) const;
- inline int64_t lastElementi(void) const;
+ inline int64_t lastElementi(void) const;
//int32_t indexOf(int64_t elem, int32_t startIndex = 0) const;
@@ -122,7 +122,7 @@ public:
void removeAllElements();
- inline int32_t size(void) const;
+ inline int32_t size(void) const;
inline UBool isEmpty(void) const { return count == 0; }
@@ -152,7 +152,7 @@ public:
/**
* Returns a pointer to the internal array holding the vector.
*/
- inline int64_t *getBuffer() const;
+ inline int64_t *getBuffer() const;
/**
* Set the maximum allowed buffer capacity for this vector/stack.
@@ -190,12 +190,12 @@ public:
//int64_t peeki(void) const;
- inline int64_t popi(void);
+ inline int64_t popi(void);
- inline int64_t push(int64_t i, UErrorCode &status);
+ inline int64_t push(int64_t i, UErrorCode &status);
- inline int64_t *reserveBlock(int32_t size, UErrorCode &status);
- inline int64_t *popFrame(int32_t size);
+ inline int64_t *reserveBlock(int32_t size, UErrorCode &status);
+ inline int64_t *popFrame(int32_t size);
};
diff --git a/contrib/libs/icu/common/wintz.cpp b/contrib/libs/icu/common/wintz.cpp
index 47a4c818ea..115512e704 100644
--- a/contrib/libs/icu/common/wintz.cpp
+++ b/contrib/libs/icu/common/wintz.cpp
@@ -1,124 +1,124 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-********************************************************************************
-* Copyright (C) 2005-2015, International Business Machines
-* Corporation and others. All Rights Reserved.
-********************************************************************************
-*
-* File WINTZ.CPP
-*
-********************************************************************************
-*/
-
-#include "unicode/utypes.h"
-
-#if U_PLATFORM_USES_ONLY_WIN32_API
-
-#include "wintz.h"
-#include "cmemory.h"
-#include "cstring.h"
-
-#include "unicode/ures.h"
-#include "unicode/ustring.h"
-#include "uresimp.h"
-
-#ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-#endif
-# define VC_EXTRALEAN
-# define NOUSER
-# define NOSERVICE
-# define NOIME
-# define NOMCX
-#include <windows.h>
-
-U_NAMESPACE_BEGIN
-
-// The max size of TimeZoneKeyName is 128, defined in DYNAMIC_TIME_ZONE_INFORMATION
-#define MAX_TIMEZONE_ID_LENGTH 128
-
-/**
-* Main Windows time zone detection function.
-* Returns the Windows time zone converted to an ICU time zone as a heap-allocated buffer, or nullptr upon failure.
-* Note: We use the Win32 API GetDynamicTimeZoneInformation to get the current time zone info.
-* This API returns a non-localized time zone name, which we can then map to an ICU time zone name.
-*/
-U_INTERNAL const char* U_EXPORT2
-uprv_detectWindowsTimeZone()
-{
- UErrorCode status = U_ZERO_ERROR;
- char* icuid = nullptr;
- char dynamicTZKeyName[MAX_TIMEZONE_ID_LENGTH];
- char tmpid[MAX_TIMEZONE_ID_LENGTH];
- int32_t len;
- int id = GEOID_NOT_AVAILABLE;
- int errorCode;
- wchar_t ISOcodeW[3] = {}; /* 2 letter ISO code in UTF-16 */
- char ISOcode[3] = {}; /* 2 letter ISO code in UTF-8 */
-
- DYNAMIC_TIME_ZONE_INFORMATION dynamicTZI;
- uprv_memset(&dynamicTZI, 0, sizeof(dynamicTZI));
- uprv_memset(dynamicTZKeyName, 0, sizeof(dynamicTZKeyName));
- uprv_memset(tmpid, 0, sizeof(tmpid));
-
- /* Obtain TIME_ZONE_INFORMATION from the API and get the non-localized time zone name. */
- if (TIME_ZONE_ID_INVALID == GetDynamicTimeZoneInformation(&dynamicTZI)) {
- return nullptr;
- }
-
- id = GetUserGeoID(GEOCLASS_NATION);
- errorCode = GetGeoInfoW(id, GEO_ISO2, ISOcodeW, 3, 0);
-
- // convert from wchar_t* (UTF-16 on Windows) to char* (UTF-8).
- u_strToUTF8(ISOcode, UPRV_LENGTHOF(ISOcode), nullptr,
- reinterpret_cast<const UChar*>(ISOcodeW), UPRV_LENGTHOF(ISOcodeW), &status);
-
- LocalUResourceBundlePointer bundle(ures_openDirect(nullptr, "windowsZones", &status));
- ures_getByKey(bundle.getAlias(), "mapTimezones", bundle.getAlias(), &status);
-
- // convert from wchar_t* (UTF-16 on Windows) to char* (UTF-8).
- u_strToUTF8(dynamicTZKeyName, UPRV_LENGTHOF(dynamicTZKeyName), nullptr,
- reinterpret_cast<const UChar*>(dynamicTZI.TimeZoneKeyName), -1, &status);
-
- if (U_FAILURE(status)) {
- return nullptr;
- }
-
- if (dynamicTZI.TimeZoneKeyName[0] != 0) {
- StackUResourceBundle winTZ;
- ures_getByKey(bundle.getAlias(), dynamicTZKeyName, winTZ.getAlias(), &status);
-
- if (U_SUCCESS(status)) {
- const UChar* icuTZ = nullptr;
- if (errorCode != 0) {
- icuTZ = ures_getStringByKey(winTZ.getAlias(), ISOcode, &len, &status);
- }
- if (errorCode == 0 || icuTZ == nullptr) {
- /* fallback to default "001" and reset status */
- status = U_ZERO_ERROR;
- icuTZ = ures_getStringByKey(winTZ.getAlias(), "001", &len, &status);
- }
-
- if (U_SUCCESS(status)) {
- int index = 0;
-
- while (!(*icuTZ == '\0' || *icuTZ == ' ')) {
- // time zone IDs only contain ASCII invariant characters.
- tmpid[index++] = (char)(*icuTZ++);
- }
- tmpid[index] = '\0';
- }
- }
- }
-
- // Copy the timezone ID to icuid to be returned.
- if (tmpid[0] != 0) {
- icuid = uprv_strdup(tmpid);
- }
-
- return icuid;
-}
-
-U_NAMESPACE_END
-#endif /* U_PLATFORM_USES_ONLY_WIN32_API */
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+********************************************************************************
+* Copyright (C) 2005-2015, International Business Machines
+* Corporation and others. All Rights Reserved.
+********************************************************************************
+*
+* File WINTZ.CPP
+*
+********************************************************************************
+*/
+
+#include "unicode/utypes.h"
+
+#if U_PLATFORM_USES_ONLY_WIN32_API
+
+#include "wintz.h"
+#include "cmemory.h"
+#include "cstring.h"
+
+#include "unicode/ures.h"
+#include "unicode/ustring.h"
+#include "uresimp.h"
+
+#ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
+# define VC_EXTRALEAN
+# define NOUSER
+# define NOSERVICE
+# define NOIME
+# define NOMCX
+#include <windows.h>
+
+U_NAMESPACE_BEGIN
+
+// The max size of TimeZoneKeyName is 128, defined in DYNAMIC_TIME_ZONE_INFORMATION
+#define MAX_TIMEZONE_ID_LENGTH 128
+
+/**
+* Main Windows time zone detection function.
+* Returns the Windows time zone converted to an ICU time zone as a heap-allocated buffer, or nullptr upon failure.
+* Note: We use the Win32 API GetDynamicTimeZoneInformation to get the current time zone info.
+* This API returns a non-localized time zone name, which we can then map to an ICU time zone name.
+*/
+U_INTERNAL const char* U_EXPORT2
+uprv_detectWindowsTimeZone()
+{
+ UErrorCode status = U_ZERO_ERROR;
+ char* icuid = nullptr;
+ char dynamicTZKeyName[MAX_TIMEZONE_ID_LENGTH];
+ char tmpid[MAX_TIMEZONE_ID_LENGTH];
+ int32_t len;
+ int id = GEOID_NOT_AVAILABLE;
+ int errorCode;
+ wchar_t ISOcodeW[3] = {}; /* 2 letter ISO code in UTF-16 */
+ char ISOcode[3] = {}; /* 2 letter ISO code in UTF-8 */
+
+ DYNAMIC_TIME_ZONE_INFORMATION dynamicTZI;
+ uprv_memset(&dynamicTZI, 0, sizeof(dynamicTZI));
+ uprv_memset(dynamicTZKeyName, 0, sizeof(dynamicTZKeyName));
+ uprv_memset(tmpid, 0, sizeof(tmpid));
+
+ /* Obtain TIME_ZONE_INFORMATION from the API and get the non-localized time zone name. */
+ if (TIME_ZONE_ID_INVALID == GetDynamicTimeZoneInformation(&dynamicTZI)) {
+ return nullptr;
+ }
+
+ id = GetUserGeoID(GEOCLASS_NATION);
+ errorCode = GetGeoInfoW(id, GEO_ISO2, ISOcodeW, 3, 0);
+
+ // convert from wchar_t* (UTF-16 on Windows) to char* (UTF-8).
+ u_strToUTF8(ISOcode, UPRV_LENGTHOF(ISOcode), nullptr,
+ reinterpret_cast<const UChar*>(ISOcodeW), UPRV_LENGTHOF(ISOcodeW), &status);
+
+ LocalUResourceBundlePointer bundle(ures_openDirect(nullptr, "windowsZones", &status));
+ ures_getByKey(bundle.getAlias(), "mapTimezones", bundle.getAlias(), &status);
+
+ // convert from wchar_t* (UTF-16 on Windows) to char* (UTF-8).
+ u_strToUTF8(dynamicTZKeyName, UPRV_LENGTHOF(dynamicTZKeyName), nullptr,
+ reinterpret_cast<const UChar*>(dynamicTZI.TimeZoneKeyName), -1, &status);
+
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+
+ if (dynamicTZI.TimeZoneKeyName[0] != 0) {
+ StackUResourceBundle winTZ;
+ ures_getByKey(bundle.getAlias(), dynamicTZKeyName, winTZ.getAlias(), &status);
+
+ if (U_SUCCESS(status)) {
+ const UChar* icuTZ = nullptr;
+ if (errorCode != 0) {
+ icuTZ = ures_getStringByKey(winTZ.getAlias(), ISOcode, &len, &status);
+ }
+ if (errorCode == 0 || icuTZ == nullptr) {
+ /* fallback to default "001" and reset status */
+ status = U_ZERO_ERROR;
+ icuTZ = ures_getStringByKey(winTZ.getAlias(), "001", &len, &status);
+ }
+
+ if (U_SUCCESS(status)) {
+ int index = 0;
+
+ while (!(*icuTZ == '\0' || *icuTZ == ' ')) {
+ // time zone IDs only contain ASCII invariant characters.
+ tmpid[index++] = (char)(*icuTZ++);
+ }
+ tmpid[index] = '\0';
+ }
+ }
+ }
+
+ // Copy the timezone ID to icuid to be returned.
+ if (tmpid[0] != 0) {
+ icuid = uprv_strdup(tmpid);
+ }
+
+ return icuid;
+}
+
+U_NAMESPACE_END
+#endif /* U_PLATFORM_USES_ONLY_WIN32_API */
diff --git a/contrib/libs/icu/common/wintz.h b/contrib/libs/icu/common/wintz.h
index c0cacdea46..cd8565eef1 100644
--- a/contrib/libs/icu/common/wintz.h
+++ b/contrib/libs/icu/common/wintz.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -16,7 +16,7 @@
#include "unicode/utypes.h"
-#if U_PLATFORM_USES_ONLY_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
/**
* \file
@@ -28,9 +28,9 @@ U_CDECL_BEGIN
typedef struct _TIME_ZONE_INFORMATION TIME_ZONE_INFORMATION;
U_CDECL_END
-U_INTERNAL const char* U_EXPORT2
+U_INTERNAL const char* U_EXPORT2
uprv_detectWindowsTimeZone();
-#endif /* U_PLATFORM_USES_ONLY_WIN32_API */
+#endif /* U_PLATFORM_USES_ONLY_WIN32_API */
#endif /* __WINTZ */
diff --git a/contrib/libs/icu/i18n/alphaindex.cpp b/contrib/libs/icu/i18n/alphaindex.cpp
index 5d1fe2ff29..9c312bd8e6 100644
--- a/contrib/libs/icu/i18n/alphaindex.cpp
+++ b/contrib/libs/icu/i18n/alphaindex.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -260,7 +260,7 @@ AlphabeticIndex::ImmutableIndex *AlphabeticIndex::buildImmutableIndex(UErrorCode
// but that would be worth it only if this method is called multiple times,
// or called after using the old-style bucket iterator API.
LocalPointer<BucketList> immutableBucketList(createBucketList(errorCode));
- LocalPointer<RuleBasedCollator> coll(collatorPrimaryOnly_->clone());
+ LocalPointer<RuleBasedCollator> coll(collatorPrimaryOnly_->clone());
if (immutableBucketList.isNull() || coll.isNull()) {
errorCode = U_MEMORY_ALLOCATION_ERROR;
return NULL;
@@ -510,8 +510,8 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const {
ces, errorCode) &&
current.charAt(current.length() - 1) != 0xFFFF /* !current.endsWith("\uffff") */) {
// "AE-ligature" or "Sch" etc.
- for (int32_t j = bucketList->size() - 2;; --j) {
- Bucket *singleBucket = getBucket(*bucketList, j);
+ for (int32_t j = bucketList->size() - 2;; --j) {
+ Bucket *singleBucket = getBucket(*bucketList, j);
if (singleBucket->labelType_ != U_ALPHAINDEX_NORMAL) {
// There is no single-character bucket since the last
// underflow or inflow label.
@@ -607,8 +607,8 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const {
}
// Do not call publicBucketList->setDeleter():
// This vector shares its objects with the bucketList.
- for (int32_t j = 0; j < bucketList->size(); ++j) {
- bucket = getBucket(*bucketList, j);
+ for (int32_t j = 0; j < bucketList->size(); ++j) {
+ bucket = getBucket(*bucketList, j);
if (bucket->displayBucket_ == NULL) {
publicBucketList->addElement(bucket, errorCode);
}
@@ -724,7 +724,7 @@ void AlphabeticIndex::addIndexExemplars(const Locale &locale, UErrorCode &status
}
// question: should we add auxiliary exemplars?
- if (exemplars.containsSome(0x61, 0x7A) /* a-z */ || exemplars.isEmpty()) {
+ if (exemplars.containsSome(0x61, 0x7A) /* a-z */ || exemplars.isEmpty()) {
exemplars.add(0x61, 0x7A);
}
if (exemplars.containsSome(0xAC00, 0xD7A3)) { // Hangul syllables
@@ -739,9 +739,9 @@ void AlphabeticIndex::addIndexExemplars(const Locale &locale, UErrorCode &status
// cut down to small list
// make use of the fact that Ethiopic is allocated in 8's, where
// the base is 0 mod 8.
- UnicodeSet ethiopic(UnicodeString(u"[ሀለሐመሠረሰሸቀቈቐቘበቨተቸኀኈነኘአከኰኸዀወዐዘዠየደዸጀገጐጘጠጨጰጸፀፈፐፘ]"), status);
- ethiopic.retainAll(exemplars);
- exemplars.remove(u'ሀ', 0x137F).addAll(ethiopic);
+ UnicodeSet ethiopic(UnicodeString(u"[ሀለሐመሠረሰሸቀቈቐቘበቨተቸኀኈነኘአከኰኸዀወዐዘዠየደዸጀገጐጘጠጨጰጸፀፈፐፘ]"), status);
+ ethiopic.retainAll(exemplars);
+ exemplars.remove(u'ሀ', 0x137F).addAll(ethiopic);
}
// Upper-case any that aren't already so.
@@ -906,7 +906,7 @@ void AlphabeticIndex::init(const Locale *locale, UErrorCode &status) {
return;
}
}
- collatorPrimaryOnly_ = collator_->clone();
+ collatorPrimaryOnly_ = collator_->clone();
if (collatorPrimaryOnly_ == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
@@ -957,7 +957,7 @@ collatorComparator(const void *context, const void *left, const void *right) {
}
if (leftString == NULL) {
return 1;
- }
+ }
if (rightString == NULL) {
return -1;
}
diff --git a/contrib/libs/icu/i18n/anytrans.cpp b/contrib/libs/icu/i18n/anytrans.cpp
index a1092301b5..167b018528 100644
--- a/contrib/libs/icu/i18n/anytrans.cpp
+++ b/contrib/libs/icu/i18n/anytrans.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************
@@ -31,14 +31,14 @@
static const UChar TARGET_SEP = 45; // '-'
static const UChar VARIANT_SEP = 47; // '/'
-static const UChar ANY[] = {0x41,0x6E,0x79,0}; // "Any"
+static const UChar ANY[] = {0x41,0x6E,0x79,0}; // "Any"
static const UChar NULL_ID[] = {78,117,108,108,0}; // "Null"
-static const UChar LATIN_PIVOT[] = {0x2D,0x4C,0x61,0x74,0x6E,0x3B,0x4C,0x61,0x74,0x6E,0x2D,0}; // "-Latn;Latn-"
+static const UChar LATIN_PIVOT[] = {0x2D,0x4C,0x61,0x74,0x6E,0x3B,0x4C,0x61,0x74,0x6E,0x2D,0}; // "-Latn;Latn-"
+
+// initial size for an Any-XXXX transform's cache of script-XXXX transforms
+// (will grow as necessary, but we don't expect to have source text with more than 7 scripts)
+#define ANY_TRANS_CACHE_INIT_SIZE 7
-// initial size for an Any-XXXX transform's cache of script-XXXX transforms
-// (will grow as necessary, but we don't expect to have source text with more than 7 scripts)
-#define ANY_TRANS_CACHE_INIT_SIZE 7
-
//------------------------------------------------------------
U_CDECL_BEGIN
@@ -190,7 +190,7 @@ AnyTransliterator::AnyTransliterator(const UnicodeString& id,
Transliterator(id, NULL),
targetScript(theTargetScript)
{
- cache = uhash_openSize(uhash_hashLong, uhash_compareLong, NULL, ANY_TRANS_CACHE_INIT_SIZE, &ec);
+ cache = uhash_openSize(uhash_hashLong, uhash_compareLong, NULL, ANY_TRANS_CACHE_INIT_SIZE, &ec);
if (U_FAILURE(ec)) {
return;
}
@@ -216,7 +216,7 @@ AnyTransliterator::AnyTransliterator(const AnyTransliterator& o) :
{
// Don't copy the cache contents
UErrorCode ec = U_ZERO_ERROR;
- cache = uhash_openSize(uhash_hashLong, uhash_compareLong, NULL, ANY_TRANS_CACHE_INIT_SIZE, &ec);
+ cache = uhash_openSize(uhash_hashLong, uhash_compareLong, NULL, ANY_TRANS_CACHE_INIT_SIZE, &ec);
if (U_FAILURE(ec)) {
return;
}
@@ -226,7 +226,7 @@ AnyTransliterator::AnyTransliterator(const AnyTransliterator& o) :
/**
* Transliterator API.
*/
-AnyTransliterator* AnyTransliterator::clone() const {
+AnyTransliterator* AnyTransliterator::clone() const {
return new AnyTransliterator(*this);
}
@@ -290,7 +290,7 @@ Transliterator* AnyTransliterator::getTransliterator(UScriptCode source) const {
}
if (t == NULL) {
UErrorCode ec = U_ZERO_ERROR;
- UnicodeString sourceName(uscript_getShortName(source), -1, US_INV);
+ UnicodeString sourceName(uscript_getShortName(source), -1, US_INV);
UnicodeString id(sourceName);
id.append(TARGET_SEP).append(target);
@@ -391,12 +391,12 @@ void AnyTransliterator::registerIDs() {
UnicodeString id;
TransliteratorIDParser::STVtoID(UnicodeString(TRUE, ANY, 3), target, variant, id);
ec = U_ZERO_ERROR;
- AnyTransliterator* tl = new AnyTransliterator(id, target, variant,
+ AnyTransliterator* tl = new AnyTransliterator(id, target, variant,
targetScript, ec);
if (U_FAILURE(ec)) {
- delete tl;
+ delete tl;
} else {
- Transliterator::_registerInstance(tl);
+ Transliterator::_registerInstance(tl);
Transliterator::_registerSpecialInverse(target, UnicodeString(TRUE, NULL_ID, 4), FALSE);
}
}
diff --git a/contrib/libs/icu/i18n/anytrans.h b/contrib/libs/icu/i18n/anytrans.h
index 162f06ea37..627dee3c81 100644
--- a/contrib/libs/icu/i18n/anytrans.h
+++ b/contrib/libs/icu/i18n/anytrans.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
***********************************************************************
@@ -66,7 +66,7 @@ public:
/**
* Transliterator API.
*/
- virtual AnyTransliterator* clone() const;
+ virtual AnyTransliterator* clone() const;
/**
* Implements {@link Transliterator#handleTransliterate}.
diff --git a/contrib/libs/icu/i18n/astro.cpp b/contrib/libs/icu/i18n/astro.cpp
index 3458b90741..f17b6db912 100644
--- a/contrib/libs/icu/i18n/astro.cpp
+++ b/contrib/libs/icu/i18n/astro.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/************************************************************************
* Copyright (C) 1996-2012, International Business Machines Corporation
@@ -65,7 +65,7 @@ static inline UBool isINVALID(double d) {
return(uprv_isNaN(d));
}
-static icu::UMutex ccLock;
+static icu::UMutex ccLock;
U_CDECL_BEGIN
static UBool calendar_astro_cleanup(void) {
diff --git a/contrib/libs/icu/i18n/astro.h b/contrib/libs/icu/i18n/astro.h
index 93a2fa6953..a246489005 100644
--- a/contrib/libs/icu/i18n/astro.h
+++ b/contrib/libs/icu/i18n/astro.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/************************************************************************
* Copyright (C) 1996-2008, International Business Machines Corporation *
diff --git a/contrib/libs/icu/i18n/basictz.cpp b/contrib/libs/icu/i18n/basictz.cpp
index 43ed52a5b4..54ee5a1a2b 100644
--- a/contrib/libs/icu/i18n/basictz.cpp
+++ b/contrib/libs/icu/i18n/basictz.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/bocsu.cpp b/contrib/libs/icu/i18n/bocsu.cpp
index efb7bcf57d..861a76a042 100644
--- a/contrib/libs/icu/i18n/bocsu.cpp
+++ b/contrib/libs/icu/i18n/bocsu.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: bocsu.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/i18n/bocsu.h b/contrib/libs/icu/i18n/bocsu.h
index f7a552a0d7..631e29aa76 100644
--- a/contrib/libs/icu/i18n/bocsu.h
+++ b/contrib/libs/icu/i18n/bocsu.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: bocsu.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -144,14 +144,14 @@ U_NAMESPACE_END
* yields negative modulo results and quotients that are one more than
* what we need here.
*/
-#define NEGDIVMOD(n, d, m) UPRV_BLOCK_MACRO_BEGIN { \
+#define NEGDIVMOD(n, d, m) UPRV_BLOCK_MACRO_BEGIN { \
(m)=(n)%(d); \
(n)/=(d); \
if((m)<0) { \
--(n); \
(m)+=(d); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
U_CFUNC UChar32
u_writeIdenticalLevelRun(UChar32 prev, const UChar *s, int32_t length, icu::ByteSink &sink);
diff --git a/contrib/libs/icu/i18n/brktrans.cpp b/contrib/libs/icu/i18n/brktrans.cpp
index d6b10c4778..46b0e345da 100644
--- a/contrib/libs/icu/i18n/brktrans.cpp
+++ b/contrib/libs/icu/i18n/brktrans.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -10,8 +10,8 @@
**********************************************************************
*/
-#include <utility>
-
+#include <utility>
+
#include "unicode/utypes.h"
#if !UCONFIG_NO_TRANSLITERATION && !UCONFIG_NO_BREAK_ITERATION
@@ -64,7 +64,7 @@ BreakTransliterator::BreakTransliterator(const BreakTransliterator& o) :
/**
* Transliterator API.
*/
-BreakTransliterator* BreakTransliterator::clone() const {
+BreakTransliterator* BreakTransliterator::clone() const {
return new BreakTransliterator(*this);
}
@@ -81,8 +81,8 @@ void BreakTransliterator::handleTransliterate(Replaceable& text, UTransPosition&
{
Mutex m;
BreakTransliterator *nonConstThis = const_cast<BreakTransliterator *>(this);
- boundaries = std::move(nonConstThis->cachedBoundaries);
- bi = std::move(nonConstThis->cachedBI);
+ boundaries = std::move(nonConstThis->cachedBoundaries);
+ bi = std::move(nonConstThis->cachedBI);
}
if (bi.isNull()) {
bi.adoptInstead(BreakIterator::createWordInstance(Locale::getEnglish(), status));
@@ -147,10 +147,10 @@ void BreakTransliterator::handleTransliterate(Replaceable& text, UTransPosition&
Mutex m;
BreakTransliterator *nonConstThis = const_cast<BreakTransliterator *>(this);
if (nonConstThis->cachedBI.isNull()) {
- nonConstThis->cachedBI = std::move(bi);
+ nonConstThis->cachedBI = std::move(bi);
}
if (nonConstThis->cachedBoundaries.isNull()) {
- nonConstThis->cachedBoundaries = std::move(boundaries);
+ nonConstThis->cachedBoundaries = std::move(boundaries);
}
}
diff --git a/contrib/libs/icu/i18n/brktrans.h b/contrib/libs/icu/i18n/brktrans.h
index c129761d28..cb3def9e92 100644
--- a/contrib/libs/icu/i18n/brktrans.h
+++ b/contrib/libs/icu/i18n/brktrans.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -54,7 +54,7 @@ public:
* Transliterator API.
* @return A copy of the object.
*/
- virtual BreakTransliterator* clone() const;
+ virtual BreakTransliterator* clone() const;
virtual const UnicodeString &getInsertion() const;
diff --git a/contrib/libs/icu/i18n/buddhcal.cpp b/contrib/libs/icu/i18n/buddhcal.cpp
index df3b3112e9..6083349ecd 100644
--- a/contrib/libs/icu/i18n/buddhcal.cpp
+++ b/contrib/libs/icu/i18n/buddhcal.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -53,7 +53,7 @@ BuddhistCalendar& BuddhistCalendar::operator= ( const BuddhistCalendar& right)
return *this;
}
-BuddhistCalendar* BuddhistCalendar::clone() const
+BuddhistCalendar* BuddhistCalendar::clone() const
{
return new BuddhistCalendar(*this);
}
@@ -133,7 +133,7 @@ void BuddhistCalendar::timeToFields(UDate theTime, UBool quick, UErrorCode& stat
*/
static UDate gSystemDefaultCenturyStart = DBL_MIN;
static int32_t gSystemDefaultCenturyStartYear = -1;
-static icu::UInitOnce gBCInitOnce = U_INITONCE_INITIALIZER;
+static icu::UInitOnce gBCInitOnce = U_INITONCE_INITIALIZER;
UBool BuddhistCalendar::haveDefaultCentury() const
diff --git a/contrib/libs/icu/i18n/buddhcal.h b/contrib/libs/icu/i18n/buddhcal.h
index 6e95e75924..0ad0886df1 100644
--- a/contrib/libs/icu/i18n/buddhcal.h
+++ b/contrib/libs/icu/i18n/buddhcal.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -94,7 +94,7 @@ public:
* @return return a polymorphic copy of this calendar.
* @internal
*/
- virtual BuddhistCalendar* clone() const;
+ virtual BuddhistCalendar* clone() const;
public:
/**
diff --git a/contrib/libs/icu/i18n/calendar.cpp b/contrib/libs/icu/i18n/calendar.cpp
index bc299aa4c8..981f09c574 100644
--- a/contrib/libs/icu/i18n/calendar.cpp
+++ b/contrib/libs/icu/i18n/calendar.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,12 +8,12 @@
*
* File CALENDAR.CPP
*
-* Modification History:
+* Modification History:
*
* Date Name Description
* 02/03/97 clhuang Creation.
-* 04/22/97 aliu Cleaned up, fixed memory leak, made
-* setWeekCountData() more robust.
+* 04/22/97 aliu Cleaned up, fixed memory leak, made
+* setWeekCountData() more robust.
* Moved platform code to TPlatformUtilities.
* 05/01/97 aliu Made equals(), before(), after() arguments const.
* 05/20/97 aliu Changed logic of when to compute fields and time
@@ -26,7 +26,7 @@
*******************************************************************************
*/
-#include "utypeinfo.h" // for 'typeid' to work
+#include "utypeinfo.h" // for 'typeid' to work
#include "unicode/utypes.h"
@@ -80,7 +80,7 @@ static UBool calendar_cleanup(void) {
return TRUE;
}
U_CDECL_END
-#endif
+#endif
// ------------------------------------------
//
@@ -92,9 +92,9 @@ U_CDECL_END
#if defined( U_DEBUG_CALSVC ) || defined (U_DEBUG_CAL)
-/**
- * fldName was removed as a duplicate implementation.
- * use udbg_ services instead,
+/**
+ * fldName was removed as a duplicate implementation.
+ * use udbg_ services instead,
* which depend on include files and library from ../tools/toolutil, the following circular link:
* CPPFLAGS+=-I$(top_srcdir)/tools/toolutil
* LIBS+=$(LIBICUTOOLUTIL)
@@ -122,7 +122,7 @@ void ucal_dump(const Calendar &cal) {
void Calendar::dump() const {
int i;
fprintf(stderr, "@calendar=%s, timeset=%c, fieldset=%c, allfields=%c, virtualset=%c, t=%.2f",
- getType(), fIsTimeSet?'y':'n', fAreFieldsSet?'y':'n', fAreAllFieldsSet?'y':'n',
+ getType(), fIsTimeSet?'y':'n', fAreFieldsSet?'y':'n', fAreAllFieldsSet?'y':'n',
fAreFieldsVirtuallySet?'y':'n',
fTime);
@@ -134,9 +134,9 @@ void Calendar::dump() const {
fprintf(stderr, " %25s: %-11ld", f, fFields[i]);
if(fStamp[i] == kUnset) {
fprintf(stderr, " (unset) ");
- } else if(fStamp[i] == kInternallySet) {
+ } else if(fStamp[i] == kInternallySet) {
fprintf(stderr, " (internally set) ");
- //} else if(fStamp[i] == kInternalDefault) {
+ //} else if(fStamp[i] == kInternalDefault) {
// fprintf(stderr, " (internal default) ");
} else {
fprintf(stderr, " %%%d ", fStamp[i]);
@@ -212,7 +212,7 @@ const SharedCalendar *LocaleCacheKey<SharedCalendar>::createObject(
const void * /*unusedCreationContext*/, UErrorCode &status) const {
Calendar *calendar = Calendar::makeInstance(fLoc, status);
if (U_FAILURE(status)) {
- return NULL;
+ return NULL;
}
SharedCalendar *shared = new SharedCalendar(calendar);
if (shared == NULL) {
@@ -233,9 +233,9 @@ static ECalType getCalendarType(const char *s) {
return CALTYPE_UNKNOWN;
}
-#if !UCONFIG_NO_SERVICE
-// Only used with service registration.
-static UBool isStandardSupportedKeyword(const char *keyword, UErrorCode& status) {
+#if !UCONFIG_NO_SERVICE
+// Only used with service registration.
+static UBool isStandardSupportedKeyword(const char *keyword, UErrorCode& status) {
if(U_FAILURE(status)) {
return FALSE;
}
@@ -243,7 +243,7 @@ static UBool isStandardSupportedKeyword(const char *keyword, UErrorCode& status)
return (calType != CALTYPE_UNKNOWN);
}
-// only used with service registration.
+// only used with service registration.
static void getCalendarKeyword(const UnicodeString &id, char *targetBuffer, int32_t targetBufferSize) {
UnicodeString calendarKeyword = UNICODE_STRING_SIMPLE("calendar=");
int32_t calKeyLen = calendarKeyword.length();
@@ -257,7 +257,7 @@ static void getCalendarKeyword(const UnicodeString &id, char *targetBuffer, int3
}
targetBuffer[keyLen] = 0;
}
-#endif
+#endif
static ECalType getCalendarTypeForLocale(const char *locid) {
UErrorCode status = U_ZERO_ERROR;
@@ -268,8 +268,8 @@ static ECalType getCalendarTypeForLocale(const char *locid) {
// canonicalize, so grandfathered variant will be transformed to keywords
// e.g ja_JP_TRADITIONAL -> ja_JP@calendar=japanese
- // NOTE: Since ICU-20187, ja_JP_TRADITIONAL no longer canonicalizes, and
- // the Gregorian calendar is returned instead.
+ // NOTE: Since ICU-20187, ja_JP_TRADITIONAL no longer canonicalizes, and
+ // the Gregorian calendar is returned instead.
int32_t canonicalLen = uloc_canonicalize(locid, canonicalName, sizeof(canonicalName) - 1, &status);
if (U_FAILURE(status)) {
return CALTYPE_GREGORIAN;
@@ -296,7 +296,7 @@ static ECalType getCalendarTypeForLocale(const char *locid) {
if (U_FAILURE(status)) {
return CALTYPE_GREGORIAN;
}
-
+
// Read preferred calendar values from supplementalData calendarPreference
UResourceBundle *rb = ures_openDirect(NULL, "supplementalData", &status);
ures_getByKey(rb, "calendarPreferenceData", rb, &status);
@@ -329,73 +329,73 @@ static ECalType getCalendarTypeForLocale(const char *locid) {
}
static Calendar *createStandardCalendar(ECalType calType, const Locale &loc, UErrorCode& status) {
- if (U_FAILURE(status)) {
- return nullptr;
- }
- LocalPointer<Calendar> cal;
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ LocalPointer<Calendar> cal;
switch (calType) {
case CALTYPE_GREGORIAN:
- cal.adoptInsteadAndCheckErrorCode(new GregorianCalendar(loc, status), status);
+ cal.adoptInsteadAndCheckErrorCode(new GregorianCalendar(loc, status), status);
break;
case CALTYPE_JAPANESE:
- cal.adoptInsteadAndCheckErrorCode(new JapaneseCalendar(loc, status), status);
+ cal.adoptInsteadAndCheckErrorCode(new JapaneseCalendar(loc, status), status);
break;
case CALTYPE_BUDDHIST:
- cal.adoptInsteadAndCheckErrorCode(new BuddhistCalendar(loc, status), status);
+ cal.adoptInsteadAndCheckErrorCode(new BuddhistCalendar(loc, status), status);
break;
case CALTYPE_ROC:
- cal.adoptInsteadAndCheckErrorCode(new TaiwanCalendar(loc, status), status);
+ cal.adoptInsteadAndCheckErrorCode(new TaiwanCalendar(loc, status), status);
break;
case CALTYPE_PERSIAN:
- cal.adoptInsteadAndCheckErrorCode(new PersianCalendar(loc, status), status);
+ cal.adoptInsteadAndCheckErrorCode(new PersianCalendar(loc, status), status);
break;
case CALTYPE_ISLAMIC_TBLA:
- cal.adoptInsteadAndCheckErrorCode(new IslamicCalendar(loc, status, IslamicCalendar::TBLA), status);
+ cal.adoptInsteadAndCheckErrorCode(new IslamicCalendar(loc, status, IslamicCalendar::TBLA), status);
break;
case CALTYPE_ISLAMIC_CIVIL:
- cal.adoptInsteadAndCheckErrorCode(new IslamicCalendar(loc, status, IslamicCalendar::CIVIL), status);
+ cal.adoptInsteadAndCheckErrorCode(new IslamicCalendar(loc, status, IslamicCalendar::CIVIL), status);
break;
case CALTYPE_ISLAMIC_RGSA:
// default any region specific not handled individually to islamic
case CALTYPE_ISLAMIC:
- cal.adoptInsteadAndCheckErrorCode(new IslamicCalendar(loc, status, IslamicCalendar::ASTRONOMICAL), status);
+ cal.adoptInsteadAndCheckErrorCode(new IslamicCalendar(loc, status, IslamicCalendar::ASTRONOMICAL), status);
break;
case CALTYPE_ISLAMIC_UMALQURA:
- cal.adoptInsteadAndCheckErrorCode(new IslamicCalendar(loc, status, IslamicCalendar::UMALQURA), status);
+ cal.adoptInsteadAndCheckErrorCode(new IslamicCalendar(loc, status, IslamicCalendar::UMALQURA), status);
break;
case CALTYPE_HEBREW:
- cal.adoptInsteadAndCheckErrorCode(new HebrewCalendar(loc, status), status);
+ cal.adoptInsteadAndCheckErrorCode(new HebrewCalendar(loc, status), status);
break;
case CALTYPE_CHINESE:
- cal.adoptInsteadAndCheckErrorCode(new ChineseCalendar(loc, status), status);
+ cal.adoptInsteadAndCheckErrorCode(new ChineseCalendar(loc, status), status);
break;
case CALTYPE_INDIAN:
- cal.adoptInsteadAndCheckErrorCode(new IndianCalendar(loc, status), status);
+ cal.adoptInsteadAndCheckErrorCode(new IndianCalendar(loc, status), status);
break;
case CALTYPE_COPTIC:
- cal.adoptInsteadAndCheckErrorCode(new CopticCalendar(loc, status), status);
+ cal.adoptInsteadAndCheckErrorCode(new CopticCalendar(loc, status), status);
break;
case CALTYPE_ETHIOPIC:
- cal.adoptInsteadAndCheckErrorCode(new EthiopicCalendar(loc, status, EthiopicCalendar::AMETE_MIHRET_ERA), status);
+ cal.adoptInsteadAndCheckErrorCode(new EthiopicCalendar(loc, status, EthiopicCalendar::AMETE_MIHRET_ERA), status);
break;
case CALTYPE_ETHIOPIC_AMETE_ALEM:
- cal.adoptInsteadAndCheckErrorCode(new EthiopicCalendar(loc, status, EthiopicCalendar::AMETE_ALEM_ERA), status);
+ cal.adoptInsteadAndCheckErrorCode(new EthiopicCalendar(loc, status, EthiopicCalendar::AMETE_ALEM_ERA), status);
break;
case CALTYPE_ISO8601:
- cal.adoptInsteadAndCheckErrorCode(new GregorianCalendar(loc, status), status);
- if (cal.isValid()) {
- cal->setFirstDayOfWeek(UCAL_MONDAY);
- cal->setMinimalDaysInFirstWeek(4);
- }
+ cal.adoptInsteadAndCheckErrorCode(new GregorianCalendar(loc, status), status);
+ if (cal.isValid()) {
+ cal->setFirstDayOfWeek(UCAL_MONDAY);
+ cal->setMinimalDaysInFirstWeek(4);
+ }
break;
case CALTYPE_DANGI:
- cal.adoptInsteadAndCheckErrorCode(new DangiCalendar(loc, status), status);
+ cal.adoptInsteadAndCheckErrorCode(new DangiCalendar(loc, status), status);
break;
default:
status = U_UNSUPPORTED_ERROR;
}
- return cal.orphan();
+ return cal.orphan();
}
@@ -404,7 +404,7 @@ static Calendar *createStandardCalendar(ECalType calType, const Locale &loc, UEr
// -------------------------------------
/**
-* a Calendar Factory which creates the "basic" calendar types, that is, those
+* a Calendar Factory which creates the "basic" calendar types, that is, those
* shipped with ICU.
*/
class BasicCalendarFactory : public LocaleKeyFactory {
@@ -418,7 +418,7 @@ public:
virtual ~BasicCalendarFactory();
protected:
- //virtual UBool isSupportedID( const UnicodeString& id, UErrorCode& status) const {
+ //virtual UBool isSupportedID( const UnicodeString& id, UErrorCode& status) const {
// if(U_FAILURE(status)) {
// return FALSE;
// }
@@ -476,7 +476,7 @@ protected:
BasicCalendarFactory::~BasicCalendarFactory() {}
-/**
+/**
* A factory which looks up the DefaultCalendar resource to determine which class of calendar to use
*/
@@ -520,7 +520,7 @@ public:
virtual UObject* cloneInstance(UObject* instance) const {
UnicodeString *s = dynamic_cast<UnicodeString *>(instance);
if(s != NULL) {
- return s->clone();
+ return s->clone();
} else {
#ifdef U_DEBUG_CALSVC_F
UErrorCode status2 = U_ZERO_ERROR;
@@ -543,10 +543,10 @@ public:
fprintf(stderr, "CalSvc:handleDefault for currentLoc %s, canloc %s\n", (const char*)loc.getName(), (const char*)loc2.getName());
#endif
Calendar *nc = new GregorianCalendar(loc, status);
- if (nc == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return nc;
- }
+ if (nc == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return nc;
+ }
#ifdef U_DEBUG_CALSVC
UErrorCode status2 = U_ZERO_ERROR;
@@ -587,7 +587,7 @@ initCalendarService(UErrorCode &status)
fprintf(stderr, "Registering classes..\n");
#endif
- // Register all basic instances.
+ // Register all basic instances.
gService->registerFactory(new BasicCalendarFactory(),status);
#ifdef U_DEBUG_CALSVC
@@ -603,7 +603,7 @@ initCalendarService(UErrorCode &status)
}
}
-static ICULocaleService*
+static ICULocaleService*
getCalendarService(UErrorCode &status)
{
umtx_initOnce(gServiceInitOnce, &initCalendarService, status);
@@ -719,8 +719,8 @@ fZone(NULL),
fRepeatedWallTime(UCAL_WALLTIME_LAST),
fSkippedWallTime(UCAL_WALLTIME_LAST)
{
- validLocale[0] = 0;
- actualLocale[0] = 0;
+ validLocale[0] = 0;
+ actualLocale[0] = 0;
clear();
if (U_FAILURE(success)) {
return;
@@ -747,10 +747,10 @@ fZone(NULL),
fRepeatedWallTime(UCAL_WALLTIME_LAST),
fSkippedWallTime(UCAL_WALLTIME_LAST)
{
- validLocale[0] = 0;
- actualLocale[0] = 0;
+ validLocale[0] = 0;
+ actualLocale[0] = 0;
if (U_FAILURE(success)) {
- delete zone;
+ delete zone;
return;
}
if(zone == 0) {
@@ -762,7 +762,7 @@ fSkippedWallTime(UCAL_WALLTIME_LAST)
return;
}
- clear();
+ clear();
fZone = zone;
setWeekData(aLocale, NULL, success);
}
@@ -782,8 +782,8 @@ fZone(NULL),
fRepeatedWallTime(UCAL_WALLTIME_LAST),
fSkippedWallTime(UCAL_WALLTIME_LAST)
{
- validLocale[0] = 0;
- actualLocale[0] = 0;
+ validLocale[0] = 0;
+ actualLocale[0] = 0;
if (U_FAILURE(success)) {
return;
}
@@ -840,10 +840,10 @@ Calendar::operator=(const Calendar &right)
fWeekendCease = right.fWeekendCease;
fWeekendCeaseMillis = right.fWeekendCeaseMillis;
fNextStamp = right.fNextStamp;
- uprv_strncpy(validLocale, right.validLocale, sizeof(validLocale));
- uprv_strncpy(actualLocale, right.actualLocale, sizeof(actualLocale));
- validLocale[sizeof(validLocale)-1] = 0;
- actualLocale[sizeof(validLocale)-1] = 0;
+ uprv_strncpy(validLocale, right.validLocale, sizeof(validLocale));
+ uprv_strncpy(actualLocale, right.actualLocale, sizeof(actualLocale));
+ validLocale[sizeof(validLocale)-1] = 0;
+ actualLocale[sizeof(validLocale)-1] = 0;
}
return *this;
@@ -873,7 +873,7 @@ Calendar::createInstance(const Locale& aLocale, UErrorCode& success)
return createInstance(TimeZone::createDefault(), aLocale, success);
}
-// ------------------------------------- Adopting
+// ------------------------------------- Adopting
// Note: this is the bottleneck that actually calls the service routines.
@@ -926,7 +926,7 @@ Calendar::makeInstance(const Locale& aLocale, UErrorCode& success) {
c = (Calendar*)getCalendarService(success)->get(l, LocaleKey::KIND_ANY, &actualLoc2, success);
if(U_FAILURE(success) || !c) {
- if(U_SUCCESS(success)) {
+ if(U_SUCCESS(success)) {
success = U_INTERNAL_PROGRAM_ERROR; // Propagate some err
}
return NULL;
@@ -934,7 +934,7 @@ Calendar::makeInstance(const Locale& aLocale, UErrorCode& success) {
str = dynamic_cast<const UnicodeString*>(c);
if(str != NULL) {
- // recursed! Second lookup returned a UnicodeString.
+ // recursed! Second lookup returned a UnicodeString.
// Perhaps DefaultCalendar{} was set to another locale.
#ifdef U_DEBUG_CALSVC
char tmp[200];
@@ -958,7 +958,7 @@ Calendar::makeInstance(const Locale& aLocale, UErrorCode& success) {
#endif
c->setWeekData(aLocale, c->getType(), success); // set the correct locale (this was an indirected calendar)
- char keyword[ULOC_FULLNAME_CAPACITY] = "";
+ char keyword[ULOC_FULLNAME_CAPACITY] = "";
UErrorCode tmpStatus = U_ZERO_ERROR;
l.getKeywordValue("calendar", keyword, ULOC_FULLNAME_CAPACITY, tmpStatus);
if (U_SUCCESS(tmpStatus) && uprv_strcmp(keyword, "iso8601") == 0) {
@@ -1008,7 +1008,7 @@ Calendar::createInstance(const TimeZone& zone, const Locale& aLocale, UErrorCode
if(U_SUCCESS(success) && c) {
c->setTimeZone(zone);
}
- return c;
+ return c;
}
// -------------------------------------
@@ -1040,7 +1040,7 @@ Calendar::operator==(const Calendar& that) const
U_SUCCESS(status);
}
-UBool
+UBool
Calendar::isEquivalentTo(const Calendar& other) const
{
return typeid(*this) == typeid(other) &&
@@ -1105,11 +1105,11 @@ Calendar::getKeywordValuesForLocale(const char* key,
uenum_close(uenum);
return NULL;
}
- UStringEnumeration* ustringenum = new UStringEnumeration(uenum);
- if (ustringenum == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
- return ustringenum;
+ UStringEnumeration* ustringenum = new UStringEnumeration(uenum);
+ if (ustringenum == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
+ return ustringenum;
}
// -------------------------------------
@@ -1126,13 +1126,13 @@ Calendar::getNow()
* Gets this Calendar's current time as a long.
* @return the current time as UTC milliseconds from the epoch.
*/
-double
+double
Calendar::getTimeInMillis(UErrorCode& status) const
{
- if(U_FAILURE(status))
+ if(U_FAILURE(status))
return 0.0;
- if ( ! fIsTimeSet)
+ if ( ! fIsTimeSet)
((Calendar*)this)->updateTime(status);
/* Test for buffer overflows */
@@ -1151,9 +1151,9 @@ Calendar::getTimeInMillis(UErrorCode& status) const
* when in lenient mode the out of range values are pinned to their respective min/max.
* @param date the new time in UTC milliseconds from the epoch.
*/
-void
+void
Calendar::setTimeInMillis( double millis, UErrorCode& status ) {
- if(U_FAILURE(status))
+ if(U_FAILURE(status))
return;
if (millis > MAX_MILLIS) {
@@ -1182,7 +1182,7 @@ Calendar::setTimeInMillis( double millis, UErrorCode& status ) {
fIsSet[i] = FALSE;
}
-
+
}
// -------------------------------------
@@ -1506,7 +1506,7 @@ void Calendar::computeFields(UErrorCode &ec)
double localMillis = internalGetTime();
int32_t rawOffset, dstOffset;
getTimeZone().getOffset(localMillis, FALSE, rawOffset, dstOffset, ec);
- localMillis += (rawOffset + dstOffset);
+ localMillis += (rawOffset + dstOffset);
// Mark fields as set. Do this before calling handleComputeFields().
uint32_t mask = //fInternalSetMask;
@@ -1515,7 +1515,7 @@ void Calendar::computeFields(UErrorCode &ec)
(1 << UCAL_MONTH) |
(1 << UCAL_DAY_OF_MONTH) | // = UCAL_DATE
(1 << UCAL_DAY_OF_YEAR) |
- (1 << UCAL_EXTENDED_YEAR);
+ (1 << UCAL_EXTENDED_YEAR);
for (int32_t i=0; i<UCAL_FIELD_COUNT; ++i) {
if ((mask & 1) == 0) {
@@ -1544,7 +1544,7 @@ void Calendar::computeFields(UErrorCode &ec)
#if defined (U_DEBUG_CAL)
//fprintf(stderr, "%s:%d- Hmm! Jules @ %d, as per %.0lf millis\n",
//__FILE__, __LINE__, fFields[UCAL_JULIAN_DAY], localMillis);
-#endif
+#endif
computeGregorianAndDOWFields(fFields[UCAL_JULIAN_DAY], ec);
@@ -1642,7 +1642,7 @@ void Calendar::computeGregorianFields(int32_t julianDay, UErrorCode & /* ec */)
* proleptic Gregorian calendar, which has no field larger than a year.
*/
void Calendar::computeWeekFields(UErrorCode &ec) {
- if(U_FAILURE(ec)) {
+ if(U_FAILURE(ec)) {
return;
}
int32_t eyear = fFields[UCAL_EXTENDED_YEAR];
@@ -1705,7 +1705,7 @@ void Calendar::computeWeekFields(UErrorCode &ec) {
fFields[UCAL_WEEK_OF_MONTH] = weekNumber(dayOfMonth, dayOfWeek);
fFields[UCAL_DAY_OF_WEEK_IN_MONTH] = (dayOfMonth-1) / 7 + 1;
#if defined (U_DEBUG_CAL)
- if(fFields[UCAL_DAY_OF_WEEK_IN_MONTH]==0) fprintf(stderr, "%s:%d: DOWIM %d on %g\n",
+ if(fFields[UCAL_DAY_OF_WEEK_IN_MONTH]==0) fprintf(stderr, "%s:%d: DOWIM %d on %g\n",
__FILE__, __LINE__,fFields[UCAL_DAY_OF_WEEK_IN_MONTH], fTime);
#endif
}
@@ -1750,7 +1750,7 @@ void Calendar::handleComputeFields(int32_t /* julianDay */, UErrorCode &/* statu
// -------------------------------------
-void Calendar::roll(EDateFields field, int32_t amount, UErrorCode& status)
+void Calendar::roll(EDateFields field, int32_t amount, UErrorCode& status)
{
roll((UCalendarDateFields)field, amount, status);
}
@@ -2088,7 +2088,7 @@ void Calendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& statu
default:
// Other fields cannot be rolled by this method
#if defined (U_DEBUG_CAL)
- fprintf(stderr, "%s:%d: ILLEGAL ARG because of roll on non-rollable field %s\n",
+ fprintf(stderr, "%s:%d: ILLEGAL ARG because of roll on non-rollable field %s\n",
__FILE__, __LINE__,fldName(field));
#endif
status = U_ILLEGAL_ARGUMENT_ERROR;
@@ -2279,7 +2279,7 @@ void Calendar::add(UCalendarDateFields field, int32_t amount, UErrorCode& status
}
}
}
- }
+ }
}
// -------------------------------------
@@ -2595,7 +2595,7 @@ Calendar::isWeekend(UDate date, UErrorCode &status) const
return FALSE;
}
// clone the calendar so we don't mess with the real one.
- Calendar *work = this->clone();
+ Calendar *work = this->clone();
if (work == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return FALSE;
@@ -2644,7 +2644,7 @@ Calendar::isWeekend(void) const
// ------------------------------------- limits
-int32_t
+int32_t
Calendar::getMinimum(EDateFields field) const {
return getLimit((UCalendarDateFields) field,UCAL_LIMIT_MINIMUM);
}
@@ -2695,7 +2695,7 @@ Calendar::getLeastMaximum(UCalendarDateFields field) const
}
// -------------------------------------
-int32_t
+int32_t
Calendar::getActualMinimum(EDateFields field, UErrorCode& status) const
{
return getActualMinimum((UCalendarDateFields) field, status);
@@ -2755,7 +2755,7 @@ Calendar::getActualMinimum(UCalendarDateFields field, UErrorCode& status) const
// clone the calendar so we don't mess with the real one, and set it to
// accept anything for the field values
- Calendar *work = this->clone();
+ Calendar *work = this->clone();
if (work == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return 0;
@@ -2771,7 +2771,7 @@ Calendar::getActualMinimum(UCalendarDateFields field, UErrorCode& status) const
work->set(field, fieldValue);
if (work->get(field, status) != fieldValue) {
break;
- }
+ }
else {
result = fieldValue;
fieldValue--;
@@ -2827,7 +2827,7 @@ void Calendar::validateField(UCalendarDateFields field, UErrorCode &status) {
case UCAL_DAY_OF_WEEK_IN_MONTH:
if (internalGet(field) == 0) {
#if defined (U_DEBUG_CAL)
- fprintf(stderr, "%s:%d: ILLEGAL ARG because DOW in month cannot be 0\n",
+ fprintf(stderr, "%s:%d: ILLEGAL ARG because DOW in month cannot be 0\n",
__FILE__, __LINE__);
#endif
status = U_ILLEGAL_ARGUMENT_ERROR; // "DAY_OF_WEEK_IN_MONTH cannot be zero"
@@ -2853,7 +2853,7 @@ void Calendar::validateField(UCalendarDateFields field, int32_t min, int32_t max
int32_t value = fFields[field];
if (value < min || value > max) {
#if defined (U_DEBUG_CAL)
- fprintf(stderr, "%s:%d: ILLEGAL ARG because of field %s out of range %d..%d at %d\n",
+ fprintf(stderr, "%s:%d: ILLEGAL ARG because of field %s out of range %d..%d at %d\n",
__FILE__, __LINE__,fldName(field),min,max,value);
#endif
status = U_ILLEGAL_ARGUMENT_ERROR;
@@ -2919,7 +2919,7 @@ linesInGroup:
}
const UFieldResolutionTable Calendar::kDatePrecedence[] =
-{
+{
{
{ UCAL_DAY_OF_MONTH, kResolveSTOP },
{ UCAL_WEEK_OF_YEAR, UCAL_DAY_OF_WEEK, kResolveSTOP },
@@ -2940,12 +2940,12 @@ const UFieldResolutionTable Calendar::kDatePrecedence[] =
{ kResolveRemap | UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_DAY_OF_WEEK, kResolveSTOP },
{ kResolveRemap | UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_DOW_LOCAL, kResolveSTOP },
{ kResolveSTOP }
- },
+ },
{{kResolveSTOP}}
};
-const UFieldResolutionTable Calendar::kDOWPrecedence[] =
+const UFieldResolutionTable Calendar::kDOWPrecedence[] =
{
{
{ UCAL_DAY_OF_WEEK,kResolveSTOP, kResolveSTOP },
@@ -2956,7 +2956,7 @@ const UFieldResolutionTable Calendar::kDOWPrecedence[] =
};
// precedence for calculating a year
-const UFieldResolutionTable Calendar::kYearPrecedence[] =
+const UFieldResolutionTable Calendar::kYearPrecedence[] =
{
{
{ UCAL_YEAR, kResolveSTOP },
@@ -2993,7 +2993,7 @@ void Calendar::computeTime(UErrorCode& status) {
// }
#endif
- double millisInDay;
+ double millisInDay;
// We only use MILLISECONDS_IN_DAY if it has been set by the user.
// This makes it possible for the caller to set the calendar to a
@@ -3113,10 +3113,10 @@ UBool Calendar::getImmediatePreviousZoneTransition(UDate base, UDate *transition
* reflects local zone wall time.
* @stable ICU 2.0
*/
-double Calendar::computeMillisInDay() {
+double Calendar::computeMillisInDay() {
// Do the time portion of the conversion.
- double millisInDay = 0;
+ double millisInDay = 0;
// Find the best set of fields specifying the time of day. There
// are only two possibilities here; the HOUR_OF_DAY or the
@@ -3158,7 +3158,7 @@ double Calendar::computeMillisInDay() {
* or range.
* @stable ICU 2.0
*/
-int32_t Calendar::computeZoneOffset(double millis, double millisInDay, UErrorCode &ec) {
+int32_t Calendar::computeZoneOffset(double millis, double millisInDay, UErrorCode &ec) {
int32_t rawOffset, dstOffset;
UDate wall = millis + millisInDay;
BasicTimeZone* btz = getBasicTimeZone();
@@ -3205,7 +3205,7 @@ int32_t Calendar::computeZoneOffset(double millis, double millisInDay, UErrorCod
return rawOffset + dstOffset;
}
-int32_t Calendar::computeJulianDay()
+int32_t Calendar::computeJulianDay()
{
// We want to see if any of the date fields is newer than the
// JULIAN_DAY. If not, then we use JULIAN_DAY. If so, then we do
@@ -3239,17 +3239,17 @@ int32_t Calendar::handleComputeJulianDay(UCalendarDateFields bestField) {
bestField == UCAL_DAY_OF_WEEK_IN_MONTH);
int32_t year;
- if (bestField == UCAL_WEEK_OF_YEAR && newerField(UCAL_YEAR_WOY, UCAL_YEAR) == UCAL_YEAR_WOY) {
- year = internalGet(UCAL_YEAR_WOY);
+ if (bestField == UCAL_WEEK_OF_YEAR && newerField(UCAL_YEAR_WOY, UCAL_YEAR) == UCAL_YEAR_WOY) {
+ year = internalGet(UCAL_YEAR_WOY);
} else {
year = handleGetExtendedYear();
}
- internalSet(UCAL_EXTENDED_YEAR, year);
-
-#if defined (U_DEBUG_CAL)
+ internalSet(UCAL_EXTENDED_YEAR, year);
+
+#if defined (U_DEBUG_CAL)
fprintf(stderr, "%s:%d: bestField= %s - y=%d\n", __FILE__, __LINE__, fldName(bestField), year);
-#endif
+#endif
// Get the Julian day of the day BEFORE the start of this year.
// If useMonth is true, get the day before the start of the month.
@@ -3331,9 +3331,9 @@ int32_t Calendar::handleComputeJulianDay(UCalendarDateFields bestField) {
date += ((monthLength - date) / 7 + dim + 1) * 7;
}
} else {
-#if defined (U_DEBUG_CAL)
+#if defined (U_DEBUG_CAL)
fprintf(stderr, "%s:%d - bf= %s\n", __FILE__, __LINE__, fldName(bestField));
-#endif
+#endif
if(bestField == UCAL_WEEK_OF_YEAR) { // ------------------------------------- WOY -------------
if(!isSet(UCAL_YEAR_WOY) || // YWOY not set at all or
@@ -3344,30 +3344,30 @@ int32_t Calendar::handleComputeJulianDay(UCalendarDateFields bestField) {
int32_t woy = internalGet(bestField);
int32_t nextJulianDay = handleComputeMonthStart(year+1, 0, FALSE); // jd of day before jan 1
- int32_t nextFirst = julianDayToDayOfWeek(nextJulianDay + 1) - firstDayOfWeek;
+ int32_t nextFirst = julianDayToDayOfWeek(nextJulianDay + 1) - firstDayOfWeek;
if (nextFirst < 0) { // 0..6 ldow of Jan 1
nextFirst += 7;
}
if(woy==1) { // FIRST WEEK ---------------------------------
-#if defined (U_DEBUG_CAL)
- fprintf(stderr, "%s:%d - woy=%d, yp=%d, nj(%d)=%d, nf=%d", __FILE__, __LINE__,
- internalGet(bestField), resolveFields(kYearPrecedence), year+1,
+#if defined (U_DEBUG_CAL)
+ fprintf(stderr, "%s:%d - woy=%d, yp=%d, nj(%d)=%d, nf=%d", __FILE__, __LINE__,
+ internalGet(bestField), resolveFields(kYearPrecedence), year+1,
nextJulianDay, nextFirst);
fprintf(stderr, " next: %d DFW, min=%d \n", (7-nextFirst), getMinimalDaysInFirstWeek() );
-#endif
+#endif
// nextFirst is now the localized DOW of Jan 1 of y-woy+1
if((nextFirst > 0) && // Jan 1 starts on FDOW
(7-nextFirst) >= getMinimalDaysInFirstWeek()) // or enough days in the week
{
// Jan 1 of (yearWoy+1) is in yearWoy+1 - recalculate JD to next year
-#if defined (U_DEBUG_CAL)
- fprintf(stderr, "%s:%d - was going to move JD from %d to %d [d%d]\n", __FILE__, __LINE__,
+#if defined (U_DEBUG_CAL)
+ fprintf(stderr, "%s:%d - was going to move JD from %d to %d [d%d]\n", __FILE__, __LINE__,
julianDay, nextJulianDay, (nextJulianDay-julianDay));
-#endif
+#endif
julianDay = nextJulianDay;
// recalculate 'first' [0-based local dow of jan 1]
@@ -3378,7 +3378,7 @@ int32_t Calendar::handleComputeJulianDay(UCalendarDateFields bestField) {
// recalculate date.
date = 1 - first + dowLocal;
}
- } else if(woy>=getLeastMaximum(bestField)) {
+ } else if(woy>=getLeastMaximum(bestField)) {
// could be in the last week- find out if this JD would overstep
int32_t testDate = date;
if ((7 - first) < getMinimalDaysInFirstWeek()) {
@@ -3388,7 +3388,7 @@ int32_t Calendar::handleComputeJulianDay(UCalendarDateFields bestField) {
// Now adjust for the week number.
testDate += 7 * (woy - 1);
-#if defined (U_DEBUG_CAL)
+#if defined (U_DEBUG_CAL)
fprintf(stderr, "%s:%d - y=%d, y-1=%d doy%d, njd%d (C.F. %d)\n",
__FILE__, __LINE__, year, year-1, testDate, julianDay+testDate, nextJulianDay);
#endif
@@ -3402,7 +3402,7 @@ int32_t Calendar::handleComputeJulianDay(UCalendarDateFields bestField) {
}
date = 1 - first + dowLocal;
-#if defined (U_DEBUG_CAL)
+#if defined (U_DEBUG_CAL)
fprintf(stderr, "%s:%d - date now %d, jd%d, ywoy%d\n",
__FILE__, __LINE__, date, julianDay, year-1);
#endif
@@ -3427,13 +3427,13 @@ int32_t Calendar::handleComputeJulianDay(UCalendarDateFields bestField) {
}
int32_t
-Calendar::getDefaultMonthInYear(int32_t /*eyear*/)
+Calendar::getDefaultMonthInYear(int32_t /*eyear*/)
{
return 0;
}
int32_t
-Calendar::getDefaultDayInMonth(int32_t /*eyear*/, int32_t /*month*/)
+Calendar::getDefaultDayInMonth(int32_t /*eyear*/, int32_t /*month*/)
{
return 1;
}
@@ -3463,13 +3463,13 @@ int32_t Calendar::getLocalDOW()
int32_t Calendar::handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t woy)
{
- // We have UCAL_YEAR_WOY and UCAL_WEEK_OF_YEAR - from those, determine
+ // We have UCAL_YEAR_WOY and UCAL_WEEK_OF_YEAR - from those, determine
// what year we fall in, so that other code can set it properly.
// (code borrowed from computeWeekFields and handleComputeJulianDay)
//return yearWoy;
// First, we need a reliable DOW.
- UCalendarDateFields bestField = resolveFields(kDatePrecedence); // !! Note: if subclasses have a different table, they should override handleGetExtendedYearFromWeekFields
+ UCalendarDateFields bestField = resolveFields(kDatePrecedence); // !! Note: if subclasses have a different table, they should override handleGetExtendedYearFromWeekFields
// Now, a local DOW
int32_t dowLocal = getLocalDOW(); // 0..6
@@ -3502,9 +3502,9 @@ int32_t Calendar::handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t w
int32_t minDays = getMinimalDaysInFirstWeek();
UBool jan1InPrevYear = FALSE; // January 1st in the year of WOY is the 1st week? (i.e. first week is < minimal )
- //UBool nextJan1InPrevYear = FALSE; // January 1st of Year of WOY + 1 is in the first week?
+ //UBool nextJan1InPrevYear = FALSE; // January 1st of Year of WOY + 1 is in the first week?
- if((7 - first) < minDays) {
+ if((7 - first) < minDays) {
jan1InPrevYear = TRUE;
}
@@ -3527,8 +3527,8 @@ int32_t Calendar::handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t w
return yearWoy; // in this year
}
}
- } else if(woy >= getLeastMaximum(bestField)) {
- // we _might_ be in the last week..
+ } else if(woy >= getLeastMaximum(bestField)) {
+ // we _might_ be in the last week..
int32_t jd = // Calculate JD of our target day:
jan1Start + // JD of Jan 1
(7-first) + // days in the first week (Jan 1.. )
@@ -3565,7 +3565,7 @@ int32_t Calendar::handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t w
}
//(internalGet(UCAL_DATE) <= (7-first)) /* && in minDow */ ) {
- //within 1st week and in this month..
+ //within 1st week and in this month..
//return yearWoy+1;
return yearWoy;
@@ -3698,7 +3698,7 @@ void Calendar::prepareGetActual(UCalendarDateFields field, UBool isMinimum, UErr
dow += 7;
}
}
-#if defined (U_DEBUG_CAL)
+#if defined (U_DEBUG_CAL)
fprintf(stderr, "prepareGetActualHelper(WOM/WOY) - dow=%d\n", dow);
#endif
set(UCAL_DAY_OF_WEEK, dow);
@@ -3714,7 +3714,7 @@ void Calendar::prepareGetActual(UCalendarDateFields field, UBool isMinimum, UErr
int32_t Calendar::getActualHelper(UCalendarDateFields field, int32_t startValue, int32_t endValue, UErrorCode &status) const
{
-#if defined (U_DEBUG_CAL)
+#if defined (U_DEBUG_CAL)
fprintf(stderr, "getActualHelper(%d,%d .. %d, %s)\n", field, startValue, endValue, u_errorName(status));
#endif
if (startValue == endValue) {
@@ -3750,7 +3750,7 @@ int32_t Calendar::getActualHelper(UCalendarDateFields field, int32_t startValue,
int32_t result = startValue;
if ((work->get(field, status) != startValue
&& field != UCAL_WEEK_OF_MONTH && delta > 0 ) || U_FAILURE(status)) {
-#if defined (U_DEBUG_CAL)
+#if defined (U_DEBUG_CAL)
fprintf(stderr, "getActualHelper(fld %d) - got %d (not %d) - %s\n", field, work->get(field,status), startValue, u_errorName(status));
#endif
} else {
@@ -3767,7 +3767,7 @@ int32_t Calendar::getActualHelper(UCalendarDateFields field, int32_t startValue,
} while (startValue != endValue);
}
delete work;
-#if defined (U_DEBUG_CAL)
+#if defined (U_DEBUG_CAL)
fprintf(stderr, "getActualHelper(%d) = %d\n", field, result);
#endif
return result;
@@ -3794,27 +3794,27 @@ Calendar::setWeekData(const Locale& desiredLocale, const char *type, UErrorCode&
// Since week and weekend data is territory based instead of language based,
// we may need to tweak the locale that we are using to try to get the appropriate
// values, using the following logic:
- // 1). If the locale has a language but no territory, use the territory as defined by
+ // 1). If the locale has a language but no territory, use the territory as defined by
// the likely subtags.
// 2). If the locale has a script designation then we ignore it,
// then remove it ( i.e. "en_Latn_US" becomes "en_US" )
-
+
UErrorCode myStatus = U_ZERO_ERROR;
- Locale min(desiredLocale);
- min.minimizeSubtags(myStatus);
+ Locale min(desiredLocale);
+ min.minimizeSubtags(myStatus);
Locale useLocale;
- if ( uprv_strlen(desiredLocale.getCountry()) == 0 ||
+ if ( uprv_strlen(desiredLocale.getCountry()) == 0 ||
(uprv_strlen(desiredLocale.getScript()) > 0 && uprv_strlen(min.getScript()) == 0) ) {
myStatus = U_ZERO_ERROR;
- Locale max(desiredLocale);
- max.addLikelySubtags(myStatus);
+ Locale max(desiredLocale);
+ max.addLikelySubtags(myStatus);
useLocale = Locale(max.getLanguage(),max.getCountry());
} else {
- useLocale = desiredLocale;
+ useLocale = desiredLocale;
}
-
- /* The code here is somewhat of a hack, since week data and weekend data aren't really tied to
+
+ /* The code here is somewhat of a hack, since week data and weekend data aren't really tied to
a specific calendar, they aren't truly locale data. But this is the only place where valid and
actual locale can be set, so we take a shot at it here by loading a representative resource
from the calendar data. The code used to use the dateTimeElements resource to get first day
@@ -3890,8 +3890,8 @@ Calendar::setWeekData(const Locale& desiredLocale, const char *type, UErrorCode&
* and areFieldsSet. Callers should check isTimeSet and only
* call this method if isTimeSet is false.
*/
-void
-Calendar::updateTime(UErrorCode& status)
+void
+Calendar::updateTime(UErrorCode& status)
{
computeTime(status);
if(U_FAILURE(status))
@@ -3900,14 +3900,14 @@ Calendar::updateTime(UErrorCode& status)
// If we are lenient, we need to recompute the fields to normalize
// the values. Also, if we haven't set all the fields yet (i.e.,
// in a newly-created object), we need to fill in the fields. [LIU]
- if (isLenient() || ! fAreAllFieldsSet)
+ if (isLenient() || ! fAreAllFieldsSet)
fAreFieldsSet = FALSE;
fIsTimeSet = TRUE;
fAreFieldsVirtuallySet = FALSE;
}
-Locale
+Locale
Calendar::getLocale(ULocDataLocaleType type, UErrorCode& status) const {
U_LOCALE_BASED(locBased, *this);
return locBased.getLocale(type, status);
diff --git a/contrib/libs/icu/i18n/casetrn.cpp b/contrib/libs/icu/i18n/casetrn.cpp
index a8f175e69a..bb650f8fa2 100644
--- a/contrib/libs/icu/i18n/casetrn.cpp
+++ b/contrib/libs/icu/i18n/casetrn.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: casetrn.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -109,7 +109,7 @@ CaseMapTransliterator::~CaseMapTransliterator() {
*/
CaseMapTransliterator::CaseMapTransliterator(const CaseMapTransliterator& o) :
Transliterator(o),
- fMap(o.fMap)
+ fMap(o.fMap)
{
}
@@ -125,7 +125,7 @@ CaseMapTransliterator::CaseMapTransliterator(const CaseMapTransliterator& o) :
/**
* Transliterator API.
*/
-/*CaseMapTransliterator* CaseMapTransliterator::clone() const {
+/*CaseMapTransliterator* CaseMapTransliterator::clone() const {
return new CaseMapTransliterator(*this);
}*/
@@ -149,14 +149,14 @@ void CaseMapTransliterator::handleTransliterate(Replaceable& text,
UnicodeString tmp;
const UChar *s;
UChar32 c;
- int32_t textPos, delta, result;
+ int32_t textPos, delta, result;
for(textPos=offsets.start; textPos<offsets.limit;) {
csc.cpStart=textPos;
c=text.char32At(textPos);
csc.cpLimit=textPos+=U16_LENGTH(c);
- result=fMap(c, utrans_rep_caseContextIterator, &csc, &s, UCASE_LOC_ROOT);
+ result=fMap(c, utrans_rep_caseContextIterator, &csc, &s, UCASE_LOC_ROOT);
if(csc.b1 && isIncremental) {
// fMap() tried to look beyond the context limit
diff --git a/contrib/libs/icu/i18n/casetrn.h b/contrib/libs/icu/i18n/casetrn.h
index 72dbe3978f..2ec3e736de 100644
--- a/contrib/libs/icu/i18n/casetrn.h
+++ b/contrib/libs/icu/i18n/casetrn.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: casetrn.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -58,7 +58,7 @@ public:
* Transliterator API.
* @return a copy of the object.
*/
- virtual CaseMapTransliterator* clone() const = 0;
+ virtual CaseMapTransliterator* clone() const = 0;
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
diff --git a/contrib/libs/icu/i18n/cecal.cpp b/contrib/libs/icu/i18n/cecal.cpp
index 890601ae08..00faa8ac07 100644
--- a/contrib/libs/icu/i18n/cecal.cpp
+++ b/contrib/libs/icu/i18n/cecal.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/cecal.h b/contrib/libs/icu/i18n/cecal.h
index e3f261fc4b..c380f0bea3 100644
--- a/contrib/libs/icu/i18n/cecal.h
+++ b/contrib/libs/icu/i18n/cecal.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/chnsecal.cpp b/contrib/libs/icu/i18n/chnsecal.cpp
index c4af947781..4c03812715 100644
--- a/contrib/libs/icu/i18n/chnsecal.cpp
+++ b/contrib/libs/icu/i18n/chnsecal.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -51,7 +51,7 @@ static void debug_chnsecal_msg(const char *pat, ...)
// --- The cache --
-static icu::UMutex astroLock;
+static icu::UMutex astroLock;
static icu::CalendarAstronomer *gChineseCalendarAstro = NULL;
// Lazy Creation & Access synchronized by class CalendarCache with a mutex.
@@ -118,7 +118,7 @@ U_NAMESPACE_BEGIN
//-------------------------------------------------------------------------
-ChineseCalendar* ChineseCalendar::clone() const {
+ChineseCalendar* ChineseCalendar::clone() const {
return new ChineseCalendar(*this);
}
diff --git a/contrib/libs/icu/i18n/chnsecal.h b/contrib/libs/icu/i18n/chnsecal.h
index 3b2de29b8b..a0c21b6b5c 100644
--- a/contrib/libs/icu/i18n/chnsecal.h
+++ b/contrib/libs/icu/i18n/chnsecal.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************
@@ -144,7 +144,7 @@ class U_I18N_API ChineseCalendar : public Calendar {
virtual ~ChineseCalendar();
// clone
- virtual ChineseCalendar* clone() const;
+ virtual ChineseCalendar* clone() const;
private:
diff --git a/contrib/libs/icu/i18n/choicfmt.cpp b/contrib/libs/icu/i18n/choicfmt.cpp
index 9b42231961..7e26bb7a1f 100644
--- a/contrib/libs/icu/i18n/choicfmt.cpp
+++ b/contrib/libs/icu/i18n/choicfmt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -563,7 +563,7 @@ ChoiceFormat::matchStringUntilLimitPart(
// -------------------------------------
-ChoiceFormat*
+ChoiceFormat*
ChoiceFormat::clone() const
{
ChoiceFormat *aCopy = new ChoiceFormat(*this);
diff --git a/contrib/libs/icu/i18n/coleitr.cpp b/contrib/libs/icu/i18n/coleitr.cpp
index e8f714ec3a..64d3ab4d2b 100644
--- a/contrib/libs/icu/i18n/coleitr.cpp
+++ b/contrib/libs/icu/i18n/coleitr.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -29,7 +29,7 @@
#if !UCONFIG_NO_COLLATION
-#include "unicode/chariter.h"
+#include "unicode/chariter.h"
#include "unicode/coleitr.h"
#include "unicode/tblcoll.h"
#include "unicode/ustring.h"
diff --git a/contrib/libs/icu/i18n/coll.cpp b/contrib/libs/icu/i18n/coll.cpp
index 2eb219f698..7b87b41dff 100644
--- a/contrib/libs/icu/i18n/coll.cpp
+++ b/contrib/libs/icu/i18n/coll.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -63,11 +63,11 @@
static icu::Locale* availableLocaleList = NULL;
static int32_t availableLocaleListCount;
-#if !UCONFIG_NO_SERVICE
+#if !UCONFIG_NO_SERVICE
static icu::ICULocaleService* gService = NULL;
static icu::UInitOnce gServiceInitOnce = U_INITONCE_INITIALIZER;
-#endif
-static icu::UInitOnce gAvailableLocaleListInitOnce = U_INITONCE_INITIALIZER;
+#endif
+static icu::UInitOnce gAvailableLocaleListInitOnce = U_INITONCE_INITIALIZER;
/**
* Release all static memory held by collator.
@@ -226,21 +226,21 @@ initAvailableLocaleList(UErrorCode &status) {
U_ASSERT(availableLocaleList == NULL);
// for now, there is a hardcoded list, so just walk through that list and set it up.
UResourceBundle *index = NULL;
- StackUResourceBundle installed;
+ StackUResourceBundle installed;
int32_t i = 0;
index = ures_openDirect(U_ICUDATA_COLL, "res_index", &status);
- ures_getByKey(index, "InstalledLocales", installed.getAlias(), &status);
-
+ ures_getByKey(index, "InstalledLocales", installed.getAlias(), &status);
+
if(U_SUCCESS(status)) {
- availableLocaleListCount = ures_getSize(installed.getAlias());
+ availableLocaleListCount = ures_getSize(installed.getAlias());
availableLocaleList = new Locale[availableLocaleListCount];
if (availableLocaleList != NULL) {
- ures_resetIterator(installed.getAlias());
- while(ures_hasNext(installed.getAlias())) {
+ ures_resetIterator(installed.getAlias());
+ while(ures_hasNext(installed.getAlias())) {
const char *tempKey = NULL;
- ures_getNextString(installed.getAlias(), NULL, &tempKey, &status);
+ ures_getNextString(installed.getAlias(), NULL, &tempKey, &status);
availableLocaleList[i++] = Locale(tempKey);
}
}
@@ -446,14 +446,14 @@ Collator* U_EXPORT2 Collator::createInstance(const Locale& desiredLocale,
#endif
{
coll = makeInstance(desiredLocale, status);
- // Either returns NULL with U_FAILURE(status), or non-NULL with U_SUCCESS(status)
- }
- // The use of *coll in setAttributesFromKeywords can cause the NULL check to be
- // optimized out of the delete even though setAttributesFromKeywords returns
- // immediately if U_FAILURE(status), so we add a check here.
- if (U_FAILURE(status)) {
- return NULL;
- }
+ // Either returns NULL with U_FAILURE(status), or non-NULL with U_SUCCESS(status)
+ }
+ // The use of *coll in setAttributesFromKeywords can cause the NULL check to be
+ // optimized out of the delete even though setAttributesFromKeywords returns
+ // immediately if U_FAILURE(status), so we add a check here.
+ if (U_FAILURE(status)) {
+ return NULL;
+ }
setAttributesFromKeywords(desiredLocale, *coll, status);
if (U_FAILURE(status)) {
delete coll;
@@ -991,8 +991,8 @@ Collator::internalCompareUTF8(const char *left, int32_t leftLength,
return UCOL_EQUAL;
}
return compareUTF8(
- StringPiece(left, (leftLength < 0) ? static_cast<int32_t>(uprv_strlen(left)) : leftLength),
- StringPiece(right, (rightLength < 0) ? static_cast<int32_t>(uprv_strlen(right)) : rightLength),
+ StringPiece(left, (leftLength < 0) ? static_cast<int32_t>(uprv_strlen(left)) : leftLength),
+ StringPiece(right, (rightLength < 0) ? static_cast<int32_t>(uprv_strlen(right)) : rightLength),
errorCode);
}
diff --git a/contrib/libs/icu/i18n/collation.cpp b/contrib/libs/icu/i18n/collation.cpp
index 93faeee5d6..14cb86576b 100644
--- a/contrib/libs/icu/i18n/collation.cpp
+++ b/contrib/libs/icu/i18n/collation.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collation.h b/contrib/libs/icu/i18n/collation.h
index a7d2326876..e9256c9c12 100644
--- a/contrib/libs/icu/i18n/collation.h
+++ b/contrib/libs/icu/i18n/collation.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationbuilder.cpp b/contrib/libs/icu/i18n/collationbuilder.cpp
index 321dba031e..45ac6ddcd5 100644
--- a/contrib/libs/icu/i18n/collationbuilder.cpp
+++ b/contrib/libs/icu/i18n/collationbuilder.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -577,7 +577,7 @@ CollationBuilder::getSpecialResetPosition(const UnicodeString &str,
parserErrorReason = "LDML forbids tailoring to U+FFFF";
return 0;
default:
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
int32_t index = findOrInsertNodeForRootCE(ce, strength, errorCode);
diff --git a/contrib/libs/icu/i18n/collationbuilder.h b/contrib/libs/icu/i18n/collationbuilder.h
index 7846b90d6a..2f20050f93 100644
--- a/contrib/libs/icu/i18n/collationbuilder.h
+++ b/contrib/libs/icu/i18n/collationbuilder.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationcompare.cpp b/contrib/libs/icu/i18n/collationcompare.cpp
index fda0f72a60..cbf32c9fe6 100644
--- a/contrib/libs/icu/i18n/collationcompare.cpp
+++ b/contrib/libs/icu/i18n/collationcompare.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationcompare.h b/contrib/libs/icu/i18n/collationcompare.h
index f9950666af..6ad2d06704 100644
--- a/contrib/libs/icu/i18n/collationcompare.h
+++ b/contrib/libs/icu/i18n/collationcompare.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationdata.cpp b/contrib/libs/icu/i18n/collationdata.cpp
index addc134a73..688770f8f6 100644
--- a/contrib/libs/icu/i18n/collationdata.cpp
+++ b/contrib/libs/icu/i18n/collationdata.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationdata.h b/contrib/libs/icu/i18n/collationdata.h
index a4ff5035db..ab9b4c47ec 100644
--- a/contrib/libs/icu/i18n/collationdata.h
+++ b/contrib/libs/icu/i18n/collationdata.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationdatabuilder.cpp b/contrib/libs/icu/i18n/collationdatabuilder.cpp
index a3b99360e4..53361b86c7 100644
--- a/contrib/libs/icu/i18n/collationdatabuilder.cpp
+++ b/contrib/libs/icu/i18n/collationdatabuilder.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -852,7 +852,7 @@ CollationDataBuilder::copyFromBaseCE32(UChar32 c, uint32_t ce32, UBool withConte
ce32 = encodeOneCE(Collation::unassignedCEFromCodePoint(c), errorCode);
break;
default:
- UPRV_UNREACHABLE; // require ce32 == base->getFinalCE32(ce32)
+ UPRV_UNREACHABLE; // require ce32 == base->getFinalCE32(ce32)
}
return ce32;
}
diff --git a/contrib/libs/icu/i18n/collationdatabuilder.h b/contrib/libs/icu/i18n/collationdatabuilder.h
index 380ac35f03..fee444deee 100644
--- a/contrib/libs/icu/i18n/collationdatabuilder.h
+++ b/contrib/libs/icu/i18n/collationdatabuilder.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationdatareader.cpp b/contrib/libs/icu/i18n/collationdatareader.cpp
index 9c1bfeeb92..0eb1861343 100644
--- a/contrib/libs/icu/i18n/collationdatareader.cpp
+++ b/contrib/libs/icu/i18n/collationdatareader.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -419,8 +419,8 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
tailoring.data, ts, fastLatinPrimaries, UPRV_LENGTHOF(fastLatinPrimaries));
if(options == ts.options && ts.variableTop != 0 &&
reorderCodesLength == ts.reorderCodesLength &&
- (reorderCodesLength == 0 ||
- uprv_memcmp(reorderCodes, ts.reorderCodes, reorderCodesLength * 4) == 0) &&
+ (reorderCodesLength == 0 ||
+ uprv_memcmp(reorderCodes, ts.reorderCodes, reorderCodesLength * 4) == 0) &&
fastLatinOptions == ts.fastLatinOptions &&
(fastLatinOptions < 0 ||
uprv_memcmp(fastLatinPrimaries, ts.fastLatinPrimaries,
diff --git a/contrib/libs/icu/i18n/collationdatareader.h b/contrib/libs/icu/i18n/collationdatareader.h
index e5c6213910..44e69399e3 100644
--- a/contrib/libs/icu/i18n/collationdatareader.h
+++ b/contrib/libs/icu/i18n/collationdatareader.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationdatawriter.cpp b/contrib/libs/icu/i18n/collationdatawriter.cpp
index 040cca3e3e..823c8eb011 100644
--- a/contrib/libs/icu/i18n/collationdatawriter.cpp
+++ b/contrib/libs/icu/i18n/collationdatawriter.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -224,7 +224,7 @@ CollationDataWriter::write(UBool isBase, const UVersionInfo dataVersion,
int32_t totalSize = indexesLength * 4;
if(hasMappings && (isBase || data.jamoCE32s != baseData->jamoCE32s)) {
- indexes[CollationDataReader::IX_JAMO_CE32S_START] = static_cast<int32_t>(data.jamoCE32s - data.ce32s);
+ indexes[CollationDataReader::IX_JAMO_CE32S_START] = static_cast<int32_t>(data.jamoCE32s - data.ce32s);
} else {
indexes[CollationDataReader::IX_JAMO_CE32S_START] = -1;
}
diff --git a/contrib/libs/icu/i18n/collationdatawriter.h b/contrib/libs/icu/i18n/collationdatawriter.h
index 3afdb6dd70..197cd5309f 100644
--- a/contrib/libs/icu/i18n/collationdatawriter.h
+++ b/contrib/libs/icu/i18n/collationdatawriter.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationfastlatin.cpp b/contrib/libs/icu/i18n/collationfastlatin.cpp
index 0572c52676..b98b8457f4 100644
--- a/contrib/libs/icu/i18n/collationfastlatin.cpp
+++ b/contrib/libs/icu/i18n/collationfastlatin.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationfastlatin.h b/contrib/libs/icu/i18n/collationfastlatin.h
index 8da1cecfac..4bac797409 100644
--- a/contrib/libs/icu/i18n/collationfastlatin.h
+++ b/contrib/libs/icu/i18n/collationfastlatin.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationfastlatinbuilder.cpp b/contrib/libs/icu/i18n/collationfastlatinbuilder.cpp
index 9205a562b0..e5ba2f0e21 100644
--- a/contrib/libs/icu/i18n/collationfastlatinbuilder.cpp
+++ b/contrib/libs/icu/i18n/collationfastlatinbuilder.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -607,7 +607,7 @@ CollationFastLatinBuilder::encodeContractions(UErrorCode &errorCode) {
}
UBool firstTriple = TRUE;
for(int32_t index = (int32_t)ce & 0x7fffffff;; index += 3) {
- int32_t x = static_cast<int32_t>(contractionCEs.elementAti(index));
+ int32_t x = static_cast<int32_t>(contractionCEs.elementAti(index));
if((uint32_t)x == CollationFastLatin::CONTR_CHAR_MASK && !firstTriple) { break; }
int64_t cce0 = contractionCEs.elementAti(index + 1);
int64_t cce1 = contractionCEs.elementAti(index + 2);
diff --git a/contrib/libs/icu/i18n/collationfastlatinbuilder.h b/contrib/libs/icu/i18n/collationfastlatinbuilder.h
index 0f925a9beb..8b63b86815 100644
--- a/contrib/libs/icu/i18n/collationfastlatinbuilder.h
+++ b/contrib/libs/icu/i18n/collationfastlatinbuilder.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationfcd.cpp b/contrib/libs/icu/i18n/collationfcd.cpp
index 5daa4dddc5..9f73ff3898 100644
--- a/contrib/libs/icu/i18n/collationfcd.cpp
+++ b/contrib/libs/icu/i18n/collationfcd.cpp
@@ -1,14 +1,14 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
-//
-// Copyright (C) 1999-2016, International Business Machines
-// Corporation and others. All Rights Reserved.
-//
-// file name: collationfcd.cpp
-//
-// machine-generated by: icu/tools/unicode/c/genuca/genuca.cpp
+//
+// Copyright (C) 1999-2016, International Business Machines
+// Corporation and others. All Rights Reserved.
+//
+// file name: collationfcd.cpp
+//
+// machine-generated by: icu/tools/unicode/c/genuca/genuca.cpp
+
-
#include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
@@ -22,27 +22,27 @@ const uint8_t CollationFCD::lcccIndex[2048]={
0,0,0,0,0,0,0,0,1,1,2,3,0,0,0,0,
0,0,0,0,4,0,0,0,0,0,0,0,5,6,7,0,
8,0,9,0xa,0,0,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0x10,
-0x11,0x12,0x13,0,0,0,0x14,0x15,0,0x16,0x17,0,0,0x16,0x18,0x19,
+0x11,0x12,0x13,0,0,0,0x14,0x15,0,0x16,0x17,0,0,0x16,0x18,0x19,
0,0x16,0x18,0,0,0x16,0x18,0,0,0x16,0x18,0,0,0,0x18,0,
-0,0,0x1a,0,0,0x16,0x18,0,0,0x1b,0x18,0,0,0,0x1c,0,
-0,0x1d,0x1e,0,0,0x1d,0x1e,0,0x1f,0x20,0,0x21,0x22,0,0x23,0,
-0,0x24,0,0,0x18,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0x25,0,0,0,0,0,
+0,0,0x1a,0,0,0x16,0x18,0,0,0x1b,0x18,0,0,0,0x1c,0,
+0,0x1d,0x1e,0,0,0x1d,0x1e,0,0x1f,0x20,0,0x21,0x22,0,0x23,0,
+0,0x24,0,0,0x18,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0x25,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,0x26,0x26,0,0,0,0,0x27,0,
-0,0,0,0,0,0x28,0,0,0,0x13,0,0,0,0,0,0,
-0x29,0,0,0x2a,0,0x2b,0x2c,0,0,0x26,0x2d,0x2e,0,0x2f,0,0x30,
-0,0x31,0,0,0,0,0x32,0x33,0,0,0,0,0,0,1,0x34,
+0,0,0,0,0,0,0,0,0x26,0x26,0,0,0,0,0x27,0,
+0,0,0,0,0,0x28,0,0,0,0x13,0,0,0,0,0,0,
+0x29,0,0,0x2a,0,0x2b,0x2c,0,0,0x26,0x2d,0x2e,0,0x2f,0,0x30,
+0,0x31,0,0,0,0,0x32,0x33,0,0,0,0,0,0,1,0x34,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0x35,0x36,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0x35,0x36,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,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,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,0,
-0,0,0,0,0,0,0,0x37,0,0,0,0x38,0,0,0,1,
+0,0,0,0,0,0,0,0x37,0,0,0,0x38,0,0,0,1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0x39,0,0,0x3a,0,0,0,0,0,0,0,0,0,0,0,
+0,0x39,0,0,0x3a,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,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,0,
@@ -101,9 +101,9 @@ const uint8_t CollationFCD::lcccIndex[2048]={
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,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0x3b,0x3c,0,0,0x3d,0,0,0,0,0,0,0,0,
-0x23,0x3e,0,0,0,0,0x2d,0x3f,0,0x40,0x41,0,0,0x41,0x2c,0,
-0,0,0,0,0,0x42,0x43,0x44,0,0,0,0,0,0,0,0x18,
+0,0,0,0x3b,0x3c,0,0,0x3d,0,0,0,0,0,0,0,0,
+0x23,0x3e,0,0,0,0,0x2d,0x3f,0,0x40,0x41,0,0,0x41,0x2c,0,
+0,0,0,0,0,0x42,0x43,0x44,0,0,0,0,0,0,0,0x18,
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,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -126,7 +126,7 @@ const uint8_t CollationFCD::lcccIndex[2048]={
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,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x45,0x46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x45,0x46,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,0,
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,
@@ -143,17 +143,17 @@ const uint8_t CollationFCD::lcccIndex[2048]={
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,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,0x19,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0x19,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};
-const uint32_t CollationFCD::lcccBits[71]={
+const uint32_t CollationFCD::lcccBits[71]={
0,0xffffffff,0xffff7fff,0xffff,0xf8,0xfffe0000,0xbfffffff,0xb6,0x7ff0000,0xfffff800,0x10000,0x9fc00000,0x3d9f,0x20000,0xffff0000,0x7ff,
-0x200ff800,0xfbc00000,0x3eef,0xe000000,0xfff80000,0xfffffffb,0x10000000,0x1e2000,0x2000,0x40000000,0x602000,0x18000000,0x400,0x7000000,0xf00,0x3000000,
-0x2a00000,0x3c3e0000,0xdf,0x40,0x6800000,0xe0000000,0x100000,0x20040000,0x200,0x1800000,0x9fe00001,0xbfff0000,1,0x10,0xff800,0xc00,
-0xc0040,0x800000,0xfff70000,0x31021fd,0xfbffffff,0x1fff0000,0x1ffe2,0x38000,0x80000000,0xfc00,0x6000000,0x3ff08000,0xc0000000,0x30000,0x1000,0x3ffff,
-0x3800,0x80000,0xc19d0000,2,0x400000,0xc0000fd,0x5108000
+0x200ff800,0xfbc00000,0x3eef,0xe000000,0xfff80000,0xfffffffb,0x10000000,0x1e2000,0x2000,0x40000000,0x602000,0x18000000,0x400,0x7000000,0xf00,0x3000000,
+0x2a00000,0x3c3e0000,0xdf,0x40,0x6800000,0xe0000000,0x100000,0x20040000,0x200,0x1800000,0x9fe00001,0xbfff0000,1,0x10,0xff800,0xc00,
+0xc0040,0x800000,0xfff70000,0x31021fd,0xfbffffff,0x1fff0000,0x1ffe2,0x38000,0x80000000,0xfc00,0x6000000,0x3ff08000,0xc0000000,0x30000,0x1000,0x3ffff,
+0x3800,0x80000,0xc19d0000,2,0x400000,0xc0000fd,0x5108000
};
const uint8_t CollationFCD::tcccIndex[2048]={
@@ -161,27 +161,27 @@ const uint8_t CollationFCD::tcccIndex[2048]={
0xb,0xc,0,0,0,0,0,0,1,1,0xd,0xe,0xf,0x10,0x11,0,
0x12,0x13,0x14,0x15,0x16,0,0x17,0x18,0,0,0,0,0x19,0x1a,0x1b,0,
0x1c,0x1d,0x1e,0x1f,0,0,0x20,0x21,0x22,0x23,0x24,0,0,0,0,0x25,
-0x26,0x27,0x28,0,0,0,0x29,0x2a,0,0x2b,0x2c,0,0,0x2d,0x2e,0x2f,
-0,0x30,0x31,0,0,0x2d,0x32,0,0,0x2d,0x33,0,0,0,0x32,0,
-0,0,0x34,0,0,0x2d,0x32,0,0,0x35,0x32,0,0,0,0x36,0,
-0,0x37,0x38,0,0,0x37,0x38,0,0x39,0x3a,0,0x3b,0x3c,0,0x3d,0,
-0,0x3e,0,0,0x32,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0x3f,0,0,0,0,0,
+0x26,0x27,0x28,0,0,0,0x29,0x2a,0,0x2b,0x2c,0,0,0x2d,0x2e,0x2f,
+0,0x30,0x31,0,0,0x2d,0x32,0,0,0x2d,0x33,0,0,0,0x32,0,
+0,0,0x34,0,0,0x2d,0x32,0,0,0x35,0x32,0,0,0,0x36,0,
+0,0x37,0x38,0,0,0x37,0x38,0,0x39,0x3a,0,0x3b,0x3c,0,0x3d,0,
+0,0x3e,0,0,0x32,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0x3f,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,0x40,0x40,0,0,0,0,0x41,0,
-0,0,0,0,0,0x42,0,0,0,0x28,0,0,0,0,0,0,
-0x43,0,0,0x44,0,0x45,0x46,0,0,0x40,0x47,0x48,0,0x49,0,0x4a,
-0,0x4b,0,0,0,0,0x4c,0x4d,0,0,0,0,0,0,1,0x4e,
-1,1,1,1,0x4f,1,1,0x50,0x51,1,0x52,0x53,1,0x54,0x55,0x56,
-0,0,0,0,0,0,0x57,0x58,0,0x59,0,0,0x5a,0x5b,0x5c,0,
-0x5d,0x5e,0x5f,0x60,0x61,0x62,0,0x63,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0x40,0x40,0,0,0,0,0x41,0,
+0,0,0,0,0,0x42,0,0,0,0x28,0,0,0,0,0,0,
+0x43,0,0,0x44,0,0x45,0x46,0,0,0x40,0x47,0x48,0,0x49,0,0x4a,
+0,0x4b,0,0,0,0,0x4c,0x4d,0,0,0,0,0,0,1,0x4e,
+1,1,1,1,0x4f,1,1,0x50,0x51,1,0x52,0x53,1,0x54,0x55,0x56,
+0,0,0,0,0,0,0x57,0x58,0,0x59,0,0,0x5a,0x5b,0x5c,0,
+0x5d,0x5e,0x5f,0x60,0x61,0x62,0,0x63,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,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,0,0,0,0,0x2d,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0x64,0,0,0,0x65,0,0,0,1,
+0,0,0,0,0,0,0,0x64,0,0,0,0x65,0,0,0,1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0x66,0x67,0x68,0x69,0x67,0x68,0x6a,0,0,0,0,0,0,0,0,
+0,0x66,0x67,0x68,0x69,0x67,0x68,0x6a,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,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,
@@ -240,9 +240,9 @@ const uint8_t CollationFCD::tcccIndex[2048]={
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,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0x6b,0x6c,0,0,0x6d,0,0,0,0,0,0,0,0,
-0x3d,0x6e,0,0,0,0,0x47,0x6f,0,0x70,0x71,0,0,0x71,0x46,0,
-0,0,0,0,0,0x72,0x73,0x74,0,0,0,0,0,0,0,0x32,
+0,0,0,0x6b,0x6c,0,0,0x6d,0,0,0,0,0,0,0,0,
+0x3d,0x6e,0,0,0,0,0x47,0x6f,0,0x70,0x71,0,0,0x71,0x46,0,
+0,0,0,0,0,0x72,0x73,0x74,0,0,0,0,0,0,0,0x32,
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,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -265,7 +265,7 @@ const uint8_t CollationFCD::tcccIndex[2048]={
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,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x75,0x76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x75,0x76,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,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,0,0,0,0,
@@ -282,20 +282,20 @@ const uint8_t CollationFCD::tcccIndex[2048]={
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,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,0x3f,0x77,0x78,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0x3f,0x77,0x78,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0xe,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};
-const uint32_t CollationFCD::tcccBits[121]={
+const uint32_t CollationFCD::tcccBits[121]={
0,0xffffffff,0x3e7effbf,0xbe7effbf,0xfffcffff,0x7ef1ff3f,0xfff3f1f8,0x7fffff3f,0x18003,0xdfffe000,0xff31ffcf,0xcfffffff,0xfffc0,0xffff7fff,0xffff,0x1d760,
0x1fc00,0x187c00,0x200708b,0x2000000,0x708b0000,0xc00000,0xf8,0xfccf0006,0x33ffcfc,0xfffe0000,0xbfffffff,0xb6,0x7ff0000,0x7c,0xfffff800,0x10000,
-0x9fc80005,0x3d9f,0x20000,0xffff0000,0x7ff,0x200ff800,0xfbc00000,0x3eef,0xe000000,0xfff80000,0xfffffffb,0x10120200,0xff1e2000,0x10000000,0xb0002000,0x40000000,
-0x10480000,0x4e002000,0x2000,0x30002000,0x602100,0x18000000,0x24000400,0x7000000,0xf00,0x3000000,0x2a00000,0x3d7e0000,0xdf,0x40,0x6800000,0xe0000000,
-0x100000,0x20040000,0x200,0x1800000,0x9fe00001,0xbfff0000,1,0x10,0xff800,0xc00,0xc0040,0x800000,0xfff70000,0x31021fd,0xfbffffff,0xbffffff,
-0x3ffffff,0x3f3fffff,0xaaff3f3f,0x3fffffff,0x1fdfffff,0xefcfffde,0x1fdc7fff,0x1fff0000,0x1ffe2,0x800,0xc000000,0x4000,0xe000,0x1210,0x50,0x292,
-0x333e005,0x333,0xf000,0x3c0f,0x38000,0x80000000,0xfc00,0x55555000,0x36db02a5,0x46100000,0x47900000,0x3ff08000,0xc0000000,0x30000,0x1000,0x3ffff,
-0x3800,0x80000,0xc19d0000,2,0x400000,0xc0000fd,0x5108000,0x5f7ffc00,0x7fdb
+0x9fc80005,0x3d9f,0x20000,0xffff0000,0x7ff,0x200ff800,0xfbc00000,0x3eef,0xe000000,0xfff80000,0xfffffffb,0x10120200,0xff1e2000,0x10000000,0xb0002000,0x40000000,
+0x10480000,0x4e002000,0x2000,0x30002000,0x602100,0x18000000,0x24000400,0x7000000,0xf00,0x3000000,0x2a00000,0x3d7e0000,0xdf,0x40,0x6800000,0xe0000000,
+0x100000,0x20040000,0x200,0x1800000,0x9fe00001,0xbfff0000,1,0x10,0xff800,0xc00,0xc0040,0x800000,0xfff70000,0x31021fd,0xfbffffff,0xbffffff,
+0x3ffffff,0x3f3fffff,0xaaff3f3f,0x3fffffff,0x1fdfffff,0xefcfffde,0x1fdc7fff,0x1fff0000,0x1ffe2,0x800,0xc000000,0x4000,0xe000,0x1210,0x50,0x292,
+0x333e005,0x333,0xf000,0x3c0f,0x38000,0x80000000,0xfc00,0x55555000,0x36db02a5,0x46100000,0x47900000,0x3ff08000,0xc0000000,0x30000,0x1000,0x3ffff,
+0x3800,0x80000,0xc19d0000,2,0x400000,0xc0000fd,0x5108000,0x5f7ffc00,0x7fdb
};
U_NAMESPACE_END
diff --git a/contrib/libs/icu/i18n/collationfcd.h b/contrib/libs/icu/i18n/collationfcd.h
index 206821d194..ec7167d76b 100644
--- a/contrib/libs/icu/i18n/collationfcd.h
+++ b/contrib/libs/icu/i18n/collationfcd.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationiterator.cpp b/contrib/libs/icu/i18n/collationiterator.cpp
index 1a670d905f..18ccf014f0 100644
--- a/contrib/libs/icu/i18n/collationiterator.cpp
+++ b/contrib/libs/icu/i18n/collationiterator.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -872,7 +872,7 @@ CollationIterator::previousCE(UVector32 &offsets, UErrorCode &errorCode) {
// consistent with forward iteration.
while(offsets.size() <= ceBuffer.length) {
offsets.addElement(limitOffset, errorCode);
- }
+ }
}
return ceBuffer.get(--ceBuffer.length);
} else {
@@ -932,7 +932,7 @@ CollationIterator::previousCEUnsafe(UChar32 c, UVector32 &offsets, UErrorCode &e
offset = getOffset();
while(offsets.size() < ceBuffer.length) {
offsets.addElement(offset, errorCode);
- }
+ }
}
U_ASSERT(offsets.size() == ceBuffer.length);
// End offset corresponding to just after the unsafe-backwards segment.
diff --git a/contrib/libs/icu/i18n/collationiterator.h b/contrib/libs/icu/i18n/collationiterator.h
index aca46735b8..12e05b4482 100644
--- a/contrib/libs/icu/i18n/collationiterator.h
+++ b/contrib/libs/icu/i18n/collationiterator.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -28,21 +28,21 @@ class SkippedState;
class UCharsTrie;
class UVector32;
-/* Large enough for CEs of most short strings. */
-#define CEBUFFER_INITIAL_CAPACITY 40
-
-// Export an explicit template instantiation of the MaybeStackArray that
-// is used as a data member of CEBuffer.
-//
-// When building DLLs for Windows this is required even though
-// no direct access to the MaybeStackArray leaks out of the i18n library.
-//
-// See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.
-//
-#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
-template class U_I18N_API MaybeStackArray<int64_t, CEBUFFER_INITIAL_CAPACITY>;
-#endif
-
+/* Large enough for CEs of most short strings. */
+#define CEBUFFER_INITIAL_CAPACITY 40
+
+// Export an explicit template instantiation of the MaybeStackArray that
+// is used as a data member of CEBuffer.
+//
+// When building DLLs for Windows this is required even though
+// no direct access to the MaybeStackArray leaks out of the i18n library.
+//
+// See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.
+//
+#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
+template class U_I18N_API MaybeStackArray<int64_t, CEBUFFER_INITIAL_CAPACITY>;
+#endif
+
/**
* Collation element iterator and abstract character iterator.
*
@@ -51,10 +51,10 @@ template class U_I18N_API MaybeStackArray<int64_t, CEBUFFER_INITIAL_CAPACITY>;
*/
class U_I18N_API CollationIterator : public UObject {
private:
- class U_I18N_API CEBuffer {
+ class U_I18N_API CEBuffer {
private:
/** Large enough for CEs of most short strings. */
- static const int32_t INITIAL_CAPACITY = CEBUFFER_INITIAL_CAPACITY;
+ static const int32_t INITIAL_CAPACITY = CEBUFFER_INITIAL_CAPACITY;
public:
CEBuffer() : length(0) {}
~CEBuffer();
diff --git a/contrib/libs/icu/i18n/collationkeys.cpp b/contrib/libs/icu/i18n/collationkeys.cpp
index 2a5ec431b3..b5c322fb44 100644
--- a/contrib/libs/icu/i18n/collationkeys.cpp
+++ b/contrib/libs/icu/i18n/collationkeys.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -403,13 +403,13 @@ CollationKeys::writeSortKeyUpToQuaternary(CollationIterator &iter,
uint8_t *secs = secondaries.data();
int32_t last = secondaries.length() - 1;
if(secSegmentStart < last) {
- uint8_t *q = secs + secSegmentStart;
- uint8_t *r = secs + last;
+ uint8_t *q = secs + secSegmentStart;
+ uint8_t *r = secs + last;
do {
- uint8_t b = *q;
- *q++ = *r;
- *r-- = b;
- } while(q < r);
+ uint8_t b = *q;
+ *q++ = *r;
+ *r-- = b;
+ } while(q < r);
}
secondaries.appendByte(p == Collation::NO_CE_PRIMARY ?
Collation::LEVEL_SEPARATOR_BYTE : Collation::MERGE_SEPARATOR_BYTE);
diff --git a/contrib/libs/icu/i18n/collationkeys.h b/contrib/libs/icu/i18n/collationkeys.h
index dd0e157eda..60d9e50c0d 100644
--- a/contrib/libs/icu/i18n/collationkeys.h
+++ b/contrib/libs/icu/i18n/collationkeys.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationroot.cpp b/contrib/libs/icu/i18n/collationroot.cpp
index c4afe6e8e4..71753bd6f4 100644
--- a/contrib/libs/icu/i18n/collationroot.cpp
+++ b/contrib/libs/icu/i18n/collationroot.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationroot.h b/contrib/libs/icu/i18n/collationroot.h
index 7e87f07b45..8cd3046cdf 100644
--- a/contrib/libs/icu/i18n/collationroot.h
+++ b/contrib/libs/icu/i18n/collationroot.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationrootelements.cpp b/contrib/libs/icu/i18n/collationrootelements.cpp
index 995991429a..9b46d14144 100644
--- a/contrib/libs/icu/i18n/collationrootelements.cpp
+++ b/contrib/libs/icu/i18n/collationrootelements.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationrootelements.h b/contrib/libs/icu/i18n/collationrootelements.h
index c3b30a51b9..7836d8d83b 100644
--- a/contrib/libs/icu/i18n/collationrootelements.h
+++ b/contrib/libs/icu/i18n/collationrootelements.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationruleparser.cpp b/contrib/libs/icu/i18n/collationruleparser.cpp
index 7c2014e7a8..ade6ecb552 100644
--- a/contrib/libs/icu/i18n/collationruleparser.cpp
+++ b/contrib/libs/icu/i18n/collationruleparser.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -622,11 +622,11 @@ CollationRuleParser::parseSetting(UErrorCode &errorCode) {
setParseError("expected language tag in [import langTag]", errorCode);
return;
}
- if(length == 0) {
+ if(length == 0) {
uprv_strcpy(baseID, "root");
- } else if(*baseID == '_') {
- uprv_memmove(baseID + 3, baseID, length + 1);
- uprv_memcpy(baseID, "und", 3);
+ } else if(*baseID == '_') {
+ uprv_memmove(baseID + 3, baseID, length + 1);
+ uprv_memcpy(baseID, "und", 3);
}
// @collation=type, or length=0 if not specified
char collationType[ULOC_KEYWORDS_CAPACITY];
diff --git a/contrib/libs/icu/i18n/collationruleparser.h b/contrib/libs/icu/i18n/collationruleparser.h
index 00907b6dad..e124881fcf 100644
--- a/contrib/libs/icu/i18n/collationruleparser.h
+++ b/contrib/libs/icu/i18n/collationruleparser.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationsets.cpp b/contrib/libs/icu/i18n/collationsets.cpp
index 008391f583..09581416a8 100644
--- a/contrib/libs/icu/i18n/collationsets.cpp
+++ b/contrib/libs/icu/i18n/collationsets.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationsets.h b/contrib/libs/icu/i18n/collationsets.h
index 2862b5bda2..aed41f7ac8 100644
--- a/contrib/libs/icu/i18n/collationsets.h
+++ b/contrib/libs/icu/i18n/collationsets.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationsettings.cpp b/contrib/libs/icu/i18n/collationsettings.cpp
index 1e2778fe72..534e20df3e 100644
--- a/contrib/libs/icu/i18n/collationsettings.cpp
+++ b/contrib/libs/icu/i18n/collationsettings.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationsettings.h b/contrib/libs/icu/i18n/collationsettings.h
index 5447dbfe3b..83e775d443 100644
--- a/contrib/libs/icu/i18n/collationsettings.h
+++ b/contrib/libs/icu/i18n/collationsettings.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationtailoring.cpp b/contrib/libs/icu/i18n/collationtailoring.cpp
index d2bf50ec44..78a11fbb26 100644
--- a/contrib/libs/icu/i18n/collationtailoring.cpp
+++ b/contrib/libs/icu/i18n/collationtailoring.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/collationtailoring.h b/contrib/libs/icu/i18n/collationtailoring.h
index a0ea0558f0..e1bc34c7d7 100644
--- a/contrib/libs/icu/i18n/collationtailoring.h
+++ b/contrib/libs/icu/i18n/collationtailoring.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -92,7 +92,7 @@ private:
CollationTailoring(const CollationTailoring &other);
};
-struct U_I18N_API CollationCacheEntry : public SharedObject {
+struct U_I18N_API CollationCacheEntry : public SharedObject {
CollationCacheEntry(const Locale &loc, const CollationTailoring *t)
: validLocale(loc), tailoring(t) {
if(t != NULL) {
diff --git a/contrib/libs/icu/i18n/collationweights.cpp b/contrib/libs/icu/i18n/collationweights.cpp
index c185cdbcf3..05458962c6 100644
--- a/contrib/libs/icu/i18n/collationweights.cpp
+++ b/contrib/libs/icu/i18n/collationweights.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: collationweights.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -527,7 +527,7 @@ CollationWeights::allocWeights(uint32_t lowerLimit, uint32_t upperLimit, int32_t
#ifdef UCOL_DEBUG
printf("lengthen the short ranges from %ld bytes to %ld and iterate\n", minLength, minLength+1);
#endif
- for(int32_t i=0; i<rangeCount && ranges[i].length==minLength; ++i) {
+ for(int32_t i=0; i<rangeCount && ranges[i].length==minLength; ++i) {
lengthenRange(ranges[i]);
}
}
diff --git a/contrib/libs/icu/i18n/collationweights.h b/contrib/libs/icu/i18n/collationweights.h
index a9fd214675..b415882184 100644
--- a/contrib/libs/icu/i18n/collationweights.h
+++ b/contrib/libs/icu/i18n/collationweights.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: collationweights.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/i18n/collunsafe.h b/contrib/libs/icu/i18n/collunsafe.h
index b6dfc38245..0767254a8a 100644
--- a/contrib/libs/icu/i18n/collunsafe.h
+++ b/contrib/libs/icu/i18n/collunsafe.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
// collunsafe.h
// Copyright (C) 2015-2016, International Business Machines Corporation and others.
diff --git a/contrib/libs/icu/i18n/compactdecimalformat.cpp b/contrib/libs/icu/i18n/compactdecimalformat.cpp
index 5abd218a87..a4c9dad25c 100644
--- a/contrib/libs/icu/i18n/compactdecimalformat.cpp
+++ b/contrib/libs/icu/i18n/compactdecimalformat.cpp
@@ -1,75 +1,75 @@
-// © 2018 and later: Unicode, Inc. and others.
+// © 2018 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
-
+
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
#include "unicode/compactdecimalformat.h"
-#include "number_mapper.h"
-#include "number_decimfmtprops.h"
+#include "number_mapper.h"
+#include "number_decimfmtprops.h"
-using namespace icu;
+using namespace icu;
-UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CompactDecimalFormat)
+UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CompactDecimalFormat)
-CompactDecimalFormat*
-CompactDecimalFormat::createInstance(const Locale& inLocale, UNumberCompactStyle style,
- UErrorCode& status) {
- return new CompactDecimalFormat(inLocale, style, status);
+CompactDecimalFormat*
+CompactDecimalFormat::createInstance(const Locale& inLocale, UNumberCompactStyle style,
+ UErrorCode& status) {
+ return new CompactDecimalFormat(inLocale, style, status);
}
-CompactDecimalFormat::CompactDecimalFormat(const Locale& inLocale, UNumberCompactStyle style,
- UErrorCode& status)
- : DecimalFormat(new DecimalFormatSymbols(inLocale, status), status) {
- if (U_FAILURE(status)) return;
- // Minimal properties: let the non-shim code path do most of the logic for us.
- fields->properties.compactStyle = style;
- fields->properties.groupingSize = -2; // do not forward grouping information
- fields->properties.minimumGroupingDigits = 2;
- touch(status);
+CompactDecimalFormat::CompactDecimalFormat(const Locale& inLocale, UNumberCompactStyle style,
+ UErrorCode& status)
+ : DecimalFormat(new DecimalFormatSymbols(inLocale, status), status) {
+ if (U_FAILURE(status)) return;
+ // Minimal properties: let the non-shim code path do most of the logic for us.
+ fields->properties.compactStyle = style;
+ fields->properties.groupingSize = -2; // do not forward grouping information
+ fields->properties.minimumGroupingDigits = 2;
+ touch(status);
}
-CompactDecimalFormat::CompactDecimalFormat(const CompactDecimalFormat& source) = default;
+CompactDecimalFormat::CompactDecimalFormat(const CompactDecimalFormat& source) = default;
-CompactDecimalFormat::~CompactDecimalFormat() = default;
+CompactDecimalFormat::~CompactDecimalFormat() = default;
-CompactDecimalFormat& CompactDecimalFormat::operator=(const CompactDecimalFormat& rhs) {
+CompactDecimalFormat& CompactDecimalFormat::operator=(const CompactDecimalFormat& rhs) {
DecimalFormat::operator=(rhs);
- return *this;
+ return *this;
}
-CompactDecimalFormat* CompactDecimalFormat::clone() const {
- return new CompactDecimalFormat(*this);
+CompactDecimalFormat* CompactDecimalFormat::clone() const {
+ return new CompactDecimalFormat(*this);
}
void
CompactDecimalFormat::parse(
- const UnicodeString& /* text */,
- Formattable& /* result */,
- ParsePosition& /* parsePosition */) const {
+ const UnicodeString& /* text */,
+ Formattable& /* result */,
+ ParsePosition& /* parsePosition */) const {
}
void
CompactDecimalFormat::parse(
- const UnicodeString& /* text */,
- Formattable& /* result */,
- UErrorCode& status) const {
- status = U_UNSUPPORTED_ERROR;
+ const UnicodeString& /* text */,
+ Formattable& /* result */,
+ UErrorCode& status) const {
+ status = U_UNSUPPORTED_ERROR;
}
CurrencyAmount*
CompactDecimalFormat::parseCurrency(
- const UnicodeString& /* text */,
- ParsePosition& /* pos */) const {
- return nullptr;
+ const UnicodeString& /* text */,
+ ParsePosition& /* pos */) const {
+ return nullptr;
}
-#endif /* #if !UCONFIG_NO_FORMATTING */
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/coptccal.cpp b/contrib/libs/icu/i18n/coptccal.cpp
index 2e46dd1e0d..9c2b1ebbb7 100644
--- a/contrib/libs/icu/i18n/coptccal.cpp
+++ b/contrib/libs/icu/i18n/coptccal.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -40,7 +40,7 @@ CopticCalendar::~CopticCalendar()
{
}
-CopticCalendar*
+CopticCalendar*
CopticCalendar::clone() const
{
return new CopticCalendar(*this);
diff --git a/contrib/libs/icu/i18n/coptccal.h b/contrib/libs/icu/i18n/coptccal.h
index eca1ad73df..e9e812dbc7 100644
--- a/contrib/libs/icu/i18n/coptccal.h
+++ b/contrib/libs/icu/i18n/coptccal.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -145,7 +145,7 @@ public:
* @return return a polymorphic copy of this calendar.
* @internal
*/
- virtual CopticCalendar* clone() const;
+ virtual CopticCalendar* clone() const;
/**
* return the calendar type, "coptic"
diff --git a/contrib/libs/icu/i18n/cpdtrans.cpp b/contrib/libs/icu/i18n/cpdtrans.cpp
index e882faa598..82ee54a77b 100644
--- a/contrib/libs/icu/i18n/cpdtrans.cpp
+++ b/contrib/libs/icu/i18n/cpdtrans.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -323,7 +323,7 @@ CompoundTransliterator& CompoundTransliterator::operator=(
/**
* Transliterator API.
*/
-CompoundTransliterator* CompoundTransliterator::clone() const {
+CompoundTransliterator* CompoundTransliterator::clone() const {
return new CompoundTransliterator(*this);
}
diff --git a/contrib/libs/icu/i18n/cpdtrans.h b/contrib/libs/icu/i18n/cpdtrans.h
index efbabcf0f3..a2c7abbd69 100644
--- a/contrib/libs/icu/i18n/cpdtrans.h
+++ b/contrib/libs/icu/i18n/cpdtrans.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -98,7 +98,7 @@ public:
/**
* Transliterator API.
*/
- virtual CompoundTransliterator* clone() const;
+ virtual CompoundTransliterator* clone() const;
/**
* Returns the number of transliterators in this chain.
diff --git a/contrib/libs/icu/i18n/csdetect.cpp b/contrib/libs/icu/i18n/csdetect.cpp
index 29bec6aba2..babb308430 100644
--- a/contrib/libs/icu/i18n/csdetect.cpp
+++ b/contrib/libs/icu/i18n/csdetect.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -36,9 +36,9 @@ U_NAMESPACE_BEGIN
struct CSRecognizerInfo : public UMemory {
CSRecognizerInfo(CharsetRecognizer *recognizer, UBool isDefaultEnabled)
- : recognizer(recognizer), isDefaultEnabled(isDefaultEnabled) {}
+ : recognizer(recognizer), isDefaultEnabled(isDefaultEnabled) {}
- ~CSRecognizerInfo() {delete recognizer;}
+ ~CSRecognizerInfo() {delete recognizer;}
CharsetRecognizer *recognizer;
UBool isDefaultEnabled;
@@ -47,7 +47,7 @@ struct CSRecognizerInfo : public UMemory {
U_NAMESPACE_END
static icu::CSRecognizerInfo **fCSRecognizers = NULL;
-static icu::UInitOnce gCSRecognizersInitOnce = U_INITONCE_INITIALIZER;
+static icu::UInitOnce gCSRecognizersInitOnce = U_INITONCE_INITIALIZER;
static int32_t fCSRecognizers_size = 0;
U_CDECL_BEGIN
diff --git a/contrib/libs/icu/i18n/csdetect.h b/contrib/libs/icu/i18n/csdetect.h
index c00f909882..d4bfa75eef 100644
--- a/contrib/libs/icu/i18n/csdetect.h
+++ b/contrib/libs/icu/i18n/csdetect.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/csmatch.cpp b/contrib/libs/icu/i18n/csmatch.cpp
index 0a7680f46a..83bf531665 100644
--- a/contrib/libs/icu/i18n/csmatch.cpp
+++ b/contrib/libs/icu/i18n/csmatch.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/csmatch.h b/contrib/libs/icu/i18n/csmatch.h
index de4e715221..fe379ceea7 100644
--- a/contrib/libs/icu/i18n/csmatch.h
+++ b/contrib/libs/icu/i18n/csmatch.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/csr2022.cpp b/contrib/libs/icu/i18n/csr2022.cpp
index c6c8191923..ff26e5e911 100644
--- a/contrib/libs/icu/i18n/csr2022.cpp
+++ b/contrib/libs/icu/i18n/csr2022.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/csr2022.h b/contrib/libs/icu/i18n/csr2022.h
index 513ef934a6..cde9019b46 100644
--- a/contrib/libs/icu/i18n/csr2022.h
+++ b/contrib/libs/icu/i18n/csr2022.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/csrecog.cpp b/contrib/libs/icu/i18n/csrecog.cpp
index ce4c180f74..31fce5dd01 100644
--- a/contrib/libs/icu/i18n/csrecog.cpp
+++ b/contrib/libs/icu/i18n/csrecog.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/csrecog.h b/contrib/libs/icu/i18n/csrecog.h
index 443808eff4..713fd4e86b 100644
--- a/contrib/libs/icu/i18n/csrecog.h
+++ b/contrib/libs/icu/i18n/csrecog.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/csrmbcs.cpp b/contrib/libs/icu/i18n/csrmbcs.cpp
index d7cc30d317..5579ba8ec3 100644
--- a/contrib/libs/icu/i18n/csrmbcs.cpp
+++ b/contrib/libs/icu/i18n/csrmbcs.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -166,7 +166,7 @@ int32_t CharsetRecog_mbcs::match_mbcs(InputText *det, const uint16_t commonChars
doubleByteCharCount++;
if (commonChars != 0) {
- if (binarySearch(commonChars, commonCharsLen, static_cast<uint16_t>(iter.charValue)) >= 0){
+ if (binarySearch(commonChars, commonCharsLen, static_cast<uint16_t>(iter.charValue)) >= 0){
commonCharCount += 1;
}
}
diff --git a/contrib/libs/icu/i18n/csrmbcs.h b/contrib/libs/icu/i18n/csrmbcs.h
index ea0eb1be31..8ccf1d56a9 100644
--- a/contrib/libs/icu/i18n/csrmbcs.h
+++ b/contrib/libs/icu/i18n/csrmbcs.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/csrsbcs.cpp b/contrib/libs/icu/i18n/csrsbcs.cpp
index 3d373507fd..0b0d8967e7 100644
--- a/contrib/libs/icu/i18n/csrsbcs.cpp
+++ b/contrib/libs/icu/i18n/csrsbcs.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/csrsbcs.h b/contrib/libs/icu/i18n/csrsbcs.h
index 27102ba53e..9768783679 100644
--- a/contrib/libs/icu/i18n/csrsbcs.h
+++ b/contrib/libs/icu/i18n/csrsbcs.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/csrucode.cpp b/contrib/libs/icu/i18n/csrucode.cpp
index d02681ca73..59f2dbe284 100644
--- a/contrib/libs/icu/i18n/csrucode.cpp
+++ b/contrib/libs/icu/i18n/csrucode.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/csrucode.h b/contrib/libs/icu/i18n/csrucode.h
index ed7562db83..cef35447fb 100644
--- a/contrib/libs/icu/i18n/csrucode.h
+++ b/contrib/libs/icu/i18n/csrucode.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/csrutf8.cpp b/contrib/libs/icu/i18n/csrutf8.cpp
index 64b8781256..b42bd8b39e 100644
--- a/contrib/libs/icu/i18n/csrutf8.cpp
+++ b/contrib/libs/icu/i18n/csrutf8.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/csrutf8.h b/contrib/libs/icu/i18n/csrutf8.h
index fb4eebe5ab..6089eb6f75 100644
--- a/contrib/libs/icu/i18n/csrutf8.h
+++ b/contrib/libs/icu/i18n/csrutf8.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/curramt.cpp b/contrib/libs/icu/i18n/curramt.cpp
index cf6929d99f..6fd2ea2fda 100644
--- a/contrib/libs/icu/i18n/curramt.cpp
+++ b/contrib/libs/icu/i18n/curramt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -19,12 +19,12 @@
U_NAMESPACE_BEGIN
-CurrencyAmount::CurrencyAmount(const Formattable& amount, ConstChar16Ptr isoCode,
+CurrencyAmount::CurrencyAmount(const Formattable& amount, ConstChar16Ptr isoCode,
UErrorCode& ec) :
Measure(amount, new CurrencyUnit(isoCode, ec), ec) {
}
-CurrencyAmount::CurrencyAmount(double amount, ConstChar16Ptr isoCode,
+CurrencyAmount::CurrencyAmount(double amount, ConstChar16Ptr isoCode,
UErrorCode& ec) :
Measure(Formattable(amount), new CurrencyUnit(isoCode, ec), ec) {
}
@@ -38,7 +38,7 @@ CurrencyAmount& CurrencyAmount::operator=(const CurrencyAmount& other) {
return *this;
}
-CurrencyAmount* CurrencyAmount::clone() const {
+CurrencyAmount* CurrencyAmount::clone() const {
return new CurrencyAmount(*this);
}
diff --git a/contrib/libs/icu/i18n/currfmt.cpp b/contrib/libs/icu/i18n/currfmt.cpp
index c553f03f6f..0ad0492ee7 100644
--- a/contrib/libs/icu/i18n/currfmt.cpp
+++ b/contrib/libs/icu/i18n/currfmt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -21,19 +21,19 @@
U_NAMESPACE_BEGIN
CurrencyFormat::CurrencyFormat(const Locale& locale, UErrorCode& ec) :
- MeasureFormat(locale, UMEASFMT_WIDTH_WIDE, ec)
+ MeasureFormat(locale, UMEASFMT_WIDTH_WIDE, ec)
{
}
CurrencyFormat::CurrencyFormat(const CurrencyFormat& other) :
- MeasureFormat(other)
+ MeasureFormat(other)
{
}
CurrencyFormat::~CurrencyFormat() {
}
-CurrencyFormat* CurrencyFormat::clone() const {
+CurrencyFormat* CurrencyFormat::clone() const {
return new CurrencyFormat(*this);
}
@@ -42,14 +42,14 @@ UnicodeString& CurrencyFormat::format(const Formattable& obj,
FieldPosition& pos,
UErrorCode& ec) const
{
- return getCurrencyFormatInternal().format(obj, appendTo, pos, ec);
+ return getCurrencyFormatInternal().format(obj, appendTo, pos, ec);
}
void CurrencyFormat::parseObject(const UnicodeString& source,
Formattable& result,
ParsePosition& pos) const
{
- CurrencyAmount* currAmt = getCurrencyFormatInternal().parseCurrency(source, pos);
+ CurrencyAmount* currAmt = getCurrencyFormatInternal().parseCurrency(source, pos);
if (currAmt != NULL) {
result.adoptObject(currAmt);
}
diff --git a/contrib/libs/icu/i18n/currfmt.h b/contrib/libs/icu/i18n/currfmt.h
index 70f2d17f0c..69a031957b 100644
--- a/contrib/libs/icu/i18n/currfmt.h
+++ b/contrib/libs/icu/i18n/currfmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -57,7 +57,7 @@ class CurrencyFormat : public MeasureFormat {
/**
* Override Format API.
*/
- virtual CurrencyFormat* clone() const;
+ virtual CurrencyFormat* clone() const;
using MeasureFormat::format;
diff --git a/contrib/libs/icu/i18n/currpinf.cpp b/contrib/libs/icu/i18n/currpinf.cpp
index ab5a199d58..af9c837af8 100644
--- a/contrib/libs/icu/i18n/currpinf.cpp
+++ b/contrib/libs/icu/i18n/currpinf.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -19,7 +19,7 @@
#include "unicode/locid.h"
#include "unicode/plurrule.h"
-#include "unicode/strenum.h"
+#include "unicode/strenum.h"
#include "unicode/ures.h"
#include "unicode/numsys.h"
#include "cstring.h"
@@ -63,27 +63,27 @@ static const char gDecimalFormatTag[]="decimalFormat";
static const char gCurrUnitPtnTag[]="CurrencyUnitPatterns";
CurrencyPluralInfo::CurrencyPluralInfo(UErrorCode& status)
-: fPluralCountToCurrencyUnitPattern(nullptr),
- fPluralRules(nullptr),
- fLocale(nullptr),
- fInternalStatus(U_ZERO_ERROR) {
+: fPluralCountToCurrencyUnitPattern(nullptr),
+ fPluralRules(nullptr),
+ fLocale(nullptr),
+ fInternalStatus(U_ZERO_ERROR) {
initialize(Locale::getDefault(), status);
}
CurrencyPluralInfo::CurrencyPluralInfo(const Locale& locale, UErrorCode& status)
-: fPluralCountToCurrencyUnitPattern(nullptr),
- fPluralRules(nullptr),
- fLocale(nullptr),
- fInternalStatus(U_ZERO_ERROR) {
+: fPluralCountToCurrencyUnitPattern(nullptr),
+ fPluralRules(nullptr),
+ fLocale(nullptr),
+ fInternalStatus(U_ZERO_ERROR) {
initialize(locale, status);
}
CurrencyPluralInfo::CurrencyPluralInfo(const CurrencyPluralInfo& info)
: UObject(info),
- fPluralCountToCurrencyUnitPattern(nullptr),
- fPluralRules(nullptr),
- fLocale(nullptr),
- fInternalStatus(U_ZERO_ERROR) {
+ fPluralCountToCurrencyUnitPattern(nullptr),
+ fPluralRules(nullptr),
+ fLocale(nullptr),
+ fInternalStatus(U_ZERO_ERROR) {
*this = info;
}
@@ -93,56 +93,56 @@ CurrencyPluralInfo::operator=(const CurrencyPluralInfo& info) {
return *this;
}
- fInternalStatus = info.fInternalStatus;
- if (U_FAILURE(fInternalStatus)) {
- // bail out early if the object we were copying from was already 'invalid'.
- return *this;
- }
-
+ fInternalStatus = info.fInternalStatus;
+ if (U_FAILURE(fInternalStatus)) {
+ // bail out early if the object we were copying from was already 'invalid'.
+ return *this;
+ }
+
deleteHash(fPluralCountToCurrencyUnitPattern);
- fPluralCountToCurrencyUnitPattern = initHash(fInternalStatus);
+ fPluralCountToCurrencyUnitPattern = initHash(fInternalStatus);
copyHash(info.fPluralCountToCurrencyUnitPattern,
- fPluralCountToCurrencyUnitPattern, fInternalStatus);
- if ( U_FAILURE(fInternalStatus) ) {
+ fPluralCountToCurrencyUnitPattern, fInternalStatus);
+ if ( U_FAILURE(fInternalStatus) ) {
return *this;
}
delete fPluralRules;
- fPluralRules = nullptr;
+ fPluralRules = nullptr;
delete fLocale;
- fLocale = nullptr;
-
- if (info.fPluralRules != nullptr) {
+ fLocale = nullptr;
+
+ if (info.fPluralRules != nullptr) {
fPluralRules = info.fPluralRules->clone();
- if (fPluralRules == nullptr) {
- fInternalStatus = U_MEMORY_ALLOCATION_ERROR;
- return *this;
- }
+ if (fPluralRules == nullptr) {
+ fInternalStatus = U_MEMORY_ALLOCATION_ERROR;
+ return *this;
+ }
}
- if (info.fLocale != nullptr) {
+ if (info.fLocale != nullptr) {
fLocale = info.fLocale->clone();
- if (fLocale == nullptr) {
- // Note: If clone had an error parameter, then we could check/set that instead.
- fInternalStatus = U_MEMORY_ALLOCATION_ERROR;
- return *this;
- }
- // If the other locale wasn't bogus, but our clone'd locale is bogus, then OOM happened
- // during the call to clone().
- if (!info.fLocale->isBogus() && fLocale->isBogus()) {
- fInternalStatus = U_MEMORY_ALLOCATION_ERROR;
- return *this;
- }
+ if (fLocale == nullptr) {
+ // Note: If clone had an error parameter, then we could check/set that instead.
+ fInternalStatus = U_MEMORY_ALLOCATION_ERROR;
+ return *this;
+ }
+ // If the other locale wasn't bogus, but our clone'd locale is bogus, then OOM happened
+ // during the call to clone().
+ if (!info.fLocale->isBogus() && fLocale->isBogus()) {
+ fInternalStatus = U_MEMORY_ALLOCATION_ERROR;
+ return *this;
+ }
}
return *this;
}
CurrencyPluralInfo::~CurrencyPluralInfo() {
deleteHash(fPluralCountToCurrencyUnitPattern);
- fPluralCountToCurrencyUnitPattern = nullptr;
+ fPluralCountToCurrencyUnitPattern = nullptr;
delete fPluralRules;
delete fLocale;
- fPluralRules = nullptr;
- fLocale = nullptr;
+ fPluralRules = nullptr;
+ fLocale = nullptr;
}
UBool
@@ -166,14 +166,14 @@ CurrencyPluralInfo::operator==(const CurrencyPluralInfo& info) const {
CurrencyPluralInfo*
CurrencyPluralInfo::clone() const {
- CurrencyPluralInfo* newObj = new CurrencyPluralInfo(*this);
- // Since clone doesn't have a 'status' parameter, the best we can do is return nullptr
- // if the new object was not full constructed properly (an error occurred).
- if (newObj != nullptr && U_FAILURE(newObj->fInternalStatus)) {
- delete newObj;
- newObj = nullptr;
- }
- return newObj;
+ CurrencyPluralInfo* newObj = new CurrencyPluralInfo(*this);
+ // Since clone doesn't have a 'status' parameter, the best we can do is return nullptr
+ // if the new object was not full constructed properly (an error occurred).
+ if (newObj != nullptr && U_FAILURE(newObj->fInternalStatus)) {
+ delete newObj;
+ newObj = nullptr;
+ }
+ return newObj;
}
const PluralRules*
@@ -186,15 +186,15 @@ CurrencyPluralInfo::getCurrencyPluralPattern(const UnicodeString& pluralCount,
UnicodeString& result) const {
const UnicodeString* currencyPluralPattern =
(UnicodeString*)fPluralCountToCurrencyUnitPattern->get(pluralCount);
- if (currencyPluralPattern == nullptr) {
+ if (currencyPluralPattern == nullptr) {
// fall back to "other"
if (pluralCount.compare(gPluralCountOther, 5)) {
currencyPluralPattern =
(UnicodeString*)fPluralCountToCurrencyUnitPattern->get(UnicodeString(TRUE, gPluralCountOther, 5));
}
- if (currencyPluralPattern == nullptr) {
+ if (currencyPluralPattern == nullptr) {
// no currencyUnitPatterns defined,
- // fallback to predefined default.
+ // fallback to predefined default.
// This should never happen when ICU resource files are
// available, since currencyUnitPattern of "other" is always
// defined in root.
@@ -215,7 +215,7 @@ void
CurrencyPluralInfo::setPluralRules(const UnicodeString& ruleDescription,
UErrorCode& status) {
if (U_SUCCESS(status)) {
- delete fPluralRules;
+ delete fPluralRules;
fPluralRules = PluralRules::createRules(ruleDescription, status);
}
}
@@ -225,15 +225,15 @@ CurrencyPluralInfo::setCurrencyPluralPattern(const UnicodeString& pluralCount,
const UnicodeString& pattern,
UErrorCode& status) {
if (U_SUCCESS(status)) {
- UnicodeString* oldValue = static_cast<UnicodeString*>(
- fPluralCountToCurrencyUnitPattern->get(pluralCount));
- delete oldValue;
- LocalPointer<UnicodeString> p(new UnicodeString(pattern), status);
- if (U_SUCCESS(status)) {
- // the p object allocated above will be owned by fPluralCountToCurrencyUnitPattern
- // after the call to put(), even if the method returns failure.
- fPluralCountToCurrencyUnitPattern->put(pluralCount, p.orphan(), status);
- }
+ UnicodeString* oldValue = static_cast<UnicodeString*>(
+ fPluralCountToCurrencyUnitPattern->get(pluralCount));
+ delete oldValue;
+ LocalPointer<UnicodeString> p(new UnicodeString(pattern), status);
+ if (U_SUCCESS(status)) {
+ // the p object allocated above will be owned by fPluralCountToCurrencyUnitPattern
+ // after the call to put(), even if the method returns failure.
+ fPluralCountToCurrencyUnitPattern->put(pluralCount, p.orphan(), status);
+ }
}
}
@@ -248,21 +248,21 @@ CurrencyPluralInfo::initialize(const Locale& loc, UErrorCode& status) {
return;
}
delete fLocale;
- fLocale = nullptr;
- delete fPluralRules;
- fPluralRules = nullptr;
-
+ fLocale = nullptr;
+ delete fPluralRules;
+ fPluralRules = nullptr;
+
fLocale = loc.clone();
- if (fLocale == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
+ if (fLocale == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ // If the locale passed in wasn't bogus, but our clone'd locale is bogus, then OOM happened
+ // during the call to loc.clone().
+ if (!loc.isBogus() && fLocale->isBogus()) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
}
- // If the locale passed in wasn't bogus, but our clone'd locale is bogus, then OOM happened
- // during the call to loc.clone().
- if (!loc.isBogus() && fLocale->isBogus()) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
fPluralRules = PluralRules::forLocale(loc, status);
setupCurrencyPluralPattern(loc, status);
}
@@ -273,32 +273,32 @@ CurrencyPluralInfo::setupCurrencyPluralPattern(const Locale& loc, UErrorCode& st
return;
}
- deleteHash(fPluralCountToCurrencyUnitPattern);
+ deleteHash(fPluralCountToCurrencyUnitPattern);
fPluralCountToCurrencyUnitPattern = initHash(status);
if (U_FAILURE(status)) {
return;
}
- LocalPointer<NumberingSystem> ns(NumberingSystem::createInstance(loc, status), status);
- if (U_FAILURE(status)) {
- return;
- }
+ LocalPointer<NumberingSystem> ns(NumberingSystem::createInstance(loc, status), status);
+ if (U_FAILURE(status)) {
+ return;
+ }
UErrorCode ec = U_ZERO_ERROR;
- LocalUResourceBundlePointer rb(ures_open(nullptr, loc.getName(), &ec));
- LocalUResourceBundlePointer numElements(ures_getByKeyWithFallback(rb.getAlias(), gNumberElementsTag, nullptr, &ec));
- ures_getByKeyWithFallback(numElements.getAlias(), ns->getName(), rb.getAlias(), &ec);
- ures_getByKeyWithFallback(rb.getAlias(), gPatternsTag, rb.getAlias(), &ec);
+ LocalUResourceBundlePointer rb(ures_open(nullptr, loc.getName(), &ec));
+ LocalUResourceBundlePointer numElements(ures_getByKeyWithFallback(rb.getAlias(), gNumberElementsTag, nullptr, &ec));
+ ures_getByKeyWithFallback(numElements.getAlias(), ns->getName(), rb.getAlias(), &ec);
+ ures_getByKeyWithFallback(rb.getAlias(), gPatternsTag, rb.getAlias(), &ec);
int32_t ptnLen;
- const UChar* numberStylePattern = ures_getStringByKeyWithFallback(rb.getAlias(), gDecimalFormatTag, &ptnLen, &ec);
+ const UChar* numberStylePattern = ures_getStringByKeyWithFallback(rb.getAlias(), gDecimalFormatTag, &ptnLen, &ec);
// Fall back to "latn" if num sys specific pattern isn't there.
- if ( ec == U_MISSING_RESOURCE_ERROR && (uprv_strcmp(ns->getName(), gLatnTag) != 0)) {
+ if ( ec == U_MISSING_RESOURCE_ERROR && (uprv_strcmp(ns->getName(), gLatnTag) != 0)) {
ec = U_ZERO_ERROR;
- ures_getByKeyWithFallback(numElements.getAlias(), gLatnTag, rb.getAlias(), &ec);
- ures_getByKeyWithFallback(rb.getAlias(), gPatternsTag, rb.getAlias(), &ec);
- numberStylePattern = ures_getStringByKeyWithFallback(rb.getAlias(), gDecimalFormatTag, &ptnLen, &ec);
+ ures_getByKeyWithFallback(numElements.getAlias(), gLatnTag, rb.getAlias(), &ec);
+ ures_getByKeyWithFallback(rb.getAlias(), gPatternsTag, rb.getAlias(), &ec);
+ numberStylePattern = ures_getStringByKeyWithFallback(rb.getAlias(), gDecimalFormatTag, &ptnLen, &ec);
}
int32_t numberStylePatternLen = ptnLen;
- const UChar* negNumberStylePattern = nullptr;
+ const UChar* negNumberStylePattern = nullptr;
int32_t negNumberStylePatternLen = 0;
// TODO: Java
// parse to check whether there is ";" separator in the numberStylePattern
@@ -316,122 +316,122 @@ CurrencyPluralInfo::setupCurrencyPluralPattern(const Locale& loc, UErrorCode& st
}
if (U_FAILURE(ec)) {
- // If OOM occurred during the above code, then we want to report that back to the caller.
- if (ec == U_MEMORY_ALLOCATION_ERROR) {
- status = ec;
- }
+ // If OOM occurred during the above code, then we want to report that back to the caller.
+ if (ec == U_MEMORY_ALLOCATION_ERROR) {
+ status = ec;
+ }
return;
}
- LocalUResourceBundlePointer currRb(ures_open(U_ICUDATA_CURR, loc.getName(), &ec));
- LocalUResourceBundlePointer currencyRes(ures_getByKeyWithFallback(currRb.getAlias(), gCurrUnitPtnTag, nullptr, &ec));
+ LocalUResourceBundlePointer currRb(ures_open(U_ICUDATA_CURR, loc.getName(), &ec));
+ LocalUResourceBundlePointer currencyRes(ures_getByKeyWithFallback(currRb.getAlias(), gCurrUnitPtnTag, nullptr, &ec));
#ifdef CURRENCY_PLURAL_INFO_DEBUG
std::cout << "in set up\n";
#endif
- LocalPointer<StringEnumeration> keywords(fPluralRules->getKeywords(ec), ec);
+ LocalPointer<StringEnumeration> keywords(fPluralRules->getKeywords(ec), ec);
if (U_SUCCESS(ec)) {
const char* pluralCount;
- while (((pluralCount = keywords->next(nullptr, ec)) != nullptr) && U_SUCCESS(ec)) {
- int32_t ptnLength;
- UErrorCode err = U_ZERO_ERROR;
- const UChar* patternChars = ures_getStringByKeyWithFallback(currencyRes.getAlias(), pluralCount, &ptnLength, &err);
- if (err == U_MEMORY_ALLOCATION_ERROR || patternChars == nullptr) {
- ec = err;
- break;
- }
- if (U_SUCCESS(err) && ptnLength > 0) {
- UnicodeString* pattern = new UnicodeString(patternChars, ptnLength);
- if (pattern == nullptr) {
- ec = U_MEMORY_ALLOCATION_ERROR;
- break;
- }
+ while (((pluralCount = keywords->next(nullptr, ec)) != nullptr) && U_SUCCESS(ec)) {
+ int32_t ptnLength;
+ UErrorCode err = U_ZERO_ERROR;
+ const UChar* patternChars = ures_getStringByKeyWithFallback(currencyRes.getAlias(), pluralCount, &ptnLength, &err);
+ if (err == U_MEMORY_ALLOCATION_ERROR || patternChars == nullptr) {
+ ec = err;
+ break;
+ }
+ if (U_SUCCESS(err) && ptnLength > 0) {
+ UnicodeString* pattern = new UnicodeString(patternChars, ptnLength);
+ if (pattern == nullptr) {
+ ec = U_MEMORY_ALLOCATION_ERROR;
+ break;
+ }
#ifdef CURRENCY_PLURAL_INFO_DEBUG
- char result_1[1000];
- pattern->extract(0, pattern->length(), result_1, "UTF-8");
- std::cout << "pluralCount: " << pluralCount << "; pattern: " << result_1 << "\n";
+ char result_1[1000];
+ pattern->extract(0, pattern->length(), result_1, "UTF-8");
+ std::cout << "pluralCount: " << pluralCount << "; pattern: " << result_1 << "\n";
#endif
- pattern->findAndReplace(UnicodeString(TRUE, gPart0, 3),
- UnicodeString(numberStylePattern, numberStylePatternLen));
- pattern->findAndReplace(UnicodeString(TRUE, gPart1, 3), UnicodeString(TRUE, gTripleCurrencySign, 3));
-
- if (hasSeparator) {
- UnicodeString negPattern(patternChars, ptnLength);
- negPattern.findAndReplace(UnicodeString(TRUE, gPart0, 3),
- UnicodeString(negNumberStylePattern, negNumberStylePatternLen));
- negPattern.findAndReplace(UnicodeString(TRUE, gPart1, 3), UnicodeString(TRUE, gTripleCurrencySign, 3));
- pattern->append(gNumberPatternSeparator);
- pattern->append(negPattern);
- }
+ pattern->findAndReplace(UnicodeString(TRUE, gPart0, 3),
+ UnicodeString(numberStylePattern, numberStylePatternLen));
+ pattern->findAndReplace(UnicodeString(TRUE, gPart1, 3), UnicodeString(TRUE, gTripleCurrencySign, 3));
+
+ if (hasSeparator) {
+ UnicodeString negPattern(patternChars, ptnLength);
+ negPattern.findAndReplace(UnicodeString(TRUE, gPart0, 3),
+ UnicodeString(negNumberStylePattern, negNumberStylePatternLen));
+ negPattern.findAndReplace(UnicodeString(TRUE, gPart1, 3), UnicodeString(TRUE, gTripleCurrencySign, 3));
+ pattern->append(gNumberPatternSeparator);
+ pattern->append(negPattern);
+ }
#ifdef CURRENCY_PLURAL_INFO_DEBUG
- pattern->extract(0, pattern->length(), result_1, "UTF-8");
- std::cout << "pluralCount: " << pluralCount << "; pattern: " << result_1 << "\n";
+ pattern->extract(0, pattern->length(), result_1, "UTF-8");
+ std::cout << "pluralCount: " << pluralCount << "; pattern: " << result_1 << "\n";
#endif
- // the 'pattern' object allocated above will be owned by the fPluralCountToCurrencyUnitPattern after the call to
- // put(), even if the method returns failure.
- fPluralCountToCurrencyUnitPattern->put(UnicodeString(pluralCount, -1, US_INV), pattern, status);
+ // the 'pattern' object allocated above will be owned by the fPluralCountToCurrencyUnitPattern after the call to
+ // put(), even if the method returns failure.
+ fPluralCountToCurrencyUnitPattern->put(UnicodeString(pluralCount, -1, US_INV), pattern, status);
}
}
}
- // If OOM occurred during the above code, then we want to report that back to the caller.
- if (ec == U_MEMORY_ALLOCATION_ERROR) {
- status = ec;
- }
+ // If OOM occurred during the above code, then we want to report that back to the caller.
+ if (ec == U_MEMORY_ALLOCATION_ERROR) {
+ status = ec;
+ }
}
void
-CurrencyPluralInfo::deleteHash(Hashtable* hTable) {
- if ( hTable == nullptr ) {
+CurrencyPluralInfo::deleteHash(Hashtable* hTable) {
+ if ( hTable == nullptr ) {
return;
}
int32_t pos = UHASH_FIRST;
- const UHashElement* element = nullptr;
- while ( (element = hTable->nextElement(pos)) != nullptr ) {
+ const UHashElement* element = nullptr;
+ while ( (element = hTable->nextElement(pos)) != nullptr ) {
const UHashTok valueTok = element->value;
const UnicodeString* value = (UnicodeString*)valueTok.pointer;
delete value;
}
delete hTable;
- hTable = nullptr;
+ hTable = nullptr;
}
Hashtable*
CurrencyPluralInfo::initHash(UErrorCode& status) {
- if (U_FAILURE(status)) {
- return nullptr;
+ if (U_FAILURE(status)) {
+ return nullptr;
}
- LocalPointer<Hashtable> hTable(new Hashtable(TRUE, status), status);
- if (U_FAILURE(status)) {
- return nullptr;
+ LocalPointer<Hashtable> hTable(new Hashtable(TRUE, status), status);
+ if (U_FAILURE(status)) {
+ return nullptr;
}
hTable->setValueComparator(ValueComparator);
- return hTable.orphan();
+ return hTable.orphan();
}
void
CurrencyPluralInfo::copyHash(const Hashtable* source,
Hashtable* target,
UErrorCode& status) {
- if (U_FAILURE(status)) {
+ if (U_FAILURE(status)) {
return;
}
int32_t pos = UHASH_FIRST;
- const UHashElement* element = nullptr;
- if (source) {
- while ( (element = source->nextElement(pos)) != nullptr ) {
+ const UHashElement* element = nullptr;
+ if (source) {
+ while ( (element = source->nextElement(pos)) != nullptr ) {
const UHashTok keyTok = element->key;
const UnicodeString* key = (UnicodeString*)keyTok.pointer;
const UHashTok valueTok = element->value;
const UnicodeString* value = (UnicodeString*)valueTok.pointer;
- LocalPointer<UnicodeString> copy(new UnicodeString(*value), status);
- if (U_FAILURE(status)) {
+ LocalPointer<UnicodeString> copy(new UnicodeString(*value), status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ // The HashTable owns the 'copy' object after the call to put().
+ target->put(UnicodeString(*key), copy.orphan(), status);
+ if (U_FAILURE(status)) {
return;
}
- // The HashTable owns the 'copy' object after the call to put().
- target->put(UnicodeString(*key), copy.orphan(), status);
- if (U_FAILURE(status)) {
- return;
- }
}
}
}
diff --git a/contrib/libs/icu/i18n/currunit.cpp b/contrib/libs/icu/i18n/currunit.cpp
index 041653972e..92bcf1268a 100644
--- a/contrib/libs/icu/i18n/currunit.cpp
+++ b/contrib/libs/icu/i18n/currunit.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -16,93 +16,93 @@
#include "unicode/currunit.h"
#include "unicode/ustring.h"
-#include "unicode/uchar.h"
-#include "cstring.h"
-#include "uinvchar.h"
-#include "charstr.h"
-#include "ustr_imp.h"
-#include "measunit_impl.h"
+#include "unicode/uchar.h"
+#include "cstring.h"
+#include "uinvchar.h"
+#include "charstr.h"
+#include "ustr_imp.h"
+#include "measunit_impl.h"
U_NAMESPACE_BEGIN
-CurrencyUnit::CurrencyUnit(ConstChar16Ptr _isoCode, UErrorCode& ec) {
- // The constructor always leaves the CurrencyUnit in a valid state (with a 3-character currency code).
- // Note: in ICU4J Currency.getInstance(), we check string length for 3, but in ICU4C we allow a
- // non-NUL-terminated string to be passed as an argument, so it is not possible to check length.
- // However, we allow a NUL-terminated empty string, which should have the same behavior as nullptr.
- // Consider NUL-terminated strings of length 1 or 2 as invalid.
- bool useDefault = false;
- if (U_FAILURE(ec) || _isoCode == nullptr || _isoCode[0] == 0) {
- useDefault = true;
- } else if (_isoCode[1] == 0 || _isoCode[2] == 0) {
- useDefault = true;
- ec = U_ILLEGAL_ARGUMENT_ERROR;
- } else if (!uprv_isInvariantUString(_isoCode, 3)) {
- // TODO: Perform a more strict ASCII check like in ICU4J isAlpha3Code?
- useDefault = true;
- ec = U_INVARIANT_CONVERSION_ERROR;
- } else {
- for (int32_t i=0; i<3; i++) {
- isoCode[i] = u_asciiToUpper(_isoCode[i]);
+CurrencyUnit::CurrencyUnit(ConstChar16Ptr _isoCode, UErrorCode& ec) {
+ // The constructor always leaves the CurrencyUnit in a valid state (with a 3-character currency code).
+ // Note: in ICU4J Currency.getInstance(), we check string length for 3, but in ICU4C we allow a
+ // non-NUL-terminated string to be passed as an argument, so it is not possible to check length.
+ // However, we allow a NUL-terminated empty string, which should have the same behavior as nullptr.
+ // Consider NUL-terminated strings of length 1 or 2 as invalid.
+ bool useDefault = false;
+ if (U_FAILURE(ec) || _isoCode == nullptr || _isoCode[0] == 0) {
+ useDefault = true;
+ } else if (_isoCode[1] == 0 || _isoCode[2] == 0) {
+ useDefault = true;
+ ec = U_ILLEGAL_ARGUMENT_ERROR;
+ } else if (!uprv_isInvariantUString(_isoCode, 3)) {
+ // TODO: Perform a more strict ASCII check like in ICU4J isAlpha3Code?
+ useDefault = true;
+ ec = U_INVARIANT_CONVERSION_ERROR;
+ } else {
+ for (int32_t i=0; i<3; i++) {
+ isoCode[i] = u_asciiToUpper(_isoCode[i]);
}
- isoCode[3] = 0;
+ isoCode[3] = 0;
}
- if (useDefault) {
- uprv_memcpy(isoCode, kDefaultCurrency, sizeof(UChar) * 4);
- }
- char simpleIsoCode[4];
- u_UCharsToChars(isoCode, simpleIsoCode, 4);
- initCurrency(simpleIsoCode);
+ if (useDefault) {
+ uprv_memcpy(isoCode, kDefaultCurrency, sizeof(UChar) * 4);
+ }
+ char simpleIsoCode[4];
+ u_UCharsToChars(isoCode, simpleIsoCode, 4);
+ initCurrency(simpleIsoCode);
+}
+
+CurrencyUnit::CurrencyUnit(StringPiece _isoCode, UErrorCode& ec) {
+ // Note: unlike the old constructor, reject empty arguments with an error.
+ char isoCodeBuffer[4];
+ const char* isoCodeToUse;
+ // uprv_memchr checks that the string contains no internal NULs
+ if (_isoCode.length() != 3 || uprv_memchr(_isoCode.data(), 0, 3) != nullptr) {
+ isoCodeToUse = kDefaultCurrency8;
+ ec = U_ILLEGAL_ARGUMENT_ERROR;
+ } else if (!uprv_isInvariantString(_isoCode.data(), 3)) {
+ // TODO: Perform a more strict ASCII check like in ICU4J isAlpha3Code?
+ isoCodeToUse = kDefaultCurrency8;
+ ec = U_INVARIANT_CONVERSION_ERROR;
+ } else {
+ // Have to use isoCodeBuffer to ensure the string is NUL-terminated
+ for (int32_t i=0; i<3; i++) {
+ isoCodeBuffer[i] = uprv_toupper(_isoCode.data()[i]);
+ }
+ isoCodeBuffer[3] = 0;
+ isoCodeToUse = isoCodeBuffer;
+ }
+ u_charsToUChars(isoCodeToUse, isoCode, 4);
+ initCurrency(isoCodeToUse);
}
-CurrencyUnit::CurrencyUnit(StringPiece _isoCode, UErrorCode& ec) {
- // Note: unlike the old constructor, reject empty arguments with an error.
- char isoCodeBuffer[4];
- const char* isoCodeToUse;
- // uprv_memchr checks that the string contains no internal NULs
- if (_isoCode.length() != 3 || uprv_memchr(_isoCode.data(), 0, 3) != nullptr) {
- isoCodeToUse = kDefaultCurrency8;
- ec = U_ILLEGAL_ARGUMENT_ERROR;
- } else if (!uprv_isInvariantString(_isoCode.data(), 3)) {
- // TODO: Perform a more strict ASCII check like in ICU4J isAlpha3Code?
- isoCodeToUse = kDefaultCurrency8;
- ec = U_INVARIANT_CONVERSION_ERROR;
- } else {
- // Have to use isoCodeBuffer to ensure the string is NUL-terminated
- for (int32_t i=0; i<3; i++) {
- isoCodeBuffer[i] = uprv_toupper(_isoCode.data()[i]);
- }
- isoCodeBuffer[3] = 0;
- isoCodeToUse = isoCodeBuffer;
- }
- u_charsToUChars(isoCodeToUse, isoCode, 4);
- initCurrency(isoCodeToUse);
-}
-
-CurrencyUnit::CurrencyUnit(const CurrencyUnit& other) : MeasureUnit(other) {
+CurrencyUnit::CurrencyUnit(const CurrencyUnit& other) : MeasureUnit(other) {
u_strcpy(isoCode, other.isoCode);
}
-CurrencyUnit::CurrencyUnit(const MeasureUnit& other, UErrorCode& ec) : MeasureUnit(other) {
- // Make sure this is a currency.
- // OK to hard-code the string because we are comparing against another hard-coded string.
- if (uprv_strcmp("currency", getType()) != 0) {
- ec = U_ILLEGAL_ARGUMENT_ERROR;
- isoCode[0] = 0;
- } else {
- // Get the ISO Code from the subtype field.
- u_charsToUChars(getSubtype(), isoCode, 4);
- isoCode[3] = 0; // make 100% sure it is NUL-terminated
- }
-}
-
-CurrencyUnit::CurrencyUnit() : MeasureUnit() {
- u_strcpy(isoCode, kDefaultCurrency);
- char simpleIsoCode[4];
- u_UCharsToChars(isoCode, simpleIsoCode, 4);
- initCurrency(simpleIsoCode);
-}
-
+CurrencyUnit::CurrencyUnit(const MeasureUnit& other, UErrorCode& ec) : MeasureUnit(other) {
+ // Make sure this is a currency.
+ // OK to hard-code the string because we are comparing against another hard-coded string.
+ if (uprv_strcmp("currency", getType()) != 0) {
+ ec = U_ILLEGAL_ARGUMENT_ERROR;
+ isoCode[0] = 0;
+ } else {
+ // Get the ISO Code from the subtype field.
+ u_charsToUChars(getSubtype(), isoCode, 4);
+ isoCode[3] = 0; // make 100% sure it is NUL-terminated
+ }
+}
+
+CurrencyUnit::CurrencyUnit() : MeasureUnit() {
+ u_strcpy(isoCode, kDefaultCurrency);
+ char simpleIsoCode[4];
+ u_UCharsToChars(isoCode, simpleIsoCode, 4);
+ initCurrency(simpleIsoCode);
+}
+
CurrencyUnit& CurrencyUnit::operator=(const CurrencyUnit& other) {
if (this == &other) {
return *this;
@@ -112,7 +112,7 @@ CurrencyUnit& CurrencyUnit::operator=(const CurrencyUnit& other) {
return *this;
}
-CurrencyUnit* CurrencyUnit::clone() const {
+CurrencyUnit* CurrencyUnit::clone() const {
return new CurrencyUnit(*this);
}
diff --git a/contrib/libs/icu/i18n/dangical.cpp b/contrib/libs/icu/i18n/dangical.cpp
index 70285744c1..02db40368e 100644
--- a/contrib/libs/icu/i18n/dangical.cpp
+++ b/contrib/libs/icu/i18n/dangical.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -65,7 +65,7 @@ DangiCalendar::~DangiCalendar()
{
}
-DangiCalendar*
+DangiCalendar*
DangiCalendar::clone() const
{
return new DangiCalendar(*this);
diff --git a/contrib/libs/icu/i18n/dangical.h b/contrib/libs/icu/i18n/dangical.h
index a232b58b7c..ece805e36d 100644
--- a/contrib/libs/icu/i18n/dangical.h
+++ b/contrib/libs/icu/i18n/dangical.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************
@@ -66,7 +66,7 @@ class DangiCalendar : public ChineseCalendar {
* Clone.
* @internal
*/
- virtual DangiCalendar* clone() const;
+ virtual DangiCalendar* clone() const;
//----------------------------------------------------------------------
// Internal methods & astronomical calculations
diff --git a/contrib/libs/icu/i18n/datefmt.cpp b/contrib/libs/icu/i18n/datefmt.cpp
index aff92a8845..a0e039cd50 100644
--- a/contrib/libs/icu/i18n/datefmt.cpp
+++ b/contrib/libs/icu/i18n/datefmt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -80,7 +80,7 @@ public:
fSkeleton(other.fSkeleton) { }
virtual ~DateFmtBestPatternKey();
virtual int32_t hashCode() const {
- return (int32_t)(37u * (uint32_t)LocaleCacheKey<DateFmtBestPattern>::hashCode() + (uint32_t)fSkeleton.hashCode());
+ return (int32_t)(37u * (uint32_t)LocaleCacheKey<DateFmtBestPattern>::hashCode() + (uint32_t)fSkeleton.hashCode());
}
virtual UBool operator==(const CacheKeyBase &other) const {
// reflexive
@@ -154,7 +154,7 @@ DateFormat& DateFormat::operator=(const DateFormat& other)
fCalendar = NULL;
}
if(other.fNumberFormat) {
- fNumberFormat = other.fNumberFormat->clone();
+ fNumberFormat = other.fNumberFormat->clone();
} else {
fNumberFormat = NULL;
}
@@ -460,15 +460,15 @@ DateFormat::createInstanceForSkeleton(
status = U_ILLEGAL_ARGUMENT_ERROR;
return NULL;
}
- Locale localeWithCalendar = locale;
- localeWithCalendar.setKeywordValue("calendar", calendar->getType(), status);
+ Locale localeWithCalendar = locale;
+ localeWithCalendar.setKeywordValue("calendar", calendar->getType(), status);
+ if (U_FAILURE(status)) {
+ return NULL;
+ }
+ DateFormat *result = createInstanceForSkeleton(skeleton, localeWithCalendar, status);
if (U_FAILURE(status)) {
return NULL;
}
- DateFormat *result = createInstanceForSkeleton(skeleton, localeWithCalendar, status);
- if (U_FAILURE(status)) {
- return NULL;
- }
result->adoptCalendar(calendar.orphan());
return result;
}
@@ -503,7 +503,7 @@ DateFormat* U_EXPORT2
DateFormat::create(EStyle timeStyle, EStyle dateStyle, const Locale& locale)
{
UErrorCode status = U_ZERO_ERROR;
-#if U_PLATFORM_USES_ONLY_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
char buffer[8];
int32_t count = locale.getKeywordValue("compat", buffer, sizeof(buffer), status);
@@ -591,14 +591,14 @@ DateFormat::adoptNumberFormat(NumberFormat* newNumberFormat)
delete fNumberFormat;
fNumberFormat = newNumberFormat;
newNumberFormat->setParseIntegerOnly(TRUE);
- newNumberFormat->setGroupingUsed(FALSE);
+ newNumberFormat->setGroupingUsed(FALSE);
}
//----------------------------------------------------------------------
void
DateFormat::setNumberFormat(const NumberFormat& newNumberFormat)
{
- NumberFormat* newNumFmtClone = newNumberFormat.clone();
+ NumberFormat* newNumFmtClone = newNumberFormat.clone();
if (newNumFmtClone != NULL) {
adoptNumberFormat(newNumFmtClone);
}
@@ -744,7 +744,7 @@ DateFormat::setBooleanAttribute(UDateFormatBooleanAttribute attr,
UBool
DateFormat::getBooleanAttribute(UDateFormatBooleanAttribute attr, UErrorCode &/*status*/) const {
- return static_cast<UBool>(fBoolFlags.get(attr));
+ return static_cast<UBool>(fBoolFlags.get(attr));
}
U_NAMESPACE_END
diff --git a/contrib/libs/icu/i18n/dayperiodrules.cpp b/contrib/libs/icu/i18n/dayperiodrules.cpp
index 07e3076a50..e364ecb708 100644
--- a/contrib/libs/icu/i18n/dayperiodrules.cpp
+++ b/contrib/libs/icu/i18n/dayperiodrules.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -174,7 +174,7 @@ struct DayPeriodRulesDataSink : public ResourceSink {
}
}
- void addCutoff(CutoffType type, const UnicodeString &hour_str, UErrorCode &errorCode) {
+ void addCutoff(CutoffType type, const UnicodeString &hour_str, UErrorCode &errorCode) {
if (U_FAILURE(errorCode)) { return; }
if (type == CUTOFF_TYPE_UNKNOWN) {
@@ -340,7 +340,7 @@ const DayPeriodRules *DayPeriodRules::getInstance(const Locale &locale, UErrorCo
// does), return NULL.
if(U_FAILURE(errorCode)) { return NULL; }
- const char *localeCode = locale.getBaseName();
+ const char *localeCode = locale.getBaseName();
char name[ULOC_FULLNAME_CAPACITY];
char parentName[ULOC_FULLNAME_CAPACITY];
diff --git a/contrib/libs/icu/i18n/dayperiodrules.h b/contrib/libs/icu/i18n/dayperiodrules.h
index 7effbf191d..610c6175bf 100644
--- a/contrib/libs/icu/i18n/dayperiodrules.h
+++ b/contrib/libs/icu/i18n/dayperiodrules.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/dcfmtsym.cpp b/contrib/libs/icu/i18n/dcfmtsym.cpp
index e203a0549b..15418bfe65 100644
--- a/contrib/libs/icu/i18n/dcfmtsym.cpp
+++ b/contrib/libs/icu/i18n/dcfmtsym.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -38,7 +38,7 @@
#include "uresimp.h"
#include "ureslocs.h"
#include "charstr.h"
-#include "uassert.h"
+#include "uassert.h"
// *****************************************************************************
// class DecimalFormatSymbols
@@ -66,7 +66,7 @@ static const UChar INTL_CURRENCY_SYMBOL_STR[] = {0xa4, 0xa4, 0};
static const char *gNumberElementKeys[DecimalFormatSymbols::kFormatSymbolCount] = {
"decimal",
"group",
- NULL, /* #11897: the <list> symbol is NOT the pattern separator symbol */
+ NULL, /* #11897: the <list> symbol is NOT the pattern separator symbol */
"percentSign",
NULL, /* Native zero digit is deprecated from CLDR - get it from the numbering system */
NULL, /* Pattern digit character is deprecated from CLDR - use # by default always */
@@ -98,7 +98,7 @@ static const char *gNumberElementKeys[DecimalFormatSymbols::kFormatSymbolCount]
// Initializes this with the decimal format symbols in the default locale.
DecimalFormatSymbols::DecimalFormatSymbols(UErrorCode& status)
- : UObject(), locale(), currPattern(NULL) {
+ : UObject(), locale(), currPattern(NULL) {
initialize(locale, status, TRUE);
}
@@ -106,17 +106,17 @@ DecimalFormatSymbols::DecimalFormatSymbols(UErrorCode& status)
// Initializes this with the decimal format symbols in the desired locale.
DecimalFormatSymbols::DecimalFormatSymbols(const Locale& loc, UErrorCode& status)
- : UObject(), locale(loc), currPattern(NULL) {
+ : UObject(), locale(loc), currPattern(NULL) {
initialize(locale, status);
}
-DecimalFormatSymbols::DecimalFormatSymbols(const Locale& loc, const NumberingSystem& ns, UErrorCode& status)
- : UObject(), locale(loc), currPattern(NULL) {
- initialize(locale, status, FALSE, &ns);
-}
-
+DecimalFormatSymbols::DecimalFormatSymbols(const Locale& loc, const NumberingSystem& ns, UErrorCode& status)
+ : UObject(), locale(loc), currPattern(NULL) {
+ initialize(locale, status, FALSE, &ns);
+}
+
DecimalFormatSymbols::DecimalFormatSymbols()
- : UObject(), locale(Locale::getRoot()), currPattern(NULL) {
+ : UObject(), locale(Locale::getRoot()), currPattern(NULL) {
*validLocale = *actualLocale = 0;
initialize();
}
@@ -166,8 +166,8 @@ DecimalFormatSymbols::operator=(const DecimalFormatSymbols& rhs)
uprv_strcpy(actualLocale, rhs.actualLocale);
fIsCustomCurrencySymbol = rhs.fIsCustomCurrencySymbol;
fIsCustomIntlCurrencySymbol = rhs.fIsCustomIntlCurrencySymbol;
- fCodePointZero = rhs.fCodePointZero;
- currPattern = rhs.currPattern;
+ fCodePointZero = rhs.fCodePointZero;
+ currPattern = rhs.currPattern;
}
return *this;
}
@@ -199,7 +199,7 @@ DecimalFormatSymbols::operator==(const DecimalFormatSymbols& that) const
return FALSE;
}
}
- // No need to check fCodePointZero since it is based on fSymbols
+ // No need to check fCodePointZero since it is based on fSymbols
return locale == that.locale &&
uprv_strcmp(validLocale, that.validLocale) == 0 &&
uprv_strcmp(actualLocale, that.actualLocale) == 0;
@@ -345,8 +345,8 @@ CurrencySpacingSink::~CurrencySpacingSink() {}
} // namespace
void
-DecimalFormatSymbols::initialize(const Locale& loc, UErrorCode& status,
- UBool useLastResortData, const NumberingSystem* ns)
+DecimalFormatSymbols::initialize(const Locale& loc, UErrorCode& status,
+ UBool useLastResortData, const NumberingSystem* ns)
{
if (U_FAILURE(status)) { return; }
*validLocale = *actualLocale = 0;
@@ -358,13 +358,13 @@ DecimalFormatSymbols::initialize(const Locale& loc, UErrorCode& status,
// Next get the numbering system for this locale and set zero digit
// and the digit string based on the numbering system for the locale
//
- LocalPointer<NumberingSystem> nsLocal;
- if (ns == nullptr) {
- // Use the numbering system according to the locale.
- // Save it into a LocalPointer so it gets cleaned up.
- nsLocal.adoptInstead(NumberingSystem::createInstance(loc, status));
- ns = nsLocal.getAlias();
- }
+ LocalPointer<NumberingSystem> nsLocal;
+ if (ns == nullptr) {
+ // Use the numbering system according to the locale.
+ // Save it into a LocalPointer so it gets cleaned up.
+ nsLocal.adoptInstead(NumberingSystem::createInstance(loc, status));
+ ns = nsLocal.getAlias();
+ }
const char *nsName;
if (U_SUCCESS(status) && ns->getRadix() == 10 && !ns->isAlgorithmic()) {
nsName = ns->getName();
@@ -436,33 +436,33 @@ DecimalFormatSymbols::initialize(const Locale& loc, UErrorCode& status,
// Let the monetary number separators equal the default number separators if necessary.
sink.resolveMissingMonetarySeparators(fSymbols);
- // Resolve codePointZero
- UChar32 tempCodePointZero = -1;
- for (int32_t i=0; i<=9; i++) {
- const UnicodeString& stringDigit = getConstDigitSymbol(i);
- if (stringDigit.countChar32() != 1) {
- tempCodePointZero = -1;
- break;
- }
- UChar32 cp = stringDigit.char32At(0);
- if (i == 0) {
- tempCodePointZero = cp;
- } else if (cp != tempCodePointZero + i) {
- tempCodePointZero = -1;
- break;
- }
- }
- fCodePointZero = tempCodePointZero;
-
- // Get the default currency from the currency API.
+ // Resolve codePointZero
+ UChar32 tempCodePointZero = -1;
+ for (int32_t i=0; i<=9; i++) {
+ const UnicodeString& stringDigit = getConstDigitSymbol(i);
+ if (stringDigit.countChar32() != 1) {
+ tempCodePointZero = -1;
+ break;
+ }
+ UChar32 cp = stringDigit.char32At(0);
+ if (i == 0) {
+ tempCodePointZero = cp;
+ } else if (cp != tempCodePointZero + i) {
+ tempCodePointZero = -1;
+ break;
+ }
+ }
+ fCodePointZero = tempCodePointZero;
+
+ // Get the default currency from the currency API.
UErrorCode internalStatus = U_ZERO_ERROR; // don't propagate failures out
UChar curriso[4];
UnicodeString tempStr;
- int32_t currisoLength = ucurr_forLocale(locStr, curriso, UPRV_LENGTHOF(curriso), &internalStatus);
- if (U_SUCCESS(internalStatus) && currisoLength == 3) {
- setCurrency(curriso, status);
- } else {
- setCurrency(nullptr, status);
+ int32_t currisoLength = ucurr_forLocale(locStr, curriso, UPRV_LENGTHOF(curriso), &internalStatus);
+ if (U_SUCCESS(internalStatus) && currisoLength == 3) {
+ setCurrency(curriso, status);
+ } else {
+ setCurrency(nullptr, status);
}
// Currency Spacing.
@@ -510,56 +510,56 @@ DecimalFormatSymbols::initialize() {
fSymbols[kExponentMultiplicationSymbol] = (UChar)0xd7; // 'x' multiplication symbol for exponents
fIsCustomCurrencySymbol = FALSE;
fIsCustomIntlCurrencySymbol = FALSE;
- fCodePointZero = 0x30;
- U_ASSERT(fCodePointZero == fSymbols[kZeroDigitSymbol].char32At(0));
- currPattern = nullptr;
+ fCodePointZero = 0x30;
+ U_ASSERT(fCodePointZero == fSymbols[kZeroDigitSymbol].char32At(0));
+ currPattern = nullptr;
}
-void DecimalFormatSymbols::setCurrency(const UChar* currency, UErrorCode& status) {
- // TODO: If this method is made public:
- // - Adopt ICU4J behavior of not allowing currency to be null.
- // - Also verify that the length of currency is 3.
- if (!currency) {
- return;
- }
-
- UnicodeString tempStr;
- uprv_getStaticCurrencyName(currency, locale.getName(), tempStr, status);
- if (U_SUCCESS(status)) {
- fSymbols[kIntlCurrencySymbol].setTo(currency, 3);
- fSymbols[kCurrencySymbol] = tempStr;
- }
-
- char cc[4]={0};
- u_UCharsToChars(currency, cc, 3);
-
- /* An explicit currency was requested */
- // TODO(ICU-13297): Move this data loading logic into a centralized place
- UErrorCode localStatus = U_ZERO_ERROR;
- LocalUResourceBundlePointer rbTop(ures_open(U_ICUDATA_CURR, locale.getName(), &localStatus));
- LocalUResourceBundlePointer rb(
- ures_getByKeyWithFallback(rbTop.getAlias(), "Currencies", NULL, &localStatus));
- ures_getByKeyWithFallback(rb.getAlias(), cc, rb.getAlias(), &localStatus);
- if(U_SUCCESS(localStatus) && ures_getSize(rb.getAlias())>2) { // the length is 3 if more data is present
- ures_getByIndex(rb.getAlias(), 2, rb.getAlias(), &localStatus);
- int32_t currPatternLen = 0;
- currPattern =
- ures_getStringByIndex(rb.getAlias(), (int32_t)0, &currPatternLen, &localStatus);
- UnicodeString decimalSep =
- ures_getUnicodeStringByIndex(rb.getAlias(), (int32_t)1, &localStatus);
- UnicodeString groupingSep =
- ures_getUnicodeStringByIndex(rb.getAlias(), (int32_t)2, &localStatus);
- if(U_SUCCESS(localStatus)){
- fSymbols[kMonetaryGroupingSeparatorSymbol] = groupingSep;
- fSymbols[kMonetarySeparatorSymbol] = decimalSep;
- //pattern.setTo(TRUE, currPattern, currPatternLen);
- }
- }
- /* else An explicit currency was requested and is unknown or locale data is malformed. */
- /* ucurr_* API will get the correct value later on. */
-}
-
+void DecimalFormatSymbols::setCurrency(const UChar* currency, UErrorCode& status) {
+ // TODO: If this method is made public:
+ // - Adopt ICU4J behavior of not allowing currency to be null.
+ // - Also verify that the length of currency is 3.
+ if (!currency) {
+ return;
+ }
+
+ UnicodeString tempStr;
+ uprv_getStaticCurrencyName(currency, locale.getName(), tempStr, status);
+ if (U_SUCCESS(status)) {
+ fSymbols[kIntlCurrencySymbol].setTo(currency, 3);
+ fSymbols[kCurrencySymbol] = tempStr;
+ }
+
+ char cc[4]={0};
+ u_UCharsToChars(currency, cc, 3);
+
+ /* An explicit currency was requested */
+ // TODO(ICU-13297): Move this data loading logic into a centralized place
+ UErrorCode localStatus = U_ZERO_ERROR;
+ LocalUResourceBundlePointer rbTop(ures_open(U_ICUDATA_CURR, locale.getName(), &localStatus));
+ LocalUResourceBundlePointer rb(
+ ures_getByKeyWithFallback(rbTop.getAlias(), "Currencies", NULL, &localStatus));
+ ures_getByKeyWithFallback(rb.getAlias(), cc, rb.getAlias(), &localStatus);
+ if(U_SUCCESS(localStatus) && ures_getSize(rb.getAlias())>2) { // the length is 3 if more data is present
+ ures_getByIndex(rb.getAlias(), 2, rb.getAlias(), &localStatus);
+ int32_t currPatternLen = 0;
+ currPattern =
+ ures_getStringByIndex(rb.getAlias(), (int32_t)0, &currPatternLen, &localStatus);
+ UnicodeString decimalSep =
+ ures_getUnicodeStringByIndex(rb.getAlias(), (int32_t)1, &localStatus);
+ UnicodeString groupingSep =
+ ures_getUnicodeStringByIndex(rb.getAlias(), (int32_t)2, &localStatus);
+ if(U_SUCCESS(localStatus)){
+ fSymbols[kMonetaryGroupingSeparatorSymbol] = groupingSep;
+ fSymbols[kMonetarySeparatorSymbol] = decimalSep;
+ //pattern.setTo(TRUE, currPattern, currPatternLen);
+ }
+ }
+ /* else An explicit currency was requested and is unknown or locale data is malformed. */
+ /* ucurr_* API will get the correct value later on. */
+}
+
Locale
DecimalFormatSymbols::getLocale(ULocDataLocaleType type, UErrorCode& status) const {
U_LOCALE_BASED(locBased, *this);
diff --git a/contrib/libs/icu/i18n/decContext.cpp b/contrib/libs/icu/i18n/decContext.cpp
index 41a6e6f80e..6ec6d32afb 100644
--- a/contrib/libs/icu/i18n/decContext.cpp
+++ b/contrib/libs/icu/i18n/decContext.cpp
@@ -1,432 +1,432 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/* ------------------------------------------------------------------ */
-/* Decimal Context module */
-/* ------------------------------------------------------------------ */
-/* Copyright (c) IBM Corporation, 2000-2012. All rights reserved. */
-/* */
-/* This software is made available under the terms of the */
-/* ICU License -- ICU 1.8.1 and later. */
-/* */
-/* The description and User's Guide ("The decNumber C Library") for */
-/* this software is called decNumber.pdf. This document is */
-/* available, together with arithmetic and format specifications, */
-/* testcases, and Web links, on the General Decimal Arithmetic page. */
-/* */
-/* Please send comments, suggestions, and corrections to the author: */
-/* mfc@uk.ibm.com */
-/* Mike Cowlishaw, IBM Fellow */
-/* IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK */
-/* ------------------------------------------------------------------ */
-/* This module comprises the routines for handling arithmetic */
-/* context structures. */
-/* ------------------------------------------------------------------ */
-
-#include <string.h> /* for strcmp */
-#include <stdio.h> /* for printf if DECCHECK */
-#include "decContext.h" /* context and base types */
-#include "decNumberLocal.h" /* decNumber local types, etc. */
-
-#if 0 /* ICU: No need to test endianness at runtime. */
-/* compile-time endian tester [assumes sizeof(Int)>1] */
-static const Int mfcone=1; /* constant 1 */
-static const Flag *mfctop=(Flag *)&mfcone; /* -> top byte */
-#define LITEND *mfctop /* named flag; 1=little-endian */
-#endif
-
-/* ------------------------------------------------------------------ */
-/* decContextClearStatus -- clear bits in current status */
-/* */
-/* context is the context structure to be queried */
-/* mask indicates the bits to be cleared (the status bit that */
-/* corresponds to each 1 bit in the mask is cleared) */
-/* returns context */
-/* */
-/* No error is possible. */
-/* ------------------------------------------------------------------ */
-U_CAPI decContext * U_EXPORT2 uprv_decContextClearStatus(decContext *context, uInt mask) {
- context->status&=~mask;
- return context;
- } /* decContextClearStatus */
-
-/* ------------------------------------------------------------------ */
-/* decContextDefault -- initialize a context structure */
-/* */
-/* context is the structure to be initialized */
-/* kind selects the required set of default values, one of: */
-/* DEC_INIT_BASE -- select ANSI X3-274 defaults */
-/* DEC_INIT_DECIMAL32 -- select IEEE 754 defaults, 32-bit */
-/* DEC_INIT_DECIMAL64 -- select IEEE 754 defaults, 64-bit */
-/* DEC_INIT_DECIMAL128 -- select IEEE 754 defaults, 128-bit */
-/* For any other value a valid context is returned, but with */
-/* Invalid_operation set in the status field. */
-/* returns a context structure with the appropriate initial values. */
-/* ------------------------------------------------------------------ */
-U_CAPI decContext * U_EXPORT2 uprv_decContextDefault(decContext *context, Int kind) {
- /* set defaults... */
- context->digits=9; /* 9 digits */
- context->emax=DEC_MAX_EMAX; /* 9-digit exponents */
- context->emin=DEC_MIN_EMIN; /* .. balanced */
- context->round=DEC_ROUND_HALF_UP; /* 0.5 rises */
- context->traps=DEC_Errors; /* all but informational */
- context->status=0; /* cleared */
- context->clamp=0; /* no clamping */
- #if DECSUBSET
- context->extended=0; /* cleared */
- #endif
- switch (kind) {
- case DEC_INIT_BASE:
- /* [use defaults] */
- break;
- case DEC_INIT_DECIMAL32:
- context->digits=7; /* digits */
- context->emax=96; /* Emax */
- context->emin=-95; /* Emin */
- context->round=DEC_ROUND_HALF_EVEN; /* 0.5 to nearest even */
- context->traps=0; /* no traps set */
- context->clamp=1; /* clamp exponents */
- #if DECSUBSET
- context->extended=1; /* set */
- #endif
- break;
- case DEC_INIT_DECIMAL64:
- context->digits=16; /* digits */
- context->emax=384; /* Emax */
- context->emin=-383; /* Emin */
- context->round=DEC_ROUND_HALF_EVEN; /* 0.5 to nearest even */
- context->traps=0; /* no traps set */
- context->clamp=1; /* clamp exponents */
- #if DECSUBSET
- context->extended=1; /* set */
- #endif
- break;
- case DEC_INIT_DECIMAL128:
- context->digits=34; /* digits */
- context->emax=6144; /* Emax */
- context->emin=-6143; /* Emin */
- context->round=DEC_ROUND_HALF_EVEN; /* 0.5 to nearest even */
- context->traps=0; /* no traps set */
- context->clamp=1; /* clamp exponents */
- #if DECSUBSET
- context->extended=1; /* set */
- #endif
- break;
-
- default: /* invalid Kind */
- /* use defaults, and .. */
- uprv_decContextSetStatus(context, DEC_Invalid_operation); /* trap */
- }
-
- return context;} /* decContextDefault */
-
-/* ------------------------------------------------------------------ */
-/* decContextGetRounding -- return current rounding mode */
-/* */
-/* context is the context structure to be queried */
-/* returns the rounding mode */
-/* */
-/* No error is possible. */
-/* ------------------------------------------------------------------ */
-U_CAPI enum rounding U_EXPORT2 uprv_decContextGetRounding(decContext *context) {
- return context->round;
- } /* decContextGetRounding */
-
-/* ------------------------------------------------------------------ */
-/* decContextGetStatus -- return current status */
-/* */
-/* context is the context structure to be queried */
-/* returns status */
-/* */
-/* No error is possible. */
-/* ------------------------------------------------------------------ */
-U_CAPI uInt U_EXPORT2 uprv_decContextGetStatus(decContext *context) {
- return context->status;
- } /* decContextGetStatus */
-
-/* ------------------------------------------------------------------ */
-/* decContextRestoreStatus -- restore bits in current status */
-/* */
-/* context is the context structure to be updated */
-/* newstatus is the source for the bits to be restored */
-/* mask indicates the bits to be restored (the status bit that */
-/* corresponds to each 1 bit in the mask is set to the value of */
-/* the correspnding bit in newstatus) */
-/* returns context */
-/* */
-/* No error is possible. */
-/* ------------------------------------------------------------------ */
-U_CAPI decContext * U_EXPORT2 uprv_decContextRestoreStatus(decContext *context,
- uInt newstatus, uInt mask) {
- context->status&=~mask; /* clear the selected bits */
- context->status|=(mask&newstatus); /* or in the new bits */
- return context;
- } /* decContextRestoreStatus */
-
-/* ------------------------------------------------------------------ */
-/* decContextSaveStatus -- save bits in current status */
-/* */
-/* context is the context structure to be queried */
-/* mask indicates the bits to be saved (the status bits that */
-/* correspond to each 1 bit in the mask are saved) */
-/* returns the AND of the mask and the current status */
-/* */
-/* No error is possible. */
-/* ------------------------------------------------------------------ */
-U_CAPI uInt U_EXPORT2 uprv_decContextSaveStatus(decContext *context, uInt mask) {
- return context->status&mask;
- } /* decContextSaveStatus */
-
-/* ------------------------------------------------------------------ */
-/* decContextSetRounding -- set current rounding mode */
-/* */
-/* context is the context structure to be updated */
-/* newround is the value which will replace the current mode */
-/* returns context */
-/* */
-/* No error is possible. */
-/* ------------------------------------------------------------------ */
-U_CAPI decContext * U_EXPORT2 uprv_decContextSetRounding(decContext *context,
- enum rounding newround) {
- context->round=newround;
- return context;
- } /* decContextSetRounding */
-
-/* ------------------------------------------------------------------ */
-/* decContextSetStatus -- set status and raise trap if appropriate */
-/* */
-/* context is the context structure to be updated */
-/* status is the DEC_ exception code */
-/* returns the context structure */
-/* */
-/* Control may never return from this routine, if there is a signal */
-/* handler and it takes a long jump. */
-/* ------------------------------------------------------------------ */
-U_CAPI decContext * U_EXPORT2 uprv_decContextSetStatus(decContext *context, uInt status) {
- context->status|=status;
-#if 0 /* ICU: Do not raise signals. */
- if (status & context->traps) raise(SIGFPE);
-#endif
- return context;} /* decContextSetStatus */
-
-/* ------------------------------------------------------------------ */
-/* decContextSetStatusFromString -- set status from a string + trap */
-/* */
-/* context is the context structure to be updated */
-/* string is a string exactly equal to one that might be returned */
-/* by decContextStatusToString */
-/* */
-/* The status bit corresponding to the string is set, and a trap */
-/* is raised if appropriate. */
-/* */
-/* returns the context structure, unless the string is equal to */
-/* DEC_Condition_MU or is not recognized. In these cases NULL is */
-/* returned. */
-/* ------------------------------------------------------------------ */
-U_CAPI decContext * U_EXPORT2 uprv_decContextSetStatusFromString(decContext *context,
- const char *string) {
- if (strcmp(string, DEC_Condition_CS)==0)
- return uprv_decContextSetStatus(context, DEC_Conversion_syntax);
- if (strcmp(string, DEC_Condition_DZ)==0)
- return uprv_decContextSetStatus(context, DEC_Division_by_zero);
- if (strcmp(string, DEC_Condition_DI)==0)
- return uprv_decContextSetStatus(context, DEC_Division_impossible);
- if (strcmp(string, DEC_Condition_DU)==0)
- return uprv_decContextSetStatus(context, DEC_Division_undefined);
- if (strcmp(string, DEC_Condition_IE)==0)
- return uprv_decContextSetStatus(context, DEC_Inexact);
- if (strcmp(string, DEC_Condition_IS)==0)
- return uprv_decContextSetStatus(context, DEC_Insufficient_storage);
- if (strcmp(string, DEC_Condition_IC)==0)
- return uprv_decContextSetStatus(context, DEC_Invalid_context);
- if (strcmp(string, DEC_Condition_IO)==0)
- return uprv_decContextSetStatus(context, DEC_Invalid_operation);
- #if DECSUBSET
- if (strcmp(string, DEC_Condition_LD)==0)
- return uprv_decContextSetStatus(context, DEC_Lost_digits);
- #endif
- if (strcmp(string, DEC_Condition_OV)==0)
- return uprv_decContextSetStatus(context, DEC_Overflow);
- if (strcmp(string, DEC_Condition_PA)==0)
- return uprv_decContextSetStatus(context, DEC_Clamped);
- if (strcmp(string, DEC_Condition_RO)==0)
- return uprv_decContextSetStatus(context, DEC_Rounded);
- if (strcmp(string, DEC_Condition_SU)==0)
- return uprv_decContextSetStatus(context, DEC_Subnormal);
- if (strcmp(string, DEC_Condition_UN)==0)
- return uprv_decContextSetStatus(context, DEC_Underflow);
- if (strcmp(string, DEC_Condition_ZE)==0)
- return context;
- return NULL; /* Multiple status, or unknown */
- } /* decContextSetStatusFromString */
-
-/* ------------------------------------------------------------------ */
-/* decContextSetStatusFromStringQuiet -- set status from a string */
-/* */
-/* context is the context structure to be updated */
-/* string is a string exactly equal to one that might be returned */
-/* by decContextStatusToString */
-/* */
-/* The status bit corresponding to the string is set; no trap is */
-/* raised. */
-/* */
-/* returns the context structure, unless the string is equal to */
-/* DEC_Condition_MU or is not recognized. In these cases NULL is */
-/* returned. */
-/* ------------------------------------------------------------------ */
-U_CAPI decContext * U_EXPORT2 uprv_decContextSetStatusFromStringQuiet(decContext *context,
- const char *string) {
- if (strcmp(string, DEC_Condition_CS)==0)
- return uprv_decContextSetStatusQuiet(context, DEC_Conversion_syntax);
- if (strcmp(string, DEC_Condition_DZ)==0)
- return uprv_decContextSetStatusQuiet(context, DEC_Division_by_zero);
- if (strcmp(string, DEC_Condition_DI)==0)
- return uprv_decContextSetStatusQuiet(context, DEC_Division_impossible);
- if (strcmp(string, DEC_Condition_DU)==0)
- return uprv_decContextSetStatusQuiet(context, DEC_Division_undefined);
- if (strcmp(string, DEC_Condition_IE)==0)
- return uprv_decContextSetStatusQuiet(context, DEC_Inexact);
- if (strcmp(string, DEC_Condition_IS)==0)
- return uprv_decContextSetStatusQuiet(context, DEC_Insufficient_storage);
- if (strcmp(string, DEC_Condition_IC)==0)
- return uprv_decContextSetStatusQuiet(context, DEC_Invalid_context);
- if (strcmp(string, DEC_Condition_IO)==0)
- return uprv_decContextSetStatusQuiet(context, DEC_Invalid_operation);
- #if DECSUBSET
- if (strcmp(string, DEC_Condition_LD)==0)
- return uprv_decContextSetStatusQuiet(context, DEC_Lost_digits);
- #endif
- if (strcmp(string, DEC_Condition_OV)==0)
- return uprv_decContextSetStatusQuiet(context, DEC_Overflow);
- if (strcmp(string, DEC_Condition_PA)==0)
- return uprv_decContextSetStatusQuiet(context, DEC_Clamped);
- if (strcmp(string, DEC_Condition_RO)==0)
- return uprv_decContextSetStatusQuiet(context, DEC_Rounded);
- if (strcmp(string, DEC_Condition_SU)==0)
- return uprv_decContextSetStatusQuiet(context, DEC_Subnormal);
- if (strcmp(string, DEC_Condition_UN)==0)
- return uprv_decContextSetStatusQuiet(context, DEC_Underflow);
- if (strcmp(string, DEC_Condition_ZE)==0)
- return context;
- return NULL; /* Multiple status, or unknown */
- } /* decContextSetStatusFromStringQuiet */
-
-/* ------------------------------------------------------------------ */
-/* decContextSetStatusQuiet -- set status without trap */
-/* */
-/* context is the context structure to be updated */
-/* status is the DEC_ exception code */
-/* returns the context structure */
-/* */
-/* No error is possible. */
-/* ------------------------------------------------------------------ */
-U_CAPI decContext * U_EXPORT2 uprv_decContextSetStatusQuiet(decContext *context, uInt status) {
- context->status|=status;
- return context;} /* decContextSetStatusQuiet */
-
-/* ------------------------------------------------------------------ */
-/* decContextStatusToString -- convert status flags to a string */
-/* */
-/* context is a context with valid status field */
-/* */
-/* returns a constant string describing the condition. If multiple */
-/* (or no) flags are set, a generic constant message is returned. */
-/* ------------------------------------------------------------------ */
-U_CAPI const char * U_EXPORT2 uprv_decContextStatusToString(const decContext *context) {
- Int status=context->status;
-
- /* test the five IEEE first, as some of the others are ambiguous when */
- /* DECEXTFLAG=0 */
- if (status==DEC_Invalid_operation ) return DEC_Condition_IO;
- if (status==DEC_Division_by_zero ) return DEC_Condition_DZ;
- if (status==DEC_Overflow ) return DEC_Condition_OV;
- if (status==DEC_Underflow ) return DEC_Condition_UN;
- if (status==DEC_Inexact ) return DEC_Condition_IE;
-
- if (status==DEC_Division_impossible ) return DEC_Condition_DI;
- if (status==DEC_Division_undefined ) return DEC_Condition_DU;
- if (status==DEC_Rounded ) return DEC_Condition_RO;
- if (status==DEC_Clamped ) return DEC_Condition_PA;
- if (status==DEC_Subnormal ) return DEC_Condition_SU;
- if (status==DEC_Conversion_syntax ) return DEC_Condition_CS;
- if (status==DEC_Insufficient_storage ) return DEC_Condition_IS;
- if (status==DEC_Invalid_context ) return DEC_Condition_IC;
- #if DECSUBSET
- if (status==DEC_Lost_digits ) return DEC_Condition_LD;
- #endif
- if (status==0 ) return DEC_Condition_ZE;
- return DEC_Condition_MU; /* Multiple errors */
- } /* decContextStatusToString */
-
-/* ------------------------------------------------------------------ */
-/* decContextTestEndian -- test whether DECLITEND is set correctly */
-/* */
-/* quiet is 1 to suppress message; 0 otherwise */
-/* returns 0 if DECLITEND is correct */
-/* 1 if DECLITEND is incorrect and should be 1 */
-/* -1 if DECLITEND is incorrect and should be 0 */
-/* */
-/* A message is displayed if the return value is not 0 and quiet==0. */
-/* */
-/* No error is possible. */
-/* ------------------------------------------------------------------ */
-#if 0 /* ICU: Unused function. Anyway, do not call printf(). */
-U_CAPI Int U_EXPORT2 uprv_decContextTestEndian(Flag quiet) {
- Int res=0; /* optimist */
- uInt dle=(uInt)DECLITEND; /* unsign */
- if (dle>1) dle=1; /* ensure 0 or 1 */
-
- if (LITEND!=DECLITEND) {
- const char *adj;
- if (!quiet) {
- if (LITEND) adj="little";
- else adj="big";
- printf("Warning: DECLITEND is set to %d, but this computer appears to be %s-endian\n",
- DECLITEND, adj);
- }
- res=(Int)LITEND-dle;
- }
- return res;
- } /* decContextTestEndian */
-#endif
-
-/* ------------------------------------------------------------------ */
-/* decContextTestSavedStatus -- test bits in saved status */
-/* */
-/* oldstatus is the status word to be tested */
-/* mask indicates the bits to be tested (the oldstatus bits that */
-/* correspond to each 1 bit in the mask are tested) */
-/* returns 1 if any of the tested bits are 1, or 0 otherwise */
-/* */
-/* No error is possible. */
-/* ------------------------------------------------------------------ */
-U_CAPI uInt U_EXPORT2 uprv_decContextTestSavedStatus(uInt oldstatus, uInt mask) {
- return (oldstatus&mask)!=0;
- } /* decContextTestSavedStatus */
-
-/* ------------------------------------------------------------------ */
-/* decContextTestStatus -- test bits in current status */
-/* */
-/* context is the context structure to be updated */
-/* mask indicates the bits to be tested (the status bits that */
-/* correspond to each 1 bit in the mask are tested) */
-/* returns 1 if any of the tested bits are 1, or 0 otherwise */
-/* */
-/* No error is possible. */
-/* ------------------------------------------------------------------ */
-U_CAPI uInt U_EXPORT2 uprv_decContextTestStatus(decContext *context, uInt mask) {
- return (context->status&mask)!=0;
- } /* decContextTestStatus */
-
-/* ------------------------------------------------------------------ */
-/* decContextZeroStatus -- clear all status bits */
-/* */
-/* context is the context structure to be updated */
-/* returns context */
-/* */
-/* No error is possible. */
-/* ------------------------------------------------------------------ */
-U_CAPI decContext * U_EXPORT2 uprv_decContextZeroStatus(decContext *context) {
- context->status=0;
- return context;
- } /* decContextZeroStatus */
-
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/* ------------------------------------------------------------------ */
+/* Decimal Context module */
+/* ------------------------------------------------------------------ */
+/* Copyright (c) IBM Corporation, 2000-2012. All rights reserved. */
+/* */
+/* This software is made available under the terms of the */
+/* ICU License -- ICU 1.8.1 and later. */
+/* */
+/* The description and User's Guide ("The decNumber C Library") for */
+/* this software is called decNumber.pdf. This document is */
+/* available, together with arithmetic and format specifications, */
+/* testcases, and Web links, on the General Decimal Arithmetic page. */
+/* */
+/* Please send comments, suggestions, and corrections to the author: */
+/* mfc@uk.ibm.com */
+/* Mike Cowlishaw, IBM Fellow */
+/* IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK */
+/* ------------------------------------------------------------------ */
+/* This module comprises the routines for handling arithmetic */
+/* context structures. */
+/* ------------------------------------------------------------------ */
+
+#include <string.h> /* for strcmp */
+#include <stdio.h> /* for printf if DECCHECK */
+#include "decContext.h" /* context and base types */
+#include "decNumberLocal.h" /* decNumber local types, etc. */
+
+#if 0 /* ICU: No need to test endianness at runtime. */
+/* compile-time endian tester [assumes sizeof(Int)>1] */
+static const Int mfcone=1; /* constant 1 */
+static const Flag *mfctop=(Flag *)&mfcone; /* -> top byte */
+#define LITEND *mfctop /* named flag; 1=little-endian */
+#endif
+
+/* ------------------------------------------------------------------ */
+/* decContextClearStatus -- clear bits in current status */
+/* */
+/* context is the context structure to be queried */
+/* mask indicates the bits to be cleared (the status bit that */
+/* corresponds to each 1 bit in the mask is cleared) */
+/* returns context */
+/* */
+/* No error is possible. */
+/* ------------------------------------------------------------------ */
+U_CAPI decContext * U_EXPORT2 uprv_decContextClearStatus(decContext *context, uInt mask) {
+ context->status&=~mask;
+ return context;
+ } /* decContextClearStatus */
+
+/* ------------------------------------------------------------------ */
+/* decContextDefault -- initialize a context structure */
+/* */
+/* context is the structure to be initialized */
+/* kind selects the required set of default values, one of: */
+/* DEC_INIT_BASE -- select ANSI X3-274 defaults */
+/* DEC_INIT_DECIMAL32 -- select IEEE 754 defaults, 32-bit */
+/* DEC_INIT_DECIMAL64 -- select IEEE 754 defaults, 64-bit */
+/* DEC_INIT_DECIMAL128 -- select IEEE 754 defaults, 128-bit */
+/* For any other value a valid context is returned, but with */
+/* Invalid_operation set in the status field. */
+/* returns a context structure with the appropriate initial values. */
+/* ------------------------------------------------------------------ */
+U_CAPI decContext * U_EXPORT2 uprv_decContextDefault(decContext *context, Int kind) {
+ /* set defaults... */
+ context->digits=9; /* 9 digits */
+ context->emax=DEC_MAX_EMAX; /* 9-digit exponents */
+ context->emin=DEC_MIN_EMIN; /* .. balanced */
+ context->round=DEC_ROUND_HALF_UP; /* 0.5 rises */
+ context->traps=DEC_Errors; /* all but informational */
+ context->status=0; /* cleared */
+ context->clamp=0; /* no clamping */
+ #if DECSUBSET
+ context->extended=0; /* cleared */
+ #endif
+ switch (kind) {
+ case DEC_INIT_BASE:
+ /* [use defaults] */
+ break;
+ case DEC_INIT_DECIMAL32:
+ context->digits=7; /* digits */
+ context->emax=96; /* Emax */
+ context->emin=-95; /* Emin */
+ context->round=DEC_ROUND_HALF_EVEN; /* 0.5 to nearest even */
+ context->traps=0; /* no traps set */
+ context->clamp=1; /* clamp exponents */
+ #if DECSUBSET
+ context->extended=1; /* set */
+ #endif
+ break;
+ case DEC_INIT_DECIMAL64:
+ context->digits=16; /* digits */
+ context->emax=384; /* Emax */
+ context->emin=-383; /* Emin */
+ context->round=DEC_ROUND_HALF_EVEN; /* 0.5 to nearest even */
+ context->traps=0; /* no traps set */
+ context->clamp=1; /* clamp exponents */
+ #if DECSUBSET
+ context->extended=1; /* set */
+ #endif
+ break;
+ case DEC_INIT_DECIMAL128:
+ context->digits=34; /* digits */
+ context->emax=6144; /* Emax */
+ context->emin=-6143; /* Emin */
+ context->round=DEC_ROUND_HALF_EVEN; /* 0.5 to nearest even */
+ context->traps=0; /* no traps set */
+ context->clamp=1; /* clamp exponents */
+ #if DECSUBSET
+ context->extended=1; /* set */
+ #endif
+ break;
+
+ default: /* invalid Kind */
+ /* use defaults, and .. */
+ uprv_decContextSetStatus(context, DEC_Invalid_operation); /* trap */
+ }
+
+ return context;} /* decContextDefault */
+
+/* ------------------------------------------------------------------ */
+/* decContextGetRounding -- return current rounding mode */
+/* */
+/* context is the context structure to be queried */
+/* returns the rounding mode */
+/* */
+/* No error is possible. */
+/* ------------------------------------------------------------------ */
+U_CAPI enum rounding U_EXPORT2 uprv_decContextGetRounding(decContext *context) {
+ return context->round;
+ } /* decContextGetRounding */
+
+/* ------------------------------------------------------------------ */
+/* decContextGetStatus -- return current status */
+/* */
+/* context is the context structure to be queried */
+/* returns status */
+/* */
+/* No error is possible. */
+/* ------------------------------------------------------------------ */
+U_CAPI uInt U_EXPORT2 uprv_decContextGetStatus(decContext *context) {
+ return context->status;
+ } /* decContextGetStatus */
+
+/* ------------------------------------------------------------------ */
+/* decContextRestoreStatus -- restore bits in current status */
+/* */
+/* context is the context structure to be updated */
+/* newstatus is the source for the bits to be restored */
+/* mask indicates the bits to be restored (the status bit that */
+/* corresponds to each 1 bit in the mask is set to the value of */
+/* the correspnding bit in newstatus) */
+/* returns context */
+/* */
+/* No error is possible. */
+/* ------------------------------------------------------------------ */
+U_CAPI decContext * U_EXPORT2 uprv_decContextRestoreStatus(decContext *context,
+ uInt newstatus, uInt mask) {
+ context->status&=~mask; /* clear the selected bits */
+ context->status|=(mask&newstatus); /* or in the new bits */
+ return context;
+ } /* decContextRestoreStatus */
+
+/* ------------------------------------------------------------------ */
+/* decContextSaveStatus -- save bits in current status */
+/* */
+/* context is the context structure to be queried */
+/* mask indicates the bits to be saved (the status bits that */
+/* correspond to each 1 bit in the mask are saved) */
+/* returns the AND of the mask and the current status */
+/* */
+/* No error is possible. */
+/* ------------------------------------------------------------------ */
+U_CAPI uInt U_EXPORT2 uprv_decContextSaveStatus(decContext *context, uInt mask) {
+ return context->status&mask;
+ } /* decContextSaveStatus */
+
+/* ------------------------------------------------------------------ */
+/* decContextSetRounding -- set current rounding mode */
+/* */
+/* context is the context structure to be updated */
+/* newround is the value which will replace the current mode */
+/* returns context */
+/* */
+/* No error is possible. */
+/* ------------------------------------------------------------------ */
+U_CAPI decContext * U_EXPORT2 uprv_decContextSetRounding(decContext *context,
+ enum rounding newround) {
+ context->round=newround;
+ return context;
+ } /* decContextSetRounding */
+
+/* ------------------------------------------------------------------ */
+/* decContextSetStatus -- set status and raise trap if appropriate */
+/* */
+/* context is the context structure to be updated */
+/* status is the DEC_ exception code */
+/* returns the context structure */
+/* */
+/* Control may never return from this routine, if there is a signal */
+/* handler and it takes a long jump. */
+/* ------------------------------------------------------------------ */
+U_CAPI decContext * U_EXPORT2 uprv_decContextSetStatus(decContext *context, uInt status) {
+ context->status|=status;
+#if 0 /* ICU: Do not raise signals. */
+ if (status & context->traps) raise(SIGFPE);
+#endif
+ return context;} /* decContextSetStatus */
+
+/* ------------------------------------------------------------------ */
+/* decContextSetStatusFromString -- set status from a string + trap */
+/* */
+/* context is the context structure to be updated */
+/* string is a string exactly equal to one that might be returned */
+/* by decContextStatusToString */
+/* */
+/* The status bit corresponding to the string is set, and a trap */
+/* is raised if appropriate. */
+/* */
+/* returns the context structure, unless the string is equal to */
+/* DEC_Condition_MU or is not recognized. In these cases NULL is */
+/* returned. */
+/* ------------------------------------------------------------------ */
+U_CAPI decContext * U_EXPORT2 uprv_decContextSetStatusFromString(decContext *context,
+ const char *string) {
+ if (strcmp(string, DEC_Condition_CS)==0)
+ return uprv_decContextSetStatus(context, DEC_Conversion_syntax);
+ if (strcmp(string, DEC_Condition_DZ)==0)
+ return uprv_decContextSetStatus(context, DEC_Division_by_zero);
+ if (strcmp(string, DEC_Condition_DI)==0)
+ return uprv_decContextSetStatus(context, DEC_Division_impossible);
+ if (strcmp(string, DEC_Condition_DU)==0)
+ return uprv_decContextSetStatus(context, DEC_Division_undefined);
+ if (strcmp(string, DEC_Condition_IE)==0)
+ return uprv_decContextSetStatus(context, DEC_Inexact);
+ if (strcmp(string, DEC_Condition_IS)==0)
+ return uprv_decContextSetStatus(context, DEC_Insufficient_storage);
+ if (strcmp(string, DEC_Condition_IC)==0)
+ return uprv_decContextSetStatus(context, DEC_Invalid_context);
+ if (strcmp(string, DEC_Condition_IO)==0)
+ return uprv_decContextSetStatus(context, DEC_Invalid_operation);
+ #if DECSUBSET
+ if (strcmp(string, DEC_Condition_LD)==0)
+ return uprv_decContextSetStatus(context, DEC_Lost_digits);
+ #endif
+ if (strcmp(string, DEC_Condition_OV)==0)
+ return uprv_decContextSetStatus(context, DEC_Overflow);
+ if (strcmp(string, DEC_Condition_PA)==0)
+ return uprv_decContextSetStatus(context, DEC_Clamped);
+ if (strcmp(string, DEC_Condition_RO)==0)
+ return uprv_decContextSetStatus(context, DEC_Rounded);
+ if (strcmp(string, DEC_Condition_SU)==0)
+ return uprv_decContextSetStatus(context, DEC_Subnormal);
+ if (strcmp(string, DEC_Condition_UN)==0)
+ return uprv_decContextSetStatus(context, DEC_Underflow);
+ if (strcmp(string, DEC_Condition_ZE)==0)
+ return context;
+ return NULL; /* Multiple status, or unknown */
+ } /* decContextSetStatusFromString */
+
+/* ------------------------------------------------------------------ */
+/* decContextSetStatusFromStringQuiet -- set status from a string */
+/* */
+/* context is the context structure to be updated */
+/* string is a string exactly equal to one that might be returned */
+/* by decContextStatusToString */
+/* */
+/* The status bit corresponding to the string is set; no trap is */
+/* raised. */
+/* */
+/* returns the context structure, unless the string is equal to */
+/* DEC_Condition_MU or is not recognized. In these cases NULL is */
+/* returned. */
+/* ------------------------------------------------------------------ */
+U_CAPI decContext * U_EXPORT2 uprv_decContextSetStatusFromStringQuiet(decContext *context,
+ const char *string) {
+ if (strcmp(string, DEC_Condition_CS)==0)
+ return uprv_decContextSetStatusQuiet(context, DEC_Conversion_syntax);
+ if (strcmp(string, DEC_Condition_DZ)==0)
+ return uprv_decContextSetStatusQuiet(context, DEC_Division_by_zero);
+ if (strcmp(string, DEC_Condition_DI)==0)
+ return uprv_decContextSetStatusQuiet(context, DEC_Division_impossible);
+ if (strcmp(string, DEC_Condition_DU)==0)
+ return uprv_decContextSetStatusQuiet(context, DEC_Division_undefined);
+ if (strcmp(string, DEC_Condition_IE)==0)
+ return uprv_decContextSetStatusQuiet(context, DEC_Inexact);
+ if (strcmp(string, DEC_Condition_IS)==0)
+ return uprv_decContextSetStatusQuiet(context, DEC_Insufficient_storage);
+ if (strcmp(string, DEC_Condition_IC)==0)
+ return uprv_decContextSetStatusQuiet(context, DEC_Invalid_context);
+ if (strcmp(string, DEC_Condition_IO)==0)
+ return uprv_decContextSetStatusQuiet(context, DEC_Invalid_operation);
+ #if DECSUBSET
+ if (strcmp(string, DEC_Condition_LD)==0)
+ return uprv_decContextSetStatusQuiet(context, DEC_Lost_digits);
+ #endif
+ if (strcmp(string, DEC_Condition_OV)==0)
+ return uprv_decContextSetStatusQuiet(context, DEC_Overflow);
+ if (strcmp(string, DEC_Condition_PA)==0)
+ return uprv_decContextSetStatusQuiet(context, DEC_Clamped);
+ if (strcmp(string, DEC_Condition_RO)==0)
+ return uprv_decContextSetStatusQuiet(context, DEC_Rounded);
+ if (strcmp(string, DEC_Condition_SU)==0)
+ return uprv_decContextSetStatusQuiet(context, DEC_Subnormal);
+ if (strcmp(string, DEC_Condition_UN)==0)
+ return uprv_decContextSetStatusQuiet(context, DEC_Underflow);
+ if (strcmp(string, DEC_Condition_ZE)==0)
+ return context;
+ return NULL; /* Multiple status, or unknown */
+ } /* decContextSetStatusFromStringQuiet */
+
+/* ------------------------------------------------------------------ */
+/* decContextSetStatusQuiet -- set status without trap */
+/* */
+/* context is the context structure to be updated */
+/* status is the DEC_ exception code */
+/* returns the context structure */
+/* */
+/* No error is possible. */
+/* ------------------------------------------------------------------ */
+U_CAPI decContext * U_EXPORT2 uprv_decContextSetStatusQuiet(decContext *context, uInt status) {
+ context->status|=status;
+ return context;} /* decContextSetStatusQuiet */
+
+/* ------------------------------------------------------------------ */
+/* decContextStatusToString -- convert status flags to a string */
+/* */
+/* context is a context with valid status field */
+/* */
+/* returns a constant string describing the condition. If multiple */
+/* (or no) flags are set, a generic constant message is returned. */
+/* ------------------------------------------------------------------ */
+U_CAPI const char * U_EXPORT2 uprv_decContextStatusToString(const decContext *context) {
+ Int status=context->status;
+
+ /* test the five IEEE first, as some of the others are ambiguous when */
+ /* DECEXTFLAG=0 */
+ if (status==DEC_Invalid_operation ) return DEC_Condition_IO;
+ if (status==DEC_Division_by_zero ) return DEC_Condition_DZ;
+ if (status==DEC_Overflow ) return DEC_Condition_OV;
+ if (status==DEC_Underflow ) return DEC_Condition_UN;
+ if (status==DEC_Inexact ) return DEC_Condition_IE;
+
+ if (status==DEC_Division_impossible ) return DEC_Condition_DI;
+ if (status==DEC_Division_undefined ) return DEC_Condition_DU;
+ if (status==DEC_Rounded ) return DEC_Condition_RO;
+ if (status==DEC_Clamped ) return DEC_Condition_PA;
+ if (status==DEC_Subnormal ) return DEC_Condition_SU;
+ if (status==DEC_Conversion_syntax ) return DEC_Condition_CS;
+ if (status==DEC_Insufficient_storage ) return DEC_Condition_IS;
+ if (status==DEC_Invalid_context ) return DEC_Condition_IC;
+ #if DECSUBSET
+ if (status==DEC_Lost_digits ) return DEC_Condition_LD;
+ #endif
+ if (status==0 ) return DEC_Condition_ZE;
+ return DEC_Condition_MU; /* Multiple errors */
+ } /* decContextStatusToString */
+
+/* ------------------------------------------------------------------ */
+/* decContextTestEndian -- test whether DECLITEND is set correctly */
+/* */
+/* quiet is 1 to suppress message; 0 otherwise */
+/* returns 0 if DECLITEND is correct */
+/* 1 if DECLITEND is incorrect and should be 1 */
+/* -1 if DECLITEND is incorrect and should be 0 */
+/* */
+/* A message is displayed if the return value is not 0 and quiet==0. */
+/* */
+/* No error is possible. */
+/* ------------------------------------------------------------------ */
+#if 0 /* ICU: Unused function. Anyway, do not call printf(). */
+U_CAPI Int U_EXPORT2 uprv_decContextTestEndian(Flag quiet) {
+ Int res=0; /* optimist */
+ uInt dle=(uInt)DECLITEND; /* unsign */
+ if (dle>1) dle=1; /* ensure 0 or 1 */
+
+ if (LITEND!=DECLITEND) {
+ const char *adj;
+ if (!quiet) {
+ if (LITEND) adj="little";
+ else adj="big";
+ printf("Warning: DECLITEND is set to %d, but this computer appears to be %s-endian\n",
+ DECLITEND, adj);
+ }
+ res=(Int)LITEND-dle;
+ }
+ return res;
+ } /* decContextTestEndian */
+#endif
+
+/* ------------------------------------------------------------------ */
+/* decContextTestSavedStatus -- test bits in saved status */
+/* */
+/* oldstatus is the status word to be tested */
+/* mask indicates the bits to be tested (the oldstatus bits that */
+/* correspond to each 1 bit in the mask are tested) */
+/* returns 1 if any of the tested bits are 1, or 0 otherwise */
+/* */
+/* No error is possible. */
+/* ------------------------------------------------------------------ */
+U_CAPI uInt U_EXPORT2 uprv_decContextTestSavedStatus(uInt oldstatus, uInt mask) {
+ return (oldstatus&mask)!=0;
+ } /* decContextTestSavedStatus */
+
+/* ------------------------------------------------------------------ */
+/* decContextTestStatus -- test bits in current status */
+/* */
+/* context is the context structure to be updated */
+/* mask indicates the bits to be tested (the status bits that */
+/* correspond to each 1 bit in the mask are tested) */
+/* returns 1 if any of the tested bits are 1, or 0 otherwise */
+/* */
+/* No error is possible. */
+/* ------------------------------------------------------------------ */
+U_CAPI uInt U_EXPORT2 uprv_decContextTestStatus(decContext *context, uInt mask) {
+ return (context->status&mask)!=0;
+ } /* decContextTestStatus */
+
+/* ------------------------------------------------------------------ */
+/* decContextZeroStatus -- clear all status bits */
+/* */
+/* context is the context structure to be updated */
+/* returns context */
+/* */
+/* No error is possible. */
+/* ------------------------------------------------------------------ */
+U_CAPI decContext * U_EXPORT2 uprv_decContextZeroStatus(decContext *context) {
+ context->status=0;
+ return context;
+ } /* decContextZeroStatus */
+
diff --git a/contrib/libs/icu/i18n/decContext.h b/contrib/libs/icu/i18n/decContext.h
index 92bf477410..e145777d1e 100644
--- a/contrib/libs/icu/i18n/decContext.h
+++ b/contrib/libs/icu/i18n/decContext.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/* ------------------------------------------------------------------ */
/* Decimal Context module header */
diff --git a/contrib/libs/icu/i18n/decNumber.cpp b/contrib/libs/icu/i18n/decNumber.cpp
index 115887ac7f..cee2f8e949 100644
--- a/contrib/libs/icu/i18n/decNumber.cpp
+++ b/contrib/libs/icu/i18n/decNumber.cpp
@@ -1,8190 +1,8190 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/* ------------------------------------------------------------------ */
-/* Decimal Number arithmetic module */
-/* ------------------------------------------------------------------ */
-/* Copyright (c) IBM Corporation, 2000-2014. All rights reserved. */
-/* */
-/* This software is made available under the terms of the */
-/* ICU License -- ICU 1.8.1 and later. */
-/* */
-/* The description and User's Guide ("The decNumber C Library") for */
-/* this software is called decNumber.pdf. This document is */
-/* available, together with arithmetic and format specifications, */
-/* testcases, and Web links, on the General Decimal Arithmetic page. */
-/* */
-/* Please send comments, suggestions, and corrections to the author: */
-/* mfc@uk.ibm.com */
-/* Mike Cowlishaw, IBM Fellow */
-/* IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK */
-/* ------------------------------------------------------------------ */
-
-/* Modified version, for use from within ICU.
- * Renamed public functions, to avoid an unwanted export of the
- * standard names from the ICU library.
- *
- * Use ICU's uprv_malloc() and uprv_free()
- *
- * Revert comment syntax to plain C
- *
- * Remove a few compiler warnings.
- */
-
-/* This module comprises the routines for arbitrary-precision General */
-/* Decimal Arithmetic as defined in the specification which may be */
-/* found on the General Decimal Arithmetic pages. It implements both */
-/* the full ('extended') arithmetic and the simpler ('subset') */
-/* arithmetic. */
-/* */
-/* Usage notes: */
-/* */
-/* 1. This code is ANSI C89 except: */
-/* */
-/* a) C99 line comments (double forward slash) are used. (Most C */
-/* compilers accept these. If yours does not, a simple script */
-/* can be used to convert them to ANSI C comments.) */
-/* */
-/* b) Types from C99 stdint.h are used. If you do not have this */
-/* header file, see the User's Guide section of the decNumber */
-/* documentation; this lists the necessary definitions. */
-/* */
-/* c) If DECDPUN>4 or DECUSE64=1, the C99 64-bit int64_t and */
-/* uint64_t types may be used. To avoid these, set DECUSE64=0 */
-/* and DECDPUN<=4 (see documentation). */
-/* */
-/* The code also conforms to C99 restrictions; in particular, */
-/* strict aliasing rules are observed. */
-/* */
-/* 2. The decNumber format which this library uses is optimized for */
-/* efficient processing of relatively short numbers; in particular */
-/* it allows the use of fixed sized structures and minimizes copy */
-/* and move operations. It does, however, support arbitrary */
-/* precision (up to 999,999,999 digits) and arbitrary exponent */
-/* range (Emax in the range 0 through 999,999,999 and Emin in the */
-/* range -999,999,999 through 0). Mathematical functions (for */
-/* example decNumberExp) as identified below are restricted more */
-/* tightly: digits, emax, and -emin in the context must be <= */
-/* DEC_MAX_MATH (999999), and their operand(s) must be within */
-/* these bounds. */
-/* */
-/* 3. Logical functions are further restricted; their operands must */
-/* be finite, positive, have an exponent of zero, and all digits */
-/* must be either 0 or 1. The result will only contain digits */
-/* which are 0 or 1 (and will have exponent=0 and a sign of 0). */
-/* */
-/* 4. Operands to operator functions are never modified unless they */
-/* are also specified to be the result number (which is always */
-/* permitted). Other than that case, operands must not overlap. */
-/* */
-/* 5. Error handling: the type of the error is ORed into the status */
-/* flags in the current context (decContext structure). The */
-/* SIGFPE signal is then raised if the corresponding trap-enabler */
-/* flag in the decContext is set (is 1). */
-/* */
-/* It is the responsibility of the caller to clear the status */
-/* flags as required. */
-/* */
-/* The result of any routine which returns a number will always */
-/* be a valid number (which may be a special value, such as an */
-/* Infinity or NaN). */
-/* */
-/* 6. The decNumber format is not an exchangeable concrete */
-/* representation as it comprises fields which may be machine- */
-/* dependent (packed or unpacked, or special length, for example). */
-/* Canonical conversions to and from strings are provided; other */
-/* conversions are available in separate modules. */
-/* */
-/* 7. Normally, input operands are assumed to be valid. Set DECCHECK */
-/* to 1 for extended operand checking (including NULL operands). */
-/* Results are undefined if a badly-formed structure (or a NULL */
-/* pointer to a structure) is provided, though with DECCHECK */
-/* enabled the operator routines are protected against exceptions. */
-/* (Except if the result pointer is NULL, which is unrecoverable.) */
-/* */
-/* However, the routines will never cause exceptions if they are */
-/* given well-formed operands, even if the value of the operands */
-/* is inappropriate for the operation and DECCHECK is not set. */
-/* (Except for SIGFPE, as and where documented.) */
-/* */
-/* 8. Subset arithmetic is available only if DECSUBSET is set to 1. */
-/* ------------------------------------------------------------------ */
-/* Implementation notes for maintenance of this module: */
-/* */
-/* 1. Storage leak protection: Routines which use malloc are not */
-/* permitted to use return for fastpath or error exits (i.e., */
-/* they follow strict structured programming conventions). */
-/* Instead they have a do{}while(0); construct surrounding the */
-/* code which is protected -- break may be used to exit this. */
-/* Other routines can safely use the return statement inline. */
-/* */
-/* Storage leak accounting can be enabled using DECALLOC. */
-/* */
-/* 2. All loops use the for(;;) construct. Any do construct does */
-/* not loop; it is for allocation protection as just described. */
-/* */
-/* 3. Setting status in the context must always be the very last */
-/* action in a routine, as non-0 status may raise a trap and hence */
-/* the call to set status may not return (if the handler uses long */
-/* jump). Therefore all cleanup must be done first. In general, */
-/* to achieve this status is accumulated and is only applied just */
-/* before return by calling decContextSetStatus (via decStatus). */
-/* */
-/* Routines which allocate storage cannot, in general, use the */
-/* 'top level' routines which could cause a non-returning */
-/* transfer of control. The decXxxxOp routines are safe (do not */
-/* call decStatus even if traps are set in the context) and should */
-/* be used instead (they are also a little faster). */
-/* */
-/* 4. Exponent checking is minimized by allowing the exponent to */
-/* grow outside its limits during calculations, provided that */
-/* the decFinalize function is called later. Multiplication and */
-/* division, and intermediate calculations in exponentiation, */
-/* require more careful checks because of the risk of 31-bit */
-/* overflow (the most negative valid exponent is -1999999997, for */
-/* a 999999999-digit number with adjusted exponent of -999999999). */
-/* */
-/* 5. Rounding is deferred until finalization of results, with any */
-/* 'off to the right' data being represented as a single digit */
-/* residue (in the range -1 through 9). This avoids any double- */
-/* rounding when more than one shortening takes place (for */
-/* example, when a result is subnormal). */
-/* */
-/* 6. The digits count is allowed to rise to a multiple of DECDPUN */
-/* during many operations, so whole Units are handled and exact */
-/* accounting of digits is not needed. The correct digits value */
-/* is found by decGetDigits, which accounts for leading zeros. */
-/* This must be called before any rounding if the number of digits */
-/* is not known exactly. */
-/* */
-/* 7. The multiply-by-reciprocal 'trick' is used for partitioning */
-/* numbers up to four digits, using appropriate constants. This */
-/* is not useful for longer numbers because overflow of 32 bits */
-/* would lead to 4 multiplies, which is almost as expensive as */
-/* a divide (unless a floating-point or 64-bit multiply is */
-/* assumed to be available). */
-/* */
-/* 8. Unusual abbreviations that may be used in the commentary: */
-/* lhs -- left hand side (operand, of an operation) */
-/* lsd -- least significant digit (of coefficient) */
-/* lsu -- least significant Unit (of coefficient) */
-/* msd -- most significant digit (of coefficient) */
-/* msi -- most significant item (in an array) */
-/* msu -- most significant Unit (of coefficient) */
-/* rhs -- right hand side (operand, of an operation) */
-/* +ve -- positive */
-/* -ve -- negative */
-/* ** -- raise to the power */
-/* ------------------------------------------------------------------ */
-
-#include <stdlib.h> /* for malloc, free, etc. */
-/* #include <stdio.h> */ /* for printf [if needed] */
-#include <string.h> /* for strcpy */
-#include <ctype.h> /* for lower */
-#include "cmemory.h" /* for uprv_malloc, etc., in ICU */
-#include "decNumber.h" /* base number library */
-#include "decNumberLocal.h" /* decNumber local types, etc. */
-#include "uassert.h"
-
-/* Constants */
-/* Public lookup table used by the D2U macro */
-static const uByte d2utable[DECMAXD2U+1]=D2UTABLE;
-
-#define DECVERB 1 /* set to 1 for verbose DECCHECK */
-#define powers DECPOWERS /* old internal name */
-
-/* Local constants */
-#define DIVIDE 0x80 /* Divide operators */
-#define REMAINDER 0x40 /* .. */
-#define DIVIDEINT 0x20 /* .. */
-#define REMNEAR 0x10 /* .. */
-#define COMPARE 0x01 /* Compare operators */
-#define COMPMAX 0x02 /* .. */
-#define COMPMIN 0x03 /* .. */
-#define COMPTOTAL 0x04 /* .. */
-#define COMPNAN 0x05 /* .. [NaN processing] */
-#define COMPSIG 0x06 /* .. [signaling COMPARE] */
-#define COMPMAXMAG 0x07 /* .. */
-#define COMPMINMAG 0x08 /* .. */
-
-#define DEC_sNaN 0x40000000 /* local status: sNaN signal */
-#define BADINT (Int)0x80000000 /* most-negative Int; error indicator */
-/* Next two indicate an integer >= 10**6, and its parity (bottom bit) */
-#define BIGEVEN (Int)0x80000002
-#define BIGODD (Int)0x80000003
-
-static const Unit uarrone[1]={1}; /* Unit array of 1, used for incrementing */
-
-/* ------------------------------------------------------------------ */
-/* round-for-reround digits */
-/* ------------------------------------------------------------------ */
-#if 0
-static const uByte DECSTICKYTAB[10]={1,1,2,3,4,6,6,7,8,9}; /* used if sticky */
-#endif
-
-/* ------------------------------------------------------------------ */
-/* Powers of ten (powers[n]==10**n, 0<=n<=9) */
-/* ------------------------------------------------------------------ */
-static const uInt DECPOWERS[10]={1, 10, 100, 1000, 10000, 100000, 1000000,
- 10000000, 100000000, 1000000000};
-
-
-/* Granularity-dependent code */
-#if DECDPUN<=4
- #define eInt Int /* extended integer */
- #define ueInt uInt /* unsigned extended integer */
- /* Constant multipliers for divide-by-power-of five using reciprocal */
- /* multiply, after removing powers of 2 by shifting, and final shift */
- /* of 17 [we only need up to **4] */
- static const uInt multies[]={131073, 26215, 5243, 1049, 210};
- /* QUOT10 -- macro to return the quotient of unit u divided by 10**n */
- #define QUOT10(u, n) ((((uInt)(u)>>(n))*multies[n])>>17)
-#else
- /* For DECDPUN>4 non-ANSI-89 64-bit types are needed. */
- #if !DECUSE64
- #error decNumber.c: DECUSE64 must be 1 when DECDPUN>4
- #endif
- #define eInt Long /* extended integer */
- #define ueInt uLong /* unsigned extended integer */
-#endif
-
-/* Local routines */
-static decNumber * decAddOp(decNumber *, const decNumber *, const decNumber *,
- decContext *, uByte, uInt *);
-static Flag decBiStr(const char *, const char *, const char *);
-static uInt decCheckMath(const decNumber *, decContext *, uInt *);
-static void decApplyRound(decNumber *, decContext *, Int, uInt *);
-static Int decCompare(const decNumber *lhs, const decNumber *rhs, Flag);
-static decNumber * decCompareOp(decNumber *, const decNumber *,
- const decNumber *, decContext *,
- Flag, uInt *);
-static void decCopyFit(decNumber *, const decNumber *, decContext *,
- Int *, uInt *);
-static decNumber * decDecap(decNumber *, Int);
-static decNumber * decDivideOp(decNumber *, const decNumber *,
- const decNumber *, decContext *, Flag, uInt *);
-static decNumber * decExpOp(decNumber *, const decNumber *,
- decContext *, uInt *);
-static void decFinalize(decNumber *, decContext *, Int *, uInt *);
-static Int decGetDigits(Unit *, Int);
-static Int decGetInt(const decNumber *);
-static decNumber * decLnOp(decNumber *, const decNumber *,
- decContext *, uInt *);
-static decNumber * decMultiplyOp(decNumber *, const decNumber *,
- const decNumber *, decContext *,
- uInt *);
-static decNumber * decNaNs(decNumber *, const decNumber *,
- const decNumber *, decContext *, uInt *);
-static decNumber * decQuantizeOp(decNumber *, const decNumber *,
- const decNumber *, decContext *, Flag,
- uInt *);
-static void decReverse(Unit *, Unit *);
-static void decSetCoeff(decNumber *, decContext *, const Unit *,
- Int, Int *, uInt *);
-static void decSetMaxValue(decNumber *, decContext *);
-static void decSetOverflow(decNumber *, decContext *, uInt *);
-static void decSetSubnormal(decNumber *, decContext *, Int *, uInt *);
-static Int decShiftToLeast(Unit *, Int, Int);
-static Int decShiftToMost(Unit *, Int, Int);
-static void decStatus(decNumber *, uInt, decContext *);
-static void decToString(const decNumber *, char[], Flag);
-static decNumber * decTrim(decNumber *, decContext *, Flag, Flag, Int *);
-static Int decUnitAddSub(const Unit *, Int, const Unit *, Int, Int,
- Unit *, Int);
-static Int decUnitCompare(const Unit *, Int, const Unit *, Int, Int);
-
-#if !DECSUBSET
-/* decFinish == decFinalize when no subset arithmetic needed */
-#define decFinish(a,b,c,d) decFinalize(a,b,c,d)
-#else
-static void decFinish(decNumber *, decContext *, Int *, uInt *);
-static decNumber * decRoundOperand(const decNumber *, decContext *, uInt *);
-#endif
-
-/* Local macros */
-/* masked special-values bits */
-#define SPECIALARG (rhs->bits & DECSPECIAL)
-#define SPECIALARGS ((lhs->bits | rhs->bits) & DECSPECIAL)
-
-/* For use in ICU */
-#define malloc(a) uprv_malloc(a)
-#define free(a) uprv_free(a)
-
-/* Diagnostic macros, etc. */
-#if DECALLOC
-/* Handle malloc/free accounting. If enabled, our accountable routines */
-/* are used; otherwise the code just goes straight to the system malloc */
-/* and free routines. */
-#define malloc(a) decMalloc(a)
-#define free(a) decFree(a)
-#define DECFENCE 0x5a /* corruption detector */
-/* 'Our' malloc and free: */
-static void *decMalloc(size_t);
-static void decFree(void *);
-uInt decAllocBytes=0; /* count of bytes allocated */
-/* Note that DECALLOC code only checks for storage buffer overflow. */
-/* To check for memory leaks, the decAllocBytes variable must be */
-/* checked to be 0 at appropriate times (e.g., after the test */
-/* harness completes a set of tests). This checking may be unreliable */
-/* if the testing is done in a multi-thread environment. */
-#endif
-
-#if DECCHECK
-/* Optional checking routines. Enabling these means that decNumber */
-/* and decContext operands to operator routines are checked for */
-/* correctness. This roughly doubles the execution time of the */
-/* fastest routines (and adds 600+ bytes), so should not normally be */
-/* used in 'production'. */
-/* decCheckInexact is used to check that inexact results have a full */
-/* complement of digits (where appropriate -- this is not the case */
-/* for Quantize, for example) */
-#define DECUNRESU ((decNumber *)(void *)0xffffffff)
-#define DECUNUSED ((const decNumber *)(void *)0xffffffff)
-#define DECUNCONT ((decContext *)(void *)(0xffffffff))
-static Flag decCheckOperands(decNumber *, const decNumber *,
- const decNumber *, decContext *);
-static Flag decCheckNumber(const decNumber *);
-static void decCheckInexact(const decNumber *, decContext *);
-#endif
-
-#if DECTRACE || DECCHECK
-/* Optional trace/debugging routines (may or may not be used) */
-void decNumberShow(const decNumber *); /* displays the components of a number */
-static void decDumpAr(char, const Unit *, Int);
-#endif
-
-/* ================================================================== */
-/* Conversions */
-/* ================================================================== */
-
-/* ------------------------------------------------------------------ */
-/* from-int32 -- conversion from Int or uInt */
-/* */
-/* dn is the decNumber to receive the integer */
-/* in or uin is the integer to be converted */
-/* returns dn */
-/* */
-/* No error is possible. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromInt32(decNumber *dn, Int in) {
- uInt unsig;
- if (in>=0) unsig=in;
- else { /* negative (possibly BADINT) */
- if (in==BADINT) unsig=(uInt)1073741824*2; /* special case */
- else unsig=-in; /* invert */
- }
- /* in is now positive */
- uprv_decNumberFromUInt32(dn, unsig);
- if (in<0) dn->bits=DECNEG; /* sign needed */
- return dn;
- } /* decNumberFromInt32 */
-
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromUInt32(decNumber *dn, uInt uin) {
- Unit *up; /* work pointer */
- uprv_decNumberZero(dn); /* clean */
- if (uin==0) return dn; /* [or decGetDigits bad call] */
- for (up=dn->lsu; uin>0; up++) {
- *up=(Unit)(uin%(DECDPUNMAX+1));
- uin=uin/(DECDPUNMAX+1);
- }
- dn->digits=decGetDigits(dn->lsu, static_cast<int32_t>(up - dn->lsu));
- return dn;
- } /* decNumberFromUInt32 */
-
-/* ------------------------------------------------------------------ */
-/* to-int32 -- conversion to Int or uInt */
-/* */
-/* dn is the decNumber to convert */
-/* set is the context for reporting errors */
-/* returns the converted decNumber, or 0 if Invalid is set */
-/* */
-/* Invalid is set if the decNumber does not have exponent==0 or if */
-/* it is a NaN, Infinite, or out-of-range. */
-/* ------------------------------------------------------------------ */
-U_CAPI Int U_EXPORT2 uprv_decNumberToInt32(const decNumber *dn, decContext *set) {
- #if DECCHECK
- if (decCheckOperands(DECUNRESU, DECUNUSED, dn, set)) return 0;
- #endif
-
- /* special or too many digits, or bad exponent */
- if (dn->bits&DECSPECIAL || dn->digits>10 || dn->exponent!=0) ; /* bad */
- else { /* is a finite integer with 10 or fewer digits */
- Int d; /* work */
- const Unit *up; /* .. */
- uInt hi=0, lo; /* .. */
- up=dn->lsu; /* -> lsu */
- lo=*up; /* get 1 to 9 digits */
- #if DECDPUN>1 /* split to higher */
- hi=lo/10;
- lo=lo%10;
- #endif
- up++;
- /* collect remaining Units, if any, into hi */
- for (d=DECDPUN; d<dn->digits; up++, d+=DECDPUN) hi+=*up*powers[d-1];
- /* now low has the lsd, hi the remainder */
- if (hi>214748364 || (hi==214748364 && lo>7)) { /* out of range? */
- /* most-negative is a reprieve */
- if (dn->bits&DECNEG && hi==214748364 && lo==8) return 0x80000000;
- /* bad -- drop through */
- }
- else { /* in-range always */
- Int i=X10(hi)+lo;
- if (dn->bits&DECNEG) return -i;
- return i;
- }
- } /* integer */
- uprv_decContextSetStatus(set, DEC_Invalid_operation); /* [may not return] */
- return 0;
- } /* decNumberToInt32 */
-
-U_CAPI uInt U_EXPORT2 uprv_decNumberToUInt32(const decNumber *dn, decContext *set) {
- #if DECCHECK
- if (decCheckOperands(DECUNRESU, DECUNUSED, dn, set)) return 0;
- #endif
- /* special or too many digits, or bad exponent, or negative (<0) */
- if (dn->bits&DECSPECIAL || dn->digits>10 || dn->exponent!=0
- || (dn->bits&DECNEG && !ISZERO(dn))); /* bad */
- else { /* is a finite integer with 10 or fewer digits */
- Int d; /* work */
- const Unit *up; /* .. */
- uInt hi=0, lo; /* .. */
- up=dn->lsu; /* -> lsu */
- lo=*up; /* get 1 to 9 digits */
- #if DECDPUN>1 /* split to higher */
- hi=lo/10;
- lo=lo%10;
- #endif
- up++;
- /* collect remaining Units, if any, into hi */
- for (d=DECDPUN; d<dn->digits; up++, d+=DECDPUN) hi+=*up*powers[d-1];
-
- /* now low has the lsd, hi the remainder */
- if (hi>429496729 || (hi==429496729 && lo>5)) ; /* no reprieve possible */
- else return X10(hi)+lo;
- } /* integer */
- uprv_decContextSetStatus(set, DEC_Invalid_operation); /* [may not return] */
- return 0;
- } /* decNumberToUInt32 */
-
-/* ------------------------------------------------------------------ */
-/* to-scientific-string -- conversion to numeric string */
-/* to-engineering-string -- conversion to numeric string */
-/* */
-/* decNumberToString(dn, string); */
-/* decNumberToEngString(dn, string); */
-/* */
-/* dn is the decNumber to convert */
-/* string is the string where the result will be laid out */
-/* */
-/* string must be at least dn->digits+14 characters long */
-/* */
-/* No error is possible, and no status can be set. */
-/* ------------------------------------------------------------------ */
-U_CAPI char * U_EXPORT2 uprv_decNumberToString(const decNumber *dn, char *string){
- decToString(dn, string, 0);
- return string;
- } /* DecNumberToString */
-
-U_CAPI char * U_EXPORT2 uprv_decNumberToEngString(const decNumber *dn, char *string){
- decToString(dn, string, 1);
- return string;
- } /* DecNumberToEngString */
-
-/* ------------------------------------------------------------------ */
-/* to-number -- conversion from numeric string */
-/* */
-/* decNumberFromString -- convert string to decNumber */
-/* dn -- the number structure to fill */
-/* chars[] -- the string to convert ('\0' terminated) */
-/* set -- the context used for processing any error, */
-/* determining the maximum precision available */
-/* (set.digits), determining the maximum and minimum */
-/* exponent (set.emax and set.emin), determining if */
-/* extended values are allowed, and checking the */
-/* rounding mode if overflow occurs or rounding is */
-/* needed. */
-/* */
-/* The length of the coefficient and the size of the exponent are */
-/* checked by this routine, so the correct error (Underflow or */
-/* Overflow) can be reported or rounding applied, as necessary. */
-/* */
-/* If bad syntax is detected, the result will be a quiet NaN. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char chars[],
- decContext *set) {
- Int exponent=0; /* working exponent [assume 0] */
- uByte bits=0; /* working flags [assume +ve] */
- Unit *res; /* where result will be built */
- Unit resbuff[SD2U(DECBUFFER+9)];/* local buffer in case need temporary */
- /* [+9 allows for ln() constants] */
- Unit *allocres=NULL; /* -> allocated result, iff allocated */
- Int d=0; /* count of digits found in decimal part */
- const char *dotchar=NULL; /* where dot was found */
- const char *cfirst=chars; /* -> first character of decimal part */
- const char *last=NULL; /* -> last digit of decimal part */
- const char *c; /* work */
- Unit *up; /* .. */
- #if DECDPUN>1
- Int cut, out; /* .. */
- #endif
- Int residue; /* rounding residue */
- uInt status=0; /* error code */
-
- #if DECCHECK
- if (decCheckOperands(DECUNRESU, DECUNUSED, DECUNUSED, set))
- return uprv_decNumberZero(dn);
- #endif
-
- do { /* status & malloc protection */
- for (c=chars;; c++) { /* -> input character */
- if (*c>='0' && *c<='9') { /* test for Arabic digit */
- last=c;
- d++; /* count of real digits */
- continue; /* still in decimal part */
- }
- if (*c=='.' && dotchar==NULL) { /* first '.' */
- dotchar=c; /* record offset into decimal part */
- if (c==cfirst) cfirst++; /* first digit must follow */
- continue;}
- if (c==chars) { /* first in string... */
- if (*c=='-') { /* valid - sign */
- cfirst++;
- bits=DECNEG;
- continue;}
- if (*c=='+') { /* valid + sign */
- cfirst++;
- continue;}
- }
- /* *c is not a digit, or a valid +, -, or '.' */
- break;
- } /* c */
-
- if (last==NULL) { /* no digits yet */
- status=DEC_Conversion_syntax;/* assume the worst */
- if (*c=='\0') break; /* and no more to come... */
- #if DECSUBSET
- /* if subset then infinities and NaNs are not allowed */
- if (!set->extended) break; /* hopeless */
- #endif
- /* Infinities and NaNs are possible, here */
- if (dotchar!=NULL) break; /* .. unless had a dot */
- uprv_decNumberZero(dn); /* be optimistic */
- if (decBiStr(c, "infinity", "INFINITY")
- || decBiStr(c, "inf", "INF")) {
- dn->bits=bits | DECINF;
- status=0; /* is OK */
- break; /* all done */
- }
- /* a NaN expected */
- /* 2003.09.10 NaNs are now permitted to have a sign */
- dn->bits=bits | DECNAN; /* assume simple NaN */
- if (*c=='s' || *c=='S') { /* looks like an sNaN */
- c++;
- dn->bits=bits | DECSNAN;
- }
- if (*c!='n' && *c!='N') break; /* check caseless "NaN" */
- c++;
- if (*c!='a' && *c!='A') break; /* .. */
- c++;
- if (*c!='n' && *c!='N') break; /* .. */
- c++;
- /* now either nothing, or nnnn payload, expected */
- /* -> start of integer and skip leading 0s [including plain 0] */
- for (cfirst=c; *cfirst=='0';) cfirst++;
- if (*cfirst=='\0') { /* "NaN" or "sNaN", maybe with all 0s */
- status=0; /* it's good */
- break; /* .. */
- }
- /* something other than 0s; setup last and d as usual [no dots] */
- for (c=cfirst;; c++, d++) {
- if (*c<'0' || *c>'9') break; /* test for Arabic digit */
- last=c;
- }
- if (*c!='\0') break; /* not all digits */
- if (d>set->digits-1) {
- /* [NB: payload in a decNumber can be full length unless */
- /* clamped, in which case can only be digits-1] */
- if (set->clamp) break;
- if (d>set->digits) break;
- } /* too many digits? */
- /* good; drop through to convert the integer to coefficient */
- status=0; /* syntax is OK */
- bits=dn->bits; /* for copy-back */
- } /* last==NULL */
-
- else if (*c!='\0') { /* more to process... */
- /* had some digits; exponent is only valid sequence now */
- Flag nege; /* 1=negative exponent */
- const char *firstexp; /* -> first significant exponent digit */
- status=DEC_Conversion_syntax;/* assume the worst */
- if (*c!='e' && *c!='E') break;
- /* Found 'e' or 'E' -- now process explicit exponent */
- /* 1998.07.11: sign no longer required */
- nege=0;
- c++; /* to (possible) sign */
- if (*c=='-') {nege=1; c++;}
- else if (*c=='+') c++;
- if (*c=='\0') break;
-
- for (; *c=='0' && *(c+1)!='\0';) c++; /* strip insignificant zeros */
- firstexp=c; /* save exponent digit place */
- uInt uexponent = 0; /* Avoid undefined behavior on signed int overflow */
- for (; ;c++) {
- if (*c<'0' || *c>'9') break; /* not a digit */
- uexponent=X10(uexponent)+(uInt)*c-(uInt)'0';
- } /* c */
- exponent = (Int)uexponent;
- /* if not now on a '\0', *c must not be a digit */
- if (*c!='\0') break;
-
- /* (this next test must be after the syntax checks) */
- /* if it was too long the exponent may have wrapped, so check */
- /* carefully and set it to a certain overflow if wrap possible */
- if (c>=firstexp+9+1) {
- if (c>firstexp+9+1 || *firstexp>'1') exponent=DECNUMMAXE*2;
- /* [up to 1999999999 is OK, for example 1E-1000000998] */
- }
- if (nege) exponent=-exponent; /* was negative */
- status=0; /* is OK */
- } /* stuff after digits */
-
- /* Here when whole string has been inspected; syntax is good */
- /* cfirst->first digit (never dot), last->last digit (ditto) */
-
- /* strip leading zeros/dot [leave final 0 if all 0's] */
- if (*cfirst=='0') { /* [cfirst has stepped over .] */
- for (c=cfirst; c<last; c++, cfirst++) {
- if (*c=='.') continue; /* ignore dots */
- if (*c!='0') break; /* non-zero found */
- d--; /* 0 stripped */
- } /* c */
- #if DECSUBSET
- /* make a rapid exit for easy zeros if !extended */
- if (*cfirst=='0' && !set->extended) {
- uprv_decNumberZero(dn); /* clean result */
- break; /* [could be return] */
- }
- #endif
- } /* at least one leading 0 */
-
- /* Handle decimal point... */
- if (dotchar!=NULL && dotchar<last) /* non-trailing '.' found? */
- exponent -= static_cast<int32_t>(last-dotchar); /* adjust exponent */
- /* [we can now ignore the .] */
-
- /* OK, the digits string is good. Assemble in the decNumber, or in */
- /* a temporary units array if rounding is needed */
- if (d<=set->digits) res=dn->lsu; /* fits into supplied decNumber */
- else { /* rounding needed */
- Int needbytes=D2U(d)*sizeof(Unit);/* bytes needed */
- res=resbuff; /* assume use local buffer */
- if (needbytes>(Int)sizeof(resbuff)) { /* too big for local */
- allocres=(Unit *)malloc(needbytes);
- if (allocres==NULL) {status|=DEC_Insufficient_storage; break;}
- res=allocres;
- }
- }
- /* res now -> number lsu, buffer, or allocated storage for Unit array */
-
- /* Place the coefficient into the selected Unit array */
- /* [this is often 70% of the cost of this function when DECDPUN>1] */
- #if DECDPUN>1
- out=0; /* accumulator */
- up=res+D2U(d)-1; /* -> msu */
- cut=d-(up-res)*DECDPUN; /* digits in top unit */
- for (c=cfirst;; c++) { /* along the digits */
- if (*c=='.') continue; /* ignore '.' [don't decrement cut] */
- out=X10(out)+(Int)*c-(Int)'0';
- if (c==last) break; /* done [never get to trailing '.'] */
- cut--;
- if (cut>0) continue; /* more for this unit */
- *up=(Unit)out; /* write unit */
- up--; /* prepare for unit below.. */
- cut=DECDPUN; /* .. */
- out=0; /* .. */
- } /* c */
- *up=(Unit)out; /* write lsu */
-
- #else
- /* DECDPUN==1 */
- up=res; /* -> lsu */
- for (c=last; c>=cfirst; c--) { /* over each character, from least */
- if (*c=='.') continue; /* ignore . [don't step up] */
- *up=(Unit)((Int)*c-(Int)'0');
- up++;
- } /* c */
- #endif
-
- dn->bits=bits;
- dn->exponent=exponent;
- dn->digits=d;
-
- /* if not in number (too long) shorten into the number */
- if (d>set->digits) {
- residue=0;
- decSetCoeff(dn, set, res, d, &residue, &status);
- /* always check for overflow or subnormal and round as needed */
- decFinalize(dn, set, &residue, &status);
- }
- else { /* no rounding, but may still have overflow or subnormal */
- /* [these tests are just for performance; finalize repeats them] */
- if ((dn->exponent-1<set->emin-dn->digits)
- || (dn->exponent-1>set->emax-set->digits)) {
- residue=0;
- decFinalize(dn, set, &residue, &status);
- }
- }
- /* decNumberShow(dn); */
- } while(0); /* [for break] */
-
- if (allocres!=NULL) free(allocres); /* drop any storage used */
- if (status!=0) decStatus(dn, status, set);
- return dn;
- } /* decNumberFromString */
-
-/* ================================================================== */
-/* Operators */
-/* ================================================================== */
-
-/* ------------------------------------------------------------------ */
-/* decNumberAbs -- absolute value operator */
-/* */
-/* This computes C = abs(A) */
-/* */
-/* res is C, the result. C may be A */
-/* rhs is A */
-/* set is the context */
-/* */
-/* See also decNumberCopyAbs for a quiet bitwise version of this. */
-/* C must have space for set->digits digits. */
-/* ------------------------------------------------------------------ */
-/* This has the same effect as decNumberPlus unless A is negative, */
-/* in which case it has the same effect as decNumberMinus. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberAbs(decNumber *res, const decNumber *rhs,
- decContext *set) {
- decNumber dzero; /* for 0 */
- uInt status=0; /* accumulator */
-
- #if DECCHECK
- if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
- #endif
-
- uprv_decNumberZero(&dzero); /* set 0 */
- dzero.exponent=rhs->exponent; /* [no coefficient expansion] */
- decAddOp(res, &dzero, rhs, set, (uByte)(rhs->bits & DECNEG), &status);
- if (status!=0) decStatus(res, status, set);
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberAbs */
-
-/* ------------------------------------------------------------------ */
-/* decNumberAdd -- add two Numbers */
-/* */
-/* This computes C = A + B */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X+X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* */
-/* C must have space for set->digits digits. */
-/* ------------------------------------------------------------------ */
-/* This just calls the routine shared with Subtract */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberAdd(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
- decAddOp(res, lhs, rhs, set, 0, &status);
- if (status!=0) decStatus(res, status, set);
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberAdd */
-
-/* ------------------------------------------------------------------ */
-/* decNumberAnd -- AND two Numbers, digitwise */
-/* */
-/* This computes C = A & B */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X&X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context (used for result length and error report) */
-/* */
-/* C must have space for set->digits digits. */
-/* */
-/* Logical function restrictions apply (see above); a NaN is */
-/* returned with Invalid_operation if a restriction is violated. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberAnd(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- const Unit *ua, *ub; /* -> operands */
- const Unit *msua, *msub; /* -> operand msus */
- Unit *uc, *msuc; /* -> result and its msu */
- Int msudigs; /* digits in res msu */
- #if DECCHECK
- if (decCheckOperands(res, lhs, rhs, set)) return res;
- #endif
-
- if (lhs->exponent!=0 || decNumberIsSpecial(lhs) || decNumberIsNegative(lhs)
- || rhs->exponent!=0 || decNumberIsSpecial(rhs) || decNumberIsNegative(rhs)) {
- decStatus(res, DEC_Invalid_operation, set);
- return res;
- }
-
- /* operands are valid */
- ua=lhs->lsu; /* bottom-up */
- ub=rhs->lsu; /* .. */
- uc=res->lsu; /* .. */
- msua=ua+D2U(lhs->digits)-1; /* -> msu of lhs */
- msub=ub+D2U(rhs->digits)-1; /* -> msu of rhs */
- msuc=uc+D2U(set->digits)-1; /* -> msu of result */
- msudigs=MSUDIGITS(set->digits); /* [faster than remainder] */
- for (; uc<=msuc; ua++, ub++, uc++) { /* Unit loop */
- Unit a, b; /* extract units */
- if (ua>msua) a=0;
- else a=*ua;
- if (ub>msub) b=0;
- else b=*ub;
- *uc=0; /* can now write back */
- if (a|b) { /* maybe 1 bits to examine */
- Int i, j;
- *uc=0; /* can now write back */
- /* This loop could be unrolled and/or use BIN2BCD tables */
- for (i=0; i<DECDPUN; i++) {
- if (a&b&1) *uc=*uc+(Unit)powers[i]; /* effect AND */
- j=a%10;
- a=a/10;
- j|=b%10;
- b=b/10;
- if (j>1) {
- decStatus(res, DEC_Invalid_operation, set);
- return res;
- }
- if (uc==msuc && i==msudigs-1) break; /* just did final digit */
- } /* each digit */
- } /* both OK */
- } /* each unit */
- /* [here uc-1 is the msu of the result] */
- res->digits=decGetDigits(res->lsu, static_cast<int32_t>(uc - res->lsu));
- res->exponent=0; /* integer */
- res->bits=0; /* sign=0 */
- return res; /* [no status to set] */
- } /* decNumberAnd */
-
-/* ------------------------------------------------------------------ */
-/* decNumberCompare -- compare two Numbers */
-/* */
-/* This computes C = A ? B */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X?X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* */
-/* C must have space for one digit (or NaN). */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompare(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
- decCompareOp(res, lhs, rhs, set, COMPARE, &status);
- if (status!=0) decStatus(res, status, set);
- return res;
- } /* decNumberCompare */
-
-/* ------------------------------------------------------------------ */
-/* decNumberCompareSignal -- compare, signalling on all NaNs */
-/* */
-/* This computes C = A ? B */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X?X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* */
-/* C must have space for one digit (or NaN). */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompareSignal(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
- decCompareOp(res, lhs, rhs, set, COMPSIG, &status);
- if (status!=0) decStatus(res, status, set);
- return res;
- } /* decNumberCompareSignal */
-
-/* ------------------------------------------------------------------ */
-/* decNumberCompareTotal -- compare two Numbers, using total ordering */
-/* */
-/* This computes C = A ? B, under total ordering */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X?X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* */
-/* C must have space for one digit; the result will always be one of */
-/* -1, 0, or 1. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompareTotal(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
- decCompareOp(res, lhs, rhs, set, COMPTOTAL, &status);
- if (status!=0) decStatus(res, status, set);
- return res;
- } /* decNumberCompareTotal */
-
-/* ------------------------------------------------------------------ */
-/* decNumberCompareTotalMag -- compare, total ordering of magnitudes */
-/* */
-/* This computes C = |A| ? |B|, under total ordering */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X?X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* */
-/* C must have space for one digit; the result will always be one of */
-/* -1, 0, or 1. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompareTotalMag(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
- uInt needbytes; /* for space calculations */
- decNumber bufa[D2N(DECBUFFER+1)];/* +1 in case DECBUFFER=0 */
- decNumber *allocbufa=NULL; /* -> allocated bufa, iff allocated */
- decNumber bufb[D2N(DECBUFFER+1)];
- decNumber *allocbufb=NULL; /* -> allocated bufb, iff allocated */
- decNumber *a, *b; /* temporary pointers */
-
- #if DECCHECK
- if (decCheckOperands(res, lhs, rhs, set)) return res;
- #endif
-
- do { /* protect allocated storage */
- /* if either is negative, take a copy and absolute */
- if (decNumberIsNegative(lhs)) { /* lhs<0 */
- a=bufa;
- needbytes=sizeof(decNumber)+(D2U(lhs->digits)-1)*sizeof(Unit);
- if (needbytes>sizeof(bufa)) { /* need malloc space */
- allocbufa=(decNumber *)malloc(needbytes);
- if (allocbufa==NULL) { /* hopeless -- abandon */
- status|=DEC_Insufficient_storage;
- break;}
- a=allocbufa; /* use the allocated space */
- }
- uprv_decNumberCopy(a, lhs); /* copy content */
- a->bits&=~DECNEG; /* .. and clear the sign */
- lhs=a; /* use copy from here on */
- }
- if (decNumberIsNegative(rhs)) { /* rhs<0 */
- b=bufb;
- needbytes=sizeof(decNumber)+(D2U(rhs->digits)-1)*sizeof(Unit);
- if (needbytes>sizeof(bufb)) { /* need malloc space */
- allocbufb=(decNumber *)malloc(needbytes);
- if (allocbufb==NULL) { /* hopeless -- abandon */
- status|=DEC_Insufficient_storage;
- break;}
- b=allocbufb; /* use the allocated space */
- }
- uprv_decNumberCopy(b, rhs); /* copy content */
- b->bits&=~DECNEG; /* .. and clear the sign */
- rhs=b; /* use copy from here on */
- }
- decCompareOp(res, lhs, rhs, set, COMPTOTAL, &status);
- } while(0); /* end protected */
-
- if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */
- if (allocbufb!=NULL) free(allocbufb); /* .. */
- if (status!=0) decStatus(res, status, set);
- return res;
- } /* decNumberCompareTotalMag */
-
-/* ------------------------------------------------------------------ */
-/* decNumberDivide -- divide one number by another */
-/* */
-/* This computes C = A / B */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X/X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* */
-/* C must have space for set->digits digits. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberDivide(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
- decDivideOp(res, lhs, rhs, set, DIVIDE, &status);
- if (status!=0) decStatus(res, status, set);
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberDivide */
-
-/* ------------------------------------------------------------------ */
-/* decNumberDivideInteger -- divide and return integer quotient */
-/* */
-/* This computes C = A # B, where # is the integer divide operator */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X#X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* */
-/* C must have space for set->digits digits. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberDivideInteger(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
- decDivideOp(res, lhs, rhs, set, DIVIDEINT, &status);
- if (status!=0) decStatus(res, status, set);
- return res;
- } /* decNumberDivideInteger */
-
-/* ------------------------------------------------------------------ */
-/* decNumberExp -- exponentiation */
-/* */
-/* This computes C = exp(A) */
-/* */
-/* res is C, the result. C may be A */
-/* rhs is A */
-/* set is the context; note that rounding mode has no effect */
-/* */
-/* C must have space for set->digits digits. */
-/* */
-/* Mathematical function restrictions apply (see above); a NaN is */
-/* returned with Invalid_operation if a restriction is violated. */
-/* */
-/* Finite results will always be full precision and Inexact, except */
-/* when A is a zero or -Infinity (giving 1 or 0 respectively). */
-/* */
-/* An Inexact result is rounded using DEC_ROUND_HALF_EVEN; it will */
-/* almost always be correctly rounded, but may be up to 1 ulp in */
-/* error in rare cases. */
-/* ------------------------------------------------------------------ */
-/* This is a wrapper for decExpOp which can handle the slightly wider */
-/* (double) range needed by Ln (which has to be able to calculate */
-/* exp(-a) where a can be the tiniest number (Ntiny). */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberExp(decNumber *res, const decNumber *rhs,
- decContext *set) {
- uInt status=0; /* accumulator */
- #if DECSUBSET
- decNumber *allocrhs=NULL; /* non-NULL if rounded rhs allocated */
- #endif
-
- #if DECCHECK
- if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
- #endif
-
- /* Check restrictions; these restrictions ensure that if h=8 (see */
- /* decExpOp) then the result will either overflow or underflow to 0. */
- /* Other math functions restrict the input range, too, for inverses. */
- /* If not violated then carry out the operation. */
- if (!decCheckMath(rhs, set, &status)) do { /* protect allocation */
- #if DECSUBSET
- if (!set->extended) {
- /* reduce operand and set lostDigits status, as needed */
- if (rhs->digits>set->digits) {
- allocrhs=decRoundOperand(rhs, set, &status);
- if (allocrhs==NULL) break;
- rhs=allocrhs;
- }
- }
- #endif
- decExpOp(res, rhs, set, &status);
- } while(0); /* end protected */
-
- #if DECSUBSET
- if (allocrhs !=NULL) free(allocrhs); /* drop any storage used */
- #endif
- /* apply significant status */
- if (status!=0) decStatus(res, status, set);
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberExp */
-
-/* ------------------------------------------------------------------ */
-/* decNumberFMA -- fused multiply add */
-/* */
-/* This computes D = (A * B) + C with only one rounding */
-/* */
-/* res is D, the result. D may be A or B or C (e.g., X=FMA(X,X,X)) */
-/* lhs is A */
-/* rhs is B */
-/* fhs is C [far hand side] */
-/* set is the context */
-/* */
-/* Mathematical function restrictions apply (see above); a NaN is */
-/* returned with Invalid_operation if a restriction is violated. */
-/* */
-/* C must have space for set->digits digits. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberFMA(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, const decNumber *fhs,
- decContext *set) {
- uInt status=0; /* accumulator */
- decContext dcmul; /* context for the multiplication */
- uInt needbytes; /* for space calculations */
- decNumber bufa[D2N(DECBUFFER*2+1)];
- decNumber *allocbufa=NULL; /* -> allocated bufa, iff allocated */
- decNumber *acc; /* accumulator pointer */
- decNumber dzero; /* work */
-
- #if DECCHECK
- if (decCheckOperands(res, lhs, rhs, set)) return res;
- if (decCheckOperands(res, fhs, DECUNUSED, set)) return res;
- #endif
-
- do { /* protect allocated storage */
- #if DECSUBSET
- if (!set->extended) { /* [undefined if subset] */
- status|=DEC_Invalid_operation;
- break;}
- #endif
- /* Check math restrictions [these ensure no overflow or underflow] */
- if ((!decNumberIsSpecial(lhs) && decCheckMath(lhs, set, &status))
- || (!decNumberIsSpecial(rhs) && decCheckMath(rhs, set, &status))
- || (!decNumberIsSpecial(fhs) && decCheckMath(fhs, set, &status))) break;
- /* set up context for multiply */
- dcmul=*set;
- dcmul.digits=lhs->digits+rhs->digits; /* just enough */
- /* [The above may be an over-estimate for subset arithmetic, but that's OK] */
- dcmul.emax=DEC_MAX_EMAX; /* effectively unbounded .. */
- dcmul.emin=DEC_MIN_EMIN; /* [thanks to Math restrictions] */
- /* set up decNumber space to receive the result of the multiply */
- acc=bufa; /* may fit */
- needbytes=sizeof(decNumber)+(D2U(dcmul.digits)-1)*sizeof(Unit);
- if (needbytes>sizeof(bufa)) { /* need malloc space */
- allocbufa=(decNumber *)malloc(needbytes);
- if (allocbufa==NULL) { /* hopeless -- abandon */
- status|=DEC_Insufficient_storage;
- break;}
- acc=allocbufa; /* use the allocated space */
- }
- /* multiply with extended range and necessary precision */
- /*printf("emin=%ld\n", dcmul.emin); */
- decMultiplyOp(acc, lhs, rhs, &dcmul, &status);
- /* Only Invalid operation (from sNaN or Inf * 0) is possible in */
- /* status; if either is seen than ignore fhs (in case it is */
- /* another sNaN) and set acc to NaN unless we had an sNaN */
- /* [decMultiplyOp leaves that to caller] */
- /* Note sNaN has to go through addOp to shorten payload if */
- /* necessary */
- if ((status&DEC_Invalid_operation)!=0) {
- if (!(status&DEC_sNaN)) { /* but be true invalid */
- uprv_decNumberZero(res); /* acc not yet set */
- res->bits=DECNAN;
- break;
- }
- uprv_decNumberZero(&dzero); /* make 0 (any non-NaN would do) */
- fhs=&dzero; /* use that */
- }
- #if DECCHECK
- else { /* multiply was OK */
- if (status!=0) printf("Status=%08lx after FMA multiply\n", (LI)status);
- }
- #endif
- /* add the third operand and result -> res, and all is done */
- decAddOp(res, acc, fhs, set, 0, &status);
- } while(0); /* end protected */
-
- if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */
- if (status!=0) decStatus(res, status, set);
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberFMA */
-
-/* ------------------------------------------------------------------ */
-/* decNumberInvert -- invert a Number, digitwise */
-/* */
-/* This computes C = ~A */
-/* */
-/* res is C, the result. C may be A (e.g., X=~X) */
-/* rhs is A */
-/* set is the context (used for result length and error report) */
-/* */
-/* C must have space for set->digits digits. */
-/* */
-/* Logical function restrictions apply (see above); a NaN is */
-/* returned with Invalid_operation if a restriction is violated. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberInvert(decNumber *res, const decNumber *rhs,
- decContext *set) {
- const Unit *ua, *msua; /* -> operand and its msu */
- Unit *uc, *msuc; /* -> result and its msu */
- Int msudigs; /* digits in res msu */
- #if DECCHECK
- if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
- #endif
-
- if (rhs->exponent!=0 || decNumberIsSpecial(rhs) || decNumberIsNegative(rhs)) {
- decStatus(res, DEC_Invalid_operation, set);
- return res;
- }
- /* operand is valid */
- ua=rhs->lsu; /* bottom-up */
- uc=res->lsu; /* .. */
- msua=ua+D2U(rhs->digits)-1; /* -> msu of rhs */
- msuc=uc+D2U(set->digits)-1; /* -> msu of result */
- msudigs=MSUDIGITS(set->digits); /* [faster than remainder] */
- for (; uc<=msuc; ua++, uc++) { /* Unit loop */
- Unit a; /* extract unit */
- Int i, j; /* work */
- if (ua>msua) a=0;
- else a=*ua;
- *uc=0; /* can now write back */
- /* always need to examine all bits in rhs */
- /* This loop could be unrolled and/or use BIN2BCD tables */
- for (i=0; i<DECDPUN; i++) {
- if ((~a)&1) *uc=*uc+(Unit)powers[i]; /* effect INVERT */
- j=a%10;
- a=a/10;
- if (j>1) {
- decStatus(res, DEC_Invalid_operation, set);
- return res;
- }
- if (uc==msuc && i==msudigs-1) break; /* just did final digit */
- } /* each digit */
- } /* each unit */
- /* [here uc-1 is the msu of the result] */
- res->digits=decGetDigits(res->lsu, static_cast<int32_t>(uc - res->lsu));
- res->exponent=0; /* integer */
- res->bits=0; /* sign=0 */
- return res; /* [no status to set] */
- } /* decNumberInvert */
-
-/* ------------------------------------------------------------------ */
-/* decNumberLn -- natural logarithm */
-/* */
-/* This computes C = ln(A) */
-/* */
-/* res is C, the result. C may be A */
-/* rhs is A */
-/* set is the context; note that rounding mode has no effect */
-/* */
-/* C must have space for set->digits digits. */
-/* */
-/* Notable cases: */
-/* A<0 -> Invalid */
-/* A=0 -> -Infinity (Exact) */
-/* A=+Infinity -> +Infinity (Exact) */
-/* A=1 exactly -> 0 (Exact) */
-/* */
-/* Mathematical function restrictions apply (see above); a NaN is */
-/* returned with Invalid_operation if a restriction is violated. */
-/* */
-/* An Inexact result is rounded using DEC_ROUND_HALF_EVEN; it will */
-/* almost always be correctly rounded, but may be up to 1 ulp in */
-/* error in rare cases. */
-/* ------------------------------------------------------------------ */
-/* This is a wrapper for decLnOp which can handle the slightly wider */
-/* (+11) range needed by Ln, Log10, etc. (which may have to be able */
-/* to calculate at p+e+2). */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberLn(decNumber *res, const decNumber *rhs,
- decContext *set) {
- uInt status=0; /* accumulator */
- #if DECSUBSET
- decNumber *allocrhs=NULL; /* non-NULL if rounded rhs allocated */
- #endif
-
- #if DECCHECK
- if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
- #endif
-
- /* Check restrictions; this is a math function; if not violated */
- /* then carry out the operation. */
- if (!decCheckMath(rhs, set, &status)) do { /* protect allocation */
- #if DECSUBSET
- if (!set->extended) {
- /* reduce operand and set lostDigits status, as needed */
- if (rhs->digits>set->digits) {
- allocrhs=decRoundOperand(rhs, set, &status);
- if (allocrhs==NULL) break;
- rhs=allocrhs;
- }
- /* special check in subset for rhs=0 */
- if (ISZERO(rhs)) { /* +/- zeros -> error */
- status|=DEC_Invalid_operation;
- break;}
- } /* extended=0 */
- #endif
- decLnOp(res, rhs, set, &status);
- } while(0); /* end protected */
-
- #if DECSUBSET
- if (allocrhs !=NULL) free(allocrhs); /* drop any storage used */
- #endif
- /* apply significant status */
- if (status!=0) decStatus(res, status, set);
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberLn */
-
-/* ------------------------------------------------------------------ */
-/* decNumberLogB - get adjusted exponent, by 754 rules */
-/* */
-/* This computes C = adjustedexponent(A) */
-/* */
-/* res is C, the result. C may be A */
-/* rhs is A */
-/* set is the context, used only for digits and status */
-/* */
-/* C must have space for 10 digits (A might have 10**9 digits and */
-/* an exponent of +999999999, or one digit and an exponent of */
-/* -1999999999). */
-/* */
-/* This returns the adjusted exponent of A after (in theory) padding */
-/* with zeros on the right to set->digits digits while keeping the */
-/* same value. The exponent is not limited by emin/emax. */
-/* */
-/* Notable cases: */
-/* A<0 -> Use |A| */
-/* A=0 -> -Infinity (Division by zero) */
-/* A=Infinite -> +Infinity (Exact) */
-/* A=1 exactly -> 0 (Exact) */
-/* NaNs are propagated as usual */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberLogB(decNumber *res, const decNumber *rhs,
- decContext *set) {
- uInt status=0; /* accumulator */
-
- #if DECCHECK
- if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
- #endif
-
- /* NaNs as usual; Infinities return +Infinity; 0->oops */
- if (decNumberIsNaN(rhs)) decNaNs(res, rhs, NULL, set, &status);
- else if (decNumberIsInfinite(rhs)) uprv_decNumberCopyAbs(res, rhs);
- else if (decNumberIsZero(rhs)) {
- uprv_decNumberZero(res); /* prepare for Infinity */
- res->bits=DECNEG|DECINF; /* -Infinity */
- status|=DEC_Division_by_zero; /* as per 754 */
- }
- else { /* finite non-zero */
- Int ae=rhs->exponent+rhs->digits-1; /* adjusted exponent */
- uprv_decNumberFromInt32(res, ae); /* lay it out */
- }
-
- if (status!=0) decStatus(res, status, set);
- return res;
- } /* decNumberLogB */
-
-/* ------------------------------------------------------------------ */
-/* decNumberLog10 -- logarithm in base 10 */
-/* */
-/* This computes C = log10(A) */
-/* */
-/* res is C, the result. C may be A */
-/* rhs is A */
-/* set is the context; note that rounding mode has no effect */
-/* */
-/* C must have space for set->digits digits. */
-/* */
-/* Notable cases: */
-/* A<0 -> Invalid */
-/* A=0 -> -Infinity (Exact) */
-/* A=+Infinity -> +Infinity (Exact) */
-/* A=10**n (if n is an integer) -> n (Exact) */
-/* */
-/* Mathematical function restrictions apply (see above); a NaN is */
-/* returned with Invalid_operation if a restriction is violated. */
-/* */
-/* An Inexact result is rounded using DEC_ROUND_HALF_EVEN; it will */
-/* almost always be correctly rounded, but may be up to 1 ulp in */
-/* error in rare cases. */
-/* ------------------------------------------------------------------ */
-/* This calculates ln(A)/ln(10) using appropriate precision. For */
-/* ln(A) this is the max(p, rhs->digits + t) + 3, where p is the */
-/* requested digits and t is the number of digits in the exponent */
-/* (maximum 6). For ln(10) it is p + 3; this is often handled by the */
-/* fastpath in decLnOp. The final division is done to the requested */
-/* precision. */
-/* ------------------------------------------------------------------ */
-#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Warray-bounds"
-#endif
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *res, const decNumber *rhs,
- decContext *set) {
- uInt status=0, ignore=0; /* status accumulators */
- uInt needbytes; /* for space calculations */
- Int p; /* working precision */
- Int t; /* digits in exponent of A */
-
- /* buffers for a and b working decimals */
- /* (adjustment calculator, same size) */
- decNumber bufa[D2N(DECBUFFER+2)];
- decNumber *allocbufa=NULL; /* -> allocated bufa, iff allocated */
- decNumber *a=bufa; /* temporary a */
- decNumber bufb[D2N(DECBUFFER+2)];
- decNumber *allocbufb=NULL; /* -> allocated bufb, iff allocated */
- decNumber *b=bufb; /* temporary b */
- decNumber bufw[D2N(10)]; /* working 2-10 digit number */
- decNumber *w=bufw; /* .. */
- #if DECSUBSET
- decNumber *allocrhs=NULL; /* non-NULL if rounded rhs allocated */
- #endif
-
- decContext aset; /* working context */
-
- #if DECCHECK
- if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
- #endif
-
- /* Check restrictions; this is a math function; if not violated */
- /* then carry out the operation. */
- if (!decCheckMath(rhs, set, &status)) do { /* protect malloc */
- #if DECSUBSET
- if (!set->extended) {
- /* reduce operand and set lostDigits status, as needed */
- if (rhs->digits>set->digits) {
- allocrhs=decRoundOperand(rhs, set, &status);
- if (allocrhs==NULL) break;
- rhs=allocrhs;
- }
- /* special check in subset for rhs=0 */
- if (ISZERO(rhs)) { /* +/- zeros -> error */
- status|=DEC_Invalid_operation;
- break;}
- } /* extended=0 */
- #endif
-
- uprv_decContextDefault(&aset, DEC_INIT_DECIMAL64); /* clean context */
-
- /* handle exact powers of 10; only check if +ve finite */
- if (!(rhs->bits&(DECNEG|DECSPECIAL)) && !ISZERO(rhs)) {
- Int residue=0; /* (no residue) */
- uInt copystat=0; /* clean status */
-
- /* round to a single digit... */
- aset.digits=1;
- decCopyFit(w, rhs, &aset, &residue, &copystat); /* copy & shorten */
- /* if exact and the digit is 1, rhs is a power of 10 */
- if (!(copystat&DEC_Inexact) && w->lsu[0]==1) {
- /* the exponent, conveniently, is the power of 10; making */
- /* this the result needs a little care as it might not fit, */
- /* so first convert it into the working number, and then move */
- /* to res */
- uprv_decNumberFromInt32(w, w->exponent);
- residue=0;
- decCopyFit(res, w, set, &residue, &status); /* copy & round */
- decFinish(res, set, &residue, &status); /* cleanup/set flags */
- break;
- } /* not a power of 10 */
- } /* not a candidate for exact */
-
- /* simplify the information-content calculation to use 'total */
- /* number of digits in a, including exponent' as compared to the */
- /* requested digits, as increasing this will only rarely cost an */
- /* iteration in ln(a) anyway */
- t=6; /* it can never be >6 */
-
- /* allocate space when needed... */
- p=(rhs->digits+t>set->digits?rhs->digits+t:set->digits)+3;
- needbytes=sizeof(decNumber)+(D2U(p)-1)*sizeof(Unit);
- if (needbytes>sizeof(bufa)) { /* need malloc space */
- allocbufa=(decNumber *)malloc(needbytes);
- if (allocbufa==NULL) { /* hopeless -- abandon */
- status|=DEC_Insufficient_storage;
- break;}
- a=allocbufa; /* use the allocated space */
- }
- aset.digits=p; /* as calculated */
- aset.emax=DEC_MAX_MATH; /* usual bounds */
- aset.emin=-DEC_MAX_MATH; /* .. */
- aset.clamp=0; /* and no concrete format */
- decLnOp(a, rhs, &aset, &status); /* a=ln(rhs) */
-
- /* skip the division if the result so far is infinite, NaN, or */
- /* zero, or there was an error; note NaN from sNaN needs copy */
- if (status&DEC_NaNs && !(status&DEC_sNaN)) break;
- if (a->bits&DECSPECIAL || ISZERO(a)) {
- uprv_decNumberCopy(res, a); /* [will fit] */
- break;}
-
- /* for ln(10) an extra 3 digits of precision are needed */
- p=set->digits+3;
- needbytes=sizeof(decNumber)+(D2U(p)-1)*sizeof(Unit);
- if (needbytes>sizeof(bufb)) { /* need malloc space */
- allocbufb=(decNumber *)malloc(needbytes);
- if (allocbufb==NULL) { /* hopeless -- abandon */
- status|=DEC_Insufficient_storage;
- break;}
- b=allocbufb; /* use the allocated space */
- }
- uprv_decNumberZero(w); /* set up 10... */
- #if DECDPUN==1
- w->lsu[1]=1; w->lsu[0]=0; /* .. */
- #else
- w->lsu[0]=10; /* .. */
- #endif
- w->digits=2; /* .. */
-
- aset.digits=p;
- decLnOp(b, w, &aset, &ignore); /* b=ln(10) */
-
- aset.digits=set->digits; /* for final divide */
- decDivideOp(res, a, b, &aset, DIVIDE, &status); /* into result */
- } while(0); /* [for break] */
-
- if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */
- if (allocbufb!=NULL) free(allocbufb); /* .. */
- #if DECSUBSET
- if (allocrhs !=NULL) free(allocrhs); /* .. */
- #endif
- /* apply significant status */
- if (status!=0) decStatus(res, status, set);
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberLog10 */
-#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406
-#pragma GCC diagnostic pop
-#endif
-
-/* ------------------------------------------------------------------ */
-/* decNumberMax -- compare two Numbers and return the maximum */
-/* */
-/* This computes C = A ? B, returning the maximum by 754 rules */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X?X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* */
-/* C must have space for set->digits digits. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberMax(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
- decCompareOp(res, lhs, rhs, set, COMPMAX, &status);
- if (status!=0) decStatus(res, status, set);
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberMax */
-
-/* ------------------------------------------------------------------ */
-/* decNumberMaxMag -- compare and return the maximum by magnitude */
-/* */
-/* This computes C = A ? B, returning the maximum by 754 rules */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X?X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* */
-/* C must have space for set->digits digits. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberMaxMag(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
- decCompareOp(res, lhs, rhs, set, COMPMAXMAG, &status);
- if (status!=0) decStatus(res, status, set);
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberMaxMag */
-
-/* ------------------------------------------------------------------ */
-/* decNumberMin -- compare two Numbers and return the minimum */
-/* */
-/* This computes C = A ? B, returning the minimum by 754 rules */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X?X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* */
-/* C must have space for set->digits digits. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberMin(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
- decCompareOp(res, lhs, rhs, set, COMPMIN, &status);
- if (status!=0) decStatus(res, status, set);
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberMin */
-
-/* ------------------------------------------------------------------ */
-/* decNumberMinMag -- compare and return the minimum by magnitude */
-/* */
-/* This computes C = A ? B, returning the minimum by 754 rules */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X?X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* */
-/* C must have space for set->digits digits. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberMinMag(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
- decCompareOp(res, lhs, rhs, set, COMPMINMAG, &status);
- if (status!=0) decStatus(res, status, set);
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberMinMag */
-
-/* ------------------------------------------------------------------ */
-/* decNumberMinus -- prefix minus operator */
-/* */
-/* This computes C = 0 - A */
-/* */
-/* res is C, the result. C may be A */
-/* rhs is A */
-/* set is the context */
-/* */
-/* See also decNumberCopyNegate for a quiet bitwise version of this. */
-/* C must have space for set->digits digits. */
-/* ------------------------------------------------------------------ */
-/* Simply use AddOp for the subtract, which will do the necessary. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberMinus(decNumber *res, const decNumber *rhs,
- decContext *set) {
- decNumber dzero;
- uInt status=0; /* accumulator */
-
- #if DECCHECK
- if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
- #endif
-
- uprv_decNumberZero(&dzero); /* make 0 */
- dzero.exponent=rhs->exponent; /* [no coefficient expansion] */
- decAddOp(res, &dzero, rhs, set, DECNEG, &status);
- if (status!=0) decStatus(res, status, set);
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberMinus */
-
-/* ------------------------------------------------------------------ */
-/* decNumberNextMinus -- next towards -Infinity */
-/* */
-/* This computes C = A - infinitesimal, rounded towards -Infinity */
-/* */
-/* res is C, the result. C may be A */
-/* rhs is A */
-/* set is the context */
-/* */
-/* This is a generalization of 754 NextDown. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberNextMinus(decNumber *res, const decNumber *rhs,
- decContext *set) {
- decNumber dtiny; /* constant */
- decContext workset=*set; /* work */
- uInt status=0; /* accumulator */
- #if DECCHECK
- if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
- #endif
-
- /* +Infinity is the special case */
- if ((rhs->bits&(DECINF|DECNEG))==DECINF) {
- decSetMaxValue(res, set); /* is +ve */
- /* there is no status to set */
- return res;
- }
- uprv_decNumberZero(&dtiny); /* start with 0 */
- dtiny.lsu[0]=1; /* make number that is .. */
- dtiny.exponent=DEC_MIN_EMIN-1; /* .. smaller than tiniest */
- workset.round=DEC_ROUND_FLOOR;
- decAddOp(res, rhs, &dtiny, &workset, DECNEG, &status);
- status&=DEC_Invalid_operation|DEC_sNaN; /* only sNaN Invalid please */
- if (status!=0) decStatus(res, status, set);
- return res;
- } /* decNumberNextMinus */
-
-/* ------------------------------------------------------------------ */
-/* decNumberNextPlus -- next towards +Infinity */
-/* */
-/* This computes C = A + infinitesimal, rounded towards +Infinity */
-/* */
-/* res is C, the result. C may be A */
-/* rhs is A */
-/* set is the context */
-/* */
-/* This is a generalization of 754 NextUp. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberNextPlus(decNumber *res, const decNumber *rhs,
- decContext *set) {
- decNumber dtiny; /* constant */
- decContext workset=*set; /* work */
- uInt status=0; /* accumulator */
- #if DECCHECK
- if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
- #endif
-
- /* -Infinity is the special case */
- if ((rhs->bits&(DECINF|DECNEG))==(DECINF|DECNEG)) {
- decSetMaxValue(res, set);
- res->bits=DECNEG; /* negative */
- /* there is no status to set */
- return res;
- }
- uprv_decNumberZero(&dtiny); /* start with 0 */
- dtiny.lsu[0]=1; /* make number that is .. */
- dtiny.exponent=DEC_MIN_EMIN-1; /* .. smaller than tiniest */
- workset.round=DEC_ROUND_CEILING;
- decAddOp(res, rhs, &dtiny, &workset, 0, &status);
- status&=DEC_Invalid_operation|DEC_sNaN; /* only sNaN Invalid please */
- if (status!=0) decStatus(res, status, set);
- return res;
- } /* decNumberNextPlus */
-
-/* ------------------------------------------------------------------ */
-/* decNumberNextToward -- next towards rhs */
-/* */
-/* This computes C = A +/- infinitesimal, rounded towards */
-/* +/-Infinity in the direction of B, as per 754-1985 nextafter */
-/* modified during revision but dropped from 754-2008. */
-/* */
-/* res is C, the result. C may be A or B. */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* */
-/* This is a generalization of 754-1985 NextAfter. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberNextToward(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- decNumber dtiny; /* constant */
- decContext workset=*set; /* work */
- Int result; /* .. */
- uInt status=0; /* accumulator */
- #if DECCHECK
- if (decCheckOperands(res, lhs, rhs, set)) return res;
- #endif
-
- if (decNumberIsNaN(lhs) || decNumberIsNaN(rhs)) {
- decNaNs(res, lhs, rhs, set, &status);
- }
- else { /* Is numeric, so no chance of sNaN Invalid, etc. */
- result=decCompare(lhs, rhs, 0); /* sign matters */
- if (result==BADINT) status|=DEC_Insufficient_storage; /* rare */
- else { /* valid compare */
- if (result==0) uprv_decNumberCopySign(res, lhs, rhs); /* easy */
- else { /* differ: need NextPlus or NextMinus */
- uByte sub; /* add or subtract */
- if (result<0) { /* lhs<rhs, do nextplus */
- /* -Infinity is the special case */
- if ((lhs->bits&(DECINF|DECNEG))==(DECINF|DECNEG)) {
- decSetMaxValue(res, set);
- res->bits=DECNEG; /* negative */
- return res; /* there is no status to set */
- }
- workset.round=DEC_ROUND_CEILING;
- sub=0; /* add, please */
- } /* plus */
- else { /* lhs>rhs, do nextminus */
- /* +Infinity is the special case */
- if ((lhs->bits&(DECINF|DECNEG))==DECINF) {
- decSetMaxValue(res, set);
- return res; /* there is no status to set */
- }
- workset.round=DEC_ROUND_FLOOR;
- sub=DECNEG; /* subtract, please */
- } /* minus */
- uprv_decNumberZero(&dtiny); /* start with 0 */
- dtiny.lsu[0]=1; /* make number that is .. */
- dtiny.exponent=DEC_MIN_EMIN-1; /* .. smaller than tiniest */
- decAddOp(res, lhs, &dtiny, &workset, sub, &status); /* + or - */
- /* turn off exceptions if the result is a normal number */
- /* (including Nmin), otherwise let all status through */
- if (uprv_decNumberIsNormal(res, set)) status=0;
- } /* unequal */
- } /* compare OK */
- } /* numeric */
- if (status!=0) decStatus(res, status, set);
- return res;
- } /* decNumberNextToward */
-
-/* ------------------------------------------------------------------ */
-/* decNumberOr -- OR two Numbers, digitwise */
-/* */
-/* This computes C = A | B */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X|X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context (used for result length and error report) */
-/* */
-/* C must have space for set->digits digits. */
-/* */
-/* Logical function restrictions apply (see above); a NaN is */
-/* returned with Invalid_operation if a restriction is violated. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberOr(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- const Unit *ua, *ub; /* -> operands */
- const Unit *msua, *msub; /* -> operand msus */
- Unit *uc, *msuc; /* -> result and its msu */
- Int msudigs; /* digits in res msu */
- #if DECCHECK
- if (decCheckOperands(res, lhs, rhs, set)) return res;
- #endif
-
- if (lhs->exponent!=0 || decNumberIsSpecial(lhs) || decNumberIsNegative(lhs)
- || rhs->exponent!=0 || decNumberIsSpecial(rhs) || decNumberIsNegative(rhs)) {
- decStatus(res, DEC_Invalid_operation, set);
- return res;
- }
- /* operands are valid */
- ua=lhs->lsu; /* bottom-up */
- ub=rhs->lsu; /* .. */
- uc=res->lsu; /* .. */
- msua=ua+D2U(lhs->digits)-1; /* -> msu of lhs */
- msub=ub+D2U(rhs->digits)-1; /* -> msu of rhs */
- msuc=uc+D2U(set->digits)-1; /* -> msu of result */
- msudigs=MSUDIGITS(set->digits); /* [faster than remainder] */
- for (; uc<=msuc; ua++, ub++, uc++) { /* Unit loop */
- Unit a, b; /* extract units */
- if (ua>msua) a=0;
- else a=*ua;
- if (ub>msub) b=0;
- else b=*ub;
- *uc=0; /* can now write back */
- if (a|b) { /* maybe 1 bits to examine */
- Int i, j;
- /* This loop could be unrolled and/or use BIN2BCD tables */
- for (i=0; i<DECDPUN; i++) {
- if ((a|b)&1) *uc=*uc+(Unit)powers[i]; /* effect OR */
- j=a%10;
- a=a/10;
- j|=b%10;
- b=b/10;
- if (j>1) {
- decStatus(res, DEC_Invalid_operation, set);
- return res;
- }
- if (uc==msuc && i==msudigs-1) break; /* just did final digit */
- } /* each digit */
- } /* non-zero */
- } /* each unit */
- /* [here uc-1 is the msu of the result] */
- res->digits=decGetDigits(res->lsu, static_cast<int32_t>(uc-res->lsu));
- res->exponent=0; /* integer */
- res->bits=0; /* sign=0 */
- return res; /* [no status to set] */
- } /* decNumberOr */
-
-/* ------------------------------------------------------------------ */
-/* decNumberPlus -- prefix plus operator */
-/* */
-/* This computes C = 0 + A */
-/* */
-/* res is C, the result. C may be A */
-/* rhs is A */
-/* set is the context */
-/* */
-/* See also decNumberCopy for a quiet bitwise version of this. */
-/* C must have space for set->digits digits. */
-/* ------------------------------------------------------------------ */
-/* This simply uses AddOp; Add will take fast path after preparing A. */
-/* Performance is a concern here, as this routine is often used to */
-/* check operands and apply rounding and overflow/underflow testing. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberPlus(decNumber *res, const decNumber *rhs,
- decContext *set) {
- decNumber dzero;
- uInt status=0; /* accumulator */
- #if DECCHECK
- if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
- #endif
-
- uprv_decNumberZero(&dzero); /* make 0 */
- dzero.exponent=rhs->exponent; /* [no coefficient expansion] */
- decAddOp(res, &dzero, rhs, set, 0, &status);
- if (status!=0) decStatus(res, status, set);
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberPlus */
-
-/* ------------------------------------------------------------------ */
-/* decNumberMultiply -- multiply two Numbers */
-/* */
-/* This computes C = A x B */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X+X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* */
-/* C must have space for set->digits digits. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberMultiply(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
- decMultiplyOp(res, lhs, rhs, set, &status);
- if (status!=0) decStatus(res, status, set);
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberMultiply */
-
-/* ------------------------------------------------------------------ */
-/* decNumberPower -- raise a number to a power */
-/* */
-/* This computes C = A ** B */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X**X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* */
-/* C must have space for set->digits digits. */
-/* */
-/* Mathematical function restrictions apply (see above); a NaN is */
-/* returned with Invalid_operation if a restriction is violated. */
-/* */
-/* However, if 1999999997<=B<=999999999 and B is an integer then the */
-/* restrictions on A and the context are relaxed to the usual bounds, */
-/* for compatibility with the earlier (integer power only) version */
-/* of this function. */
-/* */
-/* When B is an integer, the result may be exact, even if rounded. */
-/* */
-/* The final result is rounded according to the context; it will */
-/* almost always be correctly rounded, but may be up to 1 ulp in */
-/* error in rare cases. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberPower(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- #if DECSUBSET
- decNumber *alloclhs=NULL; /* non-NULL if rounded lhs allocated */
- decNumber *allocrhs=NULL; /* .., rhs */
- #endif
- decNumber *allocdac=NULL; /* -> allocated acc buffer, iff used */
- decNumber *allocinv=NULL; /* -> allocated 1/x buffer, iff used */
- Int reqdigits=set->digits; /* requested DIGITS */
- Int n; /* rhs in binary */
- Flag rhsint=0; /* 1 if rhs is an integer */
- Flag useint=0; /* 1 if can use integer calculation */
- Flag isoddint=0; /* 1 if rhs is an integer and odd */
- Int i; /* work */
- #if DECSUBSET
- Int dropped; /* .. */
- #endif
- uInt needbytes; /* buffer size needed */
- Flag seenbit; /* seen a bit while powering */
- Int residue=0; /* rounding residue */
- uInt status=0; /* accumulators */
- uByte bits=0; /* result sign if errors */
- decContext aset; /* working context */
- decNumber dnOne; /* work value 1... */
- /* local accumulator buffer [a decNumber, with digits+elength+1 digits] */
- decNumber dacbuff[D2N(DECBUFFER+9)];
- decNumber *dac=dacbuff; /* -> result accumulator */
- /* same again for possible 1/lhs calculation */
- decNumber invbuff[D2N(DECBUFFER+9)];
-
- #if DECCHECK
- if (decCheckOperands(res, lhs, rhs, set)) return res;
- #endif
-
- do { /* protect allocated storage */
- #if DECSUBSET
- if (!set->extended) { /* reduce operands and set status, as needed */
- if (lhs->digits>reqdigits) {
- alloclhs=decRoundOperand(lhs, set, &status);
- if (alloclhs==NULL) break;
- lhs=alloclhs;
- }
- if (rhs->digits>reqdigits) {
- allocrhs=decRoundOperand(rhs, set, &status);
- if (allocrhs==NULL) break;
- rhs=allocrhs;
- }
- }
- #endif
- /* [following code does not require input rounding] */
-
- /* handle NaNs and rhs Infinity (lhs infinity is harder) */
- if (SPECIALARGS) {
- if (decNumberIsNaN(lhs) || decNumberIsNaN(rhs)) { /* NaNs */
- decNaNs(res, lhs, rhs, set, &status);
- break;}
- if (decNumberIsInfinite(rhs)) { /* rhs Infinity */
- Flag rhsneg=rhs->bits&DECNEG; /* save rhs sign */
- if (decNumberIsNegative(lhs) /* lhs<0 */
- && !decNumberIsZero(lhs)) /* .. */
- status|=DEC_Invalid_operation;
- else { /* lhs >=0 */
- uprv_decNumberZero(&dnOne); /* set up 1 */
- dnOne.lsu[0]=1;
- uprv_decNumberCompare(dac, lhs, &dnOne, set); /* lhs ? 1 */
- uprv_decNumberZero(res); /* prepare for 0/1/Infinity */
- if (decNumberIsNegative(dac)) { /* lhs<1 */
- if (rhsneg) res->bits|=DECINF; /* +Infinity [else is +0] */
- }
- else if (dac->lsu[0]==0) { /* lhs=1 */
- /* 1**Infinity is inexact, so return fully-padded 1.0000 */
- Int shift=set->digits-1;
- *res->lsu=1; /* was 0, make int 1 */
- res->digits=decShiftToMost(res->lsu, 1, shift);
- res->exponent=-shift; /* make 1.0000... */
- status|=DEC_Inexact|DEC_Rounded; /* deemed inexact */
- }
- else { /* lhs>1 */
- if (!rhsneg) res->bits|=DECINF; /* +Infinity [else is +0] */
- }
- } /* lhs>=0 */
- break;}
- /* [lhs infinity drops through] */
- } /* specials */
-
- /* Original rhs may be an integer that fits and is in range */
- n=decGetInt(rhs);
- if (n!=BADINT) { /* it is an integer */
- rhsint=1; /* record the fact for 1**n */
- isoddint=(Flag)n&1; /* [works even if big] */
- if (n!=BIGEVEN && n!=BIGODD) /* can use integer path? */
- useint=1; /* looks good */
- }
-
- if (decNumberIsNegative(lhs) /* -x .. */
- && isoddint) bits=DECNEG; /* .. to an odd power */
-
- /* handle LHS infinity */
- if (decNumberIsInfinite(lhs)) { /* [NaNs already handled] */
- uByte rbits=rhs->bits; /* save */
- uprv_decNumberZero(res); /* prepare */
- if (n==0) *res->lsu=1; /* [-]Inf**0 => 1 */
- else {
- /* -Inf**nonint -> error */
- if (!rhsint && decNumberIsNegative(lhs)) {
- status|=DEC_Invalid_operation; /* -Inf**nonint is error */
- break;}
- if (!(rbits & DECNEG)) bits|=DECINF; /* was not a **-n */
- /* [otherwise will be 0 or -0] */
- res->bits=bits;
- }
- break;}
-
- /* similarly handle LHS zero */
- if (decNumberIsZero(lhs)) {
- if (n==0) { /* 0**0 => Error */
- #if DECSUBSET
- if (!set->extended) { /* [unless subset] */
- uprv_decNumberZero(res);
- *res->lsu=1; /* return 1 */
- break;}
- #endif
- status|=DEC_Invalid_operation;
- }
- else { /* 0**x */
- uByte rbits=rhs->bits; /* save */
- if (rbits & DECNEG) { /* was a 0**(-n) */
- #if DECSUBSET
- if (!set->extended) { /* [bad if subset] */
- status|=DEC_Invalid_operation;
- break;}
- #endif
- bits|=DECINF;
- }
- uprv_decNumberZero(res); /* prepare */
- /* [otherwise will be 0 or -0] */
- res->bits=bits;
- }
- break;}
-
- /* here both lhs and rhs are finite; rhs==0 is handled in the */
- /* integer path. Next handle the non-integer cases */
- if (!useint) { /* non-integral rhs */
- /* any -ve lhs is bad, as is either operand or context out of */
- /* bounds */
- if (decNumberIsNegative(lhs)) {
- status|=DEC_Invalid_operation;
- break;}
- if (decCheckMath(lhs, set, &status)
- || decCheckMath(rhs, set, &status)) break; /* variable status */
-
- uprv_decContextDefault(&aset, DEC_INIT_DECIMAL64); /* clean context */
- aset.emax=DEC_MAX_MATH; /* usual bounds */
- aset.emin=-DEC_MAX_MATH; /* .. */
- aset.clamp=0; /* and no concrete format */
-
- /* calculate the result using exp(ln(lhs)*rhs), which can */
- /* all be done into the accumulator, dac. The precision needed */
- /* is enough to contain the full information in the lhs (which */
- /* is the total digits, including exponent), or the requested */
- /* precision, if larger, + 4; 6 is used for the exponent */
- /* maximum length, and this is also used when it is shorter */
- /* than the requested digits as it greatly reduces the >0.5 ulp */
- /* cases at little cost (because Ln doubles digits each */
- /* iteration so a few extra digits rarely causes an extra */
- /* iteration) */
- aset.digits=MAXI(lhs->digits, set->digits)+6+4;
- } /* non-integer rhs */
-
- else { /* rhs is in-range integer */
- if (n==0) { /* x**0 = 1 */
- /* (0**0 was handled above) */
- uprv_decNumberZero(res); /* result=1 */
- *res->lsu=1; /* .. */
- break;}
- /* rhs is a non-zero integer */
- if (n<0) n=-n; /* use abs(n) */
-
- aset=*set; /* clone the context */
- aset.round=DEC_ROUND_HALF_EVEN; /* internally use balanced */
- /* calculate the working DIGITS */
- aset.digits=reqdigits+(rhs->digits+rhs->exponent)+2;
- #if DECSUBSET
- if (!set->extended) aset.digits--; /* use classic precision */
- #endif
- /* it's an error if this is more than can be handled */
- if (aset.digits>DECNUMMAXP) {status|=DEC_Invalid_operation; break;}
- } /* integer path */
-
- /* aset.digits is the count of digits for the accumulator needed */
- /* if accumulator is too long for local storage, then allocate */
- needbytes=sizeof(decNumber)+(D2U(aset.digits)-1)*sizeof(Unit);
- /* [needbytes also used below if 1/lhs needed] */
- if (needbytes>sizeof(dacbuff)) {
- allocdac=(decNumber *)malloc(needbytes);
- if (allocdac==NULL) { /* hopeless -- abandon */
- status|=DEC_Insufficient_storage;
- break;}
- dac=allocdac; /* use the allocated space */
- }
- /* here, aset is set up and accumulator is ready for use */
-
- if (!useint) { /* non-integral rhs */
- /* x ** y; special-case x=1 here as it will otherwise always */
- /* reduce to integer 1; decLnOp has a fastpath which detects */
- /* the case of x=1 */
- decLnOp(dac, lhs, &aset, &status); /* dac=ln(lhs) */
- /* [no error possible, as lhs 0 already handled] */
- if (ISZERO(dac)) { /* x==1, 1.0, etc. */
- /* need to return fully-padded 1.0000 etc., but rhsint->1 */
- *dac->lsu=1; /* was 0, make int 1 */
- if (!rhsint) { /* add padding */
- Int shift=set->digits-1;
- dac->digits=decShiftToMost(dac->lsu, 1, shift);
- dac->exponent=-shift; /* make 1.0000... */
- status|=DEC_Inexact|DEC_Rounded; /* deemed inexact */
- }
- }
- else {
- decMultiplyOp(dac, dac, rhs, &aset, &status); /* dac=dac*rhs */
- decExpOp(dac, dac, &aset, &status); /* dac=exp(dac) */
- }
- /* and drop through for final rounding */
- } /* non-integer rhs */
-
- else { /* carry on with integer */
- uprv_decNumberZero(dac); /* acc=1 */
- *dac->lsu=1; /* .. */
-
- /* if a negative power the constant 1 is needed, and if not subset */
- /* invert the lhs now rather than inverting the result later */
- if (decNumberIsNegative(rhs)) { /* was a **-n [hence digits>0] */
- decNumber *inv=invbuff; /* asssume use fixed buffer */
- uprv_decNumberCopy(&dnOne, dac); /* dnOne=1; [needed now or later] */
- #if DECSUBSET
- if (set->extended) { /* need to calculate 1/lhs */
- #endif
- /* divide lhs into 1, putting result in dac [dac=1/dac] */
- decDivideOp(dac, &dnOne, lhs, &aset, DIVIDE, &status);
- /* now locate or allocate space for the inverted lhs */
- if (needbytes>sizeof(invbuff)) {
- allocinv=(decNumber *)malloc(needbytes);
- if (allocinv==NULL) { /* hopeless -- abandon */
- status|=DEC_Insufficient_storage;
- break;}
- inv=allocinv; /* use the allocated space */
- }
- /* [inv now points to big-enough buffer or allocated storage] */
- uprv_decNumberCopy(inv, dac); /* copy the 1/lhs */
- uprv_decNumberCopy(dac, &dnOne); /* restore acc=1 */
- lhs=inv; /* .. and go forward with new lhs */
- #if DECSUBSET
- }
- #endif
- }
-
- /* Raise-to-the-power loop... */
- seenbit=0; /* set once a 1-bit is encountered */
- for (i=1;;i++){ /* for each bit [top bit ignored] */
- /* abandon if had overflow or terminal underflow */
- if (status & (DEC_Overflow|DEC_Underflow)) { /* interesting? */
- if (status&DEC_Overflow || ISZERO(dac)) break;
- }
- /* [the following two lines revealed an optimizer bug in a C++ */
- /* compiler, with symptom: 5**3 -> 25, when n=n+n was used] */
- n=n<<1; /* move next bit to testable position */
- if (n<0) { /* top bit is set */
- seenbit=1; /* OK, significant bit seen */
- decMultiplyOp(dac, dac, lhs, &aset, &status); /* dac=dac*x */
- }
- if (i==31) break; /* that was the last bit */
- if (!seenbit) continue; /* no need to square 1 */
- decMultiplyOp(dac, dac, dac, &aset, &status); /* dac=dac*dac [square] */
- } /*i*/ /* 32 bits */
-
- /* complete internal overflow or underflow processing */
- if (status & (DEC_Overflow|DEC_Underflow)) {
- #if DECSUBSET
- /* If subset, and power was negative, reverse the kind of -erflow */
- /* [1/x not yet done] */
- if (!set->extended && decNumberIsNegative(rhs)) {
- if (status & DEC_Overflow)
- status^=DEC_Overflow | DEC_Underflow | DEC_Subnormal;
- else { /* trickier -- Underflow may or may not be set */
- status&=~(DEC_Underflow | DEC_Subnormal); /* [one or both] */
- status|=DEC_Overflow;
- }
- }
- #endif
- dac->bits=(dac->bits & ~DECNEG) | bits; /* force correct sign */
- /* round subnormals [to set.digits rather than aset.digits] */
- /* or set overflow result similarly as required */
- decFinalize(dac, set, &residue, &status);
- uprv_decNumberCopy(res, dac); /* copy to result (is now OK length) */
- break;
- }
-
- #if DECSUBSET
- if (!set->extended && /* subset math */
- decNumberIsNegative(rhs)) { /* was a **-n [hence digits>0] */
- /* so divide result into 1 [dac=1/dac] */
- decDivideOp(dac, &dnOne, dac, &aset, DIVIDE, &status);
- }
- #endif
- } /* rhs integer path */
-
- /* reduce result to the requested length and copy to result */
- decCopyFit(res, dac, set, &residue, &status);
- decFinish(res, set, &residue, &status); /* final cleanup */
- #if DECSUBSET
- if (!set->extended) decTrim(res, set, 0, 1, &dropped); /* trailing zeros */
- #endif
- } while(0); /* end protected */
-
- if (allocdac!=NULL) free(allocdac); /* drop any storage used */
- if (allocinv!=NULL) free(allocinv); /* .. */
- #if DECSUBSET
- if (alloclhs!=NULL) free(alloclhs); /* .. */
- if (allocrhs!=NULL) free(allocrhs); /* .. */
- #endif
- if (status!=0) decStatus(res, status, set);
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberPower */
-
-/* ------------------------------------------------------------------ */
-/* decNumberQuantize -- force exponent to requested value */
-/* */
-/* This computes C = op(A, B), where op adjusts the coefficient */
-/* of C (by rounding or shifting) such that the exponent (-scale) */
-/* of C has exponent of B. The numerical value of C will equal A, */
-/* except for the effects of any rounding that occurred. */
-/* */
-/* res is C, the result. C may be A or B */
-/* lhs is A, the number to adjust */
-/* rhs is B, the number with exponent to match */
-/* set is the context */
-/* */
-/* C must have space for set->digits digits. */
-/* */
-/* Unless there is an error or the result is infinite, the exponent */
-/* after the operation is guaranteed to be equal to that of B. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberQuantize(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
- decQuantizeOp(res, lhs, rhs, set, 1, &status);
- if (status!=0) decStatus(res, status, set);
- return res;
- } /* decNumberQuantize */
-
-/* ------------------------------------------------------------------ */
-/* decNumberReduce -- remove trailing zeros */
-/* */
-/* This computes C = 0 + A, and normalizes the result */
-/* */
-/* res is C, the result. C may be A */
-/* rhs is A */
-/* set is the context */
-/* */
-/* C must have space for set->digits digits. */
-/* ------------------------------------------------------------------ */
-/* Previously known as Normalize */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberNormalize(decNumber *res, const decNumber *rhs,
- decContext *set) {
- return uprv_decNumberReduce(res, rhs, set);
- } /* decNumberNormalize */
-
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberReduce(decNumber *res, const decNumber *rhs,
- decContext *set) {
- #if DECSUBSET
- decNumber *allocrhs=NULL; /* non-NULL if rounded rhs allocated */
- #endif
- uInt status=0; /* as usual */
- Int residue=0; /* as usual */
- Int dropped; /* work */
-
- #if DECCHECK
- if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
- #endif
-
- do { /* protect allocated storage */
- #if DECSUBSET
- if (!set->extended) {
- /* reduce operand and set lostDigits status, as needed */
- if (rhs->digits>set->digits) {
- allocrhs=decRoundOperand(rhs, set, &status);
- if (allocrhs==NULL) break;
- rhs=allocrhs;
- }
- }
- #endif
- /* [following code does not require input rounding] */
-
- /* Infinities copy through; NaNs need usual treatment */
- if (decNumberIsNaN(rhs)) {
- decNaNs(res, rhs, NULL, set, &status);
- break;
- }
-
- /* reduce result to the requested length and copy to result */
- decCopyFit(res, rhs, set, &residue, &status); /* copy & round */
- decFinish(res, set, &residue, &status); /* cleanup/set flags */
- decTrim(res, set, 1, 0, &dropped); /* normalize in place */
- /* [may clamp] */
- } while(0); /* end protected */
-
- #if DECSUBSET
- if (allocrhs !=NULL) free(allocrhs); /* .. */
- #endif
- if (status!=0) decStatus(res, status, set);/* then report status */
- return res;
- } /* decNumberReduce */
-
-/* ------------------------------------------------------------------ */
-/* decNumberRescale -- force exponent to requested value */
-/* */
-/* This computes C = op(A, B), where op adjusts the coefficient */
-/* of C (by rounding or shifting) such that the exponent (-scale) */
-/* of C has the value B. The numerical value of C will equal A, */
-/* except for the effects of any rounding that occurred. */
-/* */
-/* res is C, the result. C may be A or B */
-/* lhs is A, the number to adjust */
-/* rhs is B, the requested exponent */
-/* set is the context */
-/* */
-/* C must have space for set->digits digits. */
-/* */
-/* Unless there is an error or the result is infinite, the exponent */
-/* after the operation is guaranteed to be equal to B. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberRescale(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
- decQuantizeOp(res, lhs, rhs, set, 0, &status);
- if (status!=0) decStatus(res, status, set);
- return res;
- } /* decNumberRescale */
-
-/* ------------------------------------------------------------------ */
-/* decNumberRemainder -- divide and return remainder */
-/* */
-/* This computes C = A % B */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X%X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* */
-/* C must have space for set->digits digits. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberRemainder(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
- decDivideOp(res, lhs, rhs, set, REMAINDER, &status);
- if (status!=0) decStatus(res, status, set);
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberRemainder */
-
-/* ------------------------------------------------------------------ */
-/* decNumberRemainderNear -- divide and return remainder from nearest */
-/* */
-/* This computes C = A % B, where % is the IEEE remainder operator */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X%X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* */
-/* C must have space for set->digits digits. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberRemainderNear(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
- decDivideOp(res, lhs, rhs, set, REMNEAR, &status);
- if (status!=0) decStatus(res, status, set);
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberRemainderNear */
-
-/* ------------------------------------------------------------------ */
-/* decNumberRotate -- rotate the coefficient of a Number left/right */
-/* */
-/* This computes C = A rot B (in base ten and rotating set->digits */
-/* digits). */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=XrotX) */
-/* lhs is A */
-/* rhs is B, the number of digits to rotate (-ve to right) */
-/* set is the context */
-/* */
-/* The digits of the coefficient of A are rotated to the left (if B */
-/* is positive) or to the right (if B is negative) without adjusting */
-/* the exponent or the sign of A. If lhs->digits is less than */
-/* set->digits the coefficient is padded with zeros on the left */
-/* before the rotate. Any leading zeros in the result are removed */
-/* as usual. */
-/* */
-/* B must be an integer (q=0) and in the range -set->digits through */
-/* +set->digits. */
-/* C must have space for set->digits digits. */
-/* NaNs are propagated as usual. Infinities are unaffected (but */
-/* B must be valid). No status is set unless B is invalid or an */
-/* operand is an sNaN. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberRotate(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
- Int rotate; /* rhs as an Int */
-
- #if DECCHECK
- if (decCheckOperands(res, lhs, rhs, set)) return res;
- #endif
-
- /* NaNs propagate as normal */
- if (decNumberIsNaN(lhs) || decNumberIsNaN(rhs))
- decNaNs(res, lhs, rhs, set, &status);
- /* rhs must be an integer */
- else if (decNumberIsInfinite(rhs) || rhs->exponent!=0)
- status=DEC_Invalid_operation;
- else { /* both numeric, rhs is an integer */
- rotate=decGetInt(rhs); /* [cannot fail] */
- if (rotate==BADINT /* something bad .. */
- || rotate==BIGODD || rotate==BIGEVEN /* .. very big .. */
- || abs(rotate)>set->digits) /* .. or out of range */
- status=DEC_Invalid_operation;
- else { /* rhs is OK */
- uprv_decNumberCopy(res, lhs);
- /* convert -ve rotate to equivalent positive rotation */
- if (rotate<0) rotate=set->digits+rotate;
- if (rotate!=0 && rotate!=set->digits /* zero or full rotation */
- && !decNumberIsInfinite(res)) { /* lhs was infinite */
- /* left-rotate to do; 0 < rotate < set->digits */
- uInt units, shift; /* work */
- uInt msudigits; /* digits in result msu */
- Unit *msu=res->lsu+D2U(res->digits)-1; /* current msu */
- Unit *msumax=res->lsu+D2U(set->digits)-1; /* rotation msu */
- for (msu++; msu<=msumax; msu++) *msu=0; /* ensure high units=0 */
- res->digits=set->digits; /* now full-length */
- msudigits=MSUDIGITS(res->digits); /* actual digits in msu */
-
- /* rotation here is done in-place, in three steps */
- /* 1. shift all to least up to one unit to unit-align final */
- /* lsd [any digits shifted out are rotated to the left, */
- /* abutted to the original msd (which may require split)] */
- /* */
- /* [if there are no whole units left to rotate, the */
- /* rotation is now complete] */
- /* */
- /* 2. shift to least, from below the split point only, so that */
- /* the final msd is in the right place in its Unit [any */
- /* digits shifted out will fit exactly in the current msu, */
- /* left aligned, no split required] */
- /* */
- /* 3. rotate all the units by reversing left part, right */
- /* part, and then whole */
- /* */
- /* example: rotate right 8 digits (2 units + 2), DECDPUN=3. */
- /* */
- /* start: 00a bcd efg hij klm npq */
- /* */
- /* 1a 000 0ab cde fgh|ijk lmn [pq saved] */
- /* 1b 00p qab cde fgh|ijk lmn */
- /* */
- /* 2a 00p qab cde fgh|00i jkl [mn saved] */
- /* 2b mnp qab cde fgh|00i jkl */
- /* */
- /* 3a fgh cde qab mnp|00i jkl */
- /* 3b fgh cde qab mnp|jkl 00i */
- /* 3c 00i jkl mnp qab cde fgh */
-
- /* Step 1: amount to shift is the partial right-rotate count */
- rotate=set->digits-rotate; /* make it right-rotate */
- units=rotate/DECDPUN; /* whole units to rotate */
- shift=rotate%DECDPUN; /* left-over digits count */
- if (shift>0) { /* not an exact number of units */
- uInt save=res->lsu[0]%powers[shift]; /* save low digit(s) */
- decShiftToLeast(res->lsu, D2U(res->digits), shift);
- if (shift>msudigits) { /* msumax-1 needs >0 digits */
- uInt rem=save%powers[shift-msudigits];/* split save */
- *msumax=(Unit)(save/powers[shift-msudigits]); /* and insert */
- *(msumax-1)=*(msumax-1)
- +(Unit)(rem*powers[DECDPUN-(shift-msudigits)]); /* .. */
- }
- else { /* all fits in msumax */
- *msumax=*msumax+(Unit)(save*powers[msudigits-shift]); /* [maybe *1] */
- }
- } /* digits shift needed */
-
- /* If whole units to rotate... */
- if (units>0) { /* some to do */
- /* Step 2: the units to touch are the whole ones in rotate, */
- /* if any, and the shift is DECDPUN-msudigits (which may be */
- /* 0, again) */
- shift=DECDPUN-msudigits;
- if (shift>0) { /* not an exact number of units */
- uInt save=res->lsu[0]%powers[shift]; /* save low digit(s) */
- decShiftToLeast(res->lsu, units, shift);
- *msumax=*msumax+(Unit)(save*powers[msudigits]);
- } /* partial shift needed */
-
- /* Step 3: rotate the units array using triple reverse */
- /* (reversing is easy and fast) */
- decReverse(res->lsu+units, msumax); /* left part */
- decReverse(res->lsu, res->lsu+units-1); /* right part */
- decReverse(res->lsu, msumax); /* whole */
- } /* whole units to rotate */
- /* the rotation may have left an undetermined number of zeros */
- /* on the left, so true length needs to be calculated */
- res->digits=decGetDigits(res->lsu, static_cast<int32_t>(msumax-res->lsu+1));
- } /* rotate needed */
- } /* rhs OK */
- } /* numerics */
- if (status!=0) decStatus(res, status, set);
- return res;
- } /* decNumberRotate */
-
-/* ------------------------------------------------------------------ */
-/* decNumberSameQuantum -- test for equal exponents */
-/* */
-/* res is the result number, which will contain either 0 or 1 */
-/* lhs is a number to test */
-/* rhs is the second (usually a pattern) */
-/* */
-/* No errors are possible and no context is needed. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberSameQuantum(decNumber *res, const decNumber *lhs,
- const decNumber *rhs) {
- Unit ret=0; /* return value */
-
- #if DECCHECK
- if (decCheckOperands(res, lhs, rhs, DECUNCONT)) return res;
- #endif
-
- if (SPECIALARGS) {
- if (decNumberIsNaN(lhs) && decNumberIsNaN(rhs)) ret=1;
- else if (decNumberIsInfinite(lhs) && decNumberIsInfinite(rhs)) ret=1;
- /* [anything else with a special gives 0] */
- }
- else if (lhs->exponent==rhs->exponent) ret=1;
-
- uprv_decNumberZero(res); /* OK to overwrite an operand now */
- *res->lsu=ret;
- return res;
- } /* decNumberSameQuantum */
-
-/* ------------------------------------------------------------------ */
-/* decNumberScaleB -- multiply by a power of 10 */
-/* */
-/* This computes C = A x 10**B where B is an integer (q=0) with */
-/* maximum magnitude 2*(emax+digits) */
-/* */
-/* res is C, the result. C may be A or B */
-/* lhs is A, the number to adjust */
-/* rhs is B, the requested power of ten to use */
-/* set is the context */
-/* */
-/* C must have space for set->digits digits. */
-/* */
-/* The result may underflow or overflow. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberScaleB(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- Int reqexp; /* requested exponent change [B] */
- uInt status=0; /* accumulator */
- Int residue; /* work */
-
- #if DECCHECK
- if (decCheckOperands(res, lhs, rhs, set)) return res;
- #endif
-
- /* Handle special values except lhs infinite */
- if (decNumberIsNaN(lhs) || decNumberIsNaN(rhs))
- decNaNs(res, lhs, rhs, set, &status);
- /* rhs must be an integer */
- else if (decNumberIsInfinite(rhs) || rhs->exponent!=0)
- status=DEC_Invalid_operation;
- else {
- /* lhs is a number; rhs is a finite with q==0 */
- reqexp=decGetInt(rhs); /* [cannot fail] */
- if (reqexp==BADINT /* something bad .. */
- || reqexp==BIGODD || reqexp==BIGEVEN /* .. very big .. */
- || abs(reqexp)>(2*(set->digits+set->emax))) /* .. or out of range */
- status=DEC_Invalid_operation;
- else { /* rhs is OK */
- uprv_decNumberCopy(res, lhs); /* all done if infinite lhs */
- if (!decNumberIsInfinite(res)) { /* prepare to scale */
- res->exponent+=reqexp; /* adjust the exponent */
- residue=0;
- decFinalize(res, set, &residue, &status); /* .. and check */
- } /* finite LHS */
- } /* rhs OK */
- } /* rhs finite */
- if (status!=0) decStatus(res, status, set);
- return res;
- } /* decNumberScaleB */
-
-/* ------------------------------------------------------------------ */
-/* decNumberShift -- shift the coefficient of a Number left or right */
-/* */
-/* This computes C = A << B or C = A >> -B (in base ten). */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X<<X) */
-/* lhs is A */
-/* rhs is B, the number of digits to shift (-ve to right) */
-/* set is the context */
-/* */
-/* The digits of the coefficient of A are shifted to the left (if B */
-/* is positive) or to the right (if B is negative) without adjusting */
-/* the exponent or the sign of A. */
-/* */
-/* B must be an integer (q=0) and in the range -set->digits through */
-/* +set->digits. */
-/* C must have space for set->digits digits. */
-/* NaNs are propagated as usual. Infinities are unaffected (but */
-/* B must be valid). No status is set unless B is invalid or an */
-/* operand is an sNaN. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberShift(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
- Int shift; /* rhs as an Int */
-
- #if DECCHECK
- if (decCheckOperands(res, lhs, rhs, set)) return res;
- #endif
-
- /* NaNs propagate as normal */
- if (decNumberIsNaN(lhs) || decNumberIsNaN(rhs))
- decNaNs(res, lhs, rhs, set, &status);
- /* rhs must be an integer */
- else if (decNumberIsInfinite(rhs) || rhs->exponent!=0)
- status=DEC_Invalid_operation;
- else { /* both numeric, rhs is an integer */
- shift=decGetInt(rhs); /* [cannot fail] */
- if (shift==BADINT /* something bad .. */
- || shift==BIGODD || shift==BIGEVEN /* .. very big .. */
- || abs(shift)>set->digits) /* .. or out of range */
- status=DEC_Invalid_operation;
- else { /* rhs is OK */
- uprv_decNumberCopy(res, lhs);
- if (shift!=0 && !decNumberIsInfinite(res)) { /* something to do */
- if (shift>0) { /* to left */
- if (shift==set->digits) { /* removing all */
- *res->lsu=0; /* so place 0 */
- res->digits=1; /* .. */
- }
- else { /* */
- /* first remove leading digits if necessary */
- if (res->digits+shift>set->digits) {
- decDecap(res, res->digits+shift-set->digits);
- /* that updated res->digits; may have gone to 1 (for a */
- /* single digit or for zero */
- }
- if (res->digits>1 || *res->lsu) /* if non-zero.. */
- res->digits=decShiftToMost(res->lsu, res->digits, shift);
- } /* partial left */
- } /* left */
- else { /* to right */
- if (-shift>=res->digits) { /* discarding all */
- *res->lsu=0; /* so place 0 */
- res->digits=1; /* .. */
- }
- else {
- decShiftToLeast(res->lsu, D2U(res->digits), -shift);
- res->digits-=(-shift);
- }
- } /* to right */
- } /* non-0 non-Inf shift */
- } /* rhs OK */
- } /* numerics */
- if (status!=0) decStatus(res, status, set);
- return res;
- } /* decNumberShift */
-
-/* ------------------------------------------------------------------ */
-/* decNumberSquareRoot -- square root operator */
-/* */
-/* This computes C = squareroot(A) */
-/* */
-/* res is C, the result. C may be A */
-/* rhs is A */
-/* set is the context; note that rounding mode has no effect */
-/* */
-/* C must have space for set->digits digits. */
-/* ------------------------------------------------------------------ */
-/* This uses the following varying-precision algorithm in: */
-/* */
-/* Properly Rounded Variable Precision Square Root, T. E. Hull and */
-/* A. Abrham, ACM Transactions on Mathematical Software, Vol 11 #3, */
-/* pp229-237, ACM, September 1985. */
-/* */
-/* The square-root is calculated using Newton's method, after which */
-/* a check is made to ensure the result is correctly rounded. */
-/* */
-/* % [Reformatted original Numerical Turing source code follows.] */
-/* function sqrt(x : real) : real */
-/* % sqrt(x) returns the properly rounded approximation to the square */
-/* % root of x, in the precision of the calling environment, or it */
-/* % fails if x < 0. */
-/* % t e hull and a abrham, august, 1984 */
-/* if x <= 0 then */
-/* if x < 0 then */
-/* assert false */
-/* else */
-/* result 0 */
-/* end if */
-/* end if */
-/* var f := setexp(x, 0) % fraction part of x [0.1 <= x < 1] */
-/* var e := getexp(x) % exponent part of x */
-/* var approx : real */
-/* if e mod 2 = 0 then */
-/* approx := .259 + .819 * f % approx to root of f */
-/* else */
-/* f := f/l0 % adjustments */
-/* e := e + 1 % for odd */
-/* approx := .0819 + 2.59 * f % exponent */
-/* end if */
-/* */
-/* var p:= 3 */
-/* const maxp := currentprecision + 2 */
-/* loop */
-/* p := min(2*p - 2, maxp) % p = 4,6,10, . . . , maxp */
-/* precision p */
-/* approx := .5 * (approx + f/approx) */
-/* exit when p = maxp */
-/* end loop */
-/* */
-/* % approx is now within 1 ulp of the properly rounded square root */
-/* % of f; to ensure proper rounding, compare squares of (approx - */
-/* % l/2 ulp) and (approx + l/2 ulp) with f. */
-/* p := currentprecision */
-/* begin */
-/* precision p + 2 */
-/* const approxsubhalf := approx - setexp(.5, -p) */
-/* if mulru(approxsubhalf, approxsubhalf) > f then */
-/* approx := approx - setexp(.l, -p + 1) */
-/* else */
-/* const approxaddhalf := approx + setexp(.5, -p) */
-/* if mulrd(approxaddhalf, approxaddhalf) < f then */
-/* approx := approx + setexp(.l, -p + 1) */
-/* end if */
-/* end if */
-/* end */
-/* result setexp(approx, e div 2) % fix exponent */
-/* end sqrt */
-/* ------------------------------------------------------------------ */
-#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Warray-bounds"
-#endif
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decNumber *rhs,
- decContext *set) {
- decContext workset, approxset; /* work contexts */
- decNumber dzero; /* used for constant zero */
- Int maxp; /* largest working precision */
- Int workp; /* working precision */
- Int residue=0; /* rounding residue */
- uInt status=0, ignore=0; /* status accumulators */
- uInt rstatus; /* .. */
- Int exp; /* working exponent */
- Int ideal; /* ideal (preferred) exponent */
- Int needbytes; /* work */
- Int dropped; /* .. */
-
- #if DECSUBSET
- decNumber *allocrhs=NULL; /* non-NULL if rounded rhs allocated */
- #endif
- /* buffer for f [needs +1 in case DECBUFFER 0] */
- decNumber buff[D2N(DECBUFFER+1)];
- /* buffer for a [needs +2 to match likely maxp] */
- decNumber bufa[D2N(DECBUFFER+2)];
- /* buffer for temporary, b [must be same size as a] */
- decNumber bufb[D2N(DECBUFFER+2)];
- decNumber *allocbuff=NULL; /* -> allocated buff, iff allocated */
- decNumber *allocbufa=NULL; /* -> allocated bufa, iff allocated */
- decNumber *allocbufb=NULL; /* -> allocated bufb, iff allocated */
- decNumber *f=buff; /* reduced fraction */
- decNumber *a=bufa; /* approximation to result */
- decNumber *b=bufb; /* intermediate result */
- /* buffer for temporary variable, up to 3 digits */
- decNumber buft[D2N(3)];
- decNumber *t=buft; /* up-to-3-digit constant or work */
-
- #if DECCHECK
- if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
- #endif
-
- do { /* protect allocated storage */
- #if DECSUBSET
- if (!set->extended) {
- /* reduce operand and set lostDigits status, as needed */
- if (rhs->digits>set->digits) {
- allocrhs=decRoundOperand(rhs, set, &status);
- if (allocrhs==NULL) break;
- /* [Note: 'f' allocation below could reuse this buffer if */
- /* used, but as this is rare they are kept separate for clarity.] */
- rhs=allocrhs;
- }
- }
- #endif
- /* [following code does not require input rounding] */
-
- /* handle infinities and NaNs */
- if (SPECIALARG) {
- if (decNumberIsInfinite(rhs)) { /* an infinity */
- if (decNumberIsNegative(rhs)) status|=DEC_Invalid_operation;
- else uprv_decNumberCopy(res, rhs); /* +Infinity */
- }
- else decNaNs(res, rhs, NULL, set, &status); /* a NaN */
- break;
- }
-
- /* calculate the ideal (preferred) exponent [floor(exp/2)] */
- /* [It would be nicer to write: ideal=rhs->exponent>>1, but this */
- /* generates a compiler warning. Generated code is the same.] */
- ideal=(rhs->exponent&~1)/2; /* target */
-
- /* handle zeros */
- if (ISZERO(rhs)) {
- uprv_decNumberCopy(res, rhs); /* could be 0 or -0 */
- res->exponent=ideal; /* use the ideal [safe] */
- /* use decFinish to clamp any out-of-range exponent, etc. */
- decFinish(res, set, &residue, &status);
- break;
- }
-
- /* any other -x is an oops */
- if (decNumberIsNegative(rhs)) {
- status|=DEC_Invalid_operation;
- break;
- }
-
- /* space is needed for three working variables */
- /* f -- the same precision as the RHS, reduced to 0.01->0.99... */
- /* a -- Hull's approximation -- precision, when assigned, is */
- /* currentprecision+1 or the input argument precision, */
- /* whichever is larger (+2 for use as temporary) */
- /* b -- intermediate temporary result (same size as a) */
- /* if any is too long for local storage, then allocate */
- workp=MAXI(set->digits+1, rhs->digits); /* actual rounding precision */
- workp=MAXI(workp, 7); /* at least 7 for low cases */
- maxp=workp+2; /* largest working precision */
-
- needbytes=sizeof(decNumber)+(D2U(rhs->digits)-1)*sizeof(Unit);
- if (needbytes>(Int)sizeof(buff)) {
- allocbuff=(decNumber *)malloc(needbytes);
- if (allocbuff==NULL) { /* hopeless -- abandon */
- status|=DEC_Insufficient_storage;
- break;}
- f=allocbuff; /* use the allocated space */
- }
- /* a and b both need to be able to hold a maxp-length number */
- needbytes=sizeof(decNumber)+(D2U(maxp)-1)*sizeof(Unit);
- if (needbytes>(Int)sizeof(bufa)) { /* [same applies to b] */
- allocbufa=(decNumber *)malloc(needbytes);
- allocbufb=(decNumber *)malloc(needbytes);
- if (allocbufa==NULL || allocbufb==NULL) { /* hopeless */
- status|=DEC_Insufficient_storage;
- break;}
- a=allocbufa; /* use the allocated spaces */
- b=allocbufb; /* .. */
- }
-
- /* copy rhs -> f, save exponent, and reduce so 0.1 <= f < 1 */
- uprv_decNumberCopy(f, rhs);
- exp=f->exponent+f->digits; /* adjusted to Hull rules */
- f->exponent=-(f->digits); /* to range */
-
- /* set up working context */
- uprv_decContextDefault(&workset, DEC_INIT_DECIMAL64);
- workset.emax=DEC_MAX_EMAX;
- workset.emin=DEC_MIN_EMIN;
-
- /* [Until further notice, no error is possible and status bits */
- /* (Rounded, etc.) should be ignored, not accumulated.] */
-
- /* Calculate initial approximation, and allow for odd exponent */
- workset.digits=workp; /* p for initial calculation */
- t->bits=0; t->digits=3;
- a->bits=0; a->digits=3;
- if ((exp & 1)==0) { /* even exponent */
- /* Set t=0.259, a=0.819 */
- t->exponent=-3;
- a->exponent=-3;
- #if DECDPUN>=3
- t->lsu[0]=259;
- a->lsu[0]=819;
- #elif DECDPUN==2
- t->lsu[0]=59; t->lsu[1]=2;
- a->lsu[0]=19; a->lsu[1]=8;
- #else
- t->lsu[0]=9; t->lsu[1]=5; t->lsu[2]=2;
- a->lsu[0]=9; a->lsu[1]=1; a->lsu[2]=8;
- #endif
- }
- else { /* odd exponent */
- /* Set t=0.0819, a=2.59 */
- f->exponent--; /* f=f/10 */
- exp++; /* e=e+1 */
- t->exponent=-4;
- a->exponent=-2;
- #if DECDPUN>=3
- t->lsu[0]=819;
- a->lsu[0]=259;
- #elif DECDPUN==2
- t->lsu[0]=19; t->lsu[1]=8;
- a->lsu[0]=59; a->lsu[1]=2;
- #else
- t->lsu[0]=9; t->lsu[1]=1; t->lsu[2]=8;
- a->lsu[0]=9; a->lsu[1]=5; a->lsu[2]=2;
- #endif
- }
-
- decMultiplyOp(a, a, f, &workset, &ignore); /* a=a*f */
- decAddOp(a, a, t, &workset, 0, &ignore); /* ..+t */
- /* [a is now the initial approximation for sqrt(f), calculated with */
- /* currentprecision, which is also a's precision.] */
-
- /* the main calculation loop */
- uprv_decNumberZero(&dzero); /* make 0 */
- uprv_decNumberZero(t); /* set t = 0.5 */
- t->lsu[0]=5; /* .. */
- t->exponent=-1; /* .. */
- workset.digits=3; /* initial p */
- for (; workset.digits<maxp;) {
- /* set p to min(2*p - 2, maxp) [hence 3; or: 4, 6, 10, ... , maxp] */
- workset.digits=MINI(workset.digits*2-2, maxp);
- /* a = 0.5 * (a + f/a) */
- /* [calculated at p then rounded to currentprecision] */
- decDivideOp(b, f, a, &workset, DIVIDE, &ignore); /* b=f/a */
- decAddOp(b, b, a, &workset, 0, &ignore); /* b=b+a */
- decMultiplyOp(a, b, t, &workset, &ignore); /* a=b*0.5 */
- } /* loop */
-
- /* Here, 0.1 <= a < 1 [Hull], and a has maxp digits */
- /* now reduce to length, etc.; this needs to be done with a */
- /* having the correct exponent so as to handle subnormals */
- /* correctly */
- approxset=*set; /* get emin, emax, etc. */
- approxset.round=DEC_ROUND_HALF_EVEN;
- a->exponent+=exp/2; /* set correct exponent */
- rstatus=0; /* clear status */
- residue=0; /* .. and accumulator */
- decCopyFit(a, a, &approxset, &residue, &rstatus); /* reduce (if needed) */
- decFinish(a, &approxset, &residue, &rstatus); /* clean and finalize */
-
- /* Overflow was possible if the input exponent was out-of-range, */
- /* in which case quit */
- if (rstatus&DEC_Overflow) {
- status=rstatus; /* use the status as-is */
- uprv_decNumberCopy(res, a); /* copy to result */
- break;
- }
-
- /* Preserve status except Inexact/Rounded */
- status|=(rstatus & ~(DEC_Rounded|DEC_Inexact));
-
- /* Carry out the Hull correction */
- a->exponent-=exp/2; /* back to 0.1->1 */
-
- /* a is now at final precision and within 1 ulp of the properly */
- /* rounded square root of f; to ensure proper rounding, compare */
- /* squares of (a - l/2 ulp) and (a + l/2 ulp) with f. */
- /* Here workset.digits=maxp and t=0.5, and a->digits determines */
- /* the ulp */
- workset.digits--; /* maxp-1 is OK now */
- t->exponent=-a->digits-1; /* make 0.5 ulp */
- decAddOp(b, a, t, &workset, DECNEG, &ignore); /* b = a - 0.5 ulp */
- workset.round=DEC_ROUND_UP;
- decMultiplyOp(b, b, b, &workset, &ignore); /* b = mulru(b, b) */
- decCompareOp(b, f, b, &workset, COMPARE, &ignore); /* b ? f, reversed */
- if (decNumberIsNegative(b)) { /* f < b [i.e., b > f] */
- /* this is the more common adjustment, though both are rare */
- t->exponent++; /* make 1.0 ulp */
- t->lsu[0]=1; /* .. */
- decAddOp(a, a, t, &workset, DECNEG, &ignore); /* a = a - 1 ulp */
- /* assign to approx [round to length] */
- approxset.emin-=exp/2; /* adjust to match a */
- approxset.emax-=exp/2;
- decAddOp(a, &dzero, a, &approxset, 0, &ignore);
- }
- else {
- decAddOp(b, a, t, &workset, 0, &ignore); /* b = a + 0.5 ulp */
- workset.round=DEC_ROUND_DOWN;
- decMultiplyOp(b, b, b, &workset, &ignore); /* b = mulrd(b, b) */
- decCompareOp(b, b, f, &workset, COMPARE, &ignore); /* b ? f */
- if (decNumberIsNegative(b)) { /* b < f */
- t->exponent++; /* make 1.0 ulp */
- t->lsu[0]=1; /* .. */
- decAddOp(a, a, t, &workset, 0, &ignore); /* a = a + 1 ulp */
- /* assign to approx [round to length] */
- approxset.emin-=exp/2; /* adjust to match a */
- approxset.emax-=exp/2;
- decAddOp(a, &dzero, a, &approxset, 0, &ignore);
- }
- }
- /* [no errors are possible in the above, and rounding/inexact during */
- /* estimation are irrelevant, so status was not accumulated] */
-
- /* Here, 0.1 <= a < 1 (still), so adjust back */
- a->exponent+=exp/2; /* set correct exponent */
-
- /* count droppable zeros [after any subnormal rounding] by */
- /* trimming a copy */
- uprv_decNumberCopy(b, a);
- decTrim(b, set, 1, 1, &dropped); /* [drops trailing zeros] */
-
- /* Set Inexact and Rounded. The answer can only be exact if */
- /* it is short enough so that squaring it could fit in workp */
- /* digits, so this is the only (relatively rare) condition that */
- /* a careful check is needed */
- if (b->digits*2-1 > workp) { /* cannot fit */
- status|=DEC_Inexact|DEC_Rounded;
- }
- else { /* could be exact/unrounded */
- uInt mstatus=0; /* local status */
- decMultiplyOp(b, b, b, &workset, &mstatus); /* try the multiply */
- if (mstatus&DEC_Overflow) { /* result just won't fit */
- status|=DEC_Inexact|DEC_Rounded;
- }
- else { /* plausible */
- decCompareOp(t, b, rhs, &workset, COMPARE, &mstatus); /* b ? rhs */
- if (!ISZERO(t)) status|=DEC_Inexact|DEC_Rounded; /* not equal */
- else { /* is Exact */
- /* here, dropped is the count of trailing zeros in 'a' */
- /* use closest exponent to ideal... */
- Int todrop=ideal-a->exponent; /* most that can be dropped */
- if (todrop<0) status|=DEC_Rounded; /* ideally would add 0s */
- else { /* unrounded */
- /* there are some to drop, but emax may not allow all */
- Int maxexp=set->emax-set->digits+1;
- Int maxdrop=maxexp-a->exponent;
- if (todrop>maxdrop && set->clamp) { /* apply clamping */
- todrop=maxdrop;
- status|=DEC_Clamped;
- }
- if (dropped<todrop) { /* clamp to those available */
- todrop=dropped;
- status|=DEC_Clamped;
- }
- if (todrop>0) { /* have some to drop */
- decShiftToLeast(a->lsu, D2U(a->digits), todrop);
- a->exponent+=todrop; /* maintain numerical value */
- a->digits-=todrop; /* new length */
- }
- }
- }
- }
- }
-
- /* double-check Underflow, as perhaps the result could not have */
- /* been subnormal (initial argument too big), or it is now Exact */
- if (status&DEC_Underflow) {
- Int ae=rhs->exponent+rhs->digits-1; /* adjusted exponent */
- /* check if truly subnormal */
- #if DECEXTFLAG /* DEC_Subnormal too */
- if (ae>=set->emin*2) status&=~(DEC_Subnormal|DEC_Underflow);
- #else
- if (ae>=set->emin*2) status&=~DEC_Underflow;
- #endif
- /* check if truly inexact */
- if (!(status&DEC_Inexact)) status&=~DEC_Underflow;
- }
-
- uprv_decNumberCopy(res, a); /* a is now the result */
- } while(0); /* end protected */
-
- if (allocbuff!=NULL) free(allocbuff); /* drop any storage used */
- if (allocbufa!=NULL) free(allocbufa); /* .. */
- if (allocbufb!=NULL) free(allocbufb); /* .. */
- #if DECSUBSET
- if (allocrhs !=NULL) free(allocrhs); /* .. */
- #endif
- if (status!=0) decStatus(res, status, set);/* then report status */
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberSquareRoot */
-#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406
-#pragma GCC diagnostic pop
-#endif
-
-/* ------------------------------------------------------------------ */
-/* decNumberSubtract -- subtract two Numbers */
-/* */
-/* This computes C = A - B */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X-X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* */
-/* C must have space for set->digits digits. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberSubtract(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- uInt status=0; /* accumulator */
-
- decAddOp(res, lhs, rhs, set, DECNEG, &status);
- if (status!=0) decStatus(res, status, set);
- #if DECCHECK
- decCheckInexact(res, set);
- #endif
- return res;
- } /* decNumberSubtract */
-
-/* ------------------------------------------------------------------ */
-/* decNumberToIntegralExact -- round-to-integral-value with InExact */
-/* decNumberToIntegralValue -- round-to-integral-value */
-/* */
-/* res is the result */
-/* rhs is input number */
-/* set is the context */
-/* */
-/* res must have space for any value of rhs. */
-/* */
-/* This implements the IEEE special operators and therefore treats */
-/* special values as valid. For finite numbers it returns */
-/* rescale(rhs, 0) if rhs->exponent is <0. */
-/* Otherwise the result is rhs (so no error is possible, except for */
-/* sNaN). */
-/* */
-/* The context is used for rounding mode and status after sNaN, but */
-/* the digits setting is ignored. The Exact version will signal */
-/* Inexact if the result differs numerically from rhs; the other */
-/* never signals Inexact. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberToIntegralExact(decNumber *res, const decNumber *rhs,
- decContext *set) {
- decNumber dn;
- decContext workset; /* working context */
- uInt status=0; /* accumulator */
-
- #if DECCHECK
- if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
- #endif
-
- /* handle infinities and NaNs */
- if (SPECIALARG) {
- if (decNumberIsInfinite(rhs)) uprv_decNumberCopy(res, rhs); /* an Infinity */
- else decNaNs(res, rhs, NULL, set, &status); /* a NaN */
- }
- else { /* finite */
- /* have a finite number; no error possible (res must be big enough) */
- if (rhs->exponent>=0) return uprv_decNumberCopy(res, rhs);
- /* that was easy, but if negative exponent there is work to do... */
- workset=*set; /* clone rounding, etc. */
- workset.digits=rhs->digits; /* no length rounding */
- workset.traps=0; /* no traps */
- uprv_decNumberZero(&dn); /* make a number with exponent 0 */
- uprv_decNumberQuantize(res, rhs, &dn, &workset);
- status|=workset.status;
- }
- if (status!=0) decStatus(res, status, set);
- return res;
- } /* decNumberToIntegralExact */
-
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberToIntegralValue(decNumber *res, const decNumber *rhs,
- decContext *set) {
- decContext workset=*set; /* working context */
- workset.traps=0; /* no traps */
- uprv_decNumberToIntegralExact(res, rhs, &workset);
- /* this never affects set, except for sNaNs; NaN will have been set */
- /* or propagated already, so no need to call decStatus */
- set->status|=workset.status&DEC_Invalid_operation;
- return res;
- } /* decNumberToIntegralValue */
-
-/* ------------------------------------------------------------------ */
-/* decNumberXor -- XOR two Numbers, digitwise */
-/* */
-/* This computes C = A ^ B */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X^X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context (used for result length and error report) */
-/* */
-/* C must have space for set->digits digits. */
-/* */
-/* Logical function restrictions apply (see above); a NaN is */
-/* returned with Invalid_operation if a restriction is violated. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberXor(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- const Unit *ua, *ub; /* -> operands */
- const Unit *msua, *msub; /* -> operand msus */
- Unit *uc, *msuc; /* -> result and its msu */
- Int msudigs; /* digits in res msu */
- #if DECCHECK
- if (decCheckOperands(res, lhs, rhs, set)) return res;
- #endif
-
- if (lhs->exponent!=0 || decNumberIsSpecial(lhs) || decNumberIsNegative(lhs)
- || rhs->exponent!=0 || decNumberIsSpecial(rhs) || decNumberIsNegative(rhs)) {
- decStatus(res, DEC_Invalid_operation, set);
- return res;
- }
- /* operands are valid */
- ua=lhs->lsu; /* bottom-up */
- ub=rhs->lsu; /* .. */
- uc=res->lsu; /* .. */
- msua=ua+D2U(lhs->digits)-1; /* -> msu of lhs */
- msub=ub+D2U(rhs->digits)-1; /* -> msu of rhs */
- msuc=uc+D2U(set->digits)-1; /* -> msu of result */
- msudigs=MSUDIGITS(set->digits); /* [faster than remainder] */
- for (; uc<=msuc; ua++, ub++, uc++) { /* Unit loop */
- Unit a, b; /* extract units */
- if (ua>msua) a=0;
- else a=*ua;
- if (ub>msub) b=0;
- else b=*ub;
- *uc=0; /* can now write back */
- if (a|b) { /* maybe 1 bits to examine */
- Int i, j;
- /* This loop could be unrolled and/or use BIN2BCD tables */
- for (i=0; i<DECDPUN; i++) {
- if ((a^b)&1) *uc=*uc+(Unit)powers[i]; /* effect XOR */
- j=a%10;
- a=a/10;
- j|=b%10;
- b=b/10;
- if (j>1) {
- decStatus(res, DEC_Invalid_operation, set);
- return res;
- }
- if (uc==msuc && i==msudigs-1) break; /* just did final digit */
- } /* each digit */
- } /* non-zero */
- } /* each unit */
- /* [here uc-1 is the msu of the result] */
- res->digits=decGetDigits(res->lsu, static_cast<int32_t>(uc-res->lsu));
- res->exponent=0; /* integer */
- res->bits=0; /* sign=0 */
- return res; /* [no status to set] */
- } /* decNumberXor */
-
-
-/* ================================================================== */
-/* Utility routines */
-/* ================================================================== */
-
-/* ------------------------------------------------------------------ */
-/* decNumberClass -- return the decClass of a decNumber */
-/* dn -- the decNumber to test */
-/* set -- the context to use for Emin */
-/* returns the decClass enum */
-/* ------------------------------------------------------------------ */
-enum decClass uprv_decNumberClass(const decNumber *dn, decContext *set) {
- if (decNumberIsSpecial(dn)) {
- if (decNumberIsQNaN(dn)) return DEC_CLASS_QNAN;
- if (decNumberIsSNaN(dn)) return DEC_CLASS_SNAN;
- /* must be an infinity */
- if (decNumberIsNegative(dn)) return DEC_CLASS_NEG_INF;
- return DEC_CLASS_POS_INF;
- }
- /* is finite */
- if (uprv_decNumberIsNormal(dn, set)) { /* most common */
- if (decNumberIsNegative(dn)) return DEC_CLASS_NEG_NORMAL;
- return DEC_CLASS_POS_NORMAL;
- }
- /* is subnormal or zero */
- if (decNumberIsZero(dn)) { /* most common */
- if (decNumberIsNegative(dn)) return DEC_CLASS_NEG_ZERO;
- return DEC_CLASS_POS_ZERO;
- }
- if (decNumberIsNegative(dn)) return DEC_CLASS_NEG_SUBNORMAL;
- return DEC_CLASS_POS_SUBNORMAL;
- } /* decNumberClass */
-
-/* ------------------------------------------------------------------ */
-/* decNumberClassToString -- convert decClass to a string */
-/* */
-/* eclass is a valid decClass */
-/* returns a constant string describing the class (max 13+1 chars) */
-/* ------------------------------------------------------------------ */
-const char *uprv_decNumberClassToString(enum decClass eclass) {
- if (eclass==DEC_CLASS_POS_NORMAL) return DEC_ClassString_PN;
- if (eclass==DEC_CLASS_NEG_NORMAL) return DEC_ClassString_NN;
- if (eclass==DEC_CLASS_POS_ZERO) return DEC_ClassString_PZ;
- if (eclass==DEC_CLASS_NEG_ZERO) return DEC_ClassString_NZ;
- if (eclass==DEC_CLASS_POS_SUBNORMAL) return DEC_ClassString_PS;
- if (eclass==DEC_CLASS_NEG_SUBNORMAL) return DEC_ClassString_NS;
- if (eclass==DEC_CLASS_POS_INF) return DEC_ClassString_PI;
- if (eclass==DEC_CLASS_NEG_INF) return DEC_ClassString_NI;
- if (eclass==DEC_CLASS_QNAN) return DEC_ClassString_QN;
- if (eclass==DEC_CLASS_SNAN) return DEC_ClassString_SN;
- return DEC_ClassString_UN; /* Unknown */
- } /* decNumberClassToString */
-
-/* ------------------------------------------------------------------ */
-/* decNumberCopy -- copy a number */
-/* */
-/* dest is the target decNumber */
-/* src is the source decNumber */
-/* returns dest */
-/* */
-/* (dest==src is allowed and is a no-op) */
-/* All fields are updated as required. This is a utility operation, */
-/* so special values are unchanged and no error is possible. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberCopy(decNumber *dest, const decNumber *src) {
-
- #if DECCHECK
- if (src==NULL) return uprv_decNumberZero(dest);
- #endif
-
- if (dest==src) return dest; /* no copy required */
-
- /* Use explicit assignments here as structure assignment could copy */
- /* more than just the lsu (for small DECDPUN). This would not affect */
- /* the value of the results, but could disturb test harness spill */
- /* checking. */
- dest->bits=src->bits;
- dest->exponent=src->exponent;
- dest->digits=src->digits;
- dest->lsu[0]=src->lsu[0];
- if (src->digits>DECDPUN) { /* more Units to come */
- const Unit *smsup, *s; /* work */
- Unit *d; /* .. */
- /* memcpy for the remaining Units would be safe as they cannot */
- /* overlap. However, this explicit loop is faster in short cases. */
- d=dest->lsu+1; /* -> first destination */
- smsup=src->lsu+D2U(src->digits); /* -> source msu+1 */
- for (s=src->lsu+1; s<smsup; s++, d++) *d=*s;
- }
- return dest;
- } /* decNumberCopy */
-
-/* ------------------------------------------------------------------ */
-/* decNumberCopyAbs -- quiet absolute value operator */
-/* */
-/* This sets C = abs(A) */
-/* */
-/* res is C, the result. C may be A */
-/* rhs is A */
-/* */
-/* C must have space for set->digits digits. */
-/* No exception or error can occur; this is a quiet bitwise operation.*/
-/* See also decNumberAbs for a checking version of this. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberCopyAbs(decNumber *res, const decNumber *rhs) {
- #if DECCHECK
- if (decCheckOperands(res, DECUNUSED, rhs, DECUNCONT)) return res;
- #endif
- uprv_decNumberCopy(res, rhs);
- res->bits&=~DECNEG; /* turn off sign */
- return res;
- } /* decNumberCopyAbs */
-
-/* ------------------------------------------------------------------ */
-/* decNumberCopyNegate -- quiet negate value operator */
-/* */
-/* This sets C = negate(A) */
-/* */
-/* res is C, the result. C may be A */
-/* rhs is A */
-/* */
-/* C must have space for set->digits digits. */
-/* No exception or error can occur; this is a quiet bitwise operation.*/
-/* See also decNumberMinus for a checking version of this. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberCopyNegate(decNumber *res, const decNumber *rhs) {
- #if DECCHECK
- if (decCheckOperands(res, DECUNUSED, rhs, DECUNCONT)) return res;
- #endif
- uprv_decNumberCopy(res, rhs);
- res->bits^=DECNEG; /* invert the sign */
- return res;
- } /* decNumberCopyNegate */
-
-/* ------------------------------------------------------------------ */
-/* decNumberCopySign -- quiet copy and set sign operator */
-/* */
-/* This sets C = A with the sign of B */
-/* */
-/* res is C, the result. C may be A */
-/* lhs is A */
-/* rhs is B */
-/* */
-/* C must have space for set->digits digits. */
-/* No exception or error can occur; this is a quiet bitwise operation.*/
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberCopySign(decNumber *res, const decNumber *lhs,
- const decNumber *rhs) {
- uByte sign; /* rhs sign */
- #if DECCHECK
- if (decCheckOperands(res, DECUNUSED, rhs, DECUNCONT)) return res;
- #endif
- sign=rhs->bits & DECNEG; /* save sign bit */
- uprv_decNumberCopy(res, lhs);
- res->bits&=~DECNEG; /* clear the sign */
- res->bits|=sign; /* set from rhs */
- return res;
- } /* decNumberCopySign */
-
-/* ------------------------------------------------------------------ */
-/* decNumberGetBCD -- get the coefficient in BCD8 */
-/* dn is the source decNumber */
-/* bcd is the uInt array that will receive dn->digits BCD bytes, */
-/* most-significant at offset 0 */
-/* returns bcd */
-/* */
-/* bcd must have at least dn->digits bytes. No error is possible; if */
-/* dn is a NaN or Infinite, digits must be 1 and the coefficient 0. */
-/* ------------------------------------------------------------------ */
-U_CAPI uByte * U_EXPORT2 uprv_decNumberGetBCD(const decNumber *dn, uByte *bcd) {
- uByte *ub=bcd+dn->digits-1; /* -> lsd */
- const Unit *up=dn->lsu; /* Unit pointer, -> lsu */
-
- #if DECDPUN==1 /* trivial simple copy */
- for (; ub>=bcd; ub--, up++) *ub=*up;
- #else /* chopping needed */
- uInt u=*up; /* work */
- uInt cut=DECDPUN; /* downcounter through unit */
- for (; ub>=bcd; ub--) {
- *ub=(uByte)(u%10); /* [*6554 trick inhibits, here] */
- u=u/10;
- cut--;
- if (cut>0) continue; /* more in this unit */
- up++;
- u=*up;
- cut=DECDPUN;
- }
- #endif
- return bcd;
- } /* decNumberGetBCD */
-
-/* ------------------------------------------------------------------ */
-/* decNumberSetBCD -- set (replace) the coefficient from BCD8 */
-/* dn is the target decNumber */
-/* bcd is the uInt array that will source n BCD bytes, most- */
-/* significant at offset 0 */
-/* n is the number of digits in the source BCD array (bcd) */
-/* returns dn */
-/* */
-/* dn must have space for at least n digits. No error is possible; */
-/* if dn is a NaN, or Infinite, or is to become a zero, n must be 1 */
-/* and bcd[0] zero. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberSetBCD(decNumber *dn, const uByte *bcd, uInt n) {
- Unit *up=dn->lsu+D2U(dn->digits)-1; /* -> msu [target pointer] */
- const uByte *ub=bcd; /* -> source msd */
-
- #if DECDPUN==1 /* trivial simple copy */
- for (; ub<bcd+n; ub++, up--) *up=*ub;
- #else /* some assembly needed */
- /* calculate how many digits in msu, and hence first cut */
- Int cut=MSUDIGITS(n); /* [faster than remainder] */
- for (;up>=dn->lsu; up--) { /* each Unit from msu */
- *up=0; /* will take <=DECDPUN digits */
- for (; cut>0; ub++, cut--) *up=X10(*up)+*ub;
- cut=DECDPUN; /* next Unit has all digits */
- }
- #endif
- dn->digits=n; /* set digit count */
- return dn;
- } /* decNumberSetBCD */
-
-/* ------------------------------------------------------------------ */
-/* decNumberIsNormal -- test normality of a decNumber */
-/* dn is the decNumber to test */
-/* set is the context to use for Emin */
-/* returns 1 if |dn| is finite and >=Nmin, 0 otherwise */
-/* ------------------------------------------------------------------ */
-Int uprv_decNumberIsNormal(const decNumber *dn, decContext *set) {
- Int ae; /* adjusted exponent */
- #if DECCHECK
- if (decCheckOperands(DECUNRESU, DECUNUSED, dn, set)) return 0;
- #endif
-
- if (decNumberIsSpecial(dn)) return 0; /* not finite */
- if (decNumberIsZero(dn)) return 0; /* not non-zero */
-
- ae=dn->exponent+dn->digits-1; /* adjusted exponent */
- if (ae<set->emin) return 0; /* is subnormal */
- return 1;
- } /* decNumberIsNormal */
-
-/* ------------------------------------------------------------------ */
-/* decNumberIsSubnormal -- test subnormality of a decNumber */
-/* dn is the decNumber to test */
-/* set is the context to use for Emin */
-/* returns 1 if |dn| is finite, non-zero, and <Nmin, 0 otherwise */
-/* ------------------------------------------------------------------ */
-Int uprv_decNumberIsSubnormal(const decNumber *dn, decContext *set) {
- Int ae; /* adjusted exponent */
- #if DECCHECK
- if (decCheckOperands(DECUNRESU, DECUNUSED, dn, set)) return 0;
- #endif
-
- if (decNumberIsSpecial(dn)) return 0; /* not finite */
- if (decNumberIsZero(dn)) return 0; /* not non-zero */
-
- ae=dn->exponent+dn->digits-1; /* adjusted exponent */
- if (ae<set->emin) return 1; /* is subnormal */
- return 0;
- } /* decNumberIsSubnormal */
-
-/* ------------------------------------------------------------------ */
-/* decNumberTrim -- remove insignificant zeros */
-/* */
-/* dn is the number to trim */
-/* returns dn */
-/* */
-/* All fields are updated as required. This is a utility operation, */
-/* so special values are unchanged and no error is possible. The */
-/* zeros are removed unconditionally. */
-/* ------------------------------------------------------------------ */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberTrim(decNumber *dn) {
- Int dropped; /* work */
- decContext set; /* .. */
- #if DECCHECK
- if (decCheckOperands(DECUNRESU, DECUNUSED, dn, DECUNCONT)) return dn;
- #endif
- uprv_decContextDefault(&set, DEC_INIT_BASE); /* clamp=0 */
- return decTrim(dn, &set, 0, 1, &dropped);
- } /* decNumberTrim */
-
-/* ------------------------------------------------------------------ */
-/* decNumberVersion -- return the name and version of this module */
-/* */
-/* No error is possible. */
-/* ------------------------------------------------------------------ */
-const char * uprv_decNumberVersion(void) {
- return DECVERSION;
- } /* decNumberVersion */
-
-/* ------------------------------------------------------------------ */
-/* decNumberZero -- set a number to 0 */
-/* */
-/* dn is the number to set, with space for one digit */
-/* returns dn */
-/* */
-/* No error is possible. */
-/* ------------------------------------------------------------------ */
-/* Memset is not used as it is much slower in some environments. */
-U_CAPI decNumber * U_EXPORT2 uprv_decNumberZero(decNumber *dn) {
-
- #if DECCHECK
- if (decCheckOperands(dn, DECUNUSED, DECUNUSED, DECUNCONT)) return dn;
- #endif
-
- dn->bits=0;
- dn->exponent=0;
- dn->digits=1;
- dn->lsu[0]=0;
- return dn;
- } /* decNumberZero */
-
-/* ================================================================== */
-/* Local routines */
-/* ================================================================== */
-
-/* ------------------------------------------------------------------ */
-/* decToString -- lay out a number into a string */
-/* */
-/* dn is the number to lay out */
-/* string is where to lay out the number */
-/* eng is 1 if Engineering, 0 if Scientific */
-/* */
-/* string must be at least dn->digits+14 characters long */
-/* No error is possible. */
-/* */
-/* Note that this routine can generate a -0 or 0.000. These are */
-/* never generated in subset to-number or arithmetic, but can occur */
-/* in non-subset arithmetic (e.g., -1*0 or 1.234-1.234). */
-/* ------------------------------------------------------------------ */
-/* If DECCHECK is enabled the string "?" is returned if a number is */
-/* invalid. */
-static void decToString(const decNumber *dn, char *string, Flag eng) {
- Int exp=dn->exponent; /* local copy */
- Int e; /* E-part value */
- Int pre; /* digits before the '.' */
- Int cut; /* for counting digits in a Unit */
- char *c=string; /* work [output pointer] */
- const Unit *up=dn->lsu+D2U(dn->digits)-1; /* -> msu [input pointer] */
- uInt u, pow; /* work */
-
- #if DECCHECK
- if (decCheckOperands(DECUNRESU, dn, DECUNUSED, DECUNCONT)) {
- strcpy(string, "?");
- return;}
- #endif
-
- if (decNumberIsNegative(dn)) { /* Negatives get a minus */
- *c='-';
- c++;
- }
- if (dn->bits&DECSPECIAL) { /* Is a special value */
- if (decNumberIsInfinite(dn)) {
- strcpy(c, "Inf");
- strcpy(c+3, "inity");
- return;}
- /* a NaN */
- if (dn->bits&DECSNAN) { /* signalling NaN */
- *c='s';
- c++;
- }
- strcpy(c, "NaN");
- c+=3; /* step past */
- /* if not a clean non-zero coefficient, that's all there is in a */
- /* NaN string */
- if (exp!=0 || (*dn->lsu==0 && dn->digits==1)) return;
- /* [drop through to add integer] */
- }
-
- /* calculate how many digits in msu, and hence first cut */
- cut=MSUDIGITS(dn->digits); /* [faster than remainder] */
- cut--; /* power of ten for digit */
-
- if (exp==0) { /* simple integer [common fastpath] */
- for (;up>=dn->lsu; up--) { /* each Unit from msu */
- u=*up; /* contains DECDPUN digits to lay out */
- for (; cut>=0; c++, cut--) TODIGIT(u, cut, c, pow);
- cut=DECDPUN-1; /* next Unit has all digits */
- }
- *c='\0'; /* terminate the string */
- return;}
-
- /* non-0 exponent -- assume plain form */
- pre=dn->digits+exp; /* digits before '.' */
- e=0; /* no E */
- if ((exp>0) || (pre<-5)) { /* need exponential form */
- e=exp+dn->digits-1; /* calculate E value */
- pre=1; /* assume one digit before '.' */
- if (eng && (e!=0)) { /* engineering: may need to adjust */
- Int adj; /* adjustment */
- /* The C remainder operator is undefined for negative numbers, so */
- /* a positive remainder calculation must be used here */
- if (e<0) {
- adj=(-e)%3;
- if (adj!=0) adj=3-adj;
- }
- else { /* e>0 */
- adj=e%3;
- }
- e=e-adj;
- /* if dealing with zero still produce an exponent which is a */
- /* multiple of three, as expected, but there will only be the */
- /* one zero before the E, still. Otherwise note the padding. */
- if (!ISZERO(dn)) pre+=adj;
- else { /* is zero */
- if (adj!=0) { /* 0.00Esnn needed */
- e=e+3;
- pre=-(2-adj);
- }
- } /* zero */
- } /* eng */
- } /* need exponent */
-
- /* lay out the digits of the coefficient, adding 0s and . as needed */
- u=*up;
- if (pre>0) { /* xxx.xxx or xx00 (engineering) form */
- Int n=pre;
- for (; pre>0; pre--, c++, cut--) {
- if (cut<0) { /* need new Unit */
- if (up==dn->lsu) break; /* out of input digits (pre>digits) */
- up--;
- cut=DECDPUN-1;
- u=*up;
- }
- TODIGIT(u, cut, c, pow);
- }
- if (n<dn->digits) { /* more to come, after '.' */
- *c='.'; c++;
- for (;; c++, cut--) {
- if (cut<0) { /* need new Unit */
- if (up==dn->lsu) break; /* out of input digits */
- up--;
- cut=DECDPUN-1;
- u=*up;
- }
- TODIGIT(u, cut, c, pow);
- }
- }
- else for (; pre>0; pre--, c++) *c='0'; /* 0 padding (for engineering) needed */
- }
- else { /* 0.xxx or 0.000xxx form */
- *c='0'; c++;
- *c='.'; c++;
- for (; pre<0; pre++, c++) *c='0'; /* add any 0's after '.' */
- for (; ; c++, cut--) {
- if (cut<0) { /* need new Unit */
- if (up==dn->lsu) break; /* out of input digits */
- up--;
- cut=DECDPUN-1;
- u=*up;
- }
- TODIGIT(u, cut, c, pow);
- }
- }
-
- /* Finally add the E-part, if needed. It will never be 0, has a
- base maximum and minimum of +999999999 through -999999999, but
- could range down to -1999999998 for anormal numbers */
- if (e!=0) {
- Flag had=0; /* 1=had non-zero */
- *c='E'; c++;
- *c='+'; c++; /* assume positive */
- u=e; /* .. */
- if (e<0) {
- *(c-1)='-'; /* oops, need - */
- u=-e; /* uInt, please */
- }
- /* lay out the exponent [_itoa or equivalent is not ANSI C] */
- for (cut=9; cut>=0; cut--) {
- TODIGIT(u, cut, c, pow);
- if (*c=='0' && !had) continue; /* skip leading zeros */
- had=1; /* had non-0 */
- c++; /* step for next */
- } /* cut */
- }
- *c='\0'; /* terminate the string (all paths) */
- return;
- } /* decToString */
-
-/* ------------------------------------------------------------------ */
-/* decAddOp -- add/subtract operation */
-/* */
-/* This computes C = A + B */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X+X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* negate is DECNEG if rhs should be negated, or 0 otherwise */
-/* status accumulates status for the caller */
-/* */
-/* C must have space for set->digits digits. */
-/* Inexact in status must be 0 for correct Exact zero sign in result */
-/* ------------------------------------------------------------------ */
-/* If possible, the coefficient is calculated directly into C. */
-/* However, if: */
-/* -- a digits+1 calculation is needed because the numbers are */
-/* unaligned and span more than set->digits digits */
-/* -- a carry to digits+1 digits looks possible */
-/* -- C is the same as A or B, and the result would destructively */
-/* overlap the A or B coefficient */
-/* then the result must be calculated into a temporary buffer. In */
-/* this case a local (stack) buffer is used if possible, and only if */
-/* too long for that does malloc become the final resort. */
-/* */
-/* Misalignment is handled as follows: */
-/* Apad: (AExp>BExp) Swap operands and proceed as for BExp>AExp. */
-/* BPad: Apply the padding by a combination of shifting (whole */
-/* units) and multiplication (part units). */
-/* */
-/* Addition, especially x=x+1, is speed-critical. */
-/* The static buffer is larger than might be expected to allow for */
-/* calls from higher-level funtions (notable exp). */
-/* ------------------------------------------------------------------ */
-static decNumber * decAddOp(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set,
- uByte negate, uInt *status) {
- #if DECSUBSET
- decNumber *alloclhs=NULL; /* non-NULL if rounded lhs allocated */
- decNumber *allocrhs=NULL; /* .., rhs */
- #endif
- Int rhsshift; /* working shift (in Units) */
- Int maxdigits; /* longest logical length */
- Int mult; /* multiplier */
- Int residue; /* rounding accumulator */
- uByte bits; /* result bits */
- Flag diffsign; /* non-0 if arguments have different sign */
- Unit *acc; /* accumulator for result */
- Unit accbuff[SD2U(DECBUFFER*2+20)]; /* local buffer [*2+20 reduces many */
- /* allocations when called from */
- /* other operations, notable exp] */
- Unit *allocacc=NULL; /* -> allocated acc buffer, iff allocated */
- Int reqdigits=set->digits; /* local copy; requested DIGITS */
- Int padding; /* work */
-
- #if DECCHECK
- if (decCheckOperands(res, lhs, rhs, set)) return res;
- #endif
-
- do { /* protect allocated storage */
- #if DECSUBSET
- if (!set->extended) {
- /* reduce operands and set lostDigits status, as needed */
- if (lhs->digits>reqdigits) {
- alloclhs=decRoundOperand(lhs, set, status);
- if (alloclhs==NULL) break;
- lhs=alloclhs;
- }
- if (rhs->digits>reqdigits) {
- allocrhs=decRoundOperand(rhs, set, status);
- if (allocrhs==NULL) break;
- rhs=allocrhs;
- }
- }
- #endif
- /* [following code does not require input rounding] */
-
- /* note whether signs differ [used all paths] */
- diffsign=(Flag)((lhs->bits^rhs->bits^negate)&DECNEG);
-
- /* handle infinities and NaNs */
- if (SPECIALARGS) { /* a special bit set */
- if (SPECIALARGS & (DECSNAN | DECNAN)) /* a NaN */
- decNaNs(res, lhs, rhs, set, status);
- else { /* one or two infinities */
- if (decNumberIsInfinite(lhs)) { /* LHS is infinity */
- /* two infinities with different signs is invalid */
- if (decNumberIsInfinite(rhs) && diffsign) {
- *status|=DEC_Invalid_operation;
- break;
- }
- bits=lhs->bits & DECNEG; /* get sign from LHS */
- }
- else bits=(rhs->bits^negate) & DECNEG;/* RHS must be Infinity */
- bits|=DECINF;
- uprv_decNumberZero(res);
- res->bits=bits; /* set +/- infinity */
- } /* an infinity */
- break;
- }
-
- /* Quick exit for add 0s; return the non-0, modified as need be */
- if (ISZERO(lhs)) {
- Int adjust; /* work */
- Int lexp=lhs->exponent; /* save in case LHS==RES */
- bits=lhs->bits; /* .. */
- residue=0; /* clear accumulator */
- decCopyFit(res, rhs, set, &residue, status); /* copy (as needed) */
- res->bits^=negate; /* flip if rhs was negated */
- #if DECSUBSET
- if (set->extended) { /* exponents on zeros count */
- #endif
- /* exponent will be the lower of the two */
- adjust=lexp-res->exponent; /* adjustment needed [if -ve] */
- if (ISZERO(res)) { /* both 0: special IEEE 754 rules */
- if (adjust<0) res->exponent=lexp; /* set exponent */
- /* 0-0 gives +0 unless rounding to -infinity, and -0-0 gives -0 */
- if (diffsign) {
- if (set->round!=DEC_ROUND_FLOOR) res->bits=0;
- else res->bits=DECNEG; /* preserve 0 sign */
- }
- }
- else { /* non-0 res */
- if (adjust<0) { /* 0-padding needed */
- if ((res->digits-adjust)>set->digits) {
- adjust=res->digits-set->digits; /* to fit exactly */
- *status|=DEC_Rounded; /* [but exact] */
- }
- res->digits=decShiftToMost(res->lsu, res->digits, -adjust);
- res->exponent+=adjust; /* set the exponent. */
- }
- } /* non-0 res */
- #if DECSUBSET
- } /* extended */
- #endif
- decFinish(res, set, &residue, status); /* clean and finalize */
- break;}
-
- if (ISZERO(rhs)) { /* [lhs is non-zero] */
- Int adjust; /* work */
- Int rexp=rhs->exponent; /* save in case RHS==RES */
- bits=rhs->bits; /* be clean */
- residue=0; /* clear accumulator */
- decCopyFit(res, lhs, set, &residue, status); /* copy (as needed) */
- #if DECSUBSET
- if (set->extended) { /* exponents on zeros count */
- #endif
- /* exponent will be the lower of the two */
- /* [0-0 case handled above] */
- adjust=rexp-res->exponent; /* adjustment needed [if -ve] */
- if (adjust<0) { /* 0-padding needed */
- if ((res->digits-adjust)>set->digits) {
- adjust=res->digits-set->digits; /* to fit exactly */
- *status|=DEC_Rounded; /* [but exact] */
- }
- res->digits=decShiftToMost(res->lsu, res->digits, -adjust);
- res->exponent+=adjust; /* set the exponent. */
- }
- #if DECSUBSET
- } /* extended */
- #endif
- decFinish(res, set, &residue, status); /* clean and finalize */
- break;}
-
- /* [NB: both fastpath and mainpath code below assume these cases */
- /* (notably 0-0) have already been handled] */
-
- /* calculate the padding needed to align the operands */
- padding=rhs->exponent-lhs->exponent;
-
- /* Fastpath cases where the numbers are aligned and normal, the RHS */
- /* is all in one unit, no operand rounding is needed, and no carry, */
- /* lengthening, or borrow is needed */
- if (padding==0
- && rhs->digits<=DECDPUN
- && rhs->exponent>=set->emin /* [some normals drop through] */
- && rhs->exponent<=set->emax-set->digits+1 /* [could clamp] */
- && rhs->digits<=reqdigits
- && lhs->digits<=reqdigits) {
- Int partial=*lhs->lsu;
- if (!diffsign) { /* adding */
- partial+=*rhs->lsu;
- if ((partial<=DECDPUNMAX) /* result fits in unit */
- && (lhs->digits>=DECDPUN || /* .. and no digits-count change */
- partial<(Int)powers[lhs->digits])) { /* .. */
- if (res!=lhs) uprv_decNumberCopy(res, lhs); /* not in place */
- *res->lsu=(Unit)partial; /* [copy could have overwritten RHS] */
- break;
- }
- /* else drop out for careful add */
- }
- else { /* signs differ */
- partial-=*rhs->lsu;
- if (partial>0) { /* no borrow needed, and non-0 result */
- if (res!=lhs) uprv_decNumberCopy(res, lhs); /* not in place */
- *res->lsu=(Unit)partial;
- /* this could have reduced digits [but result>0] */
- res->digits=decGetDigits(res->lsu, D2U(res->digits));
- break;
- }
- /* else drop out for careful subtract */
- }
- }
-
- /* Now align (pad) the lhs or rhs so they can be added or */
- /* subtracted, as necessary. If one number is much larger than */
- /* the other (that is, if in plain form there is a least one */
- /* digit between the lowest digit of one and the highest of the */
- /* other) padding with up to DIGITS-1 trailing zeros may be */
- /* needed; then apply rounding (as exotic rounding modes may be */
- /* affected by the residue). */
- rhsshift=0; /* rhs shift to left (padding) in Units */
- bits=lhs->bits; /* assume sign is that of LHS */
- mult=1; /* likely multiplier */
-
- /* [if padding==0 the operands are aligned; no padding is needed] */
- if (padding!=0) {
- /* some padding needed; always pad the RHS, as any required */
- /* padding can then be effected by a simple combination of */
- /* shifts and a multiply */
- Flag swapped=0;
- if (padding<0) { /* LHS needs the padding */
- const decNumber *t;
- padding=-padding; /* will be +ve */
- bits=(uByte)(rhs->bits^negate); /* assumed sign is now that of RHS */
- t=lhs; lhs=rhs; rhs=t;
- swapped=1;
- }
-
- /* If, after pad, rhs would be longer than lhs by digits+1 or */
- /* more then lhs cannot affect the answer, except as a residue, */
- /* so only need to pad up to a length of DIGITS+1. */
- if (rhs->digits+padding > lhs->digits+reqdigits+1) {
- /* The RHS is sufficient */
- /* for residue use the relative sign indication... */
- Int shift=reqdigits-rhs->digits; /* left shift needed */
- residue=1; /* residue for rounding */
- if (diffsign) residue=-residue; /* signs differ */
- /* copy, shortening if necessary */
- decCopyFit(res, rhs, set, &residue, status);
- /* if it was already shorter, then need to pad with zeros */
- if (shift>0) {
- res->digits=decShiftToMost(res->lsu, res->digits, shift);
- res->exponent-=shift; /* adjust the exponent. */
- }
- /* flip the result sign if unswapped and rhs was negated */
- if (!swapped) res->bits^=negate;
- decFinish(res, set, &residue, status); /* done */
- break;}
-
- /* LHS digits may affect result */
- rhsshift=D2U(padding+1)-1; /* this much by Unit shift .. */
- mult=powers[padding-(rhsshift*DECDPUN)]; /* .. this by multiplication */
- } /* padding needed */
-
- if (diffsign) mult=-mult; /* signs differ */
-
- /* determine the longer operand */
- maxdigits=rhs->digits+padding; /* virtual length of RHS */
- if (lhs->digits>maxdigits) maxdigits=lhs->digits;
-
- /* Decide on the result buffer to use; if possible place directly */
- /* into result. */
- acc=res->lsu; /* assume add direct to result */
- /* If destructive overlap, or the number is too long, or a carry or */
- /* borrow to DIGITS+1 might be possible, a buffer must be used. */
- /* [Might be worth more sophisticated tests when maxdigits==reqdigits] */
- if ((maxdigits>=reqdigits) /* is, or could be, too large */
- || (res==rhs && rhsshift>0)) { /* destructive overlap */
- /* buffer needed, choose it; units for maxdigits digits will be */
- /* needed, +1 Unit for carry or borrow */
- Int need=D2U(maxdigits)+1;
- acc=accbuff; /* assume use local buffer */
- if (need*sizeof(Unit)>sizeof(accbuff)) {
- /* printf("malloc add %ld %ld\n", need, sizeof(accbuff)); */
- allocacc=(Unit *)malloc(need*sizeof(Unit));
- if (allocacc==NULL) { /* hopeless -- abandon */
- *status|=DEC_Insufficient_storage;
- break;}
- acc=allocacc;
- }
- }
-
- res->bits=(uByte)(bits&DECNEG); /* it's now safe to overwrite.. */
- res->exponent=lhs->exponent; /* .. operands (even if aliased) */
-
- #if DECTRACE
- decDumpAr('A', lhs->lsu, D2U(lhs->digits));
- decDumpAr('B', rhs->lsu, D2U(rhs->digits));
- printf(" :h: %ld %ld\n", rhsshift, mult);
- #endif
-
- /* add [A+B*m] or subtract [A+B*(-m)] */
- U_ASSERT(rhs->digits > 0);
- U_ASSERT(lhs->digits > 0);
- res->digits=decUnitAddSub(lhs->lsu, D2U(lhs->digits),
- rhs->lsu, D2U(rhs->digits),
- rhsshift, acc, mult)
- *DECDPUN; /* [units -> digits] */
- if (res->digits<0) { /* borrowed... */
- res->digits=-res->digits;
- res->bits^=DECNEG; /* flip the sign */
- }
- #if DECTRACE
- decDumpAr('+', acc, D2U(res->digits));
- #endif
-
- /* If a buffer was used the result must be copied back, possibly */
- /* shortening. (If no buffer was used then the result must have */
- /* fit, so can't need rounding and residue must be 0.) */
- residue=0; /* clear accumulator */
- if (acc!=res->lsu) {
- #if DECSUBSET
- if (set->extended) { /* round from first significant digit */
- #endif
- /* remove leading zeros that were added due to rounding up to */
- /* integral Units -- before the test for rounding. */
- if (res->digits>reqdigits)
- res->digits=decGetDigits(acc, D2U(res->digits));
- decSetCoeff(res, set, acc, res->digits, &residue, status);
- #if DECSUBSET
- }
- else { /* subset arithmetic rounds from original significant digit */
- /* May have an underestimate. This only occurs when both */
- /* numbers fit in DECDPUN digits and are padding with a */
- /* negative multiple (-10, -100...) and the top digit(s) become */
- /* 0. (This only matters when using X3.274 rules where the */
- /* leading zero could be included in the rounding.) */
- if (res->digits<maxdigits) {
- *(acc+D2U(res->digits))=0; /* ensure leading 0 is there */
- res->digits=maxdigits;
- }
- else {
- /* remove leading zeros that added due to rounding up to */
- /* integral Units (but only those in excess of the original */
- /* maxdigits length, unless extended) before test for rounding. */
- if (res->digits>reqdigits) {
- res->digits=decGetDigits(acc, D2U(res->digits));
- if (res->digits<maxdigits) res->digits=maxdigits;
- }
- }
- decSetCoeff(res, set, acc, res->digits, &residue, status);
- /* Now apply rounding if needed before removing leading zeros. */
- /* This is safe because subnormals are not a possibility */
- if (residue!=0) {
- decApplyRound(res, set, residue, status);
- residue=0; /* did what needed to be done */
- }
- } /* subset */
- #endif
- } /* used buffer */
-
- /* strip leading zeros [these were left on in case of subset subtract] */
- res->digits=decGetDigits(res->lsu, D2U(res->digits));
-
- /* apply checks and rounding */
- decFinish(res, set, &residue, status);
-
- /* "When the sum of two operands with opposite signs is exactly */
- /* zero, the sign of that sum shall be '+' in all rounding modes */
- /* except round toward -Infinity, in which mode that sign shall be */
- /* '-'." [Subset zeros also never have '-', set by decFinish.] */
- if (ISZERO(res) && diffsign
- #if DECSUBSET
- && set->extended
- #endif
- && (*status&DEC_Inexact)==0) {
- if (set->round==DEC_ROUND_FLOOR) res->bits|=DECNEG; /* sign - */
- else res->bits&=~DECNEG; /* sign + */
- }
- } while(0); /* end protected */
-
- if (allocacc!=NULL) free(allocacc); /* drop any storage used */
- #if DECSUBSET
- if (allocrhs!=NULL) free(allocrhs); /* .. */
- if (alloclhs!=NULL) free(alloclhs); /* .. */
- #endif
- return res;
- } /* decAddOp */
-
-/* ------------------------------------------------------------------ */
-/* decDivideOp -- division operation */
-/* */
-/* This routine performs the calculations for all four division */
-/* operators (divide, divideInteger, remainder, remainderNear). */
-/* */
-/* C=A op B */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X/X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* op is DIVIDE, DIVIDEINT, REMAINDER, or REMNEAR respectively. */
-/* status is the usual accumulator */
-/* */
-/* C must have space for set->digits digits. */
-/* */
-/* ------------------------------------------------------------------ */
-/* The underlying algorithm of this routine is the same as in the */
-/* 1981 S/370 implementation, that is, non-restoring long division */
-/* with bi-unit (rather than bi-digit) estimation for each unit */
-/* multiplier. In this pseudocode overview, complications for the */
-/* Remainder operators and division residues for exact rounding are */
-/* omitted for clarity. */
-/* */
-/* Prepare operands and handle special values */
-/* Test for x/0 and then 0/x */
-/* Exp =Exp1 - Exp2 */
-/* Exp =Exp +len(var1) -len(var2) */
-/* Sign=Sign1 * Sign2 */
-/* Pad accumulator (Var1) to double-length with 0's (pad1) */
-/* Pad Var2 to same length as Var1 */
-/* msu2pair/plus=1st 2 or 1 units of var2, +1 to allow for round */
-/* have=0 */
-/* Do until (have=digits+1 OR residue=0) */
-/* if exp<0 then if integer divide/residue then leave */
-/* this_unit=0 */
-/* Do forever */
-/* compare numbers */
-/* if <0 then leave inner_loop */
-/* if =0 then (* quick exit without subtract *) do */
-/* this_unit=this_unit+1; output this_unit */
-/* leave outer_loop; end */
-/* Compare lengths of numbers (mantissae): */
-/* If same then tops2=msu2pair -- {units 1&2 of var2} */
-/* else tops2=msu2plus -- {0, unit 1 of var2} */
-/* tops1=first_unit_of_Var1*10**DECDPUN +second_unit_of_var1 */
-/* mult=tops1/tops2 -- Good and safe guess at divisor */
-/* if mult=0 then mult=1 */
-/* this_unit=this_unit+mult */
-/* subtract */
-/* end inner_loop */
-/* if have\=0 | this_unit\=0 then do */
-/* output this_unit */
-/* have=have+1; end */
-/* var2=var2/10 */
-/* exp=exp-1 */
-/* end outer_loop */
-/* exp=exp+1 -- set the proper exponent */
-/* if have=0 then generate answer=0 */
-/* Return (Result is defined by Var1) */
-/* */
-/* ------------------------------------------------------------------ */
-/* Two working buffers are needed during the division; one (digits+ */
-/* 1) to accumulate the result, and the other (up to 2*digits+1) for */
-/* long subtractions. These are acc and var1 respectively. */
-/* var1 is a copy of the lhs coefficient, var2 is the rhs coefficient.*/
-/* The static buffers may be larger than might be expected to allow */
-/* for calls from higher-level funtions (notable exp). */
-/* ------------------------------------------------------------------ */
-static decNumber * decDivideOp(decNumber *res,
- const decNumber *lhs, const decNumber *rhs,
- decContext *set, Flag op, uInt *status) {
- #if DECSUBSET
- decNumber *alloclhs=NULL; /* non-NULL if rounded lhs allocated */
- decNumber *allocrhs=NULL; /* .., rhs */
- #endif
- Unit accbuff[SD2U(DECBUFFER+DECDPUN+10)]; /* local buffer */
- Unit *acc=accbuff; /* -> accumulator array for result */
- Unit *allocacc=NULL; /* -> allocated buffer, iff allocated */
- Unit *accnext; /* -> where next digit will go */
- Int acclength; /* length of acc needed [Units] */
- Int accunits; /* count of units accumulated */
- Int accdigits; /* count of digits accumulated */
-
- Unit varbuff[SD2U(DECBUFFER*2+DECDPUN)]; /* buffer for var1 */
- Unit *var1=varbuff; /* -> var1 array for long subtraction */
- Unit *varalloc=NULL; /* -> allocated buffer, iff used */
- Unit *msu1; /* -> msu of var1 */
-
- const Unit *var2; /* -> var2 array */
- const Unit *msu2; /* -> msu of var2 */
- Int msu2plus; /* msu2 plus one [does not vary] */
- eInt msu2pair; /* msu2 pair plus one [does not vary] */
-
- Int var1units, var2units; /* actual lengths */
- Int var2ulen; /* logical length (units) */
- Int var1initpad=0; /* var1 initial padding (digits) */
- Int maxdigits; /* longest LHS or required acc length */
- Int mult; /* multiplier for subtraction */
- Unit thisunit; /* current unit being accumulated */
- Int residue; /* for rounding */
- Int reqdigits=set->digits; /* requested DIGITS */
- Int exponent; /* working exponent */
- Int maxexponent=0; /* DIVIDE maximum exponent if unrounded */
- uByte bits; /* working sign */
- Unit *target; /* work */
- const Unit *source; /* .. */
- uInt const *pow; /* .. */
- Int shift, cut; /* .. */
- #if DECSUBSET
- Int dropped; /* work */
- #endif
-
- #if DECCHECK
- if (decCheckOperands(res, lhs, rhs, set)) return res;
- #endif
-
- do { /* protect allocated storage */
- #if DECSUBSET
- if (!set->extended) {
- /* reduce operands and set lostDigits status, as needed */
- if (lhs->digits>reqdigits) {
- alloclhs=decRoundOperand(lhs, set, status);
- if (alloclhs==NULL) break;
- lhs=alloclhs;
- }
- if (rhs->digits>reqdigits) {
- allocrhs=decRoundOperand(rhs, set, status);
- if (allocrhs==NULL) break;
- rhs=allocrhs;
- }
- }
- #endif
- /* [following code does not require input rounding] */
-
- bits=(lhs->bits^rhs->bits)&DECNEG; /* assumed sign for divisions */
-
- /* handle infinities and NaNs */
- if (SPECIALARGS) { /* a special bit set */
- if (SPECIALARGS & (DECSNAN | DECNAN)) { /* one or two NaNs */
- decNaNs(res, lhs, rhs, set, status);
- break;
- }
- /* one or two infinities */
- if (decNumberIsInfinite(lhs)) { /* LHS (dividend) is infinite */
- if (decNumberIsInfinite(rhs) || /* two infinities are invalid .. */
- op & (REMAINDER | REMNEAR)) { /* as is remainder of infinity */
- *status|=DEC_Invalid_operation;
- break;
- }
- /* [Note that infinity/0 raises no exceptions] */
- uprv_decNumberZero(res);
- res->bits=bits|DECINF; /* set +/- infinity */
- break;
- }
- else { /* RHS (divisor) is infinite */
- residue=0;
- if (op&(REMAINDER|REMNEAR)) {
- /* result is [finished clone of] lhs */
- decCopyFit(res, lhs, set, &residue, status);
- }
- else { /* a division */
- uprv_decNumberZero(res);
- res->bits=bits; /* set +/- zero */
- /* for DIVIDEINT the exponent is always 0. For DIVIDE, result */
- /* is a 0 with infinitely negative exponent, clamped to minimum */
- if (op&DIVIDE) {
- res->exponent=set->emin-set->digits+1;
- *status|=DEC_Clamped;
- }
- }
- decFinish(res, set, &residue, status);
- break;
- }
- }
-
- /* handle 0 rhs (x/0) */
- if (ISZERO(rhs)) { /* x/0 is always exceptional */
- if (ISZERO(lhs)) {
- uprv_decNumberZero(res); /* [after lhs test] */
- *status|=DEC_Division_undefined;/* 0/0 will become NaN */
- }
- else {
- uprv_decNumberZero(res);
- if (op&(REMAINDER|REMNEAR)) *status|=DEC_Invalid_operation;
- else {
- *status|=DEC_Division_by_zero; /* x/0 */
- res->bits=bits|DECINF; /* .. is +/- Infinity */
- }
- }
- break;}
-
- /* handle 0 lhs (0/x) */
- if (ISZERO(lhs)) { /* 0/x [x!=0] */
- #if DECSUBSET
- if (!set->extended) uprv_decNumberZero(res);
- else {
- #endif
- if (op&DIVIDE) {
- residue=0;
- exponent=lhs->exponent-rhs->exponent; /* ideal exponent */
- uprv_decNumberCopy(res, lhs); /* [zeros always fit] */
- res->bits=bits; /* sign as computed */
- res->exponent=exponent; /* exponent, too */
- decFinalize(res, set, &residue, status); /* check exponent */
- }
- else if (op&DIVIDEINT) {
- uprv_decNumberZero(res); /* integer 0 */
- res->bits=bits; /* sign as computed */
- }
- else { /* a remainder */
- exponent=rhs->exponent; /* [save in case overwrite] */
- uprv_decNumberCopy(res, lhs); /* [zeros always fit] */
- if (exponent<res->exponent) res->exponent=exponent; /* use lower */
- }
- #if DECSUBSET
- }
- #endif
- break;}
-
- /* Precalculate exponent. This starts off adjusted (and hence fits */
- /* in 31 bits) and becomes the usual unadjusted exponent as the */
- /* division proceeds. The order of evaluation is important, here, */
- /* to avoid wrap. */
- exponent=(lhs->exponent+lhs->digits)-(rhs->exponent+rhs->digits);
-
- /* If the working exponent is -ve, then some quick exits are */
- /* possible because the quotient is known to be <1 */
- /* [for REMNEAR, it needs to be < -1, as -0.5 could need work] */
- if (exponent<0 && !(op==DIVIDE)) {
- if (op&DIVIDEINT) {
- uprv_decNumberZero(res); /* integer part is 0 */
- #if DECSUBSET
- if (set->extended)
- #endif
- res->bits=bits; /* set +/- zero */
- break;}
- /* fastpath remainders so long as the lhs has the smaller */
- /* (or equal) exponent */
- if (lhs->exponent<=rhs->exponent) {
- if (op&REMAINDER || exponent<-1) {
- /* It is REMAINDER or safe REMNEAR; result is [finished */
- /* clone of] lhs (r = x - 0*y) */
- residue=0;
- decCopyFit(res, lhs, set, &residue, status);
- decFinish(res, set, &residue, status);
- break;
- }
- /* [unsafe REMNEAR drops through] */
- }
- } /* fastpaths */
-
- /* Long (slow) division is needed; roll up the sleeves... */
-
- /* The accumulator will hold the quotient of the division. */
- /* If it needs to be too long for stack storage, then allocate. */
- acclength=D2U(reqdigits+DECDPUN); /* in Units */
- if (acclength*sizeof(Unit)>sizeof(accbuff)) {
- /* printf("malloc dvacc %ld units\n", acclength); */
- allocacc=(Unit *)malloc(acclength*sizeof(Unit));
- if (allocacc==NULL) { /* hopeless -- abandon */
- *status|=DEC_Insufficient_storage;
- break;}
- acc=allocacc; /* use the allocated space */
- }
-
- /* var1 is the padded LHS ready for subtractions. */
- /* If it needs to be too long for stack storage, then allocate. */
- /* The maximum units needed for var1 (long subtraction) is: */
- /* Enough for */
- /* (rhs->digits+reqdigits-1) -- to allow full slide to right */
- /* or (lhs->digits) -- to allow for long lhs */
- /* whichever is larger */
- /* +1 -- for rounding of slide to right */
- /* +1 -- for leading 0s */
- /* +1 -- for pre-adjust if a remainder or DIVIDEINT */
- /* [Note: unused units do not participate in decUnitAddSub data] */
- maxdigits=rhs->digits+reqdigits-1;
- if (lhs->digits>maxdigits) maxdigits=lhs->digits;
- var1units=D2U(maxdigits)+2;
- /* allocate a guard unit above msu1 for REMAINDERNEAR */
- if (!(op&DIVIDE)) var1units++;
- if ((var1units+1)*sizeof(Unit)>sizeof(varbuff)) {
- /* printf("malloc dvvar %ld units\n", var1units+1); */
- varalloc=(Unit *)malloc((var1units+1)*sizeof(Unit));
- if (varalloc==NULL) { /* hopeless -- abandon */
- *status|=DEC_Insufficient_storage;
- break;}
- var1=varalloc; /* use the allocated space */
- }
-
- /* Extend the lhs and rhs to full long subtraction length. The lhs */
- /* is truly extended into the var1 buffer, with 0 padding, so a */
- /* subtract in place is always possible. The rhs (var2) has */
- /* virtual padding (implemented by decUnitAddSub). */
- /* One guard unit was allocated above msu1 for rem=rem+rem in */
- /* REMAINDERNEAR. */
- msu1=var1+var1units-1; /* msu of var1 */
- source=lhs->lsu+D2U(lhs->digits)-1; /* msu of input array */
- for (target=msu1; source>=lhs->lsu; source--, target--) *target=*source;
- for (; target>=var1; target--) *target=0;
-
- /* rhs (var2) is left-aligned with var1 at the start */
- var2ulen=var1units; /* rhs logical length (units) */
- var2units=D2U(rhs->digits); /* rhs actual length (units) */
- var2=rhs->lsu; /* -> rhs array */
- msu2=var2+var2units-1; /* -> msu of var2 [never changes] */
- /* now set up the variables which will be used for estimating the */
- /* multiplication factor. If these variables are not exact, add */
- /* 1 to make sure that the multiplier is never overestimated. */
- msu2plus=*msu2; /* it's value .. */
- if (var2units>1) msu2plus++; /* .. +1 if any more */
- msu2pair=(eInt)*msu2*(DECDPUNMAX+1);/* top two pair .. */
- if (var2units>1) { /* .. [else treat 2nd as 0] */
- msu2pair+=*(msu2-1); /* .. */
- if (var2units>2) msu2pair++; /* .. +1 if any more */
- }
-
- /* The calculation is working in units, which may have leading zeros, */
- /* but the exponent was calculated on the assumption that they are */
- /* both left-aligned. Adjust the exponent to compensate: add the */
- /* number of leading zeros in var1 msu and subtract those in var2 msu. */
- /* [This is actually done by counting the digits and negating, as */
- /* lead1=DECDPUN-digits1, and similarly for lead2.] */
- for (pow=&powers[1]; *msu1>=*pow; pow++) exponent--;
- for (pow=&powers[1]; *msu2>=*pow; pow++) exponent++;
-
- /* Now, if doing an integer divide or remainder, ensure that */
- /* the result will be Unit-aligned. To do this, shift the var1 */
- /* accumulator towards least if need be. (It's much easier to */
- /* do this now than to reassemble the residue afterwards, if */
- /* doing a remainder.) Also ensure the exponent is not negative. */
- if (!(op&DIVIDE)) {
- Unit *u; /* work */
- /* save the initial 'false' padding of var1, in digits */
- var1initpad=(var1units-D2U(lhs->digits))*DECDPUN;
- /* Determine the shift to do. */
- if (exponent<0) cut=-exponent;
- else cut=DECDPUN-exponent%DECDPUN;
- decShiftToLeast(var1, var1units, cut);
- exponent+=cut; /* maintain numerical value */
- var1initpad-=cut; /* .. and reduce padding */
- /* clean any most-significant units which were just emptied */
- for (u=msu1; cut>=DECDPUN; cut-=DECDPUN, u--) *u=0;
- } /* align */
- else { /* is DIVIDE */
- maxexponent=lhs->exponent-rhs->exponent; /* save */
- /* optimization: if the first iteration will just produce 0, */
- /* preadjust to skip it [valid for DIVIDE only] */
- if (*msu1<*msu2) {
- var2ulen--; /* shift down */
- exponent-=DECDPUN; /* update the exponent */
- }
- }
-
- /* ---- start the long-division loops ------------------------------ */
- accunits=0; /* no units accumulated yet */
- accdigits=0; /* .. or digits */
- accnext=acc+acclength-1; /* -> msu of acc [NB: allows digits+1] */
- for (;;) { /* outer forever loop */
- thisunit=0; /* current unit assumed 0 */
- /* find the next unit */
- for (;;) { /* inner forever loop */
- /* strip leading zero units [from either pre-adjust or from */
- /* subtract last time around]. Leave at least one unit. */
- for (; *msu1==0 && msu1>var1; msu1--) var1units--;
-
- if (var1units<var2ulen) break; /* var1 too low for subtract */
- if (var1units==var2ulen) { /* unit-by-unit compare needed */
- /* compare the two numbers, from msu */
- const Unit *pv1, *pv2;
- Unit v2; /* units to compare */
- pv2=msu2; /* -> msu */
- for (pv1=msu1; ; pv1--, pv2--) {
- /* v1=*pv1 -- always OK */
- v2=0; /* assume in padding */
- if (pv2>=var2) v2=*pv2; /* in range */
- if (*pv1!=v2) break; /* no longer the same */
- if (pv1==var1) break; /* done; leave pv1 as is */
- }
- /* here when all inspected or a difference seen */
- if (*pv1<v2) break; /* var1 too low to subtract */
- if (*pv1==v2) { /* var1 == var2 */
- /* reach here if var1 and var2 are identical; subtraction */
- /* would increase digit by one, and the residue will be 0 so */
- /* the calculation is done; leave the loop with residue=0. */
- thisunit++; /* as though subtracted */
- *var1=0; /* set var1 to 0 */
- var1units=1; /* .. */
- break; /* from inner */
- } /* var1 == var2 */
- /* *pv1>v2. Prepare for real subtraction; the lengths are equal */
- /* Estimate the multiplier (there's always a msu1-1)... */
- /* Bring in two units of var2 to provide a good estimate. */
- mult=(Int)(((eInt)*msu1*(DECDPUNMAX+1)+*(msu1-1))/msu2pair);
- } /* lengths the same */
- else { /* var1units > var2ulen, so subtraction is safe */
- /* The var2 msu is one unit towards the lsu of the var1 msu, */
- /* so only one unit for var2 can be used. */
- mult=(Int)(((eInt)*msu1*(DECDPUNMAX+1)+*(msu1-1))/msu2plus);
- }
- if (mult==0) mult=1; /* must always be at least 1 */
- /* subtraction needed; var1 is > var2 */
- thisunit=(Unit)(thisunit+mult); /* accumulate */
- /* subtract var1-var2, into var1; only the overlap needs */
- /* processing, as this is an in-place calculation */
- shift=var2ulen-var2units;
- #if DECTRACE
- decDumpAr('1', &var1[shift], var1units-shift);
- decDumpAr('2', var2, var2units);
- printf("m=%ld\n", -mult);
- #endif
- decUnitAddSub(&var1[shift], var1units-shift,
- var2, var2units, 0,
- &var1[shift], -mult);
- #if DECTRACE
- decDumpAr('#', &var1[shift], var1units-shift);
- #endif
- /* var1 now probably has leading zeros; these are removed at the */
- /* top of the inner loop. */
- } /* inner loop */
-
- /* The next unit has been calculated in full; unless it's a */
- /* leading zero, add to acc */
- if (accunits!=0 || thisunit!=0) { /* is first or non-zero */
- *accnext=thisunit; /* store in accumulator */
- /* account exactly for the new digits */
- if (accunits==0) {
- accdigits++; /* at least one */
- for (pow=&powers[1]; thisunit>=*pow; pow++) accdigits++;
- }
- else accdigits+=DECDPUN;
- accunits++; /* update count */
- accnext--; /* ready for next */
- if (accdigits>reqdigits) break; /* have enough digits */
- }
-
- /* if the residue is zero, the operation is done (unless divide */
- /* or divideInteger and still not enough digits yet) */
- if (*var1==0 && var1units==1) { /* residue is 0 */
- if (op&(REMAINDER|REMNEAR)) break;
- if ((op&DIVIDE) && (exponent<=maxexponent)) break;
- /* [drop through if divideInteger] */
- }
- /* also done enough if calculating remainder or integer */
- /* divide and just did the last ('units') unit */
- if (exponent==0 && !(op&DIVIDE)) break;
-
- /* to get here, var1 is less than var2, so divide var2 by the per- */
- /* Unit power of ten and go for the next digit */
- var2ulen--; /* shift down */
- exponent-=DECDPUN; /* update the exponent */
- } /* outer loop */
-
- /* ---- division is complete --------------------------------------- */
- /* here: acc has at least reqdigits+1 of good results (or fewer */
- /* if early stop), starting at accnext+1 (its lsu) */
- /* var1 has any residue at the stopping point */
- /* accunits is the number of digits collected in acc */
- if (accunits==0) { /* acc is 0 */
- accunits=1; /* show have a unit .. */
- accdigits=1; /* .. */
- *accnext=0; /* .. whose value is 0 */
- }
- else accnext++; /* back to last placed */
- /* accnext now -> lowest unit of result */
-
- residue=0; /* assume no residue */
- if (op&DIVIDE) {
- /* record the presence of any residue, for rounding */
- if (*var1!=0 || var1units>1) residue=1;
- else { /* no residue */
- /* Had an exact division; clean up spurious trailing 0s. */
- /* There will be at most DECDPUN-1, from the final multiply, */
- /* and then only if the result is non-0 (and even) and the */
- /* exponent is 'loose'. */
- #if DECDPUN>1
- Unit lsu=*accnext;
- if (!(lsu&0x01) && (lsu!=0)) {
- /* count the trailing zeros */
- Int drop=0;
- for (;; drop++) { /* [will terminate because lsu!=0] */
- if (exponent>=maxexponent) break; /* don't chop real 0s */
- #if DECDPUN<=4
- if ((lsu-QUOT10(lsu, drop+1)
- *powers[drop+1])!=0) break; /* found non-0 digit */
- #else
- if (lsu%powers[drop+1]!=0) break; /* found non-0 digit */
- #endif
- exponent++;
- }
- if (drop>0) {
- accunits=decShiftToLeast(accnext, accunits, drop);
- accdigits=decGetDigits(accnext, accunits);
- accunits=D2U(accdigits);
- /* [exponent was adjusted in the loop] */
- }
- } /* neither odd nor 0 */
- #endif
- } /* exact divide */
- } /* divide */
- else /* op!=DIVIDE */ {
- /* check for coefficient overflow */
- if (accdigits+exponent>reqdigits) {
- *status|=DEC_Division_impossible;
- break;
- }
- if (op & (REMAINDER|REMNEAR)) {
- /* [Here, the exponent will be 0, because var1 was adjusted */
- /* appropriately.] */
- Int postshift; /* work */
- Flag wasodd=0; /* integer was odd */
- Unit *quotlsu; /* for save */
- Int quotdigits; /* .. */
-
- bits=lhs->bits; /* remainder sign is always as lhs */
-
- /* Fastpath when residue is truly 0 is worthwhile [and */
- /* simplifies the code below] */
- if (*var1==0 && var1units==1) { /* residue is 0 */
- Int exp=lhs->exponent; /* save min(exponents) */
- if (rhs->exponent<exp) exp=rhs->exponent;
- uprv_decNumberZero(res); /* 0 coefficient */
- #if DECSUBSET
- if (set->extended)
- #endif
- res->exponent=exp; /* .. with proper exponent */
- res->bits=(uByte)(bits&DECNEG); /* [cleaned] */
- decFinish(res, set, &residue, status); /* might clamp */
- break;
- }
- /* note if the quotient was odd */
- if (*accnext & 0x01) wasodd=1; /* acc is odd */
- quotlsu=accnext; /* save in case need to reinspect */
- quotdigits=accdigits; /* .. */
-
- /* treat the residue, in var1, as the value to return, via acc */
- /* calculate the unused zero digits. This is the smaller of: */
- /* var1 initial padding (saved above) */
- /* var2 residual padding, which happens to be given by: */
- postshift=var1initpad+exponent-lhs->exponent+rhs->exponent;
- /* [the 'exponent' term accounts for the shifts during divide] */
- if (var1initpad<postshift) postshift=var1initpad;
-
- /* shift var1 the requested amount, and adjust its digits */
- var1units=decShiftToLeast(var1, var1units, postshift);
- accnext=var1;
- accdigits=decGetDigits(var1, var1units);
- accunits=D2U(accdigits);
-
- exponent=lhs->exponent; /* exponent is smaller of lhs & rhs */
- if (rhs->exponent<exponent) exponent=rhs->exponent;
-
- /* Now correct the result if doing remainderNear; if it */
- /* (looking just at coefficients) is > rhs/2, or == rhs/2 and */
- /* the integer was odd then the result should be rem-rhs. */
- if (op&REMNEAR) {
- Int compare, tarunits; /* work */
- Unit *up; /* .. */
- /* calculate remainder*2 into the var1 buffer (which has */
- /* 'headroom' of an extra unit and hence enough space) */
- /* [a dedicated 'double' loop would be faster, here] */
- tarunits=decUnitAddSub(accnext, accunits, accnext, accunits,
- 0, accnext, 1);
- /* decDumpAr('r', accnext, tarunits); */
-
- /* Here, accnext (var1) holds tarunits Units with twice the */
- /* remainder's coefficient, which must now be compared to the */
- /* RHS. The remainder's exponent may be smaller than the RHS's. */
- compare=decUnitCompare(accnext, tarunits, rhs->lsu, D2U(rhs->digits),
- rhs->exponent-exponent);
- if (compare==BADINT) { /* deep trouble */
- *status|=DEC_Insufficient_storage;
- break;}
-
- /* now restore the remainder by dividing by two; the lsu */
- /* is known to be even. */
- for (up=accnext; up<accnext+tarunits; up++) {
- Int half; /* half to add to lower unit */
- half=*up & 0x01;
- *up/=2; /* [shift] */
- if (!half) continue;
- *(up-1)+=(DECDPUNMAX+1)/2;
- }
- /* [accunits still describes the original remainder length] */
-
- if (compare>0 || (compare==0 && wasodd)) { /* adjustment needed */
- Int exp, expunits, exprem; /* work */
- /* This is effectively causing round-up of the quotient, */
- /* so if it was the rare case where it was full and all */
- /* nines, it would overflow and hence division-impossible */
- /* should be raised */
- Flag allnines=0; /* 1 if quotient all nines */
- if (quotdigits==reqdigits) { /* could be borderline */
- for (up=quotlsu; ; up++) {
- if (quotdigits>DECDPUN) {
- if (*up!=DECDPUNMAX) break;/* non-nines */
- }
- else { /* this is the last Unit */
- if (*up==powers[quotdigits]-1) allnines=1;
- break;
- }
- quotdigits-=DECDPUN; /* checked those digits */
- } /* up */
- } /* borderline check */
- if (allnines) {
- *status|=DEC_Division_impossible;
- break;}
-
- /* rem-rhs is needed; the sign will invert. Again, var1 */
- /* can safely be used for the working Units array. */
- exp=rhs->exponent-exponent; /* RHS padding needed */
- /* Calculate units and remainder from exponent. */
- expunits=exp/DECDPUN;
- exprem=exp%DECDPUN;
- /* subtract [A+B*(-m)]; the result will always be negative */
- accunits=-decUnitAddSub(accnext, accunits,
- rhs->lsu, D2U(rhs->digits),
- expunits, accnext, -(Int)powers[exprem]);
- accdigits=decGetDigits(accnext, accunits); /* count digits exactly */
- accunits=D2U(accdigits); /* and recalculate the units for copy */
- /* [exponent is as for original remainder] */
- bits^=DECNEG; /* flip the sign */
- }
- } /* REMNEAR */
- } /* REMAINDER or REMNEAR */
- } /* not DIVIDE */
-
- /* Set exponent and bits */
- res->exponent=exponent;
- res->bits=(uByte)(bits&DECNEG); /* [cleaned] */
-
- /* Now the coefficient. */
- decSetCoeff(res, set, accnext, accdigits, &residue, status);
-
- decFinish(res, set, &residue, status); /* final cleanup */
-
- #if DECSUBSET
- /* If a divide then strip trailing zeros if subset [after round] */
- if (!set->extended && (op==DIVIDE)) decTrim(res, set, 0, 1, &dropped);
- #endif
- } while(0); /* end protected */
-
- if (varalloc!=NULL) free(varalloc); /* drop any storage used */
- if (allocacc!=NULL) free(allocacc); /* .. */
- #if DECSUBSET
- if (allocrhs!=NULL) free(allocrhs); /* .. */
- if (alloclhs!=NULL) free(alloclhs); /* .. */
- #endif
- return res;
- } /* decDivideOp */
-
-/* ------------------------------------------------------------------ */
-/* decMultiplyOp -- multiplication operation */
-/* */
-/* This routine performs the multiplication C=A x B. */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X*X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* status is the usual accumulator */
-/* */
-/* C must have space for set->digits digits. */
-/* */
-/* ------------------------------------------------------------------ */
-/* 'Classic' multiplication is used rather than Karatsuba, as the */
-/* latter would give only a minor improvement for the short numbers */
-/* expected to be handled most (and uses much more memory). */
-/* */
-/* There are two major paths here: the general-purpose ('old code') */
-/* path which handles all DECDPUN values, and a fastpath version */
-/* which is used if 64-bit ints are available, DECDPUN<=4, and more */
-/* than two calls to decUnitAddSub would be made. */
-/* */
-/* The fastpath version lumps units together into 8-digit or 9-digit */
-/* chunks, and also uses a lazy carry strategy to minimise expensive */
-/* 64-bit divisions. The chunks are then broken apart again into */
-/* units for continuing processing. Despite this overhead, the */
-/* fastpath can speed up some 16-digit operations by 10x (and much */
-/* more for higher-precision calculations). */
-/* */
-/* A buffer always has to be used for the accumulator; in the */
-/* fastpath, buffers are also always needed for the chunked copies of */
-/* of the operand coefficients. */
-/* Static buffers are larger than needed just for multiply, to allow */
-/* for calls from other operations (notably exp). */
-/* ------------------------------------------------------------------ */
-#define FASTMUL (DECUSE64 && DECDPUN<5)
-static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set,
- uInt *status) {
- Int accunits; /* Units of accumulator in use */
- Int exponent; /* work */
- Int residue=0; /* rounding residue */
- uByte bits; /* result sign */
- Unit *acc; /* -> accumulator Unit array */
- Int needbytes; /* size calculator */
- void *allocacc=NULL; /* -> allocated accumulator, iff allocated */
- Unit accbuff[SD2U(DECBUFFER*4+1)]; /* buffer (+1 for DECBUFFER==0, */
- /* *4 for calls from other operations) */
- const Unit *mer, *mermsup; /* work */
- Int madlength; /* Units in multiplicand */
- Int shift; /* Units to shift multiplicand by */
-
- #if FASTMUL
- /* if DECDPUN is 1 or 3 work in base 10**9, otherwise */
- /* (DECDPUN is 2 or 4) then work in base 10**8 */
- #if DECDPUN & 1 /* odd */
- #define FASTBASE 1000000000 /* base */
- #define FASTDIGS 9 /* digits in base */
- #define FASTLAZY 18 /* carry resolution point [1->18] */
- #else
- #define FASTBASE 100000000
- #define FASTDIGS 8
- #define FASTLAZY 1844 /* carry resolution point [1->1844] */
- #endif
- /* three buffers are used, two for chunked copies of the operands */
- /* (base 10**8 or base 10**9) and one base 2**64 accumulator with */
- /* lazy carry evaluation */
- uInt zlhibuff[(DECBUFFER*2+1)/8+1]; /* buffer (+1 for DECBUFFER==0) */
- uInt *zlhi=zlhibuff; /* -> lhs array */
- uInt *alloclhi=NULL; /* -> allocated buffer, iff allocated */
- uInt zrhibuff[(DECBUFFER*2+1)/8+1]; /* buffer (+1 for DECBUFFER==0) */
- uInt *zrhi=zrhibuff; /* -> rhs array */
- uInt *allocrhi=NULL; /* -> allocated buffer, iff allocated */
- uLong zaccbuff[(DECBUFFER*2+1)/4+2]; /* buffer (+1 for DECBUFFER==0) */
- /* [allocacc is shared for both paths, as only one will run] */
- uLong *zacc=zaccbuff; /* -> accumulator array for exact result */
- #if DECDPUN==1
- Int zoff; /* accumulator offset */
- #endif
- uInt *lip, *rip; /* item pointers */
- uInt *lmsi, *rmsi; /* most significant items */
- Int ilhs, irhs, iacc; /* item counts in the arrays */
- Int lazy; /* lazy carry counter */
- uLong lcarry; /* uLong carry */
- uInt carry; /* carry (NB not uLong) */
- Int count; /* work */
- const Unit *cup; /* .. */
- Unit *up; /* .. */
- uLong *lp; /* .. */
- Int p; /* .. */
- #endif
-
- #if DECSUBSET
- decNumber *alloclhs=NULL; /* -> allocated buffer, iff allocated */
- decNumber *allocrhs=NULL; /* -> allocated buffer, iff allocated */
- #endif
-
- #if DECCHECK
- if (decCheckOperands(res, lhs, rhs, set)) return res;
- #endif
-
- /* precalculate result sign */
- bits=(uByte)((lhs->bits^rhs->bits)&DECNEG);
-
- /* handle infinities and NaNs */
- if (SPECIALARGS) { /* a special bit set */
- if (SPECIALARGS & (DECSNAN | DECNAN)) { /* one or two NaNs */
- decNaNs(res, lhs, rhs, set, status);
- return res;}
- /* one or two infinities; Infinity * 0 is invalid */
- if (((lhs->bits & DECINF)==0 && ISZERO(lhs))
- ||((rhs->bits & DECINF)==0 && ISZERO(rhs))) {
- *status|=DEC_Invalid_operation;
- return res;}
- uprv_decNumberZero(res);
- res->bits=bits|DECINF; /* infinity */
- return res;}
-
- /* For best speed, as in DMSRCN [the original Rexx numerics */
- /* module], use the shorter number as the multiplier (rhs) and */
- /* the longer as the multiplicand (lhs) to minimise the number of */
- /* adds (partial products) */
- if (lhs->digits<rhs->digits) { /* swap... */
- const decNumber *hold=lhs;
- lhs=rhs;
- rhs=hold;
- }
-
- do { /* protect allocated storage */
- #if DECSUBSET
- if (!set->extended) {
- /* reduce operands and set lostDigits status, as needed */
- if (lhs->digits>set->digits) {
- alloclhs=decRoundOperand(lhs, set, status);
- if (alloclhs==NULL) break;
- lhs=alloclhs;
- }
- if (rhs->digits>set->digits) {
- allocrhs=decRoundOperand(rhs, set, status);
- if (allocrhs==NULL) break;
- rhs=allocrhs;
- }
- }
- #endif
- /* [following code does not require input rounding] */
-
- #if FASTMUL /* fastpath can be used */
- /* use the fast path if there are enough digits in the shorter */
- /* operand to make the setup and takedown worthwhile */
- #define NEEDTWO (DECDPUN*2) /* within two decUnitAddSub calls */
- if (rhs->digits>NEEDTWO) { /* use fastpath... */
- /* calculate the number of elements in each array */
- ilhs=(lhs->digits+FASTDIGS-1)/FASTDIGS; /* [ceiling] */
- irhs=(rhs->digits+FASTDIGS-1)/FASTDIGS; /* .. */
- iacc=ilhs+irhs;
-
- /* allocate buffers if required, as usual */
- needbytes=ilhs*sizeof(uInt);
- if (needbytes>(Int)sizeof(zlhibuff)) {
- alloclhi=(uInt *)malloc(needbytes);
- zlhi=alloclhi;}
- needbytes=irhs*sizeof(uInt);
- if (needbytes>(Int)sizeof(zrhibuff)) {
- allocrhi=(uInt *)malloc(needbytes);
- zrhi=allocrhi;}
-
- /* Allocating the accumulator space needs a special case when */
- /* DECDPUN=1 because when converting the accumulator to Units */
- /* after the multiplication each 8-byte item becomes 9 1-byte */
- /* units. Therefore iacc extra bytes are needed at the front */
- /* (rounded up to a multiple of 8 bytes), and the uLong */
- /* accumulator starts offset the appropriate number of units */
- /* to the right to avoid overwrite during the unchunking. */
-
- /* Make sure no signed int overflow below. This is always true */
- /* if the given numbers have less digits than DEC_MAX_DIGITS. */
- U_ASSERT((uint32_t)iacc <= INT32_MAX/sizeof(uLong));
- needbytes=iacc*sizeof(uLong);
- #if DECDPUN==1
- zoff=(iacc+7)/8; /* items to offset by */
- needbytes+=zoff*8;
- #endif
- if (needbytes>(Int)sizeof(zaccbuff)) {
- allocacc=(uLong *)malloc(needbytes);
- zacc=(uLong *)allocacc;}
- if (zlhi==NULL||zrhi==NULL||zacc==NULL) {
- *status|=DEC_Insufficient_storage;
- break;}
-
- acc=(Unit *)zacc; /* -> target Unit array */
- #if DECDPUN==1
- zacc+=zoff; /* start uLong accumulator to right */
- #endif
-
- /* assemble the chunked copies of the left and right sides */
- for (count=lhs->digits, cup=lhs->lsu, lip=zlhi; count>0; lip++)
- for (p=0, *lip=0; p<FASTDIGS && count>0;
- p+=DECDPUN, cup++, count-=DECDPUN)
- *lip+=*cup*powers[p];
- lmsi=lip-1; /* save -> msi */
- for (count=rhs->digits, cup=rhs->lsu, rip=zrhi; count>0; rip++)
- for (p=0, *rip=0; p<FASTDIGS && count>0;
- p+=DECDPUN, cup++, count-=DECDPUN)
- *rip+=*cup*powers[p];
- rmsi=rip-1; /* save -> msi */
-
- /* zero the accumulator */
- for (lp=zacc; lp<zacc+iacc; lp++) *lp=0;
-
- /* Start the multiplication */
- /* Resolving carries can dominate the cost of accumulating the */
- /* partial products, so this is only done when necessary. */
- /* Each uLong item in the accumulator can hold values up to */
- /* 2**64-1, and each partial product can be as large as */
- /* (10**FASTDIGS-1)**2. When FASTDIGS=9, this can be added to */
- /* itself 18.4 times in a uLong without overflowing, so during */
- /* the main calculation resolution is carried out every 18th */
- /* add -- every 162 digits. Similarly, when FASTDIGS=8, the */
- /* partial products can be added to themselves 1844.6 times in */
- /* a uLong without overflowing, so intermediate carry */
- /* resolution occurs only every 14752 digits. Hence for common */
- /* short numbers usually only the one final carry resolution */
- /* occurs. */
- /* (The count is set via FASTLAZY to simplify experiments to */
- /* measure the value of this approach: a 35% improvement on a */
- /* [34x34] multiply.) */
- lazy=FASTLAZY; /* carry delay count */
- for (rip=zrhi; rip<=rmsi; rip++) { /* over each item in rhs */
- lp=zacc+(rip-zrhi); /* where to add the lhs */
- for (lip=zlhi; lip<=lmsi; lip++, lp++) { /* over each item in lhs */
- *lp+=(uLong)(*lip)*(*rip); /* [this should in-line] */
- } /* lip loop */
- lazy--;
- if (lazy>0 && rip!=rmsi) continue;
- lazy=FASTLAZY; /* reset delay count */
- /* spin up the accumulator resolving overflows */
- for (lp=zacc; lp<zacc+iacc; lp++) {
- if (*lp<FASTBASE) continue; /* it fits */
- lcarry=*lp/FASTBASE; /* top part [slow divide] */
- /* lcarry can exceed 2**32-1, so check again; this check */
- /* and occasional extra divide (slow) is well worth it, as */
- /* it allows FASTLAZY to be increased to 18 rather than 4 */
- /* in the FASTDIGS=9 case */
- if (lcarry<FASTBASE) carry=(uInt)lcarry; /* [usual] */
- else { /* two-place carry [fairly rare] */
- uInt carry2=(uInt)(lcarry/FASTBASE); /* top top part */
- *(lp+2)+=carry2; /* add to item+2 */
- *lp-=((uLong)FASTBASE*FASTBASE*carry2); /* [slow] */
- carry=(uInt)(lcarry-((uLong)FASTBASE*carry2)); /* [inline] */
- }
- *(lp+1)+=carry; /* add to item above [inline] */
- *lp-=((uLong)FASTBASE*carry); /* [inline] */
- } /* carry resolution */
- } /* rip loop */
-
- /* The multiplication is complete; time to convert back into */
- /* units. This can be done in-place in the accumulator and in */
- /* 32-bit operations, because carries were resolved after the */
- /* final add. This needs N-1 divides and multiplies for */
- /* each item in the accumulator (which will become up to N */
- /* units, where 2<=N<=9). */
- for (lp=zacc, up=acc; lp<zacc+iacc; lp++) {
- uInt item=(uInt)*lp; /* decapitate to uInt */
- for (p=0; p<FASTDIGS-DECDPUN; p+=DECDPUN, up++) {
- uInt part=item/(DECDPUNMAX+1);
- *up=(Unit)(item-(part*(DECDPUNMAX+1)));
- item=part;
- } /* p */
- *up=(Unit)item; up++; /* [final needs no division] */
- } /* lp */
- accunits = static_cast<int32_t>(up-acc); /* count of units */
- }
- else { /* here to use units directly, without chunking ['old code'] */
- #endif
-
- /* if accumulator will be too long for local storage, then allocate */
- acc=accbuff; /* -> assume buffer for accumulator */
- needbytes=(D2U(lhs->digits)+D2U(rhs->digits))*sizeof(Unit);
- if (needbytes>(Int)sizeof(accbuff)) {
- allocacc=(Unit *)malloc(needbytes);
- if (allocacc==NULL) {*status|=DEC_Insufficient_storage; break;}
- acc=(Unit *)allocacc; /* use the allocated space */
- }
-
- /* Now the main long multiplication loop */
- /* Unlike the equivalent in the IBM Java implementation, there */
- /* is no advantage in calculating from msu to lsu. So, do it */
- /* by the book, as it were. */
- /* Each iteration calculates ACC=ACC+MULTAND*MULT */
- accunits=1; /* accumulator starts at '0' */
- *acc=0; /* .. (lsu=0) */
- shift=0; /* no multiplicand shift at first */
- madlength=D2U(lhs->digits); /* this won't change */
- mermsup=rhs->lsu+D2U(rhs->digits); /* -> msu+1 of multiplier */
-
- for (mer=rhs->lsu; mer<mermsup; mer++) {
- /* Here, *mer is the next Unit in the multiplier to use */
- /* If non-zero [optimization] add it... */
- if (*mer!=0) accunits=decUnitAddSub(&acc[shift], accunits-shift,
- lhs->lsu, madlength, 0,
- &acc[shift], *mer)
- + shift;
- else { /* extend acc with a 0; it will be used shortly */
- *(acc+accunits)=0; /* [this avoids length of <=0 later] */
- accunits++;
- }
- /* multiply multiplicand by 10**DECDPUN for next Unit to left */
- shift++; /* add this for 'logical length' */
- } /* n */
- #if FASTMUL
- } /* unchunked units */
- #endif
- /* common end-path */
- #if DECTRACE
- decDumpAr('*', acc, accunits); /* Show exact result */
- #endif
-
- /* acc now contains the exact result of the multiplication, */
- /* possibly with a leading zero unit; build the decNumber from */
- /* it, noting if any residue */
- res->bits=bits; /* set sign */
- res->digits=decGetDigits(acc, accunits); /* count digits exactly */
-
- /* There can be a 31-bit wrap in calculating the exponent. */
- /* This can only happen if both input exponents are negative and */
- /* both their magnitudes are large. If there was a wrap, set a */
- /* safe very negative exponent, from which decFinalize() will */
- /* raise a hard underflow shortly. */
- exponent=lhs->exponent+rhs->exponent; /* calculate exponent */
- if (lhs->exponent<0 && rhs->exponent<0 && exponent>0)
- exponent=-2*DECNUMMAXE; /* force underflow */
- res->exponent=exponent; /* OK to overwrite now */
-
-
- /* Set the coefficient. If any rounding, residue records */
- decSetCoeff(res, set, acc, res->digits, &residue, status);
- decFinish(res, set, &residue, status); /* final cleanup */
- } while(0); /* end protected */
-
- if (allocacc!=NULL) free(allocacc); /* drop any storage used */
- #if DECSUBSET
- if (allocrhs!=NULL) free(allocrhs); /* .. */
- if (alloclhs!=NULL) free(alloclhs); /* .. */
- #endif
- #if FASTMUL
- if (allocrhi!=NULL) free(allocrhi); /* .. */
- if (alloclhi!=NULL) free(alloclhi); /* .. */
- #endif
- return res;
- } /* decMultiplyOp */
-
-/* ------------------------------------------------------------------ */
-/* decExpOp -- effect exponentiation */
-/* */
-/* This computes C = exp(A) */
-/* */
-/* res is C, the result. C may be A */
-/* rhs is A */
-/* set is the context; note that rounding mode has no effect */
-/* */
-/* C must have space for set->digits digits. status is updated but */
-/* not set. */
-/* */
-/* Restrictions: */
-/* */
-/* digits, emax, and -emin in the context must be less than */
-/* 2*DEC_MAX_MATH (1999998), and the rhs must be within these */
-/* bounds or a zero. This is an internal routine, so these */
-/* restrictions are contractual and not enforced. */
-/* */
-/* A finite result is rounded using DEC_ROUND_HALF_EVEN; it will */
-/* almost always be correctly rounded, but may be up to 1 ulp in */
-/* error in rare cases. */
-/* */
-/* Finite results will always be full precision and Inexact, except */
-/* when A is a zero or -Infinity (giving 1 or 0 respectively). */
-/* ------------------------------------------------------------------ */
-/* This approach used here is similar to the algorithm described in */
-/* */
-/* Variable Precision Exponential Function, T. E. Hull and */
-/* A. Abrham, ACM Transactions on Mathematical Software, Vol 12 #2, */
-/* pp79-91, ACM, June 1986. */
-/* */
-/* with the main difference being that the iterations in the series */
-/* evaluation are terminated dynamically (which does not require the */
-/* extra variable-precision variables which are expensive in this */
-/* context). */
-/* */
-/* The error analysis in Hull & Abrham's paper applies except for the */
-/* round-off error accumulation during the series evaluation. This */
-/* code does not precalculate the number of iterations and so cannot */
-/* use Horner's scheme. Instead, the accumulation is done at double- */
-/* precision, which ensures that the additions of the terms are exact */
-/* and do not accumulate round-off (and any round-off errors in the */
-/* terms themselves move 'to the right' faster than they can */
-/* accumulate). This code also extends the calculation by allowing, */
-/* in the spirit of other decNumber operators, the input to be more */
-/* precise than the result (the precision used is based on the more */
-/* precise of the input or requested result). */
-/* */
-/* Implementation notes: */
-/* */
-/* 1. This is separated out as decExpOp so it can be called from */
-/* other Mathematical functions (notably Ln) with a wider range */
-/* than normal. In particular, it can handle the slightly wider */
-/* (double) range needed by Ln (which has to be able to calculate */
-/* exp(-x) where x can be the tiniest number (Ntiny). */
-/* */
-/* 2. Normalizing x to be <=0.1 (instead of <=1) reduces loop */
-/* iterations by appoximately a third with additional (although */
-/* diminishing) returns as the range is reduced to even smaller */
-/* fractions. However, h (the power of 10 used to correct the */
-/* result at the end, see below) must be kept <=8 as otherwise */
-/* the final result cannot be computed. Hence the leverage is a */
-/* sliding value (8-h), where potentially the range is reduced */
-/* more for smaller values. */
-/* */
-/* The leverage that can be applied in this way is severely */
-/* limited by the cost of the raise-to-the power at the end, */
-/* which dominates when the number of iterations is small (less */
-/* than ten) or when rhs is short. As an example, the adjustment */
-/* x**10,000,000 needs 31 multiplications, all but one full-width. */
-/* */
-/* 3. The restrictions (especially precision) could be raised with */
-/* care, but the full decNumber range seems very hard within the */
-/* 32-bit limits. */
-/* */
-/* 4. The working precisions for the static buffers are twice the */
-/* obvious size to allow for calls from decNumberPower. */
-/* ------------------------------------------------------------------ */
-decNumber * decExpOp(decNumber *res, const decNumber *rhs,
- decContext *set, uInt *status) {
- uInt ignore=0; /* working status */
- Int h; /* adjusted exponent for 0.xxxx */
- Int p; /* working precision */
- Int residue; /* rounding residue */
- uInt needbytes; /* for space calculations */
- const decNumber *x=rhs; /* (may point to safe copy later) */
- decContext aset, tset, dset; /* working contexts */
- Int comp; /* work */
-
- /* the argument is often copied to normalize it, so (unusually) it */
- /* is treated like other buffers, using DECBUFFER, +1 in case */
- /* DECBUFFER is 0 */
- decNumber bufr[D2N(DECBUFFER*2+1)];
- decNumber *allocrhs=NULL; /* non-NULL if rhs buffer allocated */
-
- /* the working precision will be no more than set->digits+8+1 */
- /* so for on-stack buffers DECBUFFER+9 is used, +1 in case DECBUFFER */
- /* is 0 (and twice that for the accumulator) */
-
- /* buffer for t, term (working precision plus) */
- decNumber buft[D2N(DECBUFFER*2+9+1)];
- decNumber *allocbuft=NULL; /* -> allocated buft, iff allocated */
- decNumber *t=buft; /* term */
- /* buffer for a, accumulator (working precision * 2), at least 9 */
- decNumber bufa[D2N(DECBUFFER*4+18+1)];
- decNumber *allocbufa=NULL; /* -> allocated bufa, iff allocated */
- decNumber *a=bufa; /* accumulator */
- /* decNumber for the divisor term; this needs at most 9 digits */
- /* and so can be fixed size [16 so can use standard context] */
- decNumber bufd[D2N(16)];
- decNumber *d=bufd; /* divisor */
- decNumber numone; /* constant 1 */
-
- #if DECCHECK
- Int iterations=0; /* for later sanity check */
- if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
- #endif
-
- do { /* protect allocated storage */
- if (SPECIALARG) { /* handle infinities and NaNs */
- if (decNumberIsInfinite(rhs)) { /* an infinity */
- if (decNumberIsNegative(rhs)) /* -Infinity -> +0 */
- uprv_decNumberZero(res);
- else uprv_decNumberCopy(res, rhs); /* +Infinity -> self */
- }
- else decNaNs(res, rhs, NULL, set, status); /* a NaN */
- break;}
-
- if (ISZERO(rhs)) { /* zeros -> exact 1 */
- uprv_decNumberZero(res); /* make clean 1 */
- *res->lsu=1; /* .. */
- break;} /* [no status to set] */
-
- /* e**x when 0 < x < 0.66 is < 1+3x/2, hence can fast-path */
- /* positive and negative tiny cases which will result in inexact */
- /* 1. This also allows the later add-accumulate to always be */
- /* exact (because its length will never be more than twice the */
- /* working precision). */
- /* The comparator (tiny) needs just one digit, so use the */
- /* decNumber d for it (reused as the divisor, etc., below); its */
- /* exponent is such that if x is positive it will have */
- /* set->digits-1 zeros between the decimal point and the digit, */
- /* which is 4, and if x is negative one more zero there as the */
- /* more precise result will be of the form 0.9999999 rather than */
- /* 1.0000001. Hence, tiny will be 0.0000004 if digits=7 and x>0 */
- /* or 0.00000004 if digits=7 and x<0. If RHS not larger than */
- /* this then the result will be 1.000000 */
- uprv_decNumberZero(d); /* clean */
- *d->lsu=4; /* set 4 .. */
- d->exponent=-set->digits; /* * 10**(-d) */
- if (decNumberIsNegative(rhs)) d->exponent--; /* negative case */
- comp=decCompare(d, rhs, 1); /* signless compare */
- if (comp==BADINT) {
- *status|=DEC_Insufficient_storage;
- break;}
- if (comp>=0) { /* rhs < d */
- Int shift=set->digits-1;
- uprv_decNumberZero(res); /* set 1 */
- *res->lsu=1; /* .. */
- res->digits=decShiftToMost(res->lsu, 1, shift);
- res->exponent=-shift; /* make 1.0000... */
- *status|=DEC_Inexact | DEC_Rounded; /* .. inexactly */
- break;} /* tiny */
-
- /* set up the context to be used for calculating a, as this is */
- /* used on both paths below */
- uprv_decContextDefault(&aset, DEC_INIT_DECIMAL64);
- /* accumulator bounds are as requested (could underflow) */
- aset.emax=set->emax; /* usual bounds */
- aset.emin=set->emin; /* .. */
- aset.clamp=0; /* and no concrete format */
-
- /* calculate the adjusted (Hull & Abrham) exponent (where the */
- /* decimal point is just to the left of the coefficient msd) */
- h=rhs->exponent+rhs->digits;
- /* if h>8 then 10**h cannot be calculated safely; however, when */
- /* h=8 then exp(|rhs|) will be at least exp(1E+7) which is at */
- /* least 6.59E+4342944, so (due to the restriction on Emax/Emin) */
- /* overflow (or underflow to 0) is guaranteed -- so this case can */
- /* be handled by simply forcing the appropriate excess */
- if (h>8) { /* overflow/underflow */
- /* set up here so Power call below will over or underflow to */
- /* zero; set accumulator to either 2 or 0.02 */
- /* [stack buffer for a is always big enough for this] */
- uprv_decNumberZero(a);
- *a->lsu=2; /* not 1 but < exp(1) */
- if (decNumberIsNegative(rhs)) a->exponent=-2; /* make 0.02 */
- h=8; /* clamp so 10**h computable */
- p=9; /* set a working precision */
- }
- else { /* h<=8 */
- Int maxlever=(rhs->digits>8?1:0);
- /* [could/should increase this for precisions >40 or so, too] */
-
- /* if h is 8, cannot normalize to a lower upper limit because */
- /* the final result will not be computable (see notes above), */
- /* but leverage can be applied whenever h is less than 8. */
- /* Apply as much as possible, up to a MAXLEVER digits, which */
- /* sets the tradeoff against the cost of the later a**(10**h). */
- /* As h is increased, the working precision below also */
- /* increases to compensate for the "constant digits at the */
- /* front" effect. */
- Int lever=MINI(8-h, maxlever); /* leverage attainable */
- Int use=-rhs->digits-lever; /* exponent to use for RHS */
- h+=lever; /* apply leverage selected */
- if (h<0) { /* clamp */
- use+=h; /* [may end up subnormal] */
- h=0;
- }
- /* Take a copy of RHS if it needs normalization (true whenever x>=1) */
- if (rhs->exponent!=use) {
- decNumber *newrhs=bufr; /* assume will fit on stack */
- needbytes=sizeof(decNumber)+(D2U(rhs->digits)-1)*sizeof(Unit);
- if (needbytes>sizeof(bufr)) { /* need malloc space */
- allocrhs=(decNumber *)malloc(needbytes);
- if (allocrhs==NULL) { /* hopeless -- abandon */
- *status|=DEC_Insufficient_storage;
- break;}
- newrhs=allocrhs; /* use the allocated space */
- }
- uprv_decNumberCopy(newrhs, rhs); /* copy to safe space */
- newrhs->exponent=use; /* normalize; now <1 */
- x=newrhs; /* ready for use */
- /* decNumberShow(x); */
- }
-
- /* Now use the usual power series to evaluate exp(x). The */
- /* series starts as 1 + x + x^2/2 ... so prime ready for the */
- /* third term by setting the term variable t=x, the accumulator */
- /* a=1, and the divisor d=2. */
-
- /* First determine the working precision. From Hull & Abrham */
- /* this is set->digits+h+2. However, if x is 'over-precise' we */
- /* need to allow for all its digits to potentially participate */
- /* (consider an x where all the excess digits are 9s) so in */
- /* this case use x->digits+h+2 */
- p=MAXI(x->digits, set->digits)+h+2; /* [h<=8] */
-
- /* a and t are variable precision, and depend on p, so space */
- /* must be allocated for them if necessary */
-
- /* the accumulator needs to be able to hold 2p digits so that */
- /* the additions on the second and subsequent iterations are */
- /* sufficiently exact. */
- needbytes=sizeof(decNumber)+(D2U(p*2)-1)*sizeof(Unit);
- if (needbytes>sizeof(bufa)) { /* need malloc space */
- allocbufa=(decNumber *)malloc(needbytes);
- if (allocbufa==NULL) { /* hopeless -- abandon */
- *status|=DEC_Insufficient_storage;
- break;}
- a=allocbufa; /* use the allocated space */
- }
- /* the term needs to be able to hold p digits (which is */
- /* guaranteed to be larger than x->digits, so the initial copy */
- /* is safe); it may also be used for the raise-to-power */
- /* calculation below, which needs an extra two digits */
- needbytes=sizeof(decNumber)+(D2U(p+2)-1)*sizeof(Unit);
- if (needbytes>sizeof(buft)) { /* need malloc space */
- allocbuft=(decNumber *)malloc(needbytes);
- if (allocbuft==NULL) { /* hopeless -- abandon */
- *status|=DEC_Insufficient_storage;
- break;}
- t=allocbuft; /* use the allocated space */
- }
-
- uprv_decNumberCopy(t, x); /* term=x */
- uprv_decNumberZero(a); *a->lsu=1; /* accumulator=1 */
- uprv_decNumberZero(d); *d->lsu=2; /* divisor=2 */
- uprv_decNumberZero(&numone); *numone.lsu=1; /* constant 1 for increment */
-
- /* set up the contexts for calculating a, t, and d */
- uprv_decContextDefault(&tset, DEC_INIT_DECIMAL64);
- dset=tset;
- /* accumulator bounds are set above, set precision now */
- aset.digits=p*2; /* double */
- /* term bounds avoid any underflow or overflow */
- tset.digits=p;
- tset.emin=DEC_MIN_EMIN; /* [emax is plenty] */
- /* [dset.digits=16, etc., are sufficient] */
-
- /* finally ready to roll */
- for (;;) {
- #if DECCHECK
- iterations++;
- #endif
- /* only the status from the accumulation is interesting */
- /* [but it should remain unchanged after first add] */
- decAddOp(a, a, t, &aset, 0, status); /* a=a+t */
- decMultiplyOp(t, t, x, &tset, &ignore); /* t=t*x */
- decDivideOp(t, t, d, &tset, DIVIDE, &ignore); /* t=t/d */
- /* the iteration ends when the term cannot affect the result, */
- /* if rounded to p digits, which is when its value is smaller */
- /* than the accumulator by p+1 digits. There must also be */
- /* full precision in a. */
- if (((a->digits+a->exponent)>=(t->digits+t->exponent+p+1))
- && (a->digits>=p)) break;
- decAddOp(d, d, &numone, &dset, 0, &ignore); /* d=d+1 */
- } /* iterate */
-
- #if DECCHECK
- /* just a sanity check; comment out test to show always */
- if (iterations>p+3)
- printf("Exp iterations=%ld, status=%08lx, p=%ld, d=%ld\n",
- (LI)iterations, (LI)*status, (LI)p, (LI)x->digits);
- #endif
- } /* h<=8 */
-
- /* apply postconditioning: a=a**(10**h) -- this is calculated */
- /* at a slightly higher precision than Hull & Abrham suggest */
- if (h>0) {
- Int seenbit=0; /* set once a 1-bit is seen */
- Int i; /* counter */
- Int n=powers[h]; /* always positive */
- aset.digits=p+2; /* sufficient precision */
- /* avoid the overhead and many extra digits of decNumberPower */
- /* as all that is needed is the short 'multipliers' loop; here */
- /* accumulate the answer into t */
- uprv_decNumberZero(t); *t->lsu=1; /* acc=1 */
- for (i=1;;i++){ /* for each bit [top bit ignored] */
- /* abandon if have had overflow or terminal underflow */
- if (*status & (DEC_Overflow|DEC_Underflow)) { /* interesting? */
- if (*status&DEC_Overflow || ISZERO(t)) break;}
- n=n<<1; /* move next bit to testable position */
- if (n<0) { /* top bit is set */
- seenbit=1; /* OK, have a significant bit */
- decMultiplyOp(t, t, a, &aset, status); /* acc=acc*x */
- }
- if (i==31) break; /* that was the last bit */
- if (!seenbit) continue; /* no need to square 1 */
- decMultiplyOp(t, t, t, &aset, status); /* acc=acc*acc [square] */
- } /*i*/ /* 32 bits */
- /* decNumberShow(t); */
- a=t; /* and carry on using t instead of a */
- }
-
- /* Copy and round the result to res */
- residue=1; /* indicate dirt to right .. */
- if (ISZERO(a)) residue=0; /* .. unless underflowed to 0 */
- aset.digits=set->digits; /* [use default rounding] */
- decCopyFit(res, a, &aset, &residue, status); /* copy & shorten */
- decFinish(res, set, &residue, status); /* cleanup/set flags */
- } while(0); /* end protected */
-
- if (allocrhs !=NULL) free(allocrhs); /* drop any storage used */
- if (allocbufa!=NULL) free(allocbufa); /* .. */
- if (allocbuft!=NULL) free(allocbuft); /* .. */
- /* [status is handled by caller] */
- return res;
- } /* decExpOp */
-
-/* ------------------------------------------------------------------ */
-/* Initial-estimate natural logarithm table */
-/* */
-/* LNnn -- 90-entry 16-bit table for values from .10 through .99. */
-/* The result is a 4-digit encode of the coefficient (c=the */
-/* top 14 bits encoding 0-9999) and a 2-digit encode of the */
-/* exponent (e=the bottom 2 bits encoding 0-3) */
-/* */
-/* The resulting value is given by: */
-/* */
-/* v = -c * 10**(-e-3) */
-/* */
-/* where e and c are extracted from entry k = LNnn[x-10] */
-/* where x is truncated (NB) into the range 10 through 99, */
-/* and then c = k>>2 and e = k&3. */
-/* ------------------------------------------------------------------ */
-static const uShort LNnn[90]={9016, 8652, 8316, 8008, 7724, 7456, 7208,
- 6972, 6748, 6540, 6340, 6148, 5968, 5792, 5628, 5464, 5312,
- 5164, 5020, 4884, 4748, 4620, 4496, 4376, 4256, 4144, 4032,
- 39233, 38181, 37157, 36157, 35181, 34229, 33297, 32389, 31501, 30629,
- 29777, 28945, 28129, 27329, 26545, 25777, 25021, 24281, 23553, 22837,
- 22137, 21445, 20769, 20101, 19445, 18801, 18165, 17541, 16925, 16321,
- 15721, 15133, 14553, 13985, 13421, 12865, 12317, 11777, 11241, 10717,
- 10197, 9685, 9177, 8677, 8185, 7697, 7213, 6737, 6269, 5801,
- 5341, 4889, 4437, 39930, 35534, 31186, 26886, 22630, 18418, 14254,
- 10130, 6046, 20055};
-
-/* ------------------------------------------------------------------ */
-/* decLnOp -- effect natural logarithm */
-/* */
-/* This computes C = ln(A) */
-/* */
-/* res is C, the result. C may be A */
-/* rhs is A */
-/* set is the context; note that rounding mode has no effect */
-/* */
-/* C must have space for set->digits digits. */
-/* */
-/* Notable cases: */
-/* A<0 -> Invalid */
-/* A=0 -> -Infinity (Exact) */
-/* A=+Infinity -> +Infinity (Exact) */
-/* A=1 exactly -> 0 (Exact) */
-/* */
-/* Restrictions (as for Exp): */
-/* */
-/* digits, emax, and -emin in the context must be less than */
-/* DEC_MAX_MATH+11 (1000010), and the rhs must be within these */
-/* bounds or a zero. This is an internal routine, so these */
-/* restrictions are contractual and not enforced. */
-/* */
-/* A finite result is rounded using DEC_ROUND_HALF_EVEN; it will */
-/* almost always be correctly rounded, but may be up to 1 ulp in */
-/* error in rare cases. */
-/* ------------------------------------------------------------------ */
-/* The result is calculated using Newton's method, with each */
-/* iteration calculating a' = a + x * exp(-a) - 1. See, for example, */
-/* Epperson 1989. */
-/* */
-/* The iteration ends when the adjustment x*exp(-a)-1 is tiny enough. */
-/* This has to be calculated at the sum of the precision of x and the */
-/* working precision. */
-/* */
-/* Implementation notes: */
-/* */
-/* 1. This is separated out as decLnOp so it can be called from */
-/* other Mathematical functions (e.g., Log 10) with a wider range */
-/* than normal. In particular, it can handle the slightly wider */
-/* (+9+2) range needed by a power function. */
-/* */
-/* 2. The speed of this function is about 10x slower than exp, as */
-/* it typically needs 4-6 iterations for short numbers, and the */
-/* extra precision needed adds a squaring effect, twice. */
-/* */
-/* 3. Fastpaths are included for ln(10) and ln(2), up to length 40, */
-/* as these are common requests. ln(10) is used by log10(x). */
-/* */
-/* 4. An iteration might be saved by widening the LNnn table, and */
-/* would certainly save at least one if it were made ten times */
-/* bigger, too (for truncated fractions 0.100 through 0.999). */
-/* However, for most practical evaluations, at least four or five */
-/* iterations will be neede -- so this would only speed up by */
-/* 20-25% and that probably does not justify increasing the table */
-/* size. */
-/* */
-/* 5. The static buffers are larger than might be expected to allow */
-/* for calls from decNumberPower. */
-/* ------------------------------------------------------------------ */
-#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Warray-bounds"
-#endif
-decNumber * decLnOp(decNumber *res, const decNumber *rhs,
- decContext *set, uInt *status) {
- uInt ignore=0; /* working status accumulator */
- uInt needbytes; /* for space calculations */
- Int residue; /* rounding residue */
- Int r; /* rhs=f*10**r [see below] */
- Int p; /* working precision */
- Int pp; /* precision for iteration */
- Int t; /* work */
-
- /* buffers for a (accumulator, typically precision+2) and b */
- /* (adjustment calculator, same size) */
- decNumber bufa[D2N(DECBUFFER+12)];
- decNumber *allocbufa=NULL; /* -> allocated bufa, iff allocated */
- decNumber *a=bufa; /* accumulator/work */
- decNumber bufb[D2N(DECBUFFER*2+2)];
- decNumber *allocbufb=NULL; /* -> allocated bufa, iff allocated */
- decNumber *b=bufb; /* adjustment/work */
-
- decNumber numone; /* constant 1 */
- decNumber cmp; /* work */
- decContext aset, bset; /* working contexts */
-
- #if DECCHECK
- Int iterations=0; /* for later sanity check */
- if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
- #endif
-
- do { /* protect allocated storage */
- if (SPECIALARG) { /* handle infinities and NaNs */
- if (decNumberIsInfinite(rhs)) { /* an infinity */
- if (decNumberIsNegative(rhs)) /* -Infinity -> error */
- *status|=DEC_Invalid_operation;
- else uprv_decNumberCopy(res, rhs); /* +Infinity -> self */
- }
- else decNaNs(res, rhs, NULL, set, status); /* a NaN */
- break;}
-
- if (ISZERO(rhs)) { /* +/- zeros -> -Infinity */
- uprv_decNumberZero(res); /* make clean */
- res->bits=DECINF|DECNEG; /* set - infinity */
- break;} /* [no status to set] */
-
- /* Non-zero negatives are bad... */
- if (decNumberIsNegative(rhs)) { /* -x -> error */
- *status|=DEC_Invalid_operation;
- break;}
-
- /* Here, rhs is positive, finite, and in range */
-
- /* lookaside fastpath code for ln(2) and ln(10) at common lengths */
- if (rhs->exponent==0 && set->digits<=40) {
- #if DECDPUN==1
- if (rhs->lsu[0]==0 && rhs->lsu[1]==1 && rhs->digits==2) { /* ln(10) */
- #else
- if (rhs->lsu[0]==10 && rhs->digits==2) { /* ln(10) */
- #endif
- aset=*set; aset.round=DEC_ROUND_HALF_EVEN;
- #define LN10 "2.302585092994045684017991454684364207601"
- uprv_decNumberFromString(res, LN10, &aset);
- *status|=(DEC_Inexact | DEC_Rounded); /* is inexact */
- break;}
- if (rhs->lsu[0]==2 && rhs->digits==1) { /* ln(2) */
- aset=*set; aset.round=DEC_ROUND_HALF_EVEN;
- #define LN2 "0.6931471805599453094172321214581765680755"
- uprv_decNumberFromString(res, LN2, &aset);
- *status|=(DEC_Inexact | DEC_Rounded);
- break;}
- } /* integer and short */
-
- /* Determine the working precision. This is normally the */
- /* requested precision + 2, with a minimum of 9. However, if */
- /* the rhs is 'over-precise' then allow for all its digits to */
- /* potentially participate (consider an rhs where all the excess */
- /* digits are 9s) so in this case use rhs->digits+2. */
- p=MAXI(rhs->digits, MAXI(set->digits, 7))+2;
-
- /* Allocate space for the accumulator and the high-precision */
- /* adjustment calculator, if necessary. The accumulator must */
- /* be able to hold p digits, and the adjustment up to */
- /* rhs->digits+p digits. They are also made big enough for 16 */
- /* digits so that they can be used for calculating the initial */
- /* estimate. */
- needbytes=sizeof(decNumber)+(D2U(MAXI(p,16))-1)*sizeof(Unit);
- if (needbytes>sizeof(bufa)) { /* need malloc space */
- allocbufa=(decNumber *)malloc(needbytes);
- if (allocbufa==NULL) { /* hopeless -- abandon */
- *status|=DEC_Insufficient_storage;
- break;}
- a=allocbufa; /* use the allocated space */
- }
- pp=p+rhs->digits;
- needbytes=sizeof(decNumber)+(D2U(MAXI(pp,16))-1)*sizeof(Unit);
- if (needbytes>sizeof(bufb)) { /* need malloc space */
- allocbufb=(decNumber *)malloc(needbytes);
- if (allocbufb==NULL) { /* hopeless -- abandon */
- *status|=DEC_Insufficient_storage;
- break;}
- b=allocbufb; /* use the allocated space */
- }
-
- /* Prepare an initial estimate in acc. Calculate this by */
- /* considering the coefficient of x to be a normalized fraction, */
- /* f, with the decimal point at far left and multiplied by */
- /* 10**r. Then, rhs=f*10**r and 0.1<=f<1, and */
- /* ln(x) = ln(f) + ln(10)*r */
- /* Get the initial estimate for ln(f) from a small lookup */
- /* table (see above) indexed by the first two digits of f, */
- /* truncated. */
-
- uprv_decContextDefault(&aset, DEC_INIT_DECIMAL64); /* 16-digit extended */
- r=rhs->exponent+rhs->digits; /* 'normalised' exponent */
- uprv_decNumberFromInt32(a, r); /* a=r */
- uprv_decNumberFromInt32(b, 2302585); /* b=ln(10) (2.302585) */
- b->exponent=-6; /* .. */
- decMultiplyOp(a, a, b, &aset, &ignore); /* a=a*b */
- /* now get top two digits of rhs into b by simple truncate and */
- /* force to integer */
- residue=0; /* (no residue) */
- aset.digits=2; aset.round=DEC_ROUND_DOWN;
- decCopyFit(b, rhs, &aset, &residue, &ignore); /* copy & shorten */
- b->exponent=0; /* make integer */
- t=decGetInt(b); /* [cannot fail] */
- if (t<10) t=X10(t); /* adjust single-digit b */
- t=LNnn[t-10]; /* look up ln(b) */
- uprv_decNumberFromInt32(b, t>>2); /* b=ln(b) coefficient */
- b->exponent=-(t&3)-3; /* set exponent */
- b->bits=DECNEG; /* ln(0.10)->ln(0.99) always -ve */
- aset.digits=16; aset.round=DEC_ROUND_HALF_EVEN; /* restore */
- decAddOp(a, a, b, &aset, 0, &ignore); /* acc=a+b */
- /* the initial estimate is now in a, with up to 4 digits correct. */
- /* When rhs is at or near Nmax the estimate will be low, so we */
- /* will approach it from below, avoiding overflow when calling exp. */
-
- uprv_decNumberZero(&numone); *numone.lsu=1; /* constant 1 for adjustment */
-
- /* accumulator bounds are as requested (could underflow, but */
- /* cannot overflow) */
- aset.emax=set->emax;
- aset.emin=set->emin;
- aset.clamp=0; /* no concrete format */
- /* set up a context to be used for the multiply and subtract */
- bset=aset;
- bset.emax=DEC_MAX_MATH*2; /* use double bounds for the */
- bset.emin=-DEC_MAX_MATH*2; /* adjustment calculation */
- /* [see decExpOp call below] */
- /* for each iteration double the number of digits to calculate, */
- /* up to a maximum of p */
- pp=9; /* initial precision */
- /* [initially 9 as then the sequence starts 7+2, 16+2, and */
- /* 34+2, which is ideal for standard-sized numbers] */
- aset.digits=pp; /* working context */
- bset.digits=pp+rhs->digits; /* wider context */
- for (;;) { /* iterate */
- #if DECCHECK
- iterations++;
- if (iterations>24) break; /* consider 9 * 2**24 */
- #endif
- /* calculate the adjustment (exp(-a)*x-1) into b. This is a */
- /* catastrophic subtraction but it really is the difference */
- /* from 1 that is of interest. */
- /* Use the internal entry point to Exp as it allows the double */
- /* range for calculating exp(-a) when a is the tiniest subnormal. */
- a->bits^=DECNEG; /* make -a */
- decExpOp(b, a, &bset, &ignore); /* b=exp(-a) */
- a->bits^=DECNEG; /* restore sign of a */
- /* now multiply by rhs and subtract 1, at the wider precision */
- decMultiplyOp(b, b, rhs, &bset, &ignore); /* b=b*rhs */
- decAddOp(b, b, &numone, &bset, DECNEG, &ignore); /* b=b-1 */
-
- /* the iteration ends when the adjustment cannot affect the */
- /* result by >=0.5 ulp (at the requested digits), which */
- /* is when its value is smaller than the accumulator by */
- /* set->digits+1 digits (or it is zero) -- this is a looser */
- /* requirement than for Exp because all that happens to the */
- /* accumulator after this is the final rounding (but note that */
- /* there must also be full precision in a, or a=0). */
-
- if (decNumberIsZero(b) ||
- (a->digits+a->exponent)>=(b->digits+b->exponent+set->digits+1)) {
- if (a->digits==p) break;
- if (decNumberIsZero(a)) {
- decCompareOp(&cmp, rhs, &numone, &aset, COMPARE, &ignore); /* rhs=1 ? */
- if (cmp.lsu[0]==0) a->exponent=0; /* yes, exact 0 */
- else *status|=(DEC_Inexact | DEC_Rounded); /* no, inexact */
- break;
- }
- /* force padding if adjustment has gone to 0 before full length */
- if (decNumberIsZero(b)) b->exponent=a->exponent-p;
- }
-
- /* not done yet ... */
- decAddOp(a, a, b, &aset, 0, &ignore); /* a=a+b for next estimate */
- if (pp==p) continue; /* precision is at maximum */
- /* lengthen the next calculation */
- pp=pp*2; /* double precision */
- if (pp>p) pp=p; /* clamp to maximum */
- aset.digits=pp; /* working context */
- bset.digits=pp+rhs->digits; /* wider context */
- } /* Newton's iteration */
-
- #if DECCHECK
- /* just a sanity check; remove the test to show always */
- if (iterations>24)
- printf("Ln iterations=%ld, status=%08lx, p=%ld, d=%ld\n",
- (LI)iterations, (LI)*status, (LI)p, (LI)rhs->digits);
- #endif
-
- /* Copy and round the result to res */
- residue=1; /* indicate dirt to right */
- if (ISZERO(a)) residue=0; /* .. unless underflowed to 0 */
- aset.digits=set->digits; /* [use default rounding] */
- decCopyFit(res, a, &aset, &residue, status); /* copy & shorten */
- decFinish(res, set, &residue, status); /* cleanup/set flags */
- } while(0); /* end protected */
-
- if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */
- if (allocbufb!=NULL) free(allocbufb); /* .. */
- /* [status is handled by caller] */
- return res;
- } /* decLnOp */
-#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406
-#pragma GCC diagnostic pop
-#endif
-
-/* ------------------------------------------------------------------ */
-/* decQuantizeOp -- force exponent to requested value */
-/* */
-/* This computes C = op(A, B), where op adjusts the coefficient */
-/* of C (by rounding or shifting) such that the exponent (-scale) */
-/* of C has the value B or matches the exponent of B. */
-/* The numerical value of C will equal A, except for the effects of */
-/* any rounding that occurred. */
-/* */
-/* res is C, the result. C may be A or B */
-/* lhs is A, the number to adjust */
-/* rhs is B, the requested exponent */
-/* set is the context */
-/* quant is 1 for quantize or 0 for rescale */
-/* status is the status accumulator (this can be called without */
-/* risk of control loss) */
-/* */
-/* C must have space for set->digits digits. */
-/* */
-/* Unless there is an error or the result is infinite, the exponent */
-/* after the operation is guaranteed to be that requested. */
-/* ------------------------------------------------------------------ */
-static decNumber * decQuantizeOp(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set,
- Flag quant, uInt *status) {
- #if DECSUBSET
- decNumber *alloclhs=NULL; /* non-NULL if rounded lhs allocated */
- decNumber *allocrhs=NULL; /* .., rhs */
- #endif
- const decNumber *inrhs=rhs; /* save original rhs */
- Int reqdigits=set->digits; /* requested DIGITS */
- Int reqexp; /* requested exponent [-scale] */
- Int residue=0; /* rounding residue */
- Int etiny=set->emin-(reqdigits-1);
-
- #if DECCHECK
- if (decCheckOperands(res, lhs, rhs, set)) return res;
- #endif
-
- do { /* protect allocated storage */
- #if DECSUBSET
- if (!set->extended) {
- /* reduce operands and set lostDigits status, as needed */
- if (lhs->digits>reqdigits) {
- alloclhs=decRoundOperand(lhs, set, status);
- if (alloclhs==NULL) break;
- lhs=alloclhs;
- }
- if (rhs->digits>reqdigits) { /* [this only checks lostDigits] */
- allocrhs=decRoundOperand(rhs, set, status);
- if (allocrhs==NULL) break;
- rhs=allocrhs;
- }
- }
- #endif
- /* [following code does not require input rounding] */
-
- /* Handle special values */
- if (SPECIALARGS) {
- /* NaNs get usual processing */
- if (SPECIALARGS & (DECSNAN | DECNAN))
- decNaNs(res, lhs, rhs, set, status);
- /* one infinity but not both is bad */
- else if ((lhs->bits ^ rhs->bits) & DECINF)
- *status|=DEC_Invalid_operation;
- /* both infinity: return lhs */
- else uprv_decNumberCopy(res, lhs); /* [nop if in place] */
- break;
- }
-
- /* set requested exponent */
- if (quant) reqexp=inrhs->exponent; /* quantize -- match exponents */
- else { /* rescale -- use value of rhs */
- /* Original rhs must be an integer that fits and is in range, */
- /* which could be from -1999999997 to +999999999, thanks to */
- /* subnormals */
- reqexp=decGetInt(inrhs); /* [cannot fail] */
- }
-
- #if DECSUBSET
- if (!set->extended) etiny=set->emin; /* no subnormals */
- #endif
-
- if (reqexp==BADINT /* bad (rescale only) or .. */
- || reqexp==BIGODD || reqexp==BIGEVEN /* very big (ditto) or .. */
- || (reqexp<etiny) /* < lowest */
- || (reqexp>set->emax)) { /* > emax */
- *status|=DEC_Invalid_operation;
- break;}
-
- /* the RHS has been processed, so it can be overwritten now if necessary */
- if (ISZERO(lhs)) { /* zero coefficient unchanged */
- uprv_decNumberCopy(res, lhs); /* [nop if in place] */
- res->exponent=reqexp; /* .. just set exponent */
- #if DECSUBSET
- if (!set->extended) res->bits=0; /* subset specification; no -0 */
- #endif
- }
- else { /* non-zero lhs */
- Int adjust=reqexp-lhs->exponent; /* digit adjustment needed */
- /* if adjusted coefficient will definitely not fit, give up now */
- if ((lhs->digits-adjust)>reqdigits) {
- *status|=DEC_Invalid_operation;
- break;
- }
-
- if (adjust>0) { /* increasing exponent */
- /* this will decrease the length of the coefficient by adjust */
- /* digits, and must round as it does so */
- decContext workset; /* work */
- workset=*set; /* clone rounding, etc. */
- workset.digits=lhs->digits-adjust; /* set requested length */
- /* [note that the latter can be <1, here] */
- decCopyFit(res, lhs, &workset, &residue, status); /* fit to result */
- decApplyRound(res, &workset, residue, status); /* .. and round */
- residue=0; /* [used] */
- /* If just rounded a 999s case, exponent will be off by one; */
- /* adjust back (after checking space), if so. */
- if (res->exponent>reqexp) {
- /* re-check needed, e.g., for quantize(0.9999, 0.001) under */
- /* set->digits==3 */
- if (res->digits==reqdigits) { /* cannot shift by 1 */
- *status&=~(DEC_Inexact | DEC_Rounded); /* [clean these] */
- *status|=DEC_Invalid_operation;
- break;
- }
- res->digits=decShiftToMost(res->lsu, res->digits, 1); /* shift */
- res->exponent--; /* (re)adjust the exponent. */
- }
- #if DECSUBSET
- if (ISZERO(res) && !set->extended) res->bits=0; /* subset; no -0 */
- #endif
- } /* increase */
- else /* adjust<=0 */ { /* decreasing or = exponent */
- /* this will increase the length of the coefficient by -adjust */
- /* digits, by adding zero or more trailing zeros; this is */
- /* already checked for fit, above */
- uprv_decNumberCopy(res, lhs); /* [it will fit] */
- /* if padding needed (adjust<0), add it now... */
- if (adjust<0) {
- res->digits=decShiftToMost(res->lsu, res->digits, -adjust);
- res->exponent+=adjust; /* adjust the exponent */
- }
- } /* decrease */
- } /* non-zero */
-
- /* Check for overflow [do not use Finalize in this case, as an */
- /* overflow here is a "don't fit" situation] */
- if (res->exponent>set->emax-res->digits+1) { /* too big */
- *status|=DEC_Invalid_operation;
- break;
- }
- else {
- decFinalize(res, set, &residue, status); /* set subnormal flags */
- *status&=~DEC_Underflow; /* suppress Underflow [as per 754] */
- }
- } while(0); /* end protected */
-
- #if DECSUBSET
- if (allocrhs!=NULL) free(allocrhs); /* drop any storage used */
- if (alloclhs!=NULL) free(alloclhs); /* .. */
- #endif
- return res;
- } /* decQuantizeOp */
-
-/* ------------------------------------------------------------------ */
-/* decCompareOp -- compare, min, or max two Numbers */
-/* */
-/* This computes C = A ? B and carries out one of four operations: */
-/* COMPARE -- returns the signum (as a number) giving the */
-/* result of a comparison unless one or both */
-/* operands is a NaN (in which case a NaN results) */
-/* COMPSIG -- as COMPARE except that a quiet NaN raises */
-/* Invalid operation. */
-/* COMPMAX -- returns the larger of the operands, using the */
-/* 754 maxnum operation */
-/* COMPMAXMAG -- ditto, comparing absolute values */
-/* COMPMIN -- the 754 minnum operation */
-/* COMPMINMAG -- ditto, comparing absolute values */
-/* COMTOTAL -- returns the signum (as a number) giving the */
-/* result of a comparison using 754 total ordering */
-/* */
-/* res is C, the result. C may be A and/or B (e.g., X=X?X) */
-/* lhs is A */
-/* rhs is B */
-/* set is the context */
-/* op is the operation flag */
-/* status is the usual accumulator */
-/* */
-/* C must have space for one digit for COMPARE or set->digits for */
-/* COMPMAX, COMPMIN, COMPMAXMAG, or COMPMINMAG. */
-/* ------------------------------------------------------------------ */
-/* The emphasis here is on speed for common cases, and avoiding */
-/* coefficient comparison if possible. */
-/* ------------------------------------------------------------------ */
-static decNumber * decCompareOp(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set,
- Flag op, uInt *status) {
- #if DECSUBSET
- decNumber *alloclhs=NULL; /* non-NULL if rounded lhs allocated */
- decNumber *allocrhs=NULL; /* .., rhs */
- #endif
- Int result=0; /* default result value */
- uByte merged; /* work */
-
- #if DECCHECK
- if (decCheckOperands(res, lhs, rhs, set)) return res;
- #endif
-
- do { /* protect allocated storage */
- #if DECSUBSET
- if (!set->extended) {
- /* reduce operands and set lostDigits status, as needed */
- if (lhs->digits>set->digits) {
- alloclhs=decRoundOperand(lhs, set, status);
- if (alloclhs==NULL) {result=BADINT; break;}
- lhs=alloclhs;
- }
- if (rhs->digits>set->digits) {
- allocrhs=decRoundOperand(rhs, set, status);
- if (allocrhs==NULL) {result=BADINT; break;}
- rhs=allocrhs;
- }
- }
- #endif
- /* [following code does not require input rounding] */
-
- /* If total ordering then handle differing signs 'up front' */
- if (op==COMPTOTAL) { /* total ordering */
- if (decNumberIsNegative(lhs) && !decNumberIsNegative(rhs)) {
- result=-1;
- break;
- }
- if (!decNumberIsNegative(lhs) && decNumberIsNegative(rhs)) {
- result=+1;
- break;
- }
- }
-
- /* handle NaNs specially; let infinities drop through */
- /* This assumes sNaN (even just one) leads to NaN. */
- merged=(lhs->bits | rhs->bits) & (DECSNAN | DECNAN);
- if (merged) { /* a NaN bit set */
- if (op==COMPARE); /* result will be NaN */
- else if (op==COMPSIG) /* treat qNaN as sNaN */
- *status|=DEC_Invalid_operation | DEC_sNaN;
- else if (op==COMPTOTAL) { /* total ordering, always finite */
- /* signs are known to be the same; compute the ordering here */
- /* as if the signs are both positive, then invert for negatives */
- if (!decNumberIsNaN(lhs)) result=-1;
- else if (!decNumberIsNaN(rhs)) result=+1;
- /* here if both NaNs */
- else if (decNumberIsSNaN(lhs) && decNumberIsQNaN(rhs)) result=-1;
- else if (decNumberIsQNaN(lhs) && decNumberIsSNaN(rhs)) result=+1;
- else { /* both NaN or both sNaN */
- /* now it just depends on the payload */
- result=decUnitCompare(lhs->lsu, D2U(lhs->digits),
- rhs->lsu, D2U(rhs->digits), 0);
- /* [Error not possible, as these are 'aligned'] */
- } /* both same NaNs */
- if (decNumberIsNegative(lhs)) result=-result;
- break;
- } /* total order */
-
- else if (merged & DECSNAN); /* sNaN -> qNaN */
- else { /* here if MIN or MAX and one or two quiet NaNs */
- /* min or max -- 754 rules ignore single NaN */
- if (!decNumberIsNaN(lhs) || !decNumberIsNaN(rhs)) {
- /* just one NaN; force choice to be the non-NaN operand */
- op=COMPMAX;
- if (lhs->bits & DECNAN) result=-1; /* pick rhs */
- else result=+1; /* pick lhs */
- break;
- }
- } /* max or min */
- op=COMPNAN; /* use special path */
- decNaNs(res, lhs, rhs, set, status); /* propagate NaN */
- break;
- }
- /* have numbers */
- if (op==COMPMAXMAG || op==COMPMINMAG) result=decCompare(lhs, rhs, 1);
- else result=decCompare(lhs, rhs, 0); /* sign matters */
- } while(0); /* end protected */
-
- if (result==BADINT) *status|=DEC_Insufficient_storage; /* rare */
- else {
- if (op==COMPARE || op==COMPSIG ||op==COMPTOTAL) { /* returning signum */
- if (op==COMPTOTAL && result==0) {
- /* operands are numerically equal or same NaN (and same sign, */
- /* tested first); if identical, leave result 0 */
- if (lhs->exponent!=rhs->exponent) {
- if (lhs->exponent<rhs->exponent) result=-1;
- else result=+1;
- if (decNumberIsNegative(lhs)) result=-result;
- } /* lexp!=rexp */
- } /* total-order by exponent */
- uprv_decNumberZero(res); /* [always a valid result] */
- if (result!=0) { /* must be -1 or +1 */
- *res->lsu=1;
- if (result<0) res->bits=DECNEG;
- }
- }
- else if (op==COMPNAN); /* special, drop through */
- else { /* MAX or MIN, non-NaN result */
- Int residue=0; /* rounding accumulator */
- /* choose the operand for the result */
- const decNumber *choice;
- if (result==0) { /* operands are numerically equal */
- /* choose according to sign then exponent (see 754) */
- uByte slhs=(lhs->bits & DECNEG);
- uByte srhs=(rhs->bits & DECNEG);
- #if DECSUBSET
- if (!set->extended) { /* subset: force left-hand */
- op=COMPMAX;
- result=+1;
- }
- else
- #endif
- if (slhs!=srhs) { /* signs differ */
- if (slhs) result=-1; /* rhs is max */
- else result=+1; /* lhs is max */
- }
- else if (slhs && srhs) { /* both negative */
- if (lhs->exponent<rhs->exponent) result=+1;
- else result=-1;
- /* [if equal, use lhs, technically identical] */
- }
- else { /* both positive */
- if (lhs->exponent>rhs->exponent) result=+1;
- else result=-1;
- /* [ditto] */
- }
- } /* numerically equal */
- /* here result will be non-0; reverse if looking for MIN */
- if (op==COMPMIN || op==COMPMINMAG) result=-result;
- choice=(result>0 ? lhs : rhs); /* choose */
- /* copy chosen to result, rounding if need be */
- decCopyFit(res, choice, set, &residue, status);
- decFinish(res, set, &residue, status);
- }
- }
- #if DECSUBSET
- if (allocrhs!=NULL) free(allocrhs); /* free any storage used */
- if (alloclhs!=NULL) free(alloclhs); /* .. */
- #endif
- return res;
- } /* decCompareOp */
-
-/* ------------------------------------------------------------------ */
-/* decCompare -- compare two decNumbers by numerical value */
-/* */
-/* This routine compares A ? B without altering them. */
-/* */
-/* Arg1 is A, a decNumber which is not a NaN */
-/* Arg2 is B, a decNumber which is not a NaN */
-/* Arg3 is 1 for a sign-independent compare, 0 otherwise */
-/* */
-/* returns -1, 0, or 1 for A<B, A==B, or A>B, or BADINT if failure */
-/* (the only possible failure is an allocation error) */
-/* ------------------------------------------------------------------ */
-static Int decCompare(const decNumber *lhs, const decNumber *rhs,
- Flag abs_c) {
- Int result; /* result value */
- Int sigr; /* rhs signum */
- Int compare; /* work */
-
- result=1; /* assume signum(lhs) */
- if (ISZERO(lhs)) result=0;
- if (abs_c) {
- if (ISZERO(rhs)) return result; /* LHS wins or both 0 */
- /* RHS is non-zero */
- if (result==0) return -1; /* LHS is 0; RHS wins */
- /* [here, both non-zero, result=1] */
- }
- else { /* signs matter */
- if (result && decNumberIsNegative(lhs)) result=-1;
- sigr=1; /* compute signum(rhs) */
- if (ISZERO(rhs)) sigr=0;
- else if (decNumberIsNegative(rhs)) sigr=-1;
- if (result > sigr) return +1; /* L > R, return 1 */
- if (result < sigr) return -1; /* L < R, return -1 */
- if (result==0) return 0; /* both 0 */
- }
-
- /* signums are the same; both are non-zero */
- if ((lhs->bits | rhs->bits) & DECINF) { /* one or more infinities */
- if (decNumberIsInfinite(rhs)) {
- if (decNumberIsInfinite(lhs)) result=0;/* both infinite */
- else result=-result; /* only rhs infinite */
- }
- return result;
- }
- /* must compare the coefficients, allowing for exponents */
- if (lhs->exponent>rhs->exponent) { /* LHS exponent larger */
- /* swap sides, and sign */
- const decNumber *temp=lhs;
- lhs=rhs;
- rhs=temp;
- result=-result;
- }
- compare=decUnitCompare(lhs->lsu, D2U(lhs->digits),
- rhs->lsu, D2U(rhs->digits),
- rhs->exponent-lhs->exponent);
- if (compare!=BADINT) compare*=result; /* comparison succeeded */
- return compare;
- } /* decCompare */
-
-/* ------------------------------------------------------------------ */
-/* decUnitCompare -- compare two >=0 integers in Unit arrays */
-/* */
-/* This routine compares A ? B*10**E where A and B are unit arrays */
-/* A is a plain integer */
-/* B has an exponent of E (which must be non-negative) */
-/* */
-/* Arg1 is A first Unit (lsu) */
-/* Arg2 is A length in Units */
-/* Arg3 is B first Unit (lsu) */
-/* Arg4 is B length in Units */
-/* Arg5 is E (0 if the units are aligned) */
-/* */
-/* returns -1, 0, or 1 for A<B, A==B, or A>B, or BADINT if failure */
-/* (the only possible failure is an allocation error, which can */
-/* only occur if E!=0) */
-/* ------------------------------------------------------------------ */
-static Int decUnitCompare(const Unit *a, Int alength,
- const Unit *b, Int blength, Int exp) {
- Unit *acc; /* accumulator for result */
- Unit accbuff[SD2U(DECBUFFER*2+1)]; /* local buffer */
- Unit *allocacc=NULL; /* -> allocated acc buffer, iff allocated */
- Int accunits, need; /* units in use or needed for acc */
- const Unit *l, *r, *u; /* work */
- Int expunits, exprem, result; /* .. */
-
- if (exp==0) { /* aligned; fastpath */
- if (alength>blength) return 1;
- if (alength<blength) return -1;
- /* same number of units in both -- need unit-by-unit compare */
- l=a+alength-1;
- r=b+alength-1;
- for (;l>=a; l--, r--) {
- if (*l>*r) return 1;
- if (*l<*r) return -1;
- }
- return 0; /* all units match */
- } /* aligned */
-
- /* Unaligned. If one is >1 unit longer than the other, padded */
- /* approximately, then can return easily */
- if (alength>blength+(Int)D2U(exp)) return 1;
- if (alength+1<blength+(Int)D2U(exp)) return -1;
-
- /* Need to do a real subtract. For this, a result buffer is needed */
- /* even though only the sign is of interest. Its length needs */
- /* to be the larger of alength and padded blength, +2 */
- need=blength+D2U(exp); /* maximum real length of B */
- if (need<alength) need=alength;
- need+=2;
- acc=accbuff; /* assume use local buffer */
- if (need*sizeof(Unit)>sizeof(accbuff)) {
- allocacc=(Unit *)malloc(need*sizeof(Unit));
- if (allocacc==NULL) return BADINT; /* hopeless -- abandon */
- acc=allocacc;
- }
- /* Calculate units and remainder from exponent. */
- expunits=exp/DECDPUN;
- exprem=exp%DECDPUN;
- /* subtract [A+B*(-m)] */
- accunits=decUnitAddSub(a, alength, b, blength, expunits, acc,
- -(Int)powers[exprem]);
- /* [UnitAddSub result may have leading zeros, even on zero] */
- if (accunits<0) result=-1; /* negative result */
- else { /* non-negative result */
- /* check units of the result before freeing any storage */
- for (u=acc; u<acc+accunits-1 && *u==0;) u++;
- result=(*u==0 ? 0 : +1);
- }
- /* clean up and return the result */
- if (allocacc!=NULL) free(allocacc); /* drop any storage used */
- return result;
- } /* decUnitCompare */
-
-/* ------------------------------------------------------------------ */
-/* decUnitAddSub -- add or subtract two >=0 integers in Unit arrays */
-/* */
-/* This routine performs the calculation: */
-/* */
-/* C=A+(B*M) */
-/* */
-/* Where M is in the range -DECDPUNMAX through +DECDPUNMAX. */
-/* */
-/* A may be shorter or longer than B. */
-/* */
-/* Leading zeros are not removed after a calculation. The result is */
-/* either the same length as the longer of A and B (adding any */
-/* shift), or one Unit longer than that (if a Unit carry occurred). */
-/* */
-/* A and B content are not altered unless C is also A or B. */
-/* C may be the same array as A or B, but only if no zero padding is */
-/* requested (that is, C may be B only if bshift==0). */
-/* C is filled from the lsu; only those units necessary to complete */
-/* the calculation are referenced. */
-/* */
-/* Arg1 is A first Unit (lsu) */
-/* Arg2 is A length in Units */
-/* Arg3 is B first Unit (lsu) */
-/* Arg4 is B length in Units */
-/* Arg5 is B shift in Units (>=0; pads with 0 units if positive) */
-/* Arg6 is C first Unit (lsu) */
-/* Arg7 is M, the multiplier */
-/* */
-/* returns the count of Units written to C, which will be non-zero */
-/* and negated if the result is negative. That is, the sign of the */
-/* returned Int is the sign of the result (positive for zero) and */
-/* the absolute value of the Int is the count of Units. */
-/* */
-/* It is the caller's responsibility to make sure that C size is */
-/* safe, allowing space if necessary for a one-Unit carry. */
-/* */
-/* This routine is severely performance-critical; *any* change here */
-/* must be measured (timed) to assure no performance degradation. */
-/* In particular, trickery here tends to be counter-productive, as */
-/* increased complexity of code hurts register optimizations on */
-/* register-poor architectures. Avoiding divisions is nearly */
-/* always a Good Idea, however. */
-/* */
-/* Special thanks to Rick McGuire (IBM Cambridge, MA) and Dave Clark */
-/* (IBM Warwick, UK) for some of the ideas used in this routine. */
-/* ------------------------------------------------------------------ */
-static Int decUnitAddSub(const Unit *a, Int alength,
- const Unit *b, Int blength, Int bshift,
- Unit *c, Int m) {
- const Unit *alsu=a; /* A lsu [need to remember it] */
- Unit *clsu=c; /* C ditto */
- Unit *minC; /* low water mark for C */
- Unit *maxC; /* high water mark for C */
- eInt carry=0; /* carry integer (could be Long) */
- Int add; /* work */
- #if DECDPUN<=4 /* myriadal, millenary, etc. */
- Int est; /* estimated quotient */
- #endif
-
- #if DECTRACE
- if (alength<1 || blength<1)
- printf("decUnitAddSub: alen blen m %ld %ld [%ld]\n", alength, blength, m);
- #endif
-
- maxC=c+alength; /* A is usually the longer */
- minC=c+blength; /* .. and B the shorter */
- if (bshift!=0) { /* B is shifted; low As copy across */
- minC+=bshift;
- /* if in place [common], skip copy unless there's a gap [rare] */
- if (a==c && bshift<=alength) {
- c+=bshift;
- a+=bshift;
- }
- else for (; c<clsu+bshift; a++, c++) { /* copy needed */
- if (a<alsu+alength) *c=*a;
- else *c=0;
- }
- }
- if (minC>maxC) { /* swap */
- Unit *hold=minC;
- minC=maxC;
- maxC=hold;
- }
-
- /* For speed, do the addition as two loops; the first where both A */
- /* and B contribute, and the second (if necessary) where only one or */
- /* other of the numbers contribute. */
- /* Carry handling is the same (i.e., duplicated) in each case. */
- for (; c<minC; c++) {
- carry+=*a;
- a++;
- carry+=((eInt)*b)*m; /* [special-casing m=1/-1 */
- b++; /* here is not a win] */
- /* here carry is new Unit of digits; it could be +ve or -ve */
- if ((ueInt)carry<=DECDPUNMAX) { /* fastpath 0-DECDPUNMAX */
- *c=(Unit)carry;
- carry=0;
- continue;
- }
- #if DECDPUN==4 /* use divide-by-multiply */
- if (carry>=0) {
- est=(((ueInt)carry>>11)*53687)>>18;
- *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
- carry=est; /* likely quotient [89%] */
- if (*c<DECDPUNMAX+1) continue; /* estimate was correct */
- carry++;
- *c-=DECDPUNMAX+1;
- continue;
- }
- /* negative case */
- carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
- est=(((ueInt)carry>>11)*53687)>>18;
- *c=(Unit)(carry-est*(DECDPUNMAX+1));
- carry=est-(DECDPUNMAX+1); /* correctly negative */
- if (*c<DECDPUNMAX+1) continue; /* was OK */
- carry++;
- *c-=DECDPUNMAX+1;
- #elif DECDPUN==3
- if (carry>=0) {
- est=(((ueInt)carry>>3)*16777)>>21;
- *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
- carry=est; /* likely quotient [99%] */
- if (*c<DECDPUNMAX+1) continue; /* estimate was correct */
- carry++;
- *c-=DECDPUNMAX+1;
- continue;
- }
- /* negative case */
- carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
- est=(((ueInt)carry>>3)*16777)>>21;
- *c=(Unit)(carry-est*(DECDPUNMAX+1));
- carry=est-(DECDPUNMAX+1); /* correctly negative */
- if (*c<DECDPUNMAX+1) continue; /* was OK */
- carry++;
- *c-=DECDPUNMAX+1;
- #elif DECDPUN<=2
- /* Can use QUOT10 as carry <= 4 digits */
- if (carry>=0) {
- est=QUOT10(carry, DECDPUN);
- *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
- carry=est; /* quotient */
- continue;
- }
- /* negative case */
- carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
- est=QUOT10(carry, DECDPUN);
- *c=(Unit)(carry-est*(DECDPUNMAX+1));
- carry=est-(DECDPUNMAX+1); /* correctly negative */
- #else
- /* remainder operator is undefined if negative, so must test */
- if ((ueInt)carry<(DECDPUNMAX+1)*2) { /* fastpath carry +1 */
- *c=(Unit)(carry-(DECDPUNMAX+1)); /* [helps additions] */
- carry=1;
- continue;
- }
- if (carry>=0) {
- *c=(Unit)(carry%(DECDPUNMAX+1));
- carry=carry/(DECDPUNMAX+1);
- continue;
- }
- /* negative case */
- carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
- *c=(Unit)(carry%(DECDPUNMAX+1));
- carry=carry/(DECDPUNMAX+1)-(DECDPUNMAX+1);
- #endif
- } /* c */
-
- /* now may have one or other to complete */
- /* [pretest to avoid loop setup/shutdown] */
- if (c<maxC) for (; c<maxC; c++) {
- if (a<alsu+alength) { /* still in A */
- carry+=*a;
- a++;
- }
- else { /* inside B */
- carry+=((eInt)*b)*m;
- b++;
- }
- /* here carry is new Unit of digits; it could be +ve or -ve and */
- /* magnitude up to DECDPUNMAX squared */
- if ((ueInt)carry<=DECDPUNMAX) { /* fastpath 0-DECDPUNMAX */
- *c=(Unit)carry;
- carry=0;
- continue;
- }
- /* result for this unit is negative or >DECDPUNMAX */
- #if DECDPUN==4 /* use divide-by-multiply */
- if (carry>=0) {
- est=(((ueInt)carry>>11)*53687)>>18;
- *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
- carry=est; /* likely quotient [79.7%] */
- if (*c<DECDPUNMAX+1) continue; /* estimate was correct */
- carry++;
- *c-=DECDPUNMAX+1;
- continue;
- }
- /* negative case */
- carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
- est=(((ueInt)carry>>11)*53687)>>18;
- *c=(Unit)(carry-est*(DECDPUNMAX+1));
- carry=est-(DECDPUNMAX+1); /* correctly negative */
- if (*c<DECDPUNMAX+1) continue; /* was OK */
- carry++;
- *c-=DECDPUNMAX+1;
- #elif DECDPUN==3
- if (carry>=0) {
- est=(((ueInt)carry>>3)*16777)>>21;
- *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
- carry=est; /* likely quotient [99%] */
- if (*c<DECDPUNMAX+1) continue; /* estimate was correct */
- carry++;
- *c-=DECDPUNMAX+1;
- continue;
- }
- /* negative case */
- carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
- est=(((ueInt)carry>>3)*16777)>>21;
- *c=(Unit)(carry-est*(DECDPUNMAX+1));
- carry=est-(DECDPUNMAX+1); /* correctly negative */
- if (*c<DECDPUNMAX+1) continue; /* was OK */
- carry++;
- *c-=DECDPUNMAX+1;
- #elif DECDPUN<=2
- if (carry>=0) {
- est=QUOT10(carry, DECDPUN);
- *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
- carry=est; /* quotient */
- continue;
- }
- /* negative case */
- carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
- est=QUOT10(carry, DECDPUN);
- *c=(Unit)(carry-est*(DECDPUNMAX+1));
- carry=est-(DECDPUNMAX+1); /* correctly negative */
- #else
- if ((ueInt)carry<(DECDPUNMAX+1)*2){ /* fastpath carry 1 */
- *c=(Unit)(carry-(DECDPUNMAX+1));
- carry=1;
- continue;
- }
- /* remainder operator is undefined if negative, so must test */
- if (carry>=0) {
- *c=(Unit)(carry%(DECDPUNMAX+1));
- carry=carry/(DECDPUNMAX+1);
- continue;
- }
- /* negative case */
- carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
- *c=(Unit)(carry%(DECDPUNMAX+1));
- carry=carry/(DECDPUNMAX+1)-(DECDPUNMAX+1);
- #endif
- } /* c */
-
- /* OK, all A and B processed; might still have carry or borrow */
- /* return number of Units in the result, negated if a borrow */
- if (carry==0) return static_cast<int32_t>(c-clsu); /* no carry, so no more to do */
- if (carry>0) { /* positive carry */
- *c=(Unit)carry; /* place as new unit */
- c++; /* .. */
- return static_cast<int32_t>(c-clsu);
- }
- /* -ve carry: it's a borrow; complement needed */
- add=1; /* temporary carry... */
- for (c=clsu; c<maxC; c++) {
- add=DECDPUNMAX+add-*c;
- if (add<=DECDPUNMAX) {
- *c=(Unit)add;
- add=0;
- }
- else {
- *c=0;
- add=1;
- }
- }
- /* add an extra unit iff it would be non-zero */
- #if DECTRACE
- printf("UAS borrow: add %ld, carry %ld\n", add, carry);
- #endif
- if ((add-carry-1)!=0) {
- *c=(Unit)(add-carry-1);
- c++; /* interesting, include it */
- }
- return static_cast<int32_t>(clsu-c); /* -ve result indicates borrowed */
- } /* decUnitAddSub */
-
-/* ------------------------------------------------------------------ */
-/* decTrim -- trim trailing zeros or normalize */
-/* */
-/* dn is the number to trim or normalize */
-/* set is the context to use to check for clamp */
-/* all is 1 to remove all trailing zeros, 0 for just fraction ones */
-/* noclamp is 1 to unconditional (unclamped) trim */
-/* dropped returns the number of discarded trailing zeros */
-/* returns dn */
-/* */
-/* If clamp is set in the context then the number of zeros trimmed */
-/* may be limited if the exponent is high. */
-/* All fields are updated as required. This is a utility operation, */
-/* so special values are unchanged and no error is possible. */
-/* ------------------------------------------------------------------ */
-static decNumber * decTrim(decNumber *dn, decContext *set, Flag all,
- Flag noclamp, Int *dropped) {
- Int d, exp; /* work */
- uInt cut; /* .. */
- Unit *up; /* -> current Unit */
-
- #if DECCHECK
- if (decCheckOperands(dn, DECUNUSED, DECUNUSED, DECUNCONT)) return dn;
- #endif
-
- *dropped=0; /* assume no zeros dropped */
- if ((dn->bits & DECSPECIAL) /* fast exit if special .. */
- || (*dn->lsu & 0x01)) return dn; /* .. or odd */
- if (ISZERO(dn)) { /* .. or 0 */
- dn->exponent=0; /* (sign is preserved) */
- return dn;
- }
-
- /* have a finite number which is even */
- exp=dn->exponent;
- cut=1; /* digit (1-DECDPUN) in Unit */
- up=dn->lsu; /* -> current Unit */
- for (d=0; d<dn->digits-1; d++) { /* [don't strip the final digit] */
- /* slice by powers */
- #if DECDPUN<=4
- uInt quot=QUOT10(*up, cut);
- if ((*up-quot*powers[cut])!=0) break; /* found non-0 digit */
- #else
- if (*up%powers[cut]!=0) break; /* found non-0 digit */
- #endif
- /* have a trailing 0 */
- if (!all) { /* trimming */
- /* [if exp>0 then all trailing 0s are significant for trim] */
- if (exp<=0) { /* if digit might be significant */
- if (exp==0) break; /* then quit */
- exp++; /* next digit might be significant */
- }
- }
- cut++; /* next power */
- if (cut>DECDPUN) { /* need new Unit */
- up++;
- cut=1;
- }
- } /* d */
- if (d==0) return dn; /* none to drop */
-
- /* may need to limit drop if clamping */
- if (set->clamp && !noclamp) {
- Int maxd=set->emax-set->digits+1-dn->exponent;
- if (maxd<=0) return dn; /* nothing possible */
- if (d>maxd) d=maxd;
- }
-
- /* effect the drop */
- decShiftToLeast(dn->lsu, D2U(dn->digits), d);
- dn->exponent+=d; /* maintain numerical value */
- dn->digits-=d; /* new length */
- *dropped=d; /* report the count */
- return dn;
- } /* decTrim */
-
-/* ------------------------------------------------------------------ */
-/* decReverse -- reverse a Unit array in place */
-/* */
-/* ulo is the start of the array */
-/* uhi is the end of the array (highest Unit to include) */
-/* */
-/* The units ulo through uhi are reversed in place (if the number */
-/* of units is odd, the middle one is untouched). Note that the */
-/* digit(s) in each unit are unaffected. */
-/* ------------------------------------------------------------------ */
-static void decReverse(Unit *ulo, Unit *uhi) {
- Unit temp;
- for (; ulo<uhi; ulo++, uhi--) {
- temp=*ulo;
- *ulo=*uhi;
- *uhi=temp;
- }
- return;
- } /* decReverse */
-
-/* ------------------------------------------------------------------ */
-/* decShiftToMost -- shift digits in array towards most significant */
-/* */
-/* uar is the array */
-/* digits is the count of digits in use in the array */
-/* shift is the number of zeros to pad with (least significant); */
-/* it must be zero or positive */
-/* */
-/* returns the new length of the integer in the array, in digits */
-/* */
-/* No overflow is permitted (that is, the uar array must be known to */
-/* be large enough to hold the result, after shifting). */
-/* ------------------------------------------------------------------ */
-static Int decShiftToMost(Unit *uar, Int digits, Int shift) {
- Unit *target, *source, *first; /* work */
- Int cut; /* odd 0's to add */
- uInt next; /* work */
-
- if (shift==0) return digits; /* [fastpath] nothing to do */
- if ((digits+shift)<=DECDPUN) { /* [fastpath] single-unit case */
- *uar=(Unit)(*uar*powers[shift]);
- return digits+shift;
- }
-
- next=0; /* all paths */
- source=uar+D2U(digits)-1; /* where msu comes from */
- target=source+D2U(shift); /* where upper part of first cut goes */
- cut=DECDPUN-MSUDIGITS(shift); /* where to slice */
- if (cut==0) { /* unit-boundary case */
- for (; source>=uar; source--, target--) *target=*source;
- }
- else {
- first=uar+D2U(digits+shift)-1; /* where msu of source will end up */
- for (; source>=uar; source--, target--) {
- /* split the source Unit and accumulate remainder for next */
- #if DECDPUN<=4
- uInt quot=QUOT10(*source, cut);
- uInt rem=*source-quot*powers[cut];
- next+=quot;
- #else
- uInt rem=*source%powers[cut];
- next+=*source/powers[cut];
- #endif
- if (target<=first) *target=(Unit)next; /* write to target iff valid */
- next=rem*powers[DECDPUN-cut]; /* save remainder for next Unit */
- }
- } /* shift-move */
-
- /* propagate any partial unit to one below and clear the rest */
- for (; target>=uar; target--) {
- *target=(Unit)next;
- next=0;
- }
- return digits+shift;
- } /* decShiftToMost */
-
-/* ------------------------------------------------------------------ */
-/* decShiftToLeast -- shift digits in array towards least significant */
-/* */
-/* uar is the array */
-/* units is length of the array, in units */
-/* shift is the number of digits to remove from the lsu end; it */
-/* must be zero or positive and <= than units*DECDPUN. */
-/* */
-/* returns the new length of the integer in the array, in units */
-/* */
-/* Removed digits are discarded (lost). Units not required to hold */
-/* the final result are unchanged. */
-/* ------------------------------------------------------------------ */
-static Int decShiftToLeast(Unit *uar, Int units, Int shift) {
- Unit *target, *up; /* work */
- Int cut, count; /* work */
- Int quot, rem; /* for division */
-
- if (shift==0) return units; /* [fastpath] nothing to do */
- if (shift==units*DECDPUN) { /* [fastpath] little to do */
- *uar=0; /* all digits cleared gives zero */
- return 1; /* leaves just the one */
- }
-
- target=uar; /* both paths */
- cut=MSUDIGITS(shift);
- if (cut==DECDPUN) { /* unit-boundary case; easy */
- up=uar+D2U(shift);
- for (; up<uar+units; target++, up++) *target=*up;
- return static_cast<int32_t>(target-uar);
- }
-
- /* messier */
- up=uar+D2U(shift-cut); /* source; correct to whole Units */
- count=units*DECDPUN-shift; /* the maximum new length */
- #if DECDPUN<=4
- quot=QUOT10(*up, cut);
- #else
- quot=*up/powers[cut];
- #endif
- for (; ; target++) {
- *target=(Unit)quot;
- count-=(DECDPUN-cut);
- if (count<=0) break;
- up++;
- quot=*up;
- #if DECDPUN<=4
- quot=QUOT10(quot, cut);
- rem=*up-quot*powers[cut];
- #else
- rem=quot%powers[cut];
- quot=quot/powers[cut];
- #endif
- *target=(Unit)(*target+rem*powers[DECDPUN-cut]);
- count-=cut;
- if (count<=0) break;
- }
- return static_cast<int32_t>(target-uar+1);
- } /* decShiftToLeast */
-
-#if DECSUBSET
-/* ------------------------------------------------------------------ */
-/* decRoundOperand -- round an operand [used for subset only] */
-/* */
-/* dn is the number to round (dn->digits is > set->digits) */
-/* set is the relevant context */
-/* status is the status accumulator */
-/* */
-/* returns an allocated decNumber with the rounded result. */
-/* */
-/* lostDigits and other status may be set by this. */
-/* */
-/* Since the input is an operand, it must not be modified. */
-/* Instead, return an allocated decNumber, rounded as required. */
-/* It is the caller's responsibility to free the allocated storage. */
-/* */
-/* If no storage is available then the result cannot be used, so NULL */
-/* is returned. */
-/* ------------------------------------------------------------------ */
-static decNumber *decRoundOperand(const decNumber *dn, decContext *set,
- uInt *status) {
- decNumber *res; /* result structure */
- uInt newstatus=0; /* status from round */
- Int residue=0; /* rounding accumulator */
-
- /* Allocate storage for the returned decNumber, big enough for the */
- /* length specified by the context */
- res=(decNumber *)malloc(sizeof(decNumber)
- +(D2U(set->digits)-1)*sizeof(Unit));
- if (res==NULL) {
- *status|=DEC_Insufficient_storage;
- return NULL;
- }
- decCopyFit(res, dn, set, &residue, &newstatus);
- decApplyRound(res, set, residue, &newstatus);
-
- /* If that set Inexact then "lost digits" is raised... */
- if (newstatus & DEC_Inexact) newstatus|=DEC_Lost_digits;
- *status|=newstatus;
- return res;
- } /* decRoundOperand */
-#endif
-
-/* ------------------------------------------------------------------ */
-/* decCopyFit -- copy a number, truncating the coefficient if needed */
-/* */
-/* dest is the target decNumber */
-/* src is the source decNumber */
-/* set is the context [used for length (digits) and rounding mode] */
-/* residue is the residue accumulator */
-/* status contains the current status to be updated */
-/* */
-/* (dest==src is allowed and will be a no-op if fits) */
-/* All fields are updated as required. */
-/* ------------------------------------------------------------------ */
-static void decCopyFit(decNumber *dest, const decNumber *src,
- decContext *set, Int *residue, uInt *status) {
- dest->bits=src->bits;
- dest->exponent=src->exponent;
- decSetCoeff(dest, set, src->lsu, src->digits, residue, status);
- } /* decCopyFit */
-
-/* ------------------------------------------------------------------ */
-/* decSetCoeff -- set the coefficient of a number */
-/* */
-/* dn is the number whose coefficient array is to be set. */
-/* It must have space for set->digits digits */
-/* set is the context [for size] */
-/* lsu -> lsu of the source coefficient [may be dn->lsu] */
-/* len is digits in the source coefficient [may be dn->digits] */
-/* residue is the residue accumulator. This has values as in */
-/* decApplyRound, and will be unchanged unless the */
-/* target size is less than len. In this case, the */
-/* coefficient is truncated and the residue is updated to */
-/* reflect the previous residue and the dropped digits. */
-/* status is the status accumulator, as usual */
-/* */
-/* The coefficient may already be in the number, or it can be an */
-/* external intermediate array. If it is in the number, lsu must == */
-/* dn->lsu and len must == dn->digits. */
-/* */
-/* Note that the coefficient length (len) may be < set->digits, and */
-/* in this case this merely copies the coefficient (or is a no-op */
-/* if dn->lsu==lsu). */
-/* */
-/* Note also that (only internally, from decQuantizeOp and */
-/* decSetSubnormal) the value of set->digits may be less than one, */
-/* indicating a round to left. This routine handles that case */
-/* correctly; caller ensures space. */
-/* */
-/* dn->digits, dn->lsu (and as required), and dn->exponent are */
-/* updated as necessary. dn->bits (sign) is unchanged. */
-/* */
-/* DEC_Rounded status is set if any digits are discarded. */
-/* DEC_Inexact status is set if any non-zero digits are discarded, or */
-/* incoming residue was non-0 (implies rounded) */
-/* ------------------------------------------------------------------ */
-/* mapping array: maps 0-9 to canonical residues, so that a residue */
-/* can be adjusted in the range [-1, +1] and achieve correct rounding */
-/* 0 1 2 3 4 5 6 7 8 9 */
-static const uByte resmap[10]={0, 3, 3, 3, 3, 5, 7, 7, 7, 7};
-static void decSetCoeff(decNumber *dn, decContext *set, const Unit *lsu,
- Int len, Int *residue, uInt *status) {
- Int discard; /* number of digits to discard */
- uInt cut; /* cut point in Unit */
- const Unit *up; /* work */
- Unit *target; /* .. */
- Int count; /* .. */
- #if DECDPUN<=4
- uInt temp; /* .. */
- #endif
-
- discard=len-set->digits; /* digits to discard */
- if (discard<=0) { /* no digits are being discarded */
- if (dn->lsu!=lsu) { /* copy needed */
- /* copy the coefficient array to the result number; no shift needed */
- count=len; /* avoids D2U */
- up=lsu;
- for (target=dn->lsu; count>0; target++, up++, count-=DECDPUN)
- *target=*up;
- dn->digits=len; /* set the new length */
- }
- /* dn->exponent and residue are unchanged, record any inexactitude */
- if (*residue!=0) *status|=(DEC_Inexact | DEC_Rounded);
- return;
- }
-
- /* some digits must be discarded ... */
- dn->exponent+=discard; /* maintain numerical value */
- *status|=DEC_Rounded; /* accumulate Rounded status */
- if (*residue>1) *residue=1; /* previous residue now to right, so reduce */
-
- if (discard>len) { /* everything, +1, is being discarded */
- /* guard digit is 0 */
- /* residue is all the number [NB could be all 0s] */
- if (*residue<=0) { /* not already positive */
- count=len; /* avoids D2U */
- for (up=lsu; count>0; up++, count-=DECDPUN) if (*up!=0) { /* found non-0 */
- *residue=1;
- break; /* no need to check any others */
- }
- }
- if (*residue!=0) *status|=DEC_Inexact; /* record inexactitude */
- *dn->lsu=0; /* coefficient will now be 0 */
- dn->digits=1; /* .. */
- return;
- } /* total discard */
-
- /* partial discard [most common case] */
- /* here, at least the first (most significant) discarded digit exists */
-
- /* spin up the number, noting residue during the spin, until get to */
- /* the Unit with the first discarded digit. When reach it, extract */
- /* it and remember its position */
- count=0;
- for (up=lsu;; up++) {
- count+=DECDPUN;
- if (count>=discard) break; /* full ones all checked */
- if (*up!=0) *residue=1;
- } /* up */
-
- /* here up -> Unit with first discarded digit */
- cut=discard-(count-DECDPUN)-1;
- if (cut==DECDPUN-1) { /* unit-boundary case (fast) */
- Unit half=(Unit)powers[DECDPUN]>>1;
- /* set residue directly */
- if (*up>=half) {
- if (*up>half) *residue=7;
- else *residue+=5; /* add sticky bit */
- }
- else { /* <half */
- if (*up!=0) *residue=3; /* [else is 0, leave as sticky bit] */
- }
- if (set->digits<=0) { /* special for Quantize/Subnormal :-( */
- *dn->lsu=0; /* .. result is 0 */
- dn->digits=1; /* .. */
- }
- else { /* shift to least */
- count=set->digits; /* now digits to end up with */
- dn->digits=count; /* set the new length */
- up++; /* move to next */
- /* on unit boundary, so shift-down copy loop is simple */
- for (target=dn->lsu; count>0; target++, up++, count-=DECDPUN)
- *target=*up;
- }
- } /* unit-boundary case */
-
- else { /* discard digit is in low digit(s), and not top digit */
- uInt discard1; /* first discarded digit */
- uInt quot, rem; /* for divisions */
- if (cut==0) quot=*up; /* is at bottom of unit */
- else /* cut>0 */ { /* it's not at bottom of unit */
- #if DECDPUN<=4
- U_ASSERT(/* cut >= 0 &&*/ cut <= 4);
- quot=QUOT10(*up, cut);
- rem=*up-quot*powers[cut];
- #else
- rem=*up%powers[cut];
- quot=*up/powers[cut];
- #endif
- if (rem!=0) *residue=1;
- }
- /* discard digit is now at bottom of quot */
- #if DECDPUN<=4
- temp=(quot*6554)>>16; /* fast /10 */
- /* Vowels algorithm here not a win (9 instructions) */
- discard1=quot-X10(temp);
- quot=temp;
- #else
- discard1=quot%10;
- quot=quot/10;
- #endif
- /* here, discard1 is the guard digit, and residue is everything */
- /* else [use mapping array to accumulate residue safely] */
- *residue+=resmap[discard1];
- cut++; /* update cut */
- /* here: up -> Unit of the array with bottom digit */
- /* cut is the division point for each Unit */
- /* quot holds the uncut high-order digits for the current unit */
- if (set->digits<=0) { /* special for Quantize/Subnormal :-( */
- *dn->lsu=0; /* .. result is 0 */
- dn->digits=1; /* .. */
- }
- else { /* shift to least needed */
- count=set->digits; /* now digits to end up with */
- dn->digits=count; /* set the new length */
- /* shift-copy the coefficient array to the result number */
- for (target=dn->lsu; ; target++) {
- *target=(Unit)quot;
- count-=(DECDPUN-cut);
- if (count<=0) break;
- up++;
- quot=*up;
- #if DECDPUN<=4
- quot=QUOT10(quot, cut);
- rem=*up-quot*powers[cut];
- #else
- rem=quot%powers[cut];
- quot=quot/powers[cut];
- #endif
- *target=(Unit)(*target+rem*powers[DECDPUN-cut]);
- count-=cut;
- if (count<=0) break;
- } /* shift-copy loop */
- } /* shift to least */
- } /* not unit boundary */
-
- if (*residue!=0) *status|=DEC_Inexact; /* record inexactitude */
- return;
- } /* decSetCoeff */
-
-/* ------------------------------------------------------------------ */
-/* decApplyRound -- apply pending rounding to a number */
-/* */
-/* dn is the number, with space for set->digits digits */
-/* set is the context [for size and rounding mode] */
-/* residue indicates pending rounding, being any accumulated */
-/* guard and sticky information. It may be: */
-/* 6-9: rounding digit is >5 */
-/* 5: rounding digit is exactly half-way */
-/* 1-4: rounding digit is <5 and >0 */
-/* 0: the coefficient is exact */
-/* -1: as 1, but the hidden digits are subtractive, that */
-/* is, of the opposite sign to dn. In this case the */
-/* coefficient must be non-0. This case occurs when */
-/* subtracting a small number (which can be reduced to */
-/* a sticky bit); see decAddOp. */
-/* status is the status accumulator, as usual */
-/* */
-/* This routine applies rounding while keeping the length of the */
-/* coefficient constant. The exponent and status are unchanged */
-/* except if: */
-/* */
-/* -- the coefficient was increased and is all nines (in which */
-/* case Overflow could occur, and is handled directly here so */
-/* the caller does not need to re-test for overflow) */
-/* */
-/* -- the coefficient was decreased and becomes all nines (in which */
-/* case Underflow could occur, and is also handled directly). */
-/* */
-/* All fields in dn are updated as required. */
-/* */
-/* ------------------------------------------------------------------ */
-static void decApplyRound(decNumber *dn, decContext *set, Int residue,
- uInt *status) {
- Int bump; /* 1 if coefficient needs to be incremented */
- /* -1 if coefficient needs to be decremented */
-
- if (residue==0) return; /* nothing to apply */
-
- bump=0; /* assume a smooth ride */
-
- /* now decide whether, and how, to round, depending on mode */
- switch (set->round) {
- case DEC_ROUND_05UP: { /* round zero or five up (for reround) */
- /* This is the same as DEC_ROUND_DOWN unless there is a */
- /* positive residue and the lsd of dn is 0 or 5, in which case */
- /* it is bumped; when residue is <0, the number is therefore */
- /* bumped down unless the final digit was 1 or 6 (in which */
- /* case it is bumped down and then up -- a no-op) */
- Int lsd5=*dn->lsu%5; /* get lsd and quintate */
- if (residue<0 && lsd5!=1) bump=-1;
- else if (residue>0 && lsd5==0) bump=1;
- /* [bump==1 could be applied directly; use common path for clarity] */
- break;} /* r-05 */
-
- case DEC_ROUND_DOWN: {
- /* no change, except if negative residue */
- if (residue<0) bump=-1;
- break;} /* r-d */
-
- case DEC_ROUND_HALF_DOWN: {
- if (residue>5) bump=1;
- break;} /* r-h-d */
-
- case DEC_ROUND_HALF_EVEN: {
- if (residue>5) bump=1; /* >0.5 goes up */
- else if (residue==5) { /* exactly 0.5000... */
- /* 0.5 goes up iff [new] lsd is odd */
- if (*dn->lsu & 0x01) bump=1;
- }
- break;} /* r-h-e */
-
- case DEC_ROUND_HALF_UP: {
- if (residue>=5) bump=1;
- break;} /* r-h-u */
-
- case DEC_ROUND_UP: {
- if (residue>0) bump=1;
- break;} /* r-u */
-
- case DEC_ROUND_CEILING: {
- /* same as _UP for positive numbers, and as _DOWN for negatives */
- /* [negative residue cannot occur on 0] */
- if (decNumberIsNegative(dn)) {
- if (residue<0) bump=-1;
- }
- else {
- if (residue>0) bump=1;
- }
- break;} /* r-c */
-
- case DEC_ROUND_FLOOR: {
- /* same as _UP for negative numbers, and as _DOWN for positive */
- /* [negative residue cannot occur on 0] */
- if (!decNumberIsNegative(dn)) {
- if (residue<0) bump=-1;
- }
- else {
- if (residue>0) bump=1;
- }
- break;} /* r-f */
-
- default: { /* e.g., DEC_ROUND_MAX */
- *status|=DEC_Invalid_context;
- #if DECTRACE || (DECCHECK && DECVERB)
- printf("Unknown rounding mode: %d\n", set->round);
- #endif
- break;}
- } /* switch */
-
- /* now bump the number, up or down, if need be */
- if (bump==0) return; /* no action required */
-
- /* Simply use decUnitAddSub unless bumping up and the number is */
- /* all nines. In this special case set to 100... explicitly */
- /* and adjust the exponent by one (as otherwise could overflow */
- /* the array) */
- /* Similarly handle all-nines result if bumping down. */
- if (bump>0) {
- Unit *up; /* work */
- uInt count=dn->digits; /* digits to be checked */
- for (up=dn->lsu; ; up++) {
- if (count<=DECDPUN) {
- /* this is the last Unit (the msu) */
- if (*up!=powers[count]-1) break; /* not still 9s */
- /* here if it, too, is all nines */
- *up=(Unit)powers[count-1]; /* here 999 -> 100 etc. */
- for (up=up-1; up>=dn->lsu; up--) *up=0; /* others all to 0 */
- dn->exponent++; /* and bump exponent */
- /* [which, very rarely, could cause Overflow...] */
- if ((dn->exponent+dn->digits)>set->emax+1) {
- decSetOverflow(dn, set, status);
- }
- return; /* done */
- }
- /* a full unit to check, with more to come */
- if (*up!=DECDPUNMAX) break; /* not still 9s */
- count-=DECDPUN;
- } /* up */
- } /* bump>0 */
- else { /* -1 */
- /* here checking for a pre-bump of 1000... (leading 1, all */
- /* other digits zero) */
- Unit *up, *sup; /* work */
- uInt count=dn->digits; /* digits to be checked */
- for (up=dn->lsu; ; up++) {
- if (count<=DECDPUN) {
- /* this is the last Unit (the msu) */
- if (*up!=powers[count-1]) break; /* not 100.. */
- /* here if have the 1000... case */
- sup=up; /* save msu pointer */
- *up=(Unit)powers[count]-1; /* here 100 in msu -> 999 */
- /* others all to all-nines, too */
- for (up=up-1; up>=dn->lsu; up--) *up=(Unit)powers[DECDPUN]-1;
- dn->exponent--; /* and bump exponent */
-
- /* iff the number was at the subnormal boundary (exponent=etiny) */
- /* then the exponent is now out of range, so it will in fact get */
- /* clamped to etiny and the final 9 dropped. */
- /* printf(">> emin=%d exp=%d sdig=%d\n", set->emin, */
- /* dn->exponent, set->digits); */
- if (dn->exponent+1==set->emin-set->digits+1) {
- if (count==1 && dn->digits==1) *sup=0; /* here 9 -> 0[.9] */
- else {
- *sup=(Unit)powers[count-1]-1; /* here 999.. in msu -> 99.. */
- dn->digits--;
- }
- dn->exponent++;
- *status|=DEC_Underflow | DEC_Subnormal | DEC_Inexact | DEC_Rounded;
- }
- return; /* done */
- }
-
- /* a full unit to check, with more to come */
- if (*up!=0) break; /* not still 0s */
- count-=DECDPUN;
- } /* up */
-
- } /* bump<0 */
-
- /* Actual bump needed. Do it. */
- decUnitAddSub(dn->lsu, D2U(dn->digits), uarrone, 1, 0, dn->lsu, bump);
- } /* decApplyRound */
-
-#if DECSUBSET
-/* ------------------------------------------------------------------ */
-/* decFinish -- finish processing a number */
-/* */
-/* dn is the number */
-/* set is the context */
-/* residue is the rounding accumulator (as in decApplyRound) */
-/* status is the accumulator */
-/* */
-/* This finishes off the current number by: */
-/* 1. If not extended: */
-/* a. Converting a zero result to clean '0' */
-/* b. Reducing positive exponents to 0, if would fit in digits */
-/* 2. Checking for overflow and subnormals (always) */
-/* Note this is just Finalize when no subset arithmetic. */
-/* All fields are updated as required. */
-/* ------------------------------------------------------------------ */
-static void decFinish(decNumber *dn, decContext *set, Int *residue,
- uInt *status) {
- if (!set->extended) {
- if ISZERO(dn) { /* value is zero */
- dn->exponent=0; /* clean exponent .. */
- dn->bits=0; /* .. and sign */
- return; /* no error possible */
- }
- if (dn->exponent>=0) { /* non-negative exponent */
- /* >0; reduce to integer if possible */
- if (set->digits >= (dn->exponent+dn->digits)) {
- dn->digits=decShiftToMost(dn->lsu, dn->digits, dn->exponent);
- dn->exponent=0;
- }
- }
- } /* !extended */
-
- decFinalize(dn, set, residue, status);
- } /* decFinish */
-#endif
-
-/* ------------------------------------------------------------------ */
-/* decFinalize -- final check, clamp, and round of a number */
-/* */
-/* dn is the number */
-/* set is the context */
-/* residue is the rounding accumulator (as in decApplyRound) */
-/* status is the status accumulator */
-/* */
-/* This finishes off the current number by checking for subnormal */
-/* results, applying any pending rounding, checking for overflow, */
-/* and applying any clamping. */
-/* Underflow and overflow conditions are raised as appropriate. */
-/* All fields are updated as required. */
-/* ------------------------------------------------------------------ */
-static void decFinalize(decNumber *dn, decContext *set, Int *residue,
- uInt *status) {
- Int shift; /* shift needed if clamping */
- Int tinyexp=set->emin-dn->digits+1; /* precalculate subnormal boundary */
-
- /* Must be careful, here, when checking the exponent as the */
- /* adjusted exponent could overflow 31 bits [because it may already */
- /* be up to twice the expected]. */
-
- /* First test for subnormal. This must be done before any final */
- /* round as the result could be rounded to Nmin or 0. */
- if (dn->exponent<=tinyexp) { /* prefilter */
- Int comp;
- decNumber nmin;
- /* A very nasty case here is dn == Nmin and residue<0 */
- if (dn->exponent<tinyexp) {
- /* Go handle subnormals; this will apply round if needed. */
- decSetSubnormal(dn, set, residue, status);
- return;
- }
- /* Equals case: only subnormal if dn=Nmin and negative residue */
- uprv_decNumberZero(&nmin);
- nmin.lsu[0]=1;
- nmin.exponent=set->emin;
- comp=decCompare(dn, &nmin, 1); /* (signless compare) */
- if (comp==BADINT) { /* oops */
- *status|=DEC_Insufficient_storage; /* abandon... */
- return;
- }
- if (*residue<0 && comp==0) { /* neg residue and dn==Nmin */
- decApplyRound(dn, set, *residue, status); /* might force down */
- decSetSubnormal(dn, set, residue, status);
- return;
- }
- }
-
- /* now apply any pending round (this could raise overflow). */
- if (*residue!=0) decApplyRound(dn, set, *residue, status);
-
- /* Check for overflow [redundant in the 'rare' case] or clamp */
- if (dn->exponent<=set->emax-set->digits+1) return; /* neither needed */
-
-
- /* here when might have an overflow or clamp to do */
- if (dn->exponent>set->emax-dn->digits+1) { /* too big */
- decSetOverflow(dn, set, status);
- return;
- }
- /* here when the result is normal but in clamp range */
- if (!set->clamp) return;
-
- /* here when need to apply the IEEE exponent clamp (fold-down) */
- shift=dn->exponent-(set->emax-set->digits+1);
-
- /* shift coefficient (if non-zero) */
- if (!ISZERO(dn)) {
- dn->digits=decShiftToMost(dn->lsu, dn->digits, shift);
- }
- dn->exponent-=shift; /* adjust the exponent to match */
- *status|=DEC_Clamped; /* and record the dirty deed */
- return;
- } /* decFinalize */
-
-/* ------------------------------------------------------------------ */
-/* decSetOverflow -- set number to proper overflow value */
-/* */
-/* dn is the number (used for sign [only] and result) */
-/* set is the context [used for the rounding mode, etc.] */
-/* status contains the current status to be updated */
-/* */
-/* This sets the sign of a number and sets its value to either */
-/* Infinity or the maximum finite value, depending on the sign of */
-/* dn and the rounding mode, following IEEE 754 rules. */
-/* ------------------------------------------------------------------ */
-static void decSetOverflow(decNumber *dn, decContext *set, uInt *status) {
- Flag needmax=0; /* result is maximum finite value */
- uByte sign=dn->bits&DECNEG; /* clean and save sign bit */
-
- if (ISZERO(dn)) { /* zero does not overflow magnitude */
- Int emax=set->emax; /* limit value */
- if (set->clamp) emax-=set->digits-1; /* lower if clamping */
- if (dn->exponent>emax) { /* clamp required */
- dn->exponent=emax;
- *status|=DEC_Clamped;
- }
- return;
- }
-
- uprv_decNumberZero(dn);
- switch (set->round) {
- case DEC_ROUND_DOWN: {
- needmax=1; /* never Infinity */
- break;} /* r-d */
- case DEC_ROUND_05UP: {
- needmax=1; /* never Infinity */
- break;} /* r-05 */
- case DEC_ROUND_CEILING: {
- if (sign) needmax=1; /* Infinity if non-negative */
- break;} /* r-c */
- case DEC_ROUND_FLOOR: {
- if (!sign) needmax=1; /* Infinity if negative */
- break;} /* r-f */
- default: break; /* Infinity in all other cases */
- }
- if (needmax) {
- decSetMaxValue(dn, set);
- dn->bits=sign; /* set sign */
- }
- else dn->bits=sign|DECINF; /* Value is +/-Infinity */
- *status|=DEC_Overflow | DEC_Inexact | DEC_Rounded;
- } /* decSetOverflow */
-
-/* ------------------------------------------------------------------ */
-/* decSetMaxValue -- set number to +Nmax (maximum normal value) */
-/* */
-/* dn is the number to set */
-/* set is the context [used for digits and emax] */
-/* */
-/* This sets the number to the maximum positive value. */
-/* ------------------------------------------------------------------ */
-static void decSetMaxValue(decNumber *dn, decContext *set) {
- Unit *up; /* work */
- Int count=set->digits; /* nines to add */
- dn->digits=count;
- /* fill in all nines to set maximum value */
- for (up=dn->lsu; ; up++) {
- if (count>DECDPUN) *up=DECDPUNMAX; /* unit full o'nines */
- else { /* this is the msu */
- *up=(Unit)(powers[count]-1);
- break;
- }
- count-=DECDPUN; /* filled those digits */
- } /* up */
- dn->bits=0; /* + sign */
- dn->exponent=set->emax-set->digits+1;
- } /* decSetMaxValue */
-
-/* ------------------------------------------------------------------ */
-/* decSetSubnormal -- process value whose exponent is <Emin */
-/* */
-/* dn is the number (used as input as well as output; it may have */
-/* an allowed subnormal value, which may need to be rounded) */
-/* set is the context [used for the rounding mode] */
-/* residue is any pending residue */
-/* status contains the current status to be updated */
-/* */
-/* If subset mode, set result to zero and set Underflow flags. */
-/* */
-/* Value may be zero with a low exponent; this does not set Subnormal */
-/* but the exponent will be clamped to Etiny. */
-/* */
-/* Otherwise ensure exponent is not out of range, and round as */
-/* necessary. Underflow is set if the result is Inexact. */
-/* ------------------------------------------------------------------ */
-static void decSetSubnormal(decNumber *dn, decContext *set, Int *residue,
- uInt *status) {
- decContext workset; /* work */
- Int etiny, adjust; /* .. */
-
- #if DECSUBSET
- /* simple set to zero and 'hard underflow' for subset */
- if (!set->extended) {
- uprv_decNumberZero(dn);
- /* always full overflow */
- *status|=DEC_Underflow | DEC_Subnormal | DEC_Inexact | DEC_Rounded;
- return;
- }
- #endif
-
- /* Full arithmetic -- allow subnormals, rounded to minimum exponent */
- /* (Etiny) if needed */
- etiny=set->emin-(set->digits-1); /* smallest allowed exponent */
-
- if ISZERO(dn) { /* value is zero */
- /* residue can never be non-zero here */
- #if DECCHECK
- if (*residue!=0) {
- printf("++ Subnormal 0 residue %ld\n", (LI)*residue);
- *status|=DEC_Invalid_operation;
- }
- #endif
- if (dn->exponent<etiny) { /* clamp required */
- dn->exponent=etiny;
- *status|=DEC_Clamped;
- }
- return;
- }
-
- *status|=DEC_Subnormal; /* have a non-zero subnormal */
- adjust=etiny-dn->exponent; /* calculate digits to remove */
- if (adjust<=0) { /* not out of range; unrounded */
- /* residue can never be non-zero here, except in the Nmin-residue */
- /* case (which is a subnormal result), so can take fast-path here */
- /* it may already be inexact (from setting the coefficient) */
- if (*status&DEC_Inexact) *status|=DEC_Underflow;
- return;
- }
-
- /* adjust>0, so need to rescale the result so exponent becomes Etiny */
- /* [this code is similar to that in rescale] */
- workset=*set; /* clone rounding, etc. */
- workset.digits=dn->digits-adjust; /* set requested length */
- workset.emin-=adjust; /* and adjust emin to match */
- /* [note that the latter can be <1, here, similar to Rescale case] */
- decSetCoeff(dn, &workset, dn->lsu, dn->digits, residue, status);
- decApplyRound(dn, &workset, *residue, status);
-
- /* Use 754 default rule: Underflow is set iff Inexact */
- /* [independent of whether trapped] */
- if (*status&DEC_Inexact) *status|=DEC_Underflow;
-
- /* if rounded up a 999s case, exponent will be off by one; adjust */
- /* back if so [it will fit, because it was shortened earlier] */
- if (dn->exponent>etiny) {
- dn->digits=decShiftToMost(dn->lsu, dn->digits, 1);
- dn->exponent--; /* (re)adjust the exponent. */
- }
-
- /* if rounded to zero, it is by definition clamped... */
- if (ISZERO(dn)) *status|=DEC_Clamped;
- } /* decSetSubnormal */
-
-/* ------------------------------------------------------------------ */
-/* decCheckMath - check entry conditions for a math function */
-/* */
-/* This checks the context and the operand */
-/* */
-/* rhs is the operand to check */
-/* set is the context to check */
-/* status is unchanged if both are good */
-/* */
-/* returns non-zero if status is changed, 0 otherwise */
-/* */
-/* Restrictions enforced: */
-/* */
-/* digits, emax, and -emin in the context must be less than */
-/* DEC_MAX_MATH (999999), and A must be within these bounds if */
-/* non-zero. Invalid_operation is set in the status if a */
-/* restriction is violated. */
-/* ------------------------------------------------------------------ */
-static uInt decCheckMath(const decNumber *rhs, decContext *set,
- uInt *status) {
- uInt save=*status; /* record */
- if (set->digits>DEC_MAX_MATH
- || set->emax>DEC_MAX_MATH
- || -set->emin>DEC_MAX_MATH) *status|=DEC_Invalid_context;
- else if ((rhs->digits>DEC_MAX_MATH
- || rhs->exponent+rhs->digits>DEC_MAX_MATH+1
- || rhs->exponent+rhs->digits<2*(1-DEC_MAX_MATH))
- && !ISZERO(rhs)) *status|=DEC_Invalid_operation;
- return (*status!=save);
- } /* decCheckMath */
-
-/* ------------------------------------------------------------------ */
-/* decGetInt -- get integer from a number */
-/* */
-/* dn is the number [which will not be altered] */
-/* */
-/* returns one of: */
-/* BADINT if there is a non-zero fraction */
-/* the converted integer */
-/* BIGEVEN if the integer is even and magnitude > 2*10**9 */
-/* BIGODD if the integer is odd and magnitude > 2*10**9 */
-/* */
-/* This checks and gets a whole number from the input decNumber. */
-/* The sign can be determined from dn by the caller when BIGEVEN or */
-/* BIGODD is returned. */
-/* ------------------------------------------------------------------ */
-static Int decGetInt(const decNumber *dn) {
- Int theInt; /* result accumulator */
- const Unit *up; /* work */
- Int got; /* digits (real or not) processed */
- Int ilength=dn->digits+dn->exponent; /* integral length */
- Flag neg=decNumberIsNegative(dn); /* 1 if -ve */
-
- /* The number must be an integer that fits in 10 digits */
- /* Assert, here, that 10 is enough for any rescale Etiny */
- #if DEC_MAX_EMAX > 999999999
- #error GetInt may need updating [for Emax]
- #endif
- #if DEC_MIN_EMIN < -999999999
- #error GetInt may need updating [for Emin]
- #endif
- if (ISZERO(dn)) return 0; /* zeros are OK, with any exponent */
-
- up=dn->lsu; /* ready for lsu */
- theInt=0; /* ready to accumulate */
- if (dn->exponent>=0) { /* relatively easy */
- /* no fractional part [usual]; allow for positive exponent */
- got=dn->exponent;
- }
- else { /* -ve exponent; some fractional part to check and discard */
- Int count=-dn->exponent; /* digits to discard */
- /* spin up whole units until reach the Unit with the unit digit */
- for (; count>=DECDPUN; up++) {
- if (*up!=0) return BADINT; /* non-zero Unit to discard */
- count-=DECDPUN;
- }
- if (count==0) got=0; /* [a multiple of DECDPUN] */
- else { /* [not multiple of DECDPUN] */
- Int rem; /* work */
- /* slice off fraction digits and check for non-zero */
- #if DECDPUN<=4
- theInt=QUOT10(*up, count);
- rem=*up-theInt*powers[count];
- #else
- rem=*up%powers[count]; /* slice off discards */
- theInt=*up/powers[count];
- #endif
- if (rem!=0) return BADINT; /* non-zero fraction */
- /* it looks good */
- got=DECDPUN-count; /* number of digits so far */
- up++; /* ready for next */
- }
- }
- /* now it's known there's no fractional part */
-
- /* tricky code now, to accumulate up to 9.3 digits */
- if (got==0) {theInt=*up; got+=DECDPUN; up++;} /* ensure lsu is there */
-
- if (ilength<11) {
- Int save=theInt;
- /* collect any remaining unit(s) */
- for (; got<ilength; up++) {
- theInt+=*up*powers[got];
- got+=DECDPUN;
- }
- if (ilength==10) { /* need to check for wrap */
- if (theInt/(Int)powers[got-DECDPUN]!=(Int)*(up-1)) ilength=11;
- /* [that test also disallows the BADINT result case] */
- else if (neg && theInt>1999999997) ilength=11;
- else if (!neg && theInt>999999999) ilength=11;
- if (ilength==11) theInt=save; /* restore correct low bit */
- }
- }
-
- if (ilength>10) { /* too big */
- if (theInt&1) return BIGODD; /* bottom bit 1 */
- return BIGEVEN; /* bottom bit 0 */
- }
-
- if (neg) theInt=-theInt; /* apply sign */
- return theInt;
- } /* decGetInt */
-
-/* ------------------------------------------------------------------ */
-/* decDecap -- decapitate the coefficient of a number */
-/* */
-/* dn is the number to be decapitated */
-/* drop is the number of digits to be removed from the left of dn; */
-/* this must be <= dn->digits (if equal, the coefficient is */
-/* set to 0) */
-/* */
-/* Returns dn; dn->digits will be <= the initial digits less drop */
-/* (after removing drop digits there may be leading zero digits */
-/* which will also be removed). Only dn->lsu and dn->digits change. */
-/* ------------------------------------------------------------------ */
-static decNumber *decDecap(decNumber *dn, Int drop) {
- Unit *msu; /* -> target cut point */
- Int cut; /* work */
- if (drop>=dn->digits) { /* losing the whole thing */
- #if DECCHECK
- if (drop>dn->digits)
- printf("decDecap called with drop>digits [%ld>%ld]\n",
- (LI)drop, (LI)dn->digits);
- #endif
- dn->lsu[0]=0;
- dn->digits=1;
- return dn;
- }
- msu=dn->lsu+D2U(dn->digits-drop)-1; /* -> likely msu */
- cut=MSUDIGITS(dn->digits-drop); /* digits to be in use in msu */
- if (cut!=DECDPUN) *msu%=powers[cut]; /* clear left digits */
- /* that may have left leading zero digits, so do a proper count... */
- dn->digits=decGetDigits(dn->lsu, static_cast<int32_t>(msu-dn->lsu+1));
- return dn;
- } /* decDecap */
-
-/* ------------------------------------------------------------------ */
-/* decBiStr -- compare string with pairwise options */
-/* */
-/* targ is the string to compare */
-/* str1 is one of the strings to compare against (length may be 0) */
-/* str2 is the other; it must be the same length as str1 */
-/* */
-/* returns 1 if strings compare equal, (that is, it is the same */
-/* length as str1 and str2, and each character of targ is in either */
-/* str1 or str2 in the corresponding position), or 0 otherwise */
-/* */
-/* This is used for generic caseless compare, including the awkward */
-/* case of the Turkish dotted and dotless Is. Use as (for example): */
-/* if (decBiStr(test, "mike", "MIKE")) ... */
-/* ------------------------------------------------------------------ */
-static Flag decBiStr(const char *targ, const char *str1, const char *str2) {
- for (;;targ++, str1++, str2++) {
- if (*targ!=*str1 && *targ!=*str2) return 0;
- /* *targ has a match in one (or both, if terminator) */
- if (*targ=='\0') break;
- } /* forever */
- return 1;
- } /* decBiStr */
-
-/* ------------------------------------------------------------------ */
-/* decNaNs -- handle NaN operand or operands */
-/* */
-/* res is the result number */
-/* lhs is the first operand */
-/* rhs is the second operand, or NULL if none */
-/* context is used to limit payload length */
-/* status contains the current status */
-/* returns res in case convenient */
-/* */
-/* Called when one or both operands is a NaN, and propagates the */
-/* appropriate result to res. When an sNaN is found, it is changed */
-/* to a qNaN and Invalid operation is set. */
-/* ------------------------------------------------------------------ */
-static decNumber * decNaNs(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set,
- uInt *status) {
- /* This decision tree ends up with LHS being the source pointer, */
- /* and status updated if need be */
- if (lhs->bits & DECSNAN)
- *status|=DEC_Invalid_operation | DEC_sNaN;
- else if (rhs==NULL);
- else if (rhs->bits & DECSNAN) {
- lhs=rhs;
- *status|=DEC_Invalid_operation | DEC_sNaN;
- }
- else if (lhs->bits & DECNAN);
- else lhs=rhs;
-
- /* propagate the payload */
- if (lhs->digits<=set->digits) uprv_decNumberCopy(res, lhs); /* easy */
- else { /* too long */
- const Unit *ul;
- Unit *ur, *uresp1;
- /* copy safe number of units, then decapitate */
- res->bits=lhs->bits; /* need sign etc. */
- uresp1=res->lsu+D2U(set->digits);
- for (ur=res->lsu, ul=lhs->lsu; ur<uresp1; ur++, ul++) *ur=*ul;
- res->digits=D2U(set->digits)*DECDPUN;
- /* maybe still too long */
- if (res->digits>set->digits) decDecap(res, res->digits-set->digits);
- }
-
- res->bits&=~DECSNAN; /* convert any sNaN to NaN, while */
- res->bits|=DECNAN; /* .. preserving sign */
- res->exponent=0; /* clean exponent */
- /* [coefficient was copied/decapitated] */
- return res;
- } /* decNaNs */
-
-/* ------------------------------------------------------------------ */
-/* decStatus -- apply non-zero status */
-/* */
-/* dn is the number to set if error */
-/* status contains the current status (not yet in context) */
-/* set is the context */
-/* */
-/* If the status is an error status, the number is set to a NaN, */
-/* unless the error was an overflow, divide-by-zero, or underflow, */
-/* in which case the number will have already been set. */
-/* */
-/* The context status is then updated with the new status. Note that */
-/* this may raise a signal, so control may never return from this */
-/* routine (hence resources must be recovered before it is called). */
-/* ------------------------------------------------------------------ */
-static void decStatus(decNumber *dn, uInt status, decContext *set) {
- if (status & DEC_NaNs) { /* error status -> NaN */
- /* if cause was an sNaN, clear and propagate [NaN is already set up] */
- if (status & DEC_sNaN) status&=~DEC_sNaN;
- else {
- uprv_decNumberZero(dn); /* other error: clean throughout */
- dn->bits=DECNAN; /* and make a quiet NaN */
- }
- }
- uprv_decContextSetStatus(set, status); /* [may not return] */
- return;
- } /* decStatus */
-
-/* ------------------------------------------------------------------ */
-/* decGetDigits -- count digits in a Units array */
-/* */
-/* uar is the Unit array holding the number (this is often an */
-/* accumulator of some sort) */
-/* len is the length of the array in units [>=1] */
-/* */
-/* returns the number of (significant) digits in the array */
-/* */
-/* All leading zeros are excluded, except the last if the array has */
-/* only zero Units. */
-/* ------------------------------------------------------------------ */
-/* This may be called twice during some operations. */
-static Int decGetDigits(Unit *uar, Int len) {
- Unit *up=uar+(len-1); /* -> msu */
- Int digits=(len-1)*DECDPUN+1; /* possible digits excluding msu */
- #if DECDPUN>4
- uInt const *pow; /* work */
- #endif
- /* (at least 1 in final msu) */
- #if DECCHECK
- if (len<1) printf("decGetDigits called with len<1 [%ld]\n", (LI)len);
- #endif
-
- for (; up>=uar; up--) {
- if (*up==0) { /* unit is all 0s */
- if (digits==1) break; /* a zero has one digit */
- digits-=DECDPUN; /* adjust for 0 unit */
- continue;}
- /* found the first (most significant) non-zero Unit */
- #if DECDPUN>1 /* not done yet */
- if (*up<10) break; /* is 1-9 */
- digits++;
- #if DECDPUN>2 /* not done yet */
- if (*up<100) break; /* is 10-99 */
- digits++;
- #if DECDPUN>3 /* not done yet */
- if (*up<1000) break; /* is 100-999 */
- digits++;
- #if DECDPUN>4 /* count the rest ... */
- for (pow=&powers[4]; *up>=*pow; pow++) digits++;
- #endif
- #endif
- #endif
- #endif
- break;
- } /* up */
- return digits;
- } /* decGetDigits */
-
-#if DECTRACE | DECCHECK
-/* ------------------------------------------------------------------ */
-/* decNumberShow -- display a number [debug aid] */
-/* dn is the number to show */
-/* */
-/* Shows: sign, exponent, coefficient (msu first), digits */
-/* or: sign, special-value */
-/* ------------------------------------------------------------------ */
-/* this is public so other modules can use it */
-void uprv_decNumberShow(const decNumber *dn) {
- const Unit *up; /* work */
- uInt u, d; /* .. */
- Int cut; /* .. */
- char isign='+'; /* main sign */
- if (dn==NULL) {
- printf("NULL\n");
- return;}
- if (decNumberIsNegative(dn)) isign='-';
- printf(" >> %c ", isign);
- if (dn->bits&DECSPECIAL) { /* Is a special value */
- if (decNumberIsInfinite(dn)) printf("Infinity");
- else { /* a NaN */
- if (dn->bits&DECSNAN) printf("sNaN"); /* signalling NaN */
- else printf("NaN");
- }
- /* if coefficient and exponent are 0, no more to do */
- if (dn->exponent==0 && dn->digits==1 && *dn->lsu==0) {
- printf("\n");
- return;}
- /* drop through to report other information */
- printf(" ");
- }
-
- /* now carefully display the coefficient */
- up=dn->lsu+D2U(dn->digits)-1; /* msu */
- printf("%ld", (LI)*up);
- for (up=up-1; up>=dn->lsu; up--) {
- u=*up;
- printf(":");
- for (cut=DECDPUN-1; cut>=0; cut--) {
- d=u/powers[cut];
- u-=d*powers[cut];
- printf("%ld", (LI)d);
- } /* cut */
- } /* up */
- if (dn->exponent!=0) {
- char esign='+';
- if (dn->exponent<0) esign='-';
- printf(" E%c%ld", esign, (LI)abs(dn->exponent));
- }
- printf(" [%ld]\n", (LI)dn->digits);
- } /* decNumberShow */
-#endif
-
-#if DECTRACE || DECCHECK
-/* ------------------------------------------------------------------ */
-/* decDumpAr -- display a unit array [debug/check aid] */
-/* name is a single-character tag name */
-/* ar is the array to display */
-/* len is the length of the array in Units */
-/* ------------------------------------------------------------------ */
-static void decDumpAr(char name, const Unit *ar, Int len) {
- Int i;
- const char *spec;
- #if DECDPUN==9
- spec="%09d ";
- #elif DECDPUN==8
- spec="%08d ";
- #elif DECDPUN==7
- spec="%07d ";
- #elif DECDPUN==6
- spec="%06d ";
- #elif DECDPUN==5
- spec="%05d ";
- #elif DECDPUN==4
- spec="%04d ";
- #elif DECDPUN==3
- spec="%03d ";
- #elif DECDPUN==2
- spec="%02d ";
- #else
- spec="%d ";
- #endif
- printf(" :%c: ", name);
- for (i=len-1; i>=0; i--) {
- if (i==len-1) printf("%ld ", (LI)ar[i]);
- else printf(spec, ar[i]);
- }
- printf("\n");
- return;}
-#endif
-
-#if DECCHECK
-/* ------------------------------------------------------------------ */
-/* decCheckOperands -- check operand(s) to a routine */
-/* res is the result structure (not checked; it will be set to */
-/* quiet NaN if error found (and it is not NULL)) */
-/* lhs is the first operand (may be DECUNRESU) */
-/* rhs is the second (may be DECUNUSED) */
-/* set is the context (may be DECUNCONT) */
-/* returns 0 if both operands, and the context are clean, or 1 */
-/* otherwise (in which case the context will show an error, */
-/* unless NULL). Note that res is not cleaned; caller should */
-/* handle this so res=NULL case is safe. */
-/* The caller is expected to abandon immediately if 1 is returned. */
-/* ------------------------------------------------------------------ */
-static Flag decCheckOperands(decNumber *res, const decNumber *lhs,
- const decNumber *rhs, decContext *set) {
- Flag bad=0;
- if (set==NULL) { /* oops; hopeless */
- #if DECTRACE || DECVERB
- printf("Reference to context is NULL.\n");
- #endif
- bad=1;
- return 1;}
- else if (set!=DECUNCONT
- && (set->digits<1 || set->round>=DEC_ROUND_MAX)) {
- bad=1;
- #if DECTRACE || DECVERB
- printf("Bad context [digits=%ld round=%ld].\n",
- (LI)set->digits, (LI)set->round);
- #endif
- }
- else {
- if (res==NULL) {
- bad=1;
- #if DECTRACE
- /* this one not DECVERB as standard tests include NULL */
- printf("Reference to result is NULL.\n");
- #endif
- }
- if (!bad && lhs!=DECUNUSED) bad=(decCheckNumber(lhs));
- if (!bad && rhs!=DECUNUSED) bad=(decCheckNumber(rhs));
- }
- if (bad) {
- if (set!=DECUNCONT) uprv_decContextSetStatus(set, DEC_Invalid_operation);
- if (res!=DECUNRESU && res!=NULL) {
- uprv_decNumberZero(res);
- res->bits=DECNAN; /* qNaN */
- }
- }
- return bad;
- } /* decCheckOperands */
-
-/* ------------------------------------------------------------------ */
-/* decCheckNumber -- check a number */
-/* dn is the number to check */
-/* returns 0 if the number is clean, or 1 otherwise */
-/* */
-/* The number is considered valid if it could be a result from some */
-/* operation in some valid context. */
-/* ------------------------------------------------------------------ */
-static Flag decCheckNumber(const decNumber *dn) {
- const Unit *up; /* work */
- uInt maxuint; /* .. */
- Int ae, d, digits; /* .. */
- Int emin, emax; /* .. */
-
- if (dn==NULL) { /* hopeless */
- #if DECTRACE
- /* this one not DECVERB as standard tests include NULL */
- printf("Reference to decNumber is NULL.\n");
- #endif
- return 1;}
-
- /* check special values */
- if (dn->bits & DECSPECIAL) {
- if (dn->exponent!=0) {
- #if DECTRACE || DECVERB
- printf("Exponent %ld (not 0) for a special value [%02x].\n",
- (LI)dn->exponent, dn->bits);
- #endif
- return 1;}
-
- /* 2003.09.08: NaNs may now have coefficients, so next tests Inf only */
- if (decNumberIsInfinite(dn)) {
- if (dn->digits!=1) {
- #if DECTRACE || DECVERB
- printf("Digits %ld (not 1) for an infinity.\n", (LI)dn->digits);
- #endif
- return 1;}
- if (*dn->lsu!=0) {
- #if DECTRACE || DECVERB
- printf("LSU %ld (not 0) for an infinity.\n", (LI)*dn->lsu);
- #endif
- decDumpAr('I', dn->lsu, D2U(dn->digits));
- return 1;}
- } /* Inf */
- /* 2002.12.26: negative NaNs can now appear through proposed IEEE */
- /* concrete formats (decimal64, etc.). */
- return 0;
- }
-
- /* check the coefficient */
- if (dn->digits<1 || dn->digits>DECNUMMAXP) {
- #if DECTRACE || DECVERB
- printf("Digits %ld in number.\n", (LI)dn->digits);
- #endif
- return 1;}
-
- d=dn->digits;
-
- for (up=dn->lsu; d>0; up++) {
- if (d>DECDPUN) maxuint=DECDPUNMAX;
- else { /* reached the msu */
- maxuint=powers[d]-1;
- if (dn->digits>1 && *up<powers[d-1]) {
- #if DECTRACE || DECVERB
- printf("Leading 0 in number.\n");
- uprv_decNumberShow(dn);
- #endif
- return 1;}
- }
- if (*up>maxuint) {
- #if DECTRACE || DECVERB
- printf("Bad Unit [%08lx] in %ld-digit number at offset %ld [maxuint %ld].\n",
- (LI)*up, (LI)dn->digits, (LI)(up-dn->lsu), (LI)maxuint);
- #endif
- return 1;}
- d-=DECDPUN;
- }
-
- /* check the exponent. Note that input operands can have exponents */
- /* which are out of the set->emin/set->emax and set->digits range */
- /* (just as they can have more digits than set->digits). */
- ae=dn->exponent+dn->digits-1; /* adjusted exponent */
- emax=DECNUMMAXE;
- emin=DECNUMMINE;
- digits=DECNUMMAXP;
- if (ae<emin-(digits-1)) {
- #if DECTRACE || DECVERB
- printf("Adjusted exponent underflow [%ld].\n", (LI)ae);
- uprv_decNumberShow(dn);
- #endif
- return 1;}
- if (ae>+emax) {
- #if DECTRACE || DECVERB
- printf("Adjusted exponent overflow [%ld].\n", (LI)ae);
- uprv_decNumberShow(dn);
- #endif
- return 1;}
-
- return 0; /* it's OK */
- } /* decCheckNumber */
-
-/* ------------------------------------------------------------------ */
-/* decCheckInexact -- check a normal finite inexact result has digits */
-/* dn is the number to check */
-/* set is the context (for status and precision) */
-/* sets Invalid operation, etc., if some digits are missing */
-/* [this check is not made for DECSUBSET compilation or when */
-/* subnormal is not set] */
-/* ------------------------------------------------------------------ */
-static void decCheckInexact(const decNumber *dn, decContext *set) {
- #if !DECSUBSET && DECEXTFLAG
- if ((set->status & (DEC_Inexact|DEC_Subnormal))==DEC_Inexact
- && (set->digits!=dn->digits) && !(dn->bits & DECSPECIAL)) {
- #if DECTRACE || DECVERB
- printf("Insufficient digits [%ld] on normal Inexact result.\n",
- (LI)dn->digits);
- uprv_decNumberShow(dn);
- #endif
- uprv_decContextSetStatus(set, DEC_Invalid_operation);
- }
- #else
- /* next is a noop for quiet compiler */
- if (dn!=NULL && dn->digits==0) set->status|=DEC_Invalid_operation;
- #endif
- return;
- } /* decCheckInexact */
-#endif
-
-#if DECALLOC
-#undef malloc
-#undef free
-/* ------------------------------------------------------------------ */
-/* decMalloc -- accountable allocation routine */
-/* n is the number of bytes to allocate */
-/* */
-/* Semantics is the same as the stdlib malloc routine, but bytes */
-/* allocated are accounted for globally, and corruption fences are */
-/* added before and after the 'actual' storage. */
-/* ------------------------------------------------------------------ */
-/* This routine allocates storage with an extra twelve bytes; 8 are */
-/* at the start and hold: */
-/* 0-3 the original length requested */
-/* 4-7 buffer corruption detection fence (DECFENCE, x4) */
-/* The 4 bytes at the end also hold a corruption fence (DECFENCE, x4) */
-/* ------------------------------------------------------------------ */
-static void *decMalloc(size_t n) {
- uInt size=n+12; /* true size */
- void *alloc; /* -> allocated storage */
- uByte *b, *b0; /* work */
- uInt uiwork; /* for macros */
-
- alloc=malloc(size); /* -> allocated storage */
- if (alloc==NULL) return NULL; /* out of strorage */
- b0=(uByte *)alloc; /* as bytes */
- decAllocBytes+=n; /* account for storage */
- UBFROMUI(alloc, n); /* save n */
- /* printf(" alloc ++ dAB: %ld (%ld)\n", (LI)decAllocBytes, (LI)n); */
- for (b=b0+4; b<b0+8; b++) *b=DECFENCE;
- for (b=b0+n+8; b<b0+n+12; b++) *b=DECFENCE;
- return b0+8; /* -> play area */
- } /* decMalloc */
-
-/* ------------------------------------------------------------------ */
-/* decFree -- accountable free routine */
-/* alloc is the storage to free */
-/* */
-/* Semantics is the same as the stdlib malloc routine, except that */
-/* the global storage accounting is updated and the fences are */
-/* checked to ensure that no routine has written 'out of bounds'. */
-/* ------------------------------------------------------------------ */
-/* This routine first checks that the fences have not been corrupted. */
-/* It then frees the storage using the 'truw' storage address (that */
-/* is, offset by 8). */
-/* ------------------------------------------------------------------ */
-static void decFree(void *alloc) {
- uInt n; /* original length */
- uByte *b, *b0; /* work */
- uInt uiwork; /* for macros */
-
- if (alloc==NULL) return; /* allowed; it's a nop */
- b0=(uByte *)alloc; /* as bytes */
- b0-=8; /* -> true start of storage */
- n=UBTOUI(b0); /* lift length */
- for (b=b0+4; b<b0+8; b++) if (*b!=DECFENCE)
- printf("=== Corrupt byte [%02x] at offset %d from %ld ===\n", *b,
- b-b0-8, (LI)b0);
- for (b=b0+n+8; b<b0+n+12; b++) if (*b!=DECFENCE)
- printf("=== Corrupt byte [%02x] at offset +%d from %ld, n=%ld ===\n", *b,
- b-b0-8, (LI)b0, (LI)n);
- free(b0); /* drop the storage */
- decAllocBytes-=n; /* account for storage */
- /* printf(" free -- dAB: %d (%d)\n", decAllocBytes, -n); */
- } /* decFree */
-#define malloc(a) decMalloc(a)
-#define free(a) decFree(a)
-#endif
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/* ------------------------------------------------------------------ */
+/* Decimal Number arithmetic module */
+/* ------------------------------------------------------------------ */
+/* Copyright (c) IBM Corporation, 2000-2014. All rights reserved. */
+/* */
+/* This software is made available under the terms of the */
+/* ICU License -- ICU 1.8.1 and later. */
+/* */
+/* The description and User's Guide ("The decNumber C Library") for */
+/* this software is called decNumber.pdf. This document is */
+/* available, together with arithmetic and format specifications, */
+/* testcases, and Web links, on the General Decimal Arithmetic page. */
+/* */
+/* Please send comments, suggestions, and corrections to the author: */
+/* mfc@uk.ibm.com */
+/* Mike Cowlishaw, IBM Fellow */
+/* IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK */
+/* ------------------------------------------------------------------ */
+
+/* Modified version, for use from within ICU.
+ * Renamed public functions, to avoid an unwanted export of the
+ * standard names from the ICU library.
+ *
+ * Use ICU's uprv_malloc() and uprv_free()
+ *
+ * Revert comment syntax to plain C
+ *
+ * Remove a few compiler warnings.
+ */
+
+/* This module comprises the routines for arbitrary-precision General */
+/* Decimal Arithmetic as defined in the specification which may be */
+/* found on the General Decimal Arithmetic pages. It implements both */
+/* the full ('extended') arithmetic and the simpler ('subset') */
+/* arithmetic. */
+/* */
+/* Usage notes: */
+/* */
+/* 1. This code is ANSI C89 except: */
+/* */
+/* a) C99 line comments (double forward slash) are used. (Most C */
+/* compilers accept these. If yours does not, a simple script */
+/* can be used to convert them to ANSI C comments.) */
+/* */
+/* b) Types from C99 stdint.h are used. If you do not have this */
+/* header file, see the User's Guide section of the decNumber */
+/* documentation; this lists the necessary definitions. */
+/* */
+/* c) If DECDPUN>4 or DECUSE64=1, the C99 64-bit int64_t and */
+/* uint64_t types may be used. To avoid these, set DECUSE64=0 */
+/* and DECDPUN<=4 (see documentation). */
+/* */
+/* The code also conforms to C99 restrictions; in particular, */
+/* strict aliasing rules are observed. */
+/* */
+/* 2. The decNumber format which this library uses is optimized for */
+/* efficient processing of relatively short numbers; in particular */
+/* it allows the use of fixed sized structures and minimizes copy */
+/* and move operations. It does, however, support arbitrary */
+/* precision (up to 999,999,999 digits) and arbitrary exponent */
+/* range (Emax in the range 0 through 999,999,999 and Emin in the */
+/* range -999,999,999 through 0). Mathematical functions (for */
+/* example decNumberExp) as identified below are restricted more */
+/* tightly: digits, emax, and -emin in the context must be <= */
+/* DEC_MAX_MATH (999999), and their operand(s) must be within */
+/* these bounds. */
+/* */
+/* 3. Logical functions are further restricted; their operands must */
+/* be finite, positive, have an exponent of zero, and all digits */
+/* must be either 0 or 1. The result will only contain digits */
+/* which are 0 or 1 (and will have exponent=0 and a sign of 0). */
+/* */
+/* 4. Operands to operator functions are never modified unless they */
+/* are also specified to be the result number (which is always */
+/* permitted). Other than that case, operands must not overlap. */
+/* */
+/* 5. Error handling: the type of the error is ORed into the status */
+/* flags in the current context (decContext structure). The */
+/* SIGFPE signal is then raised if the corresponding trap-enabler */
+/* flag in the decContext is set (is 1). */
+/* */
+/* It is the responsibility of the caller to clear the status */
+/* flags as required. */
+/* */
+/* The result of any routine which returns a number will always */
+/* be a valid number (which may be a special value, such as an */
+/* Infinity or NaN). */
+/* */
+/* 6. The decNumber format is not an exchangeable concrete */
+/* representation as it comprises fields which may be machine- */
+/* dependent (packed or unpacked, or special length, for example). */
+/* Canonical conversions to and from strings are provided; other */
+/* conversions are available in separate modules. */
+/* */
+/* 7. Normally, input operands are assumed to be valid. Set DECCHECK */
+/* to 1 for extended operand checking (including NULL operands). */
+/* Results are undefined if a badly-formed structure (or a NULL */
+/* pointer to a structure) is provided, though with DECCHECK */
+/* enabled the operator routines are protected against exceptions. */
+/* (Except if the result pointer is NULL, which is unrecoverable.) */
+/* */
+/* However, the routines will never cause exceptions if they are */
+/* given well-formed operands, even if the value of the operands */
+/* is inappropriate for the operation and DECCHECK is not set. */
+/* (Except for SIGFPE, as and where documented.) */
+/* */
+/* 8. Subset arithmetic is available only if DECSUBSET is set to 1. */
+/* ------------------------------------------------------------------ */
+/* Implementation notes for maintenance of this module: */
+/* */
+/* 1. Storage leak protection: Routines which use malloc are not */
+/* permitted to use return for fastpath or error exits (i.e., */
+/* they follow strict structured programming conventions). */
+/* Instead they have a do{}while(0); construct surrounding the */
+/* code which is protected -- break may be used to exit this. */
+/* Other routines can safely use the return statement inline. */
+/* */
+/* Storage leak accounting can be enabled using DECALLOC. */
+/* */
+/* 2. All loops use the for(;;) construct. Any do construct does */
+/* not loop; it is for allocation protection as just described. */
+/* */
+/* 3. Setting status in the context must always be the very last */
+/* action in a routine, as non-0 status may raise a trap and hence */
+/* the call to set status may not return (if the handler uses long */
+/* jump). Therefore all cleanup must be done first. In general, */
+/* to achieve this status is accumulated and is only applied just */
+/* before return by calling decContextSetStatus (via decStatus). */
+/* */
+/* Routines which allocate storage cannot, in general, use the */
+/* 'top level' routines which could cause a non-returning */
+/* transfer of control. The decXxxxOp routines are safe (do not */
+/* call decStatus even if traps are set in the context) and should */
+/* be used instead (they are also a little faster). */
+/* */
+/* 4. Exponent checking is minimized by allowing the exponent to */
+/* grow outside its limits during calculations, provided that */
+/* the decFinalize function is called later. Multiplication and */
+/* division, and intermediate calculations in exponentiation, */
+/* require more careful checks because of the risk of 31-bit */
+/* overflow (the most negative valid exponent is -1999999997, for */
+/* a 999999999-digit number with adjusted exponent of -999999999). */
+/* */
+/* 5. Rounding is deferred until finalization of results, with any */
+/* 'off to the right' data being represented as a single digit */
+/* residue (in the range -1 through 9). This avoids any double- */
+/* rounding when more than one shortening takes place (for */
+/* example, when a result is subnormal). */
+/* */
+/* 6. The digits count is allowed to rise to a multiple of DECDPUN */
+/* during many operations, so whole Units are handled and exact */
+/* accounting of digits is not needed. The correct digits value */
+/* is found by decGetDigits, which accounts for leading zeros. */
+/* This must be called before any rounding if the number of digits */
+/* is not known exactly. */
+/* */
+/* 7. The multiply-by-reciprocal 'trick' is used for partitioning */
+/* numbers up to four digits, using appropriate constants. This */
+/* is not useful for longer numbers because overflow of 32 bits */
+/* would lead to 4 multiplies, which is almost as expensive as */
+/* a divide (unless a floating-point or 64-bit multiply is */
+/* assumed to be available). */
+/* */
+/* 8. Unusual abbreviations that may be used in the commentary: */
+/* lhs -- left hand side (operand, of an operation) */
+/* lsd -- least significant digit (of coefficient) */
+/* lsu -- least significant Unit (of coefficient) */
+/* msd -- most significant digit (of coefficient) */
+/* msi -- most significant item (in an array) */
+/* msu -- most significant Unit (of coefficient) */
+/* rhs -- right hand side (operand, of an operation) */
+/* +ve -- positive */
+/* -ve -- negative */
+/* ** -- raise to the power */
+/* ------------------------------------------------------------------ */
+
+#include <stdlib.h> /* for malloc, free, etc. */
+/* #include <stdio.h> */ /* for printf [if needed] */
+#include <string.h> /* for strcpy */
+#include <ctype.h> /* for lower */
+#include "cmemory.h" /* for uprv_malloc, etc., in ICU */
+#include "decNumber.h" /* base number library */
+#include "decNumberLocal.h" /* decNumber local types, etc. */
+#include "uassert.h"
+
+/* Constants */
+/* Public lookup table used by the D2U macro */
+static const uByte d2utable[DECMAXD2U+1]=D2UTABLE;
+
+#define DECVERB 1 /* set to 1 for verbose DECCHECK */
+#define powers DECPOWERS /* old internal name */
+
+/* Local constants */
+#define DIVIDE 0x80 /* Divide operators */
+#define REMAINDER 0x40 /* .. */
+#define DIVIDEINT 0x20 /* .. */
+#define REMNEAR 0x10 /* .. */
+#define COMPARE 0x01 /* Compare operators */
+#define COMPMAX 0x02 /* .. */
+#define COMPMIN 0x03 /* .. */
+#define COMPTOTAL 0x04 /* .. */
+#define COMPNAN 0x05 /* .. [NaN processing] */
+#define COMPSIG 0x06 /* .. [signaling COMPARE] */
+#define COMPMAXMAG 0x07 /* .. */
+#define COMPMINMAG 0x08 /* .. */
+
+#define DEC_sNaN 0x40000000 /* local status: sNaN signal */
+#define BADINT (Int)0x80000000 /* most-negative Int; error indicator */
+/* Next two indicate an integer >= 10**6, and its parity (bottom bit) */
+#define BIGEVEN (Int)0x80000002
+#define BIGODD (Int)0x80000003
+
+static const Unit uarrone[1]={1}; /* Unit array of 1, used for incrementing */
+
+/* ------------------------------------------------------------------ */
+/* round-for-reround digits */
+/* ------------------------------------------------------------------ */
+#if 0
+static const uByte DECSTICKYTAB[10]={1,1,2,3,4,6,6,7,8,9}; /* used if sticky */
+#endif
+
+/* ------------------------------------------------------------------ */
+/* Powers of ten (powers[n]==10**n, 0<=n<=9) */
+/* ------------------------------------------------------------------ */
+static const uInt DECPOWERS[10]={1, 10, 100, 1000, 10000, 100000, 1000000,
+ 10000000, 100000000, 1000000000};
+
+
+/* Granularity-dependent code */
+#if DECDPUN<=4
+ #define eInt Int /* extended integer */
+ #define ueInt uInt /* unsigned extended integer */
+ /* Constant multipliers for divide-by-power-of five using reciprocal */
+ /* multiply, after removing powers of 2 by shifting, and final shift */
+ /* of 17 [we only need up to **4] */
+ static const uInt multies[]={131073, 26215, 5243, 1049, 210};
+ /* QUOT10 -- macro to return the quotient of unit u divided by 10**n */
+ #define QUOT10(u, n) ((((uInt)(u)>>(n))*multies[n])>>17)
+#else
+ /* For DECDPUN>4 non-ANSI-89 64-bit types are needed. */
+ #if !DECUSE64
+ #error decNumber.c: DECUSE64 must be 1 when DECDPUN>4
+ #endif
+ #define eInt Long /* extended integer */
+ #define ueInt uLong /* unsigned extended integer */
+#endif
+
+/* Local routines */
+static decNumber * decAddOp(decNumber *, const decNumber *, const decNumber *,
+ decContext *, uByte, uInt *);
+static Flag decBiStr(const char *, const char *, const char *);
+static uInt decCheckMath(const decNumber *, decContext *, uInt *);
+static void decApplyRound(decNumber *, decContext *, Int, uInt *);
+static Int decCompare(const decNumber *lhs, const decNumber *rhs, Flag);
+static decNumber * decCompareOp(decNumber *, const decNumber *,
+ const decNumber *, decContext *,
+ Flag, uInt *);
+static void decCopyFit(decNumber *, const decNumber *, decContext *,
+ Int *, uInt *);
+static decNumber * decDecap(decNumber *, Int);
+static decNumber * decDivideOp(decNumber *, const decNumber *,
+ const decNumber *, decContext *, Flag, uInt *);
+static decNumber * decExpOp(decNumber *, const decNumber *,
+ decContext *, uInt *);
+static void decFinalize(decNumber *, decContext *, Int *, uInt *);
+static Int decGetDigits(Unit *, Int);
+static Int decGetInt(const decNumber *);
+static decNumber * decLnOp(decNumber *, const decNumber *,
+ decContext *, uInt *);
+static decNumber * decMultiplyOp(decNumber *, const decNumber *,
+ const decNumber *, decContext *,
+ uInt *);
+static decNumber * decNaNs(decNumber *, const decNumber *,
+ const decNumber *, decContext *, uInt *);
+static decNumber * decQuantizeOp(decNumber *, const decNumber *,
+ const decNumber *, decContext *, Flag,
+ uInt *);
+static void decReverse(Unit *, Unit *);
+static void decSetCoeff(decNumber *, decContext *, const Unit *,
+ Int, Int *, uInt *);
+static void decSetMaxValue(decNumber *, decContext *);
+static void decSetOverflow(decNumber *, decContext *, uInt *);
+static void decSetSubnormal(decNumber *, decContext *, Int *, uInt *);
+static Int decShiftToLeast(Unit *, Int, Int);
+static Int decShiftToMost(Unit *, Int, Int);
+static void decStatus(decNumber *, uInt, decContext *);
+static void decToString(const decNumber *, char[], Flag);
+static decNumber * decTrim(decNumber *, decContext *, Flag, Flag, Int *);
+static Int decUnitAddSub(const Unit *, Int, const Unit *, Int, Int,
+ Unit *, Int);
+static Int decUnitCompare(const Unit *, Int, const Unit *, Int, Int);
+
+#if !DECSUBSET
+/* decFinish == decFinalize when no subset arithmetic needed */
+#define decFinish(a,b,c,d) decFinalize(a,b,c,d)
+#else
+static void decFinish(decNumber *, decContext *, Int *, uInt *);
+static decNumber * decRoundOperand(const decNumber *, decContext *, uInt *);
+#endif
+
+/* Local macros */
+/* masked special-values bits */
+#define SPECIALARG (rhs->bits & DECSPECIAL)
+#define SPECIALARGS ((lhs->bits | rhs->bits) & DECSPECIAL)
+
+/* For use in ICU */
+#define malloc(a) uprv_malloc(a)
+#define free(a) uprv_free(a)
+
+/* Diagnostic macros, etc. */
+#if DECALLOC
+/* Handle malloc/free accounting. If enabled, our accountable routines */
+/* are used; otherwise the code just goes straight to the system malloc */
+/* and free routines. */
+#define malloc(a) decMalloc(a)
+#define free(a) decFree(a)
+#define DECFENCE 0x5a /* corruption detector */
+/* 'Our' malloc and free: */
+static void *decMalloc(size_t);
+static void decFree(void *);
+uInt decAllocBytes=0; /* count of bytes allocated */
+/* Note that DECALLOC code only checks for storage buffer overflow. */
+/* To check for memory leaks, the decAllocBytes variable must be */
+/* checked to be 0 at appropriate times (e.g., after the test */
+/* harness completes a set of tests). This checking may be unreliable */
+/* if the testing is done in a multi-thread environment. */
+#endif
+
+#if DECCHECK
+/* Optional checking routines. Enabling these means that decNumber */
+/* and decContext operands to operator routines are checked for */
+/* correctness. This roughly doubles the execution time of the */
+/* fastest routines (and adds 600+ bytes), so should not normally be */
+/* used in 'production'. */
+/* decCheckInexact is used to check that inexact results have a full */
+/* complement of digits (where appropriate -- this is not the case */
+/* for Quantize, for example) */
+#define DECUNRESU ((decNumber *)(void *)0xffffffff)
+#define DECUNUSED ((const decNumber *)(void *)0xffffffff)
+#define DECUNCONT ((decContext *)(void *)(0xffffffff))
+static Flag decCheckOperands(decNumber *, const decNumber *,
+ const decNumber *, decContext *);
+static Flag decCheckNumber(const decNumber *);
+static void decCheckInexact(const decNumber *, decContext *);
+#endif
+
+#if DECTRACE || DECCHECK
+/* Optional trace/debugging routines (may or may not be used) */
+void decNumberShow(const decNumber *); /* displays the components of a number */
+static void decDumpAr(char, const Unit *, Int);
+#endif
+
+/* ================================================================== */
+/* Conversions */
+/* ================================================================== */
+
+/* ------------------------------------------------------------------ */
+/* from-int32 -- conversion from Int or uInt */
+/* */
+/* dn is the decNumber to receive the integer */
+/* in or uin is the integer to be converted */
+/* returns dn */
+/* */
+/* No error is possible. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromInt32(decNumber *dn, Int in) {
+ uInt unsig;
+ if (in>=0) unsig=in;
+ else { /* negative (possibly BADINT) */
+ if (in==BADINT) unsig=(uInt)1073741824*2; /* special case */
+ else unsig=-in; /* invert */
+ }
+ /* in is now positive */
+ uprv_decNumberFromUInt32(dn, unsig);
+ if (in<0) dn->bits=DECNEG; /* sign needed */
+ return dn;
+ } /* decNumberFromInt32 */
+
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromUInt32(decNumber *dn, uInt uin) {
+ Unit *up; /* work pointer */
+ uprv_decNumberZero(dn); /* clean */
+ if (uin==0) return dn; /* [or decGetDigits bad call] */
+ for (up=dn->lsu; uin>0; up++) {
+ *up=(Unit)(uin%(DECDPUNMAX+1));
+ uin=uin/(DECDPUNMAX+1);
+ }
+ dn->digits=decGetDigits(dn->lsu, static_cast<int32_t>(up - dn->lsu));
+ return dn;
+ } /* decNumberFromUInt32 */
+
+/* ------------------------------------------------------------------ */
+/* to-int32 -- conversion to Int or uInt */
+/* */
+/* dn is the decNumber to convert */
+/* set is the context for reporting errors */
+/* returns the converted decNumber, or 0 if Invalid is set */
+/* */
+/* Invalid is set if the decNumber does not have exponent==0 or if */
+/* it is a NaN, Infinite, or out-of-range. */
+/* ------------------------------------------------------------------ */
+U_CAPI Int U_EXPORT2 uprv_decNumberToInt32(const decNumber *dn, decContext *set) {
+ #if DECCHECK
+ if (decCheckOperands(DECUNRESU, DECUNUSED, dn, set)) return 0;
+ #endif
+
+ /* special or too many digits, or bad exponent */
+ if (dn->bits&DECSPECIAL || dn->digits>10 || dn->exponent!=0) ; /* bad */
+ else { /* is a finite integer with 10 or fewer digits */
+ Int d; /* work */
+ const Unit *up; /* .. */
+ uInt hi=0, lo; /* .. */
+ up=dn->lsu; /* -> lsu */
+ lo=*up; /* get 1 to 9 digits */
+ #if DECDPUN>1 /* split to higher */
+ hi=lo/10;
+ lo=lo%10;
+ #endif
+ up++;
+ /* collect remaining Units, if any, into hi */
+ for (d=DECDPUN; d<dn->digits; up++, d+=DECDPUN) hi+=*up*powers[d-1];
+ /* now low has the lsd, hi the remainder */
+ if (hi>214748364 || (hi==214748364 && lo>7)) { /* out of range? */
+ /* most-negative is a reprieve */
+ if (dn->bits&DECNEG && hi==214748364 && lo==8) return 0x80000000;
+ /* bad -- drop through */
+ }
+ else { /* in-range always */
+ Int i=X10(hi)+lo;
+ if (dn->bits&DECNEG) return -i;
+ return i;
+ }
+ } /* integer */
+ uprv_decContextSetStatus(set, DEC_Invalid_operation); /* [may not return] */
+ return 0;
+ } /* decNumberToInt32 */
+
+U_CAPI uInt U_EXPORT2 uprv_decNumberToUInt32(const decNumber *dn, decContext *set) {
+ #if DECCHECK
+ if (decCheckOperands(DECUNRESU, DECUNUSED, dn, set)) return 0;
+ #endif
+ /* special or too many digits, or bad exponent, or negative (<0) */
+ if (dn->bits&DECSPECIAL || dn->digits>10 || dn->exponent!=0
+ || (dn->bits&DECNEG && !ISZERO(dn))); /* bad */
+ else { /* is a finite integer with 10 or fewer digits */
+ Int d; /* work */
+ const Unit *up; /* .. */
+ uInt hi=0, lo; /* .. */
+ up=dn->lsu; /* -> lsu */
+ lo=*up; /* get 1 to 9 digits */
+ #if DECDPUN>1 /* split to higher */
+ hi=lo/10;
+ lo=lo%10;
+ #endif
+ up++;
+ /* collect remaining Units, if any, into hi */
+ for (d=DECDPUN; d<dn->digits; up++, d+=DECDPUN) hi+=*up*powers[d-1];
+
+ /* now low has the lsd, hi the remainder */
+ if (hi>429496729 || (hi==429496729 && lo>5)) ; /* no reprieve possible */
+ else return X10(hi)+lo;
+ } /* integer */
+ uprv_decContextSetStatus(set, DEC_Invalid_operation); /* [may not return] */
+ return 0;
+ } /* decNumberToUInt32 */
+
+/* ------------------------------------------------------------------ */
+/* to-scientific-string -- conversion to numeric string */
+/* to-engineering-string -- conversion to numeric string */
+/* */
+/* decNumberToString(dn, string); */
+/* decNumberToEngString(dn, string); */
+/* */
+/* dn is the decNumber to convert */
+/* string is the string where the result will be laid out */
+/* */
+/* string must be at least dn->digits+14 characters long */
+/* */
+/* No error is possible, and no status can be set. */
+/* ------------------------------------------------------------------ */
+U_CAPI char * U_EXPORT2 uprv_decNumberToString(const decNumber *dn, char *string){
+ decToString(dn, string, 0);
+ return string;
+ } /* DecNumberToString */
+
+U_CAPI char * U_EXPORT2 uprv_decNumberToEngString(const decNumber *dn, char *string){
+ decToString(dn, string, 1);
+ return string;
+ } /* DecNumberToEngString */
+
+/* ------------------------------------------------------------------ */
+/* to-number -- conversion from numeric string */
+/* */
+/* decNumberFromString -- convert string to decNumber */
+/* dn -- the number structure to fill */
+/* chars[] -- the string to convert ('\0' terminated) */
+/* set -- the context used for processing any error, */
+/* determining the maximum precision available */
+/* (set.digits), determining the maximum and minimum */
+/* exponent (set.emax and set.emin), determining if */
+/* extended values are allowed, and checking the */
+/* rounding mode if overflow occurs or rounding is */
+/* needed. */
+/* */
+/* The length of the coefficient and the size of the exponent are */
+/* checked by this routine, so the correct error (Underflow or */
+/* Overflow) can be reported or rounding applied, as necessary. */
+/* */
+/* If bad syntax is detected, the result will be a quiet NaN. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char chars[],
+ decContext *set) {
+ Int exponent=0; /* working exponent [assume 0] */
+ uByte bits=0; /* working flags [assume +ve] */
+ Unit *res; /* where result will be built */
+ Unit resbuff[SD2U(DECBUFFER+9)];/* local buffer in case need temporary */
+ /* [+9 allows for ln() constants] */
+ Unit *allocres=NULL; /* -> allocated result, iff allocated */
+ Int d=0; /* count of digits found in decimal part */
+ const char *dotchar=NULL; /* where dot was found */
+ const char *cfirst=chars; /* -> first character of decimal part */
+ const char *last=NULL; /* -> last digit of decimal part */
+ const char *c; /* work */
+ Unit *up; /* .. */
+ #if DECDPUN>1
+ Int cut, out; /* .. */
+ #endif
+ Int residue; /* rounding residue */
+ uInt status=0; /* error code */
+
+ #if DECCHECK
+ if (decCheckOperands(DECUNRESU, DECUNUSED, DECUNUSED, set))
+ return uprv_decNumberZero(dn);
+ #endif
+
+ do { /* status & malloc protection */
+ for (c=chars;; c++) { /* -> input character */
+ if (*c>='0' && *c<='9') { /* test for Arabic digit */
+ last=c;
+ d++; /* count of real digits */
+ continue; /* still in decimal part */
+ }
+ if (*c=='.' && dotchar==NULL) { /* first '.' */
+ dotchar=c; /* record offset into decimal part */
+ if (c==cfirst) cfirst++; /* first digit must follow */
+ continue;}
+ if (c==chars) { /* first in string... */
+ if (*c=='-') { /* valid - sign */
+ cfirst++;
+ bits=DECNEG;
+ continue;}
+ if (*c=='+') { /* valid + sign */
+ cfirst++;
+ continue;}
+ }
+ /* *c is not a digit, or a valid +, -, or '.' */
+ break;
+ } /* c */
+
+ if (last==NULL) { /* no digits yet */
+ status=DEC_Conversion_syntax;/* assume the worst */
+ if (*c=='\0') break; /* and no more to come... */
+ #if DECSUBSET
+ /* if subset then infinities and NaNs are not allowed */
+ if (!set->extended) break; /* hopeless */
+ #endif
+ /* Infinities and NaNs are possible, here */
+ if (dotchar!=NULL) break; /* .. unless had a dot */
+ uprv_decNumberZero(dn); /* be optimistic */
+ if (decBiStr(c, "infinity", "INFINITY")
+ || decBiStr(c, "inf", "INF")) {
+ dn->bits=bits | DECINF;
+ status=0; /* is OK */
+ break; /* all done */
+ }
+ /* a NaN expected */
+ /* 2003.09.10 NaNs are now permitted to have a sign */
+ dn->bits=bits | DECNAN; /* assume simple NaN */
+ if (*c=='s' || *c=='S') { /* looks like an sNaN */
+ c++;
+ dn->bits=bits | DECSNAN;
+ }
+ if (*c!='n' && *c!='N') break; /* check caseless "NaN" */
+ c++;
+ if (*c!='a' && *c!='A') break; /* .. */
+ c++;
+ if (*c!='n' && *c!='N') break; /* .. */
+ c++;
+ /* now either nothing, or nnnn payload, expected */
+ /* -> start of integer and skip leading 0s [including plain 0] */
+ for (cfirst=c; *cfirst=='0';) cfirst++;
+ if (*cfirst=='\0') { /* "NaN" or "sNaN", maybe with all 0s */
+ status=0; /* it's good */
+ break; /* .. */
+ }
+ /* something other than 0s; setup last and d as usual [no dots] */
+ for (c=cfirst;; c++, d++) {
+ if (*c<'0' || *c>'9') break; /* test for Arabic digit */
+ last=c;
+ }
+ if (*c!='\0') break; /* not all digits */
+ if (d>set->digits-1) {
+ /* [NB: payload in a decNumber can be full length unless */
+ /* clamped, in which case can only be digits-1] */
+ if (set->clamp) break;
+ if (d>set->digits) break;
+ } /* too many digits? */
+ /* good; drop through to convert the integer to coefficient */
+ status=0; /* syntax is OK */
+ bits=dn->bits; /* for copy-back */
+ } /* last==NULL */
+
+ else if (*c!='\0') { /* more to process... */
+ /* had some digits; exponent is only valid sequence now */
+ Flag nege; /* 1=negative exponent */
+ const char *firstexp; /* -> first significant exponent digit */
+ status=DEC_Conversion_syntax;/* assume the worst */
+ if (*c!='e' && *c!='E') break;
+ /* Found 'e' or 'E' -- now process explicit exponent */
+ /* 1998.07.11: sign no longer required */
+ nege=0;
+ c++; /* to (possible) sign */
+ if (*c=='-') {nege=1; c++;}
+ else if (*c=='+') c++;
+ if (*c=='\0') break;
+
+ for (; *c=='0' && *(c+1)!='\0';) c++; /* strip insignificant zeros */
+ firstexp=c; /* save exponent digit place */
+ uInt uexponent = 0; /* Avoid undefined behavior on signed int overflow */
+ for (; ;c++) {
+ if (*c<'0' || *c>'9') break; /* not a digit */
+ uexponent=X10(uexponent)+(uInt)*c-(uInt)'0';
+ } /* c */
+ exponent = (Int)uexponent;
+ /* if not now on a '\0', *c must not be a digit */
+ if (*c!='\0') break;
+
+ /* (this next test must be after the syntax checks) */
+ /* if it was too long the exponent may have wrapped, so check */
+ /* carefully and set it to a certain overflow if wrap possible */
+ if (c>=firstexp+9+1) {
+ if (c>firstexp+9+1 || *firstexp>'1') exponent=DECNUMMAXE*2;
+ /* [up to 1999999999 is OK, for example 1E-1000000998] */
+ }
+ if (nege) exponent=-exponent; /* was negative */
+ status=0; /* is OK */
+ } /* stuff after digits */
+
+ /* Here when whole string has been inspected; syntax is good */
+ /* cfirst->first digit (never dot), last->last digit (ditto) */
+
+ /* strip leading zeros/dot [leave final 0 if all 0's] */
+ if (*cfirst=='0') { /* [cfirst has stepped over .] */
+ for (c=cfirst; c<last; c++, cfirst++) {
+ if (*c=='.') continue; /* ignore dots */
+ if (*c!='0') break; /* non-zero found */
+ d--; /* 0 stripped */
+ } /* c */
+ #if DECSUBSET
+ /* make a rapid exit for easy zeros if !extended */
+ if (*cfirst=='0' && !set->extended) {
+ uprv_decNumberZero(dn); /* clean result */
+ break; /* [could be return] */
+ }
+ #endif
+ } /* at least one leading 0 */
+
+ /* Handle decimal point... */
+ if (dotchar!=NULL && dotchar<last) /* non-trailing '.' found? */
+ exponent -= static_cast<int32_t>(last-dotchar); /* adjust exponent */
+ /* [we can now ignore the .] */
+
+ /* OK, the digits string is good. Assemble in the decNumber, or in */
+ /* a temporary units array if rounding is needed */
+ if (d<=set->digits) res=dn->lsu; /* fits into supplied decNumber */
+ else { /* rounding needed */
+ Int needbytes=D2U(d)*sizeof(Unit);/* bytes needed */
+ res=resbuff; /* assume use local buffer */
+ if (needbytes>(Int)sizeof(resbuff)) { /* too big for local */
+ allocres=(Unit *)malloc(needbytes);
+ if (allocres==NULL) {status|=DEC_Insufficient_storage; break;}
+ res=allocres;
+ }
+ }
+ /* res now -> number lsu, buffer, or allocated storage for Unit array */
+
+ /* Place the coefficient into the selected Unit array */
+ /* [this is often 70% of the cost of this function when DECDPUN>1] */
+ #if DECDPUN>1
+ out=0; /* accumulator */
+ up=res+D2U(d)-1; /* -> msu */
+ cut=d-(up-res)*DECDPUN; /* digits in top unit */
+ for (c=cfirst;; c++) { /* along the digits */
+ if (*c=='.') continue; /* ignore '.' [don't decrement cut] */
+ out=X10(out)+(Int)*c-(Int)'0';
+ if (c==last) break; /* done [never get to trailing '.'] */
+ cut--;
+ if (cut>0) continue; /* more for this unit */
+ *up=(Unit)out; /* write unit */
+ up--; /* prepare for unit below.. */
+ cut=DECDPUN; /* .. */
+ out=0; /* .. */
+ } /* c */
+ *up=(Unit)out; /* write lsu */
+
+ #else
+ /* DECDPUN==1 */
+ up=res; /* -> lsu */
+ for (c=last; c>=cfirst; c--) { /* over each character, from least */
+ if (*c=='.') continue; /* ignore . [don't step up] */
+ *up=(Unit)((Int)*c-(Int)'0');
+ up++;
+ } /* c */
+ #endif
+
+ dn->bits=bits;
+ dn->exponent=exponent;
+ dn->digits=d;
+
+ /* if not in number (too long) shorten into the number */
+ if (d>set->digits) {
+ residue=0;
+ decSetCoeff(dn, set, res, d, &residue, &status);
+ /* always check for overflow or subnormal and round as needed */
+ decFinalize(dn, set, &residue, &status);
+ }
+ else { /* no rounding, but may still have overflow or subnormal */
+ /* [these tests are just for performance; finalize repeats them] */
+ if ((dn->exponent-1<set->emin-dn->digits)
+ || (dn->exponent-1>set->emax-set->digits)) {
+ residue=0;
+ decFinalize(dn, set, &residue, &status);
+ }
+ }
+ /* decNumberShow(dn); */
+ } while(0); /* [for break] */
+
+ if (allocres!=NULL) free(allocres); /* drop any storage used */
+ if (status!=0) decStatus(dn, status, set);
+ return dn;
+ } /* decNumberFromString */
+
+/* ================================================================== */
+/* Operators */
+/* ================================================================== */
+
+/* ------------------------------------------------------------------ */
+/* decNumberAbs -- absolute value operator */
+/* */
+/* This computes C = abs(A) */
+/* */
+/* res is C, the result. C may be A */
+/* rhs is A */
+/* set is the context */
+/* */
+/* See also decNumberCopyAbs for a quiet bitwise version of this. */
+/* C must have space for set->digits digits. */
+/* ------------------------------------------------------------------ */
+/* This has the same effect as decNumberPlus unless A is negative, */
+/* in which case it has the same effect as decNumberMinus. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberAbs(decNumber *res, const decNumber *rhs,
+ decContext *set) {
+ decNumber dzero; /* for 0 */
+ uInt status=0; /* accumulator */
+
+ #if DECCHECK
+ if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
+ #endif
+
+ uprv_decNumberZero(&dzero); /* set 0 */
+ dzero.exponent=rhs->exponent; /* [no coefficient expansion] */
+ decAddOp(res, &dzero, rhs, set, (uByte)(rhs->bits & DECNEG), &status);
+ if (status!=0) decStatus(res, status, set);
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberAbs */
+
+/* ------------------------------------------------------------------ */
+/* decNumberAdd -- add two Numbers */
+/* */
+/* This computes C = A + B */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X+X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* */
+/* C must have space for set->digits digits. */
+/* ------------------------------------------------------------------ */
+/* This just calls the routine shared with Subtract */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberAdd(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+ decAddOp(res, lhs, rhs, set, 0, &status);
+ if (status!=0) decStatus(res, status, set);
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberAdd */
+
+/* ------------------------------------------------------------------ */
+/* decNumberAnd -- AND two Numbers, digitwise */
+/* */
+/* This computes C = A & B */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X&X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context (used for result length and error report) */
+/* */
+/* C must have space for set->digits digits. */
+/* */
+/* Logical function restrictions apply (see above); a NaN is */
+/* returned with Invalid_operation if a restriction is violated. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberAnd(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ const Unit *ua, *ub; /* -> operands */
+ const Unit *msua, *msub; /* -> operand msus */
+ Unit *uc, *msuc; /* -> result and its msu */
+ Int msudigs; /* digits in res msu */
+ #if DECCHECK
+ if (decCheckOperands(res, lhs, rhs, set)) return res;
+ #endif
+
+ if (lhs->exponent!=0 || decNumberIsSpecial(lhs) || decNumberIsNegative(lhs)
+ || rhs->exponent!=0 || decNumberIsSpecial(rhs) || decNumberIsNegative(rhs)) {
+ decStatus(res, DEC_Invalid_operation, set);
+ return res;
+ }
+
+ /* operands are valid */
+ ua=lhs->lsu; /* bottom-up */
+ ub=rhs->lsu; /* .. */
+ uc=res->lsu; /* .. */
+ msua=ua+D2U(lhs->digits)-1; /* -> msu of lhs */
+ msub=ub+D2U(rhs->digits)-1; /* -> msu of rhs */
+ msuc=uc+D2U(set->digits)-1; /* -> msu of result */
+ msudigs=MSUDIGITS(set->digits); /* [faster than remainder] */
+ for (; uc<=msuc; ua++, ub++, uc++) { /* Unit loop */
+ Unit a, b; /* extract units */
+ if (ua>msua) a=0;
+ else a=*ua;
+ if (ub>msub) b=0;
+ else b=*ub;
+ *uc=0; /* can now write back */
+ if (a|b) { /* maybe 1 bits to examine */
+ Int i, j;
+ *uc=0; /* can now write back */
+ /* This loop could be unrolled and/or use BIN2BCD tables */
+ for (i=0; i<DECDPUN; i++) {
+ if (a&b&1) *uc=*uc+(Unit)powers[i]; /* effect AND */
+ j=a%10;
+ a=a/10;
+ j|=b%10;
+ b=b/10;
+ if (j>1) {
+ decStatus(res, DEC_Invalid_operation, set);
+ return res;
+ }
+ if (uc==msuc && i==msudigs-1) break; /* just did final digit */
+ } /* each digit */
+ } /* both OK */
+ } /* each unit */
+ /* [here uc-1 is the msu of the result] */
+ res->digits=decGetDigits(res->lsu, static_cast<int32_t>(uc - res->lsu));
+ res->exponent=0; /* integer */
+ res->bits=0; /* sign=0 */
+ return res; /* [no status to set] */
+ } /* decNumberAnd */
+
+/* ------------------------------------------------------------------ */
+/* decNumberCompare -- compare two Numbers */
+/* */
+/* This computes C = A ? B */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X?X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* */
+/* C must have space for one digit (or NaN). */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompare(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+ decCompareOp(res, lhs, rhs, set, COMPARE, &status);
+ if (status!=0) decStatus(res, status, set);
+ return res;
+ } /* decNumberCompare */
+
+/* ------------------------------------------------------------------ */
+/* decNumberCompareSignal -- compare, signalling on all NaNs */
+/* */
+/* This computes C = A ? B */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X?X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* */
+/* C must have space for one digit (or NaN). */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompareSignal(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+ decCompareOp(res, lhs, rhs, set, COMPSIG, &status);
+ if (status!=0) decStatus(res, status, set);
+ return res;
+ } /* decNumberCompareSignal */
+
+/* ------------------------------------------------------------------ */
+/* decNumberCompareTotal -- compare two Numbers, using total ordering */
+/* */
+/* This computes C = A ? B, under total ordering */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X?X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* */
+/* C must have space for one digit; the result will always be one of */
+/* -1, 0, or 1. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompareTotal(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+ decCompareOp(res, lhs, rhs, set, COMPTOTAL, &status);
+ if (status!=0) decStatus(res, status, set);
+ return res;
+ } /* decNumberCompareTotal */
+
+/* ------------------------------------------------------------------ */
+/* decNumberCompareTotalMag -- compare, total ordering of magnitudes */
+/* */
+/* This computes C = |A| ? |B|, under total ordering */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X?X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* */
+/* C must have space for one digit; the result will always be one of */
+/* -1, 0, or 1. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompareTotalMag(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+ uInt needbytes; /* for space calculations */
+ decNumber bufa[D2N(DECBUFFER+1)];/* +1 in case DECBUFFER=0 */
+ decNumber *allocbufa=NULL; /* -> allocated bufa, iff allocated */
+ decNumber bufb[D2N(DECBUFFER+1)];
+ decNumber *allocbufb=NULL; /* -> allocated bufb, iff allocated */
+ decNumber *a, *b; /* temporary pointers */
+
+ #if DECCHECK
+ if (decCheckOperands(res, lhs, rhs, set)) return res;
+ #endif
+
+ do { /* protect allocated storage */
+ /* if either is negative, take a copy and absolute */
+ if (decNumberIsNegative(lhs)) { /* lhs<0 */
+ a=bufa;
+ needbytes=sizeof(decNumber)+(D2U(lhs->digits)-1)*sizeof(Unit);
+ if (needbytes>sizeof(bufa)) { /* need malloc space */
+ allocbufa=(decNumber *)malloc(needbytes);
+ if (allocbufa==NULL) { /* hopeless -- abandon */
+ status|=DEC_Insufficient_storage;
+ break;}
+ a=allocbufa; /* use the allocated space */
+ }
+ uprv_decNumberCopy(a, lhs); /* copy content */
+ a->bits&=~DECNEG; /* .. and clear the sign */
+ lhs=a; /* use copy from here on */
+ }
+ if (decNumberIsNegative(rhs)) { /* rhs<0 */
+ b=bufb;
+ needbytes=sizeof(decNumber)+(D2U(rhs->digits)-1)*sizeof(Unit);
+ if (needbytes>sizeof(bufb)) { /* need malloc space */
+ allocbufb=(decNumber *)malloc(needbytes);
+ if (allocbufb==NULL) { /* hopeless -- abandon */
+ status|=DEC_Insufficient_storage;
+ break;}
+ b=allocbufb; /* use the allocated space */
+ }
+ uprv_decNumberCopy(b, rhs); /* copy content */
+ b->bits&=~DECNEG; /* .. and clear the sign */
+ rhs=b; /* use copy from here on */
+ }
+ decCompareOp(res, lhs, rhs, set, COMPTOTAL, &status);
+ } while(0); /* end protected */
+
+ if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */
+ if (allocbufb!=NULL) free(allocbufb); /* .. */
+ if (status!=0) decStatus(res, status, set);
+ return res;
+ } /* decNumberCompareTotalMag */
+
+/* ------------------------------------------------------------------ */
+/* decNumberDivide -- divide one number by another */
+/* */
+/* This computes C = A / B */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X/X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* */
+/* C must have space for set->digits digits. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberDivide(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+ decDivideOp(res, lhs, rhs, set, DIVIDE, &status);
+ if (status!=0) decStatus(res, status, set);
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberDivide */
+
+/* ------------------------------------------------------------------ */
+/* decNumberDivideInteger -- divide and return integer quotient */
+/* */
+/* This computes C = A # B, where # is the integer divide operator */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X#X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* */
+/* C must have space for set->digits digits. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberDivideInteger(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+ decDivideOp(res, lhs, rhs, set, DIVIDEINT, &status);
+ if (status!=0) decStatus(res, status, set);
+ return res;
+ } /* decNumberDivideInteger */
+
+/* ------------------------------------------------------------------ */
+/* decNumberExp -- exponentiation */
+/* */
+/* This computes C = exp(A) */
+/* */
+/* res is C, the result. C may be A */
+/* rhs is A */
+/* set is the context; note that rounding mode has no effect */
+/* */
+/* C must have space for set->digits digits. */
+/* */
+/* Mathematical function restrictions apply (see above); a NaN is */
+/* returned with Invalid_operation if a restriction is violated. */
+/* */
+/* Finite results will always be full precision and Inexact, except */
+/* when A is a zero or -Infinity (giving 1 or 0 respectively). */
+/* */
+/* An Inexact result is rounded using DEC_ROUND_HALF_EVEN; it will */
+/* almost always be correctly rounded, but may be up to 1 ulp in */
+/* error in rare cases. */
+/* ------------------------------------------------------------------ */
+/* This is a wrapper for decExpOp which can handle the slightly wider */
+/* (double) range needed by Ln (which has to be able to calculate */
+/* exp(-a) where a can be the tiniest number (Ntiny). */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberExp(decNumber *res, const decNumber *rhs,
+ decContext *set) {
+ uInt status=0; /* accumulator */
+ #if DECSUBSET
+ decNumber *allocrhs=NULL; /* non-NULL if rounded rhs allocated */
+ #endif
+
+ #if DECCHECK
+ if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
+ #endif
+
+ /* Check restrictions; these restrictions ensure that if h=8 (see */
+ /* decExpOp) then the result will either overflow or underflow to 0. */
+ /* Other math functions restrict the input range, too, for inverses. */
+ /* If not violated then carry out the operation. */
+ if (!decCheckMath(rhs, set, &status)) do { /* protect allocation */
+ #if DECSUBSET
+ if (!set->extended) {
+ /* reduce operand and set lostDigits status, as needed */
+ if (rhs->digits>set->digits) {
+ allocrhs=decRoundOperand(rhs, set, &status);
+ if (allocrhs==NULL) break;
+ rhs=allocrhs;
+ }
+ }
+ #endif
+ decExpOp(res, rhs, set, &status);
+ } while(0); /* end protected */
+
+ #if DECSUBSET
+ if (allocrhs !=NULL) free(allocrhs); /* drop any storage used */
+ #endif
+ /* apply significant status */
+ if (status!=0) decStatus(res, status, set);
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberExp */
+
+/* ------------------------------------------------------------------ */
+/* decNumberFMA -- fused multiply add */
+/* */
+/* This computes D = (A * B) + C with only one rounding */
+/* */
+/* res is D, the result. D may be A or B or C (e.g., X=FMA(X,X,X)) */
+/* lhs is A */
+/* rhs is B */
+/* fhs is C [far hand side] */
+/* set is the context */
+/* */
+/* Mathematical function restrictions apply (see above); a NaN is */
+/* returned with Invalid_operation if a restriction is violated. */
+/* */
+/* C must have space for set->digits digits. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberFMA(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, const decNumber *fhs,
+ decContext *set) {
+ uInt status=0; /* accumulator */
+ decContext dcmul; /* context for the multiplication */
+ uInt needbytes; /* for space calculations */
+ decNumber bufa[D2N(DECBUFFER*2+1)];
+ decNumber *allocbufa=NULL; /* -> allocated bufa, iff allocated */
+ decNumber *acc; /* accumulator pointer */
+ decNumber dzero; /* work */
+
+ #if DECCHECK
+ if (decCheckOperands(res, lhs, rhs, set)) return res;
+ if (decCheckOperands(res, fhs, DECUNUSED, set)) return res;
+ #endif
+
+ do { /* protect allocated storage */
+ #if DECSUBSET
+ if (!set->extended) { /* [undefined if subset] */
+ status|=DEC_Invalid_operation;
+ break;}
+ #endif
+ /* Check math restrictions [these ensure no overflow or underflow] */
+ if ((!decNumberIsSpecial(lhs) && decCheckMath(lhs, set, &status))
+ || (!decNumberIsSpecial(rhs) && decCheckMath(rhs, set, &status))
+ || (!decNumberIsSpecial(fhs) && decCheckMath(fhs, set, &status))) break;
+ /* set up context for multiply */
+ dcmul=*set;
+ dcmul.digits=lhs->digits+rhs->digits; /* just enough */
+ /* [The above may be an over-estimate for subset arithmetic, but that's OK] */
+ dcmul.emax=DEC_MAX_EMAX; /* effectively unbounded .. */
+ dcmul.emin=DEC_MIN_EMIN; /* [thanks to Math restrictions] */
+ /* set up decNumber space to receive the result of the multiply */
+ acc=bufa; /* may fit */
+ needbytes=sizeof(decNumber)+(D2U(dcmul.digits)-1)*sizeof(Unit);
+ if (needbytes>sizeof(bufa)) { /* need malloc space */
+ allocbufa=(decNumber *)malloc(needbytes);
+ if (allocbufa==NULL) { /* hopeless -- abandon */
+ status|=DEC_Insufficient_storage;
+ break;}
+ acc=allocbufa; /* use the allocated space */
+ }
+ /* multiply with extended range and necessary precision */
+ /*printf("emin=%ld\n", dcmul.emin); */
+ decMultiplyOp(acc, lhs, rhs, &dcmul, &status);
+ /* Only Invalid operation (from sNaN or Inf * 0) is possible in */
+ /* status; if either is seen than ignore fhs (in case it is */
+ /* another sNaN) and set acc to NaN unless we had an sNaN */
+ /* [decMultiplyOp leaves that to caller] */
+ /* Note sNaN has to go through addOp to shorten payload if */
+ /* necessary */
+ if ((status&DEC_Invalid_operation)!=0) {
+ if (!(status&DEC_sNaN)) { /* but be true invalid */
+ uprv_decNumberZero(res); /* acc not yet set */
+ res->bits=DECNAN;
+ break;
+ }
+ uprv_decNumberZero(&dzero); /* make 0 (any non-NaN would do) */
+ fhs=&dzero; /* use that */
+ }
+ #if DECCHECK
+ else { /* multiply was OK */
+ if (status!=0) printf("Status=%08lx after FMA multiply\n", (LI)status);
+ }
+ #endif
+ /* add the third operand and result -> res, and all is done */
+ decAddOp(res, acc, fhs, set, 0, &status);
+ } while(0); /* end protected */
+
+ if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */
+ if (status!=0) decStatus(res, status, set);
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberFMA */
+
+/* ------------------------------------------------------------------ */
+/* decNumberInvert -- invert a Number, digitwise */
+/* */
+/* This computes C = ~A */
+/* */
+/* res is C, the result. C may be A (e.g., X=~X) */
+/* rhs is A */
+/* set is the context (used for result length and error report) */
+/* */
+/* C must have space for set->digits digits. */
+/* */
+/* Logical function restrictions apply (see above); a NaN is */
+/* returned with Invalid_operation if a restriction is violated. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberInvert(decNumber *res, const decNumber *rhs,
+ decContext *set) {
+ const Unit *ua, *msua; /* -> operand and its msu */
+ Unit *uc, *msuc; /* -> result and its msu */
+ Int msudigs; /* digits in res msu */
+ #if DECCHECK
+ if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
+ #endif
+
+ if (rhs->exponent!=0 || decNumberIsSpecial(rhs) || decNumberIsNegative(rhs)) {
+ decStatus(res, DEC_Invalid_operation, set);
+ return res;
+ }
+ /* operand is valid */
+ ua=rhs->lsu; /* bottom-up */
+ uc=res->lsu; /* .. */
+ msua=ua+D2U(rhs->digits)-1; /* -> msu of rhs */
+ msuc=uc+D2U(set->digits)-1; /* -> msu of result */
+ msudigs=MSUDIGITS(set->digits); /* [faster than remainder] */
+ for (; uc<=msuc; ua++, uc++) { /* Unit loop */
+ Unit a; /* extract unit */
+ Int i, j; /* work */
+ if (ua>msua) a=0;
+ else a=*ua;
+ *uc=0; /* can now write back */
+ /* always need to examine all bits in rhs */
+ /* This loop could be unrolled and/or use BIN2BCD tables */
+ for (i=0; i<DECDPUN; i++) {
+ if ((~a)&1) *uc=*uc+(Unit)powers[i]; /* effect INVERT */
+ j=a%10;
+ a=a/10;
+ if (j>1) {
+ decStatus(res, DEC_Invalid_operation, set);
+ return res;
+ }
+ if (uc==msuc && i==msudigs-1) break; /* just did final digit */
+ } /* each digit */
+ } /* each unit */
+ /* [here uc-1 is the msu of the result] */
+ res->digits=decGetDigits(res->lsu, static_cast<int32_t>(uc - res->lsu));
+ res->exponent=0; /* integer */
+ res->bits=0; /* sign=0 */
+ return res; /* [no status to set] */
+ } /* decNumberInvert */
+
+/* ------------------------------------------------------------------ */
+/* decNumberLn -- natural logarithm */
+/* */
+/* This computes C = ln(A) */
+/* */
+/* res is C, the result. C may be A */
+/* rhs is A */
+/* set is the context; note that rounding mode has no effect */
+/* */
+/* C must have space for set->digits digits. */
+/* */
+/* Notable cases: */
+/* A<0 -> Invalid */
+/* A=0 -> -Infinity (Exact) */
+/* A=+Infinity -> +Infinity (Exact) */
+/* A=1 exactly -> 0 (Exact) */
+/* */
+/* Mathematical function restrictions apply (see above); a NaN is */
+/* returned with Invalid_operation if a restriction is violated. */
+/* */
+/* An Inexact result is rounded using DEC_ROUND_HALF_EVEN; it will */
+/* almost always be correctly rounded, but may be up to 1 ulp in */
+/* error in rare cases. */
+/* ------------------------------------------------------------------ */
+/* This is a wrapper for decLnOp which can handle the slightly wider */
+/* (+11) range needed by Ln, Log10, etc. (which may have to be able */
+/* to calculate at p+e+2). */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberLn(decNumber *res, const decNumber *rhs,
+ decContext *set) {
+ uInt status=0; /* accumulator */
+ #if DECSUBSET
+ decNumber *allocrhs=NULL; /* non-NULL if rounded rhs allocated */
+ #endif
+
+ #if DECCHECK
+ if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
+ #endif
+
+ /* Check restrictions; this is a math function; if not violated */
+ /* then carry out the operation. */
+ if (!decCheckMath(rhs, set, &status)) do { /* protect allocation */
+ #if DECSUBSET
+ if (!set->extended) {
+ /* reduce operand and set lostDigits status, as needed */
+ if (rhs->digits>set->digits) {
+ allocrhs=decRoundOperand(rhs, set, &status);
+ if (allocrhs==NULL) break;
+ rhs=allocrhs;
+ }
+ /* special check in subset for rhs=0 */
+ if (ISZERO(rhs)) { /* +/- zeros -> error */
+ status|=DEC_Invalid_operation;
+ break;}
+ } /* extended=0 */
+ #endif
+ decLnOp(res, rhs, set, &status);
+ } while(0); /* end protected */
+
+ #if DECSUBSET
+ if (allocrhs !=NULL) free(allocrhs); /* drop any storage used */
+ #endif
+ /* apply significant status */
+ if (status!=0) decStatus(res, status, set);
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberLn */
+
+/* ------------------------------------------------------------------ */
+/* decNumberLogB - get adjusted exponent, by 754 rules */
+/* */
+/* This computes C = adjustedexponent(A) */
+/* */
+/* res is C, the result. C may be A */
+/* rhs is A */
+/* set is the context, used only for digits and status */
+/* */
+/* C must have space for 10 digits (A might have 10**9 digits and */
+/* an exponent of +999999999, or one digit and an exponent of */
+/* -1999999999). */
+/* */
+/* This returns the adjusted exponent of A after (in theory) padding */
+/* with zeros on the right to set->digits digits while keeping the */
+/* same value. The exponent is not limited by emin/emax. */
+/* */
+/* Notable cases: */
+/* A<0 -> Use |A| */
+/* A=0 -> -Infinity (Division by zero) */
+/* A=Infinite -> +Infinity (Exact) */
+/* A=1 exactly -> 0 (Exact) */
+/* NaNs are propagated as usual */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberLogB(decNumber *res, const decNumber *rhs,
+ decContext *set) {
+ uInt status=0; /* accumulator */
+
+ #if DECCHECK
+ if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
+ #endif
+
+ /* NaNs as usual; Infinities return +Infinity; 0->oops */
+ if (decNumberIsNaN(rhs)) decNaNs(res, rhs, NULL, set, &status);
+ else if (decNumberIsInfinite(rhs)) uprv_decNumberCopyAbs(res, rhs);
+ else if (decNumberIsZero(rhs)) {
+ uprv_decNumberZero(res); /* prepare for Infinity */
+ res->bits=DECNEG|DECINF; /* -Infinity */
+ status|=DEC_Division_by_zero; /* as per 754 */
+ }
+ else { /* finite non-zero */
+ Int ae=rhs->exponent+rhs->digits-1; /* adjusted exponent */
+ uprv_decNumberFromInt32(res, ae); /* lay it out */
+ }
+
+ if (status!=0) decStatus(res, status, set);
+ return res;
+ } /* decNumberLogB */
+
+/* ------------------------------------------------------------------ */
+/* decNumberLog10 -- logarithm in base 10 */
+/* */
+/* This computes C = log10(A) */
+/* */
+/* res is C, the result. C may be A */
+/* rhs is A */
+/* set is the context; note that rounding mode has no effect */
+/* */
+/* C must have space for set->digits digits. */
+/* */
+/* Notable cases: */
+/* A<0 -> Invalid */
+/* A=0 -> -Infinity (Exact) */
+/* A=+Infinity -> +Infinity (Exact) */
+/* A=10**n (if n is an integer) -> n (Exact) */
+/* */
+/* Mathematical function restrictions apply (see above); a NaN is */
+/* returned with Invalid_operation if a restriction is violated. */
+/* */
+/* An Inexact result is rounded using DEC_ROUND_HALF_EVEN; it will */
+/* almost always be correctly rounded, but may be up to 1 ulp in */
+/* error in rare cases. */
+/* ------------------------------------------------------------------ */
+/* This calculates ln(A)/ln(10) using appropriate precision. For */
+/* ln(A) this is the max(p, rhs->digits + t) + 3, where p is the */
+/* requested digits and t is the number of digits in the exponent */
+/* (maximum 6). For ln(10) it is p + 3; this is often handled by the */
+/* fastpath in decLnOp. The final division is done to the requested */
+/* precision. */
+/* ------------------------------------------------------------------ */
+#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *res, const decNumber *rhs,
+ decContext *set) {
+ uInt status=0, ignore=0; /* status accumulators */
+ uInt needbytes; /* for space calculations */
+ Int p; /* working precision */
+ Int t; /* digits in exponent of A */
+
+ /* buffers for a and b working decimals */
+ /* (adjustment calculator, same size) */
+ decNumber bufa[D2N(DECBUFFER+2)];
+ decNumber *allocbufa=NULL; /* -> allocated bufa, iff allocated */
+ decNumber *a=bufa; /* temporary a */
+ decNumber bufb[D2N(DECBUFFER+2)];
+ decNumber *allocbufb=NULL; /* -> allocated bufb, iff allocated */
+ decNumber *b=bufb; /* temporary b */
+ decNumber bufw[D2N(10)]; /* working 2-10 digit number */
+ decNumber *w=bufw; /* .. */
+ #if DECSUBSET
+ decNumber *allocrhs=NULL; /* non-NULL if rounded rhs allocated */
+ #endif
+
+ decContext aset; /* working context */
+
+ #if DECCHECK
+ if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
+ #endif
+
+ /* Check restrictions; this is a math function; if not violated */
+ /* then carry out the operation. */
+ if (!decCheckMath(rhs, set, &status)) do { /* protect malloc */
+ #if DECSUBSET
+ if (!set->extended) {
+ /* reduce operand and set lostDigits status, as needed */
+ if (rhs->digits>set->digits) {
+ allocrhs=decRoundOperand(rhs, set, &status);
+ if (allocrhs==NULL) break;
+ rhs=allocrhs;
+ }
+ /* special check in subset for rhs=0 */
+ if (ISZERO(rhs)) { /* +/- zeros -> error */
+ status|=DEC_Invalid_operation;
+ break;}
+ } /* extended=0 */
+ #endif
+
+ uprv_decContextDefault(&aset, DEC_INIT_DECIMAL64); /* clean context */
+
+ /* handle exact powers of 10; only check if +ve finite */
+ if (!(rhs->bits&(DECNEG|DECSPECIAL)) && !ISZERO(rhs)) {
+ Int residue=0; /* (no residue) */
+ uInt copystat=0; /* clean status */
+
+ /* round to a single digit... */
+ aset.digits=1;
+ decCopyFit(w, rhs, &aset, &residue, &copystat); /* copy & shorten */
+ /* if exact and the digit is 1, rhs is a power of 10 */
+ if (!(copystat&DEC_Inexact) && w->lsu[0]==1) {
+ /* the exponent, conveniently, is the power of 10; making */
+ /* this the result needs a little care as it might not fit, */
+ /* so first convert it into the working number, and then move */
+ /* to res */
+ uprv_decNumberFromInt32(w, w->exponent);
+ residue=0;
+ decCopyFit(res, w, set, &residue, &status); /* copy & round */
+ decFinish(res, set, &residue, &status); /* cleanup/set flags */
+ break;
+ } /* not a power of 10 */
+ } /* not a candidate for exact */
+
+ /* simplify the information-content calculation to use 'total */
+ /* number of digits in a, including exponent' as compared to the */
+ /* requested digits, as increasing this will only rarely cost an */
+ /* iteration in ln(a) anyway */
+ t=6; /* it can never be >6 */
+
+ /* allocate space when needed... */
+ p=(rhs->digits+t>set->digits?rhs->digits+t:set->digits)+3;
+ needbytes=sizeof(decNumber)+(D2U(p)-1)*sizeof(Unit);
+ if (needbytes>sizeof(bufa)) { /* need malloc space */
+ allocbufa=(decNumber *)malloc(needbytes);
+ if (allocbufa==NULL) { /* hopeless -- abandon */
+ status|=DEC_Insufficient_storage;
+ break;}
+ a=allocbufa; /* use the allocated space */
+ }
+ aset.digits=p; /* as calculated */
+ aset.emax=DEC_MAX_MATH; /* usual bounds */
+ aset.emin=-DEC_MAX_MATH; /* .. */
+ aset.clamp=0; /* and no concrete format */
+ decLnOp(a, rhs, &aset, &status); /* a=ln(rhs) */
+
+ /* skip the division if the result so far is infinite, NaN, or */
+ /* zero, or there was an error; note NaN from sNaN needs copy */
+ if (status&DEC_NaNs && !(status&DEC_sNaN)) break;
+ if (a->bits&DECSPECIAL || ISZERO(a)) {
+ uprv_decNumberCopy(res, a); /* [will fit] */
+ break;}
+
+ /* for ln(10) an extra 3 digits of precision are needed */
+ p=set->digits+3;
+ needbytes=sizeof(decNumber)+(D2U(p)-1)*sizeof(Unit);
+ if (needbytes>sizeof(bufb)) { /* need malloc space */
+ allocbufb=(decNumber *)malloc(needbytes);
+ if (allocbufb==NULL) { /* hopeless -- abandon */
+ status|=DEC_Insufficient_storage;
+ break;}
+ b=allocbufb; /* use the allocated space */
+ }
+ uprv_decNumberZero(w); /* set up 10... */
+ #if DECDPUN==1
+ w->lsu[1]=1; w->lsu[0]=0; /* .. */
+ #else
+ w->lsu[0]=10; /* .. */
+ #endif
+ w->digits=2; /* .. */
+
+ aset.digits=p;
+ decLnOp(b, w, &aset, &ignore); /* b=ln(10) */
+
+ aset.digits=set->digits; /* for final divide */
+ decDivideOp(res, a, b, &aset, DIVIDE, &status); /* into result */
+ } while(0); /* [for break] */
+
+ if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */
+ if (allocbufb!=NULL) free(allocbufb); /* .. */
+ #if DECSUBSET
+ if (allocrhs !=NULL) free(allocrhs); /* .. */
+ #endif
+ /* apply significant status */
+ if (status!=0) decStatus(res, status, set);
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberLog10 */
+#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406
+#pragma GCC diagnostic pop
+#endif
+
+/* ------------------------------------------------------------------ */
+/* decNumberMax -- compare two Numbers and return the maximum */
+/* */
+/* This computes C = A ? B, returning the maximum by 754 rules */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X?X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* */
+/* C must have space for set->digits digits. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberMax(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+ decCompareOp(res, lhs, rhs, set, COMPMAX, &status);
+ if (status!=0) decStatus(res, status, set);
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberMax */
+
+/* ------------------------------------------------------------------ */
+/* decNumberMaxMag -- compare and return the maximum by magnitude */
+/* */
+/* This computes C = A ? B, returning the maximum by 754 rules */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X?X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* */
+/* C must have space for set->digits digits. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberMaxMag(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+ decCompareOp(res, lhs, rhs, set, COMPMAXMAG, &status);
+ if (status!=0) decStatus(res, status, set);
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberMaxMag */
+
+/* ------------------------------------------------------------------ */
+/* decNumberMin -- compare two Numbers and return the minimum */
+/* */
+/* This computes C = A ? B, returning the minimum by 754 rules */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X?X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* */
+/* C must have space for set->digits digits. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberMin(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+ decCompareOp(res, lhs, rhs, set, COMPMIN, &status);
+ if (status!=0) decStatus(res, status, set);
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberMin */
+
+/* ------------------------------------------------------------------ */
+/* decNumberMinMag -- compare and return the minimum by magnitude */
+/* */
+/* This computes C = A ? B, returning the minimum by 754 rules */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X?X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* */
+/* C must have space for set->digits digits. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberMinMag(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+ decCompareOp(res, lhs, rhs, set, COMPMINMAG, &status);
+ if (status!=0) decStatus(res, status, set);
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberMinMag */
+
+/* ------------------------------------------------------------------ */
+/* decNumberMinus -- prefix minus operator */
+/* */
+/* This computes C = 0 - A */
+/* */
+/* res is C, the result. C may be A */
+/* rhs is A */
+/* set is the context */
+/* */
+/* See also decNumberCopyNegate for a quiet bitwise version of this. */
+/* C must have space for set->digits digits. */
+/* ------------------------------------------------------------------ */
+/* Simply use AddOp for the subtract, which will do the necessary. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberMinus(decNumber *res, const decNumber *rhs,
+ decContext *set) {
+ decNumber dzero;
+ uInt status=0; /* accumulator */
+
+ #if DECCHECK
+ if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
+ #endif
+
+ uprv_decNumberZero(&dzero); /* make 0 */
+ dzero.exponent=rhs->exponent; /* [no coefficient expansion] */
+ decAddOp(res, &dzero, rhs, set, DECNEG, &status);
+ if (status!=0) decStatus(res, status, set);
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberMinus */
+
+/* ------------------------------------------------------------------ */
+/* decNumberNextMinus -- next towards -Infinity */
+/* */
+/* This computes C = A - infinitesimal, rounded towards -Infinity */
+/* */
+/* res is C, the result. C may be A */
+/* rhs is A */
+/* set is the context */
+/* */
+/* This is a generalization of 754 NextDown. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberNextMinus(decNumber *res, const decNumber *rhs,
+ decContext *set) {
+ decNumber dtiny; /* constant */
+ decContext workset=*set; /* work */
+ uInt status=0; /* accumulator */
+ #if DECCHECK
+ if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
+ #endif
+
+ /* +Infinity is the special case */
+ if ((rhs->bits&(DECINF|DECNEG))==DECINF) {
+ decSetMaxValue(res, set); /* is +ve */
+ /* there is no status to set */
+ return res;
+ }
+ uprv_decNumberZero(&dtiny); /* start with 0 */
+ dtiny.lsu[0]=1; /* make number that is .. */
+ dtiny.exponent=DEC_MIN_EMIN-1; /* .. smaller than tiniest */
+ workset.round=DEC_ROUND_FLOOR;
+ decAddOp(res, rhs, &dtiny, &workset, DECNEG, &status);
+ status&=DEC_Invalid_operation|DEC_sNaN; /* only sNaN Invalid please */
+ if (status!=0) decStatus(res, status, set);
+ return res;
+ } /* decNumberNextMinus */
+
+/* ------------------------------------------------------------------ */
+/* decNumberNextPlus -- next towards +Infinity */
+/* */
+/* This computes C = A + infinitesimal, rounded towards +Infinity */
+/* */
+/* res is C, the result. C may be A */
+/* rhs is A */
+/* set is the context */
+/* */
+/* This is a generalization of 754 NextUp. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberNextPlus(decNumber *res, const decNumber *rhs,
+ decContext *set) {
+ decNumber dtiny; /* constant */
+ decContext workset=*set; /* work */
+ uInt status=0; /* accumulator */
+ #if DECCHECK
+ if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
+ #endif
+
+ /* -Infinity is the special case */
+ if ((rhs->bits&(DECINF|DECNEG))==(DECINF|DECNEG)) {
+ decSetMaxValue(res, set);
+ res->bits=DECNEG; /* negative */
+ /* there is no status to set */
+ return res;
+ }
+ uprv_decNumberZero(&dtiny); /* start with 0 */
+ dtiny.lsu[0]=1; /* make number that is .. */
+ dtiny.exponent=DEC_MIN_EMIN-1; /* .. smaller than tiniest */
+ workset.round=DEC_ROUND_CEILING;
+ decAddOp(res, rhs, &dtiny, &workset, 0, &status);
+ status&=DEC_Invalid_operation|DEC_sNaN; /* only sNaN Invalid please */
+ if (status!=0) decStatus(res, status, set);
+ return res;
+ } /* decNumberNextPlus */
+
+/* ------------------------------------------------------------------ */
+/* decNumberNextToward -- next towards rhs */
+/* */
+/* This computes C = A +/- infinitesimal, rounded towards */
+/* +/-Infinity in the direction of B, as per 754-1985 nextafter */
+/* modified during revision but dropped from 754-2008. */
+/* */
+/* res is C, the result. C may be A or B. */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* */
+/* This is a generalization of 754-1985 NextAfter. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberNextToward(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ decNumber dtiny; /* constant */
+ decContext workset=*set; /* work */
+ Int result; /* .. */
+ uInt status=0; /* accumulator */
+ #if DECCHECK
+ if (decCheckOperands(res, lhs, rhs, set)) return res;
+ #endif
+
+ if (decNumberIsNaN(lhs) || decNumberIsNaN(rhs)) {
+ decNaNs(res, lhs, rhs, set, &status);
+ }
+ else { /* Is numeric, so no chance of sNaN Invalid, etc. */
+ result=decCompare(lhs, rhs, 0); /* sign matters */
+ if (result==BADINT) status|=DEC_Insufficient_storage; /* rare */
+ else { /* valid compare */
+ if (result==0) uprv_decNumberCopySign(res, lhs, rhs); /* easy */
+ else { /* differ: need NextPlus or NextMinus */
+ uByte sub; /* add or subtract */
+ if (result<0) { /* lhs<rhs, do nextplus */
+ /* -Infinity is the special case */
+ if ((lhs->bits&(DECINF|DECNEG))==(DECINF|DECNEG)) {
+ decSetMaxValue(res, set);
+ res->bits=DECNEG; /* negative */
+ return res; /* there is no status to set */
+ }
+ workset.round=DEC_ROUND_CEILING;
+ sub=0; /* add, please */
+ } /* plus */
+ else { /* lhs>rhs, do nextminus */
+ /* +Infinity is the special case */
+ if ((lhs->bits&(DECINF|DECNEG))==DECINF) {
+ decSetMaxValue(res, set);
+ return res; /* there is no status to set */
+ }
+ workset.round=DEC_ROUND_FLOOR;
+ sub=DECNEG; /* subtract, please */
+ } /* minus */
+ uprv_decNumberZero(&dtiny); /* start with 0 */
+ dtiny.lsu[0]=1; /* make number that is .. */
+ dtiny.exponent=DEC_MIN_EMIN-1; /* .. smaller than tiniest */
+ decAddOp(res, lhs, &dtiny, &workset, sub, &status); /* + or - */
+ /* turn off exceptions if the result is a normal number */
+ /* (including Nmin), otherwise let all status through */
+ if (uprv_decNumberIsNormal(res, set)) status=0;
+ } /* unequal */
+ } /* compare OK */
+ } /* numeric */
+ if (status!=0) decStatus(res, status, set);
+ return res;
+ } /* decNumberNextToward */
+
+/* ------------------------------------------------------------------ */
+/* decNumberOr -- OR two Numbers, digitwise */
+/* */
+/* This computes C = A | B */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X|X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context (used for result length and error report) */
+/* */
+/* C must have space for set->digits digits. */
+/* */
+/* Logical function restrictions apply (see above); a NaN is */
+/* returned with Invalid_operation if a restriction is violated. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberOr(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ const Unit *ua, *ub; /* -> operands */
+ const Unit *msua, *msub; /* -> operand msus */
+ Unit *uc, *msuc; /* -> result and its msu */
+ Int msudigs; /* digits in res msu */
+ #if DECCHECK
+ if (decCheckOperands(res, lhs, rhs, set)) return res;
+ #endif
+
+ if (lhs->exponent!=0 || decNumberIsSpecial(lhs) || decNumberIsNegative(lhs)
+ || rhs->exponent!=0 || decNumberIsSpecial(rhs) || decNumberIsNegative(rhs)) {
+ decStatus(res, DEC_Invalid_operation, set);
+ return res;
+ }
+ /* operands are valid */
+ ua=lhs->lsu; /* bottom-up */
+ ub=rhs->lsu; /* .. */
+ uc=res->lsu; /* .. */
+ msua=ua+D2U(lhs->digits)-1; /* -> msu of lhs */
+ msub=ub+D2U(rhs->digits)-1; /* -> msu of rhs */
+ msuc=uc+D2U(set->digits)-1; /* -> msu of result */
+ msudigs=MSUDIGITS(set->digits); /* [faster than remainder] */
+ for (; uc<=msuc; ua++, ub++, uc++) { /* Unit loop */
+ Unit a, b; /* extract units */
+ if (ua>msua) a=0;
+ else a=*ua;
+ if (ub>msub) b=0;
+ else b=*ub;
+ *uc=0; /* can now write back */
+ if (a|b) { /* maybe 1 bits to examine */
+ Int i, j;
+ /* This loop could be unrolled and/or use BIN2BCD tables */
+ for (i=0; i<DECDPUN; i++) {
+ if ((a|b)&1) *uc=*uc+(Unit)powers[i]; /* effect OR */
+ j=a%10;
+ a=a/10;
+ j|=b%10;
+ b=b/10;
+ if (j>1) {
+ decStatus(res, DEC_Invalid_operation, set);
+ return res;
+ }
+ if (uc==msuc && i==msudigs-1) break; /* just did final digit */
+ } /* each digit */
+ } /* non-zero */
+ } /* each unit */
+ /* [here uc-1 is the msu of the result] */
+ res->digits=decGetDigits(res->lsu, static_cast<int32_t>(uc-res->lsu));
+ res->exponent=0; /* integer */
+ res->bits=0; /* sign=0 */
+ return res; /* [no status to set] */
+ } /* decNumberOr */
+
+/* ------------------------------------------------------------------ */
+/* decNumberPlus -- prefix plus operator */
+/* */
+/* This computes C = 0 + A */
+/* */
+/* res is C, the result. C may be A */
+/* rhs is A */
+/* set is the context */
+/* */
+/* See also decNumberCopy for a quiet bitwise version of this. */
+/* C must have space for set->digits digits. */
+/* ------------------------------------------------------------------ */
+/* This simply uses AddOp; Add will take fast path after preparing A. */
+/* Performance is a concern here, as this routine is often used to */
+/* check operands and apply rounding and overflow/underflow testing. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberPlus(decNumber *res, const decNumber *rhs,
+ decContext *set) {
+ decNumber dzero;
+ uInt status=0; /* accumulator */
+ #if DECCHECK
+ if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
+ #endif
+
+ uprv_decNumberZero(&dzero); /* make 0 */
+ dzero.exponent=rhs->exponent; /* [no coefficient expansion] */
+ decAddOp(res, &dzero, rhs, set, 0, &status);
+ if (status!=0) decStatus(res, status, set);
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberPlus */
+
+/* ------------------------------------------------------------------ */
+/* decNumberMultiply -- multiply two Numbers */
+/* */
+/* This computes C = A x B */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X+X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* */
+/* C must have space for set->digits digits. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberMultiply(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+ decMultiplyOp(res, lhs, rhs, set, &status);
+ if (status!=0) decStatus(res, status, set);
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberMultiply */
+
+/* ------------------------------------------------------------------ */
+/* decNumberPower -- raise a number to a power */
+/* */
+/* This computes C = A ** B */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X**X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* */
+/* C must have space for set->digits digits. */
+/* */
+/* Mathematical function restrictions apply (see above); a NaN is */
+/* returned with Invalid_operation if a restriction is violated. */
+/* */
+/* However, if 1999999997<=B<=999999999 and B is an integer then the */
+/* restrictions on A and the context are relaxed to the usual bounds, */
+/* for compatibility with the earlier (integer power only) version */
+/* of this function. */
+/* */
+/* When B is an integer, the result may be exact, even if rounded. */
+/* */
+/* The final result is rounded according to the context; it will */
+/* almost always be correctly rounded, but may be up to 1 ulp in */
+/* error in rare cases. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberPower(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ #if DECSUBSET
+ decNumber *alloclhs=NULL; /* non-NULL if rounded lhs allocated */
+ decNumber *allocrhs=NULL; /* .., rhs */
+ #endif
+ decNumber *allocdac=NULL; /* -> allocated acc buffer, iff used */
+ decNumber *allocinv=NULL; /* -> allocated 1/x buffer, iff used */
+ Int reqdigits=set->digits; /* requested DIGITS */
+ Int n; /* rhs in binary */
+ Flag rhsint=0; /* 1 if rhs is an integer */
+ Flag useint=0; /* 1 if can use integer calculation */
+ Flag isoddint=0; /* 1 if rhs is an integer and odd */
+ Int i; /* work */
+ #if DECSUBSET
+ Int dropped; /* .. */
+ #endif
+ uInt needbytes; /* buffer size needed */
+ Flag seenbit; /* seen a bit while powering */
+ Int residue=0; /* rounding residue */
+ uInt status=0; /* accumulators */
+ uByte bits=0; /* result sign if errors */
+ decContext aset; /* working context */
+ decNumber dnOne; /* work value 1... */
+ /* local accumulator buffer [a decNumber, with digits+elength+1 digits] */
+ decNumber dacbuff[D2N(DECBUFFER+9)];
+ decNumber *dac=dacbuff; /* -> result accumulator */
+ /* same again for possible 1/lhs calculation */
+ decNumber invbuff[D2N(DECBUFFER+9)];
+
+ #if DECCHECK
+ if (decCheckOperands(res, lhs, rhs, set)) return res;
+ #endif
+
+ do { /* protect allocated storage */
+ #if DECSUBSET
+ if (!set->extended) { /* reduce operands and set status, as needed */
+ if (lhs->digits>reqdigits) {
+ alloclhs=decRoundOperand(lhs, set, &status);
+ if (alloclhs==NULL) break;
+ lhs=alloclhs;
+ }
+ if (rhs->digits>reqdigits) {
+ allocrhs=decRoundOperand(rhs, set, &status);
+ if (allocrhs==NULL) break;
+ rhs=allocrhs;
+ }
+ }
+ #endif
+ /* [following code does not require input rounding] */
+
+ /* handle NaNs and rhs Infinity (lhs infinity is harder) */
+ if (SPECIALARGS) {
+ if (decNumberIsNaN(lhs) || decNumberIsNaN(rhs)) { /* NaNs */
+ decNaNs(res, lhs, rhs, set, &status);
+ break;}
+ if (decNumberIsInfinite(rhs)) { /* rhs Infinity */
+ Flag rhsneg=rhs->bits&DECNEG; /* save rhs sign */
+ if (decNumberIsNegative(lhs) /* lhs<0 */
+ && !decNumberIsZero(lhs)) /* .. */
+ status|=DEC_Invalid_operation;
+ else { /* lhs >=0 */
+ uprv_decNumberZero(&dnOne); /* set up 1 */
+ dnOne.lsu[0]=1;
+ uprv_decNumberCompare(dac, lhs, &dnOne, set); /* lhs ? 1 */
+ uprv_decNumberZero(res); /* prepare for 0/1/Infinity */
+ if (decNumberIsNegative(dac)) { /* lhs<1 */
+ if (rhsneg) res->bits|=DECINF; /* +Infinity [else is +0] */
+ }
+ else if (dac->lsu[0]==0) { /* lhs=1 */
+ /* 1**Infinity is inexact, so return fully-padded 1.0000 */
+ Int shift=set->digits-1;
+ *res->lsu=1; /* was 0, make int 1 */
+ res->digits=decShiftToMost(res->lsu, 1, shift);
+ res->exponent=-shift; /* make 1.0000... */
+ status|=DEC_Inexact|DEC_Rounded; /* deemed inexact */
+ }
+ else { /* lhs>1 */
+ if (!rhsneg) res->bits|=DECINF; /* +Infinity [else is +0] */
+ }
+ } /* lhs>=0 */
+ break;}
+ /* [lhs infinity drops through] */
+ } /* specials */
+
+ /* Original rhs may be an integer that fits and is in range */
+ n=decGetInt(rhs);
+ if (n!=BADINT) { /* it is an integer */
+ rhsint=1; /* record the fact for 1**n */
+ isoddint=(Flag)n&1; /* [works even if big] */
+ if (n!=BIGEVEN && n!=BIGODD) /* can use integer path? */
+ useint=1; /* looks good */
+ }
+
+ if (decNumberIsNegative(lhs) /* -x .. */
+ && isoddint) bits=DECNEG; /* .. to an odd power */
+
+ /* handle LHS infinity */
+ if (decNumberIsInfinite(lhs)) { /* [NaNs already handled] */
+ uByte rbits=rhs->bits; /* save */
+ uprv_decNumberZero(res); /* prepare */
+ if (n==0) *res->lsu=1; /* [-]Inf**0 => 1 */
+ else {
+ /* -Inf**nonint -> error */
+ if (!rhsint && decNumberIsNegative(lhs)) {
+ status|=DEC_Invalid_operation; /* -Inf**nonint is error */
+ break;}
+ if (!(rbits & DECNEG)) bits|=DECINF; /* was not a **-n */
+ /* [otherwise will be 0 or -0] */
+ res->bits=bits;
+ }
+ break;}
+
+ /* similarly handle LHS zero */
+ if (decNumberIsZero(lhs)) {
+ if (n==0) { /* 0**0 => Error */
+ #if DECSUBSET
+ if (!set->extended) { /* [unless subset] */
+ uprv_decNumberZero(res);
+ *res->lsu=1; /* return 1 */
+ break;}
+ #endif
+ status|=DEC_Invalid_operation;
+ }
+ else { /* 0**x */
+ uByte rbits=rhs->bits; /* save */
+ if (rbits & DECNEG) { /* was a 0**(-n) */
+ #if DECSUBSET
+ if (!set->extended) { /* [bad if subset] */
+ status|=DEC_Invalid_operation;
+ break;}
+ #endif
+ bits|=DECINF;
+ }
+ uprv_decNumberZero(res); /* prepare */
+ /* [otherwise will be 0 or -0] */
+ res->bits=bits;
+ }
+ break;}
+
+ /* here both lhs and rhs are finite; rhs==0 is handled in the */
+ /* integer path. Next handle the non-integer cases */
+ if (!useint) { /* non-integral rhs */
+ /* any -ve lhs is bad, as is either operand or context out of */
+ /* bounds */
+ if (decNumberIsNegative(lhs)) {
+ status|=DEC_Invalid_operation;
+ break;}
+ if (decCheckMath(lhs, set, &status)
+ || decCheckMath(rhs, set, &status)) break; /* variable status */
+
+ uprv_decContextDefault(&aset, DEC_INIT_DECIMAL64); /* clean context */
+ aset.emax=DEC_MAX_MATH; /* usual bounds */
+ aset.emin=-DEC_MAX_MATH; /* .. */
+ aset.clamp=0; /* and no concrete format */
+
+ /* calculate the result using exp(ln(lhs)*rhs), which can */
+ /* all be done into the accumulator, dac. The precision needed */
+ /* is enough to contain the full information in the lhs (which */
+ /* is the total digits, including exponent), or the requested */
+ /* precision, if larger, + 4; 6 is used for the exponent */
+ /* maximum length, and this is also used when it is shorter */
+ /* than the requested digits as it greatly reduces the >0.5 ulp */
+ /* cases at little cost (because Ln doubles digits each */
+ /* iteration so a few extra digits rarely causes an extra */
+ /* iteration) */
+ aset.digits=MAXI(lhs->digits, set->digits)+6+4;
+ } /* non-integer rhs */
+
+ else { /* rhs is in-range integer */
+ if (n==0) { /* x**0 = 1 */
+ /* (0**0 was handled above) */
+ uprv_decNumberZero(res); /* result=1 */
+ *res->lsu=1; /* .. */
+ break;}
+ /* rhs is a non-zero integer */
+ if (n<0) n=-n; /* use abs(n) */
+
+ aset=*set; /* clone the context */
+ aset.round=DEC_ROUND_HALF_EVEN; /* internally use balanced */
+ /* calculate the working DIGITS */
+ aset.digits=reqdigits+(rhs->digits+rhs->exponent)+2;
+ #if DECSUBSET
+ if (!set->extended) aset.digits--; /* use classic precision */
+ #endif
+ /* it's an error if this is more than can be handled */
+ if (aset.digits>DECNUMMAXP) {status|=DEC_Invalid_operation; break;}
+ } /* integer path */
+
+ /* aset.digits is the count of digits for the accumulator needed */
+ /* if accumulator is too long for local storage, then allocate */
+ needbytes=sizeof(decNumber)+(D2U(aset.digits)-1)*sizeof(Unit);
+ /* [needbytes also used below if 1/lhs needed] */
+ if (needbytes>sizeof(dacbuff)) {
+ allocdac=(decNumber *)malloc(needbytes);
+ if (allocdac==NULL) { /* hopeless -- abandon */
+ status|=DEC_Insufficient_storage;
+ break;}
+ dac=allocdac; /* use the allocated space */
+ }
+ /* here, aset is set up and accumulator is ready for use */
+
+ if (!useint) { /* non-integral rhs */
+ /* x ** y; special-case x=1 here as it will otherwise always */
+ /* reduce to integer 1; decLnOp has a fastpath which detects */
+ /* the case of x=1 */
+ decLnOp(dac, lhs, &aset, &status); /* dac=ln(lhs) */
+ /* [no error possible, as lhs 0 already handled] */
+ if (ISZERO(dac)) { /* x==1, 1.0, etc. */
+ /* need to return fully-padded 1.0000 etc., but rhsint->1 */
+ *dac->lsu=1; /* was 0, make int 1 */
+ if (!rhsint) { /* add padding */
+ Int shift=set->digits-1;
+ dac->digits=decShiftToMost(dac->lsu, 1, shift);
+ dac->exponent=-shift; /* make 1.0000... */
+ status|=DEC_Inexact|DEC_Rounded; /* deemed inexact */
+ }
+ }
+ else {
+ decMultiplyOp(dac, dac, rhs, &aset, &status); /* dac=dac*rhs */
+ decExpOp(dac, dac, &aset, &status); /* dac=exp(dac) */
+ }
+ /* and drop through for final rounding */
+ } /* non-integer rhs */
+
+ else { /* carry on with integer */
+ uprv_decNumberZero(dac); /* acc=1 */
+ *dac->lsu=1; /* .. */
+
+ /* if a negative power the constant 1 is needed, and if not subset */
+ /* invert the lhs now rather than inverting the result later */
+ if (decNumberIsNegative(rhs)) { /* was a **-n [hence digits>0] */
+ decNumber *inv=invbuff; /* asssume use fixed buffer */
+ uprv_decNumberCopy(&dnOne, dac); /* dnOne=1; [needed now or later] */
+ #if DECSUBSET
+ if (set->extended) { /* need to calculate 1/lhs */
+ #endif
+ /* divide lhs into 1, putting result in dac [dac=1/dac] */
+ decDivideOp(dac, &dnOne, lhs, &aset, DIVIDE, &status);
+ /* now locate or allocate space for the inverted lhs */
+ if (needbytes>sizeof(invbuff)) {
+ allocinv=(decNumber *)malloc(needbytes);
+ if (allocinv==NULL) { /* hopeless -- abandon */
+ status|=DEC_Insufficient_storage;
+ break;}
+ inv=allocinv; /* use the allocated space */
+ }
+ /* [inv now points to big-enough buffer or allocated storage] */
+ uprv_decNumberCopy(inv, dac); /* copy the 1/lhs */
+ uprv_decNumberCopy(dac, &dnOne); /* restore acc=1 */
+ lhs=inv; /* .. and go forward with new lhs */
+ #if DECSUBSET
+ }
+ #endif
+ }
+
+ /* Raise-to-the-power loop... */
+ seenbit=0; /* set once a 1-bit is encountered */
+ for (i=1;;i++){ /* for each bit [top bit ignored] */
+ /* abandon if had overflow or terminal underflow */
+ if (status & (DEC_Overflow|DEC_Underflow)) { /* interesting? */
+ if (status&DEC_Overflow || ISZERO(dac)) break;
+ }
+ /* [the following two lines revealed an optimizer bug in a C++ */
+ /* compiler, with symptom: 5**3 -> 25, when n=n+n was used] */
+ n=n<<1; /* move next bit to testable position */
+ if (n<0) { /* top bit is set */
+ seenbit=1; /* OK, significant bit seen */
+ decMultiplyOp(dac, dac, lhs, &aset, &status); /* dac=dac*x */
+ }
+ if (i==31) break; /* that was the last bit */
+ if (!seenbit) continue; /* no need to square 1 */
+ decMultiplyOp(dac, dac, dac, &aset, &status); /* dac=dac*dac [square] */
+ } /*i*/ /* 32 bits */
+
+ /* complete internal overflow or underflow processing */
+ if (status & (DEC_Overflow|DEC_Underflow)) {
+ #if DECSUBSET
+ /* If subset, and power was negative, reverse the kind of -erflow */
+ /* [1/x not yet done] */
+ if (!set->extended && decNumberIsNegative(rhs)) {
+ if (status & DEC_Overflow)
+ status^=DEC_Overflow | DEC_Underflow | DEC_Subnormal;
+ else { /* trickier -- Underflow may or may not be set */
+ status&=~(DEC_Underflow | DEC_Subnormal); /* [one or both] */
+ status|=DEC_Overflow;
+ }
+ }
+ #endif
+ dac->bits=(dac->bits & ~DECNEG) | bits; /* force correct sign */
+ /* round subnormals [to set.digits rather than aset.digits] */
+ /* or set overflow result similarly as required */
+ decFinalize(dac, set, &residue, &status);
+ uprv_decNumberCopy(res, dac); /* copy to result (is now OK length) */
+ break;
+ }
+
+ #if DECSUBSET
+ if (!set->extended && /* subset math */
+ decNumberIsNegative(rhs)) { /* was a **-n [hence digits>0] */
+ /* so divide result into 1 [dac=1/dac] */
+ decDivideOp(dac, &dnOne, dac, &aset, DIVIDE, &status);
+ }
+ #endif
+ } /* rhs integer path */
+
+ /* reduce result to the requested length and copy to result */
+ decCopyFit(res, dac, set, &residue, &status);
+ decFinish(res, set, &residue, &status); /* final cleanup */
+ #if DECSUBSET
+ if (!set->extended) decTrim(res, set, 0, 1, &dropped); /* trailing zeros */
+ #endif
+ } while(0); /* end protected */
+
+ if (allocdac!=NULL) free(allocdac); /* drop any storage used */
+ if (allocinv!=NULL) free(allocinv); /* .. */
+ #if DECSUBSET
+ if (alloclhs!=NULL) free(alloclhs); /* .. */
+ if (allocrhs!=NULL) free(allocrhs); /* .. */
+ #endif
+ if (status!=0) decStatus(res, status, set);
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberPower */
+
+/* ------------------------------------------------------------------ */
+/* decNumberQuantize -- force exponent to requested value */
+/* */
+/* This computes C = op(A, B), where op adjusts the coefficient */
+/* of C (by rounding or shifting) such that the exponent (-scale) */
+/* of C has exponent of B. The numerical value of C will equal A, */
+/* except for the effects of any rounding that occurred. */
+/* */
+/* res is C, the result. C may be A or B */
+/* lhs is A, the number to adjust */
+/* rhs is B, the number with exponent to match */
+/* set is the context */
+/* */
+/* C must have space for set->digits digits. */
+/* */
+/* Unless there is an error or the result is infinite, the exponent */
+/* after the operation is guaranteed to be equal to that of B. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberQuantize(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+ decQuantizeOp(res, lhs, rhs, set, 1, &status);
+ if (status!=0) decStatus(res, status, set);
+ return res;
+ } /* decNumberQuantize */
+
+/* ------------------------------------------------------------------ */
+/* decNumberReduce -- remove trailing zeros */
+/* */
+/* This computes C = 0 + A, and normalizes the result */
+/* */
+/* res is C, the result. C may be A */
+/* rhs is A */
+/* set is the context */
+/* */
+/* C must have space for set->digits digits. */
+/* ------------------------------------------------------------------ */
+/* Previously known as Normalize */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberNormalize(decNumber *res, const decNumber *rhs,
+ decContext *set) {
+ return uprv_decNumberReduce(res, rhs, set);
+ } /* decNumberNormalize */
+
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberReduce(decNumber *res, const decNumber *rhs,
+ decContext *set) {
+ #if DECSUBSET
+ decNumber *allocrhs=NULL; /* non-NULL if rounded rhs allocated */
+ #endif
+ uInt status=0; /* as usual */
+ Int residue=0; /* as usual */
+ Int dropped; /* work */
+
+ #if DECCHECK
+ if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
+ #endif
+
+ do { /* protect allocated storage */
+ #if DECSUBSET
+ if (!set->extended) {
+ /* reduce operand and set lostDigits status, as needed */
+ if (rhs->digits>set->digits) {
+ allocrhs=decRoundOperand(rhs, set, &status);
+ if (allocrhs==NULL) break;
+ rhs=allocrhs;
+ }
+ }
+ #endif
+ /* [following code does not require input rounding] */
+
+ /* Infinities copy through; NaNs need usual treatment */
+ if (decNumberIsNaN(rhs)) {
+ decNaNs(res, rhs, NULL, set, &status);
+ break;
+ }
+
+ /* reduce result to the requested length and copy to result */
+ decCopyFit(res, rhs, set, &residue, &status); /* copy & round */
+ decFinish(res, set, &residue, &status); /* cleanup/set flags */
+ decTrim(res, set, 1, 0, &dropped); /* normalize in place */
+ /* [may clamp] */
+ } while(0); /* end protected */
+
+ #if DECSUBSET
+ if (allocrhs !=NULL) free(allocrhs); /* .. */
+ #endif
+ if (status!=0) decStatus(res, status, set);/* then report status */
+ return res;
+ } /* decNumberReduce */
+
+/* ------------------------------------------------------------------ */
+/* decNumberRescale -- force exponent to requested value */
+/* */
+/* This computes C = op(A, B), where op adjusts the coefficient */
+/* of C (by rounding or shifting) such that the exponent (-scale) */
+/* of C has the value B. The numerical value of C will equal A, */
+/* except for the effects of any rounding that occurred. */
+/* */
+/* res is C, the result. C may be A or B */
+/* lhs is A, the number to adjust */
+/* rhs is B, the requested exponent */
+/* set is the context */
+/* */
+/* C must have space for set->digits digits. */
+/* */
+/* Unless there is an error or the result is infinite, the exponent */
+/* after the operation is guaranteed to be equal to B. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberRescale(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+ decQuantizeOp(res, lhs, rhs, set, 0, &status);
+ if (status!=0) decStatus(res, status, set);
+ return res;
+ } /* decNumberRescale */
+
+/* ------------------------------------------------------------------ */
+/* decNumberRemainder -- divide and return remainder */
+/* */
+/* This computes C = A % B */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X%X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* */
+/* C must have space for set->digits digits. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberRemainder(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+ decDivideOp(res, lhs, rhs, set, REMAINDER, &status);
+ if (status!=0) decStatus(res, status, set);
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberRemainder */
+
+/* ------------------------------------------------------------------ */
+/* decNumberRemainderNear -- divide and return remainder from nearest */
+/* */
+/* This computes C = A % B, where % is the IEEE remainder operator */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X%X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* */
+/* C must have space for set->digits digits. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberRemainderNear(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+ decDivideOp(res, lhs, rhs, set, REMNEAR, &status);
+ if (status!=0) decStatus(res, status, set);
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberRemainderNear */
+
+/* ------------------------------------------------------------------ */
+/* decNumberRotate -- rotate the coefficient of a Number left/right */
+/* */
+/* This computes C = A rot B (in base ten and rotating set->digits */
+/* digits). */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=XrotX) */
+/* lhs is A */
+/* rhs is B, the number of digits to rotate (-ve to right) */
+/* set is the context */
+/* */
+/* The digits of the coefficient of A are rotated to the left (if B */
+/* is positive) or to the right (if B is negative) without adjusting */
+/* the exponent or the sign of A. If lhs->digits is less than */
+/* set->digits the coefficient is padded with zeros on the left */
+/* before the rotate. Any leading zeros in the result are removed */
+/* as usual. */
+/* */
+/* B must be an integer (q=0) and in the range -set->digits through */
+/* +set->digits. */
+/* C must have space for set->digits digits. */
+/* NaNs are propagated as usual. Infinities are unaffected (but */
+/* B must be valid). No status is set unless B is invalid or an */
+/* operand is an sNaN. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberRotate(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+ Int rotate; /* rhs as an Int */
+
+ #if DECCHECK
+ if (decCheckOperands(res, lhs, rhs, set)) return res;
+ #endif
+
+ /* NaNs propagate as normal */
+ if (decNumberIsNaN(lhs) || decNumberIsNaN(rhs))
+ decNaNs(res, lhs, rhs, set, &status);
+ /* rhs must be an integer */
+ else if (decNumberIsInfinite(rhs) || rhs->exponent!=0)
+ status=DEC_Invalid_operation;
+ else { /* both numeric, rhs is an integer */
+ rotate=decGetInt(rhs); /* [cannot fail] */
+ if (rotate==BADINT /* something bad .. */
+ || rotate==BIGODD || rotate==BIGEVEN /* .. very big .. */
+ || abs(rotate)>set->digits) /* .. or out of range */
+ status=DEC_Invalid_operation;
+ else { /* rhs is OK */
+ uprv_decNumberCopy(res, lhs);
+ /* convert -ve rotate to equivalent positive rotation */
+ if (rotate<0) rotate=set->digits+rotate;
+ if (rotate!=0 && rotate!=set->digits /* zero or full rotation */
+ && !decNumberIsInfinite(res)) { /* lhs was infinite */
+ /* left-rotate to do; 0 < rotate < set->digits */
+ uInt units, shift; /* work */
+ uInt msudigits; /* digits in result msu */
+ Unit *msu=res->lsu+D2U(res->digits)-1; /* current msu */
+ Unit *msumax=res->lsu+D2U(set->digits)-1; /* rotation msu */
+ for (msu++; msu<=msumax; msu++) *msu=0; /* ensure high units=0 */
+ res->digits=set->digits; /* now full-length */
+ msudigits=MSUDIGITS(res->digits); /* actual digits in msu */
+
+ /* rotation here is done in-place, in three steps */
+ /* 1. shift all to least up to one unit to unit-align final */
+ /* lsd [any digits shifted out are rotated to the left, */
+ /* abutted to the original msd (which may require split)] */
+ /* */
+ /* [if there are no whole units left to rotate, the */
+ /* rotation is now complete] */
+ /* */
+ /* 2. shift to least, from below the split point only, so that */
+ /* the final msd is in the right place in its Unit [any */
+ /* digits shifted out will fit exactly in the current msu, */
+ /* left aligned, no split required] */
+ /* */
+ /* 3. rotate all the units by reversing left part, right */
+ /* part, and then whole */
+ /* */
+ /* example: rotate right 8 digits (2 units + 2), DECDPUN=3. */
+ /* */
+ /* start: 00a bcd efg hij klm npq */
+ /* */
+ /* 1a 000 0ab cde fgh|ijk lmn [pq saved] */
+ /* 1b 00p qab cde fgh|ijk lmn */
+ /* */
+ /* 2a 00p qab cde fgh|00i jkl [mn saved] */
+ /* 2b mnp qab cde fgh|00i jkl */
+ /* */
+ /* 3a fgh cde qab mnp|00i jkl */
+ /* 3b fgh cde qab mnp|jkl 00i */
+ /* 3c 00i jkl mnp qab cde fgh */
+
+ /* Step 1: amount to shift is the partial right-rotate count */
+ rotate=set->digits-rotate; /* make it right-rotate */
+ units=rotate/DECDPUN; /* whole units to rotate */
+ shift=rotate%DECDPUN; /* left-over digits count */
+ if (shift>0) { /* not an exact number of units */
+ uInt save=res->lsu[0]%powers[shift]; /* save low digit(s) */
+ decShiftToLeast(res->lsu, D2U(res->digits), shift);
+ if (shift>msudigits) { /* msumax-1 needs >0 digits */
+ uInt rem=save%powers[shift-msudigits];/* split save */
+ *msumax=(Unit)(save/powers[shift-msudigits]); /* and insert */
+ *(msumax-1)=*(msumax-1)
+ +(Unit)(rem*powers[DECDPUN-(shift-msudigits)]); /* .. */
+ }
+ else { /* all fits in msumax */
+ *msumax=*msumax+(Unit)(save*powers[msudigits-shift]); /* [maybe *1] */
+ }
+ } /* digits shift needed */
+
+ /* If whole units to rotate... */
+ if (units>0) { /* some to do */
+ /* Step 2: the units to touch are the whole ones in rotate, */
+ /* if any, and the shift is DECDPUN-msudigits (which may be */
+ /* 0, again) */
+ shift=DECDPUN-msudigits;
+ if (shift>0) { /* not an exact number of units */
+ uInt save=res->lsu[0]%powers[shift]; /* save low digit(s) */
+ decShiftToLeast(res->lsu, units, shift);
+ *msumax=*msumax+(Unit)(save*powers[msudigits]);
+ } /* partial shift needed */
+
+ /* Step 3: rotate the units array using triple reverse */
+ /* (reversing is easy and fast) */
+ decReverse(res->lsu+units, msumax); /* left part */
+ decReverse(res->lsu, res->lsu+units-1); /* right part */
+ decReverse(res->lsu, msumax); /* whole */
+ } /* whole units to rotate */
+ /* the rotation may have left an undetermined number of zeros */
+ /* on the left, so true length needs to be calculated */
+ res->digits=decGetDigits(res->lsu, static_cast<int32_t>(msumax-res->lsu+1));
+ } /* rotate needed */
+ } /* rhs OK */
+ } /* numerics */
+ if (status!=0) decStatus(res, status, set);
+ return res;
+ } /* decNumberRotate */
+
+/* ------------------------------------------------------------------ */
+/* decNumberSameQuantum -- test for equal exponents */
+/* */
+/* res is the result number, which will contain either 0 or 1 */
+/* lhs is a number to test */
+/* rhs is the second (usually a pattern) */
+/* */
+/* No errors are possible and no context is needed. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberSameQuantum(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs) {
+ Unit ret=0; /* return value */
+
+ #if DECCHECK
+ if (decCheckOperands(res, lhs, rhs, DECUNCONT)) return res;
+ #endif
+
+ if (SPECIALARGS) {
+ if (decNumberIsNaN(lhs) && decNumberIsNaN(rhs)) ret=1;
+ else if (decNumberIsInfinite(lhs) && decNumberIsInfinite(rhs)) ret=1;
+ /* [anything else with a special gives 0] */
+ }
+ else if (lhs->exponent==rhs->exponent) ret=1;
+
+ uprv_decNumberZero(res); /* OK to overwrite an operand now */
+ *res->lsu=ret;
+ return res;
+ } /* decNumberSameQuantum */
+
+/* ------------------------------------------------------------------ */
+/* decNumberScaleB -- multiply by a power of 10 */
+/* */
+/* This computes C = A x 10**B where B is an integer (q=0) with */
+/* maximum magnitude 2*(emax+digits) */
+/* */
+/* res is C, the result. C may be A or B */
+/* lhs is A, the number to adjust */
+/* rhs is B, the requested power of ten to use */
+/* set is the context */
+/* */
+/* C must have space for set->digits digits. */
+/* */
+/* The result may underflow or overflow. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberScaleB(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ Int reqexp; /* requested exponent change [B] */
+ uInt status=0; /* accumulator */
+ Int residue; /* work */
+
+ #if DECCHECK
+ if (decCheckOperands(res, lhs, rhs, set)) return res;
+ #endif
+
+ /* Handle special values except lhs infinite */
+ if (decNumberIsNaN(lhs) || decNumberIsNaN(rhs))
+ decNaNs(res, lhs, rhs, set, &status);
+ /* rhs must be an integer */
+ else if (decNumberIsInfinite(rhs) || rhs->exponent!=0)
+ status=DEC_Invalid_operation;
+ else {
+ /* lhs is a number; rhs is a finite with q==0 */
+ reqexp=decGetInt(rhs); /* [cannot fail] */
+ if (reqexp==BADINT /* something bad .. */
+ || reqexp==BIGODD || reqexp==BIGEVEN /* .. very big .. */
+ || abs(reqexp)>(2*(set->digits+set->emax))) /* .. or out of range */
+ status=DEC_Invalid_operation;
+ else { /* rhs is OK */
+ uprv_decNumberCopy(res, lhs); /* all done if infinite lhs */
+ if (!decNumberIsInfinite(res)) { /* prepare to scale */
+ res->exponent+=reqexp; /* adjust the exponent */
+ residue=0;
+ decFinalize(res, set, &residue, &status); /* .. and check */
+ } /* finite LHS */
+ } /* rhs OK */
+ } /* rhs finite */
+ if (status!=0) decStatus(res, status, set);
+ return res;
+ } /* decNumberScaleB */
+
+/* ------------------------------------------------------------------ */
+/* decNumberShift -- shift the coefficient of a Number left or right */
+/* */
+/* This computes C = A << B or C = A >> -B (in base ten). */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X<<X) */
+/* lhs is A */
+/* rhs is B, the number of digits to shift (-ve to right) */
+/* set is the context */
+/* */
+/* The digits of the coefficient of A are shifted to the left (if B */
+/* is positive) or to the right (if B is negative) without adjusting */
+/* the exponent or the sign of A. */
+/* */
+/* B must be an integer (q=0) and in the range -set->digits through */
+/* +set->digits. */
+/* C must have space for set->digits digits. */
+/* NaNs are propagated as usual. Infinities are unaffected (but */
+/* B must be valid). No status is set unless B is invalid or an */
+/* operand is an sNaN. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberShift(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+ Int shift; /* rhs as an Int */
+
+ #if DECCHECK
+ if (decCheckOperands(res, lhs, rhs, set)) return res;
+ #endif
+
+ /* NaNs propagate as normal */
+ if (decNumberIsNaN(lhs) || decNumberIsNaN(rhs))
+ decNaNs(res, lhs, rhs, set, &status);
+ /* rhs must be an integer */
+ else if (decNumberIsInfinite(rhs) || rhs->exponent!=0)
+ status=DEC_Invalid_operation;
+ else { /* both numeric, rhs is an integer */
+ shift=decGetInt(rhs); /* [cannot fail] */
+ if (shift==BADINT /* something bad .. */
+ || shift==BIGODD || shift==BIGEVEN /* .. very big .. */
+ || abs(shift)>set->digits) /* .. or out of range */
+ status=DEC_Invalid_operation;
+ else { /* rhs is OK */
+ uprv_decNumberCopy(res, lhs);
+ if (shift!=0 && !decNumberIsInfinite(res)) { /* something to do */
+ if (shift>0) { /* to left */
+ if (shift==set->digits) { /* removing all */
+ *res->lsu=0; /* so place 0 */
+ res->digits=1; /* .. */
+ }
+ else { /* */
+ /* first remove leading digits if necessary */
+ if (res->digits+shift>set->digits) {
+ decDecap(res, res->digits+shift-set->digits);
+ /* that updated res->digits; may have gone to 1 (for a */
+ /* single digit or for zero */
+ }
+ if (res->digits>1 || *res->lsu) /* if non-zero.. */
+ res->digits=decShiftToMost(res->lsu, res->digits, shift);
+ } /* partial left */
+ } /* left */
+ else { /* to right */
+ if (-shift>=res->digits) { /* discarding all */
+ *res->lsu=0; /* so place 0 */
+ res->digits=1; /* .. */
+ }
+ else {
+ decShiftToLeast(res->lsu, D2U(res->digits), -shift);
+ res->digits-=(-shift);
+ }
+ } /* to right */
+ } /* non-0 non-Inf shift */
+ } /* rhs OK */
+ } /* numerics */
+ if (status!=0) decStatus(res, status, set);
+ return res;
+ } /* decNumberShift */
+
+/* ------------------------------------------------------------------ */
+/* decNumberSquareRoot -- square root operator */
+/* */
+/* This computes C = squareroot(A) */
+/* */
+/* res is C, the result. C may be A */
+/* rhs is A */
+/* set is the context; note that rounding mode has no effect */
+/* */
+/* C must have space for set->digits digits. */
+/* ------------------------------------------------------------------ */
+/* This uses the following varying-precision algorithm in: */
+/* */
+/* Properly Rounded Variable Precision Square Root, T. E. Hull and */
+/* A. Abrham, ACM Transactions on Mathematical Software, Vol 11 #3, */
+/* pp229-237, ACM, September 1985. */
+/* */
+/* The square-root is calculated using Newton's method, after which */
+/* a check is made to ensure the result is correctly rounded. */
+/* */
+/* % [Reformatted original Numerical Turing source code follows.] */
+/* function sqrt(x : real) : real */
+/* % sqrt(x) returns the properly rounded approximation to the square */
+/* % root of x, in the precision of the calling environment, or it */
+/* % fails if x < 0. */
+/* % t e hull and a abrham, august, 1984 */
+/* if x <= 0 then */
+/* if x < 0 then */
+/* assert false */
+/* else */
+/* result 0 */
+/* end if */
+/* end if */
+/* var f := setexp(x, 0) % fraction part of x [0.1 <= x < 1] */
+/* var e := getexp(x) % exponent part of x */
+/* var approx : real */
+/* if e mod 2 = 0 then */
+/* approx := .259 + .819 * f % approx to root of f */
+/* else */
+/* f := f/l0 % adjustments */
+/* e := e + 1 % for odd */
+/* approx := .0819 + 2.59 * f % exponent */
+/* end if */
+/* */
+/* var p:= 3 */
+/* const maxp := currentprecision + 2 */
+/* loop */
+/* p := min(2*p - 2, maxp) % p = 4,6,10, . . . , maxp */
+/* precision p */
+/* approx := .5 * (approx + f/approx) */
+/* exit when p = maxp */
+/* end loop */
+/* */
+/* % approx is now within 1 ulp of the properly rounded square root */
+/* % of f; to ensure proper rounding, compare squares of (approx - */
+/* % l/2 ulp) and (approx + l/2 ulp) with f. */
+/* p := currentprecision */
+/* begin */
+/* precision p + 2 */
+/* const approxsubhalf := approx - setexp(.5, -p) */
+/* if mulru(approxsubhalf, approxsubhalf) > f then */
+/* approx := approx - setexp(.l, -p + 1) */
+/* else */
+/* const approxaddhalf := approx + setexp(.5, -p) */
+/* if mulrd(approxaddhalf, approxaddhalf) < f then */
+/* approx := approx + setexp(.l, -p + 1) */
+/* end if */
+/* end if */
+/* end */
+/* result setexp(approx, e div 2) % fix exponent */
+/* end sqrt */
+/* ------------------------------------------------------------------ */
+#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decNumber *rhs,
+ decContext *set) {
+ decContext workset, approxset; /* work contexts */
+ decNumber dzero; /* used for constant zero */
+ Int maxp; /* largest working precision */
+ Int workp; /* working precision */
+ Int residue=0; /* rounding residue */
+ uInt status=0, ignore=0; /* status accumulators */
+ uInt rstatus; /* .. */
+ Int exp; /* working exponent */
+ Int ideal; /* ideal (preferred) exponent */
+ Int needbytes; /* work */
+ Int dropped; /* .. */
+
+ #if DECSUBSET
+ decNumber *allocrhs=NULL; /* non-NULL if rounded rhs allocated */
+ #endif
+ /* buffer for f [needs +1 in case DECBUFFER 0] */
+ decNumber buff[D2N(DECBUFFER+1)];
+ /* buffer for a [needs +2 to match likely maxp] */
+ decNumber bufa[D2N(DECBUFFER+2)];
+ /* buffer for temporary, b [must be same size as a] */
+ decNumber bufb[D2N(DECBUFFER+2)];
+ decNumber *allocbuff=NULL; /* -> allocated buff, iff allocated */
+ decNumber *allocbufa=NULL; /* -> allocated bufa, iff allocated */
+ decNumber *allocbufb=NULL; /* -> allocated bufb, iff allocated */
+ decNumber *f=buff; /* reduced fraction */
+ decNumber *a=bufa; /* approximation to result */
+ decNumber *b=bufb; /* intermediate result */
+ /* buffer for temporary variable, up to 3 digits */
+ decNumber buft[D2N(3)];
+ decNumber *t=buft; /* up-to-3-digit constant or work */
+
+ #if DECCHECK
+ if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
+ #endif
+
+ do { /* protect allocated storage */
+ #if DECSUBSET
+ if (!set->extended) {
+ /* reduce operand and set lostDigits status, as needed */
+ if (rhs->digits>set->digits) {
+ allocrhs=decRoundOperand(rhs, set, &status);
+ if (allocrhs==NULL) break;
+ /* [Note: 'f' allocation below could reuse this buffer if */
+ /* used, but as this is rare they are kept separate for clarity.] */
+ rhs=allocrhs;
+ }
+ }
+ #endif
+ /* [following code does not require input rounding] */
+
+ /* handle infinities and NaNs */
+ if (SPECIALARG) {
+ if (decNumberIsInfinite(rhs)) { /* an infinity */
+ if (decNumberIsNegative(rhs)) status|=DEC_Invalid_operation;
+ else uprv_decNumberCopy(res, rhs); /* +Infinity */
+ }
+ else decNaNs(res, rhs, NULL, set, &status); /* a NaN */
+ break;
+ }
+
+ /* calculate the ideal (preferred) exponent [floor(exp/2)] */
+ /* [It would be nicer to write: ideal=rhs->exponent>>1, but this */
+ /* generates a compiler warning. Generated code is the same.] */
+ ideal=(rhs->exponent&~1)/2; /* target */
+
+ /* handle zeros */
+ if (ISZERO(rhs)) {
+ uprv_decNumberCopy(res, rhs); /* could be 0 or -0 */
+ res->exponent=ideal; /* use the ideal [safe] */
+ /* use decFinish to clamp any out-of-range exponent, etc. */
+ decFinish(res, set, &residue, &status);
+ break;
+ }
+
+ /* any other -x is an oops */
+ if (decNumberIsNegative(rhs)) {
+ status|=DEC_Invalid_operation;
+ break;
+ }
+
+ /* space is needed for three working variables */
+ /* f -- the same precision as the RHS, reduced to 0.01->0.99... */
+ /* a -- Hull's approximation -- precision, when assigned, is */
+ /* currentprecision+1 or the input argument precision, */
+ /* whichever is larger (+2 for use as temporary) */
+ /* b -- intermediate temporary result (same size as a) */
+ /* if any is too long for local storage, then allocate */
+ workp=MAXI(set->digits+1, rhs->digits); /* actual rounding precision */
+ workp=MAXI(workp, 7); /* at least 7 for low cases */
+ maxp=workp+2; /* largest working precision */
+
+ needbytes=sizeof(decNumber)+(D2U(rhs->digits)-1)*sizeof(Unit);
+ if (needbytes>(Int)sizeof(buff)) {
+ allocbuff=(decNumber *)malloc(needbytes);
+ if (allocbuff==NULL) { /* hopeless -- abandon */
+ status|=DEC_Insufficient_storage;
+ break;}
+ f=allocbuff; /* use the allocated space */
+ }
+ /* a and b both need to be able to hold a maxp-length number */
+ needbytes=sizeof(decNumber)+(D2U(maxp)-1)*sizeof(Unit);
+ if (needbytes>(Int)sizeof(bufa)) { /* [same applies to b] */
+ allocbufa=(decNumber *)malloc(needbytes);
+ allocbufb=(decNumber *)malloc(needbytes);
+ if (allocbufa==NULL || allocbufb==NULL) { /* hopeless */
+ status|=DEC_Insufficient_storage;
+ break;}
+ a=allocbufa; /* use the allocated spaces */
+ b=allocbufb; /* .. */
+ }
+
+ /* copy rhs -> f, save exponent, and reduce so 0.1 <= f < 1 */
+ uprv_decNumberCopy(f, rhs);
+ exp=f->exponent+f->digits; /* adjusted to Hull rules */
+ f->exponent=-(f->digits); /* to range */
+
+ /* set up working context */
+ uprv_decContextDefault(&workset, DEC_INIT_DECIMAL64);
+ workset.emax=DEC_MAX_EMAX;
+ workset.emin=DEC_MIN_EMIN;
+
+ /* [Until further notice, no error is possible and status bits */
+ /* (Rounded, etc.) should be ignored, not accumulated.] */
+
+ /* Calculate initial approximation, and allow for odd exponent */
+ workset.digits=workp; /* p for initial calculation */
+ t->bits=0; t->digits=3;
+ a->bits=0; a->digits=3;
+ if ((exp & 1)==0) { /* even exponent */
+ /* Set t=0.259, a=0.819 */
+ t->exponent=-3;
+ a->exponent=-3;
+ #if DECDPUN>=3
+ t->lsu[0]=259;
+ a->lsu[0]=819;
+ #elif DECDPUN==2
+ t->lsu[0]=59; t->lsu[1]=2;
+ a->lsu[0]=19; a->lsu[1]=8;
+ #else
+ t->lsu[0]=9; t->lsu[1]=5; t->lsu[2]=2;
+ a->lsu[0]=9; a->lsu[1]=1; a->lsu[2]=8;
+ #endif
+ }
+ else { /* odd exponent */
+ /* Set t=0.0819, a=2.59 */
+ f->exponent--; /* f=f/10 */
+ exp++; /* e=e+1 */
+ t->exponent=-4;
+ a->exponent=-2;
+ #if DECDPUN>=3
+ t->lsu[0]=819;
+ a->lsu[0]=259;
+ #elif DECDPUN==2
+ t->lsu[0]=19; t->lsu[1]=8;
+ a->lsu[0]=59; a->lsu[1]=2;
+ #else
+ t->lsu[0]=9; t->lsu[1]=1; t->lsu[2]=8;
+ a->lsu[0]=9; a->lsu[1]=5; a->lsu[2]=2;
+ #endif
+ }
+
+ decMultiplyOp(a, a, f, &workset, &ignore); /* a=a*f */
+ decAddOp(a, a, t, &workset, 0, &ignore); /* ..+t */
+ /* [a is now the initial approximation for sqrt(f), calculated with */
+ /* currentprecision, which is also a's precision.] */
+
+ /* the main calculation loop */
+ uprv_decNumberZero(&dzero); /* make 0 */
+ uprv_decNumberZero(t); /* set t = 0.5 */
+ t->lsu[0]=5; /* .. */
+ t->exponent=-1; /* .. */
+ workset.digits=3; /* initial p */
+ for (; workset.digits<maxp;) {
+ /* set p to min(2*p - 2, maxp) [hence 3; or: 4, 6, 10, ... , maxp] */
+ workset.digits=MINI(workset.digits*2-2, maxp);
+ /* a = 0.5 * (a + f/a) */
+ /* [calculated at p then rounded to currentprecision] */
+ decDivideOp(b, f, a, &workset, DIVIDE, &ignore); /* b=f/a */
+ decAddOp(b, b, a, &workset, 0, &ignore); /* b=b+a */
+ decMultiplyOp(a, b, t, &workset, &ignore); /* a=b*0.5 */
+ } /* loop */
+
+ /* Here, 0.1 <= a < 1 [Hull], and a has maxp digits */
+ /* now reduce to length, etc.; this needs to be done with a */
+ /* having the correct exponent so as to handle subnormals */
+ /* correctly */
+ approxset=*set; /* get emin, emax, etc. */
+ approxset.round=DEC_ROUND_HALF_EVEN;
+ a->exponent+=exp/2; /* set correct exponent */
+ rstatus=0; /* clear status */
+ residue=0; /* .. and accumulator */
+ decCopyFit(a, a, &approxset, &residue, &rstatus); /* reduce (if needed) */
+ decFinish(a, &approxset, &residue, &rstatus); /* clean and finalize */
+
+ /* Overflow was possible if the input exponent was out-of-range, */
+ /* in which case quit */
+ if (rstatus&DEC_Overflow) {
+ status=rstatus; /* use the status as-is */
+ uprv_decNumberCopy(res, a); /* copy to result */
+ break;
+ }
+
+ /* Preserve status except Inexact/Rounded */
+ status|=(rstatus & ~(DEC_Rounded|DEC_Inexact));
+
+ /* Carry out the Hull correction */
+ a->exponent-=exp/2; /* back to 0.1->1 */
+
+ /* a is now at final precision and within 1 ulp of the properly */
+ /* rounded square root of f; to ensure proper rounding, compare */
+ /* squares of (a - l/2 ulp) and (a + l/2 ulp) with f. */
+ /* Here workset.digits=maxp and t=0.5, and a->digits determines */
+ /* the ulp */
+ workset.digits--; /* maxp-1 is OK now */
+ t->exponent=-a->digits-1; /* make 0.5 ulp */
+ decAddOp(b, a, t, &workset, DECNEG, &ignore); /* b = a - 0.5 ulp */
+ workset.round=DEC_ROUND_UP;
+ decMultiplyOp(b, b, b, &workset, &ignore); /* b = mulru(b, b) */
+ decCompareOp(b, f, b, &workset, COMPARE, &ignore); /* b ? f, reversed */
+ if (decNumberIsNegative(b)) { /* f < b [i.e., b > f] */
+ /* this is the more common adjustment, though both are rare */
+ t->exponent++; /* make 1.0 ulp */
+ t->lsu[0]=1; /* .. */
+ decAddOp(a, a, t, &workset, DECNEG, &ignore); /* a = a - 1 ulp */
+ /* assign to approx [round to length] */
+ approxset.emin-=exp/2; /* adjust to match a */
+ approxset.emax-=exp/2;
+ decAddOp(a, &dzero, a, &approxset, 0, &ignore);
+ }
+ else {
+ decAddOp(b, a, t, &workset, 0, &ignore); /* b = a + 0.5 ulp */
+ workset.round=DEC_ROUND_DOWN;
+ decMultiplyOp(b, b, b, &workset, &ignore); /* b = mulrd(b, b) */
+ decCompareOp(b, b, f, &workset, COMPARE, &ignore); /* b ? f */
+ if (decNumberIsNegative(b)) { /* b < f */
+ t->exponent++; /* make 1.0 ulp */
+ t->lsu[0]=1; /* .. */
+ decAddOp(a, a, t, &workset, 0, &ignore); /* a = a + 1 ulp */
+ /* assign to approx [round to length] */
+ approxset.emin-=exp/2; /* adjust to match a */
+ approxset.emax-=exp/2;
+ decAddOp(a, &dzero, a, &approxset, 0, &ignore);
+ }
+ }
+ /* [no errors are possible in the above, and rounding/inexact during */
+ /* estimation are irrelevant, so status was not accumulated] */
+
+ /* Here, 0.1 <= a < 1 (still), so adjust back */
+ a->exponent+=exp/2; /* set correct exponent */
+
+ /* count droppable zeros [after any subnormal rounding] by */
+ /* trimming a copy */
+ uprv_decNumberCopy(b, a);
+ decTrim(b, set, 1, 1, &dropped); /* [drops trailing zeros] */
+
+ /* Set Inexact and Rounded. The answer can only be exact if */
+ /* it is short enough so that squaring it could fit in workp */
+ /* digits, so this is the only (relatively rare) condition that */
+ /* a careful check is needed */
+ if (b->digits*2-1 > workp) { /* cannot fit */
+ status|=DEC_Inexact|DEC_Rounded;
+ }
+ else { /* could be exact/unrounded */
+ uInt mstatus=0; /* local status */
+ decMultiplyOp(b, b, b, &workset, &mstatus); /* try the multiply */
+ if (mstatus&DEC_Overflow) { /* result just won't fit */
+ status|=DEC_Inexact|DEC_Rounded;
+ }
+ else { /* plausible */
+ decCompareOp(t, b, rhs, &workset, COMPARE, &mstatus); /* b ? rhs */
+ if (!ISZERO(t)) status|=DEC_Inexact|DEC_Rounded; /* not equal */
+ else { /* is Exact */
+ /* here, dropped is the count of trailing zeros in 'a' */
+ /* use closest exponent to ideal... */
+ Int todrop=ideal-a->exponent; /* most that can be dropped */
+ if (todrop<0) status|=DEC_Rounded; /* ideally would add 0s */
+ else { /* unrounded */
+ /* there are some to drop, but emax may not allow all */
+ Int maxexp=set->emax-set->digits+1;
+ Int maxdrop=maxexp-a->exponent;
+ if (todrop>maxdrop && set->clamp) { /* apply clamping */
+ todrop=maxdrop;
+ status|=DEC_Clamped;
+ }
+ if (dropped<todrop) { /* clamp to those available */
+ todrop=dropped;
+ status|=DEC_Clamped;
+ }
+ if (todrop>0) { /* have some to drop */
+ decShiftToLeast(a->lsu, D2U(a->digits), todrop);
+ a->exponent+=todrop; /* maintain numerical value */
+ a->digits-=todrop; /* new length */
+ }
+ }
+ }
+ }
+ }
+
+ /* double-check Underflow, as perhaps the result could not have */
+ /* been subnormal (initial argument too big), or it is now Exact */
+ if (status&DEC_Underflow) {
+ Int ae=rhs->exponent+rhs->digits-1; /* adjusted exponent */
+ /* check if truly subnormal */
+ #if DECEXTFLAG /* DEC_Subnormal too */
+ if (ae>=set->emin*2) status&=~(DEC_Subnormal|DEC_Underflow);
+ #else
+ if (ae>=set->emin*2) status&=~DEC_Underflow;
+ #endif
+ /* check if truly inexact */
+ if (!(status&DEC_Inexact)) status&=~DEC_Underflow;
+ }
+
+ uprv_decNumberCopy(res, a); /* a is now the result */
+ } while(0); /* end protected */
+
+ if (allocbuff!=NULL) free(allocbuff); /* drop any storage used */
+ if (allocbufa!=NULL) free(allocbufa); /* .. */
+ if (allocbufb!=NULL) free(allocbufb); /* .. */
+ #if DECSUBSET
+ if (allocrhs !=NULL) free(allocrhs); /* .. */
+ #endif
+ if (status!=0) decStatus(res, status, set);/* then report status */
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberSquareRoot */
+#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406
+#pragma GCC diagnostic pop
+#endif
+
+/* ------------------------------------------------------------------ */
+/* decNumberSubtract -- subtract two Numbers */
+/* */
+/* This computes C = A - B */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X-X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* */
+/* C must have space for set->digits digits. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberSubtract(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ uInt status=0; /* accumulator */
+
+ decAddOp(res, lhs, rhs, set, DECNEG, &status);
+ if (status!=0) decStatus(res, status, set);
+ #if DECCHECK
+ decCheckInexact(res, set);
+ #endif
+ return res;
+ } /* decNumberSubtract */
+
+/* ------------------------------------------------------------------ */
+/* decNumberToIntegralExact -- round-to-integral-value with InExact */
+/* decNumberToIntegralValue -- round-to-integral-value */
+/* */
+/* res is the result */
+/* rhs is input number */
+/* set is the context */
+/* */
+/* res must have space for any value of rhs. */
+/* */
+/* This implements the IEEE special operators and therefore treats */
+/* special values as valid. For finite numbers it returns */
+/* rescale(rhs, 0) if rhs->exponent is <0. */
+/* Otherwise the result is rhs (so no error is possible, except for */
+/* sNaN). */
+/* */
+/* The context is used for rounding mode and status after sNaN, but */
+/* the digits setting is ignored. The Exact version will signal */
+/* Inexact if the result differs numerically from rhs; the other */
+/* never signals Inexact. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberToIntegralExact(decNumber *res, const decNumber *rhs,
+ decContext *set) {
+ decNumber dn;
+ decContext workset; /* working context */
+ uInt status=0; /* accumulator */
+
+ #if DECCHECK
+ if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
+ #endif
+
+ /* handle infinities and NaNs */
+ if (SPECIALARG) {
+ if (decNumberIsInfinite(rhs)) uprv_decNumberCopy(res, rhs); /* an Infinity */
+ else decNaNs(res, rhs, NULL, set, &status); /* a NaN */
+ }
+ else { /* finite */
+ /* have a finite number; no error possible (res must be big enough) */
+ if (rhs->exponent>=0) return uprv_decNumberCopy(res, rhs);
+ /* that was easy, but if negative exponent there is work to do... */
+ workset=*set; /* clone rounding, etc. */
+ workset.digits=rhs->digits; /* no length rounding */
+ workset.traps=0; /* no traps */
+ uprv_decNumberZero(&dn); /* make a number with exponent 0 */
+ uprv_decNumberQuantize(res, rhs, &dn, &workset);
+ status|=workset.status;
+ }
+ if (status!=0) decStatus(res, status, set);
+ return res;
+ } /* decNumberToIntegralExact */
+
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberToIntegralValue(decNumber *res, const decNumber *rhs,
+ decContext *set) {
+ decContext workset=*set; /* working context */
+ workset.traps=0; /* no traps */
+ uprv_decNumberToIntegralExact(res, rhs, &workset);
+ /* this never affects set, except for sNaNs; NaN will have been set */
+ /* or propagated already, so no need to call decStatus */
+ set->status|=workset.status&DEC_Invalid_operation;
+ return res;
+ } /* decNumberToIntegralValue */
+
+/* ------------------------------------------------------------------ */
+/* decNumberXor -- XOR two Numbers, digitwise */
+/* */
+/* This computes C = A ^ B */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X^X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context (used for result length and error report) */
+/* */
+/* C must have space for set->digits digits. */
+/* */
+/* Logical function restrictions apply (see above); a NaN is */
+/* returned with Invalid_operation if a restriction is violated. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberXor(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ const Unit *ua, *ub; /* -> operands */
+ const Unit *msua, *msub; /* -> operand msus */
+ Unit *uc, *msuc; /* -> result and its msu */
+ Int msudigs; /* digits in res msu */
+ #if DECCHECK
+ if (decCheckOperands(res, lhs, rhs, set)) return res;
+ #endif
+
+ if (lhs->exponent!=0 || decNumberIsSpecial(lhs) || decNumberIsNegative(lhs)
+ || rhs->exponent!=0 || decNumberIsSpecial(rhs) || decNumberIsNegative(rhs)) {
+ decStatus(res, DEC_Invalid_operation, set);
+ return res;
+ }
+ /* operands are valid */
+ ua=lhs->lsu; /* bottom-up */
+ ub=rhs->lsu; /* .. */
+ uc=res->lsu; /* .. */
+ msua=ua+D2U(lhs->digits)-1; /* -> msu of lhs */
+ msub=ub+D2U(rhs->digits)-1; /* -> msu of rhs */
+ msuc=uc+D2U(set->digits)-1; /* -> msu of result */
+ msudigs=MSUDIGITS(set->digits); /* [faster than remainder] */
+ for (; uc<=msuc; ua++, ub++, uc++) { /* Unit loop */
+ Unit a, b; /* extract units */
+ if (ua>msua) a=0;
+ else a=*ua;
+ if (ub>msub) b=0;
+ else b=*ub;
+ *uc=0; /* can now write back */
+ if (a|b) { /* maybe 1 bits to examine */
+ Int i, j;
+ /* This loop could be unrolled and/or use BIN2BCD tables */
+ for (i=0; i<DECDPUN; i++) {
+ if ((a^b)&1) *uc=*uc+(Unit)powers[i]; /* effect XOR */
+ j=a%10;
+ a=a/10;
+ j|=b%10;
+ b=b/10;
+ if (j>1) {
+ decStatus(res, DEC_Invalid_operation, set);
+ return res;
+ }
+ if (uc==msuc && i==msudigs-1) break; /* just did final digit */
+ } /* each digit */
+ } /* non-zero */
+ } /* each unit */
+ /* [here uc-1 is the msu of the result] */
+ res->digits=decGetDigits(res->lsu, static_cast<int32_t>(uc-res->lsu));
+ res->exponent=0; /* integer */
+ res->bits=0; /* sign=0 */
+ return res; /* [no status to set] */
+ } /* decNumberXor */
+
+
+/* ================================================================== */
+/* Utility routines */
+/* ================================================================== */
+
+/* ------------------------------------------------------------------ */
+/* decNumberClass -- return the decClass of a decNumber */
+/* dn -- the decNumber to test */
+/* set -- the context to use for Emin */
+/* returns the decClass enum */
+/* ------------------------------------------------------------------ */
+enum decClass uprv_decNumberClass(const decNumber *dn, decContext *set) {
+ if (decNumberIsSpecial(dn)) {
+ if (decNumberIsQNaN(dn)) return DEC_CLASS_QNAN;
+ if (decNumberIsSNaN(dn)) return DEC_CLASS_SNAN;
+ /* must be an infinity */
+ if (decNumberIsNegative(dn)) return DEC_CLASS_NEG_INF;
+ return DEC_CLASS_POS_INF;
+ }
+ /* is finite */
+ if (uprv_decNumberIsNormal(dn, set)) { /* most common */
+ if (decNumberIsNegative(dn)) return DEC_CLASS_NEG_NORMAL;
+ return DEC_CLASS_POS_NORMAL;
+ }
+ /* is subnormal or zero */
+ if (decNumberIsZero(dn)) { /* most common */
+ if (decNumberIsNegative(dn)) return DEC_CLASS_NEG_ZERO;
+ return DEC_CLASS_POS_ZERO;
+ }
+ if (decNumberIsNegative(dn)) return DEC_CLASS_NEG_SUBNORMAL;
+ return DEC_CLASS_POS_SUBNORMAL;
+ } /* decNumberClass */
+
+/* ------------------------------------------------------------------ */
+/* decNumberClassToString -- convert decClass to a string */
+/* */
+/* eclass is a valid decClass */
+/* returns a constant string describing the class (max 13+1 chars) */
+/* ------------------------------------------------------------------ */
+const char *uprv_decNumberClassToString(enum decClass eclass) {
+ if (eclass==DEC_CLASS_POS_NORMAL) return DEC_ClassString_PN;
+ if (eclass==DEC_CLASS_NEG_NORMAL) return DEC_ClassString_NN;
+ if (eclass==DEC_CLASS_POS_ZERO) return DEC_ClassString_PZ;
+ if (eclass==DEC_CLASS_NEG_ZERO) return DEC_ClassString_NZ;
+ if (eclass==DEC_CLASS_POS_SUBNORMAL) return DEC_ClassString_PS;
+ if (eclass==DEC_CLASS_NEG_SUBNORMAL) return DEC_ClassString_NS;
+ if (eclass==DEC_CLASS_POS_INF) return DEC_ClassString_PI;
+ if (eclass==DEC_CLASS_NEG_INF) return DEC_ClassString_NI;
+ if (eclass==DEC_CLASS_QNAN) return DEC_ClassString_QN;
+ if (eclass==DEC_CLASS_SNAN) return DEC_ClassString_SN;
+ return DEC_ClassString_UN; /* Unknown */
+ } /* decNumberClassToString */
+
+/* ------------------------------------------------------------------ */
+/* decNumberCopy -- copy a number */
+/* */
+/* dest is the target decNumber */
+/* src is the source decNumber */
+/* returns dest */
+/* */
+/* (dest==src is allowed and is a no-op) */
+/* All fields are updated as required. This is a utility operation, */
+/* so special values are unchanged and no error is possible. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberCopy(decNumber *dest, const decNumber *src) {
+
+ #if DECCHECK
+ if (src==NULL) return uprv_decNumberZero(dest);
+ #endif
+
+ if (dest==src) return dest; /* no copy required */
+
+ /* Use explicit assignments here as structure assignment could copy */
+ /* more than just the lsu (for small DECDPUN). This would not affect */
+ /* the value of the results, but could disturb test harness spill */
+ /* checking. */
+ dest->bits=src->bits;
+ dest->exponent=src->exponent;
+ dest->digits=src->digits;
+ dest->lsu[0]=src->lsu[0];
+ if (src->digits>DECDPUN) { /* more Units to come */
+ const Unit *smsup, *s; /* work */
+ Unit *d; /* .. */
+ /* memcpy for the remaining Units would be safe as they cannot */
+ /* overlap. However, this explicit loop is faster in short cases. */
+ d=dest->lsu+1; /* -> first destination */
+ smsup=src->lsu+D2U(src->digits); /* -> source msu+1 */
+ for (s=src->lsu+1; s<smsup; s++, d++) *d=*s;
+ }
+ return dest;
+ } /* decNumberCopy */
+
+/* ------------------------------------------------------------------ */
+/* decNumberCopyAbs -- quiet absolute value operator */
+/* */
+/* This sets C = abs(A) */
+/* */
+/* res is C, the result. C may be A */
+/* rhs is A */
+/* */
+/* C must have space for set->digits digits. */
+/* No exception or error can occur; this is a quiet bitwise operation.*/
+/* See also decNumberAbs for a checking version of this. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberCopyAbs(decNumber *res, const decNumber *rhs) {
+ #if DECCHECK
+ if (decCheckOperands(res, DECUNUSED, rhs, DECUNCONT)) return res;
+ #endif
+ uprv_decNumberCopy(res, rhs);
+ res->bits&=~DECNEG; /* turn off sign */
+ return res;
+ } /* decNumberCopyAbs */
+
+/* ------------------------------------------------------------------ */
+/* decNumberCopyNegate -- quiet negate value operator */
+/* */
+/* This sets C = negate(A) */
+/* */
+/* res is C, the result. C may be A */
+/* rhs is A */
+/* */
+/* C must have space for set->digits digits. */
+/* No exception or error can occur; this is a quiet bitwise operation.*/
+/* See also decNumberMinus for a checking version of this. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberCopyNegate(decNumber *res, const decNumber *rhs) {
+ #if DECCHECK
+ if (decCheckOperands(res, DECUNUSED, rhs, DECUNCONT)) return res;
+ #endif
+ uprv_decNumberCopy(res, rhs);
+ res->bits^=DECNEG; /* invert the sign */
+ return res;
+ } /* decNumberCopyNegate */
+
+/* ------------------------------------------------------------------ */
+/* decNumberCopySign -- quiet copy and set sign operator */
+/* */
+/* This sets C = A with the sign of B */
+/* */
+/* res is C, the result. C may be A */
+/* lhs is A */
+/* rhs is B */
+/* */
+/* C must have space for set->digits digits. */
+/* No exception or error can occur; this is a quiet bitwise operation.*/
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberCopySign(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs) {
+ uByte sign; /* rhs sign */
+ #if DECCHECK
+ if (decCheckOperands(res, DECUNUSED, rhs, DECUNCONT)) return res;
+ #endif
+ sign=rhs->bits & DECNEG; /* save sign bit */
+ uprv_decNumberCopy(res, lhs);
+ res->bits&=~DECNEG; /* clear the sign */
+ res->bits|=sign; /* set from rhs */
+ return res;
+ } /* decNumberCopySign */
+
+/* ------------------------------------------------------------------ */
+/* decNumberGetBCD -- get the coefficient in BCD8 */
+/* dn is the source decNumber */
+/* bcd is the uInt array that will receive dn->digits BCD bytes, */
+/* most-significant at offset 0 */
+/* returns bcd */
+/* */
+/* bcd must have at least dn->digits bytes. No error is possible; if */
+/* dn is a NaN or Infinite, digits must be 1 and the coefficient 0. */
+/* ------------------------------------------------------------------ */
+U_CAPI uByte * U_EXPORT2 uprv_decNumberGetBCD(const decNumber *dn, uByte *bcd) {
+ uByte *ub=bcd+dn->digits-1; /* -> lsd */
+ const Unit *up=dn->lsu; /* Unit pointer, -> lsu */
+
+ #if DECDPUN==1 /* trivial simple copy */
+ for (; ub>=bcd; ub--, up++) *ub=*up;
+ #else /* chopping needed */
+ uInt u=*up; /* work */
+ uInt cut=DECDPUN; /* downcounter through unit */
+ for (; ub>=bcd; ub--) {
+ *ub=(uByte)(u%10); /* [*6554 trick inhibits, here] */
+ u=u/10;
+ cut--;
+ if (cut>0) continue; /* more in this unit */
+ up++;
+ u=*up;
+ cut=DECDPUN;
+ }
+ #endif
+ return bcd;
+ } /* decNumberGetBCD */
+
+/* ------------------------------------------------------------------ */
+/* decNumberSetBCD -- set (replace) the coefficient from BCD8 */
+/* dn is the target decNumber */
+/* bcd is the uInt array that will source n BCD bytes, most- */
+/* significant at offset 0 */
+/* n is the number of digits in the source BCD array (bcd) */
+/* returns dn */
+/* */
+/* dn must have space for at least n digits. No error is possible; */
+/* if dn is a NaN, or Infinite, or is to become a zero, n must be 1 */
+/* and bcd[0] zero. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberSetBCD(decNumber *dn, const uByte *bcd, uInt n) {
+ Unit *up=dn->lsu+D2U(dn->digits)-1; /* -> msu [target pointer] */
+ const uByte *ub=bcd; /* -> source msd */
+
+ #if DECDPUN==1 /* trivial simple copy */
+ for (; ub<bcd+n; ub++, up--) *up=*ub;
+ #else /* some assembly needed */
+ /* calculate how many digits in msu, and hence first cut */
+ Int cut=MSUDIGITS(n); /* [faster than remainder] */
+ for (;up>=dn->lsu; up--) { /* each Unit from msu */
+ *up=0; /* will take <=DECDPUN digits */
+ for (; cut>0; ub++, cut--) *up=X10(*up)+*ub;
+ cut=DECDPUN; /* next Unit has all digits */
+ }
+ #endif
+ dn->digits=n; /* set digit count */
+ return dn;
+ } /* decNumberSetBCD */
+
+/* ------------------------------------------------------------------ */
+/* decNumberIsNormal -- test normality of a decNumber */
+/* dn is the decNumber to test */
+/* set is the context to use for Emin */
+/* returns 1 if |dn| is finite and >=Nmin, 0 otherwise */
+/* ------------------------------------------------------------------ */
+Int uprv_decNumberIsNormal(const decNumber *dn, decContext *set) {
+ Int ae; /* adjusted exponent */
+ #if DECCHECK
+ if (decCheckOperands(DECUNRESU, DECUNUSED, dn, set)) return 0;
+ #endif
+
+ if (decNumberIsSpecial(dn)) return 0; /* not finite */
+ if (decNumberIsZero(dn)) return 0; /* not non-zero */
+
+ ae=dn->exponent+dn->digits-1; /* adjusted exponent */
+ if (ae<set->emin) return 0; /* is subnormal */
+ return 1;
+ } /* decNumberIsNormal */
+
+/* ------------------------------------------------------------------ */
+/* decNumberIsSubnormal -- test subnormality of a decNumber */
+/* dn is the decNumber to test */
+/* set is the context to use for Emin */
+/* returns 1 if |dn| is finite, non-zero, and <Nmin, 0 otherwise */
+/* ------------------------------------------------------------------ */
+Int uprv_decNumberIsSubnormal(const decNumber *dn, decContext *set) {
+ Int ae; /* adjusted exponent */
+ #if DECCHECK
+ if (decCheckOperands(DECUNRESU, DECUNUSED, dn, set)) return 0;
+ #endif
+
+ if (decNumberIsSpecial(dn)) return 0; /* not finite */
+ if (decNumberIsZero(dn)) return 0; /* not non-zero */
+
+ ae=dn->exponent+dn->digits-1; /* adjusted exponent */
+ if (ae<set->emin) return 1; /* is subnormal */
+ return 0;
+ } /* decNumberIsSubnormal */
+
+/* ------------------------------------------------------------------ */
+/* decNumberTrim -- remove insignificant zeros */
+/* */
+/* dn is the number to trim */
+/* returns dn */
+/* */
+/* All fields are updated as required. This is a utility operation, */
+/* so special values are unchanged and no error is possible. The */
+/* zeros are removed unconditionally. */
+/* ------------------------------------------------------------------ */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberTrim(decNumber *dn) {
+ Int dropped; /* work */
+ decContext set; /* .. */
+ #if DECCHECK
+ if (decCheckOperands(DECUNRESU, DECUNUSED, dn, DECUNCONT)) return dn;
+ #endif
+ uprv_decContextDefault(&set, DEC_INIT_BASE); /* clamp=0 */
+ return decTrim(dn, &set, 0, 1, &dropped);
+ } /* decNumberTrim */
+
+/* ------------------------------------------------------------------ */
+/* decNumberVersion -- return the name and version of this module */
+/* */
+/* No error is possible. */
+/* ------------------------------------------------------------------ */
+const char * uprv_decNumberVersion(void) {
+ return DECVERSION;
+ } /* decNumberVersion */
+
+/* ------------------------------------------------------------------ */
+/* decNumberZero -- set a number to 0 */
+/* */
+/* dn is the number to set, with space for one digit */
+/* returns dn */
+/* */
+/* No error is possible. */
+/* ------------------------------------------------------------------ */
+/* Memset is not used as it is much slower in some environments. */
+U_CAPI decNumber * U_EXPORT2 uprv_decNumberZero(decNumber *dn) {
+
+ #if DECCHECK
+ if (decCheckOperands(dn, DECUNUSED, DECUNUSED, DECUNCONT)) return dn;
+ #endif
+
+ dn->bits=0;
+ dn->exponent=0;
+ dn->digits=1;
+ dn->lsu[0]=0;
+ return dn;
+ } /* decNumberZero */
+
+/* ================================================================== */
+/* Local routines */
+/* ================================================================== */
+
+/* ------------------------------------------------------------------ */
+/* decToString -- lay out a number into a string */
+/* */
+/* dn is the number to lay out */
+/* string is where to lay out the number */
+/* eng is 1 if Engineering, 0 if Scientific */
+/* */
+/* string must be at least dn->digits+14 characters long */
+/* No error is possible. */
+/* */
+/* Note that this routine can generate a -0 or 0.000. These are */
+/* never generated in subset to-number or arithmetic, but can occur */
+/* in non-subset arithmetic (e.g., -1*0 or 1.234-1.234). */
+/* ------------------------------------------------------------------ */
+/* If DECCHECK is enabled the string "?" is returned if a number is */
+/* invalid. */
+static void decToString(const decNumber *dn, char *string, Flag eng) {
+ Int exp=dn->exponent; /* local copy */
+ Int e; /* E-part value */
+ Int pre; /* digits before the '.' */
+ Int cut; /* for counting digits in a Unit */
+ char *c=string; /* work [output pointer] */
+ const Unit *up=dn->lsu+D2U(dn->digits)-1; /* -> msu [input pointer] */
+ uInt u, pow; /* work */
+
+ #if DECCHECK
+ if (decCheckOperands(DECUNRESU, dn, DECUNUSED, DECUNCONT)) {
+ strcpy(string, "?");
+ return;}
+ #endif
+
+ if (decNumberIsNegative(dn)) { /* Negatives get a minus */
+ *c='-';
+ c++;
+ }
+ if (dn->bits&DECSPECIAL) { /* Is a special value */
+ if (decNumberIsInfinite(dn)) {
+ strcpy(c, "Inf");
+ strcpy(c+3, "inity");
+ return;}
+ /* a NaN */
+ if (dn->bits&DECSNAN) { /* signalling NaN */
+ *c='s';
+ c++;
+ }
+ strcpy(c, "NaN");
+ c+=3; /* step past */
+ /* if not a clean non-zero coefficient, that's all there is in a */
+ /* NaN string */
+ if (exp!=0 || (*dn->lsu==0 && dn->digits==1)) return;
+ /* [drop through to add integer] */
+ }
+
+ /* calculate how many digits in msu, and hence first cut */
+ cut=MSUDIGITS(dn->digits); /* [faster than remainder] */
+ cut--; /* power of ten for digit */
+
+ if (exp==0) { /* simple integer [common fastpath] */
+ for (;up>=dn->lsu; up--) { /* each Unit from msu */
+ u=*up; /* contains DECDPUN digits to lay out */
+ for (; cut>=0; c++, cut--) TODIGIT(u, cut, c, pow);
+ cut=DECDPUN-1; /* next Unit has all digits */
+ }
+ *c='\0'; /* terminate the string */
+ return;}
+
+ /* non-0 exponent -- assume plain form */
+ pre=dn->digits+exp; /* digits before '.' */
+ e=0; /* no E */
+ if ((exp>0) || (pre<-5)) { /* need exponential form */
+ e=exp+dn->digits-1; /* calculate E value */
+ pre=1; /* assume one digit before '.' */
+ if (eng && (e!=0)) { /* engineering: may need to adjust */
+ Int adj; /* adjustment */
+ /* The C remainder operator is undefined for negative numbers, so */
+ /* a positive remainder calculation must be used here */
+ if (e<0) {
+ adj=(-e)%3;
+ if (adj!=0) adj=3-adj;
+ }
+ else { /* e>0 */
+ adj=e%3;
+ }
+ e=e-adj;
+ /* if dealing with zero still produce an exponent which is a */
+ /* multiple of three, as expected, but there will only be the */
+ /* one zero before the E, still. Otherwise note the padding. */
+ if (!ISZERO(dn)) pre+=adj;
+ else { /* is zero */
+ if (adj!=0) { /* 0.00Esnn needed */
+ e=e+3;
+ pre=-(2-adj);
+ }
+ } /* zero */
+ } /* eng */
+ } /* need exponent */
+
+ /* lay out the digits of the coefficient, adding 0s and . as needed */
+ u=*up;
+ if (pre>0) { /* xxx.xxx or xx00 (engineering) form */
+ Int n=pre;
+ for (; pre>0; pre--, c++, cut--) {
+ if (cut<0) { /* need new Unit */
+ if (up==dn->lsu) break; /* out of input digits (pre>digits) */
+ up--;
+ cut=DECDPUN-1;
+ u=*up;
+ }
+ TODIGIT(u, cut, c, pow);
+ }
+ if (n<dn->digits) { /* more to come, after '.' */
+ *c='.'; c++;
+ for (;; c++, cut--) {
+ if (cut<0) { /* need new Unit */
+ if (up==dn->lsu) break; /* out of input digits */
+ up--;
+ cut=DECDPUN-1;
+ u=*up;
+ }
+ TODIGIT(u, cut, c, pow);
+ }
+ }
+ else for (; pre>0; pre--, c++) *c='0'; /* 0 padding (for engineering) needed */
+ }
+ else { /* 0.xxx or 0.000xxx form */
+ *c='0'; c++;
+ *c='.'; c++;
+ for (; pre<0; pre++, c++) *c='0'; /* add any 0's after '.' */
+ for (; ; c++, cut--) {
+ if (cut<0) { /* need new Unit */
+ if (up==dn->lsu) break; /* out of input digits */
+ up--;
+ cut=DECDPUN-1;
+ u=*up;
+ }
+ TODIGIT(u, cut, c, pow);
+ }
+ }
+
+ /* Finally add the E-part, if needed. It will never be 0, has a
+ base maximum and minimum of +999999999 through -999999999, but
+ could range down to -1999999998 for anormal numbers */
+ if (e!=0) {
+ Flag had=0; /* 1=had non-zero */
+ *c='E'; c++;
+ *c='+'; c++; /* assume positive */
+ u=e; /* .. */
+ if (e<0) {
+ *(c-1)='-'; /* oops, need - */
+ u=-e; /* uInt, please */
+ }
+ /* lay out the exponent [_itoa or equivalent is not ANSI C] */
+ for (cut=9; cut>=0; cut--) {
+ TODIGIT(u, cut, c, pow);
+ if (*c=='0' && !had) continue; /* skip leading zeros */
+ had=1; /* had non-0 */
+ c++; /* step for next */
+ } /* cut */
+ }
+ *c='\0'; /* terminate the string (all paths) */
+ return;
+ } /* decToString */
+
+/* ------------------------------------------------------------------ */
+/* decAddOp -- add/subtract operation */
+/* */
+/* This computes C = A + B */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X+X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* negate is DECNEG if rhs should be negated, or 0 otherwise */
+/* status accumulates status for the caller */
+/* */
+/* C must have space for set->digits digits. */
+/* Inexact in status must be 0 for correct Exact zero sign in result */
+/* ------------------------------------------------------------------ */
+/* If possible, the coefficient is calculated directly into C. */
+/* However, if: */
+/* -- a digits+1 calculation is needed because the numbers are */
+/* unaligned and span more than set->digits digits */
+/* -- a carry to digits+1 digits looks possible */
+/* -- C is the same as A or B, and the result would destructively */
+/* overlap the A or B coefficient */
+/* then the result must be calculated into a temporary buffer. In */
+/* this case a local (stack) buffer is used if possible, and only if */
+/* too long for that does malloc become the final resort. */
+/* */
+/* Misalignment is handled as follows: */
+/* Apad: (AExp>BExp) Swap operands and proceed as for BExp>AExp. */
+/* BPad: Apply the padding by a combination of shifting (whole */
+/* units) and multiplication (part units). */
+/* */
+/* Addition, especially x=x+1, is speed-critical. */
+/* The static buffer is larger than might be expected to allow for */
+/* calls from higher-level funtions (notable exp). */
+/* ------------------------------------------------------------------ */
+static decNumber * decAddOp(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set,
+ uByte negate, uInt *status) {
+ #if DECSUBSET
+ decNumber *alloclhs=NULL; /* non-NULL if rounded lhs allocated */
+ decNumber *allocrhs=NULL; /* .., rhs */
+ #endif
+ Int rhsshift; /* working shift (in Units) */
+ Int maxdigits; /* longest logical length */
+ Int mult; /* multiplier */
+ Int residue; /* rounding accumulator */
+ uByte bits; /* result bits */
+ Flag diffsign; /* non-0 if arguments have different sign */
+ Unit *acc; /* accumulator for result */
+ Unit accbuff[SD2U(DECBUFFER*2+20)]; /* local buffer [*2+20 reduces many */
+ /* allocations when called from */
+ /* other operations, notable exp] */
+ Unit *allocacc=NULL; /* -> allocated acc buffer, iff allocated */
+ Int reqdigits=set->digits; /* local copy; requested DIGITS */
+ Int padding; /* work */
+
+ #if DECCHECK
+ if (decCheckOperands(res, lhs, rhs, set)) return res;
+ #endif
+
+ do { /* protect allocated storage */
+ #if DECSUBSET
+ if (!set->extended) {
+ /* reduce operands and set lostDigits status, as needed */
+ if (lhs->digits>reqdigits) {
+ alloclhs=decRoundOperand(lhs, set, status);
+ if (alloclhs==NULL) break;
+ lhs=alloclhs;
+ }
+ if (rhs->digits>reqdigits) {
+ allocrhs=decRoundOperand(rhs, set, status);
+ if (allocrhs==NULL) break;
+ rhs=allocrhs;
+ }
+ }
+ #endif
+ /* [following code does not require input rounding] */
+
+ /* note whether signs differ [used all paths] */
+ diffsign=(Flag)((lhs->bits^rhs->bits^negate)&DECNEG);
+
+ /* handle infinities and NaNs */
+ if (SPECIALARGS) { /* a special bit set */
+ if (SPECIALARGS & (DECSNAN | DECNAN)) /* a NaN */
+ decNaNs(res, lhs, rhs, set, status);
+ else { /* one or two infinities */
+ if (decNumberIsInfinite(lhs)) { /* LHS is infinity */
+ /* two infinities with different signs is invalid */
+ if (decNumberIsInfinite(rhs) && diffsign) {
+ *status|=DEC_Invalid_operation;
+ break;
+ }
+ bits=lhs->bits & DECNEG; /* get sign from LHS */
+ }
+ else bits=(rhs->bits^negate) & DECNEG;/* RHS must be Infinity */
+ bits|=DECINF;
+ uprv_decNumberZero(res);
+ res->bits=bits; /* set +/- infinity */
+ } /* an infinity */
+ break;
+ }
+
+ /* Quick exit for add 0s; return the non-0, modified as need be */
+ if (ISZERO(lhs)) {
+ Int adjust; /* work */
+ Int lexp=lhs->exponent; /* save in case LHS==RES */
+ bits=lhs->bits; /* .. */
+ residue=0; /* clear accumulator */
+ decCopyFit(res, rhs, set, &residue, status); /* copy (as needed) */
+ res->bits^=negate; /* flip if rhs was negated */
+ #if DECSUBSET
+ if (set->extended) { /* exponents on zeros count */
+ #endif
+ /* exponent will be the lower of the two */
+ adjust=lexp-res->exponent; /* adjustment needed [if -ve] */
+ if (ISZERO(res)) { /* both 0: special IEEE 754 rules */
+ if (adjust<0) res->exponent=lexp; /* set exponent */
+ /* 0-0 gives +0 unless rounding to -infinity, and -0-0 gives -0 */
+ if (diffsign) {
+ if (set->round!=DEC_ROUND_FLOOR) res->bits=0;
+ else res->bits=DECNEG; /* preserve 0 sign */
+ }
+ }
+ else { /* non-0 res */
+ if (adjust<0) { /* 0-padding needed */
+ if ((res->digits-adjust)>set->digits) {
+ adjust=res->digits-set->digits; /* to fit exactly */
+ *status|=DEC_Rounded; /* [but exact] */
+ }
+ res->digits=decShiftToMost(res->lsu, res->digits, -adjust);
+ res->exponent+=adjust; /* set the exponent. */
+ }
+ } /* non-0 res */
+ #if DECSUBSET
+ } /* extended */
+ #endif
+ decFinish(res, set, &residue, status); /* clean and finalize */
+ break;}
+
+ if (ISZERO(rhs)) { /* [lhs is non-zero] */
+ Int adjust; /* work */
+ Int rexp=rhs->exponent; /* save in case RHS==RES */
+ bits=rhs->bits; /* be clean */
+ residue=0; /* clear accumulator */
+ decCopyFit(res, lhs, set, &residue, status); /* copy (as needed) */
+ #if DECSUBSET
+ if (set->extended) { /* exponents on zeros count */
+ #endif
+ /* exponent will be the lower of the two */
+ /* [0-0 case handled above] */
+ adjust=rexp-res->exponent; /* adjustment needed [if -ve] */
+ if (adjust<0) { /* 0-padding needed */
+ if ((res->digits-adjust)>set->digits) {
+ adjust=res->digits-set->digits; /* to fit exactly */
+ *status|=DEC_Rounded; /* [but exact] */
+ }
+ res->digits=decShiftToMost(res->lsu, res->digits, -adjust);
+ res->exponent+=adjust; /* set the exponent. */
+ }
+ #if DECSUBSET
+ } /* extended */
+ #endif
+ decFinish(res, set, &residue, status); /* clean and finalize */
+ break;}
+
+ /* [NB: both fastpath and mainpath code below assume these cases */
+ /* (notably 0-0) have already been handled] */
+
+ /* calculate the padding needed to align the operands */
+ padding=rhs->exponent-lhs->exponent;
+
+ /* Fastpath cases where the numbers are aligned and normal, the RHS */
+ /* is all in one unit, no operand rounding is needed, and no carry, */
+ /* lengthening, or borrow is needed */
+ if (padding==0
+ && rhs->digits<=DECDPUN
+ && rhs->exponent>=set->emin /* [some normals drop through] */
+ && rhs->exponent<=set->emax-set->digits+1 /* [could clamp] */
+ && rhs->digits<=reqdigits
+ && lhs->digits<=reqdigits) {
+ Int partial=*lhs->lsu;
+ if (!diffsign) { /* adding */
+ partial+=*rhs->lsu;
+ if ((partial<=DECDPUNMAX) /* result fits in unit */
+ && (lhs->digits>=DECDPUN || /* .. and no digits-count change */
+ partial<(Int)powers[lhs->digits])) { /* .. */
+ if (res!=lhs) uprv_decNumberCopy(res, lhs); /* not in place */
+ *res->lsu=(Unit)partial; /* [copy could have overwritten RHS] */
+ break;
+ }
+ /* else drop out for careful add */
+ }
+ else { /* signs differ */
+ partial-=*rhs->lsu;
+ if (partial>0) { /* no borrow needed, and non-0 result */
+ if (res!=lhs) uprv_decNumberCopy(res, lhs); /* not in place */
+ *res->lsu=(Unit)partial;
+ /* this could have reduced digits [but result>0] */
+ res->digits=decGetDigits(res->lsu, D2U(res->digits));
+ break;
+ }
+ /* else drop out for careful subtract */
+ }
+ }
+
+ /* Now align (pad) the lhs or rhs so they can be added or */
+ /* subtracted, as necessary. If one number is much larger than */
+ /* the other (that is, if in plain form there is a least one */
+ /* digit between the lowest digit of one and the highest of the */
+ /* other) padding with up to DIGITS-1 trailing zeros may be */
+ /* needed; then apply rounding (as exotic rounding modes may be */
+ /* affected by the residue). */
+ rhsshift=0; /* rhs shift to left (padding) in Units */
+ bits=lhs->bits; /* assume sign is that of LHS */
+ mult=1; /* likely multiplier */
+
+ /* [if padding==0 the operands are aligned; no padding is needed] */
+ if (padding!=0) {
+ /* some padding needed; always pad the RHS, as any required */
+ /* padding can then be effected by a simple combination of */
+ /* shifts and a multiply */
+ Flag swapped=0;
+ if (padding<0) { /* LHS needs the padding */
+ const decNumber *t;
+ padding=-padding; /* will be +ve */
+ bits=(uByte)(rhs->bits^negate); /* assumed sign is now that of RHS */
+ t=lhs; lhs=rhs; rhs=t;
+ swapped=1;
+ }
+
+ /* If, after pad, rhs would be longer than lhs by digits+1 or */
+ /* more then lhs cannot affect the answer, except as a residue, */
+ /* so only need to pad up to a length of DIGITS+1. */
+ if (rhs->digits+padding > lhs->digits+reqdigits+1) {
+ /* The RHS is sufficient */
+ /* for residue use the relative sign indication... */
+ Int shift=reqdigits-rhs->digits; /* left shift needed */
+ residue=1; /* residue for rounding */
+ if (diffsign) residue=-residue; /* signs differ */
+ /* copy, shortening if necessary */
+ decCopyFit(res, rhs, set, &residue, status);
+ /* if it was already shorter, then need to pad with zeros */
+ if (shift>0) {
+ res->digits=decShiftToMost(res->lsu, res->digits, shift);
+ res->exponent-=shift; /* adjust the exponent. */
+ }
+ /* flip the result sign if unswapped and rhs was negated */
+ if (!swapped) res->bits^=negate;
+ decFinish(res, set, &residue, status); /* done */
+ break;}
+
+ /* LHS digits may affect result */
+ rhsshift=D2U(padding+1)-1; /* this much by Unit shift .. */
+ mult=powers[padding-(rhsshift*DECDPUN)]; /* .. this by multiplication */
+ } /* padding needed */
+
+ if (diffsign) mult=-mult; /* signs differ */
+
+ /* determine the longer operand */
+ maxdigits=rhs->digits+padding; /* virtual length of RHS */
+ if (lhs->digits>maxdigits) maxdigits=lhs->digits;
+
+ /* Decide on the result buffer to use; if possible place directly */
+ /* into result. */
+ acc=res->lsu; /* assume add direct to result */
+ /* If destructive overlap, or the number is too long, or a carry or */
+ /* borrow to DIGITS+1 might be possible, a buffer must be used. */
+ /* [Might be worth more sophisticated tests when maxdigits==reqdigits] */
+ if ((maxdigits>=reqdigits) /* is, or could be, too large */
+ || (res==rhs && rhsshift>0)) { /* destructive overlap */
+ /* buffer needed, choose it; units for maxdigits digits will be */
+ /* needed, +1 Unit for carry or borrow */
+ Int need=D2U(maxdigits)+1;
+ acc=accbuff; /* assume use local buffer */
+ if (need*sizeof(Unit)>sizeof(accbuff)) {
+ /* printf("malloc add %ld %ld\n", need, sizeof(accbuff)); */
+ allocacc=(Unit *)malloc(need*sizeof(Unit));
+ if (allocacc==NULL) { /* hopeless -- abandon */
+ *status|=DEC_Insufficient_storage;
+ break;}
+ acc=allocacc;
+ }
+ }
+
+ res->bits=(uByte)(bits&DECNEG); /* it's now safe to overwrite.. */
+ res->exponent=lhs->exponent; /* .. operands (even if aliased) */
+
+ #if DECTRACE
+ decDumpAr('A', lhs->lsu, D2U(lhs->digits));
+ decDumpAr('B', rhs->lsu, D2U(rhs->digits));
+ printf(" :h: %ld %ld\n", rhsshift, mult);
+ #endif
+
+ /* add [A+B*m] or subtract [A+B*(-m)] */
+ U_ASSERT(rhs->digits > 0);
+ U_ASSERT(lhs->digits > 0);
+ res->digits=decUnitAddSub(lhs->lsu, D2U(lhs->digits),
+ rhs->lsu, D2U(rhs->digits),
+ rhsshift, acc, mult)
+ *DECDPUN; /* [units -> digits] */
+ if (res->digits<0) { /* borrowed... */
+ res->digits=-res->digits;
+ res->bits^=DECNEG; /* flip the sign */
+ }
+ #if DECTRACE
+ decDumpAr('+', acc, D2U(res->digits));
+ #endif
+
+ /* If a buffer was used the result must be copied back, possibly */
+ /* shortening. (If no buffer was used then the result must have */
+ /* fit, so can't need rounding and residue must be 0.) */
+ residue=0; /* clear accumulator */
+ if (acc!=res->lsu) {
+ #if DECSUBSET
+ if (set->extended) { /* round from first significant digit */
+ #endif
+ /* remove leading zeros that were added due to rounding up to */
+ /* integral Units -- before the test for rounding. */
+ if (res->digits>reqdigits)
+ res->digits=decGetDigits(acc, D2U(res->digits));
+ decSetCoeff(res, set, acc, res->digits, &residue, status);
+ #if DECSUBSET
+ }
+ else { /* subset arithmetic rounds from original significant digit */
+ /* May have an underestimate. This only occurs when both */
+ /* numbers fit in DECDPUN digits and are padding with a */
+ /* negative multiple (-10, -100...) and the top digit(s) become */
+ /* 0. (This only matters when using X3.274 rules where the */
+ /* leading zero could be included in the rounding.) */
+ if (res->digits<maxdigits) {
+ *(acc+D2U(res->digits))=0; /* ensure leading 0 is there */
+ res->digits=maxdigits;
+ }
+ else {
+ /* remove leading zeros that added due to rounding up to */
+ /* integral Units (but only those in excess of the original */
+ /* maxdigits length, unless extended) before test for rounding. */
+ if (res->digits>reqdigits) {
+ res->digits=decGetDigits(acc, D2U(res->digits));
+ if (res->digits<maxdigits) res->digits=maxdigits;
+ }
+ }
+ decSetCoeff(res, set, acc, res->digits, &residue, status);
+ /* Now apply rounding if needed before removing leading zeros. */
+ /* This is safe because subnormals are not a possibility */
+ if (residue!=0) {
+ decApplyRound(res, set, residue, status);
+ residue=0; /* did what needed to be done */
+ }
+ } /* subset */
+ #endif
+ } /* used buffer */
+
+ /* strip leading zeros [these were left on in case of subset subtract] */
+ res->digits=decGetDigits(res->lsu, D2U(res->digits));
+
+ /* apply checks and rounding */
+ decFinish(res, set, &residue, status);
+
+ /* "When the sum of two operands with opposite signs is exactly */
+ /* zero, the sign of that sum shall be '+' in all rounding modes */
+ /* except round toward -Infinity, in which mode that sign shall be */
+ /* '-'." [Subset zeros also never have '-', set by decFinish.] */
+ if (ISZERO(res) && diffsign
+ #if DECSUBSET
+ && set->extended
+ #endif
+ && (*status&DEC_Inexact)==0) {
+ if (set->round==DEC_ROUND_FLOOR) res->bits|=DECNEG; /* sign - */
+ else res->bits&=~DECNEG; /* sign + */
+ }
+ } while(0); /* end protected */
+
+ if (allocacc!=NULL) free(allocacc); /* drop any storage used */
+ #if DECSUBSET
+ if (allocrhs!=NULL) free(allocrhs); /* .. */
+ if (alloclhs!=NULL) free(alloclhs); /* .. */
+ #endif
+ return res;
+ } /* decAddOp */
+
+/* ------------------------------------------------------------------ */
+/* decDivideOp -- division operation */
+/* */
+/* This routine performs the calculations for all four division */
+/* operators (divide, divideInteger, remainder, remainderNear). */
+/* */
+/* C=A op B */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X/X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* op is DIVIDE, DIVIDEINT, REMAINDER, or REMNEAR respectively. */
+/* status is the usual accumulator */
+/* */
+/* C must have space for set->digits digits. */
+/* */
+/* ------------------------------------------------------------------ */
+/* The underlying algorithm of this routine is the same as in the */
+/* 1981 S/370 implementation, that is, non-restoring long division */
+/* with bi-unit (rather than bi-digit) estimation for each unit */
+/* multiplier. In this pseudocode overview, complications for the */
+/* Remainder operators and division residues for exact rounding are */
+/* omitted for clarity. */
+/* */
+/* Prepare operands and handle special values */
+/* Test for x/0 and then 0/x */
+/* Exp =Exp1 - Exp2 */
+/* Exp =Exp +len(var1) -len(var2) */
+/* Sign=Sign1 * Sign2 */
+/* Pad accumulator (Var1) to double-length with 0's (pad1) */
+/* Pad Var2 to same length as Var1 */
+/* msu2pair/plus=1st 2 or 1 units of var2, +1 to allow for round */
+/* have=0 */
+/* Do until (have=digits+1 OR residue=0) */
+/* if exp<0 then if integer divide/residue then leave */
+/* this_unit=0 */
+/* Do forever */
+/* compare numbers */
+/* if <0 then leave inner_loop */
+/* if =0 then (* quick exit without subtract *) do */
+/* this_unit=this_unit+1; output this_unit */
+/* leave outer_loop; end */
+/* Compare lengths of numbers (mantissae): */
+/* If same then tops2=msu2pair -- {units 1&2 of var2} */
+/* else tops2=msu2plus -- {0, unit 1 of var2} */
+/* tops1=first_unit_of_Var1*10**DECDPUN +second_unit_of_var1 */
+/* mult=tops1/tops2 -- Good and safe guess at divisor */
+/* if mult=0 then mult=1 */
+/* this_unit=this_unit+mult */
+/* subtract */
+/* end inner_loop */
+/* if have\=0 | this_unit\=0 then do */
+/* output this_unit */
+/* have=have+1; end */
+/* var2=var2/10 */
+/* exp=exp-1 */
+/* end outer_loop */
+/* exp=exp+1 -- set the proper exponent */
+/* if have=0 then generate answer=0 */
+/* Return (Result is defined by Var1) */
+/* */
+/* ------------------------------------------------------------------ */
+/* Two working buffers are needed during the division; one (digits+ */
+/* 1) to accumulate the result, and the other (up to 2*digits+1) for */
+/* long subtractions. These are acc and var1 respectively. */
+/* var1 is a copy of the lhs coefficient, var2 is the rhs coefficient.*/
+/* The static buffers may be larger than might be expected to allow */
+/* for calls from higher-level funtions (notable exp). */
+/* ------------------------------------------------------------------ */
+static decNumber * decDivideOp(decNumber *res,
+ const decNumber *lhs, const decNumber *rhs,
+ decContext *set, Flag op, uInt *status) {
+ #if DECSUBSET
+ decNumber *alloclhs=NULL; /* non-NULL if rounded lhs allocated */
+ decNumber *allocrhs=NULL; /* .., rhs */
+ #endif
+ Unit accbuff[SD2U(DECBUFFER+DECDPUN+10)]; /* local buffer */
+ Unit *acc=accbuff; /* -> accumulator array for result */
+ Unit *allocacc=NULL; /* -> allocated buffer, iff allocated */
+ Unit *accnext; /* -> where next digit will go */
+ Int acclength; /* length of acc needed [Units] */
+ Int accunits; /* count of units accumulated */
+ Int accdigits; /* count of digits accumulated */
+
+ Unit varbuff[SD2U(DECBUFFER*2+DECDPUN)]; /* buffer for var1 */
+ Unit *var1=varbuff; /* -> var1 array for long subtraction */
+ Unit *varalloc=NULL; /* -> allocated buffer, iff used */
+ Unit *msu1; /* -> msu of var1 */
+
+ const Unit *var2; /* -> var2 array */
+ const Unit *msu2; /* -> msu of var2 */
+ Int msu2plus; /* msu2 plus one [does not vary] */
+ eInt msu2pair; /* msu2 pair plus one [does not vary] */
+
+ Int var1units, var2units; /* actual lengths */
+ Int var2ulen; /* logical length (units) */
+ Int var1initpad=0; /* var1 initial padding (digits) */
+ Int maxdigits; /* longest LHS or required acc length */
+ Int mult; /* multiplier for subtraction */
+ Unit thisunit; /* current unit being accumulated */
+ Int residue; /* for rounding */
+ Int reqdigits=set->digits; /* requested DIGITS */
+ Int exponent; /* working exponent */
+ Int maxexponent=0; /* DIVIDE maximum exponent if unrounded */
+ uByte bits; /* working sign */
+ Unit *target; /* work */
+ const Unit *source; /* .. */
+ uInt const *pow; /* .. */
+ Int shift, cut; /* .. */
+ #if DECSUBSET
+ Int dropped; /* work */
+ #endif
+
+ #if DECCHECK
+ if (decCheckOperands(res, lhs, rhs, set)) return res;
+ #endif
+
+ do { /* protect allocated storage */
+ #if DECSUBSET
+ if (!set->extended) {
+ /* reduce operands and set lostDigits status, as needed */
+ if (lhs->digits>reqdigits) {
+ alloclhs=decRoundOperand(lhs, set, status);
+ if (alloclhs==NULL) break;
+ lhs=alloclhs;
+ }
+ if (rhs->digits>reqdigits) {
+ allocrhs=decRoundOperand(rhs, set, status);
+ if (allocrhs==NULL) break;
+ rhs=allocrhs;
+ }
+ }
+ #endif
+ /* [following code does not require input rounding] */
+
+ bits=(lhs->bits^rhs->bits)&DECNEG; /* assumed sign for divisions */
+
+ /* handle infinities and NaNs */
+ if (SPECIALARGS) { /* a special bit set */
+ if (SPECIALARGS & (DECSNAN | DECNAN)) { /* one or two NaNs */
+ decNaNs(res, lhs, rhs, set, status);
+ break;
+ }
+ /* one or two infinities */
+ if (decNumberIsInfinite(lhs)) { /* LHS (dividend) is infinite */
+ if (decNumberIsInfinite(rhs) || /* two infinities are invalid .. */
+ op & (REMAINDER | REMNEAR)) { /* as is remainder of infinity */
+ *status|=DEC_Invalid_operation;
+ break;
+ }
+ /* [Note that infinity/0 raises no exceptions] */
+ uprv_decNumberZero(res);
+ res->bits=bits|DECINF; /* set +/- infinity */
+ break;
+ }
+ else { /* RHS (divisor) is infinite */
+ residue=0;
+ if (op&(REMAINDER|REMNEAR)) {
+ /* result is [finished clone of] lhs */
+ decCopyFit(res, lhs, set, &residue, status);
+ }
+ else { /* a division */
+ uprv_decNumberZero(res);
+ res->bits=bits; /* set +/- zero */
+ /* for DIVIDEINT the exponent is always 0. For DIVIDE, result */
+ /* is a 0 with infinitely negative exponent, clamped to minimum */
+ if (op&DIVIDE) {
+ res->exponent=set->emin-set->digits+1;
+ *status|=DEC_Clamped;
+ }
+ }
+ decFinish(res, set, &residue, status);
+ break;
+ }
+ }
+
+ /* handle 0 rhs (x/0) */
+ if (ISZERO(rhs)) { /* x/0 is always exceptional */
+ if (ISZERO(lhs)) {
+ uprv_decNumberZero(res); /* [after lhs test] */
+ *status|=DEC_Division_undefined;/* 0/0 will become NaN */
+ }
+ else {
+ uprv_decNumberZero(res);
+ if (op&(REMAINDER|REMNEAR)) *status|=DEC_Invalid_operation;
+ else {
+ *status|=DEC_Division_by_zero; /* x/0 */
+ res->bits=bits|DECINF; /* .. is +/- Infinity */
+ }
+ }
+ break;}
+
+ /* handle 0 lhs (0/x) */
+ if (ISZERO(lhs)) { /* 0/x [x!=0] */
+ #if DECSUBSET
+ if (!set->extended) uprv_decNumberZero(res);
+ else {
+ #endif
+ if (op&DIVIDE) {
+ residue=0;
+ exponent=lhs->exponent-rhs->exponent; /* ideal exponent */
+ uprv_decNumberCopy(res, lhs); /* [zeros always fit] */
+ res->bits=bits; /* sign as computed */
+ res->exponent=exponent; /* exponent, too */
+ decFinalize(res, set, &residue, status); /* check exponent */
+ }
+ else if (op&DIVIDEINT) {
+ uprv_decNumberZero(res); /* integer 0 */
+ res->bits=bits; /* sign as computed */
+ }
+ else { /* a remainder */
+ exponent=rhs->exponent; /* [save in case overwrite] */
+ uprv_decNumberCopy(res, lhs); /* [zeros always fit] */
+ if (exponent<res->exponent) res->exponent=exponent; /* use lower */
+ }
+ #if DECSUBSET
+ }
+ #endif
+ break;}
+
+ /* Precalculate exponent. This starts off adjusted (and hence fits */
+ /* in 31 bits) and becomes the usual unadjusted exponent as the */
+ /* division proceeds. The order of evaluation is important, here, */
+ /* to avoid wrap. */
+ exponent=(lhs->exponent+lhs->digits)-(rhs->exponent+rhs->digits);
+
+ /* If the working exponent is -ve, then some quick exits are */
+ /* possible because the quotient is known to be <1 */
+ /* [for REMNEAR, it needs to be < -1, as -0.5 could need work] */
+ if (exponent<0 && !(op==DIVIDE)) {
+ if (op&DIVIDEINT) {
+ uprv_decNumberZero(res); /* integer part is 0 */
+ #if DECSUBSET
+ if (set->extended)
+ #endif
+ res->bits=bits; /* set +/- zero */
+ break;}
+ /* fastpath remainders so long as the lhs has the smaller */
+ /* (or equal) exponent */
+ if (lhs->exponent<=rhs->exponent) {
+ if (op&REMAINDER || exponent<-1) {
+ /* It is REMAINDER or safe REMNEAR; result is [finished */
+ /* clone of] lhs (r = x - 0*y) */
+ residue=0;
+ decCopyFit(res, lhs, set, &residue, status);
+ decFinish(res, set, &residue, status);
+ break;
+ }
+ /* [unsafe REMNEAR drops through] */
+ }
+ } /* fastpaths */
+
+ /* Long (slow) division is needed; roll up the sleeves... */
+
+ /* The accumulator will hold the quotient of the division. */
+ /* If it needs to be too long for stack storage, then allocate. */
+ acclength=D2U(reqdigits+DECDPUN); /* in Units */
+ if (acclength*sizeof(Unit)>sizeof(accbuff)) {
+ /* printf("malloc dvacc %ld units\n", acclength); */
+ allocacc=(Unit *)malloc(acclength*sizeof(Unit));
+ if (allocacc==NULL) { /* hopeless -- abandon */
+ *status|=DEC_Insufficient_storage;
+ break;}
+ acc=allocacc; /* use the allocated space */
+ }
+
+ /* var1 is the padded LHS ready for subtractions. */
+ /* If it needs to be too long for stack storage, then allocate. */
+ /* The maximum units needed for var1 (long subtraction) is: */
+ /* Enough for */
+ /* (rhs->digits+reqdigits-1) -- to allow full slide to right */
+ /* or (lhs->digits) -- to allow for long lhs */
+ /* whichever is larger */
+ /* +1 -- for rounding of slide to right */
+ /* +1 -- for leading 0s */
+ /* +1 -- for pre-adjust if a remainder or DIVIDEINT */
+ /* [Note: unused units do not participate in decUnitAddSub data] */
+ maxdigits=rhs->digits+reqdigits-1;
+ if (lhs->digits>maxdigits) maxdigits=lhs->digits;
+ var1units=D2U(maxdigits)+2;
+ /* allocate a guard unit above msu1 for REMAINDERNEAR */
+ if (!(op&DIVIDE)) var1units++;
+ if ((var1units+1)*sizeof(Unit)>sizeof(varbuff)) {
+ /* printf("malloc dvvar %ld units\n", var1units+1); */
+ varalloc=(Unit *)malloc((var1units+1)*sizeof(Unit));
+ if (varalloc==NULL) { /* hopeless -- abandon */
+ *status|=DEC_Insufficient_storage;
+ break;}
+ var1=varalloc; /* use the allocated space */
+ }
+
+ /* Extend the lhs and rhs to full long subtraction length. The lhs */
+ /* is truly extended into the var1 buffer, with 0 padding, so a */
+ /* subtract in place is always possible. The rhs (var2) has */
+ /* virtual padding (implemented by decUnitAddSub). */
+ /* One guard unit was allocated above msu1 for rem=rem+rem in */
+ /* REMAINDERNEAR. */
+ msu1=var1+var1units-1; /* msu of var1 */
+ source=lhs->lsu+D2U(lhs->digits)-1; /* msu of input array */
+ for (target=msu1; source>=lhs->lsu; source--, target--) *target=*source;
+ for (; target>=var1; target--) *target=0;
+
+ /* rhs (var2) is left-aligned with var1 at the start */
+ var2ulen=var1units; /* rhs logical length (units) */
+ var2units=D2U(rhs->digits); /* rhs actual length (units) */
+ var2=rhs->lsu; /* -> rhs array */
+ msu2=var2+var2units-1; /* -> msu of var2 [never changes] */
+ /* now set up the variables which will be used for estimating the */
+ /* multiplication factor. If these variables are not exact, add */
+ /* 1 to make sure that the multiplier is never overestimated. */
+ msu2plus=*msu2; /* it's value .. */
+ if (var2units>1) msu2plus++; /* .. +1 if any more */
+ msu2pair=(eInt)*msu2*(DECDPUNMAX+1);/* top two pair .. */
+ if (var2units>1) { /* .. [else treat 2nd as 0] */
+ msu2pair+=*(msu2-1); /* .. */
+ if (var2units>2) msu2pair++; /* .. +1 if any more */
+ }
+
+ /* The calculation is working in units, which may have leading zeros, */
+ /* but the exponent was calculated on the assumption that they are */
+ /* both left-aligned. Adjust the exponent to compensate: add the */
+ /* number of leading zeros in var1 msu and subtract those in var2 msu. */
+ /* [This is actually done by counting the digits and negating, as */
+ /* lead1=DECDPUN-digits1, and similarly for lead2.] */
+ for (pow=&powers[1]; *msu1>=*pow; pow++) exponent--;
+ for (pow=&powers[1]; *msu2>=*pow; pow++) exponent++;
+
+ /* Now, if doing an integer divide or remainder, ensure that */
+ /* the result will be Unit-aligned. To do this, shift the var1 */
+ /* accumulator towards least if need be. (It's much easier to */
+ /* do this now than to reassemble the residue afterwards, if */
+ /* doing a remainder.) Also ensure the exponent is not negative. */
+ if (!(op&DIVIDE)) {
+ Unit *u; /* work */
+ /* save the initial 'false' padding of var1, in digits */
+ var1initpad=(var1units-D2U(lhs->digits))*DECDPUN;
+ /* Determine the shift to do. */
+ if (exponent<0) cut=-exponent;
+ else cut=DECDPUN-exponent%DECDPUN;
+ decShiftToLeast(var1, var1units, cut);
+ exponent+=cut; /* maintain numerical value */
+ var1initpad-=cut; /* .. and reduce padding */
+ /* clean any most-significant units which were just emptied */
+ for (u=msu1; cut>=DECDPUN; cut-=DECDPUN, u--) *u=0;
+ } /* align */
+ else { /* is DIVIDE */
+ maxexponent=lhs->exponent-rhs->exponent; /* save */
+ /* optimization: if the first iteration will just produce 0, */
+ /* preadjust to skip it [valid for DIVIDE only] */
+ if (*msu1<*msu2) {
+ var2ulen--; /* shift down */
+ exponent-=DECDPUN; /* update the exponent */
+ }
+ }
+
+ /* ---- start the long-division loops ------------------------------ */
+ accunits=0; /* no units accumulated yet */
+ accdigits=0; /* .. or digits */
+ accnext=acc+acclength-1; /* -> msu of acc [NB: allows digits+1] */
+ for (;;) { /* outer forever loop */
+ thisunit=0; /* current unit assumed 0 */
+ /* find the next unit */
+ for (;;) { /* inner forever loop */
+ /* strip leading zero units [from either pre-adjust or from */
+ /* subtract last time around]. Leave at least one unit. */
+ for (; *msu1==0 && msu1>var1; msu1--) var1units--;
+
+ if (var1units<var2ulen) break; /* var1 too low for subtract */
+ if (var1units==var2ulen) { /* unit-by-unit compare needed */
+ /* compare the two numbers, from msu */
+ const Unit *pv1, *pv2;
+ Unit v2; /* units to compare */
+ pv2=msu2; /* -> msu */
+ for (pv1=msu1; ; pv1--, pv2--) {
+ /* v1=*pv1 -- always OK */
+ v2=0; /* assume in padding */
+ if (pv2>=var2) v2=*pv2; /* in range */
+ if (*pv1!=v2) break; /* no longer the same */
+ if (pv1==var1) break; /* done; leave pv1 as is */
+ }
+ /* here when all inspected or a difference seen */
+ if (*pv1<v2) break; /* var1 too low to subtract */
+ if (*pv1==v2) { /* var1 == var2 */
+ /* reach here if var1 and var2 are identical; subtraction */
+ /* would increase digit by one, and the residue will be 0 so */
+ /* the calculation is done; leave the loop with residue=0. */
+ thisunit++; /* as though subtracted */
+ *var1=0; /* set var1 to 0 */
+ var1units=1; /* .. */
+ break; /* from inner */
+ } /* var1 == var2 */
+ /* *pv1>v2. Prepare for real subtraction; the lengths are equal */
+ /* Estimate the multiplier (there's always a msu1-1)... */
+ /* Bring in two units of var2 to provide a good estimate. */
+ mult=(Int)(((eInt)*msu1*(DECDPUNMAX+1)+*(msu1-1))/msu2pair);
+ } /* lengths the same */
+ else { /* var1units > var2ulen, so subtraction is safe */
+ /* The var2 msu is one unit towards the lsu of the var1 msu, */
+ /* so only one unit for var2 can be used. */
+ mult=(Int)(((eInt)*msu1*(DECDPUNMAX+1)+*(msu1-1))/msu2plus);
+ }
+ if (mult==0) mult=1; /* must always be at least 1 */
+ /* subtraction needed; var1 is > var2 */
+ thisunit=(Unit)(thisunit+mult); /* accumulate */
+ /* subtract var1-var2, into var1; only the overlap needs */
+ /* processing, as this is an in-place calculation */
+ shift=var2ulen-var2units;
+ #if DECTRACE
+ decDumpAr('1', &var1[shift], var1units-shift);
+ decDumpAr('2', var2, var2units);
+ printf("m=%ld\n", -mult);
+ #endif
+ decUnitAddSub(&var1[shift], var1units-shift,
+ var2, var2units, 0,
+ &var1[shift], -mult);
+ #if DECTRACE
+ decDumpAr('#', &var1[shift], var1units-shift);
+ #endif
+ /* var1 now probably has leading zeros; these are removed at the */
+ /* top of the inner loop. */
+ } /* inner loop */
+
+ /* The next unit has been calculated in full; unless it's a */
+ /* leading zero, add to acc */
+ if (accunits!=0 || thisunit!=0) { /* is first or non-zero */
+ *accnext=thisunit; /* store in accumulator */
+ /* account exactly for the new digits */
+ if (accunits==0) {
+ accdigits++; /* at least one */
+ for (pow=&powers[1]; thisunit>=*pow; pow++) accdigits++;
+ }
+ else accdigits+=DECDPUN;
+ accunits++; /* update count */
+ accnext--; /* ready for next */
+ if (accdigits>reqdigits) break; /* have enough digits */
+ }
+
+ /* if the residue is zero, the operation is done (unless divide */
+ /* or divideInteger and still not enough digits yet) */
+ if (*var1==0 && var1units==1) { /* residue is 0 */
+ if (op&(REMAINDER|REMNEAR)) break;
+ if ((op&DIVIDE) && (exponent<=maxexponent)) break;
+ /* [drop through if divideInteger] */
+ }
+ /* also done enough if calculating remainder or integer */
+ /* divide and just did the last ('units') unit */
+ if (exponent==0 && !(op&DIVIDE)) break;
+
+ /* to get here, var1 is less than var2, so divide var2 by the per- */
+ /* Unit power of ten and go for the next digit */
+ var2ulen--; /* shift down */
+ exponent-=DECDPUN; /* update the exponent */
+ } /* outer loop */
+
+ /* ---- division is complete --------------------------------------- */
+ /* here: acc has at least reqdigits+1 of good results (or fewer */
+ /* if early stop), starting at accnext+1 (its lsu) */
+ /* var1 has any residue at the stopping point */
+ /* accunits is the number of digits collected in acc */
+ if (accunits==0) { /* acc is 0 */
+ accunits=1; /* show have a unit .. */
+ accdigits=1; /* .. */
+ *accnext=0; /* .. whose value is 0 */
+ }
+ else accnext++; /* back to last placed */
+ /* accnext now -> lowest unit of result */
+
+ residue=0; /* assume no residue */
+ if (op&DIVIDE) {
+ /* record the presence of any residue, for rounding */
+ if (*var1!=0 || var1units>1) residue=1;
+ else { /* no residue */
+ /* Had an exact division; clean up spurious trailing 0s. */
+ /* There will be at most DECDPUN-1, from the final multiply, */
+ /* and then only if the result is non-0 (and even) and the */
+ /* exponent is 'loose'. */
+ #if DECDPUN>1
+ Unit lsu=*accnext;
+ if (!(lsu&0x01) && (lsu!=0)) {
+ /* count the trailing zeros */
+ Int drop=0;
+ for (;; drop++) { /* [will terminate because lsu!=0] */
+ if (exponent>=maxexponent) break; /* don't chop real 0s */
+ #if DECDPUN<=4
+ if ((lsu-QUOT10(lsu, drop+1)
+ *powers[drop+1])!=0) break; /* found non-0 digit */
+ #else
+ if (lsu%powers[drop+1]!=0) break; /* found non-0 digit */
+ #endif
+ exponent++;
+ }
+ if (drop>0) {
+ accunits=decShiftToLeast(accnext, accunits, drop);
+ accdigits=decGetDigits(accnext, accunits);
+ accunits=D2U(accdigits);
+ /* [exponent was adjusted in the loop] */
+ }
+ } /* neither odd nor 0 */
+ #endif
+ } /* exact divide */
+ } /* divide */
+ else /* op!=DIVIDE */ {
+ /* check for coefficient overflow */
+ if (accdigits+exponent>reqdigits) {
+ *status|=DEC_Division_impossible;
+ break;
+ }
+ if (op & (REMAINDER|REMNEAR)) {
+ /* [Here, the exponent will be 0, because var1 was adjusted */
+ /* appropriately.] */
+ Int postshift; /* work */
+ Flag wasodd=0; /* integer was odd */
+ Unit *quotlsu; /* for save */
+ Int quotdigits; /* .. */
+
+ bits=lhs->bits; /* remainder sign is always as lhs */
+
+ /* Fastpath when residue is truly 0 is worthwhile [and */
+ /* simplifies the code below] */
+ if (*var1==0 && var1units==1) { /* residue is 0 */
+ Int exp=lhs->exponent; /* save min(exponents) */
+ if (rhs->exponent<exp) exp=rhs->exponent;
+ uprv_decNumberZero(res); /* 0 coefficient */
+ #if DECSUBSET
+ if (set->extended)
+ #endif
+ res->exponent=exp; /* .. with proper exponent */
+ res->bits=(uByte)(bits&DECNEG); /* [cleaned] */
+ decFinish(res, set, &residue, status); /* might clamp */
+ break;
+ }
+ /* note if the quotient was odd */
+ if (*accnext & 0x01) wasodd=1; /* acc is odd */
+ quotlsu=accnext; /* save in case need to reinspect */
+ quotdigits=accdigits; /* .. */
+
+ /* treat the residue, in var1, as the value to return, via acc */
+ /* calculate the unused zero digits. This is the smaller of: */
+ /* var1 initial padding (saved above) */
+ /* var2 residual padding, which happens to be given by: */
+ postshift=var1initpad+exponent-lhs->exponent+rhs->exponent;
+ /* [the 'exponent' term accounts for the shifts during divide] */
+ if (var1initpad<postshift) postshift=var1initpad;
+
+ /* shift var1 the requested amount, and adjust its digits */
+ var1units=decShiftToLeast(var1, var1units, postshift);
+ accnext=var1;
+ accdigits=decGetDigits(var1, var1units);
+ accunits=D2U(accdigits);
+
+ exponent=lhs->exponent; /* exponent is smaller of lhs & rhs */
+ if (rhs->exponent<exponent) exponent=rhs->exponent;
+
+ /* Now correct the result if doing remainderNear; if it */
+ /* (looking just at coefficients) is > rhs/2, or == rhs/2 and */
+ /* the integer was odd then the result should be rem-rhs. */
+ if (op&REMNEAR) {
+ Int compare, tarunits; /* work */
+ Unit *up; /* .. */
+ /* calculate remainder*2 into the var1 buffer (which has */
+ /* 'headroom' of an extra unit and hence enough space) */
+ /* [a dedicated 'double' loop would be faster, here] */
+ tarunits=decUnitAddSub(accnext, accunits, accnext, accunits,
+ 0, accnext, 1);
+ /* decDumpAr('r', accnext, tarunits); */
+
+ /* Here, accnext (var1) holds tarunits Units with twice the */
+ /* remainder's coefficient, which must now be compared to the */
+ /* RHS. The remainder's exponent may be smaller than the RHS's. */
+ compare=decUnitCompare(accnext, tarunits, rhs->lsu, D2U(rhs->digits),
+ rhs->exponent-exponent);
+ if (compare==BADINT) { /* deep trouble */
+ *status|=DEC_Insufficient_storage;
+ break;}
+
+ /* now restore the remainder by dividing by two; the lsu */
+ /* is known to be even. */
+ for (up=accnext; up<accnext+tarunits; up++) {
+ Int half; /* half to add to lower unit */
+ half=*up & 0x01;
+ *up/=2; /* [shift] */
+ if (!half) continue;
+ *(up-1)+=(DECDPUNMAX+1)/2;
+ }
+ /* [accunits still describes the original remainder length] */
+
+ if (compare>0 || (compare==0 && wasodd)) { /* adjustment needed */
+ Int exp, expunits, exprem; /* work */
+ /* This is effectively causing round-up of the quotient, */
+ /* so if it was the rare case where it was full and all */
+ /* nines, it would overflow and hence division-impossible */
+ /* should be raised */
+ Flag allnines=0; /* 1 if quotient all nines */
+ if (quotdigits==reqdigits) { /* could be borderline */
+ for (up=quotlsu; ; up++) {
+ if (quotdigits>DECDPUN) {
+ if (*up!=DECDPUNMAX) break;/* non-nines */
+ }
+ else { /* this is the last Unit */
+ if (*up==powers[quotdigits]-1) allnines=1;
+ break;
+ }
+ quotdigits-=DECDPUN; /* checked those digits */
+ } /* up */
+ } /* borderline check */
+ if (allnines) {
+ *status|=DEC_Division_impossible;
+ break;}
+
+ /* rem-rhs is needed; the sign will invert. Again, var1 */
+ /* can safely be used for the working Units array. */
+ exp=rhs->exponent-exponent; /* RHS padding needed */
+ /* Calculate units and remainder from exponent. */
+ expunits=exp/DECDPUN;
+ exprem=exp%DECDPUN;
+ /* subtract [A+B*(-m)]; the result will always be negative */
+ accunits=-decUnitAddSub(accnext, accunits,
+ rhs->lsu, D2U(rhs->digits),
+ expunits, accnext, -(Int)powers[exprem]);
+ accdigits=decGetDigits(accnext, accunits); /* count digits exactly */
+ accunits=D2U(accdigits); /* and recalculate the units for copy */
+ /* [exponent is as for original remainder] */
+ bits^=DECNEG; /* flip the sign */
+ }
+ } /* REMNEAR */
+ } /* REMAINDER or REMNEAR */
+ } /* not DIVIDE */
+
+ /* Set exponent and bits */
+ res->exponent=exponent;
+ res->bits=(uByte)(bits&DECNEG); /* [cleaned] */
+
+ /* Now the coefficient. */
+ decSetCoeff(res, set, accnext, accdigits, &residue, status);
+
+ decFinish(res, set, &residue, status); /* final cleanup */
+
+ #if DECSUBSET
+ /* If a divide then strip trailing zeros if subset [after round] */
+ if (!set->extended && (op==DIVIDE)) decTrim(res, set, 0, 1, &dropped);
+ #endif
+ } while(0); /* end protected */
+
+ if (varalloc!=NULL) free(varalloc); /* drop any storage used */
+ if (allocacc!=NULL) free(allocacc); /* .. */
+ #if DECSUBSET
+ if (allocrhs!=NULL) free(allocrhs); /* .. */
+ if (alloclhs!=NULL) free(alloclhs); /* .. */
+ #endif
+ return res;
+ } /* decDivideOp */
+
+/* ------------------------------------------------------------------ */
+/* decMultiplyOp -- multiplication operation */
+/* */
+/* This routine performs the multiplication C=A x B. */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X*X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* status is the usual accumulator */
+/* */
+/* C must have space for set->digits digits. */
+/* */
+/* ------------------------------------------------------------------ */
+/* 'Classic' multiplication is used rather than Karatsuba, as the */
+/* latter would give only a minor improvement for the short numbers */
+/* expected to be handled most (and uses much more memory). */
+/* */
+/* There are two major paths here: the general-purpose ('old code') */
+/* path which handles all DECDPUN values, and a fastpath version */
+/* which is used if 64-bit ints are available, DECDPUN<=4, and more */
+/* than two calls to decUnitAddSub would be made. */
+/* */
+/* The fastpath version lumps units together into 8-digit or 9-digit */
+/* chunks, and also uses a lazy carry strategy to minimise expensive */
+/* 64-bit divisions. The chunks are then broken apart again into */
+/* units for continuing processing. Despite this overhead, the */
+/* fastpath can speed up some 16-digit operations by 10x (and much */
+/* more for higher-precision calculations). */
+/* */
+/* A buffer always has to be used for the accumulator; in the */
+/* fastpath, buffers are also always needed for the chunked copies of */
+/* of the operand coefficients. */
+/* Static buffers are larger than needed just for multiply, to allow */
+/* for calls from other operations (notably exp). */
+/* ------------------------------------------------------------------ */
+#define FASTMUL (DECUSE64 && DECDPUN<5)
+static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set,
+ uInt *status) {
+ Int accunits; /* Units of accumulator in use */
+ Int exponent; /* work */
+ Int residue=0; /* rounding residue */
+ uByte bits; /* result sign */
+ Unit *acc; /* -> accumulator Unit array */
+ Int needbytes; /* size calculator */
+ void *allocacc=NULL; /* -> allocated accumulator, iff allocated */
+ Unit accbuff[SD2U(DECBUFFER*4+1)]; /* buffer (+1 for DECBUFFER==0, */
+ /* *4 for calls from other operations) */
+ const Unit *mer, *mermsup; /* work */
+ Int madlength; /* Units in multiplicand */
+ Int shift; /* Units to shift multiplicand by */
+
+ #if FASTMUL
+ /* if DECDPUN is 1 or 3 work in base 10**9, otherwise */
+ /* (DECDPUN is 2 or 4) then work in base 10**8 */
+ #if DECDPUN & 1 /* odd */
+ #define FASTBASE 1000000000 /* base */
+ #define FASTDIGS 9 /* digits in base */
+ #define FASTLAZY 18 /* carry resolution point [1->18] */
+ #else
+ #define FASTBASE 100000000
+ #define FASTDIGS 8
+ #define FASTLAZY 1844 /* carry resolution point [1->1844] */
+ #endif
+ /* three buffers are used, two for chunked copies of the operands */
+ /* (base 10**8 or base 10**9) and one base 2**64 accumulator with */
+ /* lazy carry evaluation */
+ uInt zlhibuff[(DECBUFFER*2+1)/8+1]; /* buffer (+1 for DECBUFFER==0) */
+ uInt *zlhi=zlhibuff; /* -> lhs array */
+ uInt *alloclhi=NULL; /* -> allocated buffer, iff allocated */
+ uInt zrhibuff[(DECBUFFER*2+1)/8+1]; /* buffer (+1 for DECBUFFER==0) */
+ uInt *zrhi=zrhibuff; /* -> rhs array */
+ uInt *allocrhi=NULL; /* -> allocated buffer, iff allocated */
+ uLong zaccbuff[(DECBUFFER*2+1)/4+2]; /* buffer (+1 for DECBUFFER==0) */
+ /* [allocacc is shared for both paths, as only one will run] */
+ uLong *zacc=zaccbuff; /* -> accumulator array for exact result */
+ #if DECDPUN==1
+ Int zoff; /* accumulator offset */
+ #endif
+ uInt *lip, *rip; /* item pointers */
+ uInt *lmsi, *rmsi; /* most significant items */
+ Int ilhs, irhs, iacc; /* item counts in the arrays */
+ Int lazy; /* lazy carry counter */
+ uLong lcarry; /* uLong carry */
+ uInt carry; /* carry (NB not uLong) */
+ Int count; /* work */
+ const Unit *cup; /* .. */
+ Unit *up; /* .. */
+ uLong *lp; /* .. */
+ Int p; /* .. */
+ #endif
+
+ #if DECSUBSET
+ decNumber *alloclhs=NULL; /* -> allocated buffer, iff allocated */
+ decNumber *allocrhs=NULL; /* -> allocated buffer, iff allocated */
+ #endif
+
+ #if DECCHECK
+ if (decCheckOperands(res, lhs, rhs, set)) return res;
+ #endif
+
+ /* precalculate result sign */
+ bits=(uByte)((lhs->bits^rhs->bits)&DECNEG);
+
+ /* handle infinities and NaNs */
+ if (SPECIALARGS) { /* a special bit set */
+ if (SPECIALARGS & (DECSNAN | DECNAN)) { /* one or two NaNs */
+ decNaNs(res, lhs, rhs, set, status);
+ return res;}
+ /* one or two infinities; Infinity * 0 is invalid */
+ if (((lhs->bits & DECINF)==0 && ISZERO(lhs))
+ ||((rhs->bits & DECINF)==0 && ISZERO(rhs))) {
+ *status|=DEC_Invalid_operation;
+ return res;}
+ uprv_decNumberZero(res);
+ res->bits=bits|DECINF; /* infinity */
+ return res;}
+
+ /* For best speed, as in DMSRCN [the original Rexx numerics */
+ /* module], use the shorter number as the multiplier (rhs) and */
+ /* the longer as the multiplicand (lhs) to minimise the number of */
+ /* adds (partial products) */
+ if (lhs->digits<rhs->digits) { /* swap... */
+ const decNumber *hold=lhs;
+ lhs=rhs;
+ rhs=hold;
+ }
+
+ do { /* protect allocated storage */
+ #if DECSUBSET
+ if (!set->extended) {
+ /* reduce operands and set lostDigits status, as needed */
+ if (lhs->digits>set->digits) {
+ alloclhs=decRoundOperand(lhs, set, status);
+ if (alloclhs==NULL) break;
+ lhs=alloclhs;
+ }
+ if (rhs->digits>set->digits) {
+ allocrhs=decRoundOperand(rhs, set, status);
+ if (allocrhs==NULL) break;
+ rhs=allocrhs;
+ }
+ }
+ #endif
+ /* [following code does not require input rounding] */
+
+ #if FASTMUL /* fastpath can be used */
+ /* use the fast path if there are enough digits in the shorter */
+ /* operand to make the setup and takedown worthwhile */
+ #define NEEDTWO (DECDPUN*2) /* within two decUnitAddSub calls */
+ if (rhs->digits>NEEDTWO) { /* use fastpath... */
+ /* calculate the number of elements in each array */
+ ilhs=(lhs->digits+FASTDIGS-1)/FASTDIGS; /* [ceiling] */
+ irhs=(rhs->digits+FASTDIGS-1)/FASTDIGS; /* .. */
+ iacc=ilhs+irhs;
+
+ /* allocate buffers if required, as usual */
+ needbytes=ilhs*sizeof(uInt);
+ if (needbytes>(Int)sizeof(zlhibuff)) {
+ alloclhi=(uInt *)malloc(needbytes);
+ zlhi=alloclhi;}
+ needbytes=irhs*sizeof(uInt);
+ if (needbytes>(Int)sizeof(zrhibuff)) {
+ allocrhi=(uInt *)malloc(needbytes);
+ zrhi=allocrhi;}
+
+ /* Allocating the accumulator space needs a special case when */
+ /* DECDPUN=1 because when converting the accumulator to Units */
+ /* after the multiplication each 8-byte item becomes 9 1-byte */
+ /* units. Therefore iacc extra bytes are needed at the front */
+ /* (rounded up to a multiple of 8 bytes), and the uLong */
+ /* accumulator starts offset the appropriate number of units */
+ /* to the right to avoid overwrite during the unchunking. */
+
+ /* Make sure no signed int overflow below. This is always true */
+ /* if the given numbers have less digits than DEC_MAX_DIGITS. */
+ U_ASSERT((uint32_t)iacc <= INT32_MAX/sizeof(uLong));
+ needbytes=iacc*sizeof(uLong);
+ #if DECDPUN==1
+ zoff=(iacc+7)/8; /* items to offset by */
+ needbytes+=zoff*8;
+ #endif
+ if (needbytes>(Int)sizeof(zaccbuff)) {
+ allocacc=(uLong *)malloc(needbytes);
+ zacc=(uLong *)allocacc;}
+ if (zlhi==NULL||zrhi==NULL||zacc==NULL) {
+ *status|=DEC_Insufficient_storage;
+ break;}
+
+ acc=(Unit *)zacc; /* -> target Unit array */
+ #if DECDPUN==1
+ zacc+=zoff; /* start uLong accumulator to right */
+ #endif
+
+ /* assemble the chunked copies of the left and right sides */
+ for (count=lhs->digits, cup=lhs->lsu, lip=zlhi; count>0; lip++)
+ for (p=0, *lip=0; p<FASTDIGS && count>0;
+ p+=DECDPUN, cup++, count-=DECDPUN)
+ *lip+=*cup*powers[p];
+ lmsi=lip-1; /* save -> msi */
+ for (count=rhs->digits, cup=rhs->lsu, rip=zrhi; count>0; rip++)
+ for (p=0, *rip=0; p<FASTDIGS && count>0;
+ p+=DECDPUN, cup++, count-=DECDPUN)
+ *rip+=*cup*powers[p];
+ rmsi=rip-1; /* save -> msi */
+
+ /* zero the accumulator */
+ for (lp=zacc; lp<zacc+iacc; lp++) *lp=0;
+
+ /* Start the multiplication */
+ /* Resolving carries can dominate the cost of accumulating the */
+ /* partial products, so this is only done when necessary. */
+ /* Each uLong item in the accumulator can hold values up to */
+ /* 2**64-1, and each partial product can be as large as */
+ /* (10**FASTDIGS-1)**2. When FASTDIGS=9, this can be added to */
+ /* itself 18.4 times in a uLong without overflowing, so during */
+ /* the main calculation resolution is carried out every 18th */
+ /* add -- every 162 digits. Similarly, when FASTDIGS=8, the */
+ /* partial products can be added to themselves 1844.6 times in */
+ /* a uLong without overflowing, so intermediate carry */
+ /* resolution occurs only every 14752 digits. Hence for common */
+ /* short numbers usually only the one final carry resolution */
+ /* occurs. */
+ /* (The count is set via FASTLAZY to simplify experiments to */
+ /* measure the value of this approach: a 35% improvement on a */
+ /* [34x34] multiply.) */
+ lazy=FASTLAZY; /* carry delay count */
+ for (rip=zrhi; rip<=rmsi; rip++) { /* over each item in rhs */
+ lp=zacc+(rip-zrhi); /* where to add the lhs */
+ for (lip=zlhi; lip<=lmsi; lip++, lp++) { /* over each item in lhs */
+ *lp+=(uLong)(*lip)*(*rip); /* [this should in-line] */
+ } /* lip loop */
+ lazy--;
+ if (lazy>0 && rip!=rmsi) continue;
+ lazy=FASTLAZY; /* reset delay count */
+ /* spin up the accumulator resolving overflows */
+ for (lp=zacc; lp<zacc+iacc; lp++) {
+ if (*lp<FASTBASE) continue; /* it fits */
+ lcarry=*lp/FASTBASE; /* top part [slow divide] */
+ /* lcarry can exceed 2**32-1, so check again; this check */
+ /* and occasional extra divide (slow) is well worth it, as */
+ /* it allows FASTLAZY to be increased to 18 rather than 4 */
+ /* in the FASTDIGS=9 case */
+ if (lcarry<FASTBASE) carry=(uInt)lcarry; /* [usual] */
+ else { /* two-place carry [fairly rare] */
+ uInt carry2=(uInt)(lcarry/FASTBASE); /* top top part */
+ *(lp+2)+=carry2; /* add to item+2 */
+ *lp-=((uLong)FASTBASE*FASTBASE*carry2); /* [slow] */
+ carry=(uInt)(lcarry-((uLong)FASTBASE*carry2)); /* [inline] */
+ }
+ *(lp+1)+=carry; /* add to item above [inline] */
+ *lp-=((uLong)FASTBASE*carry); /* [inline] */
+ } /* carry resolution */
+ } /* rip loop */
+
+ /* The multiplication is complete; time to convert back into */
+ /* units. This can be done in-place in the accumulator and in */
+ /* 32-bit operations, because carries were resolved after the */
+ /* final add. This needs N-1 divides and multiplies for */
+ /* each item in the accumulator (which will become up to N */
+ /* units, where 2<=N<=9). */
+ for (lp=zacc, up=acc; lp<zacc+iacc; lp++) {
+ uInt item=(uInt)*lp; /* decapitate to uInt */
+ for (p=0; p<FASTDIGS-DECDPUN; p+=DECDPUN, up++) {
+ uInt part=item/(DECDPUNMAX+1);
+ *up=(Unit)(item-(part*(DECDPUNMAX+1)));
+ item=part;
+ } /* p */
+ *up=(Unit)item; up++; /* [final needs no division] */
+ } /* lp */
+ accunits = static_cast<int32_t>(up-acc); /* count of units */
+ }
+ else { /* here to use units directly, without chunking ['old code'] */
+ #endif
+
+ /* if accumulator will be too long for local storage, then allocate */
+ acc=accbuff; /* -> assume buffer for accumulator */
+ needbytes=(D2U(lhs->digits)+D2U(rhs->digits))*sizeof(Unit);
+ if (needbytes>(Int)sizeof(accbuff)) {
+ allocacc=(Unit *)malloc(needbytes);
+ if (allocacc==NULL) {*status|=DEC_Insufficient_storage; break;}
+ acc=(Unit *)allocacc; /* use the allocated space */
+ }
+
+ /* Now the main long multiplication loop */
+ /* Unlike the equivalent in the IBM Java implementation, there */
+ /* is no advantage in calculating from msu to lsu. So, do it */
+ /* by the book, as it were. */
+ /* Each iteration calculates ACC=ACC+MULTAND*MULT */
+ accunits=1; /* accumulator starts at '0' */
+ *acc=0; /* .. (lsu=0) */
+ shift=0; /* no multiplicand shift at first */
+ madlength=D2U(lhs->digits); /* this won't change */
+ mermsup=rhs->lsu+D2U(rhs->digits); /* -> msu+1 of multiplier */
+
+ for (mer=rhs->lsu; mer<mermsup; mer++) {
+ /* Here, *mer is the next Unit in the multiplier to use */
+ /* If non-zero [optimization] add it... */
+ if (*mer!=0) accunits=decUnitAddSub(&acc[shift], accunits-shift,
+ lhs->lsu, madlength, 0,
+ &acc[shift], *mer)
+ + shift;
+ else { /* extend acc with a 0; it will be used shortly */
+ *(acc+accunits)=0; /* [this avoids length of <=0 later] */
+ accunits++;
+ }
+ /* multiply multiplicand by 10**DECDPUN for next Unit to left */
+ shift++; /* add this for 'logical length' */
+ } /* n */
+ #if FASTMUL
+ } /* unchunked units */
+ #endif
+ /* common end-path */
+ #if DECTRACE
+ decDumpAr('*', acc, accunits); /* Show exact result */
+ #endif
+
+ /* acc now contains the exact result of the multiplication, */
+ /* possibly with a leading zero unit; build the decNumber from */
+ /* it, noting if any residue */
+ res->bits=bits; /* set sign */
+ res->digits=decGetDigits(acc, accunits); /* count digits exactly */
+
+ /* There can be a 31-bit wrap in calculating the exponent. */
+ /* This can only happen if both input exponents are negative and */
+ /* both their magnitudes are large. If there was a wrap, set a */
+ /* safe very negative exponent, from which decFinalize() will */
+ /* raise a hard underflow shortly. */
+ exponent=lhs->exponent+rhs->exponent; /* calculate exponent */
+ if (lhs->exponent<0 && rhs->exponent<0 && exponent>0)
+ exponent=-2*DECNUMMAXE; /* force underflow */
+ res->exponent=exponent; /* OK to overwrite now */
+
+
+ /* Set the coefficient. If any rounding, residue records */
+ decSetCoeff(res, set, acc, res->digits, &residue, status);
+ decFinish(res, set, &residue, status); /* final cleanup */
+ } while(0); /* end protected */
+
+ if (allocacc!=NULL) free(allocacc); /* drop any storage used */
+ #if DECSUBSET
+ if (allocrhs!=NULL) free(allocrhs); /* .. */
+ if (alloclhs!=NULL) free(alloclhs); /* .. */
+ #endif
+ #if FASTMUL
+ if (allocrhi!=NULL) free(allocrhi); /* .. */
+ if (alloclhi!=NULL) free(alloclhi); /* .. */
+ #endif
+ return res;
+ } /* decMultiplyOp */
+
+/* ------------------------------------------------------------------ */
+/* decExpOp -- effect exponentiation */
+/* */
+/* This computes C = exp(A) */
+/* */
+/* res is C, the result. C may be A */
+/* rhs is A */
+/* set is the context; note that rounding mode has no effect */
+/* */
+/* C must have space for set->digits digits. status is updated but */
+/* not set. */
+/* */
+/* Restrictions: */
+/* */
+/* digits, emax, and -emin in the context must be less than */
+/* 2*DEC_MAX_MATH (1999998), and the rhs must be within these */
+/* bounds or a zero. This is an internal routine, so these */
+/* restrictions are contractual and not enforced. */
+/* */
+/* A finite result is rounded using DEC_ROUND_HALF_EVEN; it will */
+/* almost always be correctly rounded, but may be up to 1 ulp in */
+/* error in rare cases. */
+/* */
+/* Finite results will always be full precision and Inexact, except */
+/* when A is a zero or -Infinity (giving 1 or 0 respectively). */
+/* ------------------------------------------------------------------ */
+/* This approach used here is similar to the algorithm described in */
+/* */
+/* Variable Precision Exponential Function, T. E. Hull and */
+/* A. Abrham, ACM Transactions on Mathematical Software, Vol 12 #2, */
+/* pp79-91, ACM, June 1986. */
+/* */
+/* with the main difference being that the iterations in the series */
+/* evaluation are terminated dynamically (which does not require the */
+/* extra variable-precision variables which are expensive in this */
+/* context). */
+/* */
+/* The error analysis in Hull & Abrham's paper applies except for the */
+/* round-off error accumulation during the series evaluation. This */
+/* code does not precalculate the number of iterations and so cannot */
+/* use Horner's scheme. Instead, the accumulation is done at double- */
+/* precision, which ensures that the additions of the terms are exact */
+/* and do not accumulate round-off (and any round-off errors in the */
+/* terms themselves move 'to the right' faster than they can */
+/* accumulate). This code also extends the calculation by allowing, */
+/* in the spirit of other decNumber operators, the input to be more */
+/* precise than the result (the precision used is based on the more */
+/* precise of the input or requested result). */
+/* */
+/* Implementation notes: */
+/* */
+/* 1. This is separated out as decExpOp so it can be called from */
+/* other Mathematical functions (notably Ln) with a wider range */
+/* than normal. In particular, it can handle the slightly wider */
+/* (double) range needed by Ln (which has to be able to calculate */
+/* exp(-x) where x can be the tiniest number (Ntiny). */
+/* */
+/* 2. Normalizing x to be <=0.1 (instead of <=1) reduces loop */
+/* iterations by appoximately a third with additional (although */
+/* diminishing) returns as the range is reduced to even smaller */
+/* fractions. However, h (the power of 10 used to correct the */
+/* result at the end, see below) must be kept <=8 as otherwise */
+/* the final result cannot be computed. Hence the leverage is a */
+/* sliding value (8-h), where potentially the range is reduced */
+/* more for smaller values. */
+/* */
+/* The leverage that can be applied in this way is severely */
+/* limited by the cost of the raise-to-the power at the end, */
+/* which dominates when the number of iterations is small (less */
+/* than ten) or when rhs is short. As an example, the adjustment */
+/* x**10,000,000 needs 31 multiplications, all but one full-width. */
+/* */
+/* 3. The restrictions (especially precision) could be raised with */
+/* care, but the full decNumber range seems very hard within the */
+/* 32-bit limits. */
+/* */
+/* 4. The working precisions for the static buffers are twice the */
+/* obvious size to allow for calls from decNumberPower. */
+/* ------------------------------------------------------------------ */
+decNumber * decExpOp(decNumber *res, const decNumber *rhs,
+ decContext *set, uInt *status) {
+ uInt ignore=0; /* working status */
+ Int h; /* adjusted exponent for 0.xxxx */
+ Int p; /* working precision */
+ Int residue; /* rounding residue */
+ uInt needbytes; /* for space calculations */
+ const decNumber *x=rhs; /* (may point to safe copy later) */
+ decContext aset, tset, dset; /* working contexts */
+ Int comp; /* work */
+
+ /* the argument is often copied to normalize it, so (unusually) it */
+ /* is treated like other buffers, using DECBUFFER, +1 in case */
+ /* DECBUFFER is 0 */
+ decNumber bufr[D2N(DECBUFFER*2+1)];
+ decNumber *allocrhs=NULL; /* non-NULL if rhs buffer allocated */
+
+ /* the working precision will be no more than set->digits+8+1 */
+ /* so for on-stack buffers DECBUFFER+9 is used, +1 in case DECBUFFER */
+ /* is 0 (and twice that for the accumulator) */
+
+ /* buffer for t, term (working precision plus) */
+ decNumber buft[D2N(DECBUFFER*2+9+1)];
+ decNumber *allocbuft=NULL; /* -> allocated buft, iff allocated */
+ decNumber *t=buft; /* term */
+ /* buffer for a, accumulator (working precision * 2), at least 9 */
+ decNumber bufa[D2N(DECBUFFER*4+18+1)];
+ decNumber *allocbufa=NULL; /* -> allocated bufa, iff allocated */
+ decNumber *a=bufa; /* accumulator */
+ /* decNumber for the divisor term; this needs at most 9 digits */
+ /* and so can be fixed size [16 so can use standard context] */
+ decNumber bufd[D2N(16)];
+ decNumber *d=bufd; /* divisor */
+ decNumber numone; /* constant 1 */
+
+ #if DECCHECK
+ Int iterations=0; /* for later sanity check */
+ if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
+ #endif
+
+ do { /* protect allocated storage */
+ if (SPECIALARG) { /* handle infinities and NaNs */
+ if (decNumberIsInfinite(rhs)) { /* an infinity */
+ if (decNumberIsNegative(rhs)) /* -Infinity -> +0 */
+ uprv_decNumberZero(res);
+ else uprv_decNumberCopy(res, rhs); /* +Infinity -> self */
+ }
+ else decNaNs(res, rhs, NULL, set, status); /* a NaN */
+ break;}
+
+ if (ISZERO(rhs)) { /* zeros -> exact 1 */
+ uprv_decNumberZero(res); /* make clean 1 */
+ *res->lsu=1; /* .. */
+ break;} /* [no status to set] */
+
+ /* e**x when 0 < x < 0.66 is < 1+3x/2, hence can fast-path */
+ /* positive and negative tiny cases which will result in inexact */
+ /* 1. This also allows the later add-accumulate to always be */
+ /* exact (because its length will never be more than twice the */
+ /* working precision). */
+ /* The comparator (tiny) needs just one digit, so use the */
+ /* decNumber d for it (reused as the divisor, etc., below); its */
+ /* exponent is such that if x is positive it will have */
+ /* set->digits-1 zeros between the decimal point and the digit, */
+ /* which is 4, and if x is negative one more zero there as the */
+ /* more precise result will be of the form 0.9999999 rather than */
+ /* 1.0000001. Hence, tiny will be 0.0000004 if digits=7 and x>0 */
+ /* or 0.00000004 if digits=7 and x<0. If RHS not larger than */
+ /* this then the result will be 1.000000 */
+ uprv_decNumberZero(d); /* clean */
+ *d->lsu=4; /* set 4 .. */
+ d->exponent=-set->digits; /* * 10**(-d) */
+ if (decNumberIsNegative(rhs)) d->exponent--; /* negative case */
+ comp=decCompare(d, rhs, 1); /* signless compare */
+ if (comp==BADINT) {
+ *status|=DEC_Insufficient_storage;
+ break;}
+ if (comp>=0) { /* rhs < d */
+ Int shift=set->digits-1;
+ uprv_decNumberZero(res); /* set 1 */
+ *res->lsu=1; /* .. */
+ res->digits=decShiftToMost(res->lsu, 1, shift);
+ res->exponent=-shift; /* make 1.0000... */
+ *status|=DEC_Inexact | DEC_Rounded; /* .. inexactly */
+ break;} /* tiny */
+
+ /* set up the context to be used for calculating a, as this is */
+ /* used on both paths below */
+ uprv_decContextDefault(&aset, DEC_INIT_DECIMAL64);
+ /* accumulator bounds are as requested (could underflow) */
+ aset.emax=set->emax; /* usual bounds */
+ aset.emin=set->emin; /* .. */
+ aset.clamp=0; /* and no concrete format */
+
+ /* calculate the adjusted (Hull & Abrham) exponent (where the */
+ /* decimal point is just to the left of the coefficient msd) */
+ h=rhs->exponent+rhs->digits;
+ /* if h>8 then 10**h cannot be calculated safely; however, when */
+ /* h=8 then exp(|rhs|) will be at least exp(1E+7) which is at */
+ /* least 6.59E+4342944, so (due to the restriction on Emax/Emin) */
+ /* overflow (or underflow to 0) is guaranteed -- so this case can */
+ /* be handled by simply forcing the appropriate excess */
+ if (h>8) { /* overflow/underflow */
+ /* set up here so Power call below will over or underflow to */
+ /* zero; set accumulator to either 2 or 0.02 */
+ /* [stack buffer for a is always big enough for this] */
+ uprv_decNumberZero(a);
+ *a->lsu=2; /* not 1 but < exp(1) */
+ if (decNumberIsNegative(rhs)) a->exponent=-2; /* make 0.02 */
+ h=8; /* clamp so 10**h computable */
+ p=9; /* set a working precision */
+ }
+ else { /* h<=8 */
+ Int maxlever=(rhs->digits>8?1:0);
+ /* [could/should increase this for precisions >40 or so, too] */
+
+ /* if h is 8, cannot normalize to a lower upper limit because */
+ /* the final result will not be computable (see notes above), */
+ /* but leverage can be applied whenever h is less than 8. */
+ /* Apply as much as possible, up to a MAXLEVER digits, which */
+ /* sets the tradeoff against the cost of the later a**(10**h). */
+ /* As h is increased, the working precision below also */
+ /* increases to compensate for the "constant digits at the */
+ /* front" effect. */
+ Int lever=MINI(8-h, maxlever); /* leverage attainable */
+ Int use=-rhs->digits-lever; /* exponent to use for RHS */
+ h+=lever; /* apply leverage selected */
+ if (h<0) { /* clamp */
+ use+=h; /* [may end up subnormal] */
+ h=0;
+ }
+ /* Take a copy of RHS if it needs normalization (true whenever x>=1) */
+ if (rhs->exponent!=use) {
+ decNumber *newrhs=bufr; /* assume will fit on stack */
+ needbytes=sizeof(decNumber)+(D2U(rhs->digits)-1)*sizeof(Unit);
+ if (needbytes>sizeof(bufr)) { /* need malloc space */
+ allocrhs=(decNumber *)malloc(needbytes);
+ if (allocrhs==NULL) { /* hopeless -- abandon */
+ *status|=DEC_Insufficient_storage;
+ break;}
+ newrhs=allocrhs; /* use the allocated space */
+ }
+ uprv_decNumberCopy(newrhs, rhs); /* copy to safe space */
+ newrhs->exponent=use; /* normalize; now <1 */
+ x=newrhs; /* ready for use */
+ /* decNumberShow(x); */
+ }
+
+ /* Now use the usual power series to evaluate exp(x). The */
+ /* series starts as 1 + x + x^2/2 ... so prime ready for the */
+ /* third term by setting the term variable t=x, the accumulator */
+ /* a=1, and the divisor d=2. */
+
+ /* First determine the working precision. From Hull & Abrham */
+ /* this is set->digits+h+2. However, if x is 'over-precise' we */
+ /* need to allow for all its digits to potentially participate */
+ /* (consider an x where all the excess digits are 9s) so in */
+ /* this case use x->digits+h+2 */
+ p=MAXI(x->digits, set->digits)+h+2; /* [h<=8] */
+
+ /* a and t are variable precision, and depend on p, so space */
+ /* must be allocated for them if necessary */
+
+ /* the accumulator needs to be able to hold 2p digits so that */
+ /* the additions on the second and subsequent iterations are */
+ /* sufficiently exact. */
+ needbytes=sizeof(decNumber)+(D2U(p*2)-1)*sizeof(Unit);
+ if (needbytes>sizeof(bufa)) { /* need malloc space */
+ allocbufa=(decNumber *)malloc(needbytes);
+ if (allocbufa==NULL) { /* hopeless -- abandon */
+ *status|=DEC_Insufficient_storage;
+ break;}
+ a=allocbufa; /* use the allocated space */
+ }
+ /* the term needs to be able to hold p digits (which is */
+ /* guaranteed to be larger than x->digits, so the initial copy */
+ /* is safe); it may also be used for the raise-to-power */
+ /* calculation below, which needs an extra two digits */
+ needbytes=sizeof(decNumber)+(D2U(p+2)-1)*sizeof(Unit);
+ if (needbytes>sizeof(buft)) { /* need malloc space */
+ allocbuft=(decNumber *)malloc(needbytes);
+ if (allocbuft==NULL) { /* hopeless -- abandon */
+ *status|=DEC_Insufficient_storage;
+ break;}
+ t=allocbuft; /* use the allocated space */
+ }
+
+ uprv_decNumberCopy(t, x); /* term=x */
+ uprv_decNumberZero(a); *a->lsu=1; /* accumulator=1 */
+ uprv_decNumberZero(d); *d->lsu=2; /* divisor=2 */
+ uprv_decNumberZero(&numone); *numone.lsu=1; /* constant 1 for increment */
+
+ /* set up the contexts for calculating a, t, and d */
+ uprv_decContextDefault(&tset, DEC_INIT_DECIMAL64);
+ dset=tset;
+ /* accumulator bounds are set above, set precision now */
+ aset.digits=p*2; /* double */
+ /* term bounds avoid any underflow or overflow */
+ tset.digits=p;
+ tset.emin=DEC_MIN_EMIN; /* [emax is plenty] */
+ /* [dset.digits=16, etc., are sufficient] */
+
+ /* finally ready to roll */
+ for (;;) {
+ #if DECCHECK
+ iterations++;
+ #endif
+ /* only the status from the accumulation is interesting */
+ /* [but it should remain unchanged after first add] */
+ decAddOp(a, a, t, &aset, 0, status); /* a=a+t */
+ decMultiplyOp(t, t, x, &tset, &ignore); /* t=t*x */
+ decDivideOp(t, t, d, &tset, DIVIDE, &ignore); /* t=t/d */
+ /* the iteration ends when the term cannot affect the result, */
+ /* if rounded to p digits, which is when its value is smaller */
+ /* than the accumulator by p+1 digits. There must also be */
+ /* full precision in a. */
+ if (((a->digits+a->exponent)>=(t->digits+t->exponent+p+1))
+ && (a->digits>=p)) break;
+ decAddOp(d, d, &numone, &dset, 0, &ignore); /* d=d+1 */
+ } /* iterate */
+
+ #if DECCHECK
+ /* just a sanity check; comment out test to show always */
+ if (iterations>p+3)
+ printf("Exp iterations=%ld, status=%08lx, p=%ld, d=%ld\n",
+ (LI)iterations, (LI)*status, (LI)p, (LI)x->digits);
+ #endif
+ } /* h<=8 */
+
+ /* apply postconditioning: a=a**(10**h) -- this is calculated */
+ /* at a slightly higher precision than Hull & Abrham suggest */
+ if (h>0) {
+ Int seenbit=0; /* set once a 1-bit is seen */
+ Int i; /* counter */
+ Int n=powers[h]; /* always positive */
+ aset.digits=p+2; /* sufficient precision */
+ /* avoid the overhead and many extra digits of decNumberPower */
+ /* as all that is needed is the short 'multipliers' loop; here */
+ /* accumulate the answer into t */
+ uprv_decNumberZero(t); *t->lsu=1; /* acc=1 */
+ for (i=1;;i++){ /* for each bit [top bit ignored] */
+ /* abandon if have had overflow or terminal underflow */
+ if (*status & (DEC_Overflow|DEC_Underflow)) { /* interesting? */
+ if (*status&DEC_Overflow || ISZERO(t)) break;}
+ n=n<<1; /* move next bit to testable position */
+ if (n<0) { /* top bit is set */
+ seenbit=1; /* OK, have a significant bit */
+ decMultiplyOp(t, t, a, &aset, status); /* acc=acc*x */
+ }
+ if (i==31) break; /* that was the last bit */
+ if (!seenbit) continue; /* no need to square 1 */
+ decMultiplyOp(t, t, t, &aset, status); /* acc=acc*acc [square] */
+ } /*i*/ /* 32 bits */
+ /* decNumberShow(t); */
+ a=t; /* and carry on using t instead of a */
+ }
+
+ /* Copy and round the result to res */
+ residue=1; /* indicate dirt to right .. */
+ if (ISZERO(a)) residue=0; /* .. unless underflowed to 0 */
+ aset.digits=set->digits; /* [use default rounding] */
+ decCopyFit(res, a, &aset, &residue, status); /* copy & shorten */
+ decFinish(res, set, &residue, status); /* cleanup/set flags */
+ } while(0); /* end protected */
+
+ if (allocrhs !=NULL) free(allocrhs); /* drop any storage used */
+ if (allocbufa!=NULL) free(allocbufa); /* .. */
+ if (allocbuft!=NULL) free(allocbuft); /* .. */
+ /* [status is handled by caller] */
+ return res;
+ } /* decExpOp */
+
+/* ------------------------------------------------------------------ */
+/* Initial-estimate natural logarithm table */
+/* */
+/* LNnn -- 90-entry 16-bit table for values from .10 through .99. */
+/* The result is a 4-digit encode of the coefficient (c=the */
+/* top 14 bits encoding 0-9999) and a 2-digit encode of the */
+/* exponent (e=the bottom 2 bits encoding 0-3) */
+/* */
+/* The resulting value is given by: */
+/* */
+/* v = -c * 10**(-e-3) */
+/* */
+/* where e and c are extracted from entry k = LNnn[x-10] */
+/* where x is truncated (NB) into the range 10 through 99, */
+/* and then c = k>>2 and e = k&3. */
+/* ------------------------------------------------------------------ */
+static const uShort LNnn[90]={9016, 8652, 8316, 8008, 7724, 7456, 7208,
+ 6972, 6748, 6540, 6340, 6148, 5968, 5792, 5628, 5464, 5312,
+ 5164, 5020, 4884, 4748, 4620, 4496, 4376, 4256, 4144, 4032,
+ 39233, 38181, 37157, 36157, 35181, 34229, 33297, 32389, 31501, 30629,
+ 29777, 28945, 28129, 27329, 26545, 25777, 25021, 24281, 23553, 22837,
+ 22137, 21445, 20769, 20101, 19445, 18801, 18165, 17541, 16925, 16321,
+ 15721, 15133, 14553, 13985, 13421, 12865, 12317, 11777, 11241, 10717,
+ 10197, 9685, 9177, 8677, 8185, 7697, 7213, 6737, 6269, 5801,
+ 5341, 4889, 4437, 39930, 35534, 31186, 26886, 22630, 18418, 14254,
+ 10130, 6046, 20055};
+
+/* ------------------------------------------------------------------ */
+/* decLnOp -- effect natural logarithm */
+/* */
+/* This computes C = ln(A) */
+/* */
+/* res is C, the result. C may be A */
+/* rhs is A */
+/* set is the context; note that rounding mode has no effect */
+/* */
+/* C must have space for set->digits digits. */
+/* */
+/* Notable cases: */
+/* A<0 -> Invalid */
+/* A=0 -> -Infinity (Exact) */
+/* A=+Infinity -> +Infinity (Exact) */
+/* A=1 exactly -> 0 (Exact) */
+/* */
+/* Restrictions (as for Exp): */
+/* */
+/* digits, emax, and -emin in the context must be less than */
+/* DEC_MAX_MATH+11 (1000010), and the rhs must be within these */
+/* bounds or a zero. This is an internal routine, so these */
+/* restrictions are contractual and not enforced. */
+/* */
+/* A finite result is rounded using DEC_ROUND_HALF_EVEN; it will */
+/* almost always be correctly rounded, but may be up to 1 ulp in */
+/* error in rare cases. */
+/* ------------------------------------------------------------------ */
+/* The result is calculated using Newton's method, with each */
+/* iteration calculating a' = a + x * exp(-a) - 1. See, for example, */
+/* Epperson 1989. */
+/* */
+/* The iteration ends when the adjustment x*exp(-a)-1 is tiny enough. */
+/* This has to be calculated at the sum of the precision of x and the */
+/* working precision. */
+/* */
+/* Implementation notes: */
+/* */
+/* 1. This is separated out as decLnOp so it can be called from */
+/* other Mathematical functions (e.g., Log 10) with a wider range */
+/* than normal. In particular, it can handle the slightly wider */
+/* (+9+2) range needed by a power function. */
+/* */
+/* 2. The speed of this function is about 10x slower than exp, as */
+/* it typically needs 4-6 iterations for short numbers, and the */
+/* extra precision needed adds a squaring effect, twice. */
+/* */
+/* 3. Fastpaths are included for ln(10) and ln(2), up to length 40, */
+/* as these are common requests. ln(10) is used by log10(x). */
+/* */
+/* 4. An iteration might be saved by widening the LNnn table, and */
+/* would certainly save at least one if it were made ten times */
+/* bigger, too (for truncated fractions 0.100 through 0.999). */
+/* However, for most practical evaluations, at least four or five */
+/* iterations will be neede -- so this would only speed up by */
+/* 20-25% and that probably does not justify increasing the table */
+/* size. */
+/* */
+/* 5. The static buffers are larger than might be expected to allow */
+/* for calls from decNumberPower. */
+/* ------------------------------------------------------------------ */
+#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
+decNumber * decLnOp(decNumber *res, const decNumber *rhs,
+ decContext *set, uInt *status) {
+ uInt ignore=0; /* working status accumulator */
+ uInt needbytes; /* for space calculations */
+ Int residue; /* rounding residue */
+ Int r; /* rhs=f*10**r [see below] */
+ Int p; /* working precision */
+ Int pp; /* precision for iteration */
+ Int t; /* work */
+
+ /* buffers for a (accumulator, typically precision+2) and b */
+ /* (adjustment calculator, same size) */
+ decNumber bufa[D2N(DECBUFFER+12)];
+ decNumber *allocbufa=NULL; /* -> allocated bufa, iff allocated */
+ decNumber *a=bufa; /* accumulator/work */
+ decNumber bufb[D2N(DECBUFFER*2+2)];
+ decNumber *allocbufb=NULL; /* -> allocated bufa, iff allocated */
+ decNumber *b=bufb; /* adjustment/work */
+
+ decNumber numone; /* constant 1 */
+ decNumber cmp; /* work */
+ decContext aset, bset; /* working contexts */
+
+ #if DECCHECK
+ Int iterations=0; /* for later sanity check */
+ if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
+ #endif
+
+ do { /* protect allocated storage */
+ if (SPECIALARG) { /* handle infinities and NaNs */
+ if (decNumberIsInfinite(rhs)) { /* an infinity */
+ if (decNumberIsNegative(rhs)) /* -Infinity -> error */
+ *status|=DEC_Invalid_operation;
+ else uprv_decNumberCopy(res, rhs); /* +Infinity -> self */
+ }
+ else decNaNs(res, rhs, NULL, set, status); /* a NaN */
+ break;}
+
+ if (ISZERO(rhs)) { /* +/- zeros -> -Infinity */
+ uprv_decNumberZero(res); /* make clean */
+ res->bits=DECINF|DECNEG; /* set - infinity */
+ break;} /* [no status to set] */
+
+ /* Non-zero negatives are bad... */
+ if (decNumberIsNegative(rhs)) { /* -x -> error */
+ *status|=DEC_Invalid_operation;
+ break;}
+
+ /* Here, rhs is positive, finite, and in range */
+
+ /* lookaside fastpath code for ln(2) and ln(10) at common lengths */
+ if (rhs->exponent==0 && set->digits<=40) {
+ #if DECDPUN==1
+ if (rhs->lsu[0]==0 && rhs->lsu[1]==1 && rhs->digits==2) { /* ln(10) */
+ #else
+ if (rhs->lsu[0]==10 && rhs->digits==2) { /* ln(10) */
+ #endif
+ aset=*set; aset.round=DEC_ROUND_HALF_EVEN;
+ #define LN10 "2.302585092994045684017991454684364207601"
+ uprv_decNumberFromString(res, LN10, &aset);
+ *status|=(DEC_Inexact | DEC_Rounded); /* is inexact */
+ break;}
+ if (rhs->lsu[0]==2 && rhs->digits==1) { /* ln(2) */
+ aset=*set; aset.round=DEC_ROUND_HALF_EVEN;
+ #define LN2 "0.6931471805599453094172321214581765680755"
+ uprv_decNumberFromString(res, LN2, &aset);
+ *status|=(DEC_Inexact | DEC_Rounded);
+ break;}
+ } /* integer and short */
+
+ /* Determine the working precision. This is normally the */
+ /* requested precision + 2, with a minimum of 9. However, if */
+ /* the rhs is 'over-precise' then allow for all its digits to */
+ /* potentially participate (consider an rhs where all the excess */
+ /* digits are 9s) so in this case use rhs->digits+2. */
+ p=MAXI(rhs->digits, MAXI(set->digits, 7))+2;
+
+ /* Allocate space for the accumulator and the high-precision */
+ /* adjustment calculator, if necessary. The accumulator must */
+ /* be able to hold p digits, and the adjustment up to */
+ /* rhs->digits+p digits. They are also made big enough for 16 */
+ /* digits so that they can be used for calculating the initial */
+ /* estimate. */
+ needbytes=sizeof(decNumber)+(D2U(MAXI(p,16))-1)*sizeof(Unit);
+ if (needbytes>sizeof(bufa)) { /* need malloc space */
+ allocbufa=(decNumber *)malloc(needbytes);
+ if (allocbufa==NULL) { /* hopeless -- abandon */
+ *status|=DEC_Insufficient_storage;
+ break;}
+ a=allocbufa; /* use the allocated space */
+ }
+ pp=p+rhs->digits;
+ needbytes=sizeof(decNumber)+(D2U(MAXI(pp,16))-1)*sizeof(Unit);
+ if (needbytes>sizeof(bufb)) { /* need malloc space */
+ allocbufb=(decNumber *)malloc(needbytes);
+ if (allocbufb==NULL) { /* hopeless -- abandon */
+ *status|=DEC_Insufficient_storage;
+ break;}
+ b=allocbufb; /* use the allocated space */
+ }
+
+ /* Prepare an initial estimate in acc. Calculate this by */
+ /* considering the coefficient of x to be a normalized fraction, */
+ /* f, with the decimal point at far left and multiplied by */
+ /* 10**r. Then, rhs=f*10**r and 0.1<=f<1, and */
+ /* ln(x) = ln(f) + ln(10)*r */
+ /* Get the initial estimate for ln(f) from a small lookup */
+ /* table (see above) indexed by the first two digits of f, */
+ /* truncated. */
+
+ uprv_decContextDefault(&aset, DEC_INIT_DECIMAL64); /* 16-digit extended */
+ r=rhs->exponent+rhs->digits; /* 'normalised' exponent */
+ uprv_decNumberFromInt32(a, r); /* a=r */
+ uprv_decNumberFromInt32(b, 2302585); /* b=ln(10) (2.302585) */
+ b->exponent=-6; /* .. */
+ decMultiplyOp(a, a, b, &aset, &ignore); /* a=a*b */
+ /* now get top two digits of rhs into b by simple truncate and */
+ /* force to integer */
+ residue=0; /* (no residue) */
+ aset.digits=2; aset.round=DEC_ROUND_DOWN;
+ decCopyFit(b, rhs, &aset, &residue, &ignore); /* copy & shorten */
+ b->exponent=0; /* make integer */
+ t=decGetInt(b); /* [cannot fail] */
+ if (t<10) t=X10(t); /* adjust single-digit b */
+ t=LNnn[t-10]; /* look up ln(b) */
+ uprv_decNumberFromInt32(b, t>>2); /* b=ln(b) coefficient */
+ b->exponent=-(t&3)-3; /* set exponent */
+ b->bits=DECNEG; /* ln(0.10)->ln(0.99) always -ve */
+ aset.digits=16; aset.round=DEC_ROUND_HALF_EVEN; /* restore */
+ decAddOp(a, a, b, &aset, 0, &ignore); /* acc=a+b */
+ /* the initial estimate is now in a, with up to 4 digits correct. */
+ /* When rhs is at or near Nmax the estimate will be low, so we */
+ /* will approach it from below, avoiding overflow when calling exp. */
+
+ uprv_decNumberZero(&numone); *numone.lsu=1; /* constant 1 for adjustment */
+
+ /* accumulator bounds are as requested (could underflow, but */
+ /* cannot overflow) */
+ aset.emax=set->emax;
+ aset.emin=set->emin;
+ aset.clamp=0; /* no concrete format */
+ /* set up a context to be used for the multiply and subtract */
+ bset=aset;
+ bset.emax=DEC_MAX_MATH*2; /* use double bounds for the */
+ bset.emin=-DEC_MAX_MATH*2; /* adjustment calculation */
+ /* [see decExpOp call below] */
+ /* for each iteration double the number of digits to calculate, */
+ /* up to a maximum of p */
+ pp=9; /* initial precision */
+ /* [initially 9 as then the sequence starts 7+2, 16+2, and */
+ /* 34+2, which is ideal for standard-sized numbers] */
+ aset.digits=pp; /* working context */
+ bset.digits=pp+rhs->digits; /* wider context */
+ for (;;) { /* iterate */
+ #if DECCHECK
+ iterations++;
+ if (iterations>24) break; /* consider 9 * 2**24 */
+ #endif
+ /* calculate the adjustment (exp(-a)*x-1) into b. This is a */
+ /* catastrophic subtraction but it really is the difference */
+ /* from 1 that is of interest. */
+ /* Use the internal entry point to Exp as it allows the double */
+ /* range for calculating exp(-a) when a is the tiniest subnormal. */
+ a->bits^=DECNEG; /* make -a */
+ decExpOp(b, a, &bset, &ignore); /* b=exp(-a) */
+ a->bits^=DECNEG; /* restore sign of a */
+ /* now multiply by rhs and subtract 1, at the wider precision */
+ decMultiplyOp(b, b, rhs, &bset, &ignore); /* b=b*rhs */
+ decAddOp(b, b, &numone, &bset, DECNEG, &ignore); /* b=b-1 */
+
+ /* the iteration ends when the adjustment cannot affect the */
+ /* result by >=0.5 ulp (at the requested digits), which */
+ /* is when its value is smaller than the accumulator by */
+ /* set->digits+1 digits (or it is zero) -- this is a looser */
+ /* requirement than for Exp because all that happens to the */
+ /* accumulator after this is the final rounding (but note that */
+ /* there must also be full precision in a, or a=0). */
+
+ if (decNumberIsZero(b) ||
+ (a->digits+a->exponent)>=(b->digits+b->exponent+set->digits+1)) {
+ if (a->digits==p) break;
+ if (decNumberIsZero(a)) {
+ decCompareOp(&cmp, rhs, &numone, &aset, COMPARE, &ignore); /* rhs=1 ? */
+ if (cmp.lsu[0]==0) a->exponent=0; /* yes, exact 0 */
+ else *status|=(DEC_Inexact | DEC_Rounded); /* no, inexact */
+ break;
+ }
+ /* force padding if adjustment has gone to 0 before full length */
+ if (decNumberIsZero(b)) b->exponent=a->exponent-p;
+ }
+
+ /* not done yet ... */
+ decAddOp(a, a, b, &aset, 0, &ignore); /* a=a+b for next estimate */
+ if (pp==p) continue; /* precision is at maximum */
+ /* lengthen the next calculation */
+ pp=pp*2; /* double precision */
+ if (pp>p) pp=p; /* clamp to maximum */
+ aset.digits=pp; /* working context */
+ bset.digits=pp+rhs->digits; /* wider context */
+ } /* Newton's iteration */
+
+ #if DECCHECK
+ /* just a sanity check; remove the test to show always */
+ if (iterations>24)
+ printf("Ln iterations=%ld, status=%08lx, p=%ld, d=%ld\n",
+ (LI)iterations, (LI)*status, (LI)p, (LI)rhs->digits);
+ #endif
+
+ /* Copy and round the result to res */
+ residue=1; /* indicate dirt to right */
+ if (ISZERO(a)) residue=0; /* .. unless underflowed to 0 */
+ aset.digits=set->digits; /* [use default rounding] */
+ decCopyFit(res, a, &aset, &residue, status); /* copy & shorten */
+ decFinish(res, set, &residue, status); /* cleanup/set flags */
+ } while(0); /* end protected */
+
+ if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */
+ if (allocbufb!=NULL) free(allocbufb); /* .. */
+ /* [status is handled by caller] */
+ return res;
+ } /* decLnOp */
+#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406
+#pragma GCC diagnostic pop
+#endif
+
+/* ------------------------------------------------------------------ */
+/* decQuantizeOp -- force exponent to requested value */
+/* */
+/* This computes C = op(A, B), where op adjusts the coefficient */
+/* of C (by rounding or shifting) such that the exponent (-scale) */
+/* of C has the value B or matches the exponent of B. */
+/* The numerical value of C will equal A, except for the effects of */
+/* any rounding that occurred. */
+/* */
+/* res is C, the result. C may be A or B */
+/* lhs is A, the number to adjust */
+/* rhs is B, the requested exponent */
+/* set is the context */
+/* quant is 1 for quantize or 0 for rescale */
+/* status is the status accumulator (this can be called without */
+/* risk of control loss) */
+/* */
+/* C must have space for set->digits digits. */
+/* */
+/* Unless there is an error or the result is infinite, the exponent */
+/* after the operation is guaranteed to be that requested. */
+/* ------------------------------------------------------------------ */
+static decNumber * decQuantizeOp(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set,
+ Flag quant, uInt *status) {
+ #if DECSUBSET
+ decNumber *alloclhs=NULL; /* non-NULL if rounded lhs allocated */
+ decNumber *allocrhs=NULL; /* .., rhs */
+ #endif
+ const decNumber *inrhs=rhs; /* save original rhs */
+ Int reqdigits=set->digits; /* requested DIGITS */
+ Int reqexp; /* requested exponent [-scale] */
+ Int residue=0; /* rounding residue */
+ Int etiny=set->emin-(reqdigits-1);
+
+ #if DECCHECK
+ if (decCheckOperands(res, lhs, rhs, set)) return res;
+ #endif
+
+ do { /* protect allocated storage */
+ #if DECSUBSET
+ if (!set->extended) {
+ /* reduce operands and set lostDigits status, as needed */
+ if (lhs->digits>reqdigits) {
+ alloclhs=decRoundOperand(lhs, set, status);
+ if (alloclhs==NULL) break;
+ lhs=alloclhs;
+ }
+ if (rhs->digits>reqdigits) { /* [this only checks lostDigits] */
+ allocrhs=decRoundOperand(rhs, set, status);
+ if (allocrhs==NULL) break;
+ rhs=allocrhs;
+ }
+ }
+ #endif
+ /* [following code does not require input rounding] */
+
+ /* Handle special values */
+ if (SPECIALARGS) {
+ /* NaNs get usual processing */
+ if (SPECIALARGS & (DECSNAN | DECNAN))
+ decNaNs(res, lhs, rhs, set, status);
+ /* one infinity but not both is bad */
+ else if ((lhs->bits ^ rhs->bits) & DECINF)
+ *status|=DEC_Invalid_operation;
+ /* both infinity: return lhs */
+ else uprv_decNumberCopy(res, lhs); /* [nop if in place] */
+ break;
+ }
+
+ /* set requested exponent */
+ if (quant) reqexp=inrhs->exponent; /* quantize -- match exponents */
+ else { /* rescale -- use value of rhs */
+ /* Original rhs must be an integer that fits and is in range, */
+ /* which could be from -1999999997 to +999999999, thanks to */
+ /* subnormals */
+ reqexp=decGetInt(inrhs); /* [cannot fail] */
+ }
+
+ #if DECSUBSET
+ if (!set->extended) etiny=set->emin; /* no subnormals */
+ #endif
+
+ if (reqexp==BADINT /* bad (rescale only) or .. */
+ || reqexp==BIGODD || reqexp==BIGEVEN /* very big (ditto) or .. */
+ || (reqexp<etiny) /* < lowest */
+ || (reqexp>set->emax)) { /* > emax */
+ *status|=DEC_Invalid_operation;
+ break;}
+
+ /* the RHS has been processed, so it can be overwritten now if necessary */
+ if (ISZERO(lhs)) { /* zero coefficient unchanged */
+ uprv_decNumberCopy(res, lhs); /* [nop if in place] */
+ res->exponent=reqexp; /* .. just set exponent */
+ #if DECSUBSET
+ if (!set->extended) res->bits=0; /* subset specification; no -0 */
+ #endif
+ }
+ else { /* non-zero lhs */
+ Int adjust=reqexp-lhs->exponent; /* digit adjustment needed */
+ /* if adjusted coefficient will definitely not fit, give up now */
+ if ((lhs->digits-adjust)>reqdigits) {
+ *status|=DEC_Invalid_operation;
+ break;
+ }
+
+ if (adjust>0) { /* increasing exponent */
+ /* this will decrease the length of the coefficient by adjust */
+ /* digits, and must round as it does so */
+ decContext workset; /* work */
+ workset=*set; /* clone rounding, etc. */
+ workset.digits=lhs->digits-adjust; /* set requested length */
+ /* [note that the latter can be <1, here] */
+ decCopyFit(res, lhs, &workset, &residue, status); /* fit to result */
+ decApplyRound(res, &workset, residue, status); /* .. and round */
+ residue=0; /* [used] */
+ /* If just rounded a 999s case, exponent will be off by one; */
+ /* adjust back (after checking space), if so. */
+ if (res->exponent>reqexp) {
+ /* re-check needed, e.g., for quantize(0.9999, 0.001) under */
+ /* set->digits==3 */
+ if (res->digits==reqdigits) { /* cannot shift by 1 */
+ *status&=~(DEC_Inexact | DEC_Rounded); /* [clean these] */
+ *status|=DEC_Invalid_operation;
+ break;
+ }
+ res->digits=decShiftToMost(res->lsu, res->digits, 1); /* shift */
+ res->exponent--; /* (re)adjust the exponent. */
+ }
+ #if DECSUBSET
+ if (ISZERO(res) && !set->extended) res->bits=0; /* subset; no -0 */
+ #endif
+ } /* increase */
+ else /* adjust<=0 */ { /* decreasing or = exponent */
+ /* this will increase the length of the coefficient by -adjust */
+ /* digits, by adding zero or more trailing zeros; this is */
+ /* already checked for fit, above */
+ uprv_decNumberCopy(res, lhs); /* [it will fit] */
+ /* if padding needed (adjust<0), add it now... */
+ if (adjust<0) {
+ res->digits=decShiftToMost(res->lsu, res->digits, -adjust);
+ res->exponent+=adjust; /* adjust the exponent */
+ }
+ } /* decrease */
+ } /* non-zero */
+
+ /* Check for overflow [do not use Finalize in this case, as an */
+ /* overflow here is a "don't fit" situation] */
+ if (res->exponent>set->emax-res->digits+1) { /* too big */
+ *status|=DEC_Invalid_operation;
+ break;
+ }
+ else {
+ decFinalize(res, set, &residue, status); /* set subnormal flags */
+ *status&=~DEC_Underflow; /* suppress Underflow [as per 754] */
+ }
+ } while(0); /* end protected */
+
+ #if DECSUBSET
+ if (allocrhs!=NULL) free(allocrhs); /* drop any storage used */
+ if (alloclhs!=NULL) free(alloclhs); /* .. */
+ #endif
+ return res;
+ } /* decQuantizeOp */
+
+/* ------------------------------------------------------------------ */
+/* decCompareOp -- compare, min, or max two Numbers */
+/* */
+/* This computes C = A ? B and carries out one of four operations: */
+/* COMPARE -- returns the signum (as a number) giving the */
+/* result of a comparison unless one or both */
+/* operands is a NaN (in which case a NaN results) */
+/* COMPSIG -- as COMPARE except that a quiet NaN raises */
+/* Invalid operation. */
+/* COMPMAX -- returns the larger of the operands, using the */
+/* 754 maxnum operation */
+/* COMPMAXMAG -- ditto, comparing absolute values */
+/* COMPMIN -- the 754 minnum operation */
+/* COMPMINMAG -- ditto, comparing absolute values */
+/* COMTOTAL -- returns the signum (as a number) giving the */
+/* result of a comparison using 754 total ordering */
+/* */
+/* res is C, the result. C may be A and/or B (e.g., X=X?X) */
+/* lhs is A */
+/* rhs is B */
+/* set is the context */
+/* op is the operation flag */
+/* status is the usual accumulator */
+/* */
+/* C must have space for one digit for COMPARE or set->digits for */
+/* COMPMAX, COMPMIN, COMPMAXMAG, or COMPMINMAG. */
+/* ------------------------------------------------------------------ */
+/* The emphasis here is on speed for common cases, and avoiding */
+/* coefficient comparison if possible. */
+/* ------------------------------------------------------------------ */
+static decNumber * decCompareOp(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set,
+ Flag op, uInt *status) {
+ #if DECSUBSET
+ decNumber *alloclhs=NULL; /* non-NULL if rounded lhs allocated */
+ decNumber *allocrhs=NULL; /* .., rhs */
+ #endif
+ Int result=0; /* default result value */
+ uByte merged; /* work */
+
+ #if DECCHECK
+ if (decCheckOperands(res, lhs, rhs, set)) return res;
+ #endif
+
+ do { /* protect allocated storage */
+ #if DECSUBSET
+ if (!set->extended) {
+ /* reduce operands and set lostDigits status, as needed */
+ if (lhs->digits>set->digits) {
+ alloclhs=decRoundOperand(lhs, set, status);
+ if (alloclhs==NULL) {result=BADINT; break;}
+ lhs=alloclhs;
+ }
+ if (rhs->digits>set->digits) {
+ allocrhs=decRoundOperand(rhs, set, status);
+ if (allocrhs==NULL) {result=BADINT; break;}
+ rhs=allocrhs;
+ }
+ }
+ #endif
+ /* [following code does not require input rounding] */
+
+ /* If total ordering then handle differing signs 'up front' */
+ if (op==COMPTOTAL) { /* total ordering */
+ if (decNumberIsNegative(lhs) && !decNumberIsNegative(rhs)) {
+ result=-1;
+ break;
+ }
+ if (!decNumberIsNegative(lhs) && decNumberIsNegative(rhs)) {
+ result=+1;
+ break;
+ }
+ }
+
+ /* handle NaNs specially; let infinities drop through */
+ /* This assumes sNaN (even just one) leads to NaN. */
+ merged=(lhs->bits | rhs->bits) & (DECSNAN | DECNAN);
+ if (merged) { /* a NaN bit set */
+ if (op==COMPARE); /* result will be NaN */
+ else if (op==COMPSIG) /* treat qNaN as sNaN */
+ *status|=DEC_Invalid_operation | DEC_sNaN;
+ else if (op==COMPTOTAL) { /* total ordering, always finite */
+ /* signs are known to be the same; compute the ordering here */
+ /* as if the signs are both positive, then invert for negatives */
+ if (!decNumberIsNaN(lhs)) result=-1;
+ else if (!decNumberIsNaN(rhs)) result=+1;
+ /* here if both NaNs */
+ else if (decNumberIsSNaN(lhs) && decNumberIsQNaN(rhs)) result=-1;
+ else if (decNumberIsQNaN(lhs) && decNumberIsSNaN(rhs)) result=+1;
+ else { /* both NaN or both sNaN */
+ /* now it just depends on the payload */
+ result=decUnitCompare(lhs->lsu, D2U(lhs->digits),
+ rhs->lsu, D2U(rhs->digits), 0);
+ /* [Error not possible, as these are 'aligned'] */
+ } /* both same NaNs */
+ if (decNumberIsNegative(lhs)) result=-result;
+ break;
+ } /* total order */
+
+ else if (merged & DECSNAN); /* sNaN -> qNaN */
+ else { /* here if MIN or MAX and one or two quiet NaNs */
+ /* min or max -- 754 rules ignore single NaN */
+ if (!decNumberIsNaN(lhs) || !decNumberIsNaN(rhs)) {
+ /* just one NaN; force choice to be the non-NaN operand */
+ op=COMPMAX;
+ if (lhs->bits & DECNAN) result=-1; /* pick rhs */
+ else result=+1; /* pick lhs */
+ break;
+ }
+ } /* max or min */
+ op=COMPNAN; /* use special path */
+ decNaNs(res, lhs, rhs, set, status); /* propagate NaN */
+ break;
+ }
+ /* have numbers */
+ if (op==COMPMAXMAG || op==COMPMINMAG) result=decCompare(lhs, rhs, 1);
+ else result=decCompare(lhs, rhs, 0); /* sign matters */
+ } while(0); /* end protected */
+
+ if (result==BADINT) *status|=DEC_Insufficient_storage; /* rare */
+ else {
+ if (op==COMPARE || op==COMPSIG ||op==COMPTOTAL) { /* returning signum */
+ if (op==COMPTOTAL && result==0) {
+ /* operands are numerically equal or same NaN (and same sign, */
+ /* tested first); if identical, leave result 0 */
+ if (lhs->exponent!=rhs->exponent) {
+ if (lhs->exponent<rhs->exponent) result=-1;
+ else result=+1;
+ if (decNumberIsNegative(lhs)) result=-result;
+ } /* lexp!=rexp */
+ } /* total-order by exponent */
+ uprv_decNumberZero(res); /* [always a valid result] */
+ if (result!=0) { /* must be -1 or +1 */
+ *res->lsu=1;
+ if (result<0) res->bits=DECNEG;
+ }
+ }
+ else if (op==COMPNAN); /* special, drop through */
+ else { /* MAX or MIN, non-NaN result */
+ Int residue=0; /* rounding accumulator */
+ /* choose the operand for the result */
+ const decNumber *choice;
+ if (result==0) { /* operands are numerically equal */
+ /* choose according to sign then exponent (see 754) */
+ uByte slhs=(lhs->bits & DECNEG);
+ uByte srhs=(rhs->bits & DECNEG);
+ #if DECSUBSET
+ if (!set->extended) { /* subset: force left-hand */
+ op=COMPMAX;
+ result=+1;
+ }
+ else
+ #endif
+ if (slhs!=srhs) { /* signs differ */
+ if (slhs) result=-1; /* rhs is max */
+ else result=+1; /* lhs is max */
+ }
+ else if (slhs && srhs) { /* both negative */
+ if (lhs->exponent<rhs->exponent) result=+1;
+ else result=-1;
+ /* [if equal, use lhs, technically identical] */
+ }
+ else { /* both positive */
+ if (lhs->exponent>rhs->exponent) result=+1;
+ else result=-1;
+ /* [ditto] */
+ }
+ } /* numerically equal */
+ /* here result will be non-0; reverse if looking for MIN */
+ if (op==COMPMIN || op==COMPMINMAG) result=-result;
+ choice=(result>0 ? lhs : rhs); /* choose */
+ /* copy chosen to result, rounding if need be */
+ decCopyFit(res, choice, set, &residue, status);
+ decFinish(res, set, &residue, status);
+ }
+ }
+ #if DECSUBSET
+ if (allocrhs!=NULL) free(allocrhs); /* free any storage used */
+ if (alloclhs!=NULL) free(alloclhs); /* .. */
+ #endif
+ return res;
+ } /* decCompareOp */
+
+/* ------------------------------------------------------------------ */
+/* decCompare -- compare two decNumbers by numerical value */
+/* */
+/* This routine compares A ? B without altering them. */
+/* */
+/* Arg1 is A, a decNumber which is not a NaN */
+/* Arg2 is B, a decNumber which is not a NaN */
+/* Arg3 is 1 for a sign-independent compare, 0 otherwise */
+/* */
+/* returns -1, 0, or 1 for A<B, A==B, or A>B, or BADINT if failure */
+/* (the only possible failure is an allocation error) */
+/* ------------------------------------------------------------------ */
+static Int decCompare(const decNumber *lhs, const decNumber *rhs,
+ Flag abs_c) {
+ Int result; /* result value */
+ Int sigr; /* rhs signum */
+ Int compare; /* work */
+
+ result=1; /* assume signum(lhs) */
+ if (ISZERO(lhs)) result=0;
+ if (abs_c) {
+ if (ISZERO(rhs)) return result; /* LHS wins or both 0 */
+ /* RHS is non-zero */
+ if (result==0) return -1; /* LHS is 0; RHS wins */
+ /* [here, both non-zero, result=1] */
+ }
+ else { /* signs matter */
+ if (result && decNumberIsNegative(lhs)) result=-1;
+ sigr=1; /* compute signum(rhs) */
+ if (ISZERO(rhs)) sigr=0;
+ else if (decNumberIsNegative(rhs)) sigr=-1;
+ if (result > sigr) return +1; /* L > R, return 1 */
+ if (result < sigr) return -1; /* L < R, return -1 */
+ if (result==0) return 0; /* both 0 */
+ }
+
+ /* signums are the same; both are non-zero */
+ if ((lhs->bits | rhs->bits) & DECINF) { /* one or more infinities */
+ if (decNumberIsInfinite(rhs)) {
+ if (decNumberIsInfinite(lhs)) result=0;/* both infinite */
+ else result=-result; /* only rhs infinite */
+ }
+ return result;
+ }
+ /* must compare the coefficients, allowing for exponents */
+ if (lhs->exponent>rhs->exponent) { /* LHS exponent larger */
+ /* swap sides, and sign */
+ const decNumber *temp=lhs;
+ lhs=rhs;
+ rhs=temp;
+ result=-result;
+ }
+ compare=decUnitCompare(lhs->lsu, D2U(lhs->digits),
+ rhs->lsu, D2U(rhs->digits),
+ rhs->exponent-lhs->exponent);
+ if (compare!=BADINT) compare*=result; /* comparison succeeded */
+ return compare;
+ } /* decCompare */
+
+/* ------------------------------------------------------------------ */
+/* decUnitCompare -- compare two >=0 integers in Unit arrays */
+/* */
+/* This routine compares A ? B*10**E where A and B are unit arrays */
+/* A is a plain integer */
+/* B has an exponent of E (which must be non-negative) */
+/* */
+/* Arg1 is A first Unit (lsu) */
+/* Arg2 is A length in Units */
+/* Arg3 is B first Unit (lsu) */
+/* Arg4 is B length in Units */
+/* Arg5 is E (0 if the units are aligned) */
+/* */
+/* returns -1, 0, or 1 for A<B, A==B, or A>B, or BADINT if failure */
+/* (the only possible failure is an allocation error, which can */
+/* only occur if E!=0) */
+/* ------------------------------------------------------------------ */
+static Int decUnitCompare(const Unit *a, Int alength,
+ const Unit *b, Int blength, Int exp) {
+ Unit *acc; /* accumulator for result */
+ Unit accbuff[SD2U(DECBUFFER*2+1)]; /* local buffer */
+ Unit *allocacc=NULL; /* -> allocated acc buffer, iff allocated */
+ Int accunits, need; /* units in use or needed for acc */
+ const Unit *l, *r, *u; /* work */
+ Int expunits, exprem, result; /* .. */
+
+ if (exp==0) { /* aligned; fastpath */
+ if (alength>blength) return 1;
+ if (alength<blength) return -1;
+ /* same number of units in both -- need unit-by-unit compare */
+ l=a+alength-1;
+ r=b+alength-1;
+ for (;l>=a; l--, r--) {
+ if (*l>*r) return 1;
+ if (*l<*r) return -1;
+ }
+ return 0; /* all units match */
+ } /* aligned */
+
+ /* Unaligned. If one is >1 unit longer than the other, padded */
+ /* approximately, then can return easily */
+ if (alength>blength+(Int)D2U(exp)) return 1;
+ if (alength+1<blength+(Int)D2U(exp)) return -1;
+
+ /* Need to do a real subtract. For this, a result buffer is needed */
+ /* even though only the sign is of interest. Its length needs */
+ /* to be the larger of alength and padded blength, +2 */
+ need=blength+D2U(exp); /* maximum real length of B */
+ if (need<alength) need=alength;
+ need+=2;
+ acc=accbuff; /* assume use local buffer */
+ if (need*sizeof(Unit)>sizeof(accbuff)) {
+ allocacc=(Unit *)malloc(need*sizeof(Unit));
+ if (allocacc==NULL) return BADINT; /* hopeless -- abandon */
+ acc=allocacc;
+ }
+ /* Calculate units and remainder from exponent. */
+ expunits=exp/DECDPUN;
+ exprem=exp%DECDPUN;
+ /* subtract [A+B*(-m)] */
+ accunits=decUnitAddSub(a, alength, b, blength, expunits, acc,
+ -(Int)powers[exprem]);
+ /* [UnitAddSub result may have leading zeros, even on zero] */
+ if (accunits<0) result=-1; /* negative result */
+ else { /* non-negative result */
+ /* check units of the result before freeing any storage */
+ for (u=acc; u<acc+accunits-1 && *u==0;) u++;
+ result=(*u==0 ? 0 : +1);
+ }
+ /* clean up and return the result */
+ if (allocacc!=NULL) free(allocacc); /* drop any storage used */
+ return result;
+ } /* decUnitCompare */
+
+/* ------------------------------------------------------------------ */
+/* decUnitAddSub -- add or subtract two >=0 integers in Unit arrays */
+/* */
+/* This routine performs the calculation: */
+/* */
+/* C=A+(B*M) */
+/* */
+/* Where M is in the range -DECDPUNMAX through +DECDPUNMAX. */
+/* */
+/* A may be shorter or longer than B. */
+/* */
+/* Leading zeros are not removed after a calculation. The result is */
+/* either the same length as the longer of A and B (adding any */
+/* shift), or one Unit longer than that (if a Unit carry occurred). */
+/* */
+/* A and B content are not altered unless C is also A or B. */
+/* C may be the same array as A or B, but only if no zero padding is */
+/* requested (that is, C may be B only if bshift==0). */
+/* C is filled from the lsu; only those units necessary to complete */
+/* the calculation are referenced. */
+/* */
+/* Arg1 is A first Unit (lsu) */
+/* Arg2 is A length in Units */
+/* Arg3 is B first Unit (lsu) */
+/* Arg4 is B length in Units */
+/* Arg5 is B shift in Units (>=0; pads with 0 units if positive) */
+/* Arg6 is C first Unit (lsu) */
+/* Arg7 is M, the multiplier */
+/* */
+/* returns the count of Units written to C, which will be non-zero */
+/* and negated if the result is negative. That is, the sign of the */
+/* returned Int is the sign of the result (positive for zero) and */
+/* the absolute value of the Int is the count of Units. */
+/* */
+/* It is the caller's responsibility to make sure that C size is */
+/* safe, allowing space if necessary for a one-Unit carry. */
+/* */
+/* This routine is severely performance-critical; *any* change here */
+/* must be measured (timed) to assure no performance degradation. */
+/* In particular, trickery here tends to be counter-productive, as */
+/* increased complexity of code hurts register optimizations on */
+/* register-poor architectures. Avoiding divisions is nearly */
+/* always a Good Idea, however. */
+/* */
+/* Special thanks to Rick McGuire (IBM Cambridge, MA) and Dave Clark */
+/* (IBM Warwick, UK) for some of the ideas used in this routine. */
+/* ------------------------------------------------------------------ */
+static Int decUnitAddSub(const Unit *a, Int alength,
+ const Unit *b, Int blength, Int bshift,
+ Unit *c, Int m) {
+ const Unit *alsu=a; /* A lsu [need to remember it] */
+ Unit *clsu=c; /* C ditto */
+ Unit *minC; /* low water mark for C */
+ Unit *maxC; /* high water mark for C */
+ eInt carry=0; /* carry integer (could be Long) */
+ Int add; /* work */
+ #if DECDPUN<=4 /* myriadal, millenary, etc. */
+ Int est; /* estimated quotient */
+ #endif
+
+ #if DECTRACE
+ if (alength<1 || blength<1)
+ printf("decUnitAddSub: alen blen m %ld %ld [%ld]\n", alength, blength, m);
+ #endif
+
+ maxC=c+alength; /* A is usually the longer */
+ minC=c+blength; /* .. and B the shorter */
+ if (bshift!=0) { /* B is shifted; low As copy across */
+ minC+=bshift;
+ /* if in place [common], skip copy unless there's a gap [rare] */
+ if (a==c && bshift<=alength) {
+ c+=bshift;
+ a+=bshift;
+ }
+ else for (; c<clsu+bshift; a++, c++) { /* copy needed */
+ if (a<alsu+alength) *c=*a;
+ else *c=0;
+ }
+ }
+ if (minC>maxC) { /* swap */
+ Unit *hold=minC;
+ minC=maxC;
+ maxC=hold;
+ }
+
+ /* For speed, do the addition as two loops; the first where both A */
+ /* and B contribute, and the second (if necessary) where only one or */
+ /* other of the numbers contribute. */
+ /* Carry handling is the same (i.e., duplicated) in each case. */
+ for (; c<minC; c++) {
+ carry+=*a;
+ a++;
+ carry+=((eInt)*b)*m; /* [special-casing m=1/-1 */
+ b++; /* here is not a win] */
+ /* here carry is new Unit of digits; it could be +ve or -ve */
+ if ((ueInt)carry<=DECDPUNMAX) { /* fastpath 0-DECDPUNMAX */
+ *c=(Unit)carry;
+ carry=0;
+ continue;
+ }
+ #if DECDPUN==4 /* use divide-by-multiply */
+ if (carry>=0) {
+ est=(((ueInt)carry>>11)*53687)>>18;
+ *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
+ carry=est; /* likely quotient [89%] */
+ if (*c<DECDPUNMAX+1) continue; /* estimate was correct */
+ carry++;
+ *c-=DECDPUNMAX+1;
+ continue;
+ }
+ /* negative case */
+ carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
+ est=(((ueInt)carry>>11)*53687)>>18;
+ *c=(Unit)(carry-est*(DECDPUNMAX+1));
+ carry=est-(DECDPUNMAX+1); /* correctly negative */
+ if (*c<DECDPUNMAX+1) continue; /* was OK */
+ carry++;
+ *c-=DECDPUNMAX+1;
+ #elif DECDPUN==3
+ if (carry>=0) {
+ est=(((ueInt)carry>>3)*16777)>>21;
+ *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
+ carry=est; /* likely quotient [99%] */
+ if (*c<DECDPUNMAX+1) continue; /* estimate was correct */
+ carry++;
+ *c-=DECDPUNMAX+1;
+ continue;
+ }
+ /* negative case */
+ carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
+ est=(((ueInt)carry>>3)*16777)>>21;
+ *c=(Unit)(carry-est*(DECDPUNMAX+1));
+ carry=est-(DECDPUNMAX+1); /* correctly negative */
+ if (*c<DECDPUNMAX+1) continue; /* was OK */
+ carry++;
+ *c-=DECDPUNMAX+1;
+ #elif DECDPUN<=2
+ /* Can use QUOT10 as carry <= 4 digits */
+ if (carry>=0) {
+ est=QUOT10(carry, DECDPUN);
+ *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
+ carry=est; /* quotient */
+ continue;
+ }
+ /* negative case */
+ carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
+ est=QUOT10(carry, DECDPUN);
+ *c=(Unit)(carry-est*(DECDPUNMAX+1));
+ carry=est-(DECDPUNMAX+1); /* correctly negative */
+ #else
+ /* remainder operator is undefined if negative, so must test */
+ if ((ueInt)carry<(DECDPUNMAX+1)*2) { /* fastpath carry +1 */
+ *c=(Unit)(carry-(DECDPUNMAX+1)); /* [helps additions] */
+ carry=1;
+ continue;
+ }
+ if (carry>=0) {
+ *c=(Unit)(carry%(DECDPUNMAX+1));
+ carry=carry/(DECDPUNMAX+1);
+ continue;
+ }
+ /* negative case */
+ carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
+ *c=(Unit)(carry%(DECDPUNMAX+1));
+ carry=carry/(DECDPUNMAX+1)-(DECDPUNMAX+1);
+ #endif
+ } /* c */
+
+ /* now may have one or other to complete */
+ /* [pretest to avoid loop setup/shutdown] */
+ if (c<maxC) for (; c<maxC; c++) {
+ if (a<alsu+alength) { /* still in A */
+ carry+=*a;
+ a++;
+ }
+ else { /* inside B */
+ carry+=((eInt)*b)*m;
+ b++;
+ }
+ /* here carry is new Unit of digits; it could be +ve or -ve and */
+ /* magnitude up to DECDPUNMAX squared */
+ if ((ueInt)carry<=DECDPUNMAX) { /* fastpath 0-DECDPUNMAX */
+ *c=(Unit)carry;
+ carry=0;
+ continue;
+ }
+ /* result for this unit is negative or >DECDPUNMAX */
+ #if DECDPUN==4 /* use divide-by-multiply */
+ if (carry>=0) {
+ est=(((ueInt)carry>>11)*53687)>>18;
+ *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
+ carry=est; /* likely quotient [79.7%] */
+ if (*c<DECDPUNMAX+1) continue; /* estimate was correct */
+ carry++;
+ *c-=DECDPUNMAX+1;
+ continue;
+ }
+ /* negative case */
+ carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
+ est=(((ueInt)carry>>11)*53687)>>18;
+ *c=(Unit)(carry-est*(DECDPUNMAX+1));
+ carry=est-(DECDPUNMAX+1); /* correctly negative */
+ if (*c<DECDPUNMAX+1) continue; /* was OK */
+ carry++;
+ *c-=DECDPUNMAX+1;
+ #elif DECDPUN==3
+ if (carry>=0) {
+ est=(((ueInt)carry>>3)*16777)>>21;
+ *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
+ carry=est; /* likely quotient [99%] */
+ if (*c<DECDPUNMAX+1) continue; /* estimate was correct */
+ carry++;
+ *c-=DECDPUNMAX+1;
+ continue;
+ }
+ /* negative case */
+ carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
+ est=(((ueInt)carry>>3)*16777)>>21;
+ *c=(Unit)(carry-est*(DECDPUNMAX+1));
+ carry=est-(DECDPUNMAX+1); /* correctly negative */
+ if (*c<DECDPUNMAX+1) continue; /* was OK */
+ carry++;
+ *c-=DECDPUNMAX+1;
+ #elif DECDPUN<=2
+ if (carry>=0) {
+ est=QUOT10(carry, DECDPUN);
+ *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
+ carry=est; /* quotient */
+ continue;
+ }
+ /* negative case */
+ carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
+ est=QUOT10(carry, DECDPUN);
+ *c=(Unit)(carry-est*(DECDPUNMAX+1));
+ carry=est-(DECDPUNMAX+1); /* correctly negative */
+ #else
+ if ((ueInt)carry<(DECDPUNMAX+1)*2){ /* fastpath carry 1 */
+ *c=(Unit)(carry-(DECDPUNMAX+1));
+ carry=1;
+ continue;
+ }
+ /* remainder operator is undefined if negative, so must test */
+ if (carry>=0) {
+ *c=(Unit)(carry%(DECDPUNMAX+1));
+ carry=carry/(DECDPUNMAX+1);
+ continue;
+ }
+ /* negative case */
+ carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
+ *c=(Unit)(carry%(DECDPUNMAX+1));
+ carry=carry/(DECDPUNMAX+1)-(DECDPUNMAX+1);
+ #endif
+ } /* c */
+
+ /* OK, all A and B processed; might still have carry or borrow */
+ /* return number of Units in the result, negated if a borrow */
+ if (carry==0) return static_cast<int32_t>(c-clsu); /* no carry, so no more to do */
+ if (carry>0) { /* positive carry */
+ *c=(Unit)carry; /* place as new unit */
+ c++; /* .. */
+ return static_cast<int32_t>(c-clsu);
+ }
+ /* -ve carry: it's a borrow; complement needed */
+ add=1; /* temporary carry... */
+ for (c=clsu; c<maxC; c++) {
+ add=DECDPUNMAX+add-*c;
+ if (add<=DECDPUNMAX) {
+ *c=(Unit)add;
+ add=0;
+ }
+ else {
+ *c=0;
+ add=1;
+ }
+ }
+ /* add an extra unit iff it would be non-zero */
+ #if DECTRACE
+ printf("UAS borrow: add %ld, carry %ld\n", add, carry);
+ #endif
+ if ((add-carry-1)!=0) {
+ *c=(Unit)(add-carry-1);
+ c++; /* interesting, include it */
+ }
+ return static_cast<int32_t>(clsu-c); /* -ve result indicates borrowed */
+ } /* decUnitAddSub */
+
+/* ------------------------------------------------------------------ */
+/* decTrim -- trim trailing zeros or normalize */
+/* */
+/* dn is the number to trim or normalize */
+/* set is the context to use to check for clamp */
+/* all is 1 to remove all trailing zeros, 0 for just fraction ones */
+/* noclamp is 1 to unconditional (unclamped) trim */
+/* dropped returns the number of discarded trailing zeros */
+/* returns dn */
+/* */
+/* If clamp is set in the context then the number of zeros trimmed */
+/* may be limited if the exponent is high. */
+/* All fields are updated as required. This is a utility operation, */
+/* so special values are unchanged and no error is possible. */
+/* ------------------------------------------------------------------ */
+static decNumber * decTrim(decNumber *dn, decContext *set, Flag all,
+ Flag noclamp, Int *dropped) {
+ Int d, exp; /* work */
+ uInt cut; /* .. */
+ Unit *up; /* -> current Unit */
+
+ #if DECCHECK
+ if (decCheckOperands(dn, DECUNUSED, DECUNUSED, DECUNCONT)) return dn;
+ #endif
+
+ *dropped=0; /* assume no zeros dropped */
+ if ((dn->bits & DECSPECIAL) /* fast exit if special .. */
+ || (*dn->lsu & 0x01)) return dn; /* .. or odd */
+ if (ISZERO(dn)) { /* .. or 0 */
+ dn->exponent=0; /* (sign is preserved) */
+ return dn;
+ }
+
+ /* have a finite number which is even */
+ exp=dn->exponent;
+ cut=1; /* digit (1-DECDPUN) in Unit */
+ up=dn->lsu; /* -> current Unit */
+ for (d=0; d<dn->digits-1; d++) { /* [don't strip the final digit] */
+ /* slice by powers */
+ #if DECDPUN<=4
+ uInt quot=QUOT10(*up, cut);
+ if ((*up-quot*powers[cut])!=0) break; /* found non-0 digit */
+ #else
+ if (*up%powers[cut]!=0) break; /* found non-0 digit */
+ #endif
+ /* have a trailing 0 */
+ if (!all) { /* trimming */
+ /* [if exp>0 then all trailing 0s are significant for trim] */
+ if (exp<=0) { /* if digit might be significant */
+ if (exp==0) break; /* then quit */
+ exp++; /* next digit might be significant */
+ }
+ }
+ cut++; /* next power */
+ if (cut>DECDPUN) { /* need new Unit */
+ up++;
+ cut=1;
+ }
+ } /* d */
+ if (d==0) return dn; /* none to drop */
+
+ /* may need to limit drop if clamping */
+ if (set->clamp && !noclamp) {
+ Int maxd=set->emax-set->digits+1-dn->exponent;
+ if (maxd<=0) return dn; /* nothing possible */
+ if (d>maxd) d=maxd;
+ }
+
+ /* effect the drop */
+ decShiftToLeast(dn->lsu, D2U(dn->digits), d);
+ dn->exponent+=d; /* maintain numerical value */
+ dn->digits-=d; /* new length */
+ *dropped=d; /* report the count */
+ return dn;
+ } /* decTrim */
+
+/* ------------------------------------------------------------------ */
+/* decReverse -- reverse a Unit array in place */
+/* */
+/* ulo is the start of the array */
+/* uhi is the end of the array (highest Unit to include) */
+/* */
+/* The units ulo through uhi are reversed in place (if the number */
+/* of units is odd, the middle one is untouched). Note that the */
+/* digit(s) in each unit are unaffected. */
+/* ------------------------------------------------------------------ */
+static void decReverse(Unit *ulo, Unit *uhi) {
+ Unit temp;
+ for (; ulo<uhi; ulo++, uhi--) {
+ temp=*ulo;
+ *ulo=*uhi;
+ *uhi=temp;
+ }
+ return;
+ } /* decReverse */
+
+/* ------------------------------------------------------------------ */
+/* decShiftToMost -- shift digits in array towards most significant */
+/* */
+/* uar is the array */
+/* digits is the count of digits in use in the array */
+/* shift is the number of zeros to pad with (least significant); */
+/* it must be zero or positive */
+/* */
+/* returns the new length of the integer in the array, in digits */
+/* */
+/* No overflow is permitted (that is, the uar array must be known to */
+/* be large enough to hold the result, after shifting). */
+/* ------------------------------------------------------------------ */
+static Int decShiftToMost(Unit *uar, Int digits, Int shift) {
+ Unit *target, *source, *first; /* work */
+ Int cut; /* odd 0's to add */
+ uInt next; /* work */
+
+ if (shift==0) return digits; /* [fastpath] nothing to do */
+ if ((digits+shift)<=DECDPUN) { /* [fastpath] single-unit case */
+ *uar=(Unit)(*uar*powers[shift]);
+ return digits+shift;
+ }
+
+ next=0; /* all paths */
+ source=uar+D2U(digits)-1; /* where msu comes from */
+ target=source+D2U(shift); /* where upper part of first cut goes */
+ cut=DECDPUN-MSUDIGITS(shift); /* where to slice */
+ if (cut==0) { /* unit-boundary case */
+ for (; source>=uar; source--, target--) *target=*source;
+ }
+ else {
+ first=uar+D2U(digits+shift)-1; /* where msu of source will end up */
+ for (; source>=uar; source--, target--) {
+ /* split the source Unit and accumulate remainder for next */
+ #if DECDPUN<=4
+ uInt quot=QUOT10(*source, cut);
+ uInt rem=*source-quot*powers[cut];
+ next+=quot;
+ #else
+ uInt rem=*source%powers[cut];
+ next+=*source/powers[cut];
+ #endif
+ if (target<=first) *target=(Unit)next; /* write to target iff valid */
+ next=rem*powers[DECDPUN-cut]; /* save remainder for next Unit */
+ }
+ } /* shift-move */
+
+ /* propagate any partial unit to one below and clear the rest */
+ for (; target>=uar; target--) {
+ *target=(Unit)next;
+ next=0;
+ }
+ return digits+shift;
+ } /* decShiftToMost */
+
+/* ------------------------------------------------------------------ */
+/* decShiftToLeast -- shift digits in array towards least significant */
+/* */
+/* uar is the array */
+/* units is length of the array, in units */
+/* shift is the number of digits to remove from the lsu end; it */
+/* must be zero or positive and <= than units*DECDPUN. */
+/* */
+/* returns the new length of the integer in the array, in units */
+/* */
+/* Removed digits are discarded (lost). Units not required to hold */
+/* the final result are unchanged. */
+/* ------------------------------------------------------------------ */
+static Int decShiftToLeast(Unit *uar, Int units, Int shift) {
+ Unit *target, *up; /* work */
+ Int cut, count; /* work */
+ Int quot, rem; /* for division */
+
+ if (shift==0) return units; /* [fastpath] nothing to do */
+ if (shift==units*DECDPUN) { /* [fastpath] little to do */
+ *uar=0; /* all digits cleared gives zero */
+ return 1; /* leaves just the one */
+ }
+
+ target=uar; /* both paths */
+ cut=MSUDIGITS(shift);
+ if (cut==DECDPUN) { /* unit-boundary case; easy */
+ up=uar+D2U(shift);
+ for (; up<uar+units; target++, up++) *target=*up;
+ return static_cast<int32_t>(target-uar);
+ }
+
+ /* messier */
+ up=uar+D2U(shift-cut); /* source; correct to whole Units */
+ count=units*DECDPUN-shift; /* the maximum new length */
+ #if DECDPUN<=4
+ quot=QUOT10(*up, cut);
+ #else
+ quot=*up/powers[cut];
+ #endif
+ for (; ; target++) {
+ *target=(Unit)quot;
+ count-=(DECDPUN-cut);
+ if (count<=0) break;
+ up++;
+ quot=*up;
+ #if DECDPUN<=4
+ quot=QUOT10(quot, cut);
+ rem=*up-quot*powers[cut];
+ #else
+ rem=quot%powers[cut];
+ quot=quot/powers[cut];
+ #endif
+ *target=(Unit)(*target+rem*powers[DECDPUN-cut]);
+ count-=cut;
+ if (count<=0) break;
+ }
+ return static_cast<int32_t>(target-uar+1);
+ } /* decShiftToLeast */
+
+#if DECSUBSET
+/* ------------------------------------------------------------------ */
+/* decRoundOperand -- round an operand [used for subset only] */
+/* */
+/* dn is the number to round (dn->digits is > set->digits) */
+/* set is the relevant context */
+/* status is the status accumulator */
+/* */
+/* returns an allocated decNumber with the rounded result. */
+/* */
+/* lostDigits and other status may be set by this. */
+/* */
+/* Since the input is an operand, it must not be modified. */
+/* Instead, return an allocated decNumber, rounded as required. */
+/* It is the caller's responsibility to free the allocated storage. */
+/* */
+/* If no storage is available then the result cannot be used, so NULL */
+/* is returned. */
+/* ------------------------------------------------------------------ */
+static decNumber *decRoundOperand(const decNumber *dn, decContext *set,
+ uInt *status) {
+ decNumber *res; /* result structure */
+ uInt newstatus=0; /* status from round */
+ Int residue=0; /* rounding accumulator */
+
+ /* Allocate storage for the returned decNumber, big enough for the */
+ /* length specified by the context */
+ res=(decNumber *)malloc(sizeof(decNumber)
+ +(D2U(set->digits)-1)*sizeof(Unit));
+ if (res==NULL) {
+ *status|=DEC_Insufficient_storage;
+ return NULL;
+ }
+ decCopyFit(res, dn, set, &residue, &newstatus);
+ decApplyRound(res, set, residue, &newstatus);
+
+ /* If that set Inexact then "lost digits" is raised... */
+ if (newstatus & DEC_Inexact) newstatus|=DEC_Lost_digits;
+ *status|=newstatus;
+ return res;
+ } /* decRoundOperand */
+#endif
+
+/* ------------------------------------------------------------------ */
+/* decCopyFit -- copy a number, truncating the coefficient if needed */
+/* */
+/* dest is the target decNumber */
+/* src is the source decNumber */
+/* set is the context [used for length (digits) and rounding mode] */
+/* residue is the residue accumulator */
+/* status contains the current status to be updated */
+/* */
+/* (dest==src is allowed and will be a no-op if fits) */
+/* All fields are updated as required. */
+/* ------------------------------------------------------------------ */
+static void decCopyFit(decNumber *dest, const decNumber *src,
+ decContext *set, Int *residue, uInt *status) {
+ dest->bits=src->bits;
+ dest->exponent=src->exponent;
+ decSetCoeff(dest, set, src->lsu, src->digits, residue, status);
+ } /* decCopyFit */
+
+/* ------------------------------------------------------------------ */
+/* decSetCoeff -- set the coefficient of a number */
+/* */
+/* dn is the number whose coefficient array is to be set. */
+/* It must have space for set->digits digits */
+/* set is the context [for size] */
+/* lsu -> lsu of the source coefficient [may be dn->lsu] */
+/* len is digits in the source coefficient [may be dn->digits] */
+/* residue is the residue accumulator. This has values as in */
+/* decApplyRound, and will be unchanged unless the */
+/* target size is less than len. In this case, the */
+/* coefficient is truncated and the residue is updated to */
+/* reflect the previous residue and the dropped digits. */
+/* status is the status accumulator, as usual */
+/* */
+/* The coefficient may already be in the number, or it can be an */
+/* external intermediate array. If it is in the number, lsu must == */
+/* dn->lsu and len must == dn->digits. */
+/* */
+/* Note that the coefficient length (len) may be < set->digits, and */
+/* in this case this merely copies the coefficient (or is a no-op */
+/* if dn->lsu==lsu). */
+/* */
+/* Note also that (only internally, from decQuantizeOp and */
+/* decSetSubnormal) the value of set->digits may be less than one, */
+/* indicating a round to left. This routine handles that case */
+/* correctly; caller ensures space. */
+/* */
+/* dn->digits, dn->lsu (and as required), and dn->exponent are */
+/* updated as necessary. dn->bits (sign) is unchanged. */
+/* */
+/* DEC_Rounded status is set if any digits are discarded. */
+/* DEC_Inexact status is set if any non-zero digits are discarded, or */
+/* incoming residue was non-0 (implies rounded) */
+/* ------------------------------------------------------------------ */
+/* mapping array: maps 0-9 to canonical residues, so that a residue */
+/* can be adjusted in the range [-1, +1] and achieve correct rounding */
+/* 0 1 2 3 4 5 6 7 8 9 */
+static const uByte resmap[10]={0, 3, 3, 3, 3, 5, 7, 7, 7, 7};
+static void decSetCoeff(decNumber *dn, decContext *set, const Unit *lsu,
+ Int len, Int *residue, uInt *status) {
+ Int discard; /* number of digits to discard */
+ uInt cut; /* cut point in Unit */
+ const Unit *up; /* work */
+ Unit *target; /* .. */
+ Int count; /* .. */
+ #if DECDPUN<=4
+ uInt temp; /* .. */
+ #endif
+
+ discard=len-set->digits; /* digits to discard */
+ if (discard<=0) { /* no digits are being discarded */
+ if (dn->lsu!=lsu) { /* copy needed */
+ /* copy the coefficient array to the result number; no shift needed */
+ count=len; /* avoids D2U */
+ up=lsu;
+ for (target=dn->lsu; count>0; target++, up++, count-=DECDPUN)
+ *target=*up;
+ dn->digits=len; /* set the new length */
+ }
+ /* dn->exponent and residue are unchanged, record any inexactitude */
+ if (*residue!=0) *status|=(DEC_Inexact | DEC_Rounded);
+ return;
+ }
+
+ /* some digits must be discarded ... */
+ dn->exponent+=discard; /* maintain numerical value */
+ *status|=DEC_Rounded; /* accumulate Rounded status */
+ if (*residue>1) *residue=1; /* previous residue now to right, so reduce */
+
+ if (discard>len) { /* everything, +1, is being discarded */
+ /* guard digit is 0 */
+ /* residue is all the number [NB could be all 0s] */
+ if (*residue<=0) { /* not already positive */
+ count=len; /* avoids D2U */
+ for (up=lsu; count>0; up++, count-=DECDPUN) if (*up!=0) { /* found non-0 */
+ *residue=1;
+ break; /* no need to check any others */
+ }
+ }
+ if (*residue!=0) *status|=DEC_Inexact; /* record inexactitude */
+ *dn->lsu=0; /* coefficient will now be 0 */
+ dn->digits=1; /* .. */
+ return;
+ } /* total discard */
+
+ /* partial discard [most common case] */
+ /* here, at least the first (most significant) discarded digit exists */
+
+ /* spin up the number, noting residue during the spin, until get to */
+ /* the Unit with the first discarded digit. When reach it, extract */
+ /* it and remember its position */
+ count=0;
+ for (up=lsu;; up++) {
+ count+=DECDPUN;
+ if (count>=discard) break; /* full ones all checked */
+ if (*up!=0) *residue=1;
+ } /* up */
+
+ /* here up -> Unit with first discarded digit */
+ cut=discard-(count-DECDPUN)-1;
+ if (cut==DECDPUN-1) { /* unit-boundary case (fast) */
+ Unit half=(Unit)powers[DECDPUN]>>1;
+ /* set residue directly */
+ if (*up>=half) {
+ if (*up>half) *residue=7;
+ else *residue+=5; /* add sticky bit */
+ }
+ else { /* <half */
+ if (*up!=0) *residue=3; /* [else is 0, leave as sticky bit] */
+ }
+ if (set->digits<=0) { /* special for Quantize/Subnormal :-( */
+ *dn->lsu=0; /* .. result is 0 */
+ dn->digits=1; /* .. */
+ }
+ else { /* shift to least */
+ count=set->digits; /* now digits to end up with */
+ dn->digits=count; /* set the new length */
+ up++; /* move to next */
+ /* on unit boundary, so shift-down copy loop is simple */
+ for (target=dn->lsu; count>0; target++, up++, count-=DECDPUN)
+ *target=*up;
+ }
+ } /* unit-boundary case */
+
+ else { /* discard digit is in low digit(s), and not top digit */
+ uInt discard1; /* first discarded digit */
+ uInt quot, rem; /* for divisions */
+ if (cut==0) quot=*up; /* is at bottom of unit */
+ else /* cut>0 */ { /* it's not at bottom of unit */
+ #if DECDPUN<=4
+ U_ASSERT(/* cut >= 0 &&*/ cut <= 4);
+ quot=QUOT10(*up, cut);
+ rem=*up-quot*powers[cut];
+ #else
+ rem=*up%powers[cut];
+ quot=*up/powers[cut];
+ #endif
+ if (rem!=0) *residue=1;
+ }
+ /* discard digit is now at bottom of quot */
+ #if DECDPUN<=4
+ temp=(quot*6554)>>16; /* fast /10 */
+ /* Vowels algorithm here not a win (9 instructions) */
+ discard1=quot-X10(temp);
+ quot=temp;
+ #else
+ discard1=quot%10;
+ quot=quot/10;
+ #endif
+ /* here, discard1 is the guard digit, and residue is everything */
+ /* else [use mapping array to accumulate residue safely] */
+ *residue+=resmap[discard1];
+ cut++; /* update cut */
+ /* here: up -> Unit of the array with bottom digit */
+ /* cut is the division point for each Unit */
+ /* quot holds the uncut high-order digits for the current unit */
+ if (set->digits<=0) { /* special for Quantize/Subnormal :-( */
+ *dn->lsu=0; /* .. result is 0 */
+ dn->digits=1; /* .. */
+ }
+ else { /* shift to least needed */
+ count=set->digits; /* now digits to end up with */
+ dn->digits=count; /* set the new length */
+ /* shift-copy the coefficient array to the result number */
+ for (target=dn->lsu; ; target++) {
+ *target=(Unit)quot;
+ count-=(DECDPUN-cut);
+ if (count<=0) break;
+ up++;
+ quot=*up;
+ #if DECDPUN<=4
+ quot=QUOT10(quot, cut);
+ rem=*up-quot*powers[cut];
+ #else
+ rem=quot%powers[cut];
+ quot=quot/powers[cut];
+ #endif
+ *target=(Unit)(*target+rem*powers[DECDPUN-cut]);
+ count-=cut;
+ if (count<=0) break;
+ } /* shift-copy loop */
+ } /* shift to least */
+ } /* not unit boundary */
+
+ if (*residue!=0) *status|=DEC_Inexact; /* record inexactitude */
+ return;
+ } /* decSetCoeff */
+
+/* ------------------------------------------------------------------ */
+/* decApplyRound -- apply pending rounding to a number */
+/* */
+/* dn is the number, with space for set->digits digits */
+/* set is the context [for size and rounding mode] */
+/* residue indicates pending rounding, being any accumulated */
+/* guard and sticky information. It may be: */
+/* 6-9: rounding digit is >5 */
+/* 5: rounding digit is exactly half-way */
+/* 1-4: rounding digit is <5 and >0 */
+/* 0: the coefficient is exact */
+/* -1: as 1, but the hidden digits are subtractive, that */
+/* is, of the opposite sign to dn. In this case the */
+/* coefficient must be non-0. This case occurs when */
+/* subtracting a small number (which can be reduced to */
+/* a sticky bit); see decAddOp. */
+/* status is the status accumulator, as usual */
+/* */
+/* This routine applies rounding while keeping the length of the */
+/* coefficient constant. The exponent and status are unchanged */
+/* except if: */
+/* */
+/* -- the coefficient was increased and is all nines (in which */
+/* case Overflow could occur, and is handled directly here so */
+/* the caller does not need to re-test for overflow) */
+/* */
+/* -- the coefficient was decreased and becomes all nines (in which */
+/* case Underflow could occur, and is also handled directly). */
+/* */
+/* All fields in dn are updated as required. */
+/* */
+/* ------------------------------------------------------------------ */
+static void decApplyRound(decNumber *dn, decContext *set, Int residue,
+ uInt *status) {
+ Int bump; /* 1 if coefficient needs to be incremented */
+ /* -1 if coefficient needs to be decremented */
+
+ if (residue==0) return; /* nothing to apply */
+
+ bump=0; /* assume a smooth ride */
+
+ /* now decide whether, and how, to round, depending on mode */
+ switch (set->round) {
+ case DEC_ROUND_05UP: { /* round zero or five up (for reround) */
+ /* This is the same as DEC_ROUND_DOWN unless there is a */
+ /* positive residue and the lsd of dn is 0 or 5, in which case */
+ /* it is bumped; when residue is <0, the number is therefore */
+ /* bumped down unless the final digit was 1 or 6 (in which */
+ /* case it is bumped down and then up -- a no-op) */
+ Int lsd5=*dn->lsu%5; /* get lsd and quintate */
+ if (residue<0 && lsd5!=1) bump=-1;
+ else if (residue>0 && lsd5==0) bump=1;
+ /* [bump==1 could be applied directly; use common path for clarity] */
+ break;} /* r-05 */
+
+ case DEC_ROUND_DOWN: {
+ /* no change, except if negative residue */
+ if (residue<0) bump=-1;
+ break;} /* r-d */
+
+ case DEC_ROUND_HALF_DOWN: {
+ if (residue>5) bump=1;
+ break;} /* r-h-d */
+
+ case DEC_ROUND_HALF_EVEN: {
+ if (residue>5) bump=1; /* >0.5 goes up */
+ else if (residue==5) { /* exactly 0.5000... */
+ /* 0.5 goes up iff [new] lsd is odd */
+ if (*dn->lsu & 0x01) bump=1;
+ }
+ break;} /* r-h-e */
+
+ case DEC_ROUND_HALF_UP: {
+ if (residue>=5) bump=1;
+ break;} /* r-h-u */
+
+ case DEC_ROUND_UP: {
+ if (residue>0) bump=1;
+ break;} /* r-u */
+
+ case DEC_ROUND_CEILING: {
+ /* same as _UP for positive numbers, and as _DOWN for negatives */
+ /* [negative residue cannot occur on 0] */
+ if (decNumberIsNegative(dn)) {
+ if (residue<0) bump=-1;
+ }
+ else {
+ if (residue>0) bump=1;
+ }
+ break;} /* r-c */
+
+ case DEC_ROUND_FLOOR: {
+ /* same as _UP for negative numbers, and as _DOWN for positive */
+ /* [negative residue cannot occur on 0] */
+ if (!decNumberIsNegative(dn)) {
+ if (residue<0) bump=-1;
+ }
+ else {
+ if (residue>0) bump=1;
+ }
+ break;} /* r-f */
+
+ default: { /* e.g., DEC_ROUND_MAX */
+ *status|=DEC_Invalid_context;
+ #if DECTRACE || (DECCHECK && DECVERB)
+ printf("Unknown rounding mode: %d\n", set->round);
+ #endif
+ break;}
+ } /* switch */
+
+ /* now bump the number, up or down, if need be */
+ if (bump==0) return; /* no action required */
+
+ /* Simply use decUnitAddSub unless bumping up and the number is */
+ /* all nines. In this special case set to 100... explicitly */
+ /* and adjust the exponent by one (as otherwise could overflow */
+ /* the array) */
+ /* Similarly handle all-nines result if bumping down. */
+ if (bump>0) {
+ Unit *up; /* work */
+ uInt count=dn->digits; /* digits to be checked */
+ for (up=dn->lsu; ; up++) {
+ if (count<=DECDPUN) {
+ /* this is the last Unit (the msu) */
+ if (*up!=powers[count]-1) break; /* not still 9s */
+ /* here if it, too, is all nines */
+ *up=(Unit)powers[count-1]; /* here 999 -> 100 etc. */
+ for (up=up-1; up>=dn->lsu; up--) *up=0; /* others all to 0 */
+ dn->exponent++; /* and bump exponent */
+ /* [which, very rarely, could cause Overflow...] */
+ if ((dn->exponent+dn->digits)>set->emax+1) {
+ decSetOverflow(dn, set, status);
+ }
+ return; /* done */
+ }
+ /* a full unit to check, with more to come */
+ if (*up!=DECDPUNMAX) break; /* not still 9s */
+ count-=DECDPUN;
+ } /* up */
+ } /* bump>0 */
+ else { /* -1 */
+ /* here checking for a pre-bump of 1000... (leading 1, all */
+ /* other digits zero) */
+ Unit *up, *sup; /* work */
+ uInt count=dn->digits; /* digits to be checked */
+ for (up=dn->lsu; ; up++) {
+ if (count<=DECDPUN) {
+ /* this is the last Unit (the msu) */
+ if (*up!=powers[count-1]) break; /* not 100.. */
+ /* here if have the 1000... case */
+ sup=up; /* save msu pointer */
+ *up=(Unit)powers[count]-1; /* here 100 in msu -> 999 */
+ /* others all to all-nines, too */
+ for (up=up-1; up>=dn->lsu; up--) *up=(Unit)powers[DECDPUN]-1;
+ dn->exponent--; /* and bump exponent */
+
+ /* iff the number was at the subnormal boundary (exponent=etiny) */
+ /* then the exponent is now out of range, so it will in fact get */
+ /* clamped to etiny and the final 9 dropped. */
+ /* printf(">> emin=%d exp=%d sdig=%d\n", set->emin, */
+ /* dn->exponent, set->digits); */
+ if (dn->exponent+1==set->emin-set->digits+1) {
+ if (count==1 && dn->digits==1) *sup=0; /* here 9 -> 0[.9] */
+ else {
+ *sup=(Unit)powers[count-1]-1; /* here 999.. in msu -> 99.. */
+ dn->digits--;
+ }
+ dn->exponent++;
+ *status|=DEC_Underflow | DEC_Subnormal | DEC_Inexact | DEC_Rounded;
+ }
+ return; /* done */
+ }
+
+ /* a full unit to check, with more to come */
+ if (*up!=0) break; /* not still 0s */
+ count-=DECDPUN;
+ } /* up */
+
+ } /* bump<0 */
+
+ /* Actual bump needed. Do it. */
+ decUnitAddSub(dn->lsu, D2U(dn->digits), uarrone, 1, 0, dn->lsu, bump);
+ } /* decApplyRound */
+
+#if DECSUBSET
+/* ------------------------------------------------------------------ */
+/* decFinish -- finish processing a number */
+/* */
+/* dn is the number */
+/* set is the context */
+/* residue is the rounding accumulator (as in decApplyRound) */
+/* status is the accumulator */
+/* */
+/* This finishes off the current number by: */
+/* 1. If not extended: */
+/* a. Converting a zero result to clean '0' */
+/* b. Reducing positive exponents to 0, if would fit in digits */
+/* 2. Checking for overflow and subnormals (always) */
+/* Note this is just Finalize when no subset arithmetic. */
+/* All fields are updated as required. */
+/* ------------------------------------------------------------------ */
+static void decFinish(decNumber *dn, decContext *set, Int *residue,
+ uInt *status) {
+ if (!set->extended) {
+ if ISZERO(dn) { /* value is zero */
+ dn->exponent=0; /* clean exponent .. */
+ dn->bits=0; /* .. and sign */
+ return; /* no error possible */
+ }
+ if (dn->exponent>=0) { /* non-negative exponent */
+ /* >0; reduce to integer if possible */
+ if (set->digits >= (dn->exponent+dn->digits)) {
+ dn->digits=decShiftToMost(dn->lsu, dn->digits, dn->exponent);
+ dn->exponent=0;
+ }
+ }
+ } /* !extended */
+
+ decFinalize(dn, set, residue, status);
+ } /* decFinish */
+#endif
+
+/* ------------------------------------------------------------------ */
+/* decFinalize -- final check, clamp, and round of a number */
+/* */
+/* dn is the number */
+/* set is the context */
+/* residue is the rounding accumulator (as in decApplyRound) */
+/* status is the status accumulator */
+/* */
+/* This finishes off the current number by checking for subnormal */
+/* results, applying any pending rounding, checking for overflow, */
+/* and applying any clamping. */
+/* Underflow and overflow conditions are raised as appropriate. */
+/* All fields are updated as required. */
+/* ------------------------------------------------------------------ */
+static void decFinalize(decNumber *dn, decContext *set, Int *residue,
+ uInt *status) {
+ Int shift; /* shift needed if clamping */
+ Int tinyexp=set->emin-dn->digits+1; /* precalculate subnormal boundary */
+
+ /* Must be careful, here, when checking the exponent as the */
+ /* adjusted exponent could overflow 31 bits [because it may already */
+ /* be up to twice the expected]. */
+
+ /* First test for subnormal. This must be done before any final */
+ /* round as the result could be rounded to Nmin or 0. */
+ if (dn->exponent<=tinyexp) { /* prefilter */
+ Int comp;
+ decNumber nmin;
+ /* A very nasty case here is dn == Nmin and residue<0 */
+ if (dn->exponent<tinyexp) {
+ /* Go handle subnormals; this will apply round if needed. */
+ decSetSubnormal(dn, set, residue, status);
+ return;
+ }
+ /* Equals case: only subnormal if dn=Nmin and negative residue */
+ uprv_decNumberZero(&nmin);
+ nmin.lsu[0]=1;
+ nmin.exponent=set->emin;
+ comp=decCompare(dn, &nmin, 1); /* (signless compare) */
+ if (comp==BADINT) { /* oops */
+ *status|=DEC_Insufficient_storage; /* abandon... */
+ return;
+ }
+ if (*residue<0 && comp==0) { /* neg residue and dn==Nmin */
+ decApplyRound(dn, set, *residue, status); /* might force down */
+ decSetSubnormal(dn, set, residue, status);
+ return;
+ }
+ }
+
+ /* now apply any pending round (this could raise overflow). */
+ if (*residue!=0) decApplyRound(dn, set, *residue, status);
+
+ /* Check for overflow [redundant in the 'rare' case] or clamp */
+ if (dn->exponent<=set->emax-set->digits+1) return; /* neither needed */
+
+
+ /* here when might have an overflow or clamp to do */
+ if (dn->exponent>set->emax-dn->digits+1) { /* too big */
+ decSetOverflow(dn, set, status);
+ return;
+ }
+ /* here when the result is normal but in clamp range */
+ if (!set->clamp) return;
+
+ /* here when need to apply the IEEE exponent clamp (fold-down) */
+ shift=dn->exponent-(set->emax-set->digits+1);
+
+ /* shift coefficient (if non-zero) */
+ if (!ISZERO(dn)) {
+ dn->digits=decShiftToMost(dn->lsu, dn->digits, shift);
+ }
+ dn->exponent-=shift; /* adjust the exponent to match */
+ *status|=DEC_Clamped; /* and record the dirty deed */
+ return;
+ } /* decFinalize */
+
+/* ------------------------------------------------------------------ */
+/* decSetOverflow -- set number to proper overflow value */
+/* */
+/* dn is the number (used for sign [only] and result) */
+/* set is the context [used for the rounding mode, etc.] */
+/* status contains the current status to be updated */
+/* */
+/* This sets the sign of a number and sets its value to either */
+/* Infinity or the maximum finite value, depending on the sign of */
+/* dn and the rounding mode, following IEEE 754 rules. */
+/* ------------------------------------------------------------------ */
+static void decSetOverflow(decNumber *dn, decContext *set, uInt *status) {
+ Flag needmax=0; /* result is maximum finite value */
+ uByte sign=dn->bits&DECNEG; /* clean and save sign bit */
+
+ if (ISZERO(dn)) { /* zero does not overflow magnitude */
+ Int emax=set->emax; /* limit value */
+ if (set->clamp) emax-=set->digits-1; /* lower if clamping */
+ if (dn->exponent>emax) { /* clamp required */
+ dn->exponent=emax;
+ *status|=DEC_Clamped;
+ }
+ return;
+ }
+
+ uprv_decNumberZero(dn);
+ switch (set->round) {
+ case DEC_ROUND_DOWN: {
+ needmax=1; /* never Infinity */
+ break;} /* r-d */
+ case DEC_ROUND_05UP: {
+ needmax=1; /* never Infinity */
+ break;} /* r-05 */
+ case DEC_ROUND_CEILING: {
+ if (sign) needmax=1; /* Infinity if non-negative */
+ break;} /* r-c */
+ case DEC_ROUND_FLOOR: {
+ if (!sign) needmax=1; /* Infinity if negative */
+ break;} /* r-f */
+ default: break; /* Infinity in all other cases */
+ }
+ if (needmax) {
+ decSetMaxValue(dn, set);
+ dn->bits=sign; /* set sign */
+ }
+ else dn->bits=sign|DECINF; /* Value is +/-Infinity */
+ *status|=DEC_Overflow | DEC_Inexact | DEC_Rounded;
+ } /* decSetOverflow */
+
+/* ------------------------------------------------------------------ */
+/* decSetMaxValue -- set number to +Nmax (maximum normal value) */
+/* */
+/* dn is the number to set */
+/* set is the context [used for digits and emax] */
+/* */
+/* This sets the number to the maximum positive value. */
+/* ------------------------------------------------------------------ */
+static void decSetMaxValue(decNumber *dn, decContext *set) {
+ Unit *up; /* work */
+ Int count=set->digits; /* nines to add */
+ dn->digits=count;
+ /* fill in all nines to set maximum value */
+ for (up=dn->lsu; ; up++) {
+ if (count>DECDPUN) *up=DECDPUNMAX; /* unit full o'nines */
+ else { /* this is the msu */
+ *up=(Unit)(powers[count]-1);
+ break;
+ }
+ count-=DECDPUN; /* filled those digits */
+ } /* up */
+ dn->bits=0; /* + sign */
+ dn->exponent=set->emax-set->digits+1;
+ } /* decSetMaxValue */
+
+/* ------------------------------------------------------------------ */
+/* decSetSubnormal -- process value whose exponent is <Emin */
+/* */
+/* dn is the number (used as input as well as output; it may have */
+/* an allowed subnormal value, which may need to be rounded) */
+/* set is the context [used for the rounding mode] */
+/* residue is any pending residue */
+/* status contains the current status to be updated */
+/* */
+/* If subset mode, set result to zero and set Underflow flags. */
+/* */
+/* Value may be zero with a low exponent; this does not set Subnormal */
+/* but the exponent will be clamped to Etiny. */
+/* */
+/* Otherwise ensure exponent is not out of range, and round as */
+/* necessary. Underflow is set if the result is Inexact. */
+/* ------------------------------------------------------------------ */
+static void decSetSubnormal(decNumber *dn, decContext *set, Int *residue,
+ uInt *status) {
+ decContext workset; /* work */
+ Int etiny, adjust; /* .. */
+
+ #if DECSUBSET
+ /* simple set to zero and 'hard underflow' for subset */
+ if (!set->extended) {
+ uprv_decNumberZero(dn);
+ /* always full overflow */
+ *status|=DEC_Underflow | DEC_Subnormal | DEC_Inexact | DEC_Rounded;
+ return;
+ }
+ #endif
+
+ /* Full arithmetic -- allow subnormals, rounded to minimum exponent */
+ /* (Etiny) if needed */
+ etiny=set->emin-(set->digits-1); /* smallest allowed exponent */
+
+ if ISZERO(dn) { /* value is zero */
+ /* residue can never be non-zero here */
+ #if DECCHECK
+ if (*residue!=0) {
+ printf("++ Subnormal 0 residue %ld\n", (LI)*residue);
+ *status|=DEC_Invalid_operation;
+ }
+ #endif
+ if (dn->exponent<etiny) { /* clamp required */
+ dn->exponent=etiny;
+ *status|=DEC_Clamped;
+ }
+ return;
+ }
+
+ *status|=DEC_Subnormal; /* have a non-zero subnormal */
+ adjust=etiny-dn->exponent; /* calculate digits to remove */
+ if (adjust<=0) { /* not out of range; unrounded */
+ /* residue can never be non-zero here, except in the Nmin-residue */
+ /* case (which is a subnormal result), so can take fast-path here */
+ /* it may already be inexact (from setting the coefficient) */
+ if (*status&DEC_Inexact) *status|=DEC_Underflow;
+ return;
+ }
+
+ /* adjust>0, so need to rescale the result so exponent becomes Etiny */
+ /* [this code is similar to that in rescale] */
+ workset=*set; /* clone rounding, etc. */
+ workset.digits=dn->digits-adjust; /* set requested length */
+ workset.emin-=adjust; /* and adjust emin to match */
+ /* [note that the latter can be <1, here, similar to Rescale case] */
+ decSetCoeff(dn, &workset, dn->lsu, dn->digits, residue, status);
+ decApplyRound(dn, &workset, *residue, status);
+
+ /* Use 754 default rule: Underflow is set iff Inexact */
+ /* [independent of whether trapped] */
+ if (*status&DEC_Inexact) *status|=DEC_Underflow;
+
+ /* if rounded up a 999s case, exponent will be off by one; adjust */
+ /* back if so [it will fit, because it was shortened earlier] */
+ if (dn->exponent>etiny) {
+ dn->digits=decShiftToMost(dn->lsu, dn->digits, 1);
+ dn->exponent--; /* (re)adjust the exponent. */
+ }
+
+ /* if rounded to zero, it is by definition clamped... */
+ if (ISZERO(dn)) *status|=DEC_Clamped;
+ } /* decSetSubnormal */
+
+/* ------------------------------------------------------------------ */
+/* decCheckMath - check entry conditions for a math function */
+/* */
+/* This checks the context and the operand */
+/* */
+/* rhs is the operand to check */
+/* set is the context to check */
+/* status is unchanged if both are good */
+/* */
+/* returns non-zero if status is changed, 0 otherwise */
+/* */
+/* Restrictions enforced: */
+/* */
+/* digits, emax, and -emin in the context must be less than */
+/* DEC_MAX_MATH (999999), and A must be within these bounds if */
+/* non-zero. Invalid_operation is set in the status if a */
+/* restriction is violated. */
+/* ------------------------------------------------------------------ */
+static uInt decCheckMath(const decNumber *rhs, decContext *set,
+ uInt *status) {
+ uInt save=*status; /* record */
+ if (set->digits>DEC_MAX_MATH
+ || set->emax>DEC_MAX_MATH
+ || -set->emin>DEC_MAX_MATH) *status|=DEC_Invalid_context;
+ else if ((rhs->digits>DEC_MAX_MATH
+ || rhs->exponent+rhs->digits>DEC_MAX_MATH+1
+ || rhs->exponent+rhs->digits<2*(1-DEC_MAX_MATH))
+ && !ISZERO(rhs)) *status|=DEC_Invalid_operation;
+ return (*status!=save);
+ } /* decCheckMath */
+
+/* ------------------------------------------------------------------ */
+/* decGetInt -- get integer from a number */
+/* */
+/* dn is the number [which will not be altered] */
+/* */
+/* returns one of: */
+/* BADINT if there is a non-zero fraction */
+/* the converted integer */
+/* BIGEVEN if the integer is even and magnitude > 2*10**9 */
+/* BIGODD if the integer is odd and magnitude > 2*10**9 */
+/* */
+/* This checks and gets a whole number from the input decNumber. */
+/* The sign can be determined from dn by the caller when BIGEVEN or */
+/* BIGODD is returned. */
+/* ------------------------------------------------------------------ */
+static Int decGetInt(const decNumber *dn) {
+ Int theInt; /* result accumulator */
+ const Unit *up; /* work */
+ Int got; /* digits (real or not) processed */
+ Int ilength=dn->digits+dn->exponent; /* integral length */
+ Flag neg=decNumberIsNegative(dn); /* 1 if -ve */
+
+ /* The number must be an integer that fits in 10 digits */
+ /* Assert, here, that 10 is enough for any rescale Etiny */
+ #if DEC_MAX_EMAX > 999999999
+ #error GetInt may need updating [for Emax]
+ #endif
+ #if DEC_MIN_EMIN < -999999999
+ #error GetInt may need updating [for Emin]
+ #endif
+ if (ISZERO(dn)) return 0; /* zeros are OK, with any exponent */
+
+ up=dn->lsu; /* ready for lsu */
+ theInt=0; /* ready to accumulate */
+ if (dn->exponent>=0) { /* relatively easy */
+ /* no fractional part [usual]; allow for positive exponent */
+ got=dn->exponent;
+ }
+ else { /* -ve exponent; some fractional part to check and discard */
+ Int count=-dn->exponent; /* digits to discard */
+ /* spin up whole units until reach the Unit with the unit digit */
+ for (; count>=DECDPUN; up++) {
+ if (*up!=0) return BADINT; /* non-zero Unit to discard */
+ count-=DECDPUN;
+ }
+ if (count==0) got=0; /* [a multiple of DECDPUN] */
+ else { /* [not multiple of DECDPUN] */
+ Int rem; /* work */
+ /* slice off fraction digits and check for non-zero */
+ #if DECDPUN<=4
+ theInt=QUOT10(*up, count);
+ rem=*up-theInt*powers[count];
+ #else
+ rem=*up%powers[count]; /* slice off discards */
+ theInt=*up/powers[count];
+ #endif
+ if (rem!=0) return BADINT; /* non-zero fraction */
+ /* it looks good */
+ got=DECDPUN-count; /* number of digits so far */
+ up++; /* ready for next */
+ }
+ }
+ /* now it's known there's no fractional part */
+
+ /* tricky code now, to accumulate up to 9.3 digits */
+ if (got==0) {theInt=*up; got+=DECDPUN; up++;} /* ensure lsu is there */
+
+ if (ilength<11) {
+ Int save=theInt;
+ /* collect any remaining unit(s) */
+ for (; got<ilength; up++) {
+ theInt+=*up*powers[got];
+ got+=DECDPUN;
+ }
+ if (ilength==10) { /* need to check for wrap */
+ if (theInt/(Int)powers[got-DECDPUN]!=(Int)*(up-1)) ilength=11;
+ /* [that test also disallows the BADINT result case] */
+ else if (neg && theInt>1999999997) ilength=11;
+ else if (!neg && theInt>999999999) ilength=11;
+ if (ilength==11) theInt=save; /* restore correct low bit */
+ }
+ }
+
+ if (ilength>10) { /* too big */
+ if (theInt&1) return BIGODD; /* bottom bit 1 */
+ return BIGEVEN; /* bottom bit 0 */
+ }
+
+ if (neg) theInt=-theInt; /* apply sign */
+ return theInt;
+ } /* decGetInt */
+
+/* ------------------------------------------------------------------ */
+/* decDecap -- decapitate the coefficient of a number */
+/* */
+/* dn is the number to be decapitated */
+/* drop is the number of digits to be removed from the left of dn; */
+/* this must be <= dn->digits (if equal, the coefficient is */
+/* set to 0) */
+/* */
+/* Returns dn; dn->digits will be <= the initial digits less drop */
+/* (after removing drop digits there may be leading zero digits */
+/* which will also be removed). Only dn->lsu and dn->digits change. */
+/* ------------------------------------------------------------------ */
+static decNumber *decDecap(decNumber *dn, Int drop) {
+ Unit *msu; /* -> target cut point */
+ Int cut; /* work */
+ if (drop>=dn->digits) { /* losing the whole thing */
+ #if DECCHECK
+ if (drop>dn->digits)
+ printf("decDecap called with drop>digits [%ld>%ld]\n",
+ (LI)drop, (LI)dn->digits);
+ #endif
+ dn->lsu[0]=0;
+ dn->digits=1;
+ return dn;
+ }
+ msu=dn->lsu+D2U(dn->digits-drop)-1; /* -> likely msu */
+ cut=MSUDIGITS(dn->digits-drop); /* digits to be in use in msu */
+ if (cut!=DECDPUN) *msu%=powers[cut]; /* clear left digits */
+ /* that may have left leading zero digits, so do a proper count... */
+ dn->digits=decGetDigits(dn->lsu, static_cast<int32_t>(msu-dn->lsu+1));
+ return dn;
+ } /* decDecap */
+
+/* ------------------------------------------------------------------ */
+/* decBiStr -- compare string with pairwise options */
+/* */
+/* targ is the string to compare */
+/* str1 is one of the strings to compare against (length may be 0) */
+/* str2 is the other; it must be the same length as str1 */
+/* */
+/* returns 1 if strings compare equal, (that is, it is the same */
+/* length as str1 and str2, and each character of targ is in either */
+/* str1 or str2 in the corresponding position), or 0 otherwise */
+/* */
+/* This is used for generic caseless compare, including the awkward */
+/* case of the Turkish dotted and dotless Is. Use as (for example): */
+/* if (decBiStr(test, "mike", "MIKE")) ... */
+/* ------------------------------------------------------------------ */
+static Flag decBiStr(const char *targ, const char *str1, const char *str2) {
+ for (;;targ++, str1++, str2++) {
+ if (*targ!=*str1 && *targ!=*str2) return 0;
+ /* *targ has a match in one (or both, if terminator) */
+ if (*targ=='\0') break;
+ } /* forever */
+ return 1;
+ } /* decBiStr */
+
+/* ------------------------------------------------------------------ */
+/* decNaNs -- handle NaN operand or operands */
+/* */
+/* res is the result number */
+/* lhs is the first operand */
+/* rhs is the second operand, or NULL if none */
+/* context is used to limit payload length */
+/* status contains the current status */
+/* returns res in case convenient */
+/* */
+/* Called when one or both operands is a NaN, and propagates the */
+/* appropriate result to res. When an sNaN is found, it is changed */
+/* to a qNaN and Invalid operation is set. */
+/* ------------------------------------------------------------------ */
+static decNumber * decNaNs(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set,
+ uInt *status) {
+ /* This decision tree ends up with LHS being the source pointer, */
+ /* and status updated if need be */
+ if (lhs->bits & DECSNAN)
+ *status|=DEC_Invalid_operation | DEC_sNaN;
+ else if (rhs==NULL);
+ else if (rhs->bits & DECSNAN) {
+ lhs=rhs;
+ *status|=DEC_Invalid_operation | DEC_sNaN;
+ }
+ else if (lhs->bits & DECNAN);
+ else lhs=rhs;
+
+ /* propagate the payload */
+ if (lhs->digits<=set->digits) uprv_decNumberCopy(res, lhs); /* easy */
+ else { /* too long */
+ const Unit *ul;
+ Unit *ur, *uresp1;
+ /* copy safe number of units, then decapitate */
+ res->bits=lhs->bits; /* need sign etc. */
+ uresp1=res->lsu+D2U(set->digits);
+ for (ur=res->lsu, ul=lhs->lsu; ur<uresp1; ur++, ul++) *ur=*ul;
+ res->digits=D2U(set->digits)*DECDPUN;
+ /* maybe still too long */
+ if (res->digits>set->digits) decDecap(res, res->digits-set->digits);
+ }
+
+ res->bits&=~DECSNAN; /* convert any sNaN to NaN, while */
+ res->bits|=DECNAN; /* .. preserving sign */
+ res->exponent=0; /* clean exponent */
+ /* [coefficient was copied/decapitated] */
+ return res;
+ } /* decNaNs */
+
+/* ------------------------------------------------------------------ */
+/* decStatus -- apply non-zero status */
+/* */
+/* dn is the number to set if error */
+/* status contains the current status (not yet in context) */
+/* set is the context */
+/* */
+/* If the status is an error status, the number is set to a NaN, */
+/* unless the error was an overflow, divide-by-zero, or underflow, */
+/* in which case the number will have already been set. */
+/* */
+/* The context status is then updated with the new status. Note that */
+/* this may raise a signal, so control may never return from this */
+/* routine (hence resources must be recovered before it is called). */
+/* ------------------------------------------------------------------ */
+static void decStatus(decNumber *dn, uInt status, decContext *set) {
+ if (status & DEC_NaNs) { /* error status -> NaN */
+ /* if cause was an sNaN, clear and propagate [NaN is already set up] */
+ if (status & DEC_sNaN) status&=~DEC_sNaN;
+ else {
+ uprv_decNumberZero(dn); /* other error: clean throughout */
+ dn->bits=DECNAN; /* and make a quiet NaN */
+ }
+ }
+ uprv_decContextSetStatus(set, status); /* [may not return] */
+ return;
+ } /* decStatus */
+
+/* ------------------------------------------------------------------ */
+/* decGetDigits -- count digits in a Units array */
+/* */
+/* uar is the Unit array holding the number (this is often an */
+/* accumulator of some sort) */
+/* len is the length of the array in units [>=1] */
+/* */
+/* returns the number of (significant) digits in the array */
+/* */
+/* All leading zeros are excluded, except the last if the array has */
+/* only zero Units. */
+/* ------------------------------------------------------------------ */
+/* This may be called twice during some operations. */
+static Int decGetDigits(Unit *uar, Int len) {
+ Unit *up=uar+(len-1); /* -> msu */
+ Int digits=(len-1)*DECDPUN+1; /* possible digits excluding msu */
+ #if DECDPUN>4
+ uInt const *pow; /* work */
+ #endif
+ /* (at least 1 in final msu) */
+ #if DECCHECK
+ if (len<1) printf("decGetDigits called with len<1 [%ld]\n", (LI)len);
+ #endif
+
+ for (; up>=uar; up--) {
+ if (*up==0) { /* unit is all 0s */
+ if (digits==1) break; /* a zero has one digit */
+ digits-=DECDPUN; /* adjust for 0 unit */
+ continue;}
+ /* found the first (most significant) non-zero Unit */
+ #if DECDPUN>1 /* not done yet */
+ if (*up<10) break; /* is 1-9 */
+ digits++;
+ #if DECDPUN>2 /* not done yet */
+ if (*up<100) break; /* is 10-99 */
+ digits++;
+ #if DECDPUN>3 /* not done yet */
+ if (*up<1000) break; /* is 100-999 */
+ digits++;
+ #if DECDPUN>4 /* count the rest ... */
+ for (pow=&powers[4]; *up>=*pow; pow++) digits++;
+ #endif
+ #endif
+ #endif
+ #endif
+ break;
+ } /* up */
+ return digits;
+ } /* decGetDigits */
+
+#if DECTRACE | DECCHECK
+/* ------------------------------------------------------------------ */
+/* decNumberShow -- display a number [debug aid] */
+/* dn is the number to show */
+/* */
+/* Shows: sign, exponent, coefficient (msu first), digits */
+/* or: sign, special-value */
+/* ------------------------------------------------------------------ */
+/* this is public so other modules can use it */
+void uprv_decNumberShow(const decNumber *dn) {
+ const Unit *up; /* work */
+ uInt u, d; /* .. */
+ Int cut; /* .. */
+ char isign='+'; /* main sign */
+ if (dn==NULL) {
+ printf("NULL\n");
+ return;}
+ if (decNumberIsNegative(dn)) isign='-';
+ printf(" >> %c ", isign);
+ if (dn->bits&DECSPECIAL) { /* Is a special value */
+ if (decNumberIsInfinite(dn)) printf("Infinity");
+ else { /* a NaN */
+ if (dn->bits&DECSNAN) printf("sNaN"); /* signalling NaN */
+ else printf("NaN");
+ }
+ /* if coefficient and exponent are 0, no more to do */
+ if (dn->exponent==0 && dn->digits==1 && *dn->lsu==0) {
+ printf("\n");
+ return;}
+ /* drop through to report other information */
+ printf(" ");
+ }
+
+ /* now carefully display the coefficient */
+ up=dn->lsu+D2U(dn->digits)-1; /* msu */
+ printf("%ld", (LI)*up);
+ for (up=up-1; up>=dn->lsu; up--) {
+ u=*up;
+ printf(":");
+ for (cut=DECDPUN-1; cut>=0; cut--) {
+ d=u/powers[cut];
+ u-=d*powers[cut];
+ printf("%ld", (LI)d);
+ } /* cut */
+ } /* up */
+ if (dn->exponent!=0) {
+ char esign='+';
+ if (dn->exponent<0) esign='-';
+ printf(" E%c%ld", esign, (LI)abs(dn->exponent));
+ }
+ printf(" [%ld]\n", (LI)dn->digits);
+ } /* decNumberShow */
+#endif
+
+#if DECTRACE || DECCHECK
+/* ------------------------------------------------------------------ */
+/* decDumpAr -- display a unit array [debug/check aid] */
+/* name is a single-character tag name */
+/* ar is the array to display */
+/* len is the length of the array in Units */
+/* ------------------------------------------------------------------ */
+static void decDumpAr(char name, const Unit *ar, Int len) {
+ Int i;
+ const char *spec;
+ #if DECDPUN==9
+ spec="%09d ";
+ #elif DECDPUN==8
+ spec="%08d ";
+ #elif DECDPUN==7
+ spec="%07d ";
+ #elif DECDPUN==6
+ spec="%06d ";
+ #elif DECDPUN==5
+ spec="%05d ";
+ #elif DECDPUN==4
+ spec="%04d ";
+ #elif DECDPUN==3
+ spec="%03d ";
+ #elif DECDPUN==2
+ spec="%02d ";
+ #else
+ spec="%d ";
+ #endif
+ printf(" :%c: ", name);
+ for (i=len-1; i>=0; i--) {
+ if (i==len-1) printf("%ld ", (LI)ar[i]);
+ else printf(spec, ar[i]);
+ }
+ printf("\n");
+ return;}
+#endif
+
+#if DECCHECK
+/* ------------------------------------------------------------------ */
+/* decCheckOperands -- check operand(s) to a routine */
+/* res is the result structure (not checked; it will be set to */
+/* quiet NaN if error found (and it is not NULL)) */
+/* lhs is the first operand (may be DECUNRESU) */
+/* rhs is the second (may be DECUNUSED) */
+/* set is the context (may be DECUNCONT) */
+/* returns 0 if both operands, and the context are clean, or 1 */
+/* otherwise (in which case the context will show an error, */
+/* unless NULL). Note that res is not cleaned; caller should */
+/* handle this so res=NULL case is safe. */
+/* The caller is expected to abandon immediately if 1 is returned. */
+/* ------------------------------------------------------------------ */
+static Flag decCheckOperands(decNumber *res, const decNumber *lhs,
+ const decNumber *rhs, decContext *set) {
+ Flag bad=0;
+ if (set==NULL) { /* oops; hopeless */
+ #if DECTRACE || DECVERB
+ printf("Reference to context is NULL.\n");
+ #endif
+ bad=1;
+ return 1;}
+ else if (set!=DECUNCONT
+ && (set->digits<1 || set->round>=DEC_ROUND_MAX)) {
+ bad=1;
+ #if DECTRACE || DECVERB
+ printf("Bad context [digits=%ld round=%ld].\n",
+ (LI)set->digits, (LI)set->round);
+ #endif
+ }
+ else {
+ if (res==NULL) {
+ bad=1;
+ #if DECTRACE
+ /* this one not DECVERB as standard tests include NULL */
+ printf("Reference to result is NULL.\n");
+ #endif
+ }
+ if (!bad && lhs!=DECUNUSED) bad=(decCheckNumber(lhs));
+ if (!bad && rhs!=DECUNUSED) bad=(decCheckNumber(rhs));
+ }
+ if (bad) {
+ if (set!=DECUNCONT) uprv_decContextSetStatus(set, DEC_Invalid_operation);
+ if (res!=DECUNRESU && res!=NULL) {
+ uprv_decNumberZero(res);
+ res->bits=DECNAN; /* qNaN */
+ }
+ }
+ return bad;
+ } /* decCheckOperands */
+
+/* ------------------------------------------------------------------ */
+/* decCheckNumber -- check a number */
+/* dn is the number to check */
+/* returns 0 if the number is clean, or 1 otherwise */
+/* */
+/* The number is considered valid if it could be a result from some */
+/* operation in some valid context. */
+/* ------------------------------------------------------------------ */
+static Flag decCheckNumber(const decNumber *dn) {
+ const Unit *up; /* work */
+ uInt maxuint; /* .. */
+ Int ae, d, digits; /* .. */
+ Int emin, emax; /* .. */
+
+ if (dn==NULL) { /* hopeless */
+ #if DECTRACE
+ /* this one not DECVERB as standard tests include NULL */
+ printf("Reference to decNumber is NULL.\n");
+ #endif
+ return 1;}
+
+ /* check special values */
+ if (dn->bits & DECSPECIAL) {
+ if (dn->exponent!=0) {
+ #if DECTRACE || DECVERB
+ printf("Exponent %ld (not 0) for a special value [%02x].\n",
+ (LI)dn->exponent, dn->bits);
+ #endif
+ return 1;}
+
+ /* 2003.09.08: NaNs may now have coefficients, so next tests Inf only */
+ if (decNumberIsInfinite(dn)) {
+ if (dn->digits!=1) {
+ #if DECTRACE || DECVERB
+ printf("Digits %ld (not 1) for an infinity.\n", (LI)dn->digits);
+ #endif
+ return 1;}
+ if (*dn->lsu!=0) {
+ #if DECTRACE || DECVERB
+ printf("LSU %ld (not 0) for an infinity.\n", (LI)*dn->lsu);
+ #endif
+ decDumpAr('I', dn->lsu, D2U(dn->digits));
+ return 1;}
+ } /* Inf */
+ /* 2002.12.26: negative NaNs can now appear through proposed IEEE */
+ /* concrete formats (decimal64, etc.). */
+ return 0;
+ }
+
+ /* check the coefficient */
+ if (dn->digits<1 || dn->digits>DECNUMMAXP) {
+ #if DECTRACE || DECVERB
+ printf("Digits %ld in number.\n", (LI)dn->digits);
+ #endif
+ return 1;}
+
+ d=dn->digits;
+
+ for (up=dn->lsu; d>0; up++) {
+ if (d>DECDPUN) maxuint=DECDPUNMAX;
+ else { /* reached the msu */
+ maxuint=powers[d]-1;
+ if (dn->digits>1 && *up<powers[d-1]) {
+ #if DECTRACE || DECVERB
+ printf("Leading 0 in number.\n");
+ uprv_decNumberShow(dn);
+ #endif
+ return 1;}
+ }
+ if (*up>maxuint) {
+ #if DECTRACE || DECVERB
+ printf("Bad Unit [%08lx] in %ld-digit number at offset %ld [maxuint %ld].\n",
+ (LI)*up, (LI)dn->digits, (LI)(up-dn->lsu), (LI)maxuint);
+ #endif
+ return 1;}
+ d-=DECDPUN;
+ }
+
+ /* check the exponent. Note that input operands can have exponents */
+ /* which are out of the set->emin/set->emax and set->digits range */
+ /* (just as they can have more digits than set->digits). */
+ ae=dn->exponent+dn->digits-1; /* adjusted exponent */
+ emax=DECNUMMAXE;
+ emin=DECNUMMINE;
+ digits=DECNUMMAXP;
+ if (ae<emin-(digits-1)) {
+ #if DECTRACE || DECVERB
+ printf("Adjusted exponent underflow [%ld].\n", (LI)ae);
+ uprv_decNumberShow(dn);
+ #endif
+ return 1;}
+ if (ae>+emax) {
+ #if DECTRACE || DECVERB
+ printf("Adjusted exponent overflow [%ld].\n", (LI)ae);
+ uprv_decNumberShow(dn);
+ #endif
+ return 1;}
+
+ return 0; /* it's OK */
+ } /* decCheckNumber */
+
+/* ------------------------------------------------------------------ */
+/* decCheckInexact -- check a normal finite inexact result has digits */
+/* dn is the number to check */
+/* set is the context (for status and precision) */
+/* sets Invalid operation, etc., if some digits are missing */
+/* [this check is not made for DECSUBSET compilation or when */
+/* subnormal is not set] */
+/* ------------------------------------------------------------------ */
+static void decCheckInexact(const decNumber *dn, decContext *set) {
+ #if !DECSUBSET && DECEXTFLAG
+ if ((set->status & (DEC_Inexact|DEC_Subnormal))==DEC_Inexact
+ && (set->digits!=dn->digits) && !(dn->bits & DECSPECIAL)) {
+ #if DECTRACE || DECVERB
+ printf("Insufficient digits [%ld] on normal Inexact result.\n",
+ (LI)dn->digits);
+ uprv_decNumberShow(dn);
+ #endif
+ uprv_decContextSetStatus(set, DEC_Invalid_operation);
+ }
+ #else
+ /* next is a noop for quiet compiler */
+ if (dn!=NULL && dn->digits==0) set->status|=DEC_Invalid_operation;
+ #endif
+ return;
+ } /* decCheckInexact */
+#endif
+
+#if DECALLOC
+#undef malloc
+#undef free
+/* ------------------------------------------------------------------ */
+/* decMalloc -- accountable allocation routine */
+/* n is the number of bytes to allocate */
+/* */
+/* Semantics is the same as the stdlib malloc routine, but bytes */
+/* allocated are accounted for globally, and corruption fences are */
+/* added before and after the 'actual' storage. */
+/* ------------------------------------------------------------------ */
+/* This routine allocates storage with an extra twelve bytes; 8 are */
+/* at the start and hold: */
+/* 0-3 the original length requested */
+/* 4-7 buffer corruption detection fence (DECFENCE, x4) */
+/* The 4 bytes at the end also hold a corruption fence (DECFENCE, x4) */
+/* ------------------------------------------------------------------ */
+static void *decMalloc(size_t n) {
+ uInt size=n+12; /* true size */
+ void *alloc; /* -> allocated storage */
+ uByte *b, *b0; /* work */
+ uInt uiwork; /* for macros */
+
+ alloc=malloc(size); /* -> allocated storage */
+ if (alloc==NULL) return NULL; /* out of strorage */
+ b0=(uByte *)alloc; /* as bytes */
+ decAllocBytes+=n; /* account for storage */
+ UBFROMUI(alloc, n); /* save n */
+ /* printf(" alloc ++ dAB: %ld (%ld)\n", (LI)decAllocBytes, (LI)n); */
+ for (b=b0+4; b<b0+8; b++) *b=DECFENCE;
+ for (b=b0+n+8; b<b0+n+12; b++) *b=DECFENCE;
+ return b0+8; /* -> play area */
+ } /* decMalloc */
+
+/* ------------------------------------------------------------------ */
+/* decFree -- accountable free routine */
+/* alloc is the storage to free */
+/* */
+/* Semantics is the same as the stdlib malloc routine, except that */
+/* the global storage accounting is updated and the fences are */
+/* checked to ensure that no routine has written 'out of bounds'. */
+/* ------------------------------------------------------------------ */
+/* This routine first checks that the fences have not been corrupted. */
+/* It then frees the storage using the 'truw' storage address (that */
+/* is, offset by 8). */
+/* ------------------------------------------------------------------ */
+static void decFree(void *alloc) {
+ uInt n; /* original length */
+ uByte *b, *b0; /* work */
+ uInt uiwork; /* for macros */
+
+ if (alloc==NULL) return; /* allowed; it's a nop */
+ b0=(uByte *)alloc; /* as bytes */
+ b0-=8; /* -> true start of storage */
+ n=UBTOUI(b0); /* lift length */
+ for (b=b0+4; b<b0+8; b++) if (*b!=DECFENCE)
+ printf("=== Corrupt byte [%02x] at offset %d from %ld ===\n", *b,
+ b-b0-8, (LI)b0);
+ for (b=b0+n+8; b<b0+n+12; b++) if (*b!=DECFENCE)
+ printf("=== Corrupt byte [%02x] at offset +%d from %ld, n=%ld ===\n", *b,
+ b-b0-8, (LI)b0, (LI)n);
+ free(b0); /* drop the storage */
+ decAllocBytes-=n; /* account for storage */
+ /* printf(" free -- dAB: %d (%d)\n", decAllocBytes, -n); */
+ } /* decFree */
+#define malloc(a) decMalloc(a)
+#define free(a) decFree(a)
+#endif
diff --git a/contrib/libs/icu/i18n/decNumber.h b/contrib/libs/icu/i18n/decNumber.h
index e23dc438fc..7182e789e5 100644
--- a/contrib/libs/icu/i18n/decNumber.h
+++ b/contrib/libs/icu/i18n/decNumber.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/* ------------------------------------------------------------------ */
/* Decimal Number arithmetic module header */
diff --git a/contrib/libs/icu/i18n/decNumberLocal.h b/contrib/libs/icu/i18n/decNumberLocal.h
index 9a0f56a81e..e8d1b38653 100644
--- a/contrib/libs/icu/i18n/decNumberLocal.h
+++ b/contrib/libs/icu/i18n/decNumberLocal.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/* ------------------------------------------------------------------ */
/* decNumber package local type, tuning, and macro definitions */
@@ -166,9 +166,9 @@
/* Set DECDPUNMAX -- the maximum integer that fits in DECDPUN */
/* digits, and D2UTABLE -- the initializer for the D2U table */
- #ifndef DECDPUN
- // no-op
- #elif DECDPUN==1
+ #ifndef DECDPUN
+ // no-op
+ #elif DECDPUN==1
#define DECDPUNMAX 9
#define D2UTABLE {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,26,27,28,29,30,31,32, \
@@ -214,7 +214,7 @@
#define D2UTABLE {0,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,3,3,3, \
3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5, \
5,5,6,6,6,6}
- #else
+ #else
#error DECDPUN must be in the range 1-9
#endif
@@ -230,9 +230,9 @@
/* D2U -- return the number of Units needed to hold d digits */
/* (runtime version, with table lookaside for small d) */
- #if defined(DECDPUN) && DECDPUN==8
+ #if defined(DECDPUN) && DECDPUN==8
#define D2U(d) ((unsigned)((d)<=DECMAXD2U?d2utable[d]:((d)+7)>>3))
- #elif defined(DECDPUN) && DECDPUN==4
+ #elif defined(DECDPUN) && DECDPUN==4
#define D2U(d) ((unsigned)((d)<=DECMAXD2U?d2utable[d]:((d)+3)>>2))
#else
#define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
@@ -259,7 +259,7 @@
/* 2,000,000,000 (as is needed for negative exponents of */
/* subnormals). The unsigned integer pow is used as a temporary */
/* variable. */
- #define TODIGIT(u, cut, c, pow) UPRV_BLOCK_MACRO_BEGIN { \
+ #define TODIGIT(u, cut, c, pow) UPRV_BLOCK_MACRO_BEGIN { \
*(c)='0'; \
pow=DECPOWERS[cut]*2; \
if ((u)>pow) { \
@@ -272,7 +272,7 @@
if ((u)>=pow) {(u)-=pow; *(c)+=2;} \
pow/=2; \
if ((u)>=pow) {(u)-=pow; *(c)+=1;} \
- } UPRV_BLOCK_MACRO_END
+ } UPRV_BLOCK_MACRO_END
/* ---------------------------------------------------------------- */
/* Definitions for fixed-precision modules (only valid after */
diff --git a/contrib/libs/icu/i18n/decimfmt.cpp b/contrib/libs/icu/i18n/decimfmt.cpp
index 8ac9041c2c..daa1129a6a 100644
--- a/contrib/libs/icu/i18n/decimfmt.cpp
+++ b/contrib/libs/icu/i18n/decimfmt.cpp
@@ -1,1879 +1,1879 @@
-// © 2018 and later: Unicode, Inc. and others.
+// © 2018 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include <cmath>
-#include <cstdlib>
-#include <stdlib.h>
-#include "unicode/errorcode.h"
-#include "unicode/decimfmt.h"
-#include "number_decimalquantity.h"
-#include "number_types.h"
-#include "numparse_impl.h"
-#include "number_mapper.h"
-#include "number_patternstring.h"
-#include "putilimp.h"
-#include "number_utils.h"
-#include "number_utypes.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-using namespace icu::numparse;
-using namespace icu::numparse::impl;
-using ERoundingMode = icu::DecimalFormat::ERoundingMode;
-using EPadPosition = icu::DecimalFormat::EPadPosition;
-
-// MSVC VS2015 warns C4805 when comparing bool with UBool, VS2017 no longer emits this warning.
-// TODO: Move this macro into a better place?
-#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
-#define UBOOL_TO_BOOL(b) static_cast<bool>(b)
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include <cmath>
+#include <cstdlib>
+#include <stdlib.h>
+#include "unicode/errorcode.h"
+#include "unicode/decimfmt.h"
+#include "number_decimalquantity.h"
+#include "number_types.h"
+#include "numparse_impl.h"
+#include "number_mapper.h"
+#include "number_patternstring.h"
+#include "putilimp.h"
+#include "number_utils.h"
+#include "number_utypes.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+using namespace icu::numparse;
+using namespace icu::numparse::impl;
+using ERoundingMode = icu::DecimalFormat::ERoundingMode;
+using EPadPosition = icu::DecimalFormat::EPadPosition;
+
+// MSVC VS2015 warns C4805 when comparing bool with UBool, VS2017 no longer emits this warning.
+// TODO: Move this macro into a better place?
+#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
+#define UBOOL_TO_BOOL(b) static_cast<bool>(b)
#else
-#define UBOOL_TO_BOOL(b) b
+#define UBOOL_TO_BOOL(b) b
#endif
-UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DecimalFormat)
-
-
-DecimalFormat::DecimalFormat(UErrorCode& status)
- : DecimalFormat(nullptr, status) {
- if (U_FAILURE(status)) { return; }
- // Use the default locale and decimal pattern.
- const char* localeName = Locale::getDefault().getName();
- LocalPointer<NumberingSystem> ns(NumberingSystem::createInstance(status));
- UnicodeString patternString = utils::getPatternForStyle(
- localeName,
- ns->getName(),
- CLDR_PATTERN_STYLE_DECIMAL,
- status);
- setPropertiesFromPattern(patternString, IGNORE_ROUNDING_IF_CURRENCY, status);
- touch(status);
-}
-
-DecimalFormat::DecimalFormat(const UnicodeString& pattern, UErrorCode& status)
- : DecimalFormat(nullptr, status) {
- if (U_FAILURE(status)) { return; }
- setPropertiesFromPattern(pattern, IGNORE_ROUNDING_IF_CURRENCY, status);
- touch(status);
-}
-
-DecimalFormat::DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt,
- UErrorCode& status)
- : DecimalFormat(symbolsToAdopt, status) {
- if (U_FAILURE(status)) { return; }
- setPropertiesFromPattern(pattern, IGNORE_ROUNDING_IF_CURRENCY, status);
- touch(status);
-}
-
-DecimalFormat::DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt,
- UNumberFormatStyle style, UErrorCode& status)
- : DecimalFormat(symbolsToAdopt, status) {
- if (U_FAILURE(status)) { return; }
- // If choice is a currency type, ignore the rounding information.
- if (style == UNumberFormatStyle::UNUM_CURRENCY ||
- style == UNumberFormatStyle::UNUM_CURRENCY_ISO ||
- style == UNumberFormatStyle::UNUM_CURRENCY_ACCOUNTING ||
- style == UNumberFormatStyle::UNUM_CASH_CURRENCY ||
- style == UNumberFormatStyle::UNUM_CURRENCY_STANDARD ||
- style == UNumberFormatStyle::UNUM_CURRENCY_PLURAL) {
- setPropertiesFromPattern(pattern, IGNORE_ROUNDING_ALWAYS, status);
- } else {
- setPropertiesFromPattern(pattern, IGNORE_ROUNDING_IF_CURRENCY, status);
- }
- // Note: in Java, CurrencyPluralInfo is set in NumberFormat.java, but in C++, it is not set there,
- // so we have to set it here.
- if (style == UNumberFormatStyle::UNUM_CURRENCY_PLURAL) {
- LocalPointer<CurrencyPluralInfo> cpi(
- new CurrencyPluralInfo(fields->symbols->getLocale(), status),
- status);
- if (U_FAILURE(status)) { return; }
- fields->properties.currencyPluralInfo.fPtr.adoptInstead(cpi.orphan());
- }
- touch(status);
-}
-
-DecimalFormat::DecimalFormat(const DecimalFormatSymbols* symbolsToAdopt, UErrorCode& status) {
- // we must take ownership of symbolsToAdopt, even in a failure case.
- LocalPointer<const DecimalFormatSymbols> adoptedSymbols(symbolsToAdopt);
- if (U_FAILURE(status)) {
- return;
- }
- fields = new DecimalFormatFields();
- if (fields == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- if (adoptedSymbols.isNull()) {
- fields->symbols.adoptInsteadAndCheckErrorCode(new DecimalFormatSymbols(status), status);
- } else {
- fields->symbols.adoptInsteadAndCheckErrorCode(adoptedSymbols.orphan(), status);
- }
- if (U_FAILURE(status)) {
- delete fields;
- fields = nullptr;
- }
-}
-
-#if UCONFIG_HAVE_PARSEALLINPUT
-
-void DecimalFormat::setParseAllInput(UNumberFormatAttributeValue value) {
- if (fields == nullptr) { return; }
- if (value == fields->properties.parseAllInput) { return; }
- fields->properties.parseAllInput = value;
-}
-
-#endif
-
-DecimalFormat&
-DecimalFormat::setAttribute(UNumberFormatAttribute attr, int32_t newValue, UErrorCode& status) {
- if (U_FAILURE(status)) { return *this; }
-
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
- status = U_MEMORY_ALLOCATION_ERROR;
- return *this;
- }
-
- switch (attr) {
- case UNUM_LENIENT_PARSE:
- setLenient(newValue != 0);
- break;
-
- case UNUM_PARSE_INT_ONLY:
- setParseIntegerOnly(newValue != 0);
- break;
-
- case UNUM_GROUPING_USED:
- setGroupingUsed(newValue != 0);
- break;
-
- case UNUM_DECIMAL_ALWAYS_SHOWN:
- setDecimalSeparatorAlwaysShown(newValue != 0);
- break;
-
- case UNUM_MAX_INTEGER_DIGITS:
- setMaximumIntegerDigits(newValue);
- break;
-
- case UNUM_MIN_INTEGER_DIGITS:
- setMinimumIntegerDigits(newValue);
- break;
-
- case UNUM_INTEGER_DIGITS:
- setMinimumIntegerDigits(newValue);
- setMaximumIntegerDigits(newValue);
- break;
-
- case UNUM_MAX_FRACTION_DIGITS:
- setMaximumFractionDigits(newValue);
- break;
-
- case UNUM_MIN_FRACTION_DIGITS:
- setMinimumFractionDigits(newValue);
- break;
-
- case UNUM_FRACTION_DIGITS:
- setMinimumFractionDigits(newValue);
- setMaximumFractionDigits(newValue);
- break;
-
- case UNUM_SIGNIFICANT_DIGITS_USED:
- setSignificantDigitsUsed(newValue != 0);
- break;
-
- case UNUM_MAX_SIGNIFICANT_DIGITS:
- setMaximumSignificantDigits(newValue);
- break;
-
- case UNUM_MIN_SIGNIFICANT_DIGITS:
- setMinimumSignificantDigits(newValue);
- break;
-
- case UNUM_MULTIPLIER:
- setMultiplier(newValue);
- break;
-
- case UNUM_SCALE:
- setMultiplierScale(newValue);
- break;
-
- case UNUM_GROUPING_SIZE:
- setGroupingSize(newValue);
- break;
-
- case UNUM_ROUNDING_MODE:
- setRoundingMode((DecimalFormat::ERoundingMode) newValue);
- break;
-
- case UNUM_FORMAT_WIDTH:
- setFormatWidth(newValue);
- break;
-
- case UNUM_PADDING_POSITION:
- /** The position at which padding will take place. */
- setPadPosition((DecimalFormat::EPadPosition) newValue);
- break;
+UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DecimalFormat)
+
+
+DecimalFormat::DecimalFormat(UErrorCode& status)
+ : DecimalFormat(nullptr, status) {
+ if (U_FAILURE(status)) { return; }
+ // Use the default locale and decimal pattern.
+ const char* localeName = Locale::getDefault().getName();
+ LocalPointer<NumberingSystem> ns(NumberingSystem::createInstance(status));
+ UnicodeString patternString = utils::getPatternForStyle(
+ localeName,
+ ns->getName(),
+ CLDR_PATTERN_STYLE_DECIMAL,
+ status);
+ setPropertiesFromPattern(patternString, IGNORE_ROUNDING_IF_CURRENCY, status);
+ touch(status);
+}
+
+DecimalFormat::DecimalFormat(const UnicodeString& pattern, UErrorCode& status)
+ : DecimalFormat(nullptr, status) {
+ if (U_FAILURE(status)) { return; }
+ setPropertiesFromPattern(pattern, IGNORE_ROUNDING_IF_CURRENCY, status);
+ touch(status);
+}
+
+DecimalFormat::DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt,
+ UErrorCode& status)
+ : DecimalFormat(symbolsToAdopt, status) {
+ if (U_FAILURE(status)) { return; }
+ setPropertiesFromPattern(pattern, IGNORE_ROUNDING_IF_CURRENCY, status);
+ touch(status);
+}
+
+DecimalFormat::DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt,
+ UNumberFormatStyle style, UErrorCode& status)
+ : DecimalFormat(symbolsToAdopt, status) {
+ if (U_FAILURE(status)) { return; }
+ // If choice is a currency type, ignore the rounding information.
+ if (style == UNumberFormatStyle::UNUM_CURRENCY ||
+ style == UNumberFormatStyle::UNUM_CURRENCY_ISO ||
+ style == UNumberFormatStyle::UNUM_CURRENCY_ACCOUNTING ||
+ style == UNumberFormatStyle::UNUM_CASH_CURRENCY ||
+ style == UNumberFormatStyle::UNUM_CURRENCY_STANDARD ||
+ style == UNumberFormatStyle::UNUM_CURRENCY_PLURAL) {
+ setPropertiesFromPattern(pattern, IGNORE_ROUNDING_ALWAYS, status);
+ } else {
+ setPropertiesFromPattern(pattern, IGNORE_ROUNDING_IF_CURRENCY, status);
+ }
+ // Note: in Java, CurrencyPluralInfo is set in NumberFormat.java, but in C++, it is not set there,
+ // so we have to set it here.
+ if (style == UNumberFormatStyle::UNUM_CURRENCY_PLURAL) {
+ LocalPointer<CurrencyPluralInfo> cpi(
+ new CurrencyPluralInfo(fields->symbols->getLocale(), status),
+ status);
+ if (U_FAILURE(status)) { return; }
+ fields->properties.currencyPluralInfo.fPtr.adoptInstead(cpi.orphan());
+ }
+ touch(status);
+}
+
+DecimalFormat::DecimalFormat(const DecimalFormatSymbols* symbolsToAdopt, UErrorCode& status) {
+ // we must take ownership of symbolsToAdopt, even in a failure case.
+ LocalPointer<const DecimalFormatSymbols> adoptedSymbols(symbolsToAdopt);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ fields = new DecimalFormatFields();
+ if (fields == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ if (adoptedSymbols.isNull()) {
+ fields->symbols.adoptInsteadAndCheckErrorCode(new DecimalFormatSymbols(status), status);
+ } else {
+ fields->symbols.adoptInsteadAndCheckErrorCode(adoptedSymbols.orphan(), status);
+ }
+ if (U_FAILURE(status)) {
+ delete fields;
+ fields = nullptr;
+ }
+}
- case UNUM_SECONDARY_GROUPING_SIZE:
- setSecondaryGroupingSize(newValue);
- break;
-
#if UCONFIG_HAVE_PARSEALLINPUT
- case UNUM_PARSE_ALL_INPUT:
- setParseAllInput((UNumberFormatAttributeValue) newValue);
- break;
+
+void DecimalFormat::setParseAllInput(UNumberFormatAttributeValue value) {
+ if (fields == nullptr) { return; }
+ if (value == fields->properties.parseAllInput) { return; }
+ fields->properties.parseAllInput = value;
+}
+
#endif
- case UNUM_PARSE_NO_EXPONENT:
- setParseNoExponent((UBool) newValue);
- break;
+DecimalFormat&
+DecimalFormat::setAttribute(UNumberFormatAttribute attr, int32_t newValue, UErrorCode& status) {
+ if (U_FAILURE(status)) { return *this; }
+
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return *this;
+ }
- case UNUM_PARSE_DECIMAL_MARK_REQUIRED:
- setDecimalPatternMatchRequired((UBool) newValue);
- break;
+ switch (attr) {
+ case UNUM_LENIENT_PARSE:
+ setLenient(newValue != 0);
+ break;
- case UNUM_CURRENCY_USAGE:
- setCurrencyUsage((UCurrencyUsage) newValue, &status);
- break;
+ case UNUM_PARSE_INT_ONLY:
+ setParseIntegerOnly(newValue != 0);
+ break;
- case UNUM_MINIMUM_GROUPING_DIGITS:
- setMinimumGroupingDigits(newValue);
- break;
+ case UNUM_GROUPING_USED:
+ setGroupingUsed(newValue != 0);
+ break;
- case UNUM_PARSE_CASE_SENSITIVE:
- setParseCaseSensitive(static_cast<UBool>(newValue));
- break;
+ case UNUM_DECIMAL_ALWAYS_SHOWN:
+ setDecimalSeparatorAlwaysShown(newValue != 0);
+ break;
- case UNUM_SIGN_ALWAYS_SHOWN:
- setSignAlwaysShown(static_cast<UBool>(newValue));
- break;
+ case UNUM_MAX_INTEGER_DIGITS:
+ setMaximumIntegerDigits(newValue);
+ break;
- case UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS:
- setFormatFailIfMoreThanMaxDigits(static_cast<UBool>(newValue));
- break;
-
- default:
- status = U_UNSUPPORTED_ERROR;
- break;
- }
- return *this;
-}
-
-int32_t DecimalFormat::getAttribute(UNumberFormatAttribute attr, UErrorCode& status) const {
- if (U_FAILURE(status)) { return -1; }
-
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+ case UNUM_MIN_INTEGER_DIGITS:
+ setMinimumIntegerDigits(newValue);
+ break;
+
+ case UNUM_INTEGER_DIGITS:
+ setMinimumIntegerDigits(newValue);
+ setMaximumIntegerDigits(newValue);
+ break;
+
+ case UNUM_MAX_FRACTION_DIGITS:
+ setMaximumFractionDigits(newValue);
+ break;
+
+ case UNUM_MIN_FRACTION_DIGITS:
+ setMinimumFractionDigits(newValue);
+ break;
+
+ case UNUM_FRACTION_DIGITS:
+ setMinimumFractionDigits(newValue);
+ setMaximumFractionDigits(newValue);
+ break;
+
+ case UNUM_SIGNIFICANT_DIGITS_USED:
+ setSignificantDigitsUsed(newValue != 0);
+ break;
+
+ case UNUM_MAX_SIGNIFICANT_DIGITS:
+ setMaximumSignificantDigits(newValue);
+ break;
+
+ case UNUM_MIN_SIGNIFICANT_DIGITS:
+ setMinimumSignificantDigits(newValue);
+ break;
+
+ case UNUM_MULTIPLIER:
+ setMultiplier(newValue);
+ break;
+
+ case UNUM_SCALE:
+ setMultiplierScale(newValue);
+ break;
+
+ case UNUM_GROUPING_SIZE:
+ setGroupingSize(newValue);
+ break;
+
+ case UNUM_ROUNDING_MODE:
+ setRoundingMode((DecimalFormat::ERoundingMode) newValue);
+ break;
+
+ case UNUM_FORMAT_WIDTH:
+ setFormatWidth(newValue);
+ break;
+
+ case UNUM_PADDING_POSITION:
+ /** The position at which padding will take place. */
+ setPadPosition((DecimalFormat::EPadPosition) newValue);
+ break;
+
+ case UNUM_SECONDARY_GROUPING_SIZE:
+ setSecondaryGroupingSize(newValue);
+ break;
+
+#if UCONFIG_HAVE_PARSEALLINPUT
+ case UNUM_PARSE_ALL_INPUT:
+ setParseAllInput((UNumberFormatAttributeValue) newValue);
+ break;
+#endif
+
+ case UNUM_PARSE_NO_EXPONENT:
+ setParseNoExponent((UBool) newValue);
+ break;
+
+ case UNUM_PARSE_DECIMAL_MARK_REQUIRED:
+ setDecimalPatternMatchRequired((UBool) newValue);
+ break;
+
+ case UNUM_CURRENCY_USAGE:
+ setCurrencyUsage((UCurrencyUsage) newValue, &status);
+ break;
+
+ case UNUM_MINIMUM_GROUPING_DIGITS:
+ setMinimumGroupingDigits(newValue);
+ break;
+
+ case UNUM_PARSE_CASE_SENSITIVE:
+ setParseCaseSensitive(static_cast<UBool>(newValue));
+ break;
+
+ case UNUM_SIGN_ALWAYS_SHOWN:
+ setSignAlwaysShown(static_cast<UBool>(newValue));
+ break;
+
+ case UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS:
+ setFormatFailIfMoreThanMaxDigits(static_cast<UBool>(newValue));
+ break;
+
+ default:
+ status = U_UNSUPPORTED_ERROR;
+ break;
+ }
+ return *this;
+}
+
+int32_t DecimalFormat::getAttribute(UNumberFormatAttribute attr, UErrorCode& status) const {
+ if (U_FAILURE(status)) { return -1; }
+
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
status = U_MEMORY_ALLOCATION_ERROR;
- return -1;
+ return -1;
}
- switch (attr) {
- case UNUM_LENIENT_PARSE:
- return isLenient();
+ switch (attr) {
+ case UNUM_LENIENT_PARSE:
+ return isLenient();
- case UNUM_PARSE_INT_ONLY:
- return isParseIntegerOnly();
+ case UNUM_PARSE_INT_ONLY:
+ return isParseIntegerOnly();
- case UNUM_GROUPING_USED:
- return isGroupingUsed();
+ case UNUM_GROUPING_USED:
+ return isGroupingUsed();
- case UNUM_DECIMAL_ALWAYS_SHOWN:
- return isDecimalSeparatorAlwaysShown();
+ case UNUM_DECIMAL_ALWAYS_SHOWN:
+ return isDecimalSeparatorAlwaysShown();
- case UNUM_MAX_INTEGER_DIGITS:
- return getMaximumIntegerDigits();
+ case UNUM_MAX_INTEGER_DIGITS:
+ return getMaximumIntegerDigits();
- case UNUM_MIN_INTEGER_DIGITS:
- return getMinimumIntegerDigits();
+ case UNUM_MIN_INTEGER_DIGITS:
+ return getMinimumIntegerDigits();
- case UNUM_INTEGER_DIGITS:
- // TBD: what should this return?
- return getMinimumIntegerDigits();
+ case UNUM_INTEGER_DIGITS:
+ // TBD: what should this return?
+ return getMinimumIntegerDigits();
- case UNUM_MAX_FRACTION_DIGITS:
- return getMaximumFractionDigits();
+ case UNUM_MAX_FRACTION_DIGITS:
+ return getMaximumFractionDigits();
- case UNUM_MIN_FRACTION_DIGITS:
- return getMinimumFractionDigits();
+ case UNUM_MIN_FRACTION_DIGITS:
+ return getMinimumFractionDigits();
- case UNUM_FRACTION_DIGITS:
- // TBD: what should this return?
- return getMinimumFractionDigits();
+ case UNUM_FRACTION_DIGITS:
+ // TBD: what should this return?
+ return getMinimumFractionDigits();
- case UNUM_SIGNIFICANT_DIGITS_USED:
- return areSignificantDigitsUsed();
+ case UNUM_SIGNIFICANT_DIGITS_USED:
+ return areSignificantDigitsUsed();
- case UNUM_MAX_SIGNIFICANT_DIGITS:
- return getMaximumSignificantDigits();
+ case UNUM_MAX_SIGNIFICANT_DIGITS:
+ return getMaximumSignificantDigits();
- case UNUM_MIN_SIGNIFICANT_DIGITS:
- return getMinimumSignificantDigits();
+ case UNUM_MIN_SIGNIFICANT_DIGITS:
+ return getMinimumSignificantDigits();
- case UNUM_MULTIPLIER:
- return getMultiplier();
+ case UNUM_MULTIPLIER:
+ return getMultiplier();
- case UNUM_SCALE:
- return getMultiplierScale();
+ case UNUM_SCALE:
+ return getMultiplierScale();
- case UNUM_GROUPING_SIZE:
- return getGroupingSize();
+ case UNUM_GROUPING_SIZE:
+ return getGroupingSize();
- case UNUM_ROUNDING_MODE:
- return getRoundingMode();
+ case UNUM_ROUNDING_MODE:
+ return getRoundingMode();
- case UNUM_FORMAT_WIDTH:
- return getFormatWidth();
+ case UNUM_FORMAT_WIDTH:
+ return getFormatWidth();
- case UNUM_PADDING_POSITION:
- return getPadPosition();
+ case UNUM_PADDING_POSITION:
+ return getPadPosition();
- case UNUM_SECONDARY_GROUPING_SIZE:
- return getSecondaryGroupingSize();
+ case UNUM_SECONDARY_GROUPING_SIZE:
+ return getSecondaryGroupingSize();
- case UNUM_PARSE_NO_EXPONENT:
- return isParseNoExponent();
+ case UNUM_PARSE_NO_EXPONENT:
+ return isParseNoExponent();
- case UNUM_PARSE_DECIMAL_MARK_REQUIRED:
- return isDecimalPatternMatchRequired();
+ case UNUM_PARSE_DECIMAL_MARK_REQUIRED:
+ return isDecimalPatternMatchRequired();
- case UNUM_CURRENCY_USAGE:
- return getCurrencyUsage();
+ case UNUM_CURRENCY_USAGE:
+ return getCurrencyUsage();
- case UNUM_MINIMUM_GROUPING_DIGITS:
- return getMinimumGroupingDigits();
+ case UNUM_MINIMUM_GROUPING_DIGITS:
+ return getMinimumGroupingDigits();
- case UNUM_PARSE_CASE_SENSITIVE:
- return isParseCaseSensitive();
+ case UNUM_PARSE_CASE_SENSITIVE:
+ return isParseCaseSensitive();
- case UNUM_SIGN_ALWAYS_SHOWN:
- return isSignAlwaysShown();
+ case UNUM_SIGN_ALWAYS_SHOWN:
+ return isSignAlwaysShown();
- case UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS:
- return isFormatFailIfMoreThanMaxDigits();
+ case UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS:
+ return isFormatFailIfMoreThanMaxDigits();
- default:
- status = U_UNSUPPORTED_ERROR;
- break;
- }
-
- return -1; /* undefined */
+ default:
+ status = U_UNSUPPORTED_ERROR;
+ break;
+ }
+
+ return -1; /* undefined */
}
-void DecimalFormat::setGroupingUsed(UBool enabled) {
- if (fields == nullptr) {
- return;
+void DecimalFormat::setGroupingUsed(UBool enabled) {
+ if (fields == nullptr) {
+ return;
}
- if (UBOOL_TO_BOOL(enabled) == fields->properties.groupingUsed) { return; }
- NumberFormat::setGroupingUsed(enabled); // to set field for compatibility
- fields->properties.groupingUsed = enabled;
- touchNoError();
+ if (UBOOL_TO_BOOL(enabled) == fields->properties.groupingUsed) { return; }
+ NumberFormat::setGroupingUsed(enabled); // to set field for compatibility
+ fields->properties.groupingUsed = enabled;
+ touchNoError();
}
-void DecimalFormat::setParseIntegerOnly(UBool value) {
- if (fields == nullptr) {
- return;
- }
- if (UBOOL_TO_BOOL(value) == fields->properties.parseIntegerOnly) { return; }
- NumberFormat::setParseIntegerOnly(value); // to set field for compatibility
- fields->properties.parseIntegerOnly = value;
- touchNoError();
+void DecimalFormat::setParseIntegerOnly(UBool value) {
+ if (fields == nullptr) {
+ return;
+ }
+ if (UBOOL_TO_BOOL(value) == fields->properties.parseIntegerOnly) { return; }
+ NumberFormat::setParseIntegerOnly(value); // to set field for compatibility
+ fields->properties.parseIntegerOnly = value;
+ touchNoError();
}
-void DecimalFormat::setLenient(UBool enable) {
- if (fields == nullptr) {
- return;
+void DecimalFormat::setLenient(UBool enable) {
+ if (fields == nullptr) {
+ return;
+ }
+ ParseMode mode = enable ? PARSE_MODE_LENIENT : PARSE_MODE_STRICT;
+ if (!fields->properties.parseMode.isNull() && mode == fields->properties.parseMode.getNoError()) { return; }
+ NumberFormat::setLenient(enable); // to set field for compatibility
+ fields->properties.parseMode = mode;
+ touchNoError();
+}
+
+DecimalFormat::DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt,
+ UParseError&, UErrorCode& status)
+ : DecimalFormat(symbolsToAdopt, status) {
+ if (U_FAILURE(status)) { return; }
+ // TODO: What is parseError for?
+ setPropertiesFromPattern(pattern, IGNORE_ROUNDING_IF_CURRENCY, status);
+ touch(status);
+}
+
+DecimalFormat::DecimalFormat(const UnicodeString& pattern, const DecimalFormatSymbols& symbols,
+ UErrorCode& status)
+ : DecimalFormat(nullptr, status) {
+ if (U_FAILURE(status)) { return; }
+ LocalPointer<DecimalFormatSymbols> dfs(new DecimalFormatSymbols(symbols), status);
+ if (U_FAILURE(status)) {
+ // If we failed to allocate DecimalFormatSymbols, then release fields and its members.
+ // We must have a fully complete fields object, we cannot have partially populated members.
+ delete fields;
+ fields = nullptr;
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
}
- ParseMode mode = enable ? PARSE_MODE_LENIENT : PARSE_MODE_STRICT;
- if (!fields->properties.parseMode.isNull() && mode == fields->properties.parseMode.getNoError()) { return; }
- NumberFormat::setLenient(enable); // to set field for compatibility
- fields->properties.parseMode = mode;
- touchNoError();
+ fields->symbols.adoptInstead(dfs.orphan());
+ setPropertiesFromPattern(pattern, IGNORE_ROUNDING_IF_CURRENCY, status);
+ touch(status);
}
-DecimalFormat::DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt,
- UParseError&, UErrorCode& status)
- : DecimalFormat(symbolsToAdopt, status) {
- if (U_FAILURE(status)) { return; }
- // TODO: What is parseError for?
- setPropertiesFromPattern(pattern, IGNORE_ROUNDING_IF_CURRENCY, status);
- touch(status);
-}
-
-DecimalFormat::DecimalFormat(const UnicodeString& pattern, const DecimalFormatSymbols& symbols,
- UErrorCode& status)
- : DecimalFormat(nullptr, status) {
- if (U_FAILURE(status)) { return; }
- LocalPointer<DecimalFormatSymbols> dfs(new DecimalFormatSymbols(symbols), status);
- if (U_FAILURE(status)) {
- // If we failed to allocate DecimalFormatSymbols, then release fields and its members.
- // We must have a fully complete fields object, we cannot have partially populated members.
- delete fields;
- fields = nullptr;
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- fields->symbols.adoptInstead(dfs.orphan());
- setPropertiesFromPattern(pattern, IGNORE_ROUNDING_IF_CURRENCY, status);
- touch(status);
-}
-
-DecimalFormat::DecimalFormat(const DecimalFormat& source) : NumberFormat(source) {
- // If the object that we are copying from is invalid, no point in going further.
- if (source.fields == nullptr) {
- return;
- }
- // Note: it is not safe to copy fields->formatter or fWarehouse directly because fields->formatter might have
- // dangling pointers to fields inside fWarehouse. The safe thing is to re-construct fields->formatter from
- // the property bag, despite being somewhat slower.
- fields = new DecimalFormatFields(source.fields->properties);
- if (fields == nullptr) {
- return; // no way to report an error.
- }
- UErrorCode status = U_ZERO_ERROR;
- fields->symbols.adoptInsteadAndCheckErrorCode(new DecimalFormatSymbols(*source.fields->symbols), status);
- // In order to simplify error handling logic in the various getters/setters/etc, we do not allow
- // any partially populated DecimalFormatFields object. We must have a fully complete fields object
- // or else we set it to nullptr.
+DecimalFormat::DecimalFormat(const DecimalFormat& source) : NumberFormat(source) {
+ // If the object that we are copying from is invalid, no point in going further.
+ if (source.fields == nullptr) {
+ return;
+ }
+ // Note: it is not safe to copy fields->formatter or fWarehouse directly because fields->formatter might have
+ // dangling pointers to fields inside fWarehouse. The safe thing is to re-construct fields->formatter from
+ // the property bag, despite being somewhat slower.
+ fields = new DecimalFormatFields(source.fields->properties);
+ if (fields == nullptr) {
+ return; // no way to report an error.
+ }
+ UErrorCode status = U_ZERO_ERROR;
+ fields->symbols.adoptInsteadAndCheckErrorCode(new DecimalFormatSymbols(*source.fields->symbols), status);
+ // In order to simplify error handling logic in the various getters/setters/etc, we do not allow
+ // any partially populated DecimalFormatFields object. We must have a fully complete fields object
+ // or else we set it to nullptr.
if (U_FAILURE(status)) {
- delete fields;
- fields = nullptr;
- return;
- }
- touch(status);
-}
-
-DecimalFormat& DecimalFormat::operator=(const DecimalFormat& rhs) {
- // guard against self-assignment
- if (this == &rhs) {
- return *this;
- }
- // Make sure both objects are valid.
- if (fields == nullptr || rhs.fields == nullptr) {
- return *this; // unfortunately, no way to report an error.
- }
- fields->properties = rhs.fields->properties;
- fields->exportedProperties.clear();
+ delete fields;
+ fields = nullptr;
+ return;
+ }
+ touch(status);
+}
+
+DecimalFormat& DecimalFormat::operator=(const DecimalFormat& rhs) {
+ // guard against self-assignment
+ if (this == &rhs) {
+ return *this;
+ }
+ // Make sure both objects are valid.
+ if (fields == nullptr || rhs.fields == nullptr) {
+ return *this; // unfortunately, no way to report an error.
+ }
+ fields->properties = rhs.fields->properties;
+ fields->exportedProperties.clear();
UErrorCode status = U_ZERO_ERROR;
- LocalPointer<DecimalFormatSymbols> dfs(new DecimalFormatSymbols(*rhs.fields->symbols), status);
- if (U_FAILURE(status)) {
- // We failed to allocate DecimalFormatSymbols, release fields and its members.
- // We must have a fully complete fields object, we cannot have partially populated members.
- delete fields;
- fields = nullptr;
- return *this;
- }
- fields->symbols.adoptInstead(dfs.orphan());
- touch(status);
-
- return *this;
-}
-
-DecimalFormat::~DecimalFormat() {
- if (fields == nullptr) { return; }
-
- delete fields->atomicParser.exchange(nullptr);
- delete fields->atomicCurrencyParser.exchange(nullptr);
- delete fields;
-}
-
-DecimalFormat* DecimalFormat::clone() const {
- // can only clone valid objects.
- if (fields == nullptr) {
- return nullptr;
- }
- LocalPointer<DecimalFormat> df(new DecimalFormat(*this));
- if (df.isValid() && df->fields != nullptr) {
- return df.orphan();
- }
- return nullptr;
-}
-
-UBool DecimalFormat::operator==(const Format& other) const {
- auto* otherDF = dynamic_cast<const DecimalFormat*>(&other);
- if (otherDF == nullptr) {
- return false;
- }
- // If either object is in an invalid state, prevent dereferencing nullptr below.
- // Additionally, invalid objects should not be considered equal to anything.
- if (fields == nullptr || otherDF->fields == nullptr) {
- return false;
- }
- return fields->properties == otherDF->fields->properties && *fields->symbols == *otherDF->fields->symbols;
-}
-
-UnicodeString& DecimalFormat::format(double number, UnicodeString& appendTo, FieldPosition& pos) const {
- if (fields == nullptr) {
- appendTo.setToBogus();
- return appendTo;
- }
- if (pos.getField() == FieldPosition::DONT_CARE && fastFormatDouble(number, appendTo)) {
- return appendTo;
- }
- UErrorCode localStatus = U_ZERO_ERROR;
- UFormattedNumberData output;
- output.quantity.setToDouble(number);
- fields->formatter.formatImpl(&output, localStatus);
- fieldPositionHelper(output, pos, appendTo.length(), localStatus);
- auto appendable = UnicodeStringAppendable(appendTo);
- output.appendTo(appendable, localStatus);
- return appendTo;
-}
-
-UnicodeString& DecimalFormat::format(double number, UnicodeString& appendTo, FieldPosition& pos,
- UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return appendTo; // don't overwrite status if it's already a failure.
- }
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
- status = U_MEMORY_ALLOCATION_ERROR;
- appendTo.setToBogus();
- return appendTo;
- }
- if (pos.getField() == FieldPosition::DONT_CARE && fastFormatDouble(number, appendTo)) {
- return appendTo;
- }
- UFormattedNumberData output;
- output.quantity.setToDouble(number);
- fields->formatter.formatImpl(&output, status);
- fieldPositionHelper(output, pos, appendTo.length(), status);
- auto appendable = UnicodeStringAppendable(appendTo);
- output.appendTo(appendable, status);
- return appendTo;
+ LocalPointer<DecimalFormatSymbols> dfs(new DecimalFormatSymbols(*rhs.fields->symbols), status);
+ if (U_FAILURE(status)) {
+ // We failed to allocate DecimalFormatSymbols, release fields and its members.
+ // We must have a fully complete fields object, we cannot have partially populated members.
+ delete fields;
+ fields = nullptr;
+ return *this;
+ }
+ fields->symbols.adoptInstead(dfs.orphan());
+ touch(status);
+
+ return *this;
+}
+
+DecimalFormat::~DecimalFormat() {
+ if (fields == nullptr) { return; }
+
+ delete fields->atomicParser.exchange(nullptr);
+ delete fields->atomicCurrencyParser.exchange(nullptr);
+ delete fields;
+}
+
+DecimalFormat* DecimalFormat::clone() const {
+ // can only clone valid objects.
+ if (fields == nullptr) {
+ return nullptr;
+ }
+ LocalPointer<DecimalFormat> df(new DecimalFormat(*this));
+ if (df.isValid() && df->fields != nullptr) {
+ return df.orphan();
+ }
+ return nullptr;
+}
+
+UBool DecimalFormat::operator==(const Format& other) const {
+ auto* otherDF = dynamic_cast<const DecimalFormat*>(&other);
+ if (otherDF == nullptr) {
+ return false;
+ }
+ // If either object is in an invalid state, prevent dereferencing nullptr below.
+ // Additionally, invalid objects should not be considered equal to anything.
+ if (fields == nullptr || otherDF->fields == nullptr) {
+ return false;
+ }
+ return fields->properties == otherDF->fields->properties && *fields->symbols == *otherDF->fields->symbols;
+}
+
+UnicodeString& DecimalFormat::format(double number, UnicodeString& appendTo, FieldPosition& pos) const {
+ if (fields == nullptr) {
+ appendTo.setToBogus();
+ return appendTo;
+ }
+ if (pos.getField() == FieldPosition::DONT_CARE && fastFormatDouble(number, appendTo)) {
+ return appendTo;
+ }
+ UErrorCode localStatus = U_ZERO_ERROR;
+ UFormattedNumberData output;
+ output.quantity.setToDouble(number);
+ fields->formatter.formatImpl(&output, localStatus);
+ fieldPositionHelper(output, pos, appendTo.length(), localStatus);
+ auto appendable = UnicodeStringAppendable(appendTo);
+ output.appendTo(appendable, localStatus);
+ return appendTo;
+}
+
+UnicodeString& DecimalFormat::format(double number, UnicodeString& appendTo, FieldPosition& pos,
+ UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return appendTo; // don't overwrite status if it's already a failure.
+ }
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+ status = U_MEMORY_ALLOCATION_ERROR;
+ appendTo.setToBogus();
+ return appendTo;
+ }
+ if (pos.getField() == FieldPosition::DONT_CARE && fastFormatDouble(number, appendTo)) {
+ return appendTo;
+ }
+ UFormattedNumberData output;
+ output.quantity.setToDouble(number);
+ fields->formatter.formatImpl(&output, status);
+ fieldPositionHelper(output, pos, appendTo.length(), status);
+ auto appendable = UnicodeStringAppendable(appendTo);
+ output.appendTo(appendable, status);
+ return appendTo;
+}
+
+UnicodeString&
+DecimalFormat::format(double number, UnicodeString& appendTo, FieldPositionIterator* posIter,
+ UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return appendTo; // don't overwrite status if it's already a failure.
+ }
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+ status = U_MEMORY_ALLOCATION_ERROR;
+ appendTo.setToBogus();
+ return appendTo;
+ }
+ if (posIter == nullptr && fastFormatDouble(number, appendTo)) {
+ return appendTo;
+ }
+ UFormattedNumberData output;
+ output.quantity.setToDouble(number);
+ fields->formatter.formatImpl(&output, status);
+ fieldPositionIteratorHelper(output, posIter, appendTo.length(), status);
+ auto appendable = UnicodeStringAppendable(appendTo);
+ output.appendTo(appendable, status);
+ return appendTo;
+}
+
+UnicodeString& DecimalFormat::format(int32_t number, UnicodeString& appendTo, FieldPosition& pos) const {
+ return format(static_cast<int64_t> (number), appendTo, pos);
+}
+
+UnicodeString& DecimalFormat::format(int32_t number, UnicodeString& appendTo, FieldPosition& pos,
+ UErrorCode& status) const {
+ return format(static_cast<int64_t> (number), appendTo, pos, status);
+}
+
+UnicodeString&
+DecimalFormat::format(int32_t number, UnicodeString& appendTo, FieldPositionIterator* posIter,
+ UErrorCode& status) const {
+ return format(static_cast<int64_t> (number), appendTo, posIter, status);
+}
+
+UnicodeString& DecimalFormat::format(int64_t number, UnicodeString& appendTo, FieldPosition& pos) const {
+ if (fields == nullptr) {
+ appendTo.setToBogus();
+ return appendTo;
+ }
+ if (pos.getField() == FieldPosition::DONT_CARE && fastFormatInt64(number, appendTo)) {
+ return appendTo;
+ }
+ UErrorCode localStatus = U_ZERO_ERROR;
+ UFormattedNumberData output;
+ output.quantity.setToLong(number);
+ fields->formatter.formatImpl(&output, localStatus);
+ fieldPositionHelper(output, pos, appendTo.length(), localStatus);
+ auto appendable = UnicodeStringAppendable(appendTo);
+ output.appendTo(appendable, localStatus);
+ return appendTo;
+}
+
+UnicodeString& DecimalFormat::format(int64_t number, UnicodeString& appendTo, FieldPosition& pos,
+ UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return appendTo; // don't overwrite status if it's already a failure.
+ }
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+ status = U_MEMORY_ALLOCATION_ERROR;
+ appendTo.setToBogus();
+ return appendTo;
+ }
+ if (pos.getField() == FieldPosition::DONT_CARE && fastFormatInt64(number, appendTo)) {
+ return appendTo;
+ }
+ UFormattedNumberData output;
+ output.quantity.setToLong(number);
+ fields->formatter.formatImpl(&output, status);
+ fieldPositionHelper(output, pos, appendTo.length(), status);
+ auto appendable = UnicodeStringAppendable(appendTo);
+ output.appendTo(appendable, status);
+ return appendTo;
+}
+
+UnicodeString&
+DecimalFormat::format(int64_t number, UnicodeString& appendTo, FieldPositionIterator* posIter,
+ UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return appendTo; // don't overwrite status if it's already a failure.
+ }
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+ status = U_MEMORY_ALLOCATION_ERROR;
+ appendTo.setToBogus();
+ return appendTo;
+ }
+ if (posIter == nullptr && fastFormatInt64(number, appendTo)) {
+ return appendTo;
+ }
+ UFormattedNumberData output;
+ output.quantity.setToLong(number);
+ fields->formatter.formatImpl(&output, status);
+ fieldPositionIteratorHelper(output, posIter, appendTo.length(), status);
+ auto appendable = UnicodeStringAppendable(appendTo);
+ output.appendTo(appendable, status);
+ return appendTo;
}
UnicodeString&
-DecimalFormat::format(double number, UnicodeString& appendTo, FieldPositionIterator* posIter,
- UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return appendTo; // don't overwrite status if it's already a failure.
- }
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
- status = U_MEMORY_ALLOCATION_ERROR;
- appendTo.setToBogus();
- return appendTo;
- }
- if (posIter == nullptr && fastFormatDouble(number, appendTo)) {
- return appendTo;
- }
- UFormattedNumberData output;
- output.quantity.setToDouble(number);
- fields->formatter.formatImpl(&output, status);
- fieldPositionIteratorHelper(output, posIter, appendTo.length(), status);
- auto appendable = UnicodeStringAppendable(appendTo);
- output.appendTo(appendable, status);
- return appendTo;
-}
-
-UnicodeString& DecimalFormat::format(int32_t number, UnicodeString& appendTo, FieldPosition& pos) const {
- return format(static_cast<int64_t> (number), appendTo, pos);
-}
-
-UnicodeString& DecimalFormat::format(int32_t number, UnicodeString& appendTo, FieldPosition& pos,
- UErrorCode& status) const {
- return format(static_cast<int64_t> (number), appendTo, pos, status);
+DecimalFormat::format(StringPiece number, UnicodeString& appendTo, FieldPositionIterator* posIter,
+ UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return appendTo; // don't overwrite status if it's already a failure.
+ }
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+ status = U_MEMORY_ALLOCATION_ERROR;
+ appendTo.setToBogus();
+ return appendTo;
+ }
+ UFormattedNumberData output;
+ output.quantity.setToDecNumber(number, status);
+ fields->formatter.formatImpl(&output, status);
+ fieldPositionIteratorHelper(output, posIter, appendTo.length(), status);
+ auto appendable = UnicodeStringAppendable(appendTo);
+ output.appendTo(appendable, status);
+ return appendTo;
+}
+
+UnicodeString& DecimalFormat::format(const DecimalQuantity& number, UnicodeString& appendTo,
+ FieldPositionIterator* posIter, UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return appendTo; // don't overwrite status if it's already a failure.
+ }
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+ status = U_MEMORY_ALLOCATION_ERROR;
+ appendTo.setToBogus();
+ return appendTo;
+ }
+ UFormattedNumberData output;
+ output.quantity = number;
+ fields->formatter.formatImpl(&output, status);
+ fieldPositionIteratorHelper(output, posIter, appendTo.length(), status);
+ auto appendable = UnicodeStringAppendable(appendTo);
+ output.appendTo(appendable, status);
+ return appendTo;
}
UnicodeString&
-DecimalFormat::format(int32_t number, UnicodeString& appendTo, FieldPositionIterator* posIter,
- UErrorCode& status) const {
- return format(static_cast<int64_t> (number), appendTo, posIter, status);
-}
-
-UnicodeString& DecimalFormat::format(int64_t number, UnicodeString& appendTo, FieldPosition& pos) const {
- if (fields == nullptr) {
- appendTo.setToBogus();
- return appendTo;
- }
- if (pos.getField() == FieldPosition::DONT_CARE && fastFormatInt64(number, appendTo)) {
- return appendTo;
- }
- UErrorCode localStatus = U_ZERO_ERROR;
- UFormattedNumberData output;
- output.quantity.setToLong(number);
- fields->formatter.formatImpl(&output, localStatus);
- fieldPositionHelper(output, pos, appendTo.length(), localStatus);
- auto appendable = UnicodeStringAppendable(appendTo);
- output.appendTo(appendable, localStatus);
- return appendTo;
-}
-
-UnicodeString& DecimalFormat::format(int64_t number, UnicodeString& appendTo, FieldPosition& pos,
- UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return appendTo; // don't overwrite status if it's already a failure.
- }
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
- status = U_MEMORY_ALLOCATION_ERROR;
- appendTo.setToBogus();
- return appendTo;
- }
- if (pos.getField() == FieldPosition::DONT_CARE && fastFormatInt64(number, appendTo)) {
- return appendTo;
- }
- UFormattedNumberData output;
- output.quantity.setToLong(number);
- fields->formatter.formatImpl(&output, status);
- fieldPositionHelper(output, pos, appendTo.length(), status);
- auto appendable = UnicodeStringAppendable(appendTo);
- output.appendTo(appendable, status);
- return appendTo;
-}
-
-UnicodeString&
-DecimalFormat::format(int64_t number, UnicodeString& appendTo, FieldPositionIterator* posIter,
- UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return appendTo; // don't overwrite status if it's already a failure.
- }
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
- status = U_MEMORY_ALLOCATION_ERROR;
- appendTo.setToBogus();
- return appendTo;
- }
- if (posIter == nullptr && fastFormatInt64(number, appendTo)) {
- return appendTo;
- }
- UFormattedNumberData output;
- output.quantity.setToLong(number);
- fields->formatter.formatImpl(&output, status);
- fieldPositionIteratorHelper(output, posIter, appendTo.length(), status);
- auto appendable = UnicodeStringAppendable(appendTo);
- output.appendTo(appendable, status);
- return appendTo;
-}
-
-UnicodeString&
-DecimalFormat::format(StringPiece number, UnicodeString& appendTo, FieldPositionIterator* posIter,
- UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return appendTo; // don't overwrite status if it's already a failure.
- }
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
- status = U_MEMORY_ALLOCATION_ERROR;
- appendTo.setToBogus();
- return appendTo;
- }
- UFormattedNumberData output;
- output.quantity.setToDecNumber(number, status);
- fields->formatter.formatImpl(&output, status);
- fieldPositionIteratorHelper(output, posIter, appendTo.length(), status);
- auto appendable = UnicodeStringAppendable(appendTo);
- output.appendTo(appendable, status);
- return appendTo;
-}
-
-UnicodeString& DecimalFormat::format(const DecimalQuantity& number, UnicodeString& appendTo,
- FieldPositionIterator* posIter, UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return appendTo; // don't overwrite status if it's already a failure.
- }
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
- status = U_MEMORY_ALLOCATION_ERROR;
- appendTo.setToBogus();
- return appendTo;
- }
- UFormattedNumberData output;
- output.quantity = number;
- fields->formatter.formatImpl(&output, status);
- fieldPositionIteratorHelper(output, posIter, appendTo.length(), status);
- auto appendable = UnicodeStringAppendable(appendTo);
- output.appendTo(appendable, status);
- return appendTo;
-}
-
-UnicodeString&
-DecimalFormat::format(const DecimalQuantity& number, UnicodeString& appendTo, FieldPosition& pos,
- UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return appendTo; // don't overwrite status if it's already a failure.
- }
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
- status = U_MEMORY_ALLOCATION_ERROR;
- appendTo.setToBogus();
- return appendTo;
- }
- UFormattedNumberData output;
- output.quantity = number;
- fields->formatter.formatImpl(&output, status);
- fieldPositionHelper(output, pos, appendTo.length(), status);
- auto appendable = UnicodeStringAppendable(appendTo);
- output.appendTo(appendable, status);
- return appendTo;
-}
-
-void DecimalFormat::parse(const UnicodeString& text, Formattable& output,
- ParsePosition& parsePosition) const {
- if (fields == nullptr) {
- return;
- }
- if (parsePosition.getIndex() < 0 || parsePosition.getIndex() >= text.length()) {
- if (parsePosition.getIndex() == text.length()) {
- // If there is nothing to parse, it is an error
- parsePosition.setErrorIndex(parsePosition.getIndex());
+DecimalFormat::format(const DecimalQuantity& number, UnicodeString& appendTo, FieldPosition& pos,
+ UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return appendTo; // don't overwrite status if it's already a failure.
+ }
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+ status = U_MEMORY_ALLOCATION_ERROR;
+ appendTo.setToBogus();
+ return appendTo;
+ }
+ UFormattedNumberData output;
+ output.quantity = number;
+ fields->formatter.formatImpl(&output, status);
+ fieldPositionHelper(output, pos, appendTo.length(), status);
+ auto appendable = UnicodeStringAppendable(appendTo);
+ output.appendTo(appendable, status);
+ return appendTo;
+}
+
+void DecimalFormat::parse(const UnicodeString& text, Formattable& output,
+ ParsePosition& parsePosition) const {
+ if (fields == nullptr) {
+ return;
+ }
+ if (parsePosition.getIndex() < 0 || parsePosition.getIndex() >= text.length()) {
+ if (parsePosition.getIndex() == text.length()) {
+ // If there is nothing to parse, it is an error
+ parsePosition.setErrorIndex(parsePosition.getIndex());
}
- return;
- }
-
- ErrorCode status;
- ParsedNumber result;
- // Note: if this is a currency instance, currencies will be matched despite the fact that we are not in the
- // parseCurrency method (backwards compatibility)
- int32_t startIndex = parsePosition.getIndex();
- const NumberParserImpl* parser = getParser(status);
- if (U_FAILURE(status)) {
- return; // unfortunately no way to report back the error.
- }
- parser->parse(text, startIndex, true, result, status);
- if (U_FAILURE(status)) {
- return; // unfortunately no way to report back the error.
- }
- // TODO: Do we need to check for fImpl->properties->parseAllInput (UCONFIG_HAVE_PARSEALLINPUT) here?
- if (result.success()) {
- parsePosition.setIndex(result.charEnd);
- result.populateFormattable(output, parser->getParseFlags());
+ return;
+ }
+
+ ErrorCode status;
+ ParsedNumber result;
+ // Note: if this is a currency instance, currencies will be matched despite the fact that we are not in the
+ // parseCurrency method (backwards compatibility)
+ int32_t startIndex = parsePosition.getIndex();
+ const NumberParserImpl* parser = getParser(status);
+ if (U_FAILURE(status)) {
+ return; // unfortunately no way to report back the error.
+ }
+ parser->parse(text, startIndex, true, result, status);
+ if (U_FAILURE(status)) {
+ return; // unfortunately no way to report back the error.
+ }
+ // TODO: Do we need to check for fImpl->properties->parseAllInput (UCONFIG_HAVE_PARSEALLINPUT) here?
+ if (result.success()) {
+ parsePosition.setIndex(result.charEnd);
+ result.populateFormattable(output, parser->getParseFlags());
} else {
- parsePosition.setErrorIndex(startIndex + result.charEnd);
- }
-}
-
-CurrencyAmount* DecimalFormat::parseCurrency(const UnicodeString& text, ParsePosition& parsePosition) const {
- if (fields == nullptr) {
- return nullptr;
- }
- if (parsePosition.getIndex() < 0 || parsePosition.getIndex() >= text.length()) {
- return nullptr;
- }
-
- ErrorCode status;
- ParsedNumber result;
- // Note: if this is a currency instance, currencies will be matched despite the fact that we are not in the
- // parseCurrency method (backwards compatibility)
- int32_t startIndex = parsePosition.getIndex();
- const NumberParserImpl* parser = getCurrencyParser(status);
- if (U_FAILURE(status)) {
- return nullptr;
- }
- parser->parse(text, startIndex, true, result, status);
- if (U_FAILURE(status)) {
- return nullptr;
- }
- // TODO: Do we need to check for fImpl->properties->parseAllInput (UCONFIG_HAVE_PARSEALLINPUT) here?
- if (result.success()) {
- parsePosition.setIndex(result.charEnd);
- Formattable formattable;
- result.populateFormattable(formattable, parser->getParseFlags());
- LocalPointer<CurrencyAmount> currencyAmount(
- new CurrencyAmount(formattable, result.currencyCode, status), status);
- if (U_FAILURE(status)) {
- return nullptr;
+ parsePosition.setErrorIndex(startIndex + result.charEnd);
+ }
+}
+
+CurrencyAmount* DecimalFormat::parseCurrency(const UnicodeString& text, ParsePosition& parsePosition) const {
+ if (fields == nullptr) {
+ return nullptr;
+ }
+ if (parsePosition.getIndex() < 0 || parsePosition.getIndex() >= text.length()) {
+ return nullptr;
+ }
+
+ ErrorCode status;
+ ParsedNumber result;
+ // Note: if this is a currency instance, currencies will be matched despite the fact that we are not in the
+ // parseCurrency method (backwards compatibility)
+ int32_t startIndex = parsePosition.getIndex();
+ const NumberParserImpl* parser = getCurrencyParser(status);
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ parser->parse(text, startIndex, true, result, status);
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ // TODO: Do we need to check for fImpl->properties->parseAllInput (UCONFIG_HAVE_PARSEALLINPUT) here?
+ if (result.success()) {
+ parsePosition.setIndex(result.charEnd);
+ Formattable formattable;
+ result.populateFormattable(formattable, parser->getParseFlags());
+ LocalPointer<CurrencyAmount> currencyAmount(
+ new CurrencyAmount(formattable, result.currencyCode, status), status);
+ if (U_FAILURE(status)) {
+ return nullptr;
}
- return currencyAmount.orphan();
- } else {
- parsePosition.setErrorIndex(startIndex + result.charEnd);
- return nullptr;
+ return currencyAmount.orphan();
+ } else {
+ parsePosition.setErrorIndex(startIndex + result.charEnd);
+ return nullptr;
}
}
-const DecimalFormatSymbols* DecimalFormat::getDecimalFormatSymbols(void) const {
- if (fields == nullptr) {
- return nullptr;
+const DecimalFormatSymbols* DecimalFormat::getDecimalFormatSymbols(void) const {
+ if (fields == nullptr) {
+ return nullptr;
}
- return fields->symbols.getAlias();
+ return fields->symbols.getAlias();
}
-void DecimalFormat::adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt) {
- if (symbolsToAdopt == nullptr) {
- return; // do not allow caller to set fields->symbols to NULL
+void DecimalFormat::adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt) {
+ if (symbolsToAdopt == nullptr) {
+ return; // do not allow caller to set fields->symbols to NULL
+ }
+ // we must take ownership of symbolsToAdopt, even in a failure case.
+ LocalPointer<DecimalFormatSymbols> dfs(symbolsToAdopt);
+ if (fields == nullptr) {
+ return;
}
- // we must take ownership of symbolsToAdopt, even in a failure case.
- LocalPointer<DecimalFormatSymbols> dfs(symbolsToAdopt);
- if (fields == nullptr) {
- return;
- }
- fields->symbols.adoptInstead(dfs.orphan());
- touchNoError();
-}
+ fields->symbols.adoptInstead(dfs.orphan());
+ touchNoError();
+}
-void DecimalFormat::setDecimalFormatSymbols(const DecimalFormatSymbols& symbols) {
- if (fields == nullptr) {
- return;
+void DecimalFormat::setDecimalFormatSymbols(const DecimalFormatSymbols& symbols) {
+ if (fields == nullptr) {
+ return;
}
- UErrorCode status = U_ZERO_ERROR;
- LocalPointer<DecimalFormatSymbols> dfs(new DecimalFormatSymbols(symbols), status);
- if (U_FAILURE(status)) {
- // We failed to allocate DecimalFormatSymbols, release fields and its members.
- // We must have a fully complete fields object, we cannot have partially populated members.
- delete fields;
- fields = nullptr;
- return;
+ UErrorCode status = U_ZERO_ERROR;
+ LocalPointer<DecimalFormatSymbols> dfs(new DecimalFormatSymbols(symbols), status);
+ if (U_FAILURE(status)) {
+ // We failed to allocate DecimalFormatSymbols, release fields and its members.
+ // We must have a fully complete fields object, we cannot have partially populated members.
+ delete fields;
+ fields = nullptr;
+ return;
}
- fields->symbols.adoptInstead(dfs.orphan());
- touchNoError();
+ fields->symbols.adoptInstead(dfs.orphan());
+ touchNoError();
}
-const CurrencyPluralInfo* DecimalFormat::getCurrencyPluralInfo(void) const {
- if (fields == nullptr) {
- return nullptr;
+const CurrencyPluralInfo* DecimalFormat::getCurrencyPluralInfo(void) const {
+ if (fields == nullptr) {
+ return nullptr;
}
- return fields->properties.currencyPluralInfo.fPtr.getAlias();
+ return fields->properties.currencyPluralInfo.fPtr.getAlias();
}
-void DecimalFormat::adoptCurrencyPluralInfo(CurrencyPluralInfo* toAdopt) {
- // TODO: should we guard against nullptr input, like in adoptDecimalFormatSymbols?
- // we must take ownership of toAdopt, even in a failure case.
- LocalPointer<CurrencyPluralInfo> cpi(toAdopt);
- if (fields == nullptr) {
- return;
+void DecimalFormat::adoptCurrencyPluralInfo(CurrencyPluralInfo* toAdopt) {
+ // TODO: should we guard against nullptr input, like in adoptDecimalFormatSymbols?
+ // we must take ownership of toAdopt, even in a failure case.
+ LocalPointer<CurrencyPluralInfo> cpi(toAdopt);
+ if (fields == nullptr) {
+ return;
}
- fields->properties.currencyPluralInfo.fPtr.adoptInstead(cpi.orphan());
- touchNoError();
+ fields->properties.currencyPluralInfo.fPtr.adoptInstead(cpi.orphan());
+ touchNoError();
}
-void DecimalFormat::setCurrencyPluralInfo(const CurrencyPluralInfo& info) {
- if (fields == nullptr) {
- return;
+void DecimalFormat::setCurrencyPluralInfo(const CurrencyPluralInfo& info) {
+ if (fields == nullptr) {
+ return;
}
- if (fields->properties.currencyPluralInfo.fPtr.isNull()) {
- // Note: clone() can fail with OOM error, but we have no way to report it. :(
- fields->properties.currencyPluralInfo.fPtr.adoptInstead(info.clone());
+ if (fields->properties.currencyPluralInfo.fPtr.isNull()) {
+ // Note: clone() can fail with OOM error, but we have no way to report it. :(
+ fields->properties.currencyPluralInfo.fPtr.adoptInstead(info.clone());
} else {
- *fields->properties.currencyPluralInfo.fPtr = info; // copy-assignment operator
- }
- touchNoError();
-}
+ *fields->properties.currencyPluralInfo.fPtr = info; // copy-assignment operator
+ }
+ touchNoError();
+}
-UnicodeString& DecimalFormat::getPositivePrefix(UnicodeString& result) const {
- if (fields == nullptr) {
- result.setToBogus();
- return result;
+UnicodeString& DecimalFormat::getPositivePrefix(UnicodeString& result) const {
+ if (fields == nullptr) {
+ result.setToBogus();
+ return result;
}
- UErrorCode status = U_ZERO_ERROR;
- fields->formatter.getAffixImpl(true, false, result, status);
- if (U_FAILURE(status)) { result.setToBogus(); }
- return result;
+ UErrorCode status = U_ZERO_ERROR;
+ fields->formatter.getAffixImpl(true, false, result, status);
+ if (U_FAILURE(status)) { result.setToBogus(); }
+ return result;
}
-void DecimalFormat::setPositivePrefix(const UnicodeString& newValue) {
- if (fields == nullptr) {
- return;
- }
- if (newValue == fields->properties.positivePrefix) { return; }
- fields->properties.positivePrefix = newValue;
- touchNoError();
+void DecimalFormat::setPositivePrefix(const UnicodeString& newValue) {
+ if (fields == nullptr) {
+ return;
+ }
+ if (newValue == fields->properties.positivePrefix) { return; }
+ fields->properties.positivePrefix = newValue;
+ touchNoError();
}
-UnicodeString& DecimalFormat::getNegativePrefix(UnicodeString& result) const {
- if (fields == nullptr) {
- result.setToBogus();
- return result;
+UnicodeString& DecimalFormat::getNegativePrefix(UnicodeString& result) const {
+ if (fields == nullptr) {
+ result.setToBogus();
+ return result;
}
- UErrorCode status = U_ZERO_ERROR;
- fields->formatter.getAffixImpl(true, true, result, status);
- if (U_FAILURE(status)) { result.setToBogus(); }
- return result;
+ UErrorCode status = U_ZERO_ERROR;
+ fields->formatter.getAffixImpl(true, true, result, status);
+ if (U_FAILURE(status)) { result.setToBogus(); }
+ return result;
}
-void DecimalFormat::setNegativePrefix(const UnicodeString& newValue) {
- if (fields == nullptr) {
- return;
+void DecimalFormat::setNegativePrefix(const UnicodeString& newValue) {
+ if (fields == nullptr) {
+ return;
}
- if (newValue == fields->properties.negativePrefix) { return; }
- fields->properties.negativePrefix = newValue;
- touchNoError();
+ if (newValue == fields->properties.negativePrefix) { return; }
+ fields->properties.negativePrefix = newValue;
+ touchNoError();
}
-UnicodeString& DecimalFormat::getPositiveSuffix(UnicodeString& result) const {
- if (fields == nullptr) {
- result.setToBogus();
- return result;
+UnicodeString& DecimalFormat::getPositiveSuffix(UnicodeString& result) const {
+ if (fields == nullptr) {
+ result.setToBogus();
+ return result;
}
- UErrorCode status = U_ZERO_ERROR;
- fields->formatter.getAffixImpl(false, false, result, status);
- if (U_FAILURE(status)) { result.setToBogus(); }
- return result;
+ UErrorCode status = U_ZERO_ERROR;
+ fields->formatter.getAffixImpl(false, false, result, status);
+ if (U_FAILURE(status)) { result.setToBogus(); }
+ return result;
}
-void DecimalFormat::setPositiveSuffix(const UnicodeString& newValue) {
- if (fields == nullptr) {
- return;
+void DecimalFormat::setPositiveSuffix(const UnicodeString& newValue) {
+ if (fields == nullptr) {
+ return;
}
- if (newValue == fields->properties.positiveSuffix) { return; }
- fields->properties.positiveSuffix = newValue;
- touchNoError();
+ if (newValue == fields->properties.positiveSuffix) { return; }
+ fields->properties.positiveSuffix = newValue;
+ touchNoError();
}
-UnicodeString& DecimalFormat::getNegativeSuffix(UnicodeString& result) const {
- if (fields == nullptr) {
- result.setToBogus();
- return result;
+UnicodeString& DecimalFormat::getNegativeSuffix(UnicodeString& result) const {
+ if (fields == nullptr) {
+ result.setToBogus();
+ return result;
}
- UErrorCode status = U_ZERO_ERROR;
- fields->formatter.getAffixImpl(false, true, result, status);
- if (U_FAILURE(status)) { result.setToBogus(); }
- return result;
+ UErrorCode status = U_ZERO_ERROR;
+ fields->formatter.getAffixImpl(false, true, result, status);
+ if (U_FAILURE(status)) { result.setToBogus(); }
+ return result;
}
-void DecimalFormat::setNegativeSuffix(const UnicodeString& newValue) {
- if (fields == nullptr) {
- return;
+void DecimalFormat::setNegativeSuffix(const UnicodeString& newValue) {
+ if (fields == nullptr) {
+ return;
}
- if (newValue == fields->properties.negativeSuffix) { return; }
- fields->properties.negativeSuffix = newValue;
- touchNoError();
+ if (newValue == fields->properties.negativeSuffix) { return; }
+ fields->properties.negativeSuffix = newValue;
+ touchNoError();
}
-UBool DecimalFormat::isSignAlwaysShown() const {
- // Not much we can do to report an error.
- if (fields == nullptr) {
- return DecimalFormatProperties::getDefault().signAlwaysShown;
+UBool DecimalFormat::isSignAlwaysShown() const {
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ return DecimalFormatProperties::getDefault().signAlwaysShown;
}
- return fields->properties.signAlwaysShown;
+ return fields->properties.signAlwaysShown;
}
-void DecimalFormat::setSignAlwaysShown(UBool value) {
- if (fields == nullptr) { return; }
- if (UBOOL_TO_BOOL(value) == fields->properties.signAlwaysShown) { return; }
- fields->properties.signAlwaysShown = value;
- touchNoError();
+void DecimalFormat::setSignAlwaysShown(UBool value) {
+ if (fields == nullptr) { return; }
+ if (UBOOL_TO_BOOL(value) == fields->properties.signAlwaysShown) { return; }
+ fields->properties.signAlwaysShown = value;
+ touchNoError();
}
-int32_t DecimalFormat::getMultiplier(void) const {
- const DecimalFormatProperties *dfp;
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- dfp = &(DecimalFormatProperties::getDefault());
+int32_t DecimalFormat::getMultiplier(void) const {
+ const DecimalFormatProperties *dfp;
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ dfp = &(DecimalFormatProperties::getDefault());
+ } else {
+ dfp = &fields->properties;
+ }
+ if (dfp->multiplier != 1) {
+ return dfp->multiplier;
+ } else if (dfp->magnitudeMultiplier != 0) {
+ return static_cast<int32_t>(uprv_pow10(dfp->magnitudeMultiplier));
} else {
- dfp = &fields->properties;
- }
- if (dfp->multiplier != 1) {
- return dfp->multiplier;
- } else if (dfp->magnitudeMultiplier != 0) {
- return static_cast<int32_t>(uprv_pow10(dfp->magnitudeMultiplier));
- } else {
- return 1;
- }
-}
-
-void DecimalFormat::setMultiplier(int32_t multiplier) {
- if (fields == nullptr) {
- return;
- }
- if (multiplier == 0) {
- multiplier = 1; // one being the benign default value for a multiplier.
- }
-
- // Try to convert to a magnitude multiplier first
- int delta = 0;
- int value = multiplier;
- while (value != 1) {
- delta++;
- int temp = value / 10;
- if (temp * 10 != value) {
- delta = -1;
- break;
+ return 1;
+ }
+}
+
+void DecimalFormat::setMultiplier(int32_t multiplier) {
+ if (fields == nullptr) {
+ return;
+ }
+ if (multiplier == 0) {
+ multiplier = 1; // one being the benign default value for a multiplier.
+ }
+
+ // Try to convert to a magnitude multiplier first
+ int delta = 0;
+ int value = multiplier;
+ while (value != 1) {
+ delta++;
+ int temp = value / 10;
+ if (temp * 10 != value) {
+ delta = -1;
+ break;
}
- value = temp;
+ value = temp;
}
- if (delta != -1) {
- fields->properties.magnitudeMultiplier = delta;
- fields->properties.multiplier = 1;
- } else {
- fields->properties.magnitudeMultiplier = 0;
- fields->properties.multiplier = multiplier;
- }
- touchNoError();
+ if (delta != -1) {
+ fields->properties.magnitudeMultiplier = delta;
+ fields->properties.multiplier = 1;
+ } else {
+ fields->properties.magnitudeMultiplier = 0;
+ fields->properties.multiplier = multiplier;
+ }
+ touchNoError();
}
-int32_t DecimalFormat::getMultiplierScale() const {
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- return DecimalFormatProperties::getDefault().multiplierScale;
- }
- return fields->properties.multiplierScale;
+int32_t DecimalFormat::getMultiplierScale() const {
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ return DecimalFormatProperties::getDefault().multiplierScale;
+ }
+ return fields->properties.multiplierScale;
}
-void DecimalFormat::setMultiplierScale(int32_t newValue) {
- if (fields == nullptr) { return; }
- if (newValue == fields->properties.multiplierScale) { return; }
- fields->properties.multiplierScale = newValue;
- touchNoError();
+void DecimalFormat::setMultiplierScale(int32_t newValue) {
+ if (fields == nullptr) { return; }
+ if (newValue == fields->properties.multiplierScale) { return; }
+ fields->properties.multiplierScale = newValue;
+ touchNoError();
}
-double DecimalFormat::getRoundingIncrement(void) const {
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- return DecimalFormatProperties::getDefault().roundingIncrement;
- }
- return fields->exportedProperties.roundingIncrement;
+double DecimalFormat::getRoundingIncrement(void) const {
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ return DecimalFormatProperties::getDefault().roundingIncrement;
+ }
+ return fields->exportedProperties.roundingIncrement;
}
void DecimalFormat::setRoundingIncrement(double newValue) {
- if (fields == nullptr) { return; }
- if (newValue == fields->properties.roundingIncrement) { return; }
- fields->properties.roundingIncrement = newValue;
- touchNoError();
+ if (fields == nullptr) { return; }
+ if (newValue == fields->properties.roundingIncrement) { return; }
+ fields->properties.roundingIncrement = newValue;
+ touchNoError();
}
-ERoundingMode DecimalFormat::getRoundingMode(void) const {
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- return static_cast<ERoundingMode>(DecimalFormatProperties::getDefault().roundingMode.getNoError());
- }
- // UNumberFormatRoundingMode and ERoundingMode have the same values.
- return static_cast<ERoundingMode>(fields->exportedProperties.roundingMode.getNoError());
+ERoundingMode DecimalFormat::getRoundingMode(void) const {
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ return static_cast<ERoundingMode>(DecimalFormatProperties::getDefault().roundingMode.getNoError());
+ }
+ // UNumberFormatRoundingMode and ERoundingMode have the same values.
+ return static_cast<ERoundingMode>(fields->exportedProperties.roundingMode.getNoError());
}
void DecimalFormat::setRoundingMode(ERoundingMode roundingMode) {
- if (fields == nullptr) { return; }
- auto uRoundingMode = static_cast<UNumberFormatRoundingMode>(roundingMode);
- if (!fields->properties.roundingMode.isNull() && uRoundingMode == fields->properties.roundingMode.getNoError()) {
- return;
- }
- NumberFormat::setMaximumIntegerDigits(roundingMode); // to set field for compatibility
- fields->properties.roundingMode = uRoundingMode;
- touchNoError();
+ if (fields == nullptr) { return; }
+ auto uRoundingMode = static_cast<UNumberFormatRoundingMode>(roundingMode);
+ if (!fields->properties.roundingMode.isNull() && uRoundingMode == fields->properties.roundingMode.getNoError()) {
+ return;
+ }
+ NumberFormat::setMaximumIntegerDigits(roundingMode); // to set field for compatibility
+ fields->properties.roundingMode = uRoundingMode;
+ touchNoError();
}
-int32_t DecimalFormat::getFormatWidth(void) const {
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- return DecimalFormatProperties::getDefault().formatWidth;
- }
- return fields->properties.formatWidth;
+int32_t DecimalFormat::getFormatWidth(void) const {
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ return DecimalFormatProperties::getDefault().formatWidth;
+ }
+ return fields->properties.formatWidth;
}
void DecimalFormat::setFormatWidth(int32_t width) {
- if (fields == nullptr) { return; }
- if (width == fields->properties.formatWidth) { return; }
- fields->properties.formatWidth = width;
- touchNoError();
+ if (fields == nullptr) { return; }
+ if (width == fields->properties.formatWidth) { return; }
+ fields->properties.formatWidth = width;
+ touchNoError();
}
UnicodeString DecimalFormat::getPadCharacterString() const {
- if (fields == nullptr || fields->properties.padString.isBogus()) {
- // Readonly-alias the static string kFallbackPaddingString
- return {TRUE, kFallbackPaddingString, -1};
- } else {
- return fields->properties.padString;
- }
+ if (fields == nullptr || fields->properties.padString.isBogus()) {
+ // Readonly-alias the static string kFallbackPaddingString
+ return {TRUE, kFallbackPaddingString, -1};
+ } else {
+ return fields->properties.padString;
+ }
}
-void DecimalFormat::setPadCharacter(const UnicodeString& padChar) {
- if (fields == nullptr) { return; }
- if (padChar == fields->properties.padString) { return; }
+void DecimalFormat::setPadCharacter(const UnicodeString& padChar) {
+ if (fields == nullptr) { return; }
+ if (padChar == fields->properties.padString) { return; }
if (padChar.length() > 0) {
- fields->properties.padString = UnicodeString(padChar.char32At(0));
- } else {
- fields->properties.padString.setToBogus();
+ fields->properties.padString = UnicodeString(padChar.char32At(0));
+ } else {
+ fields->properties.padString.setToBogus();
}
- touchNoError();
+ touchNoError();
}
-EPadPosition DecimalFormat::getPadPosition(void) const {
- if (fields == nullptr || fields->properties.padPosition.isNull()) {
- return EPadPosition::kPadBeforePrefix;
- } else {
- // UNumberFormatPadPosition and EPadPosition have the same values.
- return static_cast<EPadPosition>(fields->properties.padPosition.getNoError());
+EPadPosition DecimalFormat::getPadPosition(void) const {
+ if (fields == nullptr || fields->properties.padPosition.isNull()) {
+ return EPadPosition::kPadBeforePrefix;
+ } else {
+ // UNumberFormatPadPosition and EPadPosition have the same values.
+ return static_cast<EPadPosition>(fields->properties.padPosition.getNoError());
}
}
-void DecimalFormat::setPadPosition(EPadPosition padPos) {
- if (fields == nullptr) { return; }
- auto uPadPos = static_cast<UNumberFormatPadPosition>(padPos);
- if (!fields->properties.padPosition.isNull() && uPadPos == fields->properties.padPosition.getNoError()) {
- return;
- }
- fields->properties.padPosition = uPadPos;
- touchNoError();
+void DecimalFormat::setPadPosition(EPadPosition padPos) {
+ if (fields == nullptr) { return; }
+ auto uPadPos = static_cast<UNumberFormatPadPosition>(padPos);
+ if (!fields->properties.padPosition.isNull() && uPadPos == fields->properties.padPosition.getNoError()) {
+ return;
+ }
+ fields->properties.padPosition = uPadPos;
+ touchNoError();
}
-UBool DecimalFormat::isScientificNotation(void) const {
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- return (DecimalFormatProperties::getDefault().minimumExponentDigits != -1);
+UBool DecimalFormat::isScientificNotation(void) const {
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ return (DecimalFormatProperties::getDefault().minimumExponentDigits != -1);
}
- return (fields->properties.minimumExponentDigits != -1);
+ return (fields->properties.minimumExponentDigits != -1);
}
void DecimalFormat::setScientificNotation(UBool useScientific) {
- if (fields == nullptr) { return; }
- int32_t minExp = useScientific ? 1 : -1;
- if (fields->properties.minimumExponentDigits == minExp) { return; }
- if (useScientific) {
- fields->properties.minimumExponentDigits = 1;
- } else {
- fields->properties.minimumExponentDigits = -1;
- }
- touchNoError();
-}
-
-int8_t DecimalFormat::getMinimumExponentDigits(void) const {
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- return static_cast<int8_t>(DecimalFormatProperties::getDefault().minimumExponentDigits);
- }
- return static_cast<int8_t>(fields->properties.minimumExponentDigits);
+ if (fields == nullptr) { return; }
+ int32_t minExp = useScientific ? 1 : -1;
+ if (fields->properties.minimumExponentDigits == minExp) { return; }
+ if (useScientific) {
+ fields->properties.minimumExponentDigits = 1;
+ } else {
+ fields->properties.minimumExponentDigits = -1;
+ }
+ touchNoError();
+}
+
+int8_t DecimalFormat::getMinimumExponentDigits(void) const {
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ return static_cast<int8_t>(DecimalFormatProperties::getDefault().minimumExponentDigits);
+ }
+ return static_cast<int8_t>(fields->properties.minimumExponentDigits);
}
void DecimalFormat::setMinimumExponentDigits(int8_t minExpDig) {
- if (fields == nullptr) { return; }
- if (minExpDig == fields->properties.minimumExponentDigits) { return; }
- fields->properties.minimumExponentDigits = minExpDig;
- touchNoError();
+ if (fields == nullptr) { return; }
+ if (minExpDig == fields->properties.minimumExponentDigits) { return; }
+ fields->properties.minimumExponentDigits = minExpDig;
+ touchNoError();
}
-UBool DecimalFormat::isExponentSignAlwaysShown(void) const {
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- return DecimalFormatProperties::getDefault().exponentSignAlwaysShown;
- }
- return fields->properties.exponentSignAlwaysShown;
+UBool DecimalFormat::isExponentSignAlwaysShown(void) const {
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ return DecimalFormatProperties::getDefault().exponentSignAlwaysShown;
+ }
+ return fields->properties.exponentSignAlwaysShown;
}
void DecimalFormat::setExponentSignAlwaysShown(UBool expSignAlways) {
- if (fields == nullptr) { return; }
- if (UBOOL_TO_BOOL(expSignAlways) == fields->properties.exponentSignAlwaysShown) { return; }
- fields->properties.exponentSignAlwaysShown = expSignAlways;
- touchNoError();
-}
-
-int32_t DecimalFormat::getGroupingSize(void) const {
- int32_t groupingSize;
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- groupingSize = DecimalFormatProperties::getDefault().groupingSize;
- } else {
- groupingSize = fields->properties.groupingSize;
- }
- if (groupingSize < 0) {
- return 0;
- }
- return groupingSize;
-}
-
-void DecimalFormat::setGroupingSize(int32_t newValue) {
- if (fields == nullptr) { return; }
- if (newValue == fields->properties.groupingSize) { return; }
- fields->properties.groupingSize = newValue;
- touchNoError();
-}
-
-int32_t DecimalFormat::getSecondaryGroupingSize(void) const {
- int32_t grouping2;
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- grouping2 = DecimalFormatProperties::getDefault().secondaryGroupingSize;
- } else {
- grouping2 = fields->properties.secondaryGroupingSize;
- }
- if (grouping2 < 0) {
- return 0;
- }
- return grouping2;
-}
-
-void DecimalFormat::setSecondaryGroupingSize(int32_t newValue) {
- if (fields == nullptr) { return; }
- if (newValue == fields->properties.secondaryGroupingSize) { return; }
- fields->properties.secondaryGroupingSize = newValue;
- touchNoError();
-}
-
-int32_t DecimalFormat::getMinimumGroupingDigits() const {
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- return DecimalFormatProperties::getDefault().minimumGroupingDigits;
- }
- return fields->properties.minimumGroupingDigits;
-}
-
-void DecimalFormat::setMinimumGroupingDigits(int32_t newValue) {
- if (fields == nullptr) { return; }
- if (newValue == fields->properties.minimumGroupingDigits) { return; }
- fields->properties.minimumGroupingDigits = newValue;
- touchNoError();
-}
-
-UBool DecimalFormat::isDecimalSeparatorAlwaysShown(void) const {
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- return DecimalFormatProperties::getDefault().decimalSeparatorAlwaysShown;
- }
- return fields->properties.decimalSeparatorAlwaysShown;
-}
-
-void DecimalFormat::setDecimalSeparatorAlwaysShown(UBool newValue) {
- if (fields == nullptr) { return; }
- if (UBOOL_TO_BOOL(newValue) == fields->properties.decimalSeparatorAlwaysShown) { return; }
- fields->properties.decimalSeparatorAlwaysShown = newValue;
- touchNoError();
-}
-
-UBool DecimalFormat::isDecimalPatternMatchRequired(void) const {
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- return DecimalFormatProperties::getDefault().decimalPatternMatchRequired;
- }
- return fields->properties.decimalPatternMatchRequired;
-}
-
-void DecimalFormat::setDecimalPatternMatchRequired(UBool newValue) {
- if (fields == nullptr) { return; }
- if (UBOOL_TO_BOOL(newValue) == fields->properties.decimalPatternMatchRequired) { return; }
- fields->properties.decimalPatternMatchRequired = newValue;
- touchNoError();
-}
-
-UBool DecimalFormat::isParseNoExponent() const {
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- return DecimalFormatProperties::getDefault().parseNoExponent;
- }
- return fields->properties.parseNoExponent;
-}
-
-void DecimalFormat::setParseNoExponent(UBool value) {
- if (fields == nullptr) { return; }
- if (UBOOL_TO_BOOL(value) == fields->properties.parseNoExponent) { return; }
- fields->properties.parseNoExponent = value;
- touchNoError();
-}
-
-UBool DecimalFormat::isParseCaseSensitive() const {
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- return DecimalFormatProperties::getDefault().parseCaseSensitive;
- }
- return fields->properties.parseCaseSensitive;
-}
-
-void DecimalFormat::setParseCaseSensitive(UBool value) {
- if (fields == nullptr) { return; }
- if (UBOOL_TO_BOOL(value) == fields->properties.parseCaseSensitive) { return; }
- fields->properties.parseCaseSensitive = value;
- touchNoError();
-}
-
-UBool DecimalFormat::isFormatFailIfMoreThanMaxDigits() const {
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- return DecimalFormatProperties::getDefault().formatFailIfMoreThanMaxDigits;
- }
- return fields->properties.formatFailIfMoreThanMaxDigits;
-}
-
-void DecimalFormat::setFormatFailIfMoreThanMaxDigits(UBool value) {
- if (fields == nullptr) { return; }
- if (UBOOL_TO_BOOL(value) == fields->properties.formatFailIfMoreThanMaxDigits) { return; }
- fields->properties.formatFailIfMoreThanMaxDigits = value;
- touchNoError();
-}
-
-UnicodeString& DecimalFormat::toPattern(UnicodeString& result) const {
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
- result.setToBogus();
- return result;
- }
- // Pull some properties from exportedProperties and others from properties
- // to keep affix patterns intact. In particular, pull rounding properties
- // so that CurrencyUsage is reflected properly.
- // TODO: Consider putting this logic in number_patternstring.cpp instead.
- ErrorCode localStatus;
- DecimalFormatProperties tprops(fields->properties);
- bool useCurrency = (
- !tprops.currency.isNull() ||
- !tprops.currencyPluralInfo.fPtr.isNull() ||
- !tprops.currencyUsage.isNull() ||
- AffixUtils::hasCurrencySymbols(tprops.positivePrefixPattern, localStatus) ||
- AffixUtils::hasCurrencySymbols(tprops.positiveSuffixPattern, localStatus) ||
- AffixUtils::hasCurrencySymbols(tprops.negativePrefixPattern, localStatus) ||
- AffixUtils::hasCurrencySymbols(tprops.negativeSuffixPattern, localStatus));
- if (useCurrency) {
- tprops.minimumFractionDigits = fields->exportedProperties.minimumFractionDigits;
- tprops.maximumFractionDigits = fields->exportedProperties.maximumFractionDigits;
- tprops.roundingIncrement = fields->exportedProperties.roundingIncrement;
- }
- result = PatternStringUtils::propertiesToPatternString(tprops, localStatus);
- return result;
-}
-
-UnicodeString& DecimalFormat::toLocalizedPattern(UnicodeString& result) const {
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
- result.setToBogus();
- return result;
- }
- ErrorCode localStatus;
- result = toPattern(result);
- result = PatternStringUtils::convertLocalized(result, *fields->symbols, true, localStatus);
- return result;
-}
-
-void DecimalFormat::applyPattern(const UnicodeString& pattern, UParseError&, UErrorCode& status) {
- // TODO: What is parseError for?
- applyPattern(pattern, status);
-}
-
-void DecimalFormat::applyPattern(const UnicodeString& pattern, UErrorCode& status) {
- // don't overwrite status if it's already a failure.
- if (U_FAILURE(status)) { return; }
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- setPropertiesFromPattern(pattern, IGNORE_ROUNDING_NEVER, status);
- touch(status);
-}
-
-void DecimalFormat::applyLocalizedPattern(const UnicodeString& localizedPattern, UParseError&,
- UErrorCode& status) {
- // TODO: What is parseError for?
- applyLocalizedPattern(localizedPattern, status);
-}
-
-void DecimalFormat::applyLocalizedPattern(const UnicodeString& localizedPattern, UErrorCode& status) {
- // don't overwrite status if it's already a failure.
- if (U_FAILURE(status)) { return; }
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- UnicodeString pattern = PatternStringUtils::convertLocalized(
- localizedPattern, *fields->symbols, false, status);
- applyPattern(pattern, status);
+ if (fields == nullptr) { return; }
+ if (UBOOL_TO_BOOL(expSignAlways) == fields->properties.exponentSignAlwaysShown) { return; }
+ fields->properties.exponentSignAlwaysShown = expSignAlways;
+ touchNoError();
+}
+
+int32_t DecimalFormat::getGroupingSize(void) const {
+ int32_t groupingSize;
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ groupingSize = DecimalFormatProperties::getDefault().groupingSize;
+ } else {
+ groupingSize = fields->properties.groupingSize;
+ }
+ if (groupingSize < 0) {
+ return 0;
+ }
+ return groupingSize;
+}
+
+void DecimalFormat::setGroupingSize(int32_t newValue) {
+ if (fields == nullptr) { return; }
+ if (newValue == fields->properties.groupingSize) { return; }
+ fields->properties.groupingSize = newValue;
+ touchNoError();
+}
+
+int32_t DecimalFormat::getSecondaryGroupingSize(void) const {
+ int32_t grouping2;
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ grouping2 = DecimalFormatProperties::getDefault().secondaryGroupingSize;
+ } else {
+ grouping2 = fields->properties.secondaryGroupingSize;
+ }
+ if (grouping2 < 0) {
+ return 0;
+ }
+ return grouping2;
+}
+
+void DecimalFormat::setSecondaryGroupingSize(int32_t newValue) {
+ if (fields == nullptr) { return; }
+ if (newValue == fields->properties.secondaryGroupingSize) { return; }
+ fields->properties.secondaryGroupingSize = newValue;
+ touchNoError();
+}
+
+int32_t DecimalFormat::getMinimumGroupingDigits() const {
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ return DecimalFormatProperties::getDefault().minimumGroupingDigits;
+ }
+ return fields->properties.minimumGroupingDigits;
+}
+
+void DecimalFormat::setMinimumGroupingDigits(int32_t newValue) {
+ if (fields == nullptr) { return; }
+ if (newValue == fields->properties.minimumGroupingDigits) { return; }
+ fields->properties.minimumGroupingDigits = newValue;
+ touchNoError();
+}
+
+UBool DecimalFormat::isDecimalSeparatorAlwaysShown(void) const {
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ return DecimalFormatProperties::getDefault().decimalSeparatorAlwaysShown;
+ }
+ return fields->properties.decimalSeparatorAlwaysShown;
+}
+
+void DecimalFormat::setDecimalSeparatorAlwaysShown(UBool newValue) {
+ if (fields == nullptr) { return; }
+ if (UBOOL_TO_BOOL(newValue) == fields->properties.decimalSeparatorAlwaysShown) { return; }
+ fields->properties.decimalSeparatorAlwaysShown = newValue;
+ touchNoError();
+}
+
+UBool DecimalFormat::isDecimalPatternMatchRequired(void) const {
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ return DecimalFormatProperties::getDefault().decimalPatternMatchRequired;
+ }
+ return fields->properties.decimalPatternMatchRequired;
+}
+
+void DecimalFormat::setDecimalPatternMatchRequired(UBool newValue) {
+ if (fields == nullptr) { return; }
+ if (UBOOL_TO_BOOL(newValue) == fields->properties.decimalPatternMatchRequired) { return; }
+ fields->properties.decimalPatternMatchRequired = newValue;
+ touchNoError();
+}
+
+UBool DecimalFormat::isParseNoExponent() const {
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ return DecimalFormatProperties::getDefault().parseNoExponent;
+ }
+ return fields->properties.parseNoExponent;
+}
+
+void DecimalFormat::setParseNoExponent(UBool value) {
+ if (fields == nullptr) { return; }
+ if (UBOOL_TO_BOOL(value) == fields->properties.parseNoExponent) { return; }
+ fields->properties.parseNoExponent = value;
+ touchNoError();
+}
+
+UBool DecimalFormat::isParseCaseSensitive() const {
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ return DecimalFormatProperties::getDefault().parseCaseSensitive;
+ }
+ return fields->properties.parseCaseSensitive;
+}
+
+void DecimalFormat::setParseCaseSensitive(UBool value) {
+ if (fields == nullptr) { return; }
+ if (UBOOL_TO_BOOL(value) == fields->properties.parseCaseSensitive) { return; }
+ fields->properties.parseCaseSensitive = value;
+ touchNoError();
+}
+
+UBool DecimalFormat::isFormatFailIfMoreThanMaxDigits() const {
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ return DecimalFormatProperties::getDefault().formatFailIfMoreThanMaxDigits;
+ }
+ return fields->properties.formatFailIfMoreThanMaxDigits;
+}
+
+void DecimalFormat::setFormatFailIfMoreThanMaxDigits(UBool value) {
+ if (fields == nullptr) { return; }
+ if (UBOOL_TO_BOOL(value) == fields->properties.formatFailIfMoreThanMaxDigits) { return; }
+ fields->properties.formatFailIfMoreThanMaxDigits = value;
+ touchNoError();
+}
+
+UnicodeString& DecimalFormat::toPattern(UnicodeString& result) const {
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+ result.setToBogus();
+ return result;
+ }
+ // Pull some properties from exportedProperties and others from properties
+ // to keep affix patterns intact. In particular, pull rounding properties
+ // so that CurrencyUsage is reflected properly.
+ // TODO: Consider putting this logic in number_patternstring.cpp instead.
+ ErrorCode localStatus;
+ DecimalFormatProperties tprops(fields->properties);
+ bool useCurrency = (
+ !tprops.currency.isNull() ||
+ !tprops.currencyPluralInfo.fPtr.isNull() ||
+ !tprops.currencyUsage.isNull() ||
+ AffixUtils::hasCurrencySymbols(tprops.positivePrefixPattern, localStatus) ||
+ AffixUtils::hasCurrencySymbols(tprops.positiveSuffixPattern, localStatus) ||
+ AffixUtils::hasCurrencySymbols(tprops.negativePrefixPattern, localStatus) ||
+ AffixUtils::hasCurrencySymbols(tprops.negativeSuffixPattern, localStatus));
+ if (useCurrency) {
+ tprops.minimumFractionDigits = fields->exportedProperties.minimumFractionDigits;
+ tprops.maximumFractionDigits = fields->exportedProperties.maximumFractionDigits;
+ tprops.roundingIncrement = fields->exportedProperties.roundingIncrement;
+ }
+ result = PatternStringUtils::propertiesToPatternString(tprops, localStatus);
+ return result;
+}
+
+UnicodeString& DecimalFormat::toLocalizedPattern(UnicodeString& result) const {
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+ result.setToBogus();
+ return result;
+ }
+ ErrorCode localStatus;
+ result = toPattern(result);
+ result = PatternStringUtils::convertLocalized(result, *fields->symbols, true, localStatus);
+ return result;
+}
+
+void DecimalFormat::applyPattern(const UnicodeString& pattern, UParseError&, UErrorCode& status) {
+ // TODO: What is parseError for?
+ applyPattern(pattern, status);
+}
+
+void DecimalFormat::applyPattern(const UnicodeString& pattern, UErrorCode& status) {
+ // don't overwrite status if it's already a failure.
+ if (U_FAILURE(status)) { return; }
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ setPropertiesFromPattern(pattern, IGNORE_ROUNDING_NEVER, status);
+ touch(status);
+}
+
+void DecimalFormat::applyLocalizedPattern(const UnicodeString& localizedPattern, UParseError&,
+ UErrorCode& status) {
+ // TODO: What is parseError for?
+ applyLocalizedPattern(localizedPattern, status);
+}
+
+void DecimalFormat::applyLocalizedPattern(const UnicodeString& localizedPattern, UErrorCode& status) {
+ // don't overwrite status if it's already a failure.
+ if (U_FAILURE(status)) { return; }
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ UnicodeString pattern = PatternStringUtils::convertLocalized(
+ localizedPattern, *fields->symbols, false, status);
+ applyPattern(pattern, status);
}
void DecimalFormat::setMaximumIntegerDigits(int32_t newValue) {
- if (fields == nullptr) { return; }
- if (newValue == fields->properties.maximumIntegerDigits) { return; }
- // For backwards compatibility, conflicting min/max need to keep the most recent setting.
- int32_t min = fields->properties.minimumIntegerDigits;
- if (min >= 0 && min > newValue) {
- fields->properties.minimumIntegerDigits = newValue;
- }
- fields->properties.maximumIntegerDigits = newValue;
- touchNoError();
+ if (fields == nullptr) { return; }
+ if (newValue == fields->properties.maximumIntegerDigits) { return; }
+ // For backwards compatibility, conflicting min/max need to keep the most recent setting.
+ int32_t min = fields->properties.minimumIntegerDigits;
+ if (min >= 0 && min > newValue) {
+ fields->properties.minimumIntegerDigits = newValue;
+ }
+ fields->properties.maximumIntegerDigits = newValue;
+ touchNoError();
}
void DecimalFormat::setMinimumIntegerDigits(int32_t newValue) {
- if (fields == nullptr) { return; }
- if (newValue == fields->properties.minimumIntegerDigits) { return; }
- // For backwards compatibility, conflicting min/max need to keep the most recent setting.
- int32_t max = fields->properties.maximumIntegerDigits;
- if (max >= 0 && max < newValue) {
- fields->properties.maximumIntegerDigits = newValue;
- }
- fields->properties.minimumIntegerDigits = newValue;
- touchNoError();
+ if (fields == nullptr) { return; }
+ if (newValue == fields->properties.minimumIntegerDigits) { return; }
+ // For backwards compatibility, conflicting min/max need to keep the most recent setting.
+ int32_t max = fields->properties.maximumIntegerDigits;
+ if (max >= 0 && max < newValue) {
+ fields->properties.maximumIntegerDigits = newValue;
+ }
+ fields->properties.minimumIntegerDigits = newValue;
+ touchNoError();
}
void DecimalFormat::setMaximumFractionDigits(int32_t newValue) {
- if (fields == nullptr) { return; }
- if (newValue == fields->properties.maximumFractionDigits) { return; }
- // cap for backward compatibility, formerly 340, now 999
- if (newValue > kMaxIntFracSig) {
- newValue = kMaxIntFracSig;
- }
- // For backwards compatibility, conflicting min/max need to keep the most recent setting.
- int32_t min = fields->properties.minimumFractionDigits;
- if (min >= 0 && min > newValue) {
- fields->properties.minimumFractionDigits = newValue;
- }
- fields->properties.maximumFractionDigits = newValue;
- touchNoError();
+ if (fields == nullptr) { return; }
+ if (newValue == fields->properties.maximumFractionDigits) { return; }
+ // cap for backward compatibility, formerly 340, now 999
+ if (newValue > kMaxIntFracSig) {
+ newValue = kMaxIntFracSig;
+ }
+ // For backwards compatibility, conflicting min/max need to keep the most recent setting.
+ int32_t min = fields->properties.minimumFractionDigits;
+ if (min >= 0 && min > newValue) {
+ fields->properties.minimumFractionDigits = newValue;
+ }
+ fields->properties.maximumFractionDigits = newValue;
+ touchNoError();
}
void DecimalFormat::setMinimumFractionDigits(int32_t newValue) {
- if (fields == nullptr) { return; }
- if (newValue == fields->properties.minimumFractionDigits) { return; }
- // For backwards compatibility, conflicting min/max need to keep the most recent setting.
- int32_t max = fields->properties.maximumFractionDigits;
- if (max >= 0 && max < newValue) {
- fields->properties.maximumFractionDigits = newValue;
- }
- fields->properties.minimumFractionDigits = newValue;
- touchNoError();
+ if (fields == nullptr) { return; }
+ if (newValue == fields->properties.minimumFractionDigits) { return; }
+ // For backwards compatibility, conflicting min/max need to keep the most recent setting.
+ int32_t max = fields->properties.maximumFractionDigits;
+ if (max >= 0 && max < newValue) {
+ fields->properties.maximumFractionDigits = newValue;
+ }
+ fields->properties.minimumFractionDigits = newValue;
+ touchNoError();
}
int32_t DecimalFormat::getMinimumSignificantDigits() const {
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- return DecimalFormatProperties::getDefault().minimumSignificantDigits;
- }
- return fields->exportedProperties.minimumSignificantDigits;
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ return DecimalFormatProperties::getDefault().minimumSignificantDigits;
+ }
+ return fields->exportedProperties.minimumSignificantDigits;
}
int32_t DecimalFormat::getMaximumSignificantDigits() const {
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- return DecimalFormatProperties::getDefault().maximumSignificantDigits;
- }
- return fields->exportedProperties.maximumSignificantDigits;
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ return DecimalFormatProperties::getDefault().maximumSignificantDigits;
+ }
+ return fields->exportedProperties.maximumSignificantDigits;
}
-void DecimalFormat::setMinimumSignificantDigits(int32_t value) {
- if (fields == nullptr) { return; }
- if (value == fields->properties.minimumSignificantDigits) { return; }
- int32_t max = fields->properties.maximumSignificantDigits;
- if (max >= 0 && max < value) {
- fields->properties.maximumSignificantDigits = value;
+void DecimalFormat::setMinimumSignificantDigits(int32_t value) {
+ if (fields == nullptr) { return; }
+ if (value == fields->properties.minimumSignificantDigits) { return; }
+ int32_t max = fields->properties.maximumSignificantDigits;
+ if (max >= 0 && max < value) {
+ fields->properties.maximumSignificantDigits = value;
}
- fields->properties.minimumSignificantDigits = value;
- touchNoError();
+ fields->properties.minimumSignificantDigits = value;
+ touchNoError();
}
-void DecimalFormat::setMaximumSignificantDigits(int32_t value) {
- if (fields == nullptr) { return; }
- if (value == fields->properties.maximumSignificantDigits) { return; }
- int32_t min = fields->properties.minimumSignificantDigits;
- if (min >= 0 && min > value) {
- fields->properties.minimumSignificantDigits = value;
+void DecimalFormat::setMaximumSignificantDigits(int32_t value) {
+ if (fields == nullptr) { return; }
+ if (value == fields->properties.maximumSignificantDigits) { return; }
+ int32_t min = fields->properties.minimumSignificantDigits;
+ if (min >= 0 && min > value) {
+ fields->properties.minimumSignificantDigits = value;
}
- fields->properties.maximumSignificantDigits = value;
- touchNoError();
+ fields->properties.maximumSignificantDigits = value;
+ touchNoError();
}
UBool DecimalFormat::areSignificantDigitsUsed() const {
- const DecimalFormatProperties* dfp;
- // Not much we can do to report an error.
- if (fields == nullptr) {
- // Fallback to using the default instance of DecimalFormatProperties.
- dfp = &(DecimalFormatProperties::getDefault());
- } else {
- dfp = &fields->properties;
- }
- return dfp->minimumSignificantDigits != -1 || dfp->maximumSignificantDigits != -1;
+ const DecimalFormatProperties* dfp;
+ // Not much we can do to report an error.
+ if (fields == nullptr) {
+ // Fallback to using the default instance of DecimalFormatProperties.
+ dfp = &(DecimalFormatProperties::getDefault());
+ } else {
+ dfp = &fields->properties;
+ }
+ return dfp->minimumSignificantDigits != -1 || dfp->maximumSignificantDigits != -1;
}
void DecimalFormat::setSignificantDigitsUsed(UBool useSignificantDigits) {
- if (fields == nullptr) { return; }
-
- // These are the default values from the old implementation.
- if (useSignificantDigits) {
- if (fields->properties.minimumSignificantDigits != -1 ||
- fields->properties.maximumSignificantDigits != -1) {
- return;
- }
- } else {
- if (fields->properties.minimumSignificantDigits == -1 &&
- fields->properties.maximumSignificantDigits == -1) {
- return;
- }
- }
- int32_t minSig = useSignificantDigits ? 1 : -1;
- int32_t maxSig = useSignificantDigits ? 6 : -1;
- fields->properties.minimumSignificantDigits = minSig;
- fields->properties.maximumSignificantDigits = maxSig;
- touchNoError();
-}
-
-void DecimalFormat::setCurrency(const char16_t* theCurrency, UErrorCode& ec) {
- // don't overwrite ec if it's already a failure.
- if (U_FAILURE(ec)) { return; }
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
- ec = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- CurrencyUnit currencyUnit(theCurrency, ec);
- if (U_FAILURE(ec)) { return; }
- if (!fields->properties.currency.isNull() && fields->properties.currency.getNoError() == currencyUnit) {
- return;
- }
- NumberFormat::setCurrency(theCurrency, ec); // to set field for compatibility
- fields->properties.currency = currencyUnit;
- // In Java, the DecimalFormatSymbols is mutable. Why not in C++?
- LocalPointer<DecimalFormatSymbols> newSymbols(new DecimalFormatSymbols(*fields->symbols), ec);
- newSymbols->setCurrency(currencyUnit.getISOCurrency(), ec);
- fields->symbols.adoptInsteadAndCheckErrorCode(newSymbols.orphan(), ec);
- touch(ec);
-}
-
-void DecimalFormat::setCurrency(const char16_t* theCurrency) {
- ErrorCode localStatus;
- setCurrency(theCurrency, localStatus);
-}
-
-void DecimalFormat::setCurrencyUsage(UCurrencyUsage newUsage, UErrorCode* ec) {
- // don't overwrite ec if it's already a failure.
- if (U_FAILURE(*ec)) { return; }
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
- *ec = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- if (!fields->properties.currencyUsage.isNull() && newUsage == fields->properties.currencyUsage.getNoError()) {
- return;
- }
- fields->properties.currencyUsage = newUsage;
- touch(*ec);
-}
-
-UCurrencyUsage DecimalFormat::getCurrencyUsage() const {
- // CurrencyUsage is not exported, so we have to get it from the input property bag.
- // TODO: Should we export CurrencyUsage instead?
- if (fields == nullptr || fields->properties.currencyUsage.isNull()) {
- return UCURR_USAGE_STANDARD;
- }
- return fields->properties.currencyUsage.getNoError();
-}
-
-void
-DecimalFormat::formatToDecimalQuantity(double number, DecimalQuantity& output, UErrorCode& status) const {
- // don't overwrite status if it's already a failure.
- if (U_FAILURE(status)) { return; }
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
- status = U_MEMORY_ALLOCATION_ERROR;
+ if (fields == nullptr) { return; }
+
+ // These are the default values from the old implementation.
+ if (useSignificantDigits) {
+ if (fields->properties.minimumSignificantDigits != -1 ||
+ fields->properties.maximumSignificantDigits != -1) {
+ return;
+ }
+ } else {
+ if (fields->properties.minimumSignificantDigits == -1 &&
+ fields->properties.maximumSignificantDigits == -1) {
+ return;
+ }
+ }
+ int32_t minSig = useSignificantDigits ? 1 : -1;
+ int32_t maxSig = useSignificantDigits ? 6 : -1;
+ fields->properties.minimumSignificantDigits = minSig;
+ fields->properties.maximumSignificantDigits = maxSig;
+ touchNoError();
+}
+
+void DecimalFormat::setCurrency(const char16_t* theCurrency, UErrorCode& ec) {
+ // don't overwrite ec if it's already a failure.
+ if (U_FAILURE(ec)) { return; }
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+ ec = U_MEMORY_ALLOCATION_ERROR;
return;
}
- fields->formatter.formatDouble(number, status).getDecimalQuantity(output, status);
+ CurrencyUnit currencyUnit(theCurrency, ec);
+ if (U_FAILURE(ec)) { return; }
+ if (!fields->properties.currency.isNull() && fields->properties.currency.getNoError() == currencyUnit) {
+ return;
+ }
+ NumberFormat::setCurrency(theCurrency, ec); // to set field for compatibility
+ fields->properties.currency = currencyUnit;
+ // In Java, the DecimalFormatSymbols is mutable. Why not in C++?
+ LocalPointer<DecimalFormatSymbols> newSymbols(new DecimalFormatSymbols(*fields->symbols), ec);
+ newSymbols->setCurrency(currencyUnit.getISOCurrency(), ec);
+ fields->symbols.adoptInsteadAndCheckErrorCode(newSymbols.orphan(), ec);
+ touch(ec);
+}
+
+void DecimalFormat::setCurrency(const char16_t* theCurrency) {
+ ErrorCode localStatus;
+ setCurrency(theCurrency, localStatus);
+}
+
+void DecimalFormat::setCurrencyUsage(UCurrencyUsage newUsage, UErrorCode* ec) {
+ // don't overwrite ec if it's already a failure.
+ if (U_FAILURE(*ec)) { return; }
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+ *ec = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ if (!fields->properties.currencyUsage.isNull() && newUsage == fields->properties.currencyUsage.getNoError()) {
+ return;
+ }
+ fields->properties.currencyUsage = newUsage;
+ touch(*ec);
+}
+
+UCurrencyUsage DecimalFormat::getCurrencyUsage() const {
+ // CurrencyUsage is not exported, so we have to get it from the input property bag.
+ // TODO: Should we export CurrencyUsage instead?
+ if (fields == nullptr || fields->properties.currencyUsage.isNull()) {
+ return UCURR_USAGE_STANDARD;
+ }
+ return fields->properties.currencyUsage.getNoError();
+}
+
+void
+DecimalFormat::formatToDecimalQuantity(double number, DecimalQuantity& output, UErrorCode& status) const {
+ // don't overwrite status if it's already a failure.
+ if (U_FAILURE(status)) { return; }
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ fields->formatter.formatDouble(number, status).getDecimalQuantity(output, status);
}
-void DecimalFormat::formatToDecimalQuantity(const Formattable& number, DecimalQuantity& output,
- UErrorCode& status) const {
- // don't overwrite status if it's already a failure.
- if (U_FAILURE(status)) { return; }
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+void DecimalFormat::formatToDecimalQuantity(const Formattable& number, DecimalQuantity& output,
+ UErrorCode& status) const {
+ // don't overwrite status if it's already a failure.
+ if (U_FAILURE(status)) { return; }
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
status = U_MEMORY_ALLOCATION_ERROR;
- return;
+ return;
}
- UFormattedNumberData obj;
- number.populateDecimalQuantity(obj.quantity, status);
- fields->formatter.formatImpl(&obj, status);
- output = std::move(obj.quantity);
+ UFormattedNumberData obj;
+ number.populateDecimalQuantity(obj.quantity, status);
+ fields->formatter.formatImpl(&obj, status);
+ output = std::move(obj.quantity);
}
-const number::LocalizedNumberFormatter* DecimalFormat::toNumberFormatter(UErrorCode& status) const {
- // We sometimes need to return nullptr here (see ICU-20380)
- if (U_FAILURE(status)) { return nullptr; }
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
- status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
+const number::LocalizedNumberFormatter* DecimalFormat::toNumberFormatter(UErrorCode& status) const {
+ // We sometimes need to return nullptr here (see ICU-20380)
+ if (U_FAILURE(status)) { return nullptr; }
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
}
- return &fields->formatter;
+ return &fields->formatter;
}
-/** Rebuilds the formatter object from the property bag. */
-void DecimalFormat::touch(UErrorCode& status) {
- if (U_FAILURE(status)) {
+/** Rebuilds the formatter object from the property bag. */
+void DecimalFormat::touch(UErrorCode& status) {
+ if (U_FAILURE(status)) {
return;
}
- if (fields == nullptr) {
- // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
- // For regular construction, the caller should have checked the status variable for errors.
- // For copy construction, there is unfortunately nothing to report the error, so we need to guard against
- // this possible bad state here and set the status to an error.
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
+ if (fields == nullptr) {
+ // We only get here if an OOM error happend during construction, copy construction, assignment, or modification.
+ // For regular construction, the caller should have checked the status variable for errors.
+ // For copy construction, there is unfortunately nothing to report the error, so we need to guard against
+ // this possible bad state here and set the status to an error.
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
}
- // In C++, fields->symbols is the source of truth for the locale.
- Locale locale = fields->symbols->getLocale();
-
- // Note: The formatter is relatively cheap to create, and we need it to populate fields->exportedProperties,
- // so automatically recompute it here. The parser is a bit more expensive and is not needed until the
- // parse method is called, so defer that until needed.
- // TODO: Only update the pieces that changed instead of re-computing the whole formatter?
-
- // Since memory has already been allocated for the formatter, we can move assign a stack-allocated object
- // and don't need to call new. (Which is slower and could possibly fail).
- fields->formatter = NumberPropertyMapper::create(
- fields->properties, *fields->symbols, fields->warehouse, fields->exportedProperties, status
- ).locale(locale);
-
- // Do this after fields->exportedProperties are set up
- setupFastFormat();
-
- // Delete the parsers if they were made previously
- delete fields->atomicParser.exchange(nullptr);
- delete fields->atomicCurrencyParser.exchange(nullptr);
-
- // In order for the getters to work, we need to populate some fields in NumberFormat.
- NumberFormat::setCurrency(fields->exportedProperties.currency.get(status).getISOCurrency(), status);
- NumberFormat::setMaximumIntegerDigits(fields->exportedProperties.maximumIntegerDigits);
- NumberFormat::setMinimumIntegerDigits(fields->exportedProperties.minimumIntegerDigits);
- NumberFormat::setMaximumFractionDigits(fields->exportedProperties.maximumFractionDigits);
- NumberFormat::setMinimumFractionDigits(fields->exportedProperties.minimumFractionDigits);
- // fImpl->properties, not fields->exportedProperties, since this information comes from the pattern:
- NumberFormat::setGroupingUsed(fields->properties.groupingUsed);
-}
-
-void DecimalFormat::touchNoError() {
- UErrorCode localStatus = U_ZERO_ERROR;
- touch(localStatus);
-}
-
-void DecimalFormat::setPropertiesFromPattern(const UnicodeString& pattern, int32_t ignoreRounding,
- UErrorCode& status) {
- if (U_SUCCESS(status)) {
- // Cast workaround to get around putting the enum in the public header file
- auto actualIgnoreRounding = static_cast<IgnoreRounding>(ignoreRounding);
- PatternParser::parseToExistingProperties(pattern, fields->properties, actualIgnoreRounding, status);
- }
-}
-
-const numparse::impl::NumberParserImpl* DecimalFormat::getParser(UErrorCode& status) const {
- // TODO: Move this into umutex.h? (similar logic also in numrange_fluent.cpp)
- // See ICU-20146
-
- if (U_FAILURE(status)) {
- return nullptr;
- }
-
- // First try to get the pre-computed parser
- auto* ptr = fields->atomicParser.load();
- if (ptr != nullptr) {
- return ptr;
- }
-
- // Try computing the parser on our own
- auto* temp = NumberParserImpl::createParserFromProperties(fields->properties, *fields->symbols, false, status);
- if (U_FAILURE(status)) {
- return nullptr;
- }
- if (temp == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
-
- // Note: ptr starts as nullptr; during compare_exchange,
- // it is set to what is actually stored in the atomic
- // if another thread beat us to computing the parser object.
- auto* nonConstThis = const_cast<DecimalFormat*>(this);
- if (!nonConstThis->fields->atomicParser.compare_exchange_strong(ptr, temp)) {
- // Another thread beat us to computing the parser
- delete temp;
- return ptr;
- } else {
- // Our copy of the parser got stored in the atomic
- return temp;
- }
-}
-
-const numparse::impl::NumberParserImpl* DecimalFormat::getCurrencyParser(UErrorCode& status) const {
- if (U_FAILURE(status)) { return nullptr; }
-
- // First try to get the pre-computed parser
- auto* ptr = fields->atomicCurrencyParser.load();
- if (ptr != nullptr) {
- return ptr;
- }
-
- // Try computing the parser on our own
- auto* temp = NumberParserImpl::createParserFromProperties(fields->properties, *fields->symbols, true, status);
- if (temp == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- // although we may still dereference, call sites should be guarded
- }
-
- // Note: ptr starts as nullptr; during compare_exchange, it is set to what is actually stored in the
- // atomic if another thread beat us to computing the parser object.
- auto* nonConstThis = const_cast<DecimalFormat*>(this);
- if (!nonConstThis->fields->atomicCurrencyParser.compare_exchange_strong(ptr, temp)) {
- // Another thread beat us to computing the parser
- delete temp;
- return ptr;
- } else {
- // Our copy of the parser got stored in the atomic
- return temp;
- }
-}
-
-void
-DecimalFormat::fieldPositionHelper(
- const UFormattedNumberData& formatted,
- FieldPosition& fieldPosition,
- int32_t offset,
- UErrorCode& status) {
- if (U_FAILURE(status)) { return; }
- // always return first occurrence:
- fieldPosition.setBeginIndex(0);
- fieldPosition.setEndIndex(0);
- bool found = formatted.nextFieldPosition(fieldPosition, status);
- if (found && offset != 0) {
- FieldPositionOnlyHandler fpoh(fieldPosition);
- fpoh.shiftLast(offset);
- }
-}
-
-void
-DecimalFormat::fieldPositionIteratorHelper(
- const UFormattedNumberData& formatted,
- FieldPositionIterator* fpi,
- int32_t offset,
- UErrorCode& status) {
- if (U_SUCCESS(status) && (fpi != nullptr)) {
- FieldPositionIteratorHandler fpih(fpi, status);
- fpih.setShift(offset);
- formatted.getAllFieldPositions(fpih, status);
- }
-}
-
-// To debug fast-format, change void(x) to printf(x)
-#define trace(x) void(x)
-
-void DecimalFormat::setupFastFormat() {
- // Check the majority of properties:
- if (!fields->properties.equalsDefaultExceptFastFormat()) {
- trace("no fast format: equality\n");
- fields->canUseFastFormat = false;
- return;
- }
-
- // Now check the remaining properties.
- // Nontrivial affixes:
- UBool trivialPP = fields->properties.positivePrefixPattern.isEmpty();
- UBool trivialPS = fields->properties.positiveSuffixPattern.isEmpty();
- UBool trivialNP = fields->properties.negativePrefixPattern.isBogus() || (
- fields->properties.negativePrefixPattern.length() == 1 &&
- fields->properties.negativePrefixPattern.charAt(0) == u'-');
- UBool trivialNS = fields->properties.negativeSuffixPattern.isEmpty();
- if (!trivialPP || !trivialPS || !trivialNP || !trivialNS) {
- trace("no fast format: affixes\n");
- fields->canUseFastFormat = false;
- return;
- }
-
- // Grouping (secondary grouping is forbidden in equalsDefaultExceptFastFormat):
- bool groupingUsed = fields->properties.groupingUsed;
- int32_t groupingSize = fields->properties.groupingSize;
- bool unusualGroupingSize = groupingSize > 0 && groupingSize != 3;
- const UnicodeString& groupingString = fields->symbols->getConstSymbol(DecimalFormatSymbols::kGroupingSeparatorSymbol);
- if (groupingUsed && (unusualGroupingSize || groupingString.length() != 1)) {
- trace("no fast format: grouping\n");
- fields->canUseFastFormat = false;
- return;
- }
-
- // Integer length:
- int32_t minInt = fields->exportedProperties.minimumIntegerDigits;
- int32_t maxInt = fields->exportedProperties.maximumIntegerDigits;
- // Fastpath supports up to only 10 digits (length of INT32_MIN)
- if (minInt > 10) {
- trace("no fast format: integer\n");
- fields->canUseFastFormat = false;
- return;
- }
-
- // Fraction length (no fraction part allowed in fast path):
- int32_t minFrac = fields->exportedProperties.minimumFractionDigits;
- if (minFrac > 0) {
- trace("no fast format: fraction\n");
- fields->canUseFastFormat = false;
- return;
- }
-
- // Other symbols:
- const UnicodeString& minusSignString = fields->symbols->getConstSymbol(DecimalFormatSymbols::kMinusSignSymbol);
- UChar32 codePointZero = fields->symbols->getCodePointZero();
- if (minusSignString.length() != 1 || U16_LENGTH(codePointZero) != 1) {
- trace("no fast format: symbols\n");
- fields->canUseFastFormat = false;
- return;
- }
-
- // Good to go!
- trace("can use fast format!\n");
- fields->canUseFastFormat = true;
- fields->fastData.cpZero = static_cast<char16_t>(codePointZero);
- fields->fastData.cpGroupingSeparator = groupingUsed && groupingSize == 3 ? groupingString.charAt(0) : 0;
- fields->fastData.cpMinusSign = minusSignString.charAt(0);
- fields->fastData.minInt = (minInt < 0 || minInt > 127) ? 0 : static_cast<int8_t>(minInt);
- fields->fastData.maxInt = (maxInt < 0 || maxInt > 127) ? 127 : static_cast<int8_t>(maxInt);
-}
-
-bool DecimalFormat::fastFormatDouble(double input, UnicodeString& output) const {
- if (!fields->canUseFastFormat) {
- return false;
- }
- if (std::isnan(input)
- || uprv_trunc(input) != input
- || input <= INT32_MIN
- || input > INT32_MAX) {
- return false;
- }
- doFastFormatInt32(static_cast<int32_t>(input), std::signbit(input), output);
- return true;
-}
-
-bool DecimalFormat::fastFormatInt64(int64_t input, UnicodeString& output) const {
- if (!fields->canUseFastFormat) {
- return false;
- }
- if (input <= INT32_MIN || input > INT32_MAX) {
- return false;
- }
- doFastFormatInt32(static_cast<int32_t>(input), input < 0, output);
- return true;
-}
-
-void DecimalFormat::doFastFormatInt32(int32_t input, bool isNegative, UnicodeString& output) const {
- U_ASSERT(fields->canUseFastFormat);
- if (isNegative) {
- output.append(fields->fastData.cpMinusSign);
- U_ASSERT(input != INT32_MIN); // handled by callers
- input = -input;
- }
- // Cap at int32_t to make the buffer small and operations fast.
- // Longest string: "2,147,483,648" (13 chars in length)
- static constexpr int32_t localCapacity = 13;
- char16_t localBuffer[localCapacity];
- char16_t* ptr = localBuffer + localCapacity;
- int8_t group = 0;
- int8_t minInt = (fields->fastData.minInt < 1)? 1: fields->fastData.minInt;
- for (int8_t i = 0; i < fields->fastData.maxInt && (input != 0 || i < minInt); i++) {
- if (group++ == 3 && fields->fastData.cpGroupingSeparator != 0) {
- *(--ptr) = fields->fastData.cpGroupingSeparator;
- group = 1;
- }
- std::div_t res = std::div(input, 10);
- *(--ptr) = static_cast<char16_t>(fields->fastData.cpZero + res.rem);
- input = res.quot;
- }
- int32_t len = localCapacity - static_cast<int32_t>(ptr - localBuffer);
- output.append(ptr, len);
-}
-
+ // In C++, fields->symbols is the source of truth for the locale.
+ Locale locale = fields->symbols->getLocale();
+
+ // Note: The formatter is relatively cheap to create, and we need it to populate fields->exportedProperties,
+ // so automatically recompute it here. The parser is a bit more expensive and is not needed until the
+ // parse method is called, so defer that until needed.
+ // TODO: Only update the pieces that changed instead of re-computing the whole formatter?
+ // Since memory has already been allocated for the formatter, we can move assign a stack-allocated object
+ // and don't need to call new. (Which is slower and could possibly fail).
+ fields->formatter = NumberPropertyMapper::create(
+ fields->properties, *fields->symbols, fields->warehouse, fields->exportedProperties, status
+ ).locale(locale);
+
+ // Do this after fields->exportedProperties are set up
+ setupFastFormat();
+
+ // Delete the parsers if they were made previously
+ delete fields->atomicParser.exchange(nullptr);
+ delete fields->atomicCurrencyParser.exchange(nullptr);
+
+ // In order for the getters to work, we need to populate some fields in NumberFormat.
+ NumberFormat::setCurrency(fields->exportedProperties.currency.get(status).getISOCurrency(), status);
+ NumberFormat::setMaximumIntegerDigits(fields->exportedProperties.maximumIntegerDigits);
+ NumberFormat::setMinimumIntegerDigits(fields->exportedProperties.minimumIntegerDigits);
+ NumberFormat::setMaximumFractionDigits(fields->exportedProperties.maximumFractionDigits);
+ NumberFormat::setMinimumFractionDigits(fields->exportedProperties.minimumFractionDigits);
+ // fImpl->properties, not fields->exportedProperties, since this information comes from the pattern:
+ NumberFormat::setGroupingUsed(fields->properties.groupingUsed);
+}
+
+void DecimalFormat::touchNoError() {
+ UErrorCode localStatus = U_ZERO_ERROR;
+ touch(localStatus);
+}
+
+void DecimalFormat::setPropertiesFromPattern(const UnicodeString& pattern, int32_t ignoreRounding,
+ UErrorCode& status) {
+ if (U_SUCCESS(status)) {
+ // Cast workaround to get around putting the enum in the public header file
+ auto actualIgnoreRounding = static_cast<IgnoreRounding>(ignoreRounding);
+ PatternParser::parseToExistingProperties(pattern, fields->properties, actualIgnoreRounding, status);
+ }
+}
+
+const numparse::impl::NumberParserImpl* DecimalFormat::getParser(UErrorCode& status) const {
+ // TODO: Move this into umutex.h? (similar logic also in numrange_fluent.cpp)
+ // See ICU-20146
+
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+
+ // First try to get the pre-computed parser
+ auto* ptr = fields->atomicParser.load();
+ if (ptr != nullptr) {
+ return ptr;
+ }
+
+ // Try computing the parser on our own
+ auto* temp = NumberParserImpl::createParserFromProperties(fields->properties, *fields->symbols, false, status);
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ if (temp == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+
+ // Note: ptr starts as nullptr; during compare_exchange,
+ // it is set to what is actually stored in the atomic
+ // if another thread beat us to computing the parser object.
+ auto* nonConstThis = const_cast<DecimalFormat*>(this);
+ if (!nonConstThis->fields->atomicParser.compare_exchange_strong(ptr, temp)) {
+ // Another thread beat us to computing the parser
+ delete temp;
+ return ptr;
+ } else {
+ // Our copy of the parser got stored in the atomic
+ return temp;
+ }
+}
+
+const numparse::impl::NumberParserImpl* DecimalFormat::getCurrencyParser(UErrorCode& status) const {
+ if (U_FAILURE(status)) { return nullptr; }
+
+ // First try to get the pre-computed parser
+ auto* ptr = fields->atomicCurrencyParser.load();
+ if (ptr != nullptr) {
+ return ptr;
+ }
+
+ // Try computing the parser on our own
+ auto* temp = NumberParserImpl::createParserFromProperties(fields->properties, *fields->symbols, true, status);
+ if (temp == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ // although we may still dereference, call sites should be guarded
+ }
+
+ // Note: ptr starts as nullptr; during compare_exchange, it is set to what is actually stored in the
+ // atomic if another thread beat us to computing the parser object.
+ auto* nonConstThis = const_cast<DecimalFormat*>(this);
+ if (!nonConstThis->fields->atomicCurrencyParser.compare_exchange_strong(ptr, temp)) {
+ // Another thread beat us to computing the parser
+ delete temp;
+ return ptr;
+ } else {
+ // Our copy of the parser got stored in the atomic
+ return temp;
+ }
+}
+
+void
+DecimalFormat::fieldPositionHelper(
+ const UFormattedNumberData& formatted,
+ FieldPosition& fieldPosition,
+ int32_t offset,
+ UErrorCode& status) {
+ if (U_FAILURE(status)) { return; }
+ // always return first occurrence:
+ fieldPosition.setBeginIndex(0);
+ fieldPosition.setEndIndex(0);
+ bool found = formatted.nextFieldPosition(fieldPosition, status);
+ if (found && offset != 0) {
+ FieldPositionOnlyHandler fpoh(fieldPosition);
+ fpoh.shiftLast(offset);
+ }
+}
+
+void
+DecimalFormat::fieldPositionIteratorHelper(
+ const UFormattedNumberData& formatted,
+ FieldPositionIterator* fpi,
+ int32_t offset,
+ UErrorCode& status) {
+ if (U_SUCCESS(status) && (fpi != nullptr)) {
+ FieldPositionIteratorHandler fpih(fpi, status);
+ fpih.setShift(offset);
+ formatted.getAllFieldPositions(fpih, status);
+ }
+}
+
+// To debug fast-format, change void(x) to printf(x)
+#define trace(x) void(x)
+
+void DecimalFormat::setupFastFormat() {
+ // Check the majority of properties:
+ if (!fields->properties.equalsDefaultExceptFastFormat()) {
+ trace("no fast format: equality\n");
+ fields->canUseFastFormat = false;
+ return;
+ }
+
+ // Now check the remaining properties.
+ // Nontrivial affixes:
+ UBool trivialPP = fields->properties.positivePrefixPattern.isEmpty();
+ UBool trivialPS = fields->properties.positiveSuffixPattern.isEmpty();
+ UBool trivialNP = fields->properties.negativePrefixPattern.isBogus() || (
+ fields->properties.negativePrefixPattern.length() == 1 &&
+ fields->properties.negativePrefixPattern.charAt(0) == u'-');
+ UBool trivialNS = fields->properties.negativeSuffixPattern.isEmpty();
+ if (!trivialPP || !trivialPS || !trivialNP || !trivialNS) {
+ trace("no fast format: affixes\n");
+ fields->canUseFastFormat = false;
+ return;
+ }
+
+ // Grouping (secondary grouping is forbidden in equalsDefaultExceptFastFormat):
+ bool groupingUsed = fields->properties.groupingUsed;
+ int32_t groupingSize = fields->properties.groupingSize;
+ bool unusualGroupingSize = groupingSize > 0 && groupingSize != 3;
+ const UnicodeString& groupingString = fields->symbols->getConstSymbol(DecimalFormatSymbols::kGroupingSeparatorSymbol);
+ if (groupingUsed && (unusualGroupingSize || groupingString.length() != 1)) {
+ trace("no fast format: grouping\n");
+ fields->canUseFastFormat = false;
+ return;
+ }
+
+ // Integer length:
+ int32_t minInt = fields->exportedProperties.minimumIntegerDigits;
+ int32_t maxInt = fields->exportedProperties.maximumIntegerDigits;
+ // Fastpath supports up to only 10 digits (length of INT32_MIN)
+ if (minInt > 10) {
+ trace("no fast format: integer\n");
+ fields->canUseFastFormat = false;
+ return;
+ }
+
+ // Fraction length (no fraction part allowed in fast path):
+ int32_t minFrac = fields->exportedProperties.minimumFractionDigits;
+ if (minFrac > 0) {
+ trace("no fast format: fraction\n");
+ fields->canUseFastFormat = false;
+ return;
+ }
+
+ // Other symbols:
+ const UnicodeString& minusSignString = fields->symbols->getConstSymbol(DecimalFormatSymbols::kMinusSignSymbol);
+ UChar32 codePointZero = fields->symbols->getCodePointZero();
+ if (minusSignString.length() != 1 || U16_LENGTH(codePointZero) != 1) {
+ trace("no fast format: symbols\n");
+ fields->canUseFastFormat = false;
+ return;
+ }
+
+ // Good to go!
+ trace("can use fast format!\n");
+ fields->canUseFastFormat = true;
+ fields->fastData.cpZero = static_cast<char16_t>(codePointZero);
+ fields->fastData.cpGroupingSeparator = groupingUsed && groupingSize == 3 ? groupingString.charAt(0) : 0;
+ fields->fastData.cpMinusSign = minusSignString.charAt(0);
+ fields->fastData.minInt = (minInt < 0 || minInt > 127) ? 0 : static_cast<int8_t>(minInt);
+ fields->fastData.maxInt = (maxInt < 0 || maxInt > 127) ? 127 : static_cast<int8_t>(maxInt);
+}
+
+bool DecimalFormat::fastFormatDouble(double input, UnicodeString& output) const {
+ if (!fields->canUseFastFormat) {
+ return false;
+ }
+ if (std::isnan(input)
+ || uprv_trunc(input) != input
+ || input <= INT32_MIN
+ || input > INT32_MAX) {
+ return false;
+ }
+ doFastFormatInt32(static_cast<int32_t>(input), std::signbit(input), output);
+ return true;
+}
+
+bool DecimalFormat::fastFormatInt64(int64_t input, UnicodeString& output) const {
+ if (!fields->canUseFastFormat) {
+ return false;
+ }
+ if (input <= INT32_MIN || input > INT32_MAX) {
+ return false;
+ }
+ doFastFormatInt32(static_cast<int32_t>(input), input < 0, output);
+ return true;
+}
+
+void DecimalFormat::doFastFormatInt32(int32_t input, bool isNegative, UnicodeString& output) const {
+ U_ASSERT(fields->canUseFastFormat);
+ if (isNegative) {
+ output.append(fields->fastData.cpMinusSign);
+ U_ASSERT(input != INT32_MIN); // handled by callers
+ input = -input;
+ }
+ // Cap at int32_t to make the buffer small and operations fast.
+ // Longest string: "2,147,483,648" (13 chars in length)
+ static constexpr int32_t localCapacity = 13;
+ char16_t localBuffer[localCapacity];
+ char16_t* ptr = localBuffer + localCapacity;
+ int8_t group = 0;
+ int8_t minInt = (fields->fastData.minInt < 1)? 1: fields->fastData.minInt;
+ for (int8_t i = 0; i < fields->fastData.maxInt && (input != 0 || i < minInt); i++) {
+ if (group++ == 3 && fields->fastData.cpGroupingSeparator != 0) {
+ *(--ptr) = fields->fastData.cpGroupingSeparator;
+ group = 1;
+ }
+ std::div_t res = std::div(input, 10);
+ *(--ptr) = static_cast<char16_t>(fields->fastData.cpZero + res.rem);
+ input = res.quot;
+ }
+ int32_t len = localCapacity - static_cast<int32_t>(ptr - localBuffer);
+ output.append(ptr, len);
+}
+
+
#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/double-conversion-bignum-dtoa.cpp b/contrib/libs/icu/i18n/double-conversion-bignum-dtoa.cpp
index bc7e408f68..a95910df04 100644
--- a/contrib/libs/icu/i18n/double-conversion-bignum-dtoa.cpp
+++ b/contrib/libs/icu/i18n/double-conversion-bignum-dtoa.cpp
@@ -1,659 +1,659 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// From the double-conversion library. Original license:
-//
-// Copyright 2010 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.
-
-// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-#include <cmath>
-
-// ICU PATCH: Customize header file paths for ICU.
-
-#include "double-conversion-bignum-dtoa.h"
-
-#include "double-conversion-bignum.h"
-#include "double-conversion-ieee.h"
-
-// ICU PATCH: Wrap in ICU namespace
-U_NAMESPACE_BEGIN
-
-namespace double_conversion {
-
-static int NormalizedExponent(uint64_t significand, int exponent) {
- DOUBLE_CONVERSION_ASSERT(significand != 0);
- while ((significand & Double::kHiddenBit) == 0) {
- significand = significand << 1;
- exponent = exponent - 1;
- }
- return exponent;
-}
-
-
-// Forward declarations:
-// Returns an estimation of k such that 10^(k-1) <= v < 10^k.
-static int EstimatePower(int exponent);
-// Computes v / 10^estimated_power exactly, as a ratio of two bignums, numerator
-// and denominator.
-static void InitialScaledStartValues(uint64_t significand,
- int exponent,
- bool lower_boundary_is_closer,
- int estimated_power,
- bool need_boundary_deltas,
- Bignum* numerator,
- Bignum* denominator,
- Bignum* delta_minus,
- Bignum* delta_plus);
-// Multiplies numerator/denominator so that its values lies in the range 1-10.
-// Returns decimal_point s.t.
-// v = numerator'/denominator' * 10^(decimal_point-1)
-// where numerator' and denominator' are the values of numerator and
-// denominator after the call to this function.
-static void FixupMultiply10(int estimated_power, bool is_even,
- int* decimal_point,
- Bignum* numerator, Bignum* denominator,
- Bignum* delta_minus, Bignum* delta_plus);
-// Generates digits from the left to the right and stops when the generated
-// digits yield the shortest decimal representation of v.
-static void GenerateShortestDigits(Bignum* numerator, Bignum* denominator,
- Bignum* delta_minus, Bignum* delta_plus,
- bool is_even,
- Vector<char> buffer, int* length);
-// Generates 'requested_digits' after the decimal point.
-static void BignumToFixed(int requested_digits, int* decimal_point,
- Bignum* numerator, Bignum* denominator,
- Vector<char> buffer, int* length);
-// Generates 'count' digits of numerator/denominator.
-// Once 'count' digits have been produced rounds the result depending on the
-// remainder (remainders of exactly .5 round upwards). Might update the
-// decimal_point when rounding up (for example for 0.9999).
-static void GenerateCountedDigits(int count, int* decimal_point,
- Bignum* numerator, Bignum* denominator,
- Vector<char> buffer, int* length);
-
-
-void BignumDtoa(double v, BignumDtoaMode mode, int requested_digits,
- Vector<char> buffer, int* length, int* decimal_point) {
- DOUBLE_CONVERSION_ASSERT(v > 0);
- DOUBLE_CONVERSION_ASSERT(!Double(v).IsSpecial());
- uint64_t significand;
- int exponent;
- bool lower_boundary_is_closer;
- if (mode == BIGNUM_DTOA_SHORTEST_SINGLE) {
- float f = static_cast<float>(v);
- DOUBLE_CONVERSION_ASSERT(f == v);
- significand = Single(f).Significand();
- exponent = Single(f).Exponent();
- lower_boundary_is_closer = Single(f).LowerBoundaryIsCloser();
- } else {
- significand = Double(v).Significand();
- exponent = Double(v).Exponent();
- lower_boundary_is_closer = Double(v).LowerBoundaryIsCloser();
- }
- bool need_boundary_deltas =
- (mode == BIGNUM_DTOA_SHORTEST || mode == BIGNUM_DTOA_SHORTEST_SINGLE);
-
- bool is_even = (significand & 1) == 0;
- int normalized_exponent = NormalizedExponent(significand, exponent);
- // estimated_power might be too low by 1.
- int estimated_power = EstimatePower(normalized_exponent);
-
- // Shortcut for Fixed.
- // The requested digits correspond to the digits after the point. If the
- // number is much too small, then there is no need in trying to get any
- // digits.
- if (mode == BIGNUM_DTOA_FIXED && -estimated_power - 1 > requested_digits) {
- buffer[0] = '\0';
- *length = 0;
- // Set decimal-point to -requested_digits. This is what Gay does.
- // Note that it should not have any effect anyways since the string is
- // empty.
- *decimal_point = -requested_digits;
- return;
- }
-
- Bignum numerator;
- Bignum denominator;
- Bignum delta_minus;
- Bignum delta_plus;
- // Make sure the bignum can grow large enough. The smallest double equals
- // 4e-324. In this case the denominator needs fewer than 324*4 binary digits.
- // The maximum double is 1.7976931348623157e308 which needs fewer than
- // 308*4 binary digits.
- DOUBLE_CONVERSION_ASSERT(Bignum::kMaxSignificantBits >= 324*4);
- InitialScaledStartValues(significand, exponent, lower_boundary_is_closer,
- estimated_power, need_boundary_deltas,
- &numerator, &denominator,
- &delta_minus, &delta_plus);
- // We now have v = (numerator / denominator) * 10^estimated_power.
- FixupMultiply10(estimated_power, is_even, decimal_point,
- &numerator, &denominator,
- &delta_minus, &delta_plus);
- // We now have v = (numerator / denominator) * 10^(decimal_point-1), and
- // 1 <= (numerator + delta_plus) / denominator < 10
- switch (mode) {
- case BIGNUM_DTOA_SHORTEST:
- case BIGNUM_DTOA_SHORTEST_SINGLE:
- GenerateShortestDigits(&numerator, &denominator,
- &delta_minus, &delta_plus,
- is_even, buffer, length);
- break;
- case BIGNUM_DTOA_FIXED:
- BignumToFixed(requested_digits, decimal_point,
- &numerator, &denominator,
- buffer, length);
- break;
- case BIGNUM_DTOA_PRECISION:
- GenerateCountedDigits(requested_digits, decimal_point,
- &numerator, &denominator,
- buffer, length);
- break;
- default:
- DOUBLE_CONVERSION_UNREACHABLE();
- }
- buffer[*length] = '\0';
-}
-
-
-// The procedure starts generating digits from the left to the right and stops
-// when the generated digits yield the shortest decimal representation of v. A
-// decimal representation of v is a number lying closer to v than to any other
-// double, so it converts to v when read.
-//
-// This is true if d, the decimal representation, is between m- and m+, the
-// upper and lower boundaries. d must be strictly between them if !is_even.
-// m- := (numerator - delta_minus) / denominator
-// m+ := (numerator + delta_plus) / denominator
-//
-// Precondition: 0 <= (numerator+delta_plus) / denominator < 10.
-// If 1 <= (numerator+delta_plus) / denominator < 10 then no leading 0 digit
-// will be produced. This should be the standard precondition.
-static void GenerateShortestDigits(Bignum* numerator, Bignum* denominator,
- Bignum* delta_minus, Bignum* delta_plus,
- bool is_even,
- Vector<char> buffer, int* length) {
- // Small optimization: if delta_minus and delta_plus are the same just reuse
- // one of the two bignums.
- if (Bignum::Equal(*delta_minus, *delta_plus)) {
- delta_plus = delta_minus;
- }
- *length = 0;
- for (;;) {
- uint16_t digit;
- digit = numerator->DivideModuloIntBignum(*denominator);
- DOUBLE_CONVERSION_ASSERT(digit <= 9); // digit is a uint16_t and therefore always positive.
- // digit = numerator / denominator (integer division).
- // numerator = numerator % denominator.
- buffer[(*length)++] = static_cast<char>(digit + '0');
-
- // Can we stop already?
- // If the remainder of the division is less than the distance to the lower
- // boundary we can stop. In this case we simply round down (discarding the
- // remainder).
- // Similarly we test if we can round up (using the upper boundary).
- bool in_delta_room_minus;
- bool in_delta_room_plus;
- if (is_even) {
- in_delta_room_minus = Bignum::LessEqual(*numerator, *delta_minus);
- } else {
- in_delta_room_minus = Bignum::Less(*numerator, *delta_minus);
- }
- if (is_even) {
- in_delta_room_plus =
- Bignum::PlusCompare(*numerator, *delta_plus, *denominator) >= 0;
- } else {
- in_delta_room_plus =
- Bignum::PlusCompare(*numerator, *delta_plus, *denominator) > 0;
- }
- if (!in_delta_room_minus && !in_delta_room_plus) {
- // Prepare for next iteration.
- numerator->Times10();
- delta_minus->Times10();
- // We optimized delta_plus to be equal to delta_minus (if they share the
- // same value). So don't multiply delta_plus if they point to the same
- // object.
- if (delta_minus != delta_plus) {
- delta_plus->Times10();
- }
- } else if (in_delta_room_minus && in_delta_room_plus) {
- // Let's see if 2*numerator < denominator.
- // If yes, then the next digit would be < 5 and we can round down.
- int compare = Bignum::PlusCompare(*numerator, *numerator, *denominator);
- if (compare < 0) {
- // Remaining digits are less than .5. -> Round down (== do nothing).
- } else if (compare > 0) {
- // Remaining digits are more than .5 of denominator. -> Round up.
- // Note that the last digit could not be a '9' as otherwise the whole
- // loop would have stopped earlier.
- // We still have an assert here in case the preconditions were not
- // satisfied.
- DOUBLE_CONVERSION_ASSERT(buffer[(*length) - 1] != '9');
- buffer[(*length) - 1]++;
- } else {
- // Halfway case.
- // TODO(floitsch): need a way to solve half-way cases.
- // For now let's round towards even (since this is what Gay seems to
- // do).
-
- if ((buffer[(*length) - 1] - '0') % 2 == 0) {
- // Round down => Do nothing.
- } else {
- DOUBLE_CONVERSION_ASSERT(buffer[(*length) - 1] != '9');
- buffer[(*length) - 1]++;
- }
- }
- return;
- } else if (in_delta_room_minus) {
- // Round down (== do nothing).
- return;
- } else { // in_delta_room_plus
- // Round up.
- // Note again that the last digit could not be '9' since this would have
- // stopped the loop earlier.
- // We still have an DOUBLE_CONVERSION_ASSERT here, in case the preconditions were not
- // satisfied.
- DOUBLE_CONVERSION_ASSERT(buffer[(*length) -1] != '9');
- buffer[(*length) - 1]++;
- return;
- }
- }
-}
-
-
-// Let v = numerator / denominator < 10.
-// Then we generate 'count' digits of d = x.xxxxx... (without the decimal point)
-// from left to right. Once 'count' digits have been produced we decide wether
-// to round up or down. Remainders of exactly .5 round upwards. Numbers such
-// as 9.999999 propagate a carry all the way, and change the
-// exponent (decimal_point), when rounding upwards.
-static void GenerateCountedDigits(int count, int* decimal_point,
- Bignum* numerator, Bignum* denominator,
- Vector<char> buffer, int* length) {
- DOUBLE_CONVERSION_ASSERT(count >= 0);
- for (int i = 0; i < count - 1; ++i) {
- uint16_t digit;
- digit = numerator->DivideModuloIntBignum(*denominator);
- DOUBLE_CONVERSION_ASSERT(digit <= 9); // digit is a uint16_t and therefore always positive.
- // digit = numerator / denominator (integer division).
- // numerator = numerator % denominator.
- buffer[i] = static_cast<char>(digit + '0');
- // Prepare for next iteration.
- numerator->Times10();
- }
- // Generate the last digit.
- uint16_t digit;
- digit = numerator->DivideModuloIntBignum(*denominator);
- if (Bignum::PlusCompare(*numerator, *numerator, *denominator) >= 0) {
- digit++;
- }
- DOUBLE_CONVERSION_ASSERT(digit <= 10);
- buffer[count - 1] = static_cast<char>(digit + '0');
- // Correct bad digits (in case we had a sequence of '9's). Propagate the
- // carry until we hat a non-'9' or til we reach the first digit.
- for (int i = count - 1; i > 0; --i) {
- if (buffer[i] != '0' + 10) break;
- buffer[i] = '0';
- buffer[i - 1]++;
- }
- if (buffer[0] == '0' + 10) {
- // Propagate a carry past the top place.
- buffer[0] = '1';
- (*decimal_point)++;
- }
- *length = count;
-}
-
-
-// Generates 'requested_digits' after the decimal point. It might omit
-// trailing '0's. If the input number is too small then no digits at all are
-// generated (ex.: 2 fixed digits for 0.00001).
-//
-// Input verifies: 1 <= (numerator + delta) / denominator < 10.
-static void BignumToFixed(int requested_digits, int* decimal_point,
- Bignum* numerator, Bignum* denominator,
- Vector<char> buffer, int* length) {
- // Note that we have to look at more than just the requested_digits, since
- // a number could be rounded up. Example: v=0.5 with requested_digits=0.
- // Even though the power of v equals 0 we can't just stop here.
- if (-(*decimal_point) > requested_digits) {
- // The number is definitively too small.
- // Ex: 0.001 with requested_digits == 1.
- // Set decimal-point to -requested_digits. This is what Gay does.
- // Note that it should not have any effect anyways since the string is
- // empty.
- *decimal_point = -requested_digits;
- *length = 0;
- return;
- } else if (-(*decimal_point) == requested_digits) {
- // We only need to verify if the number rounds down or up.
- // Ex: 0.04 and 0.06 with requested_digits == 1.
- DOUBLE_CONVERSION_ASSERT(*decimal_point == -requested_digits);
- // Initially the fraction lies in range (1, 10]. Multiply the denominator
- // by 10 so that we can compare more easily.
- denominator->Times10();
- if (Bignum::PlusCompare(*numerator, *numerator, *denominator) >= 0) {
- // If the fraction is >= 0.5 then we have to include the rounded
- // digit.
- buffer[0] = '1';
- *length = 1;
- (*decimal_point)++;
- } else {
- // Note that we caught most of similar cases earlier.
- *length = 0;
- }
- return;
- } else {
- // The requested digits correspond to the digits after the point.
- // The variable 'needed_digits' includes the digits before the point.
- int needed_digits = (*decimal_point) + requested_digits;
- GenerateCountedDigits(needed_digits, decimal_point,
- numerator, denominator,
- buffer, length);
- }
-}
-
-
-// Returns an estimation of k such that 10^(k-1) <= v < 10^k where
-// v = f * 2^exponent and 2^52 <= f < 2^53.
-// v is hence a normalized double with the given exponent. The output is an
-// approximation for the exponent of the decimal approimation .digits * 10^k.
-//
-// The result might undershoot by 1 in which case 10^k <= v < 10^k+1.
-// Note: this property holds for v's upper boundary m+ too.
-// 10^k <= m+ < 10^k+1.
-// (see explanation below).
-//
-// Examples:
-// EstimatePower(0) => 16
-// EstimatePower(-52) => 0
-//
-// Note: e >= 0 => EstimatedPower(e) > 0. No similar claim can be made for e<0.
-static int EstimatePower(int exponent) {
- // This function estimates log10 of v where v = f*2^e (with e == exponent).
- // Note that 10^floor(log10(v)) <= v, but v <= 10^ceil(log10(v)).
- // Note that f is bounded by its container size. Let p = 53 (the double's
- // significand size). Then 2^(p-1) <= f < 2^p.
- //
- // Given that log10(v) == log2(v)/log2(10) and e+(len(f)-1) is quite close
- // to log2(v) the function is simplified to (e+(len(f)-1)/log2(10)).
- // The computed number undershoots by less than 0.631 (when we compute log3
- // and not log10).
- //
- // Optimization: since we only need an approximated result this computation
- // can be performed on 64 bit integers. On x86/x64 architecture the speedup is
- // not really measurable, though.
- //
- // Since we want to avoid overshooting we decrement by 1e10 so that
- // floating-point imprecisions don't affect us.
- //
- // Explanation for v's boundary m+: the computation takes advantage of
- // the fact that 2^(p-1) <= f < 2^p. Boundaries still satisfy this requirement
- // (even for denormals where the delta can be much more important).
-
- const double k1Log10 = 0.30102999566398114; // 1/lg(10)
-
- // For doubles len(f) == 53 (don't forget the hidden bit).
- const int kSignificandSize = Double::kSignificandSize;
- double estimate = ceil((exponent + kSignificandSize - 1) * k1Log10 - 1e-10);
- return static_cast<int>(estimate);
-}
-
-
-// See comments for InitialScaledStartValues.
-static void InitialScaledStartValuesPositiveExponent(
- uint64_t significand, int exponent,
- int estimated_power, bool need_boundary_deltas,
- Bignum* numerator, Bignum* denominator,
- Bignum* delta_minus, Bignum* delta_plus) {
- // A positive exponent implies a positive power.
- DOUBLE_CONVERSION_ASSERT(estimated_power >= 0);
- // Since the estimated_power is positive we simply multiply the denominator
- // by 10^estimated_power.
-
- // numerator = v.
- numerator->AssignUInt64(significand);
- numerator->ShiftLeft(exponent);
- // denominator = 10^estimated_power.
- denominator->AssignPowerUInt16(10, estimated_power);
-
- if (need_boundary_deltas) {
- // Introduce a common denominator so that the deltas to the boundaries are
- // integers.
- denominator->ShiftLeft(1);
- numerator->ShiftLeft(1);
- // Let v = f * 2^e, then m+ - v = 1/2 * 2^e; With the common
- // denominator (of 2) delta_plus equals 2^e.
- delta_plus->AssignUInt16(1);
- delta_plus->ShiftLeft(exponent);
- // Same for delta_minus. The adjustments if f == 2^p-1 are done later.
- delta_minus->AssignUInt16(1);
- delta_minus->ShiftLeft(exponent);
- }
-}
-
-
-// See comments for InitialScaledStartValues
-static void InitialScaledStartValuesNegativeExponentPositivePower(
- uint64_t significand, int exponent,
- int estimated_power, bool need_boundary_deltas,
- Bignum* numerator, Bignum* denominator,
- Bignum* delta_minus, Bignum* delta_plus) {
- // v = f * 2^e with e < 0, and with estimated_power >= 0.
- // This means that e is close to 0 (have a look at how estimated_power is
- // computed).
-
- // numerator = significand
- // since v = significand * 2^exponent this is equivalent to
- // numerator = v * / 2^-exponent
- numerator->AssignUInt64(significand);
- // denominator = 10^estimated_power * 2^-exponent (with exponent < 0)
- denominator->AssignPowerUInt16(10, estimated_power);
- denominator->ShiftLeft(-exponent);
-
- if (need_boundary_deltas) {
- // Introduce a common denominator so that the deltas to the boundaries are
- // integers.
- denominator->ShiftLeft(1);
- numerator->ShiftLeft(1);
- // Let v = f * 2^e, then m+ - v = 1/2 * 2^e; With the common
- // denominator (of 2) delta_plus equals 2^e.
- // Given that the denominator already includes v's exponent the distance
- // to the boundaries is simply 1.
- delta_plus->AssignUInt16(1);
- // Same for delta_minus. The adjustments if f == 2^p-1 are done later.
- delta_minus->AssignUInt16(1);
- }
-}
-
-
-// See comments for InitialScaledStartValues
-static void InitialScaledStartValuesNegativeExponentNegativePower(
- uint64_t significand, int exponent,
- int estimated_power, bool need_boundary_deltas,
- Bignum* numerator, Bignum* denominator,
- Bignum* delta_minus, Bignum* delta_plus) {
- // Instead of multiplying the denominator with 10^estimated_power we
- // multiply all values (numerator and deltas) by 10^-estimated_power.
-
- // Use numerator as temporary container for power_ten.
- Bignum* power_ten = numerator;
- power_ten->AssignPowerUInt16(10, -estimated_power);
-
- if (need_boundary_deltas) {
- // Since power_ten == numerator we must make a copy of 10^estimated_power
- // before we complete the computation of the numerator.
- // delta_plus = delta_minus = 10^estimated_power
- delta_plus->AssignBignum(*power_ten);
- delta_minus->AssignBignum(*power_ten);
- }
-
- // numerator = significand * 2 * 10^-estimated_power
- // since v = significand * 2^exponent this is equivalent to
- // numerator = v * 10^-estimated_power * 2 * 2^-exponent.
- // Remember: numerator has been abused as power_ten. So no need to assign it
- // to itself.
- DOUBLE_CONVERSION_ASSERT(numerator == power_ten);
- numerator->MultiplyByUInt64(significand);
-
- // denominator = 2 * 2^-exponent with exponent < 0.
- denominator->AssignUInt16(1);
- denominator->ShiftLeft(-exponent);
-
- if (need_boundary_deltas) {
- // Introduce a common denominator so that the deltas to the boundaries are
- // integers.
- numerator->ShiftLeft(1);
- denominator->ShiftLeft(1);
- // With this shift the boundaries have their correct value, since
- // delta_plus = 10^-estimated_power, and
- // delta_minus = 10^-estimated_power.
- // These assignments have been done earlier.
- // The adjustments if f == 2^p-1 (lower boundary is closer) are done later.
- }
-}
-
-
-// Let v = significand * 2^exponent.
-// Computes v / 10^estimated_power exactly, as a ratio of two bignums, numerator
-// and denominator. The functions GenerateShortestDigits and
-// GenerateCountedDigits will then convert this ratio to its decimal
-// representation d, with the required accuracy.
-// Then d * 10^estimated_power is the representation of v.
-// (Note: the fraction and the estimated_power might get adjusted before
-// generating the decimal representation.)
-//
-// The initial start values consist of:
-// - a scaled numerator: s.t. numerator/denominator == v / 10^estimated_power.
-// - a scaled (common) denominator.
-// optionally (used by GenerateShortestDigits to decide if it has the shortest
-// decimal converting back to v):
-// - v - m-: the distance to the lower boundary.
-// - m+ - v: the distance to the upper boundary.
-//
-// v, m+, m-, and therefore v - m- and m+ - v all share the same denominator.
-//
-// Let ep == estimated_power, then the returned values will satisfy:
-// v / 10^ep = numerator / denominator.
-// v's boundarys m- and m+:
-// m- / 10^ep == v / 10^ep - delta_minus / denominator
-// m+ / 10^ep == v / 10^ep + delta_plus / denominator
-// Or in other words:
-// m- == v - delta_minus * 10^ep / denominator;
-// m+ == v + delta_plus * 10^ep / denominator;
-//
-// Since 10^(k-1) <= v < 10^k (with k == estimated_power)
-// or 10^k <= v < 10^(k+1)
-// we then have 0.1 <= numerator/denominator < 1
-// or 1 <= numerator/denominator < 10
-//
-// It is then easy to kickstart the digit-generation routine.
-//
-// The boundary-deltas are only filled if the mode equals BIGNUM_DTOA_SHORTEST
-// or BIGNUM_DTOA_SHORTEST_SINGLE.
-
-static void InitialScaledStartValues(uint64_t significand,
- int exponent,
- bool lower_boundary_is_closer,
- int estimated_power,
- bool need_boundary_deltas,
- Bignum* numerator,
- Bignum* denominator,
- Bignum* delta_minus,
- Bignum* delta_plus) {
- if (exponent >= 0) {
- InitialScaledStartValuesPositiveExponent(
- significand, exponent, estimated_power, need_boundary_deltas,
- numerator, denominator, delta_minus, delta_plus);
- } else if (estimated_power >= 0) {
- InitialScaledStartValuesNegativeExponentPositivePower(
- significand, exponent, estimated_power, need_boundary_deltas,
- numerator, denominator, delta_minus, delta_plus);
- } else {
- InitialScaledStartValuesNegativeExponentNegativePower(
- significand, exponent, estimated_power, need_boundary_deltas,
- numerator, denominator, delta_minus, delta_plus);
- }
-
- if (need_boundary_deltas && lower_boundary_is_closer) {
- // The lower boundary is closer at half the distance of "normal" numbers.
- // Increase the common denominator and adapt all but the delta_minus.
- denominator->ShiftLeft(1); // *2
- numerator->ShiftLeft(1); // *2
- delta_plus->ShiftLeft(1); // *2
- }
-}
-
-
-// This routine multiplies numerator/denominator so that its values lies in the
-// range 1-10. That is after a call to this function we have:
-// 1 <= (numerator + delta_plus) /denominator < 10.
-// Let numerator the input before modification and numerator' the argument
-// after modification, then the output-parameter decimal_point is such that
-// numerator / denominator * 10^estimated_power ==
-// numerator' / denominator' * 10^(decimal_point - 1)
-// In some cases estimated_power was too low, and this is already the case. We
-// then simply adjust the power so that 10^(k-1) <= v < 10^k (with k ==
-// estimated_power) but do not touch the numerator or denominator.
-// Otherwise the routine multiplies the numerator and the deltas by 10.
-static void FixupMultiply10(int estimated_power, bool is_even,
- int* decimal_point,
- Bignum* numerator, Bignum* denominator,
- Bignum* delta_minus, Bignum* delta_plus) {
- bool in_range;
- if (is_even) {
- // For IEEE doubles half-way cases (in decimal system numbers ending with 5)
- // are rounded to the closest floating-point number with even significand.
- in_range = Bignum::PlusCompare(*numerator, *delta_plus, *denominator) >= 0;
- } else {
- in_range = Bignum::PlusCompare(*numerator, *delta_plus, *denominator) > 0;
- }
- if (in_range) {
- // Since numerator + delta_plus >= denominator we already have
- // 1 <= numerator/denominator < 10. Simply update the estimated_power.
- *decimal_point = estimated_power + 1;
- } else {
- *decimal_point = estimated_power;
- numerator->Times10();
- if (Bignum::Equal(*delta_minus, *delta_plus)) {
- delta_minus->Times10();
- delta_plus->AssignBignum(*delta_minus);
- } else {
- delta_minus->Times10();
- delta_plus->Times10();
- }
- }
-}
-
-} // namespace double_conversion
-
-// ICU PATCH: Close ICU namespace
-U_NAMESPACE_END
-#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+//
+// From the double-conversion library. Original license:
+//
+// Copyright 2010 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.
+
+// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+#include <cmath>
+
+// ICU PATCH: Customize header file paths for ICU.
+
+#include "double-conversion-bignum-dtoa.h"
+
+#include "double-conversion-bignum.h"
+#include "double-conversion-ieee.h"
+
+// ICU PATCH: Wrap in ICU namespace
+U_NAMESPACE_BEGIN
+
+namespace double_conversion {
+
+static int NormalizedExponent(uint64_t significand, int exponent) {
+ DOUBLE_CONVERSION_ASSERT(significand != 0);
+ while ((significand & Double::kHiddenBit) == 0) {
+ significand = significand << 1;
+ exponent = exponent - 1;
+ }
+ return exponent;
+}
+
+
+// Forward declarations:
+// Returns an estimation of k such that 10^(k-1) <= v < 10^k.
+static int EstimatePower(int exponent);
+// Computes v / 10^estimated_power exactly, as a ratio of two bignums, numerator
+// and denominator.
+static void InitialScaledStartValues(uint64_t significand,
+ int exponent,
+ bool lower_boundary_is_closer,
+ int estimated_power,
+ bool need_boundary_deltas,
+ Bignum* numerator,
+ Bignum* denominator,
+ Bignum* delta_minus,
+ Bignum* delta_plus);
+// Multiplies numerator/denominator so that its values lies in the range 1-10.
+// Returns decimal_point s.t.
+// v = numerator'/denominator' * 10^(decimal_point-1)
+// where numerator' and denominator' are the values of numerator and
+// denominator after the call to this function.
+static void FixupMultiply10(int estimated_power, bool is_even,
+ int* decimal_point,
+ Bignum* numerator, Bignum* denominator,
+ Bignum* delta_minus, Bignum* delta_plus);
+// Generates digits from the left to the right and stops when the generated
+// digits yield the shortest decimal representation of v.
+static void GenerateShortestDigits(Bignum* numerator, Bignum* denominator,
+ Bignum* delta_minus, Bignum* delta_plus,
+ bool is_even,
+ Vector<char> buffer, int* length);
+// Generates 'requested_digits' after the decimal point.
+static void BignumToFixed(int requested_digits, int* decimal_point,
+ Bignum* numerator, Bignum* denominator,
+ Vector<char> buffer, int* length);
+// Generates 'count' digits of numerator/denominator.
+// Once 'count' digits have been produced rounds the result depending on the
+// remainder (remainders of exactly .5 round upwards). Might update the
+// decimal_point when rounding up (for example for 0.9999).
+static void GenerateCountedDigits(int count, int* decimal_point,
+ Bignum* numerator, Bignum* denominator,
+ Vector<char> buffer, int* length);
+
+
+void BignumDtoa(double v, BignumDtoaMode mode, int requested_digits,
+ Vector<char> buffer, int* length, int* decimal_point) {
+ DOUBLE_CONVERSION_ASSERT(v > 0);
+ DOUBLE_CONVERSION_ASSERT(!Double(v).IsSpecial());
+ uint64_t significand;
+ int exponent;
+ bool lower_boundary_is_closer;
+ if (mode == BIGNUM_DTOA_SHORTEST_SINGLE) {
+ float f = static_cast<float>(v);
+ DOUBLE_CONVERSION_ASSERT(f == v);
+ significand = Single(f).Significand();
+ exponent = Single(f).Exponent();
+ lower_boundary_is_closer = Single(f).LowerBoundaryIsCloser();
+ } else {
+ significand = Double(v).Significand();
+ exponent = Double(v).Exponent();
+ lower_boundary_is_closer = Double(v).LowerBoundaryIsCloser();
+ }
+ bool need_boundary_deltas =
+ (mode == BIGNUM_DTOA_SHORTEST || mode == BIGNUM_DTOA_SHORTEST_SINGLE);
+
+ bool is_even = (significand & 1) == 0;
+ int normalized_exponent = NormalizedExponent(significand, exponent);
+ // estimated_power might be too low by 1.
+ int estimated_power = EstimatePower(normalized_exponent);
+
+ // Shortcut for Fixed.
+ // The requested digits correspond to the digits after the point. If the
+ // number is much too small, then there is no need in trying to get any
+ // digits.
+ if (mode == BIGNUM_DTOA_FIXED && -estimated_power - 1 > requested_digits) {
+ buffer[0] = '\0';
+ *length = 0;
+ // Set decimal-point to -requested_digits. This is what Gay does.
+ // Note that it should not have any effect anyways since the string is
+ // empty.
+ *decimal_point = -requested_digits;
+ return;
+ }
+
+ Bignum numerator;
+ Bignum denominator;
+ Bignum delta_minus;
+ Bignum delta_plus;
+ // Make sure the bignum can grow large enough. The smallest double equals
+ // 4e-324. In this case the denominator needs fewer than 324*4 binary digits.
+ // The maximum double is 1.7976931348623157e308 which needs fewer than
+ // 308*4 binary digits.
+ DOUBLE_CONVERSION_ASSERT(Bignum::kMaxSignificantBits >= 324*4);
+ InitialScaledStartValues(significand, exponent, lower_boundary_is_closer,
+ estimated_power, need_boundary_deltas,
+ &numerator, &denominator,
+ &delta_minus, &delta_plus);
+ // We now have v = (numerator / denominator) * 10^estimated_power.
+ FixupMultiply10(estimated_power, is_even, decimal_point,
+ &numerator, &denominator,
+ &delta_minus, &delta_plus);
+ // We now have v = (numerator / denominator) * 10^(decimal_point-1), and
+ // 1 <= (numerator + delta_plus) / denominator < 10
+ switch (mode) {
+ case BIGNUM_DTOA_SHORTEST:
+ case BIGNUM_DTOA_SHORTEST_SINGLE:
+ GenerateShortestDigits(&numerator, &denominator,
+ &delta_minus, &delta_plus,
+ is_even, buffer, length);
+ break;
+ case BIGNUM_DTOA_FIXED:
+ BignumToFixed(requested_digits, decimal_point,
+ &numerator, &denominator,
+ buffer, length);
+ break;
+ case BIGNUM_DTOA_PRECISION:
+ GenerateCountedDigits(requested_digits, decimal_point,
+ &numerator, &denominator,
+ buffer, length);
+ break;
+ default:
+ DOUBLE_CONVERSION_UNREACHABLE();
+ }
+ buffer[*length] = '\0';
+}
+
+
+// The procedure starts generating digits from the left to the right and stops
+// when the generated digits yield the shortest decimal representation of v. A
+// decimal representation of v is a number lying closer to v than to any other
+// double, so it converts to v when read.
+//
+// This is true if d, the decimal representation, is between m- and m+, the
+// upper and lower boundaries. d must be strictly between them if !is_even.
+// m- := (numerator - delta_minus) / denominator
+// m+ := (numerator + delta_plus) / denominator
+//
+// Precondition: 0 <= (numerator+delta_plus) / denominator < 10.
+// If 1 <= (numerator+delta_plus) / denominator < 10 then no leading 0 digit
+// will be produced. This should be the standard precondition.
+static void GenerateShortestDigits(Bignum* numerator, Bignum* denominator,
+ Bignum* delta_minus, Bignum* delta_plus,
+ bool is_even,
+ Vector<char> buffer, int* length) {
+ // Small optimization: if delta_minus and delta_plus are the same just reuse
+ // one of the two bignums.
+ if (Bignum::Equal(*delta_minus, *delta_plus)) {
+ delta_plus = delta_minus;
+ }
+ *length = 0;
+ for (;;) {
+ uint16_t digit;
+ digit = numerator->DivideModuloIntBignum(*denominator);
+ DOUBLE_CONVERSION_ASSERT(digit <= 9); // digit is a uint16_t and therefore always positive.
+ // digit = numerator / denominator (integer division).
+ // numerator = numerator % denominator.
+ buffer[(*length)++] = static_cast<char>(digit + '0');
+
+ // Can we stop already?
+ // If the remainder of the division is less than the distance to the lower
+ // boundary we can stop. In this case we simply round down (discarding the
+ // remainder).
+ // Similarly we test if we can round up (using the upper boundary).
+ bool in_delta_room_minus;
+ bool in_delta_room_plus;
+ if (is_even) {
+ in_delta_room_minus = Bignum::LessEqual(*numerator, *delta_minus);
+ } else {
+ in_delta_room_minus = Bignum::Less(*numerator, *delta_minus);
+ }
+ if (is_even) {
+ in_delta_room_plus =
+ Bignum::PlusCompare(*numerator, *delta_plus, *denominator) >= 0;
+ } else {
+ in_delta_room_plus =
+ Bignum::PlusCompare(*numerator, *delta_plus, *denominator) > 0;
+ }
+ if (!in_delta_room_minus && !in_delta_room_plus) {
+ // Prepare for next iteration.
+ numerator->Times10();
+ delta_minus->Times10();
+ // We optimized delta_plus to be equal to delta_minus (if they share the
+ // same value). So don't multiply delta_plus if they point to the same
+ // object.
+ if (delta_minus != delta_plus) {
+ delta_plus->Times10();
+ }
+ } else if (in_delta_room_minus && in_delta_room_plus) {
+ // Let's see if 2*numerator < denominator.
+ // If yes, then the next digit would be < 5 and we can round down.
+ int compare = Bignum::PlusCompare(*numerator, *numerator, *denominator);
+ if (compare < 0) {
+ // Remaining digits are less than .5. -> Round down (== do nothing).
+ } else if (compare > 0) {
+ // Remaining digits are more than .5 of denominator. -> Round up.
+ // Note that the last digit could not be a '9' as otherwise the whole
+ // loop would have stopped earlier.
+ // We still have an assert here in case the preconditions were not
+ // satisfied.
+ DOUBLE_CONVERSION_ASSERT(buffer[(*length) - 1] != '9');
+ buffer[(*length) - 1]++;
+ } else {
+ // Halfway case.
+ // TODO(floitsch): need a way to solve half-way cases.
+ // For now let's round towards even (since this is what Gay seems to
+ // do).
+
+ if ((buffer[(*length) - 1] - '0') % 2 == 0) {
+ // Round down => Do nothing.
+ } else {
+ DOUBLE_CONVERSION_ASSERT(buffer[(*length) - 1] != '9');
+ buffer[(*length) - 1]++;
+ }
+ }
+ return;
+ } else if (in_delta_room_minus) {
+ // Round down (== do nothing).
+ return;
+ } else { // in_delta_room_plus
+ // Round up.
+ // Note again that the last digit could not be '9' since this would have
+ // stopped the loop earlier.
+ // We still have an DOUBLE_CONVERSION_ASSERT here, in case the preconditions were not
+ // satisfied.
+ DOUBLE_CONVERSION_ASSERT(buffer[(*length) -1] != '9');
+ buffer[(*length) - 1]++;
+ return;
+ }
+ }
+}
+
+
+// Let v = numerator / denominator < 10.
+// Then we generate 'count' digits of d = x.xxxxx... (without the decimal point)
+// from left to right. Once 'count' digits have been produced we decide wether
+// to round up or down. Remainders of exactly .5 round upwards. Numbers such
+// as 9.999999 propagate a carry all the way, and change the
+// exponent (decimal_point), when rounding upwards.
+static void GenerateCountedDigits(int count, int* decimal_point,
+ Bignum* numerator, Bignum* denominator,
+ Vector<char> buffer, int* length) {
+ DOUBLE_CONVERSION_ASSERT(count >= 0);
+ for (int i = 0; i < count - 1; ++i) {
+ uint16_t digit;
+ digit = numerator->DivideModuloIntBignum(*denominator);
+ DOUBLE_CONVERSION_ASSERT(digit <= 9); // digit is a uint16_t and therefore always positive.
+ // digit = numerator / denominator (integer division).
+ // numerator = numerator % denominator.
+ buffer[i] = static_cast<char>(digit + '0');
+ // Prepare for next iteration.
+ numerator->Times10();
+ }
+ // Generate the last digit.
+ uint16_t digit;
+ digit = numerator->DivideModuloIntBignum(*denominator);
+ if (Bignum::PlusCompare(*numerator, *numerator, *denominator) >= 0) {
+ digit++;
+ }
+ DOUBLE_CONVERSION_ASSERT(digit <= 10);
+ buffer[count - 1] = static_cast<char>(digit + '0');
+ // Correct bad digits (in case we had a sequence of '9's). Propagate the
+ // carry until we hat a non-'9' or til we reach the first digit.
+ for (int i = count - 1; i > 0; --i) {
+ if (buffer[i] != '0' + 10) break;
+ buffer[i] = '0';
+ buffer[i - 1]++;
+ }
+ if (buffer[0] == '0' + 10) {
+ // Propagate a carry past the top place.
+ buffer[0] = '1';
+ (*decimal_point)++;
+ }
+ *length = count;
+}
+
+
+// Generates 'requested_digits' after the decimal point. It might omit
+// trailing '0's. If the input number is too small then no digits at all are
+// generated (ex.: 2 fixed digits for 0.00001).
+//
+// Input verifies: 1 <= (numerator + delta) / denominator < 10.
+static void BignumToFixed(int requested_digits, int* decimal_point,
+ Bignum* numerator, Bignum* denominator,
+ Vector<char> buffer, int* length) {
+ // Note that we have to look at more than just the requested_digits, since
+ // a number could be rounded up. Example: v=0.5 with requested_digits=0.
+ // Even though the power of v equals 0 we can't just stop here.
+ if (-(*decimal_point) > requested_digits) {
+ // The number is definitively too small.
+ // Ex: 0.001 with requested_digits == 1.
+ // Set decimal-point to -requested_digits. This is what Gay does.
+ // Note that it should not have any effect anyways since the string is
+ // empty.
+ *decimal_point = -requested_digits;
+ *length = 0;
+ return;
+ } else if (-(*decimal_point) == requested_digits) {
+ // We only need to verify if the number rounds down or up.
+ // Ex: 0.04 and 0.06 with requested_digits == 1.
+ DOUBLE_CONVERSION_ASSERT(*decimal_point == -requested_digits);
+ // Initially the fraction lies in range (1, 10]. Multiply the denominator
+ // by 10 so that we can compare more easily.
+ denominator->Times10();
+ if (Bignum::PlusCompare(*numerator, *numerator, *denominator) >= 0) {
+ // If the fraction is >= 0.5 then we have to include the rounded
+ // digit.
+ buffer[0] = '1';
+ *length = 1;
+ (*decimal_point)++;
+ } else {
+ // Note that we caught most of similar cases earlier.
+ *length = 0;
+ }
+ return;
+ } else {
+ // The requested digits correspond to the digits after the point.
+ // The variable 'needed_digits' includes the digits before the point.
+ int needed_digits = (*decimal_point) + requested_digits;
+ GenerateCountedDigits(needed_digits, decimal_point,
+ numerator, denominator,
+ buffer, length);
+ }
+}
+
+
+// Returns an estimation of k such that 10^(k-1) <= v < 10^k where
+// v = f * 2^exponent and 2^52 <= f < 2^53.
+// v is hence a normalized double with the given exponent. The output is an
+// approximation for the exponent of the decimal approimation .digits * 10^k.
+//
+// The result might undershoot by 1 in which case 10^k <= v < 10^k+1.
+// Note: this property holds for v's upper boundary m+ too.
+// 10^k <= m+ < 10^k+1.
+// (see explanation below).
+//
+// Examples:
+// EstimatePower(0) => 16
+// EstimatePower(-52) => 0
+//
+// Note: e >= 0 => EstimatedPower(e) > 0. No similar claim can be made for e<0.
+static int EstimatePower(int exponent) {
+ // This function estimates log10 of v where v = f*2^e (with e == exponent).
+ // Note that 10^floor(log10(v)) <= v, but v <= 10^ceil(log10(v)).
+ // Note that f is bounded by its container size. Let p = 53 (the double's
+ // significand size). Then 2^(p-1) <= f < 2^p.
+ //
+ // Given that log10(v) == log2(v)/log2(10) and e+(len(f)-1) is quite close
+ // to log2(v) the function is simplified to (e+(len(f)-1)/log2(10)).
+ // The computed number undershoots by less than 0.631 (when we compute log3
+ // and not log10).
+ //
+ // Optimization: since we only need an approximated result this computation
+ // can be performed on 64 bit integers. On x86/x64 architecture the speedup is
+ // not really measurable, though.
+ //
+ // Since we want to avoid overshooting we decrement by 1e10 so that
+ // floating-point imprecisions don't affect us.
+ //
+ // Explanation for v's boundary m+: the computation takes advantage of
+ // the fact that 2^(p-1) <= f < 2^p. Boundaries still satisfy this requirement
+ // (even for denormals where the delta can be much more important).
+
+ const double k1Log10 = 0.30102999566398114; // 1/lg(10)
+
+ // For doubles len(f) == 53 (don't forget the hidden bit).
+ const int kSignificandSize = Double::kSignificandSize;
+ double estimate = ceil((exponent + kSignificandSize - 1) * k1Log10 - 1e-10);
+ return static_cast<int>(estimate);
+}
+
+
+// See comments for InitialScaledStartValues.
+static void InitialScaledStartValuesPositiveExponent(
+ uint64_t significand, int exponent,
+ int estimated_power, bool need_boundary_deltas,
+ Bignum* numerator, Bignum* denominator,
+ Bignum* delta_minus, Bignum* delta_plus) {
+ // A positive exponent implies a positive power.
+ DOUBLE_CONVERSION_ASSERT(estimated_power >= 0);
+ // Since the estimated_power is positive we simply multiply the denominator
+ // by 10^estimated_power.
+
+ // numerator = v.
+ numerator->AssignUInt64(significand);
+ numerator->ShiftLeft(exponent);
+ // denominator = 10^estimated_power.
+ denominator->AssignPowerUInt16(10, estimated_power);
+
+ if (need_boundary_deltas) {
+ // Introduce a common denominator so that the deltas to the boundaries are
+ // integers.
+ denominator->ShiftLeft(1);
+ numerator->ShiftLeft(1);
+ // Let v = f * 2^e, then m+ - v = 1/2 * 2^e; With the common
+ // denominator (of 2) delta_plus equals 2^e.
+ delta_plus->AssignUInt16(1);
+ delta_plus->ShiftLeft(exponent);
+ // Same for delta_minus. The adjustments if f == 2^p-1 are done later.
+ delta_minus->AssignUInt16(1);
+ delta_minus->ShiftLeft(exponent);
+ }
+}
+
+
+// See comments for InitialScaledStartValues
+static void InitialScaledStartValuesNegativeExponentPositivePower(
+ uint64_t significand, int exponent,
+ int estimated_power, bool need_boundary_deltas,
+ Bignum* numerator, Bignum* denominator,
+ Bignum* delta_minus, Bignum* delta_plus) {
+ // v = f * 2^e with e < 0, and with estimated_power >= 0.
+ // This means that e is close to 0 (have a look at how estimated_power is
+ // computed).
+
+ // numerator = significand
+ // since v = significand * 2^exponent this is equivalent to
+ // numerator = v * / 2^-exponent
+ numerator->AssignUInt64(significand);
+ // denominator = 10^estimated_power * 2^-exponent (with exponent < 0)
+ denominator->AssignPowerUInt16(10, estimated_power);
+ denominator->ShiftLeft(-exponent);
+
+ if (need_boundary_deltas) {
+ // Introduce a common denominator so that the deltas to the boundaries are
+ // integers.
+ denominator->ShiftLeft(1);
+ numerator->ShiftLeft(1);
+ // Let v = f * 2^e, then m+ - v = 1/2 * 2^e; With the common
+ // denominator (of 2) delta_plus equals 2^e.
+ // Given that the denominator already includes v's exponent the distance
+ // to the boundaries is simply 1.
+ delta_plus->AssignUInt16(1);
+ // Same for delta_minus. The adjustments if f == 2^p-1 are done later.
+ delta_minus->AssignUInt16(1);
+ }
+}
+
+
+// See comments for InitialScaledStartValues
+static void InitialScaledStartValuesNegativeExponentNegativePower(
+ uint64_t significand, int exponent,
+ int estimated_power, bool need_boundary_deltas,
+ Bignum* numerator, Bignum* denominator,
+ Bignum* delta_minus, Bignum* delta_plus) {
+ // Instead of multiplying the denominator with 10^estimated_power we
+ // multiply all values (numerator and deltas) by 10^-estimated_power.
+
+ // Use numerator as temporary container for power_ten.
+ Bignum* power_ten = numerator;
+ power_ten->AssignPowerUInt16(10, -estimated_power);
+
+ if (need_boundary_deltas) {
+ // Since power_ten == numerator we must make a copy of 10^estimated_power
+ // before we complete the computation of the numerator.
+ // delta_plus = delta_minus = 10^estimated_power
+ delta_plus->AssignBignum(*power_ten);
+ delta_minus->AssignBignum(*power_ten);
+ }
+
+ // numerator = significand * 2 * 10^-estimated_power
+ // since v = significand * 2^exponent this is equivalent to
+ // numerator = v * 10^-estimated_power * 2 * 2^-exponent.
+ // Remember: numerator has been abused as power_ten. So no need to assign it
+ // to itself.
+ DOUBLE_CONVERSION_ASSERT(numerator == power_ten);
+ numerator->MultiplyByUInt64(significand);
+
+ // denominator = 2 * 2^-exponent with exponent < 0.
+ denominator->AssignUInt16(1);
+ denominator->ShiftLeft(-exponent);
+
+ if (need_boundary_deltas) {
+ // Introduce a common denominator so that the deltas to the boundaries are
+ // integers.
+ numerator->ShiftLeft(1);
+ denominator->ShiftLeft(1);
+ // With this shift the boundaries have their correct value, since
+ // delta_plus = 10^-estimated_power, and
+ // delta_minus = 10^-estimated_power.
+ // These assignments have been done earlier.
+ // The adjustments if f == 2^p-1 (lower boundary is closer) are done later.
+ }
+}
+
+
+// Let v = significand * 2^exponent.
+// Computes v / 10^estimated_power exactly, as a ratio of two bignums, numerator
+// and denominator. The functions GenerateShortestDigits and
+// GenerateCountedDigits will then convert this ratio to its decimal
+// representation d, with the required accuracy.
+// Then d * 10^estimated_power is the representation of v.
+// (Note: the fraction and the estimated_power might get adjusted before
+// generating the decimal representation.)
+//
+// The initial start values consist of:
+// - a scaled numerator: s.t. numerator/denominator == v / 10^estimated_power.
+// - a scaled (common) denominator.
+// optionally (used by GenerateShortestDigits to decide if it has the shortest
+// decimal converting back to v):
+// - v - m-: the distance to the lower boundary.
+// - m+ - v: the distance to the upper boundary.
+//
+// v, m+, m-, and therefore v - m- and m+ - v all share the same denominator.
+//
+// Let ep == estimated_power, then the returned values will satisfy:
+// v / 10^ep = numerator / denominator.
+// v's boundarys m- and m+:
+// m- / 10^ep == v / 10^ep - delta_minus / denominator
+// m+ / 10^ep == v / 10^ep + delta_plus / denominator
+// Or in other words:
+// m- == v - delta_minus * 10^ep / denominator;
+// m+ == v + delta_plus * 10^ep / denominator;
+//
+// Since 10^(k-1) <= v < 10^k (with k == estimated_power)
+// or 10^k <= v < 10^(k+1)
+// we then have 0.1 <= numerator/denominator < 1
+// or 1 <= numerator/denominator < 10
+//
+// It is then easy to kickstart the digit-generation routine.
+//
+// The boundary-deltas are only filled if the mode equals BIGNUM_DTOA_SHORTEST
+// or BIGNUM_DTOA_SHORTEST_SINGLE.
+
+static void InitialScaledStartValues(uint64_t significand,
+ int exponent,
+ bool lower_boundary_is_closer,
+ int estimated_power,
+ bool need_boundary_deltas,
+ Bignum* numerator,
+ Bignum* denominator,
+ Bignum* delta_minus,
+ Bignum* delta_plus) {
+ if (exponent >= 0) {
+ InitialScaledStartValuesPositiveExponent(
+ significand, exponent, estimated_power, need_boundary_deltas,
+ numerator, denominator, delta_minus, delta_plus);
+ } else if (estimated_power >= 0) {
+ InitialScaledStartValuesNegativeExponentPositivePower(
+ significand, exponent, estimated_power, need_boundary_deltas,
+ numerator, denominator, delta_minus, delta_plus);
+ } else {
+ InitialScaledStartValuesNegativeExponentNegativePower(
+ significand, exponent, estimated_power, need_boundary_deltas,
+ numerator, denominator, delta_minus, delta_plus);
+ }
+
+ if (need_boundary_deltas && lower_boundary_is_closer) {
+ // The lower boundary is closer at half the distance of "normal" numbers.
+ // Increase the common denominator and adapt all but the delta_minus.
+ denominator->ShiftLeft(1); // *2
+ numerator->ShiftLeft(1); // *2
+ delta_plus->ShiftLeft(1); // *2
+ }
+}
+
+
+// This routine multiplies numerator/denominator so that its values lies in the
+// range 1-10. That is after a call to this function we have:
+// 1 <= (numerator + delta_plus) /denominator < 10.
+// Let numerator the input before modification and numerator' the argument
+// after modification, then the output-parameter decimal_point is such that
+// numerator / denominator * 10^estimated_power ==
+// numerator' / denominator' * 10^(decimal_point - 1)
+// In some cases estimated_power was too low, and this is already the case. We
+// then simply adjust the power so that 10^(k-1) <= v < 10^k (with k ==
+// estimated_power) but do not touch the numerator or denominator.
+// Otherwise the routine multiplies the numerator and the deltas by 10.
+static void FixupMultiply10(int estimated_power, bool is_even,
+ int* decimal_point,
+ Bignum* numerator, Bignum* denominator,
+ Bignum* delta_minus, Bignum* delta_plus) {
+ bool in_range;
+ if (is_even) {
+ // For IEEE doubles half-way cases (in decimal system numbers ending with 5)
+ // are rounded to the closest floating-point number with even significand.
+ in_range = Bignum::PlusCompare(*numerator, *delta_plus, *denominator) >= 0;
+ } else {
+ in_range = Bignum::PlusCompare(*numerator, *delta_plus, *denominator) > 0;
+ }
+ if (in_range) {
+ // Since numerator + delta_plus >= denominator we already have
+ // 1 <= numerator/denominator < 10. Simply update the estimated_power.
+ *decimal_point = estimated_power + 1;
+ } else {
+ *decimal_point = estimated_power;
+ numerator->Times10();
+ if (Bignum::Equal(*delta_minus, *delta_plus)) {
+ delta_minus->Times10();
+ delta_plus->AssignBignum(*delta_minus);
+ } else {
+ delta_minus->Times10();
+ delta_plus->Times10();
+ }
+ }
+}
+
+} // namespace double_conversion
+
+// ICU PATCH: Close ICU namespace
+U_NAMESPACE_END
+#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/double-conversion-bignum-dtoa.h b/contrib/libs/icu/i18n/double-conversion-bignum-dtoa.h
index f094236a4e..edc21b0f2e 100644
--- a/contrib/libs/icu/i18n/double-conversion-bignum-dtoa.h
+++ b/contrib/libs/icu/i18n/double-conversion-bignum-dtoa.h
@@ -1,102 +1,102 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// From the double-conversion library. Original license:
-//
-// Copyright 2010 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.
-
-// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-#ifndef DOUBLE_CONVERSION_BIGNUM_DTOA_H_
-#define DOUBLE_CONVERSION_BIGNUM_DTOA_H_
-
-// ICU PATCH: Customize header file paths for ICU.
-
-#include "double-conversion-utils.h"
-
-// ICU PATCH: Wrap in ICU namespace
-U_NAMESPACE_BEGIN
-
-namespace double_conversion {
-
-enum BignumDtoaMode {
- // Return the shortest correct representation.
- // For example the output of 0.299999999999999988897 is (the less accurate but
- // correct) 0.3.
- BIGNUM_DTOA_SHORTEST,
- // Same as BIGNUM_DTOA_SHORTEST but for single-precision floats.
- BIGNUM_DTOA_SHORTEST_SINGLE,
- // Return a fixed number of digits after the decimal point.
- // For instance fixed(0.1, 4) becomes 0.1000
- // If the input number is big, the output will be big.
- BIGNUM_DTOA_FIXED,
- // Return a fixed number of digits, no matter what the exponent is.
- BIGNUM_DTOA_PRECISION
-};
-
-// Converts the given double 'v' to ascii.
-// The result should be interpreted as buffer * 10^(point-length).
-// The buffer will be null-terminated.
-//
-// The input v must be > 0 and different from NaN, and Infinity.
-//
-// The output depends on the given mode:
-// - SHORTEST: produce the least amount of digits for which the internal
-// identity requirement is still satisfied. If the digits are printed
-// (together with the correct exponent) then reading this number will give
-// 'v' again. The buffer will choose the representation that is closest to
-// 'v'. If there are two at the same distance, than the number is round up.
-// In this mode the 'requested_digits' parameter is ignored.
-// - FIXED: produces digits necessary to print a given number with
-// 'requested_digits' digits after the decimal point. The produced digits
-// might be too short in which case the caller has to fill the gaps with '0's.
-// Example: toFixed(0.001, 5) is allowed to return buffer="1", point=-2.
-// Halfway cases are rounded up. The call toFixed(0.15, 2) thus returns
-// buffer="2", point=0.
-// Note: the length of the returned buffer has no meaning wrt the significance
-// of its digits. That is, just because it contains '0's does not mean that
-// any other digit would not satisfy the internal identity requirement.
-// - PRECISION: produces 'requested_digits' where the first digit is not '0'.
-// Even though the length of produced digits usually equals
-// 'requested_digits', the function is allowed to return fewer digits, in
-// which case the caller has to fill the missing digits with '0's.
-// Halfway cases are again rounded up.
-// 'BignumDtoa' expects the given buffer to be big enough to hold all digits
-// and a terminating null-character.
-void BignumDtoa(double v, BignumDtoaMode mode, int requested_digits,
- Vector<char> buffer, int* length, int* point);
-
-} // namespace double_conversion
-
-// ICU PATCH: Close ICU namespace
-U_NAMESPACE_END
-
-#endif // DOUBLE_CONVERSION_BIGNUM_DTOA_H_
-#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+//
+// From the double-conversion library. Original license:
+//
+// Copyright 2010 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.
+
+// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+#ifndef DOUBLE_CONVERSION_BIGNUM_DTOA_H_
+#define DOUBLE_CONVERSION_BIGNUM_DTOA_H_
+
+// ICU PATCH: Customize header file paths for ICU.
+
+#include "double-conversion-utils.h"
+
+// ICU PATCH: Wrap in ICU namespace
+U_NAMESPACE_BEGIN
+
+namespace double_conversion {
+
+enum BignumDtoaMode {
+ // Return the shortest correct representation.
+ // For example the output of 0.299999999999999988897 is (the less accurate but
+ // correct) 0.3.
+ BIGNUM_DTOA_SHORTEST,
+ // Same as BIGNUM_DTOA_SHORTEST but for single-precision floats.
+ BIGNUM_DTOA_SHORTEST_SINGLE,
+ // Return a fixed number of digits after the decimal point.
+ // For instance fixed(0.1, 4) becomes 0.1000
+ // If the input number is big, the output will be big.
+ BIGNUM_DTOA_FIXED,
+ // Return a fixed number of digits, no matter what the exponent is.
+ BIGNUM_DTOA_PRECISION
+};
+
+// Converts the given double 'v' to ascii.
+// The result should be interpreted as buffer * 10^(point-length).
+// The buffer will be null-terminated.
+//
+// The input v must be > 0 and different from NaN, and Infinity.
+//
+// The output depends on the given mode:
+// - SHORTEST: produce the least amount of digits for which the internal
+// identity requirement is still satisfied. If the digits are printed
+// (together with the correct exponent) then reading this number will give
+// 'v' again. The buffer will choose the representation that is closest to
+// 'v'. If there are two at the same distance, than the number is round up.
+// In this mode the 'requested_digits' parameter is ignored.
+// - FIXED: produces digits necessary to print a given number with
+// 'requested_digits' digits after the decimal point. The produced digits
+// might be too short in which case the caller has to fill the gaps with '0's.
+// Example: toFixed(0.001, 5) is allowed to return buffer="1", point=-2.
+// Halfway cases are rounded up. The call toFixed(0.15, 2) thus returns
+// buffer="2", point=0.
+// Note: the length of the returned buffer has no meaning wrt the significance
+// of its digits. That is, just because it contains '0's does not mean that
+// any other digit would not satisfy the internal identity requirement.
+// - PRECISION: produces 'requested_digits' where the first digit is not '0'.
+// Even though the length of produced digits usually equals
+// 'requested_digits', the function is allowed to return fewer digits, in
+// which case the caller has to fill the missing digits with '0's.
+// Halfway cases are again rounded up.
+// 'BignumDtoa' expects the given buffer to be big enough to hold all digits
+// and a terminating null-character.
+void BignumDtoa(double v, BignumDtoaMode mode, int requested_digits,
+ Vector<char> buffer, int* length, int* point);
+
+} // namespace double_conversion
+
+// ICU PATCH: Close ICU namespace
+U_NAMESPACE_END
+
+#endif // DOUBLE_CONVERSION_BIGNUM_DTOA_H_
+#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/double-conversion-bignum.cpp b/contrib/libs/icu/i18n/double-conversion-bignum.cpp
index 025973eaa2..996d75c9f6 100644
--- a/contrib/libs/icu/i18n/double-conversion-bignum.cpp
+++ b/contrib/libs/icu/i18n/double-conversion-bignum.cpp
@@ -1,814 +1,814 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// From the double-conversion library. Original license:
-//
-// Copyright 2010 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.
-
-// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-#include <algorithm>
-#include <cstring>
-
-// ICU PATCH: Customize header file paths for ICU.
-
-#include "double-conversion-bignum.h"
-#include "double-conversion-utils.h"
-
-// ICU PATCH: Wrap in ICU namespace
-U_NAMESPACE_BEGIN
-
-namespace double_conversion {
-
-Bignum::Chunk& Bignum::RawBigit(const int index) {
- DOUBLE_CONVERSION_ASSERT(static_cast<unsigned>(index) < kBigitCapacity);
- return bigits_buffer_[index];
-}
-
-
-const Bignum::Chunk& Bignum::RawBigit(const int index) const {
- DOUBLE_CONVERSION_ASSERT(static_cast<unsigned>(index) < kBigitCapacity);
- return bigits_buffer_[index];
-}
-
-
-template<typename S>
-static int BitSize(const S value) {
- (void) value; // Mark variable as used.
- return 8 * sizeof(value);
-}
-
-// Guaranteed to lie in one Bigit.
-void Bignum::AssignUInt16(const uint16_t value) {
- DOUBLE_CONVERSION_ASSERT(kBigitSize >= BitSize(value));
- Zero();
- if (value > 0) {
- RawBigit(0) = value;
- used_bigits_ = 1;
- }
-}
-
-
-void Bignum::AssignUInt64(uint64_t value) {
- Zero();
- for(int i = 0; value > 0; ++i) {
- RawBigit(i) = value & kBigitMask;
- value >>= kBigitSize;
- ++used_bigits_;
- }
-}
-
-
-void Bignum::AssignBignum(const Bignum& other) {
- exponent_ = other.exponent_;
- for (int i = 0; i < other.used_bigits_; ++i) {
- RawBigit(i) = other.RawBigit(i);
- }
- used_bigits_ = other.used_bigits_;
-}
-
-
-static uint64_t ReadUInt64(const Vector<const char> buffer,
- const int from,
- const int digits_to_read) {
- uint64_t result = 0;
- for (int i = from; i < from + digits_to_read; ++i) {
- const int digit = buffer[i] - '0';
- DOUBLE_CONVERSION_ASSERT(0 <= digit && digit <= 9);
- result = result * 10 + digit;
- }
- return result;
-}
-
-
-void Bignum::AssignDecimalString(const Vector<const char> value) {
- // 2^64 = 18446744073709551616 > 10^19
- static const int kMaxUint64DecimalDigits = 19;
- Zero();
- int length = value.length();
- unsigned pos = 0;
- // Let's just say that each digit needs 4 bits.
- while (length >= kMaxUint64DecimalDigits) {
- const uint64_t digits = ReadUInt64(value, pos, kMaxUint64DecimalDigits);
- pos += kMaxUint64DecimalDigits;
- length -= kMaxUint64DecimalDigits;
- MultiplyByPowerOfTen(kMaxUint64DecimalDigits);
- AddUInt64(digits);
- }
- const uint64_t digits = ReadUInt64(value, pos, length);
- MultiplyByPowerOfTen(length);
- AddUInt64(digits);
- Clamp();
-}
-
-
-static uint64_t HexCharValue(const int c) {
- if ('0' <= c && c <= '9') {
- return c - '0';
- }
- if ('a' <= c && c <= 'f') {
- return 10 + c - 'a';
- }
- DOUBLE_CONVERSION_ASSERT('A' <= c && c <= 'F');
- return 10 + c - 'A';
-}
-
-
-// Unlike AssignDecimalString(), this function is "only" used
-// for unit-tests and therefore not performance critical.
-void Bignum::AssignHexString(Vector<const char> value) {
- Zero();
- // Required capacity could be reduced by ignoring leading zeros.
- EnsureCapacity(((value.length() * 4) + kBigitSize - 1) / kBigitSize);
- DOUBLE_CONVERSION_ASSERT(sizeof(uint64_t) * 8 >= kBigitSize + 4); // TODO: static_assert
- // Accumulates converted hex digits until at least kBigitSize bits.
- // Works with non-factor-of-four kBigitSizes.
- uint64_t tmp = 0; // Accumulates converted hex digits until at least
- for (int cnt = 0; !value.is_empty(); value.pop_back()) {
- tmp |= (HexCharValue(value.last()) << cnt);
- if ((cnt += 4) >= kBigitSize) {
- RawBigit(used_bigits_++) = (tmp & kBigitMask);
- cnt -= kBigitSize;
- tmp >>= kBigitSize;
- }
- }
- if (tmp > 0) {
- RawBigit(used_bigits_++) = tmp;
- }
- Clamp();
-}
-
-
-void Bignum::AddUInt64(const uint64_t operand) {
- if (operand == 0) {
- return;
- }
- Bignum other;
- other.AssignUInt64(operand);
- AddBignum(other);
-}
-
-
-void Bignum::AddBignum(const Bignum& other) {
- DOUBLE_CONVERSION_ASSERT(IsClamped());
- DOUBLE_CONVERSION_ASSERT(other.IsClamped());
-
- // If this has a greater exponent than other append zero-bigits to this.
- // After this call exponent_ <= other.exponent_.
- Align(other);
-
- // There are two possibilities:
- // aaaaaaaaaaa 0000 (where the 0s represent a's exponent)
- // bbbbb 00000000
- // ----------------
- // ccccccccccc 0000
- // or
- // aaaaaaaaaa 0000
- // bbbbbbbbb 0000000
- // -----------------
- // cccccccccccc 0000
- // In both cases we might need a carry bigit.
-
- EnsureCapacity(1 + (std::max)(BigitLength(), other.BigitLength()) - exponent_);
- Chunk carry = 0;
- int bigit_pos = other.exponent_ - exponent_;
- DOUBLE_CONVERSION_ASSERT(bigit_pos >= 0);
- for (int i = used_bigits_; i < bigit_pos; ++i) {
- RawBigit(i) = 0;
- }
- for (int i = 0; i < other.used_bigits_; ++i) {
- const Chunk my = (bigit_pos < used_bigits_) ? RawBigit(bigit_pos) : 0;
- const Chunk sum = my + other.RawBigit(i) + carry;
- RawBigit(bigit_pos) = sum & kBigitMask;
- carry = sum >> kBigitSize;
- ++bigit_pos;
- }
- while (carry != 0) {
- const Chunk my = (bigit_pos < used_bigits_) ? RawBigit(bigit_pos) : 0;
- const Chunk sum = my + carry;
- RawBigit(bigit_pos) = sum & kBigitMask;
- carry = sum >> kBigitSize;
- ++bigit_pos;
- }
- used_bigits_ = (std::max)(bigit_pos, static_cast<int>(used_bigits_));
- DOUBLE_CONVERSION_ASSERT(IsClamped());
-}
-
-
-void Bignum::SubtractBignum(const Bignum& other) {
- DOUBLE_CONVERSION_ASSERT(IsClamped());
- DOUBLE_CONVERSION_ASSERT(other.IsClamped());
- // We require this to be bigger than other.
- DOUBLE_CONVERSION_ASSERT(LessEqual(other, *this));
-
- Align(other);
-
- const int offset = other.exponent_ - exponent_;
- Chunk borrow = 0;
- int i;
- for (i = 0; i < other.used_bigits_; ++i) {
- DOUBLE_CONVERSION_ASSERT((borrow == 0) || (borrow == 1));
- const Chunk difference = RawBigit(i + offset) - other.RawBigit(i) - borrow;
- RawBigit(i + offset) = difference & kBigitMask;
- borrow = difference >> (kChunkSize - 1);
- }
- while (borrow != 0) {
- const Chunk difference = RawBigit(i + offset) - borrow;
- RawBigit(i + offset) = difference & kBigitMask;
- borrow = difference >> (kChunkSize - 1);
- ++i;
- }
- Clamp();
-}
-
-
-void Bignum::ShiftLeft(const int shift_amount) {
- if (used_bigits_ == 0) {
- return;
- }
- exponent_ += (shift_amount / kBigitSize);
- const int local_shift = shift_amount % kBigitSize;
- EnsureCapacity(used_bigits_ + 1);
- BigitsShiftLeft(local_shift);
-}
-
-
-void Bignum::MultiplyByUInt32(const uint32_t factor) {
- if (factor == 1) {
- return;
- }
- if (factor == 0) {
- Zero();
- return;
- }
- if (used_bigits_ == 0) {
- return;
- }
- // The product of a bigit with the factor is of size kBigitSize + 32.
- // Assert that this number + 1 (for the carry) fits into double chunk.
- DOUBLE_CONVERSION_ASSERT(kDoubleChunkSize >= kBigitSize + 32 + 1);
- DoubleChunk carry = 0;
- for (int i = 0; i < used_bigits_; ++i) {
- const DoubleChunk product = static_cast<DoubleChunk>(factor) * RawBigit(i) + carry;
- RawBigit(i) = static_cast<Chunk>(product & kBigitMask);
- carry = (product >> kBigitSize);
- }
- while (carry != 0) {
- EnsureCapacity(used_bigits_ + 1);
- RawBigit(used_bigits_) = carry & kBigitMask;
- used_bigits_++;
- carry >>= kBigitSize;
- }
-}
-
-
-void Bignum::MultiplyByUInt64(const uint64_t factor) {
- if (factor == 1) {
- return;
- }
- if (factor == 0) {
- Zero();
- return;
- }
- if (used_bigits_ == 0) {
- return;
- }
- DOUBLE_CONVERSION_ASSERT(kBigitSize < 32);
- uint64_t carry = 0;
- const uint64_t low = factor & 0xFFFFFFFF;
- const uint64_t high = factor >> 32;
- for (int i = 0; i < used_bigits_; ++i) {
- const uint64_t product_low = low * RawBigit(i);
- const uint64_t product_high = high * RawBigit(i);
- const uint64_t tmp = (carry & kBigitMask) + product_low;
- RawBigit(i) = tmp & kBigitMask;
- carry = (carry >> kBigitSize) + (tmp >> kBigitSize) +
- (product_high << (32 - kBigitSize));
- }
- while (carry != 0) {
- EnsureCapacity(used_bigits_ + 1);
- RawBigit(used_bigits_) = carry & kBigitMask;
- used_bigits_++;
- carry >>= kBigitSize;
- }
-}
-
-
-void Bignum::MultiplyByPowerOfTen(const int exponent) {
- static const uint64_t kFive27 = DOUBLE_CONVERSION_UINT64_2PART_C(0x6765c793, fa10079d);
- static const uint16_t kFive1 = 5;
- static const uint16_t kFive2 = kFive1 * 5;
- static const uint16_t kFive3 = kFive2 * 5;
- static const uint16_t kFive4 = kFive3 * 5;
- static const uint16_t kFive5 = kFive4 * 5;
- static const uint16_t kFive6 = kFive5 * 5;
- static const uint32_t kFive7 = kFive6 * 5;
- static const uint32_t kFive8 = kFive7 * 5;
- static const uint32_t kFive9 = kFive8 * 5;
- static const uint32_t kFive10 = kFive9 * 5;
- static const uint32_t kFive11 = kFive10 * 5;
- static const uint32_t kFive12 = kFive11 * 5;
- static const uint32_t kFive13 = kFive12 * 5;
- static const uint32_t kFive1_to_12[] =
- { kFive1, kFive2, kFive3, kFive4, kFive5, kFive6,
- kFive7, kFive8, kFive9, kFive10, kFive11, kFive12 };
-
- DOUBLE_CONVERSION_ASSERT(exponent >= 0);
-
- if (exponent == 0) {
- return;
- }
- if (used_bigits_ == 0) {
- return;
- }
- // We shift by exponent at the end just before returning.
- int remaining_exponent = exponent;
- while (remaining_exponent >= 27) {
- MultiplyByUInt64(kFive27);
- remaining_exponent -= 27;
- }
- while (remaining_exponent >= 13) {
- MultiplyByUInt32(kFive13);
- remaining_exponent -= 13;
- }
- if (remaining_exponent > 0) {
- MultiplyByUInt32(kFive1_to_12[remaining_exponent - 1]);
- }
- ShiftLeft(exponent);
-}
-
-
-void Bignum::Square() {
- DOUBLE_CONVERSION_ASSERT(IsClamped());
- const int product_length = 2 * used_bigits_;
- EnsureCapacity(product_length);
-
- // Comba multiplication: compute each column separately.
- // Example: r = a2a1a0 * b2b1b0.
- // r = 1 * a0b0 +
- // 10 * (a1b0 + a0b1) +
- // 100 * (a2b0 + a1b1 + a0b2) +
- // 1000 * (a2b1 + a1b2) +
- // 10000 * a2b2
- //
- // In the worst case we have to accumulate nb-digits products of digit*digit.
- //
- // Assert that the additional number of bits in a DoubleChunk are enough to
- // sum up used_digits of Bigit*Bigit.
- if ((1 << (2 * (kChunkSize - kBigitSize))) <= used_bigits_) {
- DOUBLE_CONVERSION_UNIMPLEMENTED();
- }
- DoubleChunk accumulator = 0;
- // First shift the digits so we don't overwrite them.
- const int copy_offset = used_bigits_;
- for (int i = 0; i < used_bigits_; ++i) {
- RawBigit(copy_offset + i) = RawBigit(i);
- }
- // We have two loops to avoid some 'if's in the loop.
- for (int i = 0; i < used_bigits_; ++i) {
- // Process temporary digit i with power i.
- // The sum of the two indices must be equal to i.
- int bigit_index1 = i;
- int bigit_index2 = 0;
- // Sum all of the sub-products.
- while (bigit_index1 >= 0) {
- const Chunk chunk1 = RawBigit(copy_offset + bigit_index1);
- const Chunk chunk2 = RawBigit(copy_offset + bigit_index2);
- accumulator += static_cast<DoubleChunk>(chunk1) * chunk2;
- bigit_index1--;
- bigit_index2++;
- }
- RawBigit(i) = static_cast<Chunk>(accumulator) & kBigitMask;
- accumulator >>= kBigitSize;
- }
- for (int i = used_bigits_; i < product_length; ++i) {
- int bigit_index1 = used_bigits_ - 1;
- int bigit_index2 = i - bigit_index1;
- // Invariant: sum of both indices is again equal to i.
- // Inner loop runs 0 times on last iteration, emptying accumulator.
- while (bigit_index2 < used_bigits_) {
- const Chunk chunk1 = RawBigit(copy_offset + bigit_index1);
- const Chunk chunk2 = RawBigit(copy_offset + bigit_index2);
- accumulator += static_cast<DoubleChunk>(chunk1) * chunk2;
- bigit_index1--;
- bigit_index2++;
- }
- // The overwritten RawBigit(i) will never be read in further loop iterations,
- // because bigit_index1 and bigit_index2 are always greater
- // than i - used_bigits_.
- RawBigit(i) = static_cast<Chunk>(accumulator) & kBigitMask;
- accumulator >>= kBigitSize;
- }
- // Since the result was guaranteed to lie inside the number the
- // accumulator must be 0 now.
- DOUBLE_CONVERSION_ASSERT(accumulator == 0);
-
- // Don't forget to update the used_digits and the exponent.
- used_bigits_ = product_length;
- exponent_ *= 2;
- Clamp();
-}
-
-
-void Bignum::AssignPowerUInt16(uint16_t base, const int power_exponent) {
- DOUBLE_CONVERSION_ASSERT(base != 0);
- DOUBLE_CONVERSION_ASSERT(power_exponent >= 0);
- if (power_exponent == 0) {
- AssignUInt16(1);
- return;
- }
- Zero();
- int shifts = 0;
- // We expect base to be in range 2-32, and most often to be 10.
- // It does not make much sense to implement different algorithms for counting
- // the bits.
- while ((base & 1) == 0) {
- base >>= 1;
- shifts++;
- }
- int bit_size = 0;
- int tmp_base = base;
- while (tmp_base != 0) {
- tmp_base >>= 1;
- bit_size++;
- }
- const int final_size = bit_size * power_exponent;
- // 1 extra bigit for the shifting, and one for rounded final_size.
- EnsureCapacity(final_size / kBigitSize + 2);
-
- // Left to Right exponentiation.
- int mask = 1;
- while (power_exponent >= mask) mask <<= 1;
-
- // The mask is now pointing to the bit above the most significant 1-bit of
- // power_exponent.
- // Get rid of first 1-bit;
- mask >>= 2;
- uint64_t this_value = base;
-
- bool delayed_multiplication = false;
- const uint64_t max_32bits = 0xFFFFFFFF;
- while (mask != 0 && this_value <= max_32bits) {
- this_value = this_value * this_value;
- // Verify that there is enough space in this_value to perform the
- // multiplication. The first bit_size bits must be 0.
- if ((power_exponent & mask) != 0) {
- DOUBLE_CONVERSION_ASSERT(bit_size > 0);
- const uint64_t base_bits_mask =
- ~((static_cast<uint64_t>(1) << (64 - bit_size)) - 1);
- const bool high_bits_zero = (this_value & base_bits_mask) == 0;
- if (high_bits_zero) {
- this_value *= base;
- } else {
- delayed_multiplication = true;
- }
- }
- mask >>= 1;
- }
- AssignUInt64(this_value);
- if (delayed_multiplication) {
- MultiplyByUInt32(base);
- }
-
- // Now do the same thing as a bignum.
- while (mask != 0) {
- Square();
- if ((power_exponent & mask) != 0) {
- MultiplyByUInt32(base);
- }
- mask >>= 1;
- }
-
- // And finally add the saved shifts.
- ShiftLeft(shifts * power_exponent);
-}
-
-
-// Precondition: this/other < 16bit.
-uint16_t Bignum::DivideModuloIntBignum(const Bignum& other) {
- DOUBLE_CONVERSION_ASSERT(IsClamped());
- DOUBLE_CONVERSION_ASSERT(other.IsClamped());
- DOUBLE_CONVERSION_ASSERT(other.used_bigits_ > 0);
-
- // Easy case: if we have less digits than the divisor than the result is 0.
- // Note: this handles the case where this == 0, too.
- if (BigitLength() < other.BigitLength()) {
- return 0;
- }
-
- Align(other);
-
- uint16_t result = 0;
-
- // Start by removing multiples of 'other' until both numbers have the same
- // number of digits.
- while (BigitLength() > other.BigitLength()) {
- // This naive approach is extremely inefficient if `this` divided by other
- // is big. This function is implemented for doubleToString where
- // the result should be small (less than 10).
- DOUBLE_CONVERSION_ASSERT(other.RawBigit(other.used_bigits_ - 1) >= ((1 << kBigitSize) / 16));
- DOUBLE_CONVERSION_ASSERT(RawBigit(used_bigits_ - 1) < 0x10000);
- // Remove the multiples of the first digit.
- // Example this = 23 and other equals 9. -> Remove 2 multiples.
- result += static_cast<uint16_t>(RawBigit(used_bigits_ - 1));
- SubtractTimes(other, RawBigit(used_bigits_ - 1));
- }
-
- DOUBLE_CONVERSION_ASSERT(BigitLength() == other.BigitLength());
-
- // Both bignums are at the same length now.
- // Since other has more than 0 digits we know that the access to
- // RawBigit(used_bigits_ - 1) is safe.
- const Chunk this_bigit = RawBigit(used_bigits_ - 1);
- const Chunk other_bigit = other.RawBigit(other.used_bigits_ - 1);
-
- if (other.used_bigits_ == 1) {
- // Shortcut for easy (and common) case.
- int quotient = this_bigit / other_bigit;
- RawBigit(used_bigits_ - 1) = this_bigit - other_bigit * quotient;
- DOUBLE_CONVERSION_ASSERT(quotient < 0x10000);
- result += static_cast<uint16_t>(quotient);
- Clamp();
- return result;
- }
-
- const int division_estimate = this_bigit / (other_bigit + 1);
- DOUBLE_CONVERSION_ASSERT(division_estimate < 0x10000);
- result += static_cast<uint16_t>(division_estimate);
- SubtractTimes(other, division_estimate);
-
- if (other_bigit * (division_estimate + 1) > this_bigit) {
- // No need to even try to subtract. Even if other's remaining digits were 0
- // another subtraction would be too much.
- return result;
- }
-
- while (LessEqual(other, *this)) {
- SubtractBignum(other);
- result++;
- }
- return result;
-}
-
-
-template<typename S>
-static int SizeInHexChars(S number) {
- DOUBLE_CONVERSION_ASSERT(number > 0);
- int result = 0;
- while (number != 0) {
- number >>= 4;
- result++;
- }
- return result;
-}
-
-
-static char HexCharOfValue(const int value) {
- DOUBLE_CONVERSION_ASSERT(0 <= value && value <= 16);
- if (value < 10) {
- return static_cast<char>(value + '0');
- }
- return static_cast<char>(value - 10 + 'A');
-}
-
-
-bool Bignum::ToHexString(char* buffer, const int buffer_size) const {
- DOUBLE_CONVERSION_ASSERT(IsClamped());
- // Each bigit must be printable as separate hex-character.
- DOUBLE_CONVERSION_ASSERT(kBigitSize % 4 == 0);
- static const int kHexCharsPerBigit = kBigitSize / 4;
-
- if (used_bigits_ == 0) {
- if (buffer_size < 2) {
- return false;
- }
- buffer[0] = '0';
- buffer[1] = '\0';
- return true;
- }
- // We add 1 for the terminating '\0' character.
- const int needed_chars = (BigitLength() - 1) * kHexCharsPerBigit +
- SizeInHexChars(RawBigit(used_bigits_ - 1)) + 1;
- if (needed_chars > buffer_size) {
- return false;
- }
- int string_index = needed_chars - 1;
- buffer[string_index--] = '\0';
- for (int i = 0; i < exponent_; ++i) {
- for (int j = 0; j < kHexCharsPerBigit; ++j) {
- buffer[string_index--] = '0';
- }
- }
- for (int i = 0; i < used_bigits_ - 1; ++i) {
- Chunk current_bigit = RawBigit(i);
- for (int j = 0; j < kHexCharsPerBigit; ++j) {
- buffer[string_index--] = HexCharOfValue(current_bigit & 0xF);
- current_bigit >>= 4;
- }
- }
- // And finally the last bigit.
- Chunk most_significant_bigit = RawBigit(used_bigits_ - 1);
- while (most_significant_bigit != 0) {
- buffer[string_index--] = HexCharOfValue(most_significant_bigit & 0xF);
- most_significant_bigit >>= 4;
- }
- return true;
-}
-
-
-Bignum::Chunk Bignum::BigitOrZero(const int index) const {
- if (index >= BigitLength()) {
- return 0;
- }
- if (index < exponent_) {
- return 0;
- }
- return RawBigit(index - exponent_);
-}
-
-
-int Bignum::Compare(const Bignum& a, const Bignum& b) {
- DOUBLE_CONVERSION_ASSERT(a.IsClamped());
- DOUBLE_CONVERSION_ASSERT(b.IsClamped());
- const int bigit_length_a = a.BigitLength();
- const int bigit_length_b = b.BigitLength();
- if (bigit_length_a < bigit_length_b) {
- return -1;
- }
- if (bigit_length_a > bigit_length_b) {
- return +1;
- }
- for (int i = bigit_length_a - 1; i >= (std::min)(a.exponent_, b.exponent_); --i) {
- const Chunk bigit_a = a.BigitOrZero(i);
- const Chunk bigit_b = b.BigitOrZero(i);
- if (bigit_a < bigit_b) {
- return -1;
- }
- if (bigit_a > bigit_b) {
- return +1;
- }
- // Otherwise they are equal up to this digit. Try the next digit.
- }
- return 0;
-}
-
-
-int Bignum::PlusCompare(const Bignum& a, const Bignum& b, const Bignum& c) {
- DOUBLE_CONVERSION_ASSERT(a.IsClamped());
- DOUBLE_CONVERSION_ASSERT(b.IsClamped());
- DOUBLE_CONVERSION_ASSERT(c.IsClamped());
- if (a.BigitLength() < b.BigitLength()) {
- return PlusCompare(b, a, c);
- }
- if (a.BigitLength() + 1 < c.BigitLength()) {
- return -1;
- }
- if (a.BigitLength() > c.BigitLength()) {
- return +1;
- }
- // The exponent encodes 0-bigits. So if there are more 0-digits in 'a' than
- // 'b' has digits, then the bigit-length of 'a'+'b' must be equal to the one
- // of 'a'.
- if (a.exponent_ >= b.BigitLength() && a.BigitLength() < c.BigitLength()) {
- return -1;
- }
-
- Chunk borrow = 0;
- // Starting at min_exponent all digits are == 0. So no need to compare them.
- const int min_exponent = (std::min)((std::min)(a.exponent_, b.exponent_), c.exponent_);
- for (int i = c.BigitLength() - 1; i >= min_exponent; --i) {
- const Chunk chunk_a = a.BigitOrZero(i);
- const Chunk chunk_b = b.BigitOrZero(i);
- const Chunk chunk_c = c.BigitOrZero(i);
- const Chunk sum = chunk_a + chunk_b;
- if (sum > chunk_c + borrow) {
- return +1;
- } else {
- borrow = chunk_c + borrow - sum;
- if (borrow > 1) {
- return -1;
- }
- borrow <<= kBigitSize;
- }
- }
- if (borrow == 0) {
- return 0;
- }
- return -1;
-}
-
-
-void Bignum::Clamp() {
- while (used_bigits_ > 0 && RawBigit(used_bigits_ - 1) == 0) {
- used_bigits_--;
- }
- if (used_bigits_ == 0) {
- // Zero.
- exponent_ = 0;
- }
-}
-
-
-void Bignum::Align(const Bignum& other) {
- if (exponent_ > other.exponent_) {
- // If "X" represents a "hidden" bigit (by the exponent) then we are in the
- // following case (a == this, b == other):
- // a: aaaaaaXXXX or a: aaaaaXXX
- // b: bbbbbbX b: bbbbbbbbXX
- // We replace some of the hidden digits (X) of a with 0 digits.
- // a: aaaaaa000X or a: aaaaa0XX
- const int zero_bigits = exponent_ - other.exponent_;
- EnsureCapacity(used_bigits_ + zero_bigits);
- for (int i = used_bigits_ - 1; i >= 0; --i) {
- RawBigit(i + zero_bigits) = RawBigit(i);
- }
- for (int i = 0; i < zero_bigits; ++i) {
- RawBigit(i) = 0;
- }
- used_bigits_ += zero_bigits;
- exponent_ -= zero_bigits;
-
- DOUBLE_CONVERSION_ASSERT(used_bigits_ >= 0);
- DOUBLE_CONVERSION_ASSERT(exponent_ >= 0);
- }
-}
-
-
-void Bignum::BigitsShiftLeft(const int shift_amount) {
- DOUBLE_CONVERSION_ASSERT(shift_amount < kBigitSize);
- DOUBLE_CONVERSION_ASSERT(shift_amount >= 0);
- Chunk carry = 0;
- for (int i = 0; i < used_bigits_; ++i) {
- const Chunk new_carry = RawBigit(i) >> (kBigitSize - shift_amount);
- RawBigit(i) = ((RawBigit(i) << shift_amount) + carry) & kBigitMask;
- carry = new_carry;
- }
- if (carry != 0) {
- RawBigit(used_bigits_) = carry;
- used_bigits_++;
- }
-}
-
-
-void Bignum::SubtractTimes(const Bignum& other, const int factor) {
- DOUBLE_CONVERSION_ASSERT(exponent_ <= other.exponent_);
- if (factor < 3) {
- for (int i = 0; i < factor; ++i) {
- SubtractBignum(other);
- }
- return;
- }
- Chunk borrow = 0;
- const int exponent_diff = other.exponent_ - exponent_;
- for (int i = 0; i < other.used_bigits_; ++i) {
- const DoubleChunk product = static_cast<DoubleChunk>(factor) * other.RawBigit(i);
- const DoubleChunk remove = borrow + product;
- const Chunk difference = RawBigit(i + exponent_diff) - (remove & kBigitMask);
- RawBigit(i + exponent_diff) = difference & kBigitMask;
- borrow = static_cast<Chunk>((difference >> (kChunkSize - 1)) +
- (remove >> kBigitSize));
- }
- for (int i = other.used_bigits_ + exponent_diff; i < used_bigits_; ++i) {
- if (borrow == 0) {
- return;
- }
- const Chunk difference = RawBigit(i) - borrow;
- RawBigit(i) = difference & kBigitMask;
- borrow = difference >> (kChunkSize - 1);
- }
- Clamp();
-}
-
-
-} // namespace double_conversion
-
-// ICU PATCH: Close ICU namespace
-U_NAMESPACE_END
-#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+//
+// From the double-conversion library. Original license:
+//
+// Copyright 2010 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.
+
+// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+#include <algorithm>
+#include <cstring>
+
+// ICU PATCH: Customize header file paths for ICU.
+
+#include "double-conversion-bignum.h"
+#include "double-conversion-utils.h"
+
+// ICU PATCH: Wrap in ICU namespace
+U_NAMESPACE_BEGIN
+
+namespace double_conversion {
+
+Bignum::Chunk& Bignum::RawBigit(const int index) {
+ DOUBLE_CONVERSION_ASSERT(static_cast<unsigned>(index) < kBigitCapacity);
+ return bigits_buffer_[index];
+}
+
+
+const Bignum::Chunk& Bignum::RawBigit(const int index) const {
+ DOUBLE_CONVERSION_ASSERT(static_cast<unsigned>(index) < kBigitCapacity);
+ return bigits_buffer_[index];
+}
+
+
+template<typename S>
+static int BitSize(const S value) {
+ (void) value; // Mark variable as used.
+ return 8 * sizeof(value);
+}
+
+// Guaranteed to lie in one Bigit.
+void Bignum::AssignUInt16(const uint16_t value) {
+ DOUBLE_CONVERSION_ASSERT(kBigitSize >= BitSize(value));
+ Zero();
+ if (value > 0) {
+ RawBigit(0) = value;
+ used_bigits_ = 1;
+ }
+}
+
+
+void Bignum::AssignUInt64(uint64_t value) {
+ Zero();
+ for(int i = 0; value > 0; ++i) {
+ RawBigit(i) = value & kBigitMask;
+ value >>= kBigitSize;
+ ++used_bigits_;
+ }
+}
+
+
+void Bignum::AssignBignum(const Bignum& other) {
+ exponent_ = other.exponent_;
+ for (int i = 0; i < other.used_bigits_; ++i) {
+ RawBigit(i) = other.RawBigit(i);
+ }
+ used_bigits_ = other.used_bigits_;
+}
+
+
+static uint64_t ReadUInt64(const Vector<const char> buffer,
+ const int from,
+ const int digits_to_read) {
+ uint64_t result = 0;
+ for (int i = from; i < from + digits_to_read; ++i) {
+ const int digit = buffer[i] - '0';
+ DOUBLE_CONVERSION_ASSERT(0 <= digit && digit <= 9);
+ result = result * 10 + digit;
+ }
+ return result;
+}
+
+
+void Bignum::AssignDecimalString(const Vector<const char> value) {
+ // 2^64 = 18446744073709551616 > 10^19
+ static const int kMaxUint64DecimalDigits = 19;
+ Zero();
+ int length = value.length();
+ unsigned pos = 0;
+ // Let's just say that each digit needs 4 bits.
+ while (length >= kMaxUint64DecimalDigits) {
+ const uint64_t digits = ReadUInt64(value, pos, kMaxUint64DecimalDigits);
+ pos += kMaxUint64DecimalDigits;
+ length -= kMaxUint64DecimalDigits;
+ MultiplyByPowerOfTen(kMaxUint64DecimalDigits);
+ AddUInt64(digits);
+ }
+ const uint64_t digits = ReadUInt64(value, pos, length);
+ MultiplyByPowerOfTen(length);
+ AddUInt64(digits);
+ Clamp();
+}
+
+
+static uint64_t HexCharValue(const int c) {
+ if ('0' <= c && c <= '9') {
+ return c - '0';
+ }
+ if ('a' <= c && c <= 'f') {
+ return 10 + c - 'a';
+ }
+ DOUBLE_CONVERSION_ASSERT('A' <= c && c <= 'F');
+ return 10 + c - 'A';
+}
+
+
+// Unlike AssignDecimalString(), this function is "only" used
+// for unit-tests and therefore not performance critical.
+void Bignum::AssignHexString(Vector<const char> value) {
+ Zero();
+ // Required capacity could be reduced by ignoring leading zeros.
+ EnsureCapacity(((value.length() * 4) + kBigitSize - 1) / kBigitSize);
+ DOUBLE_CONVERSION_ASSERT(sizeof(uint64_t) * 8 >= kBigitSize + 4); // TODO: static_assert
+ // Accumulates converted hex digits until at least kBigitSize bits.
+ // Works with non-factor-of-four kBigitSizes.
+ uint64_t tmp = 0; // Accumulates converted hex digits until at least
+ for (int cnt = 0; !value.is_empty(); value.pop_back()) {
+ tmp |= (HexCharValue(value.last()) << cnt);
+ if ((cnt += 4) >= kBigitSize) {
+ RawBigit(used_bigits_++) = (tmp & kBigitMask);
+ cnt -= kBigitSize;
+ tmp >>= kBigitSize;
+ }
+ }
+ if (tmp > 0) {
+ RawBigit(used_bigits_++) = tmp;
+ }
+ Clamp();
+}
+
+
+void Bignum::AddUInt64(const uint64_t operand) {
+ if (operand == 0) {
+ return;
+ }
+ Bignum other;
+ other.AssignUInt64(operand);
+ AddBignum(other);
+}
+
+
+void Bignum::AddBignum(const Bignum& other) {
+ DOUBLE_CONVERSION_ASSERT(IsClamped());
+ DOUBLE_CONVERSION_ASSERT(other.IsClamped());
+
+ // If this has a greater exponent than other append zero-bigits to this.
+ // After this call exponent_ <= other.exponent_.
+ Align(other);
+
+ // There are two possibilities:
+ // aaaaaaaaaaa 0000 (where the 0s represent a's exponent)
+ // bbbbb 00000000
+ // ----------------
+ // ccccccccccc 0000
+ // or
+ // aaaaaaaaaa 0000
+ // bbbbbbbbb 0000000
+ // -----------------
+ // cccccccccccc 0000
+ // In both cases we might need a carry bigit.
+
+ EnsureCapacity(1 + (std::max)(BigitLength(), other.BigitLength()) - exponent_);
+ Chunk carry = 0;
+ int bigit_pos = other.exponent_ - exponent_;
+ DOUBLE_CONVERSION_ASSERT(bigit_pos >= 0);
+ for (int i = used_bigits_; i < bigit_pos; ++i) {
+ RawBigit(i) = 0;
+ }
+ for (int i = 0; i < other.used_bigits_; ++i) {
+ const Chunk my = (bigit_pos < used_bigits_) ? RawBigit(bigit_pos) : 0;
+ const Chunk sum = my + other.RawBigit(i) + carry;
+ RawBigit(bigit_pos) = sum & kBigitMask;
+ carry = sum >> kBigitSize;
+ ++bigit_pos;
+ }
+ while (carry != 0) {
+ const Chunk my = (bigit_pos < used_bigits_) ? RawBigit(bigit_pos) : 0;
+ const Chunk sum = my + carry;
+ RawBigit(bigit_pos) = sum & kBigitMask;
+ carry = sum >> kBigitSize;
+ ++bigit_pos;
+ }
+ used_bigits_ = (std::max)(bigit_pos, static_cast<int>(used_bigits_));
+ DOUBLE_CONVERSION_ASSERT(IsClamped());
+}
+
+
+void Bignum::SubtractBignum(const Bignum& other) {
+ DOUBLE_CONVERSION_ASSERT(IsClamped());
+ DOUBLE_CONVERSION_ASSERT(other.IsClamped());
+ // We require this to be bigger than other.
+ DOUBLE_CONVERSION_ASSERT(LessEqual(other, *this));
+
+ Align(other);
+
+ const int offset = other.exponent_ - exponent_;
+ Chunk borrow = 0;
+ int i;
+ for (i = 0; i < other.used_bigits_; ++i) {
+ DOUBLE_CONVERSION_ASSERT((borrow == 0) || (borrow == 1));
+ const Chunk difference = RawBigit(i + offset) - other.RawBigit(i) - borrow;
+ RawBigit(i + offset) = difference & kBigitMask;
+ borrow = difference >> (kChunkSize - 1);
+ }
+ while (borrow != 0) {
+ const Chunk difference = RawBigit(i + offset) - borrow;
+ RawBigit(i + offset) = difference & kBigitMask;
+ borrow = difference >> (kChunkSize - 1);
+ ++i;
+ }
+ Clamp();
+}
+
+
+void Bignum::ShiftLeft(const int shift_amount) {
+ if (used_bigits_ == 0) {
+ return;
+ }
+ exponent_ += (shift_amount / kBigitSize);
+ const int local_shift = shift_amount % kBigitSize;
+ EnsureCapacity(used_bigits_ + 1);
+ BigitsShiftLeft(local_shift);
+}
+
+
+void Bignum::MultiplyByUInt32(const uint32_t factor) {
+ if (factor == 1) {
+ return;
+ }
+ if (factor == 0) {
+ Zero();
+ return;
+ }
+ if (used_bigits_ == 0) {
+ return;
+ }
+ // The product of a bigit with the factor is of size kBigitSize + 32.
+ // Assert that this number + 1 (for the carry) fits into double chunk.
+ DOUBLE_CONVERSION_ASSERT(kDoubleChunkSize >= kBigitSize + 32 + 1);
+ DoubleChunk carry = 0;
+ for (int i = 0; i < used_bigits_; ++i) {
+ const DoubleChunk product = static_cast<DoubleChunk>(factor) * RawBigit(i) + carry;
+ RawBigit(i) = static_cast<Chunk>(product & kBigitMask);
+ carry = (product >> kBigitSize);
+ }
+ while (carry != 0) {
+ EnsureCapacity(used_bigits_ + 1);
+ RawBigit(used_bigits_) = carry & kBigitMask;
+ used_bigits_++;
+ carry >>= kBigitSize;
+ }
+}
+
+
+void Bignum::MultiplyByUInt64(const uint64_t factor) {
+ if (factor == 1) {
+ return;
+ }
+ if (factor == 0) {
+ Zero();
+ return;
+ }
+ if (used_bigits_ == 0) {
+ return;
+ }
+ DOUBLE_CONVERSION_ASSERT(kBigitSize < 32);
+ uint64_t carry = 0;
+ const uint64_t low = factor & 0xFFFFFFFF;
+ const uint64_t high = factor >> 32;
+ for (int i = 0; i < used_bigits_; ++i) {
+ const uint64_t product_low = low * RawBigit(i);
+ const uint64_t product_high = high * RawBigit(i);
+ const uint64_t tmp = (carry & kBigitMask) + product_low;
+ RawBigit(i) = tmp & kBigitMask;
+ carry = (carry >> kBigitSize) + (tmp >> kBigitSize) +
+ (product_high << (32 - kBigitSize));
+ }
+ while (carry != 0) {
+ EnsureCapacity(used_bigits_ + 1);
+ RawBigit(used_bigits_) = carry & kBigitMask;
+ used_bigits_++;
+ carry >>= kBigitSize;
+ }
+}
+
+
+void Bignum::MultiplyByPowerOfTen(const int exponent) {
+ static const uint64_t kFive27 = DOUBLE_CONVERSION_UINT64_2PART_C(0x6765c793, fa10079d);
+ static const uint16_t kFive1 = 5;
+ static const uint16_t kFive2 = kFive1 * 5;
+ static const uint16_t kFive3 = kFive2 * 5;
+ static const uint16_t kFive4 = kFive3 * 5;
+ static const uint16_t kFive5 = kFive4 * 5;
+ static const uint16_t kFive6 = kFive5 * 5;
+ static const uint32_t kFive7 = kFive6 * 5;
+ static const uint32_t kFive8 = kFive7 * 5;
+ static const uint32_t kFive9 = kFive8 * 5;
+ static const uint32_t kFive10 = kFive9 * 5;
+ static const uint32_t kFive11 = kFive10 * 5;
+ static const uint32_t kFive12 = kFive11 * 5;
+ static const uint32_t kFive13 = kFive12 * 5;
+ static const uint32_t kFive1_to_12[] =
+ { kFive1, kFive2, kFive3, kFive4, kFive5, kFive6,
+ kFive7, kFive8, kFive9, kFive10, kFive11, kFive12 };
+
+ DOUBLE_CONVERSION_ASSERT(exponent >= 0);
+
+ if (exponent == 0) {
+ return;
+ }
+ if (used_bigits_ == 0) {
+ return;
+ }
+ // We shift by exponent at the end just before returning.
+ int remaining_exponent = exponent;
+ while (remaining_exponent >= 27) {
+ MultiplyByUInt64(kFive27);
+ remaining_exponent -= 27;
+ }
+ while (remaining_exponent >= 13) {
+ MultiplyByUInt32(kFive13);
+ remaining_exponent -= 13;
+ }
+ if (remaining_exponent > 0) {
+ MultiplyByUInt32(kFive1_to_12[remaining_exponent - 1]);
+ }
+ ShiftLeft(exponent);
+}
+
+
+void Bignum::Square() {
+ DOUBLE_CONVERSION_ASSERT(IsClamped());
+ const int product_length = 2 * used_bigits_;
+ EnsureCapacity(product_length);
+
+ // Comba multiplication: compute each column separately.
+ // Example: r = a2a1a0 * b2b1b0.
+ // r = 1 * a0b0 +
+ // 10 * (a1b0 + a0b1) +
+ // 100 * (a2b0 + a1b1 + a0b2) +
+ // 1000 * (a2b1 + a1b2) +
+ // 10000 * a2b2
+ //
+ // In the worst case we have to accumulate nb-digits products of digit*digit.
+ //
+ // Assert that the additional number of bits in a DoubleChunk are enough to
+ // sum up used_digits of Bigit*Bigit.
+ if ((1 << (2 * (kChunkSize - kBigitSize))) <= used_bigits_) {
+ DOUBLE_CONVERSION_UNIMPLEMENTED();
+ }
+ DoubleChunk accumulator = 0;
+ // First shift the digits so we don't overwrite them.
+ const int copy_offset = used_bigits_;
+ for (int i = 0; i < used_bigits_; ++i) {
+ RawBigit(copy_offset + i) = RawBigit(i);
+ }
+ // We have two loops to avoid some 'if's in the loop.
+ for (int i = 0; i < used_bigits_; ++i) {
+ // Process temporary digit i with power i.
+ // The sum of the two indices must be equal to i.
+ int bigit_index1 = i;
+ int bigit_index2 = 0;
+ // Sum all of the sub-products.
+ while (bigit_index1 >= 0) {
+ const Chunk chunk1 = RawBigit(copy_offset + bigit_index1);
+ const Chunk chunk2 = RawBigit(copy_offset + bigit_index2);
+ accumulator += static_cast<DoubleChunk>(chunk1) * chunk2;
+ bigit_index1--;
+ bigit_index2++;
+ }
+ RawBigit(i) = static_cast<Chunk>(accumulator) & kBigitMask;
+ accumulator >>= kBigitSize;
+ }
+ for (int i = used_bigits_; i < product_length; ++i) {
+ int bigit_index1 = used_bigits_ - 1;
+ int bigit_index2 = i - bigit_index1;
+ // Invariant: sum of both indices is again equal to i.
+ // Inner loop runs 0 times on last iteration, emptying accumulator.
+ while (bigit_index2 < used_bigits_) {
+ const Chunk chunk1 = RawBigit(copy_offset + bigit_index1);
+ const Chunk chunk2 = RawBigit(copy_offset + bigit_index2);
+ accumulator += static_cast<DoubleChunk>(chunk1) * chunk2;
+ bigit_index1--;
+ bigit_index2++;
+ }
+ // The overwritten RawBigit(i) will never be read in further loop iterations,
+ // because bigit_index1 and bigit_index2 are always greater
+ // than i - used_bigits_.
+ RawBigit(i) = static_cast<Chunk>(accumulator) & kBigitMask;
+ accumulator >>= kBigitSize;
+ }
+ // Since the result was guaranteed to lie inside the number the
+ // accumulator must be 0 now.
+ DOUBLE_CONVERSION_ASSERT(accumulator == 0);
+
+ // Don't forget to update the used_digits and the exponent.
+ used_bigits_ = product_length;
+ exponent_ *= 2;
+ Clamp();
+}
+
+
+void Bignum::AssignPowerUInt16(uint16_t base, const int power_exponent) {
+ DOUBLE_CONVERSION_ASSERT(base != 0);
+ DOUBLE_CONVERSION_ASSERT(power_exponent >= 0);
+ if (power_exponent == 0) {
+ AssignUInt16(1);
+ return;
+ }
+ Zero();
+ int shifts = 0;
+ // We expect base to be in range 2-32, and most often to be 10.
+ // It does not make much sense to implement different algorithms for counting
+ // the bits.
+ while ((base & 1) == 0) {
+ base >>= 1;
+ shifts++;
+ }
+ int bit_size = 0;
+ int tmp_base = base;
+ while (tmp_base != 0) {
+ tmp_base >>= 1;
+ bit_size++;
+ }
+ const int final_size = bit_size * power_exponent;
+ // 1 extra bigit for the shifting, and one for rounded final_size.
+ EnsureCapacity(final_size / kBigitSize + 2);
+
+ // Left to Right exponentiation.
+ int mask = 1;
+ while (power_exponent >= mask) mask <<= 1;
+
+ // The mask is now pointing to the bit above the most significant 1-bit of
+ // power_exponent.
+ // Get rid of first 1-bit;
+ mask >>= 2;
+ uint64_t this_value = base;
+
+ bool delayed_multiplication = false;
+ const uint64_t max_32bits = 0xFFFFFFFF;
+ while (mask != 0 && this_value <= max_32bits) {
+ this_value = this_value * this_value;
+ // Verify that there is enough space in this_value to perform the
+ // multiplication. The first bit_size bits must be 0.
+ if ((power_exponent & mask) != 0) {
+ DOUBLE_CONVERSION_ASSERT(bit_size > 0);
+ const uint64_t base_bits_mask =
+ ~((static_cast<uint64_t>(1) << (64 - bit_size)) - 1);
+ const bool high_bits_zero = (this_value & base_bits_mask) == 0;
+ if (high_bits_zero) {
+ this_value *= base;
+ } else {
+ delayed_multiplication = true;
+ }
+ }
+ mask >>= 1;
+ }
+ AssignUInt64(this_value);
+ if (delayed_multiplication) {
+ MultiplyByUInt32(base);
+ }
+
+ // Now do the same thing as a bignum.
+ while (mask != 0) {
+ Square();
+ if ((power_exponent & mask) != 0) {
+ MultiplyByUInt32(base);
+ }
+ mask >>= 1;
+ }
+
+ // And finally add the saved shifts.
+ ShiftLeft(shifts * power_exponent);
+}
+
+
+// Precondition: this/other < 16bit.
+uint16_t Bignum::DivideModuloIntBignum(const Bignum& other) {
+ DOUBLE_CONVERSION_ASSERT(IsClamped());
+ DOUBLE_CONVERSION_ASSERT(other.IsClamped());
+ DOUBLE_CONVERSION_ASSERT(other.used_bigits_ > 0);
+
+ // Easy case: if we have less digits than the divisor than the result is 0.
+ // Note: this handles the case where this == 0, too.
+ if (BigitLength() < other.BigitLength()) {
+ return 0;
+ }
+
+ Align(other);
+
+ uint16_t result = 0;
+
+ // Start by removing multiples of 'other' until both numbers have the same
+ // number of digits.
+ while (BigitLength() > other.BigitLength()) {
+ // This naive approach is extremely inefficient if `this` divided by other
+ // is big. This function is implemented for doubleToString where
+ // the result should be small (less than 10).
+ DOUBLE_CONVERSION_ASSERT(other.RawBigit(other.used_bigits_ - 1) >= ((1 << kBigitSize) / 16));
+ DOUBLE_CONVERSION_ASSERT(RawBigit(used_bigits_ - 1) < 0x10000);
+ // Remove the multiples of the first digit.
+ // Example this = 23 and other equals 9. -> Remove 2 multiples.
+ result += static_cast<uint16_t>(RawBigit(used_bigits_ - 1));
+ SubtractTimes(other, RawBigit(used_bigits_ - 1));
+ }
+
+ DOUBLE_CONVERSION_ASSERT(BigitLength() == other.BigitLength());
+
+ // Both bignums are at the same length now.
+ // Since other has more than 0 digits we know that the access to
+ // RawBigit(used_bigits_ - 1) is safe.
+ const Chunk this_bigit = RawBigit(used_bigits_ - 1);
+ const Chunk other_bigit = other.RawBigit(other.used_bigits_ - 1);
+
+ if (other.used_bigits_ == 1) {
+ // Shortcut for easy (and common) case.
+ int quotient = this_bigit / other_bigit;
+ RawBigit(used_bigits_ - 1) = this_bigit - other_bigit * quotient;
+ DOUBLE_CONVERSION_ASSERT(quotient < 0x10000);
+ result += static_cast<uint16_t>(quotient);
+ Clamp();
+ return result;
+ }
+
+ const int division_estimate = this_bigit / (other_bigit + 1);
+ DOUBLE_CONVERSION_ASSERT(division_estimate < 0x10000);
+ result += static_cast<uint16_t>(division_estimate);
+ SubtractTimes(other, division_estimate);
+
+ if (other_bigit * (division_estimate + 1) > this_bigit) {
+ // No need to even try to subtract. Even if other's remaining digits were 0
+ // another subtraction would be too much.
+ return result;
+ }
+
+ while (LessEqual(other, *this)) {
+ SubtractBignum(other);
+ result++;
+ }
+ return result;
+}
+
+
+template<typename S>
+static int SizeInHexChars(S number) {
+ DOUBLE_CONVERSION_ASSERT(number > 0);
+ int result = 0;
+ while (number != 0) {
+ number >>= 4;
+ result++;
+ }
+ return result;
+}
+
+
+static char HexCharOfValue(const int value) {
+ DOUBLE_CONVERSION_ASSERT(0 <= value && value <= 16);
+ if (value < 10) {
+ return static_cast<char>(value + '0');
+ }
+ return static_cast<char>(value - 10 + 'A');
+}
+
+
+bool Bignum::ToHexString(char* buffer, const int buffer_size) const {
+ DOUBLE_CONVERSION_ASSERT(IsClamped());
+ // Each bigit must be printable as separate hex-character.
+ DOUBLE_CONVERSION_ASSERT(kBigitSize % 4 == 0);
+ static const int kHexCharsPerBigit = kBigitSize / 4;
+
+ if (used_bigits_ == 0) {
+ if (buffer_size < 2) {
+ return false;
+ }
+ buffer[0] = '0';
+ buffer[1] = '\0';
+ return true;
+ }
+ // We add 1 for the terminating '\0' character.
+ const int needed_chars = (BigitLength() - 1) * kHexCharsPerBigit +
+ SizeInHexChars(RawBigit(used_bigits_ - 1)) + 1;
+ if (needed_chars > buffer_size) {
+ return false;
+ }
+ int string_index = needed_chars - 1;
+ buffer[string_index--] = '\0';
+ for (int i = 0; i < exponent_; ++i) {
+ for (int j = 0; j < kHexCharsPerBigit; ++j) {
+ buffer[string_index--] = '0';
+ }
+ }
+ for (int i = 0; i < used_bigits_ - 1; ++i) {
+ Chunk current_bigit = RawBigit(i);
+ for (int j = 0; j < kHexCharsPerBigit; ++j) {
+ buffer[string_index--] = HexCharOfValue(current_bigit & 0xF);
+ current_bigit >>= 4;
+ }
+ }
+ // And finally the last bigit.
+ Chunk most_significant_bigit = RawBigit(used_bigits_ - 1);
+ while (most_significant_bigit != 0) {
+ buffer[string_index--] = HexCharOfValue(most_significant_bigit & 0xF);
+ most_significant_bigit >>= 4;
+ }
+ return true;
+}
+
+
+Bignum::Chunk Bignum::BigitOrZero(const int index) const {
+ if (index >= BigitLength()) {
+ return 0;
+ }
+ if (index < exponent_) {
+ return 0;
+ }
+ return RawBigit(index - exponent_);
+}
+
+
+int Bignum::Compare(const Bignum& a, const Bignum& b) {
+ DOUBLE_CONVERSION_ASSERT(a.IsClamped());
+ DOUBLE_CONVERSION_ASSERT(b.IsClamped());
+ const int bigit_length_a = a.BigitLength();
+ const int bigit_length_b = b.BigitLength();
+ if (bigit_length_a < bigit_length_b) {
+ return -1;
+ }
+ if (bigit_length_a > bigit_length_b) {
+ return +1;
+ }
+ for (int i = bigit_length_a - 1; i >= (std::min)(a.exponent_, b.exponent_); --i) {
+ const Chunk bigit_a = a.BigitOrZero(i);
+ const Chunk bigit_b = b.BigitOrZero(i);
+ if (bigit_a < bigit_b) {
+ return -1;
+ }
+ if (bigit_a > bigit_b) {
+ return +1;
+ }
+ // Otherwise they are equal up to this digit. Try the next digit.
+ }
+ return 0;
+}
+
+
+int Bignum::PlusCompare(const Bignum& a, const Bignum& b, const Bignum& c) {
+ DOUBLE_CONVERSION_ASSERT(a.IsClamped());
+ DOUBLE_CONVERSION_ASSERT(b.IsClamped());
+ DOUBLE_CONVERSION_ASSERT(c.IsClamped());
+ if (a.BigitLength() < b.BigitLength()) {
+ return PlusCompare(b, a, c);
+ }
+ if (a.BigitLength() + 1 < c.BigitLength()) {
+ return -1;
+ }
+ if (a.BigitLength() > c.BigitLength()) {
+ return +1;
+ }
+ // The exponent encodes 0-bigits. So if there are more 0-digits in 'a' than
+ // 'b' has digits, then the bigit-length of 'a'+'b' must be equal to the one
+ // of 'a'.
+ if (a.exponent_ >= b.BigitLength() && a.BigitLength() < c.BigitLength()) {
+ return -1;
+ }
+
+ Chunk borrow = 0;
+ // Starting at min_exponent all digits are == 0. So no need to compare them.
+ const int min_exponent = (std::min)((std::min)(a.exponent_, b.exponent_), c.exponent_);
+ for (int i = c.BigitLength() - 1; i >= min_exponent; --i) {
+ const Chunk chunk_a = a.BigitOrZero(i);
+ const Chunk chunk_b = b.BigitOrZero(i);
+ const Chunk chunk_c = c.BigitOrZero(i);
+ const Chunk sum = chunk_a + chunk_b;
+ if (sum > chunk_c + borrow) {
+ return +1;
+ } else {
+ borrow = chunk_c + borrow - sum;
+ if (borrow > 1) {
+ return -1;
+ }
+ borrow <<= kBigitSize;
+ }
+ }
+ if (borrow == 0) {
+ return 0;
+ }
+ return -1;
+}
+
+
+void Bignum::Clamp() {
+ while (used_bigits_ > 0 && RawBigit(used_bigits_ - 1) == 0) {
+ used_bigits_--;
+ }
+ if (used_bigits_ == 0) {
+ // Zero.
+ exponent_ = 0;
+ }
+}
+
+
+void Bignum::Align(const Bignum& other) {
+ if (exponent_ > other.exponent_) {
+ // If "X" represents a "hidden" bigit (by the exponent) then we are in the
+ // following case (a == this, b == other):
+ // a: aaaaaaXXXX or a: aaaaaXXX
+ // b: bbbbbbX b: bbbbbbbbXX
+ // We replace some of the hidden digits (X) of a with 0 digits.
+ // a: aaaaaa000X or a: aaaaa0XX
+ const int zero_bigits = exponent_ - other.exponent_;
+ EnsureCapacity(used_bigits_ + zero_bigits);
+ for (int i = used_bigits_ - 1; i >= 0; --i) {
+ RawBigit(i + zero_bigits) = RawBigit(i);
+ }
+ for (int i = 0; i < zero_bigits; ++i) {
+ RawBigit(i) = 0;
+ }
+ used_bigits_ += zero_bigits;
+ exponent_ -= zero_bigits;
+
+ DOUBLE_CONVERSION_ASSERT(used_bigits_ >= 0);
+ DOUBLE_CONVERSION_ASSERT(exponent_ >= 0);
+ }
+}
+
+
+void Bignum::BigitsShiftLeft(const int shift_amount) {
+ DOUBLE_CONVERSION_ASSERT(shift_amount < kBigitSize);
+ DOUBLE_CONVERSION_ASSERT(shift_amount >= 0);
+ Chunk carry = 0;
+ for (int i = 0; i < used_bigits_; ++i) {
+ const Chunk new_carry = RawBigit(i) >> (kBigitSize - shift_amount);
+ RawBigit(i) = ((RawBigit(i) << shift_amount) + carry) & kBigitMask;
+ carry = new_carry;
+ }
+ if (carry != 0) {
+ RawBigit(used_bigits_) = carry;
+ used_bigits_++;
+ }
+}
+
+
+void Bignum::SubtractTimes(const Bignum& other, const int factor) {
+ DOUBLE_CONVERSION_ASSERT(exponent_ <= other.exponent_);
+ if (factor < 3) {
+ for (int i = 0; i < factor; ++i) {
+ SubtractBignum(other);
+ }
+ return;
+ }
+ Chunk borrow = 0;
+ const int exponent_diff = other.exponent_ - exponent_;
+ for (int i = 0; i < other.used_bigits_; ++i) {
+ const DoubleChunk product = static_cast<DoubleChunk>(factor) * other.RawBigit(i);
+ const DoubleChunk remove = borrow + product;
+ const Chunk difference = RawBigit(i + exponent_diff) - (remove & kBigitMask);
+ RawBigit(i + exponent_diff) = difference & kBigitMask;
+ borrow = static_cast<Chunk>((difference >> (kChunkSize - 1)) +
+ (remove >> kBigitSize));
+ }
+ for (int i = other.used_bigits_ + exponent_diff; i < used_bigits_; ++i) {
+ if (borrow == 0) {
+ return;
+ }
+ const Chunk difference = RawBigit(i) - borrow;
+ RawBigit(i) = difference & kBigitMask;
+ borrow = difference >> (kChunkSize - 1);
+ }
+ Clamp();
+}
+
+
+} // namespace double_conversion
+
+// ICU PATCH: Close ICU namespace
+U_NAMESPACE_END
+#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/double-conversion-bignum.h b/contrib/libs/icu/i18n/double-conversion-bignum.h
index a8617d26f5..bae900a15a 100644
--- a/contrib/libs/icu/i18n/double-conversion-bignum.h
+++ b/contrib/libs/icu/i18n/double-conversion-bignum.h
@@ -1,170 +1,170 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// From the double-conversion library. Original license:
-//
-// Copyright 2010 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.
-
-// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-#ifndef DOUBLE_CONVERSION_BIGNUM_H_
-#define DOUBLE_CONVERSION_BIGNUM_H_
-
-// ICU PATCH: Customize header file paths for ICU.
-
-#include "double-conversion-utils.h"
-
-// ICU PATCH: Wrap in ICU namespace
-U_NAMESPACE_BEGIN
-
-namespace double_conversion {
-
-class Bignum {
- public:
- // 3584 = 128 * 28. We can represent 2^3584 > 10^1000 accurately.
- // This bignum can encode much bigger numbers, since it contains an
- // exponent.
- static const int kMaxSignificantBits = 3584;
-
- Bignum() : used_bigits_(0), exponent_(0) {}
-
- void AssignUInt16(const uint16_t value);
- void AssignUInt64(uint64_t value);
- void AssignBignum(const Bignum& other);
-
- void AssignDecimalString(const Vector<const char> value);
- void AssignHexString(const Vector<const char> value);
-
- void AssignPowerUInt16(uint16_t base, const int exponent);
-
- void AddUInt64(const uint64_t operand);
- void AddBignum(const Bignum& other);
- // Precondition: this >= other.
- void SubtractBignum(const Bignum& other);
-
- void Square();
- void ShiftLeft(const int shift_amount);
- void MultiplyByUInt32(const uint32_t factor);
- void MultiplyByUInt64(const uint64_t factor);
- void MultiplyByPowerOfTen(const int exponent);
- void Times10() { return MultiplyByUInt32(10); }
- // Pseudocode:
- // int result = this / other;
- // this = this % other;
- // In the worst case this function is in O(this/other).
- uint16_t DivideModuloIntBignum(const Bignum& other);
-
- bool ToHexString(char* buffer, const int buffer_size) const;
-
- // Returns
- // -1 if a < b,
- // 0 if a == b, and
- // +1 if a > b.
- static int Compare(const Bignum& a, const Bignum& b);
- static bool Equal(const Bignum& a, const Bignum& b) {
- return Compare(a, b) == 0;
- }
- static bool LessEqual(const Bignum& a, const Bignum& b) {
- return Compare(a, b) <= 0;
- }
- static bool Less(const Bignum& a, const Bignum& b) {
- return Compare(a, b) < 0;
- }
- // Returns Compare(a + b, c);
- static int PlusCompare(const Bignum& a, const Bignum& b, const Bignum& c);
- // Returns a + b == c
- static bool PlusEqual(const Bignum& a, const Bignum& b, const Bignum& c) {
- return PlusCompare(a, b, c) == 0;
- }
- // Returns a + b <= c
- static bool PlusLessEqual(const Bignum& a, const Bignum& b, const Bignum& c) {
- return PlusCompare(a, b, c) <= 0;
- }
- // Returns a + b < c
- static bool PlusLess(const Bignum& a, const Bignum& b, const Bignum& c) {
- return PlusCompare(a, b, c) < 0;
- }
- private:
- typedef uint32_t Chunk;
- typedef uint64_t DoubleChunk;
-
- static const int kChunkSize = sizeof(Chunk) * 8;
- static const int kDoubleChunkSize = sizeof(DoubleChunk) * 8;
- // With bigit size of 28 we loose some bits, but a double still fits easily
- // into two chunks, and more importantly we can use the Comba multiplication.
- static const int kBigitSize = 28;
- static const Chunk kBigitMask = (1 << kBigitSize) - 1;
- // Every instance allocates kBigitLength chunks on the stack. Bignums cannot
- // grow. There are no checks if the stack-allocated space is sufficient.
- static const int kBigitCapacity = kMaxSignificantBits / kBigitSize;
-
- static void EnsureCapacity(const int size) {
- if (size > kBigitCapacity) {
- DOUBLE_CONVERSION_UNREACHABLE();
- }
- }
- void Align(const Bignum& other);
- void Clamp();
- bool IsClamped() const {
- return used_bigits_ == 0 || RawBigit(used_bigits_ - 1) != 0;
- }
- void Zero() {
- used_bigits_ = 0;
- exponent_ = 0;
- }
- // Requires this to have enough capacity (no tests done).
- // Updates used_bigits_ if necessary.
- // shift_amount must be < kBigitSize.
- void BigitsShiftLeft(const int shift_amount);
- // BigitLength includes the "hidden" bigits encoded in the exponent.
- int BigitLength() const { return used_bigits_ + exponent_; }
- Chunk& RawBigit(const int index);
- const Chunk& RawBigit(const int index) const;
- Chunk BigitOrZero(const int index) const;
- void SubtractTimes(const Bignum& other, const int factor);
-
- // The Bignum's value is value(bigits_buffer_) * 2^(exponent_ * kBigitSize),
- // where the value of the buffer consists of the lower kBigitSize bits of
- // the first used_bigits_ Chunks in bigits_buffer_, first chunk has lowest
- // significant bits.
- int16_t used_bigits_;
- int16_t exponent_;
- Chunk bigits_buffer_[kBigitCapacity];
-
- DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN(Bignum);
-};
-
-} // namespace double_conversion
-
-// ICU PATCH: Close ICU namespace
-U_NAMESPACE_END
-
-#endif // DOUBLE_CONVERSION_BIGNUM_H_
-#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+//
+// From the double-conversion library. Original license:
+//
+// Copyright 2010 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.
+
+// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+#ifndef DOUBLE_CONVERSION_BIGNUM_H_
+#define DOUBLE_CONVERSION_BIGNUM_H_
+
+// ICU PATCH: Customize header file paths for ICU.
+
+#include "double-conversion-utils.h"
+
+// ICU PATCH: Wrap in ICU namespace
+U_NAMESPACE_BEGIN
+
+namespace double_conversion {
+
+class Bignum {
+ public:
+ // 3584 = 128 * 28. We can represent 2^3584 > 10^1000 accurately.
+ // This bignum can encode much bigger numbers, since it contains an
+ // exponent.
+ static const int kMaxSignificantBits = 3584;
+
+ Bignum() : used_bigits_(0), exponent_(0) {}
+
+ void AssignUInt16(const uint16_t value);
+ void AssignUInt64(uint64_t value);
+ void AssignBignum(const Bignum& other);
+
+ void AssignDecimalString(const Vector<const char> value);
+ void AssignHexString(const Vector<const char> value);
+
+ void AssignPowerUInt16(uint16_t base, const int exponent);
+
+ void AddUInt64(const uint64_t operand);
+ void AddBignum(const Bignum& other);
+ // Precondition: this >= other.
+ void SubtractBignum(const Bignum& other);
+
+ void Square();
+ void ShiftLeft(const int shift_amount);
+ void MultiplyByUInt32(const uint32_t factor);
+ void MultiplyByUInt64(const uint64_t factor);
+ void MultiplyByPowerOfTen(const int exponent);
+ void Times10() { return MultiplyByUInt32(10); }
+ // Pseudocode:
+ // int result = this / other;
+ // this = this % other;
+ // In the worst case this function is in O(this/other).
+ uint16_t DivideModuloIntBignum(const Bignum& other);
+
+ bool ToHexString(char* buffer, const int buffer_size) const;
+
+ // Returns
+ // -1 if a < b,
+ // 0 if a == b, and
+ // +1 if a > b.
+ static int Compare(const Bignum& a, const Bignum& b);
+ static bool Equal(const Bignum& a, const Bignum& b) {
+ return Compare(a, b) == 0;
+ }
+ static bool LessEqual(const Bignum& a, const Bignum& b) {
+ return Compare(a, b) <= 0;
+ }
+ static bool Less(const Bignum& a, const Bignum& b) {
+ return Compare(a, b) < 0;
+ }
+ // Returns Compare(a + b, c);
+ static int PlusCompare(const Bignum& a, const Bignum& b, const Bignum& c);
+ // Returns a + b == c
+ static bool PlusEqual(const Bignum& a, const Bignum& b, const Bignum& c) {
+ return PlusCompare(a, b, c) == 0;
+ }
+ // Returns a + b <= c
+ static bool PlusLessEqual(const Bignum& a, const Bignum& b, const Bignum& c) {
+ return PlusCompare(a, b, c) <= 0;
+ }
+ // Returns a + b < c
+ static bool PlusLess(const Bignum& a, const Bignum& b, const Bignum& c) {
+ return PlusCompare(a, b, c) < 0;
+ }
+ private:
+ typedef uint32_t Chunk;
+ typedef uint64_t DoubleChunk;
+
+ static const int kChunkSize = sizeof(Chunk) * 8;
+ static const int kDoubleChunkSize = sizeof(DoubleChunk) * 8;
+ // With bigit size of 28 we loose some bits, but a double still fits easily
+ // into two chunks, and more importantly we can use the Comba multiplication.
+ static const int kBigitSize = 28;
+ static const Chunk kBigitMask = (1 << kBigitSize) - 1;
+ // Every instance allocates kBigitLength chunks on the stack. Bignums cannot
+ // grow. There are no checks if the stack-allocated space is sufficient.
+ static const int kBigitCapacity = kMaxSignificantBits / kBigitSize;
+
+ static void EnsureCapacity(const int size) {
+ if (size > kBigitCapacity) {
+ DOUBLE_CONVERSION_UNREACHABLE();
+ }
+ }
+ void Align(const Bignum& other);
+ void Clamp();
+ bool IsClamped() const {
+ return used_bigits_ == 0 || RawBigit(used_bigits_ - 1) != 0;
+ }
+ void Zero() {
+ used_bigits_ = 0;
+ exponent_ = 0;
+ }
+ // Requires this to have enough capacity (no tests done).
+ // Updates used_bigits_ if necessary.
+ // shift_amount must be < kBigitSize.
+ void BigitsShiftLeft(const int shift_amount);
+ // BigitLength includes the "hidden" bigits encoded in the exponent.
+ int BigitLength() const { return used_bigits_ + exponent_; }
+ Chunk& RawBigit(const int index);
+ const Chunk& RawBigit(const int index) const;
+ Chunk BigitOrZero(const int index) const;
+ void SubtractTimes(const Bignum& other, const int factor);
+
+ // The Bignum's value is value(bigits_buffer_) * 2^(exponent_ * kBigitSize),
+ // where the value of the buffer consists of the lower kBigitSize bits of
+ // the first used_bigits_ Chunks in bigits_buffer_, first chunk has lowest
+ // significant bits.
+ int16_t used_bigits_;
+ int16_t exponent_;
+ Chunk bigits_buffer_[kBigitCapacity];
+
+ DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN(Bignum);
+};
+
+} // namespace double_conversion
+
+// ICU PATCH: Close ICU namespace
+U_NAMESPACE_END
+
+#endif // DOUBLE_CONVERSION_BIGNUM_H_
+#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/double-conversion-cached-powers.cpp b/contrib/libs/icu/i18n/double-conversion-cached-powers.cpp
index e0ec9e6f55..3bc35c8aaf 100644
--- a/contrib/libs/icu/i18n/double-conversion-cached-powers.cpp
+++ b/contrib/libs/icu/i18n/double-conversion-cached-powers.cpp
@@ -1,193 +1,193 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// From the double-conversion library. Original license:
-//
-// Copyright 2006-2008 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.
-
-// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-#include <climits>
-#include <cmath>
-#include <cstdarg>
-
-// ICU PATCH: Customize header file paths for ICU.
-
-#include "double-conversion-utils.h"
-
-#include "double-conversion-cached-powers.h"
-
-// ICU PATCH: Wrap in ICU namespace
-U_NAMESPACE_BEGIN
-
-namespace double_conversion {
-
-namespace PowersOfTenCache {
-
-struct CachedPower {
- uint64_t significand;
- int16_t binary_exponent;
- int16_t decimal_exponent;
-};
-
-static const CachedPower kCachedPowers[] = {
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xfa8fd5a0, 081c0288), -1220, -348},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xbaaee17f, a23ebf76), -1193, -340},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x8b16fb20, 3055ac76), -1166, -332},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xcf42894a, 5dce35ea), -1140, -324},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x9a6bb0aa, 55653b2d), -1113, -316},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xe61acf03, 3d1a45df), -1087, -308},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xab70fe17, c79ac6ca), -1060, -300},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xff77b1fc, bebcdc4f), -1034, -292},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xbe5691ef, 416bd60c), -1007, -284},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x8dd01fad, 907ffc3c), -980, -276},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xd3515c28, 31559a83), -954, -268},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x9d71ac8f, ada6c9b5), -927, -260},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xea9c2277, 23ee8bcb), -901, -252},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xaecc4991, 4078536d), -874, -244},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x823c1279, 5db6ce57), -847, -236},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xc2109436, 4dfb5637), -821, -228},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x9096ea6f, 3848984f), -794, -220},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xd77485cb, 25823ac7), -768, -212},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xa086cfcd, 97bf97f4), -741, -204},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xef340a98, 172aace5), -715, -196},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xb23867fb, 2a35b28e), -688, -188},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x84c8d4df, d2c63f3b), -661, -180},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xc5dd4427, 1ad3cdba), -635, -172},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x936b9fce, bb25c996), -608, -164},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xdbac6c24, 7d62a584), -582, -156},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xa3ab6658, 0d5fdaf6), -555, -148},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xf3e2f893, dec3f126), -529, -140},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xb5b5ada8, aaff80b8), -502, -132},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x87625f05, 6c7c4a8b), -475, -124},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xc9bcff60, 34c13053), -449, -116},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x964e858c, 91ba2655), -422, -108},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xdff97724, 70297ebd), -396, -100},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xa6dfbd9f, b8e5b88f), -369, -92},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xf8a95fcf, 88747d94), -343, -84},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xb9447093, 8fa89bcf), -316, -76},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x8a08f0f8, bf0f156b), -289, -68},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xcdb02555, 653131b6), -263, -60},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x993fe2c6, d07b7fac), -236, -52},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xe45c10c4, 2a2b3b06), -210, -44},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xaa242499, 697392d3), -183, -36},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xfd87b5f2, 8300ca0e), -157, -28},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xbce50864, 92111aeb), -130, -20},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x8cbccc09, 6f5088cc), -103, -12},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xd1b71758, e219652c), -77, -4},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x9c400000, 00000000), -50, 4},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xe8d4a510, 00000000), -24, 12},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xad78ebc5, ac620000), 3, 20},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x813f3978, f8940984), 30, 28},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xc097ce7b, c90715b3), 56, 36},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x8f7e32ce, 7bea5c70), 83, 44},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xd5d238a4, abe98068), 109, 52},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x9f4f2726, 179a2245), 136, 60},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xed63a231, d4c4fb27), 162, 68},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xb0de6538, 8cc8ada8), 189, 76},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x83c7088e, 1aab65db), 216, 84},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xc45d1df9, 42711d9a), 242, 92},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x924d692c, a61be758), 269, 100},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xda01ee64, 1a708dea), 295, 108},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xa26da399, 9aef774a), 322, 116},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xf209787b, b47d6b85), 348, 124},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xb454e4a1, 79dd1877), 375, 132},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x865b8692, 5b9bc5c2), 402, 140},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xc83553c5, c8965d3d), 428, 148},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x952ab45c, fa97a0b3), 455, 156},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xde469fbd, 99a05fe3), 481, 164},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xa59bc234, db398c25), 508, 172},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xf6c69a72, a3989f5c), 534, 180},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xb7dcbf53, 54e9bece), 561, 188},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x88fcf317, f22241e2), 588, 196},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xcc20ce9b, d35c78a5), 614, 204},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x98165af3, 7b2153df), 641, 212},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xe2a0b5dc, 971f303a), 667, 220},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xa8d9d153, 5ce3b396), 694, 228},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xfb9b7cd9, a4a7443c), 720, 236},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xbb764c4c, a7a44410), 747, 244},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x8bab8eef, b6409c1a), 774, 252},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xd01fef10, a657842c), 800, 260},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x9b10a4e5, e9913129), 827, 268},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xe7109bfb, a19c0c9d), 853, 276},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xac2820d9, 623bf429), 880, 284},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x80444b5e, 7aa7cf85), 907, 292},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xbf21e440, 03acdd2d), 933, 300},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x8e679c2f, 5e44ff8f), 960, 308},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xd433179d, 9c8cb841), 986, 316},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0x9e19db92, b4e31ba9), 1013, 324},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xeb96bf6e, badf77d9), 1039, 332},
- {DOUBLE_CONVERSION_UINT64_2PART_C(0xaf87023b, 9bf0ee6b), 1066, 340},
-};
-
-static const int kCachedPowersOffset = 348; // -1 * the first decimal_exponent.
-static const double kD_1_LOG2_10 = 0.30102999566398114; // 1 / lg(10)
-
-void GetCachedPowerForBinaryExponentRange(
- int min_exponent,
- int max_exponent,
- DiyFp* power,
- int* decimal_exponent) {
- int kQ = DiyFp::kSignificandSize;
- double k = ceil((min_exponent + kQ - 1) * kD_1_LOG2_10);
- int foo = kCachedPowersOffset;
- int index =
- (foo + static_cast<int>(k) - 1) / kDecimalExponentDistance + 1;
- DOUBLE_CONVERSION_ASSERT(0 <= index && index < static_cast<int>(DOUBLE_CONVERSION_ARRAY_SIZE(kCachedPowers)));
- CachedPower cached_power = kCachedPowers[index];
- DOUBLE_CONVERSION_ASSERT(min_exponent <= cached_power.binary_exponent);
- (void) max_exponent; // Mark variable as used.
- DOUBLE_CONVERSION_ASSERT(cached_power.binary_exponent <= max_exponent);
- *decimal_exponent = cached_power.decimal_exponent;
- *power = DiyFp(cached_power.significand, cached_power.binary_exponent);
-}
-
-
-void GetCachedPowerForDecimalExponent(int requested_exponent,
- DiyFp* power,
- int* found_exponent) {
- DOUBLE_CONVERSION_ASSERT(kMinDecimalExponent <= requested_exponent);
- DOUBLE_CONVERSION_ASSERT(requested_exponent < kMaxDecimalExponent + kDecimalExponentDistance);
- int index =
- (requested_exponent + kCachedPowersOffset) / kDecimalExponentDistance;
- CachedPower cached_power = kCachedPowers[index];
- *power = DiyFp(cached_power.significand, cached_power.binary_exponent);
- *found_exponent = cached_power.decimal_exponent;
- DOUBLE_CONVERSION_ASSERT(*found_exponent <= requested_exponent);
- DOUBLE_CONVERSION_ASSERT(requested_exponent < *found_exponent + kDecimalExponentDistance);
-}
-
-} // namespace PowersOfTenCache
-
-} // namespace double_conversion
-
-// ICU PATCH: Close ICU namespace
-U_NAMESPACE_END
-#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+//
+// From the double-conversion library. Original license:
+//
+// Copyright 2006-2008 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.
+
+// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+#include <climits>
+#include <cmath>
+#include <cstdarg>
+
+// ICU PATCH: Customize header file paths for ICU.
+
+#include "double-conversion-utils.h"
+
+#include "double-conversion-cached-powers.h"
+
+// ICU PATCH: Wrap in ICU namespace
+U_NAMESPACE_BEGIN
+
+namespace double_conversion {
+
+namespace PowersOfTenCache {
+
+struct CachedPower {
+ uint64_t significand;
+ int16_t binary_exponent;
+ int16_t decimal_exponent;
+};
+
+static const CachedPower kCachedPowers[] = {
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xfa8fd5a0, 081c0288), -1220, -348},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xbaaee17f, a23ebf76), -1193, -340},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x8b16fb20, 3055ac76), -1166, -332},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xcf42894a, 5dce35ea), -1140, -324},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x9a6bb0aa, 55653b2d), -1113, -316},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xe61acf03, 3d1a45df), -1087, -308},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xab70fe17, c79ac6ca), -1060, -300},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xff77b1fc, bebcdc4f), -1034, -292},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xbe5691ef, 416bd60c), -1007, -284},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x8dd01fad, 907ffc3c), -980, -276},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xd3515c28, 31559a83), -954, -268},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x9d71ac8f, ada6c9b5), -927, -260},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xea9c2277, 23ee8bcb), -901, -252},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xaecc4991, 4078536d), -874, -244},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x823c1279, 5db6ce57), -847, -236},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xc2109436, 4dfb5637), -821, -228},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x9096ea6f, 3848984f), -794, -220},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xd77485cb, 25823ac7), -768, -212},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xa086cfcd, 97bf97f4), -741, -204},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xef340a98, 172aace5), -715, -196},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xb23867fb, 2a35b28e), -688, -188},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x84c8d4df, d2c63f3b), -661, -180},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xc5dd4427, 1ad3cdba), -635, -172},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x936b9fce, bb25c996), -608, -164},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xdbac6c24, 7d62a584), -582, -156},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xa3ab6658, 0d5fdaf6), -555, -148},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xf3e2f893, dec3f126), -529, -140},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xb5b5ada8, aaff80b8), -502, -132},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x87625f05, 6c7c4a8b), -475, -124},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xc9bcff60, 34c13053), -449, -116},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x964e858c, 91ba2655), -422, -108},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xdff97724, 70297ebd), -396, -100},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xa6dfbd9f, b8e5b88f), -369, -92},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xf8a95fcf, 88747d94), -343, -84},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xb9447093, 8fa89bcf), -316, -76},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x8a08f0f8, bf0f156b), -289, -68},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xcdb02555, 653131b6), -263, -60},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x993fe2c6, d07b7fac), -236, -52},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xe45c10c4, 2a2b3b06), -210, -44},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xaa242499, 697392d3), -183, -36},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xfd87b5f2, 8300ca0e), -157, -28},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xbce50864, 92111aeb), -130, -20},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x8cbccc09, 6f5088cc), -103, -12},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xd1b71758, e219652c), -77, -4},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x9c400000, 00000000), -50, 4},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xe8d4a510, 00000000), -24, 12},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xad78ebc5, ac620000), 3, 20},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x813f3978, f8940984), 30, 28},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xc097ce7b, c90715b3), 56, 36},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x8f7e32ce, 7bea5c70), 83, 44},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xd5d238a4, abe98068), 109, 52},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x9f4f2726, 179a2245), 136, 60},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xed63a231, d4c4fb27), 162, 68},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xb0de6538, 8cc8ada8), 189, 76},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x83c7088e, 1aab65db), 216, 84},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xc45d1df9, 42711d9a), 242, 92},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x924d692c, a61be758), 269, 100},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xda01ee64, 1a708dea), 295, 108},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xa26da399, 9aef774a), 322, 116},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xf209787b, b47d6b85), 348, 124},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xb454e4a1, 79dd1877), 375, 132},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x865b8692, 5b9bc5c2), 402, 140},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xc83553c5, c8965d3d), 428, 148},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x952ab45c, fa97a0b3), 455, 156},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xde469fbd, 99a05fe3), 481, 164},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xa59bc234, db398c25), 508, 172},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xf6c69a72, a3989f5c), 534, 180},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xb7dcbf53, 54e9bece), 561, 188},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x88fcf317, f22241e2), 588, 196},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xcc20ce9b, d35c78a5), 614, 204},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x98165af3, 7b2153df), 641, 212},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xe2a0b5dc, 971f303a), 667, 220},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xa8d9d153, 5ce3b396), 694, 228},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xfb9b7cd9, a4a7443c), 720, 236},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xbb764c4c, a7a44410), 747, 244},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x8bab8eef, b6409c1a), 774, 252},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xd01fef10, a657842c), 800, 260},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x9b10a4e5, e9913129), 827, 268},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xe7109bfb, a19c0c9d), 853, 276},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xac2820d9, 623bf429), 880, 284},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x80444b5e, 7aa7cf85), 907, 292},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xbf21e440, 03acdd2d), 933, 300},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x8e679c2f, 5e44ff8f), 960, 308},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xd433179d, 9c8cb841), 986, 316},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0x9e19db92, b4e31ba9), 1013, 324},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xeb96bf6e, badf77d9), 1039, 332},
+ {DOUBLE_CONVERSION_UINT64_2PART_C(0xaf87023b, 9bf0ee6b), 1066, 340},
+};
+
+static const int kCachedPowersOffset = 348; // -1 * the first decimal_exponent.
+static const double kD_1_LOG2_10 = 0.30102999566398114; // 1 / lg(10)
+
+void GetCachedPowerForBinaryExponentRange(
+ int min_exponent,
+ int max_exponent,
+ DiyFp* power,
+ int* decimal_exponent) {
+ int kQ = DiyFp::kSignificandSize;
+ double k = ceil((min_exponent + kQ - 1) * kD_1_LOG2_10);
+ int foo = kCachedPowersOffset;
+ int index =
+ (foo + static_cast<int>(k) - 1) / kDecimalExponentDistance + 1;
+ DOUBLE_CONVERSION_ASSERT(0 <= index && index < static_cast<int>(DOUBLE_CONVERSION_ARRAY_SIZE(kCachedPowers)));
+ CachedPower cached_power = kCachedPowers[index];
+ DOUBLE_CONVERSION_ASSERT(min_exponent <= cached_power.binary_exponent);
+ (void) max_exponent; // Mark variable as used.
+ DOUBLE_CONVERSION_ASSERT(cached_power.binary_exponent <= max_exponent);
+ *decimal_exponent = cached_power.decimal_exponent;
+ *power = DiyFp(cached_power.significand, cached_power.binary_exponent);
+}
+
+
+void GetCachedPowerForDecimalExponent(int requested_exponent,
+ DiyFp* power,
+ int* found_exponent) {
+ DOUBLE_CONVERSION_ASSERT(kMinDecimalExponent <= requested_exponent);
+ DOUBLE_CONVERSION_ASSERT(requested_exponent < kMaxDecimalExponent + kDecimalExponentDistance);
+ int index =
+ (requested_exponent + kCachedPowersOffset) / kDecimalExponentDistance;
+ CachedPower cached_power = kCachedPowers[index];
+ *power = DiyFp(cached_power.significand, cached_power.binary_exponent);
+ *found_exponent = cached_power.decimal_exponent;
+ DOUBLE_CONVERSION_ASSERT(*found_exponent <= requested_exponent);
+ DOUBLE_CONVERSION_ASSERT(requested_exponent < *found_exponent + kDecimalExponentDistance);
+}
+
+} // namespace PowersOfTenCache
+
+} // namespace double_conversion
+
+// ICU PATCH: Close ICU namespace
+U_NAMESPACE_END
+#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/double-conversion-cached-powers.h b/contrib/libs/icu/i18n/double-conversion-cached-powers.h
index 57cb3e9869..ade27baef8 100644
--- a/contrib/libs/icu/i18n/double-conversion-cached-powers.h
+++ b/contrib/libs/icu/i18n/double-conversion-cached-powers.h
@@ -1,82 +1,82 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// From the double-conversion library. Original license:
-//
-// Copyright 2010 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.
-
-// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-#ifndef DOUBLE_CONVERSION_CACHED_POWERS_H_
-#define DOUBLE_CONVERSION_CACHED_POWERS_H_
-
-// ICU PATCH: Customize header file paths for ICU.
-
-#include "double-conversion-diy-fp.h"
-
-// ICU PATCH: Wrap in ICU namespace
-U_NAMESPACE_BEGIN
-
-namespace double_conversion {
-
-namespace PowersOfTenCache {
-
- // Not all powers of ten are cached. The decimal exponent of two neighboring
- // cached numbers will differ by kDecimalExponentDistance.
- static const int kDecimalExponentDistance = 8;
-
- static const int kMinDecimalExponent = -348;
- static const int kMaxDecimalExponent = 340;
-
- // Returns a cached power-of-ten with a binary exponent in the range
- // [min_exponent; max_exponent] (boundaries included).
- void GetCachedPowerForBinaryExponentRange(int min_exponent,
- int max_exponent,
- DiyFp* power,
- int* decimal_exponent);
-
- // Returns a cached power of ten x ~= 10^k such that
- // k <= decimal_exponent < k + kCachedPowersDecimalDistance.
- // The given decimal_exponent must satisfy
- // kMinDecimalExponent <= requested_exponent, and
- // requested_exponent < kMaxDecimalExponent + kDecimalExponentDistance.
- void GetCachedPowerForDecimalExponent(int requested_exponent,
- DiyFp* power,
- int* found_exponent);
-
-} // namespace PowersOfTenCache
-
-} // namespace double_conversion
-
-// ICU PATCH: Close ICU namespace
-U_NAMESPACE_END
-
-#endif // DOUBLE_CONVERSION_CACHED_POWERS_H_
-#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+//
+// From the double-conversion library. Original license:
+//
+// Copyright 2010 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.
+
+// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+#ifndef DOUBLE_CONVERSION_CACHED_POWERS_H_
+#define DOUBLE_CONVERSION_CACHED_POWERS_H_
+
+// ICU PATCH: Customize header file paths for ICU.
+
+#include "double-conversion-diy-fp.h"
+
+// ICU PATCH: Wrap in ICU namespace
+U_NAMESPACE_BEGIN
+
+namespace double_conversion {
+
+namespace PowersOfTenCache {
+
+ // Not all powers of ten are cached. The decimal exponent of two neighboring
+ // cached numbers will differ by kDecimalExponentDistance.
+ static const int kDecimalExponentDistance = 8;
+
+ static const int kMinDecimalExponent = -348;
+ static const int kMaxDecimalExponent = 340;
+
+ // Returns a cached power-of-ten with a binary exponent in the range
+ // [min_exponent; max_exponent] (boundaries included).
+ void GetCachedPowerForBinaryExponentRange(int min_exponent,
+ int max_exponent,
+ DiyFp* power,
+ int* decimal_exponent);
+
+ // Returns a cached power of ten x ~= 10^k such that
+ // k <= decimal_exponent < k + kCachedPowersDecimalDistance.
+ // The given decimal_exponent must satisfy
+ // kMinDecimalExponent <= requested_exponent, and
+ // requested_exponent < kMaxDecimalExponent + kDecimalExponentDistance.
+ void GetCachedPowerForDecimalExponent(int requested_exponent,
+ DiyFp* power,
+ int* found_exponent);
+
+} // namespace PowersOfTenCache
+
+} // namespace double_conversion
+
+// ICU PATCH: Close ICU namespace
+U_NAMESPACE_END
+
+#endif // DOUBLE_CONVERSION_CACHED_POWERS_H_
+#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/double-conversion-diy-fp.h b/contrib/libs/icu/i18n/double-conversion-diy-fp.h
index c30b350365..5820abedf3 100644
--- a/contrib/libs/icu/i18n/double-conversion-diy-fp.h
+++ b/contrib/libs/icu/i18n/double-conversion-diy-fp.h
@@ -1,155 +1,155 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// From the double-conversion library. Original license:
-//
-// Copyright 2010 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.
-
-// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-#ifndef DOUBLE_CONVERSION_DIY_FP_H_
-#define DOUBLE_CONVERSION_DIY_FP_H_
-
-// ICU PATCH: Customize header file paths for ICU.
-
-#include "double-conversion-utils.h"
-
-// ICU PATCH: Wrap in ICU namespace
-U_NAMESPACE_BEGIN
-
-namespace double_conversion {
-
-// This "Do It Yourself Floating Point" class implements a floating-point number
-// with a uint64 significand and an int exponent. Normalized DiyFp numbers will
-// have the most significant bit of the significand set.
-// Multiplication and Subtraction do not normalize their results.
-// DiyFp store only non-negative numbers and are not designed to contain special
-// doubles (NaN and Infinity).
-class DiyFp {
- public:
- static const int kSignificandSize = 64;
-
- DiyFp() : f_(0), e_(0) {}
- DiyFp(const uint64_t significand, const int32_t exponent) : f_(significand), e_(exponent) {}
-
- // this -= other.
- // The exponents of both numbers must be the same and the significand of this
- // must be greater or equal than the significand of other.
- // The result will not be normalized.
- void Subtract(const DiyFp& other) {
- DOUBLE_CONVERSION_ASSERT(e_ == other.e_);
- DOUBLE_CONVERSION_ASSERT(f_ >= other.f_);
- f_ -= other.f_;
- }
-
- // Returns a - b.
- // The exponents of both numbers must be the same and a must be greater
- // or equal than b. The result will not be normalized.
- static DiyFp Minus(const DiyFp& a, const DiyFp& b) {
- DiyFp result = a;
- result.Subtract(b);
- return result;
- }
-
- // this *= other.
- void Multiply(const DiyFp& other) {
- // Simply "emulates" a 128 bit multiplication.
- // However: the resulting number only contains 64 bits. The least
- // significant 64 bits are only used for rounding the most significant 64
- // bits.
- const uint64_t kM32 = 0xFFFFFFFFU;
- const uint64_t a = f_ >> 32;
- const uint64_t b = f_ & kM32;
- const uint64_t c = other.f_ >> 32;
- const uint64_t d = other.f_ & kM32;
- const uint64_t ac = a * c;
- const uint64_t bc = b * c;
- const uint64_t ad = a * d;
- const uint64_t bd = b * d;
- // By adding 1U << 31 to tmp we round the final result.
- // Halfway cases will be rounded up.
- const uint64_t tmp = (bd >> 32) + (ad & kM32) + (bc & kM32) + (1U << 31);
- e_ += other.e_ + 64;
- f_ = ac + (ad >> 32) + (bc >> 32) + (tmp >> 32);
- }
-
- // returns a * b;
- static DiyFp Times(const DiyFp& a, const DiyFp& b) {
- DiyFp result = a;
- result.Multiply(b);
- return result;
- }
-
- void Normalize() {
- DOUBLE_CONVERSION_ASSERT(f_ != 0);
- uint64_t significand = f_;
- int32_t exponent = e_;
-
- // This method is mainly called for normalizing boundaries. In general,
- // boundaries need to be shifted by 10 bits, and we optimize for this case.
- const uint64_t k10MSBits = DOUBLE_CONVERSION_UINT64_2PART_C(0xFFC00000, 00000000);
- while ((significand & k10MSBits) == 0) {
- significand <<= 10;
- exponent -= 10;
- }
- while ((significand & kUint64MSB) == 0) {
- significand <<= 1;
- exponent--;
- }
- f_ = significand;
- e_ = exponent;
- }
-
- static DiyFp Normalize(const DiyFp& a) {
- DiyFp result = a;
- result.Normalize();
- return result;
- }
-
- uint64_t f() const { return f_; }
- int32_t e() const { return e_; }
-
- void set_f(uint64_t new_value) { f_ = new_value; }
- void set_e(int32_t new_value) { e_ = new_value; }
-
- private:
- static const uint64_t kUint64MSB = DOUBLE_CONVERSION_UINT64_2PART_C(0x80000000, 00000000);
-
- uint64_t f_;
- int32_t e_;
-};
-
-} // namespace double_conversion
-
-// ICU PATCH: Close ICU namespace
-U_NAMESPACE_END
-
-#endif // DOUBLE_CONVERSION_DIY_FP_H_
-#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+//
+// From the double-conversion library. Original license:
+//
+// Copyright 2010 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.
+
+// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+#ifndef DOUBLE_CONVERSION_DIY_FP_H_
+#define DOUBLE_CONVERSION_DIY_FP_H_
+
+// ICU PATCH: Customize header file paths for ICU.
+
+#include "double-conversion-utils.h"
+
+// ICU PATCH: Wrap in ICU namespace
+U_NAMESPACE_BEGIN
+
+namespace double_conversion {
+
+// This "Do It Yourself Floating Point" class implements a floating-point number
+// with a uint64 significand and an int exponent. Normalized DiyFp numbers will
+// have the most significant bit of the significand set.
+// Multiplication and Subtraction do not normalize their results.
+// DiyFp store only non-negative numbers and are not designed to contain special
+// doubles (NaN and Infinity).
+class DiyFp {
+ public:
+ static const int kSignificandSize = 64;
+
+ DiyFp() : f_(0), e_(0) {}
+ DiyFp(const uint64_t significand, const int32_t exponent) : f_(significand), e_(exponent) {}
+
+ // this -= other.
+ // The exponents of both numbers must be the same and the significand of this
+ // must be greater or equal than the significand of other.
+ // The result will not be normalized.
+ void Subtract(const DiyFp& other) {
+ DOUBLE_CONVERSION_ASSERT(e_ == other.e_);
+ DOUBLE_CONVERSION_ASSERT(f_ >= other.f_);
+ f_ -= other.f_;
+ }
+
+ // Returns a - b.
+ // The exponents of both numbers must be the same and a must be greater
+ // or equal than b. The result will not be normalized.
+ static DiyFp Minus(const DiyFp& a, const DiyFp& b) {
+ DiyFp result = a;
+ result.Subtract(b);
+ return result;
+ }
+
+ // this *= other.
+ void Multiply(const DiyFp& other) {
+ // Simply "emulates" a 128 bit multiplication.
+ // However: the resulting number only contains 64 bits. The least
+ // significant 64 bits are only used for rounding the most significant 64
+ // bits.
+ const uint64_t kM32 = 0xFFFFFFFFU;
+ const uint64_t a = f_ >> 32;
+ const uint64_t b = f_ & kM32;
+ const uint64_t c = other.f_ >> 32;
+ const uint64_t d = other.f_ & kM32;
+ const uint64_t ac = a * c;
+ const uint64_t bc = b * c;
+ const uint64_t ad = a * d;
+ const uint64_t bd = b * d;
+ // By adding 1U << 31 to tmp we round the final result.
+ // Halfway cases will be rounded up.
+ const uint64_t tmp = (bd >> 32) + (ad & kM32) + (bc & kM32) + (1U << 31);
+ e_ += other.e_ + 64;
+ f_ = ac + (ad >> 32) + (bc >> 32) + (tmp >> 32);
+ }
+
+ // returns a * b;
+ static DiyFp Times(const DiyFp& a, const DiyFp& b) {
+ DiyFp result = a;
+ result.Multiply(b);
+ return result;
+ }
+
+ void Normalize() {
+ DOUBLE_CONVERSION_ASSERT(f_ != 0);
+ uint64_t significand = f_;
+ int32_t exponent = e_;
+
+ // This method is mainly called for normalizing boundaries. In general,
+ // boundaries need to be shifted by 10 bits, and we optimize for this case.
+ const uint64_t k10MSBits = DOUBLE_CONVERSION_UINT64_2PART_C(0xFFC00000, 00000000);
+ while ((significand & k10MSBits) == 0) {
+ significand <<= 10;
+ exponent -= 10;
+ }
+ while ((significand & kUint64MSB) == 0) {
+ significand <<= 1;
+ exponent--;
+ }
+ f_ = significand;
+ e_ = exponent;
+ }
+
+ static DiyFp Normalize(const DiyFp& a) {
+ DiyFp result = a;
+ result.Normalize();
+ return result;
+ }
+
+ uint64_t f() const { return f_; }
+ int32_t e() const { return e_; }
+
+ void set_f(uint64_t new_value) { f_ = new_value; }
+ void set_e(int32_t new_value) { e_ = new_value; }
+
+ private:
+ static const uint64_t kUint64MSB = DOUBLE_CONVERSION_UINT64_2PART_C(0x80000000, 00000000);
+
+ uint64_t f_;
+ int32_t e_;
+};
+
+} // namespace double_conversion
+
+// ICU PATCH: Close ICU namespace
+U_NAMESPACE_END
+
+#endif // DOUBLE_CONVERSION_DIY_FP_H_
+#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/double-conversion-double-to-string.cpp b/contrib/libs/icu/i18n/double-conversion-double-to-string.cpp
index 11fa69be04..44c176f4f9 100644
--- a/contrib/libs/icu/i18n/double-conversion-double-to-string.cpp
+++ b/contrib/libs/icu/i18n/double-conversion-double-to-string.cpp
@@ -1,450 +1,450 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// From the double-conversion library. Original license:
-//
-// Copyright 2010 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.
-
-// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-#include <algorithm>
-#include <climits>
-#include <cmath>
-
-// ICU PATCH: Customize header file paths for ICU.
-// The file fixed-dtoa.h is not needed.
-
-#include "double-conversion-double-to-string.h"
-
-#include "double-conversion-bignum-dtoa.h"
-#include "double-conversion-fast-dtoa.h"
-#include "double-conversion-ieee.h"
-#include "double-conversion-utils.h"
-
-// ICU PATCH: Wrap in ICU namespace
-U_NAMESPACE_BEGIN
-
-namespace double_conversion {
-
-#if 0 // not needed for ICU
-const DoubleToStringConverter& DoubleToStringConverter::EcmaScriptConverter() {
- int flags = UNIQUE_ZERO | EMIT_POSITIVE_EXPONENT_SIGN;
- static DoubleToStringConverter converter(flags,
- "Infinity",
- "NaN",
- 'e',
- -6, 21,
- 6, 0);
- return converter;
-}
-
-
-bool DoubleToStringConverter::HandleSpecialValues(
- double value,
- StringBuilder* result_builder) const {
- Double double_inspect(value);
- if (double_inspect.IsInfinite()) {
- if (infinity_symbol_ == NULL) return false;
- if (value < 0) {
- result_builder->AddCharacter('-');
- }
- result_builder->AddString(infinity_symbol_);
- return true;
- }
- if (double_inspect.IsNan()) {
- if (nan_symbol_ == NULL) return false;
- result_builder->AddString(nan_symbol_);
- return true;
- }
- return false;
-}
-
-
-void DoubleToStringConverter::CreateExponentialRepresentation(
- const char* decimal_digits,
- int length,
- int exponent,
- StringBuilder* result_builder) const {
- DOUBLE_CONVERSION_ASSERT(length != 0);
- result_builder->AddCharacter(decimal_digits[0]);
- if (length != 1) {
- result_builder->AddCharacter('.');
- result_builder->AddSubstring(&decimal_digits[1], length-1);
- }
- result_builder->AddCharacter(exponent_character_);
- if (exponent < 0) {
- result_builder->AddCharacter('-');
- exponent = -exponent;
- } else {
- if ((flags_ & EMIT_POSITIVE_EXPONENT_SIGN) != 0) {
- result_builder->AddCharacter('+');
- }
- }
- if (exponent == 0) {
- result_builder->AddCharacter('0');
- return;
- }
- DOUBLE_CONVERSION_ASSERT(exponent < 1e4);
- // Changing this constant requires updating the comment of DoubleToStringConverter constructor
- const int kMaxExponentLength = 5;
- char buffer[kMaxExponentLength + 1];
- buffer[kMaxExponentLength] = '\0';
- int first_char_pos = kMaxExponentLength;
- while (exponent > 0) {
- buffer[--first_char_pos] = '0' + (exponent % 10);
- exponent /= 10;
- }
- // Add prefix '0' to make exponent width >= min(min_exponent_with_, kMaxExponentLength)
- // For example: convert 1e+9 -> 1e+09, if min_exponent_with_ is set to 2
- while(kMaxExponentLength - first_char_pos < std::min(min_exponent_width_, kMaxExponentLength)) {
- buffer[--first_char_pos] = '0';
- }
- result_builder->AddSubstring(&buffer[first_char_pos],
- kMaxExponentLength - first_char_pos);
-}
-
-
-void DoubleToStringConverter::CreateDecimalRepresentation(
- const char* decimal_digits,
- int length,
- int decimal_point,
- int digits_after_point,
- StringBuilder* result_builder) const {
- // Create a representation that is padded with zeros if needed.
- if (decimal_point <= 0) {
- // "0.00000decimal_rep" or "0.000decimal_rep00".
- result_builder->AddCharacter('0');
- if (digits_after_point > 0) {
- result_builder->AddCharacter('.');
- result_builder->AddPadding('0', -decimal_point);
- DOUBLE_CONVERSION_ASSERT(length <= digits_after_point - (-decimal_point));
- result_builder->AddSubstring(decimal_digits, length);
- int remaining_digits = digits_after_point - (-decimal_point) - length;
- result_builder->AddPadding('0', remaining_digits);
- }
- } else if (decimal_point >= length) {
- // "decimal_rep0000.00000" or "decimal_rep.0000".
- result_builder->AddSubstring(decimal_digits, length);
- result_builder->AddPadding('0', decimal_point - length);
- if (digits_after_point > 0) {
- result_builder->AddCharacter('.');
- result_builder->AddPadding('0', digits_after_point);
- }
- } else {
- // "decima.l_rep000".
- DOUBLE_CONVERSION_ASSERT(digits_after_point > 0);
- result_builder->AddSubstring(decimal_digits, decimal_point);
- result_builder->AddCharacter('.');
- DOUBLE_CONVERSION_ASSERT(length - decimal_point <= digits_after_point);
- result_builder->AddSubstring(&decimal_digits[decimal_point],
- length - decimal_point);
- int remaining_digits = digits_after_point - (length - decimal_point);
- result_builder->AddPadding('0', remaining_digits);
- }
- if (digits_after_point == 0) {
- if ((flags_ & EMIT_TRAILING_DECIMAL_POINT) != 0) {
- result_builder->AddCharacter('.');
- }
- if ((flags_ & EMIT_TRAILING_ZERO_AFTER_POINT) != 0) {
- result_builder->AddCharacter('0');
- }
- }
-}
-
-
-bool DoubleToStringConverter::ToShortestIeeeNumber(
- double value,
- StringBuilder* result_builder,
- DoubleToStringConverter::DtoaMode mode) const {
- DOUBLE_CONVERSION_ASSERT(mode == SHORTEST || mode == SHORTEST_SINGLE);
- if (Double(value).IsSpecial()) {
- return HandleSpecialValues(value, result_builder);
- }
-
- int decimal_point;
- bool sign;
- const int kDecimalRepCapacity = kBase10MaximalLength + 1;
- char decimal_rep[kDecimalRepCapacity];
- int decimal_rep_length;
-
- DoubleToAscii(value, mode, 0, decimal_rep, kDecimalRepCapacity,
- &sign, &decimal_rep_length, &decimal_point);
-
- bool unique_zero = (flags_ & UNIQUE_ZERO) != 0;
- if (sign && (value != 0.0 || !unique_zero)) {
- result_builder->AddCharacter('-');
- }
-
- int exponent = decimal_point - 1;
- if ((decimal_in_shortest_low_ <= exponent) &&
- (exponent < decimal_in_shortest_high_)) {
- CreateDecimalRepresentation(decimal_rep, decimal_rep_length,
- decimal_point,
- (std::max)(0, decimal_rep_length - decimal_point),
- result_builder);
- } else {
- CreateExponentialRepresentation(decimal_rep, decimal_rep_length, exponent,
- result_builder);
- }
- return true;
-}
-
-
-bool DoubleToStringConverter::ToFixed(double value,
- int requested_digits,
- StringBuilder* result_builder) const {
- DOUBLE_CONVERSION_ASSERT(kMaxFixedDigitsBeforePoint == 60);
- const double kFirstNonFixed = 1e60;
-
- if (Double(value).IsSpecial()) {
- return HandleSpecialValues(value, result_builder);
- }
-
- if (requested_digits > kMaxFixedDigitsAfterPoint) return false;
- if (value >= kFirstNonFixed || value <= -kFirstNonFixed) return false;
-
- // Find a sufficiently precise decimal representation of n.
- int decimal_point;
- bool sign;
- // Add space for the '\0' byte.
- const int kDecimalRepCapacity =
- kMaxFixedDigitsBeforePoint + kMaxFixedDigitsAfterPoint + 1;
- char decimal_rep[kDecimalRepCapacity];
- int decimal_rep_length;
- DoubleToAscii(value, FIXED, requested_digits,
- decimal_rep, kDecimalRepCapacity,
- &sign, &decimal_rep_length, &decimal_point);
-
- bool unique_zero = ((flags_ & UNIQUE_ZERO) != 0);
- if (sign && (value != 0.0 || !unique_zero)) {
- result_builder->AddCharacter('-');
- }
-
- CreateDecimalRepresentation(decimal_rep, decimal_rep_length, decimal_point,
- requested_digits, result_builder);
- return true;
-}
-
-
-bool DoubleToStringConverter::ToExponential(
- double value,
- int requested_digits,
- StringBuilder* result_builder) const {
- if (Double(value).IsSpecial()) {
- return HandleSpecialValues(value, result_builder);
- }
-
- if (requested_digits < -1) return false;
- if (requested_digits > kMaxExponentialDigits) return false;
-
- int decimal_point;
- bool sign;
- // Add space for digit before the decimal point and the '\0' character.
- const int kDecimalRepCapacity = kMaxExponentialDigits + 2;
- DOUBLE_CONVERSION_ASSERT(kDecimalRepCapacity > kBase10MaximalLength);
- char decimal_rep[kDecimalRepCapacity];
-#ifndef NDEBUG
- // Problem: there is an assert in StringBuilder::AddSubstring() that
- // will pass this buffer to strlen(), and this buffer is not generally
- // null-terminated.
- memset(decimal_rep, 0, sizeof(decimal_rep));
-#endif
- int decimal_rep_length;
-
- if (requested_digits == -1) {
- DoubleToAscii(value, SHORTEST, 0,
- decimal_rep, kDecimalRepCapacity,
- &sign, &decimal_rep_length, &decimal_point);
- } else {
- DoubleToAscii(value, PRECISION, requested_digits + 1,
- decimal_rep, kDecimalRepCapacity,
- &sign, &decimal_rep_length, &decimal_point);
- DOUBLE_CONVERSION_ASSERT(decimal_rep_length <= requested_digits + 1);
-
- for (int i = decimal_rep_length; i < requested_digits + 1; ++i) {
- decimal_rep[i] = '0';
- }
- decimal_rep_length = requested_digits + 1;
- }
-
- bool unique_zero = ((flags_ & UNIQUE_ZERO) != 0);
- if (sign && (value != 0.0 || !unique_zero)) {
- result_builder->AddCharacter('-');
- }
-
- int exponent = decimal_point - 1;
- CreateExponentialRepresentation(decimal_rep,
- decimal_rep_length,
- exponent,
- result_builder);
- return true;
-}
-
-
-bool DoubleToStringConverter::ToPrecision(double value,
- int precision,
- StringBuilder* result_builder) const {
- if (Double(value).IsSpecial()) {
- return HandleSpecialValues(value, result_builder);
- }
-
- if (precision < kMinPrecisionDigits || precision > kMaxPrecisionDigits) {
- return false;
- }
-
- // Find a sufficiently precise decimal representation of n.
- int decimal_point;
- bool sign;
- // Add one for the terminating null character.
- const int kDecimalRepCapacity = kMaxPrecisionDigits + 1;
- char decimal_rep[kDecimalRepCapacity];
- int decimal_rep_length;
-
- DoubleToAscii(value, PRECISION, precision,
- decimal_rep, kDecimalRepCapacity,
- &sign, &decimal_rep_length, &decimal_point);
- DOUBLE_CONVERSION_ASSERT(decimal_rep_length <= precision);
-
- bool unique_zero = ((flags_ & UNIQUE_ZERO) != 0);
- if (sign && (value != 0.0 || !unique_zero)) {
- result_builder->AddCharacter('-');
- }
-
- // The exponent if we print the number as x.xxeyyy. That is with the
- // decimal point after the first digit.
- int exponent = decimal_point - 1;
-
- int extra_zero = ((flags_ & EMIT_TRAILING_ZERO_AFTER_POINT) != 0) ? 1 : 0;
- if ((-decimal_point + 1 > max_leading_padding_zeroes_in_precision_mode_) ||
- (decimal_point - precision + extra_zero >
- max_trailing_padding_zeroes_in_precision_mode_)) {
- // Fill buffer to contain 'precision' digits.
- // Usually the buffer is already at the correct length, but 'DoubleToAscii'
- // is allowed to return less characters.
- for (int i = decimal_rep_length; i < precision; ++i) {
- decimal_rep[i] = '0';
- }
-
- CreateExponentialRepresentation(decimal_rep,
- precision,
- exponent,
- result_builder);
- } else {
- CreateDecimalRepresentation(decimal_rep, decimal_rep_length, decimal_point,
- (std::max)(0, precision - decimal_point),
- result_builder);
- }
- return true;
-}
-#endif // not needed for ICU
-
-
-static BignumDtoaMode DtoaToBignumDtoaMode(
- DoubleToStringConverter::DtoaMode dtoa_mode) {
- switch (dtoa_mode) {
- case DoubleToStringConverter::SHORTEST: return BIGNUM_DTOA_SHORTEST;
- case DoubleToStringConverter::SHORTEST_SINGLE:
- return BIGNUM_DTOA_SHORTEST_SINGLE;
- case DoubleToStringConverter::FIXED: return BIGNUM_DTOA_FIXED;
- case DoubleToStringConverter::PRECISION: return BIGNUM_DTOA_PRECISION;
- default:
- DOUBLE_CONVERSION_UNREACHABLE();
- }
-}
-
-
-void DoubleToStringConverter::DoubleToAscii(double v,
- DtoaMode mode,
- int requested_digits,
- char* buffer,
- int buffer_length,
- bool* sign,
- int* length,
- int* point) {
- Vector<char> vector(buffer, buffer_length);
- DOUBLE_CONVERSION_ASSERT(!Double(v).IsSpecial());
- DOUBLE_CONVERSION_ASSERT(mode == SHORTEST || mode == SHORTEST_SINGLE || requested_digits >= 0);
-
- if (Double(v).Sign() < 0) {
- *sign = true;
- v = -v;
- } else {
- *sign = false;
- }
-
- if (mode == PRECISION && requested_digits == 0) {
- vector[0] = '\0';
- *length = 0;
- return;
- }
-
- if (v == 0) {
- vector[0] = '0';
- vector[1] = '\0';
- *length = 1;
- *point = 1;
- return;
- }
-
- bool fast_worked;
- switch (mode) {
- case SHORTEST:
- fast_worked = FastDtoa(v, FAST_DTOA_SHORTEST, 0, vector, length, point);
- break;
-#if 0 // not needed for ICU
- case SHORTEST_SINGLE:
- fast_worked = FastDtoa(v, FAST_DTOA_SHORTEST_SINGLE, 0,
- vector, length, point);
- break;
- case FIXED:
- fast_worked = FastFixedDtoa(v, requested_digits, vector, length, point);
- break;
- case PRECISION:
- fast_worked = FastDtoa(v, FAST_DTOA_PRECISION, requested_digits,
- vector, length, point);
- break;
-#endif // not needed for ICU
- default:
- fast_worked = false;
- DOUBLE_CONVERSION_UNREACHABLE();
- }
- if (fast_worked) return;
-
- // If the fast dtoa didn't succeed use the slower bignum version.
- BignumDtoaMode bignum_mode = DtoaToBignumDtoaMode(mode);
- BignumDtoa(v, bignum_mode, requested_digits, vector, length, point);
- vector[*length] = '\0';
-}
-
-} // namespace double_conversion
-
-// ICU PATCH: Close ICU namespace
-U_NAMESPACE_END
-#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+//
+// From the double-conversion library. Original license:
+//
+// Copyright 2010 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.
+
+// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+#include <algorithm>
+#include <climits>
+#include <cmath>
+
+// ICU PATCH: Customize header file paths for ICU.
+// The file fixed-dtoa.h is not needed.
+
+#include "double-conversion-double-to-string.h"
+
+#include "double-conversion-bignum-dtoa.h"
+#include "double-conversion-fast-dtoa.h"
+#include "double-conversion-ieee.h"
+#include "double-conversion-utils.h"
+
+// ICU PATCH: Wrap in ICU namespace
+U_NAMESPACE_BEGIN
+
+namespace double_conversion {
+
+#if 0 // not needed for ICU
+const DoubleToStringConverter& DoubleToStringConverter::EcmaScriptConverter() {
+ int flags = UNIQUE_ZERO | EMIT_POSITIVE_EXPONENT_SIGN;
+ static DoubleToStringConverter converter(flags,
+ "Infinity",
+ "NaN",
+ 'e',
+ -6, 21,
+ 6, 0);
+ return converter;
+}
+
+
+bool DoubleToStringConverter::HandleSpecialValues(
+ double value,
+ StringBuilder* result_builder) const {
+ Double double_inspect(value);
+ if (double_inspect.IsInfinite()) {
+ if (infinity_symbol_ == NULL) return false;
+ if (value < 0) {
+ result_builder->AddCharacter('-');
+ }
+ result_builder->AddString(infinity_symbol_);
+ return true;
+ }
+ if (double_inspect.IsNan()) {
+ if (nan_symbol_ == NULL) return false;
+ result_builder->AddString(nan_symbol_);
+ return true;
+ }
+ return false;
+}
+
+
+void DoubleToStringConverter::CreateExponentialRepresentation(
+ const char* decimal_digits,
+ int length,
+ int exponent,
+ StringBuilder* result_builder) const {
+ DOUBLE_CONVERSION_ASSERT(length != 0);
+ result_builder->AddCharacter(decimal_digits[0]);
+ if (length != 1) {
+ result_builder->AddCharacter('.');
+ result_builder->AddSubstring(&decimal_digits[1], length-1);
+ }
+ result_builder->AddCharacter(exponent_character_);
+ if (exponent < 0) {
+ result_builder->AddCharacter('-');
+ exponent = -exponent;
+ } else {
+ if ((flags_ & EMIT_POSITIVE_EXPONENT_SIGN) != 0) {
+ result_builder->AddCharacter('+');
+ }
+ }
+ if (exponent == 0) {
+ result_builder->AddCharacter('0');
+ return;
+ }
+ DOUBLE_CONVERSION_ASSERT(exponent < 1e4);
+ // Changing this constant requires updating the comment of DoubleToStringConverter constructor
+ const int kMaxExponentLength = 5;
+ char buffer[kMaxExponentLength + 1];
+ buffer[kMaxExponentLength] = '\0';
+ int first_char_pos = kMaxExponentLength;
+ while (exponent > 0) {
+ buffer[--first_char_pos] = '0' + (exponent % 10);
+ exponent /= 10;
+ }
+ // Add prefix '0' to make exponent width >= min(min_exponent_with_, kMaxExponentLength)
+ // For example: convert 1e+9 -> 1e+09, if min_exponent_with_ is set to 2
+ while(kMaxExponentLength - first_char_pos < std::min(min_exponent_width_, kMaxExponentLength)) {
+ buffer[--first_char_pos] = '0';
+ }
+ result_builder->AddSubstring(&buffer[first_char_pos],
+ kMaxExponentLength - first_char_pos);
+}
+
+
+void DoubleToStringConverter::CreateDecimalRepresentation(
+ const char* decimal_digits,
+ int length,
+ int decimal_point,
+ int digits_after_point,
+ StringBuilder* result_builder) const {
+ // Create a representation that is padded with zeros if needed.
+ if (decimal_point <= 0) {
+ // "0.00000decimal_rep" or "0.000decimal_rep00".
+ result_builder->AddCharacter('0');
+ if (digits_after_point > 0) {
+ result_builder->AddCharacter('.');
+ result_builder->AddPadding('0', -decimal_point);
+ DOUBLE_CONVERSION_ASSERT(length <= digits_after_point - (-decimal_point));
+ result_builder->AddSubstring(decimal_digits, length);
+ int remaining_digits = digits_after_point - (-decimal_point) - length;
+ result_builder->AddPadding('0', remaining_digits);
+ }
+ } else if (decimal_point >= length) {
+ // "decimal_rep0000.00000" or "decimal_rep.0000".
+ result_builder->AddSubstring(decimal_digits, length);
+ result_builder->AddPadding('0', decimal_point - length);
+ if (digits_after_point > 0) {
+ result_builder->AddCharacter('.');
+ result_builder->AddPadding('0', digits_after_point);
+ }
+ } else {
+ // "decima.l_rep000".
+ DOUBLE_CONVERSION_ASSERT(digits_after_point > 0);
+ result_builder->AddSubstring(decimal_digits, decimal_point);
+ result_builder->AddCharacter('.');
+ DOUBLE_CONVERSION_ASSERT(length - decimal_point <= digits_after_point);
+ result_builder->AddSubstring(&decimal_digits[decimal_point],
+ length - decimal_point);
+ int remaining_digits = digits_after_point - (length - decimal_point);
+ result_builder->AddPadding('0', remaining_digits);
+ }
+ if (digits_after_point == 0) {
+ if ((flags_ & EMIT_TRAILING_DECIMAL_POINT) != 0) {
+ result_builder->AddCharacter('.');
+ }
+ if ((flags_ & EMIT_TRAILING_ZERO_AFTER_POINT) != 0) {
+ result_builder->AddCharacter('0');
+ }
+ }
+}
+
+
+bool DoubleToStringConverter::ToShortestIeeeNumber(
+ double value,
+ StringBuilder* result_builder,
+ DoubleToStringConverter::DtoaMode mode) const {
+ DOUBLE_CONVERSION_ASSERT(mode == SHORTEST || mode == SHORTEST_SINGLE);
+ if (Double(value).IsSpecial()) {
+ return HandleSpecialValues(value, result_builder);
+ }
+
+ int decimal_point;
+ bool sign;
+ const int kDecimalRepCapacity = kBase10MaximalLength + 1;
+ char decimal_rep[kDecimalRepCapacity];
+ int decimal_rep_length;
+
+ DoubleToAscii(value, mode, 0, decimal_rep, kDecimalRepCapacity,
+ &sign, &decimal_rep_length, &decimal_point);
+
+ bool unique_zero = (flags_ & UNIQUE_ZERO) != 0;
+ if (sign && (value != 0.0 || !unique_zero)) {
+ result_builder->AddCharacter('-');
+ }
+
+ int exponent = decimal_point - 1;
+ if ((decimal_in_shortest_low_ <= exponent) &&
+ (exponent < decimal_in_shortest_high_)) {
+ CreateDecimalRepresentation(decimal_rep, decimal_rep_length,
+ decimal_point,
+ (std::max)(0, decimal_rep_length - decimal_point),
+ result_builder);
+ } else {
+ CreateExponentialRepresentation(decimal_rep, decimal_rep_length, exponent,
+ result_builder);
+ }
+ return true;
+}
+
+
+bool DoubleToStringConverter::ToFixed(double value,
+ int requested_digits,
+ StringBuilder* result_builder) const {
+ DOUBLE_CONVERSION_ASSERT(kMaxFixedDigitsBeforePoint == 60);
+ const double kFirstNonFixed = 1e60;
+
+ if (Double(value).IsSpecial()) {
+ return HandleSpecialValues(value, result_builder);
+ }
+
+ if (requested_digits > kMaxFixedDigitsAfterPoint) return false;
+ if (value >= kFirstNonFixed || value <= -kFirstNonFixed) return false;
+
+ // Find a sufficiently precise decimal representation of n.
+ int decimal_point;
+ bool sign;
+ // Add space for the '\0' byte.
+ const int kDecimalRepCapacity =
+ kMaxFixedDigitsBeforePoint + kMaxFixedDigitsAfterPoint + 1;
+ char decimal_rep[kDecimalRepCapacity];
+ int decimal_rep_length;
+ DoubleToAscii(value, FIXED, requested_digits,
+ decimal_rep, kDecimalRepCapacity,
+ &sign, &decimal_rep_length, &decimal_point);
+
+ bool unique_zero = ((flags_ & UNIQUE_ZERO) != 0);
+ if (sign && (value != 0.0 || !unique_zero)) {
+ result_builder->AddCharacter('-');
+ }
+
+ CreateDecimalRepresentation(decimal_rep, decimal_rep_length, decimal_point,
+ requested_digits, result_builder);
+ return true;
+}
+
+
+bool DoubleToStringConverter::ToExponential(
+ double value,
+ int requested_digits,
+ StringBuilder* result_builder) const {
+ if (Double(value).IsSpecial()) {
+ return HandleSpecialValues(value, result_builder);
+ }
+
+ if (requested_digits < -1) return false;
+ if (requested_digits > kMaxExponentialDigits) return false;
+
+ int decimal_point;
+ bool sign;
+ // Add space for digit before the decimal point and the '\0' character.
+ const int kDecimalRepCapacity = kMaxExponentialDigits + 2;
+ DOUBLE_CONVERSION_ASSERT(kDecimalRepCapacity > kBase10MaximalLength);
+ char decimal_rep[kDecimalRepCapacity];
+#ifndef NDEBUG
+ // Problem: there is an assert in StringBuilder::AddSubstring() that
+ // will pass this buffer to strlen(), and this buffer is not generally
+ // null-terminated.
+ memset(decimal_rep, 0, sizeof(decimal_rep));
+#endif
+ int decimal_rep_length;
+
+ if (requested_digits == -1) {
+ DoubleToAscii(value, SHORTEST, 0,
+ decimal_rep, kDecimalRepCapacity,
+ &sign, &decimal_rep_length, &decimal_point);
+ } else {
+ DoubleToAscii(value, PRECISION, requested_digits + 1,
+ decimal_rep, kDecimalRepCapacity,
+ &sign, &decimal_rep_length, &decimal_point);
+ DOUBLE_CONVERSION_ASSERT(decimal_rep_length <= requested_digits + 1);
+
+ for (int i = decimal_rep_length; i < requested_digits + 1; ++i) {
+ decimal_rep[i] = '0';
+ }
+ decimal_rep_length = requested_digits + 1;
+ }
+
+ bool unique_zero = ((flags_ & UNIQUE_ZERO) != 0);
+ if (sign && (value != 0.0 || !unique_zero)) {
+ result_builder->AddCharacter('-');
+ }
+
+ int exponent = decimal_point - 1;
+ CreateExponentialRepresentation(decimal_rep,
+ decimal_rep_length,
+ exponent,
+ result_builder);
+ return true;
+}
+
+
+bool DoubleToStringConverter::ToPrecision(double value,
+ int precision,
+ StringBuilder* result_builder) const {
+ if (Double(value).IsSpecial()) {
+ return HandleSpecialValues(value, result_builder);
+ }
+
+ if (precision < kMinPrecisionDigits || precision > kMaxPrecisionDigits) {
+ return false;
+ }
+
+ // Find a sufficiently precise decimal representation of n.
+ int decimal_point;
+ bool sign;
+ // Add one for the terminating null character.
+ const int kDecimalRepCapacity = kMaxPrecisionDigits + 1;
+ char decimal_rep[kDecimalRepCapacity];
+ int decimal_rep_length;
+
+ DoubleToAscii(value, PRECISION, precision,
+ decimal_rep, kDecimalRepCapacity,
+ &sign, &decimal_rep_length, &decimal_point);
+ DOUBLE_CONVERSION_ASSERT(decimal_rep_length <= precision);
+
+ bool unique_zero = ((flags_ & UNIQUE_ZERO) != 0);
+ if (sign && (value != 0.0 || !unique_zero)) {
+ result_builder->AddCharacter('-');
+ }
+
+ // The exponent if we print the number as x.xxeyyy. That is with the
+ // decimal point after the first digit.
+ int exponent = decimal_point - 1;
+
+ int extra_zero = ((flags_ & EMIT_TRAILING_ZERO_AFTER_POINT) != 0) ? 1 : 0;
+ if ((-decimal_point + 1 > max_leading_padding_zeroes_in_precision_mode_) ||
+ (decimal_point - precision + extra_zero >
+ max_trailing_padding_zeroes_in_precision_mode_)) {
+ // Fill buffer to contain 'precision' digits.
+ // Usually the buffer is already at the correct length, but 'DoubleToAscii'
+ // is allowed to return less characters.
+ for (int i = decimal_rep_length; i < precision; ++i) {
+ decimal_rep[i] = '0';
+ }
+
+ CreateExponentialRepresentation(decimal_rep,
+ precision,
+ exponent,
+ result_builder);
+ } else {
+ CreateDecimalRepresentation(decimal_rep, decimal_rep_length, decimal_point,
+ (std::max)(0, precision - decimal_point),
+ result_builder);
+ }
+ return true;
+}
+#endif // not needed for ICU
+
+
+static BignumDtoaMode DtoaToBignumDtoaMode(
+ DoubleToStringConverter::DtoaMode dtoa_mode) {
+ switch (dtoa_mode) {
+ case DoubleToStringConverter::SHORTEST: return BIGNUM_DTOA_SHORTEST;
+ case DoubleToStringConverter::SHORTEST_SINGLE:
+ return BIGNUM_DTOA_SHORTEST_SINGLE;
+ case DoubleToStringConverter::FIXED: return BIGNUM_DTOA_FIXED;
+ case DoubleToStringConverter::PRECISION: return BIGNUM_DTOA_PRECISION;
+ default:
+ DOUBLE_CONVERSION_UNREACHABLE();
+ }
+}
+
+
+void DoubleToStringConverter::DoubleToAscii(double v,
+ DtoaMode mode,
+ int requested_digits,
+ char* buffer,
+ int buffer_length,
+ bool* sign,
+ int* length,
+ int* point) {
+ Vector<char> vector(buffer, buffer_length);
+ DOUBLE_CONVERSION_ASSERT(!Double(v).IsSpecial());
+ DOUBLE_CONVERSION_ASSERT(mode == SHORTEST || mode == SHORTEST_SINGLE || requested_digits >= 0);
+
+ if (Double(v).Sign() < 0) {
+ *sign = true;
+ v = -v;
+ } else {
+ *sign = false;
+ }
+
+ if (mode == PRECISION && requested_digits == 0) {
+ vector[0] = '\0';
+ *length = 0;
+ return;
+ }
+
+ if (v == 0) {
+ vector[0] = '0';
+ vector[1] = '\0';
+ *length = 1;
+ *point = 1;
+ return;
+ }
+
+ bool fast_worked;
+ switch (mode) {
+ case SHORTEST:
+ fast_worked = FastDtoa(v, FAST_DTOA_SHORTEST, 0, vector, length, point);
+ break;
+#if 0 // not needed for ICU
+ case SHORTEST_SINGLE:
+ fast_worked = FastDtoa(v, FAST_DTOA_SHORTEST_SINGLE, 0,
+ vector, length, point);
+ break;
+ case FIXED:
+ fast_worked = FastFixedDtoa(v, requested_digits, vector, length, point);
+ break;
+ case PRECISION:
+ fast_worked = FastDtoa(v, FAST_DTOA_PRECISION, requested_digits,
+ vector, length, point);
+ break;
+#endif // not needed for ICU
+ default:
+ fast_worked = false;
+ DOUBLE_CONVERSION_UNREACHABLE();
+ }
+ if (fast_worked) return;
+
+ // If the fast dtoa didn't succeed use the slower bignum version.
+ BignumDtoaMode bignum_mode = DtoaToBignumDtoaMode(mode);
+ BignumDtoa(v, bignum_mode, requested_digits, vector, length, point);
+ vector[*length] = '\0';
+}
+
+} // namespace double_conversion
+
+// ICU PATCH: Close ICU namespace
+U_NAMESPACE_END
+#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/double-conversion-double-to-string.h b/contrib/libs/icu/i18n/double-conversion-double-to-string.h
index 9e45fc7a5e..27bd867848 100644
--- a/contrib/libs/icu/i18n/double-conversion-double-to-string.h
+++ b/contrib/libs/icu/i18n/double-conversion-double-to-string.h
@@ -1,419 +1,419 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// From the double-conversion library. Original license:
-//
-// Copyright 2012 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.
-
-// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-#ifndef DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_
-#define DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_
-
-// ICU PATCH: Customize header file paths for ICU.
-
-#include "double-conversion-utils.h"
-
-// ICU PATCH: Wrap in ICU namespace
-U_NAMESPACE_BEGIN
-
-namespace double_conversion {
-
-class DoubleToStringConverter {
- public:
-#if 0 // not needed for ICU
- // When calling ToFixed with a double > 10^kMaxFixedDigitsBeforePoint
- // or a requested_digits parameter > kMaxFixedDigitsAfterPoint then the
- // function returns false.
- static const int kMaxFixedDigitsBeforePoint = 60;
- static const int kMaxFixedDigitsAfterPoint = 60;
-
- // When calling ToExponential with a requested_digits
- // parameter > kMaxExponentialDigits then the function returns false.
- static const int kMaxExponentialDigits = 120;
-
- // When calling ToPrecision with a requested_digits
- // parameter < kMinPrecisionDigits or requested_digits > kMaxPrecisionDigits
- // then the function returns false.
- static const int kMinPrecisionDigits = 1;
- static const int kMaxPrecisionDigits = 120;
-
- enum Flags {
- NO_FLAGS = 0,
- EMIT_POSITIVE_EXPONENT_SIGN = 1,
- EMIT_TRAILING_DECIMAL_POINT = 2,
- EMIT_TRAILING_ZERO_AFTER_POINT = 4,
- UNIQUE_ZERO = 8
- };
-
- // Flags should be a bit-or combination of the possible Flags-enum.
- // - NO_FLAGS: no special flags.
- // - EMIT_POSITIVE_EXPONENT_SIGN: when the number is converted into exponent
- // form, emits a '+' for positive exponents. Example: 1.2e+2.
- // - EMIT_TRAILING_DECIMAL_POINT: when the input number is an integer and is
- // converted into decimal format then a trailing decimal point is appended.
- // Example: 2345.0 is converted to "2345.".
- // - EMIT_TRAILING_ZERO_AFTER_POINT: in addition to a trailing decimal point
- // emits a trailing '0'-character. This flag requires the
- // EXMIT_TRAILING_DECIMAL_POINT flag.
- // Example: 2345.0 is converted to "2345.0".
- // - UNIQUE_ZERO: "-0.0" is converted to "0.0".
- //
- // Infinity symbol and nan_symbol provide the string representation for these
- // special values. If the string is NULL and the special value is encountered
- // then the conversion functions return false.
- //
- // The exponent_character is used in exponential representations. It is
- // usually 'e' or 'E'.
- //
- // When converting to the shortest representation the converter will
- // represent input numbers in decimal format if they are in the interval
- // [10^decimal_in_shortest_low; 10^decimal_in_shortest_high[
- // (lower boundary included, greater boundary excluded).
- // Example: with decimal_in_shortest_low = -6 and
- // decimal_in_shortest_high = 21:
- // ToShortest(0.000001) -> "0.000001"
- // ToShortest(0.0000001) -> "1e-7"
- // ToShortest(111111111111111111111.0) -> "111111111111111110000"
- // ToShortest(100000000000000000000.0) -> "100000000000000000000"
- // ToShortest(1111111111111111111111.0) -> "1.1111111111111111e+21"
- //
- // When converting to precision mode the converter may add
- // max_leading_padding_zeroes before returning the number in exponential
- // format.
- // Example with max_leading_padding_zeroes_in_precision_mode = 6.
- // ToPrecision(0.0000012345, 2) -> "0.0000012"
- // ToPrecision(0.00000012345, 2) -> "1.2e-7"
- // Similarily the converter may add up to
- // max_trailing_padding_zeroes_in_precision_mode in precision mode to avoid
- // returning an exponential representation. A zero added by the
- // EMIT_TRAILING_ZERO_AFTER_POINT flag is counted for this limit.
- // Examples for max_trailing_padding_zeroes_in_precision_mode = 1:
- // ToPrecision(230.0, 2) -> "230"
- // ToPrecision(230.0, 2) -> "230." with EMIT_TRAILING_DECIMAL_POINT.
- // ToPrecision(230.0, 2) -> "2.3e2" with EMIT_TRAILING_ZERO_AFTER_POINT.
- //
- // The min_exponent_width is used for exponential representations.
- // The converter adds leading '0's to the exponent until the exponent
- // is at least min_exponent_width digits long.
- // The min_exponent_width is clamped to 5.
- // As such, the exponent may never have more than 5 digits in total.
- DoubleToStringConverter(int flags,
- const char* infinity_symbol,
- const char* nan_symbol,
- char exponent_character,
- int decimal_in_shortest_low,
- int decimal_in_shortest_high,
- int max_leading_padding_zeroes_in_precision_mode,
- int max_trailing_padding_zeroes_in_precision_mode,
- int min_exponent_width = 0)
- : flags_(flags),
- infinity_symbol_(infinity_symbol),
- nan_symbol_(nan_symbol),
- exponent_character_(exponent_character),
- decimal_in_shortest_low_(decimal_in_shortest_low),
- decimal_in_shortest_high_(decimal_in_shortest_high),
- max_leading_padding_zeroes_in_precision_mode_(
- max_leading_padding_zeroes_in_precision_mode),
- max_trailing_padding_zeroes_in_precision_mode_(
- max_trailing_padding_zeroes_in_precision_mode),
- min_exponent_width_(min_exponent_width) {
- // When 'trailing zero after the point' is set, then 'trailing point'
- // must be set too.
- DOUBLE_CONVERSION_ASSERT(((flags & EMIT_TRAILING_DECIMAL_POINT) != 0) ||
- !((flags & EMIT_TRAILING_ZERO_AFTER_POINT) != 0));
- }
-
- // Returns a converter following the EcmaScript specification.
- static const DoubleToStringConverter& EcmaScriptConverter();
-
- // Computes the shortest string of digits that correctly represent the input
- // number. Depending on decimal_in_shortest_low and decimal_in_shortest_high
- // (see constructor) it then either returns a decimal representation, or an
- // exponential representation.
- // Example with decimal_in_shortest_low = -6,
- // decimal_in_shortest_high = 21,
- // EMIT_POSITIVE_EXPONENT_SIGN activated, and
- // EMIT_TRAILING_DECIMAL_POINT deactived:
- // ToShortest(0.000001) -> "0.000001"
- // ToShortest(0.0000001) -> "1e-7"
- // ToShortest(111111111111111111111.0) -> "111111111111111110000"
- // ToShortest(100000000000000000000.0) -> "100000000000000000000"
- // ToShortest(1111111111111111111111.0) -> "1.1111111111111111e+21"
- //
- // Note: the conversion may round the output if the returned string
- // is accurate enough to uniquely identify the input-number.
- // For example the most precise representation of the double 9e59 equals
- // "899999999999999918767229449717619953810131273674690656206848", but
- // the converter will return the shorter (but still correct) "9e59".
- //
- // Returns true if the conversion succeeds. The conversion always succeeds
- // except when the input value is special and no infinity_symbol or
- // nan_symbol has been given to the constructor.
- bool ToShortest(double value, StringBuilder* result_builder) const {
- return ToShortestIeeeNumber(value, result_builder, SHORTEST);
- }
-
- // Same as ToShortest, but for single-precision floats.
- bool ToShortestSingle(float value, StringBuilder* result_builder) const {
- return ToShortestIeeeNumber(value, result_builder, SHORTEST_SINGLE);
- }
-
-
- // Computes a decimal representation with a fixed number of digits after the
- // decimal point. The last emitted digit is rounded.
- //
- // Examples:
- // ToFixed(3.12, 1) -> "3.1"
- // ToFixed(3.1415, 3) -> "3.142"
- // ToFixed(1234.56789, 4) -> "1234.5679"
- // ToFixed(1.23, 5) -> "1.23000"
- // ToFixed(0.1, 4) -> "0.1000"
- // ToFixed(1e30, 2) -> "1000000000000000019884624838656.00"
- // ToFixed(0.1, 30) -> "0.100000000000000005551115123126"
- // ToFixed(0.1, 17) -> "0.10000000000000001"
- //
- // If requested_digits equals 0, then the tail of the result depends on
- // the EMIT_TRAILING_DECIMAL_POINT and EMIT_TRAILING_ZERO_AFTER_POINT.
- // Examples, for requested_digits == 0,
- // let EMIT_TRAILING_DECIMAL_POINT and EMIT_TRAILING_ZERO_AFTER_POINT be
- // - false and false: then 123.45 -> 123
- // 0.678 -> 1
- // - true and false: then 123.45 -> 123.
- // 0.678 -> 1.
- // - true and true: then 123.45 -> 123.0
- // 0.678 -> 1.0
- //
- // Returns true if the conversion succeeds. The conversion always succeeds
- // except for the following cases:
- // - the input value is special and no infinity_symbol or nan_symbol has
- // been provided to the constructor,
- // - 'value' > 10^kMaxFixedDigitsBeforePoint, or
- // - 'requested_digits' > kMaxFixedDigitsAfterPoint.
- // The last two conditions imply that the result will never contain more than
- // 1 + kMaxFixedDigitsBeforePoint + 1 + kMaxFixedDigitsAfterPoint characters
- // (one additional character for the sign, and one for the decimal point).
- bool ToFixed(double value,
- int requested_digits,
- StringBuilder* result_builder) const;
-
- // Computes a representation in exponential format with requested_digits
- // after the decimal point. The last emitted digit is rounded.
- // If requested_digits equals -1, then the shortest exponential representation
- // is computed.
- //
- // Examples with EMIT_POSITIVE_EXPONENT_SIGN deactivated, and
- // exponent_character set to 'e'.
- // ToExponential(3.12, 1) -> "3.1e0"
- // ToExponential(5.0, 3) -> "5.000e0"
- // ToExponential(0.001, 2) -> "1.00e-3"
- // ToExponential(3.1415, -1) -> "3.1415e0"
- // ToExponential(3.1415, 4) -> "3.1415e0"
- // ToExponential(3.1415, 3) -> "3.142e0"
- // ToExponential(123456789000000, 3) -> "1.235e14"
- // ToExponential(1000000000000000019884624838656.0, -1) -> "1e30"
- // ToExponential(1000000000000000019884624838656.0, 32) ->
- // "1.00000000000000001988462483865600e30"
- // ToExponential(1234, 0) -> "1e3"
- //
- // Returns true if the conversion succeeds. The conversion always succeeds
- // except for the following cases:
- // - the input value is special and no infinity_symbol or nan_symbol has
- // been provided to the constructor,
- // - 'requested_digits' > kMaxExponentialDigits.
- // The last condition implies that the result will never contain more than
- // kMaxExponentialDigits + 8 characters (the sign, the digit before the
- // decimal point, the decimal point, the exponent character, the
- // exponent's sign, and at most 3 exponent digits).
- bool ToExponential(double value,
- int requested_digits,
- StringBuilder* result_builder) const;
-
- // Computes 'precision' leading digits of the given 'value' and returns them
- // either in exponential or decimal format, depending on
- // max_{leading|trailing}_padding_zeroes_in_precision_mode (given to the
- // constructor).
- // The last computed digit is rounded.
- //
- // Example with max_leading_padding_zeroes_in_precision_mode = 6.
- // ToPrecision(0.0000012345, 2) -> "0.0000012"
- // ToPrecision(0.00000012345, 2) -> "1.2e-7"
- // Similarily the converter may add up to
- // max_trailing_padding_zeroes_in_precision_mode in precision mode to avoid
- // returning an exponential representation. A zero added by the
- // EMIT_TRAILING_ZERO_AFTER_POINT flag is counted for this limit.
- // Examples for max_trailing_padding_zeroes_in_precision_mode = 1:
- // ToPrecision(230.0, 2) -> "230"
- // ToPrecision(230.0, 2) -> "230." with EMIT_TRAILING_DECIMAL_POINT.
- // ToPrecision(230.0, 2) -> "2.3e2" with EMIT_TRAILING_ZERO_AFTER_POINT.
- // Examples for max_trailing_padding_zeroes_in_precision_mode = 3, and no
- // EMIT_TRAILING_ZERO_AFTER_POINT:
- // ToPrecision(123450.0, 6) -> "123450"
- // ToPrecision(123450.0, 5) -> "123450"
- // ToPrecision(123450.0, 4) -> "123500"
- // ToPrecision(123450.0, 3) -> "123000"
- // ToPrecision(123450.0, 2) -> "1.2e5"
- //
- // Returns true if the conversion succeeds. The conversion always succeeds
- // except for the following cases:
- // - the input value is special and no infinity_symbol or nan_symbol has
- // been provided to the constructor,
- // - precision < kMinPericisionDigits
- // - precision > kMaxPrecisionDigits
- // The last condition implies that the result will never contain more than
- // kMaxPrecisionDigits + 7 characters (the sign, the decimal point, the
- // exponent character, the exponent's sign, and at most 3 exponent digits).
- bool ToPrecision(double value,
- int precision,
- StringBuilder* result_builder) const;
-#endif // not needed for ICU
-
- enum DtoaMode {
- // Produce the shortest correct representation.
- // For example the output of 0.299999999999999988897 is (the less accurate
- // but correct) 0.3.
- SHORTEST,
- // Same as SHORTEST, but for single-precision floats.
- SHORTEST_SINGLE,
- // Produce a fixed number of digits after the decimal point.
- // For instance fixed(0.1, 4) becomes 0.1000
- // If the input number is big, the output will be big.
- FIXED,
- // Fixed number of digits (independent of the decimal point).
- PRECISION
- };
-
- // The maximal number of digits that are needed to emit a double in base 10.
- // A higher precision can be achieved by using more digits, but the shortest
- // accurate representation of any double will never use more digits than
- // kBase10MaximalLength.
- // Note that DoubleToAscii null-terminates its input. So the given buffer
- // should be at least kBase10MaximalLength + 1 characters long.
- static const int kBase10MaximalLength = 17;
-
- // Converts the given double 'v' to digit characters. 'v' must not be NaN,
- // +Infinity, or -Infinity. In SHORTEST_SINGLE-mode this restriction also
- // applies to 'v' after it has been casted to a single-precision float. That
- // is, in this mode static_cast<float>(v) must not be NaN, +Infinity or
- // -Infinity.
- //
- // The result should be interpreted as buffer * 10^(point-length).
- //
- // The digits are written to the buffer in the platform's charset, which is
- // often UTF-8 (with ASCII-range digits) but may be another charset, such
- // as EBCDIC.
- //
- // The output depends on the given mode:
- // - SHORTEST: produce the least amount of digits for which the internal
- // identity requirement is still satisfied. If the digits are printed
- // (together with the correct exponent) then reading this number will give
- // 'v' again. The buffer will choose the representation that is closest to
- // 'v'. If there are two at the same distance, than the one farther away
- // from 0 is chosen (halfway cases - ending with 5 - are rounded up).
- // In this mode the 'requested_digits' parameter is ignored.
- // - SHORTEST_SINGLE: same as SHORTEST but with single-precision.
- // - FIXED: produces digits necessary to print a given number with
- // 'requested_digits' digits after the decimal point. The produced digits
- // might be too short in which case the caller has to fill the remainder
- // with '0's.
- // Example: toFixed(0.001, 5) is allowed to return buffer="1", point=-2.
- // Halfway cases are rounded towards +/-Infinity (away from 0). The call
- // toFixed(0.15, 2) thus returns buffer="2", point=0.
- // The returned buffer may contain digits that would be truncated from the
- // shortest representation of the input.
- // - PRECISION: produces 'requested_digits' where the first digit is not '0'.
- // Even though the length of produced digits usually equals
- // 'requested_digits', the function is allowed to return fewer digits, in
- // which case the caller has to fill the missing digits with '0's.
- // Halfway cases are again rounded away from 0.
- // DoubleToAscii expects the given buffer to be big enough to hold all
- // digits and a terminating null-character. In SHORTEST-mode it expects a
- // buffer of at least kBase10MaximalLength + 1. In all other modes the
- // requested_digits parameter and the padding-zeroes limit the size of the
- // output. Don't forget the decimal point, the exponent character and the
- // terminating null-character when computing the maximal output size.
- // The given length is only used in debug mode to ensure the buffer is big
- // enough.
- // ICU PATCH: Export this as U_I18N_API for unit tests.
- static void U_I18N_API DoubleToAscii(double v,
- DtoaMode mode,
- int requested_digits,
- char* buffer,
- int buffer_length,
- bool* sign,
- int* length,
- int* point);
-
-#if 0 // not needed for ICU
- private:
- // Implementation for ToShortest and ToShortestSingle.
- bool ToShortestIeeeNumber(double value,
- StringBuilder* result_builder,
- DtoaMode mode) const;
-
- // If the value is a special value (NaN or Infinity) constructs the
- // corresponding string using the configured infinity/nan-symbol.
- // If either of them is NULL or the value is not special then the
- // function returns false.
- bool HandleSpecialValues(double value, StringBuilder* result_builder) const;
- // Constructs an exponential representation (i.e. 1.234e56).
- // The given exponent assumes a decimal point after the first decimal digit.
- void CreateExponentialRepresentation(const char* decimal_digits,
- int length,
- int exponent,
- StringBuilder* result_builder) const;
- // Creates a decimal representation (i.e 1234.5678).
- void CreateDecimalRepresentation(const char* decimal_digits,
- int length,
- int decimal_point,
- int digits_after_point,
- StringBuilder* result_builder) const;
-
- const int flags_;
- const char* const infinity_symbol_;
- const char* const nan_symbol_;
- const char exponent_character_;
- const int decimal_in_shortest_low_;
- const int decimal_in_shortest_high_;
- const int max_leading_padding_zeroes_in_precision_mode_;
- const int max_trailing_padding_zeroes_in_precision_mode_;
- const int min_exponent_width_;
-#endif // not needed for ICU
-
- DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS(DoubleToStringConverter);
-};
-
-} // namespace double_conversion
-
-// ICU PATCH: Close ICU namespace
-U_NAMESPACE_END
-
-#endif // DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_
-#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+//
+// From the double-conversion library. Original license:
+//
+// Copyright 2012 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.
+
+// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+#ifndef DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_
+#define DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_
+
+// ICU PATCH: Customize header file paths for ICU.
+
+#include "double-conversion-utils.h"
+
+// ICU PATCH: Wrap in ICU namespace
+U_NAMESPACE_BEGIN
+
+namespace double_conversion {
+
+class DoubleToStringConverter {
+ public:
+#if 0 // not needed for ICU
+ // When calling ToFixed with a double > 10^kMaxFixedDigitsBeforePoint
+ // or a requested_digits parameter > kMaxFixedDigitsAfterPoint then the
+ // function returns false.
+ static const int kMaxFixedDigitsBeforePoint = 60;
+ static const int kMaxFixedDigitsAfterPoint = 60;
+
+ // When calling ToExponential with a requested_digits
+ // parameter > kMaxExponentialDigits then the function returns false.
+ static const int kMaxExponentialDigits = 120;
+
+ // When calling ToPrecision with a requested_digits
+ // parameter < kMinPrecisionDigits or requested_digits > kMaxPrecisionDigits
+ // then the function returns false.
+ static const int kMinPrecisionDigits = 1;
+ static const int kMaxPrecisionDigits = 120;
+
+ enum Flags {
+ NO_FLAGS = 0,
+ EMIT_POSITIVE_EXPONENT_SIGN = 1,
+ EMIT_TRAILING_DECIMAL_POINT = 2,
+ EMIT_TRAILING_ZERO_AFTER_POINT = 4,
+ UNIQUE_ZERO = 8
+ };
+
+ // Flags should be a bit-or combination of the possible Flags-enum.
+ // - NO_FLAGS: no special flags.
+ // - EMIT_POSITIVE_EXPONENT_SIGN: when the number is converted into exponent
+ // form, emits a '+' for positive exponents. Example: 1.2e+2.
+ // - EMIT_TRAILING_DECIMAL_POINT: when the input number is an integer and is
+ // converted into decimal format then a trailing decimal point is appended.
+ // Example: 2345.0 is converted to "2345.".
+ // - EMIT_TRAILING_ZERO_AFTER_POINT: in addition to a trailing decimal point
+ // emits a trailing '0'-character. This flag requires the
+ // EXMIT_TRAILING_DECIMAL_POINT flag.
+ // Example: 2345.0 is converted to "2345.0".
+ // - UNIQUE_ZERO: "-0.0" is converted to "0.0".
+ //
+ // Infinity symbol and nan_symbol provide the string representation for these
+ // special values. If the string is NULL and the special value is encountered
+ // then the conversion functions return false.
+ //
+ // The exponent_character is used in exponential representations. It is
+ // usually 'e' or 'E'.
+ //
+ // When converting to the shortest representation the converter will
+ // represent input numbers in decimal format if they are in the interval
+ // [10^decimal_in_shortest_low; 10^decimal_in_shortest_high[
+ // (lower boundary included, greater boundary excluded).
+ // Example: with decimal_in_shortest_low = -6 and
+ // decimal_in_shortest_high = 21:
+ // ToShortest(0.000001) -> "0.000001"
+ // ToShortest(0.0000001) -> "1e-7"
+ // ToShortest(111111111111111111111.0) -> "111111111111111110000"
+ // ToShortest(100000000000000000000.0) -> "100000000000000000000"
+ // ToShortest(1111111111111111111111.0) -> "1.1111111111111111e+21"
+ //
+ // When converting to precision mode the converter may add
+ // max_leading_padding_zeroes before returning the number in exponential
+ // format.
+ // Example with max_leading_padding_zeroes_in_precision_mode = 6.
+ // ToPrecision(0.0000012345, 2) -> "0.0000012"
+ // ToPrecision(0.00000012345, 2) -> "1.2e-7"
+ // Similarily the converter may add up to
+ // max_trailing_padding_zeroes_in_precision_mode in precision mode to avoid
+ // returning an exponential representation. A zero added by the
+ // EMIT_TRAILING_ZERO_AFTER_POINT flag is counted for this limit.
+ // Examples for max_trailing_padding_zeroes_in_precision_mode = 1:
+ // ToPrecision(230.0, 2) -> "230"
+ // ToPrecision(230.0, 2) -> "230." with EMIT_TRAILING_DECIMAL_POINT.
+ // ToPrecision(230.0, 2) -> "2.3e2" with EMIT_TRAILING_ZERO_AFTER_POINT.
+ //
+ // The min_exponent_width is used for exponential representations.
+ // The converter adds leading '0's to the exponent until the exponent
+ // is at least min_exponent_width digits long.
+ // The min_exponent_width is clamped to 5.
+ // As such, the exponent may never have more than 5 digits in total.
+ DoubleToStringConverter(int flags,
+ const char* infinity_symbol,
+ const char* nan_symbol,
+ char exponent_character,
+ int decimal_in_shortest_low,
+ int decimal_in_shortest_high,
+ int max_leading_padding_zeroes_in_precision_mode,
+ int max_trailing_padding_zeroes_in_precision_mode,
+ int min_exponent_width = 0)
+ : flags_(flags),
+ infinity_symbol_(infinity_symbol),
+ nan_symbol_(nan_symbol),
+ exponent_character_(exponent_character),
+ decimal_in_shortest_low_(decimal_in_shortest_low),
+ decimal_in_shortest_high_(decimal_in_shortest_high),
+ max_leading_padding_zeroes_in_precision_mode_(
+ max_leading_padding_zeroes_in_precision_mode),
+ max_trailing_padding_zeroes_in_precision_mode_(
+ max_trailing_padding_zeroes_in_precision_mode),
+ min_exponent_width_(min_exponent_width) {
+ // When 'trailing zero after the point' is set, then 'trailing point'
+ // must be set too.
+ DOUBLE_CONVERSION_ASSERT(((flags & EMIT_TRAILING_DECIMAL_POINT) != 0) ||
+ !((flags & EMIT_TRAILING_ZERO_AFTER_POINT) != 0));
+ }
+
+ // Returns a converter following the EcmaScript specification.
+ static const DoubleToStringConverter& EcmaScriptConverter();
+
+ // Computes the shortest string of digits that correctly represent the input
+ // number. Depending on decimal_in_shortest_low and decimal_in_shortest_high
+ // (see constructor) it then either returns a decimal representation, or an
+ // exponential representation.
+ // Example with decimal_in_shortest_low = -6,
+ // decimal_in_shortest_high = 21,
+ // EMIT_POSITIVE_EXPONENT_SIGN activated, and
+ // EMIT_TRAILING_DECIMAL_POINT deactived:
+ // ToShortest(0.000001) -> "0.000001"
+ // ToShortest(0.0000001) -> "1e-7"
+ // ToShortest(111111111111111111111.0) -> "111111111111111110000"
+ // ToShortest(100000000000000000000.0) -> "100000000000000000000"
+ // ToShortest(1111111111111111111111.0) -> "1.1111111111111111e+21"
+ //
+ // Note: the conversion may round the output if the returned string
+ // is accurate enough to uniquely identify the input-number.
+ // For example the most precise representation of the double 9e59 equals
+ // "899999999999999918767229449717619953810131273674690656206848", but
+ // the converter will return the shorter (but still correct) "9e59".
+ //
+ // Returns true if the conversion succeeds. The conversion always succeeds
+ // except when the input value is special and no infinity_symbol or
+ // nan_symbol has been given to the constructor.
+ bool ToShortest(double value, StringBuilder* result_builder) const {
+ return ToShortestIeeeNumber(value, result_builder, SHORTEST);
+ }
+
+ // Same as ToShortest, but for single-precision floats.
+ bool ToShortestSingle(float value, StringBuilder* result_builder) const {
+ return ToShortestIeeeNumber(value, result_builder, SHORTEST_SINGLE);
+ }
+
+
+ // Computes a decimal representation with a fixed number of digits after the
+ // decimal point. The last emitted digit is rounded.
+ //
+ // Examples:
+ // ToFixed(3.12, 1) -> "3.1"
+ // ToFixed(3.1415, 3) -> "3.142"
+ // ToFixed(1234.56789, 4) -> "1234.5679"
+ // ToFixed(1.23, 5) -> "1.23000"
+ // ToFixed(0.1, 4) -> "0.1000"
+ // ToFixed(1e30, 2) -> "1000000000000000019884624838656.00"
+ // ToFixed(0.1, 30) -> "0.100000000000000005551115123126"
+ // ToFixed(0.1, 17) -> "0.10000000000000001"
+ //
+ // If requested_digits equals 0, then the tail of the result depends on
+ // the EMIT_TRAILING_DECIMAL_POINT and EMIT_TRAILING_ZERO_AFTER_POINT.
+ // Examples, for requested_digits == 0,
+ // let EMIT_TRAILING_DECIMAL_POINT and EMIT_TRAILING_ZERO_AFTER_POINT be
+ // - false and false: then 123.45 -> 123
+ // 0.678 -> 1
+ // - true and false: then 123.45 -> 123.
+ // 0.678 -> 1.
+ // - true and true: then 123.45 -> 123.0
+ // 0.678 -> 1.0
+ //
+ // Returns true if the conversion succeeds. The conversion always succeeds
+ // except for the following cases:
+ // - the input value is special and no infinity_symbol or nan_symbol has
+ // been provided to the constructor,
+ // - 'value' > 10^kMaxFixedDigitsBeforePoint, or
+ // - 'requested_digits' > kMaxFixedDigitsAfterPoint.
+ // The last two conditions imply that the result will never contain more than
+ // 1 + kMaxFixedDigitsBeforePoint + 1 + kMaxFixedDigitsAfterPoint characters
+ // (one additional character for the sign, and one for the decimal point).
+ bool ToFixed(double value,
+ int requested_digits,
+ StringBuilder* result_builder) const;
+
+ // Computes a representation in exponential format with requested_digits
+ // after the decimal point. The last emitted digit is rounded.
+ // If requested_digits equals -1, then the shortest exponential representation
+ // is computed.
+ //
+ // Examples with EMIT_POSITIVE_EXPONENT_SIGN deactivated, and
+ // exponent_character set to 'e'.
+ // ToExponential(3.12, 1) -> "3.1e0"
+ // ToExponential(5.0, 3) -> "5.000e0"
+ // ToExponential(0.001, 2) -> "1.00e-3"
+ // ToExponential(3.1415, -1) -> "3.1415e0"
+ // ToExponential(3.1415, 4) -> "3.1415e0"
+ // ToExponential(3.1415, 3) -> "3.142e0"
+ // ToExponential(123456789000000, 3) -> "1.235e14"
+ // ToExponential(1000000000000000019884624838656.0, -1) -> "1e30"
+ // ToExponential(1000000000000000019884624838656.0, 32) ->
+ // "1.00000000000000001988462483865600e30"
+ // ToExponential(1234, 0) -> "1e3"
+ //
+ // Returns true if the conversion succeeds. The conversion always succeeds
+ // except for the following cases:
+ // - the input value is special and no infinity_symbol or nan_symbol has
+ // been provided to the constructor,
+ // - 'requested_digits' > kMaxExponentialDigits.
+ // The last condition implies that the result will never contain more than
+ // kMaxExponentialDigits + 8 characters (the sign, the digit before the
+ // decimal point, the decimal point, the exponent character, the
+ // exponent's sign, and at most 3 exponent digits).
+ bool ToExponential(double value,
+ int requested_digits,
+ StringBuilder* result_builder) const;
+
+ // Computes 'precision' leading digits of the given 'value' and returns them
+ // either in exponential or decimal format, depending on
+ // max_{leading|trailing}_padding_zeroes_in_precision_mode (given to the
+ // constructor).
+ // The last computed digit is rounded.
+ //
+ // Example with max_leading_padding_zeroes_in_precision_mode = 6.
+ // ToPrecision(0.0000012345, 2) -> "0.0000012"
+ // ToPrecision(0.00000012345, 2) -> "1.2e-7"
+ // Similarily the converter may add up to
+ // max_trailing_padding_zeroes_in_precision_mode in precision mode to avoid
+ // returning an exponential representation. A zero added by the
+ // EMIT_TRAILING_ZERO_AFTER_POINT flag is counted for this limit.
+ // Examples for max_trailing_padding_zeroes_in_precision_mode = 1:
+ // ToPrecision(230.0, 2) -> "230"
+ // ToPrecision(230.0, 2) -> "230." with EMIT_TRAILING_DECIMAL_POINT.
+ // ToPrecision(230.0, 2) -> "2.3e2" with EMIT_TRAILING_ZERO_AFTER_POINT.
+ // Examples for max_trailing_padding_zeroes_in_precision_mode = 3, and no
+ // EMIT_TRAILING_ZERO_AFTER_POINT:
+ // ToPrecision(123450.0, 6) -> "123450"
+ // ToPrecision(123450.0, 5) -> "123450"
+ // ToPrecision(123450.0, 4) -> "123500"
+ // ToPrecision(123450.0, 3) -> "123000"
+ // ToPrecision(123450.0, 2) -> "1.2e5"
+ //
+ // Returns true if the conversion succeeds. The conversion always succeeds
+ // except for the following cases:
+ // - the input value is special and no infinity_symbol or nan_symbol has
+ // been provided to the constructor,
+ // - precision < kMinPericisionDigits
+ // - precision > kMaxPrecisionDigits
+ // The last condition implies that the result will never contain more than
+ // kMaxPrecisionDigits + 7 characters (the sign, the decimal point, the
+ // exponent character, the exponent's sign, and at most 3 exponent digits).
+ bool ToPrecision(double value,
+ int precision,
+ StringBuilder* result_builder) const;
+#endif // not needed for ICU
+
+ enum DtoaMode {
+ // Produce the shortest correct representation.
+ // For example the output of 0.299999999999999988897 is (the less accurate
+ // but correct) 0.3.
+ SHORTEST,
+ // Same as SHORTEST, but for single-precision floats.
+ SHORTEST_SINGLE,
+ // Produce a fixed number of digits after the decimal point.
+ // For instance fixed(0.1, 4) becomes 0.1000
+ // If the input number is big, the output will be big.
+ FIXED,
+ // Fixed number of digits (independent of the decimal point).
+ PRECISION
+ };
+
+ // The maximal number of digits that are needed to emit a double in base 10.
+ // A higher precision can be achieved by using more digits, but the shortest
+ // accurate representation of any double will never use more digits than
+ // kBase10MaximalLength.
+ // Note that DoubleToAscii null-terminates its input. So the given buffer
+ // should be at least kBase10MaximalLength + 1 characters long.
+ static const int kBase10MaximalLength = 17;
+
+ // Converts the given double 'v' to digit characters. 'v' must not be NaN,
+ // +Infinity, or -Infinity. In SHORTEST_SINGLE-mode this restriction also
+ // applies to 'v' after it has been casted to a single-precision float. That
+ // is, in this mode static_cast<float>(v) must not be NaN, +Infinity or
+ // -Infinity.
+ //
+ // The result should be interpreted as buffer * 10^(point-length).
+ //
+ // The digits are written to the buffer in the platform's charset, which is
+ // often UTF-8 (with ASCII-range digits) but may be another charset, such
+ // as EBCDIC.
+ //
+ // The output depends on the given mode:
+ // - SHORTEST: produce the least amount of digits for which the internal
+ // identity requirement is still satisfied. If the digits are printed
+ // (together with the correct exponent) then reading this number will give
+ // 'v' again. The buffer will choose the representation that is closest to
+ // 'v'. If there are two at the same distance, than the one farther away
+ // from 0 is chosen (halfway cases - ending with 5 - are rounded up).
+ // In this mode the 'requested_digits' parameter is ignored.
+ // - SHORTEST_SINGLE: same as SHORTEST but with single-precision.
+ // - FIXED: produces digits necessary to print a given number with
+ // 'requested_digits' digits after the decimal point. The produced digits
+ // might be too short in which case the caller has to fill the remainder
+ // with '0's.
+ // Example: toFixed(0.001, 5) is allowed to return buffer="1", point=-2.
+ // Halfway cases are rounded towards +/-Infinity (away from 0). The call
+ // toFixed(0.15, 2) thus returns buffer="2", point=0.
+ // The returned buffer may contain digits that would be truncated from the
+ // shortest representation of the input.
+ // - PRECISION: produces 'requested_digits' where the first digit is not '0'.
+ // Even though the length of produced digits usually equals
+ // 'requested_digits', the function is allowed to return fewer digits, in
+ // which case the caller has to fill the missing digits with '0's.
+ // Halfway cases are again rounded away from 0.
+ // DoubleToAscii expects the given buffer to be big enough to hold all
+ // digits and a terminating null-character. In SHORTEST-mode it expects a
+ // buffer of at least kBase10MaximalLength + 1. In all other modes the
+ // requested_digits parameter and the padding-zeroes limit the size of the
+ // output. Don't forget the decimal point, the exponent character and the
+ // terminating null-character when computing the maximal output size.
+ // The given length is only used in debug mode to ensure the buffer is big
+ // enough.
+ // ICU PATCH: Export this as U_I18N_API for unit tests.
+ static void U_I18N_API DoubleToAscii(double v,
+ DtoaMode mode,
+ int requested_digits,
+ char* buffer,
+ int buffer_length,
+ bool* sign,
+ int* length,
+ int* point);
+
+#if 0 // not needed for ICU
+ private:
+ // Implementation for ToShortest and ToShortestSingle.
+ bool ToShortestIeeeNumber(double value,
+ StringBuilder* result_builder,
+ DtoaMode mode) const;
+
+ // If the value is a special value (NaN or Infinity) constructs the
+ // corresponding string using the configured infinity/nan-symbol.
+ // If either of them is NULL or the value is not special then the
+ // function returns false.
+ bool HandleSpecialValues(double value, StringBuilder* result_builder) const;
+ // Constructs an exponential representation (i.e. 1.234e56).
+ // The given exponent assumes a decimal point after the first decimal digit.
+ void CreateExponentialRepresentation(const char* decimal_digits,
+ int length,
+ int exponent,
+ StringBuilder* result_builder) const;
+ // Creates a decimal representation (i.e 1234.5678).
+ void CreateDecimalRepresentation(const char* decimal_digits,
+ int length,
+ int decimal_point,
+ int digits_after_point,
+ StringBuilder* result_builder) const;
+
+ const int flags_;
+ const char* const infinity_symbol_;
+ const char* const nan_symbol_;
+ const char exponent_character_;
+ const int decimal_in_shortest_low_;
+ const int decimal_in_shortest_high_;
+ const int max_leading_padding_zeroes_in_precision_mode_;
+ const int max_trailing_padding_zeroes_in_precision_mode_;
+ const int min_exponent_width_;
+#endif // not needed for ICU
+
+ DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS(DoubleToStringConverter);
+};
+
+} // namespace double_conversion
+
+// ICU PATCH: Close ICU namespace
+U_NAMESPACE_END
+
+#endif // DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_
+#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/double-conversion-fast-dtoa.cpp b/contrib/libs/icu/i18n/double-conversion-fast-dtoa.cpp
index 961adbf04b..87a3d536bf 100644
--- a/contrib/libs/icu/i18n/double-conversion-fast-dtoa.cpp
+++ b/contrib/libs/icu/i18n/double-conversion-fast-dtoa.cpp
@@ -1,683 +1,683 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// From the double-conversion library. Original license:
-//
-// Copyright 2012 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.
-
-// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-// ICU PATCH: Customize header file paths for ICU.
-
-#include "double-conversion-fast-dtoa.h"
-
-#include "double-conversion-cached-powers.h"
-#include "double-conversion-diy-fp.h"
-#include "double-conversion-ieee.h"
-
-// ICU PATCH: Wrap in ICU namespace
-U_NAMESPACE_BEGIN
-
-namespace double_conversion {
-
-// The minimal and maximal target exponent define the range of w's binary
-// exponent, where 'w' is the result of multiplying the input by a cached power
-// of ten.
-//
-// A different range might be chosen on a different platform, to optimize digit
-// generation, but a smaller range requires more powers of ten to be cached.
-static const int kMinimalTargetExponent = -60;
-static const int kMaximalTargetExponent = -32;
-
-
-// Adjusts the last digit of the generated number, and screens out generated
-// solutions that may be inaccurate. A solution may be inaccurate if it is
-// outside the safe interval, or if we cannot prove that it is closer to the
-// input than a neighboring representation of the same length.
-//
-// Input: * buffer containing the digits of too_high / 10^kappa
-// * the buffer's length
-// * distance_too_high_w == (too_high - w).f() * unit
-// * unsafe_interval == (too_high - too_low).f() * unit
-// * rest = (too_high - buffer * 10^kappa).f() * unit
-// * ten_kappa = 10^kappa * unit
-// * unit = the common multiplier
-// Output: returns true if the buffer is guaranteed to contain the closest
-// representable number to the input.
-// Modifies the generated digits in the buffer to approach (round towards) w.
-static bool RoundWeed(Vector<char> buffer,
- int length,
- uint64_t distance_too_high_w,
- uint64_t unsafe_interval,
- uint64_t rest,
- uint64_t ten_kappa,
- uint64_t unit) {
- uint64_t small_distance = distance_too_high_w - unit;
- uint64_t big_distance = distance_too_high_w + unit;
- // Let w_low = too_high - big_distance, and
- // w_high = too_high - small_distance.
- // Note: w_low < w < w_high
- //
- // The real w (* unit) must lie somewhere inside the interval
- // ]w_low; w_high[ (often written as "(w_low; w_high)")
-
- // Basically the buffer currently contains a number in the unsafe interval
- // ]too_low; too_high[ with too_low < w < too_high
- //
- // too_high - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- // ^v 1 unit ^ ^ ^ ^
- // boundary_high --------------------- . . . .
- // ^v 1 unit . . . .
- // - - - - - - - - - - - - - - - - - - - + - - + - - - - - - . .
- // . . ^ . .
- // . big_distance . . .
- // . . . . rest
- // small_distance . . . .
- // v . . . .
- // w_high - - - - - - - - - - - - - - - - - - . . . .
- // ^v 1 unit . . . .
- // w ---------------------------------------- . . . .
- // ^v 1 unit v . . .
- // w_low - - - - - - - - - - - - - - - - - - - - - . . .
- // . . v
- // buffer --------------------------------------------------+-------+--------
- // . .
- // safe_interval .
- // v .
- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .
- // ^v 1 unit .
- // boundary_low ------------------------- unsafe_interval
- // ^v 1 unit v
- // too_low - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- //
- //
- // Note that the value of buffer could lie anywhere inside the range too_low
- // to too_high.
- //
- // boundary_low, boundary_high and w are approximations of the real boundaries
- // and v (the input number). They are guaranteed to be precise up to one unit.
- // In fact the error is guaranteed to be strictly less than one unit.
- //
- // Anything that lies outside the unsafe interval is guaranteed not to round
- // to v when read again.
- // Anything that lies inside the safe interval is guaranteed to round to v
- // when read again.
- // If the number inside the buffer lies inside the unsafe interval but not
- // inside the safe interval then we simply do not know and bail out (returning
- // false).
- //
- // Similarly we have to take into account the imprecision of 'w' when finding
- // the closest representation of 'w'. If we have two potential
- // representations, and one is closer to both w_low and w_high, then we know
- // it is closer to the actual value v.
- //
- // By generating the digits of too_high we got the largest (closest to
- // too_high) buffer that is still in the unsafe interval. In the case where
- // w_high < buffer < too_high we try to decrement the buffer.
- // This way the buffer approaches (rounds towards) w.
- // There are 3 conditions that stop the decrementation process:
- // 1) the buffer is already below w_high
- // 2) decrementing the buffer would make it leave the unsafe interval
- // 3) decrementing the buffer would yield a number below w_high and farther
- // away than the current number. In other words:
- // (buffer{-1} < w_high) && w_high - buffer{-1} > buffer - w_high
- // Instead of using the buffer directly we use its distance to too_high.
- // Conceptually rest ~= too_high - buffer
- // We need to do the following tests in this order to avoid over- and
- // underflows.
- DOUBLE_CONVERSION_ASSERT(rest <= unsafe_interval);
- while (rest < small_distance && // Negated condition 1
- unsafe_interval - rest >= ten_kappa && // Negated condition 2
- (rest + ten_kappa < small_distance || // buffer{-1} > w_high
- small_distance - rest >= rest + ten_kappa - small_distance)) {
- buffer[length - 1]--;
- rest += ten_kappa;
- }
-
- // We have approached w+ as much as possible. We now test if approaching w-
- // would require changing the buffer. If yes, then we have two possible
- // representations close to w, but we cannot decide which one is closer.
- if (rest < big_distance &&
- unsafe_interval - rest >= ten_kappa &&
- (rest + ten_kappa < big_distance ||
- big_distance - rest > rest + ten_kappa - big_distance)) {
- return false;
- }
-
- // Weeding test.
- // The safe interval is [too_low + 2 ulp; too_high - 2 ulp]
- // Since too_low = too_high - unsafe_interval this is equivalent to
- // [too_high - unsafe_interval + 4 ulp; too_high - 2 ulp]
- // Conceptually we have: rest ~= too_high - buffer
- return (2 * unit <= rest) && (rest <= unsafe_interval - 4 * unit);
-}
-
-
-// Rounds the buffer upwards if the result is closer to v by possibly adding
-// 1 to the buffer. If the precision of the calculation is not sufficient to
-// round correctly, return false.
-// The rounding might shift the whole buffer in which case the kappa is
-// adjusted. For example "99", kappa = 3 might become "10", kappa = 4.
-//
-// If 2*rest > ten_kappa then the buffer needs to be round up.
-// rest can have an error of +/- 1 unit. This function accounts for the
-// imprecision and returns false, if the rounding direction cannot be
-// unambiguously determined.
-//
-// Precondition: rest < ten_kappa.
-static bool RoundWeedCounted(Vector<char> buffer,
- int length,
- uint64_t rest,
- uint64_t ten_kappa,
- uint64_t unit,
- int* kappa) {
- DOUBLE_CONVERSION_ASSERT(rest < ten_kappa);
- // The following tests are done in a specific order to avoid overflows. They
- // will work correctly with any uint64 values of rest < ten_kappa and unit.
- //
- // If the unit is too big, then we don't know which way to round. For example
- // a unit of 50 means that the real number lies within rest +/- 50. If
- // 10^kappa == 40 then there is no way to tell which way to round.
- if (unit >= ten_kappa) return false;
- // Even if unit is just half the size of 10^kappa we are already completely
- // lost. (And after the previous test we know that the expression will not
- // over/underflow.)
- if (ten_kappa - unit <= unit) return false;
- // If 2 * (rest + unit) <= 10^kappa we can safely round down.
- if ((ten_kappa - rest > rest) && (ten_kappa - 2 * rest >= 2 * unit)) {
- return true;
- }
- // If 2 * (rest - unit) >= 10^kappa, then we can safely round up.
- if ((rest > unit) && (ten_kappa - (rest - unit) <= (rest - unit))) {
- // Increment the last digit recursively until we find a non '9' digit.
- buffer[length - 1]++;
- for (int i = length - 1; i > 0; --i) {
- if (buffer[i] != '0' + 10) break;
- buffer[i] = '0';
- buffer[i - 1]++;
- }
- // If the first digit is now '0'+ 10 we had a buffer with all '9's. With the
- // exception of the first digit all digits are now '0'. Simply switch the
- // first digit to '1' and adjust the kappa. Example: "99" becomes "10" and
- // the power (the kappa) is increased.
- if (buffer[0] == '0' + 10) {
- buffer[0] = '1';
- (*kappa) += 1;
- }
- return true;
- }
- return false;
-}
-
-// Returns the biggest power of ten that is less than or equal to the given
-// number. We furthermore receive the maximum number of bits 'number' has.
-//
-// Returns power == 10^(exponent_plus_one-1) such that
-// power <= number < power * 10.
-// If number_bits == 0 then 0^(0-1) is returned.
-// The number of bits must be <= 32.
-// Precondition: number < (1 << (number_bits + 1)).
-
-// Inspired by the method for finding an integer log base 10 from here:
-// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
-static unsigned int const kSmallPowersOfTen[] =
- {0, 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000,
- 1000000000};
-
-static void BiggestPowerTen(uint32_t number,
- int number_bits,
- uint32_t* power,
- int* exponent_plus_one) {
- DOUBLE_CONVERSION_ASSERT(number < (1u << (number_bits + 1)));
- // 1233/4096 is approximately 1/lg(10).
- int exponent_plus_one_guess = ((number_bits + 1) * 1233 >> 12);
- // We increment to skip over the first entry in the kPowersOf10 table.
- // Note: kPowersOf10[i] == 10^(i-1).
- exponent_plus_one_guess++;
- // We don't have any guarantees that 2^number_bits <= number.
- if (number < kSmallPowersOfTen[exponent_plus_one_guess]) {
- exponent_plus_one_guess--;
- }
- *power = kSmallPowersOfTen[exponent_plus_one_guess];
- *exponent_plus_one = exponent_plus_one_guess;
-}
-
-// Generates the digits of input number w.
-// w is a floating-point number (DiyFp), consisting of a significand and an
-// exponent. Its exponent is bounded by kMinimalTargetExponent and
-// kMaximalTargetExponent.
-// Hence -60 <= w.e() <= -32.
-//
-// Returns false if it fails, in which case the generated digits in the buffer
-// should not be used.
-// Preconditions:
-// * low, w and high are correct up to 1 ulp (unit in the last place). That
-// is, their error must be less than a unit of their last digits.
-// * low.e() == w.e() == high.e()
-// * low < w < high, and taking into account their error: low~ <= high~
-// * kMinimalTargetExponent <= w.e() <= kMaximalTargetExponent
-// Postconditions: returns false if procedure fails.
-// otherwise:
-// * buffer is not null-terminated, but len contains the number of digits.
-// * buffer contains the shortest possible decimal digit-sequence
-// such that LOW < buffer * 10^kappa < HIGH, where LOW and HIGH are the
-// correct values of low and high (without their error).
-// * if more than one decimal representation gives the minimal number of
-// decimal digits then the one closest to W (where W is the correct value
-// of w) is chosen.
-// Remark: this procedure takes into account the imprecision of its input
-// numbers. If the precision is not enough to guarantee all the postconditions
-// then false is returned. This usually happens rarely (~0.5%).
-//
-// Say, for the sake of example, that
-// w.e() == -48, and w.f() == 0x1234567890abcdef
-// w's value can be computed by w.f() * 2^w.e()
-// We can obtain w's integral digits by simply shifting w.f() by -w.e().
-// -> w's integral part is 0x1234
-// w's fractional part is therefore 0x567890abcdef.
-// Printing w's integral part is easy (simply print 0x1234 in decimal).
-// In order to print its fraction we repeatedly multiply the fraction by 10 and
-// get each digit. Example the first digit after the point would be computed by
-// (0x567890abcdef * 10) >> 48. -> 3
-// The whole thing becomes slightly more complicated because we want to stop
-// once we have enough digits. That is, once the digits inside the buffer
-// represent 'w' we can stop. Everything inside the interval low - high
-// represents w. However we have to pay attention to low, high and w's
-// imprecision.
-static bool DigitGen(DiyFp low,
- DiyFp w,
- DiyFp high,
- Vector<char> buffer,
- int* length,
- int* kappa) {
- DOUBLE_CONVERSION_ASSERT(low.e() == w.e() && w.e() == high.e());
- DOUBLE_CONVERSION_ASSERT(low.f() + 1 <= high.f() - 1);
- DOUBLE_CONVERSION_ASSERT(kMinimalTargetExponent <= w.e() && w.e() <= kMaximalTargetExponent);
- // low, w and high are imprecise, but by less than one ulp (unit in the last
- // place).
- // If we remove (resp. add) 1 ulp from low (resp. high) we are certain that
- // the new numbers are outside of the interval we want the final
- // representation to lie in.
- // Inversely adding (resp. removing) 1 ulp from low (resp. high) would yield
- // numbers that are certain to lie in the interval. We will use this fact
- // later on.
- // We will now start by generating the digits within the uncertain
- // interval. Later we will weed out representations that lie outside the safe
- // interval and thus _might_ lie outside the correct interval.
- uint64_t unit = 1;
- DiyFp too_low = DiyFp(low.f() - unit, low.e());
- DiyFp too_high = DiyFp(high.f() + unit, high.e());
- // too_low and too_high are guaranteed to lie outside the interval we want the
- // generated number in.
- DiyFp unsafe_interval = DiyFp::Minus(too_high, too_low);
- // We now cut the input number into two parts: the integral digits and the
- // fractionals. We will not write any decimal separator though, but adapt
- // kappa instead.
- // Reminder: we are currently computing the digits (stored inside the buffer)
- // such that: too_low < buffer * 10^kappa < too_high
- // We use too_high for the digit_generation and stop as soon as possible.
- // If we stop early we effectively round down.
- DiyFp one = DiyFp(static_cast<uint64_t>(1) << -w.e(), w.e());
- // Division by one is a shift.
- uint32_t integrals = static_cast<uint32_t>(too_high.f() >> -one.e());
- // Modulo by one is an and.
- uint64_t fractionals = too_high.f() & (one.f() - 1);
- uint32_t divisor;
- int divisor_exponent_plus_one;
- BiggestPowerTen(integrals, DiyFp::kSignificandSize - (-one.e()),
- &divisor, &divisor_exponent_plus_one);
- *kappa = divisor_exponent_plus_one;
- *length = 0;
- // Loop invariant: buffer = too_high / 10^kappa (integer division)
- // The invariant holds for the first iteration: kappa has been initialized
- // with the divisor exponent + 1. And the divisor is the biggest power of ten
- // that is smaller than integrals.
- while (*kappa > 0) {
- int digit = integrals / divisor;
- DOUBLE_CONVERSION_ASSERT(digit <= 9);
- buffer[*length] = static_cast<char>('0' + digit);
- (*length)++;
- integrals %= divisor;
- (*kappa)--;
- // Note that kappa now equals the exponent of the divisor and that the
- // invariant thus holds again.
- uint64_t rest =
- (static_cast<uint64_t>(integrals) << -one.e()) + fractionals;
- // Invariant: too_high = buffer * 10^kappa + DiyFp(rest, one.e())
- // Reminder: unsafe_interval.e() == one.e()
- if (rest < unsafe_interval.f()) {
- // Rounding down (by not emitting the remaining digits) yields a number
- // that lies within the unsafe interval.
- return RoundWeed(buffer, *length, DiyFp::Minus(too_high, w).f(),
- unsafe_interval.f(), rest,
- static_cast<uint64_t>(divisor) << -one.e(), unit);
- }
- divisor /= 10;
- }
-
- // The integrals have been generated. We are at the point of the decimal
- // separator. In the following loop we simply multiply the remaining digits by
- // 10 and divide by one. We just need to pay attention to multiply associated
- // data (like the interval or 'unit'), too.
- // Note that the multiplication by 10 does not overflow, because w.e >= -60
- // and thus one.e >= -60.
- DOUBLE_CONVERSION_ASSERT(one.e() >= -60);
- DOUBLE_CONVERSION_ASSERT(fractionals < one.f());
- DOUBLE_CONVERSION_ASSERT(DOUBLE_CONVERSION_UINT64_2PART_C(0xFFFFFFFF, FFFFFFFF) / 10 >= one.f());
- for (;;) {
- fractionals *= 10;
- unit *= 10;
- unsafe_interval.set_f(unsafe_interval.f() * 10);
- // Integer division by one.
- int digit = static_cast<int>(fractionals >> -one.e());
- DOUBLE_CONVERSION_ASSERT(digit <= 9);
- buffer[*length] = static_cast<char>('0' + digit);
- (*length)++;
- fractionals &= one.f() - 1; // Modulo by one.
- (*kappa)--;
- if (fractionals < unsafe_interval.f()) {
- return RoundWeed(buffer, *length, DiyFp::Minus(too_high, w).f() * unit,
- unsafe_interval.f(), fractionals, one.f(), unit);
- }
- }
-}
-
-
-
-// Generates (at most) requested_digits digits of input number w.
-// w is a floating-point number (DiyFp), consisting of a significand and an
-// exponent. Its exponent is bounded by kMinimalTargetExponent and
-// kMaximalTargetExponent.
-// Hence -60 <= w.e() <= -32.
-//
-// Returns false if it fails, in which case the generated digits in the buffer
-// should not be used.
-// Preconditions:
-// * w is correct up to 1 ulp (unit in the last place). That
-// is, its error must be strictly less than a unit of its last digit.
-// * kMinimalTargetExponent <= w.e() <= kMaximalTargetExponent
-//
-// Postconditions: returns false if procedure fails.
-// otherwise:
-// * buffer is not null-terminated, but length contains the number of
-// digits.
-// * the representation in buffer is the most precise representation of
-// requested_digits digits.
-// * buffer contains at most requested_digits digits of w. If there are less
-// than requested_digits digits then some trailing '0's have been removed.
-// * kappa is such that
-// w = buffer * 10^kappa + eps with |eps| < 10^kappa / 2.
-//
-// Remark: This procedure takes into account the imprecision of its input
-// numbers. If the precision is not enough to guarantee all the postconditions
-// then false is returned. This usually happens rarely, but the failure-rate
-// increases with higher requested_digits.
-static bool DigitGenCounted(DiyFp w,
- int requested_digits,
- Vector<char> buffer,
- int* length,
- int* kappa) {
- DOUBLE_CONVERSION_ASSERT(kMinimalTargetExponent <= w.e() && w.e() <= kMaximalTargetExponent);
- DOUBLE_CONVERSION_ASSERT(kMinimalTargetExponent >= -60);
- DOUBLE_CONVERSION_ASSERT(kMaximalTargetExponent <= -32);
- // w is assumed to have an error less than 1 unit. Whenever w is scaled we
- // also scale its error.
- uint64_t w_error = 1;
- // We cut the input number into two parts: the integral digits and the
- // fractional digits. We don't emit any decimal separator, but adapt kappa
- // instead. Example: instead of writing "1.2" we put "12" into the buffer and
- // increase kappa by 1.
- DiyFp one = DiyFp(static_cast<uint64_t>(1) << -w.e(), w.e());
- // Division by one is a shift.
- uint32_t integrals = static_cast<uint32_t>(w.f() >> -one.e());
- // Modulo by one is an and.
- uint64_t fractionals = w.f() & (one.f() - 1);
- uint32_t divisor;
- int divisor_exponent_plus_one;
- BiggestPowerTen(integrals, DiyFp::kSignificandSize - (-one.e()),
- &divisor, &divisor_exponent_plus_one);
- *kappa = divisor_exponent_plus_one;
- *length = 0;
-
- // Loop invariant: buffer = w / 10^kappa (integer division)
- // The invariant holds for the first iteration: kappa has been initialized
- // with the divisor exponent + 1. And the divisor is the biggest power of ten
- // that is smaller than 'integrals'.
- while (*kappa > 0) {
- int digit = integrals / divisor;
- DOUBLE_CONVERSION_ASSERT(digit <= 9);
- buffer[*length] = static_cast<char>('0' + digit);
- (*length)++;
- requested_digits--;
- integrals %= divisor;
- (*kappa)--;
- // Note that kappa now equals the exponent of the divisor and that the
- // invariant thus holds again.
- if (requested_digits == 0) break;
- divisor /= 10;
- }
-
- if (requested_digits == 0) {
- uint64_t rest =
- (static_cast<uint64_t>(integrals) << -one.e()) + fractionals;
- return RoundWeedCounted(buffer, *length, rest,
- static_cast<uint64_t>(divisor) << -one.e(), w_error,
- kappa);
- }
-
- // The integrals have been generated. We are at the point of the decimal
- // separator. In the following loop we simply multiply the remaining digits by
- // 10 and divide by one. We just need to pay attention to multiply associated
- // data (the 'unit'), too.
- // Note that the multiplication by 10 does not overflow, because w.e >= -60
- // and thus one.e >= -60.
- DOUBLE_CONVERSION_ASSERT(one.e() >= -60);
- DOUBLE_CONVERSION_ASSERT(fractionals < one.f());
- DOUBLE_CONVERSION_ASSERT(DOUBLE_CONVERSION_UINT64_2PART_C(0xFFFFFFFF, FFFFFFFF) / 10 >= one.f());
- while (requested_digits > 0 && fractionals > w_error) {
- fractionals *= 10;
- w_error *= 10;
- // Integer division by one.
- int digit = static_cast<int>(fractionals >> -one.e());
- DOUBLE_CONVERSION_ASSERT(digit <= 9);
- buffer[*length] = static_cast<char>('0' + digit);
- (*length)++;
- requested_digits--;
- fractionals &= one.f() - 1; // Modulo by one.
- (*kappa)--;
- }
- if (requested_digits != 0) return false;
- return RoundWeedCounted(buffer, *length, fractionals, one.f(), w_error,
- kappa);
-}
-
-
-// Provides a decimal representation of v.
-// Returns true if it succeeds, otherwise the result cannot be trusted.
-// There will be *length digits inside the buffer (not null-terminated).
-// If the function returns true then
-// v == (double) (buffer * 10^decimal_exponent).
-// The digits in the buffer are the shortest representation possible: no
-// 0.09999999999999999 instead of 0.1. The shorter representation will even be
-// chosen even if the longer one would be closer to v.
-// The last digit will be closest to the actual v. That is, even if several
-// digits might correctly yield 'v' when read again, the closest will be
-// computed.
-static bool Grisu3(double v,
- FastDtoaMode mode,
- Vector<char> buffer,
- int* length,
- int* decimal_exponent) {
- DiyFp w = Double(v).AsNormalizedDiyFp();
- // boundary_minus and boundary_plus are the boundaries between v and its
- // closest floating-point neighbors. Any number strictly between
- // boundary_minus and boundary_plus will round to v when convert to a double.
- // Grisu3 will never output representations that lie exactly on a boundary.
- DiyFp boundary_minus, boundary_plus;
- if (mode == FAST_DTOA_SHORTEST) {
- Double(v).NormalizedBoundaries(&boundary_minus, &boundary_plus);
- } else {
- DOUBLE_CONVERSION_ASSERT(mode == FAST_DTOA_SHORTEST_SINGLE);
- float single_v = static_cast<float>(v);
- Single(single_v).NormalizedBoundaries(&boundary_minus, &boundary_plus);
- }
- DOUBLE_CONVERSION_ASSERT(boundary_plus.e() == w.e());
- DiyFp ten_mk; // Cached power of ten: 10^-k
- int mk; // -k
- int ten_mk_minimal_binary_exponent =
- kMinimalTargetExponent - (w.e() + DiyFp::kSignificandSize);
- int ten_mk_maximal_binary_exponent =
- kMaximalTargetExponent - (w.e() + DiyFp::kSignificandSize);
- PowersOfTenCache::GetCachedPowerForBinaryExponentRange(
- ten_mk_minimal_binary_exponent,
- ten_mk_maximal_binary_exponent,
- &ten_mk, &mk);
- DOUBLE_CONVERSION_ASSERT((kMinimalTargetExponent <= w.e() + ten_mk.e() +
- DiyFp::kSignificandSize) &&
- (kMaximalTargetExponent >= w.e() + ten_mk.e() +
- DiyFp::kSignificandSize));
- // Note that ten_mk is only an approximation of 10^-k. A DiyFp only contains a
- // 64 bit significand and ten_mk is thus only precise up to 64 bits.
-
- // The DiyFp::Times procedure rounds its result, and ten_mk is approximated
- // too. The variable scaled_w (as well as scaled_boundary_minus/plus) are now
- // off by a small amount.
- // In fact: scaled_w - w*10^k < 1ulp (unit in the last place) of scaled_w.
- // In other words: let f = scaled_w.f() and e = scaled_w.e(), then
- // (f-1) * 2^e < w*10^k < (f+1) * 2^e
- DiyFp scaled_w = DiyFp::Times(w, ten_mk);
- DOUBLE_CONVERSION_ASSERT(scaled_w.e() ==
- boundary_plus.e() + ten_mk.e() + DiyFp::kSignificandSize);
- // In theory it would be possible to avoid some recomputations by computing
- // the difference between w and boundary_minus/plus (a power of 2) and to
- // compute scaled_boundary_minus/plus by subtracting/adding from
- // scaled_w. However the code becomes much less readable and the speed
- // enhancements are not terriffic.
- DiyFp scaled_boundary_minus = DiyFp::Times(boundary_minus, ten_mk);
- DiyFp scaled_boundary_plus = DiyFp::Times(boundary_plus, ten_mk);
-
- // DigitGen will generate the digits of scaled_w. Therefore we have
- // v == (double) (scaled_w * 10^-mk).
- // Set decimal_exponent == -mk and pass it to DigitGen. If scaled_w is not an
- // integer than it will be updated. For instance if scaled_w == 1.23 then
- // the buffer will be filled with "123" und the decimal_exponent will be
- // decreased by 2.
- int kappa;
- bool result = DigitGen(scaled_boundary_minus, scaled_w, scaled_boundary_plus,
- buffer, length, &kappa);
- *decimal_exponent = -mk + kappa;
- return result;
-}
-
-
-// The "counted" version of grisu3 (see above) only generates requested_digits
-// number of digits. This version does not generate the shortest representation,
-// and with enough requested digits 0.1 will at some point print as 0.9999999...
-// Grisu3 is too imprecise for real halfway cases (1.5 will not work) and
-// therefore the rounding strategy for halfway cases is irrelevant.
-static bool Grisu3Counted(double v,
- int requested_digits,
- Vector<char> buffer,
- int* length,
- int* decimal_exponent) {
- DiyFp w = Double(v).AsNormalizedDiyFp();
- DiyFp ten_mk; // Cached power of ten: 10^-k
- int mk; // -k
- int ten_mk_minimal_binary_exponent =
- kMinimalTargetExponent - (w.e() + DiyFp::kSignificandSize);
- int ten_mk_maximal_binary_exponent =
- kMaximalTargetExponent - (w.e() + DiyFp::kSignificandSize);
- PowersOfTenCache::GetCachedPowerForBinaryExponentRange(
- ten_mk_minimal_binary_exponent,
- ten_mk_maximal_binary_exponent,
- &ten_mk, &mk);
- DOUBLE_CONVERSION_ASSERT((kMinimalTargetExponent <= w.e() + ten_mk.e() +
- DiyFp::kSignificandSize) &&
- (kMaximalTargetExponent >= w.e() + ten_mk.e() +
- DiyFp::kSignificandSize));
- // Note that ten_mk is only an approximation of 10^-k. A DiyFp only contains a
- // 64 bit significand and ten_mk is thus only precise up to 64 bits.
-
- // The DiyFp::Times procedure rounds its result, and ten_mk is approximated
- // too. The variable scaled_w (as well as scaled_boundary_minus/plus) are now
- // off by a small amount.
- // In fact: scaled_w - w*10^k < 1ulp (unit in the last place) of scaled_w.
- // In other words: let f = scaled_w.f() and e = scaled_w.e(), then
- // (f-1) * 2^e < w*10^k < (f+1) * 2^e
- DiyFp scaled_w = DiyFp::Times(w, ten_mk);
-
- // We now have (double) (scaled_w * 10^-mk).
- // DigitGen will generate the first requested_digits digits of scaled_w and
- // return together with a kappa such that scaled_w ~= buffer * 10^kappa. (It
- // will not always be exactly the same since DigitGenCounted only produces a
- // limited number of digits.)
- int kappa;
- bool result = DigitGenCounted(scaled_w, requested_digits,
- buffer, length, &kappa);
- *decimal_exponent = -mk + kappa;
- return result;
-}
-
-
-bool FastDtoa(double v,
- FastDtoaMode mode,
- int requested_digits,
- Vector<char> buffer,
- int* length,
- int* decimal_point) {
- DOUBLE_CONVERSION_ASSERT(v > 0);
- DOUBLE_CONVERSION_ASSERT(!Double(v).IsSpecial());
-
- bool result = false;
- int decimal_exponent = 0;
- switch (mode) {
- case FAST_DTOA_SHORTEST:
- case FAST_DTOA_SHORTEST_SINGLE:
- result = Grisu3(v, mode, buffer, length, &decimal_exponent);
- break;
- case FAST_DTOA_PRECISION:
- result = Grisu3Counted(v, requested_digits,
- buffer, length, &decimal_exponent);
- break;
- default:
- DOUBLE_CONVERSION_UNREACHABLE();
- }
- if (result) {
- *decimal_point = *length + decimal_exponent;
- buffer[*length] = '\0';
- }
- return result;
-}
-
-} // namespace double_conversion
-
-// ICU PATCH: Close ICU namespace
-U_NAMESPACE_END
-#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+//
+// From the double-conversion library. Original license:
+//
+// Copyright 2012 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.
+
+// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+// ICU PATCH: Customize header file paths for ICU.
+
+#include "double-conversion-fast-dtoa.h"
+
+#include "double-conversion-cached-powers.h"
+#include "double-conversion-diy-fp.h"
+#include "double-conversion-ieee.h"
+
+// ICU PATCH: Wrap in ICU namespace
+U_NAMESPACE_BEGIN
+
+namespace double_conversion {
+
+// The minimal and maximal target exponent define the range of w's binary
+// exponent, where 'w' is the result of multiplying the input by a cached power
+// of ten.
+//
+// A different range might be chosen on a different platform, to optimize digit
+// generation, but a smaller range requires more powers of ten to be cached.
+static const int kMinimalTargetExponent = -60;
+static const int kMaximalTargetExponent = -32;
+
+
+// Adjusts the last digit of the generated number, and screens out generated
+// solutions that may be inaccurate. A solution may be inaccurate if it is
+// outside the safe interval, or if we cannot prove that it is closer to the
+// input than a neighboring representation of the same length.
+//
+// Input: * buffer containing the digits of too_high / 10^kappa
+// * the buffer's length
+// * distance_too_high_w == (too_high - w).f() * unit
+// * unsafe_interval == (too_high - too_low).f() * unit
+// * rest = (too_high - buffer * 10^kappa).f() * unit
+// * ten_kappa = 10^kappa * unit
+// * unit = the common multiplier
+// Output: returns true if the buffer is guaranteed to contain the closest
+// representable number to the input.
+// Modifies the generated digits in the buffer to approach (round towards) w.
+static bool RoundWeed(Vector<char> buffer,
+ int length,
+ uint64_t distance_too_high_w,
+ uint64_t unsafe_interval,
+ uint64_t rest,
+ uint64_t ten_kappa,
+ uint64_t unit) {
+ uint64_t small_distance = distance_too_high_w - unit;
+ uint64_t big_distance = distance_too_high_w + unit;
+ // Let w_low = too_high - big_distance, and
+ // w_high = too_high - small_distance.
+ // Note: w_low < w < w_high
+ //
+ // The real w (* unit) must lie somewhere inside the interval
+ // ]w_low; w_high[ (often written as "(w_low; w_high)")
+
+ // Basically the buffer currently contains a number in the unsafe interval
+ // ]too_low; too_high[ with too_low < w < too_high
+ //
+ // too_high - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ // ^v 1 unit ^ ^ ^ ^
+ // boundary_high --------------------- . . . .
+ // ^v 1 unit . . . .
+ // - - - - - - - - - - - - - - - - - - - + - - + - - - - - - . .
+ // . . ^ . .
+ // . big_distance . . .
+ // . . . . rest
+ // small_distance . . . .
+ // v . . . .
+ // w_high - - - - - - - - - - - - - - - - - - . . . .
+ // ^v 1 unit . . . .
+ // w ---------------------------------------- . . . .
+ // ^v 1 unit v . . .
+ // w_low - - - - - - - - - - - - - - - - - - - - - . . .
+ // . . v
+ // buffer --------------------------------------------------+-------+--------
+ // . .
+ // safe_interval .
+ // v .
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .
+ // ^v 1 unit .
+ // boundary_low ------------------------- unsafe_interval
+ // ^v 1 unit v
+ // too_low - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ //
+ //
+ // Note that the value of buffer could lie anywhere inside the range too_low
+ // to too_high.
+ //
+ // boundary_low, boundary_high and w are approximations of the real boundaries
+ // and v (the input number). They are guaranteed to be precise up to one unit.
+ // In fact the error is guaranteed to be strictly less than one unit.
+ //
+ // Anything that lies outside the unsafe interval is guaranteed not to round
+ // to v when read again.
+ // Anything that lies inside the safe interval is guaranteed to round to v
+ // when read again.
+ // If the number inside the buffer lies inside the unsafe interval but not
+ // inside the safe interval then we simply do not know and bail out (returning
+ // false).
+ //
+ // Similarly we have to take into account the imprecision of 'w' when finding
+ // the closest representation of 'w'. If we have two potential
+ // representations, and one is closer to both w_low and w_high, then we know
+ // it is closer to the actual value v.
+ //
+ // By generating the digits of too_high we got the largest (closest to
+ // too_high) buffer that is still in the unsafe interval. In the case where
+ // w_high < buffer < too_high we try to decrement the buffer.
+ // This way the buffer approaches (rounds towards) w.
+ // There are 3 conditions that stop the decrementation process:
+ // 1) the buffer is already below w_high
+ // 2) decrementing the buffer would make it leave the unsafe interval
+ // 3) decrementing the buffer would yield a number below w_high and farther
+ // away than the current number. In other words:
+ // (buffer{-1} < w_high) && w_high - buffer{-1} > buffer - w_high
+ // Instead of using the buffer directly we use its distance to too_high.
+ // Conceptually rest ~= too_high - buffer
+ // We need to do the following tests in this order to avoid over- and
+ // underflows.
+ DOUBLE_CONVERSION_ASSERT(rest <= unsafe_interval);
+ while (rest < small_distance && // Negated condition 1
+ unsafe_interval - rest >= ten_kappa && // Negated condition 2
+ (rest + ten_kappa < small_distance || // buffer{-1} > w_high
+ small_distance - rest >= rest + ten_kappa - small_distance)) {
+ buffer[length - 1]--;
+ rest += ten_kappa;
+ }
+
+ // We have approached w+ as much as possible. We now test if approaching w-
+ // would require changing the buffer. If yes, then we have two possible
+ // representations close to w, but we cannot decide which one is closer.
+ if (rest < big_distance &&
+ unsafe_interval - rest >= ten_kappa &&
+ (rest + ten_kappa < big_distance ||
+ big_distance - rest > rest + ten_kappa - big_distance)) {
+ return false;
+ }
+
+ // Weeding test.
+ // The safe interval is [too_low + 2 ulp; too_high - 2 ulp]
+ // Since too_low = too_high - unsafe_interval this is equivalent to
+ // [too_high - unsafe_interval + 4 ulp; too_high - 2 ulp]
+ // Conceptually we have: rest ~= too_high - buffer
+ return (2 * unit <= rest) && (rest <= unsafe_interval - 4 * unit);
+}
+
+
+// Rounds the buffer upwards if the result is closer to v by possibly adding
+// 1 to the buffer. If the precision of the calculation is not sufficient to
+// round correctly, return false.
+// The rounding might shift the whole buffer in which case the kappa is
+// adjusted. For example "99", kappa = 3 might become "10", kappa = 4.
+//
+// If 2*rest > ten_kappa then the buffer needs to be round up.
+// rest can have an error of +/- 1 unit. This function accounts for the
+// imprecision and returns false, if the rounding direction cannot be
+// unambiguously determined.
+//
+// Precondition: rest < ten_kappa.
+static bool RoundWeedCounted(Vector<char> buffer,
+ int length,
+ uint64_t rest,
+ uint64_t ten_kappa,
+ uint64_t unit,
+ int* kappa) {
+ DOUBLE_CONVERSION_ASSERT(rest < ten_kappa);
+ // The following tests are done in a specific order to avoid overflows. They
+ // will work correctly with any uint64 values of rest < ten_kappa and unit.
+ //
+ // If the unit is too big, then we don't know which way to round. For example
+ // a unit of 50 means that the real number lies within rest +/- 50. If
+ // 10^kappa == 40 then there is no way to tell which way to round.
+ if (unit >= ten_kappa) return false;
+ // Even if unit is just half the size of 10^kappa we are already completely
+ // lost. (And after the previous test we know that the expression will not
+ // over/underflow.)
+ if (ten_kappa - unit <= unit) return false;
+ // If 2 * (rest + unit) <= 10^kappa we can safely round down.
+ if ((ten_kappa - rest > rest) && (ten_kappa - 2 * rest >= 2 * unit)) {
+ return true;
+ }
+ // If 2 * (rest - unit) >= 10^kappa, then we can safely round up.
+ if ((rest > unit) && (ten_kappa - (rest - unit) <= (rest - unit))) {
+ // Increment the last digit recursively until we find a non '9' digit.
+ buffer[length - 1]++;
+ for (int i = length - 1; i > 0; --i) {
+ if (buffer[i] != '0' + 10) break;
+ buffer[i] = '0';
+ buffer[i - 1]++;
+ }
+ // If the first digit is now '0'+ 10 we had a buffer with all '9's. With the
+ // exception of the first digit all digits are now '0'. Simply switch the
+ // first digit to '1' and adjust the kappa. Example: "99" becomes "10" and
+ // the power (the kappa) is increased.
+ if (buffer[0] == '0' + 10) {
+ buffer[0] = '1';
+ (*kappa) += 1;
+ }
+ return true;
+ }
+ return false;
+}
+
+// Returns the biggest power of ten that is less than or equal to the given
+// number. We furthermore receive the maximum number of bits 'number' has.
+//
+// Returns power == 10^(exponent_plus_one-1) such that
+// power <= number < power * 10.
+// If number_bits == 0 then 0^(0-1) is returned.
+// The number of bits must be <= 32.
+// Precondition: number < (1 << (number_bits + 1)).
+
+// Inspired by the method for finding an integer log base 10 from here:
+// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
+static unsigned int const kSmallPowersOfTen[] =
+ {0, 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000,
+ 1000000000};
+
+static void BiggestPowerTen(uint32_t number,
+ int number_bits,
+ uint32_t* power,
+ int* exponent_plus_one) {
+ DOUBLE_CONVERSION_ASSERT(number < (1u << (number_bits + 1)));
+ // 1233/4096 is approximately 1/lg(10).
+ int exponent_plus_one_guess = ((number_bits + 1) * 1233 >> 12);
+ // We increment to skip over the first entry in the kPowersOf10 table.
+ // Note: kPowersOf10[i] == 10^(i-1).
+ exponent_plus_one_guess++;
+ // We don't have any guarantees that 2^number_bits <= number.
+ if (number < kSmallPowersOfTen[exponent_plus_one_guess]) {
+ exponent_plus_one_guess--;
+ }
+ *power = kSmallPowersOfTen[exponent_plus_one_guess];
+ *exponent_plus_one = exponent_plus_one_guess;
+}
+
+// Generates the digits of input number w.
+// w is a floating-point number (DiyFp), consisting of a significand and an
+// exponent. Its exponent is bounded by kMinimalTargetExponent and
+// kMaximalTargetExponent.
+// Hence -60 <= w.e() <= -32.
+//
+// Returns false if it fails, in which case the generated digits in the buffer
+// should not be used.
+// Preconditions:
+// * low, w and high are correct up to 1 ulp (unit in the last place). That
+// is, their error must be less than a unit of their last digits.
+// * low.e() == w.e() == high.e()
+// * low < w < high, and taking into account their error: low~ <= high~
+// * kMinimalTargetExponent <= w.e() <= kMaximalTargetExponent
+// Postconditions: returns false if procedure fails.
+// otherwise:
+// * buffer is not null-terminated, but len contains the number of digits.
+// * buffer contains the shortest possible decimal digit-sequence
+// such that LOW < buffer * 10^kappa < HIGH, where LOW and HIGH are the
+// correct values of low and high (without their error).
+// * if more than one decimal representation gives the minimal number of
+// decimal digits then the one closest to W (where W is the correct value
+// of w) is chosen.
+// Remark: this procedure takes into account the imprecision of its input
+// numbers. If the precision is not enough to guarantee all the postconditions
+// then false is returned. This usually happens rarely (~0.5%).
+//
+// Say, for the sake of example, that
+// w.e() == -48, and w.f() == 0x1234567890abcdef
+// w's value can be computed by w.f() * 2^w.e()
+// We can obtain w's integral digits by simply shifting w.f() by -w.e().
+// -> w's integral part is 0x1234
+// w's fractional part is therefore 0x567890abcdef.
+// Printing w's integral part is easy (simply print 0x1234 in decimal).
+// In order to print its fraction we repeatedly multiply the fraction by 10 and
+// get each digit. Example the first digit after the point would be computed by
+// (0x567890abcdef * 10) >> 48. -> 3
+// The whole thing becomes slightly more complicated because we want to stop
+// once we have enough digits. That is, once the digits inside the buffer
+// represent 'w' we can stop. Everything inside the interval low - high
+// represents w. However we have to pay attention to low, high and w's
+// imprecision.
+static bool DigitGen(DiyFp low,
+ DiyFp w,
+ DiyFp high,
+ Vector<char> buffer,
+ int* length,
+ int* kappa) {
+ DOUBLE_CONVERSION_ASSERT(low.e() == w.e() && w.e() == high.e());
+ DOUBLE_CONVERSION_ASSERT(low.f() + 1 <= high.f() - 1);
+ DOUBLE_CONVERSION_ASSERT(kMinimalTargetExponent <= w.e() && w.e() <= kMaximalTargetExponent);
+ // low, w and high are imprecise, but by less than one ulp (unit in the last
+ // place).
+ // If we remove (resp. add) 1 ulp from low (resp. high) we are certain that
+ // the new numbers are outside of the interval we want the final
+ // representation to lie in.
+ // Inversely adding (resp. removing) 1 ulp from low (resp. high) would yield
+ // numbers that are certain to lie in the interval. We will use this fact
+ // later on.
+ // We will now start by generating the digits within the uncertain
+ // interval. Later we will weed out representations that lie outside the safe
+ // interval and thus _might_ lie outside the correct interval.
+ uint64_t unit = 1;
+ DiyFp too_low = DiyFp(low.f() - unit, low.e());
+ DiyFp too_high = DiyFp(high.f() + unit, high.e());
+ // too_low and too_high are guaranteed to lie outside the interval we want the
+ // generated number in.
+ DiyFp unsafe_interval = DiyFp::Minus(too_high, too_low);
+ // We now cut the input number into two parts: the integral digits and the
+ // fractionals. We will not write any decimal separator though, but adapt
+ // kappa instead.
+ // Reminder: we are currently computing the digits (stored inside the buffer)
+ // such that: too_low < buffer * 10^kappa < too_high
+ // We use too_high for the digit_generation and stop as soon as possible.
+ // If we stop early we effectively round down.
+ DiyFp one = DiyFp(static_cast<uint64_t>(1) << -w.e(), w.e());
+ // Division by one is a shift.
+ uint32_t integrals = static_cast<uint32_t>(too_high.f() >> -one.e());
+ // Modulo by one is an and.
+ uint64_t fractionals = too_high.f() & (one.f() - 1);
+ uint32_t divisor;
+ int divisor_exponent_plus_one;
+ BiggestPowerTen(integrals, DiyFp::kSignificandSize - (-one.e()),
+ &divisor, &divisor_exponent_plus_one);
+ *kappa = divisor_exponent_plus_one;
+ *length = 0;
+ // Loop invariant: buffer = too_high / 10^kappa (integer division)
+ // The invariant holds for the first iteration: kappa has been initialized
+ // with the divisor exponent + 1. And the divisor is the biggest power of ten
+ // that is smaller than integrals.
+ while (*kappa > 0) {
+ int digit = integrals / divisor;
+ DOUBLE_CONVERSION_ASSERT(digit <= 9);
+ buffer[*length] = static_cast<char>('0' + digit);
+ (*length)++;
+ integrals %= divisor;
+ (*kappa)--;
+ // Note that kappa now equals the exponent of the divisor and that the
+ // invariant thus holds again.
+ uint64_t rest =
+ (static_cast<uint64_t>(integrals) << -one.e()) + fractionals;
+ // Invariant: too_high = buffer * 10^kappa + DiyFp(rest, one.e())
+ // Reminder: unsafe_interval.e() == one.e()
+ if (rest < unsafe_interval.f()) {
+ // Rounding down (by not emitting the remaining digits) yields a number
+ // that lies within the unsafe interval.
+ return RoundWeed(buffer, *length, DiyFp::Minus(too_high, w).f(),
+ unsafe_interval.f(), rest,
+ static_cast<uint64_t>(divisor) << -one.e(), unit);
+ }
+ divisor /= 10;
+ }
+
+ // The integrals have been generated. We are at the point of the decimal
+ // separator. In the following loop we simply multiply the remaining digits by
+ // 10 and divide by one. We just need to pay attention to multiply associated
+ // data (like the interval or 'unit'), too.
+ // Note that the multiplication by 10 does not overflow, because w.e >= -60
+ // and thus one.e >= -60.
+ DOUBLE_CONVERSION_ASSERT(one.e() >= -60);
+ DOUBLE_CONVERSION_ASSERT(fractionals < one.f());
+ DOUBLE_CONVERSION_ASSERT(DOUBLE_CONVERSION_UINT64_2PART_C(0xFFFFFFFF, FFFFFFFF) / 10 >= one.f());
+ for (;;) {
+ fractionals *= 10;
+ unit *= 10;
+ unsafe_interval.set_f(unsafe_interval.f() * 10);
+ // Integer division by one.
+ int digit = static_cast<int>(fractionals >> -one.e());
+ DOUBLE_CONVERSION_ASSERT(digit <= 9);
+ buffer[*length] = static_cast<char>('0' + digit);
+ (*length)++;
+ fractionals &= one.f() - 1; // Modulo by one.
+ (*kappa)--;
+ if (fractionals < unsafe_interval.f()) {
+ return RoundWeed(buffer, *length, DiyFp::Minus(too_high, w).f() * unit,
+ unsafe_interval.f(), fractionals, one.f(), unit);
+ }
+ }
+}
+
+
+
+// Generates (at most) requested_digits digits of input number w.
+// w is a floating-point number (DiyFp), consisting of a significand and an
+// exponent. Its exponent is bounded by kMinimalTargetExponent and
+// kMaximalTargetExponent.
+// Hence -60 <= w.e() <= -32.
+//
+// Returns false if it fails, in which case the generated digits in the buffer
+// should not be used.
+// Preconditions:
+// * w is correct up to 1 ulp (unit in the last place). That
+// is, its error must be strictly less than a unit of its last digit.
+// * kMinimalTargetExponent <= w.e() <= kMaximalTargetExponent
+//
+// Postconditions: returns false if procedure fails.
+// otherwise:
+// * buffer is not null-terminated, but length contains the number of
+// digits.
+// * the representation in buffer is the most precise representation of
+// requested_digits digits.
+// * buffer contains at most requested_digits digits of w. If there are less
+// than requested_digits digits then some trailing '0's have been removed.
+// * kappa is such that
+// w = buffer * 10^kappa + eps with |eps| < 10^kappa / 2.
+//
+// Remark: This procedure takes into account the imprecision of its input
+// numbers. If the precision is not enough to guarantee all the postconditions
+// then false is returned. This usually happens rarely, but the failure-rate
+// increases with higher requested_digits.
+static bool DigitGenCounted(DiyFp w,
+ int requested_digits,
+ Vector<char> buffer,
+ int* length,
+ int* kappa) {
+ DOUBLE_CONVERSION_ASSERT(kMinimalTargetExponent <= w.e() && w.e() <= kMaximalTargetExponent);
+ DOUBLE_CONVERSION_ASSERT(kMinimalTargetExponent >= -60);
+ DOUBLE_CONVERSION_ASSERT(kMaximalTargetExponent <= -32);
+ // w is assumed to have an error less than 1 unit. Whenever w is scaled we
+ // also scale its error.
+ uint64_t w_error = 1;
+ // We cut the input number into two parts: the integral digits and the
+ // fractional digits. We don't emit any decimal separator, but adapt kappa
+ // instead. Example: instead of writing "1.2" we put "12" into the buffer and
+ // increase kappa by 1.
+ DiyFp one = DiyFp(static_cast<uint64_t>(1) << -w.e(), w.e());
+ // Division by one is a shift.
+ uint32_t integrals = static_cast<uint32_t>(w.f() >> -one.e());
+ // Modulo by one is an and.
+ uint64_t fractionals = w.f() & (one.f() - 1);
+ uint32_t divisor;
+ int divisor_exponent_plus_one;
+ BiggestPowerTen(integrals, DiyFp::kSignificandSize - (-one.e()),
+ &divisor, &divisor_exponent_plus_one);
+ *kappa = divisor_exponent_plus_one;
+ *length = 0;
+
+ // Loop invariant: buffer = w / 10^kappa (integer division)
+ // The invariant holds for the first iteration: kappa has been initialized
+ // with the divisor exponent + 1. And the divisor is the biggest power of ten
+ // that is smaller than 'integrals'.
+ while (*kappa > 0) {
+ int digit = integrals / divisor;
+ DOUBLE_CONVERSION_ASSERT(digit <= 9);
+ buffer[*length] = static_cast<char>('0' + digit);
+ (*length)++;
+ requested_digits--;
+ integrals %= divisor;
+ (*kappa)--;
+ // Note that kappa now equals the exponent of the divisor and that the
+ // invariant thus holds again.
+ if (requested_digits == 0) break;
+ divisor /= 10;
+ }
+
+ if (requested_digits == 0) {
+ uint64_t rest =
+ (static_cast<uint64_t>(integrals) << -one.e()) + fractionals;
+ return RoundWeedCounted(buffer, *length, rest,
+ static_cast<uint64_t>(divisor) << -one.e(), w_error,
+ kappa);
+ }
+
+ // The integrals have been generated. We are at the point of the decimal
+ // separator. In the following loop we simply multiply the remaining digits by
+ // 10 and divide by one. We just need to pay attention to multiply associated
+ // data (the 'unit'), too.
+ // Note that the multiplication by 10 does not overflow, because w.e >= -60
+ // and thus one.e >= -60.
+ DOUBLE_CONVERSION_ASSERT(one.e() >= -60);
+ DOUBLE_CONVERSION_ASSERT(fractionals < one.f());
+ DOUBLE_CONVERSION_ASSERT(DOUBLE_CONVERSION_UINT64_2PART_C(0xFFFFFFFF, FFFFFFFF) / 10 >= one.f());
+ while (requested_digits > 0 && fractionals > w_error) {
+ fractionals *= 10;
+ w_error *= 10;
+ // Integer division by one.
+ int digit = static_cast<int>(fractionals >> -one.e());
+ DOUBLE_CONVERSION_ASSERT(digit <= 9);
+ buffer[*length] = static_cast<char>('0' + digit);
+ (*length)++;
+ requested_digits--;
+ fractionals &= one.f() - 1; // Modulo by one.
+ (*kappa)--;
+ }
+ if (requested_digits != 0) return false;
+ return RoundWeedCounted(buffer, *length, fractionals, one.f(), w_error,
+ kappa);
+}
+
+
+// Provides a decimal representation of v.
+// Returns true if it succeeds, otherwise the result cannot be trusted.
+// There will be *length digits inside the buffer (not null-terminated).
+// If the function returns true then
+// v == (double) (buffer * 10^decimal_exponent).
+// The digits in the buffer are the shortest representation possible: no
+// 0.09999999999999999 instead of 0.1. The shorter representation will even be
+// chosen even if the longer one would be closer to v.
+// The last digit will be closest to the actual v. That is, even if several
+// digits might correctly yield 'v' when read again, the closest will be
+// computed.
+static bool Grisu3(double v,
+ FastDtoaMode mode,
+ Vector<char> buffer,
+ int* length,
+ int* decimal_exponent) {
+ DiyFp w = Double(v).AsNormalizedDiyFp();
+ // boundary_minus and boundary_plus are the boundaries between v and its
+ // closest floating-point neighbors. Any number strictly between
+ // boundary_minus and boundary_plus will round to v when convert to a double.
+ // Grisu3 will never output representations that lie exactly on a boundary.
+ DiyFp boundary_minus, boundary_plus;
+ if (mode == FAST_DTOA_SHORTEST) {
+ Double(v).NormalizedBoundaries(&boundary_minus, &boundary_plus);
+ } else {
+ DOUBLE_CONVERSION_ASSERT(mode == FAST_DTOA_SHORTEST_SINGLE);
+ float single_v = static_cast<float>(v);
+ Single(single_v).NormalizedBoundaries(&boundary_minus, &boundary_plus);
+ }
+ DOUBLE_CONVERSION_ASSERT(boundary_plus.e() == w.e());
+ DiyFp ten_mk; // Cached power of ten: 10^-k
+ int mk; // -k
+ int ten_mk_minimal_binary_exponent =
+ kMinimalTargetExponent - (w.e() + DiyFp::kSignificandSize);
+ int ten_mk_maximal_binary_exponent =
+ kMaximalTargetExponent - (w.e() + DiyFp::kSignificandSize);
+ PowersOfTenCache::GetCachedPowerForBinaryExponentRange(
+ ten_mk_minimal_binary_exponent,
+ ten_mk_maximal_binary_exponent,
+ &ten_mk, &mk);
+ DOUBLE_CONVERSION_ASSERT((kMinimalTargetExponent <= w.e() + ten_mk.e() +
+ DiyFp::kSignificandSize) &&
+ (kMaximalTargetExponent >= w.e() + ten_mk.e() +
+ DiyFp::kSignificandSize));
+ // Note that ten_mk is only an approximation of 10^-k. A DiyFp only contains a
+ // 64 bit significand and ten_mk is thus only precise up to 64 bits.
+
+ // The DiyFp::Times procedure rounds its result, and ten_mk is approximated
+ // too. The variable scaled_w (as well as scaled_boundary_minus/plus) are now
+ // off by a small amount.
+ // In fact: scaled_w - w*10^k < 1ulp (unit in the last place) of scaled_w.
+ // In other words: let f = scaled_w.f() and e = scaled_w.e(), then
+ // (f-1) * 2^e < w*10^k < (f+1) * 2^e
+ DiyFp scaled_w = DiyFp::Times(w, ten_mk);
+ DOUBLE_CONVERSION_ASSERT(scaled_w.e() ==
+ boundary_plus.e() + ten_mk.e() + DiyFp::kSignificandSize);
+ // In theory it would be possible to avoid some recomputations by computing
+ // the difference between w and boundary_minus/plus (a power of 2) and to
+ // compute scaled_boundary_minus/plus by subtracting/adding from
+ // scaled_w. However the code becomes much less readable and the speed
+ // enhancements are not terriffic.
+ DiyFp scaled_boundary_minus = DiyFp::Times(boundary_minus, ten_mk);
+ DiyFp scaled_boundary_plus = DiyFp::Times(boundary_plus, ten_mk);
+
+ // DigitGen will generate the digits of scaled_w. Therefore we have
+ // v == (double) (scaled_w * 10^-mk).
+ // Set decimal_exponent == -mk and pass it to DigitGen. If scaled_w is not an
+ // integer than it will be updated. For instance if scaled_w == 1.23 then
+ // the buffer will be filled with "123" und the decimal_exponent will be
+ // decreased by 2.
+ int kappa;
+ bool result = DigitGen(scaled_boundary_minus, scaled_w, scaled_boundary_plus,
+ buffer, length, &kappa);
+ *decimal_exponent = -mk + kappa;
+ return result;
+}
+
+
+// The "counted" version of grisu3 (see above) only generates requested_digits
+// number of digits. This version does not generate the shortest representation,
+// and with enough requested digits 0.1 will at some point print as 0.9999999...
+// Grisu3 is too imprecise for real halfway cases (1.5 will not work) and
+// therefore the rounding strategy for halfway cases is irrelevant.
+static bool Grisu3Counted(double v,
+ int requested_digits,
+ Vector<char> buffer,
+ int* length,
+ int* decimal_exponent) {
+ DiyFp w = Double(v).AsNormalizedDiyFp();
+ DiyFp ten_mk; // Cached power of ten: 10^-k
+ int mk; // -k
+ int ten_mk_minimal_binary_exponent =
+ kMinimalTargetExponent - (w.e() + DiyFp::kSignificandSize);
+ int ten_mk_maximal_binary_exponent =
+ kMaximalTargetExponent - (w.e() + DiyFp::kSignificandSize);
+ PowersOfTenCache::GetCachedPowerForBinaryExponentRange(
+ ten_mk_minimal_binary_exponent,
+ ten_mk_maximal_binary_exponent,
+ &ten_mk, &mk);
+ DOUBLE_CONVERSION_ASSERT((kMinimalTargetExponent <= w.e() + ten_mk.e() +
+ DiyFp::kSignificandSize) &&
+ (kMaximalTargetExponent >= w.e() + ten_mk.e() +
+ DiyFp::kSignificandSize));
+ // Note that ten_mk is only an approximation of 10^-k. A DiyFp only contains a
+ // 64 bit significand and ten_mk is thus only precise up to 64 bits.
+
+ // The DiyFp::Times procedure rounds its result, and ten_mk is approximated
+ // too. The variable scaled_w (as well as scaled_boundary_minus/plus) are now
+ // off by a small amount.
+ // In fact: scaled_w - w*10^k < 1ulp (unit in the last place) of scaled_w.
+ // In other words: let f = scaled_w.f() and e = scaled_w.e(), then
+ // (f-1) * 2^e < w*10^k < (f+1) * 2^e
+ DiyFp scaled_w = DiyFp::Times(w, ten_mk);
+
+ // We now have (double) (scaled_w * 10^-mk).
+ // DigitGen will generate the first requested_digits digits of scaled_w and
+ // return together with a kappa such that scaled_w ~= buffer * 10^kappa. (It
+ // will not always be exactly the same since DigitGenCounted only produces a
+ // limited number of digits.)
+ int kappa;
+ bool result = DigitGenCounted(scaled_w, requested_digits,
+ buffer, length, &kappa);
+ *decimal_exponent = -mk + kappa;
+ return result;
+}
+
+
+bool FastDtoa(double v,
+ FastDtoaMode mode,
+ int requested_digits,
+ Vector<char> buffer,
+ int* length,
+ int* decimal_point) {
+ DOUBLE_CONVERSION_ASSERT(v > 0);
+ DOUBLE_CONVERSION_ASSERT(!Double(v).IsSpecial());
+
+ bool result = false;
+ int decimal_exponent = 0;
+ switch (mode) {
+ case FAST_DTOA_SHORTEST:
+ case FAST_DTOA_SHORTEST_SINGLE:
+ result = Grisu3(v, mode, buffer, length, &decimal_exponent);
+ break;
+ case FAST_DTOA_PRECISION:
+ result = Grisu3Counted(v, requested_digits,
+ buffer, length, &decimal_exponent);
+ break;
+ default:
+ DOUBLE_CONVERSION_UNREACHABLE();
+ }
+ if (result) {
+ *decimal_point = *length + decimal_exponent;
+ buffer[*length] = '\0';
+ }
+ return result;
+}
+
+} // namespace double_conversion
+
+// ICU PATCH: Close ICU namespace
+U_NAMESPACE_END
+#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/double-conversion-fast-dtoa.h b/contrib/libs/icu/i18n/double-conversion-fast-dtoa.h
index f751f1122e..58a6470052 100644
--- a/contrib/libs/icu/i18n/double-conversion-fast-dtoa.h
+++ b/contrib/libs/icu/i18n/double-conversion-fast-dtoa.h
@@ -1,106 +1,106 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// From the double-conversion library. Original license:
-//
-// Copyright 2010 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.
-
-// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-#ifndef DOUBLE_CONVERSION_FAST_DTOA_H_
-#define DOUBLE_CONVERSION_FAST_DTOA_H_
-
-// ICU PATCH: Customize header file paths for ICU.
-
-#include "double-conversion-utils.h"
-
-// ICU PATCH: Wrap in ICU namespace
-U_NAMESPACE_BEGIN
-
-namespace double_conversion {
-
-enum FastDtoaMode {
- // Computes the shortest representation of the given input. The returned
- // result will be the most accurate number of this length. Longer
- // representations might be more accurate.
- FAST_DTOA_SHORTEST,
- // Same as FAST_DTOA_SHORTEST but for single-precision floats.
- FAST_DTOA_SHORTEST_SINGLE,
- // Computes a representation where the precision (number of digits) is
- // given as input. The precision is independent of the decimal point.
- FAST_DTOA_PRECISION
-};
-
-// FastDtoa will produce at most kFastDtoaMaximalLength digits. This does not
-// include the terminating '\0' character.
-static const int kFastDtoaMaximalLength = 17;
-// Same for single-precision numbers.
-static const int kFastDtoaMaximalSingleLength = 9;
-
-// Provides a decimal representation of v.
-// The result should be interpreted as buffer * 10^(point - length).
-//
-// Precondition:
-// * v must be a strictly positive finite double.
-//
-// Returns true if it succeeds, otherwise the result can not be trusted.
-// There will be *length digits inside the buffer followed by a null terminator.
-// If the function returns true and mode equals
-// - FAST_DTOA_SHORTEST, then
-// the parameter requested_digits is ignored.
-// The result satisfies
-// v == (double) (buffer * 10^(point - length)).
-// The digits in the buffer are the shortest representation possible. E.g.
-// if 0.099999999999 and 0.1 represent the same double then "1" is returned
-// with point = 0.
-// The last digit will be closest to the actual v. That is, even if several
-// digits might correctly yield 'v' when read again, the buffer will contain
-// the one closest to v.
-// - FAST_DTOA_PRECISION, then
-// the buffer contains requested_digits digits.
-// the difference v - (buffer * 10^(point-length)) is closest to zero for
-// all possible representations of requested_digits digits.
-// If there are two values that are equally close, then FastDtoa returns
-// false.
-// For both modes the buffer must be large enough to hold the result.
-bool FastDtoa(double d,
- FastDtoaMode mode,
- int requested_digits,
- Vector<char> buffer,
- int* length,
- int* decimal_point);
-
-} // namespace double_conversion
-
-// ICU PATCH: Close ICU namespace
-U_NAMESPACE_END
-
-#endif // DOUBLE_CONVERSION_FAST_DTOA_H_
-#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+//
+// From the double-conversion library. Original license:
+//
+// Copyright 2010 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.
+
+// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+#ifndef DOUBLE_CONVERSION_FAST_DTOA_H_
+#define DOUBLE_CONVERSION_FAST_DTOA_H_
+
+// ICU PATCH: Customize header file paths for ICU.
+
+#include "double-conversion-utils.h"
+
+// ICU PATCH: Wrap in ICU namespace
+U_NAMESPACE_BEGIN
+
+namespace double_conversion {
+
+enum FastDtoaMode {
+ // Computes the shortest representation of the given input. The returned
+ // result will be the most accurate number of this length. Longer
+ // representations might be more accurate.
+ FAST_DTOA_SHORTEST,
+ // Same as FAST_DTOA_SHORTEST but for single-precision floats.
+ FAST_DTOA_SHORTEST_SINGLE,
+ // Computes a representation where the precision (number of digits) is
+ // given as input. The precision is independent of the decimal point.
+ FAST_DTOA_PRECISION
+};
+
+// FastDtoa will produce at most kFastDtoaMaximalLength digits. This does not
+// include the terminating '\0' character.
+static const int kFastDtoaMaximalLength = 17;
+// Same for single-precision numbers.
+static const int kFastDtoaMaximalSingleLength = 9;
+
+// Provides a decimal representation of v.
+// The result should be interpreted as buffer * 10^(point - length).
+//
+// Precondition:
+// * v must be a strictly positive finite double.
+//
+// Returns true if it succeeds, otherwise the result can not be trusted.
+// There will be *length digits inside the buffer followed by a null terminator.
+// If the function returns true and mode equals
+// - FAST_DTOA_SHORTEST, then
+// the parameter requested_digits is ignored.
+// The result satisfies
+// v == (double) (buffer * 10^(point - length)).
+// The digits in the buffer are the shortest representation possible. E.g.
+// if 0.099999999999 and 0.1 represent the same double then "1" is returned
+// with point = 0.
+// The last digit will be closest to the actual v. That is, even if several
+// digits might correctly yield 'v' when read again, the buffer will contain
+// the one closest to v.
+// - FAST_DTOA_PRECISION, then
+// the buffer contains requested_digits digits.
+// the difference v - (buffer * 10^(point-length)) is closest to zero for
+// all possible representations of requested_digits digits.
+// If there are two values that are equally close, then FastDtoa returns
+// false.
+// For both modes the buffer must be large enough to hold the result.
+bool FastDtoa(double d,
+ FastDtoaMode mode,
+ int requested_digits,
+ Vector<char> buffer,
+ int* length,
+ int* decimal_point);
+
+} // namespace double_conversion
+
+// ICU PATCH: Close ICU namespace
+U_NAMESPACE_END
+
+#endif // DOUBLE_CONVERSION_FAST_DTOA_H_
+#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/double-conversion-ieee.h b/contrib/libs/icu/i18n/double-conversion-ieee.h
index 8cfe2e755a..31c35867de 100644
--- a/contrib/libs/icu/i18n/double-conversion-ieee.h
+++ b/contrib/libs/icu/i18n/double-conversion-ieee.h
@@ -1,440 +1,440 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// From the double-conversion library. Original license:
-//
-// Copyright 2012 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.
-
-// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-#ifndef DOUBLE_CONVERSION_DOUBLE_H_
-#define DOUBLE_CONVERSION_DOUBLE_H_
-
-// ICU PATCH: Customize header file paths for ICU.
-
-#include "double-conversion-diy-fp.h"
-
-// ICU PATCH: Wrap in ICU namespace
-U_NAMESPACE_BEGIN
-
-namespace double_conversion {
-
-// We assume that doubles and uint64_t have the same endianness.
-static uint64_t double_to_uint64(double d) { return BitCast<uint64_t>(d); }
-static double uint64_to_double(uint64_t d64) { return BitCast<double>(d64); }
-static uint32_t float_to_uint32(float f) { return BitCast<uint32_t>(f); }
-static float uint32_to_float(uint32_t d32) { return BitCast<float>(d32); }
-
-// Helper functions for doubles.
-class Double {
- public:
- static const uint64_t kSignMask = DOUBLE_CONVERSION_UINT64_2PART_C(0x80000000, 00000000);
- static const uint64_t kExponentMask = DOUBLE_CONVERSION_UINT64_2PART_C(0x7FF00000, 00000000);
- static const uint64_t kSignificandMask = DOUBLE_CONVERSION_UINT64_2PART_C(0x000FFFFF, FFFFFFFF);
- static const uint64_t kHiddenBit = DOUBLE_CONVERSION_UINT64_2PART_C(0x00100000, 00000000);
- static const uint64_t kQuietNanBit = DOUBLE_CONVERSION_UINT64_2PART_C(0x00080000, 00000000);
- static const int kPhysicalSignificandSize = 52; // Excludes the hidden bit.
- static const int kSignificandSize = 53;
- static const int kExponentBias = 0x3FF + kPhysicalSignificandSize;
- static const int kMaxExponent = 0x7FF - kExponentBias;
-
- Double() : d64_(0) {}
- explicit Double(double d) : d64_(double_to_uint64(d)) {}
- explicit Double(uint64_t d64) : d64_(d64) {}
- explicit Double(DiyFp diy_fp)
- : d64_(DiyFpToUint64(diy_fp)) {}
-
- // The value encoded by this Double must be greater or equal to +0.0.
- // It must not be special (infinity, or NaN).
- DiyFp AsDiyFp() const {
- DOUBLE_CONVERSION_ASSERT(Sign() > 0);
- DOUBLE_CONVERSION_ASSERT(!IsSpecial());
- return DiyFp(Significand(), Exponent());
- }
-
- // The value encoded by this Double must be strictly greater than 0.
- DiyFp AsNormalizedDiyFp() const {
- DOUBLE_CONVERSION_ASSERT(value() > 0.0);
- uint64_t f = Significand();
- int e = Exponent();
-
- // The current double could be a denormal.
- while ((f & kHiddenBit) == 0) {
- f <<= 1;
- e--;
- }
- // Do the final shifts in one go.
- f <<= DiyFp::kSignificandSize - kSignificandSize;
- e -= DiyFp::kSignificandSize - kSignificandSize;
- return DiyFp(f, e);
- }
-
- // Returns the double's bit as uint64.
- uint64_t AsUint64() const {
- return d64_;
- }
-
- // Returns the next greater double. Returns +infinity on input +infinity.
- double NextDouble() const {
- if (d64_ == kInfinity) return Double(kInfinity).value();
- if (Sign() < 0 && Significand() == 0) {
- // -0.0
- return 0.0;
- }
- if (Sign() < 0) {
- return Double(d64_ - 1).value();
- } else {
- return Double(d64_ + 1).value();
- }
- }
-
- double PreviousDouble() const {
- if (d64_ == (kInfinity | kSignMask)) return -Infinity();
- if (Sign() < 0) {
- return Double(d64_ + 1).value();
- } else {
- if (Significand() == 0) return -0.0;
- return Double(d64_ - 1).value();
- }
- }
-
- int Exponent() const {
- if (IsDenormal()) return kDenormalExponent;
-
- uint64_t d64 = AsUint64();
- int biased_e =
- static_cast<int>((d64 & kExponentMask) >> kPhysicalSignificandSize);
- return biased_e - kExponentBias;
- }
-
- uint64_t Significand() const {
- uint64_t d64 = AsUint64();
- uint64_t significand = d64 & kSignificandMask;
- if (!IsDenormal()) {
- return significand + kHiddenBit;
- } else {
- return significand;
- }
- }
-
- // Returns true if the double is a denormal.
- bool IsDenormal() const {
- uint64_t d64 = AsUint64();
- return (d64 & kExponentMask) == 0;
- }
-
- // We consider denormals not to be special.
- // Hence only Infinity and NaN are special.
- bool IsSpecial() const {
- uint64_t d64 = AsUint64();
- return (d64 & kExponentMask) == kExponentMask;
- }
-
- bool IsNan() const {
- uint64_t d64 = AsUint64();
- return ((d64 & kExponentMask) == kExponentMask) &&
- ((d64 & kSignificandMask) != 0);
- }
-
- bool IsQuietNan() const {
- return IsNan() && ((AsUint64() & kQuietNanBit) != 0);
- }
-
- bool IsSignalingNan() const {
- return IsNan() && ((AsUint64() & kQuietNanBit) == 0);
- }
-
-
- bool IsInfinite() const {
- uint64_t d64 = AsUint64();
- return ((d64 & kExponentMask) == kExponentMask) &&
- ((d64 & kSignificandMask) == 0);
- }
-
- int Sign() const {
- uint64_t d64 = AsUint64();
- return (d64 & kSignMask) == 0? 1: -1;
- }
-
- // Precondition: the value encoded by this Double must be greater or equal
- // than +0.0.
- DiyFp UpperBoundary() const {
- DOUBLE_CONVERSION_ASSERT(Sign() > 0);
- return DiyFp(Significand() * 2 + 1, Exponent() - 1);
- }
-
- // Computes the two boundaries of this.
- // The bigger boundary (m_plus) is normalized. The lower boundary has the same
- // exponent as m_plus.
- // Precondition: the value encoded by this Double must be greater than 0.
- void NormalizedBoundaries(DiyFp* out_m_minus, DiyFp* out_m_plus) const {
- DOUBLE_CONVERSION_ASSERT(value() > 0.0);
- DiyFp v = this->AsDiyFp();
- DiyFp m_plus = DiyFp::Normalize(DiyFp((v.f() << 1) + 1, v.e() - 1));
- DiyFp m_minus;
- if (LowerBoundaryIsCloser()) {
- m_minus = DiyFp((v.f() << 2) - 1, v.e() - 2);
- } else {
- m_minus = DiyFp((v.f() << 1) - 1, v.e() - 1);
- }
- m_minus.set_f(m_minus.f() << (m_minus.e() - m_plus.e()));
- m_minus.set_e(m_plus.e());
- *out_m_plus = m_plus;
- *out_m_minus = m_minus;
- }
-
- bool LowerBoundaryIsCloser() const {
- // The boundary is closer if the significand is of the form f == 2^p-1 then
- // the lower boundary is closer.
- // Think of v = 1000e10 and v- = 9999e9.
- // Then the boundary (== (v - v-)/2) is not just at a distance of 1e9 but
- // at a distance of 1e8.
- // The only exception is for the smallest normal: the largest denormal is
- // at the same distance as its successor.
- // Note: denormals have the same exponent as the smallest normals.
- bool physical_significand_is_zero = ((AsUint64() & kSignificandMask) == 0);
- return physical_significand_is_zero && (Exponent() != kDenormalExponent);
- }
-
- double value() const { return uint64_to_double(d64_); }
-
- // Returns the significand size for a given order of magnitude.
- // If v = f*2^e with 2^p-1 <= f <= 2^p then p+e is v's order of magnitude.
- // This function returns the number of significant binary digits v will have
- // once it's encoded into a double. In almost all cases this is equal to
- // kSignificandSize. The only exceptions are denormals. They start with
- // leading zeroes and their effective significand-size is hence smaller.
- static int SignificandSizeForOrderOfMagnitude(int order) {
- if (order >= (kDenormalExponent + kSignificandSize)) {
- return kSignificandSize;
- }
- if (order <= kDenormalExponent) return 0;
- return order - kDenormalExponent;
- }
-
- static double Infinity() {
- return Double(kInfinity).value();
- }
-
- static double NaN() {
- return Double(kNaN).value();
- }
-
- private:
- static const int kDenormalExponent = -kExponentBias + 1;
- static const uint64_t kInfinity = DOUBLE_CONVERSION_UINT64_2PART_C(0x7FF00000, 00000000);
- static const uint64_t kNaN = DOUBLE_CONVERSION_UINT64_2PART_C(0x7FF80000, 00000000);
-
- const uint64_t d64_;
-
- static uint64_t DiyFpToUint64(DiyFp diy_fp) {
- uint64_t significand = diy_fp.f();
- int exponent = diy_fp.e();
- while (significand > kHiddenBit + kSignificandMask) {
- significand >>= 1;
- exponent++;
- }
- if (exponent >= kMaxExponent) {
- return kInfinity;
- }
- if (exponent < kDenormalExponent) {
- return 0;
- }
- while (exponent > kDenormalExponent && (significand & kHiddenBit) == 0) {
- significand <<= 1;
- exponent--;
- }
- uint64_t biased_exponent;
- if (exponent == kDenormalExponent && (significand & kHiddenBit) == 0) {
- biased_exponent = 0;
- } else {
- biased_exponent = static_cast<uint64_t>(exponent + kExponentBias);
- }
- return (significand & kSignificandMask) |
- (biased_exponent << kPhysicalSignificandSize);
- }
-
- DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN(Double);
-};
-
-class Single {
- public:
- static const uint32_t kSignMask = 0x80000000;
- static const uint32_t kExponentMask = 0x7F800000;
- static const uint32_t kSignificandMask = 0x007FFFFF;
- static const uint32_t kHiddenBit = 0x00800000;
- static const uint32_t kQuietNanBit = 0x00400000;
- static const int kPhysicalSignificandSize = 23; // Excludes the hidden bit.
- static const int kSignificandSize = 24;
-
- Single() : d32_(0) {}
- explicit Single(float f) : d32_(float_to_uint32(f)) {}
- explicit Single(uint32_t d32) : d32_(d32) {}
-
- // The value encoded by this Single must be greater or equal to +0.0.
- // It must not be special (infinity, or NaN).
- DiyFp AsDiyFp() const {
- DOUBLE_CONVERSION_ASSERT(Sign() > 0);
- DOUBLE_CONVERSION_ASSERT(!IsSpecial());
- return DiyFp(Significand(), Exponent());
- }
-
- // Returns the single's bit as uint64.
- uint32_t AsUint32() const {
- return d32_;
- }
-
- int Exponent() const {
- if (IsDenormal()) return kDenormalExponent;
-
- uint32_t d32 = AsUint32();
- int biased_e =
- static_cast<int>((d32 & kExponentMask) >> kPhysicalSignificandSize);
- return biased_e - kExponentBias;
- }
-
- uint32_t Significand() const {
- uint32_t d32 = AsUint32();
- uint32_t significand = d32 & kSignificandMask;
- if (!IsDenormal()) {
- return significand + kHiddenBit;
- } else {
- return significand;
- }
- }
-
- // Returns true if the single is a denormal.
- bool IsDenormal() const {
- uint32_t d32 = AsUint32();
- return (d32 & kExponentMask) == 0;
- }
-
- // We consider denormals not to be special.
- // Hence only Infinity and NaN are special.
- bool IsSpecial() const {
- uint32_t d32 = AsUint32();
- return (d32 & kExponentMask) == kExponentMask;
- }
-
- bool IsNan() const {
- uint32_t d32 = AsUint32();
- return ((d32 & kExponentMask) == kExponentMask) &&
- ((d32 & kSignificandMask) != 0);
- }
-
- bool IsQuietNan() const {
- return IsNan() && ((AsUint32() & kQuietNanBit) != 0);
- }
-
- bool IsSignalingNan() const {
- return IsNan() && ((AsUint32() & kQuietNanBit) == 0);
- }
-
-
- bool IsInfinite() const {
- uint32_t d32 = AsUint32();
- return ((d32 & kExponentMask) == kExponentMask) &&
- ((d32 & kSignificandMask) == 0);
- }
-
- int Sign() const {
- uint32_t d32 = AsUint32();
- return (d32 & kSignMask) == 0? 1: -1;
- }
-
- // Computes the two boundaries of this.
- // The bigger boundary (m_plus) is normalized. The lower boundary has the same
- // exponent as m_plus.
- // Precondition: the value encoded by this Single must be greater than 0.
- void NormalizedBoundaries(DiyFp* out_m_minus, DiyFp* out_m_plus) const {
- DOUBLE_CONVERSION_ASSERT(value() > 0.0);
- DiyFp v = this->AsDiyFp();
- DiyFp m_plus = DiyFp::Normalize(DiyFp((v.f() << 1) + 1, v.e() - 1));
- DiyFp m_minus;
- if (LowerBoundaryIsCloser()) {
- m_minus = DiyFp((v.f() << 2) - 1, v.e() - 2);
- } else {
- m_minus = DiyFp((v.f() << 1) - 1, v.e() - 1);
- }
- m_minus.set_f(m_minus.f() << (m_minus.e() - m_plus.e()));
- m_minus.set_e(m_plus.e());
- *out_m_plus = m_plus;
- *out_m_minus = m_minus;
- }
-
- // Precondition: the value encoded by this Single must be greater or equal
- // than +0.0.
- DiyFp UpperBoundary() const {
- DOUBLE_CONVERSION_ASSERT(Sign() > 0);
- return DiyFp(Significand() * 2 + 1, Exponent() - 1);
- }
-
- bool LowerBoundaryIsCloser() const {
- // The boundary is closer if the significand is of the form f == 2^p-1 then
- // the lower boundary is closer.
- // Think of v = 1000e10 and v- = 9999e9.
- // Then the boundary (== (v - v-)/2) is not just at a distance of 1e9 but
- // at a distance of 1e8.
- // The only exception is for the smallest normal: the largest denormal is
- // at the same distance as its successor.
- // Note: denormals have the same exponent as the smallest normals.
- bool physical_significand_is_zero = ((AsUint32() & kSignificandMask) == 0);
- return physical_significand_is_zero && (Exponent() != kDenormalExponent);
- }
-
- float value() const { return uint32_to_float(d32_); }
-
- static float Infinity() {
- return Single(kInfinity).value();
- }
-
- static float NaN() {
- return Single(kNaN).value();
- }
-
- private:
- static const int kExponentBias = 0x7F + kPhysicalSignificandSize;
- static const int kDenormalExponent = -kExponentBias + 1;
- static const int kMaxExponent = 0xFF - kExponentBias;
- static const uint32_t kInfinity = 0x7F800000;
- static const uint32_t kNaN = 0x7FC00000;
-
- const uint32_t d32_;
-
- DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN(Single);
-};
-
-} // namespace double_conversion
-
-// ICU PATCH: Close ICU namespace
-U_NAMESPACE_END
-
-#endif // DOUBLE_CONVERSION_DOUBLE_H_
-#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+//
+// From the double-conversion library. Original license:
+//
+// Copyright 2012 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.
+
+// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+#ifndef DOUBLE_CONVERSION_DOUBLE_H_
+#define DOUBLE_CONVERSION_DOUBLE_H_
+
+// ICU PATCH: Customize header file paths for ICU.
+
+#include "double-conversion-diy-fp.h"
+
+// ICU PATCH: Wrap in ICU namespace
+U_NAMESPACE_BEGIN
+
+namespace double_conversion {
+
+// We assume that doubles and uint64_t have the same endianness.
+static uint64_t double_to_uint64(double d) { return BitCast<uint64_t>(d); }
+static double uint64_to_double(uint64_t d64) { return BitCast<double>(d64); }
+static uint32_t float_to_uint32(float f) { return BitCast<uint32_t>(f); }
+static float uint32_to_float(uint32_t d32) { return BitCast<float>(d32); }
+
+// Helper functions for doubles.
+class Double {
+ public:
+ static const uint64_t kSignMask = DOUBLE_CONVERSION_UINT64_2PART_C(0x80000000, 00000000);
+ static const uint64_t kExponentMask = DOUBLE_CONVERSION_UINT64_2PART_C(0x7FF00000, 00000000);
+ static const uint64_t kSignificandMask = DOUBLE_CONVERSION_UINT64_2PART_C(0x000FFFFF, FFFFFFFF);
+ static const uint64_t kHiddenBit = DOUBLE_CONVERSION_UINT64_2PART_C(0x00100000, 00000000);
+ static const uint64_t kQuietNanBit = DOUBLE_CONVERSION_UINT64_2PART_C(0x00080000, 00000000);
+ static const int kPhysicalSignificandSize = 52; // Excludes the hidden bit.
+ static const int kSignificandSize = 53;
+ static const int kExponentBias = 0x3FF + kPhysicalSignificandSize;
+ static const int kMaxExponent = 0x7FF - kExponentBias;
+
+ Double() : d64_(0) {}
+ explicit Double(double d) : d64_(double_to_uint64(d)) {}
+ explicit Double(uint64_t d64) : d64_(d64) {}
+ explicit Double(DiyFp diy_fp)
+ : d64_(DiyFpToUint64(diy_fp)) {}
+
+ // The value encoded by this Double must be greater or equal to +0.0.
+ // It must not be special (infinity, or NaN).
+ DiyFp AsDiyFp() const {
+ DOUBLE_CONVERSION_ASSERT(Sign() > 0);
+ DOUBLE_CONVERSION_ASSERT(!IsSpecial());
+ return DiyFp(Significand(), Exponent());
+ }
+
+ // The value encoded by this Double must be strictly greater than 0.
+ DiyFp AsNormalizedDiyFp() const {
+ DOUBLE_CONVERSION_ASSERT(value() > 0.0);
+ uint64_t f = Significand();
+ int e = Exponent();
+
+ // The current double could be a denormal.
+ while ((f & kHiddenBit) == 0) {
+ f <<= 1;
+ e--;
+ }
+ // Do the final shifts in one go.
+ f <<= DiyFp::kSignificandSize - kSignificandSize;
+ e -= DiyFp::kSignificandSize - kSignificandSize;
+ return DiyFp(f, e);
+ }
+
+ // Returns the double's bit as uint64.
+ uint64_t AsUint64() const {
+ return d64_;
+ }
+
+ // Returns the next greater double. Returns +infinity on input +infinity.
+ double NextDouble() const {
+ if (d64_ == kInfinity) return Double(kInfinity).value();
+ if (Sign() < 0 && Significand() == 0) {
+ // -0.0
+ return 0.0;
+ }
+ if (Sign() < 0) {
+ return Double(d64_ - 1).value();
+ } else {
+ return Double(d64_ + 1).value();
+ }
+ }
+
+ double PreviousDouble() const {
+ if (d64_ == (kInfinity | kSignMask)) return -Infinity();
+ if (Sign() < 0) {
+ return Double(d64_ + 1).value();
+ } else {
+ if (Significand() == 0) return -0.0;
+ return Double(d64_ - 1).value();
+ }
+ }
+
+ int Exponent() const {
+ if (IsDenormal()) return kDenormalExponent;
+
+ uint64_t d64 = AsUint64();
+ int biased_e =
+ static_cast<int>((d64 & kExponentMask) >> kPhysicalSignificandSize);
+ return biased_e - kExponentBias;
+ }
+
+ uint64_t Significand() const {
+ uint64_t d64 = AsUint64();
+ uint64_t significand = d64 & kSignificandMask;
+ if (!IsDenormal()) {
+ return significand + kHiddenBit;
+ } else {
+ return significand;
+ }
+ }
+
+ // Returns true if the double is a denormal.
+ bool IsDenormal() const {
+ uint64_t d64 = AsUint64();
+ return (d64 & kExponentMask) == 0;
+ }
+
+ // We consider denormals not to be special.
+ // Hence only Infinity and NaN are special.
+ bool IsSpecial() const {
+ uint64_t d64 = AsUint64();
+ return (d64 & kExponentMask) == kExponentMask;
+ }
+
+ bool IsNan() const {
+ uint64_t d64 = AsUint64();
+ return ((d64 & kExponentMask) == kExponentMask) &&
+ ((d64 & kSignificandMask) != 0);
+ }
+
+ bool IsQuietNan() const {
+ return IsNan() && ((AsUint64() & kQuietNanBit) != 0);
+ }
+
+ bool IsSignalingNan() const {
+ return IsNan() && ((AsUint64() & kQuietNanBit) == 0);
+ }
+
+
+ bool IsInfinite() const {
+ uint64_t d64 = AsUint64();
+ return ((d64 & kExponentMask) == kExponentMask) &&
+ ((d64 & kSignificandMask) == 0);
+ }
+
+ int Sign() const {
+ uint64_t d64 = AsUint64();
+ return (d64 & kSignMask) == 0? 1: -1;
+ }
+
+ // Precondition: the value encoded by this Double must be greater or equal
+ // than +0.0.
+ DiyFp UpperBoundary() const {
+ DOUBLE_CONVERSION_ASSERT(Sign() > 0);
+ return DiyFp(Significand() * 2 + 1, Exponent() - 1);
+ }
+
+ // Computes the two boundaries of this.
+ // The bigger boundary (m_plus) is normalized. The lower boundary has the same
+ // exponent as m_plus.
+ // Precondition: the value encoded by this Double must be greater than 0.
+ void NormalizedBoundaries(DiyFp* out_m_minus, DiyFp* out_m_plus) const {
+ DOUBLE_CONVERSION_ASSERT(value() > 0.0);
+ DiyFp v = this->AsDiyFp();
+ DiyFp m_plus = DiyFp::Normalize(DiyFp((v.f() << 1) + 1, v.e() - 1));
+ DiyFp m_minus;
+ if (LowerBoundaryIsCloser()) {
+ m_minus = DiyFp((v.f() << 2) - 1, v.e() - 2);
+ } else {
+ m_minus = DiyFp((v.f() << 1) - 1, v.e() - 1);
+ }
+ m_minus.set_f(m_minus.f() << (m_minus.e() - m_plus.e()));
+ m_minus.set_e(m_plus.e());
+ *out_m_plus = m_plus;
+ *out_m_minus = m_minus;
+ }
+
+ bool LowerBoundaryIsCloser() const {
+ // The boundary is closer if the significand is of the form f == 2^p-1 then
+ // the lower boundary is closer.
+ // Think of v = 1000e10 and v- = 9999e9.
+ // Then the boundary (== (v - v-)/2) is not just at a distance of 1e9 but
+ // at a distance of 1e8.
+ // The only exception is for the smallest normal: the largest denormal is
+ // at the same distance as its successor.
+ // Note: denormals have the same exponent as the smallest normals.
+ bool physical_significand_is_zero = ((AsUint64() & kSignificandMask) == 0);
+ return physical_significand_is_zero && (Exponent() != kDenormalExponent);
+ }
+
+ double value() const { return uint64_to_double(d64_); }
+
+ // Returns the significand size for a given order of magnitude.
+ // If v = f*2^e with 2^p-1 <= f <= 2^p then p+e is v's order of magnitude.
+ // This function returns the number of significant binary digits v will have
+ // once it's encoded into a double. In almost all cases this is equal to
+ // kSignificandSize. The only exceptions are denormals. They start with
+ // leading zeroes and their effective significand-size is hence smaller.
+ static int SignificandSizeForOrderOfMagnitude(int order) {
+ if (order >= (kDenormalExponent + kSignificandSize)) {
+ return kSignificandSize;
+ }
+ if (order <= kDenormalExponent) return 0;
+ return order - kDenormalExponent;
+ }
+
+ static double Infinity() {
+ return Double(kInfinity).value();
+ }
+
+ static double NaN() {
+ return Double(kNaN).value();
+ }
+
+ private:
+ static const int kDenormalExponent = -kExponentBias + 1;
+ static const uint64_t kInfinity = DOUBLE_CONVERSION_UINT64_2PART_C(0x7FF00000, 00000000);
+ static const uint64_t kNaN = DOUBLE_CONVERSION_UINT64_2PART_C(0x7FF80000, 00000000);
+
+ const uint64_t d64_;
+
+ static uint64_t DiyFpToUint64(DiyFp diy_fp) {
+ uint64_t significand = diy_fp.f();
+ int exponent = diy_fp.e();
+ while (significand > kHiddenBit + kSignificandMask) {
+ significand >>= 1;
+ exponent++;
+ }
+ if (exponent >= kMaxExponent) {
+ return kInfinity;
+ }
+ if (exponent < kDenormalExponent) {
+ return 0;
+ }
+ while (exponent > kDenormalExponent && (significand & kHiddenBit) == 0) {
+ significand <<= 1;
+ exponent--;
+ }
+ uint64_t biased_exponent;
+ if (exponent == kDenormalExponent && (significand & kHiddenBit) == 0) {
+ biased_exponent = 0;
+ } else {
+ biased_exponent = static_cast<uint64_t>(exponent + kExponentBias);
+ }
+ return (significand & kSignificandMask) |
+ (biased_exponent << kPhysicalSignificandSize);
+ }
+
+ DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN(Double);
+};
+
+class Single {
+ public:
+ static const uint32_t kSignMask = 0x80000000;
+ static const uint32_t kExponentMask = 0x7F800000;
+ static const uint32_t kSignificandMask = 0x007FFFFF;
+ static const uint32_t kHiddenBit = 0x00800000;
+ static const uint32_t kQuietNanBit = 0x00400000;
+ static const int kPhysicalSignificandSize = 23; // Excludes the hidden bit.
+ static const int kSignificandSize = 24;
+
+ Single() : d32_(0) {}
+ explicit Single(float f) : d32_(float_to_uint32(f)) {}
+ explicit Single(uint32_t d32) : d32_(d32) {}
+
+ // The value encoded by this Single must be greater or equal to +0.0.
+ // It must not be special (infinity, or NaN).
+ DiyFp AsDiyFp() const {
+ DOUBLE_CONVERSION_ASSERT(Sign() > 0);
+ DOUBLE_CONVERSION_ASSERT(!IsSpecial());
+ return DiyFp(Significand(), Exponent());
+ }
+
+ // Returns the single's bit as uint64.
+ uint32_t AsUint32() const {
+ return d32_;
+ }
+
+ int Exponent() const {
+ if (IsDenormal()) return kDenormalExponent;
+
+ uint32_t d32 = AsUint32();
+ int biased_e =
+ static_cast<int>((d32 & kExponentMask) >> kPhysicalSignificandSize);
+ return biased_e - kExponentBias;
+ }
+
+ uint32_t Significand() const {
+ uint32_t d32 = AsUint32();
+ uint32_t significand = d32 & kSignificandMask;
+ if (!IsDenormal()) {
+ return significand + kHiddenBit;
+ } else {
+ return significand;
+ }
+ }
+
+ // Returns true if the single is a denormal.
+ bool IsDenormal() const {
+ uint32_t d32 = AsUint32();
+ return (d32 & kExponentMask) == 0;
+ }
+
+ // We consider denormals not to be special.
+ // Hence only Infinity and NaN are special.
+ bool IsSpecial() const {
+ uint32_t d32 = AsUint32();
+ return (d32 & kExponentMask) == kExponentMask;
+ }
+
+ bool IsNan() const {
+ uint32_t d32 = AsUint32();
+ return ((d32 & kExponentMask) == kExponentMask) &&
+ ((d32 & kSignificandMask) != 0);
+ }
+
+ bool IsQuietNan() const {
+ return IsNan() && ((AsUint32() & kQuietNanBit) != 0);
+ }
+
+ bool IsSignalingNan() const {
+ return IsNan() && ((AsUint32() & kQuietNanBit) == 0);
+ }
+
+
+ bool IsInfinite() const {
+ uint32_t d32 = AsUint32();
+ return ((d32 & kExponentMask) == kExponentMask) &&
+ ((d32 & kSignificandMask) == 0);
+ }
+
+ int Sign() const {
+ uint32_t d32 = AsUint32();
+ return (d32 & kSignMask) == 0? 1: -1;
+ }
+
+ // Computes the two boundaries of this.
+ // The bigger boundary (m_plus) is normalized. The lower boundary has the same
+ // exponent as m_plus.
+ // Precondition: the value encoded by this Single must be greater than 0.
+ void NormalizedBoundaries(DiyFp* out_m_minus, DiyFp* out_m_plus) const {
+ DOUBLE_CONVERSION_ASSERT(value() > 0.0);
+ DiyFp v = this->AsDiyFp();
+ DiyFp m_plus = DiyFp::Normalize(DiyFp((v.f() << 1) + 1, v.e() - 1));
+ DiyFp m_minus;
+ if (LowerBoundaryIsCloser()) {
+ m_minus = DiyFp((v.f() << 2) - 1, v.e() - 2);
+ } else {
+ m_minus = DiyFp((v.f() << 1) - 1, v.e() - 1);
+ }
+ m_minus.set_f(m_minus.f() << (m_minus.e() - m_plus.e()));
+ m_minus.set_e(m_plus.e());
+ *out_m_plus = m_plus;
+ *out_m_minus = m_minus;
+ }
+
+ // Precondition: the value encoded by this Single must be greater or equal
+ // than +0.0.
+ DiyFp UpperBoundary() const {
+ DOUBLE_CONVERSION_ASSERT(Sign() > 0);
+ return DiyFp(Significand() * 2 + 1, Exponent() - 1);
+ }
+
+ bool LowerBoundaryIsCloser() const {
+ // The boundary is closer if the significand is of the form f == 2^p-1 then
+ // the lower boundary is closer.
+ // Think of v = 1000e10 and v- = 9999e9.
+ // Then the boundary (== (v - v-)/2) is not just at a distance of 1e9 but
+ // at a distance of 1e8.
+ // The only exception is for the smallest normal: the largest denormal is
+ // at the same distance as its successor.
+ // Note: denormals have the same exponent as the smallest normals.
+ bool physical_significand_is_zero = ((AsUint32() & kSignificandMask) == 0);
+ return physical_significand_is_zero && (Exponent() != kDenormalExponent);
+ }
+
+ float value() const { return uint32_to_float(d32_); }
+
+ static float Infinity() {
+ return Single(kInfinity).value();
+ }
+
+ static float NaN() {
+ return Single(kNaN).value();
+ }
+
+ private:
+ static const int kExponentBias = 0x7F + kPhysicalSignificandSize;
+ static const int kDenormalExponent = -kExponentBias + 1;
+ static const int kMaxExponent = 0xFF - kExponentBias;
+ static const uint32_t kInfinity = 0x7F800000;
+ static const uint32_t kNaN = 0x7FC00000;
+
+ const uint32_t d32_;
+
+ DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN(Single);
+};
+
+} // namespace double_conversion
+
+// ICU PATCH: Close ICU namespace
+U_NAMESPACE_END
+
+#endif // DOUBLE_CONVERSION_DOUBLE_H_
+#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/double-conversion-string-to-double.cpp b/contrib/libs/icu/i18n/double-conversion-string-to-double.cpp
index 232b61f4f8..548cad1f30 100644
--- a/contrib/libs/icu/i18n/double-conversion-string-to-double.cpp
+++ b/contrib/libs/icu/i18n/double-conversion-string-to-double.cpp
@@ -1,789 +1,789 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// From the double-conversion library. Original license:
-//
-// Copyright 2010 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.
-
-// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-// ICU PATCH: Do not include std::locale.
-
-#include <climits>
-// #include <locale>
-#include <cmath>
-
-// ICU PATCH: Customize header file paths for ICU.
-
-#include "double-conversion-string-to-double.h"
-
-#include "double-conversion-ieee.h"
-#include "double-conversion-strtod.h"
-#include "double-conversion-utils.h"
-
-// ICU PATCH: Wrap in ICU namespace
-U_NAMESPACE_BEGIN
-
-namespace double_conversion {
-
-namespace {
-
-inline char ToLower(char ch) {
-#if 0 // do not include std::locale in ICU
- static const std::ctype<char>& cType =
- std::use_facet<std::ctype<char> >(std::locale::classic());
- return cType.tolower(ch);
-#else
- (void)ch;
- DOUBLE_CONVERSION_UNREACHABLE();
-#endif
-}
-
-inline char Pass(char ch) {
- return ch;
-}
-
-template <class Iterator, class Converter>
-static inline bool ConsumeSubStringImpl(Iterator* current,
- Iterator end,
- const char* substring,
- Converter converter) {
- DOUBLE_CONVERSION_ASSERT(converter(**current) == *substring);
- for (substring++; *substring != '\0'; substring++) {
- ++*current;
- if (*current == end || converter(**current) != *substring) {
- return false;
- }
- }
- ++*current;
- return true;
-}
-
-// Consumes the given substring from the iterator.
-// Returns false, if the substring does not match.
-template <class Iterator>
-static bool ConsumeSubString(Iterator* current,
- Iterator end,
- const char* substring,
- bool allow_case_insensitivity) {
- if (allow_case_insensitivity) {
- return ConsumeSubStringImpl(current, end, substring, ToLower);
- } else {
- return ConsumeSubStringImpl(current, end, substring, Pass);
- }
-}
-
-// Consumes first character of the str is equal to ch
-inline bool ConsumeFirstCharacter(char ch,
- const char* str,
- bool case_insensitivity) {
- return case_insensitivity ? ToLower(ch) == str[0] : ch == str[0];
-}
-} // namespace
-
-// Maximum number of significant digits in decimal representation.
-// The longest possible double in decimal representation is
-// (2^53 - 1) * 2 ^ -1074 that is (2 ^ 53 - 1) * 5 ^ 1074 / 10 ^ 1074
-// (768 digits). If we parse a number whose first digits are equal to a
-// mean of 2 adjacent doubles (that could have up to 769 digits) the result
-// must be rounded to the bigger one unless the tail consists of zeros, so
-// we don't need to preserve all the digits.
-const int kMaxSignificantDigits = 772;
-
-
-static const char kWhitespaceTable7[] = { 32, 13, 10, 9, 11, 12 };
-static const int kWhitespaceTable7Length = DOUBLE_CONVERSION_ARRAY_SIZE(kWhitespaceTable7);
-
-
-static const uc16 kWhitespaceTable16[] = {
- 160, 8232, 8233, 5760, 6158, 8192, 8193, 8194, 8195,
- 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279
-};
-static const int kWhitespaceTable16Length = DOUBLE_CONVERSION_ARRAY_SIZE(kWhitespaceTable16);
-
-
-static bool isWhitespace(int x) {
- if (x < 128) {
- for (int i = 0; i < kWhitespaceTable7Length; i++) {
- if (kWhitespaceTable7[i] == x) return true;
- }
- } else {
- for (int i = 0; i < kWhitespaceTable16Length; i++) {
- if (kWhitespaceTable16[i] == x) return true;
- }
- }
- return false;
-}
-
-
-// Returns true if a nonspace found and false if the end has reached.
-template <class Iterator>
-static inline bool AdvanceToNonspace(Iterator* current, Iterator end) {
- while (*current != end) {
- if (!isWhitespace(**current)) return true;
- ++*current;
- }
- return false;
-}
-
-
-static bool isDigit(int x, int radix) {
- return (x >= '0' && x <= '9' && x < '0' + radix)
- || (radix > 10 && x >= 'a' && x < 'a' + radix - 10)
- || (radix > 10 && x >= 'A' && x < 'A' + radix - 10);
-}
-
-
-static double SignedZero(bool sign) {
- return sign ? -0.0 : 0.0;
-}
-
-
-// Returns true if 'c' is a decimal digit that is valid for the given radix.
-//
-// The function is small and could be inlined, but VS2012 emitted a warning
-// because it constant-propagated the radix and concluded that the last
-// condition was always true. By moving it into a separate function the
-// compiler wouldn't warn anymore.
-#ifdef _MSC_VER
-#pragma optimize("",off)
-static bool IsDecimalDigitForRadix(int c, int radix) {
- return '0' <= c && c <= '9' && (c - '0') < radix;
-}
-#pragma optimize("",on)
-#else
-static bool inline IsDecimalDigitForRadix(int c, int radix) {
- return '0' <= c && c <= '9' && (c - '0') < radix;
-}
-#endif
-// Returns true if 'c' is a character digit that is valid for the given radix.
-// The 'a_character' should be 'a' or 'A'.
-//
-// The function is small and could be inlined, but VS2012 emitted a warning
-// because it constant-propagated the radix and concluded that the first
-// condition was always false. By moving it into a separate function the
-// compiler wouldn't warn anymore.
-static bool IsCharacterDigitForRadix(int c, int radix, char a_character) {
- return radix > 10 && c >= a_character && c < a_character + radix - 10;
-}
-
-// Returns true, when the iterator is equal to end.
-template<class Iterator>
-static bool Advance (Iterator* it, uc16 separator, int base, Iterator& end) {
- if (separator == StringToDoubleConverter::kNoSeparator) {
- ++(*it);
- return *it == end;
- }
- if (!isDigit(**it, base)) {
- ++(*it);
- return *it == end;
- }
- ++(*it);
- if (*it == end) return true;
- if (*it + 1 == end) return false;
- if (**it == separator && isDigit(*(*it + 1), base)) {
- ++(*it);
- }
- return *it == end;
-}
-
-// Checks whether the string in the range start-end is a hex-float string.
-// This function assumes that the leading '0x'/'0X' is already consumed.
-//
-// Hex float strings are of one of the following forms:
-// - hex_digits+ 'p' ('+'|'-')? exponent_digits+
-// - hex_digits* '.' hex_digits+ 'p' ('+'|'-')? exponent_digits+
-// - hex_digits+ '.' 'p' ('+'|'-')? exponent_digits+
-template<class Iterator>
-static bool IsHexFloatString(Iterator start,
- Iterator end,
- uc16 separator,
- bool allow_trailing_junk) {
- DOUBLE_CONVERSION_ASSERT(start != end);
-
- Iterator current = start;
-
- bool saw_digit = false;
- while (isDigit(*current, 16)) {
- saw_digit = true;
- if (Advance(&current, separator, 16, end)) return false;
- }
- if (*current == '.') {
- if (Advance(&current, separator, 16, end)) return false;
- while (isDigit(*current, 16)) {
- saw_digit = true;
- if (Advance(&current, separator, 16, end)) return false;
- }
- }
- if (!saw_digit) return false;
- if (*current != 'p' && *current != 'P') return false;
- if (Advance(&current, separator, 16, end)) return false;
- if (*current == '+' || *current == '-') {
- if (Advance(&current, separator, 16, end)) return false;
- }
- if (!isDigit(*current, 10)) return false;
- if (Advance(&current, separator, 16, end)) return true;
- while (isDigit(*current, 10)) {
- if (Advance(&current, separator, 16, end)) return true;
- }
- return allow_trailing_junk || !AdvanceToNonspace(&current, end);
-}
-
-
-// Parsing integers with radix 2, 4, 8, 16, 32. Assumes current != end.
-//
-// If parse_as_hex_float is true, then the string must be a valid
-// hex-float.
-template <int radix_log_2, class Iterator>
-static double RadixStringToIeee(Iterator* current,
- Iterator end,
- bool sign,
- uc16 separator,
- bool parse_as_hex_float,
- bool allow_trailing_junk,
- double junk_string_value,
- bool read_as_double,
- bool* result_is_junk) {
- DOUBLE_CONVERSION_ASSERT(*current != end);
- DOUBLE_CONVERSION_ASSERT(!parse_as_hex_float ||
- IsHexFloatString(*current, end, separator, allow_trailing_junk));
-
- const int kDoubleSize = Double::kSignificandSize;
- const int kSingleSize = Single::kSignificandSize;
- const int kSignificandSize = read_as_double? kDoubleSize: kSingleSize;
-
- *result_is_junk = true;
-
- int64_t number = 0;
- int exponent = 0;
- const int radix = (1 << radix_log_2);
- // Whether we have encountered a '.' and are parsing the decimal digits.
- // Only relevant if parse_as_hex_float is true.
- bool post_decimal = false;
-
- // Skip leading 0s.
- while (**current == '0') {
- if (Advance(current, separator, radix, end)) {
- *result_is_junk = false;
- return SignedZero(sign);
- }
- }
-
- while (true) {
- int digit;
- if (IsDecimalDigitForRadix(**current, radix)) {
- digit = static_cast<char>(**current) - '0';
- if (post_decimal) exponent -= radix_log_2;
- } else if (IsCharacterDigitForRadix(**current, radix, 'a')) {
- digit = static_cast<char>(**current) - 'a' + 10;
- if (post_decimal) exponent -= radix_log_2;
- } else if (IsCharacterDigitForRadix(**current, radix, 'A')) {
- digit = static_cast<char>(**current) - 'A' + 10;
- if (post_decimal) exponent -= radix_log_2;
- } else if (parse_as_hex_float && **current == '.') {
- post_decimal = true;
- Advance(current, separator, radix, end);
- DOUBLE_CONVERSION_ASSERT(*current != end);
- continue;
- } else if (parse_as_hex_float && (**current == 'p' || **current == 'P')) {
- break;
- } else {
- if (allow_trailing_junk || !AdvanceToNonspace(current, end)) {
- break;
- } else {
- return junk_string_value;
- }
- }
-
- number = number * radix + digit;
- int overflow = static_cast<int>(number >> kSignificandSize);
- if (overflow != 0) {
- // Overflow occurred. Need to determine which direction to round the
- // result.
- int overflow_bits_count = 1;
- while (overflow > 1) {
- overflow_bits_count++;
- overflow >>= 1;
- }
-
- int dropped_bits_mask = ((1 << overflow_bits_count) - 1);
- int dropped_bits = static_cast<int>(number) & dropped_bits_mask;
- number >>= overflow_bits_count;
- exponent += overflow_bits_count;
-
- bool zero_tail = true;
- for (;;) {
- if (Advance(current, separator, radix, end)) break;
- if (parse_as_hex_float && **current == '.') {
- // Just run over the '.'. We are just trying to see whether there is
- // a non-zero digit somewhere.
- Advance(current, separator, radix, end);
- DOUBLE_CONVERSION_ASSERT(*current != end);
- post_decimal = true;
- }
- if (!isDigit(**current, radix)) break;
- zero_tail = zero_tail && **current == '0';
- if (!post_decimal) exponent += radix_log_2;
- }
-
- if (!parse_as_hex_float &&
- !allow_trailing_junk &&
- AdvanceToNonspace(current, end)) {
- return junk_string_value;
- }
-
- int middle_value = (1 << (overflow_bits_count - 1));
- if (dropped_bits > middle_value) {
- number++; // Rounding up.
- } else if (dropped_bits == middle_value) {
- // Rounding to even to consistency with decimals: half-way case rounds
- // up if significant part is odd and down otherwise.
- if ((number & 1) != 0 || !zero_tail) {
- number++; // Rounding up.
- }
- }
-
- // Rounding up may cause overflow.
- if ((number & ((int64_t)1 << kSignificandSize)) != 0) {
- exponent++;
- number >>= 1;
- }
- break;
- }
- if (Advance(current, separator, radix, end)) break;
- }
-
- DOUBLE_CONVERSION_ASSERT(number < ((int64_t)1 << kSignificandSize));
- DOUBLE_CONVERSION_ASSERT(static_cast<int64_t>(static_cast<double>(number)) == number);
-
- *result_is_junk = false;
-
- if (parse_as_hex_float) {
- DOUBLE_CONVERSION_ASSERT(**current == 'p' || **current == 'P');
- Advance(current, separator, radix, end);
- DOUBLE_CONVERSION_ASSERT(*current != end);
- bool is_negative = false;
- if (**current == '+') {
- Advance(current, separator, radix, end);
- DOUBLE_CONVERSION_ASSERT(*current != end);
- } else if (**current == '-') {
- is_negative = true;
- Advance(current, separator, radix, end);
- DOUBLE_CONVERSION_ASSERT(*current != end);
- }
- int written_exponent = 0;
- while (IsDecimalDigitForRadix(**current, 10)) {
- // No need to read exponents if they are too big. That could potentially overflow
- // the `written_exponent` variable.
- if (abs(written_exponent) <= 100 * Double::kMaxExponent) {
- written_exponent = 10 * written_exponent + **current - '0';
- }
- if (Advance(current, separator, radix, end)) break;
- }
- if (is_negative) written_exponent = -written_exponent;
- exponent += written_exponent;
- }
-
- if (exponent == 0 || number == 0) {
- if (sign) {
- if (number == 0) return -0.0;
- number = -number;
- }
- return static_cast<double>(number);
- }
-
- DOUBLE_CONVERSION_ASSERT(number != 0);
- double result = Double(DiyFp(number, exponent)).value();
- return sign ? -result : result;
-}
-
-template <class Iterator>
-double StringToDoubleConverter::StringToIeee(
- Iterator input,
- int length,
- bool read_as_double,
- int* processed_characters_count) const {
- Iterator current = input;
- Iterator end = input + length;
-
- *processed_characters_count = 0;
-
- const bool allow_trailing_junk = (flags_ & ALLOW_TRAILING_JUNK) != 0;
- const bool allow_leading_spaces = (flags_ & ALLOW_LEADING_SPACES) != 0;
- const bool allow_trailing_spaces = (flags_ & ALLOW_TRAILING_SPACES) != 0;
- const bool allow_spaces_after_sign = (flags_ & ALLOW_SPACES_AFTER_SIGN) != 0;
- const bool allow_case_insensitivity = (flags_ & ALLOW_CASE_INSENSITIVITY) != 0;
-
- // To make sure that iterator dereferencing is valid the following
- // convention is used:
- // 1. Each '++current' statement is followed by check for equality to 'end'.
- // 2. If AdvanceToNonspace returned false then current == end.
- // 3. If 'current' becomes equal to 'end' the function returns or goes to
- // 'parsing_done'.
- // 4. 'current' is not dereferenced after the 'parsing_done' label.
- // 5. Code before 'parsing_done' may rely on 'current != end'.
- if (current == end) return empty_string_value_;
-
- if (allow_leading_spaces || allow_trailing_spaces) {
- if (!AdvanceToNonspace(&current, end)) {
- *processed_characters_count = static_cast<int>(current - input);
- return empty_string_value_;
- }
- if (!allow_leading_spaces && (input != current)) {
- // No leading spaces allowed, but AdvanceToNonspace moved forward.
- return junk_string_value_;
- }
- }
-
- // Exponent will be adjusted if insignificant digits of the integer part
- // or insignificant leading zeros of the fractional part are dropped.
- int exponent = 0;
- int significant_digits = 0;
- int insignificant_digits = 0;
- bool nonzero_digit_dropped = false;
-
- bool sign = false;
-
- if (*current == '+' || *current == '-') {
- sign = (*current == '-');
- ++current;
- Iterator next_non_space = current;
- // Skip following spaces (if allowed).
- if (!AdvanceToNonspace(&next_non_space, end)) return junk_string_value_;
- if (!allow_spaces_after_sign && (current != next_non_space)) {
- return junk_string_value_;
- }
- current = next_non_space;
- }
-
- if (infinity_symbol_ != NULL) {
- if (ConsumeFirstCharacter(*current, infinity_symbol_, allow_case_insensitivity)) {
- if (!ConsumeSubString(&current, end, infinity_symbol_, allow_case_insensitivity)) {
- return junk_string_value_;
- }
-
- if (!(allow_trailing_spaces || allow_trailing_junk) && (current != end)) {
- return junk_string_value_;
- }
- if (!allow_trailing_junk && AdvanceToNonspace(&current, end)) {
- return junk_string_value_;
- }
-
- *processed_characters_count = static_cast<int>(current - input);
- return sign ? -Double::Infinity() : Double::Infinity();
- }
- }
-
- if (nan_symbol_ != NULL) {
- if (ConsumeFirstCharacter(*current, nan_symbol_, allow_case_insensitivity)) {
- if (!ConsumeSubString(&current, end, nan_symbol_, allow_case_insensitivity)) {
- return junk_string_value_;
- }
-
- if (!(allow_trailing_spaces || allow_trailing_junk) && (current != end)) {
- return junk_string_value_;
- }
- if (!allow_trailing_junk && AdvanceToNonspace(&current, end)) {
- return junk_string_value_;
- }
-
- *processed_characters_count = static_cast<int>(current - input);
- return sign ? -Double::NaN() : Double::NaN();
- }
- }
-
- bool leading_zero = false;
- if (*current == '0') {
- if (Advance(&current, separator_, 10, end)) {
- *processed_characters_count = static_cast<int>(current - input);
- return SignedZero(sign);
- }
-
- leading_zero = true;
-
- // It could be hexadecimal value.
- if (((flags_ & ALLOW_HEX) || (flags_ & ALLOW_HEX_FLOATS)) &&
- (*current == 'x' || *current == 'X')) {
- ++current;
-
- if (current == end) return junk_string_value_; // "0x"
-
- bool parse_as_hex_float = (flags_ & ALLOW_HEX_FLOATS) &&
- IsHexFloatString(current, end, separator_, allow_trailing_junk);
-
- if (!parse_as_hex_float && !isDigit(*current, 16)) {
- return junk_string_value_;
- }
-
- bool result_is_junk;
- double result = RadixStringToIeee<4>(&current,
- end,
- sign,
- separator_,
- parse_as_hex_float,
- allow_trailing_junk,
- junk_string_value_,
- read_as_double,
- &result_is_junk);
- if (!result_is_junk) {
- if (allow_trailing_spaces) AdvanceToNonspace(&current, end);
- *processed_characters_count = static_cast<int>(current - input);
- }
- return result;
- }
-
- // Ignore leading zeros in the integer part.
- while (*current == '0') {
- if (Advance(&current, separator_, 10, end)) {
- *processed_characters_count = static_cast<int>(current - input);
- return SignedZero(sign);
- }
- }
- }
-
- bool octal = leading_zero && (flags_ & ALLOW_OCTALS) != 0;
-
- // The longest form of simplified number is: "-<significant digits>.1eXXX\0".
- const int kBufferSize = kMaxSignificantDigits + 10;
- DOUBLE_CONVERSION_STACK_UNINITIALIZED char
- buffer[kBufferSize]; // NOLINT: size is known at compile time.
- int buffer_pos = 0;
-
- // Copy significant digits of the integer part (if any) to the buffer.
- while (*current >= '0' && *current <= '9') {
- if (significant_digits < kMaxSignificantDigits) {
- DOUBLE_CONVERSION_ASSERT(buffer_pos < kBufferSize);
- buffer[buffer_pos++] = static_cast<char>(*current);
- significant_digits++;
- // Will later check if it's an octal in the buffer.
- } else {
- insignificant_digits++; // Move the digit into the exponential part.
- nonzero_digit_dropped = nonzero_digit_dropped || *current != '0';
- }
- octal = octal && *current < '8';
- if (Advance(&current, separator_, 10, end)) goto parsing_done;
- }
-
- if (significant_digits == 0) {
- octal = false;
- }
-
- if (*current == '.') {
- if (octal && !allow_trailing_junk) return junk_string_value_;
- if (octal) goto parsing_done;
-
- if (Advance(&current, separator_, 10, end)) {
- if (significant_digits == 0 && !leading_zero) {
- return junk_string_value_;
- } else {
- goto parsing_done;
- }
- }
-
- if (significant_digits == 0) {
- // octal = false;
- // Integer part consists of 0 or is absent. Significant digits start after
- // leading zeros (if any).
- while (*current == '0') {
- if (Advance(&current, separator_, 10, end)) {
- *processed_characters_count = static_cast<int>(current - input);
- return SignedZero(sign);
- }
- exponent--; // Move this 0 into the exponent.
- }
- }
-
- // There is a fractional part.
- // We don't emit a '.', but adjust the exponent instead.
- while (*current >= '0' && *current <= '9') {
- if (significant_digits < kMaxSignificantDigits) {
- DOUBLE_CONVERSION_ASSERT(buffer_pos < kBufferSize);
- buffer[buffer_pos++] = static_cast<char>(*current);
- significant_digits++;
- exponent--;
- } else {
- // Ignore insignificant digits in the fractional part.
- nonzero_digit_dropped = nonzero_digit_dropped || *current != '0';
- }
- if (Advance(&current, separator_, 10, end)) goto parsing_done;
- }
- }
-
- if (!leading_zero && exponent == 0 && significant_digits == 0) {
- // If leading_zeros is true then the string contains zeros.
- // If exponent < 0 then string was [+-]\.0*...
- // If significant_digits != 0 the string is not equal to 0.
- // Otherwise there are no digits in the string.
- return junk_string_value_;
- }
-
- // Parse exponential part.
- if (*current == 'e' || *current == 'E') {
- if (octal && !allow_trailing_junk) return junk_string_value_;
- if (octal) goto parsing_done;
- Iterator junk_begin = current;
- ++current;
- if (current == end) {
- if (allow_trailing_junk) {
- current = junk_begin;
- goto parsing_done;
- } else {
- return junk_string_value_;
- }
- }
- char exponen_sign = '+';
- if (*current == '+' || *current == '-') {
- exponen_sign = static_cast<char>(*current);
- ++current;
- if (current == end) {
- if (allow_trailing_junk) {
- current = junk_begin;
- goto parsing_done;
- } else {
- return junk_string_value_;
- }
- }
- }
-
- if (current == end || *current < '0' || *current > '9') {
- if (allow_trailing_junk) {
- current = junk_begin;
- goto parsing_done;
- } else {
- return junk_string_value_;
- }
- }
-
- const int max_exponent = INT_MAX / 2;
- DOUBLE_CONVERSION_ASSERT(-max_exponent / 2 <= exponent && exponent <= max_exponent / 2);
- int num = 0;
- do {
- // Check overflow.
- int digit = *current - '0';
- if (num >= max_exponent / 10
- && !(num == max_exponent / 10 && digit <= max_exponent % 10)) {
- num = max_exponent;
- } else {
- num = num * 10 + digit;
- }
- ++current;
- } while (current != end && *current >= '0' && *current <= '9');
-
- exponent += (exponen_sign == '-' ? -num : num);
- }
-
- if (!(allow_trailing_spaces || allow_trailing_junk) && (current != end)) {
- return junk_string_value_;
- }
- if (!allow_trailing_junk && AdvanceToNonspace(&current, end)) {
- return junk_string_value_;
- }
- if (allow_trailing_spaces) {
- AdvanceToNonspace(&current, end);
- }
-
- parsing_done:
- exponent += insignificant_digits;
-
- if (octal) {
- double result;
- bool result_is_junk;
- char* start = buffer;
- result = RadixStringToIeee<3>(&start,
- buffer + buffer_pos,
- sign,
- separator_,
- false, // Don't parse as hex_float.
- allow_trailing_junk,
- junk_string_value_,
- read_as_double,
- &result_is_junk);
- DOUBLE_CONVERSION_ASSERT(!result_is_junk);
- *processed_characters_count = static_cast<int>(current - input);
- return result;
- }
-
- if (nonzero_digit_dropped) {
- buffer[buffer_pos++] = '1';
- exponent--;
- }
-
- DOUBLE_CONVERSION_ASSERT(buffer_pos < kBufferSize);
- buffer[buffer_pos] = '\0';
-
- double converted;
- if (read_as_double) {
- converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent);
- } else {
- converted = Strtof(Vector<const char>(buffer, buffer_pos), exponent);
- }
- *processed_characters_count = static_cast<int>(current - input);
- return sign? -converted: converted;
-}
-
-
-double StringToDoubleConverter::StringToDouble(
- const char* buffer,
- int length,
- int* processed_characters_count) const {
- return StringToIeee(buffer, length, true, processed_characters_count);
-}
-
-
-double StringToDoubleConverter::StringToDouble(
- const uc16* buffer,
- int length,
- int* processed_characters_count) const {
- return StringToIeee(buffer, length, true, processed_characters_count);
-}
-
-
-float StringToDoubleConverter::StringToFloat(
- const char* buffer,
- int length,
- int* processed_characters_count) const {
- return static_cast<float>(StringToIeee(buffer, length, false,
- processed_characters_count));
-}
-
-
-float StringToDoubleConverter::StringToFloat(
- const uc16* buffer,
- int length,
- int* processed_characters_count) const {
- return static_cast<float>(StringToIeee(buffer, length, false,
- processed_characters_count));
-}
-
-} // namespace double_conversion
-
-// ICU PATCH: Close ICU namespace
-U_NAMESPACE_END
-#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+//
+// From the double-conversion library. Original license:
+//
+// Copyright 2010 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.
+
+// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+// ICU PATCH: Do not include std::locale.
+
+#include <climits>
+// #include <locale>
+#include <cmath>
+
+// ICU PATCH: Customize header file paths for ICU.
+
+#include "double-conversion-string-to-double.h"
+
+#include "double-conversion-ieee.h"
+#include "double-conversion-strtod.h"
+#include "double-conversion-utils.h"
+
+// ICU PATCH: Wrap in ICU namespace
+U_NAMESPACE_BEGIN
+
+namespace double_conversion {
+
+namespace {
+
+inline char ToLower(char ch) {
+#if 0 // do not include std::locale in ICU
+ static const std::ctype<char>& cType =
+ std::use_facet<std::ctype<char> >(std::locale::classic());
+ return cType.tolower(ch);
+#else
+ (void)ch;
+ DOUBLE_CONVERSION_UNREACHABLE();
+#endif
+}
+
+inline char Pass(char ch) {
+ return ch;
+}
+
+template <class Iterator, class Converter>
+static inline bool ConsumeSubStringImpl(Iterator* current,
+ Iterator end,
+ const char* substring,
+ Converter converter) {
+ DOUBLE_CONVERSION_ASSERT(converter(**current) == *substring);
+ for (substring++; *substring != '\0'; substring++) {
+ ++*current;
+ if (*current == end || converter(**current) != *substring) {
+ return false;
+ }
+ }
+ ++*current;
+ return true;
+}
+
+// Consumes the given substring from the iterator.
+// Returns false, if the substring does not match.
+template <class Iterator>
+static bool ConsumeSubString(Iterator* current,
+ Iterator end,
+ const char* substring,
+ bool allow_case_insensitivity) {
+ if (allow_case_insensitivity) {
+ return ConsumeSubStringImpl(current, end, substring, ToLower);
+ } else {
+ return ConsumeSubStringImpl(current, end, substring, Pass);
+ }
+}
+
+// Consumes first character of the str is equal to ch
+inline bool ConsumeFirstCharacter(char ch,
+ const char* str,
+ bool case_insensitivity) {
+ return case_insensitivity ? ToLower(ch) == str[0] : ch == str[0];
+}
+} // namespace
+
+// Maximum number of significant digits in decimal representation.
+// The longest possible double in decimal representation is
+// (2^53 - 1) * 2 ^ -1074 that is (2 ^ 53 - 1) * 5 ^ 1074 / 10 ^ 1074
+// (768 digits). If we parse a number whose first digits are equal to a
+// mean of 2 adjacent doubles (that could have up to 769 digits) the result
+// must be rounded to the bigger one unless the tail consists of zeros, so
+// we don't need to preserve all the digits.
+const int kMaxSignificantDigits = 772;
+
+
+static const char kWhitespaceTable7[] = { 32, 13, 10, 9, 11, 12 };
+static const int kWhitespaceTable7Length = DOUBLE_CONVERSION_ARRAY_SIZE(kWhitespaceTable7);
+
+
+static const uc16 kWhitespaceTable16[] = {
+ 160, 8232, 8233, 5760, 6158, 8192, 8193, 8194, 8195,
+ 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279
+};
+static const int kWhitespaceTable16Length = DOUBLE_CONVERSION_ARRAY_SIZE(kWhitespaceTable16);
+
+
+static bool isWhitespace(int x) {
+ if (x < 128) {
+ for (int i = 0; i < kWhitespaceTable7Length; i++) {
+ if (kWhitespaceTable7[i] == x) return true;
+ }
+ } else {
+ for (int i = 0; i < kWhitespaceTable16Length; i++) {
+ if (kWhitespaceTable16[i] == x) return true;
+ }
+ }
+ return false;
+}
+
+
+// Returns true if a nonspace found and false if the end has reached.
+template <class Iterator>
+static inline bool AdvanceToNonspace(Iterator* current, Iterator end) {
+ while (*current != end) {
+ if (!isWhitespace(**current)) return true;
+ ++*current;
+ }
+ return false;
+}
+
+
+static bool isDigit(int x, int radix) {
+ return (x >= '0' && x <= '9' && x < '0' + radix)
+ || (radix > 10 && x >= 'a' && x < 'a' + radix - 10)
+ || (radix > 10 && x >= 'A' && x < 'A' + radix - 10);
+}
+
+
+static double SignedZero(bool sign) {
+ return sign ? -0.0 : 0.0;
+}
+
+
+// Returns true if 'c' is a decimal digit that is valid for the given radix.
+//
+// The function is small and could be inlined, but VS2012 emitted a warning
+// because it constant-propagated the radix and concluded that the last
+// condition was always true. By moving it into a separate function the
+// compiler wouldn't warn anymore.
+#ifdef _MSC_VER
+#pragma optimize("",off)
+static bool IsDecimalDigitForRadix(int c, int radix) {
+ return '0' <= c && c <= '9' && (c - '0') < radix;
+}
+#pragma optimize("",on)
+#else
+static bool inline IsDecimalDigitForRadix(int c, int radix) {
+ return '0' <= c && c <= '9' && (c - '0') < radix;
+}
+#endif
+// Returns true if 'c' is a character digit that is valid for the given radix.
+// The 'a_character' should be 'a' or 'A'.
+//
+// The function is small and could be inlined, but VS2012 emitted a warning
+// because it constant-propagated the radix and concluded that the first
+// condition was always false. By moving it into a separate function the
+// compiler wouldn't warn anymore.
+static bool IsCharacterDigitForRadix(int c, int radix, char a_character) {
+ return radix > 10 && c >= a_character && c < a_character + radix - 10;
+}
+
+// Returns true, when the iterator is equal to end.
+template<class Iterator>
+static bool Advance (Iterator* it, uc16 separator, int base, Iterator& end) {
+ if (separator == StringToDoubleConverter::kNoSeparator) {
+ ++(*it);
+ return *it == end;
+ }
+ if (!isDigit(**it, base)) {
+ ++(*it);
+ return *it == end;
+ }
+ ++(*it);
+ if (*it == end) return true;
+ if (*it + 1 == end) return false;
+ if (**it == separator && isDigit(*(*it + 1), base)) {
+ ++(*it);
+ }
+ return *it == end;
+}
+
+// Checks whether the string in the range start-end is a hex-float string.
+// This function assumes that the leading '0x'/'0X' is already consumed.
+//
+// Hex float strings are of one of the following forms:
+// - hex_digits+ 'p' ('+'|'-')? exponent_digits+
+// - hex_digits* '.' hex_digits+ 'p' ('+'|'-')? exponent_digits+
+// - hex_digits+ '.' 'p' ('+'|'-')? exponent_digits+
+template<class Iterator>
+static bool IsHexFloatString(Iterator start,
+ Iterator end,
+ uc16 separator,
+ bool allow_trailing_junk) {
+ DOUBLE_CONVERSION_ASSERT(start != end);
+
+ Iterator current = start;
+
+ bool saw_digit = false;
+ while (isDigit(*current, 16)) {
+ saw_digit = true;
+ if (Advance(&current, separator, 16, end)) return false;
+ }
+ if (*current == '.') {
+ if (Advance(&current, separator, 16, end)) return false;
+ while (isDigit(*current, 16)) {
+ saw_digit = true;
+ if (Advance(&current, separator, 16, end)) return false;
+ }
+ }
+ if (!saw_digit) return false;
+ if (*current != 'p' && *current != 'P') return false;
+ if (Advance(&current, separator, 16, end)) return false;
+ if (*current == '+' || *current == '-') {
+ if (Advance(&current, separator, 16, end)) return false;
+ }
+ if (!isDigit(*current, 10)) return false;
+ if (Advance(&current, separator, 16, end)) return true;
+ while (isDigit(*current, 10)) {
+ if (Advance(&current, separator, 16, end)) return true;
+ }
+ return allow_trailing_junk || !AdvanceToNonspace(&current, end);
+}
+
+
+// Parsing integers with radix 2, 4, 8, 16, 32. Assumes current != end.
+//
+// If parse_as_hex_float is true, then the string must be a valid
+// hex-float.
+template <int radix_log_2, class Iterator>
+static double RadixStringToIeee(Iterator* current,
+ Iterator end,
+ bool sign,
+ uc16 separator,
+ bool parse_as_hex_float,
+ bool allow_trailing_junk,
+ double junk_string_value,
+ bool read_as_double,
+ bool* result_is_junk) {
+ DOUBLE_CONVERSION_ASSERT(*current != end);
+ DOUBLE_CONVERSION_ASSERT(!parse_as_hex_float ||
+ IsHexFloatString(*current, end, separator, allow_trailing_junk));
+
+ const int kDoubleSize = Double::kSignificandSize;
+ const int kSingleSize = Single::kSignificandSize;
+ const int kSignificandSize = read_as_double? kDoubleSize: kSingleSize;
+
+ *result_is_junk = true;
+
+ int64_t number = 0;
+ int exponent = 0;
+ const int radix = (1 << radix_log_2);
+ // Whether we have encountered a '.' and are parsing the decimal digits.
+ // Only relevant if parse_as_hex_float is true.
+ bool post_decimal = false;
+
+ // Skip leading 0s.
+ while (**current == '0') {
+ if (Advance(current, separator, radix, end)) {
+ *result_is_junk = false;
+ return SignedZero(sign);
+ }
+ }
+
+ while (true) {
+ int digit;
+ if (IsDecimalDigitForRadix(**current, radix)) {
+ digit = static_cast<char>(**current) - '0';
+ if (post_decimal) exponent -= radix_log_2;
+ } else if (IsCharacterDigitForRadix(**current, radix, 'a')) {
+ digit = static_cast<char>(**current) - 'a' + 10;
+ if (post_decimal) exponent -= radix_log_2;
+ } else if (IsCharacterDigitForRadix(**current, radix, 'A')) {
+ digit = static_cast<char>(**current) - 'A' + 10;
+ if (post_decimal) exponent -= radix_log_2;
+ } else if (parse_as_hex_float && **current == '.') {
+ post_decimal = true;
+ Advance(current, separator, radix, end);
+ DOUBLE_CONVERSION_ASSERT(*current != end);
+ continue;
+ } else if (parse_as_hex_float && (**current == 'p' || **current == 'P')) {
+ break;
+ } else {
+ if (allow_trailing_junk || !AdvanceToNonspace(current, end)) {
+ break;
+ } else {
+ return junk_string_value;
+ }
+ }
+
+ number = number * radix + digit;
+ int overflow = static_cast<int>(number >> kSignificandSize);
+ if (overflow != 0) {
+ // Overflow occurred. Need to determine which direction to round the
+ // result.
+ int overflow_bits_count = 1;
+ while (overflow > 1) {
+ overflow_bits_count++;
+ overflow >>= 1;
+ }
+
+ int dropped_bits_mask = ((1 << overflow_bits_count) - 1);
+ int dropped_bits = static_cast<int>(number) & dropped_bits_mask;
+ number >>= overflow_bits_count;
+ exponent += overflow_bits_count;
+
+ bool zero_tail = true;
+ for (;;) {
+ if (Advance(current, separator, radix, end)) break;
+ if (parse_as_hex_float && **current == '.') {
+ // Just run over the '.'. We are just trying to see whether there is
+ // a non-zero digit somewhere.
+ Advance(current, separator, radix, end);
+ DOUBLE_CONVERSION_ASSERT(*current != end);
+ post_decimal = true;
+ }
+ if (!isDigit(**current, radix)) break;
+ zero_tail = zero_tail && **current == '0';
+ if (!post_decimal) exponent += radix_log_2;
+ }
+
+ if (!parse_as_hex_float &&
+ !allow_trailing_junk &&
+ AdvanceToNonspace(current, end)) {
+ return junk_string_value;
+ }
+
+ int middle_value = (1 << (overflow_bits_count - 1));
+ if (dropped_bits > middle_value) {
+ number++; // Rounding up.
+ } else if (dropped_bits == middle_value) {
+ // Rounding to even to consistency with decimals: half-way case rounds
+ // up if significant part is odd and down otherwise.
+ if ((number & 1) != 0 || !zero_tail) {
+ number++; // Rounding up.
+ }
+ }
+
+ // Rounding up may cause overflow.
+ if ((number & ((int64_t)1 << kSignificandSize)) != 0) {
+ exponent++;
+ number >>= 1;
+ }
+ break;
+ }
+ if (Advance(current, separator, radix, end)) break;
+ }
+
+ DOUBLE_CONVERSION_ASSERT(number < ((int64_t)1 << kSignificandSize));
+ DOUBLE_CONVERSION_ASSERT(static_cast<int64_t>(static_cast<double>(number)) == number);
+
+ *result_is_junk = false;
+
+ if (parse_as_hex_float) {
+ DOUBLE_CONVERSION_ASSERT(**current == 'p' || **current == 'P');
+ Advance(current, separator, radix, end);
+ DOUBLE_CONVERSION_ASSERT(*current != end);
+ bool is_negative = false;
+ if (**current == '+') {
+ Advance(current, separator, radix, end);
+ DOUBLE_CONVERSION_ASSERT(*current != end);
+ } else if (**current == '-') {
+ is_negative = true;
+ Advance(current, separator, radix, end);
+ DOUBLE_CONVERSION_ASSERT(*current != end);
+ }
+ int written_exponent = 0;
+ while (IsDecimalDigitForRadix(**current, 10)) {
+ // No need to read exponents if they are too big. That could potentially overflow
+ // the `written_exponent` variable.
+ if (abs(written_exponent) <= 100 * Double::kMaxExponent) {
+ written_exponent = 10 * written_exponent + **current - '0';
+ }
+ if (Advance(current, separator, radix, end)) break;
+ }
+ if (is_negative) written_exponent = -written_exponent;
+ exponent += written_exponent;
+ }
+
+ if (exponent == 0 || number == 0) {
+ if (sign) {
+ if (number == 0) return -0.0;
+ number = -number;
+ }
+ return static_cast<double>(number);
+ }
+
+ DOUBLE_CONVERSION_ASSERT(number != 0);
+ double result = Double(DiyFp(number, exponent)).value();
+ return sign ? -result : result;
+}
+
+template <class Iterator>
+double StringToDoubleConverter::StringToIeee(
+ Iterator input,
+ int length,
+ bool read_as_double,
+ int* processed_characters_count) const {
+ Iterator current = input;
+ Iterator end = input + length;
+
+ *processed_characters_count = 0;
+
+ const bool allow_trailing_junk = (flags_ & ALLOW_TRAILING_JUNK) != 0;
+ const bool allow_leading_spaces = (flags_ & ALLOW_LEADING_SPACES) != 0;
+ const bool allow_trailing_spaces = (flags_ & ALLOW_TRAILING_SPACES) != 0;
+ const bool allow_spaces_after_sign = (flags_ & ALLOW_SPACES_AFTER_SIGN) != 0;
+ const bool allow_case_insensitivity = (flags_ & ALLOW_CASE_INSENSITIVITY) != 0;
+
+ // To make sure that iterator dereferencing is valid the following
+ // convention is used:
+ // 1. Each '++current' statement is followed by check for equality to 'end'.
+ // 2. If AdvanceToNonspace returned false then current == end.
+ // 3. If 'current' becomes equal to 'end' the function returns or goes to
+ // 'parsing_done'.
+ // 4. 'current' is not dereferenced after the 'parsing_done' label.
+ // 5. Code before 'parsing_done' may rely on 'current != end'.
+ if (current == end) return empty_string_value_;
+
+ if (allow_leading_spaces || allow_trailing_spaces) {
+ if (!AdvanceToNonspace(&current, end)) {
+ *processed_characters_count = static_cast<int>(current - input);
+ return empty_string_value_;
+ }
+ if (!allow_leading_spaces && (input != current)) {
+ // No leading spaces allowed, but AdvanceToNonspace moved forward.
+ return junk_string_value_;
+ }
+ }
+
+ // Exponent will be adjusted if insignificant digits of the integer part
+ // or insignificant leading zeros of the fractional part are dropped.
+ int exponent = 0;
+ int significant_digits = 0;
+ int insignificant_digits = 0;
+ bool nonzero_digit_dropped = false;
+
+ bool sign = false;
+
+ if (*current == '+' || *current == '-') {
+ sign = (*current == '-');
+ ++current;
+ Iterator next_non_space = current;
+ // Skip following spaces (if allowed).
+ if (!AdvanceToNonspace(&next_non_space, end)) return junk_string_value_;
+ if (!allow_spaces_after_sign && (current != next_non_space)) {
+ return junk_string_value_;
+ }
+ current = next_non_space;
+ }
+
+ if (infinity_symbol_ != NULL) {
+ if (ConsumeFirstCharacter(*current, infinity_symbol_, allow_case_insensitivity)) {
+ if (!ConsumeSubString(&current, end, infinity_symbol_, allow_case_insensitivity)) {
+ return junk_string_value_;
+ }
+
+ if (!(allow_trailing_spaces || allow_trailing_junk) && (current != end)) {
+ return junk_string_value_;
+ }
+ if (!allow_trailing_junk && AdvanceToNonspace(&current, end)) {
+ return junk_string_value_;
+ }
+
+ *processed_characters_count = static_cast<int>(current - input);
+ return sign ? -Double::Infinity() : Double::Infinity();
+ }
+ }
+
+ if (nan_symbol_ != NULL) {
+ if (ConsumeFirstCharacter(*current, nan_symbol_, allow_case_insensitivity)) {
+ if (!ConsumeSubString(&current, end, nan_symbol_, allow_case_insensitivity)) {
+ return junk_string_value_;
+ }
+
+ if (!(allow_trailing_spaces || allow_trailing_junk) && (current != end)) {
+ return junk_string_value_;
+ }
+ if (!allow_trailing_junk && AdvanceToNonspace(&current, end)) {
+ return junk_string_value_;
+ }
+
+ *processed_characters_count = static_cast<int>(current - input);
+ return sign ? -Double::NaN() : Double::NaN();
+ }
+ }
+
+ bool leading_zero = false;
+ if (*current == '0') {
+ if (Advance(&current, separator_, 10, end)) {
+ *processed_characters_count = static_cast<int>(current - input);
+ return SignedZero(sign);
+ }
+
+ leading_zero = true;
+
+ // It could be hexadecimal value.
+ if (((flags_ & ALLOW_HEX) || (flags_ & ALLOW_HEX_FLOATS)) &&
+ (*current == 'x' || *current == 'X')) {
+ ++current;
+
+ if (current == end) return junk_string_value_; // "0x"
+
+ bool parse_as_hex_float = (flags_ & ALLOW_HEX_FLOATS) &&
+ IsHexFloatString(current, end, separator_, allow_trailing_junk);
+
+ if (!parse_as_hex_float && !isDigit(*current, 16)) {
+ return junk_string_value_;
+ }
+
+ bool result_is_junk;
+ double result = RadixStringToIeee<4>(&current,
+ end,
+ sign,
+ separator_,
+ parse_as_hex_float,
+ allow_trailing_junk,
+ junk_string_value_,
+ read_as_double,
+ &result_is_junk);
+ if (!result_is_junk) {
+ if (allow_trailing_spaces) AdvanceToNonspace(&current, end);
+ *processed_characters_count = static_cast<int>(current - input);
+ }
+ return result;
+ }
+
+ // Ignore leading zeros in the integer part.
+ while (*current == '0') {
+ if (Advance(&current, separator_, 10, end)) {
+ *processed_characters_count = static_cast<int>(current - input);
+ return SignedZero(sign);
+ }
+ }
+ }
+
+ bool octal = leading_zero && (flags_ & ALLOW_OCTALS) != 0;
+
+ // The longest form of simplified number is: "-<significant digits>.1eXXX\0".
+ const int kBufferSize = kMaxSignificantDigits + 10;
+ DOUBLE_CONVERSION_STACK_UNINITIALIZED char
+ buffer[kBufferSize]; // NOLINT: size is known at compile time.
+ int buffer_pos = 0;
+
+ // Copy significant digits of the integer part (if any) to the buffer.
+ while (*current >= '0' && *current <= '9') {
+ if (significant_digits < kMaxSignificantDigits) {
+ DOUBLE_CONVERSION_ASSERT(buffer_pos < kBufferSize);
+ buffer[buffer_pos++] = static_cast<char>(*current);
+ significant_digits++;
+ // Will later check if it's an octal in the buffer.
+ } else {
+ insignificant_digits++; // Move the digit into the exponential part.
+ nonzero_digit_dropped = nonzero_digit_dropped || *current != '0';
+ }
+ octal = octal && *current < '8';
+ if (Advance(&current, separator_, 10, end)) goto parsing_done;
+ }
+
+ if (significant_digits == 0) {
+ octal = false;
+ }
+
+ if (*current == '.') {
+ if (octal && !allow_trailing_junk) return junk_string_value_;
+ if (octal) goto parsing_done;
+
+ if (Advance(&current, separator_, 10, end)) {
+ if (significant_digits == 0 && !leading_zero) {
+ return junk_string_value_;
+ } else {
+ goto parsing_done;
+ }
+ }
+
+ if (significant_digits == 0) {
+ // octal = false;
+ // Integer part consists of 0 or is absent. Significant digits start after
+ // leading zeros (if any).
+ while (*current == '0') {
+ if (Advance(&current, separator_, 10, end)) {
+ *processed_characters_count = static_cast<int>(current - input);
+ return SignedZero(sign);
+ }
+ exponent--; // Move this 0 into the exponent.
+ }
+ }
+
+ // There is a fractional part.
+ // We don't emit a '.', but adjust the exponent instead.
+ while (*current >= '0' && *current <= '9') {
+ if (significant_digits < kMaxSignificantDigits) {
+ DOUBLE_CONVERSION_ASSERT(buffer_pos < kBufferSize);
+ buffer[buffer_pos++] = static_cast<char>(*current);
+ significant_digits++;
+ exponent--;
+ } else {
+ // Ignore insignificant digits in the fractional part.
+ nonzero_digit_dropped = nonzero_digit_dropped || *current != '0';
+ }
+ if (Advance(&current, separator_, 10, end)) goto parsing_done;
+ }
+ }
+
+ if (!leading_zero && exponent == 0 && significant_digits == 0) {
+ // If leading_zeros is true then the string contains zeros.
+ // If exponent < 0 then string was [+-]\.0*...
+ // If significant_digits != 0 the string is not equal to 0.
+ // Otherwise there are no digits in the string.
+ return junk_string_value_;
+ }
+
+ // Parse exponential part.
+ if (*current == 'e' || *current == 'E') {
+ if (octal && !allow_trailing_junk) return junk_string_value_;
+ if (octal) goto parsing_done;
+ Iterator junk_begin = current;
+ ++current;
+ if (current == end) {
+ if (allow_trailing_junk) {
+ current = junk_begin;
+ goto parsing_done;
+ } else {
+ return junk_string_value_;
+ }
+ }
+ char exponen_sign = '+';
+ if (*current == '+' || *current == '-') {
+ exponen_sign = static_cast<char>(*current);
+ ++current;
+ if (current == end) {
+ if (allow_trailing_junk) {
+ current = junk_begin;
+ goto parsing_done;
+ } else {
+ return junk_string_value_;
+ }
+ }
+ }
+
+ if (current == end || *current < '0' || *current > '9') {
+ if (allow_trailing_junk) {
+ current = junk_begin;
+ goto parsing_done;
+ } else {
+ return junk_string_value_;
+ }
+ }
+
+ const int max_exponent = INT_MAX / 2;
+ DOUBLE_CONVERSION_ASSERT(-max_exponent / 2 <= exponent && exponent <= max_exponent / 2);
+ int num = 0;
+ do {
+ // Check overflow.
+ int digit = *current - '0';
+ if (num >= max_exponent / 10
+ && !(num == max_exponent / 10 && digit <= max_exponent % 10)) {
+ num = max_exponent;
+ } else {
+ num = num * 10 + digit;
+ }
+ ++current;
+ } while (current != end && *current >= '0' && *current <= '9');
+
+ exponent += (exponen_sign == '-' ? -num : num);
+ }
+
+ if (!(allow_trailing_spaces || allow_trailing_junk) && (current != end)) {
+ return junk_string_value_;
+ }
+ if (!allow_trailing_junk && AdvanceToNonspace(&current, end)) {
+ return junk_string_value_;
+ }
+ if (allow_trailing_spaces) {
+ AdvanceToNonspace(&current, end);
+ }
+
+ parsing_done:
+ exponent += insignificant_digits;
+
+ if (octal) {
+ double result;
+ bool result_is_junk;
+ char* start = buffer;
+ result = RadixStringToIeee<3>(&start,
+ buffer + buffer_pos,
+ sign,
+ separator_,
+ false, // Don't parse as hex_float.
+ allow_trailing_junk,
+ junk_string_value_,
+ read_as_double,
+ &result_is_junk);
+ DOUBLE_CONVERSION_ASSERT(!result_is_junk);
+ *processed_characters_count = static_cast<int>(current - input);
+ return result;
+ }
+
+ if (nonzero_digit_dropped) {
+ buffer[buffer_pos++] = '1';
+ exponent--;
+ }
+
+ DOUBLE_CONVERSION_ASSERT(buffer_pos < kBufferSize);
+ buffer[buffer_pos] = '\0';
+
+ double converted;
+ if (read_as_double) {
+ converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent);
+ } else {
+ converted = Strtof(Vector<const char>(buffer, buffer_pos), exponent);
+ }
+ *processed_characters_count = static_cast<int>(current - input);
+ return sign? -converted: converted;
+}
+
+
+double StringToDoubleConverter::StringToDouble(
+ const char* buffer,
+ int length,
+ int* processed_characters_count) const {
+ return StringToIeee(buffer, length, true, processed_characters_count);
+}
+
+
+double StringToDoubleConverter::StringToDouble(
+ const uc16* buffer,
+ int length,
+ int* processed_characters_count) const {
+ return StringToIeee(buffer, length, true, processed_characters_count);
+}
+
+
+float StringToDoubleConverter::StringToFloat(
+ const char* buffer,
+ int length,
+ int* processed_characters_count) const {
+ return static_cast<float>(StringToIeee(buffer, length, false,
+ processed_characters_count));
+}
+
+
+float StringToDoubleConverter::StringToFloat(
+ const uc16* buffer,
+ int length,
+ int* processed_characters_count) const {
+ return static_cast<float>(StringToIeee(buffer, length, false,
+ processed_characters_count));
+}
+
+} // namespace double_conversion
+
+// ICU PATCH: Close ICU namespace
+U_NAMESPACE_END
+#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/double-conversion-string-to-double.h b/contrib/libs/icu/i18n/double-conversion-string-to-double.h
index 2d1e02e91c..2eb0c1f897 100644
--- a/contrib/libs/icu/i18n/double-conversion-string-to-double.h
+++ b/contrib/libs/icu/i18n/double-conversion-string-to-double.h
@@ -1,244 +1,244 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// From the double-conversion library. Original license:
-//
-// Copyright 2012 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.
-
-// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-#ifndef DOUBLE_CONVERSION_STRING_TO_DOUBLE_H_
-#define DOUBLE_CONVERSION_STRING_TO_DOUBLE_H_
-
-// ICU PATCH: Customize header file paths for ICU.
-
-#include "double-conversion-utils.h"
-
-// ICU PATCH: Wrap in ICU namespace
-U_NAMESPACE_BEGIN
-
-namespace double_conversion {
-
-class StringToDoubleConverter {
- public:
- // Enumeration for allowing octals and ignoring junk when converting
- // strings to numbers.
- enum Flags {
- NO_FLAGS = 0,
- ALLOW_HEX = 1,
- ALLOW_OCTALS = 2,
- ALLOW_TRAILING_JUNK = 4,
- ALLOW_LEADING_SPACES = 8,
- ALLOW_TRAILING_SPACES = 16,
- ALLOW_SPACES_AFTER_SIGN = 32,
- ALLOW_CASE_INSENSITIVITY = 64,
- ALLOW_CASE_INSENSIBILITY = 64, // Deprecated
- ALLOW_HEX_FLOATS = 128,
- };
-
- static const uc16 kNoSeparator = '\0';
-
- // Flags should be a bit-or combination of the possible Flags-enum.
- // - NO_FLAGS: no special flags.
- // - ALLOW_HEX: recognizes the prefix "0x". Hex numbers may only be integers.
- // Ex: StringToDouble("0x1234") -> 4660.0
- // In StringToDouble("0x1234.56") the characters ".56" are trailing
- // junk. The result of the call is hence dependent on
- // the ALLOW_TRAILING_JUNK flag and/or the junk value.
- // With this flag "0x" is a junk-string. Even with ALLOW_TRAILING_JUNK,
- // the string will not be parsed as "0" followed by junk.
- //
- // - ALLOW_OCTALS: recognizes the prefix "0" for octals:
- // If a sequence of octal digits starts with '0', then the number is
- // read as octal integer. Octal numbers may only be integers.
- // Ex: StringToDouble("01234") -> 668.0
- // StringToDouble("012349") -> 12349.0 // Not a sequence of octal
- // // digits.
- // In StringToDouble("01234.56") the characters ".56" are trailing
- // junk. The result of the call is hence dependent on
- // the ALLOW_TRAILING_JUNK flag and/or the junk value.
- // In StringToDouble("01234e56") the characters "e56" are trailing
- // junk, too.
- // - ALLOW_TRAILING_JUNK: ignore trailing characters that are not part of
- // a double literal.
- // - ALLOW_LEADING_SPACES: skip over leading whitespace, including spaces,
- // new-lines, and tabs.
- // - ALLOW_TRAILING_SPACES: ignore trailing whitespace.
- // - ALLOW_SPACES_AFTER_SIGN: ignore whitespace after the sign.
- // Ex: StringToDouble("- 123.2") -> -123.2.
- // StringToDouble("+ 123.2") -> 123.2
- // - ALLOW_CASE_INSENSITIVITY: ignore case of characters for special values:
- // infinity and nan.
- // - ALLOW_HEX_FLOATS: allows hexadecimal float literals.
- // This *must* start with "0x" and separate the exponent with "p".
- // Examples: 0x1.2p3 == 9.0
- // 0x10.1p0 == 16.0625
- // ALLOW_HEX and ALLOW_HEX_FLOATS are indendent.
- //
- // empty_string_value is returned when an empty string is given as input.
- // If ALLOW_LEADING_SPACES or ALLOW_TRAILING_SPACES are set, then a string
- // containing only spaces is converted to the 'empty_string_value', too.
- //
- // junk_string_value is returned when
- // a) ALLOW_TRAILING_JUNK is not set, and a junk character (a character not
- // part of a double-literal) is found.
- // b) ALLOW_TRAILING_JUNK is set, but the string does not start with a
- // double literal.
- //
- // infinity_symbol and nan_symbol are strings that are used to detect
- // inputs that represent infinity and NaN. They can be null, in which case
- // they are ignored.
- // The conversion routine first reads any possible signs. Then it compares the
- // following character of the input-string with the first character of
- // the infinity, and nan-symbol. If either matches, the function assumes, that
- // a match has been found, and expects the following input characters to match
- // the remaining characters of the special-value symbol.
- // This means that the following restrictions apply to special-value symbols:
- // - they must not start with signs ('+', or '-'),
- // - they must not have the same first character.
- // - they must not start with digits.
- //
- // If the separator character is not kNoSeparator, then that specific
- // character is ignored when in between two valid digits of the significant.
- // It is not allowed to appear in the exponent.
- // It is not allowed to lead or trail the number.
- // It is not allowed to appear twice next to each other.
- //
- // Examples:
- // flags = ALLOW_HEX | ALLOW_TRAILING_JUNK,
- // empty_string_value = 0.0,
- // junk_string_value = NaN,
- // infinity_symbol = "infinity",
- // nan_symbol = "nan":
- // StringToDouble("0x1234") -> 4660.0.
- // StringToDouble("0x1234K") -> 4660.0.
- // StringToDouble("") -> 0.0 // empty_string_value.
- // StringToDouble(" ") -> NaN // junk_string_value.
- // StringToDouble(" 1") -> NaN // junk_string_value.
- // StringToDouble("0x") -> NaN // junk_string_value.
- // StringToDouble("-123.45") -> -123.45.
- // StringToDouble("--123.45") -> NaN // junk_string_value.
- // StringToDouble("123e45") -> 123e45.
- // StringToDouble("123E45") -> 123e45.
- // StringToDouble("123e+45") -> 123e45.
- // StringToDouble("123E-45") -> 123e-45.
- // StringToDouble("123e") -> 123.0 // trailing junk ignored.
- // StringToDouble("123e-") -> 123.0 // trailing junk ignored.
- // StringToDouble("+NaN") -> NaN // NaN string literal.
- // StringToDouble("-infinity") -> -inf. // infinity literal.
- // StringToDouble("Infinity") -> NaN // junk_string_value.
- //
- // flags = ALLOW_OCTAL | ALLOW_LEADING_SPACES,
- // empty_string_value = 0.0,
- // junk_string_value = NaN,
- // infinity_symbol = NULL,
- // nan_symbol = NULL:
- // StringToDouble("0x1234") -> NaN // junk_string_value.
- // StringToDouble("01234") -> 668.0.
- // StringToDouble("") -> 0.0 // empty_string_value.
- // StringToDouble(" ") -> 0.0 // empty_string_value.
- // StringToDouble(" 1") -> 1.0
- // StringToDouble("0x") -> NaN // junk_string_value.
- // StringToDouble("0123e45") -> NaN // junk_string_value.
- // StringToDouble("01239E45") -> 1239e45.
- // StringToDouble("-infinity") -> NaN // junk_string_value.
- // StringToDouble("NaN") -> NaN // junk_string_value.
- //
- // flags = NO_FLAGS,
- // separator = ' ':
- // StringToDouble("1 2 3 4") -> 1234.0
- // StringToDouble("1 2") -> NaN // junk_string_value
- // StringToDouble("1 000 000.0") -> 1000000.0
- // StringToDouble("1.000 000") -> 1.0
- // StringToDouble("1.0e1 000") -> NaN // junk_string_value
- StringToDoubleConverter(int flags,
- double empty_string_value,
- double junk_string_value,
- const char* infinity_symbol,
- const char* nan_symbol,
- uc16 separator = kNoSeparator)
- : flags_(flags),
- empty_string_value_(empty_string_value),
- junk_string_value_(junk_string_value),
- infinity_symbol_(infinity_symbol),
- nan_symbol_(nan_symbol),
- separator_(separator) {
- }
-
- // Performs the conversion.
- // The output parameter 'processed_characters_count' is set to the number
- // of characters that have been processed to read the number.
- // Spaces than are processed with ALLOW_{LEADING|TRAILING}_SPACES are included
- // in the 'processed_characters_count'. Trailing junk is never included.
- double StringToDouble(const char* buffer,
- int length,
- int* processed_characters_count) const;
-
- // Same as StringToDouble above but for 16 bit characters.
- double StringToDouble(const uc16* buffer,
- int length,
- int* processed_characters_count) const;
-
- // Same as StringToDouble but reads a float.
- // Note that this is not equivalent to static_cast<float>(StringToDouble(...))
- // due to potential double-rounding.
- float StringToFloat(const char* buffer,
- int length,
- int* processed_characters_count) const;
-
- // Same as StringToFloat above but for 16 bit characters.
- float StringToFloat(const uc16* buffer,
- int length,
- int* processed_characters_count) const;
-
- private:
- const int flags_;
- const double empty_string_value_;
- const double junk_string_value_;
- const char* const infinity_symbol_;
- const char* const nan_symbol_;
- const uc16 separator_;
-
- template <class Iterator>
- double StringToIeee(Iterator start_pointer,
- int length,
- bool read_as_double,
- int* processed_characters_count) const;
-
- DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS(StringToDoubleConverter);
-};
-
-} // namespace double_conversion
-
-// ICU PATCH: Close ICU namespace
-U_NAMESPACE_END
-
-#endif // DOUBLE_CONVERSION_STRING_TO_DOUBLE_H_
-#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+//
+// From the double-conversion library. Original license:
+//
+// Copyright 2012 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.
+
+// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+#ifndef DOUBLE_CONVERSION_STRING_TO_DOUBLE_H_
+#define DOUBLE_CONVERSION_STRING_TO_DOUBLE_H_
+
+// ICU PATCH: Customize header file paths for ICU.
+
+#include "double-conversion-utils.h"
+
+// ICU PATCH: Wrap in ICU namespace
+U_NAMESPACE_BEGIN
+
+namespace double_conversion {
+
+class StringToDoubleConverter {
+ public:
+ // Enumeration for allowing octals and ignoring junk when converting
+ // strings to numbers.
+ enum Flags {
+ NO_FLAGS = 0,
+ ALLOW_HEX = 1,
+ ALLOW_OCTALS = 2,
+ ALLOW_TRAILING_JUNK = 4,
+ ALLOW_LEADING_SPACES = 8,
+ ALLOW_TRAILING_SPACES = 16,
+ ALLOW_SPACES_AFTER_SIGN = 32,
+ ALLOW_CASE_INSENSITIVITY = 64,
+ ALLOW_CASE_INSENSIBILITY = 64, // Deprecated
+ ALLOW_HEX_FLOATS = 128,
+ };
+
+ static const uc16 kNoSeparator = '\0';
+
+ // Flags should be a bit-or combination of the possible Flags-enum.
+ // - NO_FLAGS: no special flags.
+ // - ALLOW_HEX: recognizes the prefix "0x". Hex numbers may only be integers.
+ // Ex: StringToDouble("0x1234") -> 4660.0
+ // In StringToDouble("0x1234.56") the characters ".56" are trailing
+ // junk. The result of the call is hence dependent on
+ // the ALLOW_TRAILING_JUNK flag and/or the junk value.
+ // With this flag "0x" is a junk-string. Even with ALLOW_TRAILING_JUNK,
+ // the string will not be parsed as "0" followed by junk.
+ //
+ // - ALLOW_OCTALS: recognizes the prefix "0" for octals:
+ // If a sequence of octal digits starts with '0', then the number is
+ // read as octal integer. Octal numbers may only be integers.
+ // Ex: StringToDouble("01234") -> 668.0
+ // StringToDouble("012349") -> 12349.0 // Not a sequence of octal
+ // // digits.
+ // In StringToDouble("01234.56") the characters ".56" are trailing
+ // junk. The result of the call is hence dependent on
+ // the ALLOW_TRAILING_JUNK flag and/or the junk value.
+ // In StringToDouble("01234e56") the characters "e56" are trailing
+ // junk, too.
+ // - ALLOW_TRAILING_JUNK: ignore trailing characters that are not part of
+ // a double literal.
+ // - ALLOW_LEADING_SPACES: skip over leading whitespace, including spaces,
+ // new-lines, and tabs.
+ // - ALLOW_TRAILING_SPACES: ignore trailing whitespace.
+ // - ALLOW_SPACES_AFTER_SIGN: ignore whitespace after the sign.
+ // Ex: StringToDouble("- 123.2") -> -123.2.
+ // StringToDouble("+ 123.2") -> 123.2
+ // - ALLOW_CASE_INSENSITIVITY: ignore case of characters for special values:
+ // infinity and nan.
+ // - ALLOW_HEX_FLOATS: allows hexadecimal float literals.
+ // This *must* start with "0x" and separate the exponent with "p".
+ // Examples: 0x1.2p3 == 9.0
+ // 0x10.1p0 == 16.0625
+ // ALLOW_HEX and ALLOW_HEX_FLOATS are indendent.
+ //
+ // empty_string_value is returned when an empty string is given as input.
+ // If ALLOW_LEADING_SPACES or ALLOW_TRAILING_SPACES are set, then a string
+ // containing only spaces is converted to the 'empty_string_value', too.
+ //
+ // junk_string_value is returned when
+ // a) ALLOW_TRAILING_JUNK is not set, and a junk character (a character not
+ // part of a double-literal) is found.
+ // b) ALLOW_TRAILING_JUNK is set, but the string does not start with a
+ // double literal.
+ //
+ // infinity_symbol and nan_symbol are strings that are used to detect
+ // inputs that represent infinity and NaN. They can be null, in which case
+ // they are ignored.
+ // The conversion routine first reads any possible signs. Then it compares the
+ // following character of the input-string with the first character of
+ // the infinity, and nan-symbol. If either matches, the function assumes, that
+ // a match has been found, and expects the following input characters to match
+ // the remaining characters of the special-value symbol.
+ // This means that the following restrictions apply to special-value symbols:
+ // - they must not start with signs ('+', or '-'),
+ // - they must not have the same first character.
+ // - they must not start with digits.
+ //
+ // If the separator character is not kNoSeparator, then that specific
+ // character is ignored when in between two valid digits of the significant.
+ // It is not allowed to appear in the exponent.
+ // It is not allowed to lead or trail the number.
+ // It is not allowed to appear twice next to each other.
+ //
+ // Examples:
+ // flags = ALLOW_HEX | ALLOW_TRAILING_JUNK,
+ // empty_string_value = 0.0,
+ // junk_string_value = NaN,
+ // infinity_symbol = "infinity",
+ // nan_symbol = "nan":
+ // StringToDouble("0x1234") -> 4660.0.
+ // StringToDouble("0x1234K") -> 4660.0.
+ // StringToDouble("") -> 0.0 // empty_string_value.
+ // StringToDouble(" ") -> NaN // junk_string_value.
+ // StringToDouble(" 1") -> NaN // junk_string_value.
+ // StringToDouble("0x") -> NaN // junk_string_value.
+ // StringToDouble("-123.45") -> -123.45.
+ // StringToDouble("--123.45") -> NaN // junk_string_value.
+ // StringToDouble("123e45") -> 123e45.
+ // StringToDouble("123E45") -> 123e45.
+ // StringToDouble("123e+45") -> 123e45.
+ // StringToDouble("123E-45") -> 123e-45.
+ // StringToDouble("123e") -> 123.0 // trailing junk ignored.
+ // StringToDouble("123e-") -> 123.0 // trailing junk ignored.
+ // StringToDouble("+NaN") -> NaN // NaN string literal.
+ // StringToDouble("-infinity") -> -inf. // infinity literal.
+ // StringToDouble("Infinity") -> NaN // junk_string_value.
+ //
+ // flags = ALLOW_OCTAL | ALLOW_LEADING_SPACES,
+ // empty_string_value = 0.0,
+ // junk_string_value = NaN,
+ // infinity_symbol = NULL,
+ // nan_symbol = NULL:
+ // StringToDouble("0x1234") -> NaN // junk_string_value.
+ // StringToDouble("01234") -> 668.0.
+ // StringToDouble("") -> 0.0 // empty_string_value.
+ // StringToDouble(" ") -> 0.0 // empty_string_value.
+ // StringToDouble(" 1") -> 1.0
+ // StringToDouble("0x") -> NaN // junk_string_value.
+ // StringToDouble("0123e45") -> NaN // junk_string_value.
+ // StringToDouble("01239E45") -> 1239e45.
+ // StringToDouble("-infinity") -> NaN // junk_string_value.
+ // StringToDouble("NaN") -> NaN // junk_string_value.
+ //
+ // flags = NO_FLAGS,
+ // separator = ' ':
+ // StringToDouble("1 2 3 4") -> 1234.0
+ // StringToDouble("1 2") -> NaN // junk_string_value
+ // StringToDouble("1 000 000.0") -> 1000000.0
+ // StringToDouble("1.000 000") -> 1.0
+ // StringToDouble("1.0e1 000") -> NaN // junk_string_value
+ StringToDoubleConverter(int flags,
+ double empty_string_value,
+ double junk_string_value,
+ const char* infinity_symbol,
+ const char* nan_symbol,
+ uc16 separator = kNoSeparator)
+ : flags_(flags),
+ empty_string_value_(empty_string_value),
+ junk_string_value_(junk_string_value),
+ infinity_symbol_(infinity_symbol),
+ nan_symbol_(nan_symbol),
+ separator_(separator) {
+ }
+
+ // Performs the conversion.
+ // The output parameter 'processed_characters_count' is set to the number
+ // of characters that have been processed to read the number.
+ // Spaces than are processed with ALLOW_{LEADING|TRAILING}_SPACES are included
+ // in the 'processed_characters_count'. Trailing junk is never included.
+ double StringToDouble(const char* buffer,
+ int length,
+ int* processed_characters_count) const;
+
+ // Same as StringToDouble above but for 16 bit characters.
+ double StringToDouble(const uc16* buffer,
+ int length,
+ int* processed_characters_count) const;
+
+ // Same as StringToDouble but reads a float.
+ // Note that this is not equivalent to static_cast<float>(StringToDouble(...))
+ // due to potential double-rounding.
+ float StringToFloat(const char* buffer,
+ int length,
+ int* processed_characters_count) const;
+
+ // Same as StringToFloat above but for 16 bit characters.
+ float StringToFloat(const uc16* buffer,
+ int length,
+ int* processed_characters_count) const;
+
+ private:
+ const int flags_;
+ const double empty_string_value_;
+ const double junk_string_value_;
+ const char* const infinity_symbol_;
+ const char* const nan_symbol_;
+ const uc16 separator_;
+
+ template <class Iterator>
+ double StringToIeee(Iterator start_pointer,
+ int length,
+ bool read_as_double,
+ int* processed_characters_count) const;
+
+ DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS(StringToDoubleConverter);
+};
+
+} // namespace double_conversion
+
+// ICU PATCH: Close ICU namespace
+U_NAMESPACE_END
+
+#endif // DOUBLE_CONVERSION_STRING_TO_DOUBLE_H_
+#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/double-conversion-strtod.cpp b/contrib/libs/icu/i18n/double-conversion-strtod.cpp
index 9b7244337f..ee6377782b 100644
--- a/contrib/libs/icu/i18n/double-conversion-strtod.cpp
+++ b/contrib/libs/icu/i18n/double-conversion-strtod.cpp
@@ -1,626 +1,626 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// From the double-conversion library. Original license:
-//
-// Copyright 2010 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.
-
-// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-#include <climits>
-#include <cstdarg>
-
-// ICU PATCH: Customize header file paths for ICU.
-
-#include "double-conversion-bignum.h"
-#include "double-conversion-cached-powers.h"
-#include "double-conversion-ieee.h"
-#include "double-conversion-strtod.h"
-
-// ICU PATCH: Wrap in ICU namespace
-U_NAMESPACE_BEGIN
-
-namespace double_conversion {
-
-#if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
-// 2^53 = 9007199254740992.
-// Any integer with at most 15 decimal digits will hence fit into a double
-// (which has a 53bit significand) without loss of precision.
-static const int kMaxExactDoubleIntegerDecimalDigits = 15;
-#endif // #if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
-// 2^64 = 18446744073709551616 > 10^19
-static const int kMaxUint64DecimalDigits = 19;
-
-// Max double: 1.7976931348623157 x 10^308
-// Min non-zero double: 4.9406564584124654 x 10^-324
-// Any x >= 10^309 is interpreted as +infinity.
-// Any x <= 10^-324 is interpreted as 0.
-// Note that 2.5e-324 (despite being smaller than the min double) will be read
-// as non-zero (equal to the min non-zero double).
-static const int kMaxDecimalPower = 309;
-static const int kMinDecimalPower = -324;
-
-// 2^64 = 18446744073709551616
-static const uint64_t kMaxUint64 = DOUBLE_CONVERSION_UINT64_2PART_C(0xFFFFFFFF, FFFFFFFF);
-
-
-#if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
-static const double exact_powers_of_ten[] = {
- 1.0, // 10^0
- 10.0,
- 100.0,
- 1000.0,
- 10000.0,
- 100000.0,
- 1000000.0,
- 10000000.0,
- 100000000.0,
- 1000000000.0,
- 10000000000.0, // 10^10
- 100000000000.0,
- 1000000000000.0,
- 10000000000000.0,
- 100000000000000.0,
- 1000000000000000.0,
- 10000000000000000.0,
- 100000000000000000.0,
- 1000000000000000000.0,
- 10000000000000000000.0,
- 100000000000000000000.0, // 10^20
- 1000000000000000000000.0,
- // 10^22 = 0x21e19e0c9bab2400000 = 0x878678326eac9 * 2^22
- 10000000000000000000000.0
-};
-static const int kExactPowersOfTenSize = DOUBLE_CONVERSION_ARRAY_SIZE(exact_powers_of_ten);
-#endif // #if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
-
-// Maximum number of significant digits in the decimal representation.
-// In fact the value is 772 (see conversions.cc), but to give us some margin
-// we round up to 780.
-static const int kMaxSignificantDecimalDigits = 780;
-
-static Vector<const char> TrimLeadingZeros(Vector<const char> buffer) {
- for (int i = 0; i < buffer.length(); i++) {
- if (buffer[i] != '0') {
- return buffer.SubVector(i, buffer.length());
- }
- }
- return Vector<const char>(buffer.start(), 0);
-}
-
-
-static Vector<const char> TrimTrailingZeros(Vector<const char> buffer) {
- for (int i = buffer.length() - 1; i >= 0; --i) {
- if (buffer[i] != '0') {
- return buffer.SubVector(0, i + 1);
- }
- }
- return Vector<const char>(buffer.start(), 0);
-}
-
-
-static void CutToMaxSignificantDigits(Vector<const char> buffer,
- int exponent,
- char* significant_buffer,
- int* significant_exponent) {
- for (int i = 0; i < kMaxSignificantDecimalDigits - 1; ++i) {
- significant_buffer[i] = buffer[i];
- }
- // The input buffer has been trimmed. Therefore the last digit must be
- // different from '0'.
- DOUBLE_CONVERSION_ASSERT(buffer[buffer.length() - 1] != '0');
- // Set the last digit to be non-zero. This is sufficient to guarantee
- // correct rounding.
- significant_buffer[kMaxSignificantDecimalDigits - 1] = '1';
- *significant_exponent =
- exponent + (buffer.length() - kMaxSignificantDecimalDigits);
-}
-
-
-// Trims the buffer and cuts it to at most kMaxSignificantDecimalDigits.
-// If possible the input-buffer is reused, but if the buffer needs to be
-// modified (due to cutting), then the input needs to be copied into the
-// buffer_copy_space.
-static void TrimAndCut(Vector<const char> buffer, int exponent,
- char* buffer_copy_space, int space_size,
- Vector<const char>* trimmed, int* updated_exponent) {
- Vector<const char> left_trimmed = TrimLeadingZeros(buffer);
- Vector<const char> right_trimmed = TrimTrailingZeros(left_trimmed);
- exponent += left_trimmed.length() - right_trimmed.length();
- if (right_trimmed.length() > kMaxSignificantDecimalDigits) {
- (void) space_size; // Mark variable as used.
- DOUBLE_CONVERSION_ASSERT(space_size >= kMaxSignificantDecimalDigits);
- CutToMaxSignificantDigits(right_trimmed, exponent,
- buffer_copy_space, updated_exponent);
- *trimmed = Vector<const char>(buffer_copy_space,
- kMaxSignificantDecimalDigits);
- } else {
- *trimmed = right_trimmed;
- *updated_exponent = exponent;
- }
-}
-
-
-// Reads digits from the buffer and converts them to a uint64.
-// Reads in as many digits as fit into a uint64.
-// When the string starts with "1844674407370955161" no further digit is read.
-// Since 2^64 = 18446744073709551616 it would still be possible read another
-// digit if it was less or equal than 6, but this would complicate the code.
-static uint64_t ReadUint64(Vector<const char> buffer,
- int* number_of_read_digits) {
- uint64_t result = 0;
- int i = 0;
- while (i < buffer.length() && result <= (kMaxUint64 / 10 - 1)) {
- int digit = buffer[i++] - '0';
- DOUBLE_CONVERSION_ASSERT(0 <= digit && digit <= 9);
- result = 10 * result + digit;
- }
- *number_of_read_digits = i;
- return result;
-}
-
-
-// Reads a DiyFp from the buffer.
-// The returned DiyFp is not necessarily normalized.
-// If remaining_decimals is zero then the returned DiyFp is accurate.
-// Otherwise it has been rounded and has error of at most 1/2 ulp.
-static void ReadDiyFp(Vector<const char> buffer,
- DiyFp* result,
- int* remaining_decimals) {
- int read_digits;
- uint64_t significand = ReadUint64(buffer, &read_digits);
- if (buffer.length() == read_digits) {
- *result = DiyFp(significand, 0);
- *remaining_decimals = 0;
- } else {
- // Round the significand.
- if (buffer[read_digits] >= '5') {
- significand++;
- }
- // Compute the binary exponent.
- int exponent = 0;
- *result = DiyFp(significand, exponent);
- *remaining_decimals = buffer.length() - read_digits;
- }
-}
-
-
-static bool DoubleStrtod(Vector<const char> trimmed,
- int exponent,
- double* result) {
-#if !defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
- // On x86 the floating-point stack can be 64 or 80 bits wide. If it is
- // 80 bits wide (as is the case on Linux) then double-rounding occurs and the
- // result is not accurate.
- // We know that Windows32 uses 64 bits and is therefore accurate.
- // Note that the ARM simulator is compiled for 32bits. It therefore exhibits
- // the same problem.
- return false;
-#else
- if (trimmed.length() <= kMaxExactDoubleIntegerDecimalDigits) {
- int read_digits;
- // The trimmed input fits into a double.
- // If the 10^exponent (resp. 10^-exponent) fits into a double too then we
- // can compute the result-double simply by multiplying (resp. dividing) the
- // two numbers.
- // This is possible because IEEE guarantees that floating-point operations
- // return the best possible approximation.
- if (exponent < 0 && -exponent < kExactPowersOfTenSize) {
- // 10^-exponent fits into a double.
- *result = static_cast<double>(ReadUint64(trimmed, &read_digits));
- DOUBLE_CONVERSION_ASSERT(read_digits == trimmed.length());
- *result /= exact_powers_of_ten[-exponent];
- return true;
- }
- if (0 <= exponent && exponent < kExactPowersOfTenSize) {
- // 10^exponent fits into a double.
- *result = static_cast<double>(ReadUint64(trimmed, &read_digits));
- DOUBLE_CONVERSION_ASSERT(read_digits == trimmed.length());
- *result *= exact_powers_of_ten[exponent];
- return true;
- }
- int remaining_digits =
- kMaxExactDoubleIntegerDecimalDigits - trimmed.length();
- if ((0 <= exponent) &&
- (exponent - remaining_digits < kExactPowersOfTenSize)) {
- // The trimmed string was short and we can multiply it with
- // 10^remaining_digits. As a result the remaining exponent now fits
- // into a double too.
- *result = static_cast<double>(ReadUint64(trimmed, &read_digits));
- DOUBLE_CONVERSION_ASSERT(read_digits == trimmed.length());
- *result *= exact_powers_of_ten[remaining_digits];
- *result *= exact_powers_of_ten[exponent - remaining_digits];
- return true;
- }
- }
- return false;
-#endif
-}
-
-
-// Returns 10^exponent as an exact DiyFp.
-// The given exponent must be in the range [1; kDecimalExponentDistance[.
-static DiyFp AdjustmentPowerOfTen(int exponent) {
- DOUBLE_CONVERSION_ASSERT(0 < exponent);
- DOUBLE_CONVERSION_ASSERT(exponent < PowersOfTenCache::kDecimalExponentDistance);
- // Simply hardcode the remaining powers for the given decimal exponent
- // distance.
- DOUBLE_CONVERSION_ASSERT(PowersOfTenCache::kDecimalExponentDistance == 8);
- switch (exponent) {
- case 1: return DiyFp(DOUBLE_CONVERSION_UINT64_2PART_C(0xa0000000, 00000000), -60);
- case 2: return DiyFp(DOUBLE_CONVERSION_UINT64_2PART_C(0xc8000000, 00000000), -57);
- case 3: return DiyFp(DOUBLE_CONVERSION_UINT64_2PART_C(0xfa000000, 00000000), -54);
- case 4: return DiyFp(DOUBLE_CONVERSION_UINT64_2PART_C(0x9c400000, 00000000), -50);
- case 5: return DiyFp(DOUBLE_CONVERSION_UINT64_2PART_C(0xc3500000, 00000000), -47);
- case 6: return DiyFp(DOUBLE_CONVERSION_UINT64_2PART_C(0xf4240000, 00000000), -44);
- case 7: return DiyFp(DOUBLE_CONVERSION_UINT64_2PART_C(0x98968000, 00000000), -40);
- default:
- DOUBLE_CONVERSION_UNREACHABLE();
- }
-}
-
-
-// If the function returns true then the result is the correct double.
-// Otherwise it is either the correct double or the double that is just below
-// the correct double.
-static bool DiyFpStrtod(Vector<const char> buffer,
- int exponent,
- double* result) {
- DiyFp input;
- int remaining_decimals;
- ReadDiyFp(buffer, &input, &remaining_decimals);
- // Since we may have dropped some digits the input is not accurate.
- // If remaining_decimals is different than 0 than the error is at most
- // .5 ulp (unit in the last place).
- // We don't want to deal with fractions and therefore keep a common
- // denominator.
- const int kDenominatorLog = 3;
- const int kDenominator = 1 << kDenominatorLog;
- // Move the remaining decimals into the exponent.
- exponent += remaining_decimals;
- uint64_t error = (remaining_decimals == 0 ? 0 : kDenominator / 2);
-
- int old_e = input.e();
- input.Normalize();
- error <<= old_e - input.e();
-
- DOUBLE_CONVERSION_ASSERT(exponent <= PowersOfTenCache::kMaxDecimalExponent);
- if (exponent < PowersOfTenCache::kMinDecimalExponent) {
- *result = 0.0;
- return true;
- }
- DiyFp cached_power;
- int cached_decimal_exponent;
- PowersOfTenCache::GetCachedPowerForDecimalExponent(exponent,
- &cached_power,
- &cached_decimal_exponent);
-
- if (cached_decimal_exponent != exponent) {
- int adjustment_exponent = exponent - cached_decimal_exponent;
- DiyFp adjustment_power = AdjustmentPowerOfTen(adjustment_exponent);
- input.Multiply(adjustment_power);
- if (kMaxUint64DecimalDigits - buffer.length() >= adjustment_exponent) {
- // The product of input with the adjustment power fits into a 64 bit
- // integer.
- DOUBLE_CONVERSION_ASSERT(DiyFp::kSignificandSize == 64);
- } else {
- // The adjustment power is exact. There is hence only an error of 0.5.
- error += kDenominator / 2;
- }
- }
-
- input.Multiply(cached_power);
- // The error introduced by a multiplication of a*b equals
- // error_a + error_b + error_a*error_b/2^64 + 0.5
- // Substituting a with 'input' and b with 'cached_power' we have
- // error_b = 0.5 (all cached powers have an error of less than 0.5 ulp),
- // error_ab = 0 or 1 / kDenominator > error_a*error_b/ 2^64
- int error_b = kDenominator / 2;
- int error_ab = (error == 0 ? 0 : 1); // We round up to 1.
- int fixed_error = kDenominator / 2;
- error += error_b + error_ab + fixed_error;
-
- old_e = input.e();
- input.Normalize();
- error <<= old_e - input.e();
-
- // See if the double's significand changes if we add/subtract the error.
- int order_of_magnitude = DiyFp::kSignificandSize + input.e();
- int effective_significand_size =
- Double::SignificandSizeForOrderOfMagnitude(order_of_magnitude);
- int precision_digits_count =
- DiyFp::kSignificandSize - effective_significand_size;
- if (precision_digits_count + kDenominatorLog >= DiyFp::kSignificandSize) {
- // This can only happen for very small denormals. In this case the
- // half-way multiplied by the denominator exceeds the range of an uint64.
- // Simply shift everything to the right.
- int shift_amount = (precision_digits_count + kDenominatorLog) -
- DiyFp::kSignificandSize + 1;
- input.set_f(input.f() >> shift_amount);
- input.set_e(input.e() + shift_amount);
- // We add 1 for the lost precision of error, and kDenominator for
- // the lost precision of input.f().
- error = (error >> shift_amount) + 1 + kDenominator;
- precision_digits_count -= shift_amount;
- }
- // We use uint64_ts now. This only works if the DiyFp uses uint64_ts too.
- DOUBLE_CONVERSION_ASSERT(DiyFp::kSignificandSize == 64);
- DOUBLE_CONVERSION_ASSERT(precision_digits_count < 64);
- uint64_t one64 = 1;
- uint64_t precision_bits_mask = (one64 << precision_digits_count) - 1;
- uint64_t precision_bits = input.f() & precision_bits_mask;
- uint64_t half_way = one64 << (precision_digits_count - 1);
- precision_bits *= kDenominator;
- half_way *= kDenominator;
- DiyFp rounded_input(input.f() >> precision_digits_count,
- input.e() + precision_digits_count);
- if (precision_bits >= half_way + error) {
- rounded_input.set_f(rounded_input.f() + 1);
- }
- // If the last_bits are too close to the half-way case than we are too
- // inaccurate and round down. In this case we return false so that we can
- // fall back to a more precise algorithm.
-
- *result = Double(rounded_input).value();
- if (half_way - error < precision_bits && precision_bits < half_way + error) {
- // Too imprecise. The caller will have to fall back to a slower version.
- // However the returned number is guaranteed to be either the correct
- // double, or the next-lower double.
- return false;
- } else {
- return true;
- }
-}
-
-
-// Returns
-// - -1 if buffer*10^exponent < diy_fp.
-// - 0 if buffer*10^exponent == diy_fp.
-// - +1 if buffer*10^exponent > diy_fp.
-// Preconditions:
-// buffer.length() + exponent <= kMaxDecimalPower + 1
-// buffer.length() + exponent > kMinDecimalPower
-// buffer.length() <= kMaxDecimalSignificantDigits
-static int CompareBufferWithDiyFp(Vector<const char> buffer,
- int exponent,
- DiyFp diy_fp) {
- DOUBLE_CONVERSION_ASSERT(buffer.length() + exponent <= kMaxDecimalPower + 1);
- DOUBLE_CONVERSION_ASSERT(buffer.length() + exponent > kMinDecimalPower);
- DOUBLE_CONVERSION_ASSERT(buffer.length() <= kMaxSignificantDecimalDigits);
- // Make sure that the Bignum will be able to hold all our numbers.
- // Our Bignum implementation has a separate field for exponents. Shifts will
- // consume at most one bigit (< 64 bits).
- // ln(10) == 3.3219...
- DOUBLE_CONVERSION_ASSERT(((kMaxDecimalPower + 1) * 333 / 100) < Bignum::kMaxSignificantBits);
- Bignum buffer_bignum;
- Bignum diy_fp_bignum;
- buffer_bignum.AssignDecimalString(buffer);
- diy_fp_bignum.AssignUInt64(diy_fp.f());
- if (exponent >= 0) {
- buffer_bignum.MultiplyByPowerOfTen(exponent);
- } else {
- diy_fp_bignum.MultiplyByPowerOfTen(-exponent);
- }
- if (diy_fp.e() > 0) {
- diy_fp_bignum.ShiftLeft(diy_fp.e());
- } else {
- buffer_bignum.ShiftLeft(-diy_fp.e());
- }
- return Bignum::Compare(buffer_bignum, diy_fp_bignum);
-}
-
-
-// Returns true if the guess is the correct double.
-// Returns false, when guess is either correct or the next-lower double.
-static bool ComputeGuess(Vector<const char> trimmed, int exponent,
- double* guess) {
- if (trimmed.length() == 0) {
- *guess = 0.0;
- return true;
- }
- if (exponent + trimmed.length() - 1 >= kMaxDecimalPower) {
- *guess = Double::Infinity();
- return true;
- }
- if (exponent + trimmed.length() <= kMinDecimalPower) {
- *guess = 0.0;
- return true;
- }
-
- if (DoubleStrtod(trimmed, exponent, guess) ||
- DiyFpStrtod(trimmed, exponent, guess)) {
- return true;
- }
- if (*guess == Double::Infinity()) {
- return true;
- }
- return false;
-}
-
-#if U_DEBUG // needed for ICU only in debug mode
-static bool IsDigit(const char d) {
- return ('0' <= d) && (d <= '9');
-}
-
-static bool IsNonZeroDigit(const char d) {
- return ('1' <= d) && (d <= '9');
-}
-
-static bool AssertTrimmedDigits(const Vector<const char>& buffer) {
- for(int i = 0; i < buffer.length(); ++i) {
- if(!IsDigit(buffer[i])) {
- return false;
- }
- }
- return (buffer.length() == 0) || (IsNonZeroDigit(buffer[0]) && IsNonZeroDigit(buffer[buffer.length()-1]));
-}
-#endif // needed for ICU only in debug mode
-
-double StrtodTrimmed(Vector<const char> trimmed, int exponent) {
- DOUBLE_CONVERSION_ASSERT(trimmed.length() <= kMaxSignificantDecimalDigits);
- DOUBLE_CONVERSION_ASSERT(AssertTrimmedDigits(trimmed));
- double guess;
- const bool is_correct = ComputeGuess(trimmed, exponent, &guess);
- if (is_correct) {
- return guess;
- }
- DiyFp upper_boundary = Double(guess).UpperBoundary();
- int comparison = CompareBufferWithDiyFp(trimmed, exponent, upper_boundary);
- if (comparison < 0) {
- return guess;
- } else if (comparison > 0) {
- return Double(guess).NextDouble();
- } else if ((Double(guess).Significand() & 1) == 0) {
- // Round towards even.
- return guess;
- } else {
- return Double(guess).NextDouble();
- }
-}
-
-double Strtod(Vector<const char> buffer, int exponent) {
- char copy_buffer[kMaxSignificantDecimalDigits];
- Vector<const char> trimmed;
- int updated_exponent;
- TrimAndCut(buffer, exponent, copy_buffer, kMaxSignificantDecimalDigits,
- &trimmed, &updated_exponent);
- return StrtodTrimmed(trimmed, updated_exponent);
-}
-
-static float SanitizedDoubletof(double d) {
- DOUBLE_CONVERSION_ASSERT(d >= 0.0);
- // ASAN has a sanitize check that disallows casting doubles to floats if
- // they are too big.
- // https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#available-checks
- // The behavior should be covered by IEEE 754, but some projects use this
- // flag, so work around it.
- float max_finite = 3.4028234663852885981170418348451692544e+38;
- // The half-way point between the max-finite and infinity value.
- // Since infinity has an even significand everything equal or greater than
- // this value should become infinity.
- double half_max_finite_infinity =
- 3.40282356779733661637539395458142568448e+38;
- if (d >= max_finite) {
- if (d >= half_max_finite_infinity) {
- return Single::Infinity();
- } else {
- return max_finite;
- }
- } else {
- return static_cast<float>(d);
- }
-}
-
-float Strtof(Vector<const char> buffer, int exponent) {
- char copy_buffer[kMaxSignificantDecimalDigits];
- Vector<const char> trimmed;
- int updated_exponent;
- TrimAndCut(buffer, exponent, copy_buffer, kMaxSignificantDecimalDigits,
- &trimmed, &updated_exponent);
- exponent = updated_exponent;
-
- double double_guess;
- bool is_correct = ComputeGuess(trimmed, exponent, &double_guess);
-
- float float_guess = SanitizedDoubletof(double_guess);
- if (float_guess == double_guess) {
- // This shortcut triggers for integer values.
- return float_guess;
- }
-
- // We must catch double-rounding. Say the double has been rounded up, and is
- // now a boundary of a float, and rounds up again. This is why we have to
- // look at previous too.
- // Example (in decimal numbers):
- // input: 12349
- // high-precision (4 digits): 1235
- // low-precision (3 digits):
- // when read from input: 123
- // when rounded from high precision: 124.
- // To do this we simply look at the neigbors of the correct result and see
- // if they would round to the same float. If the guess is not correct we have
- // to look at four values (since two different doubles could be the correct
- // double).
-
- double double_next = Double(double_guess).NextDouble();
- double double_previous = Double(double_guess).PreviousDouble();
-
- float f1 = SanitizedDoubletof(double_previous);
- float f2 = float_guess;
- float f3 = SanitizedDoubletof(double_next);
- float f4;
- if (is_correct) {
- f4 = f3;
- } else {
- double double_next2 = Double(double_next).NextDouble();
- f4 = SanitizedDoubletof(double_next2);
- }
- (void) f2; // Mark variable as used.
- DOUBLE_CONVERSION_ASSERT(f1 <= f2 && f2 <= f3 && f3 <= f4);
-
- // If the guess doesn't lie near a single-precision boundary we can simply
- // return its float-value.
- if (f1 == f4) {
- return float_guess;
- }
-
- DOUBLE_CONVERSION_ASSERT((f1 != f2 && f2 == f3 && f3 == f4) ||
- (f1 == f2 && f2 != f3 && f3 == f4) ||
- (f1 == f2 && f2 == f3 && f3 != f4));
-
- // guess and next are the two possible candidates (in the same way that
- // double_guess was the lower candidate for a double-precision guess).
- float guess = f1;
- float next = f4;
- DiyFp upper_boundary;
- if (guess == 0.0f) {
- float min_float = 1e-45f;
- upper_boundary = Double(static_cast<double>(min_float) / 2).AsDiyFp();
- } else {
- upper_boundary = Single(guess).UpperBoundary();
- }
- int comparison = CompareBufferWithDiyFp(trimmed, exponent, upper_boundary);
- if (comparison < 0) {
- return guess;
- } else if (comparison > 0) {
- return next;
- } else if ((Single(guess).Significand() & 1) == 0) {
- // Round towards even.
- return guess;
- } else {
- return next;
- }
-}
-
-} // namespace double_conversion
-
-// ICU PATCH: Close ICU namespace
-U_NAMESPACE_END
-#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+//
+// From the double-conversion library. Original license:
+//
+// Copyright 2010 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.
+
+// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+#include <climits>
+#include <cstdarg>
+
+// ICU PATCH: Customize header file paths for ICU.
+
+#include "double-conversion-bignum.h"
+#include "double-conversion-cached-powers.h"
+#include "double-conversion-ieee.h"
+#include "double-conversion-strtod.h"
+
+// ICU PATCH: Wrap in ICU namespace
+U_NAMESPACE_BEGIN
+
+namespace double_conversion {
+
+#if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
+// 2^53 = 9007199254740992.
+// Any integer with at most 15 decimal digits will hence fit into a double
+// (which has a 53bit significand) without loss of precision.
+static const int kMaxExactDoubleIntegerDecimalDigits = 15;
+#endif // #if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
+// 2^64 = 18446744073709551616 > 10^19
+static const int kMaxUint64DecimalDigits = 19;
+
+// Max double: 1.7976931348623157 x 10^308
+// Min non-zero double: 4.9406564584124654 x 10^-324
+// Any x >= 10^309 is interpreted as +infinity.
+// Any x <= 10^-324 is interpreted as 0.
+// Note that 2.5e-324 (despite being smaller than the min double) will be read
+// as non-zero (equal to the min non-zero double).
+static const int kMaxDecimalPower = 309;
+static const int kMinDecimalPower = -324;
+
+// 2^64 = 18446744073709551616
+static const uint64_t kMaxUint64 = DOUBLE_CONVERSION_UINT64_2PART_C(0xFFFFFFFF, FFFFFFFF);
+
+
+#if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
+static const double exact_powers_of_ten[] = {
+ 1.0, // 10^0
+ 10.0,
+ 100.0,
+ 1000.0,
+ 10000.0,
+ 100000.0,
+ 1000000.0,
+ 10000000.0,
+ 100000000.0,
+ 1000000000.0,
+ 10000000000.0, // 10^10
+ 100000000000.0,
+ 1000000000000.0,
+ 10000000000000.0,
+ 100000000000000.0,
+ 1000000000000000.0,
+ 10000000000000000.0,
+ 100000000000000000.0,
+ 1000000000000000000.0,
+ 10000000000000000000.0,
+ 100000000000000000000.0, // 10^20
+ 1000000000000000000000.0,
+ // 10^22 = 0x21e19e0c9bab2400000 = 0x878678326eac9 * 2^22
+ 10000000000000000000000.0
+};
+static const int kExactPowersOfTenSize = DOUBLE_CONVERSION_ARRAY_SIZE(exact_powers_of_ten);
+#endif // #if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
+
+// Maximum number of significant digits in the decimal representation.
+// In fact the value is 772 (see conversions.cc), but to give us some margin
+// we round up to 780.
+static const int kMaxSignificantDecimalDigits = 780;
+
+static Vector<const char> TrimLeadingZeros(Vector<const char> buffer) {
+ for (int i = 0; i < buffer.length(); i++) {
+ if (buffer[i] != '0') {
+ return buffer.SubVector(i, buffer.length());
+ }
+ }
+ return Vector<const char>(buffer.start(), 0);
+}
+
+
+static Vector<const char> TrimTrailingZeros(Vector<const char> buffer) {
+ for (int i = buffer.length() - 1; i >= 0; --i) {
+ if (buffer[i] != '0') {
+ return buffer.SubVector(0, i + 1);
+ }
+ }
+ return Vector<const char>(buffer.start(), 0);
+}
+
+
+static void CutToMaxSignificantDigits(Vector<const char> buffer,
+ int exponent,
+ char* significant_buffer,
+ int* significant_exponent) {
+ for (int i = 0; i < kMaxSignificantDecimalDigits - 1; ++i) {
+ significant_buffer[i] = buffer[i];
+ }
+ // The input buffer has been trimmed. Therefore the last digit must be
+ // different from '0'.
+ DOUBLE_CONVERSION_ASSERT(buffer[buffer.length() - 1] != '0');
+ // Set the last digit to be non-zero. This is sufficient to guarantee
+ // correct rounding.
+ significant_buffer[kMaxSignificantDecimalDigits - 1] = '1';
+ *significant_exponent =
+ exponent + (buffer.length() - kMaxSignificantDecimalDigits);
+}
+
+
+// Trims the buffer and cuts it to at most kMaxSignificantDecimalDigits.
+// If possible the input-buffer is reused, but if the buffer needs to be
+// modified (due to cutting), then the input needs to be copied into the
+// buffer_copy_space.
+static void TrimAndCut(Vector<const char> buffer, int exponent,
+ char* buffer_copy_space, int space_size,
+ Vector<const char>* trimmed, int* updated_exponent) {
+ Vector<const char> left_trimmed = TrimLeadingZeros(buffer);
+ Vector<const char> right_trimmed = TrimTrailingZeros(left_trimmed);
+ exponent += left_trimmed.length() - right_trimmed.length();
+ if (right_trimmed.length() > kMaxSignificantDecimalDigits) {
+ (void) space_size; // Mark variable as used.
+ DOUBLE_CONVERSION_ASSERT(space_size >= kMaxSignificantDecimalDigits);
+ CutToMaxSignificantDigits(right_trimmed, exponent,
+ buffer_copy_space, updated_exponent);
+ *trimmed = Vector<const char>(buffer_copy_space,
+ kMaxSignificantDecimalDigits);
+ } else {
+ *trimmed = right_trimmed;
+ *updated_exponent = exponent;
+ }
+}
+
+
+// Reads digits from the buffer and converts them to a uint64.
+// Reads in as many digits as fit into a uint64.
+// When the string starts with "1844674407370955161" no further digit is read.
+// Since 2^64 = 18446744073709551616 it would still be possible read another
+// digit if it was less or equal than 6, but this would complicate the code.
+static uint64_t ReadUint64(Vector<const char> buffer,
+ int* number_of_read_digits) {
+ uint64_t result = 0;
+ int i = 0;
+ while (i < buffer.length() && result <= (kMaxUint64 / 10 - 1)) {
+ int digit = buffer[i++] - '0';
+ DOUBLE_CONVERSION_ASSERT(0 <= digit && digit <= 9);
+ result = 10 * result + digit;
+ }
+ *number_of_read_digits = i;
+ return result;
+}
+
+
+// Reads a DiyFp from the buffer.
+// The returned DiyFp is not necessarily normalized.
+// If remaining_decimals is zero then the returned DiyFp is accurate.
+// Otherwise it has been rounded and has error of at most 1/2 ulp.
+static void ReadDiyFp(Vector<const char> buffer,
+ DiyFp* result,
+ int* remaining_decimals) {
+ int read_digits;
+ uint64_t significand = ReadUint64(buffer, &read_digits);
+ if (buffer.length() == read_digits) {
+ *result = DiyFp(significand, 0);
+ *remaining_decimals = 0;
+ } else {
+ // Round the significand.
+ if (buffer[read_digits] >= '5') {
+ significand++;
+ }
+ // Compute the binary exponent.
+ int exponent = 0;
+ *result = DiyFp(significand, exponent);
+ *remaining_decimals = buffer.length() - read_digits;
+ }
+}
+
+
+static bool DoubleStrtod(Vector<const char> trimmed,
+ int exponent,
+ double* result) {
+#if !defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
+ // On x86 the floating-point stack can be 64 or 80 bits wide. If it is
+ // 80 bits wide (as is the case on Linux) then double-rounding occurs and the
+ // result is not accurate.
+ // We know that Windows32 uses 64 bits and is therefore accurate.
+ // Note that the ARM simulator is compiled for 32bits. It therefore exhibits
+ // the same problem.
+ return false;
+#else
+ if (trimmed.length() <= kMaxExactDoubleIntegerDecimalDigits) {
+ int read_digits;
+ // The trimmed input fits into a double.
+ // If the 10^exponent (resp. 10^-exponent) fits into a double too then we
+ // can compute the result-double simply by multiplying (resp. dividing) the
+ // two numbers.
+ // This is possible because IEEE guarantees that floating-point operations
+ // return the best possible approximation.
+ if (exponent < 0 && -exponent < kExactPowersOfTenSize) {
+ // 10^-exponent fits into a double.
+ *result = static_cast<double>(ReadUint64(trimmed, &read_digits));
+ DOUBLE_CONVERSION_ASSERT(read_digits == trimmed.length());
+ *result /= exact_powers_of_ten[-exponent];
+ return true;
+ }
+ if (0 <= exponent && exponent < kExactPowersOfTenSize) {
+ // 10^exponent fits into a double.
+ *result = static_cast<double>(ReadUint64(trimmed, &read_digits));
+ DOUBLE_CONVERSION_ASSERT(read_digits == trimmed.length());
+ *result *= exact_powers_of_ten[exponent];
+ return true;
+ }
+ int remaining_digits =
+ kMaxExactDoubleIntegerDecimalDigits - trimmed.length();
+ if ((0 <= exponent) &&
+ (exponent - remaining_digits < kExactPowersOfTenSize)) {
+ // The trimmed string was short and we can multiply it with
+ // 10^remaining_digits. As a result the remaining exponent now fits
+ // into a double too.
+ *result = static_cast<double>(ReadUint64(trimmed, &read_digits));
+ DOUBLE_CONVERSION_ASSERT(read_digits == trimmed.length());
+ *result *= exact_powers_of_ten[remaining_digits];
+ *result *= exact_powers_of_ten[exponent - remaining_digits];
+ return true;
+ }
+ }
+ return false;
+#endif
+}
+
+
+// Returns 10^exponent as an exact DiyFp.
+// The given exponent must be in the range [1; kDecimalExponentDistance[.
+static DiyFp AdjustmentPowerOfTen(int exponent) {
+ DOUBLE_CONVERSION_ASSERT(0 < exponent);
+ DOUBLE_CONVERSION_ASSERT(exponent < PowersOfTenCache::kDecimalExponentDistance);
+ // Simply hardcode the remaining powers for the given decimal exponent
+ // distance.
+ DOUBLE_CONVERSION_ASSERT(PowersOfTenCache::kDecimalExponentDistance == 8);
+ switch (exponent) {
+ case 1: return DiyFp(DOUBLE_CONVERSION_UINT64_2PART_C(0xa0000000, 00000000), -60);
+ case 2: return DiyFp(DOUBLE_CONVERSION_UINT64_2PART_C(0xc8000000, 00000000), -57);
+ case 3: return DiyFp(DOUBLE_CONVERSION_UINT64_2PART_C(0xfa000000, 00000000), -54);
+ case 4: return DiyFp(DOUBLE_CONVERSION_UINT64_2PART_C(0x9c400000, 00000000), -50);
+ case 5: return DiyFp(DOUBLE_CONVERSION_UINT64_2PART_C(0xc3500000, 00000000), -47);
+ case 6: return DiyFp(DOUBLE_CONVERSION_UINT64_2PART_C(0xf4240000, 00000000), -44);
+ case 7: return DiyFp(DOUBLE_CONVERSION_UINT64_2PART_C(0x98968000, 00000000), -40);
+ default:
+ DOUBLE_CONVERSION_UNREACHABLE();
+ }
+}
+
+
+// If the function returns true then the result is the correct double.
+// Otherwise it is either the correct double or the double that is just below
+// the correct double.
+static bool DiyFpStrtod(Vector<const char> buffer,
+ int exponent,
+ double* result) {
+ DiyFp input;
+ int remaining_decimals;
+ ReadDiyFp(buffer, &input, &remaining_decimals);
+ // Since we may have dropped some digits the input is not accurate.
+ // If remaining_decimals is different than 0 than the error is at most
+ // .5 ulp (unit in the last place).
+ // We don't want to deal with fractions and therefore keep a common
+ // denominator.
+ const int kDenominatorLog = 3;
+ const int kDenominator = 1 << kDenominatorLog;
+ // Move the remaining decimals into the exponent.
+ exponent += remaining_decimals;
+ uint64_t error = (remaining_decimals == 0 ? 0 : kDenominator / 2);
+
+ int old_e = input.e();
+ input.Normalize();
+ error <<= old_e - input.e();
+
+ DOUBLE_CONVERSION_ASSERT(exponent <= PowersOfTenCache::kMaxDecimalExponent);
+ if (exponent < PowersOfTenCache::kMinDecimalExponent) {
+ *result = 0.0;
+ return true;
+ }
+ DiyFp cached_power;
+ int cached_decimal_exponent;
+ PowersOfTenCache::GetCachedPowerForDecimalExponent(exponent,
+ &cached_power,
+ &cached_decimal_exponent);
+
+ if (cached_decimal_exponent != exponent) {
+ int adjustment_exponent = exponent - cached_decimal_exponent;
+ DiyFp adjustment_power = AdjustmentPowerOfTen(adjustment_exponent);
+ input.Multiply(adjustment_power);
+ if (kMaxUint64DecimalDigits - buffer.length() >= adjustment_exponent) {
+ // The product of input with the adjustment power fits into a 64 bit
+ // integer.
+ DOUBLE_CONVERSION_ASSERT(DiyFp::kSignificandSize == 64);
+ } else {
+ // The adjustment power is exact. There is hence only an error of 0.5.
+ error += kDenominator / 2;
+ }
+ }
+
+ input.Multiply(cached_power);
+ // The error introduced by a multiplication of a*b equals
+ // error_a + error_b + error_a*error_b/2^64 + 0.5
+ // Substituting a with 'input' and b with 'cached_power' we have
+ // error_b = 0.5 (all cached powers have an error of less than 0.5 ulp),
+ // error_ab = 0 or 1 / kDenominator > error_a*error_b/ 2^64
+ int error_b = kDenominator / 2;
+ int error_ab = (error == 0 ? 0 : 1); // We round up to 1.
+ int fixed_error = kDenominator / 2;
+ error += error_b + error_ab + fixed_error;
+
+ old_e = input.e();
+ input.Normalize();
+ error <<= old_e - input.e();
+
+ // See if the double's significand changes if we add/subtract the error.
+ int order_of_magnitude = DiyFp::kSignificandSize + input.e();
+ int effective_significand_size =
+ Double::SignificandSizeForOrderOfMagnitude(order_of_magnitude);
+ int precision_digits_count =
+ DiyFp::kSignificandSize - effective_significand_size;
+ if (precision_digits_count + kDenominatorLog >= DiyFp::kSignificandSize) {
+ // This can only happen for very small denormals. In this case the
+ // half-way multiplied by the denominator exceeds the range of an uint64.
+ // Simply shift everything to the right.
+ int shift_amount = (precision_digits_count + kDenominatorLog) -
+ DiyFp::kSignificandSize + 1;
+ input.set_f(input.f() >> shift_amount);
+ input.set_e(input.e() + shift_amount);
+ // We add 1 for the lost precision of error, and kDenominator for
+ // the lost precision of input.f().
+ error = (error >> shift_amount) + 1 + kDenominator;
+ precision_digits_count -= shift_amount;
+ }
+ // We use uint64_ts now. This only works if the DiyFp uses uint64_ts too.
+ DOUBLE_CONVERSION_ASSERT(DiyFp::kSignificandSize == 64);
+ DOUBLE_CONVERSION_ASSERT(precision_digits_count < 64);
+ uint64_t one64 = 1;
+ uint64_t precision_bits_mask = (one64 << precision_digits_count) - 1;
+ uint64_t precision_bits = input.f() & precision_bits_mask;
+ uint64_t half_way = one64 << (precision_digits_count - 1);
+ precision_bits *= kDenominator;
+ half_way *= kDenominator;
+ DiyFp rounded_input(input.f() >> precision_digits_count,
+ input.e() + precision_digits_count);
+ if (precision_bits >= half_way + error) {
+ rounded_input.set_f(rounded_input.f() + 1);
+ }
+ // If the last_bits are too close to the half-way case than we are too
+ // inaccurate and round down. In this case we return false so that we can
+ // fall back to a more precise algorithm.
+
+ *result = Double(rounded_input).value();
+ if (half_way - error < precision_bits && precision_bits < half_way + error) {
+ // Too imprecise. The caller will have to fall back to a slower version.
+ // However the returned number is guaranteed to be either the correct
+ // double, or the next-lower double.
+ return false;
+ } else {
+ return true;
+ }
+}
+
+
+// Returns
+// - -1 if buffer*10^exponent < diy_fp.
+// - 0 if buffer*10^exponent == diy_fp.
+// - +1 if buffer*10^exponent > diy_fp.
+// Preconditions:
+// buffer.length() + exponent <= kMaxDecimalPower + 1
+// buffer.length() + exponent > kMinDecimalPower
+// buffer.length() <= kMaxDecimalSignificantDigits
+static int CompareBufferWithDiyFp(Vector<const char> buffer,
+ int exponent,
+ DiyFp diy_fp) {
+ DOUBLE_CONVERSION_ASSERT(buffer.length() + exponent <= kMaxDecimalPower + 1);
+ DOUBLE_CONVERSION_ASSERT(buffer.length() + exponent > kMinDecimalPower);
+ DOUBLE_CONVERSION_ASSERT(buffer.length() <= kMaxSignificantDecimalDigits);
+ // Make sure that the Bignum will be able to hold all our numbers.
+ // Our Bignum implementation has a separate field for exponents. Shifts will
+ // consume at most one bigit (< 64 bits).
+ // ln(10) == 3.3219...
+ DOUBLE_CONVERSION_ASSERT(((kMaxDecimalPower + 1) * 333 / 100) < Bignum::kMaxSignificantBits);
+ Bignum buffer_bignum;
+ Bignum diy_fp_bignum;
+ buffer_bignum.AssignDecimalString(buffer);
+ diy_fp_bignum.AssignUInt64(diy_fp.f());
+ if (exponent >= 0) {
+ buffer_bignum.MultiplyByPowerOfTen(exponent);
+ } else {
+ diy_fp_bignum.MultiplyByPowerOfTen(-exponent);
+ }
+ if (diy_fp.e() > 0) {
+ diy_fp_bignum.ShiftLeft(diy_fp.e());
+ } else {
+ buffer_bignum.ShiftLeft(-diy_fp.e());
+ }
+ return Bignum::Compare(buffer_bignum, diy_fp_bignum);
+}
+
+
+// Returns true if the guess is the correct double.
+// Returns false, when guess is either correct or the next-lower double.
+static bool ComputeGuess(Vector<const char> trimmed, int exponent,
+ double* guess) {
+ if (trimmed.length() == 0) {
+ *guess = 0.0;
+ return true;
+ }
+ if (exponent + trimmed.length() - 1 >= kMaxDecimalPower) {
+ *guess = Double::Infinity();
+ return true;
+ }
+ if (exponent + trimmed.length() <= kMinDecimalPower) {
+ *guess = 0.0;
+ return true;
+ }
+
+ if (DoubleStrtod(trimmed, exponent, guess) ||
+ DiyFpStrtod(trimmed, exponent, guess)) {
+ return true;
+ }
+ if (*guess == Double::Infinity()) {
+ return true;
+ }
+ return false;
+}
+
+#if U_DEBUG // needed for ICU only in debug mode
+static bool IsDigit(const char d) {
+ return ('0' <= d) && (d <= '9');
+}
+
+static bool IsNonZeroDigit(const char d) {
+ return ('1' <= d) && (d <= '9');
+}
+
+static bool AssertTrimmedDigits(const Vector<const char>& buffer) {
+ for(int i = 0; i < buffer.length(); ++i) {
+ if(!IsDigit(buffer[i])) {
+ return false;
+ }
+ }
+ return (buffer.length() == 0) || (IsNonZeroDigit(buffer[0]) && IsNonZeroDigit(buffer[buffer.length()-1]));
+}
+#endif // needed for ICU only in debug mode
+
+double StrtodTrimmed(Vector<const char> trimmed, int exponent) {
+ DOUBLE_CONVERSION_ASSERT(trimmed.length() <= kMaxSignificantDecimalDigits);
+ DOUBLE_CONVERSION_ASSERT(AssertTrimmedDigits(trimmed));
+ double guess;
+ const bool is_correct = ComputeGuess(trimmed, exponent, &guess);
+ if (is_correct) {
+ return guess;
+ }
+ DiyFp upper_boundary = Double(guess).UpperBoundary();
+ int comparison = CompareBufferWithDiyFp(trimmed, exponent, upper_boundary);
+ if (comparison < 0) {
+ return guess;
+ } else if (comparison > 0) {
+ return Double(guess).NextDouble();
+ } else if ((Double(guess).Significand() & 1) == 0) {
+ // Round towards even.
+ return guess;
+ } else {
+ return Double(guess).NextDouble();
+ }
+}
+
+double Strtod(Vector<const char> buffer, int exponent) {
+ char copy_buffer[kMaxSignificantDecimalDigits];
+ Vector<const char> trimmed;
+ int updated_exponent;
+ TrimAndCut(buffer, exponent, copy_buffer, kMaxSignificantDecimalDigits,
+ &trimmed, &updated_exponent);
+ return StrtodTrimmed(trimmed, updated_exponent);
+}
+
+static float SanitizedDoubletof(double d) {
+ DOUBLE_CONVERSION_ASSERT(d >= 0.0);
+ // ASAN has a sanitize check that disallows casting doubles to floats if
+ // they are too big.
+ // https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#available-checks
+ // The behavior should be covered by IEEE 754, but some projects use this
+ // flag, so work around it.
+ float max_finite = 3.4028234663852885981170418348451692544e+38;
+ // The half-way point between the max-finite and infinity value.
+ // Since infinity has an even significand everything equal or greater than
+ // this value should become infinity.
+ double half_max_finite_infinity =
+ 3.40282356779733661637539395458142568448e+38;
+ if (d >= max_finite) {
+ if (d >= half_max_finite_infinity) {
+ return Single::Infinity();
+ } else {
+ return max_finite;
+ }
+ } else {
+ return static_cast<float>(d);
+ }
+}
+
+float Strtof(Vector<const char> buffer, int exponent) {
+ char copy_buffer[kMaxSignificantDecimalDigits];
+ Vector<const char> trimmed;
+ int updated_exponent;
+ TrimAndCut(buffer, exponent, copy_buffer, kMaxSignificantDecimalDigits,
+ &trimmed, &updated_exponent);
+ exponent = updated_exponent;
+
+ double double_guess;
+ bool is_correct = ComputeGuess(trimmed, exponent, &double_guess);
+
+ float float_guess = SanitizedDoubletof(double_guess);
+ if (float_guess == double_guess) {
+ // This shortcut triggers for integer values.
+ return float_guess;
+ }
+
+ // We must catch double-rounding. Say the double has been rounded up, and is
+ // now a boundary of a float, and rounds up again. This is why we have to
+ // look at previous too.
+ // Example (in decimal numbers):
+ // input: 12349
+ // high-precision (4 digits): 1235
+ // low-precision (3 digits):
+ // when read from input: 123
+ // when rounded from high precision: 124.
+ // To do this we simply look at the neigbors of the correct result and see
+ // if they would round to the same float. If the guess is not correct we have
+ // to look at four values (since two different doubles could be the correct
+ // double).
+
+ double double_next = Double(double_guess).NextDouble();
+ double double_previous = Double(double_guess).PreviousDouble();
+
+ float f1 = SanitizedDoubletof(double_previous);
+ float f2 = float_guess;
+ float f3 = SanitizedDoubletof(double_next);
+ float f4;
+ if (is_correct) {
+ f4 = f3;
+ } else {
+ double double_next2 = Double(double_next).NextDouble();
+ f4 = SanitizedDoubletof(double_next2);
+ }
+ (void) f2; // Mark variable as used.
+ DOUBLE_CONVERSION_ASSERT(f1 <= f2 && f2 <= f3 && f3 <= f4);
+
+ // If the guess doesn't lie near a single-precision boundary we can simply
+ // return its float-value.
+ if (f1 == f4) {
+ return float_guess;
+ }
+
+ DOUBLE_CONVERSION_ASSERT((f1 != f2 && f2 == f3 && f3 == f4) ||
+ (f1 == f2 && f2 != f3 && f3 == f4) ||
+ (f1 == f2 && f2 == f3 && f3 != f4));
+
+ // guess and next are the two possible candidates (in the same way that
+ // double_guess was the lower candidate for a double-precision guess).
+ float guess = f1;
+ float next = f4;
+ DiyFp upper_boundary;
+ if (guess == 0.0f) {
+ float min_float = 1e-45f;
+ upper_boundary = Double(static_cast<double>(min_float) / 2).AsDiyFp();
+ } else {
+ upper_boundary = Single(guess).UpperBoundary();
+ }
+ int comparison = CompareBufferWithDiyFp(trimmed, exponent, upper_boundary);
+ if (comparison < 0) {
+ return guess;
+ } else if (comparison > 0) {
+ return next;
+ } else if ((Single(guess).Significand() & 1) == 0) {
+ // Round towards even.
+ return guess;
+ } else {
+ return next;
+ }
+}
+
+} // namespace double_conversion
+
+// ICU PATCH: Close ICU namespace
+U_NAMESPACE_END
+#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/double-conversion-strtod.h b/contrib/libs/icu/i18n/double-conversion-strtod.h
index 871bff8da6..50ef746401 100644
--- a/contrib/libs/icu/i18n/double-conversion-strtod.h
+++ b/contrib/libs/icu/i18n/double-conversion-strtod.h
@@ -1,68 +1,68 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// From the double-conversion library. Original license:
-//
-// Copyright 2010 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.
-
-// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-#ifndef DOUBLE_CONVERSION_STRTOD_H_
-#define DOUBLE_CONVERSION_STRTOD_H_
-
-// ICU PATCH: Customize header file paths for ICU.
-
-#include "double-conversion-utils.h"
-
-// ICU PATCH: Wrap in ICU namespace
-U_NAMESPACE_BEGIN
-
-namespace double_conversion {
-
-// The buffer must only contain digits in the range [0-9]. It must not
-// contain a dot or a sign. It must not start with '0', and must not be empty.
-double Strtod(Vector<const char> buffer, int exponent);
-
-// The buffer must only contain digits in the range [0-9]. It must not
-// contain a dot or a sign. It must not start with '0', and must not be empty.
-float Strtof(Vector<const char> buffer, int exponent);
-
-// For special use cases, the heart of the Strtod() function is also available
-// separately, it assumes that 'trimmed' is as produced by TrimAndCut(), i.e.
-// no leading or trailing zeros, also no lone zero, and not 'too many' digits.
-double StrtodTrimmed(Vector<const char> trimmed, int exponent);
-
-} // namespace double_conversion
-
-// ICU PATCH: Close ICU namespace
-U_NAMESPACE_END
-
-#endif // DOUBLE_CONVERSION_STRTOD_H_
-#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+//
+// From the double-conversion library. Original license:
+//
+// Copyright 2010 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.
+
+// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+#ifndef DOUBLE_CONVERSION_STRTOD_H_
+#define DOUBLE_CONVERSION_STRTOD_H_
+
+// ICU PATCH: Customize header file paths for ICU.
+
+#include "double-conversion-utils.h"
+
+// ICU PATCH: Wrap in ICU namespace
+U_NAMESPACE_BEGIN
+
+namespace double_conversion {
+
+// The buffer must only contain digits in the range [0-9]. It must not
+// contain a dot or a sign. It must not start with '0', and must not be empty.
+double Strtod(Vector<const char> buffer, int exponent);
+
+// The buffer must only contain digits in the range [0-9]. It must not
+// contain a dot or a sign. It must not start with '0', and must not be empty.
+float Strtof(Vector<const char> buffer, int exponent);
+
+// For special use cases, the heart of the Strtod() function is also available
+// separately, it assumes that 'trimmed' is as produced by TrimAndCut(), i.e.
+// no leading or trailing zeros, also no lone zero, and not 'too many' digits.
+double StrtodTrimmed(Vector<const char> trimmed, int exponent);
+
+} // namespace double_conversion
+
+// ICU PATCH: Close ICU namespace
+U_NAMESPACE_END
+
+#endif // DOUBLE_CONVERSION_STRTOD_H_
+#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/double-conversion-utils.h b/contrib/libs/icu/i18n/double-conversion-utils.h
index 1e2647b9d6..8c6a0e16e0 100644
--- a/contrib/libs/icu/i18n/double-conversion-utils.h
+++ b/contrib/libs/icu/i18n/double-conversion-utils.h
@@ -1,389 +1,389 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// From the double-conversion library. Original license:
-//
-// Copyright 2010 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.
-
-// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-#ifndef DOUBLE_CONVERSION_UTILS_H_
-#define DOUBLE_CONVERSION_UTILS_H_
-
-#include <cstdlib>
-#include <cstring>
-
-// ICU PATCH: Use U_ASSERT instead of <assert.h>
-#include "uassert.h"
-#ifndef DOUBLE_CONVERSION_ASSERT
-#define DOUBLE_CONVERSION_ASSERT(condition) \
- U_ASSERT(condition);
-#endif
-#ifndef DOUBLE_CONVERSION_UNIMPLEMENTED
-#define DOUBLE_CONVERSION_UNIMPLEMENTED() (abort())
-#endif
-#ifndef DOUBLE_CONVERSION_NO_RETURN
-#ifdef _MSC_VER
-#define DOUBLE_CONVERSION_NO_RETURN __declspec(noreturn)
-#else
-#define DOUBLE_CONVERSION_NO_RETURN __attribute__((noreturn))
-#endif
-#endif
-#ifndef DOUBLE_CONVERSION_UNREACHABLE
-#ifdef _MSC_VER
-void DOUBLE_CONVERSION_NO_RETURN abort_noreturn();
-inline void abort_noreturn() { abort(); }
-#define DOUBLE_CONVERSION_UNREACHABLE() (abort_noreturn())
-#else
-#define DOUBLE_CONVERSION_UNREACHABLE() (abort())
-#endif
-#endif
-
-// Not all compilers support __has_attribute and combining a check for both
-// ifdef and __has_attribute on the same preprocessor line isn't portable.
-#ifdef __has_attribute
-# define DOUBLE_CONVERSION_HAS_ATTRIBUTE(x) __has_attribute(x)
-#else
-# define DOUBLE_CONVERSION_HAS_ATTRIBUTE(x) 0
-#endif
-
-#ifndef DOUBLE_CONVERSION_UNUSED
-#if DOUBLE_CONVERSION_HAS_ATTRIBUTE(unused)
-#define DOUBLE_CONVERSION_UNUSED __attribute__((unused))
-#else
-#define DOUBLE_CONVERSION_UNUSED
-#endif
-#endif
-
-#if DOUBLE_CONVERSION_HAS_ATTRIBUTE(uninitialized)
-#define DOUBLE_CONVERSION_STACK_UNINITIALIZED __attribute__((uninitialized))
-#else
-#define DOUBLE_CONVERSION_STACK_UNINITIALIZED
-#endif
-
-// Double operations detection based on target architecture.
-// Linux uses a 80bit wide floating point stack on x86. This induces double
-// rounding, which in turn leads to wrong results.
-// An easy way to test if the floating-point operations are correct is to
-// evaluate: 89255.0/1e22. If the floating-point stack is 64 bits wide then
-// the result is equal to 89255e-22.
-// The best way to test this, is to create a division-function and to compare
-// the output of the division with the expected result. (Inlining must be
-// disabled.)
-// On Linux,x86 89255e-22 != Div_double(89255.0/1e22)
-//
-// For example:
-/*
-// -- in div.c
-double Div_double(double x, double y) { return x / y; }
-
-// -- in main.c
-double Div_double(double x, double y); // Forward declaration.
-
-int main(int argc, char** argv) {
- return Div_double(89255.0, 1e22) == 89255e-22;
-}
-*/
-// Run as follows ./main || echo "correct"
-//
-// If it prints "correct" then the architecture should be here, in the "correct" section.
-#if defined(_M_X64) || defined(__x86_64__) || \
- defined(__ARMEL__) || defined(__avr32__) || defined(_M_ARM) || defined(_M_ARM64) || \
- defined(__hppa__) || defined(__ia64__) || \
- defined(__mips__) || \
- defined(__nios2__) || \
- defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \
- defined(_POWER) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || \
- defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
- defined(__SH4__) || defined(__alpha__) || \
- defined(_MIPS_ARCH_MIPS32R2) || defined(__ARMEB__) ||\
- defined(__AARCH64EL__) || defined(__aarch64__) || defined(__AARCH64EB__) || \
- defined(__riscv) || defined(__e2k__) || \
- defined(__or1k__) || defined(__arc__) || \
- defined(__microblaze__) || defined(__XTENSA__) || \
- defined(__EMSCRIPTEN__) || defined(__wasm32__)
-#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
-#elif defined(__mc68000__) || \
- defined(__pnacl__) || defined(__native_client__)
-#undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
-#elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
-#if defined(_WIN32)
-// Windows uses a 64bit wide floating point stack.
-#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
-#else
-#undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
-#endif // _WIN32
-#else
-#error Target architecture was not detected as supported by Double-Conversion.
-#endif
-
-#if defined(_WIN32) && !defined(__MINGW32__)
-
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef short int16_t; // NOLINT
-typedef unsigned short uint16_t; // NOLINT
-typedef int int32_t;
-typedef unsigned int uint32_t;
-typedef __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-// intptr_t and friends are defined in crtdefs.h through stdio.h.
-
-#else
-
-#include <stdint.h>
-
-#endif
-
-typedef uint16_t uc16;
-
-// The following macro works on both 32 and 64-bit platforms.
-// Usage: instead of writing 0x1234567890123456
-// write DOUBLE_CONVERSION_UINT64_2PART_C(0x12345678,90123456);
-#define DOUBLE_CONVERSION_UINT64_2PART_C(a, b) (((static_cast<uint64_t>(a) << 32) + 0x##b##u))
-
-
-// The expression DOUBLE_CONVERSION_ARRAY_SIZE(a) is a compile-time constant of type
-// size_t which represents the number of elements of the given
-// array. You should only use DOUBLE_CONVERSION_ARRAY_SIZE on statically allocated
-// arrays.
-#ifndef DOUBLE_CONVERSION_ARRAY_SIZE
-#define DOUBLE_CONVERSION_ARRAY_SIZE(a) \
- ((sizeof(a) / sizeof(*(a))) / \
- static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
-#endif
-
-// A macro to disallow the evil copy constructor and operator= functions
-// This should be used in the private: declarations for a class
-#ifndef DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN
-#define DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN(TypeName) \
- TypeName(const TypeName&); \
- void operator=(const TypeName&)
-#endif
-
-// A macro to disallow all the implicit constructors, namely the
-// default constructor, copy constructor and operator= functions.
-//
-// This should be used in the private: declarations for a class
-// that wants to prevent anyone from instantiating it. This is
-// especially useful for classes containing only static methods.
-#ifndef DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS
-#define DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
- TypeName(); \
- DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN(TypeName)
-#endif
-
-// ICU PATCH: Wrap in ICU namespace
-U_NAMESPACE_BEGIN
-
-namespace double_conversion {
-
-inline int StrLength(const char* string) {
- size_t length = strlen(string);
- DOUBLE_CONVERSION_ASSERT(length == static_cast<size_t>(static_cast<int>(length)));
- return static_cast<int>(length);
-}
-
-// This is a simplified version of V8's Vector class.
-template <typename T>
-class Vector {
- public:
- Vector() : start_(NULL), length_(0) {}
- Vector(T* data, int len) : start_(data), length_(len) {
- DOUBLE_CONVERSION_ASSERT(len == 0 || (len > 0 && data != NULL));
- }
-
- // Returns a vector using the same backing storage as this one,
- // spanning from and including 'from', to but not including 'to'.
- Vector<T> SubVector(int from, int to) {
- DOUBLE_CONVERSION_ASSERT(to <= length_);
- DOUBLE_CONVERSION_ASSERT(from < to);
- DOUBLE_CONVERSION_ASSERT(0 <= from);
- return Vector<T>(start() + from, to - from);
- }
-
- // Returns the length of the vector.
- int length() const { return length_; }
-
- // Returns whether or not the vector is empty.
- bool is_empty() const { return length_ == 0; }
-
- // Returns the pointer to the start of the data in the vector.
- T* start() const { return start_; }
-
- // Access individual vector elements - checks bounds in debug mode.
- T& operator[](int index) const {
- DOUBLE_CONVERSION_ASSERT(0 <= index && index < length_);
- return start_[index];
- }
-
- T& first() { return start_[0]; }
-
- T& last() { return start_[length_ - 1]; }
-
- void pop_back() {
- DOUBLE_CONVERSION_ASSERT(!is_empty());
- --length_;
- }
-
- private:
- T* start_;
- int length_;
-};
-
-
-// Helper class for building result strings in a character buffer. The
-// purpose of the class is to use safe operations that checks the
-// buffer bounds on all operations in debug mode.
-class StringBuilder {
- public:
- StringBuilder(char* buffer, int buffer_size)
- : buffer_(buffer, buffer_size), position_(0) { }
-
- ~StringBuilder() { if (!is_finalized()) Finalize(); }
-
- int size() const { return buffer_.length(); }
-
- // Get the current position in the builder.
- int position() const {
- DOUBLE_CONVERSION_ASSERT(!is_finalized());
- return position_;
- }
-
- // Reset the position.
- void Reset() { position_ = 0; }
-
- // Add a single character to the builder. It is not allowed to add
- // 0-characters; use the Finalize() method to terminate the string
- // instead.
- void AddCharacter(char c) {
- DOUBLE_CONVERSION_ASSERT(c != '\0');
- DOUBLE_CONVERSION_ASSERT(!is_finalized() && position_ < buffer_.length());
- buffer_[position_++] = c;
- }
-
- // Add an entire string to the builder. Uses strlen() internally to
- // compute the length of the input string.
- void AddString(const char* s) {
- AddSubstring(s, StrLength(s));
- }
-
- // Add the first 'n' characters of the given string 's' to the
- // builder. The input string must have enough characters.
- void AddSubstring(const char* s, int n) {
- DOUBLE_CONVERSION_ASSERT(!is_finalized() && position_ + n < buffer_.length());
- DOUBLE_CONVERSION_ASSERT(static_cast<size_t>(n) <= strlen(s));
- memmove(&buffer_[position_], s, n);
- position_ += n;
- }
-
-
- // Add character padding to the builder. If count is non-positive,
- // nothing is added to the builder.
- void AddPadding(char c, int count) {
- for (int i = 0; i < count; i++) {
- AddCharacter(c);
- }
- }
-
- // Finalize the string by 0-terminating it and returning the buffer.
- char* Finalize() {
- DOUBLE_CONVERSION_ASSERT(!is_finalized() && position_ < buffer_.length());
- buffer_[position_] = '\0';
- // Make sure nobody managed to add a 0-character to the
- // buffer while building the string.
- DOUBLE_CONVERSION_ASSERT(strlen(buffer_.start()) == static_cast<size_t>(position_));
- position_ = -1;
- DOUBLE_CONVERSION_ASSERT(is_finalized());
- return buffer_.start();
- }
-
- private:
- Vector<char> buffer_;
- int position_;
-
- bool is_finalized() const { return position_ < 0; }
-
- DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder);
-};
-
-// The type-based aliasing rule allows the compiler to assume that pointers of
-// different types (for some definition of different) never alias each other.
-// Thus the following code does not work:
-//
-// float f = foo();
-// int fbits = *(int*)(&f);
-//
-// The compiler 'knows' that the int pointer can't refer to f since the types
-// don't match, so the compiler may cache f in a register, leaving random data
-// in fbits. Using C++ style casts makes no difference, however a pointer to
-// char data is assumed to alias any other pointer. This is the 'memcpy
-// exception'.
-//
-// Bit_cast uses the memcpy exception to move the bits from a variable of one
-// type of a variable of another type. Of course the end result is likely to
-// be implementation dependent. Most compilers (gcc-4.2 and MSVC 2005)
-// will completely optimize BitCast away.
-//
-// There is an additional use for BitCast.
-// Recent gccs will warn when they see casts that may result in breakage due to
-// the type-based aliasing rule. If you have checked that there is no breakage
-// you can use BitCast to cast one pointer type to another. This confuses gcc
-// enough that it can no longer see that you have cast one pointer type to
-// another thus avoiding the warning.
-template <class Dest, class Source>
-Dest BitCast(const Source& source) {
- // Compile time assertion: sizeof(Dest) == sizeof(Source)
- // A compile error here means your Dest and Source have different sizes.
-#if __cplusplus >= 201103L
- static_assert(sizeof(Dest) == sizeof(Source),
- "source and destination size mismatch");
-#else
- DOUBLE_CONVERSION_UNUSED
- typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1];
-#endif
-
- Dest dest;
- memmove(&dest, &source, sizeof(dest));
- return dest;
-}
-
-template <class Dest, class Source>
-Dest BitCast(Source* source) {
- return BitCast<Dest>(reinterpret_cast<uintptr_t>(source));
-}
-
-} // namespace double_conversion
-
-// ICU PATCH: Close ICU namespace
-U_NAMESPACE_END
-
-#endif // DOUBLE_CONVERSION_UTILS_H_
-#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+//
+// From the double-conversion library. Original license:
+//
+// Copyright 2010 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.
+
+// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+#ifndef DOUBLE_CONVERSION_UTILS_H_
+#define DOUBLE_CONVERSION_UTILS_H_
+
+#include <cstdlib>
+#include <cstring>
+
+// ICU PATCH: Use U_ASSERT instead of <assert.h>
+#include "uassert.h"
+#ifndef DOUBLE_CONVERSION_ASSERT
+#define DOUBLE_CONVERSION_ASSERT(condition) \
+ U_ASSERT(condition);
+#endif
+#ifndef DOUBLE_CONVERSION_UNIMPLEMENTED
+#define DOUBLE_CONVERSION_UNIMPLEMENTED() (abort())
+#endif
+#ifndef DOUBLE_CONVERSION_NO_RETURN
+#ifdef _MSC_VER
+#define DOUBLE_CONVERSION_NO_RETURN __declspec(noreturn)
+#else
+#define DOUBLE_CONVERSION_NO_RETURN __attribute__((noreturn))
+#endif
+#endif
+#ifndef DOUBLE_CONVERSION_UNREACHABLE
+#ifdef _MSC_VER
+void DOUBLE_CONVERSION_NO_RETURN abort_noreturn();
+inline void abort_noreturn() { abort(); }
+#define DOUBLE_CONVERSION_UNREACHABLE() (abort_noreturn())
+#else
+#define DOUBLE_CONVERSION_UNREACHABLE() (abort())
+#endif
+#endif
+
+// Not all compilers support __has_attribute and combining a check for both
+// ifdef and __has_attribute on the same preprocessor line isn't portable.
+#ifdef __has_attribute
+# define DOUBLE_CONVERSION_HAS_ATTRIBUTE(x) __has_attribute(x)
+#else
+# define DOUBLE_CONVERSION_HAS_ATTRIBUTE(x) 0
+#endif
+
+#ifndef DOUBLE_CONVERSION_UNUSED
+#if DOUBLE_CONVERSION_HAS_ATTRIBUTE(unused)
+#define DOUBLE_CONVERSION_UNUSED __attribute__((unused))
+#else
+#define DOUBLE_CONVERSION_UNUSED
+#endif
+#endif
+
+#if DOUBLE_CONVERSION_HAS_ATTRIBUTE(uninitialized)
+#define DOUBLE_CONVERSION_STACK_UNINITIALIZED __attribute__((uninitialized))
+#else
+#define DOUBLE_CONVERSION_STACK_UNINITIALIZED
+#endif
+
+// Double operations detection based on target architecture.
+// Linux uses a 80bit wide floating point stack on x86. This induces double
+// rounding, which in turn leads to wrong results.
+// An easy way to test if the floating-point operations are correct is to
+// evaluate: 89255.0/1e22. If the floating-point stack is 64 bits wide then
+// the result is equal to 89255e-22.
+// The best way to test this, is to create a division-function and to compare
+// the output of the division with the expected result. (Inlining must be
+// disabled.)
+// On Linux,x86 89255e-22 != Div_double(89255.0/1e22)
+//
+// For example:
+/*
+// -- in div.c
+double Div_double(double x, double y) { return x / y; }
+
+// -- in main.c
+double Div_double(double x, double y); // Forward declaration.
+
+int main(int argc, char** argv) {
+ return Div_double(89255.0, 1e22) == 89255e-22;
+}
+*/
+// Run as follows ./main || echo "correct"
+//
+// If it prints "correct" then the architecture should be here, in the "correct" section.
+#if defined(_M_X64) || defined(__x86_64__) || \
+ defined(__ARMEL__) || defined(__avr32__) || defined(_M_ARM) || defined(_M_ARM64) || \
+ defined(__hppa__) || defined(__ia64__) || \
+ defined(__mips__) || \
+ defined(__nios2__) || \
+ defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \
+ defined(_POWER) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || \
+ defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
+ defined(__SH4__) || defined(__alpha__) || \
+ defined(_MIPS_ARCH_MIPS32R2) || defined(__ARMEB__) ||\
+ defined(__AARCH64EL__) || defined(__aarch64__) || defined(__AARCH64EB__) || \
+ defined(__riscv) || defined(__e2k__) || \
+ defined(__or1k__) || defined(__arc__) || \
+ defined(__microblaze__) || defined(__XTENSA__) || \
+ defined(__EMSCRIPTEN__) || defined(__wasm32__)
+#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
+#elif defined(__mc68000__) || \
+ defined(__pnacl__) || defined(__native_client__)
+#undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
+#elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
+#if defined(_WIN32)
+// Windows uses a 64bit wide floating point stack.
+#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
+#else
+#undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
+#endif // _WIN32
+#else
+#error Target architecture was not detected as supported by Double-Conversion.
+#endif
+
+#if defined(_WIN32) && !defined(__MINGW32__)
+
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+typedef short int16_t; // NOLINT
+typedef unsigned short uint16_t; // NOLINT
+typedef int int32_t;
+typedef unsigned int uint32_t;
+typedef __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+// intptr_t and friends are defined in crtdefs.h through stdio.h.
+
+#else
+
+#include <stdint.h>
+
+#endif
+
+typedef uint16_t uc16;
+
+// The following macro works on both 32 and 64-bit platforms.
+// Usage: instead of writing 0x1234567890123456
+// write DOUBLE_CONVERSION_UINT64_2PART_C(0x12345678,90123456);
+#define DOUBLE_CONVERSION_UINT64_2PART_C(a, b) (((static_cast<uint64_t>(a) << 32) + 0x##b##u))
+
+
+// The expression DOUBLE_CONVERSION_ARRAY_SIZE(a) is a compile-time constant of type
+// size_t which represents the number of elements of the given
+// array. You should only use DOUBLE_CONVERSION_ARRAY_SIZE on statically allocated
+// arrays.
+#ifndef DOUBLE_CONVERSION_ARRAY_SIZE
+#define DOUBLE_CONVERSION_ARRAY_SIZE(a) \
+ ((sizeof(a) / sizeof(*(a))) / \
+ static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
+#endif
+
+// A macro to disallow the evil copy constructor and operator= functions
+// This should be used in the private: declarations for a class
+#ifndef DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN
+#define DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN(TypeName) \
+ TypeName(const TypeName&); \
+ void operator=(const TypeName&)
+#endif
+
+// A macro to disallow all the implicit constructors, namely the
+// default constructor, copy constructor and operator= functions.
+//
+// This should be used in the private: declarations for a class
+// that wants to prevent anyone from instantiating it. This is
+// especially useful for classes containing only static methods.
+#ifndef DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS
+#define DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
+ TypeName(); \
+ DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN(TypeName)
+#endif
+
+// ICU PATCH: Wrap in ICU namespace
+U_NAMESPACE_BEGIN
+
+namespace double_conversion {
+
+inline int StrLength(const char* string) {
+ size_t length = strlen(string);
+ DOUBLE_CONVERSION_ASSERT(length == static_cast<size_t>(static_cast<int>(length)));
+ return static_cast<int>(length);
+}
+
+// This is a simplified version of V8's Vector class.
+template <typename T>
+class Vector {
+ public:
+ Vector() : start_(NULL), length_(0) {}
+ Vector(T* data, int len) : start_(data), length_(len) {
+ DOUBLE_CONVERSION_ASSERT(len == 0 || (len > 0 && data != NULL));
+ }
+
+ // Returns a vector using the same backing storage as this one,
+ // spanning from and including 'from', to but not including 'to'.
+ Vector<T> SubVector(int from, int to) {
+ DOUBLE_CONVERSION_ASSERT(to <= length_);
+ DOUBLE_CONVERSION_ASSERT(from < to);
+ DOUBLE_CONVERSION_ASSERT(0 <= from);
+ return Vector<T>(start() + from, to - from);
+ }
+
+ // Returns the length of the vector.
+ int length() const { return length_; }
+
+ // Returns whether or not the vector is empty.
+ bool is_empty() const { return length_ == 0; }
+
+ // Returns the pointer to the start of the data in the vector.
+ T* start() const { return start_; }
+
+ // Access individual vector elements - checks bounds in debug mode.
+ T& operator[](int index) const {
+ DOUBLE_CONVERSION_ASSERT(0 <= index && index < length_);
+ return start_[index];
+ }
+
+ T& first() { return start_[0]; }
+
+ T& last() { return start_[length_ - 1]; }
+
+ void pop_back() {
+ DOUBLE_CONVERSION_ASSERT(!is_empty());
+ --length_;
+ }
+
+ private:
+ T* start_;
+ int length_;
+};
+
+
+// Helper class for building result strings in a character buffer. The
+// purpose of the class is to use safe operations that checks the
+// buffer bounds on all operations in debug mode.
+class StringBuilder {
+ public:
+ StringBuilder(char* buffer, int buffer_size)
+ : buffer_(buffer, buffer_size), position_(0) { }
+
+ ~StringBuilder() { if (!is_finalized()) Finalize(); }
+
+ int size() const { return buffer_.length(); }
+
+ // Get the current position in the builder.
+ int position() const {
+ DOUBLE_CONVERSION_ASSERT(!is_finalized());
+ return position_;
+ }
+
+ // Reset the position.
+ void Reset() { position_ = 0; }
+
+ // Add a single character to the builder. It is not allowed to add
+ // 0-characters; use the Finalize() method to terminate the string
+ // instead.
+ void AddCharacter(char c) {
+ DOUBLE_CONVERSION_ASSERT(c != '\0');
+ DOUBLE_CONVERSION_ASSERT(!is_finalized() && position_ < buffer_.length());
+ buffer_[position_++] = c;
+ }
+
+ // Add an entire string to the builder. Uses strlen() internally to
+ // compute the length of the input string.
+ void AddString(const char* s) {
+ AddSubstring(s, StrLength(s));
+ }
+
+ // Add the first 'n' characters of the given string 's' to the
+ // builder. The input string must have enough characters.
+ void AddSubstring(const char* s, int n) {
+ DOUBLE_CONVERSION_ASSERT(!is_finalized() && position_ + n < buffer_.length());
+ DOUBLE_CONVERSION_ASSERT(static_cast<size_t>(n) <= strlen(s));
+ memmove(&buffer_[position_], s, n);
+ position_ += n;
+ }
+
+
+ // Add character padding to the builder. If count is non-positive,
+ // nothing is added to the builder.
+ void AddPadding(char c, int count) {
+ for (int i = 0; i < count; i++) {
+ AddCharacter(c);
+ }
+ }
+
+ // Finalize the string by 0-terminating it and returning the buffer.
+ char* Finalize() {
+ DOUBLE_CONVERSION_ASSERT(!is_finalized() && position_ < buffer_.length());
+ buffer_[position_] = '\0';
+ // Make sure nobody managed to add a 0-character to the
+ // buffer while building the string.
+ DOUBLE_CONVERSION_ASSERT(strlen(buffer_.start()) == static_cast<size_t>(position_));
+ position_ = -1;
+ DOUBLE_CONVERSION_ASSERT(is_finalized());
+ return buffer_.start();
+ }
+
+ private:
+ Vector<char> buffer_;
+ int position_;
+
+ bool is_finalized() const { return position_ < 0; }
+
+ DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder);
+};
+
+// The type-based aliasing rule allows the compiler to assume that pointers of
+// different types (for some definition of different) never alias each other.
+// Thus the following code does not work:
+//
+// float f = foo();
+// int fbits = *(int*)(&f);
+//
+// The compiler 'knows' that the int pointer can't refer to f since the types
+// don't match, so the compiler may cache f in a register, leaving random data
+// in fbits. Using C++ style casts makes no difference, however a pointer to
+// char data is assumed to alias any other pointer. This is the 'memcpy
+// exception'.
+//
+// Bit_cast uses the memcpy exception to move the bits from a variable of one
+// type of a variable of another type. Of course the end result is likely to
+// be implementation dependent. Most compilers (gcc-4.2 and MSVC 2005)
+// will completely optimize BitCast away.
+//
+// There is an additional use for BitCast.
+// Recent gccs will warn when they see casts that may result in breakage due to
+// the type-based aliasing rule. If you have checked that there is no breakage
+// you can use BitCast to cast one pointer type to another. This confuses gcc
+// enough that it can no longer see that you have cast one pointer type to
+// another thus avoiding the warning.
+template <class Dest, class Source>
+Dest BitCast(const Source& source) {
+ // Compile time assertion: sizeof(Dest) == sizeof(Source)
+ // A compile error here means your Dest and Source have different sizes.
+#if __cplusplus >= 201103L
+ static_assert(sizeof(Dest) == sizeof(Source),
+ "source and destination size mismatch");
+#else
+ DOUBLE_CONVERSION_UNUSED
+ typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1];
+#endif
+
+ Dest dest;
+ memmove(&dest, &source, sizeof(dest));
+ return dest;
+}
+
+template <class Dest, class Source>
+Dest BitCast(Source* source) {
+ return BitCast<Dest>(reinterpret_cast<uintptr_t>(source));
+}
+
+} // namespace double_conversion
+
+// ICU PATCH: Close ICU namespace
+U_NAMESPACE_END
+
+#endif // DOUBLE_CONVERSION_UTILS_H_
+#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/double-conversion.h b/contrib/libs/icu/i18n/double-conversion.h
index b789a64847..eddc38763b 100644
--- a/contrib/libs/icu/i18n/double-conversion.h
+++ b/contrib/libs/icu/i18n/double-conversion.h
@@ -1,46 +1,46 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// From the double-conversion library. Original license:
-//
-// Copyright 2012 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.
-
-// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-#ifndef DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
-#define DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
-
-// ICU PATCH: Customize header file paths for ICU.
-
-#include "double-conversion-string-to-double.h"
-#include "double-conversion-double-to-string.h"
-
-#endif // DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
-#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+//
+// From the double-conversion library. Original license:
+//
+// Copyright 2012 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.
+
+// ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+#ifndef DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
+#define DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
+
+// ICU PATCH: Customize header file paths for ICU.
+
+#include "double-conversion-string-to-double.h"
+#include "double-conversion-double-to-string.h"
+
+#endif // DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
+#endif // ICU PATCH: close #if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/dt_impl.h b/contrib/libs/icu/i18n/dt_impl.h
index 27b21487ad..a4058c6924 100644
--- a/contrib/libs/icu/i18n/dt_impl.h
+++ b/contrib/libs/icu/i18n/dt_impl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/dtfmtsym.cpp b/contrib/libs/icu/i18n/dtfmtsym.cpp
index 2ddc516727..690f6a4cae 100644
--- a/contrib/libs/icu/i18n/dtfmtsym.cpp
+++ b/contrib/libs/icu/i18n/dtfmtsym.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -21,9 +21,9 @@
* 10/12/05 emmons Added setters for eraNames, month/day by width/context
*******************************************************************************
*/
-
-#include <utility>
-
+
+#include <utility>
+
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
@@ -1246,7 +1246,7 @@ const UnicodeString**
DateFormatSymbols::getZoneStrings(int32_t& rowCount, int32_t& columnCount) const
{
const UnicodeString **result = NULL;
- static UMutex LOCK;
+ static UMutex LOCK;
umtx_lock(&LOCK);
if (fZoneStrings == NULL) {
@@ -1313,7 +1313,7 @@ DateFormatSymbols::initZoneStringsArray(void) {
UDate now = Calendar::getNow();
UnicodeString tzDispName;
- while ((tzid = tzids->snext(status)) != 0) {
+ while ((tzid = tzids->snext(status)) != 0) {
if (U_FAILURE(status)) {
break;
}
@@ -1370,7 +1370,7 @@ DateFormatSymbols::setZoneStrings(const UnicodeString* const *strings, int32_t r
//------------------------------------------------------
-const char16_t * U_EXPORT2
+const char16_t * U_EXPORT2
DateFormatSymbols::getPatternUChars(void)
{
return gPatternChars;
@@ -1502,7 +1502,7 @@ struct CalendarDataSink : public ResourceSink {
* To avoid double deletion, 'maps' won't take ownership of the objects. Instead,
* 'mapRefs' will own them and will delete them when CalendarDataSink is deleted.
*/
- MemoryPool<Hashtable> mapRefs;
+ MemoryPool<Hashtable> mapRefs;
// Paths and the aliases they point to
UVector aliasPathPairs;
@@ -1520,7 +1520,7 @@ struct CalendarDataSink : public ResourceSink {
// Initializes CalendarDataSink with default values
CalendarDataSink(UErrorCode& status)
: arrays(FALSE, status), arraySizes(FALSE, status), maps(FALSE, status),
- mapRefs(),
+ mapRefs(),
aliasPathPairs(uprv_deleteUObject, uhash_compareUnicodeString, status),
currentCalendarType(), nextCalendarType(),
resourcesToVisit(NULL), aliasRelativePath() {
@@ -1633,23 +1633,23 @@ struct CalendarDataSink : public ResourceSink {
Hashtable *aliasMap;
if ((aliasArray = (UnicodeString*)arrays.get(*alias)) != NULL) {
UnicodeString *path = (UnicodeString*)aliasPathPairs[i + 1];
- if (arrays.get(*path) == NULL) {
- // Clone the array
- int32_t aliasArraySize = arraySizes.geti(*alias);
- LocalArray<UnicodeString> aliasArrayCopy(new UnicodeString[aliasArraySize], errorCode);
- if (U_FAILURE(errorCode)) { return; }
- uprv_arrayCopy(aliasArray, aliasArrayCopy.getAlias(), aliasArraySize);
- // Put the array on the 'arrays' map
- arrays.put(*path, aliasArrayCopy.orphan(), errorCode);
- arraySizes.puti(*path, aliasArraySize, errorCode);
- }
+ if (arrays.get(*path) == NULL) {
+ // Clone the array
+ int32_t aliasArraySize = arraySizes.geti(*alias);
+ LocalArray<UnicodeString> aliasArrayCopy(new UnicodeString[aliasArraySize], errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ uprv_arrayCopy(aliasArray, aliasArrayCopy.getAlias(), aliasArraySize);
+ // Put the array on the 'arrays' map
+ arrays.put(*path, aliasArrayCopy.orphan(), errorCode);
+ arraySizes.puti(*path, aliasArraySize, errorCode);
+ }
if (U_FAILURE(errorCode)) { return; }
mod = true;
} else if ((aliasMap = (Hashtable*)maps.get(*alias)) != NULL) {
UnicodeString *path = (UnicodeString*)aliasPathPairs[i + 1];
- if (maps.get(*path) == NULL) {
- maps.put(*path, aliasMap, errorCode);
- }
+ if (maps.get(*path) == NULL) {
+ maps.put(*path, aliasMap, errorCode);
+ }
if (U_FAILURE(errorCode)) { return; }
mod = true;
}
@@ -1665,7 +1665,7 @@ struct CalendarDataSink : public ResourceSink {
// Set the resources to visit on the next calendar
if (!resourcesToVisitNext.isNull()) {
- resourcesToVisit = std::move(resourcesToVisitNext);
+ resourcesToVisit = std::move(resourcesToVisitNext);
}
}
@@ -1690,12 +1690,12 @@ struct CalendarDataSink : public ResourceSink {
if (value.getType() == URES_STRING) {
// We are on a leaf, store the map elements into the stringMap
if (i == 0) {
- // mapRefs will keep ownership of 'stringMap':
- stringMap = mapRefs.create(FALSE, errorCode);
- if (stringMap == NULL) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
+ // mapRefs will keep ownership of 'stringMap':
+ stringMap = mapRefs.create(FALSE, errorCode);
+ if (stringMap == NULL) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
maps.put(path, stringMap, errorCode);
if (U_FAILURE(errorCode)) { return; }
stringMap->setValueDeleter(uprv_deleteUObject);
@@ -2177,16 +2177,16 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
// The ordering of the following statements is important.
if (fLeapMonthPatterns[kLeapMonthPatternFormatAbbrev].isEmpty()) {
fLeapMonthPatterns[kLeapMonthPatternFormatAbbrev].setTo(fLeapMonthPatterns[kLeapMonthPatternFormatWide]);
- }
+ }
if (fLeapMonthPatterns[kLeapMonthPatternFormatNarrow].isEmpty()) {
fLeapMonthPatterns[kLeapMonthPatternFormatNarrow].setTo(fLeapMonthPatterns[kLeapMonthPatternStandaloneNarrow]);
- }
+ }
if (fLeapMonthPatterns[kLeapMonthPatternStandaloneWide].isEmpty()) {
fLeapMonthPatterns[kLeapMonthPatternStandaloneWide].setTo(fLeapMonthPatterns[kLeapMonthPatternFormatWide]);
- }
+ }
if (fLeapMonthPatterns[kLeapMonthPatternStandaloneAbbrev].isEmpty()) {
fLeapMonthPatterns[kLeapMonthPatternStandaloneAbbrev].setTo(fLeapMonthPatterns[kLeapMonthPatternFormatAbbrev]);
- }
+ }
// end of hack
fLeapMonthPatternsCount = kMonthPatternsCount;
} else {
@@ -2221,8 +2221,8 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
++typeMapPtr;
}
if (typeMapPtr->usageTypeName != NULL && compResult == 0) {
- fCapitalization[typeMapPtr->usageTypeEnumValue][0] = static_cast<UBool>(intVector[0]);
- fCapitalization[typeMapPtr->usageTypeEnumValue][1] = static_cast<UBool>(intVector[1]);
+ fCapitalization[typeMapPtr->usageTypeEnumValue][0] = static_cast<UBool>(intVector[0]);
+ fCapitalization[typeMapPtr->usageTypeEnumValue][1] = static_cast<UBool>(intVector[1]);
}
}
}
@@ -2338,21 +2338,21 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
assignArray(fStandaloneNarrowMonths, fStandaloneNarrowMonthsCount, fShortMonths, fShortMonthsCount);
}
- // Load AM/PM markers; if wide or narrow not available, use short
- UErrorCode ampmStatus = U_ZERO_ERROR;
+ // Load AM/PM markers; if wide or narrow not available, use short
+ UErrorCode ampmStatus = U_ZERO_ERROR;
initField(&fAmPms, fAmPmsCount, calendarSink,
- buildResourcePath(path, gAmPmMarkersTag, ampmStatus), ampmStatus);
- if (U_FAILURE(ampmStatus)) {
- initField(&fAmPms, fAmPmsCount, calendarSink,
- buildResourcePath(path, gAmPmMarkersAbbrTag, status), status);
- }
- ampmStatus = U_ZERO_ERROR;
+ buildResourcePath(path, gAmPmMarkersTag, ampmStatus), ampmStatus);
+ if (U_FAILURE(ampmStatus)) {
+ initField(&fAmPms, fAmPmsCount, calendarSink,
+ buildResourcePath(path, gAmPmMarkersAbbrTag, status), status);
+ }
+ ampmStatus = U_ZERO_ERROR;
initField(&fNarrowAmPms, fNarrowAmPmsCount, calendarSink,
- buildResourcePath(path, gAmPmMarkersNarrowTag, ampmStatus), ampmStatus);
- if (U_FAILURE(ampmStatus)) {
- initField(&fNarrowAmPms, fNarrowAmPmsCount, calendarSink,
- buildResourcePath(path, gAmPmMarkersAbbrTag, status), status);
- }
+ buildResourcePath(path, gAmPmMarkersNarrowTag, ampmStatus), ampmStatus);
+ if (U_FAILURE(ampmStatus)) {
+ initField(&fNarrowAmPms, fNarrowAmPmsCount, calendarSink,
+ buildResourcePath(path, gAmPmMarkersAbbrTag, status), status);
+ }
// Load quarters
initField(&fQuarters, fQuartersCount, calendarSink,
diff --git a/contrib/libs/icu/i18n/dtitv_impl.h b/contrib/libs/icu/i18n/dtitv_impl.h
index 5b66af065d..c7addf37fb 100644
--- a/contrib/libs/icu/i18n/dtitv_impl.h
+++ b/contrib/libs/icu/i18n/dtitv_impl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -88,7 +88,7 @@
#define MAX_E_COUNT 5
#define MAX_M_COUNT 5
//#define MAX_INTERVAL_INDEX 4
-#define MAX_POSITIVE_INT 56632
+#define MAX_POSITIVE_INT 56632
#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/dtitvfmt.cpp b/contrib/libs/icu/i18n/dtitvfmt.cpp
index e4cef37f60..b71a571d1c 100644
--- a/contrib/libs/icu/i18n/dtitvfmt.cpp
+++ b/contrib/libs/icu/i18n/dtitvfmt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*******************************************************************************
* Copyright (C) 2008-2016, International Business Machines Corporation and
@@ -28,7 +28,7 @@
#include "dtitv_impl.h"
#include "mutex.h"
#include "uresimp.h"
-#include "formattedval_impl.h"
+#include "formattedval_impl.h"
#ifdef DTITVFMT_DEBUG
#include <iostream>
@@ -66,23 +66,23 @@ static const UChar gLaterFirstPrefix[] = {LOW_L, LOW_A, LOW_T, LOW_E, LOW_S,LOW_
static const UChar gEarlierFirstPrefix[] = {LOW_E, LOW_A, LOW_R, LOW_L, LOW_I, LOW_E, LOW_S, LOW_T, CAP_F, LOW_I, LOW_R, LOW_S, LOW_T, COLON};
-class FormattedDateIntervalData : public FormattedValueFieldPositionIteratorImpl {
-public:
- FormattedDateIntervalData(UErrorCode& status) : FormattedValueFieldPositionIteratorImpl(5, status) {}
- virtual ~FormattedDateIntervalData();
-};
-
-FormattedDateIntervalData::~FormattedDateIntervalData() = default;
-
-UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedDateInterval)
-
-
+class FormattedDateIntervalData : public FormattedValueFieldPositionIteratorImpl {
+public:
+ FormattedDateIntervalData(UErrorCode& status) : FormattedValueFieldPositionIteratorImpl(5, status) {}
+ virtual ~FormattedDateIntervalData();
+};
+
+FormattedDateIntervalData::~FormattedDateIntervalData() = default;
+
+UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedDateInterval)
+
+
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DateIntervalFormat)
// Mutex, protects access to fDateFormat, fFromCalendar and fToCalendar.
// Needed because these data members are modified by const methods of DateIntervalFormat.
-static UMutex gFormatterMutex;
+static UMutex gFormatterMutex;
DateIntervalFormat* U_EXPORT2
DateIntervalFormat::createInstance(const UnicodeString& skeleton,
@@ -108,10 +108,10 @@ DateIntervalFormat::createInstance(const UnicodeString& skeleton,
#endif
DateIntervalInfo* dtitvinf = new DateIntervalInfo(locale, status);
- if (dtitvinf == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
+ if (dtitvinf == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
return create(locale, dtitvinf, &skeleton, status);
}
@@ -136,27 +136,27 @@ DateIntervalFormat::createInstance(const UnicodeString& skeleton,
DateIntervalFormat::DateIntervalFormat()
-: fInfo(nullptr),
- fDateFormat(nullptr),
- fFromCalendar(nullptr),
- fToCalendar(nullptr),
+: fInfo(nullptr),
+ fDateFormat(nullptr),
+ fFromCalendar(nullptr),
+ fToCalendar(nullptr),
fLocale(Locale::getRoot()),
- fDatePattern(nullptr),
- fTimePattern(nullptr),
- fDateTimeFormat(nullptr)
+ fDatePattern(nullptr),
+ fTimePattern(nullptr),
+ fDateTimeFormat(nullptr)
{}
DateIntervalFormat::DateIntervalFormat(const DateIntervalFormat& itvfmt)
: Format(itvfmt),
- fInfo(nullptr),
- fDateFormat(nullptr),
- fFromCalendar(nullptr),
- fToCalendar(nullptr),
+ fInfo(nullptr),
+ fDateFormat(nullptr),
+ fFromCalendar(nullptr),
+ fToCalendar(nullptr),
fLocale(itvfmt.fLocale),
- fDatePattern(nullptr),
- fTimePattern(nullptr),
- fDateTimeFormat(nullptr) {
+ fDatePattern(nullptr),
+ fTimePattern(nullptr),
+ fDateTimeFormat(nullptr) {
*this = itvfmt;
}
@@ -174,25 +174,25 @@ DateIntervalFormat::operator=(const DateIntervalFormat& itvfmt) {
{
Mutex lock(&gFormatterMutex);
if ( itvfmt.fDateFormat ) {
- fDateFormat = itvfmt.fDateFormat->clone();
+ fDateFormat = itvfmt.fDateFormat->clone();
} else {
- fDateFormat = nullptr;
+ fDateFormat = nullptr;
}
if ( itvfmt.fFromCalendar ) {
fFromCalendar = itvfmt.fFromCalendar->clone();
} else {
- fFromCalendar = nullptr;
+ fFromCalendar = nullptr;
}
if ( itvfmt.fToCalendar ) {
fToCalendar = itvfmt.fToCalendar->clone();
} else {
- fToCalendar = nullptr;
+ fToCalendar = nullptr;
}
}
if ( itvfmt.fInfo ) {
fInfo = itvfmt.fInfo->clone();
} else {
- fInfo = nullptr;
+ fInfo = nullptr;
}
fSkeleton = itvfmt.fSkeleton;
int8_t i;
@@ -200,9 +200,9 @@ DateIntervalFormat::operator=(const DateIntervalFormat& itvfmt) {
fIntervalPatterns[i] = itvfmt.fIntervalPatterns[i];
}
fLocale = itvfmt.fLocale;
- fDatePattern = (itvfmt.fDatePattern)? itvfmt.fDatePattern->clone(): nullptr;
- fTimePattern = (itvfmt.fTimePattern)? itvfmt.fTimePattern->clone(): nullptr;
- fDateTimeFormat = (itvfmt.fDateTimeFormat)? itvfmt.fDateTimeFormat->clone(): nullptr;
+ fDatePattern = (itvfmt.fDatePattern)? itvfmt.fDatePattern->clone(): nullptr;
+ fTimePattern = (itvfmt.fTimePattern)? itvfmt.fTimePattern->clone(): nullptr;
+ fDateTimeFormat = (itvfmt.fDateTimeFormat)? itvfmt.fDateTimeFormat->clone(): nullptr;
}
return *this;
}
@@ -219,8 +219,8 @@ DateIntervalFormat::~DateIntervalFormat() {
}
-DateIntervalFormat*
-DateIntervalFormat::clone() const {
+DateIntervalFormat*
+DateIntervalFormat::clone() const {
return new DateIntervalFormat(*this);
}
@@ -231,21 +231,21 @@ DateIntervalFormat::operator==(const Format& other) const {
const DateIntervalFormat* fmt = (DateIntervalFormat*)&other;
if (this == fmt) {return TRUE;}
if (!Format::operator==(other)) {return FALSE;}
- if ((fInfo != fmt->fInfo) && (fInfo == nullptr || fmt->fInfo == nullptr)) {return FALSE;}
+ if ((fInfo != fmt->fInfo) && (fInfo == nullptr || fmt->fInfo == nullptr)) {return FALSE;}
if (fInfo && fmt->fInfo && (*fInfo != *fmt->fInfo )) {return FALSE;}
{
Mutex lock(&gFormatterMutex);
- if (fDateFormat != fmt->fDateFormat && (fDateFormat == nullptr || fmt->fDateFormat == nullptr)) {return FALSE;}
+ if (fDateFormat != fmt->fDateFormat && (fDateFormat == nullptr || fmt->fDateFormat == nullptr)) {return FALSE;}
if (fDateFormat && fmt->fDateFormat && (*fDateFormat != *fmt->fDateFormat)) {return FALSE;}
}
// note: fFromCalendar and fToCalendar hold no persistent state, and therefore do not participate in operator ==.
// fDateFormat has the master calendar for the DateIntervalFormat.
if (fSkeleton != fmt->fSkeleton) {return FALSE;}
- if (fDatePattern != fmt->fDatePattern && (fDatePattern == nullptr || fmt->fDatePattern == nullptr)) {return FALSE;}
+ if (fDatePattern != fmt->fDatePattern && (fDatePattern == nullptr || fmt->fDatePattern == nullptr)) {return FALSE;}
if (fDatePattern && fmt->fDatePattern && (*fDatePattern != *fmt->fDatePattern)) {return FALSE;}
- if (fTimePattern != fmt->fTimePattern && (fTimePattern == nullptr || fmt->fTimePattern == nullptr)) {return FALSE;}
+ if (fTimePattern != fmt->fTimePattern && (fTimePattern == nullptr || fmt->fTimePattern == nullptr)) {return FALSE;}
if (fTimePattern && fmt->fTimePattern && (*fTimePattern != *fmt->fTimePattern)) {return FALSE;}
- if (fDateTimeFormat != fmt->fDateTimeFormat && (fDateTimeFormat == nullptr || fmt->fDateTimeFormat == nullptr)) {return FALSE;}
+ if (fDateTimeFormat != fmt->fDateTimeFormat && (fDateTimeFormat == nullptr || fmt->fDateTimeFormat == nullptr)) {return FALSE;}
if (fDateTimeFormat && fmt->fDateTimeFormat && (*fDateTimeFormat != *fmt->fDateTimeFormat)) {return FALSE;}
if (fLocale != fmt->fLocale) {return FALSE;}
@@ -270,7 +270,7 @@ DateIntervalFormat::format(const Formattable& obj,
if ( obj.getType() == Formattable::kObject ) {
const UObject* formatObj = obj.getObject();
const DateInterval* interval = dynamic_cast<const DateInterval*>(formatObj);
- if (interval != nullptr) {
+ if (interval != nullptr) {
return format(interval, appendTo, fieldPosition, status);
}
}
@@ -287,142 +287,142 @@ DateIntervalFormat::format(const DateInterval* dtInterval,
if ( U_FAILURE(status) ) {
return appendTo;
}
- if (fDateFormat == nullptr || fInfo == nullptr) {
+ if (fDateFormat == nullptr || fInfo == nullptr) {
status = U_INVALID_STATE_ERROR;
return appendTo;
}
- FieldPositionOnlyHandler handler(fieldPosition);
- handler.setAcceptFirstOnly(TRUE);
- int8_t ignore;
-
+ FieldPositionOnlyHandler handler(fieldPosition);
+ handler.setAcceptFirstOnly(TRUE);
+ int8_t ignore;
+
Mutex lock(&gFormatterMutex);
- return formatIntervalImpl(*dtInterval, appendTo, ignore, handler, status);
+ return formatIntervalImpl(*dtInterval, appendTo, ignore, handler, status);
+}
+
+
+FormattedDateInterval DateIntervalFormat::formatToValue(
+ const DateInterval& dtInterval,
+ UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return FormattedDateInterval(status);
+ }
+ // LocalPointer only sets OOM status if U_SUCCESS is true.
+ LocalPointer<FormattedDateIntervalData> result(new FormattedDateIntervalData(status), status);
+ if (U_FAILURE(status)) {
+ return FormattedDateInterval(status);
+ }
+ UnicodeString string;
+ int8_t firstIndex;
+ auto handler = result->getHandler(status);
+ handler.setCategory(UFIELD_CATEGORY_DATE);
+ {
+ Mutex lock(&gFormatterMutex);
+ formatIntervalImpl(dtInterval, string, firstIndex, handler, status);
+ }
+ handler.getError(status);
+ result->appendString(string, status);
+ if (U_FAILURE(status)) {
+ return FormattedDateInterval(status);
+ }
+
+ // Compute the span fields and sort them into place:
+ if (firstIndex != -1) {
+ result->addOverlapSpans(UFIELD_CATEGORY_DATE_INTERVAL_SPAN, firstIndex, status);
+ if (U_FAILURE(status)) {
+ return FormattedDateInterval(status);
+ }
+ result->sort();
+ }
+
+ return FormattedDateInterval(result.orphan());
}
-FormattedDateInterval DateIntervalFormat::formatToValue(
- const DateInterval& dtInterval,
- UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return FormattedDateInterval(status);
- }
- // LocalPointer only sets OOM status if U_SUCCESS is true.
- LocalPointer<FormattedDateIntervalData> result(new FormattedDateIntervalData(status), status);
- if (U_FAILURE(status)) {
- return FormattedDateInterval(status);
- }
- UnicodeString string;
- int8_t firstIndex;
- auto handler = result->getHandler(status);
- handler.setCategory(UFIELD_CATEGORY_DATE);
- {
- Mutex lock(&gFormatterMutex);
- formatIntervalImpl(dtInterval, string, firstIndex, handler, status);
- }
- handler.getError(status);
- result->appendString(string, status);
- if (U_FAILURE(status)) {
- return FormattedDateInterval(status);
- }
-
- // Compute the span fields and sort them into place:
- if (firstIndex != -1) {
- result->addOverlapSpans(UFIELD_CATEGORY_DATE_INTERVAL_SPAN, firstIndex, status);
- if (U_FAILURE(status)) {
- return FormattedDateInterval(status);
- }
- result->sort();
- }
-
- return FormattedDateInterval(result.orphan());
-}
-
-
UnicodeString&
DateIntervalFormat::format(Calendar& fromCalendar,
Calendar& toCalendar,
UnicodeString& appendTo,
FieldPosition& pos,
UErrorCode& status) const {
- FieldPositionOnlyHandler handler(pos);
- handler.setAcceptFirstOnly(TRUE);
- int8_t ignore;
-
+ FieldPositionOnlyHandler handler(pos);
+ handler.setAcceptFirstOnly(TRUE);
+ int8_t ignore;
+
Mutex lock(&gFormatterMutex);
- return formatImpl(fromCalendar, toCalendar, appendTo, ignore, handler, status);
+ return formatImpl(fromCalendar, toCalendar, appendTo, ignore, handler, status);
+}
+
+
+FormattedDateInterval DateIntervalFormat::formatToValue(
+ Calendar& fromCalendar,
+ Calendar& toCalendar,
+ UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return FormattedDateInterval(status);
+ }
+ // LocalPointer only sets OOM status if U_SUCCESS is true.
+ LocalPointer<FormattedDateIntervalData> result(new FormattedDateIntervalData(status), status);
+ if (U_FAILURE(status)) {
+ return FormattedDateInterval(status);
+ }
+ UnicodeString string;
+ int8_t firstIndex;
+ auto handler = result->getHandler(status);
+ handler.setCategory(UFIELD_CATEGORY_DATE);
+ {
+ Mutex lock(&gFormatterMutex);
+ formatImpl(fromCalendar, toCalendar, string, firstIndex, handler, status);
+ }
+ handler.getError(status);
+ result->appendString(string, status);
+ if (U_FAILURE(status)) {
+ return FormattedDateInterval(status);
+ }
+
+ // Compute the span fields and sort them into place:
+ if (firstIndex != -1) {
+ result->addOverlapSpans(UFIELD_CATEGORY_DATE_INTERVAL_SPAN, firstIndex, status);
+ result->sort();
+ }
+
+ return FormattedDateInterval(result.orphan());
+}
+
+
+UnicodeString& DateIntervalFormat::formatIntervalImpl(
+ const DateInterval& dtInterval,
+ UnicodeString& appendTo,
+ int8_t& firstIndex,
+ FieldPositionHandler& fphandler,
+ UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return appendTo;
+ }
+ if (fFromCalendar == nullptr || fToCalendar == nullptr) {
+ status = U_INVALID_STATE_ERROR;
+ return appendTo;
+ }
+ fFromCalendar->setTime(dtInterval.getFromDate(), status);
+ fToCalendar->setTime(dtInterval.getToDate(), status);
+ return formatImpl(*fFromCalendar, *fToCalendar, appendTo, firstIndex, fphandler, status);
}
-FormattedDateInterval DateIntervalFormat::formatToValue(
- Calendar& fromCalendar,
- Calendar& toCalendar,
- UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return FormattedDateInterval(status);
- }
- // LocalPointer only sets OOM status if U_SUCCESS is true.
- LocalPointer<FormattedDateIntervalData> result(new FormattedDateIntervalData(status), status);
- if (U_FAILURE(status)) {
- return FormattedDateInterval(status);
- }
- UnicodeString string;
- int8_t firstIndex;
- auto handler = result->getHandler(status);
- handler.setCategory(UFIELD_CATEGORY_DATE);
- {
- Mutex lock(&gFormatterMutex);
- formatImpl(fromCalendar, toCalendar, string, firstIndex, handler, status);
- }
- handler.getError(status);
- result->appendString(string, status);
- if (U_FAILURE(status)) {
- return FormattedDateInterval(status);
- }
-
- // Compute the span fields and sort them into place:
- if (firstIndex != -1) {
- result->addOverlapSpans(UFIELD_CATEGORY_DATE_INTERVAL_SPAN, firstIndex, status);
- result->sort();
- }
-
- return FormattedDateInterval(result.orphan());
-}
-
-
-UnicodeString& DateIntervalFormat::formatIntervalImpl(
- const DateInterval& dtInterval,
- UnicodeString& appendTo,
- int8_t& firstIndex,
- FieldPositionHandler& fphandler,
- UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return appendTo;
- }
- if (fFromCalendar == nullptr || fToCalendar == nullptr) {
- status = U_INVALID_STATE_ERROR;
- return appendTo;
- }
- fFromCalendar->setTime(dtInterval.getFromDate(), status);
- fToCalendar->setTime(dtInterval.getToDate(), status);
- return formatImpl(*fFromCalendar, *fToCalendar, appendTo, firstIndex, fphandler, status);
-}
-
-
UnicodeString&
DateIntervalFormat::formatImpl(Calendar& fromCalendar,
Calendar& toCalendar,
UnicodeString& appendTo,
- int8_t& firstIndex,
- FieldPositionHandler& fphandler,
+ int8_t& firstIndex,
+ FieldPositionHandler& fphandler,
UErrorCode& status) const {
if ( U_FAILURE(status) ) {
return appendTo;
}
- // Initialize firstIndex to -1 (single date, no range)
- firstIndex = -1;
-
+ // Initialize firstIndex to -1 (single date, no range)
+ firstIndex = -1;
+
// not support different calendar types and time zones
//if ( fromCalendar.getType() != toCalendar.getType() ) {
if ( !fromCalendar.isEquivalentTo(toCalendar) ) {
@@ -456,9 +456,9 @@ DateIntervalFormat::formatImpl(Calendar& fromCalendar,
} else if ( fromCalendar.get(UCAL_SECOND, status) !=
toCalendar.get(UCAL_SECOND, status) ) {
field = UCAL_SECOND;
- } else if ( fromCalendar.get(UCAL_MILLISECOND, status) !=
- toCalendar.get(UCAL_MILLISECOND, status) ) {
- field = UCAL_MILLISECOND;
+ } else if ( fromCalendar.get(UCAL_MILLISECOND, status) !=
+ toCalendar.get(UCAL_MILLISECOND, status) ) {
+ field = UCAL_MILLISECOND;
}
if ( U_FAILURE(status) ) {
@@ -468,9 +468,9 @@ DateIntervalFormat::formatImpl(Calendar& fromCalendar,
/* ignore the millisecond etc. small fields' difference.
* use single date when all the above are the same.
*/
- return fDateFormat->_format(fromCalendar, appendTo, fphandler, status);
+ return fDateFormat->_format(fromCalendar, appendTo, fphandler, status);
}
- UBool fromToOnSameDay = (field==UCAL_AM_PM || field==UCAL_HOUR || field==UCAL_MINUTE || field==UCAL_SECOND || field==UCAL_MILLISECOND);
+ UBool fromToOnSameDay = (field==UCAL_AM_PM || field==UCAL_HOUR || field==UCAL_MINUTE || field==UCAL_SECOND || field==UCAL_MILLISECOND);
// following call should not set wrong status,
// all the pass-in fields are valid till here
@@ -485,9 +485,9 @@ DateIntervalFormat::formatImpl(Calendar& fromCalendar,
* the smallest calendar field in pattern,
* return single date format.
*/
- return fDateFormat->_format(fromCalendar, appendTo, fphandler, status);
+ return fDateFormat->_format(fromCalendar, appendTo, fphandler, status);
}
- return fallbackFormat(fromCalendar, toCalendar, fromToOnSameDay, appendTo, firstIndex, fphandler, status);
+ return fallbackFormat(fromCalendar, toCalendar, fromToOnSameDay, appendTo, firstIndex, fphandler, status);
}
// If the first part in interval pattern is empty,
// the 2nd part of it saves the full-pattern used in fall-back.
@@ -497,7 +497,7 @@ DateIntervalFormat::formatImpl(Calendar& fromCalendar,
UnicodeString originalPattern;
fDateFormat->toPattern(originalPattern);
fDateFormat->applyPattern(intervalPattern.secondPart);
- appendTo = fallbackFormat(fromCalendar, toCalendar, fromToOnSameDay, appendTo, firstIndex, fphandler, status);
+ appendTo = fallbackFormat(fromCalendar, toCalendar, fromToOnSameDay, appendTo, firstIndex, fphandler, status);
fDateFormat->applyPattern(originalPattern);
return appendTo;
}
@@ -506,22 +506,22 @@ DateIntervalFormat::formatImpl(Calendar& fromCalendar,
if ( intervalPattern.laterDateFirst ) {
firstCal = &toCalendar;
secondCal = &fromCalendar;
- firstIndex = 1;
+ firstIndex = 1;
} else {
firstCal = &fromCalendar;
secondCal = &toCalendar;
- firstIndex = 0;
+ firstIndex = 0;
}
// break the interval pattern into 2 parts,
// first part should not be empty,
UnicodeString originalPattern;
fDateFormat->toPattern(originalPattern);
fDateFormat->applyPattern(intervalPattern.firstPart);
- fDateFormat->_format(*firstCal, appendTo, fphandler, status);
-
+ fDateFormat->_format(*firstCal, appendTo, fphandler, status);
+
if ( !intervalPattern.secondPart.isEmpty() ) {
fDateFormat->applyPattern(intervalPattern.secondPart);
- fDateFormat->_format(*secondCal, appendTo, fphandler, status);
+ fDateFormat->_format(*secondCal, appendTo, fphandler, status);
}
fDateFormat->applyPattern(originalPattern);
return appendTo;
@@ -552,17 +552,17 @@ DateIntervalFormat::setDateIntervalInfo(const DateIntervalInfo& newItvPattern,
UErrorCode& status) {
delete fInfo;
fInfo = new DateIntervalInfo(newItvPattern);
- if (fInfo == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
+ if (fInfo == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
// Delete patterns that get reset by initializePattern
delete fDatePattern;
- fDatePattern = nullptr;
+ fDatePattern = nullptr;
delete fTimePattern;
- fTimePattern = nullptr;
+ fTimePattern = nullptr;
delete fDateTimeFormat;
- fDateTimeFormat = nullptr;
+ fDateTimeFormat = nullptr;
if (fDateFormat) {
initializePattern(status);
@@ -580,7 +580,7 @@ DateIntervalFormat::getDateFormat() const {
void
DateIntervalFormat::adoptTimeZone(TimeZone* zone)
{
- if (fDateFormat != nullptr) {
+ if (fDateFormat != nullptr) {
fDateFormat->adoptTimeZone(zone);
}
// The fDateFormat has the master calendar for the DateIntervalFormat and has
@@ -598,7 +598,7 @@ DateIntervalFormat::adoptTimeZone(TimeZone* zone)
void
DateIntervalFormat::setTimeZone(const TimeZone& zone)
{
- if (fDateFormat != nullptr) {
+ if (fDateFormat != nullptr) {
fDateFormat->setTimeZone(zone);
}
// The fDateFormat has the master calendar for the DateIntervalFormat;
@@ -614,11 +614,11 @@ DateIntervalFormat::setTimeZone(const TimeZone& zone)
const TimeZone&
DateIntervalFormat::getTimeZone() const
{
- if (fDateFormat != nullptr) {
+ if (fDateFormat != nullptr) {
Mutex lock(&gFormatterMutex);
return fDateFormat->getTimeZone();
}
- // If fDateFormat is nullptr (unexpected), create default timezone.
+ // If fDateFormat is nullptr (unexpected), create default timezone.
return *(TimeZone::createDefault());
}
@@ -626,14 +626,14 @@ DateIntervalFormat::DateIntervalFormat(const Locale& locale,
DateIntervalInfo* dtItvInfo,
const UnicodeString* skeleton,
UErrorCode& status)
-: fInfo(nullptr),
- fDateFormat(nullptr),
- fFromCalendar(nullptr),
- fToCalendar(nullptr),
+: fInfo(nullptr),
+ fDateFormat(nullptr),
+ fFromCalendar(nullptr),
+ fToCalendar(nullptr),
fLocale(locale),
- fDatePattern(nullptr),
- fTimePattern(nullptr),
- fDateTimeFormat(nullptr)
+ fDatePattern(nullptr),
+ fTimePattern(nullptr),
+ fDateTimeFormat(nullptr)
{
LocalPointer<DateIntervalInfo> info(dtItvInfo, status);
LocalPointer<SimpleDateFormat> dtfmt(static_cast<SimpleDateFormat *>(
@@ -661,7 +661,7 @@ DateIntervalFormat::create(const Locale& locale,
UErrorCode& status) {
DateIntervalFormat* f = new DateIntervalFormat(locale, dtitvinf,
skeleton, status);
- if ( f == nullptr ) {
+ if ( f == nullptr ) {
status = U_MEMORY_ALLOCATION_ERROR;
delete dtitvinf;
} else if ( U_FAILURE(status) ) {
@@ -778,7 +778,7 @@ DateIntervalFormat::initializePattern(UErrorCode& status) {
// with the time interval.
// The date/time pattern ( such as {0} {1} ) is saved in
// calendar, that is why need to get the CalendarData here.
- LocalUResourceBundlePointer dateTimePatternsRes(ures_open(nullptr, locale.getBaseName(), &status));
+ LocalUResourceBundlePointer dateTimePatternsRes(ures_open(nullptr, locale.getBaseName(), &status));
ures_getByKey(dateTimePatternsRes.getAlias(), gCalendarTag,
dateTimePatternsRes.getAlias(), &status);
ures_getByKeyWithFallback(dateTimePatternsRes.getAlias(), gGregorianTag,
@@ -793,10 +793,10 @@ DateIntervalFormat::initializePattern(UErrorCode& status) {
&dateTimeFormatLength, &status);
if ( U_SUCCESS(status) && dateTimeFormatLength >= 3 ) {
fDateTimeFormat = new UnicodeString(dateTimeFormat, dateTimeFormatLength);
- if (fDateTimeFormat == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
+ if (fDateTimeFormat == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
}
}
@@ -820,9 +820,9 @@ DateIntervalFormat::initializePattern(UErrorCode& status) {
// the first part of the pattern is empty,
// the second part of the pattern is the full-pattern
// should be used in fall-back.
- setPatternInfo(UCAL_DATE, nullptr, &pattern, fInfo->getDefaultOrder());
- setPatternInfo(UCAL_MONTH, nullptr, &pattern, fInfo->getDefaultOrder());
- setPatternInfo(UCAL_YEAR, nullptr, &pattern, fInfo->getDefaultOrder());
+ setPatternInfo(UCAL_DATE, nullptr, &pattern, fInfo->getDefaultOrder());
+ setPatternInfo(UCAL_MONTH, nullptr, &pattern, fInfo->getDefaultOrder());
+ setPatternInfo(UCAL_YEAR, nullptr, &pattern, fInfo->getDefaultOrder());
} else {
// TODO: fall back
}
@@ -846,9 +846,9 @@ DateIntervalFormat::initializePattern(UErrorCode& status) {
// the first part of the pattern is empty,
// the second part of the pattern is the full-pattern
// should be used in fall-back.
- setPatternInfo(UCAL_DATE, nullptr, &pattern, fInfo->getDefaultOrder());
- setPatternInfo(UCAL_MONTH, nullptr, &pattern, fInfo->getDefaultOrder());
- setPatternInfo(UCAL_YEAR, nullptr, &pattern, fInfo->getDefaultOrder());
+ setPatternInfo(UCAL_DATE, nullptr, &pattern, fInfo->getDefaultOrder());
+ setPatternInfo(UCAL_MONTH, nullptr, &pattern, fInfo->getDefaultOrder());
+ setPatternInfo(UCAL_YEAR, nullptr, &pattern, fInfo->getDefaultOrder());
} else {
/* if both present,
* 1) when the year, month, or day differs,
@@ -883,7 +883,7 @@ DateIntervalFormat::initializePattern(UErrorCode& status) {
* range expression for the time.
*/
- if ( fDateTimeFormat == nullptr ) {
+ if ( fDateTimeFormat == nullptr ) {
// earlier failure getting dateTimeFormat
return;
}
@@ -1004,7 +1004,7 @@ DateIntervalFormat::getDateTimeSkeleton(const UnicodeString& skeleton,
if ( MCount < 3 ) {
normalizedDateSkeleton.append(CAP_M);
} else {
- for ( int32_t j = 0; j < MCount && j < MAX_M_COUNT; ++j) {
+ for ( int32_t j = 0; j < MCount && j < MAX_M_COUNT; ++j) {
normalizedDateSkeleton.append(CAP_M);
}
}
@@ -1013,7 +1013,7 @@ DateIntervalFormat::getDateTimeSkeleton(const UnicodeString& skeleton,
if ( ECount <= 3 ) {
normalizedDateSkeleton.append(CAP_E);
} else {
- for ( int32_t j = 0; j < ECount && j < MAX_E_COUNT; ++j ) {
+ for ( int32_t j = 0; j < ECount && j < MAX_E_COUNT; ++j ) {
normalizedDateSkeleton.append(CAP_E);
}
}
@@ -1093,16 +1093,16 @@ DateIntervalFormat::setSeparateDateTimePtn(
int8_t differenceInfo = 0;
const UnicodeString* bestSkeleton = fInfo->getBestSkeleton(*skeleton,
differenceInfo);
- /* best skeleton could be nullptr.
+ /* best skeleton could be nullptr.
For example: in "ca" resource file,
interval format is defined as following
intervalFormats{
fallback{"{0} - {1}"}
}
there is no skeletons/interval patterns defined,
- and the best skeleton match could be nullptr
+ and the best skeleton match could be nullptr
*/
- if ( bestSkeleton == nullptr ) {
+ if ( bestSkeleton == nullptr ) {
return false;
}
@@ -1113,13 +1113,13 @@ DateIntervalFormat::setSeparateDateTimePtn(
status = U_ZERO_ERROR;
fDatePattern = new UnicodeString(DateFormat::getBestPattern(
fLocale, dateSkeleton, status));
- // no way to report OOM. :(
+ // no way to report OOM. :(
}
if ( timeSkeleton.length() != 0) {
status = U_ZERO_ERROR;
fTimePattern = new UnicodeString(DateFormat::getBestPattern(
fLocale, timeSkeleton, status));
- // no way to report OOM. :(
+ // no way to report OOM. :(
}
// difference:
@@ -1151,9 +1151,9 @@ DateIntervalFormat::setSeparateDateTimePtn(
}
setIntervalPattern(UCAL_YEAR, skeleton, bestSkeleton, differenceInfo,
&extendedSkeleton, &extendedBestSkeleton);
- setIntervalPattern(UCAL_ERA, skeleton, bestSkeleton, differenceInfo,
- &extendedSkeleton, &extendedBestSkeleton);
- } else {
+ setIntervalPattern(UCAL_ERA, skeleton, bestSkeleton, differenceInfo,
+ &extendedSkeleton, &extendedBestSkeleton);
+ } else {
setIntervalPattern(UCAL_MINUTE, skeleton, bestSkeleton, differenceInfo);
setIntervalPattern(UCAL_HOUR, skeleton, bestSkeleton, differenceInfo);
setIntervalPattern(UCAL_AM_PM, skeleton, bestSkeleton, differenceInfo);
@@ -1175,7 +1175,7 @@ DateIntervalFormat::setFallbackPattern(UCalendarDateFields field,
if ( U_FAILURE(status) ) {
return;
}
- setPatternInfo(field, nullptr, &pattern, fInfo->getDefaultOrder());
+ setPatternInfo(field, nullptr, &pattern, fInfo->getDefaultOrder());
}
@@ -1425,37 +1425,37 @@ DateIntervalFormat::splitPatternInto2Part(const UnicodeString& intervalPattern)
return (i - count);
}
-void DateIntervalFormat::fallbackFormatRange(
- Calendar& fromCalendar,
- Calendar& toCalendar,
- UnicodeString& appendTo,
- int8_t& firstIndex,
- FieldPositionHandler& fphandler,
- UErrorCode& status) const {
- UnicodeString fallbackPattern;
- fInfo->getFallbackIntervalPattern(fallbackPattern);
- SimpleFormatter sf(fallbackPattern, 2, 2, status);
- if (U_FAILURE(status)) {
+void DateIntervalFormat::fallbackFormatRange(
+ Calendar& fromCalendar,
+ Calendar& toCalendar,
+ UnicodeString& appendTo,
+ int8_t& firstIndex,
+ FieldPositionHandler& fphandler,
+ UErrorCode& status) const {
+ UnicodeString fallbackPattern;
+ fInfo->getFallbackIntervalPattern(fallbackPattern);
+ SimpleFormatter sf(fallbackPattern, 2, 2, status);
+ if (U_FAILURE(status)) {
return;
}
- int32_t offsets[2];
- UnicodeString patternBody = sf.getTextWithNoArguments(offsets, 2);
-
- // TODO(ICU-20406): Use SimpleFormatter Iterator interface when available.
- if (offsets[0] < offsets[1]) {
- firstIndex = 0;
- appendTo.append(patternBody.tempSubStringBetween(0, offsets[0]));
- fDateFormat->_format(fromCalendar, appendTo, fphandler, status);
- appendTo.append(patternBody.tempSubStringBetween(offsets[0], offsets[1]));
- fDateFormat->_format(toCalendar, appendTo, fphandler, status);
- appendTo.append(patternBody.tempSubStringBetween(offsets[1]));
+ int32_t offsets[2];
+ UnicodeString patternBody = sf.getTextWithNoArguments(offsets, 2);
+
+ // TODO(ICU-20406): Use SimpleFormatter Iterator interface when available.
+ if (offsets[0] < offsets[1]) {
+ firstIndex = 0;
+ appendTo.append(patternBody.tempSubStringBetween(0, offsets[0]));
+ fDateFormat->_format(fromCalendar, appendTo, fphandler, status);
+ appendTo.append(patternBody.tempSubStringBetween(offsets[0], offsets[1]));
+ fDateFormat->_format(toCalendar, appendTo, fphandler, status);
+ appendTo.append(patternBody.tempSubStringBetween(offsets[1]));
} else {
- firstIndex = 1;
- appendTo.append(patternBody.tempSubStringBetween(0, offsets[1]));
- fDateFormat->_format(toCalendar, appendTo, fphandler, status);
- appendTo.append(patternBody.tempSubStringBetween(offsets[1], offsets[0]));
- fDateFormat->_format(fromCalendar, appendTo, fphandler, status);
- appendTo.append(patternBody.tempSubStringBetween(offsets[0]));
+ firstIndex = 1;
+ appendTo.append(patternBody.tempSubStringBetween(0, offsets[1]));
+ fDateFormat->_format(toCalendar, appendTo, fphandler, status);
+ appendTo.append(patternBody.tempSubStringBetween(offsets[1], offsets[0]));
+ fDateFormat->_format(fromCalendar, appendTo, fphandler, status);
+ appendTo.append(patternBody.tempSubStringBetween(offsets[0]));
}
}
@@ -1464,50 +1464,50 @@ DateIntervalFormat::fallbackFormat(Calendar& fromCalendar,
Calendar& toCalendar,
UBool fromToOnSameDay, // new
UnicodeString& appendTo,
- int8_t& firstIndex,
- FieldPositionHandler& fphandler,
+ int8_t& firstIndex,
+ FieldPositionHandler& fphandler,
UErrorCode& status) const {
if ( U_FAILURE(status) ) {
return appendTo;
}
-
+
UBool formatDatePlusTimeRange = (fromToOnSameDay && fDatePattern && fTimePattern);
if (formatDatePlusTimeRange) {
- SimpleFormatter sf(*fDateTimeFormat, 2, 2, status);
- if (U_FAILURE(status)) {
- return appendTo;
- }
- int32_t offsets[2];
- UnicodeString patternBody = sf.getTextWithNoArguments(offsets, 2);
-
- UnicodeString fullPattern; // for saving the pattern in fDateFormat
+ SimpleFormatter sf(*fDateTimeFormat, 2, 2, status);
+ if (U_FAILURE(status)) {
+ return appendTo;
+ }
+ int32_t offsets[2];
+ UnicodeString patternBody = sf.getTextWithNoArguments(offsets, 2);
+
+ UnicodeString fullPattern; // for saving the pattern in fDateFormat
fDateFormat->toPattern(fullPattern); // save current pattern, restore later
-
- // {0} is time range
- // {1} is single date portion
- // TODO(ICU-20406): Use SimpleFormatter Iterator interface when available.
- if (offsets[0] < offsets[1]) {
- appendTo.append(patternBody.tempSubStringBetween(0, offsets[0]));
- fDateFormat->applyPattern(*fTimePattern);
- fallbackFormatRange(fromCalendar, toCalendar, appendTo, firstIndex, fphandler, status);
- appendTo.append(patternBody.tempSubStringBetween(offsets[0], offsets[1]));
- fDateFormat->applyPattern(*fDatePattern);
- fDateFormat->_format(fromCalendar, appendTo, fphandler, status);
- appendTo.append(patternBody.tempSubStringBetween(offsets[1]));
- } else {
- appendTo.append(patternBody.tempSubStringBetween(0, offsets[1]));
- fDateFormat->applyPattern(*fDatePattern);
- fDateFormat->_format(fromCalendar, appendTo, fphandler, status);
- appendTo.append(patternBody.tempSubStringBetween(offsets[1], offsets[0]));
- fDateFormat->applyPattern(*fTimePattern);
- fallbackFormatRange(fromCalendar, toCalendar, appendTo, firstIndex, fphandler, status);
- appendTo.append(patternBody.tempSubStringBetween(offsets[0]));
- }
-
+
+ // {0} is time range
+ // {1} is single date portion
+ // TODO(ICU-20406): Use SimpleFormatter Iterator interface when available.
+ if (offsets[0] < offsets[1]) {
+ appendTo.append(patternBody.tempSubStringBetween(0, offsets[0]));
+ fDateFormat->applyPattern(*fTimePattern);
+ fallbackFormatRange(fromCalendar, toCalendar, appendTo, firstIndex, fphandler, status);
+ appendTo.append(patternBody.tempSubStringBetween(offsets[0], offsets[1]));
+ fDateFormat->applyPattern(*fDatePattern);
+ fDateFormat->_format(fromCalendar, appendTo, fphandler, status);
+ appendTo.append(patternBody.tempSubStringBetween(offsets[1]));
+ } else {
+ appendTo.append(patternBody.tempSubStringBetween(0, offsets[1]));
+ fDateFormat->applyPattern(*fDatePattern);
+ fDateFormat->_format(fromCalendar, appendTo, fphandler, status);
+ appendTo.append(patternBody.tempSubStringBetween(offsets[1], offsets[0]));
+ fDateFormat->applyPattern(*fTimePattern);
+ fallbackFormatRange(fromCalendar, toCalendar, appendTo, firstIndex, fphandler, status);
+ appendTo.append(patternBody.tempSubStringBetween(offsets[0]));
+ }
+
// restore full pattern
fDateFormat->applyPattern(fullPattern);
- } else {
- fallbackFormatRange(fromCalendar, toCalendar, appendTo, firstIndex, fphandler, status);
+ } else {
+ fallbackFormatRange(fromCalendar, toCalendar, appendTo, firstIndex, fphandler, status);
}
return appendTo;
}
@@ -1679,7 +1679,7 @@ DateIntervalFormat::fgCalendarFieldToPatternLetter[] =
};
-
+
U_NAMESPACE_END
#endif
diff --git a/contrib/libs/icu/i18n/dtitvinf.cpp b/contrib/libs/icu/i18n/dtitvinf.cpp
index 127240a6e6..25536346ec 100644
--- a/contrib/libs/icu/i18n/dtitvinf.cpp
+++ b/contrib/libs/icu/i18n/dtitvinf.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*******************************************************************************
* Copyright (C) 2008-2016, International Business Machines Corporation and
@@ -42,15 +42,15 @@ U_NAMESPACE_BEGIN
#ifdef DTITVINF_DEBUG
-#define PRINTMESG(msg) UPRV_BLOCK_MACRO_BEGIN { \
- std::cout << "(" << __FILE__ << ":" << __LINE__ << ") " << msg << "\n"; \
-} UPRV_BLOCK_MACRO_END
+#define PRINTMESG(msg) UPRV_BLOCK_MACRO_BEGIN { \
+ std::cout << "(" << __FILE__ << ":" << __LINE__ << ") " << msg << "\n"; \
+} UPRV_BLOCK_MACRO_END
#endif
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DateIntervalInfo)
static const char gCalendarTag[]="calendar";
-static const char gGenericTag[]="generic";
+static const char gGenericTag[]="generic";
static const char gGregorianTag[]="gregorian";
static const char gIntervalDateTimePatternTag[]="intervalFormats";
static const char gFallbackPatternTag[]="fallback";
@@ -66,7 +66,7 @@ static const UChar gDefaultFallbackPattern[] = {LEFT_CURLY_BRACKET, DIGIT_ZERO,
DateIntervalInfo::DateIntervalInfo(UErrorCode& status)
: fFallbackIntervalPattern(gDefaultFallbackPattern),
fFirstDateInPtnIsLaterDate(false),
- fIntervalPatterns(nullptr)
+ fIntervalPatterns(nullptr)
{
fIntervalPatterns = initHash(status);
}
@@ -76,7 +76,7 @@ DateIntervalInfo::DateIntervalInfo(UErrorCode& status)
DateIntervalInfo::DateIntervalInfo(const Locale& locale, UErrorCode& status)
: fFallbackIntervalPattern(gDefaultFallbackPattern),
fFirstDateInPtnIsLaterDate(false),
- fIntervalPatterns(nullptr)
+ fIntervalPatterns(nullptr)
{
initializeData(locale, status);
}
@@ -126,7 +126,7 @@ DateIntervalInfo::setFallbackIntervalPattern(
DateIntervalInfo::DateIntervalInfo(const DateIntervalInfo& dtitvinf)
: UObject(dtitvinf),
- fIntervalPatterns(nullptr)
+ fIntervalPatterns(nullptr)
{
*this = dtitvinf;
}
@@ -161,7 +161,7 @@ DateIntervalInfo::clone() const {
DateIntervalInfo::~DateIntervalInfo() {
deleteHash(fIntervalPatterns);
- fIntervalPatterns = nullptr;
+ fIntervalPatterns = nullptr;
}
@@ -189,7 +189,7 @@ DateIntervalInfo::getIntervalPattern(const UnicodeString& skeleton,
}
const UnicodeString* patternsOfOneSkeleton = (UnicodeString*) fIntervalPatterns->get(skeleton);
- if ( patternsOfOneSkeleton != nullptr ) {
+ if ( patternsOfOneSkeleton != nullptr ) {
IntervalPatternIndex index = calendarFieldToIntervalIndex(field, status);
if ( U_FAILURE(status) ) {
return result;
@@ -329,9 +329,9 @@ struct DateIntervalInfo::DateIntervalSink : public ResourceSink {
char c0;
if ((c0 = patternLetter[0]) != 0 && patternLetter[1] == 0) {
// Check that the pattern letter is accepted
- if (c0 == 'G') {
- return UCAL_ERA;
- } else if (c0 == 'y') {
+ if (c0 == 'G') {
+ return UCAL_ERA;
+ } else if (c0 == 'y') {
return UCAL_YEAR;
} else if (c0 == 'M') {
return UCAL_MONTH;
@@ -363,7 +363,7 @@ struct DateIntervalInfo::DateIntervalSink : public ResourceSink {
UnicodeString* patternsOfOneSkeleton =
(UnicodeString*)(dateIntervalInfo.fIntervalPatterns->get(skeleton));
- if (patternsOfOneSkeleton == nullptr || patternsOfOneSkeleton[index].isEmpty()) {
+ if (patternsOfOneSkeleton == nullptr || patternsOfOneSkeleton[index].isEmpty()) {
UnicodeString pattern = value.getUnicodeString(errorCode);
dateIntervalInfo.setIntervalPatternInternally(skeleton, lrgDiffCalUnit,
pattern, errorCode);
@@ -398,8 +398,8 @@ DateIntervalInfo::initializeData(const Locale& locale, UErrorCode& status)
char calendarType[ULOC_KEYWORDS_CAPACITY]; // to be filled in with the type to use, if all goes well
char localeWithCalendarKey[ULOC_LOCALE_IDENTIFIER_CAPACITY];
// obtain a locale that always has the calendar key value that should be used
- (void)ures_getFunctionalEquivalent(localeWithCalendarKey, ULOC_LOCALE_IDENTIFIER_CAPACITY, nullptr,
- "calendar", "calendar", locName, nullptr, FALSE, &status);
+ (void)ures_getFunctionalEquivalent(localeWithCalendarKey, ULOC_LOCALE_IDENTIFIER_CAPACITY, nullptr,
+ "calendar", "calendar", locName, nullptr, FALSE, &status);
localeWithCalendarKey[ULOC_LOCALE_IDENTIFIER_CAPACITY-1] = 0; // ensure null termination
// now get the calendar key value from that locale
int32_t calendarTypeLen = uloc_getKeywordValue(localeWithCalendarKey, "calendar", calendarType,
@@ -411,47 +411,47 @@ DateIntervalInfo::initializeData(const Locale& locale, UErrorCode& status)
// Instantiate the resource bundles
UResourceBundle *rb, *calBundle;
- rb = ures_open(nullptr, locName, &status);
+ rb = ures_open(nullptr, locName, &status);
if (U_FAILURE(status)) {
return;
}
- calBundle = ures_getByKeyWithFallback(rb, gCalendarTag, nullptr, &status);
+ calBundle = ures_getByKeyWithFallback(rb, gCalendarTag, nullptr, &status);
if (U_SUCCESS(status)) {
UResourceBundle *calTypeBundle, *itvDtPtnResource;
// Get the fallback pattern
- const UChar* resStr = nullptr;
+ const UChar* resStr = nullptr;
int32_t resStrLen = 0;
- calTypeBundle = ures_getByKeyWithFallback(calBundle, calendarTypeToUse, nullptr, &status);
+ calTypeBundle = ures_getByKeyWithFallback(calBundle, calendarTypeToUse, nullptr, &status);
itvDtPtnResource = ures_getByKeyWithFallback(calTypeBundle,
- gIntervalDateTimePatternTag, nullptr, &status);
- // TODO(ICU-20400): After the fixing, we should find the "fallback" from
- // the rb directly by the path "calendar/${calendar}/intervalFormats/fallback".
+ gIntervalDateTimePatternTag, nullptr, &status);
+ // TODO(ICU-20400): After the fixing, we should find the "fallback" from
+ // the rb directly by the path "calendar/${calendar}/intervalFormats/fallback".
if ( U_SUCCESS(status) ) {
- resStr = ures_getStringByKeyWithFallback(itvDtPtnResource, gFallbackPatternTag,
- &resStrLen, &status);
- if ( U_FAILURE(status) ) {
- // Try to find "fallback" from "generic" to work around the bug in
- // ures_getByKeyWithFallback
- UErrorCode localStatus = U_ZERO_ERROR;
- UResourceBundle *genericCalBundle =
- ures_getByKeyWithFallback(calBundle, gGenericTag, nullptr, &localStatus);
- UResourceBundle *genericItvDtPtnResource =
- ures_getByKeyWithFallback(
- genericCalBundle, gIntervalDateTimePatternTag, nullptr, &localStatus);
- resStr = ures_getStringByKeyWithFallback(
- genericItvDtPtnResource, gFallbackPatternTag, &resStrLen, &localStatus);
- ures_close(genericItvDtPtnResource);
- ures_close(genericCalBundle);
- if ( U_SUCCESS(localStatus) ) {
- status = U_USING_FALLBACK_WARNING;;
- }
- }
- }
-
- if ( U_SUCCESS(status) && (resStr != nullptr)) {
+ resStr = ures_getStringByKeyWithFallback(itvDtPtnResource, gFallbackPatternTag,
+ &resStrLen, &status);
+ if ( U_FAILURE(status) ) {
+ // Try to find "fallback" from "generic" to work around the bug in
+ // ures_getByKeyWithFallback
+ UErrorCode localStatus = U_ZERO_ERROR;
+ UResourceBundle *genericCalBundle =
+ ures_getByKeyWithFallback(calBundle, gGenericTag, nullptr, &localStatus);
+ UResourceBundle *genericItvDtPtnResource =
+ ures_getByKeyWithFallback(
+ genericCalBundle, gIntervalDateTimePatternTag, nullptr, &localStatus);
+ resStr = ures_getStringByKeyWithFallback(
+ genericItvDtPtnResource, gFallbackPatternTag, &resStrLen, &localStatus);
+ ures_close(genericItvDtPtnResource);
+ ures_close(genericCalBundle);
+ if ( U_SUCCESS(localStatus) ) {
+ status = U_USING_FALLBACK_WARNING;;
+ }
+ }
+ }
+
+ if ( U_SUCCESS(status) && (resStr != nullptr)) {
UnicodeString pattern = UnicodeString(TRUE, resStr, resStrLen);
setFallbackIntervalPattern(pattern, status);
}
@@ -509,12 +509,12 @@ DateIntervalInfo::setIntervalPatternInternally(const UnicodeString& skeleton,
}
UnicodeString* patternsOfOneSkeleton = (UnicodeString*)(fIntervalPatterns->get(skeleton));
UBool emptyHash = false;
- if ( patternsOfOneSkeleton == nullptr ) {
+ if ( patternsOfOneSkeleton == nullptr ) {
patternsOfOneSkeleton = new UnicodeString[kIPI_MAX_INDEX];
- if (patternsOfOneSkeleton == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
+ if (patternsOfOneSkeleton == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
emptyHash = true;
}
@@ -612,7 +612,7 @@ DateIntervalInfo::getBestSkeleton(const UnicodeString& skeleton,
parseSkeleton(*inputSkeleton, inputSkeletonFieldWidth);
int32_t bestDistance = MAX_POSITIVE_INT;
- const UnicodeString* bestSkeleton = nullptr;
+ const UnicodeString* bestSkeleton = nullptr;
// 0 means exact the same skeletons;
// 1 means having the same field, but with different length,
@@ -622,10 +622,10 @@ DateIntervalInfo::getBestSkeleton(const UnicodeString& skeleton,
int8_t fieldLength = UPRV_LENGTHOF(skeletonFieldWidth);
int32_t pos = UHASH_FIRST;
- const UHashElement* elem = nullptr;
- while ( (elem = fIntervalPatterns->nextElement(pos)) != nullptr ) {
+ const UHashElement* elem = nullptr;
+ while ( (elem = fIntervalPatterns->nextElement(pos)) != nullptr ) {
const UHashTok keyTok = elem->key;
- UnicodeString* newSkeleton = (UnicodeString*)keyTok.pointer;
+ UnicodeString* newSkeleton = (UnicodeString*)keyTok.pointer;
#ifdef DTITVINF_DEBUG
skeleton->extract(0, skeleton->length(), result, "UTF-8");
sprintf(mesg, "available skeletons: skeleton: %s; \n", result);
@@ -637,7 +637,7 @@ DateIntervalInfo::getBestSkeleton(const UnicodeString& skeleton,
for ( i = 0; i < fieldLength; ++i ) {
skeletonFieldWidth[i] = 0;
}
- parseSkeleton(*newSkeleton, skeletonFieldWidth);
+ parseSkeleton(*newSkeleton, skeletonFieldWidth);
// calculate distance
int32_t distance = 0;
int8_t fieldDifference = 1;
@@ -663,7 +663,7 @@ DateIntervalInfo::getBestSkeleton(const UnicodeString& skeleton,
}
}
if ( distance < bestDistance ) {
- bestSkeleton = newSkeleton;
+ bestSkeleton = newSkeleton;
bestDistance = distance;
bestMatchDistanceInfo = fieldDifference;
}
@@ -715,9 +715,9 @@ DateIntervalInfo::calendarFieldToIntervalIndex(UCalendarDateFields field,
case UCAL_SECOND:
index = kIPI_SECOND;
break;
- case UCAL_MILLISECOND:
- index = kIPI_MILLISECOND;
- break;
+ case UCAL_MILLISECOND:
+ index = kIPI_MILLISECOND;
+ break;
default:
status = U_ILLEGAL_ARGUMENT_ERROR;
}
@@ -729,12 +729,12 @@ DateIntervalInfo::calendarFieldToIntervalIndex(UCalendarDateFields field,
void
DateIntervalInfo::deleteHash(Hashtable* hTable)
{
- if ( hTable == nullptr ) {
+ if ( hTable == nullptr ) {
return;
}
int32_t pos = UHASH_FIRST;
- const UHashElement* element = nullptr;
- while ( (element = hTable->nextElement(pos)) != nullptr ) {
+ const UHashElement* element = nullptr;
+ while ( (element = hTable->nextElement(pos)) != nullptr ) {
const UHashTok valueTok = element->value;
const UnicodeString* value = (UnicodeString*)valueTok.pointer;
delete[] value;
@@ -772,16 +772,16 @@ U_CDECL_END
Hashtable*
DateIntervalInfo::initHash(UErrorCode& status) {
if ( U_FAILURE(status) ) {
- return nullptr;
+ return nullptr;
}
Hashtable* hTable;
- if ( (hTable = new Hashtable(FALSE, status)) == nullptr ) {
+ if ( (hTable = new Hashtable(FALSE, status)) == nullptr ) {
status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
+ return nullptr;
}
if ( U_FAILURE(status) ) {
delete hTable;
- return nullptr;
+ return nullptr;
}
hTable->setValueComparator(dtitvinfHashTableValueComparator);
return hTable;
@@ -796,18 +796,18 @@ DateIntervalInfo::copyHash(const Hashtable* source,
return;
}
int32_t pos = UHASH_FIRST;
- const UHashElement* element = nullptr;
+ const UHashElement* element = nullptr;
if ( source ) {
- while ( (element = source->nextElement(pos)) != nullptr ) {
+ while ( (element = source->nextElement(pos)) != nullptr ) {
const UHashTok keyTok = element->key;
const UnicodeString* key = (UnicodeString*)keyTok.pointer;
const UHashTok valueTok = element->value;
const UnicodeString* value = (UnicodeString*)valueTok.pointer;
UnicodeString* copy = new UnicodeString[kIPI_MAX_INDEX];
- if (copy == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
+ if (copy == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
int8_t i;
for ( i = 0; i < kIPI_MAX_INDEX; ++i ) {
copy[i] = value[i];
diff --git a/contrib/libs/icu/i18n/dtptngen.cpp b/contrib/libs/icu/i18n/dtptngen.cpp
index 992b0a869b..02be4f054b 100644
--- a/contrib/libs/icu/i18n/dtptngen.cpp
+++ b/contrib/libs/icu/i18n/dtptngen.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -18,7 +18,7 @@
#include "unicode/decimfmt.h"
#include "unicode/dtfmtsym.h"
#include "unicode/dtptngen.h"
-#include "unicode/localpointer.h"
+#include "unicode/localpointer.h"
#include "unicode/simpleformatter.h"
#include "unicode/smpdtfmt.h"
#include "unicode/udat.h"
@@ -28,7 +28,7 @@
#include "unicode/ures.h"
#include "unicode/ustring.h"
#include "unicode/rep.h"
-#include "unicode/region.h"
+#include "unicode/region.h"
#include "cpputils.h"
#include "mutex.h"
#include "umutex.h"
@@ -90,17 +90,17 @@ static void ures_a_open(UResourceBundleAIterator *aiter, UResourceBundle *bund,
aiter->num = ures_getSize(aiter->bund);
aiter->cursor = 0;
#if !defined(U_SORT_ASCII_BUNDLE_ITERATOR)
- aiter->entries = nullptr;
+ aiter->entries = nullptr;
#else
aiter->entries = (UResAEntry*)uprv_malloc(sizeof(UResAEntry)*aiter->num);
for(int i=0;i<aiter->num;i++) {
- aiter->entries[i].item = ures_getByIndex(aiter->bund, i, nullptr, status);
+ aiter->entries[i].item = ures_getByIndex(aiter->bund, i, nullptr, status);
const char *akey = ures_getKey(aiter->entries[i].item);
int32_t len = uprv_strlen(akey)+1;
aiter->entries[i].key = (UChar*)uprv_malloc(len*sizeof(UChar));
u_charsToUChars(akey, aiter->entries[i].key, len);
}
- uprv_sortArray(aiter->entries, aiter->num, sizeof(UResAEntry), ures_a_codepointSort, nullptr, TRUE, status);
+ uprv_sortArray(aiter->entries, aiter->num, sizeof(UResAEntry), ures_a_codepointSort, nullptr, TRUE, status);
#endif
}
@@ -117,7 +117,7 @@ static const UChar *ures_a_getNextString(UResourceBundleAIterator *aiter, int32_
#if !defined(U_SORT_ASCII_BUNDLE_ITERATOR)
return ures_getNextString(aiter->bund, len, key, err);
#else
- if(U_FAILURE(*err)) return nullptr;
+ if(U_FAILURE(*err)) return nullptr;
UResourceBundle *item = aiter->entries[aiter->cursor].item;
const UChar* ret = ures_getString(item, len, err);
*key = ures_getKey(item);
@@ -136,18 +136,18 @@ U_NAMESPACE_BEGIN
// class DateTimePatternGenerator
// *****************************************************************************
static const UChar Canonical_Items[] = {
- // GyQMwWEDFdaHmsSv
- CAP_G, LOW_Y, CAP_Q, CAP_M, LOW_W, CAP_W, CAP_E,
- CAP_D, CAP_F, LOW_D, LOW_A, // The UDATPG_x_FIELD constants and these fields have a different order than in ICU4J
+ // GyQMwWEDFdaHmsSv
+ CAP_G, LOW_Y, CAP_Q, CAP_M, LOW_W, CAP_W, CAP_E,
+ CAP_D, CAP_F, LOW_D, LOW_A, // The UDATPG_x_FIELD constants and these fields have a different order than in ICU4J
CAP_H, LOW_M, LOW_S, CAP_S, LOW_V, 0
};
static const dtTypeElem dtTypes[] = {
// patternChar, field, type, minLen, weight
{CAP_G, UDATPG_ERA_FIELD, DT_SHORT, 1, 3,},
- {CAP_G, UDATPG_ERA_FIELD, DT_LONG, 4, 0},
- {CAP_G, UDATPG_ERA_FIELD, DT_NARROW, 5, 0},
-
+ {CAP_G, UDATPG_ERA_FIELD, DT_LONG, 4, 0},
+ {CAP_G, UDATPG_ERA_FIELD, DT_NARROW, 5, 0},
+
{LOW_Y, UDATPG_YEAR_FIELD, DT_NUMERIC, 1, 20},
{CAP_Y, UDATPG_YEAR_FIELD, DT_NUMERIC + DT_DELTA, 1, 20},
{LOW_U, UDATPG_YEAR_FIELD, DT_NUMERIC + 2*DT_DELTA, 1, 20},
@@ -155,16 +155,16 @@ static const dtTypeElem dtTypes[] = {
{CAP_U, UDATPG_YEAR_FIELD, DT_SHORT, 1, 3},
{CAP_U, UDATPG_YEAR_FIELD, DT_LONG, 4, 0},
{CAP_U, UDATPG_YEAR_FIELD, DT_NARROW, 5, 0},
-
+
{CAP_Q, UDATPG_QUARTER_FIELD, DT_NUMERIC, 1, 2},
{CAP_Q, UDATPG_QUARTER_FIELD, DT_SHORT, 3, 0},
{CAP_Q, UDATPG_QUARTER_FIELD, DT_LONG, 4, 0},
- {CAP_Q, UDATPG_QUARTER_FIELD, DT_NARROW, 5, 0},
+ {CAP_Q, UDATPG_QUARTER_FIELD, DT_NARROW, 5, 0},
{LOW_Q, UDATPG_QUARTER_FIELD, DT_NUMERIC + DT_DELTA, 1, 2},
- {LOW_Q, UDATPG_QUARTER_FIELD, DT_SHORT - DT_DELTA, 3, 0},
- {LOW_Q, UDATPG_QUARTER_FIELD, DT_LONG - DT_DELTA, 4, 0},
- {LOW_Q, UDATPG_QUARTER_FIELD, DT_NARROW - DT_DELTA, 5, 0},
-
+ {LOW_Q, UDATPG_QUARTER_FIELD, DT_SHORT - DT_DELTA, 3, 0},
+ {LOW_Q, UDATPG_QUARTER_FIELD, DT_LONG - DT_DELTA, 4, 0},
+ {LOW_Q, UDATPG_QUARTER_FIELD, DT_NARROW - DT_DELTA, 5, 0},
+
{CAP_M, UDATPG_MONTH_FIELD, DT_NUMERIC, 1, 2},
{CAP_M, UDATPG_MONTH_FIELD, DT_SHORT, 3, 0},
{CAP_M, UDATPG_MONTH_FIELD, DT_LONG, 4, 0},
@@ -174,66 +174,66 @@ static const dtTypeElem dtTypes[] = {
{CAP_L, UDATPG_MONTH_FIELD, DT_LONG - DT_DELTA, 4, 0},
{CAP_L, UDATPG_MONTH_FIELD, DT_NARROW - DT_DELTA, 5, 0},
{LOW_L, UDATPG_MONTH_FIELD, DT_NUMERIC + DT_DELTA, 1, 1},
-
+
{LOW_W, UDATPG_WEEK_OF_YEAR_FIELD, DT_NUMERIC, 1, 2},
-
- {CAP_W, UDATPG_WEEK_OF_MONTH_FIELD, DT_NUMERIC, 1, 0},
-
+
+ {CAP_W, UDATPG_WEEK_OF_MONTH_FIELD, DT_NUMERIC, 1, 0},
+
{CAP_E, UDATPG_WEEKDAY_FIELD, DT_SHORT, 1, 3},
{CAP_E, UDATPG_WEEKDAY_FIELD, DT_LONG, 4, 0},
{CAP_E, UDATPG_WEEKDAY_FIELD, DT_NARROW, 5, 0},
- {CAP_E, UDATPG_WEEKDAY_FIELD, DT_SHORTER, 6, 0},
+ {CAP_E, UDATPG_WEEKDAY_FIELD, DT_SHORTER, 6, 0},
{LOW_C, UDATPG_WEEKDAY_FIELD, DT_NUMERIC + 2*DT_DELTA, 1, 2},
{LOW_C, UDATPG_WEEKDAY_FIELD, DT_SHORT - 2*DT_DELTA, 3, 0},
{LOW_C, UDATPG_WEEKDAY_FIELD, DT_LONG - 2*DT_DELTA, 4, 0},
{LOW_C, UDATPG_WEEKDAY_FIELD, DT_NARROW - 2*DT_DELTA, 5, 0},
- {LOW_C, UDATPG_WEEKDAY_FIELD, DT_SHORTER - 2*DT_DELTA, 6, 0},
+ {LOW_C, UDATPG_WEEKDAY_FIELD, DT_SHORTER - 2*DT_DELTA, 6, 0},
{LOW_E, UDATPG_WEEKDAY_FIELD, DT_NUMERIC + DT_DELTA, 1, 2}, // LOW_E is currently not used in CLDR data, should not be canonical
{LOW_E, UDATPG_WEEKDAY_FIELD, DT_SHORT - DT_DELTA, 3, 0},
{LOW_E, UDATPG_WEEKDAY_FIELD, DT_LONG - DT_DELTA, 4, 0},
{LOW_E, UDATPG_WEEKDAY_FIELD, DT_NARROW - DT_DELTA, 5, 0},
- {LOW_E, UDATPG_WEEKDAY_FIELD, DT_SHORTER - DT_DELTA, 6, 0},
-
+ {LOW_E, UDATPG_WEEKDAY_FIELD, DT_SHORTER - DT_DELTA, 6, 0},
+
{LOW_D, UDATPG_DAY_FIELD, DT_NUMERIC, 1, 2},
- {LOW_G, UDATPG_DAY_FIELD, DT_NUMERIC + DT_DELTA, 1, 20}, // really internal use, so we don't care
-
- {CAP_D, UDATPG_DAY_OF_YEAR_FIELD, DT_NUMERIC, 1, 3},
-
- {CAP_F, UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD, DT_NUMERIC, 1, 0},
-
- {LOW_A, UDATPG_DAYPERIOD_FIELD, DT_SHORT, 1, 3},
- {LOW_A, UDATPG_DAYPERIOD_FIELD, DT_LONG, 4, 0},
- {LOW_A, UDATPG_DAYPERIOD_FIELD, DT_NARROW, 5, 0},
- {LOW_B, UDATPG_DAYPERIOD_FIELD, DT_SHORT - DT_DELTA, 1, 3},
- {LOW_B, UDATPG_DAYPERIOD_FIELD, DT_LONG - DT_DELTA, 4, 0},
- {LOW_B, UDATPG_DAYPERIOD_FIELD, DT_NARROW - DT_DELTA, 5, 0},
- // b needs to be closer to a than to B, so we make this 3*DT_DELTA
- {CAP_B, UDATPG_DAYPERIOD_FIELD, DT_SHORT - 3*DT_DELTA, 1, 3},
- {CAP_B, UDATPG_DAYPERIOD_FIELD, DT_LONG - 3*DT_DELTA, 4, 0},
- {CAP_B, UDATPG_DAYPERIOD_FIELD, DT_NARROW - 3*DT_DELTA, 5, 0},
-
+ {LOW_G, UDATPG_DAY_FIELD, DT_NUMERIC + DT_DELTA, 1, 20}, // really internal use, so we don't care
+
+ {CAP_D, UDATPG_DAY_OF_YEAR_FIELD, DT_NUMERIC, 1, 3},
+
+ {CAP_F, UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD, DT_NUMERIC, 1, 0},
+
+ {LOW_A, UDATPG_DAYPERIOD_FIELD, DT_SHORT, 1, 3},
+ {LOW_A, UDATPG_DAYPERIOD_FIELD, DT_LONG, 4, 0},
+ {LOW_A, UDATPG_DAYPERIOD_FIELD, DT_NARROW, 5, 0},
+ {LOW_B, UDATPG_DAYPERIOD_FIELD, DT_SHORT - DT_DELTA, 1, 3},
+ {LOW_B, UDATPG_DAYPERIOD_FIELD, DT_LONG - DT_DELTA, 4, 0},
+ {LOW_B, UDATPG_DAYPERIOD_FIELD, DT_NARROW - DT_DELTA, 5, 0},
+ // b needs to be closer to a than to B, so we make this 3*DT_DELTA
+ {CAP_B, UDATPG_DAYPERIOD_FIELD, DT_SHORT - 3*DT_DELTA, 1, 3},
+ {CAP_B, UDATPG_DAYPERIOD_FIELD, DT_LONG - 3*DT_DELTA, 4, 0},
+ {CAP_B, UDATPG_DAYPERIOD_FIELD, DT_NARROW - 3*DT_DELTA, 5, 0},
+
{CAP_H, UDATPG_HOUR_FIELD, DT_NUMERIC + 10*DT_DELTA, 1, 2}, // 24 hour
{LOW_K, UDATPG_HOUR_FIELD, DT_NUMERIC + 11*DT_DELTA, 1, 2}, // 24 hour
{LOW_H, UDATPG_HOUR_FIELD, DT_NUMERIC, 1, 2}, // 12 hour
{CAP_K, UDATPG_HOUR_FIELD, DT_NUMERIC + DT_DELTA, 1, 2}, // 12 hour
- // The C code has had versions of the following 3, keep & update. Should not need these, but...
- // Without these, certain tests using e.g. staticGetSkeleton fail because j/J in patterns
- // get skipped instead of mapped to the right hour chars, for example in
- // DateFormatTest::TestPatternFromSkeleton
- // IntlTestDateTimePatternGeneratorAPI:: testStaticGetSkeleton
- // DateIntervalFormatTest::testTicket11985
- // Need to investigate better handling of jJC replacement e.g. in staticGetSkeleton.
- {CAP_J, UDATPG_HOUR_FIELD, DT_NUMERIC + 5*DT_DELTA, 1, 2}, // 12/24 hour no AM/PM
- {LOW_J, UDATPG_HOUR_FIELD, DT_NUMERIC + 6*DT_DELTA, 1, 6}, // 12/24 hour
- {CAP_C, UDATPG_HOUR_FIELD, DT_NUMERIC + 7*DT_DELTA, 1, 6}, // 12/24 hour with preferred dayPeriods for 12
-
+ // The C code has had versions of the following 3, keep & update. Should not need these, but...
+ // Without these, certain tests using e.g. staticGetSkeleton fail because j/J in patterns
+ // get skipped instead of mapped to the right hour chars, for example in
+ // DateFormatTest::TestPatternFromSkeleton
+ // IntlTestDateTimePatternGeneratorAPI:: testStaticGetSkeleton
+ // DateIntervalFormatTest::testTicket11985
+ // Need to investigate better handling of jJC replacement e.g. in staticGetSkeleton.
+ {CAP_J, UDATPG_HOUR_FIELD, DT_NUMERIC + 5*DT_DELTA, 1, 2}, // 12/24 hour no AM/PM
+ {LOW_J, UDATPG_HOUR_FIELD, DT_NUMERIC + 6*DT_DELTA, 1, 6}, // 12/24 hour
+ {CAP_C, UDATPG_HOUR_FIELD, DT_NUMERIC + 7*DT_DELTA, 1, 6}, // 12/24 hour with preferred dayPeriods for 12
+
{LOW_M, UDATPG_MINUTE_FIELD, DT_NUMERIC, 1, 2},
-
+
{LOW_S, UDATPG_SECOND_FIELD, DT_NUMERIC, 1, 2},
- {CAP_A, UDATPG_SECOND_FIELD, DT_NUMERIC + DT_DELTA, 1, 1000},
-
- {CAP_S, UDATPG_FRACTIONAL_SECOND_FIELD, DT_NUMERIC, 1, 1000},
-
+ {CAP_A, UDATPG_SECOND_FIELD, DT_NUMERIC + DT_DELTA, 1, 1000},
+
+ {CAP_S, UDATPG_FRACTIONAL_SECOND_FIELD, DT_NUMERIC, 1, 1000},
+
{LOW_V, UDATPG_ZONE_FIELD, DT_SHORT - 2*DT_DELTA, 1, 0},
{LOW_V, UDATPG_ZONE_FIELD, DT_LONG - 2*DT_DELTA, 4, 0},
{LOW_Z, UDATPG_ZONE_FIELD, DT_SHORT, 1, 3},
@@ -245,39 +245,39 @@ static const dtTypeElem dtTypes[] = {
{CAP_O, UDATPG_ZONE_FIELD, DT_LONG - DT_DELTA, 4, 0},
{CAP_V, UDATPG_ZONE_FIELD, DT_SHORT - DT_DELTA, 1, 0},
{CAP_V, UDATPG_ZONE_FIELD, DT_LONG - DT_DELTA, 2, 0},
- {CAP_V, UDATPG_ZONE_FIELD, DT_LONG-1 - DT_DELTA, 3, 0},
- {CAP_V, UDATPG_ZONE_FIELD, DT_LONG-2 - DT_DELTA, 4, 0},
+ {CAP_V, UDATPG_ZONE_FIELD, DT_LONG-1 - DT_DELTA, 3, 0},
+ {CAP_V, UDATPG_ZONE_FIELD, DT_LONG-2 - DT_DELTA, 4, 0},
{CAP_X, UDATPG_ZONE_FIELD, DT_NARROW - DT_DELTA, 1, 0},
{CAP_X, UDATPG_ZONE_FIELD, DT_SHORT - DT_DELTA, 2, 0},
{CAP_X, UDATPG_ZONE_FIELD, DT_LONG - DT_DELTA, 4, 0},
{LOW_X, UDATPG_ZONE_FIELD, DT_NARROW - DT_DELTA, 1, 0},
{LOW_X, UDATPG_ZONE_FIELD, DT_SHORT - DT_DELTA, 2, 0},
{LOW_X, UDATPG_ZONE_FIELD, DT_LONG - DT_DELTA, 4, 0},
-
+
{0, UDATPG_FIELD_COUNT, 0, 0, 0} , // last row of dtTypes[]
};
static const char* const CLDR_FIELD_APPEND[] = {
- "Era", "Year", "Quarter", "Month", "Week", "*", "Day-Of-Week",
- "*", "*", "Day", "*", // The UDATPG_x_FIELD constants and these fields have a different order than in ICU4J
+ "Era", "Year", "Quarter", "Month", "Week", "*", "Day-Of-Week",
+ "*", "*", "Day", "*", // The UDATPG_x_FIELD constants and these fields have a different order than in ICU4J
"Hour", "Minute", "Second", "*", "Timezone"
};
-static const char* const CLDR_FIELD_NAME[UDATPG_FIELD_COUNT] = {
- "era", "year", "quarter", "month", "week", "weekOfMonth", "weekday",
- "dayOfYear", "weekdayOfMonth", "day", "dayperiod", // The UDATPG_x_FIELD constants and these fields have a different order than in ICU4J
+static const char* const CLDR_FIELD_NAME[UDATPG_FIELD_COUNT] = {
+ "era", "year", "quarter", "month", "week", "weekOfMonth", "weekday",
+ "dayOfYear", "weekdayOfMonth", "day", "dayperiod", // The UDATPG_x_FIELD constants and these fields have a different order than in ICU4J
"hour", "minute", "second", "*", "zone"
};
-static const char* const CLDR_FIELD_WIDTH[] = { // [UDATPG_WIDTH_COUNT]
- "", "-short", "-narrow"
-};
-
-// TODO(ticket:13619): remove when definition uncommented in dtptngen.h.
-static const int32_t UDATPG_WIDTH_COUNT = UDATPG_NARROW + 1;
-static constexpr UDateTimePGDisplayWidth UDATPG_WIDTH_APPENDITEM = UDATPG_WIDE;
-static constexpr int32_t UDATPG_FIELD_KEY_MAX = 24; // max length of CLDR field tag (type + width)
-
+static const char* const CLDR_FIELD_WIDTH[] = { // [UDATPG_WIDTH_COUNT]
+ "", "-short", "-narrow"
+};
+
+// TODO(ticket:13619): remove when definition uncommented in dtptngen.h.
+static const int32_t UDATPG_WIDTH_COUNT = UDATPG_NARROW + 1;
+static constexpr UDateTimePGDisplayWidth UDATPG_WIDTH_APPENDITEM = UDATPG_WIDE;
+static constexpr int32_t UDATPG_FIELD_KEY_MAX = 24; // max length of CLDR field tag (type + width)
+
// For appendItems
static const UChar UDATPG_ItemFormat[]= {0x7B, 0x30, 0x7D, 0x20, 0x251C, 0x7B, 0x32, 0x7D, 0x3A,
0x20, 0x7B, 0x31, 0x7D, 0x2524, 0}; // {0} \u251C{2}: {1}\u2524
@@ -304,50 +304,50 @@ DateTimePatternGenerator::createInstance(UErrorCode& status) {
DateTimePatternGenerator* U_EXPORT2
DateTimePatternGenerator::createInstance(const Locale& locale, UErrorCode& status) {
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
LocalPointer<DateTimePatternGenerator> result(
new DateTimePatternGenerator(locale, status), status);
- return U_SUCCESS(status) ? result.orphan() : nullptr;
+ return U_SUCCESS(status) ? result.orphan() : nullptr;
}
DateTimePatternGenerator* U_EXPORT2
DateTimePatternGenerator::createEmptyInstance(UErrorCode& status) {
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
- LocalPointer<DateTimePatternGenerator> result(
- new DateTimePatternGenerator(status), status);
- return U_SUCCESS(status) ? result.orphan() : nullptr;
+ LocalPointer<DateTimePatternGenerator> result(
+ new DateTimePatternGenerator(status), status);
+ return U_SUCCESS(status) ? result.orphan() : nullptr;
}
DateTimePatternGenerator::DateTimePatternGenerator(UErrorCode &status) :
- skipMatcher(nullptr),
- fAvailableFormatKeyHash(nullptr),
- fDefaultHourFormatChar(0),
- internalErrorCode(U_ZERO_ERROR)
+ skipMatcher(nullptr),
+ fAvailableFormatKeyHash(nullptr),
+ fDefaultHourFormatChar(0),
+ internalErrorCode(U_ZERO_ERROR)
{
fp = new FormatParser();
dtMatcher = new DateTimeMatcher();
distanceInfo = new DistanceInfo();
patternMap = new PatternMap();
- if (fp == nullptr || dtMatcher == nullptr || distanceInfo == nullptr || patternMap == nullptr) {
- internalErrorCode = status = U_MEMORY_ALLOCATION_ERROR;
+ if (fp == nullptr || dtMatcher == nullptr || distanceInfo == nullptr || patternMap == nullptr) {
+ internalErrorCode = status = U_MEMORY_ALLOCATION_ERROR;
}
}
DateTimePatternGenerator::DateTimePatternGenerator(const Locale& locale, UErrorCode &status) :
- skipMatcher(nullptr),
- fAvailableFormatKeyHash(nullptr),
- fDefaultHourFormatChar(0),
- internalErrorCode(U_ZERO_ERROR)
+ skipMatcher(nullptr),
+ fAvailableFormatKeyHash(nullptr),
+ fDefaultHourFormatChar(0),
+ internalErrorCode(U_ZERO_ERROR)
{
fp = new FormatParser();
dtMatcher = new DateTimeMatcher();
distanceInfo = new DistanceInfo();
patternMap = new PatternMap();
- if (fp == nullptr || dtMatcher == nullptr || distanceInfo == nullptr || patternMap == nullptr) {
- internalErrorCode = status = U_MEMORY_ALLOCATION_ERROR;
+ if (fp == nullptr || dtMatcher == nullptr || distanceInfo == nullptr || patternMap == nullptr) {
+ internalErrorCode = status = U_MEMORY_ALLOCATION_ERROR;
}
else {
initData(locale, status);
@@ -356,18 +356,18 @@ DateTimePatternGenerator::DateTimePatternGenerator(const Locale& locale, UErrorC
DateTimePatternGenerator::DateTimePatternGenerator(const DateTimePatternGenerator& other) :
UObject(),
- skipMatcher(nullptr),
- fAvailableFormatKeyHash(nullptr),
- fDefaultHourFormatChar(0),
- internalErrorCode(U_ZERO_ERROR)
+ skipMatcher(nullptr),
+ fAvailableFormatKeyHash(nullptr),
+ fDefaultHourFormatChar(0),
+ internalErrorCode(U_ZERO_ERROR)
{
fp = new FormatParser();
dtMatcher = new DateTimeMatcher();
distanceInfo = new DistanceInfo();
patternMap = new PatternMap();
- if (fp == nullptr || dtMatcher == nullptr || distanceInfo == nullptr || patternMap == nullptr) {
- internalErrorCode = U_MEMORY_ALLOCATION_ERROR;
- }
+ if (fp == nullptr || dtMatcher == nullptr || distanceInfo == nullptr || patternMap == nullptr) {
+ internalErrorCode = U_MEMORY_ALLOCATION_ERROR;
+ }
*this=other;
}
@@ -377,7 +377,7 @@ DateTimePatternGenerator::operator=(const DateTimePatternGenerator& other) {
if (&other == this) {
return *this;
}
- internalErrorCode = other.internalErrorCode;
+ internalErrorCode = other.internalErrorCode;
pLocale = other.pLocale;
fDefaultHourFormatChar = other.fDefaultHourFormatChar;
*fp = *(other.fp);
@@ -389,27 +389,27 @@ DateTimePatternGenerator::operator=(const DateTimePatternGenerator& other) {
dateTimeFormat.getTerminatedBuffer();
decimal.getTerminatedBuffer();
delete skipMatcher;
- if ( other.skipMatcher == nullptr ) {
- skipMatcher = nullptr;
+ if ( other.skipMatcher == nullptr ) {
+ skipMatcher = nullptr;
}
else {
skipMatcher = new DateTimeMatcher(*other.skipMatcher);
- if (skipMatcher == nullptr)
- {
- internalErrorCode = U_MEMORY_ALLOCATION_ERROR;
- return *this;
- }
+ if (skipMatcher == nullptr)
+ {
+ internalErrorCode = U_MEMORY_ALLOCATION_ERROR;
+ return *this;
+ }
}
for (int32_t i=0; i< UDATPG_FIELD_COUNT; ++i ) {
appendItemFormats[i] = other.appendItemFormats[i];
- appendItemFormats[i].getTerminatedBuffer(); // NUL-terminate for the C API.
- for (int32_t j=0; j< UDATPG_WIDTH_COUNT; ++j ) {
- fieldDisplayNames[i][j] = other.fieldDisplayNames[i][j];
- fieldDisplayNames[i][j].getTerminatedBuffer(); // NUL-terminate for the C API.
- }
- }
- patternMap->copyFrom(*other.patternMap, internalErrorCode);
- copyHashtable(other.fAvailableFormatKeyHash, internalErrorCode);
+ appendItemFormats[i].getTerminatedBuffer(); // NUL-terminate for the C API.
+ for (int32_t j=0; j< UDATPG_WIDTH_COUNT; ++j ) {
+ fieldDisplayNames[i][j] = other.fieldDisplayNames[i][j];
+ fieldDisplayNames[i][j].getTerminatedBuffer(); // NUL-terminate for the C API.
+ }
+ }
+ patternMap->copyFrom(*other.patternMap, internalErrorCode);
+ copyHashtable(other.fAvailableFormatKeyHash, internalErrorCode);
return *this;
}
@@ -422,14 +422,14 @@ DateTimePatternGenerator::operator==(const DateTimePatternGenerator& other) cons
if ((pLocale==other.pLocale) && (patternMap->equals(*other.patternMap)) &&
(dateTimeFormat==other.dateTimeFormat) && (decimal==other.decimal)) {
for ( int32_t i=0 ; i<UDATPG_FIELD_COUNT; ++i ) {
- if (appendItemFormats[i] != other.appendItemFormats[i]) {
- return FALSE;
- }
- for (int32_t j=0; j< UDATPG_WIDTH_COUNT; ++j ) {
- if (fieldDisplayNames[i][j] != other.fieldDisplayNames[i][j]) {
- return FALSE;
- }
- }
+ if (appendItemFormats[i] != other.appendItemFormats[i]) {
+ return FALSE;
+ }
+ for (int32_t j=0; j< UDATPG_WIDTH_COUNT; ++j ) {
+ if (fieldDisplayNames[i][j] != other.fieldDisplayNames[i][j]) {
+ return FALSE;
+ }
+ }
}
return TRUE;
}
@@ -444,21 +444,21 @@ DateTimePatternGenerator::operator!=(const DateTimePatternGenerator& other) cons
}
DateTimePatternGenerator::~DateTimePatternGenerator() {
- if (fAvailableFormatKeyHash!=nullptr) {
+ if (fAvailableFormatKeyHash!=nullptr) {
delete fAvailableFormatKeyHash;
}
- if (fp != nullptr) delete fp;
- if (dtMatcher != nullptr) delete dtMatcher;
- if (distanceInfo != nullptr) delete distanceInfo;
- if (patternMap != nullptr) delete patternMap;
- if (skipMatcher != nullptr) delete skipMatcher;
+ if (fp != nullptr) delete fp;
+ if (dtMatcher != nullptr) delete dtMatcher;
+ if (distanceInfo != nullptr) delete distanceInfo;
+ if (patternMap != nullptr) delete patternMap;
+ if (skipMatcher != nullptr) delete skipMatcher;
}
namespace {
UInitOnce initOnce = U_INITONCE_INITIALIZER;
-UHashtable *localeToAllowedHourFormatsMap = nullptr;
+UHashtable *localeToAllowedHourFormatsMap = nullptr;
// Value deleter for hashmap.
U_CFUNC void U_CALLCONV deleteAllowedHourFormats(void *ptr) {
@@ -475,13 +475,13 @@ enum AllowedHourFormat{
ALLOWED_HOUR_FORMAT_UNKNOWN = -1,
ALLOWED_HOUR_FORMAT_h,
ALLOWED_HOUR_FORMAT_H,
- ALLOWED_HOUR_FORMAT_K, // Added ICU-20383, used by JP
- ALLOWED_HOUR_FORMAT_k, // Added ICU-20383, not currently used
+ ALLOWED_HOUR_FORMAT_K, // Added ICU-20383, used by JP
+ ALLOWED_HOUR_FORMAT_k, // Added ICU-20383, not currently used
ALLOWED_HOUR_FORMAT_hb,
- ALLOWED_HOUR_FORMAT_hB,
- ALLOWED_HOUR_FORMAT_Kb, // Added ICU-20383, not currently used
- ALLOWED_HOUR_FORMAT_KB, // Added ICU-20383, not currently used
- // ICU-20383 The following are unlikely and not currently used
+ ALLOWED_HOUR_FORMAT_hB,
+ ALLOWED_HOUR_FORMAT_Kb, // Added ICU-20383, not currently used
+ ALLOWED_HOUR_FORMAT_KB, // Added ICU-20383, not currently used
+ // ICU-20383 The following are unlikely and not currently used
ALLOWED_HOUR_FORMAT_Hb,
ALLOWED_HOUR_FORMAT_HB
};
@@ -492,8 +492,8 @@ void
DateTimePatternGenerator::initData(const Locale& locale, UErrorCode &status) {
//const char *baseLangName = locale.getBaseName(); // unused
- skipMatcher = nullptr;
- fAvailableFormatKeyHash=nullptr;
+ skipMatcher = nullptr;
+ fAvailableFormatKeyHash=nullptr;
addCanonicalItems(status);
addICUPatterns(locale, status);
addCLDRData(locale, status);
@@ -501,8 +501,8 @@ DateTimePatternGenerator::initData(const Locale& locale, UErrorCode &status) {
setDecimalSymbols(locale, status);
umtx_initOnce(initOnce, loadAllowedHourFormatsData, status);
getAllowedHourFormats(locale, status);
- // If any of the above methods failed then the object is in an invalid state.
- internalErrorCode = status;
+ // If any of the above methods failed then the object is in an invalid state.
+ internalErrorCode = status;
} // DateTimePatternGenerator::initData
namespace {
@@ -520,69 +520,69 @@ struct AllowedHourFormatsSink : public ResourceSink {
const char *regionOrLocale = key;
ResourceTable formatList = value.getTable(errorCode);
if (U_FAILURE(errorCode)) { return; }
- // below we construct a list[] that has an entry for the "preferred" value at [0],
- // followed by 1 or more entries for the "allowed" values, terminated with an
- // entry for ALLOWED_HOUR_FORMAT_UNKNOWN (not included in length below)
- LocalMemory<int32_t> list;
- int32_t length = 0;
- int32_t preferredFormat = ALLOWED_HOUR_FORMAT_UNKNOWN;
+ // below we construct a list[] that has an entry for the "preferred" value at [0],
+ // followed by 1 or more entries for the "allowed" values, terminated with an
+ // entry for ALLOWED_HOUR_FORMAT_UNKNOWN (not included in length below)
+ LocalMemory<int32_t> list;
+ int32_t length = 0;
+ int32_t preferredFormat = ALLOWED_HOUR_FORMAT_UNKNOWN;
for (int32_t j = 0; formatList.getKeyAndValue(j, key, value); ++j) {
- if (uprv_strcmp(key, "allowed") == 0) {
+ if (uprv_strcmp(key, "allowed") == 0) {
if (value.getType() == URES_STRING) {
- length = 2; // 1 preferred to add later, 1 allowed to add now
- if (list.allocateInsteadAndReset(length + 1) == nullptr) {
+ length = 2; // 1 preferred to add later, 1 allowed to add now
+ if (list.allocateInsteadAndReset(length + 1) == nullptr) {
errorCode = U_MEMORY_ALLOCATION_ERROR;
return;
}
- list[1] = getHourFormatFromUnicodeString(value.getUnicodeString(errorCode));
+ list[1] = getHourFormatFromUnicodeString(value.getUnicodeString(errorCode));
}
else {
ResourceArray allowedFormats = value.getArray(errorCode);
- length = allowedFormats.getSize() + 1; // 1 preferred, getSize allowed
- if (list.allocateInsteadAndReset(length + 1) == nullptr) {
+ length = allowedFormats.getSize() + 1; // 1 preferred, getSize allowed
+ if (list.allocateInsteadAndReset(length + 1) == nullptr) {
errorCode = U_MEMORY_ALLOCATION_ERROR;
return;
}
- for (int32_t k = 1; k < length; ++k) {
- allowedFormats.getValue(k-1, value);
+ for (int32_t k = 1; k < length; ++k) {
+ allowedFormats.getValue(k-1, value);
list[k] = getHourFormatFromUnicodeString(value.getUnicodeString(errorCode));
}
}
- } else if (uprv_strcmp(key, "preferred") == 0) {
- preferredFormat = getHourFormatFromUnicodeString(value.getUnicodeString(errorCode));
+ } else if (uprv_strcmp(key, "preferred") == 0) {
+ preferredFormat = getHourFormatFromUnicodeString(value.getUnicodeString(errorCode));
}
}
- if (length > 1) {
- list[0] = (preferredFormat!=ALLOWED_HOUR_FORMAT_UNKNOWN)? preferredFormat: list[1];
- } else {
- // fallback handling for missing data
- length = 2; // 1 preferred, 1 allowed
- if (list.allocateInsteadAndReset(length + 1) == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- list[0] = (preferredFormat!=ALLOWED_HOUR_FORMAT_UNKNOWN)? preferredFormat: ALLOWED_HOUR_FORMAT_H;
- list[1] = list[0];
- }
- list[length] = ALLOWED_HOUR_FORMAT_UNKNOWN;
- // At this point list[] will have at least two non-ALLOWED_HOUR_FORMAT_UNKNOWN entries,
- // followed by ALLOWED_HOUR_FORMAT_UNKNOWN.
- uhash_put(localeToAllowedHourFormatsMap, const_cast<char *>(regionOrLocale), list.orphan(), &errorCode);
- if (U_FAILURE(errorCode)) { return; }
- }
- }
-
- AllowedHourFormat getHourFormatFromUnicodeString(const UnicodeString &s) {
+ if (length > 1) {
+ list[0] = (preferredFormat!=ALLOWED_HOUR_FORMAT_UNKNOWN)? preferredFormat: list[1];
+ } else {
+ // fallback handling for missing data
+ length = 2; // 1 preferred, 1 allowed
+ if (list.allocateInsteadAndReset(length + 1) == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ list[0] = (preferredFormat!=ALLOWED_HOUR_FORMAT_UNKNOWN)? preferredFormat: ALLOWED_HOUR_FORMAT_H;
+ list[1] = list[0];
+ }
+ list[length] = ALLOWED_HOUR_FORMAT_UNKNOWN;
+ // At this point list[] will have at least two non-ALLOWED_HOUR_FORMAT_UNKNOWN entries,
+ // followed by ALLOWED_HOUR_FORMAT_UNKNOWN.
+ uhash_put(localeToAllowedHourFormatsMap, const_cast<char *>(regionOrLocale), list.orphan(), &errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ }
+ }
+
+ AllowedHourFormat getHourFormatFromUnicodeString(const UnicodeString &s) {
if (s.length() == 1) {
if (s[0] == LOW_H) { return ALLOWED_HOUR_FORMAT_h; }
if (s[0] == CAP_H) { return ALLOWED_HOUR_FORMAT_H; }
- if (s[0] == CAP_K) { return ALLOWED_HOUR_FORMAT_K; }
- if (s[0] == LOW_K) { return ALLOWED_HOUR_FORMAT_k; }
+ if (s[0] == CAP_K) { return ALLOWED_HOUR_FORMAT_K; }
+ if (s[0] == LOW_K) { return ALLOWED_HOUR_FORMAT_k; }
} else if (s.length() == 2) {
if (s[0] == LOW_H && s[1] == LOW_B) { return ALLOWED_HOUR_FORMAT_hb; }
- if (s[0] == LOW_H && s[1] == CAP_B) { return ALLOWED_HOUR_FORMAT_hB; }
- if (s[0] == CAP_K && s[1] == LOW_B) { return ALLOWED_HOUR_FORMAT_Kb; }
- if (s[0] == CAP_K && s[1] == CAP_B) { return ALLOWED_HOUR_FORMAT_KB; }
+ if (s[0] == LOW_H && s[1] == CAP_B) { return ALLOWED_HOUR_FORMAT_hB; }
+ if (s[0] == CAP_K && s[1] == LOW_B) { return ALLOWED_HOUR_FORMAT_Kb; }
+ if (s[0] == CAP_K && s[1] == CAP_B) { return ALLOWED_HOUR_FORMAT_KB; }
if (s[0] == CAP_H && s[1] == LOW_B) { return ALLOWED_HOUR_FORMAT_Hb; }
if (s[0] == CAP_H && s[1] == CAP_B) { return ALLOWED_HOUR_FORMAT_HB; }
}
@@ -598,15 +598,15 @@ AllowedHourFormatsSink::~AllowedHourFormatsSink() {}
U_CFUNC void U_CALLCONV DateTimePatternGenerator::loadAllowedHourFormatsData(UErrorCode &status) {
if (U_FAILURE(status)) { return; }
localeToAllowedHourFormatsMap = uhash_open(
- uhash_hashChars, uhash_compareChars, nullptr, &status);
- if (U_FAILURE(status)) { return; }
-
+ uhash_hashChars, uhash_compareChars, nullptr, &status);
+ if (U_FAILURE(status)) { return; }
+
uhash_setValueDeleter(localeToAllowedHourFormatsMap, deleteAllowedHourFormats);
- ucln_i18n_registerCleanup(UCLN_I18N_ALLOWED_HOUR_FORMATS, allowedHourFormatsCleanup);
+ ucln_i18n_registerCleanup(UCLN_I18N_ALLOWED_HOUR_FORMATS, allowedHourFormatsCleanup);
+
+ LocalUResourceBundlePointer rb(ures_openDirect(nullptr, "supplementalData", &status));
+ if (U_FAILURE(status)) { return; }
- LocalUResourceBundlePointer rb(ures_openDirect(nullptr, "supplementalData", &status));
- if (U_FAILURE(status)) { return; }
-
AllowedHourFormatsSink sink;
// TODO: Currently in the enumeration each table allocates a new array.
// Try to reduce the number of memory allocations. Consider storing a
@@ -614,136 +614,136 @@ U_CFUNC void U_CALLCONV DateTimePatternGenerator::loadAllowedHourFormatsData(UEr
// into the hashmap, store 6 single-value sub-arrays right at the beginning of the
// vector (at index enum*2) for easy data sharing, copy sub-arrays into runtime
// object. Remember to clean up the vector, too.
- ures_getAllItemsWithFallback(rb.getAlias(), "timeData", sink, status);
-}
-
-static int32_t* getAllowedHourFormatsLangCountry(const char* language, const char* country, UErrorCode& status) {
- CharString langCountry;
- langCountry.append(language, status);
- langCountry.append('_', status);
- langCountry.append(country, status);
-
- int32_t* allowedFormats;
- allowedFormats = (int32_t *)uhash_get(localeToAllowedHourFormatsMap, langCountry.data());
- if (allowedFormats == nullptr) {
- allowedFormats = (int32_t *)uhash_get(localeToAllowedHourFormatsMap, const_cast<char *>(country));
- }
-
- return allowedFormats;
+ ures_getAllItemsWithFallback(rb.getAlias(), "timeData", sink, status);
+}
+
+static int32_t* getAllowedHourFormatsLangCountry(const char* language, const char* country, UErrorCode& status) {
+ CharString langCountry;
+ langCountry.append(language, status);
+ langCountry.append('_', status);
+ langCountry.append(country, status);
+
+ int32_t* allowedFormats;
+ allowedFormats = (int32_t *)uhash_get(localeToAllowedHourFormatsMap, langCountry.data());
+ if (allowedFormats == nullptr) {
+ allowedFormats = (int32_t *)uhash_get(localeToAllowedHourFormatsMap, const_cast<char *>(country));
+ }
+
+ return allowedFormats;
}
void DateTimePatternGenerator::getAllowedHourFormats(const Locale &locale, UErrorCode &status) {
if (U_FAILURE(status)) { return; }
-
- const char *language = locale.getLanguage();
- const char *country = locale.getCountry();
- Locale maxLocale; // must be here for correct lifetime
- if (*language == '\0' || *country == '\0') {
- maxLocale = locale;
- UErrorCode localStatus = U_ZERO_ERROR;
- maxLocale.addLikelySubtags(localStatus);
- if (U_SUCCESS(localStatus)) {
- language = maxLocale.getLanguage();
- country = maxLocale.getCountry();
- }
- }
- if (*language == '\0') {
- // Unexpected, but fail gracefully
- language = "und";
- }
- if (*country == '\0') {
- country = "001";
- }
-
- int32_t* allowedFormats = getAllowedHourFormatsLangCountry(language, country, status);
-
- // We need to check if there is an hour cycle on locale
- char buffer[8];
- int32_t count = locale.getKeywordValue("hours", buffer, sizeof(buffer), status);
-
- fDefaultHourFormatChar = 0;
- if (U_SUCCESS(status) && count > 0) {
- if(uprv_strcmp(buffer, "h24") == 0) {
- fDefaultHourFormatChar = LOW_K;
- } else if(uprv_strcmp(buffer, "h23") == 0) {
- fDefaultHourFormatChar = CAP_H;
- } else if(uprv_strcmp(buffer, "h12") == 0) {
- fDefaultHourFormatChar = LOW_H;
- } else if(uprv_strcmp(buffer, "h11") == 0) {
- fDefaultHourFormatChar = CAP_K;
- }
- }
-
- // Check if the region has an alias
- if (allowedFormats == nullptr) {
- UErrorCode localStatus = U_ZERO_ERROR;
- const Region* region = Region::getInstance(country, localStatus);
- if (U_SUCCESS(localStatus)) {
- country = region->getRegionCode(); // the real region code
- allowedFormats = getAllowedHourFormatsLangCountry(language, country, status);
- }
- }
-
- if (allowedFormats != nullptr) { // Lookup is successful
- // Here allowedFormats points to a list consisting of key for preferredFormat,
- // followed by one or more keys for allowedFormats, then followed by ALLOWED_HOUR_FORMAT_UNKNOWN.
- if (!fDefaultHourFormatChar) {
- switch (allowedFormats[0]) {
- case ALLOWED_HOUR_FORMAT_h: fDefaultHourFormatChar = LOW_H; break;
- case ALLOWED_HOUR_FORMAT_H: fDefaultHourFormatChar = CAP_H; break;
- case ALLOWED_HOUR_FORMAT_K: fDefaultHourFormatChar = CAP_K; break;
- case ALLOWED_HOUR_FORMAT_k: fDefaultHourFormatChar = LOW_K; break;
- default: fDefaultHourFormatChar = CAP_H; break;
- }
- }
-
+
+ const char *language = locale.getLanguage();
+ const char *country = locale.getCountry();
+ Locale maxLocale; // must be here for correct lifetime
+ if (*language == '\0' || *country == '\0') {
+ maxLocale = locale;
+ UErrorCode localStatus = U_ZERO_ERROR;
+ maxLocale.addLikelySubtags(localStatus);
+ if (U_SUCCESS(localStatus)) {
+ language = maxLocale.getLanguage();
+ country = maxLocale.getCountry();
+ }
+ }
+ if (*language == '\0') {
+ // Unexpected, but fail gracefully
+ language = "und";
+ }
+ if (*country == '\0') {
+ country = "001";
+ }
+
+ int32_t* allowedFormats = getAllowedHourFormatsLangCountry(language, country, status);
+
+ // We need to check if there is an hour cycle on locale
+ char buffer[8];
+ int32_t count = locale.getKeywordValue("hours", buffer, sizeof(buffer), status);
+
+ fDefaultHourFormatChar = 0;
+ if (U_SUCCESS(status) && count > 0) {
+ if(uprv_strcmp(buffer, "h24") == 0) {
+ fDefaultHourFormatChar = LOW_K;
+ } else if(uprv_strcmp(buffer, "h23") == 0) {
+ fDefaultHourFormatChar = CAP_H;
+ } else if(uprv_strcmp(buffer, "h12") == 0) {
+ fDefaultHourFormatChar = LOW_H;
+ } else if(uprv_strcmp(buffer, "h11") == 0) {
+ fDefaultHourFormatChar = CAP_K;
+ }
+ }
+
+ // Check if the region has an alias
+ if (allowedFormats == nullptr) {
+ UErrorCode localStatus = U_ZERO_ERROR;
+ const Region* region = Region::getInstance(country, localStatus);
+ if (U_SUCCESS(localStatus)) {
+ country = region->getRegionCode(); // the real region code
+ allowedFormats = getAllowedHourFormatsLangCountry(language, country, status);
+ }
+ }
+
+ if (allowedFormats != nullptr) { // Lookup is successful
+ // Here allowedFormats points to a list consisting of key for preferredFormat,
+ // followed by one or more keys for allowedFormats, then followed by ALLOWED_HOUR_FORMAT_UNKNOWN.
+ if (!fDefaultHourFormatChar) {
+ switch (allowedFormats[0]) {
+ case ALLOWED_HOUR_FORMAT_h: fDefaultHourFormatChar = LOW_H; break;
+ case ALLOWED_HOUR_FORMAT_H: fDefaultHourFormatChar = CAP_H; break;
+ case ALLOWED_HOUR_FORMAT_K: fDefaultHourFormatChar = CAP_K; break;
+ case ALLOWED_HOUR_FORMAT_k: fDefaultHourFormatChar = LOW_K; break;
+ default: fDefaultHourFormatChar = CAP_H; break;
+ }
+ }
+
for (int32_t i = 0; i < UPRV_LENGTHOF(fAllowedHourFormats); ++i) {
- fAllowedHourFormats[i] = allowedFormats[i + 1];
- if (fAllowedHourFormats[i] == ALLOWED_HOUR_FORMAT_UNKNOWN) {
+ fAllowedHourFormats[i] = allowedFormats[i + 1];
+ if (fAllowedHourFormats[i] == ALLOWED_HOUR_FORMAT_UNKNOWN) {
break;
}
}
} else { // Lookup failed, twice
- if (!fDefaultHourFormatChar) {
- fDefaultHourFormatChar = CAP_H;
- }
+ if (!fDefaultHourFormatChar) {
+ fDefaultHourFormatChar = CAP_H;
+ }
fAllowedHourFormats[0] = ALLOWED_HOUR_FORMAT_H;
fAllowedHourFormats[1] = ALLOWED_HOUR_FORMAT_UNKNOWN;
}
}
-UDateFormatHourCycle
-DateTimePatternGenerator::getDefaultHourCycle(UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return UDAT_HOUR_CYCLE_23;
- }
- if (fDefaultHourFormatChar == 0) {
- // We need to return something, but the caller should ignore it
- // anyways since the returned status is a failure.
- status = U_UNSUPPORTED_ERROR;
- return UDAT_HOUR_CYCLE_23;
- }
- switch (fDefaultHourFormatChar) {
- case CAP_K:
- return UDAT_HOUR_CYCLE_11;
- case LOW_H:
- return UDAT_HOUR_CYCLE_12;
- case CAP_H:
- return UDAT_HOUR_CYCLE_23;
- case LOW_K:
- return UDAT_HOUR_CYCLE_24;
- default:
- UPRV_UNREACHABLE;
- }
-}
-
+UDateFormatHourCycle
+DateTimePatternGenerator::getDefaultHourCycle(UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return UDAT_HOUR_CYCLE_23;
+ }
+ if (fDefaultHourFormatChar == 0) {
+ // We need to return something, but the caller should ignore it
+ // anyways since the returned status is a failure.
+ status = U_UNSUPPORTED_ERROR;
+ return UDAT_HOUR_CYCLE_23;
+ }
+ switch (fDefaultHourFormatChar) {
+ case CAP_K:
+ return UDAT_HOUR_CYCLE_11;
+ case LOW_H:
+ return UDAT_HOUR_CYCLE_12;
+ case CAP_H:
+ return UDAT_HOUR_CYCLE_23;
+ case LOW_K:
+ return UDAT_HOUR_CYCLE_24;
+ default:
+ UPRV_UNREACHABLE;
+ }
+}
+
UnicodeString
DateTimePatternGenerator::getSkeleton(const UnicodeString& pattern, UErrorCode&
/*status*/) {
- FormatParser fp2;
+ FormatParser fp2;
DateTimeMatcher matcher;
PtnSkeleton localSkeleton;
- matcher.set(pattern, &fp2, localSkeleton);
+ matcher.set(pattern, &fp2, localSkeleton);
return localSkeleton.getSkeleton();
}
@@ -759,10 +759,10 @@ DateTimePatternGenerator::staticGetSkeleton(
UnicodeString
DateTimePatternGenerator::getBaseSkeleton(const UnicodeString& pattern, UErrorCode& /*status*/) {
- FormatParser fp2;
+ FormatParser fp2;
DateTimeMatcher matcher;
PtnSkeleton localSkeleton;
- matcher.set(pattern, &fp2, localSkeleton);
+ matcher.set(pattern, &fp2, localSkeleton);
return localSkeleton.getBaseSkeleton();
}
@@ -788,7 +788,7 @@ DateTimePatternGenerator::addICUPatterns(const Locale& locale, UErrorCode& statu
DateFormat::EStyle style = (DateFormat::EStyle)i;
df = DateFormat::createDateInstance(style, locale);
SimpleDateFormat* sdf;
- if (df != nullptr && (sdf = dynamic_cast<SimpleDateFormat*>(df)) != nullptr) {
+ if (df != nullptr && (sdf = dynamic_cast<SimpleDateFormat*>(df)) != nullptr) {
sdf->toPattern(dfPattern);
addPattern(dfPattern, FALSE, conflictingString, status);
}
@@ -797,7 +797,7 @@ DateTimePatternGenerator::addICUPatterns(const Locale& locale, UErrorCode& statu
if (U_FAILURE(status)) { return; }
df = DateFormat::createTimeInstance(style, locale);
- if (df != nullptr && (sdf = dynamic_cast<SimpleDateFormat*>(df)) != nullptr) {
+ if (df != nullptr && (sdf = dynamic_cast<SimpleDateFormat*>(df)) != nullptr) {
sdf->toPattern(dfPattern);
addPattern(dfPattern, FALSE, conflictingString, status);
@@ -865,19 +865,19 @@ void
DateTimePatternGenerator::getCalendarTypeToUse(const Locale& locale, CharString& destination, UErrorCode& err) {
destination.clear().append(DT_DateTimeGregorianTag, -1, err); // initial default
if ( U_SUCCESS(err) ) {
- UErrorCode localStatus = U_ZERO_ERROR;
+ UErrorCode localStatus = U_ZERO_ERROR;
char localeWithCalendarKey[ULOC_LOCALE_IDENTIFIER_CAPACITY];
// obtain a locale that always has the calendar key value that should be used
ures_getFunctionalEquivalent(
localeWithCalendarKey,
ULOC_LOCALE_IDENTIFIER_CAPACITY,
- nullptr,
+ nullptr,
"calendar",
"calendar",
locale.getName(),
- nullptr,
+ nullptr,
FALSE,
- &localStatus);
+ &localStatus);
localeWithCalendarKey[ULOC_LOCALE_IDENTIFIER_CAPACITY-1] = 0; // ensure null termination
// now get the calendar key value from that locale
char calendarType[ULOC_KEYWORDS_CAPACITY];
@@ -886,14 +886,14 @@ DateTimePatternGenerator::getCalendarTypeToUse(const Locale& locale, CharString&
"calendar",
calendarType,
ULOC_KEYWORDS_CAPACITY,
- &localStatus);
- // If the input locale was invalid, don't fail with missing resource error, instead
- // continue with default of Gregorian.
- if (U_FAILURE(localStatus) && localStatus != U_MISSING_RESOURCE_ERROR) {
- err = localStatus;
- return;
- }
- if (calendarTypeLen < ULOC_KEYWORDS_CAPACITY) {
+ &localStatus);
+ // If the input locale was invalid, don't fail with missing resource error, instead
+ // continue with default of Gregorian.
+ if (U_FAILURE(localStatus) && localStatus != U_MISSING_RESOURCE_ERROR) {
+ err = localStatus;
+ return;
+ }
+ if (calendarTypeLen < ULOC_KEYWORDS_CAPACITY) {
destination.clear().append(calendarType, -1, err);
if (U_FAILURE(err)) { return; }
}
@@ -903,10 +903,10 @@ DateTimePatternGenerator::getCalendarTypeToUse(const Locale& locale, CharString&
void
DateTimePatternGenerator::consumeShortTimePattern(const UnicodeString& shortTimePattern,
UErrorCode& status) {
- if (U_FAILURE(status)) { return; }
- // ICU-20383 No longer set fDefaultHourFormatChar to the hour format character from
- // this pattern; instead it is set from localeToAllowedHourFormatsMap which now
- // includes entries for both preferred and allowed formats.
+ if (U_FAILURE(status)) { return; }
+ // ICU-20383 No longer set fDefaultHourFormatChar to the hour format character from
+ // this pattern; instead it is set from localeToAllowedHourFormatsMap which now
+ // includes entries for both preferred and allowed formats.
// HACK for hh:ss
hackTimes(shortTimePattern, status);
@@ -958,16 +958,16 @@ struct DateTimePatternGenerator::AppendItemNamesSink : public ResourceSink {
ResourceTable itemsTable = value.getTable(errorCode);
if (U_FAILURE(errorCode)) { return; }
for (int32_t i = 0; itemsTable.getKeyAndValue(i, key, value); ++i) {
- UDateTimePGDisplayWidth width;
- UDateTimePatternField field = dtpg.getFieldAndWidthIndices(key, &width);
+ UDateTimePGDisplayWidth width;
+ UDateTimePatternField field = dtpg.getFieldAndWidthIndices(key, &width);
if (field == UDATPG_FIELD_COUNT) { continue; }
ResourceTable detailsTable = value.getTable(errorCode);
if (U_FAILURE(errorCode)) { return; }
for (int32_t j = 0; detailsTable.getKeyAndValue(j, key, value); ++j) {
if (uprv_strcmp(key, "dn") != 0) { continue; }
const UnicodeString& valueStr = value.getUnicodeString(errorCode);
- if (dtpg.getFieldDisplayName(field,width).isEmpty() && !valueStr.isEmpty()) {
- dtpg.setFieldDisplayName(field,width,valueStr);
+ if (dtpg.getFieldDisplayName(field,width).isEmpty() && !valueStr.isEmpty()) {
+ dtpg.setFieldDisplayName(field,width,valueStr);
}
break;
}
@@ -976,7 +976,7 @@ struct DateTimePatternGenerator::AppendItemNamesSink : public ResourceSink {
void fillInMissing() {
for (int32_t i = 0; i < UDATPG_FIELD_COUNT; i++) {
- UnicodeString& valueStr = dtpg.getMutableFieldDisplayName((UDateTimePatternField)i, UDATPG_WIDE);
+ UnicodeString& valueStr = dtpg.getMutableFieldDisplayName((UDateTimePatternField)i, UDATPG_WIDE);
if (valueStr.isEmpty()) {
valueStr = CAP_F;
U_ASSERT(i < 20);
@@ -991,12 +991,12 @@ struct DateTimePatternGenerator::AppendItemNamesSink : public ResourceSink {
// NUL-terminate for the C API.
valueStr.getTerminatedBuffer();
}
- for (int32_t j = 1; j < UDATPG_WIDTH_COUNT; j++) {
- UnicodeString& valueStr2 = dtpg.getMutableFieldDisplayName((UDateTimePatternField)i, (UDateTimePGDisplayWidth)j);
- if (valueStr2.isEmpty()) {
- valueStr2 = dtpg.getFieldDisplayName((UDateTimePatternField)i, (UDateTimePGDisplayWidth)(j-1));
- }
- }
+ for (int32_t j = 1; j < UDATPG_WIDTH_COUNT; j++) {
+ UnicodeString& valueStr2 = dtpg.getMutableFieldDisplayName((UDateTimePatternField)i, (UDateTimePGDisplayWidth)j);
+ if (valueStr2.isEmpty()) {
+ valueStr2 = dtpg.getFieldDisplayName((UDateTimePatternField)i, (UDateTimePGDisplayWidth)(j-1));
+ }
+ }
}
}
};
@@ -1041,7 +1041,7 @@ DateTimePatternGenerator::addCLDRData(const Locale& locale, UErrorCode& errorCod
UnicodeString rbPattern, value, field;
CharString path;
- LocalUResourceBundlePointer rb(ures_open(nullptr, locale.getName(), &errorCode));
+ LocalUResourceBundlePointer rb(ures_open(nullptr, locale.getName(), &errorCode));
if (U_FAILURE(errorCode)) { return; }
CharString calendarTypeToUse; // to be filled in with the type to use, if all goes well
@@ -1086,13 +1086,13 @@ DateTimePatternGenerator::addCLDRData(const Locale& locale, UErrorCode& errorCod
void
DateTimePatternGenerator::initHashtable(UErrorCode& err) {
- if (U_FAILURE(err)) { return; }
- if (fAvailableFormatKeyHash!=nullptr) {
+ if (U_FAILURE(err)) { return; }
+ if (fAvailableFormatKeyHash!=nullptr) {
return;
}
- LocalPointer<Hashtable> hash(new Hashtable(FALSE, err), err);
- if (U_SUCCESS(err)) {
- fAvailableFormatKeyHash = hash.orphan();
+ LocalPointer<Hashtable> hash(new Hashtable(FALSE, err), err);
+ if (U_SUCCESS(err)) {
+ fAvailableFormatKeyHash = hash.orphan();
}
}
@@ -1110,35 +1110,35 @@ DateTimePatternGenerator::getAppendItemFormat(UDateTimePatternField field) const
void
DateTimePatternGenerator::setAppendItemName(UDateTimePatternField field, const UnicodeString& value) {
- setFieldDisplayName(field, UDATPG_WIDTH_APPENDITEM, value);
+ setFieldDisplayName(field, UDATPG_WIDTH_APPENDITEM, value);
}
const UnicodeString&
DateTimePatternGenerator::getAppendItemName(UDateTimePatternField field) const {
- return fieldDisplayNames[field][UDATPG_WIDTH_APPENDITEM];
-}
-
-void
-DateTimePatternGenerator::setFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width, const UnicodeString& value) {
- fieldDisplayNames[field][width] = value;
- // NUL-terminate for the C API.
- fieldDisplayNames[field][width].getTerminatedBuffer();
-}
-
-UnicodeString
-DateTimePatternGenerator::getFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width) const {
- return fieldDisplayNames[field][width];
-}
-
+ return fieldDisplayNames[field][UDATPG_WIDTH_APPENDITEM];
+}
+
+void
+DateTimePatternGenerator::setFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width, const UnicodeString& value) {
+ fieldDisplayNames[field][width] = value;
+ // NUL-terminate for the C API.
+ fieldDisplayNames[field][width].getTerminatedBuffer();
+}
+
+UnicodeString
+DateTimePatternGenerator::getFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width) const {
+ return fieldDisplayNames[field][width];
+}
+
UnicodeString&
-DateTimePatternGenerator::getMutableFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width) {
- return fieldDisplayNames[field][width];
+DateTimePatternGenerator::getMutableFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width) {
+ return fieldDisplayNames[field][width];
}
void
DateTimePatternGenerator::getAppendName(UDateTimePatternField field, UnicodeString& value) {
value = SINGLE_QUOTE;
- value += fieldDisplayNames[field][UDATPG_WIDTH_APPENDITEM];
+ value += fieldDisplayNames[field][UDATPG_WIDTH_APPENDITEM];
value += SINGLE_QUOTE;
}
@@ -1149,14 +1149,14 @@ DateTimePatternGenerator::getBestPattern(const UnicodeString& patternForm, UErro
UnicodeString
DateTimePatternGenerator::getBestPattern(const UnicodeString& patternForm, UDateTimePatternMatchOptions options, UErrorCode& status) {
- if (U_FAILURE(status)) {
- return UnicodeString();
- }
- if (U_FAILURE(internalErrorCode)) {
- status = internalErrorCode;
- return UnicodeString();
- }
- const UnicodeString *bestPattern = nullptr;
+ if (U_FAILURE(status)) {
+ return UnicodeString();
+ }
+ if (U_FAILURE(internalErrorCode)) {
+ status = internalErrorCode;
+ return UnicodeString();
+ }
+ const UnicodeString *bestPattern = nullptr;
UnicodeString dtFormat;
UnicodeString resultPattern;
int32_t flags = kDTPGNoFlags;
@@ -1165,17 +1165,17 @@ DateTimePatternGenerator::getBestPattern(const UnicodeString& patternForm, UDate
int32_t timeMask=(1<<UDATPG_FIELD_COUNT) - 1 - dateMask;
// Replace hour metacharacters 'j', 'C' and 'J', set flags as necessary
- UnicodeString patternFormMapped = mapSkeletonMetacharacters(patternForm, &flags, status);
- if (U_FAILURE(status)) {
- return UnicodeString();
- }
+ UnicodeString patternFormMapped = mapSkeletonMetacharacters(patternForm, &flags, status);
+ if (U_FAILURE(status)) {
+ return UnicodeString();
+ }
- resultPattern.remove();
- dtMatcher->set(patternFormMapped, fp);
- const PtnSkeleton* specifiedSkeleton = nullptr;
- bestPattern=getBestRaw(*dtMatcher, -1, distanceInfo, status, &specifiedSkeleton);
- if (U_FAILURE(status)) {
- return UnicodeString();
+ resultPattern.remove();
+ dtMatcher->set(patternFormMapped, fp);
+ const PtnSkeleton* specifiedSkeleton = nullptr;
+ bestPattern=getBestRaw(*dtMatcher, -1, distanceInfo, status, &specifiedSkeleton);
+ if (U_FAILURE(status)) {
+ return UnicodeString();
}
if ( distanceInfo->missingFieldMask==0 && distanceInfo->extraFieldMask==0 ) {
@@ -1184,11 +1184,11 @@ DateTimePatternGenerator::getBestPattern(const UnicodeString& patternForm, UDate
return resultPattern;
}
int32_t neededFields = dtMatcher->getFieldMask();
- UnicodeString datePattern=getBestAppending(neededFields & dateMask, flags, status, options);
- UnicodeString timePattern=getBestAppending(neededFields & timeMask, flags, status, options);
- if (U_FAILURE(status)) {
- return UnicodeString();
- }
+ UnicodeString datePattern=getBestAppending(neededFields & dateMask, flags, status, options);
+ UnicodeString timePattern=getBestAppending(neededFields & timeMask, flags, status, options);
+ if (U_FAILURE(status)) {
+ return UnicodeString();
+ }
if (datePattern.length()==0) {
if (timePattern.length()==0) {
resultPattern.remove();
@@ -1207,87 +1207,87 @@ DateTimePatternGenerator::getBestPattern(const UnicodeString& patternForm, UDate
return resultPattern;
}
-/*
- * Map a skeleton that may have metacharacters jJC to one without, by replacing
- * the metacharacters with locale-appropriate fields of h/H/k/K and of a/b/B
- * (depends on fDefaultHourFormatChar and fAllowedHourFormats being set, which in
- * turn depends on initData having been run). This method also updates the flags
- * as necessary. Returns the updated skeleton.
- */
+/*
+ * Map a skeleton that may have metacharacters jJC to one without, by replacing
+ * the metacharacters with locale-appropriate fields of h/H/k/K and of a/b/B
+ * (depends on fDefaultHourFormatChar and fAllowedHourFormats being set, which in
+ * turn depends on initData having been run). This method also updates the flags
+ * as necessary. Returns the updated skeleton.
+ */
+UnicodeString
+DateTimePatternGenerator::mapSkeletonMetacharacters(const UnicodeString& patternForm, int32_t* flags, UErrorCode& status) {
+ UnicodeString patternFormMapped;
+ patternFormMapped.remove();
+ UBool inQuoted = FALSE;
+ int32_t patPos, patLen = patternForm.length();
+ for (patPos = 0; patPos < patLen; patPos++) {
+ UChar patChr = patternForm.charAt(patPos);
+ if (patChr == SINGLE_QUOTE) {
+ inQuoted = !inQuoted;
+ } else if (!inQuoted) {
+ // Handle special mappings for 'j' and 'C' in which fields lengths
+ // 1,3,5 => hour field length 1
+ // 2,4,6 => hour field length 2
+ // 1,2 => abbreviated dayPeriod (field length 1..3)
+ // 3,4 => long dayPeriod (field length 4)
+ // 5,6 => narrow dayPeriod (field length 5)
+ if (patChr == LOW_J || patChr == CAP_C) {
+ int32_t extraLen = 0; // 1 less than total field length
+ while (patPos+1 < patLen && patternForm.charAt(patPos+1)==patChr) {
+ extraLen++;
+ patPos++;
+ }
+ int32_t hourLen = 1 + (extraLen & 1);
+ int32_t dayPeriodLen = (extraLen < 2)? 1: 3 + (extraLen >> 1);
+ UChar hourChar = LOW_H;
+ UChar dayPeriodChar = LOW_A;
+ if (patChr == LOW_J) {
+ hourChar = fDefaultHourFormatChar;
+ } else {
+ AllowedHourFormat bestAllowed;
+ if (fAllowedHourFormats[0] != ALLOWED_HOUR_FORMAT_UNKNOWN) {
+ bestAllowed = (AllowedHourFormat)fAllowedHourFormats[0];
+ } else {
+ status = U_INVALID_FORMAT_ERROR;
+ return UnicodeString();
+ }
+ if (bestAllowed == ALLOWED_HOUR_FORMAT_H || bestAllowed == ALLOWED_HOUR_FORMAT_HB || bestAllowed == ALLOWED_HOUR_FORMAT_Hb) {
+ hourChar = CAP_H;
+ } else if (bestAllowed == ALLOWED_HOUR_FORMAT_K || bestAllowed == ALLOWED_HOUR_FORMAT_KB || bestAllowed == ALLOWED_HOUR_FORMAT_Kb) {
+ hourChar = CAP_K;
+ } else if (bestAllowed == ALLOWED_HOUR_FORMAT_k) {
+ hourChar = LOW_K;
+ }
+ // in #13183 just add b/B to skeleton, no longer need to set special flags
+ if (bestAllowed == ALLOWED_HOUR_FORMAT_HB || bestAllowed == ALLOWED_HOUR_FORMAT_hB || bestAllowed == ALLOWED_HOUR_FORMAT_KB) {
+ dayPeriodChar = CAP_B;
+ } else if (bestAllowed == ALLOWED_HOUR_FORMAT_Hb || bestAllowed == ALLOWED_HOUR_FORMAT_hb || bestAllowed == ALLOWED_HOUR_FORMAT_Kb) {
+ dayPeriodChar = LOW_B;
+ }
+ }
+ if (hourChar==CAP_H || hourChar==LOW_K) {
+ dayPeriodLen = 0;
+ }
+ while (dayPeriodLen-- > 0) {
+ patternFormMapped.append(dayPeriodChar);
+ }
+ while (hourLen-- > 0) {
+ patternFormMapped.append(hourChar);
+ }
+ } else if (patChr == CAP_J) {
+ // Get pattern for skeleton with H, then replace H or k
+ // with fDefaultHourFormatChar (if different)
+ patternFormMapped.append(CAP_H);
+ *flags |= kDTPGSkeletonUsesCapJ;
+ } else {
+ patternFormMapped.append(patChr);
+ }
+ }
+ }
+ return patternFormMapped;
+}
+
UnicodeString
-DateTimePatternGenerator::mapSkeletonMetacharacters(const UnicodeString& patternForm, int32_t* flags, UErrorCode& status) {
- UnicodeString patternFormMapped;
- patternFormMapped.remove();
- UBool inQuoted = FALSE;
- int32_t patPos, patLen = patternForm.length();
- for (patPos = 0; patPos < patLen; patPos++) {
- UChar patChr = patternForm.charAt(patPos);
- if (patChr == SINGLE_QUOTE) {
- inQuoted = !inQuoted;
- } else if (!inQuoted) {
- // Handle special mappings for 'j' and 'C' in which fields lengths
- // 1,3,5 => hour field length 1
- // 2,4,6 => hour field length 2
- // 1,2 => abbreviated dayPeriod (field length 1..3)
- // 3,4 => long dayPeriod (field length 4)
- // 5,6 => narrow dayPeriod (field length 5)
- if (patChr == LOW_J || patChr == CAP_C) {
- int32_t extraLen = 0; // 1 less than total field length
- while (patPos+1 < patLen && patternForm.charAt(patPos+1)==patChr) {
- extraLen++;
- patPos++;
- }
- int32_t hourLen = 1 + (extraLen & 1);
- int32_t dayPeriodLen = (extraLen < 2)? 1: 3 + (extraLen >> 1);
- UChar hourChar = LOW_H;
- UChar dayPeriodChar = LOW_A;
- if (patChr == LOW_J) {
- hourChar = fDefaultHourFormatChar;
- } else {
- AllowedHourFormat bestAllowed;
- if (fAllowedHourFormats[0] != ALLOWED_HOUR_FORMAT_UNKNOWN) {
- bestAllowed = (AllowedHourFormat)fAllowedHourFormats[0];
- } else {
- status = U_INVALID_FORMAT_ERROR;
- return UnicodeString();
- }
- if (bestAllowed == ALLOWED_HOUR_FORMAT_H || bestAllowed == ALLOWED_HOUR_FORMAT_HB || bestAllowed == ALLOWED_HOUR_FORMAT_Hb) {
- hourChar = CAP_H;
- } else if (bestAllowed == ALLOWED_HOUR_FORMAT_K || bestAllowed == ALLOWED_HOUR_FORMAT_KB || bestAllowed == ALLOWED_HOUR_FORMAT_Kb) {
- hourChar = CAP_K;
- } else if (bestAllowed == ALLOWED_HOUR_FORMAT_k) {
- hourChar = LOW_K;
- }
- // in #13183 just add b/B to skeleton, no longer need to set special flags
- if (bestAllowed == ALLOWED_HOUR_FORMAT_HB || bestAllowed == ALLOWED_HOUR_FORMAT_hB || bestAllowed == ALLOWED_HOUR_FORMAT_KB) {
- dayPeriodChar = CAP_B;
- } else if (bestAllowed == ALLOWED_HOUR_FORMAT_Hb || bestAllowed == ALLOWED_HOUR_FORMAT_hb || bestAllowed == ALLOWED_HOUR_FORMAT_Kb) {
- dayPeriodChar = LOW_B;
- }
- }
- if (hourChar==CAP_H || hourChar==LOW_K) {
- dayPeriodLen = 0;
- }
- while (dayPeriodLen-- > 0) {
- patternFormMapped.append(dayPeriodChar);
- }
- while (hourLen-- > 0) {
- patternFormMapped.append(hourChar);
- }
- } else if (patChr == CAP_J) {
- // Get pattern for skeleton with H, then replace H or k
- // with fDefaultHourFormatChar (if different)
- patternFormMapped.append(CAP_H);
- *flags |= kDTPGSkeletonUsesCapJ;
- } else {
- patternFormMapped.append(patChr);
- }
- }
- }
- return patternFormMapped;
-}
-
-UnicodeString
DateTimePatternGenerator::replaceFieldTypes(const UnicodeString& pattern,
const UnicodeString& skeleton,
UErrorCode& status) {
@@ -1298,16 +1298,16 @@ UnicodeString
DateTimePatternGenerator::replaceFieldTypes(const UnicodeString& pattern,
const UnicodeString& skeleton,
UDateTimePatternMatchOptions options,
- UErrorCode& status) {
- if (U_FAILURE(status)) {
- return UnicodeString();
- }
- if (U_FAILURE(internalErrorCode)) {
- status = internalErrorCode;
- return UnicodeString();
- }
+ UErrorCode& status) {
+ if (U_FAILURE(status)) {
+ return UnicodeString();
+ }
+ if (U_FAILURE(internalErrorCode)) {
+ status = internalErrorCode;
+ return UnicodeString();
+ }
dtMatcher->set(skeleton, fp);
- UnicodeString result = adjustFieldTypes(pattern, nullptr, kDTPGNoFlags, options);
+ UnicodeString result = adjustFieldTypes(pattern, nullptr, kDTPGNoFlags, options);
return result;
}
@@ -1350,24 +1350,24 @@ DateTimePatternGenerator::getDateTimeFormat() const {
void
DateTimePatternGenerator::setDateTimeFromCalendar(const Locale& locale, UErrorCode& status) {
- if (U_FAILURE(status)) { return; }
-
+ if (U_FAILURE(status)) { return; }
+
const UChar *resStr;
int32_t resStrLen = 0;
- LocalPointer<Calendar> fCalendar(Calendar::createInstance(locale, status), status);
+ LocalPointer<Calendar> fCalendar(Calendar::createInstance(locale, status), status);
if (U_FAILURE(status)) { return; }
- LocalUResourceBundlePointer calData(ures_open(nullptr, locale.getBaseName(), &status));
- if (U_FAILURE(status)) { return; }
+ LocalUResourceBundlePointer calData(ures_open(nullptr, locale.getBaseName(), &status));
+ if (U_FAILURE(status)) { return; }
ures_getByKey(calData.getAlias(), DT_DateTimeCalendarTag, calData.getAlias(), &status);
- if (U_FAILURE(status)) { return; }
+ if (U_FAILURE(status)) { return; }
LocalUResourceBundlePointer dateTimePatterns;
- if (fCalendar->getType() != nullptr && *fCalendar->getType() != '\0'
+ if (fCalendar->getType() != nullptr && *fCalendar->getType() != '\0'
&& uprv_strcmp(fCalendar->getType(), DT_DateTimeGregorianTag) != 0) {
dateTimePatterns.adoptInstead(ures_getByKeyWithFallback(calData.getAlias(), fCalendar->getType(),
- nullptr, &status));
+ nullptr, &status));
ures_getByKeyWithFallback(dateTimePatterns.getAlias(), DT_DateTimePatternsTag,
dateTimePatterns.getAlias(), &status);
}
@@ -1407,12 +1407,12 @@ DateTimePatternGenerator::addPattern(
UnicodeString &conflictingPattern,
UErrorCode& status)
{
- if (U_FAILURE(internalErrorCode)) {
- status = internalErrorCode;
- return UDATPG_NO_CONFLICT;
- }
-
- return addPatternWithSkeleton(pattern, nullptr, override, conflictingPattern, status);
+ if (U_FAILURE(internalErrorCode)) {
+ status = internalErrorCode;
+ return UDATPG_NO_CONFLICT;
+ }
+
+ return addPatternWithSkeleton(pattern, nullptr, override, conflictingPattern, status);
}
// For DateTimePatternGenerator::addPatternWithSkeleton -
@@ -1433,17 +1433,17 @@ DateTimePatternGenerator::addPatternWithSkeleton(
UnicodeString& conflictingPattern,
UErrorCode& status)
{
- if (U_FAILURE(internalErrorCode)) {
- status = internalErrorCode;
- return UDATPG_NO_CONFLICT;
- }
+ if (U_FAILURE(internalErrorCode)) {
+ status = internalErrorCode;
+ return UDATPG_NO_CONFLICT;
+ }
UnicodeString basePattern;
PtnSkeleton skeleton;
UDateTimePatternConflict conflictingStatus = UDATPG_NO_CONFLICT;
DateTimeMatcher matcher;
- if ( skeletonToUse == nullptr ) {
+ if ( skeletonToUse == nullptr ) {
matcher.set(pattern, fp, skeleton);
matcher.getBasePattern(basePattern);
} else {
@@ -1459,7 +1459,7 @@ DateTimePatternGenerator::addPatternWithSkeleton(
// availableFormats items from root, which should not override any previous entry with the same base.
UBool entryHadSpecifiedSkeleton;
const UnicodeString *duplicatePattern = patternMap->getPatternFromBasePattern(basePattern, entryHadSpecifiedSkeleton);
- if (duplicatePattern != nullptr && (!entryHadSpecifiedSkeleton || (skeletonToUse != nullptr && !override))) {
+ if (duplicatePattern != nullptr && (!entryHadSpecifiedSkeleton || (skeletonToUse != nullptr && !override))) {
conflictingStatus = UDATPG_BASE_CONFLICT;
conflictingPattern = *duplicatePattern;
if (!override) {
@@ -1470,16 +1470,16 @@ DateTimePatternGenerator::addPatternWithSkeleton(
// items from CLDR data. In that case, we don't want an item from a parent locale to replace an item with
// same skeleton from the specified locale, so skip the current item if skeletonWasSpecified is true for
// the previously-specified conflicting item.
- const PtnSkeleton* entrySpecifiedSkeleton = nullptr;
+ const PtnSkeleton* entrySpecifiedSkeleton = nullptr;
duplicatePattern = patternMap->getPatternFromSkeleton(skeleton, &entrySpecifiedSkeleton);
- if (duplicatePattern != nullptr ) {
+ if (duplicatePattern != nullptr ) {
conflictingStatus = UDATPG_CONFLICT;
conflictingPattern = *duplicatePattern;
- if (!override || (skeletonToUse != nullptr && entrySpecifiedSkeleton != nullptr)) {
+ if (!override || (skeletonToUse != nullptr && entrySpecifiedSkeleton != nullptr)) {
return conflictingStatus;
}
}
- patternMap->add(basePattern, skeleton, pattern, skeletonToUse != nullptr, status);
+ patternMap->add(basePattern, skeleton, pattern, skeletonToUse != nullptr, status);
if(U_FAILURE(status)) {
return conflictingStatus;
}
@@ -1499,23 +1499,23 @@ DateTimePatternGenerator::getAppendFormatNumber(const char* field) const {
}
UDateTimePatternField
-DateTimePatternGenerator::getFieldAndWidthIndices(const char* key, UDateTimePGDisplayWidth* widthP) const {
- char cldrFieldKey[UDATPG_FIELD_KEY_MAX + 1];
- uprv_strncpy(cldrFieldKey, key, UDATPG_FIELD_KEY_MAX);
- cldrFieldKey[UDATPG_FIELD_KEY_MAX]=0; // ensure termination
- *widthP = UDATPG_WIDE;
- char* hyphenPtr = uprv_strchr(cldrFieldKey, '-');
- if (hyphenPtr) {
- for (int32_t i=UDATPG_WIDTH_COUNT-1; i>0; --i) {
- if (uprv_strcmp(CLDR_FIELD_WIDTH[i], hyphenPtr)==0) {
- *widthP=(UDateTimePGDisplayWidth)i;
- break;
- }
- }
- *hyphenPtr = 0; // now delete width portion of key
- }
+DateTimePatternGenerator::getFieldAndWidthIndices(const char* key, UDateTimePGDisplayWidth* widthP) const {
+ char cldrFieldKey[UDATPG_FIELD_KEY_MAX + 1];
+ uprv_strncpy(cldrFieldKey, key, UDATPG_FIELD_KEY_MAX);
+ cldrFieldKey[UDATPG_FIELD_KEY_MAX]=0; // ensure termination
+ *widthP = UDATPG_WIDE;
+ char* hyphenPtr = uprv_strchr(cldrFieldKey, '-');
+ if (hyphenPtr) {
+ for (int32_t i=UDATPG_WIDTH_COUNT-1; i>0; --i) {
+ if (uprv_strcmp(CLDR_FIELD_WIDTH[i], hyphenPtr)==0) {
+ *widthP=(UDateTimePGDisplayWidth)i;
+ break;
+ }
+ }
+ *hyphenPtr = 0; // now delete width portion of key
+ }
for (int32_t i=0; i<UDATPG_FIELD_COUNT; ++i ) {
- if (uprv_strcmp(CLDR_FIELD_NAME[i],cldrFieldKey)==0) {
+ if (uprv_strcmp(CLDR_FIELD_NAME[i],cldrFieldKey)==0) {
return (UDateTimePatternField)i;
}
}
@@ -1526,32 +1526,32 @@ const UnicodeString*
DateTimePatternGenerator::getBestRaw(DateTimeMatcher& source,
int32_t includeMask,
DistanceInfo* missingFields,
- UErrorCode &status,
+ UErrorCode &status,
const PtnSkeleton** specifiedSkeletonPtr) {
int32_t bestDistance = 0x7fffffff;
- int32_t bestMissingFieldMask = -1;
+ int32_t bestMissingFieldMask = -1;
DistanceInfo tempInfo;
- const UnicodeString *bestPattern=nullptr;
- const PtnSkeleton* specifiedSkeleton=nullptr;
+ const UnicodeString *bestPattern=nullptr;
+ const PtnSkeleton* specifiedSkeleton=nullptr;
+
+ PatternMapIterator it(status);
+ if (U_FAILURE(status)) { return nullptr; }
- PatternMapIterator it(status);
- if (U_FAILURE(status)) { return nullptr; }
-
for (it.set(*patternMap); it.hasNext(); ) {
DateTimeMatcher trial = it.next();
if (trial.equals(skipMatcher)) {
continue;
}
int32_t distance=source.getDistance(trial, includeMask, tempInfo);
- // Because we iterate over a map the order is undefined. Can change between implementations,
- // versions, and will very likely be different between Java and C/C++.
- // So if we have patterns with the same distance we also look at the missingFieldMask,
- // and we favour the smallest one. Because the field is a bitmask this technically means we
- // favour differences in the "least significant fields". For example we prefer the one with differences
- // in seconds field vs one with difference in the hours field.
- if (distance<bestDistance || (distance==bestDistance && bestMissingFieldMask<tempInfo.missingFieldMask)) {
+ // Because we iterate over a map the order is undefined. Can change between implementations,
+ // versions, and will very likely be different between Java and C/C++.
+ // So if we have patterns with the same distance we also look at the missingFieldMask,
+ // and we favour the smallest one. Because the field is a bitmask this technically means we
+ // favour differences in the "least significant fields". For example we prefer the one with differences
+ // in seconds field vs one with difference in the hours field.
+ if (distance<bestDistance || (distance==bestDistance && bestMissingFieldMask<tempInfo.missingFieldMask)) {
bestDistance=distance;
- bestMissingFieldMask=tempInfo.missingFieldMask;
+ bestMissingFieldMask=tempInfo.missingFieldMask;
bestPattern=patternMap->getPatternFromSkeleton(*trial.getSkeletonPtr(), &specifiedSkeleton);
missingFields->setTo(tempInfo);
if (distance==0) {
@@ -1597,23 +1597,23 @@ DateTimePatternGenerator::adjustFieldTypes(const UnicodeString& pattern,
const dtTypeElem *row = &dtTypes[canonicalIndex];
int32_t typeValue = row->field;
- // handle day periods - with #13183, no longer need special handling here, integrated with normal types
+ // handle day periods - with #13183, no longer need special handling here, integrated with normal types
if ((flags & kDTPGFixFractionalSeconds) != 0 && typeValue == UDATPG_SECOND_FIELD) {
field += decimal;
dtMatcher->skeleton.original.appendFieldTo(UDATPG_FRACTIONAL_SECOND_FIELD, field);
} else if (dtMatcher->skeleton.type[typeValue]!=0) {
// Here:
- // - "reqField" is the field from the originally requested skeleton after replacement
- // of metacharacters 'j', 'C' and 'J', with length "reqFieldLen".
+ // - "reqField" is the field from the originally requested skeleton after replacement
+ // of metacharacters 'j', 'C' and 'J', with length "reqFieldLen".
// - "field" is the field from the found pattern.
//
// The adjusted field should consist of characters from the originally requested
- // skeleton, except in the case of UDATPG_MONTH_FIELD or
+ // skeleton, except in the case of UDATPG_MONTH_FIELD or
// UDATPG_WEEKDAY_FIELD or UDATPG_YEAR_FIELD, in which case it should consist
- // of characters from the found pattern. In some cases of UDATPG_HOUR_FIELD,
- // there is adjustment following the "defaultHourFormatChar". There is explanation
- // how it is done below.
+ // of characters from the found pattern. In some cases of UDATPG_HOUR_FIELD,
+ // there is adjustment following the "defaultHourFormatChar". There is explanation
+ // how it is done below.
//
// The length of the adjusted field (adjFieldLen) should match that in the originally
// requested skeleton, except that in the following cases the length of the adjusted field
@@ -1651,31 +1651,31 @@ DateTimePatternGenerator::adjustFieldTypes(const UnicodeString& pattern,
&& (typeValue!= UDATPG_YEAR_FIELD || reqFieldChar==CAP_Y))
? reqFieldChar
: field.charAt(0);
- if (typeValue == UDATPG_HOUR_FIELD && fDefaultHourFormatChar != 0) {
- // The adjustment here is required to match spec (https://www.unicode.org/reports/tr35/tr35-dates.html#dfst-hour).
- // It is necessary to match the hour-cycle preferred by the Locale.
- // Given that, we need to do the following adjustments:
- // 1. When hour-cycle is h11 it should replace 'h' by 'K'.
- // 2. When hour-cycle is h23 it should replace 'H' by 'k'.
- // 3. When hour-cycle is h24 it should replace 'k' by 'H'.
- // 4. When hour-cycle is h12 it should replace 'K' by 'h'.
-
- if ((flags & kDTPGSkeletonUsesCapJ) != 0 || reqFieldChar == fDefaultHourFormatChar) {
- c = fDefaultHourFormatChar;
- } else if (reqFieldChar == LOW_H && fDefaultHourFormatChar == CAP_K) {
- c = CAP_K;
- } else if (reqFieldChar == CAP_H && fDefaultHourFormatChar == LOW_K) {
- c = LOW_K;
- } else if (reqFieldChar == LOW_K && fDefaultHourFormatChar == CAP_H) {
- c = CAP_H;
- } else if (reqFieldChar == CAP_K && fDefaultHourFormatChar == LOW_H) {
- c = LOW_H;
- }
+ if (typeValue == UDATPG_HOUR_FIELD && fDefaultHourFormatChar != 0) {
+ // The adjustment here is required to match spec (https://www.unicode.org/reports/tr35/tr35-dates.html#dfst-hour).
+ // It is necessary to match the hour-cycle preferred by the Locale.
+ // Given that, we need to do the following adjustments:
+ // 1. When hour-cycle is h11 it should replace 'h' by 'K'.
+ // 2. When hour-cycle is h23 it should replace 'H' by 'k'.
+ // 3. When hour-cycle is h24 it should replace 'k' by 'H'.
+ // 4. When hour-cycle is h12 it should replace 'K' by 'h'.
+
+ if ((flags & kDTPGSkeletonUsesCapJ) != 0 || reqFieldChar == fDefaultHourFormatChar) {
+ c = fDefaultHourFormatChar;
+ } else if (reqFieldChar == LOW_H && fDefaultHourFormatChar == CAP_K) {
+ c = CAP_K;
+ } else if (reqFieldChar == CAP_H && fDefaultHourFormatChar == LOW_K) {
+ c = LOW_K;
+ } else if (reqFieldChar == LOW_K && fDefaultHourFormatChar == CAP_H) {
+ c = CAP_H;
+ } else if (reqFieldChar == CAP_K && fDefaultHourFormatChar == LOW_H) {
+ c = LOW_H;
+ }
}
-
+
field.remove();
- for (int32_t j=adjFieldLen; j>0; --j) {
- field += c;
+ for (int32_t j=adjFieldLen; j>0; --j) {
+ field += c;
}
}
newPattern+=field;
@@ -1685,21 +1685,21 @@ DateTimePatternGenerator::adjustFieldTypes(const UnicodeString& pattern,
}
UnicodeString
-DateTimePatternGenerator::getBestAppending(int32_t missingFields, int32_t flags, UErrorCode &status, UDateTimePatternMatchOptions options) {
- if (U_FAILURE(status)) {
- return UnicodeString();
- }
+DateTimePatternGenerator::getBestAppending(int32_t missingFields, int32_t flags, UErrorCode &status, UDateTimePatternMatchOptions options) {
+ if (U_FAILURE(status)) {
+ return UnicodeString();
+ }
UnicodeString resultPattern, tempPattern;
- const UnicodeString* tempPatternPtr;
+ const UnicodeString* tempPatternPtr;
int32_t lastMissingFieldMask=0;
if (missingFields!=0) {
resultPattern=UnicodeString();
- const PtnSkeleton* specifiedSkeleton=nullptr;
- tempPatternPtr = getBestRaw(*dtMatcher, missingFields, distanceInfo, status, &specifiedSkeleton);
- if (U_FAILURE(status)) {
- return UnicodeString();
- }
- tempPattern = *tempPatternPtr;
+ const PtnSkeleton* specifiedSkeleton=nullptr;
+ tempPatternPtr = getBestRaw(*dtMatcher, missingFields, distanceInfo, status, &specifiedSkeleton);
+ if (U_FAILURE(status)) {
+ return UnicodeString();
+ }
+ tempPattern = *tempPatternPtr;
resultPattern = adjustFieldTypes(tempPattern, specifiedSkeleton, flags, options);
if ( distanceInfo->missingFieldMask==0 ) {
return resultPattern;
@@ -1715,26 +1715,26 @@ DateTimePatternGenerator::getBestAppending(int32_t missingFields, int32_t flags,
continue;
}
int32_t startingMask = distanceInfo->missingFieldMask;
- tempPatternPtr = getBestRaw(*dtMatcher, distanceInfo->missingFieldMask, distanceInfo, status, &specifiedSkeleton);
- if (U_FAILURE(status)) {
- return UnicodeString();
- }
- tempPattern = *tempPatternPtr;
+ tempPatternPtr = getBestRaw(*dtMatcher, distanceInfo->missingFieldMask, distanceInfo, status, &specifiedSkeleton);
+ if (U_FAILURE(status)) {
+ return UnicodeString();
+ }
+ tempPattern = *tempPatternPtr;
tempPattern = adjustFieldTypes(tempPattern, specifiedSkeleton, flags, options);
int32_t foundMask=startingMask& ~distanceInfo->missingFieldMask;
int32_t topField=getTopBitNumber(foundMask);
-
- if (appendItemFormats[topField].length() != 0) {
- UnicodeString appendName;
- getAppendName((UDateTimePatternField)topField, appendName);
- const UnicodeString *values[3] = {
- &resultPattern,
- &tempPattern,
- &appendName
- };
- SimpleFormatter(appendItemFormats[topField], 2, 3, status).
- formatAndReplace(values, 3, resultPattern, nullptr, 0, status);
- }
+
+ if (appendItemFormats[topField].length() != 0) {
+ UnicodeString appendName;
+ getAppendName((UDateTimePatternField)topField, appendName);
+ const UnicodeString *values[3] = {
+ &resultPattern,
+ &tempPattern,
+ &appendName
+ };
+ SimpleFormatter(appendItemFormats[topField], 2, 3, status).
+ formatAndReplace(values, 3, resultPattern, nullptr, 0, status);
+ }
lastMissingFieldMask = distanceInfo->missingFieldMask;
}
}
@@ -1742,7 +1742,7 @@ DateTimePatternGenerator::getBestAppending(int32_t missingFields, int32_t flags,
}
int32_t
-DateTimePatternGenerator::getTopBitNumber(int32_t foundMask) const {
+DateTimePatternGenerator::getTopBitNumber(int32_t foundMask) const {
if ( foundMask==0 ) {
return 0;
}
@@ -1771,21 +1771,21 @@ DateTimePatternGenerator::isAvailableFormatSet(const UnicodeString &key) const {
void
DateTimePatternGenerator::copyHashtable(Hashtable *other, UErrorCode &status) {
- if (other == nullptr || U_FAILURE(status)) {
+ if (other == nullptr || U_FAILURE(status)) {
return;
}
- if (fAvailableFormatKeyHash != nullptr) {
+ if (fAvailableFormatKeyHash != nullptr) {
delete fAvailableFormatKeyHash;
- fAvailableFormatKeyHash = nullptr;
+ fAvailableFormatKeyHash = nullptr;
}
initHashtable(status);
if(U_FAILURE(status)){
return;
}
int32_t pos = UHASH_FIRST;
- const UHashElement* elem = nullptr;
+ const UHashElement* elem = nullptr;
// walk through the hash table and create a deep clone
- while((elem = other->nextElement(pos))!= nullptr){
+ while((elem = other->nextElement(pos))!= nullptr){
const UHashTok otherKeyTok = elem->key;
UnicodeString* otherKey = (UnicodeString*)otherKeyTok.pointer;
fAvailableFormatKeyHash->puti(*otherKey, 1, status);
@@ -1797,17 +1797,17 @@ DateTimePatternGenerator::copyHashtable(Hashtable *other, UErrorCode &status) {
StringEnumeration*
DateTimePatternGenerator::getSkeletons(UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return nullptr;
- }
- if (U_FAILURE(internalErrorCode)) {
- status = internalErrorCode;
- return nullptr;
- }
- LocalPointer<StringEnumeration> skeletonEnumerator(
- new DTSkeletonEnumeration(*patternMap, DT_SKELETON, status), status);
-
- return U_SUCCESS(status) ? skeletonEnumerator.orphan() : nullptr;
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ if (U_FAILURE(internalErrorCode)) {
+ status = internalErrorCode;
+ return nullptr;
+ }
+ LocalPointer<StringEnumeration> skeletonEnumerator(
+ new DTSkeletonEnumeration(*patternMap, DT_SKELETON, status), status);
+
+ return U_SUCCESS(status) ? skeletonEnumerator.orphan() : nullptr;
}
const UnicodeString&
@@ -1818,70 +1818,70 @@ DateTimePatternGenerator::getPatternForSkeleton(const UnicodeString& skeleton) c
return emptyString;
}
curElem = patternMap->getHeader(skeleton.charAt(0));
- while ( curElem != nullptr ) {
+ while ( curElem != nullptr ) {
if ( curElem->skeleton->getSkeleton()==skeleton ) {
return curElem->pattern;
}
- curElem = curElem->next.getAlias();
+ curElem = curElem->next.getAlias();
}
return emptyString;
}
StringEnumeration*
DateTimePatternGenerator::getBaseSkeletons(UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return nullptr;
- }
- if (U_FAILURE(internalErrorCode)) {
- status = internalErrorCode;
- return nullptr;
- }
- LocalPointer<StringEnumeration> baseSkeletonEnumerator(
- new DTSkeletonEnumeration(*patternMap, DT_BASESKELETON, status), status);
-
- return U_SUCCESS(status) ? baseSkeletonEnumerator.orphan() : nullptr;
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ if (U_FAILURE(internalErrorCode)) {
+ status = internalErrorCode;
+ return nullptr;
+ }
+ LocalPointer<StringEnumeration> baseSkeletonEnumerator(
+ new DTSkeletonEnumeration(*patternMap, DT_BASESKELETON, status), status);
+
+ return U_SUCCESS(status) ? baseSkeletonEnumerator.orphan() : nullptr;
}
StringEnumeration*
DateTimePatternGenerator::getRedundants(UErrorCode& status) {
- if (U_FAILURE(status)) { return nullptr; }
- if (U_FAILURE(internalErrorCode)) {
- status = internalErrorCode;
- return nullptr;
- }
- LocalPointer<StringEnumeration> output(new DTRedundantEnumeration(), status);
- if (U_FAILURE(status)) { return nullptr; }
+ if (U_FAILURE(status)) { return nullptr; }
+ if (U_FAILURE(internalErrorCode)) {
+ status = internalErrorCode;
+ return nullptr;
+ }
+ LocalPointer<StringEnumeration> output(new DTRedundantEnumeration(), status);
+ if (U_FAILURE(status)) { return nullptr; }
const UnicodeString *pattern;
- PatternMapIterator it(status);
- if (U_FAILURE(status)) { return nullptr; }
-
+ PatternMapIterator it(status);
+ if (U_FAILURE(status)) { return nullptr; }
+
for (it.set(*patternMap); it.hasNext(); ) {
DateTimeMatcher current = it.next();
pattern = patternMap->getPatternFromSkeleton(*(it.getSkeleton()));
if ( isCanonicalItem(*pattern) ) {
continue;
}
- if ( skipMatcher == nullptr ) {
+ if ( skipMatcher == nullptr ) {
skipMatcher = new DateTimeMatcher(current);
- if (skipMatcher == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
+ if (skipMatcher == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
}
else {
*skipMatcher = current;
}
UnicodeString trial = getBestPattern(current.getPattern(), status);
- if (U_FAILURE(status)) { return nullptr; }
+ if (U_FAILURE(status)) { return nullptr; }
if (trial == *pattern) {
- ((DTRedundantEnumeration *)output.getAlias())->add(*pattern, status);
- if (U_FAILURE(status)) { return nullptr; }
+ ((DTRedundantEnumeration *)output.getAlias())->add(*pattern, status);
+ if (U_FAILURE(status)) { return nullptr; }
}
if (current.equals(skipMatcher)) {
continue;
}
}
- return output.orphan();
+ return output.orphan();
}
UBool
@@ -1905,54 +1905,54 @@ DateTimePatternGenerator::clone() const {
PatternMap::PatternMap() {
for (int32_t i=0; i < MAX_PATTERN_ENTRIES; ++i ) {
- boot[i] = nullptr;
+ boot[i] = nullptr;
}
isDupAllowed = TRUE;
}
void
PatternMap::copyFrom(const PatternMap& other, UErrorCode& status) {
- if (U_FAILURE(status)) {
- return;
- }
+ if (U_FAILURE(status)) {
+ return;
+ }
this->isDupAllowed = other.isDupAllowed;
- for (int32_t bootIndex = 0; bootIndex < MAX_PATTERN_ENTRIES; ++bootIndex) {
- PtnElem *curElem, *otherElem, *prevElem=nullptr;
+ for (int32_t bootIndex = 0; bootIndex < MAX_PATTERN_ENTRIES; ++bootIndex) {
+ PtnElem *curElem, *otherElem, *prevElem=nullptr;
otherElem = other.boot[bootIndex];
- while (otherElem != nullptr) {
- LocalPointer<PtnElem> newElem(new PtnElem(otherElem->basePattern, otherElem->pattern), status);
- if (U_FAILURE(status)) {
- return; // out of memory
+ while (otherElem != nullptr) {
+ LocalPointer<PtnElem> newElem(new PtnElem(otherElem->basePattern, otherElem->pattern), status);
+ if (U_FAILURE(status)) {
+ return; // out of memory
+ }
+ newElem->skeleton.adoptInsteadAndCheckErrorCode(new PtnSkeleton(*(otherElem->skeleton)), status);
+ if (U_FAILURE(status)) {
+ return; // out of memory
}
- newElem->skeleton.adoptInsteadAndCheckErrorCode(new PtnSkeleton(*(otherElem->skeleton)), status);
- if (U_FAILURE(status)) {
- return; // out of memory
- }
- newElem->skeletonWasSpecified = otherElem->skeletonWasSpecified;
-
- // Release ownership from the LocalPointer of the PtnElem object.
- // The PtnElem will now be owned by either the boot (for the first entry in the linked-list)
- // or owned by the previous PtnElem object in the linked-list.
- curElem = newElem.orphan();
-
- if (this->boot[bootIndex] == nullptr) {
+ newElem->skeletonWasSpecified = otherElem->skeletonWasSpecified;
+
+ // Release ownership from the LocalPointer of the PtnElem object.
+ // The PtnElem will now be owned by either the boot (for the first entry in the linked-list)
+ // or owned by the previous PtnElem object in the linked-list.
+ curElem = newElem.orphan();
+
+ if (this->boot[bootIndex] == nullptr) {
this->boot[bootIndex] = curElem;
- } else {
- if (prevElem != nullptr) {
- prevElem->next.adoptInstead(curElem);
- } else {
- UPRV_UNREACHABLE;
- }
+ } else {
+ if (prevElem != nullptr) {
+ prevElem->next.adoptInstead(curElem);
+ } else {
+ UPRV_UNREACHABLE;
+ }
}
prevElem = curElem;
- otherElem = otherElem->next.getAlias();
+ otherElem = otherElem->next.getAlias();
}
}
}
PtnElem*
-PatternMap::getHeader(UChar baseChar) const {
+PatternMap::getHeader(UChar baseChar) const {
PtnElem* curElem;
if ( (baseChar >= CAP_A) && (baseChar <= CAP_Z) ) {
@@ -1963,7 +1963,7 @@ PatternMap::getHeader(UChar baseChar) const {
curElem = boot[26+baseChar-LOW_A];
}
else {
- return nullptr;
+ return nullptr;
}
}
return curElem;
@@ -1971,9 +1971,9 @@ PatternMap::getHeader(UChar baseChar) const {
PatternMap::~PatternMap() {
for (int32_t i=0; i < MAX_PATTERN_ENTRIES; ++i ) {
- if (boot[i] != nullptr ) {
+ if (boot[i] != nullptr ) {
delete boot[i];
- boot[i] = nullptr;
+ boot[i] = nullptr;
}
}
} // PatternMap destructor
@@ -2002,45 +2002,45 @@ PatternMap::add(const UnicodeString& basePattern,
}
}
- if (baseElem == nullptr) {
- LocalPointer<PtnElem> newElem(new PtnElem(basePattern, value), status);
- if (U_FAILURE(status)) {
- return; // out of memory
+ if (baseElem == nullptr) {
+ LocalPointer<PtnElem> newElem(new PtnElem(basePattern, value), status);
+ if (U_FAILURE(status)) {
+ return; // out of memory
}
- newElem->skeleton.adoptInsteadAndCheckErrorCode(new PtnSkeleton(skeleton), status);
- if (U_FAILURE(status)) {
- return; // out of memory
- }
- newElem->skeletonWasSpecified = skeletonWasSpecified;
+ newElem->skeleton.adoptInsteadAndCheckErrorCode(new PtnSkeleton(skeleton), status);
+ if (U_FAILURE(status)) {
+ return; // out of memory
+ }
+ newElem->skeletonWasSpecified = skeletonWasSpecified;
if (baseChar >= LOW_A) {
- boot[26 + (baseChar - LOW_A)] = newElem.orphan(); // the boot array now owns the PtnElem.
+ boot[26 + (baseChar - LOW_A)] = newElem.orphan(); // the boot array now owns the PtnElem.
}
else {
- boot[baseChar - CAP_A] = newElem.orphan(); // the boot array now owns the PtnElem.
+ boot[baseChar - CAP_A] = newElem.orphan(); // the boot array now owns the PtnElem.
}
}
- if ( baseElem != nullptr ) {
+ if ( baseElem != nullptr ) {
curElem = getDuplicateElem(basePattern, skeleton, baseElem);
- if (curElem == nullptr) {
+ if (curElem == nullptr) {
// add new element to the list.
curElem = baseElem;
- while( curElem -> next != nullptr )
+ while( curElem -> next != nullptr )
{
- curElem = curElem->next.getAlias();
+ curElem = curElem->next.getAlias();
+ }
+
+ LocalPointer<PtnElem> newElem(new PtnElem(basePattern, value), status);
+ if (U_FAILURE(status)) {
+ return; // out of memory
}
-
- LocalPointer<PtnElem> newElem(new PtnElem(basePattern, value), status);
- if (U_FAILURE(status)) {
- return; // out of memory
+ newElem->skeleton.adoptInsteadAndCheckErrorCode(new PtnSkeleton(skeleton), status);
+ if (U_FAILURE(status)) {
+ return; // out of memory
}
- newElem->skeleton.adoptInsteadAndCheckErrorCode(new PtnSkeleton(skeleton), status);
- if (U_FAILURE(status)) {
- return; // out of memory
- }
- newElem->skeletonWasSpecified = skeletonWasSpecified;
- curElem->next.adoptInstead(newElem.orphan());
- curElem = curElem->next.getAlias();
+ newElem->skeletonWasSpecified = skeletonWasSpecified;
+ curElem->next.adoptInstead(newElem.orphan());
+ curElem = curElem->next.getAlias();
}
else {
// Pattern exists in the list already.
@@ -2058,11 +2058,11 @@ PatternMap::add(const UnicodeString& basePattern,
// Find the pattern from the given basePattern string.
const UnicodeString *
-PatternMap::getPatternFromBasePattern(const UnicodeString& basePattern, UBool& skeletonWasSpecified) const { // key to search for
+PatternMap::getPatternFromBasePattern(const UnicodeString& basePattern, UBool& skeletonWasSpecified) const { // key to search for
PtnElem *curElem;
- if ((curElem=getHeader(basePattern.charAt(0)))==nullptr) {
- return nullptr; // no match
+ if ((curElem=getHeader(basePattern.charAt(0)))==nullptr) {
+ return nullptr; // no match
}
do {
@@ -2070,10 +2070,10 @@ PatternMap::getPatternFromBasePattern(const UnicodeString& basePattern, UBool& s
skeletonWasSpecified = curElem->skeletonWasSpecified;
return &(curElem->pattern);
}
- curElem = curElem->next.getAlias();
- } while (curElem != nullptr);
+ curElem = curElem->next.getAlias();
+ } while (curElem != nullptr);
- return nullptr;
+ return nullptr;
} // PatternMap::getFromBasePattern
@@ -2084,69 +2084,69 @@ PatternMap::getPatternFromBasePattern(const UnicodeString& basePattern, UBool& s
// optimum distance value in getBestRaw. When this is called from public getRedundants (specifiedSkeletonPtr is NULL),
// for now it will continue to compare based on baseOriginal so as not to change the behavior unnecessarily.
const UnicodeString *
-PatternMap::getPatternFromSkeleton(const PtnSkeleton& skeleton, const PtnSkeleton** specifiedSkeletonPtr) const { // key to search for
+PatternMap::getPatternFromSkeleton(const PtnSkeleton& skeleton, const PtnSkeleton** specifiedSkeletonPtr) const { // key to search for
PtnElem *curElem;
if (specifiedSkeletonPtr) {
- *specifiedSkeletonPtr = nullptr;
+ *specifiedSkeletonPtr = nullptr;
}
// find boot entry
UChar baseChar = skeleton.getFirstChar();
- if ((curElem=getHeader(baseChar))==nullptr) {
- return nullptr; // no match
+ if ((curElem=getHeader(baseChar))==nullptr) {
+ return nullptr; // no match
}
do {
UBool equal;
- if (specifiedSkeletonPtr != nullptr) { // called from DateTimePatternGenerator::getBestRaw or addPattern, use original
+ if (specifiedSkeletonPtr != nullptr) { // called from DateTimePatternGenerator::getBestRaw or addPattern, use original
equal = curElem->skeleton->original == skeleton.original;
} else { // called from DateTimePatternGenerator::getRedundants, use baseOriginal
equal = curElem->skeleton->baseOriginal == skeleton.baseOriginal;
}
if (equal) {
if (specifiedSkeletonPtr && curElem->skeletonWasSpecified) {
- *specifiedSkeletonPtr = curElem->skeleton.getAlias();
+ *specifiedSkeletonPtr = curElem->skeleton.getAlias();
}
return &(curElem->pattern);
}
- curElem = curElem->next.getAlias();
- } while (curElem != nullptr);
+ curElem = curElem->next.getAlias();
+ } while (curElem != nullptr);
- return nullptr;
+ return nullptr;
}
UBool
-PatternMap::equals(const PatternMap& other) const {
+PatternMap::equals(const PatternMap& other) const {
if ( this==&other ) {
return TRUE;
}
- for (int32_t bootIndex = 0; bootIndex < MAX_PATTERN_ENTRIES; ++bootIndex) {
- if (boot[bootIndex] == other.boot[bootIndex]) {
+ for (int32_t bootIndex = 0; bootIndex < MAX_PATTERN_ENTRIES; ++bootIndex) {
+ if (boot[bootIndex] == other.boot[bootIndex]) {
continue;
}
- if ((boot[bootIndex] == nullptr) || (other.boot[bootIndex] == nullptr)) {
+ if ((boot[bootIndex] == nullptr) || (other.boot[bootIndex] == nullptr)) {
return FALSE;
}
PtnElem *otherElem = other.boot[bootIndex];
PtnElem *myElem = boot[bootIndex];
- while ((otherElem != nullptr) || (myElem != nullptr)) {
+ while ((otherElem != nullptr) || (myElem != nullptr)) {
if ( myElem == otherElem ) {
break;
}
- if ((otherElem == nullptr) || (myElem == nullptr)) {
+ if ((otherElem == nullptr) || (myElem == nullptr)) {
return FALSE;
}
if ( (myElem->basePattern != otherElem->basePattern) ||
(myElem->pattern != otherElem->pattern) ) {
return FALSE;
}
- if ((myElem->skeleton.getAlias() != otherElem->skeleton.getAlias()) &&
+ if ((myElem->skeleton.getAlias() != otherElem->skeleton.getAlias()) &&
!myElem->skeleton->equals(*(otherElem->skeleton))) {
return FALSE;
}
- myElem = myElem->next.getAlias();
- otherElem = otherElem->next.getAlias();
+ myElem = myElem->next.getAlias();
+ otherElem = otherElem->next.getAlias();
}
}
return TRUE;
@@ -2158,21 +2158,21 @@ PtnElem*
PatternMap::getDuplicateElem(
const UnicodeString &basePattern,
const PtnSkeleton &skeleton,
- PtnElem *baseElem) {
+ PtnElem *baseElem) {
PtnElem *curElem;
- if ( baseElem == nullptr ) {
- return nullptr;
+ if ( baseElem == nullptr ) {
+ return nullptr;
}
else {
curElem = baseElem;
}
do {
if ( basePattern.compare(curElem->basePattern)==0 ) {
- UBool isEqual = TRUE;
- for (int32_t i = 0; i < UDATPG_FIELD_COUNT; ++i) {
+ UBool isEqual = TRUE;
+ for (int32_t i = 0; i < UDATPG_FIELD_COUNT; ++i) {
if (curElem->skeleton->type[i] != skeleton.type[i] ) {
- isEqual = FALSE;
+ isEqual = FALSE;
break;
}
}
@@ -2180,11 +2180,11 @@ PatternMap::getDuplicateElem(
return curElem;
}
}
- curElem = curElem->next.getAlias();
- } while( curElem != nullptr );
+ curElem = curElem->next.getAlias();
+ } while( curElem != nullptr );
// end of the list
- return nullptr;
+ return nullptr;
} // PatternMap::getDuplicateElem
@@ -2197,12 +2197,12 @@ DateTimeMatcher::DateTimeMatcher(const DateTimeMatcher& other) {
copyFrom(other.skeleton);
}
-DateTimeMatcher& DateTimeMatcher::operator=(const DateTimeMatcher& other) {
- copyFrom(other.skeleton);
- return *this;
-}
+DateTimeMatcher& DateTimeMatcher::operator=(const DateTimeMatcher& other) {
+ copyFrom(other.skeleton);
+ return *this;
+}
+
-
void
DateTimeMatcher::set(const UnicodeString& pattern, FormatParser* fp) {
PtnSkeleton localSkeleton;
@@ -2215,14 +2215,14 @@ DateTimeMatcher::set(const UnicodeString& pattern, FormatParser* fp, PtnSkeleton
for (i=0; i<UDATPG_FIELD_COUNT; ++i) {
skeletonResult.type[i] = NONE;
}
- skeletonResult.original.clear();
- skeletonResult.baseOriginal.clear();
- skeletonResult.addedDefaultDayPeriod = FALSE;
-
+ skeletonResult.original.clear();
+ skeletonResult.baseOriginal.clear();
+ skeletonResult.addedDefaultDayPeriod = FALSE;
+
fp->set(pattern);
for (i=0; i < fp->itemNumber; i++) {
const UnicodeString& value = fp->items[i];
- // don't skip 'a' anymore, dayPeriod handled specially below
+ // don't skip 'a' anymore, dayPeriod handled specially below
if ( fp->isQuoteLiteral(value) ) {
UnicodeString quoteLiteral;
@@ -2230,73 +2230,73 @@ DateTimeMatcher::set(const UnicodeString& pattern, FormatParser* fp, PtnSkeleton
continue;
}
int32_t canonicalIndex = fp->getCanonicalIndex(value);
- if (canonicalIndex < 0) {
+ if (canonicalIndex < 0) {
continue;
}
const dtTypeElem *row = &dtTypes[canonicalIndex];
int32_t field = row->field;
skeletonResult.original.populate(field, value);
UChar repeatChar = row->patternChar;
- int32_t repeatCount = row->minLen;
+ int32_t repeatCount = row->minLen;
skeletonResult.baseOriginal.populate(field, repeatChar, repeatCount);
int16_t subField = row->type;
- if (row->type > 0) {
- U_ASSERT(value.length() < INT16_MAX);
- subField += static_cast<int16_t>(value.length());
+ if (row->type > 0) {
+ U_ASSERT(value.length() < INT16_MAX);
+ subField += static_cast<int16_t>(value.length());
}
skeletonResult.type[field] = subField;
}
-
- // #20739, we have a skeleton with minutes and milliseconds, but no seconds
- //
- // Theoretically we would need to check and fix all fields with "gaps":
- // for example year-day (no month), month-hour (no day), and so on, All the possible field combinations.
- // Plus some smartness: year + hour => should we add month, or add day-of-year?
- // What about month + day-of-week, or month + am/pm indicator.
- // I think beyond a certain point we should not try to fix bad developer input and try guessing what they mean.
- // Garbage in, garbage out.
- if (!skeletonResult.original.isFieldEmpty(UDATPG_MINUTE_FIELD)
- && !skeletonResult.original.isFieldEmpty(UDATPG_FRACTIONAL_SECOND_FIELD)
- && skeletonResult.original.isFieldEmpty(UDATPG_SECOND_FIELD)) {
- // Force the use of seconds
- for (i = 0; dtTypes[i].patternChar != 0; i++) {
- if (dtTypes[i].field == UDATPG_SECOND_FIELD) {
- // first entry for UDATPG_SECOND_FIELD
- skeletonResult.original.populate(UDATPG_SECOND_FIELD, dtTypes[i].patternChar, dtTypes[i].minLen);
- skeletonResult.baseOriginal.populate(UDATPG_SECOND_FIELD, dtTypes[i].patternChar, dtTypes[i].minLen);
- // We add value.length, same as above, when type is first initialized.
- // The value we want to "fake" here is "s", and 1 means "s".length()
- int16_t subField = dtTypes[i].type;
- skeletonResult.type[UDATPG_SECOND_FIELD] = (subField > 0) ? subField + 1 : subField;
- break;
- }
- }
- }
-
- // #13183, handle special behavior for day period characters (a, b, B)
- if (!skeletonResult.original.isFieldEmpty(UDATPG_HOUR_FIELD)) {
- if (skeletonResult.original.getFieldChar(UDATPG_HOUR_FIELD)==LOW_H || skeletonResult.original.getFieldChar(UDATPG_HOUR_FIELD)==CAP_K) {
- // We have a skeleton with 12-hour-cycle format
- if (skeletonResult.original.isFieldEmpty(UDATPG_DAYPERIOD_FIELD)) {
- // But we do not have a day period in the skeleton; add the default DAYPERIOD (currently "a")
- for (i = 0; dtTypes[i].patternChar != 0; i++) {
- if ( dtTypes[i].field == UDATPG_DAYPERIOD_FIELD ) {
- // first entry for UDATPG_DAYPERIOD_FIELD
- skeletonResult.original.populate(UDATPG_DAYPERIOD_FIELD, dtTypes[i].patternChar, dtTypes[i].minLen);
- skeletonResult.baseOriginal.populate(UDATPG_DAYPERIOD_FIELD, dtTypes[i].patternChar, dtTypes[i].minLen);
- skeletonResult.type[UDATPG_DAYPERIOD_FIELD] = dtTypes[i].type;
- skeletonResult.addedDefaultDayPeriod = TRUE;
- break;
- }
- }
- }
- } else {
- // Skeleton has 24-hour-cycle hour format and has dayPeriod, delete dayPeriod (i.e. ignore it)
- skeletonResult.original.clearField(UDATPG_DAYPERIOD_FIELD);
- skeletonResult.baseOriginal.clearField(UDATPG_DAYPERIOD_FIELD);
- skeletonResult.type[UDATPG_DAYPERIOD_FIELD] = NONE;
- }
- }
+
+ // #20739, we have a skeleton with minutes and milliseconds, but no seconds
+ //
+ // Theoretically we would need to check and fix all fields with "gaps":
+ // for example year-day (no month), month-hour (no day), and so on, All the possible field combinations.
+ // Plus some smartness: year + hour => should we add month, or add day-of-year?
+ // What about month + day-of-week, or month + am/pm indicator.
+ // I think beyond a certain point we should not try to fix bad developer input and try guessing what they mean.
+ // Garbage in, garbage out.
+ if (!skeletonResult.original.isFieldEmpty(UDATPG_MINUTE_FIELD)
+ && !skeletonResult.original.isFieldEmpty(UDATPG_FRACTIONAL_SECOND_FIELD)
+ && skeletonResult.original.isFieldEmpty(UDATPG_SECOND_FIELD)) {
+ // Force the use of seconds
+ for (i = 0; dtTypes[i].patternChar != 0; i++) {
+ if (dtTypes[i].field == UDATPG_SECOND_FIELD) {
+ // first entry for UDATPG_SECOND_FIELD
+ skeletonResult.original.populate(UDATPG_SECOND_FIELD, dtTypes[i].patternChar, dtTypes[i].minLen);
+ skeletonResult.baseOriginal.populate(UDATPG_SECOND_FIELD, dtTypes[i].patternChar, dtTypes[i].minLen);
+ // We add value.length, same as above, when type is first initialized.
+ // The value we want to "fake" here is "s", and 1 means "s".length()
+ int16_t subField = dtTypes[i].type;
+ skeletonResult.type[UDATPG_SECOND_FIELD] = (subField > 0) ? subField + 1 : subField;
+ break;
+ }
+ }
+ }
+
+ // #13183, handle special behavior for day period characters (a, b, B)
+ if (!skeletonResult.original.isFieldEmpty(UDATPG_HOUR_FIELD)) {
+ if (skeletonResult.original.getFieldChar(UDATPG_HOUR_FIELD)==LOW_H || skeletonResult.original.getFieldChar(UDATPG_HOUR_FIELD)==CAP_K) {
+ // We have a skeleton with 12-hour-cycle format
+ if (skeletonResult.original.isFieldEmpty(UDATPG_DAYPERIOD_FIELD)) {
+ // But we do not have a day period in the skeleton; add the default DAYPERIOD (currently "a")
+ for (i = 0; dtTypes[i].patternChar != 0; i++) {
+ if ( dtTypes[i].field == UDATPG_DAYPERIOD_FIELD ) {
+ // first entry for UDATPG_DAYPERIOD_FIELD
+ skeletonResult.original.populate(UDATPG_DAYPERIOD_FIELD, dtTypes[i].patternChar, dtTypes[i].minLen);
+ skeletonResult.baseOriginal.populate(UDATPG_DAYPERIOD_FIELD, dtTypes[i].patternChar, dtTypes[i].minLen);
+ skeletonResult.type[UDATPG_DAYPERIOD_FIELD] = dtTypes[i].type;
+ skeletonResult.addedDefaultDayPeriod = TRUE;
+ break;
+ }
+ }
+ }
+ } else {
+ // Skeleton has 24-hour-cycle hour format and has dayPeriod, delete dayPeriod (i.e. ignore it)
+ skeletonResult.original.clearField(UDATPG_DAYPERIOD_FIELD);
+ skeletonResult.baseOriginal.clearField(UDATPG_DAYPERIOD_FIELD);
+ skeletonResult.type[UDATPG_DAYPERIOD_FIELD] = NONE;
+ }
+ }
copyFrom(skeletonResult);
}
@@ -2313,8 +2313,8 @@ DateTimeMatcher::getPattern() {
}
int32_t
-DateTimeMatcher::getDistance(const DateTimeMatcher& other, int32_t includeMask, DistanceInfo& distanceInfo) const {
- int32_t result = 0;
+DateTimeMatcher::getDistance(const DateTimeMatcher& other, int32_t includeMask, DistanceInfo& distanceInfo) const {
+ int32_t result = 0;
distanceInfo.clear();
for (int32_t i=0; i<UDATPG_FIELD_COUNT; ++i ) {
int32_t myType = (includeMask&(1<<i))==0 ? 0 : skeleton.type[i];
@@ -2353,13 +2353,13 @@ DateTimeMatcher::copyFrom() {
UBool
DateTimeMatcher::equals(const DateTimeMatcher* other) const {
- if (other==nullptr) { return FALSE; }
+ if (other==nullptr) { return FALSE; }
return skeleton.original == other->skeleton.original;
}
int32_t
-DateTimeMatcher::getFieldMask() const {
- int32_t result = 0;
+DateTimeMatcher::getFieldMask() const {
+ int32_t result = 0;
for (int32_t i=0; i<UDATPG_FIELD_COUNT; ++i) {
if (skeleton.type[i]!=0) {
@@ -2376,7 +2376,7 @@ DateTimeMatcher::getSkeletonPtr() {
FormatParser::FormatParser () {
status = START;
- itemNumber = 0;
+ itemNumber = 0;
}
@@ -2388,7 +2388,7 @@ FormatParser::~FormatParser () {
// Note: the startPos may
FormatParser::TokenStatus
FormatParser::setTokens(const UnicodeString& pattern, int32_t startPos, int32_t *len) {
- int32_t curLoc = startPos;
+ int32_t curLoc = startPos;
if ( curLoc >= pattern.length()) {
return DONE;
}
@@ -2414,10 +2414,10 @@ FormatParser::setTokens(const UnicodeString& pattern, int32_t startPos, int32_t
void
FormatParser::set(const UnicodeString& pattern) {
- int32_t startPos = 0;
- TokenStatus result = START;
- int32_t len = 0;
- itemNumber = 0;
+ int32_t startPos = 0;
+ TokenStatus result = START;
+ int32_t len = 0;
+ itemNumber = 0;
do {
result = setTokens( pattern, startPos, &len );
@@ -2468,14 +2468,14 @@ FormatParser::getCanonicalIndex(const UnicodeString& s, UBool strict) {
UBool
FormatParser::isQuoteLiteral(const UnicodeString& s) {
- return (UBool)(s.charAt(0) == SINGLE_QUOTE);
+ return (UBool)(s.charAt(0) == SINGLE_QUOTE);
}
-// This function assumes the current itemIndex points to the quote literal.
+// This function assumes the current itemIndex points to the quote literal.
// Please call isQuoteLiteral prior to this function.
void
FormatParser::getQuoteLiteral(UnicodeString& quote, int32_t *itemIndex) {
- int32_t i = *itemIndex;
+ int32_t i = *itemIndex;
quote.remove();
if (items[i].charAt(0)==SINGLE_QUOTE) {
@@ -2504,7 +2504,7 @@ FormatParser::getQuoteLiteral(UnicodeString& quote, int32_t *itemIndex) {
}
UBool
-FormatParser::isPatternSeparator(const UnicodeString& field) const {
+FormatParser::isPatternSeparator(const UnicodeString& field) const {
for (int32_t i=0; i<field.length(); ++i ) {
UChar c= field.charAt(i);
if ( (c==SINGLE_QUOTE) || (c==BACKSLASH) || (c==SPACE) || (c==COLON) ||
@@ -2521,16 +2521,16 @@ FormatParser::isPatternSeparator(const UnicodeString& field) const {
DistanceInfo::~DistanceInfo() {}
void
-DistanceInfo::setTo(const DistanceInfo& other) {
+DistanceInfo::setTo(const DistanceInfo& other) {
missingFieldMask = other.missingFieldMask;
extraFieldMask= other.extraFieldMask;
}
-PatternMapIterator::PatternMapIterator(UErrorCode& status) :
- bootIndex(0), nodePtr(nullptr), matcher(nullptr), patternMap(nullptr)
-{
- if (U_FAILURE(status)) { return; }
- matcher.adoptInsteadAndCheckErrorCode(new DateTimeMatcher(), status);
+PatternMapIterator::PatternMapIterator(UErrorCode& status) :
+ bootIndex(0), nodePtr(nullptr), matcher(nullptr), patternMap(nullptr)
+{
+ if (U_FAILURE(status)) { return; }
+ matcher.adoptInsteadAndCheckErrorCode(new DateTimeMatcher(), status);
}
PatternMapIterator::~PatternMapIterator() {
@@ -2542,36 +2542,36 @@ PatternMapIterator::set(PatternMap& newPatternMap) {
}
PtnSkeleton*
-PatternMapIterator::getSkeleton() const {
- if ( nodePtr == nullptr ) {
- return nullptr;
+PatternMapIterator::getSkeleton() const {
+ if ( nodePtr == nullptr ) {
+ return nullptr;
}
else {
- return nodePtr->skeleton.getAlias();
+ return nodePtr->skeleton.getAlias();
}
}
UBool
-PatternMapIterator::hasNext() const {
- int32_t headIndex = bootIndex;
- PtnElem *curPtr = nodePtr;
+PatternMapIterator::hasNext() const {
+ int32_t headIndex = bootIndex;
+ PtnElem *curPtr = nodePtr;
- if (patternMap==nullptr) {
+ if (patternMap==nullptr) {
return FALSE;
}
while ( headIndex < MAX_PATTERN_ENTRIES ) {
- if ( curPtr != nullptr ) {
- if ( curPtr->next != nullptr ) {
+ if ( curPtr != nullptr ) {
+ if ( curPtr->next != nullptr ) {
return TRUE;
}
else {
headIndex++;
- curPtr=nullptr;
+ curPtr=nullptr;
continue;
}
}
else {
- if ( patternMap->boot[headIndex] != nullptr ) {
+ if ( patternMap->boot[headIndex] != nullptr ) {
return TRUE;
}
else {
@@ -2586,19 +2586,19 @@ PatternMapIterator::hasNext() const {
DateTimeMatcher&
PatternMapIterator::next() {
while ( bootIndex < MAX_PATTERN_ENTRIES ) {
- if ( nodePtr != nullptr ) {
- if ( nodePtr->next != nullptr ) {
- nodePtr = nodePtr->next.getAlias();
+ if ( nodePtr != nullptr ) {
+ if ( nodePtr->next != nullptr ) {
+ nodePtr = nodePtr->next.getAlias();
break;
}
else {
bootIndex++;
- nodePtr=nullptr;
+ nodePtr=nullptr;
continue;
}
}
else {
- if ( patternMap->boot[bootIndex] != nullptr ) {
+ if ( patternMap->boot[bootIndex] != nullptr ) {
nodePtr = patternMap->boot[bootIndex];
break;
}
@@ -2608,7 +2608,7 @@ PatternMapIterator::next() {
}
}
}
- if (nodePtr!=nullptr) {
+ if (nodePtr!=nullptr) {
matcher->copyFrom(*nodePtr->skeleton);
}
else {
@@ -2686,8 +2686,8 @@ UChar SkeletonFields::getFirstChar() const {
}
-PtnSkeleton::PtnSkeleton()
- : addedDefaultDayPeriod(FALSE) {
+PtnSkeleton::PtnSkeleton()
+ : addedDefaultDayPeriod(FALSE) {
}
PtnSkeleton::PtnSkeleton(const PtnSkeleton& other) {
@@ -2698,7 +2698,7 @@ void PtnSkeleton::copyFrom(const PtnSkeleton& other) {
uprv_memcpy(type, other.type, sizeof(type));
original.copyFrom(other.original);
baseOriginal.copyFrom(other.baseOriginal);
- addedDefaultDayPeriod = other.addedDefaultDayPeriod;
+ addedDefaultDayPeriod = other.addedDefaultDayPeriod;
}
void PtnSkeleton::clear() {
@@ -2717,27 +2717,27 @@ PtnSkeleton::equals(const PtnSkeleton& other) const {
UnicodeString
PtnSkeleton::getSkeleton() const {
UnicodeString result;
- result = original.appendTo(result);
- int32_t pos;
- if (addedDefaultDayPeriod && (pos = result.indexOf(LOW_A)) >= 0) {
- // for backward compatibility: if DateTimeMatcher.set added a single 'a' that
- // was not in the provided skeleton, remove it here before returning skeleton.
- result.remove(pos, 1);
- }
- return result;
+ result = original.appendTo(result);
+ int32_t pos;
+ if (addedDefaultDayPeriod && (pos = result.indexOf(LOW_A)) >= 0) {
+ // for backward compatibility: if DateTimeMatcher.set added a single 'a' that
+ // was not in the provided skeleton, remove it here before returning skeleton.
+ result.remove(pos, 1);
+ }
+ return result;
}
UnicodeString
PtnSkeleton::getBaseSkeleton() const {
UnicodeString result;
- result = baseOriginal.appendTo(result);
- int32_t pos;
- if (addedDefaultDayPeriod && (pos = result.indexOf(LOW_A)) >= 0) {
- // for backward compatibility: if DateTimeMatcher.set added a single 'a' that
- // was not in the provided skeleton, remove it here before returning skeleton.
- result.remove(pos, 1);
- }
- return result;
+ result = baseOriginal.appendTo(result);
+ int32_t pos;
+ if (addedDefaultDayPeriod && (pos = result.indexOf(LOW_A)) >= 0) {
+ // for backward compatibility: if DateTimeMatcher.set added a single 'a' that
+ // was not in the provided skeleton, remove it here before returning skeleton.
+ result.remove(pos, 1);
+ }
+ return result;
}
UChar
@@ -2749,28 +2749,28 @@ PtnSkeleton::~PtnSkeleton() {
}
PtnElem::PtnElem(const UnicodeString &basePat, const UnicodeString &pat) :
- basePattern(basePat), skeleton(nullptr), pattern(pat), next(nullptr)
+ basePattern(basePat), skeleton(nullptr), pattern(pat), next(nullptr)
{
}
PtnElem::~PtnElem() {
}
-DTSkeletonEnumeration::DTSkeletonEnumeration(PatternMap& patternMap, dtStrEnum type, UErrorCode& status) : fSkeletons(nullptr) {
+DTSkeletonEnumeration::DTSkeletonEnumeration(PatternMap& patternMap, dtStrEnum type, UErrorCode& status) : fSkeletons(nullptr) {
PtnElem *curElem;
PtnSkeleton *curSkeleton;
UnicodeString s;
int32_t bootIndex;
pos=0;
- fSkeletons.adoptInsteadAndCheckErrorCode(new UVector(status), status);
+ fSkeletons.adoptInsteadAndCheckErrorCode(new UVector(status), status);
if (U_FAILURE(status)) {
return;
}
-
+
for (bootIndex=0; bootIndex<MAX_PATTERN_ENTRIES; ++bootIndex ) {
curElem = patternMap.boot[bootIndex];
- while (curElem!=nullptr) {
+ while (curElem!=nullptr) {
switch(type) {
case DT_BASESKELETON:
s=curElem->basePattern;
@@ -2779,36 +2779,36 @@ DTSkeletonEnumeration::DTSkeletonEnumeration(PatternMap& patternMap, dtStrEnum t
s=curElem->pattern;
break;
case DT_SKELETON:
- curSkeleton=curElem->skeleton.getAlias();
+ curSkeleton=curElem->skeleton.getAlias();
s=curSkeleton->getSkeleton();
break;
}
if ( !isCanonicalItem(s) ) {
- LocalPointer<UnicodeString> newElem(new UnicodeString(s), status);
- if (U_FAILURE(status)) {
- return;
- }
- fSkeletons->addElement(newElem.getAlias(), status);
+ LocalPointer<UnicodeString> newElem(new UnicodeString(s), status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ fSkeletons->addElement(newElem.getAlias(), status);
if (U_FAILURE(status)) {
- fSkeletons.adoptInstead(nullptr);
+ fSkeletons.adoptInstead(nullptr);
return;
}
- newElem.orphan(); // fSkeletons vector now owns the UnicodeString.
+ newElem.orphan(); // fSkeletons vector now owns the UnicodeString.
}
- curElem = curElem->next.getAlias();
+ curElem = curElem->next.getAlias();
}
}
- if ((bootIndex==MAX_PATTERN_ENTRIES) && (curElem!=nullptr) ) {
+ if ((bootIndex==MAX_PATTERN_ENTRIES) && (curElem!=nullptr) ) {
status = U_BUFFER_OVERFLOW_ERROR;
}
}
const UnicodeString*
DTSkeletonEnumeration::snext(UErrorCode& status) {
- if (U_SUCCESS(status) && fSkeletons.isValid() && pos < fSkeletons->size()) {
+ if (U_SUCCESS(status) && fSkeletons.isValid() && pos < fSkeletons->size()) {
return (const UnicodeString*)fSkeletons->elementAt(pos++);
}
- return nullptr;
+ return nullptr;
}
void
@@ -2818,7 +2818,7 @@ DTSkeletonEnumeration::reset(UErrorCode& /*status*/) {
int32_t
DTSkeletonEnumeration::count(UErrorCode& /*status*/) const {
- return (fSkeletons.isNull()) ? 0 : fSkeletons->size();
+ return (fSkeletons.isNull()) ? 0 : fSkeletons->size();
}
UBool
@@ -2836,45 +2836,45 @@ DTSkeletonEnumeration::isCanonicalItem(const UnicodeString& item) {
DTSkeletonEnumeration::~DTSkeletonEnumeration() {
UnicodeString *s;
- if (fSkeletons.isValid()) {
- for (int32_t i = 0; i < fSkeletons->size(); ++i) {
- if ((s = (UnicodeString *)fSkeletons->elementAt(i)) != nullptr) {
- delete s;
- }
+ if (fSkeletons.isValid()) {
+ for (int32_t i = 0; i < fSkeletons->size(); ++i) {
+ if ((s = (UnicodeString *)fSkeletons->elementAt(i)) != nullptr) {
+ delete s;
+ }
}
}
}
-DTRedundantEnumeration::DTRedundantEnumeration() : pos(0), fPatterns(nullptr) {
+DTRedundantEnumeration::DTRedundantEnumeration() : pos(0), fPatterns(nullptr) {
}
void
DTRedundantEnumeration::add(const UnicodeString& pattern, UErrorCode& status) {
- if (U_FAILURE(status)) { return; }
- if (fPatterns.isNull()) {
- fPatterns.adoptInsteadAndCheckErrorCode(new UVector(status), status);
+ if (U_FAILURE(status)) { return; }
+ if (fPatterns.isNull()) {
+ fPatterns.adoptInsteadAndCheckErrorCode(new UVector(status), status);
if (U_FAILURE(status)) {
return;
}
}
- LocalPointer<UnicodeString> newElem(new UnicodeString(pattern), status);
+ LocalPointer<UnicodeString> newElem(new UnicodeString(pattern), status);
if (U_FAILURE(status)) {
return;
}
- fPatterns->addElement(newElem.getAlias(), status);
- if (U_FAILURE(status)) {
- fPatterns.adoptInstead(nullptr);
- return;
- }
- newElem.orphan(); // fPatterns now owns the string.
+ fPatterns->addElement(newElem.getAlias(), status);
+ if (U_FAILURE(status)) {
+ fPatterns.adoptInstead(nullptr);
+ return;
+ }
+ newElem.orphan(); // fPatterns now owns the string.
}
const UnicodeString*
DTRedundantEnumeration::snext(UErrorCode& status) {
- if (U_SUCCESS(status) && fPatterns.isValid() && pos < fPatterns->size()) {
+ if (U_SUCCESS(status) && fPatterns.isValid() && pos < fPatterns->size()) {
return (const UnicodeString*)fPatterns->elementAt(pos++);
}
- return nullptr;
+ return nullptr;
}
void
@@ -2884,11 +2884,11 @@ DTRedundantEnumeration::reset(UErrorCode& /*status*/) {
int32_t
DTRedundantEnumeration::count(UErrorCode& /*status*/) const {
- return (fPatterns.isNull()) ? 0 : fPatterns->size();
+ return (fPatterns.isNull()) ? 0 : fPatterns->size();
}
UBool
-DTRedundantEnumeration::isCanonicalItem(const UnicodeString& item) const {
+DTRedundantEnumeration::isCanonicalItem(const UnicodeString& item) const {
if ( item.length() != 1 ) {
return FALSE;
}
@@ -2902,13 +2902,13 @@ DTRedundantEnumeration::isCanonicalItem(const UnicodeString& item) const {
DTRedundantEnumeration::~DTRedundantEnumeration() {
UnicodeString *s;
- if (fPatterns.isValid()) {
- for (int32_t i = 0; i < fPatterns->size(); ++i) {
- if ((s = (UnicodeString *)fPatterns->elementAt(i)) != nullptr) {
- delete s;
- }
+ if (fPatterns.isValid()) {
+ for (int32_t i = 0; i < fPatterns->size(); ++i) {
+ if ((s = (UnicodeString *)fPatterns->elementAt(i)) != nullptr) {
+ delete s;
+ }
}
- }
+ }
}
U_NAMESPACE_END
diff --git a/contrib/libs/icu/i18n/dtptngen_impl.h b/contrib/libs/icu/i18n/dtptngen_impl.h
index ff0fe133fa..ade9f57331 100644
--- a/contrib/libs/icu/i18n/dtptngen_impl.h
+++ b/contrib/libs/icu/i18n/dtptngen_impl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -15,9 +15,9 @@
#define __DTPTNGEN_IMPL_H__
#include "unicode/udatpg.h"
-
-#include "unicode/strenum.h"
-#include "unicode/unistr.h"
+
+#include "unicode/strenum.h"
+#include "unicode/unistr.h"
#include "uvector.h"
// TODO(claireho): Split off Builder class.
@@ -92,10 +92,10 @@
#define LOW_X ((UChar)0x0078)
#define LOW_Y ((UChar)0x0079)
#define LOW_Z ((UChar)0x007A)
-#define DT_NARROW -0x101
-#define DT_SHORTER -0x102
-#define DT_SHORT -0x103
-#define DT_LONG -0x104
+#define DT_NARROW -0x101
+#define DT_SHORTER -0x102
+#define DT_SHORT -0x103
+#define DT_LONG -0x104
#define DT_NUMERIC 0x100
#define DT_DELTA 0x10
@@ -116,7 +116,7 @@ typedef struct dtTypeElem {
int16_t type;
int16_t minLen;
int16_t weight;
-} dtTypeElem;
+} dtTypeElem;
// A compact storage mechanism for skeleton field strings. Several dozen of these will be created
// for a typical DateTimePatternGenerator instance.
@@ -156,7 +156,7 @@ public:
int32_t type[UDATPG_FIELD_COUNT];
SkeletonFields original;
SkeletonFields baseOriginal;
- UBool addedDefaultDayPeriod;
+ UBool addedDefaultDayPeriod;
PtnSkeleton();
PtnSkeleton(const PtnSkeleton& other);
@@ -175,10 +175,10 @@ public:
class PtnElem : public UMemory {
public:
UnicodeString basePattern;
- LocalPointer<PtnSkeleton> skeleton;
+ LocalPointer<PtnSkeleton> skeleton;
UnicodeString pattern;
UBool skeletonWasSpecified; // if specified in availableFormats, not derived
- LocalPointer<PtnElem> next;
+ LocalPointer<PtnElem> next;
PtnElem(const UnicodeString &basePattern, const UnicodeString &pattern);
virtual ~PtnElem();
@@ -187,13 +187,13 @@ public:
class FormatParser : public UMemory {
public:
UnicodeString items[MAX_DT_TOKEN];
- int32_t itemNumber;
+ int32_t itemNumber;
FormatParser();
virtual ~FormatParser();
void set(const UnicodeString& patternString);
void getQuoteLiteral(UnicodeString& quote, int32_t *itemIndex);
- UBool isPatternSeparator(const UnicodeString& field) const;
+ UBool isPatternSeparator(const UnicodeString& field) const;
static UBool isQuoteLiteral(const UnicodeString& s);
static int32_t getCanonicalIndex(const UnicodeString& s) { return getCanonicalIndex(s, TRUE); }
static int32_t getCanonicalIndex(const UnicodeString& s, UBool strict);
@@ -204,7 +204,7 @@ private:
ADD_TOKEN,
SYNTAX_ERROR,
DONE
- } TokenStatus;
+ } TokenStatus;
TokenStatus status;
virtual TokenStatus setTokens(const UnicodeString& pattern, int32_t startPos, int32_t *len);
@@ -218,7 +218,7 @@ public:
DistanceInfo() {}
virtual ~DistanceInfo();
void clear() { missingFieldMask = extraFieldMask = 0; }
- void setTo(const DistanceInfo& other);
+ void setTo(const DistanceInfo& other);
void addMissing(int32_t field) { missingFieldMask |= (1<<field); }
void addExtra(int32_t field) { extraFieldMask |= (1<<field); }
};
@@ -235,12 +235,12 @@ public:
void copyFrom();
PtnSkeleton* getSkeletonPtr();
UBool equals(const DateTimeMatcher* other) const;
- int32_t getDistance(const DateTimeMatcher& other, int32_t includeMask, DistanceInfo& distanceInfo) const;
+ int32_t getDistance(const DateTimeMatcher& other, int32_t includeMask, DistanceInfo& distanceInfo) const;
DateTimeMatcher();
DateTimeMatcher(const DateTimeMatcher& other);
- DateTimeMatcher& operator=(const DateTimeMatcher& other);
+ DateTimeMatcher& operator=(const DateTimeMatcher& other);
virtual ~DateTimeMatcher();
- int32_t getFieldMask() const;
+ int32_t getFieldMask() const;
};
class PatternMap : public UMemory {
@@ -249,34 +249,34 @@ public:
PatternMap();
virtual ~PatternMap();
void add(const UnicodeString& basePattern, const PtnSkeleton& skeleton, const UnicodeString& value, UBool skeletonWasSpecified, UErrorCode& status);
- const UnicodeString* getPatternFromBasePattern(const UnicodeString& basePattern, UBool& skeletonWasSpecified) const;
- const UnicodeString* getPatternFromSkeleton(const PtnSkeleton& skeleton, const PtnSkeleton** specifiedSkeletonPtr = 0) const;
+ const UnicodeString* getPatternFromBasePattern(const UnicodeString& basePattern, UBool& skeletonWasSpecified) const;
+ const UnicodeString* getPatternFromSkeleton(const PtnSkeleton& skeleton, const PtnSkeleton** specifiedSkeletonPtr = 0) const;
void copyFrom(const PatternMap& other, UErrorCode& status);
- PtnElem* getHeader(UChar baseChar) const;
- UBool equals(const PatternMap& other) const;
+ PtnElem* getHeader(UChar baseChar) const;
+ UBool equals(const PatternMap& other) const;
private:
UBool isDupAllowed;
- PtnElem* getDuplicateElem(const UnicodeString& basePattern, const PtnSkeleton& skeleton, PtnElem *baseElem);
+ PtnElem* getDuplicateElem(const UnicodeString& basePattern, const PtnSkeleton& skeleton, PtnElem *baseElem);
}; // end PatternMap
class PatternMapIterator : public UMemory {
public:
- PatternMapIterator(UErrorCode &status);
+ PatternMapIterator(UErrorCode &status);
virtual ~PatternMapIterator();
void set(PatternMap& patternMap);
- PtnSkeleton* getSkeleton() const;
- UBool hasNext() const;
+ PtnSkeleton* getSkeleton() const;
+ UBool hasNext() const;
DateTimeMatcher& next();
private:
int32_t bootIndex;
PtnElem *nodePtr;
- LocalPointer<DateTimeMatcher> matcher;
+ LocalPointer<DateTimeMatcher> matcher;
PatternMap *patternMap;
};
class DTSkeletonEnumeration : public StringEnumeration {
public:
- DTSkeletonEnumeration(PatternMap& patternMap, dtStrEnum type, UErrorCode& status);
+ DTSkeletonEnumeration(PatternMap& patternMap, dtStrEnum type, UErrorCode& status);
virtual ~DTSkeletonEnumeration();
static UClassID U_EXPORT2 getStaticClassID(void);
virtual UClassID getDynamicClassID(void) const;
@@ -286,7 +286,7 @@ public:
private:
int32_t pos;
UBool isCanonicalItem(const UnicodeString& item);
- LocalPointer<UVector> fSkeletons;
+ LocalPointer<UVector> fSkeletons;
};
class DTRedundantEnumeration : public StringEnumeration {
@@ -301,8 +301,8 @@ public:
void add(const UnicodeString &pattern, UErrorCode& status);
private:
int32_t pos;
- UBool isCanonicalItem(const UnicodeString& item) const;
- LocalPointer<UVector> fPatterns;
+ UBool isCanonicalItem(const UnicodeString& item) const;
+ LocalPointer<UVector> fPatterns;
};
U_NAMESPACE_END
diff --git a/contrib/libs/icu/i18n/dtrule.cpp b/contrib/libs/icu/i18n/dtrule.cpp
index d66fe744d6..6847f1d16e 100644
--- a/contrib/libs/icu/i18n/dtrule.cpp
+++ b/contrib/libs/icu/i18n/dtrule.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/erarules.cpp b/contrib/libs/icu/i18n/erarules.cpp
index 9f23925958..e375740bd6 100644
--- a/contrib/libs/icu/i18n/erarules.cpp
+++ b/contrib/libs/icu/i18n/erarules.cpp
@@ -1,326 +1,326 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include <utility>
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include <stdlib.h>
-#include "unicode/ucal.h"
-#include "unicode/ures.h"
-#include "unicode/ustring.h"
-#include "unicode/timezone.h"
-#include "cmemory.h"
-#include "cstring.h"
-#include "erarules.h"
-#include "gregoimp.h"
-#include "uassert.h"
-
-U_NAMESPACE_BEGIN
-
-static const int32_t MAX_ENCODED_START_YEAR = 32767;
-static const int32_t MIN_ENCODED_START_YEAR = -32768;
-static const int32_t MIN_ENCODED_START = -2147483391; // encodeDate(MIN_ENCODED_START_YEAR, 1, 1, ...);
-
-static const int32_t YEAR_MASK = 0xFFFF0000;
-static const int32_t MONTH_MASK = 0x0000FF00;
-static const int32_t DAY_MASK = 0x000000FF;
-
-static const int32_t MAX_INT32 = 0x7FFFFFFF;
-static const int32_t MIN_INT32 = 0xFFFFFFFF;
-
-static const UChar VAL_FALSE[] = {0x66, 0x61, 0x6c, 0x73, 0x65}; // "false"
-static const UChar VAL_FALSE_LEN = 5;
-
-static UBool isSet(int startDate) {
- return startDate != 0;
-}
-
-static UBool isValidRuleStartDate(int32_t year, int32_t month, int32_t day) {
- return year >= MIN_ENCODED_START_YEAR && year <= MAX_ENCODED_START_YEAR
- && month >= 1 && month <= 12 && day >=1 && day <= 31;
-}
-
-/**
- * Encode year/month/date to a single integer.
- * year is high 16 bits (-32768 to 32767), month is
- * next 8 bits and day of month is last 8 bits.
- *
- * @param year year
- * @param month month (1-base)
- * @param day day of month
- * @return an encoded date.
- */
-static int32_t encodeDate(int32_t year, int32_t month, int32_t day) {
- return year << 16 | month << 8 | day;
-}
-
-static void decodeDate(int32_t encodedDate, int32_t (&fields)[3]) {
- if (encodedDate == MIN_ENCODED_START) {
- fields[0] = MIN_INT32;
- fields[1] = 1;
- fields[2] = 1;
- } else {
- fields[0] = (encodedDate & YEAR_MASK) >> 16;
- fields[1] = (encodedDate & MONTH_MASK) >> 8;
- fields[2] = encodedDate & DAY_MASK;
- }
-}
-
-/**
- * Compare an encoded date with another date specified by year/month/day.
- * @param encoded An encoded date
- * @param year Year of another date
- * @param month Month of another date
- * @param day Day of another date
- * @return -1 when encoded date is earlier, 0 when two dates are same,
- * and 1 when encoded date is later.
- */
-static int32_t compareEncodedDateWithYMD(int encoded, int year, int month, int day) {
- if (year < MIN_ENCODED_START_YEAR) {
- if (encoded == MIN_ENCODED_START) {
- if (year > MIN_INT32 || month > 1 || day > 1) {
- return -1;
- }
- return 0;
- } else {
- return 1;
- }
- } else if (year > MAX_ENCODED_START_YEAR) {
- return -1;
- } else {
- int tmp = encodeDate(year, month, day);
- if (encoded < tmp) {
- return -1;
- } else if (encoded == tmp) {
- return 0;
- } else {
- return 1;
- }
- }
-}
-
-EraRules::EraRules(LocalMemory<int32_t>& eraStartDates, int32_t numEras)
- : numEras(numEras) {
- startDates = std::move(eraStartDates);
- initCurrentEra();
-}
-
-EraRules::~EraRules() {
-}
-
-EraRules* EraRules::createInstance(const char *calType, UBool includeTentativeEra, UErrorCode& status) {
- if(U_FAILURE(status)) {
- return nullptr;
- }
- LocalUResourceBundlePointer rb(ures_openDirect(nullptr, "supplementalData", &status));
- ures_getByKey(rb.getAlias(), "calendarData", rb.getAlias(), &status);
- ures_getByKey(rb.getAlias(), calType, rb.getAlias(), &status);
- ures_getByKey(rb.getAlias(), "eras", rb.getAlias(), &status);
-
- if (U_FAILURE(status)) {
- return nullptr;
- }
-
- int32_t numEras = ures_getSize(rb.getAlias());
- int32_t firstTentativeIdx = MAX_INT32;
-
- LocalMemory<int32_t> startDates(static_cast<int32_t *>(uprv_malloc(numEras * sizeof(int32_t))));
- if (startDates.isNull()) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
- uprv_memset(startDates.getAlias(), 0 , numEras * sizeof(int32_t));
-
- while (ures_hasNext(rb.getAlias())) {
- LocalUResourceBundlePointer eraRuleRes(ures_getNextResource(rb.getAlias(), nullptr, &status));
- if (U_FAILURE(status)) {
- return nullptr;
- }
- const char *eraIdxStr = ures_getKey(eraRuleRes.getAlias());
- char *endp;
- int32_t eraIdx = (int32_t)strtol(eraIdxStr, &endp, 10);
- if ((size_t)(endp - eraIdxStr) != uprv_strlen(eraIdxStr)) {
- status = U_INVALID_FORMAT_ERROR;
- return nullptr;
- }
- if (eraIdx < 0 || eraIdx >= numEras) {
- status = U_INVALID_FORMAT_ERROR;
- return nullptr;
- }
- if (isSet(startDates[eraIdx])) {
- // start date of the index was already set
- status = U_INVALID_FORMAT_ERROR;
- return nullptr;
- }
-
- UBool hasName = TRUE;
- UBool hasEnd = TRUE;
- int32_t len;
- while (ures_hasNext(eraRuleRes.getAlias())) {
- LocalUResourceBundlePointer res(ures_getNextResource(eraRuleRes.getAlias(), nullptr, &status));
- if (U_FAILURE(status)) {
- return nullptr;
- }
- const char *key = ures_getKey(res.getAlias());
- if (uprv_strcmp(key, "start") == 0) {
- const int32_t *fields = ures_getIntVector(res.getAlias(), &len, &status);
- if (U_FAILURE(status)) {
- return nullptr;
- }
- if (len != 3 || !isValidRuleStartDate(fields[0], fields[1], fields[2])) {
- status = U_INVALID_FORMAT_ERROR;
- return nullptr;
- }
- startDates[eraIdx] = encodeDate(fields[0], fields[1], fields[2]);
- } else if (uprv_strcmp(key, "named") == 0) {
- const UChar *val = ures_getString(res.getAlias(), &len, &status);
- if (u_strncmp(val, VAL_FALSE, VAL_FALSE_LEN) == 0) {
- hasName = FALSE;
- }
- } else if (uprv_strcmp(key, "end") == 0) {
- hasEnd = TRUE;
- }
- }
-
- if (isSet(startDates[eraIdx])) {
- if (hasEnd) {
- // This implementation assumes either start or end is available, not both.
- // For now, just ignore the end rule.
- }
- } else {
- if (hasEnd) {
- if (eraIdx != 0) {
- // This implementation does not support end only rule for eras other than
- // the first one.
- status = U_INVALID_FORMAT_ERROR;
- return nullptr;
- }
- U_ASSERT(eraIdx == 0);
- startDates[eraIdx] = MIN_ENCODED_START;
- } else {
- status = U_INVALID_FORMAT_ERROR;
- return nullptr;
- }
- }
-
- if (hasName) {
- if (eraIdx >= firstTentativeIdx) {
- status = U_INVALID_FORMAT_ERROR;
- return nullptr;
- }
- } else {
- if (eraIdx < firstTentativeIdx) {
- firstTentativeIdx = eraIdx;
- }
- }
- }
-
- EraRules *result;
- if (firstTentativeIdx < MAX_INT32 && !includeTentativeEra) {
- result = new EraRules(startDates, firstTentativeIdx);
- } else {
- result = new EraRules(startDates, numEras);
- }
-
- if (result == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
- return result;
-}
-
-void EraRules::getStartDate(int32_t eraIdx, int32_t (&fields)[3], UErrorCode& status) const {
- if(U_FAILURE(status)) {
- return;
- }
- if (eraIdx < 0 || eraIdx >= numEras) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- decodeDate(startDates[eraIdx], fields);
-}
-
-int32_t EraRules::getStartYear(int32_t eraIdx, UErrorCode& status) const {
- int year = MAX_INT32; // bogus value
- if(U_FAILURE(status)) {
- return year;
- }
- if (eraIdx < 0 || eraIdx >= numEras) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return year;
- }
- int fields[3];
- decodeDate(startDates[eraIdx], fields);
- year = fields[0];
-
- return year;
-}
-
-int32_t EraRules::getEraIndex(int32_t year, int32_t month, int32_t day, UErrorCode& status) const {
- if(U_FAILURE(status)) {
- return -1;
- }
-
- if (month < 1 || month > 12 || day < 1 || day > 31) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return -1;
- }
- int32_t high = numEras; // last index + 1
- int32_t low;
-
- // Short circuit for recent years. Most modern computations will
- // occur in the last few eras.
- if (compareEncodedDateWithYMD(startDates[getCurrentEraIndex()], year, month, day) <= 0) {
- low = getCurrentEraIndex();
- } else {
- low = 0;
- }
-
- // Do binary search
- while (low < high - 1) {
- int i = (low + high) / 2;
- if (compareEncodedDateWithYMD(startDates[i], year, month, day) <= 0) {
- low = i;
- } else {
- high = i;
- }
- }
- return low;
-}
-
-void EraRules::initCurrentEra() {
- // Compute local wall time in millis using ICU's default time zone.
- UErrorCode ec = U_ZERO_ERROR;
- UDate localMillis = ucal_getNow();
-
- int32_t rawOffset, dstOffset;
- TimeZone* zone = TimeZone::createDefault();
- // If we failed to create the default time zone, we are in a bad state and don't
- // really have many options. Carry on using UTC millis as a fallback.
- if (zone != nullptr) {
- zone->getOffset(localMillis, FALSE, rawOffset, dstOffset, ec);
- delete zone;
- localMillis += (rawOffset + dstOffset);
- }
-
- int year, month0, dom, dow, doy, mid;
- Grego::timeToFields(localMillis, year, month0, dom, dow, doy, mid);
- int currentEncodedDate = encodeDate(year, month0 + 1 /* changes to 1-base */, dom);
- int eraIdx = numEras - 1;
- while (eraIdx > 0) {
- if (currentEncodedDate >= startDates[eraIdx]) {
- break;
- }
- eraIdx--;
- }
- // Note: current era could be before the first era.
- // In this case, this implementation returns the first era index (0).
- currentEra = eraIdx;
-}
-
-U_NAMESPACE_END
-#endif /* #if !UCONFIG_NO_FORMATTING */
-
-
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include <utility>
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include <stdlib.h>
+#include "unicode/ucal.h"
+#include "unicode/ures.h"
+#include "unicode/ustring.h"
+#include "unicode/timezone.h"
+#include "cmemory.h"
+#include "cstring.h"
+#include "erarules.h"
+#include "gregoimp.h"
+#include "uassert.h"
+
+U_NAMESPACE_BEGIN
+
+static const int32_t MAX_ENCODED_START_YEAR = 32767;
+static const int32_t MIN_ENCODED_START_YEAR = -32768;
+static const int32_t MIN_ENCODED_START = -2147483391; // encodeDate(MIN_ENCODED_START_YEAR, 1, 1, ...);
+
+static const int32_t YEAR_MASK = 0xFFFF0000;
+static const int32_t MONTH_MASK = 0x0000FF00;
+static const int32_t DAY_MASK = 0x000000FF;
+
+static const int32_t MAX_INT32 = 0x7FFFFFFF;
+static const int32_t MIN_INT32 = 0xFFFFFFFF;
+
+static const UChar VAL_FALSE[] = {0x66, 0x61, 0x6c, 0x73, 0x65}; // "false"
+static const UChar VAL_FALSE_LEN = 5;
+
+static UBool isSet(int startDate) {
+ return startDate != 0;
+}
+
+static UBool isValidRuleStartDate(int32_t year, int32_t month, int32_t day) {
+ return year >= MIN_ENCODED_START_YEAR && year <= MAX_ENCODED_START_YEAR
+ && month >= 1 && month <= 12 && day >=1 && day <= 31;
+}
+
+/**
+ * Encode year/month/date to a single integer.
+ * year is high 16 bits (-32768 to 32767), month is
+ * next 8 bits and day of month is last 8 bits.
+ *
+ * @param year year
+ * @param month month (1-base)
+ * @param day day of month
+ * @return an encoded date.
+ */
+static int32_t encodeDate(int32_t year, int32_t month, int32_t day) {
+ return year << 16 | month << 8 | day;
+}
+
+static void decodeDate(int32_t encodedDate, int32_t (&fields)[3]) {
+ if (encodedDate == MIN_ENCODED_START) {
+ fields[0] = MIN_INT32;
+ fields[1] = 1;
+ fields[2] = 1;
+ } else {
+ fields[0] = (encodedDate & YEAR_MASK) >> 16;
+ fields[1] = (encodedDate & MONTH_MASK) >> 8;
+ fields[2] = encodedDate & DAY_MASK;
+ }
+}
+
+/**
+ * Compare an encoded date with another date specified by year/month/day.
+ * @param encoded An encoded date
+ * @param year Year of another date
+ * @param month Month of another date
+ * @param day Day of another date
+ * @return -1 when encoded date is earlier, 0 when two dates are same,
+ * and 1 when encoded date is later.
+ */
+static int32_t compareEncodedDateWithYMD(int encoded, int year, int month, int day) {
+ if (year < MIN_ENCODED_START_YEAR) {
+ if (encoded == MIN_ENCODED_START) {
+ if (year > MIN_INT32 || month > 1 || day > 1) {
+ return -1;
+ }
+ return 0;
+ } else {
+ return 1;
+ }
+ } else if (year > MAX_ENCODED_START_YEAR) {
+ return -1;
+ } else {
+ int tmp = encodeDate(year, month, day);
+ if (encoded < tmp) {
+ return -1;
+ } else if (encoded == tmp) {
+ return 0;
+ } else {
+ return 1;
+ }
+ }
+}
+
+EraRules::EraRules(LocalMemory<int32_t>& eraStartDates, int32_t numEras)
+ : numEras(numEras) {
+ startDates = std::move(eraStartDates);
+ initCurrentEra();
+}
+
+EraRules::~EraRules() {
+}
+
+EraRules* EraRules::createInstance(const char *calType, UBool includeTentativeEra, UErrorCode& status) {
+ if(U_FAILURE(status)) {
+ return nullptr;
+ }
+ LocalUResourceBundlePointer rb(ures_openDirect(nullptr, "supplementalData", &status));
+ ures_getByKey(rb.getAlias(), "calendarData", rb.getAlias(), &status);
+ ures_getByKey(rb.getAlias(), calType, rb.getAlias(), &status);
+ ures_getByKey(rb.getAlias(), "eras", rb.getAlias(), &status);
+
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+
+ int32_t numEras = ures_getSize(rb.getAlias());
+ int32_t firstTentativeIdx = MAX_INT32;
+
+ LocalMemory<int32_t> startDates(static_cast<int32_t *>(uprv_malloc(numEras * sizeof(int32_t))));
+ if (startDates.isNull()) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+ uprv_memset(startDates.getAlias(), 0 , numEras * sizeof(int32_t));
+
+ while (ures_hasNext(rb.getAlias())) {
+ LocalUResourceBundlePointer eraRuleRes(ures_getNextResource(rb.getAlias(), nullptr, &status));
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ const char *eraIdxStr = ures_getKey(eraRuleRes.getAlias());
+ char *endp;
+ int32_t eraIdx = (int32_t)strtol(eraIdxStr, &endp, 10);
+ if ((size_t)(endp - eraIdxStr) != uprv_strlen(eraIdxStr)) {
+ status = U_INVALID_FORMAT_ERROR;
+ return nullptr;
+ }
+ if (eraIdx < 0 || eraIdx >= numEras) {
+ status = U_INVALID_FORMAT_ERROR;
+ return nullptr;
+ }
+ if (isSet(startDates[eraIdx])) {
+ // start date of the index was already set
+ status = U_INVALID_FORMAT_ERROR;
+ return nullptr;
+ }
+
+ UBool hasName = TRUE;
+ UBool hasEnd = TRUE;
+ int32_t len;
+ while (ures_hasNext(eraRuleRes.getAlias())) {
+ LocalUResourceBundlePointer res(ures_getNextResource(eraRuleRes.getAlias(), nullptr, &status));
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ const char *key = ures_getKey(res.getAlias());
+ if (uprv_strcmp(key, "start") == 0) {
+ const int32_t *fields = ures_getIntVector(res.getAlias(), &len, &status);
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ if (len != 3 || !isValidRuleStartDate(fields[0], fields[1], fields[2])) {
+ status = U_INVALID_FORMAT_ERROR;
+ return nullptr;
+ }
+ startDates[eraIdx] = encodeDate(fields[0], fields[1], fields[2]);
+ } else if (uprv_strcmp(key, "named") == 0) {
+ const UChar *val = ures_getString(res.getAlias(), &len, &status);
+ if (u_strncmp(val, VAL_FALSE, VAL_FALSE_LEN) == 0) {
+ hasName = FALSE;
+ }
+ } else if (uprv_strcmp(key, "end") == 0) {
+ hasEnd = TRUE;
+ }
+ }
+
+ if (isSet(startDates[eraIdx])) {
+ if (hasEnd) {
+ // This implementation assumes either start or end is available, not both.
+ // For now, just ignore the end rule.
+ }
+ } else {
+ if (hasEnd) {
+ if (eraIdx != 0) {
+ // This implementation does not support end only rule for eras other than
+ // the first one.
+ status = U_INVALID_FORMAT_ERROR;
+ return nullptr;
+ }
+ U_ASSERT(eraIdx == 0);
+ startDates[eraIdx] = MIN_ENCODED_START;
+ } else {
+ status = U_INVALID_FORMAT_ERROR;
+ return nullptr;
+ }
+ }
+
+ if (hasName) {
+ if (eraIdx >= firstTentativeIdx) {
+ status = U_INVALID_FORMAT_ERROR;
+ return nullptr;
+ }
+ } else {
+ if (eraIdx < firstTentativeIdx) {
+ firstTentativeIdx = eraIdx;
+ }
+ }
+ }
+
+ EraRules *result;
+ if (firstTentativeIdx < MAX_INT32 && !includeTentativeEra) {
+ result = new EraRules(startDates, firstTentativeIdx);
+ } else {
+ result = new EraRules(startDates, numEras);
+ }
+
+ if (result == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
+ return result;
+}
+
+void EraRules::getStartDate(int32_t eraIdx, int32_t (&fields)[3], UErrorCode& status) const {
+ if(U_FAILURE(status)) {
+ return;
+ }
+ if (eraIdx < 0 || eraIdx >= numEras) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ decodeDate(startDates[eraIdx], fields);
+}
+
+int32_t EraRules::getStartYear(int32_t eraIdx, UErrorCode& status) const {
+ int year = MAX_INT32; // bogus value
+ if(U_FAILURE(status)) {
+ return year;
+ }
+ if (eraIdx < 0 || eraIdx >= numEras) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return year;
+ }
+ int fields[3];
+ decodeDate(startDates[eraIdx], fields);
+ year = fields[0];
+
+ return year;
+}
+
+int32_t EraRules::getEraIndex(int32_t year, int32_t month, int32_t day, UErrorCode& status) const {
+ if(U_FAILURE(status)) {
+ return -1;
+ }
+
+ if (month < 1 || month > 12 || day < 1 || day > 31) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return -1;
+ }
+ int32_t high = numEras; // last index + 1
+ int32_t low;
+
+ // Short circuit for recent years. Most modern computations will
+ // occur in the last few eras.
+ if (compareEncodedDateWithYMD(startDates[getCurrentEraIndex()], year, month, day) <= 0) {
+ low = getCurrentEraIndex();
+ } else {
+ low = 0;
+ }
+
+ // Do binary search
+ while (low < high - 1) {
+ int i = (low + high) / 2;
+ if (compareEncodedDateWithYMD(startDates[i], year, month, day) <= 0) {
+ low = i;
+ } else {
+ high = i;
+ }
+ }
+ return low;
+}
+
+void EraRules::initCurrentEra() {
+ // Compute local wall time in millis using ICU's default time zone.
+ UErrorCode ec = U_ZERO_ERROR;
+ UDate localMillis = ucal_getNow();
+
+ int32_t rawOffset, dstOffset;
+ TimeZone* zone = TimeZone::createDefault();
+ // If we failed to create the default time zone, we are in a bad state and don't
+ // really have many options. Carry on using UTC millis as a fallback.
+ if (zone != nullptr) {
+ zone->getOffset(localMillis, FALSE, rawOffset, dstOffset, ec);
+ delete zone;
+ localMillis += (rawOffset + dstOffset);
+ }
+
+ int year, month0, dom, dow, doy, mid;
+ Grego::timeToFields(localMillis, year, month0, dom, dow, doy, mid);
+ int currentEncodedDate = encodeDate(year, month0 + 1 /* changes to 1-base */, dom);
+ int eraIdx = numEras - 1;
+ while (eraIdx > 0) {
+ if (currentEncodedDate >= startDates[eraIdx]) {
+ break;
+ }
+ eraIdx--;
+ }
+ // Note: current era could be before the first era.
+ // In this case, this implementation returns the first era index (0).
+ currentEra = eraIdx;
+}
+
+U_NAMESPACE_END
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+
diff --git a/contrib/libs/icu/i18n/erarules.h b/contrib/libs/icu/i18n/erarules.h
index 9baec63225..74b7862da4 100644
--- a/contrib/libs/icu/i18n/erarules.h
+++ b/contrib/libs/icu/i18n/erarules.h
@@ -1,99 +1,99 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#ifndef ERARULES_H_
-#define ERARULES_H_
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/localpointer.h"
-#include "unicode/uobject.h"
-#include "cmemory.h"
-
-U_NAMESPACE_BEGIN
-
-// Export an explicit template instantiation of LocalMemory used as a data member of EraRules.
-// When building DLLs for Windows this is required even though no direct access leaks out of the i18n library.
-// See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.
-#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
-#if defined(_MSC_VER)
-// Ignore warning 4661 as LocalPointerBase does not use operator== or operator!=
-#pragma warning(push)
-#pragma warning(disable: 4661)
-#endif
-template class U_I18N_API LocalPointerBase<int32_t>;
-template class U_I18N_API LocalMemory<int32_t>;
-#if defined(_MSC_VER)
-#pragma warning(pop)
-#endif
-#endif
-
-class U_I18N_API EraRules : public UMemory {
-public:
- ~EraRules();
-
- static EraRules* createInstance(const char *calType, UBool includeTentativeEra, UErrorCode& status);
-
- /**
- * Gets number of effective eras
- * @return number of effective eras
- */
- inline int32_t getNumberOfEras() const {
- return numEras;
- }
-
- /**
- * Gets start date of an era
- * @param eraIdx Era index
- * @param fields Receives date fields. The result includes values of year, month,
- * day of month in this order. When an era has no start date, the result
- * will be January 1st in year whose value is minimum integer.
- * @param status Receives status.
- */
- void getStartDate(int32_t eraIdx, int32_t (&fields)[3], UErrorCode& status) const;
-
- /**
- * Gets start year of an era
- * @param eraIdx Era index
- * @param status Receives status.
- * @return The first year of an era. When a era has no start date, minimum int32
- * value is returned.
- */
- int32_t getStartYear(int32_t eraIdx, UErrorCode& status) const;
-
- /**
- * Returns era index for the specified year/month/day.
- * @param year Year
- * @param month Month (1-base)
- * @param day Day of month
- * @param status Receives status
- * @return era index (or 0, when the specified date is before the first era)
- */
- int32_t getEraIndex(int32_t year, int32_t month, int32_t day, UErrorCode& status) const;
-
- /**
- * Gets the current era index. This is calculated only once for an instance of
- * EraRules. The current era calculation is based on the default time zone at
- * the time of instantiation.
- *
- * @return era index of current era (or 0, when current date is before the first era)
- */
- inline int32_t getCurrentEraIndex() const {
- return currentEra;
- }
-
-private:
- EraRules(LocalMemory<int32_t>& eraStartDates, int32_t numEra);
-
- void initCurrentEra();
-
- LocalMemory<int32_t> startDates;
- int32_t numEras;
- int32_t currentEra;
-};
-
-U_NAMESPACE_END
-#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* ERARULES_H_ */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#ifndef ERARULES_H_
+#define ERARULES_H_
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/localpointer.h"
+#include "unicode/uobject.h"
+#include "cmemory.h"
+
+U_NAMESPACE_BEGIN
+
+// Export an explicit template instantiation of LocalMemory used as a data member of EraRules.
+// When building DLLs for Windows this is required even though no direct access leaks out of the i18n library.
+// See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.
+#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
+#if defined(_MSC_VER)
+// Ignore warning 4661 as LocalPointerBase does not use operator== or operator!=
+#pragma warning(push)
+#pragma warning(disable: 4661)
+#endif
+template class U_I18N_API LocalPointerBase<int32_t>;
+template class U_I18N_API LocalMemory<int32_t>;
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+#endif
+
+class U_I18N_API EraRules : public UMemory {
+public:
+ ~EraRules();
+
+ static EraRules* createInstance(const char *calType, UBool includeTentativeEra, UErrorCode& status);
+
+ /**
+ * Gets number of effective eras
+ * @return number of effective eras
+ */
+ inline int32_t getNumberOfEras() const {
+ return numEras;
+ }
+
+ /**
+ * Gets start date of an era
+ * @param eraIdx Era index
+ * @param fields Receives date fields. The result includes values of year, month,
+ * day of month in this order. When an era has no start date, the result
+ * will be January 1st in year whose value is minimum integer.
+ * @param status Receives status.
+ */
+ void getStartDate(int32_t eraIdx, int32_t (&fields)[3], UErrorCode& status) const;
+
+ /**
+ * Gets start year of an era
+ * @param eraIdx Era index
+ * @param status Receives status.
+ * @return The first year of an era. When a era has no start date, minimum int32
+ * value is returned.
+ */
+ int32_t getStartYear(int32_t eraIdx, UErrorCode& status) const;
+
+ /**
+ * Returns era index for the specified year/month/day.
+ * @param year Year
+ * @param month Month (1-base)
+ * @param day Day of month
+ * @param status Receives status
+ * @return era index (or 0, when the specified date is before the first era)
+ */
+ int32_t getEraIndex(int32_t year, int32_t month, int32_t day, UErrorCode& status) const;
+
+ /**
+ * Gets the current era index. This is calculated only once for an instance of
+ * EraRules. The current era calculation is based on the default time zone at
+ * the time of instantiation.
+ *
+ * @return era index of current era (or 0, when current date is before the first era)
+ */
+ inline int32_t getCurrentEraIndex() const {
+ return currentEra;
+ }
+
+private:
+ EraRules(LocalMemory<int32_t>& eraStartDates, int32_t numEra);
+
+ void initCurrentEra();
+
+ LocalMemory<int32_t> startDates;
+ int32_t numEras;
+ int32_t currentEra;
+};
+
+U_NAMESPACE_END
+#endif /* #if !UCONFIG_NO_FORMATTING */
+#endif /* ERARULES_H_ */
diff --git a/contrib/libs/icu/i18n/esctrn.cpp b/contrib/libs/icu/i18n/esctrn.cpp
index dd947dfcb9..ba0e4c2c7b 100644
--- a/contrib/libs/icu/i18n/esctrn.cpp
+++ b/contrib/libs/icu/i18n/esctrn.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -122,7 +122,7 @@ EscapeTransliterator::~EscapeTransliterator() {
/**
* Transliterator API.
*/
-EscapeTransliterator* EscapeTransliterator::clone() const {
+EscapeTransliterator* EscapeTransliterator::clone() const {
return new EscapeTransliterator(*this);
}
diff --git a/contrib/libs/icu/i18n/esctrn.h b/contrib/libs/icu/i18n/esctrn.h
index 93a62bcc4e..2a2c6dcfe9 100644
--- a/contrib/libs/icu/i18n/esctrn.h
+++ b/contrib/libs/icu/i18n/esctrn.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -115,7 +115,7 @@ class EscapeTransliterator : public Transliterator {
/**
* Transliterator API.
*/
- virtual EscapeTransliterator* clone() const;
+ virtual EscapeTransliterator* clone() const;
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
diff --git a/contrib/libs/icu/i18n/ethpccal.cpp b/contrib/libs/icu/i18n/ethpccal.cpp
index 51583db1b2..7c7c0ba37b 100644
--- a/contrib/libs/icu/i18n/ethpccal.cpp
+++ b/contrib/libs/icu/i18n/ethpccal.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -46,7 +46,7 @@ EthiopicCalendar::~EthiopicCalendar()
{
}
-EthiopicCalendar*
+EthiopicCalendar*
EthiopicCalendar::clone() const
{
return new EthiopicCalendar(*this);
diff --git a/contrib/libs/icu/i18n/ethpccal.h b/contrib/libs/icu/i18n/ethpccal.h
index 1c82c6766a..d1e8f424b5 100644
--- a/contrib/libs/icu/i18n/ethpccal.h
+++ b/contrib/libs/icu/i18n/ethpccal.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -141,7 +141,7 @@ public:
* @return return a polymorphic copy of this calendar.
* @internal
*/
- virtual EthiopicCalendar* clone() const;
+ virtual EthiopicCalendar* clone() const;
/**
* return the calendar type, "ethiopic"
diff --git a/contrib/libs/icu/i18n/fmtable.cpp b/contrib/libs/icu/i18n/fmtable.cpp
index 28a75530cc..dbfd3c26ba 100644
--- a/contrib/libs/icu/i18n/fmtable.cpp
+++ b/contrib/libs/icu/i18n/fmtable.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -19,7 +19,7 @@
#if !UCONFIG_NO_FORMATTING
-#include <cstdlib>
+#include <cstdlib>
#include <math.h>
#include "unicode/fmtable.h"
#include "unicode/ustring.h"
@@ -30,7 +30,7 @@
#include "cmemory.h"
#include "cstring.h"
#include "fmtableimp.h"
-#include "number_decimalquantity.h"
+#include "number_decimalquantity.h"
// *****************************************************************************
// class Formattable
@@ -40,9 +40,9 @@ U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Formattable)
-using number::impl::DecimalQuantity;
+using number::impl::DecimalQuantity;
+
-
//-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
// NOTE: As of 3.0, there are limitations to the UObject API. It does
@@ -105,7 +105,7 @@ void Formattable::init() {
fValue.fInt64 = 0;
fType = kLong;
fDecimalStr = NULL;
- fDecimalQuantity = NULL;
+ fDecimalQuantity = NULL;
fBogus.setToBogus();
}
@@ -259,8 +259,8 @@ Formattable::operator=(const Formattable& source)
}
UErrorCode status = U_ZERO_ERROR;
- if (source.fDecimalQuantity != NULL) {
- fDecimalQuantity = new DecimalQuantity(*source.fDecimalQuantity);
+ if (source.fDecimalQuantity != NULL) {
+ fDecimalQuantity = new DecimalQuantity(*source.fDecimalQuantity);
}
if (source.fDecimalStr != NULL) {
fDecimalStr = new CharString(*source.fDecimalStr, status);
@@ -358,9 +358,9 @@ void Formattable::dispose()
delete fDecimalStr;
fDecimalStr = NULL;
-
- delete fDecimalQuantity;
- fDecimalQuantity = NULL;
+
+ delete fDecimalQuantity;
+ fDecimalQuantity = NULL;
}
Formattable *
@@ -462,13 +462,13 @@ Formattable::getInt64(UErrorCode& status) const
} else if (fValue.fDouble < (double)U_INT64_MIN) {
status = U_INVALID_FORMAT_ERROR;
return U_INT64_MIN;
- } else if (fabs(fValue.fDouble) > U_DOUBLE_MAX_EXACT_INT && fDecimalQuantity != NULL) {
- if (fDecimalQuantity->fitsInLong(true)) {
- return fDecimalQuantity->toLong();
+ } else if (fabs(fValue.fDouble) > U_DOUBLE_MAX_EXACT_INT && fDecimalQuantity != NULL) {
+ if (fDecimalQuantity->fitsInLong(true)) {
+ return fDecimalQuantity->toLong();
} else {
- // Unexpected
+ // Unexpected
status = U_INVALID_FORMAT_ERROR;
- return fDecimalQuantity->isNegative() ? U_INT64_MIN : U_INT64_MAX;
+ return fDecimalQuantity->isNegative() ? U_INT64_MIN : U_INT64_MAX;
}
} else {
return (int64_t)fValue.fDouble;
@@ -711,90 +711,90 @@ StringPiece Formattable::getDecimalNumber(UErrorCode &status) {
CharString *Formattable::internalGetCharString(UErrorCode &status) {
if(fDecimalStr == NULL) {
- if (fDecimalQuantity == NULL) {
+ if (fDecimalQuantity == NULL) {
// No decimal number for the formattable yet. Which means the value was
// set directly by the user as an int, int64 or double. If the value came
// from parsing, or from the user setting a decimal number, fDecimalNum
// would already be set.
//
- LocalPointer<DecimalQuantity> dq(new DecimalQuantity(), status);
- if (U_FAILURE(status)) { return nullptr; }
- populateDecimalQuantity(*dq, status);
- if (U_FAILURE(status)) { return nullptr; }
- fDecimalQuantity = dq.orphan();
+ LocalPointer<DecimalQuantity> dq(new DecimalQuantity(), status);
+ if (U_FAILURE(status)) { return nullptr; }
+ populateDecimalQuantity(*dq, status);
+ if (U_FAILURE(status)) { return nullptr; }
+ fDecimalQuantity = dq.orphan();
}
- fDecimalStr = new CharString();
+ fDecimalStr = new CharString();
if (fDecimalStr == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return NULL;
}
- // Older ICUs called uprv_decNumberToString here, which is not exactly the same as
- // DecimalQuantity::toScientificString(). The biggest difference is that uprv_decNumberToString does
- // not print scientific notation for magnitudes greater than -5 and smaller than some amount (+5?).
- if (fDecimalQuantity->isInfinite()) {
- fDecimalStr->append("Infinity", status);
- } else if (fDecimalQuantity->isNaN()) {
- fDecimalStr->append("NaN", status);
- } else if (fDecimalQuantity->isZeroish()) {
- fDecimalStr->append("0", -1, status);
- } else if (fType==kLong || fType==kInt64 || // use toPlainString for integer types
- (fDecimalQuantity->getMagnitude() != INT32_MIN && std::abs(fDecimalQuantity->getMagnitude()) < 5)) {
- fDecimalStr->appendInvariantChars(fDecimalQuantity->toPlainString(), status);
- } else {
- fDecimalStr->appendInvariantChars(fDecimalQuantity->toScientificString(), status);
- }
+ // Older ICUs called uprv_decNumberToString here, which is not exactly the same as
+ // DecimalQuantity::toScientificString(). The biggest difference is that uprv_decNumberToString does
+ // not print scientific notation for magnitudes greater than -5 and smaller than some amount (+5?).
+ if (fDecimalQuantity->isInfinite()) {
+ fDecimalStr->append("Infinity", status);
+ } else if (fDecimalQuantity->isNaN()) {
+ fDecimalStr->append("NaN", status);
+ } else if (fDecimalQuantity->isZeroish()) {
+ fDecimalStr->append("0", -1, status);
+ } else if (fType==kLong || fType==kInt64 || // use toPlainString for integer types
+ (fDecimalQuantity->getMagnitude() != INT32_MIN && std::abs(fDecimalQuantity->getMagnitude()) < 5)) {
+ fDecimalStr->appendInvariantChars(fDecimalQuantity->toPlainString(), status);
+ } else {
+ fDecimalStr->appendInvariantChars(fDecimalQuantity->toScientificString(), status);
+ }
}
return fDecimalStr;
}
-void
-Formattable::populateDecimalQuantity(number::impl::DecimalQuantity& output, UErrorCode& status) const {
- if (fDecimalQuantity != nullptr) {
- output = *fDecimalQuantity;
- return;
- }
-
- switch (fType) {
- case kDouble:
- output.setToDouble(this->getDouble());
- output.roundToInfinity();
- break;
- case kLong:
- output.setToInt(this->getLong());
- break;
- case kInt64:
- output.setToLong(this->getInt64());
- break;
- default:
- // The formattable's value is not a numeric type.
- status = U_INVALID_STATE_ERROR;
- }
+void
+Formattable::populateDecimalQuantity(number::impl::DecimalQuantity& output, UErrorCode& status) const {
+ if (fDecimalQuantity != nullptr) {
+ output = *fDecimalQuantity;
+ return;
+ }
+
+ switch (fType) {
+ case kDouble:
+ output.setToDouble(this->getDouble());
+ output.roundToInfinity();
+ break;
+ case kLong:
+ output.setToInt(this->getLong());
+ break;
+ case kInt64:
+ output.setToLong(this->getInt64());
+ break;
+ default:
+ // The formattable's value is not a numeric type.
+ status = U_INVALID_STATE_ERROR;
+ }
}
// ---------------------------------------
void
-Formattable::adoptDecimalQuantity(DecimalQuantity *dq) {
- if (fDecimalQuantity != NULL) {
- delete fDecimalQuantity;
- }
- fDecimalQuantity = dq;
- if (dq == NULL) { // allow adoptDigitList(NULL) to clear
- return;
- }
+Formattable::adoptDecimalQuantity(DecimalQuantity *dq) {
+ if (fDecimalQuantity != NULL) {
+ delete fDecimalQuantity;
+ }
+ fDecimalQuantity = dq;
+ if (dq == NULL) { // allow adoptDigitList(NULL) to clear
+ return;
+ }
// Set the value into the Union of simple type values.
- // Cannot use the set() functions because they would delete the fDecimalNum value.
- if (fDecimalQuantity->fitsInLong()) {
- fValue.fInt64 = fDecimalQuantity->toLong();
- if (fValue.fInt64 <= INT32_MAX && fValue.fInt64 >= INT32_MIN) {
- fType = kLong;
- } else {
- fType = kInt64;
- }
+ // Cannot use the set() functions because they would delete the fDecimalNum value.
+ if (fDecimalQuantity->fitsInLong()) {
+ fValue.fInt64 = fDecimalQuantity->toLong();
+ if (fValue.fInt64 <= INT32_MAX && fValue.fInt64 >= INT32_MIN) {
+ fType = kLong;
+ } else {
+ fType = kInt64;
+ }
} else {
fType = kDouble;
- fValue.fDouble = fDecimalQuantity->toDouble();
+ fValue.fDouble = fDecimalQuantity->toDouble();
}
}
@@ -807,12 +807,12 @@ Formattable::setDecimalNumber(StringPiece numberString, UErrorCode &status) {
}
dispose();
- auto* dq = new DecimalQuantity();
- dq->setToDecNumber(numberString, status);
- adoptDecimalQuantity(dq);
+ auto* dq = new DecimalQuantity();
+ dq->setToDecNumber(numberString, status);
+ adoptDecimalQuantity(dq);
// Note that we do not hang on to the caller's input string.
- // If we are asked for the string, we will regenerate one from fDecimalQuantity.
+ // If we are asked for the string, we will regenerate one from fDecimalQuantity.
}
#if 0
diff --git a/contrib/libs/icu/i18n/fmtable_cnv.cpp b/contrib/libs/icu/i18n/fmtable_cnv.cpp
index ff623c0dd4..9a64792779 100644
--- a/contrib/libs/icu/i18n/fmtable_cnv.cpp
+++ b/contrib/libs/icu/i18n/fmtable_cnv.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/fmtableimp.h b/contrib/libs/icu/i18n/fmtableimp.h
index 62c46d5470..2707d6ece2 100644
--- a/contrib/libs/icu/i18n/fmtableimp.h
+++ b/contrib/libs/icu/i18n/fmtableimp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -10,10 +10,10 @@
#ifndef FMTABLEIMP_H
#define FMTABLEIMP_H
-#include "number_decimalquantity.h"
+#include "number_decimalquantity.h"
+
+#if !UCONFIG_NO_FORMATTING
-#if !UCONFIG_NO_FORMATTING
-
U_NAMESPACE_BEGIN
/**
@@ -27,5 +27,5 @@ static const int64_t MAX_INT64_IN_DOUBLE = 0x001FFFFFFFFFFFFFLL;
U_NAMESPACE_END
-#endif // #if !UCONFIG_NO_FORMATTING
+#endif // #if !UCONFIG_NO_FORMATTING
#endif
diff --git a/contrib/libs/icu/i18n/format.cpp b/contrib/libs/icu/i18n/format.cpp
index 1b51055d83..e5abbe9eb0 100644
--- a/contrib/libs/icu/i18n/format.cpp
+++ b/contrib/libs/icu/i18n/format.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/formatted_string_builder.cpp b/contrib/libs/icu/i18n/formatted_string_builder.cpp
index 5d7d705b36..5aabc31cc4 100644
--- a/contrib/libs/icu/i18n/formatted_string_builder.cpp
+++ b/contrib/libs/icu/i18n/formatted_string_builder.cpp
@@ -1,442 +1,442 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "formatted_string_builder.h"
-#include "unicode/ustring.h"
-#include "unicode/utf16.h"
-#include "unicode/unum.h" // for UNumberFormatFields literals
-
-namespace {
-
-// A version of uprv_memcpy that checks for length 0.
-// By default, uprv_memcpy requires a length of at least 1.
-inline void uprv_memcpy2(void* dest, const void* src, size_t len) {
- if (len > 0) {
- uprv_memcpy(dest, src, len);
- }
-}
-
-// A version of uprv_memmove that checks for length 0.
-// By default, uprv_memmove requires a length of at least 1.
-inline void uprv_memmove2(void* dest, const void* src, size_t len) {
- if (len > 0) {
- uprv_memmove(dest, src, len);
- }
-}
-
-} // namespace
-
-
-U_NAMESPACE_BEGIN
-
-FormattedStringBuilder::FormattedStringBuilder() {
-#if U_DEBUG
- // Initializing the memory to non-zero helps catch some bugs that involve
- // reading from an improperly terminated string.
- for (int32_t i=0; i<getCapacity(); i++) {
- getCharPtr()[i] = 1;
- }
-#endif
-}
-
-FormattedStringBuilder::~FormattedStringBuilder() {
- if (fUsingHeap) {
- uprv_free(fChars.heap.ptr);
- uprv_free(fFields.heap.ptr);
- }
-}
-
-FormattedStringBuilder::FormattedStringBuilder(const FormattedStringBuilder &other) {
- *this = other;
-}
-
-FormattedStringBuilder &FormattedStringBuilder::operator=(const FormattedStringBuilder &other) {
- // Check for self-assignment
- if (this == &other) {
- return *this;
- }
-
- // Continue with deallocation and copying
- if (fUsingHeap) {
- uprv_free(fChars.heap.ptr);
- uprv_free(fFields.heap.ptr);
- fUsingHeap = false;
- }
-
- int32_t capacity = other.getCapacity();
- if (capacity > DEFAULT_CAPACITY) {
- // FIXME: uprv_malloc
- // C++ note: malloc appears in two places: here and in prepareForInsertHelper.
- auto newChars = static_cast<char16_t *> (uprv_malloc(sizeof(char16_t) * capacity));
- auto newFields = static_cast<Field *>(uprv_malloc(sizeof(Field) * capacity));
- if (newChars == nullptr || newFields == nullptr) {
- // UErrorCode is not available; fail silently.
- uprv_free(newChars);
- uprv_free(newFields);
- *this = FormattedStringBuilder(); // can't fail
- return *this;
- }
-
- fUsingHeap = true;
- fChars.heap.capacity = capacity;
- fChars.heap.ptr = newChars;
- fFields.heap.capacity = capacity;
- fFields.heap.ptr = newFields;
- }
-
- uprv_memcpy2(getCharPtr(), other.getCharPtr(), sizeof(char16_t) * capacity);
- uprv_memcpy2(getFieldPtr(), other.getFieldPtr(), sizeof(Field) * capacity);
-
- fZero = other.fZero;
- fLength = other.fLength;
- return *this;
-}
-
-int32_t FormattedStringBuilder::length() const {
- return fLength;
-}
-
-int32_t FormattedStringBuilder::codePointCount() const {
- return u_countChar32(getCharPtr() + fZero, fLength);
-}
-
-UChar32 FormattedStringBuilder::getFirstCodePoint() const {
- if (fLength == 0) {
- return -1;
- }
- UChar32 cp;
- U16_GET(getCharPtr() + fZero, 0, 0, fLength, cp);
- return cp;
-}
-
-UChar32 FormattedStringBuilder::getLastCodePoint() const {
- if (fLength == 0) {
- return -1;
- }
- int32_t offset = fLength;
- U16_BACK_1(getCharPtr() + fZero, 0, offset);
- UChar32 cp;
- U16_GET(getCharPtr() + fZero, 0, offset, fLength, cp);
- return cp;
-}
-
-UChar32 FormattedStringBuilder::codePointAt(int32_t index) const {
- UChar32 cp;
- U16_GET(getCharPtr() + fZero, 0, index, fLength, cp);
- return cp;
-}
-
-UChar32 FormattedStringBuilder::codePointBefore(int32_t index) const {
- int32_t offset = index;
- U16_BACK_1(getCharPtr() + fZero, 0, offset);
- UChar32 cp;
- U16_GET(getCharPtr() + fZero, 0, offset, fLength, cp);
- return cp;
-}
-
-FormattedStringBuilder &FormattedStringBuilder::clear() {
- // TODO: Reset the heap here?
- fZero = getCapacity() / 2;
- fLength = 0;
- return *this;
-}
-
-int32_t
-FormattedStringBuilder::insertCodePoint(int32_t index, UChar32 codePoint, Field field, UErrorCode &status) {
- int32_t count = U16_LENGTH(codePoint);
- int32_t position = prepareForInsert(index, count, status);
- if (U_FAILURE(status)) {
- return count;
- }
- if (count == 1) {
- getCharPtr()[position] = (char16_t) codePoint;
- getFieldPtr()[position] = field;
- } else {
- getCharPtr()[position] = U16_LEAD(codePoint);
- getCharPtr()[position + 1] = U16_TRAIL(codePoint);
- getFieldPtr()[position] = getFieldPtr()[position + 1] = field;
- }
- return count;
-}
-
-int32_t FormattedStringBuilder::insert(int32_t index, const UnicodeString &unistr, Field field,
- UErrorCode &status) {
- if (unistr.length() == 0) {
- // Nothing to insert.
- return 0;
- } else if (unistr.length() == 1) {
- // Fast path: insert using insertCodePoint.
- return insertCodePoint(index, unistr.charAt(0), field, status);
- } else {
- return insert(index, unistr, 0, unistr.length(), field, status);
- }
-}
-
-int32_t
-FormattedStringBuilder::insert(int32_t index, const UnicodeString &unistr, int32_t start, int32_t end,
- Field field, UErrorCode &status) {
- int32_t count = end - start;
- int32_t position = prepareForInsert(index, count, status);
- if (U_FAILURE(status)) {
- return count;
- }
- for (int32_t i = 0; i < count; i++) {
- getCharPtr()[position + i] = unistr.charAt(start + i);
- getFieldPtr()[position + i] = field;
- }
- return count;
-}
-
-int32_t
-FormattedStringBuilder::splice(int32_t startThis, int32_t endThis, const UnicodeString &unistr,
- int32_t startOther, int32_t endOther, Field field, UErrorCode& status) {
- int32_t thisLength = endThis - startThis;
- int32_t otherLength = endOther - startOther;
- int32_t count = otherLength - thisLength;
- int32_t position;
- if (count > 0) {
- // Overall, chars need to be added.
- position = prepareForInsert(startThis, count, status);
- } else {
- // Overall, chars need to be removed or kept the same.
- position = remove(startThis, -count);
- }
- if (U_FAILURE(status)) {
- return count;
- }
- for (int32_t i = 0; i < otherLength; i++) {
- getCharPtr()[position + i] = unistr.charAt(startOther + i);
- getFieldPtr()[position + i] = field;
- }
- return count;
-}
-
-int32_t FormattedStringBuilder::append(const FormattedStringBuilder &other, UErrorCode &status) {
- return insert(fLength, other, status);
-}
-
-int32_t
-FormattedStringBuilder::insert(int32_t index, const FormattedStringBuilder &other, UErrorCode &status) {
- if (this == &other) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
- int32_t count = other.fLength;
- if (count == 0) {
- // Nothing to insert.
- return 0;
- }
- int32_t position = prepareForInsert(index, count, status);
- if (U_FAILURE(status)) {
- return count;
- }
- for (int32_t i = 0; i < count; i++) {
- getCharPtr()[position + i] = other.charAt(i);
- getFieldPtr()[position + i] = other.fieldAt(i);
- }
- return count;
-}
-
-void FormattedStringBuilder::writeTerminator(UErrorCode& status) {
- int32_t position = prepareForInsert(fLength, 1, status);
- if (U_FAILURE(status)) {
- return;
- }
- getCharPtr()[position] = 0;
- getFieldPtr()[position] = kUndefinedField;
- fLength--;
-}
-
-int32_t FormattedStringBuilder::prepareForInsert(int32_t index, int32_t count, UErrorCode &status) {
- U_ASSERT(index >= 0);
- U_ASSERT(index <= fLength);
- U_ASSERT(count >= 0);
- if (index == 0 && fZero - count >= 0) {
- // Append to start
- fZero -= count;
- fLength += count;
- return fZero;
- } else if (index == fLength && fZero + fLength + count < getCapacity()) {
- // Append to end
- fLength += count;
- return fZero + fLength - count;
- } else {
- // Move chars around and/or allocate more space
- return prepareForInsertHelper(index, count, status);
- }
-}
-
-int32_t FormattedStringBuilder::prepareForInsertHelper(int32_t index, int32_t count, UErrorCode &status) {
- int32_t oldCapacity = getCapacity();
- int32_t oldZero = fZero;
- char16_t *oldChars = getCharPtr();
- Field *oldFields = getFieldPtr();
- if (fLength + count > oldCapacity) {
- int32_t newCapacity = (fLength + count) * 2;
- int32_t newZero = newCapacity / 2 - (fLength + count) / 2;
-
- // C++ note: malloc appears in two places: here and in the assignment operator.
- auto newChars = static_cast<char16_t *> (uprv_malloc(sizeof(char16_t) * newCapacity));
- auto newFields = static_cast<Field *>(uprv_malloc(sizeof(Field) * newCapacity));
- if (newChars == nullptr || newFields == nullptr) {
- uprv_free(newChars);
- uprv_free(newFields);
- status = U_MEMORY_ALLOCATION_ERROR;
- return -1;
- }
-
- // First copy the prefix and then the suffix, leaving room for the new chars that the
- // caller wants to insert.
- // C++ note: memcpy is OK because the src and dest do not overlap.
- uprv_memcpy2(newChars + newZero, oldChars + oldZero, sizeof(char16_t) * index);
- uprv_memcpy2(newChars + newZero + index + count,
- oldChars + oldZero + index,
- sizeof(char16_t) * (fLength - index));
- uprv_memcpy2(newFields + newZero, oldFields + oldZero, sizeof(Field) * index);
- uprv_memcpy2(newFields + newZero + index + count,
- oldFields + oldZero + index,
- sizeof(Field) * (fLength - index));
-
- if (fUsingHeap) {
- uprv_free(oldChars);
- uprv_free(oldFields);
- }
- fUsingHeap = true;
- fChars.heap.ptr = newChars;
- fChars.heap.capacity = newCapacity;
- fFields.heap.ptr = newFields;
- fFields.heap.capacity = newCapacity;
- fZero = newZero;
- fLength += count;
- } else {
- int32_t newZero = oldCapacity / 2 - (fLength + count) / 2;
-
- // C++ note: memmove is required because src and dest may overlap.
- // First copy the entire string to the location of the prefix, and then move the suffix
- // to make room for the new chars that the caller wants to insert.
- uprv_memmove2(oldChars + newZero, oldChars + oldZero, sizeof(char16_t) * fLength);
- uprv_memmove2(oldChars + newZero + index + count,
- oldChars + newZero + index,
- sizeof(char16_t) * (fLength - index));
- uprv_memmove2(oldFields + newZero, oldFields + oldZero, sizeof(Field) * fLength);
- uprv_memmove2(oldFields + newZero + index + count,
- oldFields + newZero + index,
- sizeof(Field) * (fLength - index));
-
- fZero = newZero;
- fLength += count;
- }
- return fZero + index;
-}
-
-int32_t FormattedStringBuilder::remove(int32_t index, int32_t count) {
- // TODO: Reset the heap here? (If the string after removal can fit on stack?)
- int32_t position = index + fZero;
- uprv_memmove2(getCharPtr() + position,
- getCharPtr() + position + count,
- sizeof(char16_t) * (fLength - index - count));
- uprv_memmove2(getFieldPtr() + position,
- getFieldPtr() + position + count,
- sizeof(Field) * (fLength - index - count));
- fLength -= count;
- return position;
-}
-
-UnicodeString FormattedStringBuilder::toUnicodeString() const {
- return UnicodeString(getCharPtr() + fZero, fLength);
-}
-
-const UnicodeString FormattedStringBuilder::toTempUnicodeString() const {
- // Readonly-alias constructor:
- return UnicodeString(FALSE, getCharPtr() + fZero, fLength);
-}
-
-UnicodeString FormattedStringBuilder::toDebugString() const {
- UnicodeString sb;
- sb.append(u"<FormattedStringBuilder [", -1);
- sb.append(toUnicodeString());
- sb.append(u"] [", -1);
- for (int i = 0; i < fLength; i++) {
- if (fieldAt(i) == kUndefinedField) {
- sb.append(u'n');
- } else if (fieldAt(i).getCategory() == UFIELD_CATEGORY_NUMBER) {
- char16_t c;
- switch (fieldAt(i).getField()) {
- case UNUM_SIGN_FIELD:
- c = u'-';
- break;
- case UNUM_INTEGER_FIELD:
- c = u'i';
- break;
- case UNUM_FRACTION_FIELD:
- c = u'f';
- break;
- case UNUM_EXPONENT_FIELD:
- c = u'e';
- break;
- case UNUM_EXPONENT_SIGN_FIELD:
- c = u'+';
- break;
- case UNUM_EXPONENT_SYMBOL_FIELD:
- c = u'E';
- break;
- case UNUM_DECIMAL_SEPARATOR_FIELD:
- c = u'.';
- break;
- case UNUM_GROUPING_SEPARATOR_FIELD:
- c = u',';
- break;
- case UNUM_PERCENT_FIELD:
- c = u'%';
- break;
- case UNUM_PERMILL_FIELD:
- c = u'‰';
- break;
- case UNUM_CURRENCY_FIELD:
- c = u'$';
- break;
- default:
- c = u'0' + fieldAt(i).getField();
- break;
- }
- sb.append(c);
- } else {
- sb.append(u'0' + fieldAt(i).getCategory());
- }
- }
- sb.append(u"]>", -1);
- return sb;
-}
-
-const char16_t *FormattedStringBuilder::chars() const {
- return getCharPtr() + fZero;
-}
-
-bool FormattedStringBuilder::contentEquals(const FormattedStringBuilder &other) const {
- if (fLength != other.fLength) {
- return false;
- }
- for (int32_t i = 0; i < fLength; i++) {
- if (charAt(i) != other.charAt(i) || fieldAt(i) != other.fieldAt(i)) {
- return false;
- }
- }
- return true;
-}
-
-bool FormattedStringBuilder::containsField(Field field) const {
- for (int32_t i = 0; i < fLength; i++) {
- if (field == fieldAt(i)) {
- return true;
- }
- }
- return false;
-}
-
-U_NAMESPACE_END
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "formatted_string_builder.h"
+#include "unicode/ustring.h"
+#include "unicode/utf16.h"
+#include "unicode/unum.h" // for UNumberFormatFields literals
+
+namespace {
+
+// A version of uprv_memcpy that checks for length 0.
+// By default, uprv_memcpy requires a length of at least 1.
+inline void uprv_memcpy2(void* dest, const void* src, size_t len) {
+ if (len > 0) {
+ uprv_memcpy(dest, src, len);
+ }
+}
+
+// A version of uprv_memmove that checks for length 0.
+// By default, uprv_memmove requires a length of at least 1.
+inline void uprv_memmove2(void* dest, const void* src, size_t len) {
+ if (len > 0) {
+ uprv_memmove(dest, src, len);
+ }
+}
+
+} // namespace
+
+
+U_NAMESPACE_BEGIN
+
+FormattedStringBuilder::FormattedStringBuilder() {
+#if U_DEBUG
+ // Initializing the memory to non-zero helps catch some bugs that involve
+ // reading from an improperly terminated string.
+ for (int32_t i=0; i<getCapacity(); i++) {
+ getCharPtr()[i] = 1;
+ }
+#endif
+}
+
+FormattedStringBuilder::~FormattedStringBuilder() {
+ if (fUsingHeap) {
+ uprv_free(fChars.heap.ptr);
+ uprv_free(fFields.heap.ptr);
+ }
+}
+
+FormattedStringBuilder::FormattedStringBuilder(const FormattedStringBuilder &other) {
+ *this = other;
+}
+
+FormattedStringBuilder &FormattedStringBuilder::operator=(const FormattedStringBuilder &other) {
+ // Check for self-assignment
+ if (this == &other) {
+ return *this;
+ }
+
+ // Continue with deallocation and copying
+ if (fUsingHeap) {
+ uprv_free(fChars.heap.ptr);
+ uprv_free(fFields.heap.ptr);
+ fUsingHeap = false;
+ }
+
+ int32_t capacity = other.getCapacity();
+ if (capacity > DEFAULT_CAPACITY) {
+ // FIXME: uprv_malloc
+ // C++ note: malloc appears in two places: here and in prepareForInsertHelper.
+ auto newChars = static_cast<char16_t *> (uprv_malloc(sizeof(char16_t) * capacity));
+ auto newFields = static_cast<Field *>(uprv_malloc(sizeof(Field) * capacity));
+ if (newChars == nullptr || newFields == nullptr) {
+ // UErrorCode is not available; fail silently.
+ uprv_free(newChars);
+ uprv_free(newFields);
+ *this = FormattedStringBuilder(); // can't fail
+ return *this;
+ }
+
+ fUsingHeap = true;
+ fChars.heap.capacity = capacity;
+ fChars.heap.ptr = newChars;
+ fFields.heap.capacity = capacity;
+ fFields.heap.ptr = newFields;
+ }
+
+ uprv_memcpy2(getCharPtr(), other.getCharPtr(), sizeof(char16_t) * capacity);
+ uprv_memcpy2(getFieldPtr(), other.getFieldPtr(), sizeof(Field) * capacity);
+
+ fZero = other.fZero;
+ fLength = other.fLength;
+ return *this;
+}
+
+int32_t FormattedStringBuilder::length() const {
+ return fLength;
+}
+
+int32_t FormattedStringBuilder::codePointCount() const {
+ return u_countChar32(getCharPtr() + fZero, fLength);
+}
+
+UChar32 FormattedStringBuilder::getFirstCodePoint() const {
+ if (fLength == 0) {
+ return -1;
+ }
+ UChar32 cp;
+ U16_GET(getCharPtr() + fZero, 0, 0, fLength, cp);
+ return cp;
+}
+
+UChar32 FormattedStringBuilder::getLastCodePoint() const {
+ if (fLength == 0) {
+ return -1;
+ }
+ int32_t offset = fLength;
+ U16_BACK_1(getCharPtr() + fZero, 0, offset);
+ UChar32 cp;
+ U16_GET(getCharPtr() + fZero, 0, offset, fLength, cp);
+ return cp;
+}
+
+UChar32 FormattedStringBuilder::codePointAt(int32_t index) const {
+ UChar32 cp;
+ U16_GET(getCharPtr() + fZero, 0, index, fLength, cp);
+ return cp;
+}
+
+UChar32 FormattedStringBuilder::codePointBefore(int32_t index) const {
+ int32_t offset = index;
+ U16_BACK_1(getCharPtr() + fZero, 0, offset);
+ UChar32 cp;
+ U16_GET(getCharPtr() + fZero, 0, offset, fLength, cp);
+ return cp;
+}
+
+FormattedStringBuilder &FormattedStringBuilder::clear() {
+ // TODO: Reset the heap here?
+ fZero = getCapacity() / 2;
+ fLength = 0;
+ return *this;
+}
+
+int32_t
+FormattedStringBuilder::insertCodePoint(int32_t index, UChar32 codePoint, Field field, UErrorCode &status) {
+ int32_t count = U16_LENGTH(codePoint);
+ int32_t position = prepareForInsert(index, count, status);
+ if (U_FAILURE(status)) {
+ return count;
+ }
+ if (count == 1) {
+ getCharPtr()[position] = (char16_t) codePoint;
+ getFieldPtr()[position] = field;
+ } else {
+ getCharPtr()[position] = U16_LEAD(codePoint);
+ getCharPtr()[position + 1] = U16_TRAIL(codePoint);
+ getFieldPtr()[position] = getFieldPtr()[position + 1] = field;
+ }
+ return count;
+}
+
+int32_t FormattedStringBuilder::insert(int32_t index, const UnicodeString &unistr, Field field,
+ UErrorCode &status) {
+ if (unistr.length() == 0) {
+ // Nothing to insert.
+ return 0;
+ } else if (unistr.length() == 1) {
+ // Fast path: insert using insertCodePoint.
+ return insertCodePoint(index, unistr.charAt(0), field, status);
+ } else {
+ return insert(index, unistr, 0, unistr.length(), field, status);
+ }
+}
+
+int32_t
+FormattedStringBuilder::insert(int32_t index, const UnicodeString &unistr, int32_t start, int32_t end,
+ Field field, UErrorCode &status) {
+ int32_t count = end - start;
+ int32_t position = prepareForInsert(index, count, status);
+ if (U_FAILURE(status)) {
+ return count;
+ }
+ for (int32_t i = 0; i < count; i++) {
+ getCharPtr()[position + i] = unistr.charAt(start + i);
+ getFieldPtr()[position + i] = field;
+ }
+ return count;
+}
+
+int32_t
+FormattedStringBuilder::splice(int32_t startThis, int32_t endThis, const UnicodeString &unistr,
+ int32_t startOther, int32_t endOther, Field field, UErrorCode& status) {
+ int32_t thisLength = endThis - startThis;
+ int32_t otherLength = endOther - startOther;
+ int32_t count = otherLength - thisLength;
+ int32_t position;
+ if (count > 0) {
+ // Overall, chars need to be added.
+ position = prepareForInsert(startThis, count, status);
+ } else {
+ // Overall, chars need to be removed or kept the same.
+ position = remove(startThis, -count);
+ }
+ if (U_FAILURE(status)) {
+ return count;
+ }
+ for (int32_t i = 0; i < otherLength; i++) {
+ getCharPtr()[position + i] = unistr.charAt(startOther + i);
+ getFieldPtr()[position + i] = field;
+ }
+ return count;
+}
+
+int32_t FormattedStringBuilder::append(const FormattedStringBuilder &other, UErrorCode &status) {
+ return insert(fLength, other, status);
+}
+
+int32_t
+FormattedStringBuilder::insert(int32_t index, const FormattedStringBuilder &other, UErrorCode &status) {
+ if (this == &other) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+ int32_t count = other.fLength;
+ if (count == 0) {
+ // Nothing to insert.
+ return 0;
+ }
+ int32_t position = prepareForInsert(index, count, status);
+ if (U_FAILURE(status)) {
+ return count;
+ }
+ for (int32_t i = 0; i < count; i++) {
+ getCharPtr()[position + i] = other.charAt(i);
+ getFieldPtr()[position + i] = other.fieldAt(i);
+ }
+ return count;
+}
+
+void FormattedStringBuilder::writeTerminator(UErrorCode& status) {
+ int32_t position = prepareForInsert(fLength, 1, status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ getCharPtr()[position] = 0;
+ getFieldPtr()[position] = kUndefinedField;
+ fLength--;
+}
+
+int32_t FormattedStringBuilder::prepareForInsert(int32_t index, int32_t count, UErrorCode &status) {
+ U_ASSERT(index >= 0);
+ U_ASSERT(index <= fLength);
+ U_ASSERT(count >= 0);
+ if (index == 0 && fZero - count >= 0) {
+ // Append to start
+ fZero -= count;
+ fLength += count;
+ return fZero;
+ } else if (index == fLength && fZero + fLength + count < getCapacity()) {
+ // Append to end
+ fLength += count;
+ return fZero + fLength - count;
+ } else {
+ // Move chars around and/or allocate more space
+ return prepareForInsertHelper(index, count, status);
+ }
+}
+
+int32_t FormattedStringBuilder::prepareForInsertHelper(int32_t index, int32_t count, UErrorCode &status) {
+ int32_t oldCapacity = getCapacity();
+ int32_t oldZero = fZero;
+ char16_t *oldChars = getCharPtr();
+ Field *oldFields = getFieldPtr();
+ if (fLength + count > oldCapacity) {
+ int32_t newCapacity = (fLength + count) * 2;
+ int32_t newZero = newCapacity / 2 - (fLength + count) / 2;
+
+ // C++ note: malloc appears in two places: here and in the assignment operator.
+ auto newChars = static_cast<char16_t *> (uprv_malloc(sizeof(char16_t) * newCapacity));
+ auto newFields = static_cast<Field *>(uprv_malloc(sizeof(Field) * newCapacity));
+ if (newChars == nullptr || newFields == nullptr) {
+ uprv_free(newChars);
+ uprv_free(newFields);
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return -1;
+ }
+
+ // First copy the prefix and then the suffix, leaving room for the new chars that the
+ // caller wants to insert.
+ // C++ note: memcpy is OK because the src and dest do not overlap.
+ uprv_memcpy2(newChars + newZero, oldChars + oldZero, sizeof(char16_t) * index);
+ uprv_memcpy2(newChars + newZero + index + count,
+ oldChars + oldZero + index,
+ sizeof(char16_t) * (fLength - index));
+ uprv_memcpy2(newFields + newZero, oldFields + oldZero, sizeof(Field) * index);
+ uprv_memcpy2(newFields + newZero + index + count,
+ oldFields + oldZero + index,
+ sizeof(Field) * (fLength - index));
+
+ if (fUsingHeap) {
+ uprv_free(oldChars);
+ uprv_free(oldFields);
+ }
+ fUsingHeap = true;
+ fChars.heap.ptr = newChars;
+ fChars.heap.capacity = newCapacity;
+ fFields.heap.ptr = newFields;
+ fFields.heap.capacity = newCapacity;
+ fZero = newZero;
+ fLength += count;
+ } else {
+ int32_t newZero = oldCapacity / 2 - (fLength + count) / 2;
+
+ // C++ note: memmove is required because src and dest may overlap.
+ // First copy the entire string to the location of the prefix, and then move the suffix
+ // to make room for the new chars that the caller wants to insert.
+ uprv_memmove2(oldChars + newZero, oldChars + oldZero, sizeof(char16_t) * fLength);
+ uprv_memmove2(oldChars + newZero + index + count,
+ oldChars + newZero + index,
+ sizeof(char16_t) * (fLength - index));
+ uprv_memmove2(oldFields + newZero, oldFields + oldZero, sizeof(Field) * fLength);
+ uprv_memmove2(oldFields + newZero + index + count,
+ oldFields + newZero + index,
+ sizeof(Field) * (fLength - index));
+
+ fZero = newZero;
+ fLength += count;
+ }
+ return fZero + index;
+}
+
+int32_t FormattedStringBuilder::remove(int32_t index, int32_t count) {
+ // TODO: Reset the heap here? (If the string after removal can fit on stack?)
+ int32_t position = index + fZero;
+ uprv_memmove2(getCharPtr() + position,
+ getCharPtr() + position + count,
+ sizeof(char16_t) * (fLength - index - count));
+ uprv_memmove2(getFieldPtr() + position,
+ getFieldPtr() + position + count,
+ sizeof(Field) * (fLength - index - count));
+ fLength -= count;
+ return position;
+}
+
+UnicodeString FormattedStringBuilder::toUnicodeString() const {
+ return UnicodeString(getCharPtr() + fZero, fLength);
+}
+
+const UnicodeString FormattedStringBuilder::toTempUnicodeString() const {
+ // Readonly-alias constructor:
+ return UnicodeString(FALSE, getCharPtr() + fZero, fLength);
+}
+
+UnicodeString FormattedStringBuilder::toDebugString() const {
+ UnicodeString sb;
+ sb.append(u"<FormattedStringBuilder [", -1);
+ sb.append(toUnicodeString());
+ sb.append(u"] [", -1);
+ for (int i = 0; i < fLength; i++) {
+ if (fieldAt(i) == kUndefinedField) {
+ sb.append(u'n');
+ } else if (fieldAt(i).getCategory() == UFIELD_CATEGORY_NUMBER) {
+ char16_t c;
+ switch (fieldAt(i).getField()) {
+ case UNUM_SIGN_FIELD:
+ c = u'-';
+ break;
+ case UNUM_INTEGER_FIELD:
+ c = u'i';
+ break;
+ case UNUM_FRACTION_FIELD:
+ c = u'f';
+ break;
+ case UNUM_EXPONENT_FIELD:
+ c = u'e';
+ break;
+ case UNUM_EXPONENT_SIGN_FIELD:
+ c = u'+';
+ break;
+ case UNUM_EXPONENT_SYMBOL_FIELD:
+ c = u'E';
+ break;
+ case UNUM_DECIMAL_SEPARATOR_FIELD:
+ c = u'.';
+ break;
+ case UNUM_GROUPING_SEPARATOR_FIELD:
+ c = u',';
+ break;
+ case UNUM_PERCENT_FIELD:
+ c = u'%';
+ break;
+ case UNUM_PERMILL_FIELD:
+ c = u'‰';
+ break;
+ case UNUM_CURRENCY_FIELD:
+ c = u'$';
+ break;
+ default:
+ c = u'0' + fieldAt(i).getField();
+ break;
+ }
+ sb.append(c);
+ } else {
+ sb.append(u'0' + fieldAt(i).getCategory());
+ }
+ }
+ sb.append(u"]>", -1);
+ return sb;
+}
+
+const char16_t *FormattedStringBuilder::chars() const {
+ return getCharPtr() + fZero;
+}
+
+bool FormattedStringBuilder::contentEquals(const FormattedStringBuilder &other) const {
+ if (fLength != other.fLength) {
+ return false;
+ }
+ for (int32_t i = 0; i < fLength; i++) {
+ if (charAt(i) != other.charAt(i) || fieldAt(i) != other.fieldAt(i)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool FormattedStringBuilder::containsField(Field field) const {
+ for (int32_t i = 0; i < fLength; i++) {
+ if (field == fieldAt(i)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/formatted_string_builder.h b/contrib/libs/icu/i18n/formatted_string_builder.h
index 87d7dc9ad8..4567dc1d66 100644
--- a/contrib/libs/icu/i18n/formatted_string_builder.h
+++ b/contrib/libs/icu/i18n/formatted_string_builder.h
@@ -1,271 +1,271 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMBER_STRINGBUILDER_H__
-#define __NUMBER_STRINGBUILDER_H__
-
-
-#include <cstdint>
-#include <type_traits>
-
-#include "cstring.h"
-#include "uassert.h"
-#include "fphdlimp.h"
-
-U_NAMESPACE_BEGIN
-
-class FormattedValueStringBuilderImpl;
-
-/**
- * A StringBuilder optimized for formatting. It implements the following key
- * features beyond a UnicodeString:
- *
- * <ol>
- * <li>Efficient prepend as well as append.
- * <li>Keeps tracks of Fields in an efficient manner.
- * </ol>
- *
- * See also FormattedValueStringBuilderImpl.
- *
- * @author sffc (Shane Carr)
- */
-class U_I18N_API FormattedStringBuilder : public UMemory {
- private:
- static const int32_t DEFAULT_CAPACITY = 40;
-
- template<typename T>
- union ValueOrHeapArray {
- T value[DEFAULT_CAPACITY];
- struct {
- T *ptr;
- int32_t capacity;
- } heap;
- };
-
- public:
- FormattedStringBuilder();
-
- ~FormattedStringBuilder();
-
- FormattedStringBuilder(const FormattedStringBuilder &other);
-
- // Convention: bottom 4 bits for field, top 4 bits for field category.
- // Field category 0 implies the number category so that the number field
- // literals can be directly passed as a Field type.
- // See the helper functions in "StringBuilderFieldUtils" below.
- // Exported as U_I18N_API so it can be used by other exports on Windows.
- struct U_I18N_API Field {
- uint8_t bits;
-
- Field() = default;
- constexpr Field(uint8_t category, uint8_t field);
-
- inline UFieldCategory getCategory() const;
- inline int32_t getField() const;
- inline bool isNumeric() const;
- inline bool isUndefined() const;
- inline bool operator==(const Field& other) const;
- inline bool operator!=(const Field& other) const;
- };
-
- FormattedStringBuilder &operator=(const FormattedStringBuilder &other);
-
- int32_t length() const;
-
- int32_t codePointCount() const;
-
- inline char16_t charAt(int32_t index) const {
- U_ASSERT(index >= 0);
- U_ASSERT(index < fLength);
- return getCharPtr()[fZero + index];
- }
-
- inline Field fieldAt(int32_t index) const {
- U_ASSERT(index >= 0);
- U_ASSERT(index < fLength);
- return getFieldPtr()[fZero + index];
- }
-
- UChar32 getFirstCodePoint() const;
-
- UChar32 getLastCodePoint() const;
-
- UChar32 codePointAt(int32_t index) const;
-
- UChar32 codePointBefore(int32_t index) const;
-
- FormattedStringBuilder &clear();
-
- /** Appends a UTF-16 code unit. */
- inline int32_t appendChar16(char16_t codeUnit, Field field, UErrorCode& status) {
- // appendCodePoint handles both code units and code points.
- return insertCodePoint(fLength, codeUnit, field, status);
- }
-
- /** Inserts a UTF-16 code unit. Note: insert at index 0 is very efficient. */
- inline int32_t insertChar16(int32_t index, char16_t codeUnit, Field field, UErrorCode& status) {
- // insertCodePoint handles both code units and code points.
- return insertCodePoint(index, codeUnit, field, status);
- }
-
- /** Appends a Unicode code point. */
- inline int32_t appendCodePoint(UChar32 codePoint, Field field, UErrorCode &status) {
- return insertCodePoint(fLength, codePoint, field, status);
- }
-
- /** Inserts a Unicode code point. Note: insert at index 0 is very efficient. */
- int32_t insertCodePoint(int32_t index, UChar32 codePoint, Field field, UErrorCode &status);
-
- /** Appends a string. */
- inline int32_t append(const UnicodeString &unistr, Field field, UErrorCode &status) {
- return insert(fLength, unistr, field, status);
- }
-
- /** Inserts a string. Note: insert at index 0 is very efficient. */
- int32_t insert(int32_t index, const UnicodeString &unistr, Field field, UErrorCode &status);
-
- /** Inserts a substring. Note: insert at index 0 is very efficient.
- *
- * @param start Start index of the substring of unistr to be inserted.
- * @param end End index of the substring of unistr to be inserted (exclusive).
- */
- int32_t insert(int32_t index, const UnicodeString &unistr, int32_t start, int32_t end, Field field,
- UErrorCode &status);
-
- /** Deletes a substring and then inserts a string at that same position.
- * Similar to JavaScript Array.prototype.splice().
- *
- * @param startThis Start of the span to delete.
- * @param endThis End of the span to delete (exclusive).
- * @param unistr The string to insert at the deletion position.
- * @param startOther Start index of the substring of unistr to be inserted.
- * @param endOther End index of the substring of unistr to be inserted (exclusive).
- */
- int32_t splice(int32_t startThis, int32_t endThis, const UnicodeString &unistr,
- int32_t startOther, int32_t endOther, Field field, UErrorCode& status);
-
- /** Appends a formatted string. */
- int32_t append(const FormattedStringBuilder &other, UErrorCode &status);
-
- /** Inserts a formatted string. Note: insert at index 0 is very efficient. */
- int32_t insert(int32_t index, const FormattedStringBuilder &other, UErrorCode &status);
-
- /**
- * Ensures that the string buffer contains a NUL terminator. The NUL terminator does
- * not count toward the string length. Any further changes to the string (insert or
- * append) may invalidate the NUL terminator.
- *
- * You should call this method after the formatted string is completely built if you
- * plan to return a pointer to the string from a C API.
- */
- void writeTerminator(UErrorCode& status);
-
- /**
- * Gets a "safe" UnicodeString that can be used even after the FormattedStringBuilder is destructed.
- */
- UnicodeString toUnicodeString() const;
-
- /**
- * Gets an "unsafe" UnicodeString that is valid only as long as the FormattedStringBuilder is alive and
- * unchanged. Slightly faster than toUnicodeString().
- */
- const UnicodeString toTempUnicodeString() const;
-
- UnicodeString toDebugString() const;
-
- const char16_t *chars() const;
-
- bool contentEquals(const FormattedStringBuilder &other) const;
-
- bool containsField(Field field) const;
-
- private:
- bool fUsingHeap = false;
- ValueOrHeapArray<char16_t> fChars;
- ValueOrHeapArray<Field> fFields;
- int32_t fZero = DEFAULT_CAPACITY / 2;
- int32_t fLength = 0;
-
- inline char16_t *getCharPtr() {
- return fUsingHeap ? fChars.heap.ptr : fChars.value;
- }
-
- inline const char16_t *getCharPtr() const {
- return fUsingHeap ? fChars.heap.ptr : fChars.value;
- }
-
- inline Field *getFieldPtr() {
- return fUsingHeap ? fFields.heap.ptr : fFields.value;
- }
-
- inline const Field *getFieldPtr() const {
- return fUsingHeap ? fFields.heap.ptr : fFields.value;
- }
-
- inline int32_t getCapacity() const {
- return fUsingHeap ? fChars.heap.capacity : DEFAULT_CAPACITY;
- }
-
- int32_t prepareForInsert(int32_t index, int32_t count, UErrorCode &status);
-
- int32_t prepareForInsertHelper(int32_t index, int32_t count, UErrorCode &status);
-
- int32_t remove(int32_t index, int32_t count);
-
- friend class FormattedValueStringBuilderImpl;
-};
-
-static_assert(
- std::is_pod<FormattedStringBuilder::Field>::value,
- "Field should be a POD type for efficient initialization");
-
-constexpr FormattedStringBuilder::Field::Field(uint8_t category, uint8_t field)
- : bits((
- U_ASSERT(category <= 0xf),
- U_ASSERT(field <= 0xf),
- static_cast<uint8_t>((category << 4) | field)
- )) {}
-
-/**
- * Internal constant for the undefined field for use in FormattedStringBuilder.
- */
-constexpr FormattedStringBuilder::Field kUndefinedField = {UFIELD_CATEGORY_UNDEFINED, 0};
-
-/**
- * Internal field to signal "numeric" when fields are not supported in NumberFormat.
- */
-constexpr FormattedStringBuilder::Field kGeneralNumericField = {UFIELD_CATEGORY_UNDEFINED, 1};
-
-inline UFieldCategory FormattedStringBuilder::Field::getCategory() const {
- return static_cast<UFieldCategory>(bits >> 4);
-}
-
-inline int32_t FormattedStringBuilder::Field::getField() const {
- return bits & 0xf;
-}
-
-inline bool FormattedStringBuilder::Field::isNumeric() const {
- return getCategory() == UFIELD_CATEGORY_NUMBER || *this == kGeneralNumericField;
-}
-
-inline bool FormattedStringBuilder::Field::isUndefined() const {
- return getCategory() == UFIELD_CATEGORY_UNDEFINED;
-}
-
-inline bool FormattedStringBuilder::Field::operator==(const Field& other) const {
- return bits == other.bits;
-}
-
-inline bool FormattedStringBuilder::Field::operator!=(const Field& other) const {
- return bits != other.bits;
-}
-
-U_NAMESPACE_END
-
-
-#endif //__NUMBER_STRINGBUILDER_H__
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMBER_STRINGBUILDER_H__
+#define __NUMBER_STRINGBUILDER_H__
+
+
+#include <cstdint>
+#include <type_traits>
+
+#include "cstring.h"
+#include "uassert.h"
+#include "fphdlimp.h"
+
+U_NAMESPACE_BEGIN
+
+class FormattedValueStringBuilderImpl;
+
+/**
+ * A StringBuilder optimized for formatting. It implements the following key
+ * features beyond a UnicodeString:
+ *
+ * <ol>
+ * <li>Efficient prepend as well as append.
+ * <li>Keeps tracks of Fields in an efficient manner.
+ * </ol>
+ *
+ * See also FormattedValueStringBuilderImpl.
+ *
+ * @author sffc (Shane Carr)
+ */
+class U_I18N_API FormattedStringBuilder : public UMemory {
+ private:
+ static const int32_t DEFAULT_CAPACITY = 40;
+
+ template<typename T>
+ union ValueOrHeapArray {
+ T value[DEFAULT_CAPACITY];
+ struct {
+ T *ptr;
+ int32_t capacity;
+ } heap;
+ };
+
+ public:
+ FormattedStringBuilder();
+
+ ~FormattedStringBuilder();
+
+ FormattedStringBuilder(const FormattedStringBuilder &other);
+
+ // Convention: bottom 4 bits for field, top 4 bits for field category.
+ // Field category 0 implies the number category so that the number field
+ // literals can be directly passed as a Field type.
+ // See the helper functions in "StringBuilderFieldUtils" below.
+ // Exported as U_I18N_API so it can be used by other exports on Windows.
+ struct U_I18N_API Field {
+ uint8_t bits;
+
+ Field() = default;
+ constexpr Field(uint8_t category, uint8_t field);
+
+ inline UFieldCategory getCategory() const;
+ inline int32_t getField() const;
+ inline bool isNumeric() const;
+ inline bool isUndefined() const;
+ inline bool operator==(const Field& other) const;
+ inline bool operator!=(const Field& other) const;
+ };
+
+ FormattedStringBuilder &operator=(const FormattedStringBuilder &other);
+
+ int32_t length() const;
+
+ int32_t codePointCount() const;
+
+ inline char16_t charAt(int32_t index) const {
+ U_ASSERT(index >= 0);
+ U_ASSERT(index < fLength);
+ return getCharPtr()[fZero + index];
+ }
+
+ inline Field fieldAt(int32_t index) const {
+ U_ASSERT(index >= 0);
+ U_ASSERT(index < fLength);
+ return getFieldPtr()[fZero + index];
+ }
+
+ UChar32 getFirstCodePoint() const;
+
+ UChar32 getLastCodePoint() const;
+
+ UChar32 codePointAt(int32_t index) const;
+
+ UChar32 codePointBefore(int32_t index) const;
+
+ FormattedStringBuilder &clear();
+
+ /** Appends a UTF-16 code unit. */
+ inline int32_t appendChar16(char16_t codeUnit, Field field, UErrorCode& status) {
+ // appendCodePoint handles both code units and code points.
+ return insertCodePoint(fLength, codeUnit, field, status);
+ }
+
+ /** Inserts a UTF-16 code unit. Note: insert at index 0 is very efficient. */
+ inline int32_t insertChar16(int32_t index, char16_t codeUnit, Field field, UErrorCode& status) {
+ // insertCodePoint handles both code units and code points.
+ return insertCodePoint(index, codeUnit, field, status);
+ }
+
+ /** Appends a Unicode code point. */
+ inline int32_t appendCodePoint(UChar32 codePoint, Field field, UErrorCode &status) {
+ return insertCodePoint(fLength, codePoint, field, status);
+ }
+
+ /** Inserts a Unicode code point. Note: insert at index 0 is very efficient. */
+ int32_t insertCodePoint(int32_t index, UChar32 codePoint, Field field, UErrorCode &status);
+
+ /** Appends a string. */
+ inline int32_t append(const UnicodeString &unistr, Field field, UErrorCode &status) {
+ return insert(fLength, unistr, field, status);
+ }
+
+ /** Inserts a string. Note: insert at index 0 is very efficient. */
+ int32_t insert(int32_t index, const UnicodeString &unistr, Field field, UErrorCode &status);
+
+ /** Inserts a substring. Note: insert at index 0 is very efficient.
+ *
+ * @param start Start index of the substring of unistr to be inserted.
+ * @param end End index of the substring of unistr to be inserted (exclusive).
+ */
+ int32_t insert(int32_t index, const UnicodeString &unistr, int32_t start, int32_t end, Field field,
+ UErrorCode &status);
+
+ /** Deletes a substring and then inserts a string at that same position.
+ * Similar to JavaScript Array.prototype.splice().
+ *
+ * @param startThis Start of the span to delete.
+ * @param endThis End of the span to delete (exclusive).
+ * @param unistr The string to insert at the deletion position.
+ * @param startOther Start index of the substring of unistr to be inserted.
+ * @param endOther End index of the substring of unistr to be inserted (exclusive).
+ */
+ int32_t splice(int32_t startThis, int32_t endThis, const UnicodeString &unistr,
+ int32_t startOther, int32_t endOther, Field field, UErrorCode& status);
+
+ /** Appends a formatted string. */
+ int32_t append(const FormattedStringBuilder &other, UErrorCode &status);
+
+ /** Inserts a formatted string. Note: insert at index 0 is very efficient. */
+ int32_t insert(int32_t index, const FormattedStringBuilder &other, UErrorCode &status);
+
+ /**
+ * Ensures that the string buffer contains a NUL terminator. The NUL terminator does
+ * not count toward the string length. Any further changes to the string (insert or
+ * append) may invalidate the NUL terminator.
+ *
+ * You should call this method after the formatted string is completely built if you
+ * plan to return a pointer to the string from a C API.
+ */
+ void writeTerminator(UErrorCode& status);
+
+ /**
+ * Gets a "safe" UnicodeString that can be used even after the FormattedStringBuilder is destructed.
+ */
+ UnicodeString toUnicodeString() const;
+
+ /**
+ * Gets an "unsafe" UnicodeString that is valid only as long as the FormattedStringBuilder is alive and
+ * unchanged. Slightly faster than toUnicodeString().
+ */
+ const UnicodeString toTempUnicodeString() const;
+
+ UnicodeString toDebugString() const;
+
+ const char16_t *chars() const;
+
+ bool contentEquals(const FormattedStringBuilder &other) const;
+
+ bool containsField(Field field) const;
+
+ private:
+ bool fUsingHeap = false;
+ ValueOrHeapArray<char16_t> fChars;
+ ValueOrHeapArray<Field> fFields;
+ int32_t fZero = DEFAULT_CAPACITY / 2;
+ int32_t fLength = 0;
+
+ inline char16_t *getCharPtr() {
+ return fUsingHeap ? fChars.heap.ptr : fChars.value;
+ }
+
+ inline const char16_t *getCharPtr() const {
+ return fUsingHeap ? fChars.heap.ptr : fChars.value;
+ }
+
+ inline Field *getFieldPtr() {
+ return fUsingHeap ? fFields.heap.ptr : fFields.value;
+ }
+
+ inline const Field *getFieldPtr() const {
+ return fUsingHeap ? fFields.heap.ptr : fFields.value;
+ }
+
+ inline int32_t getCapacity() const {
+ return fUsingHeap ? fChars.heap.capacity : DEFAULT_CAPACITY;
+ }
+
+ int32_t prepareForInsert(int32_t index, int32_t count, UErrorCode &status);
+
+ int32_t prepareForInsertHelper(int32_t index, int32_t count, UErrorCode &status);
+
+ int32_t remove(int32_t index, int32_t count);
+
+ friend class FormattedValueStringBuilderImpl;
+};
+
+static_assert(
+ std::is_pod<FormattedStringBuilder::Field>::value,
+ "Field should be a POD type for efficient initialization");
+
+constexpr FormattedStringBuilder::Field::Field(uint8_t category, uint8_t field)
+ : bits((
+ U_ASSERT(category <= 0xf),
+ U_ASSERT(field <= 0xf),
+ static_cast<uint8_t>((category << 4) | field)
+ )) {}
+
+/**
+ * Internal constant for the undefined field for use in FormattedStringBuilder.
+ */
+constexpr FormattedStringBuilder::Field kUndefinedField = {UFIELD_CATEGORY_UNDEFINED, 0};
+
+/**
+ * Internal field to signal "numeric" when fields are not supported in NumberFormat.
+ */
+constexpr FormattedStringBuilder::Field kGeneralNumericField = {UFIELD_CATEGORY_UNDEFINED, 1};
+
+inline UFieldCategory FormattedStringBuilder::Field::getCategory() const {
+ return static_cast<UFieldCategory>(bits >> 4);
+}
+
+inline int32_t FormattedStringBuilder::Field::getField() const {
+ return bits & 0xf;
+}
+
+inline bool FormattedStringBuilder::Field::isNumeric() const {
+ return getCategory() == UFIELD_CATEGORY_NUMBER || *this == kGeneralNumericField;
+}
+
+inline bool FormattedStringBuilder::Field::isUndefined() const {
+ return getCategory() == UFIELD_CATEGORY_UNDEFINED;
+}
+
+inline bool FormattedStringBuilder::Field::operator==(const Field& other) const {
+ return bits == other.bits;
+}
+
+inline bool FormattedStringBuilder::Field::operator!=(const Field& other) const {
+ return bits != other.bits;
+}
+
+U_NAMESPACE_END
+
+
+#endif //__NUMBER_STRINGBUILDER_H__
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/formattedval_impl.h b/contrib/libs/icu/i18n/formattedval_impl.h
index 883af8c581..7bee374286 100644
--- a/contrib/libs/icu/i18n/formattedval_impl.h
+++ b/contrib/libs/icu/i18n/formattedval_impl.h
@@ -1,277 +1,277 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#ifndef __FORMVAL_IMPL_H__
-#define __FORMVAL_IMPL_H__
-
-#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING
-
-// This file contains compliant implementations of FormattedValue which can be
-// leveraged by ICU formatters.
-//
-// Each implementation is defined in its own cpp file in order to split
-// dependencies more modularly.
-
-#include "unicode/formattedvalue.h"
-#include "capi_helper.h"
-#include "fphdlimp.h"
-#include "util.h"
-#include "uvectr32.h"
-#include "formatted_string_builder.h"
-
-
-/**
- * Represents the type of constraint for ConstrainedFieldPosition.
- *
- * Constraints are used to control the behavior of iteration in FormattedValue.
- *
- * @internal
- */
-typedef enum UCFPosConstraintType {
- /**
- * Represents the lack of a constraint.
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#ifndef __FORMVAL_IMPL_H__
+#define __FORMVAL_IMPL_H__
+
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+
+// This file contains compliant implementations of FormattedValue which can be
+// leveraged by ICU formatters.
+//
+// Each implementation is defined in its own cpp file in order to split
+// dependencies more modularly.
+
+#include "unicode/formattedvalue.h"
+#include "capi_helper.h"
+#include "fphdlimp.h"
+#include "util.h"
+#include "uvectr32.h"
+#include "formatted_string_builder.h"
+
+
+/**
+ * Represents the type of constraint for ConstrainedFieldPosition.
+ *
+ * Constraints are used to control the behavior of iteration in FormattedValue.
+ *
+ * @internal
+ */
+typedef enum UCFPosConstraintType {
+ /**
+ * Represents the lack of a constraint.
+ *
+ * This is the value of fConstraint if no "constrain" methods were called.
+ *
+ * @internal
+ */
+ UCFPOS_CONSTRAINT_NONE = 0,
+
+ /**
+ * Represents that the field category is constrained.
+ *
+ * This is the value of fConstraint if constraintCategory was called.
+ *
+ * FormattedValue implementations should not change the field category
+ * while this constraint is active.
+ *
+ * @internal
+ */
+ UCFPOS_CONSTRAINT_CATEGORY,
+
+ /**
+ * Represents that the field and field category are constrained.
+ *
+ * This is the value of fConstraint if constraintField was called.
+ *
+ * FormattedValue implementations should not change the field or field category
+ * while this constraint is active.
+ *
+ * @internal
+ */
+ UCFPOS_CONSTRAINT_FIELD
+} UCFPosConstraintType;
+
+
+U_NAMESPACE_BEGIN
+
+
+/**
+ * Implementation of FormattedValue using FieldPositionHandler to accept fields.
+ */
+class FormattedValueFieldPositionIteratorImpl : public UMemory, public FormattedValue {
+public:
+
+ /** @param initialFieldCapacity Initially allocate space for this many fields. */
+ FormattedValueFieldPositionIteratorImpl(int32_t initialFieldCapacity, UErrorCode& status);
+
+ virtual ~FormattedValueFieldPositionIteratorImpl();
+
+ // Implementation of FormattedValue (const):
+
+ UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
+ UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
+ Appendable& appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
+ UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
+
+ // Additional methods used during construction phase only (non-const):
+
+ FieldPositionIteratorHandler getHandler(UErrorCode& status);
+ void appendString(UnicodeString string, UErrorCode& status);
+
+ /**
+ * Computes the spans for duplicated values.
+ * For example, if the string has fields:
*
- * This is the value of fConstraint if no "constrain" methods were called.
- *
- * @internal
- */
- UCFPOS_CONSTRAINT_NONE = 0,
-
- /**
- * Represents that the field category is constrained.
- *
- * This is the value of fConstraint if constraintCategory was called.
- *
- * FormattedValue implementations should not change the field category
- * while this constraint is active.
- *
- * @internal
- */
- UCFPOS_CONSTRAINT_CATEGORY,
-
- /**
- * Represents that the field and field category are constrained.
- *
- * This is the value of fConstraint if constraintField was called.
- *
- * FormattedValue implementations should not change the field or field category
- * while this constraint is active.
- *
- * @internal
- */
- UCFPOS_CONSTRAINT_FIELD
-} UCFPosConstraintType;
-
-
-U_NAMESPACE_BEGIN
-
-
-/**
- * Implementation of FormattedValue using FieldPositionHandler to accept fields.
- */
-class FormattedValueFieldPositionIteratorImpl : public UMemory, public FormattedValue {
-public:
-
- /** @param initialFieldCapacity Initially allocate space for this many fields. */
- FormattedValueFieldPositionIteratorImpl(int32_t initialFieldCapacity, UErrorCode& status);
-
- virtual ~FormattedValueFieldPositionIteratorImpl();
-
- // Implementation of FormattedValue (const):
-
- UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
- UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
- Appendable& appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
- UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
-
- // Additional methods used during construction phase only (non-const):
-
- FieldPositionIteratorHandler getHandler(UErrorCode& status);
- void appendString(UnicodeString string, UErrorCode& status);
-
- /**
- * Computes the spans for duplicated values.
- * For example, if the string has fields:
- *
- * ...aa..[b.cc]..d.[bb.e.c]..a..
- *
- * then the spans will be the bracketed regions.
- *
- * Assumes that the currently known fields are sorted
- * and all in the same category.
- */
- void addOverlapSpans(UFieldCategory spanCategory, int8_t firstIndex, UErrorCode& status);
-
- /**
- * Sorts the fields: start index first, length second.
- */
- void sort();
-
-private:
- UnicodeString fString;
- UVector32 fFields;
-};
-
-
-/**
- * Implementation of FormattedValue based on FormattedStringBuilder.
- *
- * The implementation currently revolves around numbers and number fields.
- * However, it can be generalized in the future when there is a need.
- *
- * @author sffc (Shane Carr)
- */
-// Exported as U_I18N_API for tests
-class U_I18N_API FormattedValueStringBuilderImpl : public UMemory, public FormattedValue {
-public:
-
- FormattedValueStringBuilderImpl(FormattedStringBuilder::Field numericField);
-
- virtual ~FormattedValueStringBuilderImpl();
-
- // Implementation of FormattedValue (const):
-
- UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
- UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
- Appendable& appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
- UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
-
- // Additional helper functions:
- UBool nextFieldPosition(FieldPosition& fp, UErrorCode& status) const;
- void getAllFieldPositions(FieldPositionIteratorHandler& fpih, UErrorCode& status) const;
- inline FormattedStringBuilder& getStringRef() {
- return fString;
- }
- inline const FormattedStringBuilder& getStringRef() const {
- return fString;
- }
-
-private:
- FormattedStringBuilder fString;
- FormattedStringBuilder::Field fNumericField;
-
- bool nextPositionImpl(ConstrainedFieldPosition& cfpos, FormattedStringBuilder::Field numericField, UErrorCode& status) const;
- static bool isIntOrGroup(FormattedStringBuilder::Field field);
- int32_t trimBack(int32_t limit) const;
- int32_t trimFront(int32_t start) const;
-};
-
-
-// C API Helpers for FormattedValue
-// Magic number as ASCII == "UFV"
-struct UFormattedValueImpl;
-typedef IcuCApiHelper<UFormattedValue, UFormattedValueImpl, 0x55465600> UFormattedValueApiHelper;
-struct UFormattedValueImpl : public UMemory, public UFormattedValueApiHelper {
- // This pointer should be set by the child class.
- FormattedValue* fFormattedValue = nullptr;
-};
-
-
-/** Boilerplate to check for valid status before dereferencing the fData pointer. */
-#define UPRV_FORMATTED_VALUE_METHOD_GUARD(returnExpression) \
- if (U_FAILURE(status)) { \
- return returnExpression; \
- } \
- if (fData == nullptr) { \
- status = fErrorCode; \
- return returnExpression; \
- } \
-
-
-/** Implementation of the methods from U_FORMATTED_VALUE_SUBCLASS_AUTO. */
-#define UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(Name) \
- Name::Name(Name&& src) U_NOEXCEPT \
- : fData(src.fData), fErrorCode(src.fErrorCode) { \
- src.fData = nullptr; \
- src.fErrorCode = U_INVALID_STATE_ERROR; \
- } \
- Name::~Name() { \
- delete fData; \
- fData = nullptr; \
- } \
- Name& Name::operator=(Name&& src) U_NOEXCEPT { \
- delete fData; \
- fData = src.fData; \
- src.fData = nullptr; \
- fErrorCode = src.fErrorCode; \
- src.fErrorCode = U_INVALID_STATE_ERROR; \
- return *this; \
- } \
- UnicodeString Name::toString(UErrorCode& status) const { \
- UPRV_FORMATTED_VALUE_METHOD_GUARD(ICU_Utility::makeBogusString()) \
- return fData->toString(status); \
- } \
- UnicodeString Name::toTempString(UErrorCode& status) const { \
- UPRV_FORMATTED_VALUE_METHOD_GUARD(ICU_Utility::makeBogusString()) \
- return fData->toTempString(status); \
- } \
- Appendable& Name::appendTo(Appendable& appendable, UErrorCode& status) const { \
- UPRV_FORMATTED_VALUE_METHOD_GUARD(appendable) \
- return fData->appendTo(appendable, status); \
- } \
- UBool Name::nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const { \
- UPRV_FORMATTED_VALUE_METHOD_GUARD(FALSE) \
- return fData->nextPosition(cfpos, status); \
- }
-
-
-/** Like UPRV_FORMATTED_VALUE_CAPI_AUTO_IMPL but without impl type declarations. */
-#define UPRV_FORMATTED_VALUE_CAPI_NO_IMPLTYPE_AUTO_IMPL(CType, ImplType, HelperType, Prefix) \
- U_CAPI CType* U_EXPORT2 \
- Prefix ## _openResult (UErrorCode* ec) { \
- if (U_FAILURE(*ec)) { \
- return nullptr; \
- } \
- ImplType* impl = new ImplType(); \
- if (impl == nullptr) { \
- *ec = U_MEMORY_ALLOCATION_ERROR; \
- return nullptr; \
- } \
- return static_cast<HelperType*>(impl)->exportForC(); \
- } \
- U_DRAFT const UFormattedValue* U_EXPORT2 \
- Prefix ## _resultAsValue (const CType* uresult, UErrorCode* ec) { \
- const ImplType* result = HelperType::validate(uresult, *ec); \
- if (U_FAILURE(*ec)) { return nullptr; } \
- return static_cast<const UFormattedValueApiHelper*>(result)->exportConstForC(); \
- } \
- U_CAPI void U_EXPORT2 \
- Prefix ## _closeResult (CType* uresult) { \
- UErrorCode localStatus = U_ZERO_ERROR; \
- const ImplType* impl = HelperType::validate(uresult, localStatus); \
- delete impl; \
- }
-
-
-/**
- * Implementation of the standard methods for a UFormattedValue "subclass" C API.
- * @param CPPType The public C++ type, like FormattedList
- * @param CType The public C type, like UFormattedList
- * @param ImplType A name to use for the implementation class
- * @param HelperType A name to use for the "mixin" typedef for C API conversion
- * @param Prefix The C API prefix, like ulistfmt
- * @param MagicNumber A unique 32-bit number to use to identify this type
- */
-#define UPRV_FORMATTED_VALUE_CAPI_AUTO_IMPL(CPPType, CType, ImplType, HelperType, Prefix, MagicNumber) \
- U_NAMESPACE_BEGIN \
- class ImplType; \
- typedef IcuCApiHelper<CType, ImplType, MagicNumber> HelperType; \
- class ImplType : public UFormattedValueImpl, public HelperType { \
- public: \
- ImplType(); \
- ~ImplType(); \
- CPPType fImpl; \
- }; \
- ImplType::ImplType() { \
- fFormattedValue = &fImpl; \
- } \
- ImplType::~ImplType() {} \
- U_NAMESPACE_END \
- UPRV_FORMATTED_VALUE_CAPI_NO_IMPLTYPE_AUTO_IMPL(CType, ImplType, HelperType, Prefix)
-
-
-U_NAMESPACE_END
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif // __FORMVAL_IMPL_H__
+ * ...aa..[b.cc]..d.[bb.e.c]..a..
+ *
+ * then the spans will be the bracketed regions.
+ *
+ * Assumes that the currently known fields are sorted
+ * and all in the same category.
+ */
+ void addOverlapSpans(UFieldCategory spanCategory, int8_t firstIndex, UErrorCode& status);
+
+ /**
+ * Sorts the fields: start index first, length second.
+ */
+ void sort();
+
+private:
+ UnicodeString fString;
+ UVector32 fFields;
+};
+
+
+/**
+ * Implementation of FormattedValue based on FormattedStringBuilder.
+ *
+ * The implementation currently revolves around numbers and number fields.
+ * However, it can be generalized in the future when there is a need.
+ *
+ * @author sffc (Shane Carr)
+ */
+// Exported as U_I18N_API for tests
+class U_I18N_API FormattedValueStringBuilderImpl : public UMemory, public FormattedValue {
+public:
+
+ FormattedValueStringBuilderImpl(FormattedStringBuilder::Field numericField);
+
+ virtual ~FormattedValueStringBuilderImpl();
+
+ // Implementation of FormattedValue (const):
+
+ UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
+ UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
+ Appendable& appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
+ UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
+
+ // Additional helper functions:
+ UBool nextFieldPosition(FieldPosition& fp, UErrorCode& status) const;
+ void getAllFieldPositions(FieldPositionIteratorHandler& fpih, UErrorCode& status) const;
+ inline FormattedStringBuilder& getStringRef() {
+ return fString;
+ }
+ inline const FormattedStringBuilder& getStringRef() const {
+ return fString;
+ }
+
+private:
+ FormattedStringBuilder fString;
+ FormattedStringBuilder::Field fNumericField;
+
+ bool nextPositionImpl(ConstrainedFieldPosition& cfpos, FormattedStringBuilder::Field numericField, UErrorCode& status) const;
+ static bool isIntOrGroup(FormattedStringBuilder::Field field);
+ int32_t trimBack(int32_t limit) const;
+ int32_t trimFront(int32_t start) const;
+};
+
+
+// C API Helpers for FormattedValue
+// Magic number as ASCII == "UFV"
+struct UFormattedValueImpl;
+typedef IcuCApiHelper<UFormattedValue, UFormattedValueImpl, 0x55465600> UFormattedValueApiHelper;
+struct UFormattedValueImpl : public UMemory, public UFormattedValueApiHelper {
+ // This pointer should be set by the child class.
+ FormattedValue* fFormattedValue = nullptr;
+};
+
+
+/** Boilerplate to check for valid status before dereferencing the fData pointer. */
+#define UPRV_FORMATTED_VALUE_METHOD_GUARD(returnExpression) \
+ if (U_FAILURE(status)) { \
+ return returnExpression; \
+ } \
+ if (fData == nullptr) { \
+ status = fErrorCode; \
+ return returnExpression; \
+ } \
+
+
+/** Implementation of the methods from U_FORMATTED_VALUE_SUBCLASS_AUTO. */
+#define UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(Name) \
+ Name::Name(Name&& src) U_NOEXCEPT \
+ : fData(src.fData), fErrorCode(src.fErrorCode) { \
+ src.fData = nullptr; \
+ src.fErrorCode = U_INVALID_STATE_ERROR; \
+ } \
+ Name::~Name() { \
+ delete fData; \
+ fData = nullptr; \
+ } \
+ Name& Name::operator=(Name&& src) U_NOEXCEPT { \
+ delete fData; \
+ fData = src.fData; \
+ src.fData = nullptr; \
+ fErrorCode = src.fErrorCode; \
+ src.fErrorCode = U_INVALID_STATE_ERROR; \
+ return *this; \
+ } \
+ UnicodeString Name::toString(UErrorCode& status) const { \
+ UPRV_FORMATTED_VALUE_METHOD_GUARD(ICU_Utility::makeBogusString()) \
+ return fData->toString(status); \
+ } \
+ UnicodeString Name::toTempString(UErrorCode& status) const { \
+ UPRV_FORMATTED_VALUE_METHOD_GUARD(ICU_Utility::makeBogusString()) \
+ return fData->toTempString(status); \
+ } \
+ Appendable& Name::appendTo(Appendable& appendable, UErrorCode& status) const { \
+ UPRV_FORMATTED_VALUE_METHOD_GUARD(appendable) \
+ return fData->appendTo(appendable, status); \
+ } \
+ UBool Name::nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const { \
+ UPRV_FORMATTED_VALUE_METHOD_GUARD(FALSE) \
+ return fData->nextPosition(cfpos, status); \
+ }
+
+
+/** Like UPRV_FORMATTED_VALUE_CAPI_AUTO_IMPL but without impl type declarations. */
+#define UPRV_FORMATTED_VALUE_CAPI_NO_IMPLTYPE_AUTO_IMPL(CType, ImplType, HelperType, Prefix) \
+ U_CAPI CType* U_EXPORT2 \
+ Prefix ## _openResult (UErrorCode* ec) { \
+ if (U_FAILURE(*ec)) { \
+ return nullptr; \
+ } \
+ ImplType* impl = new ImplType(); \
+ if (impl == nullptr) { \
+ *ec = U_MEMORY_ALLOCATION_ERROR; \
+ return nullptr; \
+ } \
+ return static_cast<HelperType*>(impl)->exportForC(); \
+ } \
+ U_DRAFT const UFormattedValue* U_EXPORT2 \
+ Prefix ## _resultAsValue (const CType* uresult, UErrorCode* ec) { \
+ const ImplType* result = HelperType::validate(uresult, *ec); \
+ if (U_FAILURE(*ec)) { return nullptr; } \
+ return static_cast<const UFormattedValueApiHelper*>(result)->exportConstForC(); \
+ } \
+ U_CAPI void U_EXPORT2 \
+ Prefix ## _closeResult (CType* uresult) { \
+ UErrorCode localStatus = U_ZERO_ERROR; \
+ const ImplType* impl = HelperType::validate(uresult, localStatus); \
+ delete impl; \
+ }
+
+
+/**
+ * Implementation of the standard methods for a UFormattedValue "subclass" C API.
+ * @param CPPType The public C++ type, like FormattedList
+ * @param CType The public C type, like UFormattedList
+ * @param ImplType A name to use for the implementation class
+ * @param HelperType A name to use for the "mixin" typedef for C API conversion
+ * @param Prefix The C API prefix, like ulistfmt
+ * @param MagicNumber A unique 32-bit number to use to identify this type
+ */
+#define UPRV_FORMATTED_VALUE_CAPI_AUTO_IMPL(CPPType, CType, ImplType, HelperType, Prefix, MagicNumber) \
+ U_NAMESPACE_BEGIN \
+ class ImplType; \
+ typedef IcuCApiHelper<CType, ImplType, MagicNumber> HelperType; \
+ class ImplType : public UFormattedValueImpl, public HelperType { \
+ public: \
+ ImplType(); \
+ ~ImplType(); \
+ CPPType fImpl; \
+ }; \
+ ImplType::ImplType() { \
+ fFormattedValue = &fImpl; \
+ } \
+ ImplType::~ImplType() {} \
+ U_NAMESPACE_END \
+ UPRV_FORMATTED_VALUE_CAPI_NO_IMPLTYPE_AUTO_IMPL(CType, ImplType, HelperType, Prefix)
+
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+#endif // __FORMVAL_IMPL_H__
diff --git a/contrib/libs/icu/i18n/formattedval_iterimpl.cpp b/contrib/libs/icu/i18n/formattedval_iterimpl.cpp
index 52cdb82a50..75328fae88 100644
--- a/contrib/libs/icu/i18n/formattedval_iterimpl.cpp
+++ b/contrib/libs/icu/i18n/formattedval_iterimpl.cpp
@@ -1,176 +1,176 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// This file contains one implementation of FormattedValue.
-// Other independent implementations should go into their own cpp file for
-// better dependency modularization.
-
-#include "formattedval_impl.h"
-#include "putilimp.h"
-
-U_NAMESPACE_BEGIN
-
-
-FormattedValueFieldPositionIteratorImpl::FormattedValueFieldPositionIteratorImpl(
- int32_t initialFieldCapacity,
- UErrorCode& status)
- : fFields(initialFieldCapacity * 4, status) {
-}
-
-FormattedValueFieldPositionIteratorImpl::~FormattedValueFieldPositionIteratorImpl() = default;
-
-UnicodeString FormattedValueFieldPositionIteratorImpl::toString(
- UErrorCode&) const {
- return fString;
-}
-
-UnicodeString FormattedValueFieldPositionIteratorImpl::toTempString(
- UErrorCode&) const {
- // The alias must point to memory owned by this object;
- // fastCopyFrom doesn't do this when using a stack buffer.
- return UnicodeString(TRUE, fString.getBuffer(), fString.length());
-}
-
-Appendable& FormattedValueFieldPositionIteratorImpl::appendTo(
- Appendable& appendable,
- UErrorCode&) const {
- appendable.appendString(fString.getBuffer(), fString.length());
- return appendable;
-}
-
-UBool FormattedValueFieldPositionIteratorImpl::nextPosition(
- ConstrainedFieldPosition& cfpos,
- UErrorCode&) const {
- U_ASSERT(fFields.size() % 4 == 0);
- int32_t numFields = fFields.size() / 4;
- int32_t i = static_cast<int32_t>(cfpos.getInt64IterationContext());
- for (; i < numFields; i++) {
- UFieldCategory category = static_cast<UFieldCategory>(fFields.elementAti(i * 4));
- int32_t field = fFields.elementAti(i * 4 + 1);
- if (cfpos.matchesField(category, field)) {
- int32_t start = fFields.elementAti(i * 4 + 2);
- int32_t limit = fFields.elementAti(i * 4 + 3);
- cfpos.setState(category, field, start, limit);
- break;
- }
- }
- cfpos.setInt64IterationContext(i == numFields ? i : i + 1);
- return i < numFields;
-}
-
-
-FieldPositionIteratorHandler FormattedValueFieldPositionIteratorImpl::getHandler(
- UErrorCode& status) {
- return FieldPositionIteratorHandler(&fFields, status);
-}
-
-void FormattedValueFieldPositionIteratorImpl::appendString(
- UnicodeString string,
- UErrorCode& status) {
- if (U_FAILURE(status)) {
- return;
- }
- fString.append(string);
- // Make the string NUL-terminated
- if (fString.getTerminatedBuffer() == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
-}
-
-
-void FormattedValueFieldPositionIteratorImpl::addOverlapSpans(
- UFieldCategory spanCategory,
- int8_t firstIndex,
- UErrorCode& status) {
- // In order to avoid fancy data structures, this is an O(N^2) algorithm,
- // which should be fine for all real-life applications of this function.
- int32_t s1a = INT32_MAX;
- int32_t s1b = 0;
- int32_t s2a = INT32_MAX;
- int32_t s2b = 0;
- int32_t numFields = fFields.size() / 4;
- for (int32_t i = 0; i<numFields; i++) {
- int32_t field1 = fFields.elementAti(i * 4 + 1);
- for (int32_t j = i + 1; j<numFields; j++) {
- int32_t field2 = fFields.elementAti(j * 4 + 1);
- if (field1 != field2) {
- continue;
- }
- // Found a duplicate
- s1a = uprv_min(s1a, fFields.elementAti(i * 4 + 2));
- s1b = uprv_max(s1b, fFields.elementAti(i * 4 + 3));
- s2a = uprv_min(s2a, fFields.elementAti(j * 4 + 2));
- s2b = uprv_max(s2b, fFields.elementAti(j * 4 + 3));
- break;
- }
- }
- if (s1a != INT32_MAX) {
- // Success: add the two span fields
- fFields.addElement(spanCategory, status);
- fFields.addElement(firstIndex, status);
- fFields.addElement(s1a, status);
- fFields.addElement(s1b, status);
- fFields.addElement(spanCategory, status);
- fFields.addElement(1 - firstIndex, status);
- fFields.addElement(s2a, status);
- fFields.addElement(s2b, status);
- }
-}
-
-
-void FormattedValueFieldPositionIteratorImpl::sort() {
- // Use bubble sort, O(N^2) but easy and no fancy data structures.
- int32_t numFields = fFields.size() / 4;
- while (true) {
- bool isSorted = true;
- for (int32_t i=0; i<numFields-1; i++) {
- int32_t categ1 = fFields.elementAti(i*4 + 0);
- int32_t field1 = fFields.elementAti(i*4 + 1);
- int32_t start1 = fFields.elementAti(i*4 + 2);
- int32_t limit1 = fFields.elementAti(i*4 + 3);
- int32_t categ2 = fFields.elementAti(i*4 + 4);
- int32_t field2 = fFields.elementAti(i*4 + 5);
- int32_t start2 = fFields.elementAti(i*4 + 6);
- int32_t limit2 = fFields.elementAti(i*4 + 7);
- int64_t comparison = 0;
- if (start1 != start2) {
- // Higher start index -> higher rank
- comparison = start2 - start1;
- } else if (limit1 != limit2) {
- // Higher length (end index) -> lower rank
- comparison = limit1 - limit2;
- } else if (categ1 != categ2) {
- // Higher field category -> lower rank
- comparison = categ1 - categ2;
- } else if (field1 != field2) {
- // Higher field -> higher rank
- comparison = field2 - field1;
- }
- if (comparison < 0) {
- // Perform a swap
- isSorted = false;
- fFields.setElementAt(categ2, i*4 + 0);
- fFields.setElementAt(field2, i*4 + 1);
- fFields.setElementAt(start2, i*4 + 2);
- fFields.setElementAt(limit2, i*4 + 3);
- fFields.setElementAt(categ1, i*4 + 4);
- fFields.setElementAt(field1, i*4 + 5);
- fFields.setElementAt(start1, i*4 + 6);
- fFields.setElementAt(limit1, i*4 + 7);
- }
- }
- if (isSorted) {
- break;
- }
- }
-}
-
-
-U_NAMESPACE_END
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// This file contains one implementation of FormattedValue.
+// Other independent implementations should go into their own cpp file for
+// better dependency modularization.
+
+#include "formattedval_impl.h"
+#include "putilimp.h"
+
+U_NAMESPACE_BEGIN
+
+
+FormattedValueFieldPositionIteratorImpl::FormattedValueFieldPositionIteratorImpl(
+ int32_t initialFieldCapacity,
+ UErrorCode& status)
+ : fFields(initialFieldCapacity * 4, status) {
+}
+
+FormattedValueFieldPositionIteratorImpl::~FormattedValueFieldPositionIteratorImpl() = default;
+
+UnicodeString FormattedValueFieldPositionIteratorImpl::toString(
+ UErrorCode&) const {
+ return fString;
+}
+
+UnicodeString FormattedValueFieldPositionIteratorImpl::toTempString(
+ UErrorCode&) const {
+ // The alias must point to memory owned by this object;
+ // fastCopyFrom doesn't do this when using a stack buffer.
+ return UnicodeString(TRUE, fString.getBuffer(), fString.length());
+}
+
+Appendable& FormattedValueFieldPositionIteratorImpl::appendTo(
+ Appendable& appendable,
+ UErrorCode&) const {
+ appendable.appendString(fString.getBuffer(), fString.length());
+ return appendable;
+}
+
+UBool FormattedValueFieldPositionIteratorImpl::nextPosition(
+ ConstrainedFieldPosition& cfpos,
+ UErrorCode&) const {
+ U_ASSERT(fFields.size() % 4 == 0);
+ int32_t numFields = fFields.size() / 4;
+ int32_t i = static_cast<int32_t>(cfpos.getInt64IterationContext());
+ for (; i < numFields; i++) {
+ UFieldCategory category = static_cast<UFieldCategory>(fFields.elementAti(i * 4));
+ int32_t field = fFields.elementAti(i * 4 + 1);
+ if (cfpos.matchesField(category, field)) {
+ int32_t start = fFields.elementAti(i * 4 + 2);
+ int32_t limit = fFields.elementAti(i * 4 + 3);
+ cfpos.setState(category, field, start, limit);
+ break;
+ }
+ }
+ cfpos.setInt64IterationContext(i == numFields ? i : i + 1);
+ return i < numFields;
+}
+
+
+FieldPositionIteratorHandler FormattedValueFieldPositionIteratorImpl::getHandler(
+ UErrorCode& status) {
+ return FieldPositionIteratorHandler(&fFields, status);
+}
+
+void FormattedValueFieldPositionIteratorImpl::appendString(
+ UnicodeString string,
+ UErrorCode& status) {
+ if (U_FAILURE(status)) {
+ return;
+ }
+ fString.append(string);
+ // Make the string NUL-terminated
+ if (fString.getTerminatedBuffer() == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+}
+
+
+void FormattedValueFieldPositionIteratorImpl::addOverlapSpans(
+ UFieldCategory spanCategory,
+ int8_t firstIndex,
+ UErrorCode& status) {
+ // In order to avoid fancy data structures, this is an O(N^2) algorithm,
+ // which should be fine for all real-life applications of this function.
+ int32_t s1a = INT32_MAX;
+ int32_t s1b = 0;
+ int32_t s2a = INT32_MAX;
+ int32_t s2b = 0;
+ int32_t numFields = fFields.size() / 4;
+ for (int32_t i = 0; i<numFields; i++) {
+ int32_t field1 = fFields.elementAti(i * 4 + 1);
+ for (int32_t j = i + 1; j<numFields; j++) {
+ int32_t field2 = fFields.elementAti(j * 4 + 1);
+ if (field1 != field2) {
+ continue;
+ }
+ // Found a duplicate
+ s1a = uprv_min(s1a, fFields.elementAti(i * 4 + 2));
+ s1b = uprv_max(s1b, fFields.elementAti(i * 4 + 3));
+ s2a = uprv_min(s2a, fFields.elementAti(j * 4 + 2));
+ s2b = uprv_max(s2b, fFields.elementAti(j * 4 + 3));
+ break;
+ }
+ }
+ if (s1a != INT32_MAX) {
+ // Success: add the two span fields
+ fFields.addElement(spanCategory, status);
+ fFields.addElement(firstIndex, status);
+ fFields.addElement(s1a, status);
+ fFields.addElement(s1b, status);
+ fFields.addElement(spanCategory, status);
+ fFields.addElement(1 - firstIndex, status);
+ fFields.addElement(s2a, status);
+ fFields.addElement(s2b, status);
+ }
+}
+
+
+void FormattedValueFieldPositionIteratorImpl::sort() {
+ // Use bubble sort, O(N^2) but easy and no fancy data structures.
+ int32_t numFields = fFields.size() / 4;
+ while (true) {
+ bool isSorted = true;
+ for (int32_t i=0; i<numFields-1; i++) {
+ int32_t categ1 = fFields.elementAti(i*4 + 0);
+ int32_t field1 = fFields.elementAti(i*4 + 1);
+ int32_t start1 = fFields.elementAti(i*4 + 2);
+ int32_t limit1 = fFields.elementAti(i*4 + 3);
+ int32_t categ2 = fFields.elementAti(i*4 + 4);
+ int32_t field2 = fFields.elementAti(i*4 + 5);
+ int32_t start2 = fFields.elementAti(i*4 + 6);
+ int32_t limit2 = fFields.elementAti(i*4 + 7);
+ int64_t comparison = 0;
+ if (start1 != start2) {
+ // Higher start index -> higher rank
+ comparison = start2 - start1;
+ } else if (limit1 != limit2) {
+ // Higher length (end index) -> lower rank
+ comparison = limit1 - limit2;
+ } else if (categ1 != categ2) {
+ // Higher field category -> lower rank
+ comparison = categ1 - categ2;
+ } else if (field1 != field2) {
+ // Higher field -> higher rank
+ comparison = field2 - field1;
+ }
+ if (comparison < 0) {
+ // Perform a swap
+ isSorted = false;
+ fFields.setElementAt(categ2, i*4 + 0);
+ fFields.setElementAt(field2, i*4 + 1);
+ fFields.setElementAt(start2, i*4 + 2);
+ fFields.setElementAt(limit2, i*4 + 3);
+ fFields.setElementAt(categ1, i*4 + 4);
+ fFields.setElementAt(field1, i*4 + 5);
+ fFields.setElementAt(start1, i*4 + 6);
+ fFields.setElementAt(limit1, i*4 + 7);
+ }
+ }
+ if (isSorted) {
+ break;
+ }
+ }
+}
+
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/formattedval_sbimpl.cpp b/contrib/libs/icu/i18n/formattedval_sbimpl.cpp
index 79e9ede975..dfe3af6686 100644
--- a/contrib/libs/icu/i18n/formattedval_sbimpl.cpp
+++ b/contrib/libs/icu/i18n/formattedval_sbimpl.cpp
@@ -1,207 +1,207 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// This file contains one implementation of FormattedValue.
-// Other independent implementations should go into their own cpp file for
-// better dependency modularization.
-
-#include "unicode/ustring.h"
-#include "formattedval_impl.h"
-#include "number_types.h"
-#include "formatted_string_builder.h"
-#include "number_utils.h"
-#include "static_unicode_sets.h"
-
-U_NAMESPACE_BEGIN
-
-
-typedef FormattedStringBuilder::Field Field;
-
-
-FormattedValueStringBuilderImpl::FormattedValueStringBuilderImpl(Field numericField)
- : fNumericField(numericField) {
-}
-
-FormattedValueStringBuilderImpl::~FormattedValueStringBuilderImpl() {
-}
-
-
-UnicodeString FormattedValueStringBuilderImpl::toString(UErrorCode&) const {
- return fString.toUnicodeString();
-}
-
-UnicodeString FormattedValueStringBuilderImpl::toTempString(UErrorCode&) const {
- return fString.toTempUnicodeString();
-}
-
-Appendable& FormattedValueStringBuilderImpl::appendTo(Appendable& appendable, UErrorCode&) const {
- appendable.appendString(fString.chars(), fString.length());
- return appendable;
-}
-
-UBool FormattedValueStringBuilderImpl::nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const {
- // NOTE: MSVC sometimes complains when implicitly converting between bool and UBool
- return nextPositionImpl(cfpos, fNumericField, status) ? TRUE : FALSE;
-}
-
-UBool FormattedValueStringBuilderImpl::nextFieldPosition(FieldPosition& fp, UErrorCode& status) const {
- int32_t rawField = fp.getField();
-
- if (rawField == FieldPosition::DONT_CARE) {
- return FALSE;
- }
-
- if (rawField < 0 || rawField >= UNUM_FIELD_COUNT) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return FALSE;
- }
-
- ConstrainedFieldPosition cfpos;
- cfpos.constrainField(UFIELD_CATEGORY_NUMBER, rawField);
- cfpos.setState(UFIELD_CATEGORY_NUMBER, rawField, fp.getBeginIndex(), fp.getEndIndex());
- if (nextPositionImpl(cfpos, kUndefinedField, status)) {
- fp.setBeginIndex(cfpos.getStart());
- fp.setEndIndex(cfpos.getLimit());
- return TRUE;
- }
-
- // Special case: fraction should start after integer if fraction is not present
- if (rawField == UNUM_FRACTION_FIELD && fp.getEndIndex() == 0) {
- bool inside = false;
- int32_t i = fString.fZero;
- for (; i < fString.fZero + fString.fLength; i++) {
- if (isIntOrGroup(fString.getFieldPtr()[i]) || fString.getFieldPtr()[i] == Field(UFIELD_CATEGORY_NUMBER, UNUM_DECIMAL_SEPARATOR_FIELD)) {
- inside = true;
- } else if (inside) {
- break;
- }
- }
- fp.setBeginIndex(i - fString.fZero);
- fp.setEndIndex(i - fString.fZero);
- }
-
- return FALSE;
-}
-
-void FormattedValueStringBuilderImpl::getAllFieldPositions(FieldPositionIteratorHandler& fpih,
- UErrorCode& status) const {
- ConstrainedFieldPosition cfpos;
- while (nextPositionImpl(cfpos, kUndefinedField, status)) {
- fpih.addAttribute(cfpos.getField(), cfpos.getStart(), cfpos.getLimit());
- }
-}
-
-// Signal the end of the string using a field that doesn't exist and that is
-// different from kUndefinedField, which is used for "null field".
-static constexpr Field kEndField = Field(0xf, 0xf);
-
-bool FormattedValueStringBuilderImpl::nextPositionImpl(ConstrainedFieldPosition& cfpos, Field numericField, UErrorCode& /*status*/) const {
- int32_t fieldStart = -1;
- Field currField = kUndefinedField;
- for (int32_t i = fString.fZero + cfpos.getLimit(); i <= fString.fZero + fString.fLength; i++) {
- Field _field = (i < fString.fZero + fString.fLength) ? fString.getFieldPtr()[i] : kEndField;
- // Case 1: currently scanning a field.
- if (currField != kUndefinedField) {
- if (currField != _field) {
- int32_t end = i - fString.fZero;
- // Grouping separators can be whitespace; don't throw them out!
- if (currField != Field(UFIELD_CATEGORY_NUMBER, UNUM_GROUPING_SEPARATOR_FIELD)) {
- end = trimBack(i - fString.fZero);
- }
- if (end <= fieldStart) {
- // Entire field position is ignorable; skip.
- fieldStart = -1;
- currField = kUndefinedField;
- i--; // look at this index again
- continue;
- }
- int32_t start = fieldStart;
- if (currField != Field(UFIELD_CATEGORY_NUMBER, UNUM_GROUPING_SEPARATOR_FIELD)) {
- start = trimFront(start);
- }
- cfpos.setState(currField.getCategory(), currField.getField(), start, end);
- return true;
- }
- continue;
- }
- // Special case: coalesce the INTEGER if we are pointing at the end of the INTEGER.
- if (cfpos.matchesField(UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD)
- && i > fString.fZero
- // don't return the same field twice in a row:
- && i - fString.fZero > cfpos.getLimit()
- && isIntOrGroup(fString.getFieldPtr()[i - 1])
- && !isIntOrGroup(_field)) {
- int j = i - 1;
- for (; j >= fString.fZero && isIntOrGroup(fString.getFieldPtr()[j]); j--) {}
- cfpos.setState(
- UFIELD_CATEGORY_NUMBER,
- UNUM_INTEGER_FIELD,
- j - fString.fZero + 1,
- i - fString.fZero);
- return true;
- }
- // Special case: coalesce NUMERIC if we are pointing at the end of the NUMERIC.
- if (numericField != kUndefinedField
- && cfpos.matchesField(numericField.getCategory(), numericField.getField())
- && i > fString.fZero
- // don't return the same field twice in a row:
- && (i - fString.fZero > cfpos.getLimit()
- || cfpos.getCategory() != numericField.getCategory()
- || cfpos.getField() != numericField.getField())
- && fString.getFieldPtr()[i - 1].isNumeric()
- && !_field.isNumeric()) {
- int j = i - 1;
- for (; j >= fString.fZero && fString.getFieldPtr()[j].isNumeric(); j--) {}
- cfpos.setState(
- numericField.getCategory(),
- numericField.getField(),
- j - fString.fZero + 1,
- i - fString.fZero);
- return true;
- }
- // Special case: skip over INTEGER; will be coalesced later.
- if (_field == Field(UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD)) {
- _field = kUndefinedField;
- }
- // Case 2: no field starting at this position.
- if (_field.isUndefined() || _field == kEndField) {
- continue;
- }
- // Case 3: check for field starting at this position
- if (cfpos.matchesField(_field.getCategory(), _field.getField())) {
- fieldStart = i - fString.fZero;
- currField = _field;
- }
- }
-
- U_ASSERT(currField == kUndefinedField);
- return false;
-}
-
-bool FormattedValueStringBuilderImpl::isIntOrGroup(Field field) {
- return field == Field(UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD)
- || field == Field(UFIELD_CATEGORY_NUMBER, UNUM_GROUPING_SEPARATOR_FIELD);
-}
-
-int32_t FormattedValueStringBuilderImpl::trimBack(int32_t limit) const {
- return unisets::get(unisets::DEFAULT_IGNORABLES)->spanBack(
- fString.getCharPtr() + fString.fZero,
- limit,
- USET_SPAN_CONTAINED);
-}
-
-int32_t FormattedValueStringBuilderImpl::trimFront(int32_t start) const {
- return start + unisets::get(unisets::DEFAULT_IGNORABLES)->span(
- fString.getCharPtr() + fString.fZero + start,
- fString.fLength - start,
- USET_SPAN_CONTAINED);
-}
-
-
-U_NAMESPACE_END
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// This file contains one implementation of FormattedValue.
+// Other independent implementations should go into their own cpp file for
+// better dependency modularization.
+
+#include "unicode/ustring.h"
+#include "formattedval_impl.h"
+#include "number_types.h"
+#include "formatted_string_builder.h"
+#include "number_utils.h"
+#include "static_unicode_sets.h"
+
+U_NAMESPACE_BEGIN
+
+
+typedef FormattedStringBuilder::Field Field;
+
+
+FormattedValueStringBuilderImpl::FormattedValueStringBuilderImpl(Field numericField)
+ : fNumericField(numericField) {
+}
+
+FormattedValueStringBuilderImpl::~FormattedValueStringBuilderImpl() {
+}
+
+
+UnicodeString FormattedValueStringBuilderImpl::toString(UErrorCode&) const {
+ return fString.toUnicodeString();
+}
+
+UnicodeString FormattedValueStringBuilderImpl::toTempString(UErrorCode&) const {
+ return fString.toTempUnicodeString();
+}
+
+Appendable& FormattedValueStringBuilderImpl::appendTo(Appendable& appendable, UErrorCode&) const {
+ appendable.appendString(fString.chars(), fString.length());
+ return appendable;
+}
+
+UBool FormattedValueStringBuilderImpl::nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const {
+ // NOTE: MSVC sometimes complains when implicitly converting between bool and UBool
+ return nextPositionImpl(cfpos, fNumericField, status) ? TRUE : FALSE;
+}
+
+UBool FormattedValueStringBuilderImpl::nextFieldPosition(FieldPosition& fp, UErrorCode& status) const {
+ int32_t rawField = fp.getField();
+
+ if (rawField == FieldPosition::DONT_CARE) {
+ return FALSE;
+ }
+
+ if (rawField < 0 || rawField >= UNUM_FIELD_COUNT) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return FALSE;
+ }
+
+ ConstrainedFieldPosition cfpos;
+ cfpos.constrainField(UFIELD_CATEGORY_NUMBER, rawField);
+ cfpos.setState(UFIELD_CATEGORY_NUMBER, rawField, fp.getBeginIndex(), fp.getEndIndex());
+ if (nextPositionImpl(cfpos, kUndefinedField, status)) {
+ fp.setBeginIndex(cfpos.getStart());
+ fp.setEndIndex(cfpos.getLimit());
+ return TRUE;
+ }
+
+ // Special case: fraction should start after integer if fraction is not present
+ if (rawField == UNUM_FRACTION_FIELD && fp.getEndIndex() == 0) {
+ bool inside = false;
+ int32_t i = fString.fZero;
+ for (; i < fString.fZero + fString.fLength; i++) {
+ if (isIntOrGroup(fString.getFieldPtr()[i]) || fString.getFieldPtr()[i] == Field(UFIELD_CATEGORY_NUMBER, UNUM_DECIMAL_SEPARATOR_FIELD)) {
+ inside = true;
+ } else if (inside) {
+ break;
+ }
+ }
+ fp.setBeginIndex(i - fString.fZero);
+ fp.setEndIndex(i - fString.fZero);
+ }
+
+ return FALSE;
+}
+
+void FormattedValueStringBuilderImpl::getAllFieldPositions(FieldPositionIteratorHandler& fpih,
+ UErrorCode& status) const {
+ ConstrainedFieldPosition cfpos;
+ while (nextPositionImpl(cfpos, kUndefinedField, status)) {
+ fpih.addAttribute(cfpos.getField(), cfpos.getStart(), cfpos.getLimit());
+ }
+}
+
+// Signal the end of the string using a field that doesn't exist and that is
+// different from kUndefinedField, which is used for "null field".
+static constexpr Field kEndField = Field(0xf, 0xf);
+
+bool FormattedValueStringBuilderImpl::nextPositionImpl(ConstrainedFieldPosition& cfpos, Field numericField, UErrorCode& /*status*/) const {
+ int32_t fieldStart = -1;
+ Field currField = kUndefinedField;
+ for (int32_t i = fString.fZero + cfpos.getLimit(); i <= fString.fZero + fString.fLength; i++) {
+ Field _field = (i < fString.fZero + fString.fLength) ? fString.getFieldPtr()[i] : kEndField;
+ // Case 1: currently scanning a field.
+ if (currField != kUndefinedField) {
+ if (currField != _field) {
+ int32_t end = i - fString.fZero;
+ // Grouping separators can be whitespace; don't throw them out!
+ if (currField != Field(UFIELD_CATEGORY_NUMBER, UNUM_GROUPING_SEPARATOR_FIELD)) {
+ end = trimBack(i - fString.fZero);
+ }
+ if (end <= fieldStart) {
+ // Entire field position is ignorable; skip.
+ fieldStart = -1;
+ currField = kUndefinedField;
+ i--; // look at this index again
+ continue;
+ }
+ int32_t start = fieldStart;
+ if (currField != Field(UFIELD_CATEGORY_NUMBER, UNUM_GROUPING_SEPARATOR_FIELD)) {
+ start = trimFront(start);
+ }
+ cfpos.setState(currField.getCategory(), currField.getField(), start, end);
+ return true;
+ }
+ continue;
+ }
+ // Special case: coalesce the INTEGER if we are pointing at the end of the INTEGER.
+ if (cfpos.matchesField(UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD)
+ && i > fString.fZero
+ // don't return the same field twice in a row:
+ && i - fString.fZero > cfpos.getLimit()
+ && isIntOrGroup(fString.getFieldPtr()[i - 1])
+ && !isIntOrGroup(_field)) {
+ int j = i - 1;
+ for (; j >= fString.fZero && isIntOrGroup(fString.getFieldPtr()[j]); j--) {}
+ cfpos.setState(
+ UFIELD_CATEGORY_NUMBER,
+ UNUM_INTEGER_FIELD,
+ j - fString.fZero + 1,
+ i - fString.fZero);
+ return true;
+ }
+ // Special case: coalesce NUMERIC if we are pointing at the end of the NUMERIC.
+ if (numericField != kUndefinedField
+ && cfpos.matchesField(numericField.getCategory(), numericField.getField())
+ && i > fString.fZero
+ // don't return the same field twice in a row:
+ && (i - fString.fZero > cfpos.getLimit()
+ || cfpos.getCategory() != numericField.getCategory()
+ || cfpos.getField() != numericField.getField())
+ && fString.getFieldPtr()[i - 1].isNumeric()
+ && !_field.isNumeric()) {
+ int j = i - 1;
+ for (; j >= fString.fZero && fString.getFieldPtr()[j].isNumeric(); j--) {}
+ cfpos.setState(
+ numericField.getCategory(),
+ numericField.getField(),
+ j - fString.fZero + 1,
+ i - fString.fZero);
+ return true;
+ }
+ // Special case: skip over INTEGER; will be coalesced later.
+ if (_field == Field(UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD)) {
+ _field = kUndefinedField;
+ }
+ // Case 2: no field starting at this position.
+ if (_field.isUndefined() || _field == kEndField) {
+ continue;
+ }
+ // Case 3: check for field starting at this position
+ if (cfpos.matchesField(_field.getCategory(), _field.getField())) {
+ fieldStart = i - fString.fZero;
+ currField = _field;
+ }
+ }
+
+ U_ASSERT(currField == kUndefinedField);
+ return false;
+}
+
+bool FormattedValueStringBuilderImpl::isIntOrGroup(Field field) {
+ return field == Field(UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD)
+ || field == Field(UFIELD_CATEGORY_NUMBER, UNUM_GROUPING_SEPARATOR_FIELD);
+}
+
+int32_t FormattedValueStringBuilderImpl::trimBack(int32_t limit) const {
+ return unisets::get(unisets::DEFAULT_IGNORABLES)->spanBack(
+ fString.getCharPtr() + fString.fZero,
+ limit,
+ USET_SPAN_CONTAINED);
+}
+
+int32_t FormattedValueStringBuilderImpl::trimFront(int32_t start) const {
+ return start + unisets::get(unisets::DEFAULT_IGNORABLES)->span(
+ fString.getCharPtr() + fString.fZero + start,
+ fString.fLength - start,
+ USET_SPAN_CONTAINED);
+}
+
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/formattedvalue.cpp b/contrib/libs/icu/i18n/formattedvalue.cpp
index aada0f903f..e2c9c42fc8 100644
--- a/contrib/libs/icu/i18n/formattedvalue.cpp
+++ b/contrib/libs/icu/i18n/formattedvalue.cpp
@@ -1,232 +1,232 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/formattedvalue.h"
-#include "formattedval_impl.h"
-#include "capi_helper.h"
-
-U_NAMESPACE_BEGIN
-
-
-ConstrainedFieldPosition::ConstrainedFieldPosition() {}
-
-ConstrainedFieldPosition::~ConstrainedFieldPosition() {}
-
-void ConstrainedFieldPosition::reset() {
- fContext = 0LL;
- fField = 0;
- fStart = 0;
- fLimit = 0;
- fConstraint = UCFPOS_CONSTRAINT_NONE;
- fCategory = UFIELD_CATEGORY_UNDEFINED;
-}
-
-void ConstrainedFieldPosition::constrainCategory(int32_t category) {
- fConstraint = UCFPOS_CONSTRAINT_CATEGORY;
- fCategory = category;
-}
-
-void ConstrainedFieldPosition::constrainField(int32_t category, int32_t field) {
- fConstraint = UCFPOS_CONSTRAINT_FIELD;
- fCategory = category;
- fField = field;
-}
-
-void ConstrainedFieldPosition::setInt64IterationContext(int64_t context) {
- fContext = context;
-}
-
-UBool ConstrainedFieldPosition::matchesField(int32_t category, int32_t field) const {
- switch (fConstraint) {
- case UCFPOS_CONSTRAINT_NONE:
- return TRUE;
- case UCFPOS_CONSTRAINT_CATEGORY:
- return fCategory == category;
- case UCFPOS_CONSTRAINT_FIELD:
- return fCategory == category && fField == field;
- default:
- UPRV_UNREACHABLE;
- }
-}
-
-void ConstrainedFieldPosition::setState(
- int32_t category,
- int32_t field,
- int32_t start,
- int32_t limit) {
- fCategory = category;
- fField = field;
- fStart = start;
- fLimit = limit;
-}
-
-
-FormattedValue::~FormattedValue() = default;
-
-
-///////////////////////
-/// C API FUNCTIONS ///
-///////////////////////
-
-struct UConstrainedFieldPositionImpl : public UMemory,
- // Magic number as ASCII == "UCF"
- public IcuCApiHelper<UConstrainedFieldPosition, UConstrainedFieldPositionImpl, 0x55434600> {
- ConstrainedFieldPosition fImpl;
-};
-
-U_CAPI UConstrainedFieldPosition* U_EXPORT2
-ucfpos_open(UErrorCode* ec) {
- auto* impl = new UConstrainedFieldPositionImpl();
- if (impl == nullptr) {
- *ec = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
- return impl->exportForC();
-}
-
-U_CAPI void U_EXPORT2
-ucfpos_reset(UConstrainedFieldPosition* ptr, UErrorCode* ec) {
- auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
- if (U_FAILURE(*ec)) {
- return;
- }
- impl->fImpl.reset();
-}
-
-U_CAPI void U_EXPORT2
-ucfpos_constrainCategory(UConstrainedFieldPosition* ptr, int32_t category, UErrorCode* ec) {
- auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
- if (U_FAILURE(*ec)) {
- return;
- }
- impl->fImpl.constrainCategory(category);
-}
-
-U_CAPI void U_EXPORT2
-ucfpos_constrainField(UConstrainedFieldPosition* ptr, int32_t category, int32_t field, UErrorCode* ec) {
- auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
- if (U_FAILURE(*ec)) {
- return;
- }
- impl->fImpl.constrainField(category, field);
-}
-
-U_CAPI int32_t U_EXPORT2
-ucfpos_getCategory(const UConstrainedFieldPosition* ptr, UErrorCode* ec) {
- const auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
- if (U_FAILURE(*ec)) {
- return UFIELD_CATEGORY_UNDEFINED;
- }
- return impl->fImpl.getCategory();
-}
-
-U_CAPI int32_t U_EXPORT2
-ucfpos_getField(const UConstrainedFieldPosition* ptr, UErrorCode* ec) {
- const auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
- if (U_FAILURE(*ec)) {
- return 0;
- }
- return impl->fImpl.getField();
-}
-
-U_CAPI void U_EXPORT2
-ucfpos_getIndexes(const UConstrainedFieldPosition* ptr, int32_t* pStart, int32_t* pLimit, UErrorCode* ec) {
- const auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
- if (U_FAILURE(*ec)) {
- return;
- }
- *pStart = impl->fImpl.getStart();
- *pLimit = impl->fImpl.getLimit();
-}
-
-U_CAPI int64_t U_EXPORT2
-ucfpos_getInt64IterationContext(const UConstrainedFieldPosition* ptr, UErrorCode* ec) {
- const auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
- if (U_FAILURE(*ec)) {
- return 0;
- }
- return impl->fImpl.getInt64IterationContext();
-}
-
-U_CAPI void U_EXPORT2
-ucfpos_setInt64IterationContext(UConstrainedFieldPosition* ptr, int64_t context, UErrorCode* ec) {
- auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
- if (U_FAILURE(*ec)) {
- return;
- }
- impl->fImpl.setInt64IterationContext(context);
-}
-
-U_CAPI UBool U_EXPORT2
-ucfpos_matchesField(const UConstrainedFieldPosition* ptr, int32_t category, int32_t field, UErrorCode* ec) {
- const auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
- if (U_FAILURE(*ec)) {
- return 0;
- }
- return impl->fImpl.matchesField(category, field);
-}
-
-U_CAPI void U_EXPORT2
-ucfpos_setState(
- UConstrainedFieldPosition* ptr,
- int32_t category,
- int32_t field,
- int32_t start,
- int32_t limit,
- UErrorCode* ec) {
- auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
- if (U_FAILURE(*ec)) {
- return;
- }
- impl->fImpl.setState(category, field, start, limit);
-}
-
-U_CAPI void U_EXPORT2
-ucfpos_close(UConstrainedFieldPosition* ptr) {
- UErrorCode localStatus = U_ZERO_ERROR;
- auto* impl = UConstrainedFieldPositionImpl::validate(ptr, localStatus);
- delete impl;
-}
-
-
-U_DRAFT const UChar* U_EXPORT2
-ufmtval_getString(
- const UFormattedValue* ufmtval,
- int32_t* pLength,
- UErrorCode* ec) {
- const auto* impl = UFormattedValueApiHelper::validate(ufmtval, *ec);
- if (U_FAILURE(*ec)) {
- return nullptr;
- }
- UnicodeString readOnlyAlias = impl->fFormattedValue->toTempString(*ec);
- if (U_FAILURE(*ec)) {
- return nullptr;
- }
- if (pLength != nullptr) {
- *pLength = readOnlyAlias.length();
- }
- return readOnlyAlias.getBuffer();
-}
-
-
-U_DRAFT UBool U_EXPORT2
-ufmtval_nextPosition(
- const UFormattedValue* ufmtval,
- UConstrainedFieldPosition* ucfpos,
- UErrorCode* ec) {
- const auto* fmtval = UFormattedValueApiHelper::validate(ufmtval, *ec);
- auto* cfpos = UConstrainedFieldPositionImpl::validate(ucfpos, *ec);
- if (U_FAILURE(*ec)) {
- return FALSE;
- }
- return fmtval->fFormattedValue->nextPosition(cfpos->fImpl, *ec);
-}
-
-
-U_NAMESPACE_END
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/formattedvalue.h"
+#include "formattedval_impl.h"
+#include "capi_helper.h"
+
+U_NAMESPACE_BEGIN
+
+
+ConstrainedFieldPosition::ConstrainedFieldPosition() {}
+
+ConstrainedFieldPosition::~ConstrainedFieldPosition() {}
+
+void ConstrainedFieldPosition::reset() {
+ fContext = 0LL;
+ fField = 0;
+ fStart = 0;
+ fLimit = 0;
+ fConstraint = UCFPOS_CONSTRAINT_NONE;
+ fCategory = UFIELD_CATEGORY_UNDEFINED;
+}
+
+void ConstrainedFieldPosition::constrainCategory(int32_t category) {
+ fConstraint = UCFPOS_CONSTRAINT_CATEGORY;
+ fCategory = category;
+}
+
+void ConstrainedFieldPosition::constrainField(int32_t category, int32_t field) {
+ fConstraint = UCFPOS_CONSTRAINT_FIELD;
+ fCategory = category;
+ fField = field;
+}
+
+void ConstrainedFieldPosition::setInt64IterationContext(int64_t context) {
+ fContext = context;
+}
+
+UBool ConstrainedFieldPosition::matchesField(int32_t category, int32_t field) const {
+ switch (fConstraint) {
+ case UCFPOS_CONSTRAINT_NONE:
+ return TRUE;
+ case UCFPOS_CONSTRAINT_CATEGORY:
+ return fCategory == category;
+ case UCFPOS_CONSTRAINT_FIELD:
+ return fCategory == category && fField == field;
+ default:
+ UPRV_UNREACHABLE;
+ }
+}
+
+void ConstrainedFieldPosition::setState(
+ int32_t category,
+ int32_t field,
+ int32_t start,
+ int32_t limit) {
+ fCategory = category;
+ fField = field;
+ fStart = start;
+ fLimit = limit;
+}
+
+
+FormattedValue::~FormattedValue() = default;
+
+
+///////////////////////
+/// C API FUNCTIONS ///
+///////////////////////
+
+struct UConstrainedFieldPositionImpl : public UMemory,
+ // Magic number as ASCII == "UCF"
+ public IcuCApiHelper<UConstrainedFieldPosition, UConstrainedFieldPositionImpl, 0x55434600> {
+ ConstrainedFieldPosition fImpl;
+};
+
+U_CAPI UConstrainedFieldPosition* U_EXPORT2
+ucfpos_open(UErrorCode* ec) {
+ auto* impl = new UConstrainedFieldPositionImpl();
+ if (impl == nullptr) {
+ *ec = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+ return impl->exportForC();
+}
+
+U_CAPI void U_EXPORT2
+ucfpos_reset(UConstrainedFieldPosition* ptr, UErrorCode* ec) {
+ auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
+ if (U_FAILURE(*ec)) {
+ return;
+ }
+ impl->fImpl.reset();
+}
+
+U_CAPI void U_EXPORT2
+ucfpos_constrainCategory(UConstrainedFieldPosition* ptr, int32_t category, UErrorCode* ec) {
+ auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
+ if (U_FAILURE(*ec)) {
+ return;
+ }
+ impl->fImpl.constrainCategory(category);
+}
+
+U_CAPI void U_EXPORT2
+ucfpos_constrainField(UConstrainedFieldPosition* ptr, int32_t category, int32_t field, UErrorCode* ec) {
+ auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
+ if (U_FAILURE(*ec)) {
+ return;
+ }
+ impl->fImpl.constrainField(category, field);
+}
+
+U_CAPI int32_t U_EXPORT2
+ucfpos_getCategory(const UConstrainedFieldPosition* ptr, UErrorCode* ec) {
+ const auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
+ if (U_FAILURE(*ec)) {
+ return UFIELD_CATEGORY_UNDEFINED;
+ }
+ return impl->fImpl.getCategory();
+}
+
+U_CAPI int32_t U_EXPORT2
+ucfpos_getField(const UConstrainedFieldPosition* ptr, UErrorCode* ec) {
+ const auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
+ if (U_FAILURE(*ec)) {
+ return 0;
+ }
+ return impl->fImpl.getField();
+}
+
+U_CAPI void U_EXPORT2
+ucfpos_getIndexes(const UConstrainedFieldPosition* ptr, int32_t* pStart, int32_t* pLimit, UErrorCode* ec) {
+ const auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
+ if (U_FAILURE(*ec)) {
+ return;
+ }
+ *pStart = impl->fImpl.getStart();
+ *pLimit = impl->fImpl.getLimit();
+}
+
+U_CAPI int64_t U_EXPORT2
+ucfpos_getInt64IterationContext(const UConstrainedFieldPosition* ptr, UErrorCode* ec) {
+ const auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
+ if (U_FAILURE(*ec)) {
+ return 0;
+ }
+ return impl->fImpl.getInt64IterationContext();
+}
+
+U_CAPI void U_EXPORT2
+ucfpos_setInt64IterationContext(UConstrainedFieldPosition* ptr, int64_t context, UErrorCode* ec) {
+ auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
+ if (U_FAILURE(*ec)) {
+ return;
+ }
+ impl->fImpl.setInt64IterationContext(context);
+}
+
+U_CAPI UBool U_EXPORT2
+ucfpos_matchesField(const UConstrainedFieldPosition* ptr, int32_t category, int32_t field, UErrorCode* ec) {
+ const auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
+ if (U_FAILURE(*ec)) {
+ return 0;
+ }
+ return impl->fImpl.matchesField(category, field);
+}
+
+U_CAPI void U_EXPORT2
+ucfpos_setState(
+ UConstrainedFieldPosition* ptr,
+ int32_t category,
+ int32_t field,
+ int32_t start,
+ int32_t limit,
+ UErrorCode* ec) {
+ auto* impl = UConstrainedFieldPositionImpl::validate(ptr, *ec);
+ if (U_FAILURE(*ec)) {
+ return;
+ }
+ impl->fImpl.setState(category, field, start, limit);
+}
+
+U_CAPI void U_EXPORT2
+ucfpos_close(UConstrainedFieldPosition* ptr) {
+ UErrorCode localStatus = U_ZERO_ERROR;
+ auto* impl = UConstrainedFieldPositionImpl::validate(ptr, localStatus);
+ delete impl;
+}
+
+
+U_DRAFT const UChar* U_EXPORT2
+ufmtval_getString(
+ const UFormattedValue* ufmtval,
+ int32_t* pLength,
+ UErrorCode* ec) {
+ const auto* impl = UFormattedValueApiHelper::validate(ufmtval, *ec);
+ if (U_FAILURE(*ec)) {
+ return nullptr;
+ }
+ UnicodeString readOnlyAlias = impl->fFormattedValue->toTempString(*ec);
+ if (U_FAILURE(*ec)) {
+ return nullptr;
+ }
+ if (pLength != nullptr) {
+ *pLength = readOnlyAlias.length();
+ }
+ return readOnlyAlias.getBuffer();
+}
+
+
+U_DRAFT UBool U_EXPORT2
+ufmtval_nextPosition(
+ const UFormattedValue* ufmtval,
+ UConstrainedFieldPosition* ucfpos,
+ UErrorCode* ec) {
+ const auto* fmtval = UFormattedValueApiHelper::validate(ufmtval, *ec);
+ auto* cfpos = UConstrainedFieldPositionImpl::validate(ucfpos, *ec);
+ if (U_FAILURE(*ec)) {
+ return FALSE;
+ }
+ return fmtval->fFormattedValue->nextPosition(cfpos->fImpl, *ec);
+}
+
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/fphdlimp.cpp b/contrib/libs/icu/i18n/fphdlimp.cpp
index a15711f3ae..f51bf4bae7 100644
--- a/contrib/libs/icu/i18n/fphdlimp.cpp
+++ b/contrib/libs/icu/i18n/fphdlimp.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -22,8 +22,8 @@ U_NAMESPACE_BEGIN
FieldPositionHandler::~FieldPositionHandler() {
}
-void FieldPositionHandler::setShift(int32_t delta) {
- fShift = delta;
+void FieldPositionHandler::setShift(int32_t delta) {
+ fShift = delta;
}
@@ -38,10 +38,10 @@ FieldPositionOnlyHandler::~FieldPositionOnlyHandler() {
void
FieldPositionOnlyHandler::addAttribute(int32_t id, int32_t start, int32_t limit) {
- if (pos.getField() == id && (!acceptFirstOnly || !seenFirst)) {
- seenFirst = TRUE;
- pos.setBeginIndex(start + fShift);
- pos.setEndIndex(limit + fShift);
+ if (pos.getField() == id && (!acceptFirstOnly || !seenFirst)) {
+ seenFirst = TRUE;
+ pos.setBeginIndex(start + fShift);
+ pos.setEndIndex(limit + fShift);
}
}
@@ -58,27 +58,27 @@ FieldPositionOnlyHandler::isRecording(void) const {
return pos.getField() != FieldPosition::DONT_CARE;
}
-void FieldPositionOnlyHandler::setAcceptFirstOnly(UBool acceptFirstOnly) {
- this->acceptFirstOnly = acceptFirstOnly;
-}
+void FieldPositionOnlyHandler::setAcceptFirstOnly(UBool acceptFirstOnly) {
+ this->acceptFirstOnly = acceptFirstOnly;
+}
+
-
// utility subclass FieldPositionIteratorHandler
FieldPositionIteratorHandler::FieldPositionIteratorHandler(FieldPositionIterator* posIter,
UErrorCode& _status)
- : iter(posIter), vec(NULL), status(_status), fCategory(UFIELD_CATEGORY_UNDEFINED) {
+ : iter(posIter), vec(NULL), status(_status), fCategory(UFIELD_CATEGORY_UNDEFINED) {
if (iter && U_SUCCESS(status)) {
vec = new UVector32(status);
}
}
-FieldPositionIteratorHandler::FieldPositionIteratorHandler(
- UVector32* vec,
- UErrorCode& status)
- : iter(nullptr), vec(vec), status(status), fCategory(UFIELD_CATEGORY_UNDEFINED) {
-}
-
+FieldPositionIteratorHandler::FieldPositionIteratorHandler(
+ UVector32* vec,
+ UErrorCode& status)
+ : iter(nullptr), vec(vec), status(status), fCategory(UFIELD_CATEGORY_UNDEFINED) {
+}
+
FieldPositionIteratorHandler::~FieldPositionIteratorHandler() {
// setData adopts the vec regardless of status, so it's safe to null it
if (iter) {
@@ -90,12 +90,12 @@ FieldPositionIteratorHandler::~FieldPositionIteratorHandler() {
void
FieldPositionIteratorHandler::addAttribute(int32_t id, int32_t start, int32_t limit) {
- if (vec && U_SUCCESS(status) && start < limit) {
+ if (vec && U_SUCCESS(status) && start < limit) {
int32_t size = vec->size();
- vec->addElement(fCategory, status);
+ vec->addElement(fCategory, status);
vec->addElement(id, status);
- vec->addElement(start + fShift, status);
- vec->addElement(limit + fShift, status);
+ vec->addElement(start + fShift, status);
+ vec->addElement(limit + fShift, status);
if (!U_SUCCESS(status)) {
vec->setSize(size);
}
diff --git a/contrib/libs/icu/i18n/fphdlimp.h b/contrib/libs/icu/i18n/fphdlimp.h
index 5a5bd06515..b9fa9b2181 100644
--- a/contrib/libs/icu/i18n/fphdlimp.h
+++ b/contrib/libs/icu/i18n/fphdlimp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -10,13 +10,13 @@
#ifndef FPHDLIMP_H
#define FPHDLIMP_H
-#include "unicode/utypes.h"
-
+#include "unicode/utypes.h"
+
#if !UCONFIG_NO_FORMATTING
#include "unicode/fieldpos.h"
#include "unicode/fpositer.h"
-#include "unicode/formattedvalue.h"
+#include "unicode/formattedvalue.h"
U_NAMESPACE_BEGIN
@@ -24,16 +24,16 @@ U_NAMESPACE_BEGIN
// base class, null implementation
class U_I18N_API FieldPositionHandler: public UMemory {
- protected:
- int32_t fShift = 0;
-
+ protected:
+ int32_t fShift = 0;
+
public:
virtual ~FieldPositionHandler();
- virtual void addAttribute(int32_t id, int32_t start, int32_t limit) = 0;
- virtual void shiftLast(int32_t delta) = 0;
- virtual UBool isRecording(void) const = 0;
-
- void setShift(int32_t delta);
+ virtual void addAttribute(int32_t id, int32_t start, int32_t limit) = 0;
+ virtual void shiftLast(int32_t delta) = 0;
+ virtual UBool isRecording(void) const = 0;
+
+ void setShift(int32_t delta);
};
@@ -41,65 +41,65 @@ class U_I18N_API FieldPositionHandler: public UMemory {
class FieldPositionOnlyHandler : public FieldPositionHandler {
FieldPosition& pos;
- UBool acceptFirstOnly = FALSE;
- UBool seenFirst = FALSE;
+ UBool acceptFirstOnly = FALSE;
+ UBool seenFirst = FALSE;
public:
FieldPositionOnlyHandler(FieldPosition& pos);
virtual ~FieldPositionOnlyHandler();
- void addAttribute(int32_t id, int32_t start, int32_t limit) U_OVERRIDE;
- void shiftLast(int32_t delta) U_OVERRIDE;
- UBool isRecording(void) const U_OVERRIDE;
-
- /**
- * Enable this option to lock in the FieldPosition value after seeing the
- * first occurrence of the field. The default behavior is to take the last
- * occurrence.
- */
- void setAcceptFirstOnly(UBool acceptFirstOnly);
+ void addAttribute(int32_t id, int32_t start, int32_t limit) U_OVERRIDE;
+ void shiftLast(int32_t delta) U_OVERRIDE;
+ UBool isRecording(void) const U_OVERRIDE;
+
+ /**
+ * Enable this option to lock in the FieldPosition value after seeing the
+ * first occurrence of the field. The default behavior is to take the last
+ * occurrence.
+ */
+ void setAcceptFirstOnly(UBool acceptFirstOnly);
};
// utility subclass FieldPositionIteratorHandler
-// exported as U_I18N_API for tests
+// exported as U_I18N_API for tests
-class U_I18N_API FieldPositionIteratorHandler : public FieldPositionHandler {
+class U_I18N_API FieldPositionIteratorHandler : public FieldPositionHandler {
FieldPositionIterator* iter; // can be NULL
UVector32* vec;
UErrorCode status;
- UFieldCategory fCategory;
+ UFieldCategory fCategory;
// Note, we keep a reference to status, so if status is on the stack, we have
// to be destroyed before status goes out of scope. Easiest thing is to
// allocate us on the stack in the same (or narrower) scope as status has.
// This attempts to encourage that by blocking heap allocation.
- static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete;
- static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete;
-#if U_HAVE_PLACEMENT_NEW
- static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete;
-#endif
+ static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete;
+ static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete;
+#if U_HAVE_PLACEMENT_NEW
+ static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete;
+#endif
public:
FieldPositionIteratorHandler(FieldPositionIterator* posIter, UErrorCode& status);
- /** If using this constructor, you must call getError() when done formatting! */
- FieldPositionIteratorHandler(UVector32* vec, UErrorCode& status);
+ /** If using this constructor, you must call getError() when done formatting! */
+ FieldPositionIteratorHandler(UVector32* vec, UErrorCode& status);
~FieldPositionIteratorHandler();
- void addAttribute(int32_t id, int32_t start, int32_t limit) U_OVERRIDE;
- void shiftLast(int32_t delta) U_OVERRIDE;
- UBool isRecording(void) const U_OVERRIDE;
-
- /** Copies a failed error code into _status. */
- inline void getError(UErrorCode& _status) {
- if (U_SUCCESS(_status) && U_FAILURE(status)) {
- _status = status;
- }
- }
-
- inline void setCategory(UFieldCategory category) {
- fCategory = category;
- }
+ void addAttribute(int32_t id, int32_t start, int32_t limit) U_OVERRIDE;
+ void shiftLast(int32_t delta) U_OVERRIDE;
+ UBool isRecording(void) const U_OVERRIDE;
+
+ /** Copies a failed error code into _status. */
+ inline void getError(UErrorCode& _status) {
+ if (U_SUCCESS(_status) && U_FAILURE(status)) {
+ _status = status;
+ }
+ }
+
+ inline void setCategory(UFieldCategory category) {
+ fCategory = category;
+ }
};
U_NAMESPACE_END
diff --git a/contrib/libs/icu/i18n/fpositer.cpp b/contrib/libs/icu/i18n/fpositer.cpp
index cf8cffe924..75d529eb8c 100644
--- a/contrib/libs/icu/i18n/fpositer.cpp
+++ b/contrib/libs/icu/i18n/fpositer.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -65,10 +65,10 @@ void FieldPositionIterator::setData(UVector32 *adopt, UErrorCode& status) {
if (adopt->size() == 0) {
delete adopt;
adopt = NULL;
- } else if ((adopt->size() % 4) != 0) {
+ } else if ((adopt->size() % 4) != 0) {
status = U_ILLEGAL_ARGUMENT_ERROR;
} else {
- for (int i = 2; i < adopt->size(); i += 4) {
+ for (int i = 2; i < adopt->size(); i += 4) {
if (adopt->elementAti(i) >= adopt->elementAti(i+1)) {
status = U_ILLEGAL_ARGUMENT_ERROR;
break;
@@ -95,8 +95,8 @@ UBool FieldPositionIterator::next(FieldPosition& fp) {
return FALSE;
}
- // Ignore the first element of the tetrad: used for field category
- pos++;
+ // Ignore the first element of the tetrad: used for field category
+ pos++;
fp.setField(data->elementAti(pos++));
fp.setBeginIndex(data->elementAti(pos++));
fp.setEndIndex(data->elementAti(pos++));
diff --git a/contrib/libs/icu/i18n/funcrepl.cpp b/contrib/libs/icu/i18n/funcrepl.cpp
index b754950cad..7dd54ed8d2 100644
--- a/contrib/libs/icu/i18n/funcrepl.cpp
+++ b/contrib/libs/icu/i18n/funcrepl.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -59,7 +59,7 @@ FunctionReplacer::~FunctionReplacer() {
/**
* Implement UnicodeFunctor
*/
-FunctionReplacer* FunctionReplacer::clone() const {
+FunctionReplacer* FunctionReplacer::clone() const {
return new FunctionReplacer(*this);
}
diff --git a/contrib/libs/icu/i18n/funcrepl.h b/contrib/libs/icu/i18n/funcrepl.h
index ffab79a271..fe41f6caaa 100644
--- a/contrib/libs/icu/i18n/funcrepl.h
+++ b/contrib/libs/icu/i18n/funcrepl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -70,7 +70,7 @@ class FunctionReplacer : public UnicodeFunctor, public UnicodeReplacer {
/**
* Implement UnicodeFunctor
*/
- virtual FunctionReplacer* clone() const;
+ virtual FunctionReplacer* clone() const;
/**
* UnicodeFunctor API. Cast 'this' to a UnicodeReplacer* pointer
diff --git a/contrib/libs/icu/i18n/gender.cpp b/contrib/libs/icu/i18n/gender.cpp
index 15dfc95b86..dc5def6ad3 100644
--- a/contrib/libs/icu/i18n/gender.cpp
+++ b/contrib/libs/icu/i18n/gender.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -32,7 +32,7 @@
#include "uhash.h"
static UHashtable* gGenderInfoCache = NULL;
-
+
static const char* gNeutralStr = "neutral";
static const char* gMailTaintsStr = "maleTaints";
static const char* gMixedNeutralStr = "mixedNeutral";
@@ -98,7 +98,7 @@ const GenderInfo* GenderInfo::getInstance(const Locale& locale, UErrorCode& stat
return NULL;
}
- static UMutex gGenderMetaLock;
+ static UMutex gGenderMetaLock;
const GenderInfo* result = NULL;
const char* key = locale.getName();
{
@@ -160,7 +160,7 @@ const GenderInfo* GenderInfo::loadInstance(const Locale& locale, UErrorCode& sta
if (s == NULL) {
return &gObjs[NEUTRAL];
}
- char type_str[256] = "";
+ char type_str[256] = "";
u_UCharsToChars(s, type_str, resLen + 1);
if (uprv_strcmp(type_str, gNeutralStr) == 0) {
return &gObjs[NEUTRAL];
diff --git a/contrib/libs/icu/i18n/gregocal.cpp b/contrib/libs/icu/i18n/gregocal.cpp
index 8af8af0e0c..6b15171c12 100644
--- a/contrib/libs/icu/i18n/gregocal.cpp
+++ b/contrib/libs/icu/i18n/gregocal.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -286,7 +286,7 @@ fIsGregorian(source.fIsGregorian), fInvertGregorian(source.fInvertGregorian)
// -------------------------------------
-GregorianCalendar* GregorianCalendar::clone() const
+GregorianCalendar* GregorianCalendar::clone() const
{
return new GregorianCalendar(*this);
}
@@ -330,20 +330,20 @@ GregorianCalendar::setGregorianChange(UDate date, UErrorCode& status)
// normalized cutover is in pure date milliseconds; it contains no time
// of day or timezone component, and it used to compare against other
// pure date values.
- double cutoverDay = ClockMath::floorDivide(date, (double)kOneDay);
-
- // Handle the rare case of numeric overflow where the user specifies a time
- // outside of INT32_MIN .. INT32_MAX number of days.
-
- if (cutoverDay <= INT32_MIN) {
- cutoverDay = INT32_MIN;
- fGregorianCutover = fNormalizedGregorianCutover = cutoverDay * kOneDay;
- } else if (cutoverDay >= INT32_MAX) {
- cutoverDay = INT32_MAX;
- fGregorianCutover = fNormalizedGregorianCutover = cutoverDay * kOneDay;
- } else {
- fNormalizedGregorianCutover = cutoverDay * kOneDay;
- fGregorianCutover = date;
+ double cutoverDay = ClockMath::floorDivide(date, (double)kOneDay);
+
+ // Handle the rare case of numeric overflow where the user specifies a time
+ // outside of INT32_MIN .. INT32_MAX number of days.
+
+ if (cutoverDay <= INT32_MIN) {
+ cutoverDay = INT32_MIN;
+ fGregorianCutover = fNormalizedGregorianCutover = cutoverDay * kOneDay;
+ } else if (cutoverDay >= INT32_MAX) {
+ cutoverDay = INT32_MAX;
+ fGregorianCutover = fNormalizedGregorianCutover = cutoverDay * kOneDay;
+ } else {
+ fNormalizedGregorianCutover = cutoverDay * kOneDay;
+ fGregorianCutover = date;
}
// Normalize the year so BC values are represented as 0 and negative
@@ -360,7 +360,7 @@ GregorianCalendar::setGregorianChange(UDate date, UErrorCode& status)
fGregorianCutoverYear = cal->get(UCAL_YEAR, status);
if (cal->get(UCAL_ERA, status) == BC)
fGregorianCutoverYear = 1 - fGregorianCutoverYear;
- fCutoverJulianDay = (int32_t)cutoverDay;
+ fCutoverJulianDay = (int32_t)cutoverDay;
delete cal;
}
@@ -541,8 +541,8 @@ int32_t GregorianCalendar::handleComputeMonthStart(int32_t eyear, int32_t month,
}
UBool isLeap = eyear%4 == 0;
- int64_t y = (int64_t)eyear-1;
- int64_t julianDay = 365*y + ClockMath::floorDivide(y, (int64_t)4) + (kJan1_1JulianDay - 3);
+ int64_t y = (int64_t)eyear-1;
+ int64_t julianDay = 365*y + ClockMath::floorDivide(y, (int64_t)4) + (kJan1_1JulianDay - 3);
nonConstThis->fIsGregorian = (eyear >= fGregorianCutoverYear);
#if defined (U_DEBUG_CAL)
@@ -572,7 +572,7 @@ int32_t GregorianCalendar::handleComputeMonthStart(int32_t eyear, int32_t month,
julianDay += isLeap?kLeapNumDays[month]:kNumDays[month];
}
- return static_cast<int32_t>(julianDay);
+ return static_cast<int32_t>(julianDay);
}
int32_t GregorianCalendar::handleGetMonthLength(int32_t extendedYear, int32_t month) const
diff --git a/contrib/libs/icu/i18n/gregoimp.cpp b/contrib/libs/icu/i18n/gregoimp.cpp
index f11d52ba5c..537aa19d8a 100644
--- a/contrib/libs/icu/i18n/gregoimp.cpp
+++ b/contrib/libs/icu/i18n/gregoimp.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -27,11 +27,11 @@ int32_t ClockMath::floorDivide(int32_t numerator, int32_t denominator) {
numerator / denominator : ((numerator + 1) / denominator) - 1;
}
-int64_t ClockMath::floorDivide(int64_t numerator, int64_t denominator) {
- return (numerator >= 0) ?
- numerator / denominator : ((numerator + 1) / denominator) - 1;
-}
-
+int64_t ClockMath::floorDivide(int64_t numerator, int64_t denominator) {
+ return (numerator >= 0) ?
+ numerator / denominator : ((numerator + 1) / denominator) - 1;
+}
+
int32_t ClockMath::floorDivide(double numerator, int32_t denominator,
int32_t& remainder) {
double quotient;
diff --git a/contrib/libs/icu/i18n/gregoimp.h b/contrib/libs/icu/i18n/gregoimp.h
index fee1ab3096..06eb323845 100644
--- a/contrib/libs/icu/i18n/gregoimp.h
+++ b/contrib/libs/icu/i18n/gregoimp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -41,17 +41,17 @@ class ClockMath {
static int32_t floorDivide(int32_t numerator, int32_t denominator);
/**
- * Divide two integers, returning the floor of the quotient.
- * Unlike the built-in division, this is mathematically
- * well-behaved. E.g., <code>-1/4</code> => 0 but
- * <code>floorDivide(-1,4)</code> => -1.
- * @param numerator the numerator
- * @param denominator a divisor which must be != 0
- * @return the floor of the quotient
- */
- static int64_t floorDivide(int64_t numerator, int64_t denominator);
-
- /**
+ * Divide two integers, returning the floor of the quotient.
+ * Unlike the built-in division, this is mathematically
+ * well-behaved. E.g., <code>-1/4</code> => 0 but
+ * <code>floorDivide(-1,4)</code> => -1.
+ * @param numerator the numerator
+ * @param denominator a divisor which must be != 0
+ * @return the floor of the quotient
+ */
+ static int64_t floorDivide(int64_t numerator, int64_t denominator);
+
+ /**
* Divide two numbers, returning the floor of the quotient.
* Unlike the built-in division, this is mathematically
* well-behaved. E.g., <code>-1/4</code> => 0 but
@@ -299,8 +299,8 @@ inline int32_t Grego::millisToJulianDay(double millis) {
}
inline int32_t Grego::gregorianShift(int32_t eyear) {
- int64_t y = (int64_t)eyear-1;
- int32_t gregShift = static_cast<int32_t>(ClockMath::floorDivide(y, (int64_t)400) - ClockMath::floorDivide(y, (int64_t)100) + 2);
+ int64_t y = (int64_t)eyear-1;
+ int32_t gregShift = static_cast<int32_t>(ClockMath::floorDivide(y, (int64_t)400) - ClockMath::floorDivide(y, (int64_t)100) + 2);
return gregShift;
}
diff --git a/contrib/libs/icu/i18n/hebrwcal.cpp b/contrib/libs/icu/i18n/hebrwcal.cpp
index 9a1a3ab353..c8fb8a1679 100644
--- a/contrib/libs/icu/i18n/hebrwcal.cpp
+++ b/contrib/libs/icu/i18n/hebrwcal.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -169,7 +169,7 @@ const char *HebrewCalendar::getType() const {
return "hebrew";
}
-HebrewCalendar* HebrewCalendar::clone() const {
+HebrewCalendar* HebrewCalendar::clone() const {
return new HebrewCalendar(*this);
}
diff --git a/contrib/libs/icu/i18n/hebrwcal.h b/contrib/libs/icu/i18n/hebrwcal.h
index ef2670bdc8..08136de32a 100644
--- a/contrib/libs/icu/i18n/hebrwcal.h
+++ b/contrib/libs/icu/i18n/hebrwcal.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -192,7 +192,7 @@ public:
* @return return a polymorphic copy of this calendar.
* @internal
*/
- virtual HebrewCalendar* clone() const;
+ virtual HebrewCalendar* clone() const;
public:
/**
diff --git a/contrib/libs/icu/i18n/indiancal.cpp b/contrib/libs/icu/i18n/indiancal.cpp
index f66b44ffa7..f1ab853b94 100644
--- a/contrib/libs/icu/i18n/indiancal.cpp
+++ b/contrib/libs/icu/i18n/indiancal.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
* Copyright (C) 2003-2014, International Business Machines Corporation
@@ -35,7 +35,7 @@ U_NAMESPACE_BEGIN
//-------------------------------------------------------------------------
-IndianCalendar* IndianCalendar::clone() const {
+IndianCalendar* IndianCalendar::clone() const {
return new IndianCalendar(*this);
}
@@ -348,14 +348,14 @@ IndianCalendar::inDaylightTime(UErrorCode& status) const
}
-/**
- * The system maintains a static default century start date and Year. They are
- * initialized the first time they are used. Once the system default century date
- * and year are set, they do not change.
- */
-static UDate gSystemDefaultCenturyStart = DBL_MIN;
-static int32_t gSystemDefaultCenturyStartYear = -1;
-static icu::UInitOnce gSystemDefaultCenturyInit = U_INITONCE_INITIALIZER;
+/**
+ * The system maintains a static default century start date and Year. They are
+ * initialized the first time they are used. Once the system default century date
+ * and year are set, they do not change.
+ */
+static UDate gSystemDefaultCenturyStart = DBL_MIN;
+static int32_t gSystemDefaultCenturyStartYear = -1;
+static icu::UInitOnce gSystemDefaultCenturyInit = U_INITONCE_INITIALIZER;
UBool IndianCalendar::haveDefaultCentury() const
@@ -363,43 +363,43 @@ UBool IndianCalendar::haveDefaultCentury() const
return TRUE;
}
-static void U_CALLCONV
-initializeSystemDefaultCentury()
+static void U_CALLCONV
+initializeSystemDefaultCentury()
{
- // initialize systemDefaultCentury and systemDefaultCenturyYear based
- // on the current time. They'll be set to 80 years before
- // the current time.
- UErrorCode status = U_ZERO_ERROR;
-
- IndianCalendar calendar ( Locale ( "@calendar=Indian" ), status);
- if ( U_SUCCESS ( status ) ) {
- calendar.setTime ( Calendar::getNow(), status );
- calendar.add ( UCAL_YEAR, -80, status );
-
- UDate newStart = calendar.getTime ( status );
- int32_t newYear = calendar.get ( UCAL_YEAR, status );
-
- gSystemDefaultCenturyStart = newStart;
- gSystemDefaultCenturyStartYear = newYear;
- }
- // We have no recourse upon failure.
+ // initialize systemDefaultCentury and systemDefaultCenturyYear based
+ // on the current time. They'll be set to 80 years before
+ // the current time.
+ UErrorCode status = U_ZERO_ERROR;
+
+ IndianCalendar calendar ( Locale ( "@calendar=Indian" ), status);
+ if ( U_SUCCESS ( status ) ) {
+ calendar.setTime ( Calendar::getNow(), status );
+ calendar.add ( UCAL_YEAR, -80, status );
+
+ UDate newStart = calendar.getTime ( status );
+ int32_t newYear = calendar.get ( UCAL_YEAR, status );
+
+ gSystemDefaultCenturyStart = newStart;
+ gSystemDefaultCenturyStartYear = newYear;
+ }
+ // We have no recourse upon failure.
}
-
+
UDate
-IndianCalendar::defaultCenturyStart() const
+IndianCalendar::defaultCenturyStart() const
{
// lazy-evaluate systemDefaultCenturyStart
- umtx_initOnce(gSystemDefaultCenturyInit, &initializeSystemDefaultCentury);
- return gSystemDefaultCenturyStart;
+ umtx_initOnce(gSystemDefaultCenturyInit, &initializeSystemDefaultCentury);
+ return gSystemDefaultCenturyStart;
}
int32_t
-IndianCalendar::defaultCenturyStartYear() const
+IndianCalendar::defaultCenturyStartYear() const
{
// lazy-evaluate systemDefaultCenturyStartYear
- umtx_initOnce(gSystemDefaultCenturyInit, &initializeSystemDefaultCentury);
- return gSystemDefaultCenturyStartYear;
+ umtx_initOnce(gSystemDefaultCenturyInit, &initializeSystemDefaultCentury);
+ return gSystemDefaultCenturyStartYear;
}
diff --git a/contrib/libs/icu/i18n/indiancal.h b/contrib/libs/icu/i18n/indiancal.h
index e7eaa77fbe..e259d9bc17 100644
--- a/contrib/libs/icu/i18n/indiancal.h
+++ b/contrib/libs/icu/i18n/indiancal.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************
@@ -68,7 +68,7 @@ U_NAMESPACE_BEGIN
*/
-class U_I18N_API IndianCalendar : public Calendar {
+class U_I18N_API IndianCalendar : public Calendar {
public:
/**
* Useful constants for IndianCalendar.
@@ -186,7 +186,7 @@ public:
// TODO: copy c'tor, etc
// clone
- virtual IndianCalendar* clone() const;
+ virtual IndianCalendar* clone() const;
private:
/**
@@ -274,10 +274,10 @@ public:
* @return The class ID for all objects of this class.
* @internal
*/
- static UClassID U_EXPORT2 getStaticClassID(void);
+ static UClassID U_EXPORT2 getStaticClassID(void);
/**
- * return the calendar type, "indian".
+ * return the calendar type, "indian".
*
* @return calendar type
* @internal
diff --git a/contrib/libs/icu/i18n/inputext.cpp b/contrib/libs/icu/i18n/inputext.cpp
index d2f9af10d1..2d4f8a388a 100644
--- a/contrib/libs/icu/i18n/inputext.cpp
+++ b/contrib/libs/icu/i18n/inputext.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/inputext.h b/contrib/libs/icu/i18n/inputext.h
index efedf3b68d..8edc561fc6 100644
--- a/contrib/libs/icu/i18n/inputext.h
+++ b/contrib/libs/icu/i18n/inputext.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/islamcal.cpp b/contrib/libs/icu/i18n/islamcal.cpp
index 77f70faff0..582b3365a6 100644
--- a/contrib/libs/icu/i18n/islamcal.cpp
+++ b/contrib/libs/icu/i18n/islamcal.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -222,12 +222,12 @@ const char *IslamicCalendar::getType() const {
sType = "islamic-umalqura";
break;
default:
- UPRV_UNREACHABLE; // out of range
+ UPRV_UNREACHABLE; // out of range
}
return sType;
}
-IslamicCalendar* IslamicCalendar::clone() const {
+IslamicCalendar* IslamicCalendar::clone() const {
return new IslamicCalendar(*this);
}
@@ -470,7 +470,7 @@ double IslamicCalendar::moonAge(UDate time, UErrorCode &status)
{
double age = 0;
- static UMutex astroLock; // pod bay door lock
+ static UMutex astroLock; // pod bay door lock
umtx_lock(&astroLock);
if(gIslamicCalendarAstro == NULL) {
gIslamicCalendarAstro = new CalendarAstronomer();
@@ -612,7 +612,7 @@ void IslamicCalendar::handleComputeFields(int32_t julianDay, UErrorCode &status)
days = julianDay - ASTRONOMICAL_EPOC;
}
// Use the civil calendar approximation, which is just arithmetic
- year = (int32_t)ClockMath::floorDivide(30 * (int64_t)days + 10646, (int64_t)10631);
+ year = (int32_t)ClockMath::floorDivide(30 * (int64_t)days + 10646, (int64_t)10631);
month = (int32_t)uprv_ceil((days - 29 - yearStart(year)) / 29.5 );
month = month<11?month:11;
startDate = monthStart(year, month);
@@ -673,7 +673,7 @@ void IslamicCalendar::handleComputeFields(int32_t julianDay, UErrorCode &status)
month = m;
}
} else { // invalid 'civil'
- UPRV_UNREACHABLE; // should not get here, out of range
+ UPRV_UNREACHABLE; // should not get here, out of range
}
dayOfMonth = (days - monthStart(year, month)) + 1;
diff --git a/contrib/libs/icu/i18n/islamcal.h b/contrib/libs/icu/i18n/islamcal.h
index 1bf07c6f42..fde58478c0 100644
--- a/contrib/libs/icu/i18n/islamcal.h
+++ b/contrib/libs/icu/i18n/islamcal.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -230,7 +230,7 @@ class U_I18N_API IslamicCalendar : public Calendar {
// TODO: copy c'tor, etc
// clone
- virtual IslamicCalendar* clone() const;
+ virtual IslamicCalendar* clone() const;
private:
/**
diff --git a/contrib/libs/icu/i18n/japancal.cpp b/contrib/libs/icu/i18n/japancal.cpp
index e7ff137f60..75a248f406 100644
--- a/contrib/libs/icu/i18n/japancal.cpp
+++ b/contrib/libs/icu/i18n/japancal.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -16,105 +16,105 @@
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
-#if U_PLATFORM_HAS_WINUWP_API == 0
-#include <stdlib.h> // getenv() is not available in UWP env
-#else
-#ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-#endif
-# define VC_EXTRALEAN
-# define NOUSER
-# define NOSERVICE
-# define NOIME
-# define NOMCX
-#include <windows.h>
-#endif
+#if U_PLATFORM_HAS_WINUWP_API == 0
+#include <stdlib.h> // getenv() is not available in UWP env
+#else
+#ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
+# define VC_EXTRALEAN
+# define NOUSER
+# define NOSERVICE
+# define NOIME
+# define NOMCX
+#include <windows.h>
+#endif
#include "cmemory.h"
-#include "erarules.h"
+#include "erarules.h"
#include "japancal.h"
#include "unicode/gregocal.h"
#include "umutex.h"
#include "uassert.h"
-#include "ucln_in.h"
-#include "cstring.h"
-
-static icu::EraRules * gJapaneseEraRules = nullptr;
-static icu::UInitOnce gJapaneseEraRulesInitOnce = U_INITONCE_INITIALIZER;
-static int32_t gCurrentEra = 0;
-
-U_CDECL_BEGIN
-static UBool japanese_calendar_cleanup(void) {
- if (gJapaneseEraRules) {
- delete gJapaneseEraRules;
- gJapaneseEraRules = nullptr;
- }
- gCurrentEra = 0;
- gJapaneseEraRulesInitOnce.reset();
- return TRUE;
-}
-U_CDECL_END
+#include "ucln_in.h"
+#include "cstring.h"
+
+static icu::EraRules * gJapaneseEraRules = nullptr;
+static icu::UInitOnce gJapaneseEraRulesInitOnce = U_INITONCE_INITIALIZER;
+static int32_t gCurrentEra = 0;
+
+U_CDECL_BEGIN
+static UBool japanese_calendar_cleanup(void) {
+ if (gJapaneseEraRules) {
+ delete gJapaneseEraRules;
+ gJapaneseEraRules = nullptr;
+ }
+ gCurrentEra = 0;
+ gJapaneseEraRulesInitOnce.reset();
+ return TRUE;
+}
+U_CDECL_END
U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(JapaneseCalendar)
-static const int32_t kGregorianEpoch = 1970; // used as the default value of EXTENDED_YEAR
-static const char* TENTATIVE_ERA_VAR_NAME = "ICU_ENABLE_TENTATIVE_ERA";
-
-
-// Export the following for use by test code.
-UBool JapaneseCalendar::enableTentativeEra() {
- // Although start date of next Japanese era is planned ahead, a name of
- // new era might not be available. This implementation allows tester to
- // check a new era without era names by settings below (in priority order).
- // By default, such tentative era is disabled.
-
- // 1. Environment variable ICU_ENABLE_TENTATIVE_ERA=true or false
-
- UBool includeTentativeEra = FALSE;
-
-#if U_PLATFORM_HAS_WINUWP_API == 1
- // UWP doesn't allow access to getenv(), but we can call GetEnvironmentVariableW to do the same thing.
- UChar varName[26] = {};
- u_charsToUChars(TENTATIVE_ERA_VAR_NAME, varName, static_cast<int32_t>(uprv_strlen(TENTATIVE_ERA_VAR_NAME)));
- WCHAR varValue[5] = {};
- DWORD ret = GetEnvironmentVariableW(reinterpret_cast<WCHAR*>(varName), varValue, UPRV_LENGTHOF(varValue));
- if ((ret == 4) && (_wcsicmp(varValue, L"true") == 0)) {
- includeTentativeEra = TRUE;
- }
-#else
- char *envVarVal = getenv(TENTATIVE_ERA_VAR_NAME);
- if (envVarVal != NULL && uprv_stricmp(envVarVal, "true") == 0) {
- includeTentativeEra = TRUE;
- }
-#endif
- return includeTentativeEra;
-}
-
-
-// Initialize global Japanese era data
-static void U_CALLCONV initializeEras(UErrorCode &status) {
- gJapaneseEraRules = EraRules::createInstance("japanese", JapaneseCalendar::enableTentativeEra(), status);
- if (U_FAILURE(status)) {
- return;
- }
- gCurrentEra = gJapaneseEraRules->getCurrentEraIndex();
-}
-
-static void init(UErrorCode &status) {
- umtx_initOnce(gJapaneseEraRulesInitOnce, &initializeEras, status);
- ucln_i18n_registerCleanup(UCLN_I18N_JAPANESE_CALENDAR, japanese_calendar_cleanup);
-}
-
+static const int32_t kGregorianEpoch = 1970; // used as the default value of EXTENDED_YEAR
+static const char* TENTATIVE_ERA_VAR_NAME = "ICU_ENABLE_TENTATIVE_ERA";
+
+
+// Export the following for use by test code.
+UBool JapaneseCalendar::enableTentativeEra() {
+ // Although start date of next Japanese era is planned ahead, a name of
+ // new era might not be available. This implementation allows tester to
+ // check a new era without era names by settings below (in priority order).
+ // By default, such tentative era is disabled.
+
+ // 1. Environment variable ICU_ENABLE_TENTATIVE_ERA=true or false
+
+ UBool includeTentativeEra = FALSE;
+
+#if U_PLATFORM_HAS_WINUWP_API == 1
+ // UWP doesn't allow access to getenv(), but we can call GetEnvironmentVariableW to do the same thing.
+ UChar varName[26] = {};
+ u_charsToUChars(TENTATIVE_ERA_VAR_NAME, varName, static_cast<int32_t>(uprv_strlen(TENTATIVE_ERA_VAR_NAME)));
+ WCHAR varValue[5] = {};
+ DWORD ret = GetEnvironmentVariableW(reinterpret_cast<WCHAR*>(varName), varValue, UPRV_LENGTHOF(varValue));
+ if ((ret == 4) && (_wcsicmp(varValue, L"true") == 0)) {
+ includeTentativeEra = TRUE;
+ }
+#else
+ char *envVarVal = getenv(TENTATIVE_ERA_VAR_NAME);
+ if (envVarVal != NULL && uprv_stricmp(envVarVal, "true") == 0) {
+ includeTentativeEra = TRUE;
+ }
+#endif
+ return includeTentativeEra;
+}
+
+
+// Initialize global Japanese era data
+static void U_CALLCONV initializeEras(UErrorCode &status) {
+ gJapaneseEraRules = EraRules::createInstance("japanese", JapaneseCalendar::enableTentativeEra(), status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ gCurrentEra = gJapaneseEraRules->getCurrentEraIndex();
+}
+
+static void init(UErrorCode &status) {
+ umtx_initOnce(gJapaneseEraRulesInitOnce, &initializeEras, status);
+ ucln_i18n_registerCleanup(UCLN_I18N_JAPANESE_CALENDAR, japanese_calendar_cleanup);
+}
+
/* Some platforms don't like to export constants, like old Palm OS and some z/OS configurations. */
uint32_t JapaneseCalendar::getCurrentEra() {
- return gCurrentEra;
+ return gCurrentEra;
}
JapaneseCalendar::JapaneseCalendar(const Locale& aLocale, UErrorCode& success)
: GregorianCalendar(aLocale, success)
{
- init(success);
+ init(success);
setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly.
}
@@ -125,9 +125,9 @@ JapaneseCalendar::~JapaneseCalendar()
JapaneseCalendar::JapaneseCalendar(const JapaneseCalendar& source)
: GregorianCalendar(source)
{
- UErrorCode status = U_ZERO_ERROR;
- init(status);
- U_ASSERT(U_SUCCESS(status));
+ UErrorCode status = U_ZERO_ERROR;
+ init(status);
+ U_ASSERT(U_SUCCESS(status));
}
JapaneseCalendar& JapaneseCalendar::operator= ( const JapaneseCalendar& right)
@@ -136,7 +136,7 @@ JapaneseCalendar& JapaneseCalendar::operator= ( const JapaneseCalendar& right)
return *this;
}
-JapaneseCalendar* JapaneseCalendar::clone() const
+JapaneseCalendar* JapaneseCalendar::clone() const
{
return new JapaneseCalendar(*this);
}
@@ -154,14 +154,14 @@ int32_t JapaneseCalendar::getDefaultMonthInYear(int32_t eyear)
int32_t month = 0;
// Find out if we are at the edge of an era
- int32_t eraStart[3] = { 0,0,0 };
- UErrorCode status = U_ZERO_ERROR;
- gJapaneseEraRules->getStartDate(era, eraStart, status);
- U_ASSERT(U_SUCCESS(status));
- if(eyear == eraStart[0]) {
+ int32_t eraStart[3] = { 0,0,0 };
+ UErrorCode status = U_ZERO_ERROR;
+ gJapaneseEraRules->getStartDate(era, eraStart, status);
+ U_ASSERT(U_SUCCESS(status));
+ if(eyear == eraStart[0]) {
// Yes, we're in the first year of this era.
- return eraStart[1] // month
- -1; // return 0-based month
+ return eraStart[1] // month
+ -1; // return 0-based month
}
return month;
@@ -172,13 +172,13 @@ int32_t JapaneseCalendar::getDefaultDayInMonth(int32_t eyear, int32_t month)
int32_t era = internalGetEra();
int32_t day = 1;
- int32_t eraStart[3] = { 0,0,0 };
- UErrorCode status = U_ZERO_ERROR;
- gJapaneseEraRules->getStartDate(era, eraStart, status);
- U_ASSERT(U_SUCCESS(status));
- if(eyear == eraStart[0]) {
- if(month == eraStart[1] - 1) {
- return eraStart[2];
+ int32_t eraStart[3] = { 0,0,0 };
+ UErrorCode status = U_ZERO_ERROR;
+ gJapaneseEraRules->getStartDate(era, eraStart, status);
+ U_ASSERT(U_SUCCESS(status));
+ if(eyear == eraStart[0]) {
+ if(month == eraStart[1] - 1) {
+ return eraStart[2];
}
}
@@ -188,7 +188,7 @@ int32_t JapaneseCalendar::getDefaultDayInMonth(int32_t eyear, int32_t month)
int32_t JapaneseCalendar::internalGetEra() const
{
- return internalGet(UCAL_ERA, gCurrentEra);
+ return internalGet(UCAL_ERA, gCurrentEra);
}
int32_t JapaneseCalendar::handleGetExtendedYear()
@@ -199,18 +199,18 @@ int32_t JapaneseCalendar::handleGetExtendedYear()
if (newerField(UCAL_EXTENDED_YEAR, UCAL_YEAR) == UCAL_EXTENDED_YEAR &&
newerField(UCAL_EXTENDED_YEAR, UCAL_ERA) == UCAL_EXTENDED_YEAR) {
- year = internalGet(UCAL_EXTENDED_YEAR, kGregorianEpoch);
- } else {
- UErrorCode status = U_ZERO_ERROR;
- int32_t eraStartYear = gJapaneseEraRules->getStartYear(internalGet(UCAL_ERA, gCurrentEra), status);
- U_ASSERT(U_SUCCESS(status));
-
- // extended year is a gregorian year, where 1 = 1AD, 0 = 1BC, -1 = 2BC, etc
- year = internalGet(UCAL_YEAR, 1) // pin to minimum of year 1 (first year)
- + eraStartYear // add gregorian starting year
- - 1; // Subtract one because year starts at 1
- }
- return year;
+ year = internalGet(UCAL_EXTENDED_YEAR, kGregorianEpoch);
+ } else {
+ UErrorCode status = U_ZERO_ERROR;
+ int32_t eraStartYear = gJapaneseEraRules->getStartYear(internalGet(UCAL_ERA, gCurrentEra), status);
+ U_ASSERT(U_SUCCESS(status));
+
+ // extended year is a gregorian year, where 1 = 1AD, 0 = 1BC, -1 = 2BC, etc
+ year = internalGet(UCAL_YEAR, 1) // pin to minimum of year 1 (first year)
+ + eraStartYear // add gregorian starting year
+ - 1; // Subtract one because year starts at 1
+ }
+ return year;
}
@@ -219,10 +219,10 @@ void JapaneseCalendar::handleComputeFields(int32_t julianDay, UErrorCode& status
//Calendar::timeToFields(theTime, quick, status);
GregorianCalendar::handleComputeFields(julianDay, status);
int32_t year = internalGet(UCAL_EXTENDED_YEAR); // Gregorian year
- int32_t eraIdx = gJapaneseEraRules->getEraIndex(year, internalGet(UCAL_MONTH) + 1, internalGet(UCAL_DAY_OF_MONTH), status);
+ int32_t eraIdx = gJapaneseEraRules->getEraIndex(year, internalGet(UCAL_MONTH) + 1, internalGet(UCAL_DAY_OF_MONTH), status);
- internalSet(UCAL_ERA, eraIdx);
- internalSet(UCAL_YEAR, year - gJapaneseEraRules->getStartYear(eraIdx, status) + 1);
+ internalSet(UCAL_ERA, eraIdx);
+ internalSet(UCAL_YEAR, year - gJapaneseEraRules->getStartYear(eraIdx, status) + 1);
}
/*
@@ -250,7 +250,7 @@ int32_t JapaneseCalendar::handleGetLimit(UCalendarDateFields field, ELimitType l
if (limitType == UCAL_LIMIT_MINIMUM || limitType == UCAL_LIMIT_GREATEST_MINIMUM) {
return 0;
}
- return gJapaneseEraRules->getNumberOfEras() - 1; // max known era, not gCurrentEra
+ return gJapaneseEraRules->getNumberOfEras() - 1; // max known era, not gCurrentEra
case UCAL_YEAR:
{
switch (limitType) {
@@ -261,12 +261,12 @@ int32_t JapaneseCalendar::handleGetLimit(UCalendarDateFields field, ELimitType l
return 1;
case UCAL_LIMIT_COUNT: //added to avoid warning
case UCAL_LIMIT_MAXIMUM:
- {
- UErrorCode status = U_ZERO_ERROR;
- int32_t eraStartYear = gJapaneseEraRules->getStartYear(gCurrentEra, status);
- U_ASSERT(U_SUCCESS(status));
- return GregorianCalendar::handleGetLimit(UCAL_YEAR, UCAL_LIMIT_MAXIMUM) - eraStartYear;
- }
+ {
+ UErrorCode status = U_ZERO_ERROR;
+ int32_t eraStartYear = gJapaneseEraRules->getStartYear(gCurrentEra, status);
+ U_ASSERT(U_SUCCESS(status));
+ return GregorianCalendar::handleGetLimit(UCAL_YEAR, UCAL_LIMIT_MAXIMUM) - eraStartYear;
+ }
default:
return 1; // Error condition, invalid limitType
}
@@ -282,18 +282,18 @@ int32_t JapaneseCalendar::getActualMaximum(UCalendarDateFields field, UErrorCode
if (U_FAILURE(status)) {
return 0; // error case... any value
}
- if (era == gJapaneseEraRules->getNumberOfEras() - 1) { // max known era, not gCurrentEra
+ if (era == gJapaneseEraRules->getNumberOfEras() - 1) { // max known era, not gCurrentEra
// TODO: Investigate what value should be used here - revisit after 4.0.
return handleGetLimit(UCAL_YEAR, UCAL_LIMIT_MAXIMUM);
} else {
- int32_t nextEraStart[3] = { 0,0,0 };
- gJapaneseEraRules->getStartDate(era + 1, nextEraStart, status);
- int32_t nextEraYear = nextEraStart[0];
- int32_t nextEraMonth = nextEraStart[1]; // 1-base
- int32_t nextEraDate = nextEraStart[2];
-
- int32_t eraStartYear = gJapaneseEraRules->getStartYear(era, status);
- int32_t maxYear = nextEraYear - eraStartYear + 1; // 1-base
+ int32_t nextEraStart[3] = { 0,0,0 };
+ gJapaneseEraRules->getStartDate(era + 1, nextEraStart, status);
+ int32_t nextEraYear = nextEraStart[0];
+ int32_t nextEraMonth = nextEraStart[1]; // 1-base
+ int32_t nextEraDate = nextEraStart[2];
+
+ int32_t eraStartYear = gJapaneseEraRules->getStartYear(era, status);
+ int32_t maxYear = nextEraYear - eraStartYear + 1; // 1-base
if (nextEraMonth == 1 && nextEraDate == 1) {
// Subtract 1, because the next era starts at Jan 1
maxYear--;
diff --git a/contrib/libs/icu/i18n/japancal.h b/contrib/libs/icu/i18n/japancal.h
index f8340b2c40..03e6361c9f 100644
--- a/contrib/libs/icu/i18n/japancal.h
+++ b/contrib/libs/icu/i18n/japancal.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -49,34 +49,34 @@ U_NAMESPACE_BEGIN
* July 30, 1912 (Taisho), December 25, 1926 (Showa), and January 7, 1989 (Heisei). Constants
* for these eras, suitable for use in the <code>UCAL_ERA</code> field, are provided
* in this class. Note that the <em>number</em> used for each era is more or
- * less arbitrary. Currently, the era starting in 645 AD is era #0; however this
- * may change in the future. Use the predefined constants rather than using actual,
- * absolute numbers.
+ * less arbitrary. Currently, the era starting in 645 AD is era #0; however this
+ * may change in the future. Use the predefined constants rather than using actual,
+ * absolute numbers.
* <p>
- * Since ICU4C 63, start date of each era is imported from CLDR. CLDR era data
- * may contain tentative era in near future with placeholder names. By default,
- * such era data is not enabled. ICU4C users who want to test the behavior of
- * the future era can enable this one of following settings (in the priority
- * order):
- * <ol>
- * <li>Environment variable <code>ICU_ENABLE_TENTATIVE_ERA=true</code>.</li>
- * </nl>
+ * Since ICU4C 63, start date of each era is imported from CLDR. CLDR era data
+ * may contain tentative era in near future with placeholder names. By default,
+ * such era data is not enabled. ICU4C users who want to test the behavior of
+ * the future era can enable this one of following settings (in the priority
+ * order):
+ * <ol>
+ * <li>Environment variable <code>ICU_ENABLE_TENTATIVE_ERA=true</code>.</li>
+ * </nl>
* @internal
*/
class JapaneseCalendar : public GregorianCalendar {
public:
/**
- * Check environment variable.
+ * Check environment variable.
+ * @internal
+ */
+ U_I18N_API static UBool U_EXPORT2 enableTentativeEra(void);
+
+ /**
+ * Useful constants for JapaneseCalendar.
+ * Exported for use by test code.
* @internal
*/
- U_I18N_API static UBool U_EXPORT2 enableTentativeEra(void);
-
- /**
- * Useful constants for JapaneseCalendar.
- * Exported for use by test code.
- * @internal
- */
U_I18N_API static uint32_t U_EXPORT2 getCurrentEra(void); // the current era
/**
@@ -116,7 +116,7 @@ public:
* @return return a polymorphic copy of this calendar.
* @internal
*/
- virtual JapaneseCalendar* clone() const;
+ virtual JapaneseCalendar* clone() const;
/**
* Return the extended year defined by the current fields. In the
diff --git a/contrib/libs/icu/i18n/listformatter.cpp b/contrib/libs/icu/i18n/listformatter.cpp
index 60c2bcef42..da99c9291d 100644
--- a/contrib/libs/icu/i18n/listformatter.cpp
+++ b/contrib/libs/icu/i18n/listformatter.cpp
@@ -1,808 +1,808 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-*******************************************************************************
-*
-* Copyright (C) 2013-2016, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-*******************************************************************************
-* file name: listformatter.cpp
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 2012aug27
-* created by: Umesh P. Nair
-*/
-
-#include "cmemory.h"
-#include "unicode/fpositer.h" // FieldPositionIterator
-#include "unicode/listformatter.h"
-#include "unicode/simpleformatter.h"
-#include "unicode/ulistformatter.h"
-#include "unicode/uscript.h"
-#include "fphdlimp.h"
-#include "mutex.h"
-#include "hash.h"
-#include "cstring.h"
-#include "uarrsort.h"
-#include "ulocimp.h"
-#include "charstr.h"
-#include "ucln_in.h"
-#include "uresimp.h"
-#include "resource.h"
-#include "formattedval_impl.h"
-
-U_NAMESPACE_BEGIN
-
-namespace {
-
-class PatternHandler : public UObject {
-public:
- PatternHandler(const UnicodeString& two, const UnicodeString& end, UErrorCode& errorCode) :
- twoPattern(two, 2, 2, errorCode),
- endPattern(end, 2, 2, errorCode) { }
-
- PatternHandler(const SimpleFormatter& two, const SimpleFormatter& end) :
- twoPattern(two),
- endPattern(end) { }
-
- virtual ~PatternHandler();
-
- virtual PatternHandler* clone() const { return new PatternHandler(twoPattern, endPattern); }
-
- virtual const SimpleFormatter& getTwoPattern(const UnicodeString&) const {
- return twoPattern;
- }
-
- virtual const SimpleFormatter& getEndPattern(const UnicodeString&) const {
- return endPattern;
- }
-
-protected:
- SimpleFormatter twoPattern;
- SimpleFormatter endPattern;
-};
-
-PatternHandler::~PatternHandler() {
-}
-
-class ContextualHandler : public PatternHandler {
-public:
- ContextualHandler(bool (*testFunc)(const UnicodeString& text),
- const UnicodeString& thenTwo,
- const UnicodeString& elseTwo,
- const UnicodeString& thenEnd,
- const UnicodeString& elseEnd,
- UErrorCode& errorCode) :
- PatternHandler(elseTwo, elseEnd, errorCode),
- test(testFunc),
- thenTwoPattern(thenTwo, 2, 2, errorCode),
- thenEndPattern(thenEnd, 2, 2, errorCode) { }
-
- ContextualHandler(bool (*testFunc)(const UnicodeString& text),
- const SimpleFormatter& thenTwo, SimpleFormatter elseTwo,
- const SimpleFormatter& thenEnd, SimpleFormatter elseEnd) :
- PatternHandler(elseTwo, elseEnd),
- test(testFunc),
- thenTwoPattern(thenTwo),
- thenEndPattern(thenEnd) { }
-
- ~ContextualHandler() override;
-
- PatternHandler* clone() const override {
- return new ContextualHandler(
- test, thenTwoPattern, twoPattern, thenEndPattern, endPattern);
- }
-
- const SimpleFormatter& getTwoPattern(
- const UnicodeString& text) const override {
- return (test)(text) ? thenTwoPattern : twoPattern;
- }
-
- const SimpleFormatter& getEndPattern(
- const UnicodeString& text) const override {
- return (test)(text) ? thenEndPattern : endPattern;
- }
-
-private:
- bool (*test)(const UnicodeString&);
- SimpleFormatter thenTwoPattern;
- SimpleFormatter thenEndPattern;
-};
-
-ContextualHandler::~ContextualHandler() {
-}
-
-static const char16_t *spanishY = u"{0} y {1}";
-static const char16_t *spanishE = u"{0} e {1}";
-static const char16_t *spanishO = u"{0} o {1}";
-static const char16_t *spanishU = u"{0} u {1}";
-static const char16_t *hebrewVav = u"{0} \u05D5{1}";
-static const char16_t *hebrewVavDash = u"{0} \u05D5-{1}";
-
-// Condiction to change to e.
-// Starts with "hi" or "i" but not with "hie" nor "hia"
-static bool shouldChangeToE(const UnicodeString& text) {
- int32_t len = text.length();
- if (len == 0) { return false; }
- // Case insensitive match hi but not hie nor hia.
- if ((text[0] == u'h' || text[0] == u'H') &&
- ((len > 1) && (text[1] == u'i' || text[1] == u'I')) &&
- ((len == 2) || !(text[2] == u'a' || text[2] == u'A' || text[2] == u'e' || text[2] == u'E'))) {
- return true;
- }
- // Case insensitive for "start with i"
- if (text[0] == u'i' || text[0] == u'I') { return true; }
- return false;
-}
-
-// Condiction to change to u.
-// Starts with "o", "ho", and "8". Also "11" by itself.
-// re: ^((o|ho|8).*|11)$
-static bool shouldChangeToU(const UnicodeString& text) {
- int32_t len = text.length();
- if (len == 0) { return false; }
- // Case insensitive match o.* and 8.*
- if (text[0] == u'o' || text[0] == u'O' || text[0] == u'8') { return true; }
- // Case insensitive match ho.*
- if ((text[0] == u'h' || text[0] == u'H') &&
- ((len > 1) && (text[1] == 'o' || text[1] == u'O'))) {
- return true;
- }
- // match "^11$" and "^11 .*"
- if ((len >= 2) && text[0] == u'1' && text[1] == u'1' && (len == 2 || text[2] == u' ')) { return true; }
- return false;
-}
-
-// Condiction to change to VAV follow by a dash.
-// Starts with non Hebrew letter.
-static bool shouldChangeToVavDash(const UnicodeString& text) {
- if (text.isEmpty()) { return false; }
- UErrorCode status = U_ZERO_ERROR;
- return uscript_getScript(text.char32At(0), &status) != USCRIPT_HEBREW;
-}
-
-PatternHandler* createPatternHandler(
- const char* lang, const UnicodeString& two, const UnicodeString& end,
- UErrorCode& status) {
- if (uprv_strcmp(lang, "es") == 0) {
- // Spanish
- UnicodeString spanishYStr(TRUE, spanishY, -1);
- bool twoIsY = two == spanishYStr;
- bool endIsY = end == spanishYStr;
- if (twoIsY || endIsY) {
- UnicodeString replacement(TRUE, spanishE, -1);
- return new ContextualHandler(
- shouldChangeToE,
- twoIsY ? replacement : two, two,
- endIsY ? replacement : end, end, status);
- }
- UnicodeString spanishOStr(TRUE, spanishO, -1);
- bool twoIsO = two == spanishOStr;
- bool endIsO = end == spanishOStr;
- if (twoIsO || endIsO) {
- UnicodeString replacement(TRUE, spanishU, -1);
- return new ContextualHandler(
- shouldChangeToU,
- twoIsO ? replacement : two, two,
- endIsO ? replacement : end, end, status);
- }
- } else if (uprv_strcmp(lang, "he") == 0 || uprv_strcmp(lang, "iw") == 0) {
- // Hebrew
- UnicodeString hebrewVavStr(TRUE, hebrewVav, -1);
- bool twoIsVav = two == hebrewVavStr;
- bool endIsVav = end == hebrewVavStr;
- if (twoIsVav || endIsVav) {
- UnicodeString replacement(TRUE, hebrewVavDash, -1);
- return new ContextualHandler(
- shouldChangeToVavDash,
- twoIsVav ? replacement : two, two,
- endIsVav ? replacement : end, end, status);
- }
- }
- return new PatternHandler(two, end, status);
-}
-
-} // namespace
-
-struct ListFormatInternal : public UMemory {
- SimpleFormatter startPattern;
- SimpleFormatter middlePattern;
- LocalPointer<PatternHandler> patternHandler;
-
-ListFormatInternal(
- const UnicodeString& two,
- const UnicodeString& start,
- const UnicodeString& middle,
- const UnicodeString& end,
- const Locale& locale,
- UErrorCode &errorCode) :
- startPattern(start, 2, 2, errorCode),
- middlePattern(middle, 2, 2, errorCode),
- patternHandler(createPatternHandler(locale.getLanguage(), two, end, errorCode), errorCode) { }
-
-ListFormatInternal(const ListFormatData &data, UErrorCode &errorCode) :
- startPattern(data.startPattern, errorCode),
- middlePattern(data.middlePattern, errorCode),
- patternHandler(createPatternHandler(
- data.locale.getLanguage(), data.twoPattern, data.endPattern, errorCode), errorCode) { }
-
-ListFormatInternal(const ListFormatInternal &other) :
- startPattern(other.startPattern),
- middlePattern(other.middlePattern),
- patternHandler(other.patternHandler->clone()) { }
-};
-
-
-#if !UCONFIG_NO_FORMATTING
-class FormattedListData : public FormattedValueFieldPositionIteratorImpl {
-public:
- FormattedListData(UErrorCode& status) : FormattedValueFieldPositionIteratorImpl(5, status) {}
- virtual ~FormattedListData();
-};
-
-FormattedListData::~FormattedListData() = default;
-
-UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedList)
-#endif
-
-
-static Hashtable* listPatternHash = nullptr;
-
-U_CDECL_BEGIN
-static UBool U_CALLCONV uprv_listformatter_cleanup() {
- delete listPatternHash;
- listPatternHash = nullptr;
- return TRUE;
-}
-
-static void U_CALLCONV
-uprv_deleteListFormatInternal(void *obj) {
- delete static_cast<ListFormatInternal *>(obj);
-}
-
-U_CDECL_END
-
-ListFormatter::ListFormatter(const ListFormatter& other) :
- owned(other.owned), data(other.data) {
- if (other.owned != nullptr) {
- owned = new ListFormatInternal(*other.owned);
- data = owned;
- }
-}
-
-ListFormatter& ListFormatter::operator=(const ListFormatter& other) {
- if (this == &other) {
- return *this;
- }
- delete owned;
- if (other.owned) {
- owned = new ListFormatInternal(*other.owned);
- data = owned;
- } else {
- owned = nullptr;
- data = other.data;
- }
- return *this;
-}
-
-void ListFormatter::initializeHash(UErrorCode& errorCode) {
- if (U_FAILURE(errorCode)) {
- return;
- }
-
- listPatternHash = new Hashtable();
- if (listPatternHash == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
-
- listPatternHash->setValueDeleter(uprv_deleteListFormatInternal);
- ucln_i18n_registerCleanup(UCLN_I18N_LIST_FORMATTER, uprv_listformatter_cleanup);
-
-}
-
-const ListFormatInternal* ListFormatter::getListFormatInternal(
- const Locale& locale, const char *style, UErrorCode& errorCode) {
- if (U_FAILURE(errorCode)) {
- return nullptr;
- }
- CharString keyBuffer(locale.getName(), errorCode);
- keyBuffer.append(':', errorCode).append(style, errorCode);
- UnicodeString key(keyBuffer.data(), -1, US_INV);
- ListFormatInternal* result = nullptr;
- static UMutex listFormatterMutex;
- {
- Mutex m(&listFormatterMutex);
- if (listPatternHash == nullptr) {
- initializeHash(errorCode);
- if (U_FAILURE(errorCode)) {
- return nullptr;
- }
- }
- result = static_cast<ListFormatInternal*>(listPatternHash->get(key));
- }
- if (result != nullptr) {
- return result;
- }
- result = loadListFormatInternal(locale, style, errorCode);
- if (U_FAILURE(errorCode)) {
- return nullptr;
- }
-
- {
- Mutex m(&listFormatterMutex);
- ListFormatInternal* temp = static_cast<ListFormatInternal*>(listPatternHash->get(key));
- if (temp != nullptr) {
- delete result;
- result = temp;
- } else {
- listPatternHash->put(key, result, errorCode);
- if (U_FAILURE(errorCode)) {
- return nullptr;
- }
- }
- }
- return result;
-}
-
-#if !UCONFIG_NO_FORMATTING
-static const char* typeWidthToStyleString(UListFormatterType type, UListFormatterWidth width) {
- switch (type) {
- case ULISTFMT_TYPE_AND:
- switch (width) {
- case ULISTFMT_WIDTH_WIDE:
- return "standard";
- case ULISTFMT_WIDTH_SHORT:
- return "standard-short";
- case ULISTFMT_WIDTH_NARROW:
- return "standard-narrow";
- default:
- return nullptr;
- }
- break;
-
- case ULISTFMT_TYPE_OR:
- switch (width) {
- case ULISTFMT_WIDTH_WIDE:
- return "or";
- case ULISTFMT_WIDTH_SHORT:
- return "or-short";
- case ULISTFMT_WIDTH_NARROW:
- return "or-narrow";
- default:
- return nullptr;
- }
- break;
-
- case ULISTFMT_TYPE_UNITS:
- switch (width) {
- case ULISTFMT_WIDTH_WIDE:
- return "unit";
- case ULISTFMT_WIDTH_SHORT:
- return "unit-short";
- case ULISTFMT_WIDTH_NARROW:
- return "unit-narrow";
- default:
- return nullptr;
- }
- }
-
- return nullptr;
-}
-#endif
-
-static const UChar solidus = 0x2F;
-static const UChar aliasPrefix[] = { 0x6C,0x69,0x73,0x74,0x50,0x61,0x74,0x74,0x65,0x72,0x6E,0x2F }; // "listPattern/"
-enum {
- kAliasPrefixLen = UPRV_LENGTHOF(aliasPrefix),
- kStyleLenMax = 24 // longest currently is 14
-};
-
-struct ListFormatter::ListPatternsSink : public ResourceSink {
- UnicodeString two, start, middle, end;
-#if ((U_PLATFORM == U_PF_AIX) || (U_PLATFORM == U_PF_OS390)) && (U_CPLUSPLUS_VERSION < 11)
- char aliasedStyle[kStyleLenMax+1];
- ListPatternsSink() {
- uprv_memset(aliasedStyle, 0, kStyleLenMax+1);
- }
-#else
- char aliasedStyle[kStyleLenMax+1] = {0};
-
- ListPatternsSink() {}
-#endif
- virtual ~ListPatternsSink();
-
- void setAliasedStyle(UnicodeString alias) {
- int32_t startIndex = alias.indexOf(aliasPrefix, kAliasPrefixLen, 0);
- if (startIndex < 0) {
- return;
- }
- startIndex += kAliasPrefixLen;
- int32_t endIndex = alias.indexOf(solidus, startIndex);
- if (endIndex < 0) {
- endIndex = alias.length();
- }
- alias.extract(startIndex, endIndex-startIndex, aliasedStyle, kStyleLenMax+1, US_INV);
- aliasedStyle[kStyleLenMax] = 0;
- }
-
- void handleValueForPattern(ResourceValue &value, UnicodeString &pattern, UErrorCode &errorCode) {
- if (pattern.isEmpty()) {
- if (value.getType() == URES_ALIAS) {
- if (aliasedStyle[0] == 0) {
- setAliasedStyle(value.getAliasUnicodeString(errorCode));
- }
- } else {
- pattern = value.getUnicodeString(errorCode);
- }
- }
- }
-
- virtual void put(const char *key, ResourceValue &value, UBool /*noFallback*/,
- UErrorCode &errorCode) {
- aliasedStyle[0] = 0;
- if (value.getType() == URES_ALIAS) {
- setAliasedStyle(value.getAliasUnicodeString(errorCode));
- return;
- }
- ResourceTable listPatterns = value.getTable(errorCode);
- for (int i = 0; U_SUCCESS(errorCode) && listPatterns.getKeyAndValue(i, key, value); ++i) {
- if (uprv_strcmp(key, "2") == 0) {
- handleValueForPattern(value, two, errorCode);
- } else if (uprv_strcmp(key, "end") == 0) {
- handleValueForPattern(value, end, errorCode);
- } else if (uprv_strcmp(key, "middle") == 0) {
- handleValueForPattern(value, middle, errorCode);
- } else if (uprv_strcmp(key, "start") == 0) {
- handleValueForPattern(value, start, errorCode);
- }
- }
- }
-};
-
-// Virtual destructors must be defined out of line.
-ListFormatter::ListPatternsSink::~ListPatternsSink() {}
-
-ListFormatInternal* ListFormatter::loadListFormatInternal(
- const Locale& locale, const char * style, UErrorCode& errorCode) {
- UResourceBundle* rb = ures_open(nullptr, locale.getName(), &errorCode);
- rb = ures_getByKeyWithFallback(rb, "listPattern", rb, &errorCode);
- if (U_FAILURE(errorCode)) {
- ures_close(rb);
- return nullptr;
- }
- ListFormatter::ListPatternsSink sink;
- char currentStyle[kStyleLenMax+1];
- uprv_strncpy(currentStyle, style, kStyleLenMax);
- currentStyle[kStyleLenMax] = 0;
-
- for (;;) {
- ures_getAllItemsWithFallback(rb, currentStyle, sink, errorCode);
- if (U_FAILURE(errorCode) || sink.aliasedStyle[0] == 0 || uprv_strcmp(currentStyle, sink.aliasedStyle) == 0) {
- break;
- }
- uprv_strcpy(currentStyle, sink.aliasedStyle);
- }
- ures_close(rb);
- if (U_FAILURE(errorCode)) {
- return nullptr;
- }
- if (sink.two.isEmpty() || sink.start.isEmpty() || sink.middle.isEmpty() || sink.end.isEmpty()) {
- errorCode = U_MISSING_RESOURCE_ERROR;
- return nullptr;
- }
-
- ListFormatInternal* result = new ListFormatInternal(sink.two, sink.start, sink.middle, sink.end, locale, errorCode);
- if (result == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
- if (U_FAILURE(errorCode)) {
- delete result;
- return nullptr;
- }
- return result;
-}
-
-ListFormatter* ListFormatter::createInstance(UErrorCode& errorCode) {
- Locale locale; // The default locale.
- return createInstance(locale, errorCode);
-}
-
-ListFormatter* ListFormatter::createInstance(const Locale& locale, UErrorCode& errorCode) {
-#if !UCONFIG_NO_FORMATTING
- return createInstance(locale, ULISTFMT_TYPE_AND, ULISTFMT_WIDTH_WIDE, errorCode);
-#else
- return createInstance(locale, "standard", errorCode);
-#endif
-}
-
-#if !UCONFIG_NO_FORMATTING
-ListFormatter* ListFormatter::createInstance(
- const Locale& locale, UListFormatterType type, UListFormatterWidth width, UErrorCode& errorCode) {
- const char* style = typeWidthToStyleString(type, width);
- if (style == nullptr) {
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
- }
- return createInstance(locale, style, errorCode);
-}
-#endif
-
-ListFormatter* ListFormatter::createInstance(const Locale& locale, const char *style, UErrorCode& errorCode) {
- const ListFormatInternal* listFormatInternal = getListFormatInternal(locale, style, errorCode);
- if (U_FAILURE(errorCode)) {
- return nullptr;
- }
- ListFormatter* p = new ListFormatter(listFormatInternal);
- if (p == nullptr) {
- errorCode = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
- return p;
-}
-
-ListFormatter::ListFormatter(const ListFormatData& listFormatData, UErrorCode &errorCode) {
- owned = new ListFormatInternal(listFormatData, errorCode);
- data = owned;
-}
-
-ListFormatter::ListFormatter(const ListFormatInternal* listFormatterInternal) : owned(nullptr), data(listFormatterInternal) {
-}
-
-ListFormatter::~ListFormatter() {
- delete owned;
-}
-
-/**
- * Joins first and second using the pattern pat.
- * On entry offset is an offset into first or -1 if offset unspecified.
- * On exit offset is offset of second in result if recordOffset was set
- * Otherwise if it was >=0 it is set to point into result where it used
- * to point into first. On exit, result is the join of first and second
- * according to pat. Any previous value of result gets replaced.
- */
-static void joinStringsAndReplace(
- const SimpleFormatter& pat,
- const UnicodeString& first,
- const UnicodeString& second,
- UnicodeString &result,
- UBool recordOffset,
- int32_t &offset,
- int32_t *offsetFirst,
- int32_t *offsetSecond,
- UErrorCode& errorCode) {
- if (U_FAILURE(errorCode)) {
- return;
- }
- const UnicodeString *params[2] = {&first, &second};
- int32_t offsets[2];
- pat.formatAndReplace(
- params,
- UPRV_LENGTHOF(params),
- result,
- offsets,
- UPRV_LENGTHOF(offsets),
- errorCode);
- if (U_FAILURE(errorCode)) {
- return;
- }
- if (offsets[0] == -1 || offsets[1] == -1) {
- errorCode = U_INVALID_FORMAT_ERROR;
- return;
- }
- if (recordOffset) {
- offset = offsets[1];
- } else if (offset >= 0) {
- offset += offsets[0];
- }
- if (offsetFirst != nullptr) *offsetFirst = offsets[0];
- if (offsetSecond != nullptr) *offsetSecond = offsets[1];
-}
-
-UnicodeString& ListFormatter::format(
- const UnicodeString items[],
- int32_t nItems,
- UnicodeString& appendTo,
- UErrorCode& errorCode) const {
- int32_t offset;
- return format(items, nItems, appendTo, -1, offset, errorCode);
-}
-
-UnicodeString& ListFormatter::format(
- const UnicodeString items[],
- int32_t nItems,
- UnicodeString& appendTo,
- int32_t index,
- int32_t &offset,
- UErrorCode& errorCode) const {
- return format_(items, nItems, appendTo, index, offset, nullptr, errorCode);
-}
-
-#if !UCONFIG_NO_FORMATTING
-FormattedList ListFormatter::formatStringsToValue(
- const UnicodeString items[],
- int32_t nItems,
- UErrorCode& errorCode) const {
- LocalPointer<FormattedListData> result(new FormattedListData(errorCode), errorCode);
- if (U_FAILURE(errorCode)) {
- return FormattedList(errorCode);
- }
- UnicodeString string;
- int32_t offset;
- auto handler = result->getHandler(errorCode);
- handler.setCategory(UFIELD_CATEGORY_LIST);
- format_(items, nItems, string, -1, offset, &handler, errorCode);
- handler.getError(errorCode);
- result->appendString(string, errorCode);
- if (U_FAILURE(errorCode)) {
- return FormattedList(errorCode);
- }
-
- // Add span fields and sort
- ConstrainedFieldPosition cfpos;
- cfpos.constrainField(UFIELD_CATEGORY_LIST, ULISTFMT_ELEMENT_FIELD);
- int32_t i = 0;
- handler.setCategory(UFIELD_CATEGORY_LIST_SPAN);
- while (result->nextPosition(cfpos, errorCode)) {
- handler.addAttribute(i++, cfpos.getStart(), cfpos.getLimit());
- }
- handler.getError(errorCode);
- if (U_FAILURE(errorCode)) {
- return FormattedList(errorCode);
- }
- result->sort();
-
- return FormattedList(result.orphan());
-}
-#endif
-
-UnicodeString& ListFormatter::format_(
- const UnicodeString items[],
- int32_t nItems,
- UnicodeString& appendTo,
- int32_t index,
- int32_t &offset,
- FieldPositionHandler* handler,
- UErrorCode& errorCode) const {
-#if !UCONFIG_NO_FORMATTING
- offset = -1;
- if (U_FAILURE(errorCode)) {
- return appendTo;
- }
- if (data == nullptr) {
- errorCode = U_INVALID_STATE_ERROR;
- return appendTo;
- }
-
- if (nItems <= 0) {
- return appendTo;
- }
- if (nItems == 1) {
- if (index == 0) {
- offset = appendTo.length();
- }
- if (handler != nullptr) {
- handler->addAttribute(ULISTFMT_ELEMENT_FIELD,
- appendTo.length(),
- appendTo.length() + items[0].length());
- }
- appendTo.append(items[0]);
- return appendTo;
- }
- UnicodeString result(items[0]);
- if (index == 0) {
- offset = 0;
- }
- int32_t offsetFirst = 0;
- int32_t offsetSecond = 0;
- int32_t prefixLength = 0;
- // for n items, there are 2 * (n + 1) boundary including 0 and the upper
- // edge.
- MaybeStackArray<int32_t, 10> offsets((handler != nullptr) ? 2 * (nItems + 1): 0);
- if (nItems == 2) {
- joinStringsAndReplace(
- data->patternHandler->getTwoPattern(items[1]),
- result,
- items[1],
- result,
- index == 1,
- offset,
- &offsetFirst,
- &offsetSecond,
- errorCode);
- } else {
- joinStringsAndReplace(
- data->startPattern,
- result,
- items[1],
- result,
- index == 1,
- offset,
- &offsetFirst,
- &offsetSecond,
- errorCode);
- }
- if (handler != nullptr) {
- offsets[0] = 0;
- prefixLength += offsetFirst;
- offsets[1] = offsetSecond - prefixLength;
- }
- if (nItems > 2) {
- for (int32_t i = 2; i < nItems - 1; ++i) {
- joinStringsAndReplace(
- data->middlePattern,
- result,
- items[i],
- result,
- index == i,
- offset,
- &offsetFirst,
- &offsetSecond,
- errorCode);
- if (handler != nullptr) {
- prefixLength += offsetFirst;
- offsets[i] = offsetSecond - prefixLength;
- }
- }
- joinStringsAndReplace(
- data->patternHandler->getEndPattern(items[nItems - 1]),
- result,
- items[nItems - 1],
- result,
- index == nItems - 1,
- offset,
- &offsetFirst,
- &offsetSecond,
- errorCode);
- if (handler != nullptr) {
- prefixLength += offsetFirst;
- offsets[nItems - 1] = offsetSecond - prefixLength;
- }
- }
- if (handler != nullptr) {
- // If there are already some data in appendTo, we need to adjust the index
- // by shifting that lenght while insert into handler.
- int32_t shift = appendTo.length() + prefixLength;
- // Output the ULISTFMT_ELEMENT_FIELD in the order of the input elements
- for (int32_t i = 0; i < nItems; ++i) {
- offsets[i + nItems] = offsets[i] + items[i].length() + shift;
- offsets[i] += shift;
- handler->addAttribute(
- ULISTFMT_ELEMENT_FIELD, // id
- offsets[i], // index
- offsets[i + nItems]); // limit
- }
- // The locale pattern may reorder the items (such as in ur-IN locale),
- // so we cannot assume the array is in accendning order.
- // To handle the edging case, just insert the two ends into the array
- // and sort. Then we output ULISTFMT_LITERAL_FIELD if the indecies
- // between the even and odd position are not the same in the sorted array.
- offsets[2 * nItems] = shift - prefixLength;
- offsets[2 * nItems + 1] = result.length() + shift - prefixLength;
- uprv_sortArray(offsets.getAlias(), 2 * (nItems + 1), sizeof(int32_t),
- uprv_int32Comparator, nullptr,
- false, &errorCode);
- for (int32_t i = 0; i <= nItems; ++i) {
- if (offsets[i * 2] != offsets[i * 2 + 1]) {
- handler->addAttribute(
- ULISTFMT_LITERAL_FIELD, // id
- offsets[i * 2], // index
- offsets[i * 2 + 1]); // limit
- }
- }
- }
- if (U_SUCCESS(errorCode)) {
- if (offset >= 0) {
- offset += appendTo.length();
- }
- appendTo += result;
- }
-#endif
- return appendTo;
-}
-
-U_NAMESPACE_END
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+* Copyright (C) 2013-2016, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: listformatter.cpp
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2012aug27
+* created by: Umesh P. Nair
+*/
+
+#include "cmemory.h"
+#include "unicode/fpositer.h" // FieldPositionIterator
+#include "unicode/listformatter.h"
+#include "unicode/simpleformatter.h"
+#include "unicode/ulistformatter.h"
+#include "unicode/uscript.h"
+#include "fphdlimp.h"
+#include "mutex.h"
+#include "hash.h"
+#include "cstring.h"
+#include "uarrsort.h"
+#include "ulocimp.h"
+#include "charstr.h"
+#include "ucln_in.h"
+#include "uresimp.h"
+#include "resource.h"
+#include "formattedval_impl.h"
+
+U_NAMESPACE_BEGIN
+
+namespace {
+
+class PatternHandler : public UObject {
+public:
+ PatternHandler(const UnicodeString& two, const UnicodeString& end, UErrorCode& errorCode) :
+ twoPattern(two, 2, 2, errorCode),
+ endPattern(end, 2, 2, errorCode) { }
+
+ PatternHandler(const SimpleFormatter& two, const SimpleFormatter& end) :
+ twoPattern(two),
+ endPattern(end) { }
+
+ virtual ~PatternHandler();
+
+ virtual PatternHandler* clone() const { return new PatternHandler(twoPattern, endPattern); }
+
+ virtual const SimpleFormatter& getTwoPattern(const UnicodeString&) const {
+ return twoPattern;
+ }
+
+ virtual const SimpleFormatter& getEndPattern(const UnicodeString&) const {
+ return endPattern;
+ }
+
+protected:
+ SimpleFormatter twoPattern;
+ SimpleFormatter endPattern;
+};
+
+PatternHandler::~PatternHandler() {
+}
+
+class ContextualHandler : public PatternHandler {
+public:
+ ContextualHandler(bool (*testFunc)(const UnicodeString& text),
+ const UnicodeString& thenTwo,
+ const UnicodeString& elseTwo,
+ const UnicodeString& thenEnd,
+ const UnicodeString& elseEnd,
+ UErrorCode& errorCode) :
+ PatternHandler(elseTwo, elseEnd, errorCode),
+ test(testFunc),
+ thenTwoPattern(thenTwo, 2, 2, errorCode),
+ thenEndPattern(thenEnd, 2, 2, errorCode) { }
+
+ ContextualHandler(bool (*testFunc)(const UnicodeString& text),
+ const SimpleFormatter& thenTwo, SimpleFormatter elseTwo,
+ const SimpleFormatter& thenEnd, SimpleFormatter elseEnd) :
+ PatternHandler(elseTwo, elseEnd),
+ test(testFunc),
+ thenTwoPattern(thenTwo),
+ thenEndPattern(thenEnd) { }
+
+ ~ContextualHandler() override;
+
+ PatternHandler* clone() const override {
+ return new ContextualHandler(
+ test, thenTwoPattern, twoPattern, thenEndPattern, endPattern);
+ }
+
+ const SimpleFormatter& getTwoPattern(
+ const UnicodeString& text) const override {
+ return (test)(text) ? thenTwoPattern : twoPattern;
+ }
+
+ const SimpleFormatter& getEndPattern(
+ const UnicodeString& text) const override {
+ return (test)(text) ? thenEndPattern : endPattern;
+ }
+
+private:
+ bool (*test)(const UnicodeString&);
+ SimpleFormatter thenTwoPattern;
+ SimpleFormatter thenEndPattern;
+};
+
+ContextualHandler::~ContextualHandler() {
+}
+
+static const char16_t *spanishY = u"{0} y {1}";
+static const char16_t *spanishE = u"{0} e {1}";
+static const char16_t *spanishO = u"{0} o {1}";
+static const char16_t *spanishU = u"{0} u {1}";
+static const char16_t *hebrewVav = u"{0} \u05D5{1}";
+static const char16_t *hebrewVavDash = u"{0} \u05D5-{1}";
+
+// Condiction to change to e.
+// Starts with "hi" or "i" but not with "hie" nor "hia"
+static bool shouldChangeToE(const UnicodeString& text) {
+ int32_t len = text.length();
+ if (len == 0) { return false; }
+ // Case insensitive match hi but not hie nor hia.
+ if ((text[0] == u'h' || text[0] == u'H') &&
+ ((len > 1) && (text[1] == u'i' || text[1] == u'I')) &&
+ ((len == 2) || !(text[2] == u'a' || text[2] == u'A' || text[2] == u'e' || text[2] == u'E'))) {
+ return true;
+ }
+ // Case insensitive for "start with i"
+ if (text[0] == u'i' || text[0] == u'I') { return true; }
+ return false;
+}
+
+// Condiction to change to u.
+// Starts with "o", "ho", and "8". Also "11" by itself.
+// re: ^((o|ho|8).*|11)$
+static bool shouldChangeToU(const UnicodeString& text) {
+ int32_t len = text.length();
+ if (len == 0) { return false; }
+ // Case insensitive match o.* and 8.*
+ if (text[0] == u'o' || text[0] == u'O' || text[0] == u'8') { return true; }
+ // Case insensitive match ho.*
+ if ((text[0] == u'h' || text[0] == u'H') &&
+ ((len > 1) && (text[1] == 'o' || text[1] == u'O'))) {
+ return true;
+ }
+ // match "^11$" and "^11 .*"
+ if ((len >= 2) && text[0] == u'1' && text[1] == u'1' && (len == 2 || text[2] == u' ')) { return true; }
+ return false;
+}
+
+// Condiction to change to VAV follow by a dash.
+// Starts with non Hebrew letter.
+static bool shouldChangeToVavDash(const UnicodeString& text) {
+ if (text.isEmpty()) { return false; }
+ UErrorCode status = U_ZERO_ERROR;
+ return uscript_getScript(text.char32At(0), &status) != USCRIPT_HEBREW;
+}
+
+PatternHandler* createPatternHandler(
+ const char* lang, const UnicodeString& two, const UnicodeString& end,
+ UErrorCode& status) {
+ if (uprv_strcmp(lang, "es") == 0) {
+ // Spanish
+ UnicodeString spanishYStr(TRUE, spanishY, -1);
+ bool twoIsY = two == spanishYStr;
+ bool endIsY = end == spanishYStr;
+ if (twoIsY || endIsY) {
+ UnicodeString replacement(TRUE, spanishE, -1);
+ return new ContextualHandler(
+ shouldChangeToE,
+ twoIsY ? replacement : two, two,
+ endIsY ? replacement : end, end, status);
+ }
+ UnicodeString spanishOStr(TRUE, spanishO, -1);
+ bool twoIsO = two == spanishOStr;
+ bool endIsO = end == spanishOStr;
+ if (twoIsO || endIsO) {
+ UnicodeString replacement(TRUE, spanishU, -1);
+ return new ContextualHandler(
+ shouldChangeToU,
+ twoIsO ? replacement : two, two,
+ endIsO ? replacement : end, end, status);
+ }
+ } else if (uprv_strcmp(lang, "he") == 0 || uprv_strcmp(lang, "iw") == 0) {
+ // Hebrew
+ UnicodeString hebrewVavStr(TRUE, hebrewVav, -1);
+ bool twoIsVav = two == hebrewVavStr;
+ bool endIsVav = end == hebrewVavStr;
+ if (twoIsVav || endIsVav) {
+ UnicodeString replacement(TRUE, hebrewVavDash, -1);
+ return new ContextualHandler(
+ shouldChangeToVavDash,
+ twoIsVav ? replacement : two, two,
+ endIsVav ? replacement : end, end, status);
+ }
+ }
+ return new PatternHandler(two, end, status);
+}
+
+} // namespace
+
+struct ListFormatInternal : public UMemory {
+ SimpleFormatter startPattern;
+ SimpleFormatter middlePattern;
+ LocalPointer<PatternHandler> patternHandler;
+
+ListFormatInternal(
+ const UnicodeString& two,
+ const UnicodeString& start,
+ const UnicodeString& middle,
+ const UnicodeString& end,
+ const Locale& locale,
+ UErrorCode &errorCode) :
+ startPattern(start, 2, 2, errorCode),
+ middlePattern(middle, 2, 2, errorCode),
+ patternHandler(createPatternHandler(locale.getLanguage(), two, end, errorCode), errorCode) { }
+
+ListFormatInternal(const ListFormatData &data, UErrorCode &errorCode) :
+ startPattern(data.startPattern, errorCode),
+ middlePattern(data.middlePattern, errorCode),
+ patternHandler(createPatternHandler(
+ data.locale.getLanguage(), data.twoPattern, data.endPattern, errorCode), errorCode) { }
+
+ListFormatInternal(const ListFormatInternal &other) :
+ startPattern(other.startPattern),
+ middlePattern(other.middlePattern),
+ patternHandler(other.patternHandler->clone()) { }
+};
+
+
+#if !UCONFIG_NO_FORMATTING
+class FormattedListData : public FormattedValueFieldPositionIteratorImpl {
+public:
+ FormattedListData(UErrorCode& status) : FormattedValueFieldPositionIteratorImpl(5, status) {}
+ virtual ~FormattedListData();
+};
+
+FormattedListData::~FormattedListData() = default;
+
+UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedList)
+#endif
+
+
+static Hashtable* listPatternHash = nullptr;
+
+U_CDECL_BEGIN
+static UBool U_CALLCONV uprv_listformatter_cleanup() {
+ delete listPatternHash;
+ listPatternHash = nullptr;
+ return TRUE;
+}
+
+static void U_CALLCONV
+uprv_deleteListFormatInternal(void *obj) {
+ delete static_cast<ListFormatInternal *>(obj);
+}
+
+U_CDECL_END
+
+ListFormatter::ListFormatter(const ListFormatter& other) :
+ owned(other.owned), data(other.data) {
+ if (other.owned != nullptr) {
+ owned = new ListFormatInternal(*other.owned);
+ data = owned;
+ }
+}
+
+ListFormatter& ListFormatter::operator=(const ListFormatter& other) {
+ if (this == &other) {
+ return *this;
+ }
+ delete owned;
+ if (other.owned) {
+ owned = new ListFormatInternal(*other.owned);
+ data = owned;
+ } else {
+ owned = nullptr;
+ data = other.data;
+ }
+ return *this;
+}
+
+void ListFormatter::initializeHash(UErrorCode& errorCode) {
+ if (U_FAILURE(errorCode)) {
+ return;
+ }
+
+ listPatternHash = new Hashtable();
+ if (listPatternHash == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+
+ listPatternHash->setValueDeleter(uprv_deleteListFormatInternal);
+ ucln_i18n_registerCleanup(UCLN_I18N_LIST_FORMATTER, uprv_listformatter_cleanup);
+
+}
+
+const ListFormatInternal* ListFormatter::getListFormatInternal(
+ const Locale& locale, const char *style, UErrorCode& errorCode) {
+ if (U_FAILURE(errorCode)) {
+ return nullptr;
+ }
+ CharString keyBuffer(locale.getName(), errorCode);
+ keyBuffer.append(':', errorCode).append(style, errorCode);
+ UnicodeString key(keyBuffer.data(), -1, US_INV);
+ ListFormatInternal* result = nullptr;
+ static UMutex listFormatterMutex;
+ {
+ Mutex m(&listFormatterMutex);
+ if (listPatternHash == nullptr) {
+ initializeHash(errorCode);
+ if (U_FAILURE(errorCode)) {
+ return nullptr;
+ }
+ }
+ result = static_cast<ListFormatInternal*>(listPatternHash->get(key));
+ }
+ if (result != nullptr) {
+ return result;
+ }
+ result = loadListFormatInternal(locale, style, errorCode);
+ if (U_FAILURE(errorCode)) {
+ return nullptr;
+ }
+
+ {
+ Mutex m(&listFormatterMutex);
+ ListFormatInternal* temp = static_cast<ListFormatInternal*>(listPatternHash->get(key));
+ if (temp != nullptr) {
+ delete result;
+ result = temp;
+ } else {
+ listPatternHash->put(key, result, errorCode);
+ if (U_FAILURE(errorCode)) {
+ return nullptr;
+ }
+ }
+ }
+ return result;
+}
+
+#if !UCONFIG_NO_FORMATTING
+static const char* typeWidthToStyleString(UListFormatterType type, UListFormatterWidth width) {
+ switch (type) {
+ case ULISTFMT_TYPE_AND:
+ switch (width) {
+ case ULISTFMT_WIDTH_WIDE:
+ return "standard";
+ case ULISTFMT_WIDTH_SHORT:
+ return "standard-short";
+ case ULISTFMT_WIDTH_NARROW:
+ return "standard-narrow";
+ default:
+ return nullptr;
+ }
+ break;
+
+ case ULISTFMT_TYPE_OR:
+ switch (width) {
+ case ULISTFMT_WIDTH_WIDE:
+ return "or";
+ case ULISTFMT_WIDTH_SHORT:
+ return "or-short";
+ case ULISTFMT_WIDTH_NARROW:
+ return "or-narrow";
+ default:
+ return nullptr;
+ }
+ break;
+
+ case ULISTFMT_TYPE_UNITS:
+ switch (width) {
+ case ULISTFMT_WIDTH_WIDE:
+ return "unit";
+ case ULISTFMT_WIDTH_SHORT:
+ return "unit-short";
+ case ULISTFMT_WIDTH_NARROW:
+ return "unit-narrow";
+ default:
+ return nullptr;
+ }
+ }
+
+ return nullptr;
+}
+#endif
+
+static const UChar solidus = 0x2F;
+static const UChar aliasPrefix[] = { 0x6C,0x69,0x73,0x74,0x50,0x61,0x74,0x74,0x65,0x72,0x6E,0x2F }; // "listPattern/"
+enum {
+ kAliasPrefixLen = UPRV_LENGTHOF(aliasPrefix),
+ kStyleLenMax = 24 // longest currently is 14
+};
+
+struct ListFormatter::ListPatternsSink : public ResourceSink {
+ UnicodeString two, start, middle, end;
+#if ((U_PLATFORM == U_PF_AIX) || (U_PLATFORM == U_PF_OS390)) && (U_CPLUSPLUS_VERSION < 11)
+ char aliasedStyle[kStyleLenMax+1];
+ ListPatternsSink() {
+ uprv_memset(aliasedStyle, 0, kStyleLenMax+1);
+ }
+#else
+ char aliasedStyle[kStyleLenMax+1] = {0};
+
+ ListPatternsSink() {}
+#endif
+ virtual ~ListPatternsSink();
+
+ void setAliasedStyle(UnicodeString alias) {
+ int32_t startIndex = alias.indexOf(aliasPrefix, kAliasPrefixLen, 0);
+ if (startIndex < 0) {
+ return;
+ }
+ startIndex += kAliasPrefixLen;
+ int32_t endIndex = alias.indexOf(solidus, startIndex);
+ if (endIndex < 0) {
+ endIndex = alias.length();
+ }
+ alias.extract(startIndex, endIndex-startIndex, aliasedStyle, kStyleLenMax+1, US_INV);
+ aliasedStyle[kStyleLenMax] = 0;
+ }
+
+ void handleValueForPattern(ResourceValue &value, UnicodeString &pattern, UErrorCode &errorCode) {
+ if (pattern.isEmpty()) {
+ if (value.getType() == URES_ALIAS) {
+ if (aliasedStyle[0] == 0) {
+ setAliasedStyle(value.getAliasUnicodeString(errorCode));
+ }
+ } else {
+ pattern = value.getUnicodeString(errorCode);
+ }
+ }
+ }
+
+ virtual void put(const char *key, ResourceValue &value, UBool /*noFallback*/,
+ UErrorCode &errorCode) {
+ aliasedStyle[0] = 0;
+ if (value.getType() == URES_ALIAS) {
+ setAliasedStyle(value.getAliasUnicodeString(errorCode));
+ return;
+ }
+ ResourceTable listPatterns = value.getTable(errorCode);
+ for (int i = 0; U_SUCCESS(errorCode) && listPatterns.getKeyAndValue(i, key, value); ++i) {
+ if (uprv_strcmp(key, "2") == 0) {
+ handleValueForPattern(value, two, errorCode);
+ } else if (uprv_strcmp(key, "end") == 0) {
+ handleValueForPattern(value, end, errorCode);
+ } else if (uprv_strcmp(key, "middle") == 0) {
+ handleValueForPattern(value, middle, errorCode);
+ } else if (uprv_strcmp(key, "start") == 0) {
+ handleValueForPattern(value, start, errorCode);
+ }
+ }
+ }
+};
+
+// Virtual destructors must be defined out of line.
+ListFormatter::ListPatternsSink::~ListPatternsSink() {}
+
+ListFormatInternal* ListFormatter::loadListFormatInternal(
+ const Locale& locale, const char * style, UErrorCode& errorCode) {
+ UResourceBundle* rb = ures_open(nullptr, locale.getName(), &errorCode);
+ rb = ures_getByKeyWithFallback(rb, "listPattern", rb, &errorCode);
+ if (U_FAILURE(errorCode)) {
+ ures_close(rb);
+ return nullptr;
+ }
+ ListFormatter::ListPatternsSink sink;
+ char currentStyle[kStyleLenMax+1];
+ uprv_strncpy(currentStyle, style, kStyleLenMax);
+ currentStyle[kStyleLenMax] = 0;
+
+ for (;;) {
+ ures_getAllItemsWithFallback(rb, currentStyle, sink, errorCode);
+ if (U_FAILURE(errorCode) || sink.aliasedStyle[0] == 0 || uprv_strcmp(currentStyle, sink.aliasedStyle) == 0) {
+ break;
+ }
+ uprv_strcpy(currentStyle, sink.aliasedStyle);
+ }
+ ures_close(rb);
+ if (U_FAILURE(errorCode)) {
+ return nullptr;
+ }
+ if (sink.two.isEmpty() || sink.start.isEmpty() || sink.middle.isEmpty() || sink.end.isEmpty()) {
+ errorCode = U_MISSING_RESOURCE_ERROR;
+ return nullptr;
+ }
+
+ ListFormatInternal* result = new ListFormatInternal(sink.two, sink.start, sink.middle, sink.end, locale, errorCode);
+ if (result == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+ if (U_FAILURE(errorCode)) {
+ delete result;
+ return nullptr;
+ }
+ return result;
+}
+
+ListFormatter* ListFormatter::createInstance(UErrorCode& errorCode) {
+ Locale locale; // The default locale.
+ return createInstance(locale, errorCode);
+}
+
+ListFormatter* ListFormatter::createInstance(const Locale& locale, UErrorCode& errorCode) {
+#if !UCONFIG_NO_FORMATTING
+ return createInstance(locale, ULISTFMT_TYPE_AND, ULISTFMT_WIDTH_WIDE, errorCode);
+#else
+ return createInstance(locale, "standard", errorCode);
+#endif
+}
+
+#if !UCONFIG_NO_FORMATTING
+ListFormatter* ListFormatter::createInstance(
+ const Locale& locale, UListFormatterType type, UListFormatterWidth width, UErrorCode& errorCode) {
+ const char* style = typeWidthToStyleString(type, width);
+ if (style == nullptr) {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return nullptr;
+ }
+ return createInstance(locale, style, errorCode);
+}
+#endif
+
+ListFormatter* ListFormatter::createInstance(const Locale& locale, const char *style, UErrorCode& errorCode) {
+ const ListFormatInternal* listFormatInternal = getListFormatInternal(locale, style, errorCode);
+ if (U_FAILURE(errorCode)) {
+ return nullptr;
+ }
+ ListFormatter* p = new ListFormatter(listFormatInternal);
+ if (p == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+ return p;
+}
+
+ListFormatter::ListFormatter(const ListFormatData& listFormatData, UErrorCode &errorCode) {
+ owned = new ListFormatInternal(listFormatData, errorCode);
+ data = owned;
+}
+
+ListFormatter::ListFormatter(const ListFormatInternal* listFormatterInternal) : owned(nullptr), data(listFormatterInternal) {
+}
+
+ListFormatter::~ListFormatter() {
+ delete owned;
+}
+
+/**
+ * Joins first and second using the pattern pat.
+ * On entry offset is an offset into first or -1 if offset unspecified.
+ * On exit offset is offset of second in result if recordOffset was set
+ * Otherwise if it was >=0 it is set to point into result where it used
+ * to point into first. On exit, result is the join of first and second
+ * according to pat. Any previous value of result gets replaced.
+ */
+static void joinStringsAndReplace(
+ const SimpleFormatter& pat,
+ const UnicodeString& first,
+ const UnicodeString& second,
+ UnicodeString &result,
+ UBool recordOffset,
+ int32_t &offset,
+ int32_t *offsetFirst,
+ int32_t *offsetSecond,
+ UErrorCode& errorCode) {
+ if (U_FAILURE(errorCode)) {
+ return;
+ }
+ const UnicodeString *params[2] = {&first, &second};
+ int32_t offsets[2];
+ pat.formatAndReplace(
+ params,
+ UPRV_LENGTHOF(params),
+ result,
+ offsets,
+ UPRV_LENGTHOF(offsets),
+ errorCode);
+ if (U_FAILURE(errorCode)) {
+ return;
+ }
+ if (offsets[0] == -1 || offsets[1] == -1) {
+ errorCode = U_INVALID_FORMAT_ERROR;
+ return;
+ }
+ if (recordOffset) {
+ offset = offsets[1];
+ } else if (offset >= 0) {
+ offset += offsets[0];
+ }
+ if (offsetFirst != nullptr) *offsetFirst = offsets[0];
+ if (offsetSecond != nullptr) *offsetSecond = offsets[1];
+}
+
+UnicodeString& ListFormatter::format(
+ const UnicodeString items[],
+ int32_t nItems,
+ UnicodeString& appendTo,
+ UErrorCode& errorCode) const {
+ int32_t offset;
+ return format(items, nItems, appendTo, -1, offset, errorCode);
+}
+
+UnicodeString& ListFormatter::format(
+ const UnicodeString items[],
+ int32_t nItems,
+ UnicodeString& appendTo,
+ int32_t index,
+ int32_t &offset,
+ UErrorCode& errorCode) const {
+ return format_(items, nItems, appendTo, index, offset, nullptr, errorCode);
+}
+
+#if !UCONFIG_NO_FORMATTING
+FormattedList ListFormatter::formatStringsToValue(
+ const UnicodeString items[],
+ int32_t nItems,
+ UErrorCode& errorCode) const {
+ LocalPointer<FormattedListData> result(new FormattedListData(errorCode), errorCode);
+ if (U_FAILURE(errorCode)) {
+ return FormattedList(errorCode);
+ }
+ UnicodeString string;
+ int32_t offset;
+ auto handler = result->getHandler(errorCode);
+ handler.setCategory(UFIELD_CATEGORY_LIST);
+ format_(items, nItems, string, -1, offset, &handler, errorCode);
+ handler.getError(errorCode);
+ result->appendString(string, errorCode);
+ if (U_FAILURE(errorCode)) {
+ return FormattedList(errorCode);
+ }
+
+ // Add span fields and sort
+ ConstrainedFieldPosition cfpos;
+ cfpos.constrainField(UFIELD_CATEGORY_LIST, ULISTFMT_ELEMENT_FIELD);
+ int32_t i = 0;
+ handler.setCategory(UFIELD_CATEGORY_LIST_SPAN);
+ while (result->nextPosition(cfpos, errorCode)) {
+ handler.addAttribute(i++, cfpos.getStart(), cfpos.getLimit());
+ }
+ handler.getError(errorCode);
+ if (U_FAILURE(errorCode)) {
+ return FormattedList(errorCode);
+ }
+ result->sort();
+
+ return FormattedList(result.orphan());
+}
+#endif
+
+UnicodeString& ListFormatter::format_(
+ const UnicodeString items[],
+ int32_t nItems,
+ UnicodeString& appendTo,
+ int32_t index,
+ int32_t &offset,
+ FieldPositionHandler* handler,
+ UErrorCode& errorCode) const {
+#if !UCONFIG_NO_FORMATTING
+ offset = -1;
+ if (U_FAILURE(errorCode)) {
+ return appendTo;
+ }
+ if (data == nullptr) {
+ errorCode = U_INVALID_STATE_ERROR;
+ return appendTo;
+ }
+
+ if (nItems <= 0) {
+ return appendTo;
+ }
+ if (nItems == 1) {
+ if (index == 0) {
+ offset = appendTo.length();
+ }
+ if (handler != nullptr) {
+ handler->addAttribute(ULISTFMT_ELEMENT_FIELD,
+ appendTo.length(),
+ appendTo.length() + items[0].length());
+ }
+ appendTo.append(items[0]);
+ return appendTo;
+ }
+ UnicodeString result(items[0]);
+ if (index == 0) {
+ offset = 0;
+ }
+ int32_t offsetFirst = 0;
+ int32_t offsetSecond = 0;
+ int32_t prefixLength = 0;
+ // for n items, there are 2 * (n + 1) boundary including 0 and the upper
+ // edge.
+ MaybeStackArray<int32_t, 10> offsets((handler != nullptr) ? 2 * (nItems + 1): 0);
+ if (nItems == 2) {
+ joinStringsAndReplace(
+ data->patternHandler->getTwoPattern(items[1]),
+ result,
+ items[1],
+ result,
+ index == 1,
+ offset,
+ &offsetFirst,
+ &offsetSecond,
+ errorCode);
+ } else {
+ joinStringsAndReplace(
+ data->startPattern,
+ result,
+ items[1],
+ result,
+ index == 1,
+ offset,
+ &offsetFirst,
+ &offsetSecond,
+ errorCode);
+ }
+ if (handler != nullptr) {
+ offsets[0] = 0;
+ prefixLength += offsetFirst;
+ offsets[1] = offsetSecond - prefixLength;
+ }
+ if (nItems > 2) {
+ for (int32_t i = 2; i < nItems - 1; ++i) {
+ joinStringsAndReplace(
+ data->middlePattern,
+ result,
+ items[i],
+ result,
+ index == i,
+ offset,
+ &offsetFirst,
+ &offsetSecond,
+ errorCode);
+ if (handler != nullptr) {
+ prefixLength += offsetFirst;
+ offsets[i] = offsetSecond - prefixLength;
+ }
+ }
+ joinStringsAndReplace(
+ data->patternHandler->getEndPattern(items[nItems - 1]),
+ result,
+ items[nItems - 1],
+ result,
+ index == nItems - 1,
+ offset,
+ &offsetFirst,
+ &offsetSecond,
+ errorCode);
+ if (handler != nullptr) {
+ prefixLength += offsetFirst;
+ offsets[nItems - 1] = offsetSecond - prefixLength;
+ }
+ }
+ if (handler != nullptr) {
+ // If there are already some data in appendTo, we need to adjust the index
+ // by shifting that lenght while insert into handler.
+ int32_t shift = appendTo.length() + prefixLength;
+ // Output the ULISTFMT_ELEMENT_FIELD in the order of the input elements
+ for (int32_t i = 0; i < nItems; ++i) {
+ offsets[i + nItems] = offsets[i] + items[i].length() + shift;
+ offsets[i] += shift;
+ handler->addAttribute(
+ ULISTFMT_ELEMENT_FIELD, // id
+ offsets[i], // index
+ offsets[i + nItems]); // limit
+ }
+ // The locale pattern may reorder the items (such as in ur-IN locale),
+ // so we cannot assume the array is in accendning order.
+ // To handle the edging case, just insert the two ends into the array
+ // and sort. Then we output ULISTFMT_LITERAL_FIELD if the indecies
+ // between the even and odd position are not the same in the sorted array.
+ offsets[2 * nItems] = shift - prefixLength;
+ offsets[2 * nItems + 1] = result.length() + shift - prefixLength;
+ uprv_sortArray(offsets.getAlias(), 2 * (nItems + 1), sizeof(int32_t),
+ uprv_int32Comparator, nullptr,
+ false, &errorCode);
+ for (int32_t i = 0; i <= nItems; ++i) {
+ if (offsets[i * 2] != offsets[i * 2 + 1]) {
+ handler->addAttribute(
+ ULISTFMT_LITERAL_FIELD, // id
+ offsets[i * 2], // index
+ offsets[i * 2 + 1]); // limit
+ }
+ }
+ }
+ if (U_SUCCESS(errorCode)) {
+ if (offset >= 0) {
+ offset += appendTo.length();
+ }
+ appendTo += result;
+ }
+#endif
+ return appendTo;
+}
+
+U_NAMESPACE_END
diff --git a/contrib/libs/icu/i18n/measfmt.cpp b/contrib/libs/icu/i18n/measfmt.cpp
index 92dcfb9cf3..e05d66d413 100644
--- a/contrib/libs/icu/i18n/measfmt.cpp
+++ b/contrib/libs/icu/i18n/measfmt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -26,7 +26,7 @@
#include "unicode/decimfmt.h"
#include "uresimp.h"
#include "unicode/ures.h"
-#include "unicode/ustring.h"
+#include "unicode/ustring.h"
#include "ureslocs.h"
#include "cstring.h"
#include "mutex.h"
@@ -36,9 +36,9 @@
#include "unicode/putil.h"
#include "unicode/smpdtfmt.h"
#include "uassert.h"
-#include "unicode/numberformatter.h"
-#include "number_longnames.h"
-#include "number_utypes.h"
+#include "unicode/numberformatter.h"
+#include "number_longnames.h"
+#include "number_utypes.h"
#include "sharednumberformat.h"
#include "sharedpluralrules.h"
@@ -48,33 +48,33 @@
U_NAMESPACE_BEGIN
-using number::impl::UFormattedNumberData;
-
-static constexpr int32_t WIDTH_INDEX_COUNT = UMEASFMT_WIDTH_NARROW + 1;
-
+using number::impl::UFormattedNumberData;
+
+static constexpr int32_t WIDTH_INDEX_COUNT = UMEASFMT_WIDTH_NARROW + 1;
+
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(MeasureFormat)
// Used to format durations like 5:47 or 21:35:42.
class NumericDateFormatters : public UMemory {
public:
// Formats like H:mm
- UnicodeString hourMinute;
+ UnicodeString hourMinute;
// formats like M:ss
- UnicodeString minuteSecond;
+ UnicodeString minuteSecond;
// formats like H:mm:ss
- UnicodeString hourMinuteSecond;
+ UnicodeString hourMinuteSecond;
// Constructor that takes the actual patterns for hour-minute,
// minute-second, and hour-minute-second respectively.
NumericDateFormatters(
const UnicodeString &hm,
const UnicodeString &ms,
- const UnicodeString &hms) :
- hourMinute(hm),
- minuteSecond(ms),
- hourMinuteSecond(hms) {
+ const UnicodeString &hms) :
+ hourMinute(hm),
+ minuteSecond(ms),
+ hourMinuteSecond(hms) {
}
private:
NumericDateFormatters(const NumericDateFormatters &other);
@@ -88,19 +88,19 @@ static UMeasureFormatWidth getRegularWidth(UMeasureFormatWidth width) {
return width;
}
-static UNumberUnitWidth getUnitWidth(UMeasureFormatWidth width) {
- switch (width) {
- case UMEASFMT_WIDTH_WIDE:
- return UNUM_UNIT_WIDTH_FULL_NAME;
- case UMEASFMT_WIDTH_NARROW:
- case UMEASFMT_WIDTH_NUMERIC:
- return UNUM_UNIT_WIDTH_NARROW;
- case UMEASFMT_WIDTH_SHORT:
- default:
- return UNUM_UNIT_WIDTH_SHORT;
- }
-}
-
+static UNumberUnitWidth getUnitWidth(UMeasureFormatWidth width) {
+ switch (width) {
+ case UMEASFMT_WIDTH_WIDE:
+ return UNUM_UNIT_WIDTH_FULL_NAME;
+ case UMEASFMT_WIDTH_NARROW:
+ case UMEASFMT_WIDTH_NUMERIC:
+ return UNUM_UNIT_WIDTH_NARROW;
+ case UMEASFMT_WIDTH_SHORT:
+ default:
+ return UNUM_UNIT_WIDTH_SHORT;
+ }
+}
+
/**
* Instances contain all MeasureFormat specific data for a particular locale.
* This data is cached. It is never copied, but is shared via shared pointers.
@@ -147,20 +147,20 @@ public:
}
private:
- NumberFormat* currencyFormats[WIDTH_INDEX_COUNT];
- NumberFormat* integerFormat;
- NumericDateFormatters* numericDateFormatters;
-
+ NumberFormat* currencyFormats[WIDTH_INDEX_COUNT];
+ NumberFormat* integerFormat;
+ NumericDateFormatters* numericDateFormatters;
+
MeasureFormatCacheData(const MeasureFormatCacheData &other);
MeasureFormatCacheData &operator=(const MeasureFormatCacheData &other);
};
-MeasureFormatCacheData::MeasureFormatCacheData()
- : integerFormat(nullptr), numericDateFormatters(nullptr) {
+MeasureFormatCacheData::MeasureFormatCacheData()
+ : integerFormat(nullptr), numericDateFormatters(nullptr) {
for (int32_t i = 0; i < WIDTH_INDEX_COUNT; ++i) {
widthFallback[i] = UMEASFMT_WIDTH_COUNT;
}
- memset(currencyFormats, 0, sizeof(currencyFormats));
+ memset(currencyFormats, 0, sizeof(currencyFormats));
}
MeasureFormatCacheData::~MeasureFormatCacheData() {
@@ -231,7 +231,7 @@ static NumericDateFormatters *loadNumericDateFormatters(
NumericDateFormatters *result = new NumericDateFormatters(
loadNumericDateFormatterPattern(resource, "hm", status),
loadNumericDateFormatterPattern(resource, "ms", status),
- loadNumericDateFormatterPattern(resource, "hms", status));
+ loadNumericDateFormatterPattern(resource, "hms", status));
if (U_FAILURE(status)) {
delete result;
return NULL;
@@ -355,7 +355,7 @@ MeasureFormat::MeasureFormat(
: cache(NULL),
numberFormat(NULL),
pluralRules(NULL),
- fWidth(w),
+ fWidth(w),
listFormatter(NULL) {
initMeasureFormat(locale, w, NULL, status);
}
@@ -368,7 +368,7 @@ MeasureFormat::MeasureFormat(
: cache(NULL),
numberFormat(NULL),
pluralRules(NULL),
- fWidth(w),
+ fWidth(w),
listFormatter(NULL) {
initMeasureFormat(locale, w, nfToAdopt, status);
}
@@ -378,7 +378,7 @@ MeasureFormat::MeasureFormat(const MeasureFormat &other) :
cache(other.cache),
numberFormat(other.numberFormat),
pluralRules(other.pluralRules),
- fWidth(other.fWidth),
+ fWidth(other.fWidth),
listFormatter(NULL) {
cache->addRef();
numberFormat->addRef();
@@ -396,7 +396,7 @@ MeasureFormat &MeasureFormat::operator=(const MeasureFormat &other) {
SharedObject::copyPtr(other.cache, cache);
SharedObject::copyPtr(other.numberFormat, numberFormat);
SharedObject::copyPtr(other.pluralRules, pluralRules);
- fWidth = other.fWidth;
+ fWidth = other.fWidth;
delete listFormatter;
if (other.listFormatter != NULL) {
listFormatter = new ListFormatter(*other.listFormatter);
@@ -410,7 +410,7 @@ MeasureFormat::MeasureFormat() :
cache(NULL),
numberFormat(NULL),
pluralRules(NULL),
- fWidth(UMEASFMT_WIDTH_SHORT),
+ fWidth(UMEASFMT_WIDTH_SHORT),
listFormatter(NULL) {
}
@@ -440,7 +440,7 @@ UBool MeasureFormat::operator==(const Format &other) const {
// don't have to check it here.
// differing widths aren't equivalent
- if (fWidth != rhs.fWidth) {
+ if (fWidth != rhs.fWidth) {
return FALSE;
}
// Width the same check locales.
@@ -463,7 +463,7 @@ UBool MeasureFormat::operator==(const Format &other) const {
**numberFormat == **rhs.numberFormat);
}
-MeasureFormat *MeasureFormat::clone() const {
+MeasureFormat *MeasureFormat::clone() const {
return new MeasureFormat(*this);
}
@@ -501,22 +501,22 @@ UnicodeString &MeasureFormat::formatMeasurePerUnit(
if (U_FAILURE(status)) {
return appendTo;
}
- auto* df = dynamic_cast<const DecimalFormat*>(&getNumberFormatInternal());
- if (df == nullptr) {
- // Don't know how to handle other types of NumberFormat
- status = U_UNSUPPORTED_ERROR;
+ auto* df = dynamic_cast<const DecimalFormat*>(&getNumberFormatInternal());
+ if (df == nullptr) {
+ // Don't know how to handle other types of NumberFormat
+ status = U_UNSUPPORTED_ERROR;
return appendTo;
}
- UFormattedNumberData result;
- if (auto* lnf = df->toNumberFormatter(status)) {
- result.quantity.setToDouble(measure.getNumber().getDouble(status));
- lnf->unit(measure.getUnit())
- .perUnit(perUnit)
- .unitWidth(getUnitWidth(fWidth))
- .formatImpl(&result, status);
+ UFormattedNumberData result;
+ if (auto* lnf = df->toNumberFormatter(status)) {
+ result.quantity.setToDouble(measure.getNumber().getDouble(status));
+ lnf->unit(measure.getUnit())
+ .perUnit(perUnit)
+ .unitWidth(getUnitWidth(fWidth))
+ .formatImpl(&result, status);
}
- DecimalFormat::fieldPositionHelper(result, pos, appendTo.length(), status);
- appendTo.append(result.toTempString(status));
+ DecimalFormat::fieldPositionHelper(result, pos, appendTo.length(), status);
+ appendTo.append(result.toTempString(status));
return appendTo;
}
@@ -535,7 +535,7 @@ UnicodeString &MeasureFormat::formatMeasures(
if (measureCount == 1) {
return formatMeasure(measures[0], **numberFormat, appendTo, pos, status);
}
- if (fWidth == UMEASFMT_WIDTH_NUMERIC) {
+ if (fWidth == UMEASFMT_WIDTH_NUMERIC) {
Formattable hms[3];
int32_t bitMap = toHMS(measures, measureCount, hms, status);
if (bitMap > 0) {
@@ -568,12 +568,12 @@ UnicodeString &MeasureFormat::formatMeasures(
return appendTo;
}
-UnicodeString MeasureFormat::getUnitDisplayName(const MeasureUnit& unit, UErrorCode& status) const {
- return number::impl::LongNameHandler::getUnitDisplayName(
- getLocale(status),
- unit,
- getUnitWidth(fWidth),
- status);
+UnicodeString MeasureFormat::getUnitDisplayName(const MeasureUnit& unit, UErrorCode& status) const {
+ return number::impl::LongNameHandler::getUnitDisplayName(
+ getLocale(status),
+ unit,
+ getUnitWidth(fWidth),
+ status);
}
void MeasureFormat::initMeasureFormat(
@@ -602,7 +602,7 @@ void MeasureFormat::initMeasureFormat(
SharedObject::copyPtr(pr, pluralRules);
pr->removeRef();
if (nf.isNull()) {
- // TODO: Clean this up
+ // TODO: Clean this up
const SharedNumberFormat *shared = NumberFormat::createSharedInstance(
locale, UNUM_DECIMAL, status);
if (U_FAILURE(status)) {
@@ -616,11 +616,11 @@ void MeasureFormat::initMeasureFormat(
return;
}
}
- fWidth = w;
+ fWidth = w;
delete listFormatter;
listFormatter = ListFormatter::createInstance(
locale,
- listStyles[getRegularWidth(fWidth)],
+ listStyles[getRegularWidth(fWidth)],
status);
}
@@ -643,18 +643,18 @@ UBool MeasureFormat::setMeasureFormatLocale(const Locale &locale, UErrorCode &st
if (U_FAILURE(status) || locale == getLocale(status)) {
return FALSE;
}
- initMeasureFormat(locale, fWidth, NULL, status);
+ initMeasureFormat(locale, fWidth, NULL, status);
return U_SUCCESS(status);
}
-const NumberFormat &MeasureFormat::getNumberFormatInternal() const {
+const NumberFormat &MeasureFormat::getNumberFormatInternal() const {
return **numberFormat;
}
-const NumberFormat &MeasureFormat::getCurrencyFormatInternal() const {
- return *cache->getCurrencyFormat(UMEASFMT_WIDTH_NARROW);
-}
-
+const NumberFormat &MeasureFormat::getCurrencyFormatInternal() const {
+ return *cache->getCurrencyFormat(UMEASFMT_WIDTH_NARROW);
+}
+
const PluralRules &MeasureFormat::getPluralRules() const {
return **pluralRules;
}
@@ -681,142 +681,142 @@ UnicodeString &MeasureFormat::formatMeasure(
if (isCurrency(amtUnit)) {
UChar isoCode[4];
u_charsToUChars(amtUnit.getSubtype(), isoCode, 4);
- return cache->getCurrencyFormat(fWidth)->format(
+ return cache->getCurrencyFormat(fWidth)->format(
new CurrencyAmount(amtNumber, isoCode, status),
appendTo,
pos,
status);
}
- auto* df = dynamic_cast<const DecimalFormat*>(&nf);
- if (df == nullptr) {
- // Handle other types of NumberFormat using the ICU 63 code, modified to
- // get the unitPattern from LongNameHandler and handle fallback to OTHER.
- UnicodeString formattedNumber;
- StandardPlural::Form pluralForm = QuantityFormatter::selectPlural(
- amtNumber, nf, **pluralRules, formattedNumber, pos, status);
- UnicodeString pattern = number::impl::LongNameHandler::getUnitPattern(getLocale(status),
- amtUnit, getUnitWidth(fWidth), pluralForm, status);
- // The above handles fallback from other widths to short, and from other plural forms to OTHER
- if (U_FAILURE(status)) {
- return appendTo;
- }
- SimpleFormatter formatter(pattern, 0, 1, status);
- return QuantityFormatter::format(formatter, formattedNumber, appendTo, pos, status);
- }
- UFormattedNumberData result;
- if (auto* lnf = df->toNumberFormatter(status)) {
- result.quantity.setToDouble(amtNumber.getDouble(status));
- lnf->unit(amtUnit)
- .unitWidth(getUnitWidth(fWidth))
- .formatImpl(&result, status);
- }
- DecimalFormat::fieldPositionHelper(result, pos, appendTo.length(), status);
- appendTo.append(result.toTempString(status));
- return appendTo;
-}
-
-
-// Formats numeric time duration as 5:00:47 or 3:54.
+ auto* df = dynamic_cast<const DecimalFormat*>(&nf);
+ if (df == nullptr) {
+ // Handle other types of NumberFormat using the ICU 63 code, modified to
+ // get the unitPattern from LongNameHandler and handle fallback to OTHER.
+ UnicodeString formattedNumber;
+ StandardPlural::Form pluralForm = QuantityFormatter::selectPlural(
+ amtNumber, nf, **pluralRules, formattedNumber, pos, status);
+ UnicodeString pattern = number::impl::LongNameHandler::getUnitPattern(getLocale(status),
+ amtUnit, getUnitWidth(fWidth), pluralForm, status);
+ // The above handles fallback from other widths to short, and from other plural forms to OTHER
+ if (U_FAILURE(status)) {
+ return appendTo;
+ }
+ SimpleFormatter formatter(pattern, 0, 1, status);
+ return QuantityFormatter::format(formatter, formattedNumber, appendTo, pos, status);
+ }
+ UFormattedNumberData result;
+ if (auto* lnf = df->toNumberFormatter(status)) {
+ result.quantity.setToDouble(amtNumber.getDouble(status));
+ lnf->unit(amtUnit)
+ .unitWidth(getUnitWidth(fWidth))
+ .formatImpl(&result, status);
+ }
+ DecimalFormat::fieldPositionHelper(result, pos, appendTo.length(), status);
+ appendTo.append(result.toTempString(status));
+ return appendTo;
+}
+
+
+// Formats numeric time duration as 5:00:47 or 3:54.
UnicodeString &MeasureFormat::formatNumeric(
const Formattable *hms, // always length 3
- int32_t bitMap, // 1=hour set, 2=minute set, 4=second set
+ int32_t bitMap, // 1=hour set, 2=minute set, 4=second set
UnicodeString &appendTo,
UErrorCode &status) const {
if (U_FAILURE(status)) {
return appendTo;
}
- UnicodeString pattern;
+ UnicodeString pattern;
- double hours = hms[0].getDouble(status);
- double minutes = hms[1].getDouble(status);
- double seconds = hms[2].getDouble(status);
+ double hours = hms[0].getDouble(status);
+ double minutes = hms[1].getDouble(status);
+ double seconds = hms[2].getDouble(status);
if (U_FAILURE(status)) {
return appendTo;
}
- // All possible combinations: "h", "m", "s", "hm", "hs", "ms", "hms"
- if (bitMap == 5 || bitMap == 7) { // "hms" & "hs" (we add minutes if "hs")
- pattern = cache->getNumericDateFormatters()->hourMinuteSecond;
- hours = uprv_trunc(hours);
- minutes = uprv_trunc(minutes);
- } else if (bitMap == 3) { // "hm"
- pattern = cache->getNumericDateFormatters()->hourMinute;
- hours = uprv_trunc(hours);
- } else if (bitMap == 6) { // "ms"
- pattern = cache->getNumericDateFormatters()->minuteSecond;
- minutes = uprv_trunc(minutes);
- } else { // h m s, handled outside formatNumeric. No value is also an error.
+ // All possible combinations: "h", "m", "s", "hm", "hs", "ms", "hms"
+ if (bitMap == 5 || bitMap == 7) { // "hms" & "hs" (we add minutes if "hs")
+ pattern = cache->getNumericDateFormatters()->hourMinuteSecond;
+ hours = uprv_trunc(hours);
+ minutes = uprv_trunc(minutes);
+ } else if (bitMap == 3) { // "hm"
+ pattern = cache->getNumericDateFormatters()->hourMinute;
+ hours = uprv_trunc(hours);
+ } else if (bitMap == 6) { // "ms"
+ pattern = cache->getNumericDateFormatters()->minuteSecond;
+ minutes = uprv_trunc(minutes);
+ } else { // h m s, handled outside formatNumeric. No value is also an error.
status = U_INTERNAL_PROGRAM_ERROR;
return appendTo;
}
- const DecimalFormat *numberFormatter = dynamic_cast<const DecimalFormat*>(numberFormat->get());
- if (!numberFormatter) {
- status = U_INTERNAL_PROGRAM_ERROR;
- return appendTo;
- }
- number::LocalizedNumberFormatter numberFormatter2;
- if (auto* lnf = numberFormatter->toNumberFormatter(status)) {
- numberFormatter2 = lnf->integerWidth(number::IntegerWidth::zeroFillTo(2));
+ const DecimalFormat *numberFormatter = dynamic_cast<const DecimalFormat*>(numberFormat->get());
+ if (!numberFormatter) {
+ status = U_INTERNAL_PROGRAM_ERROR;
+ return appendTo;
+ }
+ number::LocalizedNumberFormatter numberFormatter2;
+ if (auto* lnf = numberFormatter->toNumberFormatter(status)) {
+ numberFormatter2 = lnf->integerWidth(number::IntegerWidth::zeroFillTo(2));
} else {
- return appendTo;
+ return appendTo;
}
- FormattedStringBuilder fsb;
+ FormattedStringBuilder fsb;
- UBool protect = FALSE;
- const int32_t patternLength = pattern.length();
- for (int32_t i = 0; i < patternLength; i++) {
- char16_t c = pattern[i];
+ UBool protect = FALSE;
+ const int32_t patternLength = pattern.length();
+ for (int32_t i = 0; i < patternLength; i++) {
+ char16_t c = pattern[i];
- // Also set the proper field in this switch
- // We don't use DateFormat.Field because this is not a date / time, is a duration.
- double value = 0;
- switch (c) {
- case u'H': value = hours; break;
- case u'm': value = minutes; break;
- case u's': value = seconds; break;
+ // Also set the proper field in this switch
+ // We don't use DateFormat.Field because this is not a date / time, is a duration.
+ double value = 0;
+ switch (c) {
+ case u'H': value = hours; break;
+ case u'm': value = minutes; break;
+ case u's': value = seconds; break;
}
- // There is not enough info to add Field(s) for the unit because all we have are plain
- // text patterns. For example in "21:51" there is no text for something like "hour",
- // while in something like "21h51" there is ("h"). But we can't really tell...
- switch (c) {
- case u'H':
- case u'm':
- case u's':
- if (protect) {
- fsb.appendChar16(c, kUndefinedField, status);
- } else {
- UnicodeString tmp;
- if ((i + 1 < patternLength) && pattern[i + 1] == c) { // doubled
- tmp = numberFormatter2.formatDouble(value, status).toString(status);
- i++;
- } else {
- numberFormatter->format(value, tmp, status);
- }
- // TODO: Use proper Field
- fsb.append(tmp, kUndefinedField, status);
- }
- break;
- case u'\'':
- // '' is escaped apostrophe
- if ((i + 1 < patternLength) && pattern[i + 1] == c) {
- fsb.appendChar16(c, kUndefinedField, status);
- i++;
- } else {
- protect = !protect;
- }
- break;
- default:
- fsb.appendChar16(c, kUndefinedField, status);
- }
- }
-
- appendTo.append(fsb.toTempUnicodeString());
-
- return appendTo;
+ // There is not enough info to add Field(s) for the unit because all we have are plain
+ // text patterns. For example in "21:51" there is no text for something like "hour",
+ // while in something like "21h51" there is ("h"). But we can't really tell...
+ switch (c) {
+ case u'H':
+ case u'm':
+ case u's':
+ if (protect) {
+ fsb.appendChar16(c, kUndefinedField, status);
+ } else {
+ UnicodeString tmp;
+ if ((i + 1 < patternLength) && pattern[i + 1] == c) { // doubled
+ tmp = numberFormatter2.formatDouble(value, status).toString(status);
+ i++;
+ } else {
+ numberFormatter->format(value, tmp, status);
+ }
+ // TODO: Use proper Field
+ fsb.append(tmp, kUndefinedField, status);
+ }
+ break;
+ case u'\'':
+ // '' is escaped apostrophe
+ if ((i + 1 < patternLength) && pattern[i + 1] == c) {
+ fsb.appendChar16(c, kUndefinedField, status);
+ i++;
+ } else {
+ protect = !protect;
+ }
+ break;
+ default:
+ fsb.appendChar16(c, kUndefinedField, status);
+ }
+ }
+
+ appendTo.append(fsb.toTempUnicodeString());
+
+ return appendTo;
}
UnicodeString &MeasureFormat::formatMeasuresSlowTrack(
@@ -830,7 +830,7 @@ UnicodeString &MeasureFormat::formatMeasuresSlowTrack(
}
FieldPosition dontCare(FieldPosition::DONT_CARE);
FieldPosition fpos(pos.getField());
- LocalArray<UnicodeString> results(new UnicodeString[measureCount], status);
+ LocalArray<UnicodeString> results(new UnicodeString[measureCount], status);
int32_t fieldPositionFoundIndex = -1;
for (int32_t i = 0; i < measureCount; ++i) {
const NumberFormat *nf = cache->getIntegerFormat();
@@ -851,7 +851,7 @@ UnicodeString &MeasureFormat::formatMeasuresSlowTrack(
}
int32_t offset;
listFormatter->format(
- results.getAlias(),
+ results.getAlias(),
measureCount,
appendTo,
fieldPositionFoundIndex,
@@ -860,7 +860,7 @@ UnicodeString &MeasureFormat::formatMeasuresSlowTrack(
if (U_FAILURE(status)) {
return appendTo;
}
- // Fix up FieldPosition indexes if our field is found.
+ // Fix up FieldPosition indexes if our field is found.
if (offset != -1) {
pos.setBeginIndex(fpos.getBeginIndex() + offset);
pos.setEndIndex(fpos.getEndIndex() + offset);
@@ -870,16 +870,16 @@ UnicodeString &MeasureFormat::formatMeasuresSlowTrack(
MeasureFormat* U_EXPORT2 MeasureFormat::createCurrencyFormat(const Locale& locale,
UErrorCode& ec) {
- if (U_FAILURE(ec)) {
- return nullptr;
+ if (U_FAILURE(ec)) {
+ return nullptr;
}
- LocalPointer<CurrencyFormat> fmt(new CurrencyFormat(locale, ec), ec);
- return fmt.orphan();
+ LocalPointer<CurrencyFormat> fmt(new CurrencyFormat(locale, ec), ec);
+ return fmt.orphan();
}
MeasureFormat* U_EXPORT2 MeasureFormat::createCurrencyFormat(UErrorCode& ec) {
if (U_FAILURE(ec)) {
- return nullptr;
+ return nullptr;
}
return MeasureFormat::createCurrencyFormat(Locale::getDefault(), ec);
}
diff --git a/contrib/libs/icu/i18n/measunit.cpp b/contrib/libs/icu/i18n/measunit.cpp
index cce8f5eb16..4edf130b7e 100644
--- a/contrib/libs/icu/i18n/measunit.cpp
+++ b/contrib/libs/icu/i18n/measunit.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -17,11 +17,11 @@
#if !UCONFIG_NO_FORMATTING
#include "unicode/uenum.h"
-#include "unicode/errorcode.h"
+#include "unicode/errorcode.h"
#include "ustrenum.h"
#include "cstring.h"
#include "uassert.h"
-#include "measunit_impl.h"
+#include "measunit_impl.h"
U_NAMESPACE_BEGIN
@@ -35,59 +35,59 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(MeasureUnit)
//
// Start generated code
-
+
static const int32_t gOffsets[] = {
0,
2,
7,
- 17,
- 25,
- 29,
- 328,
- 339,
- 355,
- 359,
- 368,
- 370,
- 374,
- 381,
- 402,
- 404,
- 418,
- 421,
- 427,
- 437,
- 441,
- 445,
- 447,
- 474
+ 17,
+ 25,
+ 29,
+ 328,
+ 339,
+ 355,
+ 359,
+ 368,
+ 370,
+ 374,
+ 381,
+ 402,
+ 404,
+ 418,
+ 421,
+ 427,
+ 437,
+ 441,
+ 445,
+ 447,
+ 474
};
static const int32_t gIndexes[] = {
0,
2,
7,
- 17,
- 25,
- 29,
- 29,
- 40,
- 56,
- 60,
- 69,
- 71,
- 75,
+ 17,
+ 25,
+ 29,
+ 29,
+ 40,
+ 56,
+ 60,
+ 69,
+ 71,
+ 75,
82,
- 103,
+ 103,
105,
- 119,
- 122,
- 128,
- 138,
- 142,
- 146,
- 148,
- 175
+ 119,
+ 122,
+ 128,
+ 138,
+ 142,
+ 146,
+ 148,
+ 175
};
// Must be sorted alphabetically.
@@ -102,32 +102,32 @@ static const char * const gTypes[] = {
"duration",
"electric",
"energy",
- "force",
+ "force",
"frequency",
- "graphics",
+ "graphics",
"length",
"light",
"mass",
- "none",
+ "none",
"power",
"pressure",
"speed",
"temperature",
- "torque",
+ "torque",
"volume"
};
// Must be grouped by type and sorted alphabetically within each type.
static const char * const gSubTypes[] = {
"g-force",
- "meter-per-square-second",
+ "meter-per-square-second",
"arc-minute",
"arc-second",
"degree",
"radian",
"revolution",
"acre",
- "dunam",
+ "dunam",
"hectare",
"square-centimeter",
"square-foot",
@@ -139,12 +139,12 @@ static const char * const gSubTypes[] = {
"karat",
"milligram-per-deciliter",
"millimole-per-liter",
- "mole",
- "percent",
- "permille",
- "permillion",
- "permyriad",
- "liter-per-100-kilometer",
+ "mole",
+ "percent",
+ "permille",
+ "permillion",
+ "permyriad",
+ "liter-per-100-kilometer",
"liter-per-kilometer",
"mile-per-gallon",
"mile-per-gallon-imperial",
@@ -152,18 +152,18 @@ static const char * const gSubTypes[] = {
"AED",
"AFA",
"AFN",
- "ALK",
+ "ALK",
"ALL",
"AMD",
"ANG",
"AOA",
- "AOK",
+ "AOK",
"AON",
"AOR",
"ARA",
"ARP",
"ARS",
- "ARY",
+ "ARY",
"ATS",
"AUD",
"AWG",
@@ -177,8 +177,8 @@ static const char * const gSubTypes[] = {
"BEC",
"BEF",
"BEL",
- "BGJ",
- "BGK",
+ "BGJ",
+ "BGK",
"BGL",
"BGN",
"BHD",
@@ -186,9 +186,9 @@ static const char * const gSubTypes[] = {
"BMD",
"BND",
"BOB",
- "BOP",
+ "BOP",
"BOV",
- "BRB",
+ "BRB",
"BRC",
"BRE",
"BRL",
@@ -196,10 +196,10 @@ static const char * const gSubTypes[] = {
"BRR",
"BSD",
"BTN",
- "BUK",
+ "BUK",
"BWP",
"BYB",
- "BYN",
+ "BYN",
"BYR",
"BZD",
"CAD",
@@ -215,7 +215,7 @@ static const char * const gSubTypes[] = {
"COU",
"CRC",
"CSD",
- "CSJ",
+ "CSJ",
"CSK",
"CUC",
"CUP",
@@ -250,13 +250,13 @@ static const char * const gSubTypes[] = {
"GHS",
"GIP",
"GMD",
- "GNE",
+ "GNE",
"GNF",
- "GNS",
+ "GNS",
"GQE",
"GRD",
"GTQ",
- "GWE",
+ "GWE",
"GWP",
"GYD",
"HKD",
@@ -267,13 +267,13 @@ static const char * const gSubTypes[] = {
"HUF",
"IDR",
"IEP",
- "ILP",
- "ILR",
+ "ILP",
+ "ILR",
"ILS",
"INR",
"IQD",
"IRR",
- "ISJ",
+ "ISJ",
"ISK",
"ITL",
"JMD",
@@ -288,13 +288,13 @@ static const char * const gSubTypes[] = {
"KWD",
"KYD",
"KZT",
- "LAJ",
+ "LAJ",
"LAK",
"LBP",
"LKR",
"LRD",
"LSL",
- "LSM",
+ "LSM",
"LTL",
"LTT",
"LUC",
@@ -313,23 +313,23 @@ static const char * const gSubTypes[] = {
"MNT",
"MOP",
"MRO",
- "MRU",
+ "MRU",
"MTL",
- "MTP",
+ "MTP",
"MUR",
- "MVQ",
+ "MVQ",
"MVR",
"MWK",
"MXN",
- "MXP",
+ "MXP",
"MXV",
"MYR",
- "MZE",
+ "MZE",
"MZM",
"MZN",
"NAD",
"NGN",
- "NIC",
+ "NIC",
"NIO",
"NLG",
"NOK",
@@ -337,7 +337,7 @@ static const char * const gSubTypes[] = {
"NZD",
"OMR",
"PAB",
- "PEH",
+ "PEH",
"PEI",
"PEN",
"PES",
@@ -349,8 +349,8 @@ static const char * const gSubTypes[] = {
"PTE",
"PYG",
"QAR",
- "RHD",
- "ROK",
+ "RHD",
+ "ROK",
"ROL",
"RON",
"RSD",
@@ -362,7 +362,7 @@ static const char * const gSubTypes[] = {
"SCR",
"SDD",
"SDG",
- "SDP",
+ "SDP",
"SEK",
"SGD",
"SHP",
@@ -374,8 +374,8 @@ static const char * const gSubTypes[] = {
"SRG",
"SSP",
"STD",
- "STN",
- "SUR",
+ "STN",
+ "SUR",
"SVC",
"SYP",
"SZL",
@@ -394,22 +394,22 @@ static const char * const gSubTypes[] = {
"TZS",
"UAH",
"UAK",
- "UGS",
- "UGW",
+ "UGS",
+ "UGW",
"UGX",
"USD",
"USN",
"USS",
"UYI",
- "UYN",
- "UYP",
+ "UYN",
+ "UYP",
"UYU",
- "UYW",
+ "UYW",
"UZS",
"VEB",
"VEF",
- "VES",
- "VNC",
+ "VES",
+ "VNC",
"VND",
"VUV",
"WST",
@@ -433,7 +433,7 @@ static const char * const gSubTypes[] = {
"XXX",
"YDD",
"YER",
- "YUD",
+ "YUD",
"YUM",
"YUN",
"ZAL",
@@ -442,7 +442,7 @@ static const char * const gSubTypes[] = {
"ZMW",
"ZRN",
"ZRZ",
- "ZWC",
+ "ZWC",
"ZWD",
"ZWL",
"ZWN",
@@ -455,51 +455,51 @@ static const char * const gSubTypes[] = {
"kilobyte",
"megabit",
"megabyte",
- "petabyte",
+ "petabyte",
"terabit",
"terabyte",
"century",
"day",
- "day-person",
- "decade",
+ "day-person",
+ "decade",
"hour",
"microsecond",
"millisecond",
"minute",
"month",
- "month-person",
+ "month-person",
"nanosecond",
"second",
"week",
- "week-person",
+ "week-person",
"year",
- "year-person",
+ "year-person",
"ampere",
"milliampere",
"ohm",
"volt",
- "british-thermal-unit",
+ "british-thermal-unit",
"calorie",
- "electronvolt",
+ "electronvolt",
"foodcalorie",
"joule",
"kilocalorie",
"kilojoule",
"kilowatt-hour",
- "therm-us",
- "newton",
- "pound-force",
+ "therm-us",
+ "newton",
+ "pound-force",
"gigahertz",
"hertz",
"kilohertz",
"megahertz",
- "dot-per-centimeter",
- "dot-per-inch",
- "em",
- "megapixel",
- "pixel",
- "pixel-per-centimeter",
- "pixel-per-inch",
+ "dot-per-centimeter",
+ "dot-per-inch",
+ "em",
+ "megapixel",
+ "pixel",
+ "pixel-per-centimeter",
+ "pixel-per-inch",
"astronomical-unit",
"centimeter",
"decimeter",
@@ -518,14 +518,14 @@ static const char * const gSubTypes[] = {
"nautical-mile",
"parsec",
"picometer",
- "point",
- "solar-radius",
+ "point",
+ "solar-radius",
"yard",
"lux",
- "solar-luminosity",
+ "solar-luminosity",
"carat",
- "dalton",
- "earth-mass",
+ "dalton",
+ "earth-mass",
"gram",
"kilogram",
"metric-ton",
@@ -534,28 +534,28 @@ static const char * const gSubTypes[] = {
"ounce",
"ounce-troy",
"pound",
- "solar-mass",
+ "solar-mass",
"stone",
"ton",
- "", // TODO(ICU-21076): manual edit of what should have been generated by Java.
- "percent", // TODO(ICU-21076): regenerate, deal with duplication.
- "permille", // TODO(ICU-21076): regenerate, deal with duplication.
+ "", // TODO(ICU-21076): manual edit of what should have been generated by Java.
+ "percent", // TODO(ICU-21076): regenerate, deal with duplication.
+ "permille", // TODO(ICU-21076): regenerate, deal with duplication.
"gigawatt",
"horsepower",
"kilowatt",
"megawatt",
"milliwatt",
"watt",
- "atmosphere",
- "bar",
+ "atmosphere",
+ "bar",
"hectopascal",
- "inch-ofhg",
- "kilopascal",
- "megapascal",
+ "inch-ofhg",
+ "kilopascal",
+ "megapascal",
"millibar",
- "millimeter-ofhg",
- "pascal",
- "pound-force-per-square-inch",
+ "millimeter-ofhg",
+ "pascal",
+ "pound-force-per-square-inch",
"kilometer-per-hour",
"knot",
"meter-per-second",
@@ -564,10 +564,10 @@ static const char * const gSubTypes[] = {
"fahrenheit",
"generic",
"kelvin",
- "newton-meter",
- "pound-force-foot",
+ "newton-meter",
+ "pound-force-foot",
"acre-foot",
- "barrel",
+ "barrel",
"bushel",
"centiliter",
"cubic-centimeter",
@@ -581,7 +581,7 @@ static const char * const gSubTypes[] = {
"cup-metric",
"deciliter",
"fluid-ounce",
- "fluid-ounce-imperial",
+ "fluid-ounce-imperial",
"gallon",
"gallon-imperial",
"hectoliter",
@@ -597,1405 +597,1405 @@ static const char * const gSubTypes[] = {
// Must be sorted by first value and then second value.
static int32_t unitPerUnitToSingleUnit[][4] = {
- {378, 382, 12, 5},
- {378, 387, 12, 6},
- {388, 343, 19, 0},
- {390, 350, 19, 2},
- {392, 343, 19, 3},
- {392, 463, 4, 2},
- {392, 464, 4, 3},
- {411, 460, 3, 1},
- {414, 12, 18, 9},
- {466, 388, 4, 1}
+ {378, 382, 12, 5},
+ {378, 387, 12, 6},
+ {388, 343, 19, 0},
+ {390, 350, 19, 2},
+ {392, 343, 19, 3},
+ {392, 463, 4, 2},
+ {392, 464, 4, 3},
+ {411, 460, 3, 1},
+ {414, 12, 18, 9},
+ {466, 388, 4, 1}
};
-// Shortcuts to the base unit in order to make the default constructor fast
-static const int32_t kBaseTypeIdx = 16;
-static const int32_t kBaseSubTypeIdx = 0;
-
+// Shortcuts to the base unit in order to make the default constructor fast
+static const int32_t kBaseTypeIdx = 16;
+static const int32_t kBaseSubTypeIdx = 0;
+
MeasureUnit *MeasureUnit::createGForce(UErrorCode &status) {
return MeasureUnit::create(0, 0, status);
}
-MeasureUnit MeasureUnit::getGForce() {
- return MeasureUnit(0, 0);
-}
-
+MeasureUnit MeasureUnit::getGForce() {
+ return MeasureUnit(0, 0);
+}
+
MeasureUnit *MeasureUnit::createMeterPerSecondSquared(UErrorCode &status) {
return MeasureUnit::create(0, 1, status);
}
-MeasureUnit MeasureUnit::getMeterPerSecondSquared() {
- return MeasureUnit(0, 1);
-}
-
+MeasureUnit MeasureUnit::getMeterPerSecondSquared() {
+ return MeasureUnit(0, 1);
+}
+
MeasureUnit *MeasureUnit::createArcMinute(UErrorCode &status) {
return MeasureUnit::create(1, 0, status);
}
-MeasureUnit MeasureUnit::getArcMinute() {
- return MeasureUnit(1, 0);
-}
-
+MeasureUnit MeasureUnit::getArcMinute() {
+ return MeasureUnit(1, 0);
+}
+
MeasureUnit *MeasureUnit::createArcSecond(UErrorCode &status) {
return MeasureUnit::create(1, 1, status);
}
-MeasureUnit MeasureUnit::getArcSecond() {
- return MeasureUnit(1, 1);
-}
-
+MeasureUnit MeasureUnit::getArcSecond() {
+ return MeasureUnit(1, 1);
+}
+
MeasureUnit *MeasureUnit::createDegree(UErrorCode &status) {
return MeasureUnit::create(1, 2, status);
}
-MeasureUnit MeasureUnit::getDegree() {
- return MeasureUnit(1, 2);
-}
-
+MeasureUnit MeasureUnit::getDegree() {
+ return MeasureUnit(1, 2);
+}
+
MeasureUnit *MeasureUnit::createRadian(UErrorCode &status) {
return MeasureUnit::create(1, 3, status);
}
-MeasureUnit MeasureUnit::getRadian() {
- return MeasureUnit(1, 3);
-}
-
+MeasureUnit MeasureUnit::getRadian() {
+ return MeasureUnit(1, 3);
+}
+
MeasureUnit *MeasureUnit::createRevolutionAngle(UErrorCode &status) {
return MeasureUnit::create(1, 4, status);
}
-MeasureUnit MeasureUnit::getRevolutionAngle() {
- return MeasureUnit(1, 4);
-}
-
+MeasureUnit MeasureUnit::getRevolutionAngle() {
+ return MeasureUnit(1, 4);
+}
+
MeasureUnit *MeasureUnit::createAcre(UErrorCode &status) {
return MeasureUnit::create(2, 0, status);
}
-MeasureUnit MeasureUnit::getAcre() {
- return MeasureUnit(2, 0);
-}
-
-MeasureUnit *MeasureUnit::createDunam(UErrorCode &status) {
+MeasureUnit MeasureUnit::getAcre() {
+ return MeasureUnit(2, 0);
+}
+
+MeasureUnit *MeasureUnit::createDunam(UErrorCode &status) {
return MeasureUnit::create(2, 1, status);
}
-MeasureUnit MeasureUnit::getDunam() {
- return MeasureUnit(2, 1);
-}
-
-MeasureUnit *MeasureUnit::createHectare(UErrorCode &status) {
+MeasureUnit MeasureUnit::getDunam() {
+ return MeasureUnit(2, 1);
+}
+
+MeasureUnit *MeasureUnit::createHectare(UErrorCode &status) {
return MeasureUnit::create(2, 2, status);
}
-MeasureUnit MeasureUnit::getHectare() {
- return MeasureUnit(2, 2);
-}
-
-MeasureUnit *MeasureUnit::createSquareCentimeter(UErrorCode &status) {
+MeasureUnit MeasureUnit::getHectare() {
+ return MeasureUnit(2, 2);
+}
+
+MeasureUnit *MeasureUnit::createSquareCentimeter(UErrorCode &status) {
return MeasureUnit::create(2, 3, status);
}
-MeasureUnit MeasureUnit::getSquareCentimeter() {
- return MeasureUnit(2, 3);
-}
-
-MeasureUnit *MeasureUnit::createSquareFoot(UErrorCode &status) {
+MeasureUnit MeasureUnit::getSquareCentimeter() {
+ return MeasureUnit(2, 3);
+}
+
+MeasureUnit *MeasureUnit::createSquareFoot(UErrorCode &status) {
return MeasureUnit::create(2, 4, status);
}
-MeasureUnit MeasureUnit::getSquareFoot() {
- return MeasureUnit(2, 4);
-}
-
-MeasureUnit *MeasureUnit::createSquareInch(UErrorCode &status) {
+MeasureUnit MeasureUnit::getSquareFoot() {
+ return MeasureUnit(2, 4);
+}
+
+MeasureUnit *MeasureUnit::createSquareInch(UErrorCode &status) {
return MeasureUnit::create(2, 5, status);
}
-MeasureUnit MeasureUnit::getSquareInch() {
- return MeasureUnit(2, 5);
-}
-
-MeasureUnit *MeasureUnit::createSquareKilometer(UErrorCode &status) {
+MeasureUnit MeasureUnit::getSquareInch() {
+ return MeasureUnit(2, 5);
+}
+
+MeasureUnit *MeasureUnit::createSquareKilometer(UErrorCode &status) {
return MeasureUnit::create(2, 6, status);
}
-MeasureUnit MeasureUnit::getSquareKilometer() {
- return MeasureUnit(2, 6);
-}
-
-MeasureUnit *MeasureUnit::createSquareMeter(UErrorCode &status) {
+MeasureUnit MeasureUnit::getSquareKilometer() {
+ return MeasureUnit(2, 6);
+}
+
+MeasureUnit *MeasureUnit::createSquareMeter(UErrorCode &status) {
return MeasureUnit::create(2, 7, status);
}
-MeasureUnit MeasureUnit::getSquareMeter() {
- return MeasureUnit(2, 7);
-}
-
-MeasureUnit *MeasureUnit::createSquareMile(UErrorCode &status) {
+MeasureUnit MeasureUnit::getSquareMeter() {
+ return MeasureUnit(2, 7);
+}
+
+MeasureUnit *MeasureUnit::createSquareMile(UErrorCode &status) {
return MeasureUnit::create(2, 8, status);
}
-MeasureUnit MeasureUnit::getSquareMile() {
- return MeasureUnit(2, 8);
-}
-
-MeasureUnit *MeasureUnit::createSquareYard(UErrorCode &status) {
- return MeasureUnit::create(2, 9, status);
-}
-
-MeasureUnit MeasureUnit::getSquareYard() {
- return MeasureUnit(2, 9);
-}
-
+MeasureUnit MeasureUnit::getSquareMile() {
+ return MeasureUnit(2, 8);
+}
+
+MeasureUnit *MeasureUnit::createSquareYard(UErrorCode &status) {
+ return MeasureUnit::create(2, 9, status);
+}
+
+MeasureUnit MeasureUnit::getSquareYard() {
+ return MeasureUnit(2, 9);
+}
+
MeasureUnit *MeasureUnit::createKarat(UErrorCode &status) {
return MeasureUnit::create(3, 0, status);
}
-MeasureUnit MeasureUnit::getKarat() {
- return MeasureUnit(3, 0);
-}
-
+MeasureUnit MeasureUnit::getKarat() {
+ return MeasureUnit(3, 0);
+}
+
MeasureUnit *MeasureUnit::createMilligramPerDeciliter(UErrorCode &status) {
return MeasureUnit::create(3, 1, status);
}
-MeasureUnit MeasureUnit::getMilligramPerDeciliter() {
- return MeasureUnit(3, 1);
-}
-
+MeasureUnit MeasureUnit::getMilligramPerDeciliter() {
+ return MeasureUnit(3, 1);
+}
+
MeasureUnit *MeasureUnit::createMillimolePerLiter(UErrorCode &status) {
return MeasureUnit::create(3, 2, status);
}
-MeasureUnit MeasureUnit::getMillimolePerLiter() {
- return MeasureUnit(3, 2);
-}
-
-MeasureUnit *MeasureUnit::createMole(UErrorCode &status) {
+MeasureUnit MeasureUnit::getMillimolePerLiter() {
+ return MeasureUnit(3, 2);
+}
+
+MeasureUnit *MeasureUnit::createMole(UErrorCode &status) {
return MeasureUnit::create(3, 3, status);
}
-MeasureUnit MeasureUnit::getMole() {
- return MeasureUnit(3, 3);
-}
-
-MeasureUnit *MeasureUnit::createPartPerMillion(UErrorCode &status) {
- return MeasureUnit::create(3, 6, status);
-}
-
-MeasureUnit MeasureUnit::getPartPerMillion() {
- return MeasureUnit(3, 6);
-}
-
-MeasureUnit *MeasureUnit::createPercent(UErrorCode &status) {
- return MeasureUnit::create(3, 4, status);
-}
-
-MeasureUnit MeasureUnit::getPercent() {
- return MeasureUnit(3, 4);
-}
-
-MeasureUnit *MeasureUnit::createPermille(UErrorCode &status) {
- return MeasureUnit::create(3, 5, status);
-}
-
-MeasureUnit MeasureUnit::getPermille() {
- return MeasureUnit(3, 5);
-}
-
-MeasureUnit *MeasureUnit::createPermyriad(UErrorCode &status) {
- return MeasureUnit::create(3, 7, status);
-}
-
-MeasureUnit MeasureUnit::getPermyriad() {
- return MeasureUnit(3, 7);
-}
-
+MeasureUnit MeasureUnit::getMole() {
+ return MeasureUnit(3, 3);
+}
+
+MeasureUnit *MeasureUnit::createPartPerMillion(UErrorCode &status) {
+ return MeasureUnit::create(3, 6, status);
+}
+
+MeasureUnit MeasureUnit::getPartPerMillion() {
+ return MeasureUnit(3, 6);
+}
+
+MeasureUnit *MeasureUnit::createPercent(UErrorCode &status) {
+ return MeasureUnit::create(3, 4, status);
+}
+
+MeasureUnit MeasureUnit::getPercent() {
+ return MeasureUnit(3, 4);
+}
+
+MeasureUnit *MeasureUnit::createPermille(UErrorCode &status) {
+ return MeasureUnit::create(3, 5, status);
+}
+
+MeasureUnit MeasureUnit::getPermille() {
+ return MeasureUnit(3, 5);
+}
+
+MeasureUnit *MeasureUnit::createPermyriad(UErrorCode &status) {
+ return MeasureUnit::create(3, 7, status);
+}
+
+MeasureUnit MeasureUnit::getPermyriad() {
+ return MeasureUnit(3, 7);
+}
+
MeasureUnit *MeasureUnit::createLiterPer100Kilometers(UErrorCode &status) {
return MeasureUnit::create(4, 0, status);
}
-MeasureUnit MeasureUnit::getLiterPer100Kilometers() {
- return MeasureUnit(4, 0);
-}
-
+MeasureUnit MeasureUnit::getLiterPer100Kilometers() {
+ return MeasureUnit(4, 0);
+}
+
MeasureUnit *MeasureUnit::createLiterPerKilometer(UErrorCode &status) {
return MeasureUnit::create(4, 1, status);
}
-MeasureUnit MeasureUnit::getLiterPerKilometer() {
- return MeasureUnit(4, 1);
-}
-
+MeasureUnit MeasureUnit::getLiterPerKilometer() {
+ return MeasureUnit(4, 1);
+}
+
MeasureUnit *MeasureUnit::createMilePerGallon(UErrorCode &status) {
return MeasureUnit::create(4, 2, status);
}
-MeasureUnit MeasureUnit::getMilePerGallon() {
- return MeasureUnit(4, 2);
-}
-
+MeasureUnit MeasureUnit::getMilePerGallon() {
+ return MeasureUnit(4, 2);
+}
+
MeasureUnit *MeasureUnit::createMilePerGallonImperial(UErrorCode &status) {
return MeasureUnit::create(4, 3, status);
}
-MeasureUnit MeasureUnit::getMilePerGallonImperial() {
- return MeasureUnit(4, 3);
+MeasureUnit MeasureUnit::getMilePerGallonImperial() {
+ return MeasureUnit(4, 3);
}
-MeasureUnit *MeasureUnit::createBit(UErrorCode &status) {
- return MeasureUnit::create(6, 0, status);
+MeasureUnit *MeasureUnit::createBit(UErrorCode &status) {
+ return MeasureUnit::create(6, 0, status);
}
-MeasureUnit MeasureUnit::getBit() {
- return MeasureUnit(6, 0);
+MeasureUnit MeasureUnit::getBit() {
+ return MeasureUnit(6, 0);
}
-MeasureUnit *MeasureUnit::createByte(UErrorCode &status) {
- return MeasureUnit::create(6, 1, status);
+MeasureUnit *MeasureUnit::createByte(UErrorCode &status) {
+ return MeasureUnit::create(6, 1, status);
}
-MeasureUnit MeasureUnit::getByte() {
- return MeasureUnit(6, 1);
+MeasureUnit MeasureUnit::getByte() {
+ return MeasureUnit(6, 1);
}
-MeasureUnit *MeasureUnit::createGigabit(UErrorCode &status) {
- return MeasureUnit::create(6, 2, status);
+MeasureUnit *MeasureUnit::createGigabit(UErrorCode &status) {
+ return MeasureUnit::create(6, 2, status);
}
-MeasureUnit MeasureUnit::getGigabit() {
- return MeasureUnit(6, 2);
+MeasureUnit MeasureUnit::getGigabit() {
+ return MeasureUnit(6, 2);
}
MeasureUnit *MeasureUnit::createGigabyte(UErrorCode &status) {
- return MeasureUnit::create(6, 3, status);
+ return MeasureUnit::create(6, 3, status);
+}
+
+MeasureUnit MeasureUnit::getGigabyte() {
+ return MeasureUnit(6, 3);
}
-MeasureUnit MeasureUnit::getGigabyte() {
- return MeasureUnit(6, 3);
-}
-
MeasureUnit *MeasureUnit::createKilobit(UErrorCode &status) {
- return MeasureUnit::create(6, 4, status);
+ return MeasureUnit::create(6, 4, status);
+}
+
+MeasureUnit MeasureUnit::getKilobit() {
+ return MeasureUnit(6, 4);
}
-MeasureUnit MeasureUnit::getKilobit() {
- return MeasureUnit(6, 4);
-}
-
MeasureUnit *MeasureUnit::createKilobyte(UErrorCode &status) {
- return MeasureUnit::create(6, 5, status);
+ return MeasureUnit::create(6, 5, status);
+}
+
+MeasureUnit MeasureUnit::getKilobyte() {
+ return MeasureUnit(6, 5);
}
-MeasureUnit MeasureUnit::getKilobyte() {
- return MeasureUnit(6, 5);
-}
-
MeasureUnit *MeasureUnit::createMegabit(UErrorCode &status) {
- return MeasureUnit::create(6, 6, status);
+ return MeasureUnit::create(6, 6, status);
+}
+
+MeasureUnit MeasureUnit::getMegabit() {
+ return MeasureUnit(6, 6);
}
-MeasureUnit MeasureUnit::getMegabit() {
- return MeasureUnit(6, 6);
-}
-
MeasureUnit *MeasureUnit::createMegabyte(UErrorCode &status) {
- return MeasureUnit::create(6, 7, status);
-}
-
-MeasureUnit MeasureUnit::getMegabyte() {
- return MeasureUnit(6, 7);
-}
-
-MeasureUnit *MeasureUnit::createPetabyte(UErrorCode &status) {
- return MeasureUnit::create(6, 8, status);
-}
-
-MeasureUnit MeasureUnit::getPetabyte() {
- return MeasureUnit(6, 8);
-}
-
+ return MeasureUnit::create(6, 7, status);
+}
+
+MeasureUnit MeasureUnit::getMegabyte() {
+ return MeasureUnit(6, 7);
+}
+
+MeasureUnit *MeasureUnit::createPetabyte(UErrorCode &status) {
+ return MeasureUnit::create(6, 8, status);
+}
+
+MeasureUnit MeasureUnit::getPetabyte() {
+ return MeasureUnit(6, 8);
+}
+
MeasureUnit *MeasureUnit::createTerabit(UErrorCode &status) {
- return MeasureUnit::create(6, 9, status);
+ return MeasureUnit::create(6, 9, status);
+}
+
+MeasureUnit MeasureUnit::getTerabit() {
+ return MeasureUnit(6, 9);
}
-MeasureUnit MeasureUnit::getTerabit() {
- return MeasureUnit(6, 9);
-}
-
MeasureUnit *MeasureUnit::createTerabyte(UErrorCode &status) {
- return MeasureUnit::create(6, 10, status);
+ return MeasureUnit::create(6, 10, status);
+}
+
+MeasureUnit MeasureUnit::getTerabyte() {
+ return MeasureUnit(6, 10);
}
-MeasureUnit MeasureUnit::getTerabyte() {
- return MeasureUnit(6, 10);
-}
-
MeasureUnit *MeasureUnit::createCentury(UErrorCode &status) {
- return MeasureUnit::create(7, 0, status);
+ return MeasureUnit::create(7, 0, status);
+}
+
+MeasureUnit MeasureUnit::getCentury() {
+ return MeasureUnit(7, 0);
}
-MeasureUnit MeasureUnit::getCentury() {
- return MeasureUnit(7, 0);
-}
-
MeasureUnit *MeasureUnit::createDay(UErrorCode &status) {
- return MeasureUnit::create(7, 1, status);
-}
-
-MeasureUnit MeasureUnit::getDay() {
- return MeasureUnit(7, 1);
-}
-
-MeasureUnit *MeasureUnit::createDayPerson(UErrorCode &status) {
- return MeasureUnit::create(7, 2, status);
-}
-
-MeasureUnit MeasureUnit::getDayPerson() {
- return MeasureUnit(7, 2);
-}
-
-MeasureUnit *MeasureUnit::createDecade(UErrorCode &status) {
- return MeasureUnit::create(7, 3, status);
-}
-
-MeasureUnit MeasureUnit::getDecade() {
- return MeasureUnit(7, 3);
-}
-
+ return MeasureUnit::create(7, 1, status);
+}
+
+MeasureUnit MeasureUnit::getDay() {
+ return MeasureUnit(7, 1);
+}
+
+MeasureUnit *MeasureUnit::createDayPerson(UErrorCode &status) {
+ return MeasureUnit::create(7, 2, status);
+}
+
+MeasureUnit MeasureUnit::getDayPerson() {
+ return MeasureUnit(7, 2);
+}
+
+MeasureUnit *MeasureUnit::createDecade(UErrorCode &status) {
+ return MeasureUnit::create(7, 3, status);
+}
+
+MeasureUnit MeasureUnit::getDecade() {
+ return MeasureUnit(7, 3);
+}
+
MeasureUnit *MeasureUnit::createHour(UErrorCode &status) {
- return MeasureUnit::create(7, 4, status);
+ return MeasureUnit::create(7, 4, status);
+}
+
+MeasureUnit MeasureUnit::getHour() {
+ return MeasureUnit(7, 4);
}
-MeasureUnit MeasureUnit::getHour() {
- return MeasureUnit(7, 4);
-}
-
MeasureUnit *MeasureUnit::createMicrosecond(UErrorCode &status) {
- return MeasureUnit::create(7, 5, status);
+ return MeasureUnit::create(7, 5, status);
+}
+
+MeasureUnit MeasureUnit::getMicrosecond() {
+ return MeasureUnit(7, 5);
}
-MeasureUnit MeasureUnit::getMicrosecond() {
- return MeasureUnit(7, 5);
-}
-
MeasureUnit *MeasureUnit::createMillisecond(UErrorCode &status) {
- return MeasureUnit::create(7, 6, status);
+ return MeasureUnit::create(7, 6, status);
+}
+
+MeasureUnit MeasureUnit::getMillisecond() {
+ return MeasureUnit(7, 6);
}
-MeasureUnit MeasureUnit::getMillisecond() {
- return MeasureUnit(7, 6);
-}
-
MeasureUnit *MeasureUnit::createMinute(UErrorCode &status) {
- return MeasureUnit::create(7, 7, status);
+ return MeasureUnit::create(7, 7, status);
+}
+
+MeasureUnit MeasureUnit::getMinute() {
+ return MeasureUnit(7, 7);
}
-MeasureUnit MeasureUnit::getMinute() {
- return MeasureUnit(7, 7);
-}
-
MeasureUnit *MeasureUnit::createMonth(UErrorCode &status) {
- return MeasureUnit::create(7, 8, status);
-}
-
-MeasureUnit MeasureUnit::getMonth() {
- return MeasureUnit(7, 8);
-}
-
-MeasureUnit *MeasureUnit::createMonthPerson(UErrorCode &status) {
- return MeasureUnit::create(7, 9, status);
-}
-
-MeasureUnit MeasureUnit::getMonthPerson() {
- return MeasureUnit(7, 9);
-}
-
+ return MeasureUnit::create(7, 8, status);
+}
+
+MeasureUnit MeasureUnit::getMonth() {
+ return MeasureUnit(7, 8);
+}
+
+MeasureUnit *MeasureUnit::createMonthPerson(UErrorCode &status) {
+ return MeasureUnit::create(7, 9, status);
+}
+
+MeasureUnit MeasureUnit::getMonthPerson() {
+ return MeasureUnit(7, 9);
+}
+
MeasureUnit *MeasureUnit::createNanosecond(UErrorCode &status) {
- return MeasureUnit::create(7, 10, status);
+ return MeasureUnit::create(7, 10, status);
+}
+
+MeasureUnit MeasureUnit::getNanosecond() {
+ return MeasureUnit(7, 10);
}
-MeasureUnit MeasureUnit::getNanosecond() {
- return MeasureUnit(7, 10);
-}
-
MeasureUnit *MeasureUnit::createSecond(UErrorCode &status) {
- return MeasureUnit::create(7, 11, status);
+ return MeasureUnit::create(7, 11, status);
+}
+
+MeasureUnit MeasureUnit::getSecond() {
+ return MeasureUnit(7, 11);
}
-MeasureUnit MeasureUnit::getSecond() {
- return MeasureUnit(7, 11);
-}
-
MeasureUnit *MeasureUnit::createWeek(UErrorCode &status) {
- return MeasureUnit::create(7, 12, status);
-}
-
-MeasureUnit MeasureUnit::getWeek() {
- return MeasureUnit(7, 12);
-}
-
-MeasureUnit *MeasureUnit::createWeekPerson(UErrorCode &status) {
- return MeasureUnit::create(7, 13, status);
-}
-
-MeasureUnit MeasureUnit::getWeekPerson() {
- return MeasureUnit(7, 13);
-}
-
+ return MeasureUnit::create(7, 12, status);
+}
+
+MeasureUnit MeasureUnit::getWeek() {
+ return MeasureUnit(7, 12);
+}
+
+MeasureUnit *MeasureUnit::createWeekPerson(UErrorCode &status) {
+ return MeasureUnit::create(7, 13, status);
+}
+
+MeasureUnit MeasureUnit::getWeekPerson() {
+ return MeasureUnit(7, 13);
+}
+
MeasureUnit *MeasureUnit::createYear(UErrorCode &status) {
- return MeasureUnit::create(7, 14, status);
-}
-
-MeasureUnit MeasureUnit::getYear() {
- return MeasureUnit(7, 14);
-}
-
-MeasureUnit *MeasureUnit::createYearPerson(UErrorCode &status) {
- return MeasureUnit::create(7, 15, status);
-}
-
-MeasureUnit MeasureUnit::getYearPerson() {
- return MeasureUnit(7, 15);
-}
-
+ return MeasureUnit::create(7, 14, status);
+}
+
+MeasureUnit MeasureUnit::getYear() {
+ return MeasureUnit(7, 14);
+}
+
+MeasureUnit *MeasureUnit::createYearPerson(UErrorCode &status) {
+ return MeasureUnit::create(7, 15, status);
+}
+
+MeasureUnit MeasureUnit::getYearPerson() {
+ return MeasureUnit(7, 15);
+}
+
MeasureUnit *MeasureUnit::createAmpere(UErrorCode &status) {
- return MeasureUnit::create(8, 0, status);
+ return MeasureUnit::create(8, 0, status);
+}
+
+MeasureUnit MeasureUnit::getAmpere() {
+ return MeasureUnit(8, 0);
}
-MeasureUnit MeasureUnit::getAmpere() {
- return MeasureUnit(8, 0);
-}
-
MeasureUnit *MeasureUnit::createMilliampere(UErrorCode &status) {
- return MeasureUnit::create(8, 1, status);
+ return MeasureUnit::create(8, 1, status);
+}
+
+MeasureUnit MeasureUnit::getMilliampere() {
+ return MeasureUnit(8, 1);
}
-MeasureUnit MeasureUnit::getMilliampere() {
- return MeasureUnit(8, 1);
-}
-
MeasureUnit *MeasureUnit::createOhm(UErrorCode &status) {
- return MeasureUnit::create(8, 2, status);
+ return MeasureUnit::create(8, 2, status);
+}
+
+MeasureUnit MeasureUnit::getOhm() {
+ return MeasureUnit(8, 2);
}
-MeasureUnit MeasureUnit::getOhm() {
- return MeasureUnit(8, 2);
-}
-
MeasureUnit *MeasureUnit::createVolt(UErrorCode &status) {
- return MeasureUnit::create(8, 3, status);
-}
-
-MeasureUnit MeasureUnit::getVolt() {
- return MeasureUnit(8, 3);
-}
-
-MeasureUnit *MeasureUnit::createBritishThermalUnit(UErrorCode &status) {
- return MeasureUnit::create(9, 0, status);
-}
-
-MeasureUnit MeasureUnit::getBritishThermalUnit() {
- return MeasureUnit(9, 0);
-}
-
+ return MeasureUnit::create(8, 3, status);
+}
+
+MeasureUnit MeasureUnit::getVolt() {
+ return MeasureUnit(8, 3);
+}
+
+MeasureUnit *MeasureUnit::createBritishThermalUnit(UErrorCode &status) {
+ return MeasureUnit::create(9, 0, status);
+}
+
+MeasureUnit MeasureUnit::getBritishThermalUnit() {
+ return MeasureUnit(9, 0);
+}
+
MeasureUnit *MeasureUnit::createCalorie(UErrorCode &status) {
- return MeasureUnit::create(9, 1, status);
-}
-
-MeasureUnit MeasureUnit::getCalorie() {
- return MeasureUnit(9, 1);
-}
-
-MeasureUnit *MeasureUnit::createElectronvolt(UErrorCode &status) {
- return MeasureUnit::create(9, 2, status);
-}
-
-MeasureUnit MeasureUnit::getElectronvolt() {
- return MeasureUnit(9, 2);
-}
-
+ return MeasureUnit::create(9, 1, status);
+}
+
+MeasureUnit MeasureUnit::getCalorie() {
+ return MeasureUnit(9, 1);
+}
+
+MeasureUnit *MeasureUnit::createElectronvolt(UErrorCode &status) {
+ return MeasureUnit::create(9, 2, status);
+}
+
+MeasureUnit MeasureUnit::getElectronvolt() {
+ return MeasureUnit(9, 2);
+}
+
MeasureUnit *MeasureUnit::createFoodcalorie(UErrorCode &status) {
- return MeasureUnit::create(9, 3, status);
+ return MeasureUnit::create(9, 3, status);
+}
+
+MeasureUnit MeasureUnit::getFoodcalorie() {
+ return MeasureUnit(9, 3);
}
-MeasureUnit MeasureUnit::getFoodcalorie() {
- return MeasureUnit(9, 3);
-}
-
MeasureUnit *MeasureUnit::createJoule(UErrorCode &status) {
- return MeasureUnit::create(9, 4, status);
+ return MeasureUnit::create(9, 4, status);
+}
+
+MeasureUnit MeasureUnit::getJoule() {
+ return MeasureUnit(9, 4);
}
-MeasureUnit MeasureUnit::getJoule() {
- return MeasureUnit(9, 4);
-}
-
MeasureUnit *MeasureUnit::createKilocalorie(UErrorCode &status) {
- return MeasureUnit::create(9, 5, status);
+ return MeasureUnit::create(9, 5, status);
+}
+
+MeasureUnit MeasureUnit::getKilocalorie() {
+ return MeasureUnit(9, 5);
}
-MeasureUnit MeasureUnit::getKilocalorie() {
- return MeasureUnit(9, 5);
-}
-
MeasureUnit *MeasureUnit::createKilojoule(UErrorCode &status) {
- return MeasureUnit::create(9, 6, status);
+ return MeasureUnit::create(9, 6, status);
+}
+
+MeasureUnit MeasureUnit::getKilojoule() {
+ return MeasureUnit(9, 6);
}
-MeasureUnit MeasureUnit::getKilojoule() {
- return MeasureUnit(9, 6);
-}
-
MeasureUnit *MeasureUnit::createKilowattHour(UErrorCode &status) {
- return MeasureUnit::create(9, 7, status);
-}
-
-MeasureUnit MeasureUnit::getKilowattHour() {
- return MeasureUnit(9, 7);
-}
-
-MeasureUnit *MeasureUnit::createThermUs(UErrorCode &status) {
- return MeasureUnit::create(9, 8, status);
-}
-
-MeasureUnit MeasureUnit::getThermUs() {
- return MeasureUnit(9, 8);
-}
-
-MeasureUnit *MeasureUnit::createNewton(UErrorCode &status) {
- return MeasureUnit::create(10, 0, status);
-}
-
-MeasureUnit MeasureUnit::getNewton() {
- return MeasureUnit(10, 0);
-}
-
-MeasureUnit *MeasureUnit::createPoundForce(UErrorCode &status) {
- return MeasureUnit::create(10, 1, status);
-}
-
-MeasureUnit MeasureUnit::getPoundForce() {
- return MeasureUnit(10, 1);
-}
-
+ return MeasureUnit::create(9, 7, status);
+}
+
+MeasureUnit MeasureUnit::getKilowattHour() {
+ return MeasureUnit(9, 7);
+}
+
+MeasureUnit *MeasureUnit::createThermUs(UErrorCode &status) {
+ return MeasureUnit::create(9, 8, status);
+}
+
+MeasureUnit MeasureUnit::getThermUs() {
+ return MeasureUnit(9, 8);
+}
+
+MeasureUnit *MeasureUnit::createNewton(UErrorCode &status) {
+ return MeasureUnit::create(10, 0, status);
+}
+
+MeasureUnit MeasureUnit::getNewton() {
+ return MeasureUnit(10, 0);
+}
+
+MeasureUnit *MeasureUnit::createPoundForce(UErrorCode &status) {
+ return MeasureUnit::create(10, 1, status);
+}
+
+MeasureUnit MeasureUnit::getPoundForce() {
+ return MeasureUnit(10, 1);
+}
+
MeasureUnit *MeasureUnit::createGigahertz(UErrorCode &status) {
return MeasureUnit::create(11, 0, status);
}
-MeasureUnit MeasureUnit::getGigahertz() {
- return MeasureUnit(11, 0);
-}
-
+MeasureUnit MeasureUnit::getGigahertz() {
+ return MeasureUnit(11, 0);
+}
+
MeasureUnit *MeasureUnit::createHertz(UErrorCode &status) {
return MeasureUnit::create(11, 1, status);
}
-MeasureUnit MeasureUnit::getHertz() {
- return MeasureUnit(11, 1);
-}
-
+MeasureUnit MeasureUnit::getHertz() {
+ return MeasureUnit(11, 1);
+}
+
MeasureUnit *MeasureUnit::createKilohertz(UErrorCode &status) {
return MeasureUnit::create(11, 2, status);
}
-MeasureUnit MeasureUnit::getKilohertz() {
- return MeasureUnit(11, 2);
-}
-
+MeasureUnit MeasureUnit::getKilohertz() {
+ return MeasureUnit(11, 2);
+}
+
MeasureUnit *MeasureUnit::createMegahertz(UErrorCode &status) {
return MeasureUnit::create(11, 3, status);
}
-MeasureUnit MeasureUnit::getMegahertz() {
- return MeasureUnit(11, 3);
-}
-
-MeasureUnit *MeasureUnit::createDotPerCentimeter(UErrorCode &status) {
+MeasureUnit MeasureUnit::getMegahertz() {
+ return MeasureUnit(11, 3);
+}
+
+MeasureUnit *MeasureUnit::createDotPerCentimeter(UErrorCode &status) {
return MeasureUnit::create(12, 0, status);
}
-MeasureUnit MeasureUnit::getDotPerCentimeter() {
- return MeasureUnit(12, 0);
-}
-
-MeasureUnit *MeasureUnit::createDotPerInch(UErrorCode &status) {
+MeasureUnit MeasureUnit::getDotPerCentimeter() {
+ return MeasureUnit(12, 0);
+}
+
+MeasureUnit *MeasureUnit::createDotPerInch(UErrorCode &status) {
return MeasureUnit::create(12, 1, status);
}
-MeasureUnit MeasureUnit::getDotPerInch() {
- return MeasureUnit(12, 1);
-}
-
-MeasureUnit *MeasureUnit::createEm(UErrorCode &status) {
+MeasureUnit MeasureUnit::getDotPerInch() {
+ return MeasureUnit(12, 1);
+}
+
+MeasureUnit *MeasureUnit::createEm(UErrorCode &status) {
return MeasureUnit::create(12, 2, status);
}
-MeasureUnit MeasureUnit::getEm() {
- return MeasureUnit(12, 2);
-}
-
-MeasureUnit *MeasureUnit::createMegapixel(UErrorCode &status) {
+MeasureUnit MeasureUnit::getEm() {
+ return MeasureUnit(12, 2);
+}
+
+MeasureUnit *MeasureUnit::createMegapixel(UErrorCode &status) {
return MeasureUnit::create(12, 3, status);
}
-MeasureUnit MeasureUnit::getMegapixel() {
- return MeasureUnit(12, 3);
-}
-
-MeasureUnit *MeasureUnit::createPixel(UErrorCode &status) {
+MeasureUnit MeasureUnit::getMegapixel() {
+ return MeasureUnit(12, 3);
+}
+
+MeasureUnit *MeasureUnit::createPixel(UErrorCode &status) {
return MeasureUnit::create(12, 4, status);
}
-MeasureUnit MeasureUnit::getPixel() {
- return MeasureUnit(12, 4);
-}
-
-MeasureUnit *MeasureUnit::createPixelPerCentimeter(UErrorCode &status) {
+MeasureUnit MeasureUnit::getPixel() {
+ return MeasureUnit(12, 4);
+}
+
+MeasureUnit *MeasureUnit::createPixelPerCentimeter(UErrorCode &status) {
return MeasureUnit::create(12, 5, status);
}
-MeasureUnit MeasureUnit::getPixelPerCentimeter() {
- return MeasureUnit(12, 5);
-}
-
-MeasureUnit *MeasureUnit::createPixelPerInch(UErrorCode &status) {
+MeasureUnit MeasureUnit::getPixelPerCentimeter() {
+ return MeasureUnit(12, 5);
+}
+
+MeasureUnit *MeasureUnit::createPixelPerInch(UErrorCode &status) {
return MeasureUnit::create(12, 6, status);
}
-MeasureUnit MeasureUnit::getPixelPerInch() {
- return MeasureUnit(12, 6);
-}
-
-MeasureUnit *MeasureUnit::createAstronomicalUnit(UErrorCode &status) {
- return MeasureUnit::create(13, 0, status);
-}
-
-MeasureUnit MeasureUnit::getAstronomicalUnit() {
- return MeasureUnit(13, 0);
-}
-
-MeasureUnit *MeasureUnit::createCentimeter(UErrorCode &status) {
- return MeasureUnit::create(13, 1, status);
-}
-
-MeasureUnit MeasureUnit::getCentimeter() {
- return MeasureUnit(13, 1);
-}
-
-MeasureUnit *MeasureUnit::createDecimeter(UErrorCode &status) {
- return MeasureUnit::create(13, 2, status);
-}
-
-MeasureUnit MeasureUnit::getDecimeter() {
- return MeasureUnit(13, 2);
-}
-
-MeasureUnit *MeasureUnit::createFathom(UErrorCode &status) {
- return MeasureUnit::create(13, 3, status);
-}
-
-MeasureUnit MeasureUnit::getFathom() {
- return MeasureUnit(13, 3);
-}
-
-MeasureUnit *MeasureUnit::createFoot(UErrorCode &status) {
- return MeasureUnit::create(13, 4, status);
-}
-
-MeasureUnit MeasureUnit::getFoot() {
- return MeasureUnit(13, 4);
-}
-
-MeasureUnit *MeasureUnit::createFurlong(UErrorCode &status) {
- return MeasureUnit::create(13, 5, status);
-}
-
-MeasureUnit MeasureUnit::getFurlong() {
- return MeasureUnit(13, 5);
-}
-
-MeasureUnit *MeasureUnit::createInch(UErrorCode &status) {
- return MeasureUnit::create(13, 6, status);
-}
-
-MeasureUnit MeasureUnit::getInch() {
- return MeasureUnit(13, 6);
-}
-
+MeasureUnit MeasureUnit::getPixelPerInch() {
+ return MeasureUnit(12, 6);
+}
+
+MeasureUnit *MeasureUnit::createAstronomicalUnit(UErrorCode &status) {
+ return MeasureUnit::create(13, 0, status);
+}
+
+MeasureUnit MeasureUnit::getAstronomicalUnit() {
+ return MeasureUnit(13, 0);
+}
+
+MeasureUnit *MeasureUnit::createCentimeter(UErrorCode &status) {
+ return MeasureUnit::create(13, 1, status);
+}
+
+MeasureUnit MeasureUnit::getCentimeter() {
+ return MeasureUnit(13, 1);
+}
+
+MeasureUnit *MeasureUnit::createDecimeter(UErrorCode &status) {
+ return MeasureUnit::create(13, 2, status);
+}
+
+MeasureUnit MeasureUnit::getDecimeter() {
+ return MeasureUnit(13, 2);
+}
+
+MeasureUnit *MeasureUnit::createFathom(UErrorCode &status) {
+ return MeasureUnit::create(13, 3, status);
+}
+
+MeasureUnit MeasureUnit::getFathom() {
+ return MeasureUnit(13, 3);
+}
+
+MeasureUnit *MeasureUnit::createFoot(UErrorCode &status) {
+ return MeasureUnit::create(13, 4, status);
+}
+
+MeasureUnit MeasureUnit::getFoot() {
+ return MeasureUnit(13, 4);
+}
+
+MeasureUnit *MeasureUnit::createFurlong(UErrorCode &status) {
+ return MeasureUnit::create(13, 5, status);
+}
+
+MeasureUnit MeasureUnit::getFurlong() {
+ return MeasureUnit(13, 5);
+}
+
+MeasureUnit *MeasureUnit::createInch(UErrorCode &status) {
+ return MeasureUnit::create(13, 6, status);
+}
+
+MeasureUnit MeasureUnit::getInch() {
+ return MeasureUnit(13, 6);
+}
+
MeasureUnit *MeasureUnit::createKilometer(UErrorCode &status) {
- return MeasureUnit::create(13, 7, status);
+ return MeasureUnit::create(13, 7, status);
+}
+
+MeasureUnit MeasureUnit::getKilometer() {
+ return MeasureUnit(13, 7);
}
-MeasureUnit MeasureUnit::getKilometer() {
- return MeasureUnit(13, 7);
-}
-
MeasureUnit *MeasureUnit::createLightYear(UErrorCode &status) {
- return MeasureUnit::create(13, 8, status);
+ return MeasureUnit::create(13, 8, status);
+}
+
+MeasureUnit MeasureUnit::getLightYear() {
+ return MeasureUnit(13, 8);
}
-MeasureUnit MeasureUnit::getLightYear() {
- return MeasureUnit(13, 8);
-}
-
MeasureUnit *MeasureUnit::createMeter(UErrorCode &status) {
- return MeasureUnit::create(13, 9, status);
+ return MeasureUnit::create(13, 9, status);
+}
+
+MeasureUnit MeasureUnit::getMeter() {
+ return MeasureUnit(13, 9);
}
-MeasureUnit MeasureUnit::getMeter() {
- return MeasureUnit(13, 9);
-}
-
MeasureUnit *MeasureUnit::createMicrometer(UErrorCode &status) {
- return MeasureUnit::create(13, 10, status);
+ return MeasureUnit::create(13, 10, status);
+}
+
+MeasureUnit MeasureUnit::getMicrometer() {
+ return MeasureUnit(13, 10);
}
-MeasureUnit MeasureUnit::getMicrometer() {
- return MeasureUnit(13, 10);
-}
-
MeasureUnit *MeasureUnit::createMile(UErrorCode &status) {
- return MeasureUnit::create(13, 11, status);
+ return MeasureUnit::create(13, 11, status);
+}
+
+MeasureUnit MeasureUnit::getMile() {
+ return MeasureUnit(13, 11);
}
-MeasureUnit MeasureUnit::getMile() {
- return MeasureUnit(13, 11);
-}
-
MeasureUnit *MeasureUnit::createMileScandinavian(UErrorCode &status) {
- return MeasureUnit::create(13, 12, status);
+ return MeasureUnit::create(13, 12, status);
+}
+
+MeasureUnit MeasureUnit::getMileScandinavian() {
+ return MeasureUnit(13, 12);
}
-MeasureUnit MeasureUnit::getMileScandinavian() {
- return MeasureUnit(13, 12);
-}
-
MeasureUnit *MeasureUnit::createMillimeter(UErrorCode &status) {
- return MeasureUnit::create(13, 13, status);
+ return MeasureUnit::create(13, 13, status);
+}
+
+MeasureUnit MeasureUnit::getMillimeter() {
+ return MeasureUnit(13, 13);
}
-MeasureUnit MeasureUnit::getMillimeter() {
- return MeasureUnit(13, 13);
-}
-
MeasureUnit *MeasureUnit::createNanometer(UErrorCode &status) {
- return MeasureUnit::create(13, 14, status);
+ return MeasureUnit::create(13, 14, status);
+}
+
+MeasureUnit MeasureUnit::getNanometer() {
+ return MeasureUnit(13, 14);
}
-MeasureUnit MeasureUnit::getNanometer() {
- return MeasureUnit(13, 14);
-}
-
MeasureUnit *MeasureUnit::createNauticalMile(UErrorCode &status) {
- return MeasureUnit::create(13, 15, status);
+ return MeasureUnit::create(13, 15, status);
+}
+
+MeasureUnit MeasureUnit::getNauticalMile() {
+ return MeasureUnit(13, 15);
}
-MeasureUnit MeasureUnit::getNauticalMile() {
- return MeasureUnit(13, 15);
-}
-
MeasureUnit *MeasureUnit::createParsec(UErrorCode &status) {
- return MeasureUnit::create(13, 16, status);
+ return MeasureUnit::create(13, 16, status);
+}
+
+MeasureUnit MeasureUnit::getParsec() {
+ return MeasureUnit(13, 16);
}
-MeasureUnit MeasureUnit::getParsec() {
- return MeasureUnit(13, 16);
-}
-
MeasureUnit *MeasureUnit::createPicometer(UErrorCode &status) {
- return MeasureUnit::create(13, 17, status);
-}
-
-MeasureUnit MeasureUnit::getPicometer() {
- return MeasureUnit(13, 17);
-}
-
-MeasureUnit *MeasureUnit::createPoint(UErrorCode &status) {
- return MeasureUnit::create(13, 18, status);
-}
-
-MeasureUnit MeasureUnit::getPoint() {
- return MeasureUnit(13, 18);
-}
-
-MeasureUnit *MeasureUnit::createSolarRadius(UErrorCode &status) {
- return MeasureUnit::create(13, 19, status);
-}
-
-MeasureUnit MeasureUnit::getSolarRadius() {
- return MeasureUnit(13, 19);
-}
-
+ return MeasureUnit::create(13, 17, status);
+}
+
+MeasureUnit MeasureUnit::getPicometer() {
+ return MeasureUnit(13, 17);
+}
+
+MeasureUnit *MeasureUnit::createPoint(UErrorCode &status) {
+ return MeasureUnit::create(13, 18, status);
+}
+
+MeasureUnit MeasureUnit::getPoint() {
+ return MeasureUnit(13, 18);
+}
+
+MeasureUnit *MeasureUnit::createSolarRadius(UErrorCode &status) {
+ return MeasureUnit::create(13, 19, status);
+}
+
+MeasureUnit MeasureUnit::getSolarRadius() {
+ return MeasureUnit(13, 19);
+}
+
MeasureUnit *MeasureUnit::createYard(UErrorCode &status) {
- return MeasureUnit::create(13, 20, status);
+ return MeasureUnit::create(13, 20, status);
+}
+
+MeasureUnit MeasureUnit::getYard() {
+ return MeasureUnit(13, 20);
}
-MeasureUnit MeasureUnit::getYard() {
- return MeasureUnit(13, 20);
-}
-
MeasureUnit *MeasureUnit::createLux(UErrorCode &status) {
- return MeasureUnit::create(14, 0, status);
-}
-
-MeasureUnit MeasureUnit::getLux() {
- return MeasureUnit(14, 0);
-}
-
-MeasureUnit *MeasureUnit::createSolarLuminosity(UErrorCode &status) {
- return MeasureUnit::create(14, 1, status);
-}
-
-MeasureUnit MeasureUnit::getSolarLuminosity() {
- return MeasureUnit(14, 1);
-}
-
+ return MeasureUnit::create(14, 0, status);
+}
+
+MeasureUnit MeasureUnit::getLux() {
+ return MeasureUnit(14, 0);
+}
+
+MeasureUnit *MeasureUnit::createSolarLuminosity(UErrorCode &status) {
+ return MeasureUnit::create(14, 1, status);
+}
+
+MeasureUnit MeasureUnit::getSolarLuminosity() {
+ return MeasureUnit(14, 1);
+}
+
MeasureUnit *MeasureUnit::createCarat(UErrorCode &status) {
- return MeasureUnit::create(15, 0, status);
-}
-
-MeasureUnit MeasureUnit::getCarat() {
- return MeasureUnit(15, 0);
-}
-
-MeasureUnit *MeasureUnit::createDalton(UErrorCode &status) {
- return MeasureUnit::create(15, 1, status);
-}
-
-MeasureUnit MeasureUnit::getDalton() {
- return MeasureUnit(15, 1);
-}
-
-MeasureUnit *MeasureUnit::createEarthMass(UErrorCode &status) {
- return MeasureUnit::create(15, 2, status);
-}
-
-MeasureUnit MeasureUnit::getEarthMass() {
- return MeasureUnit(15, 2);
-}
-
+ return MeasureUnit::create(15, 0, status);
+}
+
+MeasureUnit MeasureUnit::getCarat() {
+ return MeasureUnit(15, 0);
+}
+
+MeasureUnit *MeasureUnit::createDalton(UErrorCode &status) {
+ return MeasureUnit::create(15, 1, status);
+}
+
+MeasureUnit MeasureUnit::getDalton() {
+ return MeasureUnit(15, 1);
+}
+
+MeasureUnit *MeasureUnit::createEarthMass(UErrorCode &status) {
+ return MeasureUnit::create(15, 2, status);
+}
+
+MeasureUnit MeasureUnit::getEarthMass() {
+ return MeasureUnit(15, 2);
+}
+
MeasureUnit *MeasureUnit::createGram(UErrorCode &status) {
- return MeasureUnit::create(15, 3, status);
+ return MeasureUnit::create(15, 3, status);
+}
+
+MeasureUnit MeasureUnit::getGram() {
+ return MeasureUnit(15, 3);
}
-MeasureUnit MeasureUnit::getGram() {
- return MeasureUnit(15, 3);
-}
-
MeasureUnit *MeasureUnit::createKilogram(UErrorCode &status) {
- return MeasureUnit::create(15, 4, status);
+ return MeasureUnit::create(15, 4, status);
+}
+
+MeasureUnit MeasureUnit::getKilogram() {
+ return MeasureUnit(15, 4);
}
-MeasureUnit MeasureUnit::getKilogram() {
- return MeasureUnit(15, 4);
-}
-
MeasureUnit *MeasureUnit::createMetricTon(UErrorCode &status) {
- return MeasureUnit::create(15, 5, status);
+ return MeasureUnit::create(15, 5, status);
+}
+
+MeasureUnit MeasureUnit::getMetricTon() {
+ return MeasureUnit(15, 5);
}
-MeasureUnit MeasureUnit::getMetricTon() {
- return MeasureUnit(15, 5);
-}
-
MeasureUnit *MeasureUnit::createMicrogram(UErrorCode &status) {
- return MeasureUnit::create(15, 6, status);
+ return MeasureUnit::create(15, 6, status);
+}
+
+MeasureUnit MeasureUnit::getMicrogram() {
+ return MeasureUnit(15, 6);
}
-MeasureUnit MeasureUnit::getMicrogram() {
- return MeasureUnit(15, 6);
-}
-
MeasureUnit *MeasureUnit::createMilligram(UErrorCode &status) {
- return MeasureUnit::create(15, 7, status);
+ return MeasureUnit::create(15, 7, status);
+}
+
+MeasureUnit MeasureUnit::getMilligram() {
+ return MeasureUnit(15, 7);
}
-MeasureUnit MeasureUnit::getMilligram() {
- return MeasureUnit(15, 7);
-}
-
MeasureUnit *MeasureUnit::createOunce(UErrorCode &status) {
- return MeasureUnit::create(15, 8, status);
+ return MeasureUnit::create(15, 8, status);
+}
+
+MeasureUnit MeasureUnit::getOunce() {
+ return MeasureUnit(15, 8);
}
-MeasureUnit MeasureUnit::getOunce() {
- return MeasureUnit(15, 8);
-}
-
MeasureUnit *MeasureUnit::createOunceTroy(UErrorCode &status) {
- return MeasureUnit::create(15, 9, status);
+ return MeasureUnit::create(15, 9, status);
+}
+
+MeasureUnit MeasureUnit::getOunceTroy() {
+ return MeasureUnit(15, 9);
}
-MeasureUnit MeasureUnit::getOunceTroy() {
- return MeasureUnit(15, 9);
-}
-
MeasureUnit *MeasureUnit::createPound(UErrorCode &status) {
- return MeasureUnit::create(15, 10, status);
-}
-
-MeasureUnit MeasureUnit::getPound() {
- return MeasureUnit(15, 10);
-}
-
-MeasureUnit *MeasureUnit::createSolarMass(UErrorCode &status) {
- return MeasureUnit::create(15, 11, status);
-}
-
-MeasureUnit MeasureUnit::getSolarMass() {
- return MeasureUnit(15, 11);
-}
-
+ return MeasureUnit::create(15, 10, status);
+}
+
+MeasureUnit MeasureUnit::getPound() {
+ return MeasureUnit(15, 10);
+}
+
+MeasureUnit *MeasureUnit::createSolarMass(UErrorCode &status) {
+ return MeasureUnit::create(15, 11, status);
+}
+
+MeasureUnit MeasureUnit::getSolarMass() {
+ return MeasureUnit(15, 11);
+}
+
MeasureUnit *MeasureUnit::createStone(UErrorCode &status) {
- return MeasureUnit::create(15, 12, status);
+ return MeasureUnit::create(15, 12, status);
+}
+
+MeasureUnit MeasureUnit::getStone() {
+ return MeasureUnit(15, 12);
}
-MeasureUnit MeasureUnit::getStone() {
- return MeasureUnit(15, 12);
-}
-
MeasureUnit *MeasureUnit::createTon(UErrorCode &status) {
- return MeasureUnit::create(15, 13, status);
+ return MeasureUnit::create(15, 13, status);
+}
+
+MeasureUnit MeasureUnit::getTon() {
+ return MeasureUnit(15, 13);
}
-MeasureUnit MeasureUnit::getTon() {
- return MeasureUnit(15, 13);
-}
-
MeasureUnit *MeasureUnit::createGigawatt(UErrorCode &status) {
- return MeasureUnit::create(17, 0, status);
+ return MeasureUnit::create(17, 0, status);
+}
+
+MeasureUnit MeasureUnit::getGigawatt() {
+ return MeasureUnit(17, 0);
}
-MeasureUnit MeasureUnit::getGigawatt() {
- return MeasureUnit(17, 0);
-}
-
MeasureUnit *MeasureUnit::createHorsepower(UErrorCode &status) {
- return MeasureUnit::create(17, 1, status);
+ return MeasureUnit::create(17, 1, status);
+}
+
+MeasureUnit MeasureUnit::getHorsepower() {
+ return MeasureUnit(17, 1);
}
-MeasureUnit MeasureUnit::getHorsepower() {
- return MeasureUnit(17, 1);
-}
-
MeasureUnit *MeasureUnit::createKilowatt(UErrorCode &status) {
- return MeasureUnit::create(17, 2, status);
+ return MeasureUnit::create(17, 2, status);
+}
+
+MeasureUnit MeasureUnit::getKilowatt() {
+ return MeasureUnit(17, 2);
}
-MeasureUnit MeasureUnit::getKilowatt() {
- return MeasureUnit(17, 2);
-}
-
MeasureUnit *MeasureUnit::createMegawatt(UErrorCode &status) {
- return MeasureUnit::create(17, 3, status);
+ return MeasureUnit::create(17, 3, status);
+}
+
+MeasureUnit MeasureUnit::getMegawatt() {
+ return MeasureUnit(17, 3);
}
-MeasureUnit MeasureUnit::getMegawatt() {
- return MeasureUnit(17, 3);
-}
-
MeasureUnit *MeasureUnit::createMilliwatt(UErrorCode &status) {
- return MeasureUnit::create(17, 4, status);
+ return MeasureUnit::create(17, 4, status);
+}
+
+MeasureUnit MeasureUnit::getMilliwatt() {
+ return MeasureUnit(17, 4);
}
-MeasureUnit MeasureUnit::getMilliwatt() {
- return MeasureUnit(17, 4);
-}
-
MeasureUnit *MeasureUnit::createWatt(UErrorCode &status) {
- return MeasureUnit::create(17, 5, status);
-}
-
-MeasureUnit MeasureUnit::getWatt() {
- return MeasureUnit(17, 5);
-}
-
-MeasureUnit *MeasureUnit::createAtmosphere(UErrorCode &status) {
- return MeasureUnit::create(18, 0, status);
-}
-
-MeasureUnit MeasureUnit::getAtmosphere() {
- return MeasureUnit(18, 0);
-}
-
-MeasureUnit *MeasureUnit::createBar(UErrorCode &status) {
- return MeasureUnit::create(18, 1, status);
-}
-
-MeasureUnit MeasureUnit::getBar() {
- return MeasureUnit(18, 1);
-}
-
+ return MeasureUnit::create(17, 5, status);
+}
+
+MeasureUnit MeasureUnit::getWatt() {
+ return MeasureUnit(17, 5);
+}
+
+MeasureUnit *MeasureUnit::createAtmosphere(UErrorCode &status) {
+ return MeasureUnit::create(18, 0, status);
+}
+
+MeasureUnit MeasureUnit::getAtmosphere() {
+ return MeasureUnit(18, 0);
+}
+
+MeasureUnit *MeasureUnit::createBar(UErrorCode &status) {
+ return MeasureUnit::create(18, 1, status);
+}
+
+MeasureUnit MeasureUnit::getBar() {
+ return MeasureUnit(18, 1);
+}
+
MeasureUnit *MeasureUnit::createHectopascal(UErrorCode &status) {
- return MeasureUnit::create(18, 2, status);
+ return MeasureUnit::create(18, 2, status);
+}
+
+MeasureUnit MeasureUnit::getHectopascal() {
+ return MeasureUnit(18, 2);
}
-MeasureUnit MeasureUnit::getHectopascal() {
- return MeasureUnit(18, 2);
-}
-
MeasureUnit *MeasureUnit::createInchHg(UErrorCode &status) {
- return MeasureUnit::create(18, 3, status);
-}
-
-MeasureUnit MeasureUnit::getInchHg() {
- return MeasureUnit(18, 3);
-}
-
-MeasureUnit *MeasureUnit::createKilopascal(UErrorCode &status) {
- return MeasureUnit::create(18, 4, status);
-}
-
-MeasureUnit MeasureUnit::getKilopascal() {
- return MeasureUnit(18, 4);
-}
-
-MeasureUnit *MeasureUnit::createMegapascal(UErrorCode &status) {
- return MeasureUnit::create(18, 5, status);
-}
-
-MeasureUnit MeasureUnit::getMegapascal() {
- return MeasureUnit(18, 5);
-}
-
+ return MeasureUnit::create(18, 3, status);
+}
+
+MeasureUnit MeasureUnit::getInchHg() {
+ return MeasureUnit(18, 3);
+}
+
+MeasureUnit *MeasureUnit::createKilopascal(UErrorCode &status) {
+ return MeasureUnit::create(18, 4, status);
+}
+
+MeasureUnit MeasureUnit::getKilopascal() {
+ return MeasureUnit(18, 4);
+}
+
+MeasureUnit *MeasureUnit::createMegapascal(UErrorCode &status) {
+ return MeasureUnit::create(18, 5, status);
+}
+
+MeasureUnit MeasureUnit::getMegapascal() {
+ return MeasureUnit(18, 5);
+}
+
MeasureUnit *MeasureUnit::createMillibar(UErrorCode &status) {
- return MeasureUnit::create(18, 6, status);
+ return MeasureUnit::create(18, 6, status);
+}
+
+MeasureUnit MeasureUnit::getMillibar() {
+ return MeasureUnit(18, 6);
}
-MeasureUnit MeasureUnit::getMillibar() {
- return MeasureUnit(18, 6);
-}
-
MeasureUnit *MeasureUnit::createMillimeterOfMercury(UErrorCode &status) {
- return MeasureUnit::create(18, 7, status);
-}
-
-MeasureUnit MeasureUnit::getMillimeterOfMercury() {
- return MeasureUnit(18, 7);
-}
-
-MeasureUnit *MeasureUnit::createPascal(UErrorCode &status) {
- return MeasureUnit::create(18, 8, status);
-}
-
-MeasureUnit MeasureUnit::getPascal() {
- return MeasureUnit(18, 8);
-}
-
+ return MeasureUnit::create(18, 7, status);
+}
+
+MeasureUnit MeasureUnit::getMillimeterOfMercury() {
+ return MeasureUnit(18, 7);
+}
+
+MeasureUnit *MeasureUnit::createPascal(UErrorCode &status) {
+ return MeasureUnit::create(18, 8, status);
+}
+
+MeasureUnit MeasureUnit::getPascal() {
+ return MeasureUnit(18, 8);
+}
+
MeasureUnit *MeasureUnit::createPoundPerSquareInch(UErrorCode &status) {
- return MeasureUnit::create(18, 9, status);
+ return MeasureUnit::create(18, 9, status);
+}
+
+MeasureUnit MeasureUnit::getPoundPerSquareInch() {
+ return MeasureUnit(18, 9);
}
-MeasureUnit MeasureUnit::getPoundPerSquareInch() {
- return MeasureUnit(18, 9);
-}
-
MeasureUnit *MeasureUnit::createKilometerPerHour(UErrorCode &status) {
- return MeasureUnit::create(19, 0, status);
+ return MeasureUnit::create(19, 0, status);
+}
+
+MeasureUnit MeasureUnit::getKilometerPerHour() {
+ return MeasureUnit(19, 0);
}
-MeasureUnit MeasureUnit::getKilometerPerHour() {
- return MeasureUnit(19, 0);
-}
-
MeasureUnit *MeasureUnit::createKnot(UErrorCode &status) {
- return MeasureUnit::create(19, 1, status);
+ return MeasureUnit::create(19, 1, status);
+}
+
+MeasureUnit MeasureUnit::getKnot() {
+ return MeasureUnit(19, 1);
}
-MeasureUnit MeasureUnit::getKnot() {
- return MeasureUnit(19, 1);
-}
-
MeasureUnit *MeasureUnit::createMeterPerSecond(UErrorCode &status) {
- return MeasureUnit::create(19, 2, status);
+ return MeasureUnit::create(19, 2, status);
+}
+
+MeasureUnit MeasureUnit::getMeterPerSecond() {
+ return MeasureUnit(19, 2);
}
-MeasureUnit MeasureUnit::getMeterPerSecond() {
- return MeasureUnit(19, 2);
-}
-
MeasureUnit *MeasureUnit::createMilePerHour(UErrorCode &status) {
- return MeasureUnit::create(19, 3, status);
+ return MeasureUnit::create(19, 3, status);
+}
+
+MeasureUnit MeasureUnit::getMilePerHour() {
+ return MeasureUnit(19, 3);
}
-MeasureUnit MeasureUnit::getMilePerHour() {
- return MeasureUnit(19, 3);
-}
-
MeasureUnit *MeasureUnit::createCelsius(UErrorCode &status) {
- return MeasureUnit::create(20, 0, status);
+ return MeasureUnit::create(20, 0, status);
+}
+
+MeasureUnit MeasureUnit::getCelsius() {
+ return MeasureUnit(20, 0);
}
-MeasureUnit MeasureUnit::getCelsius() {
- return MeasureUnit(20, 0);
-}
-
MeasureUnit *MeasureUnit::createFahrenheit(UErrorCode &status) {
- return MeasureUnit::create(20, 1, status);
+ return MeasureUnit::create(20, 1, status);
+}
+
+MeasureUnit MeasureUnit::getFahrenheit() {
+ return MeasureUnit(20, 1);
}
-MeasureUnit MeasureUnit::getFahrenheit() {
- return MeasureUnit(20, 1);
-}
-
MeasureUnit *MeasureUnit::createGenericTemperature(UErrorCode &status) {
- return MeasureUnit::create(20, 2, status);
+ return MeasureUnit::create(20, 2, status);
+}
+
+MeasureUnit MeasureUnit::getGenericTemperature() {
+ return MeasureUnit(20, 2);
}
-MeasureUnit MeasureUnit::getGenericTemperature() {
- return MeasureUnit(20, 2);
-}
-
MeasureUnit *MeasureUnit::createKelvin(UErrorCode &status) {
- return MeasureUnit::create(20, 3, status);
-}
-
-MeasureUnit MeasureUnit::getKelvin() {
- return MeasureUnit(20, 3);
-}
-
-MeasureUnit *MeasureUnit::createNewtonMeter(UErrorCode &status) {
- return MeasureUnit::create(21, 0, status);
-}
-
-MeasureUnit MeasureUnit::getNewtonMeter() {
- return MeasureUnit(21, 0);
-}
-
-MeasureUnit *MeasureUnit::createPoundFoot(UErrorCode &status) {
- return MeasureUnit::create(21, 1, status);
-}
-
-MeasureUnit MeasureUnit::getPoundFoot() {
- return MeasureUnit(21, 1);
-}
-
+ return MeasureUnit::create(20, 3, status);
+}
+
+MeasureUnit MeasureUnit::getKelvin() {
+ return MeasureUnit(20, 3);
+}
+
+MeasureUnit *MeasureUnit::createNewtonMeter(UErrorCode &status) {
+ return MeasureUnit::create(21, 0, status);
+}
+
+MeasureUnit MeasureUnit::getNewtonMeter() {
+ return MeasureUnit(21, 0);
+}
+
+MeasureUnit *MeasureUnit::createPoundFoot(UErrorCode &status) {
+ return MeasureUnit::create(21, 1, status);
+}
+
+MeasureUnit MeasureUnit::getPoundFoot() {
+ return MeasureUnit(21, 1);
+}
+
MeasureUnit *MeasureUnit::createAcreFoot(UErrorCode &status) {
- return MeasureUnit::create(22, 0, status);
-}
-
-MeasureUnit MeasureUnit::getAcreFoot() {
- return MeasureUnit(22, 0);
-}
-
-MeasureUnit *MeasureUnit::createBarrel(UErrorCode &status) {
- return MeasureUnit::create(22, 1, status);
-}
-
-MeasureUnit MeasureUnit::getBarrel() {
- return MeasureUnit(22, 1);
-}
-
+ return MeasureUnit::create(22, 0, status);
+}
+
+MeasureUnit MeasureUnit::getAcreFoot() {
+ return MeasureUnit(22, 0);
+}
+
+MeasureUnit *MeasureUnit::createBarrel(UErrorCode &status) {
+ return MeasureUnit::create(22, 1, status);
+}
+
+MeasureUnit MeasureUnit::getBarrel() {
+ return MeasureUnit(22, 1);
+}
+
MeasureUnit *MeasureUnit::createBushel(UErrorCode &status) {
- return MeasureUnit::create(22, 2, status);
+ return MeasureUnit::create(22, 2, status);
+}
+
+MeasureUnit MeasureUnit::getBushel() {
+ return MeasureUnit(22, 2);
}
-MeasureUnit MeasureUnit::getBushel() {
- return MeasureUnit(22, 2);
-}
-
MeasureUnit *MeasureUnit::createCentiliter(UErrorCode &status) {
- return MeasureUnit::create(22, 3, status);
+ return MeasureUnit::create(22, 3, status);
+}
+
+MeasureUnit MeasureUnit::getCentiliter() {
+ return MeasureUnit(22, 3);
}
-MeasureUnit MeasureUnit::getCentiliter() {
- return MeasureUnit(22, 3);
-}
-
MeasureUnit *MeasureUnit::createCubicCentimeter(UErrorCode &status) {
- return MeasureUnit::create(22, 4, status);
+ return MeasureUnit::create(22, 4, status);
+}
+
+MeasureUnit MeasureUnit::getCubicCentimeter() {
+ return MeasureUnit(22, 4);
}
-MeasureUnit MeasureUnit::getCubicCentimeter() {
- return MeasureUnit(22, 4);
-}
-
MeasureUnit *MeasureUnit::createCubicFoot(UErrorCode &status) {
- return MeasureUnit::create(22, 5, status);
+ return MeasureUnit::create(22, 5, status);
+}
+
+MeasureUnit MeasureUnit::getCubicFoot() {
+ return MeasureUnit(22, 5);
}
-MeasureUnit MeasureUnit::getCubicFoot() {
- return MeasureUnit(22, 5);
-}
-
MeasureUnit *MeasureUnit::createCubicInch(UErrorCode &status) {
- return MeasureUnit::create(22, 6, status);
+ return MeasureUnit::create(22, 6, status);
+}
+
+MeasureUnit MeasureUnit::getCubicInch() {
+ return MeasureUnit(22, 6);
}
-MeasureUnit MeasureUnit::getCubicInch() {
- return MeasureUnit(22, 6);
-}
-
MeasureUnit *MeasureUnit::createCubicKilometer(UErrorCode &status) {
- return MeasureUnit::create(22, 7, status);
+ return MeasureUnit::create(22, 7, status);
+}
+
+MeasureUnit MeasureUnit::getCubicKilometer() {
+ return MeasureUnit(22, 7);
}
-MeasureUnit MeasureUnit::getCubicKilometer() {
- return MeasureUnit(22, 7);
-}
-
MeasureUnit *MeasureUnit::createCubicMeter(UErrorCode &status) {
- return MeasureUnit::create(22, 8, status);
+ return MeasureUnit::create(22, 8, status);
+}
+
+MeasureUnit MeasureUnit::getCubicMeter() {
+ return MeasureUnit(22, 8);
}
-MeasureUnit MeasureUnit::getCubicMeter() {
- return MeasureUnit(22, 8);
-}
-
MeasureUnit *MeasureUnit::createCubicMile(UErrorCode &status) {
- return MeasureUnit::create(22, 9, status);
+ return MeasureUnit::create(22, 9, status);
+}
+
+MeasureUnit MeasureUnit::getCubicMile() {
+ return MeasureUnit(22, 9);
}
-MeasureUnit MeasureUnit::getCubicMile() {
- return MeasureUnit(22, 9);
-}
-
MeasureUnit *MeasureUnit::createCubicYard(UErrorCode &status) {
- return MeasureUnit::create(22, 10, status);
+ return MeasureUnit::create(22, 10, status);
+}
+
+MeasureUnit MeasureUnit::getCubicYard() {
+ return MeasureUnit(22, 10);
}
-MeasureUnit MeasureUnit::getCubicYard() {
- return MeasureUnit(22, 10);
-}
-
MeasureUnit *MeasureUnit::createCup(UErrorCode &status) {
- return MeasureUnit::create(22, 11, status);
+ return MeasureUnit::create(22, 11, status);
+}
+
+MeasureUnit MeasureUnit::getCup() {
+ return MeasureUnit(22, 11);
}
-MeasureUnit MeasureUnit::getCup() {
- return MeasureUnit(22, 11);
-}
-
MeasureUnit *MeasureUnit::createCupMetric(UErrorCode &status) {
- return MeasureUnit::create(22, 12, status);
+ return MeasureUnit::create(22, 12, status);
+}
+
+MeasureUnit MeasureUnit::getCupMetric() {
+ return MeasureUnit(22, 12);
}
-MeasureUnit MeasureUnit::getCupMetric() {
- return MeasureUnit(22, 12);
-}
-
MeasureUnit *MeasureUnit::createDeciliter(UErrorCode &status) {
- return MeasureUnit::create(22, 13, status);
+ return MeasureUnit::create(22, 13, status);
+}
+
+MeasureUnit MeasureUnit::getDeciliter() {
+ return MeasureUnit(22, 13);
}
-MeasureUnit MeasureUnit::getDeciliter() {
- return MeasureUnit(22, 13);
-}
-
MeasureUnit *MeasureUnit::createFluidOunce(UErrorCode &status) {
- return MeasureUnit::create(22, 14, status);
-}
-
-MeasureUnit MeasureUnit::getFluidOunce() {
- return MeasureUnit(22, 14);
-}
-
-MeasureUnit *MeasureUnit::createFluidOunceImperial(UErrorCode &status) {
- return MeasureUnit::create(22, 15, status);
-}
-
-MeasureUnit MeasureUnit::getFluidOunceImperial() {
- return MeasureUnit(22, 15);
-}
-
+ return MeasureUnit::create(22, 14, status);
+}
+
+MeasureUnit MeasureUnit::getFluidOunce() {
+ return MeasureUnit(22, 14);
+}
+
+MeasureUnit *MeasureUnit::createFluidOunceImperial(UErrorCode &status) {
+ return MeasureUnit::create(22, 15, status);
+}
+
+MeasureUnit MeasureUnit::getFluidOunceImperial() {
+ return MeasureUnit(22, 15);
+}
+
MeasureUnit *MeasureUnit::createGallon(UErrorCode &status) {
- return MeasureUnit::create(22, 16, status);
+ return MeasureUnit::create(22, 16, status);
+}
+
+MeasureUnit MeasureUnit::getGallon() {
+ return MeasureUnit(22, 16);
}
-MeasureUnit MeasureUnit::getGallon() {
- return MeasureUnit(22, 16);
-}
-
MeasureUnit *MeasureUnit::createGallonImperial(UErrorCode &status) {
- return MeasureUnit::create(22, 17, status);
+ return MeasureUnit::create(22, 17, status);
+}
+
+MeasureUnit MeasureUnit::getGallonImperial() {
+ return MeasureUnit(22, 17);
}
-MeasureUnit MeasureUnit::getGallonImperial() {
- return MeasureUnit(22, 17);
-}
-
MeasureUnit *MeasureUnit::createHectoliter(UErrorCode &status) {
- return MeasureUnit::create(22, 18, status);
+ return MeasureUnit::create(22, 18, status);
+}
+
+MeasureUnit MeasureUnit::getHectoliter() {
+ return MeasureUnit(22, 18);
}
-MeasureUnit MeasureUnit::getHectoliter() {
- return MeasureUnit(22, 18);
-}
-
MeasureUnit *MeasureUnit::createLiter(UErrorCode &status) {
- return MeasureUnit::create(22, 19, status);
+ return MeasureUnit::create(22, 19, status);
+}
+
+MeasureUnit MeasureUnit::getLiter() {
+ return MeasureUnit(22, 19);
}
-MeasureUnit MeasureUnit::getLiter() {
- return MeasureUnit(22, 19);
-}
-
MeasureUnit *MeasureUnit::createMegaliter(UErrorCode &status) {
- return MeasureUnit::create(22, 20, status);
+ return MeasureUnit::create(22, 20, status);
+}
+
+MeasureUnit MeasureUnit::getMegaliter() {
+ return MeasureUnit(22, 20);
}
-MeasureUnit MeasureUnit::getMegaliter() {
- return MeasureUnit(22, 20);
-}
-
MeasureUnit *MeasureUnit::createMilliliter(UErrorCode &status) {
- return MeasureUnit::create(22, 21, status);
+ return MeasureUnit::create(22, 21, status);
+}
+
+MeasureUnit MeasureUnit::getMilliliter() {
+ return MeasureUnit(22, 21);
}
-MeasureUnit MeasureUnit::getMilliliter() {
- return MeasureUnit(22, 21);
-}
-
MeasureUnit *MeasureUnit::createPint(UErrorCode &status) {
- return MeasureUnit::create(22, 22, status);
+ return MeasureUnit::create(22, 22, status);
+}
+
+MeasureUnit MeasureUnit::getPint() {
+ return MeasureUnit(22, 22);
}
-MeasureUnit MeasureUnit::getPint() {
- return MeasureUnit(22, 22);
-}
-
MeasureUnit *MeasureUnit::createPintMetric(UErrorCode &status) {
- return MeasureUnit::create(22, 23, status);
+ return MeasureUnit::create(22, 23, status);
+}
+
+MeasureUnit MeasureUnit::getPintMetric() {
+ return MeasureUnit(22, 23);
}
-MeasureUnit MeasureUnit::getPintMetric() {
- return MeasureUnit(22, 23);
-}
-
MeasureUnit *MeasureUnit::createQuart(UErrorCode &status) {
- return MeasureUnit::create(22, 24, status);
+ return MeasureUnit::create(22, 24, status);
+}
+
+MeasureUnit MeasureUnit::getQuart() {
+ return MeasureUnit(22, 24);
}
-MeasureUnit MeasureUnit::getQuart() {
- return MeasureUnit(22, 24);
-}
-
MeasureUnit *MeasureUnit::createTablespoon(UErrorCode &status) {
- return MeasureUnit::create(22, 25, status);
+ return MeasureUnit::create(22, 25, status);
+}
+
+MeasureUnit MeasureUnit::getTablespoon() {
+ return MeasureUnit(22, 25);
}
-MeasureUnit MeasureUnit::getTablespoon() {
- return MeasureUnit(22, 25);
-}
-
MeasureUnit *MeasureUnit::createTeaspoon(UErrorCode &status) {
- return MeasureUnit::create(22, 26, status);
+ return MeasureUnit::create(22, 26, status);
+}
+
+MeasureUnit MeasureUnit::getTeaspoon() {
+ return MeasureUnit(22, 26);
}
-MeasureUnit MeasureUnit::getTeaspoon() {
- return MeasureUnit(22, 26);
-}
-
// End generated code
static int32_t binarySearch(
- const char * const * array, int32_t start, int32_t end, StringPiece key) {
+ const char * const * array, int32_t start, int32_t end, StringPiece key) {
while (start < end) {
int32_t mid = (start + end) / 2;
- int32_t cmp = StringPiece(array[mid]).compare(key);
+ int32_t cmp = StringPiece(array[mid]).compare(key);
if (cmp < 0) {
start = mid + 1;
continue;
@@ -2007,95 +2007,95 @@ static int32_t binarySearch(
}
return -1;
}
-
-MeasureUnit::MeasureUnit() : MeasureUnit(kBaseTypeIdx, kBaseSubTypeIdx) {
-}
-
-MeasureUnit::MeasureUnit(int32_t typeId, int32_t subTypeId)
- : fImpl(nullptr), fSubTypeId(subTypeId), fTypeId(typeId) {
-}
-
+
+MeasureUnit::MeasureUnit() : MeasureUnit(kBaseTypeIdx, kBaseSubTypeIdx) {
+}
+
+MeasureUnit::MeasureUnit(int32_t typeId, int32_t subTypeId)
+ : fImpl(nullptr), fSubTypeId(subTypeId), fTypeId(typeId) {
+}
+
MeasureUnit::MeasureUnit(const MeasureUnit &other)
- : fImpl(nullptr) {
- *this = other;
-}
-
-MeasureUnit::MeasureUnit(MeasureUnit &&other) noexcept
- : fImpl(other.fImpl),
- fSubTypeId(other.fSubTypeId),
- fTypeId(other.fTypeId) {
- other.fImpl = nullptr;
-}
-
-MeasureUnit::MeasureUnit(MeasureUnitImpl&& impl)
- : fImpl(nullptr), fSubTypeId(-1), fTypeId(-1) {
- if (!findBySubType(impl.identifier.toStringPiece(), this)) {
- fImpl = new MeasureUnitImpl(std::move(impl));
- }
-}
-
+ : fImpl(nullptr) {
+ *this = other;
+}
+
+MeasureUnit::MeasureUnit(MeasureUnit &&other) noexcept
+ : fImpl(other.fImpl),
+ fSubTypeId(other.fSubTypeId),
+ fTypeId(other.fTypeId) {
+ other.fImpl = nullptr;
+}
+
+MeasureUnit::MeasureUnit(MeasureUnitImpl&& impl)
+ : fImpl(nullptr), fSubTypeId(-1), fTypeId(-1) {
+ if (!findBySubType(impl.identifier.toStringPiece(), this)) {
+ fImpl = new MeasureUnitImpl(std::move(impl));
+ }
+}
+
MeasureUnit &MeasureUnit::operator=(const MeasureUnit &other) {
if (this == &other) {
return *this;
}
- delete fImpl;
- if (other.fImpl) {
- ErrorCode localStatus;
- fImpl = new MeasureUnitImpl(other.fImpl->copy(localStatus));
- if (!fImpl || localStatus.isFailure()) {
- // Unrecoverable allocation error; set to the default unit
- *this = MeasureUnit();
- return *this;
- }
- } else {
- fImpl = nullptr;
- }
+ delete fImpl;
+ if (other.fImpl) {
+ ErrorCode localStatus;
+ fImpl = new MeasureUnitImpl(other.fImpl->copy(localStatus));
+ if (!fImpl || localStatus.isFailure()) {
+ // Unrecoverable allocation error; set to the default unit
+ *this = MeasureUnit();
+ return *this;
+ }
+ } else {
+ fImpl = nullptr;
+ }
fTypeId = other.fTypeId;
fSubTypeId = other.fSubTypeId;
return *this;
}
-MeasureUnit &MeasureUnit::operator=(MeasureUnit &&other) noexcept {
- if (this == &other) {
- return *this;
- }
- delete fImpl;
- fImpl = other.fImpl;
- other.fImpl = nullptr;
- fTypeId = other.fTypeId;
- fSubTypeId = other.fSubTypeId;
- return *this;
-}
-
-MeasureUnit *MeasureUnit::clone() const {
+MeasureUnit &MeasureUnit::operator=(MeasureUnit &&other) noexcept {
+ if (this == &other) {
+ return *this;
+ }
+ delete fImpl;
+ fImpl = other.fImpl;
+ other.fImpl = nullptr;
+ fTypeId = other.fTypeId;
+ fSubTypeId = other.fSubTypeId;
+ return *this;
+}
+
+MeasureUnit *MeasureUnit::clone() const {
return new MeasureUnit(*this);
}
MeasureUnit::~MeasureUnit() {
- delete fImpl;
- fImpl = nullptr;
+ delete fImpl;
+ fImpl = nullptr;
}
const char *MeasureUnit::getType() const {
- // We have a type & subtype only if fTypeId is present.
- if (fTypeId == -1) {
- return "";
- }
+ // We have a type & subtype only if fTypeId is present.
+ if (fTypeId == -1) {
+ return "";
+ }
return gTypes[fTypeId];
}
const char *MeasureUnit::getSubtype() const {
- // We have a type & subtype only if fTypeId is present.
- if (fTypeId == -1) {
- return "";
- }
- return getIdentifier();
+ // We have a type & subtype only if fTypeId is present.
+ if (fTypeId == -1) {
+ return "";
+ }
+ return getIdentifier();
+}
+
+const char *MeasureUnit::getIdentifier() const {
+ return fImpl ? fImpl->identifier.data() : gSubTypes[getOffset()];
}
-const char *MeasureUnit::getIdentifier() const {
- return fImpl ? fImpl->identifier.data() : gSubTypes[getOffset()];
-}
-
UBool MeasureUnit::operator==(const UObject& other) const {
if (this == &other) { // Same object, equal
return TRUE;
@@ -2104,7 +2104,7 @@ UBool MeasureUnit::operator==(const UObject& other) const {
return FALSE;
}
const MeasureUnit &rhs = static_cast<const MeasureUnit&>(other);
- return uprv_strcmp(getIdentifier(), rhs.getIdentifier()) == 0;
+ return uprv_strcmp(getIdentifier(), rhs.getIdentifier()) == 0;
}
int32_t MeasureUnit::getIndex() const {
@@ -2189,29 +2189,29 @@ int32_t MeasureUnit::internalGetIndexForTypeAndSubtype(const char *type, const c
return gIndexes[t] + st - gOffsets[t];
}
-bool MeasureUnit::findBySubType(StringPiece subType, MeasureUnit* output) {
- for (int32_t t = 0; t < UPRV_LENGTHOF(gOffsets) - 1; t++) {
- // Skip currency units
- if (gIndexes[t] == gIndexes[t + 1]) {
- continue;
- }
- int32_t st = binarySearch(gSubTypes, gOffsets[t], gOffsets[t + 1], subType);
- if (st >= 0) {
- output->setTo(t, st - gOffsets[t]);
- return true;
- }
- }
- return false;
-}
-
-MeasureUnit MeasureUnit::resolveUnitPerUnit(
- const MeasureUnit &unit, const MeasureUnit &perUnit, bool* isResolved) {
+bool MeasureUnit::findBySubType(StringPiece subType, MeasureUnit* output) {
+ for (int32_t t = 0; t < UPRV_LENGTHOF(gOffsets) - 1; t++) {
+ // Skip currency units
+ if (gIndexes[t] == gIndexes[t + 1]) {
+ continue;
+ }
+ int32_t st = binarySearch(gSubTypes, gOffsets[t], gOffsets[t + 1], subType);
+ if (st >= 0) {
+ output->setTo(t, st - gOffsets[t]);
+ return true;
+ }
+ }
+ return false;
+}
+
+MeasureUnit MeasureUnit::resolveUnitPerUnit(
+ const MeasureUnit &unit, const MeasureUnit &perUnit, bool* isResolved) {
int32_t unitOffset = unit.getOffset();
int32_t perUnitOffset = perUnit.getOffset();
- if (unitOffset == -1 || perUnitOffset == -1) {
- *isResolved = false;
- return MeasureUnit();
- }
+ if (unitOffset == -1 || perUnitOffset == -1) {
+ *isResolved = false;
+ return MeasureUnit();
+ }
// binary search for (unitOffset, perUnitOffset)
int32_t start = 0;
@@ -2230,13 +2230,13 @@ MeasureUnit MeasureUnit::resolveUnitPerUnit(
} else {
// We found a resolution for our unit / per-unit combo
// return it.
- *isResolved = true;
- return MeasureUnit(midRow[2], midRow[3]);
+ *isResolved = true;
+ return MeasureUnit(midRow[2], midRow[3]);
}
}
-
- *isResolved = false;
- return MeasureUnit();
+
+ *isResolved = false;
+ return MeasureUnit();
}
MeasureUnit *MeasureUnit::create(int typeId, int subTypeId, UErrorCode &status) {
@@ -2259,46 +2259,46 @@ void MeasureUnit::initTime(const char *timeId) {
fSubTypeId = result - gOffsets[fTypeId];
}
-void MeasureUnit::initCurrency(StringPiece isoCurrency) {
+void MeasureUnit::initCurrency(StringPiece isoCurrency) {
int32_t result = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), "currency");
U_ASSERT(result != -1);
fTypeId = result;
result = binarySearch(
gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], isoCurrency);
- if (result == -1) {
- fImpl = new MeasureUnitImpl(MeasureUnitImpl::forCurrencyCode(isoCurrency));
- if (fImpl) {
- fSubTypeId = -1;
- return;
- }
- // malloc error: fall back to the undefined currency
- result = binarySearch(
- gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], kDefaultCurrency8);
- U_ASSERT(result != -1);
+ if (result == -1) {
+ fImpl = new MeasureUnitImpl(MeasureUnitImpl::forCurrencyCode(isoCurrency));
+ if (fImpl) {
+ fSubTypeId = -1;
+ return;
+ }
+ // malloc error: fall back to the undefined currency
+ result = binarySearch(
+ gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], kDefaultCurrency8);
+ U_ASSERT(result != -1);
}
- fSubTypeId = result - gOffsets[fTypeId];
+ fSubTypeId = result - gOffsets[fTypeId];
+}
+
+void MeasureUnit::initNoUnit(const char *subtype) {
+ int32_t result = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), "none");
+ U_ASSERT(result != -1);
+ fTypeId = result;
+ result = binarySearch(gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], subtype);
+ U_ASSERT(result != -1);
+ fSubTypeId = result - gOffsets[fTypeId];
}
-void MeasureUnit::initNoUnit(const char *subtype) {
- int32_t result = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), "none");
- U_ASSERT(result != -1);
- fTypeId = result;
- result = binarySearch(gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], subtype);
- U_ASSERT(result != -1);
- fSubTypeId = result - gOffsets[fTypeId];
-}
-
void MeasureUnit::setTo(int32_t typeId, int32_t subTypeId) {
fTypeId = typeId;
fSubTypeId = subTypeId;
- delete fImpl;
- fImpl = nullptr;
+ delete fImpl;
+ fImpl = nullptr;
}
int32_t MeasureUnit::getOffset() const {
- if (fTypeId < 0 || fSubTypeId < 0) {
- return -1;
- }
+ if (fTypeId < 0 || fSubTypeId < 0) {
+ return -1;
+ }
return gOffsets[fTypeId] + fSubTypeId;
}
diff --git a/contrib/libs/icu/i18n/measunit_extra.cpp b/contrib/libs/icu/i18n/measunit_extra.cpp
index ab2b40d9b7..aeb60017a1 100644
--- a/contrib/libs/icu/i18n/measunit_extra.cpp
+++ b/contrib/libs/icu/i18n/measunit_extra.cpp
@@ -1,893 +1,893 @@
-// © 2020 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// Extra functions for MeasureUnit not needed for all clients.
-// Separate .o file so that it can be removed for modularity.
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include <cstdlib>
-#include "cstring.h"
-#include "measunit_impl.h"
-#include "uarrsort.h"
-#include "uassert.h"
-#include "ucln_in.h"
-#include "umutex.h"
-#include "unicode/errorcode.h"
-#include "unicode/localpointer.h"
-#include "unicode/measunit.h"
-#include "unicode/ucharstrie.h"
-#include "unicode/ucharstriebuilder.h"
-
-#include "cstr.h"
-
-U_NAMESPACE_BEGIN
-
-
-namespace {
-
-// TODO: Propose a new error code for this?
-constexpr UErrorCode kUnitIdentifierSyntaxError = U_ILLEGAL_ARGUMENT_ERROR;
-
-// Trie value offset for SI Prefixes. This is big enough to ensure we only
-// insert positive integers into the trie.
-constexpr int32_t kSIPrefixOffset = 64;
-
-// Trie value offset for compound parts, e.g. "-per-", "-", "-and-".
-constexpr int32_t kCompoundPartOffset = 128;
-
-enum CompoundPart {
- // Represents "-per-"
- COMPOUND_PART_PER = kCompoundPartOffset,
- // Represents "-"
- COMPOUND_PART_TIMES,
- // Represents "-and-"
- COMPOUND_PART_AND,
-};
-
-// Trie value offset for "per-".
-constexpr int32_t kInitialCompoundPartOffset = 192;
-
-enum InitialCompoundPart {
- // Represents "per-", the only compound part that can appear at the start of
- // an identifier.
- INITIAL_COMPOUND_PART_PER = kInitialCompoundPartOffset,
-};
-
-// Trie value offset for powers like "square-", "cubic-", "p2-" etc.
-constexpr int32_t kPowerPartOffset = 256;
-
-enum PowerPart {
- POWER_PART_P2 = kPowerPartOffset + 2,
- POWER_PART_P3,
- POWER_PART_P4,
- POWER_PART_P5,
- POWER_PART_P6,
- POWER_PART_P7,
- POWER_PART_P8,
- POWER_PART_P9,
- POWER_PART_P10,
- POWER_PART_P11,
- POWER_PART_P12,
- POWER_PART_P13,
- POWER_PART_P14,
- POWER_PART_P15,
-};
-
-// Trie value offset for simple units, e.g. "gram", "nautical-mile",
-// "fluid-ounce-imperial".
-constexpr int32_t kSimpleUnitOffset = 512;
-
-const struct SIPrefixStrings {
- const char* const string;
- UMeasureSIPrefix value;
-} gSIPrefixStrings[] = {
- { "yotta", UMEASURE_SI_PREFIX_YOTTA },
- { "zetta", UMEASURE_SI_PREFIX_ZETTA },
- { "exa", UMEASURE_SI_PREFIX_EXA },
- { "peta", UMEASURE_SI_PREFIX_PETA },
- { "tera", UMEASURE_SI_PREFIX_TERA },
- { "giga", UMEASURE_SI_PREFIX_GIGA },
- { "mega", UMEASURE_SI_PREFIX_MEGA },
- { "kilo", UMEASURE_SI_PREFIX_KILO },
- { "hecto", UMEASURE_SI_PREFIX_HECTO },
- { "deka", UMEASURE_SI_PREFIX_DEKA },
- { "deci", UMEASURE_SI_PREFIX_DECI },
- { "centi", UMEASURE_SI_PREFIX_CENTI },
- { "milli", UMEASURE_SI_PREFIX_MILLI },
- { "micro", UMEASURE_SI_PREFIX_MICRO },
- { "nano", UMEASURE_SI_PREFIX_NANO },
- { "pico", UMEASURE_SI_PREFIX_PICO },
- { "femto", UMEASURE_SI_PREFIX_FEMTO },
- { "atto", UMEASURE_SI_PREFIX_ATTO },
- { "zepto", UMEASURE_SI_PREFIX_ZEPTO },
- { "yocto", UMEASURE_SI_PREFIX_YOCTO },
-};
-
-// TODO(ICU-21059): Get this list from data
-const char16_t* const gSimpleUnits[] = {
- u"candela",
- u"carat",
- u"gram",
- u"ounce",
- u"ounce-troy",
- u"pound",
- u"kilogram",
- u"stone",
- u"ton",
- u"metric-ton",
- u"earth-mass",
- u"solar-mass",
- u"point",
- u"inch",
- u"foot",
- u"yard",
- u"meter",
- u"fathom",
- u"furlong",
- u"mile",
- u"nautical-mile",
- u"mile-scandinavian",
- u"100-kilometer",
- u"earth-radius",
- u"solar-radius",
- u"astronomical-unit",
- u"light-year",
- u"parsec",
- u"second",
- u"minute",
- u"hour",
- u"day",
- u"day-person",
- u"week",
- u"week-person",
- u"month",
- u"month-person",
- u"year",
- u"year-person",
- u"decade",
- u"century",
- u"ampere",
- u"fahrenheit",
- u"kelvin",
- u"celsius",
- u"arc-second",
- u"arc-minute",
- u"degree",
- u"radian",
- u"revolution",
- u"item",
- u"mole",
- u"permillion",
- u"permyriad",
- u"permille",
- u"percent",
- u"karat",
- u"portion",
- u"bit",
- u"byte",
- u"dot",
- u"pixel",
- u"em",
- u"hertz",
- u"newton",
- u"pound-force",
- u"pascal",
- u"bar",
- u"atmosphere",
- u"ofhg",
- u"electronvolt",
- u"dalton",
- u"joule",
- u"calorie",
- u"british-thermal-unit",
- u"foodcalorie",
- u"therm-us",
- u"watt",
- u"horsepower",
- u"solar-luminosity",
- u"volt",
- u"ohm",
- u"dunam",
- u"acre",
- u"hectare",
- u"teaspoon",
- u"tablespoon",
- u"fluid-ounce-imperial",
- u"fluid-ounce",
- u"cup",
- u"cup-metric",
- u"pint",
- u"pint-metric",
- u"quart",
- u"liter",
- u"gallon",
- u"gallon-imperial",
- u"bushel",
- u"barrel",
- u"knot",
- u"g-force",
- u"lux",
-};
-
-icu::UInitOnce gUnitExtrasInitOnce = U_INITONCE_INITIALIZER;
-
-char16_t* kSerializedUnitExtrasStemTrie = nullptr;
-
-UBool U_CALLCONV cleanupUnitExtras() {
- uprv_free(kSerializedUnitExtrasStemTrie);
- kSerializedUnitExtrasStemTrie = nullptr;
- gUnitExtrasInitOnce.reset();
- return TRUE;
-}
-
-void U_CALLCONV initUnitExtras(UErrorCode& status) {
- ucln_i18n_registerCleanup(UCLN_I18N_UNIT_EXTRAS, cleanupUnitExtras);
-
- UCharsTrieBuilder b(status);
- if (U_FAILURE(status)) { return; }
-
- // Add SI prefixes
- for (const auto& siPrefixInfo : gSIPrefixStrings) {
- UnicodeString uSIPrefix(siPrefixInfo.string, -1, US_INV);
- b.add(uSIPrefix, siPrefixInfo.value + kSIPrefixOffset, status);
- }
- if (U_FAILURE(status)) { return; }
-
- // Add syntax parts (compound, power prefixes)
- b.add(u"-per-", COMPOUND_PART_PER, status);
- b.add(u"-", COMPOUND_PART_TIMES, status);
- b.add(u"-and-", COMPOUND_PART_AND, status);
- b.add(u"per-", INITIAL_COMPOUND_PART_PER, status);
- b.add(u"square-", POWER_PART_P2, status);
- b.add(u"cubic-", POWER_PART_P3, status);
- b.add(u"p2-", POWER_PART_P2, status);
- b.add(u"p3-", POWER_PART_P3, status);
- b.add(u"p4-", POWER_PART_P4, status);
- b.add(u"p5-", POWER_PART_P5, status);
- b.add(u"p6-", POWER_PART_P6, status);
- b.add(u"p7-", POWER_PART_P7, status);
- b.add(u"p8-", POWER_PART_P8, status);
- b.add(u"p9-", POWER_PART_P9, status);
- b.add(u"p10-", POWER_PART_P10, status);
- b.add(u"p11-", POWER_PART_P11, status);
- b.add(u"p12-", POWER_PART_P12, status);
- b.add(u"p13-", POWER_PART_P13, status);
- b.add(u"p14-", POWER_PART_P14, status);
- b.add(u"p15-", POWER_PART_P15, status);
- if (U_FAILURE(status)) { return; }
-
- // Add sanctioned simple units by offset
- int32_t simpleUnitOffset = kSimpleUnitOffset;
- for (auto simpleUnit : gSimpleUnits) {
- b.add(simpleUnit, simpleUnitOffset++, status);
- }
-
- // Build the CharsTrie
- // TODO: Use SLOW or FAST here?
- UnicodeString result;
- b.buildUnicodeString(USTRINGTRIE_BUILD_FAST, result, status);
- if (U_FAILURE(status)) { return; }
-
- // Copy the result into the global constant pointer
- size_t numBytes = result.length() * sizeof(char16_t);
- kSerializedUnitExtrasStemTrie = static_cast<char16_t*>(uprv_malloc(numBytes));
- uprv_memcpy(kSerializedUnitExtrasStemTrie, result.getBuffer(), numBytes);
-}
-
-class Token {
-public:
- Token(int32_t match) : fMatch(match) {}
-
- enum Type {
- TYPE_UNDEFINED,
- TYPE_SI_PREFIX,
- // Token type for "-per-", "-", and "-and-".
- TYPE_COMPOUND_PART,
- // Token type for "per-".
- TYPE_INITIAL_COMPOUND_PART,
- TYPE_POWER_PART,
- TYPE_SIMPLE_UNIT,
- };
-
- // Calling getType() is invalid, resulting in an assertion failure, if Token
- // value isn't positive.
- Type getType() const {
- U_ASSERT(fMatch > 0);
- if (fMatch < kCompoundPartOffset) {
- return TYPE_SI_PREFIX;
- }
- if (fMatch < kInitialCompoundPartOffset) {
- return TYPE_COMPOUND_PART;
- }
- if (fMatch < kPowerPartOffset) {
- return TYPE_INITIAL_COMPOUND_PART;
- }
- if (fMatch < kSimpleUnitOffset) {
- return TYPE_POWER_PART;
- }
- return TYPE_SIMPLE_UNIT;
- }
-
- UMeasureSIPrefix getSIPrefix() const {
- U_ASSERT(getType() == TYPE_SI_PREFIX);
- return static_cast<UMeasureSIPrefix>(fMatch - kSIPrefixOffset);
- }
-
- // Valid only for tokens with type TYPE_COMPOUND_PART.
- int32_t getMatch() const {
- U_ASSERT(getType() == TYPE_COMPOUND_PART);
- return fMatch;
- }
-
- int32_t getInitialCompoundPart() const {
- // Even if there is only one InitialCompoundPart value, we have this
- // function for the simplicity of code consistency.
- U_ASSERT(getType() == TYPE_INITIAL_COMPOUND_PART);
- // Defensive: if this assert fails, code using this function also needs
- // to change.
- U_ASSERT(fMatch == INITIAL_COMPOUND_PART_PER);
- return fMatch;
- }
-
- int8_t getPower() const {
- U_ASSERT(getType() == TYPE_POWER_PART);
- return static_cast<int8_t>(fMatch - kPowerPartOffset);
- }
-
- int32_t getSimpleUnitIndex() const {
- U_ASSERT(getType() == TYPE_SIMPLE_UNIT);
- return fMatch - kSimpleUnitOffset;
- }
-
-private:
- int32_t fMatch;
-};
-
-class Parser {
-public:
- /**
- * Factory function for parsing the given identifier.
- *
- * @param source The identifier to parse. This function does not make a copy
- * of source: the underlying string that source points at, must outlive the
- * parser.
- * @param status ICU error code.
- */
- static Parser from(StringPiece source, UErrorCode& status) {
- if (U_FAILURE(status)) {
- return Parser();
- }
- umtx_initOnce(gUnitExtrasInitOnce, &initUnitExtras, status);
- if (U_FAILURE(status)) {
- return Parser();
- }
- return Parser(source);
- }
-
- MeasureUnitImpl parse(UErrorCode& status) {
- MeasureUnitImpl result;
- parseImpl(result, status);
- return result;
- }
-
-private:
- // Tracks parser progress: the offset into fSource.
- int32_t fIndex = 0;
-
- // Since we're not owning this memory, whatever is passed to the constructor
- // should live longer than this Parser - and the parser shouldn't return any
- // references to that string.
- StringPiece fSource;
- UCharsTrie fTrie;
-
- // Set to true when we've seen a "-per-" or a "per-", after which all units
- // are in the denominator. Until we find an "-and-", at which point the
- // identifier is invalid pending TODO(CLDR-13700).
- bool fAfterPer = false;
-
- Parser() : fSource(""), fTrie(u"") {}
-
- Parser(StringPiece source)
- : fSource(source), fTrie(kSerializedUnitExtrasStemTrie) {}
-
- inline bool hasNext() const {
- return fIndex < fSource.length();
- }
-
- // Returns the next Token parsed from fSource, advancing fIndex to the end
- // of that token in fSource. In case of U_FAILURE(status), the token
- // returned will cause an abort if getType() is called on it.
- Token nextToken(UErrorCode& status) {
- fTrie.reset();
- int32_t match = -1;
- // Saves the position in the fSource string for the end of the most
- // recent matching token.
- int32_t previ = -1;
- // Find the longest token that matches a value in the trie:
- while (fIndex < fSource.length()) {
- auto result = fTrie.next(fSource.data()[fIndex++]);
- if (result == USTRINGTRIE_NO_MATCH) {
- break;
- } else if (result == USTRINGTRIE_NO_VALUE) {
- continue;
- }
- U_ASSERT(USTRINGTRIE_HAS_VALUE(result));
- match = fTrie.getValue();
- previ = fIndex;
- if (result == USTRINGTRIE_FINAL_VALUE) {
- break;
- }
- U_ASSERT(result == USTRINGTRIE_INTERMEDIATE_VALUE);
- // continue;
- }
-
- if (match < 0) {
- status = kUnitIdentifierSyntaxError;
- } else {
- fIndex = previ;
- }
- return Token(match);
- }
-
- /**
- * Returns the next "single unit" via result.
- *
- * If a "-per-" was parsed, the result will have appropriate negative
- * dimensionality.
- *
- * Returns an error if we parse both compound units and "-and-", since mixed
- * compound units are not yet supported - TODO(CLDR-13700).
- *
- * @param result Will be overwritten by the result, if status shows success.
- * @param sawAnd If an "-and-" was parsed prior to finding the "single
- * unit", sawAnd is set to true. If not, it is left as is.
- * @param status ICU error code.
- */
- void nextSingleUnit(SingleUnitImpl& result, bool& sawAnd, UErrorCode& status) {
- if (U_FAILURE(status)) {
- return;
- }
-
- // state:
- // 0 = no tokens seen yet (will accept power, SI prefix, or simple unit)
- // 1 = power token seen (will not accept another power token)
- // 2 = SI prefix token seen (will not accept a power or SI prefix token)
- int32_t state = 0;
-
- bool atStart = fIndex == 0;
- Token token = nextToken(status);
- if (U_FAILURE(status)) { return; }
-
- if (atStart) {
- // Identifiers optionally start with "per-".
- if (token.getType() == Token::TYPE_INITIAL_COMPOUND_PART) {
- U_ASSERT(token.getInitialCompoundPart() == INITIAL_COMPOUND_PART_PER);
- fAfterPer = true;
- result.dimensionality = -1;
-
- token = nextToken(status);
- if (U_FAILURE(status)) { return; }
- }
- } else {
- // All other SingleUnit's are separated from previous SingleUnit's
- // via a compound part:
- if (token.getType() != Token::TYPE_COMPOUND_PART) {
- status = kUnitIdentifierSyntaxError;
- return;
- }
-
- switch (token.getMatch()) {
- case COMPOUND_PART_PER:
- if (sawAnd) {
- // Mixed compound units not yet supported,
- // TODO(CLDR-13700).
- status = kUnitIdentifierSyntaxError;
- return;
- }
- fAfterPer = true;
- result.dimensionality = -1;
- break;
-
- case COMPOUND_PART_TIMES:
- if (fAfterPer) {
- result.dimensionality = -1;
- }
- break;
-
- case COMPOUND_PART_AND:
- if (fAfterPer) {
- // Can't start with "-and-", and mixed compound units
- // not yet supported, TODO(CLDR-13700).
- status = kUnitIdentifierSyntaxError;
- return;
- }
- sawAnd = true;
- break;
- }
-
- token = nextToken(status);
- if (U_FAILURE(status)) { return; }
- }
-
- // Read tokens until we have a complete SingleUnit or we reach the end.
- while (true) {
- switch (token.getType()) {
- case Token::TYPE_POWER_PART:
- if (state > 0) {
- status = kUnitIdentifierSyntaxError;
- return;
- }
- result.dimensionality *= token.getPower();
- state = 1;
- break;
-
- case Token::TYPE_SI_PREFIX:
- if (state > 1) {
- status = kUnitIdentifierSyntaxError;
- return;
- }
- result.siPrefix = token.getSIPrefix();
- state = 2;
- break;
-
- case Token::TYPE_SIMPLE_UNIT:
- result.index = token.getSimpleUnitIndex();
- return;
-
- default:
- status = kUnitIdentifierSyntaxError;
- return;
- }
-
- if (!hasNext()) {
- // We ran out of tokens before finding a complete single unit.
- status = kUnitIdentifierSyntaxError;
- return;
- }
- token = nextToken(status);
- if (U_FAILURE(status)) {
- return;
- }
- }
- }
-
- /// @param result is modified, not overridden. Caller must pass in a
- /// default-constructed (empty) MeasureUnitImpl instance.
- void parseImpl(MeasureUnitImpl& result, UErrorCode& status) {
- if (U_FAILURE(status)) {
- return;
- }
- if (fSource.empty()) {
- // The dimenionless unit: nothing to parse. leave result as is.
- return;
- }
- int32_t unitNum = 0;
- while (hasNext()) {
- bool sawAnd = false;
- SingleUnitImpl singleUnit;
- nextSingleUnit(singleUnit, sawAnd, status);
- if (U_FAILURE(status)) {
- return;
- }
- U_ASSERT(!singleUnit.isDimensionless());
- bool added = result.append(singleUnit, status);
- if (sawAnd && !added) {
- // Two similar units are not allowed in a mixed unit
- status = kUnitIdentifierSyntaxError;
- return;
- }
- if ((++unitNum) >= 2) {
- // nextSingleUnit fails appropriately for "per" and "and" in the
- // same identifier. It doesn't fail for other compound units
- // (COMPOUND_PART_TIMES). Consequently we take care of that
- // here.
- UMeasureUnitComplexity complexity =
- sawAnd ? UMEASURE_UNIT_MIXED : UMEASURE_UNIT_COMPOUND;
- if (unitNum == 2) {
- U_ASSERT(result.complexity == UMEASURE_UNIT_SINGLE);
- result.complexity = complexity;
- } else if (result.complexity != complexity) {
- // Can't have mixed compound units
- status = kUnitIdentifierSyntaxError;
- return;
- }
- }
- }
- }
-};
-
-int32_t U_CALLCONV
-compareSingleUnits(const void* /*context*/, const void* left, const void* right) {
- auto realLeft = static_cast<const SingleUnitImpl* const*>(left);
- auto realRight = static_cast<const SingleUnitImpl* const*>(right);
- return (*realLeft)->compareTo(**realRight);
-}
-
-/**
- * Generate the identifier string for a single unit in place.
- *
- * Does not support the dimensionless SingleUnitImpl: calling serializeSingle
- * with the dimensionless unit results in an U_INTERNAL_PROGRAM_ERROR.
- *
- * @param first If singleUnit is part of a compound unit, and not its first
- * single unit, set this to false. Otherwise: set to true.
- */
-void serializeSingle(const SingleUnitImpl& singleUnit, bool first, CharString& output, UErrorCode& status) {
- if (first && singleUnit.dimensionality < 0) {
- // Essentially the "unary per". For compound units with a numerator, the
- // caller takes care of the "binary per".
- output.append("per-", status);
- }
-
- if (singleUnit.isDimensionless()) {
- status = U_INTERNAL_PROGRAM_ERROR;
- return;
- }
- int8_t posPower = std::abs(singleUnit.dimensionality);
- if (posPower == 0) {
- status = U_INTERNAL_PROGRAM_ERROR;
- } else if (posPower == 1) {
- // no-op
- } else if (posPower == 2) {
- output.append("square-", status);
- } else if (posPower == 3) {
- output.append("cubic-", status);
- } else if (posPower < 10) {
- output.append('p', status);
- output.append(posPower + '0', status);
- output.append('-', status);
- } else if (posPower <= 15) {
- output.append("p1", status);
- output.append('0' + (posPower % 10), status);
- output.append('-', status);
- } else {
- status = kUnitIdentifierSyntaxError;
- }
- if (U_FAILURE(status)) {
- return;
- }
-
- if (singleUnit.siPrefix != UMEASURE_SI_PREFIX_ONE) {
- for (const auto& siPrefixInfo : gSIPrefixStrings) {
- if (siPrefixInfo.value == singleUnit.siPrefix) {
- output.append(siPrefixInfo.string, status);
- break;
- }
- }
- }
- if (U_FAILURE(status)) {
- return;
- }
-
- output.appendInvariantChars(gSimpleUnits[singleUnit.index], status);
-}
-
-/**
- * Normalize a MeasureUnitImpl and generate the identifier string in place.
- */
-void serialize(MeasureUnitImpl& impl, UErrorCode& status) {
- if (U_FAILURE(status)) {
- return;
- }
- U_ASSERT(impl.identifier.isEmpty());
- if (impl.units.length() == 0) {
- // Dimensionless, constructed by the default constructor: no appending
- // to impl.identifier, we wish it to contain the zero-length string.
- return;
- }
- if (impl.complexity == UMEASURE_UNIT_COMPOUND) {
- // Note: don't sort a MIXED unit
- uprv_sortArray(
- impl.units.getAlias(),
- impl.units.length(),
- sizeof(impl.units[0]),
- compareSingleUnits,
- nullptr,
- false,
- &status);
- if (U_FAILURE(status)) {
- return;
- }
- }
- serializeSingle(*impl.units[0], true, impl.identifier, status);
- if (impl.units.length() == 1) {
- return;
- }
- for (int32_t i = 1; i < impl.units.length(); i++) {
- const SingleUnitImpl& prev = *impl.units[i-1];
- const SingleUnitImpl& curr = *impl.units[i];
- if (impl.complexity == UMEASURE_UNIT_MIXED) {
- impl.identifier.append("-and-", status);
- serializeSingle(curr, true, impl.identifier, status);
- } else {
- if (prev.dimensionality > 0 && curr.dimensionality < 0) {
- impl.identifier.append("-per-", status);
- } else {
- impl.identifier.append('-', status);
- }
- serializeSingle(curr, false, impl.identifier, status);
- }
- }
-
-}
-
-/**
- * Appends a SingleUnitImpl to a MeasureUnitImpl.
- *
- * @return true if a new item was added. If unit is the dimensionless unit, it
- * is never added: the return value will always be false.
- */
-bool appendImpl(MeasureUnitImpl& impl, const SingleUnitImpl& unit, UErrorCode& status) {
- if (unit.isDimensionless()) {
- // We don't append dimensionless units.
- return false;
- }
- // Find a similar unit that already exists, to attempt to coalesce
- SingleUnitImpl* oldUnit = nullptr;
- for (int32_t i = 0; i < impl.units.length(); i++) {
- auto* candidate = impl.units[i];
- if (candidate->isCompatibleWith(unit)) {
- oldUnit = candidate;
- }
- }
- if (oldUnit) {
- // Both dimensionalities will be positive, or both will be negative, by
- // virtue of isCompatibleWith().
- oldUnit->dimensionality += unit.dimensionality;
- } else {
- SingleUnitImpl* destination = impl.units.emplaceBack();
- if (!destination) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- *destination = unit;
- }
- return (oldUnit == nullptr);
-}
-
-} // namespace
-
-
-SingleUnitImpl SingleUnitImpl::forMeasureUnit(const MeasureUnit& measureUnit, UErrorCode& status) {
- MeasureUnitImpl temp;
- const MeasureUnitImpl& impl = MeasureUnitImpl::forMeasureUnit(measureUnit, temp, status);
- if (U_FAILURE(status)) {
- return {};
- }
- if (impl.units.length() == 0) {
- return {};
- }
- if (impl.units.length() == 1) {
- return *impl.units[0];
- }
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return {};
-}
-
-MeasureUnit SingleUnitImpl::build(UErrorCode& status) const {
- MeasureUnitImpl temp;
- temp.append(*this, status);
- return std::move(temp).build(status);
-}
-
-
-MeasureUnitImpl MeasureUnitImpl::forIdentifier(StringPiece identifier, UErrorCode& status) {
- return Parser::from(identifier, status).parse(status);
-}
-
-const MeasureUnitImpl& MeasureUnitImpl::forMeasureUnit(
- const MeasureUnit& measureUnit, MeasureUnitImpl& memory, UErrorCode& status) {
- if (measureUnit.fImpl) {
- return *measureUnit.fImpl;
- } else {
- memory = Parser::from(measureUnit.getIdentifier(), status).parse(status);
- return memory;
- }
-}
-
-MeasureUnitImpl MeasureUnitImpl::forMeasureUnitMaybeCopy(
- const MeasureUnit& measureUnit, UErrorCode& status) {
- if (measureUnit.fImpl) {
- return measureUnit.fImpl->copy(status);
- } else {
- return Parser::from(measureUnit.getIdentifier(), status).parse(status);
- }
-}
-
-void MeasureUnitImpl::takeReciprocal(UErrorCode& /*status*/) {
- identifier.clear();
- for (int32_t i = 0; i < units.length(); i++) {
- units[i]->dimensionality *= -1;
- }
-}
-
-bool MeasureUnitImpl::append(const SingleUnitImpl& singleUnit, UErrorCode& status) {
- identifier.clear();
- return appendImpl(*this, singleUnit, status);
-}
-
-MeasureUnit MeasureUnitImpl::build(UErrorCode& status) && {
- serialize(*this, status);
- return MeasureUnit(std::move(*this));
-}
-
-
-MeasureUnit MeasureUnit::forIdentifier(StringPiece identifier, UErrorCode& status) {
- return Parser::from(identifier, status).parse(status).build(status);
-}
-
-UMeasureUnitComplexity MeasureUnit::getComplexity(UErrorCode& status) const {
- MeasureUnitImpl temp;
- return MeasureUnitImpl::forMeasureUnit(*this, temp, status).complexity;
-}
-
-UMeasureSIPrefix MeasureUnit::getSIPrefix(UErrorCode& status) const {
- return SingleUnitImpl::forMeasureUnit(*this, status).siPrefix;
-}
-
-MeasureUnit MeasureUnit::withSIPrefix(UMeasureSIPrefix prefix, UErrorCode& status) const {
- SingleUnitImpl singleUnit = SingleUnitImpl::forMeasureUnit(*this, status);
- singleUnit.siPrefix = prefix;
- return singleUnit.build(status);
-}
-
-int32_t MeasureUnit::getDimensionality(UErrorCode& status) const {
- SingleUnitImpl singleUnit = SingleUnitImpl::forMeasureUnit(*this, status);
- if (U_FAILURE(status)) { return 0; }
- if (singleUnit.isDimensionless()) {
- return 0;
- }
- return singleUnit.dimensionality;
-}
-
-MeasureUnit MeasureUnit::withDimensionality(int32_t dimensionality, UErrorCode& status) const {
- SingleUnitImpl singleUnit = SingleUnitImpl::forMeasureUnit(*this, status);
- singleUnit.dimensionality = dimensionality;
- return singleUnit.build(status);
-}
-
-MeasureUnit MeasureUnit::reciprocal(UErrorCode& status) const {
- MeasureUnitImpl impl = MeasureUnitImpl::forMeasureUnitMaybeCopy(*this, status);
- impl.takeReciprocal(status);
- return std::move(impl).build(status);
-}
-
-MeasureUnit MeasureUnit::product(const MeasureUnit& other, UErrorCode& status) const {
- MeasureUnitImpl impl = MeasureUnitImpl::forMeasureUnitMaybeCopy(*this, status);
- MeasureUnitImpl temp;
- const MeasureUnitImpl& otherImpl = MeasureUnitImpl::forMeasureUnit(other, temp, status);
- if (impl.complexity == UMEASURE_UNIT_MIXED || otherImpl.complexity == UMEASURE_UNIT_MIXED) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return {};
- }
- for (int32_t i = 0; i < otherImpl.units.length(); i++) {
- impl.append(*otherImpl.units[i], status);
- }
- if (impl.units.length() > 1) {
- impl.complexity = UMEASURE_UNIT_COMPOUND;
- }
- return std::move(impl).build(status);
-}
-
-LocalArray<MeasureUnit> MeasureUnit::splitToSingleUnits(int32_t& outCount, UErrorCode& status) const {
- MeasureUnitImpl temp;
- const MeasureUnitImpl& impl = MeasureUnitImpl::forMeasureUnit(*this, temp, status);
- outCount = impl.units.length();
- MeasureUnit* arr = new MeasureUnit[outCount];
- for (int32_t i = 0; i < outCount; i++) {
- arr[i] = impl.units[i]->build(status);
- }
- return LocalArray<MeasureUnit>(arr, status);
-}
-
-
-U_NAMESPACE_END
-
-#endif /* !UNCONFIG_NO_FORMATTING */
+// © 2020 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// Extra functions for MeasureUnit not needed for all clients.
+// Separate .o file so that it can be removed for modularity.
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include <cstdlib>
+#include "cstring.h"
+#include "measunit_impl.h"
+#include "uarrsort.h"
+#include "uassert.h"
+#include "ucln_in.h"
+#include "umutex.h"
+#include "unicode/errorcode.h"
+#include "unicode/localpointer.h"
+#include "unicode/measunit.h"
+#include "unicode/ucharstrie.h"
+#include "unicode/ucharstriebuilder.h"
+
+#include "cstr.h"
+
+U_NAMESPACE_BEGIN
+
+
+namespace {
+
+// TODO: Propose a new error code for this?
+constexpr UErrorCode kUnitIdentifierSyntaxError = U_ILLEGAL_ARGUMENT_ERROR;
+
+// Trie value offset for SI Prefixes. This is big enough to ensure we only
+// insert positive integers into the trie.
+constexpr int32_t kSIPrefixOffset = 64;
+
+// Trie value offset for compound parts, e.g. "-per-", "-", "-and-".
+constexpr int32_t kCompoundPartOffset = 128;
+
+enum CompoundPart {
+ // Represents "-per-"
+ COMPOUND_PART_PER = kCompoundPartOffset,
+ // Represents "-"
+ COMPOUND_PART_TIMES,
+ // Represents "-and-"
+ COMPOUND_PART_AND,
+};
+
+// Trie value offset for "per-".
+constexpr int32_t kInitialCompoundPartOffset = 192;
+
+enum InitialCompoundPart {
+ // Represents "per-", the only compound part that can appear at the start of
+ // an identifier.
+ INITIAL_COMPOUND_PART_PER = kInitialCompoundPartOffset,
+};
+
+// Trie value offset for powers like "square-", "cubic-", "p2-" etc.
+constexpr int32_t kPowerPartOffset = 256;
+
+enum PowerPart {
+ POWER_PART_P2 = kPowerPartOffset + 2,
+ POWER_PART_P3,
+ POWER_PART_P4,
+ POWER_PART_P5,
+ POWER_PART_P6,
+ POWER_PART_P7,
+ POWER_PART_P8,
+ POWER_PART_P9,
+ POWER_PART_P10,
+ POWER_PART_P11,
+ POWER_PART_P12,
+ POWER_PART_P13,
+ POWER_PART_P14,
+ POWER_PART_P15,
+};
+
+// Trie value offset for simple units, e.g. "gram", "nautical-mile",
+// "fluid-ounce-imperial".
+constexpr int32_t kSimpleUnitOffset = 512;
+
+const struct SIPrefixStrings {
+ const char* const string;
+ UMeasureSIPrefix value;
+} gSIPrefixStrings[] = {
+ { "yotta", UMEASURE_SI_PREFIX_YOTTA },
+ { "zetta", UMEASURE_SI_PREFIX_ZETTA },
+ { "exa", UMEASURE_SI_PREFIX_EXA },
+ { "peta", UMEASURE_SI_PREFIX_PETA },
+ { "tera", UMEASURE_SI_PREFIX_TERA },
+ { "giga", UMEASURE_SI_PREFIX_GIGA },
+ { "mega", UMEASURE_SI_PREFIX_MEGA },
+ { "kilo", UMEASURE_SI_PREFIX_KILO },
+ { "hecto", UMEASURE_SI_PREFIX_HECTO },
+ { "deka", UMEASURE_SI_PREFIX_DEKA },
+ { "deci", UMEASURE_SI_PREFIX_DECI },
+ { "centi", UMEASURE_SI_PREFIX_CENTI },
+ { "milli", UMEASURE_SI_PREFIX_MILLI },
+ { "micro", UMEASURE_SI_PREFIX_MICRO },
+ { "nano", UMEASURE_SI_PREFIX_NANO },
+ { "pico", UMEASURE_SI_PREFIX_PICO },
+ { "femto", UMEASURE_SI_PREFIX_FEMTO },
+ { "atto", UMEASURE_SI_PREFIX_ATTO },
+ { "zepto", UMEASURE_SI_PREFIX_ZEPTO },
+ { "yocto", UMEASURE_SI_PREFIX_YOCTO },
+};
+
+// TODO(ICU-21059): Get this list from data
+const char16_t* const gSimpleUnits[] = {
+ u"candela",
+ u"carat",
+ u"gram",
+ u"ounce",
+ u"ounce-troy",
+ u"pound",
+ u"kilogram",
+ u"stone",
+ u"ton",
+ u"metric-ton",
+ u"earth-mass",
+ u"solar-mass",
+ u"point",
+ u"inch",
+ u"foot",
+ u"yard",
+ u"meter",
+ u"fathom",
+ u"furlong",
+ u"mile",
+ u"nautical-mile",
+ u"mile-scandinavian",
+ u"100-kilometer",
+ u"earth-radius",
+ u"solar-radius",
+ u"astronomical-unit",
+ u"light-year",
+ u"parsec",
+ u"second",
+ u"minute",
+ u"hour",
+ u"day",
+ u"day-person",
+ u"week",
+ u"week-person",
+ u"month",
+ u"month-person",
+ u"year",
+ u"year-person",
+ u"decade",
+ u"century",
+ u"ampere",
+ u"fahrenheit",
+ u"kelvin",
+ u"celsius",
+ u"arc-second",
+ u"arc-minute",
+ u"degree",
+ u"radian",
+ u"revolution",
+ u"item",
+ u"mole",
+ u"permillion",
+ u"permyriad",
+ u"permille",
+ u"percent",
+ u"karat",
+ u"portion",
+ u"bit",
+ u"byte",
+ u"dot",
+ u"pixel",
+ u"em",
+ u"hertz",
+ u"newton",
+ u"pound-force",
+ u"pascal",
+ u"bar",
+ u"atmosphere",
+ u"ofhg",
+ u"electronvolt",
+ u"dalton",
+ u"joule",
+ u"calorie",
+ u"british-thermal-unit",
+ u"foodcalorie",
+ u"therm-us",
+ u"watt",
+ u"horsepower",
+ u"solar-luminosity",
+ u"volt",
+ u"ohm",
+ u"dunam",
+ u"acre",
+ u"hectare",
+ u"teaspoon",
+ u"tablespoon",
+ u"fluid-ounce-imperial",
+ u"fluid-ounce",
+ u"cup",
+ u"cup-metric",
+ u"pint",
+ u"pint-metric",
+ u"quart",
+ u"liter",
+ u"gallon",
+ u"gallon-imperial",
+ u"bushel",
+ u"barrel",
+ u"knot",
+ u"g-force",
+ u"lux",
+};
+
+icu::UInitOnce gUnitExtrasInitOnce = U_INITONCE_INITIALIZER;
+
+char16_t* kSerializedUnitExtrasStemTrie = nullptr;
+
+UBool U_CALLCONV cleanupUnitExtras() {
+ uprv_free(kSerializedUnitExtrasStemTrie);
+ kSerializedUnitExtrasStemTrie = nullptr;
+ gUnitExtrasInitOnce.reset();
+ return TRUE;
+}
+
+void U_CALLCONV initUnitExtras(UErrorCode& status) {
+ ucln_i18n_registerCleanup(UCLN_I18N_UNIT_EXTRAS, cleanupUnitExtras);
+
+ UCharsTrieBuilder b(status);
+ if (U_FAILURE(status)) { return; }
+
+ // Add SI prefixes
+ for (const auto& siPrefixInfo : gSIPrefixStrings) {
+ UnicodeString uSIPrefix(siPrefixInfo.string, -1, US_INV);
+ b.add(uSIPrefix, siPrefixInfo.value + kSIPrefixOffset, status);
+ }
+ if (U_FAILURE(status)) { return; }
+
+ // Add syntax parts (compound, power prefixes)
+ b.add(u"-per-", COMPOUND_PART_PER, status);
+ b.add(u"-", COMPOUND_PART_TIMES, status);
+ b.add(u"-and-", COMPOUND_PART_AND, status);
+ b.add(u"per-", INITIAL_COMPOUND_PART_PER, status);
+ b.add(u"square-", POWER_PART_P2, status);
+ b.add(u"cubic-", POWER_PART_P3, status);
+ b.add(u"p2-", POWER_PART_P2, status);
+ b.add(u"p3-", POWER_PART_P3, status);
+ b.add(u"p4-", POWER_PART_P4, status);
+ b.add(u"p5-", POWER_PART_P5, status);
+ b.add(u"p6-", POWER_PART_P6, status);
+ b.add(u"p7-", POWER_PART_P7, status);
+ b.add(u"p8-", POWER_PART_P8, status);
+ b.add(u"p9-", POWER_PART_P9, status);
+ b.add(u"p10-", POWER_PART_P10, status);
+ b.add(u"p11-", POWER_PART_P11, status);
+ b.add(u"p12-", POWER_PART_P12, status);
+ b.add(u"p13-", POWER_PART_P13, status);
+ b.add(u"p14-", POWER_PART_P14, status);
+ b.add(u"p15-", POWER_PART_P15, status);
+ if (U_FAILURE(status)) { return; }
+
+ // Add sanctioned simple units by offset
+ int32_t simpleUnitOffset = kSimpleUnitOffset;
+ for (auto simpleUnit : gSimpleUnits) {
+ b.add(simpleUnit, simpleUnitOffset++, status);
+ }
+
+ // Build the CharsTrie
+ // TODO: Use SLOW or FAST here?
+ UnicodeString result;
+ b.buildUnicodeString(USTRINGTRIE_BUILD_FAST, result, status);
+ if (U_FAILURE(status)) { return; }
+
+ // Copy the result into the global constant pointer
+ size_t numBytes = result.length() * sizeof(char16_t);
+ kSerializedUnitExtrasStemTrie = static_cast<char16_t*>(uprv_malloc(numBytes));
+ uprv_memcpy(kSerializedUnitExtrasStemTrie, result.getBuffer(), numBytes);
+}
+
+class Token {
+public:
+ Token(int32_t match) : fMatch(match) {}
+
+ enum Type {
+ TYPE_UNDEFINED,
+ TYPE_SI_PREFIX,
+ // Token type for "-per-", "-", and "-and-".
+ TYPE_COMPOUND_PART,
+ // Token type for "per-".
+ TYPE_INITIAL_COMPOUND_PART,
+ TYPE_POWER_PART,
+ TYPE_SIMPLE_UNIT,
+ };
+
+ // Calling getType() is invalid, resulting in an assertion failure, if Token
+ // value isn't positive.
+ Type getType() const {
+ U_ASSERT(fMatch > 0);
+ if (fMatch < kCompoundPartOffset) {
+ return TYPE_SI_PREFIX;
+ }
+ if (fMatch < kInitialCompoundPartOffset) {
+ return TYPE_COMPOUND_PART;
+ }
+ if (fMatch < kPowerPartOffset) {
+ return TYPE_INITIAL_COMPOUND_PART;
+ }
+ if (fMatch < kSimpleUnitOffset) {
+ return TYPE_POWER_PART;
+ }
+ return TYPE_SIMPLE_UNIT;
+ }
+
+ UMeasureSIPrefix getSIPrefix() const {
+ U_ASSERT(getType() == TYPE_SI_PREFIX);
+ return static_cast<UMeasureSIPrefix>(fMatch - kSIPrefixOffset);
+ }
+
+ // Valid only for tokens with type TYPE_COMPOUND_PART.
+ int32_t getMatch() const {
+ U_ASSERT(getType() == TYPE_COMPOUND_PART);
+ return fMatch;
+ }
+
+ int32_t getInitialCompoundPart() const {
+ // Even if there is only one InitialCompoundPart value, we have this
+ // function for the simplicity of code consistency.
+ U_ASSERT(getType() == TYPE_INITIAL_COMPOUND_PART);
+ // Defensive: if this assert fails, code using this function also needs
+ // to change.
+ U_ASSERT(fMatch == INITIAL_COMPOUND_PART_PER);
+ return fMatch;
+ }
+
+ int8_t getPower() const {
+ U_ASSERT(getType() == TYPE_POWER_PART);
+ return static_cast<int8_t>(fMatch - kPowerPartOffset);
+ }
+
+ int32_t getSimpleUnitIndex() const {
+ U_ASSERT(getType() == TYPE_SIMPLE_UNIT);
+ return fMatch - kSimpleUnitOffset;
+ }
+
+private:
+ int32_t fMatch;
+};
+
+class Parser {
+public:
+ /**
+ * Factory function for parsing the given identifier.
+ *
+ * @param source The identifier to parse. This function does not make a copy
+ * of source: the underlying string that source points at, must outlive the
+ * parser.
+ * @param status ICU error code.
+ */
+ static Parser from(StringPiece source, UErrorCode& status) {
+ if (U_FAILURE(status)) {
+ return Parser();
+ }
+ umtx_initOnce(gUnitExtrasInitOnce, &initUnitExtras, status);
+ if (U_FAILURE(status)) {
+ return Parser();
+ }
+ return Parser(source);
+ }
+
+ MeasureUnitImpl parse(UErrorCode& status) {
+ MeasureUnitImpl result;
+ parseImpl(result, status);
+ return result;
+ }
+
+private:
+ // Tracks parser progress: the offset into fSource.
+ int32_t fIndex = 0;
+
+ // Since we're not owning this memory, whatever is passed to the constructor
+ // should live longer than this Parser - and the parser shouldn't return any
+ // references to that string.
+ StringPiece fSource;
+ UCharsTrie fTrie;
+
+ // Set to true when we've seen a "-per-" or a "per-", after which all units
+ // are in the denominator. Until we find an "-and-", at which point the
+ // identifier is invalid pending TODO(CLDR-13700).
+ bool fAfterPer = false;
+
+ Parser() : fSource(""), fTrie(u"") {}
+
+ Parser(StringPiece source)
+ : fSource(source), fTrie(kSerializedUnitExtrasStemTrie) {}
+
+ inline bool hasNext() const {
+ return fIndex < fSource.length();
+ }
+
+ // Returns the next Token parsed from fSource, advancing fIndex to the end
+ // of that token in fSource. In case of U_FAILURE(status), the token
+ // returned will cause an abort if getType() is called on it.
+ Token nextToken(UErrorCode& status) {
+ fTrie.reset();
+ int32_t match = -1;
+ // Saves the position in the fSource string for the end of the most
+ // recent matching token.
+ int32_t previ = -1;
+ // Find the longest token that matches a value in the trie:
+ while (fIndex < fSource.length()) {
+ auto result = fTrie.next(fSource.data()[fIndex++]);
+ if (result == USTRINGTRIE_NO_MATCH) {
+ break;
+ } else if (result == USTRINGTRIE_NO_VALUE) {
+ continue;
+ }
+ U_ASSERT(USTRINGTRIE_HAS_VALUE(result));
+ match = fTrie.getValue();
+ previ = fIndex;
+ if (result == USTRINGTRIE_FINAL_VALUE) {
+ break;
+ }
+ U_ASSERT(result == USTRINGTRIE_INTERMEDIATE_VALUE);
+ // continue;
+ }
+
+ if (match < 0) {
+ status = kUnitIdentifierSyntaxError;
+ } else {
+ fIndex = previ;
+ }
+ return Token(match);
+ }
+
+ /**
+ * Returns the next "single unit" via result.
+ *
+ * If a "-per-" was parsed, the result will have appropriate negative
+ * dimensionality.
+ *
+ * Returns an error if we parse both compound units and "-and-", since mixed
+ * compound units are not yet supported - TODO(CLDR-13700).
+ *
+ * @param result Will be overwritten by the result, if status shows success.
+ * @param sawAnd If an "-and-" was parsed prior to finding the "single
+ * unit", sawAnd is set to true. If not, it is left as is.
+ * @param status ICU error code.
+ */
+ void nextSingleUnit(SingleUnitImpl& result, bool& sawAnd, UErrorCode& status) {
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ // state:
+ // 0 = no tokens seen yet (will accept power, SI prefix, or simple unit)
+ // 1 = power token seen (will not accept another power token)
+ // 2 = SI prefix token seen (will not accept a power or SI prefix token)
+ int32_t state = 0;
+
+ bool atStart = fIndex == 0;
+ Token token = nextToken(status);
+ if (U_FAILURE(status)) { return; }
+
+ if (atStart) {
+ // Identifiers optionally start with "per-".
+ if (token.getType() == Token::TYPE_INITIAL_COMPOUND_PART) {
+ U_ASSERT(token.getInitialCompoundPart() == INITIAL_COMPOUND_PART_PER);
+ fAfterPer = true;
+ result.dimensionality = -1;
+
+ token = nextToken(status);
+ if (U_FAILURE(status)) { return; }
+ }
+ } else {
+ // All other SingleUnit's are separated from previous SingleUnit's
+ // via a compound part:
+ if (token.getType() != Token::TYPE_COMPOUND_PART) {
+ status = kUnitIdentifierSyntaxError;
+ return;
+ }
+
+ switch (token.getMatch()) {
+ case COMPOUND_PART_PER:
+ if (sawAnd) {
+ // Mixed compound units not yet supported,
+ // TODO(CLDR-13700).
+ status = kUnitIdentifierSyntaxError;
+ return;
+ }
+ fAfterPer = true;
+ result.dimensionality = -1;
+ break;
+
+ case COMPOUND_PART_TIMES:
+ if (fAfterPer) {
+ result.dimensionality = -1;
+ }
+ break;
+
+ case COMPOUND_PART_AND:
+ if (fAfterPer) {
+ // Can't start with "-and-", and mixed compound units
+ // not yet supported, TODO(CLDR-13700).
+ status = kUnitIdentifierSyntaxError;
+ return;
+ }
+ sawAnd = true;
+ break;
+ }
+
+ token = nextToken(status);
+ if (U_FAILURE(status)) { return; }
+ }
+
+ // Read tokens until we have a complete SingleUnit or we reach the end.
+ while (true) {
+ switch (token.getType()) {
+ case Token::TYPE_POWER_PART:
+ if (state > 0) {
+ status = kUnitIdentifierSyntaxError;
+ return;
+ }
+ result.dimensionality *= token.getPower();
+ state = 1;
+ break;
+
+ case Token::TYPE_SI_PREFIX:
+ if (state > 1) {
+ status = kUnitIdentifierSyntaxError;
+ return;
+ }
+ result.siPrefix = token.getSIPrefix();
+ state = 2;
+ break;
+
+ case Token::TYPE_SIMPLE_UNIT:
+ result.index = token.getSimpleUnitIndex();
+ return;
+
+ default:
+ status = kUnitIdentifierSyntaxError;
+ return;
+ }
+
+ if (!hasNext()) {
+ // We ran out of tokens before finding a complete single unit.
+ status = kUnitIdentifierSyntaxError;
+ return;
+ }
+ token = nextToken(status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ }
+ }
+
+ /// @param result is modified, not overridden. Caller must pass in a
+ /// default-constructed (empty) MeasureUnitImpl instance.
+ void parseImpl(MeasureUnitImpl& result, UErrorCode& status) {
+ if (U_FAILURE(status)) {
+ return;
+ }
+ if (fSource.empty()) {
+ // The dimenionless unit: nothing to parse. leave result as is.
+ return;
+ }
+ int32_t unitNum = 0;
+ while (hasNext()) {
+ bool sawAnd = false;
+ SingleUnitImpl singleUnit;
+ nextSingleUnit(singleUnit, sawAnd, status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ U_ASSERT(!singleUnit.isDimensionless());
+ bool added = result.append(singleUnit, status);
+ if (sawAnd && !added) {
+ // Two similar units are not allowed in a mixed unit
+ status = kUnitIdentifierSyntaxError;
+ return;
+ }
+ if ((++unitNum) >= 2) {
+ // nextSingleUnit fails appropriately for "per" and "and" in the
+ // same identifier. It doesn't fail for other compound units
+ // (COMPOUND_PART_TIMES). Consequently we take care of that
+ // here.
+ UMeasureUnitComplexity complexity =
+ sawAnd ? UMEASURE_UNIT_MIXED : UMEASURE_UNIT_COMPOUND;
+ if (unitNum == 2) {
+ U_ASSERT(result.complexity == UMEASURE_UNIT_SINGLE);
+ result.complexity = complexity;
+ } else if (result.complexity != complexity) {
+ // Can't have mixed compound units
+ status = kUnitIdentifierSyntaxError;
+ return;
+ }
+ }
+ }
+ }
+};
+
+int32_t U_CALLCONV
+compareSingleUnits(const void* /*context*/, const void* left, const void* right) {
+ auto realLeft = static_cast<const SingleUnitImpl* const*>(left);
+ auto realRight = static_cast<const SingleUnitImpl* const*>(right);
+ return (*realLeft)->compareTo(**realRight);
+}
+
+/**
+ * Generate the identifier string for a single unit in place.
+ *
+ * Does not support the dimensionless SingleUnitImpl: calling serializeSingle
+ * with the dimensionless unit results in an U_INTERNAL_PROGRAM_ERROR.
+ *
+ * @param first If singleUnit is part of a compound unit, and not its first
+ * single unit, set this to false. Otherwise: set to true.
+ */
+void serializeSingle(const SingleUnitImpl& singleUnit, bool first, CharString& output, UErrorCode& status) {
+ if (first && singleUnit.dimensionality < 0) {
+ // Essentially the "unary per". For compound units with a numerator, the
+ // caller takes care of the "binary per".
+ output.append("per-", status);
+ }
+
+ if (singleUnit.isDimensionless()) {
+ status = U_INTERNAL_PROGRAM_ERROR;
+ return;
+ }
+ int8_t posPower = std::abs(singleUnit.dimensionality);
+ if (posPower == 0) {
+ status = U_INTERNAL_PROGRAM_ERROR;
+ } else if (posPower == 1) {
+ // no-op
+ } else if (posPower == 2) {
+ output.append("square-", status);
+ } else if (posPower == 3) {
+ output.append("cubic-", status);
+ } else if (posPower < 10) {
+ output.append('p', status);
+ output.append(posPower + '0', status);
+ output.append('-', status);
+ } else if (posPower <= 15) {
+ output.append("p1", status);
+ output.append('0' + (posPower % 10), status);
+ output.append('-', status);
+ } else {
+ status = kUnitIdentifierSyntaxError;
+ }
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ if (singleUnit.siPrefix != UMEASURE_SI_PREFIX_ONE) {
+ for (const auto& siPrefixInfo : gSIPrefixStrings) {
+ if (siPrefixInfo.value == singleUnit.siPrefix) {
+ output.append(siPrefixInfo.string, status);
+ break;
+ }
+ }
+ }
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ output.appendInvariantChars(gSimpleUnits[singleUnit.index], status);
+}
+
+/**
+ * Normalize a MeasureUnitImpl and generate the identifier string in place.
+ */
+void serialize(MeasureUnitImpl& impl, UErrorCode& status) {
+ if (U_FAILURE(status)) {
+ return;
+ }
+ U_ASSERT(impl.identifier.isEmpty());
+ if (impl.units.length() == 0) {
+ // Dimensionless, constructed by the default constructor: no appending
+ // to impl.identifier, we wish it to contain the zero-length string.
+ return;
+ }
+ if (impl.complexity == UMEASURE_UNIT_COMPOUND) {
+ // Note: don't sort a MIXED unit
+ uprv_sortArray(
+ impl.units.getAlias(),
+ impl.units.length(),
+ sizeof(impl.units[0]),
+ compareSingleUnits,
+ nullptr,
+ false,
+ &status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ }
+ serializeSingle(*impl.units[0], true, impl.identifier, status);
+ if (impl.units.length() == 1) {
+ return;
+ }
+ for (int32_t i = 1; i < impl.units.length(); i++) {
+ const SingleUnitImpl& prev = *impl.units[i-1];
+ const SingleUnitImpl& curr = *impl.units[i];
+ if (impl.complexity == UMEASURE_UNIT_MIXED) {
+ impl.identifier.append("-and-", status);
+ serializeSingle(curr, true, impl.identifier, status);
+ } else {
+ if (prev.dimensionality > 0 && curr.dimensionality < 0) {
+ impl.identifier.append("-per-", status);
+ } else {
+ impl.identifier.append('-', status);
+ }
+ serializeSingle(curr, false, impl.identifier, status);
+ }
+ }
+
+}
+
+/**
+ * Appends a SingleUnitImpl to a MeasureUnitImpl.
+ *
+ * @return true if a new item was added. If unit is the dimensionless unit, it
+ * is never added: the return value will always be false.
+ */
+bool appendImpl(MeasureUnitImpl& impl, const SingleUnitImpl& unit, UErrorCode& status) {
+ if (unit.isDimensionless()) {
+ // We don't append dimensionless units.
+ return false;
+ }
+ // Find a similar unit that already exists, to attempt to coalesce
+ SingleUnitImpl* oldUnit = nullptr;
+ for (int32_t i = 0; i < impl.units.length(); i++) {
+ auto* candidate = impl.units[i];
+ if (candidate->isCompatibleWith(unit)) {
+ oldUnit = candidate;
+ }
+ }
+ if (oldUnit) {
+ // Both dimensionalities will be positive, or both will be negative, by
+ // virtue of isCompatibleWith().
+ oldUnit->dimensionality += unit.dimensionality;
+ } else {
+ SingleUnitImpl* destination = impl.units.emplaceBack();
+ if (!destination) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ *destination = unit;
+ }
+ return (oldUnit == nullptr);
+}
+
+} // namespace
+
+
+SingleUnitImpl SingleUnitImpl::forMeasureUnit(const MeasureUnit& measureUnit, UErrorCode& status) {
+ MeasureUnitImpl temp;
+ const MeasureUnitImpl& impl = MeasureUnitImpl::forMeasureUnit(measureUnit, temp, status);
+ if (U_FAILURE(status)) {
+ return {};
+ }
+ if (impl.units.length() == 0) {
+ return {};
+ }
+ if (impl.units.length() == 1) {
+ return *impl.units[0];
+ }
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return {};
+}
+
+MeasureUnit SingleUnitImpl::build(UErrorCode& status) const {
+ MeasureUnitImpl temp;
+ temp.append(*this, status);
+ return std::move(temp).build(status);
+}
+
+
+MeasureUnitImpl MeasureUnitImpl::forIdentifier(StringPiece identifier, UErrorCode& status) {
+ return Parser::from(identifier, status).parse(status);
+}
+
+const MeasureUnitImpl& MeasureUnitImpl::forMeasureUnit(
+ const MeasureUnit& measureUnit, MeasureUnitImpl& memory, UErrorCode& status) {
+ if (measureUnit.fImpl) {
+ return *measureUnit.fImpl;
+ } else {
+ memory = Parser::from(measureUnit.getIdentifier(), status).parse(status);
+ return memory;
+ }
+}
+
+MeasureUnitImpl MeasureUnitImpl::forMeasureUnitMaybeCopy(
+ const MeasureUnit& measureUnit, UErrorCode& status) {
+ if (measureUnit.fImpl) {
+ return measureUnit.fImpl->copy(status);
+ } else {
+ return Parser::from(measureUnit.getIdentifier(), status).parse(status);
+ }
+}
+
+void MeasureUnitImpl::takeReciprocal(UErrorCode& /*status*/) {
+ identifier.clear();
+ for (int32_t i = 0; i < units.length(); i++) {
+ units[i]->dimensionality *= -1;
+ }
+}
+
+bool MeasureUnitImpl::append(const SingleUnitImpl& singleUnit, UErrorCode& status) {
+ identifier.clear();
+ return appendImpl(*this, singleUnit, status);
+}
+
+MeasureUnit MeasureUnitImpl::build(UErrorCode& status) && {
+ serialize(*this, status);
+ return MeasureUnit(std::move(*this));
+}
+
+
+MeasureUnit MeasureUnit::forIdentifier(StringPiece identifier, UErrorCode& status) {
+ return Parser::from(identifier, status).parse(status).build(status);
+}
+
+UMeasureUnitComplexity MeasureUnit::getComplexity(UErrorCode& status) const {
+ MeasureUnitImpl temp;
+ return MeasureUnitImpl::forMeasureUnit(*this, temp, status).complexity;
+}
+
+UMeasureSIPrefix MeasureUnit::getSIPrefix(UErrorCode& status) const {
+ return SingleUnitImpl::forMeasureUnit(*this, status).siPrefix;
+}
+
+MeasureUnit MeasureUnit::withSIPrefix(UMeasureSIPrefix prefix, UErrorCode& status) const {
+ SingleUnitImpl singleUnit = SingleUnitImpl::forMeasureUnit(*this, status);
+ singleUnit.siPrefix = prefix;
+ return singleUnit.build(status);
+}
+
+int32_t MeasureUnit::getDimensionality(UErrorCode& status) const {
+ SingleUnitImpl singleUnit = SingleUnitImpl::forMeasureUnit(*this, status);
+ if (U_FAILURE(status)) { return 0; }
+ if (singleUnit.isDimensionless()) {
+ return 0;
+ }
+ return singleUnit.dimensionality;
+}
+
+MeasureUnit MeasureUnit::withDimensionality(int32_t dimensionality, UErrorCode& status) const {
+ SingleUnitImpl singleUnit = SingleUnitImpl::forMeasureUnit(*this, status);
+ singleUnit.dimensionality = dimensionality;
+ return singleUnit.build(status);
+}
+
+MeasureUnit MeasureUnit::reciprocal(UErrorCode& status) const {
+ MeasureUnitImpl impl = MeasureUnitImpl::forMeasureUnitMaybeCopy(*this, status);
+ impl.takeReciprocal(status);
+ return std::move(impl).build(status);
+}
+
+MeasureUnit MeasureUnit::product(const MeasureUnit& other, UErrorCode& status) const {
+ MeasureUnitImpl impl = MeasureUnitImpl::forMeasureUnitMaybeCopy(*this, status);
+ MeasureUnitImpl temp;
+ const MeasureUnitImpl& otherImpl = MeasureUnitImpl::forMeasureUnit(other, temp, status);
+ if (impl.complexity == UMEASURE_UNIT_MIXED || otherImpl.complexity == UMEASURE_UNIT_MIXED) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return {};
+ }
+ for (int32_t i = 0; i < otherImpl.units.length(); i++) {
+ impl.append(*otherImpl.units[i], status);
+ }
+ if (impl.units.length() > 1) {
+ impl.complexity = UMEASURE_UNIT_COMPOUND;
+ }
+ return std::move(impl).build(status);
+}
+
+LocalArray<MeasureUnit> MeasureUnit::splitToSingleUnits(int32_t& outCount, UErrorCode& status) const {
+ MeasureUnitImpl temp;
+ const MeasureUnitImpl& impl = MeasureUnitImpl::forMeasureUnit(*this, temp, status);
+ outCount = impl.units.length();
+ MeasureUnit* arr = new MeasureUnit[outCount];
+ for (int32_t i = 0; i < outCount; i++) {
+ arr[i] = impl.units[i]->build(status);
+ }
+ return LocalArray<MeasureUnit>(arr, status);
+}
+
+
+U_NAMESPACE_END
+
+#endif /* !UNCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/measunit_impl.h b/contrib/libs/icu/i18n/measunit_impl.h
index 6aa33d740b..c69d243b3b 100644
--- a/contrib/libs/icu/i18n/measunit_impl.h
+++ b/contrib/libs/icu/i18n/measunit_impl.h
@@ -1,213 +1,213 @@
-// © 2020 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#ifndef __MEASUNIT_IMPL_H__
-#define __MEASUNIT_IMPL_H__
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/measunit.h"
-#include "cmemory.h"
-#include "charstr.h"
-
-U_NAMESPACE_BEGIN
-
-
-static const char16_t kDefaultCurrency[] = u"XXX";
-static const char kDefaultCurrency8[] = "XXX";
-
-
-/**
- * A struct representing a single unit (optional SI prefix and dimensionality).
- */
-struct SingleUnitImpl : public UMemory {
- /**
- * Gets a single unit from the MeasureUnit. If there are multiple single units, sets an error
- * code and returns the base dimensionless unit. Parses if necessary.
- */
- static SingleUnitImpl forMeasureUnit(const MeasureUnit& measureUnit, UErrorCode& status);
-
- /** Transform this SingleUnitImpl into a MeasureUnit, simplifying if possible. */
- MeasureUnit build(UErrorCode& status) const;
-
- /**
- * Compare this SingleUnitImpl to another SingleUnitImpl for the sake of
- * sorting and coalescing.
+// © 2020 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#ifndef __MEASUNIT_IMPL_H__
+#define __MEASUNIT_IMPL_H__
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/measunit.h"
+#include "cmemory.h"
+#include "charstr.h"
+
+U_NAMESPACE_BEGIN
+
+
+static const char16_t kDefaultCurrency[] = u"XXX";
+static const char kDefaultCurrency8[] = "XXX";
+
+
+/**
+ * A struct representing a single unit (optional SI prefix and dimensionality).
+ */
+struct SingleUnitImpl : public UMemory {
+ /**
+ * Gets a single unit from the MeasureUnit. If there are multiple single units, sets an error
+ * code and returns the base dimensionless unit. Parses if necessary.
+ */
+ static SingleUnitImpl forMeasureUnit(const MeasureUnit& measureUnit, UErrorCode& status);
+
+ /** Transform this SingleUnitImpl into a MeasureUnit, simplifying if possible. */
+ MeasureUnit build(UErrorCode& status) const;
+
+ /**
+ * Compare this SingleUnitImpl to another SingleUnitImpl for the sake of
+ * sorting and coalescing.
+ *
+ * Takes the sign of dimensionality into account, but not the absolute
+ * value: per-meter is not considered the same as meter, but meter is
+ * considered the same as square-meter.
+ *
+ * The dimensionless unit generally does not get compared, but if it did, it
+ * would sort before other units by virtue of index being < 0 and
+ * dimensionality not being negative.
+ */
+ int32_t compareTo(const SingleUnitImpl& other) const {
+ if (dimensionality < 0 && other.dimensionality > 0) {
+ // Positive dimensions first
+ return 1;
+ }
+ if (dimensionality > 0 && other.dimensionality < 0) {
+ return -1;
+ }
+ if (index < other.index) {
+ return -1;
+ }
+ if (index > other.index) {
+ return 1;
+ }
+ if (siPrefix < other.siPrefix) {
+ return -1;
+ }
+ if (siPrefix > other.siPrefix) {
+ return 1;
+ }
+ return 0;
+ }
+
+ /**
+ * Return whether this SingleUnitImpl is compatible with another for the purpose of coalescing.
+ *
+ * Units with the same base unit and SI prefix should match, except that they must also have
+ * the same dimensionality sign, such that we don't merge numerator and denominator.
+ */
+ bool isCompatibleWith(const SingleUnitImpl& other) const {
+ return (compareTo(other) == 0);
+ }
+
+ /**
+ * Returns true if this unit is the "dimensionless base unit", as produced
+ * by the MeasureUnit() default constructor. (This does not include the
+ * likes of concentrations or angles.)
+ */
+ bool isDimensionless() const {
+ return index == -1;
+ }
+
+ /**
+ * Simple unit index, unique for every simple unit, -1 for the dimensionless
+ * unit. This is an index into a string list in measunit_extra.cpp.
+ *
+ * The default value is -1, meaning the dimensionless unit:
+ * isDimensionless() will return true, until index is changed.
+ */
+ int32_t index = -1;
+
+ /**
+ * SI prefix.
+ *
+ * This is ignored for the dimensionless unit.
+ */
+ UMeasureSIPrefix siPrefix = UMEASURE_SI_PREFIX_ONE;
+
+ /**
+ * Dimensionality.
+ *
+ * This is meaningless for the dimensionless unit.
+ */
+ int32_t dimensionality = 1;
+};
+
+
+/**
+ * Internal representation of measurement units. Capable of representing all complexities of units,
+ * including mixed and compound units.
+ */
+struct MeasureUnitImpl : public UMemory {
+ /** Extract the MeasureUnitImpl from a MeasureUnit. */
+ static inline const MeasureUnitImpl* get(const MeasureUnit& measureUnit) {
+ return measureUnit.fImpl;
+ }
+
+ /**
+ * Parse a unit identifier into a MeasureUnitImpl.
+ *
+ * @param identifier The unit identifier string.
+ * @param status Set if the identifier string is not valid.
+ * @return A newly parsed value object. Behaviour of this unit is
+ * unspecified if an error is returned via status.
+ */
+ static MeasureUnitImpl forIdentifier(StringPiece identifier, UErrorCode& status);
+
+ /**
+ * Extract the MeasureUnitImpl from a MeasureUnit, or parse if it is not present.
*
- * Takes the sign of dimensionality into account, but not the absolute
- * value: per-meter is not considered the same as meter, but meter is
- * considered the same as square-meter.
- *
- * The dimensionless unit generally does not get compared, but if it did, it
- * would sort before other units by virtue of index being < 0 and
- * dimensionality not being negative.
- */
- int32_t compareTo(const SingleUnitImpl& other) const {
- if (dimensionality < 0 && other.dimensionality > 0) {
- // Positive dimensions first
- return 1;
- }
- if (dimensionality > 0 && other.dimensionality < 0) {
- return -1;
- }
- if (index < other.index) {
- return -1;
- }
- if (index > other.index) {
- return 1;
- }
- if (siPrefix < other.siPrefix) {
- return -1;
- }
- if (siPrefix > other.siPrefix) {
- return 1;
- }
- return 0;
- }
-
- /**
- * Return whether this SingleUnitImpl is compatible with another for the purpose of coalescing.
- *
- * Units with the same base unit and SI prefix should match, except that they must also have
- * the same dimensionality sign, such that we don't merge numerator and denominator.
- */
- bool isCompatibleWith(const SingleUnitImpl& other) const {
- return (compareTo(other) == 0);
- }
-
- /**
- * Returns true if this unit is the "dimensionless base unit", as produced
- * by the MeasureUnit() default constructor. (This does not include the
- * likes of concentrations or angles.)
- */
- bool isDimensionless() const {
- return index == -1;
- }
-
- /**
- * Simple unit index, unique for every simple unit, -1 for the dimensionless
- * unit. This is an index into a string list in measunit_extra.cpp.
- *
- * The default value is -1, meaning the dimensionless unit:
- * isDimensionless() will return true, until index is changed.
- */
- int32_t index = -1;
-
- /**
- * SI prefix.
- *
- * This is ignored for the dimensionless unit.
- */
- UMeasureSIPrefix siPrefix = UMEASURE_SI_PREFIX_ONE;
-
- /**
- * Dimensionality.
- *
- * This is meaningless for the dimensionless unit.
- */
- int32_t dimensionality = 1;
-};
-
-
-/**
- * Internal representation of measurement units. Capable of representing all complexities of units,
- * including mixed and compound units.
- */
-struct MeasureUnitImpl : public UMemory {
- /** Extract the MeasureUnitImpl from a MeasureUnit. */
- static inline const MeasureUnitImpl* get(const MeasureUnit& measureUnit) {
- return measureUnit.fImpl;
- }
-
- /**
- * Parse a unit identifier into a MeasureUnitImpl.
- *
- * @param identifier The unit identifier string.
- * @param status Set if the identifier string is not valid.
- * @return A newly parsed value object. Behaviour of this unit is
- * unspecified if an error is returned via status.
- */
- static MeasureUnitImpl forIdentifier(StringPiece identifier, UErrorCode& status);
-
- /**
- * Extract the MeasureUnitImpl from a MeasureUnit, or parse if it is not present.
- *
- * @param measureUnit The source MeasureUnit.
- * @param memory A place to write the new MeasureUnitImpl if parsing is required.
- * @param status Set if an error occurs.
- * @return A reference to either measureUnit.fImpl or memory.
- */
- static const MeasureUnitImpl& forMeasureUnit(
- const MeasureUnit& measureUnit, MeasureUnitImpl& memory, UErrorCode& status);
-
- /**
- * Extract the MeasureUnitImpl from a MeasureUnit, or parse if it is not present.
- *
- * @param measureUnit The source MeasureUnit.
- * @param status Set if an error occurs.
- * @return A value object, either newly parsed or copied from measureUnit.
- */
- static MeasureUnitImpl forMeasureUnitMaybeCopy(
- const MeasureUnit& measureUnit, UErrorCode& status);
-
- /**
- * Used for currency units.
- */
- static inline MeasureUnitImpl forCurrencyCode(StringPiece currencyCode) {
- MeasureUnitImpl result;
- UErrorCode localStatus = U_ZERO_ERROR;
- result.identifier.append(currencyCode, localStatus);
- // localStatus is not expected to fail since currencyCode should be 3 chars long
- return result;
- }
-
- /** Transform this MeasureUnitImpl into a MeasureUnit, simplifying if possible. */
- MeasureUnit build(UErrorCode& status) &&;
-
- /**
- * Create a copy of this MeasureUnitImpl. Don't use copy constructor to make this explicit.
- */
- inline MeasureUnitImpl copy(UErrorCode& status) const {
- MeasureUnitImpl result;
- result.complexity = complexity;
- result.units.appendAll(units, status);
- result.identifier.append(identifier, status);
- return result;
- }
-
- /** Mutates this MeasureUnitImpl to take the reciprocal. */
- void takeReciprocal(UErrorCode& status);
-
- /**
- * Mutates this MeasureUnitImpl to append a single unit.
- *
- * @return true if a new item was added. If unit is the dimensionless unit,
- * it is never added: the return value will always be false.
- */
- bool append(const SingleUnitImpl& singleUnit, UErrorCode& status);
-
- /** The complexity, either SINGLE, COMPOUND, or MIXED. */
- UMeasureUnitComplexity complexity = UMEASURE_UNIT_SINGLE;
-
- /**
- * The list of simple units. These may be summed or multiplied, based on the
- * value of the complexity field.
- *
- * The "dimensionless" unit (SingleUnitImpl default constructor) must not be
- * added to this list.
- */
- MaybeStackVector<SingleUnitImpl> units;
-
- /**
- * The full unit identifier. Owned by the MeasureUnitImpl. Empty if not computed.
- */
- CharString identifier;
-};
-
-
-U_NAMESPACE_END
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif //__MEASUNIT_IMPL_H__
+ * @param measureUnit The source MeasureUnit.
+ * @param memory A place to write the new MeasureUnitImpl if parsing is required.
+ * @param status Set if an error occurs.
+ * @return A reference to either measureUnit.fImpl or memory.
+ */
+ static const MeasureUnitImpl& forMeasureUnit(
+ const MeasureUnit& measureUnit, MeasureUnitImpl& memory, UErrorCode& status);
+
+ /**
+ * Extract the MeasureUnitImpl from a MeasureUnit, or parse if it is not present.
+ *
+ * @param measureUnit The source MeasureUnit.
+ * @param status Set if an error occurs.
+ * @return A value object, either newly parsed or copied from measureUnit.
+ */
+ static MeasureUnitImpl forMeasureUnitMaybeCopy(
+ const MeasureUnit& measureUnit, UErrorCode& status);
+
+ /**
+ * Used for currency units.
+ */
+ static inline MeasureUnitImpl forCurrencyCode(StringPiece currencyCode) {
+ MeasureUnitImpl result;
+ UErrorCode localStatus = U_ZERO_ERROR;
+ result.identifier.append(currencyCode, localStatus);
+ // localStatus is not expected to fail since currencyCode should be 3 chars long
+ return result;
+ }
+
+ /** Transform this MeasureUnitImpl into a MeasureUnit, simplifying if possible. */
+ MeasureUnit build(UErrorCode& status) &&;
+
+ /**
+ * Create a copy of this MeasureUnitImpl. Don't use copy constructor to make this explicit.
+ */
+ inline MeasureUnitImpl copy(UErrorCode& status) const {
+ MeasureUnitImpl result;
+ result.complexity = complexity;
+ result.units.appendAll(units, status);
+ result.identifier.append(identifier, status);
+ return result;
+ }
+
+ /** Mutates this MeasureUnitImpl to take the reciprocal. */
+ void takeReciprocal(UErrorCode& status);
+
+ /**
+ * Mutates this MeasureUnitImpl to append a single unit.
+ *
+ * @return true if a new item was added. If unit is the dimensionless unit,
+ * it is never added: the return value will always be false.
+ */
+ bool append(const SingleUnitImpl& singleUnit, UErrorCode& status);
+
+ /** The complexity, either SINGLE, COMPOUND, or MIXED. */
+ UMeasureUnitComplexity complexity = UMEASURE_UNIT_SINGLE;
+
+ /**
+ * The list of simple units. These may be summed or multiplied, based on the
+ * value of the complexity field.
+ *
+ * The "dimensionless" unit (SingleUnitImpl default constructor) must not be
+ * added to this list.
+ */
+ MaybeStackVector<SingleUnitImpl> units;
+
+ /**
+ * The full unit identifier. Owned by the MeasureUnitImpl. Empty if not computed.
+ */
+ CharString identifier;
+};
+
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+#endif //__MEASUNIT_IMPL_H__
diff --git a/contrib/libs/icu/i18n/measure.cpp b/contrib/libs/icu/i18n/measure.cpp
index 53f585fe1b..bffa44215e 100644
--- a/contrib/libs/icu/i18n/measure.cpp
+++ b/contrib/libs/icu/i18n/measure.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -43,12 +43,12 @@ Measure& Measure::operator=(const Measure& other) {
if (this != &other) {
delete unit;
number = other.number;
- unit = other.unit->clone();
+ unit = other.unit->clone();
}
return *this;
}
-Measure *Measure::clone() const {
+Measure *Measure::clone() const {
return new Measure(*this);
}
diff --git a/contrib/libs/icu/i18n/msgfmt.cpp b/contrib/libs/icu/i18n/msgfmt.cpp
index b81006129f..3ca368ef95 100644
--- a/contrib/libs/icu/i18n/msgfmt.cpp
+++ b/contrib/libs/icu/i18n/msgfmt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************
* COPYRIGHT:
@@ -31,7 +31,7 @@
#include "unicode/decimfmt.h"
#include "unicode/localpointer.h"
#include "unicode/msgfmt.h"
-#include "unicode/numberformatter.h"
+#include "unicode/numberformatter.h"
#include "unicode/plurfmt.h"
#include "unicode/rbnf.h"
#include "unicode/selfmt.h"
@@ -49,7 +49,7 @@
#include "ustrfmt.h"
#include "util.h"
#include "uvector.h"
-#include "number_decimalquantity.h"
+#include "number_decimalquantity.h"
// *****************************************************************************
// class MessageFormat
@@ -436,7 +436,7 @@ MessageFormat::operator==(const Format& rhs) const
// -------------------------------------
// Creates a copy of this MessageFormat, the caller owns the copy.
-MessageFormat*
+MessageFormat*
MessageFormat::clone() const
{
return new MessageFormat(*this);
@@ -810,31 +810,31 @@ MessageFormat::getFormats(int32_t& cnt) const
// method on this object. We construct and resize an array
// on demand that contains aliases to the subformats[i].format
// pointers.
-
- // Get total required capacity first (it's refreshed on each call).
- int32_t totalCapacity = 0;
- for (int32_t partIndex = 0; (partIndex = nextTopLevelArgStart(partIndex)) >= 0; ++totalCapacity) {}
-
+
+ // Get total required capacity first (it's refreshed on each call).
+ int32_t totalCapacity = 0;
+ for (int32_t partIndex = 0; (partIndex = nextTopLevelArgStart(partIndex)) >= 0; ++totalCapacity) {}
+
MessageFormat* t = const_cast<MessageFormat*> (this);
cnt = 0;
- if (formatAliases == nullptr) {
- t->formatAliasesCapacity = totalCapacity;
+ if (formatAliases == nullptr) {
+ t->formatAliasesCapacity = totalCapacity;
Format** a = (Format**)
uprv_malloc(sizeof(Format*) * formatAliasesCapacity);
- if (a == nullptr) {
+ if (a == nullptr) {
t->formatAliasesCapacity = 0;
- return nullptr;
+ return nullptr;
}
t->formatAliases = a;
- } else if (totalCapacity > formatAliasesCapacity) {
+ } else if (totalCapacity > formatAliasesCapacity) {
Format** a = (Format**)
- uprv_realloc(formatAliases, sizeof(Format*) * totalCapacity);
- if (a == nullptr) {
+ uprv_realloc(formatAliases, sizeof(Format*) * totalCapacity);
+ if (a == nullptr) {
t->formatAliasesCapacity = 0;
- return nullptr;
+ return nullptr;
}
t->formatAliases = a;
- t->formatAliasesCapacity = totalCapacity;
+ t->formatAliasesCapacity = totalCapacity;
}
for (int32_t partIndex = 0; (partIndex = nextTopLevelArgStart(partIndex)) >= 0;) {
@@ -1083,7 +1083,7 @@ void MessageFormat::format(int32_t msgStart, const void *plNumber,
// that formats the number without subtracting the offset.
appendTo.formatAndAppend(pluralNumber.formatter, *arg, success);
}
- } else if ((formatter = getCachedFormatter(i -2)) != 0) {
+ } else if ((formatter = getCachedFormatter(i -2)) != 0) {
// Handles all ArgType.SIMPLE, and formatters from setFormat() and its siblings.
if (dynamic_cast<const ChoiceFormat*>(formatter) ||
dynamic_cast<const PluralFormat*>(formatter) ||
@@ -1687,7 +1687,7 @@ Format* MessageFormat::createAppropriateFormat(UnicodeString& type, UnicodeStrin
Format* fmt = NULL;
int32_t typeID, styleID;
DateFormat::EStyle date_style;
- int32_t firstNonSpace;
+ int32_t firstNonSpace;
switch (typeID = findKeyword(type, TYPE_IDS)) {
case 0: // number
@@ -1706,20 +1706,20 @@ Format* MessageFormat::createAppropriateFormat(UnicodeString& type, UnicodeStrin
formattableType = Formattable::kLong;
fmt = createIntegerFormat(fLocale, ec);
break;
- default: // pattern or skeleton
- firstNonSpace = PatternProps::skipWhiteSpace(style, 0);
- if (style.compare(firstNonSpace, 2, u"::", 0, 2) == 0) {
- // Skeleton
- UnicodeString skeleton = style.tempSubString(firstNonSpace + 2);
- fmt = number::NumberFormatter::forSkeleton(skeleton, ec).locale(fLocale).toFormat(ec);
- } else {
- // Pattern
- fmt = NumberFormat::createInstance(fLocale, ec);
- if (fmt) {
- auto* decfmt = dynamic_cast<DecimalFormat*>(fmt);
- if (decfmt != nullptr) {
- decfmt->applyPattern(style, parseError, ec);
- }
+ default: // pattern or skeleton
+ firstNonSpace = PatternProps::skipWhiteSpace(style, 0);
+ if (style.compare(firstNonSpace, 2, u"::", 0, 2) == 0) {
+ // Skeleton
+ UnicodeString skeleton = style.tempSubString(firstNonSpace + 2);
+ fmt = number::NumberFormatter::forSkeleton(skeleton, ec).locale(fLocale).toFormat(ec);
+ } else {
+ // Pattern
+ fmt = NumberFormat::createInstance(fLocale, ec);
+ if (fmt) {
+ auto* decfmt = dynamic_cast<DecimalFormat*>(fmt);
+ if (decfmt != nullptr) {
+ decfmt->applyPattern(style, parseError, ec);
+ }
}
}
break;
@@ -1729,28 +1729,28 @@ Format* MessageFormat::createAppropriateFormat(UnicodeString& type, UnicodeStrin
case 1: // date
case 2: // time
formattableType = Formattable::kDate;
- firstNonSpace = PatternProps::skipWhiteSpace(style, 0);
- if (style.compare(firstNonSpace, 2, u"::", 0, 2) == 0) {
- // Skeleton
- UnicodeString skeleton = style.tempSubString(firstNonSpace + 2);
- fmt = DateFormat::createInstanceForSkeleton(skeleton, fLocale, ec);
+ firstNonSpace = PatternProps::skipWhiteSpace(style, 0);
+ if (style.compare(firstNonSpace, 2, u"::", 0, 2) == 0) {
+ // Skeleton
+ UnicodeString skeleton = style.tempSubString(firstNonSpace + 2);
+ fmt = DateFormat::createInstanceForSkeleton(skeleton, fLocale, ec);
} else {
- // Pattern
- styleID = findKeyword(style, DATE_STYLE_IDS);
- date_style = (styleID >= 0) ? DATE_STYLES[styleID] : DateFormat::kDefault;
-
- if (typeID == 1) {
- fmt = DateFormat::createDateInstance(date_style, fLocale);
- } else {
- fmt = DateFormat::createTimeInstance(date_style, fLocale);
+ // Pattern
+ styleID = findKeyword(style, DATE_STYLE_IDS);
+ date_style = (styleID >= 0) ? DATE_STYLES[styleID] : DateFormat::kDefault;
+
+ if (typeID == 1) {
+ fmt = DateFormat::createDateInstance(date_style, fLocale);
+ } else {
+ fmt = DateFormat::createTimeInstance(date_style, fLocale);
+ }
+
+ if (styleID < 0 && fmt != NULL) {
+ SimpleDateFormat* sdtfmt = dynamic_cast<SimpleDateFormat*>(fmt);
+ if (sdtfmt != NULL) {
+ sdtfmt->applyPattern(style);
+ }
}
-
- if (styleID < 0 && fmt != NULL) {
- SimpleDateFormat* sdtfmt = dynamic_cast<SimpleDateFormat*>(fmt);
- if (sdtfmt != NULL) {
- sdtfmt->applyPattern(style);
- }
- }
}
break;
@@ -1873,7 +1873,7 @@ UBool MessageFormat::DummyFormat::operator==(const Format&) const {
return TRUE;
}
-MessageFormat::DummyFormat* MessageFormat::DummyFormat::clone() const {
+MessageFormat::DummyFormat* MessageFormat::DummyFormat::clone() const {
return new DummyFormat();
}
@@ -1976,19 +1976,19 @@ UnicodeString MessageFormat::PluralSelectorProvider::select(void *ctx, double nu
context.formatter = msgFormat.getDefaultNumberFormat(ec);
context.forReplaceNumber = TRUE;
}
- if (context.number.getDouble(ec) != number) {
- ec = U_INTERNAL_PROGRAM_ERROR;
- return UnicodeString(FALSE, OTHER_STRING, 5);
- }
+ if (context.number.getDouble(ec) != number) {
+ ec = U_INTERNAL_PROGRAM_ERROR;
+ return UnicodeString(FALSE, OTHER_STRING, 5);
+ }
context.formatter->format(context.number, context.numberString, ec);
- auto* decFmt = dynamic_cast<const DecimalFormat *>(context.formatter);
+ auto* decFmt = dynamic_cast<const DecimalFormat *>(context.formatter);
if(decFmt != NULL) {
- number::impl::DecimalQuantity dq;
- decFmt->formatToDecimalQuantity(context.number, dq, ec);
+ number::impl::DecimalQuantity dq;
+ decFmt->formatToDecimalQuantity(context.number, dq, ec);
if (U_FAILURE(ec)) {
return UnicodeString(FALSE, OTHER_STRING, 5);
}
- return rules->select(dq);
+ return rules->select(dq);
} else {
return rules->select(number);
}
diff --git a/contrib/libs/icu/i18n/msgfmt_impl.h b/contrib/libs/icu/i18n/msgfmt_impl.h
index d13112ea6a..1cece1a094 100644
--- a/contrib/libs/icu/i18n/msgfmt_impl.h
+++ b/contrib/libs/icu/i18n/msgfmt_impl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/name2uni.cpp b/contrib/libs/icu/i18n/name2uni.cpp
index 258de68181..dcf8d852e2 100644
--- a/contrib/libs/icu/i18n/name2uni.cpp
+++ b/contrib/libs/icu/i18n/name2uni.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -100,7 +100,7 @@ NameUnicodeTransliterator::NameUnicodeTransliterator(const NameUnicodeTransliter
/**
* Transliterator API.
*/
-NameUnicodeTransliterator* NameUnicodeTransliterator::clone() const {
+NameUnicodeTransliterator* NameUnicodeTransliterator::clone() const {
return new NameUnicodeTransliterator(*this);
}
@@ -190,7 +190,7 @@ void NameUnicodeTransliterator::handleTransliterate(Replaceable& text, UTransPos
}
if (uprv_isInvariantUString(name.getBuffer(), len)) {
- cbuf[0] = 0;
+ cbuf[0] = 0;
name.extract(0, len, cbuf, maxLen, US_INV);
UErrorCode status = U_ZERO_ERROR;
diff --git a/contrib/libs/icu/i18n/name2uni.h b/contrib/libs/icu/i18n/name2uni.h
index 7e279f99db..44ad85fb82 100644
--- a/contrib/libs/icu/i18n/name2uni.h
+++ b/contrib/libs/icu/i18n/name2uni.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -49,7 +49,7 @@ public:
* Transliterator API.
* @return A copy of the object.
*/
- virtual NameUnicodeTransliterator* clone() const;
+ virtual NameUnicodeTransliterator* clone() const;
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
diff --git a/contrib/libs/icu/i18n/nfrlist.h b/contrib/libs/icu/i18n/nfrlist.h
index 71f4972ac0..3eb1882b2f 100644
--- a/contrib/libs/icu/i18n/nfrlist.h
+++ b/contrib/libs/icu/i18n/nfrlist.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
******************************************************************************
* file name: nfrlist.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/i18n/nfrs.cpp b/contrib/libs/icu/i18n/nfrs.cpp
index 24754d201d..e7b17b46c3 100644
--- a/contrib/libs/icu/i18n/nfrs.cpp
+++ b/contrib/libs/icu/i18n/nfrs.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
******************************************************************************
* file name: nfrs.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -23,7 +23,7 @@
#include "nfrule.h"
#include "nfrlist.h"
#include "patternprops.h"
-#include "putilimp.h"
+#include "putilimp.h"
#ifdef RBNF_DEBUG
#include "cmemory.h"
@@ -545,7 +545,7 @@ NFRuleSet::findNormalRule(int64_t number) const
// an explanation of the rollback rule). If we do, roll back
// one rule and return that one instead of the one we'd normally
// return
- if (result->shouldRollBack(number)) {
+ if (result->shouldRollBack(number)) {
if (hi == 1) { // bad rule set, no prior rule to rollback to from this base
return NULL;
}
@@ -681,7 +681,7 @@ static void dumpUS(FILE* f, const UnicodeString& us) {
#endif
UBool
-NFRuleSet::parse(const UnicodeString& text, ParsePosition& pos, double upperBound, uint32_t nonNumericalExecutedRuleMask, Formattable& result) const
+NFRuleSet::parse(const UnicodeString& text, ParsePosition& pos, double upperBound, uint32_t nonNumericalExecutedRuleMask, Formattable& result) const
{
// try matching each rule in the rule set against the text being
// parsed. Whichever one matches the most characters is the one
@@ -707,12 +707,12 @@ NFRuleSet::parse(const UnicodeString& text, ParsePosition& pos, double upperBoun
#endif
// Try each of the negative rules, fraction rules, infinity rules and NaN rules
for (int i = 0; i < NON_NUMERICAL_RULE_LENGTH; i++) {
- if (nonNumericalRules[i] && ((nonNumericalExecutedRuleMask >> i) & 1) == 0) {
- // Mark this rule as being executed so that we don't try to execute it again.
- nonNumericalExecutedRuleMask |= 1 << i;
-
+ if (nonNumericalRules[i] && ((nonNumericalExecutedRuleMask >> i) & 1) == 0) {
+ // Mark this rule as being executed so that we don't try to execute it again.
+ nonNumericalExecutedRuleMask |= 1 << i;
+
Formattable tempResult;
- UBool success = nonNumericalRules[i]->doParse(text, workingPos, 0, upperBound, nonNumericalExecutedRuleMask, tempResult);
+ UBool success = nonNumericalRules[i]->doParse(text, workingPos, 0, upperBound, nonNumericalExecutedRuleMask, tempResult);
if (success && (workingPos.getIndex() > highWaterMark.getIndex())) {
result = tempResult;
highWaterMark = workingPos;
@@ -751,7 +751,7 @@ NFRuleSet::parse(const UnicodeString& text, ParsePosition& pos, double upperBoun
continue;
}
Formattable tempResult;
- UBool success = rules[i]->doParse(text, workingPos, fIsFractionRuleSet, upperBound, nonNumericalExecutedRuleMask, tempResult);
+ UBool success = rules[i]->doParse(text, workingPos, fIsFractionRuleSet, upperBound, nonNumericalExecutedRuleMask, tempResult);
if (success && workingPos.getIndex() > highWaterMark.getIndex()) {
result = tempResult;
highWaterMark = workingPos;
@@ -833,23 +833,23 @@ int64_t util64_fromDouble(double d) {
return result;
}
-uint64_t util64_pow(uint32_t base, uint16_t exponent) {
- if (base == 0) {
+uint64_t util64_pow(uint32_t base, uint16_t exponent) {
+ if (base == 0) {
return 0;
- }
- uint64_t result = 1;
- uint64_t pow = base;
- while (true) {
- if ((exponent & 1) == 1) {
- result *= pow;
+ }
+ uint64_t result = 1;
+ uint64_t pow = base;
+ while (true) {
+ if ((exponent & 1) == 1) {
+ result *= pow;
}
- exponent >>= 1;
- if (exponent == 0) {
- break;
- }
- pow *= pow;
+ exponent >>= 1;
+ if (exponent == 0) {
+ break;
+ }
+ pow *= pow;
}
- return result;
+ return result;
}
static const uint8_t asciiDigits[] = {
diff --git a/contrib/libs/icu/i18n/nfrs.h b/contrib/libs/icu/i18n/nfrs.h
index 6443f096e5..db03c9039d 100644
--- a/contrib/libs/icu/i18n/nfrs.h
+++ b/contrib/libs/icu/i18n/nfrs.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
******************************************************************************
* file name: nfrs.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -55,7 +55,7 @@ public:
void format(int64_t number, UnicodeString& toAppendTo, int32_t pos, int32_t recursionCount, UErrorCode& status) const;
void format(double number, UnicodeString& toAppendTo, int32_t pos, int32_t recursionCount, UErrorCode& status) const;
- UBool parse(const UnicodeString& text, ParsePosition& pos, double upperBound, uint32_t nonNumericalExecutedRuleMask, Formattable& result) const;
+ UBool parse(const UnicodeString& text, ParsePosition& pos, double upperBound, uint32_t nonNumericalExecutedRuleMask, Formattable& result) const;
void appendRules(UnicodeString& result) const; // toString
@@ -88,9 +88,9 @@ private:
int64_t util64_fromDouble(double d);
// raise radix to the power exponent, only non-negative exponents
-// Arithmetic is performed in unsigned space since overflow in
-// signed space is undefined behavior.
-uint64_t util64_pow(uint32_t radix, uint16_t exponent);
+// Arithmetic is performed in unsigned space since overflow in
+// signed space is undefined behavior.
+uint64_t util64_pow(uint32_t radix, uint16_t exponent);
// convert n to digit string in buffer, return length of string
uint32_t util64_tou(int64_t n, UChar* buffer, uint32_t buflen, uint32_t radix = 10, UBool raw = FALSE);
diff --git a/contrib/libs/icu/i18n/nfrule.cpp b/contrib/libs/icu/i18n/nfrule.cpp
index f6dbd61bc5..3ad0291649 100644
--- a/contrib/libs/icu/i18n/nfrule.cpp
+++ b/contrib/libs/icu/i18n/nfrule.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
******************************************************************************
* file name: nfrule.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -30,7 +30,7 @@
#include "nfrlist.h"
#include "nfsubs.h"
#include "patternprops.h"
-#include "putilimp.h"
+#include "putilimp.h"
U_NAMESPACE_BEGIN
@@ -39,14 +39,14 @@ NFRule::NFRule(const RuleBasedNumberFormat* _rbnf, const UnicodeString &_ruleTex
, radix(10)
, exponent(0)
, decimalPoint(0)
- , fRuleText(_ruleText)
+ , fRuleText(_ruleText)
, sub1(NULL)
, sub2(NULL)
, formatter(_rbnf)
, rulePatternFormat(NULL)
{
- if (!fRuleText.isEmpty()) {
- parseRuleDescriptor(fRuleText, status);
+ if (!fRuleText.isEmpty()) {
+ parseRuleDescriptor(fRuleText, status);
}
}
@@ -122,7 +122,7 @@ NFRule::makeRules(UnicodeString& description,
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
- description = rule1->fRuleText;
+ description = rule1->fRuleText;
// check the description to see whether there's text enclosed
// in brackets
@@ -314,7 +314,7 @@ NFRule::parseRuleDescriptor(UnicodeString& description, UErrorCode& status)
if (c == gSlash) {
val = 0;
++p;
- ll_10 = 10;
+ ll_10 = 10;
while (p < descriptorLength) {
c = descriptor.charAt(p);
if (c >= gZero && c <= gNine) {
@@ -418,7 +418,7 @@ NFRule::extractSubstitutions(const NFRuleSet* ruleSet,
if (U_FAILURE(status)) {
return;
}
- fRuleText = ruleText;
+ fRuleText = ruleText;
sub1 = extractSubstitution(ruleSet, predecessor, status);
if (sub1 == NULL) {
// Small optimization. There is no need to create a redundant NullSubstitution.
@@ -427,15 +427,15 @@ NFRule::extractSubstitutions(const NFRuleSet* ruleSet,
else {
sub2 = extractSubstitution(ruleSet, predecessor, status);
}
- int32_t pluralRuleStart = fRuleText.indexOf(gDollarOpenParenthesis, -1, 0);
- int32_t pluralRuleEnd = (pluralRuleStart >= 0 ? fRuleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart) : -1);
+ int32_t pluralRuleStart = fRuleText.indexOf(gDollarOpenParenthesis, -1, 0);
+ int32_t pluralRuleEnd = (pluralRuleStart >= 0 ? fRuleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart) : -1);
if (pluralRuleEnd >= 0) {
- int32_t endType = fRuleText.indexOf(gComma, pluralRuleStart);
+ int32_t endType = fRuleText.indexOf(gComma, pluralRuleStart);
if (endType < 0) {
status = U_PARSE_ERROR;
return;
}
- UnicodeString type(fRuleText.tempSubString(pluralRuleStart + 2, endType - pluralRuleStart - 2));
+ UnicodeString type(fRuleText.tempSubString(pluralRuleStart + 2, endType - pluralRuleStart - 2));
UPluralType pluralType;
if (type.startsWith(UNICODE_STRING_SIMPLE("cardinal"))) {
pluralType = UPLURAL_TYPE_CARDINAL;
@@ -448,7 +448,7 @@ NFRule::extractSubstitutions(const NFRuleSet* ruleSet,
return;
}
rulePatternFormat = formatter->createPluralFormat(pluralType,
- fRuleText.tempSubString(endType + 1, pluralRuleEnd - endType - 1), status);
+ fRuleText.tempSubString(endType + 1, pluralRuleEnd - endType - 1), status);
}
}
@@ -484,16 +484,16 @@ NFRule::extractSubstitution(const NFRuleSet* ruleSet,
// special-case the ">>>" token, since searching for the > at the
// end will actually find the > in the middle
- if (fRuleText.indexOf(gGreaterGreaterGreater, 3, 0) == subStart) {
+ if (fRuleText.indexOf(gGreaterGreaterGreater, 3, 0) == subStart) {
subEnd = subStart + 2;
// otherwise the substitution token ends with the same character
// it began with
} else {
- UChar c = fRuleText.charAt(subStart);
- subEnd = fRuleText.indexOf(c, subStart + 1);
+ UChar c = fRuleText.charAt(subStart);
+ subEnd = fRuleText.indexOf(c, subStart + 1);
// special case for '<%foo<<'
- if (c == gLessThan && subEnd != -1 && subEnd < fRuleText.length() - 1 && fRuleText.charAt(subEnd+1) == c) {
+ if (c == gLessThan && subEnd != -1 && subEnd < fRuleText.length() - 1 && fRuleText.charAt(subEnd+1) == c) {
// ordinals use "=#,##0==%abbrev=" as their rule. Notice that the '==' in the middle
// occurs because of the juxtaposition of two different rules. The check for '<' is a hack
// to get around this. Having the duplicate at the front would cause problems with
@@ -513,12 +513,12 @@ NFRule::extractSubstitution(const NFRuleSet* ruleSet,
// some text bounded by substitution token characters). Use
// makeSubstitution() to create the right kind of substitution
UnicodeString subToken;
- subToken.setTo(fRuleText, subStart, subEnd + 1 - subStart);
+ subToken.setTo(fRuleText, subStart, subEnd + 1 - subStart);
result = NFSubstitution::makeSubstitution(subStart, this, predecessor, ruleSet,
this->formatter, subToken, status);
// remove the substitution from the rule text
- fRuleText.removeBetween(subStart, subEnd+1);
+ fRuleText.removeBetween(subStart, subEnd+1);
return result;
}
@@ -601,7 +601,7 @@ NFRule::indexOfAnyRulePrefix() const
{
int result = -1;
for (int i = 0; RULE_PREFIXES[i]; i++) {
- int32_t pos = fRuleText.indexOf(*RULE_PREFIXES[i]);
+ int32_t pos = fRuleText.indexOf(*RULE_PREFIXES[i]);
if (pos != -1 && (result == -1 || pos < result)) {
result = pos;
}
@@ -637,7 +637,7 @@ NFRule::operator==(const NFRule& rhs) const
return baseValue == rhs.baseValue
&& radix == rhs.radix
&& exponent == rhs.exponent
- && fRuleText == rhs.fRuleText
+ && fRuleText == rhs.fRuleText
&& util_equalSubstitutions(sub1, rhs.sub1)
&& util_equalSubstitutions(sub2, rhs.sub2);
}
@@ -690,14 +690,14 @@ NFRule::_appendRuleText(UnicodeString& result) const
// if the rule text begins with a space, write an apostrophe
// (whitespace after the rule descriptor is ignored; the
// apostrophe is used to make the whitespace significant)
- if (fRuleText.charAt(0) == gSpace && (sub1 == NULL || sub1->getPos() != 0)) {
+ if (fRuleText.charAt(0) == gSpace && (sub1 == NULL || sub1->getPos() != 0)) {
result.append(gTick);
}
// now, write the rule's rule text, inserting appropriate
// substitution tokens in the appropriate places
UnicodeString ruleTextCopy;
- ruleTextCopy.setTo(fRuleText);
+ ruleTextCopy.setTo(fRuleText);
UnicodeString temp;
if (sub2 != NULL) {
@@ -716,12 +716,12 @@ NFRule::_appendRuleText(UnicodeString& result) const
result.append(gSemicolon);
}
-int64_t NFRule::getDivisor() const
-{
- return util64_pow(radix, exponent);
-}
-
-
+int64_t NFRule::getDivisor() const
+{
+ return util64_pow(radix, exponent);
+}
+
+
//-----------------------------------------------------------------------
// formatting
//-----------------------------------------------------------------------
@@ -743,24 +743,24 @@ NFRule::doFormat(int64_t number, UnicodeString& toInsertInto, int32_t pos, int32
// into the right places in toInsertInto (notice we do the
// substitutions in reverse order so that the offsets don't get
// messed up)
- int32_t pluralRuleStart = fRuleText.length();
+ int32_t pluralRuleStart = fRuleText.length();
int32_t lengthOffset = 0;
if (!rulePatternFormat) {
- toInsertInto.insert(pos, fRuleText);
+ toInsertInto.insert(pos, fRuleText);
}
else {
- pluralRuleStart = fRuleText.indexOf(gDollarOpenParenthesis, -1, 0);
- int pluralRuleEnd = fRuleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart);
+ pluralRuleStart = fRuleText.indexOf(gDollarOpenParenthesis, -1, 0);
+ int pluralRuleEnd = fRuleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart);
int initialLength = toInsertInto.length();
- if (pluralRuleEnd < fRuleText.length() - 1) {
- toInsertInto.insert(pos, fRuleText.tempSubString(pluralRuleEnd + 2));
+ if (pluralRuleEnd < fRuleText.length() - 1) {
+ toInsertInto.insert(pos, fRuleText.tempSubString(pluralRuleEnd + 2));
}
toInsertInto.insert(pos,
- rulePatternFormat->format((int32_t)(number/util64_pow(radix, exponent)), status));
+ rulePatternFormat->format((int32_t)(number/util64_pow(radix, exponent)), status));
if (pluralRuleStart > 0) {
- toInsertInto.insert(pos, fRuleText.tempSubString(0, pluralRuleStart));
+ toInsertInto.insert(pos, fRuleText.tempSubString(0, pluralRuleStart));
}
- lengthOffset = fRuleText.length() - (toInsertInto.length() - initialLength);
+ lengthOffset = fRuleText.length() - (toInsertInto.length() - initialLength);
}
if (sub2 != NULL) {
@@ -789,32 +789,32 @@ NFRule::doFormat(double number, UnicodeString& toInsertInto, int32_t pos, int32_
// [again, we have two copies of this routine that do the same thing
// so that we don't sacrifice precision in a long by casting it
// to a double]
- int32_t pluralRuleStart = fRuleText.length();
+ int32_t pluralRuleStart = fRuleText.length();
int32_t lengthOffset = 0;
if (!rulePatternFormat) {
- toInsertInto.insert(pos, fRuleText);
+ toInsertInto.insert(pos, fRuleText);
}
else {
- pluralRuleStart = fRuleText.indexOf(gDollarOpenParenthesis, -1, 0);
- int pluralRuleEnd = fRuleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart);
+ pluralRuleStart = fRuleText.indexOf(gDollarOpenParenthesis, -1, 0);
+ int pluralRuleEnd = fRuleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart);
int initialLength = toInsertInto.length();
- if (pluralRuleEnd < fRuleText.length() - 1) {
- toInsertInto.insert(pos, fRuleText.tempSubString(pluralRuleEnd + 2));
+ if (pluralRuleEnd < fRuleText.length() - 1) {
+ toInsertInto.insert(pos, fRuleText.tempSubString(pluralRuleEnd + 2));
}
double pluralVal = number;
if (0 <= pluralVal && pluralVal < 1) {
// We're in a fractional rule, and we have to match the NumeratorSubstitution behavior.
// 2.3 can become 0.2999999999999998 for the fraction due to rounding errors.
- pluralVal = uprv_round(pluralVal * util64_pow(radix, exponent));
+ pluralVal = uprv_round(pluralVal * util64_pow(radix, exponent));
}
else {
- pluralVal = pluralVal / util64_pow(radix, exponent);
+ pluralVal = pluralVal / util64_pow(radix, exponent);
}
toInsertInto.insert(pos, rulePatternFormat->format((int32_t)(pluralVal), status));
if (pluralRuleStart > 0) {
- toInsertInto.insert(pos, fRuleText.tempSubString(0, pluralRuleStart));
+ toInsertInto.insert(pos, fRuleText.tempSubString(0, pluralRuleStart));
}
- lengthOffset = fRuleText.length() - (toInsertInto.length() - initialLength);
+ lengthOffset = fRuleText.length() - (toInsertInto.length() - initialLength);
}
if (sub2 != NULL) {
@@ -834,7 +834,7 @@ NFRule::doFormat(double number, UnicodeString& toInsertInto, int32_t pos, int32_
* this one in its list; false if it should use this rule
*/
UBool
-NFRule::shouldRollBack(int64_t number) const
+NFRule::shouldRollBack(int64_t number) const
{
// we roll back if the rule contains a modulus substitution,
// the number being formatted is an even multiple of the rule's
@@ -854,7 +854,7 @@ NFRule::shouldRollBack(int64_t number) const
// multiple of 100. This is called the "rollback rule."
if ((sub1 != NULL && sub1->isModulusSubstitution()) || (sub2 != NULL && sub2->isModulusSubstitution())) {
int64_t re = util64_pow(radix, exponent);
- return (number % re) == 0 && (baseValue % re) != 0;
+ return (number % re) == 0 && (baseValue % re) != 0;
}
return FALSE;
}
@@ -900,7 +900,7 @@ NFRule::doParse(const UnicodeString& text,
ParsePosition& parsePosition,
UBool isFractionRule,
double upperBound,
- uint32_t nonNumericalExecutedRuleMask,
+ uint32_t nonNumericalExecutedRuleMask,
Formattable& resVal) const
{
// internally we operate on a copy of the string being parsed
@@ -908,15 +908,15 @@ NFRule::doParse(const UnicodeString& text,
ParsePosition pp;
UnicodeString workText(text);
- int32_t sub1Pos = sub1 != NULL ? sub1->getPos() : fRuleText.length();
- int32_t sub2Pos = sub2 != NULL ? sub2->getPos() : fRuleText.length();
+ int32_t sub1Pos = sub1 != NULL ? sub1->getPos() : fRuleText.length();
+ int32_t sub2Pos = sub2 != NULL ? sub2->getPos() : fRuleText.length();
// check to see whether the text before the first substitution
// matches the text at the beginning of the string being
// parsed. If it does, strip that off the front of workText;
// otherwise, dump out with a mismatch
UnicodeString prefix;
- prefix.setTo(fRuleText, 0, sub1Pos);
+ prefix.setTo(fRuleText, 0, sub1Pos);
#ifdef RBNF_DEBUG
fprintf(stderr, "doParse %p ", this);
@@ -1000,10 +1000,10 @@ NFRule::doParse(const UnicodeString& text,
// the substitution, giving us a new partial parse result
pp.setIndex(0);
- temp.setTo(fRuleText, sub1Pos, sub2Pos - sub1Pos);
+ temp.setTo(fRuleText, sub1Pos, sub2Pos - sub1Pos);
double partialResult = matchToDelimiter(workText, start, tempBaseValue,
temp, pp, sub1,
- nonNumericalExecutedRuleMask,
+ nonNumericalExecutedRuleMask,
upperBound);
// if we got a successful match (or were trying to match a
@@ -1021,10 +1021,10 @@ NFRule::doParse(const UnicodeString& text,
// partial result with whatever it gets back from its
// substitution if there's a successful match, giving us
// a real result
- temp.setTo(fRuleText, sub2Pos, fRuleText.length() - sub2Pos);
+ temp.setTo(fRuleText, sub2Pos, fRuleText.length() - sub2Pos);
partialResult = matchToDelimiter(workText2, 0, partialResult,
temp, pp2, sub2,
- nonNumericalExecutedRuleMask,
+ nonNumericalExecutedRuleMask,
upperBound);
// if we got a successful match on this second
@@ -1039,18 +1039,18 @@ NFRule::doParse(const UnicodeString& text,
else {
// commented out because ParsePosition doesn't have error index in 1.1.x
// restored for ICU4C port
- int32_t i_temp = pp2.getErrorIndex() + sub1Pos + pp.getIndex();
- if (i_temp> parsePosition.getErrorIndex()) {
- parsePosition.setErrorIndex(i_temp);
+ int32_t i_temp = pp2.getErrorIndex() + sub1Pos + pp.getIndex();
+ if (i_temp> parsePosition.getErrorIndex()) {
+ parsePosition.setErrorIndex(i_temp);
}
}
}
else {
// commented out because ParsePosition doesn't have error index in 1.1.x
// restored for ICU4C port
- int32_t i_temp = sub1Pos + pp.getErrorIndex();
- if (i_temp > parsePosition.getErrorIndex()) {
- parsePosition.setErrorIndex(i_temp);
+ int32_t i_temp = sub1Pos + pp.getErrorIndex();
+ if (i_temp > parsePosition.getErrorIndex()) {
+ parsePosition.setErrorIndex(i_temp);
}
}
// keep trying to match things until the outer matchToDelimiter()
@@ -1161,7 +1161,7 @@ NFRule::matchToDelimiter(const UnicodeString& text,
const UnicodeString& delimiter,
ParsePosition& pp,
const NFSubstitution* sub,
- uint32_t nonNumericalExecutedRuleMask,
+ uint32_t nonNumericalExecutedRuleMask,
double upperBound) const
{
UErrorCode status = U_ZERO_ERROR;
@@ -1195,7 +1195,7 @@ NFRule::matchToDelimiter(const UnicodeString& text,
#else
formatter->isLenient(),
#endif
- nonNumericalExecutedRuleMask,
+ nonNumericalExecutedRuleMask,
result);
// if the substitution could match all the text up to
@@ -1249,7 +1249,7 @@ NFRule::matchToDelimiter(const UnicodeString& text,
#else
formatter->isLenient(),
#endif
- nonNumericalExecutedRuleMask,
+ nonNumericalExecutedRuleMask,
result);
if (success && (tempPP.getIndex() != 0)) {
// if there's a successful match (or it's a null
@@ -1483,11 +1483,11 @@ NFRule::findText(const UnicodeString& str,
rulePatternFormat->parseType(str, this, result, position);
int start = position.getBeginIndex();
if (start >= 0) {
- int32_t pluralRuleStart = fRuleText.indexOf(gDollarOpenParenthesis, -1, 0);
- int32_t pluralRuleSuffix = fRuleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart) + 2;
+ int32_t pluralRuleStart = fRuleText.indexOf(gDollarOpenParenthesis, -1, 0);
+ int32_t pluralRuleSuffix = fRuleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart) + 2;
int32_t matchLen = position.getEndIndex() - start;
- UnicodeString prefix(fRuleText.tempSubString(0, pluralRuleStart));
- UnicodeString suffix(fRuleText.tempSubString(pluralRuleSuffix));
+ UnicodeString prefix(fRuleText.tempSubString(0, pluralRuleStart));
+ UnicodeString suffix(fRuleText.tempSubString(pluralRuleSuffix));
if (str.compare(start - prefix.length(), prefix.length(), prefix, 0, prefix.length()) == 0
&& str.compare(start + matchLen, suffix.length(), suffix, 0, suffix.length()) == 0)
{
diff --git a/contrib/libs/icu/i18n/nfrule.h b/contrib/libs/icu/i18n/nfrule.h
index 721486f9d6..ed33eaa5af 100644
--- a/contrib/libs/icu/i18n/nfrule.h
+++ b/contrib/libs/icu/i18n/nfrule.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -65,7 +65,7 @@ public:
UChar getDecimalPoint() const { return decimalPoint; }
- int64_t getDivisor() const;
+ int64_t getDivisor() const;
void doFormat(int64_t number, UnicodeString& toAppendTo, int32_t pos, int32_t recursionCount, UErrorCode& status) const;
void doFormat(double number, UnicodeString& toAppendTo, int32_t pos, int32_t recursionCount, UErrorCode& status) const;
@@ -74,10 +74,10 @@ public:
ParsePosition& pos,
UBool isFractional,
double upperBound,
- uint32_t nonNumericalExecutedRuleMask,
+ uint32_t nonNumericalExecutedRuleMask,
Formattable& result) const;
- UBool shouldRollBack(int64_t number) const;
+ UBool shouldRollBack(int64_t number) const;
void _appendRuleText(UnicodeString& result) const;
@@ -95,7 +95,7 @@ private:
int32_t indexOfAnyRulePrefix() const;
double matchToDelimiter(const UnicodeString& text, int32_t startPos, double baseValue,
const UnicodeString& delimiter, ParsePosition& pp, const NFSubstitution* sub,
- uint32_t nonNumericalExecutedRuleMask,
+ uint32_t nonNumericalExecutedRuleMask,
double upperBound) const;
void stripPrefix(UnicodeString& text, const UnicodeString& prefix, ParsePosition& pp) const;
@@ -109,7 +109,7 @@ private:
int32_t radix;
int16_t exponent;
UChar decimalPoint;
- UnicodeString fRuleText;
+ UnicodeString fRuleText;
NFSubstitution* sub1;
NFSubstitution* sub2;
const RuleBasedNumberFormat* formatter;
diff --git a/contrib/libs/icu/i18n/nfsubs.cpp b/contrib/libs/icu/i18n/nfsubs.cpp
index 95f00fbe38..208543d1ac 100644
--- a/contrib/libs/icu/i18n/nfsubs.cpp
+++ b/contrib/libs/icu/i18n/nfsubs.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
******************************************************************************
* file name: nfsubs.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -19,9 +19,9 @@
#include "utypeinfo.h" // for 'typeid' to work
#include "nfsubs.h"
-#include "fmtableimp.h"
-#include "putilimp.h"
-#include "number_decimalquantity.h"
+#include "fmtableimp.h"
+#include "putilimp.h"
+#include "number_decimalquantity.h"
#if U_HAVE_RBNF
@@ -48,8 +48,8 @@ static const UChar gGreaterGreaterThan[] =
U_NAMESPACE_BEGIN
-using number::impl::DecimalQuantity;
-
+using number::impl::DecimalQuantity;
+
class SameValueSubstitution : public NFSubstitution {
public:
SameValueSubstitution(int32_t pos,
@@ -72,15 +72,15 @@ public:
SameValueSubstitution::~SameValueSubstitution() {}
class MultiplierSubstitution : public NFSubstitution {
- int64_t divisor;
+ int64_t divisor;
public:
MultiplierSubstitution(int32_t _pos,
- const NFRule *rule,
+ const NFRule *rule,
const NFRuleSet* _ruleSet,
const UnicodeString& description,
UErrorCode& status)
- : NFSubstitution(_pos, _ruleSet, description, status), divisor(rule->getDivisor())
+ : NFSubstitution(_pos, _ruleSet, description, status), divisor(rule->getDivisor())
{
if (divisor == 0) {
status = U_PARSE_ERROR;
@@ -88,8 +88,8 @@ public:
}
virtual ~MultiplierSubstitution();
- virtual void setDivisor(int32_t radix, int16_t exponent, UErrorCode& status) {
- divisor = util64_pow(radix, exponent);
+ virtual void setDivisor(int32_t radix, int16_t exponent, UErrorCode& status) {
+ divisor = util64_pow(radix, exponent);
if(divisor == 0) {
status = U_PARSE_ERROR;
@@ -99,14 +99,14 @@ public:
virtual UBool operator==(const NFSubstitution& rhs) const;
virtual int64_t transformNumber(int64_t number) const {
- return number / divisor;
+ return number / divisor;
}
virtual double transformNumber(double number) const {
if (getRuleSet()) {
return uprv_floor(number / divisor);
} else {
- return number / divisor;
+ return number / divisor;
}
}
@@ -114,7 +114,7 @@ public:
return newRuleValue * divisor;
}
- virtual double calcUpperBound(double /*oldUpperBound*/) const { return static_cast<double>(divisor); }
+ virtual double calcUpperBound(double /*oldUpperBound*/) const { return static_cast<double>(divisor); }
virtual UChar tokenChar() const { return (UChar)0x003c; } // '<'
@@ -126,19 +126,19 @@ public:
MultiplierSubstitution::~MultiplierSubstitution() {}
class ModulusSubstitution : public NFSubstitution {
- int64_t divisor;
+ int64_t divisor;
const NFRule* ruleToUse;
public:
ModulusSubstitution(int32_t pos,
- const NFRule* rule,
+ const NFRule* rule,
const NFRule* rulePredecessor,
const NFRuleSet* ruleSet,
const UnicodeString& description,
UErrorCode& status);
virtual ~ModulusSubstitution();
- virtual void setDivisor(int32_t radix, int16_t exponent, UErrorCode& status) {
- divisor = util64_pow(radix, exponent);
+ virtual void setDivisor(int32_t radix, int16_t exponent, UErrorCode& status) {
+ divisor = util64_pow(radix, exponent);
if (divisor == 0) {
status = U_PARSE_ERROR;
@@ -150,22 +150,22 @@ public:
virtual void doSubstitution(int64_t number, UnicodeString& toInsertInto, int32_t pos, int32_t recursionCount, UErrorCode& status) const;
virtual void doSubstitution(double number, UnicodeString& toInsertInto, int32_t pos, int32_t recursionCount, UErrorCode& status) const;
- virtual int64_t transformNumber(int64_t number) const { return number % divisor; }
- virtual double transformNumber(double number) const { return uprv_fmod(number, static_cast<double>(divisor)); }
+ virtual int64_t transformNumber(int64_t number) const { return number % divisor; }
+ virtual double transformNumber(double number) const { return uprv_fmod(number, static_cast<double>(divisor)); }
virtual UBool doParse(const UnicodeString& text,
ParsePosition& parsePosition,
double baseValue,
double upperBound,
UBool lenientParse,
- uint32_t nonNumericalExecutedRuleMask,
+ uint32_t nonNumericalExecutedRuleMask,
Formattable& result) const;
virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const {
- return oldRuleValue - uprv_fmod(oldRuleValue, static_cast<double>(divisor)) + newRuleValue;
+ return oldRuleValue - uprv_fmod(oldRuleValue, static_cast<double>(divisor)) + newRuleValue;
}
- virtual double calcUpperBound(double /*oldUpperBound*/) const { return static_cast<double>(divisor); }
+ virtual double calcUpperBound(double /*oldUpperBound*/) const { return static_cast<double>(divisor); }
virtual UBool isModulusSubstitution() const { return TRUE; }
@@ -225,7 +225,7 @@ public:
double baseValue,
double upperBound,
UBool lenientParse,
- uint32_t nonNumericalExecutedRuleMask,
+ uint32_t nonNumericalExecutedRuleMask,
Formattable& result) const;
virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const { return newRuleValue + oldRuleValue; }
@@ -297,7 +297,7 @@ public:
double baseValue,
double upperBound,
UBool /*lenientParse*/,
- uint32_t nonNumericalExecutedRuleMask,
+ uint32_t nonNumericalExecutedRuleMask,
Formattable& result) const;
virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const { return newRuleValue / oldRuleValue; }
@@ -355,7 +355,7 @@ NFSubstitution::makeSubstitution(int32_t pos,
// otherwise, return a MultiplierSubstitution
else {
- return new MultiplierSubstitution(pos, rule, ruleSet,
+ return new MultiplierSubstitution(pos, rule, ruleSet,
description, status);
}
@@ -385,7 +385,7 @@ NFSubstitution::makeSubstitution(int32_t pos,
// otherwise, return a ModulusSubstitution
else {
- return new ModulusSubstitution(pos, rule, predecessor,
+ return new ModulusSubstitution(pos, rule, predecessor,
ruleSet, description, status);
}
@@ -493,7 +493,7 @@ NFSubstitution::~NFSubstitution()
* @param exponent The exponent of the divisor
*/
void
-NFSubstitution::setDivisor(int32_t /*radix*/, int16_t /*exponent*/, UErrorCode& /*status*/) {
+NFSubstitution::setDivisor(int32_t /*radix*/, int16_t /*exponent*/, UErrorCode& /*status*/) {
// a no-op for all substitutions except multiplier and modulus substitutions
}
@@ -574,38 +574,38 @@ void
NFSubstitution::doSubstitution(int64_t number, UnicodeString& toInsertInto, int32_t _pos, int32_t recursionCount, UErrorCode& status) const
{
if (ruleSet != NULL) {
- // Perform a transformation on the number that is dependent
+ // Perform a transformation on the number that is dependent
// on the type of substitution this is, then just call its
// rule set's format() method to format the result
ruleSet->format(transformNumber(number), toInsertInto, _pos + this->pos, recursionCount, status);
} else if (numberFormat != NULL) {
- if (number <= MAX_INT64_IN_DOUBLE) {
- // or perform the transformation on the number (preserving
- // the result's fractional part if the formatter it set
- // to show it), then use that formatter's format() method
- // to format the result
- double numberToFormat = transformNumber((double)number);
- if (numberFormat->getMaximumFractionDigits() == 0) {
- numberToFormat = uprv_floor(numberToFormat);
- }
-
- UnicodeString temp;
- numberFormat->format(numberToFormat, temp, status);
- toInsertInto.insert(_pos + this->pos, temp);
- }
- else {
- // We have gone beyond double precision. Something has to give.
- // We're favoring accuracy of the large number over potential rules
- // that round like a CompactDecimalFormat, which is not a common use case.
- //
- // Perform a transformation on the number that is dependent
- // on the type of substitution this is, then just call its
- // rule set's format() method to format the result
- int64_t numberToFormat = transformNumber(number);
- UnicodeString temp;
- numberFormat->format(numberToFormat, temp, status);
- toInsertInto.insert(_pos + this->pos, temp);
- }
+ if (number <= MAX_INT64_IN_DOUBLE) {
+ // or perform the transformation on the number (preserving
+ // the result's fractional part if the formatter it set
+ // to show it), then use that formatter's format() method
+ // to format the result
+ double numberToFormat = transformNumber((double)number);
+ if (numberFormat->getMaximumFractionDigits() == 0) {
+ numberToFormat = uprv_floor(numberToFormat);
+ }
+
+ UnicodeString temp;
+ numberFormat->format(numberToFormat, temp, status);
+ toInsertInto.insert(_pos + this->pos, temp);
+ }
+ else {
+ // We have gone beyond double precision. Something has to give.
+ // We're favoring accuracy of the large number over potential rules
+ // that round like a CompactDecimalFormat, which is not a common use case.
+ //
+ // Perform a transformation on the number that is dependent
+ // on the type of substitution this is, then just call its
+ // rule set's format() method to format the result
+ int64_t numberToFormat = transformNumber(number);
+ UnicodeString temp;
+ numberFormat->format(numberToFormat, temp, status);
+ toInsertInto.insert(_pos + this->pos, temp);
+ }
}
}
@@ -695,7 +695,7 @@ NFSubstitution::doParse(const UnicodeString& text,
double baseValue,
double upperBound,
UBool lenientParse,
- uint32_t nonNumericalExecutedRuleMask,
+ uint32_t nonNumericalExecutedRuleMask,
Formattable& result) const
{
#ifdef RBNF_DEBUG
@@ -716,7 +716,7 @@ NFSubstitution::doParse(const UnicodeString& text,
// on), then also try parsing the text using a default-
// constructed NumberFormat
if (ruleSet != NULL) {
- ruleSet->parse(text, parsePosition, upperBound, nonNumericalExecutedRuleMask, result);
+ ruleSet->parse(text, parsePosition, upperBound, nonNumericalExecutedRuleMask, result);
if (lenientParse && !ruleSet->isFractionRuleSet() && parsePosition.getIndex() == 0) {
UErrorCode status = U_ZERO_ERROR;
NumberFormat* fmt = NumberFormat::createInstance(status);
@@ -827,20 +827,20 @@ UBool MultiplierSubstitution::operator==(const NFSubstitution& rhs) const
* regular rule.
*/
ModulusSubstitution::ModulusSubstitution(int32_t _pos,
- const NFRule* rule,
+ const NFRule* rule,
const NFRule* predecessor,
const NFRuleSet* _ruleSet,
const UnicodeString& description,
UErrorCode& status)
: NFSubstitution(_pos, _ruleSet, description, status)
- , divisor(rule->getDivisor())
+ , divisor(rule->getDivisor())
, ruleToUse(NULL)
{
// the owning rule's divisor controls the behavior of this
// substitution: rather than keeping a backpointer to the rule,
// we keep a copy of the divisor
- if (divisor == 0) {
+ if (divisor == 0) {
status = U_PARSE_ERROR;
}
@@ -938,19 +938,19 @@ ModulusSubstitution::doParse(const UnicodeString& text,
double baseValue,
double upperBound,
UBool lenientParse,
- uint32_t nonNumericalExecutedRuleMask,
+ uint32_t nonNumericalExecutedRuleMask,
Formattable& result) const
{
// if this isn't a >>> substitution, we can just use the
// inherited parse() routine to do the parsing
if (ruleToUse == NULL) {
- return NFSubstitution::doParse(text, parsePosition, baseValue, upperBound, lenientParse, nonNumericalExecutedRuleMask, result);
+ return NFSubstitution::doParse(text, parsePosition, baseValue, upperBound, lenientParse, nonNumericalExecutedRuleMask, result);
// but if it IS a >>> substitution, we have to do it here: we
// use the specific rule's doParse() method, and then we have to
// do some of the other work of NFRuleSet.parse()
} else {
- ruleToUse->doParse(text, parsePosition, FALSE, upperBound, nonNumericalExecutedRuleMask, result);
+ ruleToUse->doParse(text, parsePosition, FALSE, upperBound, nonNumericalExecutedRuleMask, result);
if (parsePosition.getIndex() != 0) {
UErrorCode status = U_ZERO_ERROR;
@@ -1072,12 +1072,12 @@ FractionalPartSubstitution::doSubstitution(double number, UnicodeString& toInser
// numberToFormat /= 10;
// }
- DecimalQuantity dl;
- dl.setToDouble(number);
- dl.roundToMagnitude(-20, UNUM_ROUND_HALFEVEN, status); // round to 20 fraction digits.
+ DecimalQuantity dl;
+ dl.setToDouble(number);
+ dl.roundToMagnitude(-20, UNUM_ROUND_HALFEVEN, status); // round to 20 fraction digits.
UBool pad = FALSE;
- for (int32_t didx = dl.getLowerDisplayMagnitude(); didx<0; didx++) {
+ for (int32_t didx = dl.getLowerDisplayMagnitude(); didx<0; didx++) {
// Loop iterates over fraction digits, starting with the LSD.
// include both real digits from the number, and zeros
// to the left of the MSD but to the right of the decimal point.
@@ -1086,7 +1086,7 @@ FractionalPartSubstitution::doSubstitution(double number, UnicodeString& toInser
} else {
pad = TRUE;
}
- int64_t digit = dl.getDigit(didx);
+ int64_t digit = dl.getDigit(didx);
getRuleSet()->format(digit, toInsertInto, _pos + getPos(), recursionCount, status);
}
@@ -1125,13 +1125,13 @@ FractionalPartSubstitution::doParse(const UnicodeString& text,
double baseValue,
double /*upperBound*/,
UBool lenientParse,
- uint32_t nonNumericalExecutedRuleMask,
+ uint32_t nonNumericalExecutedRuleMask,
Formattable& resVal) const
{
// if we're not in byDigits mode, we can just use the inherited
// doParse()
if (!byDigits) {
- return NFSubstitution::doParse(text, parsePosition, baseValue, 0, lenientParse, nonNumericalExecutedRuleMask, resVal);
+ return NFSubstitution::doParse(text, parsePosition, baseValue, 0, lenientParse, nonNumericalExecutedRuleMask, resVal);
// if we ARE in byDigits mode, parse the text one digit at a time
// using this substitution's owning rule set (we do this by setting
@@ -1144,13 +1144,13 @@ FractionalPartSubstitution::doParse(const UnicodeString& text,
int32_t digit;
// double p10 = 0.1;
- DecimalQuantity dl;
- int32_t totalDigits = 0;
+ DecimalQuantity dl;
+ int32_t totalDigits = 0;
NumberFormat* fmt = NULL;
while (workText.length() > 0 && workPos.getIndex() != 0) {
workPos.setIndex(0);
Formattable temp;
- getRuleSet()->parse(workText, workPos, 10, nonNumericalExecutedRuleMask, temp);
+ getRuleSet()->parse(workText, workPos, 10, nonNumericalExecutedRuleMask, temp);
UErrorCode status = U_ZERO_ERROR;
digit = temp.getLong(status);
// digit = temp.getType() == Formattable::kLong ?
@@ -1173,8 +1173,8 @@ FractionalPartSubstitution::doParse(const UnicodeString& text,
}
if (workPos.getIndex() != 0) {
- dl.appendDigit(static_cast<int8_t>(digit), 0, true);
- totalDigits++;
+ dl.appendDigit(static_cast<int8_t>(digit), 0, true);
+ totalDigits++;
// result += digit * p10;
// p10 /= 10;
parsePosition.setIndex(parsePosition.getIndex() + workPos.getIndex());
@@ -1187,8 +1187,8 @@ FractionalPartSubstitution::doParse(const UnicodeString& text,
}
delete fmt;
- dl.adjustMagnitude(-totalDigits);
- result = dl.toDouble();
+ dl.adjustMagnitude(-totalDigits);
+ result = dl.toDouble();
result = composeRuleValue(result, baseValue);
resVal.setDouble(result);
return TRUE;
@@ -1260,7 +1260,7 @@ NumeratorSubstitution::doParse(const UnicodeString& text,
double baseValue,
double upperBound,
UBool /*lenientParse*/,
- uint32_t nonNumericalExecutedRuleMask,
+ uint32_t nonNumericalExecutedRuleMask,
Formattable& result) const
{
// we don't have to do anything special to do the parsing here,
@@ -1279,7 +1279,7 @@ NumeratorSubstitution::doParse(const UnicodeString& text,
while (workText.length() > 0 && workPos.getIndex() != 0) {
workPos.setIndex(0);
- getRuleSet()->parse(workText, workPos, 1, nonNumericalExecutedRuleMask, temp); // parse zero or nothing at all
+ getRuleSet()->parse(workText, workPos, 1, nonNumericalExecutedRuleMask, temp); // parse zero or nothing at all
if (workPos.getIndex() == 0) {
// we failed, either there were no more zeros, or the number was formatted with digits
// either way, we're done
@@ -1301,7 +1301,7 @@ NumeratorSubstitution::doParse(const UnicodeString& text,
}
// we've parsed off the zeros, now let's parse the rest from our current position
- NFSubstitution::doParse(workText, parsePosition, withZeros ? 1 : baseValue, upperBound, FALSE, nonNumericalExecutedRuleMask, result);
+ NFSubstitution::doParse(workText, parsePosition, withZeros ? 1 : baseValue, upperBound, FALSE, nonNumericalExecutedRuleMask, result);
if (withZeros) {
// any base value will do in this case. is there a way to
diff --git a/contrib/libs/icu/i18n/nfsubs.h b/contrib/libs/icu/i18n/nfsubs.h
index 81b8b323b4..948627c0cc 100644
--- a/contrib/libs/icu/i18n/nfsubs.h
+++ b/contrib/libs/icu/i18n/nfsubs.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
******************************************************************************
* file name: nfsubs.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -91,7 +91,7 @@ public:
* @param radix The radix of the divisor
* @param exponent The exponent of the divisor
*/
- virtual void setDivisor(int32_t radix, int16_t exponent, UErrorCode& status);
+ virtual void setDivisor(int32_t radix, int16_t exponent, UErrorCode& status);
/**
* Replaces result with the string describing the substitution.
@@ -191,7 +191,7 @@ public:
double baseValue,
double upperBound,
UBool lenientParse,
- uint32_t nonNumericalExecutedRuleMask,
+ uint32_t nonNumericalExecutedRuleMask,
Formattable& result) const;
/**
diff --git a/contrib/libs/icu/i18n/nortrans.cpp b/contrib/libs/icu/i18n/nortrans.cpp
index 6c63215db8..6a8d2c7419 100644
--- a/contrib/libs/icu/i18n/nortrans.cpp
+++ b/contrib/libs/icu/i18n/nortrans.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -92,7 +92,7 @@ NormalizationTransliterator::NormalizationTransliterator(const NormalizationTran
/**
* Transliterator API.
*/
-NormalizationTransliterator* NormalizationTransliterator::clone() const {
+NormalizationTransliterator* NormalizationTransliterator::clone() const {
return new NormalizationTransliterator(*this);
}
diff --git a/contrib/libs/icu/i18n/nortrans.h b/contrib/libs/icu/i18n/nortrans.h
index 7d831aa665..198ed29c95 100644
--- a/contrib/libs/icu/i18n/nortrans.h
+++ b/contrib/libs/icu/i18n/nortrans.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -44,7 +44,7 @@ class NormalizationTransliterator : public Transliterator {
* Transliterator API.
* @return A copy of the object.
*/
- virtual NormalizationTransliterator* clone() const;
+ virtual NormalizationTransliterator* clone() const;
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
diff --git a/contrib/libs/icu/i18n/nounit.cpp b/contrib/libs/icu/i18n/nounit.cpp
index 49e574bf5d..1d4aa05506 100644
--- a/contrib/libs/icu/i18n/nounit.cpp
+++ b/contrib/libs/icu/i18n/nounit.cpp
@@ -1,42 +1,42 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/nounit.h"
-#include "uassert.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-U_NAMESPACE_BEGIN
-
-UOBJECT_DEFINE_RTTI_IMPLEMENTATION(NoUnit)
-
-NoUnit U_EXPORT2 NoUnit::base() {
- return NoUnit("");
-}
-
-NoUnit U_EXPORT2 NoUnit::percent() {
- return NoUnit("percent");
-}
-
-NoUnit U_EXPORT2 NoUnit::permille() {
- return NoUnit("permille");
-}
-
-NoUnit::NoUnit(const char* subtype) {
- initNoUnit(subtype);
-}
-
-NoUnit::NoUnit(const NoUnit& other) : MeasureUnit(other) {
-}
-
-NoUnit* NoUnit::clone() const {
- return new NoUnit(*this);
-}
-
-NoUnit::~NoUnit() {
-}
-
-
-U_NAMESPACE_END
-
-#endif
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/nounit.h"
+#include "uassert.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+U_NAMESPACE_BEGIN
+
+UOBJECT_DEFINE_RTTI_IMPLEMENTATION(NoUnit)
+
+NoUnit U_EXPORT2 NoUnit::base() {
+ return NoUnit("");
+}
+
+NoUnit U_EXPORT2 NoUnit::percent() {
+ return NoUnit("percent");
+}
+
+NoUnit U_EXPORT2 NoUnit::permille() {
+ return NoUnit("permille");
+}
+
+NoUnit::NoUnit(const char* subtype) {
+ initNoUnit(subtype);
+}
+
+NoUnit::NoUnit(const NoUnit& other) : MeasureUnit(other) {
+}
+
+NoUnit* NoUnit::clone() const {
+ return new NoUnit(*this);
+}
+
+NoUnit::~NoUnit() {
+}
+
+
+U_NAMESPACE_END
+
+#endif
diff --git a/contrib/libs/icu/i18n/nultrans.cpp b/contrib/libs/icu/i18n/nultrans.cpp
index 70403ce857..439cc55d38 100644
--- a/contrib/libs/icu/i18n/nultrans.cpp
+++ b/contrib/libs/icu/i18n/nultrans.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -24,7 +24,7 @@ NullTransliterator::NullTransliterator() : Transliterator(UNICODE_STRING_SIMPLE(
NullTransliterator::~NullTransliterator() {}
-NullTransliterator* NullTransliterator::clone() const {
+NullTransliterator* NullTransliterator::clone() const {
return new NullTransliterator();
}
diff --git a/contrib/libs/icu/i18n/nultrans.h b/contrib/libs/icu/i18n/nultrans.h
index 1cff5de175..36c92fa7b1 100644
--- a/contrib/libs/icu/i18n/nultrans.h
+++ b/contrib/libs/icu/i18n/nultrans.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -45,7 +45,7 @@ public:
* Transliterator API.
* @internal Use transliterator factory methods instead since this class will be removed in that release.
*/
- virtual NullTransliterator* clone() const;
+ virtual NullTransliterator* clone() const;
/**
* Implements {@link Transliterator#handleTransliterate}.
diff --git a/contrib/libs/icu/i18n/number_affixutils.cpp b/contrib/libs/icu/i18n/number_affixutils.cpp
index 2a437ada22..a74ec2d634 100644
--- a/contrib/libs/icu/i18n/number_affixutils.cpp
+++ b/contrib/libs/icu/i18n/number_affixutils.cpp
@@ -1,440 +1,440 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "number_affixutils.h"
-#include "unicode/utf16.h"
-#include "unicode/uniset.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-TokenConsumer::~TokenConsumer() = default;
-SymbolProvider::~SymbolProvider() = default;
-
-int32_t AffixUtils::estimateLength(const UnicodeString &patternString, UErrorCode &status) {
- AffixPatternState state = STATE_BASE;
- int32_t offset = 0;
- int32_t length = 0;
- for (; offset < patternString.length();) {
- UChar32 cp = patternString.char32At(offset);
-
- switch (state) {
- case STATE_BASE:
- if (cp == u'\'') {
- // First quote
- state = STATE_FIRST_QUOTE;
- } else {
- // Unquoted symbol
- length++;
- }
- break;
- case STATE_FIRST_QUOTE:
- if (cp == u'\'') {
- // Repeated quote
- length++;
- state = STATE_BASE;
- } else {
- // Quoted code point
- length++;
- state = STATE_INSIDE_QUOTE;
- }
- break;
- case STATE_INSIDE_QUOTE:
- if (cp == u'\'') {
- // End of quoted sequence
- state = STATE_AFTER_QUOTE;
- } else {
- // Quoted code point
- length++;
- }
- break;
- case STATE_AFTER_QUOTE:
- if (cp == u'\'') {
- // Double quote inside of quoted sequence
- length++;
- state = STATE_INSIDE_QUOTE;
- } else {
- // Unquoted symbol
- length++;
- }
- break;
- default:
- UPRV_UNREACHABLE;
- }
-
- offset += U16_LENGTH(cp);
- }
-
- switch (state) {
- case STATE_FIRST_QUOTE:
- case STATE_INSIDE_QUOTE:
- status = U_ILLEGAL_ARGUMENT_ERROR;
- break;
- default:
- break;
- }
-
- return length;
-}
-
-UnicodeString AffixUtils::escape(const UnicodeString &input) {
- AffixPatternState state = STATE_BASE;
- int32_t offset = 0;
- UnicodeString output;
- for (; offset < input.length();) {
- UChar32 cp = input.char32At(offset);
-
- switch (cp) {
- case u'\'':
- output.append(u"''", -1);
- break;
-
- case u'-':
- case u'+':
- case u'%':
- case u'‰':
- case u'¤':
- if (state == STATE_BASE) {
- output.append(u'\'');
- output.append(cp);
- state = STATE_INSIDE_QUOTE;
- } else {
- output.append(cp);
- }
- break;
-
- default:
- if (state == STATE_INSIDE_QUOTE) {
- output.append(u'\'');
- output.append(cp);
- state = STATE_BASE;
- } else {
- output.append(cp);
- }
- break;
- }
- offset += U16_LENGTH(cp);
- }
-
- if (state == STATE_INSIDE_QUOTE) {
- output.append(u'\'');
- }
-
- return output;
-}
-
-Field AffixUtils::getFieldForType(AffixPatternType type) {
- switch (type) {
- case TYPE_MINUS_SIGN:
- return {UFIELD_CATEGORY_NUMBER, UNUM_SIGN_FIELD};
- case TYPE_PLUS_SIGN:
- return {UFIELD_CATEGORY_NUMBER, UNUM_SIGN_FIELD};
- case TYPE_PERCENT:
- return {UFIELD_CATEGORY_NUMBER, UNUM_PERCENT_FIELD};
- case TYPE_PERMILLE:
- return {UFIELD_CATEGORY_NUMBER, UNUM_PERMILL_FIELD};
- case TYPE_CURRENCY_SINGLE:
- return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD};
- case TYPE_CURRENCY_DOUBLE:
- return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD};
- case TYPE_CURRENCY_TRIPLE:
- return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD};
- case TYPE_CURRENCY_QUAD:
- return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD};
- case TYPE_CURRENCY_QUINT:
- return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD};
- case TYPE_CURRENCY_OVERFLOW:
- return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD};
- default:
- UPRV_UNREACHABLE;
- }
-}
-
-int32_t
-AffixUtils::unescape(const UnicodeString &affixPattern, FormattedStringBuilder &output, int32_t position,
- const SymbolProvider &provider, Field field, UErrorCode &status) {
- int32_t length = 0;
- AffixTag tag;
- while (hasNext(tag, affixPattern)) {
- tag = nextToken(tag, affixPattern, status);
- if (U_FAILURE(status)) { return length; }
- if (tag.type == TYPE_CURRENCY_OVERFLOW) {
- // Don't go to the provider for this special case
- length += output.insertCodePoint(
- position + length,
- 0xFFFD,
- {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD},
- status);
- } else if (tag.type < 0) {
- length += output.insert(
- position + length, provider.getSymbol(tag.type), getFieldForType(tag.type), status);
- } else {
- length += output.insertCodePoint(position + length, tag.codePoint, field, status);
- }
- }
- return length;
-}
-
-int32_t AffixUtils::unescapedCodePointCount(const UnicodeString &affixPattern,
- const SymbolProvider &provider, UErrorCode &status) {
- int32_t length = 0;
- AffixTag tag;
- while (hasNext(tag, affixPattern)) {
- tag = nextToken(tag, affixPattern, status);
- if (U_FAILURE(status)) { return length; }
- if (tag.type == TYPE_CURRENCY_OVERFLOW) {
- length += 1;
- } else if (tag.type < 0) {
- length += provider.getSymbol(tag.type).length();
- } else {
- length += U16_LENGTH(tag.codePoint);
- }
- }
- return length;
-}
-
-bool
-AffixUtils::containsType(const UnicodeString &affixPattern, AffixPatternType type, UErrorCode &status) {
- if (affixPattern.length() == 0) {
- return false;
- }
- AffixTag tag;
- while (hasNext(tag, affixPattern)) {
- tag = nextToken(tag, affixPattern, status);
- if (U_FAILURE(status)) { return false; }
- if (tag.type == type) {
- return true;
- }
- }
- return false;
-}
-
-bool AffixUtils::hasCurrencySymbols(const UnicodeString &affixPattern, UErrorCode &status) {
- if (affixPattern.length() == 0) {
- return false;
- }
- AffixTag tag;
- while (hasNext(tag, affixPattern)) {
- tag = nextToken(tag, affixPattern, status);
- if (U_FAILURE(status)) { return false; }
- if (tag.type < 0 && getFieldForType(tag.type) == Field(UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD)) {
- return true;
- }
- }
- return false;
-}
-
-UnicodeString AffixUtils::replaceType(const UnicodeString &affixPattern, AffixPatternType type,
- char16_t replacementChar, UErrorCode &status) {
- UnicodeString output(affixPattern); // copy
- if (affixPattern.length() == 0) {
- return output;
- }
- AffixTag tag;
- while (hasNext(tag, affixPattern)) {
- tag = nextToken(tag, affixPattern, status);
- if (U_FAILURE(status)) { return output; }
- if (tag.type == type) {
- output.replace(tag.offset - 1, 1, replacementChar);
- }
- }
- return output;
-}
-
-bool AffixUtils::containsOnlySymbolsAndIgnorables(const UnicodeString& affixPattern,
- const UnicodeSet& ignorables, UErrorCode& status) {
- if (affixPattern.length() == 0) {
- return true;
- }
- AffixTag tag;
- while (hasNext(tag, affixPattern)) {
- tag = nextToken(tag, affixPattern, status);
- if (U_FAILURE(status)) { return false; }
- if (tag.type == TYPE_CODEPOINT && !ignorables.contains(tag.codePoint)) {
- return false;
- }
- }
- return true;
-}
-
-void AffixUtils::iterateWithConsumer(const UnicodeString& affixPattern, TokenConsumer& consumer,
- UErrorCode& status) {
- if (affixPattern.length() == 0) {
- return;
- }
- AffixTag tag;
- while (hasNext(tag, affixPattern)) {
- tag = nextToken(tag, affixPattern, status);
- if (U_FAILURE(status)) { return; }
- consumer.consumeToken(tag.type, tag.codePoint, status);
- if (U_FAILURE(status)) { return; }
- }
-}
-
-AffixTag AffixUtils::nextToken(AffixTag tag, const UnicodeString &patternString, UErrorCode &status) {
- int32_t offset = tag.offset;
- int32_t state = tag.state;
- for (; offset < patternString.length();) {
- UChar32 cp = patternString.char32At(offset);
- int32_t count = U16_LENGTH(cp);
-
- switch (state) {
- case STATE_BASE:
- switch (cp) {
- case u'\'':
- state = STATE_FIRST_QUOTE;
- offset += count;
- // continue to the next code point
- break;
- case u'-':
- return makeTag(offset + count, TYPE_MINUS_SIGN, STATE_BASE, 0);
- case u'+':
- return makeTag(offset + count, TYPE_PLUS_SIGN, STATE_BASE, 0);
- case u'%':
- return makeTag(offset + count, TYPE_PERCENT, STATE_BASE, 0);
- case u'‰':
- return makeTag(offset + count, TYPE_PERMILLE, STATE_BASE, 0);
- case u'¤':
- state = STATE_FIRST_CURR;
- offset += count;
- // continue to the next code point
- break;
- default:
- return makeTag(offset + count, TYPE_CODEPOINT, STATE_BASE, cp);
- }
- break;
- case STATE_FIRST_QUOTE:
- if (cp == u'\'') {
- return makeTag(offset + count, TYPE_CODEPOINT, STATE_BASE, cp);
- } else {
- return makeTag(offset + count, TYPE_CODEPOINT, STATE_INSIDE_QUOTE, cp);
- }
- case STATE_INSIDE_QUOTE:
- if (cp == u'\'') {
- state = STATE_AFTER_QUOTE;
- offset += count;
- // continue to the next code point
- break;
- } else {
- return makeTag(offset + count, TYPE_CODEPOINT, STATE_INSIDE_QUOTE, cp);
- }
- case STATE_AFTER_QUOTE:
- if (cp == u'\'') {
- return makeTag(offset + count, TYPE_CODEPOINT, STATE_INSIDE_QUOTE, cp);
- } else {
- state = STATE_BASE;
- // re-evaluate this code point
- break;
- }
- case STATE_FIRST_CURR:
- if (cp == u'¤') {
- state = STATE_SECOND_CURR;
- offset += count;
- // continue to the next code point
- break;
- } else {
- return makeTag(offset, TYPE_CURRENCY_SINGLE, STATE_BASE, 0);
- }
- case STATE_SECOND_CURR:
- if (cp == u'¤') {
- state = STATE_THIRD_CURR;
- offset += count;
- // continue to the next code point
- break;
- } else {
- return makeTag(offset, TYPE_CURRENCY_DOUBLE, STATE_BASE, 0);
- }
- case STATE_THIRD_CURR:
- if (cp == u'¤') {
- state = STATE_FOURTH_CURR;
- offset += count;
- // continue to the next code point
- break;
- } else {
- return makeTag(offset, TYPE_CURRENCY_TRIPLE, STATE_BASE, 0);
- }
- case STATE_FOURTH_CURR:
- if (cp == u'¤') {
- state = STATE_FIFTH_CURR;
- offset += count;
- // continue to the next code point
- break;
- } else {
- return makeTag(offset, TYPE_CURRENCY_QUAD, STATE_BASE, 0);
- }
- case STATE_FIFTH_CURR:
- if (cp == u'¤') {
- state = STATE_OVERFLOW_CURR;
- offset += count;
- // continue to the next code point
- break;
- } else {
- return makeTag(offset, TYPE_CURRENCY_QUINT, STATE_BASE, 0);
- }
- case STATE_OVERFLOW_CURR:
- if (cp == u'¤') {
- offset += count;
- // continue to the next code point and loop back to this state
- break;
- } else {
- return makeTag(offset, TYPE_CURRENCY_OVERFLOW, STATE_BASE, 0);
- }
- default:
- UPRV_UNREACHABLE;
- }
- }
- // End of string
- switch (state) {
- case STATE_BASE:
- // No more tokens in string.
- return {-1};
- case STATE_FIRST_QUOTE:
- case STATE_INSIDE_QUOTE:
- // For consistent behavior with the JDK and ICU 58, set an error here.
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return {-1};
- case STATE_AFTER_QUOTE:
- // No more tokens in string.
- return {-1};
- case STATE_FIRST_CURR:
- return makeTag(offset, TYPE_CURRENCY_SINGLE, STATE_BASE, 0);
- case STATE_SECOND_CURR:
- return makeTag(offset, TYPE_CURRENCY_DOUBLE, STATE_BASE, 0);
- case STATE_THIRD_CURR:
- return makeTag(offset, TYPE_CURRENCY_TRIPLE, STATE_BASE, 0);
- case STATE_FOURTH_CURR:
- return makeTag(offset, TYPE_CURRENCY_QUAD, STATE_BASE, 0);
- case STATE_FIFTH_CURR:
- return makeTag(offset, TYPE_CURRENCY_QUINT, STATE_BASE, 0);
- case STATE_OVERFLOW_CURR:
- return makeTag(offset, TYPE_CURRENCY_OVERFLOW, STATE_BASE, 0);
- default:
- UPRV_UNREACHABLE;
- }
-}
-
-bool AffixUtils::hasNext(const AffixTag &tag, const UnicodeString &string) {
- // First check for the {-1} and default initializer syntax.
- if (tag.offset < 0) {
- return false;
- } else if (tag.offset == 0) {
- return string.length() > 0;
- }
- // The rest of the fields are safe to use now.
- // Special case: the last character in string is an end quote.
- if (tag.state == STATE_INSIDE_QUOTE && tag.offset == string.length() - 1 &&
- string.charAt(tag.offset) == u'\'') {
- return false;
- } else if (tag.state != STATE_BASE) {
- return true;
- } else {
- return tag.offset < string.length();
- }
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "number_affixutils.h"
+#include "unicode/utf16.h"
+#include "unicode/uniset.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+TokenConsumer::~TokenConsumer() = default;
+SymbolProvider::~SymbolProvider() = default;
+
+int32_t AffixUtils::estimateLength(const UnicodeString &patternString, UErrorCode &status) {
+ AffixPatternState state = STATE_BASE;
+ int32_t offset = 0;
+ int32_t length = 0;
+ for (; offset < patternString.length();) {
+ UChar32 cp = patternString.char32At(offset);
+
+ switch (state) {
+ case STATE_BASE:
+ if (cp == u'\'') {
+ // First quote
+ state = STATE_FIRST_QUOTE;
+ } else {
+ // Unquoted symbol
+ length++;
+ }
+ break;
+ case STATE_FIRST_QUOTE:
+ if (cp == u'\'') {
+ // Repeated quote
+ length++;
+ state = STATE_BASE;
+ } else {
+ // Quoted code point
+ length++;
+ state = STATE_INSIDE_QUOTE;
+ }
+ break;
+ case STATE_INSIDE_QUOTE:
+ if (cp == u'\'') {
+ // End of quoted sequence
+ state = STATE_AFTER_QUOTE;
+ } else {
+ // Quoted code point
+ length++;
+ }
+ break;
+ case STATE_AFTER_QUOTE:
+ if (cp == u'\'') {
+ // Double quote inside of quoted sequence
+ length++;
+ state = STATE_INSIDE_QUOTE;
+ } else {
+ // Unquoted symbol
+ length++;
+ }
+ break;
+ default:
+ UPRV_UNREACHABLE;
+ }
+
+ offset += U16_LENGTH(cp);
+ }
+
+ switch (state) {
+ case STATE_FIRST_QUOTE:
+ case STATE_INSIDE_QUOTE:
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ break;
+ default:
+ break;
+ }
+
+ return length;
+}
+
+UnicodeString AffixUtils::escape(const UnicodeString &input) {
+ AffixPatternState state = STATE_BASE;
+ int32_t offset = 0;
+ UnicodeString output;
+ for (; offset < input.length();) {
+ UChar32 cp = input.char32At(offset);
+
+ switch (cp) {
+ case u'\'':
+ output.append(u"''", -1);
+ break;
+
+ case u'-':
+ case u'+':
+ case u'%':
+ case u'‰':
+ case u'¤':
+ if (state == STATE_BASE) {
+ output.append(u'\'');
+ output.append(cp);
+ state = STATE_INSIDE_QUOTE;
+ } else {
+ output.append(cp);
+ }
+ break;
+
+ default:
+ if (state == STATE_INSIDE_QUOTE) {
+ output.append(u'\'');
+ output.append(cp);
+ state = STATE_BASE;
+ } else {
+ output.append(cp);
+ }
+ break;
+ }
+ offset += U16_LENGTH(cp);
+ }
+
+ if (state == STATE_INSIDE_QUOTE) {
+ output.append(u'\'');
+ }
+
+ return output;
+}
+
+Field AffixUtils::getFieldForType(AffixPatternType type) {
+ switch (type) {
+ case TYPE_MINUS_SIGN:
+ return {UFIELD_CATEGORY_NUMBER, UNUM_SIGN_FIELD};
+ case TYPE_PLUS_SIGN:
+ return {UFIELD_CATEGORY_NUMBER, UNUM_SIGN_FIELD};
+ case TYPE_PERCENT:
+ return {UFIELD_CATEGORY_NUMBER, UNUM_PERCENT_FIELD};
+ case TYPE_PERMILLE:
+ return {UFIELD_CATEGORY_NUMBER, UNUM_PERMILL_FIELD};
+ case TYPE_CURRENCY_SINGLE:
+ return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD};
+ case TYPE_CURRENCY_DOUBLE:
+ return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD};
+ case TYPE_CURRENCY_TRIPLE:
+ return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD};
+ case TYPE_CURRENCY_QUAD:
+ return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD};
+ case TYPE_CURRENCY_QUINT:
+ return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD};
+ case TYPE_CURRENCY_OVERFLOW:
+ return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD};
+ default:
+ UPRV_UNREACHABLE;
+ }
+}
+
+int32_t
+AffixUtils::unescape(const UnicodeString &affixPattern, FormattedStringBuilder &output, int32_t position,
+ const SymbolProvider &provider, Field field, UErrorCode &status) {
+ int32_t length = 0;
+ AffixTag tag;
+ while (hasNext(tag, affixPattern)) {
+ tag = nextToken(tag, affixPattern, status);
+ if (U_FAILURE(status)) { return length; }
+ if (tag.type == TYPE_CURRENCY_OVERFLOW) {
+ // Don't go to the provider for this special case
+ length += output.insertCodePoint(
+ position + length,
+ 0xFFFD,
+ {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD},
+ status);
+ } else if (tag.type < 0) {
+ length += output.insert(
+ position + length, provider.getSymbol(tag.type), getFieldForType(tag.type), status);
+ } else {
+ length += output.insertCodePoint(position + length, tag.codePoint, field, status);
+ }
+ }
+ return length;
+}
+
+int32_t AffixUtils::unescapedCodePointCount(const UnicodeString &affixPattern,
+ const SymbolProvider &provider, UErrorCode &status) {
+ int32_t length = 0;
+ AffixTag tag;
+ while (hasNext(tag, affixPattern)) {
+ tag = nextToken(tag, affixPattern, status);
+ if (U_FAILURE(status)) { return length; }
+ if (tag.type == TYPE_CURRENCY_OVERFLOW) {
+ length += 1;
+ } else if (tag.type < 0) {
+ length += provider.getSymbol(tag.type).length();
+ } else {
+ length += U16_LENGTH(tag.codePoint);
+ }
+ }
+ return length;
+}
+
+bool
+AffixUtils::containsType(const UnicodeString &affixPattern, AffixPatternType type, UErrorCode &status) {
+ if (affixPattern.length() == 0) {
+ return false;
+ }
+ AffixTag tag;
+ while (hasNext(tag, affixPattern)) {
+ tag = nextToken(tag, affixPattern, status);
+ if (U_FAILURE(status)) { return false; }
+ if (tag.type == type) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool AffixUtils::hasCurrencySymbols(const UnicodeString &affixPattern, UErrorCode &status) {
+ if (affixPattern.length() == 0) {
+ return false;
+ }
+ AffixTag tag;
+ while (hasNext(tag, affixPattern)) {
+ tag = nextToken(tag, affixPattern, status);
+ if (U_FAILURE(status)) { return false; }
+ if (tag.type < 0 && getFieldForType(tag.type) == Field(UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+UnicodeString AffixUtils::replaceType(const UnicodeString &affixPattern, AffixPatternType type,
+ char16_t replacementChar, UErrorCode &status) {
+ UnicodeString output(affixPattern); // copy
+ if (affixPattern.length() == 0) {
+ return output;
+ }
+ AffixTag tag;
+ while (hasNext(tag, affixPattern)) {
+ tag = nextToken(tag, affixPattern, status);
+ if (U_FAILURE(status)) { return output; }
+ if (tag.type == type) {
+ output.replace(tag.offset - 1, 1, replacementChar);
+ }
+ }
+ return output;
+}
+
+bool AffixUtils::containsOnlySymbolsAndIgnorables(const UnicodeString& affixPattern,
+ const UnicodeSet& ignorables, UErrorCode& status) {
+ if (affixPattern.length() == 0) {
+ return true;
+ }
+ AffixTag tag;
+ while (hasNext(tag, affixPattern)) {
+ tag = nextToken(tag, affixPattern, status);
+ if (U_FAILURE(status)) { return false; }
+ if (tag.type == TYPE_CODEPOINT && !ignorables.contains(tag.codePoint)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+void AffixUtils::iterateWithConsumer(const UnicodeString& affixPattern, TokenConsumer& consumer,
+ UErrorCode& status) {
+ if (affixPattern.length() == 0) {
+ return;
+ }
+ AffixTag tag;
+ while (hasNext(tag, affixPattern)) {
+ tag = nextToken(tag, affixPattern, status);
+ if (U_FAILURE(status)) { return; }
+ consumer.consumeToken(tag.type, tag.codePoint, status);
+ if (U_FAILURE(status)) { return; }
+ }
+}
+
+AffixTag AffixUtils::nextToken(AffixTag tag, const UnicodeString &patternString, UErrorCode &status) {
+ int32_t offset = tag.offset;
+ int32_t state = tag.state;
+ for (; offset < patternString.length();) {
+ UChar32 cp = patternString.char32At(offset);
+ int32_t count = U16_LENGTH(cp);
+
+ switch (state) {
+ case STATE_BASE:
+ switch (cp) {
+ case u'\'':
+ state = STATE_FIRST_QUOTE;
+ offset += count;
+ // continue to the next code point
+ break;
+ case u'-':
+ return makeTag(offset + count, TYPE_MINUS_SIGN, STATE_BASE, 0);
+ case u'+':
+ return makeTag(offset + count, TYPE_PLUS_SIGN, STATE_BASE, 0);
+ case u'%':
+ return makeTag(offset + count, TYPE_PERCENT, STATE_BASE, 0);
+ case u'‰':
+ return makeTag(offset + count, TYPE_PERMILLE, STATE_BASE, 0);
+ case u'¤':
+ state = STATE_FIRST_CURR;
+ offset += count;
+ // continue to the next code point
+ break;
+ default:
+ return makeTag(offset + count, TYPE_CODEPOINT, STATE_BASE, cp);
+ }
+ break;
+ case STATE_FIRST_QUOTE:
+ if (cp == u'\'') {
+ return makeTag(offset + count, TYPE_CODEPOINT, STATE_BASE, cp);
+ } else {
+ return makeTag(offset + count, TYPE_CODEPOINT, STATE_INSIDE_QUOTE, cp);
+ }
+ case STATE_INSIDE_QUOTE:
+ if (cp == u'\'') {
+ state = STATE_AFTER_QUOTE;
+ offset += count;
+ // continue to the next code point
+ break;
+ } else {
+ return makeTag(offset + count, TYPE_CODEPOINT, STATE_INSIDE_QUOTE, cp);
+ }
+ case STATE_AFTER_QUOTE:
+ if (cp == u'\'') {
+ return makeTag(offset + count, TYPE_CODEPOINT, STATE_INSIDE_QUOTE, cp);
+ } else {
+ state = STATE_BASE;
+ // re-evaluate this code point
+ break;
+ }
+ case STATE_FIRST_CURR:
+ if (cp == u'¤') {
+ state = STATE_SECOND_CURR;
+ offset += count;
+ // continue to the next code point
+ break;
+ } else {
+ return makeTag(offset, TYPE_CURRENCY_SINGLE, STATE_BASE, 0);
+ }
+ case STATE_SECOND_CURR:
+ if (cp == u'¤') {
+ state = STATE_THIRD_CURR;
+ offset += count;
+ // continue to the next code point
+ break;
+ } else {
+ return makeTag(offset, TYPE_CURRENCY_DOUBLE, STATE_BASE, 0);
+ }
+ case STATE_THIRD_CURR:
+ if (cp == u'¤') {
+ state = STATE_FOURTH_CURR;
+ offset += count;
+ // continue to the next code point
+ break;
+ } else {
+ return makeTag(offset, TYPE_CURRENCY_TRIPLE, STATE_BASE, 0);
+ }
+ case STATE_FOURTH_CURR:
+ if (cp == u'¤') {
+ state = STATE_FIFTH_CURR;
+ offset += count;
+ // continue to the next code point
+ break;
+ } else {
+ return makeTag(offset, TYPE_CURRENCY_QUAD, STATE_BASE, 0);
+ }
+ case STATE_FIFTH_CURR:
+ if (cp == u'¤') {
+ state = STATE_OVERFLOW_CURR;
+ offset += count;
+ // continue to the next code point
+ break;
+ } else {
+ return makeTag(offset, TYPE_CURRENCY_QUINT, STATE_BASE, 0);
+ }
+ case STATE_OVERFLOW_CURR:
+ if (cp == u'¤') {
+ offset += count;
+ // continue to the next code point and loop back to this state
+ break;
+ } else {
+ return makeTag(offset, TYPE_CURRENCY_OVERFLOW, STATE_BASE, 0);
+ }
+ default:
+ UPRV_UNREACHABLE;
+ }
+ }
+ // End of string
+ switch (state) {
+ case STATE_BASE:
+ // No more tokens in string.
+ return {-1};
+ case STATE_FIRST_QUOTE:
+ case STATE_INSIDE_QUOTE:
+ // For consistent behavior with the JDK and ICU 58, set an error here.
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return {-1};
+ case STATE_AFTER_QUOTE:
+ // No more tokens in string.
+ return {-1};
+ case STATE_FIRST_CURR:
+ return makeTag(offset, TYPE_CURRENCY_SINGLE, STATE_BASE, 0);
+ case STATE_SECOND_CURR:
+ return makeTag(offset, TYPE_CURRENCY_DOUBLE, STATE_BASE, 0);
+ case STATE_THIRD_CURR:
+ return makeTag(offset, TYPE_CURRENCY_TRIPLE, STATE_BASE, 0);
+ case STATE_FOURTH_CURR:
+ return makeTag(offset, TYPE_CURRENCY_QUAD, STATE_BASE, 0);
+ case STATE_FIFTH_CURR:
+ return makeTag(offset, TYPE_CURRENCY_QUINT, STATE_BASE, 0);
+ case STATE_OVERFLOW_CURR:
+ return makeTag(offset, TYPE_CURRENCY_OVERFLOW, STATE_BASE, 0);
+ default:
+ UPRV_UNREACHABLE;
+ }
+}
+
+bool AffixUtils::hasNext(const AffixTag &tag, const UnicodeString &string) {
+ // First check for the {-1} and default initializer syntax.
+ if (tag.offset < 0) {
+ return false;
+ } else if (tag.offset == 0) {
+ return string.length() > 0;
+ }
+ // The rest of the fields are safe to use now.
+ // Special case: the last character in string is an end quote.
+ if (tag.state == STATE_INSIDE_QUOTE && tag.offset == string.length() - 1 &&
+ string.charAt(tag.offset) == u'\'') {
+ return false;
+ } else if (tag.state != STATE_BASE) {
+ return true;
+ } else {
+ return tag.offset < string.length();
+ }
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_affixutils.h b/contrib/libs/icu/i18n/number_affixutils.h
index b4948ebc00..5cfde61ffd 100644
--- a/contrib/libs/icu/i18n/number_affixutils.h
+++ b/contrib/libs/icu/i18n/number_affixutils.h
@@ -1,244 +1,244 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMBER_AFFIXUTILS_H__
-#define __NUMBER_AFFIXUTILS_H__
-
-#include <cstdint>
-#include "number_types.h"
-#include "unicode/stringpiece.h"
-#include "unicode/unistr.h"
-#include "formatted_string_builder.h"
-#include "unicode/uniset.h"
-
-U_NAMESPACE_BEGIN namespace number {
-namespace impl {
-
-enum AffixPatternState {
- STATE_BASE = 0,
- STATE_FIRST_QUOTE = 1,
- STATE_INSIDE_QUOTE = 2,
- STATE_AFTER_QUOTE = 3,
- STATE_FIRST_CURR = 4,
- STATE_SECOND_CURR = 5,
- STATE_THIRD_CURR = 6,
- STATE_FOURTH_CURR = 7,
- STATE_FIFTH_CURR = 8,
- STATE_OVERFLOW_CURR = 9
-};
-
-// enum AffixPatternType defined in internals.h
-
-struct AffixTag {
- int32_t offset;
- UChar32 codePoint;
- AffixPatternState state;
- AffixPatternType type;
-
- AffixTag()
- : offset(0), state(STATE_BASE) {}
-
- AffixTag(int32_t offset)
- : offset(offset) {}
-
- AffixTag(int32_t offset, UChar32 codePoint, AffixPatternState state, AffixPatternType type)
- : offset(offset), codePoint(codePoint), state(state), type(type) {}
-};
-
-class TokenConsumer {
- public:
- virtual ~TokenConsumer();
-
- virtual void consumeToken(AffixPatternType type, UChar32 cp, UErrorCode& status) = 0;
-};
-
-// Exported as U_I18N_API because it is a base class for other exported types
-class U_I18N_API SymbolProvider {
- public:
- virtual ~SymbolProvider();
-
- // TODO: Could this be more efficient if it returned by reference?
- virtual UnicodeString getSymbol(AffixPatternType type) const = 0;
-};
-
-/**
- * Performs manipulations on affix patterns: the prefix and suffix strings associated with a decimal
- * format pattern. For example:
- *
- * <table>
- * <tr><th>Affix Pattern</th><th>Example Unescaped (Formatted) String</th></tr>
- * <tr><td>abc</td><td>abc</td></tr>
- * <tr><td>ab-</td><td>ab−</td></tr>
- * <tr><td>ab'-'</td><td>ab-</td></tr>
- * <tr><td>ab''</td><td>ab'</td></tr>
- * </table>
- *
- * To manually iterate over tokens in a literal string, use the following pattern, which is designed
- * to be efficient.
- *
- * <pre>
- * long tag = 0L;
- * while (AffixPatternUtils.hasNext(tag, patternString)) {
- * tag = AffixPatternUtils.nextToken(tag, patternString);
- * int typeOrCp = AffixPatternUtils.getTypeOrCp(tag);
- * switch (typeOrCp) {
- * case AffixPatternUtils.TYPE_MINUS_SIGN:
- * // Current token is a minus sign.
- * break;
- * case AffixPatternUtils.TYPE_PLUS_SIGN:
- * // Current token is a plus sign.
- * break;
- * case AffixPatternUtils.TYPE_PERCENT:
- * // Current token is a percent sign.
- * break;
- * // ... other types ...
- * default:
- * // Current token is an arbitrary code point.
- * // The variable typeOrCp is the code point.
- * break;
- * }
- * }
- * </pre>
- */
-class U_I18N_API AffixUtils {
-
- public:
-
- /**
- * Estimates the number of code points present in an unescaped version of the affix pattern string
- * (one that would be returned by {@link #unescape}), assuming that all interpolated symbols
- * consume one code point and that currencies consume as many code points as their symbol width.
- * Used for computing padding width.
- *
- * @param patternString The original string whose width will be estimated.
- * @return The length of the unescaped string.
- */
- static int32_t estimateLength(const UnicodeString& patternString, UErrorCode& status);
-
- /**
- * Takes a string and escapes (quotes) characters that have special meaning in the affix pattern
- * syntax. This function does not reverse-lookup symbols.
- *
- * <p>Example input: "-$x"; example output: "'-'$x"
- *
- * @param input The string to be escaped.
- * @return The resulting UnicodeString.
- */
- static UnicodeString escape(const UnicodeString& input);
-
- static Field getFieldForType(AffixPatternType type);
-
- /**
- * Executes the unescape state machine. Replaces the unquoted characters "-", "+", "%", "‰", and
- * "¤" with the corresponding symbols provided by the {@link SymbolProvider}, and inserts the
- * result into the FormattedStringBuilder at the requested location.
- *
- * <p>Example input: "'-'¤x"; example output: "-$x"
- *
- * @param affixPattern The original string to be unescaped.
- * @param output The FormattedStringBuilder to mutate with the result.
- * @param position The index into the FormattedStringBuilder to insert the string.
- * @param provider An object to generate locale symbols.
- */
- static int32_t unescape(const UnicodeString& affixPattern, FormattedStringBuilder& output,
- int32_t position, const SymbolProvider& provider, Field field,
- UErrorCode& status);
-
- /**
- * Sames as {@link #unescape}, but only calculates the code point count. More efficient than {@link #unescape}
- * if you only need the length but not the string itself.
- *
- * @param affixPattern The original string to be unescaped.
- * @param provider An object to generate locale symbols.
- * @return The same return value as if you called {@link #unescape}.
- */
- static int32_t unescapedCodePointCount(const UnicodeString& affixPattern,
- const SymbolProvider& provider, UErrorCode& status);
-
- /**
- * Checks whether the given affix pattern contains at least one token of the given type, which is
- * one of the constants "TYPE_" in {@link AffixPatternUtils}.
- *
- * @param affixPattern The affix pattern to check.
- * @param type The token type.
- * @return true if the affix pattern contains the given token type; false otherwise.
- */
- static bool containsType(const UnicodeString& affixPattern, AffixPatternType type, UErrorCode& status);
-
- /**
- * Checks whether the specified affix pattern has any unquoted currency symbols ("¤").
- *
- * @param affixPattern The string to check for currency symbols.
- * @return true if the literal has at least one unquoted currency symbol; false otherwise.
- */
- static bool hasCurrencySymbols(const UnicodeString& affixPattern, UErrorCode& status);
-
- /**
- * Replaces all occurrences of tokens with the given type with the given replacement char.
- *
- * @param affixPattern The source affix pattern (does not get modified).
- * @param type The token type.
- * @param replacementChar The char to substitute in place of chars of the given token type.
- * @return A string containing the new affix pattern.
- */
- static UnicodeString replaceType(const UnicodeString& affixPattern, AffixPatternType type,
- char16_t replacementChar, UErrorCode& status);
-
- /**
- * Returns whether the given affix pattern contains only symbols and ignorables as defined by the
- * given ignorables set.
- */
- static bool containsOnlySymbolsAndIgnorables(const UnicodeString& affixPattern,
- const UnicodeSet& ignorables, UErrorCode& status);
-
- /**
- * Iterates over the affix pattern, calling the TokenConsumer for each token.
- */
- static void iterateWithConsumer(const UnicodeString& affixPattern, TokenConsumer& consumer,
- UErrorCode& status);
-
- /**
- * Returns the next token from the affix pattern.
- *
- * @param tag A bitmask used for keeping track of state from token to token. The initial value
- * should be 0L.
- * @param patternString The affix pattern.
- * @return The bitmask tag to pass to the next call of this method to retrieve the following token
- * (never negative), or -1 if there were no more tokens in the affix pattern.
- * @see #hasNext
- */
- static AffixTag nextToken(AffixTag tag, const UnicodeString& patternString, UErrorCode& status);
-
- /**
- * Returns whether the affix pattern string has any more tokens to be retrieved from a call to
- * {@link #nextToken}.
- *
- * @param tag The bitmask tag of the previous token, as returned by {@link #nextToken}.
- * @param string The affix pattern.
- * @return true if there are more tokens to consume; false otherwise.
- */
- static bool hasNext(const AffixTag& tag, const UnicodeString& string);
-
- private:
- /**
- * Encodes the given values into a tag struct.
- * The order of the arguments is consistent with Java, but the order of the stored
- * fields is not necessarily the same.
- */
- static inline AffixTag makeTag(int32_t offset, AffixPatternType type, AffixPatternState state,
- UChar32 cp) {
- return {offset, cp, state, type};
- }
-};
-
-} // namespace impl
-} // namespace number
-U_NAMESPACE_END
-
-
-#endif //__NUMBER_AFFIXUTILS_H__
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMBER_AFFIXUTILS_H__
+#define __NUMBER_AFFIXUTILS_H__
+
+#include <cstdint>
+#include "number_types.h"
+#include "unicode/stringpiece.h"
+#include "unicode/unistr.h"
+#include "formatted_string_builder.h"
+#include "unicode/uniset.h"
+
+U_NAMESPACE_BEGIN namespace number {
+namespace impl {
+
+enum AffixPatternState {
+ STATE_BASE = 0,
+ STATE_FIRST_QUOTE = 1,
+ STATE_INSIDE_QUOTE = 2,
+ STATE_AFTER_QUOTE = 3,
+ STATE_FIRST_CURR = 4,
+ STATE_SECOND_CURR = 5,
+ STATE_THIRD_CURR = 6,
+ STATE_FOURTH_CURR = 7,
+ STATE_FIFTH_CURR = 8,
+ STATE_OVERFLOW_CURR = 9
+};
+
+// enum AffixPatternType defined in internals.h
+
+struct AffixTag {
+ int32_t offset;
+ UChar32 codePoint;
+ AffixPatternState state;
+ AffixPatternType type;
+
+ AffixTag()
+ : offset(0), state(STATE_BASE) {}
+
+ AffixTag(int32_t offset)
+ : offset(offset) {}
+
+ AffixTag(int32_t offset, UChar32 codePoint, AffixPatternState state, AffixPatternType type)
+ : offset(offset), codePoint(codePoint), state(state), type(type) {}
+};
+
+class TokenConsumer {
+ public:
+ virtual ~TokenConsumer();
+
+ virtual void consumeToken(AffixPatternType type, UChar32 cp, UErrorCode& status) = 0;
+};
+
+// Exported as U_I18N_API because it is a base class for other exported types
+class U_I18N_API SymbolProvider {
+ public:
+ virtual ~SymbolProvider();
+
+ // TODO: Could this be more efficient if it returned by reference?
+ virtual UnicodeString getSymbol(AffixPatternType type) const = 0;
+};
+
+/**
+ * Performs manipulations on affix patterns: the prefix and suffix strings associated with a decimal
+ * format pattern. For example:
+ *
+ * <table>
+ * <tr><th>Affix Pattern</th><th>Example Unescaped (Formatted) String</th></tr>
+ * <tr><td>abc</td><td>abc</td></tr>
+ * <tr><td>ab-</td><td>ab−</td></tr>
+ * <tr><td>ab'-'</td><td>ab-</td></tr>
+ * <tr><td>ab''</td><td>ab'</td></tr>
+ * </table>
+ *
+ * To manually iterate over tokens in a literal string, use the following pattern, which is designed
+ * to be efficient.
+ *
+ * <pre>
+ * long tag = 0L;
+ * while (AffixPatternUtils.hasNext(tag, patternString)) {
+ * tag = AffixPatternUtils.nextToken(tag, patternString);
+ * int typeOrCp = AffixPatternUtils.getTypeOrCp(tag);
+ * switch (typeOrCp) {
+ * case AffixPatternUtils.TYPE_MINUS_SIGN:
+ * // Current token is a minus sign.
+ * break;
+ * case AffixPatternUtils.TYPE_PLUS_SIGN:
+ * // Current token is a plus sign.
+ * break;
+ * case AffixPatternUtils.TYPE_PERCENT:
+ * // Current token is a percent sign.
+ * break;
+ * // ... other types ...
+ * default:
+ * // Current token is an arbitrary code point.
+ * // The variable typeOrCp is the code point.
+ * break;
+ * }
+ * }
+ * </pre>
+ */
+class U_I18N_API AffixUtils {
+
+ public:
+
+ /**
+ * Estimates the number of code points present in an unescaped version of the affix pattern string
+ * (one that would be returned by {@link #unescape}), assuming that all interpolated symbols
+ * consume one code point and that currencies consume as many code points as their symbol width.
+ * Used for computing padding width.
+ *
+ * @param patternString The original string whose width will be estimated.
+ * @return The length of the unescaped string.
+ */
+ static int32_t estimateLength(const UnicodeString& patternString, UErrorCode& status);
+
+ /**
+ * Takes a string and escapes (quotes) characters that have special meaning in the affix pattern
+ * syntax. This function does not reverse-lookup symbols.
+ *
+ * <p>Example input: "-$x"; example output: "'-'$x"
+ *
+ * @param input The string to be escaped.
+ * @return The resulting UnicodeString.
+ */
+ static UnicodeString escape(const UnicodeString& input);
+
+ static Field getFieldForType(AffixPatternType type);
+
+ /**
+ * Executes the unescape state machine. Replaces the unquoted characters "-", "+", "%", "‰", and
+ * "¤" with the corresponding symbols provided by the {@link SymbolProvider}, and inserts the
+ * result into the FormattedStringBuilder at the requested location.
+ *
+ * <p>Example input: "'-'¤x"; example output: "-$x"
+ *
+ * @param affixPattern The original string to be unescaped.
+ * @param output The FormattedStringBuilder to mutate with the result.
+ * @param position The index into the FormattedStringBuilder to insert the string.
+ * @param provider An object to generate locale symbols.
+ */
+ static int32_t unescape(const UnicodeString& affixPattern, FormattedStringBuilder& output,
+ int32_t position, const SymbolProvider& provider, Field field,
+ UErrorCode& status);
+
+ /**
+ * Sames as {@link #unescape}, but only calculates the code point count. More efficient than {@link #unescape}
+ * if you only need the length but not the string itself.
+ *
+ * @param affixPattern The original string to be unescaped.
+ * @param provider An object to generate locale symbols.
+ * @return The same return value as if you called {@link #unescape}.
+ */
+ static int32_t unescapedCodePointCount(const UnicodeString& affixPattern,
+ const SymbolProvider& provider, UErrorCode& status);
+
+ /**
+ * Checks whether the given affix pattern contains at least one token of the given type, which is
+ * one of the constants "TYPE_" in {@link AffixPatternUtils}.
+ *
+ * @param affixPattern The affix pattern to check.
+ * @param type The token type.
+ * @return true if the affix pattern contains the given token type; false otherwise.
+ */
+ static bool containsType(const UnicodeString& affixPattern, AffixPatternType type, UErrorCode& status);
+
+ /**
+ * Checks whether the specified affix pattern has any unquoted currency symbols ("¤").
+ *
+ * @param affixPattern The string to check for currency symbols.
+ * @return true if the literal has at least one unquoted currency symbol; false otherwise.
+ */
+ static bool hasCurrencySymbols(const UnicodeString& affixPattern, UErrorCode& status);
+
+ /**
+ * Replaces all occurrences of tokens with the given type with the given replacement char.
+ *
+ * @param affixPattern The source affix pattern (does not get modified).
+ * @param type The token type.
+ * @param replacementChar The char to substitute in place of chars of the given token type.
+ * @return A string containing the new affix pattern.
+ */
+ static UnicodeString replaceType(const UnicodeString& affixPattern, AffixPatternType type,
+ char16_t replacementChar, UErrorCode& status);
+
+ /**
+ * Returns whether the given affix pattern contains only symbols and ignorables as defined by the
+ * given ignorables set.
+ */
+ static bool containsOnlySymbolsAndIgnorables(const UnicodeString& affixPattern,
+ const UnicodeSet& ignorables, UErrorCode& status);
+
+ /**
+ * Iterates over the affix pattern, calling the TokenConsumer for each token.
+ */
+ static void iterateWithConsumer(const UnicodeString& affixPattern, TokenConsumer& consumer,
+ UErrorCode& status);
+
+ /**
+ * Returns the next token from the affix pattern.
+ *
+ * @param tag A bitmask used for keeping track of state from token to token. The initial value
+ * should be 0L.
+ * @param patternString The affix pattern.
+ * @return The bitmask tag to pass to the next call of this method to retrieve the following token
+ * (never negative), or -1 if there were no more tokens in the affix pattern.
+ * @see #hasNext
+ */
+ static AffixTag nextToken(AffixTag tag, const UnicodeString& patternString, UErrorCode& status);
+
+ /**
+ * Returns whether the affix pattern string has any more tokens to be retrieved from a call to
+ * {@link #nextToken}.
+ *
+ * @param tag The bitmask tag of the previous token, as returned by {@link #nextToken}.
+ * @param string The affix pattern.
+ * @return true if there are more tokens to consume; false otherwise.
+ */
+ static bool hasNext(const AffixTag& tag, const UnicodeString& string);
+
+ private:
+ /**
+ * Encodes the given values into a tag struct.
+ * The order of the arguments is consistent with Java, but the order of the stored
+ * fields is not necessarily the same.
+ */
+ static inline AffixTag makeTag(int32_t offset, AffixPatternType type, AffixPatternState state,
+ UChar32 cp) {
+ return {offset, cp, state, type};
+ }
+};
+
+} // namespace impl
+} // namespace number
+U_NAMESPACE_END
+
+
+#endif //__NUMBER_AFFIXUTILS_H__
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_asformat.cpp b/contrib/libs/icu/i18n/number_asformat.cpp
index 31df5740b7..9d10d1f558 100644
--- a/contrib/libs/icu/i18n/number_asformat.cpp
+++ b/contrib/libs/icu/i18n/number_asformat.cpp
@@ -1,117 +1,117 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include <stdlib.h>
-#include <cmath>
-#include "number_asformat.h"
-#include "number_types.h"
-#include "number_utils.h"
-#include "fphdlimp.h"
-#include "number_utypes.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LocalizedNumberFormatterAsFormat)
-
-LocalizedNumberFormatterAsFormat::LocalizedNumberFormatterAsFormat(
- const LocalizedNumberFormatter& formatter, const Locale& locale)
- : fFormatter(formatter), fLocale(locale) {
- const char* localeName = locale.getName();
- setLocaleIDs(localeName, localeName);
-}
-
-LocalizedNumberFormatterAsFormat::~LocalizedNumberFormatterAsFormat() = default;
-
-UBool LocalizedNumberFormatterAsFormat::operator==(const Format& other) const {
- auto* _other = dynamic_cast<const LocalizedNumberFormatterAsFormat*>(&other);
- if (_other == nullptr) {
- return false;
- }
- // TODO: Change this to use LocalizedNumberFormatter::operator== if it is ever proposed.
- // This implementation is fine, but not particularly efficient.
- UErrorCode localStatus = U_ZERO_ERROR;
- return fFormatter.toSkeleton(localStatus) == _other->fFormatter.toSkeleton(localStatus);
-}
-
-LocalizedNumberFormatterAsFormat* LocalizedNumberFormatterAsFormat::clone() const {
- return new LocalizedNumberFormatterAsFormat(*this);
-}
-
-UnicodeString& LocalizedNumberFormatterAsFormat::format(const Formattable& obj, UnicodeString& appendTo,
- FieldPosition& pos, UErrorCode& status) const {
- if (U_FAILURE(status)) { return appendTo; }
- UFormattedNumberData data;
- obj.populateDecimalQuantity(data.quantity, status);
- if (U_FAILURE(status)) {
- return appendTo;
- }
- fFormatter.formatImpl(&data, status);
- if (U_FAILURE(status)) {
- return appendTo;
- }
- // always return first occurrence:
- pos.setBeginIndex(0);
- pos.setEndIndex(0);
- bool found = data.nextFieldPosition(pos, status);
- if (found && appendTo.length() != 0) {
- pos.setBeginIndex(pos.getBeginIndex() + appendTo.length());
- pos.setEndIndex(pos.getEndIndex() + appendTo.length());
- }
- appendTo.append(data.toTempString(status));
- return appendTo;
-}
-
-UnicodeString& LocalizedNumberFormatterAsFormat::format(const Formattable& obj, UnicodeString& appendTo,
- FieldPositionIterator* posIter,
- UErrorCode& status) const {
- if (U_FAILURE(status)) { return appendTo; }
- UFormattedNumberData data;
- obj.populateDecimalQuantity(data.quantity, status);
- if (U_FAILURE(status)) {
- return appendTo;
- }
- fFormatter.formatImpl(&data, status);
- if (U_FAILURE(status)) {
- return appendTo;
- }
- appendTo.append(data.toTempString(status));
- if (posIter != nullptr) {
- FieldPositionIteratorHandler fpih(posIter, status);
- data.getAllFieldPositions(fpih, status);
- }
- return appendTo;
-}
-
-void LocalizedNumberFormatterAsFormat::parseObject(const UnicodeString&, Formattable&,
- ParsePosition& parse_pos) const {
- // Not supported.
- parse_pos.setErrorIndex(0);
-}
-
-const LocalizedNumberFormatter& LocalizedNumberFormatterAsFormat::getNumberFormatter() const {
- return fFormatter;
-}
-
-
-// Definitions of public API methods (put here for dependency disentanglement)
-
-Format* LocalizedNumberFormatter::toFormat(UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return nullptr;
- }
- LocalPointer<LocalizedNumberFormatterAsFormat> retval(
- new LocalizedNumberFormatterAsFormat(*this, fMacros.locale), status);
- return retval.orphan();
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include <stdlib.h>
+#include <cmath>
+#include "number_asformat.h"
+#include "number_types.h"
+#include "number_utils.h"
+#include "fphdlimp.h"
+#include "number_utypes.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LocalizedNumberFormatterAsFormat)
+
+LocalizedNumberFormatterAsFormat::LocalizedNumberFormatterAsFormat(
+ const LocalizedNumberFormatter& formatter, const Locale& locale)
+ : fFormatter(formatter), fLocale(locale) {
+ const char* localeName = locale.getName();
+ setLocaleIDs(localeName, localeName);
+}
+
+LocalizedNumberFormatterAsFormat::~LocalizedNumberFormatterAsFormat() = default;
+
+UBool LocalizedNumberFormatterAsFormat::operator==(const Format& other) const {
+ auto* _other = dynamic_cast<const LocalizedNumberFormatterAsFormat*>(&other);
+ if (_other == nullptr) {
+ return false;
+ }
+ // TODO: Change this to use LocalizedNumberFormatter::operator== if it is ever proposed.
+ // This implementation is fine, but not particularly efficient.
+ UErrorCode localStatus = U_ZERO_ERROR;
+ return fFormatter.toSkeleton(localStatus) == _other->fFormatter.toSkeleton(localStatus);
+}
+
+LocalizedNumberFormatterAsFormat* LocalizedNumberFormatterAsFormat::clone() const {
+ return new LocalizedNumberFormatterAsFormat(*this);
+}
+
+UnicodeString& LocalizedNumberFormatterAsFormat::format(const Formattable& obj, UnicodeString& appendTo,
+ FieldPosition& pos, UErrorCode& status) const {
+ if (U_FAILURE(status)) { return appendTo; }
+ UFormattedNumberData data;
+ obj.populateDecimalQuantity(data.quantity, status);
+ if (U_FAILURE(status)) {
+ return appendTo;
+ }
+ fFormatter.formatImpl(&data, status);
+ if (U_FAILURE(status)) {
+ return appendTo;
+ }
+ // always return first occurrence:
+ pos.setBeginIndex(0);
+ pos.setEndIndex(0);
+ bool found = data.nextFieldPosition(pos, status);
+ if (found && appendTo.length() != 0) {
+ pos.setBeginIndex(pos.getBeginIndex() + appendTo.length());
+ pos.setEndIndex(pos.getEndIndex() + appendTo.length());
+ }
+ appendTo.append(data.toTempString(status));
+ return appendTo;
+}
+
+UnicodeString& LocalizedNumberFormatterAsFormat::format(const Formattable& obj, UnicodeString& appendTo,
+ FieldPositionIterator* posIter,
+ UErrorCode& status) const {
+ if (U_FAILURE(status)) { return appendTo; }
+ UFormattedNumberData data;
+ obj.populateDecimalQuantity(data.quantity, status);
+ if (U_FAILURE(status)) {
+ return appendTo;
+ }
+ fFormatter.formatImpl(&data, status);
+ if (U_FAILURE(status)) {
+ return appendTo;
+ }
+ appendTo.append(data.toTempString(status));
+ if (posIter != nullptr) {
+ FieldPositionIteratorHandler fpih(posIter, status);
+ data.getAllFieldPositions(fpih, status);
+ }
+ return appendTo;
+}
+
+void LocalizedNumberFormatterAsFormat::parseObject(const UnicodeString&, Formattable&,
+ ParsePosition& parse_pos) const {
+ // Not supported.
+ parse_pos.setErrorIndex(0);
+}
+
+const LocalizedNumberFormatter& LocalizedNumberFormatterAsFormat::getNumberFormatter() const {
+ return fFormatter;
+}
+
+
+// Definitions of public API methods (put here for dependency disentanglement)
+
+Format* LocalizedNumberFormatter::toFormat(UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ LocalPointer<LocalizedNumberFormatterAsFormat> retval(
+ new LocalizedNumberFormatterAsFormat(*this, fMacros.locale), status);
+ return retval.orphan();
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_asformat.h b/contrib/libs/icu/i18n/number_asformat.h
index 64f5504cfe..7b0a1dee6f 100644
--- a/contrib/libs/icu/i18n/number_asformat.h
+++ b/contrib/libs/icu/i18n/number_asformat.h
@@ -1,107 +1,107 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMBER_ASFORMAT_H__
-#define __NUMBER_ASFORMAT_H__
-
-#include "unicode/numberformatter.h"
-#include "number_types.h"
-#include "number_decimalquantity.h"
-#include "number_scientific.h"
-#include "number_patternstring.h"
-#include "number_modifiers.h"
-#include "number_multiplier.h"
-#include "number_roundingutils.h"
-#include "decNumber.h"
-#include "charstr.h"
-
-U_NAMESPACE_BEGIN namespace number {
-namespace impl {
-
-/**
- * A wrapper around LocalizedNumberFormatter implementing the Format interface, enabling improved
- * compatibility with other APIs.
- *
- * @draft ICU 62
- * @see NumberFormatter
- */
-class U_I18N_API LocalizedNumberFormatterAsFormat : public Format {
- public:
- LocalizedNumberFormatterAsFormat(const LocalizedNumberFormatter& formatter, const Locale& locale);
-
- /**
- * Destructor.
- */
- ~LocalizedNumberFormatterAsFormat() U_OVERRIDE;
-
- /**
- * Equals operator.
- */
- UBool operator==(const Format& other) const U_OVERRIDE;
-
- /**
- * Creates a copy of this object.
- */
- LocalizedNumberFormatterAsFormat* clone() const U_OVERRIDE;
-
- /**
- * Formats a Number using the wrapped LocalizedNumberFormatter. The provided formattable must be a
- * number type.
- */
- UnicodeString& format(const Formattable& obj, UnicodeString& appendTo, FieldPosition& pos,
- UErrorCode& status) const U_OVERRIDE;
-
- /**
- * Formats a Number using the wrapped LocalizedNumberFormatter. The provided formattable must be a
- * number type.
- */
- UnicodeString& format(const Formattable& obj, UnicodeString& appendTo, FieldPositionIterator* posIter,
- UErrorCode& status) const U_OVERRIDE;
-
- /**
- * Not supported: sets an error index and returns.
- */
- void parseObject(const UnicodeString& source, Formattable& result,
- ParsePosition& parse_pos) const U_OVERRIDE;
-
- /**
- * Gets the LocalizedNumberFormatter that this wrapper class uses to format numbers.
- *
- * For maximum efficiency, this function returns by const reference. You must copy the return value
- * into a local variable if you want to use it beyond the lifetime of the current object:
- *
- * <pre>
- * LocalizedNumberFormatter localFormatter = fmt->getNumberFormatter();
- * </pre>
- *
- * You can however use the return value directly when chaining:
- *
- * <pre>
- * FormattedNumber result = fmt->getNumberFormatter().formatDouble(514.23, status);
- * </pre>
- *
- * @return The unwrapped LocalizedNumberFormatter.
- */
- const LocalizedNumberFormatter& getNumberFormatter() const;
-
- UClassID getDynamicClassID() const U_OVERRIDE;
- static UClassID U_EXPORT2 getStaticClassID();
-
- private:
- LocalizedNumberFormatter fFormatter;
-
- // Even though the locale is inside the LocalizedNumberFormatter, we have to keep it here, too, because
- // LocalizedNumberFormatter doesn't have a getLocale() method, and ICU-TC didn't want to add one.
- Locale fLocale;
-};
-
-} // namespace impl
-} // namespace number
-U_NAMESPACE_END
-
-#endif // __NUMBER_ASFORMAT_H__
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMBER_ASFORMAT_H__
+#define __NUMBER_ASFORMAT_H__
+
+#include "unicode/numberformatter.h"
+#include "number_types.h"
+#include "number_decimalquantity.h"
+#include "number_scientific.h"
+#include "number_patternstring.h"
+#include "number_modifiers.h"
+#include "number_multiplier.h"
+#include "number_roundingutils.h"
+#include "decNumber.h"
+#include "charstr.h"
+
+U_NAMESPACE_BEGIN namespace number {
+namespace impl {
+
+/**
+ * A wrapper around LocalizedNumberFormatter implementing the Format interface, enabling improved
+ * compatibility with other APIs.
+ *
+ * @draft ICU 62
+ * @see NumberFormatter
+ */
+class U_I18N_API LocalizedNumberFormatterAsFormat : public Format {
+ public:
+ LocalizedNumberFormatterAsFormat(const LocalizedNumberFormatter& formatter, const Locale& locale);
+
+ /**
+ * Destructor.
+ */
+ ~LocalizedNumberFormatterAsFormat() U_OVERRIDE;
+
+ /**
+ * Equals operator.
+ */
+ UBool operator==(const Format& other) const U_OVERRIDE;
+
+ /**
+ * Creates a copy of this object.
+ */
+ LocalizedNumberFormatterAsFormat* clone() const U_OVERRIDE;
+
+ /**
+ * Formats a Number using the wrapped LocalizedNumberFormatter. The provided formattable must be a
+ * number type.
+ */
+ UnicodeString& format(const Formattable& obj, UnicodeString& appendTo, FieldPosition& pos,
+ UErrorCode& status) const U_OVERRIDE;
+
+ /**
+ * Formats a Number using the wrapped LocalizedNumberFormatter. The provided formattable must be a
+ * number type.
+ */
+ UnicodeString& format(const Formattable& obj, UnicodeString& appendTo, FieldPositionIterator* posIter,
+ UErrorCode& status) const U_OVERRIDE;
+
+ /**
+ * Not supported: sets an error index and returns.
+ */
+ void parseObject(const UnicodeString& source, Formattable& result,
+ ParsePosition& parse_pos) const U_OVERRIDE;
+
+ /**
+ * Gets the LocalizedNumberFormatter that this wrapper class uses to format numbers.
+ *
+ * For maximum efficiency, this function returns by const reference. You must copy the return value
+ * into a local variable if you want to use it beyond the lifetime of the current object:
+ *
+ * <pre>
+ * LocalizedNumberFormatter localFormatter = fmt->getNumberFormatter();
+ * </pre>
+ *
+ * You can however use the return value directly when chaining:
+ *
+ * <pre>
+ * FormattedNumber result = fmt->getNumberFormatter().formatDouble(514.23, status);
+ * </pre>
+ *
+ * @return The unwrapped LocalizedNumberFormatter.
+ */
+ const LocalizedNumberFormatter& getNumberFormatter() const;
+
+ UClassID getDynamicClassID() const U_OVERRIDE;
+ static UClassID U_EXPORT2 getStaticClassID();
+
+ private:
+ LocalizedNumberFormatter fFormatter;
+
+ // Even though the locale is inside the LocalizedNumberFormatter, we have to keep it here, too, because
+ // LocalizedNumberFormatter doesn't have a getLocale() method, and ICU-TC didn't want to add one.
+ Locale fLocale;
+};
+
+} // namespace impl
+} // namespace number
+U_NAMESPACE_END
+
+#endif // __NUMBER_ASFORMAT_H__
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_capi.cpp b/contrib/libs/icu/i18n/number_capi.cpp
index 3794bfcf5d..21a600d6ab 100644
--- a/contrib/libs/icu/i18n/number_capi.cpp
+++ b/contrib/libs/icu/i18n/number_capi.cpp
@@ -1,234 +1,234 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include "fphdlimp.h"
-#include "number_utypes.h"
-#include "numparse_types.h"
-#include "formattedval_impl.h"
-#include "unicode/numberformatter.h"
-#include "unicode/unumberformatter.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-
-U_NAMESPACE_BEGIN
-namespace number {
-namespace impl {
-
-/**
- * Implementation class for UNumberFormatter. Wraps a LocalizedNumberFormatter.
- */
-struct UNumberFormatterData : public UMemory,
- // Magic number as ASCII == "NFR" (NumberFormatteR)
- public IcuCApiHelper<UNumberFormatter, UNumberFormatterData, 0x4E465200> {
- LocalizedNumberFormatter fFormatter;
-};
-
-struct UFormattedNumberImpl;
-
-// Magic number as ASCII == "FDN" (FormatteDNumber)
-typedef IcuCApiHelper<UFormattedNumber, UFormattedNumberImpl, 0x46444E00> UFormattedNumberApiHelper;
-
-struct UFormattedNumberImpl : public UFormattedValueImpl, public UFormattedNumberApiHelper {
- UFormattedNumberImpl();
- ~UFormattedNumberImpl();
-
- FormattedNumber fImpl;
- UFormattedNumberData fData;
-};
-
-UFormattedNumberImpl::UFormattedNumberImpl()
- : fImpl(&fData) {
- fFormattedValue = &fImpl;
-}
-
-UFormattedNumberImpl::~UFormattedNumberImpl() {
- // Disown the data from fImpl so it doesn't get deleted twice
- fImpl.fData = nullptr;
-}
-
-}
-}
-U_NAMESPACE_END
-
-
-UPRV_FORMATTED_VALUE_CAPI_NO_IMPLTYPE_AUTO_IMPL(
- UFormattedNumber,
- UFormattedNumberImpl,
- UFormattedNumberApiHelper,
- unumf)
-
-
-const DecimalQuantity* icu::number::impl::validateUFormattedNumberToDecimalQuantity(
- const UFormattedNumber* uresult, UErrorCode& status) {
- auto* result = UFormattedNumberApiHelper::validate(uresult, status);
- if (U_FAILURE(status)) {
- return nullptr;
- }
- return &result->fData.quantity;
-}
-
-
-
-U_CAPI UNumberFormatter* U_EXPORT2
-unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const char* locale,
- UErrorCode* ec) {
- auto* impl = new UNumberFormatterData();
- if (impl == nullptr) {
- *ec = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
- // Readonly-alias constructor (first argument is whether we are NUL-terminated)
- UnicodeString skeletonString(skeletonLen == -1, skeleton, skeletonLen);
- impl->fFormatter = NumberFormatter::forSkeleton(skeletonString, *ec).locale(locale);
- return impl->exportForC();
-}
-
-U_CAPI UNumberFormatter* U_EXPORT2
-unumf_openForSkeletonAndLocaleWithError(const UChar* skeleton, int32_t skeletonLen, const char* locale,
- UParseError* perror, UErrorCode* ec) {
- auto* impl = new UNumberFormatterData();
- if (impl == nullptr) {
- *ec = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
- // Readonly-alias constructor (first argument is whether we are NUL-terminated)
- UnicodeString skeletonString(skeletonLen == -1, skeleton, skeletonLen);
- impl->fFormatter = NumberFormatter::forSkeleton(skeletonString, *perror, *ec).locale(locale);
- return impl->exportForC();
-}
-
-U_CAPI void U_EXPORT2
-unumf_formatInt(const UNumberFormatter* uformatter, int64_t value, UFormattedNumber* uresult,
- UErrorCode* ec) {
- const UNumberFormatterData* formatter = UNumberFormatterData::validate(uformatter, *ec);
- auto* result = UFormattedNumberApiHelper::validate(uresult, *ec);
- if (U_FAILURE(*ec)) { return; }
-
- result->fData.getStringRef().clear();
- result->fData.quantity.setToLong(value);
- formatter->fFormatter.formatImpl(&result->fData, *ec);
-}
-
-U_CAPI void U_EXPORT2
-unumf_formatDouble(const UNumberFormatter* uformatter, double value, UFormattedNumber* uresult,
- UErrorCode* ec) {
- const UNumberFormatterData* formatter = UNumberFormatterData::validate(uformatter, *ec);
- auto* result = UFormattedNumberApiHelper::validate(uresult, *ec);
- if (U_FAILURE(*ec)) { return; }
-
- result->fData.getStringRef().clear();
- result->fData.quantity.setToDouble(value);
- formatter->fFormatter.formatImpl(&result->fData, *ec);
-}
-
-U_CAPI void U_EXPORT2
-unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32_t valueLen,
- UFormattedNumber* uresult, UErrorCode* ec) {
- const UNumberFormatterData* formatter = UNumberFormatterData::validate(uformatter, *ec);
- auto* result = UFormattedNumberApiHelper::validate(uresult, *ec);
- if (U_FAILURE(*ec)) { return; }
-
- result->fData.getStringRef().clear();
- result->fData.quantity.setToDecNumber({value, valueLen}, *ec);
- if (U_FAILURE(*ec)) { return; }
- formatter->fFormatter.formatImpl(&result->fData, *ec);
-}
-
-U_CAPI int32_t U_EXPORT2
-unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t bufferCapacity,
- UErrorCode* ec) {
- const auto* result = UFormattedNumberApiHelper::validate(uresult, *ec);
- if (U_FAILURE(*ec)) { return 0; }
-
- if (buffer == nullptr ? bufferCapacity != 0 : bufferCapacity < 0) {
- *ec = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- return result->fData.toTempString(*ec).extract(buffer, bufferCapacity, *ec);
-}
-
-U_CAPI UBool U_EXPORT2
-unumf_resultNextFieldPosition(const UFormattedNumber* uresult, UFieldPosition* ufpos, UErrorCode* ec) {
- const auto* result = UFormattedNumberApiHelper::validate(uresult, *ec);
- if (U_FAILURE(*ec)) { return FALSE; }
-
- if (ufpos == nullptr) {
- *ec = U_ILLEGAL_ARGUMENT_ERROR;
- return FALSE;
- }
-
- FieldPosition fp;
- fp.setField(ufpos->field);
- fp.setBeginIndex(ufpos->beginIndex);
- fp.setEndIndex(ufpos->endIndex);
- bool retval = result->fData.nextFieldPosition(fp, *ec);
- ufpos->beginIndex = fp.getBeginIndex();
- ufpos->endIndex = fp.getEndIndex();
- // NOTE: MSVC sometimes complains when implicitly converting between bool and UBool
- return retval ? TRUE : FALSE;
-}
-
-U_CAPI void U_EXPORT2
-unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPositionIterator* ufpositer,
- UErrorCode* ec) {
- const auto* result = UFormattedNumberApiHelper::validate(uresult, *ec);
- if (U_FAILURE(*ec)) { return; }
-
- if (ufpositer == nullptr) {
- *ec = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- auto* fpi = reinterpret_cast<FieldPositionIterator*>(ufpositer);
- FieldPositionIteratorHandler fpih(fpi, *ec);
- result->fData.getAllFieldPositions(fpih, *ec);
-}
-
-U_CAPI void U_EXPORT2
-unumf_close(UNumberFormatter* f) {
- UErrorCode localStatus = U_ZERO_ERROR;
- const UNumberFormatterData* impl = UNumberFormatterData::validate(f, localStatus);
- delete impl;
-}
-
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include "fphdlimp.h"
+#include "number_utypes.h"
+#include "numparse_types.h"
+#include "formattedval_impl.h"
+#include "unicode/numberformatter.h"
+#include "unicode/unumberformatter.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+
+U_NAMESPACE_BEGIN
+namespace number {
+namespace impl {
+
+/**
+ * Implementation class for UNumberFormatter. Wraps a LocalizedNumberFormatter.
+ */
+struct UNumberFormatterData : public UMemory,
+ // Magic number as ASCII == "NFR" (NumberFormatteR)
+ public IcuCApiHelper<UNumberFormatter, UNumberFormatterData, 0x4E465200> {
+ LocalizedNumberFormatter fFormatter;
+};
+
+struct UFormattedNumberImpl;
+
+// Magic number as ASCII == "FDN" (FormatteDNumber)
+typedef IcuCApiHelper<UFormattedNumber, UFormattedNumberImpl, 0x46444E00> UFormattedNumberApiHelper;
+
+struct UFormattedNumberImpl : public UFormattedValueImpl, public UFormattedNumberApiHelper {
+ UFormattedNumberImpl();
+ ~UFormattedNumberImpl();
+
+ FormattedNumber fImpl;
+ UFormattedNumberData fData;
+};
+
+UFormattedNumberImpl::UFormattedNumberImpl()
+ : fImpl(&fData) {
+ fFormattedValue = &fImpl;
+}
+
+UFormattedNumberImpl::~UFormattedNumberImpl() {
+ // Disown the data from fImpl so it doesn't get deleted twice
+ fImpl.fData = nullptr;
+}
+
+}
+}
+U_NAMESPACE_END
+
+
+UPRV_FORMATTED_VALUE_CAPI_NO_IMPLTYPE_AUTO_IMPL(
+ UFormattedNumber,
+ UFormattedNumberImpl,
+ UFormattedNumberApiHelper,
+ unumf)
+
+
+const DecimalQuantity* icu::number::impl::validateUFormattedNumberToDecimalQuantity(
+ const UFormattedNumber* uresult, UErrorCode& status) {
+ auto* result = UFormattedNumberApiHelper::validate(uresult, status);
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ return &result->fData.quantity;
+}
+
+
+
+U_CAPI UNumberFormatter* U_EXPORT2
+unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const char* locale,
+ UErrorCode* ec) {
+ auto* impl = new UNumberFormatterData();
+ if (impl == nullptr) {
+ *ec = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+ // Readonly-alias constructor (first argument is whether we are NUL-terminated)
+ UnicodeString skeletonString(skeletonLen == -1, skeleton, skeletonLen);
+ impl->fFormatter = NumberFormatter::forSkeleton(skeletonString, *ec).locale(locale);
+ return impl->exportForC();
+}
+
+U_CAPI UNumberFormatter* U_EXPORT2
+unumf_openForSkeletonAndLocaleWithError(const UChar* skeleton, int32_t skeletonLen, const char* locale,
+ UParseError* perror, UErrorCode* ec) {
+ auto* impl = new UNumberFormatterData();
+ if (impl == nullptr) {
+ *ec = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+ // Readonly-alias constructor (first argument is whether we are NUL-terminated)
+ UnicodeString skeletonString(skeletonLen == -1, skeleton, skeletonLen);
+ impl->fFormatter = NumberFormatter::forSkeleton(skeletonString, *perror, *ec).locale(locale);
+ return impl->exportForC();
+}
+
+U_CAPI void U_EXPORT2
+unumf_formatInt(const UNumberFormatter* uformatter, int64_t value, UFormattedNumber* uresult,
+ UErrorCode* ec) {
+ const UNumberFormatterData* formatter = UNumberFormatterData::validate(uformatter, *ec);
+ auto* result = UFormattedNumberApiHelper::validate(uresult, *ec);
+ if (U_FAILURE(*ec)) { return; }
+
+ result->fData.getStringRef().clear();
+ result->fData.quantity.setToLong(value);
+ formatter->fFormatter.formatImpl(&result->fData, *ec);
+}
+
+U_CAPI void U_EXPORT2
+unumf_formatDouble(const UNumberFormatter* uformatter, double value, UFormattedNumber* uresult,
+ UErrorCode* ec) {
+ const UNumberFormatterData* formatter = UNumberFormatterData::validate(uformatter, *ec);
+ auto* result = UFormattedNumberApiHelper::validate(uresult, *ec);
+ if (U_FAILURE(*ec)) { return; }
+
+ result->fData.getStringRef().clear();
+ result->fData.quantity.setToDouble(value);
+ formatter->fFormatter.formatImpl(&result->fData, *ec);
+}
+
+U_CAPI void U_EXPORT2
+unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32_t valueLen,
+ UFormattedNumber* uresult, UErrorCode* ec) {
+ const UNumberFormatterData* formatter = UNumberFormatterData::validate(uformatter, *ec);
+ auto* result = UFormattedNumberApiHelper::validate(uresult, *ec);
+ if (U_FAILURE(*ec)) { return; }
+
+ result->fData.getStringRef().clear();
+ result->fData.quantity.setToDecNumber({value, valueLen}, *ec);
+ if (U_FAILURE(*ec)) { return; }
+ formatter->fFormatter.formatImpl(&result->fData, *ec);
+}
+
+U_CAPI int32_t U_EXPORT2
+unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t bufferCapacity,
+ UErrorCode* ec) {
+ const auto* result = UFormattedNumberApiHelper::validate(uresult, *ec);
+ if (U_FAILURE(*ec)) { return 0; }
+
+ if (buffer == nullptr ? bufferCapacity != 0 : bufferCapacity < 0) {
+ *ec = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ return result->fData.toTempString(*ec).extract(buffer, bufferCapacity, *ec);
+}
+
+U_CAPI UBool U_EXPORT2
+unumf_resultNextFieldPosition(const UFormattedNumber* uresult, UFieldPosition* ufpos, UErrorCode* ec) {
+ const auto* result = UFormattedNumberApiHelper::validate(uresult, *ec);
+ if (U_FAILURE(*ec)) { return FALSE; }
+
+ if (ufpos == nullptr) {
+ *ec = U_ILLEGAL_ARGUMENT_ERROR;
+ return FALSE;
+ }
+
+ FieldPosition fp;
+ fp.setField(ufpos->field);
+ fp.setBeginIndex(ufpos->beginIndex);
+ fp.setEndIndex(ufpos->endIndex);
+ bool retval = result->fData.nextFieldPosition(fp, *ec);
+ ufpos->beginIndex = fp.getBeginIndex();
+ ufpos->endIndex = fp.getEndIndex();
+ // NOTE: MSVC sometimes complains when implicitly converting between bool and UBool
+ return retval ? TRUE : FALSE;
+}
+
+U_CAPI void U_EXPORT2
+unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPositionIterator* ufpositer,
+ UErrorCode* ec) {
+ const auto* result = UFormattedNumberApiHelper::validate(uresult, *ec);
+ if (U_FAILURE(*ec)) { return; }
+
+ if (ufpositer == nullptr) {
+ *ec = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ auto* fpi = reinterpret_cast<FieldPositionIterator*>(ufpositer);
+ FieldPositionIteratorHandler fpih(fpi, *ec);
+ result->fData.getAllFieldPositions(fpih, *ec);
+}
+
+U_CAPI void U_EXPORT2
+unumf_close(UNumberFormatter* f) {
+ UErrorCode localStatus = U_ZERO_ERROR;
+ const UNumberFormatterData* impl = UNumberFormatterData::validate(f, localStatus);
+ delete impl;
+}
+
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/contrib/libs/icu/i18n/number_compact.cpp b/contrib/libs/icu/i18n/number_compact.cpp
index 34d6006db2..e1fef8feb5 100644
--- a/contrib/libs/icu/i18n/number_compact.cpp
+++ b/contrib/libs/icu/i18n/number_compact.cpp
@@ -1,335 +1,335 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/ustring.h"
-#include "unicode/ures.h"
-#include "cstring.h"
-#include "charstr.h"
-#include "resource.h"
-#include "number_compact.h"
-#include "number_microprops.h"
-#include "uresimp.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-namespace {
-
-// A dummy object used when a "0" compact decimal entry is encountered. This is necessary
-// in order to prevent falling back to root. Object equality ("==") is intended.
-const UChar *USE_FALLBACK = u"<USE FALLBACK>";
-
-/** Produces a string like "NumberElements/latn/patternsShort/decimalFormat". */
-void getResourceBundleKey(const char *nsName, CompactStyle compactStyle, CompactType compactType,
- CharString &sb, UErrorCode &status) {
- sb.clear();
- sb.append("NumberElements/", status);
- sb.append(nsName, status);
- sb.append(compactStyle == CompactStyle::UNUM_SHORT ? "/patternsShort" : "/patternsLong", status);
- sb.append(compactType == CompactType::TYPE_DECIMAL ? "/decimalFormat" : "/currencyFormat", status);
-}
-
-int32_t getIndex(int32_t magnitude, StandardPlural::Form plural) {
- return magnitude * StandardPlural::COUNT + plural;
-}
-
-int32_t countZeros(const UChar *patternString, int32_t patternLength) {
- // NOTE: This strategy for computing the number of zeros is a hack for efficiency.
- // It could break if there are any 0s that aren't part of the main pattern.
- int32_t numZeros = 0;
- for (int32_t i = 0; i < patternLength; i++) {
- if (patternString[i] == u'0') {
- numZeros++;
- } else if (numZeros > 0) {
- break; // zeros should always be contiguous
- }
- }
- return numZeros;
-}
-
-} // namespace
-
-// NOTE: patterns and multipliers both get zero-initialized.
-CompactData::CompactData() : patterns(), multipliers(), largestMagnitude(0), isEmpty(TRUE) {
-}
-
-void CompactData::populate(const Locale &locale, const char *nsName, CompactStyle compactStyle,
- CompactType compactType, UErrorCode &status) {
- CompactDataSink sink(*this);
- LocalUResourceBundlePointer rb(ures_open(nullptr, locale.getName(), &status));
- if (U_FAILURE(status)) { return; }
-
- bool nsIsLatn = strcmp(nsName, "latn") == 0;
- bool compactIsShort = compactStyle == CompactStyle::UNUM_SHORT;
-
- // Fall back to latn numbering system and/or short compact style.
- CharString resourceKey;
- getResourceBundleKey(nsName, compactStyle, compactType, resourceKey, status);
- UErrorCode localStatus = U_ZERO_ERROR;
- ures_getAllItemsWithFallback(rb.getAlias(), resourceKey.data(), sink, localStatus);
- if (isEmpty && !nsIsLatn) {
- getResourceBundleKey("latn", compactStyle, compactType, resourceKey, status);
- localStatus = U_ZERO_ERROR;
- ures_getAllItemsWithFallback(rb.getAlias(), resourceKey.data(), sink, localStatus);
- }
- if (isEmpty && !compactIsShort) {
- getResourceBundleKey(nsName, CompactStyle::UNUM_SHORT, compactType, resourceKey, status);
- localStatus = U_ZERO_ERROR;
- ures_getAllItemsWithFallback(rb.getAlias(), resourceKey.data(), sink, localStatus);
- }
- if (isEmpty && !nsIsLatn && !compactIsShort) {
- getResourceBundleKey("latn", CompactStyle::UNUM_SHORT, compactType, resourceKey, status);
- localStatus = U_ZERO_ERROR;
- ures_getAllItemsWithFallback(rb.getAlias(), resourceKey.data(), sink, localStatus);
- }
-
- // The last fallback should be guaranteed to return data.
- if (isEmpty) {
- status = U_INTERNAL_PROGRAM_ERROR;
- }
-}
-
-int32_t CompactData::getMultiplier(int32_t magnitude) const {
- if (magnitude < 0) {
- return 0;
- }
- if (magnitude > largestMagnitude) {
- magnitude = largestMagnitude;
- }
- return multipliers[magnitude];
-}
-
-const UChar *CompactData::getPattern(int32_t magnitude, StandardPlural::Form plural) const {
- if (magnitude < 0) {
- return nullptr;
- }
- if (magnitude > largestMagnitude) {
- magnitude = largestMagnitude;
- }
- const UChar *patternString = patterns[getIndex(magnitude, plural)];
- if (patternString == nullptr && plural != StandardPlural::OTHER) {
- // Fall back to "other" plural variant
- patternString = patterns[getIndex(magnitude, StandardPlural::OTHER)];
- }
- if (patternString == USE_FALLBACK) { // == is intended
- // Return null if USE_FALLBACK is present
- patternString = nullptr;
- }
- return patternString;
-}
-
-void CompactData::getUniquePatterns(UVector &output, UErrorCode &status) const {
- U_ASSERT(output.isEmpty());
- // NOTE: In C++, this is done more manually with a UVector.
- // In Java, we can take advantage of JDK HashSet.
- for (auto pattern : patterns) {
- if (pattern == nullptr || pattern == USE_FALLBACK) {
- continue;
- }
-
- // Insert pattern into the UVector if the UVector does not already contain the pattern.
- // Search the UVector from the end since identical patterns are likely to be adjacent.
- for (int32_t i = output.size() - 1; i >= 0; i--) {
- if (u_strcmp(pattern, static_cast<const UChar *>(output[i])) == 0) {
- goto continue_outer;
- }
- }
-
- // The string was not found; add it to the UVector.
- // ANDY: This requires a const_cast. Why?
- output.addElement(const_cast<UChar *>(pattern), status);
-
- continue_outer:
- continue;
- }
-}
-
-void CompactData::CompactDataSink::put(const char *key, ResourceValue &value, UBool /*noFallback*/,
- UErrorCode &status) {
- // traverse into the table of powers of ten
- ResourceTable powersOfTenTable = value.getTable(status);
- if (U_FAILURE(status)) { return; }
- for (int i3 = 0; powersOfTenTable.getKeyAndValue(i3, key, value); ++i3) {
-
- // Assumes that the keys are always of the form "10000" where the magnitude is the
- // length of the key minus one. We expect magnitudes to be less than MAX_DIGITS.
- auto magnitude = static_cast<int8_t> (strlen(key) - 1);
- int8_t multiplier = data.multipliers[magnitude];
- U_ASSERT(magnitude < COMPACT_MAX_DIGITS);
-
- // Iterate over the plural variants ("one", "other", etc)
- ResourceTable pluralVariantsTable = value.getTable(status);
- if (U_FAILURE(status)) { return; }
- for (int i4 = 0; pluralVariantsTable.getKeyAndValue(i4, key, value); ++i4) {
-
- // Skip this magnitude/plural if we already have it from a child locale.
- // Note: This also skips USE_FALLBACK entries.
- StandardPlural::Form plural = StandardPlural::fromString(key, status);
- if (U_FAILURE(status)) { return; }
- if (data.patterns[getIndex(magnitude, plural)] != nullptr) {
- continue;
- }
-
- // The value "0" means that we need to use the default pattern and not fall back
- // to parent locales. Example locale where this is relevant: 'it'.
- int32_t patternLength;
- const UChar *patternString = value.getString(patternLength, status);
- if (U_FAILURE(status)) { return; }
- if (u_strcmp(patternString, u"0") == 0) {
- patternString = USE_FALLBACK;
- patternLength = 0;
- }
-
- // Save the pattern string. We will parse it lazily.
- data.patterns[getIndex(magnitude, plural)] = patternString;
-
- // If necessary, compute the multiplier: the difference between the magnitude
- // and the number of zeros in the pattern.
- if (multiplier == 0) {
- int32_t numZeros = countZeros(patternString, patternLength);
- if (numZeros > 0) { // numZeros==0 in certain cases, like Somali "Kun"
- multiplier = static_cast<int8_t> (numZeros - magnitude - 1);
- }
- }
- }
-
- // Save the multiplier.
- if (data.multipliers[magnitude] == 0) {
- data.multipliers[magnitude] = multiplier;
- if (magnitude > data.largestMagnitude) {
- data.largestMagnitude = magnitude;
- }
- data.isEmpty = false;
- } else {
- U_ASSERT(data.multipliers[magnitude] == multiplier);
- }
- }
-}
-
-///////////////////////////////////////////////////////////
-/// END OF CompactData.java; BEGIN CompactNotation.java ///
-///////////////////////////////////////////////////////////
-
-CompactHandler::CompactHandler(
- CompactStyle compactStyle,
- const Locale &locale,
- const char *nsName,
- CompactType compactType,
- const PluralRules *rules,
- MutablePatternModifier *buildReference,
- bool safe,
- const MicroPropsGenerator *parent,
- UErrorCode &status)
- : rules(rules), parent(parent), safe(safe) {
- data.populate(locale, nsName, compactStyle, compactType, status);
- if (safe) {
- // Safe code path
- precomputeAllModifiers(*buildReference, status);
- } else {
- // Unsafe code path
- // Store the MutablePatternModifier reference.
- unsafePatternModifier = buildReference;
- }
-}
-
-CompactHandler::~CompactHandler() {
- for (int32_t i = 0; i < precomputedModsLength; i++) {
- delete precomputedMods[i].mod;
- }
-}
-
-void CompactHandler::precomputeAllModifiers(MutablePatternModifier &buildReference, UErrorCode &status) {
- if (U_FAILURE(status)) { return; }
-
- // Initial capacity of 12 for 0K, 00K, 000K, ...M, ...B, and ...T
- UVector allPatterns(12, status);
- if (U_FAILURE(status)) { return; }
- data.getUniquePatterns(allPatterns, status);
- if (U_FAILURE(status)) { return; }
-
- // C++ only: ensure that precomputedMods has room.
- precomputedModsLength = allPatterns.size();
- if (precomputedMods.getCapacity() < precomputedModsLength) {
- precomputedMods.resize(allPatterns.size(), status);
- if (U_FAILURE(status)) { return; }
- }
-
- for (int32_t i = 0; i < precomputedModsLength; i++) {
- auto patternString = static_cast<const UChar *>(allPatterns[i]);
- UnicodeString hello(patternString);
- CompactModInfo &info = precomputedMods[i];
- ParsedPatternInfo patternInfo;
- PatternParser::parseToPatternInfo(UnicodeString(patternString), patternInfo, status);
- if (U_FAILURE(status)) { return; }
- buildReference.setPatternInfo(&patternInfo, {UFIELD_CATEGORY_NUMBER, UNUM_COMPACT_FIELD});
- info.mod = buildReference.createImmutable(status);
- if (U_FAILURE(status)) { return; }
- info.patternString = patternString;
- }
-}
-
-void CompactHandler::processQuantity(DecimalQuantity &quantity, MicroProps &micros,
- UErrorCode &status) const {
- parent->processQuantity(quantity, micros, status);
- if (U_FAILURE(status)) { return; }
-
- // Treat zero, NaN, and infinity as if they had magnitude 0
- int32_t magnitude;
- int32_t multiplier = 0;
- if (quantity.isZeroish()) {
- magnitude = 0;
- micros.rounder.apply(quantity, status);
- } else {
- // TODO: Revisit chooseMultiplierAndApply
- multiplier = micros.rounder.chooseMultiplierAndApply(quantity, data, status);
- magnitude = quantity.isZeroish() ? 0 : quantity.getMagnitude();
- magnitude -= multiplier;
- }
-
- StandardPlural::Form plural = utils::getStandardPlural(rules, quantity);
- const UChar *patternString = data.getPattern(magnitude, plural);
- if (patternString == nullptr) {
- // Use the default (non-compact) modifier.
- // No need to take any action.
- } else if (safe) {
- // Safe code path.
- // Java uses a hash set here for O(1) lookup. C++ uses a linear search.
- // TODO: Benchmark this and maybe change to a binary search or hash table.
- int32_t i = 0;
- for (; i < precomputedModsLength; i++) {
- const CompactModInfo &info = precomputedMods[i];
- if (u_strcmp(patternString, info.patternString) == 0) {
- info.mod->applyToMicros(micros, quantity, status);
- break;
- }
- }
- // It should be guaranteed that we found the entry.
- U_ASSERT(i < precomputedModsLength);
- } else {
- // Unsafe code path.
- // Overwrite the PatternInfo in the existing modMiddle.
- // C++ Note: Use unsafePatternInfo for proper lifecycle.
- ParsedPatternInfo &patternInfo = const_cast<CompactHandler *>(this)->unsafePatternInfo;
- PatternParser::parseToPatternInfo(UnicodeString(patternString), patternInfo, status);
- unsafePatternModifier->setPatternInfo(
- &unsafePatternInfo,
- {UFIELD_CATEGORY_NUMBER, UNUM_COMPACT_FIELD});
- unsafePatternModifier->setNumberProperties(quantity.signum(), StandardPlural::Form::COUNT);
- micros.modMiddle = unsafePatternModifier;
- }
-
- // Change the exponent only after we select appropriate plural form
- // for formatting purposes so that we preserve expected formatted
- // string behavior.
- quantity.adjustExponent(-1 * multiplier);
-
- // We already performed rounding. Do not perform it again.
- micros.rounder = RoundingImpl::passThrough();
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/ustring.h"
+#include "unicode/ures.h"
+#include "cstring.h"
+#include "charstr.h"
+#include "resource.h"
+#include "number_compact.h"
+#include "number_microprops.h"
+#include "uresimp.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+namespace {
+
+// A dummy object used when a "0" compact decimal entry is encountered. This is necessary
+// in order to prevent falling back to root. Object equality ("==") is intended.
+const UChar *USE_FALLBACK = u"<USE FALLBACK>";
+
+/** Produces a string like "NumberElements/latn/patternsShort/decimalFormat". */
+void getResourceBundleKey(const char *nsName, CompactStyle compactStyle, CompactType compactType,
+ CharString &sb, UErrorCode &status) {
+ sb.clear();
+ sb.append("NumberElements/", status);
+ sb.append(nsName, status);
+ sb.append(compactStyle == CompactStyle::UNUM_SHORT ? "/patternsShort" : "/patternsLong", status);
+ sb.append(compactType == CompactType::TYPE_DECIMAL ? "/decimalFormat" : "/currencyFormat", status);
+}
+
+int32_t getIndex(int32_t magnitude, StandardPlural::Form plural) {
+ return magnitude * StandardPlural::COUNT + plural;
+}
+
+int32_t countZeros(const UChar *patternString, int32_t patternLength) {
+ // NOTE: This strategy for computing the number of zeros is a hack for efficiency.
+ // It could break if there are any 0s that aren't part of the main pattern.
+ int32_t numZeros = 0;
+ for (int32_t i = 0; i < patternLength; i++) {
+ if (patternString[i] == u'0') {
+ numZeros++;
+ } else if (numZeros > 0) {
+ break; // zeros should always be contiguous
+ }
+ }
+ return numZeros;
+}
+
+} // namespace
+
+// NOTE: patterns and multipliers both get zero-initialized.
+CompactData::CompactData() : patterns(), multipliers(), largestMagnitude(0), isEmpty(TRUE) {
+}
+
+void CompactData::populate(const Locale &locale, const char *nsName, CompactStyle compactStyle,
+ CompactType compactType, UErrorCode &status) {
+ CompactDataSink sink(*this);
+ LocalUResourceBundlePointer rb(ures_open(nullptr, locale.getName(), &status));
+ if (U_FAILURE(status)) { return; }
+
+ bool nsIsLatn = strcmp(nsName, "latn") == 0;
+ bool compactIsShort = compactStyle == CompactStyle::UNUM_SHORT;
+
+ // Fall back to latn numbering system and/or short compact style.
+ CharString resourceKey;
+ getResourceBundleKey(nsName, compactStyle, compactType, resourceKey, status);
+ UErrorCode localStatus = U_ZERO_ERROR;
+ ures_getAllItemsWithFallback(rb.getAlias(), resourceKey.data(), sink, localStatus);
+ if (isEmpty && !nsIsLatn) {
+ getResourceBundleKey("latn", compactStyle, compactType, resourceKey, status);
+ localStatus = U_ZERO_ERROR;
+ ures_getAllItemsWithFallback(rb.getAlias(), resourceKey.data(), sink, localStatus);
+ }
+ if (isEmpty && !compactIsShort) {
+ getResourceBundleKey(nsName, CompactStyle::UNUM_SHORT, compactType, resourceKey, status);
+ localStatus = U_ZERO_ERROR;
+ ures_getAllItemsWithFallback(rb.getAlias(), resourceKey.data(), sink, localStatus);
+ }
+ if (isEmpty && !nsIsLatn && !compactIsShort) {
+ getResourceBundleKey("latn", CompactStyle::UNUM_SHORT, compactType, resourceKey, status);
+ localStatus = U_ZERO_ERROR;
+ ures_getAllItemsWithFallback(rb.getAlias(), resourceKey.data(), sink, localStatus);
+ }
+
+ // The last fallback should be guaranteed to return data.
+ if (isEmpty) {
+ status = U_INTERNAL_PROGRAM_ERROR;
+ }
+}
+
+int32_t CompactData::getMultiplier(int32_t magnitude) const {
+ if (magnitude < 0) {
+ return 0;
+ }
+ if (magnitude > largestMagnitude) {
+ magnitude = largestMagnitude;
+ }
+ return multipliers[magnitude];
+}
+
+const UChar *CompactData::getPattern(int32_t magnitude, StandardPlural::Form plural) const {
+ if (magnitude < 0) {
+ return nullptr;
+ }
+ if (magnitude > largestMagnitude) {
+ magnitude = largestMagnitude;
+ }
+ const UChar *patternString = patterns[getIndex(magnitude, plural)];
+ if (patternString == nullptr && plural != StandardPlural::OTHER) {
+ // Fall back to "other" plural variant
+ patternString = patterns[getIndex(magnitude, StandardPlural::OTHER)];
+ }
+ if (patternString == USE_FALLBACK) { // == is intended
+ // Return null if USE_FALLBACK is present
+ patternString = nullptr;
+ }
+ return patternString;
+}
+
+void CompactData::getUniquePatterns(UVector &output, UErrorCode &status) const {
+ U_ASSERT(output.isEmpty());
+ // NOTE: In C++, this is done more manually with a UVector.
+ // In Java, we can take advantage of JDK HashSet.
+ for (auto pattern : patterns) {
+ if (pattern == nullptr || pattern == USE_FALLBACK) {
+ continue;
+ }
+
+ // Insert pattern into the UVector if the UVector does not already contain the pattern.
+ // Search the UVector from the end since identical patterns are likely to be adjacent.
+ for (int32_t i = output.size() - 1; i >= 0; i--) {
+ if (u_strcmp(pattern, static_cast<const UChar *>(output[i])) == 0) {
+ goto continue_outer;
+ }
+ }
+
+ // The string was not found; add it to the UVector.
+ // ANDY: This requires a const_cast. Why?
+ output.addElement(const_cast<UChar *>(pattern), status);
+
+ continue_outer:
+ continue;
+ }
+}
+
+void CompactData::CompactDataSink::put(const char *key, ResourceValue &value, UBool /*noFallback*/,
+ UErrorCode &status) {
+ // traverse into the table of powers of ten
+ ResourceTable powersOfTenTable = value.getTable(status);
+ if (U_FAILURE(status)) { return; }
+ for (int i3 = 0; powersOfTenTable.getKeyAndValue(i3, key, value); ++i3) {
+
+ // Assumes that the keys are always of the form "10000" where the magnitude is the
+ // length of the key minus one. We expect magnitudes to be less than MAX_DIGITS.
+ auto magnitude = static_cast<int8_t> (strlen(key) - 1);
+ int8_t multiplier = data.multipliers[magnitude];
+ U_ASSERT(magnitude < COMPACT_MAX_DIGITS);
+
+ // Iterate over the plural variants ("one", "other", etc)
+ ResourceTable pluralVariantsTable = value.getTable(status);
+ if (U_FAILURE(status)) { return; }
+ for (int i4 = 0; pluralVariantsTable.getKeyAndValue(i4, key, value); ++i4) {
+
+ // Skip this magnitude/plural if we already have it from a child locale.
+ // Note: This also skips USE_FALLBACK entries.
+ StandardPlural::Form plural = StandardPlural::fromString(key, status);
+ if (U_FAILURE(status)) { return; }
+ if (data.patterns[getIndex(magnitude, plural)] != nullptr) {
+ continue;
+ }
+
+ // The value "0" means that we need to use the default pattern and not fall back
+ // to parent locales. Example locale where this is relevant: 'it'.
+ int32_t patternLength;
+ const UChar *patternString = value.getString(patternLength, status);
+ if (U_FAILURE(status)) { return; }
+ if (u_strcmp(patternString, u"0") == 0) {
+ patternString = USE_FALLBACK;
+ patternLength = 0;
+ }
+
+ // Save the pattern string. We will parse it lazily.
+ data.patterns[getIndex(magnitude, plural)] = patternString;
+
+ // If necessary, compute the multiplier: the difference between the magnitude
+ // and the number of zeros in the pattern.
+ if (multiplier == 0) {
+ int32_t numZeros = countZeros(patternString, patternLength);
+ if (numZeros > 0) { // numZeros==0 in certain cases, like Somali "Kun"
+ multiplier = static_cast<int8_t> (numZeros - magnitude - 1);
+ }
+ }
+ }
+
+ // Save the multiplier.
+ if (data.multipliers[magnitude] == 0) {
+ data.multipliers[magnitude] = multiplier;
+ if (magnitude > data.largestMagnitude) {
+ data.largestMagnitude = magnitude;
+ }
+ data.isEmpty = false;
+ } else {
+ U_ASSERT(data.multipliers[magnitude] == multiplier);
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////
+/// END OF CompactData.java; BEGIN CompactNotation.java ///
+///////////////////////////////////////////////////////////
+
+CompactHandler::CompactHandler(
+ CompactStyle compactStyle,
+ const Locale &locale,
+ const char *nsName,
+ CompactType compactType,
+ const PluralRules *rules,
+ MutablePatternModifier *buildReference,
+ bool safe,
+ const MicroPropsGenerator *parent,
+ UErrorCode &status)
+ : rules(rules), parent(parent), safe(safe) {
+ data.populate(locale, nsName, compactStyle, compactType, status);
+ if (safe) {
+ // Safe code path
+ precomputeAllModifiers(*buildReference, status);
+ } else {
+ // Unsafe code path
+ // Store the MutablePatternModifier reference.
+ unsafePatternModifier = buildReference;
+ }
+}
+
+CompactHandler::~CompactHandler() {
+ for (int32_t i = 0; i < precomputedModsLength; i++) {
+ delete precomputedMods[i].mod;
+ }
+}
+
+void CompactHandler::precomputeAllModifiers(MutablePatternModifier &buildReference, UErrorCode &status) {
+ if (U_FAILURE(status)) { return; }
+
+ // Initial capacity of 12 for 0K, 00K, 000K, ...M, ...B, and ...T
+ UVector allPatterns(12, status);
+ if (U_FAILURE(status)) { return; }
+ data.getUniquePatterns(allPatterns, status);
+ if (U_FAILURE(status)) { return; }
+
+ // C++ only: ensure that precomputedMods has room.
+ precomputedModsLength = allPatterns.size();
+ if (precomputedMods.getCapacity() < precomputedModsLength) {
+ precomputedMods.resize(allPatterns.size(), status);
+ if (U_FAILURE(status)) { return; }
+ }
+
+ for (int32_t i = 0; i < precomputedModsLength; i++) {
+ auto patternString = static_cast<const UChar *>(allPatterns[i]);
+ UnicodeString hello(patternString);
+ CompactModInfo &info = precomputedMods[i];
+ ParsedPatternInfo patternInfo;
+ PatternParser::parseToPatternInfo(UnicodeString(patternString), patternInfo, status);
+ if (U_FAILURE(status)) { return; }
+ buildReference.setPatternInfo(&patternInfo, {UFIELD_CATEGORY_NUMBER, UNUM_COMPACT_FIELD});
+ info.mod = buildReference.createImmutable(status);
+ if (U_FAILURE(status)) { return; }
+ info.patternString = patternString;
+ }
+}
+
+void CompactHandler::processQuantity(DecimalQuantity &quantity, MicroProps &micros,
+ UErrorCode &status) const {
+ parent->processQuantity(quantity, micros, status);
+ if (U_FAILURE(status)) { return; }
+
+ // Treat zero, NaN, and infinity as if they had magnitude 0
+ int32_t magnitude;
+ int32_t multiplier = 0;
+ if (quantity.isZeroish()) {
+ magnitude = 0;
+ micros.rounder.apply(quantity, status);
+ } else {
+ // TODO: Revisit chooseMultiplierAndApply
+ multiplier = micros.rounder.chooseMultiplierAndApply(quantity, data, status);
+ magnitude = quantity.isZeroish() ? 0 : quantity.getMagnitude();
+ magnitude -= multiplier;
+ }
+
+ StandardPlural::Form plural = utils::getStandardPlural(rules, quantity);
+ const UChar *patternString = data.getPattern(magnitude, plural);
+ if (patternString == nullptr) {
+ // Use the default (non-compact) modifier.
+ // No need to take any action.
+ } else if (safe) {
+ // Safe code path.
+ // Java uses a hash set here for O(1) lookup. C++ uses a linear search.
+ // TODO: Benchmark this and maybe change to a binary search or hash table.
+ int32_t i = 0;
+ for (; i < precomputedModsLength; i++) {
+ const CompactModInfo &info = precomputedMods[i];
+ if (u_strcmp(patternString, info.patternString) == 0) {
+ info.mod->applyToMicros(micros, quantity, status);
+ break;
+ }
+ }
+ // It should be guaranteed that we found the entry.
+ U_ASSERT(i < precomputedModsLength);
+ } else {
+ // Unsafe code path.
+ // Overwrite the PatternInfo in the existing modMiddle.
+ // C++ Note: Use unsafePatternInfo for proper lifecycle.
+ ParsedPatternInfo &patternInfo = const_cast<CompactHandler *>(this)->unsafePatternInfo;
+ PatternParser::parseToPatternInfo(UnicodeString(patternString), patternInfo, status);
+ unsafePatternModifier->setPatternInfo(
+ &unsafePatternInfo,
+ {UFIELD_CATEGORY_NUMBER, UNUM_COMPACT_FIELD});
+ unsafePatternModifier->setNumberProperties(quantity.signum(), StandardPlural::Form::COUNT);
+ micros.modMiddle = unsafePatternModifier;
+ }
+
+ // Change the exponent only after we select appropriate plural form
+ // for formatting purposes so that we preserve expected formatted
+ // string behavior.
+ quantity.adjustExponent(-1 * multiplier);
+
+ // We already performed rounding. Do not perform it again.
+ micros.rounder = RoundingImpl::passThrough();
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_compact.h b/contrib/libs/icu/i18n/number_compact.h
index 52fcf1fb18..199d39f659 100644
--- a/contrib/libs/icu/i18n/number_compact.h
+++ b/contrib/libs/icu/i18n/number_compact.h
@@ -1,97 +1,97 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMBER_COMPACT_H__
-#define __NUMBER_COMPACT_H__
-
-#include "standardplural.h"
-#include "number_types.h"
-#include "unicode/unum.h"
-#include "uvector.h"
-#include "resource.h"
-#include "number_patternmodifier.h"
-
-U_NAMESPACE_BEGIN namespace number {
-namespace impl {
-
-static const int32_t COMPACT_MAX_DIGITS = 15;
-
-class CompactData : public MultiplierProducer {
- public:
- CompactData();
-
- void populate(const Locale &locale, const char *nsName, CompactStyle compactStyle,
- CompactType compactType, UErrorCode &status);
-
- int32_t getMultiplier(int32_t magnitude) const U_OVERRIDE;
-
- const UChar *getPattern(int32_t magnitude, StandardPlural::Form plural) const;
-
- void getUniquePatterns(UVector &output, UErrorCode &status) const;
-
- private:
- const UChar *patterns[(COMPACT_MAX_DIGITS + 1) * StandardPlural::COUNT];
- int8_t multipliers[COMPACT_MAX_DIGITS + 1];
- int8_t largestMagnitude;
- UBool isEmpty;
-
- class CompactDataSink : public ResourceSink {
- public:
- explicit CompactDataSink(CompactData &data) : data(data) {}
-
- void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) U_OVERRIDE;
-
- private:
- CompactData &data;
- };
-};
-
-struct CompactModInfo {
- const ImmutablePatternModifier *mod;
- const UChar* patternString;
-};
-
-class CompactHandler : public MicroPropsGenerator, public UMemory {
- public:
- CompactHandler(
- CompactStyle compactStyle,
- const Locale &locale,
- const char *nsName,
- CompactType compactType,
- const PluralRules *rules,
- MutablePatternModifier *buildReference,
- bool safe,
- const MicroPropsGenerator *parent,
- UErrorCode &status);
-
- ~CompactHandler() U_OVERRIDE;
-
- void
- processQuantity(DecimalQuantity &quantity, MicroProps &micros, UErrorCode &status) const U_OVERRIDE;
-
- private:
- const PluralRules *rules;
- const MicroPropsGenerator *parent;
- // Initial capacity of 12 for 0K, 00K, 000K, ...M, ...B, and ...T
- MaybeStackArray<CompactModInfo, 12> precomputedMods;
- int32_t precomputedModsLength = 0;
- CompactData data;
- ParsedPatternInfo unsafePatternInfo;
- MutablePatternModifier* unsafePatternModifier;
- UBool safe;
-
- /** Used by the safe code path */
- void precomputeAllModifiers(MutablePatternModifier &buildReference, UErrorCode &status);
-};
-
-
-} // namespace impl
-} // namespace number
-U_NAMESPACE_END
-
-#endif //__NUMBER_COMPACT_H__
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMBER_COMPACT_H__
+#define __NUMBER_COMPACT_H__
+
+#include "standardplural.h"
+#include "number_types.h"
+#include "unicode/unum.h"
+#include "uvector.h"
+#include "resource.h"
+#include "number_patternmodifier.h"
+
+U_NAMESPACE_BEGIN namespace number {
+namespace impl {
+
+static const int32_t COMPACT_MAX_DIGITS = 15;
+
+class CompactData : public MultiplierProducer {
+ public:
+ CompactData();
+
+ void populate(const Locale &locale, const char *nsName, CompactStyle compactStyle,
+ CompactType compactType, UErrorCode &status);
+
+ int32_t getMultiplier(int32_t magnitude) const U_OVERRIDE;
+
+ const UChar *getPattern(int32_t magnitude, StandardPlural::Form plural) const;
+
+ void getUniquePatterns(UVector &output, UErrorCode &status) const;
+
+ private:
+ const UChar *patterns[(COMPACT_MAX_DIGITS + 1) * StandardPlural::COUNT];
+ int8_t multipliers[COMPACT_MAX_DIGITS + 1];
+ int8_t largestMagnitude;
+ UBool isEmpty;
+
+ class CompactDataSink : public ResourceSink {
+ public:
+ explicit CompactDataSink(CompactData &data) : data(data) {}
+
+ void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) U_OVERRIDE;
+
+ private:
+ CompactData &data;
+ };
+};
+
+struct CompactModInfo {
+ const ImmutablePatternModifier *mod;
+ const UChar* patternString;
+};
+
+class CompactHandler : public MicroPropsGenerator, public UMemory {
+ public:
+ CompactHandler(
+ CompactStyle compactStyle,
+ const Locale &locale,
+ const char *nsName,
+ CompactType compactType,
+ const PluralRules *rules,
+ MutablePatternModifier *buildReference,
+ bool safe,
+ const MicroPropsGenerator *parent,
+ UErrorCode &status);
+
+ ~CompactHandler() U_OVERRIDE;
+
+ void
+ processQuantity(DecimalQuantity &quantity, MicroProps &micros, UErrorCode &status) const U_OVERRIDE;
+
+ private:
+ const PluralRules *rules;
+ const MicroPropsGenerator *parent;
+ // Initial capacity of 12 for 0K, 00K, 000K, ...M, ...B, and ...T
+ MaybeStackArray<CompactModInfo, 12> precomputedMods;
+ int32_t precomputedModsLength = 0;
+ CompactData data;
+ ParsedPatternInfo unsafePatternInfo;
+ MutablePatternModifier* unsafePatternModifier;
+ UBool safe;
+
+ /** Used by the safe code path */
+ void precomputeAllModifiers(MutablePatternModifier &buildReference, UErrorCode &status);
+};
+
+
+} // namespace impl
+} // namespace number
+U_NAMESPACE_END
+
+#endif //__NUMBER_COMPACT_H__
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_currencysymbols.cpp b/contrib/libs/icu/i18n/number_currencysymbols.cpp
index 2ad6cb823f..4d6fb2cb1d 100644
--- a/contrib/libs/icu/i18n/number_currencysymbols.cpp
+++ b/contrib/libs/icu/i18n/number_currencysymbols.cpp
@@ -1,121 +1,121 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include "numparse_types.h"
-#include "number_currencysymbols.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-
-CurrencySymbols::CurrencySymbols(CurrencyUnit currency, const Locale& locale, UErrorCode& status)
- : fCurrency(currency), fLocaleName(locale.getName(), status) {
- fCurrencySymbol.setToBogus();
- fIntlCurrencySymbol.setToBogus();
-}
-
-CurrencySymbols::CurrencySymbols(CurrencyUnit currency, const Locale& locale,
- const DecimalFormatSymbols& symbols, UErrorCode& status)
- : CurrencySymbols(currency, locale, status) {
- // If either of the overrides is present, save it in the local UnicodeString.
- if (symbols.isCustomCurrencySymbol()) {
- fCurrencySymbol = symbols.getConstSymbol(DecimalFormatSymbols::kCurrencySymbol);
- }
- if (symbols.isCustomIntlCurrencySymbol()) {
- fIntlCurrencySymbol = symbols.getConstSymbol(DecimalFormatSymbols::kIntlCurrencySymbol);
- }
-}
-
-const char16_t* CurrencySymbols::getIsoCode() const {
- return fCurrency.getISOCurrency();
-}
-
-UnicodeString CurrencySymbols::getNarrowCurrencySymbol(UErrorCode& status) const {
- // Note: currently no override is available for narrow currency symbol
- return loadSymbol(UCURR_NARROW_SYMBOL_NAME, status);
-}
-
-UnicodeString CurrencySymbols::getCurrencySymbol(UErrorCode& status) const {
- if (!fCurrencySymbol.isBogus()) {
- return fCurrencySymbol;
- }
- return loadSymbol(UCURR_SYMBOL_NAME, status);
-}
-
-UnicodeString CurrencySymbols::loadSymbol(UCurrNameStyle selector, UErrorCode& status) const {
- const char16_t* isoCode = fCurrency.getISOCurrency();
- int32_t symbolLen = 0;
- const char16_t* symbol = ucurr_getName(
- isoCode,
- fLocaleName.data(),
- selector,
- nullptr /* isChoiceFormat */,
- &symbolLen,
- &status);
- // If given an unknown currency, ucurr_getName returns the input string, which we can't alias safely!
- // Otherwise, symbol points to a resource bundle, and we can use readonly-aliasing constructor.
- if (symbol == isoCode) {
- return UnicodeString(isoCode, 3);
- } else {
- return UnicodeString(TRUE, symbol, symbolLen);
- }
-}
-
-UnicodeString CurrencySymbols::getIntlCurrencySymbol(UErrorCode&) const {
- if (!fIntlCurrencySymbol.isBogus()) {
- return fIntlCurrencySymbol;
- }
- // Note: Not safe to use readonly-aliasing constructor here because the buffer belongs to this object,
- // which could be destructed or moved during the lifetime of the return value.
- return UnicodeString(fCurrency.getISOCurrency(), 3);
-}
-
-UnicodeString CurrencySymbols::getPluralName(StandardPlural::Form plural, UErrorCode& status) const {
- const char16_t* isoCode = fCurrency.getISOCurrency();
- int32_t symbolLen = 0;
- const char16_t* symbol = ucurr_getPluralName(
- isoCode,
- fLocaleName.data(),
- nullptr /* isChoiceFormat */,
- StandardPlural::getKeyword(plural),
- &symbolLen,
- &status);
- // If given an unknown currency, ucurr_getName returns the input string, which we can't alias safely!
- // Otherwise, symbol points to a resource bundle, and we can use readonly-aliasing constructor.
- if (symbol == isoCode) {
- return UnicodeString(isoCode, 3);
- } else {
- return UnicodeString(TRUE, symbol, symbolLen);
- }
-}
-
-
-CurrencyUnit
-icu::number::impl::resolveCurrency(const DecimalFormatProperties& properties, const Locale& locale,
- UErrorCode& status) {
- if (!properties.currency.isNull()) {
- return properties.currency.getNoError();
- } else {
- UErrorCode localStatus = U_ZERO_ERROR;
- char16_t buf[4] = {};
- ucurr_forLocale(locale.getName(), buf, 4, &localStatus);
- if (U_SUCCESS(localStatus)) {
- return CurrencyUnit(buf, status);
- } else {
- // Default currency (XXX)
- return CurrencyUnit();
- }
- }
-}
-
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include "numparse_types.h"
+#include "number_currencysymbols.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+
+CurrencySymbols::CurrencySymbols(CurrencyUnit currency, const Locale& locale, UErrorCode& status)
+ : fCurrency(currency), fLocaleName(locale.getName(), status) {
+ fCurrencySymbol.setToBogus();
+ fIntlCurrencySymbol.setToBogus();
+}
+
+CurrencySymbols::CurrencySymbols(CurrencyUnit currency, const Locale& locale,
+ const DecimalFormatSymbols& symbols, UErrorCode& status)
+ : CurrencySymbols(currency, locale, status) {
+ // If either of the overrides is present, save it in the local UnicodeString.
+ if (symbols.isCustomCurrencySymbol()) {
+ fCurrencySymbol = symbols.getConstSymbol(DecimalFormatSymbols::kCurrencySymbol);
+ }
+ if (symbols.isCustomIntlCurrencySymbol()) {
+ fIntlCurrencySymbol = symbols.getConstSymbol(DecimalFormatSymbols::kIntlCurrencySymbol);
+ }
+}
+
+const char16_t* CurrencySymbols::getIsoCode() const {
+ return fCurrency.getISOCurrency();
+}
+
+UnicodeString CurrencySymbols::getNarrowCurrencySymbol(UErrorCode& status) const {
+ // Note: currently no override is available for narrow currency symbol
+ return loadSymbol(UCURR_NARROW_SYMBOL_NAME, status);
+}
+
+UnicodeString CurrencySymbols::getCurrencySymbol(UErrorCode& status) const {
+ if (!fCurrencySymbol.isBogus()) {
+ return fCurrencySymbol;
+ }
+ return loadSymbol(UCURR_SYMBOL_NAME, status);
+}
+
+UnicodeString CurrencySymbols::loadSymbol(UCurrNameStyle selector, UErrorCode& status) const {
+ const char16_t* isoCode = fCurrency.getISOCurrency();
+ int32_t symbolLen = 0;
+ const char16_t* symbol = ucurr_getName(
+ isoCode,
+ fLocaleName.data(),
+ selector,
+ nullptr /* isChoiceFormat */,
+ &symbolLen,
+ &status);
+ // If given an unknown currency, ucurr_getName returns the input string, which we can't alias safely!
+ // Otherwise, symbol points to a resource bundle, and we can use readonly-aliasing constructor.
+ if (symbol == isoCode) {
+ return UnicodeString(isoCode, 3);
+ } else {
+ return UnicodeString(TRUE, symbol, symbolLen);
+ }
+}
+
+UnicodeString CurrencySymbols::getIntlCurrencySymbol(UErrorCode&) const {
+ if (!fIntlCurrencySymbol.isBogus()) {
+ return fIntlCurrencySymbol;
+ }
+ // Note: Not safe to use readonly-aliasing constructor here because the buffer belongs to this object,
+ // which could be destructed or moved during the lifetime of the return value.
+ return UnicodeString(fCurrency.getISOCurrency(), 3);
+}
+
+UnicodeString CurrencySymbols::getPluralName(StandardPlural::Form plural, UErrorCode& status) const {
+ const char16_t* isoCode = fCurrency.getISOCurrency();
+ int32_t symbolLen = 0;
+ const char16_t* symbol = ucurr_getPluralName(
+ isoCode,
+ fLocaleName.data(),
+ nullptr /* isChoiceFormat */,
+ StandardPlural::getKeyword(plural),
+ &symbolLen,
+ &status);
+ // If given an unknown currency, ucurr_getName returns the input string, which we can't alias safely!
+ // Otherwise, symbol points to a resource bundle, and we can use readonly-aliasing constructor.
+ if (symbol == isoCode) {
+ return UnicodeString(isoCode, 3);
+ } else {
+ return UnicodeString(TRUE, symbol, symbolLen);
+ }
+}
+
+
+CurrencyUnit
+icu::number::impl::resolveCurrency(const DecimalFormatProperties& properties, const Locale& locale,
+ UErrorCode& status) {
+ if (!properties.currency.isNull()) {
+ return properties.currency.getNoError();
+ } else {
+ UErrorCode localStatus = U_ZERO_ERROR;
+ char16_t buf[4] = {};
+ ucurr_forLocale(locale.getName(), buf, 4, &localStatus);
+ if (U_SUCCESS(localStatus)) {
+ return CurrencyUnit(buf, status);
+ } else {
+ // Default currency (XXX)
+ return CurrencyUnit();
+ }
+ }
+}
+
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_currencysymbols.h b/contrib/libs/icu/i18n/number_currencysymbols.h
index ef4f9a3de8..9996bf96ae 100644
--- a/contrib/libs/icu/i18n/number_currencysymbols.h
+++ b/contrib/libs/icu/i18n/number_currencysymbols.h
@@ -1,65 +1,65 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __SOURCE_NUMBER_CURRENCYSYMBOLS_H__
-#define __SOURCE_NUMBER_CURRENCYSYMBOLS_H__
-
-#include "numparse_types.h"
-#include "charstr.h"
-#include "number_decimfmtprops.h"
-
-U_NAMESPACE_BEGIN namespace number {
-namespace impl {
-
-
-// Exported as U_I18N_API for tests
-class U_I18N_API CurrencySymbols : public UMemory {
- public:
- CurrencySymbols() = default; // default constructor: leaves class in valid but undefined state
-
- /** Creates an instance in which all symbols are loaded from data. */
- CurrencySymbols(CurrencyUnit currency, const Locale& locale, UErrorCode& status);
-
- /** Creates an instance in which some symbols might be pre-populated. */
- CurrencySymbols(CurrencyUnit currency, const Locale& locale, const DecimalFormatSymbols& symbols,
- UErrorCode& status);
-
- const char16_t* getIsoCode() const;
-
- UnicodeString getNarrowCurrencySymbol(UErrorCode& status) const;
-
- UnicodeString getCurrencySymbol(UErrorCode& status) const;
-
- UnicodeString getIntlCurrencySymbol(UErrorCode& status) const;
-
- UnicodeString getPluralName(StandardPlural::Form plural, UErrorCode& status) const;
-
- protected:
- // Required fields:
- CurrencyUnit fCurrency;
- CharString fLocaleName;
-
- // Optional fields:
- UnicodeString fCurrencySymbol;
- UnicodeString fIntlCurrencySymbol;
-
- UnicodeString loadSymbol(UCurrNameStyle selector, UErrorCode& status) const;
-};
-
-
-/**
- * Resolves the effective currency from the property bag.
- */
-CurrencyUnit
-resolveCurrency(const DecimalFormatProperties& properties, const Locale& locale, UErrorCode& status);
-
-
-} // namespace impl
-} // namespace numparse
-U_NAMESPACE_END
-
-#endif //__SOURCE_NUMBER_CURRENCYSYMBOLS_H__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __SOURCE_NUMBER_CURRENCYSYMBOLS_H__
+#define __SOURCE_NUMBER_CURRENCYSYMBOLS_H__
+
+#include "numparse_types.h"
+#include "charstr.h"
+#include "number_decimfmtprops.h"
+
+U_NAMESPACE_BEGIN namespace number {
+namespace impl {
+
+
+// Exported as U_I18N_API for tests
+class U_I18N_API CurrencySymbols : public UMemory {
+ public:
+ CurrencySymbols() = default; // default constructor: leaves class in valid but undefined state
+
+ /** Creates an instance in which all symbols are loaded from data. */
+ CurrencySymbols(CurrencyUnit currency, const Locale& locale, UErrorCode& status);
+
+ /** Creates an instance in which some symbols might be pre-populated. */
+ CurrencySymbols(CurrencyUnit currency, const Locale& locale, const DecimalFormatSymbols& symbols,
+ UErrorCode& status);
+
+ const char16_t* getIsoCode() const;
+
+ UnicodeString getNarrowCurrencySymbol(UErrorCode& status) const;
+
+ UnicodeString getCurrencySymbol(UErrorCode& status) const;
+
+ UnicodeString getIntlCurrencySymbol(UErrorCode& status) const;
+
+ UnicodeString getPluralName(StandardPlural::Form plural, UErrorCode& status) const;
+
+ protected:
+ // Required fields:
+ CurrencyUnit fCurrency;
+ CharString fLocaleName;
+
+ // Optional fields:
+ UnicodeString fCurrencySymbol;
+ UnicodeString fIntlCurrencySymbol;
+
+ UnicodeString loadSymbol(UCurrNameStyle selector, UErrorCode& status) const;
+};
+
+
+/**
+ * Resolves the effective currency from the property bag.
+ */
+CurrencyUnit
+resolveCurrency(const DecimalFormatProperties& properties, const Locale& locale, UErrorCode& status);
+
+
+} // namespace impl
+} // namespace numparse
+U_NAMESPACE_END
+
+#endif //__SOURCE_NUMBER_CURRENCYSYMBOLS_H__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_decimalquantity.cpp b/contrib/libs/icu/i18n/number_decimalquantity.cpp
index 669ec7d556..482e93dc7a 100644
--- a/contrib/libs/icu/i18n/number_decimalquantity.cpp
+++ b/contrib/libs/icu/i18n/number_decimalquantity.cpp
@@ -1,1347 +1,1347 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include <cstdlib>
-#include <cmath>
-#include <limits>
-#include <stdlib.h>
-
-#include "unicode/plurrule.h"
-#include "cmemory.h"
-#include "number_decnum.h"
-#include "putilimp.h"
-#include "number_decimalquantity.h"
-#include "number_roundingutils.h"
-#include "double-conversion.h"
-#include "charstr.h"
-#include "number_utils.h"
-#include "uassert.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-using icu::double_conversion::DoubleToStringConverter;
-using icu::double_conversion::StringToDoubleConverter;
-
-namespace {
-
-int8_t NEGATIVE_FLAG = 1;
-int8_t INFINITY_FLAG = 2;
-int8_t NAN_FLAG = 4;
-
-/** Helper function for safe subtraction (no overflow). */
-inline int32_t safeSubtract(int32_t a, int32_t b) {
- // Note: In C++, signed integer subtraction is undefined behavior.
- int32_t diff = static_cast<int32_t>(static_cast<uint32_t>(a) - static_cast<uint32_t>(b));
- if (b < 0 && diff < a) { return INT32_MAX; }
- if (b > 0 && diff > a) { return INT32_MIN; }
- return diff;
-}
-
-static double DOUBLE_MULTIPLIERS[] = {
- 1e0,
- 1e1,
- 1e2,
- 1e3,
- 1e4,
- 1e5,
- 1e6,
- 1e7,
- 1e8,
- 1e9,
- 1e10,
- 1e11,
- 1e12,
- 1e13,
- 1e14,
- 1e15,
- 1e16,
- 1e17,
- 1e18,
- 1e19,
- 1e20,
- 1e21};
-
-} // namespace
-
-icu::IFixedDecimal::~IFixedDecimal() = default;
-
-DecimalQuantity::DecimalQuantity() {
- setBcdToZero();
- flags = 0;
-}
-
-DecimalQuantity::~DecimalQuantity() {
- if (usingBytes) {
- uprv_free(fBCD.bcdBytes.ptr);
- fBCD.bcdBytes.ptr = nullptr;
- usingBytes = false;
- }
-}
-
-DecimalQuantity::DecimalQuantity(const DecimalQuantity &other) {
- *this = other;
-}
-
-DecimalQuantity::DecimalQuantity(DecimalQuantity&& src) U_NOEXCEPT {
- *this = std::move(src);
-}
-
-DecimalQuantity &DecimalQuantity::operator=(const DecimalQuantity &other) {
- if (this == &other) {
- return *this;
- }
- copyBcdFrom(other);
- copyFieldsFrom(other);
- return *this;
-}
-
-DecimalQuantity& DecimalQuantity::operator=(DecimalQuantity&& src) U_NOEXCEPT {
- if (this == &src) {
- return *this;
- }
- moveBcdFrom(src);
- copyFieldsFrom(src);
- return *this;
-}
-
-void DecimalQuantity::copyFieldsFrom(const DecimalQuantity& other) {
- bogus = other.bogus;
- lReqPos = other.lReqPos;
- rReqPos = other.rReqPos;
- scale = other.scale;
- precision = other.precision;
- flags = other.flags;
- origDouble = other.origDouble;
- origDelta = other.origDelta;
- isApproximate = other.isApproximate;
- exponent = other.exponent;
-}
-
-void DecimalQuantity::clear() {
- lReqPos = 0;
- rReqPos = 0;
- flags = 0;
- setBcdToZero(); // sets scale, precision, hasDouble, origDouble, origDelta, and BCD data
-}
-
-void DecimalQuantity::setMinInteger(int32_t minInt) {
- // Validation should happen outside of DecimalQuantity, e.g., in the Precision class.
- U_ASSERT(minInt >= 0);
-
- // Special behavior: do not set minInt to be less than what is already set.
- // This is so significant digits rounding can set the integer length.
- if (minInt < lReqPos) {
- minInt = lReqPos;
- }
-
- // Save values into internal state
- lReqPos = minInt;
-}
-
-void DecimalQuantity::setMinFraction(int32_t minFrac) {
- // Validation should happen outside of DecimalQuantity, e.g., in the Precision class.
- U_ASSERT(minFrac >= 0);
-
- // Save values into internal state
- // Negation is safe for minFrac/maxFrac because -Integer.MAX_VALUE > Integer.MIN_VALUE
- rReqPos = -minFrac;
-}
-
-void DecimalQuantity::applyMaxInteger(int32_t maxInt) {
- // Validation should happen outside of DecimalQuantity, e.g., in the Precision class.
- U_ASSERT(maxInt >= 0);
-
- if (precision == 0) {
- return;
- }
-
- if (maxInt <= scale) {
- setBcdToZero();
- return;
- }
-
- int32_t magnitude = getMagnitude();
- if (maxInt <= magnitude) {
- popFromLeft(magnitude - maxInt + 1);
- compact();
- }
-}
-
-uint64_t DecimalQuantity::getPositionFingerprint() const {
- uint64_t fingerprint = 0;
- fingerprint ^= (lReqPos << 16);
- fingerprint ^= (static_cast<uint64_t>(rReqPos) << 32);
- return fingerprint;
-}
-
-void DecimalQuantity::roundToIncrement(double roundingIncrement, RoundingMode roundingMode,
- UErrorCode& status) {
- // Do not call this method with an increment having only a 1 or a 5 digit!
- // Use a more efficient call to either roundToMagnitude() or roundToNickel().
- // Check a few popular rounding increments; a more thorough check is in Java.
- U_ASSERT(roundingIncrement != 0.01);
- U_ASSERT(roundingIncrement != 0.05);
- U_ASSERT(roundingIncrement != 0.1);
- U_ASSERT(roundingIncrement != 0.5);
- U_ASSERT(roundingIncrement != 1);
- U_ASSERT(roundingIncrement != 5);
-
- DecNum incrementDN;
- incrementDN.setTo(roundingIncrement, status);
- if (U_FAILURE(status)) { return; }
-
- // Divide this DecimalQuantity by the increment, round, then multiply back.
- divideBy(incrementDN, status);
- if (U_FAILURE(status)) { return; }
- roundToMagnitude(0, roundingMode, status);
- if (U_FAILURE(status)) { return; }
- multiplyBy(incrementDN, status);
- if (U_FAILURE(status)) { return; }
-}
-
-void DecimalQuantity::multiplyBy(const DecNum& multiplicand, UErrorCode& status) {
- if (isZeroish()) {
- return;
- }
- // Convert to DecNum, multiply, and convert back.
- DecNum decnum;
- toDecNum(decnum, status);
- if (U_FAILURE(status)) { return; }
- decnum.multiplyBy(multiplicand, status);
- if (U_FAILURE(status)) { return; }
- setToDecNum(decnum, status);
-}
-
-void DecimalQuantity::divideBy(const DecNum& divisor, UErrorCode& status) {
- if (isZeroish()) {
- return;
- }
- // Convert to DecNum, multiply, and convert back.
- DecNum decnum;
- toDecNum(decnum, status);
- if (U_FAILURE(status)) { return; }
- decnum.divideBy(divisor, status);
- if (U_FAILURE(status)) { return; }
- setToDecNum(decnum, status);
-}
-
-void DecimalQuantity::negate() {
- flags ^= NEGATIVE_FLAG;
-}
-
-int32_t DecimalQuantity::getMagnitude() const {
- U_ASSERT(precision != 0);
- return scale + precision - 1;
-}
-
-bool DecimalQuantity::adjustMagnitude(int32_t delta) {
- if (precision != 0) {
- // i.e., scale += delta; origDelta += delta
- bool overflow = uprv_add32_overflow(scale, delta, &scale);
- overflow = uprv_add32_overflow(origDelta, delta, &origDelta) || overflow;
- // Make sure that precision + scale won't overflow, either
- int32_t dummy;
- overflow = overflow || uprv_add32_overflow(scale, precision, &dummy);
- return overflow;
- }
- return false;
-}
-
-double DecimalQuantity::getPluralOperand(PluralOperand operand) const {
- // If this assertion fails, you need to call roundToInfinity() or some other rounding method.
- // See the comment at the top of this file explaining the "isApproximate" field.
- U_ASSERT(!isApproximate);
-
- switch (operand) {
- case PLURAL_OPERAND_I:
- // Invert the negative sign if necessary
- return static_cast<double>(isNegative() ? -toLong(true) : toLong(true));
- case PLURAL_OPERAND_F:
- return static_cast<double>(toFractionLong(true));
- case PLURAL_OPERAND_T:
- return static_cast<double>(toFractionLong(false));
- case PLURAL_OPERAND_V:
- return fractionCount();
- case PLURAL_OPERAND_W:
- return fractionCountWithoutTrailingZeros();
- case PLURAL_OPERAND_E:
- return static_cast<double>(getExponent());
- default:
- return std::abs(toDouble());
- }
-}
-
-int32_t DecimalQuantity::getExponent() const {
- return exponent;
-}
-
-void DecimalQuantity::adjustExponent(int delta) {
- exponent = exponent + delta;
-}
-
-bool DecimalQuantity::hasIntegerValue() const {
- return scale >= 0;
-}
-
-int32_t DecimalQuantity::getUpperDisplayMagnitude() const {
- // If this assertion fails, you need to call roundToInfinity() or some other rounding method.
- // See the comment in the header file explaining the "isApproximate" field.
- U_ASSERT(!isApproximate);
-
- int32_t magnitude = scale + precision;
- int32_t result = (lReqPos > magnitude) ? lReqPos : magnitude;
- return result - 1;
-}
-
-int32_t DecimalQuantity::getLowerDisplayMagnitude() const {
- // If this assertion fails, you need to call roundToInfinity() or some other rounding method.
- // See the comment in the header file explaining the "isApproximate" field.
- U_ASSERT(!isApproximate);
-
- int32_t magnitude = scale;
- int32_t result = (rReqPos < magnitude) ? rReqPos : magnitude;
- return result;
-}
-
-int8_t DecimalQuantity::getDigit(int32_t magnitude) const {
- // If this assertion fails, you need to call roundToInfinity() or some other rounding method.
- // See the comment at the top of this file explaining the "isApproximate" field.
- U_ASSERT(!isApproximate);
-
- return getDigitPos(magnitude - scale);
-}
-
-int32_t DecimalQuantity::fractionCount() const {
- int32_t fractionCountWithExponent = -getLowerDisplayMagnitude() - exponent;
- return fractionCountWithExponent > 0 ? fractionCountWithExponent : 0;
-}
-
-int32_t DecimalQuantity::fractionCountWithoutTrailingZeros() const {
- int32_t fractionCountWithExponent = -scale - exponent;
- return fractionCountWithExponent > 0 ? fractionCountWithExponent : 0; // max(-fractionCountWithExponent, 0)
-}
-
-bool DecimalQuantity::isNegative() const {
- return (flags & NEGATIVE_FLAG) != 0;
-}
-
-Signum DecimalQuantity::signum() const {
- bool isZero = (isZeroish() && !isInfinite());
- bool isNeg = isNegative();
- if (isZero && isNeg) {
- return SIGNUM_NEG_ZERO;
- } else if (isZero) {
- return SIGNUM_POS_ZERO;
- } else if (isNeg) {
- return SIGNUM_NEG;
- } else {
- return SIGNUM_POS;
- }
-}
-
-bool DecimalQuantity::isInfinite() const {
- return (flags & INFINITY_FLAG) != 0;
-}
-
-bool DecimalQuantity::isNaN() const {
- return (flags & NAN_FLAG) != 0;
-}
-
-bool DecimalQuantity::isZeroish() const {
- return precision == 0;
-}
-
-DecimalQuantity &DecimalQuantity::setToInt(int32_t n) {
- setBcdToZero();
- flags = 0;
- if (n == INT32_MIN) {
- flags |= NEGATIVE_FLAG;
- // leave as INT32_MIN; handled below in _setToInt()
- } else if (n < 0) {
- flags |= NEGATIVE_FLAG;
- n = -n;
- }
- if (n != 0) {
- _setToInt(n);
- compact();
- }
- return *this;
-}
-
-void DecimalQuantity::_setToInt(int32_t n) {
- if (n == INT32_MIN) {
- readLongToBcd(-static_cast<int64_t>(n));
- } else {
- readIntToBcd(n);
- }
-}
-
-DecimalQuantity &DecimalQuantity::setToLong(int64_t n) {
- setBcdToZero();
- flags = 0;
- if (n < 0 && n > INT64_MIN) {
- flags |= NEGATIVE_FLAG;
- n = -n;
- }
- if (n != 0) {
- _setToLong(n);
- compact();
- }
- return *this;
-}
-
-void DecimalQuantity::_setToLong(int64_t n) {
- if (n == INT64_MIN) {
- DecNum decnum;
- UErrorCode localStatus = U_ZERO_ERROR;
- decnum.setTo("9.223372036854775808E+18", localStatus);
- if (U_FAILURE(localStatus)) { return; } // unexpected
- flags |= NEGATIVE_FLAG;
- readDecNumberToBcd(decnum);
- } else if (n <= INT32_MAX) {
- readIntToBcd(static_cast<int32_t>(n));
- } else {
- readLongToBcd(n);
- }
-}
-
-DecimalQuantity &DecimalQuantity::setToDouble(double n) {
- setBcdToZero();
- flags = 0;
- // signbit() from <math.h> handles +0.0 vs -0.0
- if (std::signbit(n)) {
- flags |= NEGATIVE_FLAG;
- n = -n;
- }
- if (std::isnan(n) != 0) {
- flags |= NAN_FLAG;
- } else if (std::isfinite(n) == 0) {
- flags |= INFINITY_FLAG;
- } else if (n != 0) {
- _setToDoubleFast(n);
- compact();
- }
- return *this;
-}
-
-void DecimalQuantity::_setToDoubleFast(double n) {
- isApproximate = true;
- origDouble = n;
- origDelta = 0;
-
- // Make sure the double is an IEEE 754 double. If not, fall back to the slow path right now.
- // TODO: Make a fast path for other types of doubles.
- if (!std::numeric_limits<double>::is_iec559) {
- convertToAccurateDouble();
- return;
- }
-
- // To get the bits from the double, use memcpy, which takes care of endianness.
- uint64_t ieeeBits;
- uprv_memcpy(&ieeeBits, &n, sizeof(n));
- int32_t exponent = static_cast<int32_t>((ieeeBits & 0x7ff0000000000000L) >> 52) - 0x3ff;
-
- // Not all integers can be represented exactly for exponent > 52
- if (exponent <= 52 && static_cast<int64_t>(n) == n) {
- _setToLong(static_cast<int64_t>(n));
- return;
- }
-
- if (exponent == -1023 || exponent == 1024) {
- // The extreme values of exponent are special; use slow path.
- convertToAccurateDouble();
- return;
- }
-
- // 3.3219... is log2(10)
- auto fracLength = static_cast<int32_t> ((52 - exponent) / 3.32192809488736234787031942948939017586);
- if (fracLength >= 0) {
- int32_t i = fracLength;
- // 1e22 is the largest exact double.
- for (; i >= 22; i -= 22) n *= 1e22;
- n *= DOUBLE_MULTIPLIERS[i];
- } else {
- int32_t i = fracLength;
- // 1e22 is the largest exact double.
- for (; i <= -22; i += 22) n /= 1e22;
- n /= DOUBLE_MULTIPLIERS[-i];
- }
- auto result = static_cast<int64_t>(uprv_round(n));
- if (result != 0) {
- _setToLong(result);
- scale -= fracLength;
- }
-}
-
-void DecimalQuantity::convertToAccurateDouble() {
- U_ASSERT(origDouble != 0);
- int32_t delta = origDelta;
-
- // Call the slow oracle function (Double.toString in Java, DoubleToAscii in C++).
- char buffer[DoubleToStringConverter::kBase10MaximalLength + 1];
- bool sign; // unused; always positive
- int32_t length;
- int32_t point;
- DoubleToStringConverter::DoubleToAscii(
- origDouble,
- DoubleToStringConverter::DtoaMode::SHORTEST,
- 0,
- buffer,
- sizeof(buffer),
- &sign,
- &length,
- &point
- );
-
- setBcdToZero();
- readDoubleConversionToBcd(buffer, length, point);
- scale += delta;
- explicitExactDouble = true;
-}
-
-DecimalQuantity &DecimalQuantity::setToDecNumber(StringPiece n, UErrorCode& status) {
- setBcdToZero();
- flags = 0;
-
- // Compute the decNumber representation
- DecNum decnum;
- decnum.setTo(n, status);
-
- _setToDecNum(decnum, status);
- return *this;
-}
-
-DecimalQuantity& DecimalQuantity::setToDecNum(const DecNum& decnum, UErrorCode& status) {
- setBcdToZero();
- flags = 0;
-
- _setToDecNum(decnum, status);
- return *this;
-}
-
-void DecimalQuantity::_setToDecNum(const DecNum& decnum, UErrorCode& status) {
- if (U_FAILURE(status)) { return; }
- if (decnum.isNegative()) {
- flags |= NEGATIVE_FLAG;
- }
- if (!decnum.isZero()) {
- readDecNumberToBcd(decnum);
- compact();
- }
-}
-
-int64_t DecimalQuantity::toLong(bool truncateIfOverflow) const {
- // NOTE: Call sites should be guarded by fitsInLong(), like this:
- // if (dq.fitsInLong()) { /* use dq.toLong() */ } else { /* use some fallback */ }
- // Fallback behavior upon truncateIfOverflow is to truncate at 17 digits.
- uint64_t result = 0L;
- int32_t upperMagnitude = exponent + scale + precision - 1;
- if (truncateIfOverflow) {
- upperMagnitude = std::min(upperMagnitude, 17);
- }
- for (int32_t magnitude = upperMagnitude; magnitude >= 0; magnitude--) {
- result = result * 10 + getDigitPos(magnitude - scale - exponent);
- }
- if (isNegative()) {
- return static_cast<int64_t>(0LL - result); // i.e., -result
- }
- return static_cast<int64_t>(result);
-}
-
-uint64_t DecimalQuantity::toFractionLong(bool includeTrailingZeros) const {
- uint64_t result = 0L;
- int32_t magnitude = -1 - exponent;
- int32_t lowerMagnitude = scale;
- if (includeTrailingZeros) {
- lowerMagnitude = std::min(lowerMagnitude, rReqPos);
- }
- for (; magnitude >= lowerMagnitude && result <= 1e18L; magnitude--) {
- result = result * 10 + getDigitPos(magnitude - scale);
- }
- // Remove trailing zeros; this can happen during integer overflow cases.
- if (!includeTrailingZeros) {
- while (result > 0 && (result % 10) == 0) {
- result /= 10;
- }
- }
- return result;
-}
-
-bool DecimalQuantity::fitsInLong(bool ignoreFraction) const {
- if (isInfinite() || isNaN()) {
- return false;
- }
- if (isZeroish()) {
- return true;
- }
- if (exponent + scale < 0 && !ignoreFraction) {
- return false;
- }
- int magnitude = getMagnitude();
- if (magnitude < 18) {
- return true;
- }
- if (magnitude > 18) {
- return false;
- }
- // Hard case: the magnitude is 10^18.
- // The largest int64 is: 9,223,372,036,854,775,807
- for (int p = 0; p < precision; p++) {
- int8_t digit = getDigit(18 - p);
- static int8_t INT64_BCD[] = { 9, 2, 2, 3, 3, 7, 2, 0, 3, 6, 8, 5, 4, 7, 7, 5, 8, 0, 8 };
- if (digit < INT64_BCD[p]) {
- return true;
- } else if (digit > INT64_BCD[p]) {
- return false;
- }
- }
- // Exactly equal to max long plus one.
- return isNegative();
-}
-
-double DecimalQuantity::toDouble() const {
- // If this assertion fails, you need to call roundToInfinity() or some other rounding method.
- // See the comment in the header file explaining the "isApproximate" field.
- U_ASSERT(!isApproximate);
-
- if (isNaN()) {
- return NAN;
- } else if (isInfinite()) {
- return isNegative() ? -INFINITY : INFINITY;
- }
-
- // We are processing well-formed input, so we don't need any special options to StringToDoubleConverter.
- StringToDoubleConverter converter(0, 0, 0, "", "");
- UnicodeString numberString = this->toScientificString();
- int32_t count;
- return converter.StringToDouble(
- reinterpret_cast<const uint16_t*>(numberString.getBuffer()),
- numberString.length(),
- &count);
-}
-
-void DecimalQuantity::toDecNum(DecNum& output, UErrorCode& status) const {
- // Special handling for zero
- if (precision == 0) {
- output.setTo("0", status);
- }
-
- // Use the BCD constructor. We need to do a little bit of work to convert, though.
- // The decNumber constructor expects most-significant first, but we store least-significant first.
- MaybeStackArray<uint8_t, 20> ubcd(precision);
- for (int32_t m = 0; m < precision; m++) {
- ubcd[precision - m - 1] = static_cast<uint8_t>(getDigitPos(m));
- }
- output.setTo(ubcd.getAlias(), precision, scale, isNegative(), status);
-}
-
-void DecimalQuantity::truncate() {
- if (scale < 0) {
- shiftRight(-scale);
- scale = 0;
- compact();
- }
-}
-
-void DecimalQuantity::roundToNickel(int32_t magnitude, RoundingMode roundingMode, UErrorCode& status) {
- roundToMagnitude(magnitude, roundingMode, true, status);
-}
-
-void DecimalQuantity::roundToMagnitude(int32_t magnitude, RoundingMode roundingMode, UErrorCode& status) {
- roundToMagnitude(magnitude, roundingMode, false, status);
-}
-
-void DecimalQuantity::roundToMagnitude(int32_t magnitude, RoundingMode roundingMode, bool nickel, UErrorCode& status) {
- // The position in the BCD at which rounding will be performed; digits to the right of position
- // will be rounded away.
- int position = safeSubtract(magnitude, scale);
-
- // "trailing" = least significant digit to the left of rounding
- int8_t trailingDigit = getDigitPos(position);
-
- if (position <= 0 && !isApproximate && (!nickel || trailingDigit == 0 || trailingDigit == 5)) {
- // All digits are to the left of the rounding magnitude.
- } else if (precision == 0) {
- // No rounding for zero.
- } else {
- // Perform rounding logic.
- // "leading" = most significant digit to the right of rounding
- int8_t leadingDigit = getDigitPos(safeSubtract(position, 1));
-
- // Compute which section of the number we are in.
- // EDGE means we are at the bottom or top edge, like 1.000 or 1.999 (used by doubles)
- // LOWER means we are between the bottom edge and the midpoint, like 1.391
- // MIDPOINT means we are exactly in the middle, like 1.500
- // UPPER means we are between the midpoint and the top edge, like 1.916
- roundingutils::Section section;
- if (!isApproximate) {
- if (nickel && trailingDigit != 2 && trailingDigit != 7) {
- // Nickel rounding, and not at .02x or .07x
- if (trailingDigit < 2) {
- // .00, .01 => down to .00
- section = roundingutils::SECTION_LOWER;
- } else if (trailingDigit < 5) {
- // .03, .04 => up to .05
- section = roundingutils::SECTION_UPPER;
- } else if (trailingDigit < 7) {
- // .05, .06 => down to .05
- section = roundingutils::SECTION_LOWER;
- } else {
- // .08, .09 => up to .10
- section = roundingutils::SECTION_UPPER;
- }
- } else if (leadingDigit < 5) {
- // Includes nickel rounding .020-.024 and .070-.074
- section = roundingutils::SECTION_LOWER;
- } else if (leadingDigit > 5) {
- // Includes nickel rounding .026-.029 and .076-.079
- section = roundingutils::SECTION_UPPER;
- } else {
- // Includes nickel rounding .025 and .075
- section = roundingutils::SECTION_MIDPOINT;
- for (int p = safeSubtract(position, 2); p >= 0; p--) {
- if (getDigitPos(p) != 0) {
- section = roundingutils::SECTION_UPPER;
- break;
- }
- }
- }
- } else {
- int32_t p = safeSubtract(position, 2);
- int32_t minP = uprv_max(0, precision - 14);
- if (leadingDigit == 0 && (!nickel || trailingDigit == 0 || trailingDigit == 5)) {
- section = roundingutils::SECTION_LOWER_EDGE;
- for (; p >= minP; p--) {
- if (getDigitPos(p) != 0) {
- section = roundingutils::SECTION_LOWER;
- break;
- }
- }
- } else if (leadingDigit == 4 && (!nickel || trailingDigit == 2 || trailingDigit == 7)) {
- section = roundingutils::SECTION_MIDPOINT;
- for (; p >= minP; p--) {
- if (getDigitPos(p) != 9) {
- section = roundingutils::SECTION_LOWER;
- break;
- }
- }
- } else if (leadingDigit == 5 && (!nickel || trailingDigit == 2 || trailingDigit == 7)) {
- section = roundingutils::SECTION_MIDPOINT;
- for (; p >= minP; p--) {
- if (getDigitPos(p) != 0) {
- section = roundingutils::SECTION_UPPER;
- break;
- }
- }
- } else if (leadingDigit == 9 && (!nickel || trailingDigit == 4 || trailingDigit == 9)) {
- section = roundingutils::SECTION_UPPER_EDGE;
- for (; p >= minP; p--) {
- if (getDigitPos(p) != 9) {
- section = roundingutils::SECTION_UPPER;
- break;
- }
- }
- } else if (nickel && trailingDigit != 2 && trailingDigit != 7) {
- // Nickel rounding, and not at .02x or .07x
- if (trailingDigit < 2) {
- // .00, .01 => down to .00
- section = roundingutils::SECTION_LOWER;
- } else if (trailingDigit < 5) {
- // .03, .04 => up to .05
- section = roundingutils::SECTION_UPPER;
- } else if (trailingDigit < 7) {
- // .05, .06 => down to .05
- section = roundingutils::SECTION_LOWER;
- } else {
- // .08, .09 => up to .10
- section = roundingutils::SECTION_UPPER;
- }
- } else if (leadingDigit < 5) {
- // Includes nickel rounding .020-.024 and .070-.074
- section = roundingutils::SECTION_LOWER;
- } else {
- // Includes nickel rounding .026-.029 and .076-.079
- section = roundingutils::SECTION_UPPER;
- }
-
- bool roundsAtMidpoint = roundingutils::roundsAtMidpoint(roundingMode);
- if (safeSubtract(position, 1) < precision - 14 ||
- (roundsAtMidpoint && section == roundingutils::SECTION_MIDPOINT) ||
- (!roundsAtMidpoint && section < 0 /* i.e. at upper or lower edge */)) {
- // Oops! This means that we have to get the exact representation of the double,
- // because the zone of uncertainty is along the rounding boundary.
- convertToAccurateDouble();
- roundToMagnitude(magnitude, roundingMode, nickel, status); // start over
- return;
- }
-
- // Turn off the approximate double flag, since the value is now confirmed to be exact.
- isApproximate = false;
- origDouble = 0.0;
- origDelta = 0;
-
- if (position <= 0 && (!nickel || trailingDigit == 0 || trailingDigit == 5)) {
- // All digits are to the left of the rounding magnitude.
- return;
- }
-
- // Good to continue rounding.
- if (section == -1) { section = roundingutils::SECTION_LOWER; }
- if (section == -2) { section = roundingutils::SECTION_UPPER; }
- }
-
- // Nickel rounding "half even" goes to the nearest whole (away from the 5).
- bool isEven = nickel
- ? (trailingDigit < 2 || trailingDigit > 7
- || (trailingDigit == 2 && section != roundingutils::SECTION_UPPER)
- || (trailingDigit == 7 && section == roundingutils::SECTION_UPPER))
- : (trailingDigit % 2) == 0;
-
- bool roundDown = roundingutils::getRoundingDirection(isEven,
- isNegative(),
- section,
- roundingMode,
- status);
- if (U_FAILURE(status)) {
- return;
- }
-
- // Perform truncation
- if (position >= precision) {
- setBcdToZero();
- scale = magnitude;
- } else {
- shiftRight(position);
- }
-
- if (nickel) {
- if (trailingDigit < 5 && roundDown) {
- setDigitPos(0, 0);
- compact();
- return;
- } else if (trailingDigit >= 5 && !roundDown) {
- setDigitPos(0, 9);
- trailingDigit = 9;
- // do not return: use the bubbling logic below
- } else {
- setDigitPos(0, 5);
- // compact not necessary: digit at position 0 is nonzero
- return;
- }
- }
-
- // Bubble the result to the higher digits
- if (!roundDown) {
- if (trailingDigit == 9) {
- int bubblePos = 0;
- // Note: in the long implementation, the most digits BCD can have at this point is
- // 15, so bubblePos <= 15 and getDigitPos(bubblePos) is safe.
- for (; getDigitPos(bubblePos) == 9; bubblePos++) {}
- shiftRight(bubblePos); // shift off the trailing 9s
- }
- int8_t digit0 = getDigitPos(0);
- U_ASSERT(digit0 != 9);
- setDigitPos(0, static_cast<int8_t>(digit0 + 1));
- precision += 1; // in case an extra digit got added
- }
-
- compact();
- }
-}
-
-void DecimalQuantity::roundToInfinity() {
- if (isApproximate) {
- convertToAccurateDouble();
- }
-}
-
-void DecimalQuantity::appendDigit(int8_t value, int32_t leadingZeros, bool appendAsInteger) {
- U_ASSERT(leadingZeros >= 0);
-
- // Zero requires special handling to maintain the invariant that the least-significant digit
- // in the BCD is nonzero.
- if (value == 0) {
- if (appendAsInteger && precision != 0) {
- scale += leadingZeros + 1;
- }
- return;
- }
-
- // Deal with trailing zeros
- if (scale > 0) {
- leadingZeros += scale;
- if (appendAsInteger) {
- scale = 0;
- }
- }
-
- // Append digit
- shiftLeft(leadingZeros + 1);
- setDigitPos(0, value);
-
- // Fix scale if in integer mode
- if (appendAsInteger) {
- scale += leadingZeros + 1;
- }
-}
-
-UnicodeString DecimalQuantity::toPlainString() const {
- U_ASSERT(!isApproximate);
- UnicodeString sb;
- if (isNegative()) {
- sb.append(u'-');
- }
- if (precision == 0) {
- sb.append(u'0');
- return sb;
- }
- int32_t upper = scale + precision + exponent - 1;
- int32_t lower = scale + exponent;
- if (upper < lReqPos - 1) {
- upper = lReqPos - 1;
- }
- if (lower > rReqPos) {
- lower = rReqPos;
- }
- int32_t p = upper;
- if (p < 0) {
- sb.append(u'0');
- }
- for (; p >= 0; p--) {
- sb.append(u'0' + getDigitPos(p - scale - exponent));
- }
- if (lower < 0) {
- sb.append(u'.');
- }
- for(; p >= lower; p--) {
- sb.append(u'0' + getDigitPos(p - scale - exponent));
- }
- return sb;
-}
-
-UnicodeString DecimalQuantity::toScientificString() const {
- U_ASSERT(!isApproximate);
- UnicodeString result;
- if (isNegative()) {
- result.append(u'-');
- }
- if (precision == 0) {
- result.append(u"0E+0", -1);
- return result;
- }
- int32_t upperPos = precision - 1;
- int32_t lowerPos = 0;
- int32_t p = upperPos;
- result.append(u'0' + getDigitPos(p));
- if ((--p) >= lowerPos) {
- result.append(u'.');
- for (; p >= lowerPos; p--) {
- result.append(u'0' + getDigitPos(p));
- }
- }
- result.append(u'E');
- int32_t _scale = upperPos + scale + exponent;
- if (_scale == INT32_MIN) {
- result.append({u"-2147483648", -1});
- return result;
- } else if (_scale < 0) {
- _scale *= -1;
- result.append(u'-');
- } else {
- result.append(u'+');
- }
- if (_scale == 0) {
- result.append(u'0');
- }
- int32_t insertIndex = result.length();
- while (_scale > 0) {
- std::div_t res = std::div(_scale, 10);
- result.insert(insertIndex, u'0' + res.rem);
- _scale = res.quot;
- }
- return result;
-}
-
-////////////////////////////////////////////////////
-/// End of DecimalQuantity_AbstractBCD.java ///
-/// Start of DecimalQuantity_DualStorageBCD.java ///
-////////////////////////////////////////////////////
-
-int8_t DecimalQuantity::getDigitPos(int32_t position) const {
- if (usingBytes) {
- if (position < 0 || position >= precision) { return 0; }
- return fBCD.bcdBytes.ptr[position];
- } else {
- if (position < 0 || position >= 16) { return 0; }
- return (int8_t) ((fBCD.bcdLong >> (position * 4)) & 0xf);
- }
-}
-
-void DecimalQuantity::setDigitPos(int32_t position, int8_t value) {
- U_ASSERT(position >= 0);
- if (usingBytes) {
- ensureCapacity(position + 1);
- fBCD.bcdBytes.ptr[position] = value;
- } else if (position >= 16) {
- switchStorage();
- ensureCapacity(position + 1);
- fBCD.bcdBytes.ptr[position] = value;
- } else {
- int shift = position * 4;
- fBCD.bcdLong = (fBCD.bcdLong & ~(0xfL << shift)) | ((long) value << shift);
- }
-}
-
-void DecimalQuantity::shiftLeft(int32_t numDigits) {
- if (!usingBytes && precision + numDigits > 16) {
- switchStorage();
- }
- if (usingBytes) {
- ensureCapacity(precision + numDigits);
- int i = precision + numDigits - 1;
- for (; i >= numDigits; i--) {
- fBCD.bcdBytes.ptr[i] = fBCD.bcdBytes.ptr[i - numDigits];
- }
- for (; i >= 0; i--) {
- fBCD.bcdBytes.ptr[i] = 0;
- }
- } else {
- fBCD.bcdLong <<= (numDigits * 4);
- }
- scale -= numDigits;
- precision += numDigits;
-}
-
-void DecimalQuantity::shiftRight(int32_t numDigits) {
- if (usingBytes) {
- int i = 0;
- for (; i < precision - numDigits; i++) {
- fBCD.bcdBytes.ptr[i] = fBCD.bcdBytes.ptr[i + numDigits];
- }
- for (; i < precision; i++) {
- fBCD.bcdBytes.ptr[i] = 0;
- }
- } else {
- fBCD.bcdLong >>= (numDigits * 4);
- }
- scale += numDigits;
- precision -= numDigits;
-}
-
-void DecimalQuantity::popFromLeft(int32_t numDigits) {
- U_ASSERT(numDigits <= precision);
- if (usingBytes) {
- int i = precision - 1;
- for (; i >= precision - numDigits; i--) {
- fBCD.bcdBytes.ptr[i] = 0;
- }
- } else {
- fBCD.bcdLong &= (static_cast<uint64_t>(1) << ((precision - numDigits) * 4)) - 1;
- }
- precision -= numDigits;
-}
-
-void DecimalQuantity::setBcdToZero() {
- if (usingBytes) {
- uprv_free(fBCD.bcdBytes.ptr);
- fBCD.bcdBytes.ptr = nullptr;
- usingBytes = false;
- }
- fBCD.bcdLong = 0L;
- scale = 0;
- precision = 0;
- isApproximate = false;
- origDouble = 0;
- origDelta = 0;
- exponent = 0;
-}
-
-void DecimalQuantity::readIntToBcd(int32_t n) {
- U_ASSERT(n != 0);
- // ints always fit inside the long implementation.
- uint64_t result = 0L;
- int i = 16;
- for (; n != 0; n /= 10, i--) {
- result = (result >> 4) + ((static_cast<uint64_t>(n) % 10) << 60);
- }
- U_ASSERT(!usingBytes);
- fBCD.bcdLong = result >> (i * 4);
- scale = 0;
- precision = 16 - i;
-}
-
-void DecimalQuantity::readLongToBcd(int64_t n) {
- U_ASSERT(n != 0);
- if (n >= 10000000000000000L) {
- ensureCapacity();
- int i = 0;
- for (; n != 0L; n /= 10L, i++) {
- fBCD.bcdBytes.ptr[i] = static_cast<int8_t>(n % 10);
- }
- U_ASSERT(usingBytes);
- scale = 0;
- precision = i;
- } else {
- uint64_t result = 0L;
- int i = 16;
- for (; n != 0L; n /= 10L, i--) {
- result = (result >> 4) + ((n % 10) << 60);
- }
- U_ASSERT(i >= 0);
- U_ASSERT(!usingBytes);
- fBCD.bcdLong = result >> (i * 4);
- scale = 0;
- precision = 16 - i;
- }
-}
-
-void DecimalQuantity::readDecNumberToBcd(const DecNum& decnum) {
- const decNumber* dn = decnum.getRawDecNumber();
- if (dn->digits > 16) {
- ensureCapacity(dn->digits);
- for (int32_t i = 0; i < dn->digits; i++) {
- fBCD.bcdBytes.ptr[i] = dn->lsu[i];
- }
- } else {
- uint64_t result = 0L;
- for (int32_t i = 0; i < dn->digits; i++) {
- result |= static_cast<uint64_t>(dn->lsu[i]) << (4 * i);
- }
- fBCD.bcdLong = result;
- }
- scale = dn->exponent;
- precision = dn->digits;
-}
-
-void DecimalQuantity::readDoubleConversionToBcd(
- const char* buffer, int32_t length, int32_t point) {
- // NOTE: Despite the fact that double-conversion's API is called
- // "DoubleToAscii", they actually use '0' (as opposed to u8'0').
- if (length > 16) {
- ensureCapacity(length);
- for (int32_t i = 0; i < length; i++) {
- fBCD.bcdBytes.ptr[i] = buffer[length-i-1] - '0';
- }
- } else {
- uint64_t result = 0L;
- for (int32_t i = 0; i < length; i++) {
- result |= static_cast<uint64_t>(buffer[length-i-1] - '0') << (4 * i);
- }
- fBCD.bcdLong = result;
- }
- scale = point - length;
- precision = length;
-}
-
-void DecimalQuantity::compact() {
- if (usingBytes) {
- int32_t delta = 0;
- for (; delta < precision && fBCD.bcdBytes.ptr[delta] == 0; delta++);
- if (delta == precision) {
- // Number is zero
- setBcdToZero();
- return;
- } else {
- // Remove trailing zeros
- shiftRight(delta);
- }
-
- // Compute precision
- int32_t leading = precision - 1;
- for (; leading >= 0 && fBCD.bcdBytes.ptr[leading] == 0; leading--);
- precision = leading + 1;
-
- // Switch storage mechanism if possible
- if (precision <= 16) {
- switchStorage();
- }
-
- } else {
- if (fBCD.bcdLong == 0L) {
- // Number is zero
- setBcdToZero();
- return;
- }
-
- // Compact the number (remove trailing zeros)
- // TODO: Use a more efficient algorithm here and below. There is a logarithmic one.
- int32_t delta = 0;
- for (; delta < precision && getDigitPos(delta) == 0; delta++);
- fBCD.bcdLong >>= delta * 4;
- scale += delta;
-
- // Compute precision
- int32_t leading = precision - 1;
- for (; leading >= 0 && getDigitPos(leading) == 0; leading--);
- precision = leading + 1;
- }
-}
-
-void DecimalQuantity::ensureCapacity() {
- ensureCapacity(40);
-}
-
-void DecimalQuantity::ensureCapacity(int32_t capacity) {
- if (capacity == 0) { return; }
- int32_t oldCapacity = usingBytes ? fBCD.bcdBytes.len : 0;
- if (!usingBytes) {
- // TODO: There is nothing being done to check for memory allocation failures.
- // TODO: Consider indexing by nybbles instead of bytes in C++, so that we can
- // make these arrays half the size.
- fBCD.bcdBytes.ptr = static_cast<int8_t*>(uprv_malloc(capacity * sizeof(int8_t)));
- fBCD.bcdBytes.len = capacity;
- // Initialize the byte array to zeros (this is done automatically in Java)
- uprv_memset(fBCD.bcdBytes.ptr, 0, capacity * sizeof(int8_t));
- } else if (oldCapacity < capacity) {
- auto bcd1 = static_cast<int8_t*>(uprv_malloc(capacity * 2 * sizeof(int8_t)));
- uprv_memcpy(bcd1, fBCD.bcdBytes.ptr, oldCapacity * sizeof(int8_t));
- // Initialize the rest of the byte array to zeros (this is done automatically in Java)
- uprv_memset(bcd1 + oldCapacity, 0, (capacity - oldCapacity) * sizeof(int8_t));
- uprv_free(fBCD.bcdBytes.ptr);
- fBCD.bcdBytes.ptr = bcd1;
- fBCD.bcdBytes.len = capacity * 2;
- }
- usingBytes = true;
-}
-
-void DecimalQuantity::switchStorage() {
- if (usingBytes) {
- // Change from bytes to long
- uint64_t bcdLong = 0L;
- for (int i = precision - 1; i >= 0; i--) {
- bcdLong <<= 4;
- bcdLong |= fBCD.bcdBytes.ptr[i];
- }
- uprv_free(fBCD.bcdBytes.ptr);
- fBCD.bcdBytes.ptr = nullptr;
- fBCD.bcdLong = bcdLong;
- usingBytes = false;
- } else {
- // Change from long to bytes
- // Copy the long into a local variable since it will get munged when we allocate the bytes
- uint64_t bcdLong = fBCD.bcdLong;
- ensureCapacity();
- for (int i = 0; i < precision; i++) {
- fBCD.bcdBytes.ptr[i] = static_cast<int8_t>(bcdLong & 0xf);
- bcdLong >>= 4;
- }
- U_ASSERT(usingBytes);
- }
-}
-
-void DecimalQuantity::copyBcdFrom(const DecimalQuantity &other) {
- setBcdToZero();
- if (other.usingBytes) {
- ensureCapacity(other.precision);
- uprv_memcpy(fBCD.bcdBytes.ptr, other.fBCD.bcdBytes.ptr, other.precision * sizeof(int8_t));
- } else {
- fBCD.bcdLong = other.fBCD.bcdLong;
- }
-}
-
-void DecimalQuantity::moveBcdFrom(DecimalQuantity &other) {
- setBcdToZero();
- if (other.usingBytes) {
- usingBytes = true;
- fBCD.bcdBytes.ptr = other.fBCD.bcdBytes.ptr;
- fBCD.bcdBytes.len = other.fBCD.bcdBytes.len;
- // Take ownership away from the old instance:
- other.fBCD.bcdBytes.ptr = nullptr;
- other.usingBytes = false;
- } else {
- fBCD.bcdLong = other.fBCD.bcdLong;
- }
-}
-
-const char16_t* DecimalQuantity::checkHealth() const {
- if (usingBytes) {
- if (precision == 0) { return u"Zero precision but we are in byte mode"; }
- int32_t capacity = fBCD.bcdBytes.len;
- if (precision > capacity) { return u"Precision exceeds length of byte array"; }
- if (getDigitPos(precision - 1) == 0) { return u"Most significant digit is zero in byte mode"; }
- if (getDigitPos(0) == 0) { return u"Least significant digit is zero in long mode"; }
- for (int i = 0; i < precision; i++) {
- if (getDigitPos(i) >= 10) { return u"Digit exceeding 10 in byte array"; }
- if (getDigitPos(i) < 0) { return u"Digit below 0 in byte array"; }
- }
- for (int i = precision; i < capacity; i++) {
- if (getDigitPos(i) != 0) { return u"Nonzero digits outside of range in byte array"; }
- }
- } else {
- if (precision == 0 && fBCD.bcdLong != 0) {
- return u"Value in bcdLong even though precision is zero";
- }
- if (precision > 16) { return u"Precision exceeds length of long"; }
- if (precision != 0 && getDigitPos(precision - 1) == 0) {
- return u"Most significant digit is zero in long mode";
- }
- if (precision != 0 && getDigitPos(0) == 0) {
- return u"Least significant digit is zero in long mode";
- }
- for (int i = 0; i < precision; i++) {
- if (getDigitPos(i) >= 10) { return u"Digit exceeding 10 in long"; }
- if (getDigitPos(i) < 0) { return u"Digit below 0 in long (?!)"; }
- }
- for (int i = precision; i < 16; i++) {
- if (getDigitPos(i) != 0) { return u"Nonzero digits outside of range in long"; }
- }
- }
-
- // No error
- return nullptr;
-}
-
-bool DecimalQuantity::operator==(const DecimalQuantity& other) const {
- bool basicEquals =
- scale == other.scale
- && precision == other.precision
- && flags == other.flags
- && lReqPos == other.lReqPos
- && rReqPos == other.rReqPos
- && isApproximate == other.isApproximate;
- if (!basicEquals) {
- return false;
- }
-
- if (precision == 0) {
- return true;
- } else if (isApproximate) {
- return origDouble == other.origDouble && origDelta == other.origDelta;
- } else {
- for (int m = getUpperDisplayMagnitude(); m >= getLowerDisplayMagnitude(); m--) {
- if (getDigit(m) != other.getDigit(m)) {
- return false;
- }
- }
- return true;
- }
-}
-
-UnicodeString DecimalQuantity::toString() const {
- MaybeStackArray<char, 30> digits(precision + 1);
- for (int32_t i = 0; i < precision; i++) {
- digits[i] = getDigitPos(precision - i - 1) + '0';
- }
- digits[precision] = 0; // terminate buffer
- char buffer8[100];
- snprintf(
- buffer8,
- sizeof(buffer8),
- "<DecimalQuantity %d:%d %s %s%s%s%d>",
- lReqPos,
- rReqPos,
- (usingBytes ? "bytes" : "long"),
- (isNegative() ? "-" : ""),
- (precision == 0 ? "0" : digits.getAlias()),
- "E",
- scale);
- return UnicodeString(buffer8, -1, US_INV);
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include <cstdlib>
+#include <cmath>
+#include <limits>
+#include <stdlib.h>
+
+#include "unicode/plurrule.h"
+#include "cmemory.h"
+#include "number_decnum.h"
+#include "putilimp.h"
+#include "number_decimalquantity.h"
+#include "number_roundingutils.h"
+#include "double-conversion.h"
+#include "charstr.h"
+#include "number_utils.h"
+#include "uassert.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+using icu::double_conversion::DoubleToStringConverter;
+using icu::double_conversion::StringToDoubleConverter;
+
+namespace {
+
+int8_t NEGATIVE_FLAG = 1;
+int8_t INFINITY_FLAG = 2;
+int8_t NAN_FLAG = 4;
+
+/** Helper function for safe subtraction (no overflow). */
+inline int32_t safeSubtract(int32_t a, int32_t b) {
+ // Note: In C++, signed integer subtraction is undefined behavior.
+ int32_t diff = static_cast<int32_t>(static_cast<uint32_t>(a) - static_cast<uint32_t>(b));
+ if (b < 0 && diff < a) { return INT32_MAX; }
+ if (b > 0 && diff > a) { return INT32_MIN; }
+ return diff;
+}
+
+static double DOUBLE_MULTIPLIERS[] = {
+ 1e0,
+ 1e1,
+ 1e2,
+ 1e3,
+ 1e4,
+ 1e5,
+ 1e6,
+ 1e7,
+ 1e8,
+ 1e9,
+ 1e10,
+ 1e11,
+ 1e12,
+ 1e13,
+ 1e14,
+ 1e15,
+ 1e16,
+ 1e17,
+ 1e18,
+ 1e19,
+ 1e20,
+ 1e21};
+
+} // namespace
+
+icu::IFixedDecimal::~IFixedDecimal() = default;
+
+DecimalQuantity::DecimalQuantity() {
+ setBcdToZero();
+ flags = 0;
+}
+
+DecimalQuantity::~DecimalQuantity() {
+ if (usingBytes) {
+ uprv_free(fBCD.bcdBytes.ptr);
+ fBCD.bcdBytes.ptr = nullptr;
+ usingBytes = false;
+ }
+}
+
+DecimalQuantity::DecimalQuantity(const DecimalQuantity &other) {
+ *this = other;
+}
+
+DecimalQuantity::DecimalQuantity(DecimalQuantity&& src) U_NOEXCEPT {
+ *this = std::move(src);
+}
+
+DecimalQuantity &DecimalQuantity::operator=(const DecimalQuantity &other) {
+ if (this == &other) {
+ return *this;
+ }
+ copyBcdFrom(other);
+ copyFieldsFrom(other);
+ return *this;
+}
+
+DecimalQuantity& DecimalQuantity::operator=(DecimalQuantity&& src) U_NOEXCEPT {
+ if (this == &src) {
+ return *this;
+ }
+ moveBcdFrom(src);
+ copyFieldsFrom(src);
+ return *this;
+}
+
+void DecimalQuantity::copyFieldsFrom(const DecimalQuantity& other) {
+ bogus = other.bogus;
+ lReqPos = other.lReqPos;
+ rReqPos = other.rReqPos;
+ scale = other.scale;
+ precision = other.precision;
+ flags = other.flags;
+ origDouble = other.origDouble;
+ origDelta = other.origDelta;
+ isApproximate = other.isApproximate;
+ exponent = other.exponent;
+}
+
+void DecimalQuantity::clear() {
+ lReqPos = 0;
+ rReqPos = 0;
+ flags = 0;
+ setBcdToZero(); // sets scale, precision, hasDouble, origDouble, origDelta, and BCD data
+}
+
+void DecimalQuantity::setMinInteger(int32_t minInt) {
+ // Validation should happen outside of DecimalQuantity, e.g., in the Precision class.
+ U_ASSERT(minInt >= 0);
+
+ // Special behavior: do not set minInt to be less than what is already set.
+ // This is so significant digits rounding can set the integer length.
+ if (minInt < lReqPos) {
+ minInt = lReqPos;
+ }
+
+ // Save values into internal state
+ lReqPos = minInt;
+}
+
+void DecimalQuantity::setMinFraction(int32_t minFrac) {
+ // Validation should happen outside of DecimalQuantity, e.g., in the Precision class.
+ U_ASSERT(minFrac >= 0);
+
+ // Save values into internal state
+ // Negation is safe for minFrac/maxFrac because -Integer.MAX_VALUE > Integer.MIN_VALUE
+ rReqPos = -minFrac;
+}
+
+void DecimalQuantity::applyMaxInteger(int32_t maxInt) {
+ // Validation should happen outside of DecimalQuantity, e.g., in the Precision class.
+ U_ASSERT(maxInt >= 0);
+
+ if (precision == 0) {
+ return;
+ }
+
+ if (maxInt <= scale) {
+ setBcdToZero();
+ return;
+ }
+
+ int32_t magnitude = getMagnitude();
+ if (maxInt <= magnitude) {
+ popFromLeft(magnitude - maxInt + 1);
+ compact();
+ }
+}
+
+uint64_t DecimalQuantity::getPositionFingerprint() const {
+ uint64_t fingerprint = 0;
+ fingerprint ^= (lReqPos << 16);
+ fingerprint ^= (static_cast<uint64_t>(rReqPos) << 32);
+ return fingerprint;
+}
+
+void DecimalQuantity::roundToIncrement(double roundingIncrement, RoundingMode roundingMode,
+ UErrorCode& status) {
+ // Do not call this method with an increment having only a 1 or a 5 digit!
+ // Use a more efficient call to either roundToMagnitude() or roundToNickel().
+ // Check a few popular rounding increments; a more thorough check is in Java.
+ U_ASSERT(roundingIncrement != 0.01);
+ U_ASSERT(roundingIncrement != 0.05);
+ U_ASSERT(roundingIncrement != 0.1);
+ U_ASSERT(roundingIncrement != 0.5);
+ U_ASSERT(roundingIncrement != 1);
+ U_ASSERT(roundingIncrement != 5);
+
+ DecNum incrementDN;
+ incrementDN.setTo(roundingIncrement, status);
+ if (U_FAILURE(status)) { return; }
+
+ // Divide this DecimalQuantity by the increment, round, then multiply back.
+ divideBy(incrementDN, status);
+ if (U_FAILURE(status)) { return; }
+ roundToMagnitude(0, roundingMode, status);
+ if (U_FAILURE(status)) { return; }
+ multiplyBy(incrementDN, status);
+ if (U_FAILURE(status)) { return; }
+}
+
+void DecimalQuantity::multiplyBy(const DecNum& multiplicand, UErrorCode& status) {
+ if (isZeroish()) {
+ return;
+ }
+ // Convert to DecNum, multiply, and convert back.
+ DecNum decnum;
+ toDecNum(decnum, status);
+ if (U_FAILURE(status)) { return; }
+ decnum.multiplyBy(multiplicand, status);
+ if (U_FAILURE(status)) { return; }
+ setToDecNum(decnum, status);
+}
+
+void DecimalQuantity::divideBy(const DecNum& divisor, UErrorCode& status) {
+ if (isZeroish()) {
+ return;
+ }
+ // Convert to DecNum, multiply, and convert back.
+ DecNum decnum;
+ toDecNum(decnum, status);
+ if (U_FAILURE(status)) { return; }
+ decnum.divideBy(divisor, status);
+ if (U_FAILURE(status)) { return; }
+ setToDecNum(decnum, status);
+}
+
+void DecimalQuantity::negate() {
+ flags ^= NEGATIVE_FLAG;
+}
+
+int32_t DecimalQuantity::getMagnitude() const {
+ U_ASSERT(precision != 0);
+ return scale + precision - 1;
+}
+
+bool DecimalQuantity::adjustMagnitude(int32_t delta) {
+ if (precision != 0) {
+ // i.e., scale += delta; origDelta += delta
+ bool overflow = uprv_add32_overflow(scale, delta, &scale);
+ overflow = uprv_add32_overflow(origDelta, delta, &origDelta) || overflow;
+ // Make sure that precision + scale won't overflow, either
+ int32_t dummy;
+ overflow = overflow || uprv_add32_overflow(scale, precision, &dummy);
+ return overflow;
+ }
+ return false;
+}
+
+double DecimalQuantity::getPluralOperand(PluralOperand operand) const {
+ // If this assertion fails, you need to call roundToInfinity() or some other rounding method.
+ // See the comment at the top of this file explaining the "isApproximate" field.
+ U_ASSERT(!isApproximate);
+
+ switch (operand) {
+ case PLURAL_OPERAND_I:
+ // Invert the negative sign if necessary
+ return static_cast<double>(isNegative() ? -toLong(true) : toLong(true));
+ case PLURAL_OPERAND_F:
+ return static_cast<double>(toFractionLong(true));
+ case PLURAL_OPERAND_T:
+ return static_cast<double>(toFractionLong(false));
+ case PLURAL_OPERAND_V:
+ return fractionCount();
+ case PLURAL_OPERAND_W:
+ return fractionCountWithoutTrailingZeros();
+ case PLURAL_OPERAND_E:
+ return static_cast<double>(getExponent());
+ default:
+ return std::abs(toDouble());
+ }
+}
+
+int32_t DecimalQuantity::getExponent() const {
+ return exponent;
+}
+
+void DecimalQuantity::adjustExponent(int delta) {
+ exponent = exponent + delta;
+}
+
+bool DecimalQuantity::hasIntegerValue() const {
+ return scale >= 0;
+}
+
+int32_t DecimalQuantity::getUpperDisplayMagnitude() const {
+ // If this assertion fails, you need to call roundToInfinity() or some other rounding method.
+ // See the comment in the header file explaining the "isApproximate" field.
+ U_ASSERT(!isApproximate);
+
+ int32_t magnitude = scale + precision;
+ int32_t result = (lReqPos > magnitude) ? lReqPos : magnitude;
+ return result - 1;
+}
+
+int32_t DecimalQuantity::getLowerDisplayMagnitude() const {
+ // If this assertion fails, you need to call roundToInfinity() or some other rounding method.
+ // See the comment in the header file explaining the "isApproximate" field.
+ U_ASSERT(!isApproximate);
+
+ int32_t magnitude = scale;
+ int32_t result = (rReqPos < magnitude) ? rReqPos : magnitude;
+ return result;
+}
+
+int8_t DecimalQuantity::getDigit(int32_t magnitude) const {
+ // If this assertion fails, you need to call roundToInfinity() or some other rounding method.
+ // See the comment at the top of this file explaining the "isApproximate" field.
+ U_ASSERT(!isApproximate);
+
+ return getDigitPos(magnitude - scale);
+}
+
+int32_t DecimalQuantity::fractionCount() const {
+ int32_t fractionCountWithExponent = -getLowerDisplayMagnitude() - exponent;
+ return fractionCountWithExponent > 0 ? fractionCountWithExponent : 0;
+}
+
+int32_t DecimalQuantity::fractionCountWithoutTrailingZeros() const {
+ int32_t fractionCountWithExponent = -scale - exponent;
+ return fractionCountWithExponent > 0 ? fractionCountWithExponent : 0; // max(-fractionCountWithExponent, 0)
+}
+
+bool DecimalQuantity::isNegative() const {
+ return (flags & NEGATIVE_FLAG) != 0;
+}
+
+Signum DecimalQuantity::signum() const {
+ bool isZero = (isZeroish() && !isInfinite());
+ bool isNeg = isNegative();
+ if (isZero && isNeg) {
+ return SIGNUM_NEG_ZERO;
+ } else if (isZero) {
+ return SIGNUM_POS_ZERO;
+ } else if (isNeg) {
+ return SIGNUM_NEG;
+ } else {
+ return SIGNUM_POS;
+ }
+}
+
+bool DecimalQuantity::isInfinite() const {
+ return (flags & INFINITY_FLAG) != 0;
+}
+
+bool DecimalQuantity::isNaN() const {
+ return (flags & NAN_FLAG) != 0;
+}
+
+bool DecimalQuantity::isZeroish() const {
+ return precision == 0;
+}
+
+DecimalQuantity &DecimalQuantity::setToInt(int32_t n) {
+ setBcdToZero();
+ flags = 0;
+ if (n == INT32_MIN) {
+ flags |= NEGATIVE_FLAG;
+ // leave as INT32_MIN; handled below in _setToInt()
+ } else if (n < 0) {
+ flags |= NEGATIVE_FLAG;
+ n = -n;
+ }
+ if (n != 0) {
+ _setToInt(n);
+ compact();
+ }
+ return *this;
+}
+
+void DecimalQuantity::_setToInt(int32_t n) {
+ if (n == INT32_MIN) {
+ readLongToBcd(-static_cast<int64_t>(n));
+ } else {
+ readIntToBcd(n);
+ }
+}
+
+DecimalQuantity &DecimalQuantity::setToLong(int64_t n) {
+ setBcdToZero();
+ flags = 0;
+ if (n < 0 && n > INT64_MIN) {
+ flags |= NEGATIVE_FLAG;
+ n = -n;
+ }
+ if (n != 0) {
+ _setToLong(n);
+ compact();
+ }
+ return *this;
+}
+
+void DecimalQuantity::_setToLong(int64_t n) {
+ if (n == INT64_MIN) {
+ DecNum decnum;
+ UErrorCode localStatus = U_ZERO_ERROR;
+ decnum.setTo("9.223372036854775808E+18", localStatus);
+ if (U_FAILURE(localStatus)) { return; } // unexpected
+ flags |= NEGATIVE_FLAG;
+ readDecNumberToBcd(decnum);
+ } else if (n <= INT32_MAX) {
+ readIntToBcd(static_cast<int32_t>(n));
+ } else {
+ readLongToBcd(n);
+ }
+}
+
+DecimalQuantity &DecimalQuantity::setToDouble(double n) {
+ setBcdToZero();
+ flags = 0;
+ // signbit() from <math.h> handles +0.0 vs -0.0
+ if (std::signbit(n)) {
+ flags |= NEGATIVE_FLAG;
+ n = -n;
+ }
+ if (std::isnan(n) != 0) {
+ flags |= NAN_FLAG;
+ } else if (std::isfinite(n) == 0) {
+ flags |= INFINITY_FLAG;
+ } else if (n != 0) {
+ _setToDoubleFast(n);
+ compact();
+ }
+ return *this;
+}
+
+void DecimalQuantity::_setToDoubleFast(double n) {
+ isApproximate = true;
+ origDouble = n;
+ origDelta = 0;
+
+ // Make sure the double is an IEEE 754 double. If not, fall back to the slow path right now.
+ // TODO: Make a fast path for other types of doubles.
+ if (!std::numeric_limits<double>::is_iec559) {
+ convertToAccurateDouble();
+ return;
+ }
+
+ // To get the bits from the double, use memcpy, which takes care of endianness.
+ uint64_t ieeeBits;
+ uprv_memcpy(&ieeeBits, &n, sizeof(n));
+ int32_t exponent = static_cast<int32_t>((ieeeBits & 0x7ff0000000000000L) >> 52) - 0x3ff;
+
+ // Not all integers can be represented exactly for exponent > 52
+ if (exponent <= 52 && static_cast<int64_t>(n) == n) {
+ _setToLong(static_cast<int64_t>(n));
+ return;
+ }
+
+ if (exponent == -1023 || exponent == 1024) {
+ // The extreme values of exponent are special; use slow path.
+ convertToAccurateDouble();
+ return;
+ }
+
+ // 3.3219... is log2(10)
+ auto fracLength = static_cast<int32_t> ((52 - exponent) / 3.32192809488736234787031942948939017586);
+ if (fracLength >= 0) {
+ int32_t i = fracLength;
+ // 1e22 is the largest exact double.
+ for (; i >= 22; i -= 22) n *= 1e22;
+ n *= DOUBLE_MULTIPLIERS[i];
+ } else {
+ int32_t i = fracLength;
+ // 1e22 is the largest exact double.
+ for (; i <= -22; i += 22) n /= 1e22;
+ n /= DOUBLE_MULTIPLIERS[-i];
+ }
+ auto result = static_cast<int64_t>(uprv_round(n));
+ if (result != 0) {
+ _setToLong(result);
+ scale -= fracLength;
+ }
+}
+
+void DecimalQuantity::convertToAccurateDouble() {
+ U_ASSERT(origDouble != 0);
+ int32_t delta = origDelta;
+
+ // Call the slow oracle function (Double.toString in Java, DoubleToAscii in C++).
+ char buffer[DoubleToStringConverter::kBase10MaximalLength + 1];
+ bool sign; // unused; always positive
+ int32_t length;
+ int32_t point;
+ DoubleToStringConverter::DoubleToAscii(
+ origDouble,
+ DoubleToStringConverter::DtoaMode::SHORTEST,
+ 0,
+ buffer,
+ sizeof(buffer),
+ &sign,
+ &length,
+ &point
+ );
+
+ setBcdToZero();
+ readDoubleConversionToBcd(buffer, length, point);
+ scale += delta;
+ explicitExactDouble = true;
+}
+
+DecimalQuantity &DecimalQuantity::setToDecNumber(StringPiece n, UErrorCode& status) {
+ setBcdToZero();
+ flags = 0;
+
+ // Compute the decNumber representation
+ DecNum decnum;
+ decnum.setTo(n, status);
+
+ _setToDecNum(decnum, status);
+ return *this;
+}
+
+DecimalQuantity& DecimalQuantity::setToDecNum(const DecNum& decnum, UErrorCode& status) {
+ setBcdToZero();
+ flags = 0;
+
+ _setToDecNum(decnum, status);
+ return *this;
+}
+
+void DecimalQuantity::_setToDecNum(const DecNum& decnum, UErrorCode& status) {
+ if (U_FAILURE(status)) { return; }
+ if (decnum.isNegative()) {
+ flags |= NEGATIVE_FLAG;
+ }
+ if (!decnum.isZero()) {
+ readDecNumberToBcd(decnum);
+ compact();
+ }
+}
+
+int64_t DecimalQuantity::toLong(bool truncateIfOverflow) const {
+ // NOTE: Call sites should be guarded by fitsInLong(), like this:
+ // if (dq.fitsInLong()) { /* use dq.toLong() */ } else { /* use some fallback */ }
+ // Fallback behavior upon truncateIfOverflow is to truncate at 17 digits.
+ uint64_t result = 0L;
+ int32_t upperMagnitude = exponent + scale + precision - 1;
+ if (truncateIfOverflow) {
+ upperMagnitude = std::min(upperMagnitude, 17);
+ }
+ for (int32_t magnitude = upperMagnitude; magnitude >= 0; magnitude--) {
+ result = result * 10 + getDigitPos(magnitude - scale - exponent);
+ }
+ if (isNegative()) {
+ return static_cast<int64_t>(0LL - result); // i.e., -result
+ }
+ return static_cast<int64_t>(result);
+}
+
+uint64_t DecimalQuantity::toFractionLong(bool includeTrailingZeros) const {
+ uint64_t result = 0L;
+ int32_t magnitude = -1 - exponent;
+ int32_t lowerMagnitude = scale;
+ if (includeTrailingZeros) {
+ lowerMagnitude = std::min(lowerMagnitude, rReqPos);
+ }
+ for (; magnitude >= lowerMagnitude && result <= 1e18L; magnitude--) {
+ result = result * 10 + getDigitPos(magnitude - scale);
+ }
+ // Remove trailing zeros; this can happen during integer overflow cases.
+ if (!includeTrailingZeros) {
+ while (result > 0 && (result % 10) == 0) {
+ result /= 10;
+ }
+ }
+ return result;
+}
+
+bool DecimalQuantity::fitsInLong(bool ignoreFraction) const {
+ if (isInfinite() || isNaN()) {
+ return false;
+ }
+ if (isZeroish()) {
+ return true;
+ }
+ if (exponent + scale < 0 && !ignoreFraction) {
+ return false;
+ }
+ int magnitude = getMagnitude();
+ if (magnitude < 18) {
+ return true;
+ }
+ if (magnitude > 18) {
+ return false;
+ }
+ // Hard case: the magnitude is 10^18.
+ // The largest int64 is: 9,223,372,036,854,775,807
+ for (int p = 0; p < precision; p++) {
+ int8_t digit = getDigit(18 - p);
+ static int8_t INT64_BCD[] = { 9, 2, 2, 3, 3, 7, 2, 0, 3, 6, 8, 5, 4, 7, 7, 5, 8, 0, 8 };
+ if (digit < INT64_BCD[p]) {
+ return true;
+ } else if (digit > INT64_BCD[p]) {
+ return false;
+ }
+ }
+ // Exactly equal to max long plus one.
+ return isNegative();
+}
+
+double DecimalQuantity::toDouble() const {
+ // If this assertion fails, you need to call roundToInfinity() or some other rounding method.
+ // See the comment in the header file explaining the "isApproximate" field.
+ U_ASSERT(!isApproximate);
+
+ if (isNaN()) {
+ return NAN;
+ } else if (isInfinite()) {
+ return isNegative() ? -INFINITY : INFINITY;
+ }
+
+ // We are processing well-formed input, so we don't need any special options to StringToDoubleConverter.
+ StringToDoubleConverter converter(0, 0, 0, "", "");
+ UnicodeString numberString = this->toScientificString();
+ int32_t count;
+ return converter.StringToDouble(
+ reinterpret_cast<const uint16_t*>(numberString.getBuffer()),
+ numberString.length(),
+ &count);
+}
+
+void DecimalQuantity::toDecNum(DecNum& output, UErrorCode& status) const {
+ // Special handling for zero
+ if (precision == 0) {
+ output.setTo("0", status);
+ }
+
+ // Use the BCD constructor. We need to do a little bit of work to convert, though.
+ // The decNumber constructor expects most-significant first, but we store least-significant first.
+ MaybeStackArray<uint8_t, 20> ubcd(precision);
+ for (int32_t m = 0; m < precision; m++) {
+ ubcd[precision - m - 1] = static_cast<uint8_t>(getDigitPos(m));
+ }
+ output.setTo(ubcd.getAlias(), precision, scale, isNegative(), status);
+}
+
+void DecimalQuantity::truncate() {
+ if (scale < 0) {
+ shiftRight(-scale);
+ scale = 0;
+ compact();
+ }
+}
+
+void DecimalQuantity::roundToNickel(int32_t magnitude, RoundingMode roundingMode, UErrorCode& status) {
+ roundToMagnitude(magnitude, roundingMode, true, status);
+}
+
+void DecimalQuantity::roundToMagnitude(int32_t magnitude, RoundingMode roundingMode, UErrorCode& status) {
+ roundToMagnitude(magnitude, roundingMode, false, status);
+}
+
+void DecimalQuantity::roundToMagnitude(int32_t magnitude, RoundingMode roundingMode, bool nickel, UErrorCode& status) {
+ // The position in the BCD at which rounding will be performed; digits to the right of position
+ // will be rounded away.
+ int position = safeSubtract(magnitude, scale);
+
+ // "trailing" = least significant digit to the left of rounding
+ int8_t trailingDigit = getDigitPos(position);
+
+ if (position <= 0 && !isApproximate && (!nickel || trailingDigit == 0 || trailingDigit == 5)) {
+ // All digits are to the left of the rounding magnitude.
+ } else if (precision == 0) {
+ // No rounding for zero.
+ } else {
+ // Perform rounding logic.
+ // "leading" = most significant digit to the right of rounding
+ int8_t leadingDigit = getDigitPos(safeSubtract(position, 1));
+
+ // Compute which section of the number we are in.
+ // EDGE means we are at the bottom or top edge, like 1.000 or 1.999 (used by doubles)
+ // LOWER means we are between the bottom edge and the midpoint, like 1.391
+ // MIDPOINT means we are exactly in the middle, like 1.500
+ // UPPER means we are between the midpoint and the top edge, like 1.916
+ roundingutils::Section section;
+ if (!isApproximate) {
+ if (nickel && trailingDigit != 2 && trailingDigit != 7) {
+ // Nickel rounding, and not at .02x or .07x
+ if (trailingDigit < 2) {
+ // .00, .01 => down to .00
+ section = roundingutils::SECTION_LOWER;
+ } else if (trailingDigit < 5) {
+ // .03, .04 => up to .05
+ section = roundingutils::SECTION_UPPER;
+ } else if (trailingDigit < 7) {
+ // .05, .06 => down to .05
+ section = roundingutils::SECTION_LOWER;
+ } else {
+ // .08, .09 => up to .10
+ section = roundingutils::SECTION_UPPER;
+ }
+ } else if (leadingDigit < 5) {
+ // Includes nickel rounding .020-.024 and .070-.074
+ section = roundingutils::SECTION_LOWER;
+ } else if (leadingDigit > 5) {
+ // Includes nickel rounding .026-.029 and .076-.079
+ section = roundingutils::SECTION_UPPER;
+ } else {
+ // Includes nickel rounding .025 and .075
+ section = roundingutils::SECTION_MIDPOINT;
+ for (int p = safeSubtract(position, 2); p >= 0; p--) {
+ if (getDigitPos(p) != 0) {
+ section = roundingutils::SECTION_UPPER;
+ break;
+ }
+ }
+ }
+ } else {
+ int32_t p = safeSubtract(position, 2);
+ int32_t minP = uprv_max(0, precision - 14);
+ if (leadingDigit == 0 && (!nickel || trailingDigit == 0 || trailingDigit == 5)) {
+ section = roundingutils::SECTION_LOWER_EDGE;
+ for (; p >= minP; p--) {
+ if (getDigitPos(p) != 0) {
+ section = roundingutils::SECTION_LOWER;
+ break;
+ }
+ }
+ } else if (leadingDigit == 4 && (!nickel || trailingDigit == 2 || trailingDigit == 7)) {
+ section = roundingutils::SECTION_MIDPOINT;
+ for (; p >= minP; p--) {
+ if (getDigitPos(p) != 9) {
+ section = roundingutils::SECTION_LOWER;
+ break;
+ }
+ }
+ } else if (leadingDigit == 5 && (!nickel || trailingDigit == 2 || trailingDigit == 7)) {
+ section = roundingutils::SECTION_MIDPOINT;
+ for (; p >= minP; p--) {
+ if (getDigitPos(p) != 0) {
+ section = roundingutils::SECTION_UPPER;
+ break;
+ }
+ }
+ } else if (leadingDigit == 9 && (!nickel || trailingDigit == 4 || trailingDigit == 9)) {
+ section = roundingutils::SECTION_UPPER_EDGE;
+ for (; p >= minP; p--) {
+ if (getDigitPos(p) != 9) {
+ section = roundingutils::SECTION_UPPER;
+ break;
+ }
+ }
+ } else if (nickel && trailingDigit != 2 && trailingDigit != 7) {
+ // Nickel rounding, and not at .02x or .07x
+ if (trailingDigit < 2) {
+ // .00, .01 => down to .00
+ section = roundingutils::SECTION_LOWER;
+ } else if (trailingDigit < 5) {
+ // .03, .04 => up to .05
+ section = roundingutils::SECTION_UPPER;
+ } else if (trailingDigit < 7) {
+ // .05, .06 => down to .05
+ section = roundingutils::SECTION_LOWER;
+ } else {
+ // .08, .09 => up to .10
+ section = roundingutils::SECTION_UPPER;
+ }
+ } else if (leadingDigit < 5) {
+ // Includes nickel rounding .020-.024 and .070-.074
+ section = roundingutils::SECTION_LOWER;
+ } else {
+ // Includes nickel rounding .026-.029 and .076-.079
+ section = roundingutils::SECTION_UPPER;
+ }
+
+ bool roundsAtMidpoint = roundingutils::roundsAtMidpoint(roundingMode);
+ if (safeSubtract(position, 1) < precision - 14 ||
+ (roundsAtMidpoint && section == roundingutils::SECTION_MIDPOINT) ||
+ (!roundsAtMidpoint && section < 0 /* i.e. at upper or lower edge */)) {
+ // Oops! This means that we have to get the exact representation of the double,
+ // because the zone of uncertainty is along the rounding boundary.
+ convertToAccurateDouble();
+ roundToMagnitude(magnitude, roundingMode, nickel, status); // start over
+ return;
+ }
+
+ // Turn off the approximate double flag, since the value is now confirmed to be exact.
+ isApproximate = false;
+ origDouble = 0.0;
+ origDelta = 0;
+
+ if (position <= 0 && (!nickel || trailingDigit == 0 || trailingDigit == 5)) {
+ // All digits are to the left of the rounding magnitude.
+ return;
+ }
+
+ // Good to continue rounding.
+ if (section == -1) { section = roundingutils::SECTION_LOWER; }
+ if (section == -2) { section = roundingutils::SECTION_UPPER; }
+ }
+
+ // Nickel rounding "half even" goes to the nearest whole (away from the 5).
+ bool isEven = nickel
+ ? (trailingDigit < 2 || trailingDigit > 7
+ || (trailingDigit == 2 && section != roundingutils::SECTION_UPPER)
+ || (trailingDigit == 7 && section == roundingutils::SECTION_UPPER))
+ : (trailingDigit % 2) == 0;
+
+ bool roundDown = roundingutils::getRoundingDirection(isEven,
+ isNegative(),
+ section,
+ roundingMode,
+ status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ // Perform truncation
+ if (position >= precision) {
+ setBcdToZero();
+ scale = magnitude;
+ } else {
+ shiftRight(position);
+ }
+
+ if (nickel) {
+ if (trailingDigit < 5 && roundDown) {
+ setDigitPos(0, 0);
+ compact();
+ return;
+ } else if (trailingDigit >= 5 && !roundDown) {
+ setDigitPos(0, 9);
+ trailingDigit = 9;
+ // do not return: use the bubbling logic below
+ } else {
+ setDigitPos(0, 5);
+ // compact not necessary: digit at position 0 is nonzero
+ return;
+ }
+ }
+
+ // Bubble the result to the higher digits
+ if (!roundDown) {
+ if (trailingDigit == 9) {
+ int bubblePos = 0;
+ // Note: in the long implementation, the most digits BCD can have at this point is
+ // 15, so bubblePos <= 15 and getDigitPos(bubblePos) is safe.
+ for (; getDigitPos(bubblePos) == 9; bubblePos++) {}
+ shiftRight(bubblePos); // shift off the trailing 9s
+ }
+ int8_t digit0 = getDigitPos(0);
+ U_ASSERT(digit0 != 9);
+ setDigitPos(0, static_cast<int8_t>(digit0 + 1));
+ precision += 1; // in case an extra digit got added
+ }
+
+ compact();
+ }
+}
+
+void DecimalQuantity::roundToInfinity() {
+ if (isApproximate) {
+ convertToAccurateDouble();
+ }
+}
+
+void DecimalQuantity::appendDigit(int8_t value, int32_t leadingZeros, bool appendAsInteger) {
+ U_ASSERT(leadingZeros >= 0);
+
+ // Zero requires special handling to maintain the invariant that the least-significant digit
+ // in the BCD is nonzero.
+ if (value == 0) {
+ if (appendAsInteger && precision != 0) {
+ scale += leadingZeros + 1;
+ }
+ return;
+ }
+
+ // Deal with trailing zeros
+ if (scale > 0) {
+ leadingZeros += scale;
+ if (appendAsInteger) {
+ scale = 0;
+ }
+ }
+
+ // Append digit
+ shiftLeft(leadingZeros + 1);
+ setDigitPos(0, value);
+
+ // Fix scale if in integer mode
+ if (appendAsInteger) {
+ scale += leadingZeros + 1;
+ }
+}
+
+UnicodeString DecimalQuantity::toPlainString() const {
+ U_ASSERT(!isApproximate);
+ UnicodeString sb;
+ if (isNegative()) {
+ sb.append(u'-');
+ }
+ if (precision == 0) {
+ sb.append(u'0');
+ return sb;
+ }
+ int32_t upper = scale + precision + exponent - 1;
+ int32_t lower = scale + exponent;
+ if (upper < lReqPos - 1) {
+ upper = lReqPos - 1;
+ }
+ if (lower > rReqPos) {
+ lower = rReqPos;
+ }
+ int32_t p = upper;
+ if (p < 0) {
+ sb.append(u'0');
+ }
+ for (; p >= 0; p--) {
+ sb.append(u'0' + getDigitPos(p - scale - exponent));
+ }
+ if (lower < 0) {
+ sb.append(u'.');
+ }
+ for(; p >= lower; p--) {
+ sb.append(u'0' + getDigitPos(p - scale - exponent));
+ }
+ return sb;
+}
+
+UnicodeString DecimalQuantity::toScientificString() const {
+ U_ASSERT(!isApproximate);
+ UnicodeString result;
+ if (isNegative()) {
+ result.append(u'-');
+ }
+ if (precision == 0) {
+ result.append(u"0E+0", -1);
+ return result;
+ }
+ int32_t upperPos = precision - 1;
+ int32_t lowerPos = 0;
+ int32_t p = upperPos;
+ result.append(u'0' + getDigitPos(p));
+ if ((--p) >= lowerPos) {
+ result.append(u'.');
+ for (; p >= lowerPos; p--) {
+ result.append(u'0' + getDigitPos(p));
+ }
+ }
+ result.append(u'E');
+ int32_t _scale = upperPos + scale + exponent;
+ if (_scale == INT32_MIN) {
+ result.append({u"-2147483648", -1});
+ return result;
+ } else if (_scale < 0) {
+ _scale *= -1;
+ result.append(u'-');
+ } else {
+ result.append(u'+');
+ }
+ if (_scale == 0) {
+ result.append(u'0');
+ }
+ int32_t insertIndex = result.length();
+ while (_scale > 0) {
+ std::div_t res = std::div(_scale, 10);
+ result.insert(insertIndex, u'0' + res.rem);
+ _scale = res.quot;
+ }
+ return result;
+}
+
+////////////////////////////////////////////////////
+/// End of DecimalQuantity_AbstractBCD.java ///
+/// Start of DecimalQuantity_DualStorageBCD.java ///
+////////////////////////////////////////////////////
+
+int8_t DecimalQuantity::getDigitPos(int32_t position) const {
+ if (usingBytes) {
+ if (position < 0 || position >= precision) { return 0; }
+ return fBCD.bcdBytes.ptr[position];
+ } else {
+ if (position < 0 || position >= 16) { return 0; }
+ return (int8_t) ((fBCD.bcdLong >> (position * 4)) & 0xf);
+ }
+}
+
+void DecimalQuantity::setDigitPos(int32_t position, int8_t value) {
+ U_ASSERT(position >= 0);
+ if (usingBytes) {
+ ensureCapacity(position + 1);
+ fBCD.bcdBytes.ptr[position] = value;
+ } else if (position >= 16) {
+ switchStorage();
+ ensureCapacity(position + 1);
+ fBCD.bcdBytes.ptr[position] = value;
+ } else {
+ int shift = position * 4;
+ fBCD.bcdLong = (fBCD.bcdLong & ~(0xfL << shift)) | ((long) value << shift);
+ }
+}
+
+void DecimalQuantity::shiftLeft(int32_t numDigits) {
+ if (!usingBytes && precision + numDigits > 16) {
+ switchStorage();
+ }
+ if (usingBytes) {
+ ensureCapacity(precision + numDigits);
+ int i = precision + numDigits - 1;
+ for (; i >= numDigits; i--) {
+ fBCD.bcdBytes.ptr[i] = fBCD.bcdBytes.ptr[i - numDigits];
+ }
+ for (; i >= 0; i--) {
+ fBCD.bcdBytes.ptr[i] = 0;
+ }
+ } else {
+ fBCD.bcdLong <<= (numDigits * 4);
+ }
+ scale -= numDigits;
+ precision += numDigits;
+}
+
+void DecimalQuantity::shiftRight(int32_t numDigits) {
+ if (usingBytes) {
+ int i = 0;
+ for (; i < precision - numDigits; i++) {
+ fBCD.bcdBytes.ptr[i] = fBCD.bcdBytes.ptr[i + numDigits];
+ }
+ for (; i < precision; i++) {
+ fBCD.bcdBytes.ptr[i] = 0;
+ }
+ } else {
+ fBCD.bcdLong >>= (numDigits * 4);
+ }
+ scale += numDigits;
+ precision -= numDigits;
+}
+
+void DecimalQuantity::popFromLeft(int32_t numDigits) {
+ U_ASSERT(numDigits <= precision);
+ if (usingBytes) {
+ int i = precision - 1;
+ for (; i >= precision - numDigits; i--) {
+ fBCD.bcdBytes.ptr[i] = 0;
+ }
+ } else {
+ fBCD.bcdLong &= (static_cast<uint64_t>(1) << ((precision - numDigits) * 4)) - 1;
+ }
+ precision -= numDigits;
+}
+
+void DecimalQuantity::setBcdToZero() {
+ if (usingBytes) {
+ uprv_free(fBCD.bcdBytes.ptr);
+ fBCD.bcdBytes.ptr = nullptr;
+ usingBytes = false;
+ }
+ fBCD.bcdLong = 0L;
+ scale = 0;
+ precision = 0;
+ isApproximate = false;
+ origDouble = 0;
+ origDelta = 0;
+ exponent = 0;
+}
+
+void DecimalQuantity::readIntToBcd(int32_t n) {
+ U_ASSERT(n != 0);
+ // ints always fit inside the long implementation.
+ uint64_t result = 0L;
+ int i = 16;
+ for (; n != 0; n /= 10, i--) {
+ result = (result >> 4) + ((static_cast<uint64_t>(n) % 10) << 60);
+ }
+ U_ASSERT(!usingBytes);
+ fBCD.bcdLong = result >> (i * 4);
+ scale = 0;
+ precision = 16 - i;
+}
+
+void DecimalQuantity::readLongToBcd(int64_t n) {
+ U_ASSERT(n != 0);
+ if (n >= 10000000000000000L) {
+ ensureCapacity();
+ int i = 0;
+ for (; n != 0L; n /= 10L, i++) {
+ fBCD.bcdBytes.ptr[i] = static_cast<int8_t>(n % 10);
+ }
+ U_ASSERT(usingBytes);
+ scale = 0;
+ precision = i;
+ } else {
+ uint64_t result = 0L;
+ int i = 16;
+ for (; n != 0L; n /= 10L, i--) {
+ result = (result >> 4) + ((n % 10) << 60);
+ }
+ U_ASSERT(i >= 0);
+ U_ASSERT(!usingBytes);
+ fBCD.bcdLong = result >> (i * 4);
+ scale = 0;
+ precision = 16 - i;
+ }
+}
+
+void DecimalQuantity::readDecNumberToBcd(const DecNum& decnum) {
+ const decNumber* dn = decnum.getRawDecNumber();
+ if (dn->digits > 16) {
+ ensureCapacity(dn->digits);
+ for (int32_t i = 0; i < dn->digits; i++) {
+ fBCD.bcdBytes.ptr[i] = dn->lsu[i];
+ }
+ } else {
+ uint64_t result = 0L;
+ for (int32_t i = 0; i < dn->digits; i++) {
+ result |= static_cast<uint64_t>(dn->lsu[i]) << (4 * i);
+ }
+ fBCD.bcdLong = result;
+ }
+ scale = dn->exponent;
+ precision = dn->digits;
+}
+
+void DecimalQuantity::readDoubleConversionToBcd(
+ const char* buffer, int32_t length, int32_t point) {
+ // NOTE: Despite the fact that double-conversion's API is called
+ // "DoubleToAscii", they actually use '0' (as opposed to u8'0').
+ if (length > 16) {
+ ensureCapacity(length);
+ for (int32_t i = 0; i < length; i++) {
+ fBCD.bcdBytes.ptr[i] = buffer[length-i-1] - '0';
+ }
+ } else {
+ uint64_t result = 0L;
+ for (int32_t i = 0; i < length; i++) {
+ result |= static_cast<uint64_t>(buffer[length-i-1] - '0') << (4 * i);
+ }
+ fBCD.bcdLong = result;
+ }
+ scale = point - length;
+ precision = length;
+}
+
+void DecimalQuantity::compact() {
+ if (usingBytes) {
+ int32_t delta = 0;
+ for (; delta < precision && fBCD.bcdBytes.ptr[delta] == 0; delta++);
+ if (delta == precision) {
+ // Number is zero
+ setBcdToZero();
+ return;
+ } else {
+ // Remove trailing zeros
+ shiftRight(delta);
+ }
+
+ // Compute precision
+ int32_t leading = precision - 1;
+ for (; leading >= 0 && fBCD.bcdBytes.ptr[leading] == 0; leading--);
+ precision = leading + 1;
+
+ // Switch storage mechanism if possible
+ if (precision <= 16) {
+ switchStorage();
+ }
+
+ } else {
+ if (fBCD.bcdLong == 0L) {
+ // Number is zero
+ setBcdToZero();
+ return;
+ }
+
+ // Compact the number (remove trailing zeros)
+ // TODO: Use a more efficient algorithm here and below. There is a logarithmic one.
+ int32_t delta = 0;
+ for (; delta < precision && getDigitPos(delta) == 0; delta++);
+ fBCD.bcdLong >>= delta * 4;
+ scale += delta;
+
+ // Compute precision
+ int32_t leading = precision - 1;
+ for (; leading >= 0 && getDigitPos(leading) == 0; leading--);
+ precision = leading + 1;
+ }
+}
+
+void DecimalQuantity::ensureCapacity() {
+ ensureCapacity(40);
+}
+
+void DecimalQuantity::ensureCapacity(int32_t capacity) {
+ if (capacity == 0) { return; }
+ int32_t oldCapacity = usingBytes ? fBCD.bcdBytes.len : 0;
+ if (!usingBytes) {
+ // TODO: There is nothing being done to check for memory allocation failures.
+ // TODO: Consider indexing by nybbles instead of bytes in C++, so that we can
+ // make these arrays half the size.
+ fBCD.bcdBytes.ptr = static_cast<int8_t*>(uprv_malloc(capacity * sizeof(int8_t)));
+ fBCD.bcdBytes.len = capacity;
+ // Initialize the byte array to zeros (this is done automatically in Java)
+ uprv_memset(fBCD.bcdBytes.ptr, 0, capacity * sizeof(int8_t));
+ } else if (oldCapacity < capacity) {
+ auto bcd1 = static_cast<int8_t*>(uprv_malloc(capacity * 2 * sizeof(int8_t)));
+ uprv_memcpy(bcd1, fBCD.bcdBytes.ptr, oldCapacity * sizeof(int8_t));
+ // Initialize the rest of the byte array to zeros (this is done automatically in Java)
+ uprv_memset(bcd1 + oldCapacity, 0, (capacity - oldCapacity) * sizeof(int8_t));
+ uprv_free(fBCD.bcdBytes.ptr);
+ fBCD.bcdBytes.ptr = bcd1;
+ fBCD.bcdBytes.len = capacity * 2;
+ }
+ usingBytes = true;
+}
+
+void DecimalQuantity::switchStorage() {
+ if (usingBytes) {
+ // Change from bytes to long
+ uint64_t bcdLong = 0L;
+ for (int i = precision - 1; i >= 0; i--) {
+ bcdLong <<= 4;
+ bcdLong |= fBCD.bcdBytes.ptr[i];
+ }
+ uprv_free(fBCD.bcdBytes.ptr);
+ fBCD.bcdBytes.ptr = nullptr;
+ fBCD.bcdLong = bcdLong;
+ usingBytes = false;
+ } else {
+ // Change from long to bytes
+ // Copy the long into a local variable since it will get munged when we allocate the bytes
+ uint64_t bcdLong = fBCD.bcdLong;
+ ensureCapacity();
+ for (int i = 0; i < precision; i++) {
+ fBCD.bcdBytes.ptr[i] = static_cast<int8_t>(bcdLong & 0xf);
+ bcdLong >>= 4;
+ }
+ U_ASSERT(usingBytes);
+ }
+}
+
+void DecimalQuantity::copyBcdFrom(const DecimalQuantity &other) {
+ setBcdToZero();
+ if (other.usingBytes) {
+ ensureCapacity(other.precision);
+ uprv_memcpy(fBCD.bcdBytes.ptr, other.fBCD.bcdBytes.ptr, other.precision * sizeof(int8_t));
+ } else {
+ fBCD.bcdLong = other.fBCD.bcdLong;
+ }
+}
+
+void DecimalQuantity::moveBcdFrom(DecimalQuantity &other) {
+ setBcdToZero();
+ if (other.usingBytes) {
+ usingBytes = true;
+ fBCD.bcdBytes.ptr = other.fBCD.bcdBytes.ptr;
+ fBCD.bcdBytes.len = other.fBCD.bcdBytes.len;
+ // Take ownership away from the old instance:
+ other.fBCD.bcdBytes.ptr = nullptr;
+ other.usingBytes = false;
+ } else {
+ fBCD.bcdLong = other.fBCD.bcdLong;
+ }
+}
+
+const char16_t* DecimalQuantity::checkHealth() const {
+ if (usingBytes) {
+ if (precision == 0) { return u"Zero precision but we are in byte mode"; }
+ int32_t capacity = fBCD.bcdBytes.len;
+ if (precision > capacity) { return u"Precision exceeds length of byte array"; }
+ if (getDigitPos(precision - 1) == 0) { return u"Most significant digit is zero in byte mode"; }
+ if (getDigitPos(0) == 0) { return u"Least significant digit is zero in long mode"; }
+ for (int i = 0; i < precision; i++) {
+ if (getDigitPos(i) >= 10) { return u"Digit exceeding 10 in byte array"; }
+ if (getDigitPos(i) < 0) { return u"Digit below 0 in byte array"; }
+ }
+ for (int i = precision; i < capacity; i++) {
+ if (getDigitPos(i) != 0) { return u"Nonzero digits outside of range in byte array"; }
+ }
+ } else {
+ if (precision == 0 && fBCD.bcdLong != 0) {
+ return u"Value in bcdLong even though precision is zero";
+ }
+ if (precision > 16) { return u"Precision exceeds length of long"; }
+ if (precision != 0 && getDigitPos(precision - 1) == 0) {
+ return u"Most significant digit is zero in long mode";
+ }
+ if (precision != 0 && getDigitPos(0) == 0) {
+ return u"Least significant digit is zero in long mode";
+ }
+ for (int i = 0; i < precision; i++) {
+ if (getDigitPos(i) >= 10) { return u"Digit exceeding 10 in long"; }
+ if (getDigitPos(i) < 0) { return u"Digit below 0 in long (?!)"; }
+ }
+ for (int i = precision; i < 16; i++) {
+ if (getDigitPos(i) != 0) { return u"Nonzero digits outside of range in long"; }
+ }
+ }
+
+ // No error
+ return nullptr;
+}
+
+bool DecimalQuantity::operator==(const DecimalQuantity& other) const {
+ bool basicEquals =
+ scale == other.scale
+ && precision == other.precision
+ && flags == other.flags
+ && lReqPos == other.lReqPos
+ && rReqPos == other.rReqPos
+ && isApproximate == other.isApproximate;
+ if (!basicEquals) {
+ return false;
+ }
+
+ if (precision == 0) {
+ return true;
+ } else if (isApproximate) {
+ return origDouble == other.origDouble && origDelta == other.origDelta;
+ } else {
+ for (int m = getUpperDisplayMagnitude(); m >= getLowerDisplayMagnitude(); m--) {
+ if (getDigit(m) != other.getDigit(m)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
+
+UnicodeString DecimalQuantity::toString() const {
+ MaybeStackArray<char, 30> digits(precision + 1);
+ for (int32_t i = 0; i < precision; i++) {
+ digits[i] = getDigitPos(precision - i - 1) + '0';
+ }
+ digits[precision] = 0; // terminate buffer
+ char buffer8[100];
+ snprintf(
+ buffer8,
+ sizeof(buffer8),
+ "<DecimalQuantity %d:%d %s %s%s%s%d>",
+ lReqPos,
+ rReqPos,
+ (usingBytes ? "bytes" : "long"),
+ (isNegative() ? "-" : ""),
+ (precision == 0 ? "0" : digits.getAlias()),
+ "E",
+ scale);
+ return UnicodeString(buffer8, -1, US_INV);
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_decimalquantity.h b/contrib/libs/icu/i18n/number_decimalquantity.h
index 983e2b98f3..d9b35c0336 100644
--- a/contrib/libs/icu/i18n/number_decimalquantity.h
+++ b/contrib/libs/icu/i18n/number_decimalquantity.h
@@ -1,526 +1,526 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMBER_DECIMALQUANTITY_H__
-#define __NUMBER_DECIMALQUANTITY_H__
-
-#include <cstdint>
-#include "unicode/umachine.h"
-#include "standardplural.h"
-#include "plurrule_impl.h"
-#include "number_types.h"
-
-U_NAMESPACE_BEGIN namespace number {
-namespace impl {
-
-// Forward-declare (maybe don't want number_utils.h included here):
-class DecNum;
-
-/**
- * An class for representing a number to be processed by the decimal formatting pipeline. Includes
- * methods for rounding, plural rules, and decimal digit extraction.
- *
- * <p>By design, this is NOT IMMUTABLE and NOT THREAD SAFE. It is intended to be an intermediate
- * object holding state during a pass through the decimal formatting pipeline.
- *
- * <p>Represents numbers and digit display properties using Binary Coded Decimal (BCD).
- *
- * <p>Java has multiple implementations for testing, but C++ has only one implementation.
- */
-class U_I18N_API DecimalQuantity : public IFixedDecimal, public UMemory {
- public:
- /** Copy constructor. */
- DecimalQuantity(const DecimalQuantity &other);
-
- /** Move constructor. */
- DecimalQuantity(DecimalQuantity &&src) U_NOEXCEPT;
-
- DecimalQuantity();
-
- ~DecimalQuantity() override;
-
- /**
- * Sets this instance to be equal to another instance.
- *
- * @param other The instance to copy from.
- */
- DecimalQuantity &operator=(const DecimalQuantity &other);
-
- /** Move assignment */
- DecimalQuantity &operator=(DecimalQuantity&& src) U_NOEXCEPT;
-
- /**
- * Sets the minimum integer digits that this {@link DecimalQuantity} should generate.
- * This method does not perform rounding.
- *
- * @param minInt The minimum number of integer digits.
- */
- void setMinInteger(int32_t minInt);
-
- /**
- * Sets the minimum fraction digits that this {@link DecimalQuantity} should generate.
- * This method does not perform rounding.
- *
- * @param minFrac The minimum number of fraction digits.
- */
- void setMinFraction(int32_t minFrac);
-
- /**
- * Truncates digits from the upper magnitude of the number in order to satisfy the
- * specified maximum number of integer digits.
- *
- * @param maxInt The maximum number of integer digits.
- */
- void applyMaxInteger(int32_t maxInt);
-
- /**
- * Rounds the number to a specified interval, such as 0.05.
- *
- * <p>If rounding to a power of ten, use the more efficient {@link #roundToMagnitude} instead.
- *
- * @param roundingIncrement The increment to which to round.
- * @param roundingMode The {@link RoundingMode} to use if rounding is necessary.
- */
- void roundToIncrement(double roundingIncrement, RoundingMode roundingMode,
- UErrorCode& status);
-
- /** Removes all fraction digits. */
- void truncate();
-
- /**
- * Rounds the number to the nearest multiple of 5 at the specified magnitude.
- * For example, when magnitude == -2, this performs rounding to the nearest 0.05.
- *
- * @param magnitude The magnitude at which the digit should become either 0 or 5.
- * @param roundingMode Rounding strategy.
- */
- void roundToNickel(int32_t magnitude, RoundingMode roundingMode, UErrorCode& status);
-
- /**
- * Rounds the number to a specified magnitude (power of ten).
- *
- * @param roundingMagnitude The power of ten to which to round. For example, a value of -2 will
- * round to 2 decimal places.
- * @param roundingMode The {@link RoundingMode} to use if rounding is necessary.
- */
- void roundToMagnitude(int32_t magnitude, RoundingMode roundingMode, UErrorCode& status);
-
- /**
- * Rounds the number to an infinite number of decimal points. This has no effect except for
- * forcing the double in {@link DecimalQuantity_AbstractBCD} to adopt its exact representation.
- */
- void roundToInfinity();
-
- /**
- * Multiply the internal value. Uses decNumber.
- *
- * @param multiplicand The value by which to multiply.
- */
- void multiplyBy(const DecNum& multiplicand, UErrorCode& status);
-
- /**
- * Divide the internal value. Uses decNumber.
- *
- * @param multiplicand The value by which to multiply.
- */
- void divideBy(const DecNum& divisor, UErrorCode& status);
-
- /** Flips the sign from positive to negative and back. */
- void negate();
-
- /**
- * Scales the number by a power of ten. For example, if the value is currently "1234.56", calling
- * this method with delta=-3 will change the value to "1.23456".
- *
- * @param delta The number of magnitudes of ten to change by.
- * @return true if integer overflow occured; false otherwise.
- */
- bool adjustMagnitude(int32_t delta);
-
- /**
- * @return The power of ten corresponding to the most significant nonzero digit.
- * The number must not be zero.
- */
- int32_t getMagnitude() const;
-
- /**
- * @return The value of the (suppressed) exponent after the number has been
- * put into a notation with exponents (ex: compact, scientific). Ex: given
- * the number 1000 as "1K" / "1E3", the return value will be 3 (positive).
- */
- int32_t getExponent() const;
-
- /**
- * Adjusts the value for the (suppressed) exponent stored when using
- * notation with exponents (ex: compact, scientific).
- *
- * <p>Adjusting the exponent is decoupled from {@link #adjustMagnitude} in
- * order to allow flexibility for {@link StandardPlural} to be selected in
- * formatting (ex: for compact notation) either with or without the exponent
- * applied in the value of the number.
- * @param delta
- * The value to adjust the exponent by.
- */
- void adjustExponent(int32_t delta);
-
- /**
- * @return Whether the value represented by this {@link DecimalQuantity} is
- * zero, infinity, or NaN.
- */
- bool isZeroish() const;
-
- /** @return Whether the value represented by this {@link DecimalQuantity} is less than zero. */
- bool isNegative() const;
-
- /** @return The appropriate value from the Signum enum. */
- Signum signum() const;
-
- /** @return Whether the value represented by this {@link DecimalQuantity} is infinite. */
- bool isInfinite() const U_OVERRIDE;
-
- /** @return Whether the value represented by this {@link DecimalQuantity} is not a number. */
- bool isNaN() const U_OVERRIDE;
-
- /**
- * Note: this method incorporates the value of {@code exponent}
- * (for cases such as compact notation) to return the proper long value
- * represented by the result.
- * @param truncateIfOverflow if false and the number does NOT fit, fails with an assertion error.
- */
- int64_t toLong(bool truncateIfOverflow = false) const;
-
- /**
- * Note: this method incorporates the value of {@code exponent}
- * (for cases such as compact notation) to return the proper long value
- * represented by the result.
- */
- uint64_t toFractionLong(bool includeTrailingZeros) const;
-
- /**
- * Returns whether or not a Long can fully represent the value stored in this DecimalQuantity.
- * @param ignoreFraction if true, silently ignore digits after the decimal place.
- */
- bool fitsInLong(bool ignoreFraction = false) const;
-
- /** @return The value contained in this {@link DecimalQuantity} approximated as a double. */
- double toDouble() const;
-
- /** Computes a DecNum representation of this DecimalQuantity, saving it to the output parameter. */
- void toDecNum(DecNum& output, UErrorCode& status) const;
-
- DecimalQuantity &setToInt(int32_t n);
-
- DecimalQuantity &setToLong(int64_t n);
-
- DecimalQuantity &setToDouble(double n);
-
- /** decNumber is similar to BigDecimal in Java. */
- DecimalQuantity &setToDecNumber(StringPiece n, UErrorCode& status);
-
- /** Internal method if the caller already has a DecNum. */
- DecimalQuantity &setToDecNum(const DecNum& n, UErrorCode& status);
-
- /**
- * Appends a digit, optionally with one or more leading zeros, to the end of the value represented
- * by this DecimalQuantity.
- *
- * <p>The primary use of this method is to construct numbers during a parsing loop. It allows
- * parsing to take advantage of the digit list infrastructure primarily designed for formatting.
- *
- * @param value The digit to append.
- * @param leadingZeros The number of zeros to append before the digit. For example, if the value
- * in this instance starts as 12.3, and you append a 4 with 1 leading zero, the value becomes
- * 12.304.
- * @param appendAsInteger If true, increase the magnitude of existing digits to make room for the
- * new digit. If false, append to the end like a fraction digit. If true, there must not be
- * any fraction digits already in the number.
- * @internal
- * @deprecated This API is ICU internal only.
- */
- void appendDigit(int8_t value, int32_t leadingZeros, bool appendAsInteger);
-
- double getPluralOperand(PluralOperand operand) const U_OVERRIDE;
-
- bool hasIntegerValue() const U_OVERRIDE;
-
- /**
- * Gets the digit at the specified magnitude. For example, if the represented number is 12.3,
- * getDigit(-1) returns 3, since 3 is the digit corresponding to 10^-1.
- *
- * @param magnitude The magnitude of the digit.
- * @return The digit at the specified magnitude.
- */
- int8_t getDigit(int32_t magnitude) const;
-
- /**
- * Gets the largest power of ten that needs to be displayed. The value returned by this function
- * will be bounded between minInt and maxInt.
- *
- * @return The highest-magnitude digit to be displayed.
- */
- int32_t getUpperDisplayMagnitude() const;
-
- /**
- * Gets the smallest power of ten that needs to be displayed. The value returned by this function
- * will be bounded between -minFrac and -maxFrac.
- *
- * @return The lowest-magnitude digit to be displayed.
- */
- int32_t getLowerDisplayMagnitude() const;
-
- int32_t fractionCount() const;
-
- int32_t fractionCountWithoutTrailingZeros() const;
-
- void clear();
-
- /** This method is for internal testing only. */
- uint64_t getPositionFingerprint() const;
-
-// /**
-// * If the given {@link FieldPosition} is a {@link UFieldPosition}, populates it with the fraction
-// * length and fraction long value. If the argument is not a {@link UFieldPosition}, nothing
-// * happens.
-// *
-// * @param fp The {@link UFieldPosition} to populate.
-// */
-// void populateUFieldPosition(FieldPosition fp);
-
- /**
- * Checks whether the bytes stored in this instance are all valid. For internal unit testing only.
- *
- * @return An error message if this instance is invalid, or null if this instance is healthy.
- */
- const char16_t* checkHealth() const;
-
- UnicodeString toString() const;
-
- /** Returns the string in standard exponential notation. */
- UnicodeString toScientificString() const;
-
- /** Returns the string without exponential notation. Slightly slower than toScientificString(). */
- UnicodeString toPlainString() const;
-
- /** Visible for testing */
- inline bool isUsingBytes() { return usingBytes; }
-
- /** Visible for testing */
- inline bool isExplicitExactDouble() { return explicitExactDouble; }
-
- bool operator==(const DecimalQuantity& other) const;
-
- inline bool operator!=(const DecimalQuantity& other) const {
- return !(*this == other);
- }
-
- /**
- * Bogus flag for when a DecimalQuantity is stored on the stack.
- */
- bool bogus = false;
-
- private:
- /**
- * The power of ten corresponding to the least significant digit in the BCD. For example, if this
- * object represents the number "3.14", the BCD will be "0x314" and the scale will be -2.
- *
- * <p>Note that in {@link java.math.BigDecimal}, the scale is defined differently: the number of
- * digits after the decimal place, which is the negative of our definition of scale.
- */
- int32_t scale;
-
- /**
- * The number of digits in the BCD. For example, "1007" has BCD "0x1007" and precision 4. The
- * maximum precision is 16 since a long can hold only 16 digits.
- *
- * <p>This value must be re-calculated whenever the value in bcd changes by using {@link
- * #computePrecisionAndCompact()}.
- */
- int32_t precision;
-
- /**
- * A bitmask of properties relating to the number represented by this object.
- *
- * @see #NEGATIVE_FLAG
- * @see #INFINITY_FLAG
- * @see #NAN_FLAG
- */
- int8_t flags;
-
- // The following three fields relate to the double-to-ascii fast path algorithm.
- // When a double is given to DecimalQuantityBCD, it is converted to using a fast algorithm. The
- // fast algorithm guarantees correctness to only the first ~12 digits of the double. The process
- // of rounding the number ensures that the converted digits are correct, falling back to a slow-
- // path algorithm if required. Therefore, if a DecimalQuantity is constructed from a double, it
- // is *required* that roundToMagnitude(), roundToIncrement(), or roundToInfinity() is called. If
- // you don't round, assertions will fail in certain other methods if you try calling them.
-
- /**
- * Whether the value in the BCD comes from the double fast path without having been rounded to
- * ensure correctness
- */
- UBool isApproximate;
-
- /**
- * The original number provided by the user and which is represented in BCD. Used when we need to
- * re-compute the BCD for an exact double representation.
- */
- double origDouble;
-
- /**
- * The change in magnitude relative to the original double. Used when we need to re-compute the
- * BCD for an exact double representation.
- */
- int32_t origDelta;
-
- // Positions to keep track of leading and trailing zeros.
- // lReqPos is the magnitude of the first required leading zero.
- // rReqPos is the magnitude of the last required trailing zero.
- int32_t lReqPos = 0;
- int32_t rReqPos = 0;
-
- // The value of the (suppressed) exponent after the number has been put into
- // a notation with exponents (ex: compact, scientific).
- int32_t exponent = 0;
-
- /**
- * The BCD of the 16 digits of the number represented by this object. Every 4 bits of the long map
- * to one digit. For example, the number "12345" in BCD is "0x12345".
- *
- * <p>Whenever bcd changes internally, {@link #compact()} must be called, except in special cases
- * like setting the digit to zero.
- */
- union {
- struct {
- int8_t *ptr;
- int32_t len;
- } bcdBytes;
- uint64_t bcdLong;
- } fBCD;
-
- bool usingBytes = false;
-
- /**
- * Whether this {@link DecimalQuantity} has been explicitly converted to an exact double. true if
- * backed by a double that was explicitly converted via convertToAccurateDouble; false otherwise.
- * Used for testing.
- */
- bool explicitExactDouble = false;
-
- void roundToMagnitude(int32_t magnitude, RoundingMode roundingMode, bool nickel, UErrorCode& status);
-
- /**
- * Returns a single digit from the BCD list. No internal state is changed by calling this method.
- *
- * @param position The position of the digit to pop, counted in BCD units from the least
- * significant digit. If outside the range supported by the implementation, zero is returned.
- * @return The digit at the specified location.
- */
- int8_t getDigitPos(int32_t position) const;
-
- /**
- * Sets the digit in the BCD list. This method only sets the digit; it is the caller's
- * responsibility to call {@link #compact} after setting the digit.
- *
- * @param position The position of the digit to pop, counted in BCD units from the least
- * significant digit. If outside the range supported by the implementation, an AssertionError
- * is thrown.
- * @param value The digit to set at the specified location.
- */
- void setDigitPos(int32_t position, int8_t value);
-
- /**
- * Adds zeros to the end of the BCD list. This will result in an invalid BCD representation; it is
- * the caller's responsibility to do further manipulation and then call {@link #compact}.
- *
- * @param numDigits The number of zeros to add.
- */
- void shiftLeft(int32_t numDigits);
-
- /**
- * Directly removes digits from the end of the BCD list.
- * Updates the scale and precision.
- *
- * CAUTION: it is the caller's responsibility to call {@link #compact} after this method.
- */
- void shiftRight(int32_t numDigits);
-
- /**
- * Directly removes digits from the front of the BCD list.
- * Updates precision.
- *
- * CAUTION: it is the caller's responsibility to call {@link #compact} after this method.
- */
- void popFromLeft(int32_t numDigits);
-
- /**
- * Sets the internal representation to zero. Clears any values stored in scale, precision,
- * hasDouble, origDouble, origDelta, exponent, and BCD data.
- */
- void setBcdToZero();
-
- /**
- * Sets the internal BCD state to represent the value in the given int. The int is guaranteed to
- * be either positive. The internal state is guaranteed to be empty when this method is called.
- *
- * @param n The value to consume.
- */
- void readIntToBcd(int32_t n);
-
- /**
- * Sets the internal BCD state to represent the value in the given long. The long is guaranteed to
- * be either positive. The internal state is guaranteed to be empty when this method is called.
- *
- * @param n The value to consume.
- */
- void readLongToBcd(int64_t n);
-
- void readDecNumberToBcd(const DecNum& dn);
-
- void readDoubleConversionToBcd(const char* buffer, int32_t length, int32_t point);
-
- void copyFieldsFrom(const DecimalQuantity& other);
-
- void copyBcdFrom(const DecimalQuantity &other);
-
- void moveBcdFrom(DecimalQuantity& src);
-
- /**
- * Removes trailing zeros from the BCD (adjusting the scale as required) and then computes the
- * precision. The precision is the number of digits in the number up through the greatest nonzero
- * digit.
- *
- * <p>This method must always be called when bcd changes in order for assumptions to be correct in
- * methods like {@link #fractionCount()}.
- */
- void compact();
-
- void _setToInt(int32_t n);
-
- void _setToLong(int64_t n);
-
- void _setToDoubleFast(double n);
-
- void _setToDecNum(const DecNum& dn, UErrorCode& status);
-
- void convertToAccurateDouble();
-
- /** Ensure that a byte array of at least 40 digits is allocated. */
- void ensureCapacity();
-
- void ensureCapacity(int32_t capacity);
-
- /** Switches the internal storage mechanism between the 64-bit long and the byte array. */
- void switchStorage();
-};
-
-} // namespace impl
-} // namespace number
-U_NAMESPACE_END
-
-
-#endif //__NUMBER_DECIMALQUANTITY_H__
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMBER_DECIMALQUANTITY_H__
+#define __NUMBER_DECIMALQUANTITY_H__
+
+#include <cstdint>
+#include "unicode/umachine.h"
+#include "standardplural.h"
+#include "plurrule_impl.h"
+#include "number_types.h"
+
+U_NAMESPACE_BEGIN namespace number {
+namespace impl {
+
+// Forward-declare (maybe don't want number_utils.h included here):
+class DecNum;
+
+/**
+ * An class for representing a number to be processed by the decimal formatting pipeline. Includes
+ * methods for rounding, plural rules, and decimal digit extraction.
+ *
+ * <p>By design, this is NOT IMMUTABLE and NOT THREAD SAFE. It is intended to be an intermediate
+ * object holding state during a pass through the decimal formatting pipeline.
+ *
+ * <p>Represents numbers and digit display properties using Binary Coded Decimal (BCD).
+ *
+ * <p>Java has multiple implementations for testing, but C++ has only one implementation.
+ */
+class U_I18N_API DecimalQuantity : public IFixedDecimal, public UMemory {
+ public:
+ /** Copy constructor. */
+ DecimalQuantity(const DecimalQuantity &other);
+
+ /** Move constructor. */
+ DecimalQuantity(DecimalQuantity &&src) U_NOEXCEPT;
+
+ DecimalQuantity();
+
+ ~DecimalQuantity() override;
+
+ /**
+ * Sets this instance to be equal to another instance.
+ *
+ * @param other The instance to copy from.
+ */
+ DecimalQuantity &operator=(const DecimalQuantity &other);
+
+ /** Move assignment */
+ DecimalQuantity &operator=(DecimalQuantity&& src) U_NOEXCEPT;
+
+ /**
+ * Sets the minimum integer digits that this {@link DecimalQuantity} should generate.
+ * This method does not perform rounding.
+ *
+ * @param minInt The minimum number of integer digits.
+ */
+ void setMinInteger(int32_t minInt);
+
+ /**
+ * Sets the minimum fraction digits that this {@link DecimalQuantity} should generate.
+ * This method does not perform rounding.
+ *
+ * @param minFrac The minimum number of fraction digits.
+ */
+ void setMinFraction(int32_t minFrac);
+
+ /**
+ * Truncates digits from the upper magnitude of the number in order to satisfy the
+ * specified maximum number of integer digits.
+ *
+ * @param maxInt The maximum number of integer digits.
+ */
+ void applyMaxInteger(int32_t maxInt);
+
+ /**
+ * Rounds the number to a specified interval, such as 0.05.
+ *
+ * <p>If rounding to a power of ten, use the more efficient {@link #roundToMagnitude} instead.
+ *
+ * @param roundingIncrement The increment to which to round.
+ * @param roundingMode The {@link RoundingMode} to use if rounding is necessary.
+ */
+ void roundToIncrement(double roundingIncrement, RoundingMode roundingMode,
+ UErrorCode& status);
+
+ /** Removes all fraction digits. */
+ void truncate();
+
+ /**
+ * Rounds the number to the nearest multiple of 5 at the specified magnitude.
+ * For example, when magnitude == -2, this performs rounding to the nearest 0.05.
+ *
+ * @param magnitude The magnitude at which the digit should become either 0 or 5.
+ * @param roundingMode Rounding strategy.
+ */
+ void roundToNickel(int32_t magnitude, RoundingMode roundingMode, UErrorCode& status);
+
+ /**
+ * Rounds the number to a specified magnitude (power of ten).
+ *
+ * @param roundingMagnitude The power of ten to which to round. For example, a value of -2 will
+ * round to 2 decimal places.
+ * @param roundingMode The {@link RoundingMode} to use if rounding is necessary.
+ */
+ void roundToMagnitude(int32_t magnitude, RoundingMode roundingMode, UErrorCode& status);
+
+ /**
+ * Rounds the number to an infinite number of decimal points. This has no effect except for
+ * forcing the double in {@link DecimalQuantity_AbstractBCD} to adopt its exact representation.
+ */
+ void roundToInfinity();
+
+ /**
+ * Multiply the internal value. Uses decNumber.
+ *
+ * @param multiplicand The value by which to multiply.
+ */
+ void multiplyBy(const DecNum& multiplicand, UErrorCode& status);
+
+ /**
+ * Divide the internal value. Uses decNumber.
+ *
+ * @param multiplicand The value by which to multiply.
+ */
+ void divideBy(const DecNum& divisor, UErrorCode& status);
+
+ /** Flips the sign from positive to negative and back. */
+ void negate();
+
+ /**
+ * Scales the number by a power of ten. For example, if the value is currently "1234.56", calling
+ * this method with delta=-3 will change the value to "1.23456".
+ *
+ * @param delta The number of magnitudes of ten to change by.
+ * @return true if integer overflow occured; false otherwise.
+ */
+ bool adjustMagnitude(int32_t delta);
+
+ /**
+ * @return The power of ten corresponding to the most significant nonzero digit.
+ * The number must not be zero.
+ */
+ int32_t getMagnitude() const;
+
+ /**
+ * @return The value of the (suppressed) exponent after the number has been
+ * put into a notation with exponents (ex: compact, scientific). Ex: given
+ * the number 1000 as "1K" / "1E3", the return value will be 3 (positive).
+ */
+ int32_t getExponent() const;
+
+ /**
+ * Adjusts the value for the (suppressed) exponent stored when using
+ * notation with exponents (ex: compact, scientific).
+ *
+ * <p>Adjusting the exponent is decoupled from {@link #adjustMagnitude} in
+ * order to allow flexibility for {@link StandardPlural} to be selected in
+ * formatting (ex: for compact notation) either with or without the exponent
+ * applied in the value of the number.
+ * @param delta
+ * The value to adjust the exponent by.
+ */
+ void adjustExponent(int32_t delta);
+
+ /**
+ * @return Whether the value represented by this {@link DecimalQuantity} is
+ * zero, infinity, or NaN.
+ */
+ bool isZeroish() const;
+
+ /** @return Whether the value represented by this {@link DecimalQuantity} is less than zero. */
+ bool isNegative() const;
+
+ /** @return The appropriate value from the Signum enum. */
+ Signum signum() const;
+
+ /** @return Whether the value represented by this {@link DecimalQuantity} is infinite. */
+ bool isInfinite() const U_OVERRIDE;
+
+ /** @return Whether the value represented by this {@link DecimalQuantity} is not a number. */
+ bool isNaN() const U_OVERRIDE;
+
+ /**
+ * Note: this method incorporates the value of {@code exponent}
+ * (for cases such as compact notation) to return the proper long value
+ * represented by the result.
+ * @param truncateIfOverflow if false and the number does NOT fit, fails with an assertion error.
+ */
+ int64_t toLong(bool truncateIfOverflow = false) const;
+
+ /**
+ * Note: this method incorporates the value of {@code exponent}
+ * (for cases such as compact notation) to return the proper long value
+ * represented by the result.
+ */
+ uint64_t toFractionLong(bool includeTrailingZeros) const;
+
+ /**
+ * Returns whether or not a Long can fully represent the value stored in this DecimalQuantity.
+ * @param ignoreFraction if true, silently ignore digits after the decimal place.
+ */
+ bool fitsInLong(bool ignoreFraction = false) const;
+
+ /** @return The value contained in this {@link DecimalQuantity} approximated as a double. */
+ double toDouble() const;
+
+ /** Computes a DecNum representation of this DecimalQuantity, saving it to the output parameter. */
+ void toDecNum(DecNum& output, UErrorCode& status) const;
+
+ DecimalQuantity &setToInt(int32_t n);
+
+ DecimalQuantity &setToLong(int64_t n);
+
+ DecimalQuantity &setToDouble(double n);
+
+ /** decNumber is similar to BigDecimal in Java. */
+ DecimalQuantity &setToDecNumber(StringPiece n, UErrorCode& status);
+
+ /** Internal method if the caller already has a DecNum. */
+ DecimalQuantity &setToDecNum(const DecNum& n, UErrorCode& status);
+
+ /**
+ * Appends a digit, optionally with one or more leading zeros, to the end of the value represented
+ * by this DecimalQuantity.
+ *
+ * <p>The primary use of this method is to construct numbers during a parsing loop. It allows
+ * parsing to take advantage of the digit list infrastructure primarily designed for formatting.
+ *
+ * @param value The digit to append.
+ * @param leadingZeros The number of zeros to append before the digit. For example, if the value
+ * in this instance starts as 12.3, and you append a 4 with 1 leading zero, the value becomes
+ * 12.304.
+ * @param appendAsInteger If true, increase the magnitude of existing digits to make room for the
+ * new digit. If false, append to the end like a fraction digit. If true, there must not be
+ * any fraction digits already in the number.
+ * @internal
+ * @deprecated This API is ICU internal only.
+ */
+ void appendDigit(int8_t value, int32_t leadingZeros, bool appendAsInteger);
+
+ double getPluralOperand(PluralOperand operand) const U_OVERRIDE;
+
+ bool hasIntegerValue() const U_OVERRIDE;
+
+ /**
+ * Gets the digit at the specified magnitude. For example, if the represented number is 12.3,
+ * getDigit(-1) returns 3, since 3 is the digit corresponding to 10^-1.
+ *
+ * @param magnitude The magnitude of the digit.
+ * @return The digit at the specified magnitude.
+ */
+ int8_t getDigit(int32_t magnitude) const;
+
+ /**
+ * Gets the largest power of ten that needs to be displayed. The value returned by this function
+ * will be bounded between minInt and maxInt.
+ *
+ * @return The highest-magnitude digit to be displayed.
+ */
+ int32_t getUpperDisplayMagnitude() const;
+
+ /**
+ * Gets the smallest power of ten that needs to be displayed. The value returned by this function
+ * will be bounded between -minFrac and -maxFrac.
+ *
+ * @return The lowest-magnitude digit to be displayed.
+ */
+ int32_t getLowerDisplayMagnitude() const;
+
+ int32_t fractionCount() const;
+
+ int32_t fractionCountWithoutTrailingZeros() const;
+
+ void clear();
+
+ /** This method is for internal testing only. */
+ uint64_t getPositionFingerprint() const;
+
+// /**
+// * If the given {@link FieldPosition} is a {@link UFieldPosition}, populates it with the fraction
+// * length and fraction long value. If the argument is not a {@link UFieldPosition}, nothing
+// * happens.
+// *
+// * @param fp The {@link UFieldPosition} to populate.
+// */
+// void populateUFieldPosition(FieldPosition fp);
+
+ /**
+ * Checks whether the bytes stored in this instance are all valid. For internal unit testing only.
+ *
+ * @return An error message if this instance is invalid, or null if this instance is healthy.
+ */
+ const char16_t* checkHealth() const;
+
+ UnicodeString toString() const;
+
+ /** Returns the string in standard exponential notation. */
+ UnicodeString toScientificString() const;
+
+ /** Returns the string without exponential notation. Slightly slower than toScientificString(). */
+ UnicodeString toPlainString() const;
+
+ /** Visible for testing */
+ inline bool isUsingBytes() { return usingBytes; }
+
+ /** Visible for testing */
+ inline bool isExplicitExactDouble() { return explicitExactDouble; }
+
+ bool operator==(const DecimalQuantity& other) const;
+
+ inline bool operator!=(const DecimalQuantity& other) const {
+ return !(*this == other);
+ }
+
+ /**
+ * Bogus flag for when a DecimalQuantity is stored on the stack.
+ */
+ bool bogus = false;
+
+ private:
+ /**
+ * The power of ten corresponding to the least significant digit in the BCD. For example, if this
+ * object represents the number "3.14", the BCD will be "0x314" and the scale will be -2.
+ *
+ * <p>Note that in {@link java.math.BigDecimal}, the scale is defined differently: the number of
+ * digits after the decimal place, which is the negative of our definition of scale.
+ */
+ int32_t scale;
+
+ /**
+ * The number of digits in the BCD. For example, "1007" has BCD "0x1007" and precision 4. The
+ * maximum precision is 16 since a long can hold only 16 digits.
+ *
+ * <p>This value must be re-calculated whenever the value in bcd changes by using {@link
+ * #computePrecisionAndCompact()}.
+ */
+ int32_t precision;
+
+ /**
+ * A bitmask of properties relating to the number represented by this object.
+ *
+ * @see #NEGATIVE_FLAG
+ * @see #INFINITY_FLAG
+ * @see #NAN_FLAG
+ */
+ int8_t flags;
+
+ // The following three fields relate to the double-to-ascii fast path algorithm.
+ // When a double is given to DecimalQuantityBCD, it is converted to using a fast algorithm. The
+ // fast algorithm guarantees correctness to only the first ~12 digits of the double. The process
+ // of rounding the number ensures that the converted digits are correct, falling back to a slow-
+ // path algorithm if required. Therefore, if a DecimalQuantity is constructed from a double, it
+ // is *required* that roundToMagnitude(), roundToIncrement(), or roundToInfinity() is called. If
+ // you don't round, assertions will fail in certain other methods if you try calling them.
+
+ /**
+ * Whether the value in the BCD comes from the double fast path without having been rounded to
+ * ensure correctness
+ */
+ UBool isApproximate;
+
+ /**
+ * The original number provided by the user and which is represented in BCD. Used when we need to
+ * re-compute the BCD for an exact double representation.
+ */
+ double origDouble;
+
+ /**
+ * The change in magnitude relative to the original double. Used when we need to re-compute the
+ * BCD for an exact double representation.
+ */
+ int32_t origDelta;
+
+ // Positions to keep track of leading and trailing zeros.
+ // lReqPos is the magnitude of the first required leading zero.
+ // rReqPos is the magnitude of the last required trailing zero.
+ int32_t lReqPos = 0;
+ int32_t rReqPos = 0;
+
+ // The value of the (suppressed) exponent after the number has been put into
+ // a notation with exponents (ex: compact, scientific).
+ int32_t exponent = 0;
+
+ /**
+ * The BCD of the 16 digits of the number represented by this object. Every 4 bits of the long map
+ * to one digit. For example, the number "12345" in BCD is "0x12345".
+ *
+ * <p>Whenever bcd changes internally, {@link #compact()} must be called, except in special cases
+ * like setting the digit to zero.
+ */
+ union {
+ struct {
+ int8_t *ptr;
+ int32_t len;
+ } bcdBytes;
+ uint64_t bcdLong;
+ } fBCD;
+
+ bool usingBytes = false;
+
+ /**
+ * Whether this {@link DecimalQuantity} has been explicitly converted to an exact double. true if
+ * backed by a double that was explicitly converted via convertToAccurateDouble; false otherwise.
+ * Used for testing.
+ */
+ bool explicitExactDouble = false;
+
+ void roundToMagnitude(int32_t magnitude, RoundingMode roundingMode, bool nickel, UErrorCode& status);
+
+ /**
+ * Returns a single digit from the BCD list. No internal state is changed by calling this method.
+ *
+ * @param position The position of the digit to pop, counted in BCD units from the least
+ * significant digit. If outside the range supported by the implementation, zero is returned.
+ * @return The digit at the specified location.
+ */
+ int8_t getDigitPos(int32_t position) const;
+
+ /**
+ * Sets the digit in the BCD list. This method only sets the digit; it is the caller's
+ * responsibility to call {@link #compact} after setting the digit.
+ *
+ * @param position The position of the digit to pop, counted in BCD units from the least
+ * significant digit. If outside the range supported by the implementation, an AssertionError
+ * is thrown.
+ * @param value The digit to set at the specified location.
+ */
+ void setDigitPos(int32_t position, int8_t value);
+
+ /**
+ * Adds zeros to the end of the BCD list. This will result in an invalid BCD representation; it is
+ * the caller's responsibility to do further manipulation and then call {@link #compact}.
+ *
+ * @param numDigits The number of zeros to add.
+ */
+ void shiftLeft(int32_t numDigits);
+
+ /**
+ * Directly removes digits from the end of the BCD list.
+ * Updates the scale and precision.
+ *
+ * CAUTION: it is the caller's responsibility to call {@link #compact} after this method.
+ */
+ void shiftRight(int32_t numDigits);
+
+ /**
+ * Directly removes digits from the front of the BCD list.
+ * Updates precision.
+ *
+ * CAUTION: it is the caller's responsibility to call {@link #compact} after this method.
+ */
+ void popFromLeft(int32_t numDigits);
+
+ /**
+ * Sets the internal representation to zero. Clears any values stored in scale, precision,
+ * hasDouble, origDouble, origDelta, exponent, and BCD data.
+ */
+ void setBcdToZero();
+
+ /**
+ * Sets the internal BCD state to represent the value in the given int. The int is guaranteed to
+ * be either positive. The internal state is guaranteed to be empty when this method is called.
+ *
+ * @param n The value to consume.
+ */
+ void readIntToBcd(int32_t n);
+
+ /**
+ * Sets the internal BCD state to represent the value in the given long. The long is guaranteed to
+ * be either positive. The internal state is guaranteed to be empty when this method is called.
+ *
+ * @param n The value to consume.
+ */
+ void readLongToBcd(int64_t n);
+
+ void readDecNumberToBcd(const DecNum& dn);
+
+ void readDoubleConversionToBcd(const char* buffer, int32_t length, int32_t point);
+
+ void copyFieldsFrom(const DecimalQuantity& other);
+
+ void copyBcdFrom(const DecimalQuantity &other);
+
+ void moveBcdFrom(DecimalQuantity& src);
+
+ /**
+ * Removes trailing zeros from the BCD (adjusting the scale as required) and then computes the
+ * precision. The precision is the number of digits in the number up through the greatest nonzero
+ * digit.
+ *
+ * <p>This method must always be called when bcd changes in order for assumptions to be correct in
+ * methods like {@link #fractionCount()}.
+ */
+ void compact();
+
+ void _setToInt(int32_t n);
+
+ void _setToLong(int64_t n);
+
+ void _setToDoubleFast(double n);
+
+ void _setToDecNum(const DecNum& dn, UErrorCode& status);
+
+ void convertToAccurateDouble();
+
+ /** Ensure that a byte array of at least 40 digits is allocated. */
+ void ensureCapacity();
+
+ void ensureCapacity(int32_t capacity);
+
+ /** Switches the internal storage mechanism between the 64-bit long and the byte array. */
+ void switchStorage();
+};
+
+} // namespace impl
+} // namespace number
+U_NAMESPACE_END
+
+
+#endif //__NUMBER_DECIMALQUANTITY_H__
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_decimfmtprops.cpp b/contrib/libs/icu/i18n/number_decimfmtprops.cpp
index b569e59178..30481ce5bf 100644
--- a/contrib/libs/icu/i18n/number_decimfmtprops.cpp
+++ b/contrib/libs/icu/i18n/number_decimfmtprops.cpp
@@ -1,152 +1,152 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "number_decimfmtprops.h"
-#include "umutex.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-
-namespace {
-
-alignas(DecimalFormatProperties)
-char kRawDefaultProperties[sizeof(DecimalFormatProperties)];
-
-icu::UInitOnce gDefaultPropertiesInitOnce = U_INITONCE_INITIALIZER;
-
-void U_CALLCONV initDefaultProperties(UErrorCode&) {
- // can't fail, uses placement new into staticly allocated space.
- new(kRawDefaultProperties) DecimalFormatProperties(); // set to the default instance
-}
-
-}
-
-
-DecimalFormatProperties::DecimalFormatProperties() {
- clear();
-}
-
-void DecimalFormatProperties::clear() {
- compactStyle.nullify();
- currency.nullify();
- currencyPluralInfo.fPtr.adoptInstead(nullptr);
- currencyUsage.nullify();
- decimalPatternMatchRequired = false;
- decimalSeparatorAlwaysShown = false;
- exponentSignAlwaysShown = false;
- formatFailIfMoreThanMaxDigits = false;
- formatWidth = -1;
- groupingSize = -1;
- groupingUsed = true;
- magnitudeMultiplier = 0;
- maximumFractionDigits = -1;
- maximumIntegerDigits = -1;
- maximumSignificantDigits = -1;
- minimumExponentDigits = -1;
- minimumFractionDigits = -1;
- minimumGroupingDigits = -1;
- minimumIntegerDigits = -1;
- minimumSignificantDigits = -1;
- multiplier = 1;
- multiplierScale = 0;
- negativePrefix.setToBogus();
- negativePrefixPattern.setToBogus();
- negativeSuffix.setToBogus();
- negativeSuffixPattern.setToBogus();
- padPosition.nullify();
- padString.setToBogus();
- parseCaseSensitive = false;
- parseIntegerOnly = false;
- parseMode.nullify();
- parseNoExponent = false;
- parseToBigDecimal = false;
- parseAllInput = UNUM_MAYBE;
- positivePrefix.setToBogus();
- positivePrefixPattern.setToBogus();
- positiveSuffix.setToBogus();
- positiveSuffixPattern.setToBogus();
- roundingIncrement = 0.0;
- roundingMode.nullify();
- secondaryGroupingSize = -1;
- signAlwaysShown = false;
-}
-
-bool
-DecimalFormatProperties::_equals(const DecimalFormatProperties& other, bool ignoreForFastFormat) const {
- bool eq = true;
-
- // Properties that must be equal both normally and for fast-path formatting
- eq = eq && compactStyle == other.compactStyle;
- eq = eq && currency == other.currency;
- eq = eq && currencyPluralInfo.fPtr.getAlias() == other.currencyPluralInfo.fPtr.getAlias();
- eq = eq && currencyUsage == other.currencyUsage;
- eq = eq && decimalSeparatorAlwaysShown == other.decimalSeparatorAlwaysShown;
- eq = eq && exponentSignAlwaysShown == other.exponentSignAlwaysShown;
- eq = eq && formatFailIfMoreThanMaxDigits == other.formatFailIfMoreThanMaxDigits;
- eq = eq && formatWidth == other.formatWidth;
- eq = eq && magnitudeMultiplier == other.magnitudeMultiplier;
- eq = eq && maximumSignificantDigits == other.maximumSignificantDigits;
- eq = eq && minimumExponentDigits == other.minimumExponentDigits;
- eq = eq && minimumGroupingDigits == other.minimumGroupingDigits;
- eq = eq && minimumSignificantDigits == other.minimumSignificantDigits;
- eq = eq && multiplier == other.multiplier;
- eq = eq && multiplierScale == other.multiplierScale;
- eq = eq && negativePrefix == other.negativePrefix;
- eq = eq && negativeSuffix == other.negativeSuffix;
- eq = eq && padPosition == other.padPosition;
- eq = eq && padString == other.padString;
- eq = eq && positivePrefix == other.positivePrefix;
- eq = eq && positiveSuffix == other.positiveSuffix;
- eq = eq && roundingIncrement == other.roundingIncrement;
- eq = eq && roundingMode == other.roundingMode;
- eq = eq && secondaryGroupingSize == other.secondaryGroupingSize;
- eq = eq && signAlwaysShown == other.signAlwaysShown;
-
- if (ignoreForFastFormat) {
- return eq;
- }
-
- // Properties ignored by fast-path formatting
- // Formatting (special handling required):
- eq = eq && groupingSize == other.groupingSize;
- eq = eq && groupingUsed == other.groupingUsed;
- eq = eq && minimumFractionDigits == other.minimumFractionDigits;
- eq = eq && maximumFractionDigits == other.maximumFractionDigits;
- eq = eq && maximumIntegerDigits == other.maximumIntegerDigits;
- eq = eq && minimumIntegerDigits == other.minimumIntegerDigits;
- eq = eq && negativePrefixPattern == other.negativePrefixPattern;
- eq = eq && negativeSuffixPattern == other.negativeSuffixPattern;
- eq = eq && positivePrefixPattern == other.positivePrefixPattern;
- eq = eq && positiveSuffixPattern == other.positiveSuffixPattern;
-
- // Parsing (always safe to ignore):
- eq = eq && decimalPatternMatchRequired == other.decimalPatternMatchRequired;
- eq = eq && parseCaseSensitive == other.parseCaseSensitive;
- eq = eq && parseIntegerOnly == other.parseIntegerOnly;
- eq = eq && parseMode == other.parseMode;
- eq = eq && parseNoExponent == other.parseNoExponent;
- eq = eq && parseToBigDecimal == other.parseToBigDecimal;
- eq = eq && parseAllInput == other.parseAllInput;
-
- return eq;
-}
-
-bool DecimalFormatProperties::equalsDefaultExceptFastFormat() const {
- UErrorCode localStatus = U_ZERO_ERROR;
- umtx_initOnce(gDefaultPropertiesInitOnce, &initDefaultProperties, localStatus);
- return _equals(*reinterpret_cast<DecimalFormatProperties*>(kRawDefaultProperties), true);
-}
-
-const DecimalFormatProperties& DecimalFormatProperties::getDefault() {
- UErrorCode localStatus = U_ZERO_ERROR;
- umtx_initOnce(gDefaultPropertiesInitOnce, &initDefaultProperties, localStatus);
- return *reinterpret_cast<const DecimalFormatProperties*>(kRawDefaultProperties);
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "number_decimfmtprops.h"
+#include "umutex.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+
+namespace {
+
+alignas(DecimalFormatProperties)
+char kRawDefaultProperties[sizeof(DecimalFormatProperties)];
+
+icu::UInitOnce gDefaultPropertiesInitOnce = U_INITONCE_INITIALIZER;
+
+void U_CALLCONV initDefaultProperties(UErrorCode&) {
+ // can't fail, uses placement new into staticly allocated space.
+ new(kRawDefaultProperties) DecimalFormatProperties(); // set to the default instance
+}
+
+}
+
+
+DecimalFormatProperties::DecimalFormatProperties() {
+ clear();
+}
+
+void DecimalFormatProperties::clear() {
+ compactStyle.nullify();
+ currency.nullify();
+ currencyPluralInfo.fPtr.adoptInstead(nullptr);
+ currencyUsage.nullify();
+ decimalPatternMatchRequired = false;
+ decimalSeparatorAlwaysShown = false;
+ exponentSignAlwaysShown = false;
+ formatFailIfMoreThanMaxDigits = false;
+ formatWidth = -1;
+ groupingSize = -1;
+ groupingUsed = true;
+ magnitudeMultiplier = 0;
+ maximumFractionDigits = -1;
+ maximumIntegerDigits = -1;
+ maximumSignificantDigits = -1;
+ minimumExponentDigits = -1;
+ minimumFractionDigits = -1;
+ minimumGroupingDigits = -1;
+ minimumIntegerDigits = -1;
+ minimumSignificantDigits = -1;
+ multiplier = 1;
+ multiplierScale = 0;
+ negativePrefix.setToBogus();
+ negativePrefixPattern.setToBogus();
+ negativeSuffix.setToBogus();
+ negativeSuffixPattern.setToBogus();
+ padPosition.nullify();
+ padString.setToBogus();
+ parseCaseSensitive = false;
+ parseIntegerOnly = false;
+ parseMode.nullify();
+ parseNoExponent = false;
+ parseToBigDecimal = false;
+ parseAllInput = UNUM_MAYBE;
+ positivePrefix.setToBogus();
+ positivePrefixPattern.setToBogus();
+ positiveSuffix.setToBogus();
+ positiveSuffixPattern.setToBogus();
+ roundingIncrement = 0.0;
+ roundingMode.nullify();
+ secondaryGroupingSize = -1;
+ signAlwaysShown = false;
+}
+
+bool
+DecimalFormatProperties::_equals(const DecimalFormatProperties& other, bool ignoreForFastFormat) const {
+ bool eq = true;
+
+ // Properties that must be equal both normally and for fast-path formatting
+ eq = eq && compactStyle == other.compactStyle;
+ eq = eq && currency == other.currency;
+ eq = eq && currencyPluralInfo.fPtr.getAlias() == other.currencyPluralInfo.fPtr.getAlias();
+ eq = eq && currencyUsage == other.currencyUsage;
+ eq = eq && decimalSeparatorAlwaysShown == other.decimalSeparatorAlwaysShown;
+ eq = eq && exponentSignAlwaysShown == other.exponentSignAlwaysShown;
+ eq = eq && formatFailIfMoreThanMaxDigits == other.formatFailIfMoreThanMaxDigits;
+ eq = eq && formatWidth == other.formatWidth;
+ eq = eq && magnitudeMultiplier == other.magnitudeMultiplier;
+ eq = eq && maximumSignificantDigits == other.maximumSignificantDigits;
+ eq = eq && minimumExponentDigits == other.minimumExponentDigits;
+ eq = eq && minimumGroupingDigits == other.minimumGroupingDigits;
+ eq = eq && minimumSignificantDigits == other.minimumSignificantDigits;
+ eq = eq && multiplier == other.multiplier;
+ eq = eq && multiplierScale == other.multiplierScale;
+ eq = eq && negativePrefix == other.negativePrefix;
+ eq = eq && negativeSuffix == other.negativeSuffix;
+ eq = eq && padPosition == other.padPosition;
+ eq = eq && padString == other.padString;
+ eq = eq && positivePrefix == other.positivePrefix;
+ eq = eq && positiveSuffix == other.positiveSuffix;
+ eq = eq && roundingIncrement == other.roundingIncrement;
+ eq = eq && roundingMode == other.roundingMode;
+ eq = eq && secondaryGroupingSize == other.secondaryGroupingSize;
+ eq = eq && signAlwaysShown == other.signAlwaysShown;
+
+ if (ignoreForFastFormat) {
+ return eq;
+ }
+
+ // Properties ignored by fast-path formatting
+ // Formatting (special handling required):
+ eq = eq && groupingSize == other.groupingSize;
+ eq = eq && groupingUsed == other.groupingUsed;
+ eq = eq && minimumFractionDigits == other.minimumFractionDigits;
+ eq = eq && maximumFractionDigits == other.maximumFractionDigits;
+ eq = eq && maximumIntegerDigits == other.maximumIntegerDigits;
+ eq = eq && minimumIntegerDigits == other.minimumIntegerDigits;
+ eq = eq && negativePrefixPattern == other.negativePrefixPattern;
+ eq = eq && negativeSuffixPattern == other.negativeSuffixPattern;
+ eq = eq && positivePrefixPattern == other.positivePrefixPattern;
+ eq = eq && positiveSuffixPattern == other.positiveSuffixPattern;
+
+ // Parsing (always safe to ignore):
+ eq = eq && decimalPatternMatchRequired == other.decimalPatternMatchRequired;
+ eq = eq && parseCaseSensitive == other.parseCaseSensitive;
+ eq = eq && parseIntegerOnly == other.parseIntegerOnly;
+ eq = eq && parseMode == other.parseMode;
+ eq = eq && parseNoExponent == other.parseNoExponent;
+ eq = eq && parseToBigDecimal == other.parseToBigDecimal;
+ eq = eq && parseAllInput == other.parseAllInput;
+
+ return eq;
+}
+
+bool DecimalFormatProperties::equalsDefaultExceptFastFormat() const {
+ UErrorCode localStatus = U_ZERO_ERROR;
+ umtx_initOnce(gDefaultPropertiesInitOnce, &initDefaultProperties, localStatus);
+ return _equals(*reinterpret_cast<DecimalFormatProperties*>(kRawDefaultProperties), true);
+}
+
+const DecimalFormatProperties& DecimalFormatProperties::getDefault() {
+ UErrorCode localStatus = U_ZERO_ERROR;
+ umtx_initOnce(gDefaultPropertiesInitOnce, &initDefaultProperties, localStatus);
+ return *reinterpret_cast<const DecimalFormatProperties*>(kRawDefaultProperties);
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_decimfmtprops.h b/contrib/libs/icu/i18n/number_decimfmtprops.h
index c32f7f3dc9..1ce84d9dc3 100644
--- a/contrib/libs/icu/i18n/number_decimfmtprops.h
+++ b/contrib/libs/icu/i18n/number_decimfmtprops.h
@@ -1,174 +1,174 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMBER_DECIMFMTPROPS_H__
-#define __NUMBER_DECIMFMTPROPS_H__
-
-#include "unicode/unistr.h"
-#include <cstdint>
-#include "unicode/plurrule.h"
-#include "unicode/currpinf.h"
-#include "unicode/unum.h"
-#include "unicode/localpointer.h"
-#include "number_types.h"
-
-U_NAMESPACE_BEGIN
-
-// Export an explicit template instantiation of the LocalPointer that is used as a
-// data member of CurrencyPluralInfoWrapper.
-// (When building DLLs for Windows this is required.)
-#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
-#if defined(_MSC_VER)
-// Ignore warning 4661 as LocalPointerBase does not use operator== or operator!=
-#pragma warning(push)
-#pragma warning(disable: 4661)
-#endif
-template class U_I18N_API LocalPointerBase<CurrencyPluralInfo>;
-template class U_I18N_API LocalPointer<CurrencyPluralInfo>;
-#if defined(_MSC_VER)
-#pragma warning(pop)
-#endif
-#endif
-
-namespace number {
-namespace impl {
-
-// Exported as U_I18N_API because it is a public member field of exported DecimalFormatProperties
-// Using this wrapper is rather unfortunate, but is needed on Windows platforms in order to allow
-// for DLL-exporting an fully specified template instantiation.
-class U_I18N_API CurrencyPluralInfoWrapper {
-public:
- LocalPointer<CurrencyPluralInfo> fPtr;
-
- CurrencyPluralInfoWrapper() = default;
-
- CurrencyPluralInfoWrapper(const CurrencyPluralInfoWrapper& other) {
- if (!other.fPtr.isNull()) {
- fPtr.adoptInstead(new CurrencyPluralInfo(*other.fPtr));
- }
- }
-
- CurrencyPluralInfoWrapper& operator=(const CurrencyPluralInfoWrapper& other) {
- if (!other.fPtr.isNull()) {
- fPtr.adoptInstead(new CurrencyPluralInfo(*other.fPtr));
- }
- return *this;
- }
-};
-
-/** Controls the set of rules for parsing a string from the old DecimalFormat API. */
-enum ParseMode {
- /**
- * Lenient mode should be used if you want to accept malformed user input. It will use heuristics
- * to attempt to parse through typographical errors in the string.
- */
- PARSE_MODE_LENIENT,
-
- /**
- * Strict mode should be used if you want to require that the input is well-formed. More
- * specifically, it differs from lenient mode in the following ways:
- *
- * <ul>
- * <li>Grouping widths must match the grouping settings. For example, "12,3,45" will fail if the
- * grouping width is 3, as in the pattern "#,##0".
- * <li>The string must contain a complete prefix and suffix. For example, if the pattern is
- * "{#};(#)", then "{123}" or "(123)" would match, but "{123", "123}", and "123" would all fail.
- * (The latter strings would be accepted in lenient mode.)
- * <li>Whitespace may not appear at arbitrary places in the string. In lenient mode, whitespace
- * is allowed to occur arbitrarily before and after prefixes and exponent separators.
- * <li>Leading grouping separators are not allowed, as in ",123".
- * <li>Minus and plus signs can only appear if specified in the pattern. In lenient mode, a plus
- * or minus sign can always precede a number.
- * <li>The set of characters that can be interpreted as a decimal or grouping separator is
- * smaller.
- * <li><strong>If currency parsing is enabled,</strong> currencies must only appear where
- * specified in either the current pattern string or in a valid pattern string for the current
- * locale. For example, if the pattern is "¤0.00", then "$1.23" would match, but "1.23$" would
- * fail to match.
- * </ul>
- */
- PARSE_MODE_STRICT,
-};
-
-// Exported as U_I18N_API because it is needed for the unit test PatternStringTest
-struct U_I18N_API DecimalFormatProperties : public UMemory {
-
- public:
- NullableValue<UNumberCompactStyle> compactStyle;
- NullableValue<CurrencyUnit> currency;
- CurrencyPluralInfoWrapper currencyPluralInfo;
- NullableValue<UCurrencyUsage> currencyUsage;
- bool decimalPatternMatchRequired;
- bool decimalSeparatorAlwaysShown;
- bool exponentSignAlwaysShown;
- bool formatFailIfMoreThanMaxDigits; // ICU4C-only
- int32_t formatWidth;
- int32_t groupingSize;
- bool groupingUsed;
- int32_t magnitudeMultiplier; // internal field like multiplierScale but separate to avoid conflict
- int32_t maximumFractionDigits;
- int32_t maximumIntegerDigits;
- int32_t maximumSignificantDigits;
- int32_t minimumExponentDigits;
- int32_t minimumFractionDigits;
- int32_t minimumGroupingDigits;
- int32_t minimumIntegerDigits;
- int32_t minimumSignificantDigits;
- int32_t multiplier;
- int32_t multiplierScale; // ICU4C-only
- UnicodeString negativePrefix;
- UnicodeString negativePrefixPattern;
- UnicodeString negativeSuffix;
- UnicodeString negativeSuffixPattern;
- NullableValue<PadPosition> padPosition;
- UnicodeString padString;
- bool parseCaseSensitive;
- bool parseIntegerOnly;
- NullableValue<ParseMode> parseMode;
- bool parseNoExponent;
- bool parseToBigDecimal; // TODO: Not needed in ICU4C?
- UNumberFormatAttributeValue parseAllInput; // ICU4C-only
- //PluralRules pluralRules;
- UnicodeString positivePrefix;
- UnicodeString positivePrefixPattern;
- UnicodeString positiveSuffix;
- UnicodeString positiveSuffixPattern;
- double roundingIncrement;
- NullableValue<RoundingMode> roundingMode;
- int32_t secondaryGroupingSize;
- bool signAlwaysShown;
-
- DecimalFormatProperties();
-
- inline bool operator==(const DecimalFormatProperties& other) const {
- return _equals(other, false);
- }
-
- void clear();
-
- /**
- * Checks for equality to the default DecimalFormatProperties, but ignores the prescribed set of
- * options for fast-path formatting.
- */
- bool equalsDefaultExceptFastFormat() const;
-
- /**
- * Returns the default DecimalFormatProperties instance.
- */
- static const DecimalFormatProperties& getDefault();
-
- private:
- bool _equals(const DecimalFormatProperties& other, bool ignoreForFastFormat) const;
-};
-
-} // namespace impl
-} // namespace number
-U_NAMESPACE_END
-
-
-#endif //__NUMBER_DECIMFMTPROPS_H__
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMBER_DECIMFMTPROPS_H__
+#define __NUMBER_DECIMFMTPROPS_H__
+
+#include "unicode/unistr.h"
+#include <cstdint>
+#include "unicode/plurrule.h"
+#include "unicode/currpinf.h"
+#include "unicode/unum.h"
+#include "unicode/localpointer.h"
+#include "number_types.h"
+
+U_NAMESPACE_BEGIN
+
+// Export an explicit template instantiation of the LocalPointer that is used as a
+// data member of CurrencyPluralInfoWrapper.
+// (When building DLLs for Windows this is required.)
+#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
+#if defined(_MSC_VER)
+// Ignore warning 4661 as LocalPointerBase does not use operator== or operator!=
+#pragma warning(push)
+#pragma warning(disable: 4661)
+#endif
+template class U_I18N_API LocalPointerBase<CurrencyPluralInfo>;
+template class U_I18N_API LocalPointer<CurrencyPluralInfo>;
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+#endif
+
+namespace number {
+namespace impl {
+
+// Exported as U_I18N_API because it is a public member field of exported DecimalFormatProperties
+// Using this wrapper is rather unfortunate, but is needed on Windows platforms in order to allow
+// for DLL-exporting an fully specified template instantiation.
+class U_I18N_API CurrencyPluralInfoWrapper {
+public:
+ LocalPointer<CurrencyPluralInfo> fPtr;
+
+ CurrencyPluralInfoWrapper() = default;
+
+ CurrencyPluralInfoWrapper(const CurrencyPluralInfoWrapper& other) {
+ if (!other.fPtr.isNull()) {
+ fPtr.adoptInstead(new CurrencyPluralInfo(*other.fPtr));
+ }
+ }
+
+ CurrencyPluralInfoWrapper& operator=(const CurrencyPluralInfoWrapper& other) {
+ if (!other.fPtr.isNull()) {
+ fPtr.adoptInstead(new CurrencyPluralInfo(*other.fPtr));
+ }
+ return *this;
+ }
+};
+
+/** Controls the set of rules for parsing a string from the old DecimalFormat API. */
+enum ParseMode {
+ /**
+ * Lenient mode should be used if you want to accept malformed user input. It will use heuristics
+ * to attempt to parse through typographical errors in the string.
+ */
+ PARSE_MODE_LENIENT,
+
+ /**
+ * Strict mode should be used if you want to require that the input is well-formed. More
+ * specifically, it differs from lenient mode in the following ways:
+ *
+ * <ul>
+ * <li>Grouping widths must match the grouping settings. For example, "12,3,45" will fail if the
+ * grouping width is 3, as in the pattern "#,##0".
+ * <li>The string must contain a complete prefix and suffix. For example, if the pattern is
+ * "{#};(#)", then "{123}" or "(123)" would match, but "{123", "123}", and "123" would all fail.
+ * (The latter strings would be accepted in lenient mode.)
+ * <li>Whitespace may not appear at arbitrary places in the string. In lenient mode, whitespace
+ * is allowed to occur arbitrarily before and after prefixes and exponent separators.
+ * <li>Leading grouping separators are not allowed, as in ",123".
+ * <li>Minus and plus signs can only appear if specified in the pattern. In lenient mode, a plus
+ * or minus sign can always precede a number.
+ * <li>The set of characters that can be interpreted as a decimal or grouping separator is
+ * smaller.
+ * <li><strong>If currency parsing is enabled,</strong> currencies must only appear where
+ * specified in either the current pattern string or in a valid pattern string for the current
+ * locale. For example, if the pattern is "¤0.00", then "$1.23" would match, but "1.23$" would
+ * fail to match.
+ * </ul>
+ */
+ PARSE_MODE_STRICT,
+};
+
+// Exported as U_I18N_API because it is needed for the unit test PatternStringTest
+struct U_I18N_API DecimalFormatProperties : public UMemory {
+
+ public:
+ NullableValue<UNumberCompactStyle> compactStyle;
+ NullableValue<CurrencyUnit> currency;
+ CurrencyPluralInfoWrapper currencyPluralInfo;
+ NullableValue<UCurrencyUsage> currencyUsage;
+ bool decimalPatternMatchRequired;
+ bool decimalSeparatorAlwaysShown;
+ bool exponentSignAlwaysShown;
+ bool formatFailIfMoreThanMaxDigits; // ICU4C-only
+ int32_t formatWidth;
+ int32_t groupingSize;
+ bool groupingUsed;
+ int32_t magnitudeMultiplier; // internal field like multiplierScale but separate to avoid conflict
+ int32_t maximumFractionDigits;
+ int32_t maximumIntegerDigits;
+ int32_t maximumSignificantDigits;
+ int32_t minimumExponentDigits;
+ int32_t minimumFractionDigits;
+ int32_t minimumGroupingDigits;
+ int32_t minimumIntegerDigits;
+ int32_t minimumSignificantDigits;
+ int32_t multiplier;
+ int32_t multiplierScale; // ICU4C-only
+ UnicodeString negativePrefix;
+ UnicodeString negativePrefixPattern;
+ UnicodeString negativeSuffix;
+ UnicodeString negativeSuffixPattern;
+ NullableValue<PadPosition> padPosition;
+ UnicodeString padString;
+ bool parseCaseSensitive;
+ bool parseIntegerOnly;
+ NullableValue<ParseMode> parseMode;
+ bool parseNoExponent;
+ bool parseToBigDecimal; // TODO: Not needed in ICU4C?
+ UNumberFormatAttributeValue parseAllInput; // ICU4C-only
+ //PluralRules pluralRules;
+ UnicodeString positivePrefix;
+ UnicodeString positivePrefixPattern;
+ UnicodeString positiveSuffix;
+ UnicodeString positiveSuffixPattern;
+ double roundingIncrement;
+ NullableValue<RoundingMode> roundingMode;
+ int32_t secondaryGroupingSize;
+ bool signAlwaysShown;
+
+ DecimalFormatProperties();
+
+ inline bool operator==(const DecimalFormatProperties& other) const {
+ return _equals(other, false);
+ }
+
+ void clear();
+
+ /**
+ * Checks for equality to the default DecimalFormatProperties, but ignores the prescribed set of
+ * options for fast-path formatting.
+ */
+ bool equalsDefaultExceptFastFormat() const;
+
+ /**
+ * Returns the default DecimalFormatProperties instance.
+ */
+ static const DecimalFormatProperties& getDefault();
+
+ private:
+ bool _equals(const DecimalFormatProperties& other, bool ignoreForFastFormat) const;
+};
+
+} // namespace impl
+} // namespace number
+U_NAMESPACE_END
+
+
+#endif //__NUMBER_DECIMFMTPROPS_H__
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_decnum.h b/contrib/libs/icu/i18n/number_decnum.h
index bf953d6194..0c7399dbdd 100644
--- a/contrib/libs/icu/i18n/number_decnum.h
+++ b/contrib/libs/icu/i18n/number_decnum.h
@@ -1,79 +1,79 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMBER_DECNUM_H__
-#define __NUMBER_DECNUM_H__
-
-#include "decNumber.h"
-#include "charstr.h"
-
-U_NAMESPACE_BEGIN
-
-#define DECNUM_INITIAL_CAPACITY 34
-
-// Export an explicit template instantiation of the MaybeStackHeaderAndArray that is used as a data member of DecNum.
-// When building DLLs for Windows this is required even though no direct access to the MaybeStackHeaderAndArray leaks out of the i18n library.
-// (See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.)
-#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
-template class U_I18N_API MaybeStackHeaderAndArray<decNumber, char, DECNUM_INITIAL_CAPACITY>;
-#endif
-
-namespace number {
-namespace impl {
-
-/** A very thin C++ wrapper around decNumber.h */
-// Exported as U_I18N_API for tests
-class U_I18N_API DecNum : public UMemory {
- public:
- DecNum(); // leaves object in valid but undefined state
-
- // Copy-like constructor; use the default move operators.
- DecNum(const DecNum& other, UErrorCode& status);
-
- /** Sets the decNumber to the StringPiece. */
- void setTo(StringPiece str, UErrorCode& status);
-
- /** Sets the decNumber to the NUL-terminated char string. */
- void setTo(const char* str, UErrorCode& status);
-
- /** Uses double_conversion to set this decNumber to the given double. */
- void setTo(double d, UErrorCode& status);
-
- /** Sets the decNumber to the BCD representation. */
- void setTo(const uint8_t* bcd, int32_t length, int32_t scale, bool isNegative, UErrorCode& status);
-
- void normalize();
-
- void multiplyBy(const DecNum& rhs, UErrorCode& status);
-
- void divideBy(const DecNum& rhs, UErrorCode& status);
-
- bool isNegative() const;
-
- bool isZero() const;
-
- void toString(ByteSink& output, UErrorCode& status) const;
-
- inline const decNumber* getRawDecNumber() const {
- return fData.getAlias();
- }
-
- private:
- static constexpr int32_t kDefaultDigits = DECNUM_INITIAL_CAPACITY;
- MaybeStackHeaderAndArray<decNumber, char, kDefaultDigits> fData;
- decContext fContext;
-
- void _setTo(const char* str, int32_t maxDigits, UErrorCode& status);
-};
-
-} // namespace impl
-} // namespace number
-
-U_NAMESPACE_END
-
-#endif // __NUMBER_DECNUM_H__
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMBER_DECNUM_H__
+#define __NUMBER_DECNUM_H__
+
+#include "decNumber.h"
+#include "charstr.h"
+
+U_NAMESPACE_BEGIN
+
+#define DECNUM_INITIAL_CAPACITY 34
+
+// Export an explicit template instantiation of the MaybeStackHeaderAndArray that is used as a data member of DecNum.
+// When building DLLs for Windows this is required even though no direct access to the MaybeStackHeaderAndArray leaks out of the i18n library.
+// (See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.)
+#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
+template class U_I18N_API MaybeStackHeaderAndArray<decNumber, char, DECNUM_INITIAL_CAPACITY>;
+#endif
+
+namespace number {
+namespace impl {
+
+/** A very thin C++ wrapper around decNumber.h */
+// Exported as U_I18N_API for tests
+class U_I18N_API DecNum : public UMemory {
+ public:
+ DecNum(); // leaves object in valid but undefined state
+
+ // Copy-like constructor; use the default move operators.
+ DecNum(const DecNum& other, UErrorCode& status);
+
+ /** Sets the decNumber to the StringPiece. */
+ void setTo(StringPiece str, UErrorCode& status);
+
+ /** Sets the decNumber to the NUL-terminated char string. */
+ void setTo(const char* str, UErrorCode& status);
+
+ /** Uses double_conversion to set this decNumber to the given double. */
+ void setTo(double d, UErrorCode& status);
+
+ /** Sets the decNumber to the BCD representation. */
+ void setTo(const uint8_t* bcd, int32_t length, int32_t scale, bool isNegative, UErrorCode& status);
+
+ void normalize();
+
+ void multiplyBy(const DecNum& rhs, UErrorCode& status);
+
+ void divideBy(const DecNum& rhs, UErrorCode& status);
+
+ bool isNegative() const;
+
+ bool isZero() const;
+
+ void toString(ByteSink& output, UErrorCode& status) const;
+
+ inline const decNumber* getRawDecNumber() const {
+ return fData.getAlias();
+ }
+
+ private:
+ static constexpr int32_t kDefaultDigits = DECNUM_INITIAL_CAPACITY;
+ MaybeStackHeaderAndArray<decNumber, char, kDefaultDigits> fData;
+ decContext fContext;
+
+ void _setTo(const char* str, int32_t maxDigits, UErrorCode& status);
+};
+
+} // namespace impl
+} // namespace number
+
+U_NAMESPACE_END
+
+#endif // __NUMBER_DECNUM_H__
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_fluent.cpp b/contrib/libs/icu/i18n/number_fluent.cpp
index 80f1f58a98..9cdb8b7156 100644
--- a/contrib/libs/icu/i18n/number_fluent.cpp
+++ b/contrib/libs/icu/i18n/number_fluent.cpp
@@ -1,768 +1,768 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "uassert.h"
-#include "unicode/numberformatter.h"
-#include "number_decimalquantity.h"
-#include "number_formatimpl.h"
-#include "umutex.h"
-#include "number_asformat.h"
-#include "number_utils.h"
-#include "number_utypes.h"
-#include "util.h"
-#include "fphdlimp.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
-// Ignore MSVC warning 4661. This is generated for NumberFormatterSettings<>::toSkeleton() as this method
-// is defined elsewhere (in number_skeletons.cpp). The compiler is warning that the explicit template instantiation
-// inside this single translation unit (CPP file) is incomplete, and thus it isn't sure if the template class is
-// fully defined. However, since each translation unit explicitly instantiates all the necessary template classes,
-// they will all be passed to the linker, and the linker will still find and export all the class members.
-#pragma warning(push)
-#pragma warning(disable: 4661)
-#endif
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::notation(const Notation& notation) const& {
- Derived copy(*this);
- // NOTE: Slicing is OK.
- copy.fMacros.notation = notation;
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::notation(const Notation& notation)&& {
- Derived move(std::move(*this));
- // NOTE: Slicing is OK.
- move.fMacros.notation = notation;
- return move;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::unit(const icu::MeasureUnit& unit) const& {
- Derived copy(*this);
- // NOTE: Slicing occurs here. However, CurrencyUnit can be restored from MeasureUnit.
- // TimeUnit may be affected, but TimeUnit is not as relevant to number formatting.
- copy.fMacros.unit = unit;
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::unit(const icu::MeasureUnit& unit)&& {
- Derived move(std::move(*this));
- // See comments above about slicing.
- move.fMacros.unit = unit;
- return move;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::adoptUnit(icu::MeasureUnit* unit) const& {
- Derived copy(*this);
- // Just move the unit into the MacroProps by value, and delete it since we have ownership.
- // NOTE: Slicing occurs here. However, CurrencyUnit can be restored from MeasureUnit.
- // TimeUnit may be affected, but TimeUnit is not as relevant to number formatting.
- if (unit != nullptr) {
- // TODO: On nullptr, reset to default value?
- copy.fMacros.unit = std::move(*unit);
- delete unit;
- }
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::adoptUnit(icu::MeasureUnit* unit)&& {
- Derived move(std::move(*this));
- // See comments above about slicing and ownership.
- if (unit != nullptr) {
- // TODO: On nullptr, reset to default value?
- move.fMacros.unit = std::move(*unit);
- delete unit;
- }
- return move;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::perUnit(const icu::MeasureUnit& perUnit) const& {
- Derived copy(*this);
- // See comments above about slicing.
- copy.fMacros.perUnit = perUnit;
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::perUnit(const icu::MeasureUnit& perUnit)&& {
- Derived move(std::move(*this));
- // See comments above about slicing.
- move.fMacros.perUnit = perUnit;
- return move;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::adoptPerUnit(icu::MeasureUnit* perUnit) const& {
- Derived copy(*this);
- // See comments above about slicing and ownership.
- if (perUnit != nullptr) {
- // TODO: On nullptr, reset to default value?
- copy.fMacros.perUnit = std::move(*perUnit);
- delete perUnit;
- }
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::adoptPerUnit(icu::MeasureUnit* perUnit)&& {
- Derived move(std::move(*this));
- // See comments above about slicing and ownership.
- if (perUnit != nullptr) {
- // TODO: On nullptr, reset to default value?
- move.fMacros.perUnit = std::move(*perUnit);
- delete perUnit;
- }
- return move;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::precision(const Precision& precision) const& {
- Derived copy(*this);
- // NOTE: Slicing is OK.
- copy.fMacros.precision = precision;
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::precision(const Precision& precision)&& {
- Derived move(std::move(*this));
- // NOTE: Slicing is OK.
- move.fMacros.precision = precision;
- return move;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::roundingMode(UNumberFormatRoundingMode roundingMode) const& {
- Derived copy(*this);
- copy.fMacros.roundingMode = roundingMode;
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::roundingMode(UNumberFormatRoundingMode roundingMode)&& {
- Derived move(std::move(*this));
- move.fMacros.roundingMode = roundingMode;
- return move;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::grouping(UNumberGroupingStrategy strategy) const& {
- Derived copy(*this);
- // NOTE: This is slightly different than how the setting is stored in Java
- // because we want to put it on the stack.
- copy.fMacros.grouper = Grouper::forStrategy(strategy);
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::grouping(UNumberGroupingStrategy strategy)&& {
- Derived move(std::move(*this));
- move.fMacros.grouper = Grouper::forStrategy(strategy);
- return move;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::integerWidth(const IntegerWidth& style) const& {
- Derived copy(*this);
- copy.fMacros.integerWidth = style;
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::integerWidth(const IntegerWidth& style)&& {
- Derived move(std::move(*this));
- move.fMacros.integerWidth = style;
- return move;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::symbols(const DecimalFormatSymbols& symbols) const& {
- Derived copy(*this);
- copy.fMacros.symbols.setTo(symbols);
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::symbols(const DecimalFormatSymbols& symbols)&& {
- Derived move(std::move(*this));
- move.fMacros.symbols.setTo(symbols);
- return move;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::adoptSymbols(NumberingSystem* ns) const& {
- Derived copy(*this);
- copy.fMacros.symbols.setTo(ns);
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::adoptSymbols(NumberingSystem* ns)&& {
- Derived move(std::move(*this));
- move.fMacros.symbols.setTo(ns);
- return move;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::unitWidth(UNumberUnitWidth width) const& {
- Derived copy(*this);
- copy.fMacros.unitWidth = width;
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::unitWidth(UNumberUnitWidth width)&& {
- Derived move(std::move(*this));
- move.fMacros.unitWidth = width;
- return move;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::sign(UNumberSignDisplay style) const& {
- Derived copy(*this);
- copy.fMacros.sign = style;
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::sign(UNumberSignDisplay style)&& {
- Derived move(std::move(*this));
- move.fMacros.sign = style;
- return move;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::decimal(UNumberDecimalSeparatorDisplay style) const& {
- Derived copy(*this);
- copy.fMacros.decimal = style;
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::decimal(UNumberDecimalSeparatorDisplay style)&& {
- Derived move(std::move(*this));
- move.fMacros.decimal = style;
- return move;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::scale(const Scale& scale) const& {
- Derived copy(*this);
- copy.fMacros.scale = scale;
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::scale(const Scale& scale)&& {
- Derived move(std::move(*this));
- move.fMacros.scale = scale;
- return move;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::padding(const Padder& padder) const& {
- Derived copy(*this);
- copy.fMacros.padder = padder;
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::padding(const Padder& padder)&& {
- Derived move(std::move(*this));
- move.fMacros.padder = padder;
- return move;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::threshold(int32_t threshold) const& {
- Derived copy(*this);
- copy.fMacros.threshold = threshold;
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::threshold(int32_t threshold)&& {
- Derived move(std::move(*this));
- move.fMacros.threshold = threshold;
- return move;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::macros(const impl::MacroProps& macros) const& {
- Derived copy(*this);
- copy.fMacros = macros;
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::macros(const impl::MacroProps& macros)&& {
- Derived move(std::move(*this));
- move.fMacros = macros;
- return move;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::macros(impl::MacroProps&& macros) const& {
- Derived copy(*this);
- copy.fMacros = std::move(macros);
- return copy;
-}
-
-template<typename Derived>
-Derived NumberFormatterSettings<Derived>::macros(impl::MacroProps&& macros)&& {
- Derived move(std::move(*this));
- move.fMacros = std::move(macros);
- return move;
-}
-
-// Note: toSkeleton defined in number_skeletons.cpp
-
-template<typename Derived>
-LocalPointer<Derived> NumberFormatterSettings<Derived>::clone() const & {
- return LocalPointer<Derived>(new Derived(*this));
-}
-
-template<typename Derived>
-LocalPointer<Derived> NumberFormatterSettings<Derived>::clone() && {
- return LocalPointer<Derived>(new Derived(std::move(*this)));
-}
-
-// Declare all classes that implement NumberFormatterSettings
-// See https://stackoverflow.com/a/495056/1407170
-template
-class icu::number::NumberFormatterSettings<icu::number::UnlocalizedNumberFormatter>;
-template
-class icu::number::NumberFormatterSettings<icu::number::LocalizedNumberFormatter>;
-
-
-UnlocalizedNumberFormatter NumberFormatter::with() {
- UnlocalizedNumberFormatter result;
- return result;
-}
-
-LocalizedNumberFormatter NumberFormatter::withLocale(const Locale& locale) {
- return with().locale(locale);
-}
-
-// Note: forSkeleton defined in number_skeletons.cpp
-
-
-template<typename T> using NFS = NumberFormatterSettings<T>;
-using LNF = LocalizedNumberFormatter;
-using UNF = UnlocalizedNumberFormatter;
-
-UnlocalizedNumberFormatter::UnlocalizedNumberFormatter(const UNF& other)
- : UNF(static_cast<const NFS<UNF>&>(other)) {}
-
-UnlocalizedNumberFormatter::UnlocalizedNumberFormatter(const NFS<UNF>& other)
- : NFS<UNF>(other) {
- // No additional fields to assign
-}
-
-// Make default copy constructor call the NumberFormatterSettings copy constructor.
-UnlocalizedNumberFormatter::UnlocalizedNumberFormatter(UNF&& src) U_NOEXCEPT
- : UNF(static_cast<NFS<UNF>&&>(src)) {}
-
-UnlocalizedNumberFormatter::UnlocalizedNumberFormatter(NFS<UNF>&& src) U_NOEXCEPT
- : NFS<UNF>(std::move(src)) {
- // No additional fields to assign
-}
-
-UnlocalizedNumberFormatter& UnlocalizedNumberFormatter::operator=(const UNF& other) {
- NFS<UNF>::operator=(static_cast<const NFS<UNF>&>(other));
- // No additional fields to assign
- return *this;
-}
-
-UnlocalizedNumberFormatter& UnlocalizedNumberFormatter::operator=(UNF&& src) U_NOEXCEPT {
- NFS<UNF>::operator=(static_cast<NFS<UNF>&&>(src));
- // No additional fields to assign
- return *this;
-}
-
-// Make default copy constructor call the NumberFormatterSettings copy constructor.
-LocalizedNumberFormatter::LocalizedNumberFormatter(const LNF& other)
- : LNF(static_cast<const NFS<LNF>&>(other)) {}
-
-LocalizedNumberFormatter::LocalizedNumberFormatter(const NFS<LNF>& other)
- : NFS<LNF>(other) {
- // No additional fields to assign (let call count and compiled formatter reset to defaults)
-}
-
-LocalizedNumberFormatter::LocalizedNumberFormatter(LocalizedNumberFormatter&& src) U_NOEXCEPT
- : LNF(static_cast<NFS<LNF>&&>(src)) {}
-
-LocalizedNumberFormatter::LocalizedNumberFormatter(NFS<LNF>&& src) U_NOEXCEPT
- : NFS<LNF>(std::move(src)) {
- // For the move operators, copy over the compiled formatter.
- // Note: if the formatter is not compiled, call count information is lost.
- if (static_cast<LNF&&>(src).fCompiled != nullptr) {
- lnfMoveHelper(static_cast<LNF&&>(src));
- }
-}
-
-LocalizedNumberFormatter& LocalizedNumberFormatter::operator=(const LNF& other) {
- NFS<LNF>::operator=(static_cast<const NFS<LNF>&>(other));
- // Reset to default values.
- clear();
- return *this;
-}
-
-LocalizedNumberFormatter& LocalizedNumberFormatter::operator=(LNF&& src) U_NOEXCEPT {
- NFS<LNF>::operator=(static_cast<NFS<LNF>&&>(src));
- // For the move operators, copy over the compiled formatter.
- // Note: if the formatter is not compiled, call count information is lost.
- if (static_cast<LNF&&>(src).fCompiled != nullptr) {
- // Formatter is compiled
- lnfMoveHelper(static_cast<LNF&&>(src));
- } else {
- clear();
- }
- return *this;
-}
-
-void LocalizedNumberFormatter::clear() {
- // Reset to default values.
- auto* callCount = reinterpret_cast<u_atomic_int32_t*>(fUnsafeCallCount);
- umtx_storeRelease(*callCount, 0);
- delete fCompiled;
- fCompiled = nullptr;
-}
-
-void LocalizedNumberFormatter::lnfMoveHelper(LNF&& src) {
- // Copy over the compiled formatter and set call count to INT32_MIN as in computeCompiled().
- // Don't copy the call count directly because doing so requires a loadAcquire/storeRelease.
- // The bits themselves appear to be platform-dependent, so copying them might not be safe.
- auto* callCount = reinterpret_cast<u_atomic_int32_t*>(fUnsafeCallCount);
- umtx_storeRelease(*callCount, INT32_MIN);
- delete fCompiled;
- fCompiled = src.fCompiled;
- // Reset the source object to leave it in a safe state.
- auto* srcCallCount = reinterpret_cast<u_atomic_int32_t*>(src.fUnsafeCallCount);
- umtx_storeRelease(*srcCallCount, 0);
- src.fCompiled = nullptr;
-}
-
-
-LocalizedNumberFormatter::~LocalizedNumberFormatter() {
- delete fCompiled;
-}
-
-LocalizedNumberFormatter::LocalizedNumberFormatter(const MacroProps& macros, const Locale& locale) {
- fMacros = macros;
- fMacros.locale = locale;
-}
-
-LocalizedNumberFormatter::LocalizedNumberFormatter(MacroProps&& macros, const Locale& locale) {
- fMacros = std::move(macros);
- fMacros.locale = locale;
-}
-
-LocalizedNumberFormatter UnlocalizedNumberFormatter::locale(const Locale& locale) const& {
- return LocalizedNumberFormatter(fMacros, locale);
-}
-
-LocalizedNumberFormatter UnlocalizedNumberFormatter::locale(const Locale& locale)&& {
- return LocalizedNumberFormatter(std::move(fMacros), locale);
-}
-
-SymbolsWrapper::SymbolsWrapper(const SymbolsWrapper& other) {
- doCopyFrom(other);
-}
-
-SymbolsWrapper::SymbolsWrapper(SymbolsWrapper&& src) U_NOEXCEPT {
- doMoveFrom(std::move(src));
-}
-
-SymbolsWrapper& SymbolsWrapper::operator=(const SymbolsWrapper& other) {
- if (this == &other) {
- return *this;
- }
- doCleanup();
- doCopyFrom(other);
- return *this;
-}
-
-SymbolsWrapper& SymbolsWrapper::operator=(SymbolsWrapper&& src) U_NOEXCEPT {
- if (this == &src) {
- return *this;
- }
- doCleanup();
- doMoveFrom(std::move(src));
- return *this;
-}
-
-SymbolsWrapper::~SymbolsWrapper() {
- doCleanup();
-}
-
-void SymbolsWrapper::setTo(const DecimalFormatSymbols& dfs) {
- doCleanup();
- fType = SYMPTR_DFS;
- fPtr.dfs = new DecimalFormatSymbols(dfs);
-}
-
-void SymbolsWrapper::setTo(const NumberingSystem* ns) {
- doCleanup();
- fType = SYMPTR_NS;
- fPtr.ns = ns;
-}
-
-void SymbolsWrapper::doCopyFrom(const SymbolsWrapper& other) {
- fType = other.fType;
- switch (fType) {
- case SYMPTR_NONE:
- // No action necessary
- break;
- case SYMPTR_DFS:
- // Memory allocation failures are exposed in copyErrorTo()
- if (other.fPtr.dfs != nullptr) {
- fPtr.dfs = new DecimalFormatSymbols(*other.fPtr.dfs);
- } else {
- fPtr.dfs = nullptr;
- }
- break;
- case SYMPTR_NS:
- // Memory allocation failures are exposed in copyErrorTo()
- if (other.fPtr.ns != nullptr) {
- fPtr.ns = new NumberingSystem(*other.fPtr.ns);
- } else {
- fPtr.ns = nullptr;
- }
- break;
- }
-}
-
-void SymbolsWrapper::doMoveFrom(SymbolsWrapper&& src) {
- fType = src.fType;
- switch (fType) {
- case SYMPTR_NONE:
- // No action necessary
- break;
- case SYMPTR_DFS:
- fPtr.dfs = src.fPtr.dfs;
- src.fPtr.dfs = nullptr;
- break;
- case SYMPTR_NS:
- fPtr.ns = src.fPtr.ns;
- src.fPtr.ns = nullptr;
- break;
- }
-}
-
-void SymbolsWrapper::doCleanup() {
- switch (fType) {
- case SYMPTR_NONE:
- // No action necessary
- break;
- case SYMPTR_DFS:
- delete fPtr.dfs;
- break;
- case SYMPTR_NS:
- delete fPtr.ns;
- break;
- }
-}
-
-bool SymbolsWrapper::isDecimalFormatSymbols() const {
- return fType == SYMPTR_DFS;
-}
-
-bool SymbolsWrapper::isNumberingSystem() const {
- return fType == SYMPTR_NS;
-}
-
-const DecimalFormatSymbols* SymbolsWrapper::getDecimalFormatSymbols() const {
- U_ASSERT(fType == SYMPTR_DFS);
- return fPtr.dfs;
-}
-
-const NumberingSystem* SymbolsWrapper::getNumberingSystem() const {
- U_ASSERT(fType == SYMPTR_NS);
- return fPtr.ns;
-}
-
-
-FormattedNumber LocalizedNumberFormatter::formatInt(int64_t value, UErrorCode& status) const {
- if (U_FAILURE(status)) { return FormattedNumber(U_ILLEGAL_ARGUMENT_ERROR); }
- auto results = new UFormattedNumberData();
- if (results == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return FormattedNumber(status);
- }
- results->quantity.setToLong(value);
- formatImpl(results, status);
-
- // Do not save the results object if we encountered a failure.
- if (U_SUCCESS(status)) {
- return FormattedNumber(results);
- } else {
- delete results;
- return FormattedNumber(status);
- }
-}
-
-FormattedNumber LocalizedNumberFormatter::formatDouble(double value, UErrorCode& status) const {
- if (U_FAILURE(status)) { return FormattedNumber(U_ILLEGAL_ARGUMENT_ERROR); }
- auto results = new UFormattedNumberData();
- if (results == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return FormattedNumber(status);
- }
- results->quantity.setToDouble(value);
- formatImpl(results, status);
-
- // Do not save the results object if we encountered a failure.
- if (U_SUCCESS(status)) {
- return FormattedNumber(results);
- } else {
- delete results;
- return FormattedNumber(status);
- }
-}
-
-FormattedNumber LocalizedNumberFormatter::formatDecimal(StringPiece value, UErrorCode& status) const {
- if (U_FAILURE(status)) { return FormattedNumber(U_ILLEGAL_ARGUMENT_ERROR); }
- auto results = new UFormattedNumberData();
- if (results == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return FormattedNumber(status);
- }
- results->quantity.setToDecNumber(value, status);
- formatImpl(results, status);
-
- // Do not save the results object if we encountered a failure.
- if (U_SUCCESS(status)) {
- return FormattedNumber(results);
- } else {
- delete results;
- return FormattedNumber(status);
- }
-}
-
-FormattedNumber
-LocalizedNumberFormatter::formatDecimalQuantity(const DecimalQuantity& dq, UErrorCode& status) const {
- if (U_FAILURE(status)) { return FormattedNumber(U_ILLEGAL_ARGUMENT_ERROR); }
- auto results = new UFormattedNumberData();
- if (results == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return FormattedNumber(status);
- }
- results->quantity = dq;
- formatImpl(results, status);
-
- // Do not save the results object if we encountered a failure.
- if (U_SUCCESS(status)) {
- return FormattedNumber(results);
- } else {
- delete results;
- return FormattedNumber(status);
- }
-}
-
-void LocalizedNumberFormatter::formatImpl(impl::UFormattedNumberData* results, UErrorCode& status) const {
- if (computeCompiled(status)) {
- fCompiled->format(results->quantity, results->getStringRef(), status);
- } else {
- NumberFormatterImpl::formatStatic(fMacros, results->quantity, results->getStringRef(), status);
- }
- if (U_FAILURE(status)) {
- return;
- }
- results->getStringRef().writeTerminator(status);
-}
-
-void LocalizedNumberFormatter::getAffixImpl(bool isPrefix, bool isNegative, UnicodeString& result,
- UErrorCode& status) const {
- FormattedStringBuilder string;
- auto signum = static_cast<Signum>(isNegative ? SIGNUM_NEG : SIGNUM_POS);
- // Always return affixes for plural form OTHER.
- static const StandardPlural::Form plural = StandardPlural::OTHER;
- int32_t prefixLength;
- if (computeCompiled(status)) {
- prefixLength = fCompiled->getPrefixSuffix(signum, plural, string, status);
- } else {
- prefixLength = NumberFormatterImpl::getPrefixSuffixStatic(fMacros, signum, plural, string, status);
- }
- result.remove();
- if (isPrefix) {
- result.append(string.toTempUnicodeString().tempSubStringBetween(0, prefixLength));
- } else {
- result.append(string.toTempUnicodeString().tempSubStringBetween(prefixLength, string.length()));
- }
-}
-
-bool LocalizedNumberFormatter::computeCompiled(UErrorCode& status) const {
- // fUnsafeCallCount contains memory to be interpreted as an atomic int, most commonly
- // std::atomic<int32_t>. Since the type of atomic int is platform-dependent, we cast the
- // bytes in fUnsafeCallCount to u_atomic_int32_t, a typedef for the platform-dependent
- // atomic int type defined in umutex.h.
- static_assert(
- sizeof(u_atomic_int32_t) <= sizeof(fUnsafeCallCount),
- "Atomic integer size on this platform exceeds the size allocated by fUnsafeCallCount");
- auto* callCount = reinterpret_cast<u_atomic_int32_t*>(
- const_cast<LocalizedNumberFormatter*>(this)->fUnsafeCallCount);
-
- // A positive value in the atomic int indicates that the data structure is not yet ready;
- // a negative value indicates that it is ready. If, after the increment, the atomic int
- // is exactly threshold, then it is the current thread's job to build the data structure.
- // Note: We set the callCount to INT32_MIN so that if another thread proceeds to increment
- // the atomic int, the value remains below zero.
- int32_t currentCount = umtx_loadAcquire(*callCount);
- if (0 <= currentCount && currentCount <= fMacros.threshold && fMacros.threshold > 0) {
- currentCount = umtx_atomic_inc(callCount);
- }
-
- if (currentCount == fMacros.threshold && fMacros.threshold > 0) {
- // Build the data structure and then use it (slow to fast path).
- const NumberFormatterImpl* compiled = new NumberFormatterImpl(fMacros, status);
- if (compiled == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- U_ASSERT(fCompiled == nullptr);
- const_cast<LocalizedNumberFormatter*>(this)->fCompiled = compiled;
- umtx_storeRelease(*callCount, INT32_MIN);
- return true;
- } else if (currentCount < 0) {
- // The data structure is already built; use it (fast path).
- U_ASSERT(fCompiled != nullptr);
- return true;
- } else {
- // Format the number without building the data structure (slow path).
- return false;
- }
-}
-
-const impl::NumberFormatterImpl* LocalizedNumberFormatter::getCompiled() const {
- return fCompiled;
-}
-
-int32_t LocalizedNumberFormatter::getCallCount() const {
- auto* callCount = reinterpret_cast<u_atomic_int32_t*>(
- const_cast<LocalizedNumberFormatter*>(this)->fUnsafeCallCount);
- return umtx_loadAcquire(*callCount);
-}
-
-// Note: toFormat defined in number_asformat.cpp
-
-#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
-// Warning 4661.
-#pragma warning(pop)
-#endif
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "uassert.h"
+#include "unicode/numberformatter.h"
+#include "number_decimalquantity.h"
+#include "number_formatimpl.h"
+#include "umutex.h"
+#include "number_asformat.h"
+#include "number_utils.h"
+#include "number_utypes.h"
+#include "util.h"
+#include "fphdlimp.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
+// Ignore MSVC warning 4661. This is generated for NumberFormatterSettings<>::toSkeleton() as this method
+// is defined elsewhere (in number_skeletons.cpp). The compiler is warning that the explicit template instantiation
+// inside this single translation unit (CPP file) is incomplete, and thus it isn't sure if the template class is
+// fully defined. However, since each translation unit explicitly instantiates all the necessary template classes,
+// they will all be passed to the linker, and the linker will still find and export all the class members.
+#pragma warning(push)
+#pragma warning(disable: 4661)
+#endif
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::notation(const Notation& notation) const& {
+ Derived copy(*this);
+ // NOTE: Slicing is OK.
+ copy.fMacros.notation = notation;
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::notation(const Notation& notation)&& {
+ Derived move(std::move(*this));
+ // NOTE: Slicing is OK.
+ move.fMacros.notation = notation;
+ return move;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::unit(const icu::MeasureUnit& unit) const& {
+ Derived copy(*this);
+ // NOTE: Slicing occurs here. However, CurrencyUnit can be restored from MeasureUnit.
+ // TimeUnit may be affected, but TimeUnit is not as relevant to number formatting.
+ copy.fMacros.unit = unit;
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::unit(const icu::MeasureUnit& unit)&& {
+ Derived move(std::move(*this));
+ // See comments above about slicing.
+ move.fMacros.unit = unit;
+ return move;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::adoptUnit(icu::MeasureUnit* unit) const& {
+ Derived copy(*this);
+ // Just move the unit into the MacroProps by value, and delete it since we have ownership.
+ // NOTE: Slicing occurs here. However, CurrencyUnit can be restored from MeasureUnit.
+ // TimeUnit may be affected, but TimeUnit is not as relevant to number formatting.
+ if (unit != nullptr) {
+ // TODO: On nullptr, reset to default value?
+ copy.fMacros.unit = std::move(*unit);
+ delete unit;
+ }
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::adoptUnit(icu::MeasureUnit* unit)&& {
+ Derived move(std::move(*this));
+ // See comments above about slicing and ownership.
+ if (unit != nullptr) {
+ // TODO: On nullptr, reset to default value?
+ move.fMacros.unit = std::move(*unit);
+ delete unit;
+ }
+ return move;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::perUnit(const icu::MeasureUnit& perUnit) const& {
+ Derived copy(*this);
+ // See comments above about slicing.
+ copy.fMacros.perUnit = perUnit;
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::perUnit(const icu::MeasureUnit& perUnit)&& {
+ Derived move(std::move(*this));
+ // See comments above about slicing.
+ move.fMacros.perUnit = perUnit;
+ return move;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::adoptPerUnit(icu::MeasureUnit* perUnit) const& {
+ Derived copy(*this);
+ // See comments above about slicing and ownership.
+ if (perUnit != nullptr) {
+ // TODO: On nullptr, reset to default value?
+ copy.fMacros.perUnit = std::move(*perUnit);
+ delete perUnit;
+ }
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::adoptPerUnit(icu::MeasureUnit* perUnit)&& {
+ Derived move(std::move(*this));
+ // See comments above about slicing and ownership.
+ if (perUnit != nullptr) {
+ // TODO: On nullptr, reset to default value?
+ move.fMacros.perUnit = std::move(*perUnit);
+ delete perUnit;
+ }
+ return move;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::precision(const Precision& precision) const& {
+ Derived copy(*this);
+ // NOTE: Slicing is OK.
+ copy.fMacros.precision = precision;
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::precision(const Precision& precision)&& {
+ Derived move(std::move(*this));
+ // NOTE: Slicing is OK.
+ move.fMacros.precision = precision;
+ return move;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::roundingMode(UNumberFormatRoundingMode roundingMode) const& {
+ Derived copy(*this);
+ copy.fMacros.roundingMode = roundingMode;
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::roundingMode(UNumberFormatRoundingMode roundingMode)&& {
+ Derived move(std::move(*this));
+ move.fMacros.roundingMode = roundingMode;
+ return move;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::grouping(UNumberGroupingStrategy strategy) const& {
+ Derived copy(*this);
+ // NOTE: This is slightly different than how the setting is stored in Java
+ // because we want to put it on the stack.
+ copy.fMacros.grouper = Grouper::forStrategy(strategy);
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::grouping(UNumberGroupingStrategy strategy)&& {
+ Derived move(std::move(*this));
+ move.fMacros.grouper = Grouper::forStrategy(strategy);
+ return move;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::integerWidth(const IntegerWidth& style) const& {
+ Derived copy(*this);
+ copy.fMacros.integerWidth = style;
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::integerWidth(const IntegerWidth& style)&& {
+ Derived move(std::move(*this));
+ move.fMacros.integerWidth = style;
+ return move;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::symbols(const DecimalFormatSymbols& symbols) const& {
+ Derived copy(*this);
+ copy.fMacros.symbols.setTo(symbols);
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::symbols(const DecimalFormatSymbols& symbols)&& {
+ Derived move(std::move(*this));
+ move.fMacros.symbols.setTo(symbols);
+ return move;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::adoptSymbols(NumberingSystem* ns) const& {
+ Derived copy(*this);
+ copy.fMacros.symbols.setTo(ns);
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::adoptSymbols(NumberingSystem* ns)&& {
+ Derived move(std::move(*this));
+ move.fMacros.symbols.setTo(ns);
+ return move;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::unitWidth(UNumberUnitWidth width) const& {
+ Derived copy(*this);
+ copy.fMacros.unitWidth = width;
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::unitWidth(UNumberUnitWidth width)&& {
+ Derived move(std::move(*this));
+ move.fMacros.unitWidth = width;
+ return move;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::sign(UNumberSignDisplay style) const& {
+ Derived copy(*this);
+ copy.fMacros.sign = style;
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::sign(UNumberSignDisplay style)&& {
+ Derived move(std::move(*this));
+ move.fMacros.sign = style;
+ return move;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::decimal(UNumberDecimalSeparatorDisplay style) const& {
+ Derived copy(*this);
+ copy.fMacros.decimal = style;
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::decimal(UNumberDecimalSeparatorDisplay style)&& {
+ Derived move(std::move(*this));
+ move.fMacros.decimal = style;
+ return move;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::scale(const Scale& scale) const& {
+ Derived copy(*this);
+ copy.fMacros.scale = scale;
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::scale(const Scale& scale)&& {
+ Derived move(std::move(*this));
+ move.fMacros.scale = scale;
+ return move;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::padding(const Padder& padder) const& {
+ Derived copy(*this);
+ copy.fMacros.padder = padder;
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::padding(const Padder& padder)&& {
+ Derived move(std::move(*this));
+ move.fMacros.padder = padder;
+ return move;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::threshold(int32_t threshold) const& {
+ Derived copy(*this);
+ copy.fMacros.threshold = threshold;
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::threshold(int32_t threshold)&& {
+ Derived move(std::move(*this));
+ move.fMacros.threshold = threshold;
+ return move;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::macros(const impl::MacroProps& macros) const& {
+ Derived copy(*this);
+ copy.fMacros = macros;
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::macros(const impl::MacroProps& macros)&& {
+ Derived move(std::move(*this));
+ move.fMacros = macros;
+ return move;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::macros(impl::MacroProps&& macros) const& {
+ Derived copy(*this);
+ copy.fMacros = std::move(macros);
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberFormatterSettings<Derived>::macros(impl::MacroProps&& macros)&& {
+ Derived move(std::move(*this));
+ move.fMacros = std::move(macros);
+ return move;
+}
+
+// Note: toSkeleton defined in number_skeletons.cpp
+
+template<typename Derived>
+LocalPointer<Derived> NumberFormatterSettings<Derived>::clone() const & {
+ return LocalPointer<Derived>(new Derived(*this));
+}
+
+template<typename Derived>
+LocalPointer<Derived> NumberFormatterSettings<Derived>::clone() && {
+ return LocalPointer<Derived>(new Derived(std::move(*this)));
+}
+
+// Declare all classes that implement NumberFormatterSettings
+// See https://stackoverflow.com/a/495056/1407170
+template
+class icu::number::NumberFormatterSettings<icu::number::UnlocalizedNumberFormatter>;
+template
+class icu::number::NumberFormatterSettings<icu::number::LocalizedNumberFormatter>;
+
+
+UnlocalizedNumberFormatter NumberFormatter::with() {
+ UnlocalizedNumberFormatter result;
+ return result;
+}
+
+LocalizedNumberFormatter NumberFormatter::withLocale(const Locale& locale) {
+ return with().locale(locale);
+}
+
+// Note: forSkeleton defined in number_skeletons.cpp
+
+
+template<typename T> using NFS = NumberFormatterSettings<T>;
+using LNF = LocalizedNumberFormatter;
+using UNF = UnlocalizedNumberFormatter;
+
+UnlocalizedNumberFormatter::UnlocalizedNumberFormatter(const UNF& other)
+ : UNF(static_cast<const NFS<UNF>&>(other)) {}
+
+UnlocalizedNumberFormatter::UnlocalizedNumberFormatter(const NFS<UNF>& other)
+ : NFS<UNF>(other) {
+ // No additional fields to assign
+}
+
+// Make default copy constructor call the NumberFormatterSettings copy constructor.
+UnlocalizedNumberFormatter::UnlocalizedNumberFormatter(UNF&& src) U_NOEXCEPT
+ : UNF(static_cast<NFS<UNF>&&>(src)) {}
+
+UnlocalizedNumberFormatter::UnlocalizedNumberFormatter(NFS<UNF>&& src) U_NOEXCEPT
+ : NFS<UNF>(std::move(src)) {
+ // No additional fields to assign
+}
+
+UnlocalizedNumberFormatter& UnlocalizedNumberFormatter::operator=(const UNF& other) {
+ NFS<UNF>::operator=(static_cast<const NFS<UNF>&>(other));
+ // No additional fields to assign
+ return *this;
+}
+
+UnlocalizedNumberFormatter& UnlocalizedNumberFormatter::operator=(UNF&& src) U_NOEXCEPT {
+ NFS<UNF>::operator=(static_cast<NFS<UNF>&&>(src));
+ // No additional fields to assign
+ return *this;
+}
+
+// Make default copy constructor call the NumberFormatterSettings copy constructor.
+LocalizedNumberFormatter::LocalizedNumberFormatter(const LNF& other)
+ : LNF(static_cast<const NFS<LNF>&>(other)) {}
+
+LocalizedNumberFormatter::LocalizedNumberFormatter(const NFS<LNF>& other)
+ : NFS<LNF>(other) {
+ // No additional fields to assign (let call count and compiled formatter reset to defaults)
+}
+
+LocalizedNumberFormatter::LocalizedNumberFormatter(LocalizedNumberFormatter&& src) U_NOEXCEPT
+ : LNF(static_cast<NFS<LNF>&&>(src)) {}
+
+LocalizedNumberFormatter::LocalizedNumberFormatter(NFS<LNF>&& src) U_NOEXCEPT
+ : NFS<LNF>(std::move(src)) {
+ // For the move operators, copy over the compiled formatter.
+ // Note: if the formatter is not compiled, call count information is lost.
+ if (static_cast<LNF&&>(src).fCompiled != nullptr) {
+ lnfMoveHelper(static_cast<LNF&&>(src));
+ }
+}
+
+LocalizedNumberFormatter& LocalizedNumberFormatter::operator=(const LNF& other) {
+ NFS<LNF>::operator=(static_cast<const NFS<LNF>&>(other));
+ // Reset to default values.
+ clear();
+ return *this;
+}
+
+LocalizedNumberFormatter& LocalizedNumberFormatter::operator=(LNF&& src) U_NOEXCEPT {
+ NFS<LNF>::operator=(static_cast<NFS<LNF>&&>(src));
+ // For the move operators, copy over the compiled formatter.
+ // Note: if the formatter is not compiled, call count information is lost.
+ if (static_cast<LNF&&>(src).fCompiled != nullptr) {
+ // Formatter is compiled
+ lnfMoveHelper(static_cast<LNF&&>(src));
+ } else {
+ clear();
+ }
+ return *this;
+}
+
+void LocalizedNumberFormatter::clear() {
+ // Reset to default values.
+ auto* callCount = reinterpret_cast<u_atomic_int32_t*>(fUnsafeCallCount);
+ umtx_storeRelease(*callCount, 0);
+ delete fCompiled;
+ fCompiled = nullptr;
+}
+
+void LocalizedNumberFormatter::lnfMoveHelper(LNF&& src) {
+ // Copy over the compiled formatter and set call count to INT32_MIN as in computeCompiled().
+ // Don't copy the call count directly because doing so requires a loadAcquire/storeRelease.
+ // The bits themselves appear to be platform-dependent, so copying them might not be safe.
+ auto* callCount = reinterpret_cast<u_atomic_int32_t*>(fUnsafeCallCount);
+ umtx_storeRelease(*callCount, INT32_MIN);
+ delete fCompiled;
+ fCompiled = src.fCompiled;
+ // Reset the source object to leave it in a safe state.
+ auto* srcCallCount = reinterpret_cast<u_atomic_int32_t*>(src.fUnsafeCallCount);
+ umtx_storeRelease(*srcCallCount, 0);
+ src.fCompiled = nullptr;
+}
+
+
+LocalizedNumberFormatter::~LocalizedNumberFormatter() {
+ delete fCompiled;
+}
+
+LocalizedNumberFormatter::LocalizedNumberFormatter(const MacroProps& macros, const Locale& locale) {
+ fMacros = macros;
+ fMacros.locale = locale;
+}
+
+LocalizedNumberFormatter::LocalizedNumberFormatter(MacroProps&& macros, const Locale& locale) {
+ fMacros = std::move(macros);
+ fMacros.locale = locale;
+}
+
+LocalizedNumberFormatter UnlocalizedNumberFormatter::locale(const Locale& locale) const& {
+ return LocalizedNumberFormatter(fMacros, locale);
+}
+
+LocalizedNumberFormatter UnlocalizedNumberFormatter::locale(const Locale& locale)&& {
+ return LocalizedNumberFormatter(std::move(fMacros), locale);
+}
+
+SymbolsWrapper::SymbolsWrapper(const SymbolsWrapper& other) {
+ doCopyFrom(other);
+}
+
+SymbolsWrapper::SymbolsWrapper(SymbolsWrapper&& src) U_NOEXCEPT {
+ doMoveFrom(std::move(src));
+}
+
+SymbolsWrapper& SymbolsWrapper::operator=(const SymbolsWrapper& other) {
+ if (this == &other) {
+ return *this;
+ }
+ doCleanup();
+ doCopyFrom(other);
+ return *this;
+}
+
+SymbolsWrapper& SymbolsWrapper::operator=(SymbolsWrapper&& src) U_NOEXCEPT {
+ if (this == &src) {
+ return *this;
+ }
+ doCleanup();
+ doMoveFrom(std::move(src));
+ return *this;
+}
+
+SymbolsWrapper::~SymbolsWrapper() {
+ doCleanup();
+}
+
+void SymbolsWrapper::setTo(const DecimalFormatSymbols& dfs) {
+ doCleanup();
+ fType = SYMPTR_DFS;
+ fPtr.dfs = new DecimalFormatSymbols(dfs);
+}
+
+void SymbolsWrapper::setTo(const NumberingSystem* ns) {
+ doCleanup();
+ fType = SYMPTR_NS;
+ fPtr.ns = ns;
+}
+
+void SymbolsWrapper::doCopyFrom(const SymbolsWrapper& other) {
+ fType = other.fType;
+ switch (fType) {
+ case SYMPTR_NONE:
+ // No action necessary
+ break;
+ case SYMPTR_DFS:
+ // Memory allocation failures are exposed in copyErrorTo()
+ if (other.fPtr.dfs != nullptr) {
+ fPtr.dfs = new DecimalFormatSymbols(*other.fPtr.dfs);
+ } else {
+ fPtr.dfs = nullptr;
+ }
+ break;
+ case SYMPTR_NS:
+ // Memory allocation failures are exposed in copyErrorTo()
+ if (other.fPtr.ns != nullptr) {
+ fPtr.ns = new NumberingSystem(*other.fPtr.ns);
+ } else {
+ fPtr.ns = nullptr;
+ }
+ break;
+ }
+}
+
+void SymbolsWrapper::doMoveFrom(SymbolsWrapper&& src) {
+ fType = src.fType;
+ switch (fType) {
+ case SYMPTR_NONE:
+ // No action necessary
+ break;
+ case SYMPTR_DFS:
+ fPtr.dfs = src.fPtr.dfs;
+ src.fPtr.dfs = nullptr;
+ break;
+ case SYMPTR_NS:
+ fPtr.ns = src.fPtr.ns;
+ src.fPtr.ns = nullptr;
+ break;
+ }
+}
+
+void SymbolsWrapper::doCleanup() {
+ switch (fType) {
+ case SYMPTR_NONE:
+ // No action necessary
+ break;
+ case SYMPTR_DFS:
+ delete fPtr.dfs;
+ break;
+ case SYMPTR_NS:
+ delete fPtr.ns;
+ break;
+ }
+}
+
+bool SymbolsWrapper::isDecimalFormatSymbols() const {
+ return fType == SYMPTR_DFS;
+}
+
+bool SymbolsWrapper::isNumberingSystem() const {
+ return fType == SYMPTR_NS;
+}
+
+const DecimalFormatSymbols* SymbolsWrapper::getDecimalFormatSymbols() const {
+ U_ASSERT(fType == SYMPTR_DFS);
+ return fPtr.dfs;
+}
+
+const NumberingSystem* SymbolsWrapper::getNumberingSystem() const {
+ U_ASSERT(fType == SYMPTR_NS);
+ return fPtr.ns;
+}
+
+
+FormattedNumber LocalizedNumberFormatter::formatInt(int64_t value, UErrorCode& status) const {
+ if (U_FAILURE(status)) { return FormattedNumber(U_ILLEGAL_ARGUMENT_ERROR); }
+ auto results = new UFormattedNumberData();
+ if (results == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return FormattedNumber(status);
+ }
+ results->quantity.setToLong(value);
+ formatImpl(results, status);
+
+ // Do not save the results object if we encountered a failure.
+ if (U_SUCCESS(status)) {
+ return FormattedNumber(results);
+ } else {
+ delete results;
+ return FormattedNumber(status);
+ }
+}
+
+FormattedNumber LocalizedNumberFormatter::formatDouble(double value, UErrorCode& status) const {
+ if (U_FAILURE(status)) { return FormattedNumber(U_ILLEGAL_ARGUMENT_ERROR); }
+ auto results = new UFormattedNumberData();
+ if (results == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return FormattedNumber(status);
+ }
+ results->quantity.setToDouble(value);
+ formatImpl(results, status);
+
+ // Do not save the results object if we encountered a failure.
+ if (U_SUCCESS(status)) {
+ return FormattedNumber(results);
+ } else {
+ delete results;
+ return FormattedNumber(status);
+ }
+}
+
+FormattedNumber LocalizedNumberFormatter::formatDecimal(StringPiece value, UErrorCode& status) const {
+ if (U_FAILURE(status)) { return FormattedNumber(U_ILLEGAL_ARGUMENT_ERROR); }
+ auto results = new UFormattedNumberData();
+ if (results == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return FormattedNumber(status);
+ }
+ results->quantity.setToDecNumber(value, status);
+ formatImpl(results, status);
+
+ // Do not save the results object if we encountered a failure.
+ if (U_SUCCESS(status)) {
+ return FormattedNumber(results);
+ } else {
+ delete results;
+ return FormattedNumber(status);
+ }
+}
+
+FormattedNumber
+LocalizedNumberFormatter::formatDecimalQuantity(const DecimalQuantity& dq, UErrorCode& status) const {
+ if (U_FAILURE(status)) { return FormattedNumber(U_ILLEGAL_ARGUMENT_ERROR); }
+ auto results = new UFormattedNumberData();
+ if (results == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return FormattedNumber(status);
+ }
+ results->quantity = dq;
+ formatImpl(results, status);
+
+ // Do not save the results object if we encountered a failure.
+ if (U_SUCCESS(status)) {
+ return FormattedNumber(results);
+ } else {
+ delete results;
+ return FormattedNumber(status);
+ }
+}
+
+void LocalizedNumberFormatter::formatImpl(impl::UFormattedNumberData* results, UErrorCode& status) const {
+ if (computeCompiled(status)) {
+ fCompiled->format(results->quantity, results->getStringRef(), status);
+ } else {
+ NumberFormatterImpl::formatStatic(fMacros, results->quantity, results->getStringRef(), status);
+ }
+ if (U_FAILURE(status)) {
+ return;
+ }
+ results->getStringRef().writeTerminator(status);
+}
+
+void LocalizedNumberFormatter::getAffixImpl(bool isPrefix, bool isNegative, UnicodeString& result,
+ UErrorCode& status) const {
+ FormattedStringBuilder string;
+ auto signum = static_cast<Signum>(isNegative ? SIGNUM_NEG : SIGNUM_POS);
+ // Always return affixes for plural form OTHER.
+ static const StandardPlural::Form plural = StandardPlural::OTHER;
+ int32_t prefixLength;
+ if (computeCompiled(status)) {
+ prefixLength = fCompiled->getPrefixSuffix(signum, plural, string, status);
+ } else {
+ prefixLength = NumberFormatterImpl::getPrefixSuffixStatic(fMacros, signum, plural, string, status);
+ }
+ result.remove();
+ if (isPrefix) {
+ result.append(string.toTempUnicodeString().tempSubStringBetween(0, prefixLength));
+ } else {
+ result.append(string.toTempUnicodeString().tempSubStringBetween(prefixLength, string.length()));
+ }
+}
+
+bool LocalizedNumberFormatter::computeCompiled(UErrorCode& status) const {
+ // fUnsafeCallCount contains memory to be interpreted as an atomic int, most commonly
+ // std::atomic<int32_t>. Since the type of atomic int is platform-dependent, we cast the
+ // bytes in fUnsafeCallCount to u_atomic_int32_t, a typedef for the platform-dependent
+ // atomic int type defined in umutex.h.
+ static_assert(
+ sizeof(u_atomic_int32_t) <= sizeof(fUnsafeCallCount),
+ "Atomic integer size on this platform exceeds the size allocated by fUnsafeCallCount");
+ auto* callCount = reinterpret_cast<u_atomic_int32_t*>(
+ const_cast<LocalizedNumberFormatter*>(this)->fUnsafeCallCount);
+
+ // A positive value in the atomic int indicates that the data structure is not yet ready;
+ // a negative value indicates that it is ready. If, after the increment, the atomic int
+ // is exactly threshold, then it is the current thread's job to build the data structure.
+ // Note: We set the callCount to INT32_MIN so that if another thread proceeds to increment
+ // the atomic int, the value remains below zero.
+ int32_t currentCount = umtx_loadAcquire(*callCount);
+ if (0 <= currentCount && currentCount <= fMacros.threshold && fMacros.threshold > 0) {
+ currentCount = umtx_atomic_inc(callCount);
+ }
+
+ if (currentCount == fMacros.threshold && fMacros.threshold > 0) {
+ // Build the data structure and then use it (slow to fast path).
+ const NumberFormatterImpl* compiled = new NumberFormatterImpl(fMacros, status);
+ if (compiled == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ U_ASSERT(fCompiled == nullptr);
+ const_cast<LocalizedNumberFormatter*>(this)->fCompiled = compiled;
+ umtx_storeRelease(*callCount, INT32_MIN);
+ return true;
+ } else if (currentCount < 0) {
+ // The data structure is already built; use it (fast path).
+ U_ASSERT(fCompiled != nullptr);
+ return true;
+ } else {
+ // Format the number without building the data structure (slow path).
+ return false;
+ }
+}
+
+const impl::NumberFormatterImpl* LocalizedNumberFormatter::getCompiled() const {
+ return fCompiled;
+}
+
+int32_t LocalizedNumberFormatter::getCallCount() const {
+ auto* callCount = reinterpret_cast<u_atomic_int32_t*>(
+ const_cast<LocalizedNumberFormatter*>(this)->fUnsafeCallCount);
+ return umtx_loadAcquire(*callCount);
+}
+
+// Note: toFormat defined in number_asformat.cpp
+
+#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
+// Warning 4661.
+#pragma warning(pop)
+#endif
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_formatimpl.cpp b/contrib/libs/icu/i18n/number_formatimpl.cpp
index 79d53c432c..5bba09cfb5 100644
--- a/contrib/libs/icu/i18n/number_formatimpl.cpp
+++ b/contrib/libs/icu/i18n/number_formatimpl.cpp
@@ -1,536 +1,536 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "cstring.h"
-#include "unicode/ures.h"
-#include "uresimp.h"
-#include "charstr.h"
-#include "number_formatimpl.h"
-#include "unicode/numfmt.h"
-#include "number_patternstring.h"
-#include "number_utils.h"
-#include "unicode/numberformatter.h"
-#include "unicode/dcfmtsym.h"
-#include "number_scientific.h"
-#include "number_compact.h"
-#include "uresimp.h"
-#include "ureslocs.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-
-MicroPropsGenerator::~MicroPropsGenerator() = default;
-
-
-NumberFormatterImpl::NumberFormatterImpl(const MacroProps& macros, UErrorCode& status)
- : NumberFormatterImpl(macros, true, status) {
-}
-
-int32_t NumberFormatterImpl::formatStatic(const MacroProps& macros, DecimalQuantity& inValue,
- FormattedStringBuilder& outString, UErrorCode& status) {
- NumberFormatterImpl impl(macros, false, status);
- MicroProps& micros = impl.preProcessUnsafe(inValue, status);
- if (U_FAILURE(status)) { return 0; }
- int32_t length = writeNumber(micros, inValue, outString, 0, status);
- length += writeAffixes(micros, outString, 0, length, status);
- return length;
-}
-
-int32_t NumberFormatterImpl::getPrefixSuffixStatic(const MacroProps& macros, Signum signum,
- StandardPlural::Form plural,
- FormattedStringBuilder& outString, UErrorCode& status) {
- NumberFormatterImpl impl(macros, false, status);
- return impl.getPrefixSuffixUnsafe(signum, plural, outString, status);
-}
-
-// NOTE: C++ SPECIFIC DIFFERENCE FROM JAVA:
-// The "safe" apply method uses a new MicroProps. In the MicroPropsGenerator, fMicros is copied into the new instance.
-// The "unsafe" method simply re-uses fMicros, eliminating the extra copy operation.
-// See MicroProps::processQuantity() for details.
-
-int32_t NumberFormatterImpl::format(DecimalQuantity& inValue, FormattedStringBuilder& outString,
- UErrorCode& status) const {
- MicroProps micros;
- preProcess(inValue, micros, status);
- if (U_FAILURE(status)) { return 0; }
- int32_t length = writeNumber(micros, inValue, outString, 0, status);
- length += writeAffixes(micros, outString, 0, length, status);
- return length;
-}
-
-void NumberFormatterImpl::preProcess(DecimalQuantity& inValue, MicroProps& microsOut,
- UErrorCode& status) const {
- if (U_FAILURE(status)) { return; }
- if (fMicroPropsGenerator == nullptr) {
- status = U_INTERNAL_PROGRAM_ERROR;
- return;
- }
- fMicroPropsGenerator->processQuantity(inValue, microsOut, status);
- microsOut.integerWidth.apply(inValue, status);
-}
-
-MicroProps& NumberFormatterImpl::preProcessUnsafe(DecimalQuantity& inValue, UErrorCode& status) {
- if (U_FAILURE(status)) {
- return fMicros; // must always return a value
- }
- if (fMicroPropsGenerator == nullptr) {
- status = U_INTERNAL_PROGRAM_ERROR;
- return fMicros; // must always return a value
- }
- fMicroPropsGenerator->processQuantity(inValue, fMicros, status);
- fMicros.integerWidth.apply(inValue, status);
- return fMicros;
-}
-
-int32_t NumberFormatterImpl::getPrefixSuffix(Signum signum, StandardPlural::Form plural,
- FormattedStringBuilder& outString, UErrorCode& status) const {
- if (U_FAILURE(status)) { return 0; }
- // #13453: DecimalFormat wants the affixes from the pattern only (modMiddle, aka pattern modifier).
- // Safe path: use fImmutablePatternModifier.
- const Modifier* modifier = fImmutablePatternModifier->getModifier(signum, plural);
- modifier->apply(outString, 0, 0, status);
- if (U_FAILURE(status)) { return 0; }
- return modifier->getPrefixLength();
-}
-
-int32_t NumberFormatterImpl::getPrefixSuffixUnsafe(Signum signum, StandardPlural::Form plural,
- FormattedStringBuilder& outString, UErrorCode& status) {
- if (U_FAILURE(status)) { return 0; }
- // #13453: DecimalFormat wants the affixes from the pattern only (modMiddle, aka pattern modifier).
- // Unsafe path: use fPatternModifier.
- fPatternModifier->setNumberProperties(signum, plural);
- fPatternModifier->apply(outString, 0, 0, status);
- if (U_FAILURE(status)) { return 0; }
- return fPatternModifier->getPrefixLength();
-}
-
-NumberFormatterImpl::NumberFormatterImpl(const MacroProps& macros, bool safe, UErrorCode& status) {
- fMicroPropsGenerator = macrosToMicroGenerator(macros, safe, status);
-}
-
-//////////
-
-const MicroPropsGenerator*
-NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, UErrorCode& status) {
- if (U_FAILURE(status)) { return nullptr; }
- const MicroPropsGenerator* chain = &fMicros;
-
- // Check that macros is error-free before continuing.
- if (macros.copyErrorTo(status)) {
- return nullptr;
- }
-
- // TODO: Accept currency symbols from DecimalFormatSymbols?
-
- // Pre-compute a few values for efficiency.
- bool isCurrency = utils::unitIsCurrency(macros.unit);
- bool isNoUnit = utils::unitIsNoUnit(macros.unit);
- bool isPercent = utils::unitIsPercent(macros.unit);
- bool isPermille = utils::unitIsPermille(macros.unit);
- bool isAccounting =
- macros.sign == UNUM_SIGN_ACCOUNTING || macros.sign == UNUM_SIGN_ACCOUNTING_ALWAYS ||
- macros.sign == UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO;
- CurrencyUnit currency(u"", status);
- if (isCurrency) {
- currency = CurrencyUnit(macros.unit, status); // Restore CurrencyUnit from MeasureUnit
- }
- UNumberUnitWidth unitWidth = UNUM_UNIT_WIDTH_SHORT;
- if (macros.unitWidth != UNUM_UNIT_WIDTH_COUNT) {
- unitWidth = macros.unitWidth;
- }
- bool isCldrUnit = !isCurrency && !isNoUnit &&
- (unitWidth == UNUM_UNIT_WIDTH_FULL_NAME || !(isPercent || isPermille));
-
- // Select the numbering system.
- LocalPointer<const NumberingSystem> nsLocal;
- const NumberingSystem* ns;
- if (macros.symbols.isNumberingSystem()) {
- ns = macros.symbols.getNumberingSystem();
- } else {
- // TODO: Is there a way to avoid creating the NumberingSystem object?
- ns = NumberingSystem::createInstance(macros.locale, status);
- // Give ownership to the function scope.
- nsLocal.adoptInstead(ns);
- }
- const char* nsName = U_SUCCESS(status) ? ns->getName() : "latn";
- uprv_strncpy(fMicros.nsName, nsName, 8);
- fMicros.nsName[8] = 0; // guarantee NUL-terminated
-
- // Resolve the symbols. Do this here because currency may need to customize them.
- if (macros.symbols.isDecimalFormatSymbols()) {
- fMicros.symbols = macros.symbols.getDecimalFormatSymbols();
- } else {
- LocalPointer<DecimalFormatSymbols> newSymbols(
- new DecimalFormatSymbols(macros.locale, *ns, status), status);
- if (U_FAILURE(status)) {
- return nullptr;
- }
- if (isCurrency) {
- newSymbols->setCurrency(currency.getISOCurrency(), status);
- if (U_FAILURE(status)) {
- return nullptr;
- }
- }
- fMicros.symbols = newSymbols.getAlias();
- fSymbols.adoptInstead(newSymbols.orphan());
- }
-
- // Load and parse the pattern string. It is used for grouping sizes and affixes only.
- // If we are formatting currency, check for a currency-specific pattern.
- const char16_t* pattern = nullptr;
- if (isCurrency && fMicros.symbols->getCurrencyPattern() != nullptr) {
- pattern = fMicros.symbols->getCurrencyPattern();
- }
- if (pattern == nullptr) {
- CldrPatternStyle patternStyle;
- if (isCldrUnit) {
- patternStyle = CLDR_PATTERN_STYLE_DECIMAL;
- } else if (isPercent || isPermille) {
- patternStyle = CLDR_PATTERN_STYLE_PERCENT;
- } else if (!isCurrency || unitWidth == UNUM_UNIT_WIDTH_FULL_NAME) {
- patternStyle = CLDR_PATTERN_STYLE_DECIMAL;
- } else if (isAccounting) {
- // NOTE: Although ACCOUNTING and ACCOUNTING_ALWAYS are only supported in currencies right now,
- // the API contract allows us to add support to other units in the future.
- patternStyle = CLDR_PATTERN_STYLE_ACCOUNTING;
- } else {
- patternStyle = CLDR_PATTERN_STYLE_CURRENCY;
- }
- pattern = utils::getPatternForStyle(macros.locale, nsName, patternStyle, status);
- if (U_FAILURE(status)) {
- return nullptr;
- }
- }
- auto patternInfo = new ParsedPatternInfo();
- if (patternInfo == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
- fPatternInfo.adoptInstead(patternInfo);
- PatternParser::parseToPatternInfo(UnicodeString(pattern), *patternInfo, status);
- if (U_FAILURE(status)) {
- return nullptr;
- }
-
- /////////////////////////////////////////////////////////////////////////////////////
- /// START POPULATING THE DEFAULT MICROPROPS AND BUILDING THE MICROPROPS GENERATOR ///
- /////////////////////////////////////////////////////////////////////////////////////
-
- // Multiplier
- if (macros.scale.isValid()) {
- fMicros.helpers.multiplier.setAndChain(macros.scale, chain);
- chain = &fMicros.helpers.multiplier;
- }
-
- // Rounding strategy
- Precision precision;
- if (!macros.precision.isBogus()) {
- precision = macros.precision;
- } else if (macros.notation.fType == Notation::NTN_COMPACT) {
- precision = Precision::integer().withMinDigits(2);
- } else if (isCurrency) {
- precision = Precision::currency(UCURR_USAGE_STANDARD);
- } else {
- precision = Precision::maxFraction(6);
- }
- UNumberFormatRoundingMode roundingMode;
- if (macros.roundingMode != kDefaultMode) {
- roundingMode = macros.roundingMode;
- } else {
- // Temporary until ICU 64
- roundingMode = precision.fRoundingMode;
- }
- fMicros.rounder = {precision, roundingMode, currency, status};
- if (U_FAILURE(status)) {
- return nullptr;
- }
-
- // Grouping strategy
- if (!macros.grouper.isBogus()) {
- fMicros.grouping = macros.grouper;
- } else if (macros.notation.fType == Notation::NTN_COMPACT) {
- // Compact notation uses minGrouping by default since ICU 59
- fMicros.grouping = Grouper::forStrategy(UNUM_GROUPING_MIN2);
- } else {
- fMicros.grouping = Grouper::forStrategy(UNUM_GROUPING_AUTO);
- }
- fMicros.grouping.setLocaleData(*fPatternInfo, macros.locale);
-
- // Padding strategy
- if (!macros.padder.isBogus()) {
- fMicros.padding = macros.padder;
- } else {
- fMicros.padding = Padder::none();
- }
-
- // Integer width
- if (!macros.integerWidth.isBogus()) {
- fMicros.integerWidth = macros.integerWidth;
- } else {
- fMicros.integerWidth = IntegerWidth::standard();
- }
-
- // Sign display
- if (macros.sign != UNUM_SIGN_COUNT) {
- fMicros.sign = macros.sign;
- } else {
- fMicros.sign = UNUM_SIGN_AUTO;
- }
-
- // Decimal mark display
- if (macros.decimal != UNUM_DECIMAL_SEPARATOR_COUNT) {
- fMicros.decimal = macros.decimal;
- } else {
- fMicros.decimal = UNUM_DECIMAL_SEPARATOR_AUTO;
- }
-
- // Use monetary separator symbols
- fMicros.useCurrency = isCurrency;
-
- // Inner modifier (scientific notation)
- if (macros.notation.fType == Notation::NTN_SCIENTIFIC) {
- auto newScientificHandler = new ScientificHandler(&macros.notation, fMicros.symbols, chain);
- if (newScientificHandler == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
- fScientificHandler.adoptInstead(newScientificHandler);
- chain = fScientificHandler.getAlias();
- } else {
- // No inner modifier required
- fMicros.modInner = &fMicros.helpers.emptyStrongModifier;
- }
-
- // Middle modifier (patterns, positive/negative, currency symbols, percent)
- auto patternModifier = new MutablePatternModifier(false);
- if (patternModifier == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
- fPatternModifier.adoptInstead(patternModifier);
- patternModifier->setPatternInfo(
- macros.affixProvider != nullptr ? macros.affixProvider
- : static_cast<const AffixPatternProvider*>(fPatternInfo.getAlias()),
- kUndefinedField);
- patternModifier->setPatternAttributes(fMicros.sign, isPermille);
- if (patternModifier->needsPlurals()) {
- patternModifier->setSymbols(
- fMicros.symbols,
- currency,
- unitWidth,
- resolvePluralRules(macros.rules, macros.locale, status),
- status);
- } else {
- patternModifier->setSymbols(fMicros.symbols, currency, unitWidth, nullptr, status);
- }
- if (safe) {
- fImmutablePatternModifier.adoptInstead(patternModifier->createImmutable(status));
- }
- if (U_FAILURE(status)) {
- return nullptr;
- }
-
- // Outer modifier (CLDR units and currency long names)
- if (isCldrUnit) {
- fLongNameHandler.adoptInstead(
- LongNameHandler::forMeasureUnit(
- macros.locale,
- macros.unit,
- macros.perUnit,
- unitWidth,
- resolvePluralRules(macros.rules, macros.locale, status),
- chain,
- status));
- chain = fLongNameHandler.getAlias();
- } else if (isCurrency && unitWidth == UNUM_UNIT_WIDTH_FULL_NAME) {
- fLongNameHandler.adoptInstead(
- LongNameHandler::forCurrencyLongNames(
- macros.locale,
- currency,
- resolvePluralRules(macros.rules, macros.locale, status),
- chain,
- status));
- chain = fLongNameHandler.getAlias();
- } else {
- // No outer modifier required
- fMicros.modOuter = &fMicros.helpers.emptyWeakModifier;
- }
- if (U_FAILURE(status)) {
- return nullptr;
- }
-
- // Compact notation
- if (macros.notation.fType == Notation::NTN_COMPACT) {
- CompactType compactType = (isCurrency && unitWidth != UNUM_UNIT_WIDTH_FULL_NAME)
- ? CompactType::TYPE_CURRENCY : CompactType::TYPE_DECIMAL;
- auto newCompactHandler = new CompactHandler(
- macros.notation.fUnion.compactStyle,
- macros.locale,
- nsName,
- compactType,
- resolvePluralRules(macros.rules, macros.locale, status),
- patternModifier,
- safe,
- chain,
- status);
- if (newCompactHandler == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
- fCompactHandler.adoptInstead(newCompactHandler);
- chain = fCompactHandler.getAlias();
- }
- if (U_FAILURE(status)) {
- return nullptr;
- }
-
- // Always add the pattern modifier as the last element of the chain.
- if (safe) {
- fImmutablePatternModifier->addToChain(chain);
- chain = fImmutablePatternModifier.getAlias();
- } else {
- patternModifier->addToChain(chain);
- chain = patternModifier;
- }
-
- return chain;
-}
-
-const PluralRules*
-NumberFormatterImpl::resolvePluralRules(const PluralRules* rulesPtr, const Locale& locale,
- UErrorCode& status) {
- if (rulesPtr != nullptr) {
- return rulesPtr;
- }
- // Lazily create PluralRules
- if (fRules.isNull()) {
- fRules.adoptInstead(PluralRules::forLocale(locale, status));
- }
- return fRules.getAlias();
-}
-
-int32_t NumberFormatterImpl::writeAffixes(const MicroProps& micros, FormattedStringBuilder& string,
- int32_t start, int32_t end, UErrorCode& status) {
- // Always apply the inner modifier (which is "strong").
- int32_t length = micros.modInner->apply(string, start, end, status);
- if (micros.padding.isValid()) {
- length += micros.padding
- .padAndApply(*micros.modMiddle, *micros.modOuter, string, start, length + end, status);
- } else {
- length += micros.modMiddle->apply(string, start, length + end, status);
- length += micros.modOuter->apply(string, start, length + end, status);
- }
- return length;
-}
-
-int32_t NumberFormatterImpl::writeNumber(const MicroProps& micros, DecimalQuantity& quantity,
- FormattedStringBuilder& string, int32_t index,
- UErrorCode& status) {
- int32_t length = 0;
- if (quantity.isInfinite()) {
- length += string.insert(
- length + index,
- micros.symbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kInfinitySymbol),
- {UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD},
- status);
-
- } else if (quantity.isNaN()) {
- length += string.insert(
- length + index,
- micros.symbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kNaNSymbol),
- {UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD},
- status);
-
- } else {
- // Add the integer digits
- length += writeIntegerDigits(micros, quantity, string, length + index, status);
-
- // Add the decimal point
- if (quantity.getLowerDisplayMagnitude() < 0 || micros.decimal == UNUM_DECIMAL_SEPARATOR_ALWAYS) {
- length += string.insert(
- length + index,
- micros.useCurrency ? micros.symbols->getSymbol(
- DecimalFormatSymbols::ENumberFormatSymbol::kMonetarySeparatorSymbol) : micros
- .symbols
- ->getSymbol(
- DecimalFormatSymbols::ENumberFormatSymbol::kDecimalSeparatorSymbol),
- {UFIELD_CATEGORY_NUMBER, UNUM_DECIMAL_SEPARATOR_FIELD},
- status);
- }
-
- // Add the fraction digits
- length += writeFractionDigits(micros, quantity, string, length + index, status);
-
- if (length == 0) {
- // Force output of the digit for value 0
- length += utils::insertDigitFromSymbols(
- string,
- index,
- 0,
- *micros.symbols,
- {UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD},
- status);
- }
- }
-
- return length;
-}
-
-int32_t NumberFormatterImpl::writeIntegerDigits(const MicroProps& micros, DecimalQuantity& quantity,
- FormattedStringBuilder& string, int32_t index,
- UErrorCode& status) {
- int length = 0;
- int integerCount = quantity.getUpperDisplayMagnitude() + 1;
- for (int i = 0; i < integerCount; i++) {
- // Add grouping separator
- if (micros.grouping.groupAtPosition(i, quantity)) {
- length += string.insert(
- index,
- micros.useCurrency ? micros.symbols->getSymbol(
- DecimalFormatSymbols::ENumberFormatSymbol::kMonetaryGroupingSeparatorSymbol)
- : micros.symbols->getSymbol(
- DecimalFormatSymbols::ENumberFormatSymbol::kGroupingSeparatorSymbol),
- {UFIELD_CATEGORY_NUMBER, UNUM_GROUPING_SEPARATOR_FIELD},
- status);
- }
-
- // Get and append the next digit value
- int8_t nextDigit = quantity.getDigit(i);
- length += utils::insertDigitFromSymbols(
- string,
- index,
- nextDigit,
- *micros.symbols,
- {UFIELD_CATEGORY_NUMBER,
- UNUM_INTEGER_FIELD},
- status);
- }
- return length;
-}
-
-int32_t NumberFormatterImpl::writeFractionDigits(const MicroProps& micros, DecimalQuantity& quantity,
- FormattedStringBuilder& string, int32_t index,
- UErrorCode& status) {
- int length = 0;
- int fractionCount = -quantity.getLowerDisplayMagnitude();
- for (int i = 0; i < fractionCount; i++) {
- // Get and append the next digit value
- int8_t nextDigit = quantity.getDigit(-i - 1);
- length += utils::insertDigitFromSymbols(
- string,
- length + index,
- nextDigit,
- *micros.symbols,
- {UFIELD_CATEGORY_NUMBER, UNUM_FRACTION_FIELD},
- status);
- }
- return length;
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "cstring.h"
+#include "unicode/ures.h"
+#include "uresimp.h"
+#include "charstr.h"
+#include "number_formatimpl.h"
+#include "unicode/numfmt.h"
+#include "number_patternstring.h"
+#include "number_utils.h"
+#include "unicode/numberformatter.h"
+#include "unicode/dcfmtsym.h"
+#include "number_scientific.h"
+#include "number_compact.h"
+#include "uresimp.h"
+#include "ureslocs.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+
+MicroPropsGenerator::~MicroPropsGenerator() = default;
+
+
+NumberFormatterImpl::NumberFormatterImpl(const MacroProps& macros, UErrorCode& status)
+ : NumberFormatterImpl(macros, true, status) {
+}
+
+int32_t NumberFormatterImpl::formatStatic(const MacroProps& macros, DecimalQuantity& inValue,
+ FormattedStringBuilder& outString, UErrorCode& status) {
+ NumberFormatterImpl impl(macros, false, status);
+ MicroProps& micros = impl.preProcessUnsafe(inValue, status);
+ if (U_FAILURE(status)) { return 0; }
+ int32_t length = writeNumber(micros, inValue, outString, 0, status);
+ length += writeAffixes(micros, outString, 0, length, status);
+ return length;
+}
+
+int32_t NumberFormatterImpl::getPrefixSuffixStatic(const MacroProps& macros, Signum signum,
+ StandardPlural::Form plural,
+ FormattedStringBuilder& outString, UErrorCode& status) {
+ NumberFormatterImpl impl(macros, false, status);
+ return impl.getPrefixSuffixUnsafe(signum, plural, outString, status);
+}
+
+// NOTE: C++ SPECIFIC DIFFERENCE FROM JAVA:
+// The "safe" apply method uses a new MicroProps. In the MicroPropsGenerator, fMicros is copied into the new instance.
+// The "unsafe" method simply re-uses fMicros, eliminating the extra copy operation.
+// See MicroProps::processQuantity() for details.
+
+int32_t NumberFormatterImpl::format(DecimalQuantity& inValue, FormattedStringBuilder& outString,
+ UErrorCode& status) const {
+ MicroProps micros;
+ preProcess(inValue, micros, status);
+ if (U_FAILURE(status)) { return 0; }
+ int32_t length = writeNumber(micros, inValue, outString, 0, status);
+ length += writeAffixes(micros, outString, 0, length, status);
+ return length;
+}
+
+void NumberFormatterImpl::preProcess(DecimalQuantity& inValue, MicroProps& microsOut,
+ UErrorCode& status) const {
+ if (U_FAILURE(status)) { return; }
+ if (fMicroPropsGenerator == nullptr) {
+ status = U_INTERNAL_PROGRAM_ERROR;
+ return;
+ }
+ fMicroPropsGenerator->processQuantity(inValue, microsOut, status);
+ microsOut.integerWidth.apply(inValue, status);
+}
+
+MicroProps& NumberFormatterImpl::preProcessUnsafe(DecimalQuantity& inValue, UErrorCode& status) {
+ if (U_FAILURE(status)) {
+ return fMicros; // must always return a value
+ }
+ if (fMicroPropsGenerator == nullptr) {
+ status = U_INTERNAL_PROGRAM_ERROR;
+ return fMicros; // must always return a value
+ }
+ fMicroPropsGenerator->processQuantity(inValue, fMicros, status);
+ fMicros.integerWidth.apply(inValue, status);
+ return fMicros;
+}
+
+int32_t NumberFormatterImpl::getPrefixSuffix(Signum signum, StandardPlural::Form plural,
+ FormattedStringBuilder& outString, UErrorCode& status) const {
+ if (U_FAILURE(status)) { return 0; }
+ // #13453: DecimalFormat wants the affixes from the pattern only (modMiddle, aka pattern modifier).
+ // Safe path: use fImmutablePatternModifier.
+ const Modifier* modifier = fImmutablePatternModifier->getModifier(signum, plural);
+ modifier->apply(outString, 0, 0, status);
+ if (U_FAILURE(status)) { return 0; }
+ return modifier->getPrefixLength();
+}
+
+int32_t NumberFormatterImpl::getPrefixSuffixUnsafe(Signum signum, StandardPlural::Form plural,
+ FormattedStringBuilder& outString, UErrorCode& status) {
+ if (U_FAILURE(status)) { return 0; }
+ // #13453: DecimalFormat wants the affixes from the pattern only (modMiddle, aka pattern modifier).
+ // Unsafe path: use fPatternModifier.
+ fPatternModifier->setNumberProperties(signum, plural);
+ fPatternModifier->apply(outString, 0, 0, status);
+ if (U_FAILURE(status)) { return 0; }
+ return fPatternModifier->getPrefixLength();
+}
+
+NumberFormatterImpl::NumberFormatterImpl(const MacroProps& macros, bool safe, UErrorCode& status) {
+ fMicroPropsGenerator = macrosToMicroGenerator(macros, safe, status);
+}
+
+//////////
+
+const MicroPropsGenerator*
+NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, UErrorCode& status) {
+ if (U_FAILURE(status)) { return nullptr; }
+ const MicroPropsGenerator* chain = &fMicros;
+
+ // Check that macros is error-free before continuing.
+ if (macros.copyErrorTo(status)) {
+ return nullptr;
+ }
+
+ // TODO: Accept currency symbols from DecimalFormatSymbols?
+
+ // Pre-compute a few values for efficiency.
+ bool isCurrency = utils::unitIsCurrency(macros.unit);
+ bool isNoUnit = utils::unitIsNoUnit(macros.unit);
+ bool isPercent = utils::unitIsPercent(macros.unit);
+ bool isPermille = utils::unitIsPermille(macros.unit);
+ bool isAccounting =
+ macros.sign == UNUM_SIGN_ACCOUNTING || macros.sign == UNUM_SIGN_ACCOUNTING_ALWAYS ||
+ macros.sign == UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO;
+ CurrencyUnit currency(u"", status);
+ if (isCurrency) {
+ currency = CurrencyUnit(macros.unit, status); // Restore CurrencyUnit from MeasureUnit
+ }
+ UNumberUnitWidth unitWidth = UNUM_UNIT_WIDTH_SHORT;
+ if (macros.unitWidth != UNUM_UNIT_WIDTH_COUNT) {
+ unitWidth = macros.unitWidth;
+ }
+ bool isCldrUnit = !isCurrency && !isNoUnit &&
+ (unitWidth == UNUM_UNIT_WIDTH_FULL_NAME || !(isPercent || isPermille));
+
+ // Select the numbering system.
+ LocalPointer<const NumberingSystem> nsLocal;
+ const NumberingSystem* ns;
+ if (macros.symbols.isNumberingSystem()) {
+ ns = macros.symbols.getNumberingSystem();
+ } else {
+ // TODO: Is there a way to avoid creating the NumberingSystem object?
+ ns = NumberingSystem::createInstance(macros.locale, status);
+ // Give ownership to the function scope.
+ nsLocal.adoptInstead(ns);
+ }
+ const char* nsName = U_SUCCESS(status) ? ns->getName() : "latn";
+ uprv_strncpy(fMicros.nsName, nsName, 8);
+ fMicros.nsName[8] = 0; // guarantee NUL-terminated
+
+ // Resolve the symbols. Do this here because currency may need to customize them.
+ if (macros.symbols.isDecimalFormatSymbols()) {
+ fMicros.symbols = macros.symbols.getDecimalFormatSymbols();
+ } else {
+ LocalPointer<DecimalFormatSymbols> newSymbols(
+ new DecimalFormatSymbols(macros.locale, *ns, status), status);
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ if (isCurrency) {
+ newSymbols->setCurrency(currency.getISOCurrency(), status);
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ }
+ fMicros.symbols = newSymbols.getAlias();
+ fSymbols.adoptInstead(newSymbols.orphan());
+ }
+
+ // Load and parse the pattern string. It is used for grouping sizes and affixes only.
+ // If we are formatting currency, check for a currency-specific pattern.
+ const char16_t* pattern = nullptr;
+ if (isCurrency && fMicros.symbols->getCurrencyPattern() != nullptr) {
+ pattern = fMicros.symbols->getCurrencyPattern();
+ }
+ if (pattern == nullptr) {
+ CldrPatternStyle patternStyle;
+ if (isCldrUnit) {
+ patternStyle = CLDR_PATTERN_STYLE_DECIMAL;
+ } else if (isPercent || isPermille) {
+ patternStyle = CLDR_PATTERN_STYLE_PERCENT;
+ } else if (!isCurrency || unitWidth == UNUM_UNIT_WIDTH_FULL_NAME) {
+ patternStyle = CLDR_PATTERN_STYLE_DECIMAL;
+ } else if (isAccounting) {
+ // NOTE: Although ACCOUNTING and ACCOUNTING_ALWAYS are only supported in currencies right now,
+ // the API contract allows us to add support to other units in the future.
+ patternStyle = CLDR_PATTERN_STYLE_ACCOUNTING;
+ } else {
+ patternStyle = CLDR_PATTERN_STYLE_CURRENCY;
+ }
+ pattern = utils::getPatternForStyle(macros.locale, nsName, patternStyle, status);
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ }
+ auto patternInfo = new ParsedPatternInfo();
+ if (patternInfo == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+ fPatternInfo.adoptInstead(patternInfo);
+ PatternParser::parseToPatternInfo(UnicodeString(pattern), *patternInfo, status);
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// START POPULATING THE DEFAULT MICROPROPS AND BUILDING THE MICROPROPS GENERATOR ///
+ /////////////////////////////////////////////////////////////////////////////////////
+
+ // Multiplier
+ if (macros.scale.isValid()) {
+ fMicros.helpers.multiplier.setAndChain(macros.scale, chain);
+ chain = &fMicros.helpers.multiplier;
+ }
+
+ // Rounding strategy
+ Precision precision;
+ if (!macros.precision.isBogus()) {
+ precision = macros.precision;
+ } else if (macros.notation.fType == Notation::NTN_COMPACT) {
+ precision = Precision::integer().withMinDigits(2);
+ } else if (isCurrency) {
+ precision = Precision::currency(UCURR_USAGE_STANDARD);
+ } else {
+ precision = Precision::maxFraction(6);
+ }
+ UNumberFormatRoundingMode roundingMode;
+ if (macros.roundingMode != kDefaultMode) {
+ roundingMode = macros.roundingMode;
+ } else {
+ // Temporary until ICU 64
+ roundingMode = precision.fRoundingMode;
+ }
+ fMicros.rounder = {precision, roundingMode, currency, status};
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+
+ // Grouping strategy
+ if (!macros.grouper.isBogus()) {
+ fMicros.grouping = macros.grouper;
+ } else if (macros.notation.fType == Notation::NTN_COMPACT) {
+ // Compact notation uses minGrouping by default since ICU 59
+ fMicros.grouping = Grouper::forStrategy(UNUM_GROUPING_MIN2);
+ } else {
+ fMicros.grouping = Grouper::forStrategy(UNUM_GROUPING_AUTO);
+ }
+ fMicros.grouping.setLocaleData(*fPatternInfo, macros.locale);
+
+ // Padding strategy
+ if (!macros.padder.isBogus()) {
+ fMicros.padding = macros.padder;
+ } else {
+ fMicros.padding = Padder::none();
+ }
+
+ // Integer width
+ if (!macros.integerWidth.isBogus()) {
+ fMicros.integerWidth = macros.integerWidth;
+ } else {
+ fMicros.integerWidth = IntegerWidth::standard();
+ }
+
+ // Sign display
+ if (macros.sign != UNUM_SIGN_COUNT) {
+ fMicros.sign = macros.sign;
+ } else {
+ fMicros.sign = UNUM_SIGN_AUTO;
+ }
+
+ // Decimal mark display
+ if (macros.decimal != UNUM_DECIMAL_SEPARATOR_COUNT) {
+ fMicros.decimal = macros.decimal;
+ } else {
+ fMicros.decimal = UNUM_DECIMAL_SEPARATOR_AUTO;
+ }
+
+ // Use monetary separator symbols
+ fMicros.useCurrency = isCurrency;
+
+ // Inner modifier (scientific notation)
+ if (macros.notation.fType == Notation::NTN_SCIENTIFIC) {
+ auto newScientificHandler = new ScientificHandler(&macros.notation, fMicros.symbols, chain);
+ if (newScientificHandler == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+ fScientificHandler.adoptInstead(newScientificHandler);
+ chain = fScientificHandler.getAlias();
+ } else {
+ // No inner modifier required
+ fMicros.modInner = &fMicros.helpers.emptyStrongModifier;
+ }
+
+ // Middle modifier (patterns, positive/negative, currency symbols, percent)
+ auto patternModifier = new MutablePatternModifier(false);
+ if (patternModifier == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+ fPatternModifier.adoptInstead(patternModifier);
+ patternModifier->setPatternInfo(
+ macros.affixProvider != nullptr ? macros.affixProvider
+ : static_cast<const AffixPatternProvider*>(fPatternInfo.getAlias()),
+ kUndefinedField);
+ patternModifier->setPatternAttributes(fMicros.sign, isPermille);
+ if (patternModifier->needsPlurals()) {
+ patternModifier->setSymbols(
+ fMicros.symbols,
+ currency,
+ unitWidth,
+ resolvePluralRules(macros.rules, macros.locale, status),
+ status);
+ } else {
+ patternModifier->setSymbols(fMicros.symbols, currency, unitWidth, nullptr, status);
+ }
+ if (safe) {
+ fImmutablePatternModifier.adoptInstead(patternModifier->createImmutable(status));
+ }
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+
+ // Outer modifier (CLDR units and currency long names)
+ if (isCldrUnit) {
+ fLongNameHandler.adoptInstead(
+ LongNameHandler::forMeasureUnit(
+ macros.locale,
+ macros.unit,
+ macros.perUnit,
+ unitWidth,
+ resolvePluralRules(macros.rules, macros.locale, status),
+ chain,
+ status));
+ chain = fLongNameHandler.getAlias();
+ } else if (isCurrency && unitWidth == UNUM_UNIT_WIDTH_FULL_NAME) {
+ fLongNameHandler.adoptInstead(
+ LongNameHandler::forCurrencyLongNames(
+ macros.locale,
+ currency,
+ resolvePluralRules(macros.rules, macros.locale, status),
+ chain,
+ status));
+ chain = fLongNameHandler.getAlias();
+ } else {
+ // No outer modifier required
+ fMicros.modOuter = &fMicros.helpers.emptyWeakModifier;
+ }
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+
+ // Compact notation
+ if (macros.notation.fType == Notation::NTN_COMPACT) {
+ CompactType compactType = (isCurrency && unitWidth != UNUM_UNIT_WIDTH_FULL_NAME)
+ ? CompactType::TYPE_CURRENCY : CompactType::TYPE_DECIMAL;
+ auto newCompactHandler = new CompactHandler(
+ macros.notation.fUnion.compactStyle,
+ macros.locale,
+ nsName,
+ compactType,
+ resolvePluralRules(macros.rules, macros.locale, status),
+ patternModifier,
+ safe,
+ chain,
+ status);
+ if (newCompactHandler == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+ fCompactHandler.adoptInstead(newCompactHandler);
+ chain = fCompactHandler.getAlias();
+ }
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+
+ // Always add the pattern modifier as the last element of the chain.
+ if (safe) {
+ fImmutablePatternModifier->addToChain(chain);
+ chain = fImmutablePatternModifier.getAlias();
+ } else {
+ patternModifier->addToChain(chain);
+ chain = patternModifier;
+ }
+
+ return chain;
+}
+
+const PluralRules*
+NumberFormatterImpl::resolvePluralRules(const PluralRules* rulesPtr, const Locale& locale,
+ UErrorCode& status) {
+ if (rulesPtr != nullptr) {
+ return rulesPtr;
+ }
+ // Lazily create PluralRules
+ if (fRules.isNull()) {
+ fRules.adoptInstead(PluralRules::forLocale(locale, status));
+ }
+ return fRules.getAlias();
+}
+
+int32_t NumberFormatterImpl::writeAffixes(const MicroProps& micros, FormattedStringBuilder& string,
+ int32_t start, int32_t end, UErrorCode& status) {
+ // Always apply the inner modifier (which is "strong").
+ int32_t length = micros.modInner->apply(string, start, end, status);
+ if (micros.padding.isValid()) {
+ length += micros.padding
+ .padAndApply(*micros.modMiddle, *micros.modOuter, string, start, length + end, status);
+ } else {
+ length += micros.modMiddle->apply(string, start, length + end, status);
+ length += micros.modOuter->apply(string, start, length + end, status);
+ }
+ return length;
+}
+
+int32_t NumberFormatterImpl::writeNumber(const MicroProps& micros, DecimalQuantity& quantity,
+ FormattedStringBuilder& string, int32_t index,
+ UErrorCode& status) {
+ int32_t length = 0;
+ if (quantity.isInfinite()) {
+ length += string.insert(
+ length + index,
+ micros.symbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kInfinitySymbol),
+ {UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD},
+ status);
+
+ } else if (quantity.isNaN()) {
+ length += string.insert(
+ length + index,
+ micros.symbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kNaNSymbol),
+ {UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD},
+ status);
+
+ } else {
+ // Add the integer digits
+ length += writeIntegerDigits(micros, quantity, string, length + index, status);
+
+ // Add the decimal point
+ if (quantity.getLowerDisplayMagnitude() < 0 || micros.decimal == UNUM_DECIMAL_SEPARATOR_ALWAYS) {
+ length += string.insert(
+ length + index,
+ micros.useCurrency ? micros.symbols->getSymbol(
+ DecimalFormatSymbols::ENumberFormatSymbol::kMonetarySeparatorSymbol) : micros
+ .symbols
+ ->getSymbol(
+ DecimalFormatSymbols::ENumberFormatSymbol::kDecimalSeparatorSymbol),
+ {UFIELD_CATEGORY_NUMBER, UNUM_DECIMAL_SEPARATOR_FIELD},
+ status);
+ }
+
+ // Add the fraction digits
+ length += writeFractionDigits(micros, quantity, string, length + index, status);
+
+ if (length == 0) {
+ // Force output of the digit for value 0
+ length += utils::insertDigitFromSymbols(
+ string,
+ index,
+ 0,
+ *micros.symbols,
+ {UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD},
+ status);
+ }
+ }
+
+ return length;
+}
+
+int32_t NumberFormatterImpl::writeIntegerDigits(const MicroProps& micros, DecimalQuantity& quantity,
+ FormattedStringBuilder& string, int32_t index,
+ UErrorCode& status) {
+ int length = 0;
+ int integerCount = quantity.getUpperDisplayMagnitude() + 1;
+ for (int i = 0; i < integerCount; i++) {
+ // Add grouping separator
+ if (micros.grouping.groupAtPosition(i, quantity)) {
+ length += string.insert(
+ index,
+ micros.useCurrency ? micros.symbols->getSymbol(
+ DecimalFormatSymbols::ENumberFormatSymbol::kMonetaryGroupingSeparatorSymbol)
+ : micros.symbols->getSymbol(
+ DecimalFormatSymbols::ENumberFormatSymbol::kGroupingSeparatorSymbol),
+ {UFIELD_CATEGORY_NUMBER, UNUM_GROUPING_SEPARATOR_FIELD},
+ status);
+ }
+
+ // Get and append the next digit value
+ int8_t nextDigit = quantity.getDigit(i);
+ length += utils::insertDigitFromSymbols(
+ string,
+ index,
+ nextDigit,
+ *micros.symbols,
+ {UFIELD_CATEGORY_NUMBER,
+ UNUM_INTEGER_FIELD},
+ status);
+ }
+ return length;
+}
+
+int32_t NumberFormatterImpl::writeFractionDigits(const MicroProps& micros, DecimalQuantity& quantity,
+ FormattedStringBuilder& string, int32_t index,
+ UErrorCode& status) {
+ int length = 0;
+ int fractionCount = -quantity.getLowerDisplayMagnitude();
+ for (int i = 0; i < fractionCount; i++) {
+ // Get and append the next digit value
+ int8_t nextDigit = quantity.getDigit(-i - 1);
+ length += utils::insertDigitFromSymbols(
+ string,
+ length + index,
+ nextDigit,
+ *micros.symbols,
+ {UFIELD_CATEGORY_NUMBER, UNUM_FRACTION_FIELD},
+ status);
+ }
+ return length;
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_formatimpl.h b/contrib/libs/icu/i18n/number_formatimpl.h
index c06f0dd898..084bc4a9d0 100644
--- a/contrib/libs/icu/i18n/number_formatimpl.h
+++ b/contrib/libs/icu/i18n/number_formatimpl.h
@@ -1,154 +1,154 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMBER_FORMATIMPL_H__
-#define __NUMBER_FORMATIMPL_H__
-
-#include "number_types.h"
-#include "formatted_string_builder.h"
-#include "number_patternstring.h"
-#include "number_utils.h"
-#include "number_patternmodifier.h"
-#include "number_longnames.h"
-#include "number_compact.h"
-#include "number_microprops.h"
-
-U_NAMESPACE_BEGIN namespace number {
-namespace impl {
-
-/**
- * This is the "brain" of the number formatting pipeline. It ties all the pieces together, taking in a MacroProps and a
- * DecimalQuantity and outputting a properly formatted number string.
- */
-class NumberFormatterImpl : public UMemory {
- public:
- /**
- * Builds a "safe" MicroPropsGenerator, which is thread-safe and can be used repeatedly.
- * The caller owns the returned NumberFormatterImpl.
- */
- NumberFormatterImpl(const MacroProps &macros, UErrorCode &status);
-
- /**
- * Builds and evaluates an "unsafe" MicroPropsGenerator, which is cheaper but can be used only once.
- */
- static int32_t
- formatStatic(const MacroProps &macros, DecimalQuantity &inValue, FormattedStringBuilder &outString,
- UErrorCode &status);
-
- /**
- * Prints only the prefix and suffix; used for DecimalFormat getters.
- *
- * @return The index into the output at which the prefix ends and the suffix starts; in other words,
- * the prefix length.
- */
- static int32_t getPrefixSuffixStatic(const MacroProps& macros, Signum signum,
- StandardPlural::Form plural, FormattedStringBuilder& outString,
- UErrorCode& status);
-
- /**
- * Evaluates the "safe" MicroPropsGenerator created by "fromMacros".
- */
- int32_t format(DecimalQuantity& inValue, FormattedStringBuilder& outString, UErrorCode& status) const;
-
- /**
- * Like format(), but saves the result into an output MicroProps without additional processing.
- */
- void preProcess(DecimalQuantity& inValue, MicroProps& microsOut, UErrorCode& status) const;
-
- /**
- * Like getPrefixSuffixStatic() but uses the safe compiled object.
- */
- int32_t getPrefixSuffix(Signum signum, StandardPlural::Form plural, FormattedStringBuilder& outString,
- UErrorCode& status) const;
-
- const MicroProps& getRawMicroProps() const {
- return fMicros;
- }
-
- /**
- * Synthesizes the output string from a MicroProps and DecimalQuantity.
- * This method formats only the main number, not affixes.
- */
- static int32_t writeNumber(const MicroProps& micros, DecimalQuantity& quantity,
- FormattedStringBuilder& string, int32_t index, UErrorCode& status);
-
- /**
- * Adds the affixes. Intended to be called immediately after formatNumber.
- */
- static int32_t writeAffixes(const MicroProps& micros, FormattedStringBuilder& string, int32_t start,
- int32_t end, UErrorCode& status);
-
- private:
- // Head of the MicroPropsGenerator linked list:
- const MicroPropsGenerator *fMicroPropsGenerator = nullptr;
-
- // Tail of the list:
- MicroProps fMicros;
-
- // Other fields possibly used by the number formatting pipeline:
- // TODO: Convert more of these LocalPointers to value objects to reduce the number of news?
- LocalPointer<const DecimalFormatSymbols> fSymbols;
- LocalPointer<const PluralRules> fRules;
- LocalPointer<const ParsedPatternInfo> fPatternInfo;
- LocalPointer<const ScientificHandler> fScientificHandler;
- LocalPointer<MutablePatternModifier> fPatternModifier;
- LocalPointer<ImmutablePatternModifier> fImmutablePatternModifier;
- LocalPointer<const LongNameHandler> fLongNameHandler;
- LocalPointer<const CompactHandler> fCompactHandler;
-
- // Value objects possibly used by the number formatting pipeline:
- struct Warehouse {
- CurrencySymbols fCurrencySymbols;
- } fWarehouse;
-
-
- NumberFormatterImpl(const MacroProps &macros, bool safe, UErrorCode &status);
-
- MicroProps& preProcessUnsafe(DecimalQuantity &inValue, UErrorCode &status);
-
- int32_t getPrefixSuffixUnsafe(Signum signum, StandardPlural::Form plural,
- FormattedStringBuilder& outString, UErrorCode& status);
-
- /**
- * If rulesPtr is non-null, return it. Otherwise, return a PluralRules owned by this object for the
- * specified locale, creating it if necessary.
- */
- const PluralRules *
- resolvePluralRules(const PluralRules *rulesPtr, const Locale &locale, UErrorCode &status);
-
- /**
- * Synthesizes the MacroProps into a MicroPropsGenerator. All information, including the locale, is encoded into the
- * MicroPropsGenerator, except for the quantity itself, which is left abstract and must be provided to the returned
- * MicroPropsGenerator instance.
- *
- * @see MicroPropsGenerator
- * @param macros
- * The {@link MacroProps} to consume. This method does not mutate the MacroProps instance.
- * @param safe
- * If true, the returned MicroPropsGenerator will be thread-safe. If false, the returned value will
- * <em>not</em> be thread-safe, intended for a single "one-shot" use only. Building the thread-safe
- * object is more expensive.
- */
- const MicroPropsGenerator *
- macrosToMicroGenerator(const MacroProps &macros, bool safe, UErrorCode &status);
-
- static int32_t
- writeIntegerDigits(const MicroProps &micros, DecimalQuantity &quantity, FormattedStringBuilder &string,
- int32_t index, UErrorCode &status);
-
- static int32_t
- writeFractionDigits(const MicroProps &micros, DecimalQuantity &quantity, FormattedStringBuilder &string,
- int32_t index, UErrorCode &status);
-};
-
-} // namespace impl
-} // namespace number
-U_NAMESPACE_END
-
-
-#endif //__NUMBER_FORMATIMPL_H__
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMBER_FORMATIMPL_H__
+#define __NUMBER_FORMATIMPL_H__
+
+#include "number_types.h"
+#include "formatted_string_builder.h"
+#include "number_patternstring.h"
+#include "number_utils.h"
+#include "number_patternmodifier.h"
+#include "number_longnames.h"
+#include "number_compact.h"
+#include "number_microprops.h"
+
+U_NAMESPACE_BEGIN namespace number {
+namespace impl {
+
+/**
+ * This is the "brain" of the number formatting pipeline. It ties all the pieces together, taking in a MacroProps and a
+ * DecimalQuantity and outputting a properly formatted number string.
+ */
+class NumberFormatterImpl : public UMemory {
+ public:
+ /**
+ * Builds a "safe" MicroPropsGenerator, which is thread-safe and can be used repeatedly.
+ * The caller owns the returned NumberFormatterImpl.
+ */
+ NumberFormatterImpl(const MacroProps &macros, UErrorCode &status);
+
+ /**
+ * Builds and evaluates an "unsafe" MicroPropsGenerator, which is cheaper but can be used only once.
+ */
+ static int32_t
+ formatStatic(const MacroProps &macros, DecimalQuantity &inValue, FormattedStringBuilder &outString,
+ UErrorCode &status);
+
+ /**
+ * Prints only the prefix and suffix; used for DecimalFormat getters.
+ *
+ * @return The index into the output at which the prefix ends and the suffix starts; in other words,
+ * the prefix length.
+ */
+ static int32_t getPrefixSuffixStatic(const MacroProps& macros, Signum signum,
+ StandardPlural::Form plural, FormattedStringBuilder& outString,
+ UErrorCode& status);
+
+ /**
+ * Evaluates the "safe" MicroPropsGenerator created by "fromMacros".
+ */
+ int32_t format(DecimalQuantity& inValue, FormattedStringBuilder& outString, UErrorCode& status) const;
+
+ /**
+ * Like format(), but saves the result into an output MicroProps without additional processing.
+ */
+ void preProcess(DecimalQuantity& inValue, MicroProps& microsOut, UErrorCode& status) const;
+
+ /**
+ * Like getPrefixSuffixStatic() but uses the safe compiled object.
+ */
+ int32_t getPrefixSuffix(Signum signum, StandardPlural::Form plural, FormattedStringBuilder& outString,
+ UErrorCode& status) const;
+
+ const MicroProps& getRawMicroProps() const {
+ return fMicros;
+ }
+
+ /**
+ * Synthesizes the output string from a MicroProps and DecimalQuantity.
+ * This method formats only the main number, not affixes.
+ */
+ static int32_t writeNumber(const MicroProps& micros, DecimalQuantity& quantity,
+ FormattedStringBuilder& string, int32_t index, UErrorCode& status);
+
+ /**
+ * Adds the affixes. Intended to be called immediately after formatNumber.
+ */
+ static int32_t writeAffixes(const MicroProps& micros, FormattedStringBuilder& string, int32_t start,
+ int32_t end, UErrorCode& status);
+
+ private:
+ // Head of the MicroPropsGenerator linked list:
+ const MicroPropsGenerator *fMicroPropsGenerator = nullptr;
+
+ // Tail of the list:
+ MicroProps fMicros;
+
+ // Other fields possibly used by the number formatting pipeline:
+ // TODO: Convert more of these LocalPointers to value objects to reduce the number of news?
+ LocalPointer<const DecimalFormatSymbols> fSymbols;
+ LocalPointer<const PluralRules> fRules;
+ LocalPointer<const ParsedPatternInfo> fPatternInfo;
+ LocalPointer<const ScientificHandler> fScientificHandler;
+ LocalPointer<MutablePatternModifier> fPatternModifier;
+ LocalPointer<ImmutablePatternModifier> fImmutablePatternModifier;
+ LocalPointer<const LongNameHandler> fLongNameHandler;
+ LocalPointer<const CompactHandler> fCompactHandler;
+
+ // Value objects possibly used by the number formatting pipeline:
+ struct Warehouse {
+ CurrencySymbols fCurrencySymbols;
+ } fWarehouse;
+
+
+ NumberFormatterImpl(const MacroProps &macros, bool safe, UErrorCode &status);
+
+ MicroProps& preProcessUnsafe(DecimalQuantity &inValue, UErrorCode &status);
+
+ int32_t getPrefixSuffixUnsafe(Signum signum, StandardPlural::Form plural,
+ FormattedStringBuilder& outString, UErrorCode& status);
+
+ /**
+ * If rulesPtr is non-null, return it. Otherwise, return a PluralRules owned by this object for the
+ * specified locale, creating it if necessary.
+ */
+ const PluralRules *
+ resolvePluralRules(const PluralRules *rulesPtr, const Locale &locale, UErrorCode &status);
+
+ /**
+ * Synthesizes the MacroProps into a MicroPropsGenerator. All information, including the locale, is encoded into the
+ * MicroPropsGenerator, except for the quantity itself, which is left abstract and must be provided to the returned
+ * MicroPropsGenerator instance.
+ *
+ * @see MicroPropsGenerator
+ * @param macros
+ * The {@link MacroProps} to consume. This method does not mutate the MacroProps instance.
+ * @param safe
+ * If true, the returned MicroPropsGenerator will be thread-safe. If false, the returned value will
+ * <em>not</em> be thread-safe, intended for a single "one-shot" use only. Building the thread-safe
+ * object is more expensive.
+ */
+ const MicroPropsGenerator *
+ macrosToMicroGenerator(const MacroProps &macros, bool safe, UErrorCode &status);
+
+ static int32_t
+ writeIntegerDigits(const MicroProps &micros, DecimalQuantity &quantity, FormattedStringBuilder &string,
+ int32_t index, UErrorCode &status);
+
+ static int32_t
+ writeFractionDigits(const MicroProps &micros, DecimalQuantity &quantity, FormattedStringBuilder &string,
+ int32_t index, UErrorCode &status);
+};
+
+} // namespace impl
+} // namespace number
+U_NAMESPACE_END
+
+
+#endif //__NUMBER_FORMATIMPL_H__
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_grouping.cpp b/contrib/libs/icu/i18n/number_grouping.cpp
index 8854e3e091..41f727a458 100644
--- a/contrib/libs/icu/i18n/number_grouping.cpp
+++ b/contrib/libs/icu/i18n/number_grouping.cpp
@@ -1,109 +1,109 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/numberformatter.h"
-#include "number_patternstring.h"
-#include "uresimp.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-namespace {
-
-int16_t getMinGroupingForLocale(const Locale& locale) {
- // TODO: Cache this?
- UErrorCode localStatus = U_ZERO_ERROR;
- LocalUResourceBundlePointer bundle(ures_open(NULL, locale.getName(), &localStatus));
- int32_t resultLen = 0;
- const char16_t* result = ures_getStringByKeyWithFallback(
- bundle.getAlias(),
- "NumberElements/minimumGroupingDigits",
- &resultLen,
- &localStatus);
- // TODO: Is it safe to assume resultLen == 1? Would locales set minGrouping >= 10?
- if (U_FAILURE(localStatus) || resultLen != 1) {
- return 1;
- }
- return result[0] - u'0';
-}
-
-}
-
-Grouper Grouper::forStrategy(UNumberGroupingStrategy grouping) {
- switch (grouping) {
- case UNUM_GROUPING_OFF:
- return {-1, -1, -2, grouping};
- case UNUM_GROUPING_AUTO:
- return {-2, -2, -2, grouping};
- case UNUM_GROUPING_MIN2:
- return {-2, -2, -3, grouping};
- case UNUM_GROUPING_ON_ALIGNED:
- return {-4, -4, 1, grouping};
- case UNUM_GROUPING_THOUSANDS:
- return {3, 3, 1, grouping};
- default:
- UPRV_UNREACHABLE;
- }
-}
-
-Grouper Grouper::forProperties(const DecimalFormatProperties& properties) {
- if (!properties.groupingUsed) {
- return forStrategy(UNUM_GROUPING_OFF);
- }
- auto grouping1 = static_cast<int16_t>(properties.groupingSize);
- auto grouping2 = static_cast<int16_t>(properties.secondaryGroupingSize);
- auto minGrouping = static_cast<int16_t>(properties.minimumGroupingDigits);
- grouping1 = grouping1 > 0 ? grouping1 : grouping2 > 0 ? grouping2 : grouping1;
- grouping2 = grouping2 > 0 ? grouping2 : grouping1;
- return {grouping1, grouping2, minGrouping, UNUM_GROUPING_COUNT};
-}
-
-void Grouper::setLocaleData(const impl::ParsedPatternInfo &patternInfo, const Locale& locale) {
- if (fGrouping1 != -2 && fGrouping2 != -4) {
- return;
- }
- auto grouping1 = static_cast<int16_t> (patternInfo.positive.groupingSizes & 0xffff);
- auto grouping2 = static_cast<int16_t> ((patternInfo.positive.groupingSizes >> 16) & 0xffff);
- auto grouping3 = static_cast<int16_t> ((patternInfo.positive.groupingSizes >> 32) & 0xffff);
- if (grouping2 == -1) {
- grouping1 = fGrouping1 == -4 ? (short) 3 : (short) -1;
- }
- if (grouping3 == -1) {
- grouping2 = grouping1;
- }
- if (fMinGrouping == -2) {
- fMinGrouping = getMinGroupingForLocale(locale);
- } else if (fMinGrouping == -3) {
- fMinGrouping = static_cast<int16_t>(uprv_max(2, getMinGroupingForLocale(locale)));
- } else {
- // leave fMinGrouping alone
- }
- fGrouping1 = grouping1;
- fGrouping2 = grouping2;
-}
-
-bool Grouper::groupAtPosition(int32_t position, const impl::DecimalQuantity &value) const {
- U_ASSERT(fGrouping1 > -2);
- if (fGrouping1 == -1 || fGrouping1 == 0) {
- // Either -1 or 0 means "no grouping"
- return false;
- }
- position -= fGrouping1;
- return position >= 0 && (position % fGrouping2) == 0
- && value.getUpperDisplayMagnitude() - fGrouping1 + 1 >= fMinGrouping;
-}
-
-int16_t Grouper::getPrimary() const {
- return fGrouping1;
-}
-
-int16_t Grouper::getSecondary() const {
- return fGrouping2;
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/numberformatter.h"
+#include "number_patternstring.h"
+#include "uresimp.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+namespace {
+
+int16_t getMinGroupingForLocale(const Locale& locale) {
+ // TODO: Cache this?
+ UErrorCode localStatus = U_ZERO_ERROR;
+ LocalUResourceBundlePointer bundle(ures_open(NULL, locale.getName(), &localStatus));
+ int32_t resultLen = 0;
+ const char16_t* result = ures_getStringByKeyWithFallback(
+ bundle.getAlias(),
+ "NumberElements/minimumGroupingDigits",
+ &resultLen,
+ &localStatus);
+ // TODO: Is it safe to assume resultLen == 1? Would locales set minGrouping >= 10?
+ if (U_FAILURE(localStatus) || resultLen != 1) {
+ return 1;
+ }
+ return result[0] - u'0';
+}
+
+}
+
+Grouper Grouper::forStrategy(UNumberGroupingStrategy grouping) {
+ switch (grouping) {
+ case UNUM_GROUPING_OFF:
+ return {-1, -1, -2, grouping};
+ case UNUM_GROUPING_AUTO:
+ return {-2, -2, -2, grouping};
+ case UNUM_GROUPING_MIN2:
+ return {-2, -2, -3, grouping};
+ case UNUM_GROUPING_ON_ALIGNED:
+ return {-4, -4, 1, grouping};
+ case UNUM_GROUPING_THOUSANDS:
+ return {3, 3, 1, grouping};
+ default:
+ UPRV_UNREACHABLE;
+ }
+}
+
+Grouper Grouper::forProperties(const DecimalFormatProperties& properties) {
+ if (!properties.groupingUsed) {
+ return forStrategy(UNUM_GROUPING_OFF);
+ }
+ auto grouping1 = static_cast<int16_t>(properties.groupingSize);
+ auto grouping2 = static_cast<int16_t>(properties.secondaryGroupingSize);
+ auto minGrouping = static_cast<int16_t>(properties.minimumGroupingDigits);
+ grouping1 = grouping1 > 0 ? grouping1 : grouping2 > 0 ? grouping2 : grouping1;
+ grouping2 = grouping2 > 0 ? grouping2 : grouping1;
+ return {grouping1, grouping2, minGrouping, UNUM_GROUPING_COUNT};
+}
+
+void Grouper::setLocaleData(const impl::ParsedPatternInfo &patternInfo, const Locale& locale) {
+ if (fGrouping1 != -2 && fGrouping2 != -4) {
+ return;
+ }
+ auto grouping1 = static_cast<int16_t> (patternInfo.positive.groupingSizes & 0xffff);
+ auto grouping2 = static_cast<int16_t> ((patternInfo.positive.groupingSizes >> 16) & 0xffff);
+ auto grouping3 = static_cast<int16_t> ((patternInfo.positive.groupingSizes >> 32) & 0xffff);
+ if (grouping2 == -1) {
+ grouping1 = fGrouping1 == -4 ? (short) 3 : (short) -1;
+ }
+ if (grouping3 == -1) {
+ grouping2 = grouping1;
+ }
+ if (fMinGrouping == -2) {
+ fMinGrouping = getMinGroupingForLocale(locale);
+ } else if (fMinGrouping == -3) {
+ fMinGrouping = static_cast<int16_t>(uprv_max(2, getMinGroupingForLocale(locale)));
+ } else {
+ // leave fMinGrouping alone
+ }
+ fGrouping1 = grouping1;
+ fGrouping2 = grouping2;
+}
+
+bool Grouper::groupAtPosition(int32_t position, const impl::DecimalQuantity &value) const {
+ U_ASSERT(fGrouping1 > -2);
+ if (fGrouping1 == -1 || fGrouping1 == 0) {
+ // Either -1 or 0 means "no grouping"
+ return false;
+ }
+ position -= fGrouping1;
+ return position >= 0 && (position % fGrouping2) == 0
+ && value.getUpperDisplayMagnitude() - fGrouping1 + 1 >= fMinGrouping;
+}
+
+int16_t Grouper::getPrimary() const {
+ return fGrouping1;
+}
+
+int16_t Grouper::getSecondary() const {
+ return fGrouping2;
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_integerwidth.cpp b/contrib/libs/icu/i18n/number_integerwidth.cpp
index 1efb63de75..d62aef444d 100644
--- a/contrib/libs/icu/i18n/number_integerwidth.cpp
+++ b/contrib/libs/icu/i18n/number_integerwidth.cpp
@@ -1,68 +1,68 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/numberformatter.h"
-#include "number_types.h"
-#include "number_decimalquantity.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-IntegerWidth::IntegerWidth(digits_t minInt, digits_t maxInt, bool formatFailIfMoreThanMaxDigits) {
- fUnion.minMaxInt.fMinInt = minInt;
- fUnion.minMaxInt.fMaxInt = maxInt;
- fUnion.minMaxInt.fFormatFailIfMoreThanMaxDigits = formatFailIfMoreThanMaxDigits;
-}
-
-IntegerWidth IntegerWidth::zeroFillTo(int32_t minInt) {
- if (minInt >= 0 && minInt <= kMaxIntFracSig) {
- return {static_cast<digits_t>(minInt), -1, false};
- } else {
- return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
- }
-}
-
-IntegerWidth IntegerWidth::truncateAt(int32_t maxInt) {
- if (fHasError) { return *this; } // No-op on error
- digits_t minInt = fUnion.minMaxInt.fMinInt;
- if (maxInt >= 0 && maxInt <= kMaxIntFracSig && minInt <= maxInt) {
- return {minInt, static_cast<digits_t>(maxInt), false};
- } else if (maxInt == -1) {
- return {minInt, -1, false};
- } else {
- return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
- }
-}
-
-void IntegerWidth::apply(impl::DecimalQuantity& quantity, UErrorCode& status) const {
- if (fHasError) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- } else if (fUnion.minMaxInt.fMaxInt == -1) {
- quantity.setMinInteger(fUnion.minMaxInt.fMinInt);
- } else {
- // Enforce the backwards-compatibility feature "FormatFailIfMoreThanMaxDigits"
- if (fUnion.minMaxInt.fFormatFailIfMoreThanMaxDigits &&
- fUnion.minMaxInt.fMaxInt < quantity.getMagnitude()) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- }
- quantity.setMinInteger(fUnion.minMaxInt.fMinInt);
- quantity.applyMaxInteger(fUnion.minMaxInt.fMaxInt);
- }
-}
-
-bool IntegerWidth::operator==(const IntegerWidth& other) const {
- // Private operator==; do error and bogus checking first!
- U_ASSERT(!fHasError);
- U_ASSERT(!other.fHasError);
- U_ASSERT(!isBogus());
- U_ASSERT(!other.isBogus());
- return fUnion.minMaxInt.fMinInt == other.fUnion.minMaxInt.fMinInt &&
- fUnion.minMaxInt.fMaxInt == other.fUnion.minMaxInt.fMaxInt;
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/numberformatter.h"
+#include "number_types.h"
+#include "number_decimalquantity.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+IntegerWidth::IntegerWidth(digits_t minInt, digits_t maxInt, bool formatFailIfMoreThanMaxDigits) {
+ fUnion.minMaxInt.fMinInt = minInt;
+ fUnion.minMaxInt.fMaxInt = maxInt;
+ fUnion.minMaxInt.fFormatFailIfMoreThanMaxDigits = formatFailIfMoreThanMaxDigits;
+}
+
+IntegerWidth IntegerWidth::zeroFillTo(int32_t minInt) {
+ if (minInt >= 0 && minInt <= kMaxIntFracSig) {
+ return {static_cast<digits_t>(minInt), -1, false};
+ } else {
+ return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
+ }
+}
+
+IntegerWidth IntegerWidth::truncateAt(int32_t maxInt) {
+ if (fHasError) { return *this; } // No-op on error
+ digits_t minInt = fUnion.minMaxInt.fMinInt;
+ if (maxInt >= 0 && maxInt <= kMaxIntFracSig && minInt <= maxInt) {
+ return {minInt, static_cast<digits_t>(maxInt), false};
+ } else if (maxInt == -1) {
+ return {minInt, -1, false};
+ } else {
+ return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
+ }
+}
+
+void IntegerWidth::apply(impl::DecimalQuantity& quantity, UErrorCode& status) const {
+ if (fHasError) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ } else if (fUnion.minMaxInt.fMaxInt == -1) {
+ quantity.setMinInteger(fUnion.minMaxInt.fMinInt);
+ } else {
+ // Enforce the backwards-compatibility feature "FormatFailIfMoreThanMaxDigits"
+ if (fUnion.minMaxInt.fFormatFailIfMoreThanMaxDigits &&
+ fUnion.minMaxInt.fMaxInt < quantity.getMagnitude()) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ }
+ quantity.setMinInteger(fUnion.minMaxInt.fMinInt);
+ quantity.applyMaxInteger(fUnion.minMaxInt.fMaxInt);
+ }
+}
+
+bool IntegerWidth::operator==(const IntegerWidth& other) const {
+ // Private operator==; do error and bogus checking first!
+ U_ASSERT(!fHasError);
+ U_ASSERT(!other.fHasError);
+ U_ASSERT(!isBogus());
+ U_ASSERT(!other.isBogus());
+ return fUnion.minMaxInt.fMinInt == other.fUnion.minMaxInt.fMinInt &&
+ fUnion.minMaxInt.fMaxInt == other.fUnion.minMaxInt.fMaxInt;
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_longnames.cpp b/contrib/libs/icu/i18n/number_longnames.cpp
index 135aa3f7d9..bb32d0381a 100644
--- a/contrib/libs/icu/i18n/number_longnames.cpp
+++ b/contrib/libs/icu/i18n/number_longnames.cpp
@@ -1,350 +1,350 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/simpleformatter.h"
-#include "unicode/ures.h"
-#include "ureslocs.h"
-#include "charstr.h"
-#include "uresimp.h"
-#include "number_longnames.h"
-#include "number_microprops.h"
-#include <algorithm>
-#include "cstring.h"
-#include "util.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-namespace {
-
-constexpr int32_t DNAM_INDEX = StandardPlural::Form::COUNT;
-constexpr int32_t PER_INDEX = StandardPlural::Form::COUNT + 1;
-constexpr int32_t ARRAY_LENGTH = StandardPlural::Form::COUNT + 2;
-
-static int32_t getIndex(const char* pluralKeyword, UErrorCode& status) {
- // pluralKeyword can also be "dnam" or "per"
- if (uprv_strcmp(pluralKeyword, "dnam") == 0) {
- return DNAM_INDEX;
- } else if (uprv_strcmp(pluralKeyword, "per") == 0) {
- return PER_INDEX;
- } else {
- StandardPlural::Form plural = StandardPlural::fromString(pluralKeyword, status);
- return plural;
- }
-}
-
-static UnicodeString getWithPlural(
- const UnicodeString* strings,
- StandardPlural::Form plural,
- UErrorCode& status) {
- UnicodeString result = strings[plural];
- if (result.isBogus()) {
- result = strings[StandardPlural::Form::OTHER];
- }
- if (result.isBogus()) {
- // There should always be data in the "other" plural variant.
- status = U_INTERNAL_PROGRAM_ERROR;
- }
- return result;
-}
-
-
-//////////////////////////
-/// BEGIN DATA LOADING ///
-//////////////////////////
-
-class PluralTableSink : public ResourceSink {
- public:
- explicit PluralTableSink(UnicodeString *outArray) : outArray(outArray) {
- // Initialize the array to bogus strings.
- for (int32_t i = 0; i < ARRAY_LENGTH; i++) {
- outArray[i].setToBogus();
- }
- }
-
- void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) U_OVERRIDE {
- ResourceTable pluralsTable = value.getTable(status);
- if (U_FAILURE(status)) { return; }
- for (int32_t i = 0; pluralsTable.getKeyAndValue(i, key, value); ++i) {
- int32_t index = getIndex(key, status);
- if (U_FAILURE(status)) { return; }
- if (!outArray[index].isBogus()) {
- continue;
- }
- outArray[index] = value.getUnicodeString(status);
- if (U_FAILURE(status)) { return; }
- }
- }
-
- private:
- UnicodeString *outArray;
-};
-
-// NOTE: outArray MUST have room for all StandardPlural values. No bounds checking is performed.
-
-void getMeasureData(const Locale &locale, const MeasureUnit &unit, const UNumberUnitWidth &width,
- UnicodeString *outArray, UErrorCode &status) {
- PluralTableSink sink(outArray);
- LocalUResourceBundlePointer unitsBundle(ures_open(U_ICUDATA_UNIT, locale.getName(), &status));
- if (U_FAILURE(status)) { return; }
-
- // Map duration-year-person, duration-week-person, etc. to duration-year, duration-week, ...
- // TODO(ICU-20400): Get duration-*-person data properly with aliases.
- StringPiece subtypeForResource;
- int32_t subtypeLen = static_cast<int32_t>(uprv_strlen(unit.getSubtype()));
- if (subtypeLen > 7 && uprv_strcmp(unit.getSubtype() + subtypeLen - 7, "-person") == 0) {
- subtypeForResource = {unit.getSubtype(), subtypeLen - 7};
- } else {
- subtypeForResource = unit.getSubtype();
- }
-
- CharString key;
- key.append("units", status);
- if (width == UNUM_UNIT_WIDTH_NARROW) {
- key.append("Narrow", status);
- } else if (width == UNUM_UNIT_WIDTH_SHORT) {
- key.append("Short", status);
- }
- key.append("/", status);
- key.append(unit.getType(), status);
- key.append("/", status);
- key.append(subtypeForResource, status);
-
- UErrorCode localStatus = U_ZERO_ERROR;
- ures_getAllItemsWithFallback(unitsBundle.getAlias(), key.data(), sink, localStatus);
- if (width == UNUM_UNIT_WIDTH_SHORT) {
- if (U_FAILURE(localStatus)) {
- status = localStatus;
- }
- return;
- }
-
- // TODO(ICU-13353): The fallback to short does not work in ICU4C.
- // Manually fall back to short (this is done automatically in Java).
- key.clear();
- key.append("unitsShort/", status);
- key.append(unit.getType(), status);
- key.append("/", status);
- key.append(subtypeForResource, status);
- ures_getAllItemsWithFallback(unitsBundle.getAlias(), key.data(), sink, status);
-}
-
-void getCurrencyLongNameData(const Locale &locale, const CurrencyUnit &currency, UnicodeString *outArray,
- UErrorCode &status) {
- // In ICU4J, this method gets a CurrencyData from CurrencyData.provider.
- // TODO(ICU4J): Implement this without going through CurrencyData, like in ICU4C?
- PluralTableSink sink(outArray);
- LocalUResourceBundlePointer unitsBundle(ures_open(U_ICUDATA_CURR, locale.getName(), &status));
- if (U_FAILURE(status)) { return; }
- ures_getAllItemsWithFallback(unitsBundle.getAlias(), "CurrencyUnitPatterns", sink, status);
- if (U_FAILURE(status)) { return; }
- for (int32_t i = 0; i < StandardPlural::Form::COUNT; i++) {
- UnicodeString &pattern = outArray[i];
- if (pattern.isBogus()) {
- continue;
- }
- int32_t longNameLen = 0;
- const char16_t *longName = ucurr_getPluralName(
- currency.getISOCurrency(),
- locale.getName(),
- nullptr /* isChoiceFormat */,
- StandardPlural::getKeyword(static_cast<StandardPlural::Form>(i)),
- &longNameLen,
- &status);
- // Example pattern from data: "{0} {1}"
- // Example output after find-and-replace: "{0} US dollars"
- pattern.findAndReplace(UnicodeString(u"{1}"), UnicodeString(longName, longNameLen));
- }
-}
-
-UnicodeString getPerUnitFormat(const Locale& locale, const UNumberUnitWidth &width, UErrorCode& status) {
- LocalUResourceBundlePointer unitsBundle(ures_open(U_ICUDATA_UNIT, locale.getName(), &status));
- if (U_FAILURE(status)) { return {}; }
- CharString key;
- key.append("units", status);
- if (width == UNUM_UNIT_WIDTH_NARROW) {
- key.append("Narrow", status);
- } else if (width == UNUM_UNIT_WIDTH_SHORT) {
- key.append("Short", status);
- }
- key.append("/compound/per", status);
- int32_t len = 0;
- const UChar* ptr = ures_getStringByKeyWithFallback(unitsBundle.getAlias(), key.data(), &len, &status);
- return UnicodeString(ptr, len);
-}
-
-////////////////////////
-/// END DATA LOADING ///
-////////////////////////
-
-} // namespace
-
-LongNameHandler*
-LongNameHandler::forMeasureUnit(const Locale &loc, const MeasureUnit &unitRef, const MeasureUnit &perUnit,
- const UNumberUnitWidth &width, const PluralRules *rules,
- const MicroPropsGenerator *parent, UErrorCode &status) {
- if (uprv_strlen(unitRef.getType()) == 0 || uprv_strlen(perUnit.getType()) == 0) {
- // TODO(ICU-20941): Unsanctioned unit. Not yet fully supported. Set an error code.
- status = U_UNSUPPORTED_ERROR;
- return nullptr;
- }
-
- MeasureUnit unit = unitRef;
- if (uprv_strcmp(perUnit.getType(), "none") != 0) {
- // Compound unit: first try to simplify (e.g., meters per second is its own unit).
- bool isResolved = false;
- MeasureUnit resolved = MeasureUnit::resolveUnitPerUnit(unit, perUnit, &isResolved);
- if (isResolved) {
- unit = resolved;
- } else {
- // No simplified form is available.
- return forCompoundUnit(loc, unit, perUnit, width, rules, parent, status);
- }
- }
-
- auto* result = new LongNameHandler(rules, parent);
- if (result == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
- UnicodeString simpleFormats[ARRAY_LENGTH];
- getMeasureData(loc, unit, width, simpleFormats, status);
- if (U_FAILURE(status)) { return result; }
- result->simpleFormatsToModifiers(simpleFormats, {UFIELD_CATEGORY_NUMBER, UNUM_MEASURE_UNIT_FIELD}, status);
- return result;
-}
-
-LongNameHandler*
-LongNameHandler::forCompoundUnit(const Locale &loc, const MeasureUnit &unit, const MeasureUnit &perUnit,
- const UNumberUnitWidth &width, const PluralRules *rules,
- const MicroPropsGenerator *parent, UErrorCode &status) {
- auto* result = new LongNameHandler(rules, parent);
- if (result == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
- UnicodeString primaryData[ARRAY_LENGTH];
- getMeasureData(loc, unit, width, primaryData, status);
- if (U_FAILURE(status)) { return result; }
- UnicodeString secondaryData[ARRAY_LENGTH];
- getMeasureData(loc, perUnit, width, secondaryData, status);
- if (U_FAILURE(status)) { return result; }
-
- UnicodeString perUnitFormat;
- if (!secondaryData[PER_INDEX].isBogus()) {
- perUnitFormat = secondaryData[PER_INDEX];
- } else {
- UnicodeString rawPerUnitFormat = getPerUnitFormat(loc, width, status);
- if (U_FAILURE(status)) { return result; }
- // rawPerUnitFormat is something like "{0}/{1}"; we need to substitute in the secondary unit.
- SimpleFormatter compiled(rawPerUnitFormat, 2, 2, status);
- if (U_FAILURE(status)) { return result; }
- UnicodeString secondaryFormat = getWithPlural(secondaryData, StandardPlural::Form::ONE, status);
- if (U_FAILURE(status)) { return result; }
- // Some "one" pattern may not contain "{0}". For example in "ar" or "ne" locale.
- SimpleFormatter secondaryCompiled(secondaryFormat, 0, 1, status);
- if (U_FAILURE(status)) { return result; }
- UnicodeString secondaryString = secondaryCompiled.getTextWithNoArguments().trim();
- // TODO: Why does UnicodeString need to be explicit in the following line?
- compiled.format(UnicodeString(u"{0}"), secondaryString, perUnitFormat, status);
- if (U_FAILURE(status)) { return result; }
- }
- result->multiSimpleFormatsToModifiers(primaryData, perUnitFormat, {UFIELD_CATEGORY_NUMBER, UNUM_MEASURE_UNIT_FIELD}, status);
- return result;
-}
-
-UnicodeString LongNameHandler::getUnitDisplayName(
- const Locale& loc,
- const MeasureUnit& unit,
- UNumberUnitWidth width,
- UErrorCode& status) {
- if (U_FAILURE(status)) {
- return ICU_Utility::makeBogusString();
- }
- UnicodeString simpleFormats[ARRAY_LENGTH];
- getMeasureData(loc, unit, width, simpleFormats, status);
- return simpleFormats[DNAM_INDEX];
-}
-
-UnicodeString LongNameHandler::getUnitPattern(
- const Locale& loc,
- const MeasureUnit& unit,
- UNumberUnitWidth width,
- StandardPlural::Form pluralForm,
- UErrorCode& status) {
- if (U_FAILURE(status)) {
- return ICU_Utility::makeBogusString();
- }
- UnicodeString simpleFormats[ARRAY_LENGTH];
- getMeasureData(loc, unit, width, simpleFormats, status);
- // The above already handles fallback from other widths to short
- if (U_FAILURE(status)) {
- return ICU_Utility::makeBogusString();
- }
- // Now handle fallback from other plural forms to OTHER
- return (!(simpleFormats[pluralForm]).isBogus())? simpleFormats[pluralForm]:
- simpleFormats[StandardPlural::Form::OTHER];
-}
-
-LongNameHandler* LongNameHandler::forCurrencyLongNames(const Locale &loc, const CurrencyUnit &currency,
- const PluralRules *rules,
- const MicroPropsGenerator *parent,
- UErrorCode &status) {
- auto* result = new LongNameHandler(rules, parent);
- if (result == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
- UnicodeString simpleFormats[ARRAY_LENGTH];
- getCurrencyLongNameData(loc, currency, simpleFormats, status);
- if (U_FAILURE(status)) { return nullptr; }
- result->simpleFormatsToModifiers(simpleFormats, {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD}, status);
- return result;
-}
-
-void LongNameHandler::simpleFormatsToModifiers(const UnicodeString *simpleFormats, Field field,
- UErrorCode &status) {
- for (int32_t i = 0; i < StandardPlural::Form::COUNT; i++) {
- StandardPlural::Form plural = static_cast<StandardPlural::Form>(i);
- UnicodeString simpleFormat = getWithPlural(simpleFormats, plural, status);
- if (U_FAILURE(status)) { return; }
- SimpleFormatter compiledFormatter(simpleFormat, 0, 1, status);
- if (U_FAILURE(status)) { return; }
- fModifiers[i] = SimpleModifier(compiledFormatter, field, false, {this, SIGNUM_POS_ZERO, plural});
- }
-}
-
-void LongNameHandler::multiSimpleFormatsToModifiers(const UnicodeString *leadFormats, UnicodeString trailFormat,
- Field field, UErrorCode &status) {
- SimpleFormatter trailCompiled(trailFormat, 1, 1, status);
- if (U_FAILURE(status)) { return; }
- for (int32_t i = 0; i < StandardPlural::Form::COUNT; i++) {
- StandardPlural::Form plural = static_cast<StandardPlural::Form>(i);
- UnicodeString leadFormat = getWithPlural(leadFormats, plural, status);
- if (U_FAILURE(status)) { return; }
- UnicodeString compoundFormat;
- trailCompiled.format(leadFormat, compoundFormat, status);
- if (U_FAILURE(status)) { return; }
- SimpleFormatter compoundCompiled(compoundFormat, 0, 1, status);
- if (U_FAILURE(status)) { return; }
- fModifiers[i] = SimpleModifier(compoundCompiled, field, false, {this, SIGNUM_POS_ZERO, plural});
- }
-}
-
-void LongNameHandler::processQuantity(DecimalQuantity &quantity, MicroProps &micros,
- UErrorCode &status) const {
- parent->processQuantity(quantity, micros, status);
- StandardPlural::Form pluralForm = utils::getPluralSafe(micros.rounder, rules, quantity, status);
- micros.modOuter = &fModifiers[pluralForm];
-}
-
-const Modifier* LongNameHandler::getModifier(Signum /*signum*/, StandardPlural::Form plural) const {
- return &fModifiers[plural];
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/simpleformatter.h"
+#include "unicode/ures.h"
+#include "ureslocs.h"
+#include "charstr.h"
+#include "uresimp.h"
+#include "number_longnames.h"
+#include "number_microprops.h"
+#include <algorithm>
+#include "cstring.h"
+#include "util.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+namespace {
+
+constexpr int32_t DNAM_INDEX = StandardPlural::Form::COUNT;
+constexpr int32_t PER_INDEX = StandardPlural::Form::COUNT + 1;
+constexpr int32_t ARRAY_LENGTH = StandardPlural::Form::COUNT + 2;
+
+static int32_t getIndex(const char* pluralKeyword, UErrorCode& status) {
+ // pluralKeyword can also be "dnam" or "per"
+ if (uprv_strcmp(pluralKeyword, "dnam") == 0) {
+ return DNAM_INDEX;
+ } else if (uprv_strcmp(pluralKeyword, "per") == 0) {
+ return PER_INDEX;
+ } else {
+ StandardPlural::Form plural = StandardPlural::fromString(pluralKeyword, status);
+ return plural;
+ }
+}
+
+static UnicodeString getWithPlural(
+ const UnicodeString* strings,
+ StandardPlural::Form plural,
+ UErrorCode& status) {
+ UnicodeString result = strings[plural];
+ if (result.isBogus()) {
+ result = strings[StandardPlural::Form::OTHER];
+ }
+ if (result.isBogus()) {
+ // There should always be data in the "other" plural variant.
+ status = U_INTERNAL_PROGRAM_ERROR;
+ }
+ return result;
+}
+
+
+//////////////////////////
+/// BEGIN DATA LOADING ///
+//////////////////////////
+
+class PluralTableSink : public ResourceSink {
+ public:
+ explicit PluralTableSink(UnicodeString *outArray) : outArray(outArray) {
+ // Initialize the array to bogus strings.
+ for (int32_t i = 0; i < ARRAY_LENGTH; i++) {
+ outArray[i].setToBogus();
+ }
+ }
+
+ void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) U_OVERRIDE {
+ ResourceTable pluralsTable = value.getTable(status);
+ if (U_FAILURE(status)) { return; }
+ for (int32_t i = 0; pluralsTable.getKeyAndValue(i, key, value); ++i) {
+ int32_t index = getIndex(key, status);
+ if (U_FAILURE(status)) { return; }
+ if (!outArray[index].isBogus()) {
+ continue;
+ }
+ outArray[index] = value.getUnicodeString(status);
+ if (U_FAILURE(status)) { return; }
+ }
+ }
+
+ private:
+ UnicodeString *outArray;
+};
+
+// NOTE: outArray MUST have room for all StandardPlural values. No bounds checking is performed.
+
+void getMeasureData(const Locale &locale, const MeasureUnit &unit, const UNumberUnitWidth &width,
+ UnicodeString *outArray, UErrorCode &status) {
+ PluralTableSink sink(outArray);
+ LocalUResourceBundlePointer unitsBundle(ures_open(U_ICUDATA_UNIT, locale.getName(), &status));
+ if (U_FAILURE(status)) { return; }
+
+ // Map duration-year-person, duration-week-person, etc. to duration-year, duration-week, ...
+ // TODO(ICU-20400): Get duration-*-person data properly with aliases.
+ StringPiece subtypeForResource;
+ int32_t subtypeLen = static_cast<int32_t>(uprv_strlen(unit.getSubtype()));
+ if (subtypeLen > 7 && uprv_strcmp(unit.getSubtype() + subtypeLen - 7, "-person") == 0) {
+ subtypeForResource = {unit.getSubtype(), subtypeLen - 7};
+ } else {
+ subtypeForResource = unit.getSubtype();
+ }
+
+ CharString key;
+ key.append("units", status);
+ if (width == UNUM_UNIT_WIDTH_NARROW) {
+ key.append("Narrow", status);
+ } else if (width == UNUM_UNIT_WIDTH_SHORT) {
+ key.append("Short", status);
+ }
+ key.append("/", status);
+ key.append(unit.getType(), status);
+ key.append("/", status);
+ key.append(subtypeForResource, status);
+
+ UErrorCode localStatus = U_ZERO_ERROR;
+ ures_getAllItemsWithFallback(unitsBundle.getAlias(), key.data(), sink, localStatus);
+ if (width == UNUM_UNIT_WIDTH_SHORT) {
+ if (U_FAILURE(localStatus)) {
+ status = localStatus;
+ }
+ return;
+ }
+
+ // TODO(ICU-13353): The fallback to short does not work in ICU4C.
+ // Manually fall back to short (this is done automatically in Java).
+ key.clear();
+ key.append("unitsShort/", status);
+ key.append(unit.getType(), status);
+ key.append("/", status);
+ key.append(subtypeForResource, status);
+ ures_getAllItemsWithFallback(unitsBundle.getAlias(), key.data(), sink, status);
+}
+
+void getCurrencyLongNameData(const Locale &locale, const CurrencyUnit &currency, UnicodeString *outArray,
+ UErrorCode &status) {
+ // In ICU4J, this method gets a CurrencyData from CurrencyData.provider.
+ // TODO(ICU4J): Implement this without going through CurrencyData, like in ICU4C?
+ PluralTableSink sink(outArray);
+ LocalUResourceBundlePointer unitsBundle(ures_open(U_ICUDATA_CURR, locale.getName(), &status));
+ if (U_FAILURE(status)) { return; }
+ ures_getAllItemsWithFallback(unitsBundle.getAlias(), "CurrencyUnitPatterns", sink, status);
+ if (U_FAILURE(status)) { return; }
+ for (int32_t i = 0; i < StandardPlural::Form::COUNT; i++) {
+ UnicodeString &pattern = outArray[i];
+ if (pattern.isBogus()) {
+ continue;
+ }
+ int32_t longNameLen = 0;
+ const char16_t *longName = ucurr_getPluralName(
+ currency.getISOCurrency(),
+ locale.getName(),
+ nullptr /* isChoiceFormat */,
+ StandardPlural::getKeyword(static_cast<StandardPlural::Form>(i)),
+ &longNameLen,
+ &status);
+ // Example pattern from data: "{0} {1}"
+ // Example output after find-and-replace: "{0} US dollars"
+ pattern.findAndReplace(UnicodeString(u"{1}"), UnicodeString(longName, longNameLen));
+ }
+}
+
+UnicodeString getPerUnitFormat(const Locale& locale, const UNumberUnitWidth &width, UErrorCode& status) {
+ LocalUResourceBundlePointer unitsBundle(ures_open(U_ICUDATA_UNIT, locale.getName(), &status));
+ if (U_FAILURE(status)) { return {}; }
+ CharString key;
+ key.append("units", status);
+ if (width == UNUM_UNIT_WIDTH_NARROW) {
+ key.append("Narrow", status);
+ } else if (width == UNUM_UNIT_WIDTH_SHORT) {
+ key.append("Short", status);
+ }
+ key.append("/compound/per", status);
+ int32_t len = 0;
+ const UChar* ptr = ures_getStringByKeyWithFallback(unitsBundle.getAlias(), key.data(), &len, &status);
+ return UnicodeString(ptr, len);
+}
+
+////////////////////////
+/// END DATA LOADING ///
+////////////////////////
+
+} // namespace
+
+LongNameHandler*
+LongNameHandler::forMeasureUnit(const Locale &loc, const MeasureUnit &unitRef, const MeasureUnit &perUnit,
+ const UNumberUnitWidth &width, const PluralRules *rules,
+ const MicroPropsGenerator *parent, UErrorCode &status) {
+ if (uprv_strlen(unitRef.getType()) == 0 || uprv_strlen(perUnit.getType()) == 0) {
+ // TODO(ICU-20941): Unsanctioned unit. Not yet fully supported. Set an error code.
+ status = U_UNSUPPORTED_ERROR;
+ return nullptr;
+ }
+
+ MeasureUnit unit = unitRef;
+ if (uprv_strcmp(perUnit.getType(), "none") != 0) {
+ // Compound unit: first try to simplify (e.g., meters per second is its own unit).
+ bool isResolved = false;
+ MeasureUnit resolved = MeasureUnit::resolveUnitPerUnit(unit, perUnit, &isResolved);
+ if (isResolved) {
+ unit = resolved;
+ } else {
+ // No simplified form is available.
+ return forCompoundUnit(loc, unit, perUnit, width, rules, parent, status);
+ }
+ }
+
+ auto* result = new LongNameHandler(rules, parent);
+ if (result == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+ UnicodeString simpleFormats[ARRAY_LENGTH];
+ getMeasureData(loc, unit, width, simpleFormats, status);
+ if (U_FAILURE(status)) { return result; }
+ result->simpleFormatsToModifiers(simpleFormats, {UFIELD_CATEGORY_NUMBER, UNUM_MEASURE_UNIT_FIELD}, status);
+ return result;
+}
+
+LongNameHandler*
+LongNameHandler::forCompoundUnit(const Locale &loc, const MeasureUnit &unit, const MeasureUnit &perUnit,
+ const UNumberUnitWidth &width, const PluralRules *rules,
+ const MicroPropsGenerator *parent, UErrorCode &status) {
+ auto* result = new LongNameHandler(rules, parent);
+ if (result == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+ UnicodeString primaryData[ARRAY_LENGTH];
+ getMeasureData(loc, unit, width, primaryData, status);
+ if (U_FAILURE(status)) { return result; }
+ UnicodeString secondaryData[ARRAY_LENGTH];
+ getMeasureData(loc, perUnit, width, secondaryData, status);
+ if (U_FAILURE(status)) { return result; }
+
+ UnicodeString perUnitFormat;
+ if (!secondaryData[PER_INDEX].isBogus()) {
+ perUnitFormat = secondaryData[PER_INDEX];
+ } else {
+ UnicodeString rawPerUnitFormat = getPerUnitFormat(loc, width, status);
+ if (U_FAILURE(status)) { return result; }
+ // rawPerUnitFormat is something like "{0}/{1}"; we need to substitute in the secondary unit.
+ SimpleFormatter compiled(rawPerUnitFormat, 2, 2, status);
+ if (U_FAILURE(status)) { return result; }
+ UnicodeString secondaryFormat = getWithPlural(secondaryData, StandardPlural::Form::ONE, status);
+ if (U_FAILURE(status)) { return result; }
+ // Some "one" pattern may not contain "{0}". For example in "ar" or "ne" locale.
+ SimpleFormatter secondaryCompiled(secondaryFormat, 0, 1, status);
+ if (U_FAILURE(status)) { return result; }
+ UnicodeString secondaryString = secondaryCompiled.getTextWithNoArguments().trim();
+ // TODO: Why does UnicodeString need to be explicit in the following line?
+ compiled.format(UnicodeString(u"{0}"), secondaryString, perUnitFormat, status);
+ if (U_FAILURE(status)) { return result; }
+ }
+ result->multiSimpleFormatsToModifiers(primaryData, perUnitFormat, {UFIELD_CATEGORY_NUMBER, UNUM_MEASURE_UNIT_FIELD}, status);
+ return result;
+}
+
+UnicodeString LongNameHandler::getUnitDisplayName(
+ const Locale& loc,
+ const MeasureUnit& unit,
+ UNumberUnitWidth width,
+ UErrorCode& status) {
+ if (U_FAILURE(status)) {
+ return ICU_Utility::makeBogusString();
+ }
+ UnicodeString simpleFormats[ARRAY_LENGTH];
+ getMeasureData(loc, unit, width, simpleFormats, status);
+ return simpleFormats[DNAM_INDEX];
+}
+
+UnicodeString LongNameHandler::getUnitPattern(
+ const Locale& loc,
+ const MeasureUnit& unit,
+ UNumberUnitWidth width,
+ StandardPlural::Form pluralForm,
+ UErrorCode& status) {
+ if (U_FAILURE(status)) {
+ return ICU_Utility::makeBogusString();
+ }
+ UnicodeString simpleFormats[ARRAY_LENGTH];
+ getMeasureData(loc, unit, width, simpleFormats, status);
+ // The above already handles fallback from other widths to short
+ if (U_FAILURE(status)) {
+ return ICU_Utility::makeBogusString();
+ }
+ // Now handle fallback from other plural forms to OTHER
+ return (!(simpleFormats[pluralForm]).isBogus())? simpleFormats[pluralForm]:
+ simpleFormats[StandardPlural::Form::OTHER];
+}
+
+LongNameHandler* LongNameHandler::forCurrencyLongNames(const Locale &loc, const CurrencyUnit &currency,
+ const PluralRules *rules,
+ const MicroPropsGenerator *parent,
+ UErrorCode &status) {
+ auto* result = new LongNameHandler(rules, parent);
+ if (result == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+ UnicodeString simpleFormats[ARRAY_LENGTH];
+ getCurrencyLongNameData(loc, currency, simpleFormats, status);
+ if (U_FAILURE(status)) { return nullptr; }
+ result->simpleFormatsToModifiers(simpleFormats, {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD}, status);
+ return result;
+}
+
+void LongNameHandler::simpleFormatsToModifiers(const UnicodeString *simpleFormats, Field field,
+ UErrorCode &status) {
+ for (int32_t i = 0; i < StandardPlural::Form::COUNT; i++) {
+ StandardPlural::Form plural = static_cast<StandardPlural::Form>(i);
+ UnicodeString simpleFormat = getWithPlural(simpleFormats, plural, status);
+ if (U_FAILURE(status)) { return; }
+ SimpleFormatter compiledFormatter(simpleFormat, 0, 1, status);
+ if (U_FAILURE(status)) { return; }
+ fModifiers[i] = SimpleModifier(compiledFormatter, field, false, {this, SIGNUM_POS_ZERO, plural});
+ }
+}
+
+void LongNameHandler::multiSimpleFormatsToModifiers(const UnicodeString *leadFormats, UnicodeString trailFormat,
+ Field field, UErrorCode &status) {
+ SimpleFormatter trailCompiled(trailFormat, 1, 1, status);
+ if (U_FAILURE(status)) { return; }
+ for (int32_t i = 0; i < StandardPlural::Form::COUNT; i++) {
+ StandardPlural::Form plural = static_cast<StandardPlural::Form>(i);
+ UnicodeString leadFormat = getWithPlural(leadFormats, plural, status);
+ if (U_FAILURE(status)) { return; }
+ UnicodeString compoundFormat;
+ trailCompiled.format(leadFormat, compoundFormat, status);
+ if (U_FAILURE(status)) { return; }
+ SimpleFormatter compoundCompiled(compoundFormat, 0, 1, status);
+ if (U_FAILURE(status)) { return; }
+ fModifiers[i] = SimpleModifier(compoundCompiled, field, false, {this, SIGNUM_POS_ZERO, plural});
+ }
+}
+
+void LongNameHandler::processQuantity(DecimalQuantity &quantity, MicroProps &micros,
+ UErrorCode &status) const {
+ parent->processQuantity(quantity, micros, status);
+ StandardPlural::Form pluralForm = utils::getPluralSafe(micros.rounder, rules, quantity, status);
+ micros.modOuter = &fModifiers[pluralForm];
+}
+
+const Modifier* LongNameHandler::getModifier(Signum /*signum*/, StandardPlural::Form plural) const {
+ return &fModifiers[plural];
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_longnames.h b/contrib/libs/icu/i18n/number_longnames.h
index 1800b875db..a19425aa26 100644
--- a/contrib/libs/icu/i18n/number_longnames.h
+++ b/contrib/libs/icu/i18n/number_longnames.h
@@ -1,70 +1,70 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMBER_LONGNAMES_H__
-#define __NUMBER_LONGNAMES_H__
-
-#include "unicode/uversion.h"
-#include "number_utils.h"
-#include "number_modifiers.h"
-
-U_NAMESPACE_BEGIN namespace number {
-namespace impl {
-
-class LongNameHandler : public MicroPropsGenerator, public ModifierStore, public UMemory {
- public:
- static UnicodeString getUnitDisplayName(
- const Locale& loc,
- const MeasureUnit& unit,
- UNumberUnitWidth width,
- UErrorCode& status);
-
- static UnicodeString getUnitPattern(
- const Locale& loc,
- const MeasureUnit& unit,
- UNumberUnitWidth width,
- StandardPlural::Form pluralForm,
- UErrorCode& status);
-
- static LongNameHandler*
- forCurrencyLongNames(const Locale &loc, const CurrencyUnit &currency, const PluralRules *rules,
- const MicroPropsGenerator *parent, UErrorCode &status);
-
- static LongNameHandler*
- forMeasureUnit(const Locale &loc, const MeasureUnit &unit, const MeasureUnit &perUnit,
- const UNumberUnitWidth &width, const PluralRules *rules,
- const MicroPropsGenerator *parent, UErrorCode &status);
-
- void
- processQuantity(DecimalQuantity &quantity, MicroProps &micros, UErrorCode &status) const U_OVERRIDE;
-
- const Modifier* getModifier(Signum signum, StandardPlural::Form plural) const U_OVERRIDE;
-
- private:
- SimpleModifier fModifiers[StandardPlural::Form::COUNT];
- const PluralRules *rules;
- const MicroPropsGenerator *parent;
-
- LongNameHandler(const PluralRules *rules, const MicroPropsGenerator *parent)
- : rules(rules), parent(parent) {}
-
- static LongNameHandler*
- forCompoundUnit(const Locale &loc, const MeasureUnit &unit, const MeasureUnit &perUnit,
- const UNumberUnitWidth &width, const PluralRules *rules,
- const MicroPropsGenerator *parent, UErrorCode &status);
-
- void simpleFormatsToModifiers(const UnicodeString *simpleFormats, Field field, UErrorCode &status);
- void multiSimpleFormatsToModifiers(const UnicodeString *leadFormats, UnicodeString trailFormat,
- Field field, UErrorCode &status);
-};
-
-} // namespace impl
-} // namespace number
-U_NAMESPACE_END
-
-#endif //__NUMBER_LONGNAMES_H__
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMBER_LONGNAMES_H__
+#define __NUMBER_LONGNAMES_H__
+
+#include "unicode/uversion.h"
+#include "number_utils.h"
+#include "number_modifiers.h"
+
+U_NAMESPACE_BEGIN namespace number {
+namespace impl {
+
+class LongNameHandler : public MicroPropsGenerator, public ModifierStore, public UMemory {
+ public:
+ static UnicodeString getUnitDisplayName(
+ const Locale& loc,
+ const MeasureUnit& unit,
+ UNumberUnitWidth width,
+ UErrorCode& status);
+
+ static UnicodeString getUnitPattern(
+ const Locale& loc,
+ const MeasureUnit& unit,
+ UNumberUnitWidth width,
+ StandardPlural::Form pluralForm,
+ UErrorCode& status);
+
+ static LongNameHandler*
+ forCurrencyLongNames(const Locale &loc, const CurrencyUnit &currency, const PluralRules *rules,
+ const MicroPropsGenerator *parent, UErrorCode &status);
+
+ static LongNameHandler*
+ forMeasureUnit(const Locale &loc, const MeasureUnit &unit, const MeasureUnit &perUnit,
+ const UNumberUnitWidth &width, const PluralRules *rules,
+ const MicroPropsGenerator *parent, UErrorCode &status);
+
+ void
+ processQuantity(DecimalQuantity &quantity, MicroProps &micros, UErrorCode &status) const U_OVERRIDE;
+
+ const Modifier* getModifier(Signum signum, StandardPlural::Form plural) const U_OVERRIDE;
+
+ private:
+ SimpleModifier fModifiers[StandardPlural::Form::COUNT];
+ const PluralRules *rules;
+ const MicroPropsGenerator *parent;
+
+ LongNameHandler(const PluralRules *rules, const MicroPropsGenerator *parent)
+ : rules(rules), parent(parent) {}
+
+ static LongNameHandler*
+ forCompoundUnit(const Locale &loc, const MeasureUnit &unit, const MeasureUnit &perUnit,
+ const UNumberUnitWidth &width, const PluralRules *rules,
+ const MicroPropsGenerator *parent, UErrorCode &status);
+
+ void simpleFormatsToModifiers(const UnicodeString *simpleFormats, Field field, UErrorCode &status);
+ void multiSimpleFormatsToModifiers(const UnicodeString *leadFormats, UnicodeString trailFormat,
+ Field field, UErrorCode &status);
+};
+
+} // namespace impl
+} // namespace number
+U_NAMESPACE_END
+
+#endif //__NUMBER_LONGNAMES_H__
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_mapper.cpp b/contrib/libs/icu/i18n/number_mapper.cpp
index e089f9c372..ec617438c9 100644
--- a/contrib/libs/icu/i18n/number_mapper.cpp
+++ b/contrib/libs/icu/i18n/number_mapper.cpp
@@ -1,508 +1,508 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include "number_mapper.h"
-#include "number_patternstring.h"
-#include "unicode/errorcode.h"
-#include "number_utils.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-
-UnlocalizedNumberFormatter NumberPropertyMapper::create(const DecimalFormatProperties& properties,
- const DecimalFormatSymbols& symbols,
- DecimalFormatWarehouse& warehouse,
- UErrorCode& status) {
- return NumberFormatter::with().macros(oldToNew(properties, symbols, warehouse, nullptr, status));
-}
-
-UnlocalizedNumberFormatter NumberPropertyMapper::create(const DecimalFormatProperties& properties,
- const DecimalFormatSymbols& symbols,
- DecimalFormatWarehouse& warehouse,
- DecimalFormatProperties& exportedProperties,
- UErrorCode& status) {
- return NumberFormatter::with().macros(
- oldToNew(
- properties, symbols, warehouse, &exportedProperties, status));
-}
-
-MacroProps NumberPropertyMapper::oldToNew(const DecimalFormatProperties& properties,
- const DecimalFormatSymbols& symbols,
- DecimalFormatWarehouse& warehouse,
- DecimalFormatProperties* exportedProperties,
- UErrorCode& status) {
- MacroProps macros;
- Locale locale = symbols.getLocale();
-
- /////////////
- // SYMBOLS //
- /////////////
-
- macros.symbols.setTo(symbols);
-
- //////////////////
- // PLURAL RULES //
- //////////////////
-
- if (!properties.currencyPluralInfo.fPtr.isNull()) {
- macros.rules = properties.currencyPluralInfo.fPtr->getPluralRules();
- }
-
- /////////////
- // AFFIXES //
- /////////////
-
- warehouse.affixProvider.setTo(properties, status);
- macros.affixProvider = &warehouse.affixProvider.get();
-
- ///////////
- // UNITS //
- ///////////
-
- bool useCurrency = (
- !properties.currency.isNull() ||
- !properties.currencyPluralInfo.fPtr.isNull() ||
- !properties.currencyUsage.isNull() ||
- warehouse.affixProvider.get().hasCurrencySign());
- CurrencyUnit currency = resolveCurrency(properties, locale, status);
- UCurrencyUsage currencyUsage = properties.currencyUsage.getOrDefault(UCURR_USAGE_STANDARD);
- if (useCurrency) {
- // NOTE: Slicing is OK.
- macros.unit = currency; // NOLINT
- }
-
- ///////////////////////
- // ROUNDING STRATEGY //
- ///////////////////////
-
- int32_t maxInt = properties.maximumIntegerDigits;
- int32_t minInt = properties.minimumIntegerDigits;
- int32_t maxFrac = properties.maximumFractionDigits;
- int32_t minFrac = properties.minimumFractionDigits;
- int32_t minSig = properties.minimumSignificantDigits;
- int32_t maxSig = properties.maximumSignificantDigits;
- double roundingIncrement = properties.roundingIncrement;
- RoundingMode roundingMode = properties.roundingMode.getOrDefault(UNUM_ROUND_HALFEVEN);
- bool explicitMinMaxFrac = minFrac != -1 || maxFrac != -1;
- bool explicitMinMaxSig = minSig != -1 || maxSig != -1;
- // Resolve min/max frac for currencies, required for the validation logic and for when minFrac or
- // maxFrac was
- // set (but not both) on a currency instance.
- // NOTE: Increments are handled in "Precision.constructCurrency()".
- if (useCurrency && (minFrac == -1 || maxFrac == -1)) {
- int32_t digits = ucurr_getDefaultFractionDigitsForUsage(
- currency.getISOCurrency(), currencyUsage, &status);
- if (minFrac == -1 && maxFrac == -1) {
- minFrac = digits;
- maxFrac = digits;
- } else if (minFrac == -1) {
- minFrac = std::min(maxFrac, digits);
- } else /* if (maxFrac == -1) */ {
- maxFrac = std::max(minFrac, digits);
- }
- }
- // Validate min/max int/frac.
- // For backwards compatibility, minimum overrides maximum if the two conflict.
- if (minInt == 0 && maxFrac != 0) {
- minFrac = (minFrac < 0 || (minFrac == 0 && maxInt == 0)) ? 1 : minFrac;
- maxFrac = maxFrac < 0 ? -1 : maxFrac < minFrac ? minFrac : maxFrac;
- minInt = 0;
- maxInt = maxInt < 0 ? -1 : maxInt > kMaxIntFracSig ? -1 : maxInt;
- } else {
- // Force a digit before the decimal point.
- minFrac = minFrac < 0 ? 0 : minFrac;
- maxFrac = maxFrac < 0 ? -1 : maxFrac < minFrac ? minFrac : maxFrac;
- minInt = minInt <= 0 ? 1 : minInt > kMaxIntFracSig ? 1 : minInt;
- maxInt = maxInt < 0 ? -1 : maxInt < minInt ? minInt : maxInt > kMaxIntFracSig ? -1 : maxInt;
- }
- Precision precision;
- if (!properties.currencyUsage.isNull()) {
- precision = Precision::constructCurrency(currencyUsage).withCurrency(currency);
- } else if (roundingIncrement != 0.0) {
- if (PatternStringUtils::ignoreRoundingIncrement(roundingIncrement, maxFrac)) {
- precision = Precision::constructFraction(minFrac, maxFrac);
- } else {
- precision = Precision::constructIncrement(roundingIncrement, minFrac);
- }
- } else if (explicitMinMaxSig) {
- minSig = minSig < 1 ? 1 : minSig > kMaxIntFracSig ? kMaxIntFracSig : minSig;
- maxSig = maxSig < 0 ? kMaxIntFracSig : maxSig < minSig ? minSig : maxSig > kMaxIntFracSig
- ? kMaxIntFracSig : maxSig;
- precision = Precision::constructSignificant(minSig, maxSig);
- } else if (explicitMinMaxFrac) {
- precision = Precision::constructFraction(minFrac, maxFrac);
- } else if (useCurrency) {
- precision = Precision::constructCurrency(currencyUsage);
- }
- if (!precision.isBogus()) {
- precision.fRoundingMode = roundingMode;
- macros.precision = precision;
- }
-
- ///////////////////
- // INTEGER WIDTH //
- ///////////////////
-
- macros.integerWidth = IntegerWidth(
- static_cast<digits_t>(minInt),
- static_cast<digits_t>(maxInt),
- properties.formatFailIfMoreThanMaxDigits);
-
- ///////////////////////
- // GROUPING STRATEGY //
- ///////////////////////
-
- macros.grouper = Grouper::forProperties(properties);
-
- /////////////
- // PADDING //
- /////////////
-
- if (properties.formatWidth > 0) {
- macros.padder = Padder::forProperties(properties);
- }
-
- ///////////////////////////////
- // DECIMAL MARK ALWAYS SHOWN //
- ///////////////////////////////
-
- macros.decimal = properties.decimalSeparatorAlwaysShown ? UNUM_DECIMAL_SEPARATOR_ALWAYS
- : UNUM_DECIMAL_SEPARATOR_AUTO;
-
- ///////////////////////
- // SIGN ALWAYS SHOWN //
- ///////////////////////
-
- macros.sign = properties.signAlwaysShown ? UNUM_SIGN_ALWAYS : UNUM_SIGN_AUTO;
-
- /////////////////////////
- // SCIENTIFIC NOTATION //
- /////////////////////////
-
- if (properties.minimumExponentDigits != -1) {
- // Scientific notation is required.
- // This whole section feels like a hack, but it is needed for regression tests.
- // The mapping from property bag to scientific notation is nontrivial due to LDML rules.
- if (maxInt > 8) {
- // But #13110: The maximum of 8 digits has unknown origins and is not in the spec.
- // If maxInt is greater than 8, it is set to minInt, even if minInt is greater than 8.
- maxInt = minInt;
- macros.integerWidth = IntegerWidth::zeroFillTo(minInt).truncateAt(maxInt);
- } else if (maxInt > minInt && minInt > 1) {
- // Bug #13289: if maxInt > minInt > 1, then minInt should be 1.
- minInt = 1;
- macros.integerWidth = IntegerWidth::zeroFillTo(minInt).truncateAt(maxInt);
- }
- int engineering = maxInt < 0 ? -1 : maxInt;
- macros.notation = ScientificNotation(
- // Engineering interval:
- static_cast<int8_t>(engineering),
- // Enforce minimum integer digits (for patterns like "000.00E0"):
- (engineering == minInt),
- // Minimum exponent digits:
- static_cast<digits_t>(properties.minimumExponentDigits),
- // Exponent sign always shown:
- properties.exponentSignAlwaysShown ? UNUM_SIGN_ALWAYS : UNUM_SIGN_AUTO);
- // Scientific notation also involves overriding the rounding mode.
- // TODO: Overriding here is a bit of a hack. Should this logic go earlier?
- if (macros.precision.fType == Precision::PrecisionType::RND_FRACTION) {
- // For the purposes of rounding, get the original min/max int/frac, since the local
- // variables have been manipulated for display purposes.
- int maxInt_ = properties.maximumIntegerDigits;
- int minInt_ = properties.minimumIntegerDigits;
- int minFrac_ = properties.minimumFractionDigits;
- int maxFrac_ = properties.maximumFractionDigits;
- if (minInt_ == 0 && maxFrac_ == 0) {
- // Patterns like "#E0" and "##E0", which mean no rounding!
- macros.precision = Precision::unlimited();
- } else if (minInt_ == 0 && minFrac_ == 0) {
- // Patterns like "#.##E0" (no zeros in the mantissa), which mean round to maxFrac+1
- macros.precision = Precision::constructSignificant(1, maxFrac_ + 1);
- } else {
- int maxSig_ = minInt_ + maxFrac_;
- // Bug #20058: if maxInt_ > minInt_ > 1, then minInt_ should be 1.
- if (maxInt_ > minInt_ && minInt_ > 1) {
- minInt_ = 1;
- }
- int minSig_ = minInt_ + minFrac_;
- // To avoid regression, maxSig is not reset when minInt_ set to 1.
- // TODO: Reset maxSig_ = 1 + minFrac_ to follow the spec.
- macros.precision = Precision::constructSignificant(minSig_, maxSig_);
- }
- macros.precision.fRoundingMode = roundingMode;
- }
- }
-
- //////////////////////
- // COMPACT NOTATION //
- //////////////////////
-
- if (!properties.compactStyle.isNull()) {
- if (properties.compactStyle.getNoError() == UNumberCompactStyle::UNUM_LONG) {
- macros.notation = Notation::compactLong();
- } else {
- macros.notation = Notation::compactShort();
- }
- // Do not forward the affix provider.
- macros.affixProvider = nullptr;
- }
-
- /////////////////
- // MULTIPLIERS //
- /////////////////
-
- macros.scale = scaleFromProperties(properties);
-
- //////////////////////
- // PROPERTY EXPORTS //
- //////////////////////
-
- if (exportedProperties != nullptr) {
-
- exportedProperties->currency = currency;
- exportedProperties->roundingMode = roundingMode;
- exportedProperties->minimumIntegerDigits = minInt;
- exportedProperties->maximumIntegerDigits = maxInt == -1 ? INT32_MAX : maxInt;
-
- Precision rounding_;
- if (precision.fType == Precision::PrecisionType::RND_CURRENCY) {
- rounding_ = precision.withCurrency(currency, status);
- } else {
- rounding_ = precision;
- }
- int minFrac_ = minFrac;
- int maxFrac_ = maxFrac;
- int minSig_ = minSig;
- int maxSig_ = maxSig;
- double increment_ = 0.0;
- if (rounding_.fType == Precision::PrecisionType::RND_FRACTION) {
- minFrac_ = rounding_.fUnion.fracSig.fMinFrac;
- maxFrac_ = rounding_.fUnion.fracSig.fMaxFrac;
- } else if (rounding_.fType == Precision::PrecisionType::RND_INCREMENT
- || rounding_.fType == Precision::PrecisionType::RND_INCREMENT_ONE
- || rounding_.fType == Precision::PrecisionType::RND_INCREMENT_FIVE) {
- increment_ = rounding_.fUnion.increment.fIncrement;
- minFrac_ = rounding_.fUnion.increment.fMinFrac;
- maxFrac_ = rounding_.fUnion.increment.fMinFrac;
- } else if (rounding_.fType == Precision::PrecisionType::RND_SIGNIFICANT) {
- minSig_ = rounding_.fUnion.fracSig.fMinSig;
- maxSig_ = rounding_.fUnion.fracSig.fMaxSig;
- }
-
- exportedProperties->minimumFractionDigits = minFrac_;
- exportedProperties->maximumFractionDigits = maxFrac_;
- exportedProperties->minimumSignificantDigits = minSig_;
- exportedProperties->maximumSignificantDigits = maxSig_;
- exportedProperties->roundingIncrement = increment_;
- }
-
- return macros;
-}
-
-
-void PropertiesAffixPatternProvider::setTo(const DecimalFormatProperties& properties, UErrorCode& status) {
- fBogus = false;
-
- // There are two ways to set affixes in DecimalFormat: via the pattern string (applyPattern), and via the
- // explicit setters (setPositivePrefix and friends). The way to resolve the settings is as follows:
- //
- // 1) If the explicit setting is present for the field, use it.
- // 2) Otherwise, follows UTS 35 rules based on the pattern string.
- //
- // Importantly, the explicit setters affect only the one field they override. If you set the positive
- // prefix, that should not affect the negative prefix.
-
- // Convenience: Extract the properties into local variables.
- // Variables are named with three chars: [p/n][p/s][o/p]
- // [p/n] => p for positive, n for negative
- // [p/s] => p for prefix, s for suffix
- // [o/p] => o for escaped custom override string, p for pattern string
- UnicodeString ppo = AffixUtils::escape(properties.positivePrefix);
- UnicodeString pso = AffixUtils::escape(properties.positiveSuffix);
- UnicodeString npo = AffixUtils::escape(properties.negativePrefix);
- UnicodeString nso = AffixUtils::escape(properties.negativeSuffix);
- const UnicodeString& ppp = properties.positivePrefixPattern;
- const UnicodeString& psp = properties.positiveSuffixPattern;
- const UnicodeString& npp = properties.negativePrefixPattern;
- const UnicodeString& nsp = properties.negativeSuffixPattern;
-
- if (!properties.positivePrefix.isBogus()) {
- posPrefix = ppo;
- } else if (!ppp.isBogus()) {
- posPrefix = ppp;
- } else {
- // UTS 35: Default positive prefix is empty string.
- posPrefix = u"";
- }
-
- if (!properties.positiveSuffix.isBogus()) {
- posSuffix = pso;
- } else if (!psp.isBogus()) {
- posSuffix = psp;
- } else {
- // UTS 35: Default positive suffix is empty string.
- posSuffix = u"";
- }
-
- if (!properties.negativePrefix.isBogus()) {
- negPrefix = npo;
- } else if (!npp.isBogus()) {
- negPrefix = npp;
- } else {
- // UTS 35: Default negative prefix is "-" with positive prefix.
- // Important: We prepend the "-" to the pattern, not the override!
- negPrefix = ppp.isBogus() ? u"-" : u"-" + ppp;
- }
-
- if (!properties.negativeSuffix.isBogus()) {
- negSuffix = nso;
- } else if (!nsp.isBogus()) {
- negSuffix = nsp;
- } else {
- // UTS 35: Default negative prefix is the positive prefix.
- negSuffix = psp.isBogus() ? u"" : psp;
- }
-
- // For declaring if this is a currency pattern, we need to look at the
- // original pattern, not at any user-specified overrides.
- isCurrencyPattern = (
- AffixUtils::hasCurrencySymbols(ppp, status) ||
- AffixUtils::hasCurrencySymbols(psp, status) ||
- AffixUtils::hasCurrencySymbols(npp, status) ||
- AffixUtils::hasCurrencySymbols(nsp, status));
-}
-
-char16_t PropertiesAffixPatternProvider::charAt(int flags, int i) const {
- return getStringInternal(flags).charAt(i);
-}
-
-int PropertiesAffixPatternProvider::length(int flags) const {
- return getStringInternal(flags).length();
-}
-
-UnicodeString PropertiesAffixPatternProvider::getString(int32_t flags) const {
- return getStringInternal(flags);
-}
-
-const UnicodeString& PropertiesAffixPatternProvider::getStringInternal(int32_t flags) const {
- bool prefix = (flags & AFFIX_PREFIX) != 0;
- bool negative = (flags & AFFIX_NEGATIVE_SUBPATTERN) != 0;
- if (prefix && negative) {
- return negPrefix;
- } else if (prefix) {
- return posPrefix;
- } else if (negative) {
- return negSuffix;
- } else {
- return posSuffix;
- }
-}
-
-bool PropertiesAffixPatternProvider::positiveHasPlusSign() const {
- // TODO: Change the internal APIs to propagate out the error?
- ErrorCode localStatus;
- return AffixUtils::containsType(posPrefix, TYPE_PLUS_SIGN, localStatus) ||
- AffixUtils::containsType(posSuffix, TYPE_PLUS_SIGN, localStatus);
-}
-
-bool PropertiesAffixPatternProvider::hasNegativeSubpattern() const {
- return (
- (negSuffix != posSuffix) ||
- negPrefix.tempSubString(1) != posPrefix ||
- negPrefix.charAt(0) != u'-'
- );
-}
-
-bool PropertiesAffixPatternProvider::negativeHasMinusSign() const {
- ErrorCode localStatus;
- return AffixUtils::containsType(negPrefix, TYPE_MINUS_SIGN, localStatus) ||
- AffixUtils::containsType(negSuffix, TYPE_MINUS_SIGN, localStatus);
-}
-
-bool PropertiesAffixPatternProvider::hasCurrencySign() const {
- return isCurrencyPattern;
-}
-
-bool PropertiesAffixPatternProvider::containsSymbolType(AffixPatternType type, UErrorCode& status) const {
- return AffixUtils::containsType(posPrefix, type, status) ||
- AffixUtils::containsType(posSuffix, type, status) ||
- AffixUtils::containsType(negPrefix, type, status) ||
- AffixUtils::containsType(negSuffix, type, status);
-}
-
-bool PropertiesAffixPatternProvider::hasBody() const {
- return true;
-}
-
-
-void CurrencyPluralInfoAffixProvider::setTo(const CurrencyPluralInfo& cpi,
- const DecimalFormatProperties& properties,
- UErrorCode& status) {
- // We need to use a PropertiesAffixPatternProvider, not the simpler version ParsedPatternInfo,
- // because user-specified affix overrides still need to work.
- fBogus = false;
- DecimalFormatProperties pluralProperties(properties);
- for (int32_t plural = 0; plural < StandardPlural::COUNT; plural++) {
- const char* keyword = StandardPlural::getKeyword(static_cast<StandardPlural::Form>(plural));
- UnicodeString patternString;
- patternString = cpi.getCurrencyPluralPattern(keyword, patternString);
- PatternParser::parseToExistingProperties(
- patternString,
- pluralProperties,
- IGNORE_ROUNDING_NEVER,
- status);
- affixesByPlural[plural].setTo(pluralProperties, status);
- }
-}
-
-char16_t CurrencyPluralInfoAffixProvider::charAt(int32_t flags, int32_t i) const {
- int32_t pluralOrdinal = (flags & AFFIX_PLURAL_MASK);
- return affixesByPlural[pluralOrdinal].charAt(flags, i);
-}
-
-int32_t CurrencyPluralInfoAffixProvider::length(int32_t flags) const {
- int32_t pluralOrdinal = (flags & AFFIX_PLURAL_MASK);
- return affixesByPlural[pluralOrdinal].length(flags);
-}
-
-UnicodeString CurrencyPluralInfoAffixProvider::getString(int32_t flags) const {
- int32_t pluralOrdinal = (flags & AFFIX_PLURAL_MASK);
- return affixesByPlural[pluralOrdinal].getString(flags);
-}
-
-bool CurrencyPluralInfoAffixProvider::positiveHasPlusSign() const {
- return affixesByPlural[StandardPlural::OTHER].positiveHasPlusSign();
-}
-
-bool CurrencyPluralInfoAffixProvider::hasNegativeSubpattern() const {
- return affixesByPlural[StandardPlural::OTHER].hasNegativeSubpattern();
-}
-
-bool CurrencyPluralInfoAffixProvider::negativeHasMinusSign() const {
- return affixesByPlural[StandardPlural::OTHER].negativeHasMinusSign();
-}
-
-bool CurrencyPluralInfoAffixProvider::hasCurrencySign() const {
- return affixesByPlural[StandardPlural::OTHER].hasCurrencySign();
-}
-
-bool CurrencyPluralInfoAffixProvider::containsSymbolType(AffixPatternType type, UErrorCode& status) const {
- return affixesByPlural[StandardPlural::OTHER].containsSymbolType(type, status);
-}
-
-bool CurrencyPluralInfoAffixProvider::hasBody() const {
- return affixesByPlural[StandardPlural::OTHER].hasBody();
-}
-
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include "number_mapper.h"
+#include "number_patternstring.h"
+#include "unicode/errorcode.h"
+#include "number_utils.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+
+UnlocalizedNumberFormatter NumberPropertyMapper::create(const DecimalFormatProperties& properties,
+ const DecimalFormatSymbols& symbols,
+ DecimalFormatWarehouse& warehouse,
+ UErrorCode& status) {
+ return NumberFormatter::with().macros(oldToNew(properties, symbols, warehouse, nullptr, status));
+}
+
+UnlocalizedNumberFormatter NumberPropertyMapper::create(const DecimalFormatProperties& properties,
+ const DecimalFormatSymbols& symbols,
+ DecimalFormatWarehouse& warehouse,
+ DecimalFormatProperties& exportedProperties,
+ UErrorCode& status) {
+ return NumberFormatter::with().macros(
+ oldToNew(
+ properties, symbols, warehouse, &exportedProperties, status));
+}
+
+MacroProps NumberPropertyMapper::oldToNew(const DecimalFormatProperties& properties,
+ const DecimalFormatSymbols& symbols,
+ DecimalFormatWarehouse& warehouse,
+ DecimalFormatProperties* exportedProperties,
+ UErrorCode& status) {
+ MacroProps macros;
+ Locale locale = symbols.getLocale();
+
+ /////////////
+ // SYMBOLS //
+ /////////////
+
+ macros.symbols.setTo(symbols);
+
+ //////////////////
+ // PLURAL RULES //
+ //////////////////
+
+ if (!properties.currencyPluralInfo.fPtr.isNull()) {
+ macros.rules = properties.currencyPluralInfo.fPtr->getPluralRules();
+ }
+
+ /////////////
+ // AFFIXES //
+ /////////////
+
+ warehouse.affixProvider.setTo(properties, status);
+ macros.affixProvider = &warehouse.affixProvider.get();
+
+ ///////////
+ // UNITS //
+ ///////////
+
+ bool useCurrency = (
+ !properties.currency.isNull() ||
+ !properties.currencyPluralInfo.fPtr.isNull() ||
+ !properties.currencyUsage.isNull() ||
+ warehouse.affixProvider.get().hasCurrencySign());
+ CurrencyUnit currency = resolveCurrency(properties, locale, status);
+ UCurrencyUsage currencyUsage = properties.currencyUsage.getOrDefault(UCURR_USAGE_STANDARD);
+ if (useCurrency) {
+ // NOTE: Slicing is OK.
+ macros.unit = currency; // NOLINT
+ }
+
+ ///////////////////////
+ // ROUNDING STRATEGY //
+ ///////////////////////
+
+ int32_t maxInt = properties.maximumIntegerDigits;
+ int32_t minInt = properties.minimumIntegerDigits;
+ int32_t maxFrac = properties.maximumFractionDigits;
+ int32_t minFrac = properties.minimumFractionDigits;
+ int32_t minSig = properties.minimumSignificantDigits;
+ int32_t maxSig = properties.maximumSignificantDigits;
+ double roundingIncrement = properties.roundingIncrement;
+ RoundingMode roundingMode = properties.roundingMode.getOrDefault(UNUM_ROUND_HALFEVEN);
+ bool explicitMinMaxFrac = minFrac != -1 || maxFrac != -1;
+ bool explicitMinMaxSig = minSig != -1 || maxSig != -1;
+ // Resolve min/max frac for currencies, required for the validation logic and for when minFrac or
+ // maxFrac was
+ // set (but not both) on a currency instance.
+ // NOTE: Increments are handled in "Precision.constructCurrency()".
+ if (useCurrency && (minFrac == -1 || maxFrac == -1)) {
+ int32_t digits = ucurr_getDefaultFractionDigitsForUsage(
+ currency.getISOCurrency(), currencyUsage, &status);
+ if (minFrac == -1 && maxFrac == -1) {
+ minFrac = digits;
+ maxFrac = digits;
+ } else if (minFrac == -1) {
+ minFrac = std::min(maxFrac, digits);
+ } else /* if (maxFrac == -1) */ {
+ maxFrac = std::max(minFrac, digits);
+ }
+ }
+ // Validate min/max int/frac.
+ // For backwards compatibility, minimum overrides maximum if the two conflict.
+ if (minInt == 0 && maxFrac != 0) {
+ minFrac = (minFrac < 0 || (minFrac == 0 && maxInt == 0)) ? 1 : minFrac;
+ maxFrac = maxFrac < 0 ? -1 : maxFrac < minFrac ? minFrac : maxFrac;
+ minInt = 0;
+ maxInt = maxInt < 0 ? -1 : maxInt > kMaxIntFracSig ? -1 : maxInt;
+ } else {
+ // Force a digit before the decimal point.
+ minFrac = minFrac < 0 ? 0 : minFrac;
+ maxFrac = maxFrac < 0 ? -1 : maxFrac < minFrac ? minFrac : maxFrac;
+ minInt = minInt <= 0 ? 1 : minInt > kMaxIntFracSig ? 1 : minInt;
+ maxInt = maxInt < 0 ? -1 : maxInt < minInt ? minInt : maxInt > kMaxIntFracSig ? -1 : maxInt;
+ }
+ Precision precision;
+ if (!properties.currencyUsage.isNull()) {
+ precision = Precision::constructCurrency(currencyUsage).withCurrency(currency);
+ } else if (roundingIncrement != 0.0) {
+ if (PatternStringUtils::ignoreRoundingIncrement(roundingIncrement, maxFrac)) {
+ precision = Precision::constructFraction(minFrac, maxFrac);
+ } else {
+ precision = Precision::constructIncrement(roundingIncrement, minFrac);
+ }
+ } else if (explicitMinMaxSig) {
+ minSig = minSig < 1 ? 1 : minSig > kMaxIntFracSig ? kMaxIntFracSig : minSig;
+ maxSig = maxSig < 0 ? kMaxIntFracSig : maxSig < minSig ? minSig : maxSig > kMaxIntFracSig
+ ? kMaxIntFracSig : maxSig;
+ precision = Precision::constructSignificant(minSig, maxSig);
+ } else if (explicitMinMaxFrac) {
+ precision = Precision::constructFraction(minFrac, maxFrac);
+ } else if (useCurrency) {
+ precision = Precision::constructCurrency(currencyUsage);
+ }
+ if (!precision.isBogus()) {
+ precision.fRoundingMode = roundingMode;
+ macros.precision = precision;
+ }
+
+ ///////////////////
+ // INTEGER WIDTH //
+ ///////////////////
+
+ macros.integerWidth = IntegerWidth(
+ static_cast<digits_t>(minInt),
+ static_cast<digits_t>(maxInt),
+ properties.formatFailIfMoreThanMaxDigits);
+
+ ///////////////////////
+ // GROUPING STRATEGY //
+ ///////////////////////
+
+ macros.grouper = Grouper::forProperties(properties);
+
+ /////////////
+ // PADDING //
+ /////////////
+
+ if (properties.formatWidth > 0) {
+ macros.padder = Padder::forProperties(properties);
+ }
+
+ ///////////////////////////////
+ // DECIMAL MARK ALWAYS SHOWN //
+ ///////////////////////////////
+
+ macros.decimal = properties.decimalSeparatorAlwaysShown ? UNUM_DECIMAL_SEPARATOR_ALWAYS
+ : UNUM_DECIMAL_SEPARATOR_AUTO;
+
+ ///////////////////////
+ // SIGN ALWAYS SHOWN //
+ ///////////////////////
+
+ macros.sign = properties.signAlwaysShown ? UNUM_SIGN_ALWAYS : UNUM_SIGN_AUTO;
+
+ /////////////////////////
+ // SCIENTIFIC NOTATION //
+ /////////////////////////
+
+ if (properties.minimumExponentDigits != -1) {
+ // Scientific notation is required.
+ // This whole section feels like a hack, but it is needed for regression tests.
+ // The mapping from property bag to scientific notation is nontrivial due to LDML rules.
+ if (maxInt > 8) {
+ // But #13110: The maximum of 8 digits has unknown origins and is not in the spec.
+ // If maxInt is greater than 8, it is set to minInt, even if minInt is greater than 8.
+ maxInt = minInt;
+ macros.integerWidth = IntegerWidth::zeroFillTo(minInt).truncateAt(maxInt);
+ } else if (maxInt > minInt && minInt > 1) {
+ // Bug #13289: if maxInt > minInt > 1, then minInt should be 1.
+ minInt = 1;
+ macros.integerWidth = IntegerWidth::zeroFillTo(minInt).truncateAt(maxInt);
+ }
+ int engineering = maxInt < 0 ? -1 : maxInt;
+ macros.notation = ScientificNotation(
+ // Engineering interval:
+ static_cast<int8_t>(engineering),
+ // Enforce minimum integer digits (for patterns like "000.00E0"):
+ (engineering == minInt),
+ // Minimum exponent digits:
+ static_cast<digits_t>(properties.minimumExponentDigits),
+ // Exponent sign always shown:
+ properties.exponentSignAlwaysShown ? UNUM_SIGN_ALWAYS : UNUM_SIGN_AUTO);
+ // Scientific notation also involves overriding the rounding mode.
+ // TODO: Overriding here is a bit of a hack. Should this logic go earlier?
+ if (macros.precision.fType == Precision::PrecisionType::RND_FRACTION) {
+ // For the purposes of rounding, get the original min/max int/frac, since the local
+ // variables have been manipulated for display purposes.
+ int maxInt_ = properties.maximumIntegerDigits;
+ int minInt_ = properties.minimumIntegerDigits;
+ int minFrac_ = properties.minimumFractionDigits;
+ int maxFrac_ = properties.maximumFractionDigits;
+ if (minInt_ == 0 && maxFrac_ == 0) {
+ // Patterns like "#E0" and "##E0", which mean no rounding!
+ macros.precision = Precision::unlimited();
+ } else if (minInt_ == 0 && minFrac_ == 0) {
+ // Patterns like "#.##E0" (no zeros in the mantissa), which mean round to maxFrac+1
+ macros.precision = Precision::constructSignificant(1, maxFrac_ + 1);
+ } else {
+ int maxSig_ = minInt_ + maxFrac_;
+ // Bug #20058: if maxInt_ > minInt_ > 1, then minInt_ should be 1.
+ if (maxInt_ > minInt_ && minInt_ > 1) {
+ minInt_ = 1;
+ }
+ int minSig_ = minInt_ + minFrac_;
+ // To avoid regression, maxSig is not reset when minInt_ set to 1.
+ // TODO: Reset maxSig_ = 1 + minFrac_ to follow the spec.
+ macros.precision = Precision::constructSignificant(minSig_, maxSig_);
+ }
+ macros.precision.fRoundingMode = roundingMode;
+ }
+ }
+
+ //////////////////////
+ // COMPACT NOTATION //
+ //////////////////////
+
+ if (!properties.compactStyle.isNull()) {
+ if (properties.compactStyle.getNoError() == UNumberCompactStyle::UNUM_LONG) {
+ macros.notation = Notation::compactLong();
+ } else {
+ macros.notation = Notation::compactShort();
+ }
+ // Do not forward the affix provider.
+ macros.affixProvider = nullptr;
+ }
+
+ /////////////////
+ // MULTIPLIERS //
+ /////////////////
+
+ macros.scale = scaleFromProperties(properties);
+
+ //////////////////////
+ // PROPERTY EXPORTS //
+ //////////////////////
+
+ if (exportedProperties != nullptr) {
+
+ exportedProperties->currency = currency;
+ exportedProperties->roundingMode = roundingMode;
+ exportedProperties->minimumIntegerDigits = minInt;
+ exportedProperties->maximumIntegerDigits = maxInt == -1 ? INT32_MAX : maxInt;
+
+ Precision rounding_;
+ if (precision.fType == Precision::PrecisionType::RND_CURRENCY) {
+ rounding_ = precision.withCurrency(currency, status);
+ } else {
+ rounding_ = precision;
+ }
+ int minFrac_ = minFrac;
+ int maxFrac_ = maxFrac;
+ int minSig_ = minSig;
+ int maxSig_ = maxSig;
+ double increment_ = 0.0;
+ if (rounding_.fType == Precision::PrecisionType::RND_FRACTION) {
+ minFrac_ = rounding_.fUnion.fracSig.fMinFrac;
+ maxFrac_ = rounding_.fUnion.fracSig.fMaxFrac;
+ } else if (rounding_.fType == Precision::PrecisionType::RND_INCREMENT
+ || rounding_.fType == Precision::PrecisionType::RND_INCREMENT_ONE
+ || rounding_.fType == Precision::PrecisionType::RND_INCREMENT_FIVE) {
+ increment_ = rounding_.fUnion.increment.fIncrement;
+ minFrac_ = rounding_.fUnion.increment.fMinFrac;
+ maxFrac_ = rounding_.fUnion.increment.fMinFrac;
+ } else if (rounding_.fType == Precision::PrecisionType::RND_SIGNIFICANT) {
+ minSig_ = rounding_.fUnion.fracSig.fMinSig;
+ maxSig_ = rounding_.fUnion.fracSig.fMaxSig;
+ }
+
+ exportedProperties->minimumFractionDigits = minFrac_;
+ exportedProperties->maximumFractionDigits = maxFrac_;
+ exportedProperties->minimumSignificantDigits = minSig_;
+ exportedProperties->maximumSignificantDigits = maxSig_;
+ exportedProperties->roundingIncrement = increment_;
+ }
+
+ return macros;
+}
+
+
+void PropertiesAffixPatternProvider::setTo(const DecimalFormatProperties& properties, UErrorCode& status) {
+ fBogus = false;
+
+ // There are two ways to set affixes in DecimalFormat: via the pattern string (applyPattern), and via the
+ // explicit setters (setPositivePrefix and friends). The way to resolve the settings is as follows:
+ //
+ // 1) If the explicit setting is present for the field, use it.
+ // 2) Otherwise, follows UTS 35 rules based on the pattern string.
+ //
+ // Importantly, the explicit setters affect only the one field they override. If you set the positive
+ // prefix, that should not affect the negative prefix.
+
+ // Convenience: Extract the properties into local variables.
+ // Variables are named with three chars: [p/n][p/s][o/p]
+ // [p/n] => p for positive, n for negative
+ // [p/s] => p for prefix, s for suffix
+ // [o/p] => o for escaped custom override string, p for pattern string
+ UnicodeString ppo = AffixUtils::escape(properties.positivePrefix);
+ UnicodeString pso = AffixUtils::escape(properties.positiveSuffix);
+ UnicodeString npo = AffixUtils::escape(properties.negativePrefix);
+ UnicodeString nso = AffixUtils::escape(properties.negativeSuffix);
+ const UnicodeString& ppp = properties.positivePrefixPattern;
+ const UnicodeString& psp = properties.positiveSuffixPattern;
+ const UnicodeString& npp = properties.negativePrefixPattern;
+ const UnicodeString& nsp = properties.negativeSuffixPattern;
+
+ if (!properties.positivePrefix.isBogus()) {
+ posPrefix = ppo;
+ } else if (!ppp.isBogus()) {
+ posPrefix = ppp;
+ } else {
+ // UTS 35: Default positive prefix is empty string.
+ posPrefix = u"";
+ }
+
+ if (!properties.positiveSuffix.isBogus()) {
+ posSuffix = pso;
+ } else if (!psp.isBogus()) {
+ posSuffix = psp;
+ } else {
+ // UTS 35: Default positive suffix is empty string.
+ posSuffix = u"";
+ }
+
+ if (!properties.negativePrefix.isBogus()) {
+ negPrefix = npo;
+ } else if (!npp.isBogus()) {
+ negPrefix = npp;
+ } else {
+ // UTS 35: Default negative prefix is "-" with positive prefix.
+ // Important: We prepend the "-" to the pattern, not the override!
+ negPrefix = ppp.isBogus() ? u"-" : u"-" + ppp;
+ }
+
+ if (!properties.negativeSuffix.isBogus()) {
+ negSuffix = nso;
+ } else if (!nsp.isBogus()) {
+ negSuffix = nsp;
+ } else {
+ // UTS 35: Default negative prefix is the positive prefix.
+ negSuffix = psp.isBogus() ? u"" : psp;
+ }
+
+ // For declaring if this is a currency pattern, we need to look at the
+ // original pattern, not at any user-specified overrides.
+ isCurrencyPattern = (
+ AffixUtils::hasCurrencySymbols(ppp, status) ||
+ AffixUtils::hasCurrencySymbols(psp, status) ||
+ AffixUtils::hasCurrencySymbols(npp, status) ||
+ AffixUtils::hasCurrencySymbols(nsp, status));
+}
+
+char16_t PropertiesAffixPatternProvider::charAt(int flags, int i) const {
+ return getStringInternal(flags).charAt(i);
+}
+
+int PropertiesAffixPatternProvider::length(int flags) const {
+ return getStringInternal(flags).length();
+}
+
+UnicodeString PropertiesAffixPatternProvider::getString(int32_t flags) const {
+ return getStringInternal(flags);
+}
+
+const UnicodeString& PropertiesAffixPatternProvider::getStringInternal(int32_t flags) const {
+ bool prefix = (flags & AFFIX_PREFIX) != 0;
+ bool negative = (flags & AFFIX_NEGATIVE_SUBPATTERN) != 0;
+ if (prefix && negative) {
+ return negPrefix;
+ } else if (prefix) {
+ return posPrefix;
+ } else if (negative) {
+ return negSuffix;
+ } else {
+ return posSuffix;
+ }
+}
+
+bool PropertiesAffixPatternProvider::positiveHasPlusSign() const {
+ // TODO: Change the internal APIs to propagate out the error?
+ ErrorCode localStatus;
+ return AffixUtils::containsType(posPrefix, TYPE_PLUS_SIGN, localStatus) ||
+ AffixUtils::containsType(posSuffix, TYPE_PLUS_SIGN, localStatus);
+}
+
+bool PropertiesAffixPatternProvider::hasNegativeSubpattern() const {
+ return (
+ (negSuffix != posSuffix) ||
+ negPrefix.tempSubString(1) != posPrefix ||
+ negPrefix.charAt(0) != u'-'
+ );
+}
+
+bool PropertiesAffixPatternProvider::negativeHasMinusSign() const {
+ ErrorCode localStatus;
+ return AffixUtils::containsType(negPrefix, TYPE_MINUS_SIGN, localStatus) ||
+ AffixUtils::containsType(negSuffix, TYPE_MINUS_SIGN, localStatus);
+}
+
+bool PropertiesAffixPatternProvider::hasCurrencySign() const {
+ return isCurrencyPattern;
+}
+
+bool PropertiesAffixPatternProvider::containsSymbolType(AffixPatternType type, UErrorCode& status) const {
+ return AffixUtils::containsType(posPrefix, type, status) ||
+ AffixUtils::containsType(posSuffix, type, status) ||
+ AffixUtils::containsType(negPrefix, type, status) ||
+ AffixUtils::containsType(negSuffix, type, status);
+}
+
+bool PropertiesAffixPatternProvider::hasBody() const {
+ return true;
+}
+
+
+void CurrencyPluralInfoAffixProvider::setTo(const CurrencyPluralInfo& cpi,
+ const DecimalFormatProperties& properties,
+ UErrorCode& status) {
+ // We need to use a PropertiesAffixPatternProvider, not the simpler version ParsedPatternInfo,
+ // because user-specified affix overrides still need to work.
+ fBogus = false;
+ DecimalFormatProperties pluralProperties(properties);
+ for (int32_t plural = 0; plural < StandardPlural::COUNT; plural++) {
+ const char* keyword = StandardPlural::getKeyword(static_cast<StandardPlural::Form>(plural));
+ UnicodeString patternString;
+ patternString = cpi.getCurrencyPluralPattern(keyword, patternString);
+ PatternParser::parseToExistingProperties(
+ patternString,
+ pluralProperties,
+ IGNORE_ROUNDING_NEVER,
+ status);
+ affixesByPlural[plural].setTo(pluralProperties, status);
+ }
+}
+
+char16_t CurrencyPluralInfoAffixProvider::charAt(int32_t flags, int32_t i) const {
+ int32_t pluralOrdinal = (flags & AFFIX_PLURAL_MASK);
+ return affixesByPlural[pluralOrdinal].charAt(flags, i);
+}
+
+int32_t CurrencyPluralInfoAffixProvider::length(int32_t flags) const {
+ int32_t pluralOrdinal = (flags & AFFIX_PLURAL_MASK);
+ return affixesByPlural[pluralOrdinal].length(flags);
+}
+
+UnicodeString CurrencyPluralInfoAffixProvider::getString(int32_t flags) const {
+ int32_t pluralOrdinal = (flags & AFFIX_PLURAL_MASK);
+ return affixesByPlural[pluralOrdinal].getString(flags);
+}
+
+bool CurrencyPluralInfoAffixProvider::positiveHasPlusSign() const {
+ return affixesByPlural[StandardPlural::OTHER].positiveHasPlusSign();
+}
+
+bool CurrencyPluralInfoAffixProvider::hasNegativeSubpattern() const {
+ return affixesByPlural[StandardPlural::OTHER].hasNegativeSubpattern();
+}
+
+bool CurrencyPluralInfoAffixProvider::negativeHasMinusSign() const {
+ return affixesByPlural[StandardPlural::OTHER].negativeHasMinusSign();
+}
+
+bool CurrencyPluralInfoAffixProvider::hasCurrencySign() const {
+ return affixesByPlural[StandardPlural::OTHER].hasCurrencySign();
+}
+
+bool CurrencyPluralInfoAffixProvider::containsSymbolType(AffixPatternType type, UErrorCode& status) const {
+ return affixesByPlural[StandardPlural::OTHER].containsSymbolType(type, status);
+}
+
+bool CurrencyPluralInfoAffixProvider::hasBody() const {
+ return affixesByPlural[StandardPlural::OTHER].hasBody();
+}
+
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_mapper.h b/contrib/libs/icu/i18n/number_mapper.h
index 29801257cb..d18b8b3c43 100644
--- a/contrib/libs/icu/i18n/number_mapper.h
+++ b/contrib/libs/icu/i18n/number_mapper.h
@@ -1,251 +1,251 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMBER_MAPPER_H__
-#define __NUMBER_MAPPER_H__
-
-#include <atomic>
-#include "number_types.h"
-#include "unicode/currpinf.h"
-#include "standardplural.h"
-#include "number_patternstring.h"
-#include "number_currencysymbols.h"
-#include "numparse_impl.h"
-
-U_NAMESPACE_BEGIN
-namespace number {
-namespace impl {
-
-
-class AutoAffixPatternProvider;
-class CurrencyPluralInfoAffixProvider;
-
-
-class PropertiesAffixPatternProvider : public AffixPatternProvider, public UMemory {
- public:
- bool isBogus() const {
- return fBogus;
- }
-
- void setToBogus() {
- fBogus = true;
- }
-
- void setTo(const DecimalFormatProperties& properties, UErrorCode& status);
-
- // AffixPatternProvider Methods:
-
- char16_t charAt(int32_t flags, int32_t i) const U_OVERRIDE;
-
- int32_t length(int32_t flags) const U_OVERRIDE;
-
- UnicodeString getString(int32_t flags) const U_OVERRIDE;
-
- bool hasCurrencySign() const U_OVERRIDE;
-
- bool positiveHasPlusSign() const U_OVERRIDE;
-
- bool hasNegativeSubpattern() const U_OVERRIDE;
-
- bool negativeHasMinusSign() const U_OVERRIDE;
-
- bool containsSymbolType(AffixPatternType, UErrorCode&) const U_OVERRIDE;
-
- bool hasBody() const U_OVERRIDE;
-
- private:
- UnicodeString posPrefix;
- UnicodeString posSuffix;
- UnicodeString negPrefix;
- UnicodeString negSuffix;
- bool isCurrencyPattern;
-
- PropertiesAffixPatternProvider() = default; // puts instance in valid but undefined state
-
- const UnicodeString& getStringInternal(int32_t flags) const;
-
- bool fBogus{true};
-
- friend class AutoAffixPatternProvider;
- friend class CurrencyPluralInfoAffixProvider;
-};
-
-
-class CurrencyPluralInfoAffixProvider : public AffixPatternProvider, public UMemory {
- public:
- bool isBogus() const {
- return fBogus;
- }
-
- void setToBogus() {
- fBogus = true;
- }
-
- void setTo(const CurrencyPluralInfo& cpi, const DecimalFormatProperties& properties,
- UErrorCode& status);
-
- // AffixPatternProvider Methods:
-
- char16_t charAt(int32_t flags, int32_t i) const U_OVERRIDE;
-
- int32_t length(int32_t flags) const U_OVERRIDE;
-
- UnicodeString getString(int32_t flags) const U_OVERRIDE;
-
- bool hasCurrencySign() const U_OVERRIDE;
-
- bool positiveHasPlusSign() const U_OVERRIDE;
-
- bool hasNegativeSubpattern() const U_OVERRIDE;
-
- bool negativeHasMinusSign() const U_OVERRIDE;
-
- bool containsSymbolType(AffixPatternType, UErrorCode&) const U_OVERRIDE;
-
- bool hasBody() const U_OVERRIDE;
-
- private:
- PropertiesAffixPatternProvider affixesByPlural[StandardPlural::COUNT];
-
- CurrencyPluralInfoAffixProvider() = default;
-
- bool fBogus{true};
-
- friend class AutoAffixPatternProvider;
-};
-
-
-class AutoAffixPatternProvider {
- public:
- inline AutoAffixPatternProvider() = default;
-
- inline AutoAffixPatternProvider(const DecimalFormatProperties& properties, UErrorCode& status) {
- setTo(properties, status);
- }
-
- inline void setTo(const DecimalFormatProperties& properties, UErrorCode& status) {
- if (properties.currencyPluralInfo.fPtr.isNull()) {
- propertiesAPP.setTo(properties, status);
- currencyPluralInfoAPP.setToBogus();
- } else {
- propertiesAPP.setToBogus();
- currencyPluralInfoAPP.setTo(*properties.currencyPluralInfo.fPtr, properties, status);
- }
- }
-
- inline const AffixPatternProvider& get() const {
- if (!currencyPluralInfoAPP.isBogus()) {
- return currencyPluralInfoAPP;
- } else {
- return propertiesAPP;
- }
- }
-
- private:
- PropertiesAffixPatternProvider propertiesAPP;
- CurrencyPluralInfoAffixProvider currencyPluralInfoAPP;
-};
-
-
-/**
- * A struct for ownership of a few objects needed for formatting.
- */
-struct DecimalFormatWarehouse {
- AutoAffixPatternProvider affixProvider;
-
-};
-
-
-/**
-* Internal fields for DecimalFormat.
-* TODO: Make some of these fields by value instead of by LocalPointer?
-*/
-struct DecimalFormatFields : public UMemory {
-
- DecimalFormatFields() {}
-
- DecimalFormatFields(const DecimalFormatProperties& propsToCopy)
- : properties(propsToCopy) {}
-
- /** The property bag corresponding to user-specified settings and settings from the pattern string. */
- DecimalFormatProperties properties;
-
- /** The symbols for the current locale. */
- LocalPointer<const DecimalFormatSymbols> symbols;
-
- /**
- * The pre-computed formatter object. Setters cause this to be re-computed atomically. The {@link
- * #format} method uses the formatter directly without needing to synchronize.
- */
- LocalizedNumberFormatter formatter;
-
- /** The lazy-computed parser for .parse() */
- std::atomic<::icu::numparse::impl::NumberParserImpl*> atomicParser = {};
-
- /** The lazy-computed parser for .parseCurrency() */
- std::atomic<::icu::numparse::impl::NumberParserImpl*> atomicCurrencyParser = {};
-
- /** Small object ownership warehouse for the formatter and parser */
- DecimalFormatWarehouse warehouse;
-
- /** The effective properties as exported from the formatter object. Used by some getters. */
- DecimalFormatProperties exportedProperties;
-
- // Data for fastpath
- bool canUseFastFormat = false;
- struct FastFormatData {
- char16_t cpZero;
- char16_t cpGroupingSeparator;
- char16_t cpMinusSign;
- int8_t minInt;
- int8_t maxInt;
- } fastData;
-};
-
-
-/**
- * Utilities for converting between a DecimalFormatProperties and a MacroProps.
- */
-class NumberPropertyMapper {
- public:
- /** Convenience method to create a NumberFormatter directly from Properties. */
- static UnlocalizedNumberFormatter create(const DecimalFormatProperties& properties,
- const DecimalFormatSymbols& symbols,
- DecimalFormatWarehouse& warehouse, UErrorCode& status);
-
- /** Convenience method to create a NumberFormatter directly from Properties. */
- static UnlocalizedNumberFormatter create(const DecimalFormatProperties& properties,
- const DecimalFormatSymbols& symbols,
- DecimalFormatWarehouse& warehouse,
- DecimalFormatProperties& exportedProperties,
- UErrorCode& status);
-
- /**
- * Creates a new {@link MacroProps} object based on the content of a {@link DecimalFormatProperties}
- * object. In other words, maps Properties to MacroProps. This function is used by the
- * JDK-compatibility API to call into the ICU 60 fluent number formatting pipeline.
- *
- * @param properties
- * The property bag to be mapped.
- * @param symbols
- * The symbols associated with the property bag.
- * @param exportedProperties
- * A property bag in which to store validated properties. Used by some DecimalFormat
- * getters.
- * @return A new MacroProps containing all of the information in the Properties.
- */
- static MacroProps oldToNew(const DecimalFormatProperties& properties,
- const DecimalFormatSymbols& symbols, DecimalFormatWarehouse& warehouse,
- DecimalFormatProperties* exportedProperties, UErrorCode& status);
-};
-
-
-} // namespace impl
-} // namespace numparse
-U_NAMESPACE_END
-
-#endif //__NUMBER_MAPPER_H__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMBER_MAPPER_H__
+#define __NUMBER_MAPPER_H__
+
+#include <atomic>
+#include "number_types.h"
+#include "unicode/currpinf.h"
+#include "standardplural.h"
+#include "number_patternstring.h"
+#include "number_currencysymbols.h"
+#include "numparse_impl.h"
+
+U_NAMESPACE_BEGIN
+namespace number {
+namespace impl {
+
+
+class AutoAffixPatternProvider;
+class CurrencyPluralInfoAffixProvider;
+
+
+class PropertiesAffixPatternProvider : public AffixPatternProvider, public UMemory {
+ public:
+ bool isBogus() const {
+ return fBogus;
+ }
+
+ void setToBogus() {
+ fBogus = true;
+ }
+
+ void setTo(const DecimalFormatProperties& properties, UErrorCode& status);
+
+ // AffixPatternProvider Methods:
+
+ char16_t charAt(int32_t flags, int32_t i) const U_OVERRIDE;
+
+ int32_t length(int32_t flags) const U_OVERRIDE;
+
+ UnicodeString getString(int32_t flags) const U_OVERRIDE;
+
+ bool hasCurrencySign() const U_OVERRIDE;
+
+ bool positiveHasPlusSign() const U_OVERRIDE;
+
+ bool hasNegativeSubpattern() const U_OVERRIDE;
+
+ bool negativeHasMinusSign() const U_OVERRIDE;
+
+ bool containsSymbolType(AffixPatternType, UErrorCode&) const U_OVERRIDE;
+
+ bool hasBody() const U_OVERRIDE;
+
+ private:
+ UnicodeString posPrefix;
+ UnicodeString posSuffix;
+ UnicodeString negPrefix;
+ UnicodeString negSuffix;
+ bool isCurrencyPattern;
+
+ PropertiesAffixPatternProvider() = default; // puts instance in valid but undefined state
+
+ const UnicodeString& getStringInternal(int32_t flags) const;
+
+ bool fBogus{true};
+
+ friend class AutoAffixPatternProvider;
+ friend class CurrencyPluralInfoAffixProvider;
+};
+
+
+class CurrencyPluralInfoAffixProvider : public AffixPatternProvider, public UMemory {
+ public:
+ bool isBogus() const {
+ return fBogus;
+ }
+
+ void setToBogus() {
+ fBogus = true;
+ }
+
+ void setTo(const CurrencyPluralInfo& cpi, const DecimalFormatProperties& properties,
+ UErrorCode& status);
+
+ // AffixPatternProvider Methods:
+
+ char16_t charAt(int32_t flags, int32_t i) const U_OVERRIDE;
+
+ int32_t length(int32_t flags) const U_OVERRIDE;
+
+ UnicodeString getString(int32_t flags) const U_OVERRIDE;
+
+ bool hasCurrencySign() const U_OVERRIDE;
+
+ bool positiveHasPlusSign() const U_OVERRIDE;
+
+ bool hasNegativeSubpattern() const U_OVERRIDE;
+
+ bool negativeHasMinusSign() const U_OVERRIDE;
+
+ bool containsSymbolType(AffixPatternType, UErrorCode&) const U_OVERRIDE;
+
+ bool hasBody() const U_OVERRIDE;
+
+ private:
+ PropertiesAffixPatternProvider affixesByPlural[StandardPlural::COUNT];
+
+ CurrencyPluralInfoAffixProvider() = default;
+
+ bool fBogus{true};
+
+ friend class AutoAffixPatternProvider;
+};
+
+
+class AutoAffixPatternProvider {
+ public:
+ inline AutoAffixPatternProvider() = default;
+
+ inline AutoAffixPatternProvider(const DecimalFormatProperties& properties, UErrorCode& status) {
+ setTo(properties, status);
+ }
+
+ inline void setTo(const DecimalFormatProperties& properties, UErrorCode& status) {
+ if (properties.currencyPluralInfo.fPtr.isNull()) {
+ propertiesAPP.setTo(properties, status);
+ currencyPluralInfoAPP.setToBogus();
+ } else {
+ propertiesAPP.setToBogus();
+ currencyPluralInfoAPP.setTo(*properties.currencyPluralInfo.fPtr, properties, status);
+ }
+ }
+
+ inline const AffixPatternProvider& get() const {
+ if (!currencyPluralInfoAPP.isBogus()) {
+ return currencyPluralInfoAPP;
+ } else {
+ return propertiesAPP;
+ }
+ }
+
+ private:
+ PropertiesAffixPatternProvider propertiesAPP;
+ CurrencyPluralInfoAffixProvider currencyPluralInfoAPP;
+};
+
+
+/**
+ * A struct for ownership of a few objects needed for formatting.
+ */
+struct DecimalFormatWarehouse {
+ AutoAffixPatternProvider affixProvider;
+
+};
+
+
+/**
+* Internal fields for DecimalFormat.
+* TODO: Make some of these fields by value instead of by LocalPointer?
+*/
+struct DecimalFormatFields : public UMemory {
+
+ DecimalFormatFields() {}
+
+ DecimalFormatFields(const DecimalFormatProperties& propsToCopy)
+ : properties(propsToCopy) {}
+
+ /** The property bag corresponding to user-specified settings and settings from the pattern string. */
+ DecimalFormatProperties properties;
+
+ /** The symbols for the current locale. */
+ LocalPointer<const DecimalFormatSymbols> symbols;
+
+ /**
+ * The pre-computed formatter object. Setters cause this to be re-computed atomically. The {@link
+ * #format} method uses the formatter directly without needing to synchronize.
+ */
+ LocalizedNumberFormatter formatter;
+
+ /** The lazy-computed parser for .parse() */
+ std::atomic<::icu::numparse::impl::NumberParserImpl*> atomicParser = {};
+
+ /** The lazy-computed parser for .parseCurrency() */
+ std::atomic<::icu::numparse::impl::NumberParserImpl*> atomicCurrencyParser = {};
+
+ /** Small object ownership warehouse for the formatter and parser */
+ DecimalFormatWarehouse warehouse;
+
+ /** The effective properties as exported from the formatter object. Used by some getters. */
+ DecimalFormatProperties exportedProperties;
+
+ // Data for fastpath
+ bool canUseFastFormat = false;
+ struct FastFormatData {
+ char16_t cpZero;
+ char16_t cpGroupingSeparator;
+ char16_t cpMinusSign;
+ int8_t minInt;
+ int8_t maxInt;
+ } fastData;
+};
+
+
+/**
+ * Utilities for converting between a DecimalFormatProperties and a MacroProps.
+ */
+class NumberPropertyMapper {
+ public:
+ /** Convenience method to create a NumberFormatter directly from Properties. */
+ static UnlocalizedNumberFormatter create(const DecimalFormatProperties& properties,
+ const DecimalFormatSymbols& symbols,
+ DecimalFormatWarehouse& warehouse, UErrorCode& status);
+
+ /** Convenience method to create a NumberFormatter directly from Properties. */
+ static UnlocalizedNumberFormatter create(const DecimalFormatProperties& properties,
+ const DecimalFormatSymbols& symbols,
+ DecimalFormatWarehouse& warehouse,
+ DecimalFormatProperties& exportedProperties,
+ UErrorCode& status);
+
+ /**
+ * Creates a new {@link MacroProps} object based on the content of a {@link DecimalFormatProperties}
+ * object. In other words, maps Properties to MacroProps. This function is used by the
+ * JDK-compatibility API to call into the ICU 60 fluent number formatting pipeline.
+ *
+ * @param properties
+ * The property bag to be mapped.
+ * @param symbols
+ * The symbols associated with the property bag.
+ * @param exportedProperties
+ * A property bag in which to store validated properties. Used by some DecimalFormat
+ * getters.
+ * @return A new MacroProps containing all of the information in the Properties.
+ */
+ static MacroProps oldToNew(const DecimalFormatProperties& properties,
+ const DecimalFormatSymbols& symbols, DecimalFormatWarehouse& warehouse,
+ DecimalFormatProperties* exportedProperties, UErrorCode& status);
+};
+
+
+} // namespace impl
+} // namespace numparse
+U_NAMESPACE_END
+
+#endif //__NUMBER_MAPPER_H__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_microprops.h b/contrib/libs/icu/i18n/number_microprops.h
index 3f82a0c4b7..56512f5e6f 100644
--- a/contrib/libs/icu/i18n/number_microprops.h
+++ b/contrib/libs/icu/i18n/number_microprops.h
@@ -1,83 +1,83 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMBER_MICROPROPS_H__
-#define __NUMBER_MICROPROPS_H__
-
-// TODO: minimize includes
-#include "unicode/numberformatter.h"
-#include "number_types.h"
-#include "number_decimalquantity.h"
-#include "number_scientific.h"
-#include "number_patternstring.h"
-#include "number_modifiers.h"
-#include "number_multiplier.h"
-#include "number_roundingutils.h"
-#include "decNumber.h"
-#include "charstr.h"
-
-U_NAMESPACE_BEGIN namespace number {
-namespace impl {
-
-struct MicroProps : public MicroPropsGenerator {
-
- // NOTE: All of these fields are properly initialized in NumberFormatterImpl.
- RoundingImpl rounder;
- Grouper grouping;
- Padder padding;
- IntegerWidth integerWidth;
- UNumberSignDisplay sign;
- UNumberDecimalSeparatorDisplay decimal;
- bool useCurrency;
- char nsName[9];
-
- // Note: This struct has no direct ownership of the following pointers.
- const DecimalFormatSymbols* symbols;
- const Modifier* modOuter;
- const Modifier* modMiddle = nullptr;
- const Modifier* modInner;
-
- // The following "helper" fields may optionally be used during the MicroPropsGenerator.
- // They live here to retain memory.
- struct {
- ScientificModifier scientificModifier;
- EmptyModifier emptyWeakModifier{false};
- EmptyModifier emptyStrongModifier{true};
- MultiplierFormatHandler multiplier;
- } helpers;
-
-
- MicroProps() = default;
-
- MicroProps(const MicroProps& other) = default;
-
- MicroProps& operator=(const MicroProps& other) = default;
-
- void processQuantity(DecimalQuantity&, MicroProps& micros, UErrorCode& status) const U_OVERRIDE {
- (void) status;
- if (this == &micros) {
- // Unsafe path: no need to perform a copy.
- U_ASSERT(!exhausted);
- micros.exhausted = true;
- U_ASSERT(exhausted);
- } else {
- // Safe path: copy self into the output micros.
- micros = *this;
- }
- }
-
- private:
- // Internal fields:
- bool exhausted = false;
-};
-
-} // namespace impl
-} // namespace number
-U_NAMESPACE_END
-
-#endif // __NUMBER_MICROPROPS_H__
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMBER_MICROPROPS_H__
+#define __NUMBER_MICROPROPS_H__
+
+// TODO: minimize includes
+#include "unicode/numberformatter.h"
+#include "number_types.h"
+#include "number_decimalquantity.h"
+#include "number_scientific.h"
+#include "number_patternstring.h"
+#include "number_modifiers.h"
+#include "number_multiplier.h"
+#include "number_roundingutils.h"
+#include "decNumber.h"
+#include "charstr.h"
+
+U_NAMESPACE_BEGIN namespace number {
+namespace impl {
+
+struct MicroProps : public MicroPropsGenerator {
+
+ // NOTE: All of these fields are properly initialized in NumberFormatterImpl.
+ RoundingImpl rounder;
+ Grouper grouping;
+ Padder padding;
+ IntegerWidth integerWidth;
+ UNumberSignDisplay sign;
+ UNumberDecimalSeparatorDisplay decimal;
+ bool useCurrency;
+ char nsName[9];
+
+ // Note: This struct has no direct ownership of the following pointers.
+ const DecimalFormatSymbols* symbols;
+ const Modifier* modOuter;
+ const Modifier* modMiddle = nullptr;
+ const Modifier* modInner;
+
+ // The following "helper" fields may optionally be used during the MicroPropsGenerator.
+ // They live here to retain memory.
+ struct {
+ ScientificModifier scientificModifier;
+ EmptyModifier emptyWeakModifier{false};
+ EmptyModifier emptyStrongModifier{true};
+ MultiplierFormatHandler multiplier;
+ } helpers;
+
+
+ MicroProps() = default;
+
+ MicroProps(const MicroProps& other) = default;
+
+ MicroProps& operator=(const MicroProps& other) = default;
+
+ void processQuantity(DecimalQuantity&, MicroProps& micros, UErrorCode& status) const U_OVERRIDE {
+ (void) status;
+ if (this == &micros) {
+ // Unsafe path: no need to perform a copy.
+ U_ASSERT(!exhausted);
+ micros.exhausted = true;
+ U_ASSERT(exhausted);
+ } else {
+ // Safe path: copy self into the output micros.
+ micros = *this;
+ }
+ }
+
+ private:
+ // Internal fields:
+ bool exhausted = false;
+};
+
+} // namespace impl
+} // namespace number
+U_NAMESPACE_END
+
+#endif // __NUMBER_MICROPROPS_H__
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_modifiers.cpp b/contrib/libs/icu/i18n/number_modifiers.cpp
index fb9ac8f650..3becb7ba85 100644
--- a/contrib/libs/icu/i18n/number_modifiers.cpp
+++ b/contrib/libs/icu/i18n/number_modifiers.cpp
@@ -1,485 +1,485 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "umutex.h"
-#include "ucln_cmn.h"
-#include "ucln_in.h"
-#include "number_modifiers.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-namespace {
-
-// TODO: This is copied from simpleformatter.cpp
-const int32_t ARG_NUM_LIMIT = 0x100;
-
-// These are the default currency spacing UnicodeSets in CLDR.
-// Pre-compute them for performance.
-// The Java unit test testCurrencySpacingPatternStability() will start failing if these change in CLDR.
-icu::UInitOnce gDefaultCurrencySpacingInitOnce = U_INITONCE_INITIALIZER;
-
-UnicodeSet *UNISET_DIGIT = nullptr;
-UnicodeSet *UNISET_NOTS = nullptr;
-
-UBool U_CALLCONV cleanupDefaultCurrencySpacing() {
- delete UNISET_DIGIT;
- UNISET_DIGIT = nullptr;
- delete UNISET_NOTS;
- UNISET_NOTS = nullptr;
- gDefaultCurrencySpacingInitOnce.reset();
- return TRUE;
-}
-
-void U_CALLCONV initDefaultCurrencySpacing(UErrorCode &status) {
- ucln_i18n_registerCleanup(UCLN_I18N_CURRENCY_SPACING, cleanupDefaultCurrencySpacing);
- UNISET_DIGIT = new UnicodeSet(UnicodeString(u"[:digit:]"), status);
- UNISET_NOTS = new UnicodeSet(UnicodeString(u"[:^S:]"), status);
- if (UNISET_DIGIT == nullptr || UNISET_NOTS == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- UNISET_DIGIT->freeze();
- UNISET_NOTS->freeze();
-}
-
-} // namespace
-
-
-Modifier::~Modifier() = default;
-
-Modifier::Parameters::Parameters()
- : obj(nullptr) {}
-
-Modifier::Parameters::Parameters(
- const ModifierStore* _obj, Signum _signum, StandardPlural::Form _plural)
- : obj(_obj), signum(_signum), plural(_plural) {}
-
-ModifierStore::~ModifierStore() = default;
-
-AdoptingModifierStore::~AdoptingModifierStore() {
- for (const Modifier *mod : mods) {
- delete mod;
- }
-}
-
-
-int32_t ConstantAffixModifier::apply(FormattedStringBuilder &output, int leftIndex, int rightIndex,
- UErrorCode &status) const {
- // Insert the suffix first since inserting the prefix will change the rightIndex
- int length = output.insert(rightIndex, fSuffix, fField, status);
- length += output.insert(leftIndex, fPrefix, fField, status);
- return length;
-}
-
-int32_t ConstantAffixModifier::getPrefixLength() const {
- return fPrefix.length();
-}
-
-int32_t ConstantAffixModifier::getCodePointCount() const {
- return fPrefix.countChar32() + fSuffix.countChar32();
-}
-
-bool ConstantAffixModifier::isStrong() const {
- return fStrong;
-}
-
-bool ConstantAffixModifier::containsField(Field field) const {
- (void)field;
- // This method is not currently used.
- UPRV_UNREACHABLE;
-}
-
-void ConstantAffixModifier::getParameters(Parameters& output) const {
- (void)output;
- // This method is not currently used.
- UPRV_UNREACHABLE;
-}
-
-bool ConstantAffixModifier::semanticallyEquivalent(const Modifier& other) const {
- auto* _other = dynamic_cast<const ConstantAffixModifier*>(&other);
- if (_other == nullptr) {
- return false;
- }
- return fPrefix == _other->fPrefix
- && fSuffix == _other->fSuffix
- && fField == _other->fField
- && fStrong == _other->fStrong;
-}
-
-
-SimpleModifier::SimpleModifier(const SimpleFormatter &simpleFormatter, Field field, bool strong)
- : SimpleModifier(simpleFormatter, field, strong, {}) {}
-
-SimpleModifier::SimpleModifier(const SimpleFormatter &simpleFormatter, Field field, bool strong,
- const Modifier::Parameters parameters)
- : fCompiledPattern(simpleFormatter.compiledPattern), fField(field), fStrong(strong),
- fParameters(parameters) {
- int32_t argLimit = SimpleFormatter::getArgumentLimit(
- fCompiledPattern.getBuffer(), fCompiledPattern.length());
- if (argLimit == 0) {
- // No arguments in compiled pattern
- fPrefixLength = fCompiledPattern.charAt(1) - ARG_NUM_LIMIT;
- U_ASSERT(2 + fPrefixLength == fCompiledPattern.length());
- // Set suffixOffset = -1 to indicate no arguments in compiled pattern.
- fSuffixOffset = -1;
- fSuffixLength = 0;
- } else {
- U_ASSERT(argLimit == 1);
- if (fCompiledPattern.charAt(1) != 0) {
- // Found prefix
- fPrefixLength = fCompiledPattern.charAt(1) - ARG_NUM_LIMIT;
- fSuffixOffset = 3 + fPrefixLength;
- } else {
- // No prefix
- fPrefixLength = 0;
- fSuffixOffset = 2;
- }
- if (3 + fPrefixLength < fCompiledPattern.length()) {
- // Found suffix
- fSuffixLength = fCompiledPattern.charAt(fSuffixOffset) - ARG_NUM_LIMIT;
- } else {
- // No suffix
- fSuffixLength = 0;
- }
- }
-}
-
-SimpleModifier::SimpleModifier()
- : fField(kUndefinedField), fStrong(false), fPrefixLength(0), fSuffixLength(0) {
-}
-
-int32_t SimpleModifier::apply(FormattedStringBuilder &output, int leftIndex, int rightIndex,
- UErrorCode &status) const {
- return formatAsPrefixSuffix(output, leftIndex, rightIndex, status);
-}
-
-int32_t SimpleModifier::getPrefixLength() const {
- return fPrefixLength;
-}
-
-int32_t SimpleModifier::getCodePointCount() const {
- int32_t count = 0;
- if (fPrefixLength > 0) {
- count += fCompiledPattern.countChar32(2, fPrefixLength);
- }
- if (fSuffixLength > 0) {
- count += fCompiledPattern.countChar32(1 + fSuffixOffset, fSuffixLength);
- }
- return count;
-}
-
-bool SimpleModifier::isStrong() const {
- return fStrong;
-}
-
-bool SimpleModifier::containsField(Field field) const {
- (void)field;
- // This method is not currently used.
- UPRV_UNREACHABLE;
-}
-
-void SimpleModifier::getParameters(Parameters& output) const {
- output = fParameters;
-}
-
-bool SimpleModifier::semanticallyEquivalent(const Modifier& other) const {
- auto* _other = dynamic_cast<const SimpleModifier*>(&other);
- if (_other == nullptr) {
- return false;
- }
- if (fParameters.obj != nullptr) {
- return fParameters.obj == _other->fParameters.obj;
- }
- return fCompiledPattern == _other->fCompiledPattern
- && fField == _other->fField
- && fStrong == _other->fStrong;
-}
-
-
-int32_t
-SimpleModifier::formatAsPrefixSuffix(FormattedStringBuilder &result, int32_t startIndex, int32_t endIndex,
- UErrorCode &status) const {
- if (fSuffixOffset == -1 && fPrefixLength + fSuffixLength > 0) {
- // There is no argument for the inner number; overwrite the entire segment with our string.
- return result.splice(startIndex, endIndex, fCompiledPattern, 2, 2 + fPrefixLength, fField, status);
- } else {
- if (fPrefixLength > 0) {
- result.insert(startIndex, fCompiledPattern, 2, 2 + fPrefixLength, fField, status);
- }
- if (fSuffixLength > 0) {
- result.insert(
- endIndex + fPrefixLength,
- fCompiledPattern,
- 1 + fSuffixOffset,
- 1 + fSuffixOffset + fSuffixLength,
- fField,
- status);
- }
- return fPrefixLength + fSuffixLength;
- }
-}
-
-
-int32_t
-SimpleModifier::formatTwoArgPattern(const SimpleFormatter& compiled, FormattedStringBuilder& result,
- int32_t index, int32_t* outPrefixLength, int32_t* outSuffixLength,
- Field field, UErrorCode& status) {
- const UnicodeString& compiledPattern = compiled.compiledPattern;
- int32_t argLimit = SimpleFormatter::getArgumentLimit(
- compiledPattern.getBuffer(), compiledPattern.length());
- if (argLimit != 2) {
- status = U_INTERNAL_PROGRAM_ERROR;
- return 0;
- }
- int32_t offset = 1; // offset into compiledPattern
- int32_t length = 0; // chars added to result
-
- int32_t prefixLength = compiledPattern.charAt(offset);
- offset++;
- if (prefixLength < ARG_NUM_LIMIT) {
- // No prefix
- prefixLength = 0;
- } else {
- prefixLength -= ARG_NUM_LIMIT;
- result.insert(index + length, compiledPattern, offset, offset + prefixLength, field, status);
- offset += prefixLength;
- length += prefixLength;
- offset++;
- }
-
- int32_t infixLength = compiledPattern.charAt(offset);
- offset++;
- if (infixLength < ARG_NUM_LIMIT) {
- // No infix
- infixLength = 0;
- } else {
- infixLength -= ARG_NUM_LIMIT;
- result.insert(index + length, compiledPattern, offset, offset + infixLength, field, status);
- offset += infixLength;
- length += infixLength;
- offset++;
- }
-
- int32_t suffixLength;
- if (offset == compiledPattern.length()) {
- // No suffix
- suffixLength = 0;
- } else {
- suffixLength = compiledPattern.charAt(offset) - ARG_NUM_LIMIT;
- offset++;
- result.insert(index + length, compiledPattern, offset, offset + suffixLength, field, status);
- length += suffixLength;
- }
-
- *outPrefixLength = prefixLength;
- *outSuffixLength = suffixLength;
-
- return length;
-}
-
-
-int32_t ConstantMultiFieldModifier::apply(FormattedStringBuilder &output, int leftIndex, int rightIndex,
- UErrorCode &status) const {
- int32_t length = output.insert(leftIndex, fPrefix, status);
- if (fOverwrite) {
- length += output.splice(
- leftIndex + length,
- rightIndex + length,
- UnicodeString(), 0, 0,
- kUndefinedField, status);
- }
- length += output.insert(rightIndex + length, fSuffix, status);
- return length;
-}
-
-int32_t ConstantMultiFieldModifier::getPrefixLength() const {
- return fPrefix.length();
-}
-
-int32_t ConstantMultiFieldModifier::getCodePointCount() const {
- return fPrefix.codePointCount() + fSuffix.codePointCount();
-}
-
-bool ConstantMultiFieldModifier::isStrong() const {
- return fStrong;
-}
-
-bool ConstantMultiFieldModifier::containsField(Field field) const {
- return fPrefix.containsField(field) || fSuffix.containsField(field);
-}
-
-void ConstantMultiFieldModifier::getParameters(Parameters& output) const {
- output = fParameters;
-}
-
-bool ConstantMultiFieldModifier::semanticallyEquivalent(const Modifier& other) const {
- auto* _other = dynamic_cast<const ConstantMultiFieldModifier*>(&other);
- if (_other == nullptr) {
- return false;
- }
- if (fParameters.obj != nullptr) {
- return fParameters.obj == _other->fParameters.obj;
- }
- return fPrefix.contentEquals(_other->fPrefix)
- && fSuffix.contentEquals(_other->fSuffix)
- && fOverwrite == _other->fOverwrite
- && fStrong == _other->fStrong;
-}
-
-
-CurrencySpacingEnabledModifier::CurrencySpacingEnabledModifier(const FormattedStringBuilder &prefix,
- const FormattedStringBuilder &suffix,
- bool overwrite,
- bool strong,
- const DecimalFormatSymbols &symbols,
- UErrorCode &status)
- : ConstantMultiFieldModifier(prefix, suffix, overwrite, strong) {
- // Check for currency spacing. Do not build the UnicodeSets unless there is
- // a currency code point at a boundary.
- if (prefix.length() > 0 && prefix.fieldAt(prefix.length() - 1) == Field(UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD)) {
- int prefixCp = prefix.getLastCodePoint();
- UnicodeSet prefixUnicodeSet = getUnicodeSet(symbols, IN_CURRENCY, PREFIX, status);
- if (prefixUnicodeSet.contains(prefixCp)) {
- fAfterPrefixUnicodeSet = getUnicodeSet(symbols, IN_NUMBER, PREFIX, status);
- fAfterPrefixUnicodeSet.freeze();
- fAfterPrefixInsert = getInsertString(symbols, PREFIX, status);
- } else {
- fAfterPrefixUnicodeSet.setToBogus();
- fAfterPrefixInsert.setToBogus();
- }
- } else {
- fAfterPrefixUnicodeSet.setToBogus();
- fAfterPrefixInsert.setToBogus();
- }
- if (suffix.length() > 0 && suffix.fieldAt(0) == Field(UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD)) {
- int suffixCp = suffix.getFirstCodePoint();
- UnicodeSet suffixUnicodeSet = getUnicodeSet(symbols, IN_CURRENCY, SUFFIX, status);
- if (suffixUnicodeSet.contains(suffixCp)) {
- fBeforeSuffixUnicodeSet = getUnicodeSet(symbols, IN_NUMBER, SUFFIX, status);
- fBeforeSuffixUnicodeSet.freeze();
- fBeforeSuffixInsert = getInsertString(symbols, SUFFIX, status);
- } else {
- fBeforeSuffixUnicodeSet.setToBogus();
- fBeforeSuffixInsert.setToBogus();
- }
- } else {
- fBeforeSuffixUnicodeSet.setToBogus();
- fBeforeSuffixInsert.setToBogus();
- }
-}
-
-int32_t CurrencySpacingEnabledModifier::apply(FormattedStringBuilder &output, int leftIndex, int rightIndex,
- UErrorCode &status) const {
- // Currency spacing logic
- int length = 0;
- if (rightIndex - leftIndex > 0 && !fAfterPrefixUnicodeSet.isBogus() &&
- fAfterPrefixUnicodeSet.contains(output.codePointAt(leftIndex))) {
- // TODO: Should we use the CURRENCY field here?
- length += output.insert(
- leftIndex,
- fAfterPrefixInsert,
- kUndefinedField,
- status);
- }
- if (rightIndex - leftIndex > 0 && !fBeforeSuffixUnicodeSet.isBogus() &&
- fBeforeSuffixUnicodeSet.contains(output.codePointBefore(rightIndex))) {
- // TODO: Should we use the CURRENCY field here?
- length += output.insert(
- rightIndex + length,
- fBeforeSuffixInsert,
- kUndefinedField,
- status);
- }
-
- // Call super for the remaining logic
- length += ConstantMultiFieldModifier::apply(output, leftIndex, rightIndex + length, status);
- return length;
-}
-
-int32_t
-CurrencySpacingEnabledModifier::applyCurrencySpacing(FormattedStringBuilder &output, int32_t prefixStart,
- int32_t prefixLen, int32_t suffixStart,
- int32_t suffixLen,
- const DecimalFormatSymbols &symbols,
- UErrorCode &status) {
- int length = 0;
- bool hasPrefix = (prefixLen > 0);
- bool hasSuffix = (suffixLen > 0);
- bool hasNumber = (suffixStart - prefixStart - prefixLen > 0); // could be empty string
- if (hasPrefix && hasNumber) {
- length += applyCurrencySpacingAffix(output, prefixStart + prefixLen, PREFIX, symbols, status);
- }
- if (hasSuffix && hasNumber) {
- length += applyCurrencySpacingAffix(output, suffixStart + length, SUFFIX, symbols, status);
- }
- return length;
-}
-
-int32_t
-CurrencySpacingEnabledModifier::applyCurrencySpacingAffix(FormattedStringBuilder &output, int32_t index,
- EAffix affix,
- const DecimalFormatSymbols &symbols,
- UErrorCode &status) {
- // NOTE: For prefix, output.fieldAt(index-1) gets the last field type in the prefix.
- // This works even if the last code point in the prefix is 2 code units because the
- // field value gets populated to both indices in the field array.
- Field affixField = (affix == PREFIX) ? output.fieldAt(index - 1) : output.fieldAt(index);
- if (affixField != Field(UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD)) {
- return 0;
- }
- int affixCp = (affix == PREFIX) ? output.codePointBefore(index) : output.codePointAt(index);
- UnicodeSet affixUniset = getUnicodeSet(symbols, IN_CURRENCY, affix, status);
- if (!affixUniset.contains(affixCp)) {
- return 0;
- }
- int numberCp = (affix == PREFIX) ? output.codePointAt(index) : output.codePointBefore(index);
- UnicodeSet numberUniset = getUnicodeSet(symbols, IN_NUMBER, affix, status);
- if (!numberUniset.contains(numberCp)) {
- return 0;
- }
- UnicodeString spacingString = getInsertString(symbols, affix, status);
-
- // NOTE: This next line *inserts* the spacing string, triggering an arraycopy.
- // It would be more efficient if this could be done before affixes were attached,
- // so that it could be prepended/appended instead of inserted.
- // However, the build code path is more efficient, and this is the most natural
- // place to put currency spacing in the non-build code path.
- // TODO: Should we use the CURRENCY field here?
- return output.insert(index, spacingString, kUndefinedField, status);
-}
-
-UnicodeSet
-CurrencySpacingEnabledModifier::getUnicodeSet(const DecimalFormatSymbols &symbols, EPosition position,
- EAffix affix, UErrorCode &status) {
- // Ensure the static defaults are initialized:
- umtx_initOnce(gDefaultCurrencySpacingInitOnce, &initDefaultCurrencySpacing, status);
- if (U_FAILURE(status)) {
- return UnicodeSet();
- }
-
- const UnicodeString& pattern = symbols.getPatternForCurrencySpacing(
- position == IN_CURRENCY ? UNUM_CURRENCY_MATCH : UNUM_CURRENCY_SURROUNDING_MATCH,
- affix == SUFFIX,
- status);
- if (pattern.compare(u"[:digit:]", -1) == 0) {
- return *UNISET_DIGIT;
- } else if (pattern.compare(u"[:^S:]", -1) == 0) {
- return *UNISET_NOTS;
- } else {
- return UnicodeSet(pattern, status);
- }
-}
-
-UnicodeString
-CurrencySpacingEnabledModifier::getInsertString(const DecimalFormatSymbols &symbols, EAffix affix,
- UErrorCode &status) {
- return symbols.getPatternForCurrencySpacing(UNUM_CURRENCY_INSERT, affix == SUFFIX, status);
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "umutex.h"
+#include "ucln_cmn.h"
+#include "ucln_in.h"
+#include "number_modifiers.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+namespace {
+
+// TODO: This is copied from simpleformatter.cpp
+const int32_t ARG_NUM_LIMIT = 0x100;
+
+// These are the default currency spacing UnicodeSets in CLDR.
+// Pre-compute them for performance.
+// The Java unit test testCurrencySpacingPatternStability() will start failing if these change in CLDR.
+icu::UInitOnce gDefaultCurrencySpacingInitOnce = U_INITONCE_INITIALIZER;
+
+UnicodeSet *UNISET_DIGIT = nullptr;
+UnicodeSet *UNISET_NOTS = nullptr;
+
+UBool U_CALLCONV cleanupDefaultCurrencySpacing() {
+ delete UNISET_DIGIT;
+ UNISET_DIGIT = nullptr;
+ delete UNISET_NOTS;
+ UNISET_NOTS = nullptr;
+ gDefaultCurrencySpacingInitOnce.reset();
+ return TRUE;
+}
+
+void U_CALLCONV initDefaultCurrencySpacing(UErrorCode &status) {
+ ucln_i18n_registerCleanup(UCLN_I18N_CURRENCY_SPACING, cleanupDefaultCurrencySpacing);
+ UNISET_DIGIT = new UnicodeSet(UnicodeString(u"[:digit:]"), status);
+ UNISET_NOTS = new UnicodeSet(UnicodeString(u"[:^S:]"), status);
+ if (UNISET_DIGIT == nullptr || UNISET_NOTS == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ UNISET_DIGIT->freeze();
+ UNISET_NOTS->freeze();
+}
+
+} // namespace
+
+
+Modifier::~Modifier() = default;
+
+Modifier::Parameters::Parameters()
+ : obj(nullptr) {}
+
+Modifier::Parameters::Parameters(
+ const ModifierStore* _obj, Signum _signum, StandardPlural::Form _plural)
+ : obj(_obj), signum(_signum), plural(_plural) {}
+
+ModifierStore::~ModifierStore() = default;
+
+AdoptingModifierStore::~AdoptingModifierStore() {
+ for (const Modifier *mod : mods) {
+ delete mod;
+ }
+}
+
+
+int32_t ConstantAffixModifier::apply(FormattedStringBuilder &output, int leftIndex, int rightIndex,
+ UErrorCode &status) const {
+ // Insert the suffix first since inserting the prefix will change the rightIndex
+ int length = output.insert(rightIndex, fSuffix, fField, status);
+ length += output.insert(leftIndex, fPrefix, fField, status);
+ return length;
+}
+
+int32_t ConstantAffixModifier::getPrefixLength() const {
+ return fPrefix.length();
+}
+
+int32_t ConstantAffixModifier::getCodePointCount() const {
+ return fPrefix.countChar32() + fSuffix.countChar32();
+}
+
+bool ConstantAffixModifier::isStrong() const {
+ return fStrong;
+}
+
+bool ConstantAffixModifier::containsField(Field field) const {
+ (void)field;
+ // This method is not currently used.
+ UPRV_UNREACHABLE;
+}
+
+void ConstantAffixModifier::getParameters(Parameters& output) const {
+ (void)output;
+ // This method is not currently used.
+ UPRV_UNREACHABLE;
+}
+
+bool ConstantAffixModifier::semanticallyEquivalent(const Modifier& other) const {
+ auto* _other = dynamic_cast<const ConstantAffixModifier*>(&other);
+ if (_other == nullptr) {
+ return false;
+ }
+ return fPrefix == _other->fPrefix
+ && fSuffix == _other->fSuffix
+ && fField == _other->fField
+ && fStrong == _other->fStrong;
+}
+
+
+SimpleModifier::SimpleModifier(const SimpleFormatter &simpleFormatter, Field field, bool strong)
+ : SimpleModifier(simpleFormatter, field, strong, {}) {}
+
+SimpleModifier::SimpleModifier(const SimpleFormatter &simpleFormatter, Field field, bool strong,
+ const Modifier::Parameters parameters)
+ : fCompiledPattern(simpleFormatter.compiledPattern), fField(field), fStrong(strong),
+ fParameters(parameters) {
+ int32_t argLimit = SimpleFormatter::getArgumentLimit(
+ fCompiledPattern.getBuffer(), fCompiledPattern.length());
+ if (argLimit == 0) {
+ // No arguments in compiled pattern
+ fPrefixLength = fCompiledPattern.charAt(1) - ARG_NUM_LIMIT;
+ U_ASSERT(2 + fPrefixLength == fCompiledPattern.length());
+ // Set suffixOffset = -1 to indicate no arguments in compiled pattern.
+ fSuffixOffset = -1;
+ fSuffixLength = 0;
+ } else {
+ U_ASSERT(argLimit == 1);
+ if (fCompiledPattern.charAt(1) != 0) {
+ // Found prefix
+ fPrefixLength = fCompiledPattern.charAt(1) - ARG_NUM_LIMIT;
+ fSuffixOffset = 3 + fPrefixLength;
+ } else {
+ // No prefix
+ fPrefixLength = 0;
+ fSuffixOffset = 2;
+ }
+ if (3 + fPrefixLength < fCompiledPattern.length()) {
+ // Found suffix
+ fSuffixLength = fCompiledPattern.charAt(fSuffixOffset) - ARG_NUM_LIMIT;
+ } else {
+ // No suffix
+ fSuffixLength = 0;
+ }
+ }
+}
+
+SimpleModifier::SimpleModifier()
+ : fField(kUndefinedField), fStrong(false), fPrefixLength(0), fSuffixLength(0) {
+}
+
+int32_t SimpleModifier::apply(FormattedStringBuilder &output, int leftIndex, int rightIndex,
+ UErrorCode &status) const {
+ return formatAsPrefixSuffix(output, leftIndex, rightIndex, status);
+}
+
+int32_t SimpleModifier::getPrefixLength() const {
+ return fPrefixLength;
+}
+
+int32_t SimpleModifier::getCodePointCount() const {
+ int32_t count = 0;
+ if (fPrefixLength > 0) {
+ count += fCompiledPattern.countChar32(2, fPrefixLength);
+ }
+ if (fSuffixLength > 0) {
+ count += fCompiledPattern.countChar32(1 + fSuffixOffset, fSuffixLength);
+ }
+ return count;
+}
+
+bool SimpleModifier::isStrong() const {
+ return fStrong;
+}
+
+bool SimpleModifier::containsField(Field field) const {
+ (void)field;
+ // This method is not currently used.
+ UPRV_UNREACHABLE;
+}
+
+void SimpleModifier::getParameters(Parameters& output) const {
+ output = fParameters;
+}
+
+bool SimpleModifier::semanticallyEquivalent(const Modifier& other) const {
+ auto* _other = dynamic_cast<const SimpleModifier*>(&other);
+ if (_other == nullptr) {
+ return false;
+ }
+ if (fParameters.obj != nullptr) {
+ return fParameters.obj == _other->fParameters.obj;
+ }
+ return fCompiledPattern == _other->fCompiledPattern
+ && fField == _other->fField
+ && fStrong == _other->fStrong;
+}
+
+
+int32_t
+SimpleModifier::formatAsPrefixSuffix(FormattedStringBuilder &result, int32_t startIndex, int32_t endIndex,
+ UErrorCode &status) const {
+ if (fSuffixOffset == -1 && fPrefixLength + fSuffixLength > 0) {
+ // There is no argument for the inner number; overwrite the entire segment with our string.
+ return result.splice(startIndex, endIndex, fCompiledPattern, 2, 2 + fPrefixLength, fField, status);
+ } else {
+ if (fPrefixLength > 0) {
+ result.insert(startIndex, fCompiledPattern, 2, 2 + fPrefixLength, fField, status);
+ }
+ if (fSuffixLength > 0) {
+ result.insert(
+ endIndex + fPrefixLength,
+ fCompiledPattern,
+ 1 + fSuffixOffset,
+ 1 + fSuffixOffset + fSuffixLength,
+ fField,
+ status);
+ }
+ return fPrefixLength + fSuffixLength;
+ }
+}
+
+
+int32_t
+SimpleModifier::formatTwoArgPattern(const SimpleFormatter& compiled, FormattedStringBuilder& result,
+ int32_t index, int32_t* outPrefixLength, int32_t* outSuffixLength,
+ Field field, UErrorCode& status) {
+ const UnicodeString& compiledPattern = compiled.compiledPattern;
+ int32_t argLimit = SimpleFormatter::getArgumentLimit(
+ compiledPattern.getBuffer(), compiledPattern.length());
+ if (argLimit != 2) {
+ status = U_INTERNAL_PROGRAM_ERROR;
+ return 0;
+ }
+ int32_t offset = 1; // offset into compiledPattern
+ int32_t length = 0; // chars added to result
+
+ int32_t prefixLength = compiledPattern.charAt(offset);
+ offset++;
+ if (prefixLength < ARG_NUM_LIMIT) {
+ // No prefix
+ prefixLength = 0;
+ } else {
+ prefixLength -= ARG_NUM_LIMIT;
+ result.insert(index + length, compiledPattern, offset, offset + prefixLength, field, status);
+ offset += prefixLength;
+ length += prefixLength;
+ offset++;
+ }
+
+ int32_t infixLength = compiledPattern.charAt(offset);
+ offset++;
+ if (infixLength < ARG_NUM_LIMIT) {
+ // No infix
+ infixLength = 0;
+ } else {
+ infixLength -= ARG_NUM_LIMIT;
+ result.insert(index + length, compiledPattern, offset, offset + infixLength, field, status);
+ offset += infixLength;
+ length += infixLength;
+ offset++;
+ }
+
+ int32_t suffixLength;
+ if (offset == compiledPattern.length()) {
+ // No suffix
+ suffixLength = 0;
+ } else {
+ suffixLength = compiledPattern.charAt(offset) - ARG_NUM_LIMIT;
+ offset++;
+ result.insert(index + length, compiledPattern, offset, offset + suffixLength, field, status);
+ length += suffixLength;
+ }
+
+ *outPrefixLength = prefixLength;
+ *outSuffixLength = suffixLength;
+
+ return length;
+}
+
+
+int32_t ConstantMultiFieldModifier::apply(FormattedStringBuilder &output, int leftIndex, int rightIndex,
+ UErrorCode &status) const {
+ int32_t length = output.insert(leftIndex, fPrefix, status);
+ if (fOverwrite) {
+ length += output.splice(
+ leftIndex + length,
+ rightIndex + length,
+ UnicodeString(), 0, 0,
+ kUndefinedField, status);
+ }
+ length += output.insert(rightIndex + length, fSuffix, status);
+ return length;
+}
+
+int32_t ConstantMultiFieldModifier::getPrefixLength() const {
+ return fPrefix.length();
+}
+
+int32_t ConstantMultiFieldModifier::getCodePointCount() const {
+ return fPrefix.codePointCount() + fSuffix.codePointCount();
+}
+
+bool ConstantMultiFieldModifier::isStrong() const {
+ return fStrong;
+}
+
+bool ConstantMultiFieldModifier::containsField(Field field) const {
+ return fPrefix.containsField(field) || fSuffix.containsField(field);
+}
+
+void ConstantMultiFieldModifier::getParameters(Parameters& output) const {
+ output = fParameters;
+}
+
+bool ConstantMultiFieldModifier::semanticallyEquivalent(const Modifier& other) const {
+ auto* _other = dynamic_cast<const ConstantMultiFieldModifier*>(&other);
+ if (_other == nullptr) {
+ return false;
+ }
+ if (fParameters.obj != nullptr) {
+ return fParameters.obj == _other->fParameters.obj;
+ }
+ return fPrefix.contentEquals(_other->fPrefix)
+ && fSuffix.contentEquals(_other->fSuffix)
+ && fOverwrite == _other->fOverwrite
+ && fStrong == _other->fStrong;
+}
+
+
+CurrencySpacingEnabledModifier::CurrencySpacingEnabledModifier(const FormattedStringBuilder &prefix,
+ const FormattedStringBuilder &suffix,
+ bool overwrite,
+ bool strong,
+ const DecimalFormatSymbols &symbols,
+ UErrorCode &status)
+ : ConstantMultiFieldModifier(prefix, suffix, overwrite, strong) {
+ // Check for currency spacing. Do not build the UnicodeSets unless there is
+ // a currency code point at a boundary.
+ if (prefix.length() > 0 && prefix.fieldAt(prefix.length() - 1) == Field(UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD)) {
+ int prefixCp = prefix.getLastCodePoint();
+ UnicodeSet prefixUnicodeSet = getUnicodeSet(symbols, IN_CURRENCY, PREFIX, status);
+ if (prefixUnicodeSet.contains(prefixCp)) {
+ fAfterPrefixUnicodeSet = getUnicodeSet(symbols, IN_NUMBER, PREFIX, status);
+ fAfterPrefixUnicodeSet.freeze();
+ fAfterPrefixInsert = getInsertString(symbols, PREFIX, status);
+ } else {
+ fAfterPrefixUnicodeSet.setToBogus();
+ fAfterPrefixInsert.setToBogus();
+ }
+ } else {
+ fAfterPrefixUnicodeSet.setToBogus();
+ fAfterPrefixInsert.setToBogus();
+ }
+ if (suffix.length() > 0 && suffix.fieldAt(0) == Field(UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD)) {
+ int suffixCp = suffix.getFirstCodePoint();
+ UnicodeSet suffixUnicodeSet = getUnicodeSet(symbols, IN_CURRENCY, SUFFIX, status);
+ if (suffixUnicodeSet.contains(suffixCp)) {
+ fBeforeSuffixUnicodeSet = getUnicodeSet(symbols, IN_NUMBER, SUFFIX, status);
+ fBeforeSuffixUnicodeSet.freeze();
+ fBeforeSuffixInsert = getInsertString(symbols, SUFFIX, status);
+ } else {
+ fBeforeSuffixUnicodeSet.setToBogus();
+ fBeforeSuffixInsert.setToBogus();
+ }
+ } else {
+ fBeforeSuffixUnicodeSet.setToBogus();
+ fBeforeSuffixInsert.setToBogus();
+ }
+}
+
+int32_t CurrencySpacingEnabledModifier::apply(FormattedStringBuilder &output, int leftIndex, int rightIndex,
+ UErrorCode &status) const {
+ // Currency spacing logic
+ int length = 0;
+ if (rightIndex - leftIndex > 0 && !fAfterPrefixUnicodeSet.isBogus() &&
+ fAfterPrefixUnicodeSet.contains(output.codePointAt(leftIndex))) {
+ // TODO: Should we use the CURRENCY field here?
+ length += output.insert(
+ leftIndex,
+ fAfterPrefixInsert,
+ kUndefinedField,
+ status);
+ }
+ if (rightIndex - leftIndex > 0 && !fBeforeSuffixUnicodeSet.isBogus() &&
+ fBeforeSuffixUnicodeSet.contains(output.codePointBefore(rightIndex))) {
+ // TODO: Should we use the CURRENCY field here?
+ length += output.insert(
+ rightIndex + length,
+ fBeforeSuffixInsert,
+ kUndefinedField,
+ status);
+ }
+
+ // Call super for the remaining logic
+ length += ConstantMultiFieldModifier::apply(output, leftIndex, rightIndex + length, status);
+ return length;
+}
+
+int32_t
+CurrencySpacingEnabledModifier::applyCurrencySpacing(FormattedStringBuilder &output, int32_t prefixStart,
+ int32_t prefixLen, int32_t suffixStart,
+ int32_t suffixLen,
+ const DecimalFormatSymbols &symbols,
+ UErrorCode &status) {
+ int length = 0;
+ bool hasPrefix = (prefixLen > 0);
+ bool hasSuffix = (suffixLen > 0);
+ bool hasNumber = (suffixStart - prefixStart - prefixLen > 0); // could be empty string
+ if (hasPrefix && hasNumber) {
+ length += applyCurrencySpacingAffix(output, prefixStart + prefixLen, PREFIX, symbols, status);
+ }
+ if (hasSuffix && hasNumber) {
+ length += applyCurrencySpacingAffix(output, suffixStart + length, SUFFIX, symbols, status);
+ }
+ return length;
+}
+
+int32_t
+CurrencySpacingEnabledModifier::applyCurrencySpacingAffix(FormattedStringBuilder &output, int32_t index,
+ EAffix affix,
+ const DecimalFormatSymbols &symbols,
+ UErrorCode &status) {
+ // NOTE: For prefix, output.fieldAt(index-1) gets the last field type in the prefix.
+ // This works even if the last code point in the prefix is 2 code units because the
+ // field value gets populated to both indices in the field array.
+ Field affixField = (affix == PREFIX) ? output.fieldAt(index - 1) : output.fieldAt(index);
+ if (affixField != Field(UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD)) {
+ return 0;
+ }
+ int affixCp = (affix == PREFIX) ? output.codePointBefore(index) : output.codePointAt(index);
+ UnicodeSet affixUniset = getUnicodeSet(symbols, IN_CURRENCY, affix, status);
+ if (!affixUniset.contains(affixCp)) {
+ return 0;
+ }
+ int numberCp = (affix == PREFIX) ? output.codePointAt(index) : output.codePointBefore(index);
+ UnicodeSet numberUniset = getUnicodeSet(symbols, IN_NUMBER, affix, status);
+ if (!numberUniset.contains(numberCp)) {
+ return 0;
+ }
+ UnicodeString spacingString = getInsertString(symbols, affix, status);
+
+ // NOTE: This next line *inserts* the spacing string, triggering an arraycopy.
+ // It would be more efficient if this could be done before affixes were attached,
+ // so that it could be prepended/appended instead of inserted.
+ // However, the build code path is more efficient, and this is the most natural
+ // place to put currency spacing in the non-build code path.
+ // TODO: Should we use the CURRENCY field here?
+ return output.insert(index, spacingString, kUndefinedField, status);
+}
+
+UnicodeSet
+CurrencySpacingEnabledModifier::getUnicodeSet(const DecimalFormatSymbols &symbols, EPosition position,
+ EAffix affix, UErrorCode &status) {
+ // Ensure the static defaults are initialized:
+ umtx_initOnce(gDefaultCurrencySpacingInitOnce, &initDefaultCurrencySpacing, status);
+ if (U_FAILURE(status)) {
+ return UnicodeSet();
+ }
+
+ const UnicodeString& pattern = symbols.getPatternForCurrencySpacing(
+ position == IN_CURRENCY ? UNUM_CURRENCY_MATCH : UNUM_CURRENCY_SURROUNDING_MATCH,
+ affix == SUFFIX,
+ status);
+ if (pattern.compare(u"[:digit:]", -1) == 0) {
+ return *UNISET_DIGIT;
+ } else if (pattern.compare(u"[:^S:]", -1) == 0) {
+ return *UNISET_NOTS;
+ } else {
+ return UnicodeSet(pattern, status);
+ }
+}
+
+UnicodeString
+CurrencySpacingEnabledModifier::getInsertString(const DecimalFormatSymbols &symbols, EAffix affix,
+ UErrorCode &status) {
+ return symbols.getPatternForCurrencySpacing(UNUM_CURRENCY_INSERT, affix == SUFFIX, status);
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_modifiers.h b/contrib/libs/icu/i18n/number_modifiers.h
index 760fde12f3..375254310c 100644
--- a/contrib/libs/icu/i18n/number_modifiers.h
+++ b/contrib/libs/icu/i18n/number_modifiers.h
@@ -1,338 +1,338 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMBER_MODIFIERS_H__
-#define __NUMBER_MODIFIERS_H__
-
-#include <algorithm>
-#include <cstdint>
-#include "unicode/uniset.h"
-#include "unicode/simpleformatter.h"
-#include "standardplural.h"
-#include "formatted_string_builder.h"
-#include "number_types.h"
-
-U_NAMESPACE_BEGIN namespace number {
-namespace impl {
-
-/**
- * The canonical implementation of {@link Modifier}, containing a prefix and suffix string.
- * TODO: This is not currently being used by real code and could be removed.
- */
-class U_I18N_API ConstantAffixModifier : public Modifier, public UObject {
- public:
- ConstantAffixModifier(const UnicodeString &prefix, const UnicodeString &suffix, Field field,
- bool strong)
- : fPrefix(prefix), fSuffix(suffix), fField(field), fStrong(strong) {}
-
- int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex,
- UErrorCode &status) const U_OVERRIDE;
-
- int32_t getPrefixLength() const U_OVERRIDE;
-
- int32_t getCodePointCount() const U_OVERRIDE;
-
- bool isStrong() const U_OVERRIDE;
-
- bool containsField(Field field) const U_OVERRIDE;
-
- void getParameters(Parameters& output) const U_OVERRIDE;
-
- bool semanticallyEquivalent(const Modifier& other) const U_OVERRIDE;
-
- private:
- UnicodeString fPrefix;
- UnicodeString fSuffix;
- Field fField;
- bool fStrong;
-};
-
-/**
- * The second primary implementation of {@link Modifier}, this one consuming a {@link SimpleFormatter}
- * pattern.
- */
-class U_I18N_API SimpleModifier : public Modifier, public UMemory {
- public:
- SimpleModifier(const SimpleFormatter &simpleFormatter, Field field, bool strong);
-
- SimpleModifier(const SimpleFormatter &simpleFormatter, Field field, bool strong,
- const Modifier::Parameters parameters);
-
- // Default constructor for LongNameHandler.h
- SimpleModifier();
-
- int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex,
- UErrorCode &status) const U_OVERRIDE;
-
- int32_t getPrefixLength() const U_OVERRIDE;
-
- int32_t getCodePointCount() const U_OVERRIDE;
-
- bool isStrong() const U_OVERRIDE;
-
- bool containsField(Field field) const U_OVERRIDE;
-
- void getParameters(Parameters& output) const U_OVERRIDE;
-
- bool semanticallyEquivalent(const Modifier& other) const U_OVERRIDE;
-
- /**
- * TODO: This belongs in SimpleFormatterImpl. The only reason I haven't moved it there yet is because
- * FormattedStringBuilder is an internal class and SimpleFormatterImpl feels like it should not depend on it.
- *
- * <p>
- * Formats a value that is already stored inside the StringBuilder <code>result</code> between the indices
- * <code>startIndex</code> and <code>endIndex</code> by inserting characters before the start index and after the
- * end index.
- *
- * <p>
- * This is well-defined only for patterns with exactly one argument.
- *
- * @param result
- * The StringBuilder containing the value argument.
- * @param startIndex
- * The left index of the value within the string builder.
- * @param endIndex
- * The right index of the value within the string builder.
- * @return The number of characters (UTF-16 code points) that were added to the StringBuilder.
- */
- int32_t
- formatAsPrefixSuffix(FormattedStringBuilder& result, int32_t startIndex, int32_t endIndex,
- UErrorCode& status) const;
-
- /**
- * TODO: Like above, this belongs with the rest of the SimpleFormatterImpl code.
- * I put it here so that the SimpleFormatter uses in FormattedStringBuilder are near each other.
- *
- * <p>
- * Applies the compiled two-argument pattern to the FormattedStringBuilder.
- *
- * <p>
- * This method is optimized for the case where the prefix and suffix are often empty, such as
- * in the range pattern like "{0}-{1}".
- */
- static int32_t
- formatTwoArgPattern(const SimpleFormatter& compiled, FormattedStringBuilder& result,
- int32_t index, int32_t* outPrefixLength, int32_t* outSuffixLength,
- Field field, UErrorCode& status);
-
- private:
- UnicodeString fCompiledPattern;
- Field fField;
- bool fStrong = false;
- int32_t fPrefixLength = 0;
- int32_t fSuffixOffset = -1;
- int32_t fSuffixLength = 0;
- Modifier::Parameters fParameters;
-};
-
-/**
- * An implementation of {@link Modifier} that allows for multiple types of fields in the same modifier. Constructed
- * based on the contents of two {@link FormattedStringBuilder} instances (one for the prefix, one for the suffix).
- */
-class U_I18N_API ConstantMultiFieldModifier : public Modifier, public UMemory {
- public:
- ConstantMultiFieldModifier(
- const FormattedStringBuilder &prefix,
- const FormattedStringBuilder &suffix,
- bool overwrite,
- bool strong,
- const Modifier::Parameters parameters)
- : fPrefix(prefix),
- fSuffix(suffix),
- fOverwrite(overwrite),
- fStrong(strong),
- fParameters(parameters) {}
-
- ConstantMultiFieldModifier(
- const FormattedStringBuilder &prefix,
- const FormattedStringBuilder &suffix,
- bool overwrite,
- bool strong)
- : fPrefix(prefix),
- fSuffix(suffix),
- fOverwrite(overwrite),
- fStrong(strong) {}
-
- int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex,
- UErrorCode &status) const U_OVERRIDE;
-
- int32_t getPrefixLength() const U_OVERRIDE;
-
- int32_t getCodePointCount() const U_OVERRIDE;
-
- bool isStrong() const U_OVERRIDE;
-
- bool containsField(Field field) const U_OVERRIDE;
-
- void getParameters(Parameters& output) const U_OVERRIDE;
-
- bool semanticallyEquivalent(const Modifier& other) const U_OVERRIDE;
-
- protected:
- // NOTE: In Java, these are stored as array pointers. In C++, the FormattedStringBuilder is stored by
- // value and is treated internally as immutable.
- FormattedStringBuilder fPrefix;
- FormattedStringBuilder fSuffix;
- bool fOverwrite;
- bool fStrong;
- Modifier::Parameters fParameters;
-};
-
-/** Identical to {@link ConstantMultiFieldModifier}, but supports currency spacing. */
-class U_I18N_API CurrencySpacingEnabledModifier : public ConstantMultiFieldModifier {
- public:
- /** Safe code path */
- CurrencySpacingEnabledModifier(
- const FormattedStringBuilder &prefix,
- const FormattedStringBuilder &suffix,
- bool overwrite,
- bool strong,
- const DecimalFormatSymbols &symbols,
- UErrorCode &status);
-
- int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex,
- UErrorCode &status) const U_OVERRIDE;
-
- /** Unsafe code path */
- static int32_t
- applyCurrencySpacing(FormattedStringBuilder &output, int32_t prefixStart, int32_t prefixLen,
- int32_t suffixStart, int32_t suffixLen, const DecimalFormatSymbols &symbols,
- UErrorCode &status);
-
- private:
- UnicodeSet fAfterPrefixUnicodeSet;
- UnicodeString fAfterPrefixInsert;
- UnicodeSet fBeforeSuffixUnicodeSet;
- UnicodeString fBeforeSuffixInsert;
-
- enum EAffix {
- PREFIX, SUFFIX
- };
-
- enum EPosition {
- IN_CURRENCY, IN_NUMBER
- };
-
- /** Unsafe code path */
- static int32_t applyCurrencySpacingAffix(FormattedStringBuilder &output, int32_t index, EAffix affix,
- const DecimalFormatSymbols &symbols, UErrorCode &status);
-
- static UnicodeSet
- getUnicodeSet(const DecimalFormatSymbols &symbols, EPosition position, EAffix affix,
- UErrorCode &status);
-
- static UnicodeString
- getInsertString(const DecimalFormatSymbols &symbols, EAffix affix, UErrorCode &status);
-};
-
-/** A Modifier that does not do anything. */
-class U_I18N_API EmptyModifier : public Modifier, public UMemory {
- public:
- explicit EmptyModifier(bool isStrong) : fStrong(isStrong) {}
-
- int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex,
- UErrorCode &status) const U_OVERRIDE {
- (void)output;
- (void)leftIndex;
- (void)rightIndex;
- (void)status;
- return 0;
- }
-
- int32_t getPrefixLength() const U_OVERRIDE {
- return 0;
- }
-
- int32_t getCodePointCount() const U_OVERRIDE {
- return 0;
- }
-
- bool isStrong() const U_OVERRIDE {
- return fStrong;
- }
-
- bool containsField(Field field) const U_OVERRIDE {
- (void)field;
- return false;
- }
-
- void getParameters(Parameters& output) const U_OVERRIDE {
- output.obj = nullptr;
- }
-
- bool semanticallyEquivalent(const Modifier& other) const U_OVERRIDE {
- return other.getCodePointCount() == 0;
- }
-
- private:
- bool fStrong;
-};
-
-/**
- * This implementation of ModifierStore adopts Modifer pointers.
- */
-class U_I18N_API AdoptingModifierStore : public ModifierStore, public UMemory {
- public:
- virtual ~AdoptingModifierStore();
-
- static constexpr StandardPlural::Form DEFAULT_STANDARD_PLURAL = StandardPlural::OTHER;
-
- AdoptingModifierStore() = default;
-
- // No copying!
- AdoptingModifierStore(const AdoptingModifierStore &other) = delete;
-
- /**
- * Sets the Modifier with the specified signum and plural form.
- */
- void adoptModifier(Signum signum, StandardPlural::Form plural, const Modifier *mod) {
- U_ASSERT(mods[getModIndex(signum, plural)] == nullptr);
- mods[getModIndex(signum, plural)] = mod;
- }
-
- /**
- * Sets the Modifier with the specified signum.
- * The modifier will apply to all plural forms.
- */
- void adoptModifierWithoutPlural(Signum signum, const Modifier *mod) {
- U_ASSERT(mods[getModIndex(signum, DEFAULT_STANDARD_PLURAL)] == nullptr);
- mods[getModIndex(signum, DEFAULT_STANDARD_PLURAL)] = mod;
- }
-
- /** Returns a reference to the modifier; no ownership change. */
- const Modifier *getModifier(Signum signum, StandardPlural::Form plural) const U_OVERRIDE {
- const Modifier* modifier = mods[getModIndex(signum, plural)];
- if (modifier == nullptr && plural != DEFAULT_STANDARD_PLURAL) {
- modifier = mods[getModIndex(signum, DEFAULT_STANDARD_PLURAL)];
- }
- return modifier;
- }
-
- /** Returns a reference to the modifier; no ownership change. */
- const Modifier *getModifierWithoutPlural(Signum signum) const {
- return mods[getModIndex(signum, DEFAULT_STANDARD_PLURAL)];
- }
-
- private:
- // NOTE: mods is zero-initialized (to nullptr)
- const Modifier *mods[4 * StandardPlural::COUNT] = {};
-
- inline static int32_t getModIndex(Signum signum, StandardPlural::Form plural) {
- U_ASSERT(signum >= 0 && signum < SIGNUM_COUNT);
- U_ASSERT(plural >= 0 && plural < StandardPlural::COUNT);
- return static_cast<int32_t>(plural) * SIGNUM_COUNT + signum;
- }
-};
-
-} // namespace impl
-} // namespace number
-U_NAMESPACE_END
-
-
-#endif //__NUMBER_MODIFIERS_H__
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMBER_MODIFIERS_H__
+#define __NUMBER_MODIFIERS_H__
+
+#include <algorithm>
+#include <cstdint>
+#include "unicode/uniset.h"
+#include "unicode/simpleformatter.h"
+#include "standardplural.h"
+#include "formatted_string_builder.h"
+#include "number_types.h"
+
+U_NAMESPACE_BEGIN namespace number {
+namespace impl {
+
+/**
+ * The canonical implementation of {@link Modifier}, containing a prefix and suffix string.
+ * TODO: This is not currently being used by real code and could be removed.
+ */
+class U_I18N_API ConstantAffixModifier : public Modifier, public UObject {
+ public:
+ ConstantAffixModifier(const UnicodeString &prefix, const UnicodeString &suffix, Field field,
+ bool strong)
+ : fPrefix(prefix), fSuffix(suffix), fField(field), fStrong(strong) {}
+
+ int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex,
+ UErrorCode &status) const U_OVERRIDE;
+
+ int32_t getPrefixLength() const U_OVERRIDE;
+
+ int32_t getCodePointCount() const U_OVERRIDE;
+
+ bool isStrong() const U_OVERRIDE;
+
+ bool containsField(Field field) const U_OVERRIDE;
+
+ void getParameters(Parameters& output) const U_OVERRIDE;
+
+ bool semanticallyEquivalent(const Modifier& other) const U_OVERRIDE;
+
+ private:
+ UnicodeString fPrefix;
+ UnicodeString fSuffix;
+ Field fField;
+ bool fStrong;
+};
+
+/**
+ * The second primary implementation of {@link Modifier}, this one consuming a {@link SimpleFormatter}
+ * pattern.
+ */
+class U_I18N_API SimpleModifier : public Modifier, public UMemory {
+ public:
+ SimpleModifier(const SimpleFormatter &simpleFormatter, Field field, bool strong);
+
+ SimpleModifier(const SimpleFormatter &simpleFormatter, Field field, bool strong,
+ const Modifier::Parameters parameters);
+
+ // Default constructor for LongNameHandler.h
+ SimpleModifier();
+
+ int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex,
+ UErrorCode &status) const U_OVERRIDE;
+
+ int32_t getPrefixLength() const U_OVERRIDE;
+
+ int32_t getCodePointCount() const U_OVERRIDE;
+
+ bool isStrong() const U_OVERRIDE;
+
+ bool containsField(Field field) const U_OVERRIDE;
+
+ void getParameters(Parameters& output) const U_OVERRIDE;
+
+ bool semanticallyEquivalent(const Modifier& other) const U_OVERRIDE;
+
+ /**
+ * TODO: This belongs in SimpleFormatterImpl. The only reason I haven't moved it there yet is because
+ * FormattedStringBuilder is an internal class and SimpleFormatterImpl feels like it should not depend on it.
+ *
+ * <p>
+ * Formats a value that is already stored inside the StringBuilder <code>result</code> between the indices
+ * <code>startIndex</code> and <code>endIndex</code> by inserting characters before the start index and after the
+ * end index.
+ *
+ * <p>
+ * This is well-defined only for patterns with exactly one argument.
+ *
+ * @param result
+ * The StringBuilder containing the value argument.
+ * @param startIndex
+ * The left index of the value within the string builder.
+ * @param endIndex
+ * The right index of the value within the string builder.
+ * @return The number of characters (UTF-16 code points) that were added to the StringBuilder.
+ */
+ int32_t
+ formatAsPrefixSuffix(FormattedStringBuilder& result, int32_t startIndex, int32_t endIndex,
+ UErrorCode& status) const;
+
+ /**
+ * TODO: Like above, this belongs with the rest of the SimpleFormatterImpl code.
+ * I put it here so that the SimpleFormatter uses in FormattedStringBuilder are near each other.
+ *
+ * <p>
+ * Applies the compiled two-argument pattern to the FormattedStringBuilder.
+ *
+ * <p>
+ * This method is optimized for the case where the prefix and suffix are often empty, such as
+ * in the range pattern like "{0}-{1}".
+ */
+ static int32_t
+ formatTwoArgPattern(const SimpleFormatter& compiled, FormattedStringBuilder& result,
+ int32_t index, int32_t* outPrefixLength, int32_t* outSuffixLength,
+ Field field, UErrorCode& status);
+
+ private:
+ UnicodeString fCompiledPattern;
+ Field fField;
+ bool fStrong = false;
+ int32_t fPrefixLength = 0;
+ int32_t fSuffixOffset = -1;
+ int32_t fSuffixLength = 0;
+ Modifier::Parameters fParameters;
+};
+
+/**
+ * An implementation of {@link Modifier} that allows for multiple types of fields in the same modifier. Constructed
+ * based on the contents of two {@link FormattedStringBuilder} instances (one for the prefix, one for the suffix).
+ */
+class U_I18N_API ConstantMultiFieldModifier : public Modifier, public UMemory {
+ public:
+ ConstantMultiFieldModifier(
+ const FormattedStringBuilder &prefix,
+ const FormattedStringBuilder &suffix,
+ bool overwrite,
+ bool strong,
+ const Modifier::Parameters parameters)
+ : fPrefix(prefix),
+ fSuffix(suffix),
+ fOverwrite(overwrite),
+ fStrong(strong),
+ fParameters(parameters) {}
+
+ ConstantMultiFieldModifier(
+ const FormattedStringBuilder &prefix,
+ const FormattedStringBuilder &suffix,
+ bool overwrite,
+ bool strong)
+ : fPrefix(prefix),
+ fSuffix(suffix),
+ fOverwrite(overwrite),
+ fStrong(strong) {}
+
+ int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex,
+ UErrorCode &status) const U_OVERRIDE;
+
+ int32_t getPrefixLength() const U_OVERRIDE;
+
+ int32_t getCodePointCount() const U_OVERRIDE;
+
+ bool isStrong() const U_OVERRIDE;
+
+ bool containsField(Field field) const U_OVERRIDE;
+
+ void getParameters(Parameters& output) const U_OVERRIDE;
+
+ bool semanticallyEquivalent(const Modifier& other) const U_OVERRIDE;
+
+ protected:
+ // NOTE: In Java, these are stored as array pointers. In C++, the FormattedStringBuilder is stored by
+ // value and is treated internally as immutable.
+ FormattedStringBuilder fPrefix;
+ FormattedStringBuilder fSuffix;
+ bool fOverwrite;
+ bool fStrong;
+ Modifier::Parameters fParameters;
+};
+
+/** Identical to {@link ConstantMultiFieldModifier}, but supports currency spacing. */
+class U_I18N_API CurrencySpacingEnabledModifier : public ConstantMultiFieldModifier {
+ public:
+ /** Safe code path */
+ CurrencySpacingEnabledModifier(
+ const FormattedStringBuilder &prefix,
+ const FormattedStringBuilder &suffix,
+ bool overwrite,
+ bool strong,
+ const DecimalFormatSymbols &symbols,
+ UErrorCode &status);
+
+ int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex,
+ UErrorCode &status) const U_OVERRIDE;
+
+ /** Unsafe code path */
+ static int32_t
+ applyCurrencySpacing(FormattedStringBuilder &output, int32_t prefixStart, int32_t prefixLen,
+ int32_t suffixStart, int32_t suffixLen, const DecimalFormatSymbols &symbols,
+ UErrorCode &status);
+
+ private:
+ UnicodeSet fAfterPrefixUnicodeSet;
+ UnicodeString fAfterPrefixInsert;
+ UnicodeSet fBeforeSuffixUnicodeSet;
+ UnicodeString fBeforeSuffixInsert;
+
+ enum EAffix {
+ PREFIX, SUFFIX
+ };
+
+ enum EPosition {
+ IN_CURRENCY, IN_NUMBER
+ };
+
+ /** Unsafe code path */
+ static int32_t applyCurrencySpacingAffix(FormattedStringBuilder &output, int32_t index, EAffix affix,
+ const DecimalFormatSymbols &symbols, UErrorCode &status);
+
+ static UnicodeSet
+ getUnicodeSet(const DecimalFormatSymbols &symbols, EPosition position, EAffix affix,
+ UErrorCode &status);
+
+ static UnicodeString
+ getInsertString(const DecimalFormatSymbols &symbols, EAffix affix, UErrorCode &status);
+};
+
+/** A Modifier that does not do anything. */
+class U_I18N_API EmptyModifier : public Modifier, public UMemory {
+ public:
+ explicit EmptyModifier(bool isStrong) : fStrong(isStrong) {}
+
+ int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex,
+ UErrorCode &status) const U_OVERRIDE {
+ (void)output;
+ (void)leftIndex;
+ (void)rightIndex;
+ (void)status;
+ return 0;
+ }
+
+ int32_t getPrefixLength() const U_OVERRIDE {
+ return 0;
+ }
+
+ int32_t getCodePointCount() const U_OVERRIDE {
+ return 0;
+ }
+
+ bool isStrong() const U_OVERRIDE {
+ return fStrong;
+ }
+
+ bool containsField(Field field) const U_OVERRIDE {
+ (void)field;
+ return false;
+ }
+
+ void getParameters(Parameters& output) const U_OVERRIDE {
+ output.obj = nullptr;
+ }
+
+ bool semanticallyEquivalent(const Modifier& other) const U_OVERRIDE {
+ return other.getCodePointCount() == 0;
+ }
+
+ private:
+ bool fStrong;
+};
+
+/**
+ * This implementation of ModifierStore adopts Modifer pointers.
+ */
+class U_I18N_API AdoptingModifierStore : public ModifierStore, public UMemory {
+ public:
+ virtual ~AdoptingModifierStore();
+
+ static constexpr StandardPlural::Form DEFAULT_STANDARD_PLURAL = StandardPlural::OTHER;
+
+ AdoptingModifierStore() = default;
+
+ // No copying!
+ AdoptingModifierStore(const AdoptingModifierStore &other) = delete;
+
+ /**
+ * Sets the Modifier with the specified signum and plural form.
+ */
+ void adoptModifier(Signum signum, StandardPlural::Form plural, const Modifier *mod) {
+ U_ASSERT(mods[getModIndex(signum, plural)] == nullptr);
+ mods[getModIndex(signum, plural)] = mod;
+ }
+
+ /**
+ * Sets the Modifier with the specified signum.
+ * The modifier will apply to all plural forms.
+ */
+ void adoptModifierWithoutPlural(Signum signum, const Modifier *mod) {
+ U_ASSERT(mods[getModIndex(signum, DEFAULT_STANDARD_PLURAL)] == nullptr);
+ mods[getModIndex(signum, DEFAULT_STANDARD_PLURAL)] = mod;
+ }
+
+ /** Returns a reference to the modifier; no ownership change. */
+ const Modifier *getModifier(Signum signum, StandardPlural::Form plural) const U_OVERRIDE {
+ const Modifier* modifier = mods[getModIndex(signum, plural)];
+ if (modifier == nullptr && plural != DEFAULT_STANDARD_PLURAL) {
+ modifier = mods[getModIndex(signum, DEFAULT_STANDARD_PLURAL)];
+ }
+ return modifier;
+ }
+
+ /** Returns a reference to the modifier; no ownership change. */
+ const Modifier *getModifierWithoutPlural(Signum signum) const {
+ return mods[getModIndex(signum, DEFAULT_STANDARD_PLURAL)];
+ }
+
+ private:
+ // NOTE: mods is zero-initialized (to nullptr)
+ const Modifier *mods[4 * StandardPlural::COUNT] = {};
+
+ inline static int32_t getModIndex(Signum signum, StandardPlural::Form plural) {
+ U_ASSERT(signum >= 0 && signum < SIGNUM_COUNT);
+ U_ASSERT(plural >= 0 && plural < StandardPlural::COUNT);
+ return static_cast<int32_t>(plural) * SIGNUM_COUNT + signum;
+ }
+};
+
+} // namespace impl
+} // namespace number
+U_NAMESPACE_END
+
+
+#endif //__NUMBER_MODIFIERS_H__
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_multiplier.cpp b/contrib/libs/icu/i18n/number_multiplier.cpp
index f97a757403..8f07e548de 100644
--- a/contrib/libs/icu/i18n/number_multiplier.cpp
+++ b/contrib/libs/icu/i18n/number_multiplier.cpp
@@ -1,159 +1,159 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include "number_decnum.h"
-#include "number_types.h"
-#include "number_multiplier.h"
-#include "numparse_validators.h"
-#include "number_utils.h"
-#include "decNumber.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-using namespace icu::numparse::impl;
-
-
-Scale::Scale(int32_t magnitude, DecNum* arbitraryToAdopt)
- : fMagnitude(magnitude), fArbitrary(arbitraryToAdopt), fError(U_ZERO_ERROR) {
- if (fArbitrary != nullptr) {
- // Attempt to convert the DecNum to a magnitude multiplier.
- fArbitrary->normalize();
- if (fArbitrary->getRawDecNumber()->digits == 1 && fArbitrary->getRawDecNumber()->lsu[0] == 1 &&
- !fArbitrary->isNegative()) {
- // Success!
- fMagnitude += fArbitrary->getRawDecNumber()->exponent;
- delete fArbitrary;
- fArbitrary = nullptr;
- }
- }
-}
-
-Scale::Scale(const Scale& other)
- : fMagnitude(other.fMagnitude), fArbitrary(nullptr), fError(other.fError) {
- if (other.fArbitrary != nullptr) {
- UErrorCode localStatus = U_ZERO_ERROR;
- fArbitrary = new DecNum(*other.fArbitrary, localStatus);
- }
-}
-
-Scale& Scale::operator=(const Scale& other) {
- fMagnitude = other.fMagnitude;
- if (other.fArbitrary != nullptr) {
- UErrorCode localStatus = U_ZERO_ERROR;
- fArbitrary = new DecNum(*other.fArbitrary, localStatus);
- } else {
- fArbitrary = nullptr;
- }
- fError = other.fError;
- return *this;
-}
-
-Scale::Scale(Scale&& src) U_NOEXCEPT
- : fMagnitude(src.fMagnitude), fArbitrary(src.fArbitrary), fError(src.fError) {
- // Take ownership away from src if necessary
- src.fArbitrary = nullptr;
-}
-
-Scale& Scale::operator=(Scale&& src) U_NOEXCEPT {
- fMagnitude = src.fMagnitude;
- if (fArbitrary != nullptr) {
- delete fArbitrary;
- }
- fArbitrary = src.fArbitrary;
- fError = src.fError;
- // Take ownership away from src if necessary
- src.fArbitrary = nullptr;
- return *this;
-}
-
-Scale::~Scale() {
- delete fArbitrary;
-}
-
-
-Scale Scale::none() {
- return {0, nullptr};
-}
-
-Scale Scale::powerOfTen(int32_t power) {
- return {power, nullptr};
-}
-
-Scale Scale::byDecimal(StringPiece multiplicand) {
- UErrorCode localError = U_ZERO_ERROR;
- LocalPointer<DecNum> decnum(new DecNum(), localError);
- if (U_FAILURE(localError)) {
- return {localError};
- }
- decnum->setTo(multiplicand, localError);
- if (U_FAILURE(localError)) {
- return {localError};
- }
- return {0, decnum.orphan()};
-}
-
-Scale Scale::byDouble(double multiplicand) {
- UErrorCode localError = U_ZERO_ERROR;
- LocalPointer<DecNum> decnum(new DecNum(), localError);
- if (U_FAILURE(localError)) {
- return {localError};
- }
- decnum->setTo(multiplicand, localError);
- if (U_FAILURE(localError)) {
- return {localError};
- }
- return {0, decnum.orphan()};
-}
-
-Scale Scale::byDoubleAndPowerOfTen(double multiplicand, int32_t power) {
- UErrorCode localError = U_ZERO_ERROR;
- LocalPointer<DecNum> decnum(new DecNum(), localError);
- if (U_FAILURE(localError)) {
- return {localError};
- }
- decnum->setTo(multiplicand, localError);
- if (U_FAILURE(localError)) {
- return {localError};
- }
- return {power, decnum.orphan()};
-}
-
-void Scale::applyTo(impl::DecimalQuantity& quantity) const {
- quantity.adjustMagnitude(fMagnitude);
- if (fArbitrary != nullptr) {
- UErrorCode localStatus = U_ZERO_ERROR;
- quantity.multiplyBy(*fArbitrary, localStatus);
- }
-}
-
-void Scale::applyReciprocalTo(impl::DecimalQuantity& quantity) const {
- quantity.adjustMagnitude(-fMagnitude);
- if (fArbitrary != nullptr) {
- UErrorCode localStatus = U_ZERO_ERROR;
- quantity.divideBy(*fArbitrary, localStatus);
- }
-}
-
-
-void
-MultiplierFormatHandler::setAndChain(const Scale& multiplier, const MicroPropsGenerator* parent) {
- fMultiplier = multiplier;
- fParent = parent;
-}
-
-void MultiplierFormatHandler::processQuantity(DecimalQuantity& quantity, MicroProps& micros,
- UErrorCode& status) const {
- fParent->processQuantity(quantity, micros, status);
- fMultiplier.applyTo(quantity);
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include "number_decnum.h"
+#include "number_types.h"
+#include "number_multiplier.h"
+#include "numparse_validators.h"
+#include "number_utils.h"
+#include "decNumber.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+using namespace icu::numparse::impl;
+
+
+Scale::Scale(int32_t magnitude, DecNum* arbitraryToAdopt)
+ : fMagnitude(magnitude), fArbitrary(arbitraryToAdopt), fError(U_ZERO_ERROR) {
+ if (fArbitrary != nullptr) {
+ // Attempt to convert the DecNum to a magnitude multiplier.
+ fArbitrary->normalize();
+ if (fArbitrary->getRawDecNumber()->digits == 1 && fArbitrary->getRawDecNumber()->lsu[0] == 1 &&
+ !fArbitrary->isNegative()) {
+ // Success!
+ fMagnitude += fArbitrary->getRawDecNumber()->exponent;
+ delete fArbitrary;
+ fArbitrary = nullptr;
+ }
+ }
+}
+
+Scale::Scale(const Scale& other)
+ : fMagnitude(other.fMagnitude), fArbitrary(nullptr), fError(other.fError) {
+ if (other.fArbitrary != nullptr) {
+ UErrorCode localStatus = U_ZERO_ERROR;
+ fArbitrary = new DecNum(*other.fArbitrary, localStatus);
+ }
+}
+
+Scale& Scale::operator=(const Scale& other) {
+ fMagnitude = other.fMagnitude;
+ if (other.fArbitrary != nullptr) {
+ UErrorCode localStatus = U_ZERO_ERROR;
+ fArbitrary = new DecNum(*other.fArbitrary, localStatus);
+ } else {
+ fArbitrary = nullptr;
+ }
+ fError = other.fError;
+ return *this;
+}
+
+Scale::Scale(Scale&& src) U_NOEXCEPT
+ : fMagnitude(src.fMagnitude), fArbitrary(src.fArbitrary), fError(src.fError) {
+ // Take ownership away from src if necessary
+ src.fArbitrary = nullptr;
+}
+
+Scale& Scale::operator=(Scale&& src) U_NOEXCEPT {
+ fMagnitude = src.fMagnitude;
+ if (fArbitrary != nullptr) {
+ delete fArbitrary;
+ }
+ fArbitrary = src.fArbitrary;
+ fError = src.fError;
+ // Take ownership away from src if necessary
+ src.fArbitrary = nullptr;
+ return *this;
+}
+
+Scale::~Scale() {
+ delete fArbitrary;
+}
+
+
+Scale Scale::none() {
+ return {0, nullptr};
+}
+
+Scale Scale::powerOfTen(int32_t power) {
+ return {power, nullptr};
+}
+
+Scale Scale::byDecimal(StringPiece multiplicand) {
+ UErrorCode localError = U_ZERO_ERROR;
+ LocalPointer<DecNum> decnum(new DecNum(), localError);
+ if (U_FAILURE(localError)) {
+ return {localError};
+ }
+ decnum->setTo(multiplicand, localError);
+ if (U_FAILURE(localError)) {
+ return {localError};
+ }
+ return {0, decnum.orphan()};
+}
+
+Scale Scale::byDouble(double multiplicand) {
+ UErrorCode localError = U_ZERO_ERROR;
+ LocalPointer<DecNum> decnum(new DecNum(), localError);
+ if (U_FAILURE(localError)) {
+ return {localError};
+ }
+ decnum->setTo(multiplicand, localError);
+ if (U_FAILURE(localError)) {
+ return {localError};
+ }
+ return {0, decnum.orphan()};
+}
+
+Scale Scale::byDoubleAndPowerOfTen(double multiplicand, int32_t power) {
+ UErrorCode localError = U_ZERO_ERROR;
+ LocalPointer<DecNum> decnum(new DecNum(), localError);
+ if (U_FAILURE(localError)) {
+ return {localError};
+ }
+ decnum->setTo(multiplicand, localError);
+ if (U_FAILURE(localError)) {
+ return {localError};
+ }
+ return {power, decnum.orphan()};
+}
+
+void Scale::applyTo(impl::DecimalQuantity& quantity) const {
+ quantity.adjustMagnitude(fMagnitude);
+ if (fArbitrary != nullptr) {
+ UErrorCode localStatus = U_ZERO_ERROR;
+ quantity.multiplyBy(*fArbitrary, localStatus);
+ }
+}
+
+void Scale::applyReciprocalTo(impl::DecimalQuantity& quantity) const {
+ quantity.adjustMagnitude(-fMagnitude);
+ if (fArbitrary != nullptr) {
+ UErrorCode localStatus = U_ZERO_ERROR;
+ quantity.divideBy(*fArbitrary, localStatus);
+ }
+}
+
+
+void
+MultiplierFormatHandler::setAndChain(const Scale& multiplier, const MicroPropsGenerator* parent) {
+ fMultiplier = multiplier;
+ fParent = parent;
+}
+
+void MultiplierFormatHandler::processQuantity(DecimalQuantity& quantity, MicroProps& micros,
+ UErrorCode& status) const {
+ fParent->processQuantity(quantity, micros, status);
+ fMultiplier.applyTo(quantity);
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_multiplier.h b/contrib/libs/icu/i18n/number_multiplier.h
index 6f4cb837ac..d8235dc601 100644
--- a/contrib/libs/icu/i18n/number_multiplier.h
+++ b/contrib/libs/icu/i18n/number_multiplier.h
@@ -1,57 +1,57 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __SOURCE_NUMBER_MULTIPLIER_H__
-#define __SOURCE_NUMBER_MULTIPLIER_H__
-
-#include "numparse_types.h"
-#include "number_decimfmtprops.h"
-
-U_NAMESPACE_BEGIN namespace number {
-namespace impl {
-
-
-/**
- * Wraps a {@link Multiplier} for use in the number formatting pipeline.
- */
-// Exported as U_I18N_API for tests
-class U_I18N_API MultiplierFormatHandler : public MicroPropsGenerator, public UMemory {
- public:
- MultiplierFormatHandler() = default; // WARNING: Leaves object in an unusable state; call setAndChain()
-
- void setAndChain(const Scale& multiplier, const MicroPropsGenerator* parent);
-
- void processQuantity(DecimalQuantity& quantity, MicroProps& micros,
- UErrorCode& status) const U_OVERRIDE;
-
- private:
- Scale fMultiplier;
- const MicroPropsGenerator *fParent;
-};
-
-
-/** Gets a Scale from a DecimalFormatProperties. In Java, defined in RoundingUtils.java */
-static inline Scale scaleFromProperties(const DecimalFormatProperties& properties) {
- int32_t magnitudeMultiplier = properties.magnitudeMultiplier + properties.multiplierScale;
- int32_t arbitraryMultiplier = properties.multiplier;
- if (magnitudeMultiplier != 0 && arbitraryMultiplier != 1) {
- return Scale::byDoubleAndPowerOfTen(arbitraryMultiplier, magnitudeMultiplier);
- } else if (magnitudeMultiplier != 0) {
- return Scale::powerOfTen(magnitudeMultiplier);
- } else if (arbitraryMultiplier != 1) {
- return Scale::byDouble(arbitraryMultiplier);
- } else {
- return Scale::none();
- }
-}
-
-
-} // namespace impl
-} // namespace number
-U_NAMESPACE_END
-
-#endif //__SOURCE_NUMBER_MULTIPLIER_H__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __SOURCE_NUMBER_MULTIPLIER_H__
+#define __SOURCE_NUMBER_MULTIPLIER_H__
+
+#include "numparse_types.h"
+#include "number_decimfmtprops.h"
+
+U_NAMESPACE_BEGIN namespace number {
+namespace impl {
+
+
+/**
+ * Wraps a {@link Multiplier} for use in the number formatting pipeline.
+ */
+// Exported as U_I18N_API for tests
+class U_I18N_API MultiplierFormatHandler : public MicroPropsGenerator, public UMemory {
+ public:
+ MultiplierFormatHandler() = default; // WARNING: Leaves object in an unusable state; call setAndChain()
+
+ void setAndChain(const Scale& multiplier, const MicroPropsGenerator* parent);
+
+ void processQuantity(DecimalQuantity& quantity, MicroProps& micros,
+ UErrorCode& status) const U_OVERRIDE;
+
+ private:
+ Scale fMultiplier;
+ const MicroPropsGenerator *fParent;
+};
+
+
+/** Gets a Scale from a DecimalFormatProperties. In Java, defined in RoundingUtils.java */
+static inline Scale scaleFromProperties(const DecimalFormatProperties& properties) {
+ int32_t magnitudeMultiplier = properties.magnitudeMultiplier + properties.multiplierScale;
+ int32_t arbitraryMultiplier = properties.multiplier;
+ if (magnitudeMultiplier != 0 && arbitraryMultiplier != 1) {
+ return Scale::byDoubleAndPowerOfTen(arbitraryMultiplier, magnitudeMultiplier);
+ } else if (magnitudeMultiplier != 0) {
+ return Scale::powerOfTen(magnitudeMultiplier);
+ } else if (arbitraryMultiplier != 1) {
+ return Scale::byDouble(arbitraryMultiplier);
+ } else {
+ return Scale::none();
+ }
+}
+
+
+} // namespace impl
+} // namespace number
+U_NAMESPACE_END
+
+#endif //__SOURCE_NUMBER_MULTIPLIER_H__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_notation.cpp b/contrib/libs/icu/i18n/number_notation.cpp
index bf6b8179d9..b3cabb57a5 100644
--- a/contrib/libs/icu/i18n/number_notation.cpp
+++ b/contrib/libs/icu/i18n/number_notation.cpp
@@ -1,88 +1,88 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/numberformatter.h"
-#include "number_types.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-
-ScientificNotation Notation::scientific() {
- // NOTE: ISO C++ does not allow C99 designated initializers.
- ScientificSettings settings;
- settings.fEngineeringInterval = 1;
- settings.fRequireMinInt = false;
- settings.fMinExponentDigits = 1;
- settings.fExponentSignDisplay = UNUM_SIGN_AUTO;
- NotationUnion union_;
- union_.scientific = settings;
- return {NTN_SCIENTIFIC, union_};
-}
-
-ScientificNotation Notation::engineering() {
- ScientificSettings settings;
- settings.fEngineeringInterval = 3;
- settings.fRequireMinInt = false;
- settings.fMinExponentDigits = 1;
- settings.fExponentSignDisplay = UNUM_SIGN_AUTO;
- NotationUnion union_;
- union_.scientific = settings;
- return {NTN_SCIENTIFIC, union_};
-}
-
-ScientificNotation::ScientificNotation(int8_t fEngineeringInterval, bool fRequireMinInt,
- impl::digits_t fMinExponentDigits,
- UNumberSignDisplay fExponentSignDisplay) {
- ScientificSettings settings;
- settings.fEngineeringInterval = fEngineeringInterval;
- settings.fRequireMinInt = fRequireMinInt;
- settings.fMinExponentDigits = fMinExponentDigits;
- settings.fExponentSignDisplay = fExponentSignDisplay;
- NotationUnion union_;
- union_.scientific = settings;
- *this = {NTN_SCIENTIFIC, union_};
-}
-
-Notation Notation::compactShort() {
- NotationUnion union_;
- union_.compactStyle = CompactStyle::UNUM_SHORT;
- return {NTN_COMPACT, union_};
-}
-
-Notation Notation::compactLong() {
- NotationUnion union_;
- union_.compactStyle = CompactStyle::UNUM_LONG;
- return {NTN_COMPACT, union_};
-}
-
-Notation Notation::simple() {
- return {};
-}
-
-ScientificNotation
-ScientificNotation::withMinExponentDigits(int32_t minExponentDigits) const {
- if (minExponentDigits >= 1 && minExponentDigits <= kMaxIntFracSig) {
- ScientificSettings settings = fUnion.scientific;
- settings.fMinExponentDigits = static_cast<digits_t>(minExponentDigits);
- NotationUnion union_ = {settings};
- return {NTN_SCIENTIFIC, union_};
- } else {
- return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
- }
-}
-
-ScientificNotation
-ScientificNotation::withExponentSignDisplay(UNumberSignDisplay exponentSignDisplay) const {
- ScientificSettings settings = fUnion.scientific;
- settings.fExponentSignDisplay = exponentSignDisplay;
- NotationUnion union_ = {settings};
- return {NTN_SCIENTIFIC, union_};
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/numberformatter.h"
+#include "number_types.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+
+ScientificNotation Notation::scientific() {
+ // NOTE: ISO C++ does not allow C99 designated initializers.
+ ScientificSettings settings;
+ settings.fEngineeringInterval = 1;
+ settings.fRequireMinInt = false;
+ settings.fMinExponentDigits = 1;
+ settings.fExponentSignDisplay = UNUM_SIGN_AUTO;
+ NotationUnion union_;
+ union_.scientific = settings;
+ return {NTN_SCIENTIFIC, union_};
+}
+
+ScientificNotation Notation::engineering() {
+ ScientificSettings settings;
+ settings.fEngineeringInterval = 3;
+ settings.fRequireMinInt = false;
+ settings.fMinExponentDigits = 1;
+ settings.fExponentSignDisplay = UNUM_SIGN_AUTO;
+ NotationUnion union_;
+ union_.scientific = settings;
+ return {NTN_SCIENTIFIC, union_};
+}
+
+ScientificNotation::ScientificNotation(int8_t fEngineeringInterval, bool fRequireMinInt,
+ impl::digits_t fMinExponentDigits,
+ UNumberSignDisplay fExponentSignDisplay) {
+ ScientificSettings settings;
+ settings.fEngineeringInterval = fEngineeringInterval;
+ settings.fRequireMinInt = fRequireMinInt;
+ settings.fMinExponentDigits = fMinExponentDigits;
+ settings.fExponentSignDisplay = fExponentSignDisplay;
+ NotationUnion union_;
+ union_.scientific = settings;
+ *this = {NTN_SCIENTIFIC, union_};
+}
+
+Notation Notation::compactShort() {
+ NotationUnion union_;
+ union_.compactStyle = CompactStyle::UNUM_SHORT;
+ return {NTN_COMPACT, union_};
+}
+
+Notation Notation::compactLong() {
+ NotationUnion union_;
+ union_.compactStyle = CompactStyle::UNUM_LONG;
+ return {NTN_COMPACT, union_};
+}
+
+Notation Notation::simple() {
+ return {};
+}
+
+ScientificNotation
+ScientificNotation::withMinExponentDigits(int32_t minExponentDigits) const {
+ if (minExponentDigits >= 1 && minExponentDigits <= kMaxIntFracSig) {
+ ScientificSettings settings = fUnion.scientific;
+ settings.fMinExponentDigits = static_cast<digits_t>(minExponentDigits);
+ NotationUnion union_ = {settings};
+ return {NTN_SCIENTIFIC, union_};
+ } else {
+ return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
+ }
+}
+
+ScientificNotation
+ScientificNotation::withExponentSignDisplay(UNumberSignDisplay exponentSignDisplay) const {
+ ScientificSettings settings = fUnion.scientific;
+ settings.fExponentSignDisplay = exponentSignDisplay;
+ NotationUnion union_ = {settings};
+ return {NTN_SCIENTIFIC, union_};
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_output.cpp b/contrib/libs/icu/i18n/number_output.cpp
index face1bb166..40192a9225 100644
--- a/contrib/libs/icu/i18n/number_output.cpp
+++ b/contrib/libs/icu/i18n/number_output.cpp
@@ -1,47 +1,47 @@
-// © 2019 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/numberformatter.h"
-#include "number_utypes.h"
-#include "util.h"
-#include "number_decimalquantity.h"
-#include "number_decnum.h"
-
-U_NAMESPACE_BEGIN
-namespace number {
-
-
-UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedNumber)
-
-#define UPRV_NOARG
-
-void FormattedNumber::toDecimalNumber(ByteSink& sink, UErrorCode& status) const {
- UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG)
- impl::DecNum decnum;
- fData->quantity.toDecNum(decnum, status);
- decnum.toString(sink, status);
-}
-
-void FormattedNumber::getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih,
- UErrorCode& status) const {
- UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG)
- fData->getAllFieldPositions(fpih, status);
-}
-
-void FormattedNumber::getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const {
- UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG)
- output = fData->quantity;
-}
-
-
-impl::UFormattedNumberData::~UFormattedNumberData() = default;
-
-
-} // namespace number
-U_NAMESPACE_END
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/numberformatter.h"
+#include "number_utypes.h"
+#include "util.h"
+#include "number_decimalquantity.h"
+#include "number_decnum.h"
+
+U_NAMESPACE_BEGIN
+namespace number {
+
+
+UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedNumber)
+
+#define UPRV_NOARG
+
+void FormattedNumber::toDecimalNumber(ByteSink& sink, UErrorCode& status) const {
+ UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG)
+ impl::DecNum decnum;
+ fData->quantity.toDecNum(decnum, status);
+ decnum.toString(sink, status);
+}
+
+void FormattedNumber::getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih,
+ UErrorCode& status) const {
+ UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG)
+ fData->getAllFieldPositions(fpih, status);
+}
+
+void FormattedNumber::getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const {
+ UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG)
+ output = fData->quantity;
+}
+
+
+impl::UFormattedNumberData::~UFormattedNumberData() = default;
+
+
+} // namespace number
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_padding.cpp b/contrib/libs/icu/i18n/number_padding.cpp
index 52fff0497b..c320c3ffb6 100644
--- a/contrib/libs/icu/i18n/number_padding.cpp
+++ b/contrib/libs/icu/i18n/number_padding.cpp
@@ -1,96 +1,96 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/numberformatter.h"
-#include "number_types.h"
-#include "formatted_string_builder.h"
-#include "number_decimfmtprops.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-namespace {
-
-int32_t
-addPaddingHelper(UChar32 paddingCp, int32_t requiredPadding, FormattedStringBuilder &string, int32_t index,
- UErrorCode &status) {
- for (int32_t i = 0; i < requiredPadding; i++) {
- // TODO: If appending to the end, this will cause actual insertion operations. Improve.
- string.insertCodePoint(index, paddingCp, kUndefinedField, status);
- }
- return U16_LENGTH(paddingCp) * requiredPadding;
-}
-
-}
-
-Padder::Padder(UChar32 cp, int32_t width, UNumberFormatPadPosition position) : fWidth(width) {
- // TODO(13034): Consider making this a string instead of code point.
- fUnion.padding.fCp = cp;
- fUnion.padding.fPosition = position;
-}
-
-Padder::Padder(int32_t width) : fWidth(width) {}
-
-Padder Padder::none() {
- return {-1};
-}
-
-Padder Padder::codePoints(UChar32 cp, int32_t targetWidth, UNumberFormatPadPosition position) {
- // TODO: Validate the code point?
- if (targetWidth >= 0) {
- return {cp, targetWidth, position};
- } else {
- return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
- }
-}
-
-Padder Padder::forProperties(const DecimalFormatProperties& properties) {
- UChar32 padCp;
- if (properties.padString.length() > 0) {
- padCp = properties.padString.char32At(0);
- } else {
- padCp = kFallbackPaddingString[0];
- }
- return {padCp, properties.formatWidth, properties.padPosition.getOrDefault(UNUM_PAD_BEFORE_PREFIX)};
-}
-
-int32_t Padder::padAndApply(const Modifier &mod1, const Modifier &mod2,
- FormattedStringBuilder &string, int32_t leftIndex, int32_t rightIndex,
- UErrorCode &status) const {
- int32_t modLength = mod1.getCodePointCount() + mod2.getCodePointCount();
- int32_t requiredPadding = fWidth - modLength - string.codePointCount();
- U_ASSERT(leftIndex == 0 &&
- rightIndex == string.length()); // fix the previous line to remove this assertion
-
- int length = 0;
- if (requiredPadding <= 0) {
- // Padding is not required.
- length += mod1.apply(string, leftIndex, rightIndex, status);
- length += mod2.apply(string, leftIndex, rightIndex + length, status);
- return length;
- }
-
- PadPosition position = fUnion.padding.fPosition;
- UChar32 paddingCp = fUnion.padding.fCp;
- if (position == UNUM_PAD_AFTER_PREFIX) {
- length += addPaddingHelper(paddingCp, requiredPadding, string, leftIndex, status);
- } else if (position == UNUM_PAD_BEFORE_SUFFIX) {
- length += addPaddingHelper(paddingCp, requiredPadding, string, rightIndex + length, status);
- }
- length += mod1.apply(string, leftIndex, rightIndex + length, status);
- length += mod2.apply(string, leftIndex, rightIndex + length, status);
- if (position == UNUM_PAD_BEFORE_PREFIX) {
- length += addPaddingHelper(paddingCp, requiredPadding, string, leftIndex, status);
- } else if (position == UNUM_PAD_AFTER_SUFFIX) {
- length += addPaddingHelper(paddingCp, requiredPadding, string, rightIndex + length, status);
- }
-
- return length;
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/numberformatter.h"
+#include "number_types.h"
+#include "formatted_string_builder.h"
+#include "number_decimfmtprops.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+namespace {
+
+int32_t
+addPaddingHelper(UChar32 paddingCp, int32_t requiredPadding, FormattedStringBuilder &string, int32_t index,
+ UErrorCode &status) {
+ for (int32_t i = 0; i < requiredPadding; i++) {
+ // TODO: If appending to the end, this will cause actual insertion operations. Improve.
+ string.insertCodePoint(index, paddingCp, kUndefinedField, status);
+ }
+ return U16_LENGTH(paddingCp) * requiredPadding;
+}
+
+}
+
+Padder::Padder(UChar32 cp, int32_t width, UNumberFormatPadPosition position) : fWidth(width) {
+ // TODO(13034): Consider making this a string instead of code point.
+ fUnion.padding.fCp = cp;
+ fUnion.padding.fPosition = position;
+}
+
+Padder::Padder(int32_t width) : fWidth(width) {}
+
+Padder Padder::none() {
+ return {-1};
+}
+
+Padder Padder::codePoints(UChar32 cp, int32_t targetWidth, UNumberFormatPadPosition position) {
+ // TODO: Validate the code point?
+ if (targetWidth >= 0) {
+ return {cp, targetWidth, position};
+ } else {
+ return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
+ }
+}
+
+Padder Padder::forProperties(const DecimalFormatProperties& properties) {
+ UChar32 padCp;
+ if (properties.padString.length() > 0) {
+ padCp = properties.padString.char32At(0);
+ } else {
+ padCp = kFallbackPaddingString[0];
+ }
+ return {padCp, properties.formatWidth, properties.padPosition.getOrDefault(UNUM_PAD_BEFORE_PREFIX)};
+}
+
+int32_t Padder::padAndApply(const Modifier &mod1, const Modifier &mod2,
+ FormattedStringBuilder &string, int32_t leftIndex, int32_t rightIndex,
+ UErrorCode &status) const {
+ int32_t modLength = mod1.getCodePointCount() + mod2.getCodePointCount();
+ int32_t requiredPadding = fWidth - modLength - string.codePointCount();
+ U_ASSERT(leftIndex == 0 &&
+ rightIndex == string.length()); // fix the previous line to remove this assertion
+
+ int length = 0;
+ if (requiredPadding <= 0) {
+ // Padding is not required.
+ length += mod1.apply(string, leftIndex, rightIndex, status);
+ length += mod2.apply(string, leftIndex, rightIndex + length, status);
+ return length;
+ }
+
+ PadPosition position = fUnion.padding.fPosition;
+ UChar32 paddingCp = fUnion.padding.fCp;
+ if (position == UNUM_PAD_AFTER_PREFIX) {
+ length += addPaddingHelper(paddingCp, requiredPadding, string, leftIndex, status);
+ } else if (position == UNUM_PAD_BEFORE_SUFFIX) {
+ length += addPaddingHelper(paddingCp, requiredPadding, string, rightIndex + length, status);
+ }
+ length += mod1.apply(string, leftIndex, rightIndex + length, status);
+ length += mod2.apply(string, leftIndex, rightIndex + length, status);
+ if (position == UNUM_PAD_BEFORE_PREFIX) {
+ length += addPaddingHelper(paddingCp, requiredPadding, string, leftIndex, status);
+ } else if (position == UNUM_PAD_AFTER_SUFFIX) {
+ length += addPaddingHelper(paddingCp, requiredPadding, string, rightIndex + length, status);
+ }
+
+ return length;
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_patternmodifier.cpp b/contrib/libs/icu/i18n/number_patternmodifier.cpp
index 8a0cd74f7f..45602942ae 100644
--- a/contrib/libs/icu/i18n/number_patternmodifier.cpp
+++ b/contrib/libs/icu/i18n/number_patternmodifier.cpp
@@ -1,330 +1,330 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "cstring.h"
-#include "number_patternmodifier.h"
-#include "unicode/dcfmtsym.h"
-#include "unicode/ucurr.h"
-#include "unicode/unistr.h"
-#include "number_microprops.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-
-AffixPatternProvider::~AffixPatternProvider() = default;
-
-
-MutablePatternModifier::MutablePatternModifier(bool isStrong)
- : fStrong(isStrong) {}
-
-void MutablePatternModifier::setPatternInfo(const AffixPatternProvider* patternInfo, Field field) {
- fPatternInfo = patternInfo;
- fField = field;
-}
-
-void MutablePatternModifier::setPatternAttributes(UNumberSignDisplay signDisplay, bool perMille) {
- fSignDisplay = signDisplay;
- fPerMilleReplacesPercent = perMille;
-}
-
-void MutablePatternModifier::setSymbols(const DecimalFormatSymbols* symbols,
- const CurrencyUnit& currency,
- const UNumberUnitWidth unitWidth,
- const PluralRules* rules,
- UErrorCode& status) {
- U_ASSERT((rules != nullptr) == needsPlurals());
- fSymbols = symbols;
- fCurrencySymbols = {currency, symbols->getLocale(), *symbols, status};
- fUnitWidth = unitWidth;
- fRules = rules;
-}
-
-void MutablePatternModifier::setNumberProperties(Signum signum, StandardPlural::Form plural) {
- fSignum = signum;
- fPlural = plural;
-}
-
-bool MutablePatternModifier::needsPlurals() const {
- UErrorCode statusLocal = U_ZERO_ERROR;
- return fPatternInfo->containsSymbolType(AffixPatternType::TYPE_CURRENCY_TRIPLE, statusLocal);
- // Silently ignore any error codes.
-}
-
-ImmutablePatternModifier* MutablePatternModifier::createImmutable(UErrorCode& status) {
- // TODO: Move StandardPlural VALUES to standardplural.h
- static const StandardPlural::Form STANDARD_PLURAL_VALUES[] = {
- StandardPlural::Form::ZERO,
- StandardPlural::Form::ONE,
- StandardPlural::Form::TWO,
- StandardPlural::Form::FEW,
- StandardPlural::Form::MANY,
- StandardPlural::Form::OTHER};
-
- auto pm = new AdoptingModifierStore();
- if (pm == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
-
- if (needsPlurals()) {
- // Slower path when we require the plural keyword.
- for (StandardPlural::Form plural : STANDARD_PLURAL_VALUES) {
- setNumberProperties(SIGNUM_POS, plural);
- pm->adoptModifier(SIGNUM_POS, plural, createConstantModifier(status));
- setNumberProperties(SIGNUM_NEG_ZERO, plural);
- pm->adoptModifier(SIGNUM_NEG_ZERO, plural, createConstantModifier(status));
- setNumberProperties(SIGNUM_POS_ZERO, plural);
- pm->adoptModifier(SIGNUM_POS_ZERO, plural, createConstantModifier(status));
- setNumberProperties(SIGNUM_NEG, plural);
- pm->adoptModifier(SIGNUM_NEG, plural, createConstantModifier(status));
- }
- if (U_FAILURE(status)) {
- delete pm;
- return nullptr;
- }
- return new ImmutablePatternModifier(pm, fRules); // adopts pm
- } else {
- // Faster path when plural keyword is not needed.
- setNumberProperties(SIGNUM_POS, StandardPlural::Form::COUNT);
- pm->adoptModifierWithoutPlural(SIGNUM_POS, createConstantModifier(status));
- setNumberProperties(SIGNUM_NEG_ZERO, StandardPlural::Form::COUNT);
- pm->adoptModifierWithoutPlural(SIGNUM_NEG_ZERO, createConstantModifier(status));
- setNumberProperties(SIGNUM_POS_ZERO, StandardPlural::Form::COUNT);
- pm->adoptModifierWithoutPlural(SIGNUM_POS_ZERO, createConstantModifier(status));
- setNumberProperties(SIGNUM_NEG, StandardPlural::Form::COUNT);
- pm->adoptModifierWithoutPlural(SIGNUM_NEG, createConstantModifier(status));
- if (U_FAILURE(status)) {
- delete pm;
- return nullptr;
- }
- return new ImmutablePatternModifier(pm, nullptr); // adopts pm
- }
-}
-
-ConstantMultiFieldModifier* MutablePatternModifier::createConstantModifier(UErrorCode& status) {
- FormattedStringBuilder a;
- FormattedStringBuilder b;
- insertPrefix(a, 0, status);
- insertSuffix(b, 0, status);
- if (fPatternInfo->hasCurrencySign()) {
- return new CurrencySpacingEnabledModifier(
- a, b, !fPatternInfo->hasBody(), fStrong, *fSymbols, status);
- } else {
- return new ConstantMultiFieldModifier(a, b, !fPatternInfo->hasBody(), fStrong);
- }
-}
-
-ImmutablePatternModifier::ImmutablePatternModifier(AdoptingModifierStore* pm, const PluralRules* rules)
- : pm(pm), rules(rules), parent(nullptr) {}
-
-void ImmutablePatternModifier::processQuantity(DecimalQuantity& quantity, MicroProps& micros,
- UErrorCode& status) const {
- parent->processQuantity(quantity, micros, status);
- micros.rounder.apply(quantity, status);
- if (micros.modMiddle != nullptr) {
- return;
- }
- applyToMicros(micros, quantity, status);
-}
-
-void ImmutablePatternModifier::applyToMicros(
- MicroProps& micros, const DecimalQuantity& quantity, UErrorCode& status) const {
- if (rules == nullptr) {
- micros.modMiddle = pm->getModifierWithoutPlural(quantity.signum());
- } else {
- StandardPlural::Form pluralForm = utils::getPluralSafe(micros.rounder, rules, quantity, status);
- micros.modMiddle = pm->getModifier(quantity.signum(), pluralForm);
- }
-}
-
-const Modifier* ImmutablePatternModifier::getModifier(Signum signum, StandardPlural::Form plural) const {
- if (rules == nullptr) {
- return pm->getModifierWithoutPlural(signum);
- } else {
- return pm->getModifier(signum, plural);
- }
-}
-
-void ImmutablePatternModifier::addToChain(const MicroPropsGenerator* parent) {
- this->parent = parent;
-}
-
-
-/** Used by the unsafe code path. */
-MicroPropsGenerator& MutablePatternModifier::addToChain(const MicroPropsGenerator* parent) {
- fParent = parent;
- return *this;
-}
-
-void MutablePatternModifier::processQuantity(DecimalQuantity& fq, MicroProps& micros,
- UErrorCode& status) const {
- fParent->processQuantity(fq, micros, status);
- micros.rounder.apply(fq, status);
- if (micros.modMiddle != nullptr) {
- return;
- }
- // The unsafe code path performs self-mutation, so we need a const_cast.
- // This method needs to be const because it overrides a const method in the parent class.
- auto nonConstThis = const_cast<MutablePatternModifier*>(this);
- if (needsPlurals()) {
- StandardPlural::Form pluralForm = utils::getPluralSafe(micros.rounder, fRules, fq, status);
- nonConstThis->setNumberProperties(fq.signum(), pluralForm);
- } else {
- nonConstThis->setNumberProperties(fq.signum(), StandardPlural::Form::COUNT);
- }
- micros.modMiddle = this;
-}
-
-int32_t MutablePatternModifier::apply(FormattedStringBuilder& output, int32_t leftIndex, int32_t rightIndex,
- UErrorCode& status) const {
- // The unsafe code path performs self-mutation, so we need a const_cast.
- // This method needs to be const because it overrides a const method in the parent class.
- auto nonConstThis = const_cast<MutablePatternModifier*>(this);
- int32_t prefixLen = nonConstThis->insertPrefix(output, leftIndex, status);
- int32_t suffixLen = nonConstThis->insertSuffix(output, rightIndex + prefixLen, status);
- // If the pattern had no decimal stem body (like #,##0.00), overwrite the value.
- int32_t overwriteLen = 0;
- if (!fPatternInfo->hasBody()) {
- overwriteLen = output.splice(
- leftIndex + prefixLen,
- rightIndex + prefixLen,
- UnicodeString(),
- 0,
- 0,
- kUndefinedField,
- status);
- }
- CurrencySpacingEnabledModifier::applyCurrencySpacing(
- output,
- leftIndex,
- prefixLen,
- rightIndex + overwriteLen + prefixLen,
- suffixLen,
- *fSymbols,
- status);
- return prefixLen + overwriteLen + suffixLen;
-}
-
-int32_t MutablePatternModifier::getPrefixLength() const {
- // The unsafe code path performs self-mutation, so we need a const_cast.
- // This method needs to be const because it overrides a const method in the parent class.
- auto nonConstThis = const_cast<MutablePatternModifier*>(this);
-
- // Enter and exit CharSequence Mode to get the length.
- UErrorCode status = U_ZERO_ERROR; // status fails only with an iilegal argument exception
- nonConstThis->prepareAffix(true);
- int result = AffixUtils::unescapedCodePointCount(currentAffix, *this, status); // prefix length
- return result;
-}
-
-int32_t MutablePatternModifier::getCodePointCount() const {
- // The unsafe code path performs self-mutation, so we need a const_cast.
- // This method needs to be const because it overrides a const method in the parent class.
- auto nonConstThis = const_cast<MutablePatternModifier*>(this);
-
- // Render the affixes to get the length
- UErrorCode status = U_ZERO_ERROR; // status fails only with an iilegal argument exception
- nonConstThis->prepareAffix(true);
- int result = AffixUtils::unescapedCodePointCount(currentAffix, *this, status); // prefix length
- nonConstThis->prepareAffix(false);
- result += AffixUtils::unescapedCodePointCount(currentAffix, *this, status); // suffix length
- return result;
-}
-
-bool MutablePatternModifier::isStrong() const {
- return fStrong;
-}
-
-bool MutablePatternModifier::containsField(Field field) const {
- (void)field;
- // This method is not currently used.
- UPRV_UNREACHABLE;
-}
-
-void MutablePatternModifier::getParameters(Parameters& output) const {
- (void)output;
- // This method is not currently used.
- UPRV_UNREACHABLE;
-}
-
-bool MutablePatternModifier::semanticallyEquivalent(const Modifier& other) const {
- (void)other;
- // This method is not currently used.
- UPRV_UNREACHABLE;
-}
-
-int32_t MutablePatternModifier::insertPrefix(FormattedStringBuilder& sb, int position, UErrorCode& status) {
- prepareAffix(true);
- int32_t length = AffixUtils::unescape(currentAffix, sb, position, *this, fField, status);
- return length;
-}
-
-int32_t MutablePatternModifier::insertSuffix(FormattedStringBuilder& sb, int position, UErrorCode& status) {
- prepareAffix(false);
- int32_t length = AffixUtils::unescape(currentAffix, sb, position, *this, fField, status);
- return length;
-}
-
-/** This method contains the heart of the logic for rendering LDML affix strings. */
-void MutablePatternModifier::prepareAffix(bool isPrefix) {
- PatternStringUtils::patternInfoToStringBuilder(
- *fPatternInfo,
- isPrefix,
- PatternStringUtils::resolveSignDisplay(fSignDisplay, fSignum),
- fPlural,
- fPerMilleReplacesPercent,
- currentAffix);
-}
-
-UnicodeString MutablePatternModifier::getSymbol(AffixPatternType type) const {
- UErrorCode localStatus = U_ZERO_ERROR;
- switch (type) {
- case AffixPatternType::TYPE_MINUS_SIGN:
- return fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kMinusSignSymbol);
- case AffixPatternType::TYPE_PLUS_SIGN:
- return fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPlusSignSymbol);
- case AffixPatternType::TYPE_PERCENT:
- return fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPercentSymbol);
- case AffixPatternType::TYPE_PERMILLE:
- return fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPerMillSymbol);
- case AffixPatternType::TYPE_CURRENCY_SINGLE: {
- // UnitWidth ISO and HIDDEN overrides the singular currency symbol.
- if (fUnitWidth == UNumberUnitWidth::UNUM_UNIT_WIDTH_ISO_CODE) {
- return fCurrencySymbols.getIntlCurrencySymbol(localStatus);
- } else if (fUnitWidth == UNumberUnitWidth::UNUM_UNIT_WIDTH_HIDDEN) {
- return UnicodeString();
- } else if (fUnitWidth == UNumberUnitWidth::UNUM_UNIT_WIDTH_NARROW) {
- return fCurrencySymbols.getNarrowCurrencySymbol(localStatus);
- } else {
- return fCurrencySymbols.getCurrencySymbol(localStatus);
- }
- }
- case AffixPatternType::TYPE_CURRENCY_DOUBLE:
- return fCurrencySymbols.getIntlCurrencySymbol(localStatus);
- case AffixPatternType::TYPE_CURRENCY_TRIPLE:
- // NOTE: This is the code path only for patterns containing "¤¤¤".
- // Plural currencies set via the API are formatted in LongNameHandler.
- // This code path is used by DecimalFormat via CurrencyPluralInfo.
- U_ASSERT(fPlural != StandardPlural::Form::COUNT);
- return fCurrencySymbols.getPluralName(fPlural, localStatus);
- case AffixPatternType::TYPE_CURRENCY_QUAD:
- return UnicodeString(u"\uFFFD");
- case AffixPatternType::TYPE_CURRENCY_QUINT:
- return UnicodeString(u"\uFFFD");
- default:
- UPRV_UNREACHABLE;
- }
-}
-
-UnicodeString MutablePatternModifier::toUnicodeString() const {
- // Never called by AffixUtils
- UPRV_UNREACHABLE;
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "cstring.h"
+#include "number_patternmodifier.h"
+#include "unicode/dcfmtsym.h"
+#include "unicode/ucurr.h"
+#include "unicode/unistr.h"
+#include "number_microprops.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+
+AffixPatternProvider::~AffixPatternProvider() = default;
+
+
+MutablePatternModifier::MutablePatternModifier(bool isStrong)
+ : fStrong(isStrong) {}
+
+void MutablePatternModifier::setPatternInfo(const AffixPatternProvider* patternInfo, Field field) {
+ fPatternInfo = patternInfo;
+ fField = field;
+}
+
+void MutablePatternModifier::setPatternAttributes(UNumberSignDisplay signDisplay, bool perMille) {
+ fSignDisplay = signDisplay;
+ fPerMilleReplacesPercent = perMille;
+}
+
+void MutablePatternModifier::setSymbols(const DecimalFormatSymbols* symbols,
+ const CurrencyUnit& currency,
+ const UNumberUnitWidth unitWidth,
+ const PluralRules* rules,
+ UErrorCode& status) {
+ U_ASSERT((rules != nullptr) == needsPlurals());
+ fSymbols = symbols;
+ fCurrencySymbols = {currency, symbols->getLocale(), *symbols, status};
+ fUnitWidth = unitWidth;
+ fRules = rules;
+}
+
+void MutablePatternModifier::setNumberProperties(Signum signum, StandardPlural::Form plural) {
+ fSignum = signum;
+ fPlural = plural;
+}
+
+bool MutablePatternModifier::needsPlurals() const {
+ UErrorCode statusLocal = U_ZERO_ERROR;
+ return fPatternInfo->containsSymbolType(AffixPatternType::TYPE_CURRENCY_TRIPLE, statusLocal);
+ // Silently ignore any error codes.
+}
+
+ImmutablePatternModifier* MutablePatternModifier::createImmutable(UErrorCode& status) {
+ // TODO: Move StandardPlural VALUES to standardplural.h
+ static const StandardPlural::Form STANDARD_PLURAL_VALUES[] = {
+ StandardPlural::Form::ZERO,
+ StandardPlural::Form::ONE,
+ StandardPlural::Form::TWO,
+ StandardPlural::Form::FEW,
+ StandardPlural::Form::MANY,
+ StandardPlural::Form::OTHER};
+
+ auto pm = new AdoptingModifierStore();
+ if (pm == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+
+ if (needsPlurals()) {
+ // Slower path when we require the plural keyword.
+ for (StandardPlural::Form plural : STANDARD_PLURAL_VALUES) {
+ setNumberProperties(SIGNUM_POS, plural);
+ pm->adoptModifier(SIGNUM_POS, plural, createConstantModifier(status));
+ setNumberProperties(SIGNUM_NEG_ZERO, plural);
+ pm->adoptModifier(SIGNUM_NEG_ZERO, plural, createConstantModifier(status));
+ setNumberProperties(SIGNUM_POS_ZERO, plural);
+ pm->adoptModifier(SIGNUM_POS_ZERO, plural, createConstantModifier(status));
+ setNumberProperties(SIGNUM_NEG, plural);
+ pm->adoptModifier(SIGNUM_NEG, plural, createConstantModifier(status));
+ }
+ if (U_FAILURE(status)) {
+ delete pm;
+ return nullptr;
+ }
+ return new ImmutablePatternModifier(pm, fRules); // adopts pm
+ } else {
+ // Faster path when plural keyword is not needed.
+ setNumberProperties(SIGNUM_POS, StandardPlural::Form::COUNT);
+ pm->adoptModifierWithoutPlural(SIGNUM_POS, createConstantModifier(status));
+ setNumberProperties(SIGNUM_NEG_ZERO, StandardPlural::Form::COUNT);
+ pm->adoptModifierWithoutPlural(SIGNUM_NEG_ZERO, createConstantModifier(status));
+ setNumberProperties(SIGNUM_POS_ZERO, StandardPlural::Form::COUNT);
+ pm->adoptModifierWithoutPlural(SIGNUM_POS_ZERO, createConstantModifier(status));
+ setNumberProperties(SIGNUM_NEG, StandardPlural::Form::COUNT);
+ pm->adoptModifierWithoutPlural(SIGNUM_NEG, createConstantModifier(status));
+ if (U_FAILURE(status)) {
+ delete pm;
+ return nullptr;
+ }
+ return new ImmutablePatternModifier(pm, nullptr); // adopts pm
+ }
+}
+
+ConstantMultiFieldModifier* MutablePatternModifier::createConstantModifier(UErrorCode& status) {
+ FormattedStringBuilder a;
+ FormattedStringBuilder b;
+ insertPrefix(a, 0, status);
+ insertSuffix(b, 0, status);
+ if (fPatternInfo->hasCurrencySign()) {
+ return new CurrencySpacingEnabledModifier(
+ a, b, !fPatternInfo->hasBody(), fStrong, *fSymbols, status);
+ } else {
+ return new ConstantMultiFieldModifier(a, b, !fPatternInfo->hasBody(), fStrong);
+ }
+}
+
+ImmutablePatternModifier::ImmutablePatternModifier(AdoptingModifierStore* pm, const PluralRules* rules)
+ : pm(pm), rules(rules), parent(nullptr) {}
+
+void ImmutablePatternModifier::processQuantity(DecimalQuantity& quantity, MicroProps& micros,
+ UErrorCode& status) const {
+ parent->processQuantity(quantity, micros, status);
+ micros.rounder.apply(quantity, status);
+ if (micros.modMiddle != nullptr) {
+ return;
+ }
+ applyToMicros(micros, quantity, status);
+}
+
+void ImmutablePatternModifier::applyToMicros(
+ MicroProps& micros, const DecimalQuantity& quantity, UErrorCode& status) const {
+ if (rules == nullptr) {
+ micros.modMiddle = pm->getModifierWithoutPlural(quantity.signum());
+ } else {
+ StandardPlural::Form pluralForm = utils::getPluralSafe(micros.rounder, rules, quantity, status);
+ micros.modMiddle = pm->getModifier(quantity.signum(), pluralForm);
+ }
+}
+
+const Modifier* ImmutablePatternModifier::getModifier(Signum signum, StandardPlural::Form plural) const {
+ if (rules == nullptr) {
+ return pm->getModifierWithoutPlural(signum);
+ } else {
+ return pm->getModifier(signum, plural);
+ }
+}
+
+void ImmutablePatternModifier::addToChain(const MicroPropsGenerator* parent) {
+ this->parent = parent;
+}
+
+
+/** Used by the unsafe code path. */
+MicroPropsGenerator& MutablePatternModifier::addToChain(const MicroPropsGenerator* parent) {
+ fParent = parent;
+ return *this;
+}
+
+void MutablePatternModifier::processQuantity(DecimalQuantity& fq, MicroProps& micros,
+ UErrorCode& status) const {
+ fParent->processQuantity(fq, micros, status);
+ micros.rounder.apply(fq, status);
+ if (micros.modMiddle != nullptr) {
+ return;
+ }
+ // The unsafe code path performs self-mutation, so we need a const_cast.
+ // This method needs to be const because it overrides a const method in the parent class.
+ auto nonConstThis = const_cast<MutablePatternModifier*>(this);
+ if (needsPlurals()) {
+ StandardPlural::Form pluralForm = utils::getPluralSafe(micros.rounder, fRules, fq, status);
+ nonConstThis->setNumberProperties(fq.signum(), pluralForm);
+ } else {
+ nonConstThis->setNumberProperties(fq.signum(), StandardPlural::Form::COUNT);
+ }
+ micros.modMiddle = this;
+}
+
+int32_t MutablePatternModifier::apply(FormattedStringBuilder& output, int32_t leftIndex, int32_t rightIndex,
+ UErrorCode& status) const {
+ // The unsafe code path performs self-mutation, so we need a const_cast.
+ // This method needs to be const because it overrides a const method in the parent class.
+ auto nonConstThis = const_cast<MutablePatternModifier*>(this);
+ int32_t prefixLen = nonConstThis->insertPrefix(output, leftIndex, status);
+ int32_t suffixLen = nonConstThis->insertSuffix(output, rightIndex + prefixLen, status);
+ // If the pattern had no decimal stem body (like #,##0.00), overwrite the value.
+ int32_t overwriteLen = 0;
+ if (!fPatternInfo->hasBody()) {
+ overwriteLen = output.splice(
+ leftIndex + prefixLen,
+ rightIndex + prefixLen,
+ UnicodeString(),
+ 0,
+ 0,
+ kUndefinedField,
+ status);
+ }
+ CurrencySpacingEnabledModifier::applyCurrencySpacing(
+ output,
+ leftIndex,
+ prefixLen,
+ rightIndex + overwriteLen + prefixLen,
+ suffixLen,
+ *fSymbols,
+ status);
+ return prefixLen + overwriteLen + suffixLen;
+}
+
+int32_t MutablePatternModifier::getPrefixLength() const {
+ // The unsafe code path performs self-mutation, so we need a const_cast.
+ // This method needs to be const because it overrides a const method in the parent class.
+ auto nonConstThis = const_cast<MutablePatternModifier*>(this);
+
+ // Enter and exit CharSequence Mode to get the length.
+ UErrorCode status = U_ZERO_ERROR; // status fails only with an iilegal argument exception
+ nonConstThis->prepareAffix(true);
+ int result = AffixUtils::unescapedCodePointCount(currentAffix, *this, status); // prefix length
+ return result;
+}
+
+int32_t MutablePatternModifier::getCodePointCount() const {
+ // The unsafe code path performs self-mutation, so we need a const_cast.
+ // This method needs to be const because it overrides a const method in the parent class.
+ auto nonConstThis = const_cast<MutablePatternModifier*>(this);
+
+ // Render the affixes to get the length
+ UErrorCode status = U_ZERO_ERROR; // status fails only with an iilegal argument exception
+ nonConstThis->prepareAffix(true);
+ int result = AffixUtils::unescapedCodePointCount(currentAffix, *this, status); // prefix length
+ nonConstThis->prepareAffix(false);
+ result += AffixUtils::unescapedCodePointCount(currentAffix, *this, status); // suffix length
+ return result;
+}
+
+bool MutablePatternModifier::isStrong() const {
+ return fStrong;
+}
+
+bool MutablePatternModifier::containsField(Field field) const {
+ (void)field;
+ // This method is not currently used.
+ UPRV_UNREACHABLE;
+}
+
+void MutablePatternModifier::getParameters(Parameters& output) const {
+ (void)output;
+ // This method is not currently used.
+ UPRV_UNREACHABLE;
+}
+
+bool MutablePatternModifier::semanticallyEquivalent(const Modifier& other) const {
+ (void)other;
+ // This method is not currently used.
+ UPRV_UNREACHABLE;
+}
+
+int32_t MutablePatternModifier::insertPrefix(FormattedStringBuilder& sb, int position, UErrorCode& status) {
+ prepareAffix(true);
+ int32_t length = AffixUtils::unescape(currentAffix, sb, position, *this, fField, status);
+ return length;
+}
+
+int32_t MutablePatternModifier::insertSuffix(FormattedStringBuilder& sb, int position, UErrorCode& status) {
+ prepareAffix(false);
+ int32_t length = AffixUtils::unescape(currentAffix, sb, position, *this, fField, status);
+ return length;
+}
+
+/** This method contains the heart of the logic for rendering LDML affix strings. */
+void MutablePatternModifier::prepareAffix(bool isPrefix) {
+ PatternStringUtils::patternInfoToStringBuilder(
+ *fPatternInfo,
+ isPrefix,
+ PatternStringUtils::resolveSignDisplay(fSignDisplay, fSignum),
+ fPlural,
+ fPerMilleReplacesPercent,
+ currentAffix);
+}
+
+UnicodeString MutablePatternModifier::getSymbol(AffixPatternType type) const {
+ UErrorCode localStatus = U_ZERO_ERROR;
+ switch (type) {
+ case AffixPatternType::TYPE_MINUS_SIGN:
+ return fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kMinusSignSymbol);
+ case AffixPatternType::TYPE_PLUS_SIGN:
+ return fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPlusSignSymbol);
+ case AffixPatternType::TYPE_PERCENT:
+ return fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPercentSymbol);
+ case AffixPatternType::TYPE_PERMILLE:
+ return fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPerMillSymbol);
+ case AffixPatternType::TYPE_CURRENCY_SINGLE: {
+ // UnitWidth ISO and HIDDEN overrides the singular currency symbol.
+ if (fUnitWidth == UNumberUnitWidth::UNUM_UNIT_WIDTH_ISO_CODE) {
+ return fCurrencySymbols.getIntlCurrencySymbol(localStatus);
+ } else if (fUnitWidth == UNumberUnitWidth::UNUM_UNIT_WIDTH_HIDDEN) {
+ return UnicodeString();
+ } else if (fUnitWidth == UNumberUnitWidth::UNUM_UNIT_WIDTH_NARROW) {
+ return fCurrencySymbols.getNarrowCurrencySymbol(localStatus);
+ } else {
+ return fCurrencySymbols.getCurrencySymbol(localStatus);
+ }
+ }
+ case AffixPatternType::TYPE_CURRENCY_DOUBLE:
+ return fCurrencySymbols.getIntlCurrencySymbol(localStatus);
+ case AffixPatternType::TYPE_CURRENCY_TRIPLE:
+ // NOTE: This is the code path only for patterns containing "¤¤¤".
+ // Plural currencies set via the API are formatted in LongNameHandler.
+ // This code path is used by DecimalFormat via CurrencyPluralInfo.
+ U_ASSERT(fPlural != StandardPlural::Form::COUNT);
+ return fCurrencySymbols.getPluralName(fPlural, localStatus);
+ case AffixPatternType::TYPE_CURRENCY_QUAD:
+ return UnicodeString(u"\uFFFD");
+ case AffixPatternType::TYPE_CURRENCY_QUINT:
+ return UnicodeString(u"\uFFFD");
+ default:
+ UPRV_UNREACHABLE;
+ }
+}
+
+UnicodeString MutablePatternModifier::toUnicodeString() const {
+ // Never called by AffixUtils
+ UPRV_UNREACHABLE;
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_patternmodifier.h b/contrib/libs/icu/i18n/number_patternmodifier.h
index 9baea472f9..5ba842d569 100644
--- a/contrib/libs/icu/i18n/number_patternmodifier.h
+++ b/contrib/libs/icu/i18n/number_patternmodifier.h
@@ -1,254 +1,254 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMBER_PATTERNMODIFIER_H__
-#define __NUMBER_PATTERNMODIFIER_H__
-
-#include "standardplural.h"
-#include "unicode/numberformatter.h"
-#include "number_patternstring.h"
-#include "number_types.h"
-#include "number_modifiers.h"
-#include "number_utils.h"
-#include "number_currencysymbols.h"
-
-U_NAMESPACE_BEGIN
-
-// Export an explicit template instantiation of the LocalPointer that is used as a
-// data member of AdoptingModifierStore.
-// (When building DLLs for Windows this is required.)
-#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
-#if defined(_MSC_VER)
-// Ignore warning 4661 as LocalPointerBase does not use operator== or operator!=
-#pragma warning(push)
-#pragma warning(disable : 4661)
-#endif
-template class U_I18N_API LocalPointerBase<number::impl::AdoptingModifierStore>;
-template class U_I18N_API LocalPointer<number::impl::AdoptingModifierStore>;
-#if defined(_MSC_VER)
-#pragma warning(pop)
-#endif
-#endif
-
-namespace number {
-namespace impl {
-
-// Forward declaration
-class MutablePatternModifier;
-
-// Exported as U_I18N_API because it is needed for the unit test PatternModifierTest
-class U_I18N_API ImmutablePatternModifier : public MicroPropsGenerator, public UMemory {
- public:
- ~ImmutablePatternModifier() U_OVERRIDE = default;
-
- void processQuantity(DecimalQuantity&, MicroProps& micros, UErrorCode& status) const U_OVERRIDE;
-
- void applyToMicros(MicroProps& micros, const DecimalQuantity& quantity, UErrorCode& status) const;
-
- const Modifier* getModifier(Signum signum, StandardPlural::Form plural) const;
-
- // Non-const method:
- void addToChain(const MicroPropsGenerator* parent);
-
- private:
- ImmutablePatternModifier(AdoptingModifierStore* pm, const PluralRules* rules);
-
- const LocalPointer<AdoptingModifierStore> pm;
- const PluralRules* rules;
- const MicroPropsGenerator* parent;
-
- friend class MutablePatternModifier;
-};
-
-/**
- * This class is a {@link Modifier} that wraps a decimal format pattern. It applies the pattern's affixes in
- * {@link Modifier#apply}.
- *
- * <p>
- * In addition to being a Modifier, this class contains the business logic for substituting the correct locale symbols
- * into the affixes of the decimal format pattern.
- *
- * <p>
- * In order to use this class, create a new instance and call the following four setters: {@link #setPatternInfo},
- * {@link #setPatternAttributes}, {@link #setSymbols}, and {@link #setNumberProperties}. After calling these four
- * setters, the instance will be ready for use as a Modifier.
- *
- * <p>
- * This is a MUTABLE, NON-THREAD-SAFE class designed for performance. Do NOT save references to this or attempt to use
- * it from multiple threads! Instead, you can obtain a safe, immutable decimal format pattern modifier by calling
- * {@link MutablePatternModifier#createImmutable}, in effect treating this instance as a builder for the immutable
- * variant.
- */
-class U_I18N_API MutablePatternModifier
- : public MicroPropsGenerator,
- public Modifier,
- public SymbolProvider,
- public UMemory {
- public:
-
- ~MutablePatternModifier() U_OVERRIDE = default;
-
- /**
- * @param isStrong
- * Whether the modifier should be considered strong. For more information, see
- * {@link Modifier#isStrong()}. Most of the time, decimal format pattern modifiers should be considered
- * as non-strong.
- */
- explicit MutablePatternModifier(bool isStrong);
-
- /**
- * Sets a reference to the parsed decimal format pattern, usually obtained from
- * {@link PatternStringParser#parseToPatternInfo(String)}, but any implementation of {@link AffixPatternProvider} is
- * accepted.
- *
- * @param field
- * Which field to use for literal characters in the pattern.
- */
- void setPatternInfo(const AffixPatternProvider *patternInfo, Field field);
-
- /**
- * Sets attributes that imply changes to the literal interpretation of the pattern string affixes.
- *
- * @param signDisplay
- * Whether to force a plus sign on positive numbers.
- * @param perMille
- * Whether to substitute the percent sign in the pattern with a permille sign.
- */
- void setPatternAttributes(UNumberSignDisplay signDisplay, bool perMille);
-
- /**
- * Sets locale-specific details that affect the symbols substituted into the pattern string affixes.
- *
- * @param symbols
- * The desired instance of DecimalFormatSymbols.
- * @param currency
- * The currency to be used when substituting currency values into the affixes.
- * @param unitWidth
- * The width used to render currencies.
- * @param rules
- * Required if the triple currency sign, "¤¤¤", appears in the pattern, which can be determined from the
- * convenience method {@link #needsPlurals()}.
- * @param status
- * Set if an error occurs while loading currency data.
- */
- void setSymbols(const DecimalFormatSymbols* symbols, const CurrencyUnit& currency,
- UNumberUnitWidth unitWidth, const PluralRules* rules, UErrorCode& status);
-
- /**
- * Sets attributes of the current number being processed.
- *
- * @param signum
- * -1 if negative; +1 if positive; or 0 if zero.
- * @param plural
- * The plural form of the number, required only if the pattern contains the triple
- * currency sign, "¤¤¤" (and as indicated by {@link #needsPlurals()}).
- */
- void setNumberProperties(Signum signum, StandardPlural::Form plural);
-
- /**
- * Returns true if the pattern represented by this MurkyModifier requires a plural keyword in order to localize.
- * This is currently true only if there is a currency long name placeholder in the pattern ("¤¤¤").
- */
- bool needsPlurals() const;
-
- /**
- * Creates a new quantity-dependent Modifier that behaves the same as the current instance, but which is immutable
- * and can be saved for future use. The number properties in the current instance are mutated; all other properties
- * are left untouched.
- *
- * <p>
- * The resulting modifier cannot be used in a QuantityChain.
- *
- * <p>
- * CREATES A NEW HEAP OBJECT; THE CALLER GETS OWNERSHIP.
- *
- * @return An immutable that supports both positive and negative numbers.
- */
- ImmutablePatternModifier *createImmutable(UErrorCode &status);
-
- MicroPropsGenerator &addToChain(const MicroPropsGenerator *parent);
-
- void processQuantity(DecimalQuantity &, MicroProps &micros, UErrorCode &status) const U_OVERRIDE;
-
- int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex,
- UErrorCode &status) const U_OVERRIDE;
-
- int32_t getPrefixLength() const U_OVERRIDE;
-
- int32_t getCodePointCount() const U_OVERRIDE;
-
- bool isStrong() const U_OVERRIDE;
-
- bool containsField(Field field) const U_OVERRIDE;
-
- void getParameters(Parameters& output) const U_OVERRIDE;
-
- bool semanticallyEquivalent(const Modifier& other) const U_OVERRIDE;
-
- /**
- * Returns the string that substitutes a given symbol type in a pattern.
- */
- UnicodeString getSymbol(AffixPatternType type) const U_OVERRIDE;
-
- UnicodeString toUnicodeString() const;
-
- private:
- // Modifier details (initialized in constructor)
- const bool fStrong;
-
- // Pattern details (initialized in setPatternInfo and setPatternAttributes)
- const AffixPatternProvider *fPatternInfo;
- Field fField;
- UNumberSignDisplay fSignDisplay;
- bool fPerMilleReplacesPercent;
-
- // Symbol details (initialized in setSymbols)
- const DecimalFormatSymbols *fSymbols;
- UNumberUnitWidth fUnitWidth;
- CurrencySymbols fCurrencySymbols;
- const PluralRules *fRules;
-
- // Number details (initialized in setNumberProperties)
- Signum fSignum;
- StandardPlural::Form fPlural;
-
- // QuantityChain details (initialized in addToChain)
- const MicroPropsGenerator *fParent;
-
- // Transient fields for rendering
- UnicodeString currentAffix;
-
- /**
- * Uses the current properties to create a single {@link ConstantMultiFieldModifier} with currency spacing support
- * if required.
- *
- * <p>
- * CREATES A NEW HEAP OBJECT; THE CALLER GETS OWNERSHIP.
- *
- * @param a
- * A working FormattedStringBuilder object; passed from the outside to prevent the need to create many new
- * instances if this method is called in a loop.
- * @param b
- * Another working FormattedStringBuilder object.
- * @return The constant modifier object.
- */
- ConstantMultiFieldModifier *createConstantModifier(UErrorCode &status);
-
- int32_t insertPrefix(FormattedStringBuilder &sb, int position, UErrorCode &status);
-
- int32_t insertSuffix(FormattedStringBuilder &sb, int position, UErrorCode &status);
-
- void prepareAffix(bool isPrefix);
-};
-
-
-} // namespace impl
-} // namespace number
-U_NAMESPACE_END
-
-#endif //__NUMBER_PATTERNMODIFIER_H__
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMBER_PATTERNMODIFIER_H__
+#define __NUMBER_PATTERNMODIFIER_H__
+
+#include "standardplural.h"
+#include "unicode/numberformatter.h"
+#include "number_patternstring.h"
+#include "number_types.h"
+#include "number_modifiers.h"
+#include "number_utils.h"
+#include "number_currencysymbols.h"
+
+U_NAMESPACE_BEGIN
+
+// Export an explicit template instantiation of the LocalPointer that is used as a
+// data member of AdoptingModifierStore.
+// (When building DLLs for Windows this is required.)
+#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
+#if defined(_MSC_VER)
+// Ignore warning 4661 as LocalPointerBase does not use operator== or operator!=
+#pragma warning(push)
+#pragma warning(disable : 4661)
+#endif
+template class U_I18N_API LocalPointerBase<number::impl::AdoptingModifierStore>;
+template class U_I18N_API LocalPointer<number::impl::AdoptingModifierStore>;
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+#endif
+
+namespace number {
+namespace impl {
+
+// Forward declaration
+class MutablePatternModifier;
+
+// Exported as U_I18N_API because it is needed for the unit test PatternModifierTest
+class U_I18N_API ImmutablePatternModifier : public MicroPropsGenerator, public UMemory {
+ public:
+ ~ImmutablePatternModifier() U_OVERRIDE = default;
+
+ void processQuantity(DecimalQuantity&, MicroProps& micros, UErrorCode& status) const U_OVERRIDE;
+
+ void applyToMicros(MicroProps& micros, const DecimalQuantity& quantity, UErrorCode& status) const;
+
+ const Modifier* getModifier(Signum signum, StandardPlural::Form plural) const;
+
+ // Non-const method:
+ void addToChain(const MicroPropsGenerator* parent);
+
+ private:
+ ImmutablePatternModifier(AdoptingModifierStore* pm, const PluralRules* rules);
+
+ const LocalPointer<AdoptingModifierStore> pm;
+ const PluralRules* rules;
+ const MicroPropsGenerator* parent;
+
+ friend class MutablePatternModifier;
+};
+
+/**
+ * This class is a {@link Modifier} that wraps a decimal format pattern. It applies the pattern's affixes in
+ * {@link Modifier#apply}.
+ *
+ * <p>
+ * In addition to being a Modifier, this class contains the business logic for substituting the correct locale symbols
+ * into the affixes of the decimal format pattern.
+ *
+ * <p>
+ * In order to use this class, create a new instance and call the following four setters: {@link #setPatternInfo},
+ * {@link #setPatternAttributes}, {@link #setSymbols}, and {@link #setNumberProperties}. After calling these four
+ * setters, the instance will be ready for use as a Modifier.
+ *
+ * <p>
+ * This is a MUTABLE, NON-THREAD-SAFE class designed for performance. Do NOT save references to this or attempt to use
+ * it from multiple threads! Instead, you can obtain a safe, immutable decimal format pattern modifier by calling
+ * {@link MutablePatternModifier#createImmutable}, in effect treating this instance as a builder for the immutable
+ * variant.
+ */
+class U_I18N_API MutablePatternModifier
+ : public MicroPropsGenerator,
+ public Modifier,
+ public SymbolProvider,
+ public UMemory {
+ public:
+
+ ~MutablePatternModifier() U_OVERRIDE = default;
+
+ /**
+ * @param isStrong
+ * Whether the modifier should be considered strong. For more information, see
+ * {@link Modifier#isStrong()}. Most of the time, decimal format pattern modifiers should be considered
+ * as non-strong.
+ */
+ explicit MutablePatternModifier(bool isStrong);
+
+ /**
+ * Sets a reference to the parsed decimal format pattern, usually obtained from
+ * {@link PatternStringParser#parseToPatternInfo(String)}, but any implementation of {@link AffixPatternProvider} is
+ * accepted.
+ *
+ * @param field
+ * Which field to use for literal characters in the pattern.
+ */
+ void setPatternInfo(const AffixPatternProvider *patternInfo, Field field);
+
+ /**
+ * Sets attributes that imply changes to the literal interpretation of the pattern string affixes.
+ *
+ * @param signDisplay
+ * Whether to force a plus sign on positive numbers.
+ * @param perMille
+ * Whether to substitute the percent sign in the pattern with a permille sign.
+ */
+ void setPatternAttributes(UNumberSignDisplay signDisplay, bool perMille);
+
+ /**
+ * Sets locale-specific details that affect the symbols substituted into the pattern string affixes.
+ *
+ * @param symbols
+ * The desired instance of DecimalFormatSymbols.
+ * @param currency
+ * The currency to be used when substituting currency values into the affixes.
+ * @param unitWidth
+ * The width used to render currencies.
+ * @param rules
+ * Required if the triple currency sign, "¤¤¤", appears in the pattern, which can be determined from the
+ * convenience method {@link #needsPlurals()}.
+ * @param status
+ * Set if an error occurs while loading currency data.
+ */
+ void setSymbols(const DecimalFormatSymbols* symbols, const CurrencyUnit& currency,
+ UNumberUnitWidth unitWidth, const PluralRules* rules, UErrorCode& status);
+
+ /**
+ * Sets attributes of the current number being processed.
+ *
+ * @param signum
+ * -1 if negative; +1 if positive; or 0 if zero.
+ * @param plural
+ * The plural form of the number, required only if the pattern contains the triple
+ * currency sign, "¤¤¤" (and as indicated by {@link #needsPlurals()}).
+ */
+ void setNumberProperties(Signum signum, StandardPlural::Form plural);
+
+ /**
+ * Returns true if the pattern represented by this MurkyModifier requires a plural keyword in order to localize.
+ * This is currently true only if there is a currency long name placeholder in the pattern ("¤¤¤").
+ */
+ bool needsPlurals() const;
+
+ /**
+ * Creates a new quantity-dependent Modifier that behaves the same as the current instance, but which is immutable
+ * and can be saved for future use. The number properties in the current instance are mutated; all other properties
+ * are left untouched.
+ *
+ * <p>
+ * The resulting modifier cannot be used in a QuantityChain.
+ *
+ * <p>
+ * CREATES A NEW HEAP OBJECT; THE CALLER GETS OWNERSHIP.
+ *
+ * @return An immutable that supports both positive and negative numbers.
+ */
+ ImmutablePatternModifier *createImmutable(UErrorCode &status);
+
+ MicroPropsGenerator &addToChain(const MicroPropsGenerator *parent);
+
+ void processQuantity(DecimalQuantity &, MicroProps &micros, UErrorCode &status) const U_OVERRIDE;
+
+ int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex,
+ UErrorCode &status) const U_OVERRIDE;
+
+ int32_t getPrefixLength() const U_OVERRIDE;
+
+ int32_t getCodePointCount() const U_OVERRIDE;
+
+ bool isStrong() const U_OVERRIDE;
+
+ bool containsField(Field field) const U_OVERRIDE;
+
+ void getParameters(Parameters& output) const U_OVERRIDE;
+
+ bool semanticallyEquivalent(const Modifier& other) const U_OVERRIDE;
+
+ /**
+ * Returns the string that substitutes a given symbol type in a pattern.
+ */
+ UnicodeString getSymbol(AffixPatternType type) const U_OVERRIDE;
+
+ UnicodeString toUnicodeString() const;
+
+ private:
+ // Modifier details (initialized in constructor)
+ const bool fStrong;
+
+ // Pattern details (initialized in setPatternInfo and setPatternAttributes)
+ const AffixPatternProvider *fPatternInfo;
+ Field fField;
+ UNumberSignDisplay fSignDisplay;
+ bool fPerMilleReplacesPercent;
+
+ // Symbol details (initialized in setSymbols)
+ const DecimalFormatSymbols *fSymbols;
+ UNumberUnitWidth fUnitWidth;
+ CurrencySymbols fCurrencySymbols;
+ const PluralRules *fRules;
+
+ // Number details (initialized in setNumberProperties)
+ Signum fSignum;
+ StandardPlural::Form fPlural;
+
+ // QuantityChain details (initialized in addToChain)
+ const MicroPropsGenerator *fParent;
+
+ // Transient fields for rendering
+ UnicodeString currentAffix;
+
+ /**
+ * Uses the current properties to create a single {@link ConstantMultiFieldModifier} with currency spacing support
+ * if required.
+ *
+ * <p>
+ * CREATES A NEW HEAP OBJECT; THE CALLER GETS OWNERSHIP.
+ *
+ * @param a
+ * A working FormattedStringBuilder object; passed from the outside to prevent the need to create many new
+ * instances if this method is called in a loop.
+ * @param b
+ * Another working FormattedStringBuilder object.
+ * @return The constant modifier object.
+ */
+ ConstantMultiFieldModifier *createConstantModifier(UErrorCode &status);
+
+ int32_t insertPrefix(FormattedStringBuilder &sb, int position, UErrorCode &status);
+
+ int32_t insertSuffix(FormattedStringBuilder &sb, int position, UErrorCode &status);
+
+ void prepareAffix(bool isPrefix);
+};
+
+
+} // namespace impl
+} // namespace number
+U_NAMESPACE_END
+
+#endif //__NUMBER_PATTERNMODIFIER_H__
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_patternstring.cpp b/contrib/libs/icu/i18n/number_patternstring.cpp
index 0c5ea50c42..9d84505606 100644
--- a/contrib/libs/icu/i18n/number_patternstring.cpp
+++ b/contrib/libs/icu/i18n/number_patternstring.cpp
@@ -1,1120 +1,1120 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-#define UNISTR_FROM_CHAR_EXPLICIT
-
-#include "uassert.h"
-#include "number_patternstring.h"
-#include "unicode/utf16.h"
-#include "number_utils.h"
-#include "number_roundingutils.h"
-#include "number_mapper.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-
-void PatternParser::parseToPatternInfo(const UnicodeString& patternString, ParsedPatternInfo& patternInfo,
- UErrorCode& status) {
- patternInfo.consumePattern(patternString, status);
-}
-
-DecimalFormatProperties
-PatternParser::parseToProperties(const UnicodeString& pattern, IgnoreRounding ignoreRounding,
- UErrorCode& status) {
- DecimalFormatProperties properties;
- parseToExistingPropertiesImpl(pattern, properties, ignoreRounding, status);
- return properties;
-}
-
-DecimalFormatProperties PatternParser::parseToProperties(const UnicodeString& pattern,
- UErrorCode& status) {
- return parseToProperties(pattern, IGNORE_ROUNDING_NEVER, status);
-}
-
-void
-PatternParser::parseToExistingProperties(const UnicodeString& pattern, DecimalFormatProperties& properties,
- IgnoreRounding ignoreRounding, UErrorCode& status) {
- parseToExistingPropertiesImpl(pattern, properties, ignoreRounding, status);
-}
-
-
-char16_t ParsedPatternInfo::charAt(int32_t flags, int32_t index) const {
- const Endpoints& endpoints = getEndpoints(flags);
- if (index < 0 || index >= endpoints.end - endpoints.start) {
- UPRV_UNREACHABLE;
- }
- return pattern.charAt(endpoints.start + index);
-}
-
-int32_t ParsedPatternInfo::length(int32_t flags) const {
- return getLengthFromEndpoints(getEndpoints(flags));
-}
-
-int32_t ParsedPatternInfo::getLengthFromEndpoints(const Endpoints& endpoints) {
- return endpoints.end - endpoints.start;
-}
-
-UnicodeString ParsedPatternInfo::getString(int32_t flags) const {
- const Endpoints& endpoints = getEndpoints(flags);
- if (endpoints.start == endpoints.end) {
- return UnicodeString();
- }
- // Create a new UnicodeString
- return UnicodeString(pattern, endpoints.start, endpoints.end - endpoints.start);
-}
-
-const Endpoints& ParsedPatternInfo::getEndpoints(int32_t flags) const {
- bool prefix = (flags & AFFIX_PREFIX) != 0;
- bool isNegative = (flags & AFFIX_NEGATIVE_SUBPATTERN) != 0;
- bool padding = (flags & AFFIX_PADDING) != 0;
- if (isNegative && padding) {
- return negative.paddingEndpoints;
- } else if (padding) {
- return positive.paddingEndpoints;
- } else if (prefix && isNegative) {
- return negative.prefixEndpoints;
- } else if (prefix) {
- return positive.prefixEndpoints;
- } else if (isNegative) {
- return negative.suffixEndpoints;
- } else {
- return positive.suffixEndpoints;
- }
-}
-
-bool ParsedPatternInfo::positiveHasPlusSign() const {
- return positive.hasPlusSign;
-}
-
-bool ParsedPatternInfo::hasNegativeSubpattern() const {
- return fHasNegativeSubpattern;
-}
-
-bool ParsedPatternInfo::negativeHasMinusSign() const {
- return negative.hasMinusSign;
-}
-
-bool ParsedPatternInfo::hasCurrencySign() const {
- return positive.hasCurrencySign || (fHasNegativeSubpattern && negative.hasCurrencySign);
-}
-
-bool ParsedPatternInfo::containsSymbolType(AffixPatternType type, UErrorCode& status) const {
- return AffixUtils::containsType(pattern, type, status);
-}
-
-bool ParsedPatternInfo::hasBody() const {
- return positive.integerTotal > 0;
-}
-
-/////////////////////////////////////////////////////
-/// BEGIN RECURSIVE DESCENT PARSER IMPLEMENTATION ///
-/////////////////////////////////////////////////////
-
-UChar32 ParsedPatternInfo::ParserState::peek() {
- if (offset == pattern.length()) {
- return -1;
- } else {
- return pattern.char32At(offset);
- }
-}
-
-UChar32 ParsedPatternInfo::ParserState::next() {
- int codePoint = peek();
- offset += U16_LENGTH(codePoint);
- return codePoint;
-}
-
-void ParsedPatternInfo::consumePattern(const UnicodeString& patternString, UErrorCode& status) {
- if (U_FAILURE(status)) { return; }
- this->pattern = patternString;
-
- // This class is not intended for writing twice!
- // Use move assignment to overwrite instead.
- U_ASSERT(state.offset == 0);
-
- // pattern := subpattern (';' subpattern)?
- currentSubpattern = &positive;
- consumeSubpattern(status);
- if (U_FAILURE(status)) { return; }
- if (state.peek() == u';') {
- state.next(); // consume the ';'
- // Don't consume the negative subpattern if it is empty (trailing ';')
- if (state.peek() != -1) {
- fHasNegativeSubpattern = true;
- currentSubpattern = &negative;
- consumeSubpattern(status);
- if (U_FAILURE(status)) { return; }
- }
- }
- if (state.peek() != -1) {
- state.toParseException(u"Found unquoted special character");
- status = U_UNQUOTED_SPECIAL;
- }
-}
-
-void ParsedPatternInfo::consumeSubpattern(UErrorCode& status) {
- // subpattern := literals? number exponent? literals?
- consumePadding(PadPosition::UNUM_PAD_BEFORE_PREFIX, status);
- if (U_FAILURE(status)) { return; }
- consumeAffix(currentSubpattern->prefixEndpoints, status);
- if (U_FAILURE(status)) { return; }
- consumePadding(PadPosition::UNUM_PAD_AFTER_PREFIX, status);
- if (U_FAILURE(status)) { return; }
- consumeFormat(status);
- if (U_FAILURE(status)) { return; }
- consumeExponent(status);
- if (U_FAILURE(status)) { return; }
- consumePadding(PadPosition::UNUM_PAD_BEFORE_SUFFIX, status);
- if (U_FAILURE(status)) { return; }
- consumeAffix(currentSubpattern->suffixEndpoints, status);
- if (U_FAILURE(status)) { return; }
- consumePadding(PadPosition::UNUM_PAD_AFTER_SUFFIX, status);
- if (U_FAILURE(status)) { return; }
-}
-
-void ParsedPatternInfo::consumePadding(PadPosition paddingLocation, UErrorCode& status) {
- if (state.peek() != u'*') {
- return;
- }
- if (currentSubpattern->hasPadding) {
- state.toParseException(u"Cannot have multiple pad specifiers");
- status = U_MULTIPLE_PAD_SPECIFIERS;
- return;
- }
- currentSubpattern->paddingLocation = paddingLocation;
- currentSubpattern->hasPadding = true;
- state.next(); // consume the '*'
- currentSubpattern->paddingEndpoints.start = state.offset;
- consumeLiteral(status);
- currentSubpattern->paddingEndpoints.end = state.offset;
-}
-
-void ParsedPatternInfo::consumeAffix(Endpoints& endpoints, UErrorCode& status) {
- // literals := { literal }
- endpoints.start = state.offset;
- while (true) {
- switch (state.peek()) {
- case u'#':
- case u'@':
- case u';':
- case u'*':
- case u'.':
- case u',':
- case u'0':
- case u'1':
- case u'2':
- case u'3':
- case u'4':
- case u'5':
- case u'6':
- case u'7':
- case u'8':
- case u'9':
- case -1:
- // Characters that cannot appear unquoted in a literal
- // break outer;
- goto after_outer;
-
- case u'%':
- currentSubpattern->hasPercentSign = true;
- break;
-
- case u'‰':
- currentSubpattern->hasPerMilleSign = true;
- break;
-
- case u'¤':
- currentSubpattern->hasCurrencySign = true;
- break;
-
- case u'-':
- currentSubpattern->hasMinusSign = true;
- break;
-
- case u'+':
- currentSubpattern->hasPlusSign = true;
- break;
-
- default:
- break;
- }
- consumeLiteral(status);
- if (U_FAILURE(status)) { return; }
- }
- after_outer:
- endpoints.end = state.offset;
-}
-
-void ParsedPatternInfo::consumeLiteral(UErrorCode& status) {
- if (state.peek() == -1) {
- state.toParseException(u"Expected unquoted literal but found EOL");
- status = U_PATTERN_SYNTAX_ERROR;
- return;
- } else if (state.peek() == u'\'') {
- state.next(); // consume the starting quote
- while (state.peek() != u'\'') {
- if (state.peek() == -1) {
- state.toParseException(u"Expected quoted literal but found EOL");
- status = U_PATTERN_SYNTAX_ERROR;
- return;
- } else {
- state.next(); // consume a quoted character
- }
- }
- state.next(); // consume the ending quote
- } else {
- // consume a non-quoted literal character
- state.next();
- }
-}
-
-void ParsedPatternInfo::consumeFormat(UErrorCode& status) {
- consumeIntegerFormat(status);
- if (U_FAILURE(status)) { return; }
- if (state.peek() == u'.') {
- state.next(); // consume the decimal point
- currentSubpattern->hasDecimal = true;
- currentSubpattern->widthExceptAffixes += 1;
- consumeFractionFormat(status);
- if (U_FAILURE(status)) { return; }
- }
-}
-
-void ParsedPatternInfo::consumeIntegerFormat(UErrorCode& status) {
- // Convenience reference:
- ParsedSubpatternInfo& result = *currentSubpattern;
-
- while (true) {
- switch (state.peek()) {
- case u',':
- result.widthExceptAffixes += 1;
- result.groupingSizes <<= 16;
- break;
-
- case u'#':
- if (result.integerNumerals > 0) {
- state.toParseException(u"# cannot follow 0 before decimal point");
- status = U_UNEXPECTED_TOKEN;
- return;
- }
- result.widthExceptAffixes += 1;
- result.groupingSizes += 1;
- if (result.integerAtSigns > 0) {
- result.integerTrailingHashSigns += 1;
- } else {
- result.integerLeadingHashSigns += 1;
- }
- result.integerTotal += 1;
- break;
-
- case u'@':
- if (result.integerNumerals > 0) {
- state.toParseException(u"Cannot mix 0 and @");
- status = U_UNEXPECTED_TOKEN;
- return;
- }
- if (result.integerTrailingHashSigns > 0) {
- state.toParseException(u"Cannot nest # inside of a run of @");
- status = U_UNEXPECTED_TOKEN;
- return;
- }
- result.widthExceptAffixes += 1;
- result.groupingSizes += 1;
- result.integerAtSigns += 1;
- result.integerTotal += 1;
- break;
-
- case u'0':
- case u'1':
- case u'2':
- case u'3':
- case u'4':
- case u'5':
- case u'6':
- case u'7':
- case u'8':
- case u'9':
- if (result.integerAtSigns > 0) {
- state.toParseException(u"Cannot mix @ and 0");
- status = U_UNEXPECTED_TOKEN;
- return;
- }
- result.widthExceptAffixes += 1;
- result.groupingSizes += 1;
- result.integerNumerals += 1;
- result.integerTotal += 1;
- if (!result.rounding.isZeroish() || state.peek() != u'0') {
- result.rounding.appendDigit(static_cast<int8_t>(state.peek() - u'0'), 0, true);
- }
- break;
-
- default:
- goto after_outer;
- }
- state.next(); // consume the symbol
- }
-
- after_outer:
- // Disallow patterns with a trailing ',' or with two ',' next to each other
- auto grouping1 = static_cast<int16_t> (result.groupingSizes & 0xffff);
- auto grouping2 = static_cast<int16_t> ((result.groupingSizes >> 16) & 0xffff);
- auto grouping3 = static_cast<int16_t> ((result.groupingSizes >> 32) & 0xffff);
- if (grouping1 == 0 && grouping2 != -1) {
- state.toParseException(u"Trailing grouping separator is invalid");
- status = U_UNEXPECTED_TOKEN;
- return;
- }
- if (grouping2 == 0 && grouping3 != -1) {
- state.toParseException(u"Grouping width of zero is invalid");
- status = U_PATTERN_SYNTAX_ERROR;
- return;
- }
-}
-
-void ParsedPatternInfo::consumeFractionFormat(UErrorCode& status) {
- // Convenience reference:
- ParsedSubpatternInfo& result = *currentSubpattern;
-
- int32_t zeroCounter = 0;
- while (true) {
- switch (state.peek()) {
- case u'#':
- result.widthExceptAffixes += 1;
- result.fractionHashSigns += 1;
- result.fractionTotal += 1;
- zeroCounter++;
- break;
-
- case u'0':
- case u'1':
- case u'2':
- case u'3':
- case u'4':
- case u'5':
- case u'6':
- case u'7':
- case u'8':
- case u'9':
- if (result.fractionHashSigns > 0) {
- state.toParseException(u"0 cannot follow # after decimal point");
- status = U_UNEXPECTED_TOKEN;
- return;
- }
- result.widthExceptAffixes += 1;
- result.fractionNumerals += 1;
- result.fractionTotal += 1;
- if (state.peek() == u'0') {
- zeroCounter++;
- } else {
- result.rounding
- .appendDigit(static_cast<int8_t>(state.peek() - u'0'), zeroCounter, false);
- zeroCounter = 0;
- }
- break;
-
- default:
- return;
- }
- state.next(); // consume the symbol
- }
-}
-
-void ParsedPatternInfo::consumeExponent(UErrorCode& status) {
- // Convenience reference:
- ParsedSubpatternInfo& result = *currentSubpattern;
-
- if (state.peek() != u'E') {
- return;
- }
- if ((result.groupingSizes & 0xffff0000L) != 0xffff0000L) {
- state.toParseException(u"Cannot have grouping separator in scientific notation");
- status = U_MALFORMED_EXPONENTIAL_PATTERN;
- return;
- }
- state.next(); // consume the E
- result.widthExceptAffixes++;
- if (state.peek() == u'+') {
- state.next(); // consume the +
- result.exponentHasPlusSign = true;
- result.widthExceptAffixes++;
- }
- while (state.peek() == u'0') {
- state.next(); // consume the 0
- result.exponentZeros += 1;
- result.widthExceptAffixes++;
- }
-}
-
-///////////////////////////////////////////////////
-/// END RECURSIVE DESCENT PARSER IMPLEMENTATION ///
-///////////////////////////////////////////////////
-
-void PatternParser::parseToExistingPropertiesImpl(const UnicodeString& pattern,
- DecimalFormatProperties& properties,
- IgnoreRounding ignoreRounding, UErrorCode& status) {
- if (pattern.length() == 0) {
- // Backwards compatibility requires that we reset to the default values.
- // TODO: Only overwrite the properties that "saveToProperties" normally touches?
- properties.clear();
- return;
- }
-
- ParsedPatternInfo patternInfo;
- parseToPatternInfo(pattern, patternInfo, status);
- if (U_FAILURE(status)) { return; }
- patternInfoToProperties(properties, patternInfo, ignoreRounding, status);
-}
-
-void
-PatternParser::patternInfoToProperties(DecimalFormatProperties& properties, ParsedPatternInfo& patternInfo,
- IgnoreRounding _ignoreRounding, UErrorCode& status) {
- // Translate from PatternParseResult to Properties.
- // Note that most data from "negative" is ignored per the specification of DecimalFormat.
-
- const ParsedSubpatternInfo& positive = patternInfo.positive;
-
- bool ignoreRounding;
- if (_ignoreRounding == IGNORE_ROUNDING_NEVER) {
- ignoreRounding = false;
- } else if (_ignoreRounding == IGNORE_ROUNDING_IF_CURRENCY) {
- ignoreRounding = positive.hasCurrencySign;
- } else {
- U_ASSERT(_ignoreRounding == IGNORE_ROUNDING_ALWAYS);
- ignoreRounding = true;
- }
-
- // Grouping settings
- auto grouping1 = static_cast<int16_t> (positive.groupingSizes & 0xffff);
- auto grouping2 = static_cast<int16_t> ((positive.groupingSizes >> 16) & 0xffff);
- auto grouping3 = static_cast<int16_t> ((positive.groupingSizes >> 32) & 0xffff);
- if (grouping2 != -1) {
- properties.groupingSize = grouping1;
- properties.groupingUsed = true;
- } else {
- properties.groupingSize = -1;
- properties.groupingUsed = false;
- }
- if (grouping3 != -1) {
- properties.secondaryGroupingSize = grouping2;
- } else {
- properties.secondaryGroupingSize = -1;
- }
-
- // For backwards compatibility, require that the pattern emit at least one min digit.
- int minInt, minFrac;
- if (positive.integerTotal == 0 && positive.fractionTotal > 0) {
- // patterns like ".##"
- minInt = 0;
- minFrac = uprv_max(1, positive.fractionNumerals);
- } else if (positive.integerNumerals == 0 && positive.fractionNumerals == 0) {
- // patterns like "#.##"
- minInt = 1;
- minFrac = 0;
- } else {
- minInt = positive.integerNumerals;
- minFrac = positive.fractionNumerals;
- }
-
- // Rounding settings
- // Don't set basic rounding when there is a currency sign; defer to CurrencyUsage
- if (positive.integerAtSigns > 0) {
- properties.minimumFractionDigits = -1;
- properties.maximumFractionDigits = -1;
- properties.roundingIncrement = 0.0;
- properties.minimumSignificantDigits = positive.integerAtSigns;
- properties.maximumSignificantDigits = positive.integerAtSigns + positive.integerTrailingHashSigns;
- } else if (!positive.rounding.isZeroish()) {
- if (!ignoreRounding) {
- properties.minimumFractionDigits = minFrac;
- properties.maximumFractionDigits = positive.fractionTotal;
- properties.roundingIncrement = positive.rounding.toDouble();
- } else {
- properties.minimumFractionDigits = -1;
- properties.maximumFractionDigits = -1;
- properties.roundingIncrement = 0.0;
- }
- properties.minimumSignificantDigits = -1;
- properties.maximumSignificantDigits = -1;
- } else {
- if (!ignoreRounding) {
- properties.minimumFractionDigits = minFrac;
- properties.maximumFractionDigits = positive.fractionTotal;
- properties.roundingIncrement = 0.0;
- } else {
- properties.minimumFractionDigits = -1;
- properties.maximumFractionDigits = -1;
- properties.roundingIncrement = 0.0;
- }
- properties.minimumSignificantDigits = -1;
- properties.maximumSignificantDigits = -1;
- }
-
- // If the pattern ends with a '.' then force the decimal point.
- if (positive.hasDecimal && positive.fractionTotal == 0) {
- properties.decimalSeparatorAlwaysShown = true;
- } else {
- properties.decimalSeparatorAlwaysShown = false;
- }
-
- // Scientific notation settings
- if (positive.exponentZeros > 0) {
- properties.exponentSignAlwaysShown = positive.exponentHasPlusSign;
- properties.minimumExponentDigits = positive.exponentZeros;
- if (positive.integerAtSigns == 0) {
- // patterns without '@' can define max integer digits, used for engineering notation
- properties.minimumIntegerDigits = positive.integerNumerals;
- properties.maximumIntegerDigits = positive.integerTotal;
- } else {
- // patterns with '@' cannot define max integer digits
- properties.minimumIntegerDigits = 1;
- properties.maximumIntegerDigits = -1;
- }
- } else {
- properties.exponentSignAlwaysShown = false;
- properties.minimumExponentDigits = -1;
- properties.minimumIntegerDigits = minInt;
- properties.maximumIntegerDigits = -1;
- }
-
- // Compute the affix patterns (required for both padding and affixes)
- UnicodeString posPrefix = patternInfo.getString(AffixPatternProvider::AFFIX_PREFIX);
- UnicodeString posSuffix = patternInfo.getString(0);
-
- // Padding settings
- if (positive.hasPadding) {
- // The width of the positive prefix and suffix templates are included in the padding
- int paddingWidth = positive.widthExceptAffixes +
- AffixUtils::estimateLength(posPrefix, status) +
- AffixUtils::estimateLength(posSuffix, status);
- properties.formatWidth = paddingWidth;
- UnicodeString rawPaddingString = patternInfo.getString(AffixPatternProvider::AFFIX_PADDING);
- if (rawPaddingString.length() == 1) {
- properties.padString = rawPaddingString;
- } else if (rawPaddingString.length() == 2) {
- if (rawPaddingString.charAt(0) == u'\'') {
- properties.padString.setTo(u"'", -1);
- } else {
- properties.padString = rawPaddingString;
- }
- } else {
- properties.padString = UnicodeString(rawPaddingString, 1, rawPaddingString.length() - 2);
- }
- properties.padPosition = positive.paddingLocation;
- } else {
- properties.formatWidth = -1;
- properties.padString.setToBogus();
- properties.padPosition.nullify();
- }
-
- // Set the affixes
- // Always call the setter, even if the prefixes are empty, especially in the case of the
- // negative prefix pattern, to prevent default values from overriding the pattern.
- properties.positivePrefixPattern = posPrefix;
- properties.positiveSuffixPattern = posSuffix;
- if (patternInfo.fHasNegativeSubpattern) {
- properties.negativePrefixPattern = patternInfo.getString(
- AffixPatternProvider::AFFIX_NEGATIVE_SUBPATTERN | AffixPatternProvider::AFFIX_PREFIX);
- properties.negativeSuffixPattern = patternInfo.getString(
- AffixPatternProvider::AFFIX_NEGATIVE_SUBPATTERN);
- } else {
- properties.negativePrefixPattern.setToBogus();
- properties.negativeSuffixPattern.setToBogus();
- }
-
- // Set the magnitude multiplier
- if (positive.hasPercentSign) {
- properties.magnitudeMultiplier = 2;
- } else if (positive.hasPerMilleSign) {
- properties.magnitudeMultiplier = 3;
- } else {
- properties.magnitudeMultiplier = 0;
- }
-}
-
-///////////////////////////////////////////////////////////////////
-/// End PatternStringParser.java; begin PatternStringUtils.java ///
-///////////////////////////////////////////////////////////////////
-
-// Determine whether a given roundingIncrement should be ignored for formatting
-// based on the current maxFrac value (maximum fraction digits). For example a
-// roundingIncrement of 0.01 should be ignored if maxFrac is 1, but not if maxFrac
-// is 2 or more. Note that roundingIncrements are rounded in significance, so
-// a roundingIncrement of 0.006 is treated like 0.01 for this determination, i.e.
-// it should not be ignored if maxFrac is 2 or more (but a roundingIncrement of
-// 0.005 is treated like 0.001 for significance). This is the reason for the
-// initial doubling below.
-// roundIncr must be non-zero.
-bool PatternStringUtils::ignoreRoundingIncrement(double roundIncr, int32_t maxFrac) {
- if (maxFrac < 0) {
- return false;
- }
- int32_t frac = 0;
- roundIncr *= 2.0;
- for (frac = 0; frac <= maxFrac && roundIncr <= 1.0; frac++, roundIncr *= 10.0);
- return (frac > maxFrac);
-}
-
-UnicodeString PatternStringUtils::propertiesToPatternString(const DecimalFormatProperties& properties,
- UErrorCode& status) {
- UnicodeString sb;
-
- // Convenience references
- // The uprv_min() calls prevent DoS
- int32_t dosMax = 100;
- int32_t grouping1 = uprv_max(0, uprv_min(properties.groupingSize, dosMax));
- int32_t grouping2 = uprv_max(0, uprv_min(properties.secondaryGroupingSize, dosMax));
- bool useGrouping = properties.groupingUsed;
- int32_t paddingWidth = uprv_min(properties.formatWidth, dosMax);
- NullableValue<PadPosition> paddingLocation = properties.padPosition;
- UnicodeString paddingString = properties.padString;
- int32_t minInt = uprv_max(0, uprv_min(properties.minimumIntegerDigits, dosMax));
- int32_t maxInt = uprv_min(properties.maximumIntegerDigits, dosMax);
- int32_t minFrac = uprv_max(0, uprv_min(properties.minimumFractionDigits, dosMax));
- int32_t maxFrac = uprv_min(properties.maximumFractionDigits, dosMax);
- int32_t minSig = uprv_min(properties.minimumSignificantDigits, dosMax);
- int32_t maxSig = uprv_min(properties.maximumSignificantDigits, dosMax);
- bool alwaysShowDecimal = properties.decimalSeparatorAlwaysShown;
- int32_t exponentDigits = uprv_min(properties.minimumExponentDigits, dosMax);
- bool exponentShowPlusSign = properties.exponentSignAlwaysShown;
-
- AutoAffixPatternProvider affixProvider(properties, status);
-
- // Prefixes
- sb.append(affixProvider.get().getString(AffixPatternProvider::AFFIX_POS_PREFIX));
- int32_t afterPrefixPos = sb.length();
-
- // Figure out the grouping sizes.
- if (!useGrouping) {
- grouping1 = 0;
- grouping2 = 0;
- } else if (grouping1 == grouping2) {
- grouping1 = 0;
- }
- int32_t groupingLength = grouping1 + grouping2 + 1;
-
- // Figure out the digits we need to put in the pattern.
- double roundingInterval = properties.roundingIncrement;
- UnicodeString digitsString;
- int32_t digitsStringScale = 0;
- if (maxSig != uprv_min(dosMax, -1)) {
- // Significant Digits.
- while (digitsString.length() < minSig) {
- digitsString.append(u'@');
- }
- while (digitsString.length() < maxSig) {
- digitsString.append(u'#');
- }
- } else if (roundingInterval != 0.0 && !ignoreRoundingIncrement(roundingInterval,maxFrac)) {
- // Rounding Interval.
- digitsStringScale = -roundingutils::doubleFractionLength(roundingInterval, nullptr);
- // TODO: Check for DoS here?
- DecimalQuantity incrementQuantity;
- incrementQuantity.setToDouble(roundingInterval);
- incrementQuantity.adjustMagnitude(-digitsStringScale);
- incrementQuantity.roundToMagnitude(0, kDefaultMode, status);
- UnicodeString str = incrementQuantity.toPlainString();
- if (str.charAt(0) == u'-') {
- // TODO: Unsupported operation exception or fail silently?
- digitsString.append(str, 1, str.length() - 1);
- } else {
- digitsString.append(str);
- }
- }
- while (digitsString.length() + digitsStringScale < minInt) {
- digitsString.insert(0, u'0');
- }
- while (-digitsStringScale < minFrac) {
- digitsString.append(u'0');
- digitsStringScale--;
- }
-
- // Write the digits to the string builder
- int32_t m0 = uprv_max(groupingLength, digitsString.length() + digitsStringScale);
- m0 = (maxInt != dosMax) ? uprv_max(maxInt, m0) - 1 : m0 - 1;
- int32_t mN = (maxFrac != dosMax) ? uprv_min(-maxFrac, digitsStringScale) : digitsStringScale;
- for (int32_t magnitude = m0; magnitude >= mN; magnitude--) {
- int32_t di = digitsString.length() + digitsStringScale - magnitude - 1;
- if (di < 0 || di >= digitsString.length()) {
- sb.append(u'#');
- } else {
- sb.append(digitsString.charAt(di));
- }
- // Decimal separator
- if (magnitude == 0 && (alwaysShowDecimal || mN < 0)) {
- sb.append(u'.');
- }
- if (!useGrouping) {
- continue;
- }
- // Least-significant grouping separator
- if (magnitude > 0 && magnitude == grouping1) {
- sb.append(u',');
- }
- // All other grouping separators
- if (magnitude > grouping1 && grouping2 > 0 && (magnitude - grouping1) % grouping2 == 0) {
- sb.append(u',');
- }
- }
-
- // Exponential notation
- if (exponentDigits != uprv_min(dosMax, -1)) {
- sb.append(u'E');
- if (exponentShowPlusSign) {
- sb.append(u'+');
- }
- for (int32_t i = 0; i < exponentDigits; i++) {
- sb.append(u'0');
- }
- }
-
- // Suffixes
- int32_t beforeSuffixPos = sb.length();
- sb.append(affixProvider.get().getString(AffixPatternProvider::AFFIX_POS_SUFFIX));
-
- // Resolve Padding
- if (paddingWidth > 0 && !paddingLocation.isNull()) {
- while (paddingWidth - sb.length() > 0) {
- sb.insert(afterPrefixPos, u'#');
- beforeSuffixPos++;
- }
- int32_t addedLength;
- switch (paddingLocation.get(status)) {
- case PadPosition::UNUM_PAD_BEFORE_PREFIX:
- addedLength = escapePaddingString(paddingString, sb, 0, status);
- sb.insert(0, u'*');
- afterPrefixPos += addedLength + 1;
- beforeSuffixPos += addedLength + 1;
- break;
- case PadPosition::UNUM_PAD_AFTER_PREFIX:
- addedLength = escapePaddingString(paddingString, sb, afterPrefixPos, status);
- sb.insert(afterPrefixPos, u'*');
- afterPrefixPos += addedLength + 1;
- beforeSuffixPos += addedLength + 1;
- break;
- case PadPosition::UNUM_PAD_BEFORE_SUFFIX:
- escapePaddingString(paddingString, sb, beforeSuffixPos, status);
- sb.insert(beforeSuffixPos, u'*');
- break;
- case PadPosition::UNUM_PAD_AFTER_SUFFIX:
- sb.append(u'*');
- escapePaddingString(paddingString, sb, sb.length(), status);
- break;
- }
- if (U_FAILURE(status)) { return sb; }
- }
-
- // Negative affixes
- // Ignore if the negative prefix pattern is "-" and the negative suffix is empty
- if (affixProvider.get().hasNegativeSubpattern()) {
- sb.append(u';');
- sb.append(affixProvider.get().getString(AffixPatternProvider::AFFIX_NEG_PREFIX));
- // Copy the positive digit format into the negative.
- // This is optional; the pattern is the same as if '#' were appended here instead.
- // NOTE: It is not safe to append the UnicodeString to itself, so we need to copy.
- // See http://bugs.icu-project.org/trac/ticket/13707
- UnicodeString copy(sb);
- sb.append(copy, afterPrefixPos, beforeSuffixPos - afterPrefixPos);
- sb.append(affixProvider.get().getString(AffixPatternProvider::AFFIX_NEG_SUFFIX));
- }
-
- return sb;
-}
-
-int PatternStringUtils::escapePaddingString(UnicodeString input, UnicodeString& output, int startIndex,
- UErrorCode& status) {
- (void) status;
- if (input.length() == 0) {
- input.setTo(kFallbackPaddingString, -1);
- }
- int startLength = output.length();
- if (input.length() == 1) {
- if (input.compare(u"'", -1) == 0) {
- output.insert(startIndex, u"''", -1);
- } else {
- output.insert(startIndex, input);
- }
- } else {
- output.insert(startIndex, u'\'');
- int offset = 1;
- for (int i = 0; i < input.length(); i++) {
- // it's okay to deal in chars here because the quote mark is the only interesting thing.
- char16_t ch = input.charAt(i);
- if (ch == u'\'') {
- output.insert(startIndex + offset, u"''", -1);
- offset += 2;
- } else {
- output.insert(startIndex + offset, ch);
- offset += 1;
- }
- }
- output.insert(startIndex + offset, u'\'');
- }
- return output.length() - startLength;
-}
-
-UnicodeString
-PatternStringUtils::convertLocalized(const UnicodeString& input, const DecimalFormatSymbols& symbols,
- bool toLocalized, UErrorCode& status) {
- // Construct a table of strings to be converted between localized and standard.
- static constexpr int32_t LEN = 21;
- UnicodeString table[LEN][2];
- int standIdx = toLocalized ? 0 : 1;
- int localIdx = toLocalized ? 1 : 0;
- table[0][standIdx] = u"%";
- table[0][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kPercentSymbol);
- table[1][standIdx] = u"‰";
- table[1][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kPerMillSymbol);
- table[2][standIdx] = u".";
- table[2][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kDecimalSeparatorSymbol);
- table[3][standIdx] = u",";
- table[3][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kGroupingSeparatorSymbol);
- table[4][standIdx] = u"-";
- table[4][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kMinusSignSymbol);
- table[5][standIdx] = u"+";
- table[5][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kPlusSignSymbol);
- table[6][standIdx] = u";";
- table[6][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kPatternSeparatorSymbol);
- table[7][standIdx] = u"@";
- table[7][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kSignificantDigitSymbol);
- table[8][standIdx] = u"E";
- table[8][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kExponentialSymbol);
- table[9][standIdx] = u"*";
- table[9][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kPadEscapeSymbol);
- table[10][standIdx] = u"#";
- table[10][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kDigitSymbol);
- for (int i = 0; i < 10; i++) {
- table[11 + i][standIdx] = u'0' + i;
- table[11 + i][localIdx] = symbols.getConstDigitSymbol(i);
- }
-
- // Special case: quotes are NOT allowed to be in any localIdx strings.
- // Substitute them with '’' instead.
- for (int32_t i = 0; i < LEN; i++) {
- table[i][localIdx].findAndReplace(u'\'', u'’');
- }
-
- // Iterate through the string and convert.
- // State table:
- // 0 => base state
- // 1 => first char inside a quoted sequence in input and output string
- // 2 => inside a quoted sequence in input and output string
- // 3 => first char after a close quote in input string;
- // close quote still needs to be written to output string
- // 4 => base state in input string; inside quoted sequence in output string
- // 5 => first char inside a quoted sequence in input string;
- // inside quoted sequence in output string
- UnicodeString result;
- int state = 0;
- for (int offset = 0; offset < input.length(); offset++) {
- UChar ch = input.charAt(offset);
-
- // Handle a quote character (state shift)
- if (ch == u'\'') {
- if (state == 0) {
- result.append(u'\'');
- state = 1;
- continue;
- } else if (state == 1) {
- result.append(u'\'');
- state = 0;
- continue;
- } else if (state == 2) {
- state = 3;
- continue;
- } else if (state == 3) {
- result.append(u'\'');
- result.append(u'\'');
- state = 1;
- continue;
- } else if (state == 4) {
- state = 5;
- continue;
- } else {
- U_ASSERT(state == 5);
- result.append(u'\'');
- result.append(u'\'');
- state = 4;
- continue;
- }
- }
-
- if (state == 0 || state == 3 || state == 4) {
- for (auto& pair : table) {
- // Perform a greedy match on this symbol string
- UnicodeString temp = input.tempSubString(offset, pair[0].length());
- if (temp == pair[0]) {
- // Skip ahead past this region for the next iteration
- offset += pair[0].length() - 1;
- if (state == 3 || state == 4) {
- result.append(u'\'');
- state = 0;
- }
- result.append(pair[1]);
- goto continue_outer;
- }
- }
- // No replacement found. Check if a special quote is necessary
- for (auto& pair : table) {
- UnicodeString temp = input.tempSubString(offset, pair[1].length());
- if (temp == pair[1]) {
- if (state == 0) {
- result.append(u'\'');
- state = 4;
- }
- result.append(ch);
- goto continue_outer;
- }
- }
- // Still nothing. Copy the char verbatim. (Add a close quote if necessary)
- if (state == 3 || state == 4) {
- result.append(u'\'');
- state = 0;
- }
- result.append(ch);
- } else {
- U_ASSERT(state == 1 || state == 2 || state == 5);
- result.append(ch);
- state = 2;
- }
- continue_outer:;
- }
- // Resolve final quotes
- if (state == 3 || state == 4) {
- result.append(u'\'');
- state = 0;
- }
- if (state != 0) {
- // Malformed localized pattern: unterminated quote
- status = U_PATTERN_SYNTAX_ERROR;
- }
- return result;
-}
-
-void PatternStringUtils::patternInfoToStringBuilder(const AffixPatternProvider& patternInfo, bool isPrefix,
- PatternSignType patternSignType,
- StandardPlural::Form plural,
- bool perMilleReplacesPercent, UnicodeString& output) {
-
- // Should the output render '+' where '-' would normally appear in the pattern?
- bool plusReplacesMinusSign = (patternSignType == PATTERN_SIGN_TYPE_POS_SIGN)
- && !patternInfo.positiveHasPlusSign();
-
- // Should we use the affix from the negative subpattern?
- // (If not, we will use the positive subpattern.)
- bool useNegativeAffixPattern = patternInfo.hasNegativeSubpattern()
- && (patternSignType == PATTERN_SIGN_TYPE_NEG
- || (patternInfo.negativeHasMinusSign() && plusReplacesMinusSign));
-
- // Resolve the flags for the affix pattern.
- int flags = 0;
- if (useNegativeAffixPattern) {
- flags |= AffixPatternProvider::AFFIX_NEGATIVE_SUBPATTERN;
- }
- if (isPrefix) {
- flags |= AffixPatternProvider::AFFIX_PREFIX;
- }
- if (plural != StandardPlural::Form::COUNT) {
- U_ASSERT(plural == (AffixPatternProvider::AFFIX_PLURAL_MASK & plural));
- flags |= plural;
- }
-
- // Should we prepend a sign to the pattern?
- bool prependSign;
- if (!isPrefix || useNegativeAffixPattern) {
- prependSign = false;
- } else if (patternSignType == PATTERN_SIGN_TYPE_NEG) {
- prependSign = true;
- } else {
- prependSign = plusReplacesMinusSign;
- }
-
- // Compute the length of the affix pattern.
- int length = patternInfo.length(flags) + (prependSign ? 1 : 0);
-
- // Finally, set the result into the StringBuilder.
- output.remove();
- for (int index = 0; index < length; index++) {
- char16_t candidate;
- if (prependSign && index == 0) {
- candidate = u'-';
- } else if (prependSign) {
- candidate = patternInfo.charAt(flags, index - 1);
- } else {
- candidate = patternInfo.charAt(flags, index);
- }
- if (plusReplacesMinusSign && candidate == u'-') {
- candidate = u'+';
- }
- if (perMilleReplacesPercent && candidate == u'%') {
- candidate = u'‰';
- }
- output.append(candidate);
- }
-}
-
-PatternSignType PatternStringUtils::resolveSignDisplay(UNumberSignDisplay signDisplay, Signum signum) {
- switch (signDisplay) {
- case UNUM_SIGN_AUTO:
- case UNUM_SIGN_ACCOUNTING:
- switch (signum) {
- case SIGNUM_NEG:
- case SIGNUM_NEG_ZERO:
- return PATTERN_SIGN_TYPE_NEG;
- case SIGNUM_POS_ZERO:
- case SIGNUM_POS:
- return PATTERN_SIGN_TYPE_POS;
- default:
- break;
- }
- break;
-
- case UNUM_SIGN_ALWAYS:
- case UNUM_SIGN_ACCOUNTING_ALWAYS:
- switch (signum) {
- case SIGNUM_NEG:
- case SIGNUM_NEG_ZERO:
- return PATTERN_SIGN_TYPE_NEG;
- case SIGNUM_POS_ZERO:
- case SIGNUM_POS:
- return PATTERN_SIGN_TYPE_POS_SIGN;
- default:
- break;
- }
- break;
-
- case UNUM_SIGN_EXCEPT_ZERO:
- case UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO:
- switch (signum) {
- case SIGNUM_NEG:
- return PATTERN_SIGN_TYPE_NEG;
- case SIGNUM_NEG_ZERO:
- case SIGNUM_POS_ZERO:
- return PATTERN_SIGN_TYPE_POS;
- case SIGNUM_POS:
- return PATTERN_SIGN_TYPE_POS_SIGN;
- default:
- break;
- }
- break;
-
- case UNUM_SIGN_NEVER:
- return PATTERN_SIGN_TYPE_POS;
-
- default:
- break;
- }
-
- UPRV_UNREACHABLE;
- return PATTERN_SIGN_TYPE_POS;
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+#define UNISTR_FROM_CHAR_EXPLICIT
+
+#include "uassert.h"
+#include "number_patternstring.h"
+#include "unicode/utf16.h"
+#include "number_utils.h"
+#include "number_roundingutils.h"
+#include "number_mapper.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+
+void PatternParser::parseToPatternInfo(const UnicodeString& patternString, ParsedPatternInfo& patternInfo,
+ UErrorCode& status) {
+ patternInfo.consumePattern(patternString, status);
+}
+
+DecimalFormatProperties
+PatternParser::parseToProperties(const UnicodeString& pattern, IgnoreRounding ignoreRounding,
+ UErrorCode& status) {
+ DecimalFormatProperties properties;
+ parseToExistingPropertiesImpl(pattern, properties, ignoreRounding, status);
+ return properties;
+}
+
+DecimalFormatProperties PatternParser::parseToProperties(const UnicodeString& pattern,
+ UErrorCode& status) {
+ return parseToProperties(pattern, IGNORE_ROUNDING_NEVER, status);
+}
+
+void
+PatternParser::parseToExistingProperties(const UnicodeString& pattern, DecimalFormatProperties& properties,
+ IgnoreRounding ignoreRounding, UErrorCode& status) {
+ parseToExistingPropertiesImpl(pattern, properties, ignoreRounding, status);
+}
+
+
+char16_t ParsedPatternInfo::charAt(int32_t flags, int32_t index) const {
+ const Endpoints& endpoints = getEndpoints(flags);
+ if (index < 0 || index >= endpoints.end - endpoints.start) {
+ UPRV_UNREACHABLE;
+ }
+ return pattern.charAt(endpoints.start + index);
+}
+
+int32_t ParsedPatternInfo::length(int32_t flags) const {
+ return getLengthFromEndpoints(getEndpoints(flags));
+}
+
+int32_t ParsedPatternInfo::getLengthFromEndpoints(const Endpoints& endpoints) {
+ return endpoints.end - endpoints.start;
+}
+
+UnicodeString ParsedPatternInfo::getString(int32_t flags) const {
+ const Endpoints& endpoints = getEndpoints(flags);
+ if (endpoints.start == endpoints.end) {
+ return UnicodeString();
+ }
+ // Create a new UnicodeString
+ return UnicodeString(pattern, endpoints.start, endpoints.end - endpoints.start);
+}
+
+const Endpoints& ParsedPatternInfo::getEndpoints(int32_t flags) const {
+ bool prefix = (flags & AFFIX_PREFIX) != 0;
+ bool isNegative = (flags & AFFIX_NEGATIVE_SUBPATTERN) != 0;
+ bool padding = (flags & AFFIX_PADDING) != 0;
+ if (isNegative && padding) {
+ return negative.paddingEndpoints;
+ } else if (padding) {
+ return positive.paddingEndpoints;
+ } else if (prefix && isNegative) {
+ return negative.prefixEndpoints;
+ } else if (prefix) {
+ return positive.prefixEndpoints;
+ } else if (isNegative) {
+ return negative.suffixEndpoints;
+ } else {
+ return positive.suffixEndpoints;
+ }
+}
+
+bool ParsedPatternInfo::positiveHasPlusSign() const {
+ return positive.hasPlusSign;
+}
+
+bool ParsedPatternInfo::hasNegativeSubpattern() const {
+ return fHasNegativeSubpattern;
+}
+
+bool ParsedPatternInfo::negativeHasMinusSign() const {
+ return negative.hasMinusSign;
+}
+
+bool ParsedPatternInfo::hasCurrencySign() const {
+ return positive.hasCurrencySign || (fHasNegativeSubpattern && negative.hasCurrencySign);
+}
+
+bool ParsedPatternInfo::containsSymbolType(AffixPatternType type, UErrorCode& status) const {
+ return AffixUtils::containsType(pattern, type, status);
+}
+
+bool ParsedPatternInfo::hasBody() const {
+ return positive.integerTotal > 0;
+}
+
+/////////////////////////////////////////////////////
+/// BEGIN RECURSIVE DESCENT PARSER IMPLEMENTATION ///
+/////////////////////////////////////////////////////
+
+UChar32 ParsedPatternInfo::ParserState::peek() {
+ if (offset == pattern.length()) {
+ return -1;
+ } else {
+ return pattern.char32At(offset);
+ }
+}
+
+UChar32 ParsedPatternInfo::ParserState::next() {
+ int codePoint = peek();
+ offset += U16_LENGTH(codePoint);
+ return codePoint;
+}
+
+void ParsedPatternInfo::consumePattern(const UnicodeString& patternString, UErrorCode& status) {
+ if (U_FAILURE(status)) { return; }
+ this->pattern = patternString;
+
+ // This class is not intended for writing twice!
+ // Use move assignment to overwrite instead.
+ U_ASSERT(state.offset == 0);
+
+ // pattern := subpattern (';' subpattern)?
+ currentSubpattern = &positive;
+ consumeSubpattern(status);
+ if (U_FAILURE(status)) { return; }
+ if (state.peek() == u';') {
+ state.next(); // consume the ';'
+ // Don't consume the negative subpattern if it is empty (trailing ';')
+ if (state.peek() != -1) {
+ fHasNegativeSubpattern = true;
+ currentSubpattern = &negative;
+ consumeSubpattern(status);
+ if (U_FAILURE(status)) { return; }
+ }
+ }
+ if (state.peek() != -1) {
+ state.toParseException(u"Found unquoted special character");
+ status = U_UNQUOTED_SPECIAL;
+ }
+}
+
+void ParsedPatternInfo::consumeSubpattern(UErrorCode& status) {
+ // subpattern := literals? number exponent? literals?
+ consumePadding(PadPosition::UNUM_PAD_BEFORE_PREFIX, status);
+ if (U_FAILURE(status)) { return; }
+ consumeAffix(currentSubpattern->prefixEndpoints, status);
+ if (U_FAILURE(status)) { return; }
+ consumePadding(PadPosition::UNUM_PAD_AFTER_PREFIX, status);
+ if (U_FAILURE(status)) { return; }
+ consumeFormat(status);
+ if (U_FAILURE(status)) { return; }
+ consumeExponent(status);
+ if (U_FAILURE(status)) { return; }
+ consumePadding(PadPosition::UNUM_PAD_BEFORE_SUFFIX, status);
+ if (U_FAILURE(status)) { return; }
+ consumeAffix(currentSubpattern->suffixEndpoints, status);
+ if (U_FAILURE(status)) { return; }
+ consumePadding(PadPosition::UNUM_PAD_AFTER_SUFFIX, status);
+ if (U_FAILURE(status)) { return; }
+}
+
+void ParsedPatternInfo::consumePadding(PadPosition paddingLocation, UErrorCode& status) {
+ if (state.peek() != u'*') {
+ return;
+ }
+ if (currentSubpattern->hasPadding) {
+ state.toParseException(u"Cannot have multiple pad specifiers");
+ status = U_MULTIPLE_PAD_SPECIFIERS;
+ return;
+ }
+ currentSubpattern->paddingLocation = paddingLocation;
+ currentSubpattern->hasPadding = true;
+ state.next(); // consume the '*'
+ currentSubpattern->paddingEndpoints.start = state.offset;
+ consumeLiteral(status);
+ currentSubpattern->paddingEndpoints.end = state.offset;
+}
+
+void ParsedPatternInfo::consumeAffix(Endpoints& endpoints, UErrorCode& status) {
+ // literals := { literal }
+ endpoints.start = state.offset;
+ while (true) {
+ switch (state.peek()) {
+ case u'#':
+ case u'@':
+ case u';':
+ case u'*':
+ case u'.':
+ case u',':
+ case u'0':
+ case u'1':
+ case u'2':
+ case u'3':
+ case u'4':
+ case u'5':
+ case u'6':
+ case u'7':
+ case u'8':
+ case u'9':
+ case -1:
+ // Characters that cannot appear unquoted in a literal
+ // break outer;
+ goto after_outer;
+
+ case u'%':
+ currentSubpattern->hasPercentSign = true;
+ break;
+
+ case u'‰':
+ currentSubpattern->hasPerMilleSign = true;
+ break;
+
+ case u'¤':
+ currentSubpattern->hasCurrencySign = true;
+ break;
+
+ case u'-':
+ currentSubpattern->hasMinusSign = true;
+ break;
+
+ case u'+':
+ currentSubpattern->hasPlusSign = true;
+ break;
+
+ default:
+ break;
+ }
+ consumeLiteral(status);
+ if (U_FAILURE(status)) { return; }
+ }
+ after_outer:
+ endpoints.end = state.offset;
+}
+
+void ParsedPatternInfo::consumeLiteral(UErrorCode& status) {
+ if (state.peek() == -1) {
+ state.toParseException(u"Expected unquoted literal but found EOL");
+ status = U_PATTERN_SYNTAX_ERROR;
+ return;
+ } else if (state.peek() == u'\'') {
+ state.next(); // consume the starting quote
+ while (state.peek() != u'\'') {
+ if (state.peek() == -1) {
+ state.toParseException(u"Expected quoted literal but found EOL");
+ status = U_PATTERN_SYNTAX_ERROR;
+ return;
+ } else {
+ state.next(); // consume a quoted character
+ }
+ }
+ state.next(); // consume the ending quote
+ } else {
+ // consume a non-quoted literal character
+ state.next();
+ }
+}
+
+void ParsedPatternInfo::consumeFormat(UErrorCode& status) {
+ consumeIntegerFormat(status);
+ if (U_FAILURE(status)) { return; }
+ if (state.peek() == u'.') {
+ state.next(); // consume the decimal point
+ currentSubpattern->hasDecimal = true;
+ currentSubpattern->widthExceptAffixes += 1;
+ consumeFractionFormat(status);
+ if (U_FAILURE(status)) { return; }
+ }
+}
+
+void ParsedPatternInfo::consumeIntegerFormat(UErrorCode& status) {
+ // Convenience reference:
+ ParsedSubpatternInfo& result = *currentSubpattern;
+
+ while (true) {
+ switch (state.peek()) {
+ case u',':
+ result.widthExceptAffixes += 1;
+ result.groupingSizes <<= 16;
+ break;
+
+ case u'#':
+ if (result.integerNumerals > 0) {
+ state.toParseException(u"# cannot follow 0 before decimal point");
+ status = U_UNEXPECTED_TOKEN;
+ return;
+ }
+ result.widthExceptAffixes += 1;
+ result.groupingSizes += 1;
+ if (result.integerAtSigns > 0) {
+ result.integerTrailingHashSigns += 1;
+ } else {
+ result.integerLeadingHashSigns += 1;
+ }
+ result.integerTotal += 1;
+ break;
+
+ case u'@':
+ if (result.integerNumerals > 0) {
+ state.toParseException(u"Cannot mix 0 and @");
+ status = U_UNEXPECTED_TOKEN;
+ return;
+ }
+ if (result.integerTrailingHashSigns > 0) {
+ state.toParseException(u"Cannot nest # inside of a run of @");
+ status = U_UNEXPECTED_TOKEN;
+ return;
+ }
+ result.widthExceptAffixes += 1;
+ result.groupingSizes += 1;
+ result.integerAtSigns += 1;
+ result.integerTotal += 1;
+ break;
+
+ case u'0':
+ case u'1':
+ case u'2':
+ case u'3':
+ case u'4':
+ case u'5':
+ case u'6':
+ case u'7':
+ case u'8':
+ case u'9':
+ if (result.integerAtSigns > 0) {
+ state.toParseException(u"Cannot mix @ and 0");
+ status = U_UNEXPECTED_TOKEN;
+ return;
+ }
+ result.widthExceptAffixes += 1;
+ result.groupingSizes += 1;
+ result.integerNumerals += 1;
+ result.integerTotal += 1;
+ if (!result.rounding.isZeroish() || state.peek() != u'0') {
+ result.rounding.appendDigit(static_cast<int8_t>(state.peek() - u'0'), 0, true);
+ }
+ break;
+
+ default:
+ goto after_outer;
+ }
+ state.next(); // consume the symbol
+ }
+
+ after_outer:
+ // Disallow patterns with a trailing ',' or with two ',' next to each other
+ auto grouping1 = static_cast<int16_t> (result.groupingSizes & 0xffff);
+ auto grouping2 = static_cast<int16_t> ((result.groupingSizes >> 16) & 0xffff);
+ auto grouping3 = static_cast<int16_t> ((result.groupingSizes >> 32) & 0xffff);
+ if (grouping1 == 0 && grouping2 != -1) {
+ state.toParseException(u"Trailing grouping separator is invalid");
+ status = U_UNEXPECTED_TOKEN;
+ return;
+ }
+ if (grouping2 == 0 && grouping3 != -1) {
+ state.toParseException(u"Grouping width of zero is invalid");
+ status = U_PATTERN_SYNTAX_ERROR;
+ return;
+ }
+}
+
+void ParsedPatternInfo::consumeFractionFormat(UErrorCode& status) {
+ // Convenience reference:
+ ParsedSubpatternInfo& result = *currentSubpattern;
+
+ int32_t zeroCounter = 0;
+ while (true) {
+ switch (state.peek()) {
+ case u'#':
+ result.widthExceptAffixes += 1;
+ result.fractionHashSigns += 1;
+ result.fractionTotal += 1;
+ zeroCounter++;
+ break;
+
+ case u'0':
+ case u'1':
+ case u'2':
+ case u'3':
+ case u'4':
+ case u'5':
+ case u'6':
+ case u'7':
+ case u'8':
+ case u'9':
+ if (result.fractionHashSigns > 0) {
+ state.toParseException(u"0 cannot follow # after decimal point");
+ status = U_UNEXPECTED_TOKEN;
+ return;
+ }
+ result.widthExceptAffixes += 1;
+ result.fractionNumerals += 1;
+ result.fractionTotal += 1;
+ if (state.peek() == u'0') {
+ zeroCounter++;
+ } else {
+ result.rounding
+ .appendDigit(static_cast<int8_t>(state.peek() - u'0'), zeroCounter, false);
+ zeroCounter = 0;
+ }
+ break;
+
+ default:
+ return;
+ }
+ state.next(); // consume the symbol
+ }
+}
+
+void ParsedPatternInfo::consumeExponent(UErrorCode& status) {
+ // Convenience reference:
+ ParsedSubpatternInfo& result = *currentSubpattern;
+
+ if (state.peek() != u'E') {
+ return;
+ }
+ if ((result.groupingSizes & 0xffff0000L) != 0xffff0000L) {
+ state.toParseException(u"Cannot have grouping separator in scientific notation");
+ status = U_MALFORMED_EXPONENTIAL_PATTERN;
+ return;
+ }
+ state.next(); // consume the E
+ result.widthExceptAffixes++;
+ if (state.peek() == u'+') {
+ state.next(); // consume the +
+ result.exponentHasPlusSign = true;
+ result.widthExceptAffixes++;
+ }
+ while (state.peek() == u'0') {
+ state.next(); // consume the 0
+ result.exponentZeros += 1;
+ result.widthExceptAffixes++;
+ }
+}
+
+///////////////////////////////////////////////////
+/// END RECURSIVE DESCENT PARSER IMPLEMENTATION ///
+///////////////////////////////////////////////////
+
+void PatternParser::parseToExistingPropertiesImpl(const UnicodeString& pattern,
+ DecimalFormatProperties& properties,
+ IgnoreRounding ignoreRounding, UErrorCode& status) {
+ if (pattern.length() == 0) {
+ // Backwards compatibility requires that we reset to the default values.
+ // TODO: Only overwrite the properties that "saveToProperties" normally touches?
+ properties.clear();
+ return;
+ }
+
+ ParsedPatternInfo patternInfo;
+ parseToPatternInfo(pattern, patternInfo, status);
+ if (U_FAILURE(status)) { return; }
+ patternInfoToProperties(properties, patternInfo, ignoreRounding, status);
+}
+
+void
+PatternParser::patternInfoToProperties(DecimalFormatProperties& properties, ParsedPatternInfo& patternInfo,
+ IgnoreRounding _ignoreRounding, UErrorCode& status) {
+ // Translate from PatternParseResult to Properties.
+ // Note that most data from "negative" is ignored per the specification of DecimalFormat.
+
+ const ParsedSubpatternInfo& positive = patternInfo.positive;
+
+ bool ignoreRounding;
+ if (_ignoreRounding == IGNORE_ROUNDING_NEVER) {
+ ignoreRounding = false;
+ } else if (_ignoreRounding == IGNORE_ROUNDING_IF_CURRENCY) {
+ ignoreRounding = positive.hasCurrencySign;
+ } else {
+ U_ASSERT(_ignoreRounding == IGNORE_ROUNDING_ALWAYS);
+ ignoreRounding = true;
+ }
+
+ // Grouping settings
+ auto grouping1 = static_cast<int16_t> (positive.groupingSizes & 0xffff);
+ auto grouping2 = static_cast<int16_t> ((positive.groupingSizes >> 16) & 0xffff);
+ auto grouping3 = static_cast<int16_t> ((positive.groupingSizes >> 32) & 0xffff);
+ if (grouping2 != -1) {
+ properties.groupingSize = grouping1;
+ properties.groupingUsed = true;
+ } else {
+ properties.groupingSize = -1;
+ properties.groupingUsed = false;
+ }
+ if (grouping3 != -1) {
+ properties.secondaryGroupingSize = grouping2;
+ } else {
+ properties.secondaryGroupingSize = -1;
+ }
+
+ // For backwards compatibility, require that the pattern emit at least one min digit.
+ int minInt, minFrac;
+ if (positive.integerTotal == 0 && positive.fractionTotal > 0) {
+ // patterns like ".##"
+ minInt = 0;
+ minFrac = uprv_max(1, positive.fractionNumerals);
+ } else if (positive.integerNumerals == 0 && positive.fractionNumerals == 0) {
+ // patterns like "#.##"
+ minInt = 1;
+ minFrac = 0;
+ } else {
+ minInt = positive.integerNumerals;
+ minFrac = positive.fractionNumerals;
+ }
+
+ // Rounding settings
+ // Don't set basic rounding when there is a currency sign; defer to CurrencyUsage
+ if (positive.integerAtSigns > 0) {
+ properties.minimumFractionDigits = -1;
+ properties.maximumFractionDigits = -1;
+ properties.roundingIncrement = 0.0;
+ properties.minimumSignificantDigits = positive.integerAtSigns;
+ properties.maximumSignificantDigits = positive.integerAtSigns + positive.integerTrailingHashSigns;
+ } else if (!positive.rounding.isZeroish()) {
+ if (!ignoreRounding) {
+ properties.minimumFractionDigits = minFrac;
+ properties.maximumFractionDigits = positive.fractionTotal;
+ properties.roundingIncrement = positive.rounding.toDouble();
+ } else {
+ properties.minimumFractionDigits = -1;
+ properties.maximumFractionDigits = -1;
+ properties.roundingIncrement = 0.0;
+ }
+ properties.minimumSignificantDigits = -1;
+ properties.maximumSignificantDigits = -1;
+ } else {
+ if (!ignoreRounding) {
+ properties.minimumFractionDigits = minFrac;
+ properties.maximumFractionDigits = positive.fractionTotal;
+ properties.roundingIncrement = 0.0;
+ } else {
+ properties.minimumFractionDigits = -1;
+ properties.maximumFractionDigits = -1;
+ properties.roundingIncrement = 0.0;
+ }
+ properties.minimumSignificantDigits = -1;
+ properties.maximumSignificantDigits = -1;
+ }
+
+ // If the pattern ends with a '.' then force the decimal point.
+ if (positive.hasDecimal && positive.fractionTotal == 0) {
+ properties.decimalSeparatorAlwaysShown = true;
+ } else {
+ properties.decimalSeparatorAlwaysShown = false;
+ }
+
+ // Scientific notation settings
+ if (positive.exponentZeros > 0) {
+ properties.exponentSignAlwaysShown = positive.exponentHasPlusSign;
+ properties.minimumExponentDigits = positive.exponentZeros;
+ if (positive.integerAtSigns == 0) {
+ // patterns without '@' can define max integer digits, used for engineering notation
+ properties.minimumIntegerDigits = positive.integerNumerals;
+ properties.maximumIntegerDigits = positive.integerTotal;
+ } else {
+ // patterns with '@' cannot define max integer digits
+ properties.minimumIntegerDigits = 1;
+ properties.maximumIntegerDigits = -1;
+ }
+ } else {
+ properties.exponentSignAlwaysShown = false;
+ properties.minimumExponentDigits = -1;
+ properties.minimumIntegerDigits = minInt;
+ properties.maximumIntegerDigits = -1;
+ }
+
+ // Compute the affix patterns (required for both padding and affixes)
+ UnicodeString posPrefix = patternInfo.getString(AffixPatternProvider::AFFIX_PREFIX);
+ UnicodeString posSuffix = patternInfo.getString(0);
+
+ // Padding settings
+ if (positive.hasPadding) {
+ // The width of the positive prefix and suffix templates are included in the padding
+ int paddingWidth = positive.widthExceptAffixes +
+ AffixUtils::estimateLength(posPrefix, status) +
+ AffixUtils::estimateLength(posSuffix, status);
+ properties.formatWidth = paddingWidth;
+ UnicodeString rawPaddingString = patternInfo.getString(AffixPatternProvider::AFFIX_PADDING);
+ if (rawPaddingString.length() == 1) {
+ properties.padString = rawPaddingString;
+ } else if (rawPaddingString.length() == 2) {
+ if (rawPaddingString.charAt(0) == u'\'') {
+ properties.padString.setTo(u"'", -1);
+ } else {
+ properties.padString = rawPaddingString;
+ }
+ } else {
+ properties.padString = UnicodeString(rawPaddingString, 1, rawPaddingString.length() - 2);
+ }
+ properties.padPosition = positive.paddingLocation;
+ } else {
+ properties.formatWidth = -1;
+ properties.padString.setToBogus();
+ properties.padPosition.nullify();
+ }
+
+ // Set the affixes
+ // Always call the setter, even if the prefixes are empty, especially in the case of the
+ // negative prefix pattern, to prevent default values from overriding the pattern.
+ properties.positivePrefixPattern = posPrefix;
+ properties.positiveSuffixPattern = posSuffix;
+ if (patternInfo.fHasNegativeSubpattern) {
+ properties.negativePrefixPattern = patternInfo.getString(
+ AffixPatternProvider::AFFIX_NEGATIVE_SUBPATTERN | AffixPatternProvider::AFFIX_PREFIX);
+ properties.negativeSuffixPattern = patternInfo.getString(
+ AffixPatternProvider::AFFIX_NEGATIVE_SUBPATTERN);
+ } else {
+ properties.negativePrefixPattern.setToBogus();
+ properties.negativeSuffixPattern.setToBogus();
+ }
+
+ // Set the magnitude multiplier
+ if (positive.hasPercentSign) {
+ properties.magnitudeMultiplier = 2;
+ } else if (positive.hasPerMilleSign) {
+ properties.magnitudeMultiplier = 3;
+ } else {
+ properties.magnitudeMultiplier = 0;
+ }
+}
+
+///////////////////////////////////////////////////////////////////
+/// End PatternStringParser.java; begin PatternStringUtils.java ///
+///////////////////////////////////////////////////////////////////
+
+// Determine whether a given roundingIncrement should be ignored for formatting
+// based on the current maxFrac value (maximum fraction digits). For example a
+// roundingIncrement of 0.01 should be ignored if maxFrac is 1, but not if maxFrac
+// is 2 or more. Note that roundingIncrements are rounded in significance, so
+// a roundingIncrement of 0.006 is treated like 0.01 for this determination, i.e.
+// it should not be ignored if maxFrac is 2 or more (but a roundingIncrement of
+// 0.005 is treated like 0.001 for significance). This is the reason for the
+// initial doubling below.
+// roundIncr must be non-zero.
+bool PatternStringUtils::ignoreRoundingIncrement(double roundIncr, int32_t maxFrac) {
+ if (maxFrac < 0) {
+ return false;
+ }
+ int32_t frac = 0;
+ roundIncr *= 2.0;
+ for (frac = 0; frac <= maxFrac && roundIncr <= 1.0; frac++, roundIncr *= 10.0);
+ return (frac > maxFrac);
+}
+
+UnicodeString PatternStringUtils::propertiesToPatternString(const DecimalFormatProperties& properties,
+ UErrorCode& status) {
+ UnicodeString sb;
+
+ // Convenience references
+ // The uprv_min() calls prevent DoS
+ int32_t dosMax = 100;
+ int32_t grouping1 = uprv_max(0, uprv_min(properties.groupingSize, dosMax));
+ int32_t grouping2 = uprv_max(0, uprv_min(properties.secondaryGroupingSize, dosMax));
+ bool useGrouping = properties.groupingUsed;
+ int32_t paddingWidth = uprv_min(properties.formatWidth, dosMax);
+ NullableValue<PadPosition> paddingLocation = properties.padPosition;
+ UnicodeString paddingString = properties.padString;
+ int32_t minInt = uprv_max(0, uprv_min(properties.minimumIntegerDigits, dosMax));
+ int32_t maxInt = uprv_min(properties.maximumIntegerDigits, dosMax);
+ int32_t minFrac = uprv_max(0, uprv_min(properties.minimumFractionDigits, dosMax));
+ int32_t maxFrac = uprv_min(properties.maximumFractionDigits, dosMax);
+ int32_t minSig = uprv_min(properties.minimumSignificantDigits, dosMax);
+ int32_t maxSig = uprv_min(properties.maximumSignificantDigits, dosMax);
+ bool alwaysShowDecimal = properties.decimalSeparatorAlwaysShown;
+ int32_t exponentDigits = uprv_min(properties.minimumExponentDigits, dosMax);
+ bool exponentShowPlusSign = properties.exponentSignAlwaysShown;
+
+ AutoAffixPatternProvider affixProvider(properties, status);
+
+ // Prefixes
+ sb.append(affixProvider.get().getString(AffixPatternProvider::AFFIX_POS_PREFIX));
+ int32_t afterPrefixPos = sb.length();
+
+ // Figure out the grouping sizes.
+ if (!useGrouping) {
+ grouping1 = 0;
+ grouping2 = 0;
+ } else if (grouping1 == grouping2) {
+ grouping1 = 0;
+ }
+ int32_t groupingLength = grouping1 + grouping2 + 1;
+
+ // Figure out the digits we need to put in the pattern.
+ double roundingInterval = properties.roundingIncrement;
+ UnicodeString digitsString;
+ int32_t digitsStringScale = 0;
+ if (maxSig != uprv_min(dosMax, -1)) {
+ // Significant Digits.
+ while (digitsString.length() < minSig) {
+ digitsString.append(u'@');
+ }
+ while (digitsString.length() < maxSig) {
+ digitsString.append(u'#');
+ }
+ } else if (roundingInterval != 0.0 && !ignoreRoundingIncrement(roundingInterval,maxFrac)) {
+ // Rounding Interval.
+ digitsStringScale = -roundingutils::doubleFractionLength(roundingInterval, nullptr);
+ // TODO: Check for DoS here?
+ DecimalQuantity incrementQuantity;
+ incrementQuantity.setToDouble(roundingInterval);
+ incrementQuantity.adjustMagnitude(-digitsStringScale);
+ incrementQuantity.roundToMagnitude(0, kDefaultMode, status);
+ UnicodeString str = incrementQuantity.toPlainString();
+ if (str.charAt(0) == u'-') {
+ // TODO: Unsupported operation exception or fail silently?
+ digitsString.append(str, 1, str.length() - 1);
+ } else {
+ digitsString.append(str);
+ }
+ }
+ while (digitsString.length() + digitsStringScale < minInt) {
+ digitsString.insert(0, u'0');
+ }
+ while (-digitsStringScale < minFrac) {
+ digitsString.append(u'0');
+ digitsStringScale--;
+ }
+
+ // Write the digits to the string builder
+ int32_t m0 = uprv_max(groupingLength, digitsString.length() + digitsStringScale);
+ m0 = (maxInt != dosMax) ? uprv_max(maxInt, m0) - 1 : m0 - 1;
+ int32_t mN = (maxFrac != dosMax) ? uprv_min(-maxFrac, digitsStringScale) : digitsStringScale;
+ for (int32_t magnitude = m0; magnitude >= mN; magnitude--) {
+ int32_t di = digitsString.length() + digitsStringScale - magnitude - 1;
+ if (di < 0 || di >= digitsString.length()) {
+ sb.append(u'#');
+ } else {
+ sb.append(digitsString.charAt(di));
+ }
+ // Decimal separator
+ if (magnitude == 0 && (alwaysShowDecimal || mN < 0)) {
+ sb.append(u'.');
+ }
+ if (!useGrouping) {
+ continue;
+ }
+ // Least-significant grouping separator
+ if (magnitude > 0 && magnitude == grouping1) {
+ sb.append(u',');
+ }
+ // All other grouping separators
+ if (magnitude > grouping1 && grouping2 > 0 && (magnitude - grouping1) % grouping2 == 0) {
+ sb.append(u',');
+ }
+ }
+
+ // Exponential notation
+ if (exponentDigits != uprv_min(dosMax, -1)) {
+ sb.append(u'E');
+ if (exponentShowPlusSign) {
+ sb.append(u'+');
+ }
+ for (int32_t i = 0; i < exponentDigits; i++) {
+ sb.append(u'0');
+ }
+ }
+
+ // Suffixes
+ int32_t beforeSuffixPos = sb.length();
+ sb.append(affixProvider.get().getString(AffixPatternProvider::AFFIX_POS_SUFFIX));
+
+ // Resolve Padding
+ if (paddingWidth > 0 && !paddingLocation.isNull()) {
+ while (paddingWidth - sb.length() > 0) {
+ sb.insert(afterPrefixPos, u'#');
+ beforeSuffixPos++;
+ }
+ int32_t addedLength;
+ switch (paddingLocation.get(status)) {
+ case PadPosition::UNUM_PAD_BEFORE_PREFIX:
+ addedLength = escapePaddingString(paddingString, sb, 0, status);
+ sb.insert(0, u'*');
+ afterPrefixPos += addedLength + 1;
+ beforeSuffixPos += addedLength + 1;
+ break;
+ case PadPosition::UNUM_PAD_AFTER_PREFIX:
+ addedLength = escapePaddingString(paddingString, sb, afterPrefixPos, status);
+ sb.insert(afterPrefixPos, u'*');
+ afterPrefixPos += addedLength + 1;
+ beforeSuffixPos += addedLength + 1;
+ break;
+ case PadPosition::UNUM_PAD_BEFORE_SUFFIX:
+ escapePaddingString(paddingString, sb, beforeSuffixPos, status);
+ sb.insert(beforeSuffixPos, u'*');
+ break;
+ case PadPosition::UNUM_PAD_AFTER_SUFFIX:
+ sb.append(u'*');
+ escapePaddingString(paddingString, sb, sb.length(), status);
+ break;
+ }
+ if (U_FAILURE(status)) { return sb; }
+ }
+
+ // Negative affixes
+ // Ignore if the negative prefix pattern is "-" and the negative suffix is empty
+ if (affixProvider.get().hasNegativeSubpattern()) {
+ sb.append(u';');
+ sb.append(affixProvider.get().getString(AffixPatternProvider::AFFIX_NEG_PREFIX));
+ // Copy the positive digit format into the negative.
+ // This is optional; the pattern is the same as if '#' were appended here instead.
+ // NOTE: It is not safe to append the UnicodeString to itself, so we need to copy.
+ // See http://bugs.icu-project.org/trac/ticket/13707
+ UnicodeString copy(sb);
+ sb.append(copy, afterPrefixPos, beforeSuffixPos - afterPrefixPos);
+ sb.append(affixProvider.get().getString(AffixPatternProvider::AFFIX_NEG_SUFFIX));
+ }
+
+ return sb;
+}
+
+int PatternStringUtils::escapePaddingString(UnicodeString input, UnicodeString& output, int startIndex,
+ UErrorCode& status) {
+ (void) status;
+ if (input.length() == 0) {
+ input.setTo(kFallbackPaddingString, -1);
+ }
+ int startLength = output.length();
+ if (input.length() == 1) {
+ if (input.compare(u"'", -1) == 0) {
+ output.insert(startIndex, u"''", -1);
+ } else {
+ output.insert(startIndex, input);
+ }
+ } else {
+ output.insert(startIndex, u'\'');
+ int offset = 1;
+ for (int i = 0; i < input.length(); i++) {
+ // it's okay to deal in chars here because the quote mark is the only interesting thing.
+ char16_t ch = input.charAt(i);
+ if (ch == u'\'') {
+ output.insert(startIndex + offset, u"''", -1);
+ offset += 2;
+ } else {
+ output.insert(startIndex + offset, ch);
+ offset += 1;
+ }
+ }
+ output.insert(startIndex + offset, u'\'');
+ }
+ return output.length() - startLength;
+}
+
+UnicodeString
+PatternStringUtils::convertLocalized(const UnicodeString& input, const DecimalFormatSymbols& symbols,
+ bool toLocalized, UErrorCode& status) {
+ // Construct a table of strings to be converted between localized and standard.
+ static constexpr int32_t LEN = 21;
+ UnicodeString table[LEN][2];
+ int standIdx = toLocalized ? 0 : 1;
+ int localIdx = toLocalized ? 1 : 0;
+ table[0][standIdx] = u"%";
+ table[0][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kPercentSymbol);
+ table[1][standIdx] = u"‰";
+ table[1][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kPerMillSymbol);
+ table[2][standIdx] = u".";
+ table[2][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kDecimalSeparatorSymbol);
+ table[3][standIdx] = u",";
+ table[3][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kGroupingSeparatorSymbol);
+ table[4][standIdx] = u"-";
+ table[4][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kMinusSignSymbol);
+ table[5][standIdx] = u"+";
+ table[5][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kPlusSignSymbol);
+ table[6][standIdx] = u";";
+ table[6][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kPatternSeparatorSymbol);
+ table[7][standIdx] = u"@";
+ table[7][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kSignificantDigitSymbol);
+ table[8][standIdx] = u"E";
+ table[8][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kExponentialSymbol);
+ table[9][standIdx] = u"*";
+ table[9][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kPadEscapeSymbol);
+ table[10][standIdx] = u"#";
+ table[10][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kDigitSymbol);
+ for (int i = 0; i < 10; i++) {
+ table[11 + i][standIdx] = u'0' + i;
+ table[11 + i][localIdx] = symbols.getConstDigitSymbol(i);
+ }
+
+ // Special case: quotes are NOT allowed to be in any localIdx strings.
+ // Substitute them with '’' instead.
+ for (int32_t i = 0; i < LEN; i++) {
+ table[i][localIdx].findAndReplace(u'\'', u'’');
+ }
+
+ // Iterate through the string and convert.
+ // State table:
+ // 0 => base state
+ // 1 => first char inside a quoted sequence in input and output string
+ // 2 => inside a quoted sequence in input and output string
+ // 3 => first char after a close quote in input string;
+ // close quote still needs to be written to output string
+ // 4 => base state in input string; inside quoted sequence in output string
+ // 5 => first char inside a quoted sequence in input string;
+ // inside quoted sequence in output string
+ UnicodeString result;
+ int state = 0;
+ for (int offset = 0; offset < input.length(); offset++) {
+ UChar ch = input.charAt(offset);
+
+ // Handle a quote character (state shift)
+ if (ch == u'\'') {
+ if (state == 0) {
+ result.append(u'\'');
+ state = 1;
+ continue;
+ } else if (state == 1) {
+ result.append(u'\'');
+ state = 0;
+ continue;
+ } else if (state == 2) {
+ state = 3;
+ continue;
+ } else if (state == 3) {
+ result.append(u'\'');
+ result.append(u'\'');
+ state = 1;
+ continue;
+ } else if (state == 4) {
+ state = 5;
+ continue;
+ } else {
+ U_ASSERT(state == 5);
+ result.append(u'\'');
+ result.append(u'\'');
+ state = 4;
+ continue;
+ }
+ }
+
+ if (state == 0 || state == 3 || state == 4) {
+ for (auto& pair : table) {
+ // Perform a greedy match on this symbol string
+ UnicodeString temp = input.tempSubString(offset, pair[0].length());
+ if (temp == pair[0]) {
+ // Skip ahead past this region for the next iteration
+ offset += pair[0].length() - 1;
+ if (state == 3 || state == 4) {
+ result.append(u'\'');
+ state = 0;
+ }
+ result.append(pair[1]);
+ goto continue_outer;
+ }
+ }
+ // No replacement found. Check if a special quote is necessary
+ for (auto& pair : table) {
+ UnicodeString temp = input.tempSubString(offset, pair[1].length());
+ if (temp == pair[1]) {
+ if (state == 0) {
+ result.append(u'\'');
+ state = 4;
+ }
+ result.append(ch);
+ goto continue_outer;
+ }
+ }
+ // Still nothing. Copy the char verbatim. (Add a close quote if necessary)
+ if (state == 3 || state == 4) {
+ result.append(u'\'');
+ state = 0;
+ }
+ result.append(ch);
+ } else {
+ U_ASSERT(state == 1 || state == 2 || state == 5);
+ result.append(ch);
+ state = 2;
+ }
+ continue_outer:;
+ }
+ // Resolve final quotes
+ if (state == 3 || state == 4) {
+ result.append(u'\'');
+ state = 0;
+ }
+ if (state != 0) {
+ // Malformed localized pattern: unterminated quote
+ status = U_PATTERN_SYNTAX_ERROR;
+ }
+ return result;
+}
+
+void PatternStringUtils::patternInfoToStringBuilder(const AffixPatternProvider& patternInfo, bool isPrefix,
+ PatternSignType patternSignType,
+ StandardPlural::Form plural,
+ bool perMilleReplacesPercent, UnicodeString& output) {
+
+ // Should the output render '+' where '-' would normally appear in the pattern?
+ bool plusReplacesMinusSign = (patternSignType == PATTERN_SIGN_TYPE_POS_SIGN)
+ && !patternInfo.positiveHasPlusSign();
+
+ // Should we use the affix from the negative subpattern?
+ // (If not, we will use the positive subpattern.)
+ bool useNegativeAffixPattern = patternInfo.hasNegativeSubpattern()
+ && (patternSignType == PATTERN_SIGN_TYPE_NEG
+ || (patternInfo.negativeHasMinusSign() && plusReplacesMinusSign));
+
+ // Resolve the flags for the affix pattern.
+ int flags = 0;
+ if (useNegativeAffixPattern) {
+ flags |= AffixPatternProvider::AFFIX_NEGATIVE_SUBPATTERN;
+ }
+ if (isPrefix) {
+ flags |= AffixPatternProvider::AFFIX_PREFIX;
+ }
+ if (plural != StandardPlural::Form::COUNT) {
+ U_ASSERT(plural == (AffixPatternProvider::AFFIX_PLURAL_MASK & plural));
+ flags |= plural;
+ }
+
+ // Should we prepend a sign to the pattern?
+ bool prependSign;
+ if (!isPrefix || useNegativeAffixPattern) {
+ prependSign = false;
+ } else if (patternSignType == PATTERN_SIGN_TYPE_NEG) {
+ prependSign = true;
+ } else {
+ prependSign = plusReplacesMinusSign;
+ }
+
+ // Compute the length of the affix pattern.
+ int length = patternInfo.length(flags) + (prependSign ? 1 : 0);
+
+ // Finally, set the result into the StringBuilder.
+ output.remove();
+ for (int index = 0; index < length; index++) {
+ char16_t candidate;
+ if (prependSign && index == 0) {
+ candidate = u'-';
+ } else if (prependSign) {
+ candidate = patternInfo.charAt(flags, index - 1);
+ } else {
+ candidate = patternInfo.charAt(flags, index);
+ }
+ if (plusReplacesMinusSign && candidate == u'-') {
+ candidate = u'+';
+ }
+ if (perMilleReplacesPercent && candidate == u'%') {
+ candidate = u'‰';
+ }
+ output.append(candidate);
+ }
+}
+
+PatternSignType PatternStringUtils::resolveSignDisplay(UNumberSignDisplay signDisplay, Signum signum) {
+ switch (signDisplay) {
+ case UNUM_SIGN_AUTO:
+ case UNUM_SIGN_ACCOUNTING:
+ switch (signum) {
+ case SIGNUM_NEG:
+ case SIGNUM_NEG_ZERO:
+ return PATTERN_SIGN_TYPE_NEG;
+ case SIGNUM_POS_ZERO:
+ case SIGNUM_POS:
+ return PATTERN_SIGN_TYPE_POS;
+ default:
+ break;
+ }
+ break;
+
+ case UNUM_SIGN_ALWAYS:
+ case UNUM_SIGN_ACCOUNTING_ALWAYS:
+ switch (signum) {
+ case SIGNUM_NEG:
+ case SIGNUM_NEG_ZERO:
+ return PATTERN_SIGN_TYPE_NEG;
+ case SIGNUM_POS_ZERO:
+ case SIGNUM_POS:
+ return PATTERN_SIGN_TYPE_POS_SIGN;
+ default:
+ break;
+ }
+ break;
+
+ case UNUM_SIGN_EXCEPT_ZERO:
+ case UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO:
+ switch (signum) {
+ case SIGNUM_NEG:
+ return PATTERN_SIGN_TYPE_NEG;
+ case SIGNUM_NEG_ZERO:
+ case SIGNUM_POS_ZERO:
+ return PATTERN_SIGN_TYPE_POS;
+ case SIGNUM_POS:
+ return PATTERN_SIGN_TYPE_POS_SIGN;
+ default:
+ break;
+ }
+ break;
+
+ case UNUM_SIGN_NEVER:
+ return PATTERN_SIGN_TYPE_POS;
+
+ default:
+ break;
+ }
+
+ UPRV_UNREACHABLE;
+ return PATTERN_SIGN_TYPE_POS;
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_patternstring.h b/contrib/libs/icu/i18n/number_patternstring.h
index b25f1afa43..54f37fd7e2 100644
--- a/contrib/libs/icu/i18n/number_patternstring.h
+++ b/contrib/libs/icu/i18n/number_patternstring.h
@@ -1,329 +1,329 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMBER_PATTERNSTRING_H__
-#define __NUMBER_PATTERNSTRING_H__
-
-
-#include <cstdint>
-#include "unicode/unum.h"
-#include "unicode/unistr.h"
-#include "number_types.h"
-#include "number_decimalquantity.h"
-#include "number_decimfmtprops.h"
-#include "number_affixutils.h"
-
-U_NAMESPACE_BEGIN namespace number {
-namespace impl {
-
-// Forward declaration
-class PatternParser;
-
-// Note: the order of fields in this enum matters for parsing.
-enum PatternSignType {
- /** Render using normal positive subpattern rules */
- PATTERN_SIGN_TYPE_POS,
- /** Render using rules to force the display of a plus sign */
- PATTERN_SIGN_TYPE_POS_SIGN,
- /** Render using negative subpattern rules */
- PATTERN_SIGN_TYPE_NEG,
- /** Count for looping over the possibilities */
- PATTERN_SIGN_TYPE_COUNT
-};
-
-// Exported as U_I18N_API because it is a public member field of exported ParsedSubpatternInfo
-struct U_I18N_API Endpoints {
- int32_t start = 0;
- int32_t end = 0;
-};
-
-// Exported as U_I18N_API because it is a public member field of exported ParsedPatternInfo
-struct U_I18N_API ParsedSubpatternInfo {
- uint64_t groupingSizes = 0x0000ffffffff0000L;
- int32_t integerLeadingHashSigns = 0;
- int32_t integerTrailingHashSigns = 0;
- int32_t integerNumerals = 0;
- int32_t integerAtSigns = 0;
- int32_t integerTotal = 0; // for convenience
- int32_t fractionNumerals = 0;
- int32_t fractionHashSigns = 0;
- int32_t fractionTotal = 0; // for convenience
- bool hasDecimal = false;
- int32_t widthExceptAffixes = 0;
- // Note: NullableValue causes issues here with std::move.
- bool hasPadding = false;
- UNumberFormatPadPosition paddingLocation = UNUM_PAD_BEFORE_PREFIX;
- DecimalQuantity rounding;
- bool exponentHasPlusSign = false;
- int32_t exponentZeros = 0;
- bool hasPercentSign = false;
- bool hasPerMilleSign = false;
- bool hasCurrencySign = false;
- bool hasMinusSign = false;
- bool hasPlusSign = false;
-
- Endpoints prefixEndpoints;
- Endpoints suffixEndpoints;
- Endpoints paddingEndpoints;
-};
-
-// Exported as U_I18N_API because it is needed for the unit test PatternStringTest
-struct U_I18N_API ParsedPatternInfo : public AffixPatternProvider, public UMemory {
- UnicodeString pattern;
- ParsedSubpatternInfo positive;
- ParsedSubpatternInfo negative;
-
- ParsedPatternInfo()
- : state(this->pattern), currentSubpattern(nullptr) {}
-
- ~ParsedPatternInfo() U_OVERRIDE = default;
-
- // Need to declare this explicitly because of the destructor
- ParsedPatternInfo& operator=(ParsedPatternInfo&& src) U_NOEXCEPT = default;
-
- static int32_t getLengthFromEndpoints(const Endpoints& endpoints);
-
- char16_t charAt(int32_t flags, int32_t index) const U_OVERRIDE;
-
- int32_t length(int32_t flags) const U_OVERRIDE;
-
- UnicodeString getString(int32_t flags) const U_OVERRIDE;
-
- bool positiveHasPlusSign() const U_OVERRIDE;
-
- bool hasNegativeSubpattern() const U_OVERRIDE;
-
- bool negativeHasMinusSign() const U_OVERRIDE;
-
- bool hasCurrencySign() const U_OVERRIDE;
-
- bool containsSymbolType(AffixPatternType type, UErrorCode& status) const U_OVERRIDE;
-
- bool hasBody() const U_OVERRIDE;
-
- private:
- struct U_I18N_API ParserState {
- const UnicodeString& pattern; // reference to the parent
- int32_t offset = 0;
-
- explicit ParserState(const UnicodeString& _pattern)
- : pattern(_pattern) {}
-
- ParserState& operator=(ParserState&& src) U_NOEXCEPT {
- // Leave pattern reference alone; it will continue to point to the same place in memory,
- // which gets overwritten by ParsedPatternInfo's implicit move assignment.
- offset = src.offset;
- return *this;
- }
-
- UChar32 peek();
-
- UChar32 next();
-
- // TODO: We don't currently do anything with the message string.
- // This method is here as a shell for Java compatibility.
- inline void toParseException(const char16_t* message) { (void) message; }
- } state;
-
- // NOTE: In Java, these are written as pure functions.
- // In C++, they're written as methods.
- // The behavior is the same.
-
- // Mutable transient pointer:
- ParsedSubpatternInfo* currentSubpattern;
-
- // In Java, "negative == null" tells us whether or not we had a negative subpattern.
- // In C++, we need to remember in another boolean.
- bool fHasNegativeSubpattern = false;
-
- const Endpoints& getEndpoints(int32_t flags) const;
-
- /** Run the recursive descent parser. */
- void consumePattern(const UnicodeString& patternString, UErrorCode& status);
-
- void consumeSubpattern(UErrorCode& status);
-
- void consumePadding(PadPosition paddingLocation, UErrorCode& status);
-
- void consumeAffix(Endpoints& endpoints, UErrorCode& status);
-
- void consumeLiteral(UErrorCode& status);
-
- void consumeFormat(UErrorCode& status);
-
- void consumeIntegerFormat(UErrorCode& status);
-
- void consumeFractionFormat(UErrorCode& status);
-
- void consumeExponent(UErrorCode& status);
-
- friend class PatternParser;
-};
-
-enum IgnoreRounding {
- IGNORE_ROUNDING_NEVER = 0, IGNORE_ROUNDING_IF_CURRENCY = 1, IGNORE_ROUNDING_ALWAYS = 2
-};
-
-class U_I18N_API PatternParser {
- public:
- /**
- * Runs the recursive descent parser on the given pattern string, returning a data structure with raw information
- * about the pattern string.
- *
- * <p>
- * To obtain a more useful form of the data, consider using {@link #parseToProperties} instead.
- *
- * TODO: Change argument type to const char16_t* instead of UnicodeString?
- *
- * @param patternString
- * The LDML decimal format pattern (Excel-style pattern) to parse.
- * @return The results of the parse.
- */
- static void parseToPatternInfo(const UnicodeString& patternString, ParsedPatternInfo& patternInfo,
- UErrorCode& status);
-
- /**
- * Parses a pattern string into a new property bag.
- *
- * @param pattern
- * The pattern string, like "#,##0.00"
- * @param ignoreRounding
- * Whether to leave out rounding information (minFrac, maxFrac, and rounding increment) when parsing the
- * pattern. This may be desirable if a custom rounding mode, such as CurrencyUsage, is to be used
- * instead.
- * @return A property bag object.
- * @throws IllegalArgumentException
- * If there is a syntax error in the pattern string.
- */
- static DecimalFormatProperties parseToProperties(const UnicodeString& pattern,
- IgnoreRounding ignoreRounding, UErrorCode& status);
-
- static DecimalFormatProperties parseToProperties(const UnicodeString& pattern, UErrorCode& status);
-
- /**
- * Parses a pattern string into an existing property bag. All properties that can be encoded into a pattern string
- * will be overwritten with either their default value or with the value coming from the pattern string. Properties
- * that cannot be encoded into a pattern string, such as rounding mode, are not modified.
- *
- * @param pattern
- * The pattern string, like "#,##0.00"
- * @param properties
- * The property bag object to overwrite.
- * @param ignoreRounding
- * See {@link #parseToProperties(String pattern, int ignoreRounding)}.
- * @throws IllegalArgumentException
- * If there was a syntax error in the pattern string.
- */
- static void parseToExistingProperties(const UnicodeString& pattern,
- DecimalFormatProperties& properties,
- IgnoreRounding ignoreRounding, UErrorCode& status);
-
- private:
- static void parseToExistingPropertiesImpl(const UnicodeString& pattern,
- DecimalFormatProperties& properties,
- IgnoreRounding ignoreRounding, UErrorCode& status);
-
- /** Finalizes the temporary data stored in the ParsedPatternInfo to the Properties. */
- static void patternInfoToProperties(DecimalFormatProperties& properties,
- ParsedPatternInfo& patternInfo, IgnoreRounding _ignoreRounding,
- UErrorCode& status);
-};
-
-class U_I18N_API PatternStringUtils {
- public:
- /**
- * Determine whether a given roundingIncrement should be ignored for formatting
- * based on the current maxFrac value (maximum fraction digits). For example a
- * roundingIncrement of 0.01 should be ignored if maxFrac is 1, but not if maxFrac
- * is 2 or more. Note that roundingIncrements are rounded up in significance, so
- * a roundingIncrement of 0.006 is treated like 0.01 for this determination, i.e.
- * it should not be ignored if maxFrac is 2 or more (but a roundingIncrement of
- * 0.005 is treated like 0.001 for significance).
- *
- * This test is needed for both NumberPropertyMapper::oldToNew and
- * PatternStringUtils::propertiesToPatternString. In Java it cannot be
- * exported by NumberPropertyMapper (package provate) so it is in
- * PatternStringUtils, do the same in C.
- *
- * @param roundIncr
- * The roundingIncrement to be checked. Must be non-zero.
- * @param maxFrac
- * The current maximum fraction digits value.
- * @return true if roundIncr should be ignored for formatting.
- */
- static bool ignoreRoundingIncrement(double roundIncr, int32_t maxFrac);
-
- /**
- * Creates a pattern string from a property bag.
- *
- * <p>
- * Since pattern strings support only a subset of the functionality available in a property bag, a new property bag
- * created from the string returned by this function may not be the same as the original property bag.
- *
- * @param properties
- * The property bag to serialize.
- * @return A pattern string approximately serializing the property bag.
- */
- static UnicodeString propertiesToPatternString(const DecimalFormatProperties& properties,
- UErrorCode& status);
-
-
- /**
- * Converts a pattern between standard notation and localized notation. Localized notation means that instead of
- * using generic placeholders in the pattern, you use the corresponding locale-specific characters instead. For
- * example, in locale <em>fr-FR</em>, the period in the pattern "0.000" means "decimal" in standard notation (as it
- * does in every other locale), but it means "grouping" in localized notation.
- *
- * <p>
- * A greedy string-substitution strategy is used to substitute locale symbols. If two symbols are ambiguous or have
- * the same prefix, the result is not well-defined.
- *
- * <p>
- * Locale symbols are not allowed to contain the ASCII quote character.
- *
- * <p>
- * This method is provided for backwards compatibility and should not be used in any new code.
- *
- * TODO(C++): This method is not yet implemented.
- *
- * @param input
- * The pattern to convert.
- * @param symbols
- * The symbols corresponding to the localized pattern.
- * @param toLocalized
- * true to convert from standard to localized notation; false to convert from localized to standard
- * notation.
- * @return The pattern expressed in the other notation.
- */
- static UnicodeString convertLocalized(const UnicodeString& input, const DecimalFormatSymbols& symbols,
- bool toLocalized, UErrorCode& status);
-
- /**
- * This method contains the heart of the logic for rendering LDML affix strings. It handles
- * sign-always-shown resolution, whether to use the positive or negative subpattern, permille
- * substitution, and plural forms for CurrencyPluralInfo.
- */
- static void patternInfoToStringBuilder(const AffixPatternProvider& patternInfo, bool isPrefix,
- PatternSignType patternSignType,
- StandardPlural::Form plural, bool perMilleReplacesPercent,
- UnicodeString& output);
-
- static PatternSignType resolveSignDisplay(UNumberSignDisplay signDisplay, Signum signum);
-
- private:
- /** @return The number of chars inserted. */
- static int escapePaddingString(UnicodeString input, UnicodeString& output, int startIndex,
- UErrorCode& status);
-};
-
-} // namespace impl
-} // namespace number
-U_NAMESPACE_END
-
-
-#endif //__NUMBER_PATTERNSTRING_H__
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMBER_PATTERNSTRING_H__
+#define __NUMBER_PATTERNSTRING_H__
+
+
+#include <cstdint>
+#include "unicode/unum.h"
+#include "unicode/unistr.h"
+#include "number_types.h"
+#include "number_decimalquantity.h"
+#include "number_decimfmtprops.h"
+#include "number_affixutils.h"
+
+U_NAMESPACE_BEGIN namespace number {
+namespace impl {
+
+// Forward declaration
+class PatternParser;
+
+// Note: the order of fields in this enum matters for parsing.
+enum PatternSignType {
+ /** Render using normal positive subpattern rules */
+ PATTERN_SIGN_TYPE_POS,
+ /** Render using rules to force the display of a plus sign */
+ PATTERN_SIGN_TYPE_POS_SIGN,
+ /** Render using negative subpattern rules */
+ PATTERN_SIGN_TYPE_NEG,
+ /** Count for looping over the possibilities */
+ PATTERN_SIGN_TYPE_COUNT
+};
+
+// Exported as U_I18N_API because it is a public member field of exported ParsedSubpatternInfo
+struct U_I18N_API Endpoints {
+ int32_t start = 0;
+ int32_t end = 0;
+};
+
+// Exported as U_I18N_API because it is a public member field of exported ParsedPatternInfo
+struct U_I18N_API ParsedSubpatternInfo {
+ uint64_t groupingSizes = 0x0000ffffffff0000L;
+ int32_t integerLeadingHashSigns = 0;
+ int32_t integerTrailingHashSigns = 0;
+ int32_t integerNumerals = 0;
+ int32_t integerAtSigns = 0;
+ int32_t integerTotal = 0; // for convenience
+ int32_t fractionNumerals = 0;
+ int32_t fractionHashSigns = 0;
+ int32_t fractionTotal = 0; // for convenience
+ bool hasDecimal = false;
+ int32_t widthExceptAffixes = 0;
+ // Note: NullableValue causes issues here with std::move.
+ bool hasPadding = false;
+ UNumberFormatPadPosition paddingLocation = UNUM_PAD_BEFORE_PREFIX;
+ DecimalQuantity rounding;
+ bool exponentHasPlusSign = false;
+ int32_t exponentZeros = 0;
+ bool hasPercentSign = false;
+ bool hasPerMilleSign = false;
+ bool hasCurrencySign = false;
+ bool hasMinusSign = false;
+ bool hasPlusSign = false;
+
+ Endpoints prefixEndpoints;
+ Endpoints suffixEndpoints;
+ Endpoints paddingEndpoints;
+};
+
+// Exported as U_I18N_API because it is needed for the unit test PatternStringTest
+struct U_I18N_API ParsedPatternInfo : public AffixPatternProvider, public UMemory {
+ UnicodeString pattern;
+ ParsedSubpatternInfo positive;
+ ParsedSubpatternInfo negative;
+
+ ParsedPatternInfo()
+ : state(this->pattern), currentSubpattern(nullptr) {}
+
+ ~ParsedPatternInfo() U_OVERRIDE = default;
+
+ // Need to declare this explicitly because of the destructor
+ ParsedPatternInfo& operator=(ParsedPatternInfo&& src) U_NOEXCEPT = default;
+
+ static int32_t getLengthFromEndpoints(const Endpoints& endpoints);
+
+ char16_t charAt(int32_t flags, int32_t index) const U_OVERRIDE;
+
+ int32_t length(int32_t flags) const U_OVERRIDE;
+
+ UnicodeString getString(int32_t flags) const U_OVERRIDE;
+
+ bool positiveHasPlusSign() const U_OVERRIDE;
+
+ bool hasNegativeSubpattern() const U_OVERRIDE;
+
+ bool negativeHasMinusSign() const U_OVERRIDE;
+
+ bool hasCurrencySign() const U_OVERRIDE;
+
+ bool containsSymbolType(AffixPatternType type, UErrorCode& status) const U_OVERRIDE;
+
+ bool hasBody() const U_OVERRIDE;
+
+ private:
+ struct U_I18N_API ParserState {
+ const UnicodeString& pattern; // reference to the parent
+ int32_t offset = 0;
+
+ explicit ParserState(const UnicodeString& _pattern)
+ : pattern(_pattern) {}
+
+ ParserState& operator=(ParserState&& src) U_NOEXCEPT {
+ // Leave pattern reference alone; it will continue to point to the same place in memory,
+ // which gets overwritten by ParsedPatternInfo's implicit move assignment.
+ offset = src.offset;
+ return *this;
+ }
+
+ UChar32 peek();
+
+ UChar32 next();
+
+ // TODO: We don't currently do anything with the message string.
+ // This method is here as a shell for Java compatibility.
+ inline void toParseException(const char16_t* message) { (void) message; }
+ } state;
+
+ // NOTE: In Java, these are written as pure functions.
+ // In C++, they're written as methods.
+ // The behavior is the same.
+
+ // Mutable transient pointer:
+ ParsedSubpatternInfo* currentSubpattern;
+
+ // In Java, "negative == null" tells us whether or not we had a negative subpattern.
+ // In C++, we need to remember in another boolean.
+ bool fHasNegativeSubpattern = false;
+
+ const Endpoints& getEndpoints(int32_t flags) const;
+
+ /** Run the recursive descent parser. */
+ void consumePattern(const UnicodeString& patternString, UErrorCode& status);
+
+ void consumeSubpattern(UErrorCode& status);
+
+ void consumePadding(PadPosition paddingLocation, UErrorCode& status);
+
+ void consumeAffix(Endpoints& endpoints, UErrorCode& status);
+
+ void consumeLiteral(UErrorCode& status);
+
+ void consumeFormat(UErrorCode& status);
+
+ void consumeIntegerFormat(UErrorCode& status);
+
+ void consumeFractionFormat(UErrorCode& status);
+
+ void consumeExponent(UErrorCode& status);
+
+ friend class PatternParser;
+};
+
+enum IgnoreRounding {
+ IGNORE_ROUNDING_NEVER = 0, IGNORE_ROUNDING_IF_CURRENCY = 1, IGNORE_ROUNDING_ALWAYS = 2
+};
+
+class U_I18N_API PatternParser {
+ public:
+ /**
+ * Runs the recursive descent parser on the given pattern string, returning a data structure with raw information
+ * about the pattern string.
+ *
+ * <p>
+ * To obtain a more useful form of the data, consider using {@link #parseToProperties} instead.
+ *
+ * TODO: Change argument type to const char16_t* instead of UnicodeString?
+ *
+ * @param patternString
+ * The LDML decimal format pattern (Excel-style pattern) to parse.
+ * @return The results of the parse.
+ */
+ static void parseToPatternInfo(const UnicodeString& patternString, ParsedPatternInfo& patternInfo,
+ UErrorCode& status);
+
+ /**
+ * Parses a pattern string into a new property bag.
+ *
+ * @param pattern
+ * The pattern string, like "#,##0.00"
+ * @param ignoreRounding
+ * Whether to leave out rounding information (minFrac, maxFrac, and rounding increment) when parsing the
+ * pattern. This may be desirable if a custom rounding mode, such as CurrencyUsage, is to be used
+ * instead.
+ * @return A property bag object.
+ * @throws IllegalArgumentException
+ * If there is a syntax error in the pattern string.
+ */
+ static DecimalFormatProperties parseToProperties(const UnicodeString& pattern,
+ IgnoreRounding ignoreRounding, UErrorCode& status);
+
+ static DecimalFormatProperties parseToProperties(const UnicodeString& pattern, UErrorCode& status);
+
+ /**
+ * Parses a pattern string into an existing property bag. All properties that can be encoded into a pattern string
+ * will be overwritten with either their default value or with the value coming from the pattern string. Properties
+ * that cannot be encoded into a pattern string, such as rounding mode, are not modified.
+ *
+ * @param pattern
+ * The pattern string, like "#,##0.00"
+ * @param properties
+ * The property bag object to overwrite.
+ * @param ignoreRounding
+ * See {@link #parseToProperties(String pattern, int ignoreRounding)}.
+ * @throws IllegalArgumentException
+ * If there was a syntax error in the pattern string.
+ */
+ static void parseToExistingProperties(const UnicodeString& pattern,
+ DecimalFormatProperties& properties,
+ IgnoreRounding ignoreRounding, UErrorCode& status);
+
+ private:
+ static void parseToExistingPropertiesImpl(const UnicodeString& pattern,
+ DecimalFormatProperties& properties,
+ IgnoreRounding ignoreRounding, UErrorCode& status);
+
+ /** Finalizes the temporary data stored in the ParsedPatternInfo to the Properties. */
+ static void patternInfoToProperties(DecimalFormatProperties& properties,
+ ParsedPatternInfo& patternInfo, IgnoreRounding _ignoreRounding,
+ UErrorCode& status);
+};
+
+class U_I18N_API PatternStringUtils {
+ public:
+ /**
+ * Determine whether a given roundingIncrement should be ignored for formatting
+ * based on the current maxFrac value (maximum fraction digits). For example a
+ * roundingIncrement of 0.01 should be ignored if maxFrac is 1, but not if maxFrac
+ * is 2 or more. Note that roundingIncrements are rounded up in significance, so
+ * a roundingIncrement of 0.006 is treated like 0.01 for this determination, i.e.
+ * it should not be ignored if maxFrac is 2 or more (but a roundingIncrement of
+ * 0.005 is treated like 0.001 for significance).
+ *
+ * This test is needed for both NumberPropertyMapper::oldToNew and
+ * PatternStringUtils::propertiesToPatternString. In Java it cannot be
+ * exported by NumberPropertyMapper (package provate) so it is in
+ * PatternStringUtils, do the same in C.
+ *
+ * @param roundIncr
+ * The roundingIncrement to be checked. Must be non-zero.
+ * @param maxFrac
+ * The current maximum fraction digits value.
+ * @return true if roundIncr should be ignored for formatting.
+ */
+ static bool ignoreRoundingIncrement(double roundIncr, int32_t maxFrac);
+
+ /**
+ * Creates a pattern string from a property bag.
+ *
+ * <p>
+ * Since pattern strings support only a subset of the functionality available in a property bag, a new property bag
+ * created from the string returned by this function may not be the same as the original property bag.
+ *
+ * @param properties
+ * The property bag to serialize.
+ * @return A pattern string approximately serializing the property bag.
+ */
+ static UnicodeString propertiesToPatternString(const DecimalFormatProperties& properties,
+ UErrorCode& status);
+
+
+ /**
+ * Converts a pattern between standard notation and localized notation. Localized notation means that instead of
+ * using generic placeholders in the pattern, you use the corresponding locale-specific characters instead. For
+ * example, in locale <em>fr-FR</em>, the period in the pattern "0.000" means "decimal" in standard notation (as it
+ * does in every other locale), but it means "grouping" in localized notation.
+ *
+ * <p>
+ * A greedy string-substitution strategy is used to substitute locale symbols. If two symbols are ambiguous or have
+ * the same prefix, the result is not well-defined.
+ *
+ * <p>
+ * Locale symbols are not allowed to contain the ASCII quote character.
+ *
+ * <p>
+ * This method is provided for backwards compatibility and should not be used in any new code.
+ *
+ * TODO(C++): This method is not yet implemented.
+ *
+ * @param input
+ * The pattern to convert.
+ * @param symbols
+ * The symbols corresponding to the localized pattern.
+ * @param toLocalized
+ * true to convert from standard to localized notation; false to convert from localized to standard
+ * notation.
+ * @return The pattern expressed in the other notation.
+ */
+ static UnicodeString convertLocalized(const UnicodeString& input, const DecimalFormatSymbols& symbols,
+ bool toLocalized, UErrorCode& status);
+
+ /**
+ * This method contains the heart of the logic for rendering LDML affix strings. It handles
+ * sign-always-shown resolution, whether to use the positive or negative subpattern, permille
+ * substitution, and plural forms for CurrencyPluralInfo.
+ */
+ static void patternInfoToStringBuilder(const AffixPatternProvider& patternInfo, bool isPrefix,
+ PatternSignType patternSignType,
+ StandardPlural::Form plural, bool perMilleReplacesPercent,
+ UnicodeString& output);
+
+ static PatternSignType resolveSignDisplay(UNumberSignDisplay signDisplay, Signum signum);
+
+ private:
+ /** @return The number of chars inserted. */
+ static int escapePaddingString(UnicodeString input, UnicodeString& output, int startIndex,
+ UErrorCode& status);
+};
+
+} // namespace impl
+} // namespace number
+U_NAMESPACE_END
+
+
+#endif //__NUMBER_PATTERNSTRING_H__
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_rounding.cpp b/contrib/libs/icu/i18n/number_rounding.cpp
index 9481f9bcc2..3ffce673ad 100644
--- a/contrib/libs/icu/i18n/number_rounding.cpp
+++ b/contrib/libs/icu/i18n/number_rounding.cpp
@@ -1,441 +1,441 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "uassert.h"
-#include "unicode/numberformatter.h"
-#include "number_types.h"
-#include "number_decimalquantity.h"
-#include "double-conversion.h"
-#include "number_roundingutils.h"
-#include "putilimp.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-
-using double_conversion::DoubleToStringConverter;
-
-namespace {
-
-int32_t getRoundingMagnitudeFraction(int maxFrac) {
- if (maxFrac == -1) {
- return INT32_MIN;
- }
- return -maxFrac;
-}
-
-int32_t getRoundingMagnitudeSignificant(const DecimalQuantity &value, int maxSig) {
- if (maxSig == -1) {
- return INT32_MIN;
- }
- int magnitude = value.isZeroish() ? 0 : value.getMagnitude();
- return magnitude - maxSig + 1;
-}
-
-int32_t getDisplayMagnitudeFraction(int minFrac) {
- if (minFrac == 0) {
- return INT32_MAX;
- }
- return -minFrac;
-}
-
-int32_t getDisplayMagnitudeSignificant(const DecimalQuantity &value, int minSig) {
- int magnitude = value.isZeroish() ? 0 : value.getMagnitude();
- return magnitude - minSig + 1;
-}
-
-}
-
-
-MultiplierProducer::~MultiplierProducer() = default;
-
-
-digits_t roundingutils::doubleFractionLength(double input, int8_t* singleDigit) {
- char buffer[DoubleToStringConverter::kBase10MaximalLength + 1];
- bool sign; // unused; always positive
- int32_t length;
- int32_t point;
- DoubleToStringConverter::DoubleToAscii(
- input,
- DoubleToStringConverter::DtoaMode::SHORTEST,
- 0,
- buffer,
- sizeof(buffer),
- &sign,
- &length,
- &point
- );
-
- if (singleDigit == nullptr) {
- // no-op
- } else if (length == 1) {
- *singleDigit = buffer[0] - '0';
- } else {
- *singleDigit = -1;
- }
-
- return static_cast<digits_t>(length - point);
-}
-
-
-Precision Precision::unlimited() {
- return Precision(RND_NONE, {}, kDefaultMode);
-}
-
-FractionPrecision Precision::integer() {
- return constructFraction(0, 0);
-}
-
-FractionPrecision Precision::fixedFraction(int32_t minMaxFractionPlaces) {
- if (minMaxFractionPlaces >= 0 && minMaxFractionPlaces <= kMaxIntFracSig) {
- return constructFraction(minMaxFractionPlaces, minMaxFractionPlaces);
- } else {
- return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
- }
-}
-
-FractionPrecision Precision::minFraction(int32_t minFractionPlaces) {
- if (minFractionPlaces >= 0 && minFractionPlaces <= kMaxIntFracSig) {
- return constructFraction(minFractionPlaces, -1);
- } else {
- return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
- }
-}
-
-FractionPrecision Precision::maxFraction(int32_t maxFractionPlaces) {
- if (maxFractionPlaces >= 0 && maxFractionPlaces <= kMaxIntFracSig) {
- return constructFraction(0, maxFractionPlaces);
- } else {
- return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
- }
-}
-
-FractionPrecision Precision::minMaxFraction(int32_t minFractionPlaces, int32_t maxFractionPlaces) {
- if (minFractionPlaces >= 0 && maxFractionPlaces <= kMaxIntFracSig &&
- minFractionPlaces <= maxFractionPlaces) {
- return constructFraction(minFractionPlaces, maxFractionPlaces);
- } else {
- return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
- }
-}
-
-Precision Precision::fixedSignificantDigits(int32_t minMaxSignificantDigits) {
- if (minMaxSignificantDigits >= 1 && minMaxSignificantDigits <= kMaxIntFracSig) {
- return constructSignificant(minMaxSignificantDigits, minMaxSignificantDigits);
- } else {
- return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
- }
-}
-
-Precision Precision::minSignificantDigits(int32_t minSignificantDigits) {
- if (minSignificantDigits >= 1 && minSignificantDigits <= kMaxIntFracSig) {
- return constructSignificant(minSignificantDigits, -1);
- } else {
- return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
- }
-}
-
-Precision Precision::maxSignificantDigits(int32_t maxSignificantDigits) {
- if (maxSignificantDigits >= 1 && maxSignificantDigits <= kMaxIntFracSig) {
- return constructSignificant(1, maxSignificantDigits);
- } else {
- return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
- }
-}
-
-Precision Precision::minMaxSignificantDigits(int32_t minSignificantDigits, int32_t maxSignificantDigits) {
- if (minSignificantDigits >= 1 && maxSignificantDigits <= kMaxIntFracSig &&
- minSignificantDigits <= maxSignificantDigits) {
- return constructSignificant(minSignificantDigits, maxSignificantDigits);
- } else {
- return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
- }
-}
-
-IncrementPrecision Precision::increment(double roundingIncrement) {
- if (roundingIncrement > 0.0) {
- return constructIncrement(roundingIncrement, 0);
- } else {
- return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
- }
-}
-
-CurrencyPrecision Precision::currency(UCurrencyUsage currencyUsage) {
- return constructCurrency(currencyUsage);
-}
-
-Precision FractionPrecision::withMinDigits(int32_t minSignificantDigits) const {
- if (fType == RND_ERROR) { return *this; } // no-op in error state
- if (minSignificantDigits >= 1 && minSignificantDigits <= kMaxIntFracSig) {
- return constructFractionSignificant(*this, minSignificantDigits, -1);
- } else {
- return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
- }
-}
-
-Precision FractionPrecision::withMaxDigits(int32_t maxSignificantDigits) const {
- if (fType == RND_ERROR) { return *this; } // no-op in error state
- if (maxSignificantDigits >= 1 && maxSignificantDigits <= kMaxIntFracSig) {
- return constructFractionSignificant(*this, -1, maxSignificantDigits);
- } else {
- return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
- }
-}
-
-// Private method on base class
-Precision Precision::withCurrency(const CurrencyUnit &currency, UErrorCode &status) const {
- if (fType == RND_ERROR) { return *this; } // no-op in error state
- U_ASSERT(fType == RND_CURRENCY);
- const char16_t *isoCode = currency.getISOCurrency();
- double increment = ucurr_getRoundingIncrementForUsage(isoCode, fUnion.currencyUsage, &status);
- int32_t minMaxFrac = ucurr_getDefaultFractionDigitsForUsage(
- isoCode, fUnion.currencyUsage, &status);
- if (increment != 0.0) {
- return constructIncrement(increment, minMaxFrac);
- } else {
- return constructFraction(minMaxFrac, minMaxFrac);
- }
-}
-
-// Public method on CurrencyPrecision subclass
-Precision CurrencyPrecision::withCurrency(const CurrencyUnit &currency) const {
- UErrorCode localStatus = U_ZERO_ERROR;
- Precision result = Precision::withCurrency(currency, localStatus);
- if (U_FAILURE(localStatus)) {
- return {localStatus};
- }
- return result;
-}
-
-Precision IncrementPrecision::withMinFraction(int32_t minFrac) const {
- if (fType == RND_ERROR) { return *this; } // no-op in error state
- if (minFrac >= 0 && minFrac <= kMaxIntFracSig) {
- return constructIncrement(fUnion.increment.fIncrement, minFrac);
- } else {
- return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
- }
-}
-
-FractionPrecision Precision::constructFraction(int32_t minFrac, int32_t maxFrac) {
- FractionSignificantSettings settings;
- settings.fMinFrac = static_cast<digits_t>(minFrac);
- settings.fMaxFrac = static_cast<digits_t>(maxFrac);
- settings.fMinSig = -1;
- settings.fMaxSig = -1;
- PrecisionUnion union_;
- union_.fracSig = settings;
- return {RND_FRACTION, union_, kDefaultMode};
-}
-
-Precision Precision::constructSignificant(int32_t minSig, int32_t maxSig) {
- FractionSignificantSettings settings;
- settings.fMinFrac = -1;
- settings.fMaxFrac = -1;
- settings.fMinSig = static_cast<digits_t>(minSig);
- settings.fMaxSig = static_cast<digits_t>(maxSig);
- PrecisionUnion union_;
- union_.fracSig = settings;
- return {RND_SIGNIFICANT, union_, kDefaultMode};
-}
-
-Precision
-Precision::constructFractionSignificant(const FractionPrecision &base, int32_t minSig, int32_t maxSig) {
- FractionSignificantSettings settings = base.fUnion.fracSig;
- settings.fMinSig = static_cast<digits_t>(minSig);
- settings.fMaxSig = static_cast<digits_t>(maxSig);
- PrecisionUnion union_;
- union_.fracSig = settings;
- return {RND_FRACTION_SIGNIFICANT, union_, kDefaultMode};
-}
-
-IncrementPrecision Precision::constructIncrement(double increment, int32_t minFrac) {
- IncrementSettings settings;
- // Note: For number formatting, fIncrement is used for RND_INCREMENT but not
- // RND_INCREMENT_ONE or RND_INCREMENT_FIVE. However, fIncrement is used in all
- // three when constructing a skeleton.
- settings.fIncrement = increment;
- settings.fMinFrac = static_cast<digits_t>(minFrac);
- // One of the few pre-computed quantities:
- // Note: it is possible for minFrac to be more than maxFrac... (misleading)
- int8_t singleDigit;
- settings.fMaxFrac = roundingutils::doubleFractionLength(increment, &singleDigit);
- PrecisionUnion union_;
- union_.increment = settings;
- if (singleDigit == 1) {
- // NOTE: In C++, we must return the correct value type with the correct union.
- // It would be invalid to return a RND_FRACTION here because the methods on the
- // IncrementPrecision type assume that the union is backed by increment data.
- return {RND_INCREMENT_ONE, union_, kDefaultMode};
- } else if (singleDigit == 5) {
- return {RND_INCREMENT_FIVE, union_, kDefaultMode};
- } else {
- return {RND_INCREMENT, union_, kDefaultMode};
- }
-}
-
-CurrencyPrecision Precision::constructCurrency(UCurrencyUsage usage) {
- PrecisionUnion union_;
- union_.currencyUsage = usage;
- return {RND_CURRENCY, union_, kDefaultMode};
-}
-
-
-RoundingImpl::RoundingImpl(const Precision& precision, UNumberFormatRoundingMode roundingMode,
- const CurrencyUnit& currency, UErrorCode& status)
- : fPrecision(precision), fRoundingMode(roundingMode), fPassThrough(false) {
- if (precision.fType == Precision::RND_CURRENCY) {
- fPrecision = precision.withCurrency(currency, status);
- }
-}
-
-RoundingImpl RoundingImpl::passThrough() {
- return {};
-}
-
-bool RoundingImpl::isSignificantDigits() const {
- return fPrecision.fType == Precision::RND_SIGNIFICANT;
-}
-
-int32_t
-RoundingImpl::chooseMultiplierAndApply(impl::DecimalQuantity &input, const impl::MultiplierProducer &producer,
- UErrorCode &status) {
- // Do not call this method with zero, NaN, or infinity.
- U_ASSERT(!input.isZeroish());
-
- // Perform the first attempt at rounding.
- int magnitude = input.getMagnitude();
- int multiplier = producer.getMultiplier(magnitude);
- input.adjustMagnitude(multiplier);
- apply(input, status);
-
- // If the number rounded to zero, exit.
- if (input.isZeroish() || U_FAILURE(status)) {
- return multiplier;
- }
-
- // If the new magnitude after rounding is the same as it was before rounding, then we are done.
- // This case applies to most numbers.
- if (input.getMagnitude() == magnitude + multiplier) {
- return multiplier;
- }
-
- // If the above case DIDN'T apply, then we have a case like 99.9 -> 100 or 999.9 -> 1000:
- // The number rounded up to the next magnitude. Check if the multiplier changes; if it doesn't,
- // we do not need to make any more adjustments.
- int _multiplier = producer.getMultiplier(magnitude + 1);
- if (multiplier == _multiplier) {
- return multiplier;
- }
-
- // We have a case like 999.9 -> 1000, where the correct output is "1K", not "1000".
- // Fix the magnitude and re-apply the rounding strategy.
- input.adjustMagnitude(_multiplier - multiplier);
- apply(input, status);
- return _multiplier;
-}
-
-/** This is the method that contains the actual rounding logic. */
-void RoundingImpl::apply(impl::DecimalQuantity &value, UErrorCode& status) const {
- if (fPassThrough) {
- return;
- }
- switch (fPrecision.fType) {
- case Precision::RND_BOGUS:
- case Precision::RND_ERROR:
- // Errors should be caught before the apply() method is called
- status = U_INTERNAL_PROGRAM_ERROR;
- break;
-
- case Precision::RND_NONE:
- value.roundToInfinity();
- break;
-
- case Precision::RND_FRACTION:
- value.roundToMagnitude(
- getRoundingMagnitudeFraction(fPrecision.fUnion.fracSig.fMaxFrac),
- fRoundingMode,
- status);
- value.setMinFraction(
- uprv_max(0, -getDisplayMagnitudeFraction(fPrecision.fUnion.fracSig.fMinFrac)));
- break;
-
- case Precision::RND_SIGNIFICANT:
- value.roundToMagnitude(
- getRoundingMagnitudeSignificant(value, fPrecision.fUnion.fracSig.fMaxSig),
- fRoundingMode,
- status);
- value.setMinFraction(
- uprv_max(0, -getDisplayMagnitudeSignificant(value, fPrecision.fUnion.fracSig.fMinSig)));
- // Make sure that digits are displayed on zero.
- if (value.isZeroish() && fPrecision.fUnion.fracSig.fMinSig > 0) {
- value.setMinInteger(1);
- }
- break;
-
- case Precision::RND_FRACTION_SIGNIFICANT: {
- int32_t displayMag = getDisplayMagnitudeFraction(fPrecision.fUnion.fracSig.fMinFrac);
- int32_t roundingMag = getRoundingMagnitudeFraction(fPrecision.fUnion.fracSig.fMaxFrac);
- if (fPrecision.fUnion.fracSig.fMinSig == -1) {
- // Max Sig override
- int32_t candidate = getRoundingMagnitudeSignificant(
- value,
- fPrecision.fUnion.fracSig.fMaxSig);
- roundingMag = uprv_max(roundingMag, candidate);
- } else {
- // Min Sig override
- int32_t candidate = getDisplayMagnitudeSignificant(
- value,
- fPrecision.fUnion.fracSig.fMinSig);
- roundingMag = uprv_min(roundingMag, candidate);
- }
- value.roundToMagnitude(roundingMag, fRoundingMode, status);
- value.setMinFraction(uprv_max(0, -displayMag));
- break;
- }
-
- case Precision::RND_INCREMENT:
- value.roundToIncrement(
- fPrecision.fUnion.increment.fIncrement,
- fRoundingMode,
- status);
- value.setMinFraction(fPrecision.fUnion.increment.fMinFrac);
- break;
-
- case Precision::RND_INCREMENT_ONE:
- value.roundToMagnitude(
- -fPrecision.fUnion.increment.fMaxFrac,
- fRoundingMode,
- status);
- value.setMinFraction(fPrecision.fUnion.increment.fMinFrac);
- break;
-
- case Precision::RND_INCREMENT_FIVE:
- value.roundToNickel(
- -fPrecision.fUnion.increment.fMaxFrac,
- fRoundingMode,
- status);
- value.setMinFraction(fPrecision.fUnion.increment.fMinFrac);
- break;
-
- case Precision::RND_CURRENCY:
- // Call .withCurrency() before .apply()!
- UPRV_UNREACHABLE;
-
- default:
- UPRV_UNREACHABLE;
- }
-}
-
-void RoundingImpl::apply(impl::DecimalQuantity &value, int32_t minInt, UErrorCode /*status*/) {
- // This method is intended for the one specific purpose of helping print "00.000E0".
- U_ASSERT(isSignificantDigits());
- U_ASSERT(value.isZeroish());
- value.setMinFraction(fPrecision.fUnion.fracSig.fMinSig - minInt);
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "uassert.h"
+#include "unicode/numberformatter.h"
+#include "number_types.h"
+#include "number_decimalquantity.h"
+#include "double-conversion.h"
+#include "number_roundingutils.h"
+#include "putilimp.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+
+using double_conversion::DoubleToStringConverter;
+
+namespace {
+
+int32_t getRoundingMagnitudeFraction(int maxFrac) {
+ if (maxFrac == -1) {
+ return INT32_MIN;
+ }
+ return -maxFrac;
+}
+
+int32_t getRoundingMagnitudeSignificant(const DecimalQuantity &value, int maxSig) {
+ if (maxSig == -1) {
+ return INT32_MIN;
+ }
+ int magnitude = value.isZeroish() ? 0 : value.getMagnitude();
+ return magnitude - maxSig + 1;
+}
+
+int32_t getDisplayMagnitudeFraction(int minFrac) {
+ if (minFrac == 0) {
+ return INT32_MAX;
+ }
+ return -minFrac;
+}
+
+int32_t getDisplayMagnitudeSignificant(const DecimalQuantity &value, int minSig) {
+ int magnitude = value.isZeroish() ? 0 : value.getMagnitude();
+ return magnitude - minSig + 1;
+}
+
+}
+
+
+MultiplierProducer::~MultiplierProducer() = default;
+
+
+digits_t roundingutils::doubleFractionLength(double input, int8_t* singleDigit) {
+ char buffer[DoubleToStringConverter::kBase10MaximalLength + 1];
+ bool sign; // unused; always positive
+ int32_t length;
+ int32_t point;
+ DoubleToStringConverter::DoubleToAscii(
+ input,
+ DoubleToStringConverter::DtoaMode::SHORTEST,
+ 0,
+ buffer,
+ sizeof(buffer),
+ &sign,
+ &length,
+ &point
+ );
+
+ if (singleDigit == nullptr) {
+ // no-op
+ } else if (length == 1) {
+ *singleDigit = buffer[0] - '0';
+ } else {
+ *singleDigit = -1;
+ }
+
+ return static_cast<digits_t>(length - point);
+}
+
+
+Precision Precision::unlimited() {
+ return Precision(RND_NONE, {}, kDefaultMode);
+}
+
+FractionPrecision Precision::integer() {
+ return constructFraction(0, 0);
+}
+
+FractionPrecision Precision::fixedFraction(int32_t minMaxFractionPlaces) {
+ if (minMaxFractionPlaces >= 0 && minMaxFractionPlaces <= kMaxIntFracSig) {
+ return constructFraction(minMaxFractionPlaces, minMaxFractionPlaces);
+ } else {
+ return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
+ }
+}
+
+FractionPrecision Precision::minFraction(int32_t minFractionPlaces) {
+ if (minFractionPlaces >= 0 && minFractionPlaces <= kMaxIntFracSig) {
+ return constructFraction(minFractionPlaces, -1);
+ } else {
+ return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
+ }
+}
+
+FractionPrecision Precision::maxFraction(int32_t maxFractionPlaces) {
+ if (maxFractionPlaces >= 0 && maxFractionPlaces <= kMaxIntFracSig) {
+ return constructFraction(0, maxFractionPlaces);
+ } else {
+ return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
+ }
+}
+
+FractionPrecision Precision::minMaxFraction(int32_t minFractionPlaces, int32_t maxFractionPlaces) {
+ if (minFractionPlaces >= 0 && maxFractionPlaces <= kMaxIntFracSig &&
+ minFractionPlaces <= maxFractionPlaces) {
+ return constructFraction(minFractionPlaces, maxFractionPlaces);
+ } else {
+ return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
+ }
+}
+
+Precision Precision::fixedSignificantDigits(int32_t minMaxSignificantDigits) {
+ if (minMaxSignificantDigits >= 1 && minMaxSignificantDigits <= kMaxIntFracSig) {
+ return constructSignificant(minMaxSignificantDigits, minMaxSignificantDigits);
+ } else {
+ return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
+ }
+}
+
+Precision Precision::minSignificantDigits(int32_t minSignificantDigits) {
+ if (minSignificantDigits >= 1 && minSignificantDigits <= kMaxIntFracSig) {
+ return constructSignificant(minSignificantDigits, -1);
+ } else {
+ return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
+ }
+}
+
+Precision Precision::maxSignificantDigits(int32_t maxSignificantDigits) {
+ if (maxSignificantDigits >= 1 && maxSignificantDigits <= kMaxIntFracSig) {
+ return constructSignificant(1, maxSignificantDigits);
+ } else {
+ return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
+ }
+}
+
+Precision Precision::minMaxSignificantDigits(int32_t minSignificantDigits, int32_t maxSignificantDigits) {
+ if (minSignificantDigits >= 1 && maxSignificantDigits <= kMaxIntFracSig &&
+ minSignificantDigits <= maxSignificantDigits) {
+ return constructSignificant(minSignificantDigits, maxSignificantDigits);
+ } else {
+ return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
+ }
+}
+
+IncrementPrecision Precision::increment(double roundingIncrement) {
+ if (roundingIncrement > 0.0) {
+ return constructIncrement(roundingIncrement, 0);
+ } else {
+ return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
+ }
+}
+
+CurrencyPrecision Precision::currency(UCurrencyUsage currencyUsage) {
+ return constructCurrency(currencyUsage);
+}
+
+Precision FractionPrecision::withMinDigits(int32_t minSignificantDigits) const {
+ if (fType == RND_ERROR) { return *this; } // no-op in error state
+ if (minSignificantDigits >= 1 && minSignificantDigits <= kMaxIntFracSig) {
+ return constructFractionSignificant(*this, minSignificantDigits, -1);
+ } else {
+ return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
+ }
+}
+
+Precision FractionPrecision::withMaxDigits(int32_t maxSignificantDigits) const {
+ if (fType == RND_ERROR) { return *this; } // no-op in error state
+ if (maxSignificantDigits >= 1 && maxSignificantDigits <= kMaxIntFracSig) {
+ return constructFractionSignificant(*this, -1, maxSignificantDigits);
+ } else {
+ return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
+ }
+}
+
+// Private method on base class
+Precision Precision::withCurrency(const CurrencyUnit &currency, UErrorCode &status) const {
+ if (fType == RND_ERROR) { return *this; } // no-op in error state
+ U_ASSERT(fType == RND_CURRENCY);
+ const char16_t *isoCode = currency.getISOCurrency();
+ double increment = ucurr_getRoundingIncrementForUsage(isoCode, fUnion.currencyUsage, &status);
+ int32_t minMaxFrac = ucurr_getDefaultFractionDigitsForUsage(
+ isoCode, fUnion.currencyUsage, &status);
+ if (increment != 0.0) {
+ return constructIncrement(increment, minMaxFrac);
+ } else {
+ return constructFraction(minMaxFrac, minMaxFrac);
+ }
+}
+
+// Public method on CurrencyPrecision subclass
+Precision CurrencyPrecision::withCurrency(const CurrencyUnit &currency) const {
+ UErrorCode localStatus = U_ZERO_ERROR;
+ Precision result = Precision::withCurrency(currency, localStatus);
+ if (U_FAILURE(localStatus)) {
+ return {localStatus};
+ }
+ return result;
+}
+
+Precision IncrementPrecision::withMinFraction(int32_t minFrac) const {
+ if (fType == RND_ERROR) { return *this; } // no-op in error state
+ if (minFrac >= 0 && minFrac <= kMaxIntFracSig) {
+ return constructIncrement(fUnion.increment.fIncrement, minFrac);
+ } else {
+ return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR};
+ }
+}
+
+FractionPrecision Precision::constructFraction(int32_t minFrac, int32_t maxFrac) {
+ FractionSignificantSettings settings;
+ settings.fMinFrac = static_cast<digits_t>(minFrac);
+ settings.fMaxFrac = static_cast<digits_t>(maxFrac);
+ settings.fMinSig = -1;
+ settings.fMaxSig = -1;
+ PrecisionUnion union_;
+ union_.fracSig = settings;
+ return {RND_FRACTION, union_, kDefaultMode};
+}
+
+Precision Precision::constructSignificant(int32_t minSig, int32_t maxSig) {
+ FractionSignificantSettings settings;
+ settings.fMinFrac = -1;
+ settings.fMaxFrac = -1;
+ settings.fMinSig = static_cast<digits_t>(minSig);
+ settings.fMaxSig = static_cast<digits_t>(maxSig);
+ PrecisionUnion union_;
+ union_.fracSig = settings;
+ return {RND_SIGNIFICANT, union_, kDefaultMode};
+}
+
+Precision
+Precision::constructFractionSignificant(const FractionPrecision &base, int32_t minSig, int32_t maxSig) {
+ FractionSignificantSettings settings = base.fUnion.fracSig;
+ settings.fMinSig = static_cast<digits_t>(minSig);
+ settings.fMaxSig = static_cast<digits_t>(maxSig);
+ PrecisionUnion union_;
+ union_.fracSig = settings;
+ return {RND_FRACTION_SIGNIFICANT, union_, kDefaultMode};
+}
+
+IncrementPrecision Precision::constructIncrement(double increment, int32_t minFrac) {
+ IncrementSettings settings;
+ // Note: For number formatting, fIncrement is used for RND_INCREMENT but not
+ // RND_INCREMENT_ONE or RND_INCREMENT_FIVE. However, fIncrement is used in all
+ // three when constructing a skeleton.
+ settings.fIncrement = increment;
+ settings.fMinFrac = static_cast<digits_t>(minFrac);
+ // One of the few pre-computed quantities:
+ // Note: it is possible for minFrac to be more than maxFrac... (misleading)
+ int8_t singleDigit;
+ settings.fMaxFrac = roundingutils::doubleFractionLength(increment, &singleDigit);
+ PrecisionUnion union_;
+ union_.increment = settings;
+ if (singleDigit == 1) {
+ // NOTE: In C++, we must return the correct value type with the correct union.
+ // It would be invalid to return a RND_FRACTION here because the methods on the
+ // IncrementPrecision type assume that the union is backed by increment data.
+ return {RND_INCREMENT_ONE, union_, kDefaultMode};
+ } else if (singleDigit == 5) {
+ return {RND_INCREMENT_FIVE, union_, kDefaultMode};
+ } else {
+ return {RND_INCREMENT, union_, kDefaultMode};
+ }
+}
+
+CurrencyPrecision Precision::constructCurrency(UCurrencyUsage usage) {
+ PrecisionUnion union_;
+ union_.currencyUsage = usage;
+ return {RND_CURRENCY, union_, kDefaultMode};
+}
+
+
+RoundingImpl::RoundingImpl(const Precision& precision, UNumberFormatRoundingMode roundingMode,
+ const CurrencyUnit& currency, UErrorCode& status)
+ : fPrecision(precision), fRoundingMode(roundingMode), fPassThrough(false) {
+ if (precision.fType == Precision::RND_CURRENCY) {
+ fPrecision = precision.withCurrency(currency, status);
+ }
+}
+
+RoundingImpl RoundingImpl::passThrough() {
+ return {};
+}
+
+bool RoundingImpl::isSignificantDigits() const {
+ return fPrecision.fType == Precision::RND_SIGNIFICANT;
+}
+
+int32_t
+RoundingImpl::chooseMultiplierAndApply(impl::DecimalQuantity &input, const impl::MultiplierProducer &producer,
+ UErrorCode &status) {
+ // Do not call this method with zero, NaN, or infinity.
+ U_ASSERT(!input.isZeroish());
+
+ // Perform the first attempt at rounding.
+ int magnitude = input.getMagnitude();
+ int multiplier = producer.getMultiplier(magnitude);
+ input.adjustMagnitude(multiplier);
+ apply(input, status);
+
+ // If the number rounded to zero, exit.
+ if (input.isZeroish() || U_FAILURE(status)) {
+ return multiplier;
+ }
+
+ // If the new magnitude after rounding is the same as it was before rounding, then we are done.
+ // This case applies to most numbers.
+ if (input.getMagnitude() == magnitude + multiplier) {
+ return multiplier;
+ }
+
+ // If the above case DIDN'T apply, then we have a case like 99.9 -> 100 or 999.9 -> 1000:
+ // The number rounded up to the next magnitude. Check if the multiplier changes; if it doesn't,
+ // we do not need to make any more adjustments.
+ int _multiplier = producer.getMultiplier(magnitude + 1);
+ if (multiplier == _multiplier) {
+ return multiplier;
+ }
+
+ // We have a case like 999.9 -> 1000, where the correct output is "1K", not "1000".
+ // Fix the magnitude and re-apply the rounding strategy.
+ input.adjustMagnitude(_multiplier - multiplier);
+ apply(input, status);
+ return _multiplier;
+}
+
+/** This is the method that contains the actual rounding logic. */
+void RoundingImpl::apply(impl::DecimalQuantity &value, UErrorCode& status) const {
+ if (fPassThrough) {
+ return;
+ }
+ switch (fPrecision.fType) {
+ case Precision::RND_BOGUS:
+ case Precision::RND_ERROR:
+ // Errors should be caught before the apply() method is called
+ status = U_INTERNAL_PROGRAM_ERROR;
+ break;
+
+ case Precision::RND_NONE:
+ value.roundToInfinity();
+ break;
+
+ case Precision::RND_FRACTION:
+ value.roundToMagnitude(
+ getRoundingMagnitudeFraction(fPrecision.fUnion.fracSig.fMaxFrac),
+ fRoundingMode,
+ status);
+ value.setMinFraction(
+ uprv_max(0, -getDisplayMagnitudeFraction(fPrecision.fUnion.fracSig.fMinFrac)));
+ break;
+
+ case Precision::RND_SIGNIFICANT:
+ value.roundToMagnitude(
+ getRoundingMagnitudeSignificant(value, fPrecision.fUnion.fracSig.fMaxSig),
+ fRoundingMode,
+ status);
+ value.setMinFraction(
+ uprv_max(0, -getDisplayMagnitudeSignificant(value, fPrecision.fUnion.fracSig.fMinSig)));
+ // Make sure that digits are displayed on zero.
+ if (value.isZeroish() && fPrecision.fUnion.fracSig.fMinSig > 0) {
+ value.setMinInteger(1);
+ }
+ break;
+
+ case Precision::RND_FRACTION_SIGNIFICANT: {
+ int32_t displayMag = getDisplayMagnitudeFraction(fPrecision.fUnion.fracSig.fMinFrac);
+ int32_t roundingMag = getRoundingMagnitudeFraction(fPrecision.fUnion.fracSig.fMaxFrac);
+ if (fPrecision.fUnion.fracSig.fMinSig == -1) {
+ // Max Sig override
+ int32_t candidate = getRoundingMagnitudeSignificant(
+ value,
+ fPrecision.fUnion.fracSig.fMaxSig);
+ roundingMag = uprv_max(roundingMag, candidate);
+ } else {
+ // Min Sig override
+ int32_t candidate = getDisplayMagnitudeSignificant(
+ value,
+ fPrecision.fUnion.fracSig.fMinSig);
+ roundingMag = uprv_min(roundingMag, candidate);
+ }
+ value.roundToMagnitude(roundingMag, fRoundingMode, status);
+ value.setMinFraction(uprv_max(0, -displayMag));
+ break;
+ }
+
+ case Precision::RND_INCREMENT:
+ value.roundToIncrement(
+ fPrecision.fUnion.increment.fIncrement,
+ fRoundingMode,
+ status);
+ value.setMinFraction(fPrecision.fUnion.increment.fMinFrac);
+ break;
+
+ case Precision::RND_INCREMENT_ONE:
+ value.roundToMagnitude(
+ -fPrecision.fUnion.increment.fMaxFrac,
+ fRoundingMode,
+ status);
+ value.setMinFraction(fPrecision.fUnion.increment.fMinFrac);
+ break;
+
+ case Precision::RND_INCREMENT_FIVE:
+ value.roundToNickel(
+ -fPrecision.fUnion.increment.fMaxFrac,
+ fRoundingMode,
+ status);
+ value.setMinFraction(fPrecision.fUnion.increment.fMinFrac);
+ break;
+
+ case Precision::RND_CURRENCY:
+ // Call .withCurrency() before .apply()!
+ UPRV_UNREACHABLE;
+
+ default:
+ UPRV_UNREACHABLE;
+ }
+}
+
+void RoundingImpl::apply(impl::DecimalQuantity &value, int32_t minInt, UErrorCode /*status*/) {
+ // This method is intended for the one specific purpose of helping print "00.000E0".
+ U_ASSERT(isSignificantDigits());
+ U_ASSERT(value.isZeroish());
+ value.setMinFraction(fPrecision.fUnion.fracSig.fMinSig - minInt);
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_roundingutils.h b/contrib/libs/icu/i18n/number_roundingutils.h
index 1a13504b89..3e37f31954 100644
--- a/contrib/libs/icu/i18n/number_roundingutils.h
+++ b/contrib/libs/icu/i18n/number_roundingutils.h
@@ -1,199 +1,199 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMBER_ROUNDINGUTILS_H__
-#define __NUMBER_ROUNDINGUTILS_H__
-
-#include "number_types.h"
-
-U_NAMESPACE_BEGIN
-namespace number {
-namespace impl {
-namespace roundingutils {
-
-enum Section {
- SECTION_LOWER_EDGE = -1,
- SECTION_UPPER_EDGE = -2,
- SECTION_LOWER = 1,
- SECTION_MIDPOINT = 2,
- SECTION_UPPER = 3
-};
-
-/**
- * Converts a rounding mode and metadata about the quantity being rounded to a boolean determining
- * whether the value should be rounded toward infinity or toward zero.
- *
- * <p>The parameters are of type int because benchmarks on an x86-64 processor against OpenJDK
- * showed that ints were demonstrably faster than enums in switch statements.
- *
- * @param isEven Whether the digit immediately before the rounding magnitude is even.
- * @param isNegative Whether the quantity is negative.
- * @param section Whether the part of the quantity to the right of the rounding magnitude is
- * exactly halfway between two digits, whether it is in the lower part (closer to zero), or
- * whether it is in the upper part (closer to infinity). See {@link #SECTION_LOWER}, {@link
- * #SECTION_MIDPOINT}, and {@link #SECTION_UPPER}.
- * @param roundingMode The integer version of the {@link RoundingMode}, which you can get via
- * {@link RoundingMode#ordinal}.
- * @param status Error code, set to U_FORMAT_INEXACT_ERROR if the rounding mode is kRoundUnnecessary.
- * @return true if the number should be rounded toward zero; false if it should be rounded toward
- * infinity.
- */
-inline bool
-getRoundingDirection(bool isEven, bool isNegative, Section section, RoundingMode roundingMode,
- UErrorCode &status) {
- switch (roundingMode) {
- case RoundingMode::UNUM_ROUND_UP:
- // round away from zero
- return false;
-
- case RoundingMode::UNUM_ROUND_DOWN:
- // round toward zero
- return true;
-
- case RoundingMode::UNUM_ROUND_CEILING:
- // round toward positive infinity
- return isNegative;
-
- case RoundingMode::UNUM_ROUND_FLOOR:
- // round toward negative infinity
- return !isNegative;
-
- case RoundingMode::UNUM_ROUND_HALFUP:
- switch (section) {
- case SECTION_MIDPOINT:
- return false;
- case SECTION_LOWER:
- return true;
- case SECTION_UPPER:
- return false;
- default:
- break;
- }
- break;
-
- case RoundingMode::UNUM_ROUND_HALFDOWN:
- switch (section) {
- case SECTION_MIDPOINT:
- return true;
- case SECTION_LOWER:
- return true;
- case SECTION_UPPER:
- return false;
- default:
- break;
- }
- break;
-
- case RoundingMode::UNUM_ROUND_HALFEVEN:
- switch (section) {
- case SECTION_MIDPOINT:
- return isEven;
- case SECTION_LOWER:
- return true;
- case SECTION_UPPER:
- return false;
- default:
- break;
- }
- break;
-
- default:
- break;
- }
-
- status = U_FORMAT_INEXACT_ERROR;
- return false;
-}
-
-/**
- * Gets whether the given rounding mode's rounding boundary is at the midpoint. The rounding
- * boundary is the point at which a number switches from being rounded down to being rounded up.
- * For example, with rounding mode HALF_EVEN, HALF_UP, or HALF_DOWN, the rounding boundary is at
- * the midpoint, and this function would return true. However, for UP, DOWN, CEILING, and FLOOR,
- * the rounding boundary is at the "edge", and this function would return false.
- *
- * @param roundingMode The integer version of the {@link RoundingMode}.
- * @return true if rounding mode is HALF_EVEN, HALF_UP, or HALF_DOWN; false otherwise.
- */
-inline bool roundsAtMidpoint(int roundingMode) {
- switch (roundingMode) {
- case RoundingMode::UNUM_ROUND_UP:
- case RoundingMode::UNUM_ROUND_DOWN:
- case RoundingMode::UNUM_ROUND_CEILING:
- case RoundingMode::UNUM_ROUND_FLOOR:
- return false;
-
- default:
- return true;
- }
-}
-
-/**
- * Computes the number of fraction digits in a double. Used for computing maxFrac for an increment.
- * Calls into the DoubleToStringConverter library to do so.
- *
- * @param singleDigit An output parameter; set to a number if that is the
- * only digit in the double, or -1 if there is more than one digit.
- */
-digits_t doubleFractionLength(double input, int8_t* singleDigit);
-
-} // namespace roundingutils
-
-
-/**
- * Encapsulates a Precision and a RoundingMode and performs rounding on a DecimalQuantity.
- *
- * This class does not exist in Java: instead, the base Precision class is used.
- */
-class RoundingImpl {
- public:
- RoundingImpl() = default; // defaults to pass-through rounder
-
- RoundingImpl(const Precision& precision, UNumberFormatRoundingMode roundingMode,
- const CurrencyUnit& currency, UErrorCode& status);
-
- static RoundingImpl passThrough();
-
- /** Required for ScientificFormatter */
- bool isSignificantDigits() const;
-
- /**
- * Rounding endpoint used by Engineering and Compact notation. Chooses the most appropriate multiplier (magnitude
- * adjustment), applies the adjustment, rounds, and returns the chosen multiplier.
- *
- * <p>
- * In most cases, this is simple. However, when rounding the number causes it to cross a multiplier boundary, we
- * need to re-do the rounding. For example, to display 999,999 in Engineering notation with 2 sigfigs, first you
- * guess the multiplier to be -3. However, then you end up getting 1000E3, which is not the correct output. You then
- * change your multiplier to be -6, and you get 1.0E6, which is correct.
- *
- * @param input The quantity to process.
- * @param producer Function to call to return a multiplier based on a magnitude.
- * @return The number of orders of magnitude the input was adjusted by this method.
- */
- int32_t
- chooseMultiplierAndApply(impl::DecimalQuantity &input, const impl::MultiplierProducer &producer,
- UErrorCode &status);
-
- void apply(impl::DecimalQuantity &value, UErrorCode &status) const;
-
- /** Version of {@link #apply} that obeys minInt constraints. Used for scientific notation compatibility mode. */
- void apply(impl::DecimalQuantity &value, int32_t minInt, UErrorCode status);
-
- private:
- Precision fPrecision;
- UNumberFormatRoundingMode fRoundingMode;
- bool fPassThrough = true; // default value
-};
-
-
-} // namespace impl
-} // namespace number
-U_NAMESPACE_END
-
-#endif //__NUMBER_ROUNDINGUTILS_H__
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMBER_ROUNDINGUTILS_H__
+#define __NUMBER_ROUNDINGUTILS_H__
+
+#include "number_types.h"
+
+U_NAMESPACE_BEGIN
+namespace number {
+namespace impl {
+namespace roundingutils {
+
+enum Section {
+ SECTION_LOWER_EDGE = -1,
+ SECTION_UPPER_EDGE = -2,
+ SECTION_LOWER = 1,
+ SECTION_MIDPOINT = 2,
+ SECTION_UPPER = 3
+};
+
+/**
+ * Converts a rounding mode and metadata about the quantity being rounded to a boolean determining
+ * whether the value should be rounded toward infinity or toward zero.
+ *
+ * <p>The parameters are of type int because benchmarks on an x86-64 processor against OpenJDK
+ * showed that ints were demonstrably faster than enums in switch statements.
+ *
+ * @param isEven Whether the digit immediately before the rounding magnitude is even.
+ * @param isNegative Whether the quantity is negative.
+ * @param section Whether the part of the quantity to the right of the rounding magnitude is
+ * exactly halfway between two digits, whether it is in the lower part (closer to zero), or
+ * whether it is in the upper part (closer to infinity). See {@link #SECTION_LOWER}, {@link
+ * #SECTION_MIDPOINT}, and {@link #SECTION_UPPER}.
+ * @param roundingMode The integer version of the {@link RoundingMode}, which you can get via
+ * {@link RoundingMode#ordinal}.
+ * @param status Error code, set to U_FORMAT_INEXACT_ERROR if the rounding mode is kRoundUnnecessary.
+ * @return true if the number should be rounded toward zero; false if it should be rounded toward
+ * infinity.
+ */
+inline bool
+getRoundingDirection(bool isEven, bool isNegative, Section section, RoundingMode roundingMode,
+ UErrorCode &status) {
+ switch (roundingMode) {
+ case RoundingMode::UNUM_ROUND_UP:
+ // round away from zero
+ return false;
+
+ case RoundingMode::UNUM_ROUND_DOWN:
+ // round toward zero
+ return true;
+
+ case RoundingMode::UNUM_ROUND_CEILING:
+ // round toward positive infinity
+ return isNegative;
+
+ case RoundingMode::UNUM_ROUND_FLOOR:
+ // round toward negative infinity
+ return !isNegative;
+
+ case RoundingMode::UNUM_ROUND_HALFUP:
+ switch (section) {
+ case SECTION_MIDPOINT:
+ return false;
+ case SECTION_LOWER:
+ return true;
+ case SECTION_UPPER:
+ return false;
+ default:
+ break;
+ }
+ break;
+
+ case RoundingMode::UNUM_ROUND_HALFDOWN:
+ switch (section) {
+ case SECTION_MIDPOINT:
+ return true;
+ case SECTION_LOWER:
+ return true;
+ case SECTION_UPPER:
+ return false;
+ default:
+ break;
+ }
+ break;
+
+ case RoundingMode::UNUM_ROUND_HALFEVEN:
+ switch (section) {
+ case SECTION_MIDPOINT:
+ return isEven;
+ case SECTION_LOWER:
+ return true;
+ case SECTION_UPPER:
+ return false;
+ default:
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ status = U_FORMAT_INEXACT_ERROR;
+ return false;
+}
+
+/**
+ * Gets whether the given rounding mode's rounding boundary is at the midpoint. The rounding
+ * boundary is the point at which a number switches from being rounded down to being rounded up.
+ * For example, with rounding mode HALF_EVEN, HALF_UP, or HALF_DOWN, the rounding boundary is at
+ * the midpoint, and this function would return true. However, for UP, DOWN, CEILING, and FLOOR,
+ * the rounding boundary is at the "edge", and this function would return false.
+ *
+ * @param roundingMode The integer version of the {@link RoundingMode}.
+ * @return true if rounding mode is HALF_EVEN, HALF_UP, or HALF_DOWN; false otherwise.
+ */
+inline bool roundsAtMidpoint(int roundingMode) {
+ switch (roundingMode) {
+ case RoundingMode::UNUM_ROUND_UP:
+ case RoundingMode::UNUM_ROUND_DOWN:
+ case RoundingMode::UNUM_ROUND_CEILING:
+ case RoundingMode::UNUM_ROUND_FLOOR:
+ return false;
+
+ default:
+ return true;
+ }
+}
+
+/**
+ * Computes the number of fraction digits in a double. Used for computing maxFrac for an increment.
+ * Calls into the DoubleToStringConverter library to do so.
+ *
+ * @param singleDigit An output parameter; set to a number if that is the
+ * only digit in the double, or -1 if there is more than one digit.
+ */
+digits_t doubleFractionLength(double input, int8_t* singleDigit);
+
+} // namespace roundingutils
+
+
+/**
+ * Encapsulates a Precision and a RoundingMode and performs rounding on a DecimalQuantity.
+ *
+ * This class does not exist in Java: instead, the base Precision class is used.
+ */
+class RoundingImpl {
+ public:
+ RoundingImpl() = default; // defaults to pass-through rounder
+
+ RoundingImpl(const Precision& precision, UNumberFormatRoundingMode roundingMode,
+ const CurrencyUnit& currency, UErrorCode& status);
+
+ static RoundingImpl passThrough();
+
+ /** Required for ScientificFormatter */
+ bool isSignificantDigits() const;
+
+ /**
+ * Rounding endpoint used by Engineering and Compact notation. Chooses the most appropriate multiplier (magnitude
+ * adjustment), applies the adjustment, rounds, and returns the chosen multiplier.
+ *
+ * <p>
+ * In most cases, this is simple. However, when rounding the number causes it to cross a multiplier boundary, we
+ * need to re-do the rounding. For example, to display 999,999 in Engineering notation with 2 sigfigs, first you
+ * guess the multiplier to be -3. However, then you end up getting 1000E3, which is not the correct output. You then
+ * change your multiplier to be -6, and you get 1.0E6, which is correct.
+ *
+ * @param input The quantity to process.
+ * @param producer Function to call to return a multiplier based on a magnitude.
+ * @return The number of orders of magnitude the input was adjusted by this method.
+ */
+ int32_t
+ chooseMultiplierAndApply(impl::DecimalQuantity &input, const impl::MultiplierProducer &producer,
+ UErrorCode &status);
+
+ void apply(impl::DecimalQuantity &value, UErrorCode &status) const;
+
+ /** Version of {@link #apply} that obeys minInt constraints. Used for scientific notation compatibility mode. */
+ void apply(impl::DecimalQuantity &value, int32_t minInt, UErrorCode status);
+
+ private:
+ Precision fPrecision;
+ UNumberFormatRoundingMode fRoundingMode;
+ bool fPassThrough = true; // default value
+};
+
+
+} // namespace impl
+} // namespace number
+U_NAMESPACE_END
+
+#endif //__NUMBER_ROUNDINGUTILS_H__
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_scientific.cpp b/contrib/libs/icu/i18n/number_scientific.cpp
index 3718dab2dc..527ffbf78d 100644
--- a/contrib/libs/icu/i18n/number_scientific.cpp
+++ b/contrib/libs/icu/i18n/number_scientific.cpp
@@ -1,177 +1,177 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include <cstdlib>
-#include "number_scientific.h"
-#include "number_utils.h"
-#include "formatted_string_builder.h"
-#include "unicode/unum.h"
-#include "number_microprops.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-// NOTE: The object lifecycle of ScientificModifier and ScientificHandler differ greatly in Java and C++.
-//
-// During formatting, we need to provide an object with state (the exponent) as the inner modifier.
-//
-// In Java, where the priority is put on reducing object creations, the unsafe code path re-uses the
-// ScientificHandler as a ScientificModifier, and the safe code path pre-computes 25 ScientificModifier
-// instances. This scheme reduces the number of object creations by 1 in both safe and unsafe.
-//
-// In C++, MicroProps provides a pre-allocated ScientificModifier, and ScientificHandler simply populates
-// the state (the exponent) into that ScientificModifier. There is no difference between safe and unsafe.
-
-ScientificModifier::ScientificModifier() : fExponent(0), fHandler(nullptr) {}
-
-void ScientificModifier::set(int32_t exponent, const ScientificHandler *handler) {
- // ScientificModifier should be set only once.
- U_ASSERT(fHandler == nullptr);
- fExponent = exponent;
- fHandler = handler;
-}
-
-int32_t ScientificModifier::apply(FormattedStringBuilder &output, int32_t /*leftIndex*/, int32_t rightIndex,
- UErrorCode &status) const {
- // FIXME: Localized exponent separator location.
- int i = rightIndex;
- // Append the exponent separator and sign
- i += output.insert(
- i,
- fHandler->fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kExponentialSymbol),
- {UFIELD_CATEGORY_NUMBER, UNUM_EXPONENT_SYMBOL_FIELD},
- status);
- if (fExponent < 0 && fHandler->fSettings.fExponentSignDisplay != UNUM_SIGN_NEVER) {
- i += output.insert(
- i,
- fHandler->fSymbols
- ->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kMinusSignSymbol),
- {UFIELD_CATEGORY_NUMBER, UNUM_EXPONENT_SIGN_FIELD},
- status);
- } else if (fExponent >= 0 && fHandler->fSettings.fExponentSignDisplay == UNUM_SIGN_ALWAYS) {
- i += output.insert(
- i,
- fHandler->fSymbols
- ->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPlusSignSymbol),
- {UFIELD_CATEGORY_NUMBER, UNUM_EXPONENT_SIGN_FIELD},
- status);
- }
- // Append the exponent digits (using a simple inline algorithm)
- int32_t disp = std::abs(fExponent);
- for (int j = 0; j < fHandler->fSettings.fMinExponentDigits || disp > 0; j++, disp /= 10) {
- auto d = static_cast<int8_t>(disp % 10);
- i += utils::insertDigitFromSymbols(
- output,
- i - j,
- d,
- *fHandler->fSymbols,
- {UFIELD_CATEGORY_NUMBER, UNUM_EXPONENT_FIELD},
- status);
- }
- return i - rightIndex;
-}
-
-int32_t ScientificModifier::getPrefixLength() const {
- // TODO: Localized exponent separator location.
- return 0;
-}
-
-int32_t ScientificModifier::getCodePointCount() const {
- // NOTE: This method is only called one place, NumberRangeFormatterImpl.
- // The call site only cares about != 0 and != 1.
- // Return a very large value so that if this method is used elsewhere, we should notice.
- return 999;
-}
-
-bool ScientificModifier::isStrong() const {
- // Scientific is always strong
- return true;
-}
-
-bool ScientificModifier::containsField(Field field) const {
- (void)field;
- // This method is not used for inner modifiers.
- UPRV_UNREACHABLE;
-}
-
-void ScientificModifier::getParameters(Parameters& output) const {
- // Not part of any plural sets
- output.obj = nullptr;
-}
-
-bool ScientificModifier::semanticallyEquivalent(const Modifier& other) const {
- auto* _other = dynamic_cast<const ScientificModifier*>(&other);
- if (_other == nullptr) {
- return false;
- }
- // TODO: Check for locale symbols and settings as well? Could be less efficient.
- return fExponent == _other->fExponent;
-}
-
-// Note: Visual Studio does not compile this function without full name space. Why?
-icu::number::impl::ScientificHandler::ScientificHandler(const Notation *notation, const DecimalFormatSymbols *symbols,
- const MicroPropsGenerator *parent) :
- fSettings(notation->fUnion.scientific), fSymbols(symbols), fParent(parent) {}
-
-void ScientificHandler::processQuantity(DecimalQuantity &quantity, MicroProps &micros,
- UErrorCode &status) const {
- fParent->processQuantity(quantity, micros, status);
- if (U_FAILURE(status)) { return; }
-
- // Do not apply scientific notation to special doubles
- if (quantity.isInfinite() || quantity.isNaN()) {
- micros.modInner = &micros.helpers.emptyStrongModifier;
- return;
- }
-
- // Treat zero as if it had magnitude 0
- int32_t exponent;
- if (quantity.isZeroish()) {
- if (fSettings.fRequireMinInt && micros.rounder.isSignificantDigits()) {
- // Show "00.000E0" on pattern "00.000E0"
- micros.rounder.apply(quantity, fSettings.fEngineeringInterval, status);
- exponent = 0;
- } else {
- micros.rounder.apply(quantity, status);
- exponent = 0;
- }
- } else {
- exponent = -micros.rounder.chooseMultiplierAndApply(quantity, *this, status);
- }
-
- // Use MicroProps's helper ScientificModifier and save it as the modInner.
- ScientificModifier &mod = micros.helpers.scientificModifier;
- mod.set(exponent, this);
- micros.modInner = &mod;
-
- // Change the exponent only after we select appropriate plural form
- // for formatting purposes so that we preserve expected formatted
- // string behavior.
- quantity.adjustExponent(exponent);
-
- // We already performed rounding. Do not perform it again.
- micros.rounder = RoundingImpl::passThrough();
-}
-
-int32_t ScientificHandler::getMultiplier(int32_t magnitude) const {
- int32_t interval = fSettings.fEngineeringInterval;
- int32_t digitsShown;
- if (fSettings.fRequireMinInt) {
- // For patterns like "000.00E0" and ".00E0"
- digitsShown = interval;
- } else if (interval <= 1) {
- // For patterns like "0.00E0" and "@@@E0"
- digitsShown = 1;
- } else {
- // For patterns like "##0.00"
- digitsShown = ((magnitude % interval + interval) % interval) + 1;
- }
- return digitsShown - magnitude - 1;
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include <cstdlib>
+#include "number_scientific.h"
+#include "number_utils.h"
+#include "formatted_string_builder.h"
+#include "unicode/unum.h"
+#include "number_microprops.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+// NOTE: The object lifecycle of ScientificModifier and ScientificHandler differ greatly in Java and C++.
+//
+// During formatting, we need to provide an object with state (the exponent) as the inner modifier.
+//
+// In Java, where the priority is put on reducing object creations, the unsafe code path re-uses the
+// ScientificHandler as a ScientificModifier, and the safe code path pre-computes 25 ScientificModifier
+// instances. This scheme reduces the number of object creations by 1 in both safe and unsafe.
+//
+// In C++, MicroProps provides a pre-allocated ScientificModifier, and ScientificHandler simply populates
+// the state (the exponent) into that ScientificModifier. There is no difference between safe and unsafe.
+
+ScientificModifier::ScientificModifier() : fExponent(0), fHandler(nullptr) {}
+
+void ScientificModifier::set(int32_t exponent, const ScientificHandler *handler) {
+ // ScientificModifier should be set only once.
+ U_ASSERT(fHandler == nullptr);
+ fExponent = exponent;
+ fHandler = handler;
+}
+
+int32_t ScientificModifier::apply(FormattedStringBuilder &output, int32_t /*leftIndex*/, int32_t rightIndex,
+ UErrorCode &status) const {
+ // FIXME: Localized exponent separator location.
+ int i = rightIndex;
+ // Append the exponent separator and sign
+ i += output.insert(
+ i,
+ fHandler->fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kExponentialSymbol),
+ {UFIELD_CATEGORY_NUMBER, UNUM_EXPONENT_SYMBOL_FIELD},
+ status);
+ if (fExponent < 0 && fHandler->fSettings.fExponentSignDisplay != UNUM_SIGN_NEVER) {
+ i += output.insert(
+ i,
+ fHandler->fSymbols
+ ->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kMinusSignSymbol),
+ {UFIELD_CATEGORY_NUMBER, UNUM_EXPONENT_SIGN_FIELD},
+ status);
+ } else if (fExponent >= 0 && fHandler->fSettings.fExponentSignDisplay == UNUM_SIGN_ALWAYS) {
+ i += output.insert(
+ i,
+ fHandler->fSymbols
+ ->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPlusSignSymbol),
+ {UFIELD_CATEGORY_NUMBER, UNUM_EXPONENT_SIGN_FIELD},
+ status);
+ }
+ // Append the exponent digits (using a simple inline algorithm)
+ int32_t disp = std::abs(fExponent);
+ for (int j = 0; j < fHandler->fSettings.fMinExponentDigits || disp > 0; j++, disp /= 10) {
+ auto d = static_cast<int8_t>(disp % 10);
+ i += utils::insertDigitFromSymbols(
+ output,
+ i - j,
+ d,
+ *fHandler->fSymbols,
+ {UFIELD_CATEGORY_NUMBER, UNUM_EXPONENT_FIELD},
+ status);
+ }
+ return i - rightIndex;
+}
+
+int32_t ScientificModifier::getPrefixLength() const {
+ // TODO: Localized exponent separator location.
+ return 0;
+}
+
+int32_t ScientificModifier::getCodePointCount() const {
+ // NOTE: This method is only called one place, NumberRangeFormatterImpl.
+ // The call site only cares about != 0 and != 1.
+ // Return a very large value so that if this method is used elsewhere, we should notice.
+ return 999;
+}
+
+bool ScientificModifier::isStrong() const {
+ // Scientific is always strong
+ return true;
+}
+
+bool ScientificModifier::containsField(Field field) const {
+ (void)field;
+ // This method is not used for inner modifiers.
+ UPRV_UNREACHABLE;
+}
+
+void ScientificModifier::getParameters(Parameters& output) const {
+ // Not part of any plural sets
+ output.obj = nullptr;
+}
+
+bool ScientificModifier::semanticallyEquivalent(const Modifier& other) const {
+ auto* _other = dynamic_cast<const ScientificModifier*>(&other);
+ if (_other == nullptr) {
+ return false;
+ }
+ // TODO: Check for locale symbols and settings as well? Could be less efficient.
+ return fExponent == _other->fExponent;
+}
+
+// Note: Visual Studio does not compile this function without full name space. Why?
+icu::number::impl::ScientificHandler::ScientificHandler(const Notation *notation, const DecimalFormatSymbols *symbols,
+ const MicroPropsGenerator *parent) :
+ fSettings(notation->fUnion.scientific), fSymbols(symbols), fParent(parent) {}
+
+void ScientificHandler::processQuantity(DecimalQuantity &quantity, MicroProps &micros,
+ UErrorCode &status) const {
+ fParent->processQuantity(quantity, micros, status);
+ if (U_FAILURE(status)) { return; }
+
+ // Do not apply scientific notation to special doubles
+ if (quantity.isInfinite() || quantity.isNaN()) {
+ micros.modInner = &micros.helpers.emptyStrongModifier;
+ return;
+ }
+
+ // Treat zero as if it had magnitude 0
+ int32_t exponent;
+ if (quantity.isZeroish()) {
+ if (fSettings.fRequireMinInt && micros.rounder.isSignificantDigits()) {
+ // Show "00.000E0" on pattern "00.000E0"
+ micros.rounder.apply(quantity, fSettings.fEngineeringInterval, status);
+ exponent = 0;
+ } else {
+ micros.rounder.apply(quantity, status);
+ exponent = 0;
+ }
+ } else {
+ exponent = -micros.rounder.chooseMultiplierAndApply(quantity, *this, status);
+ }
+
+ // Use MicroProps's helper ScientificModifier and save it as the modInner.
+ ScientificModifier &mod = micros.helpers.scientificModifier;
+ mod.set(exponent, this);
+ micros.modInner = &mod;
+
+ // Change the exponent only after we select appropriate plural form
+ // for formatting purposes so that we preserve expected formatted
+ // string behavior.
+ quantity.adjustExponent(exponent);
+
+ // We already performed rounding. Do not perform it again.
+ micros.rounder = RoundingImpl::passThrough();
+}
+
+int32_t ScientificHandler::getMultiplier(int32_t magnitude) const {
+ int32_t interval = fSettings.fEngineeringInterval;
+ int32_t digitsShown;
+ if (fSettings.fRequireMinInt) {
+ // For patterns like "000.00E0" and ".00E0"
+ digitsShown = interval;
+ } else if (interval <= 1) {
+ // For patterns like "0.00E0" and "@@@E0"
+ digitsShown = 1;
+ } else {
+ // For patterns like "##0.00"
+ digitsShown = ((magnitude % interval + interval) % interval) + 1;
+ }
+ return digitsShown - magnitude - 1;
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_scientific.h b/contrib/libs/icu/i18n/number_scientific.h
index 0d99deea4c..a55d5ed1d4 100644
--- a/contrib/libs/icu/i18n/number_scientific.h
+++ b/contrib/libs/icu/i18n/number_scientific.h
@@ -1,68 +1,68 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMBER_SCIENTIFIC_H__
-#define __NUMBER_SCIENTIFIC_H__
-
-#include "number_types.h"
-
-U_NAMESPACE_BEGIN namespace number {
-namespace impl {
-
-// Forward-declare
-class ScientificHandler;
-
-class U_I18N_API ScientificModifier : public UMemory, public Modifier {
- public:
- ScientificModifier();
-
- void set(int32_t exponent, const ScientificHandler *handler);
-
- int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex,
- UErrorCode &status) const U_OVERRIDE;
-
- int32_t getPrefixLength() const U_OVERRIDE;
-
- int32_t getCodePointCount() const U_OVERRIDE;
-
- bool isStrong() const U_OVERRIDE;
-
- bool containsField(Field field) const U_OVERRIDE;
-
- void getParameters(Parameters& output) const U_OVERRIDE;
-
- bool semanticallyEquivalent(const Modifier& other) const U_OVERRIDE;
-
- private:
- int32_t fExponent;
- const ScientificHandler *fHandler;
-};
-
-class ScientificHandler : public UMemory, public MicroPropsGenerator, public MultiplierProducer {
- public:
- ScientificHandler(const Notation *notation, const DecimalFormatSymbols *symbols,
- const MicroPropsGenerator *parent);
-
- void
- processQuantity(DecimalQuantity &quantity, MicroProps &micros, UErrorCode &status) const U_OVERRIDE;
-
- int32_t getMultiplier(int32_t magnitude) const U_OVERRIDE;
-
- private:
- const Notation::ScientificSettings& fSettings;
- const DecimalFormatSymbols *fSymbols;
- const MicroPropsGenerator *fParent;
-
- friend class ScientificModifier;
-};
-
-} // namespace impl
-} // namespace number
-U_NAMESPACE_END
-
-#endif //__NUMBER_SCIENTIFIC_H__
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMBER_SCIENTIFIC_H__
+#define __NUMBER_SCIENTIFIC_H__
+
+#include "number_types.h"
+
+U_NAMESPACE_BEGIN namespace number {
+namespace impl {
+
+// Forward-declare
+class ScientificHandler;
+
+class U_I18N_API ScientificModifier : public UMemory, public Modifier {
+ public:
+ ScientificModifier();
+
+ void set(int32_t exponent, const ScientificHandler *handler);
+
+ int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex,
+ UErrorCode &status) const U_OVERRIDE;
+
+ int32_t getPrefixLength() const U_OVERRIDE;
+
+ int32_t getCodePointCount() const U_OVERRIDE;
+
+ bool isStrong() const U_OVERRIDE;
+
+ bool containsField(Field field) const U_OVERRIDE;
+
+ void getParameters(Parameters& output) const U_OVERRIDE;
+
+ bool semanticallyEquivalent(const Modifier& other) const U_OVERRIDE;
+
+ private:
+ int32_t fExponent;
+ const ScientificHandler *fHandler;
+};
+
+class ScientificHandler : public UMemory, public MicroPropsGenerator, public MultiplierProducer {
+ public:
+ ScientificHandler(const Notation *notation, const DecimalFormatSymbols *symbols,
+ const MicroPropsGenerator *parent);
+
+ void
+ processQuantity(DecimalQuantity &quantity, MicroProps &micros, UErrorCode &status) const U_OVERRIDE;
+
+ int32_t getMultiplier(int32_t magnitude) const U_OVERRIDE;
+
+ private:
+ const Notation::ScientificSettings& fSettings;
+ const DecimalFormatSymbols *fSymbols;
+ const MicroPropsGenerator *fParent;
+
+ friend class ScientificModifier;
+};
+
+} // namespace impl
+} // namespace number
+U_NAMESPACE_END
+
+#endif //__NUMBER_SCIENTIFIC_H__
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_skeletons.cpp b/contrib/libs/icu/i18n/number_skeletons.cpp
index 7b4b20ec6c..4ba2647986 100644
--- a/contrib/libs/icu/i18n/number_skeletons.cpp
+++ b/contrib/libs/icu/i18n/number_skeletons.cpp
@@ -1,1731 +1,1731 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include "number_decnum.h"
-#include "number_skeletons.h"
-#include "umutex.h"
-#include "ucln_in.h"
-#include "patternprops.h"
-#include "unicode/ucharstriebuilder.h"
-#include "number_utils.h"
-#include "number_decimalquantity.h"
-#include "unicode/numberformatter.h"
-#include "uinvchar.h"
-#include "charstr.h"
-#include "string_segment.h"
-#include "unicode/errorcode.h"
-#include "util.h"
-#include "measunit_impl.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-using namespace icu::number::impl::skeleton;
-
-namespace {
-
-icu::UInitOnce gNumberSkeletonsInitOnce = U_INITONCE_INITIALIZER;
-
-char16_t* kSerializedStemTrie = nullptr;
-
-UBool U_CALLCONV cleanupNumberSkeletons() {
- uprv_free(kSerializedStemTrie);
- kSerializedStemTrie = nullptr;
- gNumberSkeletonsInitOnce.reset();
- return TRUE;
-}
-
-void U_CALLCONV initNumberSkeletons(UErrorCode& status) {
- ucln_i18n_registerCleanup(UCLN_I18N_NUMBER_SKELETONS, cleanupNumberSkeletons);
-
- UCharsTrieBuilder b(status);
- if (U_FAILURE(status)) { return; }
-
- // Section 1:
- b.add(u"compact-short", STEM_COMPACT_SHORT, status);
- b.add(u"compact-long", STEM_COMPACT_LONG, status);
- b.add(u"scientific", STEM_SCIENTIFIC, status);
- b.add(u"engineering", STEM_ENGINEERING, status);
- b.add(u"notation-simple", STEM_NOTATION_SIMPLE, status);
- b.add(u"base-unit", STEM_BASE_UNIT, status);
- b.add(u"percent", STEM_PERCENT, status);
- b.add(u"permille", STEM_PERMILLE, status);
- b.add(u"precision-integer", STEM_PRECISION_INTEGER, status);
- b.add(u"precision-unlimited", STEM_PRECISION_UNLIMITED, status);
- b.add(u"precision-currency-standard", STEM_PRECISION_CURRENCY_STANDARD, status);
- b.add(u"precision-currency-cash", STEM_PRECISION_CURRENCY_CASH, status);
- b.add(u"rounding-mode-ceiling", STEM_ROUNDING_MODE_CEILING, status);
- b.add(u"rounding-mode-floor", STEM_ROUNDING_MODE_FLOOR, status);
- b.add(u"rounding-mode-down", STEM_ROUNDING_MODE_DOWN, status);
- b.add(u"rounding-mode-up", STEM_ROUNDING_MODE_UP, status);
- b.add(u"rounding-mode-half-even", STEM_ROUNDING_MODE_HALF_EVEN, status);
- b.add(u"rounding-mode-half-down", STEM_ROUNDING_MODE_HALF_DOWN, status);
- b.add(u"rounding-mode-half-up", STEM_ROUNDING_MODE_HALF_UP, status);
- b.add(u"rounding-mode-unnecessary", STEM_ROUNDING_MODE_UNNECESSARY, status);
- b.add(u"group-off", STEM_GROUP_OFF, status);
- b.add(u"group-min2", STEM_GROUP_MIN2, status);
- b.add(u"group-auto", STEM_GROUP_AUTO, status);
- b.add(u"group-on-aligned", STEM_GROUP_ON_ALIGNED, status);
- b.add(u"group-thousands", STEM_GROUP_THOUSANDS, status);
- b.add(u"latin", STEM_LATIN, status);
- b.add(u"unit-width-narrow", STEM_UNIT_WIDTH_NARROW, status);
- b.add(u"unit-width-short", STEM_UNIT_WIDTH_SHORT, status);
- b.add(u"unit-width-full-name", STEM_UNIT_WIDTH_FULL_NAME, status);
- b.add(u"unit-width-iso-code", STEM_UNIT_WIDTH_ISO_CODE, status);
- b.add(u"unit-width-hidden", STEM_UNIT_WIDTH_HIDDEN, status);
- b.add(u"sign-auto", STEM_SIGN_AUTO, status);
- b.add(u"sign-always", STEM_SIGN_ALWAYS, status);
- b.add(u"sign-never", STEM_SIGN_NEVER, status);
- b.add(u"sign-accounting", STEM_SIGN_ACCOUNTING, status);
- b.add(u"sign-accounting-always", STEM_SIGN_ACCOUNTING_ALWAYS, status);
- b.add(u"sign-except-zero", STEM_SIGN_EXCEPT_ZERO, status);
- b.add(u"sign-accounting-except-zero", STEM_SIGN_ACCOUNTING_EXCEPT_ZERO, status);
- b.add(u"decimal-auto", STEM_DECIMAL_AUTO, status);
- b.add(u"decimal-always", STEM_DECIMAL_ALWAYS, status);
- if (U_FAILURE(status)) { return; }
-
- // Section 2:
- b.add(u"precision-increment", STEM_PRECISION_INCREMENT, status);
- b.add(u"measure-unit", STEM_MEASURE_UNIT, status);
- b.add(u"per-measure-unit", STEM_PER_MEASURE_UNIT, status);
- b.add(u"unit", STEM_UNIT, status);
- b.add(u"currency", STEM_CURRENCY, status);
- b.add(u"integer-width", STEM_INTEGER_WIDTH, status);
- b.add(u"numbering-system", STEM_NUMBERING_SYSTEM, status);
- b.add(u"scale", STEM_SCALE, status);
- if (U_FAILURE(status)) { return; }
-
- // Section 3 (concise tokens):
- b.add(u"K", STEM_COMPACT_SHORT, status);
- b.add(u"KK", STEM_COMPACT_LONG, status);
- b.add(u"%", STEM_PERCENT, status);
- b.add(u"%x100", STEM_PERCENT_100, status);
- b.add(u",_", STEM_GROUP_OFF, status);
- b.add(u",?", STEM_GROUP_MIN2, status);
- b.add(u",!", STEM_GROUP_ON_ALIGNED, status);
- b.add(u"+!", STEM_SIGN_ALWAYS, status);
- b.add(u"+_", STEM_SIGN_NEVER, status);
- b.add(u"()", STEM_SIGN_ACCOUNTING, status);
- b.add(u"()!", STEM_SIGN_ACCOUNTING_ALWAYS, status);
- b.add(u"+?", STEM_SIGN_EXCEPT_ZERO, status);
- b.add(u"()?", STEM_SIGN_ACCOUNTING_EXCEPT_ZERO, status);
- if (U_FAILURE(status)) { return; }
-
- // Build the CharsTrie
- // TODO: Use SLOW or FAST here?
- UnicodeString result;
- b.buildUnicodeString(USTRINGTRIE_BUILD_FAST, result, status);
- if (U_FAILURE(status)) { return; }
-
- // Copy the result into the global constant pointer
- size_t numBytes = result.length() * sizeof(char16_t);
- kSerializedStemTrie = static_cast<char16_t*>(uprv_malloc(numBytes));
- uprv_memcpy(kSerializedStemTrie, result.getBuffer(), numBytes);
-}
-
-
-inline void appendMultiple(UnicodeString& sb, UChar32 cp, int32_t count) {
- for (int i = 0; i < count; i++) {
- sb.append(cp);
- }
-}
-
-
-#define CHECK_NULL(seen, field, status) (void)(seen); /* for auto-format line wrapping */ \
-UPRV_BLOCK_MACRO_BEGIN { \
- if ((seen).field) { \
- (status) = U_NUMBER_SKELETON_SYNTAX_ERROR; \
- return STATE_NULL; \
- } \
- (seen).field = true; \
-} UPRV_BLOCK_MACRO_END
-
-
-#define SKELETON_UCHAR_TO_CHAR(dest, src, start, end, status) (void)(dest); \
-UPRV_BLOCK_MACRO_BEGIN { \
- UErrorCode conversionStatus = U_ZERO_ERROR; \
- (dest).appendInvariantChars({FALSE, (src).getBuffer() + (start), (end) - (start)}, conversionStatus); \
- if (conversionStatus == U_INVARIANT_CONVERSION_ERROR) { \
- /* Don't propagate the invariant conversion error; it is a skeleton syntax error */ \
- (status) = U_NUMBER_SKELETON_SYNTAX_ERROR; \
- return; \
- } else if (U_FAILURE(conversionStatus)) { \
- (status) = conversionStatus; \
- return; \
- } \
-} UPRV_BLOCK_MACRO_END
-
-
-} // anonymous namespace
-
-
-Notation stem_to_object::notation(skeleton::StemEnum stem) {
- switch (stem) {
- case STEM_COMPACT_SHORT:
- return Notation::compactShort();
- case STEM_COMPACT_LONG:
- return Notation::compactLong();
- case STEM_SCIENTIFIC:
- return Notation::scientific();
- case STEM_ENGINEERING:
- return Notation::engineering();
- case STEM_NOTATION_SIMPLE:
- return Notation::simple();
- default:
- UPRV_UNREACHABLE;
- }
-}
-
-MeasureUnit stem_to_object::unit(skeleton::StemEnum stem) {
- switch (stem) {
- case STEM_BASE_UNIT:
- // Slicing is okay
- return NoUnit::base(); // NOLINT
- case STEM_PERCENT:
- // Slicing is okay
- return NoUnit::percent(); // NOLINT
- case STEM_PERMILLE:
- // Slicing is okay
- return NoUnit::permille(); // NOLINT
- default:
- UPRV_UNREACHABLE;
- }
-}
-
-Precision stem_to_object::precision(skeleton::StemEnum stem) {
- switch (stem) {
- case STEM_PRECISION_INTEGER:
- return Precision::integer();
- case STEM_PRECISION_UNLIMITED:
- return Precision::unlimited();
- case STEM_PRECISION_CURRENCY_STANDARD:
- return Precision::currency(UCURR_USAGE_STANDARD);
- case STEM_PRECISION_CURRENCY_CASH:
- return Precision::currency(UCURR_USAGE_CASH);
- default:
- UPRV_UNREACHABLE;
- }
-}
-
-UNumberFormatRoundingMode stem_to_object::roundingMode(skeleton::StemEnum stem) {
- switch (stem) {
- case STEM_ROUNDING_MODE_CEILING:
- return UNUM_ROUND_CEILING;
- case STEM_ROUNDING_MODE_FLOOR:
- return UNUM_ROUND_FLOOR;
- case STEM_ROUNDING_MODE_DOWN:
- return UNUM_ROUND_DOWN;
- case STEM_ROUNDING_MODE_UP:
- return UNUM_ROUND_UP;
- case STEM_ROUNDING_MODE_HALF_EVEN:
- return UNUM_ROUND_HALFEVEN;
- case STEM_ROUNDING_MODE_HALF_DOWN:
- return UNUM_ROUND_HALFDOWN;
- case STEM_ROUNDING_MODE_HALF_UP:
- return UNUM_ROUND_HALFUP;
- case STEM_ROUNDING_MODE_UNNECESSARY:
- return UNUM_ROUND_UNNECESSARY;
- default:
- UPRV_UNREACHABLE;
- }
-}
-
-UNumberGroupingStrategy stem_to_object::groupingStrategy(skeleton::StemEnum stem) {
- switch (stem) {
- case STEM_GROUP_OFF:
- return UNUM_GROUPING_OFF;
- case STEM_GROUP_MIN2:
- return UNUM_GROUPING_MIN2;
- case STEM_GROUP_AUTO:
- return UNUM_GROUPING_AUTO;
- case STEM_GROUP_ON_ALIGNED:
- return UNUM_GROUPING_ON_ALIGNED;
- case STEM_GROUP_THOUSANDS:
- return UNUM_GROUPING_THOUSANDS;
- default:
- return UNUM_GROUPING_COUNT; // for objects, throw; for enums, return COUNT
- }
-}
-
-UNumberUnitWidth stem_to_object::unitWidth(skeleton::StemEnum stem) {
- switch (stem) {
- case STEM_UNIT_WIDTH_NARROW:
- return UNUM_UNIT_WIDTH_NARROW;
- case STEM_UNIT_WIDTH_SHORT:
- return UNUM_UNIT_WIDTH_SHORT;
- case STEM_UNIT_WIDTH_FULL_NAME:
- return UNUM_UNIT_WIDTH_FULL_NAME;
- case STEM_UNIT_WIDTH_ISO_CODE:
- return UNUM_UNIT_WIDTH_ISO_CODE;
- case STEM_UNIT_WIDTH_HIDDEN:
- return UNUM_UNIT_WIDTH_HIDDEN;
- default:
- return UNUM_UNIT_WIDTH_COUNT; // for objects, throw; for enums, return COUNT
- }
-}
-
-UNumberSignDisplay stem_to_object::signDisplay(skeleton::StemEnum stem) {
- switch (stem) {
- case STEM_SIGN_AUTO:
- return UNUM_SIGN_AUTO;
- case STEM_SIGN_ALWAYS:
- return UNUM_SIGN_ALWAYS;
- case STEM_SIGN_NEVER:
- return UNUM_SIGN_NEVER;
- case STEM_SIGN_ACCOUNTING:
- return UNUM_SIGN_ACCOUNTING;
- case STEM_SIGN_ACCOUNTING_ALWAYS:
- return UNUM_SIGN_ACCOUNTING_ALWAYS;
- case STEM_SIGN_EXCEPT_ZERO:
- return UNUM_SIGN_EXCEPT_ZERO;
- case STEM_SIGN_ACCOUNTING_EXCEPT_ZERO:
- return UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO;
- default:
- return UNUM_SIGN_COUNT; // for objects, throw; for enums, return COUNT
- }
-}
-
-UNumberDecimalSeparatorDisplay stem_to_object::decimalSeparatorDisplay(skeleton::StemEnum stem) {
- switch (stem) {
- case STEM_DECIMAL_AUTO:
- return UNUM_DECIMAL_SEPARATOR_AUTO;
- case STEM_DECIMAL_ALWAYS:
- return UNUM_DECIMAL_SEPARATOR_ALWAYS;
- default:
- return UNUM_DECIMAL_SEPARATOR_COUNT; // for objects, throw; for enums, return COUNT
- }
-}
-
-
-void enum_to_stem_string::roundingMode(UNumberFormatRoundingMode value, UnicodeString& sb) {
- switch (value) {
- case UNUM_ROUND_CEILING:
- sb.append(u"rounding-mode-ceiling", -1);
- break;
- case UNUM_ROUND_FLOOR:
- sb.append(u"rounding-mode-floor", -1);
- break;
- case UNUM_ROUND_DOWN:
- sb.append(u"rounding-mode-down", -1);
- break;
- case UNUM_ROUND_UP:
- sb.append(u"rounding-mode-up", -1);
- break;
- case UNUM_ROUND_HALFEVEN:
- sb.append(u"rounding-mode-half-even", -1);
- break;
- case UNUM_ROUND_HALFDOWN:
- sb.append(u"rounding-mode-half-down", -1);
- break;
- case UNUM_ROUND_HALFUP:
- sb.append(u"rounding-mode-half-up", -1);
- break;
- case UNUM_ROUND_UNNECESSARY:
- sb.append(u"rounding-mode-unnecessary", -1);
- break;
- default:
- UPRV_UNREACHABLE;
- }
-}
-
-void enum_to_stem_string::groupingStrategy(UNumberGroupingStrategy value, UnicodeString& sb) {
- switch (value) {
- case UNUM_GROUPING_OFF:
- sb.append(u"group-off", -1);
- break;
- case UNUM_GROUPING_MIN2:
- sb.append(u"group-min2", -1);
- break;
- case UNUM_GROUPING_AUTO:
- sb.append(u"group-auto", -1);
- break;
- case UNUM_GROUPING_ON_ALIGNED:
- sb.append(u"group-on-aligned", -1);
- break;
- case UNUM_GROUPING_THOUSANDS:
- sb.append(u"group-thousands", -1);
- break;
- default:
- UPRV_UNREACHABLE;
- }
-}
-
-void enum_to_stem_string::unitWidth(UNumberUnitWidth value, UnicodeString& sb) {
- switch (value) {
- case UNUM_UNIT_WIDTH_NARROW:
- sb.append(u"unit-width-narrow", -1);
- break;
- case UNUM_UNIT_WIDTH_SHORT:
- sb.append(u"unit-width-short", -1);
- break;
- case UNUM_UNIT_WIDTH_FULL_NAME:
- sb.append(u"unit-width-full-name", -1);
- break;
- case UNUM_UNIT_WIDTH_ISO_CODE:
- sb.append(u"unit-width-iso-code", -1);
- break;
- case UNUM_UNIT_WIDTH_HIDDEN:
- sb.append(u"unit-width-hidden", -1);
- break;
- default:
- UPRV_UNREACHABLE;
- }
-}
-
-void enum_to_stem_string::signDisplay(UNumberSignDisplay value, UnicodeString& sb) {
- switch (value) {
- case UNUM_SIGN_AUTO:
- sb.append(u"sign-auto", -1);
- break;
- case UNUM_SIGN_ALWAYS:
- sb.append(u"sign-always", -1);
- break;
- case UNUM_SIGN_NEVER:
- sb.append(u"sign-never", -1);
- break;
- case UNUM_SIGN_ACCOUNTING:
- sb.append(u"sign-accounting", -1);
- break;
- case UNUM_SIGN_ACCOUNTING_ALWAYS:
- sb.append(u"sign-accounting-always", -1);
- break;
- case UNUM_SIGN_EXCEPT_ZERO:
- sb.append(u"sign-except-zero", -1);
- break;
- case UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO:
- sb.append(u"sign-accounting-except-zero", -1);
- break;
- default:
- UPRV_UNREACHABLE;
- }
-}
-
-void
-enum_to_stem_string::decimalSeparatorDisplay(UNumberDecimalSeparatorDisplay value, UnicodeString& sb) {
- switch (value) {
- case UNUM_DECIMAL_SEPARATOR_AUTO:
- sb.append(u"decimal-auto", -1);
- break;
- case UNUM_DECIMAL_SEPARATOR_ALWAYS:
- sb.append(u"decimal-always", -1);
- break;
- default:
- UPRV_UNREACHABLE;
- }
-}
-
-
-UnlocalizedNumberFormatter skeleton::create(
- const UnicodeString& skeletonString, UParseError* perror, UErrorCode& status) {
-
- // Initialize perror
- if (perror != nullptr) {
- perror->line = 0;
- perror->offset = -1;
- perror->preContext[0] = 0;
- perror->postContext[0] = 0;
- }
-
- umtx_initOnce(gNumberSkeletonsInitOnce, &initNumberSkeletons, status);
- if (U_FAILURE(status)) {
- return {};
- }
-
- int32_t errOffset;
- MacroProps macros = parseSkeleton(skeletonString, errOffset, status);
- if (U_SUCCESS(status)) {
- return NumberFormatter::with().macros(macros);
- }
-
- if (perror == nullptr) {
- return {};
- }
-
- // Populate the UParseError with the error location
- perror->offset = errOffset;
- int32_t contextStart = uprv_max(0, errOffset - U_PARSE_CONTEXT_LEN + 1);
- int32_t contextEnd = uprv_min(skeletonString.length(), errOffset + U_PARSE_CONTEXT_LEN - 1);
- skeletonString.extract(contextStart, errOffset - contextStart, perror->preContext, 0);
- perror->preContext[errOffset - contextStart] = 0;
- skeletonString.extract(errOffset, contextEnd - errOffset, perror->postContext, 0);
- perror->postContext[contextEnd - errOffset] = 0;
- return {};
-}
-
-UnicodeString skeleton::generate(const MacroProps& macros, UErrorCode& status) {
- umtx_initOnce(gNumberSkeletonsInitOnce, &initNumberSkeletons, status);
- UnicodeString sb;
- GeneratorHelpers::generateSkeleton(macros, sb, status);
- return sb;
-}
-
-MacroProps skeleton::parseSkeleton(
- const UnicodeString& skeletonString, int32_t& errOffset, UErrorCode& status) {
- U_ASSERT(U_SUCCESS(status));
-
- // Add a trailing whitespace to the end of the skeleton string to make code cleaner.
- UnicodeString tempSkeletonString(skeletonString);
- tempSkeletonString.append(u' ');
-
- SeenMacroProps seen;
- MacroProps macros;
- StringSegment segment(tempSkeletonString, false);
- UCharsTrie stemTrie(kSerializedStemTrie);
- ParseState stem = STATE_NULL;
- int32_t offset = 0;
-
- // Primary skeleton parse loop:
- while (offset < segment.length()) {
- UChar32 cp = segment.codePointAt(offset);
- bool isTokenSeparator = PatternProps::isWhiteSpace(cp);
- bool isOptionSeparator = (cp == u'/');
-
- if (!isTokenSeparator && !isOptionSeparator) {
- // Non-separator token; consume it.
- offset += U16_LENGTH(cp);
- if (stem == STATE_NULL) {
- // We are currently consuming a stem.
- // Go to the next state in the stem trie.
- stemTrie.nextForCodePoint(cp);
- }
- continue;
- }
-
- // We are looking at a token or option separator.
- // If the segment is nonempty, parse it and reset the segment.
- // Otherwise, make sure it is a valid repeating separator.
- if (offset != 0) {
- segment.setLength(offset);
- if (stem == STATE_NULL) {
- // The first separator after the start of a token. Parse it as a stem.
- stem = parseStem(segment, stemTrie, seen, macros, status);
- stemTrie.reset();
- } else {
- // A separator after the first separator of a token. Parse it as an option.
- stem = parseOption(stem, segment, macros, status);
- }
- segment.resetLength();
- if (U_FAILURE(status)) {
- errOffset = segment.getOffset();
- return macros;
- }
-
- // Consume the segment:
- segment.adjustOffset(offset);
- offset = 0;
-
- } else if (stem != STATE_NULL) {
- // A separator ('/' or whitespace) following an option separator ('/')
- // segment.setLength(U16_LENGTH(cp)); // for error message
- // throw new SkeletonSyntaxException("Unexpected separator character", segment);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- errOffset = segment.getOffset();
- return macros;
-
- } else {
- // Two spaces in a row; this is OK.
- }
-
- // Does the current stem forbid options?
- if (isOptionSeparator && stem == STATE_NULL) {
- // segment.setLength(U16_LENGTH(cp)); // for error message
- // throw new SkeletonSyntaxException("Unexpected option separator", segment);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- errOffset = segment.getOffset();
- return macros;
- }
-
- // Does the current stem require an option?
- if (isTokenSeparator && stem != STATE_NULL) {
- switch (stem) {
- case STATE_INCREMENT_PRECISION:
- case STATE_MEASURE_UNIT:
- case STATE_PER_MEASURE_UNIT:
- case STATE_IDENTIFIER_UNIT:
- case STATE_CURRENCY_UNIT:
- case STATE_INTEGER_WIDTH:
- case STATE_NUMBERING_SYSTEM:
- case STATE_SCALE:
- // segment.setLength(U16_LENGTH(cp)); // for error message
- // throw new SkeletonSyntaxException("Stem requires an option", segment);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- errOffset = segment.getOffset();
- return macros;
- default:
- break;
- }
- stem = STATE_NULL;
- }
-
- // Consume the separator:
- segment.adjustOffset(U16_LENGTH(cp));
- }
- U_ASSERT(stem == STATE_NULL);
- return macros;
-}
-
-ParseState
-skeleton::parseStem(const StringSegment& segment, const UCharsTrie& stemTrie, SeenMacroProps& seen,
- MacroProps& macros, UErrorCode& status) {
- // First check for "blueprint" stems, which start with a "signal char"
- switch (segment.charAt(0)) {
- case u'.':
- CHECK_NULL(seen, precision, status);
- blueprint_helpers::parseFractionStem(segment, macros, status);
- return STATE_FRACTION_PRECISION;
- case u'@':
- CHECK_NULL(seen, precision, status);
- blueprint_helpers::parseDigitsStem(segment, macros, status);
- return STATE_NULL;
- case u'E':
- CHECK_NULL(seen, notation, status);
- blueprint_helpers::parseScientificStem(segment, macros, status);
- return STATE_NULL;
- case u'0':
- CHECK_NULL(seen, integerWidth, status);
- blueprint_helpers::parseIntegerStem(segment, macros, status);
- return STATE_NULL;
- default:
- break;
- }
-
- // Now look at the stemsTrie, which is already be pointing at our stem.
- UStringTrieResult stemResult = stemTrie.current();
-
- if (stemResult != USTRINGTRIE_INTERMEDIATE_VALUE && stemResult != USTRINGTRIE_FINAL_VALUE) {
- // throw new SkeletonSyntaxException("Unknown stem", segment);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- return STATE_NULL;
- }
-
- auto stem = static_cast<StemEnum>(stemTrie.getValue());
- switch (stem) {
-
- // Stems with meaning on their own, not requiring an option:
-
- case STEM_COMPACT_SHORT:
- case STEM_COMPACT_LONG:
- case STEM_SCIENTIFIC:
- case STEM_ENGINEERING:
- case STEM_NOTATION_SIMPLE:
- CHECK_NULL(seen, notation, status);
- macros.notation = stem_to_object::notation(stem);
- switch (stem) {
- case STEM_SCIENTIFIC:
- case STEM_ENGINEERING:
- return STATE_SCIENTIFIC; // allows for scientific options
- default:
- return STATE_NULL;
- }
-
- case STEM_BASE_UNIT:
- case STEM_PERCENT:
- case STEM_PERMILLE:
- CHECK_NULL(seen, unit, status);
- macros.unit = stem_to_object::unit(stem);
- return STATE_NULL;
-
- case STEM_PERCENT_100:
- CHECK_NULL(seen, scale, status);
- CHECK_NULL(seen, unit, status);
- macros.scale = Scale::powerOfTen(2);
- macros.unit = NoUnit::percent();
- return STATE_NULL;
-
- case STEM_PRECISION_INTEGER:
- case STEM_PRECISION_UNLIMITED:
- case STEM_PRECISION_CURRENCY_STANDARD:
- case STEM_PRECISION_CURRENCY_CASH:
- CHECK_NULL(seen, precision, status);
- macros.precision = stem_to_object::precision(stem);
- switch (stem) {
- case STEM_PRECISION_INTEGER:
- return STATE_FRACTION_PRECISION; // allows for "precision-integer/@##"
- default:
- return STATE_NULL;
- }
-
- case STEM_ROUNDING_MODE_CEILING:
- case STEM_ROUNDING_MODE_FLOOR:
- case STEM_ROUNDING_MODE_DOWN:
- case STEM_ROUNDING_MODE_UP:
- case STEM_ROUNDING_MODE_HALF_EVEN:
- case STEM_ROUNDING_MODE_HALF_DOWN:
- case STEM_ROUNDING_MODE_HALF_UP:
- case STEM_ROUNDING_MODE_UNNECESSARY:
- CHECK_NULL(seen, roundingMode, status);
- macros.roundingMode = stem_to_object::roundingMode(stem);
- return STATE_NULL;
-
- case STEM_GROUP_OFF:
- case STEM_GROUP_MIN2:
- case STEM_GROUP_AUTO:
- case STEM_GROUP_ON_ALIGNED:
- case STEM_GROUP_THOUSANDS:
- CHECK_NULL(seen, grouper, status);
- macros.grouper = Grouper::forStrategy(stem_to_object::groupingStrategy(stem));
- return STATE_NULL;
-
- case STEM_LATIN:
- CHECK_NULL(seen, symbols, status);
- macros.symbols.setTo(NumberingSystem::createInstanceByName("latn", status));
- return STATE_NULL;
-
- case STEM_UNIT_WIDTH_NARROW:
- case STEM_UNIT_WIDTH_SHORT:
- case STEM_UNIT_WIDTH_FULL_NAME:
- case STEM_UNIT_WIDTH_ISO_CODE:
- case STEM_UNIT_WIDTH_HIDDEN:
- CHECK_NULL(seen, unitWidth, status);
- macros.unitWidth = stem_to_object::unitWidth(stem);
- return STATE_NULL;
-
- case STEM_SIGN_AUTO:
- case STEM_SIGN_ALWAYS:
- case STEM_SIGN_NEVER:
- case STEM_SIGN_ACCOUNTING:
- case STEM_SIGN_ACCOUNTING_ALWAYS:
- case STEM_SIGN_EXCEPT_ZERO:
- case STEM_SIGN_ACCOUNTING_EXCEPT_ZERO:
- CHECK_NULL(seen, sign, status);
- macros.sign = stem_to_object::signDisplay(stem);
- return STATE_NULL;
-
- case STEM_DECIMAL_AUTO:
- case STEM_DECIMAL_ALWAYS:
- CHECK_NULL(seen, decimal, status);
- macros.decimal = stem_to_object::decimalSeparatorDisplay(stem);
- return STATE_NULL;
-
- // Stems requiring an option:
-
- case STEM_PRECISION_INCREMENT:
- CHECK_NULL(seen, precision, status);
- return STATE_INCREMENT_PRECISION;
-
- case STEM_MEASURE_UNIT:
- CHECK_NULL(seen, unit, status);
- return STATE_MEASURE_UNIT;
-
- case STEM_PER_MEASURE_UNIT:
- CHECK_NULL(seen, perUnit, status);
- return STATE_PER_MEASURE_UNIT;
-
- case STEM_UNIT:
- CHECK_NULL(seen, unit, status);
- CHECK_NULL(seen, perUnit, status);
- return STATE_IDENTIFIER_UNIT;
-
- case STEM_CURRENCY:
- CHECK_NULL(seen, unit, status);
- return STATE_CURRENCY_UNIT;
-
- case STEM_INTEGER_WIDTH:
- CHECK_NULL(seen, integerWidth, status);
- return STATE_INTEGER_WIDTH;
-
- case STEM_NUMBERING_SYSTEM:
- CHECK_NULL(seen, symbols, status);
- return STATE_NUMBERING_SYSTEM;
-
- case STEM_SCALE:
- CHECK_NULL(seen, scale, status);
- return STATE_SCALE;
-
- default:
- UPRV_UNREACHABLE;
- }
-}
-
-ParseState skeleton::parseOption(ParseState stem, const StringSegment& segment, MacroProps& macros,
- UErrorCode& status) {
-
- ///// Required options: /////
-
- switch (stem) {
- case STATE_CURRENCY_UNIT:
- blueprint_helpers::parseCurrencyOption(segment, macros, status);
- return STATE_NULL;
- case STATE_MEASURE_UNIT:
- blueprint_helpers::parseMeasureUnitOption(segment, macros, status);
- return STATE_NULL;
- case STATE_PER_MEASURE_UNIT:
- blueprint_helpers::parseMeasurePerUnitOption(segment, macros, status);
- return STATE_NULL;
- case STATE_IDENTIFIER_UNIT:
- blueprint_helpers::parseIdentifierUnitOption(segment, macros, status);
- return STATE_NULL;
- case STATE_INCREMENT_PRECISION:
- blueprint_helpers::parseIncrementOption(segment, macros, status);
- return STATE_NULL;
- case STATE_INTEGER_WIDTH:
- blueprint_helpers::parseIntegerWidthOption(segment, macros, status);
- return STATE_NULL;
- case STATE_NUMBERING_SYSTEM:
- blueprint_helpers::parseNumberingSystemOption(segment, macros, status);
- return STATE_NULL;
- case STATE_SCALE:
- blueprint_helpers::parseScaleOption(segment, macros, status);
- return STATE_NULL;
- default:
- break;
- }
-
- ///// Non-required options: /////
-
- // Scientific options
- switch (stem) {
- case STATE_SCIENTIFIC:
- if (blueprint_helpers::parseExponentWidthOption(segment, macros, status)) {
- return STATE_SCIENTIFIC;
- }
- if (U_FAILURE(status)) {
- return {};
- }
- if (blueprint_helpers::parseExponentSignOption(segment, macros, status)) {
- return STATE_SCIENTIFIC;
- }
- if (U_FAILURE(status)) {
- return {};
- }
- break;
- default:
- break;
- }
-
- // Frac-sig option
- switch (stem) {
- case STATE_FRACTION_PRECISION:
- if (blueprint_helpers::parseFracSigOption(segment, macros, status)) {
- return STATE_NULL;
- }
- if (U_FAILURE(status)) {
- return {};
- }
- break;
- default:
- break;
- }
-
- // Unknown option
- // throw new SkeletonSyntaxException("Invalid option", segment);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- return STATE_NULL;
-}
-
-void GeneratorHelpers::generateSkeleton(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
- if (U_FAILURE(status)) { return; }
-
- // Supported options
- if (GeneratorHelpers::notation(macros, sb, status)) {
- sb.append(u' ');
- }
- if (U_FAILURE(status)) { return; }
- if (GeneratorHelpers::unit(macros, sb, status)) {
- sb.append(u' ');
- }
- if (U_FAILURE(status)) { return; }
- if (GeneratorHelpers::perUnit(macros, sb, status)) {
- sb.append(u' ');
- }
- if (U_FAILURE(status)) { return; }
- if (GeneratorHelpers::precision(macros, sb, status)) {
- sb.append(u' ');
- }
- if (U_FAILURE(status)) { return; }
- if (GeneratorHelpers::roundingMode(macros, sb, status)) {
- sb.append(u' ');
- }
- if (U_FAILURE(status)) { return; }
- if (GeneratorHelpers::grouping(macros, sb, status)) {
- sb.append(u' ');
- }
- if (U_FAILURE(status)) { return; }
- if (GeneratorHelpers::integerWidth(macros, sb, status)) {
- sb.append(u' ');
- }
- if (U_FAILURE(status)) { return; }
- if (GeneratorHelpers::symbols(macros, sb, status)) {
- sb.append(u' ');
- }
- if (U_FAILURE(status)) { return; }
- if (GeneratorHelpers::unitWidth(macros, sb, status)) {
- sb.append(u' ');
- }
- if (U_FAILURE(status)) { return; }
- if (GeneratorHelpers::sign(macros, sb, status)) {
- sb.append(u' ');
- }
- if (U_FAILURE(status)) { return; }
- if (GeneratorHelpers::decimal(macros, sb, status)) {
- sb.append(u' ');
- }
- if (U_FAILURE(status)) { return; }
- if (GeneratorHelpers::scale(macros, sb, status)) {
- sb.append(u' ');
- }
- if (U_FAILURE(status)) { return; }
-
- // Unsupported options
- if (!macros.padder.isBogus()) {
- status = U_UNSUPPORTED_ERROR;
- return;
- }
- if (macros.affixProvider != nullptr) {
- status = U_UNSUPPORTED_ERROR;
- return;
- }
- if (macros.rules != nullptr) {
- status = U_UNSUPPORTED_ERROR;
- return;
- }
-
- // Remove the trailing space
- if (sb.length() > 0) {
- sb.truncate(sb.length() - 1);
- }
-}
-
-
-bool blueprint_helpers::parseExponentWidthOption(const StringSegment& segment, MacroProps& macros,
- UErrorCode&) {
- if (!isWildcardChar(segment.charAt(0))) {
- return false;
- }
- int32_t offset = 1;
- int32_t minExp = 0;
- for (; offset < segment.length(); offset++) {
- if (segment.charAt(offset) == u'e') {
- minExp++;
- } else {
- break;
- }
- }
- if (offset < segment.length()) {
- return false;
- }
- // Use the public APIs to enforce bounds checking
- macros.notation = static_cast<ScientificNotation&>(macros.notation).withMinExponentDigits(minExp);
- return true;
-}
-
-void
-blueprint_helpers::generateExponentWidthOption(int32_t minExponentDigits, UnicodeString& sb, UErrorCode&) {
- sb.append(kWildcardChar);
- appendMultiple(sb, u'e', minExponentDigits);
-}
-
-bool
-blueprint_helpers::parseExponentSignOption(const StringSegment& segment, MacroProps& macros, UErrorCode&) {
- // Get the sign display type out of the CharsTrie data structure.
- UCharsTrie tempStemTrie(kSerializedStemTrie);
- UStringTrieResult result = tempStemTrie.next(
- segment.toTempUnicodeString().getBuffer(),
- segment.length());
- if (result != USTRINGTRIE_INTERMEDIATE_VALUE && result != USTRINGTRIE_FINAL_VALUE) {
- return false;
- }
- auto sign = stem_to_object::signDisplay(static_cast<StemEnum>(tempStemTrie.getValue()));
- if (sign == UNUM_SIGN_COUNT) {
- return false;
- }
- macros.notation = static_cast<ScientificNotation&>(macros.notation).withExponentSignDisplay(sign);
- return true;
-}
-
-void blueprint_helpers::parseCurrencyOption(const StringSegment& segment, MacroProps& macros,
- UErrorCode& status) {
- // Unlike ICU4J, have to check length manually because ICU4C CurrencyUnit does not check it for us
- if (segment.length() != 3) {
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- return;
- }
- const UChar* currencyCode = segment.toTempUnicodeString().getBuffer();
- UErrorCode localStatus = U_ZERO_ERROR;
- CurrencyUnit currency(currencyCode, localStatus);
- if (U_FAILURE(localStatus)) {
- // Not 3 ascii chars
- // throw new SkeletonSyntaxException("Invalid currency", segment);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- return;
- }
- // Slicing is OK
- macros.unit = currency; // NOLINT
-}
-
-void
-blueprint_helpers::generateCurrencyOption(const CurrencyUnit& currency, UnicodeString& sb, UErrorCode&) {
- sb.append(currency.getISOCurrency(), -1);
-}
-
-void blueprint_helpers::parseMeasureUnitOption(const StringSegment& segment, MacroProps& macros,
- UErrorCode& status) {
- const UnicodeString stemString = segment.toTempUnicodeString();
-
- // NOTE: The category (type) of the unit is guaranteed to be a valid subtag (alphanumeric)
- // http://unicode.org/reports/tr35/#Validity_Data
- int firstHyphen = 0;
- while (firstHyphen < stemString.length() && stemString.charAt(firstHyphen) != '-') {
- firstHyphen++;
- }
- if (firstHyphen == stemString.length()) {
- // throw new SkeletonSyntaxException("Invalid measure unit option", segment);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- return;
- }
-
- // Need to do char <-> UChar conversion...
- U_ASSERT(U_SUCCESS(status));
- CharString type;
- SKELETON_UCHAR_TO_CHAR(type, stemString, 0, firstHyphen, status);
- CharString subType;
- SKELETON_UCHAR_TO_CHAR(subType, stemString, firstHyphen + 1, stemString.length(), status);
-
- // Note: the largest type as of this writing (March 2018) is "volume", which has 24 units.
- static constexpr int32_t CAPACITY = 30;
- MeasureUnit units[CAPACITY];
- UErrorCode localStatus = U_ZERO_ERROR;
- int32_t numUnits = MeasureUnit::getAvailable(type.data(), units, CAPACITY, localStatus);
- if (U_FAILURE(localStatus)) {
- // More than 30 units in this type?
- status = U_INTERNAL_PROGRAM_ERROR;
- return;
- }
- for (int32_t i = 0; i < numUnits; i++) {
- auto& unit = units[i];
- if (uprv_strcmp(subType.data(), unit.getSubtype()) == 0) {
- macros.unit = unit;
- return;
- }
- }
-
- // throw new SkeletonSyntaxException("Unknown measure unit", segment);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
-}
-
-void blueprint_helpers::generateMeasureUnitOption(const MeasureUnit& measureUnit, UnicodeString& sb,
- UErrorCode&) {
- // Need to do char <-> UChar conversion...
- sb.append(UnicodeString(measureUnit.getType(), -1, US_INV));
- sb.append(u'-');
- sb.append(UnicodeString(measureUnit.getSubtype(), -1, US_INV));
-}
-
-void blueprint_helpers::parseMeasurePerUnitOption(const StringSegment& segment, MacroProps& macros,
- UErrorCode& status) {
- // A little bit of a hack: save the current unit (numerator), call the main measure unit
- // parsing code, put back the numerator unit, and put the new unit into per-unit.
- MeasureUnit numerator = macros.unit;
- parseMeasureUnitOption(segment, macros, status);
- if (U_FAILURE(status)) { return; }
- macros.perUnit = macros.unit;
- macros.unit = numerator;
-}
-
-void blueprint_helpers::parseIdentifierUnitOption(const StringSegment& segment, MacroProps& macros,
- UErrorCode& status) {
- // Need to do char <-> UChar conversion...
- U_ASSERT(U_SUCCESS(status));
- CharString buffer;
- SKELETON_UCHAR_TO_CHAR(buffer, segment.toTempUnicodeString(), 0, segment.length(), status);
-
- ErrorCode internalStatus;
- auto fullUnit = MeasureUnitImpl::forIdentifier(buffer.toStringPiece(), internalStatus);
- if (internalStatus.isFailure()) {
- // throw new SkeletonSyntaxException("Invalid core unit identifier", segment, e);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- return;
- }
-
- // TODO(ICU-20941): Clean this up.
- for (int32_t i = 0; i < fullUnit.units.length(); i++) {
- SingleUnitImpl* subUnit = fullUnit.units[i];
- if (subUnit->dimensionality > 0) {
- macros.unit = macros.unit.product(subUnit->build(status), status);
- } else {
- subUnit->dimensionality *= -1;
- macros.perUnit = macros.perUnit.product(subUnit->build(status), status);
- }
- }
-}
-
-void blueprint_helpers::parseFractionStem(const StringSegment& segment, MacroProps& macros,
- UErrorCode& status) {
- U_ASSERT(segment.charAt(0) == u'.');
- int32_t offset = 1;
- int32_t minFrac = 0;
- int32_t maxFrac;
- for (; offset < segment.length(); offset++) {
- if (segment.charAt(offset) == u'0') {
- minFrac++;
- } else {
- break;
- }
- }
- if (offset < segment.length()) {
- if (isWildcardChar(segment.charAt(offset))) {
- maxFrac = -1;
- offset++;
- } else {
- maxFrac = minFrac;
- for (; offset < segment.length(); offset++) {
- if (segment.charAt(offset) == u'#') {
- maxFrac++;
- } else {
- break;
- }
- }
- }
- } else {
- maxFrac = minFrac;
- }
- if (offset < segment.length()) {
- // throw new SkeletonSyntaxException("Invalid fraction stem", segment);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- return;
- }
- // Use the public APIs to enforce bounds checking
- if (maxFrac == -1) {
- if (minFrac == 0) {
- macros.precision = Precision::unlimited();
- } else {
- macros.precision = Precision::minFraction(minFrac);
- }
- } else {
- macros.precision = Precision::minMaxFraction(minFrac, maxFrac);
- }
-}
-
-void
-blueprint_helpers::generateFractionStem(int32_t minFrac, int32_t maxFrac, UnicodeString& sb, UErrorCode&) {
- if (minFrac == 0 && maxFrac == 0) {
- sb.append(u"precision-integer", -1);
- return;
- }
- sb.append(u'.');
- appendMultiple(sb, u'0', minFrac);
- if (maxFrac == -1) {
- sb.append(kWildcardChar);
- } else {
- appendMultiple(sb, u'#', maxFrac - minFrac);
- }
-}
-
-void
-blueprint_helpers::parseDigitsStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status) {
- U_ASSERT(segment.charAt(0) == u'@');
- int32_t offset = 0;
- int32_t minSig = 0;
- int32_t maxSig;
- for (; offset < segment.length(); offset++) {
- if (segment.charAt(offset) == u'@') {
- minSig++;
- } else {
- break;
- }
- }
- if (offset < segment.length()) {
- if (isWildcardChar(segment.charAt(offset))) {
- maxSig = -1;
- offset++;
- } else {
- maxSig = minSig;
- for (; offset < segment.length(); offset++) {
- if (segment.charAt(offset) == u'#') {
- maxSig++;
- } else {
- break;
- }
- }
- }
- } else {
- maxSig = minSig;
- }
- if (offset < segment.length()) {
- // throw new SkeletonSyntaxException("Invalid significant digits stem", segment);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- return;
- }
- // Use the public APIs to enforce bounds checking
- if (maxSig == -1) {
- macros.precision = Precision::minSignificantDigits(minSig);
- } else {
- macros.precision = Precision::minMaxSignificantDigits(minSig, maxSig);
- }
-}
-
-void
-blueprint_helpers::generateDigitsStem(int32_t minSig, int32_t maxSig, UnicodeString& sb, UErrorCode&) {
- appendMultiple(sb, u'@', minSig);
- if (maxSig == -1) {
- sb.append(kWildcardChar);
- } else {
- appendMultiple(sb, u'#', maxSig - minSig);
- }
-}
-
-void blueprint_helpers::parseScientificStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status) {
- U_ASSERT(segment.charAt(0) == u'E');
- {
- int32_t offset = 1;
- if (segment.length() == offset) {
- goto fail;
- }
- bool isEngineering = false;
- if (segment.charAt(offset) == u'E') {
- isEngineering = true;
- offset++;
- if (segment.length() == offset) {
- goto fail;
- }
- }
- UNumberSignDisplay signDisplay = UNUM_SIGN_AUTO;
- if (segment.charAt(offset) == u'+') {
- offset++;
- if (segment.length() == offset) {
- goto fail;
- }
- if (segment.charAt(offset) == u'!') {
- signDisplay = UNUM_SIGN_ALWAYS;
- } else if (segment.charAt(offset) == u'?') {
- signDisplay = UNUM_SIGN_EXCEPT_ZERO;
- } else {
- goto fail;
- }
- offset++;
- if (segment.length() == offset) {
- goto fail;
- }
- }
- int32_t minDigits = 0;
- for (; offset < segment.length(); offset++) {
- if (segment.charAt(offset) != u'0') {
- goto fail;
- }
- minDigits++;
- }
- macros.notation = (isEngineering ? Notation::engineering() : Notation::scientific())
- .withExponentSignDisplay(signDisplay)
- .withMinExponentDigits(minDigits);
- return;
- }
- fail: void();
- // throw new SkeletonSyntaxException("Invalid scientific stem", segment);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- return;
-}
-
-void blueprint_helpers::parseIntegerStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status) {
- U_ASSERT(segment.charAt(0) == u'0');
- int32_t offset = 1;
- for (; offset < segment.length(); offset++) {
- if (segment.charAt(offset) != u'0') {
- offset--;
- break;
- }
- }
- if (offset < segment.length()) {
- // throw new SkeletonSyntaxException("Invalid integer stem", segment);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- return;
- }
- macros.integerWidth = IntegerWidth::zeroFillTo(offset);
- return;
-}
-
-bool blueprint_helpers::parseFracSigOption(const StringSegment& segment, MacroProps& macros,
- UErrorCode& status) {
- if (segment.charAt(0) != u'@') {
- return false;
- }
- int offset = 0;
- int minSig = 0;
- int maxSig;
- for (; offset < segment.length(); offset++) {
- if (segment.charAt(offset) == u'@') {
- minSig++;
- } else {
- break;
- }
- }
- // For the frac-sig option, there must be minSig or maxSig but not both.
- // Valid: @+, @@+, @@@+
- // Valid: @#, @##, @###
- // Invalid: @, @@, @@@
- // Invalid: @@#, @@##, @@@#
- if (offset < segment.length()) {
- if (isWildcardChar(segment.charAt(offset))) {
- maxSig = -1;
- offset++;
- } else if (minSig > 1) {
- // @@#, @@##, @@@#
- // throw new SkeletonSyntaxException("Invalid digits option for fraction rounder", segment);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- return false;
- } else {
- maxSig = minSig;
- for (; offset < segment.length(); offset++) {
- if (segment.charAt(offset) == u'#') {
- maxSig++;
- } else {
- break;
- }
- }
- }
- } else {
- // @, @@, @@@
- // throw new SkeletonSyntaxException("Invalid digits option for fraction rounder", segment);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- return false;
- }
- if (offset < segment.length()) {
- // throw new SkeletonSyntaxException("Invalid digits option for fraction rounder", segment);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- return false;
- }
-
- auto& oldPrecision = static_cast<const FractionPrecision&>(macros.precision);
- if (maxSig == -1) {
- macros.precision = oldPrecision.withMinDigits(minSig);
- } else {
- macros.precision = oldPrecision.withMaxDigits(maxSig);
- }
- return true;
-}
-
-void blueprint_helpers::parseIncrementOption(const StringSegment& segment, MacroProps& macros,
- UErrorCode& status) {
- // Need to do char <-> UChar conversion...
- U_ASSERT(U_SUCCESS(status));
- CharString buffer;
- SKELETON_UCHAR_TO_CHAR(buffer, segment.toTempUnicodeString(), 0, segment.length(), status);
-
- // Utilize DecimalQuantity/decNumber to parse this for us.
- DecimalQuantity dq;
- UErrorCode localStatus = U_ZERO_ERROR;
- dq.setToDecNumber({buffer.data(), buffer.length()}, localStatus);
- if (U_FAILURE(localStatus)) {
- // throw new SkeletonSyntaxException("Invalid rounding increment", segment, e);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- return;
- }
- double increment = dq.toDouble();
-
- // We also need to figure out how many digits. Do a brute force string operation.
- int decimalOffset = 0;
- while (decimalOffset < segment.length() && segment.charAt(decimalOffset) != '.') {
- decimalOffset++;
- }
- if (decimalOffset == segment.length()) {
- macros.precision = Precision::increment(increment);
- } else {
- int32_t fractionLength = segment.length() - decimalOffset - 1;
- macros.precision = Precision::increment(increment).withMinFraction(fractionLength);
- }
-}
-
-void blueprint_helpers::generateIncrementOption(double increment, int32_t trailingZeros, UnicodeString& sb,
- UErrorCode&) {
- // Utilize DecimalQuantity/double_conversion to format this for us.
- DecimalQuantity dq;
- dq.setToDouble(increment);
- dq.roundToInfinity();
- sb.append(dq.toPlainString());
-
- // We might need to append extra trailing zeros for min fraction...
- if (trailingZeros > 0) {
- appendMultiple(sb, u'0', trailingZeros);
- }
-}
-
-void blueprint_helpers::parseIntegerWidthOption(const StringSegment& segment, MacroProps& macros,
- UErrorCode& status) {
- int32_t offset = 0;
- int32_t minInt = 0;
- int32_t maxInt;
- if (isWildcardChar(segment.charAt(0))) {
- maxInt = -1;
- offset++;
- } else {
- maxInt = 0;
- }
- for (; offset < segment.length(); offset++) {
- if (maxInt != -1 && segment.charAt(offset) == u'#') {
- maxInt++;
- } else {
- break;
- }
- }
- if (offset < segment.length()) {
- for (; offset < segment.length(); offset++) {
- if (segment.charAt(offset) == u'0') {
- minInt++;
- } else {
- break;
- }
- }
- }
- if (maxInt != -1) {
- maxInt += minInt;
- }
- if (offset < segment.length()) {
- // throw new SkeletonSyntaxException("Invalid integer width stem", segment);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- return;
- }
- // Use the public APIs to enforce bounds checking
- if (maxInt == -1) {
- macros.integerWidth = IntegerWidth::zeroFillTo(minInt);
- } else {
- macros.integerWidth = IntegerWidth::zeroFillTo(minInt).truncateAt(maxInt);
- }
-}
-
-void blueprint_helpers::generateIntegerWidthOption(int32_t minInt, int32_t maxInt, UnicodeString& sb,
- UErrorCode&) {
- if (maxInt == -1) {
- sb.append(kWildcardChar);
- } else {
- appendMultiple(sb, u'#', maxInt - minInt);
- }
- appendMultiple(sb, u'0', minInt);
-}
-
-void blueprint_helpers::parseNumberingSystemOption(const StringSegment& segment, MacroProps& macros,
- UErrorCode& status) {
- // Need to do char <-> UChar conversion...
- U_ASSERT(U_SUCCESS(status));
- CharString buffer;
- SKELETON_UCHAR_TO_CHAR(buffer, segment.toTempUnicodeString(), 0, segment.length(), status);
-
- NumberingSystem* ns = NumberingSystem::createInstanceByName(buffer.data(), status);
- if (ns == nullptr || U_FAILURE(status)) {
- // This is a skeleton syntax error; don't bubble up the low-level NumberingSystem error
- // throw new SkeletonSyntaxException("Unknown numbering system", segment);
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- return;
- }
- macros.symbols.setTo(ns);
-}
-
-void blueprint_helpers::generateNumberingSystemOption(const NumberingSystem& ns, UnicodeString& sb,
- UErrorCode&) {
- // Need to do char <-> UChar conversion...
- sb.append(UnicodeString(ns.getName(), -1, US_INV));
-}
-
-void blueprint_helpers::parseScaleOption(const StringSegment& segment, MacroProps& macros,
- UErrorCode& status) {
- // Need to do char <-> UChar conversion...
- U_ASSERT(U_SUCCESS(status));
- CharString buffer;
- SKELETON_UCHAR_TO_CHAR(buffer, segment.toTempUnicodeString(), 0, segment.length(), status);
-
- LocalPointer<DecNum> decnum(new DecNum(), status);
- if (U_FAILURE(status)) { return; }
- decnum->setTo({buffer.data(), buffer.length()}, status);
- if (U_FAILURE(status)) {
- // This is a skeleton syntax error; don't let the low-level decnum error bubble up
- status = U_NUMBER_SKELETON_SYNTAX_ERROR;
- return;
- }
-
- // NOTE: The constructor will optimize the decnum for us if possible.
- macros.scale = {0, decnum.orphan()};
-}
-
-void blueprint_helpers::generateScaleOption(int32_t magnitude, const DecNum* arbitrary, UnicodeString& sb,
- UErrorCode& status) {
- // Utilize DecimalQuantity/double_conversion to format this for us.
- DecimalQuantity dq;
- if (arbitrary != nullptr) {
- dq.setToDecNum(*arbitrary, status);
- if (U_FAILURE(status)) { return; }
- } else {
- dq.setToInt(1);
- }
- dq.adjustMagnitude(magnitude);
- dq.roundToInfinity();
- sb.append(dq.toPlainString());
-}
-
-
-bool GeneratorHelpers::notation(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
- if (macros.notation.fType == Notation::NTN_COMPACT) {
- UNumberCompactStyle style = macros.notation.fUnion.compactStyle;
- if (style == UNumberCompactStyle::UNUM_LONG) {
- sb.append(u"compact-long", -1);
- return true;
- } else if (style == UNumberCompactStyle::UNUM_SHORT) {
- sb.append(u"compact-short", -1);
- return true;
- } else {
- // Compact notation generated from custom data (not supported in skeleton)
- // The other compact notations are literals
- status = U_UNSUPPORTED_ERROR;
- return false;
- }
- } else if (macros.notation.fType == Notation::NTN_SCIENTIFIC) {
- const Notation::ScientificSettings& impl = macros.notation.fUnion.scientific;
- if (impl.fEngineeringInterval == 3) {
- sb.append(u"engineering", -1);
- } else {
- sb.append(u"scientific", -1);
- }
- if (impl.fMinExponentDigits > 1) {
- sb.append(u'/');
- blueprint_helpers::generateExponentWidthOption(impl.fMinExponentDigits, sb, status);
- if (U_FAILURE(status)) {
- return false;
- }
- }
- if (impl.fExponentSignDisplay != UNUM_SIGN_AUTO) {
- sb.append(u'/');
- enum_to_stem_string::signDisplay(impl.fExponentSignDisplay, sb);
- }
- return true;
- } else {
- // Default value is not shown in normalized form
- return false;
- }
-}
-
-bool GeneratorHelpers::unit(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
- if (utils::unitIsCurrency(macros.unit)) {
- sb.append(u"currency/", -1);
- CurrencyUnit currency(macros.unit, status);
- if (U_FAILURE(status)) {
- return false;
- }
- blueprint_helpers::generateCurrencyOption(currency, sb, status);
- return true;
- } else if (utils::unitIsNoUnit(macros.unit)) {
- if (utils::unitIsPercent(macros.unit)) {
- sb.append(u"percent", -1);
- return true;
- } else if (utils::unitIsPermille(macros.unit)) {
- sb.append(u"permille", -1);
- return true;
- } else {
- // Default value is not shown in normalized form
- return false;
- }
- } else {
- sb.append(u"measure-unit/", -1);
- blueprint_helpers::generateMeasureUnitOption(macros.unit, sb, status);
- return true;
- }
-}
-
-bool GeneratorHelpers::perUnit(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
- // Per-units are currently expected to be only MeasureUnits.
- if (utils::unitIsNoUnit(macros.perUnit)) {
- if (utils::unitIsPercent(macros.perUnit) || utils::unitIsPermille(macros.perUnit)) {
- status = U_UNSUPPORTED_ERROR;
- return false;
- } else {
- // Default value: ok to ignore
- return false;
- }
- } else if (utils::unitIsCurrency(macros.perUnit)) {
- status = U_UNSUPPORTED_ERROR;
- return false;
- } else {
- sb.append(u"per-measure-unit/", -1);
- blueprint_helpers::generateMeasureUnitOption(macros.perUnit, sb, status);
- return true;
- }
-}
-
-bool GeneratorHelpers::precision(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
- if (macros.precision.fType == Precision::RND_NONE) {
- sb.append(u"precision-unlimited", -1);
- } else if (macros.precision.fType == Precision::RND_FRACTION) {
- const Precision::FractionSignificantSettings& impl = macros.precision.fUnion.fracSig;
- blueprint_helpers::generateFractionStem(impl.fMinFrac, impl.fMaxFrac, sb, status);
- } else if (macros.precision.fType == Precision::RND_SIGNIFICANT) {
- const Precision::FractionSignificantSettings& impl = macros.precision.fUnion.fracSig;
- blueprint_helpers::generateDigitsStem(impl.fMinSig, impl.fMaxSig, sb, status);
- } else if (macros.precision.fType == Precision::RND_FRACTION_SIGNIFICANT) {
- const Precision::FractionSignificantSettings& impl = macros.precision.fUnion.fracSig;
- blueprint_helpers::generateFractionStem(impl.fMinFrac, impl.fMaxFrac, sb, status);
- sb.append(u'/');
- if (impl.fMinSig == -1) {
- blueprint_helpers::generateDigitsStem(1, impl.fMaxSig, sb, status);
- } else {
- blueprint_helpers::generateDigitsStem(impl.fMinSig, -1, sb, status);
- }
- } else if (macros.precision.fType == Precision::RND_INCREMENT
- || macros.precision.fType == Precision::RND_INCREMENT_ONE
- || macros.precision.fType == Precision::RND_INCREMENT_FIVE) {
- const Precision::IncrementSettings& impl = macros.precision.fUnion.increment;
- sb.append(u"precision-increment/", -1);
- blueprint_helpers::generateIncrementOption(
- impl.fIncrement,
- impl.fMinFrac - impl.fMaxFrac,
- sb,
- status);
- } else if (macros.precision.fType == Precision::RND_CURRENCY) {
- UCurrencyUsage usage = macros.precision.fUnion.currencyUsage;
- if (usage == UCURR_USAGE_STANDARD) {
- sb.append(u"precision-currency-standard", -1);
- } else {
- sb.append(u"precision-currency-cash", -1);
- }
- } else {
- // Bogus or Error
- return false;
- }
-
- // NOTE: Always return true for rounding because the default value depends on other options.
- return true;
-}
-
-bool GeneratorHelpers::roundingMode(const MacroProps& macros, UnicodeString& sb, UErrorCode&) {
- if (macros.roundingMode == kDefaultMode) {
- return false; // Default
- }
- enum_to_stem_string::roundingMode(macros.roundingMode, sb);
- return true;
-}
-
-bool GeneratorHelpers::grouping(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
- if (macros.grouper.isBogus()) {
- return false; // No value
- } else if (macros.grouper.fStrategy == UNUM_GROUPING_COUNT) {
- status = U_UNSUPPORTED_ERROR;
- return false;
- } else if (macros.grouper.fStrategy == UNUM_GROUPING_AUTO) {
- return false; // Default value
- } else {
- enum_to_stem_string::groupingStrategy(macros.grouper.fStrategy, sb);
- return true;
- }
-}
-
-bool GeneratorHelpers::integerWidth(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
- if (macros.integerWidth.fHasError || macros.integerWidth.isBogus() ||
- macros.integerWidth == IntegerWidth::standard()) {
- // Error or Default
- return false;
- }
- sb.append(u"integer-width/", -1);
- blueprint_helpers::generateIntegerWidthOption(
- macros.integerWidth.fUnion.minMaxInt.fMinInt,
- macros.integerWidth.fUnion.minMaxInt.fMaxInt,
- sb,
- status);
- return true;
-}
-
-bool GeneratorHelpers::symbols(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
- if (macros.symbols.isNumberingSystem()) {
- const NumberingSystem& ns = *macros.symbols.getNumberingSystem();
- if (uprv_strcmp(ns.getName(), "latn") == 0) {
- sb.append(u"latin", -1);
- } else {
- sb.append(u"numbering-system/", -1);
- blueprint_helpers::generateNumberingSystemOption(ns, sb, status);
- }
- return true;
- } else if (macros.symbols.isDecimalFormatSymbols()) {
- status = U_UNSUPPORTED_ERROR;
- return false;
- } else {
- // No custom symbols
- return false;
- }
-}
-
-bool GeneratorHelpers::unitWidth(const MacroProps& macros, UnicodeString& sb, UErrorCode&) {
- if (macros.unitWidth == UNUM_UNIT_WIDTH_SHORT || macros.unitWidth == UNUM_UNIT_WIDTH_COUNT) {
- return false; // Default or Bogus
- }
- enum_to_stem_string::unitWidth(macros.unitWidth, sb);
- return true;
-}
-
-bool GeneratorHelpers::sign(const MacroProps& macros, UnicodeString& sb, UErrorCode&) {
- if (macros.sign == UNUM_SIGN_AUTO || macros.sign == UNUM_SIGN_COUNT) {
- return false; // Default or Bogus
- }
- enum_to_stem_string::signDisplay(macros.sign, sb);
- return true;
-}
-
-bool GeneratorHelpers::decimal(const MacroProps& macros, UnicodeString& sb, UErrorCode&) {
- if (macros.decimal == UNUM_DECIMAL_SEPARATOR_AUTO || macros.decimal == UNUM_DECIMAL_SEPARATOR_COUNT) {
- return false; // Default or Bogus
- }
- enum_to_stem_string::decimalSeparatorDisplay(macros.decimal, sb);
- return true;
-}
-
-bool GeneratorHelpers::scale(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
- if (!macros.scale.isValid()) {
- return false; // Default or Bogus
- }
- sb.append(u"scale/", -1);
- blueprint_helpers::generateScaleOption(
- macros.scale.fMagnitude,
- macros.scale.fArbitrary,
- sb,
- status);
- return true;
-}
-
-
-// Definitions of public API methods (put here for dependency disentanglement)
-
-#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
-// Ignore MSVC warning 4661. This is generated for NumberFormatterSettings<>::toSkeleton() as this method
-// is defined elsewhere (in number_skeletons.cpp). The compiler is warning that the explicit template instantiation
-// inside this single translation unit (CPP file) is incomplete, and thus it isn't sure if the template class is
-// fully defined. However, since each translation unit explicitly instantiates all the necessary template classes,
-// they will all be passed to the linker, and the linker will still find and export all the class members.
-#pragma warning(push)
-#pragma warning(disable: 4661)
-#endif
-
-template<typename Derived>
-UnicodeString NumberFormatterSettings<Derived>::toSkeleton(UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return ICU_Utility::makeBogusString();
- }
- if (fMacros.copyErrorTo(status)) {
- return ICU_Utility::makeBogusString();
- }
- return skeleton::generate(fMacros, status);
-}
-
-// Declare all classes that implement NumberFormatterSettings
-// See https://stackoverflow.com/a/495056/1407170
-template
-class icu::number::NumberFormatterSettings<icu::number::UnlocalizedNumberFormatter>;
-template
-class icu::number::NumberFormatterSettings<icu::number::LocalizedNumberFormatter>;
-
-UnlocalizedNumberFormatter
-NumberFormatter::forSkeleton(const UnicodeString& skeleton, UErrorCode& status) {
- return skeleton::create(skeleton, nullptr, status);
-}
-
-UnlocalizedNumberFormatter
-NumberFormatter::forSkeleton(const UnicodeString& skeleton, UParseError& perror, UErrorCode& status) {
- return skeleton::create(skeleton, &perror, status);
-}
-
-#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
-// Warning 4661.
-#pragma warning(pop)
-#endif
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include "number_decnum.h"
+#include "number_skeletons.h"
+#include "umutex.h"
+#include "ucln_in.h"
+#include "patternprops.h"
+#include "unicode/ucharstriebuilder.h"
+#include "number_utils.h"
+#include "number_decimalquantity.h"
+#include "unicode/numberformatter.h"
+#include "uinvchar.h"
+#include "charstr.h"
+#include "string_segment.h"
+#include "unicode/errorcode.h"
+#include "util.h"
+#include "measunit_impl.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+using namespace icu::number::impl::skeleton;
+
+namespace {
+
+icu::UInitOnce gNumberSkeletonsInitOnce = U_INITONCE_INITIALIZER;
+
+char16_t* kSerializedStemTrie = nullptr;
+
+UBool U_CALLCONV cleanupNumberSkeletons() {
+ uprv_free(kSerializedStemTrie);
+ kSerializedStemTrie = nullptr;
+ gNumberSkeletonsInitOnce.reset();
+ return TRUE;
+}
+
+void U_CALLCONV initNumberSkeletons(UErrorCode& status) {
+ ucln_i18n_registerCleanup(UCLN_I18N_NUMBER_SKELETONS, cleanupNumberSkeletons);
+
+ UCharsTrieBuilder b(status);
+ if (U_FAILURE(status)) { return; }
+
+ // Section 1:
+ b.add(u"compact-short", STEM_COMPACT_SHORT, status);
+ b.add(u"compact-long", STEM_COMPACT_LONG, status);
+ b.add(u"scientific", STEM_SCIENTIFIC, status);
+ b.add(u"engineering", STEM_ENGINEERING, status);
+ b.add(u"notation-simple", STEM_NOTATION_SIMPLE, status);
+ b.add(u"base-unit", STEM_BASE_UNIT, status);
+ b.add(u"percent", STEM_PERCENT, status);
+ b.add(u"permille", STEM_PERMILLE, status);
+ b.add(u"precision-integer", STEM_PRECISION_INTEGER, status);
+ b.add(u"precision-unlimited", STEM_PRECISION_UNLIMITED, status);
+ b.add(u"precision-currency-standard", STEM_PRECISION_CURRENCY_STANDARD, status);
+ b.add(u"precision-currency-cash", STEM_PRECISION_CURRENCY_CASH, status);
+ b.add(u"rounding-mode-ceiling", STEM_ROUNDING_MODE_CEILING, status);
+ b.add(u"rounding-mode-floor", STEM_ROUNDING_MODE_FLOOR, status);
+ b.add(u"rounding-mode-down", STEM_ROUNDING_MODE_DOWN, status);
+ b.add(u"rounding-mode-up", STEM_ROUNDING_MODE_UP, status);
+ b.add(u"rounding-mode-half-even", STEM_ROUNDING_MODE_HALF_EVEN, status);
+ b.add(u"rounding-mode-half-down", STEM_ROUNDING_MODE_HALF_DOWN, status);
+ b.add(u"rounding-mode-half-up", STEM_ROUNDING_MODE_HALF_UP, status);
+ b.add(u"rounding-mode-unnecessary", STEM_ROUNDING_MODE_UNNECESSARY, status);
+ b.add(u"group-off", STEM_GROUP_OFF, status);
+ b.add(u"group-min2", STEM_GROUP_MIN2, status);
+ b.add(u"group-auto", STEM_GROUP_AUTO, status);
+ b.add(u"group-on-aligned", STEM_GROUP_ON_ALIGNED, status);
+ b.add(u"group-thousands", STEM_GROUP_THOUSANDS, status);
+ b.add(u"latin", STEM_LATIN, status);
+ b.add(u"unit-width-narrow", STEM_UNIT_WIDTH_NARROW, status);
+ b.add(u"unit-width-short", STEM_UNIT_WIDTH_SHORT, status);
+ b.add(u"unit-width-full-name", STEM_UNIT_WIDTH_FULL_NAME, status);
+ b.add(u"unit-width-iso-code", STEM_UNIT_WIDTH_ISO_CODE, status);
+ b.add(u"unit-width-hidden", STEM_UNIT_WIDTH_HIDDEN, status);
+ b.add(u"sign-auto", STEM_SIGN_AUTO, status);
+ b.add(u"sign-always", STEM_SIGN_ALWAYS, status);
+ b.add(u"sign-never", STEM_SIGN_NEVER, status);
+ b.add(u"sign-accounting", STEM_SIGN_ACCOUNTING, status);
+ b.add(u"sign-accounting-always", STEM_SIGN_ACCOUNTING_ALWAYS, status);
+ b.add(u"sign-except-zero", STEM_SIGN_EXCEPT_ZERO, status);
+ b.add(u"sign-accounting-except-zero", STEM_SIGN_ACCOUNTING_EXCEPT_ZERO, status);
+ b.add(u"decimal-auto", STEM_DECIMAL_AUTO, status);
+ b.add(u"decimal-always", STEM_DECIMAL_ALWAYS, status);
+ if (U_FAILURE(status)) { return; }
+
+ // Section 2:
+ b.add(u"precision-increment", STEM_PRECISION_INCREMENT, status);
+ b.add(u"measure-unit", STEM_MEASURE_UNIT, status);
+ b.add(u"per-measure-unit", STEM_PER_MEASURE_UNIT, status);
+ b.add(u"unit", STEM_UNIT, status);
+ b.add(u"currency", STEM_CURRENCY, status);
+ b.add(u"integer-width", STEM_INTEGER_WIDTH, status);
+ b.add(u"numbering-system", STEM_NUMBERING_SYSTEM, status);
+ b.add(u"scale", STEM_SCALE, status);
+ if (U_FAILURE(status)) { return; }
+
+ // Section 3 (concise tokens):
+ b.add(u"K", STEM_COMPACT_SHORT, status);
+ b.add(u"KK", STEM_COMPACT_LONG, status);
+ b.add(u"%", STEM_PERCENT, status);
+ b.add(u"%x100", STEM_PERCENT_100, status);
+ b.add(u",_", STEM_GROUP_OFF, status);
+ b.add(u",?", STEM_GROUP_MIN2, status);
+ b.add(u",!", STEM_GROUP_ON_ALIGNED, status);
+ b.add(u"+!", STEM_SIGN_ALWAYS, status);
+ b.add(u"+_", STEM_SIGN_NEVER, status);
+ b.add(u"()", STEM_SIGN_ACCOUNTING, status);
+ b.add(u"()!", STEM_SIGN_ACCOUNTING_ALWAYS, status);
+ b.add(u"+?", STEM_SIGN_EXCEPT_ZERO, status);
+ b.add(u"()?", STEM_SIGN_ACCOUNTING_EXCEPT_ZERO, status);
+ if (U_FAILURE(status)) { return; }
+
+ // Build the CharsTrie
+ // TODO: Use SLOW or FAST here?
+ UnicodeString result;
+ b.buildUnicodeString(USTRINGTRIE_BUILD_FAST, result, status);
+ if (U_FAILURE(status)) { return; }
+
+ // Copy the result into the global constant pointer
+ size_t numBytes = result.length() * sizeof(char16_t);
+ kSerializedStemTrie = static_cast<char16_t*>(uprv_malloc(numBytes));
+ uprv_memcpy(kSerializedStemTrie, result.getBuffer(), numBytes);
+}
+
+
+inline void appendMultiple(UnicodeString& sb, UChar32 cp, int32_t count) {
+ for (int i = 0; i < count; i++) {
+ sb.append(cp);
+ }
+}
+
+
+#define CHECK_NULL(seen, field, status) (void)(seen); /* for auto-format line wrapping */ \
+UPRV_BLOCK_MACRO_BEGIN { \
+ if ((seen).field) { \
+ (status) = U_NUMBER_SKELETON_SYNTAX_ERROR; \
+ return STATE_NULL; \
+ } \
+ (seen).field = true; \
+} UPRV_BLOCK_MACRO_END
+
+
+#define SKELETON_UCHAR_TO_CHAR(dest, src, start, end, status) (void)(dest); \
+UPRV_BLOCK_MACRO_BEGIN { \
+ UErrorCode conversionStatus = U_ZERO_ERROR; \
+ (dest).appendInvariantChars({FALSE, (src).getBuffer() + (start), (end) - (start)}, conversionStatus); \
+ if (conversionStatus == U_INVARIANT_CONVERSION_ERROR) { \
+ /* Don't propagate the invariant conversion error; it is a skeleton syntax error */ \
+ (status) = U_NUMBER_SKELETON_SYNTAX_ERROR; \
+ return; \
+ } else if (U_FAILURE(conversionStatus)) { \
+ (status) = conversionStatus; \
+ return; \
+ } \
+} UPRV_BLOCK_MACRO_END
+
+
+} // anonymous namespace
+
+
+Notation stem_to_object::notation(skeleton::StemEnum stem) {
+ switch (stem) {
+ case STEM_COMPACT_SHORT:
+ return Notation::compactShort();
+ case STEM_COMPACT_LONG:
+ return Notation::compactLong();
+ case STEM_SCIENTIFIC:
+ return Notation::scientific();
+ case STEM_ENGINEERING:
+ return Notation::engineering();
+ case STEM_NOTATION_SIMPLE:
+ return Notation::simple();
+ default:
+ UPRV_UNREACHABLE;
+ }
+}
+
+MeasureUnit stem_to_object::unit(skeleton::StemEnum stem) {
+ switch (stem) {
+ case STEM_BASE_UNIT:
+ // Slicing is okay
+ return NoUnit::base(); // NOLINT
+ case STEM_PERCENT:
+ // Slicing is okay
+ return NoUnit::percent(); // NOLINT
+ case STEM_PERMILLE:
+ // Slicing is okay
+ return NoUnit::permille(); // NOLINT
+ default:
+ UPRV_UNREACHABLE;
+ }
+}
+
+Precision stem_to_object::precision(skeleton::StemEnum stem) {
+ switch (stem) {
+ case STEM_PRECISION_INTEGER:
+ return Precision::integer();
+ case STEM_PRECISION_UNLIMITED:
+ return Precision::unlimited();
+ case STEM_PRECISION_CURRENCY_STANDARD:
+ return Precision::currency(UCURR_USAGE_STANDARD);
+ case STEM_PRECISION_CURRENCY_CASH:
+ return Precision::currency(UCURR_USAGE_CASH);
+ default:
+ UPRV_UNREACHABLE;
+ }
+}
+
+UNumberFormatRoundingMode stem_to_object::roundingMode(skeleton::StemEnum stem) {
+ switch (stem) {
+ case STEM_ROUNDING_MODE_CEILING:
+ return UNUM_ROUND_CEILING;
+ case STEM_ROUNDING_MODE_FLOOR:
+ return UNUM_ROUND_FLOOR;
+ case STEM_ROUNDING_MODE_DOWN:
+ return UNUM_ROUND_DOWN;
+ case STEM_ROUNDING_MODE_UP:
+ return UNUM_ROUND_UP;
+ case STEM_ROUNDING_MODE_HALF_EVEN:
+ return UNUM_ROUND_HALFEVEN;
+ case STEM_ROUNDING_MODE_HALF_DOWN:
+ return UNUM_ROUND_HALFDOWN;
+ case STEM_ROUNDING_MODE_HALF_UP:
+ return UNUM_ROUND_HALFUP;
+ case STEM_ROUNDING_MODE_UNNECESSARY:
+ return UNUM_ROUND_UNNECESSARY;
+ default:
+ UPRV_UNREACHABLE;
+ }
+}
+
+UNumberGroupingStrategy stem_to_object::groupingStrategy(skeleton::StemEnum stem) {
+ switch (stem) {
+ case STEM_GROUP_OFF:
+ return UNUM_GROUPING_OFF;
+ case STEM_GROUP_MIN2:
+ return UNUM_GROUPING_MIN2;
+ case STEM_GROUP_AUTO:
+ return UNUM_GROUPING_AUTO;
+ case STEM_GROUP_ON_ALIGNED:
+ return UNUM_GROUPING_ON_ALIGNED;
+ case STEM_GROUP_THOUSANDS:
+ return UNUM_GROUPING_THOUSANDS;
+ default:
+ return UNUM_GROUPING_COUNT; // for objects, throw; for enums, return COUNT
+ }
+}
+
+UNumberUnitWidth stem_to_object::unitWidth(skeleton::StemEnum stem) {
+ switch (stem) {
+ case STEM_UNIT_WIDTH_NARROW:
+ return UNUM_UNIT_WIDTH_NARROW;
+ case STEM_UNIT_WIDTH_SHORT:
+ return UNUM_UNIT_WIDTH_SHORT;
+ case STEM_UNIT_WIDTH_FULL_NAME:
+ return UNUM_UNIT_WIDTH_FULL_NAME;
+ case STEM_UNIT_WIDTH_ISO_CODE:
+ return UNUM_UNIT_WIDTH_ISO_CODE;
+ case STEM_UNIT_WIDTH_HIDDEN:
+ return UNUM_UNIT_WIDTH_HIDDEN;
+ default:
+ return UNUM_UNIT_WIDTH_COUNT; // for objects, throw; for enums, return COUNT
+ }
+}
+
+UNumberSignDisplay stem_to_object::signDisplay(skeleton::StemEnum stem) {
+ switch (stem) {
+ case STEM_SIGN_AUTO:
+ return UNUM_SIGN_AUTO;
+ case STEM_SIGN_ALWAYS:
+ return UNUM_SIGN_ALWAYS;
+ case STEM_SIGN_NEVER:
+ return UNUM_SIGN_NEVER;
+ case STEM_SIGN_ACCOUNTING:
+ return UNUM_SIGN_ACCOUNTING;
+ case STEM_SIGN_ACCOUNTING_ALWAYS:
+ return UNUM_SIGN_ACCOUNTING_ALWAYS;
+ case STEM_SIGN_EXCEPT_ZERO:
+ return UNUM_SIGN_EXCEPT_ZERO;
+ case STEM_SIGN_ACCOUNTING_EXCEPT_ZERO:
+ return UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO;
+ default:
+ return UNUM_SIGN_COUNT; // for objects, throw; for enums, return COUNT
+ }
+}
+
+UNumberDecimalSeparatorDisplay stem_to_object::decimalSeparatorDisplay(skeleton::StemEnum stem) {
+ switch (stem) {
+ case STEM_DECIMAL_AUTO:
+ return UNUM_DECIMAL_SEPARATOR_AUTO;
+ case STEM_DECIMAL_ALWAYS:
+ return UNUM_DECIMAL_SEPARATOR_ALWAYS;
+ default:
+ return UNUM_DECIMAL_SEPARATOR_COUNT; // for objects, throw; for enums, return COUNT
+ }
+}
+
+
+void enum_to_stem_string::roundingMode(UNumberFormatRoundingMode value, UnicodeString& sb) {
+ switch (value) {
+ case UNUM_ROUND_CEILING:
+ sb.append(u"rounding-mode-ceiling", -1);
+ break;
+ case UNUM_ROUND_FLOOR:
+ sb.append(u"rounding-mode-floor", -1);
+ break;
+ case UNUM_ROUND_DOWN:
+ sb.append(u"rounding-mode-down", -1);
+ break;
+ case UNUM_ROUND_UP:
+ sb.append(u"rounding-mode-up", -1);
+ break;
+ case UNUM_ROUND_HALFEVEN:
+ sb.append(u"rounding-mode-half-even", -1);
+ break;
+ case UNUM_ROUND_HALFDOWN:
+ sb.append(u"rounding-mode-half-down", -1);
+ break;
+ case UNUM_ROUND_HALFUP:
+ sb.append(u"rounding-mode-half-up", -1);
+ break;
+ case UNUM_ROUND_UNNECESSARY:
+ sb.append(u"rounding-mode-unnecessary", -1);
+ break;
+ default:
+ UPRV_UNREACHABLE;
+ }
+}
+
+void enum_to_stem_string::groupingStrategy(UNumberGroupingStrategy value, UnicodeString& sb) {
+ switch (value) {
+ case UNUM_GROUPING_OFF:
+ sb.append(u"group-off", -1);
+ break;
+ case UNUM_GROUPING_MIN2:
+ sb.append(u"group-min2", -1);
+ break;
+ case UNUM_GROUPING_AUTO:
+ sb.append(u"group-auto", -1);
+ break;
+ case UNUM_GROUPING_ON_ALIGNED:
+ sb.append(u"group-on-aligned", -1);
+ break;
+ case UNUM_GROUPING_THOUSANDS:
+ sb.append(u"group-thousands", -1);
+ break;
+ default:
+ UPRV_UNREACHABLE;
+ }
+}
+
+void enum_to_stem_string::unitWidth(UNumberUnitWidth value, UnicodeString& sb) {
+ switch (value) {
+ case UNUM_UNIT_WIDTH_NARROW:
+ sb.append(u"unit-width-narrow", -1);
+ break;
+ case UNUM_UNIT_WIDTH_SHORT:
+ sb.append(u"unit-width-short", -1);
+ break;
+ case UNUM_UNIT_WIDTH_FULL_NAME:
+ sb.append(u"unit-width-full-name", -1);
+ break;
+ case UNUM_UNIT_WIDTH_ISO_CODE:
+ sb.append(u"unit-width-iso-code", -1);
+ break;
+ case UNUM_UNIT_WIDTH_HIDDEN:
+ sb.append(u"unit-width-hidden", -1);
+ break;
+ default:
+ UPRV_UNREACHABLE;
+ }
+}
+
+void enum_to_stem_string::signDisplay(UNumberSignDisplay value, UnicodeString& sb) {
+ switch (value) {
+ case UNUM_SIGN_AUTO:
+ sb.append(u"sign-auto", -1);
+ break;
+ case UNUM_SIGN_ALWAYS:
+ sb.append(u"sign-always", -1);
+ break;
+ case UNUM_SIGN_NEVER:
+ sb.append(u"sign-never", -1);
+ break;
+ case UNUM_SIGN_ACCOUNTING:
+ sb.append(u"sign-accounting", -1);
+ break;
+ case UNUM_SIGN_ACCOUNTING_ALWAYS:
+ sb.append(u"sign-accounting-always", -1);
+ break;
+ case UNUM_SIGN_EXCEPT_ZERO:
+ sb.append(u"sign-except-zero", -1);
+ break;
+ case UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO:
+ sb.append(u"sign-accounting-except-zero", -1);
+ break;
+ default:
+ UPRV_UNREACHABLE;
+ }
+}
+
+void
+enum_to_stem_string::decimalSeparatorDisplay(UNumberDecimalSeparatorDisplay value, UnicodeString& sb) {
+ switch (value) {
+ case UNUM_DECIMAL_SEPARATOR_AUTO:
+ sb.append(u"decimal-auto", -1);
+ break;
+ case UNUM_DECIMAL_SEPARATOR_ALWAYS:
+ sb.append(u"decimal-always", -1);
+ break;
+ default:
+ UPRV_UNREACHABLE;
+ }
+}
+
+
+UnlocalizedNumberFormatter skeleton::create(
+ const UnicodeString& skeletonString, UParseError* perror, UErrorCode& status) {
+
+ // Initialize perror
+ if (perror != nullptr) {
+ perror->line = 0;
+ perror->offset = -1;
+ perror->preContext[0] = 0;
+ perror->postContext[0] = 0;
+ }
+
+ umtx_initOnce(gNumberSkeletonsInitOnce, &initNumberSkeletons, status);
+ if (U_FAILURE(status)) {
+ return {};
+ }
+
+ int32_t errOffset;
+ MacroProps macros = parseSkeleton(skeletonString, errOffset, status);
+ if (U_SUCCESS(status)) {
+ return NumberFormatter::with().macros(macros);
+ }
+
+ if (perror == nullptr) {
+ return {};
+ }
+
+ // Populate the UParseError with the error location
+ perror->offset = errOffset;
+ int32_t contextStart = uprv_max(0, errOffset - U_PARSE_CONTEXT_LEN + 1);
+ int32_t contextEnd = uprv_min(skeletonString.length(), errOffset + U_PARSE_CONTEXT_LEN - 1);
+ skeletonString.extract(contextStart, errOffset - contextStart, perror->preContext, 0);
+ perror->preContext[errOffset - contextStart] = 0;
+ skeletonString.extract(errOffset, contextEnd - errOffset, perror->postContext, 0);
+ perror->postContext[contextEnd - errOffset] = 0;
+ return {};
+}
+
+UnicodeString skeleton::generate(const MacroProps& macros, UErrorCode& status) {
+ umtx_initOnce(gNumberSkeletonsInitOnce, &initNumberSkeletons, status);
+ UnicodeString sb;
+ GeneratorHelpers::generateSkeleton(macros, sb, status);
+ return sb;
+}
+
+MacroProps skeleton::parseSkeleton(
+ const UnicodeString& skeletonString, int32_t& errOffset, UErrorCode& status) {
+ U_ASSERT(U_SUCCESS(status));
+
+ // Add a trailing whitespace to the end of the skeleton string to make code cleaner.
+ UnicodeString tempSkeletonString(skeletonString);
+ tempSkeletonString.append(u' ');
+
+ SeenMacroProps seen;
+ MacroProps macros;
+ StringSegment segment(tempSkeletonString, false);
+ UCharsTrie stemTrie(kSerializedStemTrie);
+ ParseState stem = STATE_NULL;
+ int32_t offset = 0;
+
+ // Primary skeleton parse loop:
+ while (offset < segment.length()) {
+ UChar32 cp = segment.codePointAt(offset);
+ bool isTokenSeparator = PatternProps::isWhiteSpace(cp);
+ bool isOptionSeparator = (cp == u'/');
+
+ if (!isTokenSeparator && !isOptionSeparator) {
+ // Non-separator token; consume it.
+ offset += U16_LENGTH(cp);
+ if (stem == STATE_NULL) {
+ // We are currently consuming a stem.
+ // Go to the next state in the stem trie.
+ stemTrie.nextForCodePoint(cp);
+ }
+ continue;
+ }
+
+ // We are looking at a token or option separator.
+ // If the segment is nonempty, parse it and reset the segment.
+ // Otherwise, make sure it is a valid repeating separator.
+ if (offset != 0) {
+ segment.setLength(offset);
+ if (stem == STATE_NULL) {
+ // The first separator after the start of a token. Parse it as a stem.
+ stem = parseStem(segment, stemTrie, seen, macros, status);
+ stemTrie.reset();
+ } else {
+ // A separator after the first separator of a token. Parse it as an option.
+ stem = parseOption(stem, segment, macros, status);
+ }
+ segment.resetLength();
+ if (U_FAILURE(status)) {
+ errOffset = segment.getOffset();
+ return macros;
+ }
+
+ // Consume the segment:
+ segment.adjustOffset(offset);
+ offset = 0;
+
+ } else if (stem != STATE_NULL) {
+ // A separator ('/' or whitespace) following an option separator ('/')
+ // segment.setLength(U16_LENGTH(cp)); // for error message
+ // throw new SkeletonSyntaxException("Unexpected separator character", segment);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ errOffset = segment.getOffset();
+ return macros;
+
+ } else {
+ // Two spaces in a row; this is OK.
+ }
+
+ // Does the current stem forbid options?
+ if (isOptionSeparator && stem == STATE_NULL) {
+ // segment.setLength(U16_LENGTH(cp)); // for error message
+ // throw new SkeletonSyntaxException("Unexpected option separator", segment);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ errOffset = segment.getOffset();
+ return macros;
+ }
+
+ // Does the current stem require an option?
+ if (isTokenSeparator && stem != STATE_NULL) {
+ switch (stem) {
+ case STATE_INCREMENT_PRECISION:
+ case STATE_MEASURE_UNIT:
+ case STATE_PER_MEASURE_UNIT:
+ case STATE_IDENTIFIER_UNIT:
+ case STATE_CURRENCY_UNIT:
+ case STATE_INTEGER_WIDTH:
+ case STATE_NUMBERING_SYSTEM:
+ case STATE_SCALE:
+ // segment.setLength(U16_LENGTH(cp)); // for error message
+ // throw new SkeletonSyntaxException("Stem requires an option", segment);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ errOffset = segment.getOffset();
+ return macros;
+ default:
+ break;
+ }
+ stem = STATE_NULL;
+ }
+
+ // Consume the separator:
+ segment.adjustOffset(U16_LENGTH(cp));
+ }
+ U_ASSERT(stem == STATE_NULL);
+ return macros;
+}
+
+ParseState
+skeleton::parseStem(const StringSegment& segment, const UCharsTrie& stemTrie, SeenMacroProps& seen,
+ MacroProps& macros, UErrorCode& status) {
+ // First check for "blueprint" stems, which start with a "signal char"
+ switch (segment.charAt(0)) {
+ case u'.':
+ CHECK_NULL(seen, precision, status);
+ blueprint_helpers::parseFractionStem(segment, macros, status);
+ return STATE_FRACTION_PRECISION;
+ case u'@':
+ CHECK_NULL(seen, precision, status);
+ blueprint_helpers::parseDigitsStem(segment, macros, status);
+ return STATE_NULL;
+ case u'E':
+ CHECK_NULL(seen, notation, status);
+ blueprint_helpers::parseScientificStem(segment, macros, status);
+ return STATE_NULL;
+ case u'0':
+ CHECK_NULL(seen, integerWidth, status);
+ blueprint_helpers::parseIntegerStem(segment, macros, status);
+ return STATE_NULL;
+ default:
+ break;
+ }
+
+ // Now look at the stemsTrie, which is already be pointing at our stem.
+ UStringTrieResult stemResult = stemTrie.current();
+
+ if (stemResult != USTRINGTRIE_INTERMEDIATE_VALUE && stemResult != USTRINGTRIE_FINAL_VALUE) {
+ // throw new SkeletonSyntaxException("Unknown stem", segment);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ return STATE_NULL;
+ }
+
+ auto stem = static_cast<StemEnum>(stemTrie.getValue());
+ switch (stem) {
+
+ // Stems with meaning on their own, not requiring an option:
+
+ case STEM_COMPACT_SHORT:
+ case STEM_COMPACT_LONG:
+ case STEM_SCIENTIFIC:
+ case STEM_ENGINEERING:
+ case STEM_NOTATION_SIMPLE:
+ CHECK_NULL(seen, notation, status);
+ macros.notation = stem_to_object::notation(stem);
+ switch (stem) {
+ case STEM_SCIENTIFIC:
+ case STEM_ENGINEERING:
+ return STATE_SCIENTIFIC; // allows for scientific options
+ default:
+ return STATE_NULL;
+ }
+
+ case STEM_BASE_UNIT:
+ case STEM_PERCENT:
+ case STEM_PERMILLE:
+ CHECK_NULL(seen, unit, status);
+ macros.unit = stem_to_object::unit(stem);
+ return STATE_NULL;
+
+ case STEM_PERCENT_100:
+ CHECK_NULL(seen, scale, status);
+ CHECK_NULL(seen, unit, status);
+ macros.scale = Scale::powerOfTen(2);
+ macros.unit = NoUnit::percent();
+ return STATE_NULL;
+
+ case STEM_PRECISION_INTEGER:
+ case STEM_PRECISION_UNLIMITED:
+ case STEM_PRECISION_CURRENCY_STANDARD:
+ case STEM_PRECISION_CURRENCY_CASH:
+ CHECK_NULL(seen, precision, status);
+ macros.precision = stem_to_object::precision(stem);
+ switch (stem) {
+ case STEM_PRECISION_INTEGER:
+ return STATE_FRACTION_PRECISION; // allows for "precision-integer/@##"
+ default:
+ return STATE_NULL;
+ }
+
+ case STEM_ROUNDING_MODE_CEILING:
+ case STEM_ROUNDING_MODE_FLOOR:
+ case STEM_ROUNDING_MODE_DOWN:
+ case STEM_ROUNDING_MODE_UP:
+ case STEM_ROUNDING_MODE_HALF_EVEN:
+ case STEM_ROUNDING_MODE_HALF_DOWN:
+ case STEM_ROUNDING_MODE_HALF_UP:
+ case STEM_ROUNDING_MODE_UNNECESSARY:
+ CHECK_NULL(seen, roundingMode, status);
+ macros.roundingMode = stem_to_object::roundingMode(stem);
+ return STATE_NULL;
+
+ case STEM_GROUP_OFF:
+ case STEM_GROUP_MIN2:
+ case STEM_GROUP_AUTO:
+ case STEM_GROUP_ON_ALIGNED:
+ case STEM_GROUP_THOUSANDS:
+ CHECK_NULL(seen, grouper, status);
+ macros.grouper = Grouper::forStrategy(stem_to_object::groupingStrategy(stem));
+ return STATE_NULL;
+
+ case STEM_LATIN:
+ CHECK_NULL(seen, symbols, status);
+ macros.symbols.setTo(NumberingSystem::createInstanceByName("latn", status));
+ return STATE_NULL;
+
+ case STEM_UNIT_WIDTH_NARROW:
+ case STEM_UNIT_WIDTH_SHORT:
+ case STEM_UNIT_WIDTH_FULL_NAME:
+ case STEM_UNIT_WIDTH_ISO_CODE:
+ case STEM_UNIT_WIDTH_HIDDEN:
+ CHECK_NULL(seen, unitWidth, status);
+ macros.unitWidth = stem_to_object::unitWidth(stem);
+ return STATE_NULL;
+
+ case STEM_SIGN_AUTO:
+ case STEM_SIGN_ALWAYS:
+ case STEM_SIGN_NEVER:
+ case STEM_SIGN_ACCOUNTING:
+ case STEM_SIGN_ACCOUNTING_ALWAYS:
+ case STEM_SIGN_EXCEPT_ZERO:
+ case STEM_SIGN_ACCOUNTING_EXCEPT_ZERO:
+ CHECK_NULL(seen, sign, status);
+ macros.sign = stem_to_object::signDisplay(stem);
+ return STATE_NULL;
+
+ case STEM_DECIMAL_AUTO:
+ case STEM_DECIMAL_ALWAYS:
+ CHECK_NULL(seen, decimal, status);
+ macros.decimal = stem_to_object::decimalSeparatorDisplay(stem);
+ return STATE_NULL;
+
+ // Stems requiring an option:
+
+ case STEM_PRECISION_INCREMENT:
+ CHECK_NULL(seen, precision, status);
+ return STATE_INCREMENT_PRECISION;
+
+ case STEM_MEASURE_UNIT:
+ CHECK_NULL(seen, unit, status);
+ return STATE_MEASURE_UNIT;
+
+ case STEM_PER_MEASURE_UNIT:
+ CHECK_NULL(seen, perUnit, status);
+ return STATE_PER_MEASURE_UNIT;
+
+ case STEM_UNIT:
+ CHECK_NULL(seen, unit, status);
+ CHECK_NULL(seen, perUnit, status);
+ return STATE_IDENTIFIER_UNIT;
+
+ case STEM_CURRENCY:
+ CHECK_NULL(seen, unit, status);
+ return STATE_CURRENCY_UNIT;
+
+ case STEM_INTEGER_WIDTH:
+ CHECK_NULL(seen, integerWidth, status);
+ return STATE_INTEGER_WIDTH;
+
+ case STEM_NUMBERING_SYSTEM:
+ CHECK_NULL(seen, symbols, status);
+ return STATE_NUMBERING_SYSTEM;
+
+ case STEM_SCALE:
+ CHECK_NULL(seen, scale, status);
+ return STATE_SCALE;
+
+ default:
+ UPRV_UNREACHABLE;
+ }
+}
+
+ParseState skeleton::parseOption(ParseState stem, const StringSegment& segment, MacroProps& macros,
+ UErrorCode& status) {
+
+ ///// Required options: /////
+
+ switch (stem) {
+ case STATE_CURRENCY_UNIT:
+ blueprint_helpers::parseCurrencyOption(segment, macros, status);
+ return STATE_NULL;
+ case STATE_MEASURE_UNIT:
+ blueprint_helpers::parseMeasureUnitOption(segment, macros, status);
+ return STATE_NULL;
+ case STATE_PER_MEASURE_UNIT:
+ blueprint_helpers::parseMeasurePerUnitOption(segment, macros, status);
+ return STATE_NULL;
+ case STATE_IDENTIFIER_UNIT:
+ blueprint_helpers::parseIdentifierUnitOption(segment, macros, status);
+ return STATE_NULL;
+ case STATE_INCREMENT_PRECISION:
+ blueprint_helpers::parseIncrementOption(segment, macros, status);
+ return STATE_NULL;
+ case STATE_INTEGER_WIDTH:
+ blueprint_helpers::parseIntegerWidthOption(segment, macros, status);
+ return STATE_NULL;
+ case STATE_NUMBERING_SYSTEM:
+ blueprint_helpers::parseNumberingSystemOption(segment, macros, status);
+ return STATE_NULL;
+ case STATE_SCALE:
+ blueprint_helpers::parseScaleOption(segment, macros, status);
+ return STATE_NULL;
+ default:
+ break;
+ }
+
+ ///// Non-required options: /////
+
+ // Scientific options
+ switch (stem) {
+ case STATE_SCIENTIFIC:
+ if (blueprint_helpers::parseExponentWidthOption(segment, macros, status)) {
+ return STATE_SCIENTIFIC;
+ }
+ if (U_FAILURE(status)) {
+ return {};
+ }
+ if (blueprint_helpers::parseExponentSignOption(segment, macros, status)) {
+ return STATE_SCIENTIFIC;
+ }
+ if (U_FAILURE(status)) {
+ return {};
+ }
+ break;
+ default:
+ break;
+ }
+
+ // Frac-sig option
+ switch (stem) {
+ case STATE_FRACTION_PRECISION:
+ if (blueprint_helpers::parseFracSigOption(segment, macros, status)) {
+ return STATE_NULL;
+ }
+ if (U_FAILURE(status)) {
+ return {};
+ }
+ break;
+ default:
+ break;
+ }
+
+ // Unknown option
+ // throw new SkeletonSyntaxException("Invalid option", segment);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ return STATE_NULL;
+}
+
+void GeneratorHelpers::generateSkeleton(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
+ if (U_FAILURE(status)) { return; }
+
+ // Supported options
+ if (GeneratorHelpers::notation(macros, sb, status)) {
+ sb.append(u' ');
+ }
+ if (U_FAILURE(status)) { return; }
+ if (GeneratorHelpers::unit(macros, sb, status)) {
+ sb.append(u' ');
+ }
+ if (U_FAILURE(status)) { return; }
+ if (GeneratorHelpers::perUnit(macros, sb, status)) {
+ sb.append(u' ');
+ }
+ if (U_FAILURE(status)) { return; }
+ if (GeneratorHelpers::precision(macros, sb, status)) {
+ sb.append(u' ');
+ }
+ if (U_FAILURE(status)) { return; }
+ if (GeneratorHelpers::roundingMode(macros, sb, status)) {
+ sb.append(u' ');
+ }
+ if (U_FAILURE(status)) { return; }
+ if (GeneratorHelpers::grouping(macros, sb, status)) {
+ sb.append(u' ');
+ }
+ if (U_FAILURE(status)) { return; }
+ if (GeneratorHelpers::integerWidth(macros, sb, status)) {
+ sb.append(u' ');
+ }
+ if (U_FAILURE(status)) { return; }
+ if (GeneratorHelpers::symbols(macros, sb, status)) {
+ sb.append(u' ');
+ }
+ if (U_FAILURE(status)) { return; }
+ if (GeneratorHelpers::unitWidth(macros, sb, status)) {
+ sb.append(u' ');
+ }
+ if (U_FAILURE(status)) { return; }
+ if (GeneratorHelpers::sign(macros, sb, status)) {
+ sb.append(u' ');
+ }
+ if (U_FAILURE(status)) { return; }
+ if (GeneratorHelpers::decimal(macros, sb, status)) {
+ sb.append(u' ');
+ }
+ if (U_FAILURE(status)) { return; }
+ if (GeneratorHelpers::scale(macros, sb, status)) {
+ sb.append(u' ');
+ }
+ if (U_FAILURE(status)) { return; }
+
+ // Unsupported options
+ if (!macros.padder.isBogus()) {
+ status = U_UNSUPPORTED_ERROR;
+ return;
+ }
+ if (macros.affixProvider != nullptr) {
+ status = U_UNSUPPORTED_ERROR;
+ return;
+ }
+ if (macros.rules != nullptr) {
+ status = U_UNSUPPORTED_ERROR;
+ return;
+ }
+
+ // Remove the trailing space
+ if (sb.length() > 0) {
+ sb.truncate(sb.length() - 1);
+ }
+}
+
+
+bool blueprint_helpers::parseExponentWidthOption(const StringSegment& segment, MacroProps& macros,
+ UErrorCode&) {
+ if (!isWildcardChar(segment.charAt(0))) {
+ return false;
+ }
+ int32_t offset = 1;
+ int32_t minExp = 0;
+ for (; offset < segment.length(); offset++) {
+ if (segment.charAt(offset) == u'e') {
+ minExp++;
+ } else {
+ break;
+ }
+ }
+ if (offset < segment.length()) {
+ return false;
+ }
+ // Use the public APIs to enforce bounds checking
+ macros.notation = static_cast<ScientificNotation&>(macros.notation).withMinExponentDigits(minExp);
+ return true;
+}
+
+void
+blueprint_helpers::generateExponentWidthOption(int32_t minExponentDigits, UnicodeString& sb, UErrorCode&) {
+ sb.append(kWildcardChar);
+ appendMultiple(sb, u'e', minExponentDigits);
+}
+
+bool
+blueprint_helpers::parseExponentSignOption(const StringSegment& segment, MacroProps& macros, UErrorCode&) {
+ // Get the sign display type out of the CharsTrie data structure.
+ UCharsTrie tempStemTrie(kSerializedStemTrie);
+ UStringTrieResult result = tempStemTrie.next(
+ segment.toTempUnicodeString().getBuffer(),
+ segment.length());
+ if (result != USTRINGTRIE_INTERMEDIATE_VALUE && result != USTRINGTRIE_FINAL_VALUE) {
+ return false;
+ }
+ auto sign = stem_to_object::signDisplay(static_cast<StemEnum>(tempStemTrie.getValue()));
+ if (sign == UNUM_SIGN_COUNT) {
+ return false;
+ }
+ macros.notation = static_cast<ScientificNotation&>(macros.notation).withExponentSignDisplay(sign);
+ return true;
+}
+
+void blueprint_helpers::parseCurrencyOption(const StringSegment& segment, MacroProps& macros,
+ UErrorCode& status) {
+ // Unlike ICU4J, have to check length manually because ICU4C CurrencyUnit does not check it for us
+ if (segment.length() != 3) {
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ return;
+ }
+ const UChar* currencyCode = segment.toTempUnicodeString().getBuffer();
+ UErrorCode localStatus = U_ZERO_ERROR;
+ CurrencyUnit currency(currencyCode, localStatus);
+ if (U_FAILURE(localStatus)) {
+ // Not 3 ascii chars
+ // throw new SkeletonSyntaxException("Invalid currency", segment);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ return;
+ }
+ // Slicing is OK
+ macros.unit = currency; // NOLINT
+}
+
+void
+blueprint_helpers::generateCurrencyOption(const CurrencyUnit& currency, UnicodeString& sb, UErrorCode&) {
+ sb.append(currency.getISOCurrency(), -1);
+}
+
+void blueprint_helpers::parseMeasureUnitOption(const StringSegment& segment, MacroProps& macros,
+ UErrorCode& status) {
+ const UnicodeString stemString = segment.toTempUnicodeString();
+
+ // NOTE: The category (type) of the unit is guaranteed to be a valid subtag (alphanumeric)
+ // http://unicode.org/reports/tr35/#Validity_Data
+ int firstHyphen = 0;
+ while (firstHyphen < stemString.length() && stemString.charAt(firstHyphen) != '-') {
+ firstHyphen++;
+ }
+ if (firstHyphen == stemString.length()) {
+ // throw new SkeletonSyntaxException("Invalid measure unit option", segment);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ return;
+ }
+
+ // Need to do char <-> UChar conversion...
+ U_ASSERT(U_SUCCESS(status));
+ CharString type;
+ SKELETON_UCHAR_TO_CHAR(type, stemString, 0, firstHyphen, status);
+ CharString subType;
+ SKELETON_UCHAR_TO_CHAR(subType, stemString, firstHyphen + 1, stemString.length(), status);
+
+ // Note: the largest type as of this writing (March 2018) is "volume", which has 24 units.
+ static constexpr int32_t CAPACITY = 30;
+ MeasureUnit units[CAPACITY];
+ UErrorCode localStatus = U_ZERO_ERROR;
+ int32_t numUnits = MeasureUnit::getAvailable(type.data(), units, CAPACITY, localStatus);
+ if (U_FAILURE(localStatus)) {
+ // More than 30 units in this type?
+ status = U_INTERNAL_PROGRAM_ERROR;
+ return;
+ }
+ for (int32_t i = 0; i < numUnits; i++) {
+ auto& unit = units[i];
+ if (uprv_strcmp(subType.data(), unit.getSubtype()) == 0) {
+ macros.unit = unit;
+ return;
+ }
+ }
+
+ // throw new SkeletonSyntaxException("Unknown measure unit", segment);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+}
+
+void blueprint_helpers::generateMeasureUnitOption(const MeasureUnit& measureUnit, UnicodeString& sb,
+ UErrorCode&) {
+ // Need to do char <-> UChar conversion...
+ sb.append(UnicodeString(measureUnit.getType(), -1, US_INV));
+ sb.append(u'-');
+ sb.append(UnicodeString(measureUnit.getSubtype(), -1, US_INV));
+}
+
+void blueprint_helpers::parseMeasurePerUnitOption(const StringSegment& segment, MacroProps& macros,
+ UErrorCode& status) {
+ // A little bit of a hack: save the current unit (numerator), call the main measure unit
+ // parsing code, put back the numerator unit, and put the new unit into per-unit.
+ MeasureUnit numerator = macros.unit;
+ parseMeasureUnitOption(segment, macros, status);
+ if (U_FAILURE(status)) { return; }
+ macros.perUnit = macros.unit;
+ macros.unit = numerator;
+}
+
+void blueprint_helpers::parseIdentifierUnitOption(const StringSegment& segment, MacroProps& macros,
+ UErrorCode& status) {
+ // Need to do char <-> UChar conversion...
+ U_ASSERT(U_SUCCESS(status));
+ CharString buffer;
+ SKELETON_UCHAR_TO_CHAR(buffer, segment.toTempUnicodeString(), 0, segment.length(), status);
+
+ ErrorCode internalStatus;
+ auto fullUnit = MeasureUnitImpl::forIdentifier(buffer.toStringPiece(), internalStatus);
+ if (internalStatus.isFailure()) {
+ // throw new SkeletonSyntaxException("Invalid core unit identifier", segment, e);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ return;
+ }
+
+ // TODO(ICU-20941): Clean this up.
+ for (int32_t i = 0; i < fullUnit.units.length(); i++) {
+ SingleUnitImpl* subUnit = fullUnit.units[i];
+ if (subUnit->dimensionality > 0) {
+ macros.unit = macros.unit.product(subUnit->build(status), status);
+ } else {
+ subUnit->dimensionality *= -1;
+ macros.perUnit = macros.perUnit.product(subUnit->build(status), status);
+ }
+ }
+}
+
+void blueprint_helpers::parseFractionStem(const StringSegment& segment, MacroProps& macros,
+ UErrorCode& status) {
+ U_ASSERT(segment.charAt(0) == u'.');
+ int32_t offset = 1;
+ int32_t minFrac = 0;
+ int32_t maxFrac;
+ for (; offset < segment.length(); offset++) {
+ if (segment.charAt(offset) == u'0') {
+ minFrac++;
+ } else {
+ break;
+ }
+ }
+ if (offset < segment.length()) {
+ if (isWildcardChar(segment.charAt(offset))) {
+ maxFrac = -1;
+ offset++;
+ } else {
+ maxFrac = minFrac;
+ for (; offset < segment.length(); offset++) {
+ if (segment.charAt(offset) == u'#') {
+ maxFrac++;
+ } else {
+ break;
+ }
+ }
+ }
+ } else {
+ maxFrac = minFrac;
+ }
+ if (offset < segment.length()) {
+ // throw new SkeletonSyntaxException("Invalid fraction stem", segment);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ return;
+ }
+ // Use the public APIs to enforce bounds checking
+ if (maxFrac == -1) {
+ if (minFrac == 0) {
+ macros.precision = Precision::unlimited();
+ } else {
+ macros.precision = Precision::minFraction(minFrac);
+ }
+ } else {
+ macros.precision = Precision::minMaxFraction(minFrac, maxFrac);
+ }
+}
+
+void
+blueprint_helpers::generateFractionStem(int32_t minFrac, int32_t maxFrac, UnicodeString& sb, UErrorCode&) {
+ if (minFrac == 0 && maxFrac == 0) {
+ sb.append(u"precision-integer", -1);
+ return;
+ }
+ sb.append(u'.');
+ appendMultiple(sb, u'0', minFrac);
+ if (maxFrac == -1) {
+ sb.append(kWildcardChar);
+ } else {
+ appendMultiple(sb, u'#', maxFrac - minFrac);
+ }
+}
+
+void
+blueprint_helpers::parseDigitsStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status) {
+ U_ASSERT(segment.charAt(0) == u'@');
+ int32_t offset = 0;
+ int32_t minSig = 0;
+ int32_t maxSig;
+ for (; offset < segment.length(); offset++) {
+ if (segment.charAt(offset) == u'@') {
+ minSig++;
+ } else {
+ break;
+ }
+ }
+ if (offset < segment.length()) {
+ if (isWildcardChar(segment.charAt(offset))) {
+ maxSig = -1;
+ offset++;
+ } else {
+ maxSig = minSig;
+ for (; offset < segment.length(); offset++) {
+ if (segment.charAt(offset) == u'#') {
+ maxSig++;
+ } else {
+ break;
+ }
+ }
+ }
+ } else {
+ maxSig = minSig;
+ }
+ if (offset < segment.length()) {
+ // throw new SkeletonSyntaxException("Invalid significant digits stem", segment);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ return;
+ }
+ // Use the public APIs to enforce bounds checking
+ if (maxSig == -1) {
+ macros.precision = Precision::minSignificantDigits(minSig);
+ } else {
+ macros.precision = Precision::minMaxSignificantDigits(minSig, maxSig);
+ }
+}
+
+void
+blueprint_helpers::generateDigitsStem(int32_t minSig, int32_t maxSig, UnicodeString& sb, UErrorCode&) {
+ appendMultiple(sb, u'@', minSig);
+ if (maxSig == -1) {
+ sb.append(kWildcardChar);
+ } else {
+ appendMultiple(sb, u'#', maxSig - minSig);
+ }
+}
+
+void blueprint_helpers::parseScientificStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status) {
+ U_ASSERT(segment.charAt(0) == u'E');
+ {
+ int32_t offset = 1;
+ if (segment.length() == offset) {
+ goto fail;
+ }
+ bool isEngineering = false;
+ if (segment.charAt(offset) == u'E') {
+ isEngineering = true;
+ offset++;
+ if (segment.length() == offset) {
+ goto fail;
+ }
+ }
+ UNumberSignDisplay signDisplay = UNUM_SIGN_AUTO;
+ if (segment.charAt(offset) == u'+') {
+ offset++;
+ if (segment.length() == offset) {
+ goto fail;
+ }
+ if (segment.charAt(offset) == u'!') {
+ signDisplay = UNUM_SIGN_ALWAYS;
+ } else if (segment.charAt(offset) == u'?') {
+ signDisplay = UNUM_SIGN_EXCEPT_ZERO;
+ } else {
+ goto fail;
+ }
+ offset++;
+ if (segment.length() == offset) {
+ goto fail;
+ }
+ }
+ int32_t minDigits = 0;
+ for (; offset < segment.length(); offset++) {
+ if (segment.charAt(offset) != u'0') {
+ goto fail;
+ }
+ minDigits++;
+ }
+ macros.notation = (isEngineering ? Notation::engineering() : Notation::scientific())
+ .withExponentSignDisplay(signDisplay)
+ .withMinExponentDigits(minDigits);
+ return;
+ }
+ fail: void();
+ // throw new SkeletonSyntaxException("Invalid scientific stem", segment);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ return;
+}
+
+void blueprint_helpers::parseIntegerStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status) {
+ U_ASSERT(segment.charAt(0) == u'0');
+ int32_t offset = 1;
+ for (; offset < segment.length(); offset++) {
+ if (segment.charAt(offset) != u'0') {
+ offset--;
+ break;
+ }
+ }
+ if (offset < segment.length()) {
+ // throw new SkeletonSyntaxException("Invalid integer stem", segment);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ return;
+ }
+ macros.integerWidth = IntegerWidth::zeroFillTo(offset);
+ return;
+}
+
+bool blueprint_helpers::parseFracSigOption(const StringSegment& segment, MacroProps& macros,
+ UErrorCode& status) {
+ if (segment.charAt(0) != u'@') {
+ return false;
+ }
+ int offset = 0;
+ int minSig = 0;
+ int maxSig;
+ for (; offset < segment.length(); offset++) {
+ if (segment.charAt(offset) == u'@') {
+ minSig++;
+ } else {
+ break;
+ }
+ }
+ // For the frac-sig option, there must be minSig or maxSig but not both.
+ // Valid: @+, @@+, @@@+
+ // Valid: @#, @##, @###
+ // Invalid: @, @@, @@@
+ // Invalid: @@#, @@##, @@@#
+ if (offset < segment.length()) {
+ if (isWildcardChar(segment.charAt(offset))) {
+ maxSig = -1;
+ offset++;
+ } else if (minSig > 1) {
+ // @@#, @@##, @@@#
+ // throw new SkeletonSyntaxException("Invalid digits option for fraction rounder", segment);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ return false;
+ } else {
+ maxSig = minSig;
+ for (; offset < segment.length(); offset++) {
+ if (segment.charAt(offset) == u'#') {
+ maxSig++;
+ } else {
+ break;
+ }
+ }
+ }
+ } else {
+ // @, @@, @@@
+ // throw new SkeletonSyntaxException("Invalid digits option for fraction rounder", segment);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ return false;
+ }
+ if (offset < segment.length()) {
+ // throw new SkeletonSyntaxException("Invalid digits option for fraction rounder", segment);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ return false;
+ }
+
+ auto& oldPrecision = static_cast<const FractionPrecision&>(macros.precision);
+ if (maxSig == -1) {
+ macros.precision = oldPrecision.withMinDigits(minSig);
+ } else {
+ macros.precision = oldPrecision.withMaxDigits(maxSig);
+ }
+ return true;
+}
+
+void blueprint_helpers::parseIncrementOption(const StringSegment& segment, MacroProps& macros,
+ UErrorCode& status) {
+ // Need to do char <-> UChar conversion...
+ U_ASSERT(U_SUCCESS(status));
+ CharString buffer;
+ SKELETON_UCHAR_TO_CHAR(buffer, segment.toTempUnicodeString(), 0, segment.length(), status);
+
+ // Utilize DecimalQuantity/decNumber to parse this for us.
+ DecimalQuantity dq;
+ UErrorCode localStatus = U_ZERO_ERROR;
+ dq.setToDecNumber({buffer.data(), buffer.length()}, localStatus);
+ if (U_FAILURE(localStatus)) {
+ // throw new SkeletonSyntaxException("Invalid rounding increment", segment, e);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ return;
+ }
+ double increment = dq.toDouble();
+
+ // We also need to figure out how many digits. Do a brute force string operation.
+ int decimalOffset = 0;
+ while (decimalOffset < segment.length() && segment.charAt(decimalOffset) != '.') {
+ decimalOffset++;
+ }
+ if (decimalOffset == segment.length()) {
+ macros.precision = Precision::increment(increment);
+ } else {
+ int32_t fractionLength = segment.length() - decimalOffset - 1;
+ macros.precision = Precision::increment(increment).withMinFraction(fractionLength);
+ }
+}
+
+void blueprint_helpers::generateIncrementOption(double increment, int32_t trailingZeros, UnicodeString& sb,
+ UErrorCode&) {
+ // Utilize DecimalQuantity/double_conversion to format this for us.
+ DecimalQuantity dq;
+ dq.setToDouble(increment);
+ dq.roundToInfinity();
+ sb.append(dq.toPlainString());
+
+ // We might need to append extra trailing zeros for min fraction...
+ if (trailingZeros > 0) {
+ appendMultiple(sb, u'0', trailingZeros);
+ }
+}
+
+void blueprint_helpers::parseIntegerWidthOption(const StringSegment& segment, MacroProps& macros,
+ UErrorCode& status) {
+ int32_t offset = 0;
+ int32_t minInt = 0;
+ int32_t maxInt;
+ if (isWildcardChar(segment.charAt(0))) {
+ maxInt = -1;
+ offset++;
+ } else {
+ maxInt = 0;
+ }
+ for (; offset < segment.length(); offset++) {
+ if (maxInt != -1 && segment.charAt(offset) == u'#') {
+ maxInt++;
+ } else {
+ break;
+ }
+ }
+ if (offset < segment.length()) {
+ for (; offset < segment.length(); offset++) {
+ if (segment.charAt(offset) == u'0') {
+ minInt++;
+ } else {
+ break;
+ }
+ }
+ }
+ if (maxInt != -1) {
+ maxInt += minInt;
+ }
+ if (offset < segment.length()) {
+ // throw new SkeletonSyntaxException("Invalid integer width stem", segment);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ return;
+ }
+ // Use the public APIs to enforce bounds checking
+ if (maxInt == -1) {
+ macros.integerWidth = IntegerWidth::zeroFillTo(minInt);
+ } else {
+ macros.integerWidth = IntegerWidth::zeroFillTo(minInt).truncateAt(maxInt);
+ }
+}
+
+void blueprint_helpers::generateIntegerWidthOption(int32_t minInt, int32_t maxInt, UnicodeString& sb,
+ UErrorCode&) {
+ if (maxInt == -1) {
+ sb.append(kWildcardChar);
+ } else {
+ appendMultiple(sb, u'#', maxInt - minInt);
+ }
+ appendMultiple(sb, u'0', minInt);
+}
+
+void blueprint_helpers::parseNumberingSystemOption(const StringSegment& segment, MacroProps& macros,
+ UErrorCode& status) {
+ // Need to do char <-> UChar conversion...
+ U_ASSERT(U_SUCCESS(status));
+ CharString buffer;
+ SKELETON_UCHAR_TO_CHAR(buffer, segment.toTempUnicodeString(), 0, segment.length(), status);
+
+ NumberingSystem* ns = NumberingSystem::createInstanceByName(buffer.data(), status);
+ if (ns == nullptr || U_FAILURE(status)) {
+ // This is a skeleton syntax error; don't bubble up the low-level NumberingSystem error
+ // throw new SkeletonSyntaxException("Unknown numbering system", segment);
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ return;
+ }
+ macros.symbols.setTo(ns);
+}
+
+void blueprint_helpers::generateNumberingSystemOption(const NumberingSystem& ns, UnicodeString& sb,
+ UErrorCode&) {
+ // Need to do char <-> UChar conversion...
+ sb.append(UnicodeString(ns.getName(), -1, US_INV));
+}
+
+void blueprint_helpers::parseScaleOption(const StringSegment& segment, MacroProps& macros,
+ UErrorCode& status) {
+ // Need to do char <-> UChar conversion...
+ U_ASSERT(U_SUCCESS(status));
+ CharString buffer;
+ SKELETON_UCHAR_TO_CHAR(buffer, segment.toTempUnicodeString(), 0, segment.length(), status);
+
+ LocalPointer<DecNum> decnum(new DecNum(), status);
+ if (U_FAILURE(status)) { return; }
+ decnum->setTo({buffer.data(), buffer.length()}, status);
+ if (U_FAILURE(status)) {
+ // This is a skeleton syntax error; don't let the low-level decnum error bubble up
+ status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+ return;
+ }
+
+ // NOTE: The constructor will optimize the decnum for us if possible.
+ macros.scale = {0, decnum.orphan()};
+}
+
+void blueprint_helpers::generateScaleOption(int32_t magnitude, const DecNum* arbitrary, UnicodeString& sb,
+ UErrorCode& status) {
+ // Utilize DecimalQuantity/double_conversion to format this for us.
+ DecimalQuantity dq;
+ if (arbitrary != nullptr) {
+ dq.setToDecNum(*arbitrary, status);
+ if (U_FAILURE(status)) { return; }
+ } else {
+ dq.setToInt(1);
+ }
+ dq.adjustMagnitude(magnitude);
+ dq.roundToInfinity();
+ sb.append(dq.toPlainString());
+}
+
+
+bool GeneratorHelpers::notation(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
+ if (macros.notation.fType == Notation::NTN_COMPACT) {
+ UNumberCompactStyle style = macros.notation.fUnion.compactStyle;
+ if (style == UNumberCompactStyle::UNUM_LONG) {
+ sb.append(u"compact-long", -1);
+ return true;
+ } else if (style == UNumberCompactStyle::UNUM_SHORT) {
+ sb.append(u"compact-short", -1);
+ return true;
+ } else {
+ // Compact notation generated from custom data (not supported in skeleton)
+ // The other compact notations are literals
+ status = U_UNSUPPORTED_ERROR;
+ return false;
+ }
+ } else if (macros.notation.fType == Notation::NTN_SCIENTIFIC) {
+ const Notation::ScientificSettings& impl = macros.notation.fUnion.scientific;
+ if (impl.fEngineeringInterval == 3) {
+ sb.append(u"engineering", -1);
+ } else {
+ sb.append(u"scientific", -1);
+ }
+ if (impl.fMinExponentDigits > 1) {
+ sb.append(u'/');
+ blueprint_helpers::generateExponentWidthOption(impl.fMinExponentDigits, sb, status);
+ if (U_FAILURE(status)) {
+ return false;
+ }
+ }
+ if (impl.fExponentSignDisplay != UNUM_SIGN_AUTO) {
+ sb.append(u'/');
+ enum_to_stem_string::signDisplay(impl.fExponentSignDisplay, sb);
+ }
+ return true;
+ } else {
+ // Default value is not shown in normalized form
+ return false;
+ }
+}
+
+bool GeneratorHelpers::unit(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
+ if (utils::unitIsCurrency(macros.unit)) {
+ sb.append(u"currency/", -1);
+ CurrencyUnit currency(macros.unit, status);
+ if (U_FAILURE(status)) {
+ return false;
+ }
+ blueprint_helpers::generateCurrencyOption(currency, sb, status);
+ return true;
+ } else if (utils::unitIsNoUnit(macros.unit)) {
+ if (utils::unitIsPercent(macros.unit)) {
+ sb.append(u"percent", -1);
+ return true;
+ } else if (utils::unitIsPermille(macros.unit)) {
+ sb.append(u"permille", -1);
+ return true;
+ } else {
+ // Default value is not shown in normalized form
+ return false;
+ }
+ } else {
+ sb.append(u"measure-unit/", -1);
+ blueprint_helpers::generateMeasureUnitOption(macros.unit, sb, status);
+ return true;
+ }
+}
+
+bool GeneratorHelpers::perUnit(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
+ // Per-units are currently expected to be only MeasureUnits.
+ if (utils::unitIsNoUnit(macros.perUnit)) {
+ if (utils::unitIsPercent(macros.perUnit) || utils::unitIsPermille(macros.perUnit)) {
+ status = U_UNSUPPORTED_ERROR;
+ return false;
+ } else {
+ // Default value: ok to ignore
+ return false;
+ }
+ } else if (utils::unitIsCurrency(macros.perUnit)) {
+ status = U_UNSUPPORTED_ERROR;
+ return false;
+ } else {
+ sb.append(u"per-measure-unit/", -1);
+ blueprint_helpers::generateMeasureUnitOption(macros.perUnit, sb, status);
+ return true;
+ }
+}
+
+bool GeneratorHelpers::precision(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
+ if (macros.precision.fType == Precision::RND_NONE) {
+ sb.append(u"precision-unlimited", -1);
+ } else if (macros.precision.fType == Precision::RND_FRACTION) {
+ const Precision::FractionSignificantSettings& impl = macros.precision.fUnion.fracSig;
+ blueprint_helpers::generateFractionStem(impl.fMinFrac, impl.fMaxFrac, sb, status);
+ } else if (macros.precision.fType == Precision::RND_SIGNIFICANT) {
+ const Precision::FractionSignificantSettings& impl = macros.precision.fUnion.fracSig;
+ blueprint_helpers::generateDigitsStem(impl.fMinSig, impl.fMaxSig, sb, status);
+ } else if (macros.precision.fType == Precision::RND_FRACTION_SIGNIFICANT) {
+ const Precision::FractionSignificantSettings& impl = macros.precision.fUnion.fracSig;
+ blueprint_helpers::generateFractionStem(impl.fMinFrac, impl.fMaxFrac, sb, status);
+ sb.append(u'/');
+ if (impl.fMinSig == -1) {
+ blueprint_helpers::generateDigitsStem(1, impl.fMaxSig, sb, status);
+ } else {
+ blueprint_helpers::generateDigitsStem(impl.fMinSig, -1, sb, status);
+ }
+ } else if (macros.precision.fType == Precision::RND_INCREMENT
+ || macros.precision.fType == Precision::RND_INCREMENT_ONE
+ || macros.precision.fType == Precision::RND_INCREMENT_FIVE) {
+ const Precision::IncrementSettings& impl = macros.precision.fUnion.increment;
+ sb.append(u"precision-increment/", -1);
+ blueprint_helpers::generateIncrementOption(
+ impl.fIncrement,
+ impl.fMinFrac - impl.fMaxFrac,
+ sb,
+ status);
+ } else if (macros.precision.fType == Precision::RND_CURRENCY) {
+ UCurrencyUsage usage = macros.precision.fUnion.currencyUsage;
+ if (usage == UCURR_USAGE_STANDARD) {
+ sb.append(u"precision-currency-standard", -1);
+ } else {
+ sb.append(u"precision-currency-cash", -1);
+ }
+ } else {
+ // Bogus or Error
+ return false;
+ }
+
+ // NOTE: Always return true for rounding because the default value depends on other options.
+ return true;
+}
+
+bool GeneratorHelpers::roundingMode(const MacroProps& macros, UnicodeString& sb, UErrorCode&) {
+ if (macros.roundingMode == kDefaultMode) {
+ return false; // Default
+ }
+ enum_to_stem_string::roundingMode(macros.roundingMode, sb);
+ return true;
+}
+
+bool GeneratorHelpers::grouping(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
+ if (macros.grouper.isBogus()) {
+ return false; // No value
+ } else if (macros.grouper.fStrategy == UNUM_GROUPING_COUNT) {
+ status = U_UNSUPPORTED_ERROR;
+ return false;
+ } else if (macros.grouper.fStrategy == UNUM_GROUPING_AUTO) {
+ return false; // Default value
+ } else {
+ enum_to_stem_string::groupingStrategy(macros.grouper.fStrategy, sb);
+ return true;
+ }
+}
+
+bool GeneratorHelpers::integerWidth(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
+ if (macros.integerWidth.fHasError || macros.integerWidth.isBogus() ||
+ macros.integerWidth == IntegerWidth::standard()) {
+ // Error or Default
+ return false;
+ }
+ sb.append(u"integer-width/", -1);
+ blueprint_helpers::generateIntegerWidthOption(
+ macros.integerWidth.fUnion.minMaxInt.fMinInt,
+ macros.integerWidth.fUnion.minMaxInt.fMaxInt,
+ sb,
+ status);
+ return true;
+}
+
+bool GeneratorHelpers::symbols(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
+ if (macros.symbols.isNumberingSystem()) {
+ const NumberingSystem& ns = *macros.symbols.getNumberingSystem();
+ if (uprv_strcmp(ns.getName(), "latn") == 0) {
+ sb.append(u"latin", -1);
+ } else {
+ sb.append(u"numbering-system/", -1);
+ blueprint_helpers::generateNumberingSystemOption(ns, sb, status);
+ }
+ return true;
+ } else if (macros.symbols.isDecimalFormatSymbols()) {
+ status = U_UNSUPPORTED_ERROR;
+ return false;
+ } else {
+ // No custom symbols
+ return false;
+ }
+}
+
+bool GeneratorHelpers::unitWidth(const MacroProps& macros, UnicodeString& sb, UErrorCode&) {
+ if (macros.unitWidth == UNUM_UNIT_WIDTH_SHORT || macros.unitWidth == UNUM_UNIT_WIDTH_COUNT) {
+ return false; // Default or Bogus
+ }
+ enum_to_stem_string::unitWidth(macros.unitWidth, sb);
+ return true;
+}
+
+bool GeneratorHelpers::sign(const MacroProps& macros, UnicodeString& sb, UErrorCode&) {
+ if (macros.sign == UNUM_SIGN_AUTO || macros.sign == UNUM_SIGN_COUNT) {
+ return false; // Default or Bogus
+ }
+ enum_to_stem_string::signDisplay(macros.sign, sb);
+ return true;
+}
+
+bool GeneratorHelpers::decimal(const MacroProps& macros, UnicodeString& sb, UErrorCode&) {
+ if (macros.decimal == UNUM_DECIMAL_SEPARATOR_AUTO || macros.decimal == UNUM_DECIMAL_SEPARATOR_COUNT) {
+ return false; // Default or Bogus
+ }
+ enum_to_stem_string::decimalSeparatorDisplay(macros.decimal, sb);
+ return true;
+}
+
+bool GeneratorHelpers::scale(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) {
+ if (!macros.scale.isValid()) {
+ return false; // Default or Bogus
+ }
+ sb.append(u"scale/", -1);
+ blueprint_helpers::generateScaleOption(
+ macros.scale.fMagnitude,
+ macros.scale.fArbitrary,
+ sb,
+ status);
+ return true;
+}
+
+
+// Definitions of public API methods (put here for dependency disentanglement)
+
+#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
+// Ignore MSVC warning 4661. This is generated for NumberFormatterSettings<>::toSkeleton() as this method
+// is defined elsewhere (in number_skeletons.cpp). The compiler is warning that the explicit template instantiation
+// inside this single translation unit (CPP file) is incomplete, and thus it isn't sure if the template class is
+// fully defined. However, since each translation unit explicitly instantiates all the necessary template classes,
+// they will all be passed to the linker, and the linker will still find and export all the class members.
+#pragma warning(push)
+#pragma warning(disable: 4661)
+#endif
+
+template<typename Derived>
+UnicodeString NumberFormatterSettings<Derived>::toSkeleton(UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return ICU_Utility::makeBogusString();
+ }
+ if (fMacros.copyErrorTo(status)) {
+ return ICU_Utility::makeBogusString();
+ }
+ return skeleton::generate(fMacros, status);
+}
+
+// Declare all classes that implement NumberFormatterSettings
+// See https://stackoverflow.com/a/495056/1407170
+template
+class icu::number::NumberFormatterSettings<icu::number::UnlocalizedNumberFormatter>;
+template
+class icu::number::NumberFormatterSettings<icu::number::LocalizedNumberFormatter>;
+
+UnlocalizedNumberFormatter
+NumberFormatter::forSkeleton(const UnicodeString& skeleton, UErrorCode& status) {
+ return skeleton::create(skeleton, nullptr, status);
+}
+
+UnlocalizedNumberFormatter
+NumberFormatter::forSkeleton(const UnicodeString& skeleton, UParseError& perror, UErrorCode& status) {
+ return skeleton::create(skeleton, &perror, status);
+}
+
+#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
+// Warning 4661.
+#pragma warning(pop)
+#endif
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_skeletons.h b/contrib/libs/icu/i18n/number_skeletons.h
index 4217598561..d9b2c0ee0b 100644
--- a/contrib/libs/icu/i18n/number_skeletons.h
+++ b/contrib/libs/icu/i18n/number_skeletons.h
@@ -1,352 +1,352 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __SOURCE_NUMBER_SKELETONS_H__
-#define __SOURCE_NUMBER_SKELETONS_H__
-
-#include "number_types.h"
-#include "numparse_types.h"
-#include "unicode/ucharstrie.h"
-#include "string_segment.h"
-
-U_NAMESPACE_BEGIN
-namespace number {
-namespace impl {
-
-// Forward-declaration
-struct SeenMacroProps;
-
-// namespace for enums and entrypoint functions
-namespace skeleton {
-
-///////////////////////////////////////////////////////////////////////////////////////
-// NOTE: For an example of how to add a new stem to the number skeleton parser, see: //
-// http://bugs.icu-project.org/trac/changeset/41193 //
-///////////////////////////////////////////////////////////////////////////////////////
-
-/**
- * While parsing a skeleton, this enum records what type of option we expect to find next.
- */
-enum ParseState {
-
- // Section 0: We expect whitespace or a stem, but not an option:
-
- STATE_NULL,
-
- // Section 1: We might accept an option, but it is not required:
-
- STATE_SCIENTIFIC,
- STATE_FRACTION_PRECISION,
-
- // Section 2: An option is required:
-
- STATE_INCREMENT_PRECISION,
- STATE_MEASURE_UNIT,
- STATE_PER_MEASURE_UNIT,
- STATE_IDENTIFIER_UNIT,
- STATE_CURRENCY_UNIT,
- STATE_INTEGER_WIDTH,
- STATE_NUMBERING_SYSTEM,
- STATE_SCALE,
-};
-
-/**
- * All possible stem literals have an entry in the StemEnum. The enum name is the kebab case stem
- * string literal written in upper snake case.
- *
- * @see StemToObject
- * @see #SERIALIZED_STEM_TRIE
- */
-enum StemEnum {
-
- // Section 1: Stems that do not require an option:
-
- STEM_COMPACT_SHORT,
- STEM_COMPACT_LONG,
- STEM_SCIENTIFIC,
- STEM_ENGINEERING,
- STEM_NOTATION_SIMPLE,
- STEM_BASE_UNIT,
- STEM_PERCENT,
- STEM_PERMILLE,
- STEM_PERCENT_100, // concise-only
- STEM_PRECISION_INTEGER,
- STEM_PRECISION_UNLIMITED,
- STEM_PRECISION_CURRENCY_STANDARD,
- STEM_PRECISION_CURRENCY_CASH,
- STEM_ROUNDING_MODE_CEILING,
- STEM_ROUNDING_MODE_FLOOR,
- STEM_ROUNDING_MODE_DOWN,
- STEM_ROUNDING_MODE_UP,
- STEM_ROUNDING_MODE_HALF_EVEN,
- STEM_ROUNDING_MODE_HALF_DOWN,
- STEM_ROUNDING_MODE_HALF_UP,
- STEM_ROUNDING_MODE_UNNECESSARY,
- STEM_GROUP_OFF,
- STEM_GROUP_MIN2,
- STEM_GROUP_AUTO,
- STEM_GROUP_ON_ALIGNED,
- STEM_GROUP_THOUSANDS,
- STEM_LATIN,
- STEM_UNIT_WIDTH_NARROW,
- STEM_UNIT_WIDTH_SHORT,
- STEM_UNIT_WIDTH_FULL_NAME,
- STEM_UNIT_WIDTH_ISO_CODE,
- STEM_UNIT_WIDTH_HIDDEN,
- STEM_SIGN_AUTO,
- STEM_SIGN_ALWAYS,
- STEM_SIGN_NEVER,
- STEM_SIGN_ACCOUNTING,
- STEM_SIGN_ACCOUNTING_ALWAYS,
- STEM_SIGN_EXCEPT_ZERO,
- STEM_SIGN_ACCOUNTING_EXCEPT_ZERO,
- STEM_DECIMAL_AUTO,
- STEM_DECIMAL_ALWAYS,
-
- // Section 2: Stems that DO require an option:
-
- STEM_PRECISION_INCREMENT,
- STEM_MEASURE_UNIT,
- STEM_PER_MEASURE_UNIT,
- STEM_UNIT,
- STEM_CURRENCY,
- STEM_INTEGER_WIDTH,
- STEM_NUMBERING_SYSTEM,
- STEM_SCALE,
-};
-
-/** Default wildcard char, accepted on input and printed in output */
-constexpr char16_t kWildcardChar = u'*';
-
-/** Alternative wildcard char, accept on input but not printed in output */
-constexpr char16_t kAltWildcardChar = u'+';
-
-/** Checks whether the char is a wildcard on input */
-inline bool isWildcardChar(char16_t c) {
- return c == kWildcardChar || c == kAltWildcardChar;
-}
-
-/**
- * Creates a NumberFormatter corresponding to the given skeleton string.
- *
- * @param skeletonString
- * A number skeleton string, possibly not in its shortest form.
- * @return An UnlocalizedNumberFormatter with behavior defined by the given skeleton string.
- */
-UnlocalizedNumberFormatter create(
- const UnicodeString& skeletonString, UParseError* perror, UErrorCode& status);
-
-/**
- * Create a skeleton string corresponding to the given NumberFormatter.
- *
- * @param macros
- * The NumberFormatter options object.
- * @return A skeleton string in normalized form.
- */
-UnicodeString generate(const MacroProps& macros, UErrorCode& status);
-
-/**
- * Converts from a skeleton string to a MacroProps. This method contains the primary parse loop.
- *
- * Internal: use the create() endpoint instead of this function.
- */
-MacroProps parseSkeleton(const UnicodeString& skeletonString, int32_t& errOffset, UErrorCode& status);
-
-/**
- * Given that the current segment represents a stem, parse it and save the result.
- *
- * @return The next state after parsing this stem, corresponding to what subset of options to expect.
- */
-ParseState parseStem(const StringSegment& segment, const UCharsTrie& stemTrie, SeenMacroProps& seen,
- MacroProps& macros, UErrorCode& status);
-
-/**
- * Given that the current segment represents an option, parse it and save the result.
- *
- * @return The next state after parsing this option, corresponding to what subset of options to
- * expect next.
- */
-ParseState
-parseOption(ParseState stem, const StringSegment& segment, MacroProps& macros, UErrorCode& status);
-
-} // namespace skeleton
-
-
-/**
- * Namespace for utility methods that convert from StemEnum to corresponding objects or enums. This
- * applies to only the "Section 1" stems, those that are well-defined without an option.
- */
-namespace stem_to_object {
-
-Notation notation(skeleton::StemEnum stem);
-
-MeasureUnit unit(skeleton::StemEnum stem);
-
-Precision precision(skeleton::StemEnum stem);
-
-UNumberFormatRoundingMode roundingMode(skeleton::StemEnum stem);
-
-UNumberGroupingStrategy groupingStrategy(skeleton::StemEnum stem);
-
-UNumberUnitWidth unitWidth(skeleton::StemEnum stem);
-
-UNumberSignDisplay signDisplay(skeleton::StemEnum stem);
-
-UNumberDecimalSeparatorDisplay decimalSeparatorDisplay(skeleton::StemEnum stem);
-
-} // namespace stem_to_object
-
-/**
- * Namespace for utility methods that convert from enums to stem strings. More complex object conversions
- * take place in the object_to_stem_string namespace.
- */
-namespace enum_to_stem_string {
-
-void roundingMode(UNumberFormatRoundingMode value, UnicodeString& sb);
-
-void groupingStrategy(UNumberGroupingStrategy value, UnicodeString& sb);
-
-void unitWidth(UNumberUnitWidth value, UnicodeString& sb);
-
-void signDisplay(UNumberSignDisplay value, UnicodeString& sb);
-
-void decimalSeparatorDisplay(UNumberDecimalSeparatorDisplay value, UnicodeString& sb);
-
-} // namespace enum_to_stem_string
-
-/**
- * Namespace for utility methods for processing stems and options that cannot be interpreted literally.
- */
-namespace blueprint_helpers {
-
-/** @return Whether we successfully found and parsed an exponent width option. */
-bool parseExponentWidthOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
-
-void generateExponentWidthOption(int32_t minExponentDigits, UnicodeString& sb, UErrorCode& status);
-
-/** @return Whether we successfully found and parsed an exponent sign option. */
-bool parseExponentSignOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
-
-void parseCurrencyOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
-
-void generateCurrencyOption(const CurrencyUnit& currency, UnicodeString& sb, UErrorCode& status);
-
-void parseMeasureUnitOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
-
-void generateMeasureUnitOption(const MeasureUnit& measureUnit, UnicodeString& sb, UErrorCode& status);
-
-void parseMeasurePerUnitOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
-
-void parseIdentifierUnitOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
-
-void parseFractionStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
-
-void generateFractionStem(int32_t minFrac, int32_t maxFrac, UnicodeString& sb, UErrorCode& status);
-
-void parseDigitsStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
-
-void generateDigitsStem(int32_t minSig, int32_t maxSig, UnicodeString& sb, UErrorCode& status);
-
-void parseScientificStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
-
-// Note: no generateScientificStem since this syntax was added later in ICU 67
-
-void parseIntegerStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
-
-// Note: no generateIntegerStem since this syntax was added later in ICU 67
-
-/** @return Whether we successfully found and parsed a frac-sig option. */
-bool parseFracSigOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
-
-void parseIncrementOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
-
-void
-generateIncrementOption(double increment, int32_t trailingZeros, UnicodeString& sb, UErrorCode& status);
-
-void parseIntegerWidthOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
-
-void generateIntegerWidthOption(int32_t minInt, int32_t maxInt, UnicodeString& sb, UErrorCode& status);
-
-void parseNumberingSystemOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
-
-void generateNumberingSystemOption(const NumberingSystem& ns, UnicodeString& sb, UErrorCode& status);
-
-void parseScaleOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
-
-void generateScaleOption(int32_t magnitude, const DecNum* arbitrary, UnicodeString& sb,
- UErrorCode& status);
-
-} // namespace blueprint_helpers
-
-/**
- * Class for utility methods for generating a token corresponding to each macro-prop. Each method
- * returns whether or not a token was written to the string builder.
- *
- * This needs to be a class, not a namespace, so it can be friended.
- */
-class GeneratorHelpers {
- public:
- /**
- * Main skeleton generator function. Appends the normalized skeleton for the MacroProps to the given
- * StringBuilder.
- *
- * Internal: use the create() endpoint instead of this function.
- */
- static void generateSkeleton(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
-
- private:
- static bool notation(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
-
- static bool unit(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
-
- static bool perUnit(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
-
- static bool precision(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
-
- static bool roundingMode(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
-
- static bool grouping(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
-
- static bool integerWidth(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
-
- static bool symbols(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
-
- static bool unitWidth(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
-
- static bool sign(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
-
- static bool decimal(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
-
- static bool scale(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
-
-};
-
-/**
- * Struct for null-checking.
- * In Java, we can just check the object reference. In C++, we need a different method.
- */
-struct SeenMacroProps {
- bool notation = false;
- bool unit = false;
- bool perUnit = false;
- bool precision = false;
- bool roundingMode = false;
- bool grouper = false;
- bool padder = false;
- bool integerWidth = false;
- bool symbols = false;
- bool unitWidth = false;
- bool sign = false;
- bool decimal = false;
- bool scale = false;
-};
-
-} // namespace impl
-} // namespace number
-U_NAMESPACE_END
-
-#endif //__SOURCE_NUMBER_SKELETONS_H__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __SOURCE_NUMBER_SKELETONS_H__
+#define __SOURCE_NUMBER_SKELETONS_H__
+
+#include "number_types.h"
+#include "numparse_types.h"
+#include "unicode/ucharstrie.h"
+#include "string_segment.h"
+
+U_NAMESPACE_BEGIN
+namespace number {
+namespace impl {
+
+// Forward-declaration
+struct SeenMacroProps;
+
+// namespace for enums and entrypoint functions
+namespace skeleton {
+
+///////////////////////////////////////////////////////////////////////////////////////
+// NOTE: For an example of how to add a new stem to the number skeleton parser, see: //
+// http://bugs.icu-project.org/trac/changeset/41193 //
+///////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * While parsing a skeleton, this enum records what type of option we expect to find next.
+ */
+enum ParseState {
+
+ // Section 0: We expect whitespace or a stem, but not an option:
+
+ STATE_NULL,
+
+ // Section 1: We might accept an option, but it is not required:
+
+ STATE_SCIENTIFIC,
+ STATE_FRACTION_PRECISION,
+
+ // Section 2: An option is required:
+
+ STATE_INCREMENT_PRECISION,
+ STATE_MEASURE_UNIT,
+ STATE_PER_MEASURE_UNIT,
+ STATE_IDENTIFIER_UNIT,
+ STATE_CURRENCY_UNIT,
+ STATE_INTEGER_WIDTH,
+ STATE_NUMBERING_SYSTEM,
+ STATE_SCALE,
+};
+
+/**
+ * All possible stem literals have an entry in the StemEnum. The enum name is the kebab case stem
+ * string literal written in upper snake case.
+ *
+ * @see StemToObject
+ * @see #SERIALIZED_STEM_TRIE
+ */
+enum StemEnum {
+
+ // Section 1: Stems that do not require an option:
+
+ STEM_COMPACT_SHORT,
+ STEM_COMPACT_LONG,
+ STEM_SCIENTIFIC,
+ STEM_ENGINEERING,
+ STEM_NOTATION_SIMPLE,
+ STEM_BASE_UNIT,
+ STEM_PERCENT,
+ STEM_PERMILLE,
+ STEM_PERCENT_100, // concise-only
+ STEM_PRECISION_INTEGER,
+ STEM_PRECISION_UNLIMITED,
+ STEM_PRECISION_CURRENCY_STANDARD,
+ STEM_PRECISION_CURRENCY_CASH,
+ STEM_ROUNDING_MODE_CEILING,
+ STEM_ROUNDING_MODE_FLOOR,
+ STEM_ROUNDING_MODE_DOWN,
+ STEM_ROUNDING_MODE_UP,
+ STEM_ROUNDING_MODE_HALF_EVEN,
+ STEM_ROUNDING_MODE_HALF_DOWN,
+ STEM_ROUNDING_MODE_HALF_UP,
+ STEM_ROUNDING_MODE_UNNECESSARY,
+ STEM_GROUP_OFF,
+ STEM_GROUP_MIN2,
+ STEM_GROUP_AUTO,
+ STEM_GROUP_ON_ALIGNED,
+ STEM_GROUP_THOUSANDS,
+ STEM_LATIN,
+ STEM_UNIT_WIDTH_NARROW,
+ STEM_UNIT_WIDTH_SHORT,
+ STEM_UNIT_WIDTH_FULL_NAME,
+ STEM_UNIT_WIDTH_ISO_CODE,
+ STEM_UNIT_WIDTH_HIDDEN,
+ STEM_SIGN_AUTO,
+ STEM_SIGN_ALWAYS,
+ STEM_SIGN_NEVER,
+ STEM_SIGN_ACCOUNTING,
+ STEM_SIGN_ACCOUNTING_ALWAYS,
+ STEM_SIGN_EXCEPT_ZERO,
+ STEM_SIGN_ACCOUNTING_EXCEPT_ZERO,
+ STEM_DECIMAL_AUTO,
+ STEM_DECIMAL_ALWAYS,
+
+ // Section 2: Stems that DO require an option:
+
+ STEM_PRECISION_INCREMENT,
+ STEM_MEASURE_UNIT,
+ STEM_PER_MEASURE_UNIT,
+ STEM_UNIT,
+ STEM_CURRENCY,
+ STEM_INTEGER_WIDTH,
+ STEM_NUMBERING_SYSTEM,
+ STEM_SCALE,
+};
+
+/** Default wildcard char, accepted on input and printed in output */
+constexpr char16_t kWildcardChar = u'*';
+
+/** Alternative wildcard char, accept on input but not printed in output */
+constexpr char16_t kAltWildcardChar = u'+';
+
+/** Checks whether the char is a wildcard on input */
+inline bool isWildcardChar(char16_t c) {
+ return c == kWildcardChar || c == kAltWildcardChar;
+}
+
+/**
+ * Creates a NumberFormatter corresponding to the given skeleton string.
+ *
+ * @param skeletonString
+ * A number skeleton string, possibly not in its shortest form.
+ * @return An UnlocalizedNumberFormatter with behavior defined by the given skeleton string.
+ */
+UnlocalizedNumberFormatter create(
+ const UnicodeString& skeletonString, UParseError* perror, UErrorCode& status);
+
+/**
+ * Create a skeleton string corresponding to the given NumberFormatter.
+ *
+ * @param macros
+ * The NumberFormatter options object.
+ * @return A skeleton string in normalized form.
+ */
+UnicodeString generate(const MacroProps& macros, UErrorCode& status);
+
+/**
+ * Converts from a skeleton string to a MacroProps. This method contains the primary parse loop.
+ *
+ * Internal: use the create() endpoint instead of this function.
+ */
+MacroProps parseSkeleton(const UnicodeString& skeletonString, int32_t& errOffset, UErrorCode& status);
+
+/**
+ * Given that the current segment represents a stem, parse it and save the result.
+ *
+ * @return The next state after parsing this stem, corresponding to what subset of options to expect.
+ */
+ParseState parseStem(const StringSegment& segment, const UCharsTrie& stemTrie, SeenMacroProps& seen,
+ MacroProps& macros, UErrorCode& status);
+
+/**
+ * Given that the current segment represents an option, parse it and save the result.
+ *
+ * @return The next state after parsing this option, corresponding to what subset of options to
+ * expect next.
+ */
+ParseState
+parseOption(ParseState stem, const StringSegment& segment, MacroProps& macros, UErrorCode& status);
+
+} // namespace skeleton
+
+
+/**
+ * Namespace for utility methods that convert from StemEnum to corresponding objects or enums. This
+ * applies to only the "Section 1" stems, those that are well-defined without an option.
+ */
+namespace stem_to_object {
+
+Notation notation(skeleton::StemEnum stem);
+
+MeasureUnit unit(skeleton::StemEnum stem);
+
+Precision precision(skeleton::StemEnum stem);
+
+UNumberFormatRoundingMode roundingMode(skeleton::StemEnum stem);
+
+UNumberGroupingStrategy groupingStrategy(skeleton::StemEnum stem);
+
+UNumberUnitWidth unitWidth(skeleton::StemEnum stem);
+
+UNumberSignDisplay signDisplay(skeleton::StemEnum stem);
+
+UNumberDecimalSeparatorDisplay decimalSeparatorDisplay(skeleton::StemEnum stem);
+
+} // namespace stem_to_object
+
+/**
+ * Namespace for utility methods that convert from enums to stem strings. More complex object conversions
+ * take place in the object_to_stem_string namespace.
+ */
+namespace enum_to_stem_string {
+
+void roundingMode(UNumberFormatRoundingMode value, UnicodeString& sb);
+
+void groupingStrategy(UNumberGroupingStrategy value, UnicodeString& sb);
+
+void unitWidth(UNumberUnitWidth value, UnicodeString& sb);
+
+void signDisplay(UNumberSignDisplay value, UnicodeString& sb);
+
+void decimalSeparatorDisplay(UNumberDecimalSeparatorDisplay value, UnicodeString& sb);
+
+} // namespace enum_to_stem_string
+
+/**
+ * Namespace for utility methods for processing stems and options that cannot be interpreted literally.
+ */
+namespace blueprint_helpers {
+
+/** @return Whether we successfully found and parsed an exponent width option. */
+bool parseExponentWidthOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
+
+void generateExponentWidthOption(int32_t minExponentDigits, UnicodeString& sb, UErrorCode& status);
+
+/** @return Whether we successfully found and parsed an exponent sign option. */
+bool parseExponentSignOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
+
+void parseCurrencyOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
+
+void generateCurrencyOption(const CurrencyUnit& currency, UnicodeString& sb, UErrorCode& status);
+
+void parseMeasureUnitOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
+
+void generateMeasureUnitOption(const MeasureUnit& measureUnit, UnicodeString& sb, UErrorCode& status);
+
+void parseMeasurePerUnitOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
+
+void parseIdentifierUnitOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
+
+void parseFractionStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
+
+void generateFractionStem(int32_t minFrac, int32_t maxFrac, UnicodeString& sb, UErrorCode& status);
+
+void parseDigitsStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
+
+void generateDigitsStem(int32_t minSig, int32_t maxSig, UnicodeString& sb, UErrorCode& status);
+
+void parseScientificStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
+
+// Note: no generateScientificStem since this syntax was added later in ICU 67
+
+void parseIntegerStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
+
+// Note: no generateIntegerStem since this syntax was added later in ICU 67
+
+/** @return Whether we successfully found and parsed a frac-sig option. */
+bool parseFracSigOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
+
+void parseIncrementOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
+
+void
+generateIncrementOption(double increment, int32_t trailingZeros, UnicodeString& sb, UErrorCode& status);
+
+void parseIntegerWidthOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
+
+void generateIntegerWidthOption(int32_t minInt, int32_t maxInt, UnicodeString& sb, UErrorCode& status);
+
+void parseNumberingSystemOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
+
+void generateNumberingSystemOption(const NumberingSystem& ns, UnicodeString& sb, UErrorCode& status);
+
+void parseScaleOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status);
+
+void generateScaleOption(int32_t magnitude, const DecNum* arbitrary, UnicodeString& sb,
+ UErrorCode& status);
+
+} // namespace blueprint_helpers
+
+/**
+ * Class for utility methods for generating a token corresponding to each macro-prop. Each method
+ * returns whether or not a token was written to the string builder.
+ *
+ * This needs to be a class, not a namespace, so it can be friended.
+ */
+class GeneratorHelpers {
+ public:
+ /**
+ * Main skeleton generator function. Appends the normalized skeleton for the MacroProps to the given
+ * StringBuilder.
+ *
+ * Internal: use the create() endpoint instead of this function.
+ */
+ static void generateSkeleton(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
+
+ private:
+ static bool notation(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
+
+ static bool unit(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
+
+ static bool perUnit(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
+
+ static bool precision(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
+
+ static bool roundingMode(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
+
+ static bool grouping(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
+
+ static bool integerWidth(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
+
+ static bool symbols(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
+
+ static bool unitWidth(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
+
+ static bool sign(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
+
+ static bool decimal(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
+
+ static bool scale(const MacroProps& macros, UnicodeString& sb, UErrorCode& status);
+
+};
+
+/**
+ * Struct for null-checking.
+ * In Java, we can just check the object reference. In C++, we need a different method.
+ */
+struct SeenMacroProps {
+ bool notation = false;
+ bool unit = false;
+ bool perUnit = false;
+ bool precision = false;
+ bool roundingMode = false;
+ bool grouper = false;
+ bool padder = false;
+ bool integerWidth = false;
+ bool symbols = false;
+ bool unitWidth = false;
+ bool sign = false;
+ bool decimal = false;
+ bool scale = false;
+};
+
+} // namespace impl
+} // namespace number
+U_NAMESPACE_END
+
+#endif //__SOURCE_NUMBER_SKELETONS_H__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_types.h b/contrib/libs/icu/i18n/number_types.h
index fe109538a3..5c2b8cf8b5 100644
--- a/contrib/libs/icu/i18n/number_types.h
+++ b/contrib/libs/icu/i18n/number_types.h
@@ -1,366 +1,366 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMBER_TYPES_H__
-#define __NUMBER_TYPES_H__
-
-#include <cstdint>
-#include "unicode/decimfmt.h"
-#include "unicode/unum.h"
-#include "unicode/numsys.h"
-#include "unicode/numberformatter.h"
-#include "unicode/utf16.h"
-#include "uassert.h"
-#include "unicode/platform.h"
-#include "unicode/uniset.h"
-#include "standardplural.h"
-#include "formatted_string_builder.h"
-
-U_NAMESPACE_BEGIN
-namespace number {
-namespace impl {
-
-// For convenience and historical reasons, import the Field typedef to the namespace.
-typedef FormattedStringBuilder::Field Field;
-
-// Typedef several enums for brevity and for easier comparison to Java.
-
-typedef UNumberFormatRoundingMode RoundingMode;
-
-typedef UNumberFormatPadPosition PadPosition;
-
-typedef UNumberCompactStyle CompactStyle;
-
-// ICU4J Equivalent: RoundingUtils.MAX_INT_FRAC_SIG
-static constexpr int32_t kMaxIntFracSig = 999;
-
-// ICU4J Equivalent: RoundingUtils.DEFAULT_ROUNDING_MODE
-static constexpr RoundingMode kDefaultMode = RoundingMode::UNUM_FOUND_HALFEVEN;
-
-// ICU4J Equivalent: Padder.FALLBACK_PADDING_STRING
-static constexpr char16_t kFallbackPaddingString[] = u" ";
-
-// Forward declarations:
-
-class Modifier;
-class MutablePatternModifier;
-class DecimalQuantity;
-class ModifierStore;
-struct MicroProps;
-
-
-enum AffixPatternType {
- // Represents a literal character; the value is stored in the code point field.
- TYPE_CODEPOINT = 0,
-
- // Represents a minus sign symbol '-'.
- TYPE_MINUS_SIGN = -1,
-
- // Represents a plus sign symbol '+'.
- TYPE_PLUS_SIGN = -2,
-
- // Represents a percent sign symbol '%'.
- TYPE_PERCENT = -3,
-
- // Represents a permille sign symbol '‰'.
- TYPE_PERMILLE = -4,
-
- // Represents a single currency symbol '¤'.
- TYPE_CURRENCY_SINGLE = -5,
-
- // Represents a double currency symbol '¤¤'.
- TYPE_CURRENCY_DOUBLE = -6,
-
- // Represents a triple currency symbol '¤¤¤'.
- TYPE_CURRENCY_TRIPLE = -7,
-
- // Represents a quadruple currency symbol '¤¤¤¤'.
- TYPE_CURRENCY_QUAD = -8,
-
- // Represents a quintuple currency symbol '¤¤¤¤¤'.
- TYPE_CURRENCY_QUINT = -9,
-
- // Represents a sequence of six or more currency symbols.
- TYPE_CURRENCY_OVERFLOW = -15
-};
-
-enum CompactType {
- TYPE_DECIMAL, TYPE_CURRENCY
-};
-
-enum Signum {
- SIGNUM_NEG = 0,
- SIGNUM_NEG_ZERO = 1,
- SIGNUM_POS_ZERO = 2,
- SIGNUM_POS = 3,
- SIGNUM_COUNT = 4,
-};
-
-
-class U_I18N_API AffixPatternProvider {
- public:
- static const int32_t AFFIX_PLURAL_MASK = 0xff;
- static const int32_t AFFIX_PREFIX = 0x100;
- static const int32_t AFFIX_NEGATIVE_SUBPATTERN = 0x200;
- static const int32_t AFFIX_PADDING = 0x400;
-
- // Convenience compound flags
- static const int32_t AFFIX_POS_PREFIX = AFFIX_PREFIX;
- static const int32_t AFFIX_POS_SUFFIX = 0;
- static const int32_t AFFIX_NEG_PREFIX = AFFIX_PREFIX | AFFIX_NEGATIVE_SUBPATTERN;
- static const int32_t AFFIX_NEG_SUFFIX = AFFIX_NEGATIVE_SUBPATTERN;
-
- virtual ~AffixPatternProvider();
-
- virtual char16_t charAt(int flags, int i) const = 0;
-
- virtual int length(int flags) const = 0;
-
- virtual UnicodeString getString(int flags) const = 0;
-
- virtual bool hasCurrencySign() const = 0;
-
- virtual bool positiveHasPlusSign() const = 0;
-
- virtual bool hasNegativeSubpattern() const = 0;
-
- virtual bool negativeHasMinusSign() const = 0;
-
- virtual bool containsSymbolType(AffixPatternType, UErrorCode&) const = 0;
-
- /**
- * True if the pattern has a number placeholder like "0" or "#,##0.00"; false if the pattern does not
- * have one. This is used in cases like compact notation, where the pattern replaces the entire
- * number instead of rendering the number.
- */
- virtual bool hasBody() const = 0;
-};
-
-
-/**
- * A Modifier is an object that can be passed through the formatting pipeline until it is finally applied to the string
- * builder. A Modifier usually contains a prefix and a suffix that are applied, but it could contain something else,
- * like a {@link com.ibm.icu.text.SimpleFormatter} pattern.
- *
- * A Modifier is usually immutable, except in cases such as {@link MutablePatternModifier}, which are mutable for performance
- * reasons.
- *
- * Exported as U_I18N_API because it is a base class for other exported types
- */
-class U_I18N_API Modifier {
- public:
- virtual ~Modifier();
-
- /**
- * Apply this Modifier to the string builder.
- *
- * @param output
- * The string builder to which to apply this modifier.
- * @param leftIndex
- * The left index of the string within the builder. Equal to 0 when only one number is being formatted.
- * @param rightIndex
- * The right index of the string within the string builder. Equal to length when only one number is being
- * formatted.
- * @return The number of characters (UTF-16 code units) that were added to the string builder.
- */
- virtual int32_t apply(FormattedStringBuilder& output, int leftIndex, int rightIndex,
- UErrorCode& status) const = 0;
-
- /**
- * Gets the length of the prefix. This information can be used in combination with {@link #apply} to extract the
- * prefix and suffix strings.
- *
- * @return The number of characters (UTF-16 code units) in the prefix.
- */
- virtual int32_t getPrefixLength() const = 0;
-
- /**
- * Returns the number of code points in the modifier, prefix plus suffix.
- */
- virtual int32_t getCodePointCount() const = 0;
-
- /**
- * Whether this modifier is strong. If a modifier is strong, it should always be applied immediately and not allowed
- * to bubble up. With regard to padding, strong modifiers are considered to be on the inside of the prefix and
- * suffix.
- *
- * @return Whether the modifier is strong.
- */
- virtual bool isStrong() const = 0;
-
- /**
- * Whether the modifier contains at least one occurrence of the given field.
- */
- virtual bool containsField(Field field) const = 0;
-
- /**
- * A fill-in for getParameters(). obj will always be set; if non-null, the other
- * two fields are also safe to read.
- */
- struct U_I18N_API Parameters {
- const ModifierStore* obj = nullptr;
- Signum signum;
- StandardPlural::Form plural;
-
- Parameters();
- Parameters(const ModifierStore* _obj, Signum _signum, StandardPlural::Form _plural);
- };
-
- /**
- * Gets a set of "parameters" for this Modifier.
- *
- * TODO: Make this return a `const Parameters*` more like Java?
- */
- virtual void getParameters(Parameters& output) const = 0;
-
- /**
- * Returns whether this Modifier is *semantically equivalent* to the other Modifier;
- * in many cases, this is the same as equal, but parameters should be ignored.
- */
- virtual bool semanticallyEquivalent(const Modifier& other) const = 0;
-};
-
-
-/**
- * This is *not* a modifier; rather, it is an object that can return modifiers
- * based on given parameters.
- *
- * Exported as U_I18N_API because it is a base class for other exported types.
- */
-class U_I18N_API ModifierStore {
- public:
- virtual ~ModifierStore();
-
- /**
- * Returns a Modifier with the given parameters (best-effort).
- */
- virtual const Modifier* getModifier(Signum signum, StandardPlural::Form plural) const = 0;
-};
-
-
-/**
- * This interface is used when all number formatting settings, including the locale, are known, except for the quantity
- * itself. The {@link #processQuantity} method performs the final step in the number processing pipeline: it uses the
- * quantity to generate a finalized {@link MicroProps}, which can be used to render the number to output.
- *
- * <p>
- * In other words, this interface is used for the parts of number processing that are <em>quantity-dependent</em>.
- *
- * <p>
- * In order to allow for multiple different objects to all mutate the same MicroProps, a "chain" of MicroPropsGenerators
- * are linked together, and each one is responsible for manipulating a certain quantity-dependent part of the
- * MicroProps. At the tail of the linked list is a base instance of {@link MicroProps} with properties that are not
- * quantity-dependent. Each element in the linked list calls {@link #processQuantity} on its "parent", then does its
- * work, and then returns the result.
- *
- * Exported as U_I18N_API because it is a base class for other exported types
- *
- */
-class U_I18N_API MicroPropsGenerator {
- public:
- virtual ~MicroPropsGenerator();
-
- /**
- * Considers the given {@link DecimalQuantity}, optionally mutates it, and returns a {@link MicroProps}.
- *
- * @param quantity
- * The quantity for consideration and optional mutation.
- * @param micros
- * The MicroProps instance to populate.
- * @return A MicroProps instance resolved for the quantity.
- */
- virtual void processQuantity(DecimalQuantity& quantity, MicroProps& micros,
- UErrorCode& status) const = 0;
-};
-
-/**
- * An interface used by compact notation and scientific notation to choose a multiplier while rounding.
- */
-class MultiplierProducer {
- public:
- virtual ~MultiplierProducer();
-
- /**
- * Maps a magnitude to a multiplier in powers of ten. For example, in compact notation in English, a magnitude of 5
- * (e.g., 100,000) should return a multiplier of -3, since the number is displayed in thousands.
- *
- * @param magnitude
- * The power of ten of the input number.
- * @return The shift in powers of ten.
- */
- virtual int32_t getMultiplier(int32_t magnitude) const = 0;
-};
-
-// Exported as U_I18N_API because it is a public member field of exported DecimalFormatProperties
-template<typename T>
-class U_I18N_API NullableValue {
- public:
- NullableValue()
- : fNull(true) {}
-
- NullableValue(const NullableValue<T>& other) = default;
-
- explicit NullableValue(const T& other) {
- fValue = other;
- fNull = false;
- }
-
- NullableValue<T>& operator=(const NullableValue<T>& other) {
- fNull = other.fNull;
- if (!fNull) {
- fValue = other.fValue;
- }
- return *this;
- }
-
- NullableValue<T>& operator=(const T& other) {
- fValue = other;
- fNull = false;
- return *this;
- }
-
- bool operator==(const NullableValue& other) const {
- // "fValue == other.fValue" returns UBool, not bool (causes compiler warnings)
- return fNull ? other.fNull : (other.fNull ? false : static_cast<bool>(fValue == other.fValue));
- }
-
- void nullify() {
- // TODO: It might be nice to call the destructor here.
- fNull = true;
- }
-
- bool isNull() const {
- return fNull;
- }
-
- T get(UErrorCode& status) const {
- if (fNull) {
- status = U_UNDEFINED_VARIABLE;
- }
- return fValue;
- }
-
- T getNoError() const {
- return fValue;
- }
-
- T getOrDefault(T defaultValue) const {
- return fNull ? defaultValue : fValue;
- }
-
- private:
- bool fNull;
- T fValue;
-};
-
-
-} // namespace impl
-} // namespace number
-U_NAMESPACE_END
-
-#endif //__NUMBER_TYPES_H__
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMBER_TYPES_H__
+#define __NUMBER_TYPES_H__
+
+#include <cstdint>
+#include "unicode/decimfmt.h"
+#include "unicode/unum.h"
+#include "unicode/numsys.h"
+#include "unicode/numberformatter.h"
+#include "unicode/utf16.h"
+#include "uassert.h"
+#include "unicode/platform.h"
+#include "unicode/uniset.h"
+#include "standardplural.h"
+#include "formatted_string_builder.h"
+
+U_NAMESPACE_BEGIN
+namespace number {
+namespace impl {
+
+// For convenience and historical reasons, import the Field typedef to the namespace.
+typedef FormattedStringBuilder::Field Field;
+
+// Typedef several enums for brevity and for easier comparison to Java.
+
+typedef UNumberFormatRoundingMode RoundingMode;
+
+typedef UNumberFormatPadPosition PadPosition;
+
+typedef UNumberCompactStyle CompactStyle;
+
+// ICU4J Equivalent: RoundingUtils.MAX_INT_FRAC_SIG
+static constexpr int32_t kMaxIntFracSig = 999;
+
+// ICU4J Equivalent: RoundingUtils.DEFAULT_ROUNDING_MODE
+static constexpr RoundingMode kDefaultMode = RoundingMode::UNUM_FOUND_HALFEVEN;
+
+// ICU4J Equivalent: Padder.FALLBACK_PADDING_STRING
+static constexpr char16_t kFallbackPaddingString[] = u" ";
+
+// Forward declarations:
+
+class Modifier;
+class MutablePatternModifier;
+class DecimalQuantity;
+class ModifierStore;
+struct MicroProps;
+
+
+enum AffixPatternType {
+ // Represents a literal character; the value is stored in the code point field.
+ TYPE_CODEPOINT = 0,
+
+ // Represents a minus sign symbol '-'.
+ TYPE_MINUS_SIGN = -1,
+
+ // Represents a plus sign symbol '+'.
+ TYPE_PLUS_SIGN = -2,
+
+ // Represents a percent sign symbol '%'.
+ TYPE_PERCENT = -3,
+
+ // Represents a permille sign symbol '‰'.
+ TYPE_PERMILLE = -4,
+
+ // Represents a single currency symbol '¤'.
+ TYPE_CURRENCY_SINGLE = -5,
+
+ // Represents a double currency symbol '¤¤'.
+ TYPE_CURRENCY_DOUBLE = -6,
+
+ // Represents a triple currency symbol '¤¤¤'.
+ TYPE_CURRENCY_TRIPLE = -7,
+
+ // Represents a quadruple currency symbol '¤¤¤¤'.
+ TYPE_CURRENCY_QUAD = -8,
+
+ // Represents a quintuple currency symbol '¤¤¤¤¤'.
+ TYPE_CURRENCY_QUINT = -9,
+
+ // Represents a sequence of six or more currency symbols.
+ TYPE_CURRENCY_OVERFLOW = -15
+};
+
+enum CompactType {
+ TYPE_DECIMAL, TYPE_CURRENCY
+};
+
+enum Signum {
+ SIGNUM_NEG = 0,
+ SIGNUM_NEG_ZERO = 1,
+ SIGNUM_POS_ZERO = 2,
+ SIGNUM_POS = 3,
+ SIGNUM_COUNT = 4,
+};
+
+
+class U_I18N_API AffixPatternProvider {
+ public:
+ static const int32_t AFFIX_PLURAL_MASK = 0xff;
+ static const int32_t AFFIX_PREFIX = 0x100;
+ static const int32_t AFFIX_NEGATIVE_SUBPATTERN = 0x200;
+ static const int32_t AFFIX_PADDING = 0x400;
+
+ // Convenience compound flags
+ static const int32_t AFFIX_POS_PREFIX = AFFIX_PREFIX;
+ static const int32_t AFFIX_POS_SUFFIX = 0;
+ static const int32_t AFFIX_NEG_PREFIX = AFFIX_PREFIX | AFFIX_NEGATIVE_SUBPATTERN;
+ static const int32_t AFFIX_NEG_SUFFIX = AFFIX_NEGATIVE_SUBPATTERN;
+
+ virtual ~AffixPatternProvider();
+
+ virtual char16_t charAt(int flags, int i) const = 0;
+
+ virtual int length(int flags) const = 0;
+
+ virtual UnicodeString getString(int flags) const = 0;
+
+ virtual bool hasCurrencySign() const = 0;
+
+ virtual bool positiveHasPlusSign() const = 0;
+
+ virtual bool hasNegativeSubpattern() const = 0;
+
+ virtual bool negativeHasMinusSign() const = 0;
+
+ virtual bool containsSymbolType(AffixPatternType, UErrorCode&) const = 0;
+
+ /**
+ * True if the pattern has a number placeholder like "0" or "#,##0.00"; false if the pattern does not
+ * have one. This is used in cases like compact notation, where the pattern replaces the entire
+ * number instead of rendering the number.
+ */
+ virtual bool hasBody() const = 0;
+};
+
+
+/**
+ * A Modifier is an object that can be passed through the formatting pipeline until it is finally applied to the string
+ * builder. A Modifier usually contains a prefix and a suffix that are applied, but it could contain something else,
+ * like a {@link com.ibm.icu.text.SimpleFormatter} pattern.
+ *
+ * A Modifier is usually immutable, except in cases such as {@link MutablePatternModifier}, which are mutable for performance
+ * reasons.
+ *
+ * Exported as U_I18N_API because it is a base class for other exported types
+ */
+class U_I18N_API Modifier {
+ public:
+ virtual ~Modifier();
+
+ /**
+ * Apply this Modifier to the string builder.
+ *
+ * @param output
+ * The string builder to which to apply this modifier.
+ * @param leftIndex
+ * The left index of the string within the builder. Equal to 0 when only one number is being formatted.
+ * @param rightIndex
+ * The right index of the string within the string builder. Equal to length when only one number is being
+ * formatted.
+ * @return The number of characters (UTF-16 code units) that were added to the string builder.
+ */
+ virtual int32_t apply(FormattedStringBuilder& output, int leftIndex, int rightIndex,
+ UErrorCode& status) const = 0;
+
+ /**
+ * Gets the length of the prefix. This information can be used in combination with {@link #apply} to extract the
+ * prefix and suffix strings.
+ *
+ * @return The number of characters (UTF-16 code units) in the prefix.
+ */
+ virtual int32_t getPrefixLength() const = 0;
+
+ /**
+ * Returns the number of code points in the modifier, prefix plus suffix.
+ */
+ virtual int32_t getCodePointCount() const = 0;
+
+ /**
+ * Whether this modifier is strong. If a modifier is strong, it should always be applied immediately and not allowed
+ * to bubble up. With regard to padding, strong modifiers are considered to be on the inside of the prefix and
+ * suffix.
+ *
+ * @return Whether the modifier is strong.
+ */
+ virtual bool isStrong() const = 0;
+
+ /**
+ * Whether the modifier contains at least one occurrence of the given field.
+ */
+ virtual bool containsField(Field field) const = 0;
+
+ /**
+ * A fill-in for getParameters(). obj will always be set; if non-null, the other
+ * two fields are also safe to read.
+ */
+ struct U_I18N_API Parameters {
+ const ModifierStore* obj = nullptr;
+ Signum signum;
+ StandardPlural::Form plural;
+
+ Parameters();
+ Parameters(const ModifierStore* _obj, Signum _signum, StandardPlural::Form _plural);
+ };
+
+ /**
+ * Gets a set of "parameters" for this Modifier.
+ *
+ * TODO: Make this return a `const Parameters*` more like Java?
+ */
+ virtual void getParameters(Parameters& output) const = 0;
+
+ /**
+ * Returns whether this Modifier is *semantically equivalent* to the other Modifier;
+ * in many cases, this is the same as equal, but parameters should be ignored.
+ */
+ virtual bool semanticallyEquivalent(const Modifier& other) const = 0;
+};
+
+
+/**
+ * This is *not* a modifier; rather, it is an object that can return modifiers
+ * based on given parameters.
+ *
+ * Exported as U_I18N_API because it is a base class for other exported types.
+ */
+class U_I18N_API ModifierStore {
+ public:
+ virtual ~ModifierStore();
+
+ /**
+ * Returns a Modifier with the given parameters (best-effort).
+ */
+ virtual const Modifier* getModifier(Signum signum, StandardPlural::Form plural) const = 0;
+};
+
+
+/**
+ * This interface is used when all number formatting settings, including the locale, are known, except for the quantity
+ * itself. The {@link #processQuantity} method performs the final step in the number processing pipeline: it uses the
+ * quantity to generate a finalized {@link MicroProps}, which can be used to render the number to output.
+ *
+ * <p>
+ * In other words, this interface is used for the parts of number processing that are <em>quantity-dependent</em>.
+ *
+ * <p>
+ * In order to allow for multiple different objects to all mutate the same MicroProps, a "chain" of MicroPropsGenerators
+ * are linked together, and each one is responsible for manipulating a certain quantity-dependent part of the
+ * MicroProps. At the tail of the linked list is a base instance of {@link MicroProps} with properties that are not
+ * quantity-dependent. Each element in the linked list calls {@link #processQuantity} on its "parent", then does its
+ * work, and then returns the result.
+ *
+ * Exported as U_I18N_API because it is a base class for other exported types
+ *
+ */
+class U_I18N_API MicroPropsGenerator {
+ public:
+ virtual ~MicroPropsGenerator();
+
+ /**
+ * Considers the given {@link DecimalQuantity}, optionally mutates it, and returns a {@link MicroProps}.
+ *
+ * @param quantity
+ * The quantity for consideration and optional mutation.
+ * @param micros
+ * The MicroProps instance to populate.
+ * @return A MicroProps instance resolved for the quantity.
+ */
+ virtual void processQuantity(DecimalQuantity& quantity, MicroProps& micros,
+ UErrorCode& status) const = 0;
+};
+
+/**
+ * An interface used by compact notation and scientific notation to choose a multiplier while rounding.
+ */
+class MultiplierProducer {
+ public:
+ virtual ~MultiplierProducer();
+
+ /**
+ * Maps a magnitude to a multiplier in powers of ten. For example, in compact notation in English, a magnitude of 5
+ * (e.g., 100,000) should return a multiplier of -3, since the number is displayed in thousands.
+ *
+ * @param magnitude
+ * The power of ten of the input number.
+ * @return The shift in powers of ten.
+ */
+ virtual int32_t getMultiplier(int32_t magnitude) const = 0;
+};
+
+// Exported as U_I18N_API because it is a public member field of exported DecimalFormatProperties
+template<typename T>
+class U_I18N_API NullableValue {
+ public:
+ NullableValue()
+ : fNull(true) {}
+
+ NullableValue(const NullableValue<T>& other) = default;
+
+ explicit NullableValue(const T& other) {
+ fValue = other;
+ fNull = false;
+ }
+
+ NullableValue<T>& operator=(const NullableValue<T>& other) {
+ fNull = other.fNull;
+ if (!fNull) {
+ fValue = other.fValue;
+ }
+ return *this;
+ }
+
+ NullableValue<T>& operator=(const T& other) {
+ fValue = other;
+ fNull = false;
+ return *this;
+ }
+
+ bool operator==(const NullableValue& other) const {
+ // "fValue == other.fValue" returns UBool, not bool (causes compiler warnings)
+ return fNull ? other.fNull : (other.fNull ? false : static_cast<bool>(fValue == other.fValue));
+ }
+
+ void nullify() {
+ // TODO: It might be nice to call the destructor here.
+ fNull = true;
+ }
+
+ bool isNull() const {
+ return fNull;
+ }
+
+ T get(UErrorCode& status) const {
+ if (fNull) {
+ status = U_UNDEFINED_VARIABLE;
+ }
+ return fValue;
+ }
+
+ T getNoError() const {
+ return fValue;
+ }
+
+ T getOrDefault(T defaultValue) const {
+ return fNull ? defaultValue : fValue;
+ }
+
+ private:
+ bool fNull;
+ T fValue;
+};
+
+
+} // namespace impl
+} // namespace number
+U_NAMESPACE_END
+
+#endif //__NUMBER_TYPES_H__
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_utils.cpp b/contrib/libs/icu/i18n/number_utils.cpp
index 326e646232..91d7f335cd 100644
--- a/contrib/libs/icu/i18n/number_utils.cpp
+++ b/contrib/libs/icu/i18n/number_utils.cpp
@@ -1,266 +1,266 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include <stdlib.h>
-#include <cmath>
-#include "number_decnum.h"
-#include "number_types.h"
-#include "number_utils.h"
-#include "charstr.h"
-#include "decContext.h"
-#include "decNumber.h"
-#include "double-conversion.h"
-#include "fphdlimp.h"
-#include "uresimp.h"
-#include "ureslocs.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-using icu::double_conversion::DoubleToStringConverter;
-
-
-namespace {
-
-const char16_t*
-doGetPattern(UResourceBundle* res, const char* nsName, const char* patternKey, UErrorCode& publicStatus,
- UErrorCode& localStatus) {
- // Construct the path into the resource bundle
- CharString key;
- key.append("NumberElements/", publicStatus);
- key.append(nsName, publicStatus);
- key.append("/patterns/", publicStatus);
- key.append(patternKey, publicStatus);
- if (U_FAILURE(publicStatus)) {
- return u"";
- }
- return ures_getStringByKeyWithFallback(res, key.data(), nullptr, &localStatus);
-}
-
-}
-
-
-const char16_t* utils::getPatternForStyle(const Locale& locale, const char* nsName, CldrPatternStyle style,
- UErrorCode& status) {
- const char* patternKey;
- switch (style) {
- case CLDR_PATTERN_STYLE_DECIMAL:
- patternKey = "decimalFormat";
- break;
- case CLDR_PATTERN_STYLE_CURRENCY:
- patternKey = "currencyFormat";
- break;
- case CLDR_PATTERN_STYLE_ACCOUNTING:
- patternKey = "accountingFormat";
- break;
- case CLDR_PATTERN_STYLE_PERCENT:
- patternKey = "percentFormat";
- break;
- case CLDR_PATTERN_STYLE_SCIENTIFIC:
- patternKey = "scientificFormat";
- break;
- default:
- patternKey = "decimalFormat"; // silence compiler error
- UPRV_UNREACHABLE;
- }
- LocalUResourceBundlePointer res(ures_open(nullptr, locale.getName(), &status));
- if (U_FAILURE(status)) { return u""; }
-
- // Attempt to get the pattern with the native numbering system.
- UErrorCode localStatus = U_ZERO_ERROR;
- const char16_t* pattern;
- pattern = doGetPattern(res.getAlias(), nsName, patternKey, status, localStatus);
- if (U_FAILURE(status)) { return u""; }
-
- // Fall back to latn if native numbering system does not have the right pattern
- if (U_FAILURE(localStatus) && uprv_strcmp("latn", nsName) != 0) {
- localStatus = U_ZERO_ERROR;
- pattern = doGetPattern(res.getAlias(), "latn", patternKey, status, localStatus);
- if (U_FAILURE(status)) { return u""; }
- }
-
- return pattern;
-}
-
-
-DecNum::DecNum() {
- uprv_decContextDefault(&fContext, DEC_INIT_BASE);
- uprv_decContextSetRounding(&fContext, DEC_ROUND_HALF_EVEN);
- fContext.traps = 0; // no traps, thank you (what does this even mean?)
-}
-
-DecNum::DecNum(const DecNum& other, UErrorCode& status)
- : fContext(other.fContext) {
- // Allocate memory for the new DecNum.
- U_ASSERT(fContext.digits == other.fData.getCapacity());
- if (fContext.digits > kDefaultDigits) {
- void* p = fData.resize(fContext.digits, 0);
- if (p == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- }
-
- // Copy the data from the old DecNum to the new one.
- uprv_memcpy(fData.getAlias(), other.fData.getAlias(), sizeof(decNumber));
- uprv_memcpy(fData.getArrayStart(),
- other.fData.getArrayStart(),
- other.fData.getArrayLimit() - other.fData.getArrayStart());
-}
-
-void DecNum::setTo(StringPiece str, UErrorCode& status) {
- // We need NUL-terminated for decNumber; CharString guarantees this, but not StringPiece.
- CharString cstr(str, status);
- if (U_FAILURE(status)) { return; }
- _setTo(cstr.data(), str.length(), status);
-}
-
-void DecNum::setTo(const char* str, UErrorCode& status) {
- _setTo(str, static_cast<int32_t>(uprv_strlen(str)), status);
-}
-
-void DecNum::setTo(double d, UErrorCode& status) {
- // Need to check for NaN and Infinity before going into DoubleToStringConverter
- if (std::isnan(d) != 0 || std::isfinite(d) == 0) {
- status = U_UNSUPPORTED_ERROR;
- return;
- }
-
- // First convert from double to string, then string to DecNum.
- // Allocate enough room for: all digits, "E-324", and NUL-terminator.
- char buffer[DoubleToStringConverter::kBase10MaximalLength + 6];
- bool sign; // unused; always positive
- int32_t length;
- int32_t point;
- DoubleToStringConverter::DoubleToAscii(
- d,
- DoubleToStringConverter::DtoaMode::SHORTEST,
- 0,
- buffer,
- sizeof(buffer),
- &sign,
- &length,
- &point
- );
-
- // Read initial result as a string.
- _setTo(buffer, length, status);
-
- // Set exponent and bitmask. Note that DoubleToStringConverter does not do negatives.
- fData.getAlias()->exponent += point - length;
- fData.getAlias()->bits |= static_cast<uint8_t>(std::signbit(d) ? DECNEG : 0);
-}
-
-void DecNum::_setTo(const char* str, int32_t maxDigits, UErrorCode& status) {
- if (maxDigits > kDefaultDigits) {
- fData.resize(maxDigits, 0);
- fContext.digits = maxDigits;
- } else {
- fContext.digits = kDefaultDigits;
- }
-
- static_assert(DECDPUN == 1, "Assumes that DECDPUN is set to 1");
- uprv_decNumberFromString(fData.getAlias(), str, &fContext);
-
- // Check for invalid syntax and set the corresponding error code.
- if ((fContext.status & DEC_Conversion_syntax) != 0) {
- status = U_DECIMAL_NUMBER_SYNTAX_ERROR;
- return;
- } else if (fContext.status != 0) {
- // Not a syntax error, but some other error, like an exponent that is too large.
- status = U_UNSUPPORTED_ERROR;
- return;
- }
-
- // For consistency with Java BigDecimal, no support for DecNum that is NaN or Infinity!
- if (decNumberIsSpecial(fData.getAlias())) {
- status = U_UNSUPPORTED_ERROR;
- return;
- }
-}
-
-void
-DecNum::setTo(const uint8_t* bcd, int32_t length, int32_t scale, bool isNegative, UErrorCode& status) {
- if (length > kDefaultDigits) {
- fData.resize(length, 0);
- fContext.digits = length;
- } else {
- fContext.digits = kDefaultDigits;
- }
-
- // "digits is of type int32_t, and must have a value in the range 1 through 999,999,999."
- if (length < 1 || length > 999999999) {
- // Too large for decNumber
- status = U_UNSUPPORTED_ERROR;
- return;
- }
- // "The exponent field holds the exponent of the number. Its range is limited by the requirement that
- // "the range of the adjusted exponent of the number be balanced and fit within a whole number of
- // "decimal digits (in this implementation, be –999,999,999 through +999,999,999). The adjusted
- // "exponent is the exponent that would result if the number were expressed with a single digit before
- // "the decimal point, and is therefore given by exponent+digits-1."
- if (scale > 999999999 - length + 1 || scale < -999999999 - length + 1) {
- // Too large for decNumber
- status = U_UNSUPPORTED_ERROR;
- return;
- }
-
- fData.getAlias()->digits = length;
- fData.getAlias()->exponent = scale;
- fData.getAlias()->bits = static_cast<uint8_t>(isNegative ? DECNEG : 0);
- uprv_decNumberSetBCD(fData, bcd, static_cast<uint32_t>(length));
- if (fContext.status != 0) {
- // Some error occurred while constructing the decNumber.
- status = U_INTERNAL_PROGRAM_ERROR;
- }
-}
-
-void DecNum::normalize() {
- uprv_decNumberReduce(fData, fData, &fContext);
-}
-
-void DecNum::multiplyBy(const DecNum& rhs, UErrorCode& status) {
- uprv_decNumberMultiply(fData, fData, rhs.fData, &fContext);
- if (fContext.status != 0) {
- status = U_INTERNAL_PROGRAM_ERROR;
- }
-}
-
-void DecNum::divideBy(const DecNum& rhs, UErrorCode& status) {
- uprv_decNumberDivide(fData, fData, rhs.fData, &fContext);
- if ((fContext.status & DEC_Inexact) != 0) {
- // Ignore.
- } else if (fContext.status != 0) {
- status = U_INTERNAL_PROGRAM_ERROR;
- }
-}
-
-bool DecNum::isNegative() const {
- return decNumberIsNegative(fData.getAlias());
-}
-
-bool DecNum::isZero() const {
- return decNumberIsZero(fData.getAlias());
-}
-
-void DecNum::toString(ByteSink& output, UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return;
- }
- // "string must be at least dn->digits+14 characters long"
- int32_t minCapacity = fData.getAlias()->digits + 14;
- MaybeStackArray<char, 30> buffer(minCapacity);
- uprv_decNumberToString(fData, buffer.getAlias());
- output.Append(buffer.getAlias(), static_cast<int32_t>(uprv_strlen(buffer.getAlias())));
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include <stdlib.h>
+#include <cmath>
+#include "number_decnum.h"
+#include "number_types.h"
+#include "number_utils.h"
+#include "charstr.h"
+#include "decContext.h"
+#include "decNumber.h"
+#include "double-conversion.h"
+#include "fphdlimp.h"
+#include "uresimp.h"
+#include "ureslocs.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+using icu::double_conversion::DoubleToStringConverter;
+
+
+namespace {
+
+const char16_t*
+doGetPattern(UResourceBundle* res, const char* nsName, const char* patternKey, UErrorCode& publicStatus,
+ UErrorCode& localStatus) {
+ // Construct the path into the resource bundle
+ CharString key;
+ key.append("NumberElements/", publicStatus);
+ key.append(nsName, publicStatus);
+ key.append("/patterns/", publicStatus);
+ key.append(patternKey, publicStatus);
+ if (U_FAILURE(publicStatus)) {
+ return u"";
+ }
+ return ures_getStringByKeyWithFallback(res, key.data(), nullptr, &localStatus);
+}
+
+}
+
+
+const char16_t* utils::getPatternForStyle(const Locale& locale, const char* nsName, CldrPatternStyle style,
+ UErrorCode& status) {
+ const char* patternKey;
+ switch (style) {
+ case CLDR_PATTERN_STYLE_DECIMAL:
+ patternKey = "decimalFormat";
+ break;
+ case CLDR_PATTERN_STYLE_CURRENCY:
+ patternKey = "currencyFormat";
+ break;
+ case CLDR_PATTERN_STYLE_ACCOUNTING:
+ patternKey = "accountingFormat";
+ break;
+ case CLDR_PATTERN_STYLE_PERCENT:
+ patternKey = "percentFormat";
+ break;
+ case CLDR_PATTERN_STYLE_SCIENTIFIC:
+ patternKey = "scientificFormat";
+ break;
+ default:
+ patternKey = "decimalFormat"; // silence compiler error
+ UPRV_UNREACHABLE;
+ }
+ LocalUResourceBundlePointer res(ures_open(nullptr, locale.getName(), &status));
+ if (U_FAILURE(status)) { return u""; }
+
+ // Attempt to get the pattern with the native numbering system.
+ UErrorCode localStatus = U_ZERO_ERROR;
+ const char16_t* pattern;
+ pattern = doGetPattern(res.getAlias(), nsName, patternKey, status, localStatus);
+ if (U_FAILURE(status)) { return u""; }
+
+ // Fall back to latn if native numbering system does not have the right pattern
+ if (U_FAILURE(localStatus) && uprv_strcmp("latn", nsName) != 0) {
+ localStatus = U_ZERO_ERROR;
+ pattern = doGetPattern(res.getAlias(), "latn", patternKey, status, localStatus);
+ if (U_FAILURE(status)) { return u""; }
+ }
+
+ return pattern;
+}
+
+
+DecNum::DecNum() {
+ uprv_decContextDefault(&fContext, DEC_INIT_BASE);
+ uprv_decContextSetRounding(&fContext, DEC_ROUND_HALF_EVEN);
+ fContext.traps = 0; // no traps, thank you (what does this even mean?)
+}
+
+DecNum::DecNum(const DecNum& other, UErrorCode& status)
+ : fContext(other.fContext) {
+ // Allocate memory for the new DecNum.
+ U_ASSERT(fContext.digits == other.fData.getCapacity());
+ if (fContext.digits > kDefaultDigits) {
+ void* p = fData.resize(fContext.digits, 0);
+ if (p == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ }
+
+ // Copy the data from the old DecNum to the new one.
+ uprv_memcpy(fData.getAlias(), other.fData.getAlias(), sizeof(decNumber));
+ uprv_memcpy(fData.getArrayStart(),
+ other.fData.getArrayStart(),
+ other.fData.getArrayLimit() - other.fData.getArrayStart());
+}
+
+void DecNum::setTo(StringPiece str, UErrorCode& status) {
+ // We need NUL-terminated for decNumber; CharString guarantees this, but not StringPiece.
+ CharString cstr(str, status);
+ if (U_FAILURE(status)) { return; }
+ _setTo(cstr.data(), str.length(), status);
+}
+
+void DecNum::setTo(const char* str, UErrorCode& status) {
+ _setTo(str, static_cast<int32_t>(uprv_strlen(str)), status);
+}
+
+void DecNum::setTo(double d, UErrorCode& status) {
+ // Need to check for NaN and Infinity before going into DoubleToStringConverter
+ if (std::isnan(d) != 0 || std::isfinite(d) == 0) {
+ status = U_UNSUPPORTED_ERROR;
+ return;
+ }
+
+ // First convert from double to string, then string to DecNum.
+ // Allocate enough room for: all digits, "E-324", and NUL-terminator.
+ char buffer[DoubleToStringConverter::kBase10MaximalLength + 6];
+ bool sign; // unused; always positive
+ int32_t length;
+ int32_t point;
+ DoubleToStringConverter::DoubleToAscii(
+ d,
+ DoubleToStringConverter::DtoaMode::SHORTEST,
+ 0,
+ buffer,
+ sizeof(buffer),
+ &sign,
+ &length,
+ &point
+ );
+
+ // Read initial result as a string.
+ _setTo(buffer, length, status);
+
+ // Set exponent and bitmask. Note that DoubleToStringConverter does not do negatives.
+ fData.getAlias()->exponent += point - length;
+ fData.getAlias()->bits |= static_cast<uint8_t>(std::signbit(d) ? DECNEG : 0);
+}
+
+void DecNum::_setTo(const char* str, int32_t maxDigits, UErrorCode& status) {
+ if (maxDigits > kDefaultDigits) {
+ fData.resize(maxDigits, 0);
+ fContext.digits = maxDigits;
+ } else {
+ fContext.digits = kDefaultDigits;
+ }
+
+ static_assert(DECDPUN == 1, "Assumes that DECDPUN is set to 1");
+ uprv_decNumberFromString(fData.getAlias(), str, &fContext);
+
+ // Check for invalid syntax and set the corresponding error code.
+ if ((fContext.status & DEC_Conversion_syntax) != 0) {
+ status = U_DECIMAL_NUMBER_SYNTAX_ERROR;
+ return;
+ } else if (fContext.status != 0) {
+ // Not a syntax error, but some other error, like an exponent that is too large.
+ status = U_UNSUPPORTED_ERROR;
+ return;
+ }
+
+ // For consistency with Java BigDecimal, no support for DecNum that is NaN or Infinity!
+ if (decNumberIsSpecial(fData.getAlias())) {
+ status = U_UNSUPPORTED_ERROR;
+ return;
+ }
+}
+
+void
+DecNum::setTo(const uint8_t* bcd, int32_t length, int32_t scale, bool isNegative, UErrorCode& status) {
+ if (length > kDefaultDigits) {
+ fData.resize(length, 0);
+ fContext.digits = length;
+ } else {
+ fContext.digits = kDefaultDigits;
+ }
+
+ // "digits is of type int32_t, and must have a value in the range 1 through 999,999,999."
+ if (length < 1 || length > 999999999) {
+ // Too large for decNumber
+ status = U_UNSUPPORTED_ERROR;
+ return;
+ }
+ // "The exponent field holds the exponent of the number. Its range is limited by the requirement that
+ // "the range of the adjusted exponent of the number be balanced and fit within a whole number of
+ // "decimal digits (in this implementation, be –999,999,999 through +999,999,999). The adjusted
+ // "exponent is the exponent that would result if the number were expressed with a single digit before
+ // "the decimal point, and is therefore given by exponent+digits-1."
+ if (scale > 999999999 - length + 1 || scale < -999999999 - length + 1) {
+ // Too large for decNumber
+ status = U_UNSUPPORTED_ERROR;
+ return;
+ }
+
+ fData.getAlias()->digits = length;
+ fData.getAlias()->exponent = scale;
+ fData.getAlias()->bits = static_cast<uint8_t>(isNegative ? DECNEG : 0);
+ uprv_decNumberSetBCD(fData, bcd, static_cast<uint32_t>(length));
+ if (fContext.status != 0) {
+ // Some error occurred while constructing the decNumber.
+ status = U_INTERNAL_PROGRAM_ERROR;
+ }
+}
+
+void DecNum::normalize() {
+ uprv_decNumberReduce(fData, fData, &fContext);
+}
+
+void DecNum::multiplyBy(const DecNum& rhs, UErrorCode& status) {
+ uprv_decNumberMultiply(fData, fData, rhs.fData, &fContext);
+ if (fContext.status != 0) {
+ status = U_INTERNAL_PROGRAM_ERROR;
+ }
+}
+
+void DecNum::divideBy(const DecNum& rhs, UErrorCode& status) {
+ uprv_decNumberDivide(fData, fData, rhs.fData, &fContext);
+ if ((fContext.status & DEC_Inexact) != 0) {
+ // Ignore.
+ } else if (fContext.status != 0) {
+ status = U_INTERNAL_PROGRAM_ERROR;
+ }
+}
+
+bool DecNum::isNegative() const {
+ return decNumberIsNegative(fData.getAlias());
+}
+
+bool DecNum::isZero() const {
+ return decNumberIsZero(fData.getAlias());
+}
+
+void DecNum::toString(ByteSink& output, UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return;
+ }
+ // "string must be at least dn->digits+14 characters long"
+ int32_t minCapacity = fData.getAlias()->digits + 14;
+ MaybeStackArray<char, 30> buffer(minCapacity);
+ uprv_decNumberToString(fData, buffer.getAlias());
+ output.Append(buffer.getAlias(), static_cast<int32_t>(uprv_strlen(buffer.getAlias())));
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_utils.h b/contrib/libs/icu/i18n/number_utils.h
index 4f302df86d..93195f080b 100644
--- a/contrib/libs/icu/i18n/number_utils.h
+++ b/contrib/libs/icu/i18n/number_utils.h
@@ -1,112 +1,112 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMBER_UTILS_H__
-#define __NUMBER_UTILS_H__
-
-#include "unicode/numberformatter.h"
-#include "number_types.h"
-#include "number_decimalquantity.h"
-#include "number_scientific.h"
-#include "number_patternstring.h"
-#include "number_modifiers.h"
-#include "number_multiplier.h"
-#include "number_roundingutils.h"
-#include "decNumber.h"
-#include "charstr.h"
-#include "formatted_string_builder.h"
-
-U_NAMESPACE_BEGIN
-
-namespace number {
-namespace impl {
-
-enum CldrPatternStyle {
- CLDR_PATTERN_STYLE_DECIMAL,
- CLDR_PATTERN_STYLE_CURRENCY,
- CLDR_PATTERN_STYLE_ACCOUNTING,
- CLDR_PATTERN_STYLE_PERCENT,
- CLDR_PATTERN_STYLE_SCIENTIFIC,
- CLDR_PATTERN_STYLE_COUNT,
-};
-
-// Namespace for naked functions
-namespace utils {
-
-inline int32_t insertDigitFromSymbols(FormattedStringBuilder& output, int32_t index, int8_t digit,
- const DecimalFormatSymbols& symbols, Field field,
- UErrorCode& status) {
- if (symbols.getCodePointZero() != -1) {
- return output.insertCodePoint(index, symbols.getCodePointZero() + digit, field, status);
- }
- return output.insert(index, symbols.getConstDigitSymbol(digit), field, status);
-}
-
-inline bool unitIsCurrency(const MeasureUnit& unit) {
- return uprv_strcmp("currency", unit.getType()) == 0;
-}
-
-inline bool unitIsNoUnit(const MeasureUnit& unit) {
- return uprv_strcmp("none", unit.getType()) == 0;
-}
-
-inline bool unitIsPercent(const MeasureUnit& unit) {
- return uprv_strcmp("percent", unit.getSubtype()) == 0;
-}
-
-inline bool unitIsPermille(const MeasureUnit& unit) {
- return uprv_strcmp("permille", unit.getSubtype()) == 0;
-}
-
-// NOTE: In Java, this method is in NumberFormat.java
-const char16_t*
-getPatternForStyle(const Locale& locale, const char* nsName, CldrPatternStyle style, UErrorCode& status);
-
-/**
- * Computes the plural form for this number based on the specified set of rules.
- *
- * @param rules A {@link PluralRules} object representing the set of rules.
- * @return The {@link StandardPlural} according to the PluralRules. If the plural form is not in
- * the set of standard plurals, {@link StandardPlural#OTHER} is returned instead.
- */
-inline StandardPlural::Form getStandardPlural(const PluralRules *rules,
- const IFixedDecimal &fdec) {
- if (rules == nullptr) {
- // Fail gracefully if the user didn't provide a PluralRules
- return StandardPlural::Form::OTHER;
- } else {
- UnicodeString ruleString = rules->select(fdec);
- return StandardPlural::orOtherFromString(ruleString);
- }
-}
-
-/**
- * Computes the plural form after copying the number and applying rounding rules.
- */
-inline StandardPlural::Form getPluralSafe(
- const RoundingImpl& rounder,
- const PluralRules* rules,
- const DecimalQuantity& dq,
- UErrorCode& status) {
- // TODO(ICU-20500): Avoid the copy?
- DecimalQuantity copy(dq);
- rounder.apply(copy, status);
- if (U_FAILURE(status)) {
- return StandardPlural::Form::OTHER;
- }
- return getStandardPlural(rules, copy);
-}
-
-} // namespace utils
-
-} // namespace impl
-} // namespace number
-
-U_NAMESPACE_END
-
-#endif //__NUMBER_UTILS_H__
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMBER_UTILS_H__
+#define __NUMBER_UTILS_H__
+
+#include "unicode/numberformatter.h"
+#include "number_types.h"
+#include "number_decimalquantity.h"
+#include "number_scientific.h"
+#include "number_patternstring.h"
+#include "number_modifiers.h"
+#include "number_multiplier.h"
+#include "number_roundingutils.h"
+#include "decNumber.h"
+#include "charstr.h"
+#include "formatted_string_builder.h"
+
+U_NAMESPACE_BEGIN
+
+namespace number {
+namespace impl {
+
+enum CldrPatternStyle {
+ CLDR_PATTERN_STYLE_DECIMAL,
+ CLDR_PATTERN_STYLE_CURRENCY,
+ CLDR_PATTERN_STYLE_ACCOUNTING,
+ CLDR_PATTERN_STYLE_PERCENT,
+ CLDR_PATTERN_STYLE_SCIENTIFIC,
+ CLDR_PATTERN_STYLE_COUNT,
+};
+
+// Namespace for naked functions
+namespace utils {
+
+inline int32_t insertDigitFromSymbols(FormattedStringBuilder& output, int32_t index, int8_t digit,
+ const DecimalFormatSymbols& symbols, Field field,
+ UErrorCode& status) {
+ if (symbols.getCodePointZero() != -1) {
+ return output.insertCodePoint(index, symbols.getCodePointZero() + digit, field, status);
+ }
+ return output.insert(index, symbols.getConstDigitSymbol(digit), field, status);
+}
+
+inline bool unitIsCurrency(const MeasureUnit& unit) {
+ return uprv_strcmp("currency", unit.getType()) == 0;
+}
+
+inline bool unitIsNoUnit(const MeasureUnit& unit) {
+ return uprv_strcmp("none", unit.getType()) == 0;
+}
+
+inline bool unitIsPercent(const MeasureUnit& unit) {
+ return uprv_strcmp("percent", unit.getSubtype()) == 0;
+}
+
+inline bool unitIsPermille(const MeasureUnit& unit) {
+ return uprv_strcmp("permille", unit.getSubtype()) == 0;
+}
+
+// NOTE: In Java, this method is in NumberFormat.java
+const char16_t*
+getPatternForStyle(const Locale& locale, const char* nsName, CldrPatternStyle style, UErrorCode& status);
+
+/**
+ * Computes the plural form for this number based on the specified set of rules.
+ *
+ * @param rules A {@link PluralRules} object representing the set of rules.
+ * @return The {@link StandardPlural} according to the PluralRules. If the plural form is not in
+ * the set of standard plurals, {@link StandardPlural#OTHER} is returned instead.
+ */
+inline StandardPlural::Form getStandardPlural(const PluralRules *rules,
+ const IFixedDecimal &fdec) {
+ if (rules == nullptr) {
+ // Fail gracefully if the user didn't provide a PluralRules
+ return StandardPlural::Form::OTHER;
+ } else {
+ UnicodeString ruleString = rules->select(fdec);
+ return StandardPlural::orOtherFromString(ruleString);
+ }
+}
+
+/**
+ * Computes the plural form after copying the number and applying rounding rules.
+ */
+inline StandardPlural::Form getPluralSafe(
+ const RoundingImpl& rounder,
+ const PluralRules* rules,
+ const DecimalQuantity& dq,
+ UErrorCode& status) {
+ // TODO(ICU-20500): Avoid the copy?
+ DecimalQuantity copy(dq);
+ rounder.apply(copy, status);
+ if (U_FAILURE(status)) {
+ return StandardPlural::Form::OTHER;
+ }
+ return getStandardPlural(rules, copy);
+}
+
+} // namespace utils
+
+} // namespace impl
+} // namespace number
+
+U_NAMESPACE_END
+
+#endif //__NUMBER_UTILS_H__
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/number_utypes.h b/contrib/libs/icu/i18n/number_utypes.h
index b1adb14c54..7a1b7a4e80 100644
--- a/contrib/libs/icu/i18n/number_utypes.h
+++ b/contrib/libs/icu/i18n/number_utypes.h
@@ -1,50 +1,50 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __SOURCE_NUMBER_UTYPES_H__
-#define __SOURCE_NUMBER_UTYPES_H__
-
-#include "unicode/numberformatter.h"
-#include "number_types.h"
-#include "number_decimalquantity.h"
-#include "formatted_string_builder.h"
-#include "formattedval_impl.h"
-
-U_NAMESPACE_BEGIN namespace number {
-namespace impl {
-
-
-/** Helper function used in upluralrules.cpp */
-const DecimalQuantity* validateUFormattedNumberToDecimalQuantity(
- const UFormattedNumber* uresult, UErrorCode& status);
-
-
-/**
- * Struct for data used by FormattedNumber.
- *
- * This struct is held internally by the C++ version FormattedNumber since the member types are not
- * declared in the public header file.
- *
- * The DecimalQuantity is not currently being used by FormattedNumber, but at some point it could be used
- * to add a toDecNumber() or similar method.
- *
- * Exported as U_I18N_API for tests
- */
-class U_I18N_API UFormattedNumberData : public FormattedValueStringBuilderImpl {
-public:
- UFormattedNumberData() : FormattedValueStringBuilderImpl(kUndefinedField) {}
- virtual ~UFormattedNumberData();
-
- DecimalQuantity quantity;
-};
-
-
-} // namespace impl
-} // namespace number
-U_NAMESPACE_END
-
-#endif //__SOURCE_NUMBER_UTYPES_H__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __SOURCE_NUMBER_UTYPES_H__
+#define __SOURCE_NUMBER_UTYPES_H__
+
+#include "unicode/numberformatter.h"
+#include "number_types.h"
+#include "number_decimalquantity.h"
+#include "formatted_string_builder.h"
+#include "formattedval_impl.h"
+
+U_NAMESPACE_BEGIN namespace number {
+namespace impl {
+
+
+/** Helper function used in upluralrules.cpp */
+const DecimalQuantity* validateUFormattedNumberToDecimalQuantity(
+ const UFormattedNumber* uresult, UErrorCode& status);
+
+
+/**
+ * Struct for data used by FormattedNumber.
+ *
+ * This struct is held internally by the C++ version FormattedNumber since the member types are not
+ * declared in the public header file.
+ *
+ * The DecimalQuantity is not currently being used by FormattedNumber, but at some point it could be used
+ * to add a toDecNumber() or similar method.
+ *
+ * Exported as U_I18N_API for tests
+ */
+class U_I18N_API UFormattedNumberData : public FormattedValueStringBuilderImpl {
+public:
+ UFormattedNumberData() : FormattedValueStringBuilderImpl(kUndefinedField) {}
+ virtual ~UFormattedNumberData();
+
+ DecimalQuantity quantity;
+};
+
+
+} // namespace impl
+} // namespace number
+U_NAMESPACE_END
+
+#endif //__SOURCE_NUMBER_UTYPES_H__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numfmt.cpp b/contrib/libs/icu/i18n/numfmt.cpp
index 64b7812d67..7c3a0551c3 100644
--- a/contrib/libs/icu/i18n/numfmt.cpp
+++ b/contrib/libs/icu/i18n/numfmt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -54,8 +54,8 @@
#include <float.h>
#include "sharednumberformat.h"
#include "unifiedcache.h"
-#include "number_decimalquantity.h"
-#include "number_utils.h"
+#include "number_decimalquantity.h"
+#include "number_utils.h"
//#define FMT_DEBUG
@@ -130,28 +130,28 @@ static const UChar * const gLastResortNumberPatterns[UNUM_FORMAT_STYLE_COUNT] =
// Keys used for accessing resource bundles
-static const icu::number::impl::CldrPatternStyle gFormatCldrStyles[UNUM_FORMAT_STYLE_COUNT] = {
- /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_PATTERN_DECIMAL
- icu::number::impl::CLDR_PATTERN_STYLE_DECIMAL, // UNUM_DECIMAL
- icu::number::impl::CLDR_PATTERN_STYLE_CURRENCY, // UNUM_CURRENCY
- icu::number::impl::CLDR_PATTERN_STYLE_PERCENT, // UNUM_PERCENT
- icu::number::impl::CLDR_PATTERN_STYLE_SCIENTIFIC, // UNUM_SCIENTIFIC
- /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_SPELLOUT
- /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_ORDINAL
- /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_DURATION
- /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_NUMBERING_SYSTEM
- /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_PATTERN_RULEBASED
+static const icu::number::impl::CldrPatternStyle gFormatCldrStyles[UNUM_FORMAT_STYLE_COUNT] = {
+ /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_PATTERN_DECIMAL
+ icu::number::impl::CLDR_PATTERN_STYLE_DECIMAL, // UNUM_DECIMAL
+ icu::number::impl::CLDR_PATTERN_STYLE_CURRENCY, // UNUM_CURRENCY
+ icu::number::impl::CLDR_PATTERN_STYLE_PERCENT, // UNUM_PERCENT
+ icu::number::impl::CLDR_PATTERN_STYLE_SCIENTIFIC, // UNUM_SCIENTIFIC
+ /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_SPELLOUT
+ /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_ORDINAL
+ /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_DURATION
+ /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_NUMBERING_SYSTEM
+ /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_PATTERN_RULEBASED
// For UNUM_CURRENCY_ISO and UNUM_CURRENCY_PLURAL,
// the pattern is the same as the pattern of UNUM_CURRENCY
// except for replacing the single currency sign with
// double currency sign or triple currency sign.
- icu::number::impl::CLDR_PATTERN_STYLE_CURRENCY, // UNUM_CURRENCY_ISO
- icu::number::impl::CLDR_PATTERN_STYLE_CURRENCY, // UNUM_CURRENCY_PLURAL
- icu::number::impl::CLDR_PATTERN_STYLE_ACCOUNTING, // UNUM_CURRENCY_ACCOUNTING
- icu::number::impl::CLDR_PATTERN_STYLE_CURRENCY, // UNUM_CASH_CURRENCY
- /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_DECIMAL_COMPACT_SHORT
- /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_DECIMAL_COMPACT_LONG
- icu::number::impl::CLDR_PATTERN_STYLE_CURRENCY, // UNUM_CURRENCY_STANDARD
+ icu::number::impl::CLDR_PATTERN_STYLE_CURRENCY, // UNUM_CURRENCY_ISO
+ icu::number::impl::CLDR_PATTERN_STYLE_CURRENCY, // UNUM_CURRENCY_PLURAL
+ icu::number::impl::CLDR_PATTERN_STYLE_ACCOUNTING, // UNUM_CURRENCY_ACCOUNTING
+ icu::number::impl::CLDR_PATTERN_STYLE_CURRENCY, // UNUM_CASH_CURRENCY
+ /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_DECIMAL_COMPACT_SHORT
+ /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_DECIMAL_COMPACT_LONG
+ icu::number::impl::CLDR_PATTERN_STYLE_CURRENCY, // UNUM_CURRENCY_STANDARD
};
// Static hashtable cache of NumberingSystem objects used by NumberFormat
@@ -521,17 +521,17 @@ ArgExtractor::ArgExtractor(const NumberFormat& /*nf*/, const Formattable& obj, U
ArgExtractor::~ArgExtractor() {
}
-UnicodeString& NumberFormat::format(const number::impl::DecimalQuantity &number,
+UnicodeString& NumberFormat::format(const number::impl::DecimalQuantity &number,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const {
// DecimalFormat overrides this function, and handles DigitList based big decimals.
- // Other subclasses (ChoiceFormat) do not (yet) handle DigitLists,
+ // Other subclasses (ChoiceFormat) do not (yet) handle DigitLists,
// so this default implementation falls back to formatting decimal numbers as doubles.
if (U_FAILURE(status)) {
return appendTo;
}
- double dnum = number.toDouble();
+ double dnum = number.toDouble();
format(dnum, appendTo, posIter, status);
return appendTo;
}
@@ -539,17 +539,17 @@ UnicodeString& NumberFormat::format(const number::impl::DecimalQuantity &number,
UnicodeString&
-NumberFormat::format(const number::impl::DecimalQuantity &number,
+NumberFormat::format(const number::impl::DecimalQuantity &number,
UnicodeString& appendTo,
FieldPosition& pos,
- UErrorCode &status) const {
+ UErrorCode &status) const {
// DecimalFormat overrides this function, and handles DigitList based big decimals.
- // Other subclasses (ChoiceFormat) do not (yet) handle DigitLists,
+ // Other subclasses (ChoiceFormat) do not (yet) handle DigitLists,
// so this default implementation falls back to formatting decimal numbers as doubles.
if (U_FAILURE(status)) {
return appendTo;
}
- double dnum = number.toDouble();
+ double dnum = number.toDouble();
format(dnum, appendTo, pos, status);
return appendTo;
}
@@ -569,13 +569,13 @@ NumberFormat::format(const Formattable& obj,
if(arg.wasCurrency() && u_strcmp(iso, getCurrency())) {
// trying to format a different currency.
// Right now, we clone.
- LocalPointer<NumberFormat> cloneFmt(this->clone());
+ LocalPointer<NumberFormat> cloneFmt(this->clone());
cloneFmt->setCurrency(iso, status);
// next line should NOT recurse, because n is numeric whereas obj was a wrapper around currency amount.
return cloneFmt->format(*n, appendTo, pos, status);
}
- if (n->isNumeric() && n->getDecimalQuantity() != NULL) {
+ if (n->isNumeric() && n->getDecimalQuantity() != NULL) {
// Decimal Number. We will have a DigitList available if the value was
// set to a decimal number, or if the value originated with a parse.
//
@@ -584,17 +584,17 @@ NumberFormat::format(const Formattable& obj,
// know about DigitList to continue to operate as they had.
//
// DecimalFormat overrides the DigitList formatting functions.
- format(*n->getDecimalQuantity(), appendTo, pos, status);
+ format(*n->getDecimalQuantity(), appendTo, pos, status);
} else {
switch (n->getType()) {
case Formattable::kDouble:
- format(n->getDouble(), appendTo, pos, status);
+ format(n->getDouble(), appendTo, pos, status);
break;
case Formattable::kLong:
- format(n->getLong(), appendTo, pos, status);
+ format(n->getLong(), appendTo, pos, status);
break;
case Formattable::kInt64:
- format(n->getInt64(), appendTo, pos, status);
+ format(n->getInt64(), appendTo, pos, status);
break;
default:
status = U_INVALID_FORMAT_ERROR;
@@ -624,15 +624,15 @@ NumberFormat::format(const Formattable& obj,
if(arg.wasCurrency() && u_strcmp(iso, getCurrency())) {
// trying to format a different currency.
// Right now, we clone.
- LocalPointer<NumberFormat> cloneFmt(this->clone());
+ LocalPointer<NumberFormat> cloneFmt(this->clone());
cloneFmt->setCurrency(iso, status);
// next line should NOT recurse, because n is numeric whereas obj was a wrapper around currency amount.
return cloneFmt->format(*n, appendTo, posIter, status);
}
- if (n->isNumeric() && n->getDecimalQuantity() != NULL) {
+ if (n->isNumeric() && n->getDecimalQuantity() != NULL) {
// Decimal Number
- format(*n->getDecimalQuantity(), appendTo, posIter, status);
+ format(*n->getDecimalQuantity(), appendTo, posIter, status);
} else {
switch (n->getType()) {
case Formattable::kDouble:
@@ -986,19 +986,19 @@ static UBool haveService() {
URegistryKey U_EXPORT2
NumberFormat::registerFactory(NumberFormatFactory* toAdopt, UErrorCode& status)
{
- if (U_FAILURE(status)) {
- delete toAdopt;
- return nullptr;
- }
- ICULocaleService *service = getNumberFormatService();
- if (service) {
- NFFactory *tempnnf = new NFFactory(toAdopt);
- if (tempnnf != NULL) {
- return service->registerFactory(tempnnf, status);
- }
- }
- status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ if (U_FAILURE(status)) {
+ delete toAdopt;
+ return nullptr;
+ }
+ ICULocaleService *service = getNumberFormatService();
+ if (service) {
+ NFFactory *tempnnf = new NFFactory(toAdopt);
+ if (tempnnf != NULL) {
+ return service->registerFactory(tempnnf, status);
+ }
+ }
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
}
// -------------------------------------
@@ -1059,7 +1059,7 @@ NumberFormat::createInstance(const Locale& loc, UNumberFormatStyle kind, UErrorC
if (U_FAILURE(status)) {
return NULL;
}
- NumberFormat *result = (*shared)->clone();
+ NumberFormat *result = (*shared)->clone();
shared->removeRef();
if (result == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
@@ -1189,7 +1189,7 @@ void NumberFormat::setCurrency(const UChar* theCurrency, UErrorCode& ec) {
}
}
-const char16_t* NumberFormat::getCurrency() const {
+const char16_t* NumberFormat::getCurrency() const {
return fCurrency;
}
@@ -1335,7 +1335,7 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
case UNUM_DECIMAL:
curr = FALSE;
// fall-through
- U_FALLTHROUGH;
+ U_FALLTHROUGH;
case UNUM_CURRENCY:
case UNUM_CURRENCY_ISO: // do not support plural formatting here
@@ -1343,13 +1343,13 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
case UNUM_CURRENCY_ACCOUNTING:
case UNUM_CASH_CURRENCY:
case UNUM_CURRENCY_STANDARD:
- {
- LocalPointer<Win32NumberFormat> f(new Win32NumberFormat(desiredLocale, curr, status), status);
+ {
+ LocalPointer<Win32NumberFormat> f(new Win32NumberFormat(desiredLocale, curr, status), status);
if (U_SUCCESS(status)) {
- return f.orphan();
+ return f.orphan();
}
- }
- break;
+ }
+ break;
default:
break;
}
@@ -1366,7 +1366,7 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
// TODO: Bad hash key usage, see ticket #8504.
int32_t hashKey = desiredLocale.hashCode();
- static UMutex nscacheMutex;
+ static UMutex nscacheMutex;
Mutex lock(&nscacheMutex);
ns = (NumberingSystem *)uhash_iget(NumberingSystem_cache, hashKey);
if (ns == NULL) {
@@ -1401,13 +1401,13 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
return NULL;
}
- // Load the pattern from data using the common library function
- const char16_t* patternPtr = number::impl::utils::getPatternForStyle(
- desiredLocale,
- ns->getName(),
- gFormatCldrStyles[style],
- status);
- pattern = UnicodeString(TRUE, patternPtr, -1);
+ // Load the pattern from data using the common library function
+ const char16_t* patternPtr = number::impl::utils::getPatternForStyle(
+ desiredLocale,
+ ns->getName(),
+ gFormatCldrStyles[style],
+ status);
+ pattern = UnicodeString(TRUE, patternPtr, -1);
}
if (U_FAILURE(status)) {
return NULL;
@@ -1420,7 +1420,7 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
}
}
- LocalPointer<NumberFormat> f;
+ LocalPointer<NumberFormat> f;
if (ns->isAlgorithmic()) {
UnicodeString nsDesc;
UnicodeString nsRuleSetGroup;
@@ -1455,7 +1455,7 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
return NULL;
}
r->setDefaultRuleSet(nsRuleSetName,status);
- f.adoptInstead(r);
+ f.adoptInstead(r);
} else {
// replace single currency sign in the pattern with double currency sign
// if the style is UNUM_CURRENCY_ISO
@@ -1464,33 +1464,33 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
UnicodeString(TRUE, gDoubleCurrencySign, 2));
}
- // "new DecimalFormat()" does not adopt the symbols argument if its memory allocation fails.
- // So we can't use adoptInsteadAndCheckErrorCode as we need to know if the 'new' failed.
- DecimalFormatSymbols *syms = symbolsToAdopt.getAlias();
- LocalPointer<DecimalFormat> df(new DecimalFormat(pattern, syms, style, status));
-
- if (df.isValid()) {
- // if the DecimalFormat object was successfully new'ed, then it will own symbolsToAdopt, even if the status is a failure.
- symbolsToAdopt.orphan();
- }
- else {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
-
- if (U_FAILURE(status)) {
- return nullptr;
- }
-
+ // "new DecimalFormat()" does not adopt the symbols argument if its memory allocation fails.
+ // So we can't use adoptInsteadAndCheckErrorCode as we need to know if the 'new' failed.
+ DecimalFormatSymbols *syms = symbolsToAdopt.getAlias();
+ LocalPointer<DecimalFormat> df(new DecimalFormat(pattern, syms, style, status));
+
+ if (df.isValid()) {
+ // if the DecimalFormat object was successfully new'ed, then it will own symbolsToAdopt, even if the status is a failure.
+ symbolsToAdopt.orphan();
+ }
+ else {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
+
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+
// if it is cash currency style, setCurrencyUsage with usage
if (style == UNUM_CASH_CURRENCY){
df->setCurrencyUsage(UCURR_USAGE_CASH, &status);
}
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
- f.adoptInstead(df.orphan());
+ f.adoptInstead(df.orphan());
}
f->setLocaleIDs(ures_getLocaleByType(ownedResource.getAlias(), ULOC_VALID_LOCALE, &status),
@@ -1498,27 +1498,27 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
if (U_FAILURE(status)) {
return NULL;
}
- return f.orphan();
-}
-
-/**
- * Get the rounding mode.
- * @return A rounding mode
- */
-NumberFormat::ERoundingMode NumberFormat::getRoundingMode() const {
- // Default value. ICU4J throws an exception and we can't change this API.
- return NumberFormat::ERoundingMode::kRoundUnnecessary;
-}
-
-/**
- * Set the rounding mode. This has no effect unless the rounding
- * increment is greater than zero.
- * @param roundingMode A rounding mode
- */
-void NumberFormat::setRoundingMode(NumberFormat::ERoundingMode /*roundingMode*/) {
- // No-op ICU4J throws an exception, and we can't change this API.
-}
-
+ return f.orphan();
+}
+
+/**
+ * Get the rounding mode.
+ * @return A rounding mode
+ */
+NumberFormat::ERoundingMode NumberFormat::getRoundingMode() const {
+ // Default value. ICU4J throws an exception and we can't change this API.
+ return NumberFormat::ERoundingMode::kRoundUnnecessary;
+}
+
+/**
+ * Set the rounding mode. This has no effect unless the rounding
+ * increment is greater than zero.
+ * @param roundingMode A rounding mode
+ */
+void NumberFormat::setRoundingMode(NumberFormat::ERoundingMode /*roundingMode*/) {
+ // No-op ICU4J throws an exception, and we can't change this API.
+}
+
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numparse_affixes.cpp b/contrib/libs/icu/i18n/numparse_affixes.cpp
index 82b989e487..ca293e741d 100644
--- a/contrib/libs/icu/i18n/numparse_affixes.cpp
+++ b/contrib/libs/icu/i18n/numparse_affixes.cpp
@@ -1,473 +1,473 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include "numparse_types.h"
-#include "numparse_affixes.h"
-#include "numparse_utils.h"
-#include "number_utils.h"
-#include "string_segment.h"
-
-using namespace icu;
-using namespace icu::numparse;
-using namespace icu::numparse::impl;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-
-namespace {
-
-/**
- * Helper method to return whether the given AffixPatternMatcher equals the given pattern string.
- * Either both arguments must be null or the pattern string inside the AffixPatternMatcher must equal
- * the given pattern string.
- */
-static bool matched(const AffixPatternMatcher* affix, const UnicodeString& patternString) {
- return (affix == nullptr && patternString.isBogus()) ||
- (affix != nullptr && affix->getPattern() == patternString);
-}
-
-/**
- * Helper method to return the length of the given AffixPatternMatcher. Returns 0 for null.
- */
-static int32_t length(const AffixPatternMatcher* matcher) {
- return matcher == nullptr ? 0 : matcher->getPattern().length();
-}
-
-/**
- * Helper method to return whether (1) both lhs and rhs are null/invalid, or (2) if they are both
- * valid, whether they are equal according to operator==. Similar to Java Objects.equals()
- */
-static bool equals(const AffixPatternMatcher* lhs, const AffixPatternMatcher* rhs) {
- if (lhs == nullptr && rhs == nullptr) {
- return true;
- }
- if (lhs == nullptr || rhs == nullptr) {
- return false;
- }
- return *lhs == *rhs;
-}
-
-}
-
-
-AffixPatternMatcherBuilder::AffixPatternMatcherBuilder(const UnicodeString& pattern,
- AffixTokenMatcherWarehouse& warehouse,
- IgnorablesMatcher* ignorables)
- : fMatchersLen(0),
- fLastTypeOrCp(0),
- fPattern(pattern),
- fWarehouse(warehouse),
- fIgnorables(ignorables) {}
-
-void AffixPatternMatcherBuilder::consumeToken(AffixPatternType type, UChar32 cp, UErrorCode& status) {
- // This is called by AffixUtils.iterateWithConsumer() for each token.
-
- // Add an ignorables matcher between tokens except between two literals, and don't put two
- // ignorables matchers in a row.
- if (fIgnorables != nullptr && fMatchersLen > 0 &&
- (fLastTypeOrCp < 0 || !fIgnorables->getSet()->contains(fLastTypeOrCp))) {
- addMatcher(*fIgnorables);
- }
-
- if (type != TYPE_CODEPOINT) {
- // Case 1: the token is a symbol.
- switch (type) {
- case TYPE_MINUS_SIGN:
- addMatcher(fWarehouse.minusSign());
- break;
- case TYPE_PLUS_SIGN:
- addMatcher(fWarehouse.plusSign());
- break;
- case TYPE_PERCENT:
- addMatcher(fWarehouse.percent());
- break;
- case TYPE_PERMILLE:
- addMatcher(fWarehouse.permille());
- break;
- case TYPE_CURRENCY_SINGLE:
- case TYPE_CURRENCY_DOUBLE:
- case TYPE_CURRENCY_TRIPLE:
- case TYPE_CURRENCY_QUAD:
- case TYPE_CURRENCY_QUINT:
- // All currency symbols use the same matcher
- addMatcher(fWarehouse.currency(status));
- break;
- default:
- UPRV_UNREACHABLE;
- }
-
- } else if (fIgnorables != nullptr && fIgnorables->getSet()->contains(cp)) {
- // Case 2: the token is an ignorable literal.
- // No action necessary: the ignorables matcher has already been added.
-
- } else {
- // Case 3: the token is a non-ignorable literal.
- if (auto* ptr = fWarehouse.nextCodePointMatcher(cp, status)) {
- addMatcher(*ptr);
- } else {
- // OOM; unwind the stack
- return;
- }
- }
- fLastTypeOrCp = type != TYPE_CODEPOINT ? type : cp;
-}
-
-void AffixPatternMatcherBuilder::addMatcher(NumberParseMatcher& matcher) {
- if (fMatchersLen >= fMatchers.getCapacity()) {
- fMatchers.resize(fMatchersLen * 2, fMatchersLen);
- }
- fMatchers[fMatchersLen++] = &matcher;
-}
-
-AffixPatternMatcher AffixPatternMatcherBuilder::build() {
- return AffixPatternMatcher(fMatchers, fMatchersLen, fPattern);
-}
-
-AffixTokenMatcherWarehouse::AffixTokenMatcherWarehouse(const AffixTokenMatcherSetupData* setupData)
- : fSetupData(setupData) {}
-
-NumberParseMatcher& AffixTokenMatcherWarehouse::minusSign() {
- return fMinusSign = {fSetupData->dfs, true};
-}
-
-NumberParseMatcher& AffixTokenMatcherWarehouse::plusSign() {
- return fPlusSign = {fSetupData->dfs, true};
-}
-
-NumberParseMatcher& AffixTokenMatcherWarehouse::percent() {
- return fPercent = {fSetupData->dfs};
-}
-
-NumberParseMatcher& AffixTokenMatcherWarehouse::permille() {
- return fPermille = {fSetupData->dfs};
-}
-
-NumberParseMatcher& AffixTokenMatcherWarehouse::currency(UErrorCode& status) {
- return fCurrency = {fSetupData->currencySymbols, fSetupData->dfs, fSetupData->parseFlags, status};
-}
-
-IgnorablesMatcher& AffixTokenMatcherWarehouse::ignorables() {
- return fSetupData->ignorables;
-}
-
-NumberParseMatcher* AffixTokenMatcherWarehouse::nextCodePointMatcher(UChar32 cp, UErrorCode& status) {
- if (U_FAILURE(status)) {
- return nullptr;
- }
- auto* result = fCodePoints.create(cp);
- if (result == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
- return result;
-}
-
-
-CodePointMatcher::CodePointMatcher(UChar32 cp)
- : fCp(cp) {}
-
-bool CodePointMatcher::match(StringSegment& segment, ParsedNumber& result, UErrorCode&) const {
- if (segment.startsWith(fCp)) {
- segment.adjustOffsetByCodePoint();
- result.setCharsConsumed(segment);
- }
- return false;
-}
-
-bool CodePointMatcher::smokeTest(const StringSegment& segment) const {
- return segment.startsWith(fCp);
-}
-
-UnicodeString CodePointMatcher::toString() const {
- return u"<CodePoint>";
-}
-
-
-AffixPatternMatcher AffixPatternMatcher::fromAffixPattern(const UnicodeString& affixPattern,
- AffixTokenMatcherWarehouse& tokenWarehouse,
- parse_flags_t parseFlags, bool* success,
- UErrorCode& status) {
- if (affixPattern.isEmpty()) {
- *success = false;
- return {};
- }
- *success = true;
-
- IgnorablesMatcher* ignorables;
- if (0 != (parseFlags & PARSE_FLAG_EXACT_AFFIX)) {
- ignorables = nullptr;
- } else {
- ignorables = &tokenWarehouse.ignorables();
- }
-
- AffixPatternMatcherBuilder builder(affixPattern, tokenWarehouse, ignorables);
- AffixUtils::iterateWithConsumer(affixPattern, builder, status);
- return builder.build();
-}
-
-AffixPatternMatcher::AffixPatternMatcher(MatcherArray& matchers, int32_t matchersLen,
- const UnicodeString& pattern)
- : ArraySeriesMatcher(matchers, matchersLen), fPattern(pattern) {}
-
-UnicodeString AffixPatternMatcher::getPattern() const {
- return fPattern.toAliasedUnicodeString();
-}
-
-bool AffixPatternMatcher::operator==(const AffixPatternMatcher& other) const {
- return fPattern == other.fPattern;
-}
-
-
-AffixMatcherWarehouse::AffixMatcherWarehouse(AffixTokenMatcherWarehouse* tokenWarehouse)
- : fTokenWarehouse(tokenWarehouse) {
-}
-
-bool AffixMatcherWarehouse::isInteresting(const AffixPatternProvider& patternInfo,
- const IgnorablesMatcher& ignorables, parse_flags_t parseFlags,
- UErrorCode& status) {
- UnicodeString posPrefixString = patternInfo.getString(AffixPatternProvider::AFFIX_POS_PREFIX);
- UnicodeString posSuffixString = patternInfo.getString(AffixPatternProvider::AFFIX_POS_SUFFIX);
- UnicodeString negPrefixString;
- UnicodeString negSuffixString;
- if (patternInfo.hasNegativeSubpattern()) {
- negPrefixString = patternInfo.getString(AffixPatternProvider::AFFIX_NEG_PREFIX);
- negSuffixString = patternInfo.getString(AffixPatternProvider::AFFIX_NEG_SUFFIX);
- }
-
- if (0 == (parseFlags & PARSE_FLAG_USE_FULL_AFFIXES) &&
- AffixUtils::containsOnlySymbolsAndIgnorables(posPrefixString, *ignorables.getSet(), status) &&
- AffixUtils::containsOnlySymbolsAndIgnorables(posSuffixString, *ignorables.getSet(), status) &&
- AffixUtils::containsOnlySymbolsAndIgnorables(negPrefixString, *ignorables.getSet(), status) &&
- AffixUtils::containsOnlySymbolsAndIgnorables(negSuffixString, *ignorables.getSet(), status)
- // HACK: Plus and minus sign are a special case: we accept them trailing only if they are
- // trailing in the pattern string.
- && !AffixUtils::containsType(posSuffixString, TYPE_PLUS_SIGN, status) &&
- !AffixUtils::containsType(posSuffixString, TYPE_MINUS_SIGN, status) &&
- !AffixUtils::containsType(negSuffixString, TYPE_PLUS_SIGN, status) &&
- !AffixUtils::containsType(negSuffixString, TYPE_MINUS_SIGN, status)) {
- // The affixes contain only symbols and ignorables.
- // No need to generate affix matchers.
- return false;
- }
- return true;
-}
-
-void AffixMatcherWarehouse::createAffixMatchers(const AffixPatternProvider& patternInfo,
- MutableMatcherCollection& output,
- const IgnorablesMatcher& ignorables,
- parse_flags_t parseFlags, UErrorCode& status) {
- if (!isInteresting(patternInfo, ignorables, parseFlags, status)) {
- return;
- }
-
- // The affixes have interesting characters, or we are in strict mode.
- // Use initial capacity of 6, the highest possible number of AffixMatchers.
- UnicodeString sb;
- bool includeUnpaired = 0 != (parseFlags & PARSE_FLAG_INCLUDE_UNPAIRED_AFFIXES);
-
- int32_t numAffixMatchers = 0;
- int32_t numAffixPatternMatchers = 0;
-
- AffixPatternMatcher* posPrefix = nullptr;
- AffixPatternMatcher* posSuffix = nullptr;
-
- // Pre-process the affix strings to resolve LDML rules like sign display.
- for (int8_t typeInt = 0; typeInt < PATTERN_SIGN_TYPE_COUNT; typeInt++) {
- auto type = static_cast<PatternSignType>(typeInt);
-
- // Skip affixes in some cases
- if (type == PATTERN_SIGN_TYPE_POS
- && 0 != (parseFlags & PARSE_FLAG_PLUS_SIGN_ALLOWED)) {
- continue;
- }
- if (type == PATTERN_SIGN_TYPE_POS_SIGN
- && 0 == (parseFlags & PARSE_FLAG_PLUS_SIGN_ALLOWED)) {
- continue;
- }
-
- // Generate Prefix
- bool hasPrefix = false;
- PatternStringUtils::patternInfoToStringBuilder(
- patternInfo, true, type, StandardPlural::OTHER, false, sb);
- fAffixPatternMatchers[numAffixPatternMatchers] = AffixPatternMatcher::fromAffixPattern(
- sb, *fTokenWarehouse, parseFlags, &hasPrefix, status);
- AffixPatternMatcher* prefix = hasPrefix ? &fAffixPatternMatchers[numAffixPatternMatchers++]
- : nullptr;
-
- // Generate Suffix
- bool hasSuffix = false;
- PatternStringUtils::patternInfoToStringBuilder(
- patternInfo, false, type, StandardPlural::OTHER, false, sb);
- fAffixPatternMatchers[numAffixPatternMatchers] = AffixPatternMatcher::fromAffixPattern(
- sb, *fTokenWarehouse, parseFlags, &hasSuffix, status);
- AffixPatternMatcher* suffix = hasSuffix ? &fAffixPatternMatchers[numAffixPatternMatchers++]
- : nullptr;
-
- if (type == PATTERN_SIGN_TYPE_POS) {
- posPrefix = prefix;
- posSuffix = suffix;
- } else if (equals(prefix, posPrefix) && equals(suffix, posSuffix)) {
- // Skip adding these matchers (we already have equivalents)
- continue;
- }
-
- // Flags for setting in the ParsedNumber; the token matchers may add more.
- int flags = (type == PATTERN_SIGN_TYPE_NEG) ? FLAG_NEGATIVE : 0;
-
- // Note: it is indeed possible for posPrefix and posSuffix to both be null.
- // We still need to add that matcher for strict mode to work.
- fAffixMatchers[numAffixMatchers++] = {prefix, suffix, flags};
- if (includeUnpaired && prefix != nullptr && suffix != nullptr) {
- // The following if statements are designed to prevent adding two identical matchers.
- if (type == PATTERN_SIGN_TYPE_POS || !equals(prefix, posPrefix)) {
- fAffixMatchers[numAffixMatchers++] = {prefix, nullptr, flags};
- }
- if (type == PATTERN_SIGN_TYPE_POS || !equals(suffix, posSuffix)) {
- fAffixMatchers[numAffixMatchers++] = {nullptr, suffix, flags};
- }
- }
- }
-
- // Put the AffixMatchers in order, and then add them to the output.
- // Since there are at most 9 elements, do a simple-to-implement bubble sort.
- bool madeChanges;
- do {
- madeChanges = false;
- for (int32_t i = 1; i < numAffixMatchers; i++) {
- if (fAffixMatchers[i - 1].compareTo(fAffixMatchers[i]) > 0) {
- madeChanges = true;
- AffixMatcher temp = std::move(fAffixMatchers[i - 1]);
- fAffixMatchers[i - 1] = std::move(fAffixMatchers[i]);
- fAffixMatchers[i] = std::move(temp);
- }
- }
- } while (madeChanges);
-
- for (int32_t i = 0; i < numAffixMatchers; i++) {
- // Enable the following line to debug affixes
- //std::cout << "Adding affix matcher: " << CStr(fAffixMatchers[i].toString())() << std::endl;
- output.addMatcher(fAffixMatchers[i]);
- }
-}
-
-
-AffixMatcher::AffixMatcher(AffixPatternMatcher* prefix, AffixPatternMatcher* suffix, result_flags_t flags)
- : fPrefix(prefix), fSuffix(suffix), fFlags(flags) {}
-
-bool AffixMatcher::match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const {
- if (!result.seenNumber()) {
- // Prefix
- // Do not match if:
- // 1. We have already seen a prefix (result.prefix != null)
- // 2. The prefix in this AffixMatcher is empty (prefix == null)
- if (!result.prefix.isBogus() || fPrefix == nullptr) {
- return false;
- }
-
- // Attempt to match the prefix.
- int initialOffset = segment.getOffset();
- bool maybeMore = fPrefix->match(segment, result, status);
- if (initialOffset != segment.getOffset()) {
- result.prefix = fPrefix->getPattern();
- }
- return maybeMore;
-
- } else {
- // Suffix
- // Do not match if:
- // 1. We have already seen a suffix (result.suffix != null)
- // 2. The suffix in this AffixMatcher is empty (suffix == null)
- // 3. The matched prefix does not equal this AffixMatcher's prefix
- if (!result.suffix.isBogus() || fSuffix == nullptr || !matched(fPrefix, result.prefix)) {
- return false;
- }
-
- // Attempt to match the suffix.
- int initialOffset = segment.getOffset();
- bool maybeMore = fSuffix->match(segment, result, status);
- if (initialOffset != segment.getOffset()) {
- result.suffix = fSuffix->getPattern();
- }
- return maybeMore;
- }
-}
-
-bool AffixMatcher::smokeTest(const StringSegment& segment) const {
- return (fPrefix != nullptr && fPrefix->smokeTest(segment)) ||
- (fSuffix != nullptr && fSuffix->smokeTest(segment));
-}
-
-void AffixMatcher::postProcess(ParsedNumber& result) const {
- // Check to see if our affix is the one that was matched. If so, set the flags in the result.
- if (matched(fPrefix, result.prefix) && matched(fSuffix, result.suffix)) {
- // Fill in the result prefix and suffix with non-null values (empty string).
- // Used by strict mode to determine whether an entire affix pair was matched.
- if (result.prefix.isBogus()) {
- result.prefix = UnicodeString();
- }
- if (result.suffix.isBogus()) {
- result.suffix = UnicodeString();
- }
- result.flags |= fFlags;
- if (fPrefix != nullptr) {
- fPrefix->postProcess(result);
- }
- if (fSuffix != nullptr) {
- fSuffix->postProcess(result);
- }
- }
-}
-
-int8_t AffixMatcher::compareTo(const AffixMatcher& rhs) const {
- const AffixMatcher& lhs = *this;
- if (length(lhs.fPrefix) != length(rhs.fPrefix)) {
- return length(lhs.fPrefix) > length(rhs.fPrefix) ? -1 : 1;
- } else if (length(lhs.fSuffix) != length(rhs.fSuffix)) {
- return length(lhs.fSuffix) > length(rhs.fSuffix) ? -1 : 1;
- } else {
- return 0;
- }
-}
-
-UnicodeString AffixMatcher::toString() const {
- bool isNegative = 0 != (fFlags & FLAG_NEGATIVE);
- return UnicodeString(u"<Affix") + (isNegative ? u":negative " : u" ") +
- (fPrefix ? fPrefix->getPattern() : u"null") + u"#" +
- (fSuffix ? fSuffix->getPattern() : u"null") + u">";
-
-}
-
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include "numparse_types.h"
+#include "numparse_affixes.h"
+#include "numparse_utils.h"
+#include "number_utils.h"
+#include "string_segment.h"
+
+using namespace icu;
+using namespace icu::numparse;
+using namespace icu::numparse::impl;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+
+namespace {
+
+/**
+ * Helper method to return whether the given AffixPatternMatcher equals the given pattern string.
+ * Either both arguments must be null or the pattern string inside the AffixPatternMatcher must equal
+ * the given pattern string.
+ */
+static bool matched(const AffixPatternMatcher* affix, const UnicodeString& patternString) {
+ return (affix == nullptr && patternString.isBogus()) ||
+ (affix != nullptr && affix->getPattern() == patternString);
+}
+
+/**
+ * Helper method to return the length of the given AffixPatternMatcher. Returns 0 for null.
+ */
+static int32_t length(const AffixPatternMatcher* matcher) {
+ return matcher == nullptr ? 0 : matcher->getPattern().length();
+}
+
+/**
+ * Helper method to return whether (1) both lhs and rhs are null/invalid, or (2) if they are both
+ * valid, whether they are equal according to operator==. Similar to Java Objects.equals()
+ */
+static bool equals(const AffixPatternMatcher* lhs, const AffixPatternMatcher* rhs) {
+ if (lhs == nullptr && rhs == nullptr) {
+ return true;
+ }
+ if (lhs == nullptr || rhs == nullptr) {
+ return false;
+ }
+ return *lhs == *rhs;
+}
+
+}
+
+
+AffixPatternMatcherBuilder::AffixPatternMatcherBuilder(const UnicodeString& pattern,
+ AffixTokenMatcherWarehouse& warehouse,
+ IgnorablesMatcher* ignorables)
+ : fMatchersLen(0),
+ fLastTypeOrCp(0),
+ fPattern(pattern),
+ fWarehouse(warehouse),
+ fIgnorables(ignorables) {}
+
+void AffixPatternMatcherBuilder::consumeToken(AffixPatternType type, UChar32 cp, UErrorCode& status) {
+ // This is called by AffixUtils.iterateWithConsumer() for each token.
+
+ // Add an ignorables matcher between tokens except between two literals, and don't put two
+ // ignorables matchers in a row.
+ if (fIgnorables != nullptr && fMatchersLen > 0 &&
+ (fLastTypeOrCp < 0 || !fIgnorables->getSet()->contains(fLastTypeOrCp))) {
+ addMatcher(*fIgnorables);
+ }
+
+ if (type != TYPE_CODEPOINT) {
+ // Case 1: the token is a symbol.
+ switch (type) {
+ case TYPE_MINUS_SIGN:
+ addMatcher(fWarehouse.minusSign());
+ break;
+ case TYPE_PLUS_SIGN:
+ addMatcher(fWarehouse.plusSign());
+ break;
+ case TYPE_PERCENT:
+ addMatcher(fWarehouse.percent());
+ break;
+ case TYPE_PERMILLE:
+ addMatcher(fWarehouse.permille());
+ break;
+ case TYPE_CURRENCY_SINGLE:
+ case TYPE_CURRENCY_DOUBLE:
+ case TYPE_CURRENCY_TRIPLE:
+ case TYPE_CURRENCY_QUAD:
+ case TYPE_CURRENCY_QUINT:
+ // All currency symbols use the same matcher
+ addMatcher(fWarehouse.currency(status));
+ break;
+ default:
+ UPRV_UNREACHABLE;
+ }
+
+ } else if (fIgnorables != nullptr && fIgnorables->getSet()->contains(cp)) {
+ // Case 2: the token is an ignorable literal.
+ // No action necessary: the ignorables matcher has already been added.
+
+ } else {
+ // Case 3: the token is a non-ignorable literal.
+ if (auto* ptr = fWarehouse.nextCodePointMatcher(cp, status)) {
+ addMatcher(*ptr);
+ } else {
+ // OOM; unwind the stack
+ return;
+ }
+ }
+ fLastTypeOrCp = type != TYPE_CODEPOINT ? type : cp;
+}
+
+void AffixPatternMatcherBuilder::addMatcher(NumberParseMatcher& matcher) {
+ if (fMatchersLen >= fMatchers.getCapacity()) {
+ fMatchers.resize(fMatchersLen * 2, fMatchersLen);
+ }
+ fMatchers[fMatchersLen++] = &matcher;
+}
+
+AffixPatternMatcher AffixPatternMatcherBuilder::build() {
+ return AffixPatternMatcher(fMatchers, fMatchersLen, fPattern);
+}
+
+AffixTokenMatcherWarehouse::AffixTokenMatcherWarehouse(const AffixTokenMatcherSetupData* setupData)
+ : fSetupData(setupData) {}
+
+NumberParseMatcher& AffixTokenMatcherWarehouse::minusSign() {
+ return fMinusSign = {fSetupData->dfs, true};
+}
+
+NumberParseMatcher& AffixTokenMatcherWarehouse::plusSign() {
+ return fPlusSign = {fSetupData->dfs, true};
+}
+
+NumberParseMatcher& AffixTokenMatcherWarehouse::percent() {
+ return fPercent = {fSetupData->dfs};
+}
+
+NumberParseMatcher& AffixTokenMatcherWarehouse::permille() {
+ return fPermille = {fSetupData->dfs};
+}
+
+NumberParseMatcher& AffixTokenMatcherWarehouse::currency(UErrorCode& status) {
+ return fCurrency = {fSetupData->currencySymbols, fSetupData->dfs, fSetupData->parseFlags, status};
+}
+
+IgnorablesMatcher& AffixTokenMatcherWarehouse::ignorables() {
+ return fSetupData->ignorables;
+}
+
+NumberParseMatcher* AffixTokenMatcherWarehouse::nextCodePointMatcher(UChar32 cp, UErrorCode& status) {
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ auto* result = fCodePoints.create(cp);
+ if (result == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
+ return result;
+}
+
+
+CodePointMatcher::CodePointMatcher(UChar32 cp)
+ : fCp(cp) {}
+
+bool CodePointMatcher::match(StringSegment& segment, ParsedNumber& result, UErrorCode&) const {
+ if (segment.startsWith(fCp)) {
+ segment.adjustOffsetByCodePoint();
+ result.setCharsConsumed(segment);
+ }
+ return false;
+}
+
+bool CodePointMatcher::smokeTest(const StringSegment& segment) const {
+ return segment.startsWith(fCp);
+}
+
+UnicodeString CodePointMatcher::toString() const {
+ return u"<CodePoint>";
+}
+
+
+AffixPatternMatcher AffixPatternMatcher::fromAffixPattern(const UnicodeString& affixPattern,
+ AffixTokenMatcherWarehouse& tokenWarehouse,
+ parse_flags_t parseFlags, bool* success,
+ UErrorCode& status) {
+ if (affixPattern.isEmpty()) {
+ *success = false;
+ return {};
+ }
+ *success = true;
+
+ IgnorablesMatcher* ignorables;
+ if (0 != (parseFlags & PARSE_FLAG_EXACT_AFFIX)) {
+ ignorables = nullptr;
+ } else {
+ ignorables = &tokenWarehouse.ignorables();
+ }
+
+ AffixPatternMatcherBuilder builder(affixPattern, tokenWarehouse, ignorables);
+ AffixUtils::iterateWithConsumer(affixPattern, builder, status);
+ return builder.build();
+}
+
+AffixPatternMatcher::AffixPatternMatcher(MatcherArray& matchers, int32_t matchersLen,
+ const UnicodeString& pattern)
+ : ArraySeriesMatcher(matchers, matchersLen), fPattern(pattern) {}
+
+UnicodeString AffixPatternMatcher::getPattern() const {
+ return fPattern.toAliasedUnicodeString();
+}
+
+bool AffixPatternMatcher::operator==(const AffixPatternMatcher& other) const {
+ return fPattern == other.fPattern;
+}
+
+
+AffixMatcherWarehouse::AffixMatcherWarehouse(AffixTokenMatcherWarehouse* tokenWarehouse)
+ : fTokenWarehouse(tokenWarehouse) {
+}
+
+bool AffixMatcherWarehouse::isInteresting(const AffixPatternProvider& patternInfo,
+ const IgnorablesMatcher& ignorables, parse_flags_t parseFlags,
+ UErrorCode& status) {
+ UnicodeString posPrefixString = patternInfo.getString(AffixPatternProvider::AFFIX_POS_PREFIX);
+ UnicodeString posSuffixString = patternInfo.getString(AffixPatternProvider::AFFIX_POS_SUFFIX);
+ UnicodeString negPrefixString;
+ UnicodeString negSuffixString;
+ if (patternInfo.hasNegativeSubpattern()) {
+ negPrefixString = patternInfo.getString(AffixPatternProvider::AFFIX_NEG_PREFIX);
+ negSuffixString = patternInfo.getString(AffixPatternProvider::AFFIX_NEG_SUFFIX);
+ }
+
+ if (0 == (parseFlags & PARSE_FLAG_USE_FULL_AFFIXES) &&
+ AffixUtils::containsOnlySymbolsAndIgnorables(posPrefixString, *ignorables.getSet(), status) &&
+ AffixUtils::containsOnlySymbolsAndIgnorables(posSuffixString, *ignorables.getSet(), status) &&
+ AffixUtils::containsOnlySymbolsAndIgnorables(negPrefixString, *ignorables.getSet(), status) &&
+ AffixUtils::containsOnlySymbolsAndIgnorables(negSuffixString, *ignorables.getSet(), status)
+ // HACK: Plus and minus sign are a special case: we accept them trailing only if they are
+ // trailing in the pattern string.
+ && !AffixUtils::containsType(posSuffixString, TYPE_PLUS_SIGN, status) &&
+ !AffixUtils::containsType(posSuffixString, TYPE_MINUS_SIGN, status) &&
+ !AffixUtils::containsType(negSuffixString, TYPE_PLUS_SIGN, status) &&
+ !AffixUtils::containsType(negSuffixString, TYPE_MINUS_SIGN, status)) {
+ // The affixes contain only symbols and ignorables.
+ // No need to generate affix matchers.
+ return false;
+ }
+ return true;
+}
+
+void AffixMatcherWarehouse::createAffixMatchers(const AffixPatternProvider& patternInfo,
+ MutableMatcherCollection& output,
+ const IgnorablesMatcher& ignorables,
+ parse_flags_t parseFlags, UErrorCode& status) {
+ if (!isInteresting(patternInfo, ignorables, parseFlags, status)) {
+ return;
+ }
+
+ // The affixes have interesting characters, or we are in strict mode.
+ // Use initial capacity of 6, the highest possible number of AffixMatchers.
+ UnicodeString sb;
+ bool includeUnpaired = 0 != (parseFlags & PARSE_FLAG_INCLUDE_UNPAIRED_AFFIXES);
+
+ int32_t numAffixMatchers = 0;
+ int32_t numAffixPatternMatchers = 0;
+
+ AffixPatternMatcher* posPrefix = nullptr;
+ AffixPatternMatcher* posSuffix = nullptr;
+
+ // Pre-process the affix strings to resolve LDML rules like sign display.
+ for (int8_t typeInt = 0; typeInt < PATTERN_SIGN_TYPE_COUNT; typeInt++) {
+ auto type = static_cast<PatternSignType>(typeInt);
+
+ // Skip affixes in some cases
+ if (type == PATTERN_SIGN_TYPE_POS
+ && 0 != (parseFlags & PARSE_FLAG_PLUS_SIGN_ALLOWED)) {
+ continue;
+ }
+ if (type == PATTERN_SIGN_TYPE_POS_SIGN
+ && 0 == (parseFlags & PARSE_FLAG_PLUS_SIGN_ALLOWED)) {
+ continue;
+ }
+
+ // Generate Prefix
+ bool hasPrefix = false;
+ PatternStringUtils::patternInfoToStringBuilder(
+ patternInfo, true, type, StandardPlural::OTHER, false, sb);
+ fAffixPatternMatchers[numAffixPatternMatchers] = AffixPatternMatcher::fromAffixPattern(
+ sb, *fTokenWarehouse, parseFlags, &hasPrefix, status);
+ AffixPatternMatcher* prefix = hasPrefix ? &fAffixPatternMatchers[numAffixPatternMatchers++]
+ : nullptr;
+
+ // Generate Suffix
+ bool hasSuffix = false;
+ PatternStringUtils::patternInfoToStringBuilder(
+ patternInfo, false, type, StandardPlural::OTHER, false, sb);
+ fAffixPatternMatchers[numAffixPatternMatchers] = AffixPatternMatcher::fromAffixPattern(
+ sb, *fTokenWarehouse, parseFlags, &hasSuffix, status);
+ AffixPatternMatcher* suffix = hasSuffix ? &fAffixPatternMatchers[numAffixPatternMatchers++]
+ : nullptr;
+
+ if (type == PATTERN_SIGN_TYPE_POS) {
+ posPrefix = prefix;
+ posSuffix = suffix;
+ } else if (equals(prefix, posPrefix) && equals(suffix, posSuffix)) {
+ // Skip adding these matchers (we already have equivalents)
+ continue;
+ }
+
+ // Flags for setting in the ParsedNumber; the token matchers may add more.
+ int flags = (type == PATTERN_SIGN_TYPE_NEG) ? FLAG_NEGATIVE : 0;
+
+ // Note: it is indeed possible for posPrefix and posSuffix to both be null.
+ // We still need to add that matcher for strict mode to work.
+ fAffixMatchers[numAffixMatchers++] = {prefix, suffix, flags};
+ if (includeUnpaired && prefix != nullptr && suffix != nullptr) {
+ // The following if statements are designed to prevent adding two identical matchers.
+ if (type == PATTERN_SIGN_TYPE_POS || !equals(prefix, posPrefix)) {
+ fAffixMatchers[numAffixMatchers++] = {prefix, nullptr, flags};
+ }
+ if (type == PATTERN_SIGN_TYPE_POS || !equals(suffix, posSuffix)) {
+ fAffixMatchers[numAffixMatchers++] = {nullptr, suffix, flags};
+ }
+ }
+ }
+
+ // Put the AffixMatchers in order, and then add them to the output.
+ // Since there are at most 9 elements, do a simple-to-implement bubble sort.
+ bool madeChanges;
+ do {
+ madeChanges = false;
+ for (int32_t i = 1; i < numAffixMatchers; i++) {
+ if (fAffixMatchers[i - 1].compareTo(fAffixMatchers[i]) > 0) {
+ madeChanges = true;
+ AffixMatcher temp = std::move(fAffixMatchers[i - 1]);
+ fAffixMatchers[i - 1] = std::move(fAffixMatchers[i]);
+ fAffixMatchers[i] = std::move(temp);
+ }
+ }
+ } while (madeChanges);
+
+ for (int32_t i = 0; i < numAffixMatchers; i++) {
+ // Enable the following line to debug affixes
+ //std::cout << "Adding affix matcher: " << CStr(fAffixMatchers[i].toString())() << std::endl;
+ output.addMatcher(fAffixMatchers[i]);
+ }
+}
+
+
+AffixMatcher::AffixMatcher(AffixPatternMatcher* prefix, AffixPatternMatcher* suffix, result_flags_t flags)
+ : fPrefix(prefix), fSuffix(suffix), fFlags(flags) {}
+
+bool AffixMatcher::match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const {
+ if (!result.seenNumber()) {
+ // Prefix
+ // Do not match if:
+ // 1. We have already seen a prefix (result.prefix != null)
+ // 2. The prefix in this AffixMatcher is empty (prefix == null)
+ if (!result.prefix.isBogus() || fPrefix == nullptr) {
+ return false;
+ }
+
+ // Attempt to match the prefix.
+ int initialOffset = segment.getOffset();
+ bool maybeMore = fPrefix->match(segment, result, status);
+ if (initialOffset != segment.getOffset()) {
+ result.prefix = fPrefix->getPattern();
+ }
+ return maybeMore;
+
+ } else {
+ // Suffix
+ // Do not match if:
+ // 1. We have already seen a suffix (result.suffix != null)
+ // 2. The suffix in this AffixMatcher is empty (suffix == null)
+ // 3. The matched prefix does not equal this AffixMatcher's prefix
+ if (!result.suffix.isBogus() || fSuffix == nullptr || !matched(fPrefix, result.prefix)) {
+ return false;
+ }
+
+ // Attempt to match the suffix.
+ int initialOffset = segment.getOffset();
+ bool maybeMore = fSuffix->match(segment, result, status);
+ if (initialOffset != segment.getOffset()) {
+ result.suffix = fSuffix->getPattern();
+ }
+ return maybeMore;
+ }
+}
+
+bool AffixMatcher::smokeTest(const StringSegment& segment) const {
+ return (fPrefix != nullptr && fPrefix->smokeTest(segment)) ||
+ (fSuffix != nullptr && fSuffix->smokeTest(segment));
+}
+
+void AffixMatcher::postProcess(ParsedNumber& result) const {
+ // Check to see if our affix is the one that was matched. If so, set the flags in the result.
+ if (matched(fPrefix, result.prefix) && matched(fSuffix, result.suffix)) {
+ // Fill in the result prefix and suffix with non-null values (empty string).
+ // Used by strict mode to determine whether an entire affix pair was matched.
+ if (result.prefix.isBogus()) {
+ result.prefix = UnicodeString();
+ }
+ if (result.suffix.isBogus()) {
+ result.suffix = UnicodeString();
+ }
+ result.flags |= fFlags;
+ if (fPrefix != nullptr) {
+ fPrefix->postProcess(result);
+ }
+ if (fSuffix != nullptr) {
+ fSuffix->postProcess(result);
+ }
+ }
+}
+
+int8_t AffixMatcher::compareTo(const AffixMatcher& rhs) const {
+ const AffixMatcher& lhs = *this;
+ if (length(lhs.fPrefix) != length(rhs.fPrefix)) {
+ return length(lhs.fPrefix) > length(rhs.fPrefix) ? -1 : 1;
+ } else if (length(lhs.fSuffix) != length(rhs.fSuffix)) {
+ return length(lhs.fSuffix) > length(rhs.fSuffix) ? -1 : 1;
+ } else {
+ return 0;
+ }
+}
+
+UnicodeString AffixMatcher::toString() const {
+ bool isNegative = 0 != (fFlags & FLAG_NEGATIVE);
+ return UnicodeString(u"<Affix") + (isNegative ? u":negative " : u" ") +
+ (fPrefix ? fPrefix->getPattern() : u"null") + u"#" +
+ (fSuffix ? fSuffix->getPattern() : u"null") + u">";
+
+}
+
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/contrib/libs/icu/i18n/numparse_affixes.h b/contrib/libs/icu/i18n/numparse_affixes.h
index d18ed08833..97a17f4d78 100644
--- a/contrib/libs/icu/i18n/numparse_affixes.h
+++ b/contrib/libs/icu/i18n/numparse_affixes.h
@@ -1,225 +1,225 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMPARSE_AFFIXES_H__
-#define __NUMPARSE_AFFIXES_H__
-
-#include "cmemory.h"
-
-#include "numparse_types.h"
-#include "numparse_symbols.h"
-#include "numparse_currency.h"
-#include "number_affixutils.h"
-#include "number_currencysymbols.h"
-
-U_NAMESPACE_BEGIN
-namespace numparse {
-namespace impl {
-
-// Forward-declaration of implementation classes for friending
-class AffixPatternMatcherBuilder;
-class AffixPatternMatcher;
-
-using ::icu::number::impl::AffixPatternProvider;
-using ::icu::number::impl::TokenConsumer;
-using ::icu::number::impl::CurrencySymbols;
-
-
-class U_I18N_API CodePointMatcher : public NumberParseMatcher, public UMemory {
- public:
- CodePointMatcher() = default; // WARNING: Leaves the object in an unusable state
-
- CodePointMatcher(UChar32 cp);
-
- bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override;
-
- bool smokeTest(const StringSegment& segment) const override;
-
- UnicodeString toString() const override;
-
- private:
- UChar32 fCp;
-};
-
-} // namespace impl
-} // namespace numparse
-
-// Export a explicit template instantiations of MaybeStackArray, MemoryPool and CompactUnicodeString.
-// When building DLLs for Windows this is required even though no direct access leaks out of the i18n library.
-// (See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.)
-// Note: These need to be outside of the numparse::impl namespace, or Clang will generate a compile error.
-#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
-template class U_I18N_API MaybeStackArray<numparse::impl::CodePointMatcher*, 8>;
-template class U_I18N_API MaybeStackArray<UChar, 4>;
-template class U_I18N_API MemoryPool<numparse::impl::CodePointMatcher, 8>;
-template class U_I18N_API numparse::impl::CompactUnicodeString<4>;
-#endif
-
-namespace numparse {
-namespace impl {
-
-struct AffixTokenMatcherSetupData {
- const CurrencySymbols& currencySymbols;
- const DecimalFormatSymbols& dfs;
- IgnorablesMatcher& ignorables;
- const Locale& locale;
- parse_flags_t parseFlags;
-};
-
-
-/**
- * Small helper class that generates matchers for individual tokens for AffixPatternMatcher.
- *
- * In Java, this is called AffixTokenMatcherFactory (a "factory"). However, in C++, it is called a
- * "warehouse", because in addition to generating the matchers, it also retains ownership of them. The
- * warehouse must stay in scope for the whole lifespan of the AffixPatternMatcher that uses matchers from
- * the warehouse.
- *
- * @author sffc
- */
-// Exported as U_I18N_API for tests
-class U_I18N_API AffixTokenMatcherWarehouse : public UMemory {
- public:
- AffixTokenMatcherWarehouse() = default; // WARNING: Leaves the object in an unusable state
-
- AffixTokenMatcherWarehouse(const AffixTokenMatcherSetupData* setupData);
-
- NumberParseMatcher& minusSign();
-
- NumberParseMatcher& plusSign();
-
- NumberParseMatcher& percent();
-
- NumberParseMatcher& permille();
-
- NumberParseMatcher& currency(UErrorCode& status);
-
- IgnorablesMatcher& ignorables();
-
- NumberParseMatcher* nextCodePointMatcher(UChar32 cp, UErrorCode& status);
-
- private:
- // NOTE: The following field may be unsafe to access after construction is done!
- const AffixTokenMatcherSetupData* fSetupData;
-
- // NOTE: These are default-constructed and should not be used until initialized.
- MinusSignMatcher fMinusSign;
- PlusSignMatcher fPlusSign;
- PercentMatcher fPercent;
- PermilleMatcher fPermille;
- CombinedCurrencyMatcher fCurrency;
-
- // Use a child class for code point matchers, since it requires non-default operators.
- MemoryPool<CodePointMatcher> fCodePoints;
-
- friend class AffixPatternMatcherBuilder;
- friend class AffixPatternMatcher;
-};
-
-
-class AffixPatternMatcherBuilder : public TokenConsumer, public MutableMatcherCollection {
- public:
- AffixPatternMatcherBuilder(const UnicodeString& pattern, AffixTokenMatcherWarehouse& warehouse,
- IgnorablesMatcher* ignorables);
-
- void consumeToken(::icu::number::impl::AffixPatternType type, UChar32 cp, UErrorCode& status) override;
-
- /** NOTE: You can build only once! */
- AffixPatternMatcher build();
-
- private:
- ArraySeriesMatcher::MatcherArray fMatchers;
- int32_t fMatchersLen;
- int32_t fLastTypeOrCp;
-
- const UnicodeString& fPattern;
- AffixTokenMatcherWarehouse& fWarehouse;
- IgnorablesMatcher* fIgnorables;
-
- void addMatcher(NumberParseMatcher& matcher) override;
-};
-
-
-// Exported as U_I18N_API for tests
-class U_I18N_API AffixPatternMatcher : public ArraySeriesMatcher {
- public:
- AffixPatternMatcher() = default; // WARNING: Leaves the object in an unusable state
-
- static AffixPatternMatcher fromAffixPattern(const UnicodeString& affixPattern,
- AffixTokenMatcherWarehouse& warehouse,
- parse_flags_t parseFlags, bool* success,
- UErrorCode& status);
-
- UnicodeString getPattern() const;
-
- bool operator==(const AffixPatternMatcher& other) const;
-
- private:
- CompactUnicodeString<4> fPattern;
-
- AffixPatternMatcher(MatcherArray& matchers, int32_t matchersLen, const UnicodeString& pattern);
-
- friend class AffixPatternMatcherBuilder;
-};
-
-
-class AffixMatcher : public NumberParseMatcher, public UMemory {
- public:
- AffixMatcher() = default; // WARNING: Leaves the object in an unusable state
-
- AffixMatcher(AffixPatternMatcher* prefix, AffixPatternMatcher* suffix, result_flags_t flags);
-
- bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override;
-
- void postProcess(ParsedNumber& result) const override;
-
- bool smokeTest(const StringSegment& segment) const override;
-
- int8_t compareTo(const AffixMatcher& rhs) const;
-
- UnicodeString toString() const override;
-
- private:
- AffixPatternMatcher* fPrefix;
- AffixPatternMatcher* fSuffix;
- result_flags_t fFlags;
-};
-
-
-/**
- * A C++-only class to retain ownership of the AffixMatchers needed for parsing.
- */
-class AffixMatcherWarehouse {
- public:
- AffixMatcherWarehouse() = default; // WARNING: Leaves the object in an unusable state
-
- AffixMatcherWarehouse(AffixTokenMatcherWarehouse* tokenWarehouse);
-
- void createAffixMatchers(const AffixPatternProvider& patternInfo, MutableMatcherCollection& output,
- const IgnorablesMatcher& ignorables, parse_flags_t parseFlags,
- UErrorCode& status);
-
- private:
- // 9 is the limit: positive, zero, and negative, each with prefix, suffix, and prefix+suffix
- AffixMatcher fAffixMatchers[9];
- // 6 is the limit: positive, zero, and negative, a prefix and a suffix for each
- AffixPatternMatcher fAffixPatternMatchers[6];
- // Reference to the warehouse for tokens used by the AffixPatternMatchers
- AffixTokenMatcherWarehouse* fTokenWarehouse;
-
- friend class AffixMatcher;
-
- static bool isInteresting(const AffixPatternProvider& patternInfo, const IgnorablesMatcher& ignorables,
- parse_flags_t parseFlags, UErrorCode& status);
-};
-
-
-} // namespace impl
-} // namespace numparse
-U_NAMESPACE_END
-
-#endif //__NUMPARSE_AFFIXES_H__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMPARSE_AFFIXES_H__
+#define __NUMPARSE_AFFIXES_H__
+
+#include "cmemory.h"
+
+#include "numparse_types.h"
+#include "numparse_symbols.h"
+#include "numparse_currency.h"
+#include "number_affixutils.h"
+#include "number_currencysymbols.h"
+
+U_NAMESPACE_BEGIN
+namespace numparse {
+namespace impl {
+
+// Forward-declaration of implementation classes for friending
+class AffixPatternMatcherBuilder;
+class AffixPatternMatcher;
+
+using ::icu::number::impl::AffixPatternProvider;
+using ::icu::number::impl::TokenConsumer;
+using ::icu::number::impl::CurrencySymbols;
+
+
+class U_I18N_API CodePointMatcher : public NumberParseMatcher, public UMemory {
+ public:
+ CodePointMatcher() = default; // WARNING: Leaves the object in an unusable state
+
+ CodePointMatcher(UChar32 cp);
+
+ bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override;
+
+ bool smokeTest(const StringSegment& segment) const override;
+
+ UnicodeString toString() const override;
+
+ private:
+ UChar32 fCp;
+};
+
+} // namespace impl
+} // namespace numparse
+
+// Export a explicit template instantiations of MaybeStackArray, MemoryPool and CompactUnicodeString.
+// When building DLLs for Windows this is required even though no direct access leaks out of the i18n library.
+// (See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.)
+// Note: These need to be outside of the numparse::impl namespace, or Clang will generate a compile error.
+#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
+template class U_I18N_API MaybeStackArray<numparse::impl::CodePointMatcher*, 8>;
+template class U_I18N_API MaybeStackArray<UChar, 4>;
+template class U_I18N_API MemoryPool<numparse::impl::CodePointMatcher, 8>;
+template class U_I18N_API numparse::impl::CompactUnicodeString<4>;
+#endif
+
+namespace numparse {
+namespace impl {
+
+struct AffixTokenMatcherSetupData {
+ const CurrencySymbols& currencySymbols;
+ const DecimalFormatSymbols& dfs;
+ IgnorablesMatcher& ignorables;
+ const Locale& locale;
+ parse_flags_t parseFlags;
+};
+
+
+/**
+ * Small helper class that generates matchers for individual tokens for AffixPatternMatcher.
+ *
+ * In Java, this is called AffixTokenMatcherFactory (a "factory"). However, in C++, it is called a
+ * "warehouse", because in addition to generating the matchers, it also retains ownership of them. The
+ * warehouse must stay in scope for the whole lifespan of the AffixPatternMatcher that uses matchers from
+ * the warehouse.
+ *
+ * @author sffc
+ */
+// Exported as U_I18N_API for tests
+class U_I18N_API AffixTokenMatcherWarehouse : public UMemory {
+ public:
+ AffixTokenMatcherWarehouse() = default; // WARNING: Leaves the object in an unusable state
+
+ AffixTokenMatcherWarehouse(const AffixTokenMatcherSetupData* setupData);
+
+ NumberParseMatcher& minusSign();
+
+ NumberParseMatcher& plusSign();
+
+ NumberParseMatcher& percent();
+
+ NumberParseMatcher& permille();
+
+ NumberParseMatcher& currency(UErrorCode& status);
+
+ IgnorablesMatcher& ignorables();
+
+ NumberParseMatcher* nextCodePointMatcher(UChar32 cp, UErrorCode& status);
+
+ private:
+ // NOTE: The following field may be unsafe to access after construction is done!
+ const AffixTokenMatcherSetupData* fSetupData;
+
+ // NOTE: These are default-constructed and should not be used until initialized.
+ MinusSignMatcher fMinusSign;
+ PlusSignMatcher fPlusSign;
+ PercentMatcher fPercent;
+ PermilleMatcher fPermille;
+ CombinedCurrencyMatcher fCurrency;
+
+ // Use a child class for code point matchers, since it requires non-default operators.
+ MemoryPool<CodePointMatcher> fCodePoints;
+
+ friend class AffixPatternMatcherBuilder;
+ friend class AffixPatternMatcher;
+};
+
+
+class AffixPatternMatcherBuilder : public TokenConsumer, public MutableMatcherCollection {
+ public:
+ AffixPatternMatcherBuilder(const UnicodeString& pattern, AffixTokenMatcherWarehouse& warehouse,
+ IgnorablesMatcher* ignorables);
+
+ void consumeToken(::icu::number::impl::AffixPatternType type, UChar32 cp, UErrorCode& status) override;
+
+ /** NOTE: You can build only once! */
+ AffixPatternMatcher build();
+
+ private:
+ ArraySeriesMatcher::MatcherArray fMatchers;
+ int32_t fMatchersLen;
+ int32_t fLastTypeOrCp;
+
+ const UnicodeString& fPattern;
+ AffixTokenMatcherWarehouse& fWarehouse;
+ IgnorablesMatcher* fIgnorables;
+
+ void addMatcher(NumberParseMatcher& matcher) override;
+};
+
+
+// Exported as U_I18N_API for tests
+class U_I18N_API AffixPatternMatcher : public ArraySeriesMatcher {
+ public:
+ AffixPatternMatcher() = default; // WARNING: Leaves the object in an unusable state
+
+ static AffixPatternMatcher fromAffixPattern(const UnicodeString& affixPattern,
+ AffixTokenMatcherWarehouse& warehouse,
+ parse_flags_t parseFlags, bool* success,
+ UErrorCode& status);
+
+ UnicodeString getPattern() const;
+
+ bool operator==(const AffixPatternMatcher& other) const;
+
+ private:
+ CompactUnicodeString<4> fPattern;
+
+ AffixPatternMatcher(MatcherArray& matchers, int32_t matchersLen, const UnicodeString& pattern);
+
+ friend class AffixPatternMatcherBuilder;
+};
+
+
+class AffixMatcher : public NumberParseMatcher, public UMemory {
+ public:
+ AffixMatcher() = default; // WARNING: Leaves the object in an unusable state
+
+ AffixMatcher(AffixPatternMatcher* prefix, AffixPatternMatcher* suffix, result_flags_t flags);
+
+ bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override;
+
+ void postProcess(ParsedNumber& result) const override;
+
+ bool smokeTest(const StringSegment& segment) const override;
+
+ int8_t compareTo(const AffixMatcher& rhs) const;
+
+ UnicodeString toString() const override;
+
+ private:
+ AffixPatternMatcher* fPrefix;
+ AffixPatternMatcher* fSuffix;
+ result_flags_t fFlags;
+};
+
+
+/**
+ * A C++-only class to retain ownership of the AffixMatchers needed for parsing.
+ */
+class AffixMatcherWarehouse {
+ public:
+ AffixMatcherWarehouse() = default; // WARNING: Leaves the object in an unusable state
+
+ AffixMatcherWarehouse(AffixTokenMatcherWarehouse* tokenWarehouse);
+
+ void createAffixMatchers(const AffixPatternProvider& patternInfo, MutableMatcherCollection& output,
+ const IgnorablesMatcher& ignorables, parse_flags_t parseFlags,
+ UErrorCode& status);
+
+ private:
+ // 9 is the limit: positive, zero, and negative, each with prefix, suffix, and prefix+suffix
+ AffixMatcher fAffixMatchers[9];
+ // 6 is the limit: positive, zero, and negative, a prefix and a suffix for each
+ AffixPatternMatcher fAffixPatternMatchers[6];
+ // Reference to the warehouse for tokens used by the AffixPatternMatchers
+ AffixTokenMatcherWarehouse* fTokenWarehouse;
+
+ friend class AffixMatcher;
+
+ static bool isInteresting(const AffixPatternProvider& patternInfo, const IgnorablesMatcher& ignorables,
+ parse_flags_t parseFlags, UErrorCode& status);
+};
+
+
+} // namespace impl
+} // namespace numparse
+U_NAMESPACE_END
+
+#endif //__NUMPARSE_AFFIXES_H__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numparse_compositions.cpp b/contrib/libs/icu/i18n/numparse_compositions.cpp
index f343b5a043..2f7e1ab28d 100644
--- a/contrib/libs/icu/i18n/numparse_compositions.cpp
+++ b/contrib/libs/icu/i18n/numparse_compositions.cpp
@@ -1,108 +1,108 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include "numparse_types.h"
-#include "numparse_compositions.h"
-#include "string_segment.h"
-#include "unicode/uniset.h"
-
-using namespace icu;
-using namespace icu::numparse;
-using namespace icu::numparse::impl;
-
-
-bool SeriesMatcher::match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const {
- ParsedNumber backup(result);
-
- int32_t initialOffset = segment.getOffset();
- bool maybeMore = true;
- for (auto* it = begin(); it < end();) {
- const NumberParseMatcher* matcher = *it;
- int matcherOffset = segment.getOffset();
- if (segment.length() != 0) {
- maybeMore = matcher->match(segment, result, status);
- } else {
- // Nothing for this matcher to match; ask for more.
- maybeMore = true;
- }
-
- bool success = (segment.getOffset() != matcherOffset);
- bool isFlexible = matcher->isFlexible();
- if (success && isFlexible) {
- // Match succeeded, and this is a flexible matcher. Re-run it.
- } else if (success) {
- // Match succeeded, and this is NOT a flexible matcher. Proceed to the next matcher.
- it++;
- // Small hack: if there is another matcher coming, do not accept trailing weak chars.
- // Needed for proper handling of currency spacing.
- if (it < end() && segment.getOffset() != result.charEnd && result.charEnd > matcherOffset) {
- segment.setOffset(result.charEnd);
- }
- } else if (isFlexible) {
- // Match failed, and this is a flexible matcher. Try again with the next matcher.
- it++;
- } else {
- // Match failed, and this is NOT a flexible matcher. Exit.
- segment.setOffset(initialOffset);
- result = backup;
- return maybeMore;
- }
- }
-
- // All matchers in the series succeeded.
- return maybeMore;
-}
-
-bool SeriesMatcher::smokeTest(const StringSegment& segment) const {
- // NOTE: The range-based for loop calls the virtual begin() and end() methods.
- // NOTE: We only want the first element. Use the for loop for boundary checking.
- for (auto& matcher : *this) {
- // SeriesMatchers are never allowed to start with a Flexible matcher.
- U_ASSERT(!matcher->isFlexible());
- return matcher->smokeTest(segment);
- }
- return false;
-}
-
-void SeriesMatcher::postProcess(ParsedNumber& result) const {
- // NOTE: The range-based for loop calls the virtual begin() and end() methods.
- for (auto* matcher : *this) {
- matcher->postProcess(result);
- }
-}
-
-
-ArraySeriesMatcher::ArraySeriesMatcher()
- : fMatchersLen(0) {
-}
-
-ArraySeriesMatcher::ArraySeriesMatcher(MatcherArray& matchers, int32_t matchersLen)
- : fMatchers(std::move(matchers)), fMatchersLen(matchersLen) {
-}
-
-int32_t ArraySeriesMatcher::length() const {
- return fMatchersLen;
-}
-
-const NumberParseMatcher* const* ArraySeriesMatcher::begin() const {
- return fMatchers.getAlias();
-}
-
-const NumberParseMatcher* const* ArraySeriesMatcher::end() const {
- return fMatchers.getAlias() + fMatchersLen;
-}
-
-UnicodeString ArraySeriesMatcher::toString() const {
- return u"<ArraySeries>";
-}
-
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include "numparse_types.h"
+#include "numparse_compositions.h"
+#include "string_segment.h"
+#include "unicode/uniset.h"
+
+using namespace icu;
+using namespace icu::numparse;
+using namespace icu::numparse::impl;
+
+
+bool SeriesMatcher::match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const {
+ ParsedNumber backup(result);
+
+ int32_t initialOffset = segment.getOffset();
+ bool maybeMore = true;
+ for (auto* it = begin(); it < end();) {
+ const NumberParseMatcher* matcher = *it;
+ int matcherOffset = segment.getOffset();
+ if (segment.length() != 0) {
+ maybeMore = matcher->match(segment, result, status);
+ } else {
+ // Nothing for this matcher to match; ask for more.
+ maybeMore = true;
+ }
+
+ bool success = (segment.getOffset() != matcherOffset);
+ bool isFlexible = matcher->isFlexible();
+ if (success && isFlexible) {
+ // Match succeeded, and this is a flexible matcher. Re-run it.
+ } else if (success) {
+ // Match succeeded, and this is NOT a flexible matcher. Proceed to the next matcher.
+ it++;
+ // Small hack: if there is another matcher coming, do not accept trailing weak chars.
+ // Needed for proper handling of currency spacing.
+ if (it < end() && segment.getOffset() != result.charEnd && result.charEnd > matcherOffset) {
+ segment.setOffset(result.charEnd);
+ }
+ } else if (isFlexible) {
+ // Match failed, and this is a flexible matcher. Try again with the next matcher.
+ it++;
+ } else {
+ // Match failed, and this is NOT a flexible matcher. Exit.
+ segment.setOffset(initialOffset);
+ result = backup;
+ return maybeMore;
+ }
+ }
+
+ // All matchers in the series succeeded.
+ return maybeMore;
+}
+
+bool SeriesMatcher::smokeTest(const StringSegment& segment) const {
+ // NOTE: The range-based for loop calls the virtual begin() and end() methods.
+ // NOTE: We only want the first element. Use the for loop for boundary checking.
+ for (auto& matcher : *this) {
+ // SeriesMatchers are never allowed to start with a Flexible matcher.
+ U_ASSERT(!matcher->isFlexible());
+ return matcher->smokeTest(segment);
+ }
+ return false;
+}
+
+void SeriesMatcher::postProcess(ParsedNumber& result) const {
+ // NOTE: The range-based for loop calls the virtual begin() and end() methods.
+ for (auto* matcher : *this) {
+ matcher->postProcess(result);
+ }
+}
+
+
+ArraySeriesMatcher::ArraySeriesMatcher()
+ : fMatchersLen(0) {
+}
+
+ArraySeriesMatcher::ArraySeriesMatcher(MatcherArray& matchers, int32_t matchersLen)
+ : fMatchers(std::move(matchers)), fMatchersLen(matchersLen) {
+}
+
+int32_t ArraySeriesMatcher::length() const {
+ return fMatchersLen;
+}
+
+const NumberParseMatcher* const* ArraySeriesMatcher::begin() const {
+ return fMatchers.getAlias();
+}
+
+const NumberParseMatcher* const* ArraySeriesMatcher::end() const {
+ return fMatchers.getAlias() + fMatchersLen;
+}
+
+UnicodeString ArraySeriesMatcher::toString() const {
+ return u"<ArraySeries>";
+}
+
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numparse_compositions.h b/contrib/libs/icu/i18n/numparse_compositions.h
index 9ed7f474eb..f085912def 100644
--- a/contrib/libs/icu/i18n/numparse_compositions.h
+++ b/contrib/libs/icu/i18n/numparse_compositions.h
@@ -1,124 +1,124 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __SOURCE_NUMPARSE_COMPOSITIONS__
-#define __SOURCE_NUMPARSE_COMPOSITIONS__
-
-#include "numparse_types.h"
-
-U_NAMESPACE_BEGIN
-
-// Export an explicit template instantiation of the MaybeStackArray that is used as a data member of ArraySeriesMatcher.
-// When building DLLs for Windows this is required even though no direct access to the MaybeStackArray leaks out of the i18n library.
-// (See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.)
-#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
-template class U_I18N_API MaybeStackArray<const numparse::impl::NumberParseMatcher*, 3>;
-#endif
-
-namespace numparse {
-namespace impl {
-
-/**
- * Base class for AnyMatcher and SeriesMatcher.
- */
-// Exported as U_I18N_API for tests
-class U_I18N_API CompositionMatcher : public NumberParseMatcher {
- protected:
- // No construction except by subclasses!
- CompositionMatcher() = default;
-
- // To be overridden by subclasses (used for iteration):
- virtual const NumberParseMatcher* const* begin() const = 0;
-
- // To be overridden by subclasses (used for iteration):
- virtual const NumberParseMatcher* const* end() const = 0;
-};
-
-
-// NOTE: AnyMatcher is no longer being used. The previous definition is shown below.
-// The implementation can be found in SVN source control, deleted around March 30, 2018.
-///**
-// * Composes a number of matchers, and succeeds if any of the matchers succeed. Always greedily chooses
-// * the first matcher in the list to succeed.
-// *
-// * NOTE: In C++, this is a base class, unlike ICU4J, which uses a factory-style interface.
-// *
-// * @author sffc
-// * @see SeriesMatcher
-// */
-//class AnyMatcher : public CompositionMatcher {
-// public:
-// bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override;
-//
-// bool smokeTest(const StringSegment& segment) const override;
-//
-// void postProcess(ParsedNumber& result) const override;
-//
-// protected:
-// // No construction except by subclasses!
-// AnyMatcher() = default;
-//};
-
-
-/**
- * Composes a number of matchers, running one after another. Matches the input string only if all of the
- * matchers in the series succeed. Performs greedy matches within the context of the series.
- *
- * @author sffc
- * @see AnyMatcher
- */
-// Exported as U_I18N_API for tests
-class U_I18N_API SeriesMatcher : public CompositionMatcher {
- public:
- bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override;
-
- bool smokeTest(const StringSegment& segment) const override;
-
- void postProcess(ParsedNumber& result) const override;
-
- virtual int32_t length() const = 0;
-
- protected:
- // No construction except by subclasses!
- SeriesMatcher() = default;
-};
-
-/**
- * An implementation of SeriesMatcher that references an array of matchers.
- *
- * The object adopts the array, but NOT the matchers contained inside the array.
- */
-// Exported as U_I18N_API for tests
-class U_I18N_API ArraySeriesMatcher : public SeriesMatcher {
- public:
- ArraySeriesMatcher(); // WARNING: Leaves the object in an unusable state
-
- typedef MaybeStackArray<const NumberParseMatcher*, 3> MatcherArray;
-
- /** The array is std::move'd */
- ArraySeriesMatcher(MatcherArray& matchers, int32_t matchersLen);
-
- UnicodeString toString() const override;
-
- int32_t length() const override;
-
- protected:
- const NumberParseMatcher* const* begin() const override;
-
- const NumberParseMatcher* const* end() const override;
-
- private:
- MatcherArray fMatchers;
- int32_t fMatchersLen;
-};
-
-
-} // namespace impl
-} // namespace numparse
-U_NAMESPACE_END
-
-#endif //__SOURCE_NUMPARSE_COMPOSITIONS__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __SOURCE_NUMPARSE_COMPOSITIONS__
+#define __SOURCE_NUMPARSE_COMPOSITIONS__
+
+#include "numparse_types.h"
+
+U_NAMESPACE_BEGIN
+
+// Export an explicit template instantiation of the MaybeStackArray that is used as a data member of ArraySeriesMatcher.
+// When building DLLs for Windows this is required even though no direct access to the MaybeStackArray leaks out of the i18n library.
+// (See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.)
+#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
+template class U_I18N_API MaybeStackArray<const numparse::impl::NumberParseMatcher*, 3>;
+#endif
+
+namespace numparse {
+namespace impl {
+
+/**
+ * Base class for AnyMatcher and SeriesMatcher.
+ */
+// Exported as U_I18N_API for tests
+class U_I18N_API CompositionMatcher : public NumberParseMatcher {
+ protected:
+ // No construction except by subclasses!
+ CompositionMatcher() = default;
+
+ // To be overridden by subclasses (used for iteration):
+ virtual const NumberParseMatcher* const* begin() const = 0;
+
+ // To be overridden by subclasses (used for iteration):
+ virtual const NumberParseMatcher* const* end() const = 0;
+};
+
+
+// NOTE: AnyMatcher is no longer being used. The previous definition is shown below.
+// The implementation can be found in SVN source control, deleted around March 30, 2018.
+///**
+// * Composes a number of matchers, and succeeds if any of the matchers succeed. Always greedily chooses
+// * the first matcher in the list to succeed.
+// *
+// * NOTE: In C++, this is a base class, unlike ICU4J, which uses a factory-style interface.
+// *
+// * @author sffc
+// * @see SeriesMatcher
+// */
+//class AnyMatcher : public CompositionMatcher {
+// public:
+// bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override;
+//
+// bool smokeTest(const StringSegment& segment) const override;
+//
+// void postProcess(ParsedNumber& result) const override;
+//
+// protected:
+// // No construction except by subclasses!
+// AnyMatcher() = default;
+//};
+
+
+/**
+ * Composes a number of matchers, running one after another. Matches the input string only if all of the
+ * matchers in the series succeed. Performs greedy matches within the context of the series.
+ *
+ * @author sffc
+ * @see AnyMatcher
+ */
+// Exported as U_I18N_API for tests
+class U_I18N_API SeriesMatcher : public CompositionMatcher {
+ public:
+ bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override;
+
+ bool smokeTest(const StringSegment& segment) const override;
+
+ void postProcess(ParsedNumber& result) const override;
+
+ virtual int32_t length() const = 0;
+
+ protected:
+ // No construction except by subclasses!
+ SeriesMatcher() = default;
+};
+
+/**
+ * An implementation of SeriesMatcher that references an array of matchers.
+ *
+ * The object adopts the array, but NOT the matchers contained inside the array.
+ */
+// Exported as U_I18N_API for tests
+class U_I18N_API ArraySeriesMatcher : public SeriesMatcher {
+ public:
+ ArraySeriesMatcher(); // WARNING: Leaves the object in an unusable state
+
+ typedef MaybeStackArray<const NumberParseMatcher*, 3> MatcherArray;
+
+ /** The array is std::move'd */
+ ArraySeriesMatcher(MatcherArray& matchers, int32_t matchersLen);
+
+ UnicodeString toString() const override;
+
+ int32_t length() const override;
+
+ protected:
+ const NumberParseMatcher* const* begin() const override;
+
+ const NumberParseMatcher* const* end() const override;
+
+ private:
+ MatcherArray fMatchers;
+ int32_t fMatchersLen;
+};
+
+
+} // namespace impl
+} // namespace numparse
+U_NAMESPACE_END
+
+#endif //__SOURCE_NUMPARSE_COMPOSITIONS__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numparse_currency.cpp b/contrib/libs/icu/i18n/numparse_currency.cpp
index 1fc8154cfb..6b53a73edf 100644
--- a/contrib/libs/icu/i18n/numparse_currency.cpp
+++ b/contrib/libs/icu/i18n/numparse_currency.cpp
@@ -1,189 +1,189 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include "numparse_types.h"
-#include "numparse_currency.h"
-#include "ucurrimp.h"
-#include "unicode/errorcode.h"
-#include "numparse_utils.h"
-#include "string_segment.h"
-
-using namespace icu;
-using namespace icu::numparse;
-using namespace icu::numparse::impl;
-
-
-CombinedCurrencyMatcher::CombinedCurrencyMatcher(const CurrencySymbols& currencySymbols, const DecimalFormatSymbols& dfs,
- parse_flags_t parseFlags, UErrorCode& status)
- : fCurrency1(currencySymbols.getCurrencySymbol(status)),
- fCurrency2(currencySymbols.getIntlCurrencySymbol(status)),
- fUseFullCurrencyData(0 == (parseFlags & PARSE_FLAG_NO_FOREIGN_CURRENCY)),
- afterPrefixInsert(dfs.getPatternForCurrencySpacing(UNUM_CURRENCY_INSERT, false, status)),
- beforeSuffixInsert(dfs.getPatternForCurrencySpacing(UNUM_CURRENCY_INSERT, true, status)),
- fLocaleName(dfs.getLocale().getName(), -1, status) {
- utils::copyCurrencyCode(fCurrencyCode, currencySymbols.getIsoCode());
-
- // Pre-load the long names for the current locale and currency
- // if we are parsing without the full currency data.
- if (!fUseFullCurrencyData) {
- for (int32_t i=0; i<StandardPlural::COUNT; i++) {
- auto plural = static_cast<StandardPlural::Form>(i);
- fLocalLongNames[i] = currencySymbols.getPluralName(plural, status);
- }
- }
-
- // TODO: Figure out how to make this faster and re-enable.
- // Computing the "lead code points" set for fastpathing is too slow to use in production.
- // See http://bugs.icu-project.org/trac/ticket/13584
-// // Compute the full set of characters that could be the first in a currency to allow for
-// // efficient smoke test.
-// fLeadCodePoints.add(fCurrency1.char32At(0));
-// fLeadCodePoints.add(fCurrency2.char32At(0));
-// fLeadCodePoints.add(beforeSuffixInsert.char32At(0));
-// uprv_currencyLeads(fLocaleName.data(), fLeadCodePoints, status);
-// // Always apply case mapping closure for currencies
-// fLeadCodePoints.closeOver(USET_ADD_CASE_MAPPINGS);
-// fLeadCodePoints.freeze();
-}
-
-bool
-CombinedCurrencyMatcher::match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const {
- if (result.currencyCode[0] != 0) {
- return false;
- }
-
- // Try to match a currency spacing separator.
- int32_t initialOffset = segment.getOffset();
- bool maybeMore = false;
- if (result.seenNumber() && !beforeSuffixInsert.isEmpty()) {
- int32_t overlap = segment.getCommonPrefixLength(beforeSuffixInsert);
- if (overlap == beforeSuffixInsert.length()) {
- segment.adjustOffset(overlap);
- // Note: let currency spacing be a weak match. Don't update chars consumed.
- }
- maybeMore = maybeMore || overlap == segment.length();
- }
-
- // Match the currency string, and reset if we didn't find one.
- maybeMore = maybeMore || matchCurrency(segment, result, status);
- if (result.currencyCode[0] == 0) {
- segment.setOffset(initialOffset);
- return maybeMore;
- }
-
- // Try to match a currency spacing separator.
- if (!result.seenNumber() && !afterPrefixInsert.isEmpty()) {
- int32_t overlap = segment.getCommonPrefixLength(afterPrefixInsert);
- if (overlap == afterPrefixInsert.length()) {
- segment.adjustOffset(overlap);
- // Note: let currency spacing be a weak match. Don't update chars consumed.
- }
- maybeMore = maybeMore || overlap == segment.length();
- }
-
- return maybeMore;
-}
-
-bool CombinedCurrencyMatcher::matchCurrency(StringSegment& segment, ParsedNumber& result,
- UErrorCode& status) const {
- bool maybeMore = false;
-
- int32_t overlap1;
- if (!fCurrency1.isEmpty()) {
- overlap1 = segment.getCaseSensitivePrefixLength(fCurrency1);
- } else {
- overlap1 = -1;
- }
- maybeMore = maybeMore || overlap1 == segment.length();
- if (overlap1 == fCurrency1.length()) {
- utils::copyCurrencyCode(result.currencyCode, fCurrencyCode);
- segment.adjustOffset(overlap1);
- result.setCharsConsumed(segment);
- return maybeMore;
- }
-
- int32_t overlap2;
- if (!fCurrency2.isEmpty()) {
- // ISO codes should be accepted case-insensitive.
- // https://unicode-org.atlassian.net/browse/ICU-13696
- overlap2 = segment.getCommonPrefixLength(fCurrency2);
- } else {
- overlap2 = -1;
- }
- maybeMore = maybeMore || overlap2 == segment.length();
- if (overlap2 == fCurrency2.length()) {
- utils::copyCurrencyCode(result.currencyCode, fCurrencyCode);
- segment.adjustOffset(overlap2);
- result.setCharsConsumed(segment);
- return maybeMore;
- }
-
- if (fUseFullCurrencyData) {
- // Use the full currency data.
- // NOTE: This call site should be improved with #13584.
- const UnicodeString segmentString = segment.toTempUnicodeString();
-
- // Try to parse the currency
- ParsePosition ppos(0);
- int32_t partialMatchLen = 0;
- uprv_parseCurrency(
- fLocaleName.data(),
- segmentString,
- ppos,
- UCURR_SYMBOL_NAME, // checks for both UCURR_SYMBOL_NAME and UCURR_LONG_NAME
- &partialMatchLen,
- result.currencyCode,
- status);
- maybeMore = maybeMore || partialMatchLen == segment.length();
-
- if (U_SUCCESS(status) && ppos.getIndex() != 0) {
- // Complete match.
- // NOTE: The currency code should already be saved in the ParsedNumber.
- segment.adjustOffset(ppos.getIndex());
- result.setCharsConsumed(segment);
- return maybeMore;
- }
-
- } else {
- // Use the locale long names.
- int32_t longestFullMatch = 0;
- for (int32_t i=0; i<StandardPlural::COUNT; i++) {
- const UnicodeString& name = fLocalLongNames[i];
- int32_t overlap = segment.getCommonPrefixLength(name);
- if (overlap == name.length() && name.length() > longestFullMatch) {
- longestFullMatch = name.length();
- }
- maybeMore = maybeMore || overlap > 0;
- }
- if (longestFullMatch > 0) {
- utils::copyCurrencyCode(result.currencyCode, fCurrencyCode);
- segment.adjustOffset(longestFullMatch);
- result.setCharsConsumed(segment);
- return maybeMore;
- }
- }
-
- // No match found.
- return maybeMore;
-}
-
-bool CombinedCurrencyMatcher::smokeTest(const StringSegment&) const {
- // TODO: See constructor
- return true;
- //return segment.startsWith(fLeadCodePoints);
-}
-
-UnicodeString CombinedCurrencyMatcher::toString() const {
- return u"<CombinedCurrencyMatcher>";
-}
-
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include "numparse_types.h"
+#include "numparse_currency.h"
+#include "ucurrimp.h"
+#include "unicode/errorcode.h"
+#include "numparse_utils.h"
+#include "string_segment.h"
+
+using namespace icu;
+using namespace icu::numparse;
+using namespace icu::numparse::impl;
+
+
+CombinedCurrencyMatcher::CombinedCurrencyMatcher(const CurrencySymbols& currencySymbols, const DecimalFormatSymbols& dfs,
+ parse_flags_t parseFlags, UErrorCode& status)
+ : fCurrency1(currencySymbols.getCurrencySymbol(status)),
+ fCurrency2(currencySymbols.getIntlCurrencySymbol(status)),
+ fUseFullCurrencyData(0 == (parseFlags & PARSE_FLAG_NO_FOREIGN_CURRENCY)),
+ afterPrefixInsert(dfs.getPatternForCurrencySpacing(UNUM_CURRENCY_INSERT, false, status)),
+ beforeSuffixInsert(dfs.getPatternForCurrencySpacing(UNUM_CURRENCY_INSERT, true, status)),
+ fLocaleName(dfs.getLocale().getName(), -1, status) {
+ utils::copyCurrencyCode(fCurrencyCode, currencySymbols.getIsoCode());
+
+ // Pre-load the long names for the current locale and currency
+ // if we are parsing without the full currency data.
+ if (!fUseFullCurrencyData) {
+ for (int32_t i=0; i<StandardPlural::COUNT; i++) {
+ auto plural = static_cast<StandardPlural::Form>(i);
+ fLocalLongNames[i] = currencySymbols.getPluralName(plural, status);
+ }
+ }
+
+ // TODO: Figure out how to make this faster and re-enable.
+ // Computing the "lead code points" set for fastpathing is too slow to use in production.
+ // See http://bugs.icu-project.org/trac/ticket/13584
+// // Compute the full set of characters that could be the first in a currency to allow for
+// // efficient smoke test.
+// fLeadCodePoints.add(fCurrency1.char32At(0));
+// fLeadCodePoints.add(fCurrency2.char32At(0));
+// fLeadCodePoints.add(beforeSuffixInsert.char32At(0));
+// uprv_currencyLeads(fLocaleName.data(), fLeadCodePoints, status);
+// // Always apply case mapping closure for currencies
+// fLeadCodePoints.closeOver(USET_ADD_CASE_MAPPINGS);
+// fLeadCodePoints.freeze();
+}
+
+bool
+CombinedCurrencyMatcher::match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const {
+ if (result.currencyCode[0] != 0) {
+ return false;
+ }
+
+ // Try to match a currency spacing separator.
+ int32_t initialOffset = segment.getOffset();
+ bool maybeMore = false;
+ if (result.seenNumber() && !beforeSuffixInsert.isEmpty()) {
+ int32_t overlap = segment.getCommonPrefixLength(beforeSuffixInsert);
+ if (overlap == beforeSuffixInsert.length()) {
+ segment.adjustOffset(overlap);
+ // Note: let currency spacing be a weak match. Don't update chars consumed.
+ }
+ maybeMore = maybeMore || overlap == segment.length();
+ }
+
+ // Match the currency string, and reset if we didn't find one.
+ maybeMore = maybeMore || matchCurrency(segment, result, status);
+ if (result.currencyCode[0] == 0) {
+ segment.setOffset(initialOffset);
+ return maybeMore;
+ }
+
+ // Try to match a currency spacing separator.
+ if (!result.seenNumber() && !afterPrefixInsert.isEmpty()) {
+ int32_t overlap = segment.getCommonPrefixLength(afterPrefixInsert);
+ if (overlap == afterPrefixInsert.length()) {
+ segment.adjustOffset(overlap);
+ // Note: let currency spacing be a weak match. Don't update chars consumed.
+ }
+ maybeMore = maybeMore || overlap == segment.length();
+ }
+
+ return maybeMore;
+}
+
+bool CombinedCurrencyMatcher::matchCurrency(StringSegment& segment, ParsedNumber& result,
+ UErrorCode& status) const {
+ bool maybeMore = false;
+
+ int32_t overlap1;
+ if (!fCurrency1.isEmpty()) {
+ overlap1 = segment.getCaseSensitivePrefixLength(fCurrency1);
+ } else {
+ overlap1 = -1;
+ }
+ maybeMore = maybeMore || overlap1 == segment.length();
+ if (overlap1 == fCurrency1.length()) {
+ utils::copyCurrencyCode(result.currencyCode, fCurrencyCode);
+ segment.adjustOffset(overlap1);
+ result.setCharsConsumed(segment);
+ return maybeMore;
+ }
+
+ int32_t overlap2;
+ if (!fCurrency2.isEmpty()) {
+ // ISO codes should be accepted case-insensitive.
+ // https://unicode-org.atlassian.net/browse/ICU-13696
+ overlap2 = segment.getCommonPrefixLength(fCurrency2);
+ } else {
+ overlap2 = -1;
+ }
+ maybeMore = maybeMore || overlap2 == segment.length();
+ if (overlap2 == fCurrency2.length()) {
+ utils::copyCurrencyCode(result.currencyCode, fCurrencyCode);
+ segment.adjustOffset(overlap2);
+ result.setCharsConsumed(segment);
+ return maybeMore;
+ }
+
+ if (fUseFullCurrencyData) {
+ // Use the full currency data.
+ // NOTE: This call site should be improved with #13584.
+ const UnicodeString segmentString = segment.toTempUnicodeString();
+
+ // Try to parse the currency
+ ParsePosition ppos(0);
+ int32_t partialMatchLen = 0;
+ uprv_parseCurrency(
+ fLocaleName.data(),
+ segmentString,
+ ppos,
+ UCURR_SYMBOL_NAME, // checks for both UCURR_SYMBOL_NAME and UCURR_LONG_NAME
+ &partialMatchLen,
+ result.currencyCode,
+ status);
+ maybeMore = maybeMore || partialMatchLen == segment.length();
+
+ if (U_SUCCESS(status) && ppos.getIndex() != 0) {
+ // Complete match.
+ // NOTE: The currency code should already be saved in the ParsedNumber.
+ segment.adjustOffset(ppos.getIndex());
+ result.setCharsConsumed(segment);
+ return maybeMore;
+ }
+
+ } else {
+ // Use the locale long names.
+ int32_t longestFullMatch = 0;
+ for (int32_t i=0; i<StandardPlural::COUNT; i++) {
+ const UnicodeString& name = fLocalLongNames[i];
+ int32_t overlap = segment.getCommonPrefixLength(name);
+ if (overlap == name.length() && name.length() > longestFullMatch) {
+ longestFullMatch = name.length();
+ }
+ maybeMore = maybeMore || overlap > 0;
+ }
+ if (longestFullMatch > 0) {
+ utils::copyCurrencyCode(result.currencyCode, fCurrencyCode);
+ segment.adjustOffset(longestFullMatch);
+ result.setCharsConsumed(segment);
+ return maybeMore;
+ }
+ }
+
+ // No match found.
+ return maybeMore;
+}
+
+bool CombinedCurrencyMatcher::smokeTest(const StringSegment&) const {
+ // TODO: See constructor
+ return true;
+ //return segment.startsWith(fLeadCodePoints);
+}
+
+UnicodeString CombinedCurrencyMatcher::toString() const {
+ return u"<CombinedCurrencyMatcher>";
+}
+
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numparse_currency.h b/contrib/libs/icu/i18n/numparse_currency.h
index 812c6b4b04..a94943312f 100644
--- a/contrib/libs/icu/i18n/numparse_currency.h
+++ b/contrib/libs/icu/i18n/numparse_currency.h
@@ -1,74 +1,74 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMPARSE_CURRENCY_H__
-#define __NUMPARSE_CURRENCY_H__
-
-#include "numparse_types.h"
-#include "numparse_compositions.h"
-#include "charstr.h"
-#include "number_currencysymbols.h"
-#include "unicode/uniset.h"
-
-U_NAMESPACE_BEGIN namespace numparse {
-namespace impl {
-
-using ::icu::number::impl::CurrencySymbols;
-
-/**
- * Matches a currency, either a custom currency or one from the data bundle. The class is called
- * "combined" to emphasize that the currency string may come from one of multiple sources.
- *
- * Will match currency spacing either before or after the number depending on whether we are currently in
- * the prefix or suffix.
- *
- * The implementation of this class is slightly different between J and C. See #13584 for a follow-up.
- *
- * @author sffc
- */
-// Exported as U_I18N_API for tests
-class U_I18N_API CombinedCurrencyMatcher : public NumberParseMatcher, public UMemory {
- public:
- CombinedCurrencyMatcher() = default; // WARNING: Leaves the object in an unusable state
-
- CombinedCurrencyMatcher(const CurrencySymbols& currencySymbols, const DecimalFormatSymbols& dfs,
- parse_flags_t parseFlags, UErrorCode& status);
-
- bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override;
-
- bool smokeTest(const StringSegment& segment) const override;
-
- UnicodeString toString() const override;
-
- private:
- UChar fCurrencyCode[4];
- UnicodeString fCurrency1;
- UnicodeString fCurrency2;
-
- bool fUseFullCurrencyData;
- UnicodeString fLocalLongNames[StandardPlural::COUNT];
-
- UnicodeString afterPrefixInsert;
- UnicodeString beforeSuffixInsert;
-
- // We could use Locale instead of CharString here, but
- // Locale has a non-trivial default constructor.
- CharString fLocaleName;
-
- // TODO: See comments in constructor in numparse_currency.cpp
- // UnicodeSet fLeadCodePoints;
-
- /** Matches the currency string without concern for currency spacing. */
- bool matchCurrency(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const;
-};
-
-
-} // namespace impl
-} // namespace numparse
-U_NAMESPACE_END
-
-#endif //__NUMPARSE_CURRENCY_H__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMPARSE_CURRENCY_H__
+#define __NUMPARSE_CURRENCY_H__
+
+#include "numparse_types.h"
+#include "numparse_compositions.h"
+#include "charstr.h"
+#include "number_currencysymbols.h"
+#include "unicode/uniset.h"
+
+U_NAMESPACE_BEGIN namespace numparse {
+namespace impl {
+
+using ::icu::number::impl::CurrencySymbols;
+
+/**
+ * Matches a currency, either a custom currency or one from the data bundle. The class is called
+ * "combined" to emphasize that the currency string may come from one of multiple sources.
+ *
+ * Will match currency spacing either before or after the number depending on whether we are currently in
+ * the prefix or suffix.
+ *
+ * The implementation of this class is slightly different between J and C. See #13584 for a follow-up.
+ *
+ * @author sffc
+ */
+// Exported as U_I18N_API for tests
+class U_I18N_API CombinedCurrencyMatcher : public NumberParseMatcher, public UMemory {
+ public:
+ CombinedCurrencyMatcher() = default; // WARNING: Leaves the object in an unusable state
+
+ CombinedCurrencyMatcher(const CurrencySymbols& currencySymbols, const DecimalFormatSymbols& dfs,
+ parse_flags_t parseFlags, UErrorCode& status);
+
+ bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override;
+
+ bool smokeTest(const StringSegment& segment) const override;
+
+ UnicodeString toString() const override;
+
+ private:
+ UChar fCurrencyCode[4];
+ UnicodeString fCurrency1;
+ UnicodeString fCurrency2;
+
+ bool fUseFullCurrencyData;
+ UnicodeString fLocalLongNames[StandardPlural::COUNT];
+
+ UnicodeString afterPrefixInsert;
+ UnicodeString beforeSuffixInsert;
+
+ // We could use Locale instead of CharString here, but
+ // Locale has a non-trivial default constructor.
+ CharString fLocaleName;
+
+ // TODO: See comments in constructor in numparse_currency.cpp
+ // UnicodeSet fLeadCodePoints;
+
+ /** Matches the currency string without concern for currency spacing. */
+ bool matchCurrency(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const;
+};
+
+
+} // namespace impl
+} // namespace numparse
+U_NAMESPACE_END
+
+#endif //__NUMPARSE_CURRENCY_H__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numparse_decimal.cpp b/contrib/libs/icu/i18n/numparse_decimal.cpp
index 813512c06b..cf1e815672 100644
--- a/contrib/libs/icu/i18n/numparse_decimal.cpp
+++ b/contrib/libs/icu/i18n/numparse_decimal.cpp
@@ -1,459 +1,459 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include "numparse_types.h"
-#include "numparse_decimal.h"
-#include "static_unicode_sets.h"
-#include "numparse_utils.h"
-#include "unicode/uchar.h"
-#include "putilimp.h"
-#include "number_decimalquantity.h"
-#include "string_segment.h"
-
-using namespace icu;
-using namespace icu::numparse;
-using namespace icu::numparse::impl;
-
-
-DecimalMatcher::DecimalMatcher(const DecimalFormatSymbols& symbols, const Grouper& grouper,
- parse_flags_t parseFlags) {
- if (0 != (parseFlags & PARSE_FLAG_MONETARY_SEPARATORS)) {
- groupingSeparator = symbols.getConstSymbol(DecimalFormatSymbols::kMonetaryGroupingSeparatorSymbol);
- decimalSeparator = symbols.getConstSymbol(DecimalFormatSymbols::kMonetarySeparatorSymbol);
- } else {
- groupingSeparator = symbols.getConstSymbol(DecimalFormatSymbols::kGroupingSeparatorSymbol);
- decimalSeparator = symbols.getConstSymbol(DecimalFormatSymbols::kDecimalSeparatorSymbol);
- }
- bool strictSeparators = 0 != (parseFlags & PARSE_FLAG_STRICT_SEPARATORS);
- unisets::Key groupingKey = strictSeparators ? unisets::STRICT_ALL_SEPARATORS
- : unisets::ALL_SEPARATORS;
-
- // Attempt to find separators in the static cache
-
- groupingUniSet = unisets::get(groupingKey);
- unisets::Key decimalKey = unisets::chooseFrom(
- decimalSeparator,
- strictSeparators ? unisets::STRICT_COMMA : unisets::COMMA,
- strictSeparators ? unisets::STRICT_PERIOD : unisets::PERIOD);
- if (decimalKey >= 0) {
- decimalUniSet = unisets::get(decimalKey);
- } else if (!decimalSeparator.isEmpty()) {
- auto* set = new UnicodeSet();
- set->add(decimalSeparator.char32At(0));
- set->freeze();
- decimalUniSet = set;
- fLocalDecimalUniSet.adoptInstead(set);
- } else {
- decimalUniSet = unisets::get(unisets::EMPTY);
- }
-
- if (groupingKey >= 0 && decimalKey >= 0) {
- // Everything is available in the static cache
- separatorSet = groupingUniSet;
- leadSet = unisets::get(
- strictSeparators ? unisets::DIGITS_OR_ALL_SEPARATORS
- : unisets::DIGITS_OR_STRICT_ALL_SEPARATORS);
- } else {
- auto* set = new UnicodeSet();
- set->addAll(*groupingUniSet);
- set->addAll(*decimalUniSet);
- set->freeze();
- separatorSet = set;
- fLocalSeparatorSet.adoptInstead(set);
- leadSet = nullptr;
- }
-
- UChar32 cpZero = symbols.getCodePointZero();
- if (cpZero == -1 || !u_isdigit(cpZero) || u_digit(cpZero, 10) != 0) {
- // Uncommon case: okay to allocate.
- auto digitStrings = new UnicodeString[10];
- fLocalDigitStrings.adoptInstead(digitStrings);
- for (int32_t i = 0; i <= 9; i++) {
- digitStrings[i] = symbols.getConstDigitSymbol(i);
- }
- }
-
- requireGroupingMatch = 0 != (parseFlags & PARSE_FLAG_STRICT_GROUPING_SIZE);
- groupingDisabled = 0 != (parseFlags & PARSE_FLAG_GROUPING_DISABLED);
- integerOnly = 0 != (parseFlags & PARSE_FLAG_INTEGER_ONLY);
- grouping1 = grouper.getPrimary();
- grouping2 = grouper.getSecondary();
-
- // Fraction grouping parsing is disabled for now but could be enabled later.
- // See http://bugs.icu-project.org/trac/ticket/10794
- // fractionGrouping = 0 != (parseFlags & PARSE_FLAG_FRACTION_GROUPING_ENABLED);
-}
-
-bool DecimalMatcher::match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const {
- return match(segment, result, 0, status);
-}
-
-bool DecimalMatcher::match(StringSegment& segment, ParsedNumber& result, int8_t exponentSign,
- UErrorCode&) const {
- if (result.seenNumber() && exponentSign == 0) {
- // A number has already been consumed.
- return false;
- } else if (exponentSign != 0) {
- // scientific notation always comes after the number
- U_ASSERT(!result.quantity.bogus);
- }
-
- // Initial offset before any character consumption.
- int32_t initialOffset = segment.getOffset();
-
- // Return value: whether to ask for more characters.
- bool maybeMore = false;
-
- // All digits consumed so far.
- number::impl::DecimalQuantity digitsConsumed;
- digitsConsumed.bogus = true;
-
- // The total number of digits after the decimal place, used for scaling the result.
- int32_t digitsAfterDecimalPlace = 0;
-
- // The actual grouping and decimal separators used in the string.
- // If non-null, we have seen that token.
- UnicodeString actualGroupingString;
- UnicodeString actualDecimalString;
- actualGroupingString.setToBogus();
- actualDecimalString.setToBogus();
-
- // Information for two groups: the previous group and the current group.
- //
- // Each group has three pieces of information:
- //
- // Offset: the string position of the beginning of the group, including a leading separator
- // if there was a leading separator. This is needed in case we need to rewind the parse to
- // that position.
- //
- // Separator type:
- // 0 => beginning of string
- // 1 => lead separator is a grouping separator
- // 2 => lead separator is a decimal separator
- //
- // Count: the number of digits in the group. If -1, the group has been validated.
- int32_t currGroupOffset = 0;
- int32_t currGroupSepType = 0;
- int32_t currGroupCount = 0;
- int32_t prevGroupOffset = -1;
- int32_t prevGroupSepType = -1;
- int32_t prevGroupCount = -1;
-
- while (segment.length() > 0) {
- maybeMore = false;
-
- // Attempt to match a digit.
- int8_t digit = -1;
-
- // Try by code point digit value.
- UChar32 cp = segment.getCodePoint();
- if (u_isdigit(cp)) {
- segment.adjustOffset(U16_LENGTH(cp));
- digit = static_cast<int8_t>(u_digit(cp, 10));
- }
-
- // Try by digit string.
- if (digit == -1 && !fLocalDigitStrings.isNull()) {
- for (int32_t i = 0; i < 10; i++) {
- const UnicodeString& str = fLocalDigitStrings[i];
- if (str.isEmpty()) {
- continue;
- }
- int32_t overlap = segment.getCommonPrefixLength(str);
- if (overlap == str.length()) {
- segment.adjustOffset(overlap);
- digit = static_cast<int8_t>(i);
- break;
- }
- maybeMore = maybeMore || (overlap == segment.length());
- }
- }
-
- if (digit >= 0) {
- // Digit was found.
- if (digitsConsumed.bogus) {
- digitsConsumed.bogus = false;
- digitsConsumed.clear();
- }
- digitsConsumed.appendDigit(digit, 0, true);
- currGroupCount++;
- if (!actualDecimalString.isBogus()) {
- digitsAfterDecimalPlace++;
- }
- continue;
- }
-
- // Attempt to match a literal grouping or decimal separator.
- bool isDecimal = false;
- bool isGrouping = false;
-
- // 1) Attempt the decimal separator string literal.
- // if (we have not seen a decimal separator yet) { ... }
- if (actualDecimalString.isBogus() && !decimalSeparator.isEmpty()) {
- int32_t overlap = segment.getCommonPrefixLength(decimalSeparator);
- maybeMore = maybeMore || (overlap == segment.length());
- if (overlap == decimalSeparator.length()) {
- isDecimal = true;
- actualDecimalString = decimalSeparator;
- }
- }
-
- // 2) Attempt to match the actual grouping string literal.
- if (!actualGroupingString.isBogus()) {
- int32_t overlap = segment.getCommonPrefixLength(actualGroupingString);
- maybeMore = maybeMore || (overlap == segment.length());
- if (overlap == actualGroupingString.length()) {
- isGrouping = true;
- }
- }
-
- // 2.5) Attempt to match a new the grouping separator string literal.
- // if (we have not seen a grouping or decimal separator yet) { ... }
- if (!groupingDisabled && actualGroupingString.isBogus() && actualDecimalString.isBogus() &&
- !groupingSeparator.isEmpty()) {
- int32_t overlap = segment.getCommonPrefixLength(groupingSeparator);
- maybeMore = maybeMore || (overlap == segment.length());
- if (overlap == groupingSeparator.length()) {
- isGrouping = true;
- actualGroupingString = groupingSeparator;
- }
- }
-
- // 3) Attempt to match a decimal separator from the equivalence set.
- // if (we have not seen a decimal separator yet) { ... }
- // The !isGrouping is to confirm that we haven't yet matched the current character.
- if (!isGrouping && actualDecimalString.isBogus()) {
- if (decimalUniSet->contains(cp)) {
- isDecimal = true;
- actualDecimalString = UnicodeString(cp);
- }
- }
-
- // 4) Attempt to match a grouping separator from the equivalence set.
- // if (we have not seen a grouping or decimal separator yet) { ... }
- if (!groupingDisabled && actualGroupingString.isBogus() && actualDecimalString.isBogus()) {
- if (groupingUniSet->contains(cp)) {
- isGrouping = true;
- actualGroupingString = UnicodeString(cp);
- }
- }
-
- // Leave if we failed to match this as a separator.
- if (!isDecimal && !isGrouping) {
- break;
- }
-
- // Check for conditions when we don't want to accept the separator.
- if (isDecimal && integerOnly) {
- break;
- } else if (currGroupSepType == 2 && isGrouping) {
- // Fraction grouping
- break;
- }
-
- // Validate intermediate grouping sizes.
- bool prevValidSecondary = validateGroup(prevGroupSepType, prevGroupCount, false);
- bool currValidPrimary = validateGroup(currGroupSepType, currGroupCount, true);
- if (!prevValidSecondary || (isDecimal && !currValidPrimary)) {
- // Invalid grouping sizes.
- if (isGrouping && currGroupCount == 0) {
- // Trailing grouping separators: these are taken care of below
- U_ASSERT(currGroupSepType == 1);
- } else if (requireGroupingMatch) {
- // Strict mode: reject the parse
- digitsConsumed.clear();
- digitsConsumed.bogus = true;
- }
- break;
- } else if (requireGroupingMatch && currGroupCount == 0 && currGroupSepType == 1) {
- break;
- } else {
- // Grouping sizes OK so far.
- prevGroupOffset = currGroupOffset;
- prevGroupCount = currGroupCount;
- if (isDecimal) {
- // Do not validate this group any more.
- prevGroupSepType = -1;
- } else {
- prevGroupSepType = currGroupSepType;
- }
- }
-
- // OK to accept the separator.
- // Special case: don't update currGroup if it is empty; this allows two grouping
- // separators in a row in lenient mode.
- if (currGroupCount != 0) {
- currGroupOffset = segment.getOffset();
- }
- currGroupSepType = isGrouping ? 1 : 2;
- currGroupCount = 0;
- if (isGrouping) {
- segment.adjustOffset(actualGroupingString.length());
- } else {
- segment.adjustOffset(actualDecimalString.length());
- }
- }
-
- // End of main loop.
- // Back up if there was a trailing grouping separator.
- // Shift prev -> curr so we can check it as a final group.
- if (currGroupSepType != 2 && currGroupCount == 0) {
- maybeMore = true;
- segment.setOffset(currGroupOffset);
- currGroupOffset = prevGroupOffset;
- currGroupSepType = prevGroupSepType;
- currGroupCount = prevGroupCount;
- prevGroupOffset = -1;
- prevGroupSepType = 0;
- prevGroupCount = 1;
- }
-
- // Validate final grouping sizes.
- bool prevValidSecondary = validateGroup(prevGroupSepType, prevGroupCount, false);
- bool currValidPrimary = validateGroup(currGroupSepType, currGroupCount, true);
- if (!requireGroupingMatch) {
- // The cases we need to handle here are lone digits.
- // Examples: "1,1" "1,1," "1,1,1" "1,1,1," ",1" (all parse as 1)
- // See more examples in numberformattestspecification.txt
- int32_t digitsToRemove = 0;
- if (!prevValidSecondary) {
- segment.setOffset(prevGroupOffset);
- digitsToRemove += prevGroupCount;
- digitsToRemove += currGroupCount;
- } else if (!currValidPrimary && (prevGroupSepType != 0 || prevGroupCount != 0)) {
- maybeMore = true;
- segment.setOffset(currGroupOffset);
- digitsToRemove += currGroupCount;
- }
- if (digitsToRemove != 0) {
- digitsConsumed.adjustMagnitude(-digitsToRemove);
- digitsConsumed.truncate();
- }
- prevValidSecondary = true;
- currValidPrimary = true;
- }
- if (currGroupSepType != 2 && (!prevValidSecondary || !currValidPrimary)) {
- // Grouping failure.
- digitsConsumed.bogus = true;
- }
-
- // Strings that start with a separator but have no digits,
- // or strings that failed a grouping size check.
- if (digitsConsumed.bogus) {
- maybeMore = maybeMore || (segment.length() == 0);
- segment.setOffset(initialOffset);
- return maybeMore;
- }
-
- // We passed all inspections. Start post-processing.
-
- // Adjust for fraction part.
- digitsConsumed.adjustMagnitude(-digitsAfterDecimalPlace);
-
- // Set the digits, either normal or exponent.
- if (exponentSign != 0 && segment.getOffset() != initialOffset) {
- bool overflow = false;
- if (digitsConsumed.fitsInLong()) {
- int64_t exponentLong = digitsConsumed.toLong(false);
- U_ASSERT(exponentLong >= 0);
- if (exponentLong <= INT32_MAX) {
- auto exponentInt = static_cast<int32_t>(exponentLong);
- if (result.quantity.adjustMagnitude(exponentSign * exponentInt)) {
- overflow = true;
- }
- } else {
- overflow = true;
- }
- } else {
- overflow = true;
- }
- if (overflow) {
- if (exponentSign == -1) {
- // Set to zero
- result.quantity.clear();
- } else {
- // Set to infinity
- result.quantity.bogus = true;
- result.flags |= FLAG_INFINITY;
- }
- }
- } else {
- result.quantity = digitsConsumed;
- }
-
- // Set other information into the result and return.
- if (!actualDecimalString.isBogus()) {
- result.flags |= FLAG_HAS_DECIMAL_SEPARATOR;
- }
- result.setCharsConsumed(segment);
- return segment.length() == 0 || maybeMore;
-}
-
-bool DecimalMatcher::validateGroup(int32_t sepType, int32_t count, bool isPrimary) const {
- if (requireGroupingMatch) {
- if (sepType == -1) {
- // No such group (prevGroup before first shift).
- return true;
- } else if (sepType == 0) {
- // First group.
- if (isPrimary) {
- // No grouping separators is OK.
- return true;
- } else {
- return count != 0 && count <= grouping2;
- }
- } else if (sepType == 1) {
- // Middle group.
- if (isPrimary) {
- return count == grouping1;
- } else {
- return count == grouping2;
- }
- } else {
- U_ASSERT(sepType == 2);
- // After the decimal separator.
- return true;
- }
- } else {
- if (sepType == 1) {
- // #11230: don't accept middle groups with only 1 digit.
- return count != 1;
- } else {
- return true;
- }
- }
-}
-
-bool DecimalMatcher::smokeTest(const StringSegment& segment) const {
- // The common case uses a static leadSet for efficiency.
- if (fLocalDigitStrings.isNull() && leadSet != nullptr) {
- return segment.startsWith(*leadSet);
- }
- if (segment.startsWith(*separatorSet) || u_isdigit(segment.getCodePoint())) {
- return true;
- }
- if (fLocalDigitStrings.isNull()) {
- return false;
- }
- for (int32_t i = 0; i < 10; i++) {
- if (segment.startsWith(fLocalDigitStrings[i])) {
- return true;
- }
- }
- return false;
-}
-
-UnicodeString DecimalMatcher::toString() const {
- return u"<Decimal>";
-}
-
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include "numparse_types.h"
+#include "numparse_decimal.h"
+#include "static_unicode_sets.h"
+#include "numparse_utils.h"
+#include "unicode/uchar.h"
+#include "putilimp.h"
+#include "number_decimalquantity.h"
+#include "string_segment.h"
+
+using namespace icu;
+using namespace icu::numparse;
+using namespace icu::numparse::impl;
+
+
+DecimalMatcher::DecimalMatcher(const DecimalFormatSymbols& symbols, const Grouper& grouper,
+ parse_flags_t parseFlags) {
+ if (0 != (parseFlags & PARSE_FLAG_MONETARY_SEPARATORS)) {
+ groupingSeparator = symbols.getConstSymbol(DecimalFormatSymbols::kMonetaryGroupingSeparatorSymbol);
+ decimalSeparator = symbols.getConstSymbol(DecimalFormatSymbols::kMonetarySeparatorSymbol);
+ } else {
+ groupingSeparator = symbols.getConstSymbol(DecimalFormatSymbols::kGroupingSeparatorSymbol);
+ decimalSeparator = symbols.getConstSymbol(DecimalFormatSymbols::kDecimalSeparatorSymbol);
+ }
+ bool strictSeparators = 0 != (parseFlags & PARSE_FLAG_STRICT_SEPARATORS);
+ unisets::Key groupingKey = strictSeparators ? unisets::STRICT_ALL_SEPARATORS
+ : unisets::ALL_SEPARATORS;
+
+ // Attempt to find separators in the static cache
+
+ groupingUniSet = unisets::get(groupingKey);
+ unisets::Key decimalKey = unisets::chooseFrom(
+ decimalSeparator,
+ strictSeparators ? unisets::STRICT_COMMA : unisets::COMMA,
+ strictSeparators ? unisets::STRICT_PERIOD : unisets::PERIOD);
+ if (decimalKey >= 0) {
+ decimalUniSet = unisets::get(decimalKey);
+ } else if (!decimalSeparator.isEmpty()) {
+ auto* set = new UnicodeSet();
+ set->add(decimalSeparator.char32At(0));
+ set->freeze();
+ decimalUniSet = set;
+ fLocalDecimalUniSet.adoptInstead(set);
+ } else {
+ decimalUniSet = unisets::get(unisets::EMPTY);
+ }
+
+ if (groupingKey >= 0 && decimalKey >= 0) {
+ // Everything is available in the static cache
+ separatorSet = groupingUniSet;
+ leadSet = unisets::get(
+ strictSeparators ? unisets::DIGITS_OR_ALL_SEPARATORS
+ : unisets::DIGITS_OR_STRICT_ALL_SEPARATORS);
+ } else {
+ auto* set = new UnicodeSet();
+ set->addAll(*groupingUniSet);
+ set->addAll(*decimalUniSet);
+ set->freeze();
+ separatorSet = set;
+ fLocalSeparatorSet.adoptInstead(set);
+ leadSet = nullptr;
+ }
+
+ UChar32 cpZero = symbols.getCodePointZero();
+ if (cpZero == -1 || !u_isdigit(cpZero) || u_digit(cpZero, 10) != 0) {
+ // Uncommon case: okay to allocate.
+ auto digitStrings = new UnicodeString[10];
+ fLocalDigitStrings.adoptInstead(digitStrings);
+ for (int32_t i = 0; i <= 9; i++) {
+ digitStrings[i] = symbols.getConstDigitSymbol(i);
+ }
+ }
+
+ requireGroupingMatch = 0 != (parseFlags & PARSE_FLAG_STRICT_GROUPING_SIZE);
+ groupingDisabled = 0 != (parseFlags & PARSE_FLAG_GROUPING_DISABLED);
+ integerOnly = 0 != (parseFlags & PARSE_FLAG_INTEGER_ONLY);
+ grouping1 = grouper.getPrimary();
+ grouping2 = grouper.getSecondary();
+
+ // Fraction grouping parsing is disabled for now but could be enabled later.
+ // See http://bugs.icu-project.org/trac/ticket/10794
+ // fractionGrouping = 0 != (parseFlags & PARSE_FLAG_FRACTION_GROUPING_ENABLED);
+}
+
+bool DecimalMatcher::match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const {
+ return match(segment, result, 0, status);
+}
+
+bool DecimalMatcher::match(StringSegment& segment, ParsedNumber& result, int8_t exponentSign,
+ UErrorCode&) const {
+ if (result.seenNumber() && exponentSign == 0) {
+ // A number has already been consumed.
+ return false;
+ } else if (exponentSign != 0) {
+ // scientific notation always comes after the number
+ U_ASSERT(!result.quantity.bogus);
+ }
+
+ // Initial offset before any character consumption.
+ int32_t initialOffset = segment.getOffset();
+
+ // Return value: whether to ask for more characters.
+ bool maybeMore = false;
+
+ // All digits consumed so far.
+ number::impl::DecimalQuantity digitsConsumed;
+ digitsConsumed.bogus = true;
+
+ // The total number of digits after the decimal place, used for scaling the result.
+ int32_t digitsAfterDecimalPlace = 0;
+
+ // The actual grouping and decimal separators used in the string.
+ // If non-null, we have seen that token.
+ UnicodeString actualGroupingString;
+ UnicodeString actualDecimalString;
+ actualGroupingString.setToBogus();
+ actualDecimalString.setToBogus();
+
+ // Information for two groups: the previous group and the current group.
+ //
+ // Each group has three pieces of information:
+ //
+ // Offset: the string position of the beginning of the group, including a leading separator
+ // if there was a leading separator. This is needed in case we need to rewind the parse to
+ // that position.
+ //
+ // Separator type:
+ // 0 => beginning of string
+ // 1 => lead separator is a grouping separator
+ // 2 => lead separator is a decimal separator
+ //
+ // Count: the number of digits in the group. If -1, the group has been validated.
+ int32_t currGroupOffset = 0;
+ int32_t currGroupSepType = 0;
+ int32_t currGroupCount = 0;
+ int32_t prevGroupOffset = -1;
+ int32_t prevGroupSepType = -1;
+ int32_t prevGroupCount = -1;
+
+ while (segment.length() > 0) {
+ maybeMore = false;
+
+ // Attempt to match a digit.
+ int8_t digit = -1;
+
+ // Try by code point digit value.
+ UChar32 cp = segment.getCodePoint();
+ if (u_isdigit(cp)) {
+ segment.adjustOffset(U16_LENGTH(cp));
+ digit = static_cast<int8_t>(u_digit(cp, 10));
+ }
+
+ // Try by digit string.
+ if (digit == -1 && !fLocalDigitStrings.isNull()) {
+ for (int32_t i = 0; i < 10; i++) {
+ const UnicodeString& str = fLocalDigitStrings[i];
+ if (str.isEmpty()) {
+ continue;
+ }
+ int32_t overlap = segment.getCommonPrefixLength(str);
+ if (overlap == str.length()) {
+ segment.adjustOffset(overlap);
+ digit = static_cast<int8_t>(i);
+ break;
+ }
+ maybeMore = maybeMore || (overlap == segment.length());
+ }
+ }
+
+ if (digit >= 0) {
+ // Digit was found.
+ if (digitsConsumed.bogus) {
+ digitsConsumed.bogus = false;
+ digitsConsumed.clear();
+ }
+ digitsConsumed.appendDigit(digit, 0, true);
+ currGroupCount++;
+ if (!actualDecimalString.isBogus()) {
+ digitsAfterDecimalPlace++;
+ }
+ continue;
+ }
+
+ // Attempt to match a literal grouping or decimal separator.
+ bool isDecimal = false;
+ bool isGrouping = false;
+
+ // 1) Attempt the decimal separator string literal.
+ // if (we have not seen a decimal separator yet) { ... }
+ if (actualDecimalString.isBogus() && !decimalSeparator.isEmpty()) {
+ int32_t overlap = segment.getCommonPrefixLength(decimalSeparator);
+ maybeMore = maybeMore || (overlap == segment.length());
+ if (overlap == decimalSeparator.length()) {
+ isDecimal = true;
+ actualDecimalString = decimalSeparator;
+ }
+ }
+
+ // 2) Attempt to match the actual grouping string literal.
+ if (!actualGroupingString.isBogus()) {
+ int32_t overlap = segment.getCommonPrefixLength(actualGroupingString);
+ maybeMore = maybeMore || (overlap == segment.length());
+ if (overlap == actualGroupingString.length()) {
+ isGrouping = true;
+ }
+ }
+
+ // 2.5) Attempt to match a new the grouping separator string literal.
+ // if (we have not seen a grouping or decimal separator yet) { ... }
+ if (!groupingDisabled && actualGroupingString.isBogus() && actualDecimalString.isBogus() &&
+ !groupingSeparator.isEmpty()) {
+ int32_t overlap = segment.getCommonPrefixLength(groupingSeparator);
+ maybeMore = maybeMore || (overlap == segment.length());
+ if (overlap == groupingSeparator.length()) {
+ isGrouping = true;
+ actualGroupingString = groupingSeparator;
+ }
+ }
+
+ // 3) Attempt to match a decimal separator from the equivalence set.
+ // if (we have not seen a decimal separator yet) { ... }
+ // The !isGrouping is to confirm that we haven't yet matched the current character.
+ if (!isGrouping && actualDecimalString.isBogus()) {
+ if (decimalUniSet->contains(cp)) {
+ isDecimal = true;
+ actualDecimalString = UnicodeString(cp);
+ }
+ }
+
+ // 4) Attempt to match a grouping separator from the equivalence set.
+ // if (we have not seen a grouping or decimal separator yet) { ... }
+ if (!groupingDisabled && actualGroupingString.isBogus() && actualDecimalString.isBogus()) {
+ if (groupingUniSet->contains(cp)) {
+ isGrouping = true;
+ actualGroupingString = UnicodeString(cp);
+ }
+ }
+
+ // Leave if we failed to match this as a separator.
+ if (!isDecimal && !isGrouping) {
+ break;
+ }
+
+ // Check for conditions when we don't want to accept the separator.
+ if (isDecimal && integerOnly) {
+ break;
+ } else if (currGroupSepType == 2 && isGrouping) {
+ // Fraction grouping
+ break;
+ }
+
+ // Validate intermediate grouping sizes.
+ bool prevValidSecondary = validateGroup(prevGroupSepType, prevGroupCount, false);
+ bool currValidPrimary = validateGroup(currGroupSepType, currGroupCount, true);
+ if (!prevValidSecondary || (isDecimal && !currValidPrimary)) {
+ // Invalid grouping sizes.
+ if (isGrouping && currGroupCount == 0) {
+ // Trailing grouping separators: these are taken care of below
+ U_ASSERT(currGroupSepType == 1);
+ } else if (requireGroupingMatch) {
+ // Strict mode: reject the parse
+ digitsConsumed.clear();
+ digitsConsumed.bogus = true;
+ }
+ break;
+ } else if (requireGroupingMatch && currGroupCount == 0 && currGroupSepType == 1) {
+ break;
+ } else {
+ // Grouping sizes OK so far.
+ prevGroupOffset = currGroupOffset;
+ prevGroupCount = currGroupCount;
+ if (isDecimal) {
+ // Do not validate this group any more.
+ prevGroupSepType = -1;
+ } else {
+ prevGroupSepType = currGroupSepType;
+ }
+ }
+
+ // OK to accept the separator.
+ // Special case: don't update currGroup if it is empty; this allows two grouping
+ // separators in a row in lenient mode.
+ if (currGroupCount != 0) {
+ currGroupOffset = segment.getOffset();
+ }
+ currGroupSepType = isGrouping ? 1 : 2;
+ currGroupCount = 0;
+ if (isGrouping) {
+ segment.adjustOffset(actualGroupingString.length());
+ } else {
+ segment.adjustOffset(actualDecimalString.length());
+ }
+ }
+
+ // End of main loop.
+ // Back up if there was a trailing grouping separator.
+ // Shift prev -> curr so we can check it as a final group.
+ if (currGroupSepType != 2 && currGroupCount == 0) {
+ maybeMore = true;
+ segment.setOffset(currGroupOffset);
+ currGroupOffset = prevGroupOffset;
+ currGroupSepType = prevGroupSepType;
+ currGroupCount = prevGroupCount;
+ prevGroupOffset = -1;
+ prevGroupSepType = 0;
+ prevGroupCount = 1;
+ }
+
+ // Validate final grouping sizes.
+ bool prevValidSecondary = validateGroup(prevGroupSepType, prevGroupCount, false);
+ bool currValidPrimary = validateGroup(currGroupSepType, currGroupCount, true);
+ if (!requireGroupingMatch) {
+ // The cases we need to handle here are lone digits.
+ // Examples: "1,1" "1,1," "1,1,1" "1,1,1," ",1" (all parse as 1)
+ // See more examples in numberformattestspecification.txt
+ int32_t digitsToRemove = 0;
+ if (!prevValidSecondary) {
+ segment.setOffset(prevGroupOffset);
+ digitsToRemove += prevGroupCount;
+ digitsToRemove += currGroupCount;
+ } else if (!currValidPrimary && (prevGroupSepType != 0 || prevGroupCount != 0)) {
+ maybeMore = true;
+ segment.setOffset(currGroupOffset);
+ digitsToRemove += currGroupCount;
+ }
+ if (digitsToRemove != 0) {
+ digitsConsumed.adjustMagnitude(-digitsToRemove);
+ digitsConsumed.truncate();
+ }
+ prevValidSecondary = true;
+ currValidPrimary = true;
+ }
+ if (currGroupSepType != 2 && (!prevValidSecondary || !currValidPrimary)) {
+ // Grouping failure.
+ digitsConsumed.bogus = true;
+ }
+
+ // Strings that start with a separator but have no digits,
+ // or strings that failed a grouping size check.
+ if (digitsConsumed.bogus) {
+ maybeMore = maybeMore || (segment.length() == 0);
+ segment.setOffset(initialOffset);
+ return maybeMore;
+ }
+
+ // We passed all inspections. Start post-processing.
+
+ // Adjust for fraction part.
+ digitsConsumed.adjustMagnitude(-digitsAfterDecimalPlace);
+
+ // Set the digits, either normal or exponent.
+ if (exponentSign != 0 && segment.getOffset() != initialOffset) {
+ bool overflow = false;
+ if (digitsConsumed.fitsInLong()) {
+ int64_t exponentLong = digitsConsumed.toLong(false);
+ U_ASSERT(exponentLong >= 0);
+ if (exponentLong <= INT32_MAX) {
+ auto exponentInt = static_cast<int32_t>(exponentLong);
+ if (result.quantity.adjustMagnitude(exponentSign * exponentInt)) {
+ overflow = true;
+ }
+ } else {
+ overflow = true;
+ }
+ } else {
+ overflow = true;
+ }
+ if (overflow) {
+ if (exponentSign == -1) {
+ // Set to zero
+ result.quantity.clear();
+ } else {
+ // Set to infinity
+ result.quantity.bogus = true;
+ result.flags |= FLAG_INFINITY;
+ }
+ }
+ } else {
+ result.quantity = digitsConsumed;
+ }
+
+ // Set other information into the result and return.
+ if (!actualDecimalString.isBogus()) {
+ result.flags |= FLAG_HAS_DECIMAL_SEPARATOR;
+ }
+ result.setCharsConsumed(segment);
+ return segment.length() == 0 || maybeMore;
+}
+
+bool DecimalMatcher::validateGroup(int32_t sepType, int32_t count, bool isPrimary) const {
+ if (requireGroupingMatch) {
+ if (sepType == -1) {
+ // No such group (prevGroup before first shift).
+ return true;
+ } else if (sepType == 0) {
+ // First group.
+ if (isPrimary) {
+ // No grouping separators is OK.
+ return true;
+ } else {
+ return count != 0 && count <= grouping2;
+ }
+ } else if (sepType == 1) {
+ // Middle group.
+ if (isPrimary) {
+ return count == grouping1;
+ } else {
+ return count == grouping2;
+ }
+ } else {
+ U_ASSERT(sepType == 2);
+ // After the decimal separator.
+ return true;
+ }
+ } else {
+ if (sepType == 1) {
+ // #11230: don't accept middle groups with only 1 digit.
+ return count != 1;
+ } else {
+ return true;
+ }
+ }
+}
+
+bool DecimalMatcher::smokeTest(const StringSegment& segment) const {
+ // The common case uses a static leadSet for efficiency.
+ if (fLocalDigitStrings.isNull() && leadSet != nullptr) {
+ return segment.startsWith(*leadSet);
+ }
+ if (segment.startsWith(*separatorSet) || u_isdigit(segment.getCodePoint())) {
+ return true;
+ }
+ if (fLocalDigitStrings.isNull()) {
+ return false;
+ }
+ for (int32_t i = 0; i < 10; i++) {
+ if (segment.startsWith(fLocalDigitStrings[i])) {
+ return true;
+ }
+ }
+ return false;
+}
+
+UnicodeString DecimalMatcher::toString() const {
+ return u"<Decimal>";
+}
+
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numparse_decimal.h b/contrib/libs/icu/i18n/numparse_decimal.h
index 6bb6c4be1a..ec6c76487e 100644
--- a/contrib/libs/icu/i18n/numparse_decimal.h
+++ b/contrib/libs/icu/i18n/numparse_decimal.h
@@ -1,76 +1,76 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMPARSE_DECIMAL_H__
-#define __NUMPARSE_DECIMAL_H__
-
-#include "unicode/uniset.h"
-#include "numparse_types.h"
-
-U_NAMESPACE_BEGIN namespace numparse {
-namespace impl {
-
-using ::icu::number::impl::Grouper;
-
-class DecimalMatcher : public NumberParseMatcher, public UMemory {
- public:
- DecimalMatcher() = default; // WARNING: Leaves the object in an unusable state
-
- DecimalMatcher(const DecimalFormatSymbols& symbols, const Grouper& grouper,
- parse_flags_t parseFlags);
-
- bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override;
-
- bool
- match(StringSegment& segment, ParsedNumber& result, int8_t exponentSign, UErrorCode& status) const;
-
- bool smokeTest(const StringSegment& segment) const override;
-
- UnicodeString toString() const override;
-
- private:
- /** If true, only accept strings whose grouping sizes match the locale */
- bool requireGroupingMatch;
-
- /** If true, do not accept grouping separators at all */
- bool groupingDisabled;
-
- // Fraction grouping parsing is disabled for now but could be enabled later.
- // See http://bugs.icu-project.org/trac/ticket/10794
- // bool fractionGrouping;
-
- /** If true, do not accept numbers in the fraction */
- bool integerOnly;
-
- int16_t grouping1;
- int16_t grouping2;
-
- UnicodeString groupingSeparator;
- UnicodeString decimalSeparator;
-
- // Assumption: these sets all consist of single code points. If this assumption needs to be broken,
- // fix getLeadCodePoints() as well as matching logic. Be careful of the performance impact.
- const UnicodeSet* groupingUniSet;
- const UnicodeSet* decimalUniSet;
- const UnicodeSet* separatorSet;
- const UnicodeSet* leadSet;
-
- // Make this class the owner of a few objects that could be allocated.
- // The first three LocalPointers are used for assigning ownership only.
- LocalPointer<const UnicodeSet> fLocalDecimalUniSet;
- LocalPointer<const UnicodeSet> fLocalSeparatorSet;
- LocalArray<const UnicodeString> fLocalDigitStrings;
-
- bool validateGroup(int32_t sepType, int32_t count, bool isPrimary) const;
-};
-
-
-} // namespace impl
-} // namespace numparse
-U_NAMESPACE_END
-
-#endif //__NUMPARSE_DECIMAL_H__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMPARSE_DECIMAL_H__
+#define __NUMPARSE_DECIMAL_H__
+
+#include "unicode/uniset.h"
+#include "numparse_types.h"
+
+U_NAMESPACE_BEGIN namespace numparse {
+namespace impl {
+
+using ::icu::number::impl::Grouper;
+
+class DecimalMatcher : public NumberParseMatcher, public UMemory {
+ public:
+ DecimalMatcher() = default; // WARNING: Leaves the object in an unusable state
+
+ DecimalMatcher(const DecimalFormatSymbols& symbols, const Grouper& grouper,
+ parse_flags_t parseFlags);
+
+ bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override;
+
+ bool
+ match(StringSegment& segment, ParsedNumber& result, int8_t exponentSign, UErrorCode& status) const;
+
+ bool smokeTest(const StringSegment& segment) const override;
+
+ UnicodeString toString() const override;
+
+ private:
+ /** If true, only accept strings whose grouping sizes match the locale */
+ bool requireGroupingMatch;
+
+ /** If true, do not accept grouping separators at all */
+ bool groupingDisabled;
+
+ // Fraction grouping parsing is disabled for now but could be enabled later.
+ // See http://bugs.icu-project.org/trac/ticket/10794
+ // bool fractionGrouping;
+
+ /** If true, do not accept numbers in the fraction */
+ bool integerOnly;
+
+ int16_t grouping1;
+ int16_t grouping2;
+
+ UnicodeString groupingSeparator;
+ UnicodeString decimalSeparator;
+
+ // Assumption: these sets all consist of single code points. If this assumption needs to be broken,
+ // fix getLeadCodePoints() as well as matching logic. Be careful of the performance impact.
+ const UnicodeSet* groupingUniSet;
+ const UnicodeSet* decimalUniSet;
+ const UnicodeSet* separatorSet;
+ const UnicodeSet* leadSet;
+
+ // Make this class the owner of a few objects that could be allocated.
+ // The first three LocalPointers are used for assigning ownership only.
+ LocalPointer<const UnicodeSet> fLocalDecimalUniSet;
+ LocalPointer<const UnicodeSet> fLocalSeparatorSet;
+ LocalArray<const UnicodeString> fLocalDigitStrings;
+
+ bool validateGroup(int32_t sepType, int32_t count, bool isPrimary) const;
+};
+
+
+} // namespace impl
+} // namespace numparse
+U_NAMESPACE_END
+
+#endif //__NUMPARSE_DECIMAL_H__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numparse_impl.cpp b/contrib/libs/icu/i18n/numparse_impl.cpp
index cb50a0858d..4b76da1c14 100644
--- a/contrib/libs/icu/i18n/numparse_impl.cpp
+++ b/contrib/libs/icu/i18n/numparse_impl.cpp
@@ -1,365 +1,365 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include <typeinfo>
-#include <array>
-#include "number_types.h"
-#include "number_patternstring.h"
-#include "numparse_types.h"
-#include "numparse_impl.h"
-#include "numparse_symbols.h"
-#include "numparse_decimal.h"
-#include "unicode/numberformatter.h"
-#include "cstr.h"
-#include "number_mapper.h"
-#include "static_unicode_sets.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-using namespace icu::numparse;
-using namespace icu::numparse::impl;
-
-
-NumberParseMatcher::~NumberParseMatcher() = default;
-
-
-NumberParserImpl*
-NumberParserImpl::createSimpleParser(const Locale& locale, const UnicodeString& patternString,
- parse_flags_t parseFlags, UErrorCode& status) {
-
- LocalPointer<NumberParserImpl> parser(new NumberParserImpl(parseFlags));
- DecimalFormatSymbols symbols(locale, status);
-
- parser->fLocalMatchers.ignorables = {parseFlags};
- IgnorablesMatcher& ignorables = parser->fLocalMatchers.ignorables;
-
- DecimalFormatSymbols dfs(locale, status);
- dfs.setSymbol(DecimalFormatSymbols::kCurrencySymbol, u"IU$");
- dfs.setSymbol(DecimalFormatSymbols::kIntlCurrencySymbol, u"ICU");
- CurrencySymbols currencySymbols({u"ICU", status}, locale, dfs, status);
-
- ParsedPatternInfo patternInfo;
- PatternParser::parseToPatternInfo(patternString, patternInfo, status);
-
- // The following statements set up the affix matchers.
- AffixTokenMatcherSetupData affixSetupData = {
- currencySymbols, symbols, ignorables, locale, parseFlags};
- parser->fLocalMatchers.affixTokenMatcherWarehouse = {&affixSetupData};
- parser->fLocalMatchers.affixMatcherWarehouse = {&parser->fLocalMatchers.affixTokenMatcherWarehouse};
- parser->fLocalMatchers.affixMatcherWarehouse.createAffixMatchers(
- patternInfo, *parser, ignorables, parseFlags, status);
-
- Grouper grouper = Grouper::forStrategy(UNUM_GROUPING_AUTO);
- grouper.setLocaleData(patternInfo, locale);
-
- parser->addMatcher(parser->fLocalMatchers.ignorables);
- parser->addMatcher(parser->fLocalMatchers.decimal = {symbols, grouper, parseFlags});
- parser->addMatcher(parser->fLocalMatchers.minusSign = {symbols, false});
- parser->addMatcher(parser->fLocalMatchers.plusSign = {symbols, false});
- parser->addMatcher(parser->fLocalMatchers.percent = {symbols});
- parser->addMatcher(parser->fLocalMatchers.permille = {symbols});
- parser->addMatcher(parser->fLocalMatchers.nan = {symbols});
- parser->addMatcher(parser->fLocalMatchers.infinity = {symbols});
- parser->addMatcher(parser->fLocalMatchers.padding = {u"@"});
- parser->addMatcher(parser->fLocalMatchers.scientific = {symbols, grouper});
- parser->addMatcher(parser->fLocalMatchers.currency = {currencySymbols, symbols, parseFlags, status});
- parser->addMatcher(parser->fLocalValidators.number = {});
-
- parser->freeze();
- return parser.orphan();
-}
-
-NumberParserImpl*
-NumberParserImpl::createParserFromProperties(const number::impl::DecimalFormatProperties& properties,
- const DecimalFormatSymbols& symbols, bool parseCurrency,
- UErrorCode& status) {
- Locale locale = symbols.getLocale();
- AutoAffixPatternProvider affixProvider(properties, status);
- if (U_FAILURE(status)) { return nullptr; }
- CurrencyUnit currency = resolveCurrency(properties, locale, status);
- CurrencySymbols currencySymbols(currency, locale, symbols, status);
- bool isStrict = properties.parseMode.getOrDefault(PARSE_MODE_STRICT) == PARSE_MODE_STRICT;
- Grouper grouper = Grouper::forProperties(properties);
- int parseFlags = 0;
- if (U_FAILURE(status)) { return nullptr; }
- if (!properties.parseCaseSensitive) {
- parseFlags |= PARSE_FLAG_IGNORE_CASE;
- }
- if (properties.parseIntegerOnly) {
- parseFlags |= PARSE_FLAG_INTEGER_ONLY;
- }
- if (properties.signAlwaysShown) {
- parseFlags |= PARSE_FLAG_PLUS_SIGN_ALLOWED;
- }
- if (isStrict) {
- parseFlags |= PARSE_FLAG_STRICT_GROUPING_SIZE;
- parseFlags |= PARSE_FLAG_STRICT_SEPARATORS;
- parseFlags |= PARSE_FLAG_USE_FULL_AFFIXES;
- parseFlags |= PARSE_FLAG_EXACT_AFFIX;
- parseFlags |= PARSE_FLAG_STRICT_IGNORABLES;
- } else {
- parseFlags |= PARSE_FLAG_INCLUDE_UNPAIRED_AFFIXES;
- }
- if (grouper.getPrimary() <= 0) {
- parseFlags |= PARSE_FLAG_GROUPING_DISABLED;
- }
- if (parseCurrency || affixProvider.get().hasCurrencySign()) {
- parseFlags |= PARSE_FLAG_MONETARY_SEPARATORS;
- }
- if (!parseCurrency) {
- parseFlags |= PARSE_FLAG_NO_FOREIGN_CURRENCY;
- }
-
- LocalPointer<NumberParserImpl> parser(new NumberParserImpl(parseFlags));
-
- parser->fLocalMatchers.ignorables = {parseFlags};
- IgnorablesMatcher& ignorables = parser->fLocalMatchers.ignorables;
-
- //////////////////////
- /// AFFIX MATCHERS ///
- //////////////////////
-
- // The following statements set up the affix matchers.
- AffixTokenMatcherSetupData affixSetupData = {
- currencySymbols, symbols, ignorables, locale, parseFlags};
- parser->fLocalMatchers.affixTokenMatcherWarehouse = {&affixSetupData};
- parser->fLocalMatchers.affixMatcherWarehouse = {&parser->fLocalMatchers.affixTokenMatcherWarehouse};
- parser->fLocalMatchers.affixMatcherWarehouse.createAffixMatchers(
- affixProvider.get(), *parser, ignorables, parseFlags, status);
-
- ////////////////////////
- /// CURRENCY MATCHER ///
- ////////////////////////
-
- if (parseCurrency || affixProvider.get().hasCurrencySign()) {
- parser->addMatcher(parser->fLocalMatchers.currency = {currencySymbols, symbols, parseFlags, status});
- }
-
- ///////////////
- /// PERCENT ///
- ///////////////
-
- // ICU-TC meeting, April 11, 2018: accept percent/permille only if it is in the pattern,
- // and to maintain regressive behavior, divide by 100 even if no percent sign is present.
- if (!isStrict && affixProvider.get().containsSymbolType(AffixPatternType::TYPE_PERCENT, status)) {
- parser->addMatcher(parser->fLocalMatchers.percent = {symbols});
- }
- if (!isStrict && affixProvider.get().containsSymbolType(AffixPatternType::TYPE_PERMILLE, status)) {
- parser->addMatcher(parser->fLocalMatchers.permille = {symbols});
- }
-
- ///////////////////////////////
- /// OTHER STANDARD MATCHERS ///
- ///////////////////////////////
-
- if (!isStrict) {
- parser->addMatcher(parser->fLocalMatchers.plusSign = {symbols, false});
- parser->addMatcher(parser->fLocalMatchers.minusSign = {symbols, false});
- }
- parser->addMatcher(parser->fLocalMatchers.nan = {symbols});
- parser->addMatcher(parser->fLocalMatchers.infinity = {symbols});
- UnicodeString padString = properties.padString;
- if (!padString.isBogus() && !ignorables.getSet()->contains(padString)) {
- parser->addMatcher(parser->fLocalMatchers.padding = {padString});
- }
- parser->addMatcher(parser->fLocalMatchers.ignorables);
- parser->addMatcher(parser->fLocalMatchers.decimal = {symbols, grouper, parseFlags});
- // NOTE: parseNoExponent doesn't disable scientific parsing if we have a scientific formatter
- if (!properties.parseNoExponent || properties.minimumExponentDigits > 0) {
- parser->addMatcher(parser->fLocalMatchers.scientific = {symbols, grouper});
- }
-
- //////////////////
- /// VALIDATORS ///
- //////////////////
-
- parser->addMatcher(parser->fLocalValidators.number = {});
- if (isStrict) {
- parser->addMatcher(parser->fLocalValidators.affix = {});
- }
- if (parseCurrency) {
- parser->addMatcher(parser->fLocalValidators.currency = {});
- }
- if (properties.decimalPatternMatchRequired) {
- bool patternHasDecimalSeparator =
- properties.decimalSeparatorAlwaysShown || properties.maximumFractionDigits != 0;
- parser->addMatcher(parser->fLocalValidators.decimalSeparator = {patternHasDecimalSeparator});
- }
- // The multiplier takes care of scaling percentages.
- Scale multiplier = scaleFromProperties(properties);
- if (multiplier.isValid()) {
- parser->addMatcher(parser->fLocalValidators.multiplier = {multiplier});
- }
-
- parser->freeze();
- return parser.orphan();
-}
-
-NumberParserImpl::NumberParserImpl(parse_flags_t parseFlags)
- : fParseFlags(parseFlags) {
-}
-
-NumberParserImpl::~NumberParserImpl() {
- fNumMatchers = 0;
-}
-
-void NumberParserImpl::addMatcher(NumberParseMatcher& matcher) {
- if (fNumMatchers + 1 > fMatchers.getCapacity()) {
- fMatchers.resize(fNumMatchers * 2, fNumMatchers);
- }
- fMatchers[fNumMatchers] = &matcher;
- fNumMatchers++;
-}
-
-void NumberParserImpl::freeze() {
- fFrozen = true;
-}
-
-parse_flags_t NumberParserImpl::getParseFlags() const {
- return fParseFlags;
-}
-
-void NumberParserImpl::parse(const UnicodeString& input, bool greedy, ParsedNumber& result,
- UErrorCode& status) const {
- return parse(input, 0, greedy, result, status);
-}
-
-void NumberParserImpl::parse(const UnicodeString& input, int32_t start, bool greedy, ParsedNumber& result,
- UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return;
- }
- U_ASSERT(fFrozen);
- // TODO: Check start >= 0 and start < input.length()
- StringSegment segment(input, 0 != (fParseFlags & PARSE_FLAG_IGNORE_CASE));
- segment.adjustOffset(start);
- if (greedy) {
- parseGreedy(segment, result, status);
- } else if (0 != (fParseFlags & PARSE_FLAG_ALLOW_INFINITE_RECURSION)) {
- // Start at 1 so that recursionLevels never gets to 0
- parseLongestRecursive(segment, result, 1, status);
- } else {
- // Arbitrary recursion safety limit: 100 levels.
- parseLongestRecursive(segment, result, -100, status);
- }
- for (int32_t i = 0; i < fNumMatchers; i++) {
- fMatchers[i]->postProcess(result);
- }
- result.postProcess();
-}
-
-void NumberParserImpl::parseGreedy(StringSegment& segment, ParsedNumber& result,
- UErrorCode& status) const {
- // Note: this method is not recursive in order to avoid stack overflow.
- for (int i = 0; i <fNumMatchers;) {
- // Base Case
- if (segment.length() == 0) {
- return;
- }
- const NumberParseMatcher* matcher = fMatchers[i];
- if (!matcher->smokeTest(segment)) {
- // Matcher failed smoke test: try the next one
- i++;
- continue;
- }
- int32_t initialOffset = segment.getOffset();
- matcher->match(segment, result, status);
- if (U_FAILURE(status)) {
- return;
- }
- if (segment.getOffset() != initialOffset) {
- // Greedy heuristic: accept the match and loop back
- i = 0;
- continue;
- } else {
- // Matcher did not match: try the next one
- i++;
- continue;
- }
- UPRV_UNREACHABLE;
- }
-
- // NOTE: If we get here, the greedy parse completed without consuming the entire string.
-}
-
-void NumberParserImpl::parseLongestRecursive(StringSegment& segment, ParsedNumber& result,
- int32_t recursionLevels,
- UErrorCode& status) const {
- // Base Case
- if (segment.length() == 0) {
- return;
- }
-
- // Safety against stack overflow
- if (recursionLevels == 0) {
- return;
- }
-
- // TODO: Give a nice way for the matcher to reset the ParsedNumber?
- ParsedNumber initial(result);
- ParsedNumber candidate;
-
- int initialOffset = segment.getOffset();
- for (int32_t i = 0; i < fNumMatchers; i++) {
- const NumberParseMatcher* matcher = fMatchers[i];
- if (!matcher->smokeTest(segment)) {
- continue;
- }
-
- // In a non-greedy parse, we attempt all possible matches and pick the best.
- for (int32_t charsToConsume = 0; charsToConsume < segment.length();) {
- charsToConsume += U16_LENGTH(segment.codePointAt(charsToConsume));
-
- // Run the matcher on a segment of the current length.
- candidate = initial;
- segment.setLength(charsToConsume);
- bool maybeMore = matcher->match(segment, candidate, status);
- segment.resetLength();
- if (U_FAILURE(status)) {
- return;
- }
-
- // If the entire segment was consumed, recurse.
- if (segment.getOffset() - initialOffset == charsToConsume) {
- parseLongestRecursive(segment, candidate, recursionLevels + 1, status);
- if (U_FAILURE(status)) {
- return;
- }
- if (candidate.isBetterThan(result)) {
- result = candidate;
- }
- }
-
- // Since the segment can be re-used, reset the offset.
- // This does not have an effect if the matcher did not consume any chars.
- segment.setOffset(initialOffset);
-
- // Unless the matcher wants to see the next char, continue to the next matcher.
- if (!maybeMore) {
- break;
- }
- }
- }
-}
-
-UnicodeString NumberParserImpl::toString() const {
- UnicodeString result(u"<NumberParserImpl matchers:[");
- for (int32_t i = 0; i < fNumMatchers; i++) {
- result.append(u' ');
- result.append(fMatchers[i]->toString());
- }
- result.append(u" ]>", -1);
- return result;
-}
-
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include <typeinfo>
+#include <array>
+#include "number_types.h"
+#include "number_patternstring.h"
+#include "numparse_types.h"
+#include "numparse_impl.h"
+#include "numparse_symbols.h"
+#include "numparse_decimal.h"
+#include "unicode/numberformatter.h"
+#include "cstr.h"
+#include "number_mapper.h"
+#include "static_unicode_sets.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+using namespace icu::numparse;
+using namespace icu::numparse::impl;
+
+
+NumberParseMatcher::~NumberParseMatcher() = default;
+
+
+NumberParserImpl*
+NumberParserImpl::createSimpleParser(const Locale& locale, const UnicodeString& patternString,
+ parse_flags_t parseFlags, UErrorCode& status) {
+
+ LocalPointer<NumberParserImpl> parser(new NumberParserImpl(parseFlags));
+ DecimalFormatSymbols symbols(locale, status);
+
+ parser->fLocalMatchers.ignorables = {parseFlags};
+ IgnorablesMatcher& ignorables = parser->fLocalMatchers.ignorables;
+
+ DecimalFormatSymbols dfs(locale, status);
+ dfs.setSymbol(DecimalFormatSymbols::kCurrencySymbol, u"IU$");
+ dfs.setSymbol(DecimalFormatSymbols::kIntlCurrencySymbol, u"ICU");
+ CurrencySymbols currencySymbols({u"ICU", status}, locale, dfs, status);
+
+ ParsedPatternInfo patternInfo;
+ PatternParser::parseToPatternInfo(patternString, patternInfo, status);
+
+ // The following statements set up the affix matchers.
+ AffixTokenMatcherSetupData affixSetupData = {
+ currencySymbols, symbols, ignorables, locale, parseFlags};
+ parser->fLocalMatchers.affixTokenMatcherWarehouse = {&affixSetupData};
+ parser->fLocalMatchers.affixMatcherWarehouse = {&parser->fLocalMatchers.affixTokenMatcherWarehouse};
+ parser->fLocalMatchers.affixMatcherWarehouse.createAffixMatchers(
+ patternInfo, *parser, ignorables, parseFlags, status);
+
+ Grouper grouper = Grouper::forStrategy(UNUM_GROUPING_AUTO);
+ grouper.setLocaleData(patternInfo, locale);
+
+ parser->addMatcher(parser->fLocalMatchers.ignorables);
+ parser->addMatcher(parser->fLocalMatchers.decimal = {symbols, grouper, parseFlags});
+ parser->addMatcher(parser->fLocalMatchers.minusSign = {symbols, false});
+ parser->addMatcher(parser->fLocalMatchers.plusSign = {symbols, false});
+ parser->addMatcher(parser->fLocalMatchers.percent = {symbols});
+ parser->addMatcher(parser->fLocalMatchers.permille = {symbols});
+ parser->addMatcher(parser->fLocalMatchers.nan = {symbols});
+ parser->addMatcher(parser->fLocalMatchers.infinity = {symbols});
+ parser->addMatcher(parser->fLocalMatchers.padding = {u"@"});
+ parser->addMatcher(parser->fLocalMatchers.scientific = {symbols, grouper});
+ parser->addMatcher(parser->fLocalMatchers.currency = {currencySymbols, symbols, parseFlags, status});
+ parser->addMatcher(parser->fLocalValidators.number = {});
+
+ parser->freeze();
+ return parser.orphan();
+}
+
+NumberParserImpl*
+NumberParserImpl::createParserFromProperties(const number::impl::DecimalFormatProperties& properties,
+ const DecimalFormatSymbols& symbols, bool parseCurrency,
+ UErrorCode& status) {
+ Locale locale = symbols.getLocale();
+ AutoAffixPatternProvider affixProvider(properties, status);
+ if (U_FAILURE(status)) { return nullptr; }
+ CurrencyUnit currency = resolveCurrency(properties, locale, status);
+ CurrencySymbols currencySymbols(currency, locale, symbols, status);
+ bool isStrict = properties.parseMode.getOrDefault(PARSE_MODE_STRICT) == PARSE_MODE_STRICT;
+ Grouper grouper = Grouper::forProperties(properties);
+ int parseFlags = 0;
+ if (U_FAILURE(status)) { return nullptr; }
+ if (!properties.parseCaseSensitive) {
+ parseFlags |= PARSE_FLAG_IGNORE_CASE;
+ }
+ if (properties.parseIntegerOnly) {
+ parseFlags |= PARSE_FLAG_INTEGER_ONLY;
+ }
+ if (properties.signAlwaysShown) {
+ parseFlags |= PARSE_FLAG_PLUS_SIGN_ALLOWED;
+ }
+ if (isStrict) {
+ parseFlags |= PARSE_FLAG_STRICT_GROUPING_SIZE;
+ parseFlags |= PARSE_FLAG_STRICT_SEPARATORS;
+ parseFlags |= PARSE_FLAG_USE_FULL_AFFIXES;
+ parseFlags |= PARSE_FLAG_EXACT_AFFIX;
+ parseFlags |= PARSE_FLAG_STRICT_IGNORABLES;
+ } else {
+ parseFlags |= PARSE_FLAG_INCLUDE_UNPAIRED_AFFIXES;
+ }
+ if (grouper.getPrimary() <= 0) {
+ parseFlags |= PARSE_FLAG_GROUPING_DISABLED;
+ }
+ if (parseCurrency || affixProvider.get().hasCurrencySign()) {
+ parseFlags |= PARSE_FLAG_MONETARY_SEPARATORS;
+ }
+ if (!parseCurrency) {
+ parseFlags |= PARSE_FLAG_NO_FOREIGN_CURRENCY;
+ }
+
+ LocalPointer<NumberParserImpl> parser(new NumberParserImpl(parseFlags));
+
+ parser->fLocalMatchers.ignorables = {parseFlags};
+ IgnorablesMatcher& ignorables = parser->fLocalMatchers.ignorables;
+
+ //////////////////////
+ /// AFFIX MATCHERS ///
+ //////////////////////
+
+ // The following statements set up the affix matchers.
+ AffixTokenMatcherSetupData affixSetupData = {
+ currencySymbols, symbols, ignorables, locale, parseFlags};
+ parser->fLocalMatchers.affixTokenMatcherWarehouse = {&affixSetupData};
+ parser->fLocalMatchers.affixMatcherWarehouse = {&parser->fLocalMatchers.affixTokenMatcherWarehouse};
+ parser->fLocalMatchers.affixMatcherWarehouse.createAffixMatchers(
+ affixProvider.get(), *parser, ignorables, parseFlags, status);
+
+ ////////////////////////
+ /// CURRENCY MATCHER ///
+ ////////////////////////
+
+ if (parseCurrency || affixProvider.get().hasCurrencySign()) {
+ parser->addMatcher(parser->fLocalMatchers.currency = {currencySymbols, symbols, parseFlags, status});
+ }
+
+ ///////////////
+ /// PERCENT ///
+ ///////////////
+
+ // ICU-TC meeting, April 11, 2018: accept percent/permille only if it is in the pattern,
+ // and to maintain regressive behavior, divide by 100 even if no percent sign is present.
+ if (!isStrict && affixProvider.get().containsSymbolType(AffixPatternType::TYPE_PERCENT, status)) {
+ parser->addMatcher(parser->fLocalMatchers.percent = {symbols});
+ }
+ if (!isStrict && affixProvider.get().containsSymbolType(AffixPatternType::TYPE_PERMILLE, status)) {
+ parser->addMatcher(parser->fLocalMatchers.permille = {symbols});
+ }
+
+ ///////////////////////////////
+ /// OTHER STANDARD MATCHERS ///
+ ///////////////////////////////
+
+ if (!isStrict) {
+ parser->addMatcher(parser->fLocalMatchers.plusSign = {symbols, false});
+ parser->addMatcher(parser->fLocalMatchers.minusSign = {symbols, false});
+ }
+ parser->addMatcher(parser->fLocalMatchers.nan = {symbols});
+ parser->addMatcher(parser->fLocalMatchers.infinity = {symbols});
+ UnicodeString padString = properties.padString;
+ if (!padString.isBogus() && !ignorables.getSet()->contains(padString)) {
+ parser->addMatcher(parser->fLocalMatchers.padding = {padString});
+ }
+ parser->addMatcher(parser->fLocalMatchers.ignorables);
+ parser->addMatcher(parser->fLocalMatchers.decimal = {symbols, grouper, parseFlags});
+ // NOTE: parseNoExponent doesn't disable scientific parsing if we have a scientific formatter
+ if (!properties.parseNoExponent || properties.minimumExponentDigits > 0) {
+ parser->addMatcher(parser->fLocalMatchers.scientific = {symbols, grouper});
+ }
+
+ //////////////////
+ /// VALIDATORS ///
+ //////////////////
+
+ parser->addMatcher(parser->fLocalValidators.number = {});
+ if (isStrict) {
+ parser->addMatcher(parser->fLocalValidators.affix = {});
+ }
+ if (parseCurrency) {
+ parser->addMatcher(parser->fLocalValidators.currency = {});
+ }
+ if (properties.decimalPatternMatchRequired) {
+ bool patternHasDecimalSeparator =
+ properties.decimalSeparatorAlwaysShown || properties.maximumFractionDigits != 0;
+ parser->addMatcher(parser->fLocalValidators.decimalSeparator = {patternHasDecimalSeparator});
+ }
+ // The multiplier takes care of scaling percentages.
+ Scale multiplier = scaleFromProperties(properties);
+ if (multiplier.isValid()) {
+ parser->addMatcher(parser->fLocalValidators.multiplier = {multiplier});
+ }
+
+ parser->freeze();
+ return parser.orphan();
+}
+
+NumberParserImpl::NumberParserImpl(parse_flags_t parseFlags)
+ : fParseFlags(parseFlags) {
+}
+
+NumberParserImpl::~NumberParserImpl() {
+ fNumMatchers = 0;
+}
+
+void NumberParserImpl::addMatcher(NumberParseMatcher& matcher) {
+ if (fNumMatchers + 1 > fMatchers.getCapacity()) {
+ fMatchers.resize(fNumMatchers * 2, fNumMatchers);
+ }
+ fMatchers[fNumMatchers] = &matcher;
+ fNumMatchers++;
+}
+
+void NumberParserImpl::freeze() {
+ fFrozen = true;
+}
+
+parse_flags_t NumberParserImpl::getParseFlags() const {
+ return fParseFlags;
+}
+
+void NumberParserImpl::parse(const UnicodeString& input, bool greedy, ParsedNumber& result,
+ UErrorCode& status) const {
+ return parse(input, 0, greedy, result, status);
+}
+
+void NumberParserImpl::parse(const UnicodeString& input, int32_t start, bool greedy, ParsedNumber& result,
+ UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return;
+ }
+ U_ASSERT(fFrozen);
+ // TODO: Check start >= 0 and start < input.length()
+ StringSegment segment(input, 0 != (fParseFlags & PARSE_FLAG_IGNORE_CASE));
+ segment.adjustOffset(start);
+ if (greedy) {
+ parseGreedy(segment, result, status);
+ } else if (0 != (fParseFlags & PARSE_FLAG_ALLOW_INFINITE_RECURSION)) {
+ // Start at 1 so that recursionLevels never gets to 0
+ parseLongestRecursive(segment, result, 1, status);
+ } else {
+ // Arbitrary recursion safety limit: 100 levels.
+ parseLongestRecursive(segment, result, -100, status);
+ }
+ for (int32_t i = 0; i < fNumMatchers; i++) {
+ fMatchers[i]->postProcess(result);
+ }
+ result.postProcess();
+}
+
+void NumberParserImpl::parseGreedy(StringSegment& segment, ParsedNumber& result,
+ UErrorCode& status) const {
+ // Note: this method is not recursive in order to avoid stack overflow.
+ for (int i = 0; i <fNumMatchers;) {
+ // Base Case
+ if (segment.length() == 0) {
+ return;
+ }
+ const NumberParseMatcher* matcher = fMatchers[i];
+ if (!matcher->smokeTest(segment)) {
+ // Matcher failed smoke test: try the next one
+ i++;
+ continue;
+ }
+ int32_t initialOffset = segment.getOffset();
+ matcher->match(segment, result, status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ if (segment.getOffset() != initialOffset) {
+ // Greedy heuristic: accept the match and loop back
+ i = 0;
+ continue;
+ } else {
+ // Matcher did not match: try the next one
+ i++;
+ continue;
+ }
+ UPRV_UNREACHABLE;
+ }
+
+ // NOTE: If we get here, the greedy parse completed without consuming the entire string.
+}
+
+void NumberParserImpl::parseLongestRecursive(StringSegment& segment, ParsedNumber& result,
+ int32_t recursionLevels,
+ UErrorCode& status) const {
+ // Base Case
+ if (segment.length() == 0) {
+ return;
+ }
+
+ // Safety against stack overflow
+ if (recursionLevels == 0) {
+ return;
+ }
+
+ // TODO: Give a nice way for the matcher to reset the ParsedNumber?
+ ParsedNumber initial(result);
+ ParsedNumber candidate;
+
+ int initialOffset = segment.getOffset();
+ for (int32_t i = 0; i < fNumMatchers; i++) {
+ const NumberParseMatcher* matcher = fMatchers[i];
+ if (!matcher->smokeTest(segment)) {
+ continue;
+ }
+
+ // In a non-greedy parse, we attempt all possible matches and pick the best.
+ for (int32_t charsToConsume = 0; charsToConsume < segment.length();) {
+ charsToConsume += U16_LENGTH(segment.codePointAt(charsToConsume));
+
+ // Run the matcher on a segment of the current length.
+ candidate = initial;
+ segment.setLength(charsToConsume);
+ bool maybeMore = matcher->match(segment, candidate, status);
+ segment.resetLength();
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ // If the entire segment was consumed, recurse.
+ if (segment.getOffset() - initialOffset == charsToConsume) {
+ parseLongestRecursive(segment, candidate, recursionLevels + 1, status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ if (candidate.isBetterThan(result)) {
+ result = candidate;
+ }
+ }
+
+ // Since the segment can be re-used, reset the offset.
+ // This does not have an effect if the matcher did not consume any chars.
+ segment.setOffset(initialOffset);
+
+ // Unless the matcher wants to see the next char, continue to the next matcher.
+ if (!maybeMore) {
+ break;
+ }
+ }
+ }
+}
+
+UnicodeString NumberParserImpl::toString() const {
+ UnicodeString result(u"<NumberParserImpl matchers:[");
+ for (int32_t i = 0; i < fNumMatchers; i++) {
+ result.append(u' ');
+ result.append(fMatchers[i]->toString());
+ }
+ result.append(u" ]>", -1);
+ return result;
+}
+
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numparse_impl.h b/contrib/libs/icu/i18n/numparse_impl.h
index ec1969e68c..380d9aa4c6 100644
--- a/contrib/libs/icu/i18n/numparse_impl.h
+++ b/contrib/libs/icu/i18n/numparse_impl.h
@@ -1,111 +1,111 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMPARSE_IMPL_H__
-#define __NUMPARSE_IMPL_H__
-
-#include "numparse_types.h"
-#include "numparse_decimal.h"
-#include "numparse_symbols.h"
-#include "numparse_scientific.h"
-#include "unicode/uniset.h"
-#include "numparse_currency.h"
-#include "numparse_affixes.h"
-#include "number_decimfmtprops.h"
-#include "unicode/localpointer.h"
-#include "numparse_validators.h"
-#include "number_multiplier.h"
-#include "string_segment.h"
-
-U_NAMESPACE_BEGIN
-
-// Export an explicit template instantiation of the MaybeStackArray that is used as a data member of NumberParserImpl.
-// When building DLLs for Windows this is required even though no direct access to the MaybeStackArray leaks out of the i18n library.
-// (See numparse_compositions.h, numparse_affixes.h, datefmt.h, and others for similar examples.)
-#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
-template class U_I18N_API MaybeStackArray<const numparse::impl::NumberParseMatcher*, 10>;
-#endif
-
-namespace numparse {
-namespace impl {
-
-// Exported as U_I18N_API for tests
-class U_I18N_API NumberParserImpl : public MutableMatcherCollection, public UMemory {
- public:
- virtual ~NumberParserImpl();
-
- static NumberParserImpl* createSimpleParser(const Locale& locale, const UnicodeString& patternString,
- parse_flags_t parseFlags, UErrorCode& status);
-
- static NumberParserImpl* createParserFromProperties(
- const number::impl::DecimalFormatProperties& properties, const DecimalFormatSymbols& symbols,
- bool parseCurrency, UErrorCode& status);
-
- /**
- * Does NOT take ownership of the matcher. The matcher MUST remain valid for the lifespan of the
- * NumberParserImpl.
- * @param matcher The matcher to reference.
- */
- void addMatcher(NumberParseMatcher& matcher) override;
-
- void freeze();
-
- parse_flags_t getParseFlags() const;
-
- void parse(const UnicodeString& input, bool greedy, ParsedNumber& result, UErrorCode& status) const;
-
- void parse(const UnicodeString& input, int32_t start, bool greedy, ParsedNumber& result,
- UErrorCode& status) const;
-
- UnicodeString toString() const;
-
- private:
- parse_flags_t fParseFlags;
- int32_t fNumMatchers = 0;
- // NOTE: The stack capacity for fMatchers and fLeads should be the same
- MaybeStackArray<const NumberParseMatcher*, 10> fMatchers;
- bool fFrozen = false;
-
- // WARNING: All of these matchers start in an undefined state (default-constructed).
- // You must use an assignment operator on them before using.
- struct {
- IgnorablesMatcher ignorables;
- InfinityMatcher infinity;
- MinusSignMatcher minusSign;
- NanMatcher nan;
- PaddingMatcher padding;
- PercentMatcher percent;
- PermilleMatcher permille;
- PlusSignMatcher plusSign;
- DecimalMatcher decimal;
- ScientificMatcher scientific;
- CombinedCurrencyMatcher currency;
- AffixMatcherWarehouse affixMatcherWarehouse;
- AffixTokenMatcherWarehouse affixTokenMatcherWarehouse;
- } fLocalMatchers;
- struct {
- RequireAffixValidator affix;
- RequireCurrencyValidator currency;
- RequireDecimalSeparatorValidator decimalSeparator;
- RequireNumberValidator number;
- MultiplierParseHandler multiplier;
- } fLocalValidators;
-
- explicit NumberParserImpl(parse_flags_t parseFlags);
-
- void parseGreedy(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const;
-
- void parseLongestRecursive(
- StringSegment& segment, ParsedNumber& result, int32_t recursionLevels, UErrorCode& status) const;
-};
-
-
-} // namespace impl
-} // namespace numparse
-U_NAMESPACE_END
-
-#endif //__NUMPARSE_IMPL_H__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMPARSE_IMPL_H__
+#define __NUMPARSE_IMPL_H__
+
+#include "numparse_types.h"
+#include "numparse_decimal.h"
+#include "numparse_symbols.h"
+#include "numparse_scientific.h"
+#include "unicode/uniset.h"
+#include "numparse_currency.h"
+#include "numparse_affixes.h"
+#include "number_decimfmtprops.h"
+#include "unicode/localpointer.h"
+#include "numparse_validators.h"
+#include "number_multiplier.h"
+#include "string_segment.h"
+
+U_NAMESPACE_BEGIN
+
+// Export an explicit template instantiation of the MaybeStackArray that is used as a data member of NumberParserImpl.
+// When building DLLs for Windows this is required even though no direct access to the MaybeStackArray leaks out of the i18n library.
+// (See numparse_compositions.h, numparse_affixes.h, datefmt.h, and others for similar examples.)
+#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
+template class U_I18N_API MaybeStackArray<const numparse::impl::NumberParseMatcher*, 10>;
+#endif
+
+namespace numparse {
+namespace impl {
+
+// Exported as U_I18N_API for tests
+class U_I18N_API NumberParserImpl : public MutableMatcherCollection, public UMemory {
+ public:
+ virtual ~NumberParserImpl();
+
+ static NumberParserImpl* createSimpleParser(const Locale& locale, const UnicodeString& patternString,
+ parse_flags_t parseFlags, UErrorCode& status);
+
+ static NumberParserImpl* createParserFromProperties(
+ const number::impl::DecimalFormatProperties& properties, const DecimalFormatSymbols& symbols,
+ bool parseCurrency, UErrorCode& status);
+
+ /**
+ * Does NOT take ownership of the matcher. The matcher MUST remain valid for the lifespan of the
+ * NumberParserImpl.
+ * @param matcher The matcher to reference.
+ */
+ void addMatcher(NumberParseMatcher& matcher) override;
+
+ void freeze();
+
+ parse_flags_t getParseFlags() const;
+
+ void parse(const UnicodeString& input, bool greedy, ParsedNumber& result, UErrorCode& status) const;
+
+ void parse(const UnicodeString& input, int32_t start, bool greedy, ParsedNumber& result,
+ UErrorCode& status) const;
+
+ UnicodeString toString() const;
+
+ private:
+ parse_flags_t fParseFlags;
+ int32_t fNumMatchers = 0;
+ // NOTE: The stack capacity for fMatchers and fLeads should be the same
+ MaybeStackArray<const NumberParseMatcher*, 10> fMatchers;
+ bool fFrozen = false;
+
+ // WARNING: All of these matchers start in an undefined state (default-constructed).
+ // You must use an assignment operator on them before using.
+ struct {
+ IgnorablesMatcher ignorables;
+ InfinityMatcher infinity;
+ MinusSignMatcher minusSign;
+ NanMatcher nan;
+ PaddingMatcher padding;
+ PercentMatcher percent;
+ PermilleMatcher permille;
+ PlusSignMatcher plusSign;
+ DecimalMatcher decimal;
+ ScientificMatcher scientific;
+ CombinedCurrencyMatcher currency;
+ AffixMatcherWarehouse affixMatcherWarehouse;
+ AffixTokenMatcherWarehouse affixTokenMatcherWarehouse;
+ } fLocalMatchers;
+ struct {
+ RequireAffixValidator affix;
+ RequireCurrencyValidator currency;
+ RequireDecimalSeparatorValidator decimalSeparator;
+ RequireNumberValidator number;
+ MultiplierParseHandler multiplier;
+ } fLocalValidators;
+
+ explicit NumberParserImpl(parse_flags_t parseFlags);
+
+ void parseGreedy(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const;
+
+ void parseLongestRecursive(
+ StringSegment& segment, ParsedNumber& result, int32_t recursionLevels, UErrorCode& status) const;
+};
+
+
+} // namespace impl
+} // namespace numparse
+U_NAMESPACE_END
+
+#endif //__NUMPARSE_IMPL_H__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numparse_parsednumber.cpp b/contrib/libs/icu/i18n/numparse_parsednumber.cpp
index cd2dad8883..4b373a3c31 100644
--- a/contrib/libs/icu/i18n/numparse_parsednumber.cpp
+++ b/contrib/libs/icu/i18n/numparse_parsednumber.cpp
@@ -1,126 +1,126 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include "numparse_types.h"
-#include "number_decimalquantity.h"
-#include "string_segment.h"
-#include "putilimp.h"
-#include <cmath>
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-using namespace icu::numparse;
-using namespace icu::numparse::impl;
-
-
-ParsedNumber::ParsedNumber() {
- clear();
-}
-
-void ParsedNumber::clear() {
- quantity.bogus = true;
- charEnd = 0;
- flags = 0;
- prefix.setToBogus();
- suffix.setToBogus();
- currencyCode[0] = 0;
-}
-
-void ParsedNumber::setCharsConsumed(const StringSegment& segment) {
- charEnd = segment.getOffset();
-}
-
-void ParsedNumber::postProcess() {
- if (!quantity.bogus && 0 != (flags & FLAG_NEGATIVE)) {
- quantity.negate();
- }
-}
-
-bool ParsedNumber::success() const {
- return charEnd > 0 && 0 == (flags & FLAG_FAIL);
-}
-
-bool ParsedNumber::seenNumber() const {
- return !quantity.bogus || 0 != (flags & FLAG_NAN) || 0 != (flags & FLAG_INFINITY);
-}
-
-double ParsedNumber::getDouble(UErrorCode& status) const {
- bool sawNaN = 0 != (flags & FLAG_NAN);
- bool sawInfinity = 0 != (flags & FLAG_INFINITY);
-
- // Check for NaN, infinity, and -0.0
- if (sawNaN) {
- // Can't use NAN or std::nan because the byte pattern is platform-dependent;
- // MSVC sets the sign bit, but Clang and GCC do not
- return uprv_getNaN();
- }
- if (sawInfinity) {
- if (0 != (flags & FLAG_NEGATIVE)) {
- return -INFINITY;
- } else {
- return INFINITY;
- }
- }
- if (quantity.bogus) {
- status = U_INVALID_STATE_ERROR;
- return 0.0;
- }
- if (quantity.isZeroish() && quantity.isNegative()) {
- return -0.0;
- }
-
- if (quantity.fitsInLong()) {
- return static_cast<double>(quantity.toLong());
- } else {
- return quantity.toDouble();
- }
-}
-
-void ParsedNumber::populateFormattable(Formattable& output, parse_flags_t parseFlags) const {
- bool sawNaN = 0 != (flags & FLAG_NAN);
- bool sawInfinity = 0 != (flags & FLAG_INFINITY);
- bool integerOnly = 0 != (parseFlags & PARSE_FLAG_INTEGER_ONLY);
-
- // Check for NaN, infinity, and -0.0
- if (sawNaN) {
- // Can't use NAN or std::nan because the byte pattern is platform-dependent;
- // MSVC sets the sign bit, but Clang and GCC do not
- output.setDouble(uprv_getNaN());
- return;
- }
- if (sawInfinity) {
- if (0 != (flags & FLAG_NEGATIVE)) {
- output.setDouble(-INFINITY);
- return;
- } else {
- output.setDouble(INFINITY);
- return;
- }
- }
- U_ASSERT(!quantity.bogus);
- if (quantity.isZeroish() && quantity.isNegative() && !integerOnly) {
- output.setDouble(-0.0);
- return;
- }
-
- // All other numbers
- output.adoptDecimalQuantity(new DecimalQuantity(quantity));
-}
-
-bool ParsedNumber::isBetterThan(const ParsedNumber& other) {
- // Favor results with strictly more characters consumed.
- return charEnd > other.charEnd;
-}
-
-
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include "numparse_types.h"
+#include "number_decimalquantity.h"
+#include "string_segment.h"
+#include "putilimp.h"
+#include <cmath>
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+using namespace icu::numparse;
+using namespace icu::numparse::impl;
+
+
+ParsedNumber::ParsedNumber() {
+ clear();
+}
+
+void ParsedNumber::clear() {
+ quantity.bogus = true;
+ charEnd = 0;
+ flags = 0;
+ prefix.setToBogus();
+ suffix.setToBogus();
+ currencyCode[0] = 0;
+}
+
+void ParsedNumber::setCharsConsumed(const StringSegment& segment) {
+ charEnd = segment.getOffset();
+}
+
+void ParsedNumber::postProcess() {
+ if (!quantity.bogus && 0 != (flags & FLAG_NEGATIVE)) {
+ quantity.negate();
+ }
+}
+
+bool ParsedNumber::success() const {
+ return charEnd > 0 && 0 == (flags & FLAG_FAIL);
+}
+
+bool ParsedNumber::seenNumber() const {
+ return !quantity.bogus || 0 != (flags & FLAG_NAN) || 0 != (flags & FLAG_INFINITY);
+}
+
+double ParsedNumber::getDouble(UErrorCode& status) const {
+ bool sawNaN = 0 != (flags & FLAG_NAN);
+ bool sawInfinity = 0 != (flags & FLAG_INFINITY);
+
+ // Check for NaN, infinity, and -0.0
+ if (sawNaN) {
+ // Can't use NAN or std::nan because the byte pattern is platform-dependent;
+ // MSVC sets the sign bit, but Clang and GCC do not
+ return uprv_getNaN();
+ }
+ if (sawInfinity) {
+ if (0 != (flags & FLAG_NEGATIVE)) {
+ return -INFINITY;
+ } else {
+ return INFINITY;
+ }
+ }
+ if (quantity.bogus) {
+ status = U_INVALID_STATE_ERROR;
+ return 0.0;
+ }
+ if (quantity.isZeroish() && quantity.isNegative()) {
+ return -0.0;
+ }
+
+ if (quantity.fitsInLong()) {
+ return static_cast<double>(quantity.toLong());
+ } else {
+ return quantity.toDouble();
+ }
+}
+
+void ParsedNumber::populateFormattable(Formattable& output, parse_flags_t parseFlags) const {
+ bool sawNaN = 0 != (flags & FLAG_NAN);
+ bool sawInfinity = 0 != (flags & FLAG_INFINITY);
+ bool integerOnly = 0 != (parseFlags & PARSE_FLAG_INTEGER_ONLY);
+
+ // Check for NaN, infinity, and -0.0
+ if (sawNaN) {
+ // Can't use NAN or std::nan because the byte pattern is platform-dependent;
+ // MSVC sets the sign bit, but Clang and GCC do not
+ output.setDouble(uprv_getNaN());
+ return;
+ }
+ if (sawInfinity) {
+ if (0 != (flags & FLAG_NEGATIVE)) {
+ output.setDouble(-INFINITY);
+ return;
+ } else {
+ output.setDouble(INFINITY);
+ return;
+ }
+ }
+ U_ASSERT(!quantity.bogus);
+ if (quantity.isZeroish() && quantity.isNegative() && !integerOnly) {
+ output.setDouble(-0.0);
+ return;
+ }
+
+ // All other numbers
+ output.adoptDecimalQuantity(new DecimalQuantity(quantity));
+}
+
+bool ParsedNumber::isBetterThan(const ParsedNumber& other) {
+ // Favor results with strictly more characters consumed.
+ return charEnd > other.charEnd;
+}
+
+
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numparse_scientific.cpp b/contrib/libs/icu/i18n/numparse_scientific.cpp
index f8c8a3fc75..4b88cd998f 100644
--- a/contrib/libs/icu/i18n/numparse_scientific.cpp
+++ b/contrib/libs/icu/i18n/numparse_scientific.cpp
@@ -1,163 +1,163 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include "numparse_types.h"
-#include "numparse_scientific.h"
-#include "static_unicode_sets.h"
-#include "string_segment.h"
-
-using namespace icu;
-using namespace icu::numparse;
-using namespace icu::numparse::impl;
-
-
-namespace {
-
-inline const UnicodeSet& minusSignSet() {
- return *unisets::get(unisets::MINUS_SIGN);
-}
-
-inline const UnicodeSet& plusSignSet() {
- return *unisets::get(unisets::PLUS_SIGN);
-}
-
-} // namespace
-
-
-ScientificMatcher::ScientificMatcher(const DecimalFormatSymbols& dfs, const Grouper& grouper)
- : fExponentSeparatorString(dfs.getConstSymbol(DecimalFormatSymbols::kExponentialSymbol)),
- fExponentMatcher(dfs, grouper, PARSE_FLAG_INTEGER_ONLY | PARSE_FLAG_GROUPING_DISABLED),
- fIgnorablesMatcher(PARSE_FLAG_STRICT_IGNORABLES) {
-
- const UnicodeString& minusSign = dfs.getConstSymbol(DecimalFormatSymbols::kMinusSignSymbol);
- if (minusSignSet().contains(minusSign)) {
- fCustomMinusSign.setToBogus();
- } else {
- fCustomMinusSign = minusSign;
- }
-
- const UnicodeString& plusSign = dfs.getConstSymbol(DecimalFormatSymbols::kPlusSignSymbol);
- if (plusSignSet().contains(plusSign)) {
- fCustomPlusSign.setToBogus();
- } else {
- fCustomPlusSign = plusSign;
- }
-}
-
-bool ScientificMatcher::match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const {
- // Only accept scientific notation after the mantissa.
- if (!result.seenNumber()) {
- return false;
- }
-
- // Only accept one exponent per string.
- if (0 != (result.flags & FLAG_HAS_EXPONENT)) {
- return false;
- }
-
- // First match the scientific separator, and then match another number after it.
- // NOTE: This is guarded by the smoke test; no need to check fExponentSeparatorString length again.
- int32_t initialOffset = segment.getOffset();
- int32_t overlap = segment.getCommonPrefixLength(fExponentSeparatorString);
- if (overlap == fExponentSeparatorString.length()) {
- // Full exponent separator match.
-
- // First attempt to get a code point, returning true if we can't get one.
- if (segment.length() == overlap) {
- return true;
- }
- segment.adjustOffset(overlap);
-
- // Allow ignorables before the sign.
- // Note: call site is guarded by the segment.length() check above.
- // Note: the ignorables matcher should not touch the result.
- fIgnorablesMatcher.match(segment, result, status);
- if (segment.length() == 0) {
- segment.setOffset(initialOffset);
- return true;
- }
-
- // Allow a sign, and then try to match digits.
- int8_t exponentSign = 1;
- if (segment.startsWith(minusSignSet())) {
- exponentSign = -1;
- segment.adjustOffsetByCodePoint();
- } else if (segment.startsWith(plusSignSet())) {
- segment.adjustOffsetByCodePoint();
- } else if (segment.startsWith(fCustomMinusSign)) {
- overlap = segment.getCommonPrefixLength(fCustomMinusSign);
- if (overlap != fCustomMinusSign.length()) {
- // Partial custom sign match
- segment.setOffset(initialOffset);
- return true;
- }
- exponentSign = -1;
- segment.adjustOffset(overlap);
- } else if (segment.startsWith(fCustomPlusSign)) {
- overlap = segment.getCommonPrefixLength(fCustomPlusSign);
- if (overlap != fCustomPlusSign.length()) {
- // Partial custom sign match
- segment.setOffset(initialOffset);
- return true;
- }
- segment.adjustOffset(overlap);
- }
-
- // Return true if the segment is empty.
- if (segment.length() == 0) {
- segment.setOffset(initialOffset);
- return true;
- }
-
- // Allow ignorables after the sign.
- // Note: call site is guarded by the segment.length() check above.
- // Note: the ignorables matcher should not touch the result.
- fIgnorablesMatcher.match(segment, result, status);
- if (segment.length() == 0) {
- segment.setOffset(initialOffset);
- return true;
- }
-
- // We are supposed to accept E0 after NaN, so we need to make sure result.quantity is available.
- bool wasBogus = result.quantity.bogus;
- result.quantity.bogus = false;
- int digitsOffset = segment.getOffset();
- bool digitsReturnValue = fExponentMatcher.match(segment, result, exponentSign, status);
- result.quantity.bogus = wasBogus;
-
- if (segment.getOffset() != digitsOffset) {
- // At least one exponent digit was matched.
- result.flags |= FLAG_HAS_EXPONENT;
- } else {
- // No exponent digits were matched
- segment.setOffset(initialOffset);
- }
- return digitsReturnValue;
-
- } else if (overlap == segment.length()) {
- // Partial exponent separator match
- return true;
- }
-
- // No match
- return false;
-}
-
-bool ScientificMatcher::smokeTest(const StringSegment& segment) const {
- return segment.startsWith(fExponentSeparatorString);
-}
-
-UnicodeString ScientificMatcher::toString() const {
- return u"<Scientific>";
-}
-
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include "numparse_types.h"
+#include "numparse_scientific.h"
+#include "static_unicode_sets.h"
+#include "string_segment.h"
+
+using namespace icu;
+using namespace icu::numparse;
+using namespace icu::numparse::impl;
+
+
+namespace {
+
+inline const UnicodeSet& minusSignSet() {
+ return *unisets::get(unisets::MINUS_SIGN);
+}
+
+inline const UnicodeSet& plusSignSet() {
+ return *unisets::get(unisets::PLUS_SIGN);
+}
+
+} // namespace
+
+
+ScientificMatcher::ScientificMatcher(const DecimalFormatSymbols& dfs, const Grouper& grouper)
+ : fExponentSeparatorString(dfs.getConstSymbol(DecimalFormatSymbols::kExponentialSymbol)),
+ fExponentMatcher(dfs, grouper, PARSE_FLAG_INTEGER_ONLY | PARSE_FLAG_GROUPING_DISABLED),
+ fIgnorablesMatcher(PARSE_FLAG_STRICT_IGNORABLES) {
+
+ const UnicodeString& minusSign = dfs.getConstSymbol(DecimalFormatSymbols::kMinusSignSymbol);
+ if (minusSignSet().contains(minusSign)) {
+ fCustomMinusSign.setToBogus();
+ } else {
+ fCustomMinusSign = minusSign;
+ }
+
+ const UnicodeString& plusSign = dfs.getConstSymbol(DecimalFormatSymbols::kPlusSignSymbol);
+ if (plusSignSet().contains(plusSign)) {
+ fCustomPlusSign.setToBogus();
+ } else {
+ fCustomPlusSign = plusSign;
+ }
+}
+
+bool ScientificMatcher::match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const {
+ // Only accept scientific notation after the mantissa.
+ if (!result.seenNumber()) {
+ return false;
+ }
+
+ // Only accept one exponent per string.
+ if (0 != (result.flags & FLAG_HAS_EXPONENT)) {
+ return false;
+ }
+
+ // First match the scientific separator, and then match another number after it.
+ // NOTE: This is guarded by the smoke test; no need to check fExponentSeparatorString length again.
+ int32_t initialOffset = segment.getOffset();
+ int32_t overlap = segment.getCommonPrefixLength(fExponentSeparatorString);
+ if (overlap == fExponentSeparatorString.length()) {
+ // Full exponent separator match.
+
+ // First attempt to get a code point, returning true if we can't get one.
+ if (segment.length() == overlap) {
+ return true;
+ }
+ segment.adjustOffset(overlap);
+
+ // Allow ignorables before the sign.
+ // Note: call site is guarded by the segment.length() check above.
+ // Note: the ignorables matcher should not touch the result.
+ fIgnorablesMatcher.match(segment, result, status);
+ if (segment.length() == 0) {
+ segment.setOffset(initialOffset);
+ return true;
+ }
+
+ // Allow a sign, and then try to match digits.
+ int8_t exponentSign = 1;
+ if (segment.startsWith(minusSignSet())) {
+ exponentSign = -1;
+ segment.adjustOffsetByCodePoint();
+ } else if (segment.startsWith(plusSignSet())) {
+ segment.adjustOffsetByCodePoint();
+ } else if (segment.startsWith(fCustomMinusSign)) {
+ overlap = segment.getCommonPrefixLength(fCustomMinusSign);
+ if (overlap != fCustomMinusSign.length()) {
+ // Partial custom sign match
+ segment.setOffset(initialOffset);
+ return true;
+ }
+ exponentSign = -1;
+ segment.adjustOffset(overlap);
+ } else if (segment.startsWith(fCustomPlusSign)) {
+ overlap = segment.getCommonPrefixLength(fCustomPlusSign);
+ if (overlap != fCustomPlusSign.length()) {
+ // Partial custom sign match
+ segment.setOffset(initialOffset);
+ return true;
+ }
+ segment.adjustOffset(overlap);
+ }
+
+ // Return true if the segment is empty.
+ if (segment.length() == 0) {
+ segment.setOffset(initialOffset);
+ return true;
+ }
+
+ // Allow ignorables after the sign.
+ // Note: call site is guarded by the segment.length() check above.
+ // Note: the ignorables matcher should not touch the result.
+ fIgnorablesMatcher.match(segment, result, status);
+ if (segment.length() == 0) {
+ segment.setOffset(initialOffset);
+ return true;
+ }
+
+ // We are supposed to accept E0 after NaN, so we need to make sure result.quantity is available.
+ bool wasBogus = result.quantity.bogus;
+ result.quantity.bogus = false;
+ int digitsOffset = segment.getOffset();
+ bool digitsReturnValue = fExponentMatcher.match(segment, result, exponentSign, status);
+ result.quantity.bogus = wasBogus;
+
+ if (segment.getOffset() != digitsOffset) {
+ // At least one exponent digit was matched.
+ result.flags |= FLAG_HAS_EXPONENT;
+ } else {
+ // No exponent digits were matched
+ segment.setOffset(initialOffset);
+ }
+ return digitsReturnValue;
+
+ } else if (overlap == segment.length()) {
+ // Partial exponent separator match
+ return true;
+ }
+
+ // No match
+ return false;
+}
+
+bool ScientificMatcher::smokeTest(const StringSegment& segment) const {
+ return segment.startsWith(fExponentSeparatorString);
+}
+
+UnicodeString ScientificMatcher::toString() const {
+ return u"<Scientific>";
+}
+
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numparse_scientific.h b/contrib/libs/icu/i18n/numparse_scientific.h
index d513109121..5617c0c6a6 100644
--- a/contrib/libs/icu/i18n/numparse_scientific.h
+++ b/contrib/libs/icu/i18n/numparse_scientific.h
@@ -1,47 +1,47 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMPARSE_SCIENTIFIC_H__
-#define __NUMPARSE_SCIENTIFIC_H__
-
-#include "numparse_types.h"
-#include "numparse_decimal.h"
-#include "numparse_symbols.h"
-#include "unicode/numberformatter.h"
-
-using icu::number::impl::Grouper;
-
-U_NAMESPACE_BEGIN namespace numparse {
-namespace impl {
-
-
-class ScientificMatcher : public NumberParseMatcher, public UMemory {
- public:
- ScientificMatcher() = default; // WARNING: Leaves the object in an unusable state
-
- ScientificMatcher(const DecimalFormatSymbols& dfs, const Grouper& grouper);
-
- bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override;
-
- bool smokeTest(const StringSegment& segment) const override;
-
- UnicodeString toString() const override;
-
- private:
- UnicodeString fExponentSeparatorString;
- DecimalMatcher fExponentMatcher;
- IgnorablesMatcher fIgnorablesMatcher;
- UnicodeString fCustomMinusSign;
- UnicodeString fCustomPlusSign;
-};
-
-
-} // namespace impl
-} // namespace numparse
-U_NAMESPACE_END
-
-#endif //__NUMPARSE_SCIENTIFIC_H__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMPARSE_SCIENTIFIC_H__
+#define __NUMPARSE_SCIENTIFIC_H__
+
+#include "numparse_types.h"
+#include "numparse_decimal.h"
+#include "numparse_symbols.h"
+#include "unicode/numberformatter.h"
+
+using icu::number::impl::Grouper;
+
+U_NAMESPACE_BEGIN namespace numparse {
+namespace impl {
+
+
+class ScientificMatcher : public NumberParseMatcher, public UMemory {
+ public:
+ ScientificMatcher() = default; // WARNING: Leaves the object in an unusable state
+
+ ScientificMatcher(const DecimalFormatSymbols& dfs, const Grouper& grouper);
+
+ bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override;
+
+ bool smokeTest(const StringSegment& segment) const override;
+
+ UnicodeString toString() const override;
+
+ private:
+ UnicodeString fExponentSeparatorString;
+ DecimalMatcher fExponentMatcher;
+ IgnorablesMatcher fIgnorablesMatcher;
+ UnicodeString fCustomMinusSign;
+ UnicodeString fCustomPlusSign;
+};
+
+
+} // namespace impl
+} // namespace numparse
+U_NAMESPACE_END
+
+#endif //__NUMPARSE_SCIENTIFIC_H__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numparse_symbols.cpp b/contrib/libs/icu/i18n/numparse_symbols.cpp
index d7c629ef58..608f4f5c8b 100644
--- a/contrib/libs/icu/i18n/numparse_symbols.cpp
+++ b/contrib/libs/icu/i18n/numparse_symbols.cpp
@@ -1,198 +1,198 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include "numparse_types.h"
-#include "numparse_symbols.h"
-#include "numparse_utils.h"
-#include "string_segment.h"
-
-using namespace icu;
-using namespace icu::numparse;
-using namespace icu::numparse::impl;
-
-
-SymbolMatcher::SymbolMatcher(const UnicodeString& symbolString, unisets::Key key) {
- fUniSet = unisets::get(key);
- if (fUniSet->contains(symbolString)) {
- fString.setToBogus();
- } else {
- fString = symbolString;
- }
-}
-
-const UnicodeSet* SymbolMatcher::getSet() const {
- return fUniSet;
-}
-
-bool SymbolMatcher::match(StringSegment& segment, ParsedNumber& result, UErrorCode&) const {
- // Smoke test first; this matcher might be disabled.
- if (isDisabled(result)) {
- return false;
- }
-
- // Test the string first in order to consume trailing chars greedily.
- int overlap = 0;
- if (!fString.isEmpty()) {
- overlap = segment.getCommonPrefixLength(fString);
- if (overlap == fString.length()) {
- segment.adjustOffset(fString.length());
- accept(segment, result);
- return false;
- }
- }
-
- int cp = segment.getCodePoint();
- if (cp != -1 && fUniSet->contains(cp)) {
- segment.adjustOffset(U16_LENGTH(cp));
- accept(segment, result);
- return false;
- }
-
- return overlap == segment.length();
-}
-
-bool SymbolMatcher::smokeTest(const StringSegment& segment) const {
- return segment.startsWith(*fUniSet) || segment.startsWith(fString);
-}
-
-UnicodeString SymbolMatcher::toString() const {
- // TODO: Customize output for each symbol
- return u"<Symbol>";
-}
-
-
-IgnorablesMatcher::IgnorablesMatcher(parse_flags_t parseFlags) :
- SymbolMatcher(
- {},
- (0 != (parseFlags & PARSE_FLAG_STRICT_IGNORABLES)) ?
- unisets::STRICT_IGNORABLES :
- unisets::DEFAULT_IGNORABLES) {
-}
-
-bool IgnorablesMatcher::isFlexible() const {
- return true;
-}
-
-UnicodeString IgnorablesMatcher::toString() const {
- return u"<Ignorables>";
-}
-
-bool IgnorablesMatcher::isDisabled(const ParsedNumber&) const {
- return false;
-}
-
-void IgnorablesMatcher::accept(StringSegment&, ParsedNumber&) const {
- // No-op
-}
-
-
-InfinityMatcher::InfinityMatcher(const DecimalFormatSymbols& dfs)
- : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kInfinitySymbol), unisets::INFINITY_SIGN) {
-}
-
-bool InfinityMatcher::isDisabled(const ParsedNumber& result) const {
- return 0 != (result.flags & FLAG_INFINITY);
-}
-
-void InfinityMatcher::accept(StringSegment& segment, ParsedNumber& result) const {
- result.flags |= FLAG_INFINITY;
- result.setCharsConsumed(segment);
-}
-
-
-MinusSignMatcher::MinusSignMatcher(const DecimalFormatSymbols& dfs, bool allowTrailing)
- : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kMinusSignSymbol), unisets::MINUS_SIGN),
- fAllowTrailing(allowTrailing) {
-}
-
-bool MinusSignMatcher::isDisabled(const ParsedNumber& result) const {
- return !fAllowTrailing && result.seenNumber();
-}
-
-void MinusSignMatcher::accept(StringSegment& segment, ParsedNumber& result) const {
- result.flags |= FLAG_NEGATIVE;
- result.setCharsConsumed(segment);
-}
-
-
-NanMatcher::NanMatcher(const DecimalFormatSymbols& dfs)
- : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kNaNSymbol), unisets::EMPTY) {
-}
-
-bool NanMatcher::isDisabled(const ParsedNumber& result) const {
- return result.seenNumber();
-}
-
-void NanMatcher::accept(StringSegment& segment, ParsedNumber& result) const {
- result.flags |= FLAG_NAN;
- result.setCharsConsumed(segment);
-}
-
-
-PaddingMatcher::PaddingMatcher(const UnicodeString& padString)
- : SymbolMatcher(padString, unisets::EMPTY) {}
-
-bool PaddingMatcher::isFlexible() const {
- return true;
-}
-
-bool PaddingMatcher::isDisabled(const ParsedNumber&) const {
- return false;
-}
-
-void PaddingMatcher::accept(StringSegment&, ParsedNumber&) const {
- // No-op
-}
-
-
-PercentMatcher::PercentMatcher(const DecimalFormatSymbols& dfs)
- : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kPercentSymbol), unisets::PERCENT_SIGN) {
-}
-
-bool PercentMatcher::isDisabled(const ParsedNumber& result) const {
- return 0 != (result.flags & FLAG_PERCENT);
-}
-
-void PercentMatcher::accept(StringSegment& segment, ParsedNumber& result) const {
- result.flags |= FLAG_PERCENT;
- result.setCharsConsumed(segment);
-}
-
-
-PermilleMatcher::PermilleMatcher(const DecimalFormatSymbols& dfs)
- : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kPerMillSymbol), unisets::PERMILLE_SIGN) {
-}
-
-bool PermilleMatcher::isDisabled(const ParsedNumber& result) const {
- return 0 != (result.flags & FLAG_PERMILLE);
-}
-
-void PermilleMatcher::accept(StringSegment& segment, ParsedNumber& result) const {
- result.flags |= FLAG_PERMILLE;
- result.setCharsConsumed(segment);
-}
-
-
-PlusSignMatcher::PlusSignMatcher(const DecimalFormatSymbols& dfs, bool allowTrailing)
- : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kPlusSignSymbol), unisets::PLUS_SIGN),
- fAllowTrailing(allowTrailing) {
-}
-
-bool PlusSignMatcher::isDisabled(const ParsedNumber& result) const {
- return !fAllowTrailing && result.seenNumber();
-}
-
-void PlusSignMatcher::accept(StringSegment& segment, ParsedNumber& result) const {
- result.setCharsConsumed(segment);
-}
-
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include "numparse_types.h"
+#include "numparse_symbols.h"
+#include "numparse_utils.h"
+#include "string_segment.h"
+
+using namespace icu;
+using namespace icu::numparse;
+using namespace icu::numparse::impl;
+
+
+SymbolMatcher::SymbolMatcher(const UnicodeString& symbolString, unisets::Key key) {
+ fUniSet = unisets::get(key);
+ if (fUniSet->contains(symbolString)) {
+ fString.setToBogus();
+ } else {
+ fString = symbolString;
+ }
+}
+
+const UnicodeSet* SymbolMatcher::getSet() const {
+ return fUniSet;
+}
+
+bool SymbolMatcher::match(StringSegment& segment, ParsedNumber& result, UErrorCode&) const {
+ // Smoke test first; this matcher might be disabled.
+ if (isDisabled(result)) {
+ return false;
+ }
+
+ // Test the string first in order to consume trailing chars greedily.
+ int overlap = 0;
+ if (!fString.isEmpty()) {
+ overlap = segment.getCommonPrefixLength(fString);
+ if (overlap == fString.length()) {
+ segment.adjustOffset(fString.length());
+ accept(segment, result);
+ return false;
+ }
+ }
+
+ int cp = segment.getCodePoint();
+ if (cp != -1 && fUniSet->contains(cp)) {
+ segment.adjustOffset(U16_LENGTH(cp));
+ accept(segment, result);
+ return false;
+ }
+
+ return overlap == segment.length();
+}
+
+bool SymbolMatcher::smokeTest(const StringSegment& segment) const {
+ return segment.startsWith(*fUniSet) || segment.startsWith(fString);
+}
+
+UnicodeString SymbolMatcher::toString() const {
+ // TODO: Customize output for each symbol
+ return u"<Symbol>";
+}
+
+
+IgnorablesMatcher::IgnorablesMatcher(parse_flags_t parseFlags) :
+ SymbolMatcher(
+ {},
+ (0 != (parseFlags & PARSE_FLAG_STRICT_IGNORABLES)) ?
+ unisets::STRICT_IGNORABLES :
+ unisets::DEFAULT_IGNORABLES) {
+}
+
+bool IgnorablesMatcher::isFlexible() const {
+ return true;
+}
+
+UnicodeString IgnorablesMatcher::toString() const {
+ return u"<Ignorables>";
+}
+
+bool IgnorablesMatcher::isDisabled(const ParsedNumber&) const {
+ return false;
+}
+
+void IgnorablesMatcher::accept(StringSegment&, ParsedNumber&) const {
+ // No-op
+}
+
+
+InfinityMatcher::InfinityMatcher(const DecimalFormatSymbols& dfs)
+ : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kInfinitySymbol), unisets::INFINITY_SIGN) {
+}
+
+bool InfinityMatcher::isDisabled(const ParsedNumber& result) const {
+ return 0 != (result.flags & FLAG_INFINITY);
+}
+
+void InfinityMatcher::accept(StringSegment& segment, ParsedNumber& result) const {
+ result.flags |= FLAG_INFINITY;
+ result.setCharsConsumed(segment);
+}
+
+
+MinusSignMatcher::MinusSignMatcher(const DecimalFormatSymbols& dfs, bool allowTrailing)
+ : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kMinusSignSymbol), unisets::MINUS_SIGN),
+ fAllowTrailing(allowTrailing) {
+}
+
+bool MinusSignMatcher::isDisabled(const ParsedNumber& result) const {
+ return !fAllowTrailing && result.seenNumber();
+}
+
+void MinusSignMatcher::accept(StringSegment& segment, ParsedNumber& result) const {
+ result.flags |= FLAG_NEGATIVE;
+ result.setCharsConsumed(segment);
+}
+
+
+NanMatcher::NanMatcher(const DecimalFormatSymbols& dfs)
+ : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kNaNSymbol), unisets::EMPTY) {
+}
+
+bool NanMatcher::isDisabled(const ParsedNumber& result) const {
+ return result.seenNumber();
+}
+
+void NanMatcher::accept(StringSegment& segment, ParsedNumber& result) const {
+ result.flags |= FLAG_NAN;
+ result.setCharsConsumed(segment);
+}
+
+
+PaddingMatcher::PaddingMatcher(const UnicodeString& padString)
+ : SymbolMatcher(padString, unisets::EMPTY) {}
+
+bool PaddingMatcher::isFlexible() const {
+ return true;
+}
+
+bool PaddingMatcher::isDisabled(const ParsedNumber&) const {
+ return false;
+}
+
+void PaddingMatcher::accept(StringSegment&, ParsedNumber&) const {
+ // No-op
+}
+
+
+PercentMatcher::PercentMatcher(const DecimalFormatSymbols& dfs)
+ : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kPercentSymbol), unisets::PERCENT_SIGN) {
+}
+
+bool PercentMatcher::isDisabled(const ParsedNumber& result) const {
+ return 0 != (result.flags & FLAG_PERCENT);
+}
+
+void PercentMatcher::accept(StringSegment& segment, ParsedNumber& result) const {
+ result.flags |= FLAG_PERCENT;
+ result.setCharsConsumed(segment);
+}
+
+
+PermilleMatcher::PermilleMatcher(const DecimalFormatSymbols& dfs)
+ : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kPerMillSymbol), unisets::PERMILLE_SIGN) {
+}
+
+bool PermilleMatcher::isDisabled(const ParsedNumber& result) const {
+ return 0 != (result.flags & FLAG_PERMILLE);
+}
+
+void PermilleMatcher::accept(StringSegment& segment, ParsedNumber& result) const {
+ result.flags |= FLAG_PERMILLE;
+ result.setCharsConsumed(segment);
+}
+
+
+PlusSignMatcher::PlusSignMatcher(const DecimalFormatSymbols& dfs, bool allowTrailing)
+ : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kPlusSignSymbol), unisets::PLUS_SIGN),
+ fAllowTrailing(allowTrailing) {
+}
+
+bool PlusSignMatcher::isDisabled(const ParsedNumber& result) const {
+ return !fAllowTrailing && result.seenNumber();
+}
+
+void PlusSignMatcher::accept(StringSegment& segment, ParsedNumber& result) const {
+ result.setCharsConsumed(segment);
+}
+
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numparse_symbols.h b/contrib/libs/icu/i18n/numparse_symbols.h
index fb8dee1046..beb133f7d0 100644
--- a/contrib/libs/icu/i18n/numparse_symbols.h
+++ b/contrib/libs/icu/i18n/numparse_symbols.h
@@ -1,173 +1,173 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMPARSE_SYMBOLS_H__
-#define __NUMPARSE_SYMBOLS_H__
-
-#include "numparse_types.h"
-#include "unicode/uniset.h"
-#include "static_unicode_sets.h"
-
-U_NAMESPACE_BEGIN namespace numparse {
-namespace impl {
-
-
-/**
- * A base class for many matchers that performs a simple match against a UnicodeString and/or UnicodeSet.
- *
- * @author sffc
- */
-// Exported as U_I18N_API for tests
-class U_I18N_API SymbolMatcher : public NumberParseMatcher, public UMemory {
- public:
- SymbolMatcher() = default; // WARNING: Leaves the object in an unusable state
-
- const UnicodeSet* getSet() const;
-
- bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override;
-
- bool smokeTest(const StringSegment& segment) const override;
-
- UnicodeString toString() const override;
-
- virtual bool isDisabled(const ParsedNumber& result) const = 0;
-
- virtual void accept(StringSegment& segment, ParsedNumber& result) const = 0;
-
- protected:
- UnicodeString fString;
- const UnicodeSet* fUniSet; // a reference from numparse_unisets.h; never owned
-
- SymbolMatcher(const UnicodeString& symbolString, unisets::Key key);
-};
-
-
-// Exported as U_I18N_API for tests
-class U_I18N_API IgnorablesMatcher : public SymbolMatcher {
- public:
- IgnorablesMatcher() = default; // WARNING: Leaves the object in an unusable state
-
- IgnorablesMatcher(parse_flags_t parseFlags);
-
- bool isFlexible() const override;
-
- UnicodeString toString() const override;
-
- protected:
- bool isDisabled(const ParsedNumber& result) const override;
-
- void accept(StringSegment& segment, ParsedNumber& result) const override;
-};
-
-
-class InfinityMatcher : public SymbolMatcher {
- public:
- InfinityMatcher() = default; // WARNING: Leaves the object in an unusable state
-
- InfinityMatcher(const DecimalFormatSymbols& dfs);
-
- protected:
- bool isDisabled(const ParsedNumber& result) const override;
-
- void accept(StringSegment& segment, ParsedNumber& result) const override;
-};
-
-
-// Exported as U_I18N_API for tests
-class U_I18N_API MinusSignMatcher : public SymbolMatcher {
- public:
- MinusSignMatcher() = default; // WARNING: Leaves the object in an unusable state
-
- MinusSignMatcher(const DecimalFormatSymbols& dfs, bool allowTrailing);
-
- protected:
- bool isDisabled(const ParsedNumber& result) const override;
-
- void accept(StringSegment& segment, ParsedNumber& result) const override;
-
- private:
- bool fAllowTrailing;
-};
-
-
-class NanMatcher : public SymbolMatcher {
- public:
- NanMatcher() = default; // WARNING: Leaves the object in an unusable state
-
- NanMatcher(const DecimalFormatSymbols& dfs);
-
- protected:
- bool isDisabled(const ParsedNumber& result) const override;
-
- void accept(StringSegment& segment, ParsedNumber& result) const override;
-};
-
-
-class PaddingMatcher : public SymbolMatcher {
- public:
- PaddingMatcher() = default; // WARNING: Leaves the object in an unusable state
-
- PaddingMatcher(const UnicodeString& padString);
-
- bool isFlexible() const override;
-
- protected:
- bool isDisabled(const ParsedNumber& result) const override;
-
- void accept(StringSegment& segment, ParsedNumber& result) const override;
-};
-
-
-// Exported as U_I18N_API for tests
-class U_I18N_API PercentMatcher : public SymbolMatcher {
- public:
- PercentMatcher() = default; // WARNING: Leaves the object in an unusable state
-
- PercentMatcher(const DecimalFormatSymbols& dfs);
-
- protected:
- bool isDisabled(const ParsedNumber& result) const override;
-
- void accept(StringSegment& segment, ParsedNumber& result) const override;
-};
-
-// Exported as U_I18N_API for tests
-class U_I18N_API PermilleMatcher : public SymbolMatcher {
- public:
- PermilleMatcher() = default; // WARNING: Leaves the object in an unusable state
-
- PermilleMatcher(const DecimalFormatSymbols& dfs);
-
- protected:
- bool isDisabled(const ParsedNumber& result) const override;
-
- void accept(StringSegment& segment, ParsedNumber& result) const override;
-};
-
-
-// Exported as U_I18N_API for tests
-class U_I18N_API PlusSignMatcher : public SymbolMatcher {
- public:
- PlusSignMatcher() = default; // WARNING: Leaves the object in an unusable state
-
- PlusSignMatcher(const DecimalFormatSymbols& dfs, bool allowTrailing);
-
- protected:
- bool isDisabled(const ParsedNumber& result) const override;
-
- void accept(StringSegment& segment, ParsedNumber& result) const override;
-
- private:
- bool fAllowTrailing;
-};
-
-
-} // namespace impl
-} // namespace numparse
-U_NAMESPACE_END
-
-#endif //__NUMPARSE_SYMBOLS_H__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMPARSE_SYMBOLS_H__
+#define __NUMPARSE_SYMBOLS_H__
+
+#include "numparse_types.h"
+#include "unicode/uniset.h"
+#include "static_unicode_sets.h"
+
+U_NAMESPACE_BEGIN namespace numparse {
+namespace impl {
+
+
+/**
+ * A base class for many matchers that performs a simple match against a UnicodeString and/or UnicodeSet.
+ *
+ * @author sffc
+ */
+// Exported as U_I18N_API for tests
+class U_I18N_API SymbolMatcher : public NumberParseMatcher, public UMemory {
+ public:
+ SymbolMatcher() = default; // WARNING: Leaves the object in an unusable state
+
+ const UnicodeSet* getSet() const;
+
+ bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const override;
+
+ bool smokeTest(const StringSegment& segment) const override;
+
+ UnicodeString toString() const override;
+
+ virtual bool isDisabled(const ParsedNumber& result) const = 0;
+
+ virtual void accept(StringSegment& segment, ParsedNumber& result) const = 0;
+
+ protected:
+ UnicodeString fString;
+ const UnicodeSet* fUniSet; // a reference from numparse_unisets.h; never owned
+
+ SymbolMatcher(const UnicodeString& symbolString, unisets::Key key);
+};
+
+
+// Exported as U_I18N_API for tests
+class U_I18N_API IgnorablesMatcher : public SymbolMatcher {
+ public:
+ IgnorablesMatcher() = default; // WARNING: Leaves the object in an unusable state
+
+ IgnorablesMatcher(parse_flags_t parseFlags);
+
+ bool isFlexible() const override;
+
+ UnicodeString toString() const override;
+
+ protected:
+ bool isDisabled(const ParsedNumber& result) const override;
+
+ void accept(StringSegment& segment, ParsedNumber& result) const override;
+};
+
+
+class InfinityMatcher : public SymbolMatcher {
+ public:
+ InfinityMatcher() = default; // WARNING: Leaves the object in an unusable state
+
+ InfinityMatcher(const DecimalFormatSymbols& dfs);
+
+ protected:
+ bool isDisabled(const ParsedNumber& result) const override;
+
+ void accept(StringSegment& segment, ParsedNumber& result) const override;
+};
+
+
+// Exported as U_I18N_API for tests
+class U_I18N_API MinusSignMatcher : public SymbolMatcher {
+ public:
+ MinusSignMatcher() = default; // WARNING: Leaves the object in an unusable state
+
+ MinusSignMatcher(const DecimalFormatSymbols& dfs, bool allowTrailing);
+
+ protected:
+ bool isDisabled(const ParsedNumber& result) const override;
+
+ void accept(StringSegment& segment, ParsedNumber& result) const override;
+
+ private:
+ bool fAllowTrailing;
+};
+
+
+class NanMatcher : public SymbolMatcher {
+ public:
+ NanMatcher() = default; // WARNING: Leaves the object in an unusable state
+
+ NanMatcher(const DecimalFormatSymbols& dfs);
+
+ protected:
+ bool isDisabled(const ParsedNumber& result) const override;
+
+ void accept(StringSegment& segment, ParsedNumber& result) const override;
+};
+
+
+class PaddingMatcher : public SymbolMatcher {
+ public:
+ PaddingMatcher() = default; // WARNING: Leaves the object in an unusable state
+
+ PaddingMatcher(const UnicodeString& padString);
+
+ bool isFlexible() const override;
+
+ protected:
+ bool isDisabled(const ParsedNumber& result) const override;
+
+ void accept(StringSegment& segment, ParsedNumber& result) const override;
+};
+
+
+// Exported as U_I18N_API for tests
+class U_I18N_API PercentMatcher : public SymbolMatcher {
+ public:
+ PercentMatcher() = default; // WARNING: Leaves the object in an unusable state
+
+ PercentMatcher(const DecimalFormatSymbols& dfs);
+
+ protected:
+ bool isDisabled(const ParsedNumber& result) const override;
+
+ void accept(StringSegment& segment, ParsedNumber& result) const override;
+};
+
+// Exported as U_I18N_API for tests
+class U_I18N_API PermilleMatcher : public SymbolMatcher {
+ public:
+ PermilleMatcher() = default; // WARNING: Leaves the object in an unusable state
+
+ PermilleMatcher(const DecimalFormatSymbols& dfs);
+
+ protected:
+ bool isDisabled(const ParsedNumber& result) const override;
+
+ void accept(StringSegment& segment, ParsedNumber& result) const override;
+};
+
+
+// Exported as U_I18N_API for tests
+class U_I18N_API PlusSignMatcher : public SymbolMatcher {
+ public:
+ PlusSignMatcher() = default; // WARNING: Leaves the object in an unusable state
+
+ PlusSignMatcher(const DecimalFormatSymbols& dfs, bool allowTrailing);
+
+ protected:
+ bool isDisabled(const ParsedNumber& result) const override;
+
+ void accept(StringSegment& segment, ParsedNumber& result) const override;
+
+ private:
+ bool fAllowTrailing;
+};
+
+
+} // namespace impl
+} // namespace numparse
+U_NAMESPACE_END
+
+#endif //__NUMPARSE_SYMBOLS_H__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numparse_types.h b/contrib/libs/icu/i18n/numparse_types.h
index 7f3db031af..b4007c2ff5 100644
--- a/contrib/libs/icu/i18n/numparse_types.h
+++ b/contrib/libs/icu/i18n/numparse_types.h
@@ -1,271 +1,271 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMPARSE_TYPES_H__
-#define __NUMPARSE_TYPES_H__
-
-#include "unicode/uobject.h"
-#include "number_decimalquantity.h"
-#include "string_segment.h"
-
-U_NAMESPACE_BEGIN
-namespace numparse {
-namespace impl {
-
-// Forward-declarations
-class ParsedNumber;
-
-typedef int32_t result_flags_t;
-typedef int32_t parse_flags_t;
-
-/** Flags for the type result_flags_t */
-enum ResultFlags {
- FLAG_NEGATIVE = 0x0001,
- FLAG_PERCENT = 0x0002,
- FLAG_PERMILLE = 0x0004,
- FLAG_HAS_EXPONENT = 0x0008,
- // FLAG_HAS_DEFAULT_CURRENCY = 0x0010, // no longer used
- FLAG_HAS_DECIMAL_SEPARATOR = 0x0020,
- FLAG_NAN = 0x0040,
- FLAG_INFINITY = 0x0080,
- FLAG_FAIL = 0x0100,
-};
-
-/** Flags for the type parse_flags_t */
-enum ParseFlags {
- PARSE_FLAG_IGNORE_CASE = 0x0001,
- PARSE_FLAG_MONETARY_SEPARATORS = 0x0002,
- PARSE_FLAG_STRICT_SEPARATORS = 0x0004,
- PARSE_FLAG_STRICT_GROUPING_SIZE = 0x0008,
- PARSE_FLAG_INTEGER_ONLY = 0x0010,
- PARSE_FLAG_GROUPING_DISABLED = 0x0020,
- // PARSE_FLAG_FRACTION_GROUPING_ENABLED = 0x0040, // see #10794
- PARSE_FLAG_INCLUDE_UNPAIRED_AFFIXES = 0x0080,
- PARSE_FLAG_USE_FULL_AFFIXES = 0x0100,
- PARSE_FLAG_EXACT_AFFIX = 0x0200,
- PARSE_FLAG_PLUS_SIGN_ALLOWED = 0x0400,
- // PARSE_FLAG_OPTIMIZE = 0x0800, // no longer used
- // PARSE_FLAG_FORCE_BIG_DECIMAL = 0x1000, // not used in ICU4C
- PARSE_FLAG_NO_FOREIGN_CURRENCY = 0x2000,
- PARSE_FLAG_ALLOW_INFINITE_RECURSION = 0x4000,
- PARSE_FLAG_STRICT_IGNORABLES = 0x8000,
-};
-
-
-// TODO: Is this class worthwhile?
-template<int32_t stackCapacity>
-class CompactUnicodeString {
- public:
- CompactUnicodeString() {
- static_assert(stackCapacity > 0, "cannot have zero space on stack");
- fBuffer[0] = 0;
- }
-
- CompactUnicodeString(const UnicodeString& text)
- : fBuffer(text.length() + 1) {
- uprv_memcpy(fBuffer.getAlias(), text.getBuffer(), sizeof(UChar) * text.length());
- fBuffer[text.length()] = 0;
- }
-
- inline UnicodeString toAliasedUnicodeString() const {
- return UnicodeString(TRUE, fBuffer.getAlias(), -1);
- }
-
- bool operator==(const CompactUnicodeString& other) const {
- // Use the alias-only constructor and then call UnicodeString operator==
- return toAliasedUnicodeString() == other.toAliasedUnicodeString();
- }
-
- private:
- MaybeStackArray<UChar, stackCapacity> fBuffer;
-};
-
-
-/**
- * Struct-like class to hold the results of a parsing routine.
- *
- * @author sffc
- */
-// Exported as U_I18N_API for tests
-class U_I18N_API ParsedNumber {
- public:
-
- /**
- * The numerical value that was parsed.
- */
- ::icu::number::impl::DecimalQuantity quantity;
-
- /**
- * The index of the last char consumed during parsing. If parsing started at index 0, this is equal
- * to the number of chars consumed. This is NOT necessarily the same as the StringSegment offset;
- * "weak" chars, like whitespace, change the offset, but the charsConsumed is not touched until a
- * "strong" char is encountered.
- */
- int32_t charEnd;
-
- /**
- * Boolean flags (see constants above).
- */
- result_flags_t flags;
-
- /**
- * The pattern string corresponding to the prefix that got consumed.
- */
- UnicodeString prefix;
-
- /**
- * The pattern string corresponding to the suffix that got consumed.
- */
- UnicodeString suffix;
-
- /**
- * The currency that got consumed.
- */
- UChar currencyCode[4];
-
- ParsedNumber();
-
- ParsedNumber(const ParsedNumber& other) = default;
-
- ParsedNumber& operator=(const ParsedNumber& other) = default;
-
- void clear();
-
- /**
- * Call this method to register that a "strong" char was consumed. This should be done after calling
- * {@link StringSegment#setOffset} or {@link StringSegment#adjustOffset} except when the char is
- * "weak", like whitespace.
- *
- * <p>
- * <strong>What is a strong versus weak char?</strong> The behavior of number parsing is to "stop"
- * after reading the number, even if there is other content following the number. For example, after
- * parsing the string "123 " (123 followed by a space), the cursor should be set to 3, not 4, even
- * though there are matchers that accept whitespace. In this example, the digits are strong, whereas
- * the whitespace is weak. Grouping separators are weak, whereas decimal separators are strong. Most
- * other chars are strong.
- *
- * @param segment
- * The current StringSegment, usually immediately following a call to setOffset.
- */
- void setCharsConsumed(const StringSegment& segment);
-
- /** Apply certain number-related flags to the DecimalQuantity. */
- void postProcess();
-
- /**
- * Returns whether this the parse was successful. To be successful, at least one char must have been
- * consumed, and the failure flag must not be set.
- */
- bool success() const;
-
- bool seenNumber() const;
-
- double getDouble(UErrorCode& status) const;
-
- void populateFormattable(Formattable& output, parse_flags_t parseFlags) const;
-
- bool isBetterThan(const ParsedNumber& other);
-};
-
-
-/**
- * The core interface implemented by all matchers used for number parsing.
- *
- * Given a string, there should NOT be more than one way to consume the string with the same matcher
- * applied multiple times. If there is, the non-greedy parsing algorithm will be unhappy and may enter an
- * exponential-time loop. For example, consider the "A Matcher" that accepts "any number of As". Given
- * the string "AAAA", there are 2^N = 8 ways to apply the A Matcher to this string: you could have the A
- * Matcher apply 4 times to each character; you could have it apply just once to all the characters; you
- * could have it apply to the first 2 characters and the second 2 characters; and so on. A better version
- * of the "A Matcher" would be for it to accept exactly one A, and allow the algorithm to run it
- * repeatedly to consume a string of multiple As. The A Matcher can implement the Flexible interface
- * below to signal that it can be applied multiple times in a row.
- *
- * @author sffc
- */
-// Exported as U_I18N_API for tests
-class U_I18N_API NumberParseMatcher {
- public:
- virtual ~NumberParseMatcher();
-
- /**
- * Matchers can override this method to return true to indicate that they are optional and can be run
- * repeatedly. Used by SeriesMatcher, primarily in the context of IgnorablesMatcher.
- */
- virtual bool isFlexible() const {
- return false;
- }
-
- /**
- * Runs this matcher starting at the beginning of the given StringSegment. If this matcher finds
- * something interesting in the StringSegment, it should update the offset of the StringSegment
- * corresponding to how many chars were matched.
- *
- * This method is thread-safe.
- *
- * @param segment
- * The StringSegment to match against. Matches always start at the beginning of the
- * segment. The segment is guaranteed to contain at least one char.
- * @param result
- * The data structure to store results if the match succeeds.
- * @return Whether this matcher thinks there may be more interesting chars beyond the end of the
- * string segment.
- */
- virtual bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const = 0;
-
- /**
- * Performs a fast "smoke check" for whether or not this matcher could possibly match against the
- * given string segment. The test should be as fast as possible but also as restrictive as possible.
- * For example, matchers can maintain a UnicodeSet of all code points that count possibly start a
- * match. Matchers should use the {@link StringSegment#startsWith} method in order to correctly
- * handle case folding.
- *
- * @param segment
- * The segment to check against.
- * @return true if the matcher might be able to match against this segment; false if it definitely
- * will not be able to match.
- */
- virtual bool smokeTest(const StringSegment& segment) const = 0;
-
- /**
- * Method called at the end of a parse, after all matchers have failed to consume any more chars.
- * Allows a matcher to make final modifications to the result given the knowledge that no more
- * matches are possible.
- *
- * @param result
- * The data structure to store results.
- */
- virtual void postProcess(ParsedNumber&) const {
- // Default implementation: no-op
- }
-
- // String for debugging
- virtual UnicodeString toString() const = 0;
-
- protected:
- // No construction except by subclasses!
- NumberParseMatcher() = default;
-};
-
-
-/**
- * Interface for use in arguments.
- */
-// Exported as U_I18N_API for tests
-class U_I18N_API MutableMatcherCollection {
- public:
- virtual ~MutableMatcherCollection() = default;
-
- virtual void addMatcher(NumberParseMatcher& matcher) = 0;
-};
-
-
-} // namespace impl
-} // namespace numparse
-U_NAMESPACE_END
-
-#endif //__NUMPARSE_TYPES_H__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMPARSE_TYPES_H__
+#define __NUMPARSE_TYPES_H__
+
+#include "unicode/uobject.h"
+#include "number_decimalquantity.h"
+#include "string_segment.h"
+
+U_NAMESPACE_BEGIN
+namespace numparse {
+namespace impl {
+
+// Forward-declarations
+class ParsedNumber;
+
+typedef int32_t result_flags_t;
+typedef int32_t parse_flags_t;
+
+/** Flags for the type result_flags_t */
+enum ResultFlags {
+ FLAG_NEGATIVE = 0x0001,
+ FLAG_PERCENT = 0x0002,
+ FLAG_PERMILLE = 0x0004,
+ FLAG_HAS_EXPONENT = 0x0008,
+ // FLAG_HAS_DEFAULT_CURRENCY = 0x0010, // no longer used
+ FLAG_HAS_DECIMAL_SEPARATOR = 0x0020,
+ FLAG_NAN = 0x0040,
+ FLAG_INFINITY = 0x0080,
+ FLAG_FAIL = 0x0100,
+};
+
+/** Flags for the type parse_flags_t */
+enum ParseFlags {
+ PARSE_FLAG_IGNORE_CASE = 0x0001,
+ PARSE_FLAG_MONETARY_SEPARATORS = 0x0002,
+ PARSE_FLAG_STRICT_SEPARATORS = 0x0004,
+ PARSE_FLAG_STRICT_GROUPING_SIZE = 0x0008,
+ PARSE_FLAG_INTEGER_ONLY = 0x0010,
+ PARSE_FLAG_GROUPING_DISABLED = 0x0020,
+ // PARSE_FLAG_FRACTION_GROUPING_ENABLED = 0x0040, // see #10794
+ PARSE_FLAG_INCLUDE_UNPAIRED_AFFIXES = 0x0080,
+ PARSE_FLAG_USE_FULL_AFFIXES = 0x0100,
+ PARSE_FLAG_EXACT_AFFIX = 0x0200,
+ PARSE_FLAG_PLUS_SIGN_ALLOWED = 0x0400,
+ // PARSE_FLAG_OPTIMIZE = 0x0800, // no longer used
+ // PARSE_FLAG_FORCE_BIG_DECIMAL = 0x1000, // not used in ICU4C
+ PARSE_FLAG_NO_FOREIGN_CURRENCY = 0x2000,
+ PARSE_FLAG_ALLOW_INFINITE_RECURSION = 0x4000,
+ PARSE_FLAG_STRICT_IGNORABLES = 0x8000,
+};
+
+
+// TODO: Is this class worthwhile?
+template<int32_t stackCapacity>
+class CompactUnicodeString {
+ public:
+ CompactUnicodeString() {
+ static_assert(stackCapacity > 0, "cannot have zero space on stack");
+ fBuffer[0] = 0;
+ }
+
+ CompactUnicodeString(const UnicodeString& text)
+ : fBuffer(text.length() + 1) {
+ uprv_memcpy(fBuffer.getAlias(), text.getBuffer(), sizeof(UChar) * text.length());
+ fBuffer[text.length()] = 0;
+ }
+
+ inline UnicodeString toAliasedUnicodeString() const {
+ return UnicodeString(TRUE, fBuffer.getAlias(), -1);
+ }
+
+ bool operator==(const CompactUnicodeString& other) const {
+ // Use the alias-only constructor and then call UnicodeString operator==
+ return toAliasedUnicodeString() == other.toAliasedUnicodeString();
+ }
+
+ private:
+ MaybeStackArray<UChar, stackCapacity> fBuffer;
+};
+
+
+/**
+ * Struct-like class to hold the results of a parsing routine.
+ *
+ * @author sffc
+ */
+// Exported as U_I18N_API for tests
+class U_I18N_API ParsedNumber {
+ public:
+
+ /**
+ * The numerical value that was parsed.
+ */
+ ::icu::number::impl::DecimalQuantity quantity;
+
+ /**
+ * The index of the last char consumed during parsing. If parsing started at index 0, this is equal
+ * to the number of chars consumed. This is NOT necessarily the same as the StringSegment offset;
+ * "weak" chars, like whitespace, change the offset, but the charsConsumed is not touched until a
+ * "strong" char is encountered.
+ */
+ int32_t charEnd;
+
+ /**
+ * Boolean flags (see constants above).
+ */
+ result_flags_t flags;
+
+ /**
+ * The pattern string corresponding to the prefix that got consumed.
+ */
+ UnicodeString prefix;
+
+ /**
+ * The pattern string corresponding to the suffix that got consumed.
+ */
+ UnicodeString suffix;
+
+ /**
+ * The currency that got consumed.
+ */
+ UChar currencyCode[4];
+
+ ParsedNumber();
+
+ ParsedNumber(const ParsedNumber& other) = default;
+
+ ParsedNumber& operator=(const ParsedNumber& other) = default;
+
+ void clear();
+
+ /**
+ * Call this method to register that a "strong" char was consumed. This should be done after calling
+ * {@link StringSegment#setOffset} or {@link StringSegment#adjustOffset} except when the char is
+ * "weak", like whitespace.
+ *
+ * <p>
+ * <strong>What is a strong versus weak char?</strong> The behavior of number parsing is to "stop"
+ * after reading the number, even if there is other content following the number. For example, after
+ * parsing the string "123 " (123 followed by a space), the cursor should be set to 3, not 4, even
+ * though there are matchers that accept whitespace. In this example, the digits are strong, whereas
+ * the whitespace is weak. Grouping separators are weak, whereas decimal separators are strong. Most
+ * other chars are strong.
+ *
+ * @param segment
+ * The current StringSegment, usually immediately following a call to setOffset.
+ */
+ void setCharsConsumed(const StringSegment& segment);
+
+ /** Apply certain number-related flags to the DecimalQuantity. */
+ void postProcess();
+
+ /**
+ * Returns whether this the parse was successful. To be successful, at least one char must have been
+ * consumed, and the failure flag must not be set.
+ */
+ bool success() const;
+
+ bool seenNumber() const;
+
+ double getDouble(UErrorCode& status) const;
+
+ void populateFormattable(Formattable& output, parse_flags_t parseFlags) const;
+
+ bool isBetterThan(const ParsedNumber& other);
+};
+
+
+/**
+ * The core interface implemented by all matchers used for number parsing.
+ *
+ * Given a string, there should NOT be more than one way to consume the string with the same matcher
+ * applied multiple times. If there is, the non-greedy parsing algorithm will be unhappy and may enter an
+ * exponential-time loop. For example, consider the "A Matcher" that accepts "any number of As". Given
+ * the string "AAAA", there are 2^N = 8 ways to apply the A Matcher to this string: you could have the A
+ * Matcher apply 4 times to each character; you could have it apply just once to all the characters; you
+ * could have it apply to the first 2 characters and the second 2 characters; and so on. A better version
+ * of the "A Matcher" would be for it to accept exactly one A, and allow the algorithm to run it
+ * repeatedly to consume a string of multiple As. The A Matcher can implement the Flexible interface
+ * below to signal that it can be applied multiple times in a row.
+ *
+ * @author sffc
+ */
+// Exported as U_I18N_API for tests
+class U_I18N_API NumberParseMatcher {
+ public:
+ virtual ~NumberParseMatcher();
+
+ /**
+ * Matchers can override this method to return true to indicate that they are optional and can be run
+ * repeatedly. Used by SeriesMatcher, primarily in the context of IgnorablesMatcher.
+ */
+ virtual bool isFlexible() const {
+ return false;
+ }
+
+ /**
+ * Runs this matcher starting at the beginning of the given StringSegment. If this matcher finds
+ * something interesting in the StringSegment, it should update the offset of the StringSegment
+ * corresponding to how many chars were matched.
+ *
+ * This method is thread-safe.
+ *
+ * @param segment
+ * The StringSegment to match against. Matches always start at the beginning of the
+ * segment. The segment is guaranteed to contain at least one char.
+ * @param result
+ * The data structure to store results if the match succeeds.
+ * @return Whether this matcher thinks there may be more interesting chars beyond the end of the
+ * string segment.
+ */
+ virtual bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status) const = 0;
+
+ /**
+ * Performs a fast "smoke check" for whether or not this matcher could possibly match against the
+ * given string segment. The test should be as fast as possible but also as restrictive as possible.
+ * For example, matchers can maintain a UnicodeSet of all code points that count possibly start a
+ * match. Matchers should use the {@link StringSegment#startsWith} method in order to correctly
+ * handle case folding.
+ *
+ * @param segment
+ * The segment to check against.
+ * @return true if the matcher might be able to match against this segment; false if it definitely
+ * will not be able to match.
+ */
+ virtual bool smokeTest(const StringSegment& segment) const = 0;
+
+ /**
+ * Method called at the end of a parse, after all matchers have failed to consume any more chars.
+ * Allows a matcher to make final modifications to the result given the knowledge that no more
+ * matches are possible.
+ *
+ * @param result
+ * The data structure to store results.
+ */
+ virtual void postProcess(ParsedNumber&) const {
+ // Default implementation: no-op
+ }
+
+ // String for debugging
+ virtual UnicodeString toString() const = 0;
+
+ protected:
+ // No construction except by subclasses!
+ NumberParseMatcher() = default;
+};
+
+
+/**
+ * Interface for use in arguments.
+ */
+// Exported as U_I18N_API for tests
+class U_I18N_API MutableMatcherCollection {
+ public:
+ virtual ~MutableMatcherCollection() = default;
+
+ virtual void addMatcher(NumberParseMatcher& matcher) = 0;
+};
+
+
+} // namespace impl
+} // namespace numparse
+U_NAMESPACE_END
+
+#endif //__NUMPARSE_TYPES_H__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numparse_utils.h b/contrib/libs/icu/i18n/numparse_utils.h
index 9b515d7fa9..162954bae0 100644
--- a/contrib/libs/icu/i18n/numparse_utils.h
+++ b/contrib/libs/icu/i18n/numparse_utils.h
@@ -1,43 +1,43 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMPARSE_UTILS_H__
-#define __NUMPARSE_UTILS_H__
-
-#include "numparse_types.h"
-#include "unicode/uniset.h"
-
-U_NAMESPACE_BEGIN namespace numparse {
-namespace impl {
-namespace utils {
-
-
-inline static void putLeadCodePoints(const UnicodeSet* input, UnicodeSet* output) {
- for (int32_t i = 0; i < input->getRangeCount(); i++) {
- output->add(input->getRangeStart(i), input->getRangeEnd(i));
- }
- // TODO: ANDY: How to iterate over the strings in ICU4C UnicodeSet?
-}
-
-inline static void putLeadCodePoint(const UnicodeString& input, UnicodeSet* output) {
- if (!input.isEmpty()) {
- output->add(input.char32At(0));
- }
-}
-
-inline static void copyCurrencyCode(UChar* dest, const UChar* src) {
- uprv_memcpy(dest, src, sizeof(UChar) * 3);
- dest[3] = 0;
-}
-
-
-} // namespace utils
-} // namespace impl
-} // namespace numparse
-U_NAMESPACE_END
-
-#endif //__NUMPARSE_UTILS_H__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMPARSE_UTILS_H__
+#define __NUMPARSE_UTILS_H__
+
+#include "numparse_types.h"
+#include "unicode/uniset.h"
+
+U_NAMESPACE_BEGIN namespace numparse {
+namespace impl {
+namespace utils {
+
+
+inline static void putLeadCodePoints(const UnicodeSet* input, UnicodeSet* output) {
+ for (int32_t i = 0; i < input->getRangeCount(); i++) {
+ output->add(input->getRangeStart(i), input->getRangeEnd(i));
+ }
+ // TODO: ANDY: How to iterate over the strings in ICU4C UnicodeSet?
+}
+
+inline static void putLeadCodePoint(const UnicodeString& input, UnicodeSet* output) {
+ if (!input.isEmpty()) {
+ output->add(input.char32At(0));
+ }
+}
+
+inline static void copyCurrencyCode(UChar* dest, const UChar* src) {
+ uprv_memcpy(dest, src, sizeof(UChar) * 3);
+ dest[3] = 0;
+}
+
+
+} // namespace utils
+} // namespace impl
+} // namespace numparse
+U_NAMESPACE_END
+
+#endif //__NUMPARSE_UTILS_H__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numparse_validators.cpp b/contrib/libs/icu/i18n/numparse_validators.cpp
index d868b06595..12d3465c4e 100644
--- a/contrib/libs/icu/i18n/numparse_validators.cpp
+++ b/contrib/libs/icu/i18n/numparse_validators.cpp
@@ -1,85 +1,85 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include "numparse_types.h"
-#include "numparse_validators.h"
-#include "static_unicode_sets.h"
-
-using namespace icu;
-using namespace icu::numparse;
-using namespace icu::numparse::impl;
-
-
-void RequireAffixValidator::postProcess(ParsedNumber& result) const {
- if (result.prefix.isBogus() || result.suffix.isBogus()) {
- // We saw a prefix or a suffix but not both. Fail the parse.
- result.flags |= FLAG_FAIL;
- }
-}
-
-UnicodeString RequireAffixValidator::toString() const {
- return u"<ReqAffix>";
-}
-
-
-void RequireCurrencyValidator::postProcess(ParsedNumber& result) const {
- if (result.currencyCode[0] == 0) {
- result.flags |= FLAG_FAIL;
- }
-}
-
-UnicodeString RequireCurrencyValidator::toString() const {
- return u"<ReqCurrency>";
-}
-
-
-RequireDecimalSeparatorValidator::RequireDecimalSeparatorValidator(bool patternHasDecimalSeparator)
- : fPatternHasDecimalSeparator(patternHasDecimalSeparator) {
-}
-
-void RequireDecimalSeparatorValidator::postProcess(ParsedNumber& result) const {
- bool parseHasDecimalSeparator = 0 != (result.flags & FLAG_HAS_DECIMAL_SEPARATOR);
- if (parseHasDecimalSeparator != fPatternHasDecimalSeparator) {
- result.flags |= FLAG_FAIL;
- }
-}
-
-UnicodeString RequireDecimalSeparatorValidator::toString() const {
- return u"<ReqDecimal>";
-}
-
-
-void RequireNumberValidator::postProcess(ParsedNumber& result) const {
- // Require that a number is matched.
- if (!result.seenNumber()) {
- result.flags |= FLAG_FAIL;
- }
-}
-
-UnicodeString RequireNumberValidator::toString() const {
- return u"<ReqNumber>";
-}
-
-MultiplierParseHandler::MultiplierParseHandler(::icu::number::Scale multiplier)
- : fMultiplier(std::move(multiplier)) {}
-
-void MultiplierParseHandler::postProcess(ParsedNumber& result) const {
- if (!result.quantity.bogus) {
- fMultiplier.applyReciprocalTo(result.quantity);
- // NOTE: It is okay if the multiplier was negative.
- }
-}
-
-UnicodeString MultiplierParseHandler::toString() const {
- return u"<Scale>";
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include "numparse_types.h"
+#include "numparse_validators.h"
+#include "static_unicode_sets.h"
+
+using namespace icu;
+using namespace icu::numparse;
+using namespace icu::numparse::impl;
+
+
+void RequireAffixValidator::postProcess(ParsedNumber& result) const {
+ if (result.prefix.isBogus() || result.suffix.isBogus()) {
+ // We saw a prefix or a suffix but not both. Fail the parse.
+ result.flags |= FLAG_FAIL;
+ }
+}
+
+UnicodeString RequireAffixValidator::toString() const {
+ return u"<ReqAffix>";
+}
+
+
+void RequireCurrencyValidator::postProcess(ParsedNumber& result) const {
+ if (result.currencyCode[0] == 0) {
+ result.flags |= FLAG_FAIL;
+ }
+}
+
+UnicodeString RequireCurrencyValidator::toString() const {
+ return u"<ReqCurrency>";
+}
+
+
+RequireDecimalSeparatorValidator::RequireDecimalSeparatorValidator(bool patternHasDecimalSeparator)
+ : fPatternHasDecimalSeparator(patternHasDecimalSeparator) {
+}
+
+void RequireDecimalSeparatorValidator::postProcess(ParsedNumber& result) const {
+ bool parseHasDecimalSeparator = 0 != (result.flags & FLAG_HAS_DECIMAL_SEPARATOR);
+ if (parseHasDecimalSeparator != fPatternHasDecimalSeparator) {
+ result.flags |= FLAG_FAIL;
+ }
+}
+
+UnicodeString RequireDecimalSeparatorValidator::toString() const {
+ return u"<ReqDecimal>";
+}
+
+
+void RequireNumberValidator::postProcess(ParsedNumber& result) const {
+ // Require that a number is matched.
+ if (!result.seenNumber()) {
+ result.flags |= FLAG_FAIL;
+ }
+}
+
+UnicodeString RequireNumberValidator::toString() const {
+ return u"<ReqNumber>";
+}
+
+MultiplierParseHandler::MultiplierParseHandler(::icu::number::Scale multiplier)
+ : fMultiplier(std::move(multiplier)) {}
+
+void MultiplierParseHandler::postProcess(ParsedNumber& result) const {
+ if (!result.quantity.bogus) {
+ fMultiplier.applyReciprocalTo(result.quantity);
+ // NOTE: It is okay if the multiplier was negative.
+ }
+}
+
+UnicodeString MultiplierParseHandler::toString() const {
+ return u"<Scale>";
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numparse_validators.h b/contrib/libs/icu/i18n/numparse_validators.h
index e4633a44ab..5d43b779d0 100644
--- a/contrib/libs/icu/i18n/numparse_validators.h
+++ b/contrib/libs/icu/i18n/numparse_validators.h
@@ -1,95 +1,95 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __SOURCE_NUMPARSE_VALIDATORS_H__
-#define __SOURCE_NUMPARSE_VALIDATORS_H__
-
-#include "numparse_types.h"
-#include "static_unicode_sets.h"
-
-U_NAMESPACE_BEGIN namespace numparse {
-namespace impl {
-
-
-class ValidationMatcher : public NumberParseMatcher {
- public:
- bool match(StringSegment&, ParsedNumber&, UErrorCode&) const U_OVERRIDE {
- // No-op
- return false;
- }
-
- bool smokeTest(const StringSegment&) const U_OVERRIDE {
- // No-op
- return false;
- }
-
- void postProcess(ParsedNumber& result) const U_OVERRIDE = 0;
-};
-
-
-class RequireAffixValidator : public ValidationMatcher, public UMemory {
- public:
- void postProcess(ParsedNumber& result) const U_OVERRIDE;
-
- UnicodeString toString() const U_OVERRIDE;
-};
-
-
-class RequireCurrencyValidator : public ValidationMatcher, public UMemory {
- public:
- void postProcess(ParsedNumber& result) const U_OVERRIDE;
-
- UnicodeString toString() const U_OVERRIDE;
-};
-
-
-class RequireDecimalSeparatorValidator : public ValidationMatcher, public UMemory {
- public:
- RequireDecimalSeparatorValidator() = default; // leaves instance in valid but undefined state
-
- RequireDecimalSeparatorValidator(bool patternHasDecimalSeparator);
-
- void postProcess(ParsedNumber& result) const U_OVERRIDE;
-
- UnicodeString toString() const U_OVERRIDE;
-
- private:
- bool fPatternHasDecimalSeparator;
-};
-
-
-class RequireNumberValidator : public ValidationMatcher, public UMemory {
- public:
- void postProcess(ParsedNumber& result) const U_OVERRIDE;
-
- UnicodeString toString() const U_OVERRIDE;
-};
-
-
-/**
- * Wraps a {@link Multiplier} for use in the number parsing pipeline.
- */
-class MultiplierParseHandler : public ValidationMatcher, public UMemory {
- public:
- MultiplierParseHandler() = default; // leaves instance in valid but undefined state
-
- MultiplierParseHandler(::icu::number::Scale multiplier);
-
- void postProcess(ParsedNumber& result) const U_OVERRIDE;
-
- UnicodeString toString() const U_OVERRIDE;
-
- private:
- ::icu::number::Scale fMultiplier;
-};
-
-
-} // namespace impl
-} // namespace numparse
-U_NAMESPACE_END
-
-#endif //__SOURCE_NUMPARSE_VALIDATORS_H__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __SOURCE_NUMPARSE_VALIDATORS_H__
+#define __SOURCE_NUMPARSE_VALIDATORS_H__
+
+#include "numparse_types.h"
+#include "static_unicode_sets.h"
+
+U_NAMESPACE_BEGIN namespace numparse {
+namespace impl {
+
+
+class ValidationMatcher : public NumberParseMatcher {
+ public:
+ bool match(StringSegment&, ParsedNumber&, UErrorCode&) const U_OVERRIDE {
+ // No-op
+ return false;
+ }
+
+ bool smokeTest(const StringSegment&) const U_OVERRIDE {
+ // No-op
+ return false;
+ }
+
+ void postProcess(ParsedNumber& result) const U_OVERRIDE = 0;
+};
+
+
+class RequireAffixValidator : public ValidationMatcher, public UMemory {
+ public:
+ void postProcess(ParsedNumber& result) const U_OVERRIDE;
+
+ UnicodeString toString() const U_OVERRIDE;
+};
+
+
+class RequireCurrencyValidator : public ValidationMatcher, public UMemory {
+ public:
+ void postProcess(ParsedNumber& result) const U_OVERRIDE;
+
+ UnicodeString toString() const U_OVERRIDE;
+};
+
+
+class RequireDecimalSeparatorValidator : public ValidationMatcher, public UMemory {
+ public:
+ RequireDecimalSeparatorValidator() = default; // leaves instance in valid but undefined state
+
+ RequireDecimalSeparatorValidator(bool patternHasDecimalSeparator);
+
+ void postProcess(ParsedNumber& result) const U_OVERRIDE;
+
+ UnicodeString toString() const U_OVERRIDE;
+
+ private:
+ bool fPatternHasDecimalSeparator;
+};
+
+
+class RequireNumberValidator : public ValidationMatcher, public UMemory {
+ public:
+ void postProcess(ParsedNumber& result) const U_OVERRIDE;
+
+ UnicodeString toString() const U_OVERRIDE;
+};
+
+
+/**
+ * Wraps a {@link Multiplier} for use in the number parsing pipeline.
+ */
+class MultiplierParseHandler : public ValidationMatcher, public UMemory {
+ public:
+ MultiplierParseHandler() = default; // leaves instance in valid but undefined state
+
+ MultiplierParseHandler(::icu::number::Scale multiplier);
+
+ void postProcess(ParsedNumber& result) const U_OVERRIDE;
+
+ UnicodeString toString() const U_OVERRIDE;
+
+ private:
+ ::icu::number::Scale fMultiplier;
+};
+
+
+} // namespace impl
+} // namespace numparse
+U_NAMESPACE_END
+
+#endif //__SOURCE_NUMPARSE_VALIDATORS_H__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numrange_fluent.cpp b/contrib/libs/icu/i18n/numrange_fluent.cpp
index ba00d66eed..33179026f8 100644
--- a/contrib/libs/icu/i18n/numrange_fluent.cpp
+++ b/contrib/libs/icu/i18n/numrange_fluent.cpp
@@ -1,402 +1,402 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include "numrange_impl.h"
-#include "util.h"
-#include "number_utypes.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-
-// This function needs to be declared in this namespace so it can be friended.
-// NOTE: In Java, this logic is handled in the resolve() function.
-void icu::number::impl::touchRangeLocales(RangeMacroProps& macros) {
- macros.formatter1.fMacros.locale = macros.locale;
- macros.formatter2.fMacros.locale = macros.locale;
-}
-
-
-template<typename Derived>
-Derived NumberRangeFormatterSettings<Derived>::numberFormatterBoth(const UnlocalizedNumberFormatter& formatter) const& {
- Derived copy(*this);
- copy.fMacros.formatter1 = formatter;
- copy.fMacros.singleFormatter = true;
- touchRangeLocales(copy.fMacros);
- return copy;
-}
-
-template<typename Derived>
-Derived NumberRangeFormatterSettings<Derived>::numberFormatterBoth(const UnlocalizedNumberFormatter& formatter) && {
- Derived move(std::move(*this));
- move.fMacros.formatter1 = formatter;
- move.fMacros.singleFormatter = true;
- touchRangeLocales(move.fMacros);
- return move;
-}
-
-template<typename Derived>
-Derived NumberRangeFormatterSettings<Derived>::numberFormatterBoth(UnlocalizedNumberFormatter&& formatter) const& {
- Derived copy(*this);
- copy.fMacros.formatter1 = std::move(formatter);
- copy.fMacros.singleFormatter = true;
- touchRangeLocales(copy.fMacros);
- return copy;
-}
-
-template<typename Derived>
-Derived NumberRangeFormatterSettings<Derived>::numberFormatterBoth(UnlocalizedNumberFormatter&& formatter) && {
- Derived move(std::move(*this));
- move.fMacros.formatter1 = std::move(formatter);
- move.fMacros.singleFormatter = true;
- touchRangeLocales(move.fMacros);
- return move;
-}
-
-template<typename Derived>
-Derived NumberRangeFormatterSettings<Derived>::numberFormatterFirst(const UnlocalizedNumberFormatter& formatter) const& {
- Derived copy(*this);
- copy.fMacros.formatter1 = formatter;
- copy.fMacros.singleFormatter = false;
- touchRangeLocales(copy.fMacros);
- return copy;
-}
-
-template<typename Derived>
-Derived NumberRangeFormatterSettings<Derived>::numberFormatterFirst(const UnlocalizedNumberFormatter& formatter) && {
- Derived move(std::move(*this));
- move.fMacros.formatter1 = formatter;
- move.fMacros.singleFormatter = false;
- touchRangeLocales(move.fMacros);
- return move;
-}
-
-template<typename Derived>
-Derived NumberRangeFormatterSettings<Derived>::numberFormatterFirst(UnlocalizedNumberFormatter&& formatter) const& {
- Derived copy(*this);
- copy.fMacros.formatter1 = std::move(formatter);
- copy.fMacros.singleFormatter = false;
- touchRangeLocales(copy.fMacros);
- return copy;
-}
-
-template<typename Derived>
-Derived NumberRangeFormatterSettings<Derived>::numberFormatterFirst(UnlocalizedNumberFormatter&& formatter) && {
- Derived move(std::move(*this));
- move.fMacros.formatter1 = std::move(formatter);
- move.fMacros.singleFormatter = false;
- touchRangeLocales(move.fMacros);
- return move;
-}
-
-template<typename Derived>
-Derived NumberRangeFormatterSettings<Derived>::numberFormatterSecond(const UnlocalizedNumberFormatter& formatter) const& {
- Derived copy(*this);
- copy.fMacros.formatter2 = formatter;
- copy.fMacros.singleFormatter = false;
- touchRangeLocales(copy.fMacros);
- return copy;
-}
-
-template<typename Derived>
-Derived NumberRangeFormatterSettings<Derived>::numberFormatterSecond(const UnlocalizedNumberFormatter& formatter) && {
- Derived move(std::move(*this));
- move.fMacros.formatter2 = formatter;
- move.fMacros.singleFormatter = false;
- touchRangeLocales(move.fMacros);
- return move;
-}
-
-template<typename Derived>
-Derived NumberRangeFormatterSettings<Derived>::numberFormatterSecond(UnlocalizedNumberFormatter&& formatter) const& {
- Derived copy(*this);
- copy.fMacros.formatter2 = std::move(formatter);
- copy.fMacros.singleFormatter = false;
- touchRangeLocales(copy.fMacros);
- return copy;
-}
-
-template<typename Derived>
-Derived NumberRangeFormatterSettings<Derived>::numberFormatterSecond(UnlocalizedNumberFormatter&& formatter) && {
- Derived move(std::move(*this));
- move.fMacros.formatter2 = std::move(formatter);
- move.fMacros.singleFormatter = false;
- touchRangeLocales(move.fMacros);
- return move;
-}
-
-template<typename Derived>
-Derived NumberRangeFormatterSettings<Derived>::collapse(UNumberRangeCollapse collapse) const& {
- Derived copy(*this);
- copy.fMacros.collapse = collapse;
- return copy;
-}
-
-template<typename Derived>
-Derived NumberRangeFormatterSettings<Derived>::collapse(UNumberRangeCollapse collapse) && {
- Derived move(std::move(*this));
- move.fMacros.collapse = collapse;
- return move;
-}
-
-template<typename Derived>
-Derived NumberRangeFormatterSettings<Derived>::identityFallback(UNumberRangeIdentityFallback identityFallback) const& {
- Derived copy(*this);
- copy.fMacros.identityFallback = identityFallback;
- return copy;
-}
-
-template<typename Derived>
-Derived NumberRangeFormatterSettings<Derived>::identityFallback(UNumberRangeIdentityFallback identityFallback) && {
- Derived move(std::move(*this));
- move.fMacros.identityFallback = identityFallback;
- return move;
-}
-
-template<typename Derived>
-LocalPointer<Derived> NumberRangeFormatterSettings<Derived>::clone() const & {
- return LocalPointer<Derived>(new Derived(*this));
-}
-
-template<typename Derived>
-LocalPointer<Derived> NumberRangeFormatterSettings<Derived>::clone() && {
- return LocalPointer<Derived>(new Derived(std::move(*this)));
-}
-
-// Declare all classes that implement NumberRangeFormatterSettings
-// See https://stackoverflow.com/a/495056/1407170
-template
-class icu::number::NumberRangeFormatterSettings<icu::number::UnlocalizedNumberRangeFormatter>;
-template
-class icu::number::NumberRangeFormatterSettings<icu::number::LocalizedNumberRangeFormatter>;
-
-
-UnlocalizedNumberRangeFormatter NumberRangeFormatter::with() {
- UnlocalizedNumberRangeFormatter result;
- return result;
-}
-
-LocalizedNumberRangeFormatter NumberRangeFormatter::withLocale(const Locale& locale) {
- return with().locale(locale);
-}
-
-
-template<typename T> using NFS = NumberRangeFormatterSettings<T>;
-using LNF = LocalizedNumberRangeFormatter;
-using UNF = UnlocalizedNumberRangeFormatter;
-
-UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter(const UNF& other)
- : UNF(static_cast<const NFS<UNF>&>(other)) {}
-
-UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter(const NFS<UNF>& other)
- : NFS<UNF>(other) {
- // No additional fields to assign
-}
-
-// Make default copy constructor call the NumberRangeFormatterSettings copy constructor.
-UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter(UNF&& src) U_NOEXCEPT
- : UNF(static_cast<NFS<UNF>&&>(src)) {}
-
-UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter(NFS<UNF>&& src) U_NOEXCEPT
- : NFS<UNF>(std::move(src)) {
- // No additional fields to assign
-}
-
-UnlocalizedNumberRangeFormatter& UnlocalizedNumberRangeFormatter::operator=(const UNF& other) {
- NFS<UNF>::operator=(static_cast<const NFS<UNF>&>(other));
- // No additional fields to assign
- return *this;
-}
-
-UnlocalizedNumberRangeFormatter& UnlocalizedNumberRangeFormatter::operator=(UNF&& src) U_NOEXCEPT {
- NFS<UNF>::operator=(static_cast<NFS<UNF>&&>(src));
- // No additional fields to assign
- return *this;
-}
-
-// Make default copy constructor call the NumberRangeFormatterSettings copy constructor.
-LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(const LNF& other)
- : LNF(static_cast<const NFS<LNF>&>(other)) {}
-
-LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(const NFS<LNF>& other)
- : NFS<LNF>(other) {
- // No additional fields to assign
-}
-
-LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(LocalizedNumberRangeFormatter&& src) U_NOEXCEPT
- : LNF(static_cast<NFS<LNF>&&>(src)) {}
-
-LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(NFS<LNF>&& src) U_NOEXCEPT
- : NFS<LNF>(std::move(src)) {
- // Steal the compiled formatter
- LNF&& _src = static_cast<LNF&&>(src);
- auto* stolen = _src.fAtomicFormatter.exchange(nullptr);
- delete fAtomicFormatter.exchange(stolen);
-}
-
-LocalizedNumberRangeFormatter& LocalizedNumberRangeFormatter::operator=(const LNF& other) {
- NFS<LNF>::operator=(static_cast<const NFS<LNF>&>(other));
- // Do not steal; just clear
- delete fAtomicFormatter.exchange(nullptr);
- return *this;
-}
-
-LocalizedNumberRangeFormatter& LocalizedNumberRangeFormatter::operator=(LNF&& src) U_NOEXCEPT {
- NFS<LNF>::operator=(static_cast<NFS<LNF>&&>(src));
- // Steal the compiled formatter
- auto* stolen = src.fAtomicFormatter.exchange(nullptr);
- delete fAtomicFormatter.exchange(stolen);
- return *this;
-}
-
-
-LocalizedNumberRangeFormatter::~LocalizedNumberRangeFormatter() {
- delete fAtomicFormatter.exchange(nullptr);
-}
-
-LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(const RangeMacroProps& macros, const Locale& locale) {
- fMacros = macros;
- fMacros.locale = locale;
- touchRangeLocales(fMacros);
-}
-
-LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(RangeMacroProps&& macros, const Locale& locale) {
- fMacros = std::move(macros);
- fMacros.locale = locale;
- touchRangeLocales(fMacros);
-}
-
-LocalizedNumberRangeFormatter UnlocalizedNumberRangeFormatter::locale(const Locale& locale) const& {
- return LocalizedNumberRangeFormatter(fMacros, locale);
-}
-
-LocalizedNumberRangeFormatter UnlocalizedNumberRangeFormatter::locale(const Locale& locale)&& {
- return LocalizedNumberRangeFormatter(std::move(fMacros), locale);
-}
-
-
-FormattedNumberRange LocalizedNumberRangeFormatter::formatFormattableRange(
- const Formattable& first, const Formattable& second, UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return FormattedNumberRange(U_ILLEGAL_ARGUMENT_ERROR);
- }
-
- auto results = new UFormattedNumberRangeData();
- if (results == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return FormattedNumberRange(status);
- }
-
- first.populateDecimalQuantity(results->quantity1, status);
- if (U_FAILURE(status)) {
- return FormattedNumberRange(status);
- }
-
- second.populateDecimalQuantity(results->quantity2, status);
- if (U_FAILURE(status)) {
- return FormattedNumberRange(status);
- }
-
- formatImpl(*results, first == second, status);
-
- // Do not save the results object if we encountered a failure.
- if (U_SUCCESS(status)) {
- return FormattedNumberRange(results);
- } else {
- delete results;
- return FormattedNumberRange(status);
- }
-}
-
-void LocalizedNumberRangeFormatter::formatImpl(
- UFormattedNumberRangeData& results, bool equalBeforeRounding, UErrorCode& status) const {
- auto* impl = getFormatter(status);
- if (U_FAILURE(status)) {
- return;
- }
- if (impl == nullptr) {
- status = U_INTERNAL_PROGRAM_ERROR;
- return;
- }
- impl->format(results, equalBeforeRounding, status);
- if (U_FAILURE(status)) {
- return;
- }
- results.getStringRef().writeTerminator(status);
-}
-
-const impl::NumberRangeFormatterImpl*
-LocalizedNumberRangeFormatter::getFormatter(UErrorCode& status) const {
- // TODO: Move this into umutex.h? (similar logic also in decimfmt.cpp)
- // See ICU-20146
-
- if (U_FAILURE(status)) {
- return nullptr;
- }
-
- // First try to get the pre-computed formatter
- auto* ptr = fAtomicFormatter.load();
- if (ptr != nullptr) {
- return ptr;
- }
-
- // Try computing the formatter on our own
- auto* temp = new NumberRangeFormatterImpl(fMacros, status);
- if (U_FAILURE(status)) {
- return nullptr;
- }
- if (temp == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
-
- // Note: ptr starts as nullptr; during compare_exchange,
- // it is set to what is actually stored in the atomic
- // if another thread beat us to computing the formatter object.
- auto* nonConstThis = const_cast<LocalizedNumberRangeFormatter*>(this);
- if (!nonConstThis->fAtomicFormatter.compare_exchange_strong(ptr, temp)) {
- // Another thread beat us to computing the formatter
- delete temp;
- return ptr;
- } else {
- // Our copy of the formatter got stored in the atomic
- return temp;
- }
-
-}
-
-
-UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedNumberRange)
-
-#define UPRV_NOARG
-
-UnicodeString FormattedNumberRange::getFirstDecimal(UErrorCode& status) const {
- UPRV_FORMATTED_VALUE_METHOD_GUARD(ICU_Utility::makeBogusString())
- return fData->quantity1.toScientificString();
-}
-
-UnicodeString FormattedNumberRange::getSecondDecimal(UErrorCode& status) const {
- UPRV_FORMATTED_VALUE_METHOD_GUARD(ICU_Utility::makeBogusString())
- return fData->quantity2.toScientificString();
-}
-
-UNumberRangeIdentityResult FormattedNumberRange::getIdentityResult(UErrorCode& status) const {
- UPRV_FORMATTED_VALUE_METHOD_GUARD(UNUM_IDENTITY_RESULT_NOT_EQUAL)
- return fData->identityResult;
-}
-
-
-UFormattedNumberRangeData::~UFormattedNumberRangeData() = default;
-
-
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include "numrange_impl.h"
+#include "util.h"
+#include "number_utypes.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+
+// This function needs to be declared in this namespace so it can be friended.
+// NOTE: In Java, this logic is handled in the resolve() function.
+void icu::number::impl::touchRangeLocales(RangeMacroProps& macros) {
+ macros.formatter1.fMacros.locale = macros.locale;
+ macros.formatter2.fMacros.locale = macros.locale;
+}
+
+
+template<typename Derived>
+Derived NumberRangeFormatterSettings<Derived>::numberFormatterBoth(const UnlocalizedNumberFormatter& formatter) const& {
+ Derived copy(*this);
+ copy.fMacros.formatter1 = formatter;
+ copy.fMacros.singleFormatter = true;
+ touchRangeLocales(copy.fMacros);
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberRangeFormatterSettings<Derived>::numberFormatterBoth(const UnlocalizedNumberFormatter& formatter) && {
+ Derived move(std::move(*this));
+ move.fMacros.formatter1 = formatter;
+ move.fMacros.singleFormatter = true;
+ touchRangeLocales(move.fMacros);
+ return move;
+}
+
+template<typename Derived>
+Derived NumberRangeFormatterSettings<Derived>::numberFormatterBoth(UnlocalizedNumberFormatter&& formatter) const& {
+ Derived copy(*this);
+ copy.fMacros.formatter1 = std::move(formatter);
+ copy.fMacros.singleFormatter = true;
+ touchRangeLocales(copy.fMacros);
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberRangeFormatterSettings<Derived>::numberFormatterBoth(UnlocalizedNumberFormatter&& formatter) && {
+ Derived move(std::move(*this));
+ move.fMacros.formatter1 = std::move(formatter);
+ move.fMacros.singleFormatter = true;
+ touchRangeLocales(move.fMacros);
+ return move;
+}
+
+template<typename Derived>
+Derived NumberRangeFormatterSettings<Derived>::numberFormatterFirst(const UnlocalizedNumberFormatter& formatter) const& {
+ Derived copy(*this);
+ copy.fMacros.formatter1 = formatter;
+ copy.fMacros.singleFormatter = false;
+ touchRangeLocales(copy.fMacros);
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberRangeFormatterSettings<Derived>::numberFormatterFirst(const UnlocalizedNumberFormatter& formatter) && {
+ Derived move(std::move(*this));
+ move.fMacros.formatter1 = formatter;
+ move.fMacros.singleFormatter = false;
+ touchRangeLocales(move.fMacros);
+ return move;
+}
+
+template<typename Derived>
+Derived NumberRangeFormatterSettings<Derived>::numberFormatterFirst(UnlocalizedNumberFormatter&& formatter) const& {
+ Derived copy(*this);
+ copy.fMacros.formatter1 = std::move(formatter);
+ copy.fMacros.singleFormatter = false;
+ touchRangeLocales(copy.fMacros);
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberRangeFormatterSettings<Derived>::numberFormatterFirst(UnlocalizedNumberFormatter&& formatter) && {
+ Derived move(std::move(*this));
+ move.fMacros.formatter1 = std::move(formatter);
+ move.fMacros.singleFormatter = false;
+ touchRangeLocales(move.fMacros);
+ return move;
+}
+
+template<typename Derived>
+Derived NumberRangeFormatterSettings<Derived>::numberFormatterSecond(const UnlocalizedNumberFormatter& formatter) const& {
+ Derived copy(*this);
+ copy.fMacros.formatter2 = formatter;
+ copy.fMacros.singleFormatter = false;
+ touchRangeLocales(copy.fMacros);
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberRangeFormatterSettings<Derived>::numberFormatterSecond(const UnlocalizedNumberFormatter& formatter) && {
+ Derived move(std::move(*this));
+ move.fMacros.formatter2 = formatter;
+ move.fMacros.singleFormatter = false;
+ touchRangeLocales(move.fMacros);
+ return move;
+}
+
+template<typename Derived>
+Derived NumberRangeFormatterSettings<Derived>::numberFormatterSecond(UnlocalizedNumberFormatter&& formatter) const& {
+ Derived copy(*this);
+ copy.fMacros.formatter2 = std::move(formatter);
+ copy.fMacros.singleFormatter = false;
+ touchRangeLocales(copy.fMacros);
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberRangeFormatterSettings<Derived>::numberFormatterSecond(UnlocalizedNumberFormatter&& formatter) && {
+ Derived move(std::move(*this));
+ move.fMacros.formatter2 = std::move(formatter);
+ move.fMacros.singleFormatter = false;
+ touchRangeLocales(move.fMacros);
+ return move;
+}
+
+template<typename Derived>
+Derived NumberRangeFormatterSettings<Derived>::collapse(UNumberRangeCollapse collapse) const& {
+ Derived copy(*this);
+ copy.fMacros.collapse = collapse;
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberRangeFormatterSettings<Derived>::collapse(UNumberRangeCollapse collapse) && {
+ Derived move(std::move(*this));
+ move.fMacros.collapse = collapse;
+ return move;
+}
+
+template<typename Derived>
+Derived NumberRangeFormatterSettings<Derived>::identityFallback(UNumberRangeIdentityFallback identityFallback) const& {
+ Derived copy(*this);
+ copy.fMacros.identityFallback = identityFallback;
+ return copy;
+}
+
+template<typename Derived>
+Derived NumberRangeFormatterSettings<Derived>::identityFallback(UNumberRangeIdentityFallback identityFallback) && {
+ Derived move(std::move(*this));
+ move.fMacros.identityFallback = identityFallback;
+ return move;
+}
+
+template<typename Derived>
+LocalPointer<Derived> NumberRangeFormatterSettings<Derived>::clone() const & {
+ return LocalPointer<Derived>(new Derived(*this));
+}
+
+template<typename Derived>
+LocalPointer<Derived> NumberRangeFormatterSettings<Derived>::clone() && {
+ return LocalPointer<Derived>(new Derived(std::move(*this)));
+}
+
+// Declare all classes that implement NumberRangeFormatterSettings
+// See https://stackoverflow.com/a/495056/1407170
+template
+class icu::number::NumberRangeFormatterSettings<icu::number::UnlocalizedNumberRangeFormatter>;
+template
+class icu::number::NumberRangeFormatterSettings<icu::number::LocalizedNumberRangeFormatter>;
+
+
+UnlocalizedNumberRangeFormatter NumberRangeFormatter::with() {
+ UnlocalizedNumberRangeFormatter result;
+ return result;
+}
+
+LocalizedNumberRangeFormatter NumberRangeFormatter::withLocale(const Locale& locale) {
+ return with().locale(locale);
+}
+
+
+template<typename T> using NFS = NumberRangeFormatterSettings<T>;
+using LNF = LocalizedNumberRangeFormatter;
+using UNF = UnlocalizedNumberRangeFormatter;
+
+UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter(const UNF& other)
+ : UNF(static_cast<const NFS<UNF>&>(other)) {}
+
+UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter(const NFS<UNF>& other)
+ : NFS<UNF>(other) {
+ // No additional fields to assign
+}
+
+// Make default copy constructor call the NumberRangeFormatterSettings copy constructor.
+UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter(UNF&& src) U_NOEXCEPT
+ : UNF(static_cast<NFS<UNF>&&>(src)) {}
+
+UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter(NFS<UNF>&& src) U_NOEXCEPT
+ : NFS<UNF>(std::move(src)) {
+ // No additional fields to assign
+}
+
+UnlocalizedNumberRangeFormatter& UnlocalizedNumberRangeFormatter::operator=(const UNF& other) {
+ NFS<UNF>::operator=(static_cast<const NFS<UNF>&>(other));
+ // No additional fields to assign
+ return *this;
+}
+
+UnlocalizedNumberRangeFormatter& UnlocalizedNumberRangeFormatter::operator=(UNF&& src) U_NOEXCEPT {
+ NFS<UNF>::operator=(static_cast<NFS<UNF>&&>(src));
+ // No additional fields to assign
+ return *this;
+}
+
+// Make default copy constructor call the NumberRangeFormatterSettings copy constructor.
+LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(const LNF& other)
+ : LNF(static_cast<const NFS<LNF>&>(other)) {}
+
+LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(const NFS<LNF>& other)
+ : NFS<LNF>(other) {
+ // No additional fields to assign
+}
+
+LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(LocalizedNumberRangeFormatter&& src) U_NOEXCEPT
+ : LNF(static_cast<NFS<LNF>&&>(src)) {}
+
+LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(NFS<LNF>&& src) U_NOEXCEPT
+ : NFS<LNF>(std::move(src)) {
+ // Steal the compiled formatter
+ LNF&& _src = static_cast<LNF&&>(src);
+ auto* stolen = _src.fAtomicFormatter.exchange(nullptr);
+ delete fAtomicFormatter.exchange(stolen);
+}
+
+LocalizedNumberRangeFormatter& LocalizedNumberRangeFormatter::operator=(const LNF& other) {
+ NFS<LNF>::operator=(static_cast<const NFS<LNF>&>(other));
+ // Do not steal; just clear
+ delete fAtomicFormatter.exchange(nullptr);
+ return *this;
+}
+
+LocalizedNumberRangeFormatter& LocalizedNumberRangeFormatter::operator=(LNF&& src) U_NOEXCEPT {
+ NFS<LNF>::operator=(static_cast<NFS<LNF>&&>(src));
+ // Steal the compiled formatter
+ auto* stolen = src.fAtomicFormatter.exchange(nullptr);
+ delete fAtomicFormatter.exchange(stolen);
+ return *this;
+}
+
+
+LocalizedNumberRangeFormatter::~LocalizedNumberRangeFormatter() {
+ delete fAtomicFormatter.exchange(nullptr);
+}
+
+LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(const RangeMacroProps& macros, const Locale& locale) {
+ fMacros = macros;
+ fMacros.locale = locale;
+ touchRangeLocales(fMacros);
+}
+
+LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(RangeMacroProps&& macros, const Locale& locale) {
+ fMacros = std::move(macros);
+ fMacros.locale = locale;
+ touchRangeLocales(fMacros);
+}
+
+LocalizedNumberRangeFormatter UnlocalizedNumberRangeFormatter::locale(const Locale& locale) const& {
+ return LocalizedNumberRangeFormatter(fMacros, locale);
+}
+
+LocalizedNumberRangeFormatter UnlocalizedNumberRangeFormatter::locale(const Locale& locale)&& {
+ return LocalizedNumberRangeFormatter(std::move(fMacros), locale);
+}
+
+
+FormattedNumberRange LocalizedNumberRangeFormatter::formatFormattableRange(
+ const Formattable& first, const Formattable& second, UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return FormattedNumberRange(U_ILLEGAL_ARGUMENT_ERROR);
+ }
+
+ auto results = new UFormattedNumberRangeData();
+ if (results == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return FormattedNumberRange(status);
+ }
+
+ first.populateDecimalQuantity(results->quantity1, status);
+ if (U_FAILURE(status)) {
+ return FormattedNumberRange(status);
+ }
+
+ second.populateDecimalQuantity(results->quantity2, status);
+ if (U_FAILURE(status)) {
+ return FormattedNumberRange(status);
+ }
+
+ formatImpl(*results, first == second, status);
+
+ // Do not save the results object if we encountered a failure.
+ if (U_SUCCESS(status)) {
+ return FormattedNumberRange(results);
+ } else {
+ delete results;
+ return FormattedNumberRange(status);
+ }
+}
+
+void LocalizedNumberRangeFormatter::formatImpl(
+ UFormattedNumberRangeData& results, bool equalBeforeRounding, UErrorCode& status) const {
+ auto* impl = getFormatter(status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ if (impl == nullptr) {
+ status = U_INTERNAL_PROGRAM_ERROR;
+ return;
+ }
+ impl->format(results, equalBeforeRounding, status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ results.getStringRef().writeTerminator(status);
+}
+
+const impl::NumberRangeFormatterImpl*
+LocalizedNumberRangeFormatter::getFormatter(UErrorCode& status) const {
+ // TODO: Move this into umutex.h? (similar logic also in decimfmt.cpp)
+ // See ICU-20146
+
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+
+ // First try to get the pre-computed formatter
+ auto* ptr = fAtomicFormatter.load();
+ if (ptr != nullptr) {
+ return ptr;
+ }
+
+ // Try computing the formatter on our own
+ auto* temp = new NumberRangeFormatterImpl(fMacros, status);
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ if (temp == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+
+ // Note: ptr starts as nullptr; during compare_exchange,
+ // it is set to what is actually stored in the atomic
+ // if another thread beat us to computing the formatter object.
+ auto* nonConstThis = const_cast<LocalizedNumberRangeFormatter*>(this);
+ if (!nonConstThis->fAtomicFormatter.compare_exchange_strong(ptr, temp)) {
+ // Another thread beat us to computing the formatter
+ delete temp;
+ return ptr;
+ } else {
+ // Our copy of the formatter got stored in the atomic
+ return temp;
+ }
+
+}
+
+
+UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedNumberRange)
+
+#define UPRV_NOARG
+
+UnicodeString FormattedNumberRange::getFirstDecimal(UErrorCode& status) const {
+ UPRV_FORMATTED_VALUE_METHOD_GUARD(ICU_Utility::makeBogusString())
+ return fData->quantity1.toScientificString();
+}
+
+UnicodeString FormattedNumberRange::getSecondDecimal(UErrorCode& status) const {
+ UPRV_FORMATTED_VALUE_METHOD_GUARD(ICU_Utility::makeBogusString())
+ return fData->quantity2.toScientificString();
+}
+
+UNumberRangeIdentityResult FormattedNumberRange::getIdentityResult(UErrorCode& status) const {
+ UPRV_FORMATTED_VALUE_METHOD_GUARD(UNUM_IDENTITY_RESULT_NOT_EQUAL)
+ return fData->identityResult;
+}
+
+
+UFormattedNumberRangeData::~UFormattedNumberRangeData() = default;
+
+
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numrange_impl.cpp b/contrib/libs/icu/i18n/numrange_impl.cpp
index 023bfd01f7..9fb3dee861 100644
--- a/contrib/libs/icu/i18n/numrange_impl.cpp
+++ b/contrib/libs/icu/i18n/numrange_impl.cpp
@@ -1,508 +1,508 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include "unicode/numberrangeformatter.h"
-#include "numrange_impl.h"
-#include "patternprops.h"
-#include "uresimp.h"
-#include "util.h"
-
-using namespace icu;
-using namespace icu::number;
-using namespace icu::number::impl;
-
-namespace {
-
-// Helper function for 2-dimensional switch statement
-constexpr int8_t identity2d(UNumberRangeIdentityFallback a, UNumberRangeIdentityResult b) {
- return static_cast<int8_t>(a) | (static_cast<int8_t>(b) << 4);
-}
-
-
-struct NumberRangeData {
- SimpleFormatter rangePattern;
- SimpleFormatter approximatelyPattern;
-};
-
-class NumberRangeDataSink : public ResourceSink {
- public:
- NumberRangeDataSink(NumberRangeData& data) : fData(data) {}
-
- void put(const char* key, ResourceValue& value, UBool /*noFallback*/, UErrorCode& status) U_OVERRIDE {
- ResourceTable miscTable = value.getTable(status);
- if (U_FAILURE(status)) { return; }
- for (int i = 0; miscTable.getKeyAndValue(i, key, value); i++) {
- if (uprv_strcmp(key, "range") == 0) {
- if (hasRangeData()) {
- continue; // have already seen this pattern
- }
- fData.rangePattern = {value.getUnicodeString(status), status};
- } else if (uprv_strcmp(key, "approximately") == 0) {
- if (hasApproxData()) {
- continue; // have already seen this pattern
- }
- fData.approximatelyPattern = {value.getUnicodeString(status), status};
- }
- }
- }
-
- bool hasRangeData() {
- return fData.rangePattern.getArgumentLimit() != 0;
- }
-
- bool hasApproxData() {
- return fData.approximatelyPattern.getArgumentLimit() != 0;
- }
-
- bool isComplete() {
- return hasRangeData() && hasApproxData();
- }
-
- void fillInDefaults(UErrorCode& status) {
- if (!hasRangeData()) {
- fData.rangePattern = {u"{0}–{1}", status};
- }
- if (!hasApproxData()) {
- fData.approximatelyPattern = {u"~{0}", status};
- }
- }
-
- private:
- NumberRangeData& fData;
-};
-
-void getNumberRangeData(const char* localeName, const char* nsName, NumberRangeData& data, UErrorCode& status) {
- if (U_FAILURE(status)) { return; }
- LocalUResourceBundlePointer rb(ures_open(NULL, localeName, &status));
- if (U_FAILURE(status)) { return; }
- NumberRangeDataSink sink(data);
-
- CharString dataPath;
- dataPath.append("NumberElements/", -1, status);
- dataPath.append(nsName, -1, status);
- dataPath.append("/miscPatterns", -1, status);
- if (U_FAILURE(status)) { return; }
-
- UErrorCode localStatus = U_ZERO_ERROR;
- ures_getAllItemsWithFallback(rb.getAlias(), dataPath.data(), sink, localStatus);
- if (U_FAILURE(localStatus) && localStatus != U_MISSING_RESOURCE_ERROR) {
- status = localStatus;
- return;
- }
-
- // Fall back to latn if necessary
- if (!sink.isComplete()) {
- ures_getAllItemsWithFallback(rb.getAlias(), "NumberElements/latn/miscPatterns", sink, status);
- }
-
- sink.fillInDefaults(status);
-}
-
-class PluralRangesDataSink : public ResourceSink {
- public:
- PluralRangesDataSink(StandardPluralRanges& output) : fOutput(output) {}
-
- void put(const char* /*key*/, ResourceValue& value, UBool /*noFallback*/, UErrorCode& status) U_OVERRIDE {
- ResourceArray entriesArray = value.getArray(status);
- if (U_FAILURE(status)) { return; }
- fOutput.setCapacity(entriesArray.getSize());
- for (int i = 0; entriesArray.getValue(i, value); i++) {
- ResourceArray pluralFormsArray = value.getArray(status);
- if (U_FAILURE(status)) { return; }
- pluralFormsArray.getValue(0, value);
- StandardPlural::Form first = StandardPlural::fromString(value.getUnicodeString(status), status);
- if (U_FAILURE(status)) { return; }
- pluralFormsArray.getValue(1, value);
- StandardPlural::Form second = StandardPlural::fromString(value.getUnicodeString(status), status);
- if (U_FAILURE(status)) { return; }
- pluralFormsArray.getValue(2, value);
- StandardPlural::Form result = StandardPlural::fromString(value.getUnicodeString(status), status);
- if (U_FAILURE(status)) { return; }
- fOutput.addPluralRange(first, second, result);
- }
- }
-
- private:
- StandardPluralRanges& fOutput;
-};
-
-void getPluralRangesData(const Locale& locale, StandardPluralRanges& output, UErrorCode& status) {
- if (U_FAILURE(status)) { return; }
- LocalUResourceBundlePointer rb(ures_openDirect(nullptr, "pluralRanges", &status));
- if (U_FAILURE(status)) { return; }
-
- CharString dataPath;
- dataPath.append("locales/", -1, status);
- dataPath.append(locale.getLanguage(), -1, status);
- if (U_FAILURE(status)) { return; }
- int32_t setLen;
- // Not all languages are covered: fail gracefully
- UErrorCode internalStatus = U_ZERO_ERROR;
- const UChar* set = ures_getStringByKeyWithFallback(rb.getAlias(), dataPath.data(), &setLen, &internalStatus);
- if (U_FAILURE(internalStatus)) { return; }
-
- dataPath.clear();
- dataPath.append("rules/", -1, status);
- dataPath.appendInvariantChars(set, setLen, status);
- if (U_FAILURE(status)) { return; }
- PluralRangesDataSink sink(output);
- ures_getAllItemsWithFallback(rb.getAlias(), dataPath.data(), sink, status);
- if (U_FAILURE(status)) { return; }
-}
-
-} // namespace
-
-
-void StandardPluralRanges::initialize(const Locale& locale, UErrorCode& status) {
- getPluralRangesData(locale, *this, status);
-}
-
-void StandardPluralRanges::addPluralRange(
- StandardPlural::Form first,
- StandardPlural::Form second,
- StandardPlural::Form result) {
- U_ASSERT(fTriplesLen < fTriples.getCapacity());
- fTriples[fTriplesLen] = {first, second, result};
- fTriplesLen++;
-}
-
-void StandardPluralRanges::setCapacity(int32_t length) {
- if (length > fTriples.getCapacity()) {
- fTriples.resize(length, 0);
- }
-}
-
-StandardPlural::Form
-StandardPluralRanges::resolve(StandardPlural::Form first, StandardPlural::Form second) const {
- for (int32_t i=0; i<fTriplesLen; i++) {
- const auto& triple = fTriples[i];
- if (triple.first == first && triple.second == second) {
- return triple.result;
- }
- }
- // Default fallback
- return StandardPlural::OTHER;
-}
-
-
-NumberRangeFormatterImpl::NumberRangeFormatterImpl(const RangeMacroProps& macros, UErrorCode& status)
- : formatterImpl1(macros.formatter1.fMacros, status),
- formatterImpl2(macros.formatter2.fMacros, status),
- fSameFormatters(macros.singleFormatter),
- fCollapse(macros.collapse),
- fIdentityFallback(macros.identityFallback) {
-
- const char* nsName = formatterImpl1.getRawMicroProps().nsName;
- if (uprv_strcmp(nsName, formatterImpl2.getRawMicroProps().nsName) != 0) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- NumberRangeData data;
- getNumberRangeData(macros.locale.getName(), nsName, data, status);
- if (U_FAILURE(status)) { return; }
- fRangeFormatter = data.rangePattern;
- fApproximatelyModifier = {data.approximatelyPattern, kUndefinedField, false};
-
- // TODO: Get locale from PluralRules instead?
- fPluralRanges.initialize(macros.locale, status);
- if (U_FAILURE(status)) { return; }
-}
-
-void NumberRangeFormatterImpl::format(UFormattedNumberRangeData& data, bool equalBeforeRounding, UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return;
- }
-
- MicroProps micros1;
- MicroProps micros2;
- formatterImpl1.preProcess(data.quantity1, micros1, status);
- if (fSameFormatters) {
- formatterImpl1.preProcess(data.quantity2, micros2, status);
- } else {
- formatterImpl2.preProcess(data.quantity2, micros2, status);
- }
- if (U_FAILURE(status)) {
- return;
- }
-
- // If any of the affixes are different, an identity is not possible
- // and we must use formatRange().
- // TODO: Write this as MicroProps operator==() ?
- // TODO: Avoid the redundancy of these equality operations with the
- // ones in formatRange?
- if (!micros1.modInner->semanticallyEquivalent(*micros2.modInner)
- || !micros1.modMiddle->semanticallyEquivalent(*micros2.modMiddle)
- || !micros1.modOuter->semanticallyEquivalent(*micros2.modOuter)) {
- formatRange(data, micros1, micros2, status);
- data.identityResult = UNUM_IDENTITY_RESULT_NOT_EQUAL;
- return;
- }
-
- // Check for identity
- if (equalBeforeRounding) {
- data.identityResult = UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING;
- } else if (data.quantity1 == data.quantity2) {
- data.identityResult = UNUM_IDENTITY_RESULT_EQUAL_AFTER_ROUNDING;
- } else {
- data.identityResult = UNUM_IDENTITY_RESULT_NOT_EQUAL;
- }
-
- switch (identity2d(fIdentityFallback, data.identityResult)) {
- case identity2d(UNUM_IDENTITY_FALLBACK_RANGE,
- UNUM_IDENTITY_RESULT_NOT_EQUAL):
- case identity2d(UNUM_IDENTITY_FALLBACK_RANGE,
- UNUM_IDENTITY_RESULT_EQUAL_AFTER_ROUNDING):
- case identity2d(UNUM_IDENTITY_FALLBACK_RANGE,
- UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING):
- case identity2d(UNUM_IDENTITY_FALLBACK_APPROXIMATELY,
- UNUM_IDENTITY_RESULT_NOT_EQUAL):
- case identity2d(UNUM_IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE,
- UNUM_IDENTITY_RESULT_NOT_EQUAL):
- case identity2d(UNUM_IDENTITY_FALLBACK_SINGLE_VALUE,
- UNUM_IDENTITY_RESULT_NOT_EQUAL):
- formatRange(data, micros1, micros2, status);
- break;
-
- case identity2d(UNUM_IDENTITY_FALLBACK_APPROXIMATELY,
- UNUM_IDENTITY_RESULT_EQUAL_AFTER_ROUNDING):
- case identity2d(UNUM_IDENTITY_FALLBACK_APPROXIMATELY,
- UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING):
- case identity2d(UNUM_IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE,
- UNUM_IDENTITY_RESULT_EQUAL_AFTER_ROUNDING):
- formatApproximately(data, micros1, micros2, status);
- break;
-
- case identity2d(UNUM_IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE,
- UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING):
- case identity2d(UNUM_IDENTITY_FALLBACK_SINGLE_VALUE,
- UNUM_IDENTITY_RESULT_EQUAL_AFTER_ROUNDING):
- case identity2d(UNUM_IDENTITY_FALLBACK_SINGLE_VALUE,
- UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING):
- formatSingleValue(data, micros1, micros2, status);
- break;
-
- default:
- UPRV_UNREACHABLE;
- }
-}
-
-
-void NumberRangeFormatterImpl::formatSingleValue(UFormattedNumberRangeData& data,
- MicroProps& micros1, MicroProps& micros2,
- UErrorCode& status) const {
- if (U_FAILURE(status)) { return; }
- if (fSameFormatters) {
- int32_t length = NumberFormatterImpl::writeNumber(micros1, data.quantity1, data.getStringRef(), 0, status);
- NumberFormatterImpl::writeAffixes(micros1, data.getStringRef(), 0, length, status);
- } else {
- formatRange(data, micros1, micros2, status);
- }
-}
-
-
-void NumberRangeFormatterImpl::formatApproximately (UFormattedNumberRangeData& data,
- MicroProps& micros1, MicroProps& micros2,
- UErrorCode& status) const {
- if (U_FAILURE(status)) { return; }
- if (fSameFormatters) {
- int32_t length = NumberFormatterImpl::writeNumber(micros1, data.quantity1, data.getStringRef(), 0, status);
- // HEURISTIC: Desired modifier order: inner, middle, approximately, outer.
- length += micros1.modInner->apply(data.getStringRef(), 0, length, status);
- length += micros1.modMiddle->apply(data.getStringRef(), 0, length, status);
- length += fApproximatelyModifier.apply(data.getStringRef(), 0, length, status);
- micros1.modOuter->apply(data.getStringRef(), 0, length, status);
- } else {
- formatRange(data, micros1, micros2, status);
- }
-}
-
-
-void NumberRangeFormatterImpl::formatRange(UFormattedNumberRangeData& data,
- MicroProps& micros1, MicroProps& micros2,
- UErrorCode& status) const {
- if (U_FAILURE(status)) { return; }
-
- // modInner is always notation (scientific); collapsable in ALL.
- // modOuter is always units; collapsable in ALL, AUTO, and UNIT.
- // modMiddle could be either; collapsable in ALL and sometimes AUTO and UNIT.
- // Never collapse an outer mod but not an inner mod.
- bool collapseOuter, collapseMiddle, collapseInner;
- switch (fCollapse) {
- case UNUM_RANGE_COLLAPSE_ALL:
- case UNUM_RANGE_COLLAPSE_AUTO:
- case UNUM_RANGE_COLLAPSE_UNIT:
- {
- // OUTER MODIFIER
- collapseOuter = micros1.modOuter->semanticallyEquivalent(*micros2.modOuter);
-
- if (!collapseOuter) {
- // Never collapse inner mods if outer mods are not collapsable
- collapseMiddle = false;
- collapseInner = false;
- break;
- }
-
- // MIDDLE MODIFIER
- collapseMiddle = micros1.modMiddle->semanticallyEquivalent(*micros2.modMiddle);
-
- if (!collapseMiddle) {
- // Never collapse inner mods if outer mods are not collapsable
- collapseInner = false;
- break;
- }
-
- // MIDDLE MODIFIER HEURISTICS
- // (could disable collapsing of the middle modifier)
- // The modifiers are equal by this point, so we can look at just one of them.
- const Modifier* mm = micros1.modMiddle;
- if (fCollapse == UNUM_RANGE_COLLAPSE_UNIT) {
- // Only collapse if the modifier is a unit.
- // TODO: Make a better way to check for a unit?
- // TODO: Handle case where the modifier has both notation and unit (compact currency)?
- if (!mm->containsField({UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD})
- && !mm->containsField({UFIELD_CATEGORY_NUMBER, UNUM_PERCENT_FIELD})) {
- collapseMiddle = false;
- }
- } else if (fCollapse == UNUM_RANGE_COLLAPSE_AUTO) {
- // Heuristic as of ICU 63: collapse only if the modifier is more than one code point.
- if (mm->getCodePointCount() <= 1) {
- collapseMiddle = false;
- }
- }
-
- if (!collapseMiddle || fCollapse != UNUM_RANGE_COLLAPSE_ALL) {
- collapseInner = false;
- break;
- }
-
- // INNER MODIFIER
- collapseInner = micros1.modInner->semanticallyEquivalent(*micros2.modInner);
-
- // All done checking for collapsability.
- break;
- }
-
- default:
- collapseOuter = false;
- collapseMiddle = false;
- collapseInner = false;
- break;
- }
-
- FormattedStringBuilder& string = data.getStringRef();
- int32_t lengthPrefix = 0;
- int32_t length1 = 0;
- int32_t lengthInfix = 0;
- int32_t length2 = 0;
- int32_t lengthSuffix = 0;
-
- // Use #define so that these are evaluated at the call site.
- #define UPRV_INDEX_0 (lengthPrefix)
- #define UPRV_INDEX_1 (lengthPrefix + length1)
- #define UPRV_INDEX_2 (lengthPrefix + length1 + lengthInfix)
- #define UPRV_INDEX_3 (lengthPrefix + length1 + lengthInfix + length2)
-
- int32_t lengthRange = SimpleModifier::formatTwoArgPattern(
- fRangeFormatter,
- string,
- 0,
- &lengthPrefix,
- &lengthSuffix,
- kUndefinedField,
- status);
- if (U_FAILURE(status)) { return; }
- lengthInfix = lengthRange - lengthPrefix - lengthSuffix;
- U_ASSERT(lengthInfix > 0);
-
- // SPACING HEURISTIC
- // Add spacing unless all modifiers are collapsed.
- // TODO: add API to control this?
- // TODO: Use a data-driven heuristic like currency spacing?
- // TODO: Use Unicode [:whitespace:] instead of PatternProps whitespace? (consider speed implications)
- {
- bool repeatInner = !collapseInner && micros1.modInner->getCodePointCount() > 0;
- bool repeatMiddle = !collapseMiddle && micros1.modMiddle->getCodePointCount() > 0;
- bool repeatOuter = !collapseOuter && micros1.modOuter->getCodePointCount() > 0;
- if (repeatInner || repeatMiddle || repeatOuter) {
- // Add spacing if there is not already spacing
- if (!PatternProps::isWhiteSpace(string.charAt(UPRV_INDEX_1))) {
- lengthInfix += string.insertCodePoint(UPRV_INDEX_1, u'\u0020', kUndefinedField, status);
- }
- if (!PatternProps::isWhiteSpace(string.charAt(UPRV_INDEX_2 - 1))) {
- lengthInfix += string.insertCodePoint(UPRV_INDEX_2, u'\u0020', kUndefinedField, status);
- }
- }
- }
-
- length1 += NumberFormatterImpl::writeNumber(micros1, data.quantity1, string, UPRV_INDEX_0, status);
- length2 += NumberFormatterImpl::writeNumber(micros2, data.quantity2, string, UPRV_INDEX_2, status);
-
- // TODO: Support padding?
-
- if (collapseInner) {
- // Note: this is actually a mix of prefix and suffix, but adding to infix length works
- const Modifier& mod = resolveModifierPlurals(*micros1.modInner, *micros2.modInner);
- lengthInfix += mod.apply(string, UPRV_INDEX_0, UPRV_INDEX_3, status);
- } else {
- length1 += micros1.modInner->apply(string, UPRV_INDEX_0, UPRV_INDEX_1, status);
- length2 += micros2.modInner->apply(string, UPRV_INDEX_2, UPRV_INDEX_3, status);
- }
-
- if (collapseMiddle) {
- // Note: this is actually a mix of prefix and suffix, but adding to infix length works
- const Modifier& mod = resolveModifierPlurals(*micros1.modMiddle, *micros2.modMiddle);
- lengthInfix += mod.apply(string, UPRV_INDEX_0, UPRV_INDEX_3, status);
- } else {
- length1 += micros1.modMiddle->apply(string, UPRV_INDEX_0, UPRV_INDEX_1, status);
- length2 += micros2.modMiddle->apply(string, UPRV_INDEX_2, UPRV_INDEX_3, status);
- }
-
- if (collapseOuter) {
- // Note: this is actually a mix of prefix and suffix, but adding to infix length works
- const Modifier& mod = resolveModifierPlurals(*micros1.modOuter, *micros2.modOuter);
- lengthInfix += mod.apply(string, UPRV_INDEX_0, UPRV_INDEX_3, status);
- } else {
- length1 += micros1.modOuter->apply(string, UPRV_INDEX_0, UPRV_INDEX_1, status);
- length2 += micros2.modOuter->apply(string, UPRV_INDEX_2, UPRV_INDEX_3, status);
- }
-}
-
-
-const Modifier&
-NumberRangeFormatterImpl::resolveModifierPlurals(const Modifier& first, const Modifier& second) const {
- Modifier::Parameters parameters;
- first.getParameters(parameters);
- if (parameters.obj == nullptr) {
- // No plural form; return a fallback (e.g., the first)
- return first;
- }
- StandardPlural::Form firstPlural = parameters.plural;
-
- second.getParameters(parameters);
- if (parameters.obj == nullptr) {
- // No plural form; return a fallback (e.g., the first)
- return first;
- }
- StandardPlural::Form secondPlural = parameters.plural;
-
- // Get the required plural form from data
- StandardPlural::Form resultPlural = fPluralRanges.resolve(firstPlural, secondPlural);
-
- // Get and return the new Modifier
- const Modifier* mod = parameters.obj->getModifier(parameters.signum, resultPlural);
- U_ASSERT(mod != nullptr);
- return *mod;
-}
-
-
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include "unicode/numberrangeformatter.h"
+#include "numrange_impl.h"
+#include "patternprops.h"
+#include "uresimp.h"
+#include "util.h"
+
+using namespace icu;
+using namespace icu::number;
+using namespace icu::number::impl;
+
+namespace {
+
+// Helper function for 2-dimensional switch statement
+constexpr int8_t identity2d(UNumberRangeIdentityFallback a, UNumberRangeIdentityResult b) {
+ return static_cast<int8_t>(a) | (static_cast<int8_t>(b) << 4);
+}
+
+
+struct NumberRangeData {
+ SimpleFormatter rangePattern;
+ SimpleFormatter approximatelyPattern;
+};
+
+class NumberRangeDataSink : public ResourceSink {
+ public:
+ NumberRangeDataSink(NumberRangeData& data) : fData(data) {}
+
+ void put(const char* key, ResourceValue& value, UBool /*noFallback*/, UErrorCode& status) U_OVERRIDE {
+ ResourceTable miscTable = value.getTable(status);
+ if (U_FAILURE(status)) { return; }
+ for (int i = 0; miscTable.getKeyAndValue(i, key, value); i++) {
+ if (uprv_strcmp(key, "range") == 0) {
+ if (hasRangeData()) {
+ continue; // have already seen this pattern
+ }
+ fData.rangePattern = {value.getUnicodeString(status), status};
+ } else if (uprv_strcmp(key, "approximately") == 0) {
+ if (hasApproxData()) {
+ continue; // have already seen this pattern
+ }
+ fData.approximatelyPattern = {value.getUnicodeString(status), status};
+ }
+ }
+ }
+
+ bool hasRangeData() {
+ return fData.rangePattern.getArgumentLimit() != 0;
+ }
+
+ bool hasApproxData() {
+ return fData.approximatelyPattern.getArgumentLimit() != 0;
+ }
+
+ bool isComplete() {
+ return hasRangeData() && hasApproxData();
+ }
+
+ void fillInDefaults(UErrorCode& status) {
+ if (!hasRangeData()) {
+ fData.rangePattern = {u"{0}–{1}", status};
+ }
+ if (!hasApproxData()) {
+ fData.approximatelyPattern = {u"~{0}", status};
+ }
+ }
+
+ private:
+ NumberRangeData& fData;
+};
+
+void getNumberRangeData(const char* localeName, const char* nsName, NumberRangeData& data, UErrorCode& status) {
+ if (U_FAILURE(status)) { return; }
+ LocalUResourceBundlePointer rb(ures_open(NULL, localeName, &status));
+ if (U_FAILURE(status)) { return; }
+ NumberRangeDataSink sink(data);
+
+ CharString dataPath;
+ dataPath.append("NumberElements/", -1, status);
+ dataPath.append(nsName, -1, status);
+ dataPath.append("/miscPatterns", -1, status);
+ if (U_FAILURE(status)) { return; }
+
+ UErrorCode localStatus = U_ZERO_ERROR;
+ ures_getAllItemsWithFallback(rb.getAlias(), dataPath.data(), sink, localStatus);
+ if (U_FAILURE(localStatus) && localStatus != U_MISSING_RESOURCE_ERROR) {
+ status = localStatus;
+ return;
+ }
+
+ // Fall back to latn if necessary
+ if (!sink.isComplete()) {
+ ures_getAllItemsWithFallback(rb.getAlias(), "NumberElements/latn/miscPatterns", sink, status);
+ }
+
+ sink.fillInDefaults(status);
+}
+
+class PluralRangesDataSink : public ResourceSink {
+ public:
+ PluralRangesDataSink(StandardPluralRanges& output) : fOutput(output) {}
+
+ void put(const char* /*key*/, ResourceValue& value, UBool /*noFallback*/, UErrorCode& status) U_OVERRIDE {
+ ResourceArray entriesArray = value.getArray(status);
+ if (U_FAILURE(status)) { return; }
+ fOutput.setCapacity(entriesArray.getSize());
+ for (int i = 0; entriesArray.getValue(i, value); i++) {
+ ResourceArray pluralFormsArray = value.getArray(status);
+ if (U_FAILURE(status)) { return; }
+ pluralFormsArray.getValue(0, value);
+ StandardPlural::Form first = StandardPlural::fromString(value.getUnicodeString(status), status);
+ if (U_FAILURE(status)) { return; }
+ pluralFormsArray.getValue(1, value);
+ StandardPlural::Form second = StandardPlural::fromString(value.getUnicodeString(status), status);
+ if (U_FAILURE(status)) { return; }
+ pluralFormsArray.getValue(2, value);
+ StandardPlural::Form result = StandardPlural::fromString(value.getUnicodeString(status), status);
+ if (U_FAILURE(status)) { return; }
+ fOutput.addPluralRange(first, second, result);
+ }
+ }
+
+ private:
+ StandardPluralRanges& fOutput;
+};
+
+void getPluralRangesData(const Locale& locale, StandardPluralRanges& output, UErrorCode& status) {
+ if (U_FAILURE(status)) { return; }
+ LocalUResourceBundlePointer rb(ures_openDirect(nullptr, "pluralRanges", &status));
+ if (U_FAILURE(status)) { return; }
+
+ CharString dataPath;
+ dataPath.append("locales/", -1, status);
+ dataPath.append(locale.getLanguage(), -1, status);
+ if (U_FAILURE(status)) { return; }
+ int32_t setLen;
+ // Not all languages are covered: fail gracefully
+ UErrorCode internalStatus = U_ZERO_ERROR;
+ const UChar* set = ures_getStringByKeyWithFallback(rb.getAlias(), dataPath.data(), &setLen, &internalStatus);
+ if (U_FAILURE(internalStatus)) { return; }
+
+ dataPath.clear();
+ dataPath.append("rules/", -1, status);
+ dataPath.appendInvariantChars(set, setLen, status);
+ if (U_FAILURE(status)) { return; }
+ PluralRangesDataSink sink(output);
+ ures_getAllItemsWithFallback(rb.getAlias(), dataPath.data(), sink, status);
+ if (U_FAILURE(status)) { return; }
+}
+
+} // namespace
+
+
+void StandardPluralRanges::initialize(const Locale& locale, UErrorCode& status) {
+ getPluralRangesData(locale, *this, status);
+}
+
+void StandardPluralRanges::addPluralRange(
+ StandardPlural::Form first,
+ StandardPlural::Form second,
+ StandardPlural::Form result) {
+ U_ASSERT(fTriplesLen < fTriples.getCapacity());
+ fTriples[fTriplesLen] = {first, second, result};
+ fTriplesLen++;
+}
+
+void StandardPluralRanges::setCapacity(int32_t length) {
+ if (length > fTriples.getCapacity()) {
+ fTriples.resize(length, 0);
+ }
+}
+
+StandardPlural::Form
+StandardPluralRanges::resolve(StandardPlural::Form first, StandardPlural::Form second) const {
+ for (int32_t i=0; i<fTriplesLen; i++) {
+ const auto& triple = fTriples[i];
+ if (triple.first == first && triple.second == second) {
+ return triple.result;
+ }
+ }
+ // Default fallback
+ return StandardPlural::OTHER;
+}
+
+
+NumberRangeFormatterImpl::NumberRangeFormatterImpl(const RangeMacroProps& macros, UErrorCode& status)
+ : formatterImpl1(macros.formatter1.fMacros, status),
+ formatterImpl2(macros.formatter2.fMacros, status),
+ fSameFormatters(macros.singleFormatter),
+ fCollapse(macros.collapse),
+ fIdentityFallback(macros.identityFallback) {
+
+ const char* nsName = formatterImpl1.getRawMicroProps().nsName;
+ if (uprv_strcmp(nsName, formatterImpl2.getRawMicroProps().nsName) != 0) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+
+ NumberRangeData data;
+ getNumberRangeData(macros.locale.getName(), nsName, data, status);
+ if (U_FAILURE(status)) { return; }
+ fRangeFormatter = data.rangePattern;
+ fApproximatelyModifier = {data.approximatelyPattern, kUndefinedField, false};
+
+ // TODO: Get locale from PluralRules instead?
+ fPluralRanges.initialize(macros.locale, status);
+ if (U_FAILURE(status)) { return; }
+}
+
+void NumberRangeFormatterImpl::format(UFormattedNumberRangeData& data, bool equalBeforeRounding, UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ MicroProps micros1;
+ MicroProps micros2;
+ formatterImpl1.preProcess(data.quantity1, micros1, status);
+ if (fSameFormatters) {
+ formatterImpl1.preProcess(data.quantity2, micros2, status);
+ } else {
+ formatterImpl2.preProcess(data.quantity2, micros2, status);
+ }
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ // If any of the affixes are different, an identity is not possible
+ // and we must use formatRange().
+ // TODO: Write this as MicroProps operator==() ?
+ // TODO: Avoid the redundancy of these equality operations with the
+ // ones in formatRange?
+ if (!micros1.modInner->semanticallyEquivalent(*micros2.modInner)
+ || !micros1.modMiddle->semanticallyEquivalent(*micros2.modMiddle)
+ || !micros1.modOuter->semanticallyEquivalent(*micros2.modOuter)) {
+ formatRange(data, micros1, micros2, status);
+ data.identityResult = UNUM_IDENTITY_RESULT_NOT_EQUAL;
+ return;
+ }
+
+ // Check for identity
+ if (equalBeforeRounding) {
+ data.identityResult = UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING;
+ } else if (data.quantity1 == data.quantity2) {
+ data.identityResult = UNUM_IDENTITY_RESULT_EQUAL_AFTER_ROUNDING;
+ } else {
+ data.identityResult = UNUM_IDENTITY_RESULT_NOT_EQUAL;
+ }
+
+ switch (identity2d(fIdentityFallback, data.identityResult)) {
+ case identity2d(UNUM_IDENTITY_FALLBACK_RANGE,
+ UNUM_IDENTITY_RESULT_NOT_EQUAL):
+ case identity2d(UNUM_IDENTITY_FALLBACK_RANGE,
+ UNUM_IDENTITY_RESULT_EQUAL_AFTER_ROUNDING):
+ case identity2d(UNUM_IDENTITY_FALLBACK_RANGE,
+ UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING):
+ case identity2d(UNUM_IDENTITY_FALLBACK_APPROXIMATELY,
+ UNUM_IDENTITY_RESULT_NOT_EQUAL):
+ case identity2d(UNUM_IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE,
+ UNUM_IDENTITY_RESULT_NOT_EQUAL):
+ case identity2d(UNUM_IDENTITY_FALLBACK_SINGLE_VALUE,
+ UNUM_IDENTITY_RESULT_NOT_EQUAL):
+ formatRange(data, micros1, micros2, status);
+ break;
+
+ case identity2d(UNUM_IDENTITY_FALLBACK_APPROXIMATELY,
+ UNUM_IDENTITY_RESULT_EQUAL_AFTER_ROUNDING):
+ case identity2d(UNUM_IDENTITY_FALLBACK_APPROXIMATELY,
+ UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING):
+ case identity2d(UNUM_IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE,
+ UNUM_IDENTITY_RESULT_EQUAL_AFTER_ROUNDING):
+ formatApproximately(data, micros1, micros2, status);
+ break;
+
+ case identity2d(UNUM_IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE,
+ UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING):
+ case identity2d(UNUM_IDENTITY_FALLBACK_SINGLE_VALUE,
+ UNUM_IDENTITY_RESULT_EQUAL_AFTER_ROUNDING):
+ case identity2d(UNUM_IDENTITY_FALLBACK_SINGLE_VALUE,
+ UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING):
+ formatSingleValue(data, micros1, micros2, status);
+ break;
+
+ default:
+ UPRV_UNREACHABLE;
+ }
+}
+
+
+void NumberRangeFormatterImpl::formatSingleValue(UFormattedNumberRangeData& data,
+ MicroProps& micros1, MicroProps& micros2,
+ UErrorCode& status) const {
+ if (U_FAILURE(status)) { return; }
+ if (fSameFormatters) {
+ int32_t length = NumberFormatterImpl::writeNumber(micros1, data.quantity1, data.getStringRef(), 0, status);
+ NumberFormatterImpl::writeAffixes(micros1, data.getStringRef(), 0, length, status);
+ } else {
+ formatRange(data, micros1, micros2, status);
+ }
+}
+
+
+void NumberRangeFormatterImpl::formatApproximately (UFormattedNumberRangeData& data,
+ MicroProps& micros1, MicroProps& micros2,
+ UErrorCode& status) const {
+ if (U_FAILURE(status)) { return; }
+ if (fSameFormatters) {
+ int32_t length = NumberFormatterImpl::writeNumber(micros1, data.quantity1, data.getStringRef(), 0, status);
+ // HEURISTIC: Desired modifier order: inner, middle, approximately, outer.
+ length += micros1.modInner->apply(data.getStringRef(), 0, length, status);
+ length += micros1.modMiddle->apply(data.getStringRef(), 0, length, status);
+ length += fApproximatelyModifier.apply(data.getStringRef(), 0, length, status);
+ micros1.modOuter->apply(data.getStringRef(), 0, length, status);
+ } else {
+ formatRange(data, micros1, micros2, status);
+ }
+}
+
+
+void NumberRangeFormatterImpl::formatRange(UFormattedNumberRangeData& data,
+ MicroProps& micros1, MicroProps& micros2,
+ UErrorCode& status) const {
+ if (U_FAILURE(status)) { return; }
+
+ // modInner is always notation (scientific); collapsable in ALL.
+ // modOuter is always units; collapsable in ALL, AUTO, and UNIT.
+ // modMiddle could be either; collapsable in ALL and sometimes AUTO and UNIT.
+ // Never collapse an outer mod but not an inner mod.
+ bool collapseOuter, collapseMiddle, collapseInner;
+ switch (fCollapse) {
+ case UNUM_RANGE_COLLAPSE_ALL:
+ case UNUM_RANGE_COLLAPSE_AUTO:
+ case UNUM_RANGE_COLLAPSE_UNIT:
+ {
+ // OUTER MODIFIER
+ collapseOuter = micros1.modOuter->semanticallyEquivalent(*micros2.modOuter);
+
+ if (!collapseOuter) {
+ // Never collapse inner mods if outer mods are not collapsable
+ collapseMiddle = false;
+ collapseInner = false;
+ break;
+ }
+
+ // MIDDLE MODIFIER
+ collapseMiddle = micros1.modMiddle->semanticallyEquivalent(*micros2.modMiddle);
+
+ if (!collapseMiddle) {
+ // Never collapse inner mods if outer mods are not collapsable
+ collapseInner = false;
+ break;
+ }
+
+ // MIDDLE MODIFIER HEURISTICS
+ // (could disable collapsing of the middle modifier)
+ // The modifiers are equal by this point, so we can look at just one of them.
+ const Modifier* mm = micros1.modMiddle;
+ if (fCollapse == UNUM_RANGE_COLLAPSE_UNIT) {
+ // Only collapse if the modifier is a unit.
+ // TODO: Make a better way to check for a unit?
+ // TODO: Handle case where the modifier has both notation and unit (compact currency)?
+ if (!mm->containsField({UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD})
+ && !mm->containsField({UFIELD_CATEGORY_NUMBER, UNUM_PERCENT_FIELD})) {
+ collapseMiddle = false;
+ }
+ } else if (fCollapse == UNUM_RANGE_COLLAPSE_AUTO) {
+ // Heuristic as of ICU 63: collapse only if the modifier is more than one code point.
+ if (mm->getCodePointCount() <= 1) {
+ collapseMiddle = false;
+ }
+ }
+
+ if (!collapseMiddle || fCollapse != UNUM_RANGE_COLLAPSE_ALL) {
+ collapseInner = false;
+ break;
+ }
+
+ // INNER MODIFIER
+ collapseInner = micros1.modInner->semanticallyEquivalent(*micros2.modInner);
+
+ // All done checking for collapsability.
+ break;
+ }
+
+ default:
+ collapseOuter = false;
+ collapseMiddle = false;
+ collapseInner = false;
+ break;
+ }
+
+ FormattedStringBuilder& string = data.getStringRef();
+ int32_t lengthPrefix = 0;
+ int32_t length1 = 0;
+ int32_t lengthInfix = 0;
+ int32_t length2 = 0;
+ int32_t lengthSuffix = 0;
+
+ // Use #define so that these are evaluated at the call site.
+ #define UPRV_INDEX_0 (lengthPrefix)
+ #define UPRV_INDEX_1 (lengthPrefix + length1)
+ #define UPRV_INDEX_2 (lengthPrefix + length1 + lengthInfix)
+ #define UPRV_INDEX_3 (lengthPrefix + length1 + lengthInfix + length2)
+
+ int32_t lengthRange = SimpleModifier::formatTwoArgPattern(
+ fRangeFormatter,
+ string,
+ 0,
+ &lengthPrefix,
+ &lengthSuffix,
+ kUndefinedField,
+ status);
+ if (U_FAILURE(status)) { return; }
+ lengthInfix = lengthRange - lengthPrefix - lengthSuffix;
+ U_ASSERT(lengthInfix > 0);
+
+ // SPACING HEURISTIC
+ // Add spacing unless all modifiers are collapsed.
+ // TODO: add API to control this?
+ // TODO: Use a data-driven heuristic like currency spacing?
+ // TODO: Use Unicode [:whitespace:] instead of PatternProps whitespace? (consider speed implications)
+ {
+ bool repeatInner = !collapseInner && micros1.modInner->getCodePointCount() > 0;
+ bool repeatMiddle = !collapseMiddle && micros1.modMiddle->getCodePointCount() > 0;
+ bool repeatOuter = !collapseOuter && micros1.modOuter->getCodePointCount() > 0;
+ if (repeatInner || repeatMiddle || repeatOuter) {
+ // Add spacing if there is not already spacing
+ if (!PatternProps::isWhiteSpace(string.charAt(UPRV_INDEX_1))) {
+ lengthInfix += string.insertCodePoint(UPRV_INDEX_1, u'\u0020', kUndefinedField, status);
+ }
+ if (!PatternProps::isWhiteSpace(string.charAt(UPRV_INDEX_2 - 1))) {
+ lengthInfix += string.insertCodePoint(UPRV_INDEX_2, u'\u0020', kUndefinedField, status);
+ }
+ }
+ }
+
+ length1 += NumberFormatterImpl::writeNumber(micros1, data.quantity1, string, UPRV_INDEX_0, status);
+ length2 += NumberFormatterImpl::writeNumber(micros2, data.quantity2, string, UPRV_INDEX_2, status);
+
+ // TODO: Support padding?
+
+ if (collapseInner) {
+ // Note: this is actually a mix of prefix and suffix, but adding to infix length works
+ const Modifier& mod = resolveModifierPlurals(*micros1.modInner, *micros2.modInner);
+ lengthInfix += mod.apply(string, UPRV_INDEX_0, UPRV_INDEX_3, status);
+ } else {
+ length1 += micros1.modInner->apply(string, UPRV_INDEX_0, UPRV_INDEX_1, status);
+ length2 += micros2.modInner->apply(string, UPRV_INDEX_2, UPRV_INDEX_3, status);
+ }
+
+ if (collapseMiddle) {
+ // Note: this is actually a mix of prefix and suffix, but adding to infix length works
+ const Modifier& mod = resolveModifierPlurals(*micros1.modMiddle, *micros2.modMiddle);
+ lengthInfix += mod.apply(string, UPRV_INDEX_0, UPRV_INDEX_3, status);
+ } else {
+ length1 += micros1.modMiddle->apply(string, UPRV_INDEX_0, UPRV_INDEX_1, status);
+ length2 += micros2.modMiddle->apply(string, UPRV_INDEX_2, UPRV_INDEX_3, status);
+ }
+
+ if (collapseOuter) {
+ // Note: this is actually a mix of prefix and suffix, but adding to infix length works
+ const Modifier& mod = resolveModifierPlurals(*micros1.modOuter, *micros2.modOuter);
+ lengthInfix += mod.apply(string, UPRV_INDEX_0, UPRV_INDEX_3, status);
+ } else {
+ length1 += micros1.modOuter->apply(string, UPRV_INDEX_0, UPRV_INDEX_1, status);
+ length2 += micros2.modOuter->apply(string, UPRV_INDEX_2, UPRV_INDEX_3, status);
+ }
+}
+
+
+const Modifier&
+NumberRangeFormatterImpl::resolveModifierPlurals(const Modifier& first, const Modifier& second) const {
+ Modifier::Parameters parameters;
+ first.getParameters(parameters);
+ if (parameters.obj == nullptr) {
+ // No plural form; return a fallback (e.g., the first)
+ return first;
+ }
+ StandardPlural::Form firstPlural = parameters.plural;
+
+ second.getParameters(parameters);
+ if (parameters.obj == nullptr) {
+ // No plural form; return a fallback (e.g., the first)
+ return first;
+ }
+ StandardPlural::Form secondPlural = parameters.plural;
+
+ // Get the required plural form from data
+ StandardPlural::Form resultPlural = fPluralRanges.resolve(firstPlural, secondPlural);
+
+ // Get and return the new Modifier
+ const Modifier* mod = parameters.obj->getModifier(parameters.signum, resultPlural);
+ U_ASSERT(mod != nullptr);
+ return *mod;
+}
+
+
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numrange_impl.h b/contrib/libs/icu/i18n/numrange_impl.h
index de1f8848de..8f4c8a40ba 100644
--- a/contrib/libs/icu/i18n/numrange_impl.h
+++ b/contrib/libs/icu/i18n/numrange_impl.h
@@ -1,113 +1,113 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __SOURCE_NUMRANGE_TYPES_H__
-#define __SOURCE_NUMRANGE_TYPES_H__
-
-#include "unicode/numberformatter.h"
-#include "unicode/numberrangeformatter.h"
-#include "unicode/simpleformatter.h"
-#include "number_types.h"
-#include "number_decimalquantity.h"
-#include "number_formatimpl.h"
-#include "formatted_string_builder.h"
-#include "formattedval_impl.h"
-
-U_NAMESPACE_BEGIN namespace number {
-namespace impl {
-
-
-/**
- * Class similar to UFormattedNumberData.
- *
- * Has incomplete magic number logic that will need to be finished
- * if this is to be exposed as C API in the future.
- *
- * Possible magic number: 0x46445200
- * Reads in ASCII as "FDR" (FormatteDnumberRange with room at the end)
- */
-class UFormattedNumberRangeData : public FormattedValueStringBuilderImpl {
-public:
- UFormattedNumberRangeData() : FormattedValueStringBuilderImpl(kUndefinedField) {}
- virtual ~UFormattedNumberRangeData();
-
- DecimalQuantity quantity1;
- DecimalQuantity quantity2;
- UNumberRangeIdentityResult identityResult = UNUM_IDENTITY_RESULT_COUNT;
-};
-
-
-class StandardPluralRanges : public UMemory {
- public:
- void initialize(const Locale& locale, UErrorCode& status);
- StandardPlural::Form resolve(StandardPlural::Form first, StandardPlural::Form second) const;
-
- /** Used for data loading. */
- void addPluralRange(
- StandardPlural::Form first,
- StandardPlural::Form second,
- StandardPlural::Form result);
-
- /** Used for data loading. */
- void setCapacity(int32_t length);
-
- private:
- struct StandardPluralRangeTriple {
- StandardPlural::Form first;
- StandardPlural::Form second;
- StandardPlural::Form result;
- };
-
- // TODO: An array is simple here, but it results in linear lookup time.
- // Certain locales have 20-30 entries in this list.
- // Consider changing to a smarter data structure.
- typedef MaybeStackArray<StandardPluralRangeTriple, 3> PluralRangeTriples;
- PluralRangeTriples fTriples;
- int32_t fTriplesLen = 0;
-};
-
-
-class NumberRangeFormatterImpl : public UMemory {
- public:
- NumberRangeFormatterImpl(const RangeMacroProps& macros, UErrorCode& status);
-
- void format(UFormattedNumberRangeData& data, bool equalBeforeRounding, UErrorCode& status) const;
-
- private:
- NumberFormatterImpl formatterImpl1;
- NumberFormatterImpl formatterImpl2;
- bool fSameFormatters;
-
- UNumberRangeCollapse fCollapse;
- UNumberRangeIdentityFallback fIdentityFallback;
-
- SimpleFormatter fRangeFormatter;
- SimpleModifier fApproximatelyModifier;
-
- StandardPluralRanges fPluralRanges;
-
- void formatSingleValue(UFormattedNumberRangeData& data,
- MicroProps& micros1, MicroProps& micros2,
- UErrorCode& status) const;
-
- void formatApproximately(UFormattedNumberRangeData& data,
- MicroProps& micros1, MicroProps& micros2,
- UErrorCode& status) const;
-
- void formatRange(UFormattedNumberRangeData& data,
- MicroProps& micros1, MicroProps& micros2,
- UErrorCode& status) const;
-
- const Modifier& resolveModifierPlurals(const Modifier& first, const Modifier& second) const;
-};
-
-
-} // namespace impl
-} // namespace number
-U_NAMESPACE_END
-
-#endif //__SOURCE_NUMRANGE_TYPES_H__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __SOURCE_NUMRANGE_TYPES_H__
+#define __SOURCE_NUMRANGE_TYPES_H__
+
+#include "unicode/numberformatter.h"
+#include "unicode/numberrangeformatter.h"
+#include "unicode/simpleformatter.h"
+#include "number_types.h"
+#include "number_decimalquantity.h"
+#include "number_formatimpl.h"
+#include "formatted_string_builder.h"
+#include "formattedval_impl.h"
+
+U_NAMESPACE_BEGIN namespace number {
+namespace impl {
+
+
+/**
+ * Class similar to UFormattedNumberData.
+ *
+ * Has incomplete magic number logic that will need to be finished
+ * if this is to be exposed as C API in the future.
+ *
+ * Possible magic number: 0x46445200
+ * Reads in ASCII as "FDR" (FormatteDnumberRange with room at the end)
+ */
+class UFormattedNumberRangeData : public FormattedValueStringBuilderImpl {
+public:
+ UFormattedNumberRangeData() : FormattedValueStringBuilderImpl(kUndefinedField) {}
+ virtual ~UFormattedNumberRangeData();
+
+ DecimalQuantity quantity1;
+ DecimalQuantity quantity2;
+ UNumberRangeIdentityResult identityResult = UNUM_IDENTITY_RESULT_COUNT;
+};
+
+
+class StandardPluralRanges : public UMemory {
+ public:
+ void initialize(const Locale& locale, UErrorCode& status);
+ StandardPlural::Form resolve(StandardPlural::Form first, StandardPlural::Form second) const;
+
+ /** Used for data loading. */
+ void addPluralRange(
+ StandardPlural::Form first,
+ StandardPlural::Form second,
+ StandardPlural::Form result);
+
+ /** Used for data loading. */
+ void setCapacity(int32_t length);
+
+ private:
+ struct StandardPluralRangeTriple {
+ StandardPlural::Form first;
+ StandardPlural::Form second;
+ StandardPlural::Form result;
+ };
+
+ // TODO: An array is simple here, but it results in linear lookup time.
+ // Certain locales have 20-30 entries in this list.
+ // Consider changing to a smarter data structure.
+ typedef MaybeStackArray<StandardPluralRangeTriple, 3> PluralRangeTriples;
+ PluralRangeTriples fTriples;
+ int32_t fTriplesLen = 0;
+};
+
+
+class NumberRangeFormatterImpl : public UMemory {
+ public:
+ NumberRangeFormatterImpl(const RangeMacroProps& macros, UErrorCode& status);
+
+ void format(UFormattedNumberRangeData& data, bool equalBeforeRounding, UErrorCode& status) const;
+
+ private:
+ NumberFormatterImpl formatterImpl1;
+ NumberFormatterImpl formatterImpl2;
+ bool fSameFormatters;
+
+ UNumberRangeCollapse fCollapse;
+ UNumberRangeIdentityFallback fIdentityFallback;
+
+ SimpleFormatter fRangeFormatter;
+ SimpleModifier fApproximatelyModifier;
+
+ StandardPluralRanges fPluralRanges;
+
+ void formatSingleValue(UFormattedNumberRangeData& data,
+ MicroProps& micros1, MicroProps& micros2,
+ UErrorCode& status) const;
+
+ void formatApproximately(UFormattedNumberRangeData& data,
+ MicroProps& micros1, MicroProps& micros2,
+ UErrorCode& status) const;
+
+ void formatRange(UFormattedNumberRangeData& data,
+ MicroProps& micros1, MicroProps& micros2,
+ UErrorCode& status) const;
+
+ const Modifier& resolveModifierPlurals(const Modifier& first, const Modifier& second) const;
+};
+
+
+} // namespace impl
+} // namespace number
+U_NAMESPACE_END
+
+#endif //__SOURCE_NUMRANGE_TYPES_H__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/numsys.cpp b/contrib/libs/icu/i18n/numsys.cpp
index aaae821e98..62d555aad2 100644
--- a/contrib/libs/icu/i18n/numsys.cpp
+++ b/contrib/libs/icu/i18n/numsys.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -25,9 +25,9 @@
#include "unicode/schriter.h"
#include "unicode/numsys.h"
#include "cstring.h"
-#include "uassert.h"
-#include "ucln_in.h"
-#include "umutex.h"
+#include "uassert.h"
+#include "ucln_in.h"
+#include "umutex.h"
#include "uresimp.h"
#include "numsys_impl.h"
@@ -37,7 +37,7 @@ U_NAMESPACE_BEGIN
// Useful constants
-#define DEFAULT_DIGITS UNICODE_STRING_SIMPLE("0123456789")
+#define DEFAULT_DIGITS UNICODE_STRING_SIMPLE("0123456789")
static const char gNumberingSystems[] = "numberingSystems";
static const char gNumberElements[] = "NumberElements";
static const char gDefault[] = "default";
@@ -81,82 +81,82 @@ NumberingSystem* U_EXPORT2
NumberingSystem::createInstance(int32_t radix_in, UBool isAlgorithmic_in, const UnicodeString & desc_in, UErrorCode &status) {
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
if ( radix_in < 2 ) {
status = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
+ return nullptr;
}
if ( !isAlgorithmic_in ) {
if ( desc_in.countChar32() != radix_in ) {
status = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
+ return nullptr;
}
}
- LocalPointer<NumberingSystem> ns(new NumberingSystem(), status);
- if (U_FAILURE(status)) {
- return nullptr;
- }
+ LocalPointer<NumberingSystem> ns(new NumberingSystem(), status);
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
ns->setRadix(radix_in);
ns->setDesc(desc_in);
ns->setAlgorithmic(isAlgorithmic_in);
- ns->setName(nullptr);
-
- return ns.orphan();
+ ns->setName(nullptr);
+
+ return ns.orphan();
}
NumberingSystem* U_EXPORT2
NumberingSystem::createInstance(const Locale & inLocale, UErrorCode& status) {
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
UBool nsResolved = TRUE;
UBool usingFallback = FALSE;
- char buffer[ULOC_KEYWORDS_CAPACITY] = "";
- int32_t count = inLocale.getKeywordValue("numbers", buffer, sizeof(buffer), status);
- if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING) {
- // the "numbers" keyword exceeds ULOC_KEYWORDS_CAPACITY; ignore and use default.
- count = 0;
- status = U_ZERO_ERROR;
- }
+ char buffer[ULOC_KEYWORDS_CAPACITY] = "";
+ int32_t count = inLocale.getKeywordValue("numbers", buffer, sizeof(buffer), status);
+ if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING) {
+ // the "numbers" keyword exceeds ULOC_KEYWORDS_CAPACITY; ignore and use default.
+ count = 0;
+ status = U_ZERO_ERROR;
+ }
if ( count > 0 ) { // @numbers keyword was specified in the locale
- U_ASSERT(count < ULOC_KEYWORDS_CAPACITY);
+ U_ASSERT(count < ULOC_KEYWORDS_CAPACITY);
buffer[count] = '\0'; // Make sure it is null terminated.
if ( !uprv_strcmp(buffer,gDefault) || !uprv_strcmp(buffer,gNative) ||
!uprv_strcmp(buffer,gTraditional) || !uprv_strcmp(buffer,gFinance)) {
nsResolved = FALSE;
}
} else {
- uprv_strcpy(buffer, gDefault);
+ uprv_strcpy(buffer, gDefault);
nsResolved = FALSE;
}
if (!nsResolved) { // Resolve the numbering system ( default, native, traditional or finance ) into a "real" numbering system
UErrorCode localStatus = U_ZERO_ERROR;
- LocalUResourceBundlePointer resource(ures_open(nullptr, inLocale.getName(), &localStatus));
- LocalUResourceBundlePointer numberElementsRes(ures_getByKey(resource.getAlias(), gNumberElements, nullptr, &localStatus));
- // Don't stomp on the catastrophic failure of OOM.
- if (localStatus == U_MEMORY_ALLOCATION_ERROR) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
+ LocalUResourceBundlePointer resource(ures_open(nullptr, inLocale.getName(), &localStatus));
+ LocalUResourceBundlePointer numberElementsRes(ures_getByKey(resource.getAlias(), gNumberElements, nullptr, &localStatus));
+ // Don't stomp on the catastrophic failure of OOM.
+ if (localStatus == U_MEMORY_ALLOCATION_ERROR) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
while (!nsResolved) {
localStatus = U_ZERO_ERROR;
count = 0;
- const UChar *nsName = ures_getStringByKeyWithFallback(numberElementsRes.getAlias(), buffer, &count, &localStatus);
- // Don't stomp on the catastrophic failure of OOM.
- if (localStatus == U_MEMORY_ALLOCATION_ERROR) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
+ const UChar *nsName = ures_getStringByKeyWithFallback(numberElementsRes.getAlias(), buffer, &count, &localStatus);
+ // Don't stomp on the catastrophic failure of OOM.
+ if (localStatus == U_MEMORY_ALLOCATION_ERROR) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
if ( count > 0 && count < ULOC_KEYWORDS_CAPACITY ) { // numbering system found
- u_UCharsToChars(nsName, buffer, count);
+ u_UCharsToChars(nsName, buffer, count);
buffer[count] = '\0'; // Make sure it is null terminated.
nsResolved = TRUE;
}
@@ -177,12 +177,12 @@ NumberingSystem::createInstance(const Locale & inLocale, UErrorCode& status) {
if (usingFallback) {
status = U_USING_FALLBACK_WARNING;
NumberingSystem *ns = new NumberingSystem();
- if (ns == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
+ if (ns == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
return ns;
} else {
- return NumberingSystem::createInstanceByName(buffer, status);
+ return NumberingSystem::createInstanceByName(buffer, status);
}
}
@@ -196,34 +196,34 @@ NumberingSystem::createInstanceByName(const char *name, UErrorCode& status) {
int32_t radix = 10;
int32_t algorithmic = 0;
- LocalUResourceBundlePointer numberingSystemsInfo(ures_openDirect(nullptr, gNumberingSystems, &status));
- LocalUResourceBundlePointer nsCurrent(ures_getByKey(numberingSystemsInfo.getAlias(), gNumberingSystems, nullptr, &status));
- LocalUResourceBundlePointer nsTop(ures_getByKey(nsCurrent.getAlias(), name, nullptr, &status));
+ LocalUResourceBundlePointer numberingSystemsInfo(ures_openDirect(nullptr, gNumberingSystems, &status));
+ LocalUResourceBundlePointer nsCurrent(ures_getByKey(numberingSystemsInfo.getAlias(), gNumberingSystems, nullptr, &status));
+ LocalUResourceBundlePointer nsTop(ures_getByKey(nsCurrent.getAlias(), name, nullptr, &status));
+
+ UnicodeString nsd = ures_getUnicodeStringByKey(nsTop.getAlias(), gDesc, &status);
- UnicodeString nsd = ures_getUnicodeStringByKey(nsTop.getAlias(), gDesc, &status);
+ ures_getByKey(nsTop.getAlias(), gRadix, nsCurrent.getAlias(), &status);
+ radix = ures_getInt(nsCurrent.getAlias(), &status);
- ures_getByKey(nsTop.getAlias(), gRadix, nsCurrent.getAlias(), &status);
- radix = ures_getInt(nsCurrent.getAlias(), &status);
+ ures_getByKey(nsTop.getAlias(), gAlgorithmic, nsCurrent.getAlias(), &status);
+ algorithmic = ures_getInt(nsCurrent.getAlias(), &status);
- ures_getByKey(nsTop.getAlias(), gAlgorithmic, nsCurrent.getAlias(), &status);
- algorithmic = ures_getInt(nsCurrent.getAlias(), &status);
-
UBool isAlgorithmic = ( algorithmic == 1 );
- if (U_FAILURE(status)) {
- // Don't stomp on the catastrophic failure of OOM.
- if (status != U_MEMORY_ALLOCATION_ERROR) {
- status = U_UNSUPPORTED_ERROR;
- }
- return nullptr;
- }
+ if (U_FAILURE(status)) {
+ // Don't stomp on the catastrophic failure of OOM.
+ if (status != U_MEMORY_ALLOCATION_ERROR) {
+ status = U_UNSUPPORTED_ERROR;
+ }
+ return nullptr;
+ }
- LocalPointer<NumberingSystem> ns(NumberingSystem::createInstance(radix, isAlgorithmic, nsd, status), status);
+ LocalPointer<NumberingSystem> ns(NumberingSystem::createInstance(radix, isAlgorithmic, nsd, status), status);
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
ns->setName(name);
- return ns.orphan();
+ return ns.orphan();
}
/**
@@ -253,99 +253,99 @@ void NumberingSystem::setAlgorithmic(UBool c) {
algorithmic = c;
}
-void NumberingSystem::setDesc(const UnicodeString &d) {
+void NumberingSystem::setDesc(const UnicodeString &d) {
desc.setTo(d);
}
void NumberingSystem::setName(const char *n) {
- if ( n == nullptr ) {
+ if ( n == nullptr ) {
name[0] = (char) 0;
} else {
- uprv_strncpy(name,n,kInternalNumSysNameCapacity);
- name[kInternalNumSysNameCapacity] = '\0'; // Make sure it is null terminated.
+ uprv_strncpy(name,n,kInternalNumSysNameCapacity);
+ name[kInternalNumSysNameCapacity] = '\0'; // Make sure it is null terminated.
}
}
UBool NumberingSystem::isAlgorithmic() const {
return ( algorithmic );
}
-namespace {
-
-UVector* gNumsysNames = nullptr;
-UInitOnce gNumSysInitOnce = U_INITONCE_INITIALIZER;
-
-U_CFUNC UBool U_CALLCONV numSysCleanup() {
- delete gNumsysNames;
- gNumsysNames = nullptr;
- gNumSysInitOnce.reset();
- return true;
-}
-
-U_CFUNC void initNumsysNames(UErrorCode &status) {
- U_ASSERT(gNumsysNames == nullptr);
- ucln_i18n_registerCleanup(UCLN_I18N_NUMSYS, numSysCleanup);
-
- // TODO: Simple array of UnicodeString objects, based on length of table resource?
- LocalPointer<UVector> numsysNames(new UVector(uprv_deleteUObject, nullptr, status), status);
+namespace {
+
+UVector* gNumsysNames = nullptr;
+UInitOnce gNumSysInitOnce = U_INITONCE_INITIALIZER;
+
+U_CFUNC UBool U_CALLCONV numSysCleanup() {
+ delete gNumsysNames;
+ gNumsysNames = nullptr;
+ gNumSysInitOnce.reset();
+ return true;
+}
+
+U_CFUNC void initNumsysNames(UErrorCode &status) {
+ U_ASSERT(gNumsysNames == nullptr);
+ ucln_i18n_registerCleanup(UCLN_I18N_NUMSYS, numSysCleanup);
+
+ // TODO: Simple array of UnicodeString objects, based on length of table resource?
+ LocalPointer<UVector> numsysNames(new UVector(uprv_deleteUObject, nullptr, status), status);
if (U_FAILURE(status)) {
- return;
+ return;
}
- UErrorCode rbstatus = U_ZERO_ERROR;
- UResourceBundle *numberingSystemsInfo = ures_openDirect(nullptr, "numberingSystems", &rbstatus);
- numberingSystemsInfo =
- ures_getByKey(numberingSystemsInfo, "numberingSystems", numberingSystemsInfo, &rbstatus);
- if (U_FAILURE(rbstatus)) {
- // Don't stomp on the catastrophic failure of OOM.
- if (rbstatus == U_MEMORY_ALLOCATION_ERROR) {
- status = rbstatus;
- } else {
+ UErrorCode rbstatus = U_ZERO_ERROR;
+ UResourceBundle *numberingSystemsInfo = ures_openDirect(nullptr, "numberingSystems", &rbstatus);
+ numberingSystemsInfo =
+ ures_getByKey(numberingSystemsInfo, "numberingSystems", numberingSystemsInfo, &rbstatus);
+ if (U_FAILURE(rbstatus)) {
+ // Don't stomp on the catastrophic failure of OOM.
+ if (rbstatus == U_MEMORY_ALLOCATION_ERROR) {
+ status = rbstatus;
+ } else {
status = U_MISSING_RESOURCE_ERROR;
}
- ures_close(numberingSystemsInfo);
- return;
- }
-
- while ( ures_hasNext(numberingSystemsInfo) && U_SUCCESS(status) ) {
- LocalUResourceBundlePointer nsCurrent(ures_getNextResource(numberingSystemsInfo, nullptr, &rbstatus));
- if (rbstatus == U_MEMORY_ALLOCATION_ERROR) {
- status = rbstatus; // we want to report OOM failure back to the caller.
- break;
+ ures_close(numberingSystemsInfo);
+ return;
+ }
+
+ while ( ures_hasNext(numberingSystemsInfo) && U_SUCCESS(status) ) {
+ LocalUResourceBundlePointer nsCurrent(ures_getNextResource(numberingSystemsInfo, nullptr, &rbstatus));
+ if (rbstatus == U_MEMORY_ALLOCATION_ERROR) {
+ status = rbstatus; // we want to report OOM failure back to the caller.
+ break;
}
- const char *nsName = ures_getKey(nsCurrent.getAlias());
- LocalPointer<UnicodeString> newElem(new UnicodeString(nsName, -1, US_INV), status);
- if (U_SUCCESS(status)) {
- numsysNames->addElement(newElem.getAlias(), status);
- if (U_SUCCESS(status)) {
- newElem.orphan(); // on success, the numsysNames vector owns newElem.
- }
+ const char *nsName = ures_getKey(nsCurrent.getAlias());
+ LocalPointer<UnicodeString> newElem(new UnicodeString(nsName, -1, US_INV), status);
+ if (U_SUCCESS(status)) {
+ numsysNames->addElement(newElem.getAlias(), status);
+ if (U_SUCCESS(status)) {
+ newElem.orphan(); // on success, the numsysNames vector owns newElem.
+ }
}
}
- ures_close(numberingSystemsInfo);
- if (U_SUCCESS(status)) {
- gNumsysNames = numsysNames.orphan();
- }
- return;
+ ures_close(numberingSystemsInfo);
+ if (U_SUCCESS(status)) {
+ gNumsysNames = numsysNames.orphan();
+ }
+ return;
+}
+
+} // end anonymous namespace
+
+StringEnumeration* NumberingSystem::getAvailableNames(UErrorCode &status) {
+ umtx_initOnce(gNumSysInitOnce, &initNumsysNames, status);
+ LocalPointer<StringEnumeration> result(new NumsysNameEnumeration(status), status);
+ return result.orphan();
}
-} // end anonymous namespace
-
-StringEnumeration* NumberingSystem::getAvailableNames(UErrorCode &status) {
- umtx_initOnce(gNumSysInitOnce, &initNumsysNames, status);
- LocalPointer<StringEnumeration> result(new NumsysNameEnumeration(status), status);
- return result.orphan();
+NumsysNameEnumeration::NumsysNameEnumeration(UErrorCode& status) : pos(0) {
+ (void)status;
}
-NumsysNameEnumeration::NumsysNameEnumeration(UErrorCode& status) : pos(0) {
- (void)status;
-}
-
const UnicodeString*
NumsysNameEnumeration::snext(UErrorCode& status) {
- if (U_SUCCESS(status) && (gNumsysNames != nullptr) && (pos < gNumsysNames->size())) {
- return (const UnicodeString*)gNumsysNames->elementAt(pos++);
+ if (U_SUCCESS(status) && (gNumsysNames != nullptr) && (pos < gNumsysNames->size())) {
+ return (const UnicodeString*)gNumsysNames->elementAt(pos++);
}
- return nullptr;
+ return nullptr;
}
void
@@ -355,7 +355,7 @@ NumsysNameEnumeration::reset(UErrorCode& /*status*/) {
int32_t
NumsysNameEnumeration::count(UErrorCode& /*status*/) const {
- return (gNumsysNames==nullptr) ? 0 : gNumsysNames->size();
+ return (gNumsysNames==nullptr) ? 0 : gNumsysNames->size();
}
NumsysNameEnumeration::~NumsysNameEnumeration() {
diff --git a/contrib/libs/icu/i18n/numsys_impl.h b/contrib/libs/icu/i18n/numsys_impl.h
index e47b0c73fe..e76e634dd2 100644
--- a/contrib/libs/icu/i18n/numsys_impl.h
+++ b/contrib/libs/icu/i18n/numsys_impl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -26,14 +26,14 @@ U_NAMESPACE_BEGIN
class NumsysNameEnumeration : public StringEnumeration {
public:
- NumsysNameEnumeration(UErrorCode& status);
+ NumsysNameEnumeration(UErrorCode& status);
virtual ~NumsysNameEnumeration();
static UClassID U_EXPORT2 getStaticClassID(void);
- virtual UClassID getDynamicClassID(void) const override;
- virtual const UnicodeString* snext(UErrorCode& status) override;
- virtual void reset(UErrorCode& status) override;
- virtual int32_t count(UErrorCode& status) const override;
+ virtual UClassID getDynamicClassID(void) const override;
+ virtual const UnicodeString* snext(UErrorCode& status) override;
+ virtual void reset(UErrorCode& status) override;
+ virtual int32_t count(UErrorCode& status) const override;
private:
int32_t pos;
};
diff --git a/contrib/libs/icu/i18n/olsontz.cpp b/contrib/libs/icu/i18n/olsontz.cpp
index eb7b91bb6e..d21e6e9929 100644
--- a/contrib/libs/icu/i18n/olsontz.cpp
+++ b/contrib/libs/icu/i18n/olsontz.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -25,7 +25,7 @@
#include "uassert.h"
#include "uvector.h"
#include <float.h> // DBL_MAX
-#include "uresimp.h"
+#include "uresimp.h"
#include "zonemeta.h"
#include "umutex.h"
@@ -134,12 +134,12 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
// setID(ures_getKey((UResourceBundle*) res)); // cast away const
int32_t len;
- StackUResourceBundle r;
+ StackUResourceBundle r;
// Pre-32bit second transitions
- ures_getByKey(res, kTRANSPRE32, r.getAlias(), &ec);
- transitionTimesPre32 = ures_getIntVector(r.getAlias(), &len, &ec);
- transitionCountPre32 = static_cast<int16_t>(len >> 1);
+ ures_getByKey(res, kTRANSPRE32, r.getAlias(), &ec);
+ transitionTimesPre32 = ures_getIntVector(r.getAlias(), &len, &ec);
+ transitionCountPre32 = static_cast<int16_t>(len >> 1);
if (ec == U_MISSING_RESOURCE_ERROR) {
// No pre-32bit transitions
transitionTimesPre32 = NULL;
@@ -150,9 +150,9 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
}
// 32bit second transitions
- ures_getByKey(res, kTRANS, r.getAlias(), &ec);
- transitionTimes32 = ures_getIntVector(r.getAlias(), &len, &ec);
- transitionCount32 = static_cast<int16_t>(len);
+ ures_getByKey(res, kTRANS, r.getAlias(), &ec);
+ transitionTimes32 = ures_getIntVector(r.getAlias(), &len, &ec);
+ transitionCount32 = static_cast<int16_t>(len);
if (ec == U_MISSING_RESOURCE_ERROR) {
// No 32bit transitions
transitionTimes32 = NULL;
@@ -163,9 +163,9 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
}
// Post-32bit second transitions
- ures_getByKey(res, kTRANSPOST32, r.getAlias(), &ec);
- transitionTimesPost32 = ures_getIntVector(r.getAlias(), &len, &ec);
- transitionCountPost32 = static_cast<int16_t>(len >> 1);
+ ures_getByKey(res, kTRANSPOST32, r.getAlias(), &ec);
+ transitionTimesPost32 = ures_getIntVector(r.getAlias(), &len, &ec);
+ transitionCountPost32 = static_cast<int16_t>(len >> 1);
if (ec == U_MISSING_RESOURCE_ERROR) {
// No pre-32bit transitions
transitionTimesPost32 = NULL;
@@ -176,8 +176,8 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
}
// Type offsets list must be of even size, with size >= 2
- ures_getByKey(res, kTYPEOFFSETS, r.getAlias(), &ec);
- typeOffsets = ures_getIntVector(r.getAlias(), &len, &ec);
+ ures_getByKey(res, kTYPEOFFSETS, r.getAlias(), &ec);
+ typeOffsets = ures_getIntVector(r.getAlias(), &len, &ec);
if (U_SUCCESS(ec) && (len < 2 || len > 0x7FFE || (len & 1) != 0)) {
ec = U_INVALID_FORMAT_ERROR;
}
@@ -186,8 +186,8 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
// Type map data must be of the same size as the transition count
typeMapData = NULL;
if (transitionCount() > 0) {
- ures_getByKey(res, kTYPEMAP, r.getAlias(), &ec);
- typeMapData = ures_getBinary(r.getAlias(), &len, &ec);
+ ures_getByKey(res, kTYPEMAP, r.getAlias(), &ec);
+ typeMapData = ures_getBinary(r.getAlias(), &len, &ec);
if (ec == U_MISSING_RESOURCE_ERROR) {
// no type mapping data
ec = U_INVALID_FORMAT_ERROR;
@@ -198,10 +198,10 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
// Process final rule and data, if any
const UChar *ruleIdUStr = ures_getStringByKey(res, kFINALRULE, &len, &ec);
- ures_getByKey(res, kFINALRAW, r.getAlias(), &ec);
- int32_t ruleRaw = ures_getInt(r.getAlias(), &ec);
- ures_getByKey(res, kFINALYEAR, r.getAlias(), &ec);
- int32_t ruleYear = ures_getInt(r.getAlias(), &ec);
+ ures_getByKey(res, kFINALRAW, r.getAlias(), &ec);
+ int32_t ruleRaw = ures_getInt(r.getAlias(), &ec);
+ ures_getByKey(res, kFINALYEAR, r.getAlias(), &ec);
+ int32_t ruleYear = ures_getInt(r.getAlias(), &ec);
if (U_SUCCESS(ec)) {
UnicodeString ruleID(TRUE, ruleIdUStr, len);
UResourceBundle *rule = TimeZone::loadRule(top, ruleID, NULL, ec);
@@ -287,7 +287,7 @@ OlsonTimeZone& OlsonTimeZone::operator=(const OlsonTimeZone& other) {
typeMapData = other.typeMapData;
delete finalZone;
- finalZone = (other.finalZone != 0) ? other.finalZone->clone() : 0;
+ finalZone = (other.finalZone != 0) ? other.finalZone->clone() : 0;
finalStartYear = other.finalStartYear;
finalStartMillis = other.finalStartMillis;
@@ -318,7 +318,7 @@ UBool OlsonTimeZone::operator==(const TimeZone& other) const {
/**
* TimeZone API.
*/
-OlsonTimeZone* OlsonTimeZone::clone() const {
+OlsonTimeZone* OlsonTimeZone::clone() const {
return new OlsonTimeZone(*this);
}
@@ -815,7 +815,7 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) {
* For now, we do not set the valid start year when the construction time
* and create a clone and set the start year when extracting rules.
*/
- finalZoneWithStartYear = finalZone->clone();
+ finalZoneWithStartYear = finalZone->clone();
// Check to make sure finalZone was actually cloned.
if (finalZoneWithStartYear == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
@@ -836,7 +836,7 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) {
startTime = tzt.getTime();
} else {
// final rule with no transitions
- finalZoneWithStartYear = finalZone->clone();
+ finalZoneWithStartYear = finalZone->clone();
// Check to make sure finalZone was actually cloned.
if (finalZoneWithStartYear == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
diff --git a/contrib/libs/icu/i18n/olsontz.h b/contrib/libs/icu/i18n/olsontz.h
index 3884e9b15a..a3b7dcc8f3 100644
--- a/contrib/libs/icu/i18n/olsontz.h
+++ b/contrib/libs/icu/i18n/olsontz.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -151,7 +151,7 @@ class U_I18N_API OlsonTimeZone: public BasicTimeZone {
/**
* TimeZone API.
*/
- virtual OlsonTimeZone* clone() const;
+ virtual OlsonTimeZone* clone() const;
/**
* TimeZone API.
@@ -398,7 +398,7 @@ private:
TimeArrayTimeZoneRule **historicRules;
int16_t historicRuleCount;
SimpleTimeZone *finalZoneWithStartYear; // hack
- UInitOnce transitionRulesInitOnce = U_INITONCE_INITIALIZER;
+ UInitOnce transitionRulesInitOnce = U_INITONCE_INITIALIZER;
};
inline int16_t
diff --git a/contrib/libs/icu/i18n/persncal.cpp b/contrib/libs/icu/i18n/persncal.cpp
index 553377641b..26fd294cee 100644
--- a/contrib/libs/icu/i18n/persncal.cpp
+++ b/contrib/libs/icu/i18n/persncal.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -74,7 +74,7 @@ const char *PersianCalendar::getType() const {
return "persian";
}
-PersianCalendar* PersianCalendar::clone() const {
+PersianCalendar* PersianCalendar::clone() const {
return new PersianCalendar(*this);
}
@@ -213,7 +213,7 @@ void PersianCalendar::handleComputeFields(int32_t julianDay, UErrorCode &/*statu
int32_t year, month, dayOfMonth, dayOfYear;
int32_t daysSinceEpoch = julianDay - PERSIAN_EPOCH;
- year = 1 + (int32_t)ClockMath::floorDivide(33 * (int64_t)daysSinceEpoch + 3, (int64_t)12053);
+ year = 1 + (int32_t)ClockMath::floorDivide(33 * (int64_t)daysSinceEpoch + 3, (int64_t)12053);
int32_t farvardin1 = 365 * (year - 1) + ClockMath::floorDivide(8 * year + 21, 33);
dayOfYear = (daysSinceEpoch - farvardin1); // 0-based
diff --git a/contrib/libs/icu/i18n/persncal.h b/contrib/libs/icu/i18n/persncal.h
index d1dc710171..ce6d7397bf 100644
--- a/contrib/libs/icu/i18n/persncal.h
+++ b/contrib/libs/icu/i18n/persncal.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -164,7 +164,7 @@ class PersianCalendar : public Calendar {
// TODO: copy c'tor, etc
// clone
- virtual PersianCalendar* clone() const;
+ virtual PersianCalendar* clone() const;
private:
/**
diff --git a/contrib/libs/icu/i18n/plurfmt.cpp b/contrib/libs/icu/i18n/plurfmt.cpp
index a802e3606a..b99437630e 100644
--- a/contrib/libs/icu/i18n/plurfmt.cpp
+++ b/contrib/libs/icu/i18n/plurfmt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -21,16 +21,16 @@
#include "plurrule_impl.h"
#include "uassert.h"
#include "uhash.h"
-#include "number_decimalquantity.h"
-#include "number_utils.h"
-#include "number_utypes.h"
+#include "number_decimalquantity.h"
+#include "number_utils.h"
+#include "number_utypes.h"
#if !UCONFIG_NO_FORMATTING
U_NAMESPACE_BEGIN
-using number::impl::DecimalQuantity;
-
+using number::impl::DecimalQuantity;
+
static const UChar OTHER_STRING[] = {
0x6F, 0x74, 0x68, 0x65, 0x72, 0 // "other"
};
@@ -159,7 +159,7 @@ PluralFormat::copyObjects(const PluralFormat& other) {
if (other.numberFormat == NULL) {
numberFormat = NumberFormat::createInstance(locale, status);
} else {
- numberFormat = other.numberFormat->clone();
+ numberFormat = other.numberFormat->clone();
}
if (other.pluralRulesWrapper.pluralRules == NULL) {
pluralRulesWrapper.pluralRules = PluralRules::forLocale(locale, status);
@@ -261,40 +261,40 @@ PluralFormat::format(const Formattable& numberObject, double number,
if (msgPattern.countParts() == 0) {
return numberFormat->format(numberObject, appendTo, pos, status);
}
-
+
// Get the appropriate sub-message.
// Select it based on the formatted number-offset.
double numberMinusOffset = number - offset;
- // Call NumberFormatter to get both the DecimalQuantity and the string.
- // This call site needs to use more internal APIs than the Java equivalent.
- number::impl::UFormattedNumberData data;
- if (offset == 0) {
- // could be BigDecimal etc.
- numberObject.populateDecimalQuantity(data.quantity, status);
- } else {
- data.quantity.setToDouble(numberMinusOffset);
- }
+ // Call NumberFormatter to get both the DecimalQuantity and the string.
+ // This call site needs to use more internal APIs than the Java equivalent.
+ number::impl::UFormattedNumberData data;
+ if (offset == 0) {
+ // could be BigDecimal etc.
+ numberObject.populateDecimalQuantity(data.quantity, status);
+ } else {
+ data.quantity.setToDouble(numberMinusOffset);
+ }
UnicodeString numberString;
- auto *decFmt = dynamic_cast<DecimalFormat *>(numberFormat);
- if(decFmt != nullptr) {
- const number::LocalizedNumberFormatter* lnf = decFmt->toNumberFormatter(status);
- if (U_FAILURE(status)) {
- return appendTo;
+ auto *decFmt = dynamic_cast<DecimalFormat *>(numberFormat);
+ if(decFmt != nullptr) {
+ const number::LocalizedNumberFormatter* lnf = decFmt->toNumberFormatter(status);
+ if (U_FAILURE(status)) {
+ return appendTo;
+ }
+ lnf->formatImpl(&data, status); // mutates &data
+ if (U_FAILURE(status)) {
+ return appendTo;
}
- lnf->formatImpl(&data, status); // mutates &data
- if (U_FAILURE(status)) {
- return appendTo;
- }
- numberString = data.getStringRef().toUnicodeString();
+ numberString = data.getStringRef().toUnicodeString();
} else {
- if (offset == 0) {
- numberFormat->format(numberObject, numberString, status);
+ if (offset == 0) {
+ numberFormat->format(numberObject, numberString, status);
} else {
- numberFormat->format(numberMinusOffset, numberString, status);
+ numberFormat->format(numberMinusOffset, numberString, status);
}
}
-
- int32_t partIndex = findSubMessage(msgPattern, 0, pluralRulesWrapper, &data.quantity, number, status);
+
+ int32_t partIndex = findSubMessage(msgPattern, 0, pluralRulesWrapper, &data.quantity, number, status);
if (U_FAILURE(status)) { return appendTo; }
// Replace syntactic # signs in the top level of this sub-message
// (not in nested arguments) with the formatted number-offset.
@@ -353,7 +353,7 @@ PluralFormat::setNumberFormat(const NumberFormat* format, UErrorCode& status) {
if (U_FAILURE(status)) {
return;
}
- NumberFormat* nf = format->clone();
+ NumberFormat* nf = format->clone();
if (nf != NULL) {
delete numberFormat;
numberFormat = nf;
@@ -362,7 +362,7 @@ PluralFormat::setNumberFormat(const NumberFormat* format, UErrorCode& status) {
}
}
-PluralFormat*
+PluralFormat*
PluralFormat::clone() const
{
return new PluralFormat(*this);
@@ -583,7 +583,7 @@ PluralFormat::PluralSelectorAdapter::~PluralSelectorAdapter() {
UnicodeString PluralFormat::PluralSelectorAdapter::select(void *context, double number,
UErrorCode& /*ec*/) const {
(void)number; // unused except in the assertion
- IFixedDecimal *dec=static_cast<IFixedDecimal *>(context);
+ IFixedDecimal *dec=static_cast<IFixedDecimal *>(context);
return pluralRules->select(*dec);
}
diff --git a/contrib/libs/icu/i18n/plurrule.cpp b/contrib/libs/icu/i18n/plurrule.cpp
index f21c622a33..794a3d8c55 100644
--- a/contrib/libs/icu/i18n/plurrule.cpp
+++ b/contrib/libs/icu/i18n/plurrule.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -17,8 +17,8 @@
#include "unicode/plurrule.h"
#include "unicode/upluralrules.h"
#include "unicode/ures.h"
-#include "unicode/numfmt.h"
-#include "unicode/decimfmt.h"
+#include "unicode/numfmt.h"
+#include "unicode/decimfmt.h"
#include "charstr.h"
#include "cmemory.h"
#include "cstring.h"
@@ -34,16 +34,16 @@
#include "uvectr32.h"
#include "sharedpluralrules.h"
#include "unifiedcache.h"
-#include "number_decimalquantity.h"
-#include "util.h"
+#include "number_decimalquantity.h"
+#include "util.h"
#if !UCONFIG_NO_FORMATTING
U_NAMESPACE_BEGIN
-using namespace icu::pluralimpl;
-using icu::number::impl::DecimalQuantity;
-
+using namespace icu::pluralimpl;
+using icu::number::impl::DecimalQuantity;
+
static const UChar PLURAL_KEYWORD_OTHER[]={LOW_O,LOW_T,LOW_H,LOW_E,LOW_R,0};
static const UChar PLURAL_DEFAULT_RULE[]={LOW_O,LOW_T,LOW_H,LOW_E,LOW_R,COLON,SPACE,LOW_N,0};
static const UChar PK_IN[]={LOW_I,LOW_N,0};
@@ -66,15 +66,15 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(PluralKeywordEnumeration)
PluralRules::PluralRules(UErrorCode& /*status*/)
: UObject(),
- mRules(nullptr),
- mInternalStatus(U_ZERO_ERROR)
+ mRules(nullptr),
+ mInternalStatus(U_ZERO_ERROR)
{
}
PluralRules::PluralRules(const PluralRules& other)
: UObject(other),
- mRules(nullptr),
- mInternalStatus(U_ZERO_ERROR)
+ mRules(nullptr),
+ mInternalStatus(U_ZERO_ERROR)
{
*this=other;
}
@@ -89,67 +89,67 @@ SharedPluralRules::~SharedPluralRules() {
PluralRules*
PluralRules::clone() const {
- PluralRules* newObj = new PluralRules(*this);
- // Since clone doesn't have a 'status' parameter, the best we can do is return nullptr if
- // the newly created object was not fully constructed properly (an error occurred).
- if (newObj != nullptr && U_FAILURE(newObj->mInternalStatus)) {
- delete newObj;
- newObj = nullptr;
- }
- return newObj;
+ PluralRules* newObj = new PluralRules(*this);
+ // Since clone doesn't have a 'status' parameter, the best we can do is return nullptr if
+ // the newly created object was not fully constructed properly (an error occurred).
+ if (newObj != nullptr && U_FAILURE(newObj->mInternalStatus)) {
+ delete newObj;
+ newObj = nullptr;
+ }
+ return newObj;
}
PluralRules&
PluralRules::operator=(const PluralRules& other) {
if (this != &other) {
delete mRules;
- mRules = nullptr;
- mInternalStatus = other.mInternalStatus;
- if (U_FAILURE(mInternalStatus)) {
- // bail out early if the object we were copying from was already 'invalid'.
- return *this;
+ mRules = nullptr;
+ mInternalStatus = other.mInternalStatus;
+ if (U_FAILURE(mInternalStatus)) {
+ // bail out early if the object we were copying from was already 'invalid'.
+ return *this;
}
- if (other.mRules != nullptr) {
+ if (other.mRules != nullptr) {
mRules = new RuleChain(*other.mRules);
- if (mRules == nullptr) {
- mInternalStatus = U_MEMORY_ALLOCATION_ERROR;
- }
- else if (U_FAILURE(mRules->fInternalStatus)) {
- // If the RuleChain wasn't fully copied, then set our status to failure as well.
- mInternalStatus = mRules->fInternalStatus;
- }
+ if (mRules == nullptr) {
+ mInternalStatus = U_MEMORY_ALLOCATION_ERROR;
+ }
+ else if (U_FAILURE(mRules->fInternalStatus)) {
+ // If the RuleChain wasn't fully copied, then set our status to failure as well.
+ mInternalStatus = mRules->fInternalStatus;
+ }
}
}
return *this;
}
StringEnumeration* PluralRules::getAvailableLocales(UErrorCode &status) {
- if (U_FAILURE(status)) {
- return nullptr;
+ if (U_FAILURE(status)) {
+ return nullptr;
}
- LocalPointer<StringEnumeration> result(new PluralAvailableLocalesEnumeration(status), status);
+ LocalPointer<StringEnumeration> result(new PluralAvailableLocalesEnumeration(status), status);
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
- return result.orphan();
+ return result.orphan();
}
PluralRules* U_EXPORT2
PluralRules::createRules(const UnicodeString& description, UErrorCode& status) {
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
PluralRuleParser parser;
- LocalPointer<PluralRules> newRules(new PluralRules(status), status);
- if (U_FAILURE(status)) {
- return nullptr;
+ LocalPointer<PluralRules> newRules(new PluralRules(status), status);
+ if (U_FAILURE(status)) {
+ return nullptr;
}
- parser.parse(description, newRules.getAlias(), status);
+ parser.parse(description, newRules.getAlias(), status);
if (U_FAILURE(status)) {
- newRules.adoptInstead(nullptr);
+ newRules.adoptInstead(nullptr);
}
- return newRules.orphan();
+ return newRules.orphan();
}
@@ -165,17 +165,17 @@ template<> U_I18N_API
const SharedPluralRules *LocaleCacheKey<SharedPluralRules>::createObject(
const void * /*unused*/, UErrorCode &status) const {
const char *localeId = fLoc.getName();
- LocalPointer<PluralRules> pr(PluralRules::internalForLocale(localeId, UPLURAL_TYPE_CARDINAL, status), status);
+ LocalPointer<PluralRules> pr(PluralRules::internalForLocale(localeId, UPLURAL_TYPE_CARDINAL, status), status);
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
- LocalPointer<SharedPluralRules> result(new SharedPluralRules(pr.getAlias()), status);
- if (U_FAILURE(status)) {
- return nullptr;
+ LocalPointer<SharedPluralRules> result(new SharedPluralRules(pr.getAlias()), status);
+ if (U_FAILURE(status)) {
+ return nullptr;
}
- pr.orphan(); // result was successfully created so it nows pr.
+ pr.orphan(); // result was successfully created so it nows pr.
result->addRef();
- return result.orphan();
+ return result.orphan();
}
/* end plural rules cache */
@@ -185,13 +185,13 @@ const SharedPluralRules* U_EXPORT2
PluralRules::createSharedInstance(
const Locale& locale, UPluralType type, UErrorCode& status) {
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
if (type != UPLURAL_TYPE_CARDINAL) {
status = U_UNSUPPORTED_ERROR;
- return nullptr;
+ return nullptr;
}
- const SharedPluralRules *result = nullptr;
+ const SharedPluralRules *result = nullptr;
UnifiedCache::getByLocale(locale, result, status);
return result;
}
@@ -209,11 +209,11 @@ PluralRules::forLocale(const Locale& locale, UPluralType type, UErrorCode& statu
const SharedPluralRules *shared = createSharedInstance(
locale, type, status);
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
PluralRules *result = (*shared)->clone();
shared->removeRef();
- if (result == nullptr) {
+ if (result == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
}
return result;
@@ -222,23 +222,23 @@ PluralRules::forLocale(const Locale& locale, UPluralType type, UErrorCode& statu
PluralRules* U_EXPORT2
PluralRules::internalForLocale(const Locale& locale, UPluralType type, UErrorCode& status) {
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
if (type >= UPLURAL_TYPE_COUNT) {
status = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
+ return nullptr;
}
- LocalPointer<PluralRules> newObj(new PluralRules(status), status);
- if (U_FAILURE(status)) {
- return nullptr;
+ LocalPointer<PluralRules> newObj(new PluralRules(status), status);
+ if (U_FAILURE(status)) {
+ return nullptr;
}
UnicodeString locRule = newObj->getRuleFromResource(locale, type, status);
- // TODO: which other errors, if any, should be returned?
+ // TODO: which other errors, if any, should be returned?
if (locRule.length() == 0) {
- // If an out-of-memory error occurred, then stop and report the failure.
- if (status == U_MEMORY_ALLOCATION_ERROR) {
- return nullptr;
- }
+ // If an out-of-memory error occurred, then stop and report the failure.
+ if (status == U_MEMORY_ALLOCATION_ERROR) {
+ return nullptr;
+ }
// Locales with no specific rules (all numbers have the "other" category
// will return a U_MISSING_RESOURCE_ERROR at this point. This is not
// an error.
@@ -246,13 +246,13 @@ PluralRules::internalForLocale(const Locale& locale, UPluralType type, UErrorCod
status = U_ZERO_ERROR;
}
PluralRuleParser parser;
- parser.parse(locRule, newObj.getAlias(), status);
+ parser.parse(locRule, newObj.getAlias(), status);
// TODO: should rule parse errors be returned, or
// should we silently use default rules?
// Original impl used default rules.
// Ask the question to ICU Core.
- return newObj.orphan();
+ return newObj.orphan();
}
UnicodeString
@@ -266,23 +266,23 @@ PluralRules::select(double number) const {
}
UnicodeString
-PluralRules::select(const number::FormattedNumber& number, UErrorCode& status) const {
- DecimalQuantity dq;
- number.getDecimalQuantity(dq, status);
- if (U_FAILURE(status)) {
- return ICU_Utility::makeBogusString();
+PluralRules::select(const number::FormattedNumber& number, UErrorCode& status) const {
+ DecimalQuantity dq;
+ number.getDecimalQuantity(dq, status);
+ if (U_FAILURE(status)) {
+ return ICU_Utility::makeBogusString();
}
- return select(dq);
+ return select(dq);
}
UnicodeString
-PluralRules::select(const IFixedDecimal &number) const {
- if (mRules == nullptr) {
+PluralRules::select(const IFixedDecimal &number) const {
+ if (mRules == nullptr) {
return UnicodeString(TRUE, PLURAL_DEFAULT_RULE, -1);
}
- else {
- return mRules->select(number);
- }
+ else {
+ return mRules->select(number);
+ }
}
@@ -290,17 +290,17 @@ PluralRules::select(const IFixedDecimal &number) const {
StringEnumeration*
PluralRules::getKeywords(UErrorCode& status) const {
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
+ }
+ if (U_FAILURE(mInternalStatus)) {
+ status = mInternalStatus;
+ return nullptr;
+ }
+ LocalPointer<StringEnumeration> nameEnumerator(new PluralKeywordEnumeration(mRules, status), status);
+ if (U_FAILURE(status)) {
+ return nullptr;
}
- if (U_FAILURE(mInternalStatus)) {
- status = mInternalStatus;
- return nullptr;
- }
- LocalPointer<StringEnumeration> nameEnumerator(new PluralKeywordEnumeration(mRules, status), status);
- if (U_FAILURE(status)) {
- return nullptr;
- }
- return nameEnumerator.orphan();
+ return nameEnumerator.orphan();
}
double
@@ -316,7 +316,7 @@ PluralRules::getAllKeywordValues(const UnicodeString & /* keyword */, double * /
return 0;
}
-
+
static double scaleForInt(double d) {
double scale = 1.0;
while (d != floor(d)) {
@@ -351,7 +351,7 @@ getSamplesFromString(const UnicodeString &samples, double *dest,
dest[sampleCount++] = sampleValue;
}
} else {
-
+
FixedDecimal fixedLo(sampleRange.tempSubStringBetween(0, tildeIndex), status);
FixedDecimal fixedHi(sampleRange.tempSubStringBetween(tildeIndex+1), status);
double rangeLo = fixedLo.source;
@@ -367,7 +367,7 @@ getSamplesFromString(const UnicodeString &samples, double *dest,
// For ranges of samples with fraction decimal digits, scale the number up so that we
// are adding one in the units place. Avoids roundoffs from repetitive adds of tenths.
- double scale = scaleForInt(rangeLo);
+ double scale = scaleForInt(rangeLo);
double t = scaleForInt(rangeHi);
if (t > scale) {
scale = t;
@@ -398,28 +398,28 @@ getSamplesFromString(const UnicodeString &samples, double *dest,
int32_t
PluralRules::getSamples(const UnicodeString &keyword, double *dest,
int32_t destCapacity, UErrorCode& status) {
- if (destCapacity == 0 || U_FAILURE(status)) {
- return 0;
- }
- if (U_FAILURE(mInternalStatus)) {
- status = mInternalStatus;
- return 0;
- }
+ if (destCapacity == 0 || U_FAILURE(status)) {
+ return 0;
+ }
+ if (U_FAILURE(mInternalStatus)) {
+ status = mInternalStatus;
+ return 0;
+ }
RuleChain *rc = rulesForKeyword(keyword);
- if (rc == nullptr) {
+ if (rc == nullptr) {
return 0;
}
int32_t numSamples = getSamplesFromString(rc->fIntegerSamples, dest, destCapacity, status);
- if (numSamples == 0) {
+ if (numSamples == 0) {
numSamples = getSamplesFromString(rc->fDecimalSamples, dest, destCapacity, status);
}
return numSamples;
}
-
+
RuleChain *PluralRules::rulesForKeyword(const UnicodeString &keyword) const {
RuleChain *rc;
- for (rc = mRules; rc != nullptr; rc = rc->fNext) {
+ for (rc = mRules; rc != nullptr; rc = rc->fNext) {
if (rc->fKeyword == keyword) {
break;
}
@@ -433,7 +433,7 @@ PluralRules::isKeyword(const UnicodeString& keyword) const {
if (0 == keyword.compare(PLURAL_KEYWORD_OTHER, 5)) {
return true;
}
- return rulesForKeyword(keyword) != nullptr;
+ return rulesForKeyword(keyword) != nullptr;
}
UnicodeString
@@ -459,13 +459,13 @@ PluralRules::operator==(const PluralRules& other) const {
return FALSE;
}
myKeywordList->reset(status);
- while ((ptrKeyword=myKeywordList->snext(status))!=nullptr) {
+ while ((ptrKeyword=myKeywordList->snext(status))!=nullptr) {
if (!other.isKeyword(*ptrKeyword)) {
return FALSE;
}
}
otherKeywordList->reset(status);
- while ((ptrKeyword=otherKeywordList->snext(status))!=nullptr) {
+ while ((ptrKeyword=otherKeywordList->snext(status))!=nullptr) {
if (!this->isKeyword(*ptrKeyword)) {
return FALSE;
}
@@ -498,33 +498,33 @@ PluralRuleParser::parse(const UnicodeString& ruleData, PluralRules *prules, UErr
}
switch (type) {
case tAnd:
- U_ASSERT(curAndConstraint != nullptr);
- curAndConstraint = curAndConstraint->add(status);
+ U_ASSERT(curAndConstraint != nullptr);
+ curAndConstraint = curAndConstraint->add(status);
break;
case tOr:
{
- U_ASSERT(currentChain != nullptr);
+ U_ASSERT(currentChain != nullptr);
OrConstraint *orNode=currentChain->ruleHeader;
- while (orNode->next != nullptr) {
+ while (orNode->next != nullptr) {
orNode = orNode->next;
}
orNode->next= new OrConstraint();
- if (orNode->next == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- break;
- }
+ if (orNode->next == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ break;
+ }
orNode=orNode->next;
- orNode->next=nullptr;
- curAndConstraint = orNode->add(status);
+ orNode->next=nullptr;
+ curAndConstraint = orNode->add(status);
}
break;
case tIs:
- U_ASSERT(curAndConstraint != nullptr);
+ U_ASSERT(curAndConstraint != nullptr);
U_ASSERT(curAndConstraint->value == -1);
- U_ASSERT(curAndConstraint->rangeList == nullptr);
+ U_ASSERT(curAndConstraint->rangeList == nullptr);
break;
case tNot:
- U_ASSERT(curAndConstraint != nullptr);
+ U_ASSERT(curAndConstraint != nullptr);
curAndConstraint->negated=TRUE;
break;
@@ -534,29 +534,29 @@ PluralRuleParser::parse(const UnicodeString& ruleData, PluralRules *prules, UErr
case tIn:
case tWithin:
case tEqual:
- {
- U_ASSERT(curAndConstraint != nullptr);
- LocalPointer<UVector32> newRangeList(new UVector32(status), status);
- if (U_FAILURE(status)) {
- break;
- }
- curAndConstraint->rangeList = newRangeList.orphan();
- curAndConstraint->rangeList->addElement(-1, status); // range Low
- curAndConstraint->rangeList->addElement(-1, status); // range Hi
- rangeLowIdx = 0;
- rangeHiIdx = 1;
- curAndConstraint->value=PLURAL_RANGE_HIGH;
- curAndConstraint->integerOnly = (type != tWithin);
- }
+ {
+ U_ASSERT(curAndConstraint != nullptr);
+ LocalPointer<UVector32> newRangeList(new UVector32(status), status);
+ if (U_FAILURE(status)) {
+ break;
+ }
+ curAndConstraint->rangeList = newRangeList.orphan();
+ curAndConstraint->rangeList->addElement(-1, status); // range Low
+ curAndConstraint->rangeList->addElement(-1, status); // range Hi
+ rangeLowIdx = 0;
+ rangeHiIdx = 1;
+ curAndConstraint->value=PLURAL_RANGE_HIGH;
+ curAndConstraint->integerOnly = (type != tWithin);
+ }
break;
case tNumber:
- U_ASSERT(curAndConstraint != nullptr);
+ U_ASSERT(curAndConstraint != nullptr);
if ( (curAndConstraint->op==AndConstraint::MOD)&&
(curAndConstraint->opNum == -1 ) ) {
curAndConstraint->opNum=getNumberValue(token);
}
else {
- if (curAndConstraint->rangeList == nullptr) {
+ if (curAndConstraint->rangeList == nullptr) {
// this is for an 'is' rule
curAndConstraint->value = getNumberValue(token);
} else {
@@ -567,7 +567,7 @@ PluralRuleParser::parse(const UnicodeString& ruleData, PluralRules *prules, UErr
}
else {
curAndConstraint->rangeList->setElementAt(getNumberValue(token), rangeHiIdx);
- if (curAndConstraint->rangeList->elementAti(rangeLowIdx) >
+ if (curAndConstraint->rangeList->elementAti(rangeLowIdx) >
curAndConstraint->rangeList->elementAti(rangeHiIdx)) {
// Range Lower bound > Range Upper bound.
// U_UNEXPECTED_TOKEN seems a little funny, but it is consistently
@@ -582,7 +582,7 @@ PluralRuleParser::parse(const UnicodeString& ruleData, PluralRules *prules, UErr
case tComma:
// TODO: rule syntax checking is inadequate, can happen with badly formed rules.
// Catch cases like "n mod 10, is 1" here instead.
- if (curAndConstraint == nullptr || curAndConstraint->rangeList == nullptr) {
+ if (curAndConstraint == nullptr || curAndConstraint->rangeList == nullptr) {
status = U_UNEXPECTED_TOKEN;
break;
}
@@ -593,7 +593,7 @@ PluralRuleParser::parse(const UnicodeString& ruleData, PluralRules *prules, UErr
curAndConstraint->rangeList->addElement(-1, status); // range Hi
break;
case tMod:
- U_ASSERT(curAndConstraint != nullptr);
+ U_ASSERT(curAndConstraint != nullptr);
curAndConstraint->op=AndConstraint::MOD;
break;
case tVariableN:
@@ -601,24 +601,24 @@ PluralRuleParser::parse(const UnicodeString& ruleData, PluralRules *prules, UErr
case tVariableF:
case tVariableT:
case tVariableV:
- U_ASSERT(curAndConstraint != nullptr);
+ U_ASSERT(curAndConstraint != nullptr);
curAndConstraint->digitsType = type;
break;
case tKeyword:
{
RuleChain *newChain = new RuleChain;
- if (newChain == nullptr) {
+ if (newChain == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
break;
}
newChain->fKeyword = token;
- if (prules->mRules == nullptr) {
+ if (prules->mRules == nullptr) {
prules->mRules = newChain;
} else {
// The new rule chain goes at the end of the linked list of rule chains,
// unless there is an "other" keyword & chain. "other" must remain last.
RuleChain *insertAfter = prules->mRules;
- while (insertAfter->fNext!=nullptr &&
+ while (insertAfter->fNext!=nullptr &&
insertAfter->fNext->fKeyword.compare(PLURAL_KEYWORD_OTHER, 5) != 0 ){
insertAfter=insertAfter->fNext;
}
@@ -626,12 +626,12 @@ PluralRuleParser::parse(const UnicodeString& ruleData, PluralRules *prules, UErr
insertAfter->fNext = newChain;
}
OrConstraint *orNode = new OrConstraint();
- if (orNode == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- break;
- }
+ if (orNode == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ break;
+ }
newChain->ruleHeader = orNode;
- curAndConstraint = orNode->add(status);
+ curAndConstraint = orNode->add(status);
currentChain = newChain;
}
break;
@@ -663,7 +663,7 @@ PluralRuleParser::parse(const UnicodeString& ruleData, PluralRules *prules, UErr
currentChain->fDecimalSamples.append(token);
}
break;
-
+
default:
break;
}
@@ -681,7 +681,7 @@ PluralRules::getRuleFromResource(const Locale& locale, UPluralType type, UErrorC
if (U_FAILURE(errCode)) {
return emptyStr;
}
- LocalUResourceBundlePointer rb(ures_openDirect(nullptr, "plurals", &errCode));
+ LocalUResourceBundlePointer rb(ures_openDirect(nullptr, "plurals", &errCode));
if(U_FAILURE(errCode)) {
return emptyStr;
}
@@ -698,33 +698,33 @@ PluralRules::getRuleFromResource(const Locale& locale, UPluralType type, UErrorC
errCode = U_ILLEGAL_ARGUMENT_ERROR;
return emptyStr;
}
- LocalUResourceBundlePointer locRes(ures_getByKey(rb.getAlias(), typeKey, nullptr, &errCode));
+ LocalUResourceBundlePointer locRes(ures_getByKey(rb.getAlias(), typeKey, nullptr, &errCode));
if(U_FAILURE(errCode)) {
return emptyStr;
}
int32_t resLen=0;
- const char *curLocaleName=locale.getBaseName();
+ const char *curLocaleName=locale.getBaseName();
const UChar* s = ures_getStringByKey(locRes.getAlias(), curLocaleName, &resLen, &errCode);
- if (s == nullptr) {
+ if (s == nullptr) {
// Check parent locales.
UErrorCode status = U_ZERO_ERROR;
char parentLocaleName[ULOC_FULLNAME_CAPACITY];
- const char *curLocaleName2=locale.getBaseName();
- uprv_strcpy(parentLocaleName, curLocaleName2);
+ const char *curLocaleName2=locale.getBaseName();
+ uprv_strcpy(parentLocaleName, curLocaleName2);
while (uloc_getParent(parentLocaleName, parentLocaleName,
ULOC_FULLNAME_CAPACITY, &status) > 0) {
resLen=0;
s = ures_getStringByKey(locRes.getAlias(), parentLocaleName, &resLen, &status);
- if (s != nullptr) {
+ if (s != nullptr) {
errCode = U_ZERO_ERROR;
break;
}
status = U_ZERO_ERROR;
}
}
- if (s==nullptr) {
+ if (s==nullptr) {
return emptyStr;
}
@@ -732,18 +732,18 @@ PluralRules::getRuleFromResource(const Locale& locale, UPluralType type, UErrorC
u_UCharsToChars(s, setKey, resLen + 1);
// printf("\n PluralRule: %s\n", setKey);
- LocalUResourceBundlePointer ruleRes(ures_getByKey(rb.getAlias(), "rules", nullptr, &errCode));
+ LocalUResourceBundlePointer ruleRes(ures_getByKey(rb.getAlias(), "rules", nullptr, &errCode));
if(U_FAILURE(errCode)) {
return emptyStr;
}
- LocalUResourceBundlePointer setRes(ures_getByKey(ruleRes.getAlias(), setKey, nullptr, &errCode));
+ LocalUResourceBundlePointer setRes(ures_getByKey(ruleRes.getAlias(), setKey, nullptr, &errCode));
if (U_FAILURE(errCode)) {
return emptyStr;
}
int32_t numberKeys = ures_getSize(setRes.getAlias());
UnicodeString result;
- const char *key=nullptr;
+ const char *key=nullptr;
for(int32_t i=0; i<numberKeys; ++i) { // Keys are zero, one, few, ...
UnicodeString rules = ures_getNextUnicodeString(setRes.getAlias(), &key, &errCode);
UnicodeString uKey(key, -1, US_INV);
@@ -759,58 +759,58 @@ PluralRules::getRuleFromResource(const Locale& locale, UPluralType type, UErrorC
UnicodeString
PluralRules::getRules() const {
UnicodeString rules;
- if (mRules != nullptr) {
+ if (mRules != nullptr) {
mRules->dumpRules(rules);
}
return rules;
}
AndConstraint::AndConstraint(const AndConstraint& other) {
- this->fInternalStatus = other.fInternalStatus;
- if (U_FAILURE(fInternalStatus)) {
- return; // stop early if the object we are copying from is invalid.
- }
+ this->fInternalStatus = other.fInternalStatus;
+ if (U_FAILURE(fInternalStatus)) {
+ return; // stop early if the object we are copying from is invalid.
+ }
this->op = other.op;
this->opNum=other.opNum;
this->value=other.value;
- if (other.rangeList != nullptr) {
- LocalPointer<UVector32> newRangeList(new UVector32(fInternalStatus), fInternalStatus);
- if (U_FAILURE(fInternalStatus)) {
- return;
- }
- this->rangeList = newRangeList.orphan();
- this->rangeList->assign(*other.rangeList, fInternalStatus);
+ if (other.rangeList != nullptr) {
+ LocalPointer<UVector32> newRangeList(new UVector32(fInternalStatus), fInternalStatus);
+ if (U_FAILURE(fInternalStatus)) {
+ return;
+ }
+ this->rangeList = newRangeList.orphan();
+ this->rangeList->assign(*other.rangeList, fInternalStatus);
}
this->integerOnly=other.integerOnly;
this->negated=other.negated;
this->digitsType = other.digitsType;
- if (other.next != nullptr) {
+ if (other.next != nullptr) {
this->next = new AndConstraint(*other.next);
- if (this->next == nullptr) {
- fInternalStatus = U_MEMORY_ALLOCATION_ERROR;
- }
+ if (this->next == nullptr) {
+ fInternalStatus = U_MEMORY_ALLOCATION_ERROR;
+ }
}
}
AndConstraint::~AndConstraint() {
delete rangeList;
- rangeList = nullptr;
- delete next;
- next = nullptr;
+ rangeList = nullptr;
+ delete next;
+ next = nullptr;
}
UBool
-AndConstraint::isFulfilled(const IFixedDecimal &number) {
+AndConstraint::isFulfilled(const IFixedDecimal &number) {
UBool result = TRUE;
if (digitsType == none) {
// An empty AndConstraint, created by a rule with a keyword but no following expression.
return TRUE;
}
-
- PluralOperand operand = tokenTypeToPluralOperand(digitsType);
- double n = number.getPluralOperand(operand); // pulls n | i | v | f value for the number.
- // Will always be positive.
- // May be non-integer (n option only)
+
+ PluralOperand operand = tokenTypeToPluralOperand(digitsType);
+ double n = number.getPluralOperand(operand); // pulls n | i | v | f value for the number.
+ // Will always be positive.
+ // May be non-integer (n option only)
do {
if (integerOnly && n != uprv_floor(n)) {
result = FALSE;
@@ -820,7 +820,7 @@ AndConstraint::isFulfilled(const IFixedDecimal &number) {
if (op == MOD) {
n = fmod(n, opNum);
}
- if (rangeList == nullptr) {
+ if (rangeList == nullptr) {
result = value == -1 || // empty rule
n == value; // 'is' rule
break;
@@ -841,79 +841,79 @@ AndConstraint::isFulfilled(const IFixedDecimal &number) {
}
AndConstraint*
-AndConstraint::add(UErrorCode& status) {
- if (U_FAILURE(fInternalStatus)) {
- status = fInternalStatus;
- return nullptr;
- }
+AndConstraint::add(UErrorCode& status) {
+ if (U_FAILURE(fInternalStatus)) {
+ status = fInternalStatus;
+ return nullptr;
+ }
this->next = new AndConstraint();
- if (this->next == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
+ if (this->next == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
return this->next;
}
OrConstraint::OrConstraint(const OrConstraint& other) {
- this->fInternalStatus = other.fInternalStatus;
- if (U_FAILURE(fInternalStatus)) {
- return; // stop early if the object we are copying from is invalid.
+ this->fInternalStatus = other.fInternalStatus;
+ if (U_FAILURE(fInternalStatus)) {
+ return; // stop early if the object we are copying from is invalid.
}
- if ( other.childNode != nullptr ) {
+ if ( other.childNode != nullptr ) {
this->childNode = new AndConstraint(*(other.childNode));
- if (this->childNode == nullptr) {
- fInternalStatus = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
+ if (this->childNode == nullptr) {
+ fInternalStatus = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
}
- if (other.next != nullptr ) {
+ if (other.next != nullptr ) {
this->next = new OrConstraint(*(other.next));
- if (this->next == nullptr) {
- fInternalStatus = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- if (U_FAILURE(this->next->fInternalStatus)) {
- this->fInternalStatus = this->next->fInternalStatus;
- }
+ if (this->next == nullptr) {
+ fInternalStatus = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ if (U_FAILURE(this->next->fInternalStatus)) {
+ this->fInternalStatus = this->next->fInternalStatus;
+ }
}
}
OrConstraint::~OrConstraint() {
- delete childNode;
- childNode = nullptr;
- delete next;
- next = nullptr;
+ delete childNode;
+ childNode = nullptr;
+ delete next;
+ next = nullptr;
}
AndConstraint*
-OrConstraint::add(UErrorCode& status) {
- if (U_FAILURE(fInternalStatus)) {
- status = fInternalStatus;
- return nullptr;
- }
+OrConstraint::add(UErrorCode& status) {
+ if (U_FAILURE(fInternalStatus)) {
+ status = fInternalStatus;
+ return nullptr;
+ }
OrConstraint *curOrConstraint=this;
{
- while (curOrConstraint->next!=nullptr) {
+ while (curOrConstraint->next!=nullptr) {
curOrConstraint = curOrConstraint->next;
}
- U_ASSERT(curOrConstraint->childNode == nullptr);
+ U_ASSERT(curOrConstraint->childNode == nullptr);
curOrConstraint->childNode = new AndConstraint();
- if (curOrConstraint->childNode == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
+ if (curOrConstraint->childNode == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
}
return curOrConstraint->childNode;
}
UBool
-OrConstraint::isFulfilled(const IFixedDecimal &number) {
+OrConstraint::isFulfilled(const IFixedDecimal &number) {
OrConstraint* orRule=this;
UBool result=FALSE;
- while (orRule!=nullptr && !result) {
+ while (orRule!=nullptr && !result) {
result=TRUE;
AndConstraint* andRule = orRule->childNode;
- while (andRule!=nullptr && result) {
+ while (andRule!=nullptr && result) {
result = andRule->isFulfilled(number);
andRule=andRule->next;
}
@@ -924,33 +924,33 @@ OrConstraint::isFulfilled(const IFixedDecimal &number) {
}
-RuleChain::RuleChain(const RuleChain& other) :
- fKeyword(other.fKeyword), fDecimalSamples(other.fDecimalSamples),
- fIntegerSamples(other.fIntegerSamples), fDecimalSamplesUnbounded(other.fDecimalSamplesUnbounded),
- fIntegerSamplesUnbounded(other.fIntegerSamplesUnbounded), fInternalStatus(other.fInternalStatus) {
- if (U_FAILURE(this->fInternalStatus)) {
- return; // stop early if the object we are copying from is invalid.
- }
- if (other.ruleHeader != nullptr) {
+RuleChain::RuleChain(const RuleChain& other) :
+ fKeyword(other.fKeyword), fDecimalSamples(other.fDecimalSamples),
+ fIntegerSamples(other.fIntegerSamples), fDecimalSamplesUnbounded(other.fDecimalSamplesUnbounded),
+ fIntegerSamplesUnbounded(other.fIntegerSamplesUnbounded), fInternalStatus(other.fInternalStatus) {
+ if (U_FAILURE(this->fInternalStatus)) {
+ return; // stop early if the object we are copying from is invalid.
+ }
+ if (other.ruleHeader != nullptr) {
this->ruleHeader = new OrConstraint(*(other.ruleHeader));
- if (this->ruleHeader == nullptr) {
- this->fInternalStatus = U_MEMORY_ALLOCATION_ERROR;
- }
- else if (U_FAILURE(this->ruleHeader->fInternalStatus)) {
- // If the OrConstraint wasn't fully copied, then set our status to failure as well.
- this->fInternalStatus = this->ruleHeader->fInternalStatus;
- return; // exit early.
- }
- }
- if (other.fNext != nullptr ) {
+ if (this->ruleHeader == nullptr) {
+ this->fInternalStatus = U_MEMORY_ALLOCATION_ERROR;
+ }
+ else if (U_FAILURE(this->ruleHeader->fInternalStatus)) {
+ // If the OrConstraint wasn't fully copied, then set our status to failure as well.
+ this->fInternalStatus = this->ruleHeader->fInternalStatus;
+ return; // exit early.
+ }
+ }
+ if (other.fNext != nullptr ) {
this->fNext = new RuleChain(*other.fNext);
- if (this->fNext == nullptr) {
- this->fInternalStatus = U_MEMORY_ALLOCATION_ERROR;
- }
- else if (U_FAILURE(this->fNext->fInternalStatus)) {
- // If the RuleChain wasn't fully copied, then set our status to failure as well.
- this->fInternalStatus = this->fNext->fInternalStatus;
- }
+ if (this->fNext == nullptr) {
+ this->fInternalStatus = U_MEMORY_ALLOCATION_ERROR;
+ }
+ else if (U_FAILURE(this->fNext->fInternalStatus)) {
+ // If the RuleChain wasn't fully copied, then set our status to failure as well.
+ this->fInternalStatus = this->fNext->fInternalStatus;
+ }
}
}
@@ -960,9 +960,9 @@ RuleChain::~RuleChain() {
}
UnicodeString
-RuleChain::select(const IFixedDecimal &number) const {
- if (!number.isNaN() && !number.isInfinite()) {
- for (const RuleChain *rules = this; rules != nullptr; rules = rules->fNext) {
+RuleChain::select(const IFixedDecimal &number) const {
+ if (!number.isNaN() && !number.isInfinite()) {
+ for (const RuleChain *rules = this; rules != nullptr; rules = rules->fNext) {
if (rules->ruleHeader->isFulfilled(number)) {
return rules->fKeyword;
}
@@ -994,17 +994,17 @@ void
RuleChain::dumpRules(UnicodeString& result) {
UChar digitString[16];
- if ( ruleHeader != nullptr ) {
+ if ( ruleHeader != nullptr ) {
result += fKeyword;
result += COLON;
result += SPACE;
OrConstraint* orRule=ruleHeader;
- while ( orRule != nullptr ) {
+ while ( orRule != nullptr ) {
AndConstraint* andRule=orRule->childNode;
- while ( andRule != nullptr ) {
- if ((andRule->op==AndConstraint::NONE) && (andRule->rangeList==nullptr) && (andRule->value == -1)) {
+ while ( andRule != nullptr ) {
+ if ((andRule->op==AndConstraint::NONE) && (andRule->rangeList==nullptr) && (andRule->value == -1)) {
// Empty Rules.
- } else if ( (andRule->op==AndConstraint::NONE) && (andRule->rangeList==nullptr) ) {
+ } else if ( (andRule->op==AndConstraint::NONE) && (andRule->rangeList==nullptr) ) {
result += tokenString(andRule->digitsType);
result += UNICODE_STRING_SIMPLE(" is ");
if (andRule->negated) {
@@ -1021,7 +1021,7 @@ RuleChain::dumpRules(UnicodeString& result) {
uprv_itou(digitString,16, andRule->opNum,10,0);
result += UnicodeString(digitString);
}
- if (andRule->rangeList==nullptr) {
+ if (andRule->rangeList==nullptr) {
if (andRule->negated) {
result += UNICODE_STRING_SIMPLE(" is not ");
uprv_itou(digitString,16, andRule->value,10,0);
@@ -1064,16 +1064,16 @@ RuleChain::dumpRules(UnicodeString& result) {
}
}
}
- if ( (andRule=andRule->next) != nullptr) {
+ if ( (andRule=andRule->next) != nullptr) {
result += UNICODE_STRING_SIMPLE(" and ");
}
}
- if ( (orRule = orRule->next) != nullptr ) {
+ if ( (orRule = orRule->next) != nullptr ) {
result += UNICODE_STRING_SIMPLE(" or ");
}
}
}
- if ( fNext != nullptr ) {
+ if ( fNext != nullptr ) {
result += UNICODE_STRING_SIMPLE("; ");
fNext->dumpRules(result);
}
@@ -1082,9 +1082,9 @@ RuleChain::dumpRules(UnicodeString& result) {
UErrorCode
RuleChain::getKeywords(int32_t capacityOfKeywords, UnicodeString* keywords, int32_t& arraySize) const {
- if (U_FAILURE(fInternalStatus)) {
- return fInternalStatus;
- }
+ if (U_FAILURE(fInternalStatus)) {
+ return fInternalStatus;
+ }
if ( arraySize < capacityOfKeywords-1 ) {
keywords[arraySize++]=fKeyword;
}
@@ -1092,7 +1092,7 @@ RuleChain::getKeywords(int32_t capacityOfKeywords, UnicodeString* keywords, int3
return U_BUFFER_OVERFLOW_ERROR;
}
- if ( fNext != nullptr ) {
+ if ( fNext != nullptr ) {
return fNext->getKeywords(capacityOfKeywords, keywords, arraySize);
}
else {
@@ -1106,7 +1106,7 @@ RuleChain::isKeyword(const UnicodeString& keywordParam) const {
return TRUE;
}
- if ( fNext != nullptr ) {
+ if ( fNext != nullptr ) {
return fNext->isKeyword(keywordParam);
}
else {
@@ -1115,9 +1115,9 @@ RuleChain::isKeyword(const UnicodeString& keywordParam) const {
}
-PluralRuleParser::PluralRuleParser() :
- ruleIndex(0), token(), type(none), prevType(none),
- curAndConstraint(nullptr), currentChain(nullptr), rangeLowIdx(-1), rangeHiIdx(-1)
+PluralRuleParser::PluralRuleParser() :
+ ruleIndex(0), token(), type(none), prevType(none),
+ curAndConstraint(nullptr), currentChain(nullptr), rangeLowIdx(-1), rangeHiIdx(-1)
{
}
@@ -1218,8 +1218,8 @@ PluralRuleParser::checkSyntax(UErrorCode &status)
break;
case tNumber:
if (type != tDot2 && type != tSemiColon && type != tIs && type != tNot &&
- type != tIn && type != tEqual && type != tNotEqual && type != tWithin &&
- type != tAnd && type != tOr && type != tComma && type != tAt &&
+ type != tIn && type != tEqual && type != tNotEqual && type != tWithin &&
+ type != tAnd && type != tOr && type != tComma && type != tAt &&
type != tEOF)
{
status = U_UNEXPECTED_TOKEN;
@@ -1264,7 +1264,7 @@ PluralRuleParser::getNextToken(UErrorCode &status)
return;
}
int32_t curIndex= ruleIndex;
-
+
switch (type) {
case tColon:
case tSemiColon:
@@ -1369,7 +1369,7 @@ PluralRuleParser::charType(UChar ch) {
// Set token type for reserved words in the Plural Rule syntax.
-tokenType
+tokenType
PluralRuleParser::getKeyType(const UnicodeString &token, tokenType keyType)
{
if (keyType != tKeyword) {
@@ -1415,36 +1415,36 @@ PluralKeywordEnumeration::PluralKeywordEnumeration(RuleChain *header, UErrorCode
return;
}
fKeywordNames.setDeleter(uprv_deleteUObject);
- UBool addKeywordOther = TRUE;
- RuleChain *node = header;
- while (node != nullptr) {
- auto newElem = new UnicodeString(node->fKeyword);
- if (newElem == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- fKeywordNames.addElement(newElem, status);
+ UBool addKeywordOther = TRUE;
+ RuleChain *node = header;
+ while (node != nullptr) {
+ auto newElem = new UnicodeString(node->fKeyword);
+ if (newElem == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ fKeywordNames.addElement(newElem, status);
if (U_FAILURE(status)) {
- delete newElem;
+ delete newElem;
return;
}
if (0 == node->fKeyword.compare(PLURAL_KEYWORD_OTHER, 5)) {
- addKeywordOther = FALSE;
+ addKeywordOther = FALSE;
}
- node = node->fNext;
+ node = node->fNext;
}
if (addKeywordOther) {
- auto newElem = new UnicodeString(PLURAL_KEYWORD_OTHER);
- if (newElem == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- fKeywordNames.addElement(newElem, status);
- if (U_FAILURE(status)) {
- delete newElem;
- return;
- }
+ auto newElem = new UnicodeString(PLURAL_KEYWORD_OTHER);
+ if (newElem == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ fKeywordNames.addElement(newElem, status);
+ if (U_FAILURE(status)) {
+ delete newElem;
+ return;
+ }
}
}
@@ -1453,7 +1453,7 @@ PluralKeywordEnumeration::snext(UErrorCode& status) {
if (U_SUCCESS(status) && pos < fKeywordNames.size()) {
return (const UnicodeString*)fKeywordNames.elementAt(pos++);
}
- return nullptr;
+ return nullptr;
}
void
@@ -1463,27 +1463,27 @@ PluralKeywordEnumeration::reset(UErrorCode& /*status*/) {
int32_t
PluralKeywordEnumeration::count(UErrorCode& /*status*/) const {
- return fKeywordNames.size();
+ return fKeywordNames.size();
}
PluralKeywordEnumeration::~PluralKeywordEnumeration() {
}
-PluralOperand tokenTypeToPluralOperand(tokenType tt) {
- switch(tt) {
- case tVariableN:
- return PLURAL_OPERAND_N;
- case tVariableI:
- return PLURAL_OPERAND_I;
- case tVariableF:
- return PLURAL_OPERAND_F;
- case tVariableV:
- return PLURAL_OPERAND_V;
- case tVariableT:
- return PLURAL_OPERAND_T;
- default:
- UPRV_UNREACHABLE; // unexpected.
- }
+PluralOperand tokenTypeToPluralOperand(tokenType tt) {
+ switch(tt) {
+ case tVariableN:
+ return PLURAL_OPERAND_N;
+ case tVariableI:
+ return PLURAL_OPERAND_I;
+ case tVariableF:
+ return PLURAL_OPERAND_F;
+ case tVariableV:
+ return PLURAL_OPERAND_V;
+ case tVariableT:
+ return PLURAL_OPERAND_T;
+ default:
+ UPRV_UNREACHABLE; // unexpected.
+ }
}
FixedDecimal::FixedDecimal(double n, int32_t v, int64_t f) {
@@ -1523,14 +1523,14 @@ FixedDecimal::FixedDecimal() {
FixedDecimal::FixedDecimal(const UnicodeString &num, UErrorCode &status) {
CharString cs;
cs.appendInvariantChars(num, status);
- DecimalQuantity dl;
- dl.setToDecNumber(cs.toStringPiece(), status);
+ DecimalQuantity dl;
+ dl.setToDecNumber(cs.toStringPiece(), status);
if (U_FAILURE(status)) {
init(0, 0, 0);
return;
}
int32_t decimalPoint = num.indexOf(DOT);
- double n = dl.toDouble();
+ double n = dl.toDouble();
if (decimalPoint == -1) {
init(n, 0, 0);
} else {
@@ -1546,15 +1546,15 @@ FixedDecimal::FixedDecimal(const FixedDecimal &other) {
decimalDigits = other.decimalDigits;
decimalDigitsWithoutTrailingZeros = other.decimalDigitsWithoutTrailingZeros;
intValue = other.intValue;
- _hasIntegerValue = other._hasIntegerValue;
+ _hasIntegerValue = other._hasIntegerValue;
isNegative = other.isNegative;
- _isNaN = other._isNaN;
- _isInfinite = other._isInfinite;
+ _isNaN = other._isNaN;
+ _isInfinite = other._isInfinite;
}
-FixedDecimal::~FixedDecimal() = default;
+FixedDecimal::~FixedDecimal() = default;
+
-
void FixedDecimal::init(double n) {
int32_t numFractionDigits = decimals(n);
init(n, numFractionDigits, getFractionalDigits(n, numFractionDigits));
@@ -1564,16 +1564,16 @@ void FixedDecimal::init(double n) {
void FixedDecimal::init(double n, int32_t v, int64_t f) {
isNegative = n < 0.0;
source = fabs(n);
- _isNaN = uprv_isNaN(source);
- _isInfinite = uprv_isInfinite(source);
- if (_isNaN || _isInfinite) {
+ _isNaN = uprv_isNaN(source);
+ _isInfinite = uprv_isInfinite(source);
+ if (_isNaN || _isInfinite) {
v = 0;
f = 0;
intValue = 0;
- _hasIntegerValue = FALSE;
+ _hasIntegerValue = FALSE;
} else {
intValue = (int64_t)source;
- _hasIntegerValue = (source == intValue);
+ _hasIntegerValue = (source == intValue);
}
visibleDecimalDigitCount = v;
@@ -1635,7 +1635,7 @@ int32_t FixedDecimal::decimals(double n) {
if (buf[i] != '0') {
break;
}
- --numFractionDigits;
+ --numFractionDigits;
}
numFractionDigits -= exponent; // Fraction part of fixed point representation.
return numFractionDigits;
@@ -1685,36 +1685,36 @@ void FixedDecimal::adjustForMinFractionDigits(int32_t minFractionDigits) {
}
}
-
-double FixedDecimal::getPluralOperand(PluralOperand operand) const {
+
+double FixedDecimal::getPluralOperand(PluralOperand operand) const {
switch(operand) {
- case PLURAL_OPERAND_N: return source;
- case PLURAL_OPERAND_I: return static_cast<double>(intValue);
- case PLURAL_OPERAND_F: return static_cast<double>(decimalDigits);
- case PLURAL_OPERAND_T: return static_cast<double>(decimalDigitsWithoutTrailingZeros);
- case PLURAL_OPERAND_V: return visibleDecimalDigitCount;
- case PLURAL_OPERAND_E: return 0;
+ case PLURAL_OPERAND_N: return source;
+ case PLURAL_OPERAND_I: return static_cast<double>(intValue);
+ case PLURAL_OPERAND_F: return static_cast<double>(decimalDigits);
+ case PLURAL_OPERAND_T: return static_cast<double>(decimalDigitsWithoutTrailingZeros);
+ case PLURAL_OPERAND_V: return visibleDecimalDigitCount;
+ case PLURAL_OPERAND_E: return 0;
default:
- UPRV_UNREACHABLE; // unexpected.
- }
-}
-
-bool FixedDecimal::isNaN() const {
- return _isNaN;
-}
-
-bool FixedDecimal::isInfinite() const {
- return _isInfinite;
-}
-
-bool FixedDecimal::hasIntegerValue() const {
- return _hasIntegerValue;
-}
-
-bool FixedDecimal::isNanOrInfinity() const {
- return _isNaN || _isInfinite;
-}
-
+ UPRV_UNREACHABLE; // unexpected.
+ }
+}
+
+bool FixedDecimal::isNaN() const {
+ return _isNaN;
+}
+
+bool FixedDecimal::isInfinite() const {
+ return _isInfinite;
+}
+
+bool FixedDecimal::hasIntegerValue() const {
+ return _hasIntegerValue;
+}
+
+bool FixedDecimal::isNanOrInfinity() const {
+ return _isNaN || _isInfinite;
+}
+
int32_t FixedDecimal::getVisibleFractionDigitCount() const {
return visibleDecimalDigitCount;
}
@@ -1726,36 +1726,36 @@ PluralAvailableLocalesEnumeration::PluralAvailableLocalesEnumeration(UErrorCode
if (U_FAILURE(status)) {
return;
}
- fOpenStatus = U_ZERO_ERROR; // clear any warnings.
- LocalUResourceBundlePointer rb(ures_openDirect(nullptr, "plurals", &fOpenStatus));
- fLocales = ures_getByKey(rb.getAlias(), "locales", nullptr, &fOpenStatus);
+ fOpenStatus = U_ZERO_ERROR; // clear any warnings.
+ LocalUResourceBundlePointer rb(ures_openDirect(nullptr, "plurals", &fOpenStatus));
+ fLocales = ures_getByKey(rb.getAlias(), "locales", nullptr, &fOpenStatus);
}
PluralAvailableLocalesEnumeration::~PluralAvailableLocalesEnumeration() {
ures_close(fLocales);
ures_close(fRes);
- fLocales = nullptr;
- fRes = nullptr;
+ fLocales = nullptr;
+ fRes = nullptr;
}
const char *PluralAvailableLocalesEnumeration::next(int32_t *resultLength, UErrorCode &status) {
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
if (U_FAILURE(fOpenStatus)) {
status = fOpenStatus;
- return nullptr;
+ return nullptr;
}
fRes = ures_getNextResource(fLocales, fRes, &status);
- if (fRes == nullptr || U_FAILURE(status)) {
+ if (fRes == nullptr || U_FAILURE(status)) {
if (status == U_INDEX_OUTOFBOUNDS_ERROR) {
status = U_ZERO_ERROR;
}
- return nullptr;
+ return nullptr;
}
const char *result = ures_getKey(fRes);
- if (resultLength != nullptr) {
- *resultLength = static_cast<int32_t>(uprv_strlen(result));
+ if (resultLength != nullptr) {
+ *resultLength = static_cast<int32_t>(uprv_strlen(result));
}
return result;
}
diff --git a/contrib/libs/icu/i18n/plurrule_impl.h b/contrib/libs/icu/i18n/plurrule_impl.h
index 90f1c0b21f..0dc44fb62e 100644
--- a/contrib/libs/icu/i18n/plurrule_impl.h
+++ b/contrib/libs/icu/i18n/plurrule_impl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -24,11 +24,11 @@
#include "unicode/format.h"
#include "unicode/locid.h"
#include "unicode/parseerr.h"
-#include "unicode/strenum.h"
+#include "unicode/strenum.h"
#include "unicode/ures.h"
#include "uvector.h"
#include "hash.h"
-#include "uassert.h"
+#include "uassert.h"
class PluralRulesTest;
@@ -40,75 +40,75 @@ class DigitInterval;
class PluralRules;
class VisibleDigits;
-namespace pluralimpl {
-
-// TODO: Remove this and replace with u"" literals. Was for EBCDIC compatibility.
-
-static const UChar DOT = ((UChar) 0x002E);
-static const UChar SINGLE_QUOTE = ((UChar) 0x0027);
-static const UChar SLASH = ((UChar) 0x002F);
-static const UChar BACKSLASH = ((UChar) 0x005C);
-static const UChar SPACE = ((UChar) 0x0020);
-static const UChar EXCLAMATION = ((UChar) 0x0021);
-static const UChar QUOTATION_MARK = ((UChar) 0x0022);
-static const UChar NUMBER_SIGN = ((UChar) 0x0023);
-static const UChar PERCENT_SIGN = ((UChar) 0x0025);
-static const UChar ASTERISK = ((UChar) 0x002A);
-static const UChar COMMA = ((UChar) 0x002C);
-static const UChar HYPHEN = ((UChar) 0x002D);
-static const UChar U_ZERO = ((UChar) 0x0030);
-static const UChar U_ONE = ((UChar) 0x0031);
-static const UChar U_TWO = ((UChar) 0x0032);
-static const UChar U_THREE = ((UChar) 0x0033);
-static const UChar U_FOUR = ((UChar) 0x0034);
-static const UChar U_FIVE = ((UChar) 0x0035);
-static const UChar U_SIX = ((UChar) 0x0036);
-static const UChar U_SEVEN = ((UChar) 0x0037);
-static const UChar U_EIGHT = ((UChar) 0x0038);
-static const UChar U_NINE = ((UChar) 0x0039);
-static const UChar COLON = ((UChar) 0x003A);
-static const UChar SEMI_COLON = ((UChar) 0x003B);
-static const UChar EQUALS = ((UChar) 0x003D);
-static const UChar AT = ((UChar) 0x0040);
-static const UChar CAP_A = ((UChar) 0x0041);
-static const UChar CAP_B = ((UChar) 0x0042);
-static const UChar CAP_R = ((UChar) 0x0052);
-static const UChar CAP_Z = ((UChar) 0x005A);
-static const UChar LOWLINE = ((UChar) 0x005F);
-static const UChar LEFTBRACE = ((UChar) 0x007B);
-static const UChar RIGHTBRACE = ((UChar) 0x007D);
-static const UChar TILDE = ((UChar) 0x007E);
-static const UChar ELLIPSIS = ((UChar) 0x2026);
-
-static const UChar LOW_A = ((UChar) 0x0061);
-static const UChar LOW_B = ((UChar) 0x0062);
-static const UChar LOW_C = ((UChar) 0x0063);
-static const UChar LOW_D = ((UChar) 0x0064);
-static const UChar LOW_E = ((UChar) 0x0065);
-static const UChar LOW_F = ((UChar) 0x0066);
-static const UChar LOW_G = ((UChar) 0x0067);
-static const UChar LOW_H = ((UChar) 0x0068);
-static const UChar LOW_I = ((UChar) 0x0069);
-static const UChar LOW_J = ((UChar) 0x006a);
-static const UChar LOW_K = ((UChar) 0x006B);
-static const UChar LOW_L = ((UChar) 0x006C);
-static const UChar LOW_M = ((UChar) 0x006D);
-static const UChar LOW_N = ((UChar) 0x006E);
-static const UChar LOW_O = ((UChar) 0x006F);
-static const UChar LOW_P = ((UChar) 0x0070);
-static const UChar LOW_Q = ((UChar) 0x0071);
-static const UChar LOW_R = ((UChar) 0x0072);
-static const UChar LOW_S = ((UChar) 0x0073);
-static const UChar LOW_T = ((UChar) 0x0074);
-static const UChar LOW_U = ((UChar) 0x0075);
-static const UChar LOW_V = ((UChar) 0x0076);
-static const UChar LOW_W = ((UChar) 0x0077);
-static const UChar LOW_Y = ((UChar) 0x0079);
-static const UChar LOW_Z = ((UChar) 0x007A);
-
-}
-
-
+namespace pluralimpl {
+
+// TODO: Remove this and replace with u"" literals. Was for EBCDIC compatibility.
+
+static const UChar DOT = ((UChar) 0x002E);
+static const UChar SINGLE_QUOTE = ((UChar) 0x0027);
+static const UChar SLASH = ((UChar) 0x002F);
+static const UChar BACKSLASH = ((UChar) 0x005C);
+static const UChar SPACE = ((UChar) 0x0020);
+static const UChar EXCLAMATION = ((UChar) 0x0021);
+static const UChar QUOTATION_MARK = ((UChar) 0x0022);
+static const UChar NUMBER_SIGN = ((UChar) 0x0023);
+static const UChar PERCENT_SIGN = ((UChar) 0x0025);
+static const UChar ASTERISK = ((UChar) 0x002A);
+static const UChar COMMA = ((UChar) 0x002C);
+static const UChar HYPHEN = ((UChar) 0x002D);
+static const UChar U_ZERO = ((UChar) 0x0030);
+static const UChar U_ONE = ((UChar) 0x0031);
+static const UChar U_TWO = ((UChar) 0x0032);
+static const UChar U_THREE = ((UChar) 0x0033);
+static const UChar U_FOUR = ((UChar) 0x0034);
+static const UChar U_FIVE = ((UChar) 0x0035);
+static const UChar U_SIX = ((UChar) 0x0036);
+static const UChar U_SEVEN = ((UChar) 0x0037);
+static const UChar U_EIGHT = ((UChar) 0x0038);
+static const UChar U_NINE = ((UChar) 0x0039);
+static const UChar COLON = ((UChar) 0x003A);
+static const UChar SEMI_COLON = ((UChar) 0x003B);
+static const UChar EQUALS = ((UChar) 0x003D);
+static const UChar AT = ((UChar) 0x0040);
+static const UChar CAP_A = ((UChar) 0x0041);
+static const UChar CAP_B = ((UChar) 0x0042);
+static const UChar CAP_R = ((UChar) 0x0052);
+static const UChar CAP_Z = ((UChar) 0x005A);
+static const UChar LOWLINE = ((UChar) 0x005F);
+static const UChar LEFTBRACE = ((UChar) 0x007B);
+static const UChar RIGHTBRACE = ((UChar) 0x007D);
+static const UChar TILDE = ((UChar) 0x007E);
+static const UChar ELLIPSIS = ((UChar) 0x2026);
+
+static const UChar LOW_A = ((UChar) 0x0061);
+static const UChar LOW_B = ((UChar) 0x0062);
+static const UChar LOW_C = ((UChar) 0x0063);
+static const UChar LOW_D = ((UChar) 0x0064);
+static const UChar LOW_E = ((UChar) 0x0065);
+static const UChar LOW_F = ((UChar) 0x0066);
+static const UChar LOW_G = ((UChar) 0x0067);
+static const UChar LOW_H = ((UChar) 0x0068);
+static const UChar LOW_I = ((UChar) 0x0069);
+static const UChar LOW_J = ((UChar) 0x006a);
+static const UChar LOW_K = ((UChar) 0x006B);
+static const UChar LOW_L = ((UChar) 0x006C);
+static const UChar LOW_M = ((UChar) 0x006D);
+static const UChar LOW_N = ((UChar) 0x006E);
+static const UChar LOW_O = ((UChar) 0x006F);
+static const UChar LOW_P = ((UChar) 0x0070);
+static const UChar LOW_Q = ((UChar) 0x0071);
+static const UChar LOW_R = ((UChar) 0x0072);
+static const UChar LOW_S = ((UChar) 0x0073);
+static const UChar LOW_T = ((UChar) 0x0074);
+static const UChar LOW_U = ((UChar) 0x0075);
+static const UChar LOW_V = ((UChar) 0x0076);
+static const UChar LOW_W = ((UChar) 0x0077);
+static const UChar LOW_Y = ((UChar) 0x0079);
+static const UChar LOW_Z = ((UChar) 0x007A);
+
+}
+
+
static const int32_t PLURAL_RANGE_HIGH = 0x7fffffff;
enum tokenType {
@@ -181,93 +181,93 @@ private:
kRangeList,
kSamples
};
-};
-
-enum PluralOperand {
- /**
- * The double value of the entire number.
- */
- PLURAL_OPERAND_N,
-
- /**
- * The integer value, with the fraction digits truncated off.
- */
- PLURAL_OPERAND_I,
-
- /**
- * All visible fraction digits as an integer, including trailing zeros.
- */
- PLURAL_OPERAND_F,
-
- /**
- * Visible fraction digits as an integer, not including trailing zeros.
- */
- PLURAL_OPERAND_T,
-
- /**
- * Number of visible fraction digits.
- */
- PLURAL_OPERAND_V,
-
- /**
- * Number of visible fraction digits, not including trailing zeros.
- */
- PLURAL_OPERAND_W,
-
- /**
- * Suppressed exponent for compact notation (exponent needed in
- * scientific notation with compact notation to approximate i).
- */
- PLURAL_OPERAND_E,
-
- /**
- * THIS OPERAND IS DEPRECATED AND HAS BEEN REMOVED FROM THE SPEC.
- *
- * <p>Returns the integer value, but will fail if the number has fraction digits.
- * That is, using "j" instead of "i" is like implicitly adding "v is 0".
- *
- * <p>For example, "j is 3" is equivalent to "i is 3 and v is 0": it matches
- * "3" but not "3.1" or "3.0".
- */
- PLURAL_OPERAND_J
+};
+
+enum PluralOperand {
+ /**
+ * The double value of the entire number.
+ */
+ PLURAL_OPERAND_N,
+
+ /**
+ * The integer value, with the fraction digits truncated off.
+ */
+ PLURAL_OPERAND_I,
+
+ /**
+ * All visible fraction digits as an integer, including trailing zeros.
+ */
+ PLURAL_OPERAND_F,
+
+ /**
+ * Visible fraction digits as an integer, not including trailing zeros.
+ */
+ PLURAL_OPERAND_T,
+
+ /**
+ * Number of visible fraction digits.
+ */
+ PLURAL_OPERAND_V,
+
+ /**
+ * Number of visible fraction digits, not including trailing zeros.
+ */
+ PLURAL_OPERAND_W,
+
+ /**
+ * Suppressed exponent for compact notation (exponent needed in
+ * scientific notation with compact notation to approximate i).
+ */
+ PLURAL_OPERAND_E,
+
+ /**
+ * THIS OPERAND IS DEPRECATED AND HAS BEEN REMOVED FROM THE SPEC.
+ *
+ * <p>Returns the integer value, but will fail if the number has fraction digits.
+ * That is, using "j" instead of "i" is like implicitly adding "v is 0".
+ *
+ * <p>For example, "j is 3" is equivalent to "i is 3 and v is 0": it matches
+ * "3" but not "3.1" or "3.0".
+ */
+ PLURAL_OPERAND_J
+};
+
+/**
+ * Converts from the tokenType enum to PluralOperand. Asserts that the given
+ * tokenType can be mapped to a PluralOperand.
+ */
+PluralOperand tokenTypeToPluralOperand(tokenType tt);
+
+/**
+ * An interface to FixedDecimal, allowing for other implementations.
+ * @internal
+ */
+class U_I18N_API IFixedDecimal {
+ public:
+ virtual ~IFixedDecimal();
+
+ /**
+ * Returns the value corresponding to the specified operand (n, i, f, t, v, or w).
+ * If the operand is 'n', returns a double; otherwise, returns an integer.
+ */
+ virtual double getPluralOperand(PluralOperand operand) const = 0;
+
+ virtual bool isNaN() const = 0;
+
+ virtual bool isInfinite() const = 0;
+
+ /** Whether the number has no nonzero fraction digits. */
+ virtual bool hasIntegerValue() const = 0;
};
/**
- * Converts from the tokenType enum to PluralOperand. Asserts that the given
- * tokenType can be mapped to a PluralOperand.
- */
-PluralOperand tokenTypeToPluralOperand(tokenType tt);
-
-/**
- * An interface to FixedDecimal, allowing for other implementations.
- * @internal
- */
-class U_I18N_API IFixedDecimal {
- public:
- virtual ~IFixedDecimal();
-
- /**
- * Returns the value corresponding to the specified operand (n, i, f, t, v, or w).
- * If the operand is 'n', returns a double; otherwise, returns an integer.
- */
- virtual double getPluralOperand(PluralOperand operand) const = 0;
-
- virtual bool isNaN() const = 0;
-
- virtual bool isInfinite() const = 0;
-
- /** Whether the number has no nonzero fraction digits. */
- virtual bool hasIntegerValue() const = 0;
-};
-
-/**
* class FixedDecimal serves to communicate the properties
* of a formatted number from a decimal formatter to PluralRules::select()
*
* see DecimalFormat::getFixedDecimal()
* @internal
*/
-class U_I18N_API FixedDecimal: public IFixedDecimal, public UObject {
+class U_I18N_API FixedDecimal: public IFixedDecimal, public UObject {
public:
/**
* @param n the number, e.g. 12.345
@@ -278,17 +278,17 @@ class U_I18N_API FixedDecimal: public IFixedDecimal, public UObject {
FixedDecimal(double n, int32_t);
explicit FixedDecimal(double n);
FixedDecimal();
- ~FixedDecimal() U_OVERRIDE;
+ ~FixedDecimal() U_OVERRIDE;
FixedDecimal(const UnicodeString &s, UErrorCode &ec);
FixedDecimal(const FixedDecimal &other);
- double getPluralOperand(PluralOperand operand) const U_OVERRIDE;
- bool isNaN() const U_OVERRIDE;
- bool isInfinite() const U_OVERRIDE;
- bool hasIntegerValue() const U_OVERRIDE;
-
- bool isNanOrInfinity() const; // used in decimfmtimpl.cpp
-
+ double getPluralOperand(PluralOperand operand) const U_OVERRIDE;
+ bool isNaN() const U_OVERRIDE;
+ bool isInfinite() const U_OVERRIDE;
+ bool hasIntegerValue() const U_OVERRIDE;
+
+ bool isNanOrInfinity() const; // used in decimfmtimpl.cpp
+
int32_t getVisibleFractionDigitCount() const;
void init(double n, int32_t v, int64_t f);
@@ -304,10 +304,10 @@ class U_I18N_API FixedDecimal: public IFixedDecimal, public UObject {
int64_t decimalDigits;
int64_t decimalDigitsWithoutTrailingZeros;
int64_t intValue;
- UBool _hasIntegerValue;
+ UBool _hasIntegerValue;
UBool isNegative;
- UBool _isNaN;
- UBool _isInfinite;
+ UBool _isNaN;
+ UBool _isInfinite;
};
class AndConstraint : public UMemory {
@@ -316,57 +316,57 @@ public:
NONE,
MOD
} RuleOp;
- RuleOp op = AndConstraint::NONE;
- int32_t opNum = -1; // for mod expressions, the right operand of the mod.
- int32_t value = -1; // valid for 'is' rules only.
- UVector32 *rangeList = nullptr; // for 'in', 'within' rules. Null otherwise.
- UBool negated = FALSE; // TRUE for negated rules.
- UBool integerOnly = FALSE; // TRUE for 'within' rules.
- tokenType digitsType = none; // n | i | v | f constraint.
- AndConstraint *next = nullptr;
- // Internal error status, used for errors that occur during the copy constructor.
- UErrorCode fInternalStatus = U_ZERO_ERROR;
-
- AndConstraint() = default;
+ RuleOp op = AndConstraint::NONE;
+ int32_t opNum = -1; // for mod expressions, the right operand of the mod.
+ int32_t value = -1; // valid for 'is' rules only.
+ UVector32 *rangeList = nullptr; // for 'in', 'within' rules. Null otherwise.
+ UBool negated = FALSE; // TRUE for negated rules.
+ UBool integerOnly = FALSE; // TRUE for 'within' rules.
+ tokenType digitsType = none; // n | i | v | f constraint.
+ AndConstraint *next = nullptr;
+ // Internal error status, used for errors that occur during the copy constructor.
+ UErrorCode fInternalStatus = U_ZERO_ERROR;
+
+ AndConstraint() = default;
AndConstraint(const AndConstraint& other);
virtual ~AndConstraint();
- AndConstraint* add(UErrorCode& status);
+ AndConstraint* add(UErrorCode& status);
// UBool isFulfilled(double number);
- UBool isFulfilled(const IFixedDecimal &number);
+ UBool isFulfilled(const IFixedDecimal &number);
};
class OrConstraint : public UMemory {
public:
- AndConstraint *childNode = nullptr;
- OrConstraint *next = nullptr;
- // Internal error status, used for errors that occur during the copy constructor.
- UErrorCode fInternalStatus = U_ZERO_ERROR;
+ AndConstraint *childNode = nullptr;
+ OrConstraint *next = nullptr;
+ // Internal error status, used for errors that occur during the copy constructor.
+ UErrorCode fInternalStatus = U_ZERO_ERROR;
- OrConstraint() = default;
+ OrConstraint() = default;
OrConstraint(const OrConstraint& other);
virtual ~OrConstraint();
- AndConstraint* add(UErrorCode& status);
+ AndConstraint* add(UErrorCode& status);
// UBool isFulfilled(double number);
- UBool isFulfilled(const IFixedDecimal &number);
+ UBool isFulfilled(const IFixedDecimal &number);
};
class RuleChain : public UMemory {
public:
UnicodeString fKeyword;
- RuleChain *fNext = nullptr;
- OrConstraint *ruleHeader = nullptr;
+ RuleChain *fNext = nullptr;
+ OrConstraint *ruleHeader = nullptr;
UnicodeString fDecimalSamples; // Samples strings from rule source
UnicodeString fIntegerSamples; // without @decimal or @integer, otherwise unprocessed.
- UBool fDecimalSamplesUnbounded = FALSE;
- UBool fIntegerSamplesUnbounded = FALSE;
- // Internal error status, used for errors that occur during the copy constructor.
- UErrorCode fInternalStatus = U_ZERO_ERROR;
+ UBool fDecimalSamplesUnbounded = FALSE;
+ UBool fIntegerSamplesUnbounded = FALSE;
+ // Internal error status, used for errors that occur during the copy constructor.
+ UErrorCode fInternalStatus = U_ZERO_ERROR;
- RuleChain() = default;
+ RuleChain() = default;
RuleChain(const RuleChain& other);
virtual ~RuleChain();
- UnicodeString select(const IFixedDecimal &number) const;
+ UnicodeString select(const IFixedDecimal &number) const;
void dumpRules(UnicodeString& result);
UErrorCode getKeywords(int32_t maxArraySize, UnicodeString *keywords, int32_t& arraySize) const;
UBool isKeyword(const UnicodeString& keyword) const;
@@ -396,8 +396,8 @@ class U_I18N_API PluralAvailableLocalesEnumeration: public StringEnumeration {
virtual int32_t count(UErrorCode& status) const;
private:
UErrorCode fOpenStatus;
- UResourceBundle *fLocales = nullptr;
- UResourceBundle *fRes = nullptr;
+ UResourceBundle *fLocales = nullptr;
+ UResourceBundle *fRes = nullptr;
};
U_NAMESPACE_END
diff --git a/contrib/libs/icu/i18n/quant.cpp b/contrib/libs/icu/i18n/quant.cpp
index 22ee5e8311..ed33933387 100644
--- a/contrib/libs/icu/i18n/quant.cpp
+++ b/contrib/libs/icu/i18n/quant.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -47,7 +47,7 @@ Quantifier::~Quantifier() {
/**
* Implement UnicodeFunctor
*/
-Quantifier* Quantifier::clone() const {
+Quantifier* Quantifier::clone() const {
return new Quantifier(*this);
}
diff --git a/contrib/libs/icu/i18n/quant.h b/contrib/libs/icu/i18n/quant.h
index c81a14c6be..d5aa8e5eee 100644
--- a/contrib/libs/icu/i18n/quant.h
+++ b/contrib/libs/icu/i18n/quant.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -45,7 +45,7 @@ class Quantifier : public UnicodeFunctor, public UnicodeMatcher {
* Implement UnicodeFunctor
* @return a copy of the object.
*/
- virtual Quantifier* clone() const;
+ virtual Quantifier* clone() const;
/**
* Implement UnicodeMatcher
diff --git a/contrib/libs/icu/i18n/quantityformatter.cpp b/contrib/libs/icu/i18n/quantityformatter.cpp
index 88d3f5ffac..9c9aa99b67 100644
--- a/contrib/libs/icu/i18n/quantityformatter.cpp
+++ b/contrib/libs/icu/i18n/quantityformatter.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -24,9 +24,9 @@
#include "unicode/fieldpos.h"
#include "standardplural.h"
#include "uassert.h"
-#include "number_decimalquantity.h"
-#include "number_utypes.h"
-#include "formatted_string_builder.h"
+#include "number_decimalquantity.h"
+#include "number_utypes.h"
+#include "formatted_string_builder.h"
U_NAMESPACE_BEGIN
@@ -153,13 +153,13 @@ StandardPlural::Form QuantityFormatter::selectPlural(
UnicodeString pluralKeyword;
const DecimalFormat *decFmt = dynamic_cast<const DecimalFormat *>(&fmt);
if (decFmt != NULL) {
- number::impl::DecimalQuantity dq;
- decFmt->formatToDecimalQuantity(number, dq, status);
+ number::impl::DecimalQuantity dq;
+ decFmt->formatToDecimalQuantity(number, dq, status);
if (U_FAILURE(status)) {
return StandardPlural::OTHER;
}
- pluralKeyword = rules.select(dq);
- decFmt->format(number, formattedNumber, pos, status);
+ pluralKeyword = rules.select(dq);
+ decFmt->format(number, formattedNumber, pos, status);
} else {
if (number.getType() == Formattable::kDouble) {
pluralKeyword = rules.select(number.getDouble());
@@ -176,44 +176,44 @@ StandardPlural::Form QuantityFormatter::selectPlural(
return StandardPlural::orOtherFromString(pluralKeyword);
}
-void QuantityFormatter::formatAndSelect(
- double quantity,
- const NumberFormat& fmt,
- const PluralRules& rules,
- FormattedStringBuilder& output,
- StandardPlural::Form& pluralForm,
- UErrorCode& status) {
- UnicodeString pluralKeyword;
- const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(&fmt);
- if (df != nullptr) {
- number::impl::UFormattedNumberData fn;
- fn.quantity.setToDouble(quantity);
- const number::LocalizedNumberFormatter* lnf = df->toNumberFormatter(status);
- if (U_FAILURE(status)) {
- return;
- }
- lnf->formatImpl(&fn, status);
- if (U_FAILURE(status)) {
- return;
- }
- output = std::move(fn.getStringRef());
- pluralKeyword = rules.select(fn.quantity);
- } else {
- UnicodeString result;
- fmt.format(quantity, result, status);
- if (U_FAILURE(status)) {
- return;
- }
- // This code path is probably RBNF. Use the generic numeric field.
- output.append(result, kGeneralNumericField, status);
- if (U_FAILURE(status)) {
- return;
- }
- pluralKeyword = rules.select(quantity);
- }
- pluralForm = StandardPlural::orOtherFromString(pluralKeyword);
-}
-
+void QuantityFormatter::formatAndSelect(
+ double quantity,
+ const NumberFormat& fmt,
+ const PluralRules& rules,
+ FormattedStringBuilder& output,
+ StandardPlural::Form& pluralForm,
+ UErrorCode& status) {
+ UnicodeString pluralKeyword;
+ const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(&fmt);
+ if (df != nullptr) {
+ number::impl::UFormattedNumberData fn;
+ fn.quantity.setToDouble(quantity);
+ const number::LocalizedNumberFormatter* lnf = df->toNumberFormatter(status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ lnf->formatImpl(&fn, status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ output = std::move(fn.getStringRef());
+ pluralKeyword = rules.select(fn.quantity);
+ } else {
+ UnicodeString result;
+ fmt.format(quantity, result, status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ // This code path is probably RBNF. Use the generic numeric field.
+ output.append(result, kGeneralNumericField, status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ pluralKeyword = rules.select(quantity);
+ }
+ pluralForm = StandardPlural::orOtherFromString(pluralKeyword);
+}
+
UnicodeString &QuantityFormatter::format(
const SimpleFormatter &pattern,
const UnicodeString &value,
diff --git a/contrib/libs/icu/i18n/quantityformatter.h b/contrib/libs/icu/i18n/quantityformatter.h
index 3089f38e06..daaef4f060 100644
--- a/contrib/libs/icu/i18n/quantityformatter.h
+++ b/contrib/libs/icu/i18n/quantityformatter.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -26,7 +26,7 @@ class PluralRules;
class NumberFormat;
class Formattable;
class FieldPosition;
-class FormattedStringBuilder;
+class FormattedStringBuilder;
/**
* A plural aware formatter that is good for expressing a single quantity and
@@ -112,7 +112,7 @@ public:
/**
* Selects the standard plural form for the number/formatter/rules.
- * TODO(13591): Remove this method.
+ * TODO(13591): Remove this method.
*/
static StandardPlural::Form selectPlural(
const Formattable &number,
@@ -123,29 +123,29 @@ public:
UErrorCode &status);
/**
- * Formats a quantity and selects its plural form. The output is appended
- * to a FormattedStringBuilder in order to retain field information.
- *
- * @param quantity The number to format.
- * @param fmt The formatter to use to format the number.
- * @param rules The rules to use to select the plural form of the
- * formatted number.
- * @param output Where to append the result of the format operation.
- * @param pluralForm Output variable populated with the plural form of the
- * formatted number.
- * @param status Set if an error occurs.
- */
- static void formatAndSelect(
- double quantity,
- const NumberFormat& fmt,
- const PluralRules& rules,
- FormattedStringBuilder& output,
- StandardPlural::Form& pluralForm,
- UErrorCode& status);
-
- /**
+ * Formats a quantity and selects its plural form. The output is appended
+ * to a FormattedStringBuilder in order to retain field information.
+ *
+ * @param quantity The number to format.
+ * @param fmt The formatter to use to format the number.
+ * @param rules The rules to use to select the plural form of the
+ * formatted number.
+ * @param output Where to append the result of the format operation.
+ * @param pluralForm Output variable populated with the plural form of the
+ * formatted number.
+ * @param status Set if an error occurs.
+ */
+ static void formatAndSelect(
+ double quantity,
+ const NumberFormat& fmt,
+ const PluralRules& rules,
+ FormattedStringBuilder& output,
+ StandardPlural::Form& pluralForm,
+ UErrorCode& status);
+
+ /**
* Formats the pattern with the value and adjusts the FieldPosition.
- * TODO: Remove?
+ * TODO: Remove?
*/
static UnicodeString &format(
const SimpleFormatter &pattern,
diff --git a/contrib/libs/icu/i18n/rbnf.cpp b/contrib/libs/icu/i18n/rbnf.cpp
index 0491082c7c..17319fb6d5 100644
--- a/contrib/libs/icu/i18n/rbnf.cpp
+++ b/contrib/libs/icu/i18n/rbnf.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -27,14 +27,14 @@
#include "unicode/udata.h"
#include "unicode/udisplaycontext.h"
#include "unicode/brkiter.h"
-#include "unicode/ucasemap.h"
+#include "unicode/ucasemap.h"
#include "cmemory.h"
#include "cstring.h"
#include "patternprops.h"
#include "uresimp.h"
-#include "nfrs.h"
-#include "number_decimalquantity.h"
+#include "nfrs.h"
+#include "number_decimalquantity.h"
// debugging
// #define RBNF_DEBUG
@@ -68,8 +68,8 @@ static const UChar gSemiPercent[] =
U_NAMESPACE_BEGIN
-using number::impl::DecimalQuantity;
-
+using number::impl::DecimalQuantity;
+
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RuleBasedNumberFormat)
/*
@@ -318,34 +318,34 @@ public:
private:
- inline void inc(void) {
- ++p;
- ch = 0xffff;
- }
- inline UBool checkInc(UChar c) {
- if (p < e && (ch == c || *p == c)) {
- inc();
- return TRUE;
- }
- return FALSE;
- }
- inline UBool check(UChar c) {
- return p < e && (ch == c || *p == c);
- }
- inline void skipWhitespace(void) {
- while (p < e && PatternProps::isWhiteSpace(ch != 0xffff ? ch : *p)) {
- inc();
- }
- }
- inline UBool inList(UChar c, const UChar* list) const {
- if (*list == SPACE && PatternProps::isWhiteSpace(c)) {
- return TRUE;
- }
- while (*list && *list != c) {
- ++list;
- }
- return *list == c;
- }
+ inline void inc(void) {
+ ++p;
+ ch = 0xffff;
+ }
+ inline UBool checkInc(UChar c) {
+ if (p < e && (ch == c || *p == c)) {
+ inc();
+ return TRUE;
+ }
+ return FALSE;
+ }
+ inline UBool check(UChar c) {
+ return p < e && (ch == c || *p == c);
+ }
+ inline void skipWhitespace(void) {
+ while (p < e && PatternProps::isWhiteSpace(ch != 0xffff ? ch : *p)) {
+ inc();
+ }
+ }
+ inline UBool inList(UChar c, const UChar* list) const {
+ if (*list == SPACE && PatternProps::isWhiteSpace(c)) {
+ return TRUE;
+ }
+ while (*list && *list != c) {
+ ++list;
+ }
+ return *list == c;
+ }
void parseError(const char* msg);
StringLocalizationInfo* doParse(void);
@@ -355,16 +355,16 @@ private:
};
#ifdef RBNF_DEBUG
-#define ERROR(msg) UPRV_BLOCK_MACRO_BEGIN { \
- parseError(msg); \
- return NULL; \
-} UPRV_BLOCK_MACRO_END
+#define ERROR(msg) UPRV_BLOCK_MACRO_BEGIN { \
+ parseError(msg); \
+ return NULL; \
+} UPRV_BLOCK_MACRO_END
#define EXPLANATION_ARG explanationArg
#else
-#define ERROR(msg) UPRV_BLOCK_MACRO_BEGIN { \
- parseError(NULL); \
- return NULL; \
-} UPRV_BLOCK_MACRO_END
+#define ERROR(msg) UPRV_BLOCK_MACRO_BEGIN { \
+ parseError(NULL); \
+ return NULL; \
+} UPRV_BLOCK_MACRO_END
#define EXPLANATION_ARG
#endif
@@ -686,7 +686,7 @@ StringLocalizationInfo::getDisplayName(int32_t localeIndex, int32_t ruleIndex) c
RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
const UnicodeString& locs,
const Locale& alocale, UParseError& perror, UErrorCode& status)
- : fRuleSets(NULL)
+ : fRuleSets(NULL)
, ruleSetDescriptions(NULL)
, numRuleSets(0)
, defaultRuleSet(NULL)
@@ -695,7 +695,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
, decimalFormatSymbols(NULL)
, defaultInfinityRule(NULL)
, defaultNaNRule(NULL)
- , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
+ , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
, lenient(FALSE)
, lenientParseRules(NULL)
, localizations(NULL)
@@ -711,7 +711,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
const UnicodeString& locs,
UParseError& perror, UErrorCode& status)
- : fRuleSets(NULL)
+ : fRuleSets(NULL)
, ruleSetDescriptions(NULL)
, numRuleSets(0)
, defaultRuleSet(NULL)
@@ -720,7 +720,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
, decimalFormatSymbols(NULL)
, defaultInfinityRule(NULL)
, defaultNaNRule(NULL)
- , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
+ , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
, lenient(FALSE)
, lenientParseRules(NULL)
, localizations(NULL)
@@ -736,7 +736,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
LocalizationInfo* info,
const Locale& alocale, UParseError& perror, UErrorCode& status)
- : fRuleSets(NULL)
+ : fRuleSets(NULL)
, ruleSetDescriptions(NULL)
, numRuleSets(0)
, defaultRuleSet(NULL)
@@ -745,7 +745,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
, decimalFormatSymbols(NULL)
, defaultInfinityRule(NULL)
, defaultNaNRule(NULL)
- , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
+ , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
, lenient(FALSE)
, lenientParseRules(NULL)
, localizations(NULL)
@@ -760,7 +760,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
UParseError& perror,
UErrorCode& status)
- : fRuleSets(NULL)
+ : fRuleSets(NULL)
, ruleSetDescriptions(NULL)
, numRuleSets(0)
, defaultRuleSet(NULL)
@@ -769,7 +769,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
, decimalFormatSymbols(NULL)
, defaultInfinityRule(NULL)
, defaultNaNRule(NULL)
- , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
+ , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
, lenient(FALSE)
, lenientParseRules(NULL)
, localizations(NULL)
@@ -785,7 +785,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
const Locale& aLocale,
UParseError& perror,
UErrorCode& status)
- : fRuleSets(NULL)
+ : fRuleSets(NULL)
, ruleSetDescriptions(NULL)
, numRuleSets(0)
, defaultRuleSet(NULL)
@@ -794,7 +794,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
, decimalFormatSymbols(NULL)
, defaultInfinityRule(NULL)
, defaultNaNRule(NULL)
- , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
+ , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
, lenient(FALSE)
, lenientParseRules(NULL)
, localizations(NULL)
@@ -807,7 +807,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
}
RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale& alocale, UErrorCode& status)
- : fRuleSets(NULL)
+ : fRuleSets(NULL)
, ruleSetDescriptions(NULL)
, numRuleSets(0)
, defaultRuleSet(NULL)
@@ -816,7 +816,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale&
, decimalFormatSymbols(NULL)
, defaultInfinityRule(NULL)
, defaultNaNRule(NULL)
- , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
+ , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
, lenient(FALSE)
, lenientParseRules(NULL)
, localizations(NULL)
@@ -874,7 +874,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale&
RuleBasedNumberFormat::RuleBasedNumberFormat(const RuleBasedNumberFormat& rhs)
: NumberFormat(rhs)
- , fRuleSets(NULL)
+ , fRuleSets(NULL)
, ruleSetDescriptions(NULL)
, numRuleSets(0)
, defaultRuleSet(NULL)
@@ -883,7 +883,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const RuleBasedNumberFormat& rhs)
, decimalFormatSymbols(NULL)
, defaultInfinityRule(NULL)
, defaultNaNRule(NULL)
- , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
+ , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
, lenient(FALSE)
, lenientParseRules(NULL)
, localizations(NULL)
@@ -913,7 +913,7 @@ RuleBasedNumberFormat::operator=(const RuleBasedNumberFormat& rhs)
setDecimalFormatSymbols(*rhs.getDecimalFormatSymbols());
init(rhs.originalDescription, rhs.localizations ? rhs.localizations->ref() : NULL, perror, status);
setDefaultRuleSet(rhs.getDefaultRuleSetName(), status);
- setRoundingMode(rhs.getRoundingMode());
+ setRoundingMode(rhs.getRoundingMode());
capitalizationInfoSet = rhs.capitalizationInfoSet;
capitalizationForUIListMenu = rhs.capitalizationForUIListMenu;
@@ -930,8 +930,8 @@ RuleBasedNumberFormat::~RuleBasedNumberFormat()
dispose();
}
-RuleBasedNumberFormat*
-RuleBasedNumberFormat::clone() const
+RuleBasedNumberFormat*
+RuleBasedNumberFormat::clone() const
{
return new RuleBasedNumberFormat(*this);
}
@@ -956,8 +956,8 @@ RuleBasedNumberFormat::operator==(const Format& other) const
? FALSE
: *localizations == rhs.localizations))) {
- NFRuleSet** p = fRuleSets;
- NFRuleSet** q = rhs.fRuleSets;
+ NFRuleSet** p = fRuleSets;
+ NFRuleSet** q = rhs.fRuleSets;
if (p == NULL) {
return q == NULL;
} else if (q == NULL) {
@@ -978,8 +978,8 @@ UnicodeString
RuleBasedNumberFormat::getRules() const
{
UnicodeString result;
- if (fRuleSets != NULL) {
- for (NFRuleSet** p = fRuleSets; *p; ++p) {
+ if (fRuleSets != NULL) {
+ for (NFRuleSet** p = fRuleSets; *p; ++p) {
(*p)->appendRules(result);
}
}
@@ -993,9 +993,9 @@ RuleBasedNumberFormat::getRuleSetName(int32_t index) const
UnicodeString string(TRUE, localizations->getRuleSetName(index), (int32_t)-1);
return string;
}
- else if (fRuleSets) {
+ else if (fRuleSets) {
UnicodeString result;
- for (NFRuleSet** p = fRuleSets; *p; ++p) {
+ for (NFRuleSet** p = fRuleSets; *p; ++p) {
NFRuleSet* rs = *p;
if (rs->isPublic()) {
if (--index == -1) {
@@ -1016,8 +1016,8 @@ RuleBasedNumberFormat::getNumberOfRuleSetNames() const
if (localizations) {
result = localizations->getNumberOfRuleSets();
}
- else if (fRuleSets) {
- for (NFRuleSet** p = fRuleSets; *p; ++p) {
+ else if (fRuleSets) {
+ for (NFRuleSet** p = fRuleSets; *p; ++p) {
if ((**p).isPublic()) {
++result;
}
@@ -1104,8 +1104,8 @@ RuleBasedNumberFormat::getRuleSetDisplayName(const UnicodeString& ruleSetName, c
NFRuleSet*
RuleBasedNumberFormat::findRuleSet(const UnicodeString& name, UErrorCode& status) const
{
- if (U_SUCCESS(status) && fRuleSets) {
- for (NFRuleSet** p = fRuleSets; *p; ++p) {
+ if (U_SUCCESS(status) && fRuleSets) {
+ for (NFRuleSet** p = fRuleSets; *p; ++p) {
NFRuleSet* rs = *p;
if (rs->isNamed(name)) {
return rs;
@@ -1117,49 +1117,49 @@ RuleBasedNumberFormat::findRuleSet(const UnicodeString& name, UErrorCode& status
}
UnicodeString&
-RuleBasedNumberFormat::format(const DecimalQuantity &number,
- UnicodeString& appendTo,
- FieldPosition& pos,
- UErrorCode &status) const {
- if (U_FAILURE(status)) {
- return appendTo;
- }
- DecimalQuantity copy(number);
- if (copy.fitsInLong()) {
- format(number.toLong(), appendTo, pos, status);
- }
- else {
- copy.roundToMagnitude(0, number::impl::RoundingMode::UNUM_ROUND_HALFEVEN, status);
- if (copy.fitsInLong()) {
- format(number.toDouble(), appendTo, pos, status);
- }
- else {
- // We're outside of our normal range that this framework can handle.
- // The DecimalFormat will provide more accurate results.
-
- // TODO this section should probably be optimized. The DecimalFormat is shared in ICU4J.
- LocalPointer<NumberFormat> decimalFormat(NumberFormat::createInstance(locale, UNUM_DECIMAL, status), status);
- if (decimalFormat.isNull()) {
- return appendTo;
- }
- Formattable f;
- LocalPointer<DecimalQuantity> decimalQuantity(new DecimalQuantity(number), status);
- if (decimalQuantity.isNull()) {
- return appendTo;
- }
- f.adoptDecimalQuantity(decimalQuantity.orphan()); // f now owns decimalQuantity.
- decimalFormat->format(f, appendTo, pos, status);
- }
- }
- return appendTo;
-}
-
-UnicodeString&
+RuleBasedNumberFormat::format(const DecimalQuantity &number,
+ UnicodeString& appendTo,
+ FieldPosition& pos,
+ UErrorCode &status) const {
+ if (U_FAILURE(status)) {
+ return appendTo;
+ }
+ DecimalQuantity copy(number);
+ if (copy.fitsInLong()) {
+ format(number.toLong(), appendTo, pos, status);
+ }
+ else {
+ copy.roundToMagnitude(0, number::impl::RoundingMode::UNUM_ROUND_HALFEVEN, status);
+ if (copy.fitsInLong()) {
+ format(number.toDouble(), appendTo, pos, status);
+ }
+ else {
+ // We're outside of our normal range that this framework can handle.
+ // The DecimalFormat will provide more accurate results.
+
+ // TODO this section should probably be optimized. The DecimalFormat is shared in ICU4J.
+ LocalPointer<NumberFormat> decimalFormat(NumberFormat::createInstance(locale, UNUM_DECIMAL, status), status);
+ if (decimalFormat.isNull()) {
+ return appendTo;
+ }
+ Formattable f;
+ LocalPointer<DecimalQuantity> decimalQuantity(new DecimalQuantity(number), status);
+ if (decimalQuantity.isNull()) {
+ return appendTo;
+ }
+ f.adoptDecimalQuantity(decimalQuantity.orphan()); // f now owns decimalQuantity.
+ decimalFormat->format(f, appendTo, pos, status);
+ }
+ }
+ return appendTo;
+}
+
+UnicodeString&
RuleBasedNumberFormat::format(int32_t number,
UnicodeString& toAppendTo,
- FieldPosition& pos) const
+ FieldPosition& pos) const
{
- return format((int64_t)number, toAppendTo, pos);
+ return format((int64_t)number, toAppendTo, pos);
}
@@ -1170,7 +1170,7 @@ RuleBasedNumberFormat::format(int64_t number,
{
if (defaultRuleSet) {
UErrorCode status = U_ZERO_ERROR;
- format(number, defaultRuleSet, toAppendTo, status);
+ format(number, defaultRuleSet, toAppendTo, status);
}
return toAppendTo;
}
@@ -1181,11 +1181,11 @@ RuleBasedNumberFormat::format(double number,
UnicodeString& toAppendTo,
FieldPosition& /* pos */) const
{
- UErrorCode status = U_ZERO_ERROR;
+ UErrorCode status = U_ZERO_ERROR;
if (defaultRuleSet) {
- format(number, *defaultRuleSet, toAppendTo, status);
+ format(number, *defaultRuleSet, toAppendTo, status);
}
- return toAppendTo;
+ return toAppendTo;
}
@@ -1193,17 +1193,17 @@ UnicodeString&
RuleBasedNumberFormat::format(int32_t number,
const UnicodeString& ruleSetName,
UnicodeString& toAppendTo,
- FieldPosition& pos,
- UErrorCode& status) const
-{
- return format((int64_t)number, ruleSetName, toAppendTo, pos, status);
-}
-
-
-UnicodeString&
-RuleBasedNumberFormat::format(int64_t number,
- const UnicodeString& ruleSetName,
- UnicodeString& toAppendTo,
+ FieldPosition& pos,
+ UErrorCode& status) const
+{
+ return format((int64_t)number, ruleSetName, toAppendTo, pos, status);
+}
+
+
+UnicodeString&
+RuleBasedNumberFormat::format(int64_t number,
+ const UnicodeString& ruleSetName,
+ UnicodeString& toAppendTo,
FieldPosition& /* pos */,
UErrorCode& status) const
{
@@ -1214,7 +1214,7 @@ RuleBasedNumberFormat::format(int64_t number,
} else {
NFRuleSet *rs = findRuleSet(ruleSetName, status);
if (rs) {
- format(number, rs, toAppendTo, status);
+ format(number, rs, toAppendTo, status);
}
}
}
@@ -1223,7 +1223,7 @@ RuleBasedNumberFormat::format(int64_t number,
UnicodeString&
-RuleBasedNumberFormat::format(double number,
+RuleBasedNumberFormat::format(double number,
const UnicodeString& ruleSetName,
UnicodeString& toAppendTo,
FieldPosition& /* pos */,
@@ -1236,100 +1236,100 @@ RuleBasedNumberFormat::format(double number,
} else {
NFRuleSet *rs = findRuleSet(ruleSetName, status);
if (rs) {
- format(number, *rs, toAppendTo, status);
+ format(number, *rs, toAppendTo, status);
}
}
}
return toAppendTo;
}
-void
+void
RuleBasedNumberFormat::format(double number,
- NFRuleSet& rs,
+ NFRuleSet& rs,
UnicodeString& toAppendTo,
UErrorCode& status) const
{
- int32_t startPos = toAppendTo.length();
- if (getRoundingMode() != DecimalFormat::ERoundingMode::kRoundUnnecessary && !uprv_isNaN(number) && !uprv_isInfinite(number)) {
- DecimalQuantity digitList;
- digitList.setToDouble(number);
- digitList.roundToMagnitude(
- -getMaximumFractionDigits(),
- static_cast<UNumberFormatRoundingMode>(getRoundingMode()),
- status);
- number = digitList.toDouble();
- }
- rs.format(number, toAppendTo, toAppendTo.length(), 0, status);
- adjustForCapitalizationContext(startPos, toAppendTo, status);
-}
-
-/**
- * Bottleneck through which all the public format() methods
- * that take a long pass. By the time we get here, we know
- * which rule set we're using to do the formatting.
- * @param number The number to format
- * @param ruleSet The rule set to use to format the number
- * @return The text that resulted from formatting the number
- */
-UnicodeString&
-RuleBasedNumberFormat::format(int64_t number, NFRuleSet *ruleSet, UnicodeString& toAppendTo, UErrorCode& status) const
-{
- // all API format() routines that take a double vector through
- // here. We have these two identical functions-- one taking a
- // double and one taking a long-- the couple digits of precision
- // that long has but double doesn't (both types are 8 bytes long,
- // but double has to borrow some of the mantissa bits to hold
- // the exponent).
- // Create an empty string buffer where the result will
- // be built, and pass it to the rule set (along with an insertion
- // position of 0 and the number being formatted) to the rule set
- // for formatting
-
+ int32_t startPos = toAppendTo.length();
+ if (getRoundingMode() != DecimalFormat::ERoundingMode::kRoundUnnecessary && !uprv_isNaN(number) && !uprv_isInfinite(number)) {
+ DecimalQuantity digitList;
+ digitList.setToDouble(number);
+ digitList.roundToMagnitude(
+ -getMaximumFractionDigits(),
+ static_cast<UNumberFormatRoundingMode>(getRoundingMode()),
+ status);
+ number = digitList.toDouble();
+ }
+ rs.format(number, toAppendTo, toAppendTo.length(), 0, status);
+ adjustForCapitalizationContext(startPos, toAppendTo, status);
+}
+
+/**
+ * Bottleneck through which all the public format() methods
+ * that take a long pass. By the time we get here, we know
+ * which rule set we're using to do the formatting.
+ * @param number The number to format
+ * @param ruleSet The rule set to use to format the number
+ * @return The text that resulted from formatting the number
+ */
+UnicodeString&
+RuleBasedNumberFormat::format(int64_t number, NFRuleSet *ruleSet, UnicodeString& toAppendTo, UErrorCode& status) const
+{
+ // all API format() routines that take a double vector through
+ // here. We have these two identical functions-- one taking a
+ // double and one taking a long-- the couple digits of precision
+ // that long has but double doesn't (both types are 8 bytes long,
+ // but double has to borrow some of the mantissa bits to hold
+ // the exponent).
+ // Create an empty string buffer where the result will
+ // be built, and pass it to the rule set (along with an insertion
+ // position of 0 and the number being formatted) to the rule set
+ // for formatting
+
if (U_SUCCESS(status)) {
- if (number == U_INT64_MIN) {
- // We can't handle this value right now. Provide an accurate default value.
-
- // TODO this section should probably be optimized. The DecimalFormat is shared in ICU4J.
- NumberFormat *decimalFormat = NumberFormat::createInstance(locale, UNUM_DECIMAL, status);
- if (decimalFormat == nullptr) {
- return toAppendTo;
+ if (number == U_INT64_MIN) {
+ // We can't handle this value right now. Provide an accurate default value.
+
+ // TODO this section should probably be optimized. The DecimalFormat is shared in ICU4J.
+ NumberFormat *decimalFormat = NumberFormat::createInstance(locale, UNUM_DECIMAL, status);
+ if (decimalFormat == nullptr) {
+ return toAppendTo;
}
- Formattable f;
- FieldPosition pos(FieldPosition::DONT_CARE);
- DecimalQuantity *decimalQuantity = new DecimalQuantity();
- if (decimalQuantity == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- delete decimalFormat;
- return toAppendTo;
- }
- decimalQuantity->setToLong(number);
- f.adoptDecimalQuantity(decimalQuantity); // f now owns decimalQuantity.
- decimalFormat->format(f, toAppendTo, pos, status);
- delete decimalFormat;
- }
- else {
- int32_t startPos = toAppendTo.length();
- ruleSet->format(number, toAppendTo, toAppendTo.length(), 0, status);
- adjustForCapitalizationContext(startPos, toAppendTo, status);
- }
+ Formattable f;
+ FieldPosition pos(FieldPosition::DONT_CARE);
+ DecimalQuantity *decimalQuantity = new DecimalQuantity();
+ if (decimalQuantity == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ delete decimalFormat;
+ return toAppendTo;
+ }
+ decimalQuantity->setToLong(number);
+ f.adoptDecimalQuantity(decimalQuantity); // f now owns decimalQuantity.
+ decimalFormat->format(f, toAppendTo, pos, status);
+ delete decimalFormat;
+ }
+ else {
+ int32_t startPos = toAppendTo.length();
+ ruleSet->format(number, toAppendTo, toAppendTo.length(), 0, status);
+ adjustForCapitalizationContext(startPos, toAppendTo, status);
+ }
}
return toAppendTo;
}
UnicodeString&
RuleBasedNumberFormat::adjustForCapitalizationContext(int32_t startPos,
- UnicodeString& currentResult,
- UErrorCode& status) const
+ UnicodeString& currentResult,
+ UErrorCode& status) const
{
#if !UCONFIG_NO_BREAK_ITERATION
- UDisplayContext capitalizationContext = getContext(UDISPCTX_TYPE_CAPITALIZATION, status);
- if (capitalizationContext != UDISPCTX_CAPITALIZATION_NONE && startPos == 0 && currentResult.length() > 0) {
+ UDisplayContext capitalizationContext = getContext(UDISPCTX_TYPE_CAPITALIZATION, status);
+ if (capitalizationContext != UDISPCTX_CAPITALIZATION_NONE && startPos == 0 && currentResult.length() > 0) {
// capitalize currentResult according to context
UChar32 ch = currentResult.char32At(0);
- if (u_islower(ch) && U_SUCCESS(status) && capitalizationBrkIter != NULL &&
- ( capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
- (capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForUIListMenu) ||
- (capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone)) ) {
+ if (u_islower(ch) && U_SUCCESS(status) && capitalizationBrkIter != NULL &&
+ ( capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
+ (capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForUIListMenu) ||
+ (capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone)) ) {
// titlecase first word of currentResult, here use sentence iterator unlike current implementations
// in LocaleDisplayNamesImpl::adjustForUsageAndContext and RelativeDateFormat::format
currentResult.toTitle(capitalizationBrkIter, locale, U_TITLECASE_NO_LOWERCASE | U_TITLECASE_NO_BREAK_ADJUSTMENT);
@@ -1345,7 +1345,7 @@ RuleBasedNumberFormat::parse(const UnicodeString& text,
Formattable& result,
ParsePosition& parsePosition) const
{
- if (!fRuleSets) {
+ if (!fRuleSets) {
parsePosition.setErrorIndex(0);
return;
}
@@ -1356,13 +1356,13 @@ RuleBasedNumberFormat::parse(const UnicodeString& text,
ParsePosition high_pp(0);
Formattable high_result;
- for (NFRuleSet** p = fRuleSets; *p; ++p) {
+ for (NFRuleSet** p = fRuleSets; *p; ++p) {
NFRuleSet *rp = *p;
if (rp->isPublic() && rp->isParseable()) {
ParsePosition working_pp(0);
Formattable working_result;
- rp->parse(workingText, working_pp, kMaxDouble, 0, working_result);
+ rp->parse(workingText, working_pp, kMaxDouble, 0, working_result);
if (working_pp.getIndex() > high_pp.getIndex()) {
high_pp = working_pp;
high_result = working_result;
@@ -1444,7 +1444,7 @@ void
RuleBasedNumberFormat::initDefaultRuleSet()
{
defaultRuleSet = NULL;
- if (!fRuleSets) {
+ if (!fRuleSets) {
return;
}
@@ -1452,7 +1452,7 @@ RuleBasedNumberFormat::initDefaultRuleSet()
const UnicodeString ordinal(UNICODE_STRING_SIMPLE("%digits-ordinal"));
const UnicodeString duration(UNICODE_STRING_SIMPLE("%duration"));
- NFRuleSet**p = &fRuleSets[0];
+ NFRuleSet**p = &fRuleSets[0];
while (*p) {
if ((*p)->isNamed(spellout) || (*p)->isNamed(ordinal) || (*p)->isNamed(duration)) {
defaultRuleSet = *p;
@@ -1464,7 +1464,7 @@ RuleBasedNumberFormat::initDefaultRuleSet()
defaultRuleSet = *--p;
if (!defaultRuleSet->isPublic()) {
- while (p != fRuleSets) {
+ while (p != fRuleSets) {
if ((*--p)->isPublic()) {
defaultRuleSet = *p;
break;
@@ -1534,7 +1534,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
// from the description
lenientParseRules = new UnicodeString();
/* test for NULL */
- if (lenientParseRules == nullptr) {
+ if (lenientParseRules == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -1555,15 +1555,15 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
++numRuleSets;
// our rule list is an array of the appropriate size
- fRuleSets = (NFRuleSet **)uprv_malloc((numRuleSets + 1) * sizeof(NFRuleSet *));
+ fRuleSets = (NFRuleSet **)uprv_malloc((numRuleSets + 1) * sizeof(NFRuleSet *));
/* test for NULL */
- if (fRuleSets == 0) {
+ if (fRuleSets == 0) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
for (int i = 0; i <= numRuleSets; ++i) {
- fRuleSets[i] = NULL;
+ fRuleSets[i] = NULL;
}
// divide up the descriptions into individual rule-set descriptions
@@ -1579,7 +1579,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
}
ruleSetDescriptions = new UnicodeString[numRuleSets];
- if (ruleSetDescriptions == nullptr) {
+ if (ruleSetDescriptions == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -1589,8 +1589,8 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
int32_t start = 0;
for (int32_t p = description.indexOf(gSemiPercent, 2, 0); p != -1; p = description.indexOf(gSemiPercent, 2, start)) {
ruleSetDescriptions[curRuleSet].setTo(description, start, p + 1 - start);
- fRuleSets[curRuleSet] = new NFRuleSet(this, ruleSetDescriptions, curRuleSet, status);
- if (fRuleSets[curRuleSet] == nullptr) {
+ fRuleSets[curRuleSet] = new NFRuleSet(this, ruleSetDescriptions, curRuleSet, status);
+ if (fRuleSets[curRuleSet] == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -1598,8 +1598,8 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
start = p + 1;
}
ruleSetDescriptions[curRuleSet].setTo(description, start, description.length() - start);
- fRuleSets[curRuleSet] = new NFRuleSet(this, ruleSetDescriptions, curRuleSet, status);
- if (fRuleSets[curRuleSet] == nullptr) {
+ fRuleSets[curRuleSet] = new NFRuleSet(this, ruleSetDescriptions, curRuleSet, status);
+ if (fRuleSets[curRuleSet] == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -1617,11 +1617,11 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
initDefaultRuleSet();
// finally, we can go back through the temporary descriptions
- // list and finish setting up the substructure (and we throw
+ // list and finish setting up the substructure (and we throw
// away the temporary descriptions as we go)
{
for (int i = 0; i < numRuleSets; i++) {
- fRuleSets[i]->parseRules(ruleSetDescriptions[i], status);
+ fRuleSets[i]->parseRules(ruleSetDescriptions[i], status);
}
}
@@ -1667,7 +1667,7 @@ RuleBasedNumberFormat::setContext(UDisplayContext value, UErrorCode& status)
if ( capitalizationBrkIter == NULL && (value==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
(value==UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForUIListMenu) ||
(value==UDISPCTX_CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone)) ) {
- status = U_ZERO_ERROR;
+ status = U_ZERO_ERROR;
capitalizationBrkIter = BreakIterator::createSentenceInstance(locale, status);
if (U_FAILURE(status)) {
delete capitalizationBrkIter;
@@ -1691,8 +1691,8 @@ RuleBasedNumberFormat::initCapitalizationContextInfo(const Locale& thelocale)
int32_t len = 0;
const int32_t * intVector = ures_getIntVector(rb, &len, &status);
if (U_SUCCESS(status) && intVector != NULL && len >= 2) {
- capitalizationForUIListMenu = static_cast<UBool>(intVector[0]);
- capitalizationForStandAlone = static_cast<UBool>(intVector[1]);
+ capitalizationForUIListMenu = static_cast<UBool>(intVector[0]);
+ capitalizationForStandAlone = static_cast<UBool>(intVector[1]);
}
}
ures_close(rb);
@@ -1727,7 +1727,7 @@ RuleBasedNumberFormat::stripWhitespace(UnicodeString& description)
start = p + 1;
}
- // when we get here, we've seeked off the end of the string, and
+ // when we get here, we've seeked off the end of the string, and
// we terminate the loop (we continue until *start* is -1 rather
// than until *p* is -1, because otherwise we'd miss the last
// rule in the description)
@@ -1743,12 +1743,12 @@ RuleBasedNumberFormat::stripWhitespace(UnicodeString& description)
void
RuleBasedNumberFormat::dispose()
{
- if (fRuleSets) {
- for (NFRuleSet** p = fRuleSets; *p; ++p) {
+ if (fRuleSets) {
+ for (NFRuleSet** p = fRuleSets; *p; ++p) {
delete *p;
}
- uprv_free(fRuleSets);
- fRuleSets = NULL;
+ uprv_free(fRuleSets);
+ fRuleSets = NULL;
}
if (ruleSetDescriptions) {
@@ -1798,7 +1798,7 @@ const RuleBasedCollator*
RuleBasedNumberFormat::getCollator() const
{
#if !UCONFIG_NO_COLLATION
- if (!fRuleSets) {
+ if (!fRuleSets) {
return NULL;
}
@@ -1807,7 +1807,7 @@ RuleBasedNumberFormat::getCollator() const
// create a default collator based on the formatter's locale,
// then pull out that collator's rules, append any additional
// rules specified in the description, and create a _new_
- // collator based on the combination of those rules
+ // collator based on the combination of those rules
UErrorCode status = U_ZERO_ERROR;
@@ -1850,10 +1850,10 @@ RuleBasedNumberFormat::initializeDecimalFormatSymbols(UErrorCode &status)
// lazy-evaluate the DecimalFormatSymbols object. This object
// is shared by all DecimalFormat instances belonging to this
// formatter
- if (decimalFormatSymbols == nullptr) {
- LocalPointer<DecimalFormatSymbols> temp(new DecimalFormatSymbols(locale, status), status);
+ if (decimalFormatSymbols == nullptr) {
+ LocalPointer<DecimalFormatSymbols> temp(new DecimalFormatSymbols(locale, status), status);
if (U_SUCCESS(status)) {
- decimalFormatSymbols = temp.orphan();
+ decimalFormatSymbols = temp.orphan();
}
}
return decimalFormatSymbols;
@@ -1873,14 +1873,14 @@ NFRule*
RuleBasedNumberFormat::initializeDefaultInfinityRule(UErrorCode &status)
{
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
if (defaultInfinityRule == NULL) {
UnicodeString rule(UNICODE_STRING_SIMPLE("Inf: "));
rule.append(getDecimalFormatSymbols()->getSymbol(DecimalFormatSymbols::kInfinitySymbol));
- LocalPointer<NFRule> temp(new NFRule(this, rule, status), status);
+ LocalPointer<NFRule> temp(new NFRule(this, rule, status), status);
if (U_SUCCESS(status)) {
- defaultInfinityRule = temp.orphan();
+ defaultInfinityRule = temp.orphan();
}
}
return defaultInfinityRule;
@@ -1896,14 +1896,14 @@ NFRule*
RuleBasedNumberFormat::initializeDefaultNaNRule(UErrorCode &status)
{
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
- if (defaultNaNRule == nullptr) {
+ if (defaultNaNRule == nullptr) {
UnicodeString rule(UNICODE_STRING_SIMPLE("NaN: "));
rule.append(getDecimalFormatSymbols()->getSymbol(DecimalFormatSymbols::kNaNSymbol));
- LocalPointer<NFRule> temp(new NFRule(this, rule, status), status);
+ LocalPointer<NFRule> temp(new NFRule(this, rule, status), status);
if (U_SUCCESS(status)) {
- defaultNaNRule = temp.orphan();
+ defaultNaNRule = temp.orphan();
}
}
return defaultNaNRule;
@@ -1941,15 +1941,15 @@ RuleBasedNumberFormat::adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsTo
defaultNaNRule = NULL;
initializeDefaultNaNRule(status); // Reset with the new DecimalFormatSymbols
- if (fRuleSets) {
+ if (fRuleSets) {
for (int32_t i = 0; i < numRuleSets; i++) {
- fRuleSets[i]->setDecimalFormatSymbols(*symbolsToAdopt, status);
+ fRuleSets[i]->setDecimalFormatSymbols(*symbolsToAdopt, status);
}
}
}
}
-// Setting the symbols is equivalent to adopting a newly created localized symbols.
+// Setting the symbols is equivalent to adopting a newly created localized symbols.
void
RuleBasedNumberFormat::setDecimalFormatSymbols(const DecimalFormatSymbols& symbols)
{
@@ -1961,30 +1961,30 @@ RuleBasedNumberFormat::createPluralFormat(UPluralType pluralType,
const UnicodeString &pattern,
UErrorCode& status) const
{
- auto *pf = new PluralFormat(locale, pluralType, pattern, status);
- if (pf == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
- return pf;
-}
-
-/**
- * Get the rounding mode.
- * @return A rounding mode
- */
-DecimalFormat::ERoundingMode RuleBasedNumberFormat::getRoundingMode() const {
- return fRoundingMode;
-}
-
-/**
- * Set the rounding mode. This has no effect unless the rounding
- * increment is greater than zero.
- * @param roundingMode A rounding mode
- */
-void RuleBasedNumberFormat::setRoundingMode(DecimalFormat::ERoundingMode roundingMode) {
- fRoundingMode = roundingMode;
-}
-
+ auto *pf = new PluralFormat(locale, pluralType, pattern, status);
+ if (pf == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
+ return pf;
+}
+
+/**
+ * Get the rounding mode.
+ * @return A rounding mode
+ */
+DecimalFormat::ERoundingMode RuleBasedNumberFormat::getRoundingMode() const {
+ return fRoundingMode;
+}
+
+/**
+ * Set the rounding mode. This has no effect unless the rounding
+ * increment is greater than zero.
+ * @param roundingMode A rounding mode
+ */
+void RuleBasedNumberFormat::setRoundingMode(DecimalFormat::ERoundingMode roundingMode) {
+ fRoundingMode = roundingMode;
+}
+
U_NAMESPACE_END
/* U_HAVE_RBNF */
diff --git a/contrib/libs/icu/i18n/rbt.cpp b/contrib/libs/icu/i18n/rbt.cpp
index 8166b49b7d..4cef242e58 100644
--- a/contrib/libs/icu/i18n/rbt.cpp
+++ b/contrib/libs/icu/i18n/rbt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -191,8 +191,8 @@ RuleBasedTransliterator::~RuleBasedTransliterator() {
}
}
-RuleBasedTransliterator*
-RuleBasedTransliterator::clone() const {
+RuleBasedTransliterator*
+RuleBasedTransliterator::clone() const {
return new RuleBasedTransliterator(*this);
}
@@ -252,8 +252,8 @@ RuleBasedTransliterator::handleTransliterate(Replaceable& text, UTransPosition&
// Shared RBT data protected by transliteratorDataMutex.
//
// TODO(andy): Need a better scheme for handling this.
-
- static UMutex transliteratorDataMutex;
+
+ static UMutex transliteratorDataMutex;
UBool needToLock;
{
Mutex m;
diff --git a/contrib/libs/icu/i18n/rbt.h b/contrib/libs/icu/i18n/rbt.h
index b7ae39615a..97ef01e140 100644
--- a/contrib/libs/icu/i18n/rbt.h
+++ b/contrib/libs/icu/i18n/rbt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -29,10 +29,10 @@ class TransliterationRuleData;
/**
* <code>RuleBasedTransliterator</code> is a transliterator
- * built from a set of rules as defined for
- * Transliterator::createFromRules().
- * See the C++ class Transliterator documentation for the rule syntax.
- *
+ * built from a set of rules as defined for
+ * Transliterator::createFromRules().
+ * See the C++ class Transliterator documentation for the rule syntax.
+ *
* @author Alan Liu
* @internal Use transliterator factory methods instead since this class will be removed in that release.
*/
@@ -144,7 +144,7 @@ public:
* Implement Transliterator API.
* @internal Use transliterator factory methods instead since this class will be removed in that release.
*/
- virtual RuleBasedTransliterator* clone() const;
+ virtual RuleBasedTransliterator* clone() const;
protected:
/**
diff --git a/contrib/libs/icu/i18n/rbt_data.cpp b/contrib/libs/icu/i18n/rbt_data.cpp
index 76e3104bff..4b596ac6c4 100644
--- a/contrib/libs/icu/i18n/rbt_data.cpp
+++ b/contrib/libs/icu/i18n/rbt_data.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/rbt_data.h b/contrib/libs/icu/i18n/rbt_data.h
index f3a8a3f10d..52a961dde0 100644
--- a/contrib/libs/icu/i18n/rbt_data.h
+++ b/contrib/libs/icu/i18n/rbt_data.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/rbt_pars.cpp b/contrib/libs/icu/i18n/rbt_pars.cpp
index b5fe0c6366..1ae5b81f03 100644
--- a/contrib/libs/icu/i18n/rbt_pars.cpp
+++ b/contrib/libs/icu/i18n/rbt_pars.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -194,9 +194,9 @@ const UnicodeFunctor* ParseData::lookupMatcher(UChar32 ch) const {
const UnicodeFunctor* set = NULL;
int32_t i = ch - data->variablesBase;
if (i >= 0 && i < variablesVector->size()) {
- int32_t j = ch - data->variablesBase;
- set = (j < variablesVector->size()) ?
- (UnicodeFunctor*) variablesVector->elementAt(j) : 0;
+ int32_t j = ch - data->variablesBase;
+ set = (j < variablesVector->size()) ?
+ (UnicodeFunctor*) variablesVector->elementAt(j) : 0;
}
return set;
}
@@ -1108,17 +1108,17 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
}
data->variableNames.removeAll();
- int32_t p = UHASH_FIRST;
- const UHashElement* he = variableNames.nextElement(p);
+ int32_t p = UHASH_FIRST;
+ const UHashElement* he = variableNames.nextElement(p);
while (he != NULL) {
- UnicodeString* tempus = ((UnicodeString*)(he->value.pointer))->clone();
+ UnicodeString* tempus = ((UnicodeString*)(he->value.pointer))->clone();
if (tempus == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
data->variableNames.put(*((UnicodeString*)(he->key.pointer)),
tempus, status);
- he = variableNames.nextElement(p);
+ he = variableNames.nextElement(p);
}
}
variablesVector.removeAllElements(); // keeps them from getting deleted when we succeed
diff --git a/contrib/libs/icu/i18n/rbt_pars.h b/contrib/libs/icu/i18n/rbt_pars.h
index cf002eb27c..61ce9727e0 100644
--- a/contrib/libs/icu/i18n/rbt_pars.h
+++ b/contrib/libs/icu/i18n/rbt_pars.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/rbt_rule.cpp b/contrib/libs/icu/i18n/rbt_rule.cpp
index 26f7415ce2..6cc5325c46 100644
--- a/contrib/libs/icu/i18n/rbt_rule.cpp
+++ b/contrib/libs/icu/i18n/rbt_rule.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -180,13 +180,13 @@ TransliterationRule::TransliterationRule(TransliterationRule& other) :
}
if (other.anteContext != NULL) {
- anteContext = other.anteContext->clone();
+ anteContext = other.anteContext->clone();
}
if (other.key != NULL) {
- key = other.key->clone();
+ key = other.key->clone();
}
if (other.postContext != NULL) {
- postContext = other.postContext->clone();
+ postContext = other.postContext->clone();
}
output = other.output->clone();
}
diff --git a/contrib/libs/icu/i18n/rbt_rule.h b/contrib/libs/icu/i18n/rbt_rule.h
index 2244704969..5501981266 100644
--- a/contrib/libs/icu/i18n/rbt_rule.h
+++ b/contrib/libs/icu/i18n/rbt_rule.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
* Copyright (C) {1999-2001}, International Business Machines Corporation and others. All Rights Reserved.
diff --git a/contrib/libs/icu/i18n/rbt_set.cpp b/contrib/libs/icu/i18n/rbt_set.cpp
index 81297d32b2..d8d0384dda 100644
--- a/contrib/libs/icu/i18n/rbt_set.cpp
+++ b/contrib/libs/icu/i18n/rbt_set.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/rbt_set.h b/contrib/libs/icu/i18n/rbt_set.h
index c38276594b..b4b46786bf 100644
--- a/contrib/libs/icu/i18n/rbt_set.h
+++ b/contrib/libs/icu/i18n/rbt_set.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/rbtz.cpp b/contrib/libs/icu/i18n/rbtz.cpp
index af86c8375a..3249a32a1c 100644
--- a/contrib/libs/icu/i18n/rbtz.cpp
+++ b/contrib/libs/icu/i18n/rbtz.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -149,7 +149,7 @@ RuleBasedTimeZone::addTransitionRule(TimeZoneRule* rule, UErrorCode& status) {
void
RuleBasedTimeZone::completeConst(UErrorCode& status) const {
- static UMutex gLock;
+ static UMutex gLock;
if (U_FAILURE(status)) {
return;
}
@@ -356,8 +356,8 @@ cleanup:
fUpToDate = FALSE;
}
-RuleBasedTimeZone*
-RuleBasedTimeZone::clone() const {
+RuleBasedTimeZone*
+RuleBasedTimeZone::clone() const {
return new RuleBasedTimeZone(*this);
}
diff --git a/contrib/libs/icu/i18n/regexcmp.cpp b/contrib/libs/icu/i18n/regexcmp.cpp
index 99169dcd60..dd777b7538 100644
--- a/contrib/libs/icu/i18n/regexcmp.cpp
+++ b/contrib/libs/icu/i18n/regexcmp.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// file: regexcmp.cpp
@@ -28,7 +28,7 @@
#include "patternprops.h"
#include "putilimp.h"
#include "cmemory.h"
-#include "cstr.h"
+#include "cstr.h"
#include "cstring.h"
#include "uvectr32.h"
#include "uvectr64.h"
@@ -487,12 +487,12 @@ UBool RegexCompile::doParseActions(int32_t action)
// If this is a named capture group, add the name->group number mapping.
if (fCaptureName != NULL) {
- if (!fRXPat->initNamedCaptureMap()) {
- if (U_SUCCESS(*fStatus)) {
- error(fRXPat->fDeferredStatus);
- }
- break;
- }
+ if (!fRXPat->initNamedCaptureMap()) {
+ if (U_SUCCESS(*fStatus)) {
+ error(fRXPat->fDeferredStatus);
+ }
+ break;
+ }
int32_t groupNumber = fRXPat->fGroupMap->size();
int32_t previousMapping = uhash_puti(fRXPat->fNamedCaptureMap, fCaptureName, groupNumber, fStatus);
fCaptureName = NULL; // hash table takes ownership of the name (key) string.
@@ -564,7 +564,7 @@ UBool RegexCompile::doParseActions(int32_t action)
// sequence; don't change without making updates there too.
//
// Compiles to
- // 1 LA_START dataLoc Saves SP, Input Pos, Active input region.
+ // 1 LA_START dataLoc Saves SP, Input Pos, Active input region.
// 2. STATE_SAVE 4 on failure of lookahead, goto 4
// 3 JMP 6 continue ...
//
@@ -578,14 +578,14 @@ UBool RegexCompile::doParseActions(int32_t action)
// 8. code for parenthesized stuff.
// 9. LA_END
//
- // Four data slots are reserved, for saving state on entry to the look-around
- // 0: stack pointer on entry.
- // 1: input position on entry.
- // 2: fActiveStart, the active bounds start on entry.
- // 3: fActiveLimit, the active bounds limit on entry.
+ // Four data slots are reserved, for saving state on entry to the look-around
+ // 0: stack pointer on entry.
+ // 1: input position on entry.
+ // 2: fActiveStart, the active bounds start on entry.
+ // 3: fActiveLimit, the active bounds limit on entry.
{
fixLiterals();
- int32_t dataLoc = allocateData(4);
+ int32_t dataLoc = allocateData(4);
appendOp(URX_LA_START, dataLoc);
appendOp(URX_STATE_SAVE, fRXPat->fCompiledPat->size()+ 2);
appendOp(URX_JMP, fRXPat->fCompiledPat->size()+ 3);
@@ -606,23 +606,23 @@ UBool RegexCompile::doParseActions(int32_t action)
case doOpenLookAheadNeg:
// Negated Lookahead. (?! stuff )
// Compiles to
- // 1. LA_START dataloc
+ // 1. LA_START dataloc
// 2. SAVE_STATE 7 // Fail within look-ahead block restores to this state,
// // which continues with the match.
// 3. NOP // Std. Open Paren sequence, for possible '|'
// 4. code for parenthesized stuff.
- // 5. LA_END // Cut back stack, remove saved state from step 2.
+ // 5. LA_END // Cut back stack, remove saved state from step 2.
// 6. BACKTRACK // code in block succeeded, so neg. lookahead fails.
// 7. END_LA // Restore match region, in case look-ahead was using
// an alternate (transparent) region.
- // Four data slots are reserved, for saving state on entry to the look-around
- // 0: stack pointer on entry.
- // 1: input position on entry.
- // 2: fActiveStart, the active bounds start on entry.
- // 3: fActiveLimit, the active bounds limit on entry.
+ // Four data slots are reserved, for saving state on entry to the look-around
+ // 0: stack pointer on entry.
+ // 1: input position on entry.
+ // 2: fActiveStart, the active bounds start on entry.
+ // 3: fActiveLimit, the active bounds limit on entry.
{
fixLiterals();
- int32_t dataLoc = allocateData(4);
+ int32_t dataLoc = allocateData(4);
appendOp(URX_LA_START, dataLoc);
appendOp(URX_STATE_SAVE, 0); // dest address will be patched later.
appendOp(URX_NOP, 0);
@@ -656,16 +656,16 @@ UBool RegexCompile::doParseActions(int32_t action)
// Allocate a block of matcher data, to contain (when running a match)
// 0: Stack ptr on entry
// 1: Input Index on entry
- // 2: fActiveStart, the active bounds start on entry.
- // 3: fActiveLimit, the active bounds limit on entry.
- // 4: Start index of match current match attempt.
- // The first four items must match the layout of data for LA_START / LA_END
+ // 2: fActiveStart, the active bounds start on entry.
+ // 3: fActiveLimit, the active bounds limit on entry.
+ // 4: Start index of match current match attempt.
+ // The first four items must match the layout of data for LA_START / LA_END
// Generate match code for any pending literals.
fixLiterals();
// Allocate data space
- int32_t dataLoc = allocateData(5);
+ int32_t dataLoc = allocateData(5);
// Emit URX_LB_START
appendOp(URX_LB_START, dataLoc);
@@ -710,16 +710,16 @@ UBool RegexCompile::doParseActions(int32_t action)
// Allocate a block of matcher data, to contain (when running a match)
// 0: Stack ptr on entry
// 1: Input Index on entry
- // 2: fActiveStart, the active bounds start on entry.
- // 3: fActiveLimit, the active bounds limit on entry.
- // 4: Start index of match current match attempt.
- // The first four items must match the layout of data for LA_START / LA_END
+ // 2: fActiveStart, the active bounds start on entry.
+ // 3: fActiveLimit, the active bounds limit on entry.
+ // 4: Start index of match current match attempt.
+ // The first four items must match the layout of data for LA_START / LA_END
// Generate match code for any pending literals.
fixLiterals();
// Allocate data space
- int32_t dataLoc = allocateData(5);
+ int32_t dataLoc = allocateData(5);
// Emit URX_LB_START
appendOp(URX_LB_START, dataLoc);
@@ -1254,10 +1254,10 @@ UBool RegexCompile::doParseActions(int32_t action)
break;
case doBackslashX:
- #if UCONFIG_NO_BREAK_ITERATION==1
- // Grapheme Cluster Boundary requires ICU break iteration.
- error(U_UNSUPPORTED_ERROR);
- #endif
+ #if UCONFIG_NO_BREAK_ITERATION==1
+ // Grapheme Cluster Boundary requires ICU break iteration.
+ error(U_UNSUPPORTED_ERROR);
+ #endif
fixLiterals(FALSE);
appendOp(URX_BACKSLASH_X, 0);
break;
@@ -1351,8 +1351,8 @@ UBool RegexCompile::doParseActions(int32_t action)
case doCompleteNamedBackRef:
{
- int32_t groupNumber =
- fRXPat->fNamedCaptureMap ? uhash_geti(fRXPat->fNamedCaptureMap, fCaptureName) : 0;
+ int32_t groupNumber =
+ fRXPat->fNamedCaptureMap ? uhash_geti(fRXPat->fNamedCaptureMap, fCaptureName) : 0;
if (groupNumber == 0) {
// Group name has not been defined.
// Could be a forward reference. If we choose to support them at some
@@ -1485,7 +1485,7 @@ UBool RegexCompile::doParseActions(int32_t action)
case 0x78: /* 'x' */ bit = UREGEX_COMMENTS; break;
case 0x2d: /* '-' */ fSetModeFlag = FALSE; break;
default:
- UPRV_UNREACHABLE; // Should never happen. Other chars are filtered out
+ UPRV_UNREACHABLE; // Should never happen. Other chars are filtered out
// by the scanner.
}
if (fSetModeFlag) {
@@ -1565,15 +1565,15 @@ UBool RegexCompile::doParseActions(int32_t action)
case doSetBackslash_s:
{
UnicodeSet *set = (UnicodeSet *)fSetStack.peek();
- set->addAll(RegexStaticSets::gStaticSets->fPropSets[URX_ISSPACE_SET]);
+ set->addAll(RegexStaticSets::gStaticSets->fPropSets[URX_ISSPACE_SET]);
break;
}
case doSetBackslash_S:
{
UnicodeSet *set = (UnicodeSet *)fSetStack.peek();
- UnicodeSet SSet;
- SSet.addAll(RegexStaticSets::gStaticSets->fPropSets[URX_ISSPACE_SET]).complement();
+ UnicodeSet SSet;
+ SSet.addAll(RegexStaticSets::gStaticSets->fPropSets[URX_ISSPACE_SET]).complement();
set->addAll(SSet);
break;
}
@@ -1642,15 +1642,15 @@ UBool RegexCompile::doParseActions(int32_t action)
case doSetBackslash_w:
{
UnicodeSet *set = (UnicodeSet *)fSetStack.peek();
- set->addAll(RegexStaticSets::gStaticSets->fPropSets[URX_ISWORD_SET]);
+ set->addAll(RegexStaticSets::gStaticSets->fPropSets[URX_ISWORD_SET]);
break;
}
case doSetBackslash_W:
{
UnicodeSet *set = (UnicodeSet *)fSetStack.peek();
- UnicodeSet SSet;
- SSet.addAll(RegexStaticSets::gStaticSets->fPropSets[URX_ISWORD_SET]).complement();
+ UnicodeSet SSet;
+ SSet.addAll(RegexStaticSets::gStaticSets->fPropSets[URX_ISWORD_SET]).complement();
set->addAll(SSet);
break;
}
@@ -1860,7 +1860,7 @@ UBool RegexCompile::doParseActions(int32_t action)
}
default:
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
if (U_FAILURE(*fStatus)) {
@@ -1967,17 +1967,17 @@ int32_t RegexCompile::buildOp(int32_t type, int32_t val) {
return 0;
}
if (type < 0 || type > 255) {
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
if (val > 0x00ffffff) {
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
if (val < 0) {
if (!(type == URX_RESERVED_OP_N || type == URX_RESERVED_OP)) {
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
if (URX_TYPE(val) != 0xff) {
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
type = URX_RESERVED_OP_N;
}
@@ -2305,13 +2305,13 @@ void RegexCompile::handleCloseParen() {
error(U_REGEX_LOOK_BEHIND_LIMIT);
break;
}
- if (minML == INT32_MAX) {
- // This condition happens when no match is possible, such as with a
- // [set] expression containing no elements.
- // In principle, the generated code to evaluate the expression could be deleted,
- // but it's probably not worth the complication.
- minML = 0;
- }
+ if (minML == INT32_MAX) {
+ // This condition happens when no match is possible, such as with a
+ // [set] expression containing no elements.
+ // In principle, the generated code to evaluate the expression could be deleted,
+ // but it's probably not worth the complication.
+ minML = 0;
+ }
U_ASSERT(minML <= maxML);
// Insert the min and max match len bounds into the URX_LB_CONT op that
@@ -2348,14 +2348,14 @@ void RegexCompile::handleCloseParen() {
error(U_REGEX_LOOK_BEHIND_LIMIT);
break;
}
- if (minML == INT32_MAX) {
- // This condition happens when no match is possible, such as with a
- // [set] expression containing no elements.
- // In principle, the generated code to evaluate the expression could be deleted,
- // but it's probably not worth the complication.
- minML = 0;
- }
-
+ if (minML == INT32_MAX) {
+ // This condition happens when no match is possible, such as with a
+ // [set] expression containing no elements.
+ // In principle, the generated code to evaluate the expression could be deleted,
+ // but it's probably not worth the complication.
+ minML = 0;
+ }
+
U_ASSERT(minML <= maxML);
// Insert the min and max match len bounds into the URX_LB_CONT op that
@@ -2373,7 +2373,7 @@ void RegexCompile::handleCloseParen() {
default:
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
// remember the next location in the compiled pattern.
@@ -2425,7 +2425,7 @@ void RegexCompile::compileSet(UnicodeSet *theSet)
{
// The set contains two or more chars. (the normal case)
// Put it into the compiled pattern as a set.
- theSet->freeze();
+ theSet->freeze();
int32_t setNumber = fRXPat->fSets->size();
fRXPat->fSets->addElement(theSet, *fStatus);
appendOp(URX_SETREF, setNumber);
@@ -2634,7 +2634,7 @@ void RegexCompile::findCaseInsensitiveStarters(UChar32 c, UnicodeSet *starterCh
if (c < UCHAR_MIN_VALUE || c > UCHAR_MAX_VALUE) {
// This function should never be called with an invalid input character.
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
} else if (u_hasBinaryProperty(c, UCHAR_CASE_SENSITIVE)) {
UChar32 caseFoldedC = u_foldCase(c, U_FOLD_CASE_DEFAULT);
starterChars->set(caseFoldedC, caseFoldedC);
@@ -2663,18 +2663,18 @@ void RegexCompile::findCaseInsensitiveStarters(UChar32 c, UnicodeSet *starterCh
}
-// Increment with overflow check.
-// val and delta will both be positive.
+// Increment with overflow check.
+// val and delta will both be positive.
+
+static int32_t safeIncrement(int32_t val, int32_t delta) {
+ if (INT32_MAX - val > delta) {
+ return val + delta;
+ } else {
+ return INT32_MAX;
+ }
+}
-static int32_t safeIncrement(int32_t val, int32_t delta) {
- if (INT32_MAX - val > delta) {
- return val + delta;
- } else {
- return INT32_MAX;
- }
-}
-
//------------------------------------------------------------------------------
//
// matchStartType Determine how a match can start.
@@ -2773,7 +2773,7 @@ void RegexCompile::matchStartType() {
fRXPat->fInitialChars->add(URX_VAL(op));
numInitialStrings += 2;
}
- currentLen = safeIncrement(currentLen, 1);
+ currentLen = safeIncrement(currentLen, 1);
atStart = FALSE;
break;
@@ -2786,7 +2786,7 @@ void RegexCompile::matchStartType() {
fRXPat->fInitialChars->addAll(*s);
numInitialStrings += 2;
}
- currentLen = safeIncrement(currentLen, 1);
+ currentLen = safeIncrement(currentLen, 1);
atStart = FALSE;
break;
@@ -2819,11 +2819,11 @@ void RegexCompile::matchStartType() {
if (currentLen == 0) {
int32_t sn = URX_VAL(op);
U_ASSERT(sn>0 && sn<URX_LAST_SET);
- const UnicodeSet &s = RegexStaticSets::gStaticSets->fPropSets[sn];
- fRXPat->fInitialChars->addAll(s);
+ const UnicodeSet &s = RegexStaticSets::gStaticSets->fPropSets[sn];
+ fRXPat->fInitialChars->addAll(s);
numInitialStrings += 2;
}
- currentLen = safeIncrement(currentLen, 1);
+ currentLen = safeIncrement(currentLen, 1);
atStart = FALSE;
break;
@@ -2832,12 +2832,12 @@ void RegexCompile::matchStartType() {
case URX_STAT_SETREF_N:
if (currentLen == 0) {
int32_t sn = URX_VAL(op);
- UnicodeSet sc;
- sc.addAll(RegexStaticSets::gStaticSets->fPropSets[sn]).complement();
+ UnicodeSet sc;
+ sc.addAll(RegexStaticSets::gStaticSets->fPropSets[sn]).complement();
fRXPat->fInitialChars->addAll(sc);
numInitialStrings += 2;
}
- currentLen = safeIncrement(currentLen, 1);
+ currentLen = safeIncrement(currentLen, 1);
atStart = FALSE;
break;
@@ -2854,7 +2854,7 @@ void RegexCompile::matchStartType() {
fRXPat->fInitialChars->addAll(s);
numInitialStrings += 2;
}
- currentLen = safeIncrement(currentLen, 1);
+ currentLen = safeIncrement(currentLen, 1);
atStart = FALSE;
break;
@@ -2871,7 +2871,7 @@ void RegexCompile::matchStartType() {
fRXPat->fInitialChars->addAll(s);
numInitialStrings += 2;
}
- currentLen = safeIncrement(currentLen, 1);
+ currentLen = safeIncrement(currentLen, 1);
atStart = FALSE;
break;
@@ -2890,7 +2890,7 @@ void RegexCompile::matchStartType() {
fRXPat->fInitialChars->addAll(s);
numInitialStrings += 2;
}
- currentLen = safeIncrement(currentLen, 1);
+ currentLen = safeIncrement(currentLen, 1);
atStart = FALSE;
break;
@@ -2914,7 +2914,7 @@ void RegexCompile::matchStartType() {
}
numInitialStrings += 2;
}
- currentLen = safeIncrement(currentLen, 1);
+ currentLen = safeIncrement(currentLen, 1);
atStart = FALSE;
break;
@@ -2930,7 +2930,7 @@ void RegexCompile::matchStartType() {
fRXPat->fInitialChars->complement();
numInitialStrings += 2;
}
- currentLen = safeIncrement(currentLen, 1);
+ currentLen = safeIncrement(currentLen, 1);
atStart = FALSE;
break;
@@ -3010,7 +3010,7 @@ void RegexCompile::matchStartType() {
fRXPat->fInitialStringLen = stringLen;
}
- currentLen = safeIncrement(currentLen, stringLen);
+ currentLen = safeIncrement(currentLen, stringLen);
atStart = FALSE;
}
break;
@@ -3035,7 +3035,7 @@ void RegexCompile::matchStartType() {
fRXPat->fInitialChars->addAll(s);
numInitialStrings += 2; // Matching on an initial string not possible.
}
- currentLen = safeIncrement(currentLen, stringLen);
+ currentLen = safeIncrement(currentLen, stringLen);
atStart = FALSE;
}
break;
@@ -3127,10 +3127,10 @@ void RegexCompile::matchStartType() {
case URX_LB_END:
case URX_LBN_CONT:
case URX_LBN_END:
- UPRV_UNREACHABLE; // Shouldn't get here. These ops should be
+ UPRV_UNREACHABLE; // Shouldn't get here. These ops should be
// consumed by the scan in URX_LA_START and LB_START
default:
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
}
@@ -3290,7 +3290,7 @@ int32_t RegexCompile::minMatchLength(int32_t start, int32_t end) {
case URX_DOTANY_ALL: // . matches one or two.
case URX_DOTANY:
case URX_DOTANY_UNIX:
- currentLen = safeIncrement(currentLen, 1);
+ currentLen = safeIncrement(currentLen, 1);
break;
@@ -3342,7 +3342,7 @@ int32_t RegexCompile::minMatchLength(int32_t start, int32_t end) {
{
loc++;
int32_t stringLenOp = (int32_t)fRXPat->fCompiledPat->elementAti(loc);
- currentLen = safeIncrement(currentLen, URX_VAL(stringLenOp));
+ currentLen = safeIncrement(currentLen, URX_VAL(stringLenOp));
}
break;
@@ -3355,7 +3355,7 @@ int32_t RegexCompile::minMatchLength(int32_t start, int32_t end) {
// Assume a min length of one for now. A min length of zero causes
// optimization failures for a pattern like "string"+
// currentLen += URX_VAL(stringLenOp);
- currentLen = safeIncrement(currentLen, 1);
+ currentLen = safeIncrement(currentLen, 1);
}
break;
@@ -3401,7 +3401,7 @@ int32_t RegexCompile::minMatchLength(int32_t start, int32_t end) {
// it assumes that the look-ahead match might be zero-length.
// TODO: Positive lookahead could recursively do the block, then continue
// with the longer of the block or the value coming in. Ticket 6060
- int32_t depth = (opType == URX_LA_START? 2: 1);
+ int32_t depth = (opType == URX_LA_START? 2: 1);
for (;;) {
loc++;
op = (int32_t)fRXPat->fCompiledPat->elementAti(loc);
@@ -3450,7 +3450,7 @@ int32_t RegexCompile::minMatchLength(int32_t start, int32_t end) {
break;
default:
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
}
@@ -3691,9 +3691,9 @@ int32_t RegexCompile::maxMatchLength(int32_t start, int32_t end) {
case URX_CTR_LOOP:
case URX_CTR_LOOP_NG:
- // These opcodes will be skipped over by code for URX_CTR_INIT.
+ // These opcodes will be skipped over by code for URX_CTR_INIT.
// We shouldn't encounter them here.
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
case URX_LOOP_SR_I:
case URX_LOOP_DOT_I:
@@ -3713,26 +3713,26 @@ int32_t RegexCompile::maxMatchLength(int32_t start, int32_t end) {
// End of look-ahead ops should always be consumed by the processing at
// the URX_LA_START op.
- // UPRV_UNREACHABLE;
+ // UPRV_UNREACHABLE;
case URX_LB_START:
{
// Look-behind. Scan forward until the matching look-around end,
// without processing the look-behind block.
- int32_t dataLoc = URX_VAL(op);
- for (loc = loc + 1; loc < end; ++loc) {
+ int32_t dataLoc = URX_VAL(op);
+ for (loc = loc + 1; loc < end; ++loc) {
op = (int32_t)fRXPat->fCompiledPat->elementAti(loc);
- int32_t opType = URX_TYPE(op);
- if ((opType == URX_LA_END || opType == URX_LBN_END) && (URX_VAL(op) == dataLoc)) {
- break;
+ int32_t opType = URX_TYPE(op);
+ if ((opType == URX_LA_END || opType == URX_LBN_END) && (URX_VAL(op) == dataLoc)) {
+ break;
}
}
- U_ASSERT(loc < end);
+ U_ASSERT(loc < end);
}
break;
default:
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
@@ -3887,7 +3887,7 @@ void RegexCompile::stripNOPs() {
default:
// Some op is unaccounted for.
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
}
@@ -3904,7 +3904,7 @@ void RegexCompile::stripNOPs() {
//
//------------------------------------------------------------------------------
void RegexCompile::error(UErrorCode e) {
- if (U_SUCCESS(*fStatus) || e == U_MEMORY_ALLOCATION_ERROR) {
+ if (U_SUCCESS(*fStatus) || e == U_MEMORY_ALLOCATION_ERROR) {
*fStatus = e;
// Hmm. fParseErr (UParseError) line & offset fields are int32_t in public
// API (see common/unicode/parseerr.h), while fLineNum and fCharNum are
@@ -4023,7 +4023,7 @@ UChar32 RegexCompile::peekCharLL() {
//
//------------------------------------------------------------------------------
void RegexCompile::nextChar(RegexPatternChar &c) {
- tailRecursion:
+ tailRecursion:
fScanIndex = UTEXT_GETNATIVEINDEX(fRXPat->fPattern);
c.fChar = nextCharLL();
c.fQuoted = FALSE;
@@ -4034,9 +4034,9 @@ void RegexCompile::nextChar(RegexPatternChar &c) {
c.fChar == (UChar32)-1) {
fQuoteMode = FALSE; // Exit quote mode,
nextCharLL(); // discard the E
- // nextChar(c); // recurse to get the real next char
- goto tailRecursion; // Note: fuzz testing produced testcases that
- // resulted in stack overflow here.
+ // nextChar(c); // recurse to get the real next char
+ goto tailRecursion; // Note: fuzz testing produced testcases that
+ // resulted in stack overflow here.
}
}
else if (fInBackslashQuote) {
@@ -4154,10 +4154,10 @@ void RegexCompile::nextChar(RegexPatternChar &c) {
else if (peekCharLL() == chQ) {
// "\Q" enter quote mode, which will continue until "\E"
fQuoteMode = TRUE;
- nextCharLL(); // discard the 'Q'.
- // nextChar(c); // recurse to get the real next char.
- goto tailRecursion; // Note: fuzz testing produced test cases that
- // resulted in stack overflow here.
+ nextCharLL(); // discard the 'Q'.
+ // nextChar(c); // recurse to get the real next char.
+ goto tailRecursion; // Note: fuzz testing produced test cases that
+ // resulted in stack overflow here.
}
else
{
@@ -4389,203 +4389,203 @@ static inline void addIdentifierIgnorable(UnicodeSet *set, UErrorCode& ec) {
UnicodeSet *RegexCompile::createSetForProperty(const UnicodeString &propName, UBool negated) {
if (U_FAILURE(*fStatus)) {
- return nullptr;
+ return nullptr;
}
- LocalPointer<UnicodeSet> set;
- UErrorCode status = U_ZERO_ERROR;
-
- do { // non-loop, exists to allow breaks from the block.
- //
- // First try the property as we received it
- //
- UnicodeString setExpr;
- uint32_t usetFlags = 0;
- setExpr.append(u"[\\p{", -1);
- setExpr.append(propName);
- setExpr.append(u"}]", -1);
- if (fModeFlags & UREGEX_CASE_INSENSITIVE) {
- usetFlags |= USET_CASE_INSENSITIVE;
- }
- set.adoptInsteadAndCheckErrorCode(new UnicodeSet(setExpr, usetFlags, NULL, status), status);
- if (U_SUCCESS(status) || status == U_MEMORY_ALLOCATION_ERROR) {
- break;
- }
-
- //
- // The incoming property wasn't directly recognized by ICU.
-
- // Check [:word:] and [:all:]. These are not recognized as a properties by ICU UnicodeSet.
- // Java accepts 'word' with mixed case.
- // Java accepts 'all' only in all lower case.
-
- status = U_ZERO_ERROR;
- if (propName.caseCompare(u"word", -1, 0) == 0) {
- set.adoptInsteadAndCheckErrorCode(
- RegexStaticSets::gStaticSets->fPropSets[URX_ISWORD_SET].cloneAsThawed(), status);
- break;
+ LocalPointer<UnicodeSet> set;
+ UErrorCode status = U_ZERO_ERROR;
+
+ do { // non-loop, exists to allow breaks from the block.
+ //
+ // First try the property as we received it
+ //
+ UnicodeString setExpr;
+ uint32_t usetFlags = 0;
+ setExpr.append(u"[\\p{", -1);
+ setExpr.append(propName);
+ setExpr.append(u"}]", -1);
+ if (fModeFlags & UREGEX_CASE_INSENSITIVE) {
+ usetFlags |= USET_CASE_INSENSITIVE;
}
- if (propName.compare(u"all", -1) == 0) {
- set.adoptInsteadAndCheckErrorCode(new UnicodeSet(0, 0x10ffff), status);
- break;
+ set.adoptInsteadAndCheckErrorCode(new UnicodeSet(setExpr, usetFlags, NULL, status), status);
+ if (U_SUCCESS(status) || status == U_MEMORY_ALLOCATION_ERROR) {
+ break;
}
+ //
+ // The incoming property wasn't directly recognized by ICU.
+
+ // Check [:word:] and [:all:]. These are not recognized as a properties by ICU UnicodeSet.
+ // Java accepts 'word' with mixed case.
+ // Java accepts 'all' only in all lower case.
- // Do Java InBlock expressions
+ status = U_ZERO_ERROR;
+ if (propName.caseCompare(u"word", -1, 0) == 0) {
+ set.adoptInsteadAndCheckErrorCode(
+ RegexStaticSets::gStaticSets->fPropSets[URX_ISWORD_SET].cloneAsThawed(), status);
+ break;
+ }
+ if (propName.compare(u"all", -1) == 0) {
+ set.adoptInsteadAndCheckErrorCode(new UnicodeSet(0, 0x10ffff), status);
+ break;
+ }
+
+
+ // Do Java InBlock expressions
//
- UnicodeString mPropName = propName;
- if (mPropName.startsWith(u"In", 2) && mPropName.length() >= 3) {
- status = U_ZERO_ERROR;
- set.adoptInsteadAndCheckErrorCode(new UnicodeSet(), status);
- if (U_FAILURE(status)) {
- break;
- }
- UnicodeString blockName(mPropName, 2); // Property with the leading "In" removed.
- set->applyPropertyAlias(UnicodeString(u"Block"), blockName, status);
- break;
+ UnicodeString mPropName = propName;
+ if (mPropName.startsWith(u"In", 2) && mPropName.length() >= 3) {
+ status = U_ZERO_ERROR;
+ set.adoptInsteadAndCheckErrorCode(new UnicodeSet(), status);
+ if (U_FAILURE(status)) {
+ break;
+ }
+ UnicodeString blockName(mPropName, 2); // Property with the leading "In" removed.
+ set->applyPropertyAlias(UnicodeString(u"Block"), blockName, status);
+ break;
}
- // Check for the Java form "IsBooleanPropertyValue", which we will recast
- // as "BooleanPropertyValue". The property value can be either a
- // a General Category or a Script Name.
-
- if (propName.startsWith(u"Is", 2) && propName.length()>=3) {
- mPropName.remove(0, 2); // Strip the "Is"
- if (mPropName.indexOf(u'=') >= 0) {
- // Reject any "Is..." property expression containing an '=', that is,
- // any non-binary property expression.
- status = U_REGEX_PROPERTY_SYNTAX;
- break;
- }
-
- if (mPropName.caseCompare(u"assigned", -1, 0) == 0) {
- mPropName.setTo(u"unassigned", -1);
- negated = !negated;
- } else if (mPropName.caseCompare(u"TitleCase", -1, 0) == 0) {
- mPropName.setTo(u"Titlecase_Letter", -1);
- }
-
- mPropName.insert(0, u"[\\p{", -1);
- mPropName.append(u"}]", -1);
- set.adoptInsteadAndCheckErrorCode(new UnicodeSet(mPropName, *fStatus), status);
-
- if (U_SUCCESS(status) && !set->isEmpty() && (usetFlags & USET_CASE_INSENSITIVE)) {
+ // Check for the Java form "IsBooleanPropertyValue", which we will recast
+ // as "BooleanPropertyValue". The property value can be either a
+ // a General Category or a Script Name.
+
+ if (propName.startsWith(u"Is", 2) && propName.length()>=3) {
+ mPropName.remove(0, 2); // Strip the "Is"
+ if (mPropName.indexOf(u'=') >= 0) {
+ // Reject any "Is..." property expression containing an '=', that is,
+ // any non-binary property expression.
+ status = U_REGEX_PROPERTY_SYNTAX;
+ break;
+ }
+
+ if (mPropName.caseCompare(u"assigned", -1, 0) == 0) {
+ mPropName.setTo(u"unassigned", -1);
+ negated = !negated;
+ } else if (mPropName.caseCompare(u"TitleCase", -1, 0) == 0) {
+ mPropName.setTo(u"Titlecase_Letter", -1);
+ }
+
+ mPropName.insert(0, u"[\\p{", -1);
+ mPropName.append(u"}]", -1);
+ set.adoptInsteadAndCheckErrorCode(new UnicodeSet(mPropName, *fStatus), status);
+
+ if (U_SUCCESS(status) && !set->isEmpty() && (usetFlags & USET_CASE_INSENSITIVE)) {
set->closeOver(USET_CASE_INSENSITIVE);
}
- break;
-
- }
-
- if (propName.startsWith(u"java", -1)) {
- status = U_ZERO_ERROR;
- set.adoptInsteadAndCheckErrorCode(new UnicodeSet(), status);
- if (U_FAILURE(status)) {
- break;
- }
- //
- // Try the various Java specific properties.
- // These all begin with "java"
- //
- if (propName.compare(u"javaDefined", -1) == 0) {
- addCategory(set.getAlias(), U_GC_CN_MASK, status);
+ break;
+
+ }
+
+ if (propName.startsWith(u"java", -1)) {
+ status = U_ZERO_ERROR;
+ set.adoptInsteadAndCheckErrorCode(new UnicodeSet(), status);
+ if (U_FAILURE(status)) {
+ break;
+ }
+ //
+ // Try the various Java specific properties.
+ // These all begin with "java"
+ //
+ if (propName.compare(u"javaDefined", -1) == 0) {
+ addCategory(set.getAlias(), U_GC_CN_MASK, status);
set->complement();
}
- else if (propName.compare(u"javaDigit", -1) == 0) {
- addCategory(set.getAlias(), U_GC_ND_MASK, status);
- }
- else if (propName.compare(u"javaIdentifierIgnorable", -1) == 0) {
- addIdentifierIgnorable(set.getAlias(), status);
- }
- else if (propName.compare(u"javaISOControl", -1) == 0) {
- set->add(0, 0x1F).add(0x7F, 0x9F);
- }
- else if (propName.compare(u"javaJavaIdentifierPart", -1) == 0) {
- addCategory(set.getAlias(), U_GC_L_MASK, status);
- addCategory(set.getAlias(), U_GC_SC_MASK, status);
- addCategory(set.getAlias(), U_GC_PC_MASK, status);
- addCategory(set.getAlias(), U_GC_ND_MASK, status);
- addCategory(set.getAlias(), U_GC_NL_MASK, status);
- addCategory(set.getAlias(), U_GC_MC_MASK, status);
- addCategory(set.getAlias(), U_GC_MN_MASK, status);
- addIdentifierIgnorable(set.getAlias(), status);
- }
- else if (propName.compare(u"javaJavaIdentifierStart", -1) == 0) {
- addCategory(set.getAlias(), U_GC_L_MASK, status);
- addCategory(set.getAlias(), U_GC_NL_MASK, status);
- addCategory(set.getAlias(), U_GC_SC_MASK, status);
- addCategory(set.getAlias(), U_GC_PC_MASK, status);
- }
- else if (propName.compare(u"javaLetter", -1) == 0) {
- addCategory(set.getAlias(), U_GC_L_MASK, status);
- }
- else if (propName.compare(u"javaLetterOrDigit", -1) == 0) {
- addCategory(set.getAlias(), U_GC_L_MASK, status);
- addCategory(set.getAlias(), U_GC_ND_MASK, status);
- }
- else if (propName.compare(u"javaLowerCase", -1) == 0) {
- addCategory(set.getAlias(), U_GC_LL_MASK, status);
- }
- else if (propName.compare(u"javaMirrored", -1) == 0) {
- set->applyIntPropertyValue(UCHAR_BIDI_MIRRORED, 1, status);
- }
- else if (propName.compare(u"javaSpaceChar", -1) == 0) {
- addCategory(set.getAlias(), U_GC_Z_MASK, status);
- }
- else if (propName.compare(u"javaSupplementaryCodePoint", -1) == 0) {
- set->add(0x10000, UnicodeSet::MAX_VALUE);
- }
- else if (propName.compare(u"javaTitleCase", -1) == 0) {
- addCategory(set.getAlias(), U_GC_LT_MASK, status);
- }
- else if (propName.compare(u"javaUnicodeIdentifierStart", -1) == 0) {
- addCategory(set.getAlias(), U_GC_L_MASK, status);
- addCategory(set.getAlias(), U_GC_NL_MASK, status);
- }
- else if (propName.compare(u"javaUnicodeIdentifierPart", -1) == 0) {
- addCategory(set.getAlias(), U_GC_L_MASK, status);
- addCategory(set.getAlias(), U_GC_PC_MASK, status);
- addCategory(set.getAlias(), U_GC_ND_MASK, status);
- addCategory(set.getAlias(), U_GC_NL_MASK, status);
- addCategory(set.getAlias(), U_GC_MC_MASK, status);
- addCategory(set.getAlias(), U_GC_MN_MASK, status);
- addIdentifierIgnorable(set.getAlias(), status);
- }
- else if (propName.compare(u"javaUpperCase", -1) == 0) {
- addCategory(set.getAlias(), U_GC_LU_MASK, status);
- }
- else if (propName.compare(u"javaValidCodePoint", -1) == 0) {
- set->add(0, UnicodeSet::MAX_VALUE);
- }
- else if (propName.compare(u"javaWhitespace", -1) == 0) {
- addCategory(set.getAlias(), U_GC_Z_MASK, status);
- set->removeAll(UnicodeSet().add(0xa0).add(0x2007).add(0x202f));
- set->add(9, 0x0d).add(0x1c, 0x1f);
- } else {
- status = U_REGEX_PROPERTY_SYNTAX;
- }
-
- if (U_SUCCESS(status) && !set->isEmpty() && (usetFlags & USET_CASE_INSENSITIVE)) {
- set->closeOver(USET_CASE_INSENSITIVE);
- }
- break;
+ else if (propName.compare(u"javaDigit", -1) == 0) {
+ addCategory(set.getAlias(), U_GC_ND_MASK, status);
+ }
+ else if (propName.compare(u"javaIdentifierIgnorable", -1) == 0) {
+ addIdentifierIgnorable(set.getAlias(), status);
+ }
+ else if (propName.compare(u"javaISOControl", -1) == 0) {
+ set->add(0, 0x1F).add(0x7F, 0x9F);
+ }
+ else if (propName.compare(u"javaJavaIdentifierPart", -1) == 0) {
+ addCategory(set.getAlias(), U_GC_L_MASK, status);
+ addCategory(set.getAlias(), U_GC_SC_MASK, status);
+ addCategory(set.getAlias(), U_GC_PC_MASK, status);
+ addCategory(set.getAlias(), U_GC_ND_MASK, status);
+ addCategory(set.getAlias(), U_GC_NL_MASK, status);
+ addCategory(set.getAlias(), U_GC_MC_MASK, status);
+ addCategory(set.getAlias(), U_GC_MN_MASK, status);
+ addIdentifierIgnorable(set.getAlias(), status);
+ }
+ else if (propName.compare(u"javaJavaIdentifierStart", -1) == 0) {
+ addCategory(set.getAlias(), U_GC_L_MASK, status);
+ addCategory(set.getAlias(), U_GC_NL_MASK, status);
+ addCategory(set.getAlias(), U_GC_SC_MASK, status);
+ addCategory(set.getAlias(), U_GC_PC_MASK, status);
+ }
+ else if (propName.compare(u"javaLetter", -1) == 0) {
+ addCategory(set.getAlias(), U_GC_L_MASK, status);
+ }
+ else if (propName.compare(u"javaLetterOrDigit", -1) == 0) {
+ addCategory(set.getAlias(), U_GC_L_MASK, status);
+ addCategory(set.getAlias(), U_GC_ND_MASK, status);
+ }
+ else if (propName.compare(u"javaLowerCase", -1) == 0) {
+ addCategory(set.getAlias(), U_GC_LL_MASK, status);
+ }
+ else if (propName.compare(u"javaMirrored", -1) == 0) {
+ set->applyIntPropertyValue(UCHAR_BIDI_MIRRORED, 1, status);
+ }
+ else if (propName.compare(u"javaSpaceChar", -1) == 0) {
+ addCategory(set.getAlias(), U_GC_Z_MASK, status);
+ }
+ else if (propName.compare(u"javaSupplementaryCodePoint", -1) == 0) {
+ set->add(0x10000, UnicodeSet::MAX_VALUE);
+ }
+ else if (propName.compare(u"javaTitleCase", -1) == 0) {
+ addCategory(set.getAlias(), U_GC_LT_MASK, status);
+ }
+ else if (propName.compare(u"javaUnicodeIdentifierStart", -1) == 0) {
+ addCategory(set.getAlias(), U_GC_L_MASK, status);
+ addCategory(set.getAlias(), U_GC_NL_MASK, status);
+ }
+ else if (propName.compare(u"javaUnicodeIdentifierPart", -1) == 0) {
+ addCategory(set.getAlias(), U_GC_L_MASK, status);
+ addCategory(set.getAlias(), U_GC_PC_MASK, status);
+ addCategory(set.getAlias(), U_GC_ND_MASK, status);
+ addCategory(set.getAlias(), U_GC_NL_MASK, status);
+ addCategory(set.getAlias(), U_GC_MC_MASK, status);
+ addCategory(set.getAlias(), U_GC_MN_MASK, status);
+ addIdentifierIgnorable(set.getAlias(), status);
+ }
+ else if (propName.compare(u"javaUpperCase", -1) == 0) {
+ addCategory(set.getAlias(), U_GC_LU_MASK, status);
+ }
+ else if (propName.compare(u"javaValidCodePoint", -1) == 0) {
+ set->add(0, UnicodeSet::MAX_VALUE);
+ }
+ else if (propName.compare(u"javaWhitespace", -1) == 0) {
+ addCategory(set.getAlias(), U_GC_Z_MASK, status);
+ set->removeAll(UnicodeSet().add(0xa0).add(0x2007).add(0x202f));
+ set->add(9, 0x0d).add(0x1c, 0x1f);
+ } else {
+ status = U_REGEX_PROPERTY_SYNTAX;
+ }
+
+ if (U_SUCCESS(status) && !set->isEmpty() && (usetFlags & USET_CASE_INSENSITIVE)) {
+ set->closeOver(USET_CASE_INSENSITIVE);
+ }
+ break;
+ }
+
+ // Unrecognized property. ICU didn't like it as it was, and none of the Java compatibility
+ // extensions matched it.
+ status = U_REGEX_PROPERTY_SYNTAX;
+ } while (false); // End of do loop block. Code above breaks out of the block on success or hard failure.
+
+ if (U_SUCCESS(status)) {
+ U_ASSERT(set.isValid());
+ if (negated) {
+ set->complement();
+ }
+ return set.orphan();
+ } else {
+ if (status == U_ILLEGAL_ARGUMENT_ERROR) {
+ status = U_REGEX_PROPERTY_SYNTAX;
}
-
- // Unrecognized property. ICU didn't like it as it was, and none of the Java compatibility
- // extensions matched it.
- status = U_REGEX_PROPERTY_SYNTAX;
- } while (false); // End of do loop block. Code above breaks out of the block on success or hard failure.
-
- if (U_SUCCESS(status)) {
- U_ASSERT(set.isValid());
- if (negated) {
- set->complement();
- }
- return set.orphan();
- } else {
- if (status == U_ILLEGAL_ARGUMENT_ERROR) {
- status = U_REGEX_PROPERTY_SYNTAX;
- }
- error(status);
- return nullptr;
+ error(status);
+ return nullptr;
}
}
@@ -4638,7 +4638,7 @@ void RegexCompile::setEval(int32_t nextOp) {
delete rightOperand;
break;
default:
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
}
}
diff --git a/contrib/libs/icu/i18n/regexcmp.h b/contrib/libs/icu/i18n/regexcmp.h
index 279c81a257..f2aeea909e 100644
--- a/contrib/libs/icu/i18n/regexcmp.h
+++ b/contrib/libs/icu/i18n/regexcmp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// regexcmp.h
diff --git a/contrib/libs/icu/i18n/regexcst.h b/contrib/libs/icu/i18n/regexcst.h
index db32a4ca1c..d44c2aec2b 100644
--- a/contrib/libs/icu/i18n/regexcst.h
+++ b/contrib/libs/icu/i18n/regexcst.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//---------------------------------------------------------------------------------
//
@@ -20,117 +20,117 @@ U_NAMESPACE_BEGIN
//
// Character classes for regex pattern scanning.
//
- static const uint8_t kRuleSet_digit_char = 128;
- static const uint8_t kRuleSet_ascii_letter = 129;
+ static const uint8_t kRuleSet_digit_char = 128;
+ static const uint8_t kRuleSet_ascii_letter = 129;
static const uint8_t kRuleSet_rule_char = 130;
- constexpr uint32_t kRuleSet_count = 131-128;
+ constexpr uint32_t kRuleSet_count = 131-128;
enum Regex_PatternParseAction {
- doSetBackslash_D,
- doBackslashh,
- doBackslashH,
+ doSetBackslash_D,
+ doBackslashh,
+ doBackslashH,
doSetLiteralEscaped,
- doOpenLookAheadNeg,
- doCompleteNamedBackRef,
- doPatStart,
- doBackslashS,
- doBackslashD,
- doNGStar,
+ doOpenLookAheadNeg,
+ doCompleteNamedBackRef,
+ doPatStart,
+ doBackslashS,
+ doBackslashD,
+ doNGStar,
doNOP,
- doBackslashX,
- doSetLiteral,
- doContinueNamedCapture,
- doBackslashG,
- doBackslashR,
- doSetBegin,
- doSetBackslash_v,
- doPossessivePlus,
- doPerlInline,
+ doBackslashX,
+ doSetLiteral,
+ doContinueNamedCapture,
+ doBackslashG,
+ doBackslashR,
+ doSetBegin,
+ doSetBackslash_v,
+ doPossessivePlus,
+ doPerlInline,
doBackslashZ,
doSetAddAmp,
doSetBeginDifference1,
- doIntervalError,
+ doIntervalError,
doSetNegate,
- doIntervalInit,
- doSetIntersection2,
- doPossessiveInterval,
+ doIntervalInit,
+ doSetIntersection2,
+ doPossessiveInterval,
doRuleError,
- doBackslashW,
- doContinueNamedBackRef,
- doOpenNonCaptureParen,
- doExit,
- doSetNamedChar,
- doSetBackslash_V,
+ doBackslashW,
+ doContinueNamedBackRef,
+ doOpenNonCaptureParen,
+ doExit,
+ doSetNamedChar,
+ doSetBackslash_V,
doConditionalExpr,
- doEscapeError,
- doBadOpenParenType,
+ doEscapeError,
+ doBadOpenParenType,
doPossessiveStar,
- doSetAddDash,
- doEscapedLiteralChar,
- doSetBackslash_w,
- doIntervalUpperDigit,
- doBackslashv,
- doSetBackslash_S,
- doSetNoCloseError,
- doSetProp,
- doBackslashB,
- doSetEnd,
- doSetRange,
- doMatchModeParen,
+ doSetAddDash,
+ doEscapedLiteralChar,
+ doSetBackslash_w,
+ doIntervalUpperDigit,
+ doBackslashv,
+ doSetBackslash_S,
+ doSetNoCloseError,
+ doSetProp,
+ doBackslashB,
+ doSetEnd,
+ doSetRange,
+ doMatchModeParen,
doPlus,
- doBackslashV,
- doSetMatchMode,
- doBackslashz,
- doSetNamedRange,
- doOpenLookBehindNeg,
- doInterval,
- doBadNamedCapture,
- doBeginMatchMode,
- doBackslashd,
- doPatFinish,
- doNamedChar,
- doNGPlus,
- doSetDifference2,
- doSetBackslash_H,
+ doBackslashV,
+ doSetMatchMode,
+ doBackslashz,
+ doSetNamedRange,
+ doOpenLookBehindNeg,
+ doInterval,
+ doBadNamedCapture,
+ doBeginMatchMode,
+ doBackslashd,
+ doPatFinish,
+ doNamedChar,
+ doNGPlus,
+ doSetDifference2,
+ doSetBackslash_H,
doCloseParen,
- doDotAny,
- doOpenCaptureParen,
- doEnterQuoteMode,
- doOpenAtomicParen,
- doBadModeFlag,
- doSetBackslash_d,
- doSetFinish,
- doProperty,
- doBeginNamedBackRef,
+ doDotAny,
+ doOpenCaptureParen,
+ doEnterQuoteMode,
+ doOpenAtomicParen,
+ doBadModeFlag,
+ doSetBackslash_d,
+ doSetFinish,
+ doProperty,
+ doBeginNamedBackRef,
doBackRef,
doOpt,
- doDollar,
- doBeginNamedCapture,
- doNGInterval,
- doSetOpError,
- doSetPosixProp,
+ doDollar,
+ doBeginNamedCapture,
+ doNGInterval,
+ doSetOpError,
+ doSetPosixProp,
doSetBeginIntersection1,
- doBackslashb,
- doSetBeginUnion,
- doIntevalLowerDigit,
- doSetBackslash_h,
- doStar,
- doMatchMode,
+ doBackslashb,
+ doSetBeginUnion,
+ doIntevalLowerDigit,
+ doSetBackslash_h,
+ doStar,
+ doMatchMode,
doBackslashA,
- doOpenLookBehind,
- doPossessiveOpt,
- doOrOperator,
- doBackslashw,
- doBackslashs,
+ doOpenLookBehind,
+ doPossessiveOpt,
+ doOrOperator,
+ doBackslashw,
+ doBackslashs,
doLiteralChar,
doSuppressComments,
- doCaret,
- doIntervalSame,
- doNGOpt,
- doOpenLookAhead,
- doSetBackslash_W,
+ doCaret,
+ doIntervalSame,
+ doNGOpt,
+ doOpenLookAhead,
+ doSetBackslash_W,
doMismatchedParenErr,
- doSetBackslash_s,
+ doSetBackslash_s,
rbbiLastAction};
//-------------------------------------------------------------------------------
@@ -197,7 +197,7 @@ static const struct RegexTableEl gRuleParseStateTable[] = {
, {doBadOpenParenType, 255, 206,0, FALSE} // 45
, {doOpenLookBehind, 61 /* = */, 2, 20, TRUE} // 46 open-paren-lookbehind
, {doOpenLookBehindNeg, 33 /* ! */, 2, 20, TRUE} // 47
- , {doBeginNamedCapture, 129, 64,0, FALSE} // 48
+ , {doBeginNamedCapture, 129, 64,0, FALSE} // 48
, {doBadOpenParenType, 255, 206,0, FALSE} // 49
, {doNOP, 41 /* ) */, 255,0, TRUE} // 50 paren-comment
, {doMismatchedParenErr, 253, 206,0, FALSE} // 51
@@ -213,8 +213,8 @@ static const struct RegexTableEl gRuleParseStateTable[] = {
, {doSetMatchMode, 41 /* ) */, 2,0, TRUE} // 61
, {doMatchModeParen, 58 /* : */, 2, 14, TRUE} // 62
, {doBadModeFlag, 255, 206,0, FALSE} // 63
- , {doContinueNamedCapture, 129, 64,0, TRUE} // 64 named-capture
- , {doContinueNamedCapture, 128, 64,0, TRUE} // 65
+ , {doContinueNamedCapture, 129, 64,0, TRUE} // 64 named-capture
+ , {doContinueNamedCapture, 128, 64,0, TRUE} // 65
, {doOpenCaptureParen, 62 /* > */, 2, 14, TRUE} // 66
, {doBadNamedCapture, 255, 206,0, FALSE} // 67
, {doNGStar, 63 /* ? */, 20,0, TRUE} // 68 quant-star
@@ -226,13 +226,13 @@ static const struct RegexTableEl gRuleParseStateTable[] = {
, {doNGOpt, 63 /* ? */, 20,0, TRUE} // 74 quant-opt
, {doPossessiveOpt, 43 /* + */, 20,0, TRUE} // 75
, {doOpt, 255, 20,0, FALSE} // 76
- , {doNOP, 128, 79,0, FALSE} // 77 interval-open
+ , {doNOP, 128, 79,0, FALSE} // 77 interval-open
, {doIntervalError, 255, 206,0, FALSE} // 78
- , {doIntevalLowerDigit, 128, 79,0, TRUE} // 79 interval-lower
+ , {doIntevalLowerDigit, 128, 79,0, TRUE} // 79 interval-lower
, {doNOP, 44 /* , */, 83,0, TRUE} // 80
, {doIntervalSame, 125 /* } */, 86,0, TRUE} // 81
, {doIntervalError, 255, 206,0, FALSE} // 82
- , {doIntervalUpperDigit, 128, 83,0, TRUE} // 83 interval-upper
+ , {doIntervalUpperDigit, 128, 83,0, TRUE} // 83 interval-upper
, {doNOP, 125 /* } */, 86,0, TRUE} // 84
, {doIntervalError, 255, 206,0, FALSE} // 85
, {doNGInterval, 63 /* ? */, 20,0, TRUE} // 86 interval-type
@@ -261,15 +261,15 @@ static const struct RegexTableEl gRuleParseStateTable[] = {
, {doBackslashX, 88 /* X */, 14,0, TRUE} // 109
, {doBackslashZ, 90 /* Z */, 2,0, TRUE} // 110
, {doBackslashz, 122 /* z */, 2,0, TRUE} // 111
- , {doBackRef, 128, 14,0, TRUE} // 112
+ , {doBackRef, 128, 14,0, TRUE} // 112
, {doEscapeError, 253, 206,0, FALSE} // 113
, {doEscapedLiteralChar, 255, 14,0, TRUE} // 114
, {doBeginNamedBackRef, 60 /* < */, 117,0, TRUE} // 115 named-backref
, {doBadNamedCapture, 255, 206,0, FALSE} // 116
- , {doContinueNamedBackRef, 129, 119,0, TRUE} // 117 named-backref-2
+ , {doContinueNamedBackRef, 129, 119,0, TRUE} // 117 named-backref-2
, {doBadNamedCapture, 255, 206,0, FALSE} // 118
- , {doContinueNamedBackRef, 129, 119,0, TRUE} // 119 named-backref-3
- , {doContinueNamedBackRef, 128, 119,0, TRUE} // 120
+ , {doContinueNamedBackRef, 129, 119,0, TRUE} // 119 named-backref-3
+ , {doContinueNamedBackRef, 128, 119,0, TRUE} // 120
, {doCompleteNamedBackRef, 62 /* > */, 14,0, TRUE} // 121
, {doBadNamedCapture, 255, 206,0, FALSE} // 122
, {doSetNegate, 94 /* ^ */, 126,0, TRUE} // 123 set-open
diff --git a/contrib/libs/icu/i18n/regeximp.cpp b/contrib/libs/icu/i18n/regeximp.cpp
index a933ae9c54..d555669625 100644
--- a/contrib/libs/icu/i18n/regeximp.cpp
+++ b/contrib/libs/icu/i18n/regeximp.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// Copyright (C) 2012 International Business Machines Corporation
@@ -19,7 +19,7 @@
U_NAMESPACE_BEGIN
CaseFoldingUTextIterator::CaseFoldingUTextIterator(UText &text) :
- fUText(text), fFoldChars(NULL), fFoldLength(0) {
+ fUText(text), fFoldChars(NULL), fFoldLength(0) {
}
CaseFoldingUTextIterator::~CaseFoldingUTextIterator() {}
@@ -34,7 +34,7 @@ UChar32 CaseFoldingUTextIterator::next() {
if (originalC == U_SENTINEL) {
return originalC;
}
- fFoldLength = ucase_toFullFolding(originalC, &fFoldChars, U_FOLD_CASE_DEFAULT);
+ fFoldLength = ucase_toFullFolding(originalC, &fFoldChars, U_FOLD_CASE_DEFAULT);
if (fFoldLength >= UCASE_MAX_STRING_LENGTH || fFoldLength < 0) {
// input code point folds to a single code point, possibly itself.
// See comment in ucase.h for explanation of return values from ucase_toFullFoldings.
@@ -64,7 +64,7 @@ UBool CaseFoldingUTextIterator::inExpansion() {
CaseFoldingUCharIterator::CaseFoldingUCharIterator(const UChar *chars, int64_t start, int64_t limit) :
- fChars(chars), fIndex(start), fLimit(limit), fFoldChars(NULL), fFoldLength(0) {
+ fChars(chars), fIndex(start), fLimit(limit), fFoldChars(NULL), fFoldLength(0) {
}
@@ -82,7 +82,7 @@ UChar32 CaseFoldingUCharIterator::next() {
}
U16_NEXT(fChars, fIndex, fLimit, originalC);
- fFoldLength = ucase_toFullFolding(originalC, &fFoldChars, U_FOLD_CASE_DEFAULT);
+ fFoldLength = ucase_toFullFolding(originalC, &fFoldChars, U_FOLD_CASE_DEFAULT);
if (fFoldLength >= UCASE_MAX_STRING_LENGTH || fFoldLength < 0) {
// input code point folds to a single code point, possibly itself.
// See comment in ucase.h for explanation of return values from ucase_toFullFoldings.
diff --git a/contrib/libs/icu/i18n/regeximp.h b/contrib/libs/icu/i18n/regeximp.h
index 7376c112fb..590d216895 100644
--- a/contrib/libs/icu/i18n/regeximp.h
+++ b/contrib/libs/icu/i18n/regeximp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// Copyright (C) 2002-2015 International Business Machines Corporation
@@ -123,7 +123,7 @@ enum {
// saved input position, FAIL rather than taking
// the JMP
URX_LA_START = 37, // Starting a LookAround expression.
- // Save InputPos, SP and active region in static data.
+ // Save InputPos, SP and active region in static data.
// Operand: Static data offset for the save
URX_LA_END = 38, // Ending a Lookaround expression.
// Restore InputPos and Stack to saved values.
diff --git a/contrib/libs/icu/i18n/regexst.cpp b/contrib/libs/icu/i18n/regexst.cpp
index d117a80e9b..97e417ab5a 100644
--- a/contrib/libs/icu/i18n/regexst.cpp
+++ b/contrib/libs/icu/i18n/regexst.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// regexst.h
@@ -37,99 +37,99 @@
U_NAMESPACE_BEGIN
-// "Rule Char" Characters are those with special meaning, and therefore
-// need to be escaped to appear as literals in a regexp.
-constexpr char16_t const *gRuleSet_rule_chars = u"*?+[(){}^$|\\.";
+// "Rule Char" Characters are those with special meaning, and therefore
+// need to be escaped to appear as literals in a regexp.
+constexpr char16_t const *gRuleSet_rule_chars = u"*?+[(){}^$|\\.";
//
-// The backslash escape characters that ICU's unescape() function will handle.
+// The backslash escape characters that ICU's unescape() function will handle.
//
-constexpr char16_t const *gUnescapeChars = u"acefnrtuUx";
+constexpr char16_t const *gUnescapeChars = u"acefnrtuUx";
//
-// Unicode Set pattern for Regular Expression \w
+// Unicode Set pattern for Regular Expression \w
//
-constexpr char16_t const *gIsWordPattern = u"[\\p{Alphabetic}\\p{M}\\p{Nd}\\p{Pc}\\u200c\\u200d]";
+constexpr char16_t const *gIsWordPattern = u"[\\p{Alphabetic}\\p{M}\\p{Nd}\\p{Pc}\\u200c\\u200d]";
//
// Unicode Set Definitions for Regular Expression \s
//
-constexpr char16_t const *gIsSpacePattern = u"[\\p{WhiteSpace}]";
+constexpr char16_t const *gIsSpacePattern = u"[\\p{WhiteSpace}]";
//
// UnicodeSets used in implementation of Grapheme Cluster detection, \X
//
-constexpr char16_t const *gGC_ControlPattern = u"[[:Zl:][:Zp:][:Cc:][:Cf:]-[:Grapheme_Extend:]]";
-constexpr char16_t const *gGC_ExtendPattern = u"[\\p{Grapheme_Extend}]";
-constexpr char16_t const *gGC_LPattern = u"[\\p{Hangul_Syllable_Type=L}]";
-constexpr char16_t const *gGC_VPattern = u"[\\p{Hangul_Syllable_Type=V}]";
-constexpr char16_t const *gGC_TPattern = u"[\\p{Hangul_Syllable_Type=T}]";
-constexpr char16_t const *gGC_LVPattern = u"[\\p{Hangul_Syllable_Type=LV}]";
-constexpr char16_t const *gGC_LVTPattern = u"[\\p{Hangul_Syllable_Type=LVT}]";
-
-
-RegexStaticSets *RegexStaticSets::gStaticSets = nullptr;
-UInitOnce gStaticSetsInitOnce = U_INITONCE_INITIALIZER;
-
-
-RegexStaticSets::RegexStaticSets(UErrorCode *status) {
- // Initialize the shared static sets to their correct values.
- fUnescapeCharSet.addAll(UnicodeString(true, gUnescapeChars, -1)).freeze();
- fPropSets[URX_ISWORD_SET].applyPattern(UnicodeString(true, gIsWordPattern, -1), *status).freeze();
- fPropSets[URX_ISSPACE_SET].applyPattern(UnicodeString(true, gIsSpacePattern, -1), *status).freeze();
- fPropSets[URX_GC_EXTEND].applyPattern(UnicodeString(TRUE, gGC_ExtendPattern, -1), *status).freeze();
- fPropSets[URX_GC_CONTROL].applyPattern(UnicodeString(TRUE, gGC_ControlPattern, -1), *status).freeze();
- fPropSets[URX_GC_L].applyPattern(UnicodeString(TRUE, gGC_LPattern, -1), *status).freeze();
- fPropSets[URX_GC_V].applyPattern(UnicodeString(TRUE, gGC_VPattern, -1), *status).freeze();
- fPropSets[URX_GC_T].applyPattern(UnicodeString(TRUE, gGC_TPattern, -1), *status).freeze();
- fPropSets[URX_GC_LV].applyPattern(UnicodeString(TRUE, gGC_LVPattern, -1), *status).freeze();
- fPropSets[URX_GC_LVT].applyPattern(UnicodeString(TRUE, gGC_LVTPattern, -1), *status).freeze();
+constexpr char16_t const *gGC_ControlPattern = u"[[:Zl:][:Zp:][:Cc:][:Cf:]-[:Grapheme_Extend:]]";
+constexpr char16_t const *gGC_ExtendPattern = u"[\\p{Grapheme_Extend}]";
+constexpr char16_t const *gGC_LPattern = u"[\\p{Hangul_Syllable_Type=L}]";
+constexpr char16_t const *gGC_VPattern = u"[\\p{Hangul_Syllable_Type=V}]";
+constexpr char16_t const *gGC_TPattern = u"[\\p{Hangul_Syllable_Type=T}]";
+constexpr char16_t const *gGC_LVPattern = u"[\\p{Hangul_Syllable_Type=LV}]";
+constexpr char16_t const *gGC_LVTPattern = u"[\\p{Hangul_Syllable_Type=LVT}]";
+
+
+RegexStaticSets *RegexStaticSets::gStaticSets = nullptr;
+UInitOnce gStaticSetsInitOnce = U_INITONCE_INITIALIZER;
+
+
+RegexStaticSets::RegexStaticSets(UErrorCode *status) {
+ // Initialize the shared static sets to their correct values.
+ fUnescapeCharSet.addAll(UnicodeString(true, gUnescapeChars, -1)).freeze();
+ fPropSets[URX_ISWORD_SET].applyPattern(UnicodeString(true, gIsWordPattern, -1), *status).freeze();
+ fPropSets[URX_ISSPACE_SET].applyPattern(UnicodeString(true, gIsSpacePattern, -1), *status).freeze();
+ fPropSets[URX_GC_EXTEND].applyPattern(UnicodeString(TRUE, gGC_ExtendPattern, -1), *status).freeze();
+ fPropSets[URX_GC_CONTROL].applyPattern(UnicodeString(TRUE, gGC_ControlPattern, -1), *status).freeze();
+ fPropSets[URX_GC_L].applyPattern(UnicodeString(TRUE, gGC_LPattern, -1), *status).freeze();
+ fPropSets[URX_GC_V].applyPattern(UnicodeString(TRUE, gGC_VPattern, -1), *status).freeze();
+ fPropSets[URX_GC_T].applyPattern(UnicodeString(TRUE, gGC_TPattern, -1), *status).freeze();
+ fPropSets[URX_GC_LV].applyPattern(UnicodeString(TRUE, gGC_LVPattern, -1), *status).freeze();
+ fPropSets[URX_GC_LVT].applyPattern(UnicodeString(TRUE, gGC_LVTPattern, -1), *status).freeze();
//
// "Normal" is the set of characters that don't need special handling
// when finding grapheme cluster boundaries.
//
- fPropSets[URX_GC_NORMAL].complement();
- fPropSets[URX_GC_NORMAL].remove(0xac00, 0xd7a4);
- fPropSets[URX_GC_NORMAL].removeAll(fPropSets[URX_GC_CONTROL]);
- fPropSets[URX_GC_NORMAL].removeAll(fPropSets[URX_GC_L]);
- fPropSets[URX_GC_NORMAL].removeAll(fPropSets[URX_GC_V]);
- fPropSets[URX_GC_NORMAL].removeAll(fPropSets[URX_GC_T]);
- fPropSets[URX_GC_NORMAL].freeze();
+ fPropSets[URX_GC_NORMAL].complement();
+ fPropSets[URX_GC_NORMAL].remove(0xac00, 0xd7a4);
+ fPropSets[URX_GC_NORMAL].removeAll(fPropSets[URX_GC_CONTROL]);
+ fPropSets[URX_GC_NORMAL].removeAll(fPropSets[URX_GC_L]);
+ fPropSets[URX_GC_NORMAL].removeAll(fPropSets[URX_GC_V]);
+ fPropSets[URX_GC_NORMAL].removeAll(fPropSets[URX_GC_T]);
+ fPropSets[URX_GC_NORMAL].freeze();
// Initialize the 8-bit fast bit sets from the parallel full
// UnicodeSets.
- //
- // TODO: 25 Oct 2019 are these fast 8-bit sets worth keeping?
- // Measured 3.5% gain on (non) matching with the pattern "x(?:\\S+)+x"
- // This runs in exponential time, making it easy to adjust the time for
- // convenient measuring.
- //
- // This 8 bit optimization dates from the early days of ICU,
- // with a less optimized UnicodeSet. At the time, the difference
- // was substantial.
-
- for (int32_t i=0; i<URX_LAST_SET; i++) {
- fPropSets8[i].init(&fPropSets[i]);
+ //
+ // TODO: 25 Oct 2019 are these fast 8-bit sets worth keeping?
+ // Measured 3.5% gain on (non) matching with the pattern "x(?:\\S+)+x"
+ // This runs in exponential time, making it easy to adjust the time for
+ // convenient measuring.
+ //
+ // This 8 bit optimization dates from the early days of ICU,
+ // with a less optimized UnicodeSet. At the time, the difference
+ // was substantial.
+
+ for (int32_t i=0; i<URX_LAST_SET; i++) {
+ fPropSets8[i].init(&fPropSets[i]);
}
// Sets used while parsing rules, but not referenced from the parse state table
- fRuleSets[kRuleSet_rule_char-128]
- .addAll(UnicodeString(gRuleSet_rule_chars)).complement().freeze();
-
- fRuleSets[kRuleSet_digit_char-128].add(u'0', u'9').freeze();
- fRuleSets[kRuleSet_ascii_letter-128].add(u'A', u'Z').add(u'a', u'z').freeze();
+ fRuleSets[kRuleSet_rule_char-128]
+ .addAll(UnicodeString(gRuleSet_rule_chars)).complement().freeze();
+
+ fRuleSets[kRuleSet_digit_char-128].add(u'0', u'9').freeze();
+ fRuleSets[kRuleSet_ascii_letter-128].add(u'A', u'Z').add(u'a', u'z').freeze();
fRuleDigitsAlias = &fRuleSets[kRuleSet_digit_char-128];
- // Finally, initialize an empty UText string for utility purposes
- fEmptyText = utext_openUChars(nullptr, nullptr, 0, status);
+ // Finally, initialize an empty UText string for utility purposes
+ fEmptyText = utext_openUChars(nullptr, nullptr, 0, status);
}
RegexStaticSets::~RegexStaticSets() {
- fRuleDigitsAlias = nullptr;
+ fRuleDigitsAlias = nullptr;
utext_close(fEmptyText);
}
@@ -144,21 +144,21 @@ RegexStaticSets::~RegexStaticSets() {
U_CDECL_BEGIN
static UBool U_CALLCONV
regex_cleanup(void) {
- delete RegexStaticSets::gStaticSets;
- RegexStaticSets::gStaticSets = nullptr;
- gStaticSetsInitOnce.reset();
- return TRUE;
+ delete RegexStaticSets::gStaticSets;
+ RegexStaticSets::gStaticSets = nullptr;
+ gStaticSetsInitOnce.reset();
+ return TRUE;
}
static void U_CALLCONV initStaticSets(UErrorCode &status) {
- U_ASSERT(RegexStaticSets::gStaticSets == nullptr);
+ U_ASSERT(RegexStaticSets::gStaticSets == nullptr);
ucln_i18n_registerCleanup(UCLN_I18N_REGEX, regex_cleanup);
RegexStaticSets::gStaticSets = new RegexStaticSets(&status);
if (U_FAILURE(status)) {
delete RegexStaticSets::gStaticSets;
- RegexStaticSets::gStaticSets = nullptr;
+ RegexStaticSets::gStaticSets = nullptr;
}
- if (RegexStaticSets::gStaticSets == nullptr && U_SUCCESS(status)) {
+ if (RegexStaticSets::gStaticSets == nullptr && U_SUCCESS(status)) {
status = U_MEMORY_ALLOCATION_ERROR;
}
}
diff --git a/contrib/libs/icu/i18n/regexst.h b/contrib/libs/icu/i18n/regexst.h
index 5d7c26be73..bcb393dd3f 100644
--- a/contrib/libs/icu/i18n/regexst.h
+++ b/contrib/libs/icu/i18n/regexst.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// regexst.h
@@ -25,7 +25,7 @@
#if !UCONFIG_NO_REGULAR_EXPRESSIONS
#include "regeximp.h"
-#include "regexcst.h"
+#include "regexcst.h"
U_NAMESPACE_BEGIN
@@ -41,15 +41,15 @@ public:
~RegexStaticSets();
static void initGlobals(UErrorCode *status);
- UnicodeSet fPropSets[URX_LAST_SET] {}; // The sets for common regex items, e.g. \s
- Regex8BitSet fPropSets8[URX_LAST_SET] {}; // Fast bitmap sets for latin-1 range for above.
+ UnicodeSet fPropSets[URX_LAST_SET] {}; // The sets for common regex items, e.g. \s
+ Regex8BitSet fPropSets8[URX_LAST_SET] {}; // Fast bitmap sets for latin-1 range for above.
- UnicodeSet fRuleSets[kRuleSet_count] {}; // Sets used while parsing regexp patterns.
- UnicodeSet fUnescapeCharSet {}; // Set of chars handled by unescape when
- // encountered with a \ in a pattern.
- UnicodeSet *fRuleDigitsAlias {};
- UText *fEmptyText {}; // An empty string, to be used when a matcher
- // is created with no input.
+ UnicodeSet fRuleSets[kRuleSet_count] {}; // Sets used while parsing regexp patterns.
+ UnicodeSet fUnescapeCharSet {}; // Set of chars handled by unescape when
+ // encountered with a \ in a pattern.
+ UnicodeSet *fRuleDigitsAlias {};
+ UText *fEmptyText {}; // An empty string, to be used when a matcher
+ // is created with no input.
};
diff --git a/contrib/libs/icu/i18n/regextxt.cpp b/contrib/libs/icu/i18n/regextxt.cpp
index 82bbc37afb..41bb4a944b 100644
--- a/contrib/libs/icu/i18n/regextxt.cpp
+++ b/contrib/libs/icu/i18n/regextxt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************
* COPYRIGHT:
diff --git a/contrib/libs/icu/i18n/regextxt.h b/contrib/libs/icu/i18n/regextxt.h
index d8772a9505..9cfabbe415 100644
--- a/contrib/libs/icu/i18n/regextxt.h
+++ b/contrib/libs/icu/i18n/regextxt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************
* COPYRIGHT:
diff --git a/contrib/libs/icu/i18n/region.cpp b/contrib/libs/icu/i18n/region.cpp
index 064a816703..76445aef32 100644
--- a/contrib/libs/icu/i18n/region.cpp
+++ b/contrib/libs/icu/i18n/region.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -32,7 +32,7 @@
#include "umutex.h"
#include "uresimp.h"
#include "region_impl.h"
-#include "util.h"
+#include "util.h"
#if !UCONFIG_NO_FORMATTING
@@ -166,18 +166,18 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
continents->addElement(continentName,status);
}
- UResourceBundle *groupingBundle = nullptr;
+ UResourceBundle *groupingBundle = nullptr;
while ( ures_hasNext(groupingContainment.getAlias()) ) {
- groupingBundle = ures_getNextResource(groupingContainment.getAlias(), groupingBundle, &status);
- if (U_FAILURE(status)) {
- break;
- }
- UnicodeString *groupingName = new UnicodeString(ures_getKey(groupingBundle), -1, US_INV);
- if (groupingName) {
- groupings->addElement(groupingName,status);
- }
+ groupingBundle = ures_getNextResource(groupingContainment.getAlias(), groupingBundle, &status);
+ if (U_FAILURE(status)) {
+ break;
+ }
+ UnicodeString *groupingName = new UnicodeString(ures_getKey(groupingBundle), -1, US_INV);
+ if (groupingName) {
+ groupings->addElement(groupingName,status);
+ }
}
- ures_close(groupingBundle);
+ ures_close(groupingBundle);
for ( int32_t i = 0 ; i < allRegions->size() ; i++ ) {
LocalPointer<Region> r(new Region(), status);
@@ -188,14 +188,14 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
r->idStr = *regionName;
r->idStr.extract(0,r->idStr.length(),r->id,sizeof(r->id),US_INV);
- r->fType = URGN_TERRITORY; // Only temporary - figure out the real type later once the aliases are known.
+ r->fType = URGN_TERRITORY; // Only temporary - figure out the real type later once the aliases are known.
- int32_t pos = 0;
- int32_t result = ICU_Utility::parseAsciiInteger(r->idStr, pos);
- if (pos > 0) {
- r->code = result; // Convert string to number
+ int32_t pos = 0;
+ int32_t result = ICU_Utility::parseAsciiInteger(r->idStr, pos);
+ if (pos > 0) {
+ r->code = result; // Convert string to number
uhash_iput(newNumericCodeMap.getAlias(),r->code,(void *)(r.getAlias()),&status);
- r->fType = URGN_SUBCONTINENT;
+ r->fType = URGN_SUBCONTINENT;
} else {
r->code = -1;
}
@@ -227,17 +227,17 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
aliasFromRegion->idStr.setTo(*aliasFromStr);
aliasFromRegion->idStr.extract(0,aliasFromRegion->idStr.length(),aliasFromRegion->id,sizeof(aliasFromRegion->id),US_INV);
uhash_put(newRegionIDMap.getAlias(),(void *)&(aliasFromRegion->idStr),(void *)aliasFromRegion,&status);
- int32_t pos = 0;
- int32_t result = ICU_Utility::parseAsciiInteger(aliasFromRegion->idStr, pos);
- if ( pos > 0 ) {
- aliasFromRegion->code = result; // Convert string to number
+ int32_t pos = 0;
+ int32_t result = ICU_Utility::parseAsciiInteger(aliasFromRegion->idStr, pos);
+ if ( pos > 0 ) {
+ aliasFromRegion->code = result; // Convert string to number
uhash_iput(newNumericCodeMap.getAlias(),aliasFromRegion->code,(void *)aliasFromRegion,&status);
} else {
aliasFromRegion->code = -1;
}
- aliasFromRegion->fType = URGN_DEPRECATED;
+ aliasFromRegion->fType = URGN_DEPRECATED;
} else {
- aliasFromRegion->fType = URGN_DEPRECATED;
+ aliasFromRegion->fType = URGN_DEPRECATED;
}
{
@@ -275,10 +275,10 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
Region *r = (Region *)uhash_get(newRegionIDMap.getAlias(),(void *)&codeMappingID);
if ( r ) {
- int32_t pos = 0;
- int32_t result = ICU_Utility::parseAsciiInteger(codeMappingNumber, pos);
- if ( pos > 0 ) {
- r->code = result; // Convert string to number
+ int32_t pos = 0;
+ int32_t result = ICU_Utility::parseAsciiInteger(codeMappingNumber, pos);
+ if ( pos > 0 ) {
+ r->code = result; // Convert string to number
uhash_iput(newNumericCodeMap.getAlias(),r->code,(void *)r,&status);
}
LocalPointer<UnicodeString> code3(new UnicodeString(codeMapping3Letter), status);
@@ -293,26 +293,26 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
UnicodeString WORLD_ID_STRING(WORLD_ID);
r = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)&WORLD_ID_STRING);
if ( r ) {
- r->fType = URGN_WORLD;
+ r->fType = URGN_WORLD;
}
UnicodeString UNKNOWN_REGION_ID_STRING(UNKNOWN_REGION_ID);
r = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)&UNKNOWN_REGION_ID_STRING);
if ( r ) {
- r->fType = URGN_UNKNOWN;
+ r->fType = URGN_UNKNOWN;
}
for ( int32_t i = 0 ; i < continents->size() ; i++ ) {
r = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)continents->elementAt(i));
if ( r ) {
- r->fType = URGN_CONTINENT;
+ r->fType = URGN_CONTINENT;
}
}
for ( int32_t i = 0 ; i < groupings->size() ; i++ ) {
r = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)groupings->elementAt(i));
if ( r ) {
- r->fType = URGN_GROUPING;
+ r->fType = URGN_GROUPING;
}
}
@@ -322,7 +322,7 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
UnicodeString OUTLYING_OCEANIA_REGION_ID_STRING(OUTLYING_OCEANIA_REGION_ID);
r = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)&OUTLYING_OCEANIA_REGION_ID_STRING);
if ( r ) {
- r->fType = URGN_SUBCONTINENT;
+ r->fType = URGN_SUBCONTINENT;
}
// Load territory containment info from the supplemental data.
@@ -359,7 +359,7 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
// Set the parent region to be the containing region of the child.
// Regions of type GROUPING can't be set as the parent, since another region
// such as a SUBCONTINENT, CONTINENT, or WORLD must always be the parent.
- if ( parentRegion->fType != URGN_GROUPING) {
+ if ( parentRegion->fType != URGN_GROUPING) {
childRegion->containingRegion = parentRegion;
}
}
@@ -370,15 +370,15 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
int32_t pos = UHASH_FIRST;
while ( const UHashElement* element = uhash_nextElement(newRegionIDMap.getAlias(),&pos)) {
Region *ar = (Region *)element->value.pointer;
- if ( availableRegions[ar->fType] == NULL ) {
+ if ( availableRegions[ar->fType] == NULL ) {
LocalPointer<UVector> newAr(new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status);
- availableRegions[ar->fType] = newAr.orphan();
+ availableRegions[ar->fType] = newAr.orphan();
}
LocalPointer<UnicodeString> arString(new UnicodeString(ar->idStr), status);
if( U_FAILURE(status) ) {
return; // error out
}
- availableRegions[ar->fType]->addElement((void *)arString.orphan(),status);
+ availableRegions[ar->fType]->addElement((void *)arString.orphan(),status);
}
ucln_i18n_registerCleanup(UCLN_I18N_REGION, region_cleanup);
@@ -419,7 +419,7 @@ void Region::cleanupRegionData() {
Region::Region ()
: code(-1),
- fType(URGN_UNKNOWN),
+ fType(URGN_UNKNOWN),
containingRegion(NULL),
containedRegions(NULL),
preferredValues(NULL) {
@@ -484,7 +484,7 @@ Region::getInstance(const char *region_code, UErrorCode &status) {
return NULL;
}
- if ( r->fType == URGN_DEPRECATED && r->preferredValues->size() == 1) {
+ if ( r->fType == URGN_DEPRECATED && r->preferredValues->size() == 1) {
StringEnumeration *pv = r->getPreferredValues(status);
pv->reset(status);
const UnicodeString *ustr = pv->snext(status);
@@ -512,7 +512,7 @@ Region::getInstance (int32_t code, UErrorCode &status) {
if ( !r ) { // Just in case there's an alias that's numeric, try to find it.
UnicodeString id;
- ICU_Utility::appendNumber(id, code, 10, 1);
+ ICU_Utility::appendNumber(id, code, 10, 1);
r = (Region *)uhash_get(regionAliases,&id);
}
@@ -525,7 +525,7 @@ Region::getInstance (int32_t code, UErrorCode &status) {
return NULL;
}
- if ( r->fType == URGN_DEPRECATED && r->preferredValues->size() == 1) {
+ if ( r->fType == URGN_DEPRECATED && r->preferredValues->size() == 1) {
StringEnumeration *pv = r->getPreferredValues(status);
pv->reset(status);
const UnicodeString *ustr = pv->snext(status);
@@ -576,7 +576,7 @@ Region::getContainingRegion(URegionType type) const {
return NULL;
}
- return ( containingRegion->fType == type)? containingRegion: containingRegion->getContainingRegion(type);
+ return ( containingRegion->fType == type)? containingRegion: containingRegion->getContainingRegion(type);
}
/**
@@ -614,9 +614,9 @@ Region::getContainedRegions( URegionType type, UErrorCode &status ) const {
StringEnumeration *cr = getContainedRegions(status);
for ( int32_t i = 0 ; i < cr->count(status) ; i++ ) {
- const char *regionId = cr->next(NULL,status);
- const Region *r = Region::getInstance(regionId,status);
- if ( r->getType() == type) {
+ const char *regionId = cr->next(NULL,status);
+ const Region *r = Region::getInstance(regionId,status);
+ if ( r->getType() == type) {
result->addElement((void *)&r->idStr,status);
} else {
StringEnumeration *children = r->getContainedRegions(type, status);
@@ -668,7 +668,7 @@ Region::contains(const Region &other) const {
StringEnumeration*
Region::getPreferredValues(UErrorCode &status) const {
umtx_initOnce(gRegionDataInitOnce, &loadRegionData, status); // returns immediately if U_FAILURE(status)
- if (U_FAILURE(status) || fType != URGN_DEPRECATED) {
+ if (U_FAILURE(status) || fType != URGN_DEPRECATED) {
return NULL;
}
return new RegionNameEnumeration(preferredValues,status);
@@ -693,7 +693,7 @@ Region::getNumericCode() const {
*/
URegionType
Region::getType() const {
- return fType;
+ return fType;
}
RegionNameEnumeration::RegionNameEnumeration(UVector *fNameList, UErrorCode& status) {
diff --git a/contrib/libs/icu/i18n/region_impl.h b/contrib/libs/icu/i18n/region_impl.h
index 3e8b208bf8..5e5a64529a 100644
--- a/contrib/libs/icu/i18n/region_impl.h
+++ b/contrib/libs/icu/i18n/region_impl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/reldatefmt.cpp b/contrib/libs/icu/i18n/reldatefmt.cpp
index 56e80640d0..8c6688c5b9 100644
--- a/contrib/libs/icu/i18n/reldatefmt.cpp
+++ b/contrib/libs/icu/i18n/reldatefmt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -14,10 +14,10 @@
#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION
-#include <cmath>
-#include <functional>
+#include <cmath>
+#include <functional>
#include "unicode/dtfmtsym.h"
-#include "unicode/ucasemap.h"
+#include "unicode/ucasemap.h"
#include "unicode/ureldatefmt.h"
#include "unicode/udisplaycontext.h"
#include "unicode/unum.h"
@@ -42,12 +42,12 @@
#include "sharednumberformat.h"
#include "standardplural.h"
#include "unifiedcache.h"
-#include "util.h"
-#include "formatted_string_builder.h"
-#include "number_utypes.h"
-#include "number_modifiers.h"
-#include "formattedval_impl.h"
-#include "number_utils.h"
+#include "util.h"
+#include "formatted_string_builder.h"
+#include "number_utypes.h"
+#include "number_modifiers.h"
+#include "formattedval_impl.h"
+#include "number_utils.h"
// Copied from uscript_props.cpp
@@ -56,13 +56,13 @@ U_NAMESPACE_BEGIN
// RelativeDateTimeFormatter specific data for a single locale
class RelativeDateTimeCacheData: public SharedObject {
public:
- RelativeDateTimeCacheData() : combinedDateAndTime(nullptr) {
+ RelativeDateTimeCacheData() : combinedDateAndTime(nullptr) {
// Initialize the cache arrays
for (int32_t style = 0; style < UDAT_STYLE_COUNT; ++style) {
- for (int32_t relUnit = 0; relUnit < UDAT_REL_UNIT_COUNT; ++relUnit) {
+ for (int32_t relUnit = 0; relUnit < UDAT_REL_UNIT_COUNT; ++relUnit) {
for (int32_t pl = 0; pl < StandardPlural::COUNT; ++pl) {
- relativeUnitsFormatters[style][relUnit][0][pl] = nullptr;
- relativeUnitsFormatters[style][relUnit][1][pl] = nullptr;
+ relativeUnitsFormatters[style][relUnit][0][pl] = nullptr;
+ relativeUnitsFormatters[style][relUnit][1][pl] = nullptr;
}
}
}
@@ -79,7 +79,7 @@ public:
// e.g., Next Tuesday; Yesterday; etc. For third index, 0
// means past, e.g., 5 days ago; 1 means future, e.g., in 5 days.
SimpleFormatter *relativeUnitsFormatters[UDAT_STYLE_COUNT]
- [UDAT_REL_UNIT_COUNT][2][StandardPlural::COUNT];
+ [UDAT_REL_UNIT_COUNT][2][StandardPlural::COUNT];
const UnicodeString& getAbsoluteUnitString(int32_t fStyle,
UDateAbsoluteUnit unit,
@@ -88,10 +88,10 @@ public:
UDateRelativeUnit unit,
int32_t pastFutureIndex,
int32_t pluralUnit) const;
- const SimpleFormatter* getRelativeDateTimeUnitFormatter(int32_t fStyle,
- URelativeDateTimeUnit unit,
- int32_t pastFutureIndex,
- int32_t pluralUnit) const;
+ const SimpleFormatter* getRelativeDateTimeUnitFormatter(int32_t fStyle,
+ URelativeDateTimeUnit unit,
+ int32_t pastFutureIndex,
+ int32_t pluralUnit) const;
const UnicodeString emptyString;
@@ -116,7 +116,7 @@ private:
RelativeDateTimeCacheData::~RelativeDateTimeCacheData() {
// clear out the cache arrays
for (int32_t style = 0; style < UDAT_STYLE_COUNT; ++style) {
- for (int32_t relUnit = 0; relUnit < UDAT_REL_UNIT_COUNT; ++relUnit) {
+ for (int32_t relUnit = 0; relUnit < UDAT_REL_UNIT_COUNT; ++relUnit) {
for (int32_t pl = 0; pl < StandardPlural::COUNT; ++pl) {
delete relativeUnitsFormatters[style][relUnit][0][pl];
delete relativeUnitsFormatters[style][relUnit][1][pl];
@@ -145,43 +145,43 @@ const UnicodeString& RelativeDateTimeCacheData::getAbsoluteUnitString(
UDateRelativeUnit unit,
int32_t pastFutureIndex,
int32_t pluralUnit) const {
- URelativeDateTimeUnit rdtunit = UDAT_REL_UNIT_COUNT;
- switch (unit) {
- case UDAT_RELATIVE_YEARS: rdtunit = UDAT_REL_UNIT_YEAR; break;
- case UDAT_RELATIVE_MONTHS: rdtunit = UDAT_REL_UNIT_MONTH; break;
- case UDAT_RELATIVE_WEEKS: rdtunit = UDAT_REL_UNIT_WEEK; break;
- case UDAT_RELATIVE_DAYS: rdtunit = UDAT_REL_UNIT_DAY; break;
- case UDAT_RELATIVE_HOURS: rdtunit = UDAT_REL_UNIT_HOUR; break;
- case UDAT_RELATIVE_MINUTES: rdtunit = UDAT_REL_UNIT_MINUTE; break;
- case UDAT_RELATIVE_SECONDS: rdtunit = UDAT_REL_UNIT_SECOND; break;
- default: // a unit that the above method does not handle
- return nullptr;
- }
-
- return getRelativeDateTimeUnitFormatter(fStyle, rdtunit, pastFutureIndex, pluralUnit);
- }
-
- // Use fallback cache for SimpleFormatter relativeUnits.
- const SimpleFormatter* RelativeDateTimeCacheData::getRelativeDateTimeUnitFormatter(
- int32_t fStyle,
- URelativeDateTimeUnit unit,
- int32_t pastFutureIndex,
- int32_t pluralUnit) const {
- while (true) {
- int32_t style = fStyle;
- do {
- if (relativeUnitsFormatters[style][unit][pastFutureIndex][pluralUnit] != nullptr) {
- return relativeUnitsFormatters[style][unit][pastFutureIndex][pluralUnit];
- }
- style = fallBackCache[style];
- } while (style != -1);
-
- if (pluralUnit == StandardPlural::OTHER) {
- break;
+ URelativeDateTimeUnit rdtunit = UDAT_REL_UNIT_COUNT;
+ switch (unit) {
+ case UDAT_RELATIVE_YEARS: rdtunit = UDAT_REL_UNIT_YEAR; break;
+ case UDAT_RELATIVE_MONTHS: rdtunit = UDAT_REL_UNIT_MONTH; break;
+ case UDAT_RELATIVE_WEEKS: rdtunit = UDAT_REL_UNIT_WEEK; break;
+ case UDAT_RELATIVE_DAYS: rdtunit = UDAT_REL_UNIT_DAY; break;
+ case UDAT_RELATIVE_HOURS: rdtunit = UDAT_REL_UNIT_HOUR; break;
+ case UDAT_RELATIVE_MINUTES: rdtunit = UDAT_REL_UNIT_MINUTE; break;
+ case UDAT_RELATIVE_SECONDS: rdtunit = UDAT_REL_UNIT_SECOND; break;
+ default: // a unit that the above method does not handle
+ return nullptr;
+ }
+
+ return getRelativeDateTimeUnitFormatter(fStyle, rdtunit, pastFutureIndex, pluralUnit);
+ }
+
+ // Use fallback cache for SimpleFormatter relativeUnits.
+ const SimpleFormatter* RelativeDateTimeCacheData::getRelativeDateTimeUnitFormatter(
+ int32_t fStyle,
+ URelativeDateTimeUnit unit,
+ int32_t pastFutureIndex,
+ int32_t pluralUnit) const {
+ while (true) {
+ int32_t style = fStyle;
+ do {
+ if (relativeUnitsFormatters[style][unit][pastFutureIndex][pluralUnit] != nullptr) {
+ return relativeUnitsFormatters[style][unit][pastFutureIndex][pluralUnit];
+ }
+ style = fallBackCache[style];
+ } while (style != -1);
+
+ if (pluralUnit == StandardPlural::OTHER) {
+ break;
}
- pluralUnit = StandardPlural::OTHER;
- }
- return nullptr; // No formatter found.
+ pluralUnit = StandardPlural::OTHER;
+ }
+ return nullptr; // No formatter found.
}
static UBool getStringWithFallback(
@@ -254,35 +254,35 @@ struct RelDateTimeFmtDataSink : public ResourceSink {
// Converts the generic units to UDAT_RELATIVE version.
switch (genUnit) {
case SECOND:
- return UDAT_REL_UNIT_SECOND;
+ return UDAT_REL_UNIT_SECOND;
case MINUTE:
- return UDAT_REL_UNIT_MINUTE;
+ return UDAT_REL_UNIT_MINUTE;
case HOUR:
- return UDAT_REL_UNIT_HOUR;
+ return UDAT_REL_UNIT_HOUR;
case DAY:
- return UDAT_REL_UNIT_DAY;
+ return UDAT_REL_UNIT_DAY;
case WEEK:
- return UDAT_REL_UNIT_WEEK;
+ return UDAT_REL_UNIT_WEEK;
case MONTH:
- return UDAT_REL_UNIT_MONTH;
- case QUARTER:
- return UDAT_REL_UNIT_QUARTER;
+ return UDAT_REL_UNIT_MONTH;
+ case QUARTER:
+ return UDAT_REL_UNIT_QUARTER;
case YEAR:
- return UDAT_REL_UNIT_YEAR;
- case SUNDAY:
- return UDAT_REL_UNIT_SUNDAY;
- case MONDAY:
- return UDAT_REL_UNIT_MONDAY;
- case TUESDAY:
- return UDAT_REL_UNIT_TUESDAY;
- case WEDNESDAY:
- return UDAT_REL_UNIT_WEDNESDAY;
- case THURSDAY:
- return UDAT_REL_UNIT_THURSDAY;
- case FRIDAY:
- return UDAT_REL_UNIT_FRIDAY;
- case SATURDAY:
- return UDAT_REL_UNIT_SATURDAY;
+ return UDAT_REL_UNIT_YEAR;
+ case SUNDAY:
+ return UDAT_REL_UNIT_SUNDAY;
+ case MONDAY:
+ return UDAT_REL_UNIT_MONDAY;
+ case TUESDAY:
+ return UDAT_REL_UNIT_TUESDAY;
+ case WEDNESDAY:
+ return UDAT_REL_UNIT_WEDNESDAY;
+ case THURSDAY:
+ return UDAT_REL_UNIT_THURSDAY;
+ case FRIDAY:
+ return UDAT_REL_UNIT_FRIDAY;
+ case SATURDAY:
+ return UDAT_REL_UNIT_SATURDAY;
default:
return -1;
}
@@ -297,8 +297,8 @@ struct RelDateTimeFmtDataSink : public ResourceSink {
return UDAT_ABSOLUTE_WEEK;
case MONTH:
return UDAT_ABSOLUTE_MONTH;
- case QUARTER:
- return UDAT_ABSOLUTE_QUARTER;
+ case QUARTER:
+ return UDAT_ABSOLUTE_QUARTER;
case YEAR:
return UDAT_ABSOLUTE_YEAR;
case SUNDAY:
@@ -315,10 +315,10 @@ struct RelDateTimeFmtDataSink : public ResourceSink {
return UDAT_ABSOLUTE_FRIDAY;
case SATURDAY:
return UDAT_ABSOLUTE_SATURDAY;
- case HOUR:
- return UDAT_ABSOLUTE_HOUR;
- case MINUTE:
- return UDAT_ABSOLUTE_MINUTE;
+ case HOUR:
+ return UDAT_ABSOLUTE_HOUR;
+ case MINUTE:
+ return UDAT_ABSOLUTE_MINUTE;
default:
return -1;
}
@@ -363,7 +363,7 @@ struct RelDateTimeFmtDataSink : public ResourceSink {
// Utility functions
static UDateRelativeDateTimeFormatterStyle styleFromString(const char *s) {
- int32_t len = static_cast<int32_t>(uprv_strlen(s));
+ int32_t len = static_cast<int32_t>(uprv_strlen(s));
if (len >= 7 && uprv_strcmp(s + len - 7, "-narrow") == 0) {
return UDAT_STYLE_NARROW;
}
@@ -481,7 +481,7 @@ struct RelDateTimeFmtDataSink : public ResourceSink {
}
int32_t relUnitIndex = relUnitFromGeneric(genericUnit);
- if (relUnitIndex == UDAT_REL_UNIT_SECOND && uprv_strcmp(key, "0") == 0 &&
+ if (relUnitIndex == UDAT_REL_UNIT_SECOND && uprv_strcmp(key, "0") == 0 &&
outputData.absoluteUnits[style][UDAT_ABSOLUTE_NOW][UDAT_DIRECTION_PLAIN].isEmpty()) {
// Handle "NOW"
outputData.absoluteUnits[style][UDAT_ABSOLUTE_NOW]
@@ -514,10 +514,10 @@ struct RelDateTimeFmtDataSink : public ResourceSink {
outputData.relativeUnitsFormatters[style][relUnitIndex]
[pastFutureIndex];
// Only set if not already established.
- if (patterns[pluralIndex] == nullptr) {
+ if (patterns[pluralIndex] == nullptr) {
patterns[pluralIndex] = new SimpleFormatter(
value.getUnicodeString(errorCode), 0, 1, errorCode);
- if (patterns[pluralIndex] == nullptr) {
+ if (patterns[pluralIndex] == nullptr) {
errorCode = U_MEMORY_ALLOCATION_ERROR;
}
}
@@ -597,7 +597,7 @@ struct RelDateTimeFmtDataSink : public ResourceSink {
consumeAlias(key, value, errorCode);
} else {
style = styleFromString(key);
- int32_t unitSize = static_cast<int32_t>(uprv_strlen(key)) - styleSuffixLength(style);
+ int32_t unitSize = static_cast<int32_t>(uprv_strlen(key)) - styleSuffixLength(style);
genericUnit = unitOrNegativeFromString(key, unitSize);
if (style >= 0 && genericUnit != INVALID_UNIT) {
consumeTimeUnit(key, value, errorCode);
@@ -612,7 +612,7 @@ struct RelDateTimeFmtDataSink : public ResourceSink {
RelDateTimeFmtDataSink::~RelDateTimeFmtDataSink() {}
} // namespace
-static const DateFormatSymbols::DtWidthType styleToDateFormatSymbolWidth[UDAT_STYLE_COUNT] = {
+static const DateFormatSymbols::DtWidthType styleToDateFormatSymbolWidth[UDAT_STYLE_COUNT] = {
DateFormatSymbols::WIDE, DateFormatSymbols::SHORT, DateFormatSymbols::NARROW
};
@@ -621,14 +621,14 @@ static void loadWeekdayNames(UnicodeString absoluteUnits[UDAT_STYLE_COUNT]
[UDAT_ABSOLUTE_UNIT_COUNT][UDAT_DIRECTION_COUNT],
const char* localeId,
UErrorCode& status) {
- if (U_FAILURE(status)) {
- return;
- }
+ if (U_FAILURE(status)) {
+ return;
+ }
Locale locale(localeId);
DateFormatSymbols dfSym(locale, status);
- if (U_FAILURE(status)) {
- return;
- }
+ if (U_FAILURE(status)) {
+ return;
+ }
for (int32_t style = 0; style < UDAT_STYLE_COUNT; ++style) {
DateFormatSymbols::DtWidthType dtfmtWidth = styleToDateFormatSymbolWidth[style];
int32_t count;
@@ -652,9 +652,9 @@ static UBool loadUnitData(
RelDateTimeFmtDataSink sink(cacheData);
ures_getAllItemsWithFallback(resource, "fields", sink, status);
- if (U_FAILURE(status)) {
- return false;
- }
+ if (U_FAILURE(status)) {
+ return false;
+ }
// Get the weekday names from DateFormatSymbols.
loadWeekdayNames(cacheData.absoluteUnits, localeId, status);
@@ -679,7 +679,7 @@ static UBool getDateTimePattern(
.append("/DateTimePatterns", status);
LocalUResourceBundlePointer topLevel(
ures_getByKeyWithFallback(
- resource, pathBuffer.data(), nullptr, &status));
+ resource, pathBuffer.data(), nullptr, &status));
if (U_FAILURE(status)) {
return FALSE;
}
@@ -696,88 +696,88 @@ static UBool getDateTimePattern(
template<> U_I18N_API
const RelativeDateTimeCacheData *LocaleCacheKey<RelativeDateTimeCacheData>::createObject(const void * /*unused*/, UErrorCode &status) const {
const char *localeId = fLoc.getName();
- LocalUResourceBundlePointer topLevel(ures_open(nullptr, localeId, &status));
+ LocalUResourceBundlePointer topLevel(ures_open(nullptr, localeId, &status));
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
LocalPointer<RelativeDateTimeCacheData> result(
new RelativeDateTimeCacheData());
if (result.isNull()) {
status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
+ return nullptr;
}
if (!loadUnitData(
topLevel.getAlias(),
*result,
localeId,
status)) {
- return nullptr;
+ return nullptr;
}
UnicodeString dateTimePattern;
if (!getDateTimePattern(topLevel.getAlias(), dateTimePattern, status)) {
- return nullptr;
+ return nullptr;
}
result->adoptCombinedDateAndTime(
new SimpleFormatter(dateTimePattern, 2, 2, status));
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
result->addRef();
return result.orphan();
}
-
-
-static constexpr FormattedStringBuilder::Field kRDTNumericField
- = {UFIELD_CATEGORY_RELATIVE_DATETIME, UDAT_REL_NUMERIC_FIELD};
-
-static constexpr FormattedStringBuilder::Field kRDTLiteralField
- = {UFIELD_CATEGORY_RELATIVE_DATETIME, UDAT_REL_LITERAL_FIELD};
-
-class FormattedRelativeDateTimeData : public FormattedValueStringBuilderImpl {
-public:
- FormattedRelativeDateTimeData() : FormattedValueStringBuilderImpl(kRDTNumericField) {}
- virtual ~FormattedRelativeDateTimeData();
-};
-
-FormattedRelativeDateTimeData::~FormattedRelativeDateTimeData() = default;
-
-
-UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedRelativeDateTime)
-
-
+
+
+static constexpr FormattedStringBuilder::Field kRDTNumericField
+ = {UFIELD_CATEGORY_RELATIVE_DATETIME, UDAT_REL_NUMERIC_FIELD};
+
+static constexpr FormattedStringBuilder::Field kRDTLiteralField
+ = {UFIELD_CATEGORY_RELATIVE_DATETIME, UDAT_REL_LITERAL_FIELD};
+
+class FormattedRelativeDateTimeData : public FormattedValueStringBuilderImpl {
+public:
+ FormattedRelativeDateTimeData() : FormattedValueStringBuilderImpl(kRDTNumericField) {}
+ virtual ~FormattedRelativeDateTimeData();
+};
+
+FormattedRelativeDateTimeData::~FormattedRelativeDateTimeData() = default;
+
+
+UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedRelativeDateTime)
+
+
RelativeDateTimeFormatter::RelativeDateTimeFormatter(UErrorCode& status) :
- fCache(nullptr),
- fNumberFormat(nullptr),
- fPluralRules(nullptr),
+ fCache(nullptr),
+ fNumberFormat(nullptr),
+ fPluralRules(nullptr),
fStyle(UDAT_STYLE_LONG),
fContext(UDISPCTX_CAPITALIZATION_NONE),
- fOptBreakIterator(nullptr) {
- init(nullptr, nullptr, status);
+ fOptBreakIterator(nullptr) {
+ init(nullptr, nullptr, status);
}
RelativeDateTimeFormatter::RelativeDateTimeFormatter(
const Locale& locale, UErrorCode& status) :
- fCache(nullptr),
- fNumberFormat(nullptr),
- fPluralRules(nullptr),
+ fCache(nullptr),
+ fNumberFormat(nullptr),
+ fPluralRules(nullptr),
fStyle(UDAT_STYLE_LONG),
fContext(UDISPCTX_CAPITALIZATION_NONE),
- fOptBreakIterator(nullptr),
+ fOptBreakIterator(nullptr),
fLocale(locale) {
- init(nullptr, nullptr, status);
+ init(nullptr, nullptr, status);
}
RelativeDateTimeFormatter::RelativeDateTimeFormatter(
const Locale& locale, NumberFormat *nfToAdopt, UErrorCode& status) :
- fCache(nullptr),
- fNumberFormat(nullptr),
- fPluralRules(nullptr),
+ fCache(nullptr),
+ fNumberFormat(nullptr),
+ fPluralRules(nullptr),
fStyle(UDAT_STYLE_LONG),
fContext(UDISPCTX_CAPITALIZATION_NONE),
- fOptBreakIterator(nullptr),
+ fOptBreakIterator(nullptr),
fLocale(locale) {
- init(nfToAdopt, nullptr, status);
+ init(nfToAdopt, nullptr, status);
}
RelativeDateTimeFormatter::RelativeDateTimeFormatter(
@@ -786,12 +786,12 @@ RelativeDateTimeFormatter::RelativeDateTimeFormatter(
UDateRelativeDateTimeFormatterStyle styl,
UDisplayContext capitalizationContext,
UErrorCode& status) :
- fCache(nullptr),
- fNumberFormat(nullptr),
- fPluralRules(nullptr),
+ fCache(nullptr),
+ fNumberFormat(nullptr),
+ fPluralRules(nullptr),
fStyle(styl),
fContext(capitalizationContext),
- fOptBreakIterator(nullptr),
+ fOptBreakIterator(nullptr),
fLocale(locale) {
if (U_FAILURE(status)) {
return;
@@ -807,7 +807,7 @@ RelativeDateTimeFormatter::RelativeDateTimeFormatter(
}
init(nfToAdopt, bi, status);
} else {
- init(nfToAdopt, nullptr, status);
+ init(nfToAdopt, nullptr, status);
}
}
@@ -824,7 +824,7 @@ RelativeDateTimeFormatter::RelativeDateTimeFormatter(
fCache->addRef();
fNumberFormat->addRef();
fPluralRules->addRef();
- if (fOptBreakIterator != nullptr) {
+ if (fOptBreakIterator != nullptr) {
fOptBreakIterator->addRef();
}
}
@@ -844,16 +844,16 @@ RelativeDateTimeFormatter& RelativeDateTimeFormatter::operator=(
}
RelativeDateTimeFormatter::~RelativeDateTimeFormatter() {
- if (fCache != nullptr) {
+ if (fCache != nullptr) {
fCache->removeRef();
}
- if (fNumberFormat != nullptr) {
+ if (fNumberFormat != nullptr) {
fNumberFormat->removeRef();
}
- if (fPluralRules != nullptr) {
+ if (fPluralRules != nullptr) {
fPluralRules->removeRef();
}
- if (fOptBreakIterator != nullptr) {
+ if (fOptBreakIterator != nullptr) {
fOptBreakIterator->removeRef();
}
}
@@ -870,254 +870,254 @@ UDateRelativeDateTimeFormatterStyle RelativeDateTimeFormatter::getFormatStyle()
return fStyle;
}
-
-// To reduce boilerplate code, we use a helper function that forwards variadic
-// arguments to the formatImpl function.
-
-template<typename F, typename... Args>
-UnicodeString& RelativeDateTimeFormatter::doFormat(
- F callback,
- UnicodeString& appendTo,
- UErrorCode& status,
- Args... args) const {
- FormattedRelativeDateTimeData output;
- (this->*callback)(std::forward<Args>(args)..., output, status);
+
+// To reduce boilerplate code, we use a helper function that forwards variadic
+// arguments to the formatImpl function.
+
+template<typename F, typename... Args>
+UnicodeString& RelativeDateTimeFormatter::doFormat(
+ F callback,
+ UnicodeString& appendTo,
+ UErrorCode& status,
+ Args... args) const {
+ FormattedRelativeDateTimeData output;
+ (this->*callback)(std::forward<Args>(args)..., output, status);
if (U_FAILURE(status)) {
return appendTo;
}
- UnicodeString result = output.getStringRef().toUnicodeString();
- return appendTo.append(adjustForContext(result));
-}
-
-template<typename F, typename... Args>
-FormattedRelativeDateTime RelativeDateTimeFormatter::doFormatToValue(
- F callback,
- UErrorCode& status,
- Args... args) const {
- if (!checkNoAdjustForContext(status)) {
- return FormattedRelativeDateTime(status);
- }
- LocalPointer<FormattedRelativeDateTimeData> output(
- new FormattedRelativeDateTimeData(), status);
- if (U_FAILURE(status)) {
- return FormattedRelativeDateTime(status);
- }
- (this->*callback)(std::forward<Args>(args)..., *output, status);
- output->getStringRef().writeTerminator(status);
- return FormattedRelativeDateTime(output.orphan());
-}
-
-UnicodeString& RelativeDateTimeFormatter::format(
- double quantity,
- UDateDirection direction,
- UDateRelativeUnit unit,
- UnicodeString& appendTo,
- UErrorCode& status) const {
- return doFormat(
- &RelativeDateTimeFormatter::formatImpl,
- appendTo,
- status,
- quantity,
- direction,
- unit);
-}
-
-FormattedRelativeDateTime RelativeDateTimeFormatter::formatToValue(
- double quantity,
- UDateDirection direction,
- UDateRelativeUnit unit,
- UErrorCode& status) const {
- return doFormatToValue(
- &RelativeDateTimeFormatter::formatImpl,
- status,
- quantity,
- direction,
- unit);
-}
-
-void RelativeDateTimeFormatter::formatImpl(
- double quantity,
- UDateDirection direction,
- UDateRelativeUnit unit,
- FormattedRelativeDateTimeData& output,
- UErrorCode& status) const {
- if (U_FAILURE(status)) {
- return;
- }
+ UnicodeString result = output.getStringRef().toUnicodeString();
+ return appendTo.append(adjustForContext(result));
+}
+
+template<typename F, typename... Args>
+FormattedRelativeDateTime RelativeDateTimeFormatter::doFormatToValue(
+ F callback,
+ UErrorCode& status,
+ Args... args) const {
+ if (!checkNoAdjustForContext(status)) {
+ return FormattedRelativeDateTime(status);
+ }
+ LocalPointer<FormattedRelativeDateTimeData> output(
+ new FormattedRelativeDateTimeData(), status);
+ if (U_FAILURE(status)) {
+ return FormattedRelativeDateTime(status);
+ }
+ (this->*callback)(std::forward<Args>(args)..., *output, status);
+ output->getStringRef().writeTerminator(status);
+ return FormattedRelativeDateTime(output.orphan());
+}
+
+UnicodeString& RelativeDateTimeFormatter::format(
+ double quantity,
+ UDateDirection direction,
+ UDateRelativeUnit unit,
+ UnicodeString& appendTo,
+ UErrorCode& status) const {
+ return doFormat(
+ &RelativeDateTimeFormatter::formatImpl,
+ appendTo,
+ status,
+ quantity,
+ direction,
+ unit);
+}
+
+FormattedRelativeDateTime RelativeDateTimeFormatter::formatToValue(
+ double quantity,
+ UDateDirection direction,
+ UDateRelativeUnit unit,
+ UErrorCode& status) const {
+ return doFormatToValue(
+ &RelativeDateTimeFormatter::formatImpl,
+ status,
+ quantity,
+ direction,
+ unit);
+}
+
+void RelativeDateTimeFormatter::formatImpl(
+ double quantity,
+ UDateDirection direction,
+ UDateRelativeUnit unit,
+ FormattedRelativeDateTimeData& output,
+ UErrorCode& status) const {
+ if (U_FAILURE(status)) {
+ return;
+ }
if (direction != UDAT_DIRECTION_LAST && direction != UDAT_DIRECTION_NEXT) {
status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
+ return;
}
int32_t bFuture = direction == UDAT_DIRECTION_NEXT ? 1 : 0;
- StandardPlural::Form pluralForm;
- QuantityFormatter::formatAndSelect(
- quantity,
- **fNumberFormat,
- **fPluralRules,
- output.getStringRef(),
- pluralForm,
+ StandardPlural::Form pluralForm;
+ QuantityFormatter::formatAndSelect(
+ quantity,
+ **fNumberFormat,
+ **fPluralRules,
+ output.getStringRef(),
+ pluralForm,
status);
- if (U_FAILURE(status)) {
- return;
- }
+ if (U_FAILURE(status)) {
+ return;
+ }
const SimpleFormatter* formatter =
- fCache->getRelativeUnitFormatter(fStyle, unit, bFuture, pluralForm);
- if (formatter == nullptr) {
+ fCache->getRelativeUnitFormatter(fStyle, unit, bFuture, pluralForm);
+ if (formatter == nullptr) {
// TODO: WARN - look at quantity formatter's action with an error.
status = U_INVALID_FORMAT_ERROR;
- return;
+ return;
}
-
- number::impl::SimpleModifier modifier(*formatter, kRDTLiteralField, false);
- modifier.formatAsPrefixSuffix(
- output.getStringRef(), 0, output.getStringRef().length(), status);
+
+ number::impl::SimpleModifier modifier(*formatter, kRDTLiteralField, false);
+ modifier.formatAsPrefixSuffix(
+ output.getStringRef(), 0, output.getStringRef().length(), status);
}
UnicodeString& RelativeDateTimeFormatter::formatNumeric(
- double offset,
- URelativeDateTimeUnit unit,
- UnicodeString& appendTo,
- UErrorCode& status) const {
- return doFormat(
- &RelativeDateTimeFormatter::formatNumericImpl,
- appendTo,
- status,
- offset,
- unit);
-}
-
-FormattedRelativeDateTime RelativeDateTimeFormatter::formatNumericToValue(
- double offset,
- URelativeDateTimeUnit unit,
- UErrorCode& status) const {
- return doFormatToValue(
- &RelativeDateTimeFormatter::formatNumericImpl,
- status,
- offset,
- unit);
-}
-
-void RelativeDateTimeFormatter::formatNumericImpl(
- double offset,
- URelativeDateTimeUnit unit,
- FormattedRelativeDateTimeData& output,
- UErrorCode& status) const {
+ double offset,
+ URelativeDateTimeUnit unit,
+ UnicodeString& appendTo,
+ UErrorCode& status) const {
+ return doFormat(
+ &RelativeDateTimeFormatter::formatNumericImpl,
+ appendTo,
+ status,
+ offset,
+ unit);
+}
+
+FormattedRelativeDateTime RelativeDateTimeFormatter::formatNumericToValue(
+ double offset,
+ URelativeDateTimeUnit unit,
+ UErrorCode& status) const {
+ return doFormatToValue(
+ &RelativeDateTimeFormatter::formatNumericImpl,
+ status,
+ offset,
+ unit);
+}
+
+void RelativeDateTimeFormatter::formatNumericImpl(
+ double offset,
+ URelativeDateTimeUnit unit,
+ FormattedRelativeDateTimeData& output,
+ UErrorCode& status) const {
if (U_FAILURE(status)) {
- return;
+ return;
}
UDateDirection direction = UDAT_DIRECTION_NEXT;
- if (std::signbit(offset)) { // needed to handle -0.0
+ if (std::signbit(offset)) { // needed to handle -0.0
direction = UDAT_DIRECTION_LAST;
offset = -offset;
}
- if (direction != UDAT_DIRECTION_LAST && direction != UDAT_DIRECTION_NEXT) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
- int32_t bFuture = direction == UDAT_DIRECTION_NEXT ? 1 : 0;
-
- StandardPlural::Form pluralForm;
- QuantityFormatter::formatAndSelect(
- offset,
- **fNumberFormat,
- **fPluralRules,
- output.getStringRef(),
- pluralForm,
- status);
- if (U_FAILURE(status)) {
- return;
- }
-
- const SimpleFormatter* formatter =
- fCache->getRelativeDateTimeUnitFormatter(fStyle, unit, bFuture, pluralForm);
- if (formatter == nullptr) {
- // TODO: WARN - look at quantity formatter's action with an error.
- status = U_INVALID_FORMAT_ERROR;
- return;
- }
-
- number::impl::SimpleModifier modifier(*formatter, kRDTLiteralField, false);
- modifier.formatAsPrefixSuffix(
- output.getStringRef(), 0, output.getStringRef().length(), status);
+ if (direction != UDAT_DIRECTION_LAST && direction != UDAT_DIRECTION_NEXT) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ int32_t bFuture = direction == UDAT_DIRECTION_NEXT ? 1 : 0;
+
+ StandardPlural::Form pluralForm;
+ QuantityFormatter::formatAndSelect(
+ offset,
+ **fNumberFormat,
+ **fPluralRules,
+ output.getStringRef(),
+ pluralForm,
+ status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+
+ const SimpleFormatter* formatter =
+ fCache->getRelativeDateTimeUnitFormatter(fStyle, unit, bFuture, pluralForm);
+ if (formatter == nullptr) {
+ // TODO: WARN - look at quantity formatter's action with an error.
+ status = U_INVALID_FORMAT_ERROR;
+ return;
+ }
+
+ number::impl::SimpleModifier modifier(*formatter, kRDTLiteralField, false);
+ modifier.formatAsPrefixSuffix(
+ output.getStringRef(), 0, output.getStringRef().length(), status);
}
UnicodeString& RelativeDateTimeFormatter::format(
- UDateDirection direction,
- UDateAbsoluteUnit unit,
- UnicodeString& appendTo,
- UErrorCode& status) const {
- return doFormat(
- &RelativeDateTimeFormatter::formatAbsoluteImpl,
- appendTo,
- status,
- direction,
- unit);
-}
-
-FormattedRelativeDateTime RelativeDateTimeFormatter::formatToValue(
- UDateDirection direction,
- UDateAbsoluteUnit unit,
- UErrorCode& status) const {
- return doFormatToValue(
- &RelativeDateTimeFormatter::formatAbsoluteImpl,
- status,
- direction,
- unit);
-}
-
-void RelativeDateTimeFormatter::formatAbsoluteImpl(
- UDateDirection direction,
- UDateAbsoluteUnit unit,
- FormattedRelativeDateTimeData& output,
- UErrorCode& status) const {
+ UDateDirection direction,
+ UDateAbsoluteUnit unit,
+ UnicodeString& appendTo,
+ UErrorCode& status) const {
+ return doFormat(
+ &RelativeDateTimeFormatter::formatAbsoluteImpl,
+ appendTo,
+ status,
+ direction,
+ unit);
+}
+
+FormattedRelativeDateTime RelativeDateTimeFormatter::formatToValue(
+ UDateDirection direction,
+ UDateAbsoluteUnit unit,
+ UErrorCode& status) const {
+ return doFormatToValue(
+ &RelativeDateTimeFormatter::formatAbsoluteImpl,
+ status,
+ direction,
+ unit);
+}
+
+void RelativeDateTimeFormatter::formatAbsoluteImpl(
+ UDateDirection direction,
+ UDateAbsoluteUnit unit,
+ FormattedRelativeDateTimeData& output,
+ UErrorCode& status) const {
if (U_FAILURE(status)) {
- return;
+ return;
}
if (unit == UDAT_ABSOLUTE_NOW && direction != UDAT_DIRECTION_PLAIN) {
status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
+ return;
}
// Get string using fallback.
- output.getStringRef().append(
- fCache->getAbsoluteUnitString(fStyle, unit, direction),
- kRDTLiteralField,
- status);
+ output.getStringRef().append(
+ fCache->getAbsoluteUnitString(fStyle, unit, direction),
+ kRDTLiteralField,
+ status);
}
UnicodeString& RelativeDateTimeFormatter::format(
- double offset,
- URelativeDateTimeUnit unit,
- UnicodeString& appendTo,
- UErrorCode& status) const {
- return doFormat(
- &RelativeDateTimeFormatter::formatRelativeImpl,
- appendTo,
- status,
- offset,
- unit);
-}
-
-FormattedRelativeDateTime RelativeDateTimeFormatter::formatToValue(
- double offset,
- URelativeDateTimeUnit unit,
- UErrorCode& status) const {
- return doFormatToValue(
- &RelativeDateTimeFormatter::formatRelativeImpl,
- status,
- offset,
- unit);
-}
-
-void RelativeDateTimeFormatter::formatRelativeImpl(
- double offset,
- URelativeDateTimeUnit unit,
- FormattedRelativeDateTimeData& output,
- UErrorCode& status) const {
+ double offset,
+ URelativeDateTimeUnit unit,
+ UnicodeString& appendTo,
+ UErrorCode& status) const {
+ return doFormat(
+ &RelativeDateTimeFormatter::formatRelativeImpl,
+ appendTo,
+ status,
+ offset,
+ unit);
+}
+
+FormattedRelativeDateTime RelativeDateTimeFormatter::formatToValue(
+ double offset,
+ URelativeDateTimeUnit unit,
+ UErrorCode& status) const {
+ return doFormatToValue(
+ &RelativeDateTimeFormatter::formatRelativeImpl,
+ status,
+ offset,
+ unit);
+}
+
+void RelativeDateTimeFormatter::formatRelativeImpl(
+ double offset,
+ URelativeDateTimeUnit unit,
+ FormattedRelativeDateTimeData& output,
+ UErrorCode& status) const {
if (U_FAILURE(status)) {
- return;
+ return;
}
// TODO:
// The full implementation of this depends on CLDR data that is not yet available,
@@ -1144,7 +1144,7 @@ void RelativeDateTimeFormatter::formatRelativeImpl(
UDateAbsoluteUnit absunit = UDAT_ABSOLUTE_UNIT_COUNT;
switch (unit) {
case UDAT_REL_UNIT_YEAR: absunit = UDAT_ABSOLUTE_YEAR; break;
- case UDAT_REL_UNIT_QUARTER: absunit = UDAT_ABSOLUTE_QUARTER; break;
+ case UDAT_REL_UNIT_QUARTER: absunit = UDAT_ABSOLUTE_QUARTER; break;
case UDAT_REL_UNIT_MONTH: absunit = UDAT_ABSOLUTE_MONTH; break;
case UDAT_REL_UNIT_WEEK: absunit = UDAT_ABSOLUTE_WEEK; break;
case UDAT_REL_UNIT_DAY: absunit = UDAT_ABSOLUTE_DAY; break;
@@ -1161,18 +1161,18 @@ void RelativeDateTimeFormatter::formatRelativeImpl(
case UDAT_REL_UNIT_THURSDAY: absunit = UDAT_ABSOLUTE_THURSDAY; break;
case UDAT_REL_UNIT_FRIDAY: absunit = UDAT_ABSOLUTE_FRIDAY; break;
case UDAT_REL_UNIT_SATURDAY: absunit = UDAT_ABSOLUTE_SATURDAY; break;
- case UDAT_REL_UNIT_HOUR: absunit = UDAT_ABSOLUTE_HOUR; break;
- case UDAT_REL_UNIT_MINUTE: absunit = UDAT_ABSOLUTE_MINUTE; break;
+ case UDAT_REL_UNIT_HOUR: absunit = UDAT_ABSOLUTE_HOUR; break;
+ case UDAT_REL_UNIT_MINUTE: absunit = UDAT_ABSOLUTE_MINUTE; break;
default: break;
}
if (direction != UDAT_DIRECTION_COUNT && absunit != UDAT_ABSOLUTE_UNIT_COUNT) {
- formatAbsoluteImpl(direction, absunit, output, status);
- if (output.getStringRef().length() != 0) {
- return;
+ formatAbsoluteImpl(direction, absunit, output, status);
+ if (output.getStringRef().length() != 0) {
+ return;
}
}
// otherwise fallback to formatNumeric
- formatNumericImpl(offset, unit, output, status);
+ formatNumericImpl(offset, unit, output, status);
}
UnicodeString& RelativeDateTimeFormatter::combineDateAndTime(
@@ -1182,33 +1182,33 @@ UnicodeString& RelativeDateTimeFormatter::combineDateAndTime(
timeString, relativeDateString, appendTo, status);
}
-UnicodeString& RelativeDateTimeFormatter::adjustForContext(UnicodeString &str) const {
- if (fOptBreakIterator == nullptr
+UnicodeString& RelativeDateTimeFormatter::adjustForContext(UnicodeString &str) const {
+ if (fOptBreakIterator == nullptr
|| str.length() == 0 || !u_islower(str.char32At(0))) {
- return str;
+ return str;
}
// Must guarantee that one thread at a time accesses the shared break
// iterator.
- static UMutex gBrkIterMutex;
+ static UMutex gBrkIterMutex;
Mutex lock(&gBrkIterMutex);
str.toTitle(
fOptBreakIterator->get(),
fLocale,
U_TITLECASE_NO_LOWERCASE | U_TITLECASE_NO_BREAK_ADJUSTMENT);
- return str;
+ return str;
+}
+
+UBool RelativeDateTimeFormatter::checkNoAdjustForContext(UErrorCode& status) const {
+ // This is unsupported because it's hard to keep fields in sync with title
+ // casing. The code could be written and tested if there is demand.
+ if (fOptBreakIterator != nullptr) {
+ status = U_UNSUPPORTED_ERROR;
+ return FALSE;
+ }
+ return TRUE;
}
-UBool RelativeDateTimeFormatter::checkNoAdjustForContext(UErrorCode& status) const {
- // This is unsupported because it's hard to keep fields in sync with title
- // casing. The code could be written and tested if there is demand.
- if (fOptBreakIterator != nullptr) {
- status = U_UNSUPPORTED_ERROR;
- return FALSE;
- }
- return TRUE;
-}
-
void RelativeDateTimeFormatter::init(
NumberFormat *nfToAdopt,
BreakIterator *biToAdopt,
@@ -1236,7 +1236,7 @@ void RelativeDateTimeFormatter::init(
shared->removeRef();
} else {
SharedNumberFormat *shared = new SharedNumberFormat(nf.getAlias());
- if (shared == nullptr) {
+ if (shared == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -1247,7 +1247,7 @@ void RelativeDateTimeFormatter::init(
SharedObject::clearPtr(fOptBreakIterator);
} else {
SharedBreakIterator *shared = new SharedBreakIterator(bi.getAlias());
- if (shared == nullptr) {
+ if (shared == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -1262,17 +1262,17 @@ U_NAMESPACE_END
U_NAMESPACE_USE
-
-// Magic number: "FRDT" (FormattedRelativeDateTime) in ASCII
-UPRV_FORMATTED_VALUE_CAPI_AUTO_IMPL(
- FormattedRelativeDateTime,
- UFormattedRelativeDateTime,
- UFormattedRelativeDateTimeImpl,
- UFormattedRelativeDateTimeApiHelper,
- ureldatefmt,
- 0x46524454)
-
-
+
+// Magic number: "FRDT" (FormattedRelativeDateTime) in ASCII
+UPRV_FORMATTED_VALUE_CAPI_AUTO_IMPL(
+ FormattedRelativeDateTime,
+ UFormattedRelativeDateTime,
+ UFormattedRelativeDateTimeImpl,
+ UFormattedRelativeDateTimeApiHelper,
+ ureldatefmt,
+ 0x46524454)
+
+
U_CAPI URelativeDateTimeFormatter* U_EXPORT2
ureldatefmt_open( const char* locale,
UNumberFormat* nfToAdopt,
@@ -1281,13 +1281,13 @@ ureldatefmt_open( const char* locale,
UErrorCode* status )
{
if (U_FAILURE(*status)) {
- return nullptr;
+ return nullptr;
}
LocalPointer<RelativeDateTimeFormatter> formatter(new RelativeDateTimeFormatter(Locale(locale),
(NumberFormat*)nfToAdopt, width,
capitalizationContext, *status), *status);
if (U_FAILURE(*status)) {
- return nullptr;
+ return nullptr;
}
return (URelativeDateTimeFormatter*)formatter.orphan();
}
@@ -1309,13 +1309,13 @@ ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt,
if (U_FAILURE(*status)) {
return 0;
}
- if (result == nullptr ? resultCapacity != 0 : resultCapacity < 0) {
+ if (result == nullptr ? resultCapacity != 0 : resultCapacity < 0) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
UnicodeString res;
- if (result != nullptr) {
- // nullptr destination for pure preflighting: empty dummy string
+ if (result != nullptr) {
+ // nullptr destination for pure preflighting: empty dummy string
// otherwise, alias the destination buffer (copied from udat_format)
res.setTo(result, 0, resultCapacity);
}
@@ -1326,21 +1326,21 @@ ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt,
return res.extract(result, resultCapacity, *status);
}
-U_STABLE void U_EXPORT2
-ureldatefmt_formatNumericToResult(
- const URelativeDateTimeFormatter* reldatefmt,
- double offset,
- URelativeDateTimeUnit unit,
- UFormattedRelativeDateTime* result,
- UErrorCode* status) {
- if (U_FAILURE(*status)) {
- return;
- }
- auto* fmt = reinterpret_cast<const RelativeDateTimeFormatter*>(reldatefmt);
- auto* resultImpl = UFormattedRelativeDateTimeApiHelper::validate(result, *status);
- resultImpl->fImpl = fmt->formatNumericToValue(offset, unit, *status);
-}
-
+U_STABLE void U_EXPORT2
+ureldatefmt_formatNumericToResult(
+ const URelativeDateTimeFormatter* reldatefmt,
+ double offset,
+ URelativeDateTimeUnit unit,
+ UFormattedRelativeDateTime* result,
+ UErrorCode* status) {
+ if (U_FAILURE(*status)) {
+ return;
+ }
+ auto* fmt = reinterpret_cast<const RelativeDateTimeFormatter*>(reldatefmt);
+ auto* resultImpl = UFormattedRelativeDateTimeApiHelper::validate(result, *status);
+ resultImpl->fImpl = fmt->formatNumericToValue(offset, unit, *status);
+}
+
U_CAPI int32_t U_EXPORT2
ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt,
double offset,
@@ -1352,13 +1352,13 @@ ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt,
if (U_FAILURE(*status)) {
return 0;
}
- if (result == nullptr ? resultCapacity != 0 : resultCapacity < 0) {
+ if (result == nullptr ? resultCapacity != 0 : resultCapacity < 0) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
UnicodeString res;
- if (result != nullptr) {
- // nullptr destination for pure preflighting: empty dummy string
+ if (result != nullptr) {
+ // nullptr destination for pure preflighting: empty dummy string
// otherwise, alias the destination buffer (copied from udat_format)
res.setTo(result, 0, resultCapacity);
}
@@ -1369,21 +1369,21 @@ ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt,
return res.extract(result, resultCapacity, *status);
}
-U_DRAFT void U_EXPORT2
-ureldatefmt_formatToResult(
- const URelativeDateTimeFormatter* reldatefmt,
- double offset,
- URelativeDateTimeUnit unit,
- UFormattedRelativeDateTime* result,
- UErrorCode* status) {
- if (U_FAILURE(*status)) {
- return;
- }
- auto* fmt = reinterpret_cast<const RelativeDateTimeFormatter*>(reldatefmt);
- auto* resultImpl = UFormattedRelativeDateTimeApiHelper::validate(result, *status);
- resultImpl->fImpl = fmt->formatToValue(offset, unit, *status);
-}
-
+U_DRAFT void U_EXPORT2
+ureldatefmt_formatToResult(
+ const URelativeDateTimeFormatter* reldatefmt,
+ double offset,
+ URelativeDateTimeUnit unit,
+ UFormattedRelativeDateTime* result,
+ UErrorCode* status) {
+ if (U_FAILURE(*status)) {
+ return;
+ }
+ auto* fmt = reinterpret_cast<const RelativeDateTimeFormatter*>(reldatefmt);
+ auto* resultImpl = UFormattedRelativeDateTimeApiHelper::validate(result, *status);
+ resultImpl->fImpl = fmt->formatToValue(offset, unit, *status);
+}
+
U_CAPI int32_t U_EXPORT2
ureldatefmt_combineDateAndTime( const URelativeDateTimeFormatter* reldatefmt,
const UChar * relativeDateString,
@@ -1397,9 +1397,9 @@ ureldatefmt_combineDateAndTime( const URelativeDateTimeFormatter* reldatefmt,
if (U_FAILURE(*status)) {
return 0;
}
- if (result == nullptr ? resultCapacity != 0 : resultCapacity < 0 ||
- (relativeDateString == nullptr ? relativeDateStringLen != 0 : relativeDateStringLen < -1) ||
- (timeString == nullptr ? timeStringLen != 0 : timeStringLen < -1)) {
+ if (result == nullptr ? resultCapacity != 0 : resultCapacity < 0 ||
+ (relativeDateString == nullptr ? relativeDateStringLen != 0 : relativeDateStringLen < -1) ||
+ (timeString == nullptr ? timeStringLen != 0 : timeStringLen < -1)) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
diff --git a/contrib/libs/icu/i18n/reldtfmt.cpp b/contrib/libs/icu/i18n/reldtfmt.cpp
index 161a182f08..c8ffd04646 100644
--- a/contrib/libs/icu/i18n/reldtfmt.cpp
+++ b/contrib/libs/icu/i18n/reldtfmt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -20,7 +20,7 @@
#include "unicode/udisplaycontext.h"
#include "unicode/uchar.h"
#include "unicode/brkiter.h"
-#include "unicode/ucasemap.h"
+#include "unicode/ucasemap.h"
#include "reldtfmt.h"
#include "cmemory.h"
#include "uresimp.h"
@@ -51,7 +51,7 @@ RelativeDateFormat::RelativeDateFormat(const RelativeDateFormat& other) :
fCapitalizationBrkIter(NULL)
{
if(other.fDateTimeFormatter != NULL) {
- fDateTimeFormatter = other.fDateTimeFormatter->clone();
+ fDateTimeFormatter = other.fDateTimeFormatter->clone();
}
if(other.fCombinedFormat != NULL) {
fCombinedFormat = new SimpleFormatter(*other.fCombinedFormat);
@@ -131,7 +131,7 @@ RelativeDateFormat::~RelativeDateFormat() {
}
-RelativeDateFormat* RelativeDateFormat::clone() const {
+RelativeDateFormat* RelativeDateFormat::clone() const {
return new RelativeDateFormat(*this);
}
@@ -430,7 +430,7 @@ RelativeDateFormat::setContext(UDisplayContext value, UErrorCode& status)
if ( fCapitalizationBrkIter == NULL && (value==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
(value==UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU && fCapitalizationOfRelativeUnitsForUIListMenu) ||
(value==UDISPCTX_CAPITALIZATION_FOR_STANDALONE && fCapitalizationOfRelativeUnitsForStandAlone)) ) {
- status = U_ZERO_ERROR;
+ status = U_ZERO_ERROR;
fCapitalizationBrkIter = BreakIterator::createSentenceInstance(fLocale, status);
if (U_FAILURE(status)) {
delete fCapitalizationBrkIter;
@@ -456,8 +456,8 @@ RelativeDateFormat::initCapitalizationContextInfo(const Locale& thelocale)
const int32_t * intVector = ures_getIntVector(rb.getAlias(),
&len, &status);
if (U_SUCCESS(status) && intVector != NULL && len >= 2) {
- fCapitalizationOfRelativeUnitsForUIListMenu = static_cast<UBool>(intVector[0]);
- fCapitalizationOfRelativeUnitsForStandAlone = static_cast<UBool>(intVector[1]);
+ fCapitalizationOfRelativeUnitsForUIListMenu = static_cast<UBool>(intVector[0]);
+ fCapitalizationOfRelativeUnitsForStandAlone = static_cast<UBool>(intVector[1]);
}
}
#endif
diff --git a/contrib/libs/icu/i18n/reldtfmt.h b/contrib/libs/icu/i18n/reldtfmt.h
index 2d5ed1bbb9..ff48d3b5c4 100644
--- a/contrib/libs/icu/i18n/reldtfmt.h
+++ b/contrib/libs/icu/i18n/reldtfmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -71,7 +71,7 @@ public:
* @return A copy of the object.
* @internal ICU 3.8
*/
- virtual RelativeDateFormat* clone() const;
+ virtual RelativeDateFormat* clone() const;
/**
* Return true if the given Format objects are semantically equal. Objects
diff --git a/contrib/libs/icu/i18n/rematch.cpp b/contrib/libs/icu/i18n/rematch.cpp
index c8f07e7c1b..69909faab9 100644
--- a/contrib/libs/icu/i18n/rematch.cpp
+++ b/contrib/libs/icu/i18n/rematch.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**************************************************************************
@@ -177,7 +177,7 @@ RegexMatcher::~RegexMatcher() {
#if UCONFIG_NO_BREAK_ITERATION==0
delete fWordBreakItr;
- delete fGCBreakItr;
+ delete fGCBreakItr;
#endif
}
@@ -223,7 +223,7 @@ void RegexMatcher::init(UErrorCode &status) {
fDeferredStatus = status;
fData = fSmallData;
fWordBreakItr = NULL;
- fGCBreakItr = NULL;
+ fGCBreakItr = NULL;
fStack = NULL;
fInputText = NULL;
@@ -431,7 +431,7 @@ RegexMatcher &RegexMatcher::appendReplacement(UText *dest,
(nextChar >= 0x31 && nextChar <= 0x39)) { // 0..9
groupName.append(nextChar);
} else if (nextChar == RIGHTBRACKET) {
- groupNum = fPattern->fNamedCaptureMap ? uhash_geti(fPattern->fNamedCaptureMap, &groupName) : 0;
+ groupNum = fPattern->fNamedCaptureMap ? uhash_geti(fPattern->fNamedCaptureMap, &groupName) : 0;
if (groupNum == 0) {
status = U_REGEX_INVALID_CAPTURE_GROUP_NAME;
}
@@ -440,7 +440,7 @@ RegexMatcher &RegexMatcher::appendReplacement(UText *dest,
status = U_REGEX_INVALID_CAPTURE_GROUP_NAME;
}
}
-
+
} else if (u_isdigit(nextChar)) {
// $n Scan for a capture group number
int32_t numCaptureGroups = fPattern->fGroupMap->size();
@@ -461,7 +461,7 @@ RegexMatcher &RegexMatcher::appendReplacement(UText *dest,
break;
}
(void)UTEXT_NEXT32(replacement);
- groupNum=groupNum*10 + nextDigitVal;
+ groupNum=groupNum*10 + nextDigitVal;
++numDigits;
}
} else {
@@ -719,7 +719,7 @@ UBool RegexMatcher::find(UErrorCode &status) {
if (findProgressInterrupt(startPos, status))
return FALSE;
}
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
case START_START:
// Matches are only possible at the start of the input string
@@ -767,7 +767,7 @@ UBool RegexMatcher::find(UErrorCode &status) {
return FALSE;
}
}
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
case START_STRING:
case START_CHAR:
@@ -799,11 +799,11 @@ UBool RegexMatcher::find(UErrorCode &status) {
return FALSE;
}
}
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
case START_LINE:
{
- UChar32 ch;
+ UChar32 ch;
if (startPos == fAnchorStart) {
MatchAt(startPos, FALSE, status);
if (U_FAILURE(status)) {
@@ -813,17 +813,17 @@ UBool RegexMatcher::find(UErrorCode &status) {
return TRUE;
}
UTEXT_SETNATIVEINDEX(fInputText, startPos);
- ch = UTEXT_NEXT32(fInputText);
+ ch = UTEXT_NEXT32(fInputText);
startPos = UTEXT_GETNATIVEINDEX(fInputText);
} else {
UTEXT_SETNATIVEINDEX(fInputText, startPos);
- ch = UTEXT_PREVIOUS32(fInputText);
+ ch = UTEXT_PREVIOUS32(fInputText);
UTEXT_SETNATIVEINDEX(fInputText, startPos);
}
if (fPattern->fFlags & UREGEX_UNIX_LINES) {
for (;;) {
- if (ch == 0x0a) {
+ if (ch == 0x0a) {
MatchAt(startPos, FALSE, status);
if (U_FAILURE(status)) {
return FALSE;
@@ -838,7 +838,7 @@ UBool RegexMatcher::find(UErrorCode &status) {
fHitEnd = TRUE;
return FALSE;
}
- ch = UTEXT_NEXT32(fInputText);
+ ch = UTEXT_NEXT32(fInputText);
startPos = UTEXT_GETNATIVEINDEX(fInputText);
// Note that it's perfectly OK for a pattern to have a zero-length
// match at the end of a string, so we must make sure that the loop
@@ -848,8 +848,8 @@ UBool RegexMatcher::find(UErrorCode &status) {
}
} else {
for (;;) {
- if (isLineTerminator(ch)) {
- if (ch == 0x0d && startPos < fActiveLimit && UTEXT_CURRENT32(fInputText) == 0x0a) {
+ if (isLineTerminator(ch)) {
+ if (ch == 0x0d && startPos < fActiveLimit && UTEXT_CURRENT32(fInputText) == 0x0a) {
(void)UTEXT_NEXT32(fInputText);
startPos = UTEXT_GETNATIVEINDEX(fInputText);
}
@@ -867,7 +867,7 @@ UBool RegexMatcher::find(UErrorCode &status) {
fHitEnd = TRUE;
return FALSE;
}
- ch = UTEXT_NEXT32(fInputText);
+ ch = UTEXT_NEXT32(fInputText);
startPos = UTEXT_GETNATIVEINDEX(fInputText);
// Note that it's perfectly OK for a pattern to have a zero-length
// match at the end of a string, so we must make sure that the loop
@@ -879,10 +879,10 @@ UBool RegexMatcher::find(UErrorCode &status) {
}
default:
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
@@ -993,7 +993,7 @@ UBool RegexMatcher::findUsingChunk(UErrorCode &status) {
if (findProgressInterrupt(startPos, status))
return FALSE;
}
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
case START_START:
// Matches are only possible at the start of the input string
@@ -1035,7 +1035,7 @@ UBool RegexMatcher::findUsingChunk(UErrorCode &status) {
return FALSE;
}
}
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
case START_STRING:
case START_CHAR:
@@ -1064,11 +1064,11 @@ UBool RegexMatcher::findUsingChunk(UErrorCode &status) {
return FALSE;
}
}
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
case START_LINE:
{
- UChar32 ch;
+ UChar32 ch;
if (startPos == fAnchorStart) {
MatchChunkAt(startPos, FALSE, status);
if (U_FAILURE(status)) {
@@ -1082,8 +1082,8 @@ UBool RegexMatcher::findUsingChunk(UErrorCode &status) {
if (fPattern->fFlags & UREGEX_UNIX_LINES) {
for (;;) {
- ch = inputBuf[startPos-1];
- if (ch == 0x0a) {
+ ch = inputBuf[startPos-1];
+ if (ch == 0x0a) {
MatchChunkAt(startPos, FALSE, status);
if (U_FAILURE(status)) {
return FALSE;
@@ -1106,9 +1106,9 @@ UBool RegexMatcher::findUsingChunk(UErrorCode &status) {
}
} else {
for (;;) {
- ch = inputBuf[startPos-1];
- if (isLineTerminator(ch)) {
- if (ch == 0x0d && startPos < fActiveLimit && inputBuf[startPos] == 0x0a) {
+ ch = inputBuf[startPos-1];
+ if (isLineTerminator(ch)) {
+ if (ch == 0x0d && startPos < fActiveLimit && inputBuf[startPos] == 0x0a) {
startPos++;
}
MatchChunkAt(startPos, FALSE, status);
@@ -1135,10 +1135,10 @@ UBool RegexMatcher::findUsingChunk(UErrorCode &status) {
}
default:
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
@@ -1857,14 +1857,14 @@ RegexMatcher &RegexMatcher::reset(const UnicodeString &input) {
fInputUniStrMaybeMutable = TRUE;
#if UCONFIG_NO_BREAK_ITERATION==0
- if (fWordBreakItr) {
- fWordBreakItr->setText(fInputText, fDeferredStatus);
- }
- if (fGCBreakItr) {
- fGCBreakItr->setText(fInputText, fDeferredStatus);
- }
+ if (fWordBreakItr) {
+ fWordBreakItr->setText(fInputText, fDeferredStatus);
+ }
+ if (fGCBreakItr) {
+ fGCBreakItr->setText(fInputText, fDeferredStatus);
+ }
#endif
-
+
return *this;
}
@@ -1882,12 +1882,12 @@ RegexMatcher &RegexMatcher::reset(UText *input) {
fInput = NULL;
#if UCONFIG_NO_BREAK_ITERATION==0
- if (fWordBreakItr) {
- fWordBreakItr->setText(input, fDeferredStatus);
- }
- if (fGCBreakItr) {
- fGCBreakItr->setText(fInputText, fDeferredStatus);
- }
+ if (fWordBreakItr) {
+ fWordBreakItr->setText(input, fDeferredStatus);
+ }
+ if (fGCBreakItr) {
+ fGCBreakItr->setText(fInputText, fDeferredStatus);
+ }
#endif
}
reset();
@@ -2076,7 +2076,7 @@ int32_t RegexMatcher::split(UText *input,
//
if (U_FAILURE(status)) {
return 0;
- }
+ }
if (destCapacity < 1) {
status = U_ILLEGAL_ARGUMENT_ERROR;
@@ -2192,7 +2192,7 @@ int32_t RegexMatcher::split(UText *input,
break;
}
i++;
- dest[i] = utext_extract_replace(fInputText, dest[i],
+ dest[i] = utext_extract_replace(fInputText, dest[i],
start64(groupNum, status), end64(groupNum, status), &status);
}
@@ -2205,7 +2205,7 @@ int32_t RegexMatcher::split(UText *input,
if (dest[i] == NULL) {
dest[i] = utext_openUChars(NULL, NULL, 0, &status);
} else {
- static const UChar emptyString[] = {(UChar)0};
+ static const UChar emptyString[] = {(UChar)0};
utext_replace(dest[i], 0, utext_nativeLength(dest[i]), emptyString, 0, &status);
}
}
@@ -2549,7 +2549,7 @@ UBool RegexMatcher::isWordBoundary(int64_t pos) {
// Current char is a combining one. Not a boundary.
return FALSE;
}
- cIsWord = RegexStaticSets::gStaticSets->fPropSets[URX_ISWORD_SET].contains(c);
+ cIsWord = RegexStaticSets::gStaticSets->fPropSets[URX_ISWORD_SET].contains(c);
}
// Back up until we come to a non-combining char, determine whether
@@ -2562,7 +2562,7 @@ UBool RegexMatcher::isWordBoundary(int64_t pos) {
UChar32 prevChar = UTEXT_PREVIOUS32(fInputText);
if (!(u_hasBinaryProperty(prevChar, UCHAR_GRAPHEME_EXTEND)
|| u_charType(prevChar) == U_FORMAT_CHAR)) {
- prevCIsWord = RegexStaticSets::gStaticSets->fPropSets[URX_ISWORD_SET].contains(prevChar);
+ prevCIsWord = RegexStaticSets::gStaticSets->fPropSets[URX_ISWORD_SET].contains(prevChar);
break;
}
}
@@ -2587,7 +2587,7 @@ UBool RegexMatcher::isChunkWordBoundary(int32_t pos) {
// Current char is a combining one. Not a boundary.
return FALSE;
}
- cIsWord = RegexStaticSets::gStaticSets->fPropSets[URX_ISWORD_SET].contains(c);
+ cIsWord = RegexStaticSets::gStaticSets->fPropSets[URX_ISWORD_SET].contains(c);
}
// Back up until we come to a non-combining char, determine whether
@@ -2601,7 +2601,7 @@ UBool RegexMatcher::isChunkWordBoundary(int32_t pos) {
U16_PREV(inputBuf, fLookStart, pos, prevChar);
if (!(u_hasBinaryProperty(prevChar, UCHAR_GRAPHEME_EXTEND)
|| u_charType(prevChar) == U_FORMAT_CHAR)) {
- prevCIsWord = RegexStaticSets::gStaticSets->fPropSets[URX_ISWORD_SET].contains(prevChar);
+ prevCIsWord = RegexStaticSets::gStaticSets->fPropSets[URX_ISWORD_SET].contains(prevChar);
break;
}
}
@@ -2618,24 +2618,24 @@ UBool RegexMatcher::isChunkWordBoundary(int32_t pos) {
// parameters: pos - the current position in the input buffer
//
//--------------------------------------------------------------------------------
-UBool RegexMatcher::isUWordBoundary(int64_t pos, UErrorCode &status) {
+UBool RegexMatcher::isUWordBoundary(int64_t pos, UErrorCode &status) {
UBool returnVal = FALSE;
-
+
#if UCONFIG_NO_BREAK_ITERATION==0
- // Note: this point will never be reached if break iteration is configured out.
- // Regex patterns that would require this function will fail to compile.
+ // Note: this point will never be reached if break iteration is configured out.
+ // Regex patterns that would require this function will fail to compile.
// If we haven't yet created a break iterator for this matcher, do it now.
- if (fWordBreakItr == nullptr) {
- fWordBreakItr = BreakIterator::createWordInstance(Locale::getEnglish(), status);
- if (U_FAILURE(status)) {
+ if (fWordBreakItr == nullptr) {
+ fWordBreakItr = BreakIterator::createWordInstance(Locale::getEnglish(), status);
+ if (U_FAILURE(status)) {
return FALSE;
}
- fWordBreakItr->setText(fInputText, status);
+ fWordBreakItr->setText(fInputText, status);
}
- // Note: zero width boundary tests like \b see through transparent region bounds,
- // which is why fLookLimit is used here, rather than fActiveLimit.
+ // Note: zero width boundary tests like \b see through transparent region bounds,
+ // which is why fLookLimit is used here, rather than fActiveLimit.
if (pos >= fLookLimit) {
fHitEnd = TRUE;
returnVal = TRUE; // With Unicode word rules, only positions within the interior of "real"
@@ -2648,30 +2648,30 @@ UBool RegexMatcher::isUWordBoundary(int64_t pos, UErrorCode &status) {
return returnVal;
}
-
-int64_t RegexMatcher::followingGCBoundary(int64_t pos, UErrorCode &status) {
- int64_t result = pos;
-
-#if UCONFIG_NO_BREAK_ITERATION==0
- // Note: this point will never be reached if break iteration is configured out.
- // Regex patterns that would require this function will fail to compile.
-
- // If we haven't yet created a break iterator for this matcher, do it now.
- if (fGCBreakItr == nullptr) {
- fGCBreakItr = BreakIterator::createCharacterInstance(Locale::getEnglish(), status);
- if (U_FAILURE(status)) {
- return pos;
- }
- fGCBreakItr->setText(fInputText, status);
- }
- result = fGCBreakItr->following(pos);
- if (result == BreakIterator::DONE) {
- result = pos;
- }
-#endif
- return result;
-}
-
+
+int64_t RegexMatcher::followingGCBoundary(int64_t pos, UErrorCode &status) {
+ int64_t result = pos;
+
+#if UCONFIG_NO_BREAK_ITERATION==0
+ // Note: this point will never be reached if break iteration is configured out.
+ // Regex patterns that would require this function will fail to compile.
+
+ // If we haven't yet created a break iterator for this matcher, do it now.
+ if (fGCBreakItr == nullptr) {
+ fGCBreakItr = BreakIterator::createCharacterInstance(Locale::getEnglish(), status);
+ if (U_FAILURE(status)) {
+ return pos;
+ }
+ fGCBreakItr->setText(fInputText, status);
+ }
+ result = fGCBreakItr->following(pos);
+ if (result == BreakIterator::DONE) {
+ result = pos;
+ }
+#endif
+ return result;
+}
+
//--------------------------------------------------------------------------------
//
// IncrementTime This function is called once each TIMER_INITIAL_VALUE state
@@ -2802,7 +2802,7 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
int64_t *pat = fPattern->fCompiledPat->getBuffer();
const UChar *litText = fPattern->fLiteralText.getBuffer();
- UVector *fSets = fPattern->fSets;
+ UVector *fSets = fPattern->fSets;
fFrameSize = fPattern->fFrameSize;
REStackFrame *fp = resetStack();
@@ -3112,7 +3112,7 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
case URX_BACKSLASH_BU: // Test for word boundaries, Unicode-style
{
- UBool success = isUWordBoundary(fp->fInputIdx, status);
+ UBool success = isUWordBoundary(fp->fInputIdx, status);
success ^= (UBool)(opValue != 0); // flip sense for \B
if (!success) {
fp = (REStackFrame *)fStack->popFrame(fFrameSize);
@@ -3214,21 +3214,21 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
case URX_BACKSLASH_X:
- // Match a Grapheme, as defined by Unicode UAX 29.
+ // Match a Grapheme, as defined by Unicode UAX 29.
- // Fail if at end of input
- if (fp->fInputIdx >= fActiveLimit) {
- fHitEnd = TRUE;
- fp = (REStackFrame *)fStack->popFrame(fFrameSize);
+ // Fail if at end of input
+ if (fp->fInputIdx >= fActiveLimit) {
+ fHitEnd = TRUE;
+ fp = (REStackFrame *)fStack->popFrame(fFrameSize);
break;
}
- fp->fInputIdx = followingGCBoundary(fp->fInputIdx, status);
- if (fp->fInputIdx >= fActiveLimit) {
- fHitEnd = TRUE;
- fp->fInputIdx = fActiveLimit;
- }
- break;
+ fp->fInputIdx = followingGCBoundary(fp->fInputIdx, status);
+ if (fp->fInputIdx >= fActiveLimit) {
+ fHitEnd = TRUE;
+ fp->fInputIdx = fActiveLimit;
+ }
+ break;
case URX_BACKSLASH_Z: // Test for end of Input
@@ -3262,13 +3262,13 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
UTEXT_SETNATIVEINDEX(fInputText, fp->fInputIdx);
UChar32 c = UTEXT_NEXT32(fInputText);
if (c < 256) {
- Regex8BitSet &s8 = RegexStaticSets::gStaticSets->fPropSets8[opValue];
- if (s8.contains(c)) {
+ Regex8BitSet &s8 = RegexStaticSets::gStaticSets->fPropSets8[opValue];
+ if (s8.contains(c)) {
success = !success;
}
} else {
- const UnicodeSet &s = RegexStaticSets::gStaticSets->fPropSets[opValue];
- if (s.contains(c)) {
+ const UnicodeSet &s = RegexStaticSets::gStaticSets->fPropSets[opValue];
+ if (s.contains(c)) {
success = !success;
}
}
@@ -3298,14 +3298,14 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
UChar32 c = UTEXT_NEXT32(fInputText);
if (c < 256) {
- Regex8BitSet &s8 = RegexStaticSets::gStaticSets->fPropSets8[opValue];
- if (s8.contains(c) == FALSE) {
+ Regex8BitSet &s8 = RegexStaticSets::gStaticSets->fPropSets8[opValue];
+ if (s8.contains(c) == FALSE) {
fp->fInputIdx = UTEXT_GETNATIVEINDEX(fInputText);
break;
}
} else {
- const UnicodeSet &s = RegexStaticSets::gStaticSets->fPropSets[opValue];
- if (s.contains(c) == FALSE) {
+ const UnicodeSet &s = RegexStaticSets::gStaticSets->fPropSets[opValue];
+ if (s.contains(c) == FALSE) {
fp->fInputIdx = UTEXT_GETNATIVEINDEX(fInputText);
break;
}
@@ -3326,7 +3326,7 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
// There is input left. Pick up one char and test it for set membership.
UChar32 c = UTEXT_NEXT32(fInputText);
- U_ASSERT(opValue > 0 && opValue < fSets->size());
+ U_ASSERT(opValue > 0 && opValue < fSets->size());
if (c<256) {
Regex8BitSet *s8 = &fPattern->fSets8[opValue];
if (s8->contains(c)) {
@@ -3334,7 +3334,7 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
break;
}
} else {
- UnicodeSet *s = (UnicodeSet *)fSets->elementAt(opValue);
+ UnicodeSet *s = (UnicodeSet *)fSets->elementAt(opValue);
if (s->contains(c)) {
// The character is in the set. A Match.
fp->fInputIdx = UTEXT_GETNATIVEINDEX(fInputText);
@@ -3516,14 +3516,14 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
}
}
fp = StateSave(fp, fp->fPatIdx, status);
- } else {
- // Increment time-out counter. (StateSave() does it if count >= minCount)
- fTickCounter--;
- if (fTickCounter <= 0) {
- IncrementTime(status); // Re-initializes fTickCounter
- }
- }
-
+ } else {
+ // Increment time-out counter. (StateSave() does it if count >= minCount)
+ fTickCounter--;
+ if (fTickCounter <= 0) {
+ IncrementTime(status); // Re-initializes fTickCounter
+ }
+ }
+
fp->fPatIdx = opValue + 4; // Loop back.
}
break;
@@ -3580,11 +3580,11 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
// We haven't met the minimum number of matches yet.
// Loop back for another one.
fp->fPatIdx = opValue + 4; // Loop back.
- // Increment time-out counter. (StateSave() does it if count >= minCount)
- fTickCounter--;
- if (fTickCounter <= 0) {
- IncrementTime(status); // Re-initializes fTickCounter
- }
+ // Increment time-out counter. (StateSave() does it if count >= minCount)
+ fTickCounter--;
+ if (fTickCounter <= 0) {
+ IncrementTime(status); // Re-initializes fTickCounter
+ }
} else {
// We do have the minimum number of matches.
@@ -3621,9 +3621,9 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
if (newFP == (int64_t *)fp) {
break;
}
- int32_t j;
- for (j=0; j<fFrameSize; j++) {
- newFP[j] = ((int64_t *)fp)[j];
+ int32_t j;
+ for (j=0; j<fFrameSize; j++) {
+ newFP[j] = ((int64_t *)fp)[j];
}
fp = (REStackFrame *)newFP;
fStack->setSize(newStackSize);
@@ -3757,13 +3757,13 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
case URX_LA_START:
{
- // Entering a look around block.
+ // Entering a look around block.
// Save Stack Ptr, Input Pos.
- U_ASSERT(opValue>=0 && opValue+3<fPattern->fDataSize);
+ U_ASSERT(opValue>=0 && opValue+3<fPattern->fDataSize);
fData[opValue] = fStack->size();
fData[opValue+1] = fp->fInputIdx;
- fData[opValue+2] = fActiveStart;
- fData[opValue+3] = fActiveLimit;
+ fData[opValue+2] = fActiveStart;
+ fData[opValue+3] = fActiveLimit;
fActiveStart = fLookStart; // Set the match region change for
fActiveLimit = fLookLimit; // transparent bounds.
}
@@ -3773,7 +3773,7 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
{
// Leaving a look-ahead block.
// restore Stack Ptr, Input Pos to positions they had on entry to block.
- U_ASSERT(opValue>=0 && opValue+3<fPattern->fDataSize);
+ U_ASSERT(opValue>=0 && opValue+3<fPattern->fDataSize);
int32_t stackSize = fStack->size();
int32_t newStackSize =(int32_t)fData[opValue];
U_ASSERT(stackSize >= newStackSize);
@@ -3782,9 +3782,9 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
// This makes the capture groups from within the look-ahead
// expression available.
int64_t *newFP = fStack->getBuffer() + newStackSize - fFrameSize;
- int32_t j;
- for (j=0; j<fFrameSize; j++) {
- newFP[j] = ((int64_t *)fp)[j];
+ int32_t j;
+ for (j=0; j<fFrameSize; j++) {
+ newFP[j] = ((int64_t *)fp)[j];
}
fp = (REStackFrame *)newFP;
fStack->setSize(newStackSize);
@@ -3793,10 +3793,10 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
// Restore the active region bounds in the input string; they may have
// been changed because of transparent bounds on a Region.
- fActiveStart = fData[opValue+2];
- fActiveLimit = fData[opValue+3];
- U_ASSERT(fActiveStart >= 0);
- U_ASSERT(fActiveLimit <= fInputLength);
+ fActiveStart = fData[opValue+2];
+ fActiveLimit = fData[opValue+3];
+ U_ASSERT(fActiveStart >= 0);
+ U_ASSERT(fActiveLimit <= fInputLength);
}
break;
@@ -3872,19 +3872,19 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
case URX_LB_START:
{
// Entering a look-behind block.
- // Save Stack Ptr, Input Pos and active input region.
+ // Save Stack Ptr, Input Pos and active input region.
// TODO: implement transparent bounds. Ticket #6067
- U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
+ U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
fData[opValue] = fStack->size();
fData[opValue+1] = fp->fInputIdx;
// Save input string length, then reset to pin any matches to end at
// the current position.
- fData[opValue+2] = fActiveStart;
+ fData[opValue+2] = fActiveStart;
fData[opValue+3] = fActiveLimit;
- fActiveStart = fRegionStart;
+ fActiveStart = fRegionStart;
fActiveLimit = fp->fInputIdx;
- // Init the variable containing the start index for attempted matches.
- fData[opValue+4] = -1;
+ // Init the variable containing the start index for attempted matches.
+ fData[opValue+4] = -1;
}
break;
@@ -3907,8 +3907,8 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
U_ASSERT(minML >= 0);
// Fetch (from data) the last input index where a match was attempted.
- U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
- int64_t &lbStartIdx = fData[opValue+4];
+ U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
+ int64_t &lbStartIdx = fData[opValue+4];
if (lbStartIdx < 0) {
// First time through loop.
lbStartIdx = fp->fInputIdx - minML;
@@ -3934,10 +3934,10 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
// getting a match. Backtrack out, and out of the
// Look Behind altogether.
fp = (REStackFrame *)fStack->popFrame(fFrameSize);
- fActiveStart = fData[opValue+2];
- fActiveLimit = fData[opValue+3];
- U_ASSERT(fActiveStart >= 0);
- U_ASSERT(fActiveLimit <= fInputLength);
+ fActiveStart = fData[opValue+2];
+ fActiveLimit = fData[opValue+3];
+ U_ASSERT(fActiveStart >= 0);
+ U_ASSERT(fActiveLimit <= fInputLength);
break;
}
@@ -3951,7 +3951,7 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
case URX_LB_END:
// End of a look-behind block, after a successful match.
{
- U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
+ U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
if (fp->fInputIdx != fActiveLimit) {
// The look-behind expression matched, but the match did not
// extend all the way to the point that we are looking behind from.
@@ -3962,13 +3962,13 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
break;
}
- // Look-behind match is good. Restore the orignal input string region,
+ // Look-behind match is good. Restore the orignal input string region,
// which had been truncated to pin the end of the lookbehind match to the
// position being looked-behind.
- fActiveStart = fData[opValue+2];
- fActiveLimit = fData[opValue+3];
- U_ASSERT(fActiveStart >= 0);
- U_ASSERT(fActiveLimit <= fInputLength);
+ fActiveStart = fData[opValue+2];
+ fActiveLimit = fData[opValue+3];
+ U_ASSERT(fActiveStart >= 0);
+ U_ASSERT(fActiveLimit <= fInputLength);
}
break;
@@ -3993,8 +3993,8 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
U_ASSERT(continueLoc > fp->fPatIdx);
// Fetch (from data) the last input index where a match was attempted.
- U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
- int64_t &lbStartIdx = fData[opValue+4];
+ U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
+ int64_t &lbStartIdx = fData[opValue+4];
if (lbStartIdx < 0) {
// First time through loop.
lbStartIdx = fp->fInputIdx - minML;
@@ -4019,10 +4019,10 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
// We have tried all potential match starting points without
// getting a match, which means that the negative lookbehind as
// a whole has succeeded. Jump forward to the continue location
- fActiveStart = fData[opValue+2];
- fActiveLimit = fData[opValue+3];
- U_ASSERT(fActiveStart >= 0);
- U_ASSERT(fActiveLimit <= fInputLength);
+ fActiveStart = fData[opValue+2];
+ fActiveLimit = fData[opValue+3];
+ U_ASSERT(fActiveStart >= 0);
+ U_ASSERT(fActiveLimit <= fInputLength);
fp->fPatIdx = continueLoc;
break;
}
@@ -4037,7 +4037,7 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
case URX_LBN_END:
// End of a negative look-behind block, after a successful match.
{
- U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
+ U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
if (fp->fInputIdx != fActiveLimit) {
// The look-behind expression matched, but the match did not
// extend all the way to the point that we are looking behind from.
@@ -4054,10 +4054,10 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
// Restore the orignal input string length, which had been truncated
// inorder to pin the end of the lookbehind match
// to the position being looked-behind.
- fActiveStart = fData[opValue+2];
- fActiveLimit = fData[opValue+3];
- U_ASSERT(fActiveStart >= 0);
- U_ASSERT(fActiveLimit <= fInputLength);
+ fActiveStart = fData[opValue+2];
+ fActiveLimit = fData[opValue+3];
+ U_ASSERT(fActiveStart >= 0);
+ U_ASSERT(fActiveLimit <= fInputLength);
// Restore original stack position, discarding any state saved
// by the successful pattern match.
@@ -4079,9 +4079,9 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
// This op scans through all matching input.
// The following LOOP_C op emulates stack unwinding if the following pattern fails.
{
- U_ASSERT(opValue > 0 && opValue < fSets->size());
+ U_ASSERT(opValue > 0 && opValue < fSets->size());
Regex8BitSet *s8 = &fPattern->fSets8[opValue];
- UnicodeSet *s = (UnicodeSet *)fSets->elementAt(opValue);
+ UnicodeSet *s = (UnicodeSet *)fSets->elementAt(opValue);
// Loop through input, until either the input is exhausted or
// we reach a character that is not a member of the set.
@@ -4234,7 +4234,7 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
default:
// Trouble. The compiled pattern contains an entry with an
// unrecognized type tag.
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
if (U_FAILURE(status)) {
@@ -4306,7 +4306,7 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
int64_t *pat = fPattern->fCompiledPat->getBuffer();
const UChar *litText = fPattern->fLiteralText.getBuffer();
- UVector *fSets = fPattern->fSets;
+ UVector *fSets = fPattern->fSets;
const UChar *inputBuf = fInputText->chunkContents;
@@ -4614,7 +4614,7 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
case URX_BACKSLASH_BU: // Test for word boundaries, Unicode-style
{
- UBool success = isUWordBoundary(fp->fInputIdx, status);
+ UBool success = isUWordBoundary(fp->fInputIdx, status);
success ^= (UBool)(opValue != 0); // flip sense for \B
if (!success) {
fp = (REStackFrame *)fStack->popFrame(fFrameSize);
@@ -4713,7 +4713,7 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
case URX_BACKSLASH_X:
- // Match a Grapheme, as defined by Unicode UAX 29.
+ // Match a Grapheme, as defined by Unicode UAX 29.
// Fail if at end of input
if (fp->fInputIdx >= fActiveLimit) {
@@ -4722,10 +4722,10 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
break;
}
- fp->fInputIdx = followingGCBoundary(fp->fInputIdx, status);
+ fp->fInputIdx = followingGCBoundary(fp->fInputIdx, status);
if (fp->fInputIdx >= fActiveLimit) {
fHitEnd = TRUE;
- fp->fInputIdx = fActiveLimit;
+ fp->fInputIdx = fActiveLimit;
}
break;
@@ -4761,13 +4761,13 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
UChar32 c;
U16_NEXT(inputBuf, fp->fInputIdx, fActiveLimit, c);
if (c < 256) {
- Regex8BitSet &s8 = RegexStaticSets::gStaticSets->fPropSets8[opValue];
- if (s8.contains(c)) {
+ Regex8BitSet &s8 = RegexStaticSets::gStaticSets->fPropSets8[opValue];
+ if (s8.contains(c)) {
success = !success;
}
} else {
- const UnicodeSet &s = RegexStaticSets::gStaticSets->fPropSets[opValue];
- if (s.contains(c)) {
+ const UnicodeSet &s = RegexStaticSets::gStaticSets->fPropSets[opValue];
+ if (s.contains(c)) {
success = !success;
}
}
@@ -4793,13 +4793,13 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
UChar32 c;
U16_NEXT(inputBuf, fp->fInputIdx, fActiveLimit, c);
if (c < 256) {
- Regex8BitSet &s8 = RegexStaticSets::gStaticSets->fPropSets8[opValue];
- if (s8.contains(c) == FALSE) {
+ Regex8BitSet &s8 = RegexStaticSets::gStaticSets->fPropSets8[opValue];
+ if (s8.contains(c) == FALSE) {
break;
}
} else {
- const UnicodeSet &s = RegexStaticSets::gStaticSets->fPropSets[opValue];
- if (s.contains(c) == FALSE) {
+ const UnicodeSet &s = RegexStaticSets::gStaticSets->fPropSets[opValue];
+ if (s.contains(c) == FALSE) {
break;
}
}
@@ -4816,7 +4816,7 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
break;
}
- U_ASSERT(opValue > 0 && opValue < fSets->size());
+ U_ASSERT(opValue > 0 && opValue < fSets->size());
// There is input left. Pick up one char and test it for set membership.
UChar32 c;
@@ -4828,7 +4828,7 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
break;
}
} else {
- UnicodeSet *s = (UnicodeSet *)fSets->elementAt(opValue);
+ UnicodeSet *s = (UnicodeSet *)fSets->elementAt(opValue);
if (s->contains(c)) {
// The character is in the set. A Match.
break;
@@ -4999,12 +4999,12 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
}
}
fp = StateSave(fp, fp->fPatIdx, status);
- } else {
- // Increment time-out counter. (StateSave() does it if count >= minCount)
- fTickCounter--;
- if (fTickCounter <= 0) {
- IncrementTime(status); // Re-initializes fTickCounter
- }
+ } else {
+ // Increment time-out counter. (StateSave() does it if count >= minCount)
+ fTickCounter--;
+ if (fTickCounter <= 0) {
+ IncrementTime(status); // Re-initializes fTickCounter
+ }
}
fp->fPatIdx = opValue + 4; // Loop back.
}
@@ -5062,10 +5062,10 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
// We haven't met the minimum number of matches yet.
// Loop back for another one.
fp->fPatIdx = opValue + 4; // Loop back.
- fTickCounter--;
- if (fTickCounter <= 0) {
- IncrementTime(status); // Re-initializes fTickCounter
- }
+ fTickCounter--;
+ if (fTickCounter <= 0) {
+ IncrementTime(status); // Re-initializes fTickCounter
+ }
} else {
// We do have the minimum number of matches.
@@ -5102,9 +5102,9 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
if (newFP == (int64_t *)fp) {
break;
}
- int32_t j;
- for (j=0; j<fFrameSize; j++) {
- newFP[j] = ((int64_t *)fp)[j];
+ int32_t j;
+ for (j=0; j<fFrameSize; j++) {
+ newFP[j] = ((int64_t *)fp)[j];
}
fp = (REStackFrame *)newFP;
fStack->setSize(newStackSize);
@@ -5226,13 +5226,13 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
case URX_LA_START:
{
- // Entering a look around block.
+ // Entering a look around block.
// Save Stack Ptr, Input Pos.
- U_ASSERT(opValue>=0 && opValue+3<fPattern->fDataSize);
+ U_ASSERT(opValue>=0 && opValue+3<fPattern->fDataSize);
fData[opValue] = fStack->size();
fData[opValue+1] = fp->fInputIdx;
- fData[opValue+2] = fActiveStart;
- fData[opValue+3] = fActiveLimit;
+ fData[opValue+2] = fActiveStart;
+ fData[opValue+3] = fActiveLimit;
fActiveStart = fLookStart; // Set the match region change for
fActiveLimit = fLookLimit; // transparent bounds.
}
@@ -5240,9 +5240,9 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
case URX_LA_END:
{
- // Leaving a look around block.
+ // Leaving a look around block.
// restore Stack Ptr, Input Pos to positions they had on entry to block.
- U_ASSERT(opValue>=0 && opValue+3<fPattern->fDataSize);
+ U_ASSERT(opValue>=0 && opValue+3<fPattern->fDataSize);
int32_t stackSize = fStack->size();
int32_t newStackSize = (int32_t)fData[opValue];
U_ASSERT(stackSize >= newStackSize);
@@ -5251,9 +5251,9 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
// This makes the capture groups from within the look-ahead
// expression available.
int64_t *newFP = fStack->getBuffer() + newStackSize - fFrameSize;
- int32_t j;
- for (j=0; j<fFrameSize; j++) {
- newFP[j] = ((int64_t *)fp)[j];
+ int32_t j;
+ for (j=0; j<fFrameSize; j++) {
+ newFP[j] = ((int64_t *)fp)[j];
}
fp = (REStackFrame *)newFP;
fStack->setSize(newStackSize);
@@ -5262,10 +5262,10 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
// Restore the active region bounds in the input string; they may have
// been changed because of transparent bounds on a Region.
- fActiveStart = fData[opValue+2];
- fActiveLimit = fData[opValue+3];
- U_ASSERT(fActiveStart >= 0);
- U_ASSERT(fActiveLimit <= fInputLength);
+ fActiveStart = fData[opValue+2];
+ fActiveLimit = fData[opValue+3];
+ U_ASSERT(fActiveStart >= 0);
+ U_ASSERT(fActiveLimit <= fInputLength);
}
break;
@@ -5328,19 +5328,19 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
case URX_LB_START:
{
// Entering a look-behind block.
- // Save Stack Ptr, Input Pos and active input region.
+ // Save Stack Ptr, Input Pos and active input region.
// TODO: implement transparent bounds. Ticket #6067
- U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
+ U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
fData[opValue] = fStack->size();
fData[opValue+1] = fp->fInputIdx;
// Save input string length, then reset to pin any matches to end at
// the current position.
- fData[opValue+2] = fActiveStart;
+ fData[opValue+2] = fActiveStart;
fData[opValue+3] = fActiveLimit;
- fActiveStart = fRegionStart;
+ fActiveStart = fRegionStart;
fActiveLimit = fp->fInputIdx;
- // Init the variable containing the start index for attempted matches.
- fData[opValue+4] = -1;
+ // Init the variable containing the start index for attempted matches.
+ fData[opValue+4] = -1;
}
break;
@@ -5358,12 +5358,12 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
U_ASSERT(minML >= 0);
// Fetch (from data) the last input index where a match was attempted.
- U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
- int64_t &lbStartIdx = fData[opValue+4];
+ U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
+ int64_t &lbStartIdx = fData[opValue+4];
if (lbStartIdx < 0) {
// First time through loop.
lbStartIdx = fp->fInputIdx - minML;
- if (lbStartIdx > 0 && lbStartIdx < fInputLength) {
+ if (lbStartIdx > 0 && lbStartIdx < fInputLength) {
U16_SET_CP_START(inputBuf, 0, lbStartIdx);
}
} else {
@@ -5381,10 +5381,10 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
// getting a match. Backtrack out, and out of the
// Look Behind altogether.
fp = (REStackFrame *)fStack->popFrame(fFrameSize);
- fActiveStart = fData[opValue+2];
- fActiveLimit = fData[opValue+3];
- U_ASSERT(fActiveStart >= 0);
- U_ASSERT(fActiveLimit <= fInputLength);
+ fActiveStart = fData[opValue+2];
+ fActiveLimit = fData[opValue+3];
+ U_ASSERT(fActiveStart >= 0);
+ U_ASSERT(fActiveLimit <= fInputLength);
break;
}
@@ -5398,7 +5398,7 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
case URX_LB_END:
// End of a look-behind block, after a successful match.
{
- U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
+ U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
if (fp->fInputIdx != fActiveLimit) {
// The look-behind expression matched, but the match did not
// extend all the way to the point that we are looking behind from.
@@ -5409,13 +5409,13 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
break;
}
- // Look-behind match is good. Restore the orignal input string region,
+ // Look-behind match is good. Restore the orignal input string region,
// which had been truncated to pin the end of the lookbehind match to the
// position being looked-behind.
- fActiveStart = fData[opValue+2];
- fActiveLimit = fData[opValue+3];
- U_ASSERT(fActiveStart >= 0);
- U_ASSERT(fActiveLimit <= fInputLength);
+ fActiveStart = fData[opValue+2];
+ fActiveLimit = fData[opValue+3];
+ U_ASSERT(fActiveStart >= 0);
+ U_ASSERT(fActiveLimit <= fInputLength);
}
break;
@@ -5435,12 +5435,12 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
U_ASSERT(continueLoc > fp->fPatIdx);
// Fetch (from data) the last input index where a match was attempted.
- U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
- int64_t &lbStartIdx = fData[opValue+4];
+ U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
+ int64_t &lbStartIdx = fData[opValue+4];
if (lbStartIdx < 0) {
// First time through loop.
lbStartIdx = fp->fInputIdx - minML;
- if (lbStartIdx > 0 && lbStartIdx < fInputLength) {
+ if (lbStartIdx > 0 && lbStartIdx < fInputLength) {
U16_SET_CP_START(inputBuf, 0, lbStartIdx);
}
} else {
@@ -5457,10 +5457,10 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
// We have tried all potential match starting points without
// getting a match, which means that the negative lookbehind as
// a whole has succeeded. Jump forward to the continue location
- fActiveStart = fData[opValue+2];
- fActiveLimit = fData[opValue+3];
- U_ASSERT(fActiveStart >= 0);
- U_ASSERT(fActiveLimit <= fInputLength);
+ fActiveStart = fData[opValue+2];
+ fActiveLimit = fData[opValue+3];
+ U_ASSERT(fActiveStart >= 0);
+ U_ASSERT(fActiveLimit <= fInputLength);
fp->fPatIdx = continueLoc;
break;
}
@@ -5475,7 +5475,7 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
case URX_LBN_END:
// End of a negative look-behind block, after a successful match.
{
- U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
+ U_ASSERT(opValue>=0 && opValue+4<fPattern->fDataSize);
if (fp->fInputIdx != fActiveLimit) {
// The look-behind expression matched, but the match did not
// extend all the way to the point that we are looking behind from.
@@ -5492,10 +5492,10 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
// Restore the orignal input string length, which had been truncated
// inorder to pin the end of the lookbehind match
// to the position being looked-behind.
- fActiveStart = fData[opValue+2];
- fActiveLimit = fData[opValue+3];
- U_ASSERT(fActiveStart >= 0);
- U_ASSERT(fActiveLimit <= fInputLength);
+ fActiveStart = fData[opValue+2];
+ fActiveLimit = fData[opValue+3];
+ U_ASSERT(fActiveStart >= 0);
+ U_ASSERT(fActiveLimit <= fInputLength);
// Restore original stack position, discarding any state saved
// by the successful pattern match.
@@ -5517,9 +5517,9 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
// This op scans through all matching input.
// The following LOOP_C op emulates stack unwinding if the following pattern fails.
{
- U_ASSERT(opValue > 0 && opValue < fSets->size());
+ U_ASSERT(opValue > 0 && opValue < fSets->size());
Regex8BitSet *s8 = &fPattern->fSets8[opValue];
- UnicodeSet *s = (UnicodeSet *)fSets->elementAt(opValue);
+ UnicodeSet *s = (UnicodeSet *)fSets->elementAt(opValue);
// Loop through input, until either the input is exhausted or
// we reach a character that is not a member of the set.
@@ -5672,7 +5672,7 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
default:
// Trouble. The compiled pattern contains an entry with an
// unrecognized type tag.
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
if (U_FAILURE(status)) {
@@ -5712,4 +5712,4 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RegexMatcher)
U_NAMESPACE_END
#endif // !UCONFIG_NO_REGULAR_EXPRESSIONS
-
+
diff --git a/contrib/libs/icu/i18n/remtrans.cpp b/contrib/libs/icu/i18n/remtrans.cpp
index 8c754c8738..03b878575c 100644
--- a/contrib/libs/icu/i18n/remtrans.cpp
+++ b/contrib/libs/icu/i18n/remtrans.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -48,10 +48,10 @@ RemoveTransliterator::RemoveTransliterator() : Transliterator(UnicodeString(TRUE
RemoveTransliterator::~RemoveTransliterator() {}
-RemoveTransliterator* RemoveTransliterator::clone() const {
- RemoveTransliterator* result = new RemoveTransliterator();
+RemoveTransliterator* RemoveTransliterator::clone() const {
+ RemoveTransliterator* result = new RemoveTransliterator();
if (result != NULL && getFilter() != 0) {
- result->adoptFilter(getFilter()->clone());
+ result->adoptFilter(getFilter()->clone());
}
return result;
}
diff --git a/contrib/libs/icu/i18n/remtrans.h b/contrib/libs/icu/i18n/remtrans.h
index 511804172d..13de01594a 100644
--- a/contrib/libs/icu/i18n/remtrans.h
+++ b/contrib/libs/icu/i18n/remtrans.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -47,7 +47,7 @@ public:
* Transliterator API.
* @return A copy of the object.
*/
- virtual RemoveTransliterator* clone() const;
+ virtual RemoveTransliterator* clone() const;
/**
* Implements {@link Transliterator#handleTransliterate}.
diff --git a/contrib/libs/icu/i18n/repattrn.cpp b/contrib/libs/icu/i18n/repattrn.cpp
index cce5dd654e..b3028e04f7 100644
--- a/contrib/libs/icu/i18n/repattrn.cpp
+++ b/contrib/libs/icu/i18n/repattrn.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
//
// file: repattrn.cpp
@@ -136,20 +136,20 @@ RegexPattern &RegexPattern::operator = (const RegexPattern &other) {
}
// Copy the named capture group hash map.
- if (other.fNamedCaptureMap != nullptr && initNamedCaptureMap()) {
- int32_t hashPos = UHASH_FIRST;
- while (const UHashElement *hashEl = uhash_nextElement(other.fNamedCaptureMap, &hashPos)) {
- if (U_FAILURE(fDeferredStatus)) {
- break;
- }
- const UnicodeString *name = (const UnicodeString *)hashEl->key.pointer;
- UnicodeString *key = new UnicodeString(*name);
- int32_t val = hashEl->value.integer;
- if (key == NULL) {
- fDeferredStatus = U_MEMORY_ALLOCATION_ERROR;
- } else {
- uhash_puti(fNamedCaptureMap, key, val, &fDeferredStatus);
- }
+ if (other.fNamedCaptureMap != nullptr && initNamedCaptureMap()) {
+ int32_t hashPos = UHASH_FIRST;
+ while (const UHashElement *hashEl = uhash_nextElement(other.fNamedCaptureMap, &hashPos)) {
+ if (U_FAILURE(fDeferredStatus)) {
+ break;
+ }
+ const UnicodeString *name = (const UnicodeString *)hashEl->key.pointer;
+ UnicodeString *key = new UnicodeString(*name);
+ int32_t val = hashEl->value.integer;
+ if (key == NULL) {
+ fDeferredStatus = U_MEMORY_ALLOCATION_ERROR;
+ } else {
+ uhash_puti(fNamedCaptureMap, key, val, &fDeferredStatus);
+ }
}
}
return *this;
@@ -193,32 +193,32 @@ void RegexPattern::init() {
return;
}
if (fCompiledPat == NULL || fGroupMap == NULL || fSets == NULL ||
- fInitialChars == NULL || fInitialChars8 == NULL) {
+ fInitialChars == NULL || fInitialChars8 == NULL) {
fDeferredStatus = U_MEMORY_ALLOCATION_ERROR;
return;
}
// Slot zero of the vector of sets is reserved. Fill it here.
fSets->addElement((int32_t)0, fDeferredStatus);
-}
-
-
-bool RegexPattern::initNamedCaptureMap() {
- if (fNamedCaptureMap) {
- return true;
- }
- fNamedCaptureMap = uhash_openSize(uhash_hashUnicodeString, // Key hash function
- uhash_compareUnicodeString, // Key comparator function
- uhash_compareLong, // Value comparator function
- 7, // Initial table capacity
- &fDeferredStatus);
- if (U_FAILURE(fDeferredStatus)) {
- return false;
- }
-
+}
+
+
+bool RegexPattern::initNamedCaptureMap() {
+ if (fNamedCaptureMap) {
+ return true;
+ }
+ fNamedCaptureMap = uhash_openSize(uhash_hashUnicodeString, // Key hash function
+ uhash_compareUnicodeString, // Key comparator function
+ uhash_compareLong, // Value comparator function
+ 7, // Initial table capacity
+ &fDeferredStatus);
+ if (U_FAILURE(fDeferredStatus)) {
+ return false;
+ }
+
// fNamedCaptureMap owns its key strings, type (UnicodeString *)
uhash_setKeyDeleter(fNamedCaptureMap, uprv_deleteUObject);
- return true;
+ return true;
}
//--------------------------------------------------------------------------
@@ -255,10 +255,10 @@ void RegexPattern::zap() {
delete fPatternString;
fPatternString = NULL;
}
- if (fNamedCaptureMap != NULL) {
- uhash_close(fNamedCaptureMap);
- fNamedCaptureMap = NULL;
- }
+ if (fNamedCaptureMap != NULL) {
+ uhash_close(fNamedCaptureMap);
+ fNamedCaptureMap = NULL;
+ }
}
@@ -629,7 +629,7 @@ int32_t RegexPattern::groupNumberFromName(const UnicodeString &groupName, UError
// No need to explicitly check for syntactically valid names.
// Invalid ones will never be in the map, and the lookup will fail.
- int32_t number = fNamedCaptureMap ? uhash_geti(fNamedCaptureMap, &groupName) : 0;
+ int32_t number = fNamedCaptureMap ? uhash_geti(fNamedCaptureMap, &groupName) : 0;
if (number == 0) {
status = U_REGEX_INVALID_CAPTURE_GROUP_NAME;
}
@@ -657,7 +657,7 @@ int32_t RegexPattern::split(const UnicodeString &input,
{
if (U_FAILURE(status)) {
return 0;
- }
+ }
RegexMatcher m(this);
int32_t r = 0;
@@ -678,7 +678,7 @@ int32_t RegexPattern::split(UText *input,
{
if (U_FAILURE(status)) {
return 0;
- }
+ }
RegexMatcher m(this);
int32_t r = 0;
@@ -801,8 +801,8 @@ void RegexPattern::dumpOp(int32_t index) const {
printf("NOT ");
val &= ~URX_NEG_SET;
}
- UnicodeSet &set = RegexStaticSets::gStaticSets->fPropSets[val];
- set.toPattern(s, TRUE);
+ UnicodeSet &set = RegexStaticSets::gStaticSets->fPropSets[val];
+ set.toPattern(s, TRUE);
printf("%s", CStr(s)());
}
break;
@@ -846,7 +846,7 @@ void RegexPattern::dumpPattern() const {
}
printf("Named Capture Groups:\n");
- if (!fNamedCaptureMap || uhash_count(fNamedCaptureMap) == 0) {
+ if (!fNamedCaptureMap || uhash_count(fNamedCaptureMap) == 0) {
printf(" None\n");
} else {
int32_t pos = UHASH_FIRST;
diff --git a/contrib/libs/icu/i18n/rulebasedcollator.cpp b/contrib/libs/icu/i18n/rulebasedcollator.cpp
index 23f9622c2d..60acf17815 100644
--- a/contrib/libs/icu/i18n/rulebasedcollator.cpp
+++ b/contrib/libs/icu/i18n/rulebasedcollator.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -220,7 +220,7 @@ RuleBasedCollator::adoptTailoring(CollationTailoring *t, UErrorCode &errorCode)
actualLocaleIsSameAsValid = FALSE;
}
-RuleBasedCollator *
+RuleBasedCollator *
RuleBasedCollator::clone() const {
return new RuleBasedCollator(*this);
}
@@ -764,9 +764,9 @@ RuleBasedCollator::internalCompareUTF8(const char *left, int32_t leftLength,
// Make sure both or neither strings have a known length.
// We do not optimize for mixed length/termination.
if(leftLength >= 0) {
- if(rightLength < 0) { rightLength = static_cast<int32_t>(uprv_strlen(right)); }
+ if(rightLength < 0) { rightLength = static_cast<int32_t>(uprv_strlen(right)); }
} else {
- if(rightLength >= 0) { leftLength = static_cast<int32_t>(uprv_strlen(left)); }
+ if(rightLength >= 0) { leftLength = static_cast<int32_t>(uprv_strlen(left)); }
}
return doCompare(reinterpret_cast<const uint8_t *>(left), leftLength,
reinterpret_cast<const uint8_t *>(right), rightLength, errorCode);
@@ -862,9 +862,9 @@ public:
} else {
str.setTo(text, (int32_t)(spanLimit - text));
{
- ReorderingBuffer r_buffer(nfcImpl, str);
- if(r_buffer.init(str.length(), errorCode)) {
- nfcImpl.makeFCD(spanLimit, textLimit, &r_buffer, errorCode);
+ ReorderingBuffer r_buffer(nfcImpl, str);
+ if(r_buffer.init(str.length(), errorCode)) {
+ nfcImpl.makeFCD(spanLimit, textLimit, &r_buffer, errorCode);
}
}
if(U_SUCCESS(errorCode)) {
@@ -1554,7 +1554,7 @@ RuleBasedCollator::internalGetShortDefinitionString(const char *locale,
"collation", locale,
NULL, &errorCode);
if(U_FAILURE(errorCode)) { return 0; }
- resultLocale[length] = 0;
+ resultLocale[length] = 0;
// Append items in alphabetic order of their short definition letters.
CharString result;
@@ -1581,11 +1581,11 @@ RuleBasedCollator::internalGetShortDefinitionString(const char *locale,
length = uloc_getKeywordValue(resultLocale, "collation", subtag, UPRV_LENGTHOF(subtag), &errorCode);
appendSubtag(result, 'K', subtag, length, errorCode);
length = uloc_getLanguage(resultLocale, subtag, UPRV_LENGTHOF(subtag), &errorCode);
- if (length == 0) {
- appendSubtag(result, 'L', "root", 4, errorCode);
- } else {
- appendSubtag(result, 'L', subtag, length, errorCode);
- }
+ if (length == 0) {
+ appendSubtag(result, 'L', "root", 4, errorCode);
+ } else {
+ appendSubtag(result, 'L', subtag, length, errorCode);
+ }
if(attributeHasBeenSetExplicitly(UCOL_NORMALIZATION_MODE)) {
appendAttribute(result, 'N', getAttribute(UCOL_NORMALIZATION_MODE, errorCode), errorCode);
}
diff --git a/contrib/libs/icu/i18n/scientificnumberformatter.cpp b/contrib/libs/icu/i18n/scientificnumberformatter.cpp
index a54dcb17f1..6c2cb3aeed 100644
--- a/contrib/libs/icu/i18n/scientificnumberformatter.cpp
+++ b/contrib/libs/icu/i18n/scientificnumberformatter.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -16,7 +16,7 @@
#include "unicode/utf16.h"
#include "unicode/uniset.h"
#include "unicode/decimfmt.h"
-#include "static_unicode_sets.h"
+#include "static_unicode_sets.h"
U_NAMESPACE_BEGIN
@@ -121,7 +121,7 @@ ScientificNumberFormatter *ScientificNumberFormatter::createInstance(
return result;
}
-ScientificNumberFormatter::SuperscriptStyle *ScientificNumberFormatter::SuperscriptStyle::clone() const {
+ScientificNumberFormatter::SuperscriptStyle *ScientificNumberFormatter::SuperscriptStyle::clone() const {
return new ScientificNumberFormatter::SuperscriptStyle(*this);
}
@@ -148,17 +148,17 @@ UnicodeString &ScientificNumberFormatter::SuperscriptStyle::format(
break;
case UNUM_EXPONENT_SIGN_FIELD:
{
- using namespace icu::numparse::impl;
+ using namespace icu::numparse::impl;
int32_t beginIndex = fp.getBeginIndex();
int32_t endIndex = fp.getEndIndex();
UChar32 aChar = original.char32At(beginIndex);
- if (unisets::get(unisets::MINUS_SIGN)->contains(aChar)) {
+ if (unisets::get(unisets::MINUS_SIGN)->contains(aChar)) {
appendTo.append(
original,
copyFromOffset,
beginIndex - copyFromOffset);
appendTo.append(kSuperscriptMinusSign);
- } else if (unisets::get(unisets::PLUS_SIGN)->contains(aChar)) {
+ } else if (unisets::get(unisets::PLUS_SIGN)->contains(aChar)) {
appendTo.append(
original,
copyFromOffset,
@@ -195,7 +195,7 @@ UnicodeString &ScientificNumberFormatter::SuperscriptStyle::format(
return appendTo;
}
-ScientificNumberFormatter::MarkupStyle *ScientificNumberFormatter::MarkupStyle::clone() const {
+ScientificNumberFormatter::MarkupStyle *ScientificNumberFormatter::MarkupStyle::clone() const {
return new ScientificNumberFormatter::MarkupStyle(*this);
}
@@ -242,7 +242,7 @@ ScientificNumberFormatter::ScientificNumberFormatter(
DecimalFormat *fmtToAdopt, Style *styleToAdopt, UErrorCode &status)
: fPreExponent(),
fDecimalFormat(fmtToAdopt),
- fStyle(styleToAdopt) {
+ fStyle(styleToAdopt) {
if (U_FAILURE(status)) {
return;
}
@@ -263,7 +263,7 @@ ScientificNumberFormatter::ScientificNumberFormatter(
: UObject(other),
fPreExponent(other.fPreExponent),
fDecimalFormat(NULL),
- fStyle(NULL) {
+ fStyle(NULL) {
fDecimalFormat = static_cast<DecimalFormat *>(
other.fDecimalFormat->clone());
fStyle = other.fStyle->clone();
diff --git a/contrib/libs/icu/i18n/scriptset.cpp b/contrib/libs/icu/i18n/scriptset.cpp
index 86f1563db1..18a3b263b7 100644
--- a/contrib/libs/icu/i18n/scriptset.cpp
+++ b/contrib/libs/icu/i18n/scriptset.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -29,7 +29,7 @@ U_NAMESPACE_BEGIN
//
//----------------------------------------------------------------------------
ScriptSet::ScriptSet() {
- uprv_memset(bits, 0, sizeof(bits));
+ uprv_memset(bits, 0, sizeof(bits));
}
ScriptSet::~ScriptSet() {
@@ -40,7 +40,7 @@ ScriptSet::ScriptSet(const ScriptSet &other) {
}
ScriptSet & ScriptSet::operator =(const ScriptSet &other) {
- uprv_memcpy(bits, other.bits, sizeof(bits));
+ uprv_memcpy(bits, other.bits, sizeof(bits));
return *this;
}
@@ -57,7 +57,7 @@ UBool ScriptSet::test(UScriptCode script, UErrorCode &status) const {
if (U_FAILURE(status)) {
return FALSE;
}
- if (script < 0 || (int32_t)script >= SCRIPT_LIMIT) {
+ if (script < 0 || (int32_t)script >= SCRIPT_LIMIT) {
status = U_ILLEGAL_ARGUMENT_ERROR;
return FALSE;
}
@@ -71,7 +71,7 @@ ScriptSet &ScriptSet::set(UScriptCode script, UErrorCode &status) {
if (U_FAILURE(status)) {
return *this;
}
- if (script < 0 || (int32_t)script >= SCRIPT_LIMIT) {
+ if (script < 0 || (int32_t)script >= SCRIPT_LIMIT) {
status = U_ILLEGAL_ARGUMENT_ERROR;
return *this;
}
@@ -85,7 +85,7 @@ ScriptSet &ScriptSet::reset(UScriptCode script, UErrorCode &status) {
if (U_FAILURE(status)) {
return *this;
}
- if (script < 0 || (int32_t)script >= SCRIPT_LIMIT) {
+ if (script < 0 || (int32_t)script >= SCRIPT_LIMIT) {
status = U_ILLEGAL_ARGUMENT_ERROR;
return *this;
}
@@ -119,7 +119,7 @@ ScriptSet &ScriptSet::intersect(UScriptCode script, UErrorCode &status) {
}
return *this;
}
-
+
UBool ScriptSet::intersects(const ScriptSet &other) const {
for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
if ((bits[i] & other.bits[i]) != 0) {
@@ -145,7 +145,7 @@ ScriptSet &ScriptSet::setAll() {
ScriptSet &ScriptSet::resetAll() {
- uprv_memset(bits, 0, sizeof(bits));
+ uprv_memset(bits, 0, sizeof(bits));
return *this;
}
@@ -177,7 +177,7 @@ int32_t ScriptSet::nextSetBit(int32_t fromIndex) const {
return -1;
}
UErrorCode status = U_ZERO_ERROR;
- for (int32_t scriptIndex = fromIndex; scriptIndex < SCRIPT_LIMIT; scriptIndex++) {
+ for (int32_t scriptIndex = fromIndex; scriptIndex < SCRIPT_LIMIT; scriptIndex++) {
if (test((UScriptCode)scriptIndex, status)) {
return scriptIndex;
}
@@ -243,14 +243,14 @@ ScriptSet &ScriptSet::parseScripts(const UnicodeString &scriptString, UErrorCode
void ScriptSet::setScriptExtensions(UChar32 codePoint, UErrorCode& status) {
if (U_FAILURE(status)) { return; }
- static const int32_t FIRST_GUESS_SCRIPT_CAPACITY = 20;
+ static const int32_t FIRST_GUESS_SCRIPT_CAPACITY = 20;
MaybeStackArray<UScriptCode,FIRST_GUESS_SCRIPT_CAPACITY> scripts;
UErrorCode internalStatus = U_ZERO_ERROR;
int32_t script_count = -1;
while (TRUE) {
script_count = uscript_getScriptExtensions(
- codePoint, scripts.getAlias(), scripts.getCapacity(), &internalStatus);
+ codePoint, scripts.getAlias(), scripts.getCapacity(), &internalStatus);
if (internalStatus == U_BUFFER_OVERFLOW_ERROR) {
// Need to allocate more space
if (scripts.resize(script_count) == NULL) {
@@ -290,7 +290,7 @@ uhash_compareScriptSet(UElement key0, UElement key1) {
icu::ScriptSet *s0 = static_cast<icu::ScriptSet *>(key0.pointer);
icu::ScriptSet *s1 = static_cast<icu::ScriptSet *>(key1.pointer);
int32_t diff = s0->countMembers() - s1->countMembers();
- if (diff != 0) return static_cast<UBool>(diff);
+ if (diff != 0) return static_cast<UBool>(diff);
int32_t i0 = s0->nextSetBit(0);
int32_t i1 = s1->nextSetBit(0);
while ((diff = i0-i1) == 0 && i0 > 0) {
diff --git a/contrib/libs/icu/i18n/scriptset.h b/contrib/libs/icu/i18n/scriptset.h
index 55019ff7e7..a41ab737a6 100644
--- a/contrib/libs/icu/i18n/scriptset.h
+++ b/contrib/libs/icu/i18n/scriptset.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -35,14 +35,14 @@ U_NAMESPACE_BEGIN
//-------------------------------------------------------------------------------
class U_I18N_API ScriptSet: public UMemory {
public:
- static constexpr int32_t SCRIPT_LIMIT = 224; // multiple of 32!
-
+ static constexpr int32_t SCRIPT_LIMIT = 224; // multiple of 32!
+
ScriptSet();
ScriptSet(const ScriptSet &other);
~ScriptSet();
UBool operator == (const ScriptSet &other) const;
- UBool operator != (const ScriptSet &other) const {return !(*this == other);}
+ UBool operator != (const ScriptSet &other) const {return !(*this == other);}
ScriptSet & operator = (const ScriptSet &other);
UBool test(UScriptCode script, UErrorCode &status) const;
@@ -69,7 +69,7 @@ class U_I18N_API ScriptSet: public UMemory {
void setScriptExtensions(UChar32 codePoint, UErrorCode& status);
private:
- uint32_t bits[SCRIPT_LIMIT / 32];
+ uint32_t bits[SCRIPT_LIMIT / 32];
};
U_NAMESPACE_END
diff --git a/contrib/libs/icu/i18n/search.cpp b/contrib/libs/icu/i18n/search.cpp
index 9da3509adb..f944b68455 100644
--- a/contrib/libs/icu/i18n/search.cpp
+++ b/contrib/libs/icu/i18n/search.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/selfmt.cpp b/contrib/libs/icu/i18n/selfmt.cpp
index 19c6ec6c06..47e53d75de 100644
--- a/contrib/libs/icu/i18n/selfmt.cpp
+++ b/contrib/libs/icu/i18n/selfmt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************
* COPYRIGHT:
@@ -151,7 +151,7 @@ int32_t SelectFormat::findSubMessage(const MessagePattern& pattern, int32_t part
return msgStart;
}
-SelectFormat* SelectFormat::clone() const
+SelectFormat* SelectFormat::clone() const
{
return new SelectFormat(*this);
}
diff --git a/contrib/libs/icu/i18n/selfmtimpl.h b/contrib/libs/icu/i18n/selfmtimpl.h
index fee4e80adc..a36d1a5c34 100644
--- a/contrib/libs/icu/i18n/selfmtimpl.h
+++ b/contrib/libs/icu/i18n/selfmtimpl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************
* COPYRIGHT:
diff --git a/contrib/libs/icu/i18n/sharedbreakiterator.cpp b/contrib/libs/icu/i18n/sharedbreakiterator.cpp
index e9d470218b..82f482bdd7 100644
--- a/contrib/libs/icu/i18n/sharedbreakiterator.cpp
+++ b/contrib/libs/icu/i18n/sharedbreakiterator.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/sharedbreakiterator.h b/contrib/libs/icu/i18n/sharedbreakiterator.h
index 1911da82d2..b6d67bc8e8 100644
--- a/contrib/libs/icu/i18n/sharedbreakiterator.h
+++ b/contrib/libs/icu/i18n/sharedbreakiterator.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/i18n/sharedcalendar.h b/contrib/libs/icu/i18n/sharedcalendar.h
index c0edb57dbf..1526f92e88 100644
--- a/contrib/libs/icu/i18n/sharedcalendar.h
+++ b/contrib/libs/icu/i18n/sharedcalendar.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/i18n/shareddateformatsymbols.h b/contrib/libs/icu/i18n/shareddateformatsymbols.h
index 9d314f46ea..66a06ecae5 100644
--- a/contrib/libs/icu/i18n/shareddateformatsymbols.h
+++ b/contrib/libs/icu/i18n/shareddateformatsymbols.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -12,9 +12,9 @@
#define __SHARED_DATEFORMATSYMBOLS_H__
#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
+
+#if !UCONFIG_NO_FORMATTING
+
#include "sharedobject.h"
#include "unicode/dtfmtsym.h"
@@ -36,6 +36,6 @@ private:
U_NAMESPACE_END
-#endif /* !UCONFIG_NO_FORMATTING */
-
+#endif /* !UCONFIG_NO_FORMATTING */
+
#endif
diff --git a/contrib/libs/icu/i18n/sharednumberformat.h b/contrib/libs/icu/i18n/sharednumberformat.h
index 7cc41a3320..a7e105b5ac 100644
--- a/contrib/libs/icu/i18n/sharednumberformat.h
+++ b/contrib/libs/icu/i18n/sharednumberformat.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/i18n/sharedpluralrules.h b/contrib/libs/icu/i18n/sharedpluralrules.h
index cdfd112be3..28d8b25c14 100644
--- a/contrib/libs/icu/i18n/sharedpluralrules.h
+++ b/contrib/libs/icu/i18n/sharedpluralrules.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/i18n/simpletz.cpp b/contrib/libs/icu/i18n/simpletz.cpp
index 277a70e583..7972e2bb04 100644
--- a/contrib/libs/icu/i18n/simpletz.cpp
+++ b/contrib/libs/icu/i18n/simpletz.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -33,7 +33,7 @@
#include "unicode/gregocal.h"
#include "unicode/smpdtfmt.h"
-#include "cmemory.h"
+#include "cmemory.h"
#include "gregoimp.h"
#include "umutex.h"
@@ -178,7 +178,7 @@ void SimpleTimeZone::construct(int32_t rawOffsetGMT,
decodeRules(status);
- if (savingsDST == 0) {
+ if (savingsDST == 0) {
status = U_ILLEGAL_ARGUMENT_ERROR;
}
}
@@ -243,7 +243,7 @@ SimpleTimeZone::operator==(const TimeZone& that) const
// -------------------------------------
// Called by TimeZone::createDefault() inside a Mutex - be careful.
-SimpleTimeZone*
+SimpleTimeZone*
SimpleTimeZone::clone() const
{
return new SimpleTimeZone(*this);
@@ -687,7 +687,7 @@ SimpleTimeZone::setRawOffset(int32_t offsetMillis)
void
SimpleTimeZone::setDSTSavings(int32_t millisSavedDuringDST, UErrorCode& status)
{
- if (millisSavedDuringDST == 0) {
+ if (millisSavedDuringDST == 0) {
status = U_ILLEGAL_ARGUMENT_ERROR;
}
else {
@@ -1084,7 +1084,7 @@ SimpleTimeZone::checkTransitionRules(UErrorCode& status) const {
if (U_FAILURE(status)) {
return;
}
- static UMutex gLock;
+ static UMutex gLock;
umtx_lock(&gLock);
if (!transitionRulesInitialized) {
SimpleTimeZone *ncThis = const_cast<SimpleTimeZone*>(this);
@@ -1190,22 +1190,22 @@ SimpleTimeZone::initTransitionRules(UErrorCode& status) {
// Create a TimeZoneRule for initial time
if (firstStdStart < firstDstStart) {
initialRule = new InitialTimeZoneRule(tzid+UnicodeString(DST_STR), getRawOffset(), dstRule->getDSTSavings());
- if (initialRule == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
- deleteTransitionRules();
- return;
- }
+ if (initialRule == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ deleteTransitionRules();
+ return;
+ }
firstTransition = new TimeZoneTransition(firstStdStart, *initialRule, *stdRule);
} else {
initialRule = new InitialTimeZoneRule(tzid+UnicodeString(STD_STR), getRawOffset(), 0);
- if (initialRule == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
- deleteTransitionRules();
- return;
- }
+ if (initialRule == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ deleteTransitionRules();
+ return;
+ }
firstTransition = new TimeZoneTransition(firstDstStart, *initialRule, *dstRule);
}
- if (firstTransition == NULL) {
+ if (firstTransition == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
deleteTransitionRules();
return;
diff --git a/contrib/libs/icu/i18n/smpdtfmt.cpp b/contrib/libs/icu/i18n/smpdtfmt.cpp
index 7f5d4777a6..d704642b05 100644
--- a/contrib/libs/icu/i18n/smpdtfmt.cpp
+++ b/contrib/libs/icu/i18n/smpdtfmt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -48,12 +48,12 @@
#include "unicode/simpletz.h"
#include "unicode/rbtz.h"
#include "unicode/tzfmt.h"
-#include "unicode/ucasemap.h"
+#include "unicode/ucasemap.h"
#include "unicode/utf16.h"
#include "unicode/vtzone.h"
#include "unicode/udisplaycontext.h"
#include "unicode/brkiter.h"
-#include "unicode/rbnf.h"
+#include "unicode/rbnf.h"
#include "uresimp.h"
#include "olsontz.h"
#include "patternprops.h"
@@ -66,14 +66,14 @@
#include <float.h>
#include "smpdtfst.h"
#include "sharednumberformat.h"
-#include "ucasemap_imp.h"
+#include "ucasemap_imp.h"
#include "ustr_imp.h"
#include "charstr.h"
#include "uvector.h"
#include "cstr.h"
#include "dayperiodrules.h"
-#include "tznames_impl.h" // ZONE_NAME_U16_MAX
-#include "number_utypes.h"
+#include "tznames_impl.h" // ZONE_NAME_U16_MAX
+#include "number_utypes.h"
#if defined( U_DEBUG_CALSVC ) || defined (U_DEBUG_CAL)
#include <stdio.h>
@@ -230,7 +230,7 @@ static const int32_t gFieldRangeBias[] = {
static const int32_t HEBREW_CAL_CUR_MILLENIUM_START_YEAR = 5000;
static const int32_t HEBREW_CAL_CUR_MILLENIUM_END_YEAR = 6000;
-static UMutex LOCK;
+static UMutex LOCK;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SimpleDateFormat)
@@ -244,9 +244,9 @@ SimpleDateFormat::NSOverride::~NSOverride() {
void SimpleDateFormat::NSOverride::free() {
NSOverride *cur = this;
while (cur) {
- NSOverride *next_temp = cur->next;
+ NSOverride *next_temp = cur->next;
delete cur;
- cur = next_temp;
+ cur = next_temp;
}
}
@@ -325,7 +325,7 @@ SimpleDateFormat::~SimpleDateFormat()
if (fTimeZoneFormat) {
delete fTimeZoneFormat;
}
- freeFastNumberFormatters();
+ freeFastNumberFormatters();
#if !UCONFIG_NO_BREAK_ITERATION
delete fCapitalizationBrkIter;
@@ -583,14 +583,14 @@ SimpleDateFormat& SimpleDateFormat::operator=(const SimpleDateFormat& other)
fHasMinute = other.fHasMinute;
fHasSecond = other.fHasSecond;
- fLocale = other.fLocale;
-
- // TimeZoneFormat can now be set independently via setter.
- // If it is NULL, it will be lazily initialized from locale
- delete fTimeZoneFormat;
- fTimeZoneFormat = NULL;
- if (other.fTimeZoneFormat) {
- fTimeZoneFormat = new TimeZoneFormat(*other.fTimeZoneFormat);
+ fLocale = other.fLocale;
+
+ // TimeZoneFormat can now be set independently via setter.
+ // If it is NULL, it will be lazily initialized from locale
+ delete fTimeZoneFormat;
+ fTimeZoneFormat = NULL;
+ if (other.fTimeZoneFormat) {
+ fTimeZoneFormat = new TimeZoneFormat(*other.fTimeZoneFormat);
}
#if !UCONFIG_NO_BREAK_ITERATION
@@ -614,16 +614,16 @@ SimpleDateFormat& SimpleDateFormat::operator=(const SimpleDateFormat& other)
}
}
- UErrorCode localStatus = U_ZERO_ERROR;
- freeFastNumberFormatters();
- initFastNumberFormatters(localStatus);
-
+ UErrorCode localStatus = U_ZERO_ERROR;
+ freeFastNumberFormatters();
+ initFastNumberFormatters(localStatus);
+
return *this;
}
//----------------------------------------------------------------------
-SimpleDateFormat*
+SimpleDateFormat*
SimpleDateFormat::clone() const
{
return new SimpleDateFormat(*this);
@@ -859,17 +859,17 @@ SimpleDateFormat::initialize(const Locale& locale,
{
if (U_FAILURE(status)) return;
- parsePattern(); // Need this before initNumberFormatters(), to set fHasHanYearChar
-
- // Simple-minded hack to force Gannen year numbering for ja@calendar=japanese
- // if format is non-numeric (includes 年) and fDateOverride is not already specified.
- // Now this does get updated if applyPattern subsequently changes the pattern type.
- if (fDateOverride.isBogus() && fHasHanYearChar &&
- fCalendar != nullptr && uprv_strcmp(fCalendar->getType(),"japanese") == 0 &&
- uprv_strcmp(fLocale.getLanguage(),"ja") == 0) {
- fDateOverride.setTo(u"y=jpanyear", -1);
- }
-
+ parsePattern(); // Need this before initNumberFormatters(), to set fHasHanYearChar
+
+ // Simple-minded hack to force Gannen year numbering for ja@calendar=japanese
+ // if format is non-numeric (includes 年) and fDateOverride is not already specified.
+ // Now this does get updated if applyPattern subsequently changes the pattern type.
+ if (fDateOverride.isBogus() && fHasHanYearChar &&
+ fCalendar != nullptr && uprv_strcmp(fCalendar->getType(),"japanese") == 0 &&
+ uprv_strcmp(fLocale.getLanguage(),"ja") == 0) {
+ fDateOverride.setTo(u"y=jpanyear", -1);
+ }
+
// We don't need to check that the row count is >= 1, since all 2d arrays have at
// least one row
fNumberFormat = NumberFormat::createInstance(locale, status);
@@ -878,8 +878,8 @@ SimpleDateFormat::initialize(const Locale& locale,
fixNumberFormatForDates(*fNumberFormat);
//fNumberFormat->setLenient(TRUE); // Java uses a custom DateNumberFormat to format/parse
- initNumberFormatters(locale, status);
- initFastNumberFormatters(status);
+ initNumberFormatters(locale, status);
+ initFastNumberFormatters(status);
}
else if (U_SUCCESS(status))
@@ -999,8 +999,8 @@ SimpleDateFormat::_format(Calendar& cal, UnicodeString& appendTo,
// Use subFormat() to format a repeated pattern character
// when a different pattern or non-pattern character is seen
if (ch != prevCh && count > 0) {
- subFormat(appendTo, prevCh, count, capitalizationContext, fieldNum++,
- prevCh, handler, *workCal, status);
+ subFormat(appendTo, prevCh, count, capitalizationContext, fieldNum++,
+ prevCh, handler, *workCal, status);
count = 0;
}
if (ch == QUOTE) {
@@ -1027,8 +1027,8 @@ SimpleDateFormat::_format(Calendar& cal, UnicodeString& appendTo,
// Format the last item in the pattern, if any
if (count > 0) {
- subFormat(appendTo, prevCh, count, capitalizationContext, fieldNum++,
- prevCh, handler, *workCal, status);
+ subFormat(appendTo, prevCh, count, capitalizationContext, fieldNum++,
+ prevCh, handler, *workCal, status);
}
if (calClone != NULL) {
@@ -1223,47 +1223,47 @@ _appendSymbolWithMonthPattern(UnicodeString& dst, int32_t value, const UnicodeSt
}
//----------------------------------------------------------------------
-
-static number::LocalizedNumberFormatter*
-createFastFormatter(const DecimalFormat* df, int32_t minInt, int32_t maxInt, UErrorCode& status) {
- const number::LocalizedNumberFormatter* lnfBase = df->toNumberFormatter(status);
- if (U_FAILURE(status)) {
- return nullptr;
- }
- return lnfBase->integerWidth(
- number::IntegerWidth::zeroFillTo(minInt).truncateAt(maxInt)
- ).clone().orphan();
-}
-
-void SimpleDateFormat::initFastNumberFormatters(UErrorCode& status) {
- if (U_FAILURE(status)) {
- return;
- }
- auto* df = dynamic_cast<const DecimalFormat*>(fNumberFormat);
- if (df == nullptr) {
- return;
- }
- fFastNumberFormatters[SMPDTFMT_NF_1x10] = createFastFormatter(df, 1, 10, status);
- fFastNumberFormatters[SMPDTFMT_NF_2x10] = createFastFormatter(df, 2, 10, status);
- fFastNumberFormatters[SMPDTFMT_NF_3x10] = createFastFormatter(df, 3, 10, status);
- fFastNumberFormatters[SMPDTFMT_NF_4x10] = createFastFormatter(df, 4, 10, status);
- fFastNumberFormatters[SMPDTFMT_NF_2x2] = createFastFormatter(df, 2, 2, status);
-}
-
-void SimpleDateFormat::freeFastNumberFormatters() {
- delete fFastNumberFormatters[SMPDTFMT_NF_1x10];
- delete fFastNumberFormatters[SMPDTFMT_NF_2x10];
- delete fFastNumberFormatters[SMPDTFMT_NF_3x10];
- delete fFastNumberFormatters[SMPDTFMT_NF_4x10];
- delete fFastNumberFormatters[SMPDTFMT_NF_2x2];
- fFastNumberFormatters[SMPDTFMT_NF_1x10] = nullptr;
- fFastNumberFormatters[SMPDTFMT_NF_2x10] = nullptr;
- fFastNumberFormatters[SMPDTFMT_NF_3x10] = nullptr;
- fFastNumberFormatters[SMPDTFMT_NF_4x10] = nullptr;
- fFastNumberFormatters[SMPDTFMT_NF_2x2] = nullptr;
-}
-
-
+
+static number::LocalizedNumberFormatter*
+createFastFormatter(const DecimalFormat* df, int32_t minInt, int32_t maxInt, UErrorCode& status) {
+ const number::LocalizedNumberFormatter* lnfBase = df->toNumberFormatter(status);
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ return lnfBase->integerWidth(
+ number::IntegerWidth::zeroFillTo(minInt).truncateAt(maxInt)
+ ).clone().orphan();
+}
+
+void SimpleDateFormat::initFastNumberFormatters(UErrorCode& status) {
+ if (U_FAILURE(status)) {
+ return;
+ }
+ auto* df = dynamic_cast<const DecimalFormat*>(fNumberFormat);
+ if (df == nullptr) {
+ return;
+ }
+ fFastNumberFormatters[SMPDTFMT_NF_1x10] = createFastFormatter(df, 1, 10, status);
+ fFastNumberFormatters[SMPDTFMT_NF_2x10] = createFastFormatter(df, 2, 10, status);
+ fFastNumberFormatters[SMPDTFMT_NF_3x10] = createFastFormatter(df, 3, 10, status);
+ fFastNumberFormatters[SMPDTFMT_NF_4x10] = createFastFormatter(df, 4, 10, status);
+ fFastNumberFormatters[SMPDTFMT_NF_2x2] = createFastFormatter(df, 2, 2, status);
+}
+
+void SimpleDateFormat::freeFastNumberFormatters() {
+ delete fFastNumberFormatters[SMPDTFMT_NF_1x10];
+ delete fFastNumberFormatters[SMPDTFMT_NF_2x10];
+ delete fFastNumberFormatters[SMPDTFMT_NF_3x10];
+ delete fFastNumberFormatters[SMPDTFMT_NF_4x10];
+ delete fFastNumberFormatters[SMPDTFMT_NF_2x2];
+ fFastNumberFormatters[SMPDTFMT_NF_1x10] = nullptr;
+ fFastNumberFormatters[SMPDTFMT_NF_2x10] = nullptr;
+ fFastNumberFormatters[SMPDTFMT_NF_3x10] = nullptr;
+ fFastNumberFormatters[SMPDTFMT_NF_4x10] = nullptr;
+ fFastNumberFormatters[SMPDTFMT_NF_2x2] = nullptr;
+}
+
+
void
SimpleDateFormat::initNumberFormatters(const Locale &locale,UErrorCode &status) {
if (U_FAILURE(status)) {
@@ -1322,15 +1322,15 @@ SimpleDateFormat::processOverrideString(const Locale &locale, const UnicodeStrin
int32_t nsNameHash = nsName.hashCode();
// See if the numbering system is in the override list, if not, then add it.
- NSOverride *curr = overrideList;
+ NSOverride *curr = overrideList;
const SharedNumberFormat *snf = NULL;
UBool found = FALSE;
- while ( curr && !found ) {
- if ( curr->hash == nsNameHash ) {
- snf = curr->snf;
+ while ( curr && !found ) {
+ if ( curr->hash == nsNameHash ) {
+ snf = curr->snf;
found = TRUE;
}
- curr = curr->next;
+ curr = curr->next;
}
if (!found) {
@@ -1407,11 +1407,11 @@ SimpleDateFormat::processOverrideString(const Locale &locale, const UnicodeStrin
//---------------------------------------------------------------------
void
SimpleDateFormat::subFormat(UnicodeString &appendTo,
- char16_t ch,
+ char16_t ch,
int32_t count,
UDisplayContext capitalizationContext,
int32_t fieldNum,
- char16_t fieldToOutput,
+ char16_t fieldToOutput,
FieldPositionHandler& handler,
Calendar& cal,
UErrorCode& status) const
@@ -1426,7 +1426,7 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
UDateFormatField patternCharIndex = DateFormatSymbols::getPatternCharIndex(ch);
const int32_t maxIntCount = 10;
int32_t beginOffset = appendTo.length();
- const NumberFormat *currentNumberFormat;
+ const NumberFormat *currentNumberFormat;
DateFormatSymbols::ECapitalizationContextUsageType capContextUsageType = DateFormatSymbols::kCapContextUsageOther;
UBool isHebrewCalendar = (uprv_strcmp(cal.getType(),"hebrew") == 0);
@@ -1451,9 +1451,9 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
return;
}
- currentNumberFormat = getNumberFormatByIndex(patternCharIndex);
+ currentNumberFormat = getNumberFormatByIndex(patternCharIndex);
if (currentNumberFormat == NULL) {
- status = U_INTERNAL_PROGRAM_ERROR;
+ status = U_INTERNAL_PROGRAM_ERROR;
return;
}
UnicodeString hebr("hebr", 4, US_INV);
@@ -1573,15 +1573,15 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
case UDAT_FRACTIONAL_SECOND_FIELD:
// Fractional seconds left-justify
{
- int32_t minDigits = (count > 3) ? 3 : count;
+ int32_t minDigits = (count > 3) ? 3 : count;
if (count == 1) {
value /= 100;
} else if (count == 2) {
value /= 10;
}
- zeroPaddingNumber(currentNumberFormat, appendTo, value, minDigits, maxIntCount);
+ zeroPaddingNumber(currentNumberFormat, appendTo, value, minDigits, maxIntCount);
if (count > 3) {
- zeroPaddingNumber(currentNumberFormat, appendTo, 0, count - 3, maxIntCount);
+ zeroPaddingNumber(currentNumberFormat, appendTo, 0, count - 3, maxIntCount);
}
}
break;
@@ -1695,109 +1695,109 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
case UDAT_TIMEZONE_ISO_FIELD: // 'X'
case UDAT_TIMEZONE_ISO_LOCAL_FIELD: // 'x'
{
- UChar zsbuf[ZONE_NAME_U16_MAX];
+ UChar zsbuf[ZONE_NAME_U16_MAX];
UnicodeString zoneString(zsbuf, 0, UPRV_LENGTHOF(zsbuf));
const TimeZone& tz = cal.getTimeZone();
UDate date = cal.getTime(status);
- const TimeZoneFormat *tzfmt = tzFormat(status);
+ const TimeZoneFormat *tzfmt = tzFormat(status);
if (U_SUCCESS(status)) {
if (patternCharIndex == UDAT_TIMEZONE_FIELD) {
if (count < 4) {
// "z", "zz", "zzz"
- tzfmt->format(UTZFMT_STYLE_SPECIFIC_SHORT, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_SPECIFIC_SHORT, tz, date, zoneString);
capContextUsageType = DateFormatSymbols::kCapContextUsageMetazoneShort;
} else {
// "zzzz" or longer
- tzfmt->format(UTZFMT_STYLE_SPECIFIC_LONG, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_SPECIFIC_LONG, tz, date, zoneString);
capContextUsageType = DateFormatSymbols::kCapContextUsageMetazoneLong;
}
}
else if (patternCharIndex == UDAT_TIMEZONE_RFC_FIELD) {
if (count < 4) {
// "Z"
- tzfmt->format(UTZFMT_STYLE_ISO_BASIC_LOCAL_FULL, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_ISO_BASIC_LOCAL_FULL, tz, date, zoneString);
} else if (count == 5) {
// "ZZZZZ"
- tzfmt->format(UTZFMT_STYLE_ISO_EXTENDED_FULL, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_ISO_EXTENDED_FULL, tz, date, zoneString);
} else {
// "ZZ", "ZZZ", "ZZZZ"
- tzfmt->format(UTZFMT_STYLE_LOCALIZED_GMT, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_LOCALIZED_GMT, tz, date, zoneString);
}
}
else if (patternCharIndex == UDAT_TIMEZONE_GENERIC_FIELD) {
if (count == 1) {
// "v"
- tzfmt->format(UTZFMT_STYLE_GENERIC_SHORT, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_GENERIC_SHORT, tz, date, zoneString);
capContextUsageType = DateFormatSymbols::kCapContextUsageMetazoneShort;
} else if (count == 4) {
// "vvvv"
- tzfmt->format(UTZFMT_STYLE_GENERIC_LONG, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_GENERIC_LONG, tz, date, zoneString);
capContextUsageType = DateFormatSymbols::kCapContextUsageMetazoneLong;
}
}
else if (patternCharIndex == UDAT_TIMEZONE_SPECIAL_FIELD) {
if (count == 1) {
// "V"
- tzfmt->format(UTZFMT_STYLE_ZONE_ID_SHORT, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_ZONE_ID_SHORT, tz, date, zoneString);
} else if (count == 2) {
// "VV"
- tzfmt->format(UTZFMT_STYLE_ZONE_ID, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_ZONE_ID, tz, date, zoneString);
} else if (count == 3) {
// "VVV"
- tzfmt->format(UTZFMT_STYLE_EXEMPLAR_LOCATION, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_EXEMPLAR_LOCATION, tz, date, zoneString);
} else if (count == 4) {
// "VVVV"
- tzfmt->format(UTZFMT_STYLE_GENERIC_LOCATION, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_GENERIC_LOCATION, tz, date, zoneString);
capContextUsageType = DateFormatSymbols::kCapContextUsageZoneLong;
}
}
else if (patternCharIndex == UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD) {
if (count == 1) {
// "O"
- tzfmt->format(UTZFMT_STYLE_LOCALIZED_GMT_SHORT, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_LOCALIZED_GMT_SHORT, tz, date, zoneString);
} else if (count == 4) {
// "OOOO"
- tzfmt->format(UTZFMT_STYLE_LOCALIZED_GMT, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_LOCALIZED_GMT, tz, date, zoneString);
}
}
else if (patternCharIndex == UDAT_TIMEZONE_ISO_FIELD) {
if (count == 1) {
// "X"
- tzfmt->format(UTZFMT_STYLE_ISO_BASIC_SHORT, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_ISO_BASIC_SHORT, tz, date, zoneString);
} else if (count == 2) {
// "XX"
- tzfmt->format(UTZFMT_STYLE_ISO_BASIC_FIXED, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_ISO_BASIC_FIXED, tz, date, zoneString);
} else if (count == 3) {
// "XXX"
- tzfmt->format(UTZFMT_STYLE_ISO_EXTENDED_FIXED, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_ISO_EXTENDED_FIXED, tz, date, zoneString);
} else if (count == 4) {
// "XXXX"
- tzfmt->format(UTZFMT_STYLE_ISO_BASIC_FULL, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_ISO_BASIC_FULL, tz, date, zoneString);
} else if (count == 5) {
// "XXXXX"
- tzfmt->format(UTZFMT_STYLE_ISO_EXTENDED_FULL, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_ISO_EXTENDED_FULL, tz, date, zoneString);
}
}
else if (patternCharIndex == UDAT_TIMEZONE_ISO_LOCAL_FIELD) {
if (count == 1) {
// "x"
- tzfmt->format(UTZFMT_STYLE_ISO_BASIC_LOCAL_SHORT, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_ISO_BASIC_LOCAL_SHORT, tz, date, zoneString);
} else if (count == 2) {
// "xx"
- tzfmt->format(UTZFMT_STYLE_ISO_BASIC_LOCAL_FIXED, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_ISO_BASIC_LOCAL_FIXED, tz, date, zoneString);
} else if (count == 3) {
// "xxx"
- tzfmt->format(UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FIXED, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FIXED, tz, date, zoneString);
} else if (count == 4) {
// "xxxx"
- tzfmt->format(UTZFMT_STYLE_ISO_BASIC_LOCAL_FULL, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_ISO_BASIC_LOCAL_FULL, tz, date, zoneString);
} else if (count == 5) {
// "xxxxx"
- tzfmt->format(UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FULL, tz, date, zoneString);
+ tzfmt->format(UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FULL, tz, date, zoneString);
}
}
else {
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
}
appendTo += zoneString;
@@ -1843,14 +1843,14 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
// Stealing am/pm value to use as our array index.
// It works out: am/midnight are both 0, pm/noon are both 1,
// 12 am is 12 midnight, and 12 pm is 12 noon.
- int32_t val = cal.get(UCAL_AM_PM, status);
+ int32_t val = cal.get(UCAL_AM_PM, status);
if (count <= 3) {
- toAppend = &fSymbols->fAbbreviatedDayPeriods[val];
+ toAppend = &fSymbols->fAbbreviatedDayPeriods[val];
} else if (count == 4 || count > 5) {
- toAppend = &fSymbols->fWideDayPeriods[val];
+ toAppend = &fSymbols->fWideDayPeriods[val];
} else { // count == 5
- toAppend = &fSymbols->fNarrowDayPeriods[val];
+ toAppend = &fSymbols->fNarrowDayPeriods[val];
}
}
@@ -1859,11 +1859,11 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
// In either case, fall back to am/pm.
if (toAppend == NULL || toAppend->isBogus()) {
// Reformat with identical arguments except ch, now changed to 'a'.
- // We are passing a different fieldToOutput because we want to add
- // 'b' to field position. This makes this fallback stable when
- // there is a data change on locales.
- subFormat(appendTo, u'a', count, capitalizationContext, fieldNum, u'b', handler, cal, status);
- return;
+ // We are passing a different fieldToOutput because we want to add
+ // 'b' to field position. This makes this fallback stable when
+ // there is a data change on locales.
+ subFormat(appendTo, u'a', count, capitalizationContext, fieldNum, u'b', handler, cal, status);
+ return;
} else {
appendTo += *toAppend;
}
@@ -1883,11 +1883,11 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
if (ruleSet == NULL) {
// Data doesn't exist for the locale we're looking for.
// Falling back to am/pm.
- // We are passing a different fieldToOutput because we want to add
- // 'B' to field position. This makes this fallback stable when
- // there is a data change on locales.
- subFormat(appendTo, u'a', count, capitalizationContext, fieldNum, u'B', handler, cal, status);
- return;
+ // We are passing a different fieldToOutput because we want to add
+ // 'B' to field position. This makes this fallback stable when
+ // there is a data change on locales.
+ subFormat(appendTo, u'a', count, capitalizationContext, fieldNum, u'B', handler, cal, status);
+ return;
}
// Get current display time.
@@ -1956,11 +1956,11 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
if (periodType == DayPeriodRules::DAYPERIOD_AM ||
periodType == DayPeriodRules::DAYPERIOD_PM ||
toAppend->isBogus()) {
- // We are passing a different fieldToOutput because we want to add
- // 'B' to field position iterator. This makes this fallback stable when
- // there is a data change on locales.
- subFormat(appendTo, u'a', count, capitalizationContext, fieldNum, u'B', handler, cal, status);
- return;
+ // We are passing a different fieldToOutput because we want to add
+ // 'B' to field position iterator. This makes this fallback stable when
+ // there is a data change on locales.
+ subFormat(appendTo, u'a', count, capitalizationContext, fieldNum, u'B', handler, cal, status);
+ return;
}
else {
appendTo += *toAppend;
@@ -1977,8 +1977,8 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
}
#if !UCONFIG_NO_BREAK_ITERATION
// if first field, check to see whether we need to and are able to titlecase it
- if (fieldNum == 0 && fCapitalizationBrkIter != NULL && appendTo.length() > beginOffset &&
- u_islower(appendTo.char32At(beginOffset))) {
+ if (fieldNum == 0 && fCapitalizationBrkIter != NULL && appendTo.length() > beginOffset &&
+ u_islower(appendTo.char32At(beginOffset))) {
UBool titlecase = FALSE;
switch (capitalizationContext) {
case UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE:
@@ -1995,16 +1995,16 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
break;
}
if (titlecase) {
- BreakIterator* const mutableCapitalizationBrkIter = fCapitalizationBrkIter->clone();
+ BreakIterator* const mutableCapitalizationBrkIter = fCapitalizationBrkIter->clone();
UnicodeString firstField(appendTo, beginOffset);
- firstField.toTitle(mutableCapitalizationBrkIter, fLocale, U_TITLECASE_NO_LOWERCASE | U_TITLECASE_NO_BREAK_ADJUSTMENT);
+ firstField.toTitle(mutableCapitalizationBrkIter, fLocale, U_TITLECASE_NO_LOWERCASE | U_TITLECASE_NO_BREAK_ADJUSTMENT);
appendTo.replaceBetween(beginOffset, appendTo.length(), firstField);
- delete mutableCapitalizationBrkIter;
+ delete mutableCapitalizationBrkIter;
}
}
#endif
- handler.addAttribute(DateFormatSymbols::getPatternCharIndex(fieldToOutput), beginOffset, appendTo.length());
+ handler.addAttribute(DateFormatSymbols::getPatternCharIndex(fieldToOutput), beginOffset, appendTo.length());
}
//----------------------------------------------------------------------
@@ -2020,11 +2020,11 @@ void SimpleDateFormat::adoptNumberFormat(NumberFormat *formatToAdopt) {
freeSharedNumberFormatters(fSharedNumberFormatters);
fSharedNumberFormatters = NULL;
}
-
- // Also re-compute the fast formatters.
- UErrorCode localStatus = U_ZERO_ERROR;
- freeFastNumberFormatters();
- initFastNumberFormatters(localStatus);
+
+ // Also re-compute the fast formatters.
+ UErrorCode localStatus = U_ZERO_ERROR;
+ freeFastNumberFormatters();
+ initFastNumberFormatters(localStatus);
}
void SimpleDateFormat::adoptNumberFormat(const UnicodeString& fields, NumberFormat *formatToAdopt, UErrorCode &status){
@@ -2076,58 +2076,58 @@ SimpleDateFormat::getNumberFormatForField(UChar field) const {
//----------------------------------------------------------------------
void
SimpleDateFormat::zeroPaddingNumber(
- const NumberFormat *currentNumberFormat,
+ const NumberFormat *currentNumberFormat,
UnicodeString &appendTo,
int32_t value, int32_t minDigits, int32_t maxDigits) const
{
- const number::LocalizedNumberFormatter* fastFormatter = nullptr;
- // NOTE: This uses the heuristic that these five min/max int settings account for the vast majority
- // of SimpleDateFormat number formatting cases at the time of writing (ICU 62).
- if (currentNumberFormat == fNumberFormat) {
- if (maxDigits == 10) {
- if (minDigits == 1) {
- fastFormatter = fFastNumberFormatters[SMPDTFMT_NF_1x10];
- } else if (minDigits == 2) {
- fastFormatter = fFastNumberFormatters[SMPDTFMT_NF_2x10];
- } else if (minDigits == 3) {
- fastFormatter = fFastNumberFormatters[SMPDTFMT_NF_3x10];
- } else if (minDigits == 4) {
- fastFormatter = fFastNumberFormatters[SMPDTFMT_NF_4x10];
- }
- } else if (maxDigits == 2) {
- if (minDigits == 2) {
- fastFormatter = fFastNumberFormatters[SMPDTFMT_NF_2x2];
- }
- }
- }
- if (fastFormatter != nullptr) {
- // Can use fast path
- number::impl::UFormattedNumberData result;
- result.quantity.setToInt(value);
- UErrorCode localStatus = U_ZERO_ERROR;
- fastFormatter->formatImpl(&result, localStatus);
- if (U_FAILURE(localStatus)) {
- return;
- }
- appendTo.append(result.getStringRef().toTempUnicodeString());
- return;
- }
-
- // Check for RBNF (no clone necessary)
- auto* rbnf = dynamic_cast<const RuleBasedNumberFormat*>(currentNumberFormat);
- if (rbnf != nullptr) {
+ const number::LocalizedNumberFormatter* fastFormatter = nullptr;
+ // NOTE: This uses the heuristic that these five min/max int settings account for the vast majority
+ // of SimpleDateFormat number formatting cases at the time of writing (ICU 62).
+ if (currentNumberFormat == fNumberFormat) {
+ if (maxDigits == 10) {
+ if (minDigits == 1) {
+ fastFormatter = fFastNumberFormatters[SMPDTFMT_NF_1x10];
+ } else if (minDigits == 2) {
+ fastFormatter = fFastNumberFormatters[SMPDTFMT_NF_2x10];
+ } else if (minDigits == 3) {
+ fastFormatter = fFastNumberFormatters[SMPDTFMT_NF_3x10];
+ } else if (minDigits == 4) {
+ fastFormatter = fFastNumberFormatters[SMPDTFMT_NF_4x10];
+ }
+ } else if (maxDigits == 2) {
+ if (minDigits == 2) {
+ fastFormatter = fFastNumberFormatters[SMPDTFMT_NF_2x2];
+ }
+ }
+ }
+ if (fastFormatter != nullptr) {
+ // Can use fast path
+ number::impl::UFormattedNumberData result;
+ result.quantity.setToInt(value);
+ UErrorCode localStatus = U_ZERO_ERROR;
+ fastFormatter->formatImpl(&result, localStatus);
+ if (U_FAILURE(localStatus)) {
+ return;
+ }
+ appendTo.append(result.getStringRef().toTempUnicodeString());
+ return;
+ }
+
+ // Check for RBNF (no clone necessary)
+ auto* rbnf = dynamic_cast<const RuleBasedNumberFormat*>(currentNumberFormat);
+ if (rbnf != nullptr) {
+ FieldPosition pos(FieldPosition::DONT_CARE);
+ rbnf->format(value, appendTo, pos); // 3rd arg is there to speed up processing
+ return;
+ }
+
+ // Fall back to slow path (clone and mutate the NumberFormat)
+ if (currentNumberFormat != nullptr) {
FieldPosition pos(FieldPosition::DONT_CARE);
- rbnf->format(value, appendTo, pos); // 3rd arg is there to speed up processing
- return;
- }
-
- // Fall back to slow path (clone and mutate the NumberFormat)
- if (currentNumberFormat != nullptr) {
- FieldPosition pos(FieldPosition::DONT_CARE);
- LocalPointer<NumberFormat> nf(currentNumberFormat->clone());
- nf->setMinimumIntegerDigits(minDigits);
- nf->setMaximumIntegerDigits(maxDigits);
- nf->format(value, appendTo, pos); // 3rd arg is there to speed up processing
+ LocalPointer<NumberFormat> nf(currentNumberFormat->clone());
+ nf->setMinimumIntegerDigits(minDigits);
+ nf->setMaximumIntegerDigits(maxDigits);
+ nf->format(value, appendTo, pos); // 3rd arg is there to speed up processing
}
}
@@ -2287,7 +2287,7 @@ SimpleDateFormat::parse(const UnicodeString& text, Calendar& cal, ParsePosition&
}
pos = subParse(text, pos, ch, count,
- TRUE, FALSE, ambiguousYear, saveHebrewMonth, *workCal, i, numericLeapMonthFormatter, &tzTimeType);
+ TRUE, FALSE, ambiguousYear, saveHebrewMonth, *workCal, i, numericLeapMonthFormatter, &tzTimeType);
// If the parse fails anywhere in the run, back up to the
// start of the run and retry.
@@ -2302,7 +2302,7 @@ SimpleDateFormat::parse(const UnicodeString& text, Calendar& cal, ParsePosition&
// fields.
else if (ch != 0x6C) { // pattern char 'l' (SMALL LETTER L) just gets ignored
int32_t s = subParse(text, pos, ch, count,
- FALSE, TRUE, ambiguousYear, saveHebrewMonth, *workCal, i, numericLeapMonthFormatter, &tzTimeType, &dayPeriodInt);
+ FALSE, TRUE, ambiguousYear, saveHebrewMonth, *workCal, i, numericLeapMonthFormatter, &tzTimeType, &dayPeriodInt);
if (s == -pos-1) {
// era not present, in special cases allow this to continue
@@ -2311,10 +2311,10 @@ SimpleDateFormat::parse(const UnicodeString& text, Calendar& cal, ParsePosition&
if (i+1 < fPattern.length()) {
// move to next pattern character
- UChar c = fPattern.charAt(i+1);
+ UChar c = fPattern.charAt(i+1);
// check for whitespace
- if (PatternProps::isWhiteSpace(c)) {
+ if (PatternProps::isWhiteSpace(c)) {
i++;
// Advance over run in pattern
while ((i+1)<fPattern.length() &&
@@ -2920,7 +2920,7 @@ SimpleDateFormat::set2DigitYearStart(UDate d, UErrorCode& status)
*/
int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UChar ch, int32_t count,
UBool obeyCount, UBool allowNegative, UBool ambiguousYear[], int32_t& saveHebrewMonth, Calendar& cal,
- int32_t patLoc, MessageFormat * numericLeapMonthFormatter, UTimeZoneFormatTimeType *tzTimeType,
+ int32_t patLoc, MessageFormat * numericLeapMonthFormatter, UTimeZoneFormatTimeType *tzTimeType,
int32_t *dayPeriod) const
{
Formattable number;
@@ -2930,7 +2930,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
UErrorCode status = U_ZERO_ERROR;
ParsePosition pos(0);
UDateFormatField patternCharIndex = DateFormatSymbols::getPatternCharIndex(ch);
- const NumberFormat *currentNumberFormat;
+ const NumberFormat *currentNumberFormat;
UnicodeString temp;
UBool gotNumber = FALSE;
@@ -2942,7 +2942,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
return -start;
}
- currentNumberFormat = getNumberFormatByIndex(patternCharIndex);
+ currentNumberFormat = getNumberFormatByIndex(patternCharIndex);
if (currentNumberFormat == NULL) {
return -start;
}
@@ -3116,9 +3116,9 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
// is treated literally: "2250", "-1", "1", "002".
if (fDateOverride.compare(hebr)==0 && value < 1000) {
value += HEBREW_CAL_CUR_MILLENIUM_START_YEAR;
- } else if (text.moveIndex32(start, 2) == pos.getIndex() && !isChineseCalendar
- && u_isdigit(text.char32At(start))
- && u_isdigit(text.char32At(text.moveIndex32(start, 1))))
+ } else if (text.moveIndex32(start, 2) == pos.getIndex() && !isChineseCalendar
+ && u_isdigit(text.char32At(start))
+ && u_isdigit(text.char32At(text.moveIndex32(start, 1))))
{
// only adjust year for patterns less than 3.
if(count < 3) {
@@ -3156,9 +3156,9 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
// Comment is the same as for UDAT_Year_FIELDs - look above
if (fDateOverride.compare(hebr)==0 && value < 1000) {
value += HEBREW_CAL_CUR_MILLENIUM_START_YEAR;
- } else if (text.moveIndex32(start, 2) == pos.getIndex()
- && u_isdigit(text.char32At(start))
- && u_isdigit(text.char32At(text.moveIndex32(start, 1)))
+ } else if (text.moveIndex32(start, 2) == pos.getIndex()
+ && u_isdigit(text.char32At(start))
+ && u_isdigit(text.char32At(text.moveIndex32(start, 1)))
&& fHaveDefaultCentury )
{
int32_t ambiguousTwoDigitYear = fDefaultCenturyStartYear % 100;
@@ -3192,8 +3192,8 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
if (!strcmp(cal.getType(),"hebrew")) {
HebrewCalendar *hc = (HebrewCalendar*)&cal;
if (cal.isSet(UCAL_YEAR)) {
- UErrorCode monthStatus = U_ZERO_ERROR;
- if (!hc->isLeapYear(hc->get(UCAL_YEAR, monthStatus)) && value >= 6) {
+ UErrorCode monthStatus = U_ZERO_ERROR;
+ if (!hc->isLeapYear(hc->get(UCAL_YEAR, monthStatus)) && value >= 6) {
cal.set(UCAL_MONTH, value);
} else {
cal.set(UCAL_MONTH, value - 1);
@@ -3264,7 +3264,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
case UDAT_FRACTIONAL_SECOND_FIELD:
// Fractional seconds left-justify
- i = countDigits(text, start, pos.getIndex());
+ i = countDigits(text, start, pos.getIndex());
if (i < 3) {
while (i < 3) {
value *= 10;
@@ -3455,41 +3455,41 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
case UDAT_TIMEZONE_FIELD: // 'z'
{
UTimeZoneFormatStyle style = (count < 4) ? UTZFMT_STYLE_SPECIFIC_SHORT : UTZFMT_STYLE_SPECIFIC_LONG;
- const TimeZoneFormat *tzfmt = tzFormat(status);
- if (U_SUCCESS(status)) {
- TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
- if (tz != NULL) {
- cal.adoptTimeZone(tz);
- return pos.getIndex();
- }
+ const TimeZoneFormat *tzfmt = tzFormat(status);
+ if (U_SUCCESS(status)) {
+ TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
+ if (tz != NULL) {
+ cal.adoptTimeZone(tz);
+ return pos.getIndex();
+ }
}
- return -start;
- }
+ return -start;
+ }
break;
case UDAT_TIMEZONE_RFC_FIELD: // 'Z'
{
UTimeZoneFormatStyle style = (count < 4) ?
UTZFMT_STYLE_ISO_BASIC_LOCAL_FULL : ((count == 5) ? UTZFMT_STYLE_ISO_EXTENDED_FULL: UTZFMT_STYLE_LOCALIZED_GMT);
- const TimeZoneFormat *tzfmt = tzFormat(status);
- if (U_SUCCESS(status)) {
- TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
- if (tz != NULL) {
- cal.adoptTimeZone(tz);
- return pos.getIndex();
- }
+ const TimeZoneFormat *tzfmt = tzFormat(status);
+ if (U_SUCCESS(status)) {
+ TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
+ if (tz != NULL) {
+ cal.adoptTimeZone(tz);
+ return pos.getIndex();
+ }
}
return -start;
}
case UDAT_TIMEZONE_GENERIC_FIELD: // 'v'
{
UTimeZoneFormatStyle style = (count < 4) ? UTZFMT_STYLE_GENERIC_SHORT : UTZFMT_STYLE_GENERIC_LONG;
- const TimeZoneFormat *tzfmt = tzFormat(status);
- if (U_SUCCESS(status)) {
- TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
- if (tz != NULL) {
- cal.adoptTimeZone(tz);
- return pos.getIndex();
- }
+ const TimeZoneFormat *tzfmt = tzFormat(status);
+ if (U_SUCCESS(status)) {
+ TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
+ if (tz != NULL) {
+ cal.adoptTimeZone(tz);
+ return pos.getIndex();
+ }
}
return -start;
}
@@ -3510,26 +3510,26 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
style = UTZFMT_STYLE_GENERIC_LOCATION;
break;
}
- const TimeZoneFormat *tzfmt = tzFormat(status);
- if (U_SUCCESS(status)) {
- TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
- if (tz != NULL) {
- cal.adoptTimeZone(tz);
- return pos.getIndex();
- }
+ const TimeZoneFormat *tzfmt = tzFormat(status);
+ if (U_SUCCESS(status)) {
+ TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
+ if (tz != NULL) {
+ cal.adoptTimeZone(tz);
+ return pos.getIndex();
+ }
}
return -start;
}
case UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD: // 'O'
{
UTimeZoneFormatStyle style = (count < 4) ? UTZFMT_STYLE_LOCALIZED_GMT_SHORT : UTZFMT_STYLE_LOCALIZED_GMT;
- const TimeZoneFormat *tzfmt = tzFormat(status);
- if (U_SUCCESS(status)) {
- TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
- if (tz != NULL) {
- cal.adoptTimeZone(tz);
- return pos.getIndex();
- }
+ const TimeZoneFormat *tzfmt = tzFormat(status);
+ if (U_SUCCESS(status)) {
+ TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
+ if (tz != NULL) {
+ cal.adoptTimeZone(tz);
+ return pos.getIndex();
+ }
}
return -start;
}
@@ -3553,13 +3553,13 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
style = UTZFMT_STYLE_ISO_EXTENDED_FULL;
break;
}
- const TimeZoneFormat *tzfmt = tzFormat(status);
- if (U_SUCCESS(status)) {
- TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
- if (tz != NULL) {
- cal.adoptTimeZone(tz);
- return pos.getIndex();
- }
+ const TimeZoneFormat *tzfmt = tzFormat(status);
+ if (U_SUCCESS(status)) {
+ TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
+ if (tz != NULL) {
+ cal.adoptTimeZone(tz);
+ return pos.getIndex();
+ }
}
return -start;
}
@@ -3583,13 +3583,13 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
style = UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FULL;
break;
}
- const TimeZoneFormat *tzfmt = tzFormat(status);
- if (U_SUCCESS(status)) {
- TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
- if (tz != NULL) {
- cal.adoptTimeZone(tz);
- return pos.getIndex();
- }
+ const TimeZoneFormat *tzfmt = tzFormat(status);
+ if (U_SUCCESS(status)) {
+ TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
+ if (tz != NULL) {
+ cal.adoptTimeZone(tz);
+ return pos.getIndex();
+ }
}
return -start;
}
@@ -3601,21 +3601,21 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
static const UChar alt_sep = DateFormatSymbols::ALTERNATE_TIME_SEPARATOR;
// Try matching a time separator.
- int32_t count_sep = 1;
+ int32_t count_sep = 1;
UnicodeString data[3];
fSymbols->getTimeSeparatorString(data[0]);
// Add the default, if different from the locale.
if (data[0].compare(&def_sep, 1) != 0) {
- data[count_sep++].setTo(def_sep);
+ data[count_sep++].setTo(def_sep);
}
// If lenient, add also the alternate, if different from the locale.
if (isLenient() && data[0].compare(&alt_sep, 1) != 0) {
- data[count_sep++].setTo(alt_sep);
+ data[count_sep++].setTo(alt_sep);
}
- return matchString(text, start, UCAL_FIELD_COUNT /* => nothing to set */, data, count_sep, NULL, cal);
+ return matchString(text, start, UCAL_FIELD_COUNT /* => nothing to set */, data, count_sep, NULL, cal);
}
case UDAT_AM_PM_MIDNIGHT_NOON_FIELD:
@@ -3623,7 +3623,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
U_ASSERT(dayPeriod != NULL);
int32_t ampmStart = subParse(text, start, 0x61, count,
obeyCount, allowNegative, ambiguousYear, saveHebrewMonth, cal,
- patLoc, numericLeapMonthFormatter, tzTimeType);
+ patLoc, numericLeapMonthFormatter, tzTimeType);
if (ampmStart > 0) {
return ampmStart;
@@ -3704,7 +3704,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
}
parseInt(*src, number, pos, allowNegative,currentNumberFormat);
if (pos.getIndex() != parseStart) {
- int32_t val = number.getLong();
+ int32_t val = number.getLong();
// Don't need suffix processing here (as in number processing at the beginning of the function);
// the new fields being handled as numeric values (month, weekdays, quarters) should not have suffixes.
@@ -3712,7 +3712,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
if (!getBooleanAttribute(UDAT_PARSE_ALLOW_NUMERIC, status)) {
// Check the range of the value
int32_t bias = gFieldRangeBias[patternCharIndex];
- if (bias >= 0 && (val > cal.getMaximum(field) + bias || val < cal.getMinimum(field) + bias)) {
+ if (bias >= 0 && (val > cal.getMaximum(field) + bias || val < cal.getMinimum(field) + bias)) {
return -start;
}
}
@@ -3726,35 +3726,35 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
if (!strcmp(cal.getType(),"hebrew")) {
HebrewCalendar *hc = (HebrewCalendar*)&cal;
if (cal.isSet(UCAL_YEAR)) {
- UErrorCode monthStatus = U_ZERO_ERROR;
- if (!hc->isLeapYear(hc->get(UCAL_YEAR, monthStatus)) && val >= 6) {
- cal.set(UCAL_MONTH, val);
+ UErrorCode monthStatus = U_ZERO_ERROR;
+ if (!hc->isLeapYear(hc->get(UCAL_YEAR, monthStatus)) && val >= 6) {
+ cal.set(UCAL_MONTH, val);
} else {
- cal.set(UCAL_MONTH, val - 1);
+ cal.set(UCAL_MONTH, val - 1);
}
} else {
- saveHebrewMonth = val;
+ saveHebrewMonth = val;
}
} else {
- cal.set(UCAL_MONTH, val - 1);
+ cal.set(UCAL_MONTH, val - 1);
}
break;
case UDAT_STANDALONE_MONTH_FIELD:
- cal.set(UCAL_MONTH, val - 1);
+ cal.set(UCAL_MONTH, val - 1);
break;
case UDAT_DOW_LOCAL_FIELD:
case UDAT_STANDALONE_DAY_FIELD:
- cal.set(UCAL_DOW_LOCAL, val);
+ cal.set(UCAL_DOW_LOCAL, val);
break;
case UDAT_QUARTER_FIELD:
case UDAT_STANDALONE_QUARTER_FIELD:
- cal.set(UCAL_MONTH, (val - 1) * 3);
+ cal.set(UCAL_MONTH, (val - 1) * 3);
break;
case UDAT_RELATED_YEAR_FIELD:
- cal.setRelatedYear(val);
+ cal.setRelatedYear(val);
break;
default:
- cal.set(field, val);
+ cal.set(field, val);
break;
}
return pos.getIndex();
@@ -3770,7 +3770,7 @@ void SimpleDateFormat::parseInt(const UnicodeString& text,
Formattable& number,
ParsePosition& pos,
UBool allowNegative,
- const NumberFormat *fmt) const {
+ const NumberFormat *fmt) const {
parseInt(text, number, -1, pos, allowNegative,fmt);
}
@@ -3782,18 +3782,18 @@ void SimpleDateFormat::parseInt(const UnicodeString& text,
int32_t maxDigits,
ParsePosition& pos,
UBool allowNegative,
- const NumberFormat *fmt) const {
+ const NumberFormat *fmt) const {
UnicodeString oldPrefix;
- auto* fmtAsDF = dynamic_cast<const DecimalFormat*>(fmt);
- LocalPointer<DecimalFormat> df;
- if (!allowNegative && fmtAsDF != nullptr) {
- df.adoptInstead(fmtAsDF->clone());
- if (df.isNull()) {
- // Memory allocation error
- return;
- }
+ auto* fmtAsDF = dynamic_cast<const DecimalFormat*>(fmt);
+ LocalPointer<DecimalFormat> df;
+ if (!allowNegative && fmtAsDF != nullptr) {
+ df.adoptInstead(fmtAsDF->clone());
+ if (df.isNull()) {
+ // Memory allocation error
+ return;
+ }
df->setNegativePrefix(UnicodeString(TRUE, SUPPRESS_NEGATIVE_PREFIX, -1));
- fmt = df.getAlias();
+ fmt = df.getAlias();
}
int32_t oldPos = pos.getIndex();
fmt->parse(text, number, pos);
@@ -3815,19 +3815,19 @@ void SimpleDateFormat::parseInt(const UnicodeString& text,
}
}
-int32_t SimpleDateFormat::countDigits(const UnicodeString& text, int32_t start, int32_t end) const {
- int32_t numDigits = 0;
- int32_t idx = start;
- while (idx < end) {
- UChar32 cp = text.char32At(idx);
- if (u_isdigit(cp)) {
- numDigits++;
- }
- idx += U16_LENGTH(cp);
- }
- return numDigits;
-}
-
+int32_t SimpleDateFormat::countDigits(const UnicodeString& text, int32_t start, int32_t end) const {
+ int32_t numDigits = 0;
+ int32_t idx = start;
+ while (idx < end) {
+ UChar32 cp = text.char32At(idx);
+ if (u_isdigit(cp)) {
+ numDigits++;
+ }
+ idx += U16_LENGTH(cp);
+ }
+ return numDigits;
+}
+
//----------------------------------------------------------------------
void SimpleDateFormat::translatePattern(const UnicodeString& originalPattern,
@@ -3902,42 +3902,42 @@ SimpleDateFormat::applyPattern(const UnicodeString& pattern)
{
fPattern = pattern;
parsePattern();
-
- // Hack to update use of Gannen year numbering for ja@calendar=japanese -
- // use only if format is non-numeric (includes 年) and no other fDateOverride.
- if (fCalendar != nullptr && uprv_strcmp(fCalendar->getType(),"japanese") == 0 &&
- uprv_strcmp(fLocale.getLanguage(),"ja") == 0) {
- if (fDateOverride==UnicodeString(u"y=jpanyear") && !fHasHanYearChar) {
- // Gannen numbering is set but new pattern should not use it, unset;
- // use procedure from adoptNumberFormat to clear overrides
- if (fSharedNumberFormatters) {
- freeSharedNumberFormatters(fSharedNumberFormatters);
- fSharedNumberFormatters = NULL;
- }
- fDateOverride.setToBogus(); // record status
- } else if (fDateOverride.isBogus() && fHasHanYearChar) {
- // No current override (=> no Gannen numbering) but new pattern needs it;
- // use procedures from initNUmberFormatters / adoptNumberFormat
- umtx_lock(&LOCK);
- if (fSharedNumberFormatters == NULL) {
- fSharedNumberFormatters = allocSharedNumberFormatters();
- }
- umtx_unlock(&LOCK);
- if (fSharedNumberFormatters != NULL) {
- Locale ovrLoc(fLocale.getLanguage(),fLocale.getCountry(),fLocale.getVariant(),"numbers=jpanyear");
- UErrorCode status = U_ZERO_ERROR;
- const SharedNumberFormat *snf = createSharedNumberFormat(ovrLoc, status);
- if (U_SUCCESS(status)) {
- // Now that we have an appropriate number formatter, fill in the
- // appropriate slot in the number formatters table.
- UDateFormatField patternCharIndex = DateFormatSymbols::getPatternCharIndex(u'y');
- SharedObject::copyPtr(snf, fSharedNumberFormatters[patternCharIndex]);
- snf->deleteIfZeroRefCount();
- fDateOverride.setTo(u"y=jpanyear", -1); // record status
- }
- }
- }
- }
+
+ // Hack to update use of Gannen year numbering for ja@calendar=japanese -
+ // use only if format is non-numeric (includes 年) and no other fDateOverride.
+ if (fCalendar != nullptr && uprv_strcmp(fCalendar->getType(),"japanese") == 0 &&
+ uprv_strcmp(fLocale.getLanguage(),"ja") == 0) {
+ if (fDateOverride==UnicodeString(u"y=jpanyear") && !fHasHanYearChar) {
+ // Gannen numbering is set but new pattern should not use it, unset;
+ // use procedure from adoptNumberFormat to clear overrides
+ if (fSharedNumberFormatters) {
+ freeSharedNumberFormatters(fSharedNumberFormatters);
+ fSharedNumberFormatters = NULL;
+ }
+ fDateOverride.setToBogus(); // record status
+ } else if (fDateOverride.isBogus() && fHasHanYearChar) {
+ // No current override (=> no Gannen numbering) but new pattern needs it;
+ // use procedures from initNUmberFormatters / adoptNumberFormat
+ umtx_lock(&LOCK);
+ if (fSharedNumberFormatters == NULL) {
+ fSharedNumberFormatters = allocSharedNumberFormatters();
+ }
+ umtx_unlock(&LOCK);
+ if (fSharedNumberFormatters != NULL) {
+ Locale ovrLoc(fLocale.getLanguage(),fLocale.getCountry(),fLocale.getVariant(),"numbers=jpanyear");
+ UErrorCode status = U_ZERO_ERROR;
+ const SharedNumberFormat *snf = createSharedNumberFormat(ovrLoc, status);
+ if (U_SUCCESS(status)) {
+ // Now that we have an appropriate number formatter, fill in the
+ // appropriate slot in the number formatters table.
+ UDateFormatField patternCharIndex = DateFormatSymbols::getPatternCharIndex(u'y');
+ SharedObject::copyPtr(snf, fSharedNumberFormatters[patternCharIndex]);
+ snf->deleteIfZeroRefCount();
+ fDateOverride.setTo(u"y=jpanyear", -1); // record status
+ }
+ }
+ }
+ }
}
//----------------------------------------------------------------------
@@ -3979,13 +3979,13 @@ SimpleDateFormat::setDateFormatSymbols(const DateFormatSymbols& newFormatSymbols
//----------------------------------------------------------------------
const TimeZoneFormat*
SimpleDateFormat::getTimeZoneFormat(void) const {
- // TimeZoneFormat initialization might fail when out of memory.
- // If we always initialize TimeZoneFormat instance, we can return
- // such status there. For now, this implementation lazily instantiates
- // a TimeZoneFormat for performance optimization reasons, but cannot
- // propagate such error (probably just out of memory case) to the caller.
- UErrorCode status = U_ZERO_ERROR;
- return (const TimeZoneFormat*)tzFormat(status);
+ // TimeZoneFormat initialization might fail when out of memory.
+ // If we always initialize TimeZoneFormat instance, we can return
+ // such status there. For now, this implementation lazily instantiates
+ // a TimeZoneFormat for performance optimization reasons, but cannot
+ // propagate such error (probably just out of memory case) to the caller.
+ UErrorCode status = U_ZERO_ERROR;
+ return (const TimeZoneFormat*)tzFormat(status);
}
//----------------------------------------------------------------------
@@ -4015,7 +4015,7 @@ void SimpleDateFormat::adoptCalendar(Calendar* calendarToAdopt)
DateFormatSymbols *newSymbols =
DateFormatSymbols::createForLocale(calLocale, status);
if (U_FAILURE(status)) {
- delete calendarToAdopt;
+ delete calendarToAdopt;
return;
}
DateFormat::adoptCalendar(calendarToAdopt);
@@ -4038,7 +4038,7 @@ SimpleDateFormat::setContext(UDisplayContext value, UErrorCode& status)
if (U_SUCCESS(status)) {
if ( fCapitalizationBrkIter == NULL && (value==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
value==UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU || value==UDISPCTX_CAPITALIZATION_FOR_STANDALONE) ) {
- status = U_ZERO_ERROR;
+ status = U_ZERO_ERROR;
fCapitalizationBrkIter = BreakIterator::createSentenceInstance(fLocale, status);
if (U_FAILURE(status)) {
delete fCapitalizationBrkIter;
@@ -4253,7 +4253,7 @@ SimpleDateFormat::skipUWhiteSpace(const UnicodeString& text, int32_t pos) const
// Lazy TimeZoneFormat instantiation, semantically const.
TimeZoneFormat *
-SimpleDateFormat::tzFormat(UErrorCode &status) const {
+SimpleDateFormat::tzFormat(UErrorCode &status) const {
if (fTimeZoneFormat == NULL) {
umtx_lock(&LOCK);
{
@@ -4274,7 +4274,7 @@ SimpleDateFormat::tzFormat(UErrorCode &status) const {
void SimpleDateFormat::parsePattern() {
fHasMinute = FALSE;
fHasSecond = FALSE;
- fHasHanYearChar = FALSE;
+ fHasHanYearChar = FALSE;
int len = fPattern.length();
UBool inQuote = FALSE;
@@ -4283,9 +4283,9 @@ void SimpleDateFormat::parsePattern() {
if (ch == QUOTE) {
inQuote = !inQuote;
}
- if (ch == 0x5E74) { // don't care whether this is inside quotes
- fHasHanYearChar = TRUE;
- }
+ if (ch == 0x5E74) { // don't care whether this is inside quotes
+ fHasHanYearChar = TRUE;
+ }
if (!inQuote) {
if (ch == 0x6D) { // 0x6D == 'm'
fHasMinute = TRUE;
diff --git a/contrib/libs/icu/i18n/smpdtfst.cpp b/contrib/libs/icu/i18n/smpdtfst.cpp
index f30c085ea0..db59a4b4ab 100644
--- a/contrib/libs/icu/i18n/smpdtfst.cpp
+++ b/contrib/libs/icu/i18n/smpdtfst.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/smpdtfst.h b/contrib/libs/icu/i18n/smpdtfst.h
index 24b0dfdd19..cc80909c88 100644
--- a/contrib/libs/icu/i18n/smpdtfst.h
+++ b/contrib/libs/icu/i18n/smpdtfst.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -16,7 +16,7 @@
#ifndef SMPDTFST_H
#define SMPDTFST_H
-#include "unicode/uobject.h"
+#include "unicode/uobject.h"
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/i18n/sortkey.cpp b/contrib/libs/icu/i18n/sortkey.cpp
index 43610280a2..12289482ec 100644
--- a/contrib/libs/icu/i18n/sortkey.cpp
+++ b/contrib/libs/icu/i18n/sortkey.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/standardplural.cpp b/contrib/libs/icu/i18n/standardplural.cpp
index 194537709c..0391034b3e 100644
--- a/contrib/libs/icu/i18n/standardplural.cpp
+++ b/contrib/libs/icu/i18n/standardplural.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/standardplural.h b/contrib/libs/icu/i18n/standardplural.h
index e7a9eea432..33e1d605f6 100644
--- a/contrib/libs/icu/i18n/standardplural.h
+++ b/contrib/libs/icu/i18n/standardplural.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/string_segment.cpp b/contrib/libs/icu/i18n/string_segment.cpp
index 0393f3fd19..5d19ac57f5 100644
--- a/contrib/libs/icu/i18n/string_segment.cpp
+++ b/contrib/libs/icu/i18n/string_segment.cpp
@@ -1,145 +1,145 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-// Allow implicit conversion from char16_t* to UnicodeString for this file:
-// Helpful in toString methods and elsewhere.
-#define UNISTR_FROM_STRING_EXPLICIT
-
-#include "numparse_types.h"
-#include "string_segment.h"
-#include "putilimp.h"
-#include "unicode/utf16.h"
-#include "unicode/uniset.h"
-
-U_NAMESPACE_BEGIN
-
-
-StringSegment::StringSegment(const UnicodeString& str, bool ignoreCase)
- : fStr(str), fStart(0), fEnd(str.length()),
- fFoldCase(ignoreCase) {}
-
-int32_t StringSegment::getOffset() const {
- return fStart;
-}
-
-void StringSegment::setOffset(int32_t start) {
- fStart = start;
-}
-
-void StringSegment::adjustOffset(int32_t delta) {
- fStart += delta;
-}
-
-void StringSegment::adjustOffsetByCodePoint() {
- fStart += U16_LENGTH(getCodePoint());
-}
-
-void StringSegment::setLength(int32_t length) {
- fEnd = fStart + length;
-}
-
-void StringSegment::resetLength() {
- fEnd = fStr.length();
-}
-
-int32_t StringSegment::length() const {
- return fEnd - fStart;
-}
-
-char16_t StringSegment::charAt(int32_t index) const {
- return fStr.charAt(index + fStart);
-}
-
-UChar32 StringSegment::codePointAt(int32_t index) const {
- return fStr.char32At(index + fStart);
-}
-
-UnicodeString StringSegment::toUnicodeString() const {
- return UnicodeString(fStr.getBuffer() + fStart, fEnd - fStart);
-}
-
-const UnicodeString StringSegment::toTempUnicodeString() const {
- // Use the readonly-aliasing constructor for efficiency.
- return UnicodeString(FALSE, fStr.getBuffer() + fStart, fEnd - fStart);
-}
-
-UChar32 StringSegment::getCodePoint() const {
- char16_t lead = fStr.charAt(fStart);
- if (U16_IS_LEAD(lead) && fStart + 1 < fEnd) {
- return fStr.char32At(fStart);
- } else if (U16_IS_SURROGATE(lead)) {
- return -1;
- } else {
- return lead;
- }
-}
-
-bool StringSegment::startsWith(UChar32 otherCp) const {
- return codePointsEqual(getCodePoint(), otherCp, fFoldCase);
-}
-
-bool StringSegment::startsWith(const UnicodeSet& uniset) const {
- // TODO: Move UnicodeSet case-folding logic here.
- // TODO: Handle string matches here instead of separately.
- UChar32 cp = getCodePoint();
- if (cp == -1) {
- return false;
- }
- return uniset.contains(cp);
-}
-
-bool StringSegment::startsWith(const UnicodeString& other) const {
- if (other.isBogus() || other.length() == 0 || length() == 0) {
- return false;
- }
- int cp1 = getCodePoint();
- int cp2 = other.char32At(0);
- return codePointsEqual(cp1, cp2, fFoldCase);
-}
-
-int32_t StringSegment::getCommonPrefixLength(const UnicodeString& other) {
- return getPrefixLengthInternal(other, fFoldCase);
-}
-
-int32_t StringSegment::getCaseSensitivePrefixLength(const UnicodeString& other) {
- return getPrefixLengthInternal(other, false);
-}
-
-int32_t StringSegment::getPrefixLengthInternal(const UnicodeString& other, bool foldCase) {
- U_ASSERT(other.length() > 0);
- int32_t offset = 0;
- for (; offset < uprv_min(length(), other.length());) {
- // TODO: case-fold code points, not chars
- char16_t c1 = charAt(offset);
- char16_t c2 = other.charAt(offset);
- if (!codePointsEqual(c1, c2, foldCase)) {
- break;
- }
- offset++;
- }
- return offset;
-}
-
-bool StringSegment::codePointsEqual(UChar32 cp1, UChar32 cp2, bool foldCase) {
- if (cp1 == cp2) {
- return true;
- }
- if (!foldCase) {
- return false;
- }
- cp1 = u_foldCase(cp1, TRUE);
- cp2 = u_foldCase(cp2, TRUE);
- return cp1 == cp2;
-}
-
-bool StringSegment::operator==(const UnicodeString& other) const {
- return toTempUnicodeString() == other;
-}
-
-
-U_NAMESPACE_END
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+// Allow implicit conversion from char16_t* to UnicodeString for this file:
+// Helpful in toString methods and elsewhere.
+#define UNISTR_FROM_STRING_EXPLICIT
+
+#include "numparse_types.h"
+#include "string_segment.h"
+#include "putilimp.h"
+#include "unicode/utf16.h"
+#include "unicode/uniset.h"
+
+U_NAMESPACE_BEGIN
+
+
+StringSegment::StringSegment(const UnicodeString& str, bool ignoreCase)
+ : fStr(str), fStart(0), fEnd(str.length()),
+ fFoldCase(ignoreCase) {}
+
+int32_t StringSegment::getOffset() const {
+ return fStart;
+}
+
+void StringSegment::setOffset(int32_t start) {
+ fStart = start;
+}
+
+void StringSegment::adjustOffset(int32_t delta) {
+ fStart += delta;
+}
+
+void StringSegment::adjustOffsetByCodePoint() {
+ fStart += U16_LENGTH(getCodePoint());
+}
+
+void StringSegment::setLength(int32_t length) {
+ fEnd = fStart + length;
+}
+
+void StringSegment::resetLength() {
+ fEnd = fStr.length();
+}
+
+int32_t StringSegment::length() const {
+ return fEnd - fStart;
+}
+
+char16_t StringSegment::charAt(int32_t index) const {
+ return fStr.charAt(index + fStart);
+}
+
+UChar32 StringSegment::codePointAt(int32_t index) const {
+ return fStr.char32At(index + fStart);
+}
+
+UnicodeString StringSegment::toUnicodeString() const {
+ return UnicodeString(fStr.getBuffer() + fStart, fEnd - fStart);
+}
+
+const UnicodeString StringSegment::toTempUnicodeString() const {
+ // Use the readonly-aliasing constructor for efficiency.
+ return UnicodeString(FALSE, fStr.getBuffer() + fStart, fEnd - fStart);
+}
+
+UChar32 StringSegment::getCodePoint() const {
+ char16_t lead = fStr.charAt(fStart);
+ if (U16_IS_LEAD(lead) && fStart + 1 < fEnd) {
+ return fStr.char32At(fStart);
+ } else if (U16_IS_SURROGATE(lead)) {
+ return -1;
+ } else {
+ return lead;
+ }
+}
+
+bool StringSegment::startsWith(UChar32 otherCp) const {
+ return codePointsEqual(getCodePoint(), otherCp, fFoldCase);
+}
+
+bool StringSegment::startsWith(const UnicodeSet& uniset) const {
+ // TODO: Move UnicodeSet case-folding logic here.
+ // TODO: Handle string matches here instead of separately.
+ UChar32 cp = getCodePoint();
+ if (cp == -1) {
+ return false;
+ }
+ return uniset.contains(cp);
+}
+
+bool StringSegment::startsWith(const UnicodeString& other) const {
+ if (other.isBogus() || other.length() == 0 || length() == 0) {
+ return false;
+ }
+ int cp1 = getCodePoint();
+ int cp2 = other.char32At(0);
+ return codePointsEqual(cp1, cp2, fFoldCase);
+}
+
+int32_t StringSegment::getCommonPrefixLength(const UnicodeString& other) {
+ return getPrefixLengthInternal(other, fFoldCase);
+}
+
+int32_t StringSegment::getCaseSensitivePrefixLength(const UnicodeString& other) {
+ return getPrefixLengthInternal(other, false);
+}
+
+int32_t StringSegment::getPrefixLengthInternal(const UnicodeString& other, bool foldCase) {
+ U_ASSERT(other.length() > 0);
+ int32_t offset = 0;
+ for (; offset < uprv_min(length(), other.length());) {
+ // TODO: case-fold code points, not chars
+ char16_t c1 = charAt(offset);
+ char16_t c2 = other.charAt(offset);
+ if (!codePointsEqual(c1, c2, foldCase)) {
+ break;
+ }
+ offset++;
+ }
+ return offset;
+}
+
+bool StringSegment::codePointsEqual(UChar32 cp1, UChar32 cp2, bool foldCase) {
+ if (cp1 == cp2) {
+ return true;
+ }
+ if (!foldCase) {
+ return false;
+ }
+ cp1 = u_foldCase(cp1, TRUE);
+ cp2 = u_foldCase(cp2, TRUE);
+ return cp1 == cp2;
+}
+
+bool StringSegment::operator==(const UnicodeString& other) const {
+ return toTempUnicodeString() == other;
+}
+
+
+U_NAMESPACE_END
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/string_segment.h b/contrib/libs/icu/i18n/string_segment.h
index 5a3d7e4c81..b581f7e575 100644
--- a/contrib/libs/icu/i18n/string_segment.h
+++ b/contrib/libs/icu/i18n/string_segment.h
@@ -1,134 +1,134 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __NUMPARSE_STRINGSEGMENT_H__
-#define __NUMPARSE_STRINGSEGMENT_H__
-
-#include "unicode/unistr.h"
-#include "unicode/uniset.h"
-
-U_NAMESPACE_BEGIN
-
-
-/**
- * A mutable UnicodeString wrapper with a variable offset and length and
- * support for case folding. The charAt, length, and subSequence methods all
- * operate relative to the fixed offset into the UnicodeString.
- *
- * Intended to be useful for parsing.
- *
- * CAUTION: Since this class is mutable, it must not be used anywhere that an
- * immutable object is required, like in a cache or as the key of a hash map.
- *
- * @author sffc (Shane Carr)
- */
-// Exported as U_I18N_API for tests
-class U_I18N_API StringSegment : public UMemory {
- public:
- StringSegment(const UnicodeString& str, bool ignoreCase);
-
- int32_t getOffset() const;
-
- void setOffset(int32_t start);
-
- /**
- * Equivalent to <code>setOffset(getOffset()+delta)</code>.
- *
- * <p>
- * This method is usually called by a Matcher to register that a char was consumed. If the char is
- * strong (it usually is, except for things like whitespace), follow this with a call to
- * {@link ParsedNumber#setCharsConsumed}. For more information on strong chars, see that method.
- */
- void adjustOffset(int32_t delta);
-
- /**
- * Adjusts the offset by the width of the current code point, either 1 or 2 chars.
- */
- void adjustOffsetByCodePoint();
-
- void setLength(int32_t length);
-
- void resetLength();
-
- int32_t length() const;
-
- char16_t charAt(int32_t index) const;
-
- UChar32 codePointAt(int32_t index) const;
-
- UnicodeString toUnicodeString() const;
-
- const UnicodeString toTempUnicodeString() const;
-
- /**
- * Returns the first code point in the string segment, or -1 if the string starts with an invalid
- * code point.
- *
- * <p>
- * <strong>Important:</strong> Most of the time, you should use {@link #startsWith}, which handles case
- * folding logic, instead of this method.
- */
- UChar32 getCodePoint() const;
-
- /**
- * Returns true if the first code point of this StringSegment equals the given code point.
- *
- * <p>
- * This method will perform case folding if case folding is enabled for the parser.
- */
- bool startsWith(UChar32 otherCp) const;
-
- /**
- * Returns true if the first code point of this StringSegment is in the given UnicodeSet.
- */
- bool startsWith(const UnicodeSet& uniset) const;
-
- /**
- * Returns true if there is at least one code point of overlap between this StringSegment and the
- * given UnicodeString.
- */
- bool startsWith(const UnicodeString& other) const;
-
- /**
- * Returns the length of the prefix shared by this StringSegment and the given UnicodeString. For
- * example, if this string segment is "aab", and the char sequence is "aac", this method returns 2,
- * since the first 2 characters are the same.
- *
- * <p>
- * This method only returns offsets along code point boundaries.
- *
- * <p>
- * This method will perform case folding if case folding was enabled in the constructor.
- *
- * <p>
- * IMPORTANT: The given UnicodeString must not be empty! It is the caller's responsibility to check.
- */
- int32_t getCommonPrefixLength(const UnicodeString& other);
-
- /**
- * Like {@link #getCommonPrefixLength}, but never performs case folding, even if case folding is
- * enabled for the parser.
- */
- int32_t getCaseSensitivePrefixLength(const UnicodeString& other);
-
- bool operator==(const UnicodeString& other) const;
-
- private:
- const UnicodeString& fStr;
- int32_t fStart;
- int32_t fEnd;
- bool fFoldCase;
-
- int32_t getPrefixLengthInternal(const UnicodeString& other, bool foldCase);
-
- static bool codePointsEqual(UChar32 cp1, UChar32 cp2, bool foldCase);
-};
-
-
-U_NAMESPACE_END
-
-#endif //__NUMPARSE_STRINGSEGMENT_H__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __NUMPARSE_STRINGSEGMENT_H__
+#define __NUMPARSE_STRINGSEGMENT_H__
+
+#include "unicode/unistr.h"
+#include "unicode/uniset.h"
+
+U_NAMESPACE_BEGIN
+
+
+/**
+ * A mutable UnicodeString wrapper with a variable offset and length and
+ * support for case folding. The charAt, length, and subSequence methods all
+ * operate relative to the fixed offset into the UnicodeString.
+ *
+ * Intended to be useful for parsing.
+ *
+ * CAUTION: Since this class is mutable, it must not be used anywhere that an
+ * immutable object is required, like in a cache or as the key of a hash map.
+ *
+ * @author sffc (Shane Carr)
+ */
+// Exported as U_I18N_API for tests
+class U_I18N_API StringSegment : public UMemory {
+ public:
+ StringSegment(const UnicodeString& str, bool ignoreCase);
+
+ int32_t getOffset() const;
+
+ void setOffset(int32_t start);
+
+ /**
+ * Equivalent to <code>setOffset(getOffset()+delta)</code>.
+ *
+ * <p>
+ * This method is usually called by a Matcher to register that a char was consumed. If the char is
+ * strong (it usually is, except for things like whitespace), follow this with a call to
+ * {@link ParsedNumber#setCharsConsumed}. For more information on strong chars, see that method.
+ */
+ void adjustOffset(int32_t delta);
+
+ /**
+ * Adjusts the offset by the width of the current code point, either 1 or 2 chars.
+ */
+ void adjustOffsetByCodePoint();
+
+ void setLength(int32_t length);
+
+ void resetLength();
+
+ int32_t length() const;
+
+ char16_t charAt(int32_t index) const;
+
+ UChar32 codePointAt(int32_t index) const;
+
+ UnicodeString toUnicodeString() const;
+
+ const UnicodeString toTempUnicodeString() const;
+
+ /**
+ * Returns the first code point in the string segment, or -1 if the string starts with an invalid
+ * code point.
+ *
+ * <p>
+ * <strong>Important:</strong> Most of the time, you should use {@link #startsWith}, which handles case
+ * folding logic, instead of this method.
+ */
+ UChar32 getCodePoint() const;
+
+ /**
+ * Returns true if the first code point of this StringSegment equals the given code point.
+ *
+ * <p>
+ * This method will perform case folding if case folding is enabled for the parser.
+ */
+ bool startsWith(UChar32 otherCp) const;
+
+ /**
+ * Returns true if the first code point of this StringSegment is in the given UnicodeSet.
+ */
+ bool startsWith(const UnicodeSet& uniset) const;
+
+ /**
+ * Returns true if there is at least one code point of overlap between this StringSegment and the
+ * given UnicodeString.
+ */
+ bool startsWith(const UnicodeString& other) const;
+
+ /**
+ * Returns the length of the prefix shared by this StringSegment and the given UnicodeString. For
+ * example, if this string segment is "aab", and the char sequence is "aac", this method returns 2,
+ * since the first 2 characters are the same.
+ *
+ * <p>
+ * This method only returns offsets along code point boundaries.
+ *
+ * <p>
+ * This method will perform case folding if case folding was enabled in the constructor.
+ *
+ * <p>
+ * IMPORTANT: The given UnicodeString must not be empty! It is the caller's responsibility to check.
+ */
+ int32_t getCommonPrefixLength(const UnicodeString& other);
+
+ /**
+ * Like {@link #getCommonPrefixLength}, but never performs case folding, even if case folding is
+ * enabled for the parser.
+ */
+ int32_t getCaseSensitivePrefixLength(const UnicodeString& other);
+
+ bool operator==(const UnicodeString& other) const;
+
+ private:
+ const UnicodeString& fStr;
+ int32_t fStart;
+ int32_t fEnd;
+ bool fFoldCase;
+
+ int32_t getPrefixLengthInternal(const UnicodeString& other, bool foldCase);
+
+ static bool codePointsEqual(UChar32 cp1, UChar32 cp2, bool foldCase);
+};
+
+
+U_NAMESPACE_END
+
+#endif //__NUMPARSE_STRINGSEGMENT_H__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/strmatch.cpp b/contrib/libs/icu/i18n/strmatch.cpp
index d7903bc0cf..a20f7873fe 100644
--- a/contrib/libs/icu/i18n/strmatch.cpp
+++ b/contrib/libs/icu/i18n/strmatch.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -58,7 +58,7 @@ StringMatcher::~StringMatcher() {
/**
* Implement UnicodeFunctor
*/
-StringMatcher* StringMatcher::clone() const {
+StringMatcher* StringMatcher::clone() const {
return new StringMatcher(*this);
}
diff --git a/contrib/libs/icu/i18n/strmatch.h b/contrib/libs/icu/i18n/strmatch.h
index c1e0a4dbdf..71ae984951 100644
--- a/contrib/libs/icu/i18n/strmatch.h
+++ b/contrib/libs/icu/i18n/strmatch.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
* Copyright (C) 2001-2011, International Business Machines Corporation
@@ -78,7 +78,7 @@ class StringMatcher : public UnicodeFunctor, public UnicodeMatcher, public Unico
* Implement UnicodeFunctor
* @return a copy of the object.
*/
- virtual StringMatcher* clone() const;
+ virtual StringMatcher* clone() const;
/**
* UnicodeFunctor API. Cast 'this' to a UnicodeMatcher* pointer
diff --git a/contrib/libs/icu/i18n/strrepl.cpp b/contrib/libs/icu/i18n/strrepl.cpp
index 6b71da1ae6..9fafeb2659 100644
--- a/contrib/libs/icu/i18n/strrepl.cpp
+++ b/contrib/libs/icu/i18n/strrepl.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -87,7 +87,7 @@ StringReplacer::~StringReplacer() {
/**
* Implement UnicodeFunctor
*/
-StringReplacer* StringReplacer::clone() const {
+StringReplacer* StringReplacer::clone() const {
return new StringReplacer(*this);
}
diff --git a/contrib/libs/icu/i18n/strrepl.h b/contrib/libs/icu/i18n/strrepl.h
index 3f5969f60b..7f74d0d945 100644
--- a/contrib/libs/icu/i18n/strrepl.h
+++ b/contrib/libs/icu/i18n/strrepl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -111,7 +111,7 @@ class StringReplacer : public UnicodeFunctor, public UnicodeReplacer {
/**
* Implement UnicodeFunctor
*/
- virtual StringReplacer* clone() const;
+ virtual StringReplacer* clone() const;
/**
* UnicodeFunctor API. Cast 'this' to a UnicodeReplacer* pointer
diff --git a/contrib/libs/icu/i18n/stsearch.cpp b/contrib/libs/icu/i18n/stsearch.cpp
index 2e1908b054..3e6ed4648b 100644
--- a/contrib/libs/icu/i18n/stsearch.cpp
+++ b/contrib/libs/icu/i18n/stsearch.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -282,7 +282,7 @@ void StringSearch::reset()
usearch_reset(m_strsrch_);
}
-StringSearch * StringSearch::safeClone() const
+StringSearch * StringSearch::safeClone() const
{
UErrorCode status = U_ZERO_ERROR;
StringSearch *result = new StringSearch(m_pattern_, m_text_,
diff --git a/contrib/libs/icu/i18n/taiwncal.cpp b/contrib/libs/icu/i18n/taiwncal.cpp
index 4771e24b41..27352aa10c 100644
--- a/contrib/libs/icu/i18n/taiwncal.cpp
+++ b/contrib/libs/icu/i18n/taiwncal.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -53,7 +53,7 @@ TaiwanCalendar& TaiwanCalendar::operator= ( const TaiwanCalendar& right)
return *this;
}
-TaiwanCalendar* TaiwanCalendar::clone() const
+TaiwanCalendar* TaiwanCalendar::clone() const
{
return new TaiwanCalendar(*this);
}
diff --git a/contrib/libs/icu/i18n/taiwncal.h b/contrib/libs/icu/i18n/taiwncal.h
index c0bfbcddac..01d4d31e80 100644
--- a/contrib/libs/icu/i18n/taiwncal.h
+++ b/contrib/libs/icu/i18n/taiwncal.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -91,7 +91,7 @@ public:
* @return return a polymorphic copy of this calendar.
* @internal
*/
- virtual TaiwanCalendar* clone() const;
+ virtual TaiwanCalendar* clone() const;
public:
/**
diff --git a/contrib/libs/icu/i18n/timezone.cpp b/contrib/libs/icu/i18n/timezone.cpp
index 2ed29b0a34..284334ebf7 100644
--- a/contrib/libs/icu/i18n/timezone.cpp
+++ b/contrib/libs/icu/i18n/timezone.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -115,14 +115,14 @@ static const int32_t UNKNOWN_ZONE_ID_LENGTH = 11;
static icu::TimeZone* DEFAULT_ZONE = NULL;
static icu::UInitOnce gDefaultZoneInitOnce = U_INITONCE_INITIALIZER;
-alignas(icu::SimpleTimeZone)
-static char gRawGMT[sizeof(icu::SimpleTimeZone)];
-
-alignas(icu::SimpleTimeZone)
-static char gRawUNKNOWN[sizeof(icu::SimpleTimeZone)];
-
+alignas(icu::SimpleTimeZone)
+static char gRawGMT[sizeof(icu::SimpleTimeZone)];
+
+alignas(icu::SimpleTimeZone)
+static char gRawUNKNOWN[sizeof(icu::SimpleTimeZone)];
+
static icu::UInitOnce gStaticZonesInitOnce = U_INITONCE_INITIALIZER;
-static UBool gStaticZonesInitialized = FALSE; // Whether the static zones are initialized and ready to use.
+static UBool gStaticZonesInitialized = FALSE; // Whether the static zones are initialized and ready to use.
static char TZDATA_VERSION[16];
static icu::UInitOnce gTZDataVersionInitOnce = U_INITONCE_INITIALIZER;
@@ -147,12 +147,12 @@ static UBool U_CALLCONV timeZone_cleanup(void)
DEFAULT_ZONE = NULL;
gDefaultZoneInitOnce.reset();
- if (gStaticZonesInitialized) {
- reinterpret_cast<SimpleTimeZone*>(gRawGMT)->~SimpleTimeZone();
- reinterpret_cast<SimpleTimeZone*>(gRawUNKNOWN)->~SimpleTimeZone();
- gStaticZonesInitialized = FALSE;
- gStaticZonesInitOnce.reset();
- }
+ if (gStaticZonesInitialized) {
+ reinterpret_cast<SimpleTimeZone*>(gRawGMT)->~SimpleTimeZone();
+ reinterpret_cast<SimpleTimeZone*>(gRawUNKNOWN)->~SimpleTimeZone();
+ gStaticZonesInitialized = FALSE;
+ gStaticZonesInitOnce.reset();
+ }
uprv_memset(TZDATA_VERSION, 0, sizeof(TZDATA_VERSION));
gTZDataVersionInitOnce.reset();
@@ -278,7 +278,7 @@ static UResourceBundle* openOlsonResource(const UnicodeString& id,
UResourceBundle& res,
UErrorCode& ec)
{
-#ifdef U_DEBUG_TZ
+#ifdef U_DEBUG_TZ
char buf[128];
id.extract(0, sizeof(buf)-1, buf, sizeof(buf), "");
#endif
@@ -310,12 +310,12 @@ void U_CALLCONV initStaticTimeZones() {
// Initialize _GMT independently of other static data; it should
// be valid even if we can't load the time zone UDataMemory.
ucln_i18n_registerCleanup(UCLN_I18N_TIMEZONE, timeZone_cleanup);
-
- // new can't fail below, as we use placement new into staticly allocated space.
- new(gRawGMT) SimpleTimeZone(0, UnicodeString(TRUE, GMT_ID, GMT_ID_LENGTH));
- new(gRawUNKNOWN) SimpleTimeZone(0, UnicodeString(TRUE, UNKNOWN_ZONE_ID, UNKNOWN_ZONE_ID_LENGTH));
-
- gStaticZonesInitialized = TRUE;
+
+ // new can't fail below, as we use placement new into staticly allocated space.
+ new(gRawGMT) SimpleTimeZone(0, UnicodeString(TRUE, GMT_ID, GMT_ID_LENGTH));
+ new(gRawUNKNOWN) SimpleTimeZone(0, UnicodeString(TRUE, UNKNOWN_ZONE_ID, UNKNOWN_ZONE_ID_LENGTH));
+
+ gStaticZonesInitialized = TRUE;
}
} // anonymous namespace
@@ -324,14 +324,14 @@ const TimeZone& U_EXPORT2
TimeZone::getUnknown()
{
umtx_initOnce(gStaticZonesInitOnce, &initStaticTimeZones);
- return *reinterpret_cast<SimpleTimeZone*>(gRawUNKNOWN);
+ return *reinterpret_cast<SimpleTimeZone*>(gRawUNKNOWN);
}
const TimeZone* U_EXPORT2
TimeZone::getGMT(void)
{
umtx_initOnce(gStaticZonesInitOnce, &initStaticTimeZones);
- return reinterpret_cast<SimpleTimeZone*>(gRawGMT);
+ return reinterpret_cast<SimpleTimeZone*>(gRawGMT);
}
// *****************************************************************************
@@ -392,22 +392,22 @@ createSystemTimeZone(const UnicodeString& id, UErrorCode& ec) {
return NULL;
}
TimeZone* z = 0;
- StackUResourceBundle res;
+ StackUResourceBundle res;
U_DEBUG_TZ_MSG(("pre-err=%s\n", u_errorName(ec)));
- UResourceBundle *top = openOlsonResource(id, res.ref(), ec);
+ UResourceBundle *top = openOlsonResource(id, res.ref(), ec);
U_DEBUG_TZ_MSG(("post-err=%s\n", u_errorName(ec)));
if (U_SUCCESS(ec)) {
- z = new OlsonTimeZone(top, res.getAlias(), id, ec);
+ z = new OlsonTimeZone(top, res.getAlias(), id, ec);
if (z == NULL) {
- ec = U_MEMORY_ALLOCATION_ERROR;
- U_DEBUG_TZ_MSG(("cstz: olson time zone failed to initialize - err %s\n", u_errorName(ec)));
+ ec = U_MEMORY_ALLOCATION_ERROR;
+ U_DEBUG_TZ_MSG(("cstz: olson time zone failed to initialize - err %s\n", u_errorName(ec)));
}
}
ures_close(top);
if (U_FAILURE(ec)) {
U_DEBUG_TZ_MSG(("cstz: failed to create, err %s\n", u_errorName(ec)));
delete z;
- z = NULL;
+ z = NULL;
}
return z;
}
@@ -445,8 +445,8 @@ TimeZone::createTimeZone(const UnicodeString& ID)
if (result == NULL) {
U_DEBUG_TZ_MSG(("failed to load time zone with id - falling to Etc/Unknown(GMT)"));
const TimeZone& unknown = getUnknown();
- // Unknown zone uses staticly allocated memory, so creation of it can never fail due to OOM.
- result = unknown.clone();
+ // Unknown zone uses staticly allocated memory, so creation of it can never fail due to OOM.
+ result = unknown.clone();
}
return result;
}
@@ -456,11 +456,11 @@ TimeZone::createTimeZone(const UnicodeString& ID)
TimeZone* U_EXPORT2
TimeZone::detectHostTimeZone()
{
- // We access system timezone data through uprv_tzset(), uprv_tzname(), and others,
- // which have platform specific implementations in putil.cpp
+ // We access system timezone data through uprv_tzset(), uprv_tzname(), and others,
+ // which have platform specific implementations in putil.cpp
int32_t rawOffset = 0;
const char *hostID;
- UBool hostDetectionSucceeded = TRUE;
+ UBool hostDetectionSucceeded = TRUE;
// First, try to create a system timezone, based
// on the string ID in tzname[0].
@@ -471,7 +471,7 @@ TimeZone::detectHostTimeZone()
// Get the timezone ID from the host. This function should do
// any required host-specific remapping; e.g., on Windows this
- // function maps the Windows Time Zone name to an ICU timezone ID.
+ // function maps the Windows Time Zone name to an ICU timezone ID.
hostID = uprv_tzname(0);
// Invert sign because UNIX semantics are backwards
@@ -480,14 +480,14 @@ TimeZone::detectHostTimeZone()
TimeZone* hostZone = NULL;
UnicodeString hostStrID(hostID, -1, US_INV);
-
- if (hostStrID.length() == 0) {
- // The host time zone detection (or remapping) above has failed and
- // we have no name at all. Fallback to using the Unknown zone.
- hostStrID = UnicodeString(TRUE, UNKNOWN_ZONE_ID, UNKNOWN_ZONE_ID_LENGTH);
- hostDetectionSucceeded = FALSE;
- }
-
+
+ if (hostStrID.length() == 0) {
+ // The host time zone detection (or remapping) above has failed and
+ // we have no name at all. Fallback to using the Unknown zone.
+ hostStrID = UnicodeString(TRUE, UNKNOWN_ZONE_ID, UNKNOWN_ZONE_ID_LENGTH);
+ hostDetectionSucceeded = FALSE;
+ }
+
hostZone = createSystemTimeZone(hostStrID);
#if U_PLATFORM_USES_ONLY_WIN32_API
@@ -507,19 +507,19 @@ TimeZone::detectHostTimeZone()
// Construct a fixed standard zone with the host's ID
// and raw offset.
- if (hostZone == NULL && hostDetectionSucceeded) {
+ if (hostZone == NULL && hostDetectionSucceeded) {
hostZone = new SimpleTimeZone(rawOffset, hostStrID);
}
- // If we _still_ don't have a time zone, use the Unknown zone.
+ // If we _still_ don't have a time zone, use the Unknown zone.
//
// Note: This is extremely unlikely situation. If
// new SimpleTimeZone(...) above fails, the following
// code may also fail.
if (hostZone == NULL) {
- // Unknown zone uses static allocated memory, so it must always exist.
- // However, clone() allocates memory and can fail.
- hostZone = TimeZone::getUnknown().clone();
+ // Unknown zone uses static allocated memory, so it must always exist.
+ // However, clone() allocates memory and can fail.
+ hostZone = TimeZone::getUnknown().clone();
}
return hostZone;
@@ -527,8 +527,8 @@ TimeZone::detectHostTimeZone()
// -------------------------------------
-static UMutex gDefaultZoneMutex;
-
+static UMutex gDefaultZoneMutex;
+
/**
* Initialize DEFAULT_ZONE from the system default time zone.
* Upon return, DEFAULT_ZONE will not be NULL, unless operator new()
@@ -538,7 +538,7 @@ static void U_CALLCONV initDefault()
{
ucln_i18n_registerCleanup(UCLN_I18N_TIMEZONE, timeZone_cleanup);
- Mutex lock(&gDefaultZoneMutex);
+ Mutex lock(&gDefaultZoneMutex);
// If setDefault() has already been called we can skip getting the
// default zone information from the system.
if (DEFAULT_ZONE != NULL) {
@@ -571,10 +571,10 @@ TimeZone* U_EXPORT2
TimeZone::createDefault()
{
umtx_initOnce(gDefaultZoneInitOnce, initDefault);
- {
- Mutex lock(&gDefaultZoneMutex);
- return (DEFAULT_ZONE != NULL) ? DEFAULT_ZONE->clone() : NULL;
- }
+ {
+ Mutex lock(&gDefaultZoneMutex);
+ return (DEFAULT_ZONE != NULL) ? DEFAULT_ZONE->clone() : NULL;
+ }
}
// -------------------------------------
@@ -584,12 +584,12 @@ TimeZone::adoptDefault(TimeZone* zone)
{
if (zone != NULL)
{
- {
- Mutex lock(&gDefaultZoneMutex);
- TimeZone *old = DEFAULT_ZONE;
- DEFAULT_ZONE = zone;
- delete old;
- }
+ {
+ Mutex lock(&gDefaultZoneMutex);
+ TimeZone *old = DEFAULT_ZONE;
+ DEFAULT_ZONE = zone;
+ delete old;
+ }
ucln_i18n_registerCleanup(UCLN_I18N_TIMEZONE, timeZone_cleanup);
}
}
@@ -753,7 +753,7 @@ private:
len = mapLen;
}
- UBool getID(int32_t i, UErrorCode& ec) {
+ UBool getID(int32_t i, UErrorCode& ec) {
int32_t idLen = 0;
const UChar* id = NULL;
UResourceBundle *top = ures_openDirect(0, kZONEINFO, &ec);
@@ -943,7 +943,7 @@ public:
virtual const UnicodeString* snext(UErrorCode& status) {
if (U_SUCCESS(status) && map != NULL && pos < len) {
- getID(map[pos], status);
+ getID(map[pos], status);
++pos;
return &unistr;
}
@@ -1000,13 +1000,13 @@ int32_t U_EXPORT2
TimeZone::countEquivalentIDs(const UnicodeString& id) {
int32_t result = 0;
UErrorCode ec = U_ZERO_ERROR;
- StackUResourceBundle res;
+ StackUResourceBundle res;
U_DEBUG_TZ_MSG(("countEquivalentIDs..\n"));
- UResourceBundle *top = openOlsonResource(id, res.ref(), ec);
+ UResourceBundle *top = openOlsonResource(id, res.ref(), ec);
if (U_SUCCESS(ec)) {
- StackUResourceBundle r;
- ures_getByKey(res.getAlias(), kLINKS, r.getAlias(), &ec);
- ures_getIntVector(r.getAlias(), &result, &ec);
+ StackUResourceBundle r;
+ ures_getByKey(res.getAlias(), kLINKS, r.getAlias(), &ec);
+ ures_getIntVector(r.getAlias(), &result, &ec);
}
ures_close(top);
return result;
@@ -1019,14 +1019,14 @@ TimeZone::getEquivalentID(const UnicodeString& id, int32_t index) {
U_DEBUG_TZ_MSG(("gEI(%d)\n", index));
UnicodeString result;
UErrorCode ec = U_ZERO_ERROR;
- StackUResourceBundle res;
- UResourceBundle *top = openOlsonResource(id, res.ref(), ec);
+ StackUResourceBundle res;
+ UResourceBundle *top = openOlsonResource(id, res.ref(), ec);
int32_t zone = -1;
if (U_SUCCESS(ec)) {
- StackUResourceBundle r;
+ StackUResourceBundle r;
int32_t size;
- ures_getByKey(res.getAlias(), kLINKS, r.getAlias(), &ec);
- const int32_t *v = ures_getIntVector(r.getAlias(), &size, &ec);
+ ures_getByKey(res.getAlias(), kLINKS, r.getAlias(), &ec);
+ const int32_t *v = ures_getIntVector(r.getAlias(), &size, &ec);
if (U_SUCCESS(ec)) {
if (index >= 0 && index < size) {
zone = v[index];
@@ -1037,8 +1037,8 @@ TimeZone::getEquivalentID(const UnicodeString& id, int32_t index) {
UResourceBundle *ares = ures_getByKey(top, kNAMES, NULL, &ec); // dereference Zones section
if (U_SUCCESS(ec)) {
int32_t idLen = 0;
- const UChar* id2 = ures_getStringByIndex(ares, zone, &idLen, &ec);
- result.fastCopyFrom(UnicodeString(TRUE, id2, idLen));
+ const UChar* id2 = ures_getStringByIndex(ares, zone, &idLen, &ec);
+ result.fastCopyFrom(UnicodeString(TRUE, id2, idLen));
U_DEBUG_TZ_MSG(("gei(%d) -> %d, len%d, %s\n", index, zone, result.length(), u_errorName(ec)));
}
ures_close(ares);
@@ -1187,9 +1187,9 @@ TimeZone::getDisplayName(const Locale& locale, UnicodeString& result) const
}
UnicodeString&
-TimeZone::getDisplayName(UBool inDaylight, EDisplayType style, UnicodeString& result) const
+TimeZone::getDisplayName(UBool inDaylight, EDisplayType style, UnicodeString& result) const
{
- return getDisplayName(inDaylight,style, Locale::getDefault(), result);
+ return getDisplayName(inDaylight,style, Locale::getDefault(), result);
}
//--------------------------------------
int32_t
@@ -1201,11 +1201,11 @@ TimeZone::getDSTSavings()const {
}
//---------------------------------------
UnicodeString&
-TimeZone::getDisplayName(UBool inDaylight, EDisplayType style, const Locale& locale, UnicodeString& result) const
+TimeZone::getDisplayName(UBool inDaylight, EDisplayType style, const Locale& locale, UnicodeString& result) const
{
UErrorCode status = U_ZERO_ERROR;
UDate date = Calendar::getNow();
- UTimeZoneFormatTimeType timeType = UTZFMT_TIME_TYPE_UNKNOWN;
+ UTimeZoneFormatTimeType timeType = UTZFMT_TIME_TYPE_UNKNOWN;
int32_t offset;
if (style == GENERIC_LOCATION || style == LONG_GENERIC || style == SHORT_GENERIC) {
@@ -1226,13 +1226,13 @@ TimeZone::getDisplayName(UBool inDaylight, EDisplayType style, const Locale& loc
tzfmt->format(UTZFMT_STYLE_GENERIC_SHORT, *this, date, result, &timeType);
break;
default:
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
// Generic format many use Localized GMT as the final fallback.
// When Localized GMT format is used, the result might not be
// appropriate for the requested daylight value.
- if ((inDaylight && timeType == UTZFMT_TIME_TYPE_STANDARD) || (!inDaylight && timeType == UTZFMT_TIME_TYPE_DAYLIGHT)) {
- offset = inDaylight ? getRawOffset() + getDSTSavings() : getRawOffset();
+ if ((inDaylight && timeType == UTZFMT_TIME_TYPE_STANDARD) || (!inDaylight && timeType == UTZFMT_TIME_TYPE_DAYLIGHT)) {
+ offset = inDaylight ? getRawOffset() + getDSTSavings() : getRawOffset();
if (style == SHORT_GENERIC) {
tzfmt->formatOffsetShortLocalizedGMT(offset, result, status);
} else {
@@ -1245,7 +1245,7 @@ TimeZone::getDisplayName(UBool inDaylight, EDisplayType style, const Locale& loc
result.remove();
return result;
}
- offset = inDaylight && useDaylightTime() ? getRawOffset() + getDSTSavings() : getRawOffset();
+ offset = inDaylight && useDaylightTime() ? getRawOffset() + getDSTSavings() : getRawOffset();
switch (style) {
case LONG_GMT:
tzfmt->formatOffsetLocalizedGMT(offset, result, status);
@@ -1254,7 +1254,7 @@ TimeZone::getDisplayName(UBool inDaylight, EDisplayType style, const Locale& loc
tzfmt->formatOffsetISO8601Basic(offset, FALSE, FALSE, FALSE, result, status);
break;
default:
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
} else {
@@ -1262,14 +1262,14 @@ TimeZone::getDisplayName(UBool inDaylight, EDisplayType style, const Locale& loc
UTimeZoneNameType nameType = UTZNM_UNKNOWN;
switch (style) {
case LONG:
- nameType = inDaylight ? UTZNM_LONG_DAYLIGHT : UTZNM_LONG_STANDARD;
+ nameType = inDaylight ? UTZNM_LONG_DAYLIGHT : UTZNM_LONG_STANDARD;
break;
case SHORT:
case SHORT_COMMONLY_USED:
- nameType = inDaylight ? UTZNM_SHORT_DAYLIGHT : UTZNM_SHORT_STANDARD;
+ nameType = inDaylight ? UTZNM_SHORT_DAYLIGHT : UTZNM_SHORT_STANDARD;
break;
default:
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
LocalPointer<TimeZoneNames> tznames(TimeZoneNames::createInstance(locale, status));
if (U_FAILURE(status)) {
@@ -1281,7 +1281,7 @@ TimeZone::getDisplayName(UBool inDaylight, EDisplayType style, const Locale& loc
if (result.isEmpty()) {
// Fallback to localized GMT
LocalPointer<TimeZoneFormat> tzfmt(TimeZoneFormat::createInstance(locale, status));
- offset = inDaylight && useDaylightTime() ? getRawOffset() + getDSTSavings() : getRawOffset();
+ offset = inDaylight && useDaylightTime() ? getRawOffset() + getDSTSavings() : getRawOffset();
if (style == LONG) {
tzfmt->formatOffsetLocalizedGMT(offset, result, status);
} else {
@@ -1502,9 +1502,9 @@ TimeZone::hasSameRules(const TimeZone& other) const
static void U_CALLCONV initTZDataVersion(UErrorCode &status) {
ucln_i18n_registerCleanup(UCLN_I18N_TIMEZONE, timeZone_cleanup);
int32_t len = 0;
- StackUResourceBundle bundle;
- ures_openDirectFillIn(bundle.getAlias(), NULL, kZONEINFO, &status);
- const UChar *tzver = ures_getStringByKey(bundle.getAlias(), kTZVERSION, &len, &status);
+ StackUResourceBundle bundle;
+ ures_openDirectFillIn(bundle.getAlias(), NULL, kZONEINFO, &status);
+ const UChar *tzver = ures_getStringByKey(bundle.getAlias(), kTZVERSION, &len, &status);
if (U_SUCCESS(status)) {
if (len >= (int32_t)sizeof(TZDATA_VERSION)) {
@@ -1617,7 +1617,7 @@ TimeZone::getWindowsID(const UnicodeString& id, UnicodeString& winid, UErrorCode
end = tzids + len;
hasNext = FALSE;
}
- if (canonicalID.compare(start, static_cast<int32_t>(end - start)) == 0) {
+ if (canonicalID.compare(start, static_cast<int32_t>(end - start)) == 0) {
winid = UnicodeString(ures_getKey(winzone), -1 , US_INV);
found = TRUE;
break;
@@ -1678,7 +1678,7 @@ TimeZone::getIDForWindowsID(const UnicodeString& winid, const char* region, Unic
if (end == NULL) {
id.setTo(tzids, -1);
} else {
- id.setTo(tzids, static_cast<int32_t>(end - tzids));
+ id.setTo(tzids, static_cast<int32_t>(end - tzids));
}
gotID = TRUE;
}
diff --git a/contrib/libs/icu/i18n/titletrn.cpp b/contrib/libs/icu/i18n/titletrn.cpp
index 9027838a91..9c39b4676a 100644
--- a/contrib/libs/icu/i18n/titletrn.cpp
+++ b/contrib/libs/icu/i18n/titletrn.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -60,7 +60,7 @@ TitlecaseTransliterator::TitlecaseTransliterator(const TitlecaseTransliterator&
/**
* Transliterator API.
*/
-TitlecaseTransliterator* TitlecaseTransliterator::clone() const {
+TitlecaseTransliterator* TitlecaseTransliterator::clone() const {
return new TitlecaseTransliterator(*this);
}
@@ -97,7 +97,7 @@ void TitlecaseTransliterator::handleTransliterate(
int32_t start;
for (start = offsets.start - 1; start >= offsets.contextStart; start -= U16_LENGTH(c)) {
c = text.char32At(start);
- type=ucase_getTypeOrIgnorable(c);
+ type=ucase_getTypeOrIgnorable(c);
if(type>0) { // cased
doTitle=FALSE;
break;
@@ -118,19 +118,19 @@ void TitlecaseTransliterator::handleTransliterate(
UnicodeString tmp;
const UChar *s;
- int32_t textPos, delta, result;
+ int32_t textPos, delta, result;
for(textPos=offsets.start; textPos<offsets.limit;) {
csc.cpStart=textPos;
c=text.char32At(textPos);
csc.cpLimit=textPos+=U16_LENGTH(c);
- type=ucase_getTypeOrIgnorable(c);
+ type=ucase_getTypeOrIgnorable(c);
if(type>=0) { // not case-ignorable
if(doTitle) {
- result=ucase_toFullTitle(c, utrans_rep_caseContextIterator, &csc, &s, UCASE_LOC_ROOT);
+ result=ucase_toFullTitle(c, utrans_rep_caseContextIterator, &csc, &s, UCASE_LOC_ROOT);
} else {
- result=ucase_toFullLower(c, utrans_rep_caseContextIterator, &csc, &s, UCASE_LOC_ROOT);
+ result=ucase_toFullLower(c, utrans_rep_caseContextIterator, &csc, &s, UCASE_LOC_ROOT);
}
doTitle = (UBool)(type==0); // doTitle=isUncased
diff --git a/contrib/libs/icu/i18n/titletrn.h b/contrib/libs/icu/i18n/titletrn.h
index 04e64f3406..4e45ac6f81 100644
--- a/contrib/libs/icu/i18n/titletrn.h
+++ b/contrib/libs/icu/i18n/titletrn.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -52,7 +52,7 @@ class TitlecaseTransliterator : public CaseMapTransliterator {
* Transliterator API.
* @return a copy of the object.
*/
- virtual TitlecaseTransliterator* clone() const;
+ virtual TitlecaseTransliterator* clone() const;
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
diff --git a/contrib/libs/icu/i18n/tmunit.cpp b/contrib/libs/icu/i18n/tmunit.cpp
index 5f29a8f34a..910489b178 100644
--- a/contrib/libs/icu/i18n/tmunit.cpp
+++ b/contrib/libs/icu/i18n/tmunit.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -94,7 +94,7 @@ TimeUnit::TimeUnit(TimeUnit::UTimeUnitFields timeUnitField) {
initTime("second");
break;
default:
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
}
@@ -102,7 +102,7 @@ TimeUnit::TimeUnit(const TimeUnit& other)
: MeasureUnit(other), fTimeUnitField(other.fTimeUnitField) {
}
-TimeUnit*
+TimeUnit*
TimeUnit::clone() const {
return new TimeUnit(*this);
}
diff --git a/contrib/libs/icu/i18n/tmutamt.cpp b/contrib/libs/icu/i18n/tmutamt.cpp
index d221d23170..25464693ea 100644
--- a/contrib/libs/icu/i18n/tmutamt.cpp
+++ b/contrib/libs/icu/i18n/tmutamt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -50,7 +50,7 @@ TimeUnitAmount::operator==(const UObject& other) const {
return Measure::operator==(other);
}
-TimeUnitAmount*
+TimeUnitAmount*
TimeUnitAmount::clone() const {
return new TimeUnitAmount(*this);
}
diff --git a/contrib/libs/icu/i18n/tmutfmt.cpp b/contrib/libs/icu/i18n/tmutfmt.cpp
index 4ee9f2db6b..231ea5799c 100644
--- a/contrib/libs/icu/i18n/tmutfmt.cpp
+++ b/contrib/libs/icu/i18n/tmutfmt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -136,8 +136,8 @@ TimeUnitFormat::~TimeUnitFormat() {
}
-TimeUnitFormat*
-TimeUnitFormat::clone() const {
+TimeUnitFormat*
+TimeUnitFormat::clone() const {
return new TimeUnitFormat(*this);
}
@@ -224,7 +224,7 @@ TimeUnitFormat::parseObject(const UnicodeString& source,
if (temp.getType() == Formattable::kString) {
UnicodeString tmpString;
UErrorCode pStatus = U_ZERO_ERROR;
- getNumberFormatInternal().parse(temp.getString(tmpString), tmpNumber, pStatus);
+ getNumberFormatInternal().parse(temp.getString(tmpString), tmpNumber, pStatus);
if (U_FAILURE(pStatus)) {
continue;
}
@@ -685,7 +685,7 @@ TimeUnitFormat::setNumberFormat(const NumberFormat& format, UErrorCode& status){
if (U_FAILURE(status)) {
return;
}
- adoptNumberFormat(format.clone(), status);
+ adoptNumberFormat(format.clone(), status);
}
@@ -721,8 +721,8 @@ TimeUnitFormat::copyHash(const Hashtable* source, Hashtable* target, UErrorCode&
const UHashTok valueTok = element->value;
const MessageFormat** value = (const MessageFormat**)valueTok.pointer;
MessageFormat** newVal = (MessageFormat**)uprv_malloc(UTMUTFMT_FORMAT_STYLE_COUNT*sizeof(MessageFormat*));
- newVal[0] = value[0]->clone();
- newVal[1] = value[1]->clone();
+ newVal[0] = value[0]->clone();
+ newVal[1] = value[1]->clone();
target->put(UnicodeString(*key), newVal, status);
if ( U_FAILURE(status) ) {
delete newVal[0];
diff --git a/contrib/libs/icu/i18n/tolowtrn.cpp b/contrib/libs/icu/i18n/tolowtrn.cpp
index 8eed19c218..289327874e 100644
--- a/contrib/libs/icu/i18n/tolowtrn.cpp
+++ b/contrib/libs/icu/i18n/tolowtrn.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -58,7 +58,7 @@ LowercaseTransliterator::LowercaseTransliterator(const LowercaseTransliterator&
/**
* Transliterator API.
*/
-LowercaseTransliterator* LowercaseTransliterator::clone() const {
+LowercaseTransliterator* LowercaseTransliterator::clone() const {
return new LowercaseTransliterator(*this);
}
diff --git a/contrib/libs/icu/i18n/tolowtrn.h b/contrib/libs/icu/i18n/tolowtrn.h
index ce86f27d22..2fbfb90e1b 100644
--- a/contrib/libs/icu/i18n/tolowtrn.h
+++ b/contrib/libs/icu/i18n/tolowtrn.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -50,7 +50,7 @@ class LowercaseTransliterator : public CaseMapTransliterator {
* Transliterator API.
* @return a copy of the object.
*/
- virtual LowercaseTransliterator* clone() const;
+ virtual LowercaseTransliterator* clone() const;
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
diff --git a/contrib/libs/icu/i18n/toupptrn.cpp b/contrib/libs/icu/i18n/toupptrn.cpp
index 06311b5049..2a8b78b9a6 100644
--- a/contrib/libs/icu/i18n/toupptrn.cpp
+++ b/contrib/libs/icu/i18n/toupptrn.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -58,7 +58,7 @@ UppercaseTransliterator::UppercaseTransliterator(const UppercaseTransliterator&
/**
* Transliterator API.
*/
-UppercaseTransliterator* UppercaseTransliterator::clone() const {
+UppercaseTransliterator* UppercaseTransliterator::clone() const {
return new UppercaseTransliterator(*this);
}
diff --git a/contrib/libs/icu/i18n/toupptrn.h b/contrib/libs/icu/i18n/toupptrn.h
index bdc77ca55c..e96ca8f0ba 100644
--- a/contrib/libs/icu/i18n/toupptrn.h
+++ b/contrib/libs/icu/i18n/toupptrn.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -50,7 +50,7 @@ class UppercaseTransliterator : public CaseMapTransliterator {
* Transliterator API.
* @return a copy of the object.
*/
- virtual UppercaseTransliterator* clone() const;
+ virtual UppercaseTransliterator* clone() const;
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
diff --git a/contrib/libs/icu/i18n/translit.cpp b/contrib/libs/icu/i18n/translit.cpp
index b497d1aa87..ef44f42aa6 100644
--- a/contrib/libs/icu/i18n/translit.cpp
+++ b/contrib/libs/icu/i18n/translit.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -91,7 +91,7 @@ static const char RB_RULE_BASED_IDS[] = "RuleBasedTransliteratorIDs";
/**
* The mutex controlling access to registry object.
*/
-static icu::UMutex registryMutex;
+static icu::UMutex registryMutex;
/**
* System transliterator registry; non-null when initialized.
@@ -158,7 +158,7 @@ Transliterator::Transliterator(const Transliterator& other) :
if (other.filter != 0) {
// We own the filter, so we must have our own copy
- filter = other.filter->clone();
+ filter = other.filter->clone();
}
}
@@ -175,7 +175,7 @@ Transliterator& Transliterator::operator=(const Transliterator& other) {
ID.getTerminatedBuffer();
maximumContextLength = other.maximumContextLength;
- adoptFilter((other.filter == 0) ? 0 : other.filter->clone());
+ adoptFilter((other.filter == 0) ? 0 : other.filter->clone());
return *this;
}
@@ -923,15 +923,15 @@ Transliterator::createInstance(const UnicodeString& ID,
return NULL;
}
- UnicodeSet* globalFilter = nullptr;
+ UnicodeSet* globalFilter = nullptr;
// TODO add code for parseError...currently unused, but
// later may be used by parsing code...
if (!TransliteratorIDParser::parseCompoundID(ID, dir, canonID, list, globalFilter)) {
status = U_INVALID_ID;
- delete globalFilter;
+ delete globalFilter;
return NULL;
}
- LocalPointer<UnicodeSet> lpGlobalFilter(globalFilter);
+ LocalPointer<UnicodeSet> lpGlobalFilter(globalFilter);
TransliteratorIDParser::instantiateList(list, status);
if (U_FAILURE(status)) {
@@ -955,8 +955,8 @@ Transliterator::createInstance(const UnicodeString& ID,
// Check null pointer
if (t != NULL) {
t->setID(canonID);
- if (lpGlobalFilter.isValid()) {
- t->adoptFilter(lpGlobalFilter.orphan());
+ if (lpGlobalFilter.isValid()) {
+ t->adoptFilter(lpGlobalFilter.orphan());
}
}
else if (U_SUCCESS(status)) {
@@ -1103,10 +1103,10 @@ Transliterator::createFromRules(const UnicodeString& ID,
UnicodeString* idBlock = (UnicodeString*)parser.idBlockVector.elementAt(i);
if (!idBlock->isEmpty()) {
Transliterator* temp = createInstance(*idBlock, UTRANS_FORWARD, parseError, status);
- if (U_FAILURE(status)) {
- delete temp;
- return nullptr;
- }
+ if (U_FAILURE(status)) {
+ delete temp;
+ return nullptr;
+ }
if (temp != NULL && typeid(*temp) != typeid(NullTransliterator))
transliterators.addElement(temp, status);
else
@@ -1120,10 +1120,10 @@ Transliterator::createFromRules(const UnicodeString& ID,
data, TRUE);
// Check if NULL before adding it to transliterators to avoid future usage of NULL pointer.
if (temprbt == NULL) {
- if (U_SUCCESS(status)) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
- return t;
+ if (U_SUCCESS(status)) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
+ return t;
}
transliterators.addElement(temprbt, status);
}
@@ -1508,35 +1508,35 @@ UBool Transliterator::initializeRegistry(UErrorCode &status) {
*/
//static const char translit_index[] = "translit_index";
- UErrorCode lstatus = U_ZERO_ERROR;
+ UErrorCode lstatus = U_ZERO_ERROR;
UResourceBundle *bundle, *transIDs, *colBund;
- bundle = ures_open(U_ICUDATA_TRANSLIT, NULL/*open default locale*/, &lstatus);
- transIDs = ures_getByKey(bundle, RB_RULE_BASED_IDS, 0, &lstatus);
+ bundle = ures_open(U_ICUDATA_TRANSLIT, NULL/*open default locale*/, &lstatus);
+ transIDs = ures_getByKey(bundle, RB_RULE_BASED_IDS, 0, &lstatus);
const UnicodeString T_PART = UNICODE_STRING_SIMPLE("-t-");
int32_t row, maxRows;
- if (lstatus == U_MEMORY_ALLOCATION_ERROR) {
- delete registry;
- registry = nullptr;
- status = U_MEMORY_ALLOCATION_ERROR;
- return FALSE;
- }
- if (U_SUCCESS(lstatus)) {
+ if (lstatus == U_MEMORY_ALLOCATION_ERROR) {
+ delete registry;
+ registry = nullptr;
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return FALSE;
+ }
+ if (U_SUCCESS(lstatus)) {
maxRows = ures_getSize(transIDs);
for (row = 0; row < maxRows; row++) {
- colBund = ures_getByIndex(transIDs, row, 0, &lstatus);
- if (U_SUCCESS(lstatus)) {
+ colBund = ures_getByIndex(transIDs, row, 0, &lstatus);
+ if (U_SUCCESS(lstatus)) {
UnicodeString id(ures_getKey(colBund), -1, US_INV);
if(id.indexOf(T_PART) != -1) {
ures_close(colBund);
continue;
}
- UResourceBundle* res = ures_getNextResource(colBund, NULL, &lstatus);
+ UResourceBundle* res = ures_getNextResource(colBund, NULL, &lstatus);
const char* typeStr = ures_getKey(res);
UChar type;
u_charsToUChars(typeStr, &type, 1);
- if (U_SUCCESS(lstatus)) {
+ if (U_SUCCESS(lstatus)) {
int32_t len = 0;
const UChar *resString;
switch (type) {
@@ -1546,19 +1546,19 @@ UBool Transliterator::initializeRegistry(UErrorCode &status) {
// row[2]=resource, row[3]=direction
{
- resString = ures_getStringByKey(res, "resource", &len, &lstatus);
+ resString = ures_getStringByKey(res, "resource", &len, &lstatus);
UBool visible = (type == 0x0066 /*f*/);
UTransDirection dir =
- (ures_getUnicodeStringByKey(res, "direction", &lstatus).charAt(0) ==
+ (ures_getUnicodeStringByKey(res, "direction", &lstatus).charAt(0) ==
0x0046 /*F*/) ?
UTRANS_FORWARD : UTRANS_REVERSE;
- registry->put(id, UnicodeString(TRUE, resString, len), dir, TRUE, visible, lstatus);
+ registry->put(id, UnicodeString(TRUE, resString, len), dir, TRUE, visible, lstatus);
}
break;
case 0x61: // 'a'
// 'alias'; row[2]=createInstance argument
- resString = ures_getString(res, &len, &lstatus);
- registry->put(id, UnicodeString(TRUE, resString, len), TRUE, TRUE, lstatus);
+ resString = ures_getString(res, &len, &lstatus);
+ registry->put(id, UnicodeString(TRUE, resString, len), TRUE, TRUE, lstatus);
break;
}
}
diff --git a/contrib/libs/icu/i18n/transreg.cpp b/contrib/libs/icu/i18n/transreg.cpp
index dae00b0c0b..c412a20079 100644
--- a/contrib/libs/icu/i18n/transreg.cpp
+++ b/contrib/libs/icu/i18n/transreg.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -46,29 +46,29 @@ static const UChar LOCALE_SEP = 95; // '_'
//static const UChar VARIANT_SEP = 0x002F; // '/'
// String constants
-static const UChar ANY[] = { 0x41, 0x6E, 0x79, 0 }; // Any
-static const UChar LAT[] = { 0x4C, 0x61, 0x74, 0 }; // Lat
+static const UChar ANY[] = { 0x41, 0x6E, 0x79, 0 }; // Any
+static const UChar LAT[] = { 0x4C, 0x61, 0x74, 0 }; // Lat
// empty string
#define NO_VARIANT UnicodeString()
-// initial estimate for specDAG size
-// ICU 60 Transliterator::countAvailableSources()
-#define SPECDAG_INIT_SIZE 149
-
-// initial estimate for number of variant names
-#define VARIANT_LIST_INIT_SIZE 11
-#define VARIANT_LIST_MAX_SIZE 31
-
-// initial estimate for availableIDs count (default estimate is 8 => multiple reallocs)
-// ICU 60 Transliterator::countAvailableIDs()
-#define AVAILABLE_IDS_INIT_SIZE 641
-
-// initial estimate for number of targets for source "Any", "Lat"
-// ICU 60 Transliterator::countAvailableTargets("Any")/("Latn")
-#define ANY_TARGETS_INIT_SIZE 125
-#define LAT_TARGETS_INIT_SIZE 23
-
+// initial estimate for specDAG size
+// ICU 60 Transliterator::countAvailableSources()
+#define SPECDAG_INIT_SIZE 149
+
+// initial estimate for number of variant names
+#define VARIANT_LIST_INIT_SIZE 11
+#define VARIANT_LIST_MAX_SIZE 31
+
+// initial estimate for availableIDs count (default estimate is 8 => multiple reallocs)
+// ICU 60 Transliterator::countAvailableIDs()
+#define AVAILABLE_IDS_INIT_SIZE 641
+
+// initial estimate for number of targets for source "Any", "Lat"
+// ICU 60 Transliterator::countAvailableTargets("Any")/("Latn")
+#define ANY_TARGETS_INIT_SIZE 125
+#define LAT_TARGETS_INIT_SIZE 23
+
/**
* Resource bundle key for the RuleBasedTransliterator rule.
*/
@@ -131,7 +131,7 @@ Transliterator* TransliteratorAlias::create(UParseError& pe,
return 0;
}
if (compoundFilter != 0)
- t->adoptFilter(compoundFilter->clone());
+ t->adoptFilter(compoundFilter->clone());
break;
case COMPOUND:
{
@@ -173,8 +173,8 @@ Transliterator* TransliteratorAlias::create(UParseError& pe,
if (U_SUCCESS(ec)) {
t = new CompoundTransliterator(ID, transliterators,
- (compoundFilter ? compoundFilter->clone() : nullptr),
- anonymousRBTs, pe, ec);
+ (compoundFilter ? compoundFilter->clone() : nullptr),
+ anonymousRBTs, pe, ec);
if (t == 0) {
ec = U_MEMORY_ALLOCATION_ERROR;
return 0;
@@ -186,7 +186,7 @@ Transliterator* TransliteratorAlias::create(UParseError& pe,
}
break;
case RULES:
- UPRV_UNREACHABLE; // don't call create() if isRuleBased() returns TRUE!
+ UPRV_UNREACHABLE; // don't call create() if isRuleBased() returns TRUE!
}
return t;
}
@@ -534,17 +534,17 @@ U_CDECL_END
TransliteratorRegistry::TransliteratorRegistry(UErrorCode& status) :
registry(TRUE, status),
- specDAG(TRUE, SPECDAG_INIT_SIZE, status),
- variantList(VARIANT_LIST_INIT_SIZE, status),
- availableIDs(AVAILABLE_IDS_INIT_SIZE, status)
+ specDAG(TRUE, SPECDAG_INIT_SIZE, status),
+ variantList(VARIANT_LIST_INIT_SIZE, status),
+ availableIDs(AVAILABLE_IDS_INIT_SIZE, status)
{
registry.setValueDeleter(deleteEntry);
- variantList.setDeleter(uprv_deleteUObject);
- variantList.setComparer(uhash_compareCaselessUnicodeString);
- UnicodeString *emptyString = new UnicodeString();
- if (emptyString != NULL) {
- variantList.addElement(emptyString, status);
- }
+ variantList.setDeleter(uprv_deleteUObject);
+ variantList.setComparer(uhash_compareCaselessUnicodeString);
+ UnicodeString *emptyString = new UnicodeString();
+ if (emptyString != NULL) {
+ variantList.addElement(emptyString, status);
+ }
availableIDs.setDeleter(uprv_deleteUObject);
availableIDs.setComparer(uhash_compareCaselessUnicodeString);
specDAG.setValueDeleter(uhash_deleteHashtable);
@@ -805,15 +805,15 @@ int32_t TransliteratorRegistry::countAvailableVariants(const UnicodeString& sour
if (targets == 0) {
return 0;
}
- uint32_t varMask = targets->geti(target);
- int32_t varCount = 0;
- while (varMask > 0) {
- if (varMask & 1) {
- varCount++;
- }
- varMask >>= 1;
- }
- return varCount;
+ uint32_t varMask = targets->geti(target);
+ int32_t varCount = 0;
+ while (varMask > 0) {
+ if (varMask & 1) {
+ varCount++;
+ }
+ varMask >>= 1;
+ }
+ return varCount;
}
UnicodeString& TransliteratorRegistry::getAvailableVariant(int32_t index,
@@ -825,25 +825,25 @@ UnicodeString& TransliteratorRegistry::getAvailableVariant(int32_t index,
result.truncate(0); // invalid source
return result;
}
- uint32_t varMask = targets->geti(target);
- int32_t varCount = 0;
- int32_t varListIndex = 0;
- while (varMask > 0) {
- if (varMask & 1) {
- if (varCount == index) {
- UnicodeString *v = (UnicodeString*) variantList.elementAt(varListIndex);
- if (v != NULL) {
- result = *v;
- return result;
- }
- break;
- }
- varCount++;
- }
- varMask >>= 1;
- varListIndex++;
+ uint32_t varMask = targets->geti(target);
+ int32_t varCount = 0;
+ int32_t varListIndex = 0;
+ while (varMask > 0) {
+ if (varMask & 1) {
+ if (varCount == index) {
+ UnicodeString *v = (UnicodeString*) variantList.elementAt(varListIndex);
+ if (v != NULL) {
+ result = *v;
+ return result;
+ }
+ break;
+ }
+ varCount++;
+ }
+ varMask >>= 1;
+ varListIndex++;
}
- result.truncate(0); // invalid target or index
+ result.truncate(0); // invalid target or index
return result;
}
@@ -946,12 +946,12 @@ void TransliteratorRegistry::registerEntry(const UnicodeString& ID,
if (visible) {
registerSTV(source, target, variant);
if (!availableIDs.contains((void*) &ID)) {
- UnicodeString *newID = ID.clone();
+ UnicodeString *newID = ID.clone();
// Check to make sure newID was created.
if (newID != NULL) {
- // NUL-terminate the ID string
- newID->getTerminatedBuffer();
- availableIDs.addElement(newID, status);
+ // NUL-terminate the ID string
+ newID->getTerminatedBuffer();
+ availableIDs.addElement(newID, status);
}
}
} else {
@@ -962,7 +962,7 @@ void TransliteratorRegistry::registerEntry(const UnicodeString& ID,
/**
* Register a source-target/variant in the specDAG. Variant may be
- * empty, but source and target must not be.
+ * empty, but source and target must not be.
*/
void TransliteratorRegistry::registerSTV(const UnicodeString& source,
const UnicodeString& target,
@@ -972,38 +972,38 @@ void TransliteratorRegistry::registerSTV(const UnicodeString& source,
UErrorCode status = U_ZERO_ERROR;
Hashtable *targets = (Hashtable*) specDAG.get(source);
if (targets == 0) {
- int32_t size = 3;
- if (source.compare(ANY,3) == 0) {
- size = ANY_TARGETS_INIT_SIZE;
- } else if (source.compare(LAT,3) == 0) {
- size = LAT_TARGETS_INIT_SIZE;
- }
- targets = new Hashtable(TRUE, size, status);
- if (U_FAILURE(status) || targets == NULL) {
+ int32_t size = 3;
+ if (source.compare(ANY,3) == 0) {
+ size = ANY_TARGETS_INIT_SIZE;
+ } else if (source.compare(LAT,3) == 0) {
+ size = LAT_TARGETS_INIT_SIZE;
+ }
+ targets = new Hashtable(TRUE, size, status);
+ if (U_FAILURE(status) || targets == NULL) {
return;
}
specDAG.put(source, targets, status);
}
- int32_t variantListIndex = variantList.indexOf((void*) &variant, 0);
- if (variantListIndex < 0) {
- if (variantList.size() >= VARIANT_LIST_MAX_SIZE) {
- // can't handle any more variants
+ int32_t variantListIndex = variantList.indexOf((void*) &variant, 0);
+ if (variantListIndex < 0) {
+ if (variantList.size() >= VARIANT_LIST_MAX_SIZE) {
+ // can't handle any more variants
return;
}
- UnicodeString *variantEntry = new UnicodeString(variant);
- if (variantEntry != NULL) {
- variantList.addElement(variantEntry, status);
- if (U_SUCCESS(status)) {
- variantListIndex = variantList.size() - 1;
- }
+ UnicodeString *variantEntry = new UnicodeString(variant);
+ if (variantEntry != NULL) {
+ variantList.addElement(variantEntry, status);
+ if (U_SUCCESS(status)) {
+ variantListIndex = variantList.size() - 1;
+ }
+ }
+ if (variantListIndex < 0) {
+ return;
}
- if (variantListIndex < 0) {
- return;
- }
}
- uint32_t addMask = 1 << variantListIndex;
- uint32_t varMask = targets->geti(target);
- targets->puti(target, varMask | addMask, status);
+ uint32_t addMask = 1 << variantListIndex;
+ uint32_t varMask = targets->geti(target);
+ targets->puti(target, varMask | addMask, status);
}
/**
@@ -1014,24 +1014,24 @@ void TransliteratorRegistry::removeSTV(const UnicodeString& source,
const UnicodeString& variant) {
// assert(source.length() > 0);
// assert(target.length() > 0);
- UErrorCode status = U_ZERO_ERROR;
+ UErrorCode status = U_ZERO_ERROR;
Hashtable *targets = (Hashtable*) specDAG.get(source);
- if (targets == NULL) {
+ if (targets == NULL) {
return; // should never happen for valid s-t/v
}
- uint32_t varMask = targets->geti(target);
- if (varMask == 0) {
+ uint32_t varMask = targets->geti(target);
+ if (varMask == 0) {
return; // should never happen for valid s-t/v
}
- int32_t variantListIndex = variantList.indexOf((void*) &variant, 0);
- if (variantListIndex < 0) {
- return; // should never happen for valid s-t/v
- }
- int32_t remMask = 1 << variantListIndex;
- varMask &= (~remMask);
- if (varMask != 0) {
- targets->puti(target, varMask, status);
- } else {
+ int32_t variantListIndex = variantList.indexOf((void*) &variant, 0);
+ if (variantListIndex < 0) {
+ return; // should never happen for valid s-t/v
+ }
+ int32_t remMask = 1 << variantListIndex;
+ varMask &= (~remMask);
+ if (varMask != 0) {
+ targets->puti(target, varMask, status);
+ } else {
targets->remove(target); // should delete variants
if (targets->count() == 0) {
specDAG.remove(source); // should delete targets
@@ -1323,18 +1323,18 @@ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID
UVector* rbts = new UVector(entry->u.dataVector->size(), status);
// Check for null pointer
if (rbts == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
}
int32_t passNumber = 1;
for (int32_t i = 0; U_SUCCESS(status) && i < entry->u.dataVector->size(); i++) {
// TODO: Should passNumber be turned into a decimal-string representation (1 -> "1")?
- Transliterator* tl = new RuleBasedTransliterator(UnicodeString(CompoundTransliterator::PASS_STRING) + UnicodeString(passNumber++),
+ Transliterator* tl = new RuleBasedTransliterator(UnicodeString(CompoundTransliterator::PASS_STRING) + UnicodeString(passNumber++),
(TransliterationRuleData*)(entry->u.dataVector->elementAt(i)), FALSE);
- if (tl == 0)
+ if (tl == 0)
status = U_MEMORY_ALLOCATION_ERROR;
else
- rbts->addElement(tl, status);
+ rbts->addElement(tl, status);
}
if (U_FAILURE(status)) {
delete rbts;
@@ -1395,7 +1395,7 @@ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID
}
return 0;
default:
- UPRV_UNREACHABLE; // can't get here
+ UPRV_UNREACHABLE; // can't get here
}
}
U_NAMESPACE_END
diff --git a/contrib/libs/icu/i18n/transreg.h b/contrib/libs/icu/i18n/transreg.h
index a90a8f6848..041244e1b0 100644
--- a/contrib/libs/icu/i18n/transreg.h
+++ b/contrib/libs/icu/i18n/transreg.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -440,16 +440,16 @@ class TransliteratorRegistry : public UMemory {
/**
* DAG of visible IDs by spec. Hashtable: source => (Hashtable:
- * target => variant bitmask)
+ * target => variant bitmask)
*/
Hashtable specDAG;
/**
- * Vector of all variant names
- */
- UVector variantList;
-
- /**
+ * Vector of all variant names
+ */
+ UVector variantList;
+
+ /**
* Vector of public full IDs.
*/
UVector availableIDs;
diff --git a/contrib/libs/icu/i18n/tridpars.cpp b/contrib/libs/icu/i18n/tridpars.cpp
index daa75fcb71..65bfc88063 100644
--- a/contrib/libs/icu/i18n/tridpars.cpp
+++ b/contrib/libs/icu/i18n/tridpars.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -50,7 +50,7 @@ static UInitOnce gSpecialInversesInitOnce = U_INITONCE_INITIALIZER;
/**
* The mutex controlling access to SPECIAL_INVERSES
*/
-static UMutex LOCK;
+static UMutex LOCK;
TransliteratorIDParser::Specs::Specs(const UnicodeString& s, const UnicodeString& t,
const UnicodeString& v, UBool sawS,
@@ -294,7 +294,7 @@ UnicodeSet* TransliteratorIDParser::parseGlobalFilter(const UnicodeString& id, i
pos = ppos.getIndex();
if (withParens == 1 && !ICU_Utility::parseChar(id, pos, CLOSE_REV)) {
- delete filter;
+ delete filter;
pos = start;
return NULL;
}
diff --git a/contrib/libs/icu/i18n/tridpars.h b/contrib/libs/icu/i18n/tridpars.h
index 1a87a808ae..5e42f068a4 100644
--- a/contrib/libs/icu/i18n/tridpars.h
+++ b/contrib/libs/icu/i18n/tridpars.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**************************************************************************
diff --git a/contrib/libs/icu/i18n/tzfmt.cpp b/contrib/libs/icu/i18n/tzfmt.cpp
index 62faa96eaa..f87f0f67b1 100644
--- a/contrib/libs/icu/i18n/tzfmt.cpp
+++ b/contrib/libs/icu/i18n/tzfmt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -14,27 +14,27 @@
#include "unicode/calendar.h"
#include "unicode/tzfmt.h"
#include "unicode/numsys.h"
-#include "unicode/strenum.h"
+#include "unicode/strenum.h"
#include "unicode/uchar.h"
#include "unicode/udat.h"
-#include "unicode/ustring.h"
-#include "unicode/utf16.h"
-#include "bytesinkutil.h"
-#include "charstr.h"
+#include "unicode/ustring.h"
+#include "unicode/utf16.h"
+#include "bytesinkutil.h"
+#include "charstr.h"
#include "tzgnames.h"
#include "cmemory.h"
#include "cstring.h"
#include "putilimp.h"
#include "uassert.h"
#include "ucln_in.h"
-#include "ulocimp.h"
+#include "ulocimp.h"
#include "umutex.h"
#include "uresimp.h"
#include "ureslocs.h"
#include "uvector.h"
#include "zonemeta.h"
#include "tznames_impl.h" // TextTrieMap
-#include "patternprops.h"
+#include "patternprops.h"
U_NAMESPACE_BEGIN
@@ -150,7 +150,7 @@ static icu::UInitOnce gZoneIdTrieInitOnce = U_INITONCE_INITIALIZER;
static TextTrieMap *gShortZoneIdTrie = NULL;
static icu::UInitOnce gShortZoneIdTrieInitOnce = U_INITONCE_INITIALIZER;
-static UMutex gLock;
+static UMutex gLock;
U_CDECL_BEGIN
/**
@@ -270,7 +270,7 @@ GMTOffsetField::isValid(FieldType type, int32_t width) {
case SECOND:
return (width == 2);
default:
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
return (width > 0);
}
@@ -325,15 +325,15 @@ TimeZoneFormat::TimeZoneFormat(const Locale& locale, UErrorCode& status)
}
const char* region = fLocale.getCountry();
- int32_t regionLen = static_cast<int32_t>(uprv_strlen(region));
+ int32_t regionLen = static_cast<int32_t>(uprv_strlen(region));
if (regionLen == 0) {
- CharString loc;
- {
- CharStringByteSink sink(&loc);
- ulocimp_addLikelySubtags(fLocale.getName(), sink, &status);
- }
+ CharString loc;
+ {
+ CharStringByteSink sink(&loc);
+ ulocimp_addLikelySubtags(fLocale.getName(), sink, &status);
+ }
- regionLen = uloc_getCountry(loc.data(), fTargetRegion, sizeof(fTargetRegion), &status);
+ regionLen = uloc_getCountry(loc.data(), fTargetRegion, sizeof(fTargetRegion), &status);
if (U_SUCCESS(status)) {
fTargetRegion[regionLen] = 0;
} else {
@@ -505,7 +505,7 @@ TimeZoneFormat::operator==(const Format& other) const {
return isEqual;
}
-TimeZoneFormat*
+TimeZoneFormat*
TimeZoneFormat::clone() const {
return new TimeZoneFormat(*this);
}
@@ -595,7 +595,7 @@ TimeZoneFormat::setGMTOffsetPattern(UTimeZoneFormatGMTOffsetPatternType type, co
required = FIELDS_HMS;
break;
default:
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
UVector* patternItems = parseOffsetPattern(pattern, required, status);
@@ -795,7 +795,7 @@ TimeZoneFormat::format(const Formattable& obj, UnicodeString& appendTo,
if (tz != NULL) {
int32_t rawOffset, dstOffset;
tz->getOffset(date, FALSE, rawOffset, dstOffset, status);
- UChar buf[ZONE_NAME_U16_MAX];
+ UChar buf[ZONE_NAME_U16_MAX];
UnicodeString result(buf, 0, UPRV_LENGTHOF(buf));
formatOffsetLocalizedGMT(rawOffset + dstOffset, result, status);
if (U_SUCCESS(status)) {
@@ -1033,7 +1033,7 @@ TimeZoneFormat::parse(UTimeZoneFormatStyle style, const UnicodeString& text, Par
break;
default:
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
int32_t len = 0;
@@ -1421,7 +1421,7 @@ TimeZoneFormat::getTZDBTimeZoneNames(UErrorCode& status) const {
UnicodeString&
TimeZoneFormat::formatExemplarLocation(const TimeZone& tz, UnicodeString& name) const {
- UChar locationBuf[ZONE_NAME_U16_MAX];
+ UChar locationBuf[ZONE_NAME_U16_MAX];
UnicodeString location(locationBuf, 0, UPRV_LENGTHOF(locationBuf));
const UChar* canonicalID = ZoneMeta::getCanonicalCLDRID(tz);
@@ -1819,9 +1819,9 @@ TimeZoneFormat::parseOffsetFields(const UnicodeString& text, int32_t start, UBoo
// but it should be parsed as 00:10:20.
int32_t tmpLen = 0;
int32_t tmpSign = 1;
- int32_t tmpH = 0;
- int32_t tmpM = 0;
- int32_t tmpS = 0;
+ int32_t tmpH = 0;
+ int32_t tmpM = 0;
+ int32_t tmpS = 0;
for (int32_t patidx = 0; PARSE_GMT_OFFSET_TYPES[patidx] >= 0; patidx++) {
int32_t gmtPatType = PARSE_GMT_OFFSET_TYPES[patidx];
@@ -1869,27 +1869,27 @@ TimeZoneFormat::parseOffsetFieldsWithPattern(const UnicodeString& text, int32_t
if (fieldType == GMTOffsetField::TEXT) {
const UChar* patStr = field->getPatternText();
len = u_strlen(patStr);
- if (i == 0) {
- // When TimeZoneFormat parse() is called from SimpleDateFormat,
- // leading space characters might be truncated. If the first pattern text
- // starts with such character (e.g. Bidi control), then we need to
- // skip the leading space charcters.
- if (idx < text.length() && !PatternProps::isWhiteSpace(text.char32At(idx))) {
- while (len > 0) {
- UChar32 ch;
- int32_t chLen;
- U16_GET(patStr, 0, 0, len, ch);
- if (PatternProps::isWhiteSpace(ch)) {
- chLen = U16_LENGTH(ch);
- len -= chLen;
- patStr += chLen;
- }
- else {
- break;
- }
- }
- }
- }
+ if (i == 0) {
+ // When TimeZoneFormat parse() is called from SimpleDateFormat,
+ // leading space characters might be truncated. If the first pattern text
+ // starts with such character (e.g. Bidi control), then we need to
+ // skip the leading space charcters.
+ if (idx < text.length() && !PatternProps::isWhiteSpace(text.char32At(idx))) {
+ while (len > 0) {
+ UChar32 ch;
+ int32_t chLen;
+ U16_GET(patStr, 0, 0, len, ch);
+ if (PatternProps::isWhiteSpace(ch)) {
+ chLen = U16_LENGTH(ch);
+ len -= chLen;
+ patStr += chLen;
+ }
+ else {
+ break;
+ }
+ }
+ }
+ }
if (text.caseCompare(idx, len, patStr, 0) != 0) {
failed = TRUE;
break;
@@ -2458,7 +2458,7 @@ TimeZoneFormat::parseOffsetPattern(const UnicodeString& pattern, OffsetFields re
isPrevQuote = TRUE;
if (itemType != GMTOffsetField::TEXT) {
if (GMTOffsetField::isValid(itemType, itemLength)) {
- GMTOffsetField* fld = GMTOffsetField::createTimeField(itemType, static_cast<uint8_t>(itemLength), status);
+ GMTOffsetField* fld = GMTOffsetField::createTimeField(itemType, static_cast<uint8_t>(itemLength), status);
result->addElement(fld, status);
if (U_FAILURE(status)) {
break;
@@ -2493,7 +2493,7 @@ TimeZoneFormat::parseOffsetPattern(const UnicodeString& pattern, OffsetFields re
}
} else {
if (GMTOffsetField::isValid(itemType, itemLength)) {
- GMTOffsetField* fld = GMTOffsetField::createTimeField(itemType, static_cast<uint8_t>(itemLength), status);
+ GMTOffsetField* fld = GMTOffsetField::createTimeField(itemType, static_cast<uint8_t>(itemLength), status);
result->addElement(fld, status);
if (U_FAILURE(status)) {
break;
@@ -2511,7 +2511,7 @@ TimeZoneFormat::parseOffsetPattern(const UnicodeString& pattern, OffsetFields re
// a string literal
if (itemType != GMTOffsetField::TEXT) {
if (GMTOffsetField::isValid(itemType, itemLength)) {
- GMTOffsetField* fld = GMTOffsetField::createTimeField(itemType, static_cast<uint8_t>(itemLength), status);
+ GMTOffsetField* fld = GMTOffsetField::createTimeField(itemType, static_cast<uint8_t>(itemLength), status);
result->addElement(fld, status);
if (U_FAILURE(status)) {
break;
@@ -2536,7 +2536,7 @@ TimeZoneFormat::parseOffsetPattern(const UnicodeString& pattern, OffsetFields re
}
} else {
if (GMTOffsetField::isValid(itemType, itemLength)) {
- GMTOffsetField* fld = GMTOffsetField::createTimeField(itemType, static_cast<uint8_t>(itemLength), status);
+ GMTOffsetField* fld = GMTOffsetField::createTimeField(itemType, static_cast<uint8_t>(itemLength), status);
result->addElement(fld, status);
} else {
status = U_ILLEGAL_ARGUMENT_ERROR;
@@ -2653,12 +2653,12 @@ TimeZoneFormat::checkAbuttingHoursAndMinutes() {
UVector *items = fGMTOffsetPatternItems[type];
for (int32_t i = 0; i < items->size(); i++) {
const GMTOffsetField* item = (GMTOffsetField*)items->elementAt(i);
- GMTOffsetField::FieldType fieldType = item->getType();
- if (fieldType != GMTOffsetField::TEXT) {
+ GMTOffsetField::FieldType fieldType = item->getType();
+ if (fieldType != GMTOffsetField::TEXT) {
if (afterH) {
fAbuttingOffsetHoursAndMinutes = TRUE;
break;
- } else if (fieldType == GMTOffsetField::HOUR) {
+ } else if (fieldType == GMTOffsetField::HOUR) {
afterH = TRUE;
}
} else if (afterH) {
@@ -2782,7 +2782,7 @@ static void U_CALLCONV initZoneIdTrie(UErrorCode &status) {
}
StringEnumeration *tzenum = TimeZone::createEnumeration();
const UnicodeString *id;
- while ((id = tzenum->snext(status)) != NULL) {
+ while ((id = tzenum->snext(status)) != NULL) {
const UChar* uid = ZoneMeta::findTimeZoneID(*id);
if (uid) {
gZoneIdTrie->put(uid, const_cast<UChar *>(uid), status);
@@ -2829,7 +2829,7 @@ static void U_CALLCONV initShortZoneIdTrie(UErrorCode &status) {
status = U_MEMORY_ALLOCATION_ERROR;
} else {
const UnicodeString *id;
- while ((id = tzenum->snext(status)) != NULL) {
+ while ((id = tzenum->snext(status)) != NULL) {
const UChar* uID = ZoneMeta::findTimeZoneID(*id);
const UChar* shortID = ZoneMeta::getShortID(*id);
if (shortID && uID) {
diff --git a/contrib/libs/icu/i18n/tzgnames.cpp b/contrib/libs/icu/i18n/tzgnames.cpp
index 94d00d7e8d..e056461dc3 100644
--- a/contrib/libs/icu/i18n/tzgnames.cpp
+++ b/contrib/libs/icu/i18n/tzgnames.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -18,18 +18,18 @@
#include "unicode/rbtz.h"
#include "unicode/simpleformatter.h"
#include "unicode/simpletz.h"
-#include "unicode/strenum.h"
+#include "unicode/strenum.h"
#include "unicode/vtzone.h"
-#include "bytesinkutil.h"
-#include "charstr.h"
+#include "bytesinkutil.h"
+#include "charstr.h"
#include "cmemory.h"
#include "cstring.h"
#include "mutex.h"
#include "uhash.h"
#include "uassert.h"
#include "umutex.h"
-#include "ulocimp.h"
+#include "ulocimp.h"
#include "uresimp.h"
#include "ureslocs.h"
#include "zonemeta.h"
@@ -272,7 +272,7 @@ GNameSearchHandler::getMatches(int32_t& maxMatchLen) {
return results;
}
-static UMutex gLock;
+static UMutex gLock;
class TZGNCore : public UMemory {
public:
@@ -410,15 +410,15 @@ TZGNCore::initialize(const Locale& locale, UErrorCode& status) {
// target region
const char* region = fLocale.getCountry();
- int32_t regionLen = static_cast<int32_t>(uprv_strlen(region));
+ int32_t regionLen = static_cast<int32_t>(uprv_strlen(region));
if (regionLen == 0) {
- CharString loc;
- {
- CharStringByteSink sink(&loc);
- ulocimp_addLikelySubtags(fLocale.getName(), sink, &status);
- }
+ CharString loc;
+ {
+ CharStringByteSink sink(&loc);
+ ulocimp_addLikelySubtags(fLocale.getName(), sink, &status);
+ }
- regionLen = uloc_getCountry(loc.data(), fTargetRegion, sizeof(fTargetRegion), &status);
+ regionLen = uloc_getCountry(loc.data(), fTargetRegion, sizeof(fTargetRegion), &status);
if (U_SUCCESS(status)) {
fTargetRegion[regionLen] = 0;
} else {
@@ -621,7 +621,7 @@ TZGNCore::formatGenericNonLocationName(const TimeZone& tz, UTimeZoneGenericNameT
UErrorCode status = U_ZERO_ERROR;
UBool useStandard = FALSE;
int32_t raw, sav;
- UChar tmpNameBuf[ZONE_NAME_U16_MAX];
+ UChar tmpNameBuf[ZONE_NAME_U16_MAX];
tz.getOffset(date, FALSE, raw, sav, status);
if (U_FAILURE(status)) {
@@ -689,7 +689,7 @@ TZGNCore::formatGenericNonLocationName(const TimeZone& tz, UTimeZoneGenericNameT
// for some meta zones in some locales. This looks like a data bugs.
// For now, we check if the standard name is different from its generic
// name below.
- UChar genNameBuf[ZONE_NAME_U16_MAX];
+ UChar genNameBuf[ZONE_NAME_U16_MAX];
UnicodeString mzGenericName(genNameBuf, 0, UPRV_LENGTHOF(genNameBuf));
fTimeZoneNames->getMetaZoneDisplayName(mzID, nameType, mzGenericName);
if (stdName.caseCompare(mzGenericName, 0) == 0) {
@@ -862,7 +862,7 @@ TZGNCore::loadStrings(const UnicodeString& tzCanonicalID) {
};
StringEnumeration *mzIDs = fTimeZoneNames->getAvailableMetaZoneIDs(tzCanonicalID, status);
- while ((mzID = mzIDs->snext(status)) != NULL) {
+ while ((mzID = mzIDs->snext(status)) != NULL) {
if (U_FAILURE(status)) {
break;
}
@@ -1050,7 +1050,7 @@ TZGNCore::findLocal(const UnicodeString& text, int32_t start, uint32_t types, UE
StringEnumeration *tzIDs = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL, NULL, NULL, status);
if (U_SUCCESS(status)) {
const UnicodeString *tzID;
- while ((tzID = tzIDs->snext(status)) != NULL) {
+ while ((tzID = tzIDs->snext(status)) != NULL) {
if (U_FAILURE(status)) {
break;
}
@@ -1118,7 +1118,7 @@ typedef struct TZGNCoreRef {
} TZGNCoreRef;
// TZGNCore object cache handling
-static UMutex gTZGNLock;
+static UMutex gTZGNLock;
static UHashtable *gTZGNCoreCache = NULL;
static UBool gTZGNCoreCacheInitialized = FALSE;
@@ -1170,7 +1170,7 @@ static void sweepCache() {
const UHashElement* elem;
double now = (double)uprv_getUTCtime();
- while ((elem = uhash_nextElement(gTZGNCoreCache, &pos)) != NULL) {
+ while ((elem = uhash_nextElement(gTZGNCoreCache, &pos)) != NULL) {
TZGNCoreRef *entry = (TZGNCoreRef *)elem->value.pointer;
if (entry->refCount <= 0 && (now - entry->lastAccess) > CACHE_EXPIRATION) {
// delete this entry
diff --git a/contrib/libs/icu/i18n/tzgnames.h b/contrib/libs/icu/i18n/tzgnames.h
index ccfb253659..71d9d84dc0 100644
--- a/contrib/libs/icu/i18n/tzgnames.h
+++ b/contrib/libs/icu/i18n/tzgnames.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -46,7 +46,7 @@ public:
static TimeZoneGenericNames* createInstance(const Locale& locale, UErrorCode& status);
virtual UBool operator==(const TimeZoneGenericNames& other) const;
- virtual UBool operator!=(const TimeZoneGenericNames& other) const {return !operator==(other);}
+ virtual UBool operator!=(const TimeZoneGenericNames& other) const {return !operator==(other);}
virtual TimeZoneGenericNames* clone() const;
UnicodeString& getDisplayName(const TimeZone& tz, UTimeZoneGenericNameType type,
diff --git a/contrib/libs/icu/i18n/tznames.cpp b/contrib/libs/icu/i18n/tznames.cpp
index 4e18d1b4a9..d789c12363 100644
--- a/contrib/libs/icu/i18n/tznames.cpp
+++ b/contrib/libs/icu/i18n/tznames.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -29,7 +29,7 @@
U_NAMESPACE_BEGIN
// TimeZoneNames object cache handling
-static UMutex gTimeZoneNamesLock;
+static UMutex gTimeZoneNamesLock;
static UHashtable *gTimeZoneNamesCache = NULL;
static UBool gTimeZoneNamesCacheInitialized = FALSE;
@@ -87,7 +87,7 @@ static void sweepCache() {
const UHashElement* elem;
double now = (double)uprv_getUTCtime();
- while ((elem = uhash_nextElement(gTimeZoneNamesCache, &pos)) != 0) {
+ while ((elem = uhash_nextElement(gTimeZoneNamesCache, &pos)) != 0) {
TimeZoneNamesCacheEntry *entry = (TimeZoneNamesCacheEntry *)elem->value.pointer;
if (entry->refCount <= 0 && (now - entry->lastAccess) > CACHE_EXPIRATION) {
// delete this entry
@@ -105,8 +105,8 @@ public:
virtual ~TimeZoneNamesDelegate();
virtual UBool operator==(const TimeZoneNames& other) const;
- virtual UBool operator!=(const TimeZoneNames& other) const {return !operator==(other);}
- virtual TimeZoneNamesDelegate* clone() const;
+ virtual UBool operator!=(const TimeZoneNames& other) const {return !operator==(other);}
+ virtual TimeZoneNamesDelegate* clone() const;
StringEnumeration* getAvailableMetaZoneIDs(UErrorCode& status) const;
StringEnumeration* getAvailableMetaZoneIDs(const UnicodeString& tzID, UErrorCode& status) const;
@@ -233,7 +233,7 @@ TimeZoneNamesDelegate::operator==(const TimeZoneNames& other) const {
return FALSE;
}
-TimeZoneNamesDelegate*
+TimeZoneNamesDelegate*
TimeZoneNamesDelegate::clone() const {
TimeZoneNamesDelegate* other = new TimeZoneNamesDelegate();
if (other != NULL) {
diff --git a/contrib/libs/icu/i18n/tznames_impl.cpp b/contrib/libs/icu/i18n/tznames_impl.cpp
index 258f104506..186aaaf74d 100644
--- a/contrib/libs/icu/i18n/tznames_impl.cpp
+++ b/contrib/libs/icu/i18n/tznames_impl.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -15,20 +15,20 @@
#if !UCONFIG_NO_FORMATTING
-#include "unicode/strenum.h"
+#include "unicode/strenum.h"
#include "unicode/ustring.h"
#include "unicode/timezone.h"
-#include "unicode/utf16.h"
+#include "unicode/utf16.h"
#include "tznames_impl.h"
-#include "bytesinkutil.h"
-#include "charstr.h"
+#include "bytesinkutil.h"
+#include "charstr.h"
#include "cmemory.h"
#include "cstring.h"
#include "uassert.h"
#include "mutex.h"
#include "resource.h"
-#include "ulocimp.h"
+#include "ulocimp.h"
#include "uresimp.h"
#include "ureslocs.h"
#include "zonemeta.h"
@@ -52,7 +52,7 @@ static const UChar NO_NAME[] = { 0 }; // for empty no-fallback time
static const char* TZDBNAMES_KEYS[] = {"ss", "sd"};
static const int32_t TZDBNAMES_KEYS_SIZE = UPRV_LENGTHOF(TZDBNAMES_KEYS);
-static UMutex gDataMutex;
+static UMutex gDataMutex;
static UHashtable* gTZDBNamesMap = NULL;
static icu::UInitOnce gTZDBNamesMapInitOnce = U_INITONCE_INITIALIZER;
@@ -72,7 +72,7 @@ enum UTimeZoneNameTypeIndex {
UTZNM_INDEX_SHORT_DAYLIGHT,
UTZNM_INDEX_COUNT
};
-static const UChar* const EMPTY_NAMES[UTZNM_INDEX_COUNT] = {0,0,0,0,0,0,0};
+static const UChar* const EMPTY_NAMES[UTZNM_INDEX_COUNT] = {0,0,0,0,0,0,0};
U_CDECL_BEGIN
static UBool U_CALLCONV tzdbTimeZoneNames_cleanup(void) {
@@ -386,10 +386,10 @@ TextTrieMap::search(const UnicodeString &text, int32_t start,
// the ICU atomic safe functions for assigning and testing.
// Don't test the pointer fLazyContents.
// Don't do unless it's really required.
-
- // Mutex for protecting the lazy creation of the Trie node structure on the first call to search().
- static UMutex TextTrieMutex;
-
+
+ // Mutex for protecting the lazy creation of the Trie node structure on the first call to search().
+ static UMutex TextTrieMutex;
+
Mutex lock(&TextTrieMutex);
if (fLazyContents != NULL) {
TextTrieMap *nonConstThis = const_cast<TextTrieMap *>(this);
@@ -417,28 +417,28 @@ TextTrieMap::search(CharacterNode *node, const UnicodeString &text, int32_t star
}
}
if (fIgnoreCase) {
- // for folding we need to get a complete code point.
- // size of character may grow after fold operation;
- // then we need to get result as UTF16 code units.
- UChar32 c32 = text.char32At(index);
- index += U16_LENGTH(c32);
- UnicodeString tmp(c32);
+ // for folding we need to get a complete code point.
+ // size of character may grow after fold operation;
+ // then we need to get result as UTF16 code units.
+ UChar32 c32 = text.char32At(index);
+ index += U16_LENGTH(c32);
+ UnicodeString tmp(c32);
tmp.foldCase();
int32_t tmpidx = 0;
while (tmpidx < tmp.length()) {
- UChar c = tmp.charAt(tmpidx++);
+ UChar c = tmp.charAt(tmpidx++);
node = getChildNode(node, c);
if (node == NULL) {
break;
}
}
} else {
- // here we just get the next UTF16 code unit
- UChar c = text.charAt(index++);
+ // here we just get the next UTF16 code unit
+ UChar c = text.charAt(index++);
node = getChildNode(node, c);
}
if (node != NULL) {
- search(node, text, start, index, handler, status);
+ search(node, text, start, index, handler, status);
}
}
@@ -1079,7 +1079,7 @@ TimeZoneNamesImpl::loadStrings(const UnicodeString& tzCanonicalID, UErrorCode& s
U_ASSERT(!mzIDs.isNull());
const UnicodeString *mzID;
- while (((mzID = mzIDs->snext(status)) != NULL) && U_SUCCESS(status)) {
+ while (((mzID = mzIDs->snext(status)) != NULL) && U_SUCCESS(status)) {
loadMetaZoneNames(*mzID, status);
}
}
@@ -1113,7 +1113,7 @@ TimeZoneNamesImpl::operator==(const TimeZoneNames& other) const {
return FALSE;
}
-TimeZoneNamesImpl*
+TimeZoneNamesImpl*
TimeZoneNamesImpl::clone() const {
UErrorCode status = U_ZERO_ERROR;
return new TimeZoneNamesImpl(fLocale, status);
@@ -1289,7 +1289,7 @@ static void mergeTimeZoneKey(const UnicodeString& mzID, char* result) {
char mzIdChar[ZID_KEY_MAX + 1];
int32_t keyLen;
- int32_t prefixLen = static_cast<int32_t>(uprv_strlen(gMZPrefix));
+ int32_t prefixLen = static_cast<int32_t>(uprv_strlen(gMZPrefix));
keyLen = mzID.extract(0, mzID.length(), mzIdChar, ZID_KEY_MAX + 1, US_INV);
uprv_memcpy((void *)result, (void *)gMZPrefix, prefixLen);
uprv_memcpy((void *)(result + prefixLen), (void *)mzIdChar, keyLen);
@@ -1457,7 +1457,7 @@ struct TimeZoneNamesImpl::ZoneStringsLoader : public ResourceSink {
virtual ~ZoneStringsLoader();
void* createKey(const char* key, UErrorCode& status) {
- int32_t len = sizeof(char) * (static_cast<int32_t>(uprv_strlen(key)) + 1);
+ int32_t len = sizeof(char) * (static_cast<int32_t>(uprv_strlen(key)) + 1);
char* newKey = (char*) uprv_malloc(len);
if (newKey == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
@@ -1473,7 +1473,7 @@ struct TimeZoneNamesImpl::ZoneStringsLoader : public ResourceSink {
}
UnicodeString mzIDFromKey(const char* key) {
- return UnicodeString(key + MZ_PREFIX_LEN, static_cast<int32_t>(uprv_strlen(key)) - MZ_PREFIX_LEN, US_INV);
+ return UnicodeString(key + MZ_PREFIX_LEN, static_cast<int32_t>(uprv_strlen(key)) - MZ_PREFIX_LEN, US_INV);
}
UnicodeString tzIDFromKey(const char* key) {
@@ -1660,7 +1660,7 @@ void TimeZoneNamesImpl::internalLoadAllDisplayNames(UErrorCode& status) {
StringEnumeration *tzIDs = TimeZone::createTimeZoneIDEnumeration(
UCAL_ZONE_TYPE_CANONICAL, NULL, NULL, status);
if (U_SUCCESS(status)) {
- while ((id = tzIDs->snext(status)) != NULL) {
+ while ((id = tzIDs->snext(status)) != NULL) {
if (U_FAILURE(status)) {
break;
}
@@ -1948,8 +1948,8 @@ TZDBNameSearchHandler::handleMatch(int32_t matchLength, const CharacterNode *nod
// metazone mapping for "CST" is America_Central,
// but if region is one of CN/MO/TW, "CST" is parsed
// as metazone China (China Standard Time).
- for (int32_t j = 0; j < ninfo->nRegions; j++) {
- const char *region = ninfo->parseRegions[j];
+ for (int32_t j = 0; j < ninfo->nRegions; j++) {
+ const char *region = ninfo->parseRegions[j];
if (uprv_strcmp(fRegion, region) == 0) {
match = ninfo;
matchRegion = TRUE;
@@ -2063,11 +2063,11 @@ static void U_CALLCONV prepareFind(UErrorCode &status) {
const UnicodeString *mzID;
StringEnumeration *mzIDs = TimeZoneNamesImpl::_getAvailableMetaZoneIDs(status);
if (U_SUCCESS(status)) {
- while ((mzID = mzIDs->snext(status)) != 0 && U_SUCCESS(status)) {
+ while ((mzID = mzIDs->snext(status)) != 0 && U_SUCCESS(status)) {
const TZDBNames *names = TZDBTimeZoneNames::getMetaZoneNames(*mzID, status);
- if (U_FAILURE(status)) {
- break;
- }
+ if (U_FAILURE(status)) {
+ break;
+ }
if (names == NULL) {
continue;
}
@@ -2132,15 +2132,15 @@ TZDBTimeZoneNames::TZDBTimeZoneNames(const Locale& locale)
: fLocale(locale) {
UBool useWorld = TRUE;
const char* region = fLocale.getCountry();
- int32_t regionLen = static_cast<int32_t>(uprv_strlen(region));
+ int32_t regionLen = static_cast<int32_t>(uprv_strlen(region));
if (regionLen == 0) {
UErrorCode status = U_ZERO_ERROR;
- CharString loc;
- {
- CharStringByteSink sink(&loc);
- ulocimp_addLikelySubtags(fLocale.getName(), sink, &status);
- }
- regionLen = uloc_getCountry(loc.data(), fRegion, sizeof(fRegion), &status);
+ CharString loc;
+ {
+ CharStringByteSink sink(&loc);
+ ulocimp_addLikelySubtags(fLocale.getName(), sink, &status);
+ }
+ regionLen = uloc_getCountry(loc.data(), fRegion, sizeof(fRegion), &status);
if (U_SUCCESS(status) && regionLen < (int32_t)sizeof(fRegion)) {
useWorld = FALSE;
}
@@ -2165,7 +2165,7 @@ TZDBTimeZoneNames::operator==(const TimeZoneNames& other) const {
return FALSE;
}
-TZDBTimeZoneNames*
+TZDBTimeZoneNames*
TZDBTimeZoneNames::clone() const {
return new TZDBTimeZoneNames(fLocale);
}
@@ -2202,11 +2202,11 @@ TZDBTimeZoneNames::getMetaZoneDisplayName(const UnicodeString& mzID,
UErrorCode status = U_ZERO_ERROR;
const TZDBNames *tzdbNames = TZDBTimeZoneNames::getMetaZoneNames(mzID, status);
if (U_SUCCESS(status)) {
- if (tzdbNames != NULL) {
- const UChar *s = tzdbNames->getName(type);
- if (s != NULL) {
- name.setTo(TRUE, s, -1);
- }
+ if (tzdbNames != NULL) {
+ const UChar *s = tzdbNames->getName(type);
+ if (s != NULL) {
+ name.setTo(TRUE, s, -1);
+ }
}
}
@@ -2250,7 +2250,7 @@ TZDBTimeZoneNames::getMetaZoneNames(const UnicodeString& mzID, UErrorCode& statu
U_ASSERT(status == U_ZERO_ERROR); // already checked length above
mzIDKey[mzID.length()] = 0;
- static UMutex gTZDBNamesMapLock;
+ static UMutex gTZDBNamesMapLock;
umtx_lock(&gTZDBNamesMapLock);
{
void *cacheVal = uhash_get(gTZDBNamesMap, mzIDKey);
diff --git a/contrib/libs/icu/i18n/tznames_impl.h b/contrib/libs/icu/i18n/tznames_impl.h
index 2fdfa91667..1286eeb80d 100644
--- a/contrib/libs/icu/i18n/tznames_impl.h
+++ b/contrib/libs/icu/i18n/tznames_impl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -27,9 +27,9 @@
#include "uvector.h"
#include "umutex.h"
-// Some zone display names involving supplementary characters can be over 50 chars, 100 UTF-16 code units, 200 UTF-8 bytes
-#define ZONE_NAME_U16_MAX 128
-
+// Some zone display names involving supplementary characters can be over 50 chars, 100 UTF-16 code units, 200 UTF-8 bytes
+#define ZONE_NAME_U16_MAX 128
+
U_NAMESPACE_BEGIN
/*
@@ -174,7 +174,7 @@ public:
virtual ~TimeZoneNamesImpl();
virtual UBool operator==(const TimeZoneNames& other) const;
- virtual TimeZoneNamesImpl* clone() const;
+ virtual TimeZoneNamesImpl* clone() const;
StringEnumeration* getAvailableMetaZoneIDs(UErrorCode& status) const;
StringEnumeration* getAvailableMetaZoneIDs(const UnicodeString& tzID, UErrorCode& status) const;
@@ -236,7 +236,7 @@ public:
virtual ~TZDBTimeZoneNames();
virtual UBool operator==(const TimeZoneNames& other) const;
- virtual TZDBTimeZoneNames* clone() const;
+ virtual TZDBTimeZoneNames* clone() const;
StringEnumeration* getAvailableMetaZoneIDs(UErrorCode& status) const;
StringEnumeration* getAvailableMetaZoneIDs(const UnicodeString& tzID, UErrorCode& status) const;
@@ -249,8 +249,8 @@ public:
TimeZoneNames::MatchInfoCollection* find(const UnicodeString& text, int32_t start, uint32_t types, UErrorCode& status) const;
- // When TZDBNames for the metazone is not available, this method returns NULL,
- // but does NOT set U_MISSING_RESOURCE_ERROR to status.
+ // When TZDBNames for the metazone is not available, this method returns NULL,
+ // but does NOT set U_MISSING_RESOURCE_ERROR to status.
static const TZDBNames* getMetaZoneNames(const UnicodeString& mzId, UErrorCode& status);
private:
diff --git a/contrib/libs/icu/i18n/tzrule.cpp b/contrib/libs/icu/i18n/tzrule.cpp
index 239b3b0725..759a2d4c67 100644
--- a/contrib/libs/icu/i18n/tzrule.cpp
+++ b/contrib/libs/icu/i18n/tzrule.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -108,7 +108,7 @@ InitialTimeZoneRule::~InitialTimeZoneRule() {
}
InitialTimeZoneRule*
-InitialTimeZoneRule::clone() const {
+InitialTimeZoneRule::clone() const {
return new InitialTimeZoneRule(*this);
}
diff --git a/contrib/libs/icu/i18n/tztrans.cpp b/contrib/libs/icu/i18n/tztrans.cpp
index eee98251d3..3199b78ea8 100644
--- a/contrib/libs/icu/i18n/tztrans.cpp
+++ b/contrib/libs/icu/i18n/tztrans.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/ucal.cpp b/contrib/libs/icu/i18n/ucal.cpp
index c5db70c785..67c51aea27 100644
--- a/contrib/libs/icu/i18n/ucal.cpp
+++ b/contrib/libs/icu/i18n/ucal.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -34,7 +34,7 @@ U_NAMESPACE_USE
static TimeZone*
_createTimeZone(const UChar* zoneID, int32_t len, UErrorCode* ec) {
TimeZone* zone = NULL;
- if (ec != NULL && U_SUCCESS(*ec)) {
+ if (ec != NULL && U_SUCCESS(*ec)) {
// Note that if zoneID is invalid, we get back GMT. This odd
// behavior is by design and goes back to the JDK. The only
// failure we will see is a memory allocation failure.
@@ -69,7 +69,7 @@ ucal_openCountryTimeZones(const char* country, UErrorCode* ec) {
U_CAPI int32_t U_EXPORT2
ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec) {
int32_t len = 0;
- if (ec != NULL && U_SUCCESS(*ec)) {
+ if (ec != NULL && U_SUCCESS(*ec)) {
TimeZone* zone = TimeZone::createDefault();
if (zone == NULL) {
*ec = U_MEMORY_ALLOCATION_ERROR;
@@ -91,23 +91,23 @@ ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec) {
}
}
-U_DRAFT int32_t U_EXPORT2
-ucal_getHostTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec) {
- int32_t len = 0;
- if (ec != NULL && U_SUCCESS(*ec)) {
- TimeZone *zone = TimeZone::detectHostTimeZone();
- if (zone == NULL) {
- *ec = U_MEMORY_ALLOCATION_ERROR;
- } else {
- UnicodeString id;
- zone->getID(id);
- delete zone;
- len = id.extract(result, resultCapacity, *ec);
- }
- }
- return len;
-}
-
+U_DRAFT int32_t U_EXPORT2
+ucal_getHostTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec) {
+ int32_t len = 0;
+ if (ec != NULL && U_SUCCESS(*ec)) {
+ TimeZone *zone = TimeZone::detectHostTimeZone();
+ if (zone == NULL) {
+ *ec = U_MEMORY_ALLOCATION_ERROR;
+ } else {
+ UnicodeString id;
+ zone->getID(id);
+ delete zone;
+ len = id.extract(result, resultCapacity, *ec);
+ }
+ }
+ return len;
+}
+
U_CAPI int32_t U_EXPORT2
ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec) {
int32_t result = 0;
@@ -154,43 +154,43 @@ ucal_open( const UChar* zoneID,
UCalendarType caltype,
UErrorCode* status)
{
- if (U_FAILURE(*status)) {
- return nullptr;
- }
+ if (U_FAILURE(*status)) {
+ return nullptr;
+ }
- LocalPointer<TimeZone> zone( (zoneID==nullptr) ? TimeZone::createDefault()
- : _createTimeZone(zoneID, len, status), *status);
+ LocalPointer<TimeZone> zone( (zoneID==nullptr) ? TimeZone::createDefault()
+ : _createTimeZone(zoneID, len, status), *status);
if (U_FAILURE(*status)) {
- return nullptr;
+ return nullptr;
}
if ( caltype == UCAL_GREGORIAN ) {
- char localeBuf[ULOC_LOCALE_IDENTIFIER_CAPACITY];
- if ( locale == nullptr ) {
+ char localeBuf[ULOC_LOCALE_IDENTIFIER_CAPACITY];
+ if ( locale == nullptr ) {
locale = uloc_getDefault();
}
- int32_t localeLength = static_cast<int32_t>(uprv_strlen(locale));
- if (localeLength >= ULOC_LOCALE_IDENTIFIER_CAPACITY) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
- }
- uprv_strcpy(localeBuf, locale);
+ int32_t localeLength = static_cast<int32_t>(uprv_strlen(locale));
+ if (localeLength >= ULOC_LOCALE_IDENTIFIER_CAPACITY) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return nullptr;
+ }
+ uprv_strcpy(localeBuf, locale);
uloc_setKeywordValue("calendar", "gregorian", localeBuf, ULOC_LOCALE_IDENTIFIER_CAPACITY, status);
if (U_FAILURE(*status)) {
- return nullptr;
+ return nullptr;
}
- return (UCalendar*)Calendar::createInstance(zone.orphan(), Locale(localeBuf), *status);
+ return (UCalendar*)Calendar::createInstance(zone.orphan(), Locale(localeBuf), *status);
}
- return (UCalendar*)Calendar::createInstance(zone.orphan(), Locale(locale), *status);
+ return (UCalendar*)Calendar::createInstance(zone.orphan(), Locale(locale), *status);
}
U_CAPI void U_EXPORT2
ucal_close(UCalendar *cal)
{
- if (cal != nullptr) {
- delete (Calendar*) cal;
- }
+ if (cal != nullptr) {
+ delete (Calendar*) cal;
+ }
}
U_CAPI UCalendar* U_EXPORT2
diff --git a/contrib/libs/icu/i18n/ucln_in.cpp b/contrib/libs/icu/i18n/ucln_in.cpp
index 94be2af9b4..f29cbe41dd 100644
--- a/contrib/libs/icu/i18n/ucln_in.cpp
+++ b/contrib/libs/icu/i18n/ucln_in.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
* *
******************************************************************************
* file name: ucln_in.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/i18n/ucln_in.h b/contrib/libs/icu/i18n/ucln_in.h
index b1e09bc81b..765cdd559f 100644
--- a/contrib/libs/icu/i18n/ucln_in.h
+++ b/contrib/libs/icu/i18n/ucln_in.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
******************************************************************************
* file name: ucln_in.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -26,14 +26,14 @@ as the functions are suppose to be called.
It's usually best to have child dependencies called first. */
typedef enum ECleanupI18NType {
UCLN_I18N_START = -1,
- UCLN_I18N_UNIT_EXTRAS,
- UCLN_I18N_NUMBER_SKELETONS,
- UCLN_I18N_CURRENCY_SPACING,
+ UCLN_I18N_UNIT_EXTRAS,
+ UCLN_I18N_NUMBER_SKELETONS,
+ UCLN_I18N_CURRENCY_SPACING,
UCLN_I18N_SPOOF,
UCLN_I18N_SPOOFDATA,
UCLN_I18N_TRANSLITERATOR,
UCLN_I18N_REGEX,
- UCLN_I18N_JAPANESE_CALENDAR,
+ UCLN_I18N_JAPANESE_CALENDAR,
UCLN_I18N_ISLAMIC_CALENDAR,
UCLN_I18N_CHINESE_CALENDAR,
UCLN_I18N_HEBREW_CALENDAR,
@@ -60,8 +60,8 @@ typedef enum ECleanupI18NType {
UCLN_I18N_GENDERINFO,
UCLN_I18N_CDFINFO,
UCLN_I18N_REGION,
- UCLN_I18N_LIST_FORMATTER,
- UCLN_I18N_NUMSYS,
+ UCLN_I18N_LIST_FORMATTER,
+ UCLN_I18N_NUMSYS,
UCLN_I18N_COUNT /* This must be last */
} ECleanupI18NType;
diff --git a/contrib/libs/icu/i18n/ucol.cpp b/contrib/libs/icu/i18n/ucol.cpp
index 07f505368a..f59333ede3 100644
--- a/contrib/libs/icu/i18n/ucol.cpp
+++ b/contrib/libs/icu/i18n/ucol.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: ucol.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -95,7 +95,7 @@ ucol_safeClone(const UCollator *coll, void * /*stackBuffer*/, int32_t * pBufferS
Collator *newColl = Collator::fromUCollator(coll)->clone();
if (newColl == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
+ return nullptr;
} else {
*status = U_SAFECLONE_ALLOCATED_WARNING;
}
diff --git a/contrib/libs/icu/i18n/ucol_imp.h b/contrib/libs/icu/i18n/ucol_imp.h
index 0f2a7d8e58..a251fc461d 100644
--- a/contrib/libs/icu/i18n/ucol_imp.h
+++ b/contrib/libs/icu/i18n/ucol_imp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -10,7 +10,7 @@
*
* Private implementation header for C collation
* file name: ucol_imp.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/i18n/ucol_res.cpp b/contrib/libs/icu/i18n/ucol_res.cpp
index f0d759b702..aa4027eb87 100644
--- a/contrib/libs/icu/i18n/ucol_res.cpp
+++ b/contrib/libs/icu/i18n/ucol_res.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: ucol_res.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -62,7 +62,7 @@ namespace {
static const UChar *rootRules = NULL;
static int32_t rootRulesLength = 0;
static UResourceBundle *rootBundle = NULL;
-static UInitOnce gInitOnceUcolRes = U_INITONCE_INITIALIZER;
+static UInitOnce gInitOnceUcolRes = U_INITONCE_INITIALIZER;
} // namespace
@@ -74,7 +74,7 @@ ucol_res_cleanup() {
rootRulesLength = 0;
ures_close(rootBundle);
rootBundle = NULL;
- gInitOnceUcolRes.reset();
+ gInitOnceUcolRes.reset();
return TRUE;
}
@@ -97,7 +97,7 @@ U_CDECL_END
void
CollationLoader::appendRootRules(UnicodeString &s) {
UErrorCode errorCode = U_ZERO_ERROR;
- umtx_initOnce(gInitOnceUcolRes, CollationLoader::loadRootRules, errorCode);
+ umtx_initOnce(gInitOnceUcolRes, CollationLoader::loadRootRules, errorCode);
if(U_SUCCESS(errorCode)) {
s.append(rootRules, rootRulesLength);
}
@@ -110,7 +110,7 @@ CollationLoader::loadRules(const char *localeID, const char *collationType,
U_ASSERT(collationType != NULL && *collationType != 0);
// Copy the type for lowercasing.
char type[16];
- int32_t typeLength = static_cast<int32_t>(uprv_strlen(collationType));
+ int32_t typeLength = static_cast<int32_t>(uprv_strlen(collationType));
if(typeLength >= UPRV_LENGTHOF(type)) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return;
@@ -318,7 +318,7 @@ CollationLoader::loadFromCollations(UErrorCode &errorCode) {
// Load the collations/type tailoring, with type fallback.
LocalUResourceBundlePointer localData(
ures_getByKeyWithFallback(collations, type, NULL, &errorCode));
- int32_t typeLength = static_cast<int32_t>(uprv_strlen(type));
+ int32_t typeLength = static_cast<int32_t>(uprv_strlen(type));
if(errorCode == U_MISSING_RESOURCE_ERROR) {
errorCode = U_USING_DEFAULT_WARNING;
typeFallback = TRUE;
@@ -348,7 +348,7 @@ CollationLoader::loadFromCollations(UErrorCode &errorCode) {
const char *actualLocale = ures_getLocaleByType(data, ULOC_ACTUAL_LOCALE, &errorCode);
if(U_FAILURE(errorCode)) { return NULL; }
const char *vLocale = validLocale.getBaseName();
- UBool actualAndValidLocalesAreDifferent = Locale(actualLocale) != Locale(vLocale);
+ UBool actualAndValidLocalesAreDifferent = Locale(actualLocale) != Locale(vLocale);
// Set the collation types on the informational locales,
// except when they match the default types (for brevity and backwards compatibility).
@@ -400,17 +400,17 @@ CollationLoader::loadFromData(UErrorCode &errorCode) {
// Try to fetch the optional rules string.
{
UErrorCode internalErrorCode = U_ZERO_ERROR;
- int32_t len;
- const UChar *s = ures_getStringByKey(data, "Sequence", &len,
+ int32_t len;
+ const UChar *s = ures_getStringByKey(data, "Sequence", &len,
&internalErrorCode);
if(U_SUCCESS(internalErrorCode)) {
- t->rules.setTo(TRUE, s, len);
+ t->rules.setTo(TRUE, s, len);
}
}
const char *actualLocale = locale.getBaseName(); // without type
const char *vLocale = validLocale.getBaseName();
- UBool actualAndValidLocalesAreDifferent = Locale(actualLocale) != Locale(vLocale);
+ UBool actualAndValidLocalesAreDifferent = Locale(actualLocale) != Locale(vLocale);
// For the actual locale, suppress the default type *according to the actual locale*.
// For example, zh has default=pinyin and contains all of the Chinese tailorings.
@@ -426,10 +426,10 @@ CollationLoader::loadFromData(UErrorCode &errorCode) {
LocalUResourceBundlePointer def(
ures_getByKeyWithFallback(actualBundle.getAlias(), "collations/default", NULL,
&internalErrorCode));
- int32_t len;
- const UChar *s = ures_getString(def.getAlias(), &len, &internalErrorCode);
- if(U_SUCCESS(internalErrorCode) && len < UPRV_LENGTHOF(defaultType)) {
- u_UCharsToChars(s, defaultType, len + 1);
+ int32_t len;
+ const UChar *s = ures_getString(def.getAlias(), &len, &internalErrorCode);
+ if(U_SUCCESS(internalErrorCode) && len < UPRV_LENGTHOF(defaultType)) {
+ u_UCharsToChars(s, defaultType, len + 1);
} else {
uprv_strcpy(defaultType, "standard");
}
@@ -451,7 +451,7 @@ CollationLoader::loadFromData(UErrorCode &errorCode) {
const CollationCacheEntry *entry = new CollationCacheEntry(validLocale, t.getAlias());
if(entry == NULL) {
errorCode = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
+ return nullptr;
} else {
t.orphan();
}
@@ -681,7 +681,7 @@ ucol_getKeywordValuesForLocale(const char* /*key*/, const char* locale,
return NULL;
}
memcpy(en, &defaultKeywordValues, sizeof(UEnumeration));
- ulist_resetList(sink.values); // Initialize the iterator.
+ ulist_resetList(sink.values); // Initialize the iterator.
en->context = sink.values;
sink.values = NULL; // Avoid deletion in the sink destructor.
return en;
diff --git a/contrib/libs/icu/i18n/ucol_sit.cpp b/contrib/libs/icu/i18n/ucol_sit.cpp
index 367d4167ea..92f332d6d0 100644
--- a/contrib/libs/icu/i18n/ucol_sit.cpp
+++ b/contrib/libs/icu/i18n/ucol_sit.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: ucol_sit.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -24,11 +24,11 @@
#include "cstring.h"
#include "uresimp.h"
#include "unicode/coll.h"
-#include "unicode/stringpiece.h"
-#include "charstr.h"
+#include "unicode/stringpiece.h"
+#include "charstr.h"
+
+U_NAMESPACE_USE
-U_NAMESPACE_USE
-
#ifdef UCOL_TRACE_SIT
# include <stdio.h>
#endif
@@ -93,31 +93,31 @@ static const int32_t internalBufferSize = 512;
* collator instance
*/
struct CollatorSpec {
- inline CollatorSpec();
-
- CharString locElements[locElementCount];
- CharString locale;
+ inline CollatorSpec();
+
+ CharString locElements[locElementCount];
+ CharString locale;
UColAttributeValue options[UCOL_ATTRIBUTE_COUNT];
uint32_t variableTopValue;
UChar variableTopString[locElementCapacity];
int32_t variableTopStringLen;
UBool variableTopSet;
- CharString entries[UCOL_SIT_ITEMS_COUNT];
+ CharString entries[UCOL_SIT_ITEMS_COUNT];
};
-CollatorSpec::CollatorSpec() :
-locale(),
-variableTopValue(0),
-variableTopString(),
-variableTopSet(FALSE)
- {
- // set collation options to default
- for(int32_t i = 0; i < UCOL_ATTRIBUTE_COUNT; i++) {
- options[i] = UCOL_DEFAULT;
- }
-}
-
-
+CollatorSpec::CollatorSpec() :
+locale(),
+variableTopValue(0),
+variableTopString(),
+variableTopSet(FALSE)
+ {
+ // set collation options to default
+ for(int32_t i = 0; i < UCOL_ATTRIBUTE_COUNT; i++) {
+ options[i] = UCOL_DEFAULT;
+ }
+}
+
+
/* structure for converting between character attribute
* representation and real collation attribute value.
*/
@@ -171,11 +171,11 @@ _processLocaleElement(CollatorSpec *spec, uint32_t value, const char* string,
{
do {
if(value == UCOL_SIT_LANGUAGE || value == UCOL_SIT_KEYWORD || value == UCOL_SIT_PROVIDER) {
- spec->locElements[value].append(uprv_tolower(*string), *status);
+ spec->locElements[value].append(uprv_tolower(*string), *status);
} else {
- spec->locElements[value].append(*string, *status);
+ spec->locElements[value].append(*string, *status);
}
- } while(*(++string) != '_' && *string && U_SUCCESS(*status));
+ } while(*(++string) != '_' && *string && U_SUCCESS(*status));
// don't skip the underscore at the end
return string;
}
@@ -193,7 +193,7 @@ _processRFC3066Locale(CollatorSpec *spec, uint32_t, const char* string,
*status = U_BUFFER_OVERFLOW_ERROR;
return string;
} else {
- spec->locale.copyFrom(CharString(string, static_cast<int32_t>(end-string), *status), *status);
+ spec->locale.copyFrom(CharString(string, static_cast<int32_t>(end-string), *status), *status);
return end+1;
}
}
@@ -315,11 +315,11 @@ const char* ucol_sit_readOption(const char *start, CollatorSpec *spec,
for(i = 0; i < UCOL_SIT_ITEMS_COUNT; i++) {
if(*start == options[i].optionStart) {
const char* end = options[i].action(spec, options[i].attr, start+1, status);
-#ifdef UCOL_TRACE_SIT
- fprintf(stderr, "***Set %d to %s...\n", i, start);
-#endif
- // assume 'start' does not go away through all this
- spec->entries[i].copyFrom(CharString(start, (int32_t)(end - start), *status), *status);
+#ifdef UCOL_TRACE_SIT
+ fprintf(stderr, "***Set %d to %s...\n", i, start);
+#endif
+ // assume 'start' does not go away through all this
+ spec->entries[i].copyFrom(CharString(start, (int32_t)(end - start), *status), *status);
return end;
}
}
@@ -356,25 +356,25 @@ int32_t ucol_sit_dumpSpecs(CollatorSpec *s, char *destination, int32_t capacity,
char optName;
if(U_SUCCESS(*status)) {
for(i = 0; i < UCOL_SIT_ITEMS_COUNT; i++) {
- if(!s->entries[i].isEmpty()) {
+ if(!s->entries[i].isEmpty()) {
if(len) {
if(len < capacity) {
uprv_strcat(destination, "_");
}
len++;
}
- optName = s->entries[i][0];
+ optName = s->entries[i][0];
if(optName == languageArg || optName == regionArg || optName == variantArg || optName == keywordArg) {
- for(j = 0; j < s->entries[i].length(); j++) {
+ for(j = 0; j < s->entries[i].length(); j++) {
if(len + j < capacity) {
- destination[len+j] = uprv_toupper(s->entries[i][j]);
+ destination[len+j] = uprv_toupper(s->entries[i][j]);
}
}
- len += s->entries[i].length();
+ len += s->entries[i].length();
} else {
- len += s->entries[i].length();
+ len += s->entries[i].length();
if(len < capacity) {
- uprv_strncat(destination,s->entries[i].data(), s->entries[i].length());
+ uprv_strncat(destination,s->entries[i].data(), s->entries[i].length());
}
}
}
@@ -386,40 +386,40 @@ int32_t ucol_sit_dumpSpecs(CollatorSpec *s, char *destination, int32_t capacity,
}
static void
-ucol_sit_calculateWholeLocale(CollatorSpec *s, UErrorCode &status) {
+ucol_sit_calculateWholeLocale(CollatorSpec *s, UErrorCode &status) {
// put the locale together, unless we have a done
// locale
- if(s->locale.isEmpty()) {
+ if(s->locale.isEmpty()) {
// first the language
- s->locale.append(s->locElements[UCOL_SIT_LANGUAGE], status);
+ s->locale.append(s->locElements[UCOL_SIT_LANGUAGE], status);
// then the script, if present
- if(!s->locElements[UCOL_SIT_SCRIPT].isEmpty()) {
- s->locale.append("_", status);
- s->locale.append(s->locElements[UCOL_SIT_SCRIPT], status);
+ if(!s->locElements[UCOL_SIT_SCRIPT].isEmpty()) {
+ s->locale.append("_", status);
+ s->locale.append(s->locElements[UCOL_SIT_SCRIPT], status);
}
// then the region, if present
- if(!s->locElements[UCOL_SIT_REGION].isEmpty()) {
- s->locale.append("_", status);
- s->locale.append(s->locElements[UCOL_SIT_REGION], status);
- } else if(!s->locElements[UCOL_SIT_VARIANT].isEmpty()) { // if there is a variant, we need an underscore
- s->locale.append("_", status);
+ if(!s->locElements[UCOL_SIT_REGION].isEmpty()) {
+ s->locale.append("_", status);
+ s->locale.append(s->locElements[UCOL_SIT_REGION], status);
+ } else if(!s->locElements[UCOL_SIT_VARIANT].isEmpty()) { // if there is a variant, we need an underscore
+ s->locale.append("_", status);
}
// add variant, if there
- if(!s->locElements[UCOL_SIT_VARIANT].isEmpty()) {
- s->locale.append("_", status);
- s->locale.append(s->locElements[UCOL_SIT_VARIANT], status);
+ if(!s->locElements[UCOL_SIT_VARIANT].isEmpty()) {
+ s->locale.append("_", status);
+ s->locale.append(s->locElements[UCOL_SIT_VARIANT], status);
}
// if there is a collation keyword, add that too
- if(!s->locElements[UCOL_SIT_KEYWORD].isEmpty()) {
- s->locale.append(collationKeyword, status);
- s->locale.append(s->locElements[UCOL_SIT_KEYWORD], status);
+ if(!s->locElements[UCOL_SIT_KEYWORD].isEmpty()) {
+ s->locale.append(collationKeyword, status);
+ s->locale.append(s->locElements[UCOL_SIT_KEYWORD], status);
}
// if there is a provider keyword, add that too
- if(!s->locElements[UCOL_SIT_PROVIDER].isEmpty()) {
- s->locale.append(providerKeyword, status);
- s->locale.append(s->locElements[UCOL_SIT_PROVIDER], status);
+ if(!s->locElements[UCOL_SIT_PROVIDER].isEmpty()) {
+ s->locale.append(providerKeyword, status);
+ s->locale.append(s->locElements[UCOL_SIT_PROVIDER], status);
}
}
}
@@ -451,11 +451,11 @@ ucol_prepareShortStringOpen( const char *definition,
// analyse the string in order to get everything we need.
CollatorSpec s;
ucol_sit_readSpecs(&s, definition, parseError, status);
- ucol_sit_calculateWholeLocale(&s, *status);
+ ucol_sit_calculateWholeLocale(&s, *status);
char buffer[internalBufferSize];
uprv_memset(buffer, 0, internalBufferSize);
- uloc_canonicalize(s.locale.data(), buffer, internalBufferSize, status);
+ uloc_canonicalize(s.locale.data(), buffer, internalBufferSize, status);
UResourceBundle *b = ures_open(U_ICUDATA_COLL, buffer, status);
/* we try to find stuff from keyword */
@@ -463,15 +463,15 @@ ucol_prepareShortStringOpen( const char *definition,
UResourceBundle *collElem = NULL;
char keyBuffer[256];
// if there is a keyword, we pick it up and try to get elements
- int32_t keyLen = uloc_getKeywordValue(buffer, "collation", keyBuffer, sizeof(keyBuffer), status);
- // Treat too long a value as no keyword.
- if(keyLen >= (int32_t)sizeof(keyBuffer)) {
- keyLen = 0;
- *status = U_ZERO_ERROR;
- }
- if(keyLen == 0) {
- // no keyword
- // we try to find the default setting, which will give us the keyword value
+ int32_t keyLen = uloc_getKeywordValue(buffer, "collation", keyBuffer, sizeof(keyBuffer), status);
+ // Treat too long a value as no keyword.
+ if(keyLen >= (int32_t)sizeof(keyBuffer)) {
+ keyLen = 0;
+ *status = U_ZERO_ERROR;
+ }
+ if(keyLen == 0) {
+ // no keyword
+ // we try to find the default setting, which will give us the keyword value
UResourceBundle *defaultColl = ures_getByKeyWithFallback(collations, "default", NULL, status);
if(U_SUCCESS(*status)) {
int32_t defaultKeyLen = 0;
@@ -521,14 +521,14 @@ ucol_openFromShortString( const char *definition,
const char *string = definition;
CollatorSpec s;
string = ucol_sit_readSpecs(&s, definition, parseError, status);
- ucol_sit_calculateWholeLocale(&s, *status);
+ ucol_sit_calculateWholeLocale(&s, *status);
char buffer[internalBufferSize];
uprv_memset(buffer, 0, internalBufferSize);
-#ifdef UCOL_TRACE_SIT
- fprintf(stderr, "DEF %s, DATA %s, ERR %s\n", definition, s.locale.data(), u_errorName(*status));
-#endif
- uloc_canonicalize(s.locale.data(), buffer, internalBufferSize, status);
+#ifdef UCOL_TRACE_SIT
+ fprintf(stderr, "DEF %s, DATA %s, ERR %s\n", definition, s.locale.data(), u_errorName(*status));
+#endif
+ uloc_canonicalize(s.locale.data(), buffer, internalBufferSize, status);
UCollator *result = ucol_open(buffer, status);
int32_t i = 0;
diff --git a/contrib/libs/icu/i18n/ucoleitr.cpp b/contrib/libs/icu/i18n/ucoleitr.cpp
index c20f08a69e..596ce03295 100644
--- a/contrib/libs/icu/i18n/ucoleitr.cpp
+++ b/contrib/libs/icu/i18n/ucoleitr.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/i18n/ucsdet.cpp b/contrib/libs/icu/i18n/ucsdet.cpp
index 452fc4298c..46f69cf90c 100644
--- a/contrib/libs/icu/i18n/ucsdet.cpp
+++ b/contrib/libs/icu/i18n/ucsdet.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
diff --git a/contrib/libs/icu/i18n/udat.cpp b/contrib/libs/icu/i18n/udat.cpp
index 8be8d06ba2..ab91bcff41 100644
--- a/contrib/libs/icu/i18n/udat.cpp
+++ b/contrib/libs/icu/i18n/udat.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -167,14 +167,14 @@ udat_open(UDateFormatStyle timeStyle,
}
}
- if(fmt == nullptr) {
+ if(fmt == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
+ return nullptr;
+ }
+ if (U_FAILURE(*status)) {
+ delete fmt;
+ return nullptr;
}
- if (U_FAILURE(*status)) {
- delete fmt;
- return nullptr;
- }
if(tzID != 0) {
TimeZone *zone = TimeZone::createTimeZone(UnicodeString((UBool)(tzIDLength == -1), tzID, tzIDLength));
@@ -607,7 +607,7 @@ udat_getSymbols(const UDateFormat *fmt,
} else {
return -1;
}
- int32_t count = 0;
+ int32_t count = 0;
const UnicodeString *res = NULL;
switch(type) {
diff --git a/contrib/libs/icu/i18n/udateintervalformat.cpp b/contrib/libs/icu/i18n/udateintervalformat.cpp
index 58dcfbd4be..388960384b 100644
--- a/contrib/libs/icu/i18n/udateintervalformat.cpp
+++ b/contrib/libs/icu/i18n/udateintervalformat.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************************
@@ -18,21 +18,21 @@
#include "unicode/timezone.h"
#include "unicode/locid.h"
#include "unicode/unistr.h"
-#include "formattedval_impl.h"
+#include "formattedval_impl.h"
U_NAMESPACE_USE
-// Magic number: FDIV in ASCII
-UPRV_FORMATTED_VALUE_CAPI_AUTO_IMPL(
- FormattedDateInterval,
- UFormattedDateInterval,
- UFormattedDateIntervalImpl,
- UFormattedDateIntervalApiHelper,
- udtitvfmt,
- 0x46444956)
-
-
+// Magic number: FDIV in ASCII
+UPRV_FORMATTED_VALUE_CAPI_AUTO_IMPL(
+ FormattedDateInterval,
+ UFormattedDateInterval,
+ UFormattedDateIntervalImpl,
+ UFormattedDateIntervalApiHelper,
+ udtitvfmt,
+ 0x46444956)
+
+
U_CAPI UDateIntervalFormat* U_EXPORT2
udtitvfmt_open(const char* locale,
const UChar* skeleton,
@@ -116,40 +116,40 @@ udtitvfmt_format(const UDateIntervalFormat* formatter,
}
-U_DRAFT void U_EXPORT2
-udtitvfmt_formatToResult(
- const UDateIntervalFormat* formatter,
- UDate fromDate,
- UDate toDate,
- UFormattedDateInterval* result,
- UErrorCode* status) {
- if (U_FAILURE(*status)) {
- return;
- }
- auto* resultImpl = UFormattedDateIntervalApiHelper::validate(result, *status);
- DateInterval interval = DateInterval(fromDate,toDate);
- if (resultImpl != nullptr) {
- resultImpl->fImpl = reinterpret_cast<const DateIntervalFormat*>(formatter)
- ->formatToValue(interval, *status);
- }
-}
-
-U_DRAFT void U_EXPORT2
-udtitvfmt_formatCalendarToResult(
- const UDateIntervalFormat* formatter,
- UCalendar* fromCalendar,
- UCalendar* toCalendar,
- UFormattedDateInterval* result,
- UErrorCode* status) {
- if (U_FAILURE(*status)) {
- return;
- }
- auto* resultImpl = UFormattedDateIntervalApiHelper::validate(result, *status);
- if (resultImpl != nullptr) {
- resultImpl->fImpl = reinterpret_cast<const DateIntervalFormat*>(formatter)
- ->formatToValue(*(Calendar *)fromCalendar, *(Calendar *)toCalendar, *status);
- }
-}
-
-
+U_DRAFT void U_EXPORT2
+udtitvfmt_formatToResult(
+ const UDateIntervalFormat* formatter,
+ UDate fromDate,
+ UDate toDate,
+ UFormattedDateInterval* result,
+ UErrorCode* status) {
+ if (U_FAILURE(*status)) {
+ return;
+ }
+ auto* resultImpl = UFormattedDateIntervalApiHelper::validate(result, *status);
+ DateInterval interval = DateInterval(fromDate,toDate);
+ if (resultImpl != nullptr) {
+ resultImpl->fImpl = reinterpret_cast<const DateIntervalFormat*>(formatter)
+ ->formatToValue(interval, *status);
+ }
+}
+
+U_DRAFT void U_EXPORT2
+udtitvfmt_formatCalendarToResult(
+ const UDateIntervalFormat* formatter,
+ UCalendar* fromCalendar,
+ UCalendar* toCalendar,
+ UFormattedDateInterval* result,
+ UErrorCode* status) {
+ if (U_FAILURE(*status)) {
+ return;
+ }
+ auto* resultImpl = UFormattedDateIntervalApiHelper::validate(result, *status);
+ if (resultImpl != nullptr) {
+ resultImpl->fImpl = reinterpret_cast<const DateIntervalFormat*>(formatter)
+ ->formatToValue(*(Calendar *)fromCalendar, *(Calendar *)toCalendar, *status);
+ }
+}
+
+
#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/udatpg.cpp b/contrib/libs/icu/i18n/udatpg.cpp
index 0e8c36183c..332636a938 100644
--- a/contrib/libs/icu/i18n/udatpg.cpp
+++ b/contrib/libs/icu/i18n/udatpg.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: udatpg.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -181,25 +181,25 @@ udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
return result.getBuffer();
}
-U_CAPI int32_t U_EXPORT2
-udatpg_getFieldDisplayName(const UDateTimePatternGenerator *dtpg,
- UDateTimePatternField field,
- UDateTimePGDisplayWidth width,
- UChar *fieldName, int32_t capacity,
- UErrorCode *pErrorCode) {
- if (U_FAILURE(*pErrorCode))
- return -1;
- if (fieldName == NULL ? capacity != 0 : capacity < 0) {
- *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return -1;
- }
- UnicodeString result = ((const DateTimePatternGenerator *)dtpg)->getFieldDisplayName(field,width);
- if (fieldName == NULL) {
- return result.length();
- }
- return result.extract(fieldName, capacity, *pErrorCode);
-}
-
+U_CAPI int32_t U_EXPORT2
+udatpg_getFieldDisplayName(const UDateTimePatternGenerator *dtpg,
+ UDateTimePatternField field,
+ UDateTimePGDisplayWidth width,
+ UChar *fieldName, int32_t capacity,
+ UErrorCode *pErrorCode) {
+ if (U_FAILURE(*pErrorCode))
+ return -1;
+ if (fieldName == NULL ? capacity != 0 : capacity < 0) {
+ *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return -1;
+ }
+ UnicodeString result = ((const DateTimePatternGenerator *)dtpg)->getFieldDisplayName(field,width);
+ if (fieldName == NULL) {
+ return result.length();
+ }
+ return result.extract(fieldName, capacity, *pErrorCode);
+}
+
U_CAPI void U_EXPORT2
udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg,
const UChar *dtFormat, int32_t length) {
@@ -291,9 +291,9 @@ udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg,
return result.getBuffer();
}
-U_CAPI UDateFormatHourCycle U_EXPORT2
-udatpg_getDefaultHourCycle(const UDateTimePatternGenerator *dtpg, UErrorCode* pErrorCode) {
- return ((const DateTimePatternGenerator *)dtpg)->getDefaultHourCycle(*pErrorCode);
-}
-
+U_CAPI UDateFormatHourCycle U_EXPORT2
+udatpg_getDefaultHourCycle(const UDateTimePatternGenerator *dtpg, UErrorCode* pErrorCode) {
+ return ((const DateTimePatternGenerator *)dtpg)->getDefaultHourCycle(*pErrorCode);
+}
+
#endif
diff --git a/contrib/libs/icu/i18n/ufieldpositer.cpp b/contrib/libs/icu/i18n/ufieldpositer.cpp
index 4c7d9c14c1..64de856c30 100644
--- a/contrib/libs/icu/i18n/ufieldpositer.cpp
+++ b/contrib/libs/icu/i18n/ufieldpositer.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************************
diff --git a/contrib/libs/icu/i18n/uitercollationiterator.cpp b/contrib/libs/icu/i18n/uitercollationiterator.cpp
index b342c1fe36..103c91cac8 100644
--- a/contrib/libs/icu/i18n/uitercollationiterator.cpp
+++ b/contrib/libs/icu/i18n/uitercollationiterator.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/uitercollationiterator.h b/contrib/libs/icu/i18n/uitercollationiterator.h
index 6ebd706b57..62b6f83419 100644
--- a/contrib/libs/icu/i18n/uitercollationiterator.h
+++ b/contrib/libs/icu/i18n/uitercollationiterator.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/ulistformatter.cpp b/contrib/libs/icu/i18n/ulistformatter.cpp
index 38d3d06be4..bfb7cf96bd 100644
--- a/contrib/libs/icu/i18n/ulistformatter.cpp
+++ b/contrib/libs/icu/i18n/ulistformatter.cpp
@@ -1,160 +1,160 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-*****************************************************************************************
-* Copyright (C) 2015, International Business Machines
-* Corporation and others. All Rights Reserved.
-*****************************************************************************************
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/ulistformatter.h"
-#include "unicode/listformatter.h"
-#include "unicode/localpointer.h"
-#include "cmemory.h"
-#include "formattedval_impl.h"
-
-U_NAMESPACE_USE
-
-U_CAPI UListFormatter* U_EXPORT2
-ulistfmt_open(const char* locale,
- UErrorCode* status)
-{
- if (U_FAILURE(*status)) {
- return NULL;
- }
- LocalPointer<ListFormatter> listfmt(ListFormatter::createInstance(Locale(locale), *status));
- if (U_FAILURE(*status)) {
- return NULL;
- }
- return (UListFormatter*)listfmt.orphan();
-}
-
-
-U_CAPI UListFormatter* U_EXPORT2
-ulistfmt_openForType(const char* locale, UListFormatterType type,
- UListFormatterWidth width, UErrorCode* status)
-{
- if (U_FAILURE(*status)) {
- return NULL;
- }
- LocalPointer<ListFormatter> listfmt(ListFormatter::createInstance(Locale(locale), type, width, *status));
- if (U_FAILURE(*status)) {
- return NULL;
- }
- return (UListFormatter*)listfmt.orphan();
-}
-
-
-U_CAPI void U_EXPORT2
-ulistfmt_close(UListFormatter *listfmt)
-{
- delete (ListFormatter*)listfmt;
-}
-
-
-// Magic number: FLST in ASCII
-UPRV_FORMATTED_VALUE_CAPI_AUTO_IMPL(
- FormattedList,
- UFormattedList,
- UFormattedListImpl,
- UFormattedListApiHelper,
- ulistfmt,
- 0x464C5354)
-
-
-static UnicodeString* getUnicodeStrings(
- const UChar* const strings[],
- const int32_t* stringLengths,
- int32_t stringCount,
- UnicodeString* length4StackBuffer,
- LocalArray<UnicodeString>& maybeOwner,
- UErrorCode& status) {
- U_ASSERT(U_SUCCESS(status));
- if (stringCount < 0 || (strings == NULL && stringCount > 0)) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
- }
- UnicodeString* ustrings = length4StackBuffer;
- if (stringCount > 4) {
- maybeOwner.adoptInsteadAndCheckErrorCode(new UnicodeString[stringCount], status);
- if (U_FAILURE(status)) {
- return nullptr;
- }
- ustrings = maybeOwner.getAlias();
- }
- if (stringLengths == NULL) {
- for (int32_t stringIndex = 0; stringIndex < stringCount; stringIndex++) {
- ustrings[stringIndex].setTo(TRUE, strings[stringIndex], -1);
- }
- } else {
- for (int32_t stringIndex = 0; stringIndex < stringCount; stringIndex++) {
- ustrings[stringIndex].setTo(stringLengths[stringIndex] < 0, strings[stringIndex], stringLengths[stringIndex]);
- }
- }
- return ustrings;
-}
-
-
-U_CAPI int32_t U_EXPORT2
-ulistfmt_format(const UListFormatter* listfmt,
- const UChar* const strings[],
- const int32_t * stringLengths,
- int32_t stringCount,
- UChar* result,
- int32_t resultCapacity,
- UErrorCode* status)
-{
- if (U_FAILURE(*status)) {
- return -1;
- }
- if ((result == NULL) ? resultCapacity != 0 : resultCapacity < 0) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return -1;
- }
- UnicodeString length4StackBuffer[4];
- LocalArray<UnicodeString> maybeOwner;
- UnicodeString* ustrings = getUnicodeStrings(
- strings, stringLengths, stringCount, length4StackBuffer, maybeOwner, *status);
- if (U_FAILURE(*status)) {
- return -1;
- }
- UnicodeString res;
- if (result != NULL) {
- // NULL destination for pure preflighting: empty dummy string
- // otherwise, alias the destination buffer (copied from udat_format)
- res.setTo(result, 0, resultCapacity);
- }
- reinterpret_cast<const ListFormatter*>(listfmt)->format( ustrings, stringCount, res, *status );
- return res.extract(result, resultCapacity, *status);
-}
-
-
-U_CAPI void U_EXPORT2
-ulistfmt_formatStringsToResult(
- const UListFormatter* listfmt,
- const UChar* const strings[],
- const int32_t * stringLengths,
- int32_t stringCount,
- UFormattedList* uresult,
- UErrorCode* status) {
- auto* result = UFormattedListApiHelper::validate(uresult, *status);
- if (U_FAILURE(*status)) {
- return;
- }
- UnicodeString length4StackBuffer[4];
- LocalArray<UnicodeString> maybeOwner;
- UnicodeString* ustrings = getUnicodeStrings(
- strings, stringLengths, stringCount, length4StackBuffer, maybeOwner, *status);
- if (U_FAILURE(*status)) {
- return;
- }
- result->fImpl = reinterpret_cast<const ListFormatter*>(listfmt)
- ->formatStringsToValue(ustrings, stringCount, *status);
-}
-
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*****************************************************************************************
+* Copyright (C) 2015, International Business Machines
+* Corporation and others. All Rights Reserved.
+*****************************************************************************************
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/ulistformatter.h"
+#include "unicode/listformatter.h"
+#include "unicode/localpointer.h"
+#include "cmemory.h"
+#include "formattedval_impl.h"
+
+U_NAMESPACE_USE
+
+U_CAPI UListFormatter* U_EXPORT2
+ulistfmt_open(const char* locale,
+ UErrorCode* status)
+{
+ if (U_FAILURE(*status)) {
+ return NULL;
+ }
+ LocalPointer<ListFormatter> listfmt(ListFormatter::createInstance(Locale(locale), *status));
+ if (U_FAILURE(*status)) {
+ return NULL;
+ }
+ return (UListFormatter*)listfmt.orphan();
+}
+
+
+U_CAPI UListFormatter* U_EXPORT2
+ulistfmt_openForType(const char* locale, UListFormatterType type,
+ UListFormatterWidth width, UErrorCode* status)
+{
+ if (U_FAILURE(*status)) {
+ return NULL;
+ }
+ LocalPointer<ListFormatter> listfmt(ListFormatter::createInstance(Locale(locale), type, width, *status));
+ if (U_FAILURE(*status)) {
+ return NULL;
+ }
+ return (UListFormatter*)listfmt.orphan();
+}
+
+
+U_CAPI void U_EXPORT2
+ulistfmt_close(UListFormatter *listfmt)
+{
+ delete (ListFormatter*)listfmt;
+}
+
+
+// Magic number: FLST in ASCII
+UPRV_FORMATTED_VALUE_CAPI_AUTO_IMPL(
+ FormattedList,
+ UFormattedList,
+ UFormattedListImpl,
+ UFormattedListApiHelper,
+ ulistfmt,
+ 0x464C5354)
+
+
+static UnicodeString* getUnicodeStrings(
+ const UChar* const strings[],
+ const int32_t* stringLengths,
+ int32_t stringCount,
+ UnicodeString* length4StackBuffer,
+ LocalArray<UnicodeString>& maybeOwner,
+ UErrorCode& status) {
+ U_ASSERT(U_SUCCESS(status));
+ if (stringCount < 0 || (strings == NULL && stringCount > 0)) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return nullptr;
+ }
+ UnicodeString* ustrings = length4StackBuffer;
+ if (stringCount > 4) {
+ maybeOwner.adoptInsteadAndCheckErrorCode(new UnicodeString[stringCount], status);
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
+ ustrings = maybeOwner.getAlias();
+ }
+ if (stringLengths == NULL) {
+ for (int32_t stringIndex = 0; stringIndex < stringCount; stringIndex++) {
+ ustrings[stringIndex].setTo(TRUE, strings[stringIndex], -1);
+ }
+ } else {
+ for (int32_t stringIndex = 0; stringIndex < stringCount; stringIndex++) {
+ ustrings[stringIndex].setTo(stringLengths[stringIndex] < 0, strings[stringIndex], stringLengths[stringIndex]);
+ }
+ }
+ return ustrings;
+}
+
+
+U_CAPI int32_t U_EXPORT2
+ulistfmt_format(const UListFormatter* listfmt,
+ const UChar* const strings[],
+ const int32_t * stringLengths,
+ int32_t stringCount,
+ UChar* result,
+ int32_t resultCapacity,
+ UErrorCode* status)
+{
+ if (U_FAILURE(*status)) {
+ return -1;
+ }
+ if ((result == NULL) ? resultCapacity != 0 : resultCapacity < 0) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return -1;
+ }
+ UnicodeString length4StackBuffer[4];
+ LocalArray<UnicodeString> maybeOwner;
+ UnicodeString* ustrings = getUnicodeStrings(
+ strings, stringLengths, stringCount, length4StackBuffer, maybeOwner, *status);
+ if (U_FAILURE(*status)) {
+ return -1;
+ }
+ UnicodeString res;
+ if (result != NULL) {
+ // NULL destination for pure preflighting: empty dummy string
+ // otherwise, alias the destination buffer (copied from udat_format)
+ res.setTo(result, 0, resultCapacity);
+ }
+ reinterpret_cast<const ListFormatter*>(listfmt)->format( ustrings, stringCount, res, *status );
+ return res.extract(result, resultCapacity, *status);
+}
+
+
+U_CAPI void U_EXPORT2
+ulistfmt_formatStringsToResult(
+ const UListFormatter* listfmt,
+ const UChar* const strings[],
+ const int32_t * stringLengths,
+ int32_t stringCount,
+ UFormattedList* uresult,
+ UErrorCode* status) {
+ auto* result = UFormattedListApiHelper::validate(uresult, *status);
+ if (U_FAILURE(*status)) {
+ return;
+ }
+ UnicodeString length4StackBuffer[4];
+ LocalArray<UnicodeString> maybeOwner;
+ UnicodeString* ustrings = getUnicodeStrings(
+ strings, stringLengths, stringCount, length4StackBuffer, maybeOwner, *status);
+ if (U_FAILURE(*status)) {
+ return;
+ }
+ result->fImpl = reinterpret_cast<const ListFormatter*>(listfmt)
+ ->formatStringsToValue(ustrings, stringCount, *status);
+}
+
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/ulocdata.cpp b/contrib/libs/icu/i18n/ulocdata.cpp
index fbe6137bdd..7f4e7b9b11 100644
--- a/contrib/libs/icu/i18n/ulocdata.cpp
+++ b/contrib/libs/icu/i18n/ulocdata.cpp
@@ -1,386 +1,386 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-* *
-* Copyright (C) 2003-2016, International Business Machines *
-* Corporation and others. All Rights Reserved. *
-* *
-******************************************************************************
-* file name: ulocdata.c
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 2003Oct21
-* created by: Ram Viswanadha,John Emmons
-*/
-
-#include "cmemory.h"
-#include "unicode/ustring.h"
-#include "unicode/ures.h"
-#include "unicode/uloc.h"
-#include "unicode/ulocdata.h"
-#include "uresimp.h"
-#include "ureslocs.h"
-#include "ulocimp.h"
-
-#define MEASUREMENT_SYSTEM "MeasurementSystem"
-#define PAPER_SIZE "PaperSize"
-
-/** A locale data object.
- * For usage in C programs.
- * @draft ICU 3.4
- */
-struct ULocaleData {
- /**
- * Controls the "No Substitute" behavior of this locale data object
- */
- UBool noSubstitute;
-
- /**
- * Pointer to the resource bundle associated with this locale data object
- */
- UResourceBundle *bundle;
-
- /**
- * Pointer to the lang resource bundle associated with this locale data object
- */
- UResourceBundle *langBundle;
-};
-
-U_CAPI ULocaleData* U_EXPORT2
-ulocdata_open(const char *localeID, UErrorCode *status)
-{
- ULocaleData *uld;
-
- if (U_FAILURE(*status)) {
- return NULL;
- }
-
- uld = (ULocaleData *)uprv_malloc(sizeof(ULocaleData));
- if (uld == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return(NULL);
- }
-
- uld->langBundle = NULL;
-
- uld->noSubstitute = FALSE;
- uld->bundle = ures_open(NULL, localeID, status);
- uld->langBundle = ures_open(U_ICUDATA_LANG, localeID, status);
-
- if (U_FAILURE(*status)) {
- uprv_free(uld);
- return NULL;
- }
-
- return uld;
-}
-
-U_CAPI void U_EXPORT2
-ulocdata_close(ULocaleData *uld)
-{
- if ( uld != NULL ) {
- ures_close(uld->langBundle);
- ures_close(uld->bundle);
- uprv_free(uld);
- }
-}
-
-U_CAPI void U_EXPORT2
-ulocdata_setNoSubstitute(ULocaleData *uld, UBool setting)
-{
- uld->noSubstitute = setting;
-}
-
-U_CAPI UBool U_EXPORT2
-ulocdata_getNoSubstitute(ULocaleData *uld)
-{
- return uld->noSubstitute;
-}
-
-U_CAPI USet* U_EXPORT2
-ulocdata_getExemplarSet(ULocaleData *uld, USet *fillIn,
- uint32_t options, ULocaleDataExemplarSetType extype, UErrorCode *status){
-
- static const char* const exemplarSetTypes[] = { "ExemplarCharacters",
- "AuxExemplarCharacters",
- "ExemplarCharactersIndex",
- "ExemplarCharactersPunctuation"};
- const UChar *exemplarChars = NULL;
- int32_t len = 0;
- UErrorCode localStatus = U_ZERO_ERROR;
-
- if (U_FAILURE(*status))
- return NULL;
-
- exemplarChars = ures_getStringByKey(uld->bundle, exemplarSetTypes[extype], &len, &localStatus);
- if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) {
- localStatus = U_MISSING_RESOURCE_ERROR;
- }
-
- if (localStatus != U_ZERO_ERROR) {
- *status = localStatus;
- }
-
- if (U_FAILURE(*status))
- return NULL;
-
- if(fillIn != NULL)
- uset_applyPattern(fillIn, exemplarChars, len,
- USET_IGNORE_SPACE | options, status);
- else
- fillIn = uset_openPatternOptions(exemplarChars, len,
- USET_IGNORE_SPACE | options, status);
-
- return fillIn;
-
-}
-
-U_CAPI int32_t U_EXPORT2
-ulocdata_getDelimiter(ULocaleData *uld, ULocaleDataDelimiterType type,
- UChar *result, int32_t resultLength, UErrorCode *status){
-
- static const char* const delimiterKeys[] = {
- "quotationStart",
- "quotationEnd",
- "alternateQuotationStart",
- "alternateQuotationEnd"
- };
-
- UResourceBundle *delimiterBundle;
- int32_t len = 0;
- const UChar *delimiter = NULL;
- UErrorCode localStatus = U_ZERO_ERROR;
-
- if (U_FAILURE(*status))
- return 0;
-
- delimiterBundle = ures_getByKey(uld->bundle, "delimiters", NULL, &localStatus);
-
- if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) {
- localStatus = U_MISSING_RESOURCE_ERROR;
- }
-
- if (localStatus != U_ZERO_ERROR) {
- *status = localStatus;
- }
-
- if (U_FAILURE(*status)){
- ures_close(delimiterBundle);
- return 0;
- }
-
- delimiter = ures_getStringByKey(delimiterBundle, delimiterKeys[type], &len, &localStatus);
- ures_close(delimiterBundle);
-
- if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) {
- localStatus = U_MISSING_RESOURCE_ERROR;
- }
-
- if (localStatus != U_ZERO_ERROR) {
- *status = localStatus;
- }
-
- if (U_FAILURE(*status)){
- return 0;
- }
-
- u_strncpy(result,delimiter, resultLength);
- return len;
-}
-
-static UResourceBundle * measurementTypeBundleForLocale(const char *localeID, const char *measurementType, UErrorCode *status){
- char region[ULOC_COUNTRY_CAPACITY];
- UResourceBundle *rb;
- UResourceBundle *measTypeBundle = NULL;
-
- ulocimp_getRegionForSupplementalData(localeID, TRUE, region, ULOC_COUNTRY_CAPACITY, status);
-
- rb = ures_openDirect(NULL, "supplementalData", status);
- ures_getByKey(rb, "measurementData", rb, status);
- if (rb != NULL) {
- UResourceBundle *measDataBundle = ures_getByKey(rb, region, NULL, status);
- if (U_SUCCESS(*status)) {
- measTypeBundle = ures_getByKey(measDataBundle, measurementType, NULL, status);
- }
- if (*status == U_MISSING_RESOURCE_ERROR) {
- *status = U_ZERO_ERROR;
- if (measDataBundle != NULL) {
- ures_close(measDataBundle);
- }
- measDataBundle = ures_getByKey(rb, "001", NULL, status);
- measTypeBundle = ures_getByKey(measDataBundle, measurementType, NULL, status);
- }
- ures_close(measDataBundle);
- }
- ures_close(rb);
- return measTypeBundle;
-}
-
-U_CAPI UMeasurementSystem U_EXPORT2
-ulocdata_getMeasurementSystem(const char *localeID, UErrorCode *status){
-
- UResourceBundle* measurement=NULL;
- UMeasurementSystem system = UMS_LIMIT;
-
- if(status == NULL || U_FAILURE(*status)){
- return system;
- }
-
- measurement = measurementTypeBundleForLocale(localeID, MEASUREMENT_SYSTEM, status);
- system = (UMeasurementSystem) ures_getInt(measurement, status);
-
- ures_close(measurement);
-
- return system;
-
-}
-
-U_CAPI void U_EXPORT2
-ulocdata_getPaperSize(const char* localeID, int32_t *height, int32_t *width, UErrorCode *status){
- UResourceBundle* paperSizeBundle = NULL;
- const int32_t* paperSize=NULL;
- int32_t len = 0;
-
- if(status == NULL || U_FAILURE(*status)){
- return;
- }
-
- paperSizeBundle = measurementTypeBundleForLocale(localeID, PAPER_SIZE, status);
- paperSize = ures_getIntVector(paperSizeBundle, &len, status);
-
- if(U_SUCCESS(*status)){
- if(len < 2){
- *status = U_INTERNAL_PROGRAM_ERROR;
- }else{
- *height = paperSize[0];
- *width = paperSize[1];
- }
- }
-
- ures_close(paperSizeBundle);
-
-}
-
-U_CAPI void U_EXPORT2
-ulocdata_getCLDRVersion(UVersionInfo versionArray, UErrorCode *status) {
- UResourceBundle *rb = NULL;
- rb = ures_openDirect(NULL, "supplementalData", status);
- ures_getVersionByKey(rb, "cldrVersion", versionArray, status);
- ures_close(rb);
-}
-
-U_CAPI int32_t U_EXPORT2
-ulocdata_getLocaleDisplayPattern(ULocaleData *uld,
- UChar *result,
- int32_t resultCapacity,
- UErrorCode *status) {
- UResourceBundle *patternBundle;
- int32_t len = 0;
- const UChar *pattern = NULL;
- UErrorCode localStatus = U_ZERO_ERROR;
-
- if (U_FAILURE(*status))
- return 0;
-
- patternBundle = ures_getByKey(uld->langBundle, "localeDisplayPattern", NULL, &localStatus);
-
- if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) {
- localStatus = U_MISSING_RESOURCE_ERROR;
- }
-
- if (localStatus != U_ZERO_ERROR) {
- *status = localStatus;
- }
-
- if (U_FAILURE(*status)){
- ures_close(patternBundle);
- return 0;
- }
-
- pattern = ures_getStringByKey(patternBundle, "pattern", &len, &localStatus);
- ures_close(patternBundle);
-
- if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) {
- localStatus = U_MISSING_RESOURCE_ERROR;
- }
-
- if (localStatus != U_ZERO_ERROR) {
- *status = localStatus;
- }
-
- if (U_FAILURE(*status)){
- return 0;
- }
-
- u_strncpy(result, pattern, resultCapacity);
- return len;
-}
-
-
-U_CAPI int32_t U_EXPORT2
-ulocdata_getLocaleSeparator(ULocaleData *uld,
- UChar *result,
- int32_t resultCapacity,
- UErrorCode *status) {
- UResourceBundle *separatorBundle;
- int32_t len = 0;
- const UChar *separator = NULL;
- UErrorCode localStatus = U_ZERO_ERROR;
- UChar *p0, *p1;
- static const UChar sub0[4] = { 0x007b, 0x0030, 0x007d , 0x0000 }; /* {0} */
- static const UChar sub1[4] = { 0x007b, 0x0031, 0x007d , 0x0000 }; /* {1} */
- static const int32_t subLen = 3;
-
- if (U_FAILURE(*status))
- return 0;
-
- separatorBundle = ures_getByKey(uld->langBundle, "localeDisplayPattern", NULL, &localStatus);
-
- if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) {
- localStatus = U_MISSING_RESOURCE_ERROR;
- }
-
- if (localStatus != U_ZERO_ERROR) {
- *status = localStatus;
- }
-
- if (U_FAILURE(*status)){
- ures_close(separatorBundle);
- return 0;
- }
-
- separator = ures_getStringByKey(separatorBundle, "separator", &len, &localStatus);
- ures_close(separatorBundle);
-
- if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) {
- localStatus = U_MISSING_RESOURCE_ERROR;
- }
-
- if (localStatus != U_ZERO_ERROR) {
- *status = localStatus;
- }
-
- if (U_FAILURE(*status)){
- return 0;
- }
-
- /* For backwards compatibility, if we have a pattern, return the portion between {0} and {1} */
- p0=u_strstr(separator, sub0);
- p1=u_strstr(separator, sub1);
- if (p0!=NULL && p1!=NULL && p0<=p1) {
- separator = (const UChar *)p0 + subLen;
- len = static_cast<int32_t>(p1 - separator);
- /* Desired separator is no longer zero-terminated; handle that if necessary */
- if (len < resultCapacity) {
- u_strncpy(result, separator, len);
- result[len] = 0;
- return len;
- }
- }
-
- u_strncpy(result, separator, resultCapacity);
- return len;
-}
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+* *
+* Copyright (C) 2003-2016, International Business Machines *
+* Corporation and others. All Rights Reserved. *
+* *
+******************************************************************************
+* file name: ulocdata.c
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2003Oct21
+* created by: Ram Viswanadha,John Emmons
+*/
+
+#include "cmemory.h"
+#include "unicode/ustring.h"
+#include "unicode/ures.h"
+#include "unicode/uloc.h"
+#include "unicode/ulocdata.h"
+#include "uresimp.h"
+#include "ureslocs.h"
+#include "ulocimp.h"
+
+#define MEASUREMENT_SYSTEM "MeasurementSystem"
+#define PAPER_SIZE "PaperSize"
+
+/** A locale data object.
+ * For usage in C programs.
+ * @draft ICU 3.4
+ */
+struct ULocaleData {
+ /**
+ * Controls the "No Substitute" behavior of this locale data object
+ */
+ UBool noSubstitute;
+
+ /**
+ * Pointer to the resource bundle associated with this locale data object
+ */
+ UResourceBundle *bundle;
+
+ /**
+ * Pointer to the lang resource bundle associated with this locale data object
+ */
+ UResourceBundle *langBundle;
+};
+
+U_CAPI ULocaleData* U_EXPORT2
+ulocdata_open(const char *localeID, UErrorCode *status)
+{
+ ULocaleData *uld;
+
+ if (U_FAILURE(*status)) {
+ return NULL;
+ }
+
+ uld = (ULocaleData *)uprv_malloc(sizeof(ULocaleData));
+ if (uld == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return(NULL);
+ }
+
+ uld->langBundle = NULL;
+
+ uld->noSubstitute = FALSE;
+ uld->bundle = ures_open(NULL, localeID, status);
+ uld->langBundle = ures_open(U_ICUDATA_LANG, localeID, status);
+
+ if (U_FAILURE(*status)) {
+ uprv_free(uld);
+ return NULL;
+ }
+
+ return uld;
+}
+
+U_CAPI void U_EXPORT2
+ulocdata_close(ULocaleData *uld)
+{
+ if ( uld != NULL ) {
+ ures_close(uld->langBundle);
+ ures_close(uld->bundle);
+ uprv_free(uld);
+ }
+}
+
+U_CAPI void U_EXPORT2
+ulocdata_setNoSubstitute(ULocaleData *uld, UBool setting)
+{
+ uld->noSubstitute = setting;
+}
+
+U_CAPI UBool U_EXPORT2
+ulocdata_getNoSubstitute(ULocaleData *uld)
+{
+ return uld->noSubstitute;
+}
+
+U_CAPI USet* U_EXPORT2
+ulocdata_getExemplarSet(ULocaleData *uld, USet *fillIn,
+ uint32_t options, ULocaleDataExemplarSetType extype, UErrorCode *status){
+
+ static const char* const exemplarSetTypes[] = { "ExemplarCharacters",
+ "AuxExemplarCharacters",
+ "ExemplarCharactersIndex",
+ "ExemplarCharactersPunctuation"};
+ const UChar *exemplarChars = NULL;
+ int32_t len = 0;
+ UErrorCode localStatus = U_ZERO_ERROR;
+
+ if (U_FAILURE(*status))
+ return NULL;
+
+ exemplarChars = ures_getStringByKey(uld->bundle, exemplarSetTypes[extype], &len, &localStatus);
+ if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) {
+ localStatus = U_MISSING_RESOURCE_ERROR;
+ }
+
+ if (localStatus != U_ZERO_ERROR) {
+ *status = localStatus;
+ }
+
+ if (U_FAILURE(*status))
+ return NULL;
+
+ if(fillIn != NULL)
+ uset_applyPattern(fillIn, exemplarChars, len,
+ USET_IGNORE_SPACE | options, status);
+ else
+ fillIn = uset_openPatternOptions(exemplarChars, len,
+ USET_IGNORE_SPACE | options, status);
+
+ return fillIn;
+
+}
+
+U_CAPI int32_t U_EXPORT2
+ulocdata_getDelimiter(ULocaleData *uld, ULocaleDataDelimiterType type,
+ UChar *result, int32_t resultLength, UErrorCode *status){
+
+ static const char* const delimiterKeys[] = {
+ "quotationStart",
+ "quotationEnd",
+ "alternateQuotationStart",
+ "alternateQuotationEnd"
+ };
+
+ UResourceBundle *delimiterBundle;
+ int32_t len = 0;
+ const UChar *delimiter = NULL;
+ UErrorCode localStatus = U_ZERO_ERROR;
+
+ if (U_FAILURE(*status))
+ return 0;
+
+ delimiterBundle = ures_getByKey(uld->bundle, "delimiters", NULL, &localStatus);
+
+ if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) {
+ localStatus = U_MISSING_RESOURCE_ERROR;
+ }
+
+ if (localStatus != U_ZERO_ERROR) {
+ *status = localStatus;
+ }
+
+ if (U_FAILURE(*status)){
+ ures_close(delimiterBundle);
+ return 0;
+ }
+
+ delimiter = ures_getStringByKey(delimiterBundle, delimiterKeys[type], &len, &localStatus);
+ ures_close(delimiterBundle);
+
+ if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) {
+ localStatus = U_MISSING_RESOURCE_ERROR;
+ }
+
+ if (localStatus != U_ZERO_ERROR) {
+ *status = localStatus;
+ }
+
+ if (U_FAILURE(*status)){
+ return 0;
+ }
+
+ u_strncpy(result,delimiter, resultLength);
+ return len;
+}
+
+static UResourceBundle * measurementTypeBundleForLocale(const char *localeID, const char *measurementType, UErrorCode *status){
+ char region[ULOC_COUNTRY_CAPACITY];
+ UResourceBundle *rb;
+ UResourceBundle *measTypeBundle = NULL;
+
+ ulocimp_getRegionForSupplementalData(localeID, TRUE, region, ULOC_COUNTRY_CAPACITY, status);
+
+ rb = ures_openDirect(NULL, "supplementalData", status);
+ ures_getByKey(rb, "measurementData", rb, status);
+ if (rb != NULL) {
+ UResourceBundle *measDataBundle = ures_getByKey(rb, region, NULL, status);
+ if (U_SUCCESS(*status)) {
+ measTypeBundle = ures_getByKey(measDataBundle, measurementType, NULL, status);
+ }
+ if (*status == U_MISSING_RESOURCE_ERROR) {
+ *status = U_ZERO_ERROR;
+ if (measDataBundle != NULL) {
+ ures_close(measDataBundle);
+ }
+ measDataBundle = ures_getByKey(rb, "001", NULL, status);
+ measTypeBundle = ures_getByKey(measDataBundle, measurementType, NULL, status);
+ }
+ ures_close(measDataBundle);
+ }
+ ures_close(rb);
+ return measTypeBundle;
+}
+
+U_CAPI UMeasurementSystem U_EXPORT2
+ulocdata_getMeasurementSystem(const char *localeID, UErrorCode *status){
+
+ UResourceBundle* measurement=NULL;
+ UMeasurementSystem system = UMS_LIMIT;
+
+ if(status == NULL || U_FAILURE(*status)){
+ return system;
+ }
+
+ measurement = measurementTypeBundleForLocale(localeID, MEASUREMENT_SYSTEM, status);
+ system = (UMeasurementSystem) ures_getInt(measurement, status);
+
+ ures_close(measurement);
+
+ return system;
+
+}
+
+U_CAPI void U_EXPORT2
+ulocdata_getPaperSize(const char* localeID, int32_t *height, int32_t *width, UErrorCode *status){
+ UResourceBundle* paperSizeBundle = NULL;
+ const int32_t* paperSize=NULL;
+ int32_t len = 0;
+
+ if(status == NULL || U_FAILURE(*status)){
+ return;
+ }
+
+ paperSizeBundle = measurementTypeBundleForLocale(localeID, PAPER_SIZE, status);
+ paperSize = ures_getIntVector(paperSizeBundle, &len, status);
+
+ if(U_SUCCESS(*status)){
+ if(len < 2){
+ *status = U_INTERNAL_PROGRAM_ERROR;
+ }else{
+ *height = paperSize[0];
+ *width = paperSize[1];
+ }
+ }
+
+ ures_close(paperSizeBundle);
+
+}
+
+U_CAPI void U_EXPORT2
+ulocdata_getCLDRVersion(UVersionInfo versionArray, UErrorCode *status) {
+ UResourceBundle *rb = NULL;
+ rb = ures_openDirect(NULL, "supplementalData", status);
+ ures_getVersionByKey(rb, "cldrVersion", versionArray, status);
+ ures_close(rb);
+}
+
+U_CAPI int32_t U_EXPORT2
+ulocdata_getLocaleDisplayPattern(ULocaleData *uld,
+ UChar *result,
+ int32_t resultCapacity,
+ UErrorCode *status) {
+ UResourceBundle *patternBundle;
+ int32_t len = 0;
+ const UChar *pattern = NULL;
+ UErrorCode localStatus = U_ZERO_ERROR;
+
+ if (U_FAILURE(*status))
+ return 0;
+
+ patternBundle = ures_getByKey(uld->langBundle, "localeDisplayPattern", NULL, &localStatus);
+
+ if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) {
+ localStatus = U_MISSING_RESOURCE_ERROR;
+ }
+
+ if (localStatus != U_ZERO_ERROR) {
+ *status = localStatus;
+ }
+
+ if (U_FAILURE(*status)){
+ ures_close(patternBundle);
+ return 0;
+ }
+
+ pattern = ures_getStringByKey(patternBundle, "pattern", &len, &localStatus);
+ ures_close(patternBundle);
+
+ if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) {
+ localStatus = U_MISSING_RESOURCE_ERROR;
+ }
+
+ if (localStatus != U_ZERO_ERROR) {
+ *status = localStatus;
+ }
+
+ if (U_FAILURE(*status)){
+ return 0;
+ }
+
+ u_strncpy(result, pattern, resultCapacity);
+ return len;
+}
+
+
+U_CAPI int32_t U_EXPORT2
+ulocdata_getLocaleSeparator(ULocaleData *uld,
+ UChar *result,
+ int32_t resultCapacity,
+ UErrorCode *status) {
+ UResourceBundle *separatorBundle;
+ int32_t len = 0;
+ const UChar *separator = NULL;
+ UErrorCode localStatus = U_ZERO_ERROR;
+ UChar *p0, *p1;
+ static const UChar sub0[4] = { 0x007b, 0x0030, 0x007d , 0x0000 }; /* {0} */
+ static const UChar sub1[4] = { 0x007b, 0x0031, 0x007d , 0x0000 }; /* {1} */
+ static const int32_t subLen = 3;
+
+ if (U_FAILURE(*status))
+ return 0;
+
+ separatorBundle = ures_getByKey(uld->langBundle, "localeDisplayPattern", NULL, &localStatus);
+
+ if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) {
+ localStatus = U_MISSING_RESOURCE_ERROR;
+ }
+
+ if (localStatus != U_ZERO_ERROR) {
+ *status = localStatus;
+ }
+
+ if (U_FAILURE(*status)){
+ ures_close(separatorBundle);
+ return 0;
+ }
+
+ separator = ures_getStringByKey(separatorBundle, "separator", &len, &localStatus);
+ ures_close(separatorBundle);
+
+ if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) {
+ localStatus = U_MISSING_RESOURCE_ERROR;
+ }
+
+ if (localStatus != U_ZERO_ERROR) {
+ *status = localStatus;
+ }
+
+ if (U_FAILURE(*status)){
+ return 0;
+ }
+
+ /* For backwards compatibility, if we have a pattern, return the portion between {0} and {1} */
+ p0=u_strstr(separator, sub0);
+ p1=u_strstr(separator, sub1);
+ if (p0!=NULL && p1!=NULL && p0<=p1) {
+ separator = (const UChar *)p0 + subLen;
+ len = static_cast<int32_t>(p1 - separator);
+ /* Desired separator is no longer zero-terminated; handle that if necessary */
+ if (len < resultCapacity) {
+ u_strncpy(result, separator, len);
+ result[len] = 0;
+ return len;
+ }
+ }
+
+ u_strncpy(result, separator, resultCapacity);
+ return len;
+}
diff --git a/contrib/libs/icu/i18n/umsg.cpp b/contrib/libs/icu/i18n/umsg.cpp
index f4019fe479..9a5344e019 100644
--- a/contrib/libs/icu/i18n/umsg.cpp
+++ b/contrib/libs/icu/i18n/umsg.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: umsg.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -321,7 +321,7 @@ umsg_applyPattern(UMessageFormat *fmt,
if(status ==NULL||U_FAILURE(*status)){
return ;
}
- if(fmt==NULL || (pattern==NULL && patternLength!=0) || patternLength<-1) {
+ if(fmt==NULL || (pattern==NULL && patternLength!=0) || patternLength<-1) {
*status=U_ILLEGAL_ARGUMENT_ERROR;
return ;
}
@@ -330,7 +330,7 @@ umsg_applyPattern(UMessageFormat *fmt,
parseError = &tErr;
}
- // UnicodeString(pattern, -1) calls u_strlen().
+ // UnicodeString(pattern, -1) calls u_strlen().
((MessageFormat*)fmt)->applyPattern(UnicodeString(pattern,patternLength),*parseError,*status);
}
@@ -463,7 +463,7 @@ umsg_vformat( const UMessageFormat *fmt,
default:
// Unknown/unsupported argument type.
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
}
UnicodeString resultStr;
@@ -590,11 +590,11 @@ umsg_vparse(const UMessageFormat *fmt,
// support kObject. When MessageFormat is changed to
// understand MeasureFormats, modify this code to do the
// right thing. [alan]
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
// better not happen!
case Formattable::kArray:
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
}
diff --git a/contrib/libs/icu/i18n/umsg_imp.h b/contrib/libs/icu/i18n/umsg_imp.h
index 2e080dc337..43ef1c78f0 100644
--- a/contrib/libs/icu/i18n/umsg_imp.h
+++ b/contrib/libs/icu/i18n/umsg_imp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: umsg_imp.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/i18n/unesctrn.cpp b/contrib/libs/icu/i18n/unesctrn.cpp
index 68549a64f9..0636fe1d14 100644
--- a/contrib/libs/icu/i18n/unesctrn.cpp
+++ b/contrib/libs/icu/i18n/unesctrn.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -164,7 +164,7 @@ UnescapeTransliterator::~UnescapeTransliterator() {
/**
* Transliterator API.
*/
-UnescapeTransliterator* UnescapeTransliterator::clone() const {
+UnescapeTransliterator* UnescapeTransliterator::clone() const {
return new UnescapeTransliterator(*this);
}
diff --git a/contrib/libs/icu/i18n/unesctrn.h b/contrib/libs/icu/i18n/unesctrn.h
index 7bd2c29d89..57dd8d32cf 100644
--- a/contrib/libs/icu/i18n/unesctrn.h
+++ b/contrib/libs/icu/i18n/unesctrn.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -77,7 +77,7 @@ class UnescapeTransliterator : public Transliterator {
/**
* Transliterator API.
*/
- virtual UnescapeTransliterator* clone() const;
+ virtual UnescapeTransliterator* clone() const;
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
diff --git a/contrib/libs/icu/i18n/uni2name.cpp b/contrib/libs/icu/i18n/uni2name.cpp
index 81048b91ba..41d5c931e4 100644
--- a/contrib/libs/icu/i18n/uni2name.cpp
+++ b/contrib/libs/icu/i18n/uni2name.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -60,7 +60,7 @@ UnicodeNameTransliterator::UnicodeNameTransliterator(const UnicodeNameTransliter
/**
* Transliterator API.
*/
-UnicodeNameTransliterator* UnicodeNameTransliterator::clone() const {
+UnicodeNameTransliterator* UnicodeNameTransliterator::clone() const {
return new UnicodeNameTransliterator(*this);
}
diff --git a/contrib/libs/icu/i18n/uni2name.h b/contrib/libs/icu/i18n/uni2name.h
index 91f24100a6..99309c8e0f 100644
--- a/contrib/libs/icu/i18n/uni2name.h
+++ b/contrib/libs/icu/i18n/uni2name.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -48,7 +48,7 @@ class UnicodeNameTransliterator : public Transliterator {
/**
* Transliterator API.
*/
- virtual UnicodeNameTransliterator* clone() const;
+ virtual UnicodeNameTransliterator* clone() const;
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
diff --git a/contrib/libs/icu/i18n/unum.cpp b/contrib/libs/icu/i18n/unum.cpp
index a0b66dd025..cce3db7d0b 100644
--- a/contrib/libs/icu/i18n/unum.cpp
+++ b/contrib/libs/icu/i18n/unum.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -135,11 +135,11 @@ unum_open( UNumberFormatStyle style,
*status = U_MEMORY_ALLOCATION_ERROR;
}
- if (U_FAILURE(*status) && retVal != NULL) {
- delete retVal;
- retVal = NULL;
- }
-
+ if (U_FAILURE(*status) && retVal != NULL) {
+ delete retVal;
+ retVal = NULL;
+ }
+
return reinterpret_cast<UNumberFormat *>(retVal);
}
@@ -252,34 +252,34 @@ unum_formatDouble( const UNumberFormat* fmt,
return res.extract(result, resultLength, *status);
}
-U_CAPI int32_t U_EXPORT2
-unum_formatDoubleForFields(const UNumberFormat* format,
- double number,
- UChar* result,
- int32_t resultLength,
- UFieldPositionIterator* fpositer,
- UErrorCode* status)
-{
- if (U_FAILURE(*status))
- return -1;
-
- if (result == NULL ? resultLength != 0 : resultLength < 0) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return -1;
- }
-
- UnicodeString res;
- if (result != NULL) {
- // NULL destination for pure preflighting: empty dummy string
- // otherwise, alias the destination buffer
- res.setTo(result, 0, resultLength);
- }
-
- ((const NumberFormat*)format)->format(number, res, (FieldPositionIterator*)fpositer, *status);
-
- return res.extract(result, resultLength, *status);
-}
-
+U_CAPI int32_t U_EXPORT2
+unum_formatDoubleForFields(const UNumberFormat* format,
+ double number,
+ UChar* result,
+ int32_t resultLength,
+ UFieldPositionIterator* fpositer,
+ UErrorCode* status)
+{
+ if (U_FAILURE(*status))
+ return -1;
+
+ if (result == NULL ? resultLength != 0 : resultLength < 0) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return -1;
+ }
+
+ UnicodeString res;
+ if (result != NULL) {
+ // NULL destination for pure preflighting: empty dummy string
+ // otherwise, alias the destination buffer
+ res.setTo(result, 0, resultLength);
+ }
+
+ ((const NumberFormat*)format)->format(number, res, (FieldPositionIterator*)fpositer, *status);
+
+ return res.extract(result, resultLength, *status);
+}
+
U_CAPI int32_t U_EXPORT2
unum_formatDecimal(const UNumberFormat* fmt,
const char * number,
@@ -303,7 +303,7 @@ unum_formatDecimal(const UNumberFormat* fmt,
}
if (length < 0) {
- length = static_cast<int32_t>(uprv_strlen(number));
+ length = static_cast<int32_t>(uprv_strlen(number));
}
StringPiece numSP(number, length);
Formattable numFmtbl(numSP, *status);
@@ -512,43 +512,43 @@ U_CAPI int32_t U_EXPORT2
unum_getAttribute(const UNumberFormat* fmt,
UNumberFormatAttribute attr)
{
- const NumberFormat* nf = reinterpret_cast<const NumberFormat*>(fmt);
- if (attr == UNUM_LENIENT_PARSE) {
- // Supported for all subclasses
- return nf->isLenient();
- }
- else if (attr == UNUM_MAX_INTEGER_DIGITS) {
- return nf->getMaximumIntegerDigits();
- }
- else if (attr == UNUM_MIN_INTEGER_DIGITS) {
- return nf->getMinimumIntegerDigits();
- }
- else if (attr == UNUM_INTEGER_DIGITS) {
- // TODO: what should this return?
- return nf->getMinimumIntegerDigits();
- }
- else if (attr == UNUM_MAX_FRACTION_DIGITS) {
- return nf->getMaximumFractionDigits();
- }
- else if (attr == UNUM_MIN_FRACTION_DIGITS) {
- return nf->getMinimumFractionDigits();
- }
- else if (attr == UNUM_FRACTION_DIGITS) {
- // TODO: what should this return?
- return nf->getMinimumFractionDigits();
- }
- else if (attr == UNUM_ROUNDING_MODE) {
- return nf->getRoundingMode();
- }
-
- // The remaining attributes are only supported for DecimalFormat
- const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(nf);
- if (df != NULL) {
- UErrorCode ignoredStatus = U_ZERO_ERROR;
- return df->getAttribute(attr, ignoredStatus);
- }
-
- return -1;
+ const NumberFormat* nf = reinterpret_cast<const NumberFormat*>(fmt);
+ if (attr == UNUM_LENIENT_PARSE) {
+ // Supported for all subclasses
+ return nf->isLenient();
+ }
+ else if (attr == UNUM_MAX_INTEGER_DIGITS) {
+ return nf->getMaximumIntegerDigits();
+ }
+ else if (attr == UNUM_MIN_INTEGER_DIGITS) {
+ return nf->getMinimumIntegerDigits();
+ }
+ else if (attr == UNUM_INTEGER_DIGITS) {
+ // TODO: what should this return?
+ return nf->getMinimumIntegerDigits();
+ }
+ else if (attr == UNUM_MAX_FRACTION_DIGITS) {
+ return nf->getMaximumFractionDigits();
+ }
+ else if (attr == UNUM_MIN_FRACTION_DIGITS) {
+ return nf->getMinimumFractionDigits();
+ }
+ else if (attr == UNUM_FRACTION_DIGITS) {
+ // TODO: what should this return?
+ return nf->getMinimumFractionDigits();
+ }
+ else if (attr == UNUM_ROUNDING_MODE) {
+ return nf->getRoundingMode();
+ }
+
+ // The remaining attributes are only supported for DecimalFormat
+ const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(nf);
+ if (df != NULL) {
+ UErrorCode ignoredStatus = U_ZERO_ERROR;
+ return df->getAttribute(attr, ignoredStatus);
+ }
+
+ return -1;
}
U_CAPI void U_EXPORT2
@@ -556,42 +556,42 @@ unum_setAttribute( UNumberFormat* fmt,
UNumberFormatAttribute attr,
int32_t newValue)
{
- NumberFormat* nf = reinterpret_cast<NumberFormat*>(fmt);
- if (attr == UNUM_LENIENT_PARSE) {
- // Supported for all subclasses
- // keep this here as the class may not be a DecimalFormat
- return nf->setLenient(newValue != 0);
- }
- else if (attr == UNUM_MAX_INTEGER_DIGITS) {
- return nf->setMaximumIntegerDigits(newValue);
- }
- else if (attr == UNUM_MIN_INTEGER_DIGITS) {
- return nf->setMinimumIntegerDigits(newValue);
- }
- else if (attr == UNUM_INTEGER_DIGITS) {
- nf->setMinimumIntegerDigits(newValue);
- return nf->setMaximumIntegerDigits(newValue);
- }
- else if (attr == UNUM_MAX_FRACTION_DIGITS) {
- return nf->setMaximumFractionDigits(newValue);
- }
- else if (attr == UNUM_MIN_FRACTION_DIGITS) {
- return nf->setMinimumFractionDigits(newValue);
- }
- else if (attr == UNUM_FRACTION_DIGITS) {
- nf->setMinimumFractionDigits(newValue);
- return nf->setMaximumFractionDigits(newValue);
- }
- else if (attr == UNUM_ROUNDING_MODE) {
- return nf->setRoundingMode((NumberFormat::ERoundingMode)newValue);
- }
-
- // The remaining attributes are only supported for DecimalFormat
- DecimalFormat* df = dynamic_cast<DecimalFormat*>(nf);
- if (df != NULL) {
- UErrorCode ignoredStatus = U_ZERO_ERROR;
- df->setAttribute(attr, newValue, ignoredStatus);
- }
+ NumberFormat* nf = reinterpret_cast<NumberFormat*>(fmt);
+ if (attr == UNUM_LENIENT_PARSE) {
+ // Supported for all subclasses
+ // keep this here as the class may not be a DecimalFormat
+ return nf->setLenient(newValue != 0);
+ }
+ else if (attr == UNUM_MAX_INTEGER_DIGITS) {
+ return nf->setMaximumIntegerDigits(newValue);
+ }
+ else if (attr == UNUM_MIN_INTEGER_DIGITS) {
+ return nf->setMinimumIntegerDigits(newValue);
+ }
+ else if (attr == UNUM_INTEGER_DIGITS) {
+ nf->setMinimumIntegerDigits(newValue);
+ return nf->setMaximumIntegerDigits(newValue);
+ }
+ else if (attr == UNUM_MAX_FRACTION_DIGITS) {
+ return nf->setMaximumFractionDigits(newValue);
+ }
+ else if (attr == UNUM_MIN_FRACTION_DIGITS) {
+ return nf->setMinimumFractionDigits(newValue);
+ }
+ else if (attr == UNUM_FRACTION_DIGITS) {
+ nf->setMinimumFractionDigits(newValue);
+ return nf->setMaximumFractionDigits(newValue);
+ }
+ else if (attr == UNUM_ROUNDING_MODE) {
+ return nf->setRoundingMode((NumberFormat::ERoundingMode)newValue);
+ }
+
+ // The remaining attributes are only supported for DecimalFormat
+ DecimalFormat* df = dynamic_cast<DecimalFormat*>(nf);
+ if (df != NULL) {
+ UErrorCode ignoredStatus = U_ZERO_ERROR;
+ df->setAttribute(attr, newValue, ignoredStatus);
+ }
}
U_CAPI double U_EXPORT2
diff --git a/contrib/libs/icu/i18n/unumsys.cpp b/contrib/libs/icu/i18n/unumsys.cpp
index 8ae3d752dd..4a0d0fa3b6 100644
--- a/contrib/libs/icu/i18n/unumsys.cpp
+++ b/contrib/libs/icu/i18n/unumsys.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************************
diff --git a/contrib/libs/icu/i18n/upluralrules.cpp b/contrib/libs/icu/i18n/upluralrules.cpp
index 1563ab09d6..5119257fd8 100644
--- a/contrib/libs/icu/i18n/upluralrules.cpp
+++ b/contrib/libs/icu/i18n/upluralrules.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************************
@@ -15,49 +15,49 @@
#include "unicode/plurrule.h"
#include "unicode/locid.h"
#include "unicode/unistr.h"
-#include "unicode/unum.h"
-#include "unicode/numfmt.h"
-#include "unicode/unumberformatter.h"
-#include "number_decimalquantity.h"
-#include "number_utypes.h"
+#include "unicode/unum.h"
+#include "unicode/numfmt.h"
+#include "unicode/unumberformatter.h"
+#include "number_decimalquantity.h"
+#include "number_utypes.h"
U_NAMESPACE_USE
-namespace {
+namespace {
+
+/**
+ * Given a number and a format, returns the keyword of the first applicable
+ * rule for the PluralRules object.
+ * @param rules The plural rules.
+ * @param obj The numeric object for which the rule should be determined.
+ * @param fmt The NumberFormat specifying how the number will be formatted
+ * (this can affect the plural form, e.g. "1 dollar" vs "1.0 dollars").
+ * @param status Input/output parameter. If at entry this indicates a
+ * failure status, the method returns immediately; otherwise
+ * this is set to indicate the outcome of the call.
+ * @return The keyword of the selected rule. Undefined in the case of an error.
+ */
+UnicodeString select(const PluralRules &rules, const Formattable& obj, const NumberFormat& fmt, UErrorCode& status) {
+ if (U_SUCCESS(status)) {
+ const DecimalFormat *decFmt = dynamic_cast<const DecimalFormat *>(&fmt);
+ if (decFmt != NULL) {
+ number::impl::DecimalQuantity dq;
+ decFmt->formatToDecimalQuantity(obj, dq, status);
+ if (U_SUCCESS(status)) {
+ return rules.select(dq);
+ }
+ } else {
+ double number = obj.getDouble(status);
+ if (U_SUCCESS(status)) {
+ return rules.select(number);
+ }
+ }
+ }
+ return UnicodeString();
+}
+
+} // namespace
-/**
- * Given a number and a format, returns the keyword of the first applicable
- * rule for the PluralRules object.
- * @param rules The plural rules.
- * @param obj The numeric object for which the rule should be determined.
- * @param fmt The NumberFormat specifying how the number will be formatted
- * (this can affect the plural form, e.g. "1 dollar" vs "1.0 dollars").
- * @param status Input/output parameter. If at entry this indicates a
- * failure status, the method returns immediately; otherwise
- * this is set to indicate the outcome of the call.
- * @return The keyword of the selected rule. Undefined in the case of an error.
- */
-UnicodeString select(const PluralRules &rules, const Formattable& obj, const NumberFormat& fmt, UErrorCode& status) {
- if (U_SUCCESS(status)) {
- const DecimalFormat *decFmt = dynamic_cast<const DecimalFormat *>(&fmt);
- if (decFmt != NULL) {
- number::impl::DecimalQuantity dq;
- decFmt->formatToDecimalQuantity(obj, dq, status);
- if (U_SUCCESS(status)) {
- return rules.select(dq);
- }
- } else {
- double number = obj.getDouble(status);
- if (U_SUCCESS(status)) {
- return rules.select(number);
- }
- }
- }
- return UnicodeString();
-}
-
-} // namespace
-
U_CAPI UPluralRules* U_EXPORT2
uplrules_open(const char *locale, UErrorCode *status)
{
@@ -93,70 +93,70 @@ uplrules_select(const UPluralRules *uplrules,
return result.extract(keyword, capacity, *status);
}
-U_CAPI int32_t U_EXPORT2
-uplrules_selectFormatted(const UPluralRules *uplrules,
- const UFormattedNumber* number,
- UChar *keyword, int32_t capacity,
- UErrorCode *status)
-{
- if (U_FAILURE(*status)) {
- return 0;
- }
- if (keyword == NULL ? capacity != 0 : capacity < 0) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
- const number::impl::DecimalQuantity* dq =
- number::impl::validateUFormattedNumberToDecimalQuantity(number, *status);
- if (U_FAILURE(*status)) {
- return 0;
- }
- UnicodeString result = ((PluralRules*)uplrules)->select(*dq);
- return result.extract(keyword, capacity, *status);
-}
+U_CAPI int32_t U_EXPORT2
+uplrules_selectFormatted(const UPluralRules *uplrules,
+ const UFormattedNumber* number,
+ UChar *keyword, int32_t capacity,
+ UErrorCode *status)
+{
+ if (U_FAILURE(*status)) {
+ return 0;
+ }
+ if (keyword == NULL ? capacity != 0 : capacity < 0) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+ const number::impl::DecimalQuantity* dq =
+ number::impl::validateUFormattedNumberToDecimalQuantity(number, *status);
+ if (U_FAILURE(*status)) {
+ return 0;
+ }
+ UnicodeString result = ((PluralRules*)uplrules)->select(*dq);
+ return result.extract(keyword, capacity, *status);
+}
+
+U_CAPI int32_t U_EXPORT2
+uplrules_selectWithFormat(const UPluralRules *uplrules,
+ double number,
+ const UNumberFormat *fmt,
+ UChar *keyword, int32_t capacity,
+ UErrorCode *status)
+{
+ if (U_FAILURE(*status)) {
+ return 0;
+ }
+ const PluralRules* plrules = reinterpret_cast<const PluralRules*>(uplrules);
+ const NumberFormat* nf = reinterpret_cast<const NumberFormat*>(fmt);
+ if (plrules == NULL || nf == NULL || ((keyword == NULL)? capacity != 0 : capacity < 0)) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+ Formattable obj(number);
+ UnicodeString result = select(*plrules, obj, *nf, *status);
+ return result.extract(keyword, capacity, *status);
+}
+
+U_CAPI UEnumeration* U_EXPORT2
+uplrules_getKeywords(const UPluralRules *uplrules,
+ UErrorCode *status)
+{
+ if (U_FAILURE(*status)) {
+ return NULL;
+ }
+ const PluralRules* plrules = reinterpret_cast<const PluralRules*>(uplrules);
+ if (plrules == NULL) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
+ }
+ StringEnumeration *senum = plrules->getKeywords(*status);
+ if (U_FAILURE(*status)) {
+ return NULL;
+ }
+ if (senum == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+ return uenum_openFromStringEnumeration(senum, status);
+}
-U_CAPI int32_t U_EXPORT2
-uplrules_selectWithFormat(const UPluralRules *uplrules,
- double number,
- const UNumberFormat *fmt,
- UChar *keyword, int32_t capacity,
- UErrorCode *status)
-{
- if (U_FAILURE(*status)) {
- return 0;
- }
- const PluralRules* plrules = reinterpret_cast<const PluralRules*>(uplrules);
- const NumberFormat* nf = reinterpret_cast<const NumberFormat*>(fmt);
- if (plrules == NULL || nf == NULL || ((keyword == NULL)? capacity != 0 : capacity < 0)) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
- Formattable obj(number);
- UnicodeString result = select(*plrules, obj, *nf, *status);
- return result.extract(keyword, capacity, *status);
-}
-
-U_CAPI UEnumeration* U_EXPORT2
-uplrules_getKeywords(const UPluralRules *uplrules,
- UErrorCode *status)
-{
- if (U_FAILURE(*status)) {
- return NULL;
- }
- const PluralRules* plrules = reinterpret_cast<const PluralRules*>(uplrules);
- if (plrules == NULL) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
- }
- StringEnumeration *senum = plrules->getKeywords(*status);
- if (U_FAILURE(*status)) {
- return NULL;
- }
- if (senum == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
- return uenum_openFromStringEnumeration(senum, status);
-}
-
#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/uregex.cpp b/contrib/libs/icu/i18n/uregex.cpp
index 31c5b9f5bc..7f41918cff 100644
--- a/contrib/libs/icu/i18n/uregex.cpp
+++ b/contrib/libs/icu/i18n/uregex.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -767,7 +767,7 @@ uregex_start64(URegularExpression *regexp2,
if (validateRE(regexp, TRUE, status) == FALSE) {
return 0;
}
- int64_t result = regexp->fMatcher->start64(groupNum, *status);
+ int64_t result = regexp->fMatcher->start64(groupNum, *status);
return result;
}
@@ -791,7 +791,7 @@ uregex_end64(URegularExpression *regexp2,
if (validateRE(regexp, TRUE, status) == FALSE) {
return 0;
}
- int64_t result = regexp->fMatcher->end64(groupNum, *status);
+ int64_t result = regexp->fMatcher->end64(groupNum, *status);
return result;
}
@@ -1465,10 +1465,10 @@ int32_t RegexCImpl::appendReplacement(RegularExpression *regexp,
int32_t groupNum = 0;
U_ASSERT(c == DOLLARSIGN);
- UChar32 c32 = -1;
- if (replIdx < replacementLength) {
- U16_GET(replacementText, 0, replIdx, replacementLength, c32);
- }
+ UChar32 c32 = -1;
+ if (replIdx < replacementLength) {
+ U16_GET(replacementText, 0, replIdx, replacementLength, c32);
+ }
if (u_isdigit(c32)) {
int32_t numDigits = 0;
int32_t numCaptureGroups = m->fPattern->fGroupMap->size();
@@ -1508,8 +1508,8 @@ int32_t RegexCImpl::appendReplacement(RegularExpression *regexp,
(c32 >= 0x31 && c32 <= 0x39)) { // 0..9
groupName.append(c32);
} else if (c32 == RIGHTBRACKET) {
- groupNum = regexp->fPat->fNamedCaptureMap ?
- uhash_geti(regexp->fPat->fNamedCaptureMap, &groupName) : 0;
+ groupNum = regexp->fPat->fNamedCaptureMap ?
+ uhash_geti(regexp->fPat->fNamedCaptureMap, &groupName) : 0;
if (groupNum == 0) {
// Name not defined by pattern.
*status = U_REGEX_INVALID_CAPTURE_GROUP_NAME;
@@ -1655,8 +1655,8 @@ int32_t RegexCImpl::appendTail(RegularExpression *regexp,
} else if (UTEXT_USES_U16(m->fInputText)) {
srcIdx = (int32_t)nativeIdx;
} else {
- UErrorCode newStatus = U_ZERO_ERROR;
- srcIdx = utext_extract(m->fInputText, 0, nativeIdx, NULL, 0, &newStatus);
+ UErrorCode newStatus = U_ZERO_ERROR;
+ srcIdx = utext_extract(m->fInputText, 0, nativeIdx, NULL, 0, &newStatus);
}
for (;;) {
diff --git a/contrib/libs/icu/i18n/uregexc.cpp b/contrib/libs/icu/i18n/uregexc.cpp
index a3b1f24a67..c7d3bcd2c7 100644
--- a/contrib/libs/icu/i18n/uregexc.cpp
+++ b/contrib/libs/icu/i18n/uregexc.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/uregion.cpp b/contrib/libs/icu/i18n/uregion.cpp
index a5e141d217..79a623730c 100644
--- a/contrib/libs/icu/i18n/uregion.cpp
+++ b/contrib/libs/icu/i18n/uregion.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************************
diff --git a/contrib/libs/icu/i18n/usearch.cpp b/contrib/libs/icu/i18n/usearch.cpp
index 532471c7f9..8866de7033 100644
--- a/contrib/libs/icu/i18n/usearch.cpp
+++ b/contrib/libs/icu/i18n/usearch.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -317,7 +317,7 @@ inline uint16_t initializePatternCETable(UStringSearch *strsrch,
uprv_free(pattern->ces);
}
- uint32_t offset = 0;
+ uint32_t offset = 0;
uint16_t result = 0;
int32_t ce;
@@ -388,7 +388,7 @@ inline uint16_t initializePatternPCETable(UStringSearch *strsrch,
uprv_free(pattern->pces);
}
- uint32_t offset = 0;
+ uint32_t offset = 0;
uint16_t result = 0;
int64_t pce;
@@ -498,7 +498,7 @@ inline void setShiftTable(int16_t shift[], int16_t backshift[],
for (count = 0; count < cesize; count ++) {
// number of ces from right of array to the count
int temp = defaultforward - count - 1;
- shift[hashFromCE32(cetable[count])] = temp > 1 ? static_cast<int16_t>(temp) : 1;
+ shift[hashFromCE32(cetable[count])] = temp > 1 ? static_cast<int16_t>(temp) : 1;
}
shift[hashFromCE32(cetable[cesize])] = 1;
// for ignorables we just shift by one. see test examples.
@@ -1351,7 +1351,7 @@ inline int getUnblockedAccentIndex(UChar *accents, int32_t *accentsindex)
* @param destinationlength target array size, returning the appended length
* @param source1 null-terminated first array
* @param source2 second array
-* @param source2length length of second array
+* @param source2length length of second array
* @param source3 null-terminated third array
* @param status error status if any
* @return new destination array, destination if there was no new allocation
@@ -1560,7 +1560,7 @@ inline void cleanUpSafeText(const UStringSearch *strsrch, UChar *safetext,
/**
* Take the rearranged end accents and tries matching. If match failed at
-* a separate preceding set of accents (separated from the rearranged on by
+* a separate preceding set of accents (separated from the rearranged on by
* at least a base character) then we rearrange the preceding accents and
* tries matching again.
* We allow skipping of the ends of the accent set if the ces do not match.
@@ -2220,7 +2220,7 @@ int32_t doPreviousCanonicalSuffixMatch(UStringSearch *strsrch,
/**
* Take the rearranged start accents and tries matching. If match failed at
-* a separate following set of accents (separated from the rearranged on by
+* a separate following set of accents (separated from the rearranged on by
* at least a base character) then we rearrange the preceding accents and
* tries matching again.
* We allow skipping of the ends of the accent set if the ces do not match.
@@ -3545,10 +3545,10 @@ const CEI *CEIBuffer::get(int32_t index) {
// that is allowed.
if (index != limitIx) {
U_ASSERT(FALSE);
- // TODO: In ICU 64 the above assert was changed to use UPRV_UNREACHABLE instead
- // which unconditionally calls abort(). However, there were cases where this was
- // being hit. This change is reverted for now, restoring the existing behavior.
- // ICU-20792 tracks the follow-up work/further investigation on this.
+ // TODO: In ICU 64 the above assert was changed to use UPRV_UNREACHABLE instead
+ // which unconditionally calls abort(). However, there were cases where this was
+ // being hit. This change is reverted for now, restoring the existing behavior.
+ // ICU-20792 tracks the follow-up work/further investigation on this.
return NULL;
}
@@ -3587,10 +3587,10 @@ const CEI *CEIBuffer::getPrevious(int32_t index) {
// that is allowed.
if (index != limitIx) {
U_ASSERT(FALSE);
- // TODO: In ICU 64 the above assert was changed to use UPRV_UNREACHABLE instead
- // which unconditionally calls abort(). However, there were cases where this was
- // being hit. This change is reverted for now, restoring the existing behavior.
- // ICU-20792 tracks the follow-up work/further investigation on this.
+ // TODO: In ICU 64 the above assert was changed to use UPRV_UNREACHABLE instead
+ // which unconditionally calls abort(). However, there were cases where this was
+ // being hit. This change is reverted for now, restoring the existing behavior.
+ // ICU-20792 tracks the follow-up work/further investigation on this.
return NULL;
}
@@ -3862,7 +3862,7 @@ U_CAPI UBool U_EXPORT2 usearch_search(UStringSearch *strsrch,
#endif
// Input parameter sanity check.
- // TODO: should input indices clip to the text length
+ // TODO: should input indices clip to the text length
// in the same way that UText does.
if(strsrch->pattern.cesLength == 0 ||
startIdx < 0 ||
@@ -4024,7 +4024,7 @@ U_CAPI UBool U_EXPORT2 usearch_search(UStringSearch *strsrch,
// Check for the start of the match being within an Collation Element Expansion,
// meaning that the first char of the match is only partially matched.
- // With expansions, the first CE will report the index of the source
+ // With expansions, the first CE will report the index of the source
// character, and all subsequent (expansions) CEs will report the source index of the
// _following_ character.
int32_t secondIx = firstCEI->highIndex;
diff --git a/contrib/libs/icu/i18n/uspoof.cpp b/contrib/libs/icu/i18n/uspoof.cpp
index bb878c6a44..33682389f5 100644
--- a/contrib/libs/icu/i18n/uspoof.cpp
+++ b/contrib/libs/icu/i18n/uspoof.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
***************************************************************************
@@ -6,7 +6,7 @@
* and others. All Rights Reserved.
***************************************************************************
* file name: uspoof.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -43,9 +43,9 @@ static UnicodeSet *gRecommendedSet = NULL;
static const Normalizer2 *gNfdNormalizer = NULL;
static UInitOnce gSpoofInitStaticsOnce = U_INITONCE_INITIALIZER;
-namespace {
-
-UBool U_CALLCONV
+namespace {
+
+UBool U_CALLCONV
uspoof_cleanup(void) {
delete gInclusionSet;
gInclusionSet = NULL;
@@ -56,103 +56,103 @@ uspoof_cleanup(void) {
return TRUE;
}
-void U_CALLCONV initializeStatics(UErrorCode &status) {
- static const char16_t *inclusionPat =
- u"['\\-.\\:\\u00B7\\u0375\\u058A\\u05F3\\u05F4\\u06FD\\u06FE\\u0F0B\\u200C"
- u"\\u200D\\u2010\\u2019\\u2027\\u30A0\\u30FB]";
- gInclusionSet = new UnicodeSet(UnicodeString(inclusionPat), status);
- if (gInclusionSet == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
+void U_CALLCONV initializeStatics(UErrorCode &status) {
+ static const char16_t *inclusionPat =
+ u"['\\-.\\:\\u00B7\\u0375\\u058A\\u05F3\\u05F4\\u06FD\\u06FE\\u0F0B\\u200C"
+ u"\\u200D\\u2010\\u2019\\u2027\\u30A0\\u30FB]";
+ gInclusionSet = new UnicodeSet(UnicodeString(inclusionPat), status);
+ if (gInclusionSet == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
gInclusionSet->freeze();
- // Note: data from IdentifierStatus.txt & IdentifierType.txt
+ // Note: data from IdentifierStatus.txt & IdentifierType.txt
// There is tooling to generate this constant in the unicodetools project:
// org.unicode.text.tools.RecommendedSetGenerator
// It will print the Java and C++ code to the console for easy copy-paste into this file.
- static const char16_t *recommendedPat =
- u"[0-9A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u0131\\u0134-\\u013E"
- u"\\u0141-\\u0148\\u014A-\\u017E\\u018F\\u01A0\\u01A1\\u01AF\\u01B0\\u01CD-"
- u"\\u01DC\\u01DE-\\u01E3\\u01E6-\\u01F0\\u01F4\\u01F5\\u01F8-\\u021B\\u021E"
- u"\\u021F\\u0226-\\u0233\\u0259\\u02BB\\u02BC\\u02EC\\u0300-\\u0304\\u0306-"
- u"\\u030C\\u030F-\\u0311\\u0313\\u0314\\u031B\\u0323-\\u0328\\u032D\\u032E"
- u"\\u0330\\u0331\\u0335\\u0338\\u0339\\u0342\\u0345\\u037B-\\u037D\\u0386"
- u"\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03CE\\u03FC-\\u045F\\u048A-"
- u"\\u04FF\\u0510-\\u0529\\u052E\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0586"
- u"\\u05B4\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u063F\\u0641-\\u0655\\u0660-"
- u"\\u0669\\u0670-\\u0672\\u0674\\u0679-\\u068D\\u068F-\\u06A0\\u06A2-\\u06D3"
- u"\\u06D5\\u06E5\\u06E6\\u06EE-\\u06FC\\u06FF\\u0750-\\u07B1\\u08A0-\\u08AC"
- u"\\u08B2\\u08B6-\\u08C7\\u0901-\\u094D\\u094F\\u0950\\u0956\\u0957\\u0960-"
- u"\\u0963\\u0966-\\u096F\\u0971-\\u0977\\u0979-\\u097F\\u0981-\\u0983\\u0985-"
- u"\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9"
- u"\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09E0-\\u09E3\\u09E6-"
- u"\\u09F1\\u09FE\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28"
- u"\\u0A2A-\\u0A30\\u0A32\\u0A35\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47"
- u"\\u0A48\\u0A4B-\\u0A4D\\u0A5C\\u0A66-\\u0A74\\u0A81-\\u0A83\\u0A85-\\u0A8D"
- u"\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9"
- u"\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-"
- u"\\u0AEF\\u0AFA-\\u0AFF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-"
- u"\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B43\\u0B47"
- u"\\u0B48\\u0B4B-\\u0B4D\\u0B55-\\u0B57\\u0B5F-\\u0B61\\u0B66-\\u0B6F\\u0B71"
- u"\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A"
- u"\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-"
- u"\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C01-"
- u"\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D-"
- u"\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C60\\u0C61\\u0C66-"
- u"\\u0C6F\\u0C80\\u0C82\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8"
- u"\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD"
- u"\\u0CD5\\u0CD6\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D00\\u0D02"
- u"\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D43\\u0D46-"
- u"\\u0D48\\u0D4A-\\u0D4E\\u0D54-\\u0D57\\u0D60\\u0D61\\u0D66-\\u0D6F\\u0D7A-"
- u"\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D8E\\u0D91-\\u0D96\\u0D9A-\\u0DA5\\u0DA7-"
- u"\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6"
- u"\\u0DD8-\\u0DDE\\u0DF2\\u0E01-\\u0E32\\u0E34-\\u0E3A\\u0E40-\\u0E4E\\u0E50-"
- u"\\u0E59\\u0E81\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-"
- u"\\u0EB2\\u0EB4-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9"
- u"\\u0EDE\\u0EDF\\u0F00\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F3E-\\u0F42\\u0F44-"
- u"\\u0F47\\u0F49-\\u0F4C\\u0F4E-\\u0F51\\u0F53-\\u0F56\\u0F58-\\u0F5B\\u0F5D-"
- u"\\u0F68\\u0F6A-\\u0F6C\\u0F71\\u0F72\\u0F74\\u0F7A-\\u0F80\\u0F82-\\u0F84"
- u"\\u0F86-\\u0F92\\u0F94-\\u0F97\\u0F99-\\u0F9C\\u0F9E-\\u0FA1\\u0FA3-\\u0FA6"
- u"\\u0FA8-\\u0FAB\\u0FAD-\\u0FB8\\u0FBA-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-"
- u"\\u109D\\u10C7\\u10CD\\u10D0-\\u10F0\\u10F7-\\u10FA\\u10FD-\\u10FF\\u1200-"
- u"\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288"
- u"\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-"
- u"\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-"
- u"\\u135F\\u1380-\\u138F\\u1780-\\u17A2\\u17A5-\\u17A7\\u17A9-\\u17B3\\u17B6-"
- u"\\u17CA\\u17D2\\u17D7\\u17DC\\u17E0-\\u17E9\\u1C90-\\u1CBA\\u1CBD-\\u1CBF"
- u"\\u1E00-\\u1E99\\u1E9E\\u1EA0-\\u1EF9\\u1F00-\\u1F15\\u1F18-\\u1F1D\\u1F20-"
- u"\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F70"
- u"\\u1F72\\u1F74\\u1F76\\u1F78\\u1F7A\\u1F7C\\u1F80-\\u1FB4\\u1FB6-\\u1FBA"
- u"\\u1FBC\\u1FC2-\\u1FC4\\u1FC6-\\u1FC8\\u1FCA\\u1FCC\\u1FD0-\\u1FD2\\u1FD6-"
- u"\\u1FDA\\u1FE0-\\u1FE2\\u1FE4-\\u1FEA\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FF8"
- u"\\u1FFA\\u1FFC\\u2D27\\u2D2D\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE"
- u"\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6"
- u"\\u2DD8-\\u2DDE\\u3005-\\u3007\\u3041-\\u3096\\u3099\\u309A\\u309D\\u309E"
- u"\\u30A1-\\u30FA\\u30FC-\\u30FE\\u3105-\\u312D\\u312F\\u31A0-\\u31BF\\u3400-"
- u"\\u4DBF\\u4E00-\\u9FFC\\uA67F\\uA717-\\uA71F\\uA788\\uA78D\\uA792\\uA793"
- u"\\uA7AA\\uA7AE\\uA7B8\\uA7B9\\uA7C2-\\uA7CA\\uA9E7-\\uA9FE\\uAA60-\\uAA76"
- u"\\uAA7A-\\uAA7F\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26"
- u"\\uAB28-\\uAB2E\\uAB66\\uAB67\\uAC00-\\uD7A3\\uFA0E\\uFA0F\\uFA11\\uFA13"
- u"\\uFA14\\uFA1F\\uFA21\\uFA23\\uFA24\\uFA27-\\uFA29\\U00011301\\U00011303"
- u"\\U0001133B\\U0001133C\\U00016FF0\\U00016FF1\\U0001B150-\\U0001B152"
- u"\\U0001B164-\\U0001B167\\U00020000-\\U0002A6DD\\U0002A700-\\U0002B734"
- u"\\U0002B740-\\U0002B81D\\U0002B820-\\U0002CEA1\\U0002CEB0-\\U0002EBE0"
- u"\\U00030000-\\U0003134A]";
-
- gRecommendedSet = new UnicodeSet(UnicodeString(recommendedPat), status);
- if (gRecommendedSet == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
- delete gInclusionSet;
- return;
- }
+ static const char16_t *recommendedPat =
+ u"[0-9A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u0131\\u0134-\\u013E"
+ u"\\u0141-\\u0148\\u014A-\\u017E\\u018F\\u01A0\\u01A1\\u01AF\\u01B0\\u01CD-"
+ u"\\u01DC\\u01DE-\\u01E3\\u01E6-\\u01F0\\u01F4\\u01F5\\u01F8-\\u021B\\u021E"
+ u"\\u021F\\u0226-\\u0233\\u0259\\u02BB\\u02BC\\u02EC\\u0300-\\u0304\\u0306-"
+ u"\\u030C\\u030F-\\u0311\\u0313\\u0314\\u031B\\u0323-\\u0328\\u032D\\u032E"
+ u"\\u0330\\u0331\\u0335\\u0338\\u0339\\u0342\\u0345\\u037B-\\u037D\\u0386"
+ u"\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03CE\\u03FC-\\u045F\\u048A-"
+ u"\\u04FF\\u0510-\\u0529\\u052E\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0586"
+ u"\\u05B4\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u063F\\u0641-\\u0655\\u0660-"
+ u"\\u0669\\u0670-\\u0672\\u0674\\u0679-\\u068D\\u068F-\\u06A0\\u06A2-\\u06D3"
+ u"\\u06D5\\u06E5\\u06E6\\u06EE-\\u06FC\\u06FF\\u0750-\\u07B1\\u08A0-\\u08AC"
+ u"\\u08B2\\u08B6-\\u08C7\\u0901-\\u094D\\u094F\\u0950\\u0956\\u0957\\u0960-"
+ u"\\u0963\\u0966-\\u096F\\u0971-\\u0977\\u0979-\\u097F\\u0981-\\u0983\\u0985-"
+ u"\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9"
+ u"\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09E0-\\u09E3\\u09E6-"
+ u"\\u09F1\\u09FE\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28"
+ u"\\u0A2A-\\u0A30\\u0A32\\u0A35\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47"
+ u"\\u0A48\\u0A4B-\\u0A4D\\u0A5C\\u0A66-\\u0A74\\u0A81-\\u0A83\\u0A85-\\u0A8D"
+ u"\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9"
+ u"\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-"
+ u"\\u0AEF\\u0AFA-\\u0AFF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-"
+ u"\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B43\\u0B47"
+ u"\\u0B48\\u0B4B-\\u0B4D\\u0B55-\\u0B57\\u0B5F-\\u0B61\\u0B66-\\u0B6F\\u0B71"
+ u"\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A"
+ u"\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-"
+ u"\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C01-"
+ u"\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D-"
+ u"\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C60\\u0C61\\u0C66-"
+ u"\\u0C6F\\u0C80\\u0C82\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8"
+ u"\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD"
+ u"\\u0CD5\\u0CD6\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D00\\u0D02"
+ u"\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D43\\u0D46-"
+ u"\\u0D48\\u0D4A-\\u0D4E\\u0D54-\\u0D57\\u0D60\\u0D61\\u0D66-\\u0D6F\\u0D7A-"
+ u"\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D8E\\u0D91-\\u0D96\\u0D9A-\\u0DA5\\u0DA7-"
+ u"\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6"
+ u"\\u0DD8-\\u0DDE\\u0DF2\\u0E01-\\u0E32\\u0E34-\\u0E3A\\u0E40-\\u0E4E\\u0E50-"
+ u"\\u0E59\\u0E81\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-"
+ u"\\u0EB2\\u0EB4-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9"
+ u"\\u0EDE\\u0EDF\\u0F00\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F3E-\\u0F42\\u0F44-"
+ u"\\u0F47\\u0F49-\\u0F4C\\u0F4E-\\u0F51\\u0F53-\\u0F56\\u0F58-\\u0F5B\\u0F5D-"
+ u"\\u0F68\\u0F6A-\\u0F6C\\u0F71\\u0F72\\u0F74\\u0F7A-\\u0F80\\u0F82-\\u0F84"
+ u"\\u0F86-\\u0F92\\u0F94-\\u0F97\\u0F99-\\u0F9C\\u0F9E-\\u0FA1\\u0FA3-\\u0FA6"
+ u"\\u0FA8-\\u0FAB\\u0FAD-\\u0FB8\\u0FBA-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-"
+ u"\\u109D\\u10C7\\u10CD\\u10D0-\\u10F0\\u10F7-\\u10FA\\u10FD-\\u10FF\\u1200-"
+ u"\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288"
+ u"\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-"
+ u"\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-"
+ u"\\u135F\\u1380-\\u138F\\u1780-\\u17A2\\u17A5-\\u17A7\\u17A9-\\u17B3\\u17B6-"
+ u"\\u17CA\\u17D2\\u17D7\\u17DC\\u17E0-\\u17E9\\u1C90-\\u1CBA\\u1CBD-\\u1CBF"
+ u"\\u1E00-\\u1E99\\u1E9E\\u1EA0-\\u1EF9\\u1F00-\\u1F15\\u1F18-\\u1F1D\\u1F20-"
+ u"\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F70"
+ u"\\u1F72\\u1F74\\u1F76\\u1F78\\u1F7A\\u1F7C\\u1F80-\\u1FB4\\u1FB6-\\u1FBA"
+ u"\\u1FBC\\u1FC2-\\u1FC4\\u1FC6-\\u1FC8\\u1FCA\\u1FCC\\u1FD0-\\u1FD2\\u1FD6-"
+ u"\\u1FDA\\u1FE0-\\u1FE2\\u1FE4-\\u1FEA\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FF8"
+ u"\\u1FFA\\u1FFC\\u2D27\\u2D2D\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE"
+ u"\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6"
+ u"\\u2DD8-\\u2DDE\\u3005-\\u3007\\u3041-\\u3096\\u3099\\u309A\\u309D\\u309E"
+ u"\\u30A1-\\u30FA\\u30FC-\\u30FE\\u3105-\\u312D\\u312F\\u31A0-\\u31BF\\u3400-"
+ u"\\u4DBF\\u4E00-\\u9FFC\\uA67F\\uA717-\\uA71F\\uA788\\uA78D\\uA792\\uA793"
+ u"\\uA7AA\\uA7AE\\uA7B8\\uA7B9\\uA7C2-\\uA7CA\\uA9E7-\\uA9FE\\uAA60-\\uAA76"
+ u"\\uAA7A-\\uAA7F\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26"
+ u"\\uAB28-\\uAB2E\\uAB66\\uAB67\\uAC00-\\uD7A3\\uFA0E\\uFA0F\\uFA11\\uFA13"
+ u"\\uFA14\\uFA1F\\uFA21\\uFA23\\uFA24\\uFA27-\\uFA29\\U00011301\\U00011303"
+ u"\\U0001133B\\U0001133C\\U00016FF0\\U00016FF1\\U0001B150-\\U0001B152"
+ u"\\U0001B164-\\U0001B167\\U00020000-\\U0002A6DD\\U0002A700-\\U0002B734"
+ u"\\U0002B740-\\U0002B81D\\U0002B820-\\U0002CEA1\\U0002CEB0-\\U0002EBE0"
+ u"\\U00030000-\\U0003134A]";
+
+ gRecommendedSet = new UnicodeSet(UnicodeString(recommendedPat), status);
+ if (gRecommendedSet == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ delete gInclusionSet;
+ return;
+ }
gRecommendedSet->freeze();
gNfdNormalizer = Normalizer2::getNFDInstance(status);
ucln_i18n_registerCleanup(UCLN_I18N_SPOOF, uspoof_cleanup);
}
-} // namespace
-
+} // namespace
+
U_CFUNC void uspoof_internalInitStatics(UErrorCode *status) {
umtx_initOnce(gSpoofInitStaticsOnce, &initializeStatics, *status);
}
@@ -164,13 +164,13 @@ uspoof_open(UErrorCode *status) {
return NULL;
}
SpoofImpl *si = new SpoofImpl(*status);
- if (si == NULL) {
+ if (si == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return NULL;
}
if (U_FAILURE(*status)) {
delete si;
- return NULL;
+ return NULL;
}
return si->asUSpoofChecker();
}
@@ -182,41 +182,41 @@ uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLeng
if (U_FAILURE(*status)) {
return NULL;
}
-
- if (data == NULL) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
- }
-
+
+ if (data == NULL) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
+ }
+
umtx_initOnce(gSpoofInitStaticsOnce, &initializeStatics, *status);
- if (U_FAILURE(*status))
- {
- return NULL;
- }
-
+ if (U_FAILURE(*status))
+ {
+ return NULL;
+ }
+
SpoofData *sd = new SpoofData(data, length, *status);
- if (sd == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
-
+ if (sd == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+
if (U_FAILURE(*status)) {
delete sd;
return NULL;
}
-
- SpoofImpl *si = new SpoofImpl(sd, *status);
- if (si == NULL) {
+
+ SpoofImpl *si = new SpoofImpl(sd, *status);
+ if (si == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
- delete sd; // explicit delete as the destructor for si won't be called.
+ delete sd; // explicit delete as the destructor for si won't be called.
return NULL;
}
-
- if (U_FAILURE(*status)) {
- delete si; // no delete for sd, as the si destructor will delete it.
- return NULL;
- }
-
+
+ if (U_FAILURE(*status)) {
+ delete si; // no delete for sd, as the si destructor will delete it.
+ return NULL;
+ }
+
if (pActualLength != NULL) {
*pActualLength = sd->size();
}
@@ -231,10 +231,10 @@ uspoof_clone(const USpoofChecker *sc, UErrorCode *status) {
return NULL;
}
SpoofImpl *result = new SpoofImpl(*src, *status); // copy constructor
- if (result == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
+ if (result == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
if (U_FAILURE(*status)) {
delete result;
result = NULL;
@@ -350,7 +350,7 @@ uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const UnicodeSet *chars, UErrorCo
*status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
- UnicodeSet *clonedSet = chars->clone();
+ UnicodeSet *clonedSet = chars->clone();
if (clonedSet == NULL || clonedSet->isBogus()) {
*status = U_MEMORY_ALLOCATION_ERROR;
return;
@@ -423,7 +423,7 @@ uspoof_check2UTF8(const USpoofChecker *sc,
if (U_FAILURE(*status)) {
return 0;
}
- UnicodeString idStr = UnicodeString::fromUTF8(StringPiece(id, length>=0 ? length : static_cast<int32_t>(uprv_strlen(id))));
+ UnicodeString idStr = UnicodeString::fromUTF8(StringPiece(id, length>=0 ? length : static_cast<int32_t>(uprv_strlen(id))));
int32_t result = uspoof_check2UnicodeString(sc, idStr, checkResult, status);
return result;
}
@@ -462,8 +462,8 @@ uspoof_areConfusableUTF8(const USpoofChecker *sc,
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
- UnicodeString id1Str = UnicodeString::fromUTF8(StringPiece(id1, length1>=0? length1 : static_cast<int32_t>(uprv_strlen(id1))));
- UnicodeString id2Str = UnicodeString::fromUTF8(StringPiece(id2, length2>=0? length2 : static_cast<int32_t>(uprv_strlen(id2))));
+ UnicodeString id1Str = UnicodeString::fromUTF8(StringPiece(id1, length1>=0? length1 : static_cast<int32_t>(uprv_strlen(id1))));
+ UnicodeString id2Str = UnicodeString::fromUTF8(StringPiece(id2, length2>=0? length2 : static_cast<int32_t>(uprv_strlen(id2))));
int32_t results = uspoof_areConfusableUnicodeString(sc, id1Str, id2Str, status);
return results;
}
@@ -550,8 +550,8 @@ uspoof_checkUnicodeString(const USpoofChecker *sc,
return uspoof_check2UnicodeString(sc, id, NULL, status);
}
-namespace {
-
+namespace {
+
int32_t checkImpl(const SpoofImpl* This, const UnicodeString& id, CheckResult* checkResult, UErrorCode* status) {
U_ASSERT(This != NULL);
U_ASSERT(checkResult != NULL);
@@ -575,14 +575,14 @@ int32_t checkImpl(const SpoofImpl* This, const UnicodeString& id, CheckResult* c
checkResult->fNumerics = numerics; // UnicodeSet::operator=
}
- if (0 != (This->fChecks & USPOOF_HIDDEN_OVERLAY)) {
- int32_t index = This->findHiddenOverlay(id, *status);
- if (index != -1) {
- result |= USPOOF_HIDDEN_OVERLAY;
- }
- }
+ if (0 != (This->fChecks & USPOOF_HIDDEN_OVERLAY)) {
+ int32_t index = This->findHiddenOverlay(id, *status);
+ if (index != -1) {
+ result |= USPOOF_HIDDEN_OVERLAY;
+ }
+ }
+
-
if (0 != (This->fChecks & USPOOF_CHAR_LIMIT)) {
int32_t i;
UChar32 c;
@@ -644,8 +644,8 @@ int32_t checkImpl(const SpoofImpl* This, const UnicodeString& id, CheckResult* c
return checkResult->toCombinedBitmask(This->fChecks);
}
-} // namespace
-
+} // namespace
+
U_CAPI int32_t U_EXPORT2
uspoof_check2UnicodeString(const USpoofChecker *sc,
const icu::UnicodeString &id,
@@ -740,7 +740,7 @@ uspoof_getSkeletonUTF8(const USpoofChecker *sc,
return 0;
}
- UnicodeString srcStr = UnicodeString::fromUTF8(StringPiece(id, length>=0 ? length : static_cast<int32_t>(uprv_strlen(id))));
+ UnicodeString srcStr = UnicodeString::fromUTF8(StringPiece(id, length>=0 ? length : static_cast<int32_t>(uprv_strlen(id))));
UnicodeString destStr;
uspoof_getSkeletonUnicodeString(sc, type, srcStr, destStr, status);
if (U_FAILURE(*status)) {
diff --git a/contrib/libs/icu/i18n/uspoof_build.cpp b/contrib/libs/icu/i18n/uspoof_build.cpp
index 06f960bee1..192fb9a688 100644
--- a/contrib/libs/icu/i18n/uspoof_build.cpp
+++ b/contrib/libs/icu/i18n/uspoof_build.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
***************************************************************************
@@ -6,7 +6,7 @@
* and others. All Rights Reserved.
***************************************************************************
* file name: uspoof_build.cpp
- * encoding: UTF-8
+ * encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -71,29 +71,29 @@ uspoof_openFromSource(const char *confusables, int32_t confusablesLen,
// Set up a shell of a spoof detector, with empty data.
SpoofData *newSpoofData = new SpoofData(*status);
-
- if (newSpoofData == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
-
- if (U_FAILURE(*status)) {
- delete newSpoofData;
- return NULL;
- }
+
+ if (newSpoofData == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+
+ if (U_FAILURE(*status)) {
+ delete newSpoofData;
+ return NULL;
+ }
SpoofImpl *This = new SpoofImpl(newSpoofData, *status);
- if (This == NULL) {
- *status = U_MEMORY_ALLOCATION_ERROR;
- delete newSpoofData; // explicit delete as the destructor for SpoofImpl won't be called.
- return NULL;
- }
-
- if (U_FAILURE(*status)) {
- delete This; // no delete for newSpoofData, as the SpoofImpl destructor will delete it.
- return NULL;
- }
-
+ if (This == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ delete newSpoofData; // explicit delete as the destructor for SpoofImpl won't be called.
+ return NULL;
+ }
+
+ if (U_FAILURE(*status)) {
+ delete This; // no delete for newSpoofData, as the SpoofImpl destructor will delete it.
+ return NULL;
+ }
+
// Compile the binary data from the source (text) format.
ConfusabledataBuilder::buildConfusableData(This, confusables, confusablesLen, errorType, pe, *status);
diff --git a/contrib/libs/icu/i18n/uspoof_conf.cpp b/contrib/libs/icu/i18n/uspoof_conf.cpp
index cf81460226..1a7cdad60a 100644
--- a/contrib/libs/icu/i18n/uspoof_conf.cpp
+++ b/contrib/libs/icu/i18n/uspoof_conf.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: uspoof_conf.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -76,10 +76,10 @@ SPUString::~SPUString() {
SPUStringPool::SPUStringPool(UErrorCode &status) : fVec(NULL), fHash(NULL) {
fVec = new UVector(status);
- if (fVec == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
+ if (fVec == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
fHash = uhash_open(uhash_hashUnicodeString, // key hash function
uhash_compareUnicodeString, // Key Comparator
NULL, // Value Comparator
@@ -140,10 +140,10 @@ SPUString *SPUStringPool::addString(UnicodeString *src, UErrorCode &status) {
delete src;
} else {
hashedString = new SPUString(src);
- if (hashedString == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
+ if (hashedString == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
uhash_put(fHash, src, hashedString, &status);
fVec->addElement(hashedString, status);
}
@@ -168,32 +168,32 @@ ConfusabledataBuilder::ConfusabledataBuilder(SpoofImpl *spImpl, UErrorCode &stat
if (U_FAILURE(status)) {
return;
}
-
- fTable = uhash_open(uhash_hashLong, uhash_compareLong, NULL, &status);
-
- fKeySet = new UnicodeSet();
- if (fKeySet == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
-
- fKeyVec = new UVector(status);
- if (fKeyVec == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
-
- fValueVec = new UVector(status);
- if (fValueVec == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
-
+
+ fTable = uhash_open(uhash_hashLong, uhash_compareLong, NULL, &status);
+
+ fKeySet = new UnicodeSet();
+ if (fKeySet == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+
+ fKeyVec = new UVector(status);
+ if (fKeyVec == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+
+ fValueVec = new UVector(status);
+ if (fValueVec == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+
stringPool = new SPUStringPool(status);
- if (stringPool == NULL) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
+ if (stringPool == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
}
@@ -425,7 +425,7 @@ void ConfusabledataBuilder::outputData(UErrorCode &status) {
for (i=0; i<numKeys; i++) {
int32_t key = fKeyVec->elementAti(i);
UChar32 codePoint = ConfusableDataUtils::keyToCodePoint(key);
- (void)previousCodePoint; // Suppress unused variable warning.
+ (void)previousCodePoint; // Suppress unused variable warning.
// strictly greater because there can be only one entry per code point
U_ASSERT(codePoint > previousCodePoint);
keys[i] = key;
diff --git a/contrib/libs/icu/i18n/uspoof_conf.h b/contrib/libs/icu/i18n/uspoof_conf.h
index ee5b6a970e..cfa80e7ca7 100644
--- a/contrib/libs/icu/i18n/uspoof_conf.h
+++ b/contrib/libs/icu/i18n/uspoof_conf.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: uspoof_conf.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -21,8 +21,8 @@
#ifndef __USPOOF_BUILDCONF_H__
#define __USPOOF_BUILDCONF_H__
-#include "unicode/utypes.h"
-
+#include "unicode/utypes.h"
+
#if !UCONFIG_NO_NORMALIZATION
#if !UCONFIG_NO_REGULAR_EXPRESSIONS
diff --git a/contrib/libs/icu/i18n/uspoof_impl.cpp b/contrib/libs/icu/i18n/uspoof_impl.cpp
index fb8ff187c2..88245b7f8f 100644
--- a/contrib/libs/icu/i18n/uspoof_impl.cpp
+++ b/contrib/libs/icu/i18n/uspoof_impl.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -73,7 +73,7 @@ void SpoofImpl::construct(UErrorCode& status) {
// Copy Constructor, used by the user level clone() function.
SpoofImpl::SpoofImpl(const SpoofImpl &src, UErrorCode &status) :
- fChecks(USPOOF_ALL_CHECKS), fSpoofData(NULL), fAllowedCharsSet(NULL) ,
+ fChecks(USPOOF_ALL_CHECKS), fSpoofData(NULL), fAllowedCharsSet(NULL) ,
fAllowedLocales(NULL) {
if (U_FAILURE(status)) {
return;
@@ -82,7 +82,7 @@ SpoofImpl::SpoofImpl(const SpoofImpl &src, UErrorCode &status) :
if (src.fSpoofData != NULL) {
fSpoofData = src.fSpoofData->addReference();
}
- fAllowedCharsSet = src.fAllowedCharsSet->clone();
+ fAllowedCharsSet = src.fAllowedCharsSet->clone();
fAllowedLocales = uprv_strdup(src.fAllowedLocales);
if (fAllowedCharsSet == NULL || fAllowedLocales == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
@@ -100,7 +100,7 @@ SpoofImpl::~SpoofImpl() {
// Cast this instance as a USpoofChecker for the C API.
USpoofChecker *SpoofImpl::asUSpoofChecker() {
- return exportForC();
+ return exportForC();
}
//
@@ -108,7 +108,7 @@ USpoofChecker *SpoofImpl::asUSpoofChecker() {
// received from the C API.
//
const SpoofImpl *SpoofImpl::validateThis(const USpoofChecker *sc, UErrorCode &status) {
- auto* This = validate(sc, status);
+ auto* This = validate(sc, status);
if (U_FAILURE(status)) {
return NULL;
}
@@ -193,7 +193,7 @@ void SpoofImpl::setAllowedLocales(const char *localesList, UErrorCode &status) {
}
// Store the updated spoof checker state.
- tmpSet = allowedChars.clone();
+ tmpSet = allowedChars.clone();
const char *tmpLocalesList = uprv_strdup(localesList);
if (tmpSet == NULL || tmpLocalesList == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
@@ -365,45 +365,45 @@ URestrictionLevel SpoofImpl::getRestrictionLevel(const UnicodeString& input, UEr
return USPOOF_MINIMALLY_RESTRICTIVE;
}
-int32_t SpoofImpl::findHiddenOverlay(const UnicodeString& input, UErrorCode&) const {
- bool sawLeadCharacter = false;
- for (int32_t i=0; i<input.length();) {
- UChar32 cp = input.char32At(i);
- if (sawLeadCharacter && cp == 0x0307) {
- return i;
- }
- uint8_t combiningClass = u_getCombiningClass(cp);
- // Skip over characters except for those with combining class 0 (non-combining characters) or with
- // combining class 230 (same class as U+0307)
- U_ASSERT(u_getCombiningClass(0x0307) == 230);
- if (combiningClass == 0 || combiningClass == 230) {
- sawLeadCharacter = isIllegalCombiningDotLeadCharacter(cp);
- }
- i += U16_LENGTH(cp);
- }
- return -1;
-}
-
-static inline bool isIllegalCombiningDotLeadCharacterNoLookup(UChar32 cp) {
- return cp == u'i' || cp == u'j' || cp == u'ı' || cp == u'ȷ' || cp == u'l' ||
- u_hasBinaryProperty(cp, UCHAR_SOFT_DOTTED);
-}
-
-bool SpoofImpl::isIllegalCombiningDotLeadCharacter(UChar32 cp) const {
- if (isIllegalCombiningDotLeadCharacterNoLookup(cp)) {
- return true;
- }
- UnicodeString skelStr;
- fSpoofData->confusableLookup(cp, skelStr);
- UChar32 finalCp = skelStr.char32At(skelStr.moveIndex32(skelStr.length(), -1));
- if (finalCp != cp && isIllegalCombiningDotLeadCharacterNoLookup(finalCp)) {
- return true;
- }
- return false;
-}
-
-
-
+int32_t SpoofImpl::findHiddenOverlay(const UnicodeString& input, UErrorCode&) const {
+ bool sawLeadCharacter = false;
+ for (int32_t i=0; i<input.length();) {
+ UChar32 cp = input.char32At(i);
+ if (sawLeadCharacter && cp == 0x0307) {
+ return i;
+ }
+ uint8_t combiningClass = u_getCombiningClass(cp);
+ // Skip over characters except for those with combining class 0 (non-combining characters) or with
+ // combining class 230 (same class as U+0307)
+ U_ASSERT(u_getCombiningClass(0x0307) == 230);
+ if (combiningClass == 0 || combiningClass == 230) {
+ sawLeadCharacter = isIllegalCombiningDotLeadCharacter(cp);
+ }
+ i += U16_LENGTH(cp);
+ }
+ return -1;
+}
+
+static inline bool isIllegalCombiningDotLeadCharacterNoLookup(UChar32 cp) {
+ return cp == u'i' || cp == u'j' || cp == u'ı' || cp == u'ȷ' || cp == u'l' ||
+ u_hasBinaryProperty(cp, UCHAR_SOFT_DOTTED);
+}
+
+bool SpoofImpl::isIllegalCombiningDotLeadCharacter(UChar32 cp) const {
+ if (isIllegalCombiningDotLeadCharacterNoLookup(cp)) {
+ return true;
+ }
+ UnicodeString skelStr;
+ fSpoofData->confusableLookup(cp, skelStr);
+ UChar32 finalCp = skelStr.char32At(skelStr.moveIndex32(skelStr.length(), -1));
+ if (finalCp != cp && isIllegalCombiningDotLeadCharacterNoLookup(finalCp)) {
+ return true;
+ }
+ return false;
+}
+
+
+
// Convert a text format hex number. Utility function used by builder code. Static.
// Input: UChar *string text. Output: a UChar32
// Input has been pre-checked, and will have no non-hex chars.
@@ -442,12 +442,12 @@ UChar32 SpoofImpl::ScanHex(const UChar *s, int32_t start, int32_t limit, UErrorC
//
//-----------------------------------------
-CheckResult::CheckResult() {
+CheckResult::CheckResult() {
clear();
}
USpoofCheckResult* CheckResult::asUSpoofCheckResult() {
- return exportForC();
+ return exportForC();
}
//
@@ -455,11 +455,11 @@ USpoofCheckResult* CheckResult::asUSpoofCheckResult() {
// received from the C API.
//
const CheckResult* CheckResult::validateThis(const USpoofCheckResult *ptr, UErrorCode &status) {
- return validate(ptr, status);
+ return validate(ptr, status);
}
CheckResult* CheckResult::validateThis(USpoofCheckResult *ptr, UErrorCode &status) {
- return validate(ptr, status);
+ return validate(ptr, status);
}
void CheckResult::clear() {
@@ -546,25 +546,25 @@ uspoof_cleanupDefaultData(void) {
if (gDefaultSpoofData) {
// Will delete, assuming all user-level spoof checkers were closed.
gDefaultSpoofData->removeReference();
- gDefaultSpoofData = nullptr;
+ gDefaultSpoofData = nullptr;
gSpoofInitDefaultOnce.reset();
}
return TRUE;
}
static void U_CALLCONV uspoof_loadDefaultData(UErrorCode& status) {
- UDataMemory *udm = udata_openChoice(nullptr, "cfu", "confusables",
+ UDataMemory *udm = udata_openChoice(nullptr, "cfu", "confusables",
spoofDataIsAcceptable,
- nullptr, // context, would receive dataVersion if supplied.
+ nullptr, // context, would receive dataVersion if supplied.
&status);
if (U_FAILURE(status)) { return; }
gDefaultSpoofData = new SpoofData(udm, status);
if (U_FAILURE(status)) {
delete gDefaultSpoofData;
- gDefaultSpoofData = nullptr;
+ gDefaultSpoofData = nullptr;
return;
}
- if (gDefaultSpoofData == nullptr) {
+ if (gDefaultSpoofData == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -605,10 +605,10 @@ SpoofData::SpoofData(const void *data, int32_t length, UErrorCode &status)
status = U_INVALID_FORMAT_ERROR;
return;
}
- if (data == NULL) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
+ if (data == NULL) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
void *ncData = const_cast<void *>(data);
fRawData = static_cast<SpoofDataHeader *>(ncData);
if (length < fRawData->fLength) {
@@ -729,7 +729,7 @@ void *SpoofData::reserveSpace(int32_t numBytes, UErrorCode &status) {
return NULL;
}
if (!fDataOwned) {
- UPRV_UNREACHABLE;
+ UPRV_UNREACHABLE;
}
numBytes = (numBytes + 15) & ~15; // Round up to a multiple of 16
diff --git a/contrib/libs/icu/i18n/uspoof_impl.h b/contrib/libs/icu/i18n/uspoof_impl.h
index 398dec71ef..b111d4b16a 100644
--- a/contrib/libs/icu/i18n/uspoof_impl.h
+++ b/contrib/libs/icu/i18n/uspoof_impl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
***************************************************************************
@@ -20,15 +20,15 @@
#include "unicode/uspoof.h"
#include "unicode/uscript.h"
#include "unicode/udata.h"
-#include "udataswp.h"
+#include "udataswp.h"
#include "utrie2.h"
#if !UCONFIG_NO_NORMALIZATION
#ifdef __cplusplus
-#include "capi_helper.h"
-
+#include "capi_helper.h"
+
U_NAMESPACE_BEGIN
// The maximium length (in UTF-16 UChars) of the skeleton replacement string resulting from
@@ -54,8 +54,8 @@ class ConfusableDataUtils;
* Class SpoofImpl corresponds directly to the plain C API opaque type
* USpoofChecker. One can be cast to the other.
*/
-class SpoofImpl : public UObject,
- public IcuCApiHelper<USpoofChecker, SpoofImpl, USPOOF_MAGIC> {
+class SpoofImpl : public UObject,
+ public IcuCApiHelper<USpoofChecker, SpoofImpl, USPOOF_MAGIC> {
public:
SpoofImpl(SpoofData *data, UErrorCode& status);
SpoofImpl(UErrorCode& status);
@@ -86,9 +86,9 @@ public:
void getNumerics(const UnicodeString& input, UnicodeSet& result, UErrorCode& status) const;
URestrictionLevel getRestrictionLevel(const UnicodeString& input, UErrorCode& status) const;
- int32_t findHiddenOverlay(const UnicodeString& input, UErrorCode& status) const;
- bool isIllegalCombiningDotLeadCharacter(UChar32 cp) const;
-
+ int32_t findHiddenOverlay(const UnicodeString& input, UErrorCode& status) const;
+ bool isIllegalCombiningDotLeadCharacter(UChar32 cp) const;
+
/** parse a hex number. Untility used by the builders. */
static UChar32 ScanHex(const UChar *s, int32_t start, int32_t limit, UErrorCode &status);
@@ -114,8 +114,8 @@ public:
* Class CheckResult corresponds directly to the plain C API opaque type
* USpoofCheckResult. One can be cast to the other.
*/
-class CheckResult : public UObject,
- public IcuCApiHelper<USpoofCheckResult, CheckResult, USPOOF_CHECK_MAGIC> {
+class CheckResult : public UObject,
+ public IcuCApiHelper<USpoofCheckResult, CheckResult, USPOOF_CHECK_MAGIC> {
public:
CheckResult();
virtual ~CheckResult();
diff --git a/contrib/libs/icu/i18n/usrchimp.h b/contrib/libs/icu/i18n/usrchimp.h
index 6d5d0a56f2..88b2e217db 100644
--- a/contrib/libs/icu/i18n/usrchimp.h
+++ b/contrib/libs/icu/i18n/usrchimp.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/i18n/utf16collationiterator.cpp b/contrib/libs/icu/i18n/utf16collationiterator.cpp
index c8444432c4..7598b0ee52 100644
--- a/contrib/libs/icu/i18n/utf16collationiterator.cpp
+++ b/contrib/libs/icu/i18n/utf16collationiterator.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/utf16collationiterator.h b/contrib/libs/icu/i18n/utf16collationiterator.h
index af91969533..fd3a05e9ef 100644
--- a/contrib/libs/icu/i18n/utf16collationiterator.h
+++ b/contrib/libs/icu/i18n/utf16collationiterator.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/utf8collationiterator.cpp b/contrib/libs/icu/i18n/utf8collationiterator.cpp
index a994657647..345b1994ef 100644
--- a/contrib/libs/icu/i18n/utf8collationiterator.cpp
+++ b/contrib/libs/icu/i18n/utf8collationiterator.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -49,21 +49,21 @@ UTF8CollationIterator::handleNextCE32(UChar32 &c, UErrorCode & /*errorCode*/) {
}
// Optimized combination of U8_NEXT_OR_FFFD() and UTRIE2_U8_NEXT32().
c = u8[pos++];
- if(U8_IS_SINGLE(c)) {
- // ASCII 00..7F
+ if(U8_IS_SINGLE(c)) {
+ // ASCII 00..7F
return trie->data32[c];
}
uint8_t t1, t2;
- if(0xe0 <= c && c < 0xf0 &&
- ((pos + 1) < length || length < 0) &&
- U8_IS_VALID_LEAD3_AND_T1(c, t1 = u8[pos]) &&
- (t2 = (u8[pos + 1] - 0x80)) <= 0x3f) {
- // U+0800..U+FFFF except surrogates
- c = (((c & 0xf) << 12) | ((t1 & 0x3f) << 6) | t2);
- pos += 2;
- return UTRIE2_GET32_FROM_U16_SINGLE_LEAD(trie, c);
- } else if(c < 0xe0 && c >= 0xc2 && pos != length && (t1 = (u8[pos] - 0x80)) <= 0x3f) {
- // U+0080..U+07FF
+ if(0xe0 <= c && c < 0xf0 &&
+ ((pos + 1) < length || length < 0) &&
+ U8_IS_VALID_LEAD3_AND_T1(c, t1 = u8[pos]) &&
+ (t2 = (u8[pos + 1] - 0x80)) <= 0x3f) {
+ // U+0800..U+FFFF except surrogates
+ c = (((c & 0xf) << 12) | ((t1 & 0x3f) << 6) | t2);
+ pos += 2;
+ return UTRIE2_GET32_FROM_U16_SINGLE_LEAD(trie, c);
+ } else if(c < 0xe0 && c >= 0xc2 && pos != length && (t1 = (u8[pos] - 0x80)) <= 0x3f) {
+ // U+0080..U+07FF
uint32_t ce32 = trie->data32[trie->index[(UTRIE2_UTF8_2B_INDEX_2_OFFSET - 0xc0) + c] + t1];
c = ((c & 0x1f) << 6) | t1;
++pos;
@@ -157,27 +157,27 @@ FCDUTF8CollationIterator::handleNextCE32(UChar32 &c, UErrorCode &errorCode) {
return Collation::FALLBACK_CE32;
}
c = u8[pos++];
- if(U8_IS_SINGLE(c)) {
- // ASCII 00..7F
+ if(U8_IS_SINGLE(c)) {
+ // ASCII 00..7F
return trie->data32[c];
}
uint8_t t1, t2;
- if(0xe0 <= c && c < 0xf0 &&
- ((pos + 1) < length || length < 0) &&
- U8_IS_VALID_LEAD3_AND_T1(c, t1 = u8[pos]) &&
- (t2 = (u8[pos + 1] - 0x80)) <= 0x3f) {
- // U+0800..U+FFFF except surrogates
- c = (((c & 0xf) << 12) | ((t1 & 0x3f) << 6) | t2);
- pos += 2;
- if(CollationFCD::hasTccc(c) &&
- (CollationFCD::maybeTibetanCompositeVowel(c) ||
- (pos != length && nextHasLccc()))) {
- pos -= 3;
- } else {
- break; // return CE32(BMP)
- }
- } else if(c < 0xe0 && c >= 0xc2 && pos != length && (t1 = (u8[pos] - 0x80)) <= 0x3f) {
- // U+0080..U+07FF
+ if(0xe0 <= c && c < 0xf0 &&
+ ((pos + 1) < length || length < 0) &&
+ U8_IS_VALID_LEAD3_AND_T1(c, t1 = u8[pos]) &&
+ (t2 = (u8[pos + 1] - 0x80)) <= 0x3f) {
+ // U+0800..U+FFFF except surrogates
+ c = (((c & 0xf) << 12) | ((t1 & 0x3f) << 6) | t2);
+ pos += 2;
+ if(CollationFCD::hasTccc(c) &&
+ (CollationFCD::maybeTibetanCompositeVowel(c) ||
+ (pos != length && nextHasLccc()))) {
+ pos -= 3;
+ } else {
+ break; // return CE32(BMP)
+ }
+ } else if(c < 0xe0 && c >= 0xc2 && pos != length && (t1 = (u8[pos] - 0x80)) <= 0x3f) {
+ // U+0080..U+07FF
uint32_t ce32 = trie->data32[trie->index[(UTRIE2_UTF8_2B_INDEX_2_OFFSET - 0xc0) + c] + t1];
c = ((c & 0x1f) << 6) | t1;
++pos;
@@ -235,7 +235,7 @@ UBool
FCDUTF8CollationIterator::previousHasTccc() const {
U_ASSERT(state == CHECK_BWD && pos != 0);
UChar32 c = u8[pos - 1];
- if(U8_IS_SINGLE(c)) { return FALSE; }
+ if(U8_IS_SINGLE(c)) { return FALSE; }
int32_t i = pos;
U8_PREV_OR_FFFD(u8, 0, i, c);
if(c > 0xffff) { c = U16_LEAD(c); }
@@ -269,7 +269,7 @@ FCDUTF8CollationIterator::nextCodePoint(UErrorCode &errorCode) {
if(pos == length || ((c = u8[pos]) == 0 && length < 0)) {
return U_SENTINEL;
}
- if(U8_IS_SINGLE(c)) {
+ if(U8_IS_SINGLE(c)) {
++pos;
return c;
}
@@ -307,7 +307,7 @@ FCDUTF8CollationIterator::previousCodePoint(UErrorCode &errorCode) {
if(pos == 0) {
return U_SENTINEL;
}
- if(U8_IS_SINGLE(c = u8[pos - 1])) {
+ if(U8_IS_SINGLE(c = u8[pos - 1])) {
--pos;
return c;
}
diff --git a/contrib/libs/icu/i18n/utf8collationiterator.h b/contrib/libs/icu/i18n/utf8collationiterator.h
index 32938feb2b..9a3ec45aeb 100644
--- a/contrib/libs/icu/i18n/utf8collationiterator.h
+++ b/contrib/libs/icu/i18n/utf8collationiterator.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/utmscale.cpp b/contrib/libs/icu/i18n/utmscale.cpp
index a6a40c7dfd..7bf6eec331 100644
--- a/contrib/libs/icu/i18n/utmscale.cpp
+++ b/contrib/libs/icu/i18n/utmscale.cpp
@@ -1,116 +1,116 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-*******************************************************************************
-* Copyright (C) 2004-2012, International Business Machines Corporation and
-* others. All Rights Reserved.
-*******************************************************************************
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/utmscale.h"
-
-#define ticks INT64_C(1)
-#define microseconds (ticks * 10)
-#define milliseconds (microseconds * 1000)
-#define seconds (milliseconds * 1000)
-#define minutes (seconds * 60)
-#define hours (minutes * 60)
-#define days (hours * 24)
-
-/* Constants generated by ICU4J com.ibm.icu.dev.tool.timescale.GenerateCTimeScaleData. */
-static const int64_t timeScaleTable[UDTS_MAX_SCALE][UTSV_MAX_SCALE_VALUE] = {
- /* units epochOffset fromMin fromMax toMin toMax epochOffsetP1 epochOffsetM1 unitsRound minRound maxRound */
- {milliseconds, INT64_C(62135596800000), INT64_C(-984472800485477), INT64_C(860201606885477), INT64_C(-9223372036854774999), INT64_C(9223372036854774999), INT64_C(62135596800001), INT64_C(62135596799999), INT64_C(5000), INT64_C(-9223372036854770808), INT64_C(9223372036854770807)},
- {seconds, INT64_C(62135596800), INT64_C(-984472800485), INT64_C(860201606885), U_INT64_MIN, U_INT64_MAX, INT64_C(62135596801), INT64_C(62135596799), INT64_C(5000000), INT64_C(-9223372036849775808), INT64_C(9223372036849775807)},
- {milliseconds, INT64_C(62135596800000), INT64_C(-984472800485477), INT64_C(860201606885477), INT64_C(-9223372036854774999), INT64_C(9223372036854774999), INT64_C(62135596800001), INT64_C(62135596799999), INT64_C(5000), INT64_C(-9223372036854770808), INT64_C(9223372036854770807)},
- {ticks, INT64_C(504911232000000000), U_INT64_MIN, INT64_C(8718460804854775807), INT64_C(-8718460804854775808), U_INT64_MAX, INT64_C(504911232000000000), INT64_C(504911232000000000), INT64_C(0), U_INT64_MIN, U_INT64_MAX},
- {ticks, INT64_C(0), U_INT64_MIN, U_INT64_MAX, U_INT64_MIN, U_INT64_MAX, INT64_C(0), INT64_C(0), INT64_C(0), U_INT64_MIN, U_INT64_MAX},
- {seconds, INT64_C(60052752000), INT64_C(-982389955685), INT64_C(862284451685), U_INT64_MIN, U_INT64_MAX, INT64_C(60052752001), INT64_C(60052751999), INT64_C(5000000), INT64_C(-9223372036849775808), INT64_C(9223372036849775807)},
- {seconds, INT64_C(63113904000), INT64_C(-985451107685), INT64_C(859223299685), U_INT64_MIN, U_INT64_MAX, INT64_C(63113904001), INT64_C(63113903999), INT64_C(5000000), INT64_C(-9223372036849775808), INT64_C(9223372036849775807)},
- {days, INT64_C(693594), INT64_C(-11368793), INT64_C(9981605), U_INT64_MIN, U_INT64_MAX, INT64_C(693595), INT64_C(693593), INT64_C(432000000000), INT64_C(-9223371604854775808), INT64_C(9223371604854775807)},
- {days, INT64_C(693594), INT64_C(-11368793), INT64_C(9981605), U_INT64_MIN, U_INT64_MAX, INT64_C(693595), INT64_C(693593), INT64_C(432000000000), INT64_C(-9223371604854775808), INT64_C(9223371604854775807)},
- {microseconds, INT64_C(62135596800000000), INT64_C(-984472800485477580), INT64_C(860201606885477580), INT64_C(-9223372036854775804), INT64_C(9223372036854775804), INT64_C(62135596800000001), INT64_C(62135596799999999), INT64_C(5), INT64_C(-9223372036854775803), INT64_C(9223372036854775802)},
-};
-
-U_CAPI int64_t U_EXPORT2
-utmscale_getTimeScaleValue(UDateTimeScale timeScale, UTimeScaleValue value, UErrorCode *status)
-{
- if (status == NULL || U_FAILURE(*status)) {
- return 0;
- }
-
- if (timeScale < UDTS_JAVA_TIME || UDTS_MAX_SCALE <= timeScale
- || value < UTSV_UNITS_VALUE || UTSV_MAX_SCALE_VALUE <= value)
- {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- return timeScaleTable[timeScale][value];
-}
-
-U_CAPI int64_t U_EXPORT2
-utmscale_fromInt64(int64_t otherTime, UDateTimeScale timeScale, UErrorCode *status)
-{
- const int64_t *data;
-
- if (status == NULL || U_FAILURE(*status)) {
- return 0;
- }
-
- if ((int32_t)timeScale < 0 || timeScale >= UDTS_MAX_SCALE) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- data = (const int64_t *)(&timeScaleTable[timeScale]);
-
- if (otherTime < data[UTSV_FROM_MIN_VALUE] || otherTime > data[UTSV_FROM_MAX_VALUE]) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- return (otherTime + data[UTSV_EPOCH_OFFSET_VALUE]) * data[UTSV_UNITS_VALUE];
-}
-
-U_CAPI int64_t U_EXPORT2
-utmscale_toInt64(int64_t universalTime, UDateTimeScale timeScale, UErrorCode *status)
-{
- const int64_t *data;
-
- if (status == NULL || U_FAILURE(*status)) {
- return 0;
- }
-
- if ((int32_t)timeScale < 0 || timeScale >= UDTS_MAX_SCALE) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- data = (const int64_t *)(&timeScaleTable[timeScale]);
-
- if (universalTime < data[UTSV_TO_MIN_VALUE] || universalTime > data[UTSV_TO_MAX_VALUE]) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return 0;
- }
-
- if (universalTime < 0) {
- if (universalTime < data[UTSV_MIN_ROUND_VALUE]) {
- return (universalTime + data[UTSV_UNITS_ROUND_VALUE]) / data[UTSV_UNITS_VALUE] - data[UTSV_EPOCH_OFFSET_PLUS_1_VALUE];
- }
-
- return (universalTime - data[UTSV_UNITS_ROUND_VALUE]) / data[UTSV_UNITS_VALUE] - data[UTSV_EPOCH_OFFSET_VALUE];
- }
-
- if (universalTime > data[UTSV_MAX_ROUND_VALUE]) {
- return (universalTime - data[UTSV_UNITS_ROUND_VALUE]) / data[UTSV_UNITS_VALUE] - data[UTSV_EPOCH_OFFSET_MINUS_1_VALUE];
- }
-
- return (universalTime + data[UTSV_UNITS_ROUND_VALUE]) / data[UTSV_UNITS_VALUE] - data[UTSV_EPOCH_OFFSET_VALUE];
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+* Copyright (C) 2004-2012, International Business Machines Corporation and
+* others. All Rights Reserved.
+*******************************************************************************
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/utmscale.h"
+
+#define ticks INT64_C(1)
+#define microseconds (ticks * 10)
+#define milliseconds (microseconds * 1000)
+#define seconds (milliseconds * 1000)
+#define minutes (seconds * 60)
+#define hours (minutes * 60)
+#define days (hours * 24)
+
+/* Constants generated by ICU4J com.ibm.icu.dev.tool.timescale.GenerateCTimeScaleData. */
+static const int64_t timeScaleTable[UDTS_MAX_SCALE][UTSV_MAX_SCALE_VALUE] = {
+ /* units epochOffset fromMin fromMax toMin toMax epochOffsetP1 epochOffsetM1 unitsRound minRound maxRound */
+ {milliseconds, INT64_C(62135596800000), INT64_C(-984472800485477), INT64_C(860201606885477), INT64_C(-9223372036854774999), INT64_C(9223372036854774999), INT64_C(62135596800001), INT64_C(62135596799999), INT64_C(5000), INT64_C(-9223372036854770808), INT64_C(9223372036854770807)},
+ {seconds, INT64_C(62135596800), INT64_C(-984472800485), INT64_C(860201606885), U_INT64_MIN, U_INT64_MAX, INT64_C(62135596801), INT64_C(62135596799), INT64_C(5000000), INT64_C(-9223372036849775808), INT64_C(9223372036849775807)},
+ {milliseconds, INT64_C(62135596800000), INT64_C(-984472800485477), INT64_C(860201606885477), INT64_C(-9223372036854774999), INT64_C(9223372036854774999), INT64_C(62135596800001), INT64_C(62135596799999), INT64_C(5000), INT64_C(-9223372036854770808), INT64_C(9223372036854770807)},
+ {ticks, INT64_C(504911232000000000), U_INT64_MIN, INT64_C(8718460804854775807), INT64_C(-8718460804854775808), U_INT64_MAX, INT64_C(504911232000000000), INT64_C(504911232000000000), INT64_C(0), U_INT64_MIN, U_INT64_MAX},
+ {ticks, INT64_C(0), U_INT64_MIN, U_INT64_MAX, U_INT64_MIN, U_INT64_MAX, INT64_C(0), INT64_C(0), INT64_C(0), U_INT64_MIN, U_INT64_MAX},
+ {seconds, INT64_C(60052752000), INT64_C(-982389955685), INT64_C(862284451685), U_INT64_MIN, U_INT64_MAX, INT64_C(60052752001), INT64_C(60052751999), INT64_C(5000000), INT64_C(-9223372036849775808), INT64_C(9223372036849775807)},
+ {seconds, INT64_C(63113904000), INT64_C(-985451107685), INT64_C(859223299685), U_INT64_MIN, U_INT64_MAX, INT64_C(63113904001), INT64_C(63113903999), INT64_C(5000000), INT64_C(-9223372036849775808), INT64_C(9223372036849775807)},
+ {days, INT64_C(693594), INT64_C(-11368793), INT64_C(9981605), U_INT64_MIN, U_INT64_MAX, INT64_C(693595), INT64_C(693593), INT64_C(432000000000), INT64_C(-9223371604854775808), INT64_C(9223371604854775807)},
+ {days, INT64_C(693594), INT64_C(-11368793), INT64_C(9981605), U_INT64_MIN, U_INT64_MAX, INT64_C(693595), INT64_C(693593), INT64_C(432000000000), INT64_C(-9223371604854775808), INT64_C(9223371604854775807)},
+ {microseconds, INT64_C(62135596800000000), INT64_C(-984472800485477580), INT64_C(860201606885477580), INT64_C(-9223372036854775804), INT64_C(9223372036854775804), INT64_C(62135596800000001), INT64_C(62135596799999999), INT64_C(5), INT64_C(-9223372036854775803), INT64_C(9223372036854775802)},
+};
+
+U_CAPI int64_t U_EXPORT2
+utmscale_getTimeScaleValue(UDateTimeScale timeScale, UTimeScaleValue value, UErrorCode *status)
+{
+ if (status == NULL || U_FAILURE(*status)) {
+ return 0;
+ }
+
+ if (timeScale < UDTS_JAVA_TIME || UDTS_MAX_SCALE <= timeScale
+ || value < UTSV_UNITS_VALUE || UTSV_MAX_SCALE_VALUE <= value)
+ {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ return timeScaleTable[timeScale][value];
+}
+
+U_CAPI int64_t U_EXPORT2
+utmscale_fromInt64(int64_t otherTime, UDateTimeScale timeScale, UErrorCode *status)
+{
+ const int64_t *data;
+
+ if (status == NULL || U_FAILURE(*status)) {
+ return 0;
+ }
+
+ if ((int32_t)timeScale < 0 || timeScale >= UDTS_MAX_SCALE) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ data = (const int64_t *)(&timeScaleTable[timeScale]);
+
+ if (otherTime < data[UTSV_FROM_MIN_VALUE] || otherTime > data[UTSV_FROM_MAX_VALUE]) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ return (otherTime + data[UTSV_EPOCH_OFFSET_VALUE]) * data[UTSV_UNITS_VALUE];
+}
+
+U_CAPI int64_t U_EXPORT2
+utmscale_toInt64(int64_t universalTime, UDateTimeScale timeScale, UErrorCode *status)
+{
+ const int64_t *data;
+
+ if (status == NULL || U_FAILURE(*status)) {
+ return 0;
+ }
+
+ if ((int32_t)timeScale < 0 || timeScale >= UDTS_MAX_SCALE) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ data = (const int64_t *)(&timeScaleTable[timeScale]);
+
+ if (universalTime < data[UTSV_TO_MIN_VALUE] || universalTime > data[UTSV_TO_MAX_VALUE]) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ if (universalTime < 0) {
+ if (universalTime < data[UTSV_MIN_ROUND_VALUE]) {
+ return (universalTime + data[UTSV_UNITS_ROUND_VALUE]) / data[UTSV_UNITS_VALUE] - data[UTSV_EPOCH_OFFSET_PLUS_1_VALUE];
+ }
+
+ return (universalTime - data[UTSV_UNITS_ROUND_VALUE]) / data[UTSV_UNITS_VALUE] - data[UTSV_EPOCH_OFFSET_VALUE];
+ }
+
+ if (universalTime > data[UTSV_MAX_ROUND_VALUE]) {
+ return (universalTime - data[UTSV_UNITS_ROUND_VALUE]) / data[UTSV_UNITS_VALUE] - data[UTSV_EPOCH_OFFSET_MINUS_1_VALUE];
+ }
+
+ return (universalTime + data[UTSV_UNITS_ROUND_VALUE]) / data[UTSV_UNITS_VALUE] - data[UTSV_EPOCH_OFFSET_VALUE];
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/i18n/utrans.cpp b/contrib/libs/icu/i18n/utrans.cpp
index 8b1ae16992..29013ead12 100644
--- a/contrib/libs/icu/i18n/utrans.cpp
+++ b/contrib/libs/icu/i18n/utrans.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -41,12 +41,12 @@ U_NAMESPACE_BEGIN
class ReplaceableGlue : public Replaceable {
UReplaceable *rep;
- const UReplaceableCallbacks *func;
+ const UReplaceableCallbacks *func;
public:
ReplaceableGlue(UReplaceable *replaceable,
- const UReplaceableCallbacks *funcCallback);
+ const UReplaceableCallbacks *funcCallback);
virtual ~ReplaceableGlue();
@@ -88,7 +88,7 @@ protected:
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ReplaceableGlue)
ReplaceableGlue::ReplaceableGlue(UReplaceable *replaceable,
- const UReplaceableCallbacks *funcCallback)
+ const UReplaceableCallbacks *funcCallback)
: Replaceable()
{
this->rep = replaceable;
@@ -398,7 +398,7 @@ utrans_openIDs(UErrorCode *pErrorCode) {
U_CAPI void U_EXPORT2
utrans_trans(const UTransliterator* trans,
UReplaceable* rep,
- const UReplaceableCallbacks* repFunc,
+ const UReplaceableCallbacks* repFunc,
int32_t start,
int32_t* limit,
UErrorCode* status) {
@@ -418,7 +418,7 @@ utrans_trans(const UTransliterator* trans,
U_CAPI void U_EXPORT2
utrans_transIncremental(const UTransliterator* trans,
UReplaceable* rep,
- const UReplaceableCallbacks* repFunc,
+ const UReplaceableCallbacks* repFunc,
UTransPosition* pos,
UErrorCode* status) {
diff --git a/contrib/libs/icu/i18n/vtzone.cpp b/contrib/libs/icu/i18n/vtzone.cpp
index b9d6620395..36e5834523 100644
--- a/contrib/libs/icu/i18n/vtzone.cpp
+++ b/contrib/libs/icu/i18n/vtzone.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -135,7 +135,7 @@ static UnicodeString& appendAsciiDigits(int32_t number, uint8_t length, UnicodeS
digits[i++] = number % 10;
number /= 10;
} while (number != 0);
- length = static_cast<uint8_t>(i);
+ length = static_cast<uint8_t>(i);
} else {
// fixed digits
for (i = 0; i < length; i++) {
@@ -358,7 +358,7 @@ static void millisToOffset(int32_t millis, UnicodeString& str) {
/*
* Create a default TZNAME from TZID
*/
-static void getDefaultTZName(const UnicodeString &tzid, UBool isDST, UnicodeString& zonename) {
+static void getDefaultTZName(const UnicodeString &tzid, UBool isDST, UnicodeString& zonename) {
zonename = tzid;
if (isDST) {
zonename += UNICODE_STRING_SIMPLE("(DST)");
@@ -526,15 +526,15 @@ rruleParseError:
static TimeZoneRule* createRuleByRRULE(const UnicodeString& zonename, int rawOffset, int dstSavings, UDate start,
UVector* dates, int fromOffset, UErrorCode& status) {
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
- if (dates == nullptr || dates->size() == 0) {
+ if (dates == nullptr || dates->size() == 0) {
status = U_ILLEGAL_ARGUMENT_ERROR;
- return nullptr;
+ return nullptr;
}
int32_t i, j;
- DateTimeRule *adtr = nullptr;
+ DateTimeRule *adtr = nullptr;
// Parse the first rule
UnicodeString rrule = *((UnicodeString*)dates->elementAt(0));
@@ -545,7 +545,7 @@ static TimeZoneRule* createRuleByRRULE(const UnicodeString& zonename, int rawOff
parseRRULE(rrule, month, dayOfWeek, nthDayOfWeek, days, daysCount, until, status);
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
if (dates->size() == 1) {
@@ -620,7 +620,7 @@ static TimeZoneRule* createRuleByRRULE(const UnicodeString& zonename, int rawOff
int32_t tmp_daysCount = UPRV_LENGTHOF(tmp_days);
parseRRULE(rrule, tmp_month, tmp_dayOfWeek, tmp_nthDayOfWeek, tmp_days, tmp_daysCount, tmp_until, status);
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
// If UNTIL is newer than previous one, use the one
if (tmp_until > until) {
@@ -713,14 +713,14 @@ static TimeZoneRule* createRuleByRRULE(const UnicodeString& zonename, int rawOff
// first Sunday after 15th day in the month
adtr = new DateTimeRule(month, dayOfMonth, dayOfWeek, TRUE, startMID, DateTimeRule::WALL_TIME);
}
- if (adtr == nullptr) {
+ if (adtr == nullptr) {
goto unsupportedRRule;
}
return new AnnualTimeZoneRule(zonename, rawOffset, dstSavings, adtr, startYear, endYear);
unsupportedRRule:
status = U_INVALID_STATE_ERROR;
- return nullptr;
+ return nullptr;
}
/*
@@ -729,35 +729,35 @@ unsupportedRRule:
static TimeZoneRule* createRuleByRDATE(const UnicodeString& zonename, int32_t rawOffset, int32_t dstSavings,
UDate start, UVector* dates, int32_t fromOffset, UErrorCode& status) {
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
- TimeArrayTimeZoneRule *retVal = nullptr;
- if (dates == nullptr || dates->size() == 0) {
+ TimeArrayTimeZoneRule *retVal = nullptr;
+ if (dates == nullptr || dates->size() == 0) {
// When no RDATE line is provided, use start (DTSTART)
// as the transition time
- retVal = new TimeArrayTimeZoneRule(zonename, rawOffset, dstSavings, &start, 1, DateTimeRule::UTC_TIME);
+ retVal = new TimeArrayTimeZoneRule(zonename, rawOffset, dstSavings, &start, 1, DateTimeRule::UTC_TIME);
} else {
// Create an array of transition times
int32_t size = dates->size();
UDate* times = (UDate*)uprv_malloc(sizeof(UDate) * size);
- if (times == nullptr) {
+ if (times == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
+ return nullptr;
}
for (int32_t i = 0; i < size; i++) {
UnicodeString *datestr = (UnicodeString*)dates->elementAt(i);
times[i] = parseDateTimeString(*datestr, fromOffset, status);
if (U_FAILURE(status)) {
uprv_free(times);
- return nullptr;
+ return nullptr;
}
}
- retVal = new TimeArrayTimeZoneRule(zonename, rawOffset, dstSavings, times, size, DateTimeRule::UTC_TIME);
+ retVal = new TimeArrayTimeZoneRule(zonename, rawOffset, dstSavings, times, size, DateTimeRule::UTC_TIME);
uprv_free(times);
}
- if (retVal == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
+ if (retVal == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
return retVal;
}
@@ -801,15 +801,15 @@ static UBool isEquivalentDateRule(int32_t month, int32_t weekInMonth, int32_t da
/*
* Convert the rule to its equivalent rule using WALL_TIME mode.
- * This function returns nullptr when the specified DateTimeRule is already
+ * This function returns nullptr when the specified DateTimeRule is already
* using WALL_TIME mode.
*/
-static DateTimeRule *toWallTimeRule(const DateTimeRule *rule, int32_t rawOffset, int32_t dstSavings, UErrorCode &status) {
- if (U_FAILURE(status)) {
- return nullptr;
- }
+static DateTimeRule *toWallTimeRule(const DateTimeRule *rule, int32_t rawOffset, int32_t dstSavings, UErrorCode &status) {
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
if (rule->getTimeRuleType() == DateTimeRule::WALL_TIME) {
- return nullptr;
+ return nullptr;
}
int32_t wallt = rule->getRuleMillisInDay();
if (rule->getTimeRuleType() == DateTimeRule::UTC_TIME) {
@@ -868,15 +868,15 @@ static DateTimeRule *toWallTimeRule(const DateTimeRule *rule, int32_t rawOffset,
}
}
// Create a new rule
- DateTimeRule *modifiedRule = nullptr;
+ DateTimeRule *modifiedRule = nullptr;
if (dtype == DateTimeRule::DOM) {
modifiedRule = new DateTimeRule(month, dom, wallt, DateTimeRule::WALL_TIME);
} else {
- modifiedRule = new DateTimeRule(month, dom, dow, (dtype == DateTimeRule::DOW_GEQ_DOM), wallt, DateTimeRule::WALL_TIME);
+ modifiedRule = new DateTimeRule(month, dom, dow, (dtype == DateTimeRule::DOW_GEQ_DOM), wallt, DateTimeRule::WALL_TIME);
+ }
+ if (modifiedRule == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
}
- if (modifiedRule == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
return modifiedRule;
}
@@ -962,24 +962,24 @@ VTZReader::read(void) {
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(VTimeZone)
VTimeZone::VTimeZone()
-: BasicTimeZone(), tz(nullptr), vtzlines(nullptr),
+: BasicTimeZone(), tz(nullptr), vtzlines(nullptr),
lastmod(MAX_MILLIS) {
}
VTimeZone::VTimeZone(const VTimeZone& source)
-: BasicTimeZone(source), tz(nullptr), vtzlines(nullptr),
+: BasicTimeZone(source), tz(nullptr), vtzlines(nullptr),
tzurl(source.tzurl), lastmod(source.lastmod),
olsonzid(source.olsonzid), icutzver(source.icutzver) {
- if (source.tz != nullptr) {
- tz = source.tz->clone();
+ if (source.tz != nullptr) {
+ tz = source.tz->clone();
}
- if (source.vtzlines != nullptr) {
+ if (source.vtzlines != nullptr) {
UErrorCode status = U_ZERO_ERROR;
int32_t size = source.vtzlines->size();
vtzlines = new UVector(uprv_deleteUObject, uhash_compareUnicodeString, size, status);
- if (vtzlines == nullptr) {
- return;
- }
+ if (vtzlines == nullptr) {
+ return;
+ }
if (U_SUCCESS(status)) {
for (int32_t i = 0; i < size; i++) {
UnicodeString *line = (UnicodeString*)source.vtzlines->elementAt(i);
@@ -989,17 +989,17 @@ VTimeZone::VTimeZone(const VTimeZone& source)
}
}
}
- if (U_FAILURE(status) && vtzlines != nullptr) {
+ if (U_FAILURE(status) && vtzlines != nullptr) {
delete vtzlines;
}
}
}
VTimeZone::~VTimeZone() {
- if (tz != nullptr) {
+ if (tz != nullptr) {
delete tz;
}
- if (vtzlines != nullptr) {
+ if (vtzlines != nullptr) {
delete vtzlines;
}
}
@@ -1011,21 +1011,21 @@ VTimeZone::operator=(const VTimeZone& right) {
}
if (*this != right) {
BasicTimeZone::operator=(right);
- if (tz != nullptr) {
+ if (tz != nullptr) {
delete tz;
- tz = nullptr;
+ tz = nullptr;
}
- if (right.tz != nullptr) {
- tz = right.tz->clone();
+ if (right.tz != nullptr) {
+ tz = right.tz->clone();
}
- if (vtzlines != nullptr) {
+ if (vtzlines != nullptr) {
delete vtzlines;
}
- if (right.vtzlines != nullptr) {
+ if (right.vtzlines != nullptr) {
UErrorCode status = U_ZERO_ERROR;
int32_t size = right.vtzlines->size();
vtzlines = new UVector(uprv_deleteUObject, uhash_compareUnicodeString, size, status);
- if (vtzlines != nullptr && U_SUCCESS(status)) {
+ if (vtzlines != nullptr && U_SUCCESS(status)) {
for (int32_t i = 0; i < size; i++) {
UnicodeString *line = (UnicodeString*)right.vtzlines->elementAt(i);
vtzlines->addElement(line->clone(), status);
@@ -1034,9 +1034,9 @@ VTimeZone::operator=(const VTimeZone& right) {
}
}
}
- if (U_FAILURE(status) && vtzlines != nullptr) {
+ if (U_FAILURE(status) && vtzlines != nullptr) {
delete vtzlines;
- vtzlines = nullptr;
+ vtzlines = nullptr;
}
}
tzurl = right.tzurl;
@@ -1076,18 +1076,18 @@ VTimeZone::operator!=(const TimeZone& that) const {
VTimeZone*
VTimeZone::createVTimeZoneByID(const UnicodeString& ID) {
VTimeZone *vtz = new VTimeZone();
- if (vtz == nullptr) {
- return nullptr;
- }
+ if (vtz == nullptr) {
+ return nullptr;
+ }
vtz->tz = (BasicTimeZone*)TimeZone::createTimeZone(ID);
vtz->tz->getID(vtz->olsonzid);
// Set ICU tzdata version
UErrorCode status = U_ZERO_ERROR;
- UResourceBundle *bundle = nullptr;
- const UChar* versionStr = nullptr;
+ UResourceBundle *bundle = nullptr;
+ const UChar* versionStr = nullptr;
int32_t len = 0;
- bundle = ures_openDirect(nullptr, "zoneinfo64", &status);
+ bundle = ures_openDirect(nullptr, "zoneinfo64", &status);
versionStr = ures_getStringByKey(bundle, "TZVersion", &len, &status);
if (U_SUCCESS(status)) {
vtz->icutzver.setTo(versionStr, len);
@@ -1099,26 +1099,26 @@ VTimeZone::createVTimeZoneByID(const UnicodeString& ID) {
VTimeZone*
VTimeZone::createVTimeZoneFromBasicTimeZone(const BasicTimeZone& basic_time_zone, UErrorCode &status) {
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
VTimeZone *vtz = new VTimeZone();
- if (vtz == nullptr) {
+ if (vtz == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
+ return nullptr;
}
- vtz->tz = basic_time_zone.clone();
- if (vtz->tz == nullptr) {
+ vtz->tz = basic_time_zone.clone();
+ if (vtz->tz == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
delete vtz;
- return nullptr;
+ return nullptr;
}
vtz->tz->getID(vtz->olsonzid);
// Set ICU tzdata version
- UResourceBundle *bundle = nullptr;
- const UChar* versionStr = nullptr;
+ UResourceBundle *bundle = nullptr;
+ const UChar* versionStr = nullptr;
int32_t len = 0;
- bundle = ures_openDirect(nullptr, "zoneinfo64", &status);
+ bundle = ures_openDirect(nullptr, "zoneinfo64", &status);
versionStr = ures_getStringByKey(bundle, "TZVersion", &len, &status);
if (U_SUCCESS(status)) {
vtz->icutzver.setTo(versionStr, len);
@@ -1130,18 +1130,18 @@ VTimeZone::createVTimeZoneFromBasicTimeZone(const BasicTimeZone& basic_time_zone
VTimeZone*
VTimeZone::createVTimeZone(const UnicodeString& vtzdata, UErrorCode& status) {
if (U_FAILURE(status)) {
- return nullptr;
+ return nullptr;
}
VTZReader reader(vtzdata);
VTimeZone *vtz = new VTimeZone();
- if (vtz == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return nullptr;
- }
+ if (vtz == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
vtz->load(reader, status);
if (U_FAILURE(status)) {
delete vtz;
- return nullptr;
+ return nullptr;
}
return vtz;
}
@@ -1195,8 +1195,8 @@ VTimeZone::writeSimple(UDate time, UnicodeString& result, UErrorCode& status) co
writeSimple(time, writer, status);
}
-VTimeZone*
-VTimeZone::clone() const {
+VTimeZone*
+VTimeZone::clone() const {
return new VTimeZone(*this);
}
@@ -1269,9 +1269,9 @@ VTimeZone::getTimeZoneRules(const InitialTimeZoneRule*& initial,
void
VTimeZone::load(VTZReader& reader, UErrorCode& status) {
vtzlines = new UVector(uprv_deleteUObject, uhash_compareUnicodeString, DEFAULT_VTIMEZONE_LINES, status);
- if (vtzlines == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
+ if (vtzlines == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
if (U_FAILURE(status)) {
return;
}
@@ -1285,15 +1285,15 @@ VTimeZone::load(VTZReader& reader, UErrorCode& status) {
if (ch == 0xFFFF) {
// end of file
if (start && line.startsWith(ICAL_END_VTIMEZONE, -1)) {
- LocalPointer<UnicodeString> element(new UnicodeString(line), status);
+ LocalPointer<UnicodeString> element(new UnicodeString(line), status);
+ if (U_FAILURE(status)) {
+ goto cleanupVtzlines;
+ }
+ vtzlines->addElement(element.getAlias(), status);
if (U_FAILURE(status)) {
goto cleanupVtzlines;
}
- vtzlines->addElement(element.getAlias(), status);
- if (U_FAILURE(status)) {
- goto cleanupVtzlines;
- }
- element.orphan(); // on success, vtzlines owns the object.
+ element.orphan(); // on success, vtzlines owns the object.
success = TRUE;
}
break;
@@ -1307,15 +1307,15 @@ VTimeZone::load(VTZReader& reader, UErrorCode& status) {
// NOT followed by TAB/SP -> new line
if (start) {
if (line.length() > 0) {
- LocalPointer<UnicodeString> element(new UnicodeString(line), status);
+ LocalPointer<UnicodeString> element(new UnicodeString(line), status);
if (U_FAILURE(status)) {
goto cleanupVtzlines;
}
- vtzlines->addElement(element.getAlias(), status);
- if (U_FAILURE(status)) {
- goto cleanupVtzlines;
- }
- element.orphan(); // on success, vtzlines owns the object.
+ vtzlines->addElement(element.getAlias(), status);
+ if (U_FAILURE(status)) {
+ goto cleanupVtzlines;
+ }
+ element.orphan(); // on success, vtzlines owns the object.
}
}
line.remove();
@@ -1330,29 +1330,29 @@ VTimeZone::load(VTZReader& reader, UErrorCode& status) {
eol = TRUE;
if (start) {
if (line.startsWith(ICAL_END_VTIMEZONE, -1)) {
- LocalPointer<UnicodeString> element(new UnicodeString(line), status);
+ LocalPointer<UnicodeString> element(new UnicodeString(line), status);
+ if (U_FAILURE(status)) {
+ goto cleanupVtzlines;
+ }
+ vtzlines->addElement(element.getAlias(), status);
if (U_FAILURE(status)) {
goto cleanupVtzlines;
}
- vtzlines->addElement(element.getAlias(), status);
- if (U_FAILURE(status)) {
- goto cleanupVtzlines;
- }
- element.orphan(); // on success, vtzlines owns the object.
+ element.orphan(); // on success, vtzlines owns the object.
success = TRUE;
break;
}
} else {
if (line.startsWith(ICAL_BEGIN_VTIMEZONE, -1)) {
- LocalPointer<UnicodeString> element(new UnicodeString(line), status);
+ LocalPointer<UnicodeString> element(new UnicodeString(line), status);
+ if (U_FAILURE(status)) {
+ goto cleanupVtzlines;
+ }
+ vtzlines->addElement(element.getAlias(), status);
if (U_FAILURE(status)) {
goto cleanupVtzlines;
}
- vtzlines->addElement(element.getAlias(), status);
- if (U_FAILURE(status)) {
- goto cleanupVtzlines;
- }
- element.orphan(); // on success, vtzlines owns the object.
+ element.orphan(); // on success, vtzlines owns the object.
line.remove();
start = TRUE;
eol = FALSE;
@@ -1374,7 +1374,7 @@ VTimeZone::load(VTZReader& reader, UErrorCode& status) {
cleanupVtzlines:
delete vtzlines;
- vtzlines = nullptr;
+ vtzlines = nullptr;
}
// parser state
@@ -1390,12 +1390,12 @@ VTimeZone::parse(UErrorCode& status) {
if (U_FAILURE(status)) {
return;
}
- if (vtzlines == nullptr || vtzlines->size() == 0) {
+ if (vtzlines == nullptr || vtzlines->size() == 0) {
status = U_INVALID_STATE_ERROR;
return;
}
- InitialTimeZoneRule *initialRule = nullptr;
- RuleBasedTimeZone *rbtz = nullptr;
+ InitialTimeZoneRule *initialRule = nullptr;
+ RuleBasedTimeZone *rbtz = nullptr;
// timezone ID
UnicodeString tzid;
@@ -1414,16 +1414,16 @@ VTimeZone::parse(UErrorCode& status) {
UnicodeString name; // RFC2445 prop name
UnicodeString value; // RFC2445 prop value
- UVector *dates = nullptr; // list of RDATE or RRULE strings
- UVector *rules = nullptr; // list of TimeZoneRule instances
+ UVector *dates = nullptr; // list of RDATE or RRULE strings
+ UVector *rules = nullptr; // list of TimeZoneRule instances
int32_t finalRuleIdx = -1;
int32_t finalRuleCount = 0;
rules = new UVector(status);
- if (rules == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
+ if (rules == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
if (U_FAILURE(status)) {
goto cleanupParse;
}
@@ -1431,13 +1431,13 @@ VTimeZone::parse(UErrorCode& status) {
rules->setDeleter(deleteTimeZoneRule);
dates = new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status);
- if (dates == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
+ if (dates == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
if (U_FAILURE(status)) {
goto cleanupParse;
}
-
+
for (n = 0; n < vtzlines->size(); n++) {
UnicodeString *line = (UnicodeString*)vtzlines->elementAt(n);
int32_t valueSep = line->indexOf(COLON);
@@ -1511,7 +1511,7 @@ VTimeZone::parse(UErrorCode& status) {
// by comma
UBool nextDate = TRUE;
int32_t dstart = 0;
- UnicodeString *dstr = nullptr;
+ UnicodeString *dstr = nullptr;
while (nextDate) {
int32_t dend = value.indexOf(COMMA, dstart);
if (dend == -1) {
@@ -1520,11 +1520,11 @@ VTimeZone::parse(UErrorCode& status) {
} else {
dstr = new UnicodeString(value, dstart, dend - dstart);
}
- if (dstr == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- } else {
- dates->addElement(dstr, status);
- }
+ if (dstr == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ } else {
+ dates->addElement(dstr, status);
+ }
if (U_FAILURE(status)) {
goto cleanupParse;
}
@@ -1536,15 +1536,15 @@ VTimeZone::parse(UErrorCode& status) {
goto cleanupParse;
}
isRRULE = true;
- LocalPointer<UnicodeString> element(new UnicodeString(value), status);
+ LocalPointer<UnicodeString> element(new UnicodeString(value), status);
if (U_FAILURE(status)) {
goto cleanupParse;
}
- dates->addElement(element.getAlias(), status);
- if (U_FAILURE(status)) {
- goto cleanupParse;
- }
- element.orphan(); // on success, dates owns the object.
+ dates->addElement(element.getAlias(), status);
+ if (U_FAILURE(status)) {
+ goto cleanupParse;
+ }
+ element.orphan(); // on success, dates owns the object.
} else if (name.compare(ICAL_END, -1) == 0) {
// Mandatory properties
if (dtstart.length() == 0 || from.length() == 0 || to.length() == 0) {
@@ -1556,7 +1556,7 @@ VTimeZone::parse(UErrorCode& status) {
}
// create a time zone rule
- TimeZoneRule *rule = nullptr;
+ TimeZoneRule *rule = nullptr;
int32_t fromOffset = 0;
int32_t toOffset = 0;
int32_t rawOffset = 0;
@@ -1598,7 +1598,7 @@ VTimeZone::parse(UErrorCode& status) {
} else {
rule = createRuleByRDATE(zonename, rawOffset, dstSavings, start, dates, fromOffset, status);
}
- if (U_FAILURE(status) || rule == nullptr) {
+ if (U_FAILURE(status) || rule == nullptr) {
goto cleanupParse;
} else {
UBool startAvail = rule->getFirstStart(fromOffset, 0, actualStart);
@@ -1638,24 +1638,24 @@ VTimeZone::parse(UErrorCode& status) {
// Create a initial rule
getDefaultTZName(tzid, FALSE, zonename);
- initialRule = new InitialTimeZoneRule(zonename, initialRawOffset, initialDSTSavings);
- if (initialRule == nullptr) {
+ initialRule = new InitialTimeZoneRule(zonename, initialRawOffset, initialDSTSavings);
+ if (initialRule == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
goto cleanupParse;
}
// Finally, create the RuleBasedTimeZone
rbtz = new RuleBasedTimeZone(tzid, initialRule);
- if (rbtz == nullptr) {
+ if (rbtz == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
goto cleanupParse;
}
- initialRule = nullptr; // already adopted by RBTZ, no need to delete
+ initialRule = nullptr; // already adopted by RBTZ, no need to delete
for (n = 0; n < rules->size(); n++) {
TimeZoneRule *r = (TimeZoneRule*)rules->elementAt(n);
AnnualTimeZoneRule *atzrule = dynamic_cast<AnnualTimeZoneRule *>(r);
- if (atzrule != nullptr) {
+ if (atzrule != nullptr) {
if (atzrule->getEndYear() == AnnualTimeZoneRule::MAX_YEAR) {
finalRuleCount++;
finalRuleIdx = n;
@@ -1700,7 +1700,7 @@ VTimeZone::parse(UErrorCode& status) {
}
}
- TimeZoneRule *newRule = nullptr;
+ TimeZoneRule *newRule = nullptr;
UnicodeString tznam;
if (start == finalStart) {
// Transform this into a single transition
@@ -1723,7 +1723,7 @@ VTimeZone::parse(UErrorCode& status) {
finalRule->getStartYear(),
y);
}
- if (newRule == nullptr) {
+ if (newRule == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
goto cleanupParse;
}
@@ -1755,20 +1755,20 @@ VTimeZone::parse(UErrorCode& status) {
return;
cleanupParse:
- if (rules != nullptr) {
+ if (rules != nullptr) {
while (!rules->isEmpty()) {
TimeZoneRule *r = (TimeZoneRule*)rules->orphanElementAt(0);
delete r;
}
delete rules;
}
- if (dates != nullptr) {
+ if (dates != nullptr) {
delete dates;
}
- if (initialRule != nullptr) {
+ if (initialRule != nullptr) {
delete initialRule;
}
- if (rbtz != nullptr) {
+ if (rbtz != nullptr) {
delete rbtz;
}
return;
@@ -1776,7 +1776,7 @@ cleanupParse:
void
VTimeZone::write(VTZWriter& writer, UErrorCode& status) const {
- if (vtzlines != nullptr) {
+ if (vtzlines != nullptr) {
for (int32_t i = 0; i < vtzlines->size(); i++) {
UnicodeString *line = (UnicodeString*)vtzlines->elementAt(i);
if (line->startsWith(ICAL_TZURL, -1)
@@ -1798,16 +1798,16 @@ VTimeZone::write(VTZWriter& writer, UErrorCode& status) const {
}
}
} else {
- UnicodeString icutzprop;
- UVector customProps(nullptr, uhash_compareUnicodeString, status);
+ UnicodeString icutzprop;
+ UVector customProps(nullptr, uhash_compareUnicodeString, status);
if (olsonzid.length() > 0 && icutzver.length() > 0) {
- icutzprop.append(olsonzid);
- icutzprop.append(u'[');
- icutzprop.append(icutzver);
- icutzprop.append(u']');
- customProps.addElement(&icutzprop, status);
+ icutzprop.append(olsonzid);
+ icutzprop.append(u'[');
+ icutzprop.append(icutzver);
+ icutzprop.append(u']');
+ customProps.addElement(&icutzprop, status);
}
- writeZone(writer, *tz, &customProps, status);
+ writeZone(writer, *tz, &customProps, status);
}
}
@@ -1816,8 +1816,8 @@ VTimeZone::write(UDate start, VTZWriter& writer, UErrorCode& status) const {
if (U_FAILURE(status)) {
return;
}
- InitialTimeZoneRule *initial = nullptr;
- UVector *transitionRules = nullptr;
+ InitialTimeZoneRule *initial = nullptr;
+ UVector *transitionRules = nullptr;
UVector customProps(uprv_deleteUObject, uhash_compareUnicodeString, status);
UnicodeString tzid;
@@ -1830,7 +1830,7 @@ VTimeZone::write(UDate start, VTZWriter& writer, UErrorCode& status) const {
// Create a RuleBasedTimeZone with the subset rule
getID(tzid);
RuleBasedTimeZone rbtz(tzid, initial);
- if (transitionRules != nullptr) {
+ if (transitionRules != nullptr) {
while (!transitionRules->isEmpty()) {
TimeZoneRule *tr = (TimeZoneRule*)transitionRules->orphanElementAt(0);
rbtz.addTransitionRule(tr, status);
@@ -1839,7 +1839,7 @@ VTimeZone::write(UDate start, VTZWriter& writer, UErrorCode& status) const {
}
}
delete transitionRules;
- transitionRules = nullptr;
+ transitionRules = nullptr;
}
rbtz.complete(status);
if (U_FAILURE(status)) {
@@ -1848,10 +1848,10 @@ VTimeZone::write(UDate start, VTZWriter& writer, UErrorCode& status) const {
if (olsonzid.length() > 0 && icutzver.length() > 0) {
UnicodeString *icutzprop = new UnicodeString(ICU_TZINFO_PROP);
- if (icutzprop == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- goto cleanupWritePartial;
- }
+ if (icutzprop == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ goto cleanupWritePartial;
+ }
icutzprop->append(olsonzid);
icutzprop->append((UChar)0x005B/*'['*/);
icutzprop->append(icutzver);
@@ -1868,10 +1868,10 @@ VTimeZone::write(UDate start, VTZWriter& writer, UErrorCode& status) const {
return;
cleanupWritePartial:
- if (initial != nullptr) {
+ if (initial != nullptr) {
delete initial;
}
- if (transitionRules != nullptr) {
+ if (transitionRules != nullptr) {
while (!transitionRules->isEmpty()) {
TimeZoneRule *tr = (TimeZoneRule*)transitionRules->orphanElementAt(0);
delete tr;
@@ -1890,14 +1890,14 @@ VTimeZone::writeSimple(UDate time, VTZWriter& writer, UErrorCode& status) const
UnicodeString tzid;
// Extract simple rules
- InitialTimeZoneRule *initial = nullptr;
- AnnualTimeZoneRule *std = nullptr, *dst = nullptr;
+ InitialTimeZoneRule *initial = nullptr;
+ AnnualTimeZoneRule *std = nullptr, *dst = nullptr;
getSimpleRulesNear(time, initial, std, dst, status);
if (U_SUCCESS(status)) {
// Create a RuleBasedTimeZone with the subset rule
getID(tzid);
RuleBasedTimeZone rbtz(tzid, initial);
- if (std != nullptr && dst != nullptr) {
+ if (std != nullptr && dst != nullptr) {
rbtz.addTransitionRule(std, status);
rbtz.addTransitionRule(dst, status);
}
@@ -1907,10 +1907,10 @@ VTimeZone::writeSimple(UDate time, VTZWriter& writer, UErrorCode& status) const
if (olsonzid.length() > 0 && icutzver.length() > 0) {
UnicodeString *icutzprop = new UnicodeString(ICU_TZINFO_PROP);
- if (icutzprop == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- goto cleanupWriteSimple;
- }
+ if (icutzprop == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ goto cleanupWriteSimple;
+ }
icutzprop->append(olsonzid);
icutzprop->append((UChar)0x005B/*'['*/);
icutzprop->append(icutzver);
@@ -1928,13 +1928,13 @@ VTimeZone::writeSimple(UDate time, VTZWriter& writer, UErrorCode& status) const
return;
cleanupWriteSimple:
- if (initial != nullptr) {
+ if (initial != nullptr) {
delete initial;
}
- if (std != nullptr) {
+ if (std != nullptr) {
delete std;
}
- if (dst != nullptr) {
+ if (dst != nullptr) {
delete dst;
}
}
@@ -1950,7 +1950,7 @@ VTimeZone::writeZone(VTZWriter& w, BasicTimeZone& basictz,
return;
}
- if (customProps != nullptr) {
+ if (customProps != nullptr) {
for (int32_t i = 0; i < customProps->size(); i++) {
UnicodeString *custprop = (UnicodeString*)customProps->elementAt(i);
w.write(*custprop);
@@ -1971,7 +1971,7 @@ VTimeZone::writeZone(VTZWriter& w, BasicTimeZone& basictz,
UDate dstStartTime = 0.0;
UDate dstUntilTime = 0.0;
int32_t dstCount = 0;
- AnnualTimeZoneRule *finalDstRule = nullptr;
+ AnnualTimeZoneRule *finalDstRule = nullptr;
UnicodeString stdName;
int32_t stdFromOffset = 0;
@@ -1985,7 +1985,7 @@ VTimeZone::writeZone(VTZWriter& w, BasicTimeZone& basictz,
UDate stdStartTime = 0.0;
UDate stdUntilTime = 0.0;
int32_t stdCount = 0;
- AnnualTimeZoneRule *finalStdRule = nullptr;
+ AnnualTimeZoneRule *finalStdRule = nullptr;
int32_t year, month, dom, dow, doy, mid;
UBool hasTransitions = FALSE;
@@ -2012,11 +2012,11 @@ VTimeZone::writeZone(VTZWriter& w, BasicTimeZone& basictz,
UBool sameRule = FALSE;
const AnnualTimeZoneRule *atzrule;
if (isDst) {
- if (finalDstRule == nullptr
- && (atzrule = dynamic_cast<const AnnualTimeZoneRule *>(tzt.getTo())) != nullptr
+ if (finalDstRule == nullptr
+ && (atzrule = dynamic_cast<const AnnualTimeZoneRule *>(tzt.getTo())) != nullptr
&& atzrule->getEndYear() == AnnualTimeZoneRule::MAX_YEAR
) {
- finalDstRule = atzrule->clone();
+ finalDstRule = atzrule->clone();
}
if (dstCount > 0) {
if (year == dstStartYear + dstCount
@@ -2059,15 +2059,15 @@ VTimeZone::writeZone(VTZWriter& w, BasicTimeZone& basictz,
dstStartTime = dstUntilTime = t;
dstCount = 1;
}
- if (finalStdRule != nullptr && finalDstRule != nullptr) {
+ if (finalStdRule != nullptr && finalDstRule != nullptr) {
break;
}
} else {
- if (finalStdRule == nullptr
- && (atzrule = dynamic_cast<const AnnualTimeZoneRule *>(tzt.getTo())) != nullptr
+ if (finalStdRule == nullptr
+ && (atzrule = dynamic_cast<const AnnualTimeZoneRule *>(tzt.getTo())) != nullptr
&& atzrule->getEndYear() == AnnualTimeZoneRule::MAX_YEAR
) {
- finalStdRule = atzrule->clone();
+ finalStdRule = atzrule->clone();
}
if (stdCount > 0) {
if (year == stdStartYear + stdCount
@@ -2110,7 +2110,7 @@ VTimeZone::writeZone(VTZWriter& w, BasicTimeZone& basictz,
stdStartTime = stdUntilTime = t;
stdCount = 1;
}
- if (finalStdRule != nullptr && finalDstRule != nullptr) {
+ if (finalStdRule != nullptr && finalDstRule != nullptr) {
break;
}
}
@@ -2134,7 +2134,7 @@ VTimeZone::writeZone(VTZWriter& w, BasicTimeZone& basictz,
}
} else {
if (dstCount > 0) {
- if (finalDstRule == nullptr) {
+ if (finalDstRule == nullptr) {
if (dstCount == 1) {
writeZonePropsByTime(w, TRUE, dstName, dstFromOffset, dstToOffset, dstStartTime,
TRUE, status);
@@ -2176,7 +2176,7 @@ VTimeZone::writeZone(VTZWriter& w, BasicTimeZone& basictz,
}
}
if (stdCount > 0) {
- if (finalStdRule == nullptr) {
+ if (finalStdRule == nullptr) {
if (stdCount == 1) {
writeZonePropsByTime(w, FALSE, stdName, stdFromOffset, stdToOffset, stdStartTime,
TRUE, status);
@@ -2222,10 +2222,10 @@ VTimeZone::writeZone(VTZWriter& w, BasicTimeZone& basictz,
cleanupWriteZone:
- if (finalStdRule != nullptr) {
+ if (finalStdRule != nullptr) {
delete finalStdRule;
}
- if (finalDstRule != nullptr) {
+ if (finalDstRule != nullptr) {
delete finalDstRule;
}
}
@@ -2538,11 +2538,11 @@ VTimeZone::writeFinalRule(VTZWriter& writer, UBool isDst, const AnnualTimeZoneRu
return;
}
UBool modifiedRule = TRUE;
- const DateTimeRule *dtrule = toWallTimeRule(rule->getRule(), fromRawOffset, fromDSTSavings, status);
- if (U_FAILURE(status)) {
- return;
- }
- if (dtrule == nullptr) {
+ const DateTimeRule *dtrule = toWallTimeRule(rule->getRule(), fromRawOffset, fromDSTSavings, status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ if (dtrule == nullptr) {
modifiedRule = FALSE;
dtrule = rule->getRule();
}
diff --git a/contrib/libs/icu/i18n/vzone.cpp b/contrib/libs/icu/i18n/vzone.cpp
index 0405cb13ea..7e3a5544fd 100644
--- a/contrib/libs/icu/i18n/vzone.cpp
+++ b/contrib/libs/icu/i18n/vzone.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/vzone.h b/contrib/libs/icu/i18n/vzone.h
index 9e3e0b05a9..17df92e17b 100644
--- a/contrib/libs/icu/i18n/vzone.h
+++ b/contrib/libs/icu/i18n/vzone.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/windtfmt.cpp b/contrib/libs/icu/i18n/windtfmt.cpp
index 02518d17b3..bcf272bc61 100644
--- a/contrib/libs/icu/i18n/windtfmt.cpp
+++ b/contrib/libs/icu/i18n/windtfmt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -13,7 +13,7 @@
#include "unicode/utypes.h"
-#if U_PLATFORM_USES_ONLY_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
#if !UCONFIG_NO_FORMATTING
@@ -35,9 +35,9 @@
#include "windtfmt.h"
#include "wintzimpl.h"
-#ifndef WIN32_LEAN_AND_MEAN
+#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
-#endif
+#endif
# define VC_EXTRALEAN
# define NOUSER
# define NOSERVICE
@@ -94,83 +94,83 @@ UnicodeString* Win32DateFormat::getTimeDateFormat(const Calendar *cal, const Loc
return result;
}
-// TODO: This is copied in both winnmfmt.cpp and windtfmt.cpp, but really should
-// be factored out into a common helper for both.
-static UErrorCode GetEquivalentWindowsLocaleName(const Locale& locale, UnicodeString** buffer)
-{
- UErrorCode status = U_ZERO_ERROR;
- char asciiBCP47Tag[LOCALE_NAME_MAX_LENGTH] = {};
-
- // Convert from names like "en_CA" and "de_DE@collation=phonebook" to "en-CA" and "de-DE-u-co-phonebk".
- (void)uloc_toLanguageTag(locale.getName(), asciiBCP47Tag, UPRV_LENGTHOF(asciiBCP47Tag), FALSE, &status);
-
- if (U_SUCCESS(status))
- {
- // Need it to be UTF-16, not 8-bit
- // TODO: This seems like a good thing for a helper
- wchar_t bcp47Tag[LOCALE_NAME_MAX_LENGTH] = {};
- int32_t i;
- for (i = 0; i < UPRV_LENGTHOF(bcp47Tag); i++)
- {
- if (asciiBCP47Tag[i] == '\0')
- {
- break;
- }
- else
- {
- // normally just copy the character
- bcp47Tag[i] = static_cast<wchar_t>(asciiBCP47Tag[i]);
- }
- }
-
- // Ensure it's null terminated
- if (i < (UPRV_LENGTHOF(bcp47Tag) - 1))
- {
- bcp47Tag[i] = L'\0';
- }
- else
- {
- // Ran out of room.
- bcp47Tag[UPRV_LENGTHOF(bcp47Tag) - 1] = L'\0';
- }
-
-
- wchar_t windowsLocaleName[LOCALE_NAME_MAX_LENGTH] = {};
-
- // Note: On Windows versions below 10, there is no support for locale name aliases.
- // This means that it will fail for locales where ICU has a completely different
- // name (like ku vs ckb), and it will also not work for alternate sort locale
- // names like "de-DE-u-co-phonebk".
-
- // TODO: We could add some sort of exception table for cases like ku vs ckb.
-
- int length = ResolveLocaleName(bcp47Tag, windowsLocaleName, UPRV_LENGTHOF(windowsLocaleName));
-
- if (length > 0)
- {
- *buffer = new UnicodeString(windowsLocaleName);
- }
- else
- {
- status = U_UNSUPPORTED_ERROR;
- }
- }
- return status;
-}
-
+// TODO: This is copied in both winnmfmt.cpp and windtfmt.cpp, but really should
+// be factored out into a common helper for both.
+static UErrorCode GetEquivalentWindowsLocaleName(const Locale& locale, UnicodeString** buffer)
+{
+ UErrorCode status = U_ZERO_ERROR;
+ char asciiBCP47Tag[LOCALE_NAME_MAX_LENGTH] = {};
+
+ // Convert from names like "en_CA" and "de_DE@collation=phonebook" to "en-CA" and "de-DE-u-co-phonebk".
+ (void)uloc_toLanguageTag(locale.getName(), asciiBCP47Tag, UPRV_LENGTHOF(asciiBCP47Tag), FALSE, &status);
+
+ if (U_SUCCESS(status))
+ {
+ // Need it to be UTF-16, not 8-bit
+ // TODO: This seems like a good thing for a helper
+ wchar_t bcp47Tag[LOCALE_NAME_MAX_LENGTH] = {};
+ int32_t i;
+ for (i = 0; i < UPRV_LENGTHOF(bcp47Tag); i++)
+ {
+ if (asciiBCP47Tag[i] == '\0')
+ {
+ break;
+ }
+ else
+ {
+ // normally just copy the character
+ bcp47Tag[i] = static_cast<wchar_t>(asciiBCP47Tag[i]);
+ }
+ }
+
+ // Ensure it's null terminated
+ if (i < (UPRV_LENGTHOF(bcp47Tag) - 1))
+ {
+ bcp47Tag[i] = L'\0';
+ }
+ else
+ {
+ // Ran out of room.
+ bcp47Tag[UPRV_LENGTHOF(bcp47Tag) - 1] = L'\0';
+ }
+
+
+ wchar_t windowsLocaleName[LOCALE_NAME_MAX_LENGTH] = {};
+
+ // Note: On Windows versions below 10, there is no support for locale name aliases.
+ // This means that it will fail for locales where ICU has a completely different
+ // name (like ku vs ckb), and it will also not work for alternate sort locale
+ // names like "de-DE-u-co-phonebk".
+
+ // TODO: We could add some sort of exception table for cases like ku vs ckb.
+
+ int length = ResolveLocaleName(bcp47Tag, windowsLocaleName, UPRV_LENGTHOF(windowsLocaleName));
+
+ if (length > 0)
+ {
+ *buffer = new UnicodeString(windowsLocaleName);
+ }
+ else
+ {
+ status = U_UNSUPPORTED_ERROR;
+ }
+ }
+ return status;
+}
+
// TODO: Range-check timeStyle, dateStyle
Win32DateFormat::Win32DateFormat(DateFormat::EStyle timeStyle, DateFormat::EStyle dateStyle, const Locale &locale, UErrorCode &status)
- : DateFormat(), fDateTimeMsg(NULL), fTimeStyle(timeStyle), fDateStyle(dateStyle), fLocale(locale), fZoneID(), fWindowsLocaleName(nullptr)
+ : DateFormat(), fDateTimeMsg(NULL), fTimeStyle(timeStyle), fDateStyle(dateStyle), fLocale(locale), fZoneID(), fWindowsLocaleName(nullptr)
{
if (U_SUCCESS(status)) {
- GetEquivalentWindowsLocaleName(locale, &fWindowsLocaleName);
- // Note: In the previous code, it would look up the LCID for the locale, and if
- // the locale was not recognized then it would get an LCID of 0, which is a
- // synonym for LOCALE_USER_DEFAULT on Windows.
- // If the above method fails, then fWindowsLocaleName will remain as nullptr, and
- // then we will pass nullptr to API GetLocaleInfoEx, which is the same as passing
- // LOCALE_USER_DEFAULT.
-
+ GetEquivalentWindowsLocaleName(locale, &fWindowsLocaleName);
+ // Note: In the previous code, it would look up the LCID for the locale, and if
+ // the locale was not recognized then it would get an LCID of 0, which is a
+ // synonym for LOCALE_USER_DEFAULT on Windows.
+ // If the above method fails, then fWindowsLocaleName will remain as nullptr, and
+ // then we will pass nullptr to API GetLocaleInfoEx, which is the same as passing
+ // LOCALE_USER_DEFAULT.
+
fTZI = NEW_ARRAY(TIME_ZONE_INFORMATION, 1);
uprv_memset(fTZI, 0, sizeof(TIME_ZONE_INFORMATION));
adoptCalendar(Calendar::createInstance(locale, status));
@@ -188,7 +188,7 @@ Win32DateFormat::~Win32DateFormat()
// delete fCalendar;
uprv_free(fTZI);
delete fDateTimeMsg;
- delete fWindowsLocaleName;
+ delete fWindowsLocaleName;
}
Win32DateFormat &Win32DateFormat::operator=(const Win32DateFormat &other)
@@ -208,18 +208,18 @@ Win32DateFormat &Win32DateFormat::operator=(const Win32DateFormat &other)
this->fTZI = NEW_ARRAY(TIME_ZONE_INFORMATION, 1);
*this->fTZI = *other.fTZI;
- this->fWindowsLocaleName = other.fWindowsLocaleName == NULL ? NULL : new UnicodeString(*other.fWindowsLocaleName);
-
+ this->fWindowsLocaleName = other.fWindowsLocaleName == NULL ? NULL : new UnicodeString(*other.fWindowsLocaleName);
+
return *this;
}
-Win32DateFormat *Win32DateFormat::clone() const
+Win32DateFormat *Win32DateFormat::clone() const
{
return new Win32DateFormat(*this);
}
// TODO: Is just ignoring pos the right thing?
-UnicodeString &Win32DateFormat::format(Calendar &cal, UnicodeString &appendTo, FieldPosition & /* pos */) const
+UnicodeString &Win32DateFormat::format(Calendar &cal, UnicodeString &appendTo, FieldPosition & /* pos */) const
{
FILETIME ft;
SYSTEMTIME st_gmt;
@@ -263,7 +263,7 @@ UnicodeString &Win32DateFormat::format(Calendar &cal, UnicodeString &appendTo, F
return appendTo;
}
-void Win32DateFormat::parse(const UnicodeString& /* text */, Calendar& /* cal */, ParsePosition& pos) const
+void Win32DateFormat::parse(const UnicodeString& /* text */, Calendar& /* cal */, ParsePosition& pos) const
{
pos.setErrorIndex(pos.getIndex());
}
@@ -306,25 +306,25 @@ static const DWORD dfFlags[] = {DATE_LONGDATE, DATE_LONGDATE, DATE_SHORTDATE, DA
void Win32DateFormat::formatDate(const SYSTEMTIME *st, UnicodeString &appendTo) const
{
- int result=0;
+ int result=0;
wchar_t stackBuffer[STACK_BUFFER_SIZE];
wchar_t *buffer = stackBuffer;
- const wchar_t *localeName = nullptr;
+ const wchar_t *localeName = nullptr;
- if (fWindowsLocaleName != nullptr)
- {
- localeName = reinterpret_cast<const wchar_t*>(toOldUCharPtr(fWindowsLocaleName->getTerminatedBuffer()));
- }
+ if (fWindowsLocaleName != nullptr)
+ {
+ localeName = reinterpret_cast<const wchar_t*>(toOldUCharPtr(fWindowsLocaleName->getTerminatedBuffer()));
+ }
+
+ result = GetDateFormatEx(localeName, dfFlags[fDateStyle - kDateOffset], st, NULL, buffer, STACK_BUFFER_SIZE, NULL);
- result = GetDateFormatEx(localeName, dfFlags[fDateStyle - kDateOffset], st, NULL, buffer, STACK_BUFFER_SIZE, NULL);
-
if (result == 0) {
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
- int newLength = GetDateFormatEx(localeName, dfFlags[fDateStyle - kDateOffset], st, NULL, NULL, 0, NULL);
+ int newLength = GetDateFormatEx(localeName, dfFlags[fDateStyle - kDateOffset], st, NULL, NULL, 0, NULL);
buffer = NEW_ARRAY(wchar_t, newLength);
-
- GetDateFormatEx(localeName, dfFlags[fDateStyle - kDateOffset], st, NULL, buffer, newLength, NULL);
+
+ GetDateFormatEx(localeName, dfFlags[fDateStyle - kDateOffset], st, NULL, buffer, newLength, NULL);
}
}
@@ -342,22 +342,22 @@ void Win32DateFormat::formatTime(const SYSTEMTIME *st, UnicodeString &appendTo)
int result;
wchar_t stackBuffer[STACK_BUFFER_SIZE];
wchar_t *buffer = stackBuffer;
- const wchar_t *localeName = nullptr;
+ const wchar_t *localeName = nullptr;
- if (fWindowsLocaleName != nullptr)
- {
- localeName = reinterpret_cast<const wchar_t*>(toOldUCharPtr(fWindowsLocaleName->getTerminatedBuffer()));
- }
+ if (fWindowsLocaleName != nullptr)
+ {
+ localeName = reinterpret_cast<const wchar_t*>(toOldUCharPtr(fWindowsLocaleName->getTerminatedBuffer()));
+ }
+
+ result = GetTimeFormatEx(localeName, tfFlags[fTimeStyle], st, NULL, buffer, STACK_BUFFER_SIZE);
- result = GetTimeFormatEx(localeName, tfFlags[fTimeStyle], st, NULL, buffer, STACK_BUFFER_SIZE);
-
if (result == 0) {
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
- int newLength = GetTimeFormatEx(localeName, tfFlags[fTimeStyle], st, NULL, NULL, 0);
+ int newLength = GetTimeFormatEx(localeName, tfFlags[fTimeStyle], st, NULL, NULL, 0);
buffer = NEW_ARRAY(wchar_t, newLength);
-
- GetTimeFormatEx(localeName, tfFlags[fTimeStyle], st, NULL, buffer, newLength);
+
+ GetTimeFormatEx(localeName, tfFlags[fTimeStyle], st, NULL, buffer, newLength);
}
}
@@ -385,8 +385,8 @@ UnicodeString Win32DateFormat::setTimeZoneInfo(TIME_ZONE_INFORMATION *tzi, const
for (int z = 0; z < ec; z += 1) {
UnicodeString equiv = TimeZone::getEquivalentID(icuid, z);
- found = uprv_getWindowsTimeZoneInfo(tzi, equiv.getBuffer(), equiv.length());
- if (found) {
+ found = uprv_getWindowsTimeZoneInfo(tzi, equiv.getBuffer(), equiv.length());
+ if (found) {
break;
}
}
@@ -404,5 +404,5 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif // U_PLATFORM_USES_ONLY_WIN32_API
+#endif // U_PLATFORM_USES_ONLY_WIN32_API
diff --git a/contrib/libs/icu/i18n/windtfmt.h b/contrib/libs/icu/i18n/windtfmt.h
index 3b59a018ce..7fe7f68f45 100644
--- a/contrib/libs/icu/i18n/windtfmt.h
+++ b/contrib/libs/icu/i18n/windtfmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -16,7 +16,7 @@
#include "unicode/utypes.h"
-#if U_PLATFORM_USES_ONLY_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
#if !UCONFIG_NO_FORMATTING
@@ -48,7 +48,7 @@ public:
virtual ~Win32DateFormat();
- virtual Win32DateFormat *clone() const;
+ virtual Win32DateFormat *clone() const;
Win32DateFormat &operator=(const Win32DateFormat &other);
@@ -95,7 +95,7 @@ public:
* <pre>
* . Base* polymorphic_pointer = createPolymorphicObject();
* . if (polymorphic_pointer->getDynamicClassID() ==
- * . derived::getStaticClassID()) ...
+ * . derived::getStaticClassID()) ...
* </pre>
* @return The class ID for all objects of this class.
*/
@@ -126,14 +126,14 @@ private:
Locale fLocale;
UnicodeString fZoneID;
TIME_ZONE_INFORMATION *fTZI;
-
- UnicodeString* fWindowsLocaleName; // Stores the equivalent Windows locale name.
+
+ UnicodeString* fWindowsLocaleName; // Stores the equivalent Windows locale name.
};
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif // U_PLATFORM_USES_ONLY_WIN32_API
+#endif // U_PLATFORM_USES_ONLY_WIN32_API
#endif // __WINDTFMT
diff --git a/contrib/libs/icu/i18n/winnmfmt.cpp b/contrib/libs/icu/i18n/winnmfmt.cpp
index 1c5e969ae6..72da1be28b 100644
--- a/contrib/libs/icu/i18n/winnmfmt.cpp
+++ b/contrib/libs/icu/i18n/winnmfmt.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -28,9 +28,9 @@
#include "uassert.h"
#include "locmap.h"
-#ifndef WIN32_LEAN_AND_MEAN
+#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
-#endif
+#endif
# define VC_EXTRALEAN
# define NOUSER
# define NOSERVICE
@@ -60,43 +60,43 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Win32NumberFormat)
* end in ";0" then the return value should be multiplied by 10.
* (e.g. "3" => 30, "3;2" => 320)
*/
-static UINT getGrouping(const wchar_t *grouping)
+static UINT getGrouping(const wchar_t *grouping)
{
UINT g = 0;
- const wchar_t *s;
+ const wchar_t *s;
- for (s = grouping; *s != L'\0'; s += 1) {
- if (*s > L'0' && *s < L'9') {
- g = g * 10 + (*s - L'0');
- } else if (*s != L';') {
+ for (s = grouping; *s != L'\0'; s += 1) {
+ if (*s > L'0' && *s < L'9') {
+ g = g * 10 + (*s - L'0');
+ } else if (*s != L';') {
break;
}
}
- if (*s != L'0') {
+ if (*s != L'0') {
g *= 10;
}
return g;
}
-static void getNumberFormat(NUMBERFMTW *fmt, const wchar_t *windowsLocaleName)
+static void getNumberFormat(NUMBERFMTW *fmt, const wchar_t *windowsLocaleName)
{
- wchar_t buf[10];
+ wchar_t buf[10];
- GetLocaleInfoEx(windowsLocaleName, LOCALE_RETURN_NUMBER|LOCALE_IDIGITS, (LPWSTR) &fmt->NumDigits, sizeof(UINT));
- GetLocaleInfoEx(windowsLocaleName, LOCALE_RETURN_NUMBER|LOCALE_ILZERO, (LPWSTR) &fmt->LeadingZero, sizeof(UINT));
+ GetLocaleInfoEx(windowsLocaleName, LOCALE_RETURN_NUMBER|LOCALE_IDIGITS, (LPWSTR) &fmt->NumDigits, sizeof(UINT));
+ GetLocaleInfoEx(windowsLocaleName, LOCALE_RETURN_NUMBER|LOCALE_ILZERO, (LPWSTR) &fmt->LeadingZero, sizeof(UINT));
- GetLocaleInfoEx(windowsLocaleName, LOCALE_SGROUPING, (LPWSTR)buf, 10);
+ GetLocaleInfoEx(windowsLocaleName, LOCALE_SGROUPING, (LPWSTR)buf, 10);
fmt->Grouping = getGrouping(buf);
fmt->lpDecimalSep = NEW_ARRAY(wchar_t, 6);
- GetLocaleInfoEx(windowsLocaleName, LOCALE_SDECIMAL, fmt->lpDecimalSep, 6);
+ GetLocaleInfoEx(windowsLocaleName, LOCALE_SDECIMAL, fmt->lpDecimalSep, 6);
fmt->lpThousandSep = NEW_ARRAY(wchar_t, 6);
- GetLocaleInfoEx(windowsLocaleName, LOCALE_STHOUSAND, fmt->lpThousandSep, 6);
+ GetLocaleInfoEx(windowsLocaleName, LOCALE_STHOUSAND, fmt->lpThousandSep, 6);
- GetLocaleInfoEx(windowsLocaleName, LOCALE_RETURN_NUMBER|LOCALE_INEGNUMBER, (LPWSTR) &fmt->NegativeOrder, sizeof(UINT));
+ GetLocaleInfoEx(windowsLocaleName, LOCALE_RETURN_NUMBER|LOCALE_INEGNUMBER, (LPWSTR) &fmt->NegativeOrder, sizeof(UINT));
}
static void freeNumberFormat(NUMBERFMTW *fmt)
@@ -107,27 +107,27 @@ static void freeNumberFormat(NUMBERFMTW *fmt)
}
}
-static void getCurrencyFormat(CURRENCYFMTW *fmt, const wchar_t *windowsLocaleName)
+static void getCurrencyFormat(CURRENCYFMTW *fmt, const wchar_t *windowsLocaleName)
{
- wchar_t buf[10];
+ wchar_t buf[10];
- GetLocaleInfoEx(windowsLocaleName, LOCALE_RETURN_NUMBER|LOCALE_ICURRDIGITS, (LPWSTR) &fmt->NumDigits, sizeof(UINT));
- GetLocaleInfoEx(windowsLocaleName, LOCALE_RETURN_NUMBER|LOCALE_ILZERO, (LPWSTR) &fmt->LeadingZero, sizeof(UINT));
+ GetLocaleInfoEx(windowsLocaleName, LOCALE_RETURN_NUMBER|LOCALE_ICURRDIGITS, (LPWSTR) &fmt->NumDigits, sizeof(UINT));
+ GetLocaleInfoEx(windowsLocaleName, LOCALE_RETURN_NUMBER|LOCALE_ILZERO, (LPWSTR) &fmt->LeadingZero, sizeof(UINT));
- GetLocaleInfoEx(windowsLocaleName, LOCALE_SMONGROUPING, (LPWSTR)buf, sizeof(buf));
+ GetLocaleInfoEx(windowsLocaleName, LOCALE_SMONGROUPING, (LPWSTR)buf, sizeof(buf));
fmt->Grouping = getGrouping(buf);
fmt->lpDecimalSep = NEW_ARRAY(wchar_t, 6);
- GetLocaleInfoEx(windowsLocaleName, LOCALE_SMONDECIMALSEP, fmt->lpDecimalSep, 6);
+ GetLocaleInfoEx(windowsLocaleName, LOCALE_SMONDECIMALSEP, fmt->lpDecimalSep, 6);
fmt->lpThousandSep = NEW_ARRAY(wchar_t, 6);
- GetLocaleInfoEx(windowsLocaleName, LOCALE_SMONTHOUSANDSEP, fmt->lpThousandSep, 6);
+ GetLocaleInfoEx(windowsLocaleName, LOCALE_SMONTHOUSANDSEP, fmt->lpThousandSep, 6);
- GetLocaleInfoEx(windowsLocaleName, LOCALE_RETURN_NUMBER|LOCALE_INEGCURR, (LPWSTR) &fmt->NegativeOrder, sizeof(UINT));
- GetLocaleInfoEx(windowsLocaleName, LOCALE_RETURN_NUMBER|LOCALE_ICURRENCY, (LPWSTR) &fmt->PositiveOrder, sizeof(UINT));
+ GetLocaleInfoEx(windowsLocaleName, LOCALE_RETURN_NUMBER|LOCALE_INEGCURR, (LPWSTR) &fmt->NegativeOrder, sizeof(UINT));
+ GetLocaleInfoEx(windowsLocaleName, LOCALE_RETURN_NUMBER|LOCALE_ICURRENCY, (LPWSTR) &fmt->PositiveOrder, sizeof(UINT));
fmt->lpCurrencySymbol = NEW_ARRAY(wchar_t, 8);
- GetLocaleInfoEx(windowsLocaleName, LOCALE_SCURRENCY, (LPWSTR) fmt->lpCurrencySymbol, 8);
+ GetLocaleInfoEx(windowsLocaleName, LOCALE_SCURRENCY, (LPWSTR) fmt->lpCurrencySymbol, 8);
}
static void freeCurrencyFormat(CURRENCYFMTW *fmt)
@@ -139,84 +139,84 @@ static void freeCurrencyFormat(CURRENCYFMTW *fmt)
}
}
-// TODO: This is copied in both winnmfmt.cpp and windtfmt.cpp, but really should
-// be factored out into a common helper for both.
-static UErrorCode GetEquivalentWindowsLocaleName(const Locale& locale, UnicodeString** buffer)
-{
- UErrorCode status = U_ZERO_ERROR;
- char asciiBCP47Tag[LOCALE_NAME_MAX_LENGTH] = {};
-
- // Convert from names like "en_CA" and "de_DE@collation=phonebook" to "en-CA" and "de-DE-u-co-phonebk".
- (void) uloc_toLanguageTag(locale.getName(), asciiBCP47Tag, UPRV_LENGTHOF(asciiBCP47Tag), FALSE, &status);
-
- if (U_SUCCESS(status))
- {
- // Need it to be UTF-16, not 8-bit
- // TODO: This seems like a good thing for a helper
- wchar_t bcp47Tag[LOCALE_NAME_MAX_LENGTH] = {};
- int32_t i;
- for (i = 0; i < UPRV_LENGTHOF(bcp47Tag); i++)
- {
- if (asciiBCP47Tag[i] == '\0')
- {
- break;
- }
- else
- {
- // normally just copy the character
- bcp47Tag[i] = static_cast<wchar_t>(asciiBCP47Tag[i]);
- }
- }
-
- // Ensure it's null terminated
- if (i < (UPRV_LENGTHOF(bcp47Tag) - 1))
- {
- bcp47Tag[i] = L'\0';
- }
- else
- {
- // Ran out of room.
- bcp47Tag[UPRV_LENGTHOF(bcp47Tag) - 1] = L'\0';
- }
-
-
- wchar_t windowsLocaleName[LOCALE_NAME_MAX_LENGTH] = {};
-
- // Note: On Windows versions below 10, there is no support for locale name aliases.
- // This means that it will fail for locales where ICU has a completely different
- // name (like ku vs ckb), and it will also not work for alternate sort locale
- // names like "de-DE-u-co-phonebk".
-
- // TODO: We could add some sort of exception table for cases like ku vs ckb.
-
- int length = ResolveLocaleName(bcp47Tag, windowsLocaleName, UPRV_LENGTHOF(windowsLocaleName));
-
- if (length > 0)
- {
- *buffer = new UnicodeString(windowsLocaleName);
- }
- else
- {
- status = U_UNSUPPORTED_ERROR;
- }
- }
- return status;
-}
-
+// TODO: This is copied in both winnmfmt.cpp and windtfmt.cpp, but really should
+// be factored out into a common helper for both.
+static UErrorCode GetEquivalentWindowsLocaleName(const Locale& locale, UnicodeString** buffer)
+{
+ UErrorCode status = U_ZERO_ERROR;
+ char asciiBCP47Tag[LOCALE_NAME_MAX_LENGTH] = {};
+
+ // Convert from names like "en_CA" and "de_DE@collation=phonebook" to "en-CA" and "de-DE-u-co-phonebk".
+ (void) uloc_toLanguageTag(locale.getName(), asciiBCP47Tag, UPRV_LENGTHOF(asciiBCP47Tag), FALSE, &status);
+
+ if (U_SUCCESS(status))
+ {
+ // Need it to be UTF-16, not 8-bit
+ // TODO: This seems like a good thing for a helper
+ wchar_t bcp47Tag[LOCALE_NAME_MAX_LENGTH] = {};
+ int32_t i;
+ for (i = 0; i < UPRV_LENGTHOF(bcp47Tag); i++)
+ {
+ if (asciiBCP47Tag[i] == '\0')
+ {
+ break;
+ }
+ else
+ {
+ // normally just copy the character
+ bcp47Tag[i] = static_cast<wchar_t>(asciiBCP47Tag[i]);
+ }
+ }
+
+ // Ensure it's null terminated
+ if (i < (UPRV_LENGTHOF(bcp47Tag) - 1))
+ {
+ bcp47Tag[i] = L'\0';
+ }
+ else
+ {
+ // Ran out of room.
+ bcp47Tag[UPRV_LENGTHOF(bcp47Tag) - 1] = L'\0';
+ }
+
+
+ wchar_t windowsLocaleName[LOCALE_NAME_MAX_LENGTH] = {};
+
+ // Note: On Windows versions below 10, there is no support for locale name aliases.
+ // This means that it will fail for locales where ICU has a completely different
+ // name (like ku vs ckb), and it will also not work for alternate sort locale
+ // names like "de-DE-u-co-phonebk".
+
+ // TODO: We could add some sort of exception table for cases like ku vs ckb.
+
+ int length = ResolveLocaleName(bcp47Tag, windowsLocaleName, UPRV_LENGTHOF(windowsLocaleName));
+
+ if (length > 0)
+ {
+ *buffer = new UnicodeString(windowsLocaleName);
+ }
+ else
+ {
+ status = U_UNSUPPORTED_ERROR;
+ }
+ }
+ return status;
+}
+
Win32NumberFormat::Win32NumberFormat(const Locale &locale, UBool currency, UErrorCode &status)
- : NumberFormat(), fCurrency(currency), fFormatInfo(NULL), fFractionDigitsSet(FALSE), fWindowsLocaleName(nullptr)
+ : NumberFormat(), fCurrency(currency), fFormatInfo(NULL), fFractionDigitsSet(FALSE), fWindowsLocaleName(nullptr)
{
if (!U_FAILURE(status)) {
fLCID = locale.getLCID();
- GetEquivalentWindowsLocaleName(locale, &fWindowsLocaleName);
- // Note: In the previous code, it would look up the LCID for the locale, and if
- // the locale was not recognized then it would get an LCID of 0, which is a
- // synonym for LOCALE_USER_DEFAULT on Windows.
- // If the above method fails, then fWindowsLocaleName will remain as nullptr, and
- // then we will pass nullptr to API GetLocaleInfoEx, which is the same as passing
- // LOCALE_USER_DEFAULT.
-
+ GetEquivalentWindowsLocaleName(locale, &fWindowsLocaleName);
+ // Note: In the previous code, it would look up the LCID for the locale, and if
+ // the locale was not recognized then it would get an LCID of 0, which is a
+ // synonym for LOCALE_USER_DEFAULT on Windows.
+ // If the above method fails, then fWindowsLocaleName will remain as nullptr, and
+ // then we will pass nullptr to API GetLocaleInfoEx, which is the same as passing
+ // LOCALE_USER_DEFAULT.
+
// Resolve actual locale to be used later
UErrorCode tmpsts = U_ZERO_ERROR;
char tmpLocID[ULOC_FULLNAME_CAPACITY];
@@ -226,19 +226,19 @@ Win32NumberFormat::Win32NumberFormat(const Locale &locale, UBool currency, UErro
fLocale = Locale((const char*)tmpLocID);
}
- const wchar_t *localeName = nullptr;
-
- if (fWindowsLocaleName != nullptr)
- {
- localeName = reinterpret_cast<const wchar_t*>(toOldUCharPtr(fWindowsLocaleName->getTerminatedBuffer()));
- }
-
+ const wchar_t *localeName = nullptr;
+
+ if (fWindowsLocaleName != nullptr)
+ {
+ localeName = reinterpret_cast<const wchar_t*>(toOldUCharPtr(fWindowsLocaleName->getTerminatedBuffer()));
+ }
+
fFormatInfo = (FormatInfo*)uprv_malloc(sizeof(FormatInfo));
if (fCurrency) {
- getCurrencyFormat(&fFormatInfo->currency, localeName);
+ getCurrencyFormat(&fFormatInfo->currency, localeName);
} else {
- getNumberFormat(&fFormatInfo->number, localeName);
+ getNumberFormat(&fFormatInfo->number, localeName);
}
}
}
@@ -263,7 +263,7 @@ Win32NumberFormat::~Win32NumberFormat()
uprv_free(fFormatInfo);
}
- delete fWindowsLocaleName;
+ delete fWindowsLocaleName;
}
Win32NumberFormat &Win32NumberFormat::operator=(const Win32NumberFormat &other)
@@ -274,42 +274,42 @@ Win32NumberFormat &Win32NumberFormat::operator=(const Win32NumberFormat &other)
this->fLocale = other.fLocale;
this->fLCID = other.fLCID;
this->fFractionDigitsSet = other.fFractionDigitsSet;
- this->fWindowsLocaleName = other.fWindowsLocaleName == NULL ? NULL : new UnicodeString(*other.fWindowsLocaleName);
-
- const wchar_t *localeName = nullptr;
-
- if (fWindowsLocaleName != nullptr)
- {
- localeName = reinterpret_cast<const wchar_t*>(toOldUCharPtr(fWindowsLocaleName->getTerminatedBuffer()));
- }
-
+ this->fWindowsLocaleName = other.fWindowsLocaleName == NULL ? NULL : new UnicodeString(*other.fWindowsLocaleName);
+
+ const wchar_t *localeName = nullptr;
+
+ if (fWindowsLocaleName != nullptr)
+ {
+ localeName = reinterpret_cast<const wchar_t*>(toOldUCharPtr(fWindowsLocaleName->getTerminatedBuffer()));
+ }
+
if (fCurrency) {
freeCurrencyFormat(&fFormatInfo->currency);
- getCurrencyFormat(&fFormatInfo->currency, localeName);
+ getCurrencyFormat(&fFormatInfo->currency, localeName);
} else {
freeNumberFormat(&fFormatInfo->number);
- getNumberFormat(&fFormatInfo->number, localeName);
+ getNumberFormat(&fFormatInfo->number, localeName);
}
return *this;
}
-Win32NumberFormat *Win32NumberFormat::clone() const
+Win32NumberFormat *Win32NumberFormat::clone() const
{
return new Win32NumberFormat(*this);
}
-UnicodeString& Win32NumberFormat::format(double number, UnicodeString& appendTo, FieldPosition& /* pos */) const
+UnicodeString& Win32NumberFormat::format(double number, UnicodeString& appendTo, FieldPosition& /* pos */) const
{
return format(getMaximumFractionDigits(), appendTo, L"%.16f", number);
}
-UnicodeString& Win32NumberFormat::format(int32_t number, UnicodeString& appendTo, FieldPosition& /* pos */) const
+UnicodeString& Win32NumberFormat::format(int32_t number, UnicodeString& appendTo, FieldPosition& /* pos */) const
{
return format(getMinimumFractionDigits(), appendTo, L"%I32d", number);
}
-UnicodeString& Win32NumberFormat::format(int64_t number, UnicodeString& appendTo, FieldPosition& /* pos */) const
+UnicodeString& Win32NumberFormat::format(int64_t number, UnicodeString& appendTo, FieldPosition& /* pos */) const
{
return format(getMinimumFractionDigits(), appendTo, L"%I64d", number);
}
@@ -389,13 +389,13 @@ UnicodeString &Win32NumberFormat::format(int32_t numDigits, UnicodeString &appen
formatInfo = *fFormatInfo;
buffer[0] = 0x0000;
- const wchar_t *localeName = nullptr;
-
- if (fWindowsLocaleName != nullptr)
- {
- localeName = reinterpret_cast<const wchar_t*>(toOldUCharPtr(fWindowsLocaleName->getTerminatedBuffer()));
- }
-
+ const wchar_t *localeName = nullptr;
+
+ if (fWindowsLocaleName != nullptr)
+ {
+ localeName = reinterpret_cast<const wchar_t*>(toOldUCharPtr(fWindowsLocaleName->getTerminatedBuffer()));
+ }
+
if (fCurrency) {
if (fFractionDigitsSet) {
formatInfo.currency.NumDigits = (UINT) numDigits;
@@ -405,17 +405,17 @@ UnicodeString &Win32NumberFormat::format(int32_t numDigits, UnicodeString &appen
formatInfo.currency.Grouping = 0;
}
- result = GetCurrencyFormatEx(localeName, 0, nBuffer, &formatInfo.currency, buffer, STACK_BUFFER_SIZE);
+ result = GetCurrencyFormatEx(localeName, 0, nBuffer, &formatInfo.currency, buffer, STACK_BUFFER_SIZE);
if (result == 0) {
DWORD lastError = GetLastError();
if (lastError == ERROR_INSUFFICIENT_BUFFER) {
- int newLength = GetCurrencyFormatEx(localeName, 0, nBuffer, &formatInfo.currency, NULL, 0);
+ int newLength = GetCurrencyFormatEx(localeName, 0, nBuffer, &formatInfo.currency, NULL, 0);
buffer = NEW_ARRAY(wchar_t, newLength);
buffer[0] = 0x0000;
- GetCurrencyFormatEx(localeName, 0, nBuffer, &formatInfo.currency, buffer, newLength);
+ GetCurrencyFormatEx(localeName, 0, nBuffer, &formatInfo.currency, buffer, newLength);
}
}
} else {
@@ -427,15 +427,15 @@ UnicodeString &Win32NumberFormat::format(int32_t numDigits, UnicodeString &appen
formatInfo.number.Grouping = 0;
}
- result = GetNumberFormatEx(localeName, 0, nBuffer, &formatInfo.number, buffer, STACK_BUFFER_SIZE);
+ result = GetNumberFormatEx(localeName, 0, nBuffer, &formatInfo.number, buffer, STACK_BUFFER_SIZE);
if (result == 0) {
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
- int newLength = GetNumberFormatEx(localeName, 0, nBuffer, &formatInfo.number, NULL, 0);
+ int newLength = GetNumberFormatEx(localeName, 0, nBuffer, &formatInfo.number, NULL, 0);
buffer = NEW_ARRAY(wchar_t, newLength);
buffer[0] = 0x0000;
- GetNumberFormatEx(localeName, 0, nBuffer, &formatInfo.number, buffer, newLength);
+ GetNumberFormatEx(localeName, 0, nBuffer, &formatInfo.number, buffer, newLength);
}
}
}
diff --git a/contrib/libs/icu/i18n/winnmfmt.h b/contrib/libs/icu/i18n/winnmfmt.h
index 33ddefc624..99571d2013 100644
--- a/contrib/libs/icu/i18n/winnmfmt.h
+++ b/contrib/libs/icu/i18n/winnmfmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -44,7 +44,7 @@ public:
virtual ~Win32NumberFormat();
- virtual Win32NumberFormat *clone() const;
+ virtual Win32NumberFormat *clone() const;
Win32NumberFormat &operator=(const Win32NumberFormat &other);
@@ -128,7 +128,7 @@ public:
* <pre>
* . Base* polymorphic_pointer = createPolymorphicObject();
* . if (polymorphic_pointer->getDynamicClassID() ==
- * . derived::getStaticClassID()) ...
+ * . derived::getStaticClassID()) ...
* </pre>
* @return The class ID for all objects of this class.
*/
@@ -155,7 +155,7 @@ private:
FormatInfo *fFormatInfo;
UBool fFractionDigitsSet;
- UnicodeString* fWindowsLocaleName; // Stores the equivalent Windows locale name.
+ UnicodeString* fWindowsLocaleName; // Stores the equivalent Windows locale name.
};
U_NAMESPACE_END
diff --git a/contrib/libs/icu/i18n/wintzimpl.cpp b/contrib/libs/icu/i18n/wintzimpl.cpp
index 7449fa6e4c..433ed4c293 100644
--- a/contrib/libs/icu/i18n/wintzimpl.cpp
+++ b/contrib/libs/icu/i18n/wintzimpl.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -13,7 +13,7 @@
#include "unicode/utypes.h"
-#if U_PLATFORM_USES_ONLY_WIN32_API && !UCONFIG_NO_FORMATTING
+#if U_PLATFORM_USES_ONLY_WIN32_API && !UCONFIG_NO_FORMATTING
#include "wintzimpl.h"
@@ -24,9 +24,9 @@
#include "uassert.h"
#include "cmemory.h"
-#ifndef WIN32_LEAN_AND_MEAN
+#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
-#endif
+#endif
# define VC_EXTRALEAN
# define NOUSER
# define NOSERVICE
@@ -65,12 +65,12 @@ static UBool getSystemTimeInformation(TimeZone *tz, SYSTEMTIME &daylightDate, SY
// Always use DOW type rule
int32_t hour, min, sec, mil;
standardDate.wYear = 0;
- standardDate.wMonth = static_cast<WORD>(std->getRule()->getRuleMonth()) + 1;
- standardDate.wDay = static_cast<WORD>(std->getRule()->getRuleWeekInMonth());
+ standardDate.wMonth = static_cast<WORD>(std->getRule()->getRuleMonth()) + 1;
+ standardDate.wDay = static_cast<WORD>(std->getRule()->getRuleWeekInMonth());
if (standardDate.wDay < 0) {
standardDate.wDay = 5;
}
- standardDate.wDayOfWeek = static_cast<WORD>(std->getRule()->getRuleDayOfWeek()) - 1;
+ standardDate.wDayOfWeek = static_cast<WORD>(std->getRule()->getRuleDayOfWeek()) - 1;
mil = std->getRule()->getRuleMillisInDay();
hour = mil/3600000;
@@ -80,18 +80,18 @@ static UBool getSystemTimeInformation(TimeZone *tz, SYSTEMTIME &daylightDate, SY
sec = mil/1000;
mil %= 1000;
- standardDate.wHour = static_cast<WORD>(hour);
- standardDate.wMinute = static_cast<WORD>(min);
- standardDate.wSecond = static_cast<WORD>(sec);
- standardDate.wMilliseconds = static_cast<WORD>(mil);
+ standardDate.wHour = static_cast<WORD>(hour);
+ standardDate.wMinute = static_cast<WORD>(min);
+ standardDate.wSecond = static_cast<WORD>(sec);
+ standardDate.wMilliseconds = static_cast<WORD>(mil);
daylightDate.wYear = 0;
- daylightDate.wMonth = static_cast<WORD>(dst->getRule()->getRuleMonth()) + 1;
- daylightDate.wDay = static_cast<WORD>(dst->getRule()->getRuleWeekInMonth());
+ daylightDate.wMonth = static_cast<WORD>(dst->getRule()->getRuleMonth()) + 1;
+ daylightDate.wDay = static_cast<WORD>(dst->getRule()->getRuleWeekInMonth());
if (daylightDate.wDay < 0) {
daylightDate.wDay = 5;
}
- daylightDate.wDayOfWeek = static_cast<WORD>(dst->getRule()->getRuleDayOfWeek()) - 1;
+ daylightDate.wDayOfWeek = static_cast<WORD>(dst->getRule()->getRuleDayOfWeek()) - 1;
mil = dst->getRule()->getRuleMillisInDay();
hour = mil/3600000;
@@ -101,10 +101,10 @@ static UBool getSystemTimeInformation(TimeZone *tz, SYSTEMTIME &daylightDate, SY
sec = mil/1000;
mil %= 1000;
- daylightDate.wHour = static_cast<WORD>(hour);
- daylightDate.wMinute = static_cast<WORD>(min);
- daylightDate.wSecond = static_cast<WORD>(sec);
- daylightDate.wMilliseconds = static_cast<WORD>(mil);
+ daylightDate.wHour = static_cast<WORD>(hour);
+ daylightDate.wMinute = static_cast<WORD>(min);
+ daylightDate.wSecond = static_cast<WORD>(sec);
+ daylightDate.wMilliseconds = static_cast<WORD>(mil);
}
} else {
result = FALSE;
diff --git a/contrib/libs/icu/i18n/wintzimpl.h b/contrib/libs/icu/i18n/wintzimpl.h
index 9f982ebe4e..772ea95bc5 100644
--- a/contrib/libs/icu/i18n/wintzimpl.h
+++ b/contrib/libs/icu/i18n/wintzimpl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -16,7 +16,7 @@
#include "unicode/utypes.h"
-#if U_PLATFORM_USES_ONLY_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
/**
* \file
* \brief C API: Utilities for dealing w/ Windows time zones.
@@ -34,6 +34,6 @@ U_CAPI UBool U_EXPORT2
uprv_getWindowsTimeZoneInfo(TIME_ZONE_INFORMATION *zoneInfo, const UChar *icuid, int32_t length);
-#endif /* U_PLATFORM_USES_ONLY_WIN32_API */
+#endif /* U_PLATFORM_USES_ONLY_WIN32_API */
#endif /* __WINTZIMPL */
diff --git a/contrib/libs/icu/i18n/zonemeta.cpp b/contrib/libs/icu/i18n/zonemeta.cpp
index b2c6abeff0..72c590f424 100644
--- a/contrib/libs/icu/i18n/zonemeta.cpp
+++ b/contrib/libs/icu/i18n/zonemeta.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -17,7 +17,7 @@
#include "unicode/ustring.h"
#include "unicode/putil.h"
#include "unicode/simpletz.h"
-#include "unicode/strenum.h"
+#include "unicode/strenum.h"
#include "umutex.h"
#include "uvector.h"
#include "cmemory.h"
@@ -28,9 +28,9 @@
#include "uresimp.h"
#include "uhash.h"
#include "olsontz.h"
-#include "uinvchar.h"
+#include "uinvchar.h"
-static icu::UMutex gZoneMetaLock;
+static icu::UMutex gZoneMetaLock;
// CLDR Canonical ID mapping table
static UHashtable *gCanonicalIDCache = NULL;
@@ -256,12 +256,12 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
tzid.extract(utzid, ZID_KEY_MAX + 1, tmpStatus);
U_ASSERT(tmpStatus == U_ZERO_ERROR); // we checked the length of tzid already
- if (!uprv_isInvariantUString(utzid, -1)) {
- // All of known tz IDs are only containing ASCII invariant characters.
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
- }
-
+ if (!uprv_isInvariantUString(utzid, -1)) {
+ // All of known tz IDs are only containing ASCII invariant characters.
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
+ }
+
// Check if it was already cached
umtx_lock(&gZoneMetaLock);
{
@@ -319,10 +319,10 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
id[len] = (char) 0; // Make sure it is null terminated.
// replace '/' with ':'
- char *q = id;
- while (*q++) {
- if (*q == '/') {
- *q = ':';
+ char *q = id;
+ while (*q++) {
+ if (*q == '/') {
+ *q = ':';
}
}
@@ -690,7 +690,7 @@ ZoneMeta::createMetazoneMappings(const UnicodeString &tzid) {
mzMappings = new UVector(deleteOlsonToMetaMappingEntry, NULL, status);
if (U_FAILURE(status)) {
delete mzMappings;
- mzMappings = NULL;
+ mzMappings = NULL;
uprv_free(entry);
break;
}
@@ -784,14 +784,14 @@ static void U_CALLCONV initAvailableMetaZoneIDs () {
UResourceBundle *rb = ures_openDirect(NULL, gMetaZones, &status);
UResourceBundle *bundle = ures_getByKey(rb, gMapTimezonesTag, NULL, &status);
- StackUResourceBundle res;
+ StackUResourceBundle res;
while (U_SUCCESS(status) && ures_hasNext(bundle)) {
- ures_getNextResource(bundle, res.getAlias(), &status);
+ ures_getNextResource(bundle, res.getAlias(), &status);
if (U_FAILURE(status)) {
break;
}
- const char *mzID = ures_getKey(res.getAlias());
- int32_t len = static_cast<int32_t>(uprv_strlen(mzID));
+ const char *mzID = ures_getKey(res.getAlias());
+ int32_t len = static_cast<int32_t>(uprv_strlen(mzID));
UChar *uMzID = (UChar*)uprv_malloc(sizeof(UChar) * (len + 1));
if (uMzID == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
@@ -848,13 +848,13 @@ ZoneMeta::createCustomTimeZone(int32_t offset) {
negative = TRUE;
tmp = -offset;
}
- uint8_t hour, min, sec;
+ uint8_t hour, min, sec;
tmp /= 1000;
- sec = static_cast<uint8_t>(tmp % 60);
+ sec = static_cast<uint8_t>(tmp % 60);
tmp /= 60;
- min = static_cast<uint8_t>(tmp % 60);
- hour = static_cast<uint8_t>(tmp / 60);
+ min = static_cast<uint8_t>(tmp % 60);
+ hour = static_cast<uint8_t>(tmp / 60);
UnicodeString zid;
formatCustomID(hour, min, sec, negative, zid);
diff --git a/contrib/libs/icu/i18n/zonemeta.h b/contrib/libs/icu/i18n/zonemeta.h
index 0c92047918..9dbcc878a2 100644
--- a/contrib/libs/icu/i18n/zonemeta.h
+++ b/contrib/libs/icu/i18n/zonemeta.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -41,11 +41,11 @@ public:
/**
* Return the canonical id for this tzid defined by CLDR, which might be the id itself.
* This overload method returns a persistent const UChar*, which is guranteed to persist
- * (a pointer to a resource). If the given system tzid is not known, U_ILLEGAL_ARGUMENT_ERROR
- * is set in the status.
- * @param tzid Zone ID
- * @param status Receives the status
- * @return The canonical ID for the input time zone ID
+ * (a pointer to a resource). If the given system tzid is not known, U_ILLEGAL_ARGUMENT_ERROR
+ * is set in the status.
+ * @param tzid Zone ID
+ * @param status Receives the status
+ * @return The canonical ID for the input time zone ID
*/
static const UChar* U_EXPORT2 getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status);
diff --git a/contrib/libs/icu/i18n/zrule.cpp b/contrib/libs/icu/i18n/zrule.cpp
index 83bf019923..bdf84965b5 100644
--- a/contrib/libs/icu/i18n/zrule.cpp
+++ b/contrib/libs/icu/i18n/zrule.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/zrule.h b/contrib/libs/icu/i18n/zrule.h
index 04a4ecead9..f395ad4c3f 100644
--- a/contrib/libs/icu/i18n/zrule.h
+++ b/contrib/libs/icu/i18n/zrule.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/ztrans.cpp b/contrib/libs/icu/i18n/ztrans.cpp
index 3e7fe95817..9dbe9bb0b9 100644
--- a/contrib/libs/icu/i18n/ztrans.cpp
+++ b/contrib/libs/icu/i18n/ztrans.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/i18n/ztrans.h b/contrib/libs/icu/i18n/ztrans.h
index 60552df017..b23bb4fc70 100644
--- a/contrib/libs/icu/i18n/ztrans.h
+++ b/contrib/libs/icu/i18n/ztrans.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/icu4c.css b/contrib/libs/icu/icu4c.css
index b73972489c..b7631ff9d9 100644
--- a/contrib/libs/icu/icu4c.css
+++ b/contrib/libs/icu/icu4c.css
@@ -1,515 +1,515 @@
-/*
- * Default CSS style sheet for the ICU4C Open Source readme
- * Copyright (C) 2016 and later: Unicode, Inc. and others.
- * License & terms of use: http://www.unicode.org/copyright.html
- * Copyright (C) 2005-2014, International Business Machines
- * Corporation and others. All Rights Reserved.
- */
-
-/* Global styles */
-
-body,p,li,ol,ul,th,td {
- font-size: 1em;
- font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
-}
-
-body {
- margin: 1em;
-}
-
-body.draft {
- background-image: url(images/draftbg.png);
-}
-
-body .only-milestone,
-body .only-draft,
-body .only-rc {
- display: none;
-}
-
-body.milestone .only-milestone {
- display: inherit !important;
-}
-
-body.draft .only-draft {
- display: inherit !important;
-}
-
-body.rc .only-rc {
- display: inherit !important;
-}
-
-
-.mainbody {
- padding: 1em;
-}
-
-
-h1,h2,h3,h4,h5 {
- font-family: Georgia, "Times New Roman", Times, serif;
-}
-/*
- * Customize the headers to have less space around them than usual
- */
-
-h1 {
- margin-bottom: .5em;
- margin-top: .5em;
- padding-bottom: .5em;
- padding-top: .5em;
- font-weight: 700;
- font-size: 20pt;
- text-align: center;
- font-size: 2em;
- font-weight: bold;
-}
-
-h2 {
- margin-bottom: 0.5em;
- padding-left: 4px;
- margin-top: 12pt;
- font-weight: 700;
- font-size: 2em;
- page-break-before: always;
-}
-
-h2 a {
- text-decoration: none;
- color: black;
-}
-
-h2 a:hover {
- color: blue;
- text-decoration: underline;
-}
-
-h3 {
- margin-bottom: 0pt;
- padding-left: 0;
- margin-left: 1em;
- margin-top: 1em;
- padding-bottom: 0.2em;
- font-size: 1.5em;
-}
-
-h3 a {
- text-decoration: none;
- color: black;
-}
-
-h3 a:hover {
- color: blue;
- text-decoration: underline;
-}
-
-h4 {
- margin-left: 1.5em;
- margin-bottom: 0pt;
- margin-top: 12pt;
- font-size: 1.0em;
- font-weight: bolder;
-}
-
-h4 a {
- text-decoration: none;
- color: black;
-}
-
-h4 a:hover {
- color: blue;
- text-decoration: underline;
-}
-
-h5, h6 {
- margin-left: 1.8em;
- margin-bottom: 0pt;
- margin-top: 12pt;
- padding-left: 0.75em;
- font-size: x-small;
- font-family: Georgia, "Times New Roman", Times, serif;
-}
-
-p,pre,table,ul,ol,dl {
- margin-left: 2em;
-}
-
-p {
- margin-top: 0.5em;
- margin-bottom: 0.5em;
-}
-
-/*
- * Add a little bit of space above li's
- */
-li {
- margin-top: 0.25em;
-}
-
-/*
- * Navigation sidebar on the left hand of most pages
- */
-
-td.sidebar1 {
- background-color: #99CCFF;
- font-weight: 700;
- margin-top: 0px;
- margin-bottom: 0px;
- padding-top: 1em;
- padding-left: 0.2em;
- white-space: nowrap;
-}
-
-td.sidebar2 {
- background-color: #99CCFF;
- margin-top: 0px;
- margin-bottom: 0px;
- margin-left: 0px;
- padding-top: 1px;
- padding-bottom: 1px;
- padding-left: 1px;
- padding-right: 0.5em;
- white-space: nowrap;
- text-decoration: none;
- display: block;
-}
-
-td.sidebar2:hover {
- background-color: #EEEEFF;
- padding-top: 1px;
- padding-bottom: 1px;
- padding-left: 1px;
- padding-right: 0.5em;
-}
-
-a.sidebar2 {
- text-decoration: none;
- display: block;
- width: 100%;
-}
-
-a.sidebar2:link {
- color: #000099;
- display: block;
-}
-
-a.sidebar2:hover {
- background-color: #EEEEFF;
- display: block;
-}
-
-.underlinehover:hover {
- background-color: #EEEEFF;
- text-decoration: underline;
-}
-
-/* This is the faded header at the top */
-
-td.fadedtop {
- background-color: #006699;
- background-image: url(http://www.icu-project.org/images/gr100.gif);
-}
-
-/* Related site on the left */
-
-p.relatedsite {
- color: White;
- font-weight: 700;
- font-size: 10pt;
- margin-top: 1em;
- margin-bottom: 0;
- padding-left: 0.2em;
- white-space: nowrap;
-}
-
-/* Related site on the left */
-
-p.sidebar3 {
- margin-top: 0.75em;
- margin-bottom: 0;
- padding-left: 0.8em;
-}
-
-a.sidebar3 {
- font-size: 0.9em;
- text-decoration: none;
-}
-
-a.sidebar3:link {
- text-decoration: none;
- color: White;
-}
-
-a.sidebar3:hover {
- text-decoration: underline;
-}
-
-/* FAQ */
-
-li.faq_contents {
- font-weight: 500;
-}
-
-p.faq_q {
- font-weight: 700;
- margin-bottom: 0px;
-}
-
-p.faq_a {
- margin-top: 0px;
-}
-
-/* News items */
-
-table.newsItem {
- padding-left: 1em;
- padding-right: 1em;
- border-width: medium;
-}
-
-th.newsItem {
- background-color: #666666;
- color: White;
-}
-
-td.newsItem {
- background-color: #CCCCCC;
-}
-
-td.release-line,th.release-line {
- padding-left: 0.5em;
- padding-right: 0.5em;
- white-space: nowrap;
- border: 1px;
-}
-
-.note {
- font-style: italic;
- font-size: small;
- margin-left: 1em;
-}
-
-
-p.note::before {
- content: 'Note:';
- font-weight: bold;
- margin-right: 1em;
-}
-p.note {
- border: 1px solid gray;
- padding: 0.5em;
- background-color: #fdfdd9;
-}
-
-samp {
- margin-left: 1em;
- margin-right: 2em;
- border-style: groove;
- padding: 1em;
- display: block;
- background-color: #EEEEEE
-}
-
-table.rtable caption {
- margin-left: 2px;
- margin-right: 2px;
- padding: 3px;
- font-weight: bold;
- background-color: #dee2ff;
- text-align: left;
-}
-
-table.rtable tr th {
- background-color: #dee2ff;
- text-align: left;
-}
-
-table.rtable tr td {
- background-color: #c0c0fd;
- padding: 3px;
-}
-
-table.rtable tr.broken td {
- background-color: #fbb;
- border: 1px dashed gray;
- padding: 3px;
- font-weight: bold;
-}
-
-table.rtable tr.rarely td {
- background-color: #efe9c2;
- padding: 3px;
- font-style: italic;
-}
-
-/* APIChangeReport specific things */
-
-.row0 {
- background-color: white;
-}
-
-.row1 {
- background-color: #dfd;
-}
-
-.verchange {
- color: red;
- font-weight: bold;
- font-size: large;
-}
-
-.stabchange {
- color: red;
- font-size: large;
-}
-
-.bigwarn {
- color: red;
- background-color: white;
- font-size: large;
- margin: 0.5 em;
-}
-
-
-td.bornstable {
-
-}
-td.bornstable .bigwarn {
- font-size: small;
- white-space: nowrap;
-}
-
-table.genTable {
- border-collapse: collapse;
- border: 1px solid black;
-}
-
-/* 'everything inc version */
-
-table.gentable td {
- border: 1px solid gray;
- padding: 0.25em;
- font-size: small;
-}
-
-/* not version */
-
-table.genTable td.file,
-table.genTable td.proto {
- border: none;
- font-size: medium;
-}
-
-table.genTable td.file {
- font-family: monospace;
- font-weight: bold;
-}
-
-div.other .row0 {
- background-color: white;
-}
-
-div.other .row1 {
- background-color: #ddf;
-}
-
-table.docTable {
- border-collapse: collapse;
- border: 1px solid black;
-}
-
-/* 'everything inc version */
-
-table.docTable td,
-table.docTable th {
- border: 1px solid gray;
- padding: 0.25em;
- font-size: small;
-}
-
-/* not version */
-
-table.docTable td.file,
-table.docTable td.proto {
- border: none;
- font-size: medium;
-}
-
-table.docTable td.file {
- font-family: monospace;
- font-weight: bold;
-}
-
-abbr {
- border-bottom: 1px dashed #0B0;
-}
-
-h2.TOC {
- page-break-before: auto;
-}
-
-body.readme {
-
-}
-
-caption {
- font-weight: bold;
- text-align: left
-}
-
-div.indent {
- margin-left: 2em
-}
-
-ul.TOC {
- font-size: medium;
-}
-
-ul.TOC,
-ul.TOC li,
-ul.TOC li ul,
-ul.TOC li ul li {
- margin-left: 0.25em;
- margin-top: 0.25em;
-}
-
-ul.TOC li {
- padding-left: 1em;
- margin-left: 0.25em;
-}
-ul.TOC li li {
- padding-left: 1em;
- margin-left: 0.25em;
-}
-
-pre.samp,samp {
- margin-top: 0.5em;
- margin-bottom: 0.5em;
- margin-left: 1em;
- border-style: groove;
- padding: 1em;
- display: block;
- background-color: #f9fbfa;
- font-family: "Source Code Pro", "Everson Mono", "Courier New", Courier, mono;
- border-radius: 12px;
- border-bottom-color: gray;
- border-right-color: gray;
- white-space: pre-wrap;
-}
-
-td.proto {
- font-size: smaller;
-}
-
-.no-left-margin {
- margin-left: 0;
-}
-
-@media print {
- div#toc {
- display: none;
- }
-
- table,tr,td,div {
- page-break-inside: auto;
- }
-}
+/*
+ * Default CSS style sheet for the ICU4C Open Source readme
+ * Copyright (C) 2016 and later: Unicode, Inc. and others.
+ * License & terms of use: http://www.unicode.org/copyright.html
+ * Copyright (C) 2005-2014, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ */
+
+/* Global styles */
+
+body,p,li,ol,ul,th,td {
+ font-size: 1em;
+ font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
+}
+
+body {
+ margin: 1em;
+}
+
+body.draft {
+ background-image: url(images/draftbg.png);
+}
+
+body .only-milestone,
+body .only-draft,
+body .only-rc {
+ display: none;
+}
+
+body.milestone .only-milestone {
+ display: inherit !important;
+}
+
+body.draft .only-draft {
+ display: inherit !important;
+}
+
+body.rc .only-rc {
+ display: inherit !important;
+}
+
+
+.mainbody {
+ padding: 1em;
+}
+
+
+h1,h2,h3,h4,h5 {
+ font-family: Georgia, "Times New Roman", Times, serif;
+}
+/*
+ * Customize the headers to have less space around them than usual
+ */
+
+h1 {
+ margin-bottom: .5em;
+ margin-top: .5em;
+ padding-bottom: .5em;
+ padding-top: .5em;
+ font-weight: 700;
+ font-size: 20pt;
+ text-align: center;
+ font-size: 2em;
+ font-weight: bold;
+}
+
+h2 {
+ margin-bottom: 0.5em;
+ padding-left: 4px;
+ margin-top: 12pt;
+ font-weight: 700;
+ font-size: 2em;
+ page-break-before: always;
+}
+
+h2 a {
+ text-decoration: none;
+ color: black;
+}
+
+h2 a:hover {
+ color: blue;
+ text-decoration: underline;
+}
+
+h3 {
+ margin-bottom: 0pt;
+ padding-left: 0;
+ margin-left: 1em;
+ margin-top: 1em;
+ padding-bottom: 0.2em;
+ font-size: 1.5em;
+}
+
+h3 a {
+ text-decoration: none;
+ color: black;
+}
+
+h3 a:hover {
+ color: blue;
+ text-decoration: underline;
+}
+
+h4 {
+ margin-left: 1.5em;
+ margin-bottom: 0pt;
+ margin-top: 12pt;
+ font-size: 1.0em;
+ font-weight: bolder;
+}
+
+h4 a {
+ text-decoration: none;
+ color: black;
+}
+
+h4 a:hover {
+ color: blue;
+ text-decoration: underline;
+}
+
+h5, h6 {
+ margin-left: 1.8em;
+ margin-bottom: 0pt;
+ margin-top: 12pt;
+ padding-left: 0.75em;
+ font-size: x-small;
+ font-family: Georgia, "Times New Roman", Times, serif;
+}
+
+p,pre,table,ul,ol,dl {
+ margin-left: 2em;
+}
+
+p {
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+}
+
+/*
+ * Add a little bit of space above li's
+ */
+li {
+ margin-top: 0.25em;
+}
+
+/*
+ * Navigation sidebar on the left hand of most pages
+ */
+
+td.sidebar1 {
+ background-color: #99CCFF;
+ font-weight: 700;
+ margin-top: 0px;
+ margin-bottom: 0px;
+ padding-top: 1em;
+ padding-left: 0.2em;
+ white-space: nowrap;
+}
+
+td.sidebar2 {
+ background-color: #99CCFF;
+ margin-top: 0px;
+ margin-bottom: 0px;
+ margin-left: 0px;
+ padding-top: 1px;
+ padding-bottom: 1px;
+ padding-left: 1px;
+ padding-right: 0.5em;
+ white-space: nowrap;
+ text-decoration: none;
+ display: block;
+}
+
+td.sidebar2:hover {
+ background-color: #EEEEFF;
+ padding-top: 1px;
+ padding-bottom: 1px;
+ padding-left: 1px;
+ padding-right: 0.5em;
+}
+
+a.sidebar2 {
+ text-decoration: none;
+ display: block;
+ width: 100%;
+}
+
+a.sidebar2:link {
+ color: #000099;
+ display: block;
+}
+
+a.sidebar2:hover {
+ background-color: #EEEEFF;
+ display: block;
+}
+
+.underlinehover:hover {
+ background-color: #EEEEFF;
+ text-decoration: underline;
+}
+
+/* This is the faded header at the top */
+
+td.fadedtop {
+ background-color: #006699;
+ background-image: url(http://www.icu-project.org/images/gr100.gif);
+}
+
+/* Related site on the left */
+
+p.relatedsite {
+ color: White;
+ font-weight: 700;
+ font-size: 10pt;
+ margin-top: 1em;
+ margin-bottom: 0;
+ padding-left: 0.2em;
+ white-space: nowrap;
+}
+
+/* Related site on the left */
+
+p.sidebar3 {
+ margin-top: 0.75em;
+ margin-bottom: 0;
+ padding-left: 0.8em;
+}
+
+a.sidebar3 {
+ font-size: 0.9em;
+ text-decoration: none;
+}
+
+a.sidebar3:link {
+ text-decoration: none;
+ color: White;
+}
+
+a.sidebar3:hover {
+ text-decoration: underline;
+}
+
+/* FAQ */
+
+li.faq_contents {
+ font-weight: 500;
+}
+
+p.faq_q {
+ font-weight: 700;
+ margin-bottom: 0px;
+}
+
+p.faq_a {
+ margin-top: 0px;
+}
+
+/* News items */
+
+table.newsItem {
+ padding-left: 1em;
+ padding-right: 1em;
+ border-width: medium;
+}
+
+th.newsItem {
+ background-color: #666666;
+ color: White;
+}
+
+td.newsItem {
+ background-color: #CCCCCC;
+}
+
+td.release-line,th.release-line {
+ padding-left: 0.5em;
+ padding-right: 0.5em;
+ white-space: nowrap;
+ border: 1px;
+}
+
+.note {
+ font-style: italic;
+ font-size: small;
+ margin-left: 1em;
+}
+
+
+p.note::before {
+ content: 'Note:';
+ font-weight: bold;
+ margin-right: 1em;
+}
+p.note {
+ border: 1px solid gray;
+ padding: 0.5em;
+ background-color: #fdfdd9;
+}
+
+samp {
+ margin-left: 1em;
+ margin-right: 2em;
+ border-style: groove;
+ padding: 1em;
+ display: block;
+ background-color: #EEEEEE
+}
+
+table.rtable caption {
+ margin-left: 2px;
+ margin-right: 2px;
+ padding: 3px;
+ font-weight: bold;
+ background-color: #dee2ff;
+ text-align: left;
+}
+
+table.rtable tr th {
+ background-color: #dee2ff;
+ text-align: left;
+}
+
+table.rtable tr td {
+ background-color: #c0c0fd;
+ padding: 3px;
+}
+
+table.rtable tr.broken td {
+ background-color: #fbb;
+ border: 1px dashed gray;
+ padding: 3px;
+ font-weight: bold;
+}
+
+table.rtable tr.rarely td {
+ background-color: #efe9c2;
+ padding: 3px;
+ font-style: italic;
+}
+
+/* APIChangeReport specific things */
+
+.row0 {
+ background-color: white;
+}
+
+.row1 {
+ background-color: #dfd;
+}
+
+.verchange {
+ color: red;
+ font-weight: bold;
+ font-size: large;
+}
+
+.stabchange {
+ color: red;
+ font-size: large;
+}
+
+.bigwarn {
+ color: red;
+ background-color: white;
+ font-size: large;
+ margin: 0.5 em;
+}
+
+
+td.bornstable {
+
+}
+td.bornstable .bigwarn {
+ font-size: small;
+ white-space: nowrap;
+}
+
+table.genTable {
+ border-collapse: collapse;
+ border: 1px solid black;
+}
+
+/* 'everything inc version */
+
+table.gentable td {
+ border: 1px solid gray;
+ padding: 0.25em;
+ font-size: small;
+}
+
+/* not version */
+
+table.genTable td.file,
+table.genTable td.proto {
+ border: none;
+ font-size: medium;
+}
+
+table.genTable td.file {
+ font-family: monospace;
+ font-weight: bold;
+}
+
+div.other .row0 {
+ background-color: white;
+}
+
+div.other .row1 {
+ background-color: #ddf;
+}
+
+table.docTable {
+ border-collapse: collapse;
+ border: 1px solid black;
+}
+
+/* 'everything inc version */
+
+table.docTable td,
+table.docTable th {
+ border: 1px solid gray;
+ padding: 0.25em;
+ font-size: small;
+}
+
+/* not version */
+
+table.docTable td.file,
+table.docTable td.proto {
+ border: none;
+ font-size: medium;
+}
+
+table.docTable td.file {
+ font-family: monospace;
+ font-weight: bold;
+}
+
+abbr {
+ border-bottom: 1px dashed #0B0;
+}
+
+h2.TOC {
+ page-break-before: auto;
+}
+
+body.readme {
+
+}
+
+caption {
+ font-weight: bold;
+ text-align: left
+}
+
+div.indent {
+ margin-left: 2em
+}
+
+ul.TOC {
+ font-size: medium;
+}
+
+ul.TOC,
+ul.TOC li,
+ul.TOC li ul,
+ul.TOC li ul li {
+ margin-left: 0.25em;
+ margin-top: 0.25em;
+}
+
+ul.TOC li {
+ padding-left: 1em;
+ margin-left: 0.25em;
+}
+ul.TOC li li {
+ padding-left: 1em;
+ margin-left: 0.25em;
+}
+
+pre.samp,samp {
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ margin-left: 1em;
+ border-style: groove;
+ padding: 1em;
+ display: block;
+ background-color: #f9fbfa;
+ font-family: "Source Code Pro", "Everson Mono", "Courier New", Courier, mono;
+ border-radius: 12px;
+ border-bottom-color: gray;
+ border-right-color: gray;
+ white-space: pre-wrap;
+}
+
+td.proto {
+ font-size: smaller;
+}
+
+.no-left-margin {
+ margin-left: 0;
+}
+
+@media print {
+ div#toc {
+ display: none;
+ }
+
+ table,tr,td,div {
+ page-break-inside: auto;
+ }
+}
diff --git a/contrib/libs/icu/include/unicode/alphaindex.h b/contrib/libs/icu/include/unicode/alphaindex.h
index c423448d26..e3c68ea7cc 100644
--- a/contrib/libs/icu/include/unicode/alphaindex.h
+++ b/contrib/libs/icu/include/unicode/alphaindex.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -13,12 +13,12 @@
#define INDEXCHARS_H
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
#include "unicode/locid.h"
-#include "unicode/unistr.h"
+#include "unicode/unistr.h"
#if !UCONFIG_NO_COLLATION
@@ -269,8 +269,8 @@ public:
* Use getBucket() to get the bucket's properties.
*
* @param name the string to be sorted into an index bucket
- * @param errorCode Error code, will be set with the reason if the
- * operation fails.
+ * @param errorCode Error code, will be set with the reason if the
+ * operation fails.
* @return the bucket number for the name
* @stable ICU 51
*/
@@ -382,11 +382,11 @@ public:
/**
- * Get the default label used for abbreviated buckets *between* other index characters.
- * For example, consider the labels when Latin (X Y Z) and Greek (Α Β Γ) are used:
+ * Get the default label used for abbreviated buckets *between* other index characters.
+ * For example, consider the labels when Latin (X Y Z) and Greek (Α Β Γ) are used:
+ *
+ * X Y Z ... Α Β Γ.
*
- * X Y Z ... Α Β Γ.
- *
* @return inflow label
* @stable ICU 4.8
*/
@@ -654,7 +654,7 @@ private:
/**
* No assignment.
*/
- AlphabeticIndex &operator =(const AlphabeticIndex & /*other*/) { return *this;}
+ AlphabeticIndex &operator =(const AlphabeticIndex & /*other*/) { return *this;}
/**
* No Equality operators.
@@ -706,7 +706,7 @@ public:
/**
* A (name, data) pair, to be sorted by name into one of the index buckets.
* The user data is not used by the index implementation.
- * \cond
+ * \cond
* @internal
*/
struct Record: public UMemory {
@@ -715,7 +715,7 @@ public:
Record(const UnicodeString &name, const void *data);
~Record();
};
- /** \endcond */
+ /** \endcond */
#endif /* U_HIDE_INTERNAL_API */
private:
@@ -760,7 +760,7 @@ private:
U_NAMESPACE_END
#endif // !UCONFIG_NO_COLLATION
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/appendable.h b/contrib/libs/icu/include/unicode/appendable.h
index ad9322c823..4beacaf658 100644
--- a/contrib/libs/icu/include/unicode/appendable.h
+++ b/contrib/libs/icu/include/unicode/appendable.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: appendable.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -19,13 +19,13 @@
/**
* \file
- * \brief C++ API: Appendable class: Sink for Unicode code points and 16-bit code units (char16_ts).
+ * \brief C++ API: Appendable class: Sink for Unicode code points and 16-bit code units (char16_ts).
*/
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
U_NAMESPACE_BEGIN
@@ -37,10 +37,10 @@ class UnicodeString;
* Combines elements of Java Appendable and ICU4C ByteSink.
*
* This class can be used in APIs where it does not matter whether the actual destination is
- * a UnicodeString, a char16_t[] array, a UnicodeSet, or any other object
+ * a UnicodeString, a char16_t[] array, a UnicodeSet, or any other object
* that receives and processes characters and/or strings.
*
- * Implementation classes must implement at least appendCodeUnit(char16_t).
+ * Implementation classes must implement at least appendCodeUnit(char16_t).
* The base class provides default implementations for the other methods.
*
* The methods do not take UErrorCode parameters.
@@ -65,11 +65,11 @@ public:
* @return TRUE if the operation succeeded
* @stable ICU 4.8
*/
- virtual UBool appendCodeUnit(char16_t c) = 0;
+ virtual UBool appendCodeUnit(char16_t c) = 0;
/**
* Appends a code point.
- * The default implementation calls appendCodeUnit(char16_t) once or twice.
+ * The default implementation calls appendCodeUnit(char16_t) once or twice.
* @param c code point 0..0x10ffff
* @return TRUE if the operation succeeded
* @stable ICU 4.8
@@ -78,20 +78,20 @@ public:
/**
* Appends a string.
- * The default implementation calls appendCodeUnit(char16_t) for each code unit.
+ * 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
* @stable ICU 4.8
*/
- virtual UBool appendString(const char16_t *s, int32_t length);
+ virtual UBool appendString(const char16_t *s, int32_t length);
/**
* Tells the object that the caller is going to append roughly
- * appendCapacity char16_ts. A subclass might use this to pre-allocate
+ * 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.)
- * @param appendCapacity estimated number of char16_ts that will be appended
+ * @param appendCapacity estimated number of char16_ts that will be appended
* @return TRUE if the operation succeeded
* @stable ICU 4.8
*/
@@ -105,19 +105,19 @@ public:
* The returned buffer is only valid until the next operation
* on this Appendable.
*
- * After writing at most *resultCapacity char16_ts, call appendString() with the
- * pointer returned from this function and the number of char16_ts written.
- * Many appendString() implementations will avoid copying char16_ts if this function
+ * After writing at most *resultCapacity char16_ts, call appendString() with the
+ * pointer returned from this function and the number of char16_ts written.
+ * Many appendString() implementations will avoid copying char16_ts if this function
* returned an internal buffer.
*
* Partial usage example:
* \code
* int32_t capacity;
- * char16_t* buffer = app.getAppendBuffer(..., &capacity);
- * ... Write n char16_ts into buffer, with n <= capacity.
+ * char16_t* buffer = app.getAppendBuffer(..., &capacity);
+ * ... Write n char16_ts into buffer, with n <= capacity.
* app.appendString(buffer, n);
* \endcode
- * In many implementations, that call to append will avoid copying char16_ts.
+ * In many implementations, that call to append will avoid copying char16_ts.
*
* If the Appendable allocates or reallocates an internal buffer, it should use
* the desiredCapacityHint if appropriate.
@@ -141,9 +141,9 @@ public:
* @return a buffer with *resultCapacity>=minCapacity
* @stable ICU 4.8
*/
- virtual char16_t *getAppendBuffer(int32_t minCapacity,
+ virtual char16_t *getAppendBuffer(int32_t minCapacity,
int32_t desiredCapacityHint,
- char16_t *scratch, int32_t scratchCapacity,
+ char16_t *scratch, int32_t scratchCapacity,
int32_t *resultCapacity);
};
@@ -174,7 +174,7 @@ public:
* @return TRUE if the operation succeeded
* @stable ICU 4.8
*/
- virtual UBool appendCodeUnit(char16_t c);
+ virtual UBool appendCodeUnit(char16_t c);
/**
* Appends a code point to the string.
@@ -191,12 +191,12 @@ public:
* @return TRUE if the operation succeeded
* @stable ICU 4.8
*/
- virtual UBool appendString(const char16_t *s, int32_t length);
+ virtual UBool appendString(const char16_t *s, int32_t length);
/**
* 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
+ * appendCapacity char16_ts.
+ * @param appendCapacity estimated number of char16_ts that will be appended
* @return TRUE if the operation succeeded
* @stable ICU 4.8
*/
@@ -223,9 +223,9 @@ public:
* @return a buffer with *resultCapacity>=minCapacity
* @stable ICU 4.8
*/
- virtual char16_t *getAppendBuffer(int32_t minCapacity,
+ virtual char16_t *getAppendBuffer(int32_t minCapacity,
int32_t desiredCapacityHint,
- char16_t *scratch, int32_t scratchCapacity,
+ char16_t *scratch, int32_t scratchCapacity,
int32_t *resultCapacity);
private:
@@ -234,6 +234,6 @@ private:
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __APPENDABLE_H__
diff --git a/contrib/libs/icu/include/unicode/basictz.h b/contrib/libs/icu/include/unicode/basictz.h
index 1da4b88af2..fc2cb8e59f 100644
--- a/contrib/libs/icu/include/unicode/basictz.h
+++ b/contrib/libs/icu/include/unicode/basictz.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -16,8 +16,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
#include "unicode/timezone.h"
@@ -44,14 +44,14 @@ public:
virtual ~BasicTimeZone();
/**
- * Clones this object polymorphically.
- * The caller owns the result and should delete it when done.
- * @return clone, or nullptr if an error occurred
- * @stable ICU 3.8
- */
- virtual BasicTimeZone* clone() const = 0;
-
- /**
+ * Clones this object polymorphically.
+ * The caller owns the result and should delete it when done.
+ * @return clone, or nullptr if an error occurred
+ * @stable ICU 3.8
+ */
+ virtual BasicTimeZone* clone() const = 0;
+
+ /**
* Gets the first time zone transition after the base time.
* @param base The base time.
* @param inclusive Whether the base time is inclusive or not.
@@ -207,12 +207,12 @@ protected:
BasicTimeZone(const BasicTimeZone& source);
/**
- * Copy assignment.
- * @stable ICU 3.8
- */
- BasicTimeZone& operator=(const BasicTimeZone&) = default;
-
- /**
+ * Copy assignment.
+ * @stable ICU 3.8
+ */
+ BasicTimeZone& operator=(const BasicTimeZone&) = default;
+
+ /**
* Gets the set of TimeZoneRule instances applicable to the specified time and after.
* @param start The start date used for extracting time zone rules
* @param initial Receives the InitialTimeZone, always not NULL
@@ -227,8 +227,8 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // BASICTZ_H
//eof
diff --git a/contrib/libs/icu/include/unicode/brkiter.h b/contrib/libs/icu/include/unicode/brkiter.h
index 9ad42373e6..b944497345 100644
--- a/contrib/libs/icu/include/unicode/brkiter.h
+++ b/contrib/libs/icu/include/unicode/brkiter.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -29,10 +29,10 @@
* \brief C++ API: Break Iterator.
*/
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#if UCONFIG_NO_BREAK_ITERATION
U_NAMESPACE_BEGIN
@@ -139,7 +139,7 @@ public:
* method which subclasses implement.
* @stable ICU 2.0
*/
- virtual BreakIterator* clone() const = 0;
+ virtual BreakIterator* clone() const = 0;
/**
* Return a polymorphic class ID for this object. Different subclasses
@@ -254,7 +254,7 @@ public:
virtual int32_t next(void) = 0;
/**
- * Return character index of the current iterator position within the text.
+ * Return character index of the current iterator position within the text.
* @return The boundary most recently returned.
* @stable ICU 2.0
*/
@@ -281,7 +281,7 @@ public:
virtual int32_t preceding(int32_t offset) = 0;
/**
- * Return true if the specified position is a boundary position.
+ * Return true if the specified position is a boundary position.
* As a side effect, the current position of the iterator is set
* to the first boundary position at or following the specified offset.
* @param offset the offset to check.
@@ -296,20 +296,20 @@ public:
* does nothing. Negative values move to previous boundaries
* and positive values move to later boundaries.
* @return The new iterator position, or
- * DONE if there are fewer than |n| boundaries in the specified direction.
+ * DONE if there are fewer than |n| boundaries in the specified direction.
* @stable ICU 2.0
*/
virtual int32_t next(int32_t n) = 0;
/**
- * For RuleBasedBreakIterators, return the status tag from the break rule
- * that determined the boundary at the current iteration position.
+ * For RuleBasedBreakIterators, return the status tag from the break rule
+ * that determined the boundary at the current iteration position.
* <p>
* For break iterator types that do not support a rule status,
* a default value of 0 is returned.
* <p>
- * @return the status from the break rule that determined the boundary at
- * the current iteration position.
+ * @return the status from the break rule that determined the boundary at
+ * the current iteration position.
* @see RuleBaseBreakIterator::getRuleStatus()
* @see UWordBreak
* @stable ICU 52
@@ -318,7 +318,7 @@ public:
/**
* For RuleBasedBreakIterators, get the status (tag) values from the break rule(s)
- * that determined the boundary at the current iteration position.
+ * that determined the boundary at the current iteration position.
* <p>
* For break iterator types that do not support rule status,
* no values are returned.
@@ -334,10 +334,10 @@ public:
* @param fillInVec an array to be filled in with the status values.
* @param capacity the length of the supplied vector. A length of zero causes
* the function to return the number of status values, in the
- * normal way, without attempting to store any values.
+ * normal way, without attempting to store any values.
* @param status receives error codes.
* @return The number of rule status values from rules that determined
- * the boundary at the current iteration position.
+ * the boundary at the current iteration position.
* In the event of a U_BUFFER_OVERFLOW_ERROR, the return value
* is the total number of status values that were available,
* not the reduced number that were actually returned.
@@ -435,13 +435,13 @@ public:
static BreakIterator* U_EXPORT2
createSentenceInstance(const Locale& where, UErrorCode& status);
-#ifndef U_HIDE_DEPRECATED_API
+#ifndef U_HIDE_DEPRECATED_API
/**
* Create BreakIterator for title-casing breaks using the specified locale
* Returns an instance of a BreakIterator implementing title breaks.
* The iterator returned locates title boundaries as described for
* Unicode 3.2 only. For Unicode 4.0 and above title boundary iteration,
- * please use a word boundary iterator. See {@link #createWordInstance }.
+ * please use a word boundary iterator. See {@link #createWordInstance }.
*
* @param where the locale.
* @param status The error code.
@@ -456,11 +456,11 @@ public:
* used; neither the requested locale nor any of its fall back locales
* could be found.
* The caller owns the returned object and is responsible for deleting it.
- * @deprecated ICU 64 Use createWordInstance instead.
+ * @deprecated ICU 64 Use createWordInstance instead.
*/
static BreakIterator* U_EXPORT2
createTitleInstance(const Locale& where, UErrorCode& status);
-#endif /* U_HIDE_DEPRECATED_API */
+#endif /* U_HIDE_DEPRECATED_API */
/**
* Get the set of Locales for which TextBoundaries are installed.
@@ -474,7 +474,7 @@ public:
static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
/**
- * Get name of the object for the desired Locale, in the desired language.
+ * Get name of the object for the desired Locale, in the desired language.
* @param objectLocale must be from getAvailableLocales.
* @param displayLocale specifies the desired locale for output.
* @param name the fill-in parameter of the return value
@@ -487,7 +487,7 @@ public:
UnicodeString& name);
/**
- * Get name of the object for the desired Locale, in the language of the
+ * Get name of the object for the desired Locale, in the language of the
* default locale.
* @param objectLocale must be from getMatchingLocales
* @param name the fill-in parameter of the return value
@@ -497,7 +497,7 @@ public:
static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale,
UnicodeString& name);
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Deprecated functionality. Use clone() instead.
*
@@ -520,7 +520,7 @@ public:
virtual BreakIterator * createBufferClone(void *stackBuffer,
int32_t &BufferSize,
UErrorCode &status) = 0;
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
#ifndef U_HIDE_DEPRECATED_API
@@ -623,7 +623,7 @@ public:
virtual BreakIterator &refreshInputText(UText *input, UErrorCode &status) = 0;
private:
- static BreakIterator* buildInstance(const Locale& loc, const char *type, UErrorCode& status);
+ static BreakIterator* buildInstance(const Locale& loc, const char *type, UErrorCode& status);
static BreakIterator* createInstance(const Locale& loc, int32_t kind, UErrorCode& status);
static BreakIterator* makeInstance(const Locale& loc, int32_t kind, UErrorCode& status);
@@ -636,17 +636,17 @@ protected:
/** @internal */
BreakIterator();
/** @internal */
- BreakIterator (const BreakIterator &other);
+ BreakIterator (const BreakIterator &other);
#ifndef U_HIDE_INTERNAL_API
/** @internal */
- BreakIterator (const Locale& valid, const Locale &actual);
- /** @internal. Assignment Operator, used by RuleBasedBreakIterator. */
- BreakIterator &operator = (const BreakIterator &other);
+ BreakIterator (const Locale& valid, const Locale &actual);
+ /** @internal. Assignment Operator, used by RuleBasedBreakIterator. */
+ BreakIterator &operator = (const BreakIterator &other);
#endif /* U_HIDE_INTERNAL_API */
private:
- /** @internal (private) */
+ /** @internal (private) */
char actualLocale[ULOC_FULLNAME_CAPACITY];
char validLocale[ULOC_FULLNAME_CAPACITY];
};
@@ -664,7 +664,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
-#endif // BRKITER_H
+#endif /* U_SHOW_CPLUSPLUS_API */
+
+#endif // BRKITER_H
//eof
diff --git a/contrib/libs/icu/include/unicode/bytestream.h b/contrib/libs/icu/include/unicode/bytestream.h
index d9101cda7c..7fe2406222 100644
--- a/contrib/libs/icu/include/unicode/bytestream.h
+++ b/contrib/libs/icu/include/unicode/bytestream.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
// Copyright (C) 2009-2012, International Business Machines
// Corporation and others. All Rights Reserved.
@@ -38,9 +38,9 @@
*/
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
#include "unicode/std_string.h"
@@ -71,41 +71,41 @@ public:
*/
virtual void Append(const char* bytes, int32_t n) = 0;
-#ifndef U_HIDE_DRAFT_API
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Appends n bytes to this. Same as Append().
+ * Call AppendU8() with u8"string literals" which are const char * in C++11
+ * but const char8_t * in C++20.
+ * If the compiler does support char8_t as a distinct type,
+ * then an AppendU8() overload for that is defined and will be chosen.
+ *
+ * @param bytes the pointer to the bytes
+ * @param n the number of bytes; must be non-negative
+ * @draft ICU 67
+ */
+ inline void AppendU8(const char* bytes, int32_t n) {
+ Append(bytes, n);
+ }
+
+#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN)
+ /**
+ * Appends n bytes to this. Same as Append() but for a const char8_t * pointer.
+ * Call AppendU8() with u8"string literals" which are const char * in C++11
+ * but const char8_t * in C++20.
+ * If the compiler does support char8_t as a distinct type,
+ * then this AppendU8() overload for that is defined and will be chosen.
+ *
+ * @param bytes the pointer to the bytes
+ * @param n the number of bytes; must be non-negative
+ * @draft ICU 67
+ */
+ inline void AppendU8(const char8_t* bytes, int32_t n) {
+ Append(reinterpret_cast<const char*>(bytes), n);
+ }
+#endif
+#endif // U_HIDE_DRAFT_API
+
/**
- * Appends n bytes to this. Same as Append().
- * Call AppendU8() with u8"string literals" which are const char * in C++11
- * but const char8_t * in C++20.
- * If the compiler does support char8_t as a distinct type,
- * then an AppendU8() overload for that is defined and will be chosen.
- *
- * @param bytes the pointer to the bytes
- * @param n the number of bytes; must be non-negative
- * @draft ICU 67
- */
- inline void AppendU8(const char* bytes, int32_t n) {
- Append(bytes, n);
- }
-
-#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN)
- /**
- * Appends n bytes to this. Same as Append() but for a const char8_t * pointer.
- * Call AppendU8() with u8"string literals" which are const char * in C++11
- * but const char8_t * in C++20.
- * If the compiler does support char8_t as a distinct type,
- * then this AppendU8() overload for that is defined and will be chosen.
- *
- * @param bytes the pointer to the bytes
- * @param n the number of bytes; must be non-negative
- * @draft ICU 67
- */
- inline void AppendU8(const char8_t* bytes, int32_t n) {
- Append(reinterpret_cast<const char*>(bytes), n);
- }
-#endif
-#endif // U_HIDE_DRAFT_API
-
- /**
* Returns a writable buffer for appending and writes the buffer's capacity to
* *result_capacity. Guarantees *result_capacity>=min_capacity.
* May return a pointer to the caller-owned scratch buffer which must have
@@ -163,8 +163,8 @@ public:
virtual void Flush();
private:
- ByteSink(const ByteSink &) = delete;
- ByteSink &operator=(const ByteSink &) = delete;
+ ByteSink(const ByteSink &) = delete;
+ ByteSink &operator=(const ByteSink &) = delete;
};
// -------------------------------------------------------------
@@ -254,10 +254,10 @@ private:
int32_t size_;
int32_t appended_;
UBool overflowed_;
-
- CheckedArrayByteSink() = delete;
- CheckedArrayByteSink(const CheckedArrayByteSink &) = delete;
- CheckedArrayByteSink &operator=(const CheckedArrayByteSink &) = delete;
+
+ CheckedArrayByteSink() = delete;
+ CheckedArrayByteSink(const CheckedArrayByteSink &) = delete;
+ CheckedArrayByteSink &operator=(const CheckedArrayByteSink &) = delete;
};
/**
@@ -275,19 +275,19 @@ class StringByteSink : public ByteSink {
*/
StringByteSink(StringClass* dest) : dest_(dest) { }
/**
- * Constructs a ByteSink that reserves append capacity and will append bytes to the dest string.
- *
- * @param dest pointer to string object to append to
- * @param initialAppendCapacity capacity beyond dest->length() to be reserve()d
- * @stable ICU 60
- */
- StringByteSink(StringClass* dest, int32_t initialAppendCapacity) : dest_(dest) {
- if (initialAppendCapacity > 0 &&
- (uint32_t)initialAppendCapacity > (dest->capacity() - dest->length())) {
- dest->reserve(dest->length() + initialAppendCapacity);
- }
- }
- /**
+ * Constructs a ByteSink that reserves append capacity and will append bytes to the dest string.
+ *
+ * @param dest pointer to string object to append to
+ * @param initialAppendCapacity capacity beyond dest->length() to be reserve()d
+ * @stable ICU 60
+ */
+ StringByteSink(StringClass* dest, int32_t initialAppendCapacity) : dest_(dest) {
+ if (initialAppendCapacity > 0 &&
+ (uint32_t)initialAppendCapacity > (dest->capacity() - dest->length())) {
+ dest->reserve(dest->length() + initialAppendCapacity);
+ }
+ }
+ /**
* Append "bytes[0,n-1]" to this.
* @param data the pointer to the bytes
* @param n the number of bytes; must be non-negative
@@ -296,14 +296,14 @@ class StringByteSink : public ByteSink {
virtual void Append(const char* data, int32_t n) { dest_->append(data, n); }
private:
StringClass* dest_;
-
- StringByteSink() = delete;
- StringByteSink(const StringByteSink &) = delete;
- StringByteSink &operator=(const StringByteSink &) = delete;
+
+ StringByteSink() = delete;
+ StringByteSink(const StringByteSink &) = delete;
+ StringByteSink &operator=(const StringByteSink &) = delete;
};
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __BYTESTREAM_H__
diff --git a/contrib/libs/icu/include/unicode/bytestrie.h b/contrib/libs/icu/include/unicode/bytestrie.h
index d6550af23d..51405f64a1 100644
--- a/contrib/libs/icu/include/unicode/bytestrie.h
+++ b/contrib/libs/icu/include/unicode/bytestrie.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: bytestrie.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -23,9 +23,9 @@
*/
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/stringpiece.h"
#include "unicode/uobject.h"
#include "unicode/ustringtrie.h"
@@ -97,42 +97,42 @@ public:
return *this;
}
-#ifndef U_HIDE_DRAFT_API
+#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
+ */
+ uint64_t getState64() const {
+ return (static_cast<uint64_t>(remainingMatchLength_ + 2) << kState64RemainingShift) |
+ (uint64_t)(pos_ - bytes_);
+ }
+
+ /**
+ * Resets this trie to the saved state.
+ * Unlike resetToState(State), the 64-bit state value
+ * must be from getState64() from the same trie object or
+ * from one initialized the exact same way.
+ * Because of no validation, this method is faster.
+ *
+ * @param state The opaque trie state value from getState64().
+ * @return *this
+ * @see getState64
+ * @see resetToState
+ * @see reset
+ * @draft 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 */
+
/**
- * 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
- */
- uint64_t getState64() const {
- return (static_cast<uint64_t>(remainingMatchLength_ + 2) << kState64RemainingShift) |
- (uint64_t)(pos_ - bytes_);
- }
-
- /**
- * Resets this trie to the saved state.
- * Unlike resetToState(State), the 64-bit state value
- * must be from getState64() from the same trie object or
- * from one initialized the exact same way.
- * Because of no validation, this method is faster.
- *
- * @param state The opaque trie state value from getState64().
- * @return *this
- * @see getState64
- * @see resetToState
- * @see reset
- * @draft 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
* and resetting the trie back to this state later.
* @stable ICU 4.8
@@ -540,13 +540,13 @@ private:
static const int32_t kMaxTwoByteDelta=((kMinThreeByteDeltaLead-kMinTwoByteDeltaLead)<<8)-1; // 0x2fff
static const int32_t kMaxThreeByteDelta=((kFourByteDeltaLead-kMinThreeByteDeltaLead)<<16)-1; // 0xdffff
- // For getState64():
- // The remainingMatchLength_ is -1..14=(kMaxLinearMatchLength=0x10)-2
- // so we need at least 5 bits for that.
- // We add 2 to store it as a positive value 1..16=kMaxLinearMatchLength.
- static constexpr int32_t kState64RemainingShift = 59;
- static constexpr uint64_t kState64PosMask = (UINT64_C(1) << kState64RemainingShift) - 1;
-
+ // For getState64():
+ // The remainingMatchLength_ is -1..14=(kMaxLinearMatchLength=0x10)-2
+ // so we need at least 5 bits for that.
+ // We add 2 to store it as a positive value 1..16=kMaxLinearMatchLength.
+ static constexpr int32_t kState64RemainingShift = 59;
+ static constexpr uint64_t kState64PosMask = (UINT64_C(1) << kState64RemainingShift) - 1;
+
uint8_t *ownedArray_;
// Fixed value referencing the BytesTrie bytes.
@@ -562,6 +562,6 @@ private:
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __BYTESTRIE_H__
diff --git a/contrib/libs/icu/include/unicode/bytestriebuilder.h b/contrib/libs/icu/include/unicode/bytestriebuilder.h
index d0887d9937..b98374bb8f 100644
--- a/contrib/libs/icu/include/unicode/bytestriebuilder.h
+++ b/contrib/libs/icu/include/unicode/bytestriebuilder.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: bytestriebuilder.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -23,9 +23,9 @@
#define __BYTESTRIEBUILDER_H__
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/bytestrie.h"
#include "unicode/stringpiece.h"
#include "unicode/stringtriebuilder.h"
@@ -130,14 +130,14 @@ private:
void buildBytes(UStringTrieBuildOption buildOption, UErrorCode &errorCode);
virtual int32_t getElementStringLength(int32_t i) const;
- virtual char16_t getElementUnit(int32_t i, int32_t byteIndex) const;
+ virtual char16_t getElementUnit(int32_t i, int32_t byteIndex) const;
virtual int32_t getElementValue(int32_t i) const;
virtual int32_t getLimitOfLinearMatch(int32_t first, int32_t last, int32_t byteIndex) const;
virtual int32_t countElementUnits(int32_t start, int32_t limit, int32_t byteIndex) const;
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 int32_t indexOfElementWithNextUnit(int32_t i, int32_t byteIndex, char16_t byte) const;
virtual UBool matchNodesCanHaveValues() const { return FALSE; }
@@ -146,7 +146,7 @@ private:
virtual int32_t getMaxLinearMatchLength() const { return BytesTrie::kMaxLinearMatchLength; }
/**
- * @internal (private)
+ * @internal (private)
*/
class BTLinearMatchNode : public LinearMatchNode {
public:
@@ -182,6 +182,6 @@ private:
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __BYTESTRIEBUILDER_H__
diff --git a/contrib/libs/icu/include/unicode/calendar.h b/contrib/libs/icu/include/unicode/calendar.h
index 91d1e06899..2a8c2935ca 100644
--- a/contrib/libs/icu/include/unicode/calendar.h
+++ b/contrib/libs/icu/include/unicode/calendar.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -29,10 +29,10 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
- * \file
+ * \file
* \brief C++ API: Calendar object
*/
#if !UCONFIG_NO_FORMATTING
@@ -54,64 +54,64 @@ typedef int32_t UFieldResolutionTable[12][8];
class BasicTimeZone;
/**
- * `Calendar` is an abstract base class for converting between
- * a `UDate` object and a set of integer fields such as
- * `YEAR`, `MONTH`, `DAY`, `HOUR`, and so on.
- * (A `UDate` object represents a specific instant in
+ * `Calendar` is an abstract base class for converting between
+ * a `UDate` object and a set of integer fields such as
+ * `YEAR`, `MONTH`, `DAY`, `HOUR`, and so on.
+ * (A `UDate` object represents a specific instant in
* time with millisecond precision. See UDate
- * for information about the `UDate` class.)
+ * for information about the `UDate` class.)
*
- * Subclasses of `Calendar` interpret a `UDate`
+ * Subclasses of `Calendar` interpret a `UDate`
* according to the rules of a specific calendar system.
- * The most commonly used subclass of `Calendar` is
- * `GregorianCalendar`. Other subclasses could represent
+ * The most commonly used subclass of `Calendar` is
+ * `GregorianCalendar`. Other subclasses could represent
* the various types of lunar calendars in use in many parts of the world.
*
- * **NOTE**: (ICU 2.6) The subclass interface should be considered unstable -
- * it WILL change.
+ * **NOTE**: (ICU 2.6) The subclass interface should be considered unstable -
+ * it WILL change.
*
- * Like other locale-sensitive classes, `Calendar` provides a
- * static method, `createInstance`, for getting a generally useful
- * object of this type. `Calendar`'s `createInstance` method
- * returns the appropriate `Calendar` subclass whose
+ * Like other locale-sensitive classes, `Calendar` provides a
+ * static method, `createInstance`, for getting a generally useful
+ * object of this type. `Calendar`'s `createInstance` method
+ * returns the appropriate `Calendar` subclass whose
* time fields have been initialized with the current date and time:
*
- * Calendar *rightNow = Calendar::createInstance(errCode);
- *
- * A `Calendar` object can produce all the time field values
+ * Calendar *rightNow = Calendar::createInstance(errCode);
+ *
+ * A `Calendar` object can produce all the time field values
* needed to implement the date-time formatting for a particular language
* and calendar style (for example, Japanese-Gregorian, Japanese-Traditional).
*
- * When computing a `UDate` from time fields, some special circumstances
+ * When computing a `UDate` from time fields, some special circumstances
* may arise: there may be insufficient information to compute the
- * `UDate` (such as only year and month but no day in the month),
+ * `UDate` (such as only year and month but no day in the month),
* there may be inconsistent information (such as "Tuesday, July 15, 1996"
* -- July 15, 1996 is actually a Monday), or the input time might be ambiguous
* because of time zone transition.
*
- * **Insufficient information.** The calendar will use default
+ * **Insufficient information.** The calendar will use default
* information to specify the missing fields. This may vary by calendar; for
* the Gregorian calendar, the default for a field is the same as that of the
* start of the epoch: i.e., YEAR = 1970, MONTH = JANUARY, DATE = 1, etc.
*
- * **Inconsistent information.** If fields conflict, the calendar
+ * **Inconsistent information.** If fields conflict, the calendar
* will give preference to fields set more recently. For example, when
* determining the day, the calendar will look for one of the following
* combinations of fields. The most recent combination, as determined by the
* most recently set single field, will be used.
*
- * MONTH + DAY_OF_MONTH
- * MONTH + WEEK_OF_MONTH + DAY_OF_WEEK
- * MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK
- * DAY_OF_YEAR
- * DAY_OF_WEEK + WEEK_OF_YEAR
+ * MONTH + DAY_OF_MONTH
+ * MONTH + WEEK_OF_MONTH + DAY_OF_WEEK
+ * MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK
+ * DAY_OF_YEAR
+ * DAY_OF_WEEK + WEEK_OF_YEAR
*
* For the time of day:
*
- * HOUR_OF_DAY
- * AM_PM + HOUR
+ * HOUR_OF_DAY
+ * AM_PM + HOUR
*
- * **Ambiguous Wall Clock Time.** When time offset from UTC has
+ * **Ambiguous Wall Clock Time.** When time offset from UTC has
* changed, it produces an ambiguous time slot around the transition. For example,
* many US locations observe daylight saving time. On the date switching to daylight
* saving time in US, wall clock time jumps from 12:59 AM (standard) to 2:00 AM
@@ -120,73 +120,73 @@ class BasicTimeZone;
* Calendar resolves the time using the UTC offset before the transition by default.
* In this example, 1:30 AM is interpreted as 1:30 AM standard time (non-exist),
* so the final result will be 2:30 AM daylight time.
- *
- * On the date switching back to standard time, wall clock time is moved back one
+ *
+ * On the date switching back to standard time, wall clock time is moved back one
* hour at 2:00 AM. So wall clock time from 1:00 AM to 1:59 AM occur twice. In this
* case, the ICU Calendar resolves the time using the UTC offset after the transition
* by default. For example, 1:30 AM on the date is resolved as 1:30 AM standard time.
*
- * Ambiguous wall clock time resolution behaviors can be customized by Calendar APIs
+ * Ambiguous wall clock time resolution behaviors can be customized by Calendar APIs
* {@link #setRepeatedWallTimeOption} and {@link #setSkippedWallTimeOption}.
* These methods are available in ICU 49 or later versions.
*
- * **Note:** for some non-Gregorian calendars, different
+ * **Note:** for some non-Gregorian calendars, different
* fields may be necessary for complete disambiguation. For example, a full
- * specification of the historical Arabic astronomical calendar requires year,
- * month, day-of-month *and* day-of-week in some cases.
+ * specification of the historical Arabic astronomical calendar requires year,
+ * month, day-of-month *and* day-of-week in some cases.
*
- * **Note:** There are certain possible ambiguities in
+ * **Note:** There are certain possible ambiguities in
* interpretation of certain singular times, which are resolved in the
* following ways:
*
- * 1. 24:00:00 "belongs" to the following day. That is,
- * 23:59 on Dec 31, 1969 < 24:00 on Jan 1, 1970 < 24:01:00 on Jan 1, 1970
- * 2. Although historically not precise, midnight also belongs to "am",
- * and noon belongs to "pm", so on the same day,
- * 12:00 am (midnight) < 12:01 am, and 12:00 pm (noon) < 12:01 pm
+ * 1. 24:00:00 "belongs" to the following day. That is,
+ * 23:59 on Dec 31, 1969 < 24:00 on Jan 1, 1970 < 24:01:00 on Jan 1, 1970
+ * 2. Although historically not precise, midnight also belongs to "am",
+ * and noon belongs to "pm", so on the same day,
+ * 12:00 am (midnight) < 12:01 am, and 12:00 pm (noon) < 12:01 pm
*
* The date or time format strings are not part of the definition of a
* calendar, as those must be modifiable or overridable by the user at
- * runtime. Use `DateFormat` to format dates.
+ * runtime. Use `DateFormat` to format dates.
*
- * `Calendar` provides an API for field "rolling", where fields
+ * `Calendar` provides an API for field "rolling", where fields
* can be incremented or decremented, but wrap around. For example, rolling the
- * month up in the date December 12, **1996** results in
- * January 12, **1996**.
+ * month up in the date December 12, **1996** results in
+ * January 12, **1996**.
*
- * `Calendar` also provides a date arithmetic function for
+ * `Calendar` also provides a date arithmetic function for
* adding the specified (signed) amount of time to a particular time field.
- * For example, subtracting 5 days from the date `September 12, 1996`
- * results in `September 7, 1996`.
+ * For example, subtracting 5 days from the date `September 12, 1996`
+ * results in `September 7, 1996`.
*
- * ***Supported range***
+ * ***Supported range***
*
- * The allowable range of `Calendar` has been narrowed. `GregorianCalendar` used
- * to attempt to support the range of dates with millisecond values from
- * `Long.MIN_VALUE` to `Long.MAX_VALUE`. The new `Calendar` protocol specifies the
+ * The allowable range of `Calendar` has been narrowed. `GregorianCalendar` used
+ * to attempt to support the range of dates with millisecond values from
+ * `Long.MIN_VALUE` to `Long.MAX_VALUE`. The new `Calendar` protocol specifies the
* maximum range of supportable dates as those having Julian day numbers
- * of `-0x7F000000` to `+0x7F000000`. This corresponds to years from ~5,800,000 BCE
- * to ~5,800,000 CE. Programmers should use the protected constants in `Calendar` to
- * specify an extremely early or extremely late date.
+ * of `-0x7F000000` to `+0x7F000000`. This corresponds to years from ~5,800,000 BCE
+ * to ~5,800,000 CE. Programmers should use the protected constants in `Calendar` to
+ * specify an extremely early or extremely late date.
+ *
+ * <p>
+ * The Japanese calendar uses a combination of era name and year number.
+ * When an emperor of Japan abdicates and a new emperor ascends the throne,
+ * a new era is declared and year number is reset to 1. Even if the date of
+ * abdication is scheduled ahead of time, the new era name might not be
+ * announced until just before the date. In such case, ICU4C may include
+ * a start date of future era without actual era name, but not enabled
+ * by default. ICU4C users who want to test the behavior of the future era
+ * can enable the tentative era by:
+ * <ul>
+ * <li>Environment variable <code>ICU_ENABLE_TENTATIVE_ERA=true</code>.</li>
+ * </ul>
*
- * <p>
- * The Japanese calendar uses a combination of era name and year number.
- * When an emperor of Japan abdicates and a new emperor ascends the throne,
- * a new era is declared and year number is reset to 1. Even if the date of
- * abdication is scheduled ahead of time, the new era name might not be
- * announced until just before the date. In such case, ICU4C may include
- * a start date of future era without actual era name, but not enabled
- * by default. ICU4C users who want to test the behavior of the future era
- * can enable the tentative era by:
- * <ul>
- * <li>Environment variable <code>ICU_ENABLE_TENTATIVE_ERA=true</code>.</li>
- * </ul>
- *
* @stable ICU 2.0
*/
class U_I18N_API Calendar : public UObject {
public:
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Field IDs for date and time. Used to specify date/time fields. ERA is calendar
* specific. Example ranges given are for illustration only; see specific Calendar
@@ -220,7 +220,7 @@ public:
DST_OFFSET, // Example: 0 or U_MILLIS_PER_HOUR
YEAR_WOY, // 'Y' Example: 1..big number - Year of Week of Year
DOW_LOCAL, // 'e' Example: 1..7 - Day of Week / Localized
-
+
EXTENDED_YEAR,
JULIAN_DAY,
MILLISECONDS_IN_DAY,
@@ -229,7 +229,7 @@ public:
FIELD_COUNT = UCAL_FIELD_COUNT // See ucal.h for other fields.
#endif /* U_HIDE_DEPRECATED_API */
};
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
#ifndef U_HIDE_DEPRECATED_API
/**
@@ -290,7 +290,7 @@ public:
* @return a polymorphic copy of this calendar.
* @stable ICU 2.0
*/
- virtual Calendar* clone() const = 0;
+ virtual Calendar* clone() const = 0;
/**
* Creates a Calendar using the default timezone and locale. Clients are responsible
@@ -521,7 +521,7 @@ public:
*/
UBool after(const Calendar& when, UErrorCode& status) const;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* UDate Arithmetic function. Adds the specified (signed) amount of time to the given
* time field, based on the calendar's rules. For example, to subtract 5 days from
@@ -543,7 +543,7 @@ public:
* @deprecated ICU 2.6. use add(UCalendarDateFields field, int32_t amount, UErrorCode& status) instead.
*/
virtual void add(EDateFields field, int32_t amount, UErrorCode& status);
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* UDate Arithmetic function. Adds the specified (signed) amount of time to the given
@@ -637,7 +637,7 @@ public:
*/
inline void roll(UCalendarDateFields field, UBool up, UErrorCode& status);
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Time Field Rolling function. Rolls by the given amount on the given
* time field. For example, to roll the current date up by one day, call
@@ -670,7 +670,7 @@ public:
* @deprecated ICU 2.6. Use roll(UCalendarDateFields field, int32_t amount, UErrorCode& status) instead.
*/
virtual void roll(EDateFields field, int32_t amount, UErrorCode& status);
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Time Field Rolling function. Rolls by the given amount on the given
@@ -705,7 +705,7 @@ public:
*/
virtual void roll(UCalendarDateFields field, int32_t amount, UErrorCode& status);
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Return the difference between the given time and the time this
* calendar object is set to. If this calendar is set
@@ -762,7 +762,7 @@ public:
* @deprecated ICU 2.6. Use fieldDifference(UDate when, UCalendarDateFields field, UErrorCode& status).
*/
virtual int32_t fieldDifference(UDate when, EDateFields field, UErrorCode& status);
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Return the difference between the given time and the time this
@@ -895,7 +895,7 @@ public:
/**
* Sets the behavior for handling wall time repeating multiple times
* at negative time zone offset transitions. For example, 1:30 AM on
- * November 6, 2011 in US Eastern time (America/New_York) occurs twice;
+ * November 6, 2011 in US Eastern time (America/New_York) occurs twice;
* 1:30 AM EDT, then 1:30 AM EST one hour later. When <code>UCAL_WALLTIME_FIRST</code>
* is used, the wall time 1:30AM in this example will be interpreted as 1:30 AM EDT
* (first occurrence). When <code>UCAL_WALLTIME_LAST</code> is used, it will be
@@ -906,7 +906,7 @@ public:
* option for this. When the argument is neither <code>UCAL_WALLTIME_FIRST</code>
* nor <code>UCAL_WALLTIME_LAST</code>, this method has no effect and will keep
* the current setting.
- *
+ *
* @param option the behavior for handling repeating wall time, either
* <code>UCAL_WALLTIME_FIRST</code> or <code>UCAL_WALLTIME_LAST</code>.
* @see #getRepeatedWallTimeOption
@@ -917,7 +917,7 @@ public:
/**
* Gets the behavior for handling wall time repeating multiple times
* at negative time zone offset transitions.
- *
+ *
* @return the behavior for handling repeating wall time, either
* <code>UCAL_WALLTIME_FIRST</code> or <code>UCAL_WALLTIME_LAST</code>.
* @see #setRepeatedWallTimeOption
@@ -938,12 +938,12 @@ public:
* <p>
* <b>Note:</b>This option is effective only when this calendar is lenient.
* When the calendar is strict, such non-existing wall time will cause an error.
- *
+ *
* @param option the behavior for handling skipped wall time at positive time zone
* offset transitions, one of <code>UCAL_WALLTIME_FIRST</code>, <code>UCAL_WALLTIME_LAST</code> and
* <code>UCAL_WALLTIME_NEXT_VALID</code>.
* @see #getSkippedWallTimeOption
- *
+ *
* @stable ICU 49
*/
void setSkippedWallTimeOption(UCalendarWallTimeOption option);
@@ -951,7 +951,7 @@ public:
/**
* Gets the behavior for handling skipped wall time at positive time zone offset
* transitions.
- *
+ *
* @return the behavior for handling skipped wall time, one of
* <code>UCAL_WALLTIME_FIRST</code>, <code>UCAL_WALLTIME_LAST</code>
* and <code>UCAL_WALLTIME_NEXT_VALID</code>.
@@ -1019,7 +1019,7 @@ public:
*/
uint8_t getMinimalDaysInFirstWeek(void) const;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Gets the minimum value for the given time field. e.g., for Gregorian
* DAY_OF_MONTH, 1.
@@ -1029,7 +1029,7 @@ public:
* @deprecated ICU 2.6. Use getMinimum(UCalendarDateFields field) instead.
*/
virtual int32_t getMinimum(EDateFields field) const;
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Gets the minimum value for the given time field. e.g., for Gregorian
@@ -1041,7 +1041,7 @@ public:
*/
virtual int32_t getMinimum(UCalendarDateFields field) const;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Gets the maximum value for the given time field. e.g. for Gregorian DAY_OF_MONTH,
* 31.
@@ -1051,7 +1051,7 @@ public:
* @deprecated ICU 2.6. Use getMaximum(UCalendarDateFields field) instead.
*/
virtual int32_t getMaximum(EDateFields field) const;
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Gets the maximum value for the given time field. e.g. for Gregorian DAY_OF_MONTH,
@@ -1063,7 +1063,7 @@ public:
*/
virtual int32_t getMaximum(UCalendarDateFields field) const;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Gets the highest minimum value for the given field if varies. Otherwise same as
* getMinimum(). For Gregorian, no difference.
@@ -1073,7 +1073,7 @@ public:
* @deprecated ICU 2.6. Use getGreatestMinimum(UCalendarDateFields field) instead.
*/
virtual int32_t getGreatestMinimum(EDateFields field) const;
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Gets the highest minimum value for the given field if varies. Otherwise same as
@@ -1085,7 +1085,7 @@ public:
*/
virtual int32_t getGreatestMinimum(UCalendarDateFields field) const;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Gets the lowest maximum value for the given field if varies. Otherwise same as
* getMaximum(). e.g., for Gregorian DAY_OF_MONTH, 28.
@@ -1095,7 +1095,7 @@ public:
* @deprecated ICU 2.6. Use getLeastMaximum(UCalendarDateFields field) instead.
*/
virtual int32_t getLeastMaximum(EDateFields field) const;
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Gets the lowest maximum value for the given field if varies. Otherwise same as
@@ -1718,7 +1718,7 @@ protected:
/**
* Validate a single field of this calendar. Subclasses should
* override this method to validate any calendar-specific fields.
- * Generic fields can be handled by `Calendar::validateField()`.
+ * Generic fields can be handled by `Calendar::validateField()`.
* @internal
*/
virtual void validateField(UCalendarDateFields field, UErrorCode &status);
@@ -1739,7 +1739,7 @@ protected:
* reflects local zone wall time.
* @internal
*/
- double computeMillisInDay();
+ double computeMillisInDay();
/**
* This method can assume EXTENDED_YEAR has been set.
@@ -1750,7 +1750,7 @@ protected:
* when this function fails.
* @internal
*/
- int32_t computeZoneOffset(double millis, double millisInDay, UErrorCode &ec);
+ int32_t computeZoneOffset(double millis, double millisInDay, UErrorCode &ec);
/**
@@ -1912,13 +1912,13 @@ protected:
*/
int32_t fFields[UCAL_FIELD_COUNT];
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* The flags which tell if a specified time field for the calendar is set.
* @deprecated ICU 2.8 use (fStamp[n]!=kUnset)
*/
UBool fIsSet[UCAL_FIELD_COUNT];
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/** Special values of stamp[]
* @stable ICU 2.0
@@ -2171,7 +2171,7 @@ private:
TimeZone* fZone;
/**
- * Option for repeated wall time
+ * Option for repeated wall time
* @see #setRepeatedWallTimeOption
*/
UCalendarWallTimeOption fRepeatedWallTime;
@@ -2454,7 +2454,7 @@ private:
BasicTimeZone* getBasicTimeZone() const;
/**
- * Find the previous zone transition near the given time.
+ * Find the previous zone transition near the given time.
* @param base The base time, inclusive
* @param transitionTime Receives the result time
* @param status The error status
@@ -2546,6 +2546,6 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _CALENDAR
diff --git a/contrib/libs/icu/include/unicode/caniter.h b/contrib/libs/icu/include/unicode/caniter.h
index fad9daf77f..13e524ff6a 100644
--- a/contrib/libs/icu/include/unicode/caniter.h
+++ b/contrib/libs/icu/include/unicode/caniter.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -12,8 +12,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_NORMALIZATION
#include "unicode/uobject.h"
@@ -155,13 +155,13 @@ private:
/**
* Copy constructor. Private for now.
- * @internal (private)
+ * @internal (private)
*/
CanonicalIterator(const CanonicalIterator& other);
/**
* Assignment operator. Private for now.
- * @internal (private)
+ * @internal (private)
*/
CanonicalIterator& operator=(const CanonicalIterator& other);
@@ -189,7 +189,7 @@ private:
UnicodeString *getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status); //private String[] getEquivalents(String segment)
//Set getEquivalents2(String segment);
- Hashtable *getEquivalents2(Hashtable *fillinResult, const char16_t *segment, int32_t segLen, UErrorCode &status);
+ Hashtable *getEquivalents2(Hashtable *fillinResult, const char16_t *segment, int32_t segLen, UErrorCode &status);
//Hashtable *getEquivalents2(const UnicodeString &segment, int32_t segLen, UErrorCode &status);
/**
@@ -198,7 +198,7 @@ private:
* If so, take the remainder, and return the equivalents
*/
//Set extract(int comp, String segment, int segmentPos, StringBuffer buffer);
- Hashtable *extract(Hashtable *fillinResult, UChar32 comp, const char16_t *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status);
+ Hashtable *extract(Hashtable *fillinResult, UChar32 comp, const char16_t *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status);
//Hashtable *extract(UChar32 comp, const UnicodeString &segment, int32_t segLen, int32_t segmentPos, UErrorCode &status);
void cleanPieces();
@@ -209,6 +209,6 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_NORMALIZATION */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/casemap.h b/contrib/libs/icu/include/unicode/casemap.h
index 35fbcf72dd..53af84fa74 100644
--- a/contrib/libs/icu/include/unicode/casemap.h
+++ b/contrib/libs/icu/include/unicode/casemap.h
@@ -1,497 +1,497 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// casemap.h
-// created: 2017jan12 Markus W. Scherer
-
-#ifndef __CASEMAP_H__
-#define __CASEMAP_H__
-
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
-#include "unicode/stringpiece.h"
-#include "unicode/uobject.h"
-
-/**
- * \file
- * \brief C++ API: Low-level C++ case mapping functions.
- */
-
-U_NAMESPACE_BEGIN
-
-class BreakIterator;
-class ByteSink;
-class Edits;
-
-/**
- * Low-level C++ case mapping functions.
- *
- * @stable ICU 59
- */
-class U_COMMON_API CaseMap U_FINAL : public UMemory {
-public:
- /**
- * Lowercases a UTF-16 string and optionally records edits.
- * Casing is locale-dependent and context-sensitive.
- * The result may be longer or shorter than the original.
- * The source string and the destination buffer must not overlap.
- *
- * @param locale The locale ID. ("" = root locale, NULL = default locale.)
- * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
- * @param src The original string.
- * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
- * @param dest A buffer for the result string. The result will be NUL-terminated if
- * the buffer is large enough.
- * The contents is undefined in case of failure.
- * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then
- * dest may be NULL and the function will only return the length of the result
- * without writing any of the result string.
- * @param edits Records edits for index mapping, working with styled text,
- * and getting only changes (if any).
- * The Edits contents is undefined if any error occurs.
- * This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
- * @param errorCode Reference to an in/out error code value
- * which must not indicate a failure before the function call.
- * @return The length of the result string, if successful.
- * When the result would be longer than destCapacity,
- * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
- *
- * @see u_strToLower
- * @stable ICU 59
- */
- static int32_t toLower(
- const char *locale, uint32_t options,
- const char16_t *src, int32_t srcLength,
- char16_t *dest, int32_t destCapacity, Edits *edits,
- UErrorCode &errorCode);
-
- /**
- * Uppercases a UTF-16 string and optionally records edits.
- * Casing is locale-dependent and context-sensitive.
- * The result may be longer or shorter than the original.
- * The source string and the destination buffer must not overlap.
- *
- * @param locale The locale ID. ("" = root locale, NULL = default locale.)
- * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
- * @param src The original string.
- * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
- * @param dest A buffer for the result string. The result will be NUL-terminated if
- * the buffer is large enough.
- * The contents is undefined in case of failure.
- * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then
- * dest may be NULL and the function will only return the length of the result
- * without writing any of the result string.
- * @param edits Records edits for index mapping, working with styled text,
- * and getting only changes (if any).
- * The Edits contents is undefined if any error occurs.
- * This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
- * @param errorCode Reference to an in/out error code value
- * which must not indicate a failure before the function call.
- * @return The length of the result string, if successful.
- * When the result would be longer than destCapacity,
- * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
- *
- * @see u_strToUpper
- * @stable ICU 59
- */
- static int32_t toUpper(
- const char *locale, uint32_t options,
- const char16_t *src, int32_t srcLength,
- char16_t *dest, int32_t destCapacity, Edits *edits,
- UErrorCode &errorCode);
-
-#if !UCONFIG_NO_BREAK_ITERATION
-
- /**
- * Titlecases a UTF-16 string and optionally records edits.
- * Casing is locale-dependent and context-sensitive.
- * The result may be longer or shorter than the original.
- * The source string and the destination buffer must not overlap.
- *
- * Titlecasing uses a break iterator to find the first characters of words
- * that are to be titlecased. It titlecases those characters and lowercases
- * all others. (This can be modified with options bits.)
- *
- * @param locale The locale ID. ("" = root locale, NULL = default locale.)
- * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET,
- * U_TITLECASE_NO_LOWERCASE,
- * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED,
- * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES.
- * @param iter A break iterator to find the first characters of words that are to be titlecased.
- * It is set to the source string (setText())
- * and used one or more times for iteration (first() and next()).
- * If NULL, then a word break iterator for the locale is used
- * (or something equivalent).
- * @param src The original string.
- * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
- * @param dest A buffer for the result string. The result will be NUL-terminated if
- * the buffer is large enough.
- * The contents is undefined in case of failure.
- * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then
- * dest may be NULL and the function will only return the length of the result
- * without writing any of the result string.
- * @param edits Records edits for index mapping, working with styled text,
- * and getting only changes (if any).
- * The Edits contents is undefined if any error occurs.
- * This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
- * @param errorCode Reference to an in/out error code value
- * which must not indicate a failure before the function call.
- * @return The length of the result string, if successful.
- * When the result would be longer than destCapacity,
- * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
- *
- * @see u_strToTitle
- * @see ucasemap_toTitle
- * @stable ICU 59
- */
- static int32_t toTitle(
- const char *locale, uint32_t options, BreakIterator *iter,
- const char16_t *src, int32_t srcLength,
- char16_t *dest, int32_t destCapacity, Edits *edits,
- UErrorCode &errorCode);
-
-#endif // UCONFIG_NO_BREAK_ITERATION
-
- /**
- * Case-folds a UTF-16 string and optionally records edits.
- *
- * Case folding is locale-independent and not context-sensitive,
- * but there is an option for whether to include or exclude mappings for dotted I
- * and dotless i that are marked with 'T' in CaseFolding.txt.
- *
- * The result may be longer or shorter than the original.
- * The source string and the destination buffer must not overlap.
- *
- * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET,
- * U_FOLD_CASE_DEFAULT, U_FOLD_CASE_EXCLUDE_SPECIAL_I.
- * @param src The original string.
- * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
- * @param dest A buffer for the result string. The result will be NUL-terminated if
- * the buffer is large enough.
- * The contents is undefined in case of failure.
- * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then
- * dest may be NULL and the function will only return the length of the result
- * without writing any of the result string.
- * @param edits Records edits for index mapping, working with styled text,
- * and getting only changes (if any).
- * The Edits contents is undefined if any error occurs.
- * This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
- * @param errorCode Reference to an in/out error code value
- * which must not indicate a failure before the function call.
- * @return The length of the result string, if successful.
- * When the result would be longer than destCapacity,
- * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
- *
- * @see u_strFoldCase
- * @stable ICU 59
- */
- static int32_t fold(
- uint32_t options,
- const char16_t *src, int32_t srcLength,
- char16_t *dest, int32_t destCapacity, Edits *edits,
- UErrorCode &errorCode);
-
- /**
- * Lowercases a UTF-8 string and optionally records edits.
- * Casing is locale-dependent and context-sensitive.
- * The result may be longer or shorter than the original.
- *
- * @param locale The locale ID. ("" = root locale, NULL = default locale.)
- * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
- * @param src The original string.
- * @param sink A ByteSink to which the result string is written.
- * sink.Flush() is called at the end.
- * @param edits Records edits for index mapping, working with styled text,
- * and getting only changes (if any).
- * The Edits contents is undefined if any error occurs.
- * This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
- * @param errorCode Reference to an in/out error code value
- * which must not indicate a failure before the function call.
- *
- * @see ucasemap_utf8ToLower
- * @stable ICU 60
- */
- static void utf8ToLower(
- const char *locale, uint32_t options,
- StringPiece src, ByteSink &sink, Edits *edits,
- UErrorCode &errorCode);
-
- /**
- * Uppercases a UTF-8 string and optionally records edits.
- * Casing is locale-dependent and context-sensitive.
- * The result may be longer or shorter than the original.
- *
- * @param locale The locale ID. ("" = root locale, NULL = default locale.)
- * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
- * @param src The original string.
- * @param sink A ByteSink to which the result string is written.
- * sink.Flush() is called at the end.
- * @param edits Records edits for index mapping, working with styled text,
- * and getting only changes (if any).
- * The Edits contents is undefined if any error occurs.
- * This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
- * @param errorCode Reference to an in/out error code value
- * which must not indicate a failure before the function call.
- *
- * @see ucasemap_utf8ToUpper
- * @stable ICU 60
- */
- static void utf8ToUpper(
- const char *locale, uint32_t options,
- StringPiece src, ByteSink &sink, Edits *edits,
- UErrorCode &errorCode);
-
-#if !UCONFIG_NO_BREAK_ITERATION
-
- /**
- * Titlecases a UTF-8 string and optionally records edits.
- * Casing is locale-dependent and context-sensitive.
- * The result may be longer or shorter than the original.
- *
- * Titlecasing uses a break iterator to find the first characters of words
- * that are to be titlecased. It titlecases those characters and lowercases
- * all others. (This can be modified with options bits.)
- *
- * @param locale The locale ID. ("" = root locale, NULL = default locale.)
- * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET,
- * U_TITLECASE_NO_LOWERCASE,
- * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED,
- * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES.
- * @param iter A break iterator to find the first characters of words that are to be titlecased.
- * It is set to the source string (setUText())
- * and used one or more times for iteration (first() and next()).
- * If NULL, then a word break iterator for the locale is used
- * (or something equivalent).
- * @param src The original string.
- * @param sink A ByteSink to which the result string is written.
- * sink.Flush() is called at the end.
- * @param edits Records edits for index mapping, working with styled text,
- * and getting only changes (if any).
- * The Edits contents is undefined if any error occurs.
- * This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
- * @param errorCode Reference to an in/out error code value
- * which must not indicate a failure before the function call.
- *
- * @see ucasemap_utf8ToTitle
- * @stable ICU 60
- */
- static void utf8ToTitle(
- const char *locale, uint32_t options, BreakIterator *iter,
- StringPiece src, ByteSink &sink, Edits *edits,
- UErrorCode &errorCode);
-
-#endif // UCONFIG_NO_BREAK_ITERATION
-
- /**
- * Case-folds a UTF-8 string and optionally records edits.
- *
- * Case folding is locale-independent and not context-sensitive,
- * but there is an option for whether to include or exclude mappings for dotted I
- * and dotless i that are marked with 'T' in CaseFolding.txt.
- *
- * The result may be longer or shorter than the original.
- *
- * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
- * @param src The original string.
- * @param sink A ByteSink to which the result string is written.
- * sink.Flush() is called at the end.
- * @param edits Records edits for index mapping, working with styled text,
- * and getting only changes (if any).
- * The Edits contents is undefined if any error occurs.
- * This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
- * @param errorCode Reference to an in/out error code value
- * which must not indicate a failure before the function call.
- *
- * @see ucasemap_utf8FoldCase
- * @stable ICU 60
- */
- static void utf8Fold(
- uint32_t options,
- StringPiece src, ByteSink &sink, Edits *edits,
- UErrorCode &errorCode);
-
- /**
- * Lowercases a UTF-8 string and optionally records edits.
- * Casing is locale-dependent and context-sensitive.
- * The result may be longer or shorter than the original.
- * The source string and the destination buffer must not overlap.
- *
- * @param locale The locale ID. ("" = root locale, NULL = default locale.)
- * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
- * @param src The original string.
- * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
- * @param dest A buffer for the result string. The result will be NUL-terminated if
- * the buffer is large enough.
- * The contents is undefined in case of failure.
- * @param destCapacity The size of the buffer (number of bytes). If it is 0, then
- * dest may be NULL and the function will only return the length of the result
- * without writing any of the result string.
- * @param edits Records edits for index mapping, working with styled text,
- * and getting only changes (if any).
- * The Edits contents is undefined if any error occurs.
- * This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
- * @param errorCode Reference to an in/out error code value
- * which must not indicate a failure before the function call.
- * @return The length of the result string, if successful.
- * When the result would be longer than destCapacity,
- * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
- *
- * @see ucasemap_utf8ToLower
- * @stable ICU 59
- */
- static int32_t utf8ToLower(
- const char *locale, uint32_t options,
- const char *src, int32_t srcLength,
- char *dest, int32_t destCapacity, Edits *edits,
- UErrorCode &errorCode);
-
- /**
- * Uppercases a UTF-8 string and optionally records edits.
- * Casing is locale-dependent and context-sensitive.
- * The result may be longer or shorter than the original.
- * The source string and the destination buffer must not overlap.
- *
- * @param locale The locale ID. ("" = root locale, NULL = default locale.)
- * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
- * @param src The original string.
- * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
- * @param dest A buffer for the result string. The result will be NUL-terminated if
- * the buffer is large enough.
- * The contents is undefined in case of failure.
- * @param destCapacity The size of the buffer (number of bytes). If it is 0, then
- * dest may be NULL and the function will only return the length of the result
- * without writing any of the result string.
- * @param edits Records edits for index mapping, working with styled text,
- * and getting only changes (if any).
- * The Edits contents is undefined if any error occurs.
- * This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
- * @param errorCode Reference to an in/out error code value
- * which must not indicate a failure before the function call.
- * @return The length of the result string, if successful.
- * When the result would be longer than destCapacity,
- * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
- *
- * @see ucasemap_utf8ToUpper
- * @stable ICU 59
- */
- static int32_t utf8ToUpper(
- const char *locale, uint32_t options,
- const char *src, int32_t srcLength,
- char *dest, int32_t destCapacity, Edits *edits,
- UErrorCode &errorCode);
-
-#if !UCONFIG_NO_BREAK_ITERATION
-
- /**
- * Titlecases a UTF-8 string and optionally records edits.
- * Casing is locale-dependent and context-sensitive.
- * The result may be longer or shorter than the original.
- * The source string and the destination buffer must not overlap.
- *
- * Titlecasing uses a break iterator to find the first characters of words
- * that are to be titlecased. It titlecases those characters and lowercases
- * all others. (This can be modified with options bits.)
- *
- * @param locale The locale ID. ("" = root locale, NULL = default locale.)
- * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET,
- * U_TITLECASE_NO_LOWERCASE,
- * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED,
- * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES.
- * @param iter A break iterator to find the first characters of words that are to be titlecased.
- * It is set to the source string (setUText())
- * and used one or more times for iteration (first() and next()).
- * If NULL, then a word break iterator for the locale is used
- * (or something equivalent).
- * @param src The original string.
- * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
- * @param dest A buffer for the result string. The result will be NUL-terminated if
- * the buffer is large enough.
- * The contents is undefined in case of failure.
- * @param destCapacity The size of the buffer (number of bytes). If it is 0, then
- * dest may be NULL and the function will only return the length of the result
- * without writing any of the result string.
- * @param edits Records edits for index mapping, working with styled text,
- * and getting only changes (if any).
- * The Edits contents is undefined if any error occurs.
- * This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
- * @param errorCode Reference to an in/out error code value
- * which must not indicate a failure before the function call.
- * @return The length of the result string, if successful.
- * When the result would be longer than destCapacity,
- * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
- *
- * @see ucasemap_utf8ToTitle
- * @stable ICU 59
- */
- static int32_t utf8ToTitle(
- const char *locale, uint32_t options, BreakIterator *iter,
- const char *src, int32_t srcLength,
- char *dest, int32_t destCapacity, Edits *edits,
- UErrorCode &errorCode);
-
-#endif // UCONFIG_NO_BREAK_ITERATION
-
- /**
- * Case-folds a UTF-8 string and optionally records edits.
- *
- * Case folding is locale-independent and not context-sensitive,
- * but there is an option for whether to include or exclude mappings for dotted I
- * and dotless i that are marked with 'T' in CaseFolding.txt.
- *
- * The result may be longer or shorter than the original.
- * The source string and the destination buffer must not overlap.
- *
- * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET,
- * U_FOLD_CASE_DEFAULT, U_FOLD_CASE_EXCLUDE_SPECIAL_I.
- * @param src The original string.
- * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
- * @param dest A buffer for the result string. The result will be NUL-terminated if
- * the buffer is large enough.
- * The contents is undefined in case of failure.
- * @param destCapacity The size of the buffer (number of bytes). If it is 0, then
- * dest may be NULL and the function will only return the length of the result
- * without writing any of the result string.
- * @param edits Records edits for index mapping, working with styled text,
- * and getting only changes (if any).
- * The Edits contents is undefined if any error occurs.
- * This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
- * @param errorCode Reference to an in/out error code value
- * which must not indicate a failure before the function call.
- * @return The length of the result string, if successful.
- * When the result would be longer than destCapacity,
- * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
- *
- * @see ucasemap_utf8FoldCase
- * @stable ICU 59
- */
- static int32_t utf8Fold(
- uint32_t options,
- const char *src, int32_t srcLength,
- char *dest, int32_t destCapacity, Edits *edits,
- UErrorCode &errorCode);
-
-private:
- CaseMap() = delete;
- CaseMap(const CaseMap &other) = delete;
- CaseMap &operator=(const CaseMap &other) = delete;
-};
-
-U_NAMESPACE_END
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
-#endif // __CASEMAP_H__
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// casemap.h
+// created: 2017jan12 Markus W. Scherer
+
+#ifndef __CASEMAP_H__
+#define __CASEMAP_H__
+
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
+#include "unicode/stringpiece.h"
+#include "unicode/uobject.h"
+
+/**
+ * \file
+ * \brief C++ API: Low-level C++ case mapping functions.
+ */
+
+U_NAMESPACE_BEGIN
+
+class BreakIterator;
+class ByteSink;
+class Edits;
+
+/**
+ * Low-level C++ case mapping functions.
+ *
+ * @stable ICU 59
+ */
+class U_COMMON_API CaseMap U_FINAL : public UMemory {
+public:
+ /**
+ * Lowercases a UTF-16 string and optionally records edits.
+ * Casing is locale-dependent and context-sensitive.
+ * The result may be longer or shorter than the original.
+ * The source string and the destination buffer must not overlap.
+ *
+ * @param locale The locale ID. ("" = root locale, NULL = default locale.)
+ * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
+ * @param src The original string.
+ * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
+ * @param dest A buffer for the result string. The result will be NUL-terminated if
+ * the buffer is large enough.
+ * The contents is undefined in case of failure.
+ * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then
+ * dest may be NULL and the function will only return the length of the result
+ * without writing any of the result string.
+ * @param edits Records edits for index mapping, working with styled text,
+ * and getting only changes (if any).
+ * The Edits contents is undefined if any error occurs.
+ * This function calls edits->reset() first unless
+ * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * @param errorCode Reference to an in/out error code value
+ * which must not indicate a failure before the function call.
+ * @return The length of the result string, if successful.
+ * When the result would be longer than destCapacity,
+ * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
+ *
+ * @see u_strToLower
+ * @stable ICU 59
+ */
+ static int32_t toLower(
+ const char *locale, uint32_t options,
+ const char16_t *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity, Edits *edits,
+ UErrorCode &errorCode);
+
+ /**
+ * Uppercases a UTF-16 string and optionally records edits.
+ * Casing is locale-dependent and context-sensitive.
+ * The result may be longer or shorter than the original.
+ * The source string and the destination buffer must not overlap.
+ *
+ * @param locale The locale ID. ("" = root locale, NULL = default locale.)
+ * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
+ * @param src The original string.
+ * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
+ * @param dest A buffer for the result string. The result will be NUL-terminated if
+ * the buffer is large enough.
+ * The contents is undefined in case of failure.
+ * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then
+ * dest may be NULL and the function will only return the length of the result
+ * without writing any of the result string.
+ * @param edits Records edits for index mapping, working with styled text,
+ * and getting only changes (if any).
+ * The Edits contents is undefined if any error occurs.
+ * This function calls edits->reset() first unless
+ * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * @param errorCode Reference to an in/out error code value
+ * which must not indicate a failure before the function call.
+ * @return The length of the result string, if successful.
+ * When the result would be longer than destCapacity,
+ * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
+ *
+ * @see u_strToUpper
+ * @stable ICU 59
+ */
+ static int32_t toUpper(
+ const char *locale, uint32_t options,
+ const char16_t *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity, Edits *edits,
+ UErrorCode &errorCode);
+
+#if !UCONFIG_NO_BREAK_ITERATION
+
+ /**
+ * Titlecases a UTF-16 string and optionally records edits.
+ * Casing is locale-dependent and context-sensitive.
+ * The result may be longer or shorter than the original.
+ * The source string and the destination buffer must not overlap.
+ *
+ * Titlecasing uses a break iterator to find the first characters of words
+ * that are to be titlecased. It titlecases those characters and lowercases
+ * all others. (This can be modified with options bits.)
+ *
+ * @param locale The locale ID. ("" = root locale, NULL = default locale.)
+ * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET,
+ * U_TITLECASE_NO_LOWERCASE,
+ * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED,
+ * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES.
+ * @param iter A break iterator to find the first characters of words that are to be titlecased.
+ * It is set to the source string (setText())
+ * and used one or more times for iteration (first() and next()).
+ * If NULL, then a word break iterator for the locale is used
+ * (or something equivalent).
+ * @param src The original string.
+ * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
+ * @param dest A buffer for the result string. The result will be NUL-terminated if
+ * the buffer is large enough.
+ * The contents is undefined in case of failure.
+ * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then
+ * dest may be NULL and the function will only return the length of the result
+ * without writing any of the result string.
+ * @param edits Records edits for index mapping, working with styled text,
+ * and getting only changes (if any).
+ * The Edits contents is undefined if any error occurs.
+ * This function calls edits->reset() first unless
+ * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * @param errorCode Reference to an in/out error code value
+ * which must not indicate a failure before the function call.
+ * @return The length of the result string, if successful.
+ * When the result would be longer than destCapacity,
+ * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
+ *
+ * @see u_strToTitle
+ * @see ucasemap_toTitle
+ * @stable ICU 59
+ */
+ static int32_t toTitle(
+ const char *locale, uint32_t options, BreakIterator *iter,
+ const char16_t *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity, Edits *edits,
+ UErrorCode &errorCode);
+
+#endif // UCONFIG_NO_BREAK_ITERATION
+
+ /**
+ * Case-folds a UTF-16 string and optionally records edits.
+ *
+ * Case folding is locale-independent and not context-sensitive,
+ * but there is an option for whether to include or exclude mappings for dotted I
+ * and dotless i that are marked with 'T' in CaseFolding.txt.
+ *
+ * The result may be longer or shorter than the original.
+ * The source string and the destination buffer must not overlap.
+ *
+ * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET,
+ * U_FOLD_CASE_DEFAULT, U_FOLD_CASE_EXCLUDE_SPECIAL_I.
+ * @param src The original string.
+ * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
+ * @param dest A buffer for the result string. The result will be NUL-terminated if
+ * the buffer is large enough.
+ * The contents is undefined in case of failure.
+ * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then
+ * dest may be NULL and the function will only return the length of the result
+ * without writing any of the result string.
+ * @param edits Records edits for index mapping, working with styled text,
+ * and getting only changes (if any).
+ * The Edits contents is undefined if any error occurs.
+ * This function calls edits->reset() first unless
+ * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * @param errorCode Reference to an in/out error code value
+ * which must not indicate a failure before the function call.
+ * @return The length of the result string, if successful.
+ * When the result would be longer than destCapacity,
+ * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
+ *
+ * @see u_strFoldCase
+ * @stable ICU 59
+ */
+ static int32_t fold(
+ uint32_t options,
+ const char16_t *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity, Edits *edits,
+ UErrorCode &errorCode);
+
+ /**
+ * Lowercases a UTF-8 string and optionally records edits.
+ * Casing is locale-dependent and context-sensitive.
+ * The result may be longer or shorter than the original.
+ *
+ * @param locale The locale ID. ("" = root locale, NULL = default locale.)
+ * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
+ * @param src The original string.
+ * @param sink A ByteSink to which the result string is written.
+ * sink.Flush() is called at the end.
+ * @param edits Records edits for index mapping, working with styled text,
+ * and getting only changes (if any).
+ * The Edits contents is undefined if any error occurs.
+ * This function calls edits->reset() first unless
+ * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * @param errorCode Reference to an in/out error code value
+ * which must not indicate a failure before the function call.
+ *
+ * @see ucasemap_utf8ToLower
+ * @stable ICU 60
+ */
+ static void utf8ToLower(
+ const char *locale, uint32_t options,
+ StringPiece src, ByteSink &sink, Edits *edits,
+ UErrorCode &errorCode);
+
+ /**
+ * Uppercases a UTF-8 string and optionally records edits.
+ * Casing is locale-dependent and context-sensitive.
+ * The result may be longer or shorter than the original.
+ *
+ * @param locale The locale ID. ("" = root locale, NULL = default locale.)
+ * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
+ * @param src The original string.
+ * @param sink A ByteSink to which the result string is written.
+ * sink.Flush() is called at the end.
+ * @param edits Records edits for index mapping, working with styled text,
+ * and getting only changes (if any).
+ * The Edits contents is undefined if any error occurs.
+ * This function calls edits->reset() first unless
+ * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * @param errorCode Reference to an in/out error code value
+ * which must not indicate a failure before the function call.
+ *
+ * @see ucasemap_utf8ToUpper
+ * @stable ICU 60
+ */
+ static void utf8ToUpper(
+ const char *locale, uint32_t options,
+ StringPiece src, ByteSink &sink, Edits *edits,
+ UErrorCode &errorCode);
+
+#if !UCONFIG_NO_BREAK_ITERATION
+
+ /**
+ * Titlecases a UTF-8 string and optionally records edits.
+ * Casing is locale-dependent and context-sensitive.
+ * The result may be longer or shorter than the original.
+ *
+ * Titlecasing uses a break iterator to find the first characters of words
+ * that are to be titlecased. It titlecases those characters and lowercases
+ * all others. (This can be modified with options bits.)
+ *
+ * @param locale The locale ID. ("" = root locale, NULL = default locale.)
+ * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET,
+ * U_TITLECASE_NO_LOWERCASE,
+ * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED,
+ * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES.
+ * @param iter A break iterator to find the first characters of words that are to be titlecased.
+ * It is set to the source string (setUText())
+ * and used one or more times for iteration (first() and next()).
+ * If NULL, then a word break iterator for the locale is used
+ * (or something equivalent).
+ * @param src The original string.
+ * @param sink A ByteSink to which the result string is written.
+ * sink.Flush() is called at the end.
+ * @param edits Records edits for index mapping, working with styled text,
+ * and getting only changes (if any).
+ * The Edits contents is undefined if any error occurs.
+ * This function calls edits->reset() first unless
+ * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * @param errorCode Reference to an in/out error code value
+ * which must not indicate a failure before the function call.
+ *
+ * @see ucasemap_utf8ToTitle
+ * @stable ICU 60
+ */
+ static void utf8ToTitle(
+ const char *locale, uint32_t options, BreakIterator *iter,
+ StringPiece src, ByteSink &sink, Edits *edits,
+ UErrorCode &errorCode);
+
+#endif // UCONFIG_NO_BREAK_ITERATION
+
+ /**
+ * Case-folds a UTF-8 string and optionally records edits.
+ *
+ * Case folding is locale-independent and not context-sensitive,
+ * but there is an option for whether to include or exclude mappings for dotted I
+ * and dotless i that are marked with 'T' in CaseFolding.txt.
+ *
+ * The result may be longer or shorter than the original.
+ *
+ * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
+ * @param src The original string.
+ * @param sink A ByteSink to which the result string is written.
+ * sink.Flush() is called at the end.
+ * @param edits Records edits for index mapping, working with styled text,
+ * and getting only changes (if any).
+ * The Edits contents is undefined if any error occurs.
+ * This function calls edits->reset() first unless
+ * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * @param errorCode Reference to an in/out error code value
+ * which must not indicate a failure before the function call.
+ *
+ * @see ucasemap_utf8FoldCase
+ * @stable ICU 60
+ */
+ static void utf8Fold(
+ uint32_t options,
+ StringPiece src, ByteSink &sink, Edits *edits,
+ UErrorCode &errorCode);
+
+ /**
+ * Lowercases a UTF-8 string and optionally records edits.
+ * Casing is locale-dependent and context-sensitive.
+ * The result may be longer or shorter than the original.
+ * The source string and the destination buffer must not overlap.
+ *
+ * @param locale The locale ID. ("" = root locale, NULL = default locale.)
+ * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
+ * @param src The original string.
+ * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
+ * @param dest A buffer for the result string. The result will be NUL-terminated if
+ * the buffer is large enough.
+ * The contents is undefined in case of failure.
+ * @param destCapacity The size of the buffer (number of bytes). If it is 0, then
+ * dest may be NULL and the function will only return the length of the result
+ * without writing any of the result string.
+ * @param edits Records edits for index mapping, working with styled text,
+ * and getting only changes (if any).
+ * The Edits contents is undefined if any error occurs.
+ * This function calls edits->reset() first unless
+ * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * @param errorCode Reference to an in/out error code value
+ * which must not indicate a failure before the function call.
+ * @return The length of the result string, if successful.
+ * When the result would be longer than destCapacity,
+ * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
+ *
+ * @see ucasemap_utf8ToLower
+ * @stable ICU 59
+ */
+ static int32_t utf8ToLower(
+ const char *locale, uint32_t options,
+ const char *src, int32_t srcLength,
+ char *dest, int32_t destCapacity, Edits *edits,
+ UErrorCode &errorCode);
+
+ /**
+ * Uppercases a UTF-8 string and optionally records edits.
+ * Casing is locale-dependent and context-sensitive.
+ * The result may be longer or shorter than the original.
+ * The source string and the destination buffer must not overlap.
+ *
+ * @param locale The locale ID. ("" = root locale, NULL = default locale.)
+ * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
+ * @param src The original string.
+ * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
+ * @param dest A buffer for the result string. The result will be NUL-terminated if
+ * the buffer is large enough.
+ * The contents is undefined in case of failure.
+ * @param destCapacity The size of the buffer (number of bytes). If it is 0, then
+ * dest may be NULL and the function will only return the length of the result
+ * without writing any of the result string.
+ * @param edits Records edits for index mapping, working with styled text,
+ * and getting only changes (if any).
+ * The Edits contents is undefined if any error occurs.
+ * This function calls edits->reset() first unless
+ * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * @param errorCode Reference to an in/out error code value
+ * which must not indicate a failure before the function call.
+ * @return The length of the result string, if successful.
+ * When the result would be longer than destCapacity,
+ * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
+ *
+ * @see ucasemap_utf8ToUpper
+ * @stable ICU 59
+ */
+ static int32_t utf8ToUpper(
+ const char *locale, uint32_t options,
+ const char *src, int32_t srcLength,
+ char *dest, int32_t destCapacity, Edits *edits,
+ UErrorCode &errorCode);
+
+#if !UCONFIG_NO_BREAK_ITERATION
+
+ /**
+ * Titlecases a UTF-8 string and optionally records edits.
+ * Casing is locale-dependent and context-sensitive.
+ * The result may be longer or shorter than the original.
+ * The source string and the destination buffer must not overlap.
+ *
+ * Titlecasing uses a break iterator to find the first characters of words
+ * that are to be titlecased. It titlecases those characters and lowercases
+ * all others. (This can be modified with options bits.)
+ *
+ * @param locale The locale ID. ("" = root locale, NULL = default locale.)
+ * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET,
+ * U_TITLECASE_NO_LOWERCASE,
+ * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED,
+ * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES.
+ * @param iter A break iterator to find the first characters of words that are to be titlecased.
+ * It is set to the source string (setUText())
+ * and used one or more times for iteration (first() and next()).
+ * If NULL, then a word break iterator for the locale is used
+ * (or something equivalent).
+ * @param src The original string.
+ * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
+ * @param dest A buffer for the result string. The result will be NUL-terminated if
+ * the buffer is large enough.
+ * The contents is undefined in case of failure.
+ * @param destCapacity The size of the buffer (number of bytes). If it is 0, then
+ * dest may be NULL and the function will only return the length of the result
+ * without writing any of the result string.
+ * @param edits Records edits for index mapping, working with styled text,
+ * and getting only changes (if any).
+ * The Edits contents is undefined if any error occurs.
+ * This function calls edits->reset() first unless
+ * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * @param errorCode Reference to an in/out error code value
+ * which must not indicate a failure before the function call.
+ * @return The length of the result string, if successful.
+ * When the result would be longer than destCapacity,
+ * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
+ *
+ * @see ucasemap_utf8ToTitle
+ * @stable ICU 59
+ */
+ static int32_t utf8ToTitle(
+ const char *locale, uint32_t options, BreakIterator *iter,
+ const char *src, int32_t srcLength,
+ char *dest, int32_t destCapacity, Edits *edits,
+ UErrorCode &errorCode);
+
+#endif // UCONFIG_NO_BREAK_ITERATION
+
+ /**
+ * Case-folds a UTF-8 string and optionally records edits.
+ *
+ * Case folding is locale-independent and not context-sensitive,
+ * but there is an option for whether to include or exclude mappings for dotted I
+ * and dotless i that are marked with 'T' in CaseFolding.txt.
+ *
+ * The result may be longer or shorter than the original.
+ * The source string and the destination buffer must not overlap.
+ *
+ * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET,
+ * U_FOLD_CASE_DEFAULT, U_FOLD_CASE_EXCLUDE_SPECIAL_I.
+ * @param src The original string.
+ * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
+ * @param dest A buffer for the result string. The result will be NUL-terminated if
+ * the buffer is large enough.
+ * The contents is undefined in case of failure.
+ * @param destCapacity The size of the buffer (number of bytes). If it is 0, then
+ * dest may be NULL and the function will only return the length of the result
+ * without writing any of the result string.
+ * @param edits Records edits for index mapping, working with styled text,
+ * and getting only changes (if any).
+ * The Edits contents is undefined if any error occurs.
+ * This function calls edits->reset() first unless
+ * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * @param errorCode Reference to an in/out error code value
+ * which must not indicate a failure before the function call.
+ * @return The length of the result string, if successful.
+ * When the result would be longer than destCapacity,
+ * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
+ *
+ * @see ucasemap_utf8FoldCase
+ * @stable ICU 59
+ */
+ static int32_t utf8Fold(
+ uint32_t options,
+ const char *src, int32_t srcLength,
+ char *dest, int32_t destCapacity, Edits *edits,
+ UErrorCode &errorCode);
+
+private:
+ CaseMap() = delete;
+ CaseMap(const CaseMap &other) = delete;
+ CaseMap &operator=(const CaseMap &other) = delete;
+};
+
+U_NAMESPACE_END
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
+#endif // __CASEMAP_H__
diff --git a/contrib/libs/icu/include/unicode/char16ptr.h b/contrib/libs/icu/include/unicode/char16ptr.h
index 3a7450cc2b..c8a9ae6c35 100644
--- a/contrib/libs/icu/include/unicode/char16ptr.h
+++ b/contrib/libs/icu/include/unicode/char16ptr.h
@@ -1,313 +1,313 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// char16ptr.h
-// created: 2017feb28 Markus W. Scherer
-
-#ifndef __CHAR16PTR_H__
-#define __CHAR16PTR_H__
-
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
-#include <cstddef>
-
-/**
- * \file
- * \brief C++ API: char16_t pointer wrappers with
- * implicit conversion from bit-compatible raw pointer types.
- * Also conversion functions from char16_t * to UChar * and OldUChar *.
- */
-
-U_NAMESPACE_BEGIN
-
-/**
- * \def U_ALIASING_BARRIER
- * Barrier for pointer anti-aliasing optimizations even across function boundaries.
- * @internal
- */
-#ifdef U_ALIASING_BARRIER
- // Use the predefined value.
-#elif (defined(__clang__) || defined(__GNUC__)) && U_PLATFORM != U_PF_BROWSER_NATIVE_CLIENT
-# define U_ALIASING_BARRIER(ptr) asm volatile("" : : "rm"(ptr) : "memory")
-#elif defined(U_IN_DOXYGEN)
-# define U_ALIASING_BARRIER(ptr)
-#endif
-
-/**
- * char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types.
- * @stable ICU 59
- */
-class U_COMMON_API Char16Ptr U_FINAL {
-public:
- /**
- * Copies the pointer.
- * @param p pointer
- * @stable ICU 59
- */
- inline Char16Ptr(char16_t *p);
-#if !U_CHAR16_IS_TYPEDEF
- /**
- * Converts the pointer to char16_t *.
- * @param p pointer to be converted
- * @stable ICU 59
- */
- inline Char16Ptr(uint16_t *p);
-#endif
-#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
- /**
- * Converts the pointer to char16_t *.
- * (Only defined if U_SIZEOF_WCHAR_T==2.)
- * @param p pointer to be converted
- * @stable ICU 59
- */
- inline Char16Ptr(wchar_t *p);
-#endif
- /**
- * nullptr constructor.
- * @param p nullptr
- * @stable ICU 59
- */
- inline Char16Ptr(std::nullptr_t p);
- /**
- * Destructor.
- * @stable ICU 59
- */
- inline ~Char16Ptr();
-
- /**
- * Pointer access.
- * @return the wrapped pointer
- * @stable ICU 59
- */
- inline char16_t *get() const;
- /**
- * char16_t pointer access via type conversion (e.g., static_cast).
- * @return the wrapped pointer
- * @stable ICU 59
- */
- inline operator char16_t *() const { return get(); }
-
-private:
- Char16Ptr() = delete;
-
-#ifdef U_ALIASING_BARRIER
- template<typename T> static char16_t *cast(T *t) {
- U_ALIASING_BARRIER(t);
- return reinterpret_cast<char16_t *>(t);
- }
-
- char16_t *p_;
-#else
- union {
- char16_t *cp;
- uint16_t *up;
- wchar_t *wp;
- } u_;
-#endif
-};
-
-/// \cond
-#ifdef U_ALIASING_BARRIER
-
-Char16Ptr::Char16Ptr(char16_t *p) : p_(p) {}
-#if !U_CHAR16_IS_TYPEDEF
-Char16Ptr::Char16Ptr(uint16_t *p) : p_(cast(p)) {}
-#endif
-#if U_SIZEOF_WCHAR_T==2
-Char16Ptr::Char16Ptr(wchar_t *p) : p_(cast(p)) {}
-#endif
-Char16Ptr::Char16Ptr(std::nullptr_t p) : p_(p) {}
-Char16Ptr::~Char16Ptr() {
- U_ALIASING_BARRIER(p_);
-}
-
-char16_t *Char16Ptr::get() const { return p_; }
-
-#else
-
-Char16Ptr::Char16Ptr(char16_t *p) { u_.cp = p; }
-#if !U_CHAR16_IS_TYPEDEF
-Char16Ptr::Char16Ptr(uint16_t *p) { u_.up = p; }
-#endif
-#if U_SIZEOF_WCHAR_T==2
-Char16Ptr::Char16Ptr(wchar_t *p) { u_.wp = p; }
-#endif
-Char16Ptr::Char16Ptr(std::nullptr_t p) { u_.cp = p; }
-Char16Ptr::~Char16Ptr() {}
-
-char16_t *Char16Ptr::get() const { return u_.cp; }
-
-#endif
-/// \endcond
-
-/**
- * const char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types.
- * @stable ICU 59
- */
-class U_COMMON_API ConstChar16Ptr U_FINAL {
-public:
- /**
- * Copies the pointer.
- * @param p pointer
- * @stable ICU 59
- */
- inline ConstChar16Ptr(const char16_t *p);
-#if !U_CHAR16_IS_TYPEDEF
- /**
- * Converts the pointer to char16_t *.
- * @param p pointer to be converted
- * @stable ICU 59
- */
- inline ConstChar16Ptr(const uint16_t *p);
-#endif
-#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
- /**
- * Converts the pointer to char16_t *.
- * (Only defined if U_SIZEOF_WCHAR_T==2.)
- * @param p pointer to be converted
- * @stable ICU 59
- */
- inline ConstChar16Ptr(const wchar_t *p);
-#endif
- /**
- * nullptr constructor.
- * @param p nullptr
- * @stable ICU 59
- */
- inline ConstChar16Ptr(const std::nullptr_t p);
-
- /**
- * Destructor.
- * @stable ICU 59
- */
- inline ~ConstChar16Ptr();
-
- /**
- * Pointer access.
- * @return the wrapped pointer
- * @stable ICU 59
- */
- inline const char16_t *get() const;
- /**
- * char16_t pointer access via type conversion (e.g., static_cast).
- * @return the wrapped pointer
- * @stable ICU 59
- */
- inline operator const char16_t *() const { return get(); }
-
-private:
- ConstChar16Ptr() = delete;
-
-#ifdef U_ALIASING_BARRIER
- template<typename T> static const char16_t *cast(const T *t) {
- U_ALIASING_BARRIER(t);
- return reinterpret_cast<const char16_t *>(t);
- }
-
- const char16_t *p_;
-#else
- union {
- const char16_t *cp;
- const uint16_t *up;
- const wchar_t *wp;
- } u_;
-#endif
-};
-
-/// \cond
-#ifdef U_ALIASING_BARRIER
-
-ConstChar16Ptr::ConstChar16Ptr(const char16_t *p) : p_(p) {}
-#if !U_CHAR16_IS_TYPEDEF
-ConstChar16Ptr::ConstChar16Ptr(const uint16_t *p) : p_(cast(p)) {}
-#endif
-#if U_SIZEOF_WCHAR_T==2
-ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) : p_(cast(p)) {}
-#endif
-ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) : p_(p) {}
-ConstChar16Ptr::~ConstChar16Ptr() {
- U_ALIASING_BARRIER(p_);
-}
-
-const char16_t *ConstChar16Ptr::get() const { return p_; }
-
-#else
-
-ConstChar16Ptr::ConstChar16Ptr(const char16_t *p) { u_.cp = p; }
-#if !U_CHAR16_IS_TYPEDEF
-ConstChar16Ptr::ConstChar16Ptr(const uint16_t *p) { u_.up = p; }
-#endif
-#if U_SIZEOF_WCHAR_T==2
-ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) { u_.wp = p; }
-#endif
-ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) { u_.cp = p; }
-ConstChar16Ptr::~ConstChar16Ptr() {}
-
-const char16_t *ConstChar16Ptr::get() const { return u_.cp; }
-
-#endif
-/// \endcond
-
-/**
- * Converts from const char16_t * to const UChar *.
- * Includes an aliasing barrier if available.
- * @param p pointer
- * @return p as const UChar *
- * @stable ICU 59
- */
-inline const UChar *toUCharPtr(const char16_t *p) {
-#ifdef U_ALIASING_BARRIER
- U_ALIASING_BARRIER(p);
-#endif
- return reinterpret_cast<const UChar *>(p);
-}
-
-/**
- * Converts from char16_t * to UChar *.
- * Includes an aliasing barrier if available.
- * @param p pointer
- * @return p as UChar *
- * @stable ICU 59
- */
-inline UChar *toUCharPtr(char16_t *p) {
-#ifdef U_ALIASING_BARRIER
- U_ALIASING_BARRIER(p);
-#endif
- return reinterpret_cast<UChar *>(p);
-}
-
-/**
- * Converts from const char16_t * to const OldUChar *.
- * Includes an aliasing barrier if available.
- * @param p pointer
- * @return p as const OldUChar *
- * @stable ICU 59
- */
-inline const OldUChar *toOldUCharPtr(const char16_t *p) {
-#ifdef U_ALIASING_BARRIER
- U_ALIASING_BARRIER(p);
-#endif
- return reinterpret_cast<const OldUChar *>(p);
-}
-
-/**
- * Converts from char16_t * to OldUChar *.
- * Includes an aliasing barrier if available.
- * @param p pointer
- * @return p as OldUChar *
- * @stable ICU 59
- */
-inline OldUChar *toOldUCharPtr(char16_t *p) {
-#ifdef U_ALIASING_BARRIER
- U_ALIASING_BARRIER(p);
-#endif
- return reinterpret_cast<OldUChar *>(p);
-}
-
-U_NAMESPACE_END
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
-#endif // __CHAR16PTR_H__
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// char16ptr.h
+// created: 2017feb28 Markus W. Scherer
+
+#ifndef __CHAR16PTR_H__
+#define __CHAR16PTR_H__
+
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
+#include <cstddef>
+
+/**
+ * \file
+ * \brief C++ API: char16_t pointer wrappers with
+ * implicit conversion from bit-compatible raw pointer types.
+ * Also conversion functions from char16_t * to UChar * and OldUChar *.
+ */
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \def U_ALIASING_BARRIER
+ * Barrier for pointer anti-aliasing optimizations even across function boundaries.
+ * @internal
+ */
+#ifdef U_ALIASING_BARRIER
+ // Use the predefined value.
+#elif (defined(__clang__) || defined(__GNUC__)) && U_PLATFORM != U_PF_BROWSER_NATIVE_CLIENT
+# define U_ALIASING_BARRIER(ptr) asm volatile("" : : "rm"(ptr) : "memory")
+#elif defined(U_IN_DOXYGEN)
+# define U_ALIASING_BARRIER(ptr)
+#endif
+
+/**
+ * char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types.
+ * @stable ICU 59
+ */
+class U_COMMON_API Char16Ptr U_FINAL {
+public:
+ /**
+ * Copies the pointer.
+ * @param p pointer
+ * @stable ICU 59
+ */
+ inline Char16Ptr(char16_t *p);
+#if !U_CHAR16_IS_TYPEDEF
+ /**
+ * Converts the pointer to char16_t *.
+ * @param p pointer to be converted
+ * @stable ICU 59
+ */
+ inline Char16Ptr(uint16_t *p);
+#endif
+#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
+ /**
+ * Converts the pointer to char16_t *.
+ * (Only defined if U_SIZEOF_WCHAR_T==2.)
+ * @param p pointer to be converted
+ * @stable ICU 59
+ */
+ inline Char16Ptr(wchar_t *p);
+#endif
+ /**
+ * nullptr constructor.
+ * @param p nullptr
+ * @stable ICU 59
+ */
+ inline Char16Ptr(std::nullptr_t p);
+ /**
+ * Destructor.
+ * @stable ICU 59
+ */
+ inline ~Char16Ptr();
+
+ /**
+ * Pointer access.
+ * @return the wrapped pointer
+ * @stable ICU 59
+ */
+ inline char16_t *get() const;
+ /**
+ * char16_t pointer access via type conversion (e.g., static_cast).
+ * @return the wrapped pointer
+ * @stable ICU 59
+ */
+ inline operator char16_t *() const { return get(); }
+
+private:
+ Char16Ptr() = delete;
+
+#ifdef U_ALIASING_BARRIER
+ template<typename T> static char16_t *cast(T *t) {
+ U_ALIASING_BARRIER(t);
+ return reinterpret_cast<char16_t *>(t);
+ }
+
+ char16_t *p_;
+#else
+ union {
+ char16_t *cp;
+ uint16_t *up;
+ wchar_t *wp;
+ } u_;
+#endif
+};
+
+/// \cond
+#ifdef U_ALIASING_BARRIER
+
+Char16Ptr::Char16Ptr(char16_t *p) : p_(p) {}
+#if !U_CHAR16_IS_TYPEDEF
+Char16Ptr::Char16Ptr(uint16_t *p) : p_(cast(p)) {}
+#endif
+#if U_SIZEOF_WCHAR_T==2
+Char16Ptr::Char16Ptr(wchar_t *p) : p_(cast(p)) {}
+#endif
+Char16Ptr::Char16Ptr(std::nullptr_t p) : p_(p) {}
+Char16Ptr::~Char16Ptr() {
+ U_ALIASING_BARRIER(p_);
+}
+
+char16_t *Char16Ptr::get() const { return p_; }
+
+#else
+
+Char16Ptr::Char16Ptr(char16_t *p) { u_.cp = p; }
+#if !U_CHAR16_IS_TYPEDEF
+Char16Ptr::Char16Ptr(uint16_t *p) { u_.up = p; }
+#endif
+#if U_SIZEOF_WCHAR_T==2
+Char16Ptr::Char16Ptr(wchar_t *p) { u_.wp = p; }
+#endif
+Char16Ptr::Char16Ptr(std::nullptr_t p) { u_.cp = p; }
+Char16Ptr::~Char16Ptr() {}
+
+char16_t *Char16Ptr::get() const { return u_.cp; }
+
+#endif
+/// \endcond
+
+/**
+ * const char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types.
+ * @stable ICU 59
+ */
+class U_COMMON_API ConstChar16Ptr U_FINAL {
+public:
+ /**
+ * Copies the pointer.
+ * @param p pointer
+ * @stable ICU 59
+ */
+ inline ConstChar16Ptr(const char16_t *p);
+#if !U_CHAR16_IS_TYPEDEF
+ /**
+ * Converts the pointer to char16_t *.
+ * @param p pointer to be converted
+ * @stable ICU 59
+ */
+ inline ConstChar16Ptr(const uint16_t *p);
+#endif
+#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
+ /**
+ * Converts the pointer to char16_t *.
+ * (Only defined if U_SIZEOF_WCHAR_T==2.)
+ * @param p pointer to be converted
+ * @stable ICU 59
+ */
+ inline ConstChar16Ptr(const wchar_t *p);
+#endif
+ /**
+ * nullptr constructor.
+ * @param p nullptr
+ * @stable ICU 59
+ */
+ inline ConstChar16Ptr(const std::nullptr_t p);
+
+ /**
+ * Destructor.
+ * @stable ICU 59
+ */
+ inline ~ConstChar16Ptr();
+
+ /**
+ * Pointer access.
+ * @return the wrapped pointer
+ * @stable ICU 59
+ */
+ inline const char16_t *get() const;
+ /**
+ * char16_t pointer access via type conversion (e.g., static_cast).
+ * @return the wrapped pointer
+ * @stable ICU 59
+ */
+ inline operator const char16_t *() const { return get(); }
+
+private:
+ ConstChar16Ptr() = delete;
+
+#ifdef U_ALIASING_BARRIER
+ template<typename T> static const char16_t *cast(const T *t) {
+ U_ALIASING_BARRIER(t);
+ return reinterpret_cast<const char16_t *>(t);
+ }
+
+ const char16_t *p_;
+#else
+ union {
+ const char16_t *cp;
+ const uint16_t *up;
+ const wchar_t *wp;
+ } u_;
+#endif
+};
+
+/// \cond
+#ifdef U_ALIASING_BARRIER
+
+ConstChar16Ptr::ConstChar16Ptr(const char16_t *p) : p_(p) {}
+#if !U_CHAR16_IS_TYPEDEF
+ConstChar16Ptr::ConstChar16Ptr(const uint16_t *p) : p_(cast(p)) {}
+#endif
+#if U_SIZEOF_WCHAR_T==2
+ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) : p_(cast(p)) {}
+#endif
+ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) : p_(p) {}
+ConstChar16Ptr::~ConstChar16Ptr() {
+ U_ALIASING_BARRIER(p_);
+}
+
+const char16_t *ConstChar16Ptr::get() const { return p_; }
+
+#else
+
+ConstChar16Ptr::ConstChar16Ptr(const char16_t *p) { u_.cp = p; }
+#if !U_CHAR16_IS_TYPEDEF
+ConstChar16Ptr::ConstChar16Ptr(const uint16_t *p) { u_.up = p; }
+#endif
+#if U_SIZEOF_WCHAR_T==2
+ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) { u_.wp = p; }
+#endif
+ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) { u_.cp = p; }
+ConstChar16Ptr::~ConstChar16Ptr() {}
+
+const char16_t *ConstChar16Ptr::get() const { return u_.cp; }
+
+#endif
+/// \endcond
+
+/**
+ * Converts from const char16_t * to const UChar *.
+ * Includes an aliasing barrier if available.
+ * @param p pointer
+ * @return p as const UChar *
+ * @stable ICU 59
+ */
+inline const UChar *toUCharPtr(const char16_t *p) {
+#ifdef U_ALIASING_BARRIER
+ U_ALIASING_BARRIER(p);
+#endif
+ return reinterpret_cast<const UChar *>(p);
+}
+
+/**
+ * Converts from char16_t * to UChar *.
+ * Includes an aliasing barrier if available.
+ * @param p pointer
+ * @return p as UChar *
+ * @stable ICU 59
+ */
+inline UChar *toUCharPtr(char16_t *p) {
+#ifdef U_ALIASING_BARRIER
+ U_ALIASING_BARRIER(p);
+#endif
+ return reinterpret_cast<UChar *>(p);
+}
+
+/**
+ * Converts from const char16_t * to const OldUChar *.
+ * Includes an aliasing barrier if available.
+ * @param p pointer
+ * @return p as const OldUChar *
+ * @stable ICU 59
+ */
+inline const OldUChar *toOldUCharPtr(const char16_t *p) {
+#ifdef U_ALIASING_BARRIER
+ U_ALIASING_BARRIER(p);
+#endif
+ return reinterpret_cast<const OldUChar *>(p);
+}
+
+/**
+ * Converts from char16_t * to OldUChar *.
+ * Includes an aliasing barrier if available.
+ * @param p pointer
+ * @return p as OldUChar *
+ * @stable ICU 59
+ */
+inline OldUChar *toOldUCharPtr(char16_t *p) {
+#ifdef U_ALIASING_BARRIER
+ U_ALIASING_BARRIER(p);
+#endif
+ return reinterpret_cast<OldUChar *>(p);
+}
+
+U_NAMESPACE_END
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
+#endif // __CHAR16PTR_H__
diff --git a/contrib/libs/icu/include/unicode/chariter.h b/contrib/libs/icu/include/unicode/chariter.h
index 25f29b9f4b..db86f79e42 100644
--- a/contrib/libs/icu/include/unicode/chariter.h
+++ b/contrib/libs/icu/include/unicode/chariter.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************
@@ -13,9 +13,9 @@
#define CHARITER_H
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
#include "unicode/unistr.h"
/**
@@ -81,7 +81,7 @@ U_NAMESPACE_BEGIN
* }
*
* void function1(ForwardCharacterIterator &it) {
- * char16_t c;
+ * char16_t c;
* while((c=it.nextPostInc())!=ForwardCharacterIterator::DONE) {
* // use c
* }
@@ -152,7 +152,7 @@ public:
* @return the current code unit.
* @stable ICU 2.0
*/
- virtual char16_t nextPostInc(void) = 0;
+ virtual char16_t nextPostInc(void) = 0;
/**
* Gets the current code point for returning and advances to the next code point
@@ -233,7 +233,7 @@ protected:
* showing a way to convert simple for() loops:
* \code
* void forward2(CharacterIterator &it) {
- * char16_t c;
+ * char16_t c;
* for(c=it.firstPostInc(); c!=CharacterIterator::DONE; c=it.nextPostInc()) {
* // use c
* }
@@ -252,7 +252,7 @@ protected:
* Backward iteration with a more traditional for() loop:
* \code
* void backward2(CharacterIterator &it) {
- * char16_t c;
+ * char16_t c;
* for(c=it.last(); c!=CharacterIterator::DONE; c=it.previous()) {
* // use c
* }
@@ -269,7 +269,7 @@ protected:
* // get the position
* int32_t pos=it.getIndex();
* // get the previous code unit
- * char16_t u=it.previous();
+ * char16_t u=it.previous();
* // move back one more code unit
* it.move(-1, CharacterIterator::kCurrent);
* // set the position back to where it was
@@ -286,7 +286,7 @@ protected:
* Function processing characters, in this example simple output
* <pre>
* \code
- * void processChar( char16_t c )
+ * void processChar( char16_t c )
* {
* cout << " " << c;
* }
@@ -297,7 +297,7 @@ protected:
* \code
* void traverseForward(CharacterIterator& iter)
* {
- * for(char16_t c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
+ * for(char16_t c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
* processChar(c);
* }
* }
@@ -308,7 +308,7 @@ protected:
* \code
* void traverseBackward(CharacterIterator& iter)
* {
- * for(char16_t c = iter.last(); c != CharacterIterator.DONE; c = iter.previous()) {
+ * for(char16_t c = iter.last(); c != CharacterIterator.DONE; c = iter.previous()) {
* processChar(c);
* }
* }
@@ -320,7 +320,7 @@ protected:
* \code
* void traverseOut(CharacterIterator& iter, int32_t pos)
* {
- * char16_t c;
+ * char16_t c;
* for (c = iter.setIndex(pos);
* c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c));
* c = iter.next()) {}
@@ -380,7 +380,7 @@ public:
* @return a pointer to a new CharacterIterator
* @stable ICU 2.0
*/
- virtual CharacterIterator* clone() const = 0;
+ virtual CharacterIterator* clone() const = 0;
/**
* Sets the iterator to refer to the first code unit in its
@@ -389,7 +389,7 @@ public:
* @return the first code unit in its iteration range.
* @stable ICU 2.0
*/
- virtual char16_t first(void) = 0;
+ virtual char16_t first(void) = 0;
/**
* Sets the iterator to refer to the first code unit in its
@@ -399,7 +399,7 @@ public:
* @return the first code unit in its iteration range.
* @stable ICU 2.0
*/
- virtual char16_t firstPostInc(void);
+ virtual char16_t firstPostInc(void);
/**
* Sets the iterator to refer to the first code point in its
@@ -438,7 +438,7 @@ public:
* @return the last code unit.
* @stable ICU 2.0
*/
- virtual char16_t last(void) = 0;
+ virtual char16_t last(void) = 0;
/**
* Sets the iterator to refer to the last code point in its
@@ -466,7 +466,7 @@ public:
* @return the "position"-th code unit.
* @stable ICU 2.0
*/
- virtual char16_t setIndex(int32_t position) = 0;
+ virtual char16_t setIndex(int32_t position) = 0;
/**
* Sets the iterator to refer to the beginning of the code point
@@ -486,7 +486,7 @@ public:
* @return the current code unit.
* @stable ICU 2.0
*/
- virtual char16_t current(void) const = 0;
+ virtual char16_t current(void) const = 0;
/**
* Returns the code point the iterator currently refers to.
@@ -502,7 +502,7 @@ public:
* @return the next code unit.
* @stable ICU 2.0
*/
- virtual char16_t next(void) = 0;
+ virtual char16_t next(void) = 0;
/**
* Advances to the next code point in the iteration range
@@ -523,7 +523,7 @@ public:
* @return the previous code unit.
* @stable ICU 2.0
*/
- virtual char16_t previous(void) = 0;
+ virtual char16_t previous(void) = 0;
/**
* Advances to the previous code point in the iteration range
@@ -572,7 +572,7 @@ public:
* Returns the numeric index in the underlying text-storage
* object of the character the iterator currently refers to
* (i.e., the character returned by current()).
- * @return the numeric index in the text-storage object of
+ * @return the numeric index in the text-storage object of
* the character the iterator currently refers to
* @stable ICU 2.0
*/
@@ -610,10 +610,10 @@ public:
* @return the new position
* @stable ICU 2.0
*/
-#ifdef move32
- // One of the system headers right now is sometimes defining a conflicting macro we don't use
-#undef move32
-#endif
+#ifdef move32
+ // One of the system headers right now is sometimes defining a conflicting macro we don't use
+#undef move32
+#endif
virtual int32_t move32(int32_t delta, EOrigin origin) = 0;
/**
@@ -728,7 +728,7 @@ CharacterIterator::getLength(void) const {
}
U_NAMESPACE_END
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/choicfmt.h b/contrib/libs/icu/include/unicode/choicfmt.h
index 107e621591..3b2f48cb1f 100644
--- a/contrib/libs/icu/include/unicode/choicfmt.h
+++ b/contrib/libs/icu/include/unicode/choicfmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -26,8 +26,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: Choice Format.
@@ -41,8 +41,8 @@
#include "unicode/numfmt.h"
#include "unicode/unistr.h"
-#ifndef U_HIDE_DEPRECATED_API
-
+#ifndef U_HIDE_DEPRECATED_API
+
U_NAMESPACE_BEGIN
class MessageFormat;
@@ -251,7 +251,7 @@ public:
* @return a copy of this object
* @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments.
*/
- virtual ChoiceFormat* clone() const;
+ virtual ChoiceFormat* clone() const;
/**
* Returns true if the given Format objects are semantically equal.
@@ -595,7 +595,7 @@ U_NAMESPACE_END
#endif // U_HIDE_DEPRECATED_API
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // CHOICFMT_H
//eof
diff --git a/contrib/libs/icu/include/unicode/coleitr.h b/contrib/libs/icu/include/unicode/coleitr.h
index aa3ef43ceb..e3ec0e01a1 100644
--- a/contrib/libs/icu/include/unicode/coleitr.h
+++ b/contrib/libs/icu/include/unicode/coleitr.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -35,8 +35,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_COLLATION
#include "unicode/unistr.h"
@@ -49,7 +49,7 @@ U_NAMESPACE_BEGIN
struct CollationData;
-class CharacterIterator;
+class CharacterIterator;
class CollationIterator;
class RuleBasedCollator;
class UCollationPCE;
@@ -406,6 +406,6 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_COLLATION */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/coll.h b/contrib/libs/icu/include/unicode/coll.h
index 72b6e2103d..f5564c7394 100644
--- a/contrib/libs/icu/include/unicode/coll.h
+++ b/contrib/libs/icu/include/unicode/coll.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -54,13 +54,13 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_COLLATION
#include "unicode/uobject.h"
#include "unicode/ucol.h"
-#include "unicode/unorm.h"
+#include "unicode/unorm.h"
#include "unicode/locid.h"
#include "unicode/uniset.h"
#include "unicode/umisc.h"
@@ -160,7 +160,7 @@ class CollationKey;
* @see CollationKey
* @see CollationElementIterator
* @see Locale
-* @see Normalizer2
+* @see Normalizer2
* @version 2.0 11/15/01
*/
@@ -206,7 +206,7 @@ public:
// Cannot use #ifndef U_HIDE_DEPRECATED_API for the following, it is
// used by virtual methods that cannot have that conditional.
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* LESS is returned if source string is compared to be less than target
* string in the compare() method.
@@ -223,7 +223,7 @@ public:
EQUAL = UCOL_EQUAL, // 0
GREATER = UCOL_GREATER // 1
};
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
// Collator public destructor -----------------------------------------
@@ -239,16 +239,16 @@ public:
* Returns TRUE if "other" is the same as "this".
*
* The base class implementation returns TRUE if "other" has the same type/class as "this":
- * `typeid(*this) == typeid(other)`.
+ * `typeid(*this) == typeid(other)`.
*
* Subclass implementations should do something like the following:
*
- * if (this == &other) { return TRUE; }
- * if (!Collator::operator==(other)) { return FALSE; } // not the same class
- *
- * const MyCollator &o = (const MyCollator&)other;
- * (compare this vs. o's subclass fields)
- *
+ * if (this == &other) { return TRUE; }
+ * if (!Collator::operator==(other)) { return FALSE; } // not the same class
+ *
+ * const MyCollator &o = (const MyCollator&)other;
+ * (compare this vs. o's subclass fields)
+ *
* @param other Collator object to be compared
* @return TRUE if other is the same as this.
* @stable ICU 2.0
@@ -269,7 +269,7 @@ public:
* @return a copy of this object, owned by the caller
* @stable ICU 2.0
*/
- virtual Collator* clone() const = 0;
+ virtual Collator* clone() const = 0;
/**
* Creates the Collator object for the current default locale.
@@ -327,7 +327,7 @@ public:
*/
static Collator* U_EXPORT2 createInstance(const Locale& loc, UErrorCode& err);
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* The comparison function compares the character data stored in two
* different strings. Returns information about whether a string is less
@@ -341,7 +341,7 @@ public:
*/
virtual EComparisonResult compare(const UnicodeString& source,
const UnicodeString& target) const;
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* The comparison function compares the character data stored in two
@@ -359,7 +359,7 @@ public:
const UnicodeString& target,
UErrorCode &status) const = 0;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Does the same thing as compare but limits the comparison to a specified
* length
@@ -375,7 +375,7 @@ public:
virtual EComparisonResult compare(const UnicodeString& source,
const UnicodeString& target,
int32_t length) const;
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Does the same thing as compare but limits the comparison to a specified
@@ -395,15 +395,15 @@ public:
int32_t length,
UErrorCode &status) const = 0;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* The comparison function compares the character data stored in two
* different string arrays. Returns information about whether a string array
* is less than, greater than or equal to another string array.
* <p>Example of use:
* <pre>
- * . char16_t ABC[] = {0x41, 0x42, 0x43, 0}; // = "ABC"
- * . char16_t abc[] = {0x61, 0x62, 0x63, 0}; // = "abc"
+ * . char16_t ABC[] = {0x41, 0x42, 0x43, 0}; // = "ABC"
+ * . char16_t abc[] = {0x61, 0x62, 0x63, 0}; // = "abc"
* . UErrorCode status = U_ZERO_ERROR;
* . Collator *myCollation =
* . Collator::createInstance(Locale::getUS(), status);
@@ -429,10 +429,10 @@ public:
* target
* @deprecated ICU 2.6 use the overload with UErrorCode &
*/
- virtual EComparisonResult compare(const char16_t* source, int32_t sourceLength,
- const char16_t* target, int32_t targetLength)
+ virtual EComparisonResult compare(const char16_t* source, int32_t sourceLength,
+ const char16_t* target, int32_t targetLength)
const;
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* The comparison function compares the character data stored in two
@@ -450,8 +450,8 @@ public:
* than target
* @stable ICU 2.6
*/
- virtual UCollationResult compare(const char16_t* source, int32_t sourceLength,
- const char16_t* target, int32_t targetLength,
+ virtual UCollationResult compare(const char16_t* source, int32_t sourceLength,
+ const char16_t* target, int32_t targetLength,
UErrorCode &status) const = 0;
/**
@@ -527,7 +527,7 @@ public:
* @see CollationKey#compare
* @stable ICU 2.0
*/
- virtual CollationKey& getCollationKey(const char16_t*source,
+ virtual CollationKey& getCollationKey(const char16_t*source,
int32_t sourceLength,
CollationKey& key,
UErrorCode& status) const = 0;
@@ -537,7 +537,7 @@ public:
*/
virtual int32_t hashCode(void) const = 0;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Gets the locale of the Collator
*
@@ -551,7 +551,7 @@ public:
* in ICU 3.0.
*/
virtual Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const = 0;
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Convenience method for comparing two strings based on the collation rules.
@@ -588,7 +588,7 @@ public:
*/
UBool equals(const UnicodeString& source, const UnicodeString& target) const;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Determines the minimum strength that will be used in comparison or
* transformation.
@@ -620,7 +620,7 @@ public:
* @deprecated ICU 2.6 Use setAttribute(UCOL_STRENGTH...) instead
*/
virtual void setStrength(ECollationStrength newStrength);
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Retrieves the reordering codes for this collator.
@@ -686,7 +686,7 @@ public:
UErrorCode& status);
/**
- * Get name of the object for the desired Locale, in the desired language
+ * Get name of the object for the desired Locale, in the desired language
* @param objectLocale must be from getAvailableLocales
* @param displayLocale specifies the desired locale for output
* @param name the fill-in parameter of the return value
@@ -699,7 +699,7 @@ public:
UnicodeString& name);
/**
- * Get name of the object for the desired Locale, in the language of the
+ * Get name of the object for the desired Locale, in the language of the
* default locale.
* @param objectLocale must be from getAvailableLocales
* @param name the fill-in parameter of the return value
@@ -918,7 +918,7 @@ public:
*/
virtual UColReorderCode getMaxVariable() const;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Sets the variable top to the primary weight of the specified string.
*
@@ -926,7 +926,7 @@ public:
* the top of one of the supported reordering groups,
* and it must not be beyond the last of those groups.
* See setMaxVariable().
- * @param varTop one or more (if contraction) char16_ts to which the variable top should be set
+ * @param varTop one or more (if contraction) char16_ts to which the variable top should be set
* @param len length of variable top string. If -1 it is considered to be zero terminated.
* @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br>
* U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction<br>
@@ -935,7 +935,7 @@ public:
* @return variable top primary weight
* @deprecated ICU 53 Call setMaxVariable() instead.
*/
- virtual uint32_t setVariableTop(const char16_t *varTop, int32_t len, UErrorCode &status) = 0;
+ virtual uint32_t setVariableTop(const char16_t *varTop, int32_t len, UErrorCode &status) = 0;
/**
* Sets the variable top to the primary weight of the specified string.
@@ -944,7 +944,7 @@ public:
* the top of one of the supported reordering groups,
* and it must not be beyond the last of those groups.
* See setMaxVariable().
- * @param varTop a UnicodeString size 1 or more (if contraction) of char16_ts to which the variable top should be set
+ * @param varTop a UnicodeString size 1 or more (if contraction) of char16_ts to which the variable top should be set
* @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br>
* U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction<br>
* U_ILLEGAL_ARGUMENT_ERROR if the variable top is beyond
@@ -966,7 +966,7 @@ public:
* @deprecated ICU 53 Call setMaxVariable() instead.
*/
virtual void setVariableTop(uint32_t varTop, UErrorCode &status) = 0;
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Gets the variable top value of a Collator.
@@ -988,7 +988,7 @@ public:
*/
virtual UnicodeSet *getTailoredSet(UErrorCode &status) const;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Same as clone().
* The base class implementation simply calls clone().
@@ -996,8 +996,8 @@ public:
* @see clone()
* @deprecated ICU 50 no need to have two methods for cloning
*/
- virtual Collator* safeClone() const;
-#endif // U_FORCE_HIDE_DEPRECATED_API
+ virtual Collator* safeClone() const;
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Get the sort key as an array of bytes from a UnicodeString.
@@ -1020,7 +1020,7 @@ public:
int32_t resultLength) const = 0;
/**
- * Get the sort key as an array of bytes from a char16_t buffer.
+ * Get the sort key as an array of bytes from a char16_t buffer.
* Sort key byte arrays are zero-terminated and can be compared using
* strcmp().
*
@@ -1038,7 +1038,7 @@ public:
* @return Number of bytes needed for storing the sort key
* @stable ICU 2.2
*/
- virtual int32_t getSortKey(const char16_t*source, int32_t sourceLength,
+ virtual int32_t getSortKey(const char16_t*source, int32_t sourceLength,
uint8_t*result, int32_t resultLength) const = 0;
/**
@@ -1289,6 +1289,6 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_COLLATION */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/compactdecimalformat.h b/contrib/libs/icu/include/unicode/compactdecimalformat.h
index 199031e8b9..9c1e200996 100644
--- a/contrib/libs/icu/include/unicode/compactdecimalformat.h
+++ b/contrib/libs/icu/include/unicode/compactdecimalformat.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -14,12 +14,12 @@
#define __COMPACT_DECIMAL_FORMAT_H__
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
- * \brief C++ API: Compatibility APIs for compact decimal number formatting.
+ * \brief C++ API: Compatibility APIs for compact decimal number formatting.
*/
#if !UCONFIG_NO_FORMATTING
@@ -33,31 +33,31 @@ U_NAMESPACE_BEGIN
class PluralRules;
/**
- * **IMPORTANT:** New users are strongly encouraged to see if
- * numberformatter.h fits their use case. Although not deprecated, this header
- * is provided for backwards compatibility only.
- *
- * -----------------------------------------------------------------------------
- *
+ * **IMPORTANT:** New users are strongly encouraged to see if
+ * numberformatter.h fits their use case. Although not deprecated, this header
+ * is provided for backwards compatibility only.
+ *
+ * -----------------------------------------------------------------------------
+ *
* The CompactDecimalFormat produces abbreviated numbers, suitable for display in
* environments will limited real estate. For example, 'Hits: 1.2B' instead of
* 'Hits: 1,200,000,000'. The format will be appropriate for the given language,
* such as "1,2 Mrd." for German.
- *
+ *
* For numbers under 1000 trillion (under 10^15, such as 123,456,789,012,345),
* the result will be short for supported languages. However, the result may
* sometimes exceed 7 characters, such as when there are combining marks or thin
* characters. In such cases, the visual width in fonts should still be short.
- *
+ *
* By default, there are 3 significant digits. After creation, if more than
* three significant digits are set (with setMaximumSignificantDigits), or if a
* fixed number of digits are set (with setMaximumIntegerDigits or
* setMaximumFractionDigits), then result may be wider.
- *
+ *
* At this time, parsing is not supported, and will produce a U_UNSUPPORTED_ERROR.
* Resetting the pattern prefixes or suffixes is not supported; the method calls
* are ignored.
- *
+ *
* @stable ICU 51
*/
class U_I18N_API CompactDecimalFormat : public DecimalFormat {
@@ -65,9 +65,9 @@ public:
/**
* Returns a compact decimal instance for specified locale.
- *
- * **NOTE:** New users are strongly encouraged to use
- * `number::NumberFormatter` instead of NumberFormat.
+ *
+ * **NOTE:** New users are strongly encouraged to use
+ * `number::NumberFormatter` instead of NumberFormat.
* @param inLocale the given locale.
* @param style whether to use short or long style.
* @param status error code returned here.
@@ -88,7 +88,7 @@ public:
* Destructor.
* @stable ICU 51
*/
- ~CompactDecimalFormat() U_OVERRIDE;
+ ~CompactDecimalFormat() U_OVERRIDE;
/**
* Assignment operator.
@@ -105,21 +105,21 @@ public:
* @return a polymorphic copy of this CompactDecimalFormat.
* @stable ICU 51
*/
- CompactDecimalFormat* clone() const U_OVERRIDE;
+ CompactDecimalFormat* clone() const U_OVERRIDE;
using DecimalFormat::format;
/**
- * CompactDecimalFormat does not support parsing. This implementation
- * does nothing.
- * @param text Unused.
- * @param result Does not change.
- * @param parsePosition Does not change.
- * @see Formattable
+ * CompactDecimalFormat does not support parsing. This implementation
+ * does nothing.
+ * @param text Unused.
+ * @param result Does not change.
+ * @param parsePosition Does not change.
+ * @see Formattable
* @stable ICU 51
*/
- void parse(const UnicodeString& text, Formattable& result,
- ParsePosition& parsePosition) const U_OVERRIDE;
+ void parse(const UnicodeString& text, Formattable& result,
+ ParsePosition& parsePosition) const U_OVERRIDE;
/**
* CompactDecimalFormat does not support parsing. This implementation
@@ -130,9 +130,9 @@ public:
* @param status Always set to U_UNSUPPORTED_ERROR.
* @stable ICU 51
*/
- void parse(const UnicodeString& text, Formattable& result, UErrorCode& status) const U_OVERRIDE;
+ void parse(const UnicodeString& text, Formattable& result, UErrorCode& status) const U_OVERRIDE;
-#ifndef U_HIDE_INTERNAL_API
+#ifndef U_HIDE_INTERNAL_API
/**
* Parses text from the given string as a currency amount. Unlike
* the parse() method, this method will attempt to parse a generic
@@ -153,8 +153,8 @@ public:
* the parsed currency; if parse fails, this is NULL.
* @internal
*/
- CurrencyAmount* parseCurrency(const UnicodeString& text, ParsePosition& pos) const U_OVERRIDE;
-#endif /* U_HIDE_INTERNAL_API */
+ CurrencyAmount* parseCurrency(const UnicodeString& text, ParsePosition& pos) const U_OVERRIDE;
+#endif /* U_HIDE_INTERNAL_API */
/**
* Return the class ID for this class. This is useful only for
@@ -180,17 +180,17 @@ public:
* other classes have different class IDs.
* @stable ICU 51
*/
- UClassID getDynamicClassID() const U_OVERRIDE;
+ UClassID getDynamicClassID() const U_OVERRIDE;
- private:
- CompactDecimalFormat(const Locale& inLocale, UNumberCompactStyle style, UErrorCode& status);
+ private:
+ CompactDecimalFormat(const Locale& inLocale, UNumberCompactStyle style, UErrorCode& status);
};
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __COMPACT_DECIMAL_FORMAT_H__
//eof
diff --git a/contrib/libs/icu/include/unicode/curramt.h b/contrib/libs/icu/include/unicode/curramt.h
index 9278007d23..5cfe1cf75e 100644
--- a/contrib/libs/icu/include/unicode/curramt.h
+++ b/contrib/libs/icu/include/unicode/curramt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -15,8 +15,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
#include "unicode/measure.h"
@@ -48,7 +48,7 @@ class U_I18N_API CurrencyAmount: public Measure {
* is invalid, then this will be set to a failing value.
* @stable ICU 3.0
*/
- CurrencyAmount(const Formattable& amount, ConstChar16Ptr isoCode,
+ CurrencyAmount(const Formattable& amount, ConstChar16Ptr isoCode,
UErrorCode &ec);
/**
@@ -61,7 +61,7 @@ class U_I18N_API CurrencyAmount: public Measure {
* then this will be set to a failing value.
* @stable ICU 3.0
*/
- CurrencyAmount(double amount, ConstChar16Ptr isoCode,
+ CurrencyAmount(double amount, ConstChar16Ptr isoCode,
UErrorCode &ec);
/**
@@ -81,7 +81,7 @@ class U_I18N_API CurrencyAmount: public Measure {
* have the same class as returned by getDynamicClassID().
* @stable ICU 3.0
*/
- virtual CurrencyAmount* clone() const;
+ virtual CurrencyAmount* clone() const;
/**
* Destructor
@@ -117,21 +117,21 @@ class U_I18N_API CurrencyAmount: public Measure {
* Return the ISO currency code of this object.
* @stable ICU 3.0
*/
- inline const char16_t* getISOCurrency() const;
+ inline const char16_t* getISOCurrency() const;
};
inline const CurrencyUnit& CurrencyAmount::getCurrency() const {
return (const CurrencyUnit&) getUnit();
}
-inline const char16_t* CurrencyAmount::getISOCurrency() const {
+inline const char16_t* CurrencyAmount::getISOCurrency() const {
return getCurrency().getISOCurrency();
}
U_NAMESPACE_END
#endif // !UCONFIG_NO_FORMATTING
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __CURRENCYAMOUNT_H__
diff --git a/contrib/libs/icu/include/unicode/currpinf.h b/contrib/libs/icu/include/unicode/currpinf.h
index 91882f5e3a..fb0b2a7dbc 100644
--- a/contrib/libs/icu/include/unicode/currpinf.h
+++ b/contrib/libs/icu/include/unicode/currpinf.h
@@ -1,8 +1,8 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
- * Copyright (C) 2009-2015, International Business Machines Corporation and *
+ * Copyright (C) 2009-2015, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@@ -11,8 +11,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: Currency Plural Information used by Decimal Format
@@ -242,33 +242,33 @@ private:
/*
* The plural rule is used to format currency plural name,
* for example: "3.00 US Dollars".
- * If there are 3 currency signs in the currency pattern,
+ * If there are 3 currency signs in the currency pattern,
* the 3 currency signs will be replaced by currency plural name.
*/
PluralRules* fPluralRules;
// locale
Locale* fLocale;
-
-private:
- /**
- * An internal status variable used to indicate that the object is in an 'invalid' state.
- * Used by copy constructor, the assignment operator and the clone method.
- */
- UErrorCode fInternalStatus;
+
+private:
+ /**
+ * An internal status variable used to indicate that the object is in an 'invalid' state.
+ * Used by copy constructor, the assignment operator and the clone method.
+ */
+ UErrorCode fInternalStatus;
};
inline UBool
-CurrencyPluralInfo::operator!=(const CurrencyPluralInfo& info) const {
- return !operator==(info);
-}
+CurrencyPluralInfo::operator!=(const CurrencyPluralInfo& info) const {
+ return !operator==(info);
+}
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _CURRPINFO
//eof
diff --git a/contrib/libs/icu/include/unicode/currunit.h b/contrib/libs/icu/include/unicode/currunit.h
index 6020a3dc76..9b608fdeef 100644
--- a/contrib/libs/icu/include/unicode/currunit.h
+++ b/contrib/libs/icu/include/unicode/currunit.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -15,8 +15,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
#include "unicode/measunit.h"
@@ -30,7 +30,7 @@ U_NAMESPACE_BEGIN
/**
* A unit of currency, such as USD (U.S. dollars) or JPY (Japanese
- * yen). This class is a thin wrapper over a char16_t string that
+ * yen). This class is a thin wrapper over a char16_t string that
* subclasses MeasureUnit, for use with Measure and MeasureFormat.
*
* @author Alan Liu
@@ -39,51 +39,51 @@ U_NAMESPACE_BEGIN
class U_I18N_API CurrencyUnit: public MeasureUnit {
public:
/**
- * Default constructor. Initializes currency code to "XXX" (no currency).
- * @stable ICU 60
- */
- CurrencyUnit();
-
- /**
+ * Default constructor. Initializes currency code to "XXX" (no currency).
+ * @stable ICU 60
+ */
+ CurrencyUnit();
+
+ /**
* Construct an object with the given ISO currency code.
- *
- * @param isoCode the 3-letter ISO 4217 currency code; must have
- * length 3 and need not be NUL-terminated. If NULL, the currency
- * is initialized to the unknown currency XXX.
+ *
+ * @param isoCode the 3-letter ISO 4217 currency code; must have
+ * length 3 and need not be NUL-terminated. If NULL, the currency
+ * is initialized to the unknown currency XXX.
* @param ec input-output error code. If the isoCode is invalid,
* then this will be set to a failing value.
* @stable ICU 3.0
*/
- CurrencyUnit(ConstChar16Ptr isoCode, UErrorCode &ec);
+ CurrencyUnit(ConstChar16Ptr isoCode, UErrorCode &ec);
+
+ /**
+ * Construct an object with the given ISO currency code.
+ *
+ * @param isoCode the 3-letter ISO 4217 currency code; must have
+ * length 3. If invalid, the currency is initialized to XXX.
+ * @param ec input-output error code. If the isoCode is invalid,
+ * then this will be set to a failing value.
+ * @stable ICU 64
+ */
+ CurrencyUnit(StringPiece isoCode, UErrorCode &ec);
/**
- * Construct an object with the given ISO currency code.
- *
- * @param isoCode the 3-letter ISO 4217 currency code; must have
- * length 3. If invalid, the currency is initialized to XXX.
- * @param ec input-output error code. If the isoCode is invalid,
- * then this will be set to a failing value.
- * @stable ICU 64
- */
- CurrencyUnit(StringPiece isoCode, UErrorCode &ec);
-
- /**
* Copy constructor
* @stable ICU 3.0
*/
CurrencyUnit(const CurrencyUnit& other);
/**
- * Copy constructor from MeasureUnit. This constructor allows you to
- * restore a CurrencyUnit that was sliced to MeasureUnit.
- *
- * @param measureUnit The MeasureUnit to copy from.
- * @param ec Set to a failing value if the MeasureUnit is not a currency.
- * @stable ICU 60
- */
- CurrencyUnit(const MeasureUnit& measureUnit, UErrorCode &ec);
-
- /**
+ * Copy constructor from MeasureUnit. This constructor allows you to
+ * restore a CurrencyUnit that was sliced to MeasureUnit.
+ *
+ * @param measureUnit The MeasureUnit to copy from.
+ * @param ec Set to a failing value if the MeasureUnit is not a currency.
+ * @stable ICU 60
+ */
+ CurrencyUnit(const MeasureUnit& measureUnit, UErrorCode &ec);
+
+ /**
* Assignment operator
* @stable ICU 3.0
*/
@@ -94,7 +94,7 @@ class U_I18N_API CurrencyUnit: public MeasureUnit {
* have the same class as returned by getDynamicClassID().
* @stable ICU 3.0
*/
- virtual CurrencyUnit* clone() const;
+ virtual CurrencyUnit* clone() const;
/**
* Destructor
@@ -124,23 +124,23 @@ class U_I18N_API CurrencyUnit: public MeasureUnit {
* Return the ISO currency code of this object.
* @stable ICU 3.0
*/
- inline const char16_t* getISOCurrency() const;
+ inline const char16_t* getISOCurrency() const;
private:
/**
* The ISO 4217 code of this object.
*/
- char16_t isoCode[4];
+ char16_t isoCode[4];
};
-inline const char16_t* CurrencyUnit::getISOCurrency() const {
+inline const char16_t* CurrencyUnit::getISOCurrency() const {
return isoCode;
}
U_NAMESPACE_END
#endif // !UCONFIG_NO_FORMATTING
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __CURRENCYUNIT_H__
diff --git a/contrib/libs/icu/include/unicode/datefmt.h b/contrib/libs/icu/include/unicode/datefmt.h
index 6905b544b0..f106e821a7 100644
--- a/contrib/libs/icu/include/unicode/datefmt.h
+++ b/contrib/libs/icu/include/unicode/datefmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -23,8 +23,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
#include "unicode/udat.h"
@@ -45,17 +45,17 @@ U_NAMESPACE_BEGIN
class TimeZone;
class DateTimePatternGenerator;
-/**
- * \cond
- * Export an explicit template instantiation. (See digitlst.h, datefmt.h, and others.)
- * (When building DLLs for Windows this is required.)
- */
-#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN && !defined(U_IN_DOXYGEN)
+/**
+ * \cond
+ * Export an explicit template instantiation. (See digitlst.h, datefmt.h, and others.)
+ * (When building DLLs for Windows this is required.)
+ */
+#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN && !defined(U_IN_DOXYGEN)
template class U_I18N_API EnumSet<UDateFormatBooleanAttribute,
0,
UDAT_BOOLEAN_ATTRIBUTE_COUNT>;
#endif
-/** \endcond */
+/** \endcond */
/**
* DateFormat is an abstract class for a family of classes that convert dates and
@@ -224,14 +224,14 @@ public:
virtual ~DateFormat();
/**
- * Clones this object polymorphically.
- * The caller owns the result and should delete it when done.
- * @return clone, or nullptr if an error occurred
- * @stable ICU 2.0
- */
- virtual DateFormat* clone() const = 0;
-
- /**
+ * Clones this object polymorphically.
+ * The caller owns the result and should delete it when done.
+ * @return clone, or nullptr if an error occurred
+ * @stable ICU 2.0
+ */
+ virtual DateFormat* clone() const = 0;
+
+ /**
* Equality operator. Returns true if the two formats have the same behavior.
* @stable ICU 2.0
*/
@@ -963,7 +963,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _DATEFMT
//eof
diff --git a/contrib/libs/icu/include/unicode/dbbi.h b/contrib/libs/icu/include/unicode/dbbi.h
index 03ac003742..3de9cc3814 100644
--- a/contrib/libs/icu/include/unicode/dbbi.h
+++ b/contrib/libs/icu/include/unicode/dbbi.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -13,10 +13,10 @@
#ifndef DBBI_H
#define DBBI_H
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/rbbi.h"
#if !UCONFIG_NO_BREAK_ITERATION
@@ -43,6 +43,6 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/dcfmtsym.h b/contrib/libs/icu/include/unicode/dcfmtsym.h
index 56c89fcf95..582e7533a4 100644
--- a/contrib/libs/icu/include/unicode/dcfmtsym.h
+++ b/contrib/libs/icu/include/unicode/dcfmtsym.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -29,16 +29,16 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
-#include "unicode/uchar.h"
+#include "unicode/uchar.h"
#include "unicode/uobject.h"
#include "unicode/locid.h"
-#include "unicode/numsys.h"
+#include "unicode/numsys.h"
#include "unicode/unum.h"
-#include "unicode/unistr.h"
+#include "unicode/unistr.h"
/**
* \file
@@ -184,24 +184,24 @@ public:
DecimalFormatSymbols(const Locale& locale, UErrorCode& status);
/**
- * Creates a DecimalFormatSymbols instance for the given locale with digits and symbols
- * corresponding to the given NumberingSystem.
- *
- * This constructor behaves equivalently to the normal constructor called with a locale having a
- * "numbers=xxxx" keyword specifying the numbering system by name.
- *
- * In this constructor, the NumberingSystem argument will be used even if the locale has its own
- * "numbers=xxxx" keyword.
- *
- * @param locale The locale to get symbols for.
- * @param ns The numbering system.
- * @param status Input/output parameter, set to success or
- * failure code upon return.
- * @stable ICU 60
- */
- DecimalFormatSymbols(const Locale& locale, const NumberingSystem& ns, UErrorCode& status);
-
- /**
+ * Creates a DecimalFormatSymbols instance for the given locale with digits and symbols
+ * corresponding to the given NumberingSystem.
+ *
+ * This constructor behaves equivalently to the normal constructor called with a locale having a
+ * "numbers=xxxx" keyword specifying the numbering system by name.
+ *
+ * In this constructor, the NumberingSystem argument will be used even if the locale has its own
+ * "numbers=xxxx" keyword.
+ *
+ * @param locale The locale to get symbols for.
+ * @param ns The numbering system.
+ * @param status Input/output parameter, set to success or
+ * failure code upon return.
+ * @stable ICU 60
+ */
+ DecimalFormatSymbols(const Locale& locale, const NumberingSystem& ns, UErrorCode& status);
+
+ /**
* Create a DecimalFormatSymbols object for the default locale.
* This constructor will not fail. If the resource file data is
* not available, it will use hard-coded last-resort data and
@@ -291,18 +291,18 @@ public:
*/
void setSymbol(ENumberFormatSymbol symbol, const UnicodeString &value, const UBool propogateDigits);
-#ifndef U_HIDE_INTERNAL_API
+#ifndef U_HIDE_INTERNAL_API
+ /**
+ * Loads symbols for the specified currency into this instance.
+ *
+ * This method is internal. If you think it should be public, file a ticket.
+ *
+ * @internal
+ */
+ void setCurrency(const UChar* currency, UErrorCode& status);
+#endif // U_HIDE_INTERNAL_API
+
/**
- * Loads symbols for the specified currency into this instance.
- *
- * This method is internal. If you think it should be public, file a ticket.
- *
- * @internal
- */
- void setCurrency(const UChar* currency, UErrorCode& status);
-#endif // U_HIDE_INTERNAL_API
-
- /**
* Returns the locale for which this object was constructed.
* @stable ICU 2.6
*/
@@ -374,11 +374,11 @@ private:
* @param success Input/output parameter, set to success or
* failure code upon return.
* @param useLastResortData determine if use last resort data
- * @param ns The NumberingSystem to use; otherwise, fall
- * back to the locale.
+ * @param ns The NumberingSystem to use; otherwise, fall
+ * back to the locale.
*/
- void initialize(const Locale& locale, UErrorCode& success,
- UBool useLastResortData = FALSE, const NumberingSystem* ns = nullptr);
+ void initialize(const Locale& locale, UErrorCode& success,
+ UBool useLastResortData = FALSE, const NumberingSystem* ns = nullptr);
/**
* Initialize the symbols with default values.
@@ -401,13 +401,13 @@ public:
inline UBool isCustomIntlCurrencySymbol() const {
return fIsCustomIntlCurrencySymbol;
}
-
- /**
- * @internal For ICU use only
- */
- inline UChar32 getCodePointZero() const {
- return fCodePointZero;
- }
+
+ /**
+ * @internal For ICU use only
+ */
+ inline UChar32 getCodePointZero() const {
+ return fCodePointZero;
+ }
#endif /* U_HIDE_INTERNAL_API */
/**
@@ -415,41 +415,41 @@ public:
* returning a const reference to one of the symbol strings.
* The returned reference becomes invalid when the symbol is changed
* or when the DecimalFormatSymbols are destroyed.
- * Note: moved \#ifndef U_HIDE_INTERNAL_API after this, since this is needed for inline in DecimalFormat
+ * Note: moved \#ifndef U_HIDE_INTERNAL_API after this, since this is needed for inline in DecimalFormat
+ *
+ * This is not currently stable API, but if you think it should be stable,
+ * post a comment on the following ticket and the ICU team will take a look:
+ * http://bugs.icu-project.org/trac/ticket/13580
*
- * This is not currently stable API, but if you think it should be stable,
- * post a comment on the following ticket and the ICU team will take a look:
- * http://bugs.icu-project.org/trac/ticket/13580
- *
* @param symbol Constant to indicate a number format symbol.
* @return the format symbol by the param 'symbol'
* @internal
*/
- inline const UnicodeString& getConstSymbol(ENumberFormatSymbol symbol) const;
+ inline const UnicodeString& getConstSymbol(ENumberFormatSymbol symbol) const;
#ifndef U_HIDE_INTERNAL_API
/**
- * Returns the const UnicodeString reference, like getConstSymbol,
- * corresponding to the digit with the given value. This is equivalent
- * to accessing the symbol from getConstSymbol with the corresponding
- * key, such as kZeroDigitSymbol or kOneDigitSymbol.
- *
- * This is not currently stable API, but if you think it should be stable,
- * post a comment on the following ticket and the ICU team will take a look:
- * http://bugs.icu-project.org/trac/ticket/13580
- *
- * @param digit The digit, an integer between 0 and 9 inclusive.
- * If outside the range 0 to 9, the zero digit is returned.
- * @return the format symbol for the given digit.
- * @internal This API is currently for ICU use only.
- */
- inline const UnicodeString& getConstDigitSymbol(int32_t digit) const;
-
- /**
+ * Returns the const UnicodeString reference, like getConstSymbol,
+ * corresponding to the digit with the given value. This is equivalent
+ * to accessing the symbol from getConstSymbol with the corresponding
+ * key, such as kZeroDigitSymbol or kOneDigitSymbol.
+ *
+ * This is not currently stable API, but if you think it should be stable,
+ * post a comment on the following ticket and the ICU team will take a look:
+ * http://bugs.icu-project.org/trac/ticket/13580
+ *
+ * @param digit The digit, an integer between 0 and 9 inclusive.
+ * If outside the range 0 to 9, the zero digit is returned.
+ * @return the format symbol for the given digit.
+ * @internal This API is currently for ICU use only.
+ */
+ inline const UnicodeString& getConstDigitSymbol(int32_t digit) const;
+
+ /**
* Returns that pattern stored in currecy info. Internal API for use by NumberFormat API.
* @internal
*/
- inline const char16_t* getCurrencyPattern(void) const;
+ inline const char16_t* getCurrencyPattern(void) const;
#endif /* U_HIDE_INTERNAL_API */
private:
@@ -474,27 +474,27 @@ private:
*/
UnicodeString fNoSymbol;
- /**
- * Dealing with code points is faster than dealing with strings when formatting. Because of
- * this, we maintain a value containing the zero code point that is used whenever digitStrings
- * represents a sequence of ten code points in order.
- *
- * <p>If the value stored here is positive, it means that the code point stored in this value
- * corresponds to the digitStrings array, and codePointZero can be used instead of the
- * digitStrings array for the purposes of efficient formatting; if -1, then digitStrings does
- * *not* contain a sequence of code points, and it must be used directly.
- *
- * <p>It is assumed that codePointZero always shadows the value in digitStrings. codePointZero
- * should never be set directly; rather, it should be updated only when digitStrings mutates.
- * That is, the flow of information is digitStrings -> codePointZero, not the other way.
- */
- UChar32 fCodePointZero;
-
+ /**
+ * Dealing with code points is faster than dealing with strings when formatting. Because of
+ * this, we maintain a value containing the zero code point that is used whenever digitStrings
+ * represents a sequence of ten code points in order.
+ *
+ * <p>If the value stored here is positive, it means that the code point stored in this value
+ * corresponds to the digitStrings array, and codePointZero can be used instead of the
+ * digitStrings array for the purposes of efficient formatting; if -1, then digitStrings does
+ * *not* contain a sequence of code points, and it must be used directly.
+ *
+ * <p>It is assumed that codePointZero always shadows the value in digitStrings. codePointZero
+ * should never be set directly; rather, it should be updated only when digitStrings mutates.
+ * That is, the flow of information is digitStrings -> codePointZero, not the other way.
+ */
+ UChar32 fCodePointZero;
+
Locale locale;
char actualLocale[ULOC_FULLNAME_CAPACITY];
char validLocale[ULOC_FULLNAME_CAPACITY];
- const char16_t* currPattern;
+ const char16_t* currPattern;
UnicodeString currencySpcBeforeSym[UNUM_CURRENCY_SPACING_COUNT];
UnicodeString currencySpcAfterSym[UNUM_CURRENCY_SPACING_COUNT];
@@ -515,7 +515,7 @@ DecimalFormatSymbols::getSymbol(ENumberFormatSymbol symbol) const {
return *strPtr;
}
-// See comments above for this function. Not hidden with #ifdef U_HIDE_INTERNAL_API
+// See comments above for this function. Not hidden with #ifdef U_HIDE_INTERNAL_API
inline const UnicodeString &
DecimalFormatSymbols::getConstSymbol(ENumberFormatSymbol symbol) const {
const UnicodeString *strPtr;
@@ -527,19 +527,19 @@ DecimalFormatSymbols::getConstSymbol(ENumberFormatSymbol symbol) const {
return *strPtr;
}
-#ifndef U_HIDE_INTERNAL_API
-inline const UnicodeString& DecimalFormatSymbols::getConstDigitSymbol(int32_t digit) const {
- if (digit < 0 || digit > 9) {
- digit = 0;
- }
- if (digit == 0) {
- return fSymbols[kZeroDigitSymbol];
- }
- ENumberFormatSymbol key = static_cast<ENumberFormatSymbol>(kOneDigitSymbol + digit - 1);
- return fSymbols[key];
-}
-#endif /* U_HIDE_INTERNAL_API */
-
+#ifndef U_HIDE_INTERNAL_API
+inline const UnicodeString& DecimalFormatSymbols::getConstDigitSymbol(int32_t digit) const {
+ if (digit < 0 || digit > 9) {
+ digit = 0;
+ }
+ if (digit == 0) {
+ return fSymbols[kZeroDigitSymbol];
+ }
+ ENumberFormatSymbol key = static_cast<ENumberFormatSymbol>(kOneDigitSymbol + digit - 1);
+ return fSymbols[key];
+}
+#endif /* U_HIDE_INTERNAL_API */
+
// -------------------------------------
inline void
@@ -556,20 +556,20 @@ DecimalFormatSymbols::setSymbol(ENumberFormatSymbol symbol, const UnicodeString
// If the zero digit is being set to a known zero digit according to Unicode,
// then we automatically set the corresponding 1-9 digits
- // Also record updates to fCodePointZero. Be conservative if in doubt.
- if (symbol == kZeroDigitSymbol) {
+ // Also record updates to fCodePointZero. Be conservative if in doubt.
+ if (symbol == kZeroDigitSymbol) {
UChar32 sym = value.char32At(0);
- if ( propogateDigits && u_charDigitValue(sym) == 0 && value.countChar32() == 1 ) {
- fCodePointZero = sym;
+ if ( propogateDigits && u_charDigitValue(sym) == 0 && value.countChar32() == 1 ) {
+ fCodePointZero = sym;
for ( int8_t i = 1 ; i<= 9 ; i++ ) {
sym++;
fSymbols[(int)kOneDigitSymbol+i-1] = UnicodeString(sym);
}
- } else {
- fCodePointZero = -1;
+ } else {
+ fCodePointZero = -1;
}
- } else if (symbol >= kOneDigitSymbol && symbol <= kNineDigitSymbol) {
- fCodePointZero = -1;
+ } else if (symbol >= kOneDigitSymbol && symbol <= kNineDigitSymbol) {
+ fCodePointZero = -1;
}
}
@@ -581,7 +581,7 @@ DecimalFormatSymbols::getLocale() const {
}
#ifndef U_HIDE_INTERNAL_API
-inline const char16_t*
+inline const char16_t*
DecimalFormatSymbols::getCurrencyPattern() const {
return currPattern;
}
@@ -591,7 +591,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _DCFMTSYM
//eof
diff --git a/contrib/libs/icu/include/unicode/decimfmt.h b/contrib/libs/icu/include/unicode/decimfmt.h
index ffdbb1cc99..8dba9b21f3 100644
--- a/contrib/libs/icu/include/unicode/decimfmt.h
+++ b/contrib/libs/icu/include/unicode/decimfmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -28,12 +28,12 @@
#define DECIMFMT_H
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
- * \brief C++ API: Compatibility APIs for decimal formatting.
+ * \brief C++ API: Compatibility APIs for decimal formatting.
*/
#if !UCONFIG_NO_FORMATTING
@@ -49,28 +49,28 @@
U_NAMESPACE_BEGIN
class CurrencyPluralInfo;
-class CompactDecimalFormat;
-
-namespace number {
-class LocalizedNumberFormatter;
-namespace impl {
-class DecimalQuantity;
-struct DecimalFormatFields;
-class UFormattedNumberData;
-}
-}
-
-namespace numparse {
-namespace impl {
-class NumberParserImpl;
-}
-}
-
+class CompactDecimalFormat;
+
+namespace number {
+class LocalizedNumberFormatter;
+namespace impl {
+class DecimalQuantity;
+struct DecimalFormatFields;
+class UFormattedNumberData;
+}
+}
+
+namespace numparse {
+namespace impl {
+class NumberParserImpl;
+}
+}
+
/**
- * **IMPORTANT:** New users are strongly encouraged to see if
- * numberformatter.h fits their use case. Although not deprecated, this header
- * is provided for backwards compatibility only.
- *
+ * **IMPORTANT:** New users are strongly encouraged to see if
+ * numberformatter.h fits their use case. Although not deprecated, this header
+ * is provided for backwards compatibility only.
+ *
* DecimalFormat is a concrete subclass of NumberFormat that formats decimal
* numbers. It has a variety of features designed to make it possible to parse
* and format numbers in any locale, including support for Western, Arabic, or
@@ -79,13 +79,13 @@ class NumberParserImpl;
* ("1.23E4"), percentages ("12%"), and currency amounts ("$123", "USD123",
* "123 US dollars"). All of these flavors can be easily localized.
*
- * To obtain a NumberFormat for a specific locale (including the default
+ * To obtain a NumberFormat for a specific locale (including the default
* locale) call one of NumberFormat's factory methods such as
* createInstance(). Do not call the DecimalFormat constructors directly, unless
* you know what you are doing, since the NumberFormat factory methods may
* return subclasses other than DecimalFormat.
*
- * **Example Usage**
+ * **Example Usage**
*
* \code
* // Normally we would have a GUI with a menu for this
@@ -129,11 +129,11 @@ class NumberParserImpl;
* }
* }
* \endcode
- *
- * **Another example use createInstance(style)**
- *
- * \code
- * // Print out a number using the localized number, currency,
+ *
+ * **Another example use createInstance(style)**
+ *
+ * \code
+ * // Print out a number using the localized number, currency,
* // percent, scientific, integer, iso currency, and plural currency
* // format for each locale</strong>
* Locale* locale = new Locale("en", "US");
@@ -144,13 +144,13 @@ class NumberParserImpl;
* for (int j=NumberFormat::kNumberStyle;
* j<=NumberFormat::kPluralCurrencyStyle;
* ++j) {
- * NumberFormat* form = NumberFormat::createInstance(locale, j, success);
+ * NumberFormat* form = NumberFormat::createInstance(locale, j, success);
* str.remove();
* cout << "format result " << form->format(myNumber, str) << endl;
* format->parse(form->format(myNumber, str), fmtable, success);
- * delete form;
- * }
- * \endcode
+ * delete form;
+ * }
+ * \endcode
*
*
* <p><strong>Patterns</strong>
@@ -279,7 +279,7 @@ class NumberParserImpl;
* <td>Pad escape, precedes pad character
* </table>
*
- * <p>A DecimalFormat pattern contains a positive and negative
+ * <p>A DecimalFormat pattern contains a positive and negative
* subpattern, for example, "#,##0.00;(#,##0.00)". Each subpattern has a
* prefix, a numeric part, and a suffix. If there is no explicit negative
* subpattern, the negative subpattern is the localized minus sign prefixed to the
@@ -414,7 +414,7 @@ class NumberParserImpl;
*
* <li>If the number of actual fraction digits is less than the
* <em>minimum fraction digits</em>, then trailing zeros are added.
- * For example, 0.125 is formatted as "0.1250" if the minimum fraction
+ * For example, 0.125 is formatted as "0.1250" if the minimum fraction
* digits is set to 4.
*
* <li>Trailing fractional zeros are not displayed if they occur
@@ -579,9 +579,9 @@ class NumberParserImpl;
* count of <code>getMaximumSignificantDigits() - 1</code>. For example, the
* pattern <code>"@@###E0"</code> is equivalent to <code>"0.0###E0"</code>.
*
- * <li>If significant digits are in use, then the integer and fraction
+ * <li>If significant digits are in use, then the integer and fraction
* digit counts, as set via the API, are ignored. If significant
- * digits are not in use, then the significant digit counts, as set via
+ * digits are not in use, then the significant digit counts, as set via
* the API, are ignored.
*
* </ul>
@@ -603,7 +603,7 @@ class NumberParserImpl;
* including prefix and suffix, determines the format width. For example, in
* the pattern <code>"* #0 o''clock"</code>, the format width is 10.
*
- * <li>The width is counted in 16-bit code units (char16_ts).
+ * <li>The width is counted in 16-bit code units (char16_ts).
*
* <li>Some parameters which usually do not matter have meaning when padding is
* used, because the pattern width is significant with padding. In the pattern
@@ -635,7 +635,7 @@ class NumberParserImpl;
* increment in the pattern itself. "#,#50" specifies a rounding increment of
* 50. "#,##0.05" specifies a rounding increment of 0.05.
*
- * <p>In the absence of an explicit rounding increment numbers are
+ * <p>In the absence of an explicit rounding increment numbers are
* rounded to their formatted width.
*
* <ul>
@@ -665,14 +665,14 @@ class NumberParserImpl;
* subclasses, such code will not necessarily work and will not be
* guaranteed to work stably from release to release.
*/
-class U_I18N_API DecimalFormat : public NumberFormat {
- public:
+class U_I18N_API DecimalFormat : public NumberFormat {
+ public:
/**
* Pad position.
* @stable ICU 2.4
*/
enum EPadPosition {
- kPadBeforePrefix, kPadAfterPrefix, kPadBeforeSuffix, kPadAfterSuffix
+ kPadBeforePrefix, kPadAfterPrefix, kPadBeforeSuffix, kPadAfterSuffix
};
/**
@@ -684,9 +684,9 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* on NumberFormat such as createInstance. These factories will
* return the most appropriate sub-class of NumberFormat for a given
* locale.
- * <p>
- * <strong>NOTE:</strong> New users are strongly encouraged to use
- * #icu::number::NumberFormatter instead of DecimalFormat.
+ * <p>
+ * <strong>NOTE:</strong> New users are strongly encouraged to use
+ * #icu::number::NumberFormatter instead of DecimalFormat.
* @param status Output param set to success/failure code. If the
* pattern is invalid this will be set to a failure code.
* @stable ICU 2.0
@@ -702,15 +702,15 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* on NumberFormat such as createInstance. These factories will
* return the most appropriate sub-class of NumberFormat for a given
* locale.
- * <p>
- * <strong>NOTE:</strong> New users are strongly encouraged to use
- * #icu::number::NumberFormatter instead of DecimalFormat.
+ * <p>
+ * <strong>NOTE:</strong> New users are strongly encouraged to use
+ * #icu::number::NumberFormatter instead of DecimalFormat.
* @param pattern A non-localized pattern string.
* @param status Output param set to success/failure code. If the
* pattern is invalid this will be set to a failure code.
* @stable ICU 2.0
*/
- DecimalFormat(const UnicodeString& pattern, UErrorCode& status);
+ DecimalFormat(const UnicodeString& pattern, UErrorCode& status);
/**
* Create a DecimalFormat from the given pattern and symbols.
@@ -722,9 +722,9 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* createInstance or createCurrencyInstance. If you need only minor adjustments
* to a standard format, you can modify the format returned by
* a NumberFormat factory method.
- * <p>
- * <strong>NOTE:</strong> New users are strongly encouraged to use
- * #icu::number::NumberFormatter instead of DecimalFormat.
+ * <p>
+ * <strong>NOTE:</strong> New users are strongly encouraged to use
+ * #icu::number::NumberFormatter instead of DecimalFormat.
*
* @param pattern a non-localized pattern string
* @param symbolsToAdopt the set of symbols to be used. The caller should not
@@ -733,10 +733,10 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* pattern is invalid this will be set to a failure code.
* @stable ICU 2.0
*/
- DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt, UErrorCode& status);
+ DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt, UErrorCode& status);
#ifndef U_HIDE_INTERNAL_API
-
+
/**
* This API is for ICU use only.
* Create a DecimalFormat from the given pattern, symbols, and style.
@@ -749,41 +749,41 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* pattern is invalid this will be set to a failure code.
* @internal
*/
- DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt,
- UNumberFormatStyle style, UErrorCode& status);
+ DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt,
+ UNumberFormatStyle style, UErrorCode& status);
#if UCONFIG_HAVE_PARSEALLINPUT
-
+
/**
* @internal
*/
void setParseAllInput(UNumberFormatAttributeValue value);
-
+
#endif
#endif /* U_HIDE_INTERNAL_API */
- private:
+ private:
+
+ /**
+ * Internal constructor for DecimalFormat; sets up internal fields. All public constructors should
+ * call this constructor.
+ */
+ DecimalFormat(const DecimalFormatSymbols* symbolsToAdopt, UErrorCode& status);
+
+ public:
/**
- * Internal constructor for DecimalFormat; sets up internal fields. All public constructors should
- * call this constructor.
- */
- DecimalFormat(const DecimalFormatSymbols* symbolsToAdopt, UErrorCode& status);
-
- public:
-
- /**
* Set an integer attribute on this DecimalFormat.
* May return U_UNSUPPORTED_ERROR if this instance does not support
* the specified attribute.
* @param attr the attribute to set
- * @param newValue new value
+ * @param newValue new value
* @param status the error type
* @return *this - for chaining (example: format.setAttribute(...).setAttribute(...) )
* @stable ICU 51
*/
- virtual DecimalFormat& setAttribute(UNumberFormatAttribute attr, int32_t newValue, UErrorCode& status);
+ virtual DecimalFormat& setAttribute(UNumberFormatAttribute attr, int32_t newValue, UErrorCode& status);
/**
* Get an integer
@@ -794,7 +794,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @return the attribute value. Undefined if there is an error.
* @stable ICU 51
*/
- virtual int32_t getAttribute(UNumberFormatAttribute attr, UErrorCode& status) const;
+ virtual int32_t getAttribute(UNumberFormatAttribute attr, UErrorCode& status) const;
/**
@@ -803,7 +803,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @see getGroupingUsed
* @stable ICU 53
*/
- void setGroupingUsed(UBool newValue) U_OVERRIDE;
+ void setGroupingUsed(UBool newValue) U_OVERRIDE;
/**
* Sets whether or not numbers should be parsed as integers only.
@@ -812,16 +812,16 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @see isParseIntegerOnly
* @stable ICU 53
*/
- void setParseIntegerOnly(UBool value) U_OVERRIDE;
+ void setParseIntegerOnly(UBool value) U_OVERRIDE;
/**
- * Sets whether lenient parsing should be enabled (it is off by default).
- *
- * @param enable \c TRUE if lenient parsing should be used,
- * \c FALSE otherwise.
- * @stable ICU 4.8
+ * Sets whether lenient parsing should be enabled (it is off by default).
+ *
+ * @param enable \c TRUE if lenient parsing should be used,
+ * \c FALSE otherwise.
+ * @stable ICU 4.8
*/
- void setLenient(UBool enable) U_OVERRIDE;
+ void setLenient(UBool enable) U_OVERRIDE;
/**
* Create a DecimalFormat from the given pattern and symbols.
@@ -833,21 +833,21 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* createInstance or createCurrencyInstance. If you need only minor adjustments
* to a standard format, you can modify the format returned by
* a NumberFormat factory method.
- * <p>
- * <strong>NOTE:</strong> New users are strongly encouraged to use
- * #icu::number::NumberFormatter instead of DecimalFormat.
+ * <p>
+ * <strong>NOTE:</strong> New users are strongly encouraged to use
+ * #icu::number::NumberFormatter instead of DecimalFormat.
*
* @param pattern a non-localized pattern string
* @param symbolsToAdopt the set of symbols to be used. The caller should not
* delete this object after making this call.
- * @param parseError Output param to receive errors occurred during parsing
+ * @param parseError Output param to receive errors occurred during parsing
* @param status Output param set to success/failure code. If the
* pattern is invalid this will be set to a failure code.
* @stable ICU 2.0
*/
- DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt,
- UParseError& parseError, UErrorCode& status);
-
+ DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt,
+ UParseError& parseError, UErrorCode& status);
+
/**
* Create a DecimalFormat from the given pattern and symbols.
* Use this constructor when you need to completely customize the
@@ -858,9 +858,9 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* createInstance or createCurrencyInstance. If you need only minor adjustments
* to a standard format, you can modify the format returned by
* a NumberFormat factory method.
- * <p>
- * <strong>NOTE:</strong> New users are strongly encouraged to use
- * #icu::number::NumberFormatter instead of DecimalFormat.
+ * <p>
+ * <strong>NOTE:</strong> New users are strongly encouraged to use
+ * #icu::number::NumberFormatter instead of DecimalFormat.
*
* @param pattern a non-localized pattern string
* @param symbols the set of symbols to be used
@@ -868,7 +868,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* pattern is invalid this will be set to a failure code.
* @stable ICU 2.0
*/
- DecimalFormat(const UnicodeString& pattern, const DecimalFormatSymbols& symbols, UErrorCode& status);
+ DecimalFormat(const UnicodeString& pattern, const DecimalFormatSymbols& symbols, UErrorCode& status);
/**
* Copy constructor.
@@ -890,7 +890,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* Destructor.
* @stable ICU 2.0
*/
- ~DecimalFormat() U_OVERRIDE;
+ ~DecimalFormat() U_OVERRIDE;
/**
* Clone this Format object polymorphically. The caller owns the
@@ -899,7 +899,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @return a polymorphic copy of this DecimalFormat.
* @stable ICU 2.0
*/
- DecimalFormat* clone() const U_OVERRIDE;
+ DecimalFormat* clone() const U_OVERRIDE;
/**
* Return true if the given Format objects are semantically equal.
@@ -909,7 +909,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @return true if the given Format objects are semantically equal.
* @stable ICU 2.0
*/
- UBool operator==(const Format& other) const U_OVERRIDE;
+ UBool operator==(const Format& other) const U_OVERRIDE;
using NumberFormat::format;
@@ -925,9 +925,9 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @return Reference to 'appendTo' parameter.
* @stable ICU 2.0
*/
- UnicodeString& format(double number, UnicodeString& appendTo, FieldPosition& pos) const U_OVERRIDE;
+ UnicodeString& format(double number, UnicodeString& appendTo, FieldPosition& pos) const U_OVERRIDE;
-#ifndef U_HIDE_INTERNAL_API
+#ifndef U_HIDE_INTERNAL_API
/**
* Format a double or long number using base-10 representation.
*
@@ -940,9 +940,9 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @return Reference to 'appendTo' parameter.
* @internal
*/
- UnicodeString& format(double number, UnicodeString& appendTo, FieldPosition& pos,
- UErrorCode& status) const U_OVERRIDE;
-#endif /* U_HIDE_INTERNAL_API */
+ UnicodeString& format(double number, UnicodeString& appendTo, FieldPosition& pos,
+ UErrorCode& status) const U_OVERRIDE;
+#endif /* U_HIDE_INTERNAL_API */
/**
* Format a double or long number using base-10 representation.
@@ -957,8 +957,8 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @return Reference to 'appendTo' parameter.
* @stable ICU 4.4
*/
- UnicodeString& format(double number, UnicodeString& appendTo, FieldPositionIterator* posIter,
- UErrorCode& status) const U_OVERRIDE;
+ UnicodeString& format(double number, UnicodeString& appendTo, FieldPositionIterator* posIter,
+ UErrorCode& status) const U_OVERRIDE;
/**
* Format a long number using base-10 representation.
@@ -971,9 +971,9 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @return Reference to 'appendTo' parameter.
* @stable ICU 2.0
*/
- UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPosition& pos) const U_OVERRIDE;
+ UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPosition& pos) const U_OVERRIDE;
-#ifndef U_HIDE_INTERNAL_API
+#ifndef U_HIDE_INTERNAL_API
/**
* Format a long number using base-10 representation.
*
@@ -982,13 +982,13 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* Result is appended to existing contents.
* @param pos On input: an alignment field, if desired.
* On output: the offsets of the alignment field.
- * @param status Output param filled with success/failure status.
+ * @param status Output param filled with success/failure status.
* @return Reference to 'appendTo' parameter.
* @internal
*/
- UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPosition& pos,
- UErrorCode& status) const U_OVERRIDE;
-#endif /* U_HIDE_INTERNAL_API */
+ UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPosition& pos,
+ UErrorCode& status) const U_OVERRIDE;
+#endif /* U_HIDE_INTERNAL_API */
/**
* Format a long number using base-10 representation.
@@ -1003,8 +1003,8 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @return Reference to 'appendTo' parameter.
* @stable ICU 4.4
*/
- UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPositionIterator* posIter,
- UErrorCode& status) const U_OVERRIDE;
+ UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPositionIterator* posIter,
+ UErrorCode& status) const U_OVERRIDE;
/**
* Format an int64 number using base-10 representation.
@@ -1017,9 +1017,9 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @return Reference to 'appendTo' parameter.
* @stable ICU 2.8
*/
- UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPosition& pos) const U_OVERRIDE;
+ UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPosition& pos) const U_OVERRIDE;
-#ifndef U_HIDE_INTERNAL_API
+#ifndef U_HIDE_INTERNAL_API
/**
* Format an int64 number using base-10 representation.
*
@@ -1028,13 +1028,13 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* Result is appended to existing contents.
* @param pos On input: an alignment field, if desired.
* On output: the offsets of the alignment field.
- * @param status Output param filled with success/failure status.
+ * @param status Output param filled with success/failure status.
* @return Reference to 'appendTo' parameter.
* @internal
*/
- UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPosition& pos,
- UErrorCode& status) const U_OVERRIDE;
-#endif /* U_HIDE_INTERNAL_API */
+ UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPosition& pos,
+ UErrorCode& status) const U_OVERRIDE;
+#endif /* U_HIDE_INTERNAL_API */
/**
* Format an int64 number using base-10 representation.
@@ -1049,8 +1049,8 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @return Reference to 'appendTo' parameter.
* @stable ICU 4.4
*/
- UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPositionIterator* posIter,
- UErrorCode& status) const U_OVERRIDE;
+ UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPositionIterator* posIter,
+ UErrorCode& status) const U_OVERRIDE;
/**
* Format a decimal number.
@@ -1068,18 +1068,18 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @return Reference to 'appendTo' parameter.
* @stable ICU 4.4
*/
- UnicodeString& format(StringPiece number, UnicodeString& appendTo, FieldPositionIterator* posIter,
- UErrorCode& status) const U_OVERRIDE;
+ UnicodeString& format(StringPiece number, UnicodeString& appendTo, FieldPositionIterator* posIter,
+ UErrorCode& status) const U_OVERRIDE;
-#ifndef U_HIDE_INTERNAL_API
+#ifndef U_HIDE_INTERNAL_API
/**
* Format a decimal number.
- * The number is a DecimalQuantity wrapper onto a floating point decimal number.
+ * The number is a DecimalQuantity wrapper onto a floating point decimal number.
* The default implementation in NumberFormat converts the decimal number
* to a double and formats that.
*
- * @param number The number, a DecimalQuantity format Decimal Floating Point.
+ * @param number The number, a DecimalQuantity format Decimal Floating Point.
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
* @param posIter On return, can be used to iterate over positions
@@ -1088,16 +1088,16 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @return Reference to 'appendTo' parameter.
* @internal
*/
- UnicodeString& format(const number::impl::DecimalQuantity& number, UnicodeString& appendTo,
- FieldPositionIterator* posIter, UErrorCode& status) const U_OVERRIDE;
+ UnicodeString& format(const number::impl::DecimalQuantity& number, UnicodeString& appendTo,
+ FieldPositionIterator* posIter, UErrorCode& status) const U_OVERRIDE;
/**
* Format a decimal number.
- * The number is a DecimalQuantity wrapper onto a floating point decimal number.
+ * The number is a DecimalQuantity wrapper onto a floating point decimal number.
* The default implementation in NumberFormat converts the decimal number
* to a double and formats that.
*
- * @param number The number, a DecimalQuantity format Decimal Floating Point.
+ * @param number The number, a DecimalQuantity format Decimal Floating Point.
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
* @param pos On input: an alignment field, if desired.
@@ -1106,36 +1106,36 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @return Reference to 'appendTo' parameter.
* @internal
*/
- UnicodeString& format(const number::impl::DecimalQuantity& number, UnicodeString& appendTo,
- FieldPosition& pos, UErrorCode& status) const U_OVERRIDE;
+ UnicodeString& format(const number::impl::DecimalQuantity& number, UnicodeString& appendTo,
+ FieldPosition& pos, UErrorCode& status) const U_OVERRIDE;
-#endif // U_HIDE_INTERNAL_API
+#endif // U_HIDE_INTERNAL_API
- using NumberFormat::parse;
+ using NumberFormat::parse;
+
+ /**
+ * Parse the given string using this object's choices. The method
+ * does string comparisons to try to find an optimal match.
+ * If no object can be parsed, index is unchanged, and NULL is
+ * returned. The result is returned as the most parsimonious
+ * type of Formattable that will accommodate all of the
+ * necessary precision. For example, if the result is exactly 12,
+ * it will be returned as a long. However, if it is 1.5, it will
+ * be returned as a double.
+ *
+ * @param text The text to be parsed.
+ * @param result Formattable to be set to the parse result.
+ * If parse fails, return contents are undefined.
+ * @param parsePosition The position to start parsing at on input.
+ * On output, moved to after the last successfully
+ * parse character. On parse failure, does not change.
+ * @see Formattable
+ * @stable ICU 2.0
+ */
+ void parse(const UnicodeString& text, Formattable& result,
+ ParsePosition& parsePosition) const U_OVERRIDE;
/**
- * Parse the given string using this object's choices. The method
- * does string comparisons to try to find an optimal match.
- * If no object can be parsed, index is unchanged, and NULL is
- * returned. The result is returned as the most parsimonious
- * type of Formattable that will accommodate all of the
- * necessary precision. For example, if the result is exactly 12,
- * it will be returned as a long. However, if it is 1.5, it will
- * be returned as a double.
- *
- * @param text The text to be parsed.
- * @param result Formattable to be set to the parse result.
- * If parse fails, return contents are undefined.
- * @param parsePosition The position to start parsing at on input.
- * On output, moved to after the last successfully
- * parse character. On parse failure, does not change.
- * @see Formattable
- * @stable ICU 2.0
- */
- void parse(const UnicodeString& text, Formattable& result,
- ParsePosition& parsePosition) const U_OVERRIDE;
-
- /**
* Parses text from the given string as a currency amount. Unlike
* the parse() method, this method will attempt to parse a generic
* currency name, searching for a match of this object's locale's
@@ -1154,7 +1154,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* the parsed currency; if parse fails, this is NULL.
* @stable ICU 49
*/
- CurrencyAmount* parseCurrency(const UnicodeString& text, ParsePosition& pos) const U_OVERRIDE;
+ CurrencyAmount* parseCurrency(const UnicodeString& text, ParsePosition& pos) const U_OVERRIDE;
/**
* Returns the decimal format symbols, which is generally not changed
@@ -1284,33 +1284,33 @@ class U_I18N_API DecimalFormat : public NumberFormat {
virtual void setNegativeSuffix(const UnicodeString& newValue);
/**
- * Whether to show the plus sign on positive (non-negative) numbers; for example, "+12"
- *
- * For more control over sign display, use NumberFormatter.
- *
- * @return Whether the sign is shown on positive numbers and zero.
- * @stable ICU 64
- */
- UBool isSignAlwaysShown() const;
-
- /**
- * Set whether to show the plus sign on positive (non-negative) numbers; for example, "+12".
- *
- * For more control over sign display, use NumberFormatter.
- *
- * @param value true to always show a sign; false to hide the sign on positive numbers and zero.
- * @stable ICU 64
- */
- void setSignAlwaysShown(UBool value);
-
- /**
+ * Whether to show the plus sign on positive (non-negative) numbers; for example, "+12"
+ *
+ * For more control over sign display, use NumberFormatter.
+ *
+ * @return Whether the sign is shown on positive numbers and zero.
+ * @stable ICU 64
+ */
+ UBool isSignAlwaysShown() const;
+
+ /**
+ * Set whether to show the plus sign on positive (non-negative) numbers; for example, "+12".
+ *
+ * For more control over sign display, use NumberFormatter.
+ *
+ * @param value true to always show a sign; false to hide the sign on positive numbers and zero.
+ * @stable ICU 64
+ */
+ void setSignAlwaysShown(UBool value);
+
+ /**
* Get the multiplier for use in percent, permill, etc.
* For a percentage, set the suffixes to have "%" and the multiplier to be 100.
* (For Arabic, use arabic percent symbol).
* For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000.
*
- * The number may also be multiplied by a power of ten; see getMultiplierScale().
- *
+ * The number may also be multiplied by a power of ten; see getMultiplierScale().
+ *
* @return the multiplier for use in percent, permill, etc.
* Examples: with 100, 1.23 -> "123", and "123" -> 1.23
* @stable ICU 2.0
@@ -1323,9 +1323,9 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* (For Arabic, use arabic percent symbol).
* For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000.
*
- * This method only supports integer multipliers. To multiply by a non-integer, pair this
- * method with setMultiplierScale().
- *
+ * This method only supports integer multipliers. To multiply by a non-integer, pair this
+ * method with setMultiplierScale().
+ *
* @param newValue the new value of the multiplier for use in percent, permill, etc.
* Examples: with 100, 1.23 -> "123", and "123" -> 1.23
* @stable ICU 2.0
@@ -1333,41 +1333,41 @@ class U_I18N_API DecimalFormat : public NumberFormat {
virtual void setMultiplier(int32_t newValue);
/**
- * Gets the power of ten by which number should be multiplied before formatting, which
- * can be combined with setMultiplier() to multiply by any arbitrary decimal value.
- *
- * A multiplier scale of 2 corresponds to multiplication by 100, and a multiplier scale
- * of -2 corresponds to multiplication by 0.01.
- *
- * This method is analogous to UNUM_SCALE in getAttribute.
- *
- * @return the current value of the power-of-ten multiplier.
- * @stable ICU 62
- */
- int32_t getMultiplierScale(void) const;
-
- /**
- * Sets a power of ten by which number should be multiplied before formatting, which
- * can be combined with setMultiplier() to multiply by any arbitrary decimal value.
- *
- * A multiplier scale of 2 corresponds to multiplication by 100, and a multiplier scale
- * of -2 corresponds to multiplication by 0.01.
- *
- * For example, to multiply numbers by 0.5 before formatting, you can do:
- *
- * <pre>
- * df.setMultiplier(5);
- * df.setMultiplierScale(-1);
- * </pre>
- *
- * This method is analogous to UNUM_SCALE in setAttribute.
- *
- * @param newValue the new value of the power-of-ten multiplier.
- * @stable ICU 62
- */
- void setMultiplierScale(int32_t newValue);
-
- /**
+ * Gets the power of ten by which number should be multiplied before formatting, which
+ * can be combined with setMultiplier() to multiply by any arbitrary decimal value.
+ *
+ * A multiplier scale of 2 corresponds to multiplication by 100, and a multiplier scale
+ * of -2 corresponds to multiplication by 0.01.
+ *
+ * This method is analogous to UNUM_SCALE in getAttribute.
+ *
+ * @return the current value of the power-of-ten multiplier.
+ * @stable ICU 62
+ */
+ int32_t getMultiplierScale(void) const;
+
+ /**
+ * Sets a power of ten by which number should be multiplied before formatting, which
+ * can be combined with setMultiplier() to multiply by any arbitrary decimal value.
+ *
+ * A multiplier scale of 2 corresponds to multiplication by 100, and a multiplier scale
+ * of -2 corresponds to multiplication by 0.01.
+ *
+ * For example, to multiply numbers by 0.5 before formatting, you can do:
+ *
+ * <pre>
+ * df.setMultiplier(5);
+ * df.setMultiplierScale(-1);
+ * </pre>
+ *
+ * This method is analogous to UNUM_SCALE in setAttribute.
+ *
+ * @param newValue the new value of the power-of-ten multiplier.
+ * @stable ICU 62
+ */
+ void setMultiplierScale(int32_t newValue);
+
+ /**
* Get the rounding increment.
* @return A positive rounding increment, or 0.0 if a custom rounding
* increment is not in effect.
@@ -1399,7 +1399,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @see #setRoundingMode
* @stable ICU 2.0
*/
- virtual ERoundingMode getRoundingMode(void) const U_OVERRIDE;
+ virtual ERoundingMode getRoundingMode(void) const U_OVERRIDE;
/**
* Set the rounding mode.
@@ -1409,7 +1409,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @see #getRoundingMode
* @stable ICU 2.0
*/
- virtual void setRoundingMode(ERoundingMode roundingMode) U_OVERRIDE;
+ virtual void setRoundingMode(ERoundingMode roundingMode) U_OVERRIDE;
/**
* Get the width to which the output of format() is padded.
@@ -1458,8 +1458,8 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* Set the character used to pad to the format width. If padding
* is not enabled, then this will take effect if padding is later
* enabled.
- * @param padChar a string containing the pad character. If the string
- * has length 0, then the pad character is set to ' '. Otherwise
+ * @param padChar a string containing the pad character. If the string
+ * has length 0, then the pad character is set to ' '. Otherwise
* padChar.char32At(0) will be used as the pad character.
* @see #setFormatWidth
* @see #getFormatWidth
@@ -1468,7 +1468,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @see #setPadPosition
* @stable ICU 2.0
*/
- virtual void setPadCharacter(const UnicodeString& padChar);
+ virtual void setPadCharacter(const UnicodeString& padChar);
/**
* Get the position at which padding will take place. This is the location
@@ -1662,14 +1662,14 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* A value of 1, 0, or lower, means that the use of grouping separators
* only depends on the grouping size (and on isGroupingUsed()).
*
- * NOTE: The CLDR data is used in NumberFormatter but not in DecimalFormat.
- * This is for backwards compatibility reasons.
- *
- * For more control over grouping strategies, use NumberFormatter.
- *
+ * NOTE: The CLDR data is used in NumberFormatter but not in DecimalFormat.
+ * This is for backwards compatibility reasons.
+ *
+ * For more control over grouping strategies, use NumberFormatter.
+ *
* @see setMinimumGroupingDigits
* @see getGroupingSize
- * @stable ICU 64
+ * @stable ICU 64
*/
int32_t getMinimumGroupingDigits() const;
@@ -1677,13 +1677,13 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* Sets the minimum grouping digits. Setting to a value less than or
* equal to 1 turns off minimum grouping digits.
*
- * For more control over grouping strategies, use NumberFormatter.
- *
+ * For more control over grouping strategies, use NumberFormatter.
+ *
* @param newValue the new value of minimum grouping digits.
* @see getMinimumGroupingDigits
- * @stable ICU 64
+ * @stable ICU 64
*/
- void setMinimumGroupingDigits(int32_t newValue);
+ void setMinimumGroupingDigits(int32_t newValue);
/**
* Allows you to get the behavior of the decimal separator with integers.
@@ -1714,7 +1714,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
UBool isDecimalPatternMatchRequired(void) const;
/**
- * Allows you to set the parse behavior of the pattern decimal mark.
+ * Allows you to set the parse behavior of the pattern decimal mark.
*
* if TRUE, the input must have a decimal mark if one was specified in the pattern. When
* FALSE the decimal mark may be omitted from the input.
@@ -1724,67 +1724,67 @@ class U_I18N_API DecimalFormat : public NumberFormat {
*/
virtual void setDecimalPatternMatchRequired(UBool newValue);
- /**
- * Returns whether to ignore exponents when parsing.
- *
- * @return Whether to ignore exponents when parsing.
- * @see #setParseNoExponent
- * @stable ICU 64
- */
- UBool isParseNoExponent() const;
+ /**
+ * Returns whether to ignore exponents when parsing.
+ *
+ * @return Whether to ignore exponents when parsing.
+ * @see #setParseNoExponent
+ * @stable ICU 64
+ */
+ UBool isParseNoExponent() const;
+
+ /**
+ * Specifies whether to stop parsing when an exponent separator is encountered. For
+ * example, parses "123E4" to 123 (with parse position 3) instead of 1230000 (with parse position
+ * 5).
+ *
+ * @param value true to prevent exponents from being parsed; false to allow them to be parsed.
+ * @stable ICU 64
+ */
+ void setParseNoExponent(UBool value);
+
+ /**
+ * Returns whether parsing is sensitive to case (lowercase/uppercase).
+ *
+ * @return Whether parsing is case-sensitive.
+ * @see #setParseCaseSensitive
+ * @stable ICU 64
+ */
+ UBool isParseCaseSensitive() const;
+
+ /**
+ * Whether to pay attention to case when parsing; default is to ignore case (perform
+ * case-folding). For example, "A" == "a" in case-insensitive but not case-sensitive mode.
+ *
+ * Currency symbols are never case-folded. For example, "us$1.00" will not parse in case-insensitive
+ * mode, even though "US$1.00" parses.
+ *
+ * @param value true to enable case-sensitive parsing (the default); false to force
+ * case-sensitive parsing behavior.
+ * @stable ICU 64
+ */
+ void setParseCaseSensitive(UBool value);
+
+ /**
+ * Returns whether truncation of high-order integer digits should result in an error.
+ * By default, setMaximumIntegerDigits truncates high-order digits silently.
+ *
+ * @return Whether an error code is set if high-order digits are truncated.
+ * @see setFormatFailIfMoreThanMaxDigits
+ * @stable ICU 64
+ */
+ UBool isFormatFailIfMoreThanMaxDigits() const;
+
+ /**
+ * Sets whether truncation of high-order integer digits should result in an error.
+ * By default, setMaximumIntegerDigits truncates high-order digits silently.
+ *
+ * @param value Whether to set an error code if high-order digits are truncated.
+ * @stable ICU 64
+ */
+ void setFormatFailIfMoreThanMaxDigits(UBool value);
/**
- * Specifies whether to stop parsing when an exponent separator is encountered. For
- * example, parses "123E4" to 123 (with parse position 3) instead of 1230000 (with parse position
- * 5).
- *
- * @param value true to prevent exponents from being parsed; false to allow them to be parsed.
- * @stable ICU 64
- */
- void setParseNoExponent(UBool value);
-
- /**
- * Returns whether parsing is sensitive to case (lowercase/uppercase).
- *
- * @return Whether parsing is case-sensitive.
- * @see #setParseCaseSensitive
- * @stable ICU 64
- */
- UBool isParseCaseSensitive() const;
-
- /**
- * Whether to pay attention to case when parsing; default is to ignore case (perform
- * case-folding). For example, "A" == "a" in case-insensitive but not case-sensitive mode.
- *
- * Currency symbols are never case-folded. For example, "us$1.00" will not parse in case-insensitive
- * mode, even though "US$1.00" parses.
- *
- * @param value true to enable case-sensitive parsing (the default); false to force
- * case-sensitive parsing behavior.
- * @stable ICU 64
- */
- void setParseCaseSensitive(UBool value);
-
- /**
- * Returns whether truncation of high-order integer digits should result in an error.
- * By default, setMaximumIntegerDigits truncates high-order digits silently.
- *
- * @return Whether an error code is set if high-order digits are truncated.
- * @see setFormatFailIfMoreThanMaxDigits
- * @stable ICU 64
- */
- UBool isFormatFailIfMoreThanMaxDigits() const;
-
- /**
- * Sets whether truncation of high-order integer digits should result in an error.
- * By default, setMaximumIntegerDigits truncates high-order digits silently.
- *
- * @param value Whether to set an error code if high-order digits are truncated.
- * @stable ICU 64
- */
- void setFormatFailIfMoreThanMaxDigits(UBool value);
-
- /**
* Synthesizes a pattern string that represents the current state
* of this Format object.
*
@@ -1837,8 +1837,8 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* set to a failure result.
* @stable ICU 2.0
*/
- virtual void applyPattern(const UnicodeString& pattern, UParseError& parseError, UErrorCode& status);
-
+ virtual void applyPattern(const UnicodeString& pattern, UParseError& parseError, UErrorCode& status);
+
/**
* Sets the pattern.
* @param pattern The pattern to be applied.
@@ -1847,7 +1847,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* set to a failure result.
* @stable ICU 2.0
*/
- virtual void applyPattern(const UnicodeString& pattern, UErrorCode& status);
+ virtual void applyPattern(const UnicodeString& pattern, UErrorCode& status);
/**
* Apply the given pattern to this Format object. The pattern
@@ -1879,7 +1879,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* set to a failure result.
* @stable ICU 2.0
*/
- virtual void applyLocalizedPattern(const UnicodeString& pattern, UParseError& parseError,
+ virtual void applyLocalizedPattern(const UnicodeString& pattern, UParseError& parseError,
UErrorCode& status);
/**
@@ -1891,7 +1891,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* set to a failure result.
* @stable ICU 2.0
*/
- virtual void applyLocalizedPattern(const UnicodeString& pattern, UErrorCode& status);
+ virtual void applyLocalizedPattern(const UnicodeString& pattern, UErrorCode& status);
/**
@@ -1903,7 +1903,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @see NumberFormat#setMaximumIntegerDigits
* @stable ICU 2.0
*/
- void setMaximumIntegerDigits(int32_t newValue) U_OVERRIDE;
+ void setMaximumIntegerDigits(int32_t newValue) U_OVERRIDE;
/**
* Sets the minimum number of digits allowed in the integer portion of a
@@ -1914,7 +1914,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @see NumberFormat#setMinimumIntegerDigits
* @stable ICU 2.0
*/
- void setMinimumIntegerDigits(int32_t newValue) U_OVERRIDE;
+ void setMinimumIntegerDigits(int32_t newValue) U_OVERRIDE;
/**
* Sets the maximum number of digits allowed in the fraction portion of a
@@ -1925,7 +1925,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @see NumberFormat#setMaximumFractionDigits
* @stable ICU 2.0
*/
- void setMaximumFractionDigits(int32_t newValue) U_OVERRIDE;
+ void setMaximumFractionDigits(int32_t newValue) U_OVERRIDE;
/**
* Sets the minimum number of digits allowed in the fraction portion of a
@@ -1936,7 +1936,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @see NumberFormat#setMinimumFractionDigits
* @stable ICU 2.0
*/
- void setMinimumFractionDigits(int32_t newValue) U_OVERRIDE;
+ void setMinimumFractionDigits(int32_t newValue) U_OVERRIDE;
/**
* Returns the minimum number of significant digits that will be
@@ -2011,100 +2011,100 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @param ec input-output error code
* @stable ICU 3.0
*/
- void setCurrency(const char16_t* theCurrency, UErrorCode& ec) U_OVERRIDE;
+ void setCurrency(const char16_t* theCurrency, UErrorCode& ec) U_OVERRIDE;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Sets the currency used to display currency amounts. See
- * setCurrency(const char16_t*, UErrorCode&).
- * @deprecated ICU 3.0. Use setCurrency(const char16_t*, UErrorCode&).
+ * setCurrency(const char16_t*, UErrorCode&).
+ * @deprecated ICU 3.0. Use setCurrency(const char16_t*, UErrorCode&).
*/
- virtual void setCurrency(const char16_t* theCurrency);
-#endif // U_FORCE_HIDE_DEPRECATED_API
+ virtual void setCurrency(const char16_t* theCurrency);
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
- * Sets the `Currency Usage` object used to display currency.
+ * Sets the `Currency Usage` object used to display currency.
* This takes effect immediately, if this format is a
* currency format.
- * @param newUsage new currency usage object to use.
- * @param ec input-output error code
+ * @param newUsage new currency usage object to use.
+ * @param ec input-output error code
* @stable ICU 54
*/
void setCurrencyUsage(UCurrencyUsage newUsage, UErrorCode* ec);
/**
- * Returns the `Currency Usage` object used to display currency
+ * Returns the `Currency Usage` object used to display currency
* @stable ICU 54
*/
UCurrencyUsage getCurrencyUsage() const;
-#ifndef U_HIDE_INTERNAL_API
+#ifndef U_HIDE_INTERNAL_API
/**
- * Format a number and save it into the given DecimalQuantity.
+ * Format a number and save it into the given DecimalQuantity.
* Internal, not intended for public use.
* @internal
*/
- void formatToDecimalQuantity(double number, number::impl::DecimalQuantity& output,
- UErrorCode& status) const;
+ void formatToDecimalQuantity(double number, number::impl::DecimalQuantity& output,
+ UErrorCode& status) const;
/**
- * Get a DecimalQuantity corresponding to a formattable as it would be
+ * Get a DecimalQuantity corresponding to a formattable as it would be
* formatted by this DecimalFormat.
* Internal, not intended for public use.
* @internal
*/
- void formatToDecimalQuantity(const Formattable& number, number::impl::DecimalQuantity& output,
- UErrorCode& status) const;
+ void formatToDecimalQuantity(const Formattable& number, number::impl::DecimalQuantity& output,
+ UErrorCode& status) const;
-#endif /* U_HIDE_INTERNAL_API */
+#endif /* U_HIDE_INTERNAL_API */
/**
- * Converts this DecimalFormat to a (Localized)NumberFormatter. Starting
- * in ICU 60, NumberFormatter is the recommended way to format numbers.
- * You can use the returned LocalizedNumberFormatter to format numbers and
- * get a FormattedNumber, which contains a string as well as additional
- * annotations about the formatted value.
- *
- * If a memory allocation failure occurs, the return value of this method
- * might be null. If you are concerned about correct recovery from
- * out-of-memory situations, use this pattern:
- *
- * <pre>
- * FormattedNumber result;
- * if (auto* ptr = df->toNumberFormatter(status)) {
- * result = ptr->formatDouble(123, status);
- * }
- * </pre>
- *
- * If you are not concerned about out-of-memory situations, or if your
- * environment throws exceptions when memory allocation failure occurs,
- * you can chain the methods, like this:
- *
- * <pre>
- * FormattedNumber result = df
- * ->toNumberFormatter(status)
- * ->formatDouble(123, status);
- * </pre>
+ * Converts this DecimalFormat to a (Localized)NumberFormatter. Starting
+ * in ICU 60, NumberFormatter is the recommended way to format numbers.
+ * You can use the returned LocalizedNumberFormatter to format numbers and
+ * get a FormattedNumber, which contains a string as well as additional
+ * annotations about the formatted value.
*
- * NOTE: The returned LocalizedNumberFormatter is owned by this DecimalFormat.
- * If a non-const method is called on the DecimalFormat, or if the DecimalFormat
- * is deleted, the object becomes invalid. If you plan to keep the return value
- * beyond the lifetime of the DecimalFormat, copy it to a local variable:
- *
- * <pre>
- * LocalizedNumberFormatter lnf;
- * if (auto* ptr = df->toNumberFormatter(status)) {
- * lnf = *ptr;
- * }
- * </pre>
- *
- * @param status Set on failure, like U_MEMORY_ALLOCATION_ERROR.
- * @return A pointer to an internal object, or nullptr on failure.
- * Do not delete the return value!
- * @stable ICU 64
+ * If a memory allocation failure occurs, the return value of this method
+ * might be null. If you are concerned about correct recovery from
+ * out-of-memory situations, use this pattern:
+ *
+ * <pre>
+ * FormattedNumber result;
+ * if (auto* ptr = df->toNumberFormatter(status)) {
+ * result = ptr->formatDouble(123, status);
+ * }
+ * </pre>
+ *
+ * If you are not concerned about out-of-memory situations, or if your
+ * environment throws exceptions when memory allocation failure occurs,
+ * you can chain the methods, like this:
+ *
+ * <pre>
+ * FormattedNumber result = df
+ * ->toNumberFormatter(status)
+ * ->formatDouble(123, status);
+ * </pre>
+ *
+ * NOTE: The returned LocalizedNumberFormatter is owned by this DecimalFormat.
+ * If a non-const method is called on the DecimalFormat, or if the DecimalFormat
+ * is deleted, the object becomes invalid. If you plan to keep the return value
+ * beyond the lifetime of the DecimalFormat, copy it to a local variable:
+ *
+ * <pre>
+ * LocalizedNumberFormatter lnf;
+ * if (auto* ptr = df->toNumberFormatter(status)) {
+ * lnf = *ptr;
+ * }
+ * </pre>
+ *
+ * @param status Set on failure, like U_MEMORY_ALLOCATION_ERROR.
+ * @return A pointer to an internal object, or nullptr on failure.
+ * Do not delete the return value!
+ * @stable ICU 64
*/
- const number::LocalizedNumberFormatter* toNumberFormatter(UErrorCode& status) const;
+ const number::LocalizedNumberFormatter* toNumberFormatter(UErrorCode& status) const;
/**
* Return the class ID for this class. This is useful only for
@@ -2130,68 +2130,68 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* other classes have different class IDs.
* @stable ICU 2.0
*/
- UClassID getDynamicClassID(void) const U_OVERRIDE;
+ UClassID getDynamicClassID(void) const U_OVERRIDE;
- private:
+ private:
- /** Rebuilds the formatter object from the property bag. */
- void touch(UErrorCode& status);
+ /** Rebuilds the formatter object from the property bag. */
+ void touch(UErrorCode& status);
- /** Rebuilds the formatter object, ignoring any error code. */
- void touchNoError();
+ /** Rebuilds the formatter object, ignoring any error code. */
+ void touchNoError();
/**
- * Updates the property bag with settings from the given pattern.
- *
- * @param pattern The pattern string to parse.
- * @param ignoreRounding Whether to leave out rounding information (minFrac, maxFrac, and rounding
- * increment) when parsing the pattern. This may be desirable if a custom rounding mode, such
- * as CurrencyUsage, is to be used instead. One of {@link
- * PatternStringParser#IGNORE_ROUNDING_ALWAYS}, {@link PatternStringParser#IGNORE_ROUNDING_IF_CURRENCY},
- * or {@link PatternStringParser#IGNORE_ROUNDING_NEVER}.
- * @see PatternAndPropertyUtils#parseToExistingProperties
+ * Updates the property bag with settings from the given pattern.
+ *
+ * @param pattern The pattern string to parse.
+ * @param ignoreRounding Whether to leave out rounding information (minFrac, maxFrac, and rounding
+ * increment) when parsing the pattern. This may be desirable if a custom rounding mode, such
+ * as CurrencyUsage, is to be used instead. One of {@link
+ * PatternStringParser#IGNORE_ROUNDING_ALWAYS}, {@link PatternStringParser#IGNORE_ROUNDING_IF_CURRENCY},
+ * or {@link PatternStringParser#IGNORE_ROUNDING_NEVER}.
+ * @see PatternAndPropertyUtils#parseToExistingProperties
*/
- void setPropertiesFromPattern(const UnicodeString& pattern, int32_t ignoreRounding,
- UErrorCode& status);
+ void setPropertiesFromPattern(const UnicodeString& pattern, int32_t ignoreRounding,
+ UErrorCode& status);
- const numparse::impl::NumberParserImpl* getParser(UErrorCode& status) const;
+ const numparse::impl::NumberParserImpl* getParser(UErrorCode& status) const;
- const numparse::impl::NumberParserImpl* getCurrencyParser(UErrorCode& status) const;
+ const numparse::impl::NumberParserImpl* getCurrencyParser(UErrorCode& status) const;
- static void fieldPositionHelper(
- const number::impl::UFormattedNumberData& formatted,
- FieldPosition& fieldPosition,
- int32_t offset,
- UErrorCode& status);
+ static void fieldPositionHelper(
+ const number::impl::UFormattedNumberData& formatted,
+ FieldPosition& fieldPosition,
+ int32_t offset,
+ UErrorCode& status);
- static void fieldPositionIteratorHelper(
- const number::impl::UFormattedNumberData& formatted,
- FieldPositionIterator* fpi,
- int32_t offset,
- UErrorCode& status);
+ static void fieldPositionIteratorHelper(
+ const number::impl::UFormattedNumberData& formatted,
+ FieldPositionIterator* fpi,
+ int32_t offset,
+ UErrorCode& status);
- void setupFastFormat();
+ void setupFastFormat();
- bool fastFormatDouble(double input, UnicodeString& output) const;
+ bool fastFormatDouble(double input, UnicodeString& output) const;
- bool fastFormatInt64(int64_t input, UnicodeString& output) const;
+ bool fastFormatInt64(int64_t input, UnicodeString& output) const;
- void doFastFormatInt32(int32_t input, bool isNegative, UnicodeString& output) const;
+ void doFastFormatInt32(int32_t input, bool isNegative, UnicodeString& output) const;
- //=====================================================================================//
- // INSTANCE FIELDS //
- //=====================================================================================//
+ //=====================================================================================//
+ // INSTANCE FIELDS //
+ //=====================================================================================//
- // One instance field for the implementation, keep all fields inside of an implementation
- // class defined in number_mapper.h
- number::impl::DecimalFormatFields* fields = nullptr;
+ // One instance field for the implementation, keep all fields inside of an implementation
+ // class defined in number_mapper.h
+ number::impl::DecimalFormatFields* fields = nullptr;
- // Allow child class CompactDecimalFormat to access fProperties:
- friend class CompactDecimalFormat;
+ // Allow child class CompactDecimalFormat to access fProperties:
+ friend class CompactDecimalFormat;
- // Allow MeasureFormat to use fieldPositionHelper:
- friend class MeasureFormat;
+ // Allow MeasureFormat to use fieldPositionHelper:
+ friend class MeasureFormat;
};
@@ -2199,7 +2199,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _DECIMFMT
//eof
diff --git a/contrib/libs/icu/include/unicode/docmain.h b/contrib/libs/icu/include/unicode/docmain.h
index 63764e52e4..704139a85e 100644
--- a/contrib/libs/icu/include/unicode/docmain.h
+++ b/contrib/libs/icu/include/unicode/docmain.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************
* COPYRIGHT:
@@ -33,7 +33,7 @@
* then detailed member descriptions.</p>
*
* <h3>C Programmers:</h3>
- * <p>Use <a href="#Module">Module List</a> or <a href="globals_u.html">File Members</a>
+ * <p>Use <a href="#Module">Module List</a> or <a href="globals_u.html">File Members</a>
* to find a list of all the functions and constants.
* For example, to find BreakIterator functions you would click on
* <a href="files.html"> File List</a>,
@@ -88,26 +88,26 @@
* <td>icu::UnicodeSet</td>
* </tr>
* <tr>
- * <td>Maps from Unicode Code Points to Integer Values</td>
- * <td>ucptrie.h, umutablecptrie.h</td>
- * <td>C API</td>
- * </tr>
- * <tr>
+ * <td>Maps from Unicode Code Points to Integer Values</td>
+ * <td>ucptrie.h, umutablecptrie.h</td>
+ * <td>C API</td>
+ * </tr>
+ * <tr>
* <td>Maps from Strings to Integer Values</td>
* <td>(no C API)</td>
* <td>icu::BytesTrie, icu::UCharsTrie</td>
* </tr>
* <tr>
* <td>Codepage Conversion</td>
- * <td>ucnv.h, ucnvsel.h</td>
+ * <td>ucnv.h, ucnvsel.h</td>
+ * <td>C API</td>
+ * </tr>
+ * <tr>
+ * <td>Codepage Detection</td>
+ * <td>ucsdet.h</td>
* <td>C API</td>
* </tr>
* <tr>
- * <td>Codepage Detection</td>
- * <td>ucsdet.h</td>
- * <td>C API</td>
- * </tr>
- * <tr>
* <td>Unicode Text Compression</td>
* <td>ucnv.h<br/>(encoding name "SCSU" or "BOCU-1")</td>
* <td>C API</td>
@@ -115,7 +115,7 @@
* <tr>
* <td>Locales </td>
* <td>uloc.h</a></td>
- * <td>icu::Locale, icu::LocaleBuilder, icu::LocaleMatcher</td>
+ * <td>icu::Locale, icu::LocaleBuilder, icu::LocaleMatcher</td>
* </tr>
* <tr>
* <td>Resource Bundles</td>
@@ -143,16 +143,16 @@
* <td>icu::MessageFormat</td>
* </tr>
* <tr>
- * <td>Number Formatting<br/>(includes currency and unit formatting)</td>
- * <td>unumberformatter.h, unum.h</td>
- * <td>icu::number::NumberFormatter (ICU 60+) or icu::NumberFormat (older versions)</td>
+ * <td>Number Formatting<br/>(includes currency and unit formatting)</td>
+ * <td>unumberformatter.h, unum.h</td>
+ * <td>icu::number::NumberFormatter (ICU 60+) or icu::NumberFormat (older versions)</td>
+ * </tr>
+ * <tr>
+ * <td>Number Range Formatting<br />(includes currency and unit ranges)</td>
+ * <td>(no C API)</td>
+ * <td>icu::number::NumberRangeFormatter</td>
* </tr>
* <tr>
- * <td>Number Range Formatting<br />(includes currency and unit ranges)</td>
- * <td>(no C API)</td>
- * <td>icu::number::NumberRangeFormatter</td>
- * </tr>
- * <tr>
* <td>Number Spellout<br/>(Rule Based Number Formatting)</td>
* <td>unum.h<br/>(use UNUM_SPELLOUT)</td>
* <td>icu::RuleBasedNumberFormat</td>
@@ -218,9 +218,9 @@
* <td>C API</td>
* </tr>
* <tr>
- * <td>Paragraph Layout / Complex Text Layout</td>
- * <td>playout.h</td>
- * <td>icu::ParagraphLayout</td>
+ * <td>Paragraph Layout / Complex Text Layout</td>
+ * <td>playout.h</td>
+ * <td>icu::ParagraphLayout</td>
* </tr>
* <tr>
* <td>ICU I/O</td>
diff --git a/contrib/libs/icu/include/unicode/dtfmtsym.h b/contrib/libs/icu/include/unicode/dtfmtsym.h
index a6f52a7514..c6d76fe98e 100644
--- a/contrib/libs/icu/include/unicode/dtfmtsym.h
+++ b/contrib/libs/icu/include/unicode/dtfmtsym.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -22,12 +22,12 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
#include "unicode/calendar.h"
-#include "unicode/strenum.h"
+#include "unicode/strenum.h"
#include "unicode/uobject.h"
#include "unicode/locid.h"
#include "unicode/udat.h"
@@ -429,13 +429,13 @@ public:
* doesn't specify any time separator, and always recognized when parsing.
* @internal
*/
- static const char16_t DEFAULT_TIME_SEPARATOR = 0x003a; // ':'
+ static const char16_t DEFAULT_TIME_SEPARATOR = 0x003a; // ':'
/**
* This alternate time separator is always recognized when parsing.
* @internal
*/
- static const char16_t ALTERNATE_TIME_SEPARATOR = 0x002e; // '.'
+ static const char16_t ALTERNATE_TIME_SEPARATOR = 0x002e; // '.'
/**
* Gets the time separator string. For example: ":".
@@ -569,7 +569,7 @@ public:
* @return the non-localized date-time pattern characters
* @stable ICU 2.0
*/
- static const char16_t * U_EXPORT2 getPatternUChars(void);
+ static const char16_t * U_EXPORT2 getPatternUChars(void);
/**
* Gets localized date-time pattern characters. For example: 'u', 't', etc.
@@ -980,7 +980,7 @@ private:
* Returns the date format field index of the pattern character c,
* or UDAT_FIELD_COUNT if c is not a pattern character.
*/
- static UDateFormatField U_EXPORT2 getPatternCharIndex(char16_t c);
+ static UDateFormatField U_EXPORT2 getPatternCharIndex(char16_t c);
/**
* Returns TRUE if f (with its pattern character repeated count times) is a numeric field.
@@ -990,7 +990,7 @@ private:
/**
* Returns TRUE if c (repeated count times) is the pattern character for a numeric field.
*/
- static UBool U_EXPORT2 isNumericPatternChar(char16_t c, int32_t count);
+ static UBool U_EXPORT2 isNumericPatternChar(char16_t c, int32_t count);
public:
#ifndef U_HIDE_INTERNAL_API
/**
@@ -1013,7 +1013,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _DTFMTSYM
//eof
diff --git a/contrib/libs/icu/include/unicode/dtintrv.h b/contrib/libs/icu/include/unicode/dtintrv.h
index edc6ef272d..15e15c9d40 100644
--- a/contrib/libs/icu/include/unicode/dtintrv.h
+++ b/contrib/libs/icu/include/unicode/dtintrv.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -15,9 +15,9 @@
#define __DTINTRV_H__
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
/**
@@ -55,14 +55,14 @@ public:
* @return the from date in dateInterval.
* @stable ICU 4.0
*/
- inline UDate getFromDate() const;
+ inline UDate getFromDate() const;
/**
* Get the to date.
* @return the to date in dateInterval.
* @stable ICU 4.0
*/
- inline UDate getToDate() const;
+ inline UDate getToDate() const;
/**
@@ -71,7 +71,7 @@ public:
* <pre>
* . Base* polymorphic_pointer = createPolymorphicObject();
* . if (polymorphic_pointer->getDynamicClassID() ==
- * . derived::getStaticClassID()) ...
+ * . derived::getStaticClassID()) ...
* </pre>
* @return The class ID for all objects of this class.
* @stable ICU 4.0
@@ -116,7 +116,7 @@ public:
* @return TRUE if the two DateIntervals are not the same
* @stable ICU 4.0
*/
- inline UBool operator!=(const DateInterval& other) const;
+ inline UBool operator!=(const DateInterval& other) const;
/**
@@ -159,6 +159,6 @@ DateInterval::operator!=(const DateInterval& other) const {
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/dtitvfmt.h b/contrib/libs/icu/include/unicode/dtitvfmt.h
index 40d6591688..4e4d712b4f 100644
--- a/contrib/libs/icu/include/unicode/dtitvfmt.h
+++ b/contrib/libs/icu/include/unicode/dtitvfmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************************
* Copyright (C) 2008-2016, International Business Machines Corporation and
@@ -16,8 +16,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: Format and parse date interval in a language-independent manner.
@@ -30,87 +30,87 @@
#include "unicode/dtintrv.h"
#include "unicode/dtitvinf.h"
#include "unicode/dtptngen.h"
-#include "unicode/formattedvalue.h"
+#include "unicode/formattedvalue.h"
U_NAMESPACE_BEGIN
-class FormattedDateIntervalData;
-class DateIntervalFormat;
+class FormattedDateIntervalData;
+class DateIntervalFormat;
+
+/**
+ * An immutable class containing the result of a date interval formatting operation.
+ *
+ * Instances of this class are immutable and thread-safe.
+ *
+ * When calling nextPosition():
+ * The fields are returned from left to right. The special field category
+ * UFIELD_CATEGORY_DATE_INTERVAL_SPAN is used to indicate which datetime
+ * primitives came from which arguments: 0 means fromCalendar, and 1 means
+ * toCalendar. The span category will always occur before the
+ * corresponding fields in UFIELD_CATEGORY_DATE
+ * in the nextPosition() iterator.
+ *
+ * Not intended for public subclassing.
+ *
+ * @stable ICU 64
+ */
+class U_I18N_API FormattedDateInterval : public UMemory, public FormattedValue {
+ public:
+ /**
+ * Default constructor; makes an empty FormattedDateInterval.
+ * @stable ICU 64
+ */
+ FormattedDateInterval() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
+
+ /**
+ * Move constructor: Leaves the source FormattedDateInterval in an undefined state.
+ * @stable ICU 64
+ */
+ FormattedDateInterval(FormattedDateInterval&& src) U_NOEXCEPT;
+
+ /**
+ * Destruct an instance of FormattedDateInterval.
+ * @stable ICU 64
+ */
+ virtual ~FormattedDateInterval() U_OVERRIDE;
+
+ /** Copying not supported; use move constructor instead. */
+ FormattedDateInterval(const FormattedDateInterval&) = delete;
+
+ /** Copying not supported; use move assignment instead. */
+ FormattedDateInterval& operator=(const FormattedDateInterval&) = delete;
+
+ /**
+ * Move assignment: Leaves the source FormattedDateInterval in an undefined state.
+ * @stable ICU 64
+ */
+ FormattedDateInterval& operator=(FormattedDateInterval&& src) U_NOEXCEPT;
+
+ /** @copydoc FormattedValue::toString() */
+ UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
+
+ /** @copydoc FormattedValue::toTempString() */
+ UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
+
+ /** @copydoc FormattedValue::appendTo() */
+ Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
+
+ /** @copydoc FormattedValue::nextPosition() */
+ UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
+
+ private:
+ FormattedDateIntervalData *fData;
+ UErrorCode fErrorCode;
+ explicit FormattedDateInterval(FormattedDateIntervalData *results)
+ : fData(results), fErrorCode(U_ZERO_ERROR) {}
+ explicit FormattedDateInterval(UErrorCode errorCode)
+ : fData(nullptr), fErrorCode(errorCode) {}
+ friend class DateIntervalFormat;
+};
+
/**
- * An immutable class containing the result of a date interval formatting operation.
- *
- * Instances of this class are immutable and thread-safe.
- *
- * When calling nextPosition():
- * The fields are returned from left to right. The special field category
- * UFIELD_CATEGORY_DATE_INTERVAL_SPAN is used to indicate which datetime
- * primitives came from which arguments: 0 means fromCalendar, and 1 means
- * toCalendar. The span category will always occur before the
- * corresponding fields in UFIELD_CATEGORY_DATE
- * in the nextPosition() iterator.
- *
- * Not intended for public subclassing.
- *
- * @stable ICU 64
- */
-class U_I18N_API FormattedDateInterval : public UMemory, public FormattedValue {
- public:
- /**
- * Default constructor; makes an empty FormattedDateInterval.
- * @stable ICU 64
- */
- FormattedDateInterval() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
-
- /**
- * Move constructor: Leaves the source FormattedDateInterval in an undefined state.
- * @stable ICU 64
- */
- FormattedDateInterval(FormattedDateInterval&& src) U_NOEXCEPT;
-
- /**
- * Destruct an instance of FormattedDateInterval.
- * @stable ICU 64
- */
- virtual ~FormattedDateInterval() U_OVERRIDE;
-
- /** Copying not supported; use move constructor instead. */
- FormattedDateInterval(const FormattedDateInterval&) = delete;
-
- /** Copying not supported; use move assignment instead. */
- FormattedDateInterval& operator=(const FormattedDateInterval&) = delete;
-
- /**
- * Move assignment: Leaves the source FormattedDateInterval in an undefined state.
- * @stable ICU 64
- */
- FormattedDateInterval& operator=(FormattedDateInterval&& src) U_NOEXCEPT;
-
- /** @copydoc FormattedValue::toString() */
- UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
-
- /** @copydoc FormattedValue::toTempString() */
- UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
-
- /** @copydoc FormattedValue::appendTo() */
- Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
-
- /** @copydoc FormattedValue::nextPosition() */
- UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
-
- private:
- FormattedDateIntervalData *fData;
- UErrorCode fErrorCode;
- explicit FormattedDateInterval(FormattedDateIntervalData *results)
- : fData(results), fErrorCode(U_ZERO_ERROR) {}
- explicit FormattedDateInterval(UErrorCode errorCode)
- : fData(nullptr), fErrorCode(errorCode) {}
- friend class DateIntervalFormat;
-};
-
-
-/**
* DateIntervalFormat is a class for formatting and parsing date
* intervals in a language-independent manner.
* Only formatting is supported, parsing is not supported.
@@ -172,12 +172,12 @@ class U_I18N_API FormattedDateInterval : public UMemory, public FormattedValue {
*
* <P>
* The calendar fields we support for interval formatting are:
- * year, month, date, day-of-week, am-pm, hour, hour-of-day, minute, second,
- * and millisecond.
+ * year, month, date, day-of-week, am-pm, hour, hour-of-day, minute, second,
+ * and millisecond.
* (though we do not currently have specific intervalFormat date for skeletons
- * with seconds and millisecond).
+ * with seconds and millisecond).
* Those calendar fields can be defined in the following order:
- * year > month > date > hour (in day) > minute > second > millisecond
+ * year > month > date > hour (in day) > minute > second > millisecond
*
* The largest different calendar fields between 2 calendars is the
* first different calendar field in above order.
@@ -433,7 +433,7 @@ public:
* @return A copy of the object.
* @stable ICU 4.0
*/
- virtual DateIntervalFormat* clone() const;
+ virtual DateIntervalFormat* clone() const;
/**
* Return true if the given Format objects are semantically equal. Objects
@@ -502,19 +502,19 @@ public:
FieldPosition& fieldPosition,
UErrorCode& status) const ;
- /**
- * Format a DateInterval to produce a FormattedDateInterval.
- *
- * The FormattedDateInterval exposes field information about the formatted string.
- *
- * @param dtInterval DateInterval to be formatted.
- * @param status Set if an error occurs.
- * @return A FormattedDateInterval containing the format result.
- * @stable ICU 64
- */
- FormattedDateInterval formatToValue(
- const DateInterval& dtInterval,
- UErrorCode& status) const;
+ /**
+ * Format a DateInterval to produce a FormattedDateInterval.
+ *
+ * The FormattedDateInterval exposes field information about the formatted string.
+ *
+ * @param dtInterval DateInterval to be formatted.
+ * @param status Set if an error occurs.
+ * @return A FormattedDateInterval containing the format result.
+ * @stable ICU 64
+ */
+ FormattedDateInterval formatToValue(
+ const DateInterval& dtInterval,
+ UErrorCode& status) const;
/**
* Format 2 Calendars to produce a string.
@@ -546,27 +546,27 @@ public:
UErrorCode& status) const ;
/**
- * Format 2 Calendars to produce a FormattedDateInterval.
- *
- * The FormattedDateInterval exposes field information about the formatted string.
- *
- * Note: "fromCalendar" and "toCalendar" are not const,
- * since calendar is not const in SimpleDateFormat::format(Calendar&),
- *
- * @param fromCalendar calendar set to the from date in date interval
- * to be formatted into date interval string
- * @param toCalendar calendar set to the to date in date interval
- * to be formatted into date interval string
- * @param status Set if an error occurs.
- * @return A FormattedDateInterval containing the format result.
- * @stable ICU 64
- */
- FormattedDateInterval formatToValue(
- Calendar& fromCalendar,
- Calendar& toCalendar,
- UErrorCode& status) const;
-
- /**
+ * Format 2 Calendars to produce a FormattedDateInterval.
+ *
+ * The FormattedDateInterval exposes field information about the formatted string.
+ *
+ * Note: "fromCalendar" and "toCalendar" are not const,
+ * since calendar is not const in SimpleDateFormat::format(Calendar&),
+ *
+ * @param fromCalendar calendar set to the from date in date interval
+ * to be formatted into date interval string
+ * @param toCalendar calendar set to the to date in date interval
+ * to be formatted into date interval string
+ * @param status Set if an error occurs.
+ * @return A FormattedDateInterval containing the format result.
+ * @stable ICU 64
+ */
+ FormattedDateInterval formatToValue(
+ Calendar& fromCalendar,
+ Calendar& toCalendar,
+ UErrorCode& status) const;
+
+ /**
* Date interval parsing is not supported. Please do not use.
* <P>
* This method should handle parsing of
@@ -775,14 +775,14 @@ private:
* Below are for generating interval patterns local to the formatter
*/
- /** Like fallbackFormat, but only formats the range part of the fallback. */
- void fallbackFormatRange(
- Calendar& fromCalendar,
- Calendar& toCalendar,
- UnicodeString& appendTo,
- int8_t& firstIndex,
- FieldPositionHandler& fphandler,
- UErrorCode& status) const;
+ /** Like fallbackFormat, but only formats the range part of the fallback. */
+ void fallbackFormatRange(
+ Calendar& fromCalendar,
+ Calendar& toCalendar,
+ UnicodeString& appendTo,
+ int8_t& firstIndex,
+ FieldPositionHandler& fphandler,
+ UErrorCode& status) const;
/**
* Format 2 Calendars using fall-back interval pattern
@@ -800,8 +800,8 @@ private:
* (any difference is in ampm/hours or below)
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
- * @param firstIndex See formatImpl for more information.
- * @param fphandler See formatImpl for more information.
+ * @param firstIndex See formatImpl for more information.
+ * @param fphandler See formatImpl for more information.
* @param status output param set to success/failure code on exit
* @return Reference to 'appendTo' parameter.
* @internal (private)
@@ -810,8 +810,8 @@ private:
Calendar& toCalendar,
UBool fromToOnSameDay,
UnicodeString& appendTo,
- int8_t& firstIndex,
- FieldPositionHandler& fphandler,
+ int8_t& firstIndex,
+ FieldPositionHandler& fphandler,
UErrorCode& status) const;
@@ -1075,11 +1075,11 @@ private:
* to be formatted into date interval string
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
- * @param firstIndex 0 if the first output date is fromCalendar;
- * 1 if it corresponds to toCalendar;
- * -1 if there is only one date printed.
- * @param fphandler Handler for field position information.
- * The fields will be from the UDateFormatField enum.
+ * @param firstIndex 0 if the first output date is fromCalendar;
+ * 1 if it corresponds to toCalendar;
+ * -1 if there is only one date printed.
+ * @param fphandler Handler for field position information.
+ * The fields will be from the UDateFormatField enum.
* @param status Output param filled with success/failure status.
* Caller needs to make sure it is SUCCESS
* at the function entrance
@@ -1089,20 +1089,20 @@ private:
UnicodeString& formatImpl(Calendar& fromCalendar,
Calendar& toCalendar,
UnicodeString& appendTo,
- int8_t& firstIndex,
- FieldPositionHandler& fphandler,
+ int8_t& firstIndex,
+ FieldPositionHandler& fphandler,
UErrorCode& status) const ;
- /** Version of formatImpl for DateInterval. */
- UnicodeString& formatIntervalImpl(const DateInterval& dtInterval,
- UnicodeString& appendTo,
- int8_t& firstIndex,
- FieldPositionHandler& fphandler,
- UErrorCode& status) const;
+ /** Version of formatImpl for DateInterval. */
+ UnicodeString& formatIntervalImpl(const DateInterval& dtInterval,
+ UnicodeString& appendTo,
+ int8_t& firstIndex,
+ FieldPositionHandler& fphandler,
+ UErrorCode& status) const;
+
-
// from calendar field to pattern letter
- static const char16_t fgCalendarFieldToPatternLetter[];
+ static const char16_t fgCalendarFieldToPatternLetter[];
/**
@@ -1148,7 +1148,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _DTITVFMT_H__
//eof
diff --git a/contrib/libs/icu/include/unicode/dtitvinf.h b/contrib/libs/icu/include/unicode/dtitvinf.h
index 6fc159d420..68bfa4352a 100644
--- a/contrib/libs/icu/include/unicode/dtitvinf.h
+++ b/contrib/libs/icu/include/unicode/dtitvinf.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -16,8 +16,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: Date/Time interval patterns for formatting date/time interval
@@ -137,8 +137,8 @@ U_NAMESPACE_BEGIN
* After a DateIntervalInfo object is created, clients may modify
* the interval patterns using setIntervalPattern function as so desired.
* Currently, users can only set interval patterns when the following
- * calendar fields are different: ERA, YEAR, MONTH, DATE, DAY_OF_MONTH,
- * DAY_OF_WEEK, AM_PM, HOUR, HOUR_OF_DAY, MINUTE, SECOND, and MILLISECOND.
+ * calendar fields are different: ERA, YEAR, MONTH, DATE, DAY_OF_MONTH,
+ * DAY_OF_WEEK, AM_PM, HOUR, HOUR_OF_DAY, MINUTE, SECOND, and MILLISECOND.
* Interval patterns when other calendar fields are different is not supported.
* <P>
* DateIntervalInfo objects are cloneable.
@@ -197,7 +197,7 @@ public:
* @return a copy of the object
* @stable ICU 4.0
*/
- virtual DateIntervalInfo* clone() const;
+ virtual DateIntervalInfo* clone() const;
/**
* Destructor.
@@ -245,7 +245,7 @@ public:
* Restriction:
* Currently, users can only set interval patterns when the following
* calendar fields are different: ERA, YEAR, MONTH, DATE, DAY_OF_MONTH,
- * DAY_OF_WEEK, AM_PM, HOUR, HOUR_OF_DAY, MINUTE, SECOND and MILLISECOND.
+ * DAY_OF_WEEK, AM_PM, HOUR, HOUR_OF_DAY, MINUTE, SECOND and MILLISECOND.
* Interval patterns when other calendar fields are different are
* not supported.
*
@@ -348,7 +348,7 @@ private:
/**
* Following is for saving the interval patterns.
* We only support interval patterns on
- * ERA, YEAR, MONTH, DAY, AM_PM, HOUR, MINUTE, SECOND and MILLISECOND.
+ * ERA, YEAR, MONTH, DAY, AM_PM, HOUR, MINUTE, SECOND and MILLISECOND.
*/
enum IntervalPatternIndex
{
@@ -360,7 +360,7 @@ private:
kIPI_HOUR,
kIPI_MINUTE,
kIPI_SECOND,
- kIPI_MILLISECOND,
+ kIPI_MILLISECOND,
kIPI_MAX_INDEX
};
public:
@@ -454,8 +454,8 @@ private:
* hash table.
*
* Since we only support the following calendar fields:
- * ERA, YEAR, MONTH, DATE, DAY_OF_MONTH, DAY_OF_WEEK,
- * AM_PM, HOUR, HOUR_OF_DAY, MINUTE, SECOND, and MILLISECOND.
+ * ERA, YEAR, MONTH, DATE, DAY_OF_MONTH, DAY_OF_WEEK,
+ * AM_PM, HOUR, HOUR_OF_DAY, MINUTE, SECOND, and MILLISECOND.
* We reserve only 4 interval patterns for a skeleton.
*
* @param field calendar field
@@ -518,7 +518,7 @@ U_NAMESPACE_END
#endif
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/dtptngen.h b/contrib/libs/icu/include/unicode/dtptngen.h
index d836b2d765..dd99d58e65 100644
--- a/contrib/libs/icu/include/unicode/dtptngen.h
+++ b/contrib/libs/icu/include/unicode/dtptngen.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -14,15 +14,15 @@
#ifndef __DTPTNGEN_H__
#define __DTPTNGEN_H__
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/datefmt.h"
#include "unicode/locid.h"
#include "unicode/udat.h"
#include "unicode/udatpg.h"
-#include "unicode/unistr.h"
+#include "unicode/unistr.h"
U_NAMESPACE_BEGIN
@@ -32,7 +32,7 @@ U_NAMESPACE_BEGIN
*/
-class CharString;
+class CharString;
class Hashtable;
class FormatParser;
class DateTimeMatcher;
@@ -211,11 +211,11 @@ public:
* @return conflicting status. The value could be UDATPG_NO_CONFLICT,
* UDATPG_BASE_CONFLICT or UDATPG_CONFLICT.
* @stable ICU 3.8
- * <p>
- * <h4>Sample code</h4>
- * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1
- * \snippet samples/dtptngsample/dtptngsample.cpp addPatternExample
- * <p>
+ * <p>
+ * <h4>Sample code</h4>
+ * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1
+ * \snippet samples/dtptngsample/dtptngsample.cpp addPatternExample
+ * <p>
*/
UDateTimePatternConflict addPattern(const UnicodeString& pattern,
UBool override,
@@ -267,28 +267,28 @@ public:
/**
* Getter corresponding to setAppendItemNames. Values below 0 or at or above
- * UDATPG_FIELD_COUNT are illegal arguments. Note: The more general method
- * for getting date/time field display names is getFieldDisplayName.
+ * UDATPG_FIELD_COUNT are illegal arguments. Note: The more general method
+ * for getting date/time field display names is getFieldDisplayName.
*
* @param field such as UDATPG_ERA_FIELD.
* @return name for field
- * @see getFieldDisplayName
+ * @see getFieldDisplayName
* @stable ICU 3.8
*/
const UnicodeString& getAppendItemName(UDateTimePatternField field) const;
/**
- * The general interface to get a display name for a particular date/time field,
- * in one of several possible display widths.
- *
- * @param field The desired UDateTimePatternField, such as UDATPG_ERA_FIELD.
- * @param width The desired UDateTimePGDisplayWidth, such as UDATPG_ABBREVIATED.
- * @return The display name for field
- * @stable ICU 61
- */
- UnicodeString getFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width) const;
-
- /**
+ * The general interface to get a display name for a particular date/time field,
+ * in one of several possible display widths.
+ *
+ * @param field The desired UDateTimePatternField, such as UDATPG_ERA_FIELD.
+ * @param width The desired UDateTimePGDisplayWidth, such as UDATPG_ABBREVIATED.
+ * @return The display name for field
+ * @stable ICU 61
+ */
+ UnicodeString getFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width) const;
+
+ /**
* The DateTimeFormat is a message format pattern used to compose date and
* time patterns. The default pattern in the root locale is "{1} {0}", where
* {1} will be replaced by the date pattern and {0} will be replaced by the
@@ -330,11 +330,11 @@ public:
* @return bestPattern
* The best pattern found from the given skeleton.
* @stable ICU 3.8
- * <p>
- * <h4>Sample code</h4>
- * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1
- * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample
- * <p>
+ * <p>
+ * <h4>Sample code</h4>
+ * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1
+ * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample
+ * <p>
*/
UnicodeString getBestPattern(const UnicodeString& skeleton, UErrorCode& status);
@@ -378,11 +378,11 @@ public:
* which must not indicate a failure before the function call.
* @return pattern adjusted to match the skeleton fields widths and subtypes.
* @stable ICU 3.8
- * <p>
- * <h4>Sample code</h4>
- * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1
- * \snippet samples/dtptngsample/dtptngsample.cpp replaceFieldTypesExample
- * <p>
+ * <p>
+ * <h4>Sample code</h4>
+ * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1
+ * \snippet samples/dtptngsample/dtptngsample.cpp replaceFieldTypesExample
+ * <p>
*/
UnicodeString replaceFieldTypes(const UnicodeString& pattern,
const UnicodeString& skeleton,
@@ -483,27 +483,27 @@ public:
*/
const UnicodeString& getDecimal() const;
-#if !UCONFIG_NO_FORMATTING
-
-#ifndef U_HIDE_DRAFT_API
- /**
- * Get the default hour cycle for a locale. Uses the locale that the
- * DateTimePatternGenerator was initially created with.
- *
- * Cannot be used on an empty DateTimePatternGenerator instance.
- *
- * @param status Output param set to success/failure code on exit, which
- * which must not indicate a failure before the function call.
- * Set to U_UNSUPPORTED_ERROR if used on an empty instance.
- * @return the default hour cycle.
- * @draft ICU 67
- */
- UDateFormatHourCycle getDefaultHourCycle(UErrorCode& status) const;
-#endif /* U_HIDE_DRAFT_API */
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
-
- /**
+#if !UCONFIG_NO_FORMATTING
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Get the default hour cycle for a locale. Uses the locale that the
+ * DateTimePatternGenerator was initially created with.
+ *
+ * Cannot be used on an empty DateTimePatternGenerator instance.
+ *
+ * @param status Output param set to success/failure code on exit, which
+ * which must not indicate a failure before the function call.
+ * Set to U_UNSUPPORTED_ERROR if used on an empty instance.
+ * @return the default hour cycle.
+ * @draft ICU 67
+ */
+ UDateFormatHourCycle getDefaultHourCycle(UErrorCode& status) const;
+#endif /* U_HIDE_DRAFT_API */
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+ /**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @stable ICU 3.8
@@ -540,37 +540,37 @@ private:
*/
DateTimePatternGenerator& operator=(const DateTimePatternGenerator& other);
- // TODO(ticket:13619): re-enable when UDATPG_NARROW no longer in draft mode.
- // static const int32_t UDATPG_WIDTH_COUNT = UDATPG_NARROW + 1;
-
+ // TODO(ticket:13619): re-enable when UDATPG_NARROW no longer in draft mode.
+ // static const int32_t UDATPG_WIDTH_COUNT = UDATPG_NARROW + 1;
+
Locale pLocale; // pattern locale
FormatParser *fp;
DateTimeMatcher* dtMatcher;
DistanceInfo *distanceInfo;
PatternMap *patternMap;
UnicodeString appendItemFormats[UDATPG_FIELD_COUNT];
- // TODO(ticket:13619): [3] -> UDATPG_WIDTH_COUNT
- UnicodeString fieldDisplayNames[UDATPG_FIELD_COUNT][3];
+ // TODO(ticket:13619): [3] -> UDATPG_WIDTH_COUNT
+ UnicodeString fieldDisplayNames[UDATPG_FIELD_COUNT][3];
UnicodeString dateTimeFormat;
UnicodeString decimal;
DateTimeMatcher *skipMatcher;
Hashtable *fAvailableFormatKeyHash;
UnicodeString emptyString;
- char16_t fDefaultHourFormatChar;
+ char16_t fDefaultHourFormatChar;
int32_t fAllowedHourFormats[7]; // Actually an array of AllowedHourFormat enum type, ending with UNKNOWN.
- // Internal error code used for recording/reporting errors that occur during methods that do not
- // have a UErrorCode parameter. For example: the Copy Constructor, or the ::clone() method.
- // When this is set to an error the object is in an invalid state.
- UErrorCode internalErrorCode;
-
+ // Internal error code used for recording/reporting errors that occur during methods that do not
+ // have a UErrorCode parameter. For example: the Copy Constructor, or the ::clone() method.
+ // When this is set to an error the object is in an invalid state.
+ UErrorCode internalErrorCode;
+
/* internal flags masks for adjustFieldTypes etc. */
enum {
kDTPGNoFlags = 0,
kDTPGFixFractionalSeconds = 1,
- kDTPGSkeletonUsesCapJ = 2
- // with #13183, no longer need flags for b, B
+ kDTPGSkeletonUsesCapJ = 2
+ // with #13183, no longer need flags for b, B
};
void initData(const Locale &locale, UErrorCode &status);
@@ -585,16 +585,16 @@ private:
void setDateTimeFromCalendar(const Locale& locale, UErrorCode& status);
void setDecimalSymbols(const Locale& locale, UErrorCode& status);
UDateTimePatternField getAppendFormatNumber(const char* field) const;
- // Note for the next 3: UDateTimePGDisplayWidth is now stable ICU 61
- UDateTimePatternField getFieldAndWidthIndices(const char* key, UDateTimePGDisplayWidth* widthP) const;
- void setFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width, const UnicodeString& value);
- UnicodeString& getMutableFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width);
+ // Note for the next 3: UDateTimePGDisplayWidth is now stable ICU 61
+ UDateTimePatternField getFieldAndWidthIndices(const char* key, UDateTimePGDisplayWidth* widthP) const;
+ void setFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width, const UnicodeString& value);
+ UnicodeString& getMutableFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width);
void getAppendName(UDateTimePatternField field, UnicodeString& value);
- UnicodeString mapSkeletonMetacharacters(const UnicodeString& patternForm, int32_t* flags, UErrorCode& status);
- const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields, UErrorCode& status, const PtnSkeleton** specifiedSkeletonPtr = 0);
+ UnicodeString mapSkeletonMetacharacters(const UnicodeString& patternForm, int32_t* flags, UErrorCode& status);
+ const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields, UErrorCode& status, const PtnSkeleton** specifiedSkeletonPtr = 0);
UnicodeString adjustFieldTypes(const UnicodeString& pattern, const PtnSkeleton* specifiedSkeleton, int32_t flags, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS);
- UnicodeString getBestAppending(int32_t missingFields, int32_t flags, UErrorCode& status, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS);
- int32_t getTopBitNumber(int32_t foundMask) const;
+ UnicodeString getBestAppending(int32_t missingFields, int32_t flags, UErrorCode& status, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS);
+ int32_t getTopBitNumber(int32_t foundMask) const;
void setAvailableFormat(const UnicodeString &key, UErrorCode& status);
UBool isAvailableFormatSet(const UnicodeString &key) const;
void copyHashtable(Hashtable *other, UErrorCode &status);
@@ -609,6 +609,6 @@ private:
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/dtrule.h b/contrib/libs/icu/include/unicode/dtrule.h
index 4fae05f09e..adab8967f6 100644
--- a/contrib/libs/icu/include/unicode/dtrule.h
+++ b/contrib/libs/icu/include/unicode/dtrule.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -11,8 +11,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: Rule for specifying date and time in an year
@@ -128,7 +128,7 @@ public:
* @return A copy of the object.
* @stable ICU 3.8
*/
- DateTimeRule* clone() const;
+ DateTimeRule* clone() const;
/**
* Assignment operator.
@@ -250,7 +250,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // DTRULE_H
//eof
diff --git a/contrib/libs/icu/include/unicode/edits.h b/contrib/libs/icu/include/unicode/edits.h
index 28f8f9753d..c3ceaccb3b 100644
--- a/contrib/libs/icu/include/unicode/edits.h
+++ b/contrib/libs/icu/include/unicode/edits.h
@@ -1,531 +1,531 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// edits.h
-// created: 2016dec30 Markus W. Scherer
-
-#ifndef __EDITS_H__
-#define __EDITS_H__
-
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
-#include "unicode/uobject.h"
-
-/**
- * \file
- * \brief C++ API: C++ class Edits for low-level string transformations on styled text.
- */
-
-U_NAMESPACE_BEGIN
-
-class UnicodeString;
-
-/**
- * Records lengths of string edits but not replacement text. Supports replacements, insertions, deletions
- * in linear progression. Does not support moving/reordering of text.
- *
- * There are two types of edits: <em>change edits</em> and <em>no-change edits</em>. Add edits to
- * instances of this class using {@link #addReplace(int32_t, int32_t)} (for change edits) and
- * {@link #addUnchanged(int32_t)} (for no-change edits). Change edits are retained with full granularity,
- * whereas adjacent no-change edits are always merged together. In no-change edits, there is a one-to-one
- * mapping between code points in the source and destination strings.
- *
- * After all edits have been added, instances of this class should be considered immutable, and an
- * {@link Edits::Iterator} can be used for queries.
- *
- * There are four flavors of Edits::Iterator:
- *
- * <ul>
- * <li>{@link #getFineIterator()} retains full granularity of change edits.
- * <li>{@link #getFineChangesIterator()} retains full granularity of change edits, and when calling
- * next() on the iterator, skips over no-change edits (unchanged regions).
- * <li>{@link #getCoarseIterator()} treats adjacent change edits as a single edit. (Adjacent no-change
- * edits are automatically merged during the construction phase.)
- * <li>{@link #getCoarseChangesIterator()} treats adjacent change edits as a single edit, and when
- * calling next() on the iterator, skips over no-change edits (unchanged regions).
- * </ul>
- *
- * For example, consider the string "abcßDeF", which case-folds to "abcssdef". This string has the
- * following fine edits:
- * <ul>
- * <li>abc ⇨ abc (no-change)
- * <li>ß ⇨ ss (change)
- * <li>D ⇨ d (change)
- * <li>e ⇨ e (no-change)
- * <li>F ⇨ f (change)
- * </ul>
- * and the following coarse edits (note how adjacent change edits get merged together):
- * <ul>
- * <li>abc ⇨ abc (no-change)
- * <li>ßD ⇨ ssd (change)
- * <li>e ⇨ e (no-change)
- * <li>F ⇨ f (change)
- * </ul>
- *
- * The "fine changes" and "coarse changes" iterators will step through only the change edits when their
- * `Edits::Iterator::next()` methods are called. They are identical to the non-change iterators when
- * their `Edits::Iterator::findSourceIndex()` or `Edits::Iterator::findDestinationIndex()`
- * methods are used to walk through the string.
- *
- * For examples of how to use this class, see the test `TestCaseMapEditsIteratorDocs` in
- * UCharacterCaseTest.java.
- *
- * An Edits object tracks a separate UErrorCode, but ICU string transformation functions
- * (e.g., case mapping functions) merge any such errors into their API's UErrorCode.
- *
- * @stable ICU 59
- */
-class U_COMMON_API Edits U_FINAL : public UMemory {
-public:
- /**
- * Constructs an empty object.
- * @stable ICU 59
- */
- Edits() :
- array(stackArray), capacity(STACK_CAPACITY), length(0), delta(0), numChanges(0),
- errorCode_(U_ZERO_ERROR) {}
- /**
- * Copy constructor.
- * @param other source edits
- * @stable ICU 60
- */
- Edits(const Edits &other) :
- array(stackArray), capacity(STACK_CAPACITY), length(other.length),
- delta(other.delta), numChanges(other.numChanges),
- errorCode_(other.errorCode_) {
- copyArray(other);
- }
- /**
- * Move constructor, might leave src empty.
- * This object will have the same contents that the source object had.
- * @param src source edits
- * @stable ICU 60
- */
- Edits(Edits &&src) U_NOEXCEPT :
- array(stackArray), capacity(STACK_CAPACITY), length(src.length),
- delta(src.delta), numChanges(src.numChanges),
- errorCode_(src.errorCode_) {
- moveArray(src);
- }
-
- /**
- * Destructor.
- * @stable ICU 59
- */
- ~Edits();
-
- /**
- * Assignment operator.
- * @param other source edits
- * @return *this
- * @stable ICU 60
- */
- Edits &operator=(const Edits &other);
-
- /**
- * Move assignment operator, might leave src empty.
- * This object will have the same contents that the source object had.
- * The behavior is undefined if *this and src are the same object.
- * @param src source edits
- * @return *this
- * @stable ICU 60
- */
- Edits &operator=(Edits &&src) U_NOEXCEPT;
-
- /**
- * Resets the data but may not release memory.
- * @stable ICU 59
- */
- void reset() U_NOEXCEPT;
-
- /**
- * Adds a no-change edit: a record for an unchanged segment of text.
- * Normally called from inside ICU string transformation functions, not user code.
- * @stable ICU 59
- */
- void addUnchanged(int32_t unchangedLength);
- /**
- * Adds a change edit: a record for a text replacement/insertion/deletion.
- * Normally called from inside ICU string transformation functions, not user code.
- * @stable ICU 59
- */
- void addReplace(int32_t oldLength, int32_t newLength);
- /**
- * Sets the UErrorCode if an error occurred while recording edits.
- * Preserves older error codes in the outErrorCode.
- * Normally called from inside ICU string transformation functions, not user code.
- * @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)
- * @stable ICU 59
- */
- UBool copyErrorTo(UErrorCode &outErrorCode) const;
-
- /**
- * How much longer is the new text compared with the old text?
- * @return new length minus old length
- * @stable ICU 59
- */
- int32_t lengthDelta() const { return delta; }
- /**
- * @return TRUE if there are any change edits
- * @stable ICU 59
- */
- UBool hasChanges() const { return numChanges != 0; }
-
- /**
- * @return the number of change edits
- * @stable ICU 60
- */
- int32_t numberOfChanges() const { return numChanges; }
-
- /**
- * Access to the list of edits.
- *
- * At any moment in time, an instance of this class points to a single edit: a "window" into a span
- * of the source string and the corresponding span of the destination string. The source string span
- * starts at {@link #sourceIndex()} and runs for {@link #oldLength()} chars; the destination string
- * span starts at {@link #destinationIndex()} and runs for {@link #newLength()} chars.
- *
- * The iterator can be moved between edits using the `next()`, `findSourceIndex(int32_t, UErrorCode &)`,
- * and `findDestinationIndex(int32_t, UErrorCode &)` methods.
- * Calling any of these methods mutates the iterator to make it point to the corresponding edit.
- *
- * For more information, see the documentation for {@link Edits}.
- *
- * @see getCoarseIterator
- * @see getFineIterator
- * @stable ICU 59
- */
- struct U_COMMON_API Iterator U_FINAL : public UMemory {
- /**
- * Default constructor, empty iterator.
- * @stable ICU 60
- */
- Iterator() :
- array(nullptr), index(0), length(0),
- remaining(0), onlyChanges_(FALSE), coarse(FALSE),
- dir(0), changed(FALSE), oldLength_(0), newLength_(0),
- srcIndex(0), replIndex(0), destIndex(0) {}
- /**
- * Copy constructor.
- * @stable ICU 59
- */
- Iterator(const Iterator &other) = default;
- /**
- * Assignment operator.
- * @stable ICU 59
- */
- Iterator &operator=(const Iterator &other) = default;
-
- /**
- * Advances the iterator to the next edit.
- * @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
- * @stable ICU 59
- */
- UBool next(UErrorCode &errorCode) { return next(onlyChanges_, errorCode); }
-
- /**
- * Moves the iterator to the edit that contains the source index.
- * The source index may be found in a no-change edit
- * even if normal iteration would skip no-change edits.
- * Normal iteration can continue from a found edit.
- *
- * The iterator state before this search logically does not matter.
- * (It may affect the performance of the search.)
- *
- * The iterator state after this search is undefined
- * if the source index is out of bounds for the source string.
- *
- * @param i source index
- * @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
- * @stable ICU 59
- */
- UBool findSourceIndex(int32_t i, UErrorCode &errorCode) {
- return findIndex(i, TRUE, errorCode) == 0;
- }
-
- /**
- * Moves the iterator to the edit that contains the destination index.
- * The destination index may be found in a no-change edit
- * even if normal iteration would skip no-change edits.
- * Normal iteration can continue from a found edit.
- *
- * The iterator state before this search logically does not matter.
- * (It may affect the performance of the search.)
- *
- * The iterator state after this search is undefined
- * if the source index is out of bounds for the source string.
- *
- * @param i destination index
- * @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
- * @stable ICU 60
- */
- UBool findDestinationIndex(int32_t i, UErrorCode &errorCode) {
- return findIndex(i, FALSE, errorCode) == 0;
- }
-
- /**
- * Computes the destination index corresponding to the given source index.
- * If the source index is inside a change edit (not at its start),
- * then the destination index at the end of that edit is returned,
- * since there is no information about index mapping inside a change edit.
- *
- * (This means that indexes to the start and middle of an edit,
- * for example around a grapheme cluster, are mapped to indexes
- * encompassing the entire edit.
- * The alternative, mapping an interior index to the start,
- * would map such an interval to an empty one.)
- *
- * This operation will usually but not always modify this object.
- * The iterator state after this search is undefined.
- *
- * @param i source index
- * @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 destination index; undefined if i is not 0..string length
- * @stable ICU 60
- */
- int32_t destinationIndexFromSourceIndex(int32_t i, UErrorCode &errorCode);
-
- /**
- * Computes the source index corresponding to the given destination index.
- * If the destination index is inside a change edit (not at its start),
- * then the source index at the end of that edit is returned,
- * since there is no information about index mapping inside a change edit.
- *
- * (This means that indexes to the start and middle of an edit,
- * for example around a grapheme cluster, are mapped to indexes
- * encompassing the entire edit.
- * The alternative, mapping an interior index to the start,
- * would map such an interval to an empty one.)
- *
- * This operation will usually but not always modify this object.
- * The iterator state after this search is undefined.
- *
- * @param i destination index
- * @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 source index; undefined if i is not 0..string length
- * @stable ICU 60
- */
- int32_t sourceIndexFromDestinationIndex(int32_t i, UErrorCode &errorCode);
-
- /**
- * 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.
- * @stable ICU 59
- */
- UBool hasChange() const { return changed; }
-
- /**
- * The length of the current span in the source string, which starts at {@link #sourceIndex}.
- *
- * @return the number of units in the original string which are replaced or remain unchanged.
- * @stable ICU 59
- */
- int32_t oldLength() const { return oldLength_; }
-
- /**
- * The length of the current span in the destination string, which starts at
- * {@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.
- * @stable ICU 59
- */
- int32_t newLength() const { return newLength_; }
-
- /**
- * The start index of the current span in the source string; the span has length
- * {@link #oldLength}.
- *
- * @return the current index into the source string
- * @stable ICU 59
- */
- int32_t sourceIndex() const { return srcIndex; }
-
- /**
- * The start index of the current span in the replacement string; the span has length
- * {@link #newLength}. Well-defined only if the current edit is a change edit.
- *
- * The *replacement string* is the concatenation of all substrings of the destination
- * string corresponding to change edits.
- *
- * This method is intended to be used together with operations that write only replacement
- * characters (e.g. operations specifying the \ref U_OMIT_UNCHANGED_TEXT option).
- * The source string can then be modified in-place.
- *
- * @return the current index into the replacement-characters-only string,
- * not counting unchanged spans
- * @stable ICU 59
- */
- int32_t replacementIndex() const {
- // TODO: Throw an exception if we aren't in a change edit?
- return replIndex;
- }
-
- /**
- * The start index of the current span in the destination string; the span has length
- * {@link #newLength}.
- *
- * @return the current index into the full destination string
- * @stable ICU 59
- */
- int32_t destinationIndex() const { return destIndex; }
-
-#ifndef U_HIDE_INTERNAL_API
- /**
- * A string representation of the current edit represented by the iterator for debugging. You
- * should not depend on the contents of the return string.
- * @internal
- */
- UnicodeString& toString(UnicodeString& appendTo) const;
-#endif // U_HIDE_INTERNAL_API
-
- private:
- friend class Edits;
-
- Iterator(const uint16_t *a, int32_t len, UBool oc, UBool crs);
-
- int32_t readLength(int32_t head);
- void updateNextIndexes();
- void updatePreviousIndexes();
- UBool noNext();
- UBool next(UBool onlyChanges, UErrorCode &errorCode);
- UBool previous(UErrorCode &errorCode);
- /** @return -1: error or i<0; 0: found; 1: i>=string length */
- int32_t findIndex(int32_t i, UBool findSource, UErrorCode &errorCode);
-
- const uint16_t *array;
- int32_t index, length;
- // 0 if we are not within compressed equal-length changes.
- // Otherwise the number of remaining changes, including the current one.
- int32_t remaining;
- UBool onlyChanges_, coarse;
-
- int8_t dir; // iteration direction: back(<0), initial(0), forward(>0)
- UBool changed;
- int32_t oldLength_, newLength_;
- int32_t srcIndex, replIndex, destIndex;
- };
-
- /**
- * Returns an Iterator for coarse-grained change edits
- * (adjacent change edits are treated as one).
- * Can be used to perform simple string updates.
- * Skips no-change edits.
- * @return an Iterator that merges adjacent changes.
- * @stable ICU 59
- */
- Iterator getCoarseChangesIterator() const {
- return Iterator(array, length, TRUE, TRUE);
- }
-
- /**
- * Returns an Iterator for coarse-grained change and no-change edits
- * (adjacent change edits are treated as one).
- * Can be used to perform simple string updates.
- * Adjacent change edits are treated as one edit.
- * @return an Iterator that merges adjacent changes.
- * @stable ICU 59
- */
- Iterator getCoarseIterator() const {
- return Iterator(array, length, FALSE, TRUE);
- }
-
- /**
- * Returns an Iterator for fine-grained change edits
- * (full granularity of change edits is retained).
- * Can be used for modifying styled text.
- * Skips no-change edits.
- * @return an Iterator that separates adjacent changes.
- * @stable ICU 59
- */
- Iterator getFineChangesIterator() const {
- return Iterator(array, length, TRUE, FALSE);
- }
-
- /**
- * Returns an Iterator for fine-grained change and no-change edits
- * (full granularity of change edits is retained).
- * Can be used for modifying styled text.
- * @return an Iterator that separates adjacent changes.
- * @stable ICU 59
- */
- Iterator getFineIterator() const {
- return Iterator(array, length, FALSE, FALSE);
- }
-
- /**
- * Merges the two input Edits and appends the result to this object.
- *
- * Consider two string transformations (for example, normalization and case mapping)
- * where each records Edits in addition to writing an output string.<br>
- * Edits ab reflect how substrings of input string a
- * map to substrings of intermediate string b.<br>
- * Edits bc reflect how substrings of intermediate string b
- * map to substrings of output string c.<br>
- * This function merges ab and bc such that the additional edits
- * recorded in this object reflect how substrings of input string a
- * map to substrings of output string c.
- *
- * If unrelated Edits are passed in where the output string of the first
- * has a different length than the input string of the second,
- * then a U_ILLEGAL_ARGUMENT_ERROR is reported.
- *
- * @param ab reflects how substrings of input string a
- * map to substrings of intermediate string b.
- * @param bc reflects how substrings of intermediate string b
- * map to substrings of output string c.
- * @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 *this, with the merged edits appended
- * @stable ICU 60
- */
- Edits &mergeAndAppend(const Edits &ab, const Edits &bc, UErrorCode &errorCode);
-
-private:
- void releaseArray() U_NOEXCEPT;
- Edits &copyArray(const Edits &other);
- Edits &moveArray(Edits &src) U_NOEXCEPT;
-
- void setLastUnit(int32_t last) { array[length - 1] = (uint16_t)last; }
- int32_t lastUnit() const { return length > 0 ? array[length - 1] : 0xffff; }
-
- void append(int32_t r);
- UBool growArray();
-
- static const int32_t STACK_CAPACITY = 100;
- uint16_t *array;
- int32_t capacity;
- int32_t length;
- int32_t delta;
- int32_t numChanges;
- UErrorCode errorCode_;
- uint16_t stackArray[STACK_CAPACITY];
-};
-
-U_NAMESPACE_END
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
-#endif // __EDITS_H__
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// edits.h
+// created: 2016dec30 Markus W. Scherer
+
+#ifndef __EDITS_H__
+#define __EDITS_H__
+
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
+#include "unicode/uobject.h"
+
+/**
+ * \file
+ * \brief C++ API: C++ class Edits for low-level string transformations on styled text.
+ */
+
+U_NAMESPACE_BEGIN
+
+class UnicodeString;
+
+/**
+ * Records lengths of string edits but not replacement text. Supports replacements, insertions, deletions
+ * in linear progression. Does not support moving/reordering of text.
+ *
+ * There are two types of edits: <em>change edits</em> and <em>no-change edits</em>. Add edits to
+ * instances of this class using {@link #addReplace(int32_t, int32_t)} (for change edits) and
+ * {@link #addUnchanged(int32_t)} (for no-change edits). Change edits are retained with full granularity,
+ * whereas adjacent no-change edits are always merged together. In no-change edits, there is a one-to-one
+ * mapping between code points in the source and destination strings.
+ *
+ * After all edits have been added, instances of this class should be considered immutable, and an
+ * {@link Edits::Iterator} can be used for queries.
+ *
+ * There are four flavors of Edits::Iterator:
+ *
+ * <ul>
+ * <li>{@link #getFineIterator()} retains full granularity of change edits.
+ * <li>{@link #getFineChangesIterator()} retains full granularity of change edits, and when calling
+ * next() on the iterator, skips over no-change edits (unchanged regions).
+ * <li>{@link #getCoarseIterator()} treats adjacent change edits as a single edit. (Adjacent no-change
+ * edits are automatically merged during the construction phase.)
+ * <li>{@link #getCoarseChangesIterator()} treats adjacent change edits as a single edit, and when
+ * calling next() on the iterator, skips over no-change edits (unchanged regions).
+ * </ul>
+ *
+ * For example, consider the string "abcßDeF", which case-folds to "abcssdef". This string has the
+ * following fine edits:
+ * <ul>
+ * <li>abc ⇨ abc (no-change)
+ * <li>ß ⇨ ss (change)
+ * <li>D ⇨ d (change)
+ * <li>e ⇨ e (no-change)
+ * <li>F ⇨ f (change)
+ * </ul>
+ * and the following coarse edits (note how adjacent change edits get merged together):
+ * <ul>
+ * <li>abc ⇨ abc (no-change)
+ * <li>ßD ⇨ ssd (change)
+ * <li>e ⇨ e (no-change)
+ * <li>F ⇨ f (change)
+ * </ul>
+ *
+ * The "fine changes" and "coarse changes" iterators will step through only the change edits when their
+ * `Edits::Iterator::next()` methods are called. They are identical to the non-change iterators when
+ * their `Edits::Iterator::findSourceIndex()` or `Edits::Iterator::findDestinationIndex()`
+ * methods are used to walk through the string.
+ *
+ * For examples of how to use this class, see the test `TestCaseMapEditsIteratorDocs` in
+ * UCharacterCaseTest.java.
+ *
+ * An Edits object tracks a separate UErrorCode, but ICU string transformation functions
+ * (e.g., case mapping functions) merge any such errors into their API's UErrorCode.
+ *
+ * @stable ICU 59
+ */
+class U_COMMON_API Edits U_FINAL : public UMemory {
+public:
+ /**
+ * Constructs an empty object.
+ * @stable ICU 59
+ */
+ Edits() :
+ array(stackArray), capacity(STACK_CAPACITY), length(0), delta(0), numChanges(0),
+ errorCode_(U_ZERO_ERROR) {}
+ /**
+ * Copy constructor.
+ * @param other source edits
+ * @stable ICU 60
+ */
+ Edits(const Edits &other) :
+ array(stackArray), capacity(STACK_CAPACITY), length(other.length),
+ delta(other.delta), numChanges(other.numChanges),
+ errorCode_(other.errorCode_) {
+ copyArray(other);
+ }
+ /**
+ * Move constructor, might leave src empty.
+ * This object will have the same contents that the source object had.
+ * @param src source edits
+ * @stable ICU 60
+ */
+ Edits(Edits &&src) U_NOEXCEPT :
+ array(stackArray), capacity(STACK_CAPACITY), length(src.length),
+ delta(src.delta), numChanges(src.numChanges),
+ errorCode_(src.errorCode_) {
+ moveArray(src);
+ }
+
+ /**
+ * Destructor.
+ * @stable ICU 59
+ */
+ ~Edits();
+
+ /**
+ * Assignment operator.
+ * @param other source edits
+ * @return *this
+ * @stable ICU 60
+ */
+ Edits &operator=(const Edits &other);
+
+ /**
+ * Move assignment operator, might leave src empty.
+ * This object will have the same contents that the source object had.
+ * The behavior is undefined if *this and src are the same object.
+ * @param src source edits
+ * @return *this
+ * @stable ICU 60
+ */
+ Edits &operator=(Edits &&src) U_NOEXCEPT;
+
+ /**
+ * Resets the data but may not release memory.
+ * @stable ICU 59
+ */
+ void reset() U_NOEXCEPT;
+
+ /**
+ * Adds a no-change edit: a record for an unchanged segment of text.
+ * Normally called from inside ICU string transformation functions, not user code.
+ * @stable ICU 59
+ */
+ void addUnchanged(int32_t unchangedLength);
+ /**
+ * Adds a change edit: a record for a text replacement/insertion/deletion.
+ * Normally called from inside ICU string transformation functions, not user code.
+ * @stable ICU 59
+ */
+ void addReplace(int32_t oldLength, int32_t newLength);
+ /**
+ * Sets the UErrorCode if an error occurred while recording edits.
+ * Preserves older error codes in the outErrorCode.
+ * Normally called from inside ICU string transformation functions, not user code.
+ * @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)
+ * @stable ICU 59
+ */
+ UBool copyErrorTo(UErrorCode &outErrorCode) const;
+
+ /**
+ * How much longer is the new text compared with the old text?
+ * @return new length minus old length
+ * @stable ICU 59
+ */
+ int32_t lengthDelta() const { return delta; }
+ /**
+ * @return TRUE if there are any change edits
+ * @stable ICU 59
+ */
+ UBool hasChanges() const { return numChanges != 0; }
+
+ /**
+ * @return the number of change edits
+ * @stable ICU 60
+ */
+ int32_t numberOfChanges() const { return numChanges; }
+
+ /**
+ * Access to the list of edits.
+ *
+ * At any moment in time, an instance of this class points to a single edit: a "window" into a span
+ * of the source string and the corresponding span of the destination string. The source string span
+ * starts at {@link #sourceIndex()} and runs for {@link #oldLength()} chars; the destination string
+ * span starts at {@link #destinationIndex()} and runs for {@link #newLength()} chars.
+ *
+ * The iterator can be moved between edits using the `next()`, `findSourceIndex(int32_t, UErrorCode &)`,
+ * and `findDestinationIndex(int32_t, UErrorCode &)` methods.
+ * Calling any of these methods mutates the iterator to make it point to the corresponding edit.
+ *
+ * For more information, see the documentation for {@link Edits}.
+ *
+ * @see getCoarseIterator
+ * @see getFineIterator
+ * @stable ICU 59
+ */
+ struct U_COMMON_API Iterator U_FINAL : public UMemory {
+ /**
+ * Default constructor, empty iterator.
+ * @stable ICU 60
+ */
+ Iterator() :
+ array(nullptr), index(0), length(0),
+ remaining(0), onlyChanges_(FALSE), coarse(FALSE),
+ dir(0), changed(FALSE), oldLength_(0), newLength_(0),
+ srcIndex(0), replIndex(0), destIndex(0) {}
+ /**
+ * Copy constructor.
+ * @stable ICU 59
+ */
+ Iterator(const Iterator &other) = default;
+ /**
+ * Assignment operator.
+ * @stable ICU 59
+ */
+ Iterator &operator=(const Iterator &other) = default;
+
+ /**
+ * Advances the iterator to the next edit.
+ * @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
+ * @stable ICU 59
+ */
+ UBool next(UErrorCode &errorCode) { return next(onlyChanges_, errorCode); }
+
+ /**
+ * Moves the iterator to the edit that contains the source index.
+ * The source index may be found in a no-change edit
+ * even if normal iteration would skip no-change edits.
+ * Normal iteration can continue from a found edit.
+ *
+ * The iterator state before this search logically does not matter.
+ * (It may affect the performance of the search.)
+ *
+ * The iterator state after this search is undefined
+ * if the source index is out of bounds for the source string.
+ *
+ * @param i source index
+ * @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
+ * @stable ICU 59
+ */
+ UBool findSourceIndex(int32_t i, UErrorCode &errorCode) {
+ return findIndex(i, TRUE, errorCode) == 0;
+ }
+
+ /**
+ * Moves the iterator to the edit that contains the destination index.
+ * The destination index may be found in a no-change edit
+ * even if normal iteration would skip no-change edits.
+ * Normal iteration can continue from a found edit.
+ *
+ * The iterator state before this search logically does not matter.
+ * (It may affect the performance of the search.)
+ *
+ * The iterator state after this search is undefined
+ * if the source index is out of bounds for the source string.
+ *
+ * @param i destination index
+ * @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
+ * @stable ICU 60
+ */
+ UBool findDestinationIndex(int32_t i, UErrorCode &errorCode) {
+ return findIndex(i, FALSE, errorCode) == 0;
+ }
+
+ /**
+ * Computes the destination index corresponding to the given source index.
+ * If the source index is inside a change edit (not at its start),
+ * then the destination index at the end of that edit is returned,
+ * since there is no information about index mapping inside a change edit.
+ *
+ * (This means that indexes to the start and middle of an edit,
+ * for example around a grapheme cluster, are mapped to indexes
+ * encompassing the entire edit.
+ * The alternative, mapping an interior index to the start,
+ * would map such an interval to an empty one.)
+ *
+ * This operation will usually but not always modify this object.
+ * The iterator state after this search is undefined.
+ *
+ * @param i source index
+ * @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 destination index; undefined if i is not 0..string length
+ * @stable ICU 60
+ */
+ int32_t destinationIndexFromSourceIndex(int32_t i, UErrorCode &errorCode);
+
+ /**
+ * Computes the source index corresponding to the given destination index.
+ * If the destination index is inside a change edit (not at its start),
+ * then the source index at the end of that edit is returned,
+ * since there is no information about index mapping inside a change edit.
+ *
+ * (This means that indexes to the start and middle of an edit,
+ * for example around a grapheme cluster, are mapped to indexes
+ * encompassing the entire edit.
+ * The alternative, mapping an interior index to the start,
+ * would map such an interval to an empty one.)
+ *
+ * This operation will usually but not always modify this object.
+ * The iterator state after this search is undefined.
+ *
+ * @param i destination index
+ * @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 source index; undefined if i is not 0..string length
+ * @stable ICU 60
+ */
+ int32_t sourceIndexFromDestinationIndex(int32_t i, UErrorCode &errorCode);
+
+ /**
+ * 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.
+ * @stable ICU 59
+ */
+ UBool hasChange() const { return changed; }
+
+ /**
+ * The length of the current span in the source string, which starts at {@link #sourceIndex}.
+ *
+ * @return the number of units in the original string which are replaced or remain unchanged.
+ * @stable ICU 59
+ */
+ int32_t oldLength() const { return oldLength_; }
+
+ /**
+ * The length of the current span in the destination string, which starts at
+ * {@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.
+ * @stable ICU 59
+ */
+ int32_t newLength() const { return newLength_; }
+
+ /**
+ * The start index of the current span in the source string; the span has length
+ * {@link #oldLength}.
+ *
+ * @return the current index into the source string
+ * @stable ICU 59
+ */
+ int32_t sourceIndex() const { return srcIndex; }
+
+ /**
+ * The start index of the current span in the replacement string; the span has length
+ * {@link #newLength}. Well-defined only if the current edit is a change edit.
+ *
+ * The *replacement string* is the concatenation of all substrings of the destination
+ * string corresponding to change edits.
+ *
+ * This method is intended to be used together with operations that write only replacement
+ * characters (e.g. operations specifying the \ref U_OMIT_UNCHANGED_TEXT option).
+ * The source string can then be modified in-place.
+ *
+ * @return the current index into the replacement-characters-only string,
+ * not counting unchanged spans
+ * @stable ICU 59
+ */
+ int32_t replacementIndex() const {
+ // TODO: Throw an exception if we aren't in a change edit?
+ return replIndex;
+ }
+
+ /**
+ * The start index of the current span in the destination string; the span has length
+ * {@link #newLength}.
+ *
+ * @return the current index into the full destination string
+ * @stable ICU 59
+ */
+ int32_t destinationIndex() const { return destIndex; }
+
+#ifndef U_HIDE_INTERNAL_API
+ /**
+ * A string representation of the current edit represented by the iterator for debugging. You
+ * should not depend on the contents of the return string.
+ * @internal
+ */
+ UnicodeString& toString(UnicodeString& appendTo) const;
+#endif // U_HIDE_INTERNAL_API
+
+ private:
+ friend class Edits;
+
+ Iterator(const uint16_t *a, int32_t len, UBool oc, UBool crs);
+
+ int32_t readLength(int32_t head);
+ void updateNextIndexes();
+ void updatePreviousIndexes();
+ UBool noNext();
+ UBool next(UBool onlyChanges, UErrorCode &errorCode);
+ UBool previous(UErrorCode &errorCode);
+ /** @return -1: error or i<0; 0: found; 1: i>=string length */
+ int32_t findIndex(int32_t i, UBool findSource, UErrorCode &errorCode);
+
+ const uint16_t *array;
+ int32_t index, length;
+ // 0 if we are not within compressed equal-length changes.
+ // Otherwise the number of remaining changes, including the current one.
+ int32_t remaining;
+ UBool onlyChanges_, coarse;
+
+ int8_t dir; // iteration direction: back(<0), initial(0), forward(>0)
+ UBool changed;
+ int32_t oldLength_, newLength_;
+ int32_t srcIndex, replIndex, destIndex;
+ };
+
+ /**
+ * Returns an Iterator for coarse-grained change edits
+ * (adjacent change edits are treated as one).
+ * Can be used to perform simple string updates.
+ * Skips no-change edits.
+ * @return an Iterator that merges adjacent changes.
+ * @stable ICU 59
+ */
+ Iterator getCoarseChangesIterator() const {
+ return Iterator(array, length, TRUE, TRUE);
+ }
+
+ /**
+ * Returns an Iterator for coarse-grained change and no-change edits
+ * (adjacent change edits are treated as one).
+ * Can be used to perform simple string updates.
+ * Adjacent change edits are treated as one edit.
+ * @return an Iterator that merges adjacent changes.
+ * @stable ICU 59
+ */
+ Iterator getCoarseIterator() const {
+ return Iterator(array, length, FALSE, TRUE);
+ }
+
+ /**
+ * Returns an Iterator for fine-grained change edits
+ * (full granularity of change edits is retained).
+ * Can be used for modifying styled text.
+ * Skips no-change edits.
+ * @return an Iterator that separates adjacent changes.
+ * @stable ICU 59
+ */
+ Iterator getFineChangesIterator() const {
+ return Iterator(array, length, TRUE, FALSE);
+ }
+
+ /**
+ * Returns an Iterator for fine-grained change and no-change edits
+ * (full granularity of change edits is retained).
+ * Can be used for modifying styled text.
+ * @return an Iterator that separates adjacent changes.
+ * @stable ICU 59
+ */
+ Iterator getFineIterator() const {
+ return Iterator(array, length, FALSE, FALSE);
+ }
+
+ /**
+ * Merges the two input Edits and appends the result to this object.
+ *
+ * Consider two string transformations (for example, normalization and case mapping)
+ * where each records Edits in addition to writing an output string.<br>
+ * Edits ab reflect how substrings of input string a
+ * map to substrings of intermediate string b.<br>
+ * Edits bc reflect how substrings of intermediate string b
+ * map to substrings of output string c.<br>
+ * This function merges ab and bc such that the additional edits
+ * recorded in this object reflect how substrings of input string a
+ * map to substrings of output string c.
+ *
+ * If unrelated Edits are passed in where the output string of the first
+ * has a different length than the input string of the second,
+ * then a U_ILLEGAL_ARGUMENT_ERROR is reported.
+ *
+ * @param ab reflects how substrings of input string a
+ * map to substrings of intermediate string b.
+ * @param bc reflects how substrings of intermediate string b
+ * map to substrings of output string c.
+ * @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 *this, with the merged edits appended
+ * @stable ICU 60
+ */
+ Edits &mergeAndAppend(const Edits &ab, const Edits &bc, UErrorCode &errorCode);
+
+private:
+ void releaseArray() U_NOEXCEPT;
+ Edits &copyArray(const Edits &other);
+ Edits &moveArray(Edits &src) U_NOEXCEPT;
+
+ void setLastUnit(int32_t last) { array[length - 1] = (uint16_t)last; }
+ int32_t lastUnit() const { return length > 0 ? array[length - 1] : 0xffff; }
+
+ void append(int32_t r);
+ UBool growArray();
+
+ static const int32_t STACK_CAPACITY = 100;
+ uint16_t *array;
+ int32_t capacity;
+ int32_t length;
+ int32_t delta;
+ int32_t numChanges;
+ UErrorCode errorCode_;
+ uint16_t stackArray[STACK_CAPACITY];
+};
+
+U_NAMESPACE_END
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
+#endif // __EDITS_H__
diff --git a/contrib/libs/icu/include/unicode/enumset.h b/contrib/libs/icu/include/unicode/enumset.h
index 6bee8114d4..bde8c455c0 100644
--- a/contrib/libs/icu/include/unicode/enumset.h
+++ b/contrib/libs/icu/include/unicode/enumset.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -28,7 +28,7 @@ U_NAMESPACE_BEGIN
* enum bitset for boolean fields. Similar to Java EnumSet<>.
* Needs to range check. Used for private instance variables.
* @internal
- * \cond
+ * \cond
*/
template<typename T, uint32_t minValue, uint32_t limitValue>
class EnumSet {
@@ -61,8 +61,8 @@ private:
uint32_t fBools;
};
-/** \endcond */
-
+/** \endcond */
+
U_NAMESPACE_END
#endif /* U_SHOW_CPLUSPLUS_API */
diff --git a/contrib/libs/icu/include/unicode/errorcode.h b/contrib/libs/icu/include/unicode/errorcode.h
index 1d3c09f38d..fe7b518323 100644
--- a/contrib/libs/icu/include/unicode/errorcode.h
+++ b/contrib/libs/icu/include/unicode/errorcode.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: errorcode.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -26,9 +26,9 @@
*/
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
U_NAMESPACE_BEGIN
@@ -139,6 +139,6 @@ protected:
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __ERRORCODE_H__
diff --git a/contrib/libs/icu/include/unicode/fieldpos.h b/contrib/libs/icu/include/unicode/fieldpos.h
index e689b30557..23ee38624b 100644
--- a/contrib/libs/icu/include/unicode/fieldpos.h
+++ b/contrib/libs/icu/include/unicode/fieldpos.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -26,8 +26,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: FieldPosition identifies the fields in a formatted output.
@@ -292,7 +292,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _FIELDPOS
//eof
diff --git a/contrib/libs/icu/include/unicode/filteredbrk.h b/contrib/libs/icu/include/unicode/filteredbrk.h
index a0fe605ee3..4293676325 100644
--- a/contrib/libs/icu/include/unicode/filteredbrk.h
+++ b/contrib/libs/icu/include/unicode/filteredbrk.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -11,9 +11,9 @@
#define FILTEREDBRK_H
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/brkiter.h"
#if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION
@@ -58,26 +58,26 @@ class U_COMMON_API FilteredBreakIteratorBuilder : public UObject {
*/
static FilteredBreakIteratorBuilder *createInstance(const Locale& where, UErrorCode& status);
-#ifndef U_HIDE_DEPRECATED_API
+#ifndef U_HIDE_DEPRECATED_API
+ /**
+ * This function has been deprecated in favor of createEmptyInstance, which has
+ * identical behavior.
+ * @param status The error code.
+ * @return the new builder
+ * @deprecated ICU 60 use createEmptyInstance instead
+ * @see createEmptyInstance()
+ */
+ static FilteredBreakIteratorBuilder *createInstance(UErrorCode &status);
+#endif /* U_HIDE_DEPRECATED_API */
+
/**
- * This function has been deprecated in favor of createEmptyInstance, which has
- * identical behavior.
- * @param status The error code.
- * @return the new builder
- * @deprecated ICU 60 use createEmptyInstance instead
- * @see createEmptyInstance()
- */
- static FilteredBreakIteratorBuilder *createInstance(UErrorCode &status);
-#endif /* U_HIDE_DEPRECATED_API */
-
- /**
* Construct an empty FilteredBreakIteratorBuilder.
* In this state, it will not suppress any segment boundaries.
* @param status The error code.
* @return the new builder
- * @stable ICU 60
+ * @stable ICU 60
*/
- static FilteredBreakIteratorBuilder *createEmptyInstance(UErrorCode &status);
+ static FilteredBreakIteratorBuilder *createEmptyInstance(UErrorCode &status);
/**
* Suppress a certain string from being the end of a segment.
@@ -96,7 +96,7 @@ class U_COMMON_API FilteredBreakIteratorBuilder : public UObject {
* This function does not create any new segment boundaries, but only serves to un-do
* the effect of earlier calls to suppressBreakAfter, or to un-do the effect of
* locale data which may be suppressing certain strings.
- * @param string the exception to remove
+ * @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.
@@ -104,35 +104,35 @@ class U_COMMON_API FilteredBreakIteratorBuilder : public UObject {
*/
virtual UBool unsuppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
+ /**
+ * This function has been deprecated in favor of wrapIteratorWithFilter()
+ * The behavior is identical.
+ * @param adoptBreakIterator the break iterator to adopt
+ * @param status error code
+ * @return the new BreakIterator, owned by the caller.
+ * @deprecated ICU 60 use wrapIteratorWithFilter() instead
+ * @see wrapBreakIteratorWithFilter()
+ */
+ virtual BreakIterator *build(BreakIterator* adoptBreakIterator, UErrorCode& status) = 0;
+#endif // U_FORCE_HIDE_DEPRECATED_API
+
/**
- * This function has been deprecated in favor of wrapIteratorWithFilter()
- * The behavior is identical.
- * @param adoptBreakIterator the break iterator to adopt
- * @param status error code
- * @return the new BreakIterator, owned by the caller.
- * @deprecated ICU 60 use wrapIteratorWithFilter() instead
- * @see wrapBreakIteratorWithFilter()
- */
- virtual BreakIterator *build(BreakIterator* adoptBreakIterator, UErrorCode& status) = 0;
-#endif // U_FORCE_HIDE_DEPRECATED_API
-
- /**
* Wrap (adopt) an existing break iterator in a new filtered instance.
* The resulting BreakIterator is owned by the caller.
* The BreakIteratorFilter may be destroyed before the BreakIterator is destroyed.
* Note that the adoptBreakIterator is adopted by the new BreakIterator
* and should no longer be used by the caller.
* The FilteredBreakIteratorBuilder may be reused.
- * This function is an alias for build()
+ * This function is an alias for build()
* @param adoptBreakIterator the break iterator to adopt
* @param status error code
* @return the new BreakIterator, owned by the caller.
- * @stable ICU 60
+ * @stable ICU 60
*/
- inline BreakIterator *wrapIteratorWithFilter(BreakIterator* adoptBreakIterator, UErrorCode& status) {
- return build(adoptBreakIterator, status);
- }
+ inline BreakIterator *wrapIteratorWithFilter(BreakIterator* adoptBreakIterator, UErrorCode& status) {
+ return build(adoptBreakIterator, status);
+ }
protected:
/**
@@ -147,6 +147,6 @@ U_NAMESPACE_END
#endif // #if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // #ifndef FILTEREDBRK_H
diff --git a/contrib/libs/icu/include/unicode/fmtable.h b/contrib/libs/icu/include/unicode/fmtable.h
index 9496c8b334..7bec4f6906 100644
--- a/contrib/libs/icu/include/unicode/fmtable.h
+++ b/contrib/libs/icu/include/unicode/fmtable.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -19,8 +19,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: Formattable is a thin wrapper for primitive types used for formatting and parsing
@@ -35,11 +35,11 @@
U_NAMESPACE_BEGIN
class CharString;
-namespace number {
-namespace impl {
-class DecimalQuantity;
-}
-}
+namespace number {
+namespace impl {
+class DecimalQuantity;
+}
+}
/**
* Formattable objects can be passed to the Format class or
@@ -645,25 +645,25 @@ public:
* Internal function, do not use.
* TODO: figure out how to make this be non-public.
* NumberFormat::format(Formattable, ...
- * needs to get at the DecimalQuantity, if it exists, for
+ * needs to get at the DecimalQuantity, if it exists, for
* big decimal formatting.
* @internal
*/
- number::impl::DecimalQuantity *getDecimalQuantity() const { return fDecimalQuantity;}
+ number::impl::DecimalQuantity *getDecimalQuantity() const { return fDecimalQuantity;}
/**
- * Export the value of this Formattable to a DecimalQuantity.
- * @internal
+ * Export the value of this Formattable to a DecimalQuantity.
+ * @internal
*/
- void populateDecimalQuantity(number::impl::DecimalQuantity& output, UErrorCode& status) const;
+ void populateDecimalQuantity(number::impl::DecimalQuantity& output, UErrorCode& status) const;
/**
- * Adopt, and set value from, a DecimalQuantity
+ * Adopt, and set value from, a DecimalQuantity
* Internal Function, do not use.
- * @param dq the DecimalQuantity to be adopted
+ * @param dq the DecimalQuantity to be adopted
* @internal
*/
- void adoptDecimalQuantity(number::impl::DecimalQuantity *dq);
+ void adoptDecimalQuantity(number::impl::DecimalQuantity *dq);
/**
* Internal function to return the CharString pointer.
@@ -703,7 +703,7 @@ private:
CharString *fDecimalStr;
- number::impl::DecimalQuantity *fDecimalQuantity;
+ number::impl::DecimalQuantity *fDecimalQuantity;
Type fType;
UnicodeString fBogus; // Bogus string when it's needed.
@@ -753,7 +753,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif //_FMTABLE
//eof
diff --git a/contrib/libs/icu/include/unicode/format.h b/contrib/libs/icu/include/unicode/format.h
index 8f4a2ae78a..96883a81a2 100644
--- a/contrib/libs/icu/include/unicode/format.h
+++ b/contrib/libs/icu/include/unicode/format.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -26,8 +26,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: Base class for all formats.
@@ -305,7 +305,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _FORMAT
//eof
diff --git a/contrib/libs/icu/include/unicode/formattedvalue.h b/contrib/libs/icu/include/unicode/formattedvalue.h
index a58a43dca4..e7ba4ec245 100644
--- a/contrib/libs/icu/include/unicode/formattedvalue.h
+++ b/contrib/libs/icu/include/unicode/formattedvalue.h
@@ -1,318 +1,318 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#ifndef __FORMATTEDVALUE_H__
-#define __FORMATTEDVALUE_H__
-
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/appendable.h"
-#include "unicode/fpositer.h"
-#include "unicode/unistr.h"
-#include "unicode/uformattedvalue.h"
-
-U_NAMESPACE_BEGIN
-
-/**
- * \file
- * \brief C++ API: Abstract operations for localized strings.
- *
- * This file contains declarations for classes that deal with formatted strings. A number
- * of APIs throughout ICU use these classes for expressing their localized output.
- */
-
-/**
- * Represents a span of a string containing a given field.
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#ifndef __FORMATTEDVALUE_H__
+#define __FORMATTEDVALUE_H__
+
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/appendable.h"
+#include "unicode/fpositer.h"
+#include "unicode/unistr.h"
+#include "unicode/uformattedvalue.h"
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \file
+ * \brief C++ API: Abstract operations for localized strings.
*
- * This class differs from FieldPosition in the following ways:
- *
- * 1. It has information on the field category.
- * 2. It allows you to set constraints to use when iterating over field positions.
- * 3. It is used for the newer FormattedValue APIs.
- *
- * This class is not intended for public subclassing.
- *
- * @stable ICU 64
- */
-class U_I18N_API ConstrainedFieldPosition : public UMemory {
- public:
-
- /**
- * Initializes a ConstrainedFieldPosition.
- *
- * By default, the ConstrainedFieldPosition has no iteration constraints.
- *
- * @stable ICU 64
- */
- ConstrainedFieldPosition();
-
- /** @stable ICU 64 */
- ~ConstrainedFieldPosition();
-
- /**
- * Resets this ConstrainedFieldPosition to its initial state, as if it were newly created:
- *
- * - Removes any constraints that may have been set on the instance.
- * - Resets the iteration position.
- *
- * @stable ICU 64
- */
- void reset();
-
- /**
- * Sets a constraint on the field category.
- *
- * When this instance of ConstrainedFieldPosition is passed to FormattedValue#nextPosition,
- * positions are skipped unless they have the given category.
- *
- * Any previously set constraints are cleared.
- *
- * For example, to loop over only the number-related fields:
- *
- * ConstrainedFieldPosition cfpos;
- * cfpos.constrainCategory(UFIELDCATEGORY_NUMBER_FORMAT);
- * while (fmtval.nextPosition(cfpos, status)) {
- * // handle the number-related field position
- * }
- *
- * Changing the constraint while in the middle of iterating over a FormattedValue
- * does not generally have well-defined behavior.
- *
- * @param category The field category to fix when iterating.
- * @stable ICU 64
- */
- void constrainCategory(int32_t category);
-
- /**
- * Sets a constraint on the category and field.
- *
- * When this instance of ConstrainedFieldPosition is passed to FormattedValue#nextPosition,
- * positions are skipped unless they have the given category and field.
- *
- * Any previously set constraints are cleared.
- *
- * For example, to loop over all grouping separators:
- *
- * ConstrainedFieldPosition cfpos;
- * cfpos.constrainField(UFIELDCATEGORY_NUMBER_FORMAT, UNUM_GROUPING_SEPARATOR_FIELD);
- * while (fmtval.nextPosition(cfpos, status)) {
- * // handle the grouping separator position
- * }
- *
- * Changing the constraint while in the middle of iterating over a FormattedValue
- * does not generally have well-defined behavior.
- *
- * @param category The field category to fix when iterating.
- * @param field The field to fix when iterating.
- * @stable ICU 64
- */
- void constrainField(int32_t category, int32_t field);
-
- /**
- * Gets the field category for the current position.
- *
- * The return value is well-defined only after
- * FormattedValue#nextPosition returns TRUE.
- *
- * @return The field category saved in the instance.
- * @stable ICU 64
- */
- inline int32_t getCategory() const {
- return fCategory;
- }
-
- /**
- * Gets the field for the current position.
- *
- * The return value is well-defined only after
- * FormattedValue#nextPosition returns TRUE.
- *
- * @return The field saved in the instance.
- * @stable ICU 64
- */
- inline int32_t getField() const {
- return fField;
- }
-
- /**
- * Gets the INCLUSIVE start index for the current position.
- *
- * The return value is well-defined only after FormattedValue#nextPosition returns TRUE.
- *
- * @return The start index saved in the instance.
- * @stable ICU 64
- */
- inline int32_t getStart() const {
- return fStart;
- }
-
- /**
- * Gets the EXCLUSIVE end index stored for the current position.
- *
- * The return value is well-defined only after FormattedValue#nextPosition returns TRUE.
- *
- * @return The end index saved in the instance.
- * @stable ICU 64
- */
- inline int32_t getLimit() const {
- return fLimit;
- }
-
- ////////////////////////////////////////////////////////////////////
- //// The following methods are for FormattedValue implementers; ////
- //// most users can ignore them. ////
- ////////////////////////////////////////////////////////////////////
-
- /**
- * Gets an int64 that FormattedValue implementations may use for storage.
- *
- * The initial value is zero.
- *
- * Users of FormattedValue should not need to call this method.
- *
- * @return The current iteration context from {@link #setInt64IterationContext}.
- * @stable ICU 64
- */
- inline int64_t getInt64IterationContext() const {
- return fContext;
- }
-
- /**
- * Sets an int64 that FormattedValue implementations may use for storage.
- *
- * Intended to be used by FormattedValue implementations.
- *
- * @param context The new iteration context.
- * @stable ICU 64
- */
- void setInt64IterationContext(int64_t context);
-
- /**
- * Determines whether a given field should be included given the
- * constraints.
- *
- * Intended to be used by FormattedValue implementations.
- *
- * @param category The category to test.
- * @param field The field to test.
- * @stable ICU 64
- */
- UBool matchesField(int32_t category, int32_t field) const;
-
- /**
- * Sets new values for the primary public getters.
- *
- * Intended to be used by FormattedValue implementations.
- *
- * It is up to the implementation to ensure that the user-requested
- * constraints are satisfied. This method does not check!
- *
- * @param category The new field category.
- * @param field The new field.
- * @param start The new inclusive start index.
- * @param limit The new exclusive end index.
- * @stable ICU 64
- */
- void setState(
- int32_t category,
- int32_t field,
- int32_t start,
- int32_t limit);
-
- private:
- int64_t fContext = 0LL;
- int32_t fField = 0;
- int32_t fStart = 0;
- int32_t fLimit = 0;
- int32_t fCategory = UFIELD_CATEGORY_UNDEFINED;
- int8_t fConstraint = 0;
-};
-
-/**
- * An abstract formatted value: a string with associated field attributes.
- * Many formatters format to classes implementing FormattedValue.
- *
- * @stable ICU 64
- */
-class U_I18N_API FormattedValue /* not : public UObject because this is an interface/mixin class */ {
- public:
- /** @stable ICU 64 */
- virtual ~FormattedValue();
-
- /**
- * Returns the formatted string as a self-contained UnicodeString.
- *
- * If you need the string within the current scope only, consider #toTempString.
- *
- * @param status Set if an error occurs.
- * @return a UnicodeString containing the formatted string.
- *
- * @stable ICU 64
- */
- virtual UnicodeString toString(UErrorCode& status) const = 0;
-
- /**
- * Returns the formatted string as a read-only alias to memory owned by the FormattedValue.
- *
- * The return value is valid only as long as this FormattedValue is present and unchanged in
- * memory. If you need the string outside the current scope, consider #toString.
- *
- * The buffer returned by calling UnicodeString#getBuffer() on the return value is
- * guaranteed to be NUL-terminated.
- *
- * @param status Set if an error occurs.
- * @return a temporary UnicodeString containing the formatted string.
- *
- * @stable ICU 64
- */
- virtual UnicodeString toTempString(UErrorCode& status) const = 0;
-
- /**
- * Appends the formatted string to an Appendable.
- *
- * @param appendable
- * The Appendable to which to append the string output.
- * @param status Set if an error occurs.
- * @return The same Appendable, for chaining.
- *
- * @stable ICU 64
- * @see Appendable
- */
- virtual Appendable& appendTo(Appendable& appendable, UErrorCode& status) const = 0;
-
- /**
- * Iterates over field positions in the FormattedValue. This lets you determine the position
- * of specific types of substrings, like a month or a decimal separator.
- *
- * To loop over all field positions:
- *
- * ConstrainedFieldPosition cfpos;
- * while (fmtval.nextPosition(cfpos, status)) {
- * // handle the field position; get information from cfpos
- * }
- *
- * @param cfpos
- * The object used for iteration state. This can provide constraints to iterate over
- * only one specific category or field;
- * see ConstrainedFieldPosition#constrainCategory
- * and ConstrainedFieldPosition#constrainField.
- * @param status Set if an error occurs.
- * @return TRUE if a new occurrence of the field was found;
- * FALSE otherwise or if an error was set.
- *
- * @stable ICU 64
- */
- virtual UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const = 0;
-};
-
-U_NAMESPACE_END
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
-#endif // __FORMATTEDVALUE_H__
+ * This file contains declarations for classes that deal with formatted strings. A number
+ * of APIs throughout ICU use these classes for expressing their localized output.
+ */
+
+/**
+ * Represents a span of a string containing a given field.
+ *
+ * This class differs from FieldPosition in the following ways:
+ *
+ * 1. It has information on the field category.
+ * 2. It allows you to set constraints to use when iterating over field positions.
+ * 3. It is used for the newer FormattedValue APIs.
+ *
+ * This class is not intended for public subclassing.
+ *
+ * @stable ICU 64
+ */
+class U_I18N_API ConstrainedFieldPosition : public UMemory {
+ public:
+
+ /**
+ * Initializes a ConstrainedFieldPosition.
+ *
+ * By default, the ConstrainedFieldPosition has no iteration constraints.
+ *
+ * @stable ICU 64
+ */
+ ConstrainedFieldPosition();
+
+ /** @stable ICU 64 */
+ ~ConstrainedFieldPosition();
+
+ /**
+ * Resets this ConstrainedFieldPosition to its initial state, as if it were newly created:
+ *
+ * - Removes any constraints that may have been set on the instance.
+ * - Resets the iteration position.
+ *
+ * @stable ICU 64
+ */
+ void reset();
+
+ /**
+ * Sets a constraint on the field category.
+ *
+ * When this instance of ConstrainedFieldPosition is passed to FormattedValue#nextPosition,
+ * positions are skipped unless they have the given category.
+ *
+ * Any previously set constraints are cleared.
+ *
+ * For example, to loop over only the number-related fields:
+ *
+ * ConstrainedFieldPosition cfpos;
+ * cfpos.constrainCategory(UFIELDCATEGORY_NUMBER_FORMAT);
+ * while (fmtval.nextPosition(cfpos, status)) {
+ * // handle the number-related field position
+ * }
+ *
+ * Changing the constraint while in the middle of iterating over a FormattedValue
+ * does not generally have well-defined behavior.
+ *
+ * @param category The field category to fix when iterating.
+ * @stable ICU 64
+ */
+ void constrainCategory(int32_t category);
+
+ /**
+ * Sets a constraint on the category and field.
+ *
+ * When this instance of ConstrainedFieldPosition is passed to FormattedValue#nextPosition,
+ * positions are skipped unless they have the given category and field.
+ *
+ * Any previously set constraints are cleared.
+ *
+ * For example, to loop over all grouping separators:
+ *
+ * ConstrainedFieldPosition cfpos;
+ * cfpos.constrainField(UFIELDCATEGORY_NUMBER_FORMAT, UNUM_GROUPING_SEPARATOR_FIELD);
+ * while (fmtval.nextPosition(cfpos, status)) {
+ * // handle the grouping separator position
+ * }
+ *
+ * Changing the constraint while in the middle of iterating over a FormattedValue
+ * does not generally have well-defined behavior.
+ *
+ * @param category The field category to fix when iterating.
+ * @param field The field to fix when iterating.
+ * @stable ICU 64
+ */
+ void constrainField(int32_t category, int32_t field);
+
+ /**
+ * Gets the field category for the current position.
+ *
+ * The return value is well-defined only after
+ * FormattedValue#nextPosition returns TRUE.
+ *
+ * @return The field category saved in the instance.
+ * @stable ICU 64
+ */
+ inline int32_t getCategory() const {
+ return fCategory;
+ }
+
+ /**
+ * Gets the field for the current position.
+ *
+ * The return value is well-defined only after
+ * FormattedValue#nextPosition returns TRUE.
+ *
+ * @return The field saved in the instance.
+ * @stable ICU 64
+ */
+ inline int32_t getField() const {
+ return fField;
+ }
+
+ /**
+ * Gets the INCLUSIVE start index for the current position.
+ *
+ * The return value is well-defined only after FormattedValue#nextPosition returns TRUE.
+ *
+ * @return The start index saved in the instance.
+ * @stable ICU 64
+ */
+ inline int32_t getStart() const {
+ return fStart;
+ }
+
+ /**
+ * Gets the EXCLUSIVE end index stored for the current position.
+ *
+ * The return value is well-defined only after FormattedValue#nextPosition returns TRUE.
+ *
+ * @return The end index saved in the instance.
+ * @stable ICU 64
+ */
+ inline int32_t getLimit() const {
+ return fLimit;
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ //// The following methods are for FormattedValue implementers; ////
+ //// most users can ignore them. ////
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Gets an int64 that FormattedValue implementations may use for storage.
+ *
+ * The initial value is zero.
+ *
+ * Users of FormattedValue should not need to call this method.
+ *
+ * @return The current iteration context from {@link #setInt64IterationContext}.
+ * @stable ICU 64
+ */
+ inline int64_t getInt64IterationContext() const {
+ return fContext;
+ }
+
+ /**
+ * Sets an int64 that FormattedValue implementations may use for storage.
+ *
+ * Intended to be used by FormattedValue implementations.
+ *
+ * @param context The new iteration context.
+ * @stable ICU 64
+ */
+ void setInt64IterationContext(int64_t context);
+
+ /**
+ * Determines whether a given field should be included given the
+ * constraints.
+ *
+ * Intended to be used by FormattedValue implementations.
+ *
+ * @param category The category to test.
+ * @param field The field to test.
+ * @stable ICU 64
+ */
+ UBool matchesField(int32_t category, int32_t field) const;
+
+ /**
+ * Sets new values for the primary public getters.
+ *
+ * Intended to be used by FormattedValue implementations.
+ *
+ * It is up to the implementation to ensure that the user-requested
+ * constraints are satisfied. This method does not check!
+ *
+ * @param category The new field category.
+ * @param field The new field.
+ * @param start The new inclusive start index.
+ * @param limit The new exclusive end index.
+ * @stable ICU 64
+ */
+ void setState(
+ int32_t category,
+ int32_t field,
+ int32_t start,
+ int32_t limit);
+
+ private:
+ int64_t fContext = 0LL;
+ int32_t fField = 0;
+ int32_t fStart = 0;
+ int32_t fLimit = 0;
+ int32_t fCategory = UFIELD_CATEGORY_UNDEFINED;
+ int8_t fConstraint = 0;
+};
+
+/**
+ * An abstract formatted value: a string with associated field attributes.
+ * Many formatters format to classes implementing FormattedValue.
+ *
+ * @stable ICU 64
+ */
+class U_I18N_API FormattedValue /* not : public UObject because this is an interface/mixin class */ {
+ public:
+ /** @stable ICU 64 */
+ virtual ~FormattedValue();
+
+ /**
+ * Returns the formatted string as a self-contained UnicodeString.
+ *
+ * If you need the string within the current scope only, consider #toTempString.
+ *
+ * @param status Set if an error occurs.
+ * @return a UnicodeString containing the formatted string.
+ *
+ * @stable ICU 64
+ */
+ virtual UnicodeString toString(UErrorCode& status) const = 0;
+
+ /**
+ * Returns the formatted string as a read-only alias to memory owned by the FormattedValue.
+ *
+ * The return value is valid only as long as this FormattedValue is present and unchanged in
+ * memory. If you need the string outside the current scope, consider #toString.
+ *
+ * The buffer returned by calling UnicodeString#getBuffer() on the return value is
+ * guaranteed to be NUL-terminated.
+ *
+ * @param status Set if an error occurs.
+ * @return a temporary UnicodeString containing the formatted string.
+ *
+ * @stable ICU 64
+ */
+ virtual UnicodeString toTempString(UErrorCode& status) const = 0;
+
+ /**
+ * Appends the formatted string to an Appendable.
+ *
+ * @param appendable
+ * The Appendable to which to append the string output.
+ * @param status Set if an error occurs.
+ * @return The same Appendable, for chaining.
+ *
+ * @stable ICU 64
+ * @see Appendable
+ */
+ virtual Appendable& appendTo(Appendable& appendable, UErrorCode& status) const = 0;
+
+ /**
+ * Iterates over field positions in the FormattedValue. This lets you determine the position
+ * of specific types of substrings, like a month or a decimal separator.
+ *
+ * To loop over all field positions:
+ *
+ * ConstrainedFieldPosition cfpos;
+ * while (fmtval.nextPosition(cfpos, status)) {
+ * // handle the field position; get information from cfpos
+ * }
+ *
+ * @param cfpos
+ * The object used for iteration state. This can provide constraints to iterate over
+ * only one specific category or field;
+ * see ConstrainedFieldPosition#constrainCategory
+ * and ConstrainedFieldPosition#constrainField.
+ * @param status Set if an error occurs.
+ * @return TRUE if a new occurrence of the field was found;
+ * FALSE otherwise or if an error was set.
+ *
+ * @stable ICU 64
+ */
+ virtual UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const = 0;
+};
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
+#endif // __FORMATTEDVALUE_H__
diff --git a/contrib/libs/icu/include/unicode/fpositer.h b/contrib/libs/icu/include/unicode/fpositer.h
index c314e79b14..3e8a0108f1 100644
--- a/contrib/libs/icu/include/unicode/fpositer.h
+++ b/contrib/libs/icu/include/unicode/fpositer.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -19,9 +19,9 @@
#define FPOSITER_H
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
/**
@@ -109,8 +109,8 @@ private:
*/
void setData(UVector32 *adopt, UErrorCode& status);
- friend class FieldPositionIteratorHandler;
-
+ friend class FieldPositionIteratorHandler;
+
UVector32 *data;
int32_t pos;
};
@@ -119,6 +119,6 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // FPOSITER_H
diff --git a/contrib/libs/icu/include/unicode/gender.h b/contrib/libs/icu/include/unicode/gender.h
index 9587e1ecb3..cf7fee963e 100644
--- a/contrib/libs/icu/include/unicode/gender.h
+++ b/contrib/libs/icu/include/unicode/gender.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -18,15 +18,15 @@
#ifndef _GENDER
#define _GENDER
-/**
- * \file
- * \brief C++ API: GenderInfo computes the gender of a list.
- */
-
+/**
+ * \file
+ * \brief C++ API: GenderInfo computes the gender of a list.
+ */
+
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
#include "unicode/locid.h"
@@ -37,7 +37,7 @@ class GenderInfoTest;
U_NAMESPACE_BEGIN
-/** \internal Forward Declaration */
+/** \internal Forward Declaration */
void U_CALLCONV GenderInfo_initCache(UErrorCode &status);
/**
@@ -116,7 +116,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _GENDER
//eof
diff --git a/contrib/libs/icu/include/unicode/gregocal.h b/contrib/libs/icu/include/unicode/gregocal.h
index 1e68d4372b..4ce40daf3a 100644
--- a/contrib/libs/icu/include/unicode/gregocal.h
+++ b/contrib/libs/icu/include/unicode/gregocal.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
* Copyright (C) 1997-2013, International Business Machines Corporation and others.
@@ -28,8 +28,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
#include "unicode/calendar.h"
@@ -303,7 +303,7 @@ public:
* @return return a polymorphic copy of this calendar.
* @stable ICU 2.0
*/
- virtual GregorianCalendar* clone() const;
+ virtual GregorianCalendar* clone() const;
/**
* Sets the GregorianCalendar change date. This is the point when the switch from
@@ -352,7 +352,7 @@ public:
*/
virtual UBool isEquivalentTo(const Calendar& other) const;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* (Overrides Calendar) Rolls up or down by the given amount in the specified field.
* For more information, see the documentation for Calendar::roll().
@@ -365,7 +365,7 @@ public:
* @deprecated ICU 2.6. Use roll(UCalendarDateFields field, int32_t amount, UErrorCode& status) instead.
*/
virtual void roll(EDateFields field, int32_t amount, UErrorCode& status);
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* (Overrides Calendar) Rolls up or down by the given amount in the specified field.
@@ -778,8 +778,8 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _GREGOCAL
//eof
diff --git a/contrib/libs/icu/include/unicode/icudataver.h b/contrib/libs/icu/include/unicode/icudataver.h
index 21ab501819..1cb202e3d4 100644
--- a/contrib/libs/icu/include/unicode/icudataver.h
+++ b/contrib/libs/icu/include/unicode/icudataver.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/include/unicode/icuplug.h b/contrib/libs/icu/include/unicode/icuplug.h
index e67541cd65..2e57b149e1 100644
--- a/contrib/libs/icu/include/unicode/icuplug.h
+++ b/contrib/libs/icu/include/unicode/icuplug.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -110,7 +110,7 @@
#include "unicode/utypes.h"
-#if UCONFIG_ENABLE_PLUGINS || defined(U_IN_DOXYGEN)
+#if UCONFIG_ENABLE_PLUGINS || defined(U_IN_DOXYGEN)
diff --git a/contrib/libs/icu/include/unicode/idna.h b/contrib/libs/icu/include/unicode/idna.h
index e04050a30e..6dfcfe48db 100644
--- a/contrib/libs/icu/include/unicode/idna.h
+++ b/contrib/libs/icu/include/unicode/idna.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: idna.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -24,8 +24,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_IDNA
#include "unicode/bytestream.h"
@@ -324,7 +324,7 @@ private:
U_NAMESPACE_END
#endif // UCONFIG_NO_IDNA
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __IDNA_H__
diff --git a/contrib/libs/icu/include/unicode/listformatter.h b/contrib/libs/icu/include/unicode/listformatter.h
index af97798271..211055d9d1 100644
--- a/contrib/libs/icu/include/unicode/listformatter.h
+++ b/contrib/libs/icu/include/unicode/listformatter.h
@@ -1,301 +1,301 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-*******************************************************************************
-*
-* Copyright (C) 2012-2016, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-*******************************************************************************
-* file name: listformatter.h
-* encoding: UTF-8
-* tab size: 8 (not used)
-* indentation:4
-*
-* created on: 20120426
-* created by: Umesh P. Nair
-*/
-
-#ifndef __LISTFORMATTER_H__
-#define __LISTFORMATTER_H__
-
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
-#include "unicode/unistr.h"
-#include "unicode/locid.h"
-#include "unicode/formattedvalue.h"
-#include "unicode/ulistformatter.h"
-
-U_NAMESPACE_BEGIN
-
-class FieldPositionHandler;
-class FormattedListData;
-class ListFormatter;
-
-/** @internal */
-class Hashtable;
-
-/** @internal */
-struct ListFormatInternal;
-
-/* The following can't be #ifndef U_HIDE_INTERNAL_API, needed for other .h file declarations */
-/**
- * @internal
- * \cond
- */
-struct ListFormatData : public UMemory {
- UnicodeString twoPattern;
- UnicodeString startPattern;
- UnicodeString middlePattern;
- UnicodeString endPattern;
- Locale locale;
-
- ListFormatData(const UnicodeString& two, const UnicodeString& start, const UnicodeString& middle, const UnicodeString& end,
- const Locale& loc) :
- twoPattern(two), startPattern(start), middlePattern(middle), endPattern(end), locale(loc) {}
-};
-/** \endcond */
-
-
-/**
- * \file
- * \brief C++ API: API for formatting a list.
- */
-
-
-#if !UCONFIG_NO_FORMATTING
-/**
- * An immutable class containing the result of a list formatting operation.
- *
- * Instances of this class are immutable and thread-safe.
- *
- * When calling nextPosition():
- * The fields are returned from start to end. The special field category
- * UFIELD_CATEGORY_LIST_SPAN is used to indicate which argument
- * was inserted at the given position. The span category will
- * always occur before the corresponding instance of UFIELD_CATEGORY_LIST
- * in the nextPosition() iterator.
- *
- * Not intended for public subclassing.
- *
- * @stable ICU 64
- */
-class U_I18N_API FormattedList : public UMemory, public FormattedValue {
- public:
- /**
- * Default constructor; makes an empty FormattedList.
- * @stable ICU 64
- */
- FormattedList() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
-
- /**
- * Move constructor: Leaves the source FormattedList in an undefined state.
- * @stable ICU 64
- */
- FormattedList(FormattedList&& src) U_NOEXCEPT;
-
- /**
- * Destruct an instance of FormattedList.
- * @stable ICU 64
- */
- virtual ~FormattedList() U_OVERRIDE;
-
- /** Copying not supported; use move constructor instead. */
- FormattedList(const FormattedList&) = delete;
-
- /** Copying not supported; use move assignment instead. */
- FormattedList& operator=(const FormattedList&) = delete;
-
- /**
- * Move assignment: Leaves the source FormattedList in an undefined state.
- * @stable ICU 64
- */
- FormattedList& operator=(FormattedList&& src) U_NOEXCEPT;
-
- /** @copydoc FormattedValue::toString() */
- UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
-
- /** @copydoc FormattedValue::toTempString() */
- UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
-
- /** @copydoc FormattedValue::appendTo() */
- Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
-
- /** @copydoc FormattedValue::nextPosition() */
- UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
-
- private:
- FormattedListData *fData;
- UErrorCode fErrorCode;
- explicit FormattedList(FormattedListData *results)
- : fData(results), fErrorCode(U_ZERO_ERROR) {}
- explicit FormattedList(UErrorCode errorCode)
- : fData(nullptr), fErrorCode(errorCode) {}
- friend class ListFormatter;
-};
-#endif // !UCONFIG_NO_FORMATTING
-
-
-/**
- * An immutable class for formatting a list, using data from CLDR (or supplied
- * separately).
- *
- * Example: Input data ["Alice", "Bob", "Charlie", "Delta"] will be formatted
- * as "Alice, Bob, Charlie and Delta" in English.
- *
- * The ListFormatter class is not intended for public subclassing.
- * @stable ICU 50
- */
-class U_I18N_API ListFormatter : public UObject{
-
- public:
-
- /**
- * Copy constructor.
- * @stable ICU 52
- */
- ListFormatter(const ListFormatter&);
-
- /**
- * Assignment operator.
- * @stable ICU 52
- */
- ListFormatter& operator=(const ListFormatter& other);
-
- /**
- * Creates a ListFormatter appropriate for the default locale.
- *
- * @param errorCode ICU error code, set if no data available for default locale.
- * @return Pointer to a ListFormatter object for the default locale,
- * created from internal data derived from CLDR data.
- * @stable ICU 50
- */
- static ListFormatter* createInstance(UErrorCode& errorCode);
-
- /**
- * Creates a ListFormatter appropriate for a locale.
- *
- * @param locale The locale.
- * @param errorCode ICU error code, set if no data available for the given locale.
- * @return A ListFormatter object created from internal data derived from
- * CLDR data.
- * @stable ICU 50
- */
- static ListFormatter* createInstance(const Locale& locale, UErrorCode& errorCode);
-
-#ifndef U_HIDE_DRAFT_API
-#if !UCONFIG_NO_FORMATTING
- /**
- * Creates a ListFormatter for the given locale, list type, and style.
- *
- * @param locale The locale.
- * @param type The type of list formatting to use.
- * @param width The width of formatting to use.
- * @param errorCode ICU error code, set if no data available for the given locale.
- * @return A ListFormatter object created from internal data derived from CLDR data.
- * @draft ICU 67
- */
- static ListFormatter* createInstance(
- const Locale& locale, UListFormatterType type, UListFormatterWidth width, UErrorCode& errorCode);
-#endif /* !UCONFIG_NO_FORMATTING */
-#endif /* U_HIDE_DRAFT_API */
-
-#ifndef U_HIDE_INTERNAL_API
- /**
- * Creates a ListFormatter appropriate for a locale and style.
- *
- * TODO(ICU-20888): Remove this in ICU 68.
- *
- * @param locale The locale.
- * @param style the style, either "standard", "or", "unit", "unit-narrow", or "unit-short"
- * @param errorCode ICU error code, set if no data available for the given locale.
- * @return A ListFormatter object created from internal data derived from
- * CLDR data.
- * @internal
- */
- static ListFormatter* createInstance(const Locale& locale, const char* style, UErrorCode& errorCode);
-#endif /* U_HIDE_INTERNAL_API */
-
- /**
- * Destructor.
- *
- * @stable ICU 50
- */
- virtual ~ListFormatter();
-
-
- /**
- * Formats a list of strings.
- *
- * @param items An array of strings to be combined and formatted.
- * @param n_items Length of the array items.
- * @param appendTo The string to which the result should be appended to.
- * @param errorCode ICU error code, set if there is an error.
- * @return Formatted string combining the elements of items, appended to appendTo.
- * @stable ICU 50
- */
- UnicodeString& format(const UnicodeString items[], int32_t n_items,
- UnicodeString& appendTo, UErrorCode& errorCode) const;
-
-#if !UCONFIG_NO_FORMATTING
- /**
- * Formats a list of strings to a FormattedList, which exposes field
- * position information. The FormattedList contains more information than
- * a FieldPositionIterator.
- *
- * @param items An array of strings to be combined and formatted.
- * @param n_items Length of the array items.
- * @param errorCode ICU error code returned here.
- * @return A FormattedList containing field information.
- * @stable ICU 64
- */
- FormattedList formatStringsToValue(
- const UnicodeString items[],
- int32_t n_items,
- UErrorCode& errorCode) const;
-#endif // !UCONFIG_NO_FORMATTING
-
-#ifndef U_HIDE_INTERNAL_API
- /**
- @internal for MeasureFormat
- */
- UnicodeString& format(
- const UnicodeString items[],
- int32_t n_items,
- UnicodeString& appendTo,
- int32_t index,
- int32_t &offset,
- UErrorCode& errorCode) const;
- /**
- * @internal constructor made public for testing.
- */
- ListFormatter(const ListFormatData &data, UErrorCode &errorCode);
- /**
- * @internal constructor made public for testing.
- */
- ListFormatter(const ListFormatInternal* listFormatterInternal);
-#endif /* U_HIDE_INTERNAL_API */
-
- private:
- static void initializeHash(UErrorCode& errorCode);
- static const ListFormatInternal* getListFormatInternal(const Locale& locale, const char *style, UErrorCode& errorCode);
- struct ListPatternsSink;
- static ListFormatInternal* loadListFormatInternal(const Locale& locale, const char* style, UErrorCode& errorCode);
-
- UnicodeString& format_(
- const UnicodeString items[], int32_t n_items, UnicodeString& appendTo,
- int32_t index, int32_t &offset, FieldPositionHandler* handler, UErrorCode& errorCode) const;
-
- ListFormatter();
-
- ListFormatInternal* owned;
- const ListFormatInternal* data;
-};
-
-U_NAMESPACE_END
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
-#endif // __LISTFORMATTER_H__
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+* Copyright (C) 2012-2016, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: listformatter.h
+* encoding: UTF-8
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 20120426
+* created by: Umesh P. Nair
+*/
+
+#ifndef __LISTFORMATTER_H__
+#define __LISTFORMATTER_H__
+
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
+#include "unicode/unistr.h"
+#include "unicode/locid.h"
+#include "unicode/formattedvalue.h"
+#include "unicode/ulistformatter.h"
+
+U_NAMESPACE_BEGIN
+
+class FieldPositionHandler;
+class FormattedListData;
+class ListFormatter;
+
+/** @internal */
+class Hashtable;
+
+/** @internal */
+struct ListFormatInternal;
+
+/* The following can't be #ifndef U_HIDE_INTERNAL_API, needed for other .h file declarations */
+/**
+ * @internal
+ * \cond
+ */
+struct ListFormatData : public UMemory {
+ UnicodeString twoPattern;
+ UnicodeString startPattern;
+ UnicodeString middlePattern;
+ UnicodeString endPattern;
+ Locale locale;
+
+ ListFormatData(const UnicodeString& two, const UnicodeString& start, const UnicodeString& middle, const UnicodeString& end,
+ const Locale& loc) :
+ twoPattern(two), startPattern(start), middlePattern(middle), endPattern(end), locale(loc) {}
+};
+/** \endcond */
+
+
+/**
+ * \file
+ * \brief C++ API: API for formatting a list.
+ */
+
+
+#if !UCONFIG_NO_FORMATTING
+/**
+ * An immutable class containing the result of a list formatting operation.
+ *
+ * Instances of this class are immutable and thread-safe.
+ *
+ * When calling nextPosition():
+ * The fields are returned from start to end. The special field category
+ * UFIELD_CATEGORY_LIST_SPAN is used to indicate which argument
+ * was inserted at the given position. The span category will
+ * always occur before the corresponding instance of UFIELD_CATEGORY_LIST
+ * in the nextPosition() iterator.
+ *
+ * Not intended for public subclassing.
+ *
+ * @stable ICU 64
+ */
+class U_I18N_API FormattedList : public UMemory, public FormattedValue {
+ public:
+ /**
+ * Default constructor; makes an empty FormattedList.
+ * @stable ICU 64
+ */
+ FormattedList() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
+
+ /**
+ * Move constructor: Leaves the source FormattedList in an undefined state.
+ * @stable ICU 64
+ */
+ FormattedList(FormattedList&& src) U_NOEXCEPT;
+
+ /**
+ * Destruct an instance of FormattedList.
+ * @stable ICU 64
+ */
+ virtual ~FormattedList() U_OVERRIDE;
+
+ /** Copying not supported; use move constructor instead. */
+ FormattedList(const FormattedList&) = delete;
+
+ /** Copying not supported; use move assignment instead. */
+ FormattedList& operator=(const FormattedList&) = delete;
+
+ /**
+ * Move assignment: Leaves the source FormattedList in an undefined state.
+ * @stable ICU 64
+ */
+ FormattedList& operator=(FormattedList&& src) U_NOEXCEPT;
+
+ /** @copydoc FormattedValue::toString() */
+ UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
+
+ /** @copydoc FormattedValue::toTempString() */
+ UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
+
+ /** @copydoc FormattedValue::appendTo() */
+ Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
+
+ /** @copydoc FormattedValue::nextPosition() */
+ UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
+
+ private:
+ FormattedListData *fData;
+ UErrorCode fErrorCode;
+ explicit FormattedList(FormattedListData *results)
+ : fData(results), fErrorCode(U_ZERO_ERROR) {}
+ explicit FormattedList(UErrorCode errorCode)
+ : fData(nullptr), fErrorCode(errorCode) {}
+ friend class ListFormatter;
+};
+#endif // !UCONFIG_NO_FORMATTING
+
+
+/**
+ * An immutable class for formatting a list, using data from CLDR (or supplied
+ * separately).
+ *
+ * Example: Input data ["Alice", "Bob", "Charlie", "Delta"] will be formatted
+ * as "Alice, Bob, Charlie and Delta" in English.
+ *
+ * The ListFormatter class is not intended for public subclassing.
+ * @stable ICU 50
+ */
+class U_I18N_API ListFormatter : public UObject{
+
+ public:
+
+ /**
+ * Copy constructor.
+ * @stable ICU 52
+ */
+ ListFormatter(const ListFormatter&);
+
+ /**
+ * Assignment operator.
+ * @stable ICU 52
+ */
+ ListFormatter& operator=(const ListFormatter& other);
+
+ /**
+ * Creates a ListFormatter appropriate for the default locale.
+ *
+ * @param errorCode ICU error code, set if no data available for default locale.
+ * @return Pointer to a ListFormatter object for the default locale,
+ * created from internal data derived from CLDR data.
+ * @stable ICU 50
+ */
+ static ListFormatter* createInstance(UErrorCode& errorCode);
+
+ /**
+ * Creates a ListFormatter appropriate for a locale.
+ *
+ * @param locale The locale.
+ * @param errorCode ICU error code, set if no data available for the given locale.
+ * @return A ListFormatter object created from internal data derived from
+ * CLDR data.
+ * @stable ICU 50
+ */
+ static ListFormatter* createInstance(const Locale& locale, UErrorCode& errorCode);
+
+#ifndef U_HIDE_DRAFT_API
+#if !UCONFIG_NO_FORMATTING
+ /**
+ * Creates a ListFormatter for the given locale, list type, and style.
+ *
+ * @param locale The locale.
+ * @param type The type of list formatting to use.
+ * @param width The width of formatting to use.
+ * @param errorCode ICU error code, set if no data available for the given locale.
+ * @return A ListFormatter object created from internal data derived from CLDR data.
+ * @draft ICU 67
+ */
+ static ListFormatter* createInstance(
+ const Locale& locale, UListFormatterType type, UListFormatterWidth width, UErrorCode& errorCode);
+#endif /* !UCONFIG_NO_FORMATTING */
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_INTERNAL_API
+ /**
+ * Creates a ListFormatter appropriate for a locale and style.
+ *
+ * TODO(ICU-20888): Remove this in ICU 68.
+ *
+ * @param locale The locale.
+ * @param style the style, either "standard", "or", "unit", "unit-narrow", or "unit-short"
+ * @param errorCode ICU error code, set if no data available for the given locale.
+ * @return A ListFormatter object created from internal data derived from
+ * CLDR data.
+ * @internal
+ */
+ static ListFormatter* createInstance(const Locale& locale, const char* style, UErrorCode& errorCode);
+#endif /* U_HIDE_INTERNAL_API */
+
+ /**
+ * Destructor.
+ *
+ * @stable ICU 50
+ */
+ virtual ~ListFormatter();
+
+
+ /**
+ * Formats a list of strings.
+ *
+ * @param items An array of strings to be combined and formatted.
+ * @param n_items Length of the array items.
+ * @param appendTo The string to which the result should be appended to.
+ * @param errorCode ICU error code, set if there is an error.
+ * @return Formatted string combining the elements of items, appended to appendTo.
+ * @stable ICU 50
+ */
+ UnicodeString& format(const UnicodeString items[], int32_t n_items,
+ UnicodeString& appendTo, UErrorCode& errorCode) const;
+
+#if !UCONFIG_NO_FORMATTING
+ /**
+ * Formats a list of strings to a FormattedList, which exposes field
+ * position information. The FormattedList contains more information than
+ * a FieldPositionIterator.
+ *
+ * @param items An array of strings to be combined and formatted.
+ * @param n_items Length of the array items.
+ * @param errorCode ICU error code returned here.
+ * @return A FormattedList containing field information.
+ * @stable ICU 64
+ */
+ FormattedList formatStringsToValue(
+ const UnicodeString items[],
+ int32_t n_items,
+ UErrorCode& errorCode) const;
+#endif // !UCONFIG_NO_FORMATTING
+
+#ifndef U_HIDE_INTERNAL_API
+ /**
+ @internal for MeasureFormat
+ */
+ UnicodeString& format(
+ const UnicodeString items[],
+ int32_t n_items,
+ UnicodeString& appendTo,
+ int32_t index,
+ int32_t &offset,
+ UErrorCode& errorCode) const;
+ /**
+ * @internal constructor made public for testing.
+ */
+ ListFormatter(const ListFormatData &data, UErrorCode &errorCode);
+ /**
+ * @internal constructor made public for testing.
+ */
+ ListFormatter(const ListFormatInternal* listFormatterInternal);
+#endif /* U_HIDE_INTERNAL_API */
+
+ private:
+ static void initializeHash(UErrorCode& errorCode);
+ static const ListFormatInternal* getListFormatInternal(const Locale& locale, const char *style, UErrorCode& errorCode);
+ struct ListPatternsSink;
+ static ListFormatInternal* loadListFormatInternal(const Locale& locale, const char* style, UErrorCode& errorCode);
+
+ UnicodeString& format_(
+ const UnicodeString items[], int32_t n_items, UnicodeString& appendTo,
+ int32_t index, int32_t &offset, FieldPositionHandler* handler, UErrorCode& errorCode) const;
+
+ ListFormatter();
+
+ ListFormatInternal* owned;
+ const ListFormatInternal* data;
+};
+
+U_NAMESPACE_END
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
+#endif // __LISTFORMATTER_H__
diff --git a/contrib/libs/icu/include/unicode/localebuilder.h b/contrib/libs/icu/include/unicode/localebuilder.h
index b623da8f97..c5836fe270 100644
--- a/contrib/libs/icu/include/unicode/localebuilder.h
+++ b/contrib/libs/icu/include/unicode/localebuilder.h
@@ -1,312 +1,312 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html#License
-#ifndef __LOCALEBUILDER_H__
-#define __LOCALEBUILDER_H__
-
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
-#include "unicode/locid.h"
-#include "unicode/localematcher.h"
-#include "unicode/stringpiece.h"
-#include "unicode/uobject.h"
-
-/**
- * \file
- * \brief C++ API: Builder API for Locale
- */
-
-U_NAMESPACE_BEGIN
-class CharString;
-
-/**
- * <code>LocaleBuilder</code> is used to build instances of <code>Locale</code>
- * from values configured by the setters. Unlike the <code>Locale</code>
- * constructors, the <code>LocaleBuilder</code> checks if a value configured by a
- * setter satisfies the syntax requirements defined by the <code>Locale</code>
- * class. A <code>Locale</code> object created by a <code>LocaleBuilder</code> is
- * well-formed and can be transformed to a well-formed IETF BCP 47 language tag
- * without losing information.
- *
- * <p>The following example shows how to create a <code>Locale</code> object
- * with the <code>LocaleBuilder</code>.
- * <blockquote>
- * <pre>
- * UErrorCode status = U_ZERO_ERROR;
- * Locale aLocale = LocaleBuilder()
- * .setLanguage("sr")
- * .setScript("Latn")
- * .setRegion("RS")
- * .build(status);
- * if (U_SUCCESS(status)) {
- * // ...
- * }
- * </pre>
- * </blockquote>
- *
- * <p>LocaleBuilders can be reused; <code>clear()</code> resets all
- * fields to their default values.
- *
- * <p>LocaleBuilder tracks errors in an internal UErrorCode. For all setters,
- * except setLanguageTag and setLocale, LocaleBuilder will return immediately
- * if the internal UErrorCode is in error state.
- * To reset internal state and error code, call clear method.
- * The setLanguageTag and setLocale method will first clear the internal
- * UErrorCode, then track the error of the validation of the input parameter
- * into the internal UErrorCode.
- *
- * @stable ICU 64
- */
-class U_COMMON_API LocaleBuilder : public UObject {
-public:
- /**
- * Constructs an empty LocaleBuilder. The default value of all
- * fields, extensions, and private use information is the
- * empty string.
- *
- * @stable ICU 64
- */
- LocaleBuilder();
-
- /**
- * Destructor
- * @stable ICU 64
- */
- virtual ~LocaleBuilder();
-
- /**
- * Resets the <code>LocaleBuilder</code> to match the provided
- * <code>locale</code>. Existing state is discarded.
- *
- * <p>All fields of the locale must be well-formed.
- * <p>This method clears the internal UErrorCode.
- *
- * @param locale the locale
- * @return This builder.
- *
- * @stable ICU 64
- */
- LocaleBuilder& setLocale(const Locale& locale);
-
- /**
- * 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.
- *
- * <p>This method clears the internal UErrorCode.
- *
- * @param tag the language tag, defined as
- * [unicode_locale_id](http://www.unicode.org/reports/tr35/tr35.html#unicode_locale_id).
- * @return This builder.
- * @stable ICU 64
- */
- LocaleBuilder& setLanguageTag(StringPiece tag);
-
- /**
- * Sets the language. If <code>language</code> is the empty string, the
- * language in this <code>LocaleBuilder</code> is removed. Otherwise, the
- * <code>language</code> must be well-formed, or else the build() method will
- * later report an U_ILLEGAL_ARGUMENT_ERROR.
- *
- * <p>The syntax of language value is defined as
- * [unicode_language_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_language_subtag).
- *
- * @param language the language
- * @return This builder.
- * @stable ICU 64
- */
- LocaleBuilder& setLanguage(StringPiece language);
-
- /**
- * Sets the script. If <code>script</code> is the empty string, the script in
- * this <code>LocaleBuilder</code> is removed.
- * Otherwise, the <code>script</code> must be well-formed, or else the build()
- * method will later report an U_ILLEGAL_ARGUMENT_ERROR.
- *
- * <p>The script value is a four-letter script code as
- * [unicode_script_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_script_subtag)
- * defined by ISO 15924
- *
- * @param script the script
- * @return This builder.
- * @stable ICU 64
- */
- LocaleBuilder& setScript(StringPiece script);
-
- /**
- * Sets the region. If region is the empty string, the region in this
- * <code>LocaleBuilder</code> is removed. Otherwise, the <code>region</code>
- * must be well-formed, or else the build() method will later report an
- * U_ILLEGAL_ARGUMENT_ERROR.
- *
- * <p>The region value is defined by
- * [unicode_region_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_region_subtag)
- * as a two-letter ISO 3166 code or a three-digit UN M.49 area code.
- *
- * <p>The region value in the <code>Locale</code> created by the
- * <code>LocaleBuilder</code> is always normalized to upper case.
- *
- * @param region the region
- * @return This builder.
- * @stable ICU 64
- */
- LocaleBuilder& setRegion(StringPiece region);
-
- /**
- * Sets the variant. If variant is the empty string, the variant in this
- * <code>LocaleBuilder</code> is removed. Otherwise, the <code>variant</code>
- * must be well-formed, or else the build() method will later report an
- * U_ILLEGAL_ARGUMENT_ERROR.
- *
- * <p><b>Note:</b> This method checks if <code>variant</code>
- * satisfies the
- * [unicode_variant_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_variant_subtag)
- * syntax requirements, and normalizes the value to lowercase letters. However,
- * the <code>Locale</code> class does not impose any syntactic
- * restriction on variant. To set an ill-formed variant, use a Locale constructor.
- * If there are multiple unicode_variant_subtag, the caller must concatenate
- * them with '-' as separator (ex: "foobar-fibar").
- *
- * @param variant the variant
- * @return This builder.
- * @stable ICU 64
- */
- LocaleBuilder& setVariant(StringPiece variant);
-
- /**
- * Sets the extension for the given key. If the value is the empty string,
- * the extension is removed. Otherwise, the <code>key</code> and
- * <code>value</code> must be well-formed, or else the build() method will
- * later report an U_ILLEGAL_ARGUMENT_ERROR.
- *
- * <p><b>Note:</b> The key ('u') is used for the Unicode locale extension.
- * Setting a value for this key replaces any existing Unicode locale key/type
- * pairs with those defined in the extension.
- *
- * <p><b>Note:</b> The key ('x') is used for the private use code. To be
- * well-formed, the value for this key needs only to have subtags of one to
- * eight alphanumeric characters, not two to eight as in the general case.
- *
- * @param key the extension key
- * @param value the extension value
- * @return This builder.
- * @stable ICU 64
- */
- LocaleBuilder& setExtension(char key, StringPiece value);
-
- /**
- * Sets the Unicode locale keyword type for the given key. If the type
- * StringPiece is constructed with a nullptr, the keyword is removed.
- * If the type is the empty string, the keyword is set without type subtags.
- * Otherwise, the key and type must be well-formed, or else the build()
- * method will later report an U_ILLEGAL_ARGUMENT_ERROR.
- *
- * <p>Keys and types are converted to lower case.
- *
- * <p><b>Note</b>:Setting the 'u' extension via {@link #setExtension}
- * replaces all Unicode locale keywords with those defined in the
- * extension.
- *
- * @param key the Unicode locale key
- * @param type the Unicode locale type
- * @return This builder.
- * @stable ICU 64
- */
- LocaleBuilder& setUnicodeLocaleKeyword(
- StringPiece key, StringPiece type);
-
- /**
- * Adds a unicode locale attribute, if not already present, otherwise
- * has no effect. The attribute must not be empty string and must be
- * well-formed or U_ILLEGAL_ARGUMENT_ERROR will be set to status
- * during the build() call.
- *
- * @param attribute the attribute
- * @return This builder.
- * @stable ICU 64
- */
- LocaleBuilder& addUnicodeLocaleAttribute(StringPiece attribute);
-
- /**
- * Removes a unicode locale attribute, if present, otherwise has no
- * effect. The attribute must not be empty string and must be well-formed
- * or U_ILLEGAL_ARGUMENT_ERROR will be set to status during the build() call.
- *
- * <p>Attribute comparison for removal is case-insensitive.
- *
- * @param attribute the attribute
- * @return This builder.
- * @stable ICU 64
- */
- LocaleBuilder& removeUnicodeLocaleAttribute(StringPiece attribute);
-
- /**
- * Resets the builder to its initial, empty state.
- * <p>This method clears the internal UErrorCode.
- *
- * @return this builder
- * @stable ICU 64
- */
- LocaleBuilder& clear();
-
- /**
- * Resets the extensions to their initial, empty state.
- * Language, script, region and variant are unchanged.
- *
- * @return this builder
- * @stable ICU 64
- */
- LocaleBuilder& clearExtensions();
-
- /**
- * Returns an instance of <code>Locale</code> created from the fields set
- * on this builder.
- * If any set methods or during the build() call require memory allocation
- * but fail U_MEMORY_ALLOCATION_ERROR will be set to status.
- * If any of the fields set by the setters are not well-formed, the status
- * will be set to U_ILLEGAL_ARGUMENT_ERROR. The state of the builder will
- * not change after the build() call and the caller is free to keep using
- * the same builder to build more locales.
- *
- * @return a new Locale
- * @stable ICU 64
- */
- 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
- */
- UBool copyErrorTo(UErrorCode &outErrorCode) const;
-#endif /* U_HIDE_DRAFT_API */
-
-private:
- friend class LocaleMatcher::Result;
-
- void copyExtensionsFrom(const Locale& src, UErrorCode& errorCode);
-
- UErrorCode status_;
- char language_[9];
- char script_[5];
- char region_[4];
- CharString *variant_; // Pointer not object so we need not #include internal charstr.h.
- icu::Locale *extensions_; // Pointer not object. Storage for all other fields.
-
-};
-
-U_NAMESPACE_END
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
-#endif // __LOCALEBUILDER_H__
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+#ifndef __LOCALEBUILDER_H__
+#define __LOCALEBUILDER_H__
+
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
+#include "unicode/locid.h"
+#include "unicode/localematcher.h"
+#include "unicode/stringpiece.h"
+#include "unicode/uobject.h"
+
+/**
+ * \file
+ * \brief C++ API: Builder API for Locale
+ */
+
+U_NAMESPACE_BEGIN
+class CharString;
+
+/**
+ * <code>LocaleBuilder</code> is used to build instances of <code>Locale</code>
+ * from values configured by the setters. Unlike the <code>Locale</code>
+ * constructors, the <code>LocaleBuilder</code> checks if a value configured by a
+ * setter satisfies the syntax requirements defined by the <code>Locale</code>
+ * class. A <code>Locale</code> object created by a <code>LocaleBuilder</code> is
+ * well-formed and can be transformed to a well-formed IETF BCP 47 language tag
+ * without losing information.
+ *
+ * <p>The following example shows how to create a <code>Locale</code> object
+ * with the <code>LocaleBuilder</code>.
+ * <blockquote>
+ * <pre>
+ * UErrorCode status = U_ZERO_ERROR;
+ * Locale aLocale = LocaleBuilder()
+ * .setLanguage("sr")
+ * .setScript("Latn")
+ * .setRegion("RS")
+ * .build(status);
+ * if (U_SUCCESS(status)) {
+ * // ...
+ * }
+ * </pre>
+ * </blockquote>
+ *
+ * <p>LocaleBuilders can be reused; <code>clear()</code> resets all
+ * fields to their default values.
+ *
+ * <p>LocaleBuilder tracks errors in an internal UErrorCode. For all setters,
+ * except setLanguageTag and setLocale, LocaleBuilder will return immediately
+ * if the internal UErrorCode is in error state.
+ * To reset internal state and error code, call clear method.
+ * The setLanguageTag and setLocale method will first clear the internal
+ * UErrorCode, then track the error of the validation of the input parameter
+ * into the internal UErrorCode.
+ *
+ * @stable ICU 64
+ */
+class U_COMMON_API LocaleBuilder : public UObject {
+public:
+ /**
+ * Constructs an empty LocaleBuilder. The default value of all
+ * fields, extensions, and private use information is the
+ * empty string.
+ *
+ * @stable ICU 64
+ */
+ LocaleBuilder();
+
+ /**
+ * Destructor
+ * @stable ICU 64
+ */
+ virtual ~LocaleBuilder();
+
+ /**
+ * Resets the <code>LocaleBuilder</code> to match the provided
+ * <code>locale</code>. Existing state is discarded.
+ *
+ * <p>All fields of the locale must be well-formed.
+ * <p>This method clears the internal UErrorCode.
+ *
+ * @param locale the locale
+ * @return This builder.
+ *
+ * @stable ICU 64
+ */
+ LocaleBuilder& setLocale(const Locale& locale);
+
+ /**
+ * 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.
+ *
+ * <p>This method clears the internal UErrorCode.
+ *
+ * @param tag the language tag, defined as
+ * [unicode_locale_id](http://www.unicode.org/reports/tr35/tr35.html#unicode_locale_id).
+ * @return This builder.
+ * @stable ICU 64
+ */
+ LocaleBuilder& setLanguageTag(StringPiece tag);
+
+ /**
+ * Sets the language. If <code>language</code> is the empty string, the
+ * language in this <code>LocaleBuilder</code> is removed. Otherwise, the
+ * <code>language</code> must be well-formed, or else the build() method will
+ * later report an U_ILLEGAL_ARGUMENT_ERROR.
+ *
+ * <p>The syntax of language value is defined as
+ * [unicode_language_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_language_subtag).
+ *
+ * @param language the language
+ * @return This builder.
+ * @stable ICU 64
+ */
+ LocaleBuilder& setLanguage(StringPiece language);
+
+ /**
+ * Sets the script. If <code>script</code> is the empty string, the script in
+ * this <code>LocaleBuilder</code> is removed.
+ * Otherwise, the <code>script</code> must be well-formed, or else the build()
+ * method will later report an U_ILLEGAL_ARGUMENT_ERROR.
+ *
+ * <p>The script value is a four-letter script code as
+ * [unicode_script_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_script_subtag)
+ * defined by ISO 15924
+ *
+ * @param script the script
+ * @return This builder.
+ * @stable ICU 64
+ */
+ LocaleBuilder& setScript(StringPiece script);
+
+ /**
+ * Sets the region. If region is the empty string, the region in this
+ * <code>LocaleBuilder</code> is removed. Otherwise, the <code>region</code>
+ * must be well-formed, or else the build() method will later report an
+ * U_ILLEGAL_ARGUMENT_ERROR.
+ *
+ * <p>The region value is defined by
+ * [unicode_region_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_region_subtag)
+ * as a two-letter ISO 3166 code or a three-digit UN M.49 area code.
+ *
+ * <p>The region value in the <code>Locale</code> created by the
+ * <code>LocaleBuilder</code> is always normalized to upper case.
+ *
+ * @param region the region
+ * @return This builder.
+ * @stable ICU 64
+ */
+ LocaleBuilder& setRegion(StringPiece region);
+
+ /**
+ * Sets the variant. If variant is the empty string, the variant in this
+ * <code>LocaleBuilder</code> is removed. Otherwise, the <code>variant</code>
+ * must be well-formed, or else the build() method will later report an
+ * U_ILLEGAL_ARGUMENT_ERROR.
+ *
+ * <p><b>Note:</b> This method checks if <code>variant</code>
+ * satisfies the
+ * [unicode_variant_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_variant_subtag)
+ * syntax requirements, and normalizes the value to lowercase letters. However,
+ * the <code>Locale</code> class does not impose any syntactic
+ * restriction on variant. To set an ill-formed variant, use a Locale constructor.
+ * If there are multiple unicode_variant_subtag, the caller must concatenate
+ * them with '-' as separator (ex: "foobar-fibar").
+ *
+ * @param variant the variant
+ * @return This builder.
+ * @stable ICU 64
+ */
+ LocaleBuilder& setVariant(StringPiece variant);
+
+ /**
+ * Sets the extension for the given key. If the value is the empty string,
+ * the extension is removed. Otherwise, the <code>key</code> and
+ * <code>value</code> must be well-formed, or else the build() method will
+ * later report an U_ILLEGAL_ARGUMENT_ERROR.
+ *
+ * <p><b>Note:</b> The key ('u') is used for the Unicode locale extension.
+ * Setting a value for this key replaces any existing Unicode locale key/type
+ * pairs with those defined in the extension.
+ *
+ * <p><b>Note:</b> The key ('x') is used for the private use code. To be
+ * well-formed, the value for this key needs only to have subtags of one to
+ * eight alphanumeric characters, not two to eight as in the general case.
+ *
+ * @param key the extension key
+ * @param value the extension value
+ * @return This builder.
+ * @stable ICU 64
+ */
+ LocaleBuilder& setExtension(char key, StringPiece value);
+
+ /**
+ * Sets the Unicode locale keyword type for the given key. If the type
+ * StringPiece is constructed with a nullptr, the keyword is removed.
+ * If the type is the empty string, the keyword is set without type subtags.
+ * Otherwise, the key and type must be well-formed, or else the build()
+ * method will later report an U_ILLEGAL_ARGUMENT_ERROR.
+ *
+ * <p>Keys and types are converted to lower case.
+ *
+ * <p><b>Note</b>:Setting the 'u' extension via {@link #setExtension}
+ * replaces all Unicode locale keywords with those defined in the
+ * extension.
+ *
+ * @param key the Unicode locale key
+ * @param type the Unicode locale type
+ * @return This builder.
+ * @stable ICU 64
+ */
+ LocaleBuilder& setUnicodeLocaleKeyword(
+ StringPiece key, StringPiece type);
+
+ /**
+ * Adds a unicode locale attribute, if not already present, otherwise
+ * has no effect. The attribute must not be empty string and must be
+ * well-formed or U_ILLEGAL_ARGUMENT_ERROR will be set to status
+ * during the build() call.
+ *
+ * @param attribute the attribute
+ * @return This builder.
+ * @stable ICU 64
+ */
+ LocaleBuilder& addUnicodeLocaleAttribute(StringPiece attribute);
+
+ /**
+ * Removes a unicode locale attribute, if present, otherwise has no
+ * effect. The attribute must not be empty string and must be well-formed
+ * or U_ILLEGAL_ARGUMENT_ERROR will be set to status during the build() call.
+ *
+ * <p>Attribute comparison for removal is case-insensitive.
+ *
+ * @param attribute the attribute
+ * @return This builder.
+ * @stable ICU 64
+ */
+ LocaleBuilder& removeUnicodeLocaleAttribute(StringPiece attribute);
+
+ /**
+ * Resets the builder to its initial, empty state.
+ * <p>This method clears the internal UErrorCode.
+ *
+ * @return this builder
+ * @stable ICU 64
+ */
+ LocaleBuilder& clear();
+
+ /**
+ * Resets the extensions to their initial, empty state.
+ * Language, script, region and variant are unchanged.
+ *
+ * @return this builder
+ * @stable ICU 64
+ */
+ LocaleBuilder& clearExtensions();
+
+ /**
+ * Returns an instance of <code>Locale</code> created from the fields set
+ * on this builder.
+ * If any set methods or during the build() call require memory allocation
+ * but fail U_MEMORY_ALLOCATION_ERROR will be set to status.
+ * If any of the fields set by the setters are not well-formed, the status
+ * will be set to U_ILLEGAL_ARGUMENT_ERROR. The state of the builder will
+ * not change after the build() call and the caller is free to keep using
+ * the same builder to build more locales.
+ *
+ * @return a new Locale
+ * @stable ICU 64
+ */
+ 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
+ */
+ UBool copyErrorTo(UErrorCode &outErrorCode) const;
+#endif /* U_HIDE_DRAFT_API */
+
+private:
+ friend class LocaleMatcher::Result;
+
+ void copyExtensionsFrom(const Locale& src, UErrorCode& errorCode);
+
+ UErrorCode status_;
+ char language_[9];
+ char script_[5];
+ char region_[4];
+ CharString *variant_; // Pointer not object so we need not #include internal charstr.h.
+ icu::Locale *extensions_; // Pointer not object. Storage for all other fields.
+
+};
+
+U_NAMESPACE_END
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
+#endif // __LOCALEBUILDER_H__
diff --git a/contrib/libs/icu/include/unicode/localematcher.h b/contrib/libs/icu/include/unicode/localematcher.h
index fa97014fb7..2e1a7a349f 100644
--- a/contrib/libs/icu/include/unicode/localematcher.h
+++ b/contrib/libs/icu/include/unicode/localematcher.h
@@ -1,665 +1,665 @@
-// © 2019 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html#License
-
-// localematcher.h
-// created: 2019may08 Markus W. Scherer
-
-#ifndef __LOCALEMATCHER_H__
-#define __LOCALEMATCHER_H__
-
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
-#include "unicode/locid.h"
-#include "unicode/stringpiece.h"
-#include "unicode/uobject.h"
-
-/**
- * \file
- * \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
- */
-enum ULocMatchFavorSubtag {
- /**
- * Language differences are most important, then script differences, then region differences.
- * (This is the default behavior.)
- *
- * @draft ICU 65
- */
- ULOCMATCH_FAVOR_LANGUAGE,
- /**
- * Makes script differences matter relatively more than language differences.
- *
- * @draft ICU 65
- */
- ULOCMATCH_FAVOR_SCRIPT
-};
-#ifndef U_IN_DOXYGEN
-typedef enum ULocMatchFavorSubtag ULocMatchFavorSubtag;
-#endif
-
-/**
- * Builder option for whether all desired locales are treated equally or
- * earlier ones are preferred.
- *
- * @see Builder#setDemotionPerDesiredLocale(ULocMatchDemotion)
- * @draft ICU 65
- */
-enum ULocMatchDemotion {
- /**
- * All desired locales are treated equally.
- *
- * @draft ICU 65
- */
- ULOCMATCH_DEMOTION_NONE,
- /**
- * Earlier desired locales are preferred.
- *
- * <p>From each desired locale to the next,
- * the distance to any supported locale is increased by an additional amount
- * which is at least as large as most region mismatches.
- * A later desired locale has to have a better match with some supported locale
- * due to more than merely having the same region subtag.
- *
- * <p>For example: <code>Supported={en, sv} desired=[en-GB, sv]</code>
- * yields <code>Result(en-GB, en)</code> because
- * with the demotion of sv its perfect match is no better than
- * the region distance between the earlier desired locale en-GB and en=en-US.
- *
- * <p>Notes:
- * <ul>
- * <li>In some cases, language and/or script differences can be as small as
- * the typical region difference. (Example: sr-Latn vs. sr-Cyrl)
- * <li>It is possible for certain region differences to be larger than usual,
- * and larger than the demotion.
- * (As of CLDR 35 there is no such case, but
- * this is possible in future versions of the data.)
- * </ul>
- *
- * @draft ICU 65
- */
- ULOCMATCH_DEMOTION_REGION
-};
-#ifndef U_IN_DOXYGEN
-typedef enum ULocMatchDemotion ULocMatchDemotion;
-#endif
-
-/**
- * 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.
- * Sometimes it is desirable to ignore those.
- *
- * <p>For example, consider a web application with the UI in a given language,
- * with a link to another, related web app.
- * The link should include the UI language, and the target server may also use
- * the client’s Accept-Language header data.
- * The target server has its own list of supported languages.
- * One may want to favor UI language consistency, that is,
- * 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)
- * @draft ICU 67
- */
-enum ULocMatchDirection {
- /**
- * Locale matching includes one-way matches such as Breton→French. (default)
- *
- * @draft ICU 67
- */
- ULOCMATCH_DIRECTION_WITH_ONE_WAY,
- /**
- * Locale matching limited to two-way matches including e.g. Danish↔Norwegian
- * but ignoring one-way matches.
- *
- * @draft ICU 67
- */
- ULOCMATCH_DIRECTION_ONLY_TWO_WAY
-};
-#ifndef U_IN_DOXYGEN
-typedef enum ULocMatchDirection ULocMatchDirection;
-#endif
-
-struct UHashtable;
-
-U_NAMESPACE_BEGIN
-
-struct LSR;
-
-class LocaleDistance;
-class LocaleLsrIterator;
-class UVector;
-class XLikelySubtags;
-
-/**
- * Immutable class that picks the best match between a user's desired locales and
- * an application's supported locales.
- * Movable but not copyable.
- *
- * <p>Example:
- * <pre>
- * UErrorCode errorCode = U_ZERO_ERROR;
- * LocaleMatcher matcher = LocaleMatcher::Builder().setSupportedLocales("fr, en-GB, en").build(errorCode);
- * Locale *bestSupported = matcher.getBestLocale(Locale.US, errorCode); // "en"
- * </pre>
- *
- * <p>A matcher takes into account when languages are close to one another,
- * such as Danish and Norwegian,
- * and when regional variants are close, like en-GB and en-AU as opposed to en-US.
- *
- * <p>If there are multiple supported locales with the same (language, script, region)
- * likely subtags, then the current implementation returns the first of those locales.
- * It ignores variant subtags (except for pseudolocale variants) and extensions.
- * This may change in future versions.
- *
- * <p>For example, the current implementation does not distinguish between
- * de, de-DE, de-Latn, de-1901, de-u-co-phonebk.
- *
- * <p>If you prefer one equivalent locale over another, then provide only the preferred one,
- * or place it earlier in the list of supported locales.
- *
- * <p>Otherwise, the order of supported locales may have no effect on the best-match results.
- * The current implementation compares each desired locale with supported locales
- * in the following order:
- * 1. Default locale, if supported;
- * 2. CLDR "paradigm locales" like en-GB and es-419;
- * 3. other supported locales.
- * This may change in future versions.
- *
- * <p>Often a product will just need one matcher instance, built with the languages
- * that it supports. However, it may want multiple instances with different
- * default languages based on additional information, such as the domain.
- *
- * <p>This class is not intended for public subclassing.
- *
- * @draft ICU 65
- */
-class U_COMMON_API LocaleMatcher : public UMemory {
-public:
- /**
- * Data for the best-matching pair of a desired and a supported locale.
- * Movable but not copyable.
- *
- * @draft ICU 65
- */
- class U_COMMON_API Result : public UMemory {
- public:
- /**
- * Move constructor; might modify the source.
- * This object will have the same contents that the source object had.
- *
- * @param src Result to move contents from.
- * @draft ICU 65
- */
- Result(Result &&src) U_NOEXCEPT;
-
- /**
- * Destructor.
- *
- * @draft ICU 65
- */
- ~Result();
-
- /**
- * Move assignment; might modify the source.
- * This object will have the same contents that the source object had.
- *
- * @param src Result to move contents from.
- * @draft 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
- */
- 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.
- *
- * @return the best-matching supported locale, or nullptr.
- * @draft ICU 65
- */
- inline const Locale *getSupportedLocale() const { return supportedLocale; }
-
- /**
- * Returns the index of the best-matching desired locale in the input Iterable order.
- * -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
- */
- inline int32_t getDesiredIndex() const { return desiredIndex; }
-
- /**
- * Returns the index of the best-matching supported locale in the
- * constructor’s or builder’s input order (“set” Collection plus “added” locales).
- * If the matcher was built from a locale list string, then the iteration order is that
- * of a LocalePriorityList built from the same string.
- * -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
- */
- inline int32_t getSupportedIndex() const { return supportedIndex; }
-
- /**
- * Takes the best-matching supported locale and adds relevant fields of the
- * best-matching desired locale, such as the -t- and -u- extensions.
- * May replace some fields of the supported locale.
- * The result is the locale that should be used for date and number formatting, collation, etc.
- * Returns the root locale if getSupportedLocale() returns nullptr.
- *
- * <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
- */
- Locale makeResolvedLocale(UErrorCode &errorCode) const;
-#endif // U_HIDE_DRAFT_API
-
- private:
- Result(const Locale *desired, const Locale *supported,
- int32_t desIndex, int32_t suppIndex, UBool owned) :
- desiredLocale(desired), supportedLocale(supported),
- desiredIndex(desIndex), supportedIndex(suppIndex),
- desiredIsOwned(owned) {}
-
- Result(const Result &other) = delete;
- Result &operator=(const Result &other) = delete;
-
- const Locale *desiredLocale;
- const Locale *supportedLocale;
- int32_t desiredIndex;
- int32_t supportedIndex;
- UBool desiredIsOwned;
-
- friend class LocaleMatcher;
- };
-
- /**
- * LocaleMatcher builder.
- * Movable but not copyable.
- *
- * @see LocaleMatcher#builder()
- * @draft ICU 65
- */
- class U_COMMON_API Builder : public UMemory {
- public:
- /**
- * Constructs a builder used in chaining parameters for building a LocaleMatcher.
- *
- * @return a new Builder object
- * @draft ICU 65
- */
- Builder() {}
-
- /**
- * Move constructor; might modify the source.
- * This builder will have the same contents that the source builder had.
- *
- * @param src Builder to move contents from.
- * @draft ICU 65
- */
- Builder(Builder &&src) U_NOEXCEPT;
-
- /**
- * Destructor.
- *
- * @draft ICU 65
- */
- ~Builder();
-
- /**
- * Move assignment; might modify the source.
- * This builder will have the same contents that the source builder had.
- *
- * @param src Builder to move contents from.
- * @draft 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>),
- * such as "af, en, fr;q=0.9", and sets the supported locales accordingly.
- * Allows whitespace in more places but does not allow "*".
- * Clears any previously set/added supported locales first.
- *
- * @param locales the Accept-Language string of locales to set
- * @return this Builder object
- * @draft ICU 65
- */
- Builder &setSupportedLocalesFromListString(StringPiece locales);
-
- /**
- * Copies the supported locales, preserving iteration order.
- * Clears any previously set/added supported locales first.
- * Duplicates are allowed, and are not removed.
- *
- * @param locales the list of locale
- * @return this Builder object
- * @draft ICU 65
- */
- Builder &setSupportedLocales(Locale::Iterator &locales);
-
- /**
- * Copies the supported locales from the begin/end range, preserving iteration order.
- * Clears any previously set/added supported locales first.
- * Duplicates are allowed, and are not removed.
- *
- * Each of the iterator parameter values must be an
- * input iterator whose value is convertible to const Locale &.
- *
- * @param begin Start of range.
- * @param end Exclusive end of range.
- * @return this Builder object
- * @draft ICU 65
- */
- template<typename Iter>
- Builder &setSupportedLocales(Iter begin, Iter end) {
- if (U_FAILURE(errorCode_)) { return *this; }
- clearSupportedLocales();
- while (begin != end) {
- addSupportedLocale(*begin++);
- }
- return *this;
- }
-
- /**
- * Copies the supported locales from the begin/end range, preserving iteration order.
- * Calls the converter to convert each *begin to a Locale or const Locale &.
- * Clears any previously set/added supported locales first.
- * Duplicates are allowed, and are not removed.
- *
- * Each of the iterator parameter values must be an
- * input iterator whose value is convertible to const Locale &.
- *
- * @param begin Start of range.
- * @param end Exclusive end of range.
- * @param converter Converter from *begin to const Locale & or compatible.
- * @return this Builder object
- * @draft ICU 65
- */
- template<typename Iter, typename Conv>
- Builder &setSupportedLocalesViaConverter(Iter begin, Iter end, Conv converter) {
- if (U_FAILURE(errorCode_)) { return *this; }
- clearSupportedLocales();
- while (begin != end) {
- addSupportedLocale(converter(*begin++));
- }
- return *this;
- }
-
- /**
- * Adds another supported locale.
- * Duplicates are allowed, and are not removed.
- *
- * @param locale another locale
- * @return this Builder object
- * @draft ICU 65
- */
- Builder &addSupportedLocale(const Locale &locale);
-
- /**
- * Sets the default locale; if nullptr, or if it is not set explicitly,
- * then the first supported locale is used as the default locale.
- *
- * @param defaultLocale the default locale (will be copied)
- * @return this Builder object
- * @draft ICU 65
- */
- Builder &setDefaultLocale(const Locale *defaultLocale);
-
- /**
- * If ULOCMATCH_FAVOR_SCRIPT, then the language differences are smaller than script
- * differences.
- * This is used in situations (such as maps) where
- * it is better to fall back to the same script than a similar language.
- *
- * @param subtag the subtag to favor
- * @return this Builder object
- * @draft ICU 65
- */
- Builder &setFavorSubtag(ULocMatchFavorSubtag subtag);
-
- /**
- * Option for whether all desired locales are treated equally or
- * earlier ones are preferred (this is the default).
- *
- * @param demotion the demotion per desired locale to set.
- * @return this Builder object
- * @draft ICU 65
- */
- Builder &setDemotionPerDesiredLocale(ULocMatchDemotion demotion);
-
- /**
- * Option for whether to include or ignore one-way (fallback) match data.
- * By default, they are included.
- *
- * @param direction the match direction to set.
- * @return this Builder object
- * @draft ICU 67
- */
- Builder &setDirection(ULocMatchDirection direction) {
- if (U_SUCCESS(errorCode_)) {
- direction_ = direction;
- }
- return *this;
- }
-
- /**
- * Sets the UErrorCode if an error occurred while setting parameters.
- * Preserves older error codes in the outErrorCode.
- *
- * @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
- */
- UBool copyErrorTo(UErrorCode &outErrorCode) const;
-
- /**
- * Builds and returns a new locale matcher.
- * This builder can continue to be used.
- *
- * @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
- */
- LocaleMatcher build(UErrorCode &errorCode) const;
-#endif // U_HIDE_DRAFT_API
-
- private:
- friend class LocaleMatcher;
-
- Builder(const Builder &other) = delete;
- Builder &operator=(const Builder &other) = delete;
-
- void clearSupportedLocales();
- bool ensureSupportedLocaleVector();
-
- UErrorCode errorCode_ = U_ZERO_ERROR;
- UVector *supportedLocales_ = nullptr;
- int32_t thresholdDistance_ = -1;
- ULocMatchDemotion demotion_ = ULOCMATCH_DEMOTION_REGION;
- Locale *defaultLocale_ = nullptr;
- ULocMatchFavorSubtag favor_ = ULOCMATCH_FAVOR_LANGUAGE;
- ULocMatchDirection direction_ = ULOCMATCH_DIRECTION_WITH_ONE_WAY;
- };
-
- // FYI No public LocaleMatcher constructors in C++; use the Builder.
-
- /**
- * 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
- */
- LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT;
-
- /**
- * Destructor.
- * @draft ICU 65
- */
- ~LocaleMatcher();
-
- /**
- * Move assignment operator; might modify the source.
- * This matcher will have the same settings that the source matcher had.
- * The behavior is undefined if *this and src are the same object.
- * @param src source matcher
- * @return *this
- * @draft ICU 65
- */
- LocaleMatcher &operator=(LocaleMatcher &&src) U_NOEXCEPT;
-
-#ifndef U_HIDE_DRAFT_API
- /**
- * Returns the supported locale which best matches the desired locale.
- *
- * @param desiredLocale Typically a user's language.
- * @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 the best-matching supported locale.
- * @draft ICU 65
- */
- const Locale *getBestMatch(const Locale &desiredLocale, UErrorCode &errorCode) const;
-
- /**
- * Returns the supported locale which best matches one of the desired locales.
- *
- * @param desiredLocales Typically a user's languages, in order of preference (descending).
- * @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 the best-matching supported locale.
- * @draft ICU 65
- */
- const Locale *getBestMatch(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const;
-
- /**
- * Parses an Accept-Language string
- * (<a href="https://tools.ietf.org/html/rfc2616#section-14.4">RFC 2616 Section 14.4</a>),
- * such as "af, en, fr;q=0.9",
- * and returns the supported locale which best matches one of the desired locales.
- * Allows whitespace in more places but does not allow "*".
- *
- * @param desiredLocaleList Typically a user's languages, as an Accept-Language string.
- * @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 the best-matching supported locale.
- * @draft ICU 65
- */
- const Locale *getBestMatchForListString(StringPiece desiredLocaleList, UErrorCode &errorCode) const;
-
- /**
- * Returns the best match between the desired locale and the supported locales.
- * If the result's desired locale is not nullptr, then it is the address of the input locale.
- * It has not been cloned.
- *
- * @param desiredLocale Typically a user's language.
- * @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 the best-matching pair of the desired and a supported locale.
- * @draft ICU 65
- */
- Result getBestMatchResult(const Locale &desiredLocale, UErrorCode &errorCode) const;
-
- /**
- * Returns the best match between the desired and supported locales.
- * If the result's desired locale is not nullptr, then it is a clone of
- * the best-matching desired locale. The Result object owns the clone.
- *
- * @param desiredLocales Typically a user's languages, in order of preference (descending).
- * @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 the best-matching pair of a desired and a supported locale.
- * @draft ICU 65
- */
- Result getBestMatchResult(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const;
-#endif // U_HIDE_DRAFT_API
-
-#ifndef U_HIDE_INTERNAL_API
- /**
- * Returns a fraction between 0 and 1, where 1 means that the languages are a
- * perfect match, and 0 means that they are completely different.
- *
- * <p>This is mostly an implementation detail, and the precise values may change over time.
- * The implementation may use either the maximized forms or the others ones, or both.
- * The implementation may or may not rely on the forms to be consistent with each other.
- *
- * <p>Callers should construct and use a matcher rather than match pairs of locales directly.
- *
- * @param desired Desired locale.
- * @param supported 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 value between 0 and 1, inclusive.
- * @internal (has a known user)
- */
- double internalMatch(const Locale &desired, const Locale &supported, UErrorCode &errorCode) const;
-#endif // U_HIDE_INTERNAL_API
-
-private:
- LocaleMatcher(const Builder &builder, UErrorCode &errorCode);
- LocaleMatcher(const LocaleMatcher &other) = delete;
- LocaleMatcher &operator=(const LocaleMatcher &other) = delete;
-
- int32_t putIfAbsent(const LSR &lsr, int32_t i, int32_t suppLength, UErrorCode &errorCode);
-
- int32_t getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remainingIter, UErrorCode &errorCode) const;
-
- const XLikelySubtags &likelySubtags;
- const LocaleDistance &localeDistance;
- int32_t thresholdDistance;
- int32_t demotionPerDesiredLocale;
- ULocMatchFavorSubtag favorSubtag;
- ULocMatchDirection direction;
-
- // These are in input order.
- const Locale ** supportedLocales;
- LSR *lsrs;
- int32_t supportedLocalesLength;
- // These are in preference order: 1. Default locale 2. paradigm locales 3. others.
- UHashtable *supportedLsrToIndex; // Map<LSR, Integer> stores index+1 because 0 is "not found"
- // Array versions of the supportedLsrToIndex keys and values.
- // The distance lookup loops over the supportedLSRs and returns the index of the best match.
- const LSR **supportedLSRs;
- int32_t *supportedIndexes;
- int32_t supportedLSRsLength;
- Locale *ownedDefaultLocale;
- const Locale *defaultLocale;
-};
-
-U_NAMESPACE_END
-
-#endif // U_FORCE_HIDE_DRAFT_API
-#endif // U_SHOW_CPLUSPLUS_API
-#endif // __LOCALEMATCHER_H__
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// localematcher.h
+// created: 2019may08 Markus W. Scherer
+
+#ifndef __LOCALEMATCHER_H__
+#define __LOCALEMATCHER_H__
+
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
+#include "unicode/locid.h"
+#include "unicode/stringpiece.h"
+#include "unicode/uobject.h"
+
+/**
+ * \file
+ * \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
+ */
+enum ULocMatchFavorSubtag {
+ /**
+ * Language differences are most important, then script differences, then region differences.
+ * (This is the default behavior.)
+ *
+ * @draft ICU 65
+ */
+ ULOCMATCH_FAVOR_LANGUAGE,
+ /**
+ * Makes script differences matter relatively more than language differences.
+ *
+ * @draft ICU 65
+ */
+ ULOCMATCH_FAVOR_SCRIPT
+};
+#ifndef U_IN_DOXYGEN
+typedef enum ULocMatchFavorSubtag ULocMatchFavorSubtag;
+#endif
+
+/**
+ * Builder option for whether all desired locales are treated equally or
+ * earlier ones are preferred.
+ *
+ * @see Builder#setDemotionPerDesiredLocale(ULocMatchDemotion)
+ * @draft ICU 65
+ */
+enum ULocMatchDemotion {
+ /**
+ * All desired locales are treated equally.
+ *
+ * @draft ICU 65
+ */
+ ULOCMATCH_DEMOTION_NONE,
+ /**
+ * Earlier desired locales are preferred.
+ *
+ * <p>From each desired locale to the next,
+ * the distance to any supported locale is increased by an additional amount
+ * which is at least as large as most region mismatches.
+ * A later desired locale has to have a better match with some supported locale
+ * due to more than merely having the same region subtag.
+ *
+ * <p>For example: <code>Supported={en, sv} desired=[en-GB, sv]</code>
+ * yields <code>Result(en-GB, en)</code> because
+ * with the demotion of sv its perfect match is no better than
+ * the region distance between the earlier desired locale en-GB and en=en-US.
+ *
+ * <p>Notes:
+ * <ul>
+ * <li>In some cases, language and/or script differences can be as small as
+ * the typical region difference. (Example: sr-Latn vs. sr-Cyrl)
+ * <li>It is possible for certain region differences to be larger than usual,
+ * and larger than the demotion.
+ * (As of CLDR 35 there is no such case, but
+ * this is possible in future versions of the data.)
+ * </ul>
+ *
+ * @draft ICU 65
+ */
+ ULOCMATCH_DEMOTION_REGION
+};
+#ifndef U_IN_DOXYGEN
+typedef enum ULocMatchDemotion ULocMatchDemotion;
+#endif
+
+/**
+ * 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.
+ * Sometimes it is desirable to ignore those.
+ *
+ * <p>For example, consider a web application with the UI in a given language,
+ * with a link to another, related web app.
+ * The link should include the UI language, and the target server may also use
+ * the client’s Accept-Language header data.
+ * The target server has its own list of supported languages.
+ * One may want to favor UI language consistency, that is,
+ * 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)
+ * @draft ICU 67
+ */
+enum ULocMatchDirection {
+ /**
+ * Locale matching includes one-way matches such as Breton→French. (default)
+ *
+ * @draft ICU 67
+ */
+ ULOCMATCH_DIRECTION_WITH_ONE_WAY,
+ /**
+ * Locale matching limited to two-way matches including e.g. Danish↔Norwegian
+ * but ignoring one-way matches.
+ *
+ * @draft ICU 67
+ */
+ ULOCMATCH_DIRECTION_ONLY_TWO_WAY
+};
+#ifndef U_IN_DOXYGEN
+typedef enum ULocMatchDirection ULocMatchDirection;
+#endif
+
+struct UHashtable;
+
+U_NAMESPACE_BEGIN
+
+struct LSR;
+
+class LocaleDistance;
+class LocaleLsrIterator;
+class UVector;
+class XLikelySubtags;
+
+/**
+ * Immutable class that picks the best match between a user's desired locales and
+ * an application's supported locales.
+ * Movable but not copyable.
+ *
+ * <p>Example:
+ * <pre>
+ * UErrorCode errorCode = U_ZERO_ERROR;
+ * LocaleMatcher matcher = LocaleMatcher::Builder().setSupportedLocales("fr, en-GB, en").build(errorCode);
+ * Locale *bestSupported = matcher.getBestLocale(Locale.US, errorCode); // "en"
+ * </pre>
+ *
+ * <p>A matcher takes into account when languages are close to one another,
+ * such as Danish and Norwegian,
+ * and when regional variants are close, like en-GB and en-AU as opposed to en-US.
+ *
+ * <p>If there are multiple supported locales with the same (language, script, region)
+ * likely subtags, then the current implementation returns the first of those locales.
+ * It ignores variant subtags (except for pseudolocale variants) and extensions.
+ * This may change in future versions.
+ *
+ * <p>For example, the current implementation does not distinguish between
+ * de, de-DE, de-Latn, de-1901, de-u-co-phonebk.
+ *
+ * <p>If you prefer one equivalent locale over another, then provide only the preferred one,
+ * or place it earlier in the list of supported locales.
+ *
+ * <p>Otherwise, the order of supported locales may have no effect on the best-match results.
+ * The current implementation compares each desired locale with supported locales
+ * in the following order:
+ * 1. Default locale, if supported;
+ * 2. CLDR "paradigm locales" like en-GB and es-419;
+ * 3. other supported locales.
+ * This may change in future versions.
+ *
+ * <p>Often a product will just need one matcher instance, built with the languages
+ * that it supports. However, it may want multiple instances with different
+ * default languages based on additional information, such as the domain.
+ *
+ * <p>This class is not intended for public subclassing.
+ *
+ * @draft ICU 65
+ */
+class U_COMMON_API LocaleMatcher : public UMemory {
+public:
+ /**
+ * Data for the best-matching pair of a desired and a supported locale.
+ * Movable but not copyable.
+ *
+ * @draft ICU 65
+ */
+ class U_COMMON_API Result : public UMemory {
+ public:
+ /**
+ * Move constructor; might modify the source.
+ * This object will have the same contents that the source object had.
+ *
+ * @param src Result to move contents from.
+ * @draft ICU 65
+ */
+ Result(Result &&src) U_NOEXCEPT;
+
+ /**
+ * Destructor.
+ *
+ * @draft ICU 65
+ */
+ ~Result();
+
+ /**
+ * Move assignment; might modify the source.
+ * This object will have the same contents that the source object had.
+ *
+ * @param src Result to move contents from.
+ * @draft 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
+ */
+ 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.
+ *
+ * @return the best-matching supported locale, or nullptr.
+ * @draft ICU 65
+ */
+ inline const Locale *getSupportedLocale() const { return supportedLocale; }
+
+ /**
+ * Returns the index of the best-matching desired locale in the input Iterable order.
+ * -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
+ */
+ inline int32_t getDesiredIndex() const { return desiredIndex; }
+
+ /**
+ * Returns the index of the best-matching supported locale in the
+ * constructor’s or builder’s input order (“set” Collection plus “added” locales).
+ * If the matcher was built from a locale list string, then the iteration order is that
+ * of a LocalePriorityList built from the same string.
+ * -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
+ */
+ inline int32_t getSupportedIndex() const { return supportedIndex; }
+
+ /**
+ * Takes the best-matching supported locale and adds relevant fields of the
+ * best-matching desired locale, such as the -t- and -u- extensions.
+ * May replace some fields of the supported locale.
+ * The result is the locale that should be used for date and number formatting, collation, etc.
+ * Returns the root locale if getSupportedLocale() returns nullptr.
+ *
+ * <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
+ */
+ Locale makeResolvedLocale(UErrorCode &errorCode) const;
+#endif // U_HIDE_DRAFT_API
+
+ private:
+ Result(const Locale *desired, const Locale *supported,
+ int32_t desIndex, int32_t suppIndex, UBool owned) :
+ desiredLocale(desired), supportedLocale(supported),
+ desiredIndex(desIndex), supportedIndex(suppIndex),
+ desiredIsOwned(owned) {}
+
+ Result(const Result &other) = delete;
+ Result &operator=(const Result &other) = delete;
+
+ const Locale *desiredLocale;
+ const Locale *supportedLocale;
+ int32_t desiredIndex;
+ int32_t supportedIndex;
+ UBool desiredIsOwned;
+
+ friend class LocaleMatcher;
+ };
+
+ /**
+ * LocaleMatcher builder.
+ * Movable but not copyable.
+ *
+ * @see LocaleMatcher#builder()
+ * @draft ICU 65
+ */
+ class U_COMMON_API Builder : public UMemory {
+ public:
+ /**
+ * Constructs a builder used in chaining parameters for building a LocaleMatcher.
+ *
+ * @return a new Builder object
+ * @draft ICU 65
+ */
+ Builder() {}
+
+ /**
+ * Move constructor; might modify the source.
+ * This builder will have the same contents that the source builder had.
+ *
+ * @param src Builder to move contents from.
+ * @draft ICU 65
+ */
+ Builder(Builder &&src) U_NOEXCEPT;
+
+ /**
+ * Destructor.
+ *
+ * @draft ICU 65
+ */
+ ~Builder();
+
+ /**
+ * Move assignment; might modify the source.
+ * This builder will have the same contents that the source builder had.
+ *
+ * @param src Builder to move contents from.
+ * @draft 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>),
+ * such as "af, en, fr;q=0.9", and sets the supported locales accordingly.
+ * Allows whitespace in more places but does not allow "*".
+ * Clears any previously set/added supported locales first.
+ *
+ * @param locales the Accept-Language string of locales to set
+ * @return this Builder object
+ * @draft ICU 65
+ */
+ Builder &setSupportedLocalesFromListString(StringPiece locales);
+
+ /**
+ * Copies the supported locales, preserving iteration order.
+ * Clears any previously set/added supported locales first.
+ * Duplicates are allowed, and are not removed.
+ *
+ * @param locales the list of locale
+ * @return this Builder object
+ * @draft ICU 65
+ */
+ Builder &setSupportedLocales(Locale::Iterator &locales);
+
+ /**
+ * Copies the supported locales from the begin/end range, preserving iteration order.
+ * Clears any previously set/added supported locales first.
+ * Duplicates are allowed, and are not removed.
+ *
+ * Each of the iterator parameter values must be an
+ * input iterator whose value is convertible to const Locale &.
+ *
+ * @param begin Start of range.
+ * @param end Exclusive end of range.
+ * @return this Builder object
+ * @draft ICU 65
+ */
+ template<typename Iter>
+ Builder &setSupportedLocales(Iter begin, Iter end) {
+ if (U_FAILURE(errorCode_)) { return *this; }
+ clearSupportedLocales();
+ while (begin != end) {
+ addSupportedLocale(*begin++);
+ }
+ return *this;
+ }
+
+ /**
+ * Copies the supported locales from the begin/end range, preserving iteration order.
+ * Calls the converter to convert each *begin to a Locale or const Locale &.
+ * Clears any previously set/added supported locales first.
+ * Duplicates are allowed, and are not removed.
+ *
+ * Each of the iterator parameter values must be an
+ * input iterator whose value is convertible to const Locale &.
+ *
+ * @param begin Start of range.
+ * @param end Exclusive end of range.
+ * @param converter Converter from *begin to const Locale & or compatible.
+ * @return this Builder object
+ * @draft ICU 65
+ */
+ template<typename Iter, typename Conv>
+ Builder &setSupportedLocalesViaConverter(Iter begin, Iter end, Conv converter) {
+ if (U_FAILURE(errorCode_)) { return *this; }
+ clearSupportedLocales();
+ while (begin != end) {
+ addSupportedLocale(converter(*begin++));
+ }
+ return *this;
+ }
+
+ /**
+ * Adds another supported locale.
+ * Duplicates are allowed, and are not removed.
+ *
+ * @param locale another locale
+ * @return this Builder object
+ * @draft ICU 65
+ */
+ Builder &addSupportedLocale(const Locale &locale);
+
+ /**
+ * Sets the default locale; if nullptr, or if it is not set explicitly,
+ * then the first supported locale is used as the default locale.
+ *
+ * @param defaultLocale the default locale (will be copied)
+ * @return this Builder object
+ * @draft ICU 65
+ */
+ Builder &setDefaultLocale(const Locale *defaultLocale);
+
+ /**
+ * If ULOCMATCH_FAVOR_SCRIPT, then the language differences are smaller than script
+ * differences.
+ * This is used in situations (such as maps) where
+ * it is better to fall back to the same script than a similar language.
+ *
+ * @param subtag the subtag to favor
+ * @return this Builder object
+ * @draft ICU 65
+ */
+ Builder &setFavorSubtag(ULocMatchFavorSubtag subtag);
+
+ /**
+ * Option for whether all desired locales are treated equally or
+ * earlier ones are preferred (this is the default).
+ *
+ * @param demotion the demotion per desired locale to set.
+ * @return this Builder object
+ * @draft ICU 65
+ */
+ Builder &setDemotionPerDesiredLocale(ULocMatchDemotion demotion);
+
+ /**
+ * Option for whether to include or ignore one-way (fallback) match data.
+ * By default, they are included.
+ *
+ * @param direction the match direction to set.
+ * @return this Builder object
+ * @draft ICU 67
+ */
+ Builder &setDirection(ULocMatchDirection direction) {
+ if (U_SUCCESS(errorCode_)) {
+ direction_ = direction;
+ }
+ return *this;
+ }
+
+ /**
+ * Sets the UErrorCode if an error occurred while setting parameters.
+ * Preserves older error codes in the outErrorCode.
+ *
+ * @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
+ */
+ UBool copyErrorTo(UErrorCode &outErrorCode) const;
+
+ /**
+ * Builds and returns a new locale matcher.
+ * This builder can continue to be used.
+ *
+ * @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
+ */
+ LocaleMatcher build(UErrorCode &errorCode) const;
+#endif // U_HIDE_DRAFT_API
+
+ private:
+ friend class LocaleMatcher;
+
+ Builder(const Builder &other) = delete;
+ Builder &operator=(const Builder &other) = delete;
+
+ void clearSupportedLocales();
+ bool ensureSupportedLocaleVector();
+
+ UErrorCode errorCode_ = U_ZERO_ERROR;
+ UVector *supportedLocales_ = nullptr;
+ int32_t thresholdDistance_ = -1;
+ ULocMatchDemotion demotion_ = ULOCMATCH_DEMOTION_REGION;
+ Locale *defaultLocale_ = nullptr;
+ ULocMatchFavorSubtag favor_ = ULOCMATCH_FAVOR_LANGUAGE;
+ ULocMatchDirection direction_ = ULOCMATCH_DIRECTION_WITH_ONE_WAY;
+ };
+
+ // FYI No public LocaleMatcher constructors in C++; use the Builder.
+
+ /**
+ * 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
+ */
+ LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT;
+
+ /**
+ * Destructor.
+ * @draft ICU 65
+ */
+ ~LocaleMatcher();
+
+ /**
+ * Move assignment operator; might modify the source.
+ * This matcher will have the same settings that the source matcher had.
+ * The behavior is undefined if *this and src are the same object.
+ * @param src source matcher
+ * @return *this
+ * @draft ICU 65
+ */
+ LocaleMatcher &operator=(LocaleMatcher &&src) U_NOEXCEPT;
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns the supported locale which best matches the desired locale.
+ *
+ * @param desiredLocale Typically a user's language.
+ * @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 the best-matching supported locale.
+ * @draft ICU 65
+ */
+ const Locale *getBestMatch(const Locale &desiredLocale, UErrorCode &errorCode) const;
+
+ /**
+ * Returns the supported locale which best matches one of the desired locales.
+ *
+ * @param desiredLocales Typically a user's languages, in order of preference (descending).
+ * @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 the best-matching supported locale.
+ * @draft ICU 65
+ */
+ const Locale *getBestMatch(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const;
+
+ /**
+ * Parses an Accept-Language string
+ * (<a href="https://tools.ietf.org/html/rfc2616#section-14.4">RFC 2616 Section 14.4</a>),
+ * such as "af, en, fr;q=0.9",
+ * and returns the supported locale which best matches one of the desired locales.
+ * Allows whitespace in more places but does not allow "*".
+ *
+ * @param desiredLocaleList Typically a user's languages, as an Accept-Language string.
+ * @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 the best-matching supported locale.
+ * @draft ICU 65
+ */
+ const Locale *getBestMatchForListString(StringPiece desiredLocaleList, UErrorCode &errorCode) const;
+
+ /**
+ * Returns the best match between the desired locale and the supported locales.
+ * If the result's desired locale is not nullptr, then it is the address of the input locale.
+ * It has not been cloned.
+ *
+ * @param desiredLocale Typically a user's language.
+ * @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 the best-matching pair of the desired and a supported locale.
+ * @draft ICU 65
+ */
+ Result getBestMatchResult(const Locale &desiredLocale, UErrorCode &errorCode) const;
+
+ /**
+ * Returns the best match between the desired and supported locales.
+ * If the result's desired locale is not nullptr, then it is a clone of
+ * the best-matching desired locale. The Result object owns the clone.
+ *
+ * @param desiredLocales Typically a user's languages, in order of preference (descending).
+ * @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 the best-matching pair of a desired and a supported locale.
+ * @draft ICU 65
+ */
+ Result getBestMatchResult(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const;
+#endif // U_HIDE_DRAFT_API
+
+#ifndef U_HIDE_INTERNAL_API
+ /**
+ * Returns a fraction between 0 and 1, where 1 means that the languages are a
+ * perfect match, and 0 means that they are completely different.
+ *
+ * <p>This is mostly an implementation detail, and the precise values may change over time.
+ * The implementation may use either the maximized forms or the others ones, or both.
+ * The implementation may or may not rely on the forms to be consistent with each other.
+ *
+ * <p>Callers should construct and use a matcher rather than match pairs of locales directly.
+ *
+ * @param desired Desired locale.
+ * @param supported 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 value between 0 and 1, inclusive.
+ * @internal (has a known user)
+ */
+ double internalMatch(const Locale &desired, const Locale &supported, UErrorCode &errorCode) const;
+#endif // U_HIDE_INTERNAL_API
+
+private:
+ LocaleMatcher(const Builder &builder, UErrorCode &errorCode);
+ LocaleMatcher(const LocaleMatcher &other) = delete;
+ LocaleMatcher &operator=(const LocaleMatcher &other) = delete;
+
+ int32_t putIfAbsent(const LSR &lsr, int32_t i, int32_t suppLength, UErrorCode &errorCode);
+
+ int32_t getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remainingIter, UErrorCode &errorCode) const;
+
+ const XLikelySubtags &likelySubtags;
+ const LocaleDistance &localeDistance;
+ int32_t thresholdDistance;
+ int32_t demotionPerDesiredLocale;
+ ULocMatchFavorSubtag favorSubtag;
+ ULocMatchDirection direction;
+
+ // These are in input order.
+ const Locale ** supportedLocales;
+ LSR *lsrs;
+ int32_t supportedLocalesLength;
+ // These are in preference order: 1. Default locale 2. paradigm locales 3. others.
+ UHashtable *supportedLsrToIndex; // Map<LSR, Integer> stores index+1 because 0 is "not found"
+ // Array versions of the supportedLsrToIndex keys and values.
+ // The distance lookup loops over the supportedLSRs and returns the index of the best match.
+ const LSR **supportedLSRs;
+ int32_t *supportedIndexes;
+ int32_t supportedLSRsLength;
+ Locale *ownedDefaultLocale;
+ const Locale *defaultLocale;
+};
+
+U_NAMESPACE_END
+
+#endif // U_FORCE_HIDE_DRAFT_API
+#endif // U_SHOW_CPLUSPLUS_API
+#endif // __LOCALEMATCHER_H__
diff --git a/contrib/libs/icu/include/unicode/localpointer.h b/contrib/libs/icu/include/unicode/localpointer.h
index 7985a56ba2..61c3020918 100644
--- a/contrib/libs/icu/include/unicode/localpointer.h
+++ b/contrib/libs/icu/include/unicode/localpointer.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: localpointer.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -42,8 +42,8 @@
#if U_SHOW_CPLUSPLUS_API
-#include <memory>
-
+#include <memory>
+
U_NAMESPACE_BEGIN
/**
@@ -67,13 +67,13 @@ U_NAMESPACE_BEGIN
template<typename T>
class LocalPointerBase {
public:
- // No heap allocation. Use only on the stack.
- static void* U_EXPORT2 operator new(size_t) = delete;
- static void* U_EXPORT2 operator new[](size_t) = delete;
-#if U_HAVE_PLACEMENT_NEW
- static void* U_EXPORT2 operator new(size_t, void*) = delete;
-#endif
-
+ // No heap allocation. Use only on the stack.
+ static void* U_EXPORT2 operator new(size_t) = delete;
+ static void* U_EXPORT2 operator new[](size_t) = delete;
+#if U_HAVE_PLACEMENT_NEW
+ static void* U_EXPORT2 operator new(size_t, void*) = delete;
+#endif
+
/**
* Constructor takes ownership.
* @param p simple pointer to an object that is adopted
@@ -177,9 +177,9 @@ private:
* \code
* LocalPointer<UnicodeString> s(new UnicodeString((UChar32)0x50005));
* int32_t length=s->length(); // 2
- * char16_t lead=s->charAt(0); // 0xd900
+ * char16_t lead=s->charAt(0); // 0xd900
* if(some condition) { return; } // no need to explicitly delete the pointer
- * s.adoptInstead(new UnicodeString((char16_t)0xfffc));
+ * s.adoptInstead(new UnicodeString((char16_t)0xfffc));
* length=s->length(); // 1
* // no need to explicitly delete the pointer
* \endcode
@@ -224,21 +224,21 @@ public:
LocalPointer(LocalPointer<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
src.ptr=NULL;
}
-
- /**
- * Constructs a LocalPointer from a C++11 std::unique_ptr.
- * The LocalPointer steals the object owned by the std::unique_ptr.
- *
- * This constructor works via move semantics. If your std::unique_ptr is
- * in a local variable, you must use std::move.
- *
- * @param p The std::unique_ptr from which the pointer will be stolen.
- * @stable ICU 64
- */
- explicit LocalPointer(std::unique_ptr<T> &&p)
- : LocalPointerBase<T>(p.release()) {}
-
- /**
+
+ /**
+ * Constructs a LocalPointer from a C++11 std::unique_ptr.
+ * The LocalPointer steals the object owned by the std::unique_ptr.
+ *
+ * This constructor works via move semantics. If your std::unique_ptr is
+ * in a local variable, you must use std::move.
+ *
+ * @param p The std::unique_ptr from which the pointer will be stolen.
+ * @stable ICU 64
+ */
+ explicit LocalPointer(std::unique_ptr<T> &&p)
+ : LocalPointerBase<T>(p.release()) {}
+
+ /**
* Destructor deletes the object it owns.
* @stable ICU 4.4
*/
@@ -253,25 +253,25 @@ public:
* @stable ICU 56
*/
LocalPointer<T> &operator=(LocalPointer<T> &&src) U_NOEXCEPT {
- delete LocalPointerBase<T>::ptr;
- LocalPointerBase<T>::ptr=src.ptr;
- src.ptr=NULL;
- return *this;
+ delete LocalPointerBase<T>::ptr;
+ LocalPointerBase<T>::ptr=src.ptr;
+ src.ptr=NULL;
+ return *this;
}
-
+
/**
- * Move-assign from an std::unique_ptr to this LocalPointer.
- * Steals the pointer from the std::unique_ptr.
+ * Move-assign from an std::unique_ptr to this LocalPointer.
+ * Steals the pointer from the std::unique_ptr.
*
- * @param p The std::unique_ptr from which the pointer will be stolen.
+ * @param p The std::unique_ptr from which the pointer will be stolen.
* @return *this
- * @stable ICU 64
+ * @stable ICU 64
*/
- LocalPointer<T> &operator=(std::unique_ptr<T> &&p) U_NOEXCEPT {
- adoptInstead(p.release());
+ LocalPointer<T> &operator=(std::unique_ptr<T> &&p) U_NOEXCEPT {
+ adoptInstead(p.release());
return *this;
}
-
+
/**
* Swap pointers.
* @param other other smart pointer
@@ -327,21 +327,21 @@ public:
delete p;
}
}
-
- /**
- * Conversion operator to a C++11 std::unique_ptr.
- * Disowns the object and gives it to the returned std::unique_ptr.
- *
- * This operator works via move semantics. If your LocalPointer is
- * in a local variable, you must use std::move.
- *
- * @return An std::unique_ptr owning the pointer previously owned by this
- * icu::LocalPointer.
- * @stable ICU 64
- */
- operator std::unique_ptr<T> () && {
- return std::unique_ptr<T>(LocalPointerBase<T>::orphan());
- }
+
+ /**
+ * Conversion operator to a C++11 std::unique_ptr.
+ * Disowns the object and gives it to the returned std::unique_ptr.
+ *
+ * This operator works via move semantics. If your LocalPointer is
+ * in a local variable, you must use std::move.
+ *
+ * @return An std::unique_ptr owning the pointer previously owned by this
+ * icu::LocalPointer.
+ * @stable ICU 64
+ */
+ operator std::unique_ptr<T> () && {
+ return std::unique_ptr<T>(LocalPointerBase<T>::orphan());
+ }
};
/**
@@ -352,10 +352,10 @@ public:
* Usage example:
* \code
* LocalArray<UnicodeString> a(new UnicodeString[2]);
- * a[0].append((char16_t)0x61);
+ * a[0].append((char16_t)0x61);
* if(some condition) { return; } // no need to explicitly delete the array
* a.adoptInstead(new UnicodeString[4]);
- * a[3].append((char16_t)0x62).append((char16_t)0x63).reverse();
+ * a[3].append((char16_t)0x62).append((char16_t)0x63).reverse();
* // no need to explicitly delete the array
* \endcode
*
@@ -399,21 +399,21 @@ public:
LocalArray(LocalArray<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
src.ptr=NULL;
}
-
- /**
- * Constructs a LocalArray from a C++11 std::unique_ptr of an array type.
- * The LocalPointer steals the array owned by the std::unique_ptr.
- *
- * This constructor works via move semantics. If your std::unique_ptr is
- * in a local variable, you must use std::move.
- *
- * @param p The std::unique_ptr from which the array will be stolen.
- * @stable ICU 64
- */
- explicit LocalArray(std::unique_ptr<T[]> &&p)
- : LocalPointerBase<T>(p.release()) {}
-
- /**
+
+ /**
+ * Constructs a LocalArray from a C++11 std::unique_ptr of an array type.
+ * The LocalPointer steals the array owned by the std::unique_ptr.
+ *
+ * This constructor works via move semantics. If your std::unique_ptr is
+ * in a local variable, you must use std::move.
+ *
+ * @param p The std::unique_ptr from which the array will be stolen.
+ * @stable ICU 64
+ */
+ explicit LocalArray(std::unique_ptr<T[]> &&p)
+ : LocalPointerBase<T>(p.release()) {}
+
+ /**
* Destructor deletes the array it owns.
* @stable ICU 4.4
*/
@@ -428,25 +428,25 @@ public:
* @stable ICU 56
*/
LocalArray<T> &operator=(LocalArray<T> &&src) U_NOEXCEPT {
- delete[] LocalPointerBase<T>::ptr;
- LocalPointerBase<T>::ptr=src.ptr;
- src.ptr=NULL;
- return *this;
+ delete[] LocalPointerBase<T>::ptr;
+ LocalPointerBase<T>::ptr=src.ptr;
+ src.ptr=NULL;
+ return *this;
}
-
+
/**
- * Move-assign from an std::unique_ptr to this LocalPointer.
- * Steals the array from the std::unique_ptr.
+ * Move-assign from an std::unique_ptr to this LocalPointer.
+ * Steals the array from the std::unique_ptr.
*
- * @param p The std::unique_ptr from which the array will be stolen.
+ * @param p The std::unique_ptr from which the array will be stolen.
* @return *this
- * @stable ICU 64
+ * @stable ICU 64
*/
- LocalArray<T> &operator=(std::unique_ptr<T[]> &&p) U_NOEXCEPT {
- adoptInstead(p.release());
+ LocalArray<T> &operator=(std::unique_ptr<T[]> &&p) U_NOEXCEPT {
+ adoptInstead(p.release());
return *this;
}
-
+
/**
* Swap pointers.
* @param other other smart pointer
@@ -510,21 +510,21 @@ public:
* @stable ICU 4.4
*/
T &operator[](ptrdiff_t i) const { return LocalPointerBase<T>::ptr[i]; }
-
- /**
- * Conversion operator to a C++11 std::unique_ptr.
- * Disowns the object and gives it to the returned std::unique_ptr.
- *
- * This operator works via move semantics. If your LocalPointer is
- * in a local variable, you must use std::move.
- *
- * @return An std::unique_ptr owning the pointer previously owned by this
- * icu::LocalPointer.
- * @stable ICU 64
- */
- operator std::unique_ptr<T[]> () && {
- return std::unique_ptr<T[]>(LocalPointerBase<T>::orphan());
- }
+
+ /**
+ * Conversion operator to a C++11 std::unique_ptr.
+ * Disowns the object and gives it to the returned std::unique_ptr.
+ *
+ * This operator works via move semantics. If your LocalPointer is
+ * in a local variable, you must use std::move.
+ *
+ * @return An std::unique_ptr owning the pointer previously owned by this
+ * icu::LocalPointer.
+ * @stable ICU 64
+ */
+ operator std::unique_ptr<T[]> () && {
+ return std::unique_ptr<T[]>(LocalPointerBase<T>::orphan());
+ }
};
/**
@@ -557,9 +557,9 @@ public:
: LocalPointerBase<Type>(src.ptr) { \
src.ptr=NULL; \
} \
- /* TODO: Be agnostic of the deleter function signature from the user-provided std::unique_ptr? */ \
- explicit LocalPointerClassName(std::unique_ptr<Type, decltype(&closeFunction)> &&p) \
- : LocalPointerBase<Type>(p.release()) {} \
+ /* TODO: Be agnostic of the deleter function signature from the user-provided std::unique_ptr? */ \
+ explicit LocalPointerClassName(std::unique_ptr<Type, decltype(&closeFunction)> &&p) \
+ : LocalPointerBase<Type>(p.release()) {} \
~LocalPointerClassName() { if (ptr != NULL) { closeFunction(ptr); } } \
LocalPointerClassName &operator=(LocalPointerClassName &&src) U_NOEXCEPT { \
if (ptr != NULL) { closeFunction(ptr); } \
@@ -567,9 +567,9 @@ public:
src.ptr=NULL; \
return *this; \
} \
- /* TODO: Be agnostic of the deleter function signature from the user-provided std::unique_ptr? */ \
- LocalPointerClassName &operator=(std::unique_ptr<Type, decltype(&closeFunction)> &&p) { \
- adoptInstead(p.release()); \
+ /* TODO: Be agnostic of the deleter function signature from the user-provided std::unique_ptr? */ \
+ LocalPointerClassName &operator=(std::unique_ptr<Type, decltype(&closeFunction)> &&p) { \
+ adoptInstead(p.release()); \
return *this; \
} \
void swap(LocalPointerClassName &other) U_NOEXCEPT { \
@@ -584,9 +584,9 @@ public:
if (ptr != NULL) { closeFunction(ptr); } \
ptr=p; \
} \
- operator std::unique_ptr<Type, decltype(&closeFunction)> () && { \
- return std::unique_ptr<Type, decltype(&closeFunction)>(LocalPointerBase<Type>::orphan(), closeFunction); \
- } \
+ operator std::unique_ptr<Type, decltype(&closeFunction)> () && { \
+ return std::unique_ptr<Type, decltype(&closeFunction)>(LocalPointerBase<Type>::orphan(), closeFunction); \
+ } \
}
U_NAMESPACE_END
diff --git a/contrib/libs/icu/include/unicode/locdspnm.h b/contrib/libs/icu/include/unicode/locdspnm.h
index f3e1143d5c..4f06f85704 100644
--- a/contrib/libs/icu/include/unicode/locdspnm.h
+++ b/contrib/libs/icu/include/unicode/locdspnm.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -12,8 +12,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: Provides display names of Locale and its components.
@@ -22,7 +22,7 @@
#if !UCONFIG_NO_FORMATTING
#include "unicode/locid.h"
-#include "unicode/strenum.h"
+#include "unicode/strenum.h"
#include "unicode/uscript.h"
#include "unicode/uldnames.h"
#include "unicode/udisplaycontext.h"
@@ -51,7 +51,7 @@ public:
* @return a LocaleDisplayNames instance
* @stable ICU 4.4
*/
- inline static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale);
+ inline static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale);
/**
* Returns an instance of LocaleDisplayNames that returns names
@@ -206,6 +206,6 @@ U_NAMESPACE_END
#endif
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/locid.h b/contrib/libs/icu/include/unicode/locid.h
index 82e3342e80..1d031daabc 100644
--- a/contrib/libs/icu/include/unicode/locid.h
+++ b/contrib/libs/icu/include/unicode/locid.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -32,13 +32,13 @@
#define LOCID_H
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
-#include "unicode/bytestream.h"
-#include "unicode/localpointer.h"
-#include "unicode/strenum.h"
-#include "unicode/stringpiece.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
+#include "unicode/bytestream.h"
+#include "unicode/localpointer.h"
+#include "unicode/strenum.h"
+#include "unicode/stringpiece.h"
#include "unicode/uobject.h"
#include "unicode/putil.h"
#include "unicode/uloc.h"
@@ -53,9 +53,9 @@ U_NAMESPACE_BEGIN
// Forward Declarations
void U_CALLCONV locale_available_init(); /**< @internal */
-class StringEnumeration;
-class UnicodeString;
-
+class StringEnumeration;
+class UnicodeString;
+
/**
* A <code>Locale</code> object represents a specific geographical, political,
* or cultural region. An operation that requires a <code>Locale</code> to perform
@@ -95,7 +95,7 @@ class UnicodeString;
* <P>
* The third constructor requires a third argument--the <STRONG>Variant.</STRONG>
* The Variant codes are vendor and browser-specific.
- * For example, use REVISED for a language's revised script orthography, and POSIX for POSIX.
+ * For example, use REVISED for a language's revised script orthography, and POSIX for POSIX.
* Where there are two variants, separate them with an underscore, and
* put the most important one first. For
* example, a Traditional Spanish collation might be referenced, with
@@ -287,14 +287,14 @@ public:
*/
Locale(const Locale& other);
- /**
- * Move constructor; might leave source in bogus state.
- * This locale will have the same contents that the source locale had.
- *
- * @param other The Locale object being moved in.
- * @stable ICU 63
- */
- Locale(Locale&& other) U_NOEXCEPT;
+ /**
+ * Move constructor; might leave source in bogus state.
+ * This locale will have the same contents that the source locale had.
+ *
+ * @param other The Locale object being moved in.
+ * @stable ICU 63
+ */
+ Locale(Locale&& other) U_NOEXCEPT;
/**
* Destructor
@@ -312,17 +312,17 @@ public:
Locale& operator=(const Locale& other);
/**
- * Move assignment operator; might leave source in bogus state.
- * This locale will have the same contents that the source locale had.
- * The behavior is undefined if *this and the source are the same object.
- *
- * @param other The Locale object being moved in.
- * @return *this
- * @stable ICU 63
- */
- Locale& operator=(Locale&& other) U_NOEXCEPT;
-
- /**
+ * Move assignment operator; might leave source in bogus state.
+ * This locale will have the same contents that the source locale had.
+ * The behavior is undefined if *this and the source are the same object.
+ *
+ * @param other The Locale object being moved in.
+ * @return *this
+ * @stable ICU 63
+ */
+ Locale& operator=(Locale&& other) U_NOEXCEPT;
+
+ /**
* Checks if two locale keys are the same.
*
* @param other The locale key object to be compared with this.
@@ -339,7 +339,7 @@ public:
* otherwise.
* @stable ICU 2.0
*/
- inline UBool operator!=(const Locale& other) const;
+ inline UBool operator!=(const Locale& other) const;
/**
* Clone this object.
@@ -379,7 +379,7 @@ public:
* the default locale ID of the runtime environment.
*
* @param newLocale Locale to set to. If NULL, set to the value obtained
- * from the runtime environment.
+ * from the runtime environment.
* @param success The error code.
* @system
* @stable ICU 2.0
@@ -389,53 +389,53 @@ public:
#endif /* U_HIDE_SYSTEM_API */
/**
- * Returns a Locale for the specified BCP47 language tag string.
- * 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
- * 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.
- * @stable ICU 63
- */
- static Locale U_EXPORT2 forLanguageTag(StringPiece tag, UErrorCode& status);
-
- /**
- * Returns a well-formed language tag for this Locale.
- * <p>
- * <b>Note</b>: Any locale fields which do not satisfy the BCP47 syntax
- * requirement will be silently omitted from the result.
- *
- * If this function fails, partial output may have been written to the sink.
- *
- * @param sink the output sink receiving the BCP47 language
- * tag for this Locale.
- * @param status error information if creating the language tag failed.
- * @stable ICU 63
- */
- void toLanguageTag(ByteSink& sink, UErrorCode& status) const;
-
- /**
- * Returns a well-formed language tag for this Locale.
- * <p>
- * <b>Note</b>: Any locale fields which do not satisfy the BCP47 syntax
- * requirement will be silently omitted from the result.
- *
- * @param status error information if creating the language tag failed.
- * @return the BCP47 language tag for this Locale.
- * @stable ICU 63
- */
- template<typename StringClass>
- inline StringClass toLanguageTag(UErrorCode& status) const;
-
- /**
+ * Returns a Locale for the specified BCP47 language tag string.
+ * 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
+ * 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.
+ * @stable ICU 63
+ */
+ static Locale U_EXPORT2 forLanguageTag(StringPiece tag, UErrorCode& status);
+
+ /**
+ * Returns a well-formed language tag for this Locale.
+ * <p>
+ * <b>Note</b>: Any locale fields which do not satisfy the BCP47 syntax
+ * requirement will be silently omitted from the result.
+ *
+ * If this function fails, partial output may have been written to the sink.
+ *
+ * @param sink the output sink receiving the BCP47 language
+ * tag for this Locale.
+ * @param status error information if creating the language tag failed.
+ * @stable ICU 63
+ */
+ void toLanguageTag(ByteSink& sink, UErrorCode& status) const;
+
+ /**
+ * Returns a well-formed language tag for this Locale.
+ * <p>
+ * <b>Note</b>: Any locale fields which do not satisfy the BCP47 syntax
+ * requirement will be silently omitted from the result.
+ *
+ * @param status error information if creating the language tag failed.
+ * @return the BCP47 language tag for this Locale.
+ * @stable ICU 63
+ */
+ template<typename StringClass>
+ inline StringClass toLanguageTag(UErrorCode& status) const;
+
+ /**
* Creates a locale which has had minimal canonicalization
* as per uloc_getName().
* @param name The name to create from. If name is null,
@@ -448,7 +448,7 @@ public:
/**
* Creates a locale from the given string after canonicalizing
- * the string according to CLDR by calling uloc_canonicalize().
+ * the string according to CLDR by calling uloc_canonicalize().
* @param name the locale ID to create from. Must not be NULL.
* @return a new locale object corresponding to the given name
* @stable ICU 3.0
@@ -505,136 +505,136 @@ public:
*/
const char * getBaseName() const;
- /**
- * Add the likely subtags for this Locale, per the algorithm described
- * in the following CLDR technical report:
- *
- * http://www.unicode.org/reports/tr35/#Likely_Subtags
- *
- * If this Locale is already in the maximal form, or not valid, or there is
- * no data available for maximization, the Locale will be unchanged.
- *
- * For example, "und-Zzzz" cannot be maximized, since there is no
- * reasonable maximization.
- *
- * Examples:
- *
- * "en" maximizes to "en_Latn_US"
- *
- * "de" maximizes to "de_Latn_US"
- *
- * "sr" maximizes to "sr_Cyrl_RS"
- *
- * "sh" maximizes to "sr_Latn_RS" (Note this will not reverse.)
- *
- * "zh_Hani" maximizes to "zh_Hans_CN" (Note this will not reverse.)
- *
- * @param status error information if maximizing this Locale failed.
- * If this Locale is not well-formed, the error code is
- * U_ILLEGAL_ARGUMENT_ERROR.
- * @stable ICU 63
- */
- void addLikelySubtags(UErrorCode& status);
-
- /**
- * Minimize the subtags for this Locale, per the algorithm described
- * in the following CLDR technical report:
- *
- * http://www.unicode.org/reports/tr35/#Likely_Subtags
- *
- * If this Locale is already in the minimal form, or not valid, or there is
- * no data available for minimization, the Locale will be unchanged.
- *
- * Since the minimization algorithm relies on proper maximization, see the
- * comments for addLikelySubtags for reasons why there might not be any
- * data.
- *
- * Examples:
- *
- * "en_Latn_US" minimizes to "en"
- *
- * "de_Latn_US" minimizes to "de"
- *
- * "sr_Cyrl_RS" minimizes to "sr"
- *
- * "zh_Hant_TW" minimizes to "zh_TW" (The region is preferred to the
- * script, and minimizing to "zh" would imply "zh_Hans_CN".)
- *
- * @param status error information if maximizing this Locale failed.
- * If this Locale is not well-formed, the error code is
- * U_ILLEGAL_ARGUMENT_ERROR.
- * @stable ICU 63
- */
- void minimizeSubtags(UErrorCode& status);
-
-#ifndef U_HIDE_DRAFT_API
- /**
- * Canonicalize the locale ID of this object according to CLDR.
- * @param status the status code
- * @draft ICU 67
- * @see createCanonical
- */
- void canonicalize(UErrorCode& status);
-#endif // U_HIDE_DRAFT_API
-
- /**
+ /**
+ * Add the likely subtags for this Locale, per the algorithm described
+ * in the following CLDR technical report:
+ *
+ * http://www.unicode.org/reports/tr35/#Likely_Subtags
+ *
+ * If this Locale is already in the maximal form, or not valid, or there is
+ * no data available for maximization, the Locale will be unchanged.
+ *
+ * For example, "und-Zzzz" cannot be maximized, since there is no
+ * reasonable maximization.
+ *
+ * Examples:
+ *
+ * "en" maximizes to "en_Latn_US"
+ *
+ * "de" maximizes to "de_Latn_US"
+ *
+ * "sr" maximizes to "sr_Cyrl_RS"
+ *
+ * "sh" maximizes to "sr_Latn_RS" (Note this will not reverse.)
+ *
+ * "zh_Hani" maximizes to "zh_Hans_CN" (Note this will not reverse.)
+ *
+ * @param status error information if maximizing this Locale failed.
+ * If this Locale is not well-formed, the error code is
+ * U_ILLEGAL_ARGUMENT_ERROR.
+ * @stable ICU 63
+ */
+ void addLikelySubtags(UErrorCode& status);
+
+ /**
+ * Minimize the subtags for this Locale, per the algorithm described
+ * in the following CLDR technical report:
+ *
+ * http://www.unicode.org/reports/tr35/#Likely_Subtags
+ *
+ * If this Locale is already in the minimal form, or not valid, or there is
+ * no data available for minimization, the Locale will be unchanged.
+ *
+ * Since the minimization algorithm relies on proper maximization, see the
+ * comments for addLikelySubtags for reasons why there might not be any
+ * data.
+ *
+ * Examples:
+ *
+ * "en_Latn_US" minimizes to "en"
+ *
+ * "de_Latn_US" minimizes to "de"
+ *
+ * "sr_Cyrl_RS" minimizes to "sr"
+ *
+ * "zh_Hant_TW" minimizes to "zh_TW" (The region is preferred to the
+ * script, and minimizing to "zh" would imply "zh_Hans_CN".)
+ *
+ * @param status error information if maximizing this Locale failed.
+ * If this Locale is not well-formed, the error code is
+ * U_ILLEGAL_ARGUMENT_ERROR.
+ * @stable ICU 63
+ */
+ void minimizeSubtags(UErrorCode& status);
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Canonicalize the locale ID of this object according to CLDR.
+ * @param status the status code
+ * @draft ICU 67
+ * @see createCanonical
+ */
+ void canonicalize(UErrorCode& status);
+#endif // U_HIDE_DRAFT_API
+
+ /**
* Gets the list of keywords for the specified locale.
*
* @param status the status code
* @return pointer to StringEnumeration class, or NULL if there are no keywords.
* Client must dispose of it by calling delete.
- * @see getKeywords
+ * @see getKeywords
* @stable ICU 2.8
*/
StringEnumeration * createKeywords(UErrorCode &status) const;
/**
- * Gets the list of Unicode keywords for the specified locale.
- *
- * @param status the status code
- * @return pointer to StringEnumeration class, or NULL if there are no keywords.
- * Client must dispose of it by calling delete.
- * @see getUnicodeKeywords
- * @stable ICU 63
- */
- StringEnumeration * createUnicodeKeywords(UErrorCode &status) const;
-
- /**
- * Gets the set of keywords for this Locale.
- *
- * A wrapper to call createKeywords() and write the resulting
- * keywords as standard strings (or compatible objects) into any kind of
- * container that can be written to by an STL style output iterator.
- *
- * @param iterator an STL style output iterator to write the keywords to.
- * @param status error information if creating set of keywords failed.
- * @stable ICU 63
- */
- template<typename StringClass, typename OutputIterator>
- inline void getKeywords(OutputIterator iterator, UErrorCode& status) const;
-
- /**
- * Gets the set of Unicode keywords for this Locale.
- *
- * A wrapper to call createUnicodeKeywords() and write the resulting
- * keywords as standard strings (or compatible objects) into any kind of
- * container that can be written to by an STL style output iterator.
- *
- * @param iterator an STL style output iterator to write the keywords to.
- * @param status error information if creating set of keywords failed.
- * @stable ICU 63
- */
- template<typename StringClass, typename OutputIterator>
- inline void getUnicodeKeywords(OutputIterator iterator, UErrorCode& status) const;
-
- /**
+ * Gets the list of Unicode keywords for the specified locale.
+ *
+ * @param status the status code
+ * @return pointer to StringEnumeration class, or NULL if there are no keywords.
+ * Client must dispose of it by calling delete.
+ * @see getUnicodeKeywords
+ * @stable ICU 63
+ */
+ StringEnumeration * createUnicodeKeywords(UErrorCode &status) const;
+
+ /**
+ * Gets the set of keywords for this Locale.
+ *
+ * A wrapper to call createKeywords() and write the resulting
+ * keywords as standard strings (or compatible objects) into any kind of
+ * container that can be written to by an STL style output iterator.
+ *
+ * @param iterator an STL style output iterator to write the keywords to.
+ * @param status error information if creating set of keywords failed.
+ * @stable ICU 63
+ */
+ template<typename StringClass, typename OutputIterator>
+ inline void getKeywords(OutputIterator iterator, UErrorCode& status) const;
+
+ /**
+ * Gets the set of Unicode keywords for this Locale.
+ *
+ * A wrapper to call createUnicodeKeywords() and write the resulting
+ * keywords as standard strings (or compatible objects) into any kind of
+ * container that can be written to by an STL style output iterator.
+ *
+ * @param iterator an STL style output iterator to write the keywords to.
+ * @param status error information if creating set of keywords failed.
+ * @stable ICU 63
+ */
+ template<typename StringClass, typename OutputIterator>
+ inline void getUnicodeKeywords(OutputIterator iterator, UErrorCode& status) const;
+
+ /**
* Gets the value for a keyword.
*
- * This uses legacy keyword=value pairs, like "collation=phonebook".
- *
- * ICU4C doesn't do automatic conversion between legacy and Unicode
- * keywords and values in getters and setters (as opposed to ICU4J).
- *
+ * This uses legacy keyword=value pairs, like "collation=phonebook".
+ *
+ * ICU4C doesn't do automatic conversion between legacy and Unicode
+ * keywords and values in getters and setters (as opposed to ICU4J).
+ *
* @param keywordName name of the keyword for which we want the value. Case insensitive.
* @param buffer The buffer to receive the keyword value.
* @param bufferCapacity The capacity of receiving buffer
@@ -646,78 +646,78 @@ public:
int32_t getKeywordValue(const char* keywordName, char *buffer, int32_t bufferCapacity, UErrorCode &status) const;
/**
- * Gets the value for a keyword.
- *
- * This uses legacy keyword=value pairs, like "collation=phonebook".
- *
- * ICU4C doesn't do automatic conversion between legacy and Unicode
- * keywords and values in getters and setters (as opposed to ICU4J).
- *
- * @param keywordName name of the keyword for which we want the value.
- * @param sink the sink to receive the keyword value.
- * @param status error information if getting the value failed.
- * @stable ICU 63
- */
- void getKeywordValue(StringPiece keywordName, ByteSink& sink, UErrorCode& status) const;
-
- /**
- * Gets the value for a keyword.
- *
- * This uses legacy keyword=value pairs, like "collation=phonebook".
- *
- * ICU4C doesn't do automatic conversion between legacy and Unicode
- * keywords and values in getters and setters (as opposed to ICU4J).
- *
- * @param keywordName name of the keyword for which we want the value.
- * @param status error information if getting the value failed.
- * @return the keyword value.
- * @stable ICU 63
- */
- template<typename StringClass>
- inline StringClass getKeywordValue(StringPiece keywordName, UErrorCode& status) const;
-
- /**
- * Gets the Unicode value for a Unicode keyword.
- *
- * This uses Unicode key-value pairs, like "co-phonebk".
- *
- * ICU4C doesn't do automatic conversion between legacy and Unicode
- * keywords and values in getters and setters (as opposed to ICU4J).
- *
- * @param keywordName name of the keyword for which we want the value.
- * @param sink the sink to receive the keyword value.
- * @param status error information if getting the value failed.
- * @stable ICU 63
- */
- void getUnicodeKeywordValue(StringPiece keywordName, ByteSink& sink, UErrorCode& status) const;
-
- /**
- * Gets the Unicode value for a Unicode keyword.
- *
- * This uses Unicode key-value pairs, like "co-phonebk".
- *
- * ICU4C doesn't do automatic conversion between legacy and Unicode
- * keywords and values in getters and setters (as opposed to ICU4J).
- *
- * @param keywordName name of the keyword for which we want the value.
- * @param status error information if getting the value failed.
- * @return the keyword value.
- * @stable ICU 63
- */
- template<typename StringClass>
- inline StringClass getUnicodeKeywordValue(StringPiece keywordName, UErrorCode& status) const;
-
- /**
+ * Gets the value for a keyword.
+ *
+ * This uses legacy keyword=value pairs, like "collation=phonebook".
+ *
+ * ICU4C doesn't do automatic conversion between legacy and Unicode
+ * keywords and values in getters and setters (as opposed to ICU4J).
+ *
+ * @param keywordName name of the keyword for which we want the value.
+ * @param sink the sink to receive the keyword value.
+ * @param status error information if getting the value failed.
+ * @stable ICU 63
+ */
+ void getKeywordValue(StringPiece keywordName, ByteSink& sink, UErrorCode& status) const;
+
+ /**
+ * Gets the value for a keyword.
+ *
+ * This uses legacy keyword=value pairs, like "collation=phonebook".
+ *
+ * ICU4C doesn't do automatic conversion between legacy and Unicode
+ * keywords and values in getters and setters (as opposed to ICU4J).
+ *
+ * @param keywordName name of the keyword for which we want the value.
+ * @param status error information if getting the value failed.
+ * @return the keyword value.
+ * @stable ICU 63
+ */
+ template<typename StringClass>
+ inline StringClass getKeywordValue(StringPiece keywordName, UErrorCode& status) const;
+
+ /**
+ * Gets the Unicode value for a Unicode keyword.
+ *
+ * This uses Unicode key-value pairs, like "co-phonebk".
+ *
+ * ICU4C doesn't do automatic conversion between legacy and Unicode
+ * keywords and values in getters and setters (as opposed to ICU4J).
+ *
+ * @param keywordName name of the keyword for which we want the value.
+ * @param sink the sink to receive the keyword value.
+ * @param status error information if getting the value failed.
+ * @stable ICU 63
+ */
+ void getUnicodeKeywordValue(StringPiece keywordName, ByteSink& sink, UErrorCode& status) const;
+
+ /**
+ * Gets the Unicode value for a Unicode keyword.
+ *
+ * This uses Unicode key-value pairs, like "co-phonebk".
+ *
+ * ICU4C doesn't do automatic conversion between legacy and Unicode
+ * keywords and values in getters and setters (as opposed to ICU4J).
+ *
+ * @param keywordName name of the keyword for which we want the value.
+ * @param status error information if getting the value failed.
+ * @return the keyword value.
+ * @stable ICU 63
+ */
+ template<typename StringClass>
+ inline StringClass getUnicodeKeywordValue(StringPiece keywordName, UErrorCode& status) const;
+
+ /**
* Sets or removes the value for a keyword.
*
* For removing all keywords, use getBaseName(),
* and construct a new Locale if it differs from getName().
*
- * This uses legacy keyword=value pairs, like "collation=phonebook".
- *
- * ICU4C doesn't do automatic conversion between legacy and Unicode
- * keywords and values in getters and setters (as opposed to ICU4J).
- *
+ * This uses legacy keyword=value pairs, like "collation=phonebook".
+ *
+ * ICU4C doesn't do automatic conversion between legacy and Unicode
+ * keywords and values in getters and setters (as opposed to ICU4J).
+ *
* @param keywordName name of the keyword to be set. Case insensitive.
* @param keywordValue value of the keyword to be set. If 0-length or
* NULL, will result in the keyword being removed. No error is given if
@@ -729,46 +729,46 @@ public:
void setKeywordValue(const char* keywordName, const char* keywordValue, UErrorCode &status);
/**
- * Sets or removes the value for a keyword.
- *
- * For removing all keywords, use getBaseName(),
- * and construct a new Locale if it differs from getName().
- *
- * This uses legacy keyword=value pairs, like "collation=phonebook".
- *
- * ICU4C doesn't do automatic conversion between legacy and Unicode
- * keywords and values in getters and setters (as opposed to ICU4J).
- *
- * @param keywordName name of the keyword to be set.
- * @param keywordValue value of the keyword to be set. If 0-length or
- * NULL, will result in the keyword being removed. No error is given if
- * that keyword does not exist.
- * @param status Returns any error information while performing this operation.
- * @stable ICU 63
- */
- void setKeywordValue(StringPiece keywordName, StringPiece keywordValue, UErrorCode& status);
-
- /**
- * Sets or removes the Unicode value for a Unicode keyword.
- *
- * For removing all keywords, use getBaseName(),
- * and construct a new Locale if it differs from getName().
- *
- * This uses Unicode key-value pairs, like "co-phonebk".
- *
- * ICU4C doesn't do automatic conversion between legacy and Unicode
- * keywords and values in getters and setters (as opposed to ICU4J).
- *
- * @param keywordName name of the keyword to be set.
- * @param keywordValue value of the keyword to be set. If 0-length or
- * NULL, will result in the keyword being removed. No error is given if
- * that keyword does not exist.
- * @param status Returns any error information while performing this operation.
- * @stable ICU 63
- */
- void setUnicodeKeywordValue(StringPiece keywordName, StringPiece keywordValue, UErrorCode& status);
-
- /**
+ * Sets or removes the value for a keyword.
+ *
+ * For removing all keywords, use getBaseName(),
+ * and construct a new Locale if it differs from getName().
+ *
+ * This uses legacy keyword=value pairs, like "collation=phonebook".
+ *
+ * ICU4C doesn't do automatic conversion between legacy and Unicode
+ * keywords and values in getters and setters (as opposed to ICU4J).
+ *
+ * @param keywordName name of the keyword to be set.
+ * @param keywordValue value of the keyword to be set. If 0-length or
+ * NULL, will result in the keyword being removed. No error is given if
+ * that keyword does not exist.
+ * @param status Returns any error information while performing this operation.
+ * @stable ICU 63
+ */
+ void setKeywordValue(StringPiece keywordName, StringPiece keywordValue, UErrorCode& status);
+
+ /**
+ * Sets or removes the Unicode value for a Unicode keyword.
+ *
+ * For removing all keywords, use getBaseName(),
+ * and construct a new Locale if it differs from getName().
+ *
+ * This uses Unicode key-value pairs, like "co-phonebk".
+ *
+ * ICU4C doesn't do automatic conversion between legacy and Unicode
+ * keywords and values in getters and setters (as opposed to ICU4J).
+ *
+ * @param keywordName name of the keyword to be set.
+ * @param keywordValue value of the keyword to be set. If 0-length or
+ * NULL, will result in the keyword being removed. No error is given if
+ * that keyword does not exist.
+ * @param status Returns any error information while performing this operation.
+ * @stable ICU 63
+ */
+ void setUnicodeKeywordValue(StringPiece keywordName, StringPiece keywordValue, UErrorCode& status);
+
+ /**
* returns the locale's three-letter language code, as specified
* in ISO draft standard ISO-639-2.
* @return An alias to the code, or an empty string
@@ -925,7 +925,7 @@ public:
/**
* Fills in "name" with the name of this locale in a format suitable for user display
- * in the locale specified by "displayLocale". This function uses getDisplayLanguage(),
+ * in the locale specified by "displayLocale". This function uses getDisplayLanguage(),
* getDisplayCountry(), and getDisplayVariant() to do its work, and outputs the display
* name in the format "language (country[,variant])". For example, if displayLocale is
* fr_FR, then en_US's display name would be "Anglais (&Eacute;tats-Unis)", and no_NO_NY's
@@ -959,7 +959,7 @@ public:
* @return FALSE if it is a real locale, TRUE if it is a bogus locale
* @stable ICU 2.1
*/
- inline UBool isBogus(void) const;
+ inline UBool isBogus(void) const;
/**
* Returns a list of all installed locales.
@@ -1005,104 +1005,104 @@ public:
*/
virtual UClassID getDynamicClassID() const;
-#ifndef U_HIDE_DRAFT_API
- /**
- * A Locale iterator interface similar to a Java Iterator<Locale>.
- * @draft ICU 65
- */
- class U_COMMON_API Iterator /* not : public UObject because this is an interface/mixin class */ {
- public:
- /** @draft ICU 65 */
- virtual ~Iterator();
-
- /**
- * @return TRUE if next() can be called again.
- * @draft ICU 65
- */
- virtual UBool hasNext() const = 0;
-
- /**
- * @return the next locale.
- * @draft ICU 65
- */
- virtual const Locale &next() = 0;
- };
-
- /**
- * A generic Locale iterator implementation over Locale input iterators.
- * @draft ICU 65
- */
- template<typename Iter>
- class RangeIterator : public Iterator, public UMemory {
- public:
- /**
- * Constructs an iterator from a begin/end range.
- * Each of the iterator parameter values must be an
- * input iterator whose value is convertible to const Locale &.
- *
- * @param begin Start of range.
- * @param end Exclusive end of range.
- * @draft ICU 65
- */
- RangeIterator(Iter begin, Iter end) : it_(begin), end_(end) {}
-
- /**
- * @return TRUE if next() can be called again.
- * @draft ICU 65
- */
- UBool hasNext() const override { return it_ != end_; }
-
- /**
- * @return the next locale.
- * @draft ICU 65
- */
- const Locale &next() override { return *it_++; }
-
- private:
- Iter it_;
- const Iter end_;
- };
-
- /**
- * A generic Locale iterator implementation over Locale input iterators.
- * Calls the converter to convert each *begin to a const Locale &.
- * @draft ICU 65
- */
- template<typename Iter, typename Conv>
- class ConvertingIterator : public Iterator, public UMemory {
- public:
- /**
- * Constructs an iterator from a begin/end range.
- * Each of the iterator parameter values must be an
- * input iterator whose value the converter converts to const Locale &.
- *
- * @param begin Start of range.
- * @param end Exclusive end of range.
- * @param converter Converter from *begin to const Locale & or compatible.
- * @draft 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
- */
- UBool hasNext() const override { return it_ != end_; }
-
- /**
- * @return the next locale.
- * @draft ICU 65
- */
- const Locale &next() override { return converter_(*it_++); }
-
- private:
- Iter it_;
- const Iter end_;
- Conv converter_;
- };
-#endif // U_HIDE_DRAFT_API
-
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * A Locale iterator interface similar to a Java Iterator<Locale>.
+ * @draft ICU 65
+ */
+ class U_COMMON_API Iterator /* not : public UObject because this is an interface/mixin class */ {
+ public:
+ /** @draft ICU 65 */
+ virtual ~Iterator();
+
+ /**
+ * @return TRUE if next() can be called again.
+ * @draft ICU 65
+ */
+ virtual UBool hasNext() const = 0;
+
+ /**
+ * @return the next locale.
+ * @draft ICU 65
+ */
+ virtual const Locale &next() = 0;
+ };
+
+ /**
+ * A generic Locale iterator implementation over Locale input iterators.
+ * @draft ICU 65
+ */
+ template<typename Iter>
+ class RangeIterator : public Iterator, public UMemory {
+ public:
+ /**
+ * Constructs an iterator from a begin/end range.
+ * Each of the iterator parameter values must be an
+ * input iterator whose value is convertible to const Locale &.
+ *
+ * @param begin Start of range.
+ * @param end Exclusive end of range.
+ * @draft ICU 65
+ */
+ RangeIterator(Iter begin, Iter end) : it_(begin), end_(end) {}
+
+ /**
+ * @return TRUE if next() can be called again.
+ * @draft ICU 65
+ */
+ UBool hasNext() const override { return it_ != end_; }
+
+ /**
+ * @return the next locale.
+ * @draft ICU 65
+ */
+ const Locale &next() override { return *it_++; }
+
+ private:
+ Iter it_;
+ const Iter end_;
+ };
+
+ /**
+ * A generic Locale iterator implementation over Locale input iterators.
+ * Calls the converter to convert each *begin to a const Locale &.
+ * @draft ICU 65
+ */
+ template<typename Iter, typename Conv>
+ class ConvertingIterator : public Iterator, public UMemory {
+ public:
+ /**
+ * Constructs an iterator from a begin/end range.
+ * Each of the iterator parameter values must be an
+ * input iterator whose value the converter converts to const Locale &.
+ *
+ * @param begin Start of range.
+ * @param end Exclusive end of range.
+ * @param converter Converter from *begin to const Locale & or compatible.
+ * @draft 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
+ */
+ UBool hasNext() const override { return it_ != end_; }
+
+ /**
+ * @return the next locale.
+ * @draft ICU 65
+ */
+ const Locale &next() override { return converter_(*it_++); }
+
+ private:
+ Iter it_;
+ const Iter end_;
+ Conv converter_;
+ };
+#endif // U_HIDE_DRAFT_API
+
protected: /* only protected for testing purposes. DO NOT USE. */
#ifndef U_HIDE_INTERNAL_API
/**
@@ -1153,12 +1153,12 @@ private:
/**
* A friend to allow the default locale to be set by either the C or C++ API.
- * @internal (private)
+ * @internal (private)
*/
friend Locale *locale_set_default_internal(const char *, UErrorCode& status);
/**
- * @internal (private)
+ * @internal (private)
*/
friend void U_CALLCONV locale_available_init();
};
@@ -1169,15 +1169,15 @@ Locale::operator!=(const Locale& other) const
return !operator==(other);
}
-template<typename StringClass> inline StringClass
-Locale::toLanguageTag(UErrorCode& status) const
-{
- StringClass result;
- StringByteSink<StringClass> sink(&result);
- toLanguageTag(sink, status);
- return result;
-}
-
+template<typename StringClass> inline StringClass
+Locale::toLanguageTag(UErrorCode& status) const
+{
+ StringClass result;
+ StringByteSink<StringClass> sink(&result);
+ toLanguageTag(sink, status);
+ return result;
+}
+
inline const char *
Locale::getCountry() const
{
@@ -1208,58 +1208,58 @@ Locale::getName() const
return fullName;
}
-template<typename StringClass, typename OutputIterator> inline void
-Locale::getKeywords(OutputIterator iterator, UErrorCode& status) const
-{
- LocalPointer<StringEnumeration> keys(createKeywords(status));
- if (U_FAILURE(status) || keys.isNull()) {
- return;
- }
- for (;;) {
- int32_t resultLength;
- const char* buffer = keys->next(&resultLength, status);
- if (U_FAILURE(status) || buffer == nullptr) {
- return;
- }
- *iterator++ = StringClass(buffer, resultLength);
- }
-}
-
-template<typename StringClass, typename OutputIterator> inline void
-Locale::getUnicodeKeywords(OutputIterator iterator, UErrorCode& status) const
-{
- LocalPointer<StringEnumeration> keys(createUnicodeKeywords(status));
- if (U_FAILURE(status) || keys.isNull()) {
- return;
- }
- for (;;) {
- int32_t resultLength;
- const char* buffer = keys->next(&resultLength, status);
- if (U_FAILURE(status) || buffer == nullptr) {
- return;
- }
- *iterator++ = StringClass(buffer, resultLength);
- }
-}
-
-template<typename StringClass> inline StringClass
-Locale::getKeywordValue(StringPiece keywordName, UErrorCode& status) const
-{
- StringClass result;
- StringByteSink<StringClass> sink(&result);
- getKeywordValue(keywordName, sink, status);
- return result;
-}
-
-template<typename StringClass> inline StringClass
-Locale::getUnicodeKeywordValue(StringPiece keywordName, UErrorCode& status) const
-{
- StringClass result;
- StringByteSink<StringClass> sink(&result);
- getUnicodeKeywordValue(keywordName, sink, status);
- return result;
-}
-
+template<typename StringClass, typename OutputIterator> inline void
+Locale::getKeywords(OutputIterator iterator, UErrorCode& status) const
+{
+ LocalPointer<StringEnumeration> keys(createKeywords(status));
+ if (U_FAILURE(status) || keys.isNull()) {
+ return;
+ }
+ for (;;) {
+ int32_t resultLength;
+ const char* buffer = keys->next(&resultLength, status);
+ if (U_FAILURE(status) || buffer == nullptr) {
+ return;
+ }
+ *iterator++ = StringClass(buffer, resultLength);
+ }
+}
+
+template<typename StringClass, typename OutputIterator> inline void
+Locale::getUnicodeKeywords(OutputIterator iterator, UErrorCode& status) const
+{
+ LocalPointer<StringEnumeration> keys(createUnicodeKeywords(status));
+ if (U_FAILURE(status) || keys.isNull()) {
+ return;
+ }
+ for (;;) {
+ int32_t resultLength;
+ const char* buffer = keys->next(&resultLength, status);
+ if (U_FAILURE(status) || buffer == nullptr) {
+ return;
+ }
+ *iterator++ = StringClass(buffer, resultLength);
+ }
+}
+
+template<typename StringClass> inline StringClass
+Locale::getKeywordValue(StringPiece keywordName, UErrorCode& status) const
+{
+ StringClass result;
+ StringByteSink<StringClass> sink(&result);
+ getKeywordValue(keywordName, sink, status);
+ return result;
+}
+
+template<typename StringClass> inline StringClass
+Locale::getUnicodeKeywordValue(StringPiece keywordName, UErrorCode& status) const
+{
+ StringClass result;
+ StringByteSink<StringClass> sink(&result);
+ getUnicodeKeywordValue(keywordName, sink, status);
+ return result;
+}
+
inline UBool
Locale::isBogus(void) const {
return fIsBogus;
@@ -1267,6 +1267,6 @@ Locale::isBogus(void) const {
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/measfmt.h b/contrib/libs/icu/include/unicode/measfmt.h
index 6775982bca..b4f9048629 100644
--- a/contrib/libs/icu/include/unicode/measfmt.h
+++ b/contrib/libs/icu/include/unicode/measfmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -15,8 +15,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
#include "unicode/format.h"
@@ -24,7 +24,7 @@
/**
* \file
- * \brief C++ API: Compatibility APIs for measure formatting.
+ * \brief C++ API: Compatibility APIs for measure formatting.
*/
/**
@@ -89,9 +89,9 @@ class ListFormatter;
class DateFormat;
/**
- * <p><strong>IMPORTANT:</strong> New users are strongly encouraged to see if
- * numberformatter.h fits their use case. Although not deprecated, this header
- * is provided for backwards compatibility only.
+ * <p><strong>IMPORTANT:</strong> New users are strongly encouraged to see if
+ * numberformatter.h fits their use case. Although not deprecated, this header
+ * is provided for backwards compatibility only.
*
* @see Format
* @author Alan Liu
@@ -104,9 +104,9 @@ class U_I18N_API MeasureFormat : public Format {
/**
* Constructor.
- * <p>
- * <strong>NOTE:</strong> New users are strongly encouraged to use
- * {@link icu::number::NumberFormatter} instead of NumberFormat.
+ * <p>
+ * <strong>NOTE:</strong> New users are strongly encouraged to use
+ * {@link icu::number::NumberFormatter} instead of NumberFormat.
* @stable ICU 53
*/
MeasureFormat(
@@ -114,9 +114,9 @@ class U_I18N_API MeasureFormat : public Format {
/**
* Constructor.
- * <p>
- * <strong>NOTE:</strong> New users are strongly encouraged to use
- * {@link icu::number::NumberFormatter} instead of NumberFormat.
+ * <p>
+ * <strong>NOTE:</strong> New users are strongly encouraged to use
+ * {@link icu::number::NumberFormatter} instead of NumberFormat.
* @stable ICU 53
*/
MeasureFormat(
@@ -153,7 +153,7 @@ class U_I18N_API MeasureFormat : public Format {
* Clones this object polymorphically.
* @stable ICU 53
*/
- virtual MeasureFormat *clone() const;
+ virtual MeasureFormat *clone() const;
/**
* Formats object to produce a string.
@@ -165,7 +165,7 @@ class U_I18N_API MeasureFormat : public Format {
FieldPosition &pos,
UErrorCode &status) const;
-#ifndef U_FORCE_HIDE_DRAFT_API
+#ifndef U_FORCE_HIDE_DRAFT_API
/**
* Parse a string to produce an object. This implementation sets
* status to U_UNSUPPORTED_ERROR.
@@ -176,7 +176,7 @@ class U_I18N_API MeasureFormat : public Format {
const UnicodeString &source,
Formattable &reslt,
ParsePosition &pos) const;
-#endif // U_FORCE_HIDE_DRAFT_API
+#endif // U_FORCE_HIDE_DRAFT_API
/**
* Formats measure objects to produce a string. An example of such a
@@ -206,7 +206,7 @@ class U_I18N_API MeasureFormat : public Format {
* formatted string is 3.5 meters per second.
* @param measure The measure object. In above example, 3.5 meters.
* @param perUnit The per unit. In above example, it is
- * `*%MeasureUnit::createSecond(status)`.
+ * `*%MeasureUnit::createSecond(status)`.
* @param appendTo formatted string appended here.
* @param pos the field position.
* @param status the error.
@@ -227,10 +227,10 @@ class U_I18N_API MeasureFormat : public Format {
* @param unit The unit for which to get a display name.
* @param status the error.
* @return The display name in the locale and width specified in
- * the MeasureFormat constructor, or null if there is no display name available
+ * the MeasureFormat constructor, or null if there is no display name available
* for the specified unit.
*
- * @stable ICU 58
+ * @stable ICU 58
*/
UnicodeString getUnitDisplayName(const MeasureUnit& unit, UErrorCode &status) const;
@@ -238,9 +238,9 @@ class U_I18N_API MeasureFormat : public Format {
/**
* Return a formatter for CurrencyAmount objects in the given
* locale.
- * <p>
- * <strong>NOTE:</strong> New users are strongly encouraged to use
- * {@link icu::number::NumberFormatter} instead of NumberFormat.
+ * <p>
+ * <strong>NOTE:</strong> New users are strongly encouraged to use
+ * {@link icu::number::NumberFormatter} instead of NumberFormat.
* @param locale desired locale
* @param ec input-output error code
* @return a formatter object, or NULL upon error
@@ -252,9 +252,9 @@ class U_I18N_API MeasureFormat : public Format {
/**
* Return a formatter for CurrencyAmount objects in the default
* locale.
- * <p>
- * <strong>NOTE:</strong> New users are strongly encouraged to use
- * {@link icu::number::NumberFormatter} instead of NumberFormat.
+ * <p>
+ * <strong>NOTE:</strong> New users are strongly encouraged to use
+ * {@link icu::number::NumberFormatter} instead of NumberFormat.
* @param ec input-output error code
* @return a formatter object, or NULL upon error
* @stable ICU 3.0
@@ -326,19 +326,19 @@ class U_I18N_API MeasureFormat : public Format {
* ICU use only.
* @internal.
*/
- const NumberFormat &getNumberFormatInternal() const;
+ const NumberFormat &getNumberFormatInternal() const;
+
+ /**
+ * ICU use only.
+ * Always returns the short form currency formatter.
+ * @internal.
+ */
+ const NumberFormat& getCurrencyFormatInternal() const;
/**
* ICU use only.
- * Always returns the short form currency formatter.
* @internal.
*/
- const NumberFormat& getCurrencyFormatInternal() const;
-
- /**
- * ICU use only.
- * @internal.
- */
const PluralRules &getPluralRules() const;
/**
@@ -359,7 +359,7 @@ class U_I18N_API MeasureFormat : public Format {
const MeasureFormatCacheData *cache;
const SharedNumberFormat *numberFormat;
const SharedPluralRules *pluralRules;
- UMeasureFormatWidth fWidth;
+ UMeasureFormatWidth fWidth;
// Declared outside of MeasureFormatSharedData because ListFormatter
// objects are relatively cheap to copy; therefore, they don't need to be
@@ -391,7 +391,7 @@ class U_I18N_API MeasureFormat : public Format {
U_NAMESPACE_END
#endif // #if !UCONFIG_NO_FORMATTING
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // #ifndef MEASUREFORMAT_H
diff --git a/contrib/libs/icu/include/unicode/measunit.h b/contrib/libs/icu/include/unicode/measunit.h
index 5c3e168b25..e240092e30 100644
--- a/contrib/libs/icu/include/unicode/measunit.h
+++ b/contrib/libs/icu/include/unicode/measunit.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -15,12 +15,12 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
#include "unicode/unistr.h"
-#include "unicode/localpointer.h"
+#include "unicode/localpointer.h"
/**
* \file
@@ -30,204 +30,204 @@
U_NAMESPACE_BEGIN
class StringEnumeration;
-struct MeasureUnitImpl;
+struct MeasureUnitImpl;
-#ifndef U_HIDE_DRAFT_API
+#ifndef U_HIDE_DRAFT_API
/**
- * Enumeration for unit complexity. There are three levels:
- *
- * - SINGLE: A single unit, optionally with a power and/or SI prefix. Examples: hectare,
- * square-kilometer, kilojoule, per-second.
- * - COMPOUND: A unit composed of the product of multiple single units. Examples:
- * meter-per-second, kilowatt-hour, kilogram-meter-per-square-second.
- * - MIXED: A unit composed of the sum of multiple single units. Examples: foot+inch,
- * hour+minute+second, degree+arcminute+arcsecond.
- *
- * The complexity determines which operations are available. For example, you cannot set the power
- * or SI prefix of a compound unit.
- *
- * @draft ICU 67
- */
-enum UMeasureUnitComplexity {
- /**
- * A single unit, like kilojoule.
- *
- * @draft ICU 67
- */
- UMEASURE_UNIT_SINGLE,
-
- /**
- * A compound unit, like meter-per-second.
- *
- * @draft ICU 67
- */
- UMEASURE_UNIT_COMPOUND,
-
- /**
- * A mixed unit, like hour+minute.
- *
- * @draft ICU 67
- */
- UMEASURE_UNIT_MIXED
-};
-
-/**
- * Enumeration for SI prefixes, such as "kilo".
+ * Enumeration for unit complexity. There are three levels:
*
- * @draft ICU 67
- */
-typedef enum UMeasureSIPrefix {
-
- /**
- * SI prefix: yotta, 10^24.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_YOTTA = 24,
-
- /**
- * SI prefix: zetta, 10^21.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_ZETTA = 21,
-
- /**
- * SI prefix: exa, 10^18.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_EXA = 18,
-
- /**
- * SI prefix: peta, 10^15.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_PETA = 15,
-
- /**
- * SI prefix: tera, 10^12.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_TERA = 12,
-
- /**
- * SI prefix: giga, 10^9.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_GIGA = 9,
-
- /**
- * SI prefix: mega, 10^6.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_MEGA = 6,
-
- /**
- * SI prefix: kilo, 10^3.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_KILO = 3,
-
- /**
- * SI prefix: hecto, 10^2.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_HECTO = 2,
-
- /**
- * SI prefix: deka, 10^1.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_DEKA = 1,
-
- /**
- * The absence of an SI prefix.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_ONE = 0,
-
- /**
- * SI prefix: deci, 10^-1.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_DECI = -1,
-
- /**
- * SI prefix: centi, 10^-2.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_CENTI = -2,
-
- /**
- * SI prefix: milli, 10^-3.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_MILLI = -3,
-
- /**
- * SI prefix: micro, 10^-6.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_MICRO = -6,
-
- /**
- * SI prefix: nano, 10^-9.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_NANO = -9,
-
- /**
- * SI prefix: pico, 10^-12.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_PICO = -12,
-
- /**
- * SI prefix: femto, 10^-15.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_FEMTO = -15,
-
- /**
- * SI prefix: atto, 10^-18.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_ATTO = -18,
-
- /**
- * SI prefix: zepto, 10^-21.
- *
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_ZEPTO = -21,
-
- /**
- * SI prefix: yocto, 10^-24.
+ * - SINGLE: A single unit, optionally with a power and/or SI prefix. Examples: hectare,
+ * square-kilometer, kilojoule, per-second.
+ * - COMPOUND: A unit composed of the product of multiple single units. Examples:
+ * meter-per-second, kilowatt-hour, kilogram-meter-per-square-second.
+ * - MIXED: A unit composed of the sum of multiple single units. Examples: foot+inch,
+ * hour+minute+second, degree+arcminute+arcsecond.
+ *
+ * The complexity determines which operations are available. For example, you cannot set the power
+ * or SI prefix of a compound unit.
+ *
+ * @draft ICU 67
+ */
+enum UMeasureUnitComplexity {
+ /**
+ * A single unit, like kilojoule.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_UNIT_SINGLE,
+
+ /**
+ * A compound unit, like meter-per-second.
*
- * @draft ICU 67
- */
- UMEASURE_SI_PREFIX_YOCTO = -24
-} UMeasureSIPrefix;
-#endif // U_HIDE_DRAFT_API
-
-/**
+ * @draft ICU 67
+ */
+ UMEASURE_UNIT_COMPOUND,
+
+ /**
+ * A mixed unit, like hour+minute.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_UNIT_MIXED
+};
+
+/**
+ * Enumeration for SI prefixes, such as "kilo".
+ *
+ * @draft ICU 67
+ */
+typedef enum UMeasureSIPrefix {
+
+ /**
+ * SI prefix: yotta, 10^24.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_YOTTA = 24,
+
+ /**
+ * SI prefix: zetta, 10^21.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_ZETTA = 21,
+
+ /**
+ * SI prefix: exa, 10^18.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_EXA = 18,
+
+ /**
+ * SI prefix: peta, 10^15.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_PETA = 15,
+
+ /**
+ * SI prefix: tera, 10^12.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_TERA = 12,
+
+ /**
+ * SI prefix: giga, 10^9.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_GIGA = 9,
+
+ /**
+ * SI prefix: mega, 10^6.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_MEGA = 6,
+
+ /**
+ * SI prefix: kilo, 10^3.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_KILO = 3,
+
+ /**
+ * SI prefix: hecto, 10^2.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_HECTO = 2,
+
+ /**
+ * SI prefix: deka, 10^1.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_DEKA = 1,
+
+ /**
+ * The absence of an SI prefix.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_ONE = 0,
+
+ /**
+ * SI prefix: deci, 10^-1.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_DECI = -1,
+
+ /**
+ * SI prefix: centi, 10^-2.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_CENTI = -2,
+
+ /**
+ * SI prefix: milli, 10^-3.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_MILLI = -3,
+
+ /**
+ * SI prefix: micro, 10^-6.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_MICRO = -6,
+
+ /**
+ * SI prefix: nano, 10^-9.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_NANO = -9,
+
+ /**
+ * SI prefix: pico, 10^-12.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_PICO = -12,
+
+ /**
+ * SI prefix: femto, 10^-15.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_FEMTO = -15,
+
+ /**
+ * SI prefix: atto, 10^-18.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_ATTO = -18,
+
+ /**
+ * SI prefix: zepto, 10^-21.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_ZEPTO = -21,
+
+ /**
+ * SI prefix: yocto, 10^-24.
+ *
+ * @draft ICU 67
+ */
+ UMEASURE_SI_PREFIX_YOCTO = -24
+} UMeasureSIPrefix;
+#endif // U_HIDE_DRAFT_API
+
+/**
* A unit such as length, mass, volume, currency, etc. A unit is
* coupled with a numeric amount to produce a Measure.
*
@@ -239,59 +239,59 @@ class U_I18N_API MeasureUnit: public UObject {
/**
* Default constructor.
- * Populates the instance with the base dimensionless unit.
+ * Populates the instance with the base dimensionless unit.
* @stable ICU 3.0
*/
- MeasureUnit();
+ MeasureUnit();
/**
* Copy constructor.
* @stable ICU 3.0
*/
MeasureUnit(const MeasureUnit &other);
-
-#ifndef U_HIDE_DRAFT_API
+
+#ifndef U_HIDE_DRAFT_API
/**
- * Move constructor.
- * @draft ICU 67
- */
- MeasureUnit(MeasureUnit &&other) noexcept;
-
- /**
- * Construct a MeasureUnit from a CLDR Unit Identifier, defined in UTS 35.
- * Validates and canonicalizes the identifier.
- *
- * <pre>
- * MeasureUnit example = MeasureUnit::forIdentifier("furlong-per-nanosecond")
- * </pre>
- *
- * @param identifier The CLDR Unit Identifier
- * @param status Set if the identifier is invalid.
- * @draft ICU 67
- */
- static MeasureUnit forIdentifier(StringPiece identifier, UErrorCode& status);
-#endif // U_HIDE_DRAFT_API
-
- /**
- * Copy assignment operator.
+ * Move constructor.
+ * @draft ICU 67
+ */
+ MeasureUnit(MeasureUnit &&other) noexcept;
+
+ /**
+ * Construct a MeasureUnit from a CLDR Unit Identifier, defined in UTS 35.
+ * Validates and canonicalizes the identifier.
+ *
+ * <pre>
+ * MeasureUnit example = MeasureUnit::forIdentifier("furlong-per-nanosecond")
+ * </pre>
+ *
+ * @param identifier The CLDR Unit Identifier
+ * @param status Set if the identifier is invalid.
+ * @draft ICU 67
+ */
+ static MeasureUnit forIdentifier(StringPiece identifier, UErrorCode& status);
+#endif // U_HIDE_DRAFT_API
+
+ /**
+ * Copy assignment operator.
* @stable ICU 3.0
*/
MeasureUnit &operator=(const MeasureUnit &other);
-#ifndef U_HIDE_DRAFT_API
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Move assignment operator.
+ * @draft ICU 67
+ */
+ MeasureUnit &operator=(MeasureUnit &&other) noexcept;
+#endif // U_HIDE_DRAFT_API
+
/**
- * Move assignment operator.
- * @draft ICU 67
- */
- MeasureUnit &operator=(MeasureUnit &&other) noexcept;
-#endif // U_HIDE_DRAFT_API
-
- /**
* Returns a polymorphic clone of this object. The result will
* have the same class as returned by getDynamicClassID().
* @stable ICU 3.0
*/
- virtual MeasureUnit* clone() const;
+ virtual MeasureUnit* clone() const;
/**
* Destructor
@@ -317,157 +317,157 @@ class U_I18N_API MeasureUnit: public UObject {
/**
* Get the type.
- *
- * If the unit does not have a type, the empty string is returned.
- *
+ *
+ * If the unit does not have a type, the empty string is returned.
+ *
* @stable ICU 53
*/
const char *getType() const;
/**
* Get the sub type.
- *
- * If the unit does not have a subtype, the empty string is returned.
- *
+ *
+ * If the unit does not have a subtype, the empty string is returned.
+ *
* @stable ICU 53
*/
const char *getSubtype() const;
-#ifndef U_HIDE_DRAFT_API
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Get the CLDR Unit Identifier for this MeasureUnit, as defined in UTS 35.
+ *
+ * @return The string form of this unit, owned by this MeasureUnit.
+ * @draft ICU 67
+ */
+ const char* getIdentifier() const;
+
+ /**
+ * Compute the complexity of the unit. See UMeasureUnitComplexity for more information.
+ *
+ * @param status Set if an error occurs.
+ * @return The unit complexity.
+ * @draft ICU 67
+ */
+ UMeasureUnitComplexity getComplexity(UErrorCode& status) const;
+
+ /**
+ * Creates a MeasureUnit which is this SINGLE unit augmented with the specified SI prefix.
+ * For example, UMEASURE_SI_PREFIX_KILO for "kilo".
+ *
+ * There is sufficient locale data to format all standard SI prefixes.
+ *
+ * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will
+ * occur. For more information, see UMeasureUnitComplexity.
+ *
+ * @param prefix The SI prefix, from UMeasureSIPrefix.
+ * @param status Set if this is not a SINGLE unit or if another error occurs.
+ * @return A new SINGLE unit.
+ * @draft ICU 67
+ */
+ MeasureUnit withSIPrefix(UMeasureSIPrefix prefix, UErrorCode& status) const;
+
+ /**
+ * Gets the current SI prefix of this SINGLE unit. For example, if the unit has the SI prefix
+ * "kilo", then UMEASURE_SI_PREFIX_KILO is returned.
+ *
+ * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will
+ * occur. For more information, see UMeasureUnitComplexity.
+ *
+ * @param status Set if this is not a SINGLE unit or if another error occurs.
+ * @return The SI prefix of this SINGLE unit, from UMeasureSIPrefix.
+ * @draft ICU 67
+ */
+ UMeasureSIPrefix getSIPrefix(UErrorCode& status) const;
+
+ /**
+ * Creates a MeasureUnit which is this SINGLE unit augmented with the specified dimensionality
+ * (power). For example, if dimensionality is 2, the unit will be squared.
+ *
+ * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will
+ * occur. For more information, see UMeasureUnitComplexity.
+ *
+ * For the base dimensionless unit, withDimensionality does nothing.
+ *
+ * @param dimensionality The dimensionality (power).
+ * @param status Set if this is not a SINGLE unit or if another error occurs.
+ * @return A new SINGLE unit.
+ * @draft ICU 67
+ */
+ MeasureUnit withDimensionality(int32_t dimensionality, UErrorCode& status) const;
+
+ /**
+ * Gets the dimensionality (power) of this MeasureUnit. For example, if the unit is square,
+ * then 2 is returned.
+ *
+ * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will
+ * occur. For more information, see UMeasureUnitComplexity.
+ *
+ * For the base dimensionless unit, getDimensionality returns 0.
+ *
+ * @param status Set if this is not a SINGLE unit or if another error occurs.
+ * @return The dimensionality (power) of this simple unit.
+ * @draft ICU 67
+ */
+ int32_t getDimensionality(UErrorCode& status) const;
+
+ /**
+ * Gets the reciprocal of this MeasureUnit, with the numerator and denominator flipped.
+ *
+ * For example, if the receiver is "meter-per-second", the unit "second-per-meter" is returned.
+ *
+ * NOTE: Only works on SINGLE and COMPOUND units. If this is a MIXED unit, an error will
+ * occur. For more information, see UMeasureUnitComplexity.
+ *
+ * @param status Set if this is a MIXED unit or if another error occurs.
+ * @return The reciprocal of the target unit.
+ * @draft ICU 67
+ */
+ MeasureUnit reciprocal(UErrorCode& status) const;
+
+ /**
+ * Gets the product of this unit with another unit. This is a way to build units from
+ * constituent parts.
+ *
+ * The numerator and denominator are preserved through this operation.
+ *
+ * For example, if the receiver is "kilowatt" and the argument is "hour-per-day", then the
+ * unit "kilowatt-hour-per-day" is returned.
+ *
+ * NOTE: Only works on SINGLE and COMPOUND units. If either unit (receivee and argument) is a
+ * MIXED unit, an error will occur. For more information, see UMeasureUnitComplexity.
+ *
+ * @param other The MeasureUnit to multiply with the target.
+ * @param status Set if this or other is a MIXED unit or if another error occurs.
+ * @return The product of the target unit with the provided unit.
+ * @draft ICU 67
+ */
+ MeasureUnit product(const MeasureUnit& other, UErrorCode& status) const;
+#endif // U_HIDE_DRAFT_API
+
+#ifndef U_HIDE_INTERNAL_API
+ /**
+ * Gets the list of SINGLE units contained within a MIXED of COMPOUND unit.
+ *
+ * Examples:
+ * - Given "meter-kilogram-per-second", three units will be returned: "meter",
+ * "kilogram", and "per-second".
+ * - Given "hour+minute+second", three units will be returned: "hour", "minute",
+ * and "second".
+ *
+ * If this is a SINGLE unit, an array of length 1 will be returned.
+ *
+ * TODO(ICU-21021): Finalize this API and propose it as draft.
+ *
+ * @param outCount The number of elements in the return array.
+ * @param status Set if an error occurs.
+ * @return An array of single units, owned by the caller.
+ * @internal ICU 67 Technical Preview
+ */
+ LocalArray<MeasureUnit> splitToSingleUnits(int32_t& outCount, UErrorCode& status) const;
+#endif // U_HIDE_INTERNAL_API
+
/**
- * Get the CLDR Unit Identifier for this MeasureUnit, as defined in UTS 35.
- *
- * @return The string form of this unit, owned by this MeasureUnit.
- * @draft ICU 67
- */
- const char* getIdentifier() const;
-
- /**
- * Compute the complexity of the unit. See UMeasureUnitComplexity for more information.
- *
- * @param status Set if an error occurs.
- * @return The unit complexity.
- * @draft ICU 67
- */
- UMeasureUnitComplexity getComplexity(UErrorCode& status) const;
-
- /**
- * Creates a MeasureUnit which is this SINGLE unit augmented with the specified SI prefix.
- * For example, UMEASURE_SI_PREFIX_KILO for "kilo".
- *
- * There is sufficient locale data to format all standard SI prefixes.
- *
- * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will
- * occur. For more information, see UMeasureUnitComplexity.
- *
- * @param prefix The SI prefix, from UMeasureSIPrefix.
- * @param status Set if this is not a SINGLE unit or if another error occurs.
- * @return A new SINGLE unit.
- * @draft ICU 67
- */
- MeasureUnit withSIPrefix(UMeasureSIPrefix prefix, UErrorCode& status) const;
-
- /**
- * Gets the current SI prefix of this SINGLE unit. For example, if the unit has the SI prefix
- * "kilo", then UMEASURE_SI_PREFIX_KILO is returned.
- *
- * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will
- * occur. For more information, see UMeasureUnitComplexity.
- *
- * @param status Set if this is not a SINGLE unit or if another error occurs.
- * @return The SI prefix of this SINGLE unit, from UMeasureSIPrefix.
- * @draft ICU 67
- */
- UMeasureSIPrefix getSIPrefix(UErrorCode& status) const;
-
- /**
- * Creates a MeasureUnit which is this SINGLE unit augmented with the specified dimensionality
- * (power). For example, if dimensionality is 2, the unit will be squared.
- *
- * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will
- * occur. For more information, see UMeasureUnitComplexity.
- *
- * For the base dimensionless unit, withDimensionality does nothing.
- *
- * @param dimensionality The dimensionality (power).
- * @param status Set if this is not a SINGLE unit or if another error occurs.
- * @return A new SINGLE unit.
- * @draft ICU 67
- */
- MeasureUnit withDimensionality(int32_t dimensionality, UErrorCode& status) const;
-
- /**
- * Gets the dimensionality (power) of this MeasureUnit. For example, if the unit is square,
- * then 2 is returned.
- *
- * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will
- * occur. For more information, see UMeasureUnitComplexity.
- *
- * For the base dimensionless unit, getDimensionality returns 0.
- *
- * @param status Set if this is not a SINGLE unit or if another error occurs.
- * @return The dimensionality (power) of this simple unit.
- * @draft ICU 67
- */
- int32_t getDimensionality(UErrorCode& status) const;
-
- /**
- * Gets the reciprocal of this MeasureUnit, with the numerator and denominator flipped.
- *
- * For example, if the receiver is "meter-per-second", the unit "second-per-meter" is returned.
- *
- * NOTE: Only works on SINGLE and COMPOUND units. If this is a MIXED unit, an error will
- * occur. For more information, see UMeasureUnitComplexity.
- *
- * @param status Set if this is a MIXED unit or if another error occurs.
- * @return The reciprocal of the target unit.
- * @draft ICU 67
- */
- MeasureUnit reciprocal(UErrorCode& status) const;
-
- /**
- * Gets the product of this unit with another unit. This is a way to build units from
- * constituent parts.
- *
- * The numerator and denominator are preserved through this operation.
- *
- * For example, if the receiver is "kilowatt" and the argument is "hour-per-day", then the
- * unit "kilowatt-hour-per-day" is returned.
- *
- * NOTE: Only works on SINGLE and COMPOUND units. If either unit (receivee and argument) is a
- * MIXED unit, an error will occur. For more information, see UMeasureUnitComplexity.
- *
- * @param other The MeasureUnit to multiply with the target.
- * @param status Set if this or other is a MIXED unit or if another error occurs.
- * @return The product of the target unit with the provided unit.
- * @draft ICU 67
- */
- MeasureUnit product(const MeasureUnit& other, UErrorCode& status) const;
-#endif // U_HIDE_DRAFT_API
-
-#ifndef U_HIDE_INTERNAL_API
- /**
- * Gets the list of SINGLE units contained within a MIXED of COMPOUND unit.
- *
- * Examples:
- * - Given "meter-kilogram-per-second", three units will be returned: "meter",
- * "kilogram", and "per-second".
- * - Given "hour+minute+second", three units will be returned: "hour", "minute",
- * and "second".
- *
- * If this is a SINGLE unit, an array of length 1 will be returned.
- *
- * TODO(ICU-21021): Finalize this API and propose it as draft.
- *
- * @param outCount The number of elements in the return array.
- * @param status Set if an error occurs.
- * @return An array of single units, owned by the caller.
- * @internal ICU 67 Technical Preview
- */
- LocalArray<MeasureUnit> splitToSingleUnits(int32_t& outCount, UErrorCode& status) const;
-#endif // U_HIDE_INTERNAL_API
-
- /**
* getAvailable gets all of the available units.
* If there are too many units to fit into destCapacity then the
* error code is set to U_BUFFER_OVERFLOW_ERROR.
@@ -517,7 +517,7 @@ class U_I18N_API MeasureUnit: public UObject {
* <pre>
* . Base* polymorphic_pointer = createPolymorphicObject();
* . if (polymorphic_pointer->getDynamicClassID() ==
- * . Derived::getStaticClassID()) ...
+ * . Derived::getStaticClassID()) ...
* </pre>
* @return The class ID for all objects of this class.
* @stable ICU 53
@@ -565,8 +565,8 @@ class U_I18N_API MeasureUnit: public UObject {
* ICU use only.
* @internal
*/
- static MeasureUnit resolveUnitPerUnit(
- const MeasureUnit &unit, const MeasureUnit &perUnit, bool* isResolved);
+ static MeasureUnit resolveUnitPerUnit(
+ const MeasureUnit &unit, const MeasureUnit &perUnit, bool* isResolved);
#endif /* U_HIDE_INTERNAL_API */
// All code between the "Start generated createXXX methods" comment and
@@ -578,2780 +578,2780 @@ class U_I18N_API MeasureUnit: public UObject {
// Start generated createXXX methods
/**
- * Returns by pointer, unit of acceleration: g-force.
+ * Returns by pointer, unit of acceleration: g-force.
* Caller owns returned value and must free it.
- * Also see {@link #getGForce()}.
+ * Also see {@link #getGForce()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createGForce(UErrorCode &status);
/**
- * Returns by value, unit of acceleration: g-force.
- * Also see {@link #createGForce()}.
- * @stable ICU 64
- */
- static MeasureUnit getGForce();
-
- /**
- * Returns by pointer, unit of acceleration: meter-per-square-second.
+ * Returns by value, unit of acceleration: g-force.
+ * Also see {@link #createGForce()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getGForce();
+
+ /**
+ * Returns by pointer, unit of acceleration: meter-per-square-second.
* Caller owns returned value and must free it.
- * Also see {@link #getMeterPerSecondSquared()}.
+ * Also see {@link #getMeterPerSecondSquared()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMeterPerSecondSquared(UErrorCode &status);
/**
- * Returns by value, unit of acceleration: meter-per-square-second.
- * Also see {@link #createMeterPerSecondSquared()}.
- * @stable ICU 64
- */
- static MeasureUnit getMeterPerSecondSquared();
-
- /**
- * Returns by pointer, unit of angle: arc-minute.
+ * Returns by value, unit of acceleration: meter-per-square-second.
+ * Also see {@link #createMeterPerSecondSquared()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMeterPerSecondSquared();
+
+ /**
+ * Returns by pointer, unit of angle: arc-minute.
* Caller owns returned value and must free it.
- * Also see {@link #getArcMinute()}.
+ * Also see {@link #getArcMinute()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createArcMinute(UErrorCode &status);
/**
- * Returns by value, unit of angle: arc-minute.
- * Also see {@link #createArcMinute()}.
- * @stable ICU 64
- */
- static MeasureUnit getArcMinute();
-
- /**
- * Returns by pointer, unit of angle: arc-second.
+ * Returns by value, unit of angle: arc-minute.
+ * Also see {@link #createArcMinute()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getArcMinute();
+
+ /**
+ * Returns by pointer, unit of angle: arc-second.
* Caller owns returned value and must free it.
- * Also see {@link #getArcSecond()}.
+ * Also see {@link #getArcSecond()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createArcSecond(UErrorCode &status);
/**
- * Returns by value, unit of angle: arc-second.
- * Also see {@link #createArcSecond()}.
- * @stable ICU 64
- */
- static MeasureUnit getArcSecond();
-
- /**
- * Returns by pointer, unit of angle: degree.
+ * Returns by value, unit of angle: arc-second.
+ * Also see {@link #createArcSecond()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getArcSecond();
+
+ /**
+ * Returns by pointer, unit of angle: degree.
* Caller owns returned value and must free it.
- * Also see {@link #getDegree()}.
+ * Also see {@link #getDegree()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createDegree(UErrorCode &status);
/**
- * Returns by value, unit of angle: degree.
- * Also see {@link #createDegree()}.
- * @stable ICU 64
- */
- static MeasureUnit getDegree();
-
- /**
- * Returns by pointer, unit of angle: radian.
+ * Returns by value, unit of angle: degree.
+ * Also see {@link #createDegree()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getDegree();
+
+ /**
+ * Returns by pointer, unit of angle: radian.
* Caller owns returned value and must free it.
- * Also see {@link #getRadian()}.
+ * Also see {@link #getRadian()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createRadian(UErrorCode &status);
/**
- * Returns by value, unit of angle: radian.
- * Also see {@link #createRadian()}.
- * @stable ICU 64
- */
- static MeasureUnit getRadian();
-
- /**
- * Returns by pointer, unit of angle: revolution.
+ * Returns by value, unit of angle: radian.
+ * Also see {@link #createRadian()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getRadian();
+
+ /**
+ * Returns by pointer, unit of angle: revolution.
* Caller owns returned value and must free it.
- * Also see {@link #getRevolutionAngle()}.
+ * Also see {@link #getRevolutionAngle()}.
* @param status ICU error code.
* @stable ICU 56
*/
static MeasureUnit *createRevolutionAngle(UErrorCode &status);
/**
- * Returns by value, unit of angle: revolution.
- * Also see {@link #createRevolutionAngle()}.
- * @stable ICU 64
- */
- static MeasureUnit getRevolutionAngle();
-
- /**
- * Returns by pointer, unit of area: acre.
+ * Returns by value, unit of angle: revolution.
+ * Also see {@link #createRevolutionAngle()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getRevolutionAngle();
+
+ /**
+ * Returns by pointer, unit of area: acre.
* Caller owns returned value and must free it.
- * Also see {@link #getAcre()}.
+ * Also see {@link #getAcre()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createAcre(UErrorCode &status);
/**
- * Returns by value, unit of area: acre.
- * Also see {@link #createAcre()}.
- * @stable ICU 64
- */
- static MeasureUnit getAcre();
-
- /**
- * Returns by pointer, unit of area: dunam.
+ * Returns by value, unit of area: acre.
+ * Also see {@link #createAcre()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getAcre();
+
+ /**
+ * Returns by pointer, unit of area: dunam.
* Caller owns returned value and must free it.
- * Also see {@link #getDunam()}.
+ * Also see {@link #getDunam()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createDunam(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of area: dunam.
+ * Also see {@link #createDunam()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getDunam();
+
+ /**
+ * Returns by pointer, unit of area: hectare.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getHectare()}.
* @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createDunam(UErrorCode &status);
-
- /**
- * Returns by value, unit of area: dunam.
- * Also see {@link #createDunam()}.
- * @stable ICU 64
- */
- static MeasureUnit getDunam();
-
- /**
- * Returns by pointer, unit of area: hectare.
- * Caller owns returned value and must free it.
- * Also see {@link #getHectare()}.
- * @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createHectare(UErrorCode &status);
/**
- * Returns by value, unit of area: hectare.
- * Also see {@link #createHectare()}.
- * @stable ICU 64
- */
- static MeasureUnit getHectare();
-
- /**
- * Returns by pointer, unit of area: square-centimeter.
+ * Returns by value, unit of area: hectare.
+ * Also see {@link #createHectare()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getHectare();
+
+ /**
+ * Returns by pointer, unit of area: square-centimeter.
* Caller owns returned value and must free it.
- * Also see {@link #getSquareCentimeter()}.
+ * Also see {@link #getSquareCentimeter()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createSquareCentimeter(UErrorCode &status);
/**
- * Returns by value, unit of area: square-centimeter.
- * Also see {@link #createSquareCentimeter()}.
- * @stable ICU 64
- */
- static MeasureUnit getSquareCentimeter();
-
- /**
- * Returns by pointer, unit of area: square-foot.
+ * Returns by value, unit of area: square-centimeter.
+ * Also see {@link #createSquareCentimeter()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getSquareCentimeter();
+
+ /**
+ * Returns by pointer, unit of area: square-foot.
* Caller owns returned value and must free it.
- * Also see {@link #getSquareFoot()}.
+ * Also see {@link #getSquareFoot()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createSquareFoot(UErrorCode &status);
/**
- * Returns by value, unit of area: square-foot.
- * Also see {@link #createSquareFoot()}.
- * @stable ICU 64
- */
- static MeasureUnit getSquareFoot();
-
- /**
- * Returns by pointer, unit of area: square-inch.
+ * Returns by value, unit of area: square-foot.
+ * Also see {@link #createSquareFoot()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getSquareFoot();
+
+ /**
+ * Returns by pointer, unit of area: square-inch.
* Caller owns returned value and must free it.
- * Also see {@link #getSquareInch()}.
+ * Also see {@link #getSquareInch()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createSquareInch(UErrorCode &status);
/**
- * Returns by value, unit of area: square-inch.
- * Also see {@link #createSquareInch()}.
- * @stable ICU 64
- */
- static MeasureUnit getSquareInch();
-
- /**
- * Returns by pointer, unit of area: square-kilometer.
+ * Returns by value, unit of area: square-inch.
+ * Also see {@link #createSquareInch()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getSquareInch();
+
+ /**
+ * Returns by pointer, unit of area: square-kilometer.
* Caller owns returned value and must free it.
- * Also see {@link #getSquareKilometer()}.
+ * Also see {@link #getSquareKilometer()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createSquareKilometer(UErrorCode &status);
/**
- * Returns by value, unit of area: square-kilometer.
- * Also see {@link #createSquareKilometer()}.
- * @stable ICU 64
- */
- static MeasureUnit getSquareKilometer();
-
- /**
- * Returns by pointer, unit of area: square-meter.
+ * Returns by value, unit of area: square-kilometer.
+ * Also see {@link #createSquareKilometer()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getSquareKilometer();
+
+ /**
+ * Returns by pointer, unit of area: square-meter.
* Caller owns returned value and must free it.
- * Also see {@link #getSquareMeter()}.
+ * Also see {@link #getSquareMeter()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createSquareMeter(UErrorCode &status);
/**
- * Returns by value, unit of area: square-meter.
- * Also see {@link #createSquareMeter()}.
- * @stable ICU 64
- */
- static MeasureUnit getSquareMeter();
-
- /**
- * Returns by pointer, unit of area: square-mile.
+ * Returns by value, unit of area: square-meter.
+ * Also see {@link #createSquareMeter()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getSquareMeter();
+
+ /**
+ * Returns by pointer, unit of area: square-mile.
* Caller owns returned value and must free it.
- * Also see {@link #getSquareMile()}.
+ * Also see {@link #getSquareMile()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createSquareMile(UErrorCode &status);
/**
- * Returns by value, unit of area: square-mile.
- * Also see {@link #createSquareMile()}.
- * @stable ICU 64
- */
- static MeasureUnit getSquareMile();
-
- /**
- * Returns by pointer, unit of area: square-yard.
+ * Returns by value, unit of area: square-mile.
+ * Also see {@link #createSquareMile()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getSquareMile();
+
+ /**
+ * Returns by pointer, unit of area: square-yard.
* Caller owns returned value and must free it.
- * Also see {@link #getSquareYard()}.
+ * Also see {@link #getSquareYard()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createSquareYard(UErrorCode &status);
/**
- * Returns by value, unit of area: square-yard.
- * Also see {@link #createSquareYard()}.
- * @stable ICU 64
- */
- static MeasureUnit getSquareYard();
-
- /**
- * Returns by pointer, unit of concentr: karat.
+ * Returns by value, unit of area: square-yard.
+ * Also see {@link #createSquareYard()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getSquareYard();
+
+ /**
+ * Returns by pointer, unit of concentr: karat.
* Caller owns returned value and must free it.
- * Also see {@link #getKarat()}.
+ * Also see {@link #getKarat()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createKarat(UErrorCode &status);
/**
- * Returns by value, unit of concentr: karat.
- * Also see {@link #createKarat()}.
- * @stable ICU 64
- */
- static MeasureUnit getKarat();
-
- /**
- * Returns by pointer, unit of concentr: milligram-per-deciliter.
+ * Returns by value, unit of concentr: karat.
+ * Also see {@link #createKarat()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getKarat();
+
+ /**
+ * Returns by pointer, unit of concentr: milligram-per-deciliter.
* Caller owns returned value and must free it.
- * Also see {@link #getMilligramPerDeciliter()}.
+ * Also see {@link #getMilligramPerDeciliter()}.
* @param status ICU error code.
- * @stable ICU 57
+ * @stable ICU 57
*/
static MeasureUnit *createMilligramPerDeciliter(UErrorCode &status);
/**
- * Returns by value, unit of concentr: milligram-per-deciliter.
- * Also see {@link #createMilligramPerDeciliter()}.
- * @stable ICU 64
- */
- static MeasureUnit getMilligramPerDeciliter();
-
- /**
- * Returns by pointer, unit of concentr: millimole-per-liter.
+ * Returns by value, unit of concentr: milligram-per-deciliter.
+ * Also see {@link #createMilligramPerDeciliter()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMilligramPerDeciliter();
+
+ /**
+ * Returns by pointer, unit of concentr: millimole-per-liter.
* Caller owns returned value and must free it.
- * Also see {@link #getMillimolePerLiter()}.
+ * Also see {@link #getMillimolePerLiter()}.
* @param status ICU error code.
- * @stable ICU 57
+ * @stable ICU 57
*/
static MeasureUnit *createMillimolePerLiter(UErrorCode &status);
/**
- * Returns by value, unit of concentr: millimole-per-liter.
- * Also see {@link #createMillimolePerLiter()}.
- * @stable ICU 64
- */
- static MeasureUnit getMillimolePerLiter();
-
- /**
- * Returns by pointer, unit of concentr: mole.
+ * Returns by value, unit of concentr: millimole-per-liter.
+ * Also see {@link #createMillimolePerLiter()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMillimolePerLiter();
+
+ /**
+ * Returns by pointer, unit of concentr: mole.
* Caller owns returned value and must free it.
- * Also see {@link #getMole()}.
+ * Also see {@link #getMole()}.
* @param status ICU error code.
- * @stable ICU 64
+ * @stable ICU 64
*/
- static MeasureUnit *createMole(UErrorCode &status);
+ static MeasureUnit *createMole(UErrorCode &status);
/**
- * Returns by value, unit of concentr: mole.
- * Also see {@link #createMole()}.
- * @stable ICU 64
- */
- static MeasureUnit getMole();
-
- /**
- * Returns by pointer, unit of concentr: permillion.
+ * Returns by value, unit of concentr: mole.
+ * Also see {@link #createMole()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMole();
+
+ /**
+ * Returns by pointer, unit of concentr: permillion.
* Caller owns returned value and must free it.
- * Also see {@link #getPartPerMillion()}.
+ * Also see {@link #getPartPerMillion()}.
* @param status ICU error code.
- * @stable ICU 57
+ * @stable ICU 57
*/
- static MeasureUnit *createPartPerMillion(UErrorCode &status);
+ static MeasureUnit *createPartPerMillion(UErrorCode &status);
/**
- * Returns by value, unit of concentr: permillion.
- * Also see {@link #createPartPerMillion()}.
- * @stable ICU 64
- */
- static MeasureUnit getPartPerMillion();
-
- /**
- * Returns by pointer, unit of concentr: percent.
+ * Returns by value, unit of concentr: permillion.
+ * Also see {@link #createPartPerMillion()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getPartPerMillion();
+
+ /**
+ * Returns by pointer, unit of concentr: percent.
* Caller owns returned value and must free it.
- * Also see {@link #getPercent()}.
+ * Also see {@link #getPercent()}.
* @param status ICU error code.
- * @stable ICU 63
+ * @stable ICU 63
*/
- static MeasureUnit *createPercent(UErrorCode &status);
+ static MeasureUnit *createPercent(UErrorCode &status);
/**
- * Returns by value, unit of concentr: percent.
- * Also see {@link #createPercent()}.
- * @stable ICU 64
- */
- static MeasureUnit getPercent();
-
- /**
- * Returns by pointer, unit of concentr: permille.
+ * Returns by value, unit of concentr: percent.
+ * Also see {@link #createPercent()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getPercent();
+
+ /**
+ * Returns by pointer, unit of concentr: permille.
* Caller owns returned value and must free it.
- * Also see {@link #getPermille()}.
+ * Also see {@link #getPermille()}.
* @param status ICU error code.
- * @stable ICU 63
+ * @stable ICU 63
*/
- static MeasureUnit *createPermille(UErrorCode &status);
+ static MeasureUnit *createPermille(UErrorCode &status);
/**
- * Returns by value, unit of concentr: permille.
- * Also see {@link #createPermille()}.
- * @stable ICU 64
- */
- static MeasureUnit getPermille();
-
- /**
- * Returns by pointer, unit of concentr: permyriad.
+ * Returns by value, unit of concentr: permille.
+ * Also see {@link #createPermille()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getPermille();
+
+ /**
+ * Returns by pointer, unit of concentr: permyriad.
* Caller owns returned value and must free it.
- * Also see {@link #getPermyriad()}.
+ * Also see {@link #getPermyriad()}.
* @param status ICU error code.
- * @stable ICU 64
+ * @stable ICU 64
*/
- static MeasureUnit *createPermyriad(UErrorCode &status);
+ static MeasureUnit *createPermyriad(UErrorCode &status);
/**
- * Returns by value, unit of concentr: permyriad.
- * Also see {@link #createPermyriad()}.
- * @stable ICU 64
- */
- static MeasureUnit getPermyriad();
-
- /**
- * Returns by pointer, unit of consumption: liter-per-100-kilometer.
+ * Returns by value, unit of concentr: permyriad.
+ * Also see {@link #createPermyriad()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getPermyriad();
+
+ /**
+ * Returns by pointer, unit of consumption: liter-per-100-kilometer.
* Caller owns returned value and must free it.
- * Also see {@link #getLiterPer100Kilometers()}.
+ * Also see {@link #getLiterPer100Kilometers()}.
* @param status ICU error code.
- * @stable ICU 56
+ * @stable ICU 56
*/
- static MeasureUnit *createLiterPer100Kilometers(UErrorCode &status);
+ static MeasureUnit *createLiterPer100Kilometers(UErrorCode &status);
/**
- * Returns by value, unit of consumption: liter-per-100-kilometer.
- * Also see {@link #createLiterPer100Kilometers()}.
- * @stable ICU 64
- */
- static MeasureUnit getLiterPer100Kilometers();
-
- /**
- * Returns by pointer, unit of consumption: liter-per-kilometer.
+ * Returns by value, unit of consumption: liter-per-100-kilometer.
+ * Also see {@link #createLiterPer100Kilometers()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getLiterPer100Kilometers();
+
+ /**
+ * Returns by pointer, unit of consumption: liter-per-kilometer.
* Caller owns returned value and must free it.
- * Also see {@link #getLiterPerKilometer()}.
+ * Also see {@link #getLiterPerKilometer()}.
* @param status ICU error code.
- * @stable ICU 54
+ * @stable ICU 54
*/
- static MeasureUnit *createLiterPerKilometer(UErrorCode &status);
+ static MeasureUnit *createLiterPerKilometer(UErrorCode &status);
/**
- * Returns by value, unit of consumption: liter-per-kilometer.
- * Also see {@link #createLiterPerKilometer()}.
- * @stable ICU 64
- */
- static MeasureUnit getLiterPerKilometer();
-
- /**
- * Returns by pointer, unit of consumption: mile-per-gallon.
+ * Returns by value, unit of consumption: liter-per-kilometer.
+ * Also see {@link #createLiterPerKilometer()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getLiterPerKilometer();
+
+ /**
+ * Returns by pointer, unit of consumption: mile-per-gallon.
* Caller owns returned value and must free it.
- * Also see {@link #getMilePerGallon()}.
+ * Also see {@link #getMilePerGallon()}.
* @param status ICU error code.
- * @stable ICU 54
+ * @stable ICU 54
*/
- static MeasureUnit *createMilePerGallon(UErrorCode &status);
+ static MeasureUnit *createMilePerGallon(UErrorCode &status);
/**
- * Returns by value, unit of consumption: mile-per-gallon.
- * Also see {@link #createMilePerGallon()}.
- * @stable ICU 64
- */
- static MeasureUnit getMilePerGallon();
-
- /**
- * Returns by pointer, unit of consumption: mile-per-gallon-imperial.
+ * Returns by value, unit of consumption: mile-per-gallon.
+ * Also see {@link #createMilePerGallon()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMilePerGallon();
+
+ /**
+ * Returns by pointer, unit of consumption: mile-per-gallon-imperial.
* Caller owns returned value and must free it.
- * Also see {@link #getMilePerGallonImperial()}.
+ * Also see {@link #getMilePerGallonImperial()}.
* @param status ICU error code.
- * @stable ICU 57
+ * @stable ICU 57
*/
- static MeasureUnit *createMilePerGallonImperial(UErrorCode &status);
+ static MeasureUnit *createMilePerGallonImperial(UErrorCode &status);
/**
- * Returns by value, unit of consumption: mile-per-gallon-imperial.
- * Also see {@link #createMilePerGallonImperial()}.
- * @stable ICU 64
- */
- static MeasureUnit getMilePerGallonImperial();
-
- /**
- * Returns by pointer, unit of digital: bit.
+ * Returns by value, unit of consumption: mile-per-gallon-imperial.
+ * Also see {@link #createMilePerGallonImperial()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMilePerGallonImperial();
+
+ /**
+ * Returns by pointer, unit of digital: bit.
* Caller owns returned value and must free it.
- * Also see {@link #getBit()}.
+ * Also see {@link #getBit()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createBit(UErrorCode &status);
/**
- * Returns by value, unit of digital: bit.
- * Also see {@link #createBit()}.
- * @stable ICU 64
- */
- static MeasureUnit getBit();
-
- /**
- * Returns by pointer, unit of digital: byte.
+ * Returns by value, unit of digital: bit.
+ * Also see {@link #createBit()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getBit();
+
+ /**
+ * Returns by pointer, unit of digital: byte.
* Caller owns returned value and must free it.
- * Also see {@link #getByte()}.
+ * Also see {@link #getByte()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createByte(UErrorCode &status);
/**
- * Returns by value, unit of digital: byte.
- * Also see {@link #createByte()}.
- * @stable ICU 64
- */
- static MeasureUnit getByte();
-
- /**
- * Returns by pointer, unit of digital: gigabit.
+ * Returns by value, unit of digital: byte.
+ * Also see {@link #createByte()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getByte();
+
+ /**
+ * Returns by pointer, unit of digital: gigabit.
* Caller owns returned value and must free it.
- * Also see {@link #getGigabit()}.
+ * Also see {@link #getGigabit()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createGigabit(UErrorCode &status);
/**
- * Returns by value, unit of digital: gigabit.
- * Also see {@link #createGigabit()}.
- * @stable ICU 64
- */
- static MeasureUnit getGigabit();
-
- /**
- * Returns by pointer, unit of digital: gigabyte.
+ * Returns by value, unit of digital: gigabit.
+ * Also see {@link #createGigabit()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getGigabit();
+
+ /**
+ * Returns by pointer, unit of digital: gigabyte.
* Caller owns returned value and must free it.
- * Also see {@link #getGigabyte()}.
+ * Also see {@link #getGigabyte()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createGigabyte(UErrorCode &status);
/**
- * Returns by value, unit of digital: gigabyte.
- * Also see {@link #createGigabyte()}.
- * @stable ICU 64
- */
- static MeasureUnit getGigabyte();
-
- /**
- * Returns by pointer, unit of digital: kilobit.
+ * Returns by value, unit of digital: gigabyte.
+ * Also see {@link #createGigabyte()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getGigabyte();
+
+ /**
+ * Returns by pointer, unit of digital: kilobit.
* Caller owns returned value and must free it.
- * Also see {@link #getKilobit()}.
+ * Also see {@link #getKilobit()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createKilobit(UErrorCode &status);
/**
- * Returns by value, unit of digital: kilobit.
- * Also see {@link #createKilobit()}.
- * @stable ICU 64
- */
- static MeasureUnit getKilobit();
-
- /**
- * Returns by pointer, unit of digital: kilobyte.
+ * Returns by value, unit of digital: kilobit.
+ * Also see {@link #createKilobit()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getKilobit();
+
+ /**
+ * Returns by pointer, unit of digital: kilobyte.
* Caller owns returned value and must free it.
- * Also see {@link #getKilobyte()}.
+ * Also see {@link #getKilobyte()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createKilobyte(UErrorCode &status);
/**
- * Returns by value, unit of digital: kilobyte.
- * Also see {@link #createKilobyte()}.
- * @stable ICU 64
- */
- static MeasureUnit getKilobyte();
-
- /**
- * Returns by pointer, unit of digital: megabit.
+ * Returns by value, unit of digital: kilobyte.
+ * Also see {@link #createKilobyte()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getKilobyte();
+
+ /**
+ * Returns by pointer, unit of digital: megabit.
* Caller owns returned value and must free it.
- * Also see {@link #getMegabit()}.
+ * Also see {@link #getMegabit()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMegabit(UErrorCode &status);
/**
- * Returns by value, unit of digital: megabit.
- * Also see {@link #createMegabit()}.
- * @stable ICU 64
- */
- static MeasureUnit getMegabit();
-
- /**
- * Returns by pointer, unit of digital: megabyte.
+ * Returns by value, unit of digital: megabit.
+ * Also see {@link #createMegabit()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMegabit();
+
+ /**
+ * Returns by pointer, unit of digital: megabyte.
* Caller owns returned value and must free it.
- * Also see {@link #getMegabyte()}.
+ * Also see {@link #getMegabyte()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMegabyte(UErrorCode &status);
/**
- * Returns by value, unit of digital: megabyte.
- * Also see {@link #createMegabyte()}.
- * @stable ICU 64
- */
- static MeasureUnit getMegabyte();
-
- /**
- * Returns by pointer, unit of digital: petabyte.
+ * Returns by value, unit of digital: megabyte.
+ * Also see {@link #createMegabyte()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMegabyte();
+
+ /**
+ * Returns by pointer, unit of digital: petabyte.
* Caller owns returned value and must free it.
- * Also see {@link #getPetabyte()}.
+ * Also see {@link #getPetabyte()}.
+ * @param status ICU error code.
+ * @stable ICU 63
+ */
+ static MeasureUnit *createPetabyte(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of digital: petabyte.
+ * Also see {@link #createPetabyte()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getPetabyte();
+
+ /**
+ * Returns by pointer, unit of digital: terabit.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getTerabit()}.
* @param status ICU error code.
- * @stable ICU 63
- */
- static MeasureUnit *createPetabyte(UErrorCode &status);
-
- /**
- * Returns by value, unit of digital: petabyte.
- * Also see {@link #createPetabyte()}.
- * @stable ICU 64
- */
- static MeasureUnit getPetabyte();
-
- /**
- * Returns by pointer, unit of digital: terabit.
- * Caller owns returned value and must free it.
- * Also see {@link #getTerabit()}.
- * @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createTerabit(UErrorCode &status);
/**
- * Returns by value, unit of digital: terabit.
- * Also see {@link #createTerabit()}.
- * @stable ICU 64
- */
- static MeasureUnit getTerabit();
-
- /**
- * Returns by pointer, unit of digital: terabyte.
+ * Returns by value, unit of digital: terabit.
+ * Also see {@link #createTerabit()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getTerabit();
+
+ /**
+ * Returns by pointer, unit of digital: terabyte.
* Caller owns returned value and must free it.
- * Also see {@link #getTerabyte()}.
+ * Also see {@link #getTerabyte()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createTerabyte(UErrorCode &status);
/**
- * Returns by value, unit of digital: terabyte.
- * Also see {@link #createTerabyte()}.
- * @stable ICU 64
- */
- static MeasureUnit getTerabyte();
-
- /**
- * Returns by pointer, unit of duration: century.
+ * Returns by value, unit of digital: terabyte.
+ * Also see {@link #createTerabyte()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getTerabyte();
+
+ /**
+ * Returns by pointer, unit of duration: century.
* Caller owns returned value and must free it.
- * Also see {@link #getCentury()}.
+ * Also see {@link #getCentury()}.
* @param status ICU error code.
* @stable ICU 56
*/
static MeasureUnit *createCentury(UErrorCode &status);
/**
- * Returns by value, unit of duration: century.
- * Also see {@link #createCentury()}.
- * @stable ICU 64
- */
- static MeasureUnit getCentury();
-
- /**
- * Returns by pointer, unit of duration: day.
+ * Returns by value, unit of duration: century.
+ * Also see {@link #createCentury()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getCentury();
+
+ /**
+ * Returns by pointer, unit of duration: day.
* Caller owns returned value and must free it.
- * Also see {@link #getDay()}.
+ * Also see {@link #getDay()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createDay(UErrorCode &status);
/**
- * Returns by value, unit of duration: day.
- * Also see {@link #createDay()}.
- * @stable ICU 64
- */
- static MeasureUnit getDay();
-
- /**
- * Returns by pointer, unit of duration: day-person.
+ * Returns by value, unit of duration: day.
+ * Also see {@link #createDay()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getDay();
+
+ /**
+ * Returns by pointer, unit of duration: day-person.
* Caller owns returned value and must free it.
- * Also see {@link #getDayPerson()}.
+ * Also see {@link #getDayPerson()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createDayPerson(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of duration: day-person.
+ * Also see {@link #createDayPerson()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getDayPerson();
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of duration: decade.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getDecade()}.
+ * @param status ICU error code.
+ * @draft ICU 65
+ */
+ static MeasureUnit *createDecade(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of duration: decade.
+ * Also see {@link #createDecade()}.
+ * @draft ICU 65
+ */
+ static MeasureUnit getDecade();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of duration: hour.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getHour()}.
* @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createDayPerson(UErrorCode &status);
-
- /**
- * Returns by value, unit of duration: day-person.
- * Also see {@link #createDayPerson()}.
- * @stable ICU 64
- */
- static MeasureUnit getDayPerson();
-
-#ifndef U_HIDE_DRAFT_API
- /**
- * Returns by pointer, unit of duration: decade.
- * Caller owns returned value and must free it.
- * Also see {@link #getDecade()}.
- * @param status ICU error code.
- * @draft ICU 65
- */
- static MeasureUnit *createDecade(UErrorCode &status);
-
- /**
- * Returns by value, unit of duration: decade.
- * Also see {@link #createDecade()}.
- * @draft ICU 65
- */
- static MeasureUnit getDecade();
-#endif /* U_HIDE_DRAFT_API */
-
- /**
- * Returns by pointer, unit of duration: hour.
- * Caller owns returned value and must free it.
- * Also see {@link #getHour()}.
- * @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createHour(UErrorCode &status);
/**
- * Returns by value, unit of duration: hour.
- * Also see {@link #createHour()}.
- * @stable ICU 64
- */
- static MeasureUnit getHour();
-
- /**
- * Returns by pointer, unit of duration: microsecond.
+ * Returns by value, unit of duration: hour.
+ * Also see {@link #createHour()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getHour();
+
+ /**
+ * Returns by pointer, unit of duration: microsecond.
* Caller owns returned value and must free it.
- * Also see {@link #getMicrosecond()}.
+ * Also see {@link #getMicrosecond()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMicrosecond(UErrorCode &status);
/**
- * Returns by value, unit of duration: microsecond.
- * Also see {@link #createMicrosecond()}.
- * @stable ICU 64
- */
- static MeasureUnit getMicrosecond();
-
- /**
- * Returns by pointer, unit of duration: millisecond.
+ * Returns by value, unit of duration: microsecond.
+ * Also see {@link #createMicrosecond()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMicrosecond();
+
+ /**
+ * Returns by pointer, unit of duration: millisecond.
* Caller owns returned value and must free it.
- * Also see {@link #getMillisecond()}.
+ * Also see {@link #getMillisecond()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createMillisecond(UErrorCode &status);
/**
- * Returns by value, unit of duration: millisecond.
- * Also see {@link #createMillisecond()}.
- * @stable ICU 64
- */
- static MeasureUnit getMillisecond();
-
- /**
- * Returns by pointer, unit of duration: minute.
+ * Returns by value, unit of duration: millisecond.
+ * Also see {@link #createMillisecond()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMillisecond();
+
+ /**
+ * Returns by pointer, unit of duration: minute.
* Caller owns returned value and must free it.
- * Also see {@link #getMinute()}.
+ * Also see {@link #getMinute()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createMinute(UErrorCode &status);
/**
- * Returns by value, unit of duration: minute.
- * Also see {@link #createMinute()}.
- * @stable ICU 64
- */
- static MeasureUnit getMinute();
-
- /**
- * Returns by pointer, unit of duration: month.
+ * Returns by value, unit of duration: minute.
+ * Also see {@link #createMinute()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMinute();
+
+ /**
+ * Returns by pointer, unit of duration: month.
* Caller owns returned value and must free it.
- * Also see {@link #getMonth()}.
+ * Also see {@link #getMonth()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createMonth(UErrorCode &status);
/**
- * Returns by value, unit of duration: month.
- * Also see {@link #createMonth()}.
- * @stable ICU 64
- */
- static MeasureUnit getMonth();
-
- /**
- * Returns by pointer, unit of duration: month-person.
+ * Returns by value, unit of duration: month.
+ * Also see {@link #createMonth()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMonth();
+
+ /**
+ * Returns by pointer, unit of duration: month-person.
* Caller owns returned value and must free it.
- * Also see {@link #getMonthPerson()}.
+ * Also see {@link #getMonthPerson()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createMonthPerson(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of duration: month-person.
+ * Also see {@link #createMonthPerson()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMonthPerson();
+
+ /**
+ * Returns by pointer, unit of duration: nanosecond.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getNanosecond()}.
* @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createMonthPerson(UErrorCode &status);
-
- /**
- * Returns by value, unit of duration: month-person.
- * Also see {@link #createMonthPerson()}.
- * @stable ICU 64
- */
- static MeasureUnit getMonthPerson();
-
- /**
- * Returns by pointer, unit of duration: nanosecond.
- * Caller owns returned value and must free it.
- * Also see {@link #getNanosecond()}.
- * @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createNanosecond(UErrorCode &status);
/**
- * Returns by value, unit of duration: nanosecond.
- * Also see {@link #createNanosecond()}.
- * @stable ICU 64
- */
- static MeasureUnit getNanosecond();
-
- /**
- * Returns by pointer, unit of duration: second.
+ * Returns by value, unit of duration: nanosecond.
+ * Also see {@link #createNanosecond()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getNanosecond();
+
+ /**
+ * Returns by pointer, unit of duration: second.
* Caller owns returned value and must free it.
- * Also see {@link #getSecond()}.
+ * Also see {@link #getSecond()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createSecond(UErrorCode &status);
/**
- * Returns by value, unit of duration: second.
- * Also see {@link #createSecond()}.
- * @stable ICU 64
- */
- static MeasureUnit getSecond();
-
- /**
- * Returns by pointer, unit of duration: week.
+ * Returns by value, unit of duration: second.
+ * Also see {@link #createSecond()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getSecond();
+
+ /**
+ * Returns by pointer, unit of duration: week.
* Caller owns returned value and must free it.
- * Also see {@link #getWeek()}.
+ * Also see {@link #getWeek()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createWeek(UErrorCode &status);
/**
- * Returns by value, unit of duration: week.
- * Also see {@link #createWeek()}.
- * @stable ICU 64
- */
- static MeasureUnit getWeek();
-
- /**
- * Returns by pointer, unit of duration: week-person.
+ * Returns by value, unit of duration: week.
+ * Also see {@link #createWeek()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getWeek();
+
+ /**
+ * Returns by pointer, unit of duration: week-person.
* Caller owns returned value and must free it.
- * Also see {@link #getWeekPerson()}.
+ * Also see {@link #getWeekPerson()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createWeekPerson(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of duration: week-person.
+ * Also see {@link #createWeekPerson()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getWeekPerson();
+
+ /**
+ * Returns by pointer, unit of duration: year.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getYear()}.
* @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createWeekPerson(UErrorCode &status);
-
- /**
- * Returns by value, unit of duration: week-person.
- * Also see {@link #createWeekPerson()}.
- * @stable ICU 64
- */
- static MeasureUnit getWeekPerson();
-
- /**
- * Returns by pointer, unit of duration: year.
- * Caller owns returned value and must free it.
- * Also see {@link #getYear()}.
- * @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createYear(UErrorCode &status);
/**
- * Returns by value, unit of duration: year.
- * Also see {@link #createYear()}.
- * @stable ICU 64
- */
- static MeasureUnit getYear();
-
- /**
- * Returns by pointer, unit of duration: year-person.
+ * Returns by value, unit of duration: year.
+ * Also see {@link #createYear()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getYear();
+
+ /**
+ * Returns by pointer, unit of duration: year-person.
* Caller owns returned value and must free it.
- * Also see {@link #getYearPerson()}.
+ * Also see {@link #getYearPerson()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createYearPerson(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of duration: year-person.
+ * Also see {@link #createYearPerson()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getYearPerson();
+
+ /**
+ * Returns by pointer, unit of electric: ampere.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getAmpere()}.
* @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createYearPerson(UErrorCode &status);
-
- /**
- * Returns by value, unit of duration: year-person.
- * Also see {@link #createYearPerson()}.
- * @stable ICU 64
- */
- static MeasureUnit getYearPerson();
-
- /**
- * Returns by pointer, unit of electric: ampere.
- * Caller owns returned value and must free it.
- * Also see {@link #getAmpere()}.
- * @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createAmpere(UErrorCode &status);
/**
- * Returns by value, unit of electric: ampere.
- * Also see {@link #createAmpere()}.
- * @stable ICU 64
- */
- static MeasureUnit getAmpere();
-
- /**
- * Returns by pointer, unit of electric: milliampere.
+ * Returns by value, unit of electric: ampere.
+ * Also see {@link #createAmpere()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getAmpere();
+
+ /**
+ * Returns by pointer, unit of electric: milliampere.
* Caller owns returned value and must free it.
- * Also see {@link #getMilliampere()}.
+ * Also see {@link #getMilliampere()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMilliampere(UErrorCode &status);
/**
- * Returns by value, unit of electric: milliampere.
- * Also see {@link #createMilliampere()}.
- * @stable ICU 64
- */
- static MeasureUnit getMilliampere();
-
- /**
- * Returns by pointer, unit of electric: ohm.
+ * Returns by value, unit of electric: milliampere.
+ * Also see {@link #createMilliampere()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMilliampere();
+
+ /**
+ * Returns by pointer, unit of electric: ohm.
* Caller owns returned value and must free it.
- * Also see {@link #getOhm()}.
+ * Also see {@link #getOhm()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createOhm(UErrorCode &status);
/**
- * Returns by value, unit of electric: ohm.
- * Also see {@link #createOhm()}.
- * @stable ICU 64
- */
- static MeasureUnit getOhm();
-
- /**
- * Returns by pointer, unit of electric: volt.
+ * Returns by value, unit of electric: ohm.
+ * Also see {@link #createOhm()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getOhm();
+
+ /**
+ * Returns by pointer, unit of electric: volt.
* Caller owns returned value and must free it.
- * Also see {@link #getVolt()}.
+ * Also see {@link #getVolt()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createVolt(UErrorCode &status);
/**
- * Returns by value, unit of electric: volt.
- * Also see {@link #createVolt()}.
- * @stable ICU 64
- */
- static MeasureUnit getVolt();
-
- /**
- * Returns by pointer, unit of energy: british-thermal-unit.
+ * Returns by value, unit of electric: volt.
+ * Also see {@link #createVolt()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getVolt();
+
+ /**
+ * Returns by pointer, unit of energy: british-thermal-unit.
* Caller owns returned value and must free it.
- * Also see {@link #getBritishThermalUnit()}.
+ * Also see {@link #getBritishThermalUnit()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createBritishThermalUnit(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of energy: british-thermal-unit.
+ * Also see {@link #createBritishThermalUnit()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getBritishThermalUnit();
+
+ /**
+ * Returns by pointer, unit of energy: calorie.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getCalorie()}.
* @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createBritishThermalUnit(UErrorCode &status);
-
- /**
- * Returns by value, unit of energy: british-thermal-unit.
- * Also see {@link #createBritishThermalUnit()}.
- * @stable ICU 64
- */
- static MeasureUnit getBritishThermalUnit();
-
- /**
- * Returns by pointer, unit of energy: calorie.
- * Caller owns returned value and must free it.
- * Also see {@link #getCalorie()}.
- * @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createCalorie(UErrorCode &status);
/**
- * Returns by value, unit of energy: calorie.
- * Also see {@link #createCalorie()}.
- * @stable ICU 64
- */
- static MeasureUnit getCalorie();
-
- /**
- * Returns by pointer, unit of energy: electronvolt.
+ * Returns by value, unit of energy: calorie.
+ * Also see {@link #createCalorie()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getCalorie();
+
+ /**
+ * Returns by pointer, unit of energy: electronvolt.
* Caller owns returned value and must free it.
- * Also see {@link #getElectronvolt()}.
+ * Also see {@link #getElectronvolt()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createElectronvolt(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of energy: electronvolt.
+ * Also see {@link #createElectronvolt()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getElectronvolt();
+
+ /**
+ * Returns by pointer, unit of energy: foodcalorie.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getFoodcalorie()}.
* @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createElectronvolt(UErrorCode &status);
-
- /**
- * Returns by value, unit of energy: electronvolt.
- * Also see {@link #createElectronvolt()}.
- * @stable ICU 64
- */
- static MeasureUnit getElectronvolt();
-
- /**
- * Returns by pointer, unit of energy: foodcalorie.
- * Caller owns returned value and must free it.
- * Also see {@link #getFoodcalorie()}.
- * @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createFoodcalorie(UErrorCode &status);
/**
- * Returns by value, unit of energy: foodcalorie.
- * Also see {@link #createFoodcalorie()}.
- * @stable ICU 64
- */
- static MeasureUnit getFoodcalorie();
-
- /**
- * Returns by pointer, unit of energy: joule.
+ * Returns by value, unit of energy: foodcalorie.
+ * Also see {@link #createFoodcalorie()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getFoodcalorie();
+
+ /**
+ * Returns by pointer, unit of energy: joule.
* Caller owns returned value and must free it.
- * Also see {@link #getJoule()}.
+ * Also see {@link #getJoule()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createJoule(UErrorCode &status);
/**
- * Returns by value, unit of energy: joule.
- * Also see {@link #createJoule()}.
- * @stable ICU 64
- */
- static MeasureUnit getJoule();
-
- /**
- * Returns by pointer, unit of energy: kilocalorie.
+ * Returns by value, unit of energy: joule.
+ * Also see {@link #createJoule()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getJoule();
+
+ /**
+ * Returns by pointer, unit of energy: kilocalorie.
* Caller owns returned value and must free it.
- * Also see {@link #getKilocalorie()}.
+ * Also see {@link #getKilocalorie()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createKilocalorie(UErrorCode &status);
/**
- * Returns by value, unit of energy: kilocalorie.
- * Also see {@link #createKilocalorie()}.
- * @stable ICU 64
- */
- static MeasureUnit getKilocalorie();
-
- /**
- * Returns by pointer, unit of energy: kilojoule.
+ * Returns by value, unit of energy: kilocalorie.
+ * Also see {@link #createKilocalorie()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getKilocalorie();
+
+ /**
+ * Returns by pointer, unit of energy: kilojoule.
* Caller owns returned value and must free it.
- * Also see {@link #getKilojoule()}.
+ * Also see {@link #getKilojoule()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createKilojoule(UErrorCode &status);
/**
- * Returns by value, unit of energy: kilojoule.
- * Also see {@link #createKilojoule()}.
- * @stable ICU 64
- */
- static MeasureUnit getKilojoule();
-
- /**
- * Returns by pointer, unit of energy: kilowatt-hour.
+ * Returns by value, unit of energy: kilojoule.
+ * Also see {@link #createKilojoule()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getKilojoule();
+
+ /**
+ * Returns by pointer, unit of energy: kilowatt-hour.
* Caller owns returned value and must free it.
- * Also see {@link #getKilowattHour()}.
+ * Also see {@link #getKilowattHour()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createKilowattHour(UErrorCode &status);
/**
- * Returns by value, unit of energy: kilowatt-hour.
- * Also see {@link #createKilowattHour()}.
- * @stable ICU 64
- */
- static MeasureUnit getKilowattHour();
-
-#ifndef U_HIDE_DRAFT_API
- /**
- * Returns by pointer, unit of energy: therm-us.
+ * Returns by value, unit of energy: kilowatt-hour.
+ * Also see {@link #createKilowattHour()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getKilowattHour();
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of energy: therm-us.
* Caller owns returned value and must free it.
- * Also see {@link #getThermUs()}.
+ * Also see {@link #getThermUs()}.
+ * @param status ICU error code.
+ * @draft ICU 65
+ */
+ static MeasureUnit *createThermUs(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of energy: therm-us.
+ * Also see {@link #createThermUs()}.
+ * @draft ICU 65
+ */
+ static MeasureUnit getThermUs();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of force: newton.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getNewton()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createNewton(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of force: newton.
+ * Also see {@link #createNewton()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getNewton();
+
+ /**
+ * Returns by pointer, unit of force: pound-force.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getPoundForce()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createPoundForce(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of force: pound-force.
+ * Also see {@link #createPoundForce()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getPoundForce();
+
+ /**
+ * Returns by pointer, unit of frequency: gigahertz.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getGigahertz()}.
* @param status ICU error code.
- * @draft ICU 65
- */
- static MeasureUnit *createThermUs(UErrorCode &status);
-
- /**
- * Returns by value, unit of energy: therm-us.
- * Also see {@link #createThermUs()}.
- * @draft ICU 65
- */
- static MeasureUnit getThermUs();
-#endif /* U_HIDE_DRAFT_API */
-
- /**
- * Returns by pointer, unit of force: newton.
- * Caller owns returned value and must free it.
- * Also see {@link #getNewton()}.
- * @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createNewton(UErrorCode &status);
-
- /**
- * Returns by value, unit of force: newton.
- * Also see {@link #createNewton()}.
- * @stable ICU 64
- */
- static MeasureUnit getNewton();
-
- /**
- * Returns by pointer, unit of force: pound-force.
- * Caller owns returned value and must free it.
- * Also see {@link #getPoundForce()}.
- * @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createPoundForce(UErrorCode &status);
-
- /**
- * Returns by value, unit of force: pound-force.
- * Also see {@link #createPoundForce()}.
- * @stable ICU 64
- */
- static MeasureUnit getPoundForce();
-
- /**
- * Returns by pointer, unit of frequency: gigahertz.
- * Caller owns returned value and must free it.
- * Also see {@link #getGigahertz()}.
- * @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createGigahertz(UErrorCode &status);
/**
- * Returns by value, unit of frequency: gigahertz.
- * Also see {@link #createGigahertz()}.
- * @stable ICU 64
- */
- static MeasureUnit getGigahertz();
-
- /**
- * Returns by pointer, unit of frequency: hertz.
+ * Returns by value, unit of frequency: gigahertz.
+ * Also see {@link #createGigahertz()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getGigahertz();
+
+ /**
+ * Returns by pointer, unit of frequency: hertz.
* Caller owns returned value and must free it.
- * Also see {@link #getHertz()}.
+ * Also see {@link #getHertz()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createHertz(UErrorCode &status);
/**
- * Returns by value, unit of frequency: hertz.
- * Also see {@link #createHertz()}.
- * @stable ICU 64
- */
- static MeasureUnit getHertz();
-
- /**
- * Returns by pointer, unit of frequency: kilohertz.
+ * Returns by value, unit of frequency: hertz.
+ * Also see {@link #createHertz()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getHertz();
+
+ /**
+ * Returns by pointer, unit of frequency: kilohertz.
* Caller owns returned value and must free it.
- * Also see {@link #getKilohertz()}.
+ * Also see {@link #getKilohertz()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createKilohertz(UErrorCode &status);
/**
- * Returns by value, unit of frequency: kilohertz.
- * Also see {@link #createKilohertz()}.
- * @stable ICU 64
- */
- static MeasureUnit getKilohertz();
-
- /**
- * Returns by pointer, unit of frequency: megahertz.
+ * Returns by value, unit of frequency: kilohertz.
+ * Also see {@link #createKilohertz()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getKilohertz();
+
+ /**
+ * Returns by pointer, unit of frequency: megahertz.
* Caller owns returned value and must free it.
- * Also see {@link #getMegahertz()}.
+ * Also see {@link #getMegahertz()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMegahertz(UErrorCode &status);
/**
- * Returns by value, unit of frequency: megahertz.
- * Also see {@link #createMegahertz()}.
- * @stable ICU 64
- */
- static MeasureUnit getMegahertz();
-
-#ifndef U_HIDE_DRAFT_API
- /**
- * Returns by pointer, unit of graphics: dot-per-centimeter.
+ * Returns by value, unit of frequency: megahertz.
+ * Also see {@link #createMegahertz()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMegahertz();
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of graphics: dot-per-centimeter.
* Caller owns returned value and must free it.
- * Also see {@link #getDotPerCentimeter()}.
+ * Also see {@link #getDotPerCentimeter()}.
+ * @param status ICU error code.
+ * @draft ICU 65
+ */
+ static MeasureUnit *createDotPerCentimeter(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of graphics: dot-per-centimeter.
+ * Also see {@link #createDotPerCentimeter()}.
+ * @draft ICU 65
+ */
+ static MeasureUnit getDotPerCentimeter();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of graphics: dot-per-inch.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getDotPerInch()}.
+ * @param status ICU error code.
+ * @draft ICU 65
+ */
+ static MeasureUnit *createDotPerInch(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of graphics: dot-per-inch.
+ * Also see {@link #createDotPerInch()}.
+ * @draft ICU 65
+ */
+ static MeasureUnit getDotPerInch();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of graphics: em.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getEm()}.
+ * @param status ICU error code.
+ * @draft ICU 65
+ */
+ static MeasureUnit *createEm(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of graphics: em.
+ * Also see {@link #createEm()}.
+ * @draft ICU 65
+ */
+ static MeasureUnit getEm();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of graphics: megapixel.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getMegapixel()}.
+ * @param status ICU error code.
+ * @draft ICU 65
+ */
+ static MeasureUnit *createMegapixel(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of graphics: megapixel.
+ * Also see {@link #createMegapixel()}.
+ * @draft ICU 65
+ */
+ static MeasureUnit getMegapixel();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of graphics: pixel.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getPixel()}.
+ * @param status ICU error code.
+ * @draft ICU 65
+ */
+ static MeasureUnit *createPixel(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of graphics: pixel.
+ * Also see {@link #createPixel()}.
+ * @draft ICU 65
+ */
+ static MeasureUnit getPixel();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of graphics: pixel-per-centimeter.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getPixelPerCentimeter()}.
+ * @param status ICU error code.
+ * @draft ICU 65
+ */
+ static MeasureUnit *createPixelPerCentimeter(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of graphics: pixel-per-centimeter.
+ * Also see {@link #createPixelPerCentimeter()}.
+ * @draft ICU 65
+ */
+ static MeasureUnit getPixelPerCentimeter();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of graphics: pixel-per-inch.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getPixelPerInch()}.
+ * @param status ICU error code.
+ * @draft ICU 65
+ */
+ static MeasureUnit *createPixelPerInch(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of graphics: pixel-per-inch.
+ * Also see {@link #createPixelPerInch()}.
+ * @draft ICU 65
+ */
+ static MeasureUnit getPixelPerInch();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of length: astronomical-unit.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getAstronomicalUnit()}.
* @param status ICU error code.
- * @draft ICU 65
- */
- static MeasureUnit *createDotPerCentimeter(UErrorCode &status);
-
- /**
- * Returns by value, unit of graphics: dot-per-centimeter.
- * Also see {@link #createDotPerCentimeter()}.
- * @draft ICU 65
- */
- static MeasureUnit getDotPerCentimeter();
-#endif /* U_HIDE_DRAFT_API */
-
-#ifndef U_HIDE_DRAFT_API
- /**
- * Returns by pointer, unit of graphics: dot-per-inch.
- * Caller owns returned value and must free it.
- * Also see {@link #getDotPerInch()}.
- * @param status ICU error code.
- * @draft ICU 65
- */
- static MeasureUnit *createDotPerInch(UErrorCode &status);
-
- /**
- * Returns by value, unit of graphics: dot-per-inch.
- * Also see {@link #createDotPerInch()}.
- * @draft ICU 65
- */
- static MeasureUnit getDotPerInch();
-#endif /* U_HIDE_DRAFT_API */
-
-#ifndef U_HIDE_DRAFT_API
- /**
- * Returns by pointer, unit of graphics: em.
- * Caller owns returned value and must free it.
- * Also see {@link #getEm()}.
- * @param status ICU error code.
- * @draft ICU 65
- */
- static MeasureUnit *createEm(UErrorCode &status);
-
- /**
- * Returns by value, unit of graphics: em.
- * Also see {@link #createEm()}.
- * @draft ICU 65
- */
- static MeasureUnit getEm();
-#endif /* U_HIDE_DRAFT_API */
-
-#ifndef U_HIDE_DRAFT_API
- /**
- * Returns by pointer, unit of graphics: megapixel.
- * Caller owns returned value and must free it.
- * Also see {@link #getMegapixel()}.
- * @param status ICU error code.
- * @draft ICU 65
- */
- static MeasureUnit *createMegapixel(UErrorCode &status);
-
- /**
- * Returns by value, unit of graphics: megapixel.
- * Also see {@link #createMegapixel()}.
- * @draft ICU 65
- */
- static MeasureUnit getMegapixel();
-#endif /* U_HIDE_DRAFT_API */
-
-#ifndef U_HIDE_DRAFT_API
- /**
- * Returns by pointer, unit of graphics: pixel.
- * Caller owns returned value and must free it.
- * Also see {@link #getPixel()}.
- * @param status ICU error code.
- * @draft ICU 65
- */
- static MeasureUnit *createPixel(UErrorCode &status);
-
- /**
- * Returns by value, unit of graphics: pixel.
- * Also see {@link #createPixel()}.
- * @draft ICU 65
- */
- static MeasureUnit getPixel();
-#endif /* U_HIDE_DRAFT_API */
-
-#ifndef U_HIDE_DRAFT_API
- /**
- * Returns by pointer, unit of graphics: pixel-per-centimeter.
- * Caller owns returned value and must free it.
- * Also see {@link #getPixelPerCentimeter()}.
- * @param status ICU error code.
- * @draft ICU 65
- */
- static MeasureUnit *createPixelPerCentimeter(UErrorCode &status);
-
- /**
- * Returns by value, unit of graphics: pixel-per-centimeter.
- * Also see {@link #createPixelPerCentimeter()}.
- * @draft ICU 65
- */
- static MeasureUnit getPixelPerCentimeter();
-#endif /* U_HIDE_DRAFT_API */
-
-#ifndef U_HIDE_DRAFT_API
- /**
- * Returns by pointer, unit of graphics: pixel-per-inch.
- * Caller owns returned value and must free it.
- * Also see {@link #getPixelPerInch()}.
- * @param status ICU error code.
- * @draft ICU 65
- */
- static MeasureUnit *createPixelPerInch(UErrorCode &status);
-
- /**
- * Returns by value, unit of graphics: pixel-per-inch.
- * Also see {@link #createPixelPerInch()}.
- * @draft ICU 65
- */
- static MeasureUnit getPixelPerInch();
-#endif /* U_HIDE_DRAFT_API */
-
- /**
- * Returns by pointer, unit of length: astronomical-unit.
- * Caller owns returned value and must free it.
- * Also see {@link #getAstronomicalUnit()}.
- * @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createAstronomicalUnit(UErrorCode &status);
/**
- * Returns by value, unit of length: astronomical-unit.
- * Also see {@link #createAstronomicalUnit()}.
- * @stable ICU 64
- */
- static MeasureUnit getAstronomicalUnit();
-
- /**
- * Returns by pointer, unit of length: centimeter.
+ * Returns by value, unit of length: astronomical-unit.
+ * Also see {@link #createAstronomicalUnit()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getAstronomicalUnit();
+
+ /**
+ * Returns by pointer, unit of length: centimeter.
* Caller owns returned value and must free it.
- * Also see {@link #getCentimeter()}.
+ * Also see {@link #getCentimeter()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createCentimeter(UErrorCode &status);
/**
- * Returns by value, unit of length: centimeter.
- * Also see {@link #createCentimeter()}.
- * @stable ICU 64
- */
- static MeasureUnit getCentimeter();
-
- /**
- * Returns by pointer, unit of length: decimeter.
+ * Returns by value, unit of length: centimeter.
+ * Also see {@link #createCentimeter()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getCentimeter();
+
+ /**
+ * Returns by pointer, unit of length: decimeter.
* Caller owns returned value and must free it.
- * Also see {@link #getDecimeter()}.
+ * Also see {@link #getDecimeter()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createDecimeter(UErrorCode &status);
/**
- * Returns by value, unit of length: decimeter.
- * Also see {@link #createDecimeter()}.
- * @stable ICU 64
- */
- static MeasureUnit getDecimeter();
-
- /**
- * Returns by pointer, unit of length: fathom.
+ * Returns by value, unit of length: decimeter.
+ * Also see {@link #createDecimeter()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getDecimeter();
+
+ /**
+ * Returns by pointer, unit of length: fathom.
* Caller owns returned value and must free it.
- * Also see {@link #getFathom()}.
+ * Also see {@link #getFathom()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createFathom(UErrorCode &status);
/**
- * Returns by value, unit of length: fathom.
- * Also see {@link #createFathom()}.
- * @stable ICU 64
- */
- static MeasureUnit getFathom();
-
- /**
- * Returns by pointer, unit of length: foot.
+ * Returns by value, unit of length: fathom.
+ * Also see {@link #createFathom()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getFathom();
+
+ /**
+ * Returns by pointer, unit of length: foot.
* Caller owns returned value and must free it.
- * Also see {@link #getFoot()}.
+ * Also see {@link #getFoot()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createFoot(UErrorCode &status);
/**
- * Returns by value, unit of length: foot.
- * Also see {@link #createFoot()}.
- * @stable ICU 64
- */
- static MeasureUnit getFoot();
-
- /**
- * Returns by pointer, unit of length: furlong.
+ * Returns by value, unit of length: foot.
+ * Also see {@link #createFoot()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getFoot();
+
+ /**
+ * Returns by pointer, unit of length: furlong.
* Caller owns returned value and must free it.
- * Also see {@link #getFurlong()}.
+ * Also see {@link #getFurlong()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createFurlong(UErrorCode &status);
/**
- * Returns by value, unit of length: furlong.
- * Also see {@link #createFurlong()}.
- * @stable ICU 64
- */
- static MeasureUnit getFurlong();
-
- /**
- * Returns by pointer, unit of length: inch.
+ * Returns by value, unit of length: furlong.
+ * Also see {@link #createFurlong()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getFurlong();
+
+ /**
+ * Returns by pointer, unit of length: inch.
* Caller owns returned value and must free it.
- * Also see {@link #getInch()}.
+ * Also see {@link #getInch()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createInch(UErrorCode &status);
/**
- * Returns by value, unit of length: inch.
- * Also see {@link #createInch()}.
- * @stable ICU 64
- */
- static MeasureUnit getInch();
-
- /**
- * Returns by pointer, unit of length: kilometer.
+ * Returns by value, unit of length: inch.
+ * Also see {@link #createInch()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getInch();
+
+ /**
+ * Returns by pointer, unit of length: kilometer.
* Caller owns returned value and must free it.
- * Also see {@link #getKilometer()}.
+ * Also see {@link #getKilometer()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createKilometer(UErrorCode &status);
/**
- * Returns by value, unit of length: kilometer.
- * Also see {@link #createKilometer()}.
- * @stable ICU 64
- */
- static MeasureUnit getKilometer();
-
- /**
- * Returns by pointer, unit of length: light-year.
+ * Returns by value, unit of length: kilometer.
+ * Also see {@link #createKilometer()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getKilometer();
+
+ /**
+ * Returns by pointer, unit of length: light-year.
* Caller owns returned value and must free it.
- * Also see {@link #getLightYear()}.
+ * Also see {@link #getLightYear()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createLightYear(UErrorCode &status);
/**
- * Returns by value, unit of length: light-year.
- * Also see {@link #createLightYear()}.
- * @stable ICU 64
- */
- static MeasureUnit getLightYear();
-
- /**
- * Returns by pointer, unit of length: meter.
+ * Returns by value, unit of length: light-year.
+ * Also see {@link #createLightYear()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getLightYear();
+
+ /**
+ * Returns by pointer, unit of length: meter.
* Caller owns returned value and must free it.
- * Also see {@link #getMeter()}.
+ * Also see {@link #getMeter()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createMeter(UErrorCode &status);
/**
- * Returns by value, unit of length: meter.
- * Also see {@link #createMeter()}.
- * @stable ICU 64
- */
- static MeasureUnit getMeter();
-
- /**
- * Returns by pointer, unit of length: micrometer.
+ * Returns by value, unit of length: meter.
+ * Also see {@link #createMeter()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMeter();
+
+ /**
+ * Returns by pointer, unit of length: micrometer.
* Caller owns returned value and must free it.
- * Also see {@link #getMicrometer()}.
+ * Also see {@link #getMicrometer()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMicrometer(UErrorCode &status);
/**
- * Returns by value, unit of length: micrometer.
- * Also see {@link #createMicrometer()}.
- * @stable ICU 64
- */
- static MeasureUnit getMicrometer();
-
- /**
- * Returns by pointer, unit of length: mile.
+ * Returns by value, unit of length: micrometer.
+ * Also see {@link #createMicrometer()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMicrometer();
+
+ /**
+ * Returns by pointer, unit of length: mile.
* Caller owns returned value and must free it.
- * Also see {@link #getMile()}.
+ * Also see {@link #getMile()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createMile(UErrorCode &status);
/**
- * Returns by value, unit of length: mile.
- * Also see {@link #createMile()}.
- * @stable ICU 64
- */
- static MeasureUnit getMile();
-
- /**
- * Returns by pointer, unit of length: mile-scandinavian.
+ * Returns by value, unit of length: mile.
+ * Also see {@link #createMile()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMile();
+
+ /**
+ * Returns by pointer, unit of length: mile-scandinavian.
* Caller owns returned value and must free it.
- * Also see {@link #getMileScandinavian()}.
+ * Also see {@link #getMileScandinavian()}.
* @param status ICU error code.
* @stable ICU 56
*/
static MeasureUnit *createMileScandinavian(UErrorCode &status);
/**
- * Returns by value, unit of length: mile-scandinavian.
- * Also see {@link #createMileScandinavian()}.
- * @stable ICU 64
- */
- static MeasureUnit getMileScandinavian();
-
- /**
- * Returns by pointer, unit of length: millimeter.
+ * Returns by value, unit of length: mile-scandinavian.
+ * Also see {@link #createMileScandinavian()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMileScandinavian();
+
+ /**
+ * Returns by pointer, unit of length: millimeter.
* Caller owns returned value and must free it.
- * Also see {@link #getMillimeter()}.
+ * Also see {@link #getMillimeter()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createMillimeter(UErrorCode &status);
/**
- * Returns by value, unit of length: millimeter.
- * Also see {@link #createMillimeter()}.
- * @stable ICU 64
- */
- static MeasureUnit getMillimeter();
-
- /**
- * Returns by pointer, unit of length: nanometer.
+ * Returns by value, unit of length: millimeter.
+ * Also see {@link #createMillimeter()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMillimeter();
+
+ /**
+ * Returns by pointer, unit of length: nanometer.
* Caller owns returned value and must free it.
- * Also see {@link #getNanometer()}.
+ * Also see {@link #getNanometer()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createNanometer(UErrorCode &status);
/**
- * Returns by value, unit of length: nanometer.
- * Also see {@link #createNanometer()}.
- * @stable ICU 64
- */
- static MeasureUnit getNanometer();
-
- /**
- * Returns by pointer, unit of length: nautical-mile.
+ * Returns by value, unit of length: nanometer.
+ * Also see {@link #createNanometer()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getNanometer();
+
+ /**
+ * Returns by pointer, unit of length: nautical-mile.
* Caller owns returned value and must free it.
- * Also see {@link #getNauticalMile()}.
+ * Also see {@link #getNauticalMile()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createNauticalMile(UErrorCode &status);
/**
- * Returns by value, unit of length: nautical-mile.
- * Also see {@link #createNauticalMile()}.
- * @stable ICU 64
- */
- static MeasureUnit getNauticalMile();
-
- /**
- * Returns by pointer, unit of length: parsec.
+ * Returns by value, unit of length: nautical-mile.
+ * Also see {@link #createNauticalMile()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getNauticalMile();
+
+ /**
+ * Returns by pointer, unit of length: parsec.
* Caller owns returned value and must free it.
- * Also see {@link #getParsec()}.
+ * Also see {@link #getParsec()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createParsec(UErrorCode &status);
/**
- * Returns by value, unit of length: parsec.
- * Also see {@link #createParsec()}.
- * @stable ICU 64
- */
- static MeasureUnit getParsec();
-
- /**
- * Returns by pointer, unit of length: picometer.
+ * Returns by value, unit of length: parsec.
+ * Also see {@link #createParsec()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getParsec();
+
+ /**
+ * Returns by pointer, unit of length: picometer.
* Caller owns returned value and must free it.
- * Also see {@link #getPicometer()}.
+ * Also see {@link #getPicometer()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createPicometer(UErrorCode &status);
/**
- * Returns by value, unit of length: picometer.
- * Also see {@link #createPicometer()}.
- * @stable ICU 64
- */
- static MeasureUnit getPicometer();
-
- /**
- * Returns by pointer, unit of length: point.
+ * Returns by value, unit of length: picometer.
+ * Also see {@link #createPicometer()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getPicometer();
+
+ /**
+ * Returns by pointer, unit of length: point.
* Caller owns returned value and must free it.
- * Also see {@link #getPoint()}.
+ * Also see {@link #getPoint()}.
+ * @param status ICU error code.
+ * @stable ICU 59
+ */
+ static MeasureUnit *createPoint(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of length: point.
+ * Also see {@link #createPoint()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getPoint();
+
+ /**
+ * Returns by pointer, unit of length: solar-radius.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getSolarRadius()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createSolarRadius(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of length: solar-radius.
+ * Also see {@link #createSolarRadius()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getSolarRadius();
+
+ /**
+ * Returns by pointer, unit of length: yard.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getYard()}.
* @param status ICU error code.
- * @stable ICU 59
- */
- static MeasureUnit *createPoint(UErrorCode &status);
-
- /**
- * Returns by value, unit of length: point.
- * Also see {@link #createPoint()}.
- * @stable ICU 64
- */
- static MeasureUnit getPoint();
-
- /**
- * Returns by pointer, unit of length: solar-radius.
- * Caller owns returned value and must free it.
- * Also see {@link #getSolarRadius()}.
- * @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createSolarRadius(UErrorCode &status);
-
- /**
- * Returns by value, unit of length: solar-radius.
- * Also see {@link #createSolarRadius()}.
- * @stable ICU 64
- */
- static MeasureUnit getSolarRadius();
-
- /**
- * Returns by pointer, unit of length: yard.
- * Caller owns returned value and must free it.
- * Also see {@link #getYard()}.
- * @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createYard(UErrorCode &status);
/**
- * Returns by value, unit of length: yard.
- * Also see {@link #createYard()}.
- * @stable ICU 64
- */
- static MeasureUnit getYard();
-
- /**
- * Returns by pointer, unit of light: lux.
+ * Returns by value, unit of length: yard.
+ * Also see {@link #createYard()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getYard();
+
+ /**
+ * Returns by pointer, unit of light: lux.
* Caller owns returned value and must free it.
- * Also see {@link #getLux()}.
+ * Also see {@link #getLux()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createLux(UErrorCode &status);
/**
- * Returns by value, unit of light: lux.
- * Also see {@link #createLux()}.
- * @stable ICU 64
- */
- static MeasureUnit getLux();
-
- /**
- * Returns by pointer, unit of light: solar-luminosity.
+ * Returns by value, unit of light: lux.
+ * Also see {@link #createLux()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getLux();
+
+ /**
+ * Returns by pointer, unit of light: solar-luminosity.
* Caller owns returned value and must free it.
- * Also see {@link #getSolarLuminosity()}.
+ * Also see {@link #getSolarLuminosity()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createSolarLuminosity(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of light: solar-luminosity.
+ * Also see {@link #createSolarLuminosity()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getSolarLuminosity();
+
+ /**
+ * Returns by pointer, unit of mass: carat.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getCarat()}.
* @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createSolarLuminosity(UErrorCode &status);
-
- /**
- * Returns by value, unit of light: solar-luminosity.
- * Also see {@link #createSolarLuminosity()}.
- * @stable ICU 64
- */
- static MeasureUnit getSolarLuminosity();
-
- /**
- * Returns by pointer, unit of mass: carat.
- * Caller owns returned value and must free it.
- * Also see {@link #getCarat()}.
- * @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createCarat(UErrorCode &status);
/**
- * Returns by value, unit of mass: carat.
- * Also see {@link #createCarat()}.
- * @stable ICU 64
- */
- static MeasureUnit getCarat();
-
- /**
- * Returns by pointer, unit of mass: dalton.
+ * Returns by value, unit of mass: carat.
+ * Also see {@link #createCarat()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getCarat();
+
+ /**
+ * Returns by pointer, unit of mass: dalton.
* Caller owns returned value and must free it.
- * Also see {@link #getDalton()}.
+ * Also see {@link #getDalton()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createDalton(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of mass: dalton.
+ * Also see {@link #createDalton()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getDalton();
+
+ /**
+ * Returns by pointer, unit of mass: earth-mass.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getEarthMass()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createEarthMass(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of mass: earth-mass.
+ * Also see {@link #createEarthMass()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getEarthMass();
+
+ /**
+ * Returns by pointer, unit of mass: gram.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getGram()}.
* @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createDalton(UErrorCode &status);
-
- /**
- * Returns by value, unit of mass: dalton.
- * Also see {@link #createDalton()}.
- * @stable ICU 64
- */
- static MeasureUnit getDalton();
-
- /**
- * Returns by pointer, unit of mass: earth-mass.
- * Caller owns returned value and must free it.
- * Also see {@link #getEarthMass()}.
- * @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createEarthMass(UErrorCode &status);
-
- /**
- * Returns by value, unit of mass: earth-mass.
- * Also see {@link #createEarthMass()}.
- * @stable ICU 64
- */
- static MeasureUnit getEarthMass();
-
- /**
- * Returns by pointer, unit of mass: gram.
- * Caller owns returned value and must free it.
- * Also see {@link #getGram()}.
- * @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createGram(UErrorCode &status);
/**
- * Returns by value, unit of mass: gram.
- * Also see {@link #createGram()}.
- * @stable ICU 64
- */
- static MeasureUnit getGram();
-
- /**
- * Returns by pointer, unit of mass: kilogram.
+ * Returns by value, unit of mass: gram.
+ * Also see {@link #createGram()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getGram();
+
+ /**
+ * Returns by pointer, unit of mass: kilogram.
* Caller owns returned value and must free it.
- * Also see {@link #getKilogram()}.
+ * Also see {@link #getKilogram()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createKilogram(UErrorCode &status);
/**
- * Returns by value, unit of mass: kilogram.
- * Also see {@link #createKilogram()}.
- * @stable ICU 64
- */
- static MeasureUnit getKilogram();
-
- /**
- * Returns by pointer, unit of mass: metric-ton.
+ * Returns by value, unit of mass: kilogram.
+ * Also see {@link #createKilogram()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getKilogram();
+
+ /**
+ * Returns by pointer, unit of mass: metric-ton.
* Caller owns returned value and must free it.
- * Also see {@link #getMetricTon()}.
+ * Also see {@link #getMetricTon()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMetricTon(UErrorCode &status);
/**
- * Returns by value, unit of mass: metric-ton.
- * Also see {@link #createMetricTon()}.
- * @stable ICU 64
- */
- static MeasureUnit getMetricTon();
-
- /**
- * Returns by pointer, unit of mass: microgram.
+ * Returns by value, unit of mass: metric-ton.
+ * Also see {@link #createMetricTon()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMetricTon();
+
+ /**
+ * Returns by pointer, unit of mass: microgram.
* Caller owns returned value and must free it.
- * Also see {@link #getMicrogram()}.
+ * Also see {@link #getMicrogram()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMicrogram(UErrorCode &status);
/**
- * Returns by value, unit of mass: microgram.
- * Also see {@link #createMicrogram()}.
- * @stable ICU 64
- */
- static MeasureUnit getMicrogram();
-
- /**
- * Returns by pointer, unit of mass: milligram.
+ * Returns by value, unit of mass: microgram.
+ * Also see {@link #createMicrogram()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMicrogram();
+
+ /**
+ * Returns by pointer, unit of mass: milligram.
* Caller owns returned value and must free it.
- * Also see {@link #getMilligram()}.
+ * Also see {@link #getMilligram()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMilligram(UErrorCode &status);
/**
- * Returns by value, unit of mass: milligram.
- * Also see {@link #createMilligram()}.
- * @stable ICU 64
- */
- static MeasureUnit getMilligram();
-
- /**
- * Returns by pointer, unit of mass: ounce.
+ * Returns by value, unit of mass: milligram.
+ * Also see {@link #createMilligram()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMilligram();
+
+ /**
+ * Returns by pointer, unit of mass: ounce.
* Caller owns returned value and must free it.
- * Also see {@link #getOunce()}.
+ * Also see {@link #getOunce()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createOunce(UErrorCode &status);
/**
- * Returns by value, unit of mass: ounce.
- * Also see {@link #createOunce()}.
- * @stable ICU 64
- */
- static MeasureUnit getOunce();
-
- /**
- * Returns by pointer, unit of mass: ounce-troy.
+ * Returns by value, unit of mass: ounce.
+ * Also see {@link #createOunce()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getOunce();
+
+ /**
+ * Returns by pointer, unit of mass: ounce-troy.
* Caller owns returned value and must free it.
- * Also see {@link #getOunceTroy()}.
+ * Also see {@link #getOunceTroy()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createOunceTroy(UErrorCode &status);
/**
- * Returns by value, unit of mass: ounce-troy.
- * Also see {@link #createOunceTroy()}.
- * @stable ICU 64
- */
- static MeasureUnit getOunceTroy();
-
- /**
- * Returns by pointer, unit of mass: pound.
+ * Returns by value, unit of mass: ounce-troy.
+ * Also see {@link #createOunceTroy()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getOunceTroy();
+
+ /**
+ * Returns by pointer, unit of mass: pound.
* Caller owns returned value and must free it.
- * Also see {@link #getPound()}.
+ * Also see {@link #getPound()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createPound(UErrorCode &status);
/**
- * Returns by value, unit of mass: pound.
- * Also see {@link #createPound()}.
- * @stable ICU 64
- */
- static MeasureUnit getPound();
-
- /**
- * Returns by pointer, unit of mass: solar-mass.
+ * Returns by value, unit of mass: pound.
+ * Also see {@link #createPound()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getPound();
+
+ /**
+ * Returns by pointer, unit of mass: solar-mass.
* Caller owns returned value and must free it.
- * Also see {@link #getSolarMass()}.
+ * Also see {@link #getSolarMass()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createSolarMass(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of mass: solar-mass.
+ * Also see {@link #createSolarMass()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getSolarMass();
+
+ /**
+ * Returns by pointer, unit of mass: stone.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getStone()}.
* @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createSolarMass(UErrorCode &status);
-
- /**
- * Returns by value, unit of mass: solar-mass.
- * Also see {@link #createSolarMass()}.
- * @stable ICU 64
- */
- static MeasureUnit getSolarMass();
-
- /**
- * Returns by pointer, unit of mass: stone.
- * Caller owns returned value and must free it.
- * Also see {@link #getStone()}.
- * @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createStone(UErrorCode &status);
/**
- * Returns by value, unit of mass: stone.
- * Also see {@link #createStone()}.
- * @stable ICU 64
- */
- static MeasureUnit getStone();
-
- /**
- * Returns by pointer, unit of mass: ton.
+ * Returns by value, unit of mass: stone.
+ * Also see {@link #createStone()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getStone();
+
+ /**
+ * Returns by pointer, unit of mass: ton.
* Caller owns returned value and must free it.
- * Also see {@link #getTon()}.
+ * Also see {@link #getTon()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createTon(UErrorCode &status);
/**
- * Returns by value, unit of mass: ton.
- * Also see {@link #createTon()}.
- * @stable ICU 64
- */
- static MeasureUnit getTon();
-
- /**
- * Returns by pointer, unit of power: gigawatt.
+ * Returns by value, unit of mass: ton.
+ * Also see {@link #createTon()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getTon();
+
+ /**
+ * Returns by pointer, unit of power: gigawatt.
* Caller owns returned value and must free it.
- * Also see {@link #getGigawatt()}.
+ * Also see {@link #getGigawatt()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createGigawatt(UErrorCode &status);
/**
- * Returns by value, unit of power: gigawatt.
- * Also see {@link #createGigawatt()}.
- * @stable ICU 64
- */
- static MeasureUnit getGigawatt();
-
- /**
- * Returns by pointer, unit of power: horsepower.
+ * Returns by value, unit of power: gigawatt.
+ * Also see {@link #createGigawatt()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getGigawatt();
+
+ /**
+ * Returns by pointer, unit of power: horsepower.
* Caller owns returned value and must free it.
- * Also see {@link #getHorsepower()}.
+ * Also see {@link #getHorsepower()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createHorsepower(UErrorCode &status);
/**
- * Returns by value, unit of power: horsepower.
- * Also see {@link #createHorsepower()}.
- * @stable ICU 64
- */
- static MeasureUnit getHorsepower();
-
- /**
- * Returns by pointer, unit of power: kilowatt.
+ * Returns by value, unit of power: horsepower.
+ * Also see {@link #createHorsepower()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getHorsepower();
+
+ /**
+ * Returns by pointer, unit of power: kilowatt.
* Caller owns returned value and must free it.
- * Also see {@link #getKilowatt()}.
+ * Also see {@link #getKilowatt()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createKilowatt(UErrorCode &status);
/**
- * Returns by value, unit of power: kilowatt.
- * Also see {@link #createKilowatt()}.
- * @stable ICU 64
- */
- static MeasureUnit getKilowatt();
-
- /**
- * Returns by pointer, unit of power: megawatt.
+ * Returns by value, unit of power: kilowatt.
+ * Also see {@link #createKilowatt()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getKilowatt();
+
+ /**
+ * Returns by pointer, unit of power: megawatt.
* Caller owns returned value and must free it.
- * Also see {@link #getMegawatt()}.
+ * Also see {@link #getMegawatt()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMegawatt(UErrorCode &status);
/**
- * Returns by value, unit of power: megawatt.
- * Also see {@link #createMegawatt()}.
- * @stable ICU 64
- */
- static MeasureUnit getMegawatt();
-
- /**
- * Returns by pointer, unit of power: milliwatt.
+ * Returns by value, unit of power: megawatt.
+ * Also see {@link #createMegawatt()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMegawatt();
+
+ /**
+ * Returns by pointer, unit of power: milliwatt.
* Caller owns returned value and must free it.
- * Also see {@link #getMilliwatt()}.
+ * Also see {@link #getMilliwatt()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMilliwatt(UErrorCode &status);
/**
- * Returns by value, unit of power: milliwatt.
- * Also see {@link #createMilliwatt()}.
- * @stable ICU 64
- */
- static MeasureUnit getMilliwatt();
-
- /**
- * Returns by pointer, unit of power: watt.
+ * Returns by value, unit of power: milliwatt.
+ * Also see {@link #createMilliwatt()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMilliwatt();
+
+ /**
+ * Returns by pointer, unit of power: watt.
* Caller owns returned value and must free it.
- * Also see {@link #getWatt()}.
+ * Also see {@link #getWatt()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createWatt(UErrorCode &status);
/**
- * Returns by value, unit of power: watt.
- * Also see {@link #createWatt()}.
- * @stable ICU 64
- */
- static MeasureUnit getWatt();
-
- /**
- * Returns by pointer, unit of pressure: atmosphere.
+ * Returns by value, unit of power: watt.
+ * Also see {@link #createWatt()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getWatt();
+
+ /**
+ * Returns by pointer, unit of pressure: atmosphere.
* Caller owns returned value and must free it.
- * Also see {@link #getAtmosphere()}.
+ * Also see {@link #getAtmosphere()}.
+ * @param status ICU error code.
+ * @stable ICU 63
+ */
+ static MeasureUnit *createAtmosphere(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of pressure: atmosphere.
+ * Also see {@link #createAtmosphere()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getAtmosphere();
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of pressure: bar.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getBar()}.
+ * @param status ICU error code.
+ * @draft ICU 65
+ */
+ static MeasureUnit *createBar(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of pressure: bar.
+ * Also see {@link #createBar()}.
+ * @draft ICU 65
+ */
+ static MeasureUnit getBar();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of pressure: hectopascal.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getHectopascal()}.
* @param status ICU error code.
- * @stable ICU 63
- */
- static MeasureUnit *createAtmosphere(UErrorCode &status);
-
- /**
- * Returns by value, unit of pressure: atmosphere.
- * Also see {@link #createAtmosphere()}.
- * @stable ICU 64
- */
- static MeasureUnit getAtmosphere();
-
-#ifndef U_HIDE_DRAFT_API
- /**
- * Returns by pointer, unit of pressure: bar.
- * Caller owns returned value and must free it.
- * Also see {@link #getBar()}.
- * @param status ICU error code.
- * @draft ICU 65
- */
- static MeasureUnit *createBar(UErrorCode &status);
-
- /**
- * Returns by value, unit of pressure: bar.
- * Also see {@link #createBar()}.
- * @draft ICU 65
- */
- static MeasureUnit getBar();
-#endif /* U_HIDE_DRAFT_API */
-
- /**
- * Returns by pointer, unit of pressure: hectopascal.
- * Caller owns returned value and must free it.
- * Also see {@link #getHectopascal()}.
- * @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createHectopascal(UErrorCode &status);
/**
- * Returns by value, unit of pressure: hectopascal.
- * Also see {@link #createHectopascal()}.
- * @stable ICU 64
- */
- static MeasureUnit getHectopascal();
-
- /**
- * Returns by pointer, unit of pressure: inch-ofhg.
+ * Returns by value, unit of pressure: hectopascal.
+ * Also see {@link #createHectopascal()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getHectopascal();
+
+ /**
+ * Returns by pointer, unit of pressure: inch-ofhg.
* Caller owns returned value and must free it.
- * Also see {@link #getInchHg()}.
+ * Also see {@link #getInchHg()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createInchHg(UErrorCode &status);
/**
- * Returns by value, unit of pressure: inch-ofhg.
- * Also see {@link #createInchHg()}.
- * @stable ICU 64
- */
- static MeasureUnit getInchHg();
-
- /**
- * Returns by pointer, unit of pressure: kilopascal.
+ * Returns by value, unit of pressure: inch-ofhg.
+ * Also see {@link #createInchHg()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getInchHg();
+
+ /**
+ * Returns by pointer, unit of pressure: kilopascal.
* Caller owns returned value and must free it.
- * Also see {@link #getKilopascal()}.
+ * Also see {@link #getKilopascal()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createKilopascal(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of pressure: kilopascal.
+ * Also see {@link #createKilopascal()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getKilopascal();
+
+ /**
+ * Returns by pointer, unit of pressure: megapascal.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getMegapascal()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createMegapascal(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of pressure: megapascal.
+ * Also see {@link #createMegapascal()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMegapascal();
+
+ /**
+ * Returns by pointer, unit of pressure: millibar.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getMillibar()}.
* @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createKilopascal(UErrorCode &status);
-
- /**
- * Returns by value, unit of pressure: kilopascal.
- * Also see {@link #createKilopascal()}.
- * @stable ICU 64
- */
- static MeasureUnit getKilopascal();
-
- /**
- * Returns by pointer, unit of pressure: megapascal.
- * Caller owns returned value and must free it.
- * Also see {@link #getMegapascal()}.
- * @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createMegapascal(UErrorCode &status);
-
- /**
- * Returns by value, unit of pressure: megapascal.
- * Also see {@link #createMegapascal()}.
- * @stable ICU 64
- */
- static MeasureUnit getMegapascal();
-
- /**
- * Returns by pointer, unit of pressure: millibar.
- * Caller owns returned value and must free it.
- * Also see {@link #getMillibar()}.
- * @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createMillibar(UErrorCode &status);
/**
- * Returns by value, unit of pressure: millibar.
- * Also see {@link #createMillibar()}.
- * @stable ICU 64
- */
- static MeasureUnit getMillibar();
-
- /**
- * Returns by pointer, unit of pressure: millimeter-ofhg.
+ * Returns by value, unit of pressure: millibar.
+ * Also see {@link #createMillibar()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMillibar();
+
+ /**
+ * Returns by pointer, unit of pressure: millimeter-ofhg.
* Caller owns returned value and must free it.
- * Also see {@link #getMillimeterOfMercury()}.
+ * Also see {@link #getMillimeterOfMercury()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMillimeterOfMercury(UErrorCode &status);
/**
- * Returns by value, unit of pressure: millimeter-ofhg.
- * Also see {@link #createMillimeterOfMercury()}.
- * @stable ICU 64
- */
- static MeasureUnit getMillimeterOfMercury();
-
-#ifndef U_HIDE_DRAFT_API
- /**
- * Returns by pointer, unit of pressure: pascal.
+ * Returns by value, unit of pressure: millimeter-ofhg.
+ * Also see {@link #createMillimeterOfMercury()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMillimeterOfMercury();
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of pressure: pascal.
* Caller owns returned value and must free it.
- * Also see {@link #getPascal()}.
+ * Also see {@link #getPascal()}.
+ * @param status ICU error code.
+ * @draft ICU 65
+ */
+ static MeasureUnit *createPascal(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of pressure: pascal.
+ * Also see {@link #createPascal()}.
+ * @draft ICU 65
+ */
+ static MeasureUnit getPascal();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of pressure: pound-force-per-square-inch.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getPoundPerSquareInch()}.
* @param status ICU error code.
- * @draft ICU 65
- */
- static MeasureUnit *createPascal(UErrorCode &status);
-
- /**
- * Returns by value, unit of pressure: pascal.
- * Also see {@link #createPascal()}.
- * @draft ICU 65
- */
- static MeasureUnit getPascal();
-#endif /* U_HIDE_DRAFT_API */
-
- /**
- * Returns by pointer, unit of pressure: pound-force-per-square-inch.
- * Caller owns returned value and must free it.
- * Also see {@link #getPoundPerSquareInch()}.
- * @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createPoundPerSquareInch(UErrorCode &status);
/**
- * Returns by value, unit of pressure: pound-force-per-square-inch.
- * Also see {@link #createPoundPerSquareInch()}.
- * @stable ICU 64
- */
- static MeasureUnit getPoundPerSquareInch();
-
- /**
- * Returns by pointer, unit of speed: kilometer-per-hour.
+ * Returns by value, unit of pressure: pound-force-per-square-inch.
+ * Also see {@link #createPoundPerSquareInch()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getPoundPerSquareInch();
+
+ /**
+ * Returns by pointer, unit of speed: kilometer-per-hour.
* Caller owns returned value and must free it.
- * Also see {@link #getKilometerPerHour()}.
+ * Also see {@link #getKilometerPerHour()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createKilometerPerHour(UErrorCode &status);
/**
- * Returns by value, unit of speed: kilometer-per-hour.
- * Also see {@link #createKilometerPerHour()}.
- * @stable ICU 64
- */
- static MeasureUnit getKilometerPerHour();
-
- /**
- * Returns by pointer, unit of speed: knot.
+ * Returns by value, unit of speed: kilometer-per-hour.
+ * Also see {@link #createKilometerPerHour()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getKilometerPerHour();
+
+ /**
+ * Returns by pointer, unit of speed: knot.
* Caller owns returned value and must free it.
- * Also see {@link #getKnot()}.
+ * Also see {@link #getKnot()}.
* @param status ICU error code.
* @stable ICU 56
*/
static MeasureUnit *createKnot(UErrorCode &status);
/**
- * Returns by value, unit of speed: knot.
- * Also see {@link #createKnot()}.
- * @stable ICU 64
- */
- static MeasureUnit getKnot();
-
- /**
- * Returns by pointer, unit of speed: meter-per-second.
+ * Returns by value, unit of speed: knot.
+ * Also see {@link #createKnot()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getKnot();
+
+ /**
+ * Returns by pointer, unit of speed: meter-per-second.
* Caller owns returned value and must free it.
- * Also see {@link #getMeterPerSecond()}.
+ * Also see {@link #getMeterPerSecond()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createMeterPerSecond(UErrorCode &status);
/**
- * Returns by value, unit of speed: meter-per-second.
- * Also see {@link #createMeterPerSecond()}.
- * @stable ICU 64
- */
- static MeasureUnit getMeterPerSecond();
-
- /**
- * Returns by pointer, unit of speed: mile-per-hour.
+ * Returns by value, unit of speed: meter-per-second.
+ * Also see {@link #createMeterPerSecond()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMeterPerSecond();
+
+ /**
+ * Returns by pointer, unit of speed: mile-per-hour.
* Caller owns returned value and must free it.
- * Also see {@link #getMilePerHour()}.
+ * Also see {@link #getMilePerHour()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createMilePerHour(UErrorCode &status);
/**
- * Returns by value, unit of speed: mile-per-hour.
- * Also see {@link #createMilePerHour()}.
- * @stable ICU 64
- */
- static MeasureUnit getMilePerHour();
-
- /**
- * Returns by pointer, unit of temperature: celsius.
+ * Returns by value, unit of speed: mile-per-hour.
+ * Also see {@link #createMilePerHour()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMilePerHour();
+
+ /**
+ * Returns by pointer, unit of temperature: celsius.
* Caller owns returned value and must free it.
- * Also see {@link #getCelsius()}.
+ * Also see {@link #getCelsius()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createCelsius(UErrorCode &status);
/**
- * Returns by value, unit of temperature: celsius.
- * Also see {@link #createCelsius()}.
- * @stable ICU 64
- */
- static MeasureUnit getCelsius();
-
- /**
- * Returns by pointer, unit of temperature: fahrenheit.
+ * Returns by value, unit of temperature: celsius.
+ * Also see {@link #createCelsius()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getCelsius();
+
+ /**
+ * Returns by pointer, unit of temperature: fahrenheit.
* Caller owns returned value and must free it.
- * Also see {@link #getFahrenheit()}.
+ * Also see {@link #getFahrenheit()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createFahrenheit(UErrorCode &status);
/**
- * Returns by value, unit of temperature: fahrenheit.
- * Also see {@link #createFahrenheit()}.
- * @stable ICU 64
- */
- static MeasureUnit getFahrenheit();
-
- /**
- * Returns by pointer, unit of temperature: generic.
+ * Returns by value, unit of temperature: fahrenheit.
+ * Also see {@link #createFahrenheit()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getFahrenheit();
+
+ /**
+ * Returns by pointer, unit of temperature: generic.
* Caller owns returned value and must free it.
- * Also see {@link #getGenericTemperature()}.
+ * Also see {@link #getGenericTemperature()}.
* @param status ICU error code.
* @stable ICU 56
*/
static MeasureUnit *createGenericTemperature(UErrorCode &status);
/**
- * Returns by value, unit of temperature: generic.
- * Also see {@link #createGenericTemperature()}.
- * @stable ICU 64
- */
- static MeasureUnit getGenericTemperature();
-
- /**
- * Returns by pointer, unit of temperature: kelvin.
+ * Returns by value, unit of temperature: generic.
+ * Also see {@link #createGenericTemperature()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getGenericTemperature();
+
+ /**
+ * Returns by pointer, unit of temperature: kelvin.
* Caller owns returned value and must free it.
- * Also see {@link #getKelvin()}.
+ * Also see {@link #getKelvin()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createKelvin(UErrorCode &status);
/**
- * Returns by value, unit of temperature: kelvin.
- * Also see {@link #createKelvin()}.
- * @stable ICU 64
- */
- static MeasureUnit getKelvin();
-
- /**
- * Returns by pointer, unit of torque: newton-meter.
+ * Returns by value, unit of temperature: kelvin.
+ * Also see {@link #createKelvin()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getKelvin();
+
+ /**
+ * Returns by pointer, unit of torque: newton-meter.
* Caller owns returned value and must free it.
- * Also see {@link #getNewtonMeter()}.
+ * Also see {@link #getNewtonMeter()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createNewtonMeter(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of torque: newton-meter.
+ * Also see {@link #createNewtonMeter()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getNewtonMeter();
+
+ /**
+ * Returns by pointer, unit of torque: pound-force-foot.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getPoundFoot()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createPoundFoot(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of torque: pound-force-foot.
+ * Also see {@link #createPoundFoot()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getPoundFoot();
+
+ /**
+ * Returns by pointer, unit of volume: acre-foot.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getAcreFoot()}.
* @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createNewtonMeter(UErrorCode &status);
-
- /**
- * Returns by value, unit of torque: newton-meter.
- * Also see {@link #createNewtonMeter()}.
- * @stable ICU 64
- */
- static MeasureUnit getNewtonMeter();
-
- /**
- * Returns by pointer, unit of torque: pound-force-foot.
- * Caller owns returned value and must free it.
- * Also see {@link #getPoundFoot()}.
- * @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createPoundFoot(UErrorCode &status);
-
- /**
- * Returns by value, unit of torque: pound-force-foot.
- * Also see {@link #createPoundFoot()}.
- * @stable ICU 64
- */
- static MeasureUnit getPoundFoot();
-
- /**
- * Returns by pointer, unit of volume: acre-foot.
- * Caller owns returned value and must free it.
- * Also see {@link #getAcreFoot()}.
- * @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createAcreFoot(UErrorCode &status);
/**
- * Returns by value, unit of volume: acre-foot.
- * Also see {@link #createAcreFoot()}.
- * @stable ICU 64
- */
- static MeasureUnit getAcreFoot();
-
- /**
- * Returns by pointer, unit of volume: barrel.
+ * Returns by value, unit of volume: acre-foot.
+ * Also see {@link #createAcreFoot()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getAcreFoot();
+
+ /**
+ * Returns by pointer, unit of volume: barrel.
* Caller owns returned value and must free it.
- * Also see {@link #getBarrel()}.
+ * Also see {@link #getBarrel()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createBarrel(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of volume: barrel.
+ * Also see {@link #createBarrel()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getBarrel();
+
+ /**
+ * Returns by pointer, unit of volume: bushel.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getBushel()}.
* @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createBarrel(UErrorCode &status);
-
- /**
- * Returns by value, unit of volume: barrel.
- * Also see {@link #createBarrel()}.
- * @stable ICU 64
- */
- static MeasureUnit getBarrel();
-
- /**
- * Returns by pointer, unit of volume: bushel.
- * Caller owns returned value and must free it.
- * Also see {@link #getBushel()}.
- * @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createBushel(UErrorCode &status);
/**
- * Returns by value, unit of volume: bushel.
- * Also see {@link #createBushel()}.
- * @stable ICU 64
- */
- static MeasureUnit getBushel();
-
- /**
- * Returns by pointer, unit of volume: centiliter.
+ * Returns by value, unit of volume: bushel.
+ * Also see {@link #createBushel()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getBushel();
+
+ /**
+ * Returns by pointer, unit of volume: centiliter.
* Caller owns returned value and must free it.
- * Also see {@link #getCentiliter()}.
+ * Also see {@link #getCentiliter()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createCentiliter(UErrorCode &status);
/**
- * Returns by value, unit of volume: centiliter.
- * Also see {@link #createCentiliter()}.
- * @stable ICU 64
- */
- static MeasureUnit getCentiliter();
-
- /**
- * Returns by pointer, unit of volume: cubic-centimeter.
+ * Returns by value, unit of volume: centiliter.
+ * Also see {@link #createCentiliter()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getCentiliter();
+
+ /**
+ * Returns by pointer, unit of volume: cubic-centimeter.
* Caller owns returned value and must free it.
- * Also see {@link #getCubicCentimeter()}.
+ * Also see {@link #getCubicCentimeter()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createCubicCentimeter(UErrorCode &status);
/**
- * Returns by value, unit of volume: cubic-centimeter.
- * Also see {@link #createCubicCentimeter()}.
- * @stable ICU 64
- */
- static MeasureUnit getCubicCentimeter();
-
- /**
- * Returns by pointer, unit of volume: cubic-foot.
+ * Returns by value, unit of volume: cubic-centimeter.
+ * Also see {@link #createCubicCentimeter()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getCubicCentimeter();
+
+ /**
+ * Returns by pointer, unit of volume: cubic-foot.
* Caller owns returned value and must free it.
- * Also see {@link #getCubicFoot()}.
+ * Also see {@link #getCubicFoot()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createCubicFoot(UErrorCode &status);
/**
- * Returns by value, unit of volume: cubic-foot.
- * Also see {@link #createCubicFoot()}.
- * @stable ICU 64
- */
- static MeasureUnit getCubicFoot();
-
- /**
- * Returns by pointer, unit of volume: cubic-inch.
+ * Returns by value, unit of volume: cubic-foot.
+ * Also see {@link #createCubicFoot()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getCubicFoot();
+
+ /**
+ * Returns by pointer, unit of volume: cubic-inch.
* Caller owns returned value and must free it.
- * Also see {@link #getCubicInch()}.
+ * Also see {@link #getCubicInch()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createCubicInch(UErrorCode &status);
/**
- * Returns by value, unit of volume: cubic-inch.
- * Also see {@link #createCubicInch()}.
- * @stable ICU 64
- */
- static MeasureUnit getCubicInch();
-
- /**
- * Returns by pointer, unit of volume: cubic-kilometer.
+ * Returns by value, unit of volume: cubic-inch.
+ * Also see {@link #createCubicInch()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getCubicInch();
+
+ /**
+ * Returns by pointer, unit of volume: cubic-kilometer.
* Caller owns returned value and must free it.
- * Also see {@link #getCubicKilometer()}.
+ * Also see {@link #getCubicKilometer()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createCubicKilometer(UErrorCode &status);
/**
- * Returns by value, unit of volume: cubic-kilometer.
- * Also see {@link #createCubicKilometer()}.
- * @stable ICU 64
- */
- static MeasureUnit getCubicKilometer();
-
- /**
- * Returns by pointer, unit of volume: cubic-meter.
+ * Returns by value, unit of volume: cubic-kilometer.
+ * Also see {@link #createCubicKilometer()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getCubicKilometer();
+
+ /**
+ * Returns by pointer, unit of volume: cubic-meter.
* Caller owns returned value and must free it.
- * Also see {@link #getCubicMeter()}.
+ * Also see {@link #getCubicMeter()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createCubicMeter(UErrorCode &status);
/**
- * Returns by value, unit of volume: cubic-meter.
- * Also see {@link #createCubicMeter()}.
- * @stable ICU 64
- */
- static MeasureUnit getCubicMeter();
-
- /**
- * Returns by pointer, unit of volume: cubic-mile.
+ * Returns by value, unit of volume: cubic-meter.
+ * Also see {@link #createCubicMeter()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getCubicMeter();
+
+ /**
+ * Returns by pointer, unit of volume: cubic-mile.
* Caller owns returned value and must free it.
- * Also see {@link #getCubicMile()}.
+ * Also see {@link #getCubicMile()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createCubicMile(UErrorCode &status);
/**
- * Returns by value, unit of volume: cubic-mile.
- * Also see {@link #createCubicMile()}.
- * @stable ICU 64
- */
- static MeasureUnit getCubicMile();
-
- /**
- * Returns by pointer, unit of volume: cubic-yard.
+ * Returns by value, unit of volume: cubic-mile.
+ * Also see {@link #createCubicMile()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getCubicMile();
+
+ /**
+ * Returns by pointer, unit of volume: cubic-yard.
* Caller owns returned value and must free it.
- * Also see {@link #getCubicYard()}.
+ * Also see {@link #getCubicYard()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createCubicYard(UErrorCode &status);
/**
- * Returns by value, unit of volume: cubic-yard.
- * Also see {@link #createCubicYard()}.
- * @stable ICU 64
- */
- static MeasureUnit getCubicYard();
-
- /**
- * Returns by pointer, unit of volume: cup.
+ * Returns by value, unit of volume: cubic-yard.
+ * Also see {@link #createCubicYard()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getCubicYard();
+
+ /**
+ * Returns by pointer, unit of volume: cup.
* Caller owns returned value and must free it.
- * Also see {@link #getCup()}.
+ * Also see {@link #getCup()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createCup(UErrorCode &status);
/**
- * Returns by value, unit of volume: cup.
- * Also see {@link #createCup()}.
- * @stable ICU 64
- */
- static MeasureUnit getCup();
-
- /**
- * Returns by pointer, unit of volume: cup-metric.
+ * Returns by value, unit of volume: cup.
+ * Also see {@link #createCup()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getCup();
+
+ /**
+ * Returns by pointer, unit of volume: cup-metric.
* Caller owns returned value and must free it.
- * Also see {@link #getCupMetric()}.
+ * Also see {@link #getCupMetric()}.
* @param status ICU error code.
* @stable ICU 56
*/
static MeasureUnit *createCupMetric(UErrorCode &status);
/**
- * Returns by value, unit of volume: cup-metric.
- * Also see {@link #createCupMetric()}.
- * @stable ICU 64
- */
- static MeasureUnit getCupMetric();
-
- /**
- * Returns by pointer, unit of volume: deciliter.
+ * Returns by value, unit of volume: cup-metric.
+ * Also see {@link #createCupMetric()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getCupMetric();
+
+ /**
+ * Returns by pointer, unit of volume: deciliter.
* Caller owns returned value and must free it.
- * Also see {@link #getDeciliter()}.
+ * Also see {@link #getDeciliter()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createDeciliter(UErrorCode &status);
/**
- * Returns by value, unit of volume: deciliter.
- * Also see {@link #createDeciliter()}.
- * @stable ICU 64
- */
- static MeasureUnit getDeciliter();
-
- /**
- * Returns by pointer, unit of volume: fluid-ounce.
+ * Returns by value, unit of volume: deciliter.
+ * Also see {@link #createDeciliter()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getDeciliter();
+
+ /**
+ * Returns by pointer, unit of volume: fluid-ounce.
* Caller owns returned value and must free it.
- * Also see {@link #getFluidOunce()}.
+ * Also see {@link #getFluidOunce()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createFluidOunce(UErrorCode &status);
/**
- * Returns by value, unit of volume: fluid-ounce.
- * Also see {@link #createFluidOunce()}.
- * @stable ICU 64
- */
- static MeasureUnit getFluidOunce();
-
- /**
- * Returns by pointer, unit of volume: fluid-ounce-imperial.
+ * Returns by value, unit of volume: fluid-ounce.
+ * Also see {@link #createFluidOunce()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getFluidOunce();
+
+ /**
+ * Returns by pointer, unit of volume: fluid-ounce-imperial.
* Caller owns returned value and must free it.
- * Also see {@link #getFluidOunceImperial()}.
+ * Also see {@link #getFluidOunceImperial()}.
+ * @param status ICU error code.
+ * @stable ICU 64
+ */
+ static MeasureUnit *createFluidOunceImperial(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of volume: fluid-ounce-imperial.
+ * Also see {@link #createFluidOunceImperial()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getFluidOunceImperial();
+
+ /**
+ * Returns by pointer, unit of volume: gallon.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getGallon()}.
* @param status ICU error code.
- * @stable ICU 64
- */
- static MeasureUnit *createFluidOunceImperial(UErrorCode &status);
-
- /**
- * Returns by value, unit of volume: fluid-ounce-imperial.
- * Also see {@link #createFluidOunceImperial()}.
- * @stable ICU 64
- */
- static MeasureUnit getFluidOunceImperial();
-
- /**
- * Returns by pointer, unit of volume: gallon.
- * Caller owns returned value and must free it.
- * Also see {@link #getGallon()}.
- * @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createGallon(UErrorCode &status);
/**
- * Returns by value, unit of volume: gallon.
- * Also see {@link #createGallon()}.
- * @stable ICU 64
- */
- static MeasureUnit getGallon();
-
- /**
- * Returns by pointer, unit of volume: gallon-imperial.
+ * Returns by value, unit of volume: gallon.
+ * Also see {@link #createGallon()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getGallon();
+
+ /**
+ * Returns by pointer, unit of volume: gallon-imperial.
* Caller owns returned value and must free it.
- * Also see {@link #getGallonImperial()}.
+ * Also see {@link #getGallonImperial()}.
* @param status ICU error code.
- * @stable ICU 57
+ * @stable ICU 57
*/
static MeasureUnit *createGallonImperial(UErrorCode &status);
/**
- * Returns by value, unit of volume: gallon-imperial.
- * Also see {@link #createGallonImperial()}.
- * @stable ICU 64
- */
- static MeasureUnit getGallonImperial();
-
- /**
- * Returns by pointer, unit of volume: hectoliter.
+ * Returns by value, unit of volume: gallon-imperial.
+ * Also see {@link #createGallonImperial()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getGallonImperial();
+
+ /**
+ * Returns by pointer, unit of volume: hectoliter.
* Caller owns returned value and must free it.
- * Also see {@link #getHectoliter()}.
+ * Also see {@link #getHectoliter()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createHectoliter(UErrorCode &status);
/**
- * Returns by value, unit of volume: hectoliter.
- * Also see {@link #createHectoliter()}.
- * @stable ICU 64
- */
- static MeasureUnit getHectoliter();
-
- /**
- * Returns by pointer, unit of volume: liter.
+ * Returns by value, unit of volume: hectoliter.
+ * Also see {@link #createHectoliter()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getHectoliter();
+
+ /**
+ * Returns by pointer, unit of volume: liter.
* Caller owns returned value and must free it.
- * Also see {@link #getLiter()}.
+ * Also see {@link #getLiter()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createLiter(UErrorCode &status);
/**
- * Returns by value, unit of volume: liter.
- * Also see {@link #createLiter()}.
- * @stable ICU 64
- */
- static MeasureUnit getLiter();
-
- /**
- * Returns by pointer, unit of volume: megaliter.
+ * Returns by value, unit of volume: liter.
+ * Also see {@link #createLiter()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getLiter();
+
+ /**
+ * Returns by pointer, unit of volume: megaliter.
* Caller owns returned value and must free it.
- * Also see {@link #getMegaliter()}.
+ * Also see {@link #getMegaliter()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMegaliter(UErrorCode &status);
/**
- * Returns by value, unit of volume: megaliter.
- * Also see {@link #createMegaliter()}.
- * @stable ICU 64
- */
- static MeasureUnit getMegaliter();
-
- /**
- * Returns by pointer, unit of volume: milliliter.
+ * Returns by value, unit of volume: megaliter.
+ * Also see {@link #createMegaliter()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMegaliter();
+
+ /**
+ * Returns by pointer, unit of volume: milliliter.
* Caller owns returned value and must free it.
- * Also see {@link #getMilliliter()}.
+ * Also see {@link #getMilliliter()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMilliliter(UErrorCode &status);
/**
- * Returns by value, unit of volume: milliliter.
- * Also see {@link #createMilliliter()}.
- * @stable ICU 64
- */
- static MeasureUnit getMilliliter();
-
- /**
- * Returns by pointer, unit of volume: pint.
+ * Returns by value, unit of volume: milliliter.
+ * Also see {@link #createMilliliter()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getMilliliter();
+
+ /**
+ * Returns by pointer, unit of volume: pint.
* Caller owns returned value and must free it.
- * Also see {@link #getPint()}.
+ * Also see {@link #getPint()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createPint(UErrorCode &status);
/**
- * Returns by value, unit of volume: pint.
- * Also see {@link #createPint()}.
- * @stable ICU 64
- */
- static MeasureUnit getPint();
-
- /**
- * Returns by pointer, unit of volume: pint-metric.
+ * Returns by value, unit of volume: pint.
+ * Also see {@link #createPint()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getPint();
+
+ /**
+ * Returns by pointer, unit of volume: pint-metric.
* Caller owns returned value and must free it.
- * Also see {@link #getPintMetric()}.
+ * Also see {@link #getPintMetric()}.
* @param status ICU error code.
* @stable ICU 56
*/
static MeasureUnit *createPintMetric(UErrorCode &status);
/**
- * Returns by value, unit of volume: pint-metric.
- * Also see {@link #createPintMetric()}.
- * @stable ICU 64
- */
- static MeasureUnit getPintMetric();
-
- /**
- * Returns by pointer, unit of volume: quart.
+ * Returns by value, unit of volume: pint-metric.
+ * Also see {@link #createPintMetric()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getPintMetric();
+
+ /**
+ * Returns by pointer, unit of volume: quart.
* Caller owns returned value and must free it.
- * Also see {@link #getQuart()}.
+ * Also see {@link #getQuart()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createQuart(UErrorCode &status);
/**
- * Returns by value, unit of volume: quart.
- * Also see {@link #createQuart()}.
- * @stable ICU 64
- */
- static MeasureUnit getQuart();
-
- /**
- * Returns by pointer, unit of volume: tablespoon.
+ * Returns by value, unit of volume: quart.
+ * Also see {@link #createQuart()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getQuart();
+
+ /**
+ * Returns by pointer, unit of volume: tablespoon.
* Caller owns returned value and must free it.
- * Also see {@link #getTablespoon()}.
+ * Also see {@link #getTablespoon()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createTablespoon(UErrorCode &status);
/**
- * Returns by value, unit of volume: tablespoon.
- * Also see {@link #createTablespoon()}.
- * @stable ICU 64
- */
- static MeasureUnit getTablespoon();
-
- /**
- * Returns by pointer, unit of volume: teaspoon.
+ * Returns by value, unit of volume: tablespoon.
+ * Also see {@link #createTablespoon()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getTablespoon();
+
+ /**
+ * Returns by pointer, unit of volume: teaspoon.
* Caller owns returned value and must free it.
- * Also see {@link #getTeaspoon()}.
+ * Also see {@link #getTeaspoon()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createTeaspoon(UErrorCode &status);
- /**
- * Returns by value, unit of volume: teaspoon.
- * Also see {@link #createTeaspoon()}.
- * @stable ICU 64
- */
- static MeasureUnit getTeaspoon();
+ /**
+ * Returns by value, unit of volume: teaspoon.
+ * Also see {@link #createTeaspoon()}.
+ * @stable ICU 64
+ */
+ static MeasureUnit getTeaspoon();
+
-
// End generated createXXX methods
protected:
@@ -3367,51 +3367,51 @@ class U_I18N_API MeasureUnit: public UObject {
* For ICU use only.
* @internal
*/
- void initCurrency(StringPiece isoCurrency);
+ void initCurrency(StringPiece isoCurrency);
+
+ /**
+ * For ICU use only.
+ * @internal
+ */
+ void initNoUnit(const char *subtype);
- /**
- * For ICU use only.
- * @internal
- */
- void initNoUnit(const char *subtype);
-
#endif /* U_HIDE_INTERNAL_API */
private:
- // Used by new draft APIs in ICU 67. If non-null, fImpl is owned by the
- // MeasureUnit.
- MeasureUnitImpl* fImpl;
-
- // An index into a static string list in measunit.cpp. If set to -1, fImpl
- // is in use instead of fTypeId and fSubTypeId.
- int16_t fSubTypeId;
- // An index into a static string list in measunit.cpp. If set to -1, fImpl
- // is in use instead of fTypeId and fSubTypeId.
- int8_t fTypeId;
-
- MeasureUnit(int32_t typeId, int32_t subTypeId);
- MeasureUnit(MeasureUnitImpl&& impl);
+ // Used by new draft APIs in ICU 67. If non-null, fImpl is owned by the
+ // MeasureUnit.
+ MeasureUnitImpl* fImpl;
+
+ // An index into a static string list in measunit.cpp. If set to -1, fImpl
+ // is in use instead of fTypeId and fSubTypeId.
+ int16_t fSubTypeId;
+ // An index into a static string list in measunit.cpp. If set to -1, fImpl
+ // is in use instead of fTypeId and fSubTypeId.
+ int8_t fTypeId;
+
+ MeasureUnit(int32_t typeId, int32_t subTypeId);
+ MeasureUnit(MeasureUnitImpl&& impl);
void setTo(int32_t typeId, int32_t subTypeId);
int32_t getOffset() const;
static MeasureUnit *create(int typeId, int subTypeId, UErrorCode &status);
-
- /**
- * Sets output's typeId and subTypeId according to subType, if subType is a
- * valid/known identifier.
- *
- * @return Whether subType is known to ICU. If false, output was not
- * modified.
- */
- static bool findBySubType(StringPiece subType, MeasureUnit* output);
-
- friend struct MeasureUnitImpl;
+
+ /**
+ * Sets output's typeId and subTypeId according to subType, if subType is a
+ * valid/known identifier.
+ *
+ * @return Whether subType is known to ICU. If false, output was not
+ * modified.
+ */
+ static bool findBySubType(StringPiece subType, MeasureUnit* output);
+
+ friend struct MeasureUnitImpl;
};
U_NAMESPACE_END
#endif // !UNCONFIG_NO_FORMATTING
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __MEASUREUNIT_H__
diff --git a/contrib/libs/icu/include/unicode/measure.h b/contrib/libs/icu/include/unicode/measure.h
index f146767fbc..fa9c29351e 100644
--- a/contrib/libs/icu/include/unicode/measure.h
+++ b/contrib/libs/icu/include/unicode/measure.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -15,8 +15,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: MeasureUnit object.
@@ -74,7 +74,7 @@ class U_I18N_API Measure: public UObject {
* have the same class as returned by getDynamicClassID().
* @stable ICU 3.0
*/
- virtual Measure* clone() const;
+ virtual Measure* clone() const;
/**
* Destructor
@@ -160,7 +160,7 @@ inline const MeasureUnit& Measure::getUnit() const {
U_NAMESPACE_END
#endif // !UCONFIG_NO_FORMATTING
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __MEASURE_H__
diff --git a/contrib/libs/icu/include/unicode/messagepattern.h b/contrib/libs/icu/include/unicode/messagepattern.h
index 564e7a8865..04f00a8757 100644
--- a/contrib/libs/icu/include/unicode/messagepattern.h
+++ b/contrib/libs/icu/include/unicode/messagepattern.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: messagepattern.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -24,8 +24,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
#include "unicode/parseerr.h"
@@ -773,8 +773,8 @@ public:
* @stable ICU 4.8
*/
UMessagePatternArgType getArgType() const {
- UMessagePatternPartType msgType=getType();
- if(msgType ==UMSGPAT_PART_TYPE_ARG_START || msgType ==UMSGPAT_PART_TYPE_ARG_LIMIT) {
+ UMessagePatternPartType msgType=getType();
+ if(msgType ==UMSGPAT_PART_TYPE_ARG_START || msgType ==UMSGPAT_PART_TYPE_ARG_LIMIT) {
return (UMessagePatternArgType)value;
} else {
return UMSGPAT_ARG_TYPE_NONE;
@@ -944,6 +944,6 @@ U_NAMESPACE_END
#endif // !UCONFIG_NO_FORMATTING
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __MESSAGEPATTERN_H__
diff --git a/contrib/libs/icu/include/unicode/msgfmt.h b/contrib/libs/icu/include/unicode/msgfmt.h
index 9e3c21ec19..99b0eaeec1 100644
--- a/contrib/libs/icu/include/unicode/msgfmt.h
+++ b/contrib/libs/icu/include/unicode/msgfmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
* Copyright (C) 2007-2013, International Business Machines Corporation and
@@ -21,8 +21,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: Formats messages in a language-neutral way.
@@ -71,8 +71,8 @@ class NumberFormat;
* if the pattern has named arguments (see {@link #usesNamedArguments()}).
*
* <p>An argument might not specify any format type. In this case,
- * a numeric value is formatted with a default (for the locale) NumberFormat,
- * and a date/time value is formatted with a default (for the locale) DateFormat.
+ * a numeric value is formatted with a default (for the locale) NumberFormat,
+ * and a date/time value is formatted with a default (for the locale) DateFormat.
*
* <p>An argument might specify a "simple" type for which the specified
* Format object is created, cached and used.
@@ -125,7 +125,7 @@ class NumberFormat;
* argNumber = '0' | ('1'..'9' ('0'..'9')*)
*
* argType = "number" | "date" | "time" | "spellout" | "ordinal" | "duration"
- * argStyle = "short" | "medium" | "long" | "full" | "integer" | "currency" | "percent" | argStyleText | "::" argSkeletonText
+ * argStyle = "short" | "medium" | "long" | "full" | "integer" | "currency" | "percent" | argStyleText | "::" argSkeletonText
* </pre>
*
* <ul>
@@ -167,7 +167,7 @@ class NumberFormat;
* <td colspan=2><i>(none)</i>
* <td><code>null</code>
* <tr>
- * <td rowspan=6><code>number</code>
+ * <td rowspan=6><code>number</code>
* <td><i>(none)</i>
* <td><code>NumberFormat.createInstance(getLocale(), status)</code>
* <tr>
@@ -183,10 +183,10 @@ class NumberFormat;
* <td><i>argStyleText</i>
* <td><code>new DecimalFormat(argStyleText, new DecimalFormatSymbols(getLocale(), status), status)</code>
* <tr>
- * <td><i>argSkeletonText</i>
- * <td><code>NumberFormatter::forSkeleton(argSkeletonText, status).locale(getLocale()).toFormat(status)</code>
- * <tr>
- * <td rowspan=7><code>date</code>
+ * <td><i>argSkeletonText</i>
+ * <td><code>NumberFormatter::forSkeleton(argSkeletonText, status).locale(getLocale()).toFormat(status)</code>
+ * <tr>
+ * <td rowspan=7><code>date</code>
* <td><i>(none)</i>
* <td><code>DateFormat.createDateInstance(kDefault, getLocale(), status)</code>
* <tr>
@@ -203,11 +203,11 @@ class NumberFormat;
* <td><code>DateFormat.createDateInstance(kFull, getLocale(), status)</code>
* <tr>
* <td><i>argStyleText</i>
- * <td><code>new SimpleDateFormat(argStyleText, getLocale(), status)</code>
+ * <td><code>new SimpleDateFormat(argStyleText, getLocale(), status)</code>
+ * <tr>
+ * <td><i>argSkeletonText</i>
+ * <td><code>DateFormat::createInstanceForSkeleton(argSkeletonText, getLocale(), status)</code>
* <tr>
- * <td><i>argSkeletonText</i>
- * <td><code>DateFormat::createInstanceForSkeleton(argSkeletonText, getLocale(), status)</code>
- * <tr>
* <td rowspan=6><code>time</code>
* <td><i>(none)</i>
* <td><code>DateFormat.createTimeInstance(kDefault, getLocale(), status)</code>
@@ -225,7 +225,7 @@ class NumberFormat;
* <td><code>DateFormat.createTimeInstance(kFull, getLocale(), status)</code>
* <tr>
* <td><i>argStyleText</i>
- * <td><code>new SimpleDateFormat(argStyleText, getLocale(), status)</code>
+ * <td><code>new SimpleDateFormat(argStyleText, getLocale(), status)</code>
* <tr>
* <td><code>spellout</code>
* <td><i>argStyleText (optional)</i>
@@ -244,19 +244,19 @@ class NumberFormat;
* </table>
* <p>
*
- * <h4>Argument formatting</h4>
- *
- * <p>Arguments are formatted according to their type, using the default
- * ICU formatters for those types, unless otherwise specified.</p>
- *
- * <p>There are also several ways to control the formatting.</p>
- *
- * <p>We recommend you use default styles, predefined style values, skeletons,
- * or preformatted values, but not pattern strings or custom format objects.</p>
- *
- * <p>For more details, see the
- * <a href="http://userguide.icu-project.org/formatparse/messages">ICU User Guide</a>.</p>
- *
+ * <h4>Argument formatting</h4>
+ *
+ * <p>Arguments are formatted according to their type, using the default
+ * ICU formatters for those types, unless otherwise specified.</p>
+ *
+ * <p>There are also several ways to control the formatting.</p>
+ *
+ * <p>We recommend you use default styles, predefined style values, skeletons,
+ * or preformatted values, but not pattern strings or custom format objects.</p>
+ *
+ * <p>For more details, see the
+ * <a href="http://userguide.icu-project.org/formatparse/messages">ICU User Guide</a>.</p>
+ *
* <h4>Usage Information</h4>
*
* <p>Here are some examples of usage:
@@ -274,11 +274,11 @@ class NumberFormat;
*
* UnicodeString result;
* MessageFormat::format(
- * "At {1,time,::jmm} on {1,date,::dMMMM}, there was {2} on planet {0,number}.",
+ * "At {1,time,::jmm} on {1,date,::dMMMM}, there was {2} on planet {0,number}.",
* arguments, 3, result, success );
*
* cout << "result: " << result << endl;
- * //<output>: At 4:34 PM on March 23, there was a disturbance
+ * //<output>: At 4:34 PM on March 23, there was a disturbance
* // in the Force on planet 7.
* \endcode
* </pre>
@@ -420,7 +420,7 @@ public:
* result and should delete it when done.
* @stable ICU 2.0
*/
- virtual MessageFormat* clone() const;
+ virtual MessageFormat* clone() const;
/**
* Returns true if the given Format objects are semantically equal.
@@ -959,7 +959,7 @@ private:
* @return the index of the list which matches the keyword s.
*/
static int32_t findKeyword( const UnicodeString& s,
- const char16_t * const *list);
+ const char16_t * const *list);
/**
* Thin wrapper around the format(... AppendableWrapper ...) variant.
@@ -1011,8 +1011,8 @@ private:
void cacheExplicitFormats(UErrorCode& status);
- int32_t skipLeadingSpaces(UnicodeString& style);
-
+ int32_t skipLeadingSpaces(UnicodeString& style);
+
Format* createAppropriateFormat(UnicodeString& type,
UnicodeString& style,
Formattable::Type& formattableType,
@@ -1089,7 +1089,7 @@ private:
class U_I18N_API DummyFormat : public Format {
public:
virtual UBool operator==(const Format&) const;
- virtual DummyFormat* clone() const;
+ virtual DummyFormat* clone() const;
virtual UnicodeString& format(const Formattable& obj,
UnicodeString& appendTo,
UErrorCode& status) const;
@@ -1113,7 +1113,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _MSGFMT
//eof
diff --git a/contrib/libs/icu/include/unicode/normalizer2.h b/contrib/libs/icu/include/unicode/normalizer2.h
index c7fbdf87b1..4aeb3bb3d8 100644
--- a/contrib/libs/icu/include/unicode/normalizer2.h
+++ b/contrib/libs/icu/include/unicode/normalizer2.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: normalizer2.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -26,19 +26,19 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_NORMALIZATION
-#include "unicode/stringpiece.h"
+#include "unicode/stringpiece.h"
#include "unicode/uniset.h"
#include "unicode/unistr.h"
#include "unicode/unorm2.h"
U_NAMESPACE_BEGIN
-class ByteSink;
-
+class ByteSink;
+
/**
* Unicode normalization functionality for standard Unicode normalization or
* for using custom mapping tables.
@@ -220,36 +220,36 @@ public:
normalize(const UnicodeString &src,
UnicodeString &dest,
UErrorCode &errorCode) const = 0;
-
- /**
- * Normalizes a UTF-8 string and optionally records how source substrings
- * relate to changed and unchanged result substrings.
- *
- * Currently implemented completely only for "compose" modes,
- * such as for NFC, NFKC, and NFKC_Casefold
- * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS).
- * Otherwise currently converts to & from UTF-16 and does not support edits.
- *
- * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
- * @param src Source UTF-8 string.
- * @param sink A ByteSink to which the normalized UTF-8 result string is written.
- * sink.Flush() is called at the end.
- * @param edits Records edits for index mapping, working with styled text,
- * and getting only changes (if any).
- * The Edits contents is undefined if any error occurs.
- * This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be nullptr.
- * @param errorCode Standard 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.)
- * @stable ICU 60
- */
- virtual void
- normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink,
- Edits *edits, UErrorCode &errorCode) const;
-
- /**
+
+ /**
+ * Normalizes a UTF-8 string and optionally records how source substrings
+ * relate to changed and unchanged result substrings.
+ *
+ * Currently implemented completely only for "compose" modes,
+ * such as for NFC, NFKC, and NFKC_Casefold
+ * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS).
+ * Otherwise currently converts to & from UTF-16 and does not support edits.
+ *
+ * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
+ * @param src Source UTF-8 string.
+ * @param sink A ByteSink to which the normalized UTF-8 result string is written.
+ * sink.Flush() is called at the end.
+ * @param edits Records edits for index mapping, working with styled text,
+ * and getting only changes (if any).
+ * The Edits contents is undefined if any error occurs.
+ * This function calls edits->reset() first unless
+ * options includes U_EDITS_NO_RESET. edits can be nullptr.
+ * @param errorCode Standard 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.)
+ * @stable ICU 60
+ */
+ virtual void
+ normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink,
+ Edits *edits, UErrorCode &errorCode) const;
+
+ /**
* Appends the normalized form of the second string to the first string
* (merging them at the boundary) and returns the first string.
* The result is normalized if the first string was normalized.
@@ -316,7 +316,7 @@ public:
*
* When used on a standard NFC Normalizer2 instance,
* it returns the Decomposition_Mapping only if the Decomposition_Type (dt) is Canonical (Can);
- * in this case, the result contains either one or two code points (=1..4 char16_ts).
+ * 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.
@@ -374,31 +374,31 @@ public:
*/
virtual UBool
isNormalized(const UnicodeString &s, UErrorCode &errorCode) const = 0;
- /**
- * Tests if the UTF-8 string is normalized.
- * Internally, in cases where the quickCheck() method would return "maybe"
- * (which is only possible for the two COMPOSE modes) this method
- * resolves to "yes" or "no" to provide a definitive result,
- * at the cost of doing more work in those cases.
- *
- * This works for all normalization modes,
- * but it is currently optimized for UTF-8 only for "compose" modes,
- * such as for NFC, NFKC, and NFKC_Casefold
- * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS).
- * For other modes it currently converts to UTF-16 and calls isNormalized().
- *
- * @param s UTF-8 input string
- * @param errorCode Standard 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 s is normalized
- * @stable ICU 60
- */
- virtual UBool
- isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const;
-
-
+ /**
+ * Tests if the UTF-8 string is normalized.
+ * Internally, in cases where the quickCheck() method would return "maybe"
+ * (which is only possible for the two COMPOSE modes) this method
+ * resolves to "yes" or "no" to provide a definitive result,
+ * at the cost of doing more work in those cases.
+ *
+ * This works for all normalization modes,
+ * but it is currently optimized for UTF-8 only for "compose" modes,
+ * such as for NFC, NFKC, and NFKC_Casefold
+ * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS).
+ * For other modes it currently converts to UTF-16 and calls isNormalized().
+ *
+ * @param s UTF-8 input string
+ * @param errorCode Standard 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 s is normalized
+ * @stable ICU 60
+ */
+ virtual UBool
+ isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const;
+
+
/**
* Tests if the string is normalized.
* For the two COMPOSE modes, the result could be "maybe" in cases that
@@ -537,37 +537,37 @@ public:
virtual UnicodeString &
normalize(const UnicodeString &src,
UnicodeString &dest,
- UErrorCode &errorCode) const U_OVERRIDE;
-
- /**
- * Normalizes a UTF-8 string and optionally records how source substrings
- * relate to changed and unchanged result substrings.
- *
- * Currently implemented completely only for "compose" modes,
- * such as for NFC, NFKC, and NFKC_Casefold
- * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS).
- * Otherwise currently converts to & from UTF-16 and does not support edits.
- *
- * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
- * @param src Source UTF-8 string.
- * @param sink A ByteSink to which the normalized UTF-8 result string is written.
- * sink.Flush() is called at the end.
- * @param edits Records edits for index mapping, working with styled text,
- * and getting only changes (if any).
- * The Edits contents is undefined if any error occurs.
- * This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be nullptr.
- * @param errorCode Standard 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.)
- * @stable ICU 60
- */
- virtual void
- normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink,
- Edits *edits, UErrorCode &errorCode) const U_OVERRIDE;
-
- /**
+ UErrorCode &errorCode) const U_OVERRIDE;
+
+ /**
+ * Normalizes a UTF-8 string and optionally records how source substrings
+ * relate to changed and unchanged result substrings.
+ *
+ * Currently implemented completely only for "compose" modes,
+ * such as for NFC, NFKC, and NFKC_Casefold
+ * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS).
+ * Otherwise currently converts to & from UTF-16 and does not support edits.
+ *
+ * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
+ * @param src Source UTF-8 string.
+ * @param sink A ByteSink to which the normalized UTF-8 result string is written.
+ * sink.Flush() is called at the end.
+ * @param edits Records edits for index mapping, working with styled text,
+ * and getting only changes (if any).
+ * The Edits contents is undefined if any error occurs.
+ * This function calls edits->reset() first unless
+ * options includes U_EDITS_NO_RESET. edits can be nullptr.
+ * @param errorCode Standard 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.)
+ * @stable ICU 60
+ */
+ virtual void
+ normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink,
+ Edits *edits, UErrorCode &errorCode) const U_OVERRIDE;
+
+ /**
* Appends the normalized form of the second string to the first string
* (merging them at the boundary) and returns the first string.
* The result is normalized if the first string was normalized.
@@ -584,7 +584,7 @@ public:
virtual UnicodeString &
normalizeSecondAndAppend(UnicodeString &first,
const UnicodeString &second,
- UErrorCode &errorCode) const U_OVERRIDE;
+ UErrorCode &errorCode) const U_OVERRIDE;
/**
* Appends the second string to the first string
* (merging them at the boundary) and returns the first string.
@@ -602,7 +602,7 @@ public:
virtual UnicodeString &
append(UnicodeString &first,
const UnicodeString &second,
- UErrorCode &errorCode) const U_OVERRIDE;
+ UErrorCode &errorCode) const U_OVERRIDE;
/**
* Gets the decomposition mapping of c.
@@ -616,7 +616,7 @@ public:
* @stable ICU 4.6
*/
virtual UBool
- getDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE;
+ getDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE;
/**
* Gets the raw decomposition mapping of c.
@@ -630,7 +630,7 @@ public:
* @stable ICU 49
*/
virtual UBool
- getRawDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE;
+ getRawDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE;
/**
* Performs pairwise composition of a & b and returns the composite if there is one.
@@ -643,7 +643,7 @@ public:
* @stable ICU 49
*/
virtual UChar32
- composePair(UChar32 a, UChar32 b) const U_OVERRIDE;
+ composePair(UChar32 a, UChar32 b) const U_OVERRIDE;
/**
* Gets the combining class of c.
@@ -654,7 +654,7 @@ public:
* @stable ICU 49
*/
virtual uint8_t
- getCombiningClass(UChar32 c) const U_OVERRIDE;
+ getCombiningClass(UChar32 c) const U_OVERRIDE;
/**
* Tests if the string is normalized.
@@ -668,31 +668,31 @@ public:
* @stable ICU 4.4
*/
virtual UBool
- isNormalized(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE;
- /**
- * Tests if the UTF-8 string is normalized.
- * Internally, in cases where the quickCheck() method would return "maybe"
- * (which is only possible for the two COMPOSE modes) this method
- * resolves to "yes" or "no" to provide a definitive result,
- * at the cost of doing more work in those cases.
- *
- * This works for all normalization modes,
- * but it is currently optimized for UTF-8 only for "compose" modes,
- * such as for NFC, NFKC, and NFKC_Casefold
- * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS).
- * For other modes it currently converts to UTF-16 and calls isNormalized().
- *
- * @param s UTF-8 input string
- * @param errorCode Standard 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 s is normalized
- * @stable ICU 60
- */
- virtual UBool
- isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const U_OVERRIDE;
- /**
+ isNormalized(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE;
+ /**
+ * Tests if the UTF-8 string is normalized.
+ * Internally, in cases where the quickCheck() method would return "maybe"
+ * (which is only possible for the two COMPOSE modes) this method
+ * resolves to "yes" or "no" to provide a definitive result,
+ * at the cost of doing more work in those cases.
+ *
+ * This works for all normalization modes,
+ * but it is currently optimized for UTF-8 only for "compose" modes,
+ * such as for NFC, NFKC, and NFKC_Casefold
+ * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS).
+ * For other modes it currently converts to UTF-16 and calls isNormalized().
+ *
+ * @param s UTF-8 input string
+ * @param errorCode Standard 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 s is normalized
+ * @stable ICU 60
+ */
+ virtual UBool
+ isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const U_OVERRIDE;
+ /**
* Tests if the string is normalized.
* For details see the Normalizer2 base class documentation.
* @param s input string
@@ -704,7 +704,7 @@ public:
* @stable ICU 4.4
*/
virtual UNormalizationCheckResult
- quickCheck(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE;
+ quickCheck(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE;
/**
* Returns the end of the normalized substring of the input string.
* For details see the Normalizer2 base class documentation.
@@ -717,7 +717,7 @@ public:
* @stable ICU 4.4
*/
virtual int32_t
- spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE;
+ spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE;
/**
* Tests if the character always has a normalization boundary before it,
@@ -727,7 +727,7 @@ public:
* @return TRUE if c has a normalization boundary before it
* @stable ICU 4.4
*/
- virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE;
+ virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE;
/**
* Tests if the character always has a normalization boundary after it,
@@ -737,7 +737,7 @@ public:
* @return TRUE if c has a normalization boundary after it
* @stable ICU 4.4
*/
- virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE;
+ virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE;
/**
* Tests if the character is normalization-inert.
@@ -746,7 +746,7 @@ public:
* @return TRUE if c is normalization-inert
* @stable ICU 4.4
*/
- virtual UBool isInert(UChar32 c) const U_OVERRIDE;
+ virtual UBool isInert(UChar32 c) const U_OVERRIDE;
private:
UnicodeString &
normalize(const UnicodeString &src,
@@ -754,12 +754,12 @@ private:
USetSpanCondition spanCondition,
UErrorCode &errorCode) const;
- void
- normalizeUTF8(uint32_t options, const char *src, int32_t length,
- ByteSink &sink, Edits *edits,
- USetSpanCondition spanCondition,
- UErrorCode &errorCode) const;
-
+ void
+ normalizeUTF8(uint32_t options, const char *src, int32_t length,
+ ByteSink &sink, Edits *edits,
+ USetSpanCondition spanCondition,
+ UErrorCode &errorCode) const;
+
UnicodeString &
normalizeSecondAndAppend(UnicodeString &first,
const UnicodeString &second,
@@ -773,7 +773,7 @@ private:
U_NAMESPACE_END
#endif // !UCONFIG_NO_NORMALIZATION
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __NORMALIZER2_H__
diff --git a/contrib/libs/icu/include/unicode/normlzr.h b/contrib/libs/icu/include/unicode/normlzr.h
index 4921786ee5..07a596bd11 100644
--- a/contrib/libs/icu/include/unicode/normlzr.h
+++ b/contrib/libs/icu/include/unicode/normlzr.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************
@@ -13,8 +13,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: Unicode Normalization
@@ -170,7 +170,7 @@ public:
* @param mode The normalization mode.
* @deprecated ICU 56 Use Normalizer2 instead.
*/
- Normalizer(ConstChar16Ptr str, int32_t length, UNormalizationMode mode);
+ Normalizer(ConstChar16Ptr str, int32_t length, UNormalizationMode mode);
/**
* Creates a new <code>Normalizer</code> object for iterating over the
@@ -185,7 +185,7 @@ public:
Normalizer(const CharacterIterator& iter, UNormalizationMode mode);
#endif /* U_HIDE_DEPRECATED_API */
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Copy constructor.
* @param copy The object to be copied.
@@ -198,7 +198,7 @@ public:
* @deprecated ICU 56 Use Normalizer2 instead.
*/
virtual ~Normalizer();
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
//-------------------------------------------------------------------------
// Static utility methods
@@ -602,7 +602,7 @@ public:
* @return a pointer to a new Normalizer
* @deprecated ICU 56 Use Normalizer2 instead.
*/
- Normalizer* clone() const;
+ Normalizer* clone() const;
/**
* Generates a hash code for this iterator.
@@ -707,7 +707,7 @@ public:
* @param status a UErrorCode
* @deprecated ICU 56 Use Normalizer2 instead.
*/
- void setText(ConstChar16Ptr newText,
+ void setText(ConstChar16Ptr newText,
int32_t length,
UErrorCode &status);
/**
@@ -726,14 +726,14 @@ public:
static UClassID U_EXPORT2 getStaticClassID();
#endif /* U_HIDE_DEPRECATED_API */
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
* @return a UClassID for the actual class.
* @deprecated ICU 56 Use Normalizer2 instead.
*/
virtual UClassID getDynamicClassID() const;
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
private:
//-------------------------------------------------------------------------
@@ -801,8 +801,8 @@ Normalizer::compare(const UnicodeString &s1, const UnicodeString &s2,
uint32_t options,
UErrorCode &errorCode) {
// all argument checking is done in unorm_compare
- return unorm_compare(toUCharPtr(s1.getBuffer()), s1.length(),
- toUCharPtr(s2.getBuffer()), s2.length(),
+ return unorm_compare(toUCharPtr(s1.getBuffer()), s1.length(),
+ toUCharPtr(s2.getBuffer()), s2.length(),
options,
&errorCode);
}
@@ -812,5 +812,5 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_NORMALIZATION */
#endif // NORMLZR_H
-
-#endif /* U_SHOW_CPLUSPLUS_API */
+
+#endif /* U_SHOW_CPLUSPLUS_API */
diff --git a/contrib/libs/icu/include/unicode/nounit.h b/contrib/libs/icu/include/unicode/nounit.h
index ad9bb68276..61b5c16ee3 100644
--- a/contrib/libs/icu/include/unicode/nounit.h
+++ b/contrib/libs/icu/include/unicode/nounit.h
@@ -1,116 +1,116 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
- *******************************************************************************
- * Copyright (C) 2009-2017, International Business Machines Corporation, *
- * Google, and others. All Rights Reserved. *
- *******************************************************************************
- */
-
-#ifndef __NOUNIT_H__
-#define __NOUNIT_H__
-
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/measunit.h"
-
-#ifndef U_HIDE_DRAFT_API
-
-/**
- * \file
- * \brief C++ API: units for percent and permille
- */
-
-U_NAMESPACE_BEGIN
-
-/**
- * Dimensionless unit for percent and permille.
- * @see NumberFormatter
- * @draft ICU 60
- */
-class U_I18N_API NoUnit: public MeasureUnit {
-public:
- /**
- * Returns an instance for the base unit (dimensionless and no scaling).
- *
- * @return a NoUnit instance
- * @draft ICU 60
- */
- static NoUnit U_EXPORT2 base();
-
- /**
- * Returns an instance for percent, or 1/100 of a base unit.
- *
- * @return a NoUnit instance
- * @draft ICU 60
- */
- static NoUnit U_EXPORT2 percent();
-
- /**
- * Returns an instance for permille, or 1/1000 of a base unit.
- *
- * @return a NoUnit instance
- * @draft ICU 60
- */
- static NoUnit U_EXPORT2 permille();
-
- /**
- * Copy operator.
- * @draft ICU 60
- */
- NoUnit(const NoUnit& other);
-
- /**
- * Destructor.
- * @draft ICU 60
- */
- virtual ~NoUnit();
-
- /**
- * Return a polymorphic clone of this object. The result will
- * have the same class as returned by getDynamicClassID().
- * @draft ICU 60
- */
- virtual NoUnit* clone() const;
-
- /**
- * Returns a unique class ID for this object POLYMORPHICALLY.
- * This method implements a simple form of RTTI used by ICU.
- * @return The class ID for this object. All objects of a given
- * class have the same class ID. Objects of other classes have
- * different class IDs.
- * @draft ICU 60
- */
- virtual UClassID getDynamicClassID() const;
-
- /**
- * Returns the class ID for this class. This is used to compare to
- * the return value of getDynamicClassID().
- * @return The class ID for all objects of this class.
- * @draft ICU 60
- */
- static UClassID U_EXPORT2 getStaticClassID();
-
-private:
- /**
- * Constructor
- * @internal (private)
- */
- NoUnit(const char* subtype);
-
-};
-
-U_NAMESPACE_END
-
-#endif /* U_HIDE_DRAFT_API */
-#endif /* #if !UCONFIG_NO_FORMATTING */
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
-#endif // __NOUNIT_H__
-//eof
-//
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+ *******************************************************************************
+ * Copyright (C) 2009-2017, International Business Machines Corporation, *
+ * Google, and others. All Rights Reserved. *
+ *******************************************************************************
+ */
+
+#ifndef __NOUNIT_H__
+#define __NOUNIT_H__
+
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/measunit.h"
+
+#ifndef U_HIDE_DRAFT_API
+
+/**
+ * \file
+ * \brief C++ API: units for percent and permille
+ */
+
+U_NAMESPACE_BEGIN
+
+/**
+ * Dimensionless unit for percent and permille.
+ * @see NumberFormatter
+ * @draft ICU 60
+ */
+class U_I18N_API NoUnit: public MeasureUnit {
+public:
+ /**
+ * Returns an instance for the base unit (dimensionless and no scaling).
+ *
+ * @return a NoUnit instance
+ * @draft ICU 60
+ */
+ static NoUnit U_EXPORT2 base();
+
+ /**
+ * Returns an instance for percent, or 1/100 of a base unit.
+ *
+ * @return a NoUnit instance
+ * @draft ICU 60
+ */
+ static NoUnit U_EXPORT2 percent();
+
+ /**
+ * Returns an instance for permille, or 1/1000 of a base unit.
+ *
+ * @return a NoUnit instance
+ * @draft ICU 60
+ */
+ static NoUnit U_EXPORT2 permille();
+
+ /**
+ * Copy operator.
+ * @draft ICU 60
+ */
+ NoUnit(const NoUnit& other);
+
+ /**
+ * Destructor.
+ * @draft ICU 60
+ */
+ virtual ~NoUnit();
+
+ /**
+ * Return a polymorphic clone of this object. The result will
+ * have the same class as returned by getDynamicClassID().
+ * @draft ICU 60
+ */
+ virtual NoUnit* clone() const;
+
+ /**
+ * Returns a unique class ID for this object POLYMORPHICALLY.
+ * This method implements a simple form of RTTI used by ICU.
+ * @return The class ID for this object. All objects of a given
+ * class have the same class ID. Objects of other classes have
+ * different class IDs.
+ * @draft ICU 60
+ */
+ virtual UClassID getDynamicClassID() const;
+
+ /**
+ * Returns the class ID for this class. This is used to compare to
+ * the return value of getDynamicClassID().
+ * @return The class ID for all objects of this class.
+ * @draft ICU 60
+ */
+ static UClassID U_EXPORT2 getStaticClassID();
+
+private:
+ /**
+ * Constructor
+ * @internal (private)
+ */
+ NoUnit(const char* subtype);
+
+};
+
+U_NAMESPACE_END
+
+#endif /* U_HIDE_DRAFT_API */
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
+#endif // __NOUNIT_H__
+//eof
+//
diff --git a/contrib/libs/icu/include/unicode/numberformatter.h b/contrib/libs/icu/include/unicode/numberformatter.h
index 0f128ed7ab..615cf49f7b 100644
--- a/contrib/libs/icu/include/unicode/numberformatter.h
+++ b/contrib/libs/icu/include/unicode/numberformatter.h
@@ -1,2642 +1,2642 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#ifndef __NUMBERFORMATTER_H__
-#define __NUMBERFORMATTER_H__
-
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/appendable.h"
-#include "unicode/bytestream.h"
-#include "unicode/currunit.h"
-#include "unicode/dcfmtsym.h"
-#include "unicode/fieldpos.h"
-#include "unicode/formattedvalue.h"
-#include "unicode/fpositer.h"
-#include "unicode/measunit.h"
-#include "unicode/nounit.h"
-#include "unicode/parseerr.h"
-#include "unicode/plurrule.h"
-#include "unicode/ucurr.h"
-#include "unicode/unum.h"
-#include "unicode/unumberformatter.h"
-#include "unicode/uobject.h"
-
-/**
- * \file
- * \brief C++ API: Library for localized number formatting introduced in ICU 60.
- *
- * This library was introduced in ICU 60 to simplify the process of formatting localized number strings.
- * Basic usage examples:
- *
- * <pre>
- * // Most basic usage:
- * NumberFormatter::withLocale(...).format(123).toString(); // 1,234 in en-US
- *
- * // Custom notation, unit, and rounding precision:
- * NumberFormatter::with()
- * .notation(Notation::compactShort())
- * .unit(CurrencyUnit("EUR", status))
- * .precision(Precision::maxDigits(2))
- * .locale(...)
- * .format(1234)
- * .toString(); // €1.2K in en-US
- *
- * // Create a formatter in a singleton by value for use later:
- * static const LocalizedNumberFormatter formatter = NumberFormatter::withLocale(...)
- * .unit(NoUnit::percent())
- * .precision(Precision::fixedFraction(3));
- * formatter.format(5.9831).toString(); // 5.983% in en-US
- *
- * // Create a "template" in a singleton unique_ptr but without setting a locale until the call site:
- * std::unique_ptr<UnlocalizedNumberFormatter> template = NumberFormatter::with()
- * .sign(UNumberSignDisplay::UNUM_SIGN_ALWAYS)
- * .unit(MeasureUnit::getMeter())
- * .unitWidth(UNumberUnitWidth::UNUM_UNIT_WIDTH_FULL_NAME)
- * .clone();
- * template->locale(...).format(1234).toString(); // +1,234 meters in en-US
- * </pre>
- *
- * <p>
- * This API offers more features than DecimalFormat and is geared toward new users of ICU.
- *
- * <p>
- * NumberFormatter instances (i.e., LocalizedNumberFormatter and UnlocalizedNumberFormatter)
- * are immutable and thread safe. This means that invoking a configuration method has no
- * effect on the receiving instance; you must store and use the new number formatter instance it returns instead.
- *
- * <pre>
- * UnlocalizedNumberFormatter formatter = UnlocalizedNumberFormatter::with().notation(Notation::scientific());
- * formatter.precision(Precision.maxFraction(2)); // does nothing!
- * formatter.locale(Locale.getEnglish()).format(9.8765).toString(); // prints "9.8765E0", not "9.88E0"
- * </pre>
- *
- * <p>
- * This API is based on the <em>fluent</em> design pattern popularized by libraries such as Google's Guava. For
- * extensive details on the design of this API, read <a href="https://goo.gl/szi5VB">the design doc</a>.
- *
- * @author Shane Carr
- */
-
-U_NAMESPACE_BEGIN
-
-// Forward declarations:
-class IFixedDecimal;
-class FieldPositionIteratorHandler;
-class FormattedStringBuilder;
-
-namespace numparse {
-namespace impl {
-
-// Forward declarations:
-class NumberParserImpl;
-class MultiplierParseHandler;
-
-}
-}
-
-namespace number { // icu::number
-
-// Forward declarations:
-class UnlocalizedNumberFormatter;
-class LocalizedNumberFormatter;
-class FormattedNumber;
-class Notation;
-class ScientificNotation;
-class Precision;
-class FractionPrecision;
-class CurrencyPrecision;
-class IncrementPrecision;
-class IntegerWidth;
-
-namespace impl {
-
-// can't be #ifndef U_HIDE_INTERNAL_API; referenced throughout this file in public classes
-/**
- * Datatype for minimum/maximum fraction digits. Must be able to hold kMaxIntFracSig.
- *
- * @internal
- */
-typedef int16_t digits_t;
-
-// can't be #ifndef U_HIDE_INTERNAL_API; needed for struct initialization
-/**
- * Use a default threshold of 3. This means that the third time .format() is called, the data structures get built
- * using the "safe" code path. The first two calls to .format() will trigger the unsafe code path.
- *
- * @internal
- */
-static constexpr int32_t kInternalDefaultThreshold = 3;
-
-// Forward declarations:
-class Padder;
-struct MacroProps;
-struct MicroProps;
-class DecimalQuantity;
-class UFormattedNumberData;
-class NumberFormatterImpl;
-struct ParsedPatternInfo;
-class ScientificModifier;
-class MultiplierProducer;
-class RoundingImpl;
-class ScientificHandler;
-class Modifier;
-class AffixPatternProvider;
-class NumberPropertyMapper;
-struct DecimalFormatProperties;
-class MultiplierFormatHandler;
-class CurrencySymbols;
-class GeneratorHelpers;
-class DecNum;
-class NumberRangeFormatterImpl;
-struct RangeMacroProps;
-struct UFormattedNumberImpl;
-class MutablePatternModifier;
-class ImmutablePatternModifier;
-
-/**
- * Used for NumberRangeFormatter and implemented in numrange_fluent.cpp.
- * Declared here so it can be friended.
- *
- * @internal
- */
-void touchRangeLocales(impl::RangeMacroProps& macros);
-
-} // namespace impl
-
-/**
- * Extra name reserved in case it is needed in the future.
- *
- * @stable ICU 63
- */
-typedef Notation CompactNotation;
-
-/**
- * Extra name reserved in case it is needed in the future.
- *
- * @stable ICU 63
- */
-typedef Notation SimpleNotation;
-
-/**
- * A class that defines the notation style to be used when formatting numbers in NumberFormatter.
- *
- * @stable ICU 60
- */
-class U_I18N_API Notation : public UMemory {
- public:
- /**
- * Print the number using scientific notation (also known as scientific form, standard index form, or standard form
- * in the UK). The format for scientific notation varies by locale; for example, many Western locales display the
- * number in the form "#E0", where the number is displayed with one digit before the decimal separator, zero or more
- * digits after the decimal separator, and the corresponding power of 10 displayed after the "E".
- *
- * <p>
- * Example outputs in <em>en-US</em> when printing 8.765E4 through 8.765E-3:
- *
- * <pre>
- * 8.765E4
- * 8.765E3
- * 8.765E2
- * 8.765E1
- * 8.765E0
- * 8.765E-1
- * 8.765E-2
- * 8.765E-3
- * 0E0
- * </pre>
- *
- * @return A ScientificNotation for chaining or passing to the NumberFormatter notation() setter.
- * @stable ICU 60
- */
- static ScientificNotation scientific();
-
- /**
- * Print the number using engineering notation, a variant of scientific notation in which the exponent must be
- * divisible by 3.
- *
- * <p>
- * Example outputs in <em>en-US</em> when printing 8.765E4 through 8.765E-3:
- *
- * <pre>
- * 87.65E3
- * 8.765E3
- * 876.5E0
- * 87.65E0
- * 8.765E0
- * 876.5E-3
- * 87.65E-3
- * 8.765E-3
- * 0E0
- * </pre>
- *
- * @return A ScientificNotation for chaining or passing to the NumberFormatter notation() setter.
- * @stable ICU 60
- */
- static ScientificNotation engineering();
-
- /**
- * Print the number using short-form compact notation.
- *
- * <p>
- * <em>Compact notation</em>, defined in Unicode Technical Standard #35 Part 3 Section 2.4.1, prints numbers with
- * localized prefixes or suffixes corresponding to different powers of ten. Compact notation is similar to
- * engineering notation in how it scales numbers.
- *
- * <p>
- * Compact notation is ideal for displaying large numbers (over ~1000) to humans while at the same time minimizing
- * screen real estate.
- *
- * <p>
- * In short form, the powers of ten are abbreviated. In <em>en-US</em>, the abbreviations are "K" for thousands, "M"
- * for millions, "B" for billions, and "T" for trillions. Example outputs in <em>en-US</em> when printing 8.765E7
- * through 8.765E0:
- *
- * <pre>
- * 88M
- * 8.8M
- * 876K
- * 88K
- * 8.8K
- * 876
- * 88
- * 8.8
- * </pre>
- *
- * <p>
- * When compact notation is specified without an explicit rounding precision, numbers are rounded off to the closest
- * integer after scaling the number by the corresponding power of 10, but with a digit shown after the decimal
- * separator if there is only one digit before the decimal separator. The default compact notation rounding precision
- * is equivalent to:
- *
- * <pre>
- * Precision::integer().withMinDigits(2)
- * </pre>
- *
- * @return A CompactNotation for passing to the NumberFormatter notation() setter.
- * @stable ICU 60
- */
- static CompactNotation compactShort();
-
- /**
- * Print the number using long-form compact notation. For more information on compact notation, see
- * {@link #compactShort}.
- *
- * <p>
- * In long form, the powers of ten are spelled out fully. Example outputs in <em>en-US</em> when printing 8.765E7
- * through 8.765E0:
- *
- * <pre>
- * 88 million
- * 8.8 million
- * 876 thousand
- * 88 thousand
- * 8.8 thousand
- * 876
- * 88
- * 8.8
- * </pre>
- *
- * @return A CompactNotation for passing to the NumberFormatter notation() setter.
- * @stable ICU 60
- */
- static CompactNotation compactLong();
-
- /**
- * Print the number using simple notation without any scaling by powers of ten. This is the default behavior.
- *
- * <p>
- * Since this is the default behavior, this method needs to be called only when it is necessary to override a
- * previous setting.
- *
- * <p>
- * Example outputs in <em>en-US</em> when printing 8.765E7 through 8.765E0:
- *
- * <pre>
- * 87,650,000
- * 8,765,000
- * 876,500
- * 87,650
- * 8,765
- * 876.5
- * 87.65
- * 8.765
- * </pre>
- *
- * @return A SimpleNotation for passing to the NumberFormatter notation() setter.
- * @stable ICU 60
- */
- static SimpleNotation simple();
-
- private:
- enum NotationType {
- NTN_SCIENTIFIC, NTN_COMPACT, NTN_SIMPLE, NTN_ERROR
- } fType;
-
- union NotationUnion {
- // For NTN_SCIENTIFIC
- /** @internal */
- struct ScientificSettings {
- /** @internal */
- int8_t fEngineeringInterval;
- /** @internal */
- bool fRequireMinInt;
- /** @internal */
- impl::digits_t fMinExponentDigits;
- /** @internal */
- UNumberSignDisplay fExponentSignDisplay;
- } scientific;
-
- // For NTN_COMPACT
- UNumberCompactStyle compactStyle;
-
- // For NTN_ERROR
- UErrorCode errorCode;
- } fUnion;
-
- typedef NotationUnion::ScientificSettings ScientificSettings;
-
- Notation(const NotationType &type, const NotationUnion &union_) : fType(type), fUnion(union_) {}
-
- Notation(UErrorCode errorCode) : fType(NTN_ERROR) {
- fUnion.errorCode = errorCode;
- }
-
- Notation() : fType(NTN_SIMPLE), fUnion() {}
-
- UBool copyErrorTo(UErrorCode &status) const {
- if (fType == NTN_ERROR) {
- status = fUnion.errorCode;
- return TRUE;
- }
- return FALSE;
- }
-
- // To allow MacroProps to initialize empty instances:
- friend struct impl::MacroProps;
- friend class ScientificNotation;
-
- // To allow implementation to access internal types:
- friend class impl::NumberFormatterImpl;
- friend class impl::ScientificModifier;
- friend class impl::ScientificHandler;
-
- // To allow access to the skeleton generation code:
- friend class impl::GeneratorHelpers;
-};
-
-/**
- * A class that defines the scientific notation style to be used when formatting numbers in NumberFormatter.
- *
- * <p>
- * To create a ScientificNotation, use one of the factory methods in {@link Notation}.
- *
- * @stable ICU 60
- */
-class U_I18N_API ScientificNotation : public Notation {
- public:
- /**
- * Sets the minimum number of digits to show in the exponent of scientific notation, padding with zeros if
- * necessary. Useful for fixed-width display.
- *
- * <p>
- * For example, with minExponentDigits=2, the number 123 will be printed as "1.23E02" in <em>en-US</em> instead of
- * the default "1.23E2".
- *
- * @param minExponentDigits
- * The minimum number of digits to show in the exponent.
- * @return A ScientificNotation, for chaining.
- * @stable ICU 60
- */
- ScientificNotation withMinExponentDigits(int32_t minExponentDigits) const;
-
- /**
- * Sets whether to show the sign on positive and negative exponents in scientific notation. The default is AUTO,
- * showing the minus sign but not the plus sign.
- *
- * <p>
- * For example, with exponentSignDisplay=ALWAYS, the number 123 will be printed as "1.23E+2" in <em>en-US</em>
- * instead of the default "1.23E2".
- *
- * @param exponentSignDisplay
- * The strategy for displaying the sign in the exponent.
- * @return A ScientificNotation, for chaining.
- * @stable ICU 60
- */
- ScientificNotation withExponentSignDisplay(UNumberSignDisplay exponentSignDisplay) const;
-
- private:
- // Inherit constructor
- using Notation::Notation;
-
- // Raw constructor for NumberPropertyMapper
- ScientificNotation(int8_t fEngineeringInterval, bool fRequireMinInt, impl::digits_t fMinExponentDigits,
- UNumberSignDisplay fExponentSignDisplay);
-
- friend class Notation;
-
- // So that NumberPropertyMapper can create instances
- friend class impl::NumberPropertyMapper;
-};
-
-/**
- * Extra name reserved in case it is needed in the future.
- *
- * @stable ICU 63
- */
-typedef Precision SignificantDigitsPrecision;
-
-/**
- * A class that defines the rounding precision to be used when formatting numbers in NumberFormatter.
- *
- * <p>
- * To create a Precision, use one of the factory methods.
- *
- * @stable ICU 60
- */
-class U_I18N_API Precision : public UMemory {
-
- public:
- /**
- * Show all available digits to full precision.
- *
- * <p>
- * <strong>NOTE:</strong> When formatting a <em>double</em>, this method, along with {@link #minFraction} and
- * {@link #minSignificantDigits}, will trigger complex algorithm similar to <em>Dragon4</em> to determine the
- * low-order digits and the number of digits to display based on the value of the double.
- * If the number of fraction places or significant digits can be bounded, consider using {@link #maxFraction}
- * or {@link #maxSignificantDigits} instead to maximize performance.
- * For more information, read the following blog post.
- *
- * <p>
- * http://www.serpentine.com/blog/2011/06/29/here-be-dragons-advances-in-problems-you-didnt-even-know-you-had/
- *
- * @return A Precision for chaining or passing to the NumberFormatter precision() setter.
- * @stable ICU 60
- */
- static Precision unlimited();
-
- /**
- * Show numbers rounded if necessary to the nearest integer.
- *
- * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter.
- * @stable ICU 60
- */
- static FractionPrecision integer();
-
- /**
- * Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator).
- * Additionally, pad with zeros to ensure that this number of places are always shown.
- *
- * <p>
- * Example output with minMaxFractionPlaces = 3:
- *
- * <p>
- * 87,650.000<br>
- * 8,765.000<br>
- * 876.500<br>
- * 87.650<br>
- * 8.765<br>
- * 0.876<br>
- * 0.088<br>
- * 0.009<br>
- * 0.000 (zero)
- *
- * <p>
- * This method is equivalent to {@link #minMaxFraction} with both arguments equal.
- *
- * @param minMaxFractionPlaces
- * The minimum and maximum number of numerals to display after the decimal separator (rounding if too
- * long or padding with zeros if too short).
- * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter.
- * @stable ICU 60
- */
- static FractionPrecision fixedFraction(int32_t minMaxFractionPlaces);
-
- /**
- * Always show at least a certain number of fraction places after the decimal separator, padding with zeros if
- * necessary. Do not perform rounding (display numbers to their full precision).
- *
- * <p>
- * <strong>NOTE:</strong> If you are formatting <em>doubles</em>, see the performance note in {@link #unlimited}.
- *
- * @param minFractionPlaces
- * The minimum number of numerals to display after the decimal separator (padding with zeros if
- * necessary).
- * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter.
- * @stable ICU 60
- */
- static FractionPrecision minFraction(int32_t minFractionPlaces);
-
- /**
- * Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator).
- * Unlike the other fraction rounding strategies, this strategy does <em>not</em> pad zeros to the end of the
- * number.
- *
- * @param maxFractionPlaces
- * The maximum number of numerals to display after the decimal mark (rounding if necessary).
- * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter.
- * @stable ICU 60
- */
- static FractionPrecision maxFraction(int32_t maxFractionPlaces);
-
- /**
- * Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator);
- * in addition, always show at least a certain number of places after the decimal separator, padding with zeros if
- * necessary.
- *
- * @param minFractionPlaces
- * The minimum number of numerals to display after the decimal separator (padding with zeros if
- * necessary).
- * @param maxFractionPlaces
- * The maximum number of numerals to display after the decimal separator (rounding if necessary).
- * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter.
- * @stable ICU 60
- */
- static FractionPrecision minMaxFraction(int32_t minFractionPlaces, int32_t maxFractionPlaces);
-
- /**
- * Show numbers rounded if necessary to a certain number of significant digits or significant figures. Additionally,
- * pad with zeros to ensure that this number of significant digits/figures are always shown.
- *
- * <p>
- * This method is equivalent to {@link #minMaxSignificantDigits} with both arguments equal.
- *
- * @param minMaxSignificantDigits
- * The minimum and maximum number of significant digits to display (rounding if too long or padding with
- * zeros if too short).
- * @return A precision for chaining or passing to the NumberFormatter precision() setter.
- * @stable ICU 62
- */
- static SignificantDigitsPrecision fixedSignificantDigits(int32_t minMaxSignificantDigits);
-
- /**
- * Always show at least a certain number of significant digits/figures, padding with zeros if necessary. Do not
- * perform rounding (display numbers to their full precision).
- *
- * <p>
- * <strong>NOTE:</strong> If you are formatting <em>doubles</em>, see the performance note in {@link #unlimited}.
- *
- * @param minSignificantDigits
- * The minimum number of significant digits to display (padding with zeros if too short).
- * @return A precision for chaining or passing to the NumberFormatter precision() setter.
- * @stable ICU 62
- */
- static SignificantDigitsPrecision minSignificantDigits(int32_t minSignificantDigits);
-
- /**
- * Show numbers rounded if necessary to a certain number of significant digits/figures.
- *
- * @param maxSignificantDigits
- * The maximum number of significant digits to display (rounding if too long).
- * @return A precision for chaining or passing to the NumberFormatter precision() setter.
- * @stable ICU 62
- */
- static SignificantDigitsPrecision maxSignificantDigits(int32_t maxSignificantDigits);
-
- /**
- * Show numbers rounded if necessary to a certain number of significant digits/figures; in addition, always show at
- * least a certain number of significant digits, padding with zeros if necessary.
- *
- * @param minSignificantDigits
- * The minimum number of significant digits to display (padding with zeros if necessary).
- * @param maxSignificantDigits
- * The maximum number of significant digits to display (rounding if necessary).
- * @return A precision for chaining or passing to the NumberFormatter precision() setter.
- * @stable ICU 62
- */
- static SignificantDigitsPrecision minMaxSignificantDigits(int32_t minSignificantDigits,
- int32_t maxSignificantDigits);
-
- /**
- * Show numbers rounded if necessary to the closest multiple of a certain rounding increment. For example, if the
- * rounding increment is 0.5, then round 1.2 to 1 and round 1.3 to 1.5.
- *
- * <p>
- * In order to ensure that numbers are padded to the appropriate number of fraction places, call
- * withMinFraction() on the return value of this method.
- * For example, to round to the nearest 0.5 and always display 2 numerals after the
- * decimal separator (to display 1.2 as "1.00" and 1.3 as "1.50"), you can run:
- *
- * <pre>
- * Precision::increment(0.5).withMinFraction(2)
- * </pre>
- *
- * @param roundingIncrement
- * The increment to which to round numbers.
- * @return A precision for chaining or passing to the NumberFormatter precision() setter.
- * @stable ICU 60
- */
- static IncrementPrecision increment(double roundingIncrement);
-
- /**
- * Show numbers rounded and padded according to the rules for the currency unit. The most common
- * rounding precision settings for currencies include <code>Precision::fixedFraction(2)</code>,
- * <code>Precision::integer()</code>, and <code>Precision::increment(0.05)</code> for cash transactions
- * ("nickel rounding").
- *
- * <p>
- * The exact rounding details will be resolved at runtime based on the currency unit specified in the
- * NumberFormatter chain. To round according to the rules for one currency while displaying the symbol for another
- * currency, the withCurrency() method can be called on the return value of this method.
- *
- * @param currencyUsage
- * Either STANDARD (for digital transactions) or CASH (for transactions where the rounding increment may
- * be limited by the available denominations of cash or coins).
- * @return A CurrencyPrecision for chaining or passing to the NumberFormatter precision() setter.
- * @stable ICU 60
- */
- static CurrencyPrecision currency(UCurrencyUsage currencyUsage);
-
- private:
- enum PrecisionType {
- RND_BOGUS,
- RND_NONE,
- RND_FRACTION,
- RND_SIGNIFICANT,
- RND_FRACTION_SIGNIFICANT,
-
- // Used for strange increments like 3.14.
- RND_INCREMENT,
-
- // Used for increments with 1 as the only digit. This is different than fraction
- // rounding because it supports having additional trailing zeros. For example, this
- // class is used to round with the increment 0.010.
- RND_INCREMENT_ONE,
-
- // Used for increments with 5 as the only digit (nickel rounding).
- RND_INCREMENT_FIVE,
-
- RND_CURRENCY,
- RND_ERROR
- } fType;
-
- union PrecisionUnion {
- /** @internal */
- struct FractionSignificantSettings {
- // For RND_FRACTION, RND_SIGNIFICANT, and RND_FRACTION_SIGNIFICANT
- /** @internal */
- impl::digits_t fMinFrac;
- /** @internal */
- impl::digits_t fMaxFrac;
- /** @internal */
- impl::digits_t fMinSig;
- /** @internal */
- impl::digits_t fMaxSig;
- } fracSig;
- /** @internal */
- struct IncrementSettings {
- // For RND_INCREMENT, RND_INCREMENT_ONE, and RND_INCREMENT_FIVE
- /** @internal */
- double fIncrement;
- /** @internal */
- impl::digits_t fMinFrac;
- /** @internal */
- impl::digits_t fMaxFrac;
- } increment;
- UCurrencyUsage currencyUsage; // For RND_CURRENCY
- UErrorCode errorCode; // For RND_ERROR
- } fUnion;
-
- typedef PrecisionUnion::FractionSignificantSettings FractionSignificantSettings;
- typedef PrecisionUnion::IncrementSettings IncrementSettings;
-
- /** The Precision encapsulates the RoundingMode when used within the implementation. */
- UNumberFormatRoundingMode fRoundingMode;
-
- Precision(const PrecisionType& type, const PrecisionUnion& union_,
- UNumberFormatRoundingMode roundingMode)
- : fType(type), fUnion(union_), fRoundingMode(roundingMode) {}
-
- Precision(UErrorCode errorCode) : fType(RND_ERROR) {
- fUnion.errorCode = errorCode;
- }
-
- Precision() : fType(RND_BOGUS) {}
-
- bool isBogus() const {
- return fType == RND_BOGUS;
- }
-
- UBool copyErrorTo(UErrorCode &status) const {
- if (fType == RND_ERROR) {
- status = fUnion.errorCode;
- return TRUE;
- }
- return FALSE;
- }
-
- // On the parent type so that this method can be called internally on Precision instances.
- Precision withCurrency(const CurrencyUnit &currency, UErrorCode &status) const;
-
- static FractionPrecision constructFraction(int32_t minFrac, int32_t maxFrac);
-
- static Precision constructSignificant(int32_t minSig, int32_t maxSig);
-
- static Precision
- constructFractionSignificant(const FractionPrecision &base, int32_t minSig, int32_t maxSig);
-
- static IncrementPrecision constructIncrement(double increment, int32_t minFrac);
-
- static CurrencyPrecision constructCurrency(UCurrencyUsage usage);
-
- static Precision constructPassThrough();
-
- // To allow MacroProps/MicroProps to initialize bogus instances:
- friend struct impl::MacroProps;
- friend struct impl::MicroProps;
-
- // To allow NumberFormatterImpl to access isBogus() and other internal methods:
- friend class impl::NumberFormatterImpl;
-
- // To allow NumberPropertyMapper to create instances from DecimalFormatProperties:
- friend class impl::NumberPropertyMapper;
-
- // To allow access to the main implementation class:
- friend class impl::RoundingImpl;
-
- // To allow child classes to call private methods:
- friend class FractionPrecision;
- friend class CurrencyPrecision;
- friend class IncrementPrecision;
-
- // To allow access to the skeleton generation code:
- friend class impl::GeneratorHelpers;
-};
-
-/**
- * A class that defines a rounding precision based on a number of fraction places and optionally significant digits to be
- * used when formatting numbers in NumberFormatter.
- *
- * <p>
- * To create a FractionPrecision, use one of the factory methods on Precision.
- *
- * @stable ICU 60
- */
-class U_I18N_API FractionPrecision : public Precision {
- public:
- /**
- * Ensure that no less than this number of significant digits are retained when rounding according to fraction
- * rules.
- *
- * <p>
- * For example, with integer rounding, the number 3.141 becomes "3". However, with minimum figures set to 2, 3.141
- * becomes "3.1" instead.
- *
- * <p>
- * This setting does not affect the number of trailing zeros. For example, 3.01 would print as "3", not "3.0".
- *
- * @param minSignificantDigits
- * The number of significant figures to guarantee.
- * @return A precision for chaining or passing to the NumberFormatter precision() setter.
- * @stable ICU 60
- */
- Precision withMinDigits(int32_t minSignificantDigits) const;
-
- /**
- * Ensure that no more than this number of significant digits are retained when rounding according to fraction
- * rules.
- *
- * <p>
- * For example, with integer rounding, the number 123.4 becomes "123". However, with maximum figures set to 2, 123.4
- * becomes "120" instead.
- *
- * <p>
- * This setting does not affect the number of trailing zeros. For example, with fixed fraction of 2, 123.4 would
- * become "120.00".
- *
- * @param maxSignificantDigits
- * Round the number to no more than this number of significant figures.
- * @return A precision for chaining or passing to the NumberFormatter precision() setter.
- * @stable ICU 60
- */
- Precision withMaxDigits(int32_t maxSignificantDigits) const;
-
- private:
- // Inherit constructor
- using Precision::Precision;
-
- // To allow parent class to call this class's constructor:
- friend class Precision;
-};
-
-/**
- * A class that defines a rounding precision parameterized by a currency to be used when formatting numbers in
- * NumberFormatter.
- *
- * <p>
- * To create a CurrencyPrecision, use one of the factory methods on Precision.
- *
- * @stable ICU 60
- */
-class U_I18N_API CurrencyPrecision : public Precision {
- public:
- /**
- * Associates a currency with this rounding precision.
- *
- * <p>
- * <strong>Calling this method is <em>not required</em></strong>, because the currency specified in unit()
- * is automatically applied to currency rounding precisions. However,
- * this method enables you to override that automatic association.
- *
- * <p>
- * This method also enables numbers to be formatted using currency rounding rules without explicitly using a
- * currency format.
- *
- * @param currency
- * The currency to associate with this rounding precision.
- * @return A precision for chaining or passing to the NumberFormatter precision() setter.
- * @stable ICU 60
- */
- Precision withCurrency(const CurrencyUnit &currency) const;
-
- private:
- // Inherit constructor
- using Precision::Precision;
-
- // To allow parent class to call this class's constructor:
- friend class Precision;
-};
-
-/**
- * A class that defines a rounding precision parameterized by a rounding increment to be used when formatting numbers in
- * NumberFormatter.
- *
- * <p>
- * To create an IncrementPrecision, use one of the factory methods on Precision.
- *
- * @stable ICU 60
- */
-class U_I18N_API IncrementPrecision : public Precision {
- public:
- /**
- * Specifies the minimum number of fraction digits to render after the decimal separator, padding with zeros if
- * necessary. By default, no trailing zeros are added.
- *
- * <p>
- * For example, if the rounding increment is 0.5 and minFrac is 2, then the resulting strings include "0.00",
- * "0.50", "1.00", and "1.50".
- *
- * <p>
- * Note: In ICU4J, this functionality is accomplished via the scale of the BigDecimal rounding increment.
- *
- * @param minFrac The minimum number of digits after the decimal separator.
- * @return A precision for chaining or passing to the NumberFormatter precision() setter.
- * @stable ICU 60
- */
- Precision withMinFraction(int32_t minFrac) const;
-
- private:
- // Inherit constructor
- using Precision::Precision;
-
- // To allow parent class to call this class's constructor:
- friend class Precision;
-};
-
-/**
- * A class that defines the strategy for padding and truncating integers before the decimal separator.
- *
- * <p>
- * To create an IntegerWidth, use one of the factory methods.
- *
- * @stable ICU 60
- * @see NumberFormatter
- */
-class U_I18N_API IntegerWidth : public UMemory {
- public:
- /**
- * Pad numbers at the beginning with zeros to guarantee a certain number of numerals before the decimal separator.
- *
- * <p>
- * For example, with minInt=3, the number 55 will get printed as "055".
- *
- * @param minInt
- * The minimum number of places before the decimal separator.
- * @return An IntegerWidth for chaining or passing to the NumberFormatter integerWidth() setter.
- * @stable ICU 60
- */
- static IntegerWidth zeroFillTo(int32_t minInt);
-
- /**
- * Truncate numbers exceeding a certain number of numerals before the decimal separator.
- *
- * For example, with maxInt=3, the number 1234 will get printed as "234".
- *
- * @param maxInt
- * The maximum number of places before the decimal separator. maxInt == -1 means no
- * truncation.
- * @return An IntegerWidth for passing to the NumberFormatter integerWidth() setter.
- * @stable ICU 60
- */
- IntegerWidth truncateAt(int32_t maxInt);
-
- private:
- union {
- struct {
- impl::digits_t fMinInt;
- impl::digits_t fMaxInt;
- bool fFormatFailIfMoreThanMaxDigits;
- } minMaxInt;
- UErrorCode errorCode;
- } fUnion;
- bool fHasError = false;
-
- IntegerWidth(impl::digits_t minInt, impl::digits_t maxInt, bool formatFailIfMoreThanMaxDigits);
-
- IntegerWidth(UErrorCode errorCode) { // NOLINT
- fUnion.errorCode = errorCode;
- fHasError = true;
- }
-
- IntegerWidth() { // NOLINT
- fUnion.minMaxInt.fMinInt = -1;
- }
-
- /** Returns the default instance. */
- static IntegerWidth standard() {
- return IntegerWidth::zeroFillTo(1);
- }
-
- bool isBogus() const {
- return !fHasError && fUnion.minMaxInt.fMinInt == -1;
- }
-
- UBool copyErrorTo(UErrorCode &status) const {
- if (fHasError) {
- status = fUnion.errorCode;
- return TRUE;
- }
- return FALSE;
- }
-
- void apply(impl::DecimalQuantity &quantity, UErrorCode &status) const;
-
- bool operator==(const IntegerWidth& other) const;
-
- // To allow MacroProps/MicroProps to initialize empty instances:
- friend struct impl::MacroProps;
- friend struct impl::MicroProps;
-
- // To allow NumberFormatterImpl to access isBogus():
- friend class impl::NumberFormatterImpl;
-
- // To allow the use of this class when formatting:
- friend class impl::MutablePatternModifier;
- friend class impl::ImmutablePatternModifier;
-
- // So that NumberPropertyMapper can create instances
- friend class impl::NumberPropertyMapper;
-
- // To allow access to the skeleton generation code:
- friend class impl::GeneratorHelpers;
-};
-
-/**
- * A class that defines a quantity by which a number should be multiplied when formatting.
- *
- * <p>
- * To create a Scale, use one of the factory methods.
- *
- * @stable ICU 62
- */
-class U_I18N_API Scale : public UMemory {
- public:
- /**
- * Do not change the value of numbers when formatting or parsing.
- *
- * @return A Scale to prevent any multiplication.
- * @stable ICU 62
- */
- static Scale none();
-
- /**
- * Multiply numbers by a power of ten before formatting. Useful for combining with a percent unit:
- *
- * <pre>
- * NumberFormatter::with().unit(NoUnit::percent()).multiplier(Scale::powerOfTen(2))
- * </pre>
- *
- * @return A Scale for passing to the setter in NumberFormatter.
- * @stable ICU 62
- */
- static Scale powerOfTen(int32_t power);
-
- /**
- * Multiply numbers by an arbitrary value before formatting. Useful for unit conversions.
- *
- * This method takes a string in a decimal number format with syntax
- * as defined in the Decimal Arithmetic Specification, available at
- * http://speleotrove.com/decimal
- *
- * Also see the version of this method that takes a double.
- *
- * @return A Scale for passing to the setter in NumberFormatter.
- * @stable ICU 62
- */
- static Scale byDecimal(StringPiece multiplicand);
-
- /**
- * Multiply numbers by an arbitrary value before formatting. Useful for unit conversions.
- *
- * This method takes a double; also see the version of this method that takes an exact decimal.
- *
- * @return A Scale for passing to the setter in NumberFormatter.
- * @stable ICU 62
- */
- static Scale byDouble(double multiplicand);
-
- /**
- * Multiply a number by both a power of ten and by an arbitrary double value.
- *
- * @return A Scale for passing to the setter in NumberFormatter.
- * @stable ICU 62
- */
- static Scale byDoubleAndPowerOfTen(double multiplicand, int32_t power);
-
- // We need a custom destructor for the DecNum, which means we need to declare
- // the copy/move constructor/assignment quartet.
-
- /** @stable ICU 62 */
- Scale(const Scale& other);
-
- /** @stable ICU 62 */
- Scale& operator=(const Scale& other);
-
- /** @stable ICU 62 */
- Scale(Scale&& src) U_NOEXCEPT;
-
- /** @stable ICU 62 */
- Scale& operator=(Scale&& src) U_NOEXCEPT;
-
- /** @stable ICU 62 */
- ~Scale();
-
-#ifndef U_HIDE_INTERNAL_API
- /** @internal */
- Scale(int32_t magnitude, impl::DecNum* arbitraryToAdopt);
-#endif /* U_HIDE_INTERNAL_API */
-
- private:
- int32_t fMagnitude;
- impl::DecNum* fArbitrary;
- UErrorCode fError;
-
- Scale(UErrorCode error) : fMagnitude(0), fArbitrary(nullptr), fError(error) {}
-
- Scale() : fMagnitude(0), fArbitrary(nullptr), fError(U_ZERO_ERROR) {}
-
- bool isValid() const {
- return fMagnitude != 0 || fArbitrary != nullptr;
- }
-
- UBool copyErrorTo(UErrorCode &status) const {
- if (fError != U_ZERO_ERROR) {
- status = fError;
- return TRUE;
- }
- return FALSE;
- }
-
- void applyTo(impl::DecimalQuantity& quantity) const;
-
- void applyReciprocalTo(impl::DecimalQuantity& quantity) const;
-
- // To allow MacroProps/MicroProps to initialize empty instances:
- friend struct impl::MacroProps;
- friend struct impl::MicroProps;
-
- // To allow NumberFormatterImpl to access isBogus() and perform other operations:
- friend class impl::NumberFormatterImpl;
-
- // To allow the helper class MultiplierFormatHandler access to private fields:
- friend class impl::MultiplierFormatHandler;
-
- // To allow access to the skeleton generation code:
- friend class impl::GeneratorHelpers;
-
- // To allow access to parsing code:
- friend class ::icu::numparse::impl::NumberParserImpl;
- friend class ::icu::numparse::impl::MultiplierParseHandler;
-};
-
-namespace impl {
-
-// Do not enclose entire SymbolsWrapper with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
-/** @internal */
-class U_I18N_API SymbolsWrapper : public UMemory {
- public:
- /** @internal */
- SymbolsWrapper() : fType(SYMPTR_NONE), fPtr{nullptr} {}
-
- /** @internal */
- SymbolsWrapper(const SymbolsWrapper &other);
-
- /** @internal */
- SymbolsWrapper &operator=(const SymbolsWrapper &other);
-
- /** @internal */
- SymbolsWrapper(SymbolsWrapper&& src) U_NOEXCEPT;
-
- /** @internal */
- SymbolsWrapper &operator=(SymbolsWrapper&& src) U_NOEXCEPT;
-
- /** @internal */
- ~SymbolsWrapper();
-
-#ifndef U_HIDE_INTERNAL_API
-
- /**
- * The provided object is copied, but we do not adopt it.
- * @internal
- */
- void setTo(const DecimalFormatSymbols &dfs);
-
- /**
- * Adopt the provided object.
- * @internal
- */
- void setTo(const NumberingSystem *ns);
-
- /**
- * Whether the object is currently holding a DecimalFormatSymbols.
- * @internal
- */
- bool isDecimalFormatSymbols() const;
-
- /**
- * Whether the object is currently holding a NumberingSystem.
- * @internal
- */
- bool isNumberingSystem() const;
-
- /**
- * Get the DecimalFormatSymbols pointer. No ownership change.
- * @internal
- */
- const DecimalFormatSymbols *getDecimalFormatSymbols() const;
-
- /**
- * Get the NumberingSystem pointer. No ownership change.
- * @internal
- */
- const NumberingSystem *getNumberingSystem() const;
-
-#endif // U_HIDE_INTERNAL_API
-
- /** @internal */
- UBool copyErrorTo(UErrorCode &status) const {
- if (fType == SYMPTR_DFS && fPtr.dfs == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return TRUE;
- } else if (fType == SYMPTR_NS && fPtr.ns == nullptr) {
- status = U_MEMORY_ALLOCATION_ERROR;
- return TRUE;
- }
- return FALSE;
- }
-
- private:
- enum SymbolsPointerType {
- SYMPTR_NONE, SYMPTR_DFS, SYMPTR_NS
- } fType;
-
- union {
- const DecimalFormatSymbols *dfs;
- const NumberingSystem *ns;
- } fPtr;
-
- void doCopyFrom(const SymbolsWrapper &other);
-
- void doMoveFrom(SymbolsWrapper&& src);
-
- void doCleanup();
-};
-
-// Do not enclose entire Grouper with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
-/** @internal */
-class U_I18N_API Grouper : public UMemory {
- public:
-#ifndef U_HIDE_INTERNAL_API
- /** @internal */
- static Grouper forStrategy(UNumberGroupingStrategy grouping);
-
- /**
- * Resolve the values in Properties to a Grouper object.
- * @internal
- */
- static Grouper forProperties(const DecimalFormatProperties& properties);
-
- // Future: static Grouper forProperties(DecimalFormatProperties& properties);
-
- /** @internal */
- Grouper(int16_t grouping1, int16_t grouping2, int16_t minGrouping, UNumberGroupingStrategy strategy)
- : fGrouping1(grouping1),
- fGrouping2(grouping2),
- fMinGrouping(minGrouping),
- fStrategy(strategy) {}
-#endif // U_HIDE_INTERNAL_API
-
- /** @internal */
- int16_t getPrimary() const;
-
- /** @internal */
- int16_t getSecondary() const;
-
- private:
- /**
- * The grouping sizes, with the following special values:
- * <ul>
- * <li>-1 = no grouping
- * <li>-2 = needs locale data
- * <li>-4 = fall back to Western grouping if not in locale
- * </ul>
- */
- int16_t fGrouping1;
- int16_t fGrouping2;
-
- /**
- * The minimum grouping size, with the following special values:
- * <ul>
- * <li>-2 = needs locale data
- * <li>-3 = no less than 2
- * </ul>
- */
- int16_t fMinGrouping;
-
- /**
- * The UNumberGroupingStrategy that was used to create this Grouper, or UNUM_GROUPING_COUNT if this
- * was not created from a UNumberGroupingStrategy.
- */
- UNumberGroupingStrategy fStrategy;
-
- Grouper() : fGrouping1(-3) {}
-
- bool isBogus() const {
- return fGrouping1 == -3;
- }
-
- /** NON-CONST: mutates the current instance. */
- void setLocaleData(const impl::ParsedPatternInfo &patternInfo, const Locale& locale);
-
- bool groupAtPosition(int32_t position, const impl::DecimalQuantity &value) const;
-
- // To allow MacroProps/MicroProps to initialize empty instances:
- friend struct MacroProps;
- friend struct MicroProps;
-
- // To allow NumberFormatterImpl to access isBogus() and perform other operations:
- friend class NumberFormatterImpl;
-
- // To allow NumberParserImpl to perform setLocaleData():
- friend class ::icu::numparse::impl::NumberParserImpl;
-
- // To allow access to the skeleton generation code:
- friend class impl::GeneratorHelpers;
-};
-
-// Do not enclose entire Padder with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
-/** @internal */
-class U_I18N_API Padder : public UMemory {
- public:
-#ifndef U_HIDE_INTERNAL_API
- /** @internal */
- static Padder none();
-
- /** @internal */
- static Padder codePoints(UChar32 cp, int32_t targetWidth, UNumberFormatPadPosition position);
-#endif // U_HIDE_INTERNAL_API
-
- /** @internal */
- static Padder forProperties(const DecimalFormatProperties& properties);
-
- private:
- UChar32 fWidth; // -3 = error; -2 = bogus; -1 = no padding
- union {
- struct {
- int32_t fCp;
- UNumberFormatPadPosition fPosition;
- } padding;
- UErrorCode errorCode;
- } fUnion;
-
- Padder(UChar32 cp, int32_t width, UNumberFormatPadPosition position);
-
- Padder(int32_t width);
-
- Padder(UErrorCode errorCode) : fWidth(-3) { // NOLINT
- fUnion.errorCode = errorCode;
- }
-
- Padder() : fWidth(-2) {} // NOLINT
-
- bool isBogus() const {
- return fWidth == -2;
- }
-
- UBool copyErrorTo(UErrorCode &status) const {
- if (fWidth == -3) {
- status = fUnion.errorCode;
- return TRUE;
- }
- return FALSE;
- }
-
- bool isValid() const {
- return fWidth > 0;
- }
-
- int32_t padAndApply(const impl::Modifier &mod1, const impl::Modifier &mod2,
- FormattedStringBuilder &string, int32_t leftIndex, int32_t rightIndex,
- UErrorCode &status) const;
-
- // To allow MacroProps/MicroProps to initialize empty instances:
- friend struct MacroProps;
- friend struct MicroProps;
-
- // To allow NumberFormatterImpl to access isBogus() and perform other operations:
- friend class impl::NumberFormatterImpl;
-
- // To allow access to the skeleton generation code:
- friend class impl::GeneratorHelpers;
-};
-
-// Do not enclose entire MacroProps with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
-/** @internal */
-struct U_I18N_API MacroProps : public UMemory {
- /** @internal */
- Notation notation;
-
- /** @internal */
- MeasureUnit unit; // = NoUnit::base();
-
- /** @internal */
- MeasureUnit perUnit; // = NoUnit::base();
-
- /** @internal */
- Precision precision; // = Precision(); (bogus)
-
- /** @internal */
- UNumberFormatRoundingMode roundingMode = UNUM_ROUND_HALFEVEN;
-
- /** @internal */
- Grouper grouper; // = Grouper(); (bogus)
-
- /** @internal */
- Padder padder; // = Padder(); (bogus)
-
- /** @internal */
- IntegerWidth integerWidth; // = IntegerWidth(); (bogus)
-
- /** @internal */
- SymbolsWrapper symbols;
-
- // UNUM_XYZ_COUNT denotes null (bogus) values.
-
- /** @internal */
- UNumberUnitWidth unitWidth = UNUM_UNIT_WIDTH_COUNT;
-
- /** @internal */
- UNumberSignDisplay sign = UNUM_SIGN_COUNT;
-
- /** @internal */
- UNumberDecimalSeparatorDisplay decimal = UNUM_DECIMAL_SEPARATOR_COUNT;
-
- /** @internal */
- Scale scale; // = Scale(); (benign value)
-
- /** @internal */
- const AffixPatternProvider* affixProvider = nullptr; // no ownership
-
- /** @internal */
- const PluralRules* rules = nullptr; // no ownership
-
- /** @internal */
- int32_t threshold = kInternalDefaultThreshold;
-
- /** @internal */
- Locale locale;
-
- // NOTE: Uses default copy and move constructors.
-
- /**
- * Check all members for errors.
- * @internal
- */
- bool copyErrorTo(UErrorCode &status) const {
- return notation.copyErrorTo(status) || precision.copyErrorTo(status) ||
- padder.copyErrorTo(status) || integerWidth.copyErrorTo(status) ||
- symbols.copyErrorTo(status) || scale.copyErrorTo(status);
- }
-};
-
-} // namespace impl
-
-#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
-// Ignore MSVC warning 4661. This is generated for NumberFormatterSettings<>::toSkeleton() as this method
-// is defined elsewhere (in number_skeletons.cpp). The compiler is warning that the explicit template instantiation
-// inside this single translation unit (CPP file) is incomplete, and thus it isn't sure if the template class is
-// fully defined. However, since each translation unit explicitly instantiates all the necessary template classes,
-// they will all be passed to the linker, and the linker will still find and export all the class members.
-#pragma warning(push)
-#pragma warning(disable: 4661)
-#endif
-
-/**
- * An abstract base class for specifying settings related to number formatting. This class is implemented by
- * {@link UnlocalizedNumberFormatter} and {@link LocalizedNumberFormatter}. This class is not intended for
- * public subclassing.
- */
-template<typename Derived>
-class U_I18N_API NumberFormatterSettings {
- public:
- /**
- * Specifies the notation style (simple, scientific, or compact) for rendering numbers.
- *
- * <ul>
- * <li>Simple notation: "12,300"
- * <li>Scientific notation: "1.23E4"
- * <li>Compact notation: "12K"
- * </ul>
- *
- * <p>
- * All notation styles will be properly localized with locale data, and all notation styles are compatible with
- * units, rounding precisions, and other number formatter settings.
- *
- * <p>
- * Pass this method the return value of a {@link Notation} factory method. For example:
- *
- * <pre>
- * NumberFormatter::with().notation(Notation::compactShort())
- * </pre>
- *
- * The default is to use simple notation.
- *
- * @param notation
- * The notation strategy to use.
- * @return The fluent chain.
- * @see Notation
- * @stable ICU 60
- */
- Derived notation(const Notation &notation) const &;
-
- /**
- * Overload of notation() for use on an rvalue reference.
- *
- * @param notation
- * The notation strategy to use.
- * @return The fluent chain.
- * @see #notation
- * @stable ICU 62
- */
- Derived notation(const Notation &notation) &&;
-
- /**
- * Specifies the unit (unit of measure, currency, or percent) to associate with rendered numbers.
- *
- * <ul>
- * <li>Unit of measure: "12.3 meters"
- * <li>Currency: "$12.30"
- * <li>Percent: "12.3%"
- * </ul>
- *
- * All units will be properly localized with locale data, and all units are compatible with notation styles,
- * rounding precisions, and other number formatter settings.
- *
- * Pass this method any instance of {@link MeasureUnit}. For units of measure:
- *
- * <pre>
- * NumberFormatter::with().unit(MeasureUnit::getMeter())
- * </pre>
- *
- * Currency:
- *
- * <pre>
- * NumberFormatter::with().unit(CurrencyUnit(u"USD", status))
- * </pre>
- *
- * Percent:
- *
- * <pre>
- * NumberFormatter::with().unit(NoUnit.percent())
- * </pre>
- *
- * See {@link #perUnit} for information on how to format strings like "5 meters per second".
- *
- * The default is to render without units (equivalent to NoUnit.base()).
- *
- * @param unit
- * The unit to render.
- * @return The fluent chain.
- * @see MeasureUnit
- * @see Currency
- * @see NoUnit
- * @see #perUnit
- * @stable ICU 60
- */
- Derived unit(const icu::MeasureUnit &unit) const &;
-
- /**
- * Overload of unit() for use on an rvalue reference.
- *
- * @param unit
- * The unit to render.
- * @return The fluent chain.
- * @see #unit
- * @stable ICU 62
- */
- Derived unit(const icu::MeasureUnit &unit) &&;
-
- /**
- * Like unit(), but takes ownership of a pointer. Convenient for use with the MeasureFormat factory
- * methods that return pointers that need ownership.
- *
- * Note: consider using the MeasureFormat factory methods that return by value.
- *
- * @param unit
- * The unit to render.
- * @return The fluent chain.
- * @see #unit
- * @see MeasureUnit
- * @stable ICU 60
- */
- Derived adoptUnit(icu::MeasureUnit *unit) const &;
-
- /**
- * Overload of adoptUnit() for use on an rvalue reference.
- *
- * @param unit
- * The unit to render.
- * @return The fluent chain.
- * @see #adoptUnit
- * @stable ICU 62
- */
- Derived adoptUnit(icu::MeasureUnit *unit) &&;
-
- /**
- * Sets a unit to be used in the denominator. For example, to format "3 m/s", pass METER to the unit and SECOND to
- * the perUnit.
- *
- * Pass this method any instance of {@link MeasureUnit}. Example:
- *
- * <pre>
- * NumberFormatter::with()
- * .unit(MeasureUnit::getMeter())
- * .perUnit(MeasureUnit::getSecond())
- * </pre>
- *
- * The default is not to display any unit in the denominator.
- *
- * If a per-unit is specified without a primary unit via {@link #unit}, the behavior is undefined.
- *
- * @param perUnit
- * The unit to render in the denominator.
- * @return The fluent chain
- * @see #unit
- * @stable ICU 61
- */
- Derived perUnit(const icu::MeasureUnit &perUnit) const &;
-
- /**
- * Overload of perUnit() for use on an rvalue reference.
- *
- * @param perUnit
- * The unit to render in the denominator.
- * @return The fluent chain.
- * @see #perUnit
- * @stable ICU 62
- */
- Derived perUnit(const icu::MeasureUnit &perUnit) &&;
-
- /**
- * Like perUnit(), but takes ownership of a pointer. Convenient for use with the MeasureFormat factory
- * methods that return pointers that need ownership.
- *
- * Note: consider using the MeasureFormat factory methods that return by value.
- *
- * @param perUnit
- * The unit to render in the denominator.
- * @return The fluent chain.
- * @see #perUnit
- * @see MeasureUnit
- * @stable ICU 61
- */
- Derived adoptPerUnit(icu::MeasureUnit *perUnit) const &;
-
- /**
- * Overload of adoptPerUnit() for use on an rvalue reference.
- *
- * @param perUnit
- * The unit to render in the denominator.
- * @return The fluent chain.
- * @see #adoptPerUnit
- * @stable ICU 62
- */
- Derived adoptPerUnit(icu::MeasureUnit *perUnit) &&;
-
- /**
- * Specifies the rounding precision to use when formatting numbers.
- *
- * <ul>
- * <li>Round to 3 decimal places: "3.142"
- * <li>Round to 3 significant figures: "3.14"
- * <li>Round to the closest nickel: "3.15"
- * <li>Do not perform rounding: "3.1415926..."
- * </ul>
- *
- * <p>
- * Pass this method the return value of one of the factory methods on {@link Precision}. For example:
- *
- * <pre>
- * NumberFormatter::with().precision(Precision::fixedFraction(2))
- * </pre>
- *
- * <p>
- * In most cases, the default rounding strategy is to round to 6 fraction places; i.e.,
- * <code>Precision.maxFraction(6)</code>. The exceptions are if compact notation is being used, then the compact
- * notation rounding strategy is used (see {@link Notation#compactShort} for details), or if the unit is a currency,
- * then standard currency rounding is used, which varies from currency to currency (see {@link Precision#currency} for
- * details).
- *
- * @param precision
- * The rounding precision to use.
- * @return The fluent chain.
- * @see Precision
- * @stable ICU 62
- */
- Derived precision(const Precision& precision) const &;
-
- /**
- * Overload of precision() for use on an rvalue reference.
- *
- * @param precision
- * The rounding precision to use.
- * @return The fluent chain.
- * @see #precision
- * @stable ICU 62
- */
- Derived precision(const Precision& precision) &&;
-
- /**
- * Specifies how to determine the direction to round a number when it has more digits than fit in the
- * desired precision. When formatting 1.235:
- *
- * <ul>
- * <li>Ceiling rounding mode with integer precision: "2"
- * <li>Half-down rounding mode with 2 fixed fraction digits: "1.23"
- * <li>Half-up rounding mode with 2 fixed fraction digits: "1.24"
- * </ul>
- *
- * The default is HALF_EVEN. For more information on rounding mode, see the ICU userguide here:
- *
- * http://userguide.icu-project.org/formatparse/numbers/rounding-modes
- *
- * @param roundingMode The rounding mode to use.
- * @return The fluent chain.
- * @stable ICU 62
- */
- Derived roundingMode(UNumberFormatRoundingMode roundingMode) const &;
-
- /**
- * Overload of roundingMode() for use on an rvalue reference.
- *
- * @param roundingMode The rounding mode to use.
- * @return The fluent chain.
- * @see #roundingMode
- * @stable ICU 62
- */
- Derived roundingMode(UNumberFormatRoundingMode roundingMode) &&;
-
- /**
- * Specifies the grouping strategy to use when formatting numbers.
- *
- * <ul>
- * <li>Default grouping: "12,300" and "1,230"
- * <li>Grouping with at least 2 digits: "12,300" and "1230"
- * <li>No grouping: "12300" and "1230"
- * </ul>
- *
- * <p>
- * The exact grouping widths will be chosen based on the locale.
- *
- * <p>
- * Pass this method an element from the {@link UNumberGroupingStrategy} enum. For example:
- *
- * <pre>
- * NumberFormatter::with().grouping(UNUM_GROUPING_MIN2)
- * </pre>
- *
- * The default is to perform grouping according to locale data; most locales, but not all locales,
- * enable it by default.
- *
- * @param strategy
- * The grouping strategy to use.
- * @return The fluent chain.
- * @stable ICU 61
- */
- Derived grouping(UNumberGroupingStrategy strategy) const &;
-
- /**
- * Overload of grouping() for use on an rvalue reference.
- *
- * @param strategy
- * The grouping strategy to use.
- * @return The fluent chain.
- * @see #grouping
- * @stable ICU 62
- */
- Derived grouping(UNumberGroupingStrategy strategy) &&;
-
- /**
- * Specifies the minimum and maximum number of digits to render before the decimal mark.
- *
- * <ul>
- * <li>Zero minimum integer digits: ".08"
- * <li>One minimum integer digit: "0.08"
- * <li>Two minimum integer digits: "00.08"
- * </ul>
- *
- * <p>
- * Pass this method the return value of {@link IntegerWidth#zeroFillTo}. For example:
- *
- * <pre>
- * NumberFormatter::with().integerWidth(IntegerWidth::zeroFillTo(2))
- * </pre>
- *
- * The default is to have one minimum integer digit.
- *
- * @param style
- * The integer width to use.
- * @return The fluent chain.
- * @see IntegerWidth
- * @stable ICU 60
- */
- Derived integerWidth(const IntegerWidth &style) const &;
-
- /**
- * Overload of integerWidth() for use on an rvalue reference.
- *
- * @param style
- * The integer width to use.
- * @return The fluent chain.
- * @see #integerWidth
- * @stable ICU 62
- */
- Derived integerWidth(const IntegerWidth &style) &&;
-
- /**
- * Specifies the symbols (decimal separator, grouping separator, percent sign, numerals, etc.) to use when rendering
- * numbers.
- *
- * <ul>
- * <li><em>en_US</em> symbols: "12,345.67"
- * <li><em>fr_FR</em> symbols: "12&nbsp;345,67"
- * <li><em>de_CH</em> symbols: "12’345.67"
- * <li><em>my_MY</em> symbols: "၁၂,၃၄၅.၆၇"
- * </ul>
- *
- * <p>
- * Pass this method an instance of {@link DecimalFormatSymbols}. For example:
- *
- * <pre>
- * NumberFormatter::with().symbols(DecimalFormatSymbols(Locale("de_CH"), status))
- * </pre>
- *
- * <p>
- * <strong>Note:</strong> DecimalFormatSymbols automatically chooses the best numbering system based on the locale.
- * In the examples above, the first three are using the Latin numbering system, and the fourth is using the Myanmar
- * numbering system.
- *
- * <p>
- * <strong>Note:</strong> The instance of DecimalFormatSymbols will be copied: changes made to the symbols object
- * after passing it into the fluent chain will not be seen.
- *
- * <p>
- * <strong>Note:</strong> Calling this method will override any previously specified DecimalFormatSymbols
- * or NumberingSystem.
- *
- * <p>
- * The default is to choose the symbols based on the locale specified in the fluent chain.
- *
- * @param symbols
- * The DecimalFormatSymbols to use.
- * @return The fluent chain.
- * @see DecimalFormatSymbols
- * @stable ICU 60
- */
- Derived symbols(const DecimalFormatSymbols &symbols) const &;
-
- /**
- * Overload of symbols() for use on an rvalue reference.
- *
- * @param symbols
- * The DecimalFormatSymbols to use.
- * @return The fluent chain.
- * @see #symbols
- * @stable ICU 62
- */
- Derived symbols(const DecimalFormatSymbols &symbols) &&;
-
- /**
- * Specifies that the given numbering system should be used when fetching symbols.
- *
- * <ul>
- * <li>Latin numbering system: "12,345"
- * <li>Myanmar numbering system: "၁၂,၃၄၅"
- * <li>Math Sans Bold numbering system: "𝟭𝟮,𝟯𝟰𝟱"
- * </ul>
- *
- * <p>
- * Pass this method an instance of {@link NumberingSystem}. For example, to force the locale to always use the Latin
- * alphabet numbering system (ASCII digits):
- *
- * <pre>
- * NumberFormatter::with().adoptSymbols(NumberingSystem::createInstanceByName("latn", status))
- * </pre>
- *
- * <p>
- * <strong>Note:</strong> Calling this method will override any previously specified DecimalFormatSymbols
- * or NumberingSystem.
- *
- * <p>
- * The default is to choose the best numbering system for the locale.
- *
- * <p>
- * This method takes ownership of a pointer in order to work nicely with the NumberingSystem factory methods.
- *
- * @param symbols
- * The NumberingSystem to use.
- * @return The fluent chain.
- * @see NumberingSystem
- * @stable ICU 60
- */
- Derived adoptSymbols(NumberingSystem *symbols) const &;
-
- /**
- * Overload of adoptSymbols() for use on an rvalue reference.
- *
- * @param symbols
- * The NumberingSystem to use.
- * @return The fluent chain.
- * @see #adoptSymbols
- * @stable ICU 62
- */
- Derived adoptSymbols(NumberingSystem *symbols) &&;
-
- /**
- * Sets the width of the unit (measure unit or currency). Most common values:
- *
- * <ul>
- * <li>Short: "$12.00", "12 m"
- * <li>ISO Code: "USD 12.00"
- * <li>Full name: "12.00 US dollars", "12 meters"
- * </ul>
- *
- * <p>
- * Pass an element from the {@link UNumberUnitWidth} enum to this setter. For example:
- *
- * <pre>
- * NumberFormatter::with().unitWidth(UNumberUnitWidth::UNUM_UNIT_WIDTH_FULL_NAME)
- * </pre>
- *
- * <p>
- * The default is the SHORT width.
- *
- * @param width
- * The width to use when rendering numbers.
- * @return The fluent chain
- * @see UNumberUnitWidth
- * @stable ICU 60
- */
- Derived unitWidth(UNumberUnitWidth width) const &;
-
- /**
- * Overload of unitWidth() for use on an rvalue reference.
- *
- * @param width
- * The width to use when rendering numbers.
- * @return The fluent chain.
- * @see #unitWidth
- * @stable ICU 62
- */
- Derived unitWidth(UNumberUnitWidth width) &&;
-
- /**
- * Sets the plus/minus sign display strategy. Most common values:
- *
- * <ul>
- * <li>Auto: "123", "-123"
- * <li>Always: "+123", "-123"
- * <li>Accounting: "$123", "($123)"
- * </ul>
- *
- * <p>
- * Pass an element from the {@link UNumberSignDisplay} enum to this setter. For example:
- *
- * <pre>
- * NumberFormatter::with().sign(UNumberSignDisplay::UNUM_SIGN_ALWAYS)
- * </pre>
- *
- * <p>
- * The default is AUTO sign display.
- *
- * @param style
- * The sign display strategy to use when rendering numbers.
- * @return The fluent chain
- * @see UNumberSignDisplay
- * @stable ICU 60
- */
- Derived sign(UNumberSignDisplay style) const &;
-
- /**
- * Overload of sign() for use on an rvalue reference.
- *
- * @param style
- * The sign display strategy to use when rendering numbers.
- * @return The fluent chain.
- * @see #sign
- * @stable ICU 62
- */
- Derived sign(UNumberSignDisplay style) &&;
-
- /**
- * Sets the decimal separator display strategy. This affects integer numbers with no fraction part. Most common
- * values:
- *
- * <ul>
- * <li>Auto: "1"
- * <li>Always: "1."
- * </ul>
- *
- * <p>
- * Pass an element from the {@link UNumberDecimalSeparatorDisplay} enum to this setter. For example:
- *
- * <pre>
- * NumberFormatter::with().decimal(UNumberDecimalSeparatorDisplay::UNUM_DECIMAL_SEPARATOR_ALWAYS)
- * </pre>
- *
- * <p>
- * The default is AUTO decimal separator display.
- *
- * @param style
- * The decimal separator display strategy to use when rendering numbers.
- * @return The fluent chain
- * @see UNumberDecimalSeparatorDisplay
- * @stable ICU 60
- */
- Derived decimal(UNumberDecimalSeparatorDisplay style) const &;
-
- /**
- * Overload of decimal() for use on an rvalue reference.
- *
- * @param style
- * The decimal separator display strategy to use when rendering numbers.
- * @return The fluent chain.
- * @see #decimal
- * @stable ICU 62
- */
- Derived decimal(UNumberDecimalSeparatorDisplay style) &&;
-
- /**
- * Sets a scale (multiplier) to be used to scale the number by an arbitrary amount before formatting.
- * Most common values:
- *
- * <ul>
- * <li>Multiply by 100: useful for percentages.
- * <li>Multiply by an arbitrary value: useful for unit conversions.
- * </ul>
- *
- * <p>
- * Pass an element from a {@link Scale} factory method to this setter. For example:
- *
- * <pre>
- * NumberFormatter::with().scale(Scale::powerOfTen(2))
- * </pre>
- *
- * <p>
- * The default is to not apply any multiplier.
- *
- * @param scale
- * The scale to apply when rendering numbers.
- * @return The fluent chain
- * @stable ICU 62
- */
- Derived scale(const Scale &scale) const &;
-
- /**
- * Overload of scale() for use on an rvalue reference.
- *
- * @param scale
- * The scale to apply when rendering numbers.
- * @return The fluent chain.
- * @see #scale
- * @stable ICU 62
- */
- Derived scale(const Scale &scale) &&;
-
-#ifndef U_HIDE_INTERNAL_API
-
- /**
- * Set the padding strategy. May be added in the future; see #13338.
- *
- * @internal ICU 60: This API is ICU internal only.
- */
- Derived padding(const impl::Padder &padder) const &;
-
- /** @internal */
- Derived padding(const impl::Padder &padder) &&;
-
- /**
- * Internal fluent setter to support a custom regulation threshold. A threshold of 1 causes the data structures to
- * be built right away. A threshold of 0 prevents the data structures from being built.
- *
- * @internal ICU 60: This API is ICU internal only.
- */
- Derived threshold(int32_t threshold) const &;
-
- /** @internal */
- Derived threshold(int32_t threshold) &&;
-
- /**
- * Internal fluent setter to overwrite the entire macros object.
- *
- * @internal ICU 60: This API is ICU internal only.
- */
- Derived macros(const impl::MacroProps& macros) const &;
-
- /** @internal */
- Derived macros(const impl::MacroProps& macros) &&;
-
- /** @internal */
- Derived macros(impl::MacroProps&& macros) const &;
-
- /** @internal */
- Derived macros(impl::MacroProps&& macros) &&;
-
-#endif /* U_HIDE_INTERNAL_API */
-
- /**
- * Creates a skeleton string representation of this number formatter. A skeleton string is a
- * locale-agnostic serialized form of a number formatter.
- *
- * Not all options are capable of being represented in the skeleton string; for example, a
- * DecimalFormatSymbols object. If any such option is encountered, the error code is set to
- * U_UNSUPPORTED_ERROR.
- *
- * The returned skeleton is in normalized form, such that two number formatters with equivalent
- * behavior should produce the same skeleton.
- *
- * @return A number skeleton string with behavior corresponding to this number formatter.
- * @stable ICU 62
- */
- UnicodeString toSkeleton(UErrorCode& status) const;
-
- /**
- * Returns the current (Un)LocalizedNumberFormatter as a LocalPointer
- * wrapping a heap-allocated copy of the current object.
- *
- * This is equivalent to new-ing the move constructor with a value object
- * as the argument.
- *
- * @return A wrapped (Un)LocalizedNumberFormatter pointer, or a wrapped
- * nullptr on failure.
- * @stable ICU 64
- */
- LocalPointer<Derived> clone() const &;
-
- /**
- * Overload of clone for use on an rvalue reference.
- *
- * @return A wrapped (Un)LocalizedNumberFormatter pointer, or a wrapped
- * nullptr on failure.
- * @stable ICU 64
- */
- LocalPointer<Derived> clone() &&;
-
- /**
- * Sets the UErrorCode if an error occurred in the fluent chain.
- * Preserves older error codes in the outErrorCode.
- * @return TRUE if U_FAILURE(outErrorCode)
- * @stable ICU 60
- */
- UBool copyErrorTo(UErrorCode &outErrorCode) const {
- if (U_FAILURE(outErrorCode)) {
- // Do not overwrite the older error code
- return TRUE;
- }
- fMacros.copyErrorTo(outErrorCode);
- return U_FAILURE(outErrorCode);
- }
-
- // NOTE: Uses default copy and move constructors.
-
- private:
- impl::MacroProps fMacros;
-
- // Don't construct me directly! Use (Un)LocalizedNumberFormatter.
- NumberFormatterSettings() = default;
-
- friend class LocalizedNumberFormatter;
- friend class UnlocalizedNumberFormatter;
-
- // Give NumberRangeFormatter access to the MacroProps
- friend void impl::touchRangeLocales(impl::RangeMacroProps& macros);
- friend class impl::NumberRangeFormatterImpl;
-};
-
-/**
- * A NumberFormatter that does not yet have a locale. In order to format numbers, a locale must be specified.
- *
- * Instances of this class are immutable and thread-safe.
- *
- * @see NumberFormatter
- * @stable ICU 60
- */
-class U_I18N_API UnlocalizedNumberFormatter
- : public NumberFormatterSettings<UnlocalizedNumberFormatter>, public UMemory {
-
- public:
- /**
- * Associate the given locale with the number formatter. The locale is used for picking the appropriate symbols,
- * formats, and other data for number display.
- *
- * @param locale
- * The locale to use when loading data for number formatting.
- * @return The fluent chain.
- * @stable ICU 60
- */
- LocalizedNumberFormatter locale(const icu::Locale &locale) const &;
-
- /**
- * Overload of locale() for use on an rvalue reference.
- *
- * @param locale
- * The locale to use when loading data for number formatting.
- * @return The fluent chain.
- * @see #locale
- * @stable ICU 62
- */
- LocalizedNumberFormatter locale(const icu::Locale &locale) &&;
-
- /**
- * Default constructor: puts the formatter into a valid but undefined state.
- *
- * @stable ICU 62
- */
- UnlocalizedNumberFormatter() = default;
-
- /**
- * Returns a copy of this UnlocalizedNumberFormatter.
- * @stable ICU 60
- */
- UnlocalizedNumberFormatter(const UnlocalizedNumberFormatter &other);
-
- /**
- * Move constructor:
- * The source UnlocalizedNumberFormatter will be left in a valid but undefined state.
- * @stable ICU 62
- */
- UnlocalizedNumberFormatter(UnlocalizedNumberFormatter&& src) U_NOEXCEPT;
-
- /**
- * Copy assignment operator.
- * @stable ICU 62
- */
- UnlocalizedNumberFormatter& operator=(const UnlocalizedNumberFormatter& other);
-
- /**
- * Move assignment operator:
- * The source UnlocalizedNumberFormatter will be left in a valid but undefined state.
- * @stable ICU 62
- */
- UnlocalizedNumberFormatter& operator=(UnlocalizedNumberFormatter&& src) U_NOEXCEPT;
-
- private:
- explicit UnlocalizedNumberFormatter(const NumberFormatterSettings<UnlocalizedNumberFormatter>& other);
-
- explicit UnlocalizedNumberFormatter(
- NumberFormatterSettings<UnlocalizedNumberFormatter>&& src) U_NOEXCEPT;
-
- // To give the fluent setters access to this class's constructor:
- friend class NumberFormatterSettings<UnlocalizedNumberFormatter>;
-
- // To give NumberFormatter::with() access to this class's constructor:
- friend class NumberFormatter;
-};
-
-/**
- * A NumberFormatter that has a locale associated with it; this means .format() methods are available.
- *
- * Instances of this class are immutable and thread-safe.
- *
- * @see NumberFormatter
- * @stable ICU 60
- */
-class U_I18N_API LocalizedNumberFormatter
- : public NumberFormatterSettings<LocalizedNumberFormatter>, public UMemory {
- public:
- /**
- * Format the given integer number to a string using the settings specified in the NumberFormatter fluent
- * setting chain.
- *
- * @param value
- * The number to format.
- * @param status
- * Set to an ErrorCode if one occurred in the setter chain or during formatting.
- * @return A FormattedNumber object; call .toString() to get the string.
- * @stable ICU 60
- */
- FormattedNumber formatInt(int64_t value, UErrorCode &status) const;
-
- /**
- * Format the given float or double to a string using the settings specified in the NumberFormatter fluent setting
- * chain.
- *
- * @param value
- * The number to format.
- * @param status
- * Set to an ErrorCode if one occurred in the setter chain or during formatting.
- * @return A FormattedNumber object; call .toString() to get the string.
- * @stable ICU 60
- */
- FormattedNumber formatDouble(double value, UErrorCode &status) const;
-
- /**
- * Format the given decimal number to a string using the settings
- * specified in the NumberFormatter fluent setting chain.
- * The syntax of the unformatted number is a "numeric string"
- * as defined in the Decimal Arithmetic Specification, available at
- * http://speleotrove.com/decimal
- *
- * @param value
- * The number to format.
- * @param status
- * Set to an ErrorCode if one occurred in the setter chain or during formatting.
- * @return A FormattedNumber object; call .toString() to get the string.
- * @stable ICU 60
- */
- FormattedNumber formatDecimal(StringPiece value, UErrorCode& status) const;
-
-#ifndef U_HIDE_INTERNAL_API
-
- /** Internal method.
- * @internal
- */
- FormattedNumber formatDecimalQuantity(const impl::DecimalQuantity& dq, UErrorCode& status) const;
-
- /** Internal method for DecimalFormat compatibility.
- * @internal
- */
- void getAffixImpl(bool isPrefix, bool isNegative, UnicodeString& result, UErrorCode& status) const;
-
- /**
- * Internal method for testing.
- * @internal
- */
- const impl::NumberFormatterImpl* getCompiled() const;
-
- /**
- * Internal method for testing.
- * @internal
- */
- int32_t getCallCount() const;
-
-#endif /* U_HIDE_INTERNAL_API */
-
- /**
- * Creates a representation of this LocalizedNumberFormat as an icu::Format, enabling the use
- * of this number formatter with APIs that need an object of that type, such as MessageFormat.
- *
- * This API is not intended to be used other than for enabling API compatibility. The formatDouble,
- * formatInt, and formatDecimal methods should normally be used when formatting numbers, not the Format
- * object returned by this method.
- *
- * The caller owns the returned object and must delete it when finished.
- *
- * @return A Format wrapping this LocalizedNumberFormatter.
- * @stable ICU 62
- */
- Format* toFormat(UErrorCode& status) const;
-
- /**
- * Default constructor: puts the formatter into a valid but undefined state.
- *
- * @stable ICU 62
- */
- LocalizedNumberFormatter() = default;
-
- /**
- * Returns a copy of this LocalizedNumberFormatter.
- * @stable ICU 60
- */
- LocalizedNumberFormatter(const LocalizedNumberFormatter &other);
-
- /**
- * Move constructor:
- * The source LocalizedNumberFormatter will be left in a valid but undefined state.
- * @stable ICU 62
- */
- LocalizedNumberFormatter(LocalizedNumberFormatter&& src) U_NOEXCEPT;
-
- /**
- * Copy assignment operator.
- * @stable ICU 62
- */
- LocalizedNumberFormatter& operator=(const LocalizedNumberFormatter& other);
-
- /**
- * Move assignment operator:
- * The source LocalizedNumberFormatter will be left in a valid but undefined state.
- * @stable ICU 62
- */
- LocalizedNumberFormatter& operator=(LocalizedNumberFormatter&& src) U_NOEXCEPT;
-
-#ifndef U_HIDE_INTERNAL_API
-
- /**
- * This is the core entrypoint to the number formatting pipeline. It performs self-regulation: a static code path
- * for the first few calls, and compiling a more efficient data structure if called repeatedly.
- *
- * <p>
- * This function is very hot, being called in every call to the number formatting pipeline.
- *
- * @param results
- * The results object. This method will mutate it to save the results.
- * @param status
- * @internal
- */
- void formatImpl(impl::UFormattedNumberData *results, UErrorCode &status) const;
-
-#endif /* U_HIDE_INTERNAL_API */
-
- /**
- * Destruct this LocalizedNumberFormatter, cleaning up any memory it might own.
- * @stable ICU 60
- */
- ~LocalizedNumberFormatter();
-
- private:
- // Note: fCompiled can't be a LocalPointer because impl::NumberFormatterImpl is defined in an internal
- // header, and LocalPointer needs the full class definition in order to delete the instance.
- const impl::NumberFormatterImpl* fCompiled {nullptr};
- char fUnsafeCallCount[8] {}; // internally cast to u_atomic_int32_t
-
- explicit LocalizedNumberFormatter(const NumberFormatterSettings<LocalizedNumberFormatter>& other);
-
- explicit LocalizedNumberFormatter(NumberFormatterSettings<LocalizedNumberFormatter>&& src) U_NOEXCEPT;
-
- LocalizedNumberFormatter(const impl::MacroProps &macros, const Locale &locale);
-
- LocalizedNumberFormatter(impl::MacroProps &&macros, const Locale &locale);
-
- void clear();
-
- void lnfMoveHelper(LocalizedNumberFormatter&& src);
-
- /**
- * @return true if the compiled formatter is available.
- */
- bool computeCompiled(UErrorCode& status) const;
-
- // To give the fluent setters access to this class's constructor:
- friend class NumberFormatterSettings<UnlocalizedNumberFormatter>;
- friend class NumberFormatterSettings<LocalizedNumberFormatter>;
-
- // To give UnlocalizedNumberFormatter::locale() access to this class's constructor:
- friend class UnlocalizedNumberFormatter;
-};
-
-#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
-// Warning 4661.
-#pragma warning(pop)
-#endif
-
-/**
- * The result of a number formatting operation. This class allows the result to be exported in several data types,
- * including a UnicodeString and a FieldPositionIterator.
- *
- * Instances of this class are immutable and thread-safe.
- *
- * @stable ICU 60
- */
-class U_I18N_API FormattedNumber : public UMemory, public FormattedValue {
- public:
-
- /**
- * Default constructor; makes an empty FormattedNumber.
- * @stable ICU 64
- */
- FormattedNumber()
- : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
-
- /**
- * Move constructor: Leaves the source FormattedNumber in an undefined state.
- * @stable ICU 62
- */
- FormattedNumber(FormattedNumber&& src) U_NOEXCEPT;
-
- /**
- * Destruct an instance of FormattedNumber.
- * @stable ICU 60
- */
- virtual ~FormattedNumber() U_OVERRIDE;
-
- /** Copying not supported; use move constructor instead. */
- FormattedNumber(const FormattedNumber&) = delete;
-
- /** Copying not supported; use move assignment instead. */
- FormattedNumber& operator=(const FormattedNumber&) = delete;
-
- /**
- * Move assignment: Leaves the source FormattedNumber in an undefined state.
- * @stable ICU 62
- */
- FormattedNumber& operator=(FormattedNumber&& src) U_NOEXCEPT;
-
- // Copybrief: this method is older than the parent method
- /**
- * @copybrief FormattedValue::toString()
- *
- * For more information, see FormattedValue::toString()
- *
- * @stable ICU 62
- */
- UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
-
- // Copydoc: this method is new in ICU 64
- /** @copydoc FormattedValue::toTempString() */
- UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
-
- // Copybrief: this method is older than the parent method
- /**
- * @copybrief FormattedValue::appendTo()
- *
- * For more information, see FormattedValue::appendTo()
- *
- * @stable ICU 62
- */
- Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
-
- // Copydoc: this method is new in ICU 64
- /** @copydoc FormattedValue::nextPosition() */
- UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
-
-#ifndef U_HIDE_DRAFT_API
- /**
- * Export the formatted number as a "numeric string" conforming to the
- * syntax defined in the Decimal Arithmetic Specification, available at
- * http://speleotrove.com/decimal
- *
- * This endpoint is useful for obtaining the exact number being printed
- * after scaling and rounding have been applied by the number formatter.
- *
- * Example call site:
- *
- * auto decimalNumber = fn.toDecimalNumber<std::string>(status);
- *
- * @tparam StringClass A string class compatible with StringByteSink;
- * for example, std::string.
- * @param status Set if an error occurs.
- * @return A StringClass containing the numeric string.
- * @draft ICU 65
- */
- template<typename StringClass>
- inline StringClass toDecimalNumber(UErrorCode& status) const;
-#endif // U_HIDE_DRAFT_API
-
-#ifndef U_HIDE_INTERNAL_API
-
- /**
- * Gets the raw DecimalQuantity for plural rule selection.
- * @internal
- */
- void getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const;
-
- /**
- * Populates the mutable builder type FieldPositionIteratorHandler.
- * @internal
- */
- void getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih, UErrorCode& status) const;
-
-#endif /* U_HIDE_INTERNAL_API */
-
- private:
- // Can't use LocalPointer because UFormattedNumberData is forward-declared
- const impl::UFormattedNumberData *fData;
-
- // Error code for the terminal methods
- UErrorCode fErrorCode;
-
- /**
- * Internal constructor from data type. Adopts the data pointer.
- * @internal
- */
- explicit FormattedNumber(impl::UFormattedNumberData *results)
- : fData(results), fErrorCode(U_ZERO_ERROR) {}
-
- explicit FormattedNumber(UErrorCode errorCode)
- : fData(nullptr), fErrorCode(errorCode) {}
-
- // TODO(ICU-20775): Propose this as API.
- void toDecimalNumber(ByteSink& sink, UErrorCode& status) const;
-
- // To give LocalizedNumberFormatter format methods access to this class's constructor:
- friend class LocalizedNumberFormatter;
-
- // To give C API access to internals
- friend struct impl::UFormattedNumberImpl;
-};
-
-#ifndef U_HIDE_DRAFT_API
-// Note: This is draft ICU 65
-template<typename StringClass>
-StringClass FormattedNumber::toDecimalNumber(UErrorCode& status) const {
- StringClass result;
- StringByteSink<StringClass> sink(&result);
- toDecimalNumber(sink, status);
- return result;
-}
-#endif // U_HIDE_DRAFT_API
-
-/**
- * See the main description in numberformatter.h for documentation and examples.
- *
- * @stable ICU 60
- */
-class U_I18N_API NumberFormatter final {
- public:
- /**
- * Call this method at the beginning of a NumberFormatter fluent chain in which the locale is not currently known at
- * the call site.
- *
- * @return An {@link UnlocalizedNumberFormatter}, to be used for chaining.
- * @stable ICU 60
- */
- static UnlocalizedNumberFormatter with();
-
- /**
- * Call this method at the beginning of a NumberFormatter fluent chain in which the locale is known at the call
- * site.
- *
- * @param locale
- * The locale from which to load formats and symbols for number formatting.
- * @return A {@link LocalizedNumberFormatter}, to be used for chaining.
- * @stable ICU 60
- */
- static LocalizedNumberFormatter withLocale(const Locale &locale);
-
- /**
- * Call this method at the beginning of a NumberFormatter fluent chain to create an instance based
- * on a given number skeleton string.
- *
- * It is possible for an error to occur while parsing. See the overload of this method if you are
- * interested in the location of a possible parse error.
- *
- * @param skeleton
- * The skeleton string off of which to base this NumberFormatter.
- * @param status
- * Set to U_NUMBER_SKELETON_SYNTAX_ERROR if the skeleton was invalid.
- * @return An UnlocalizedNumberFormatter, to be used for chaining.
- * @stable ICU 62
- */
- static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton, UErrorCode& status);
-
- /**
- * Call this method at the beginning of a NumberFormatter fluent chain to create an instance based
- * on a given number skeleton string.
- *
- * If an error occurs while parsing the skeleton string, the offset into the skeleton string at
- * which the error occurred will be saved into the UParseError, if provided.
- *
- * @param skeleton
- * The skeleton string off of which to base this NumberFormatter.
- * @param perror
- * A parse error struct populated if an error occurs when parsing.
- * If no error occurs, perror.offset will be set to -1.
- * @param status
- * Set to U_NUMBER_SKELETON_SYNTAX_ERROR if the skeleton was invalid.
- * @return An UnlocalizedNumberFormatter, to be used for chaining.
- * @stable ICU 64
- */
- static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton,
- UParseError& perror, UErrorCode& status);
-
- /**
- * Use factory methods instead of the constructor to create a NumberFormatter.
- */
- NumberFormatter() = delete;
-};
-
-} // namespace number
-U_NAMESPACE_END
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
-#endif // __NUMBERFORMATTER_H__
-
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#ifndef __NUMBERFORMATTER_H__
+#define __NUMBERFORMATTER_H__
+
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/appendable.h"
+#include "unicode/bytestream.h"
+#include "unicode/currunit.h"
+#include "unicode/dcfmtsym.h"
+#include "unicode/fieldpos.h"
+#include "unicode/formattedvalue.h"
+#include "unicode/fpositer.h"
+#include "unicode/measunit.h"
+#include "unicode/nounit.h"
+#include "unicode/parseerr.h"
+#include "unicode/plurrule.h"
+#include "unicode/ucurr.h"
+#include "unicode/unum.h"
+#include "unicode/unumberformatter.h"
+#include "unicode/uobject.h"
+
+/**
+ * \file
+ * \brief C++ API: Library for localized number formatting introduced in ICU 60.
+ *
+ * This library was introduced in ICU 60 to simplify the process of formatting localized number strings.
+ * Basic usage examples:
+ *
+ * <pre>
+ * // Most basic usage:
+ * NumberFormatter::withLocale(...).format(123).toString(); // 1,234 in en-US
+ *
+ * // Custom notation, unit, and rounding precision:
+ * NumberFormatter::with()
+ * .notation(Notation::compactShort())
+ * .unit(CurrencyUnit("EUR", status))
+ * .precision(Precision::maxDigits(2))
+ * .locale(...)
+ * .format(1234)
+ * .toString(); // €1.2K in en-US
+ *
+ * // Create a formatter in a singleton by value for use later:
+ * static const LocalizedNumberFormatter formatter = NumberFormatter::withLocale(...)
+ * .unit(NoUnit::percent())
+ * .precision(Precision::fixedFraction(3));
+ * formatter.format(5.9831).toString(); // 5.983% in en-US
+ *
+ * // Create a "template" in a singleton unique_ptr but without setting a locale until the call site:
+ * std::unique_ptr<UnlocalizedNumberFormatter> template = NumberFormatter::with()
+ * .sign(UNumberSignDisplay::UNUM_SIGN_ALWAYS)
+ * .unit(MeasureUnit::getMeter())
+ * .unitWidth(UNumberUnitWidth::UNUM_UNIT_WIDTH_FULL_NAME)
+ * .clone();
+ * template->locale(...).format(1234).toString(); // +1,234 meters in en-US
+ * </pre>
+ *
+ * <p>
+ * This API offers more features than DecimalFormat and is geared toward new users of ICU.
+ *
+ * <p>
+ * NumberFormatter instances (i.e., LocalizedNumberFormatter and UnlocalizedNumberFormatter)
+ * are immutable and thread safe. This means that invoking a configuration method has no
+ * effect on the receiving instance; you must store and use the new number formatter instance it returns instead.
+ *
+ * <pre>
+ * UnlocalizedNumberFormatter formatter = UnlocalizedNumberFormatter::with().notation(Notation::scientific());
+ * formatter.precision(Precision.maxFraction(2)); // does nothing!
+ * formatter.locale(Locale.getEnglish()).format(9.8765).toString(); // prints "9.8765E0", not "9.88E0"
+ * </pre>
+ *
+ * <p>
+ * This API is based on the <em>fluent</em> design pattern popularized by libraries such as Google's Guava. For
+ * extensive details on the design of this API, read <a href="https://goo.gl/szi5VB">the design doc</a>.
+ *
+ * @author Shane Carr
+ */
+
+U_NAMESPACE_BEGIN
+
+// Forward declarations:
+class IFixedDecimal;
+class FieldPositionIteratorHandler;
+class FormattedStringBuilder;
+
+namespace numparse {
+namespace impl {
+
+// Forward declarations:
+class NumberParserImpl;
+class MultiplierParseHandler;
+
+}
+}
+
+namespace number { // icu::number
+
+// Forward declarations:
+class UnlocalizedNumberFormatter;
+class LocalizedNumberFormatter;
+class FormattedNumber;
+class Notation;
+class ScientificNotation;
+class Precision;
+class FractionPrecision;
+class CurrencyPrecision;
+class IncrementPrecision;
+class IntegerWidth;
+
+namespace impl {
+
+// can't be #ifndef U_HIDE_INTERNAL_API; referenced throughout this file in public classes
+/**
+ * Datatype for minimum/maximum fraction digits. Must be able to hold kMaxIntFracSig.
+ *
+ * @internal
+ */
+typedef int16_t digits_t;
+
+// can't be #ifndef U_HIDE_INTERNAL_API; needed for struct initialization
+/**
+ * Use a default threshold of 3. This means that the third time .format() is called, the data structures get built
+ * using the "safe" code path. The first two calls to .format() will trigger the unsafe code path.
+ *
+ * @internal
+ */
+static constexpr int32_t kInternalDefaultThreshold = 3;
+
+// Forward declarations:
+class Padder;
+struct MacroProps;
+struct MicroProps;
+class DecimalQuantity;
+class UFormattedNumberData;
+class NumberFormatterImpl;
+struct ParsedPatternInfo;
+class ScientificModifier;
+class MultiplierProducer;
+class RoundingImpl;
+class ScientificHandler;
+class Modifier;
+class AffixPatternProvider;
+class NumberPropertyMapper;
+struct DecimalFormatProperties;
+class MultiplierFormatHandler;
+class CurrencySymbols;
+class GeneratorHelpers;
+class DecNum;
+class NumberRangeFormatterImpl;
+struct RangeMacroProps;
+struct UFormattedNumberImpl;
+class MutablePatternModifier;
+class ImmutablePatternModifier;
+
+/**
+ * Used for NumberRangeFormatter and implemented in numrange_fluent.cpp.
+ * Declared here so it can be friended.
+ *
+ * @internal
+ */
+void touchRangeLocales(impl::RangeMacroProps& macros);
+
+} // namespace impl
+
+/**
+ * Extra name reserved in case it is needed in the future.
+ *
+ * @stable ICU 63
+ */
+typedef Notation CompactNotation;
+
+/**
+ * Extra name reserved in case it is needed in the future.
+ *
+ * @stable ICU 63
+ */
+typedef Notation SimpleNotation;
+
+/**
+ * A class that defines the notation style to be used when formatting numbers in NumberFormatter.
+ *
+ * @stable ICU 60
+ */
+class U_I18N_API Notation : public UMemory {
+ public:
+ /**
+ * Print the number using scientific notation (also known as scientific form, standard index form, or standard form
+ * in the UK). The format for scientific notation varies by locale; for example, many Western locales display the
+ * number in the form "#E0", where the number is displayed with one digit before the decimal separator, zero or more
+ * digits after the decimal separator, and the corresponding power of 10 displayed after the "E".
+ *
+ * <p>
+ * Example outputs in <em>en-US</em> when printing 8.765E4 through 8.765E-3:
+ *
+ * <pre>
+ * 8.765E4
+ * 8.765E3
+ * 8.765E2
+ * 8.765E1
+ * 8.765E0
+ * 8.765E-1
+ * 8.765E-2
+ * 8.765E-3
+ * 0E0
+ * </pre>
+ *
+ * @return A ScientificNotation for chaining or passing to the NumberFormatter notation() setter.
+ * @stable ICU 60
+ */
+ static ScientificNotation scientific();
+
+ /**
+ * Print the number using engineering notation, a variant of scientific notation in which the exponent must be
+ * divisible by 3.
+ *
+ * <p>
+ * Example outputs in <em>en-US</em> when printing 8.765E4 through 8.765E-3:
+ *
+ * <pre>
+ * 87.65E3
+ * 8.765E3
+ * 876.5E0
+ * 87.65E0
+ * 8.765E0
+ * 876.5E-3
+ * 87.65E-3
+ * 8.765E-3
+ * 0E0
+ * </pre>
+ *
+ * @return A ScientificNotation for chaining or passing to the NumberFormatter notation() setter.
+ * @stable ICU 60
+ */
+ static ScientificNotation engineering();
+
+ /**
+ * Print the number using short-form compact notation.
+ *
+ * <p>
+ * <em>Compact notation</em>, defined in Unicode Technical Standard #35 Part 3 Section 2.4.1, prints numbers with
+ * localized prefixes or suffixes corresponding to different powers of ten. Compact notation is similar to
+ * engineering notation in how it scales numbers.
+ *
+ * <p>
+ * Compact notation is ideal for displaying large numbers (over ~1000) to humans while at the same time minimizing
+ * screen real estate.
+ *
+ * <p>
+ * In short form, the powers of ten are abbreviated. In <em>en-US</em>, the abbreviations are "K" for thousands, "M"
+ * for millions, "B" for billions, and "T" for trillions. Example outputs in <em>en-US</em> when printing 8.765E7
+ * through 8.765E0:
+ *
+ * <pre>
+ * 88M
+ * 8.8M
+ * 876K
+ * 88K
+ * 8.8K
+ * 876
+ * 88
+ * 8.8
+ * </pre>
+ *
+ * <p>
+ * When compact notation is specified without an explicit rounding precision, numbers are rounded off to the closest
+ * integer after scaling the number by the corresponding power of 10, but with a digit shown after the decimal
+ * separator if there is only one digit before the decimal separator. The default compact notation rounding precision
+ * is equivalent to:
+ *
+ * <pre>
+ * Precision::integer().withMinDigits(2)
+ * </pre>
+ *
+ * @return A CompactNotation for passing to the NumberFormatter notation() setter.
+ * @stable ICU 60
+ */
+ static CompactNotation compactShort();
+
+ /**
+ * Print the number using long-form compact notation. For more information on compact notation, see
+ * {@link #compactShort}.
+ *
+ * <p>
+ * In long form, the powers of ten are spelled out fully. Example outputs in <em>en-US</em> when printing 8.765E7
+ * through 8.765E0:
+ *
+ * <pre>
+ * 88 million
+ * 8.8 million
+ * 876 thousand
+ * 88 thousand
+ * 8.8 thousand
+ * 876
+ * 88
+ * 8.8
+ * </pre>
+ *
+ * @return A CompactNotation for passing to the NumberFormatter notation() setter.
+ * @stable ICU 60
+ */
+ static CompactNotation compactLong();
+
+ /**
+ * Print the number using simple notation without any scaling by powers of ten. This is the default behavior.
+ *
+ * <p>
+ * Since this is the default behavior, this method needs to be called only when it is necessary to override a
+ * previous setting.
+ *
+ * <p>
+ * Example outputs in <em>en-US</em> when printing 8.765E7 through 8.765E0:
+ *
+ * <pre>
+ * 87,650,000
+ * 8,765,000
+ * 876,500
+ * 87,650
+ * 8,765
+ * 876.5
+ * 87.65
+ * 8.765
+ * </pre>
+ *
+ * @return A SimpleNotation for passing to the NumberFormatter notation() setter.
+ * @stable ICU 60
+ */
+ static SimpleNotation simple();
+
+ private:
+ enum NotationType {
+ NTN_SCIENTIFIC, NTN_COMPACT, NTN_SIMPLE, NTN_ERROR
+ } fType;
+
+ union NotationUnion {
+ // For NTN_SCIENTIFIC
+ /** @internal */
+ struct ScientificSettings {
+ /** @internal */
+ int8_t fEngineeringInterval;
+ /** @internal */
+ bool fRequireMinInt;
+ /** @internal */
+ impl::digits_t fMinExponentDigits;
+ /** @internal */
+ UNumberSignDisplay fExponentSignDisplay;
+ } scientific;
+
+ // For NTN_COMPACT
+ UNumberCompactStyle compactStyle;
+
+ // For NTN_ERROR
+ UErrorCode errorCode;
+ } fUnion;
+
+ typedef NotationUnion::ScientificSettings ScientificSettings;
+
+ Notation(const NotationType &type, const NotationUnion &union_) : fType(type), fUnion(union_) {}
+
+ Notation(UErrorCode errorCode) : fType(NTN_ERROR) {
+ fUnion.errorCode = errorCode;
+ }
+
+ Notation() : fType(NTN_SIMPLE), fUnion() {}
+
+ UBool copyErrorTo(UErrorCode &status) const {
+ if (fType == NTN_ERROR) {
+ status = fUnion.errorCode;
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ // To allow MacroProps to initialize empty instances:
+ friend struct impl::MacroProps;
+ friend class ScientificNotation;
+
+ // To allow implementation to access internal types:
+ friend class impl::NumberFormatterImpl;
+ friend class impl::ScientificModifier;
+ friend class impl::ScientificHandler;
+
+ // To allow access to the skeleton generation code:
+ friend class impl::GeneratorHelpers;
+};
+
+/**
+ * A class that defines the scientific notation style to be used when formatting numbers in NumberFormatter.
+ *
+ * <p>
+ * To create a ScientificNotation, use one of the factory methods in {@link Notation}.
+ *
+ * @stable ICU 60
+ */
+class U_I18N_API ScientificNotation : public Notation {
+ public:
+ /**
+ * Sets the minimum number of digits to show in the exponent of scientific notation, padding with zeros if
+ * necessary. Useful for fixed-width display.
+ *
+ * <p>
+ * For example, with minExponentDigits=2, the number 123 will be printed as "1.23E02" in <em>en-US</em> instead of
+ * the default "1.23E2".
+ *
+ * @param minExponentDigits
+ * The minimum number of digits to show in the exponent.
+ * @return A ScientificNotation, for chaining.
+ * @stable ICU 60
+ */
+ ScientificNotation withMinExponentDigits(int32_t minExponentDigits) const;
+
+ /**
+ * Sets whether to show the sign on positive and negative exponents in scientific notation. The default is AUTO,
+ * showing the minus sign but not the plus sign.
+ *
+ * <p>
+ * For example, with exponentSignDisplay=ALWAYS, the number 123 will be printed as "1.23E+2" in <em>en-US</em>
+ * instead of the default "1.23E2".
+ *
+ * @param exponentSignDisplay
+ * The strategy for displaying the sign in the exponent.
+ * @return A ScientificNotation, for chaining.
+ * @stable ICU 60
+ */
+ ScientificNotation withExponentSignDisplay(UNumberSignDisplay exponentSignDisplay) const;
+
+ private:
+ // Inherit constructor
+ using Notation::Notation;
+
+ // Raw constructor for NumberPropertyMapper
+ ScientificNotation(int8_t fEngineeringInterval, bool fRequireMinInt, impl::digits_t fMinExponentDigits,
+ UNumberSignDisplay fExponentSignDisplay);
+
+ friend class Notation;
+
+ // So that NumberPropertyMapper can create instances
+ friend class impl::NumberPropertyMapper;
+};
+
+/**
+ * Extra name reserved in case it is needed in the future.
+ *
+ * @stable ICU 63
+ */
+typedef Precision SignificantDigitsPrecision;
+
+/**
+ * A class that defines the rounding precision to be used when formatting numbers in NumberFormatter.
+ *
+ * <p>
+ * To create a Precision, use one of the factory methods.
+ *
+ * @stable ICU 60
+ */
+class U_I18N_API Precision : public UMemory {
+
+ public:
+ /**
+ * Show all available digits to full precision.
+ *
+ * <p>
+ * <strong>NOTE:</strong> When formatting a <em>double</em>, this method, along with {@link #minFraction} and
+ * {@link #minSignificantDigits}, will trigger complex algorithm similar to <em>Dragon4</em> to determine the
+ * low-order digits and the number of digits to display based on the value of the double.
+ * If the number of fraction places or significant digits can be bounded, consider using {@link #maxFraction}
+ * or {@link #maxSignificantDigits} instead to maximize performance.
+ * For more information, read the following blog post.
+ *
+ * <p>
+ * http://www.serpentine.com/blog/2011/06/29/here-be-dragons-advances-in-problems-you-didnt-even-know-you-had/
+ *
+ * @return A Precision for chaining or passing to the NumberFormatter precision() setter.
+ * @stable ICU 60
+ */
+ static Precision unlimited();
+
+ /**
+ * Show numbers rounded if necessary to the nearest integer.
+ *
+ * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter.
+ * @stable ICU 60
+ */
+ static FractionPrecision integer();
+
+ /**
+ * Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator).
+ * Additionally, pad with zeros to ensure that this number of places are always shown.
+ *
+ * <p>
+ * Example output with minMaxFractionPlaces = 3:
+ *
+ * <p>
+ * 87,650.000<br>
+ * 8,765.000<br>
+ * 876.500<br>
+ * 87.650<br>
+ * 8.765<br>
+ * 0.876<br>
+ * 0.088<br>
+ * 0.009<br>
+ * 0.000 (zero)
+ *
+ * <p>
+ * This method is equivalent to {@link #minMaxFraction} with both arguments equal.
+ *
+ * @param minMaxFractionPlaces
+ * The minimum and maximum number of numerals to display after the decimal separator (rounding if too
+ * long or padding with zeros if too short).
+ * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter.
+ * @stable ICU 60
+ */
+ static FractionPrecision fixedFraction(int32_t minMaxFractionPlaces);
+
+ /**
+ * Always show at least a certain number of fraction places after the decimal separator, padding with zeros if
+ * necessary. Do not perform rounding (display numbers to their full precision).
+ *
+ * <p>
+ * <strong>NOTE:</strong> If you are formatting <em>doubles</em>, see the performance note in {@link #unlimited}.
+ *
+ * @param minFractionPlaces
+ * The minimum number of numerals to display after the decimal separator (padding with zeros if
+ * necessary).
+ * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter.
+ * @stable ICU 60
+ */
+ static FractionPrecision minFraction(int32_t minFractionPlaces);
+
+ /**
+ * Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator).
+ * Unlike the other fraction rounding strategies, this strategy does <em>not</em> pad zeros to the end of the
+ * number.
+ *
+ * @param maxFractionPlaces
+ * The maximum number of numerals to display after the decimal mark (rounding if necessary).
+ * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter.
+ * @stable ICU 60
+ */
+ static FractionPrecision maxFraction(int32_t maxFractionPlaces);
+
+ /**
+ * Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator);
+ * in addition, always show at least a certain number of places after the decimal separator, padding with zeros if
+ * necessary.
+ *
+ * @param minFractionPlaces
+ * The minimum number of numerals to display after the decimal separator (padding with zeros if
+ * necessary).
+ * @param maxFractionPlaces
+ * The maximum number of numerals to display after the decimal separator (rounding if necessary).
+ * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter.
+ * @stable ICU 60
+ */
+ static FractionPrecision minMaxFraction(int32_t minFractionPlaces, int32_t maxFractionPlaces);
+
+ /**
+ * Show numbers rounded if necessary to a certain number of significant digits or significant figures. Additionally,
+ * pad with zeros to ensure that this number of significant digits/figures are always shown.
+ *
+ * <p>
+ * This method is equivalent to {@link #minMaxSignificantDigits} with both arguments equal.
+ *
+ * @param minMaxSignificantDigits
+ * The minimum and maximum number of significant digits to display (rounding if too long or padding with
+ * zeros if too short).
+ * @return A precision for chaining or passing to the NumberFormatter precision() setter.
+ * @stable ICU 62
+ */
+ static SignificantDigitsPrecision fixedSignificantDigits(int32_t minMaxSignificantDigits);
+
+ /**
+ * Always show at least a certain number of significant digits/figures, padding with zeros if necessary. Do not
+ * perform rounding (display numbers to their full precision).
+ *
+ * <p>
+ * <strong>NOTE:</strong> If you are formatting <em>doubles</em>, see the performance note in {@link #unlimited}.
+ *
+ * @param minSignificantDigits
+ * The minimum number of significant digits to display (padding with zeros if too short).
+ * @return A precision for chaining or passing to the NumberFormatter precision() setter.
+ * @stable ICU 62
+ */
+ static SignificantDigitsPrecision minSignificantDigits(int32_t minSignificantDigits);
+
+ /**
+ * Show numbers rounded if necessary to a certain number of significant digits/figures.
+ *
+ * @param maxSignificantDigits
+ * The maximum number of significant digits to display (rounding if too long).
+ * @return A precision for chaining or passing to the NumberFormatter precision() setter.
+ * @stable ICU 62
+ */
+ static SignificantDigitsPrecision maxSignificantDigits(int32_t maxSignificantDigits);
+
+ /**
+ * Show numbers rounded if necessary to a certain number of significant digits/figures; in addition, always show at
+ * least a certain number of significant digits, padding with zeros if necessary.
+ *
+ * @param minSignificantDigits
+ * The minimum number of significant digits to display (padding with zeros if necessary).
+ * @param maxSignificantDigits
+ * The maximum number of significant digits to display (rounding if necessary).
+ * @return A precision for chaining or passing to the NumberFormatter precision() setter.
+ * @stable ICU 62
+ */
+ static SignificantDigitsPrecision minMaxSignificantDigits(int32_t minSignificantDigits,
+ int32_t maxSignificantDigits);
+
+ /**
+ * Show numbers rounded if necessary to the closest multiple of a certain rounding increment. For example, if the
+ * rounding increment is 0.5, then round 1.2 to 1 and round 1.3 to 1.5.
+ *
+ * <p>
+ * In order to ensure that numbers are padded to the appropriate number of fraction places, call
+ * withMinFraction() on the return value of this method.
+ * For example, to round to the nearest 0.5 and always display 2 numerals after the
+ * decimal separator (to display 1.2 as "1.00" and 1.3 as "1.50"), you can run:
+ *
+ * <pre>
+ * Precision::increment(0.5).withMinFraction(2)
+ * </pre>
+ *
+ * @param roundingIncrement
+ * The increment to which to round numbers.
+ * @return A precision for chaining or passing to the NumberFormatter precision() setter.
+ * @stable ICU 60
+ */
+ static IncrementPrecision increment(double roundingIncrement);
+
+ /**
+ * Show numbers rounded and padded according to the rules for the currency unit. The most common
+ * rounding precision settings for currencies include <code>Precision::fixedFraction(2)</code>,
+ * <code>Precision::integer()</code>, and <code>Precision::increment(0.05)</code> for cash transactions
+ * ("nickel rounding").
+ *
+ * <p>
+ * The exact rounding details will be resolved at runtime based on the currency unit specified in the
+ * NumberFormatter chain. To round according to the rules for one currency while displaying the symbol for another
+ * currency, the withCurrency() method can be called on the return value of this method.
+ *
+ * @param currencyUsage
+ * Either STANDARD (for digital transactions) or CASH (for transactions where the rounding increment may
+ * be limited by the available denominations of cash or coins).
+ * @return A CurrencyPrecision for chaining or passing to the NumberFormatter precision() setter.
+ * @stable ICU 60
+ */
+ static CurrencyPrecision currency(UCurrencyUsage currencyUsage);
+
+ private:
+ enum PrecisionType {
+ RND_BOGUS,
+ RND_NONE,
+ RND_FRACTION,
+ RND_SIGNIFICANT,
+ RND_FRACTION_SIGNIFICANT,
+
+ // Used for strange increments like 3.14.
+ RND_INCREMENT,
+
+ // Used for increments with 1 as the only digit. This is different than fraction
+ // rounding because it supports having additional trailing zeros. For example, this
+ // class is used to round with the increment 0.010.
+ RND_INCREMENT_ONE,
+
+ // Used for increments with 5 as the only digit (nickel rounding).
+ RND_INCREMENT_FIVE,
+
+ RND_CURRENCY,
+ RND_ERROR
+ } fType;
+
+ union PrecisionUnion {
+ /** @internal */
+ struct FractionSignificantSettings {
+ // For RND_FRACTION, RND_SIGNIFICANT, and RND_FRACTION_SIGNIFICANT
+ /** @internal */
+ impl::digits_t fMinFrac;
+ /** @internal */
+ impl::digits_t fMaxFrac;
+ /** @internal */
+ impl::digits_t fMinSig;
+ /** @internal */
+ impl::digits_t fMaxSig;
+ } fracSig;
+ /** @internal */
+ struct IncrementSettings {
+ // For RND_INCREMENT, RND_INCREMENT_ONE, and RND_INCREMENT_FIVE
+ /** @internal */
+ double fIncrement;
+ /** @internal */
+ impl::digits_t fMinFrac;
+ /** @internal */
+ impl::digits_t fMaxFrac;
+ } increment;
+ UCurrencyUsage currencyUsage; // For RND_CURRENCY
+ UErrorCode errorCode; // For RND_ERROR
+ } fUnion;
+
+ typedef PrecisionUnion::FractionSignificantSettings FractionSignificantSettings;
+ typedef PrecisionUnion::IncrementSettings IncrementSettings;
+
+ /** The Precision encapsulates the RoundingMode when used within the implementation. */
+ UNumberFormatRoundingMode fRoundingMode;
+
+ Precision(const PrecisionType& type, const PrecisionUnion& union_,
+ UNumberFormatRoundingMode roundingMode)
+ : fType(type), fUnion(union_), fRoundingMode(roundingMode) {}
+
+ Precision(UErrorCode errorCode) : fType(RND_ERROR) {
+ fUnion.errorCode = errorCode;
+ }
+
+ Precision() : fType(RND_BOGUS) {}
+
+ bool isBogus() const {
+ return fType == RND_BOGUS;
+ }
+
+ UBool copyErrorTo(UErrorCode &status) const {
+ if (fType == RND_ERROR) {
+ status = fUnion.errorCode;
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ // On the parent type so that this method can be called internally on Precision instances.
+ Precision withCurrency(const CurrencyUnit &currency, UErrorCode &status) const;
+
+ static FractionPrecision constructFraction(int32_t minFrac, int32_t maxFrac);
+
+ static Precision constructSignificant(int32_t minSig, int32_t maxSig);
+
+ static Precision
+ constructFractionSignificant(const FractionPrecision &base, int32_t minSig, int32_t maxSig);
+
+ static IncrementPrecision constructIncrement(double increment, int32_t minFrac);
+
+ static CurrencyPrecision constructCurrency(UCurrencyUsage usage);
+
+ static Precision constructPassThrough();
+
+ // To allow MacroProps/MicroProps to initialize bogus instances:
+ friend struct impl::MacroProps;
+ friend struct impl::MicroProps;
+
+ // To allow NumberFormatterImpl to access isBogus() and other internal methods:
+ friend class impl::NumberFormatterImpl;
+
+ // To allow NumberPropertyMapper to create instances from DecimalFormatProperties:
+ friend class impl::NumberPropertyMapper;
+
+ // To allow access to the main implementation class:
+ friend class impl::RoundingImpl;
+
+ // To allow child classes to call private methods:
+ friend class FractionPrecision;
+ friend class CurrencyPrecision;
+ friend class IncrementPrecision;
+
+ // To allow access to the skeleton generation code:
+ friend class impl::GeneratorHelpers;
+};
+
+/**
+ * A class that defines a rounding precision based on a number of fraction places and optionally significant digits to be
+ * used when formatting numbers in NumberFormatter.
+ *
+ * <p>
+ * To create a FractionPrecision, use one of the factory methods on Precision.
+ *
+ * @stable ICU 60
+ */
+class U_I18N_API FractionPrecision : public Precision {
+ public:
+ /**
+ * Ensure that no less than this number of significant digits are retained when rounding according to fraction
+ * rules.
+ *
+ * <p>
+ * For example, with integer rounding, the number 3.141 becomes "3". However, with minimum figures set to 2, 3.141
+ * becomes "3.1" instead.
+ *
+ * <p>
+ * This setting does not affect the number of trailing zeros. For example, 3.01 would print as "3", not "3.0".
+ *
+ * @param minSignificantDigits
+ * The number of significant figures to guarantee.
+ * @return A precision for chaining or passing to the NumberFormatter precision() setter.
+ * @stable ICU 60
+ */
+ Precision withMinDigits(int32_t minSignificantDigits) const;
+
+ /**
+ * Ensure that no more than this number of significant digits are retained when rounding according to fraction
+ * rules.
+ *
+ * <p>
+ * For example, with integer rounding, the number 123.4 becomes "123". However, with maximum figures set to 2, 123.4
+ * becomes "120" instead.
+ *
+ * <p>
+ * This setting does not affect the number of trailing zeros. For example, with fixed fraction of 2, 123.4 would
+ * become "120.00".
+ *
+ * @param maxSignificantDigits
+ * Round the number to no more than this number of significant figures.
+ * @return A precision for chaining or passing to the NumberFormatter precision() setter.
+ * @stable ICU 60
+ */
+ Precision withMaxDigits(int32_t maxSignificantDigits) const;
+
+ private:
+ // Inherit constructor
+ using Precision::Precision;
+
+ // To allow parent class to call this class's constructor:
+ friend class Precision;
+};
+
+/**
+ * A class that defines a rounding precision parameterized by a currency to be used when formatting numbers in
+ * NumberFormatter.
+ *
+ * <p>
+ * To create a CurrencyPrecision, use one of the factory methods on Precision.
+ *
+ * @stable ICU 60
+ */
+class U_I18N_API CurrencyPrecision : public Precision {
+ public:
+ /**
+ * Associates a currency with this rounding precision.
+ *
+ * <p>
+ * <strong>Calling this method is <em>not required</em></strong>, because the currency specified in unit()
+ * is automatically applied to currency rounding precisions. However,
+ * this method enables you to override that automatic association.
+ *
+ * <p>
+ * This method also enables numbers to be formatted using currency rounding rules without explicitly using a
+ * currency format.
+ *
+ * @param currency
+ * The currency to associate with this rounding precision.
+ * @return A precision for chaining or passing to the NumberFormatter precision() setter.
+ * @stable ICU 60
+ */
+ Precision withCurrency(const CurrencyUnit &currency) const;
+
+ private:
+ // Inherit constructor
+ using Precision::Precision;
+
+ // To allow parent class to call this class's constructor:
+ friend class Precision;
+};
+
+/**
+ * A class that defines a rounding precision parameterized by a rounding increment to be used when formatting numbers in
+ * NumberFormatter.
+ *
+ * <p>
+ * To create an IncrementPrecision, use one of the factory methods on Precision.
+ *
+ * @stable ICU 60
+ */
+class U_I18N_API IncrementPrecision : public Precision {
+ public:
+ /**
+ * Specifies the minimum number of fraction digits to render after the decimal separator, padding with zeros if
+ * necessary. By default, no trailing zeros are added.
+ *
+ * <p>
+ * For example, if the rounding increment is 0.5 and minFrac is 2, then the resulting strings include "0.00",
+ * "0.50", "1.00", and "1.50".
+ *
+ * <p>
+ * Note: In ICU4J, this functionality is accomplished via the scale of the BigDecimal rounding increment.
+ *
+ * @param minFrac The minimum number of digits after the decimal separator.
+ * @return A precision for chaining or passing to the NumberFormatter precision() setter.
+ * @stable ICU 60
+ */
+ Precision withMinFraction(int32_t minFrac) const;
+
+ private:
+ // Inherit constructor
+ using Precision::Precision;
+
+ // To allow parent class to call this class's constructor:
+ friend class Precision;
+};
+
+/**
+ * A class that defines the strategy for padding and truncating integers before the decimal separator.
+ *
+ * <p>
+ * To create an IntegerWidth, use one of the factory methods.
+ *
+ * @stable ICU 60
+ * @see NumberFormatter
+ */
+class U_I18N_API IntegerWidth : public UMemory {
+ public:
+ /**
+ * Pad numbers at the beginning with zeros to guarantee a certain number of numerals before the decimal separator.
+ *
+ * <p>
+ * For example, with minInt=3, the number 55 will get printed as "055".
+ *
+ * @param minInt
+ * The minimum number of places before the decimal separator.
+ * @return An IntegerWidth for chaining or passing to the NumberFormatter integerWidth() setter.
+ * @stable ICU 60
+ */
+ static IntegerWidth zeroFillTo(int32_t minInt);
+
+ /**
+ * Truncate numbers exceeding a certain number of numerals before the decimal separator.
+ *
+ * For example, with maxInt=3, the number 1234 will get printed as "234".
+ *
+ * @param maxInt
+ * The maximum number of places before the decimal separator. maxInt == -1 means no
+ * truncation.
+ * @return An IntegerWidth for passing to the NumberFormatter integerWidth() setter.
+ * @stable ICU 60
+ */
+ IntegerWidth truncateAt(int32_t maxInt);
+
+ private:
+ union {
+ struct {
+ impl::digits_t fMinInt;
+ impl::digits_t fMaxInt;
+ bool fFormatFailIfMoreThanMaxDigits;
+ } minMaxInt;
+ UErrorCode errorCode;
+ } fUnion;
+ bool fHasError = false;
+
+ IntegerWidth(impl::digits_t minInt, impl::digits_t maxInt, bool formatFailIfMoreThanMaxDigits);
+
+ IntegerWidth(UErrorCode errorCode) { // NOLINT
+ fUnion.errorCode = errorCode;
+ fHasError = true;
+ }
+
+ IntegerWidth() { // NOLINT
+ fUnion.minMaxInt.fMinInt = -1;
+ }
+
+ /** Returns the default instance. */
+ static IntegerWidth standard() {
+ return IntegerWidth::zeroFillTo(1);
+ }
+
+ bool isBogus() const {
+ return !fHasError && fUnion.minMaxInt.fMinInt == -1;
+ }
+
+ UBool copyErrorTo(UErrorCode &status) const {
+ if (fHasError) {
+ status = fUnion.errorCode;
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ void apply(impl::DecimalQuantity &quantity, UErrorCode &status) const;
+
+ bool operator==(const IntegerWidth& other) const;
+
+ // To allow MacroProps/MicroProps to initialize empty instances:
+ friend struct impl::MacroProps;
+ friend struct impl::MicroProps;
+
+ // To allow NumberFormatterImpl to access isBogus():
+ friend class impl::NumberFormatterImpl;
+
+ // To allow the use of this class when formatting:
+ friend class impl::MutablePatternModifier;
+ friend class impl::ImmutablePatternModifier;
+
+ // So that NumberPropertyMapper can create instances
+ friend class impl::NumberPropertyMapper;
+
+ // To allow access to the skeleton generation code:
+ friend class impl::GeneratorHelpers;
+};
+
+/**
+ * A class that defines a quantity by which a number should be multiplied when formatting.
+ *
+ * <p>
+ * To create a Scale, use one of the factory methods.
+ *
+ * @stable ICU 62
+ */
+class U_I18N_API Scale : public UMemory {
+ public:
+ /**
+ * Do not change the value of numbers when formatting or parsing.
+ *
+ * @return A Scale to prevent any multiplication.
+ * @stable ICU 62
+ */
+ static Scale none();
+
+ /**
+ * Multiply numbers by a power of ten before formatting. Useful for combining with a percent unit:
+ *
+ * <pre>
+ * NumberFormatter::with().unit(NoUnit::percent()).multiplier(Scale::powerOfTen(2))
+ * </pre>
+ *
+ * @return A Scale for passing to the setter in NumberFormatter.
+ * @stable ICU 62
+ */
+ static Scale powerOfTen(int32_t power);
+
+ /**
+ * Multiply numbers by an arbitrary value before formatting. Useful for unit conversions.
+ *
+ * This method takes a string in a decimal number format with syntax
+ * as defined in the Decimal Arithmetic Specification, available at
+ * http://speleotrove.com/decimal
+ *
+ * Also see the version of this method that takes a double.
+ *
+ * @return A Scale for passing to the setter in NumberFormatter.
+ * @stable ICU 62
+ */
+ static Scale byDecimal(StringPiece multiplicand);
+
+ /**
+ * Multiply numbers by an arbitrary value before formatting. Useful for unit conversions.
+ *
+ * This method takes a double; also see the version of this method that takes an exact decimal.
+ *
+ * @return A Scale for passing to the setter in NumberFormatter.
+ * @stable ICU 62
+ */
+ static Scale byDouble(double multiplicand);
+
+ /**
+ * Multiply a number by both a power of ten and by an arbitrary double value.
+ *
+ * @return A Scale for passing to the setter in NumberFormatter.
+ * @stable ICU 62
+ */
+ static Scale byDoubleAndPowerOfTen(double multiplicand, int32_t power);
+
+ // We need a custom destructor for the DecNum, which means we need to declare
+ // the copy/move constructor/assignment quartet.
+
+ /** @stable ICU 62 */
+ Scale(const Scale& other);
+
+ /** @stable ICU 62 */
+ Scale& operator=(const Scale& other);
+
+ /** @stable ICU 62 */
+ Scale(Scale&& src) U_NOEXCEPT;
+
+ /** @stable ICU 62 */
+ Scale& operator=(Scale&& src) U_NOEXCEPT;
+
+ /** @stable ICU 62 */
+ ~Scale();
+
+#ifndef U_HIDE_INTERNAL_API
+ /** @internal */
+ Scale(int32_t magnitude, impl::DecNum* arbitraryToAdopt);
+#endif /* U_HIDE_INTERNAL_API */
+
+ private:
+ int32_t fMagnitude;
+ impl::DecNum* fArbitrary;
+ UErrorCode fError;
+
+ Scale(UErrorCode error) : fMagnitude(0), fArbitrary(nullptr), fError(error) {}
+
+ Scale() : fMagnitude(0), fArbitrary(nullptr), fError(U_ZERO_ERROR) {}
+
+ bool isValid() const {
+ return fMagnitude != 0 || fArbitrary != nullptr;
+ }
+
+ UBool copyErrorTo(UErrorCode &status) const {
+ if (fError != U_ZERO_ERROR) {
+ status = fError;
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ void applyTo(impl::DecimalQuantity& quantity) const;
+
+ void applyReciprocalTo(impl::DecimalQuantity& quantity) const;
+
+ // To allow MacroProps/MicroProps to initialize empty instances:
+ friend struct impl::MacroProps;
+ friend struct impl::MicroProps;
+
+ // To allow NumberFormatterImpl to access isBogus() and perform other operations:
+ friend class impl::NumberFormatterImpl;
+
+ // To allow the helper class MultiplierFormatHandler access to private fields:
+ friend class impl::MultiplierFormatHandler;
+
+ // To allow access to the skeleton generation code:
+ friend class impl::GeneratorHelpers;
+
+ // To allow access to parsing code:
+ friend class ::icu::numparse::impl::NumberParserImpl;
+ friend class ::icu::numparse::impl::MultiplierParseHandler;
+};
+
+namespace impl {
+
+// Do not enclose entire SymbolsWrapper with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
+/** @internal */
+class U_I18N_API SymbolsWrapper : public UMemory {
+ public:
+ /** @internal */
+ SymbolsWrapper() : fType(SYMPTR_NONE), fPtr{nullptr} {}
+
+ /** @internal */
+ SymbolsWrapper(const SymbolsWrapper &other);
+
+ /** @internal */
+ SymbolsWrapper &operator=(const SymbolsWrapper &other);
+
+ /** @internal */
+ SymbolsWrapper(SymbolsWrapper&& src) U_NOEXCEPT;
+
+ /** @internal */
+ SymbolsWrapper &operator=(SymbolsWrapper&& src) U_NOEXCEPT;
+
+ /** @internal */
+ ~SymbolsWrapper();
+
+#ifndef U_HIDE_INTERNAL_API
+
+ /**
+ * The provided object is copied, but we do not adopt it.
+ * @internal
+ */
+ void setTo(const DecimalFormatSymbols &dfs);
+
+ /**
+ * Adopt the provided object.
+ * @internal
+ */
+ void setTo(const NumberingSystem *ns);
+
+ /**
+ * Whether the object is currently holding a DecimalFormatSymbols.
+ * @internal
+ */
+ bool isDecimalFormatSymbols() const;
+
+ /**
+ * Whether the object is currently holding a NumberingSystem.
+ * @internal
+ */
+ bool isNumberingSystem() const;
+
+ /**
+ * Get the DecimalFormatSymbols pointer. No ownership change.
+ * @internal
+ */
+ const DecimalFormatSymbols *getDecimalFormatSymbols() const;
+
+ /**
+ * Get the NumberingSystem pointer. No ownership change.
+ * @internal
+ */
+ const NumberingSystem *getNumberingSystem() const;
+
+#endif // U_HIDE_INTERNAL_API
+
+ /** @internal */
+ UBool copyErrorTo(UErrorCode &status) const {
+ if (fType == SYMPTR_DFS && fPtr.dfs == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return TRUE;
+ } else if (fType == SYMPTR_NS && fPtr.ns == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ private:
+ enum SymbolsPointerType {
+ SYMPTR_NONE, SYMPTR_DFS, SYMPTR_NS
+ } fType;
+
+ union {
+ const DecimalFormatSymbols *dfs;
+ const NumberingSystem *ns;
+ } fPtr;
+
+ void doCopyFrom(const SymbolsWrapper &other);
+
+ void doMoveFrom(SymbolsWrapper&& src);
+
+ void doCleanup();
+};
+
+// Do not enclose entire Grouper with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
+/** @internal */
+class U_I18N_API Grouper : public UMemory {
+ public:
+#ifndef U_HIDE_INTERNAL_API
+ /** @internal */
+ static Grouper forStrategy(UNumberGroupingStrategy grouping);
+
+ /**
+ * Resolve the values in Properties to a Grouper object.
+ * @internal
+ */
+ static Grouper forProperties(const DecimalFormatProperties& properties);
+
+ // Future: static Grouper forProperties(DecimalFormatProperties& properties);
+
+ /** @internal */
+ Grouper(int16_t grouping1, int16_t grouping2, int16_t minGrouping, UNumberGroupingStrategy strategy)
+ : fGrouping1(grouping1),
+ fGrouping2(grouping2),
+ fMinGrouping(minGrouping),
+ fStrategy(strategy) {}
+#endif // U_HIDE_INTERNAL_API
+
+ /** @internal */
+ int16_t getPrimary() const;
+
+ /** @internal */
+ int16_t getSecondary() const;
+
+ private:
+ /**
+ * The grouping sizes, with the following special values:
+ * <ul>
+ * <li>-1 = no grouping
+ * <li>-2 = needs locale data
+ * <li>-4 = fall back to Western grouping if not in locale
+ * </ul>
+ */
+ int16_t fGrouping1;
+ int16_t fGrouping2;
+
+ /**
+ * The minimum grouping size, with the following special values:
+ * <ul>
+ * <li>-2 = needs locale data
+ * <li>-3 = no less than 2
+ * </ul>
+ */
+ int16_t fMinGrouping;
+
+ /**
+ * The UNumberGroupingStrategy that was used to create this Grouper, or UNUM_GROUPING_COUNT if this
+ * was not created from a UNumberGroupingStrategy.
+ */
+ UNumberGroupingStrategy fStrategy;
+
+ Grouper() : fGrouping1(-3) {}
+
+ bool isBogus() const {
+ return fGrouping1 == -3;
+ }
+
+ /** NON-CONST: mutates the current instance. */
+ void setLocaleData(const impl::ParsedPatternInfo &patternInfo, const Locale& locale);
+
+ bool groupAtPosition(int32_t position, const impl::DecimalQuantity &value) const;
+
+ // To allow MacroProps/MicroProps to initialize empty instances:
+ friend struct MacroProps;
+ friend struct MicroProps;
+
+ // To allow NumberFormatterImpl to access isBogus() and perform other operations:
+ friend class NumberFormatterImpl;
+
+ // To allow NumberParserImpl to perform setLocaleData():
+ friend class ::icu::numparse::impl::NumberParserImpl;
+
+ // To allow access to the skeleton generation code:
+ friend class impl::GeneratorHelpers;
+};
+
+// Do not enclose entire Padder with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
+/** @internal */
+class U_I18N_API Padder : public UMemory {
+ public:
+#ifndef U_HIDE_INTERNAL_API
+ /** @internal */
+ static Padder none();
+
+ /** @internal */
+ static Padder codePoints(UChar32 cp, int32_t targetWidth, UNumberFormatPadPosition position);
+#endif // U_HIDE_INTERNAL_API
+
+ /** @internal */
+ static Padder forProperties(const DecimalFormatProperties& properties);
+
+ private:
+ UChar32 fWidth; // -3 = error; -2 = bogus; -1 = no padding
+ union {
+ struct {
+ int32_t fCp;
+ UNumberFormatPadPosition fPosition;
+ } padding;
+ UErrorCode errorCode;
+ } fUnion;
+
+ Padder(UChar32 cp, int32_t width, UNumberFormatPadPosition position);
+
+ Padder(int32_t width);
+
+ Padder(UErrorCode errorCode) : fWidth(-3) { // NOLINT
+ fUnion.errorCode = errorCode;
+ }
+
+ Padder() : fWidth(-2) {} // NOLINT
+
+ bool isBogus() const {
+ return fWidth == -2;
+ }
+
+ UBool copyErrorTo(UErrorCode &status) const {
+ if (fWidth == -3) {
+ status = fUnion.errorCode;
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ bool isValid() const {
+ return fWidth > 0;
+ }
+
+ int32_t padAndApply(const impl::Modifier &mod1, const impl::Modifier &mod2,
+ FormattedStringBuilder &string, int32_t leftIndex, int32_t rightIndex,
+ UErrorCode &status) const;
+
+ // To allow MacroProps/MicroProps to initialize empty instances:
+ friend struct MacroProps;
+ friend struct MicroProps;
+
+ // To allow NumberFormatterImpl to access isBogus() and perform other operations:
+ friend class impl::NumberFormatterImpl;
+
+ // To allow access to the skeleton generation code:
+ friend class impl::GeneratorHelpers;
+};
+
+// Do not enclose entire MacroProps with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
+/** @internal */
+struct U_I18N_API MacroProps : public UMemory {
+ /** @internal */
+ Notation notation;
+
+ /** @internal */
+ MeasureUnit unit; // = NoUnit::base();
+
+ /** @internal */
+ MeasureUnit perUnit; // = NoUnit::base();
+
+ /** @internal */
+ Precision precision; // = Precision(); (bogus)
+
+ /** @internal */
+ UNumberFormatRoundingMode roundingMode = UNUM_ROUND_HALFEVEN;
+
+ /** @internal */
+ Grouper grouper; // = Grouper(); (bogus)
+
+ /** @internal */
+ Padder padder; // = Padder(); (bogus)
+
+ /** @internal */
+ IntegerWidth integerWidth; // = IntegerWidth(); (bogus)
+
+ /** @internal */
+ SymbolsWrapper symbols;
+
+ // UNUM_XYZ_COUNT denotes null (bogus) values.
+
+ /** @internal */
+ UNumberUnitWidth unitWidth = UNUM_UNIT_WIDTH_COUNT;
+
+ /** @internal */
+ UNumberSignDisplay sign = UNUM_SIGN_COUNT;
+
+ /** @internal */
+ UNumberDecimalSeparatorDisplay decimal = UNUM_DECIMAL_SEPARATOR_COUNT;
+
+ /** @internal */
+ Scale scale; // = Scale(); (benign value)
+
+ /** @internal */
+ const AffixPatternProvider* affixProvider = nullptr; // no ownership
+
+ /** @internal */
+ const PluralRules* rules = nullptr; // no ownership
+
+ /** @internal */
+ int32_t threshold = kInternalDefaultThreshold;
+
+ /** @internal */
+ Locale locale;
+
+ // NOTE: Uses default copy and move constructors.
+
+ /**
+ * Check all members for errors.
+ * @internal
+ */
+ bool copyErrorTo(UErrorCode &status) const {
+ return notation.copyErrorTo(status) || precision.copyErrorTo(status) ||
+ padder.copyErrorTo(status) || integerWidth.copyErrorTo(status) ||
+ symbols.copyErrorTo(status) || scale.copyErrorTo(status);
+ }
+};
+
+} // namespace impl
+
+#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
+// Ignore MSVC warning 4661. This is generated for NumberFormatterSettings<>::toSkeleton() as this method
+// is defined elsewhere (in number_skeletons.cpp). The compiler is warning that the explicit template instantiation
+// inside this single translation unit (CPP file) is incomplete, and thus it isn't sure if the template class is
+// fully defined. However, since each translation unit explicitly instantiates all the necessary template classes,
+// they will all be passed to the linker, and the linker will still find and export all the class members.
+#pragma warning(push)
+#pragma warning(disable: 4661)
+#endif
+
+/**
+ * An abstract base class for specifying settings related to number formatting. This class is implemented by
+ * {@link UnlocalizedNumberFormatter} and {@link LocalizedNumberFormatter}. This class is not intended for
+ * public subclassing.
+ */
+template<typename Derived>
+class U_I18N_API NumberFormatterSettings {
+ public:
+ /**
+ * Specifies the notation style (simple, scientific, or compact) for rendering numbers.
+ *
+ * <ul>
+ * <li>Simple notation: "12,300"
+ * <li>Scientific notation: "1.23E4"
+ * <li>Compact notation: "12K"
+ * </ul>
+ *
+ * <p>
+ * All notation styles will be properly localized with locale data, and all notation styles are compatible with
+ * units, rounding precisions, and other number formatter settings.
+ *
+ * <p>
+ * Pass this method the return value of a {@link Notation} factory method. For example:
+ *
+ * <pre>
+ * NumberFormatter::with().notation(Notation::compactShort())
+ * </pre>
+ *
+ * The default is to use simple notation.
+ *
+ * @param notation
+ * The notation strategy to use.
+ * @return The fluent chain.
+ * @see Notation
+ * @stable ICU 60
+ */
+ Derived notation(const Notation &notation) const &;
+
+ /**
+ * Overload of notation() for use on an rvalue reference.
+ *
+ * @param notation
+ * The notation strategy to use.
+ * @return The fluent chain.
+ * @see #notation
+ * @stable ICU 62
+ */
+ Derived notation(const Notation &notation) &&;
+
+ /**
+ * Specifies the unit (unit of measure, currency, or percent) to associate with rendered numbers.
+ *
+ * <ul>
+ * <li>Unit of measure: "12.3 meters"
+ * <li>Currency: "$12.30"
+ * <li>Percent: "12.3%"
+ * </ul>
+ *
+ * All units will be properly localized with locale data, and all units are compatible with notation styles,
+ * rounding precisions, and other number formatter settings.
+ *
+ * Pass this method any instance of {@link MeasureUnit}. For units of measure:
+ *
+ * <pre>
+ * NumberFormatter::with().unit(MeasureUnit::getMeter())
+ * </pre>
+ *
+ * Currency:
+ *
+ * <pre>
+ * NumberFormatter::with().unit(CurrencyUnit(u"USD", status))
+ * </pre>
+ *
+ * Percent:
+ *
+ * <pre>
+ * NumberFormatter::with().unit(NoUnit.percent())
+ * </pre>
+ *
+ * See {@link #perUnit} for information on how to format strings like "5 meters per second".
+ *
+ * The default is to render without units (equivalent to NoUnit.base()).
+ *
+ * @param unit
+ * The unit to render.
+ * @return The fluent chain.
+ * @see MeasureUnit
+ * @see Currency
+ * @see NoUnit
+ * @see #perUnit
+ * @stable ICU 60
+ */
+ Derived unit(const icu::MeasureUnit &unit) const &;
+
+ /**
+ * Overload of unit() for use on an rvalue reference.
+ *
+ * @param unit
+ * The unit to render.
+ * @return The fluent chain.
+ * @see #unit
+ * @stable ICU 62
+ */
+ Derived unit(const icu::MeasureUnit &unit) &&;
+
+ /**
+ * Like unit(), but takes ownership of a pointer. Convenient for use with the MeasureFormat factory
+ * methods that return pointers that need ownership.
+ *
+ * Note: consider using the MeasureFormat factory methods that return by value.
+ *
+ * @param unit
+ * The unit to render.
+ * @return The fluent chain.
+ * @see #unit
+ * @see MeasureUnit
+ * @stable ICU 60
+ */
+ Derived adoptUnit(icu::MeasureUnit *unit) const &;
+
+ /**
+ * Overload of adoptUnit() for use on an rvalue reference.
+ *
+ * @param unit
+ * The unit to render.
+ * @return The fluent chain.
+ * @see #adoptUnit
+ * @stable ICU 62
+ */
+ Derived adoptUnit(icu::MeasureUnit *unit) &&;
+
+ /**
+ * Sets a unit to be used in the denominator. For example, to format "3 m/s", pass METER to the unit and SECOND to
+ * the perUnit.
+ *
+ * Pass this method any instance of {@link MeasureUnit}. Example:
+ *
+ * <pre>
+ * NumberFormatter::with()
+ * .unit(MeasureUnit::getMeter())
+ * .perUnit(MeasureUnit::getSecond())
+ * </pre>
+ *
+ * The default is not to display any unit in the denominator.
+ *
+ * If a per-unit is specified without a primary unit via {@link #unit}, the behavior is undefined.
+ *
+ * @param perUnit
+ * The unit to render in the denominator.
+ * @return The fluent chain
+ * @see #unit
+ * @stable ICU 61
+ */
+ Derived perUnit(const icu::MeasureUnit &perUnit) const &;
+
+ /**
+ * Overload of perUnit() for use on an rvalue reference.
+ *
+ * @param perUnit
+ * The unit to render in the denominator.
+ * @return The fluent chain.
+ * @see #perUnit
+ * @stable ICU 62
+ */
+ Derived perUnit(const icu::MeasureUnit &perUnit) &&;
+
+ /**
+ * Like perUnit(), but takes ownership of a pointer. Convenient for use with the MeasureFormat factory
+ * methods that return pointers that need ownership.
+ *
+ * Note: consider using the MeasureFormat factory methods that return by value.
+ *
+ * @param perUnit
+ * The unit to render in the denominator.
+ * @return The fluent chain.
+ * @see #perUnit
+ * @see MeasureUnit
+ * @stable ICU 61
+ */
+ Derived adoptPerUnit(icu::MeasureUnit *perUnit) const &;
+
+ /**
+ * Overload of adoptPerUnit() for use on an rvalue reference.
+ *
+ * @param perUnit
+ * The unit to render in the denominator.
+ * @return The fluent chain.
+ * @see #adoptPerUnit
+ * @stable ICU 62
+ */
+ Derived adoptPerUnit(icu::MeasureUnit *perUnit) &&;
+
+ /**
+ * Specifies the rounding precision to use when formatting numbers.
+ *
+ * <ul>
+ * <li>Round to 3 decimal places: "3.142"
+ * <li>Round to 3 significant figures: "3.14"
+ * <li>Round to the closest nickel: "3.15"
+ * <li>Do not perform rounding: "3.1415926..."
+ * </ul>
+ *
+ * <p>
+ * Pass this method the return value of one of the factory methods on {@link Precision}. For example:
+ *
+ * <pre>
+ * NumberFormatter::with().precision(Precision::fixedFraction(2))
+ * </pre>
+ *
+ * <p>
+ * In most cases, the default rounding strategy is to round to 6 fraction places; i.e.,
+ * <code>Precision.maxFraction(6)</code>. The exceptions are if compact notation is being used, then the compact
+ * notation rounding strategy is used (see {@link Notation#compactShort} for details), or if the unit is a currency,
+ * then standard currency rounding is used, which varies from currency to currency (see {@link Precision#currency} for
+ * details).
+ *
+ * @param precision
+ * The rounding precision to use.
+ * @return The fluent chain.
+ * @see Precision
+ * @stable ICU 62
+ */
+ Derived precision(const Precision& precision) const &;
+
+ /**
+ * Overload of precision() for use on an rvalue reference.
+ *
+ * @param precision
+ * The rounding precision to use.
+ * @return The fluent chain.
+ * @see #precision
+ * @stable ICU 62
+ */
+ Derived precision(const Precision& precision) &&;
+
+ /**
+ * Specifies how to determine the direction to round a number when it has more digits than fit in the
+ * desired precision. When formatting 1.235:
+ *
+ * <ul>
+ * <li>Ceiling rounding mode with integer precision: "2"
+ * <li>Half-down rounding mode with 2 fixed fraction digits: "1.23"
+ * <li>Half-up rounding mode with 2 fixed fraction digits: "1.24"
+ * </ul>
+ *
+ * The default is HALF_EVEN. For more information on rounding mode, see the ICU userguide here:
+ *
+ * http://userguide.icu-project.org/formatparse/numbers/rounding-modes
+ *
+ * @param roundingMode The rounding mode to use.
+ * @return The fluent chain.
+ * @stable ICU 62
+ */
+ Derived roundingMode(UNumberFormatRoundingMode roundingMode) const &;
+
+ /**
+ * Overload of roundingMode() for use on an rvalue reference.
+ *
+ * @param roundingMode The rounding mode to use.
+ * @return The fluent chain.
+ * @see #roundingMode
+ * @stable ICU 62
+ */
+ Derived roundingMode(UNumberFormatRoundingMode roundingMode) &&;
+
+ /**
+ * Specifies the grouping strategy to use when formatting numbers.
+ *
+ * <ul>
+ * <li>Default grouping: "12,300" and "1,230"
+ * <li>Grouping with at least 2 digits: "12,300" and "1230"
+ * <li>No grouping: "12300" and "1230"
+ * </ul>
+ *
+ * <p>
+ * The exact grouping widths will be chosen based on the locale.
+ *
+ * <p>
+ * Pass this method an element from the {@link UNumberGroupingStrategy} enum. For example:
+ *
+ * <pre>
+ * NumberFormatter::with().grouping(UNUM_GROUPING_MIN2)
+ * </pre>
+ *
+ * The default is to perform grouping according to locale data; most locales, but not all locales,
+ * enable it by default.
+ *
+ * @param strategy
+ * The grouping strategy to use.
+ * @return The fluent chain.
+ * @stable ICU 61
+ */
+ Derived grouping(UNumberGroupingStrategy strategy) const &;
+
+ /**
+ * Overload of grouping() for use on an rvalue reference.
+ *
+ * @param strategy
+ * The grouping strategy to use.
+ * @return The fluent chain.
+ * @see #grouping
+ * @stable ICU 62
+ */
+ Derived grouping(UNumberGroupingStrategy strategy) &&;
+
+ /**
+ * Specifies the minimum and maximum number of digits to render before the decimal mark.
+ *
+ * <ul>
+ * <li>Zero minimum integer digits: ".08"
+ * <li>One minimum integer digit: "0.08"
+ * <li>Two minimum integer digits: "00.08"
+ * </ul>
+ *
+ * <p>
+ * Pass this method the return value of {@link IntegerWidth#zeroFillTo}. For example:
+ *
+ * <pre>
+ * NumberFormatter::with().integerWidth(IntegerWidth::zeroFillTo(2))
+ * </pre>
+ *
+ * The default is to have one minimum integer digit.
+ *
+ * @param style
+ * The integer width to use.
+ * @return The fluent chain.
+ * @see IntegerWidth
+ * @stable ICU 60
+ */
+ Derived integerWidth(const IntegerWidth &style) const &;
+
+ /**
+ * Overload of integerWidth() for use on an rvalue reference.
+ *
+ * @param style
+ * The integer width to use.
+ * @return The fluent chain.
+ * @see #integerWidth
+ * @stable ICU 62
+ */
+ Derived integerWidth(const IntegerWidth &style) &&;
+
+ /**
+ * Specifies the symbols (decimal separator, grouping separator, percent sign, numerals, etc.) to use when rendering
+ * numbers.
+ *
+ * <ul>
+ * <li><em>en_US</em> symbols: "12,345.67"
+ * <li><em>fr_FR</em> symbols: "12&nbsp;345,67"
+ * <li><em>de_CH</em> symbols: "12’345.67"
+ * <li><em>my_MY</em> symbols: "၁၂,၃၄၅.၆၇"
+ * </ul>
+ *
+ * <p>
+ * Pass this method an instance of {@link DecimalFormatSymbols}. For example:
+ *
+ * <pre>
+ * NumberFormatter::with().symbols(DecimalFormatSymbols(Locale("de_CH"), status))
+ * </pre>
+ *
+ * <p>
+ * <strong>Note:</strong> DecimalFormatSymbols automatically chooses the best numbering system based on the locale.
+ * In the examples above, the first three are using the Latin numbering system, and the fourth is using the Myanmar
+ * numbering system.
+ *
+ * <p>
+ * <strong>Note:</strong> The instance of DecimalFormatSymbols will be copied: changes made to the symbols object
+ * after passing it into the fluent chain will not be seen.
+ *
+ * <p>
+ * <strong>Note:</strong> Calling this method will override any previously specified DecimalFormatSymbols
+ * or NumberingSystem.
+ *
+ * <p>
+ * The default is to choose the symbols based on the locale specified in the fluent chain.
+ *
+ * @param symbols
+ * The DecimalFormatSymbols to use.
+ * @return The fluent chain.
+ * @see DecimalFormatSymbols
+ * @stable ICU 60
+ */
+ Derived symbols(const DecimalFormatSymbols &symbols) const &;
+
+ /**
+ * Overload of symbols() for use on an rvalue reference.
+ *
+ * @param symbols
+ * The DecimalFormatSymbols to use.
+ * @return The fluent chain.
+ * @see #symbols
+ * @stable ICU 62
+ */
+ Derived symbols(const DecimalFormatSymbols &symbols) &&;
+
+ /**
+ * Specifies that the given numbering system should be used when fetching symbols.
+ *
+ * <ul>
+ * <li>Latin numbering system: "12,345"
+ * <li>Myanmar numbering system: "၁၂,၃၄၅"
+ * <li>Math Sans Bold numbering system: "𝟭𝟮,𝟯𝟰𝟱"
+ * </ul>
+ *
+ * <p>
+ * Pass this method an instance of {@link NumberingSystem}. For example, to force the locale to always use the Latin
+ * alphabet numbering system (ASCII digits):
+ *
+ * <pre>
+ * NumberFormatter::with().adoptSymbols(NumberingSystem::createInstanceByName("latn", status))
+ * </pre>
+ *
+ * <p>
+ * <strong>Note:</strong> Calling this method will override any previously specified DecimalFormatSymbols
+ * or NumberingSystem.
+ *
+ * <p>
+ * The default is to choose the best numbering system for the locale.
+ *
+ * <p>
+ * This method takes ownership of a pointer in order to work nicely with the NumberingSystem factory methods.
+ *
+ * @param symbols
+ * The NumberingSystem to use.
+ * @return The fluent chain.
+ * @see NumberingSystem
+ * @stable ICU 60
+ */
+ Derived adoptSymbols(NumberingSystem *symbols) const &;
+
+ /**
+ * Overload of adoptSymbols() for use on an rvalue reference.
+ *
+ * @param symbols
+ * The NumberingSystem to use.
+ * @return The fluent chain.
+ * @see #adoptSymbols
+ * @stable ICU 62
+ */
+ Derived adoptSymbols(NumberingSystem *symbols) &&;
+
+ /**
+ * Sets the width of the unit (measure unit or currency). Most common values:
+ *
+ * <ul>
+ * <li>Short: "$12.00", "12 m"
+ * <li>ISO Code: "USD 12.00"
+ * <li>Full name: "12.00 US dollars", "12 meters"
+ * </ul>
+ *
+ * <p>
+ * Pass an element from the {@link UNumberUnitWidth} enum to this setter. For example:
+ *
+ * <pre>
+ * NumberFormatter::with().unitWidth(UNumberUnitWidth::UNUM_UNIT_WIDTH_FULL_NAME)
+ * </pre>
+ *
+ * <p>
+ * The default is the SHORT width.
+ *
+ * @param width
+ * The width to use when rendering numbers.
+ * @return The fluent chain
+ * @see UNumberUnitWidth
+ * @stable ICU 60
+ */
+ Derived unitWidth(UNumberUnitWidth width) const &;
+
+ /**
+ * Overload of unitWidth() for use on an rvalue reference.
+ *
+ * @param width
+ * The width to use when rendering numbers.
+ * @return The fluent chain.
+ * @see #unitWidth
+ * @stable ICU 62
+ */
+ Derived unitWidth(UNumberUnitWidth width) &&;
+
+ /**
+ * Sets the plus/minus sign display strategy. Most common values:
+ *
+ * <ul>
+ * <li>Auto: "123", "-123"
+ * <li>Always: "+123", "-123"
+ * <li>Accounting: "$123", "($123)"
+ * </ul>
+ *
+ * <p>
+ * Pass an element from the {@link UNumberSignDisplay} enum to this setter. For example:
+ *
+ * <pre>
+ * NumberFormatter::with().sign(UNumberSignDisplay::UNUM_SIGN_ALWAYS)
+ * </pre>
+ *
+ * <p>
+ * The default is AUTO sign display.
+ *
+ * @param style
+ * The sign display strategy to use when rendering numbers.
+ * @return The fluent chain
+ * @see UNumberSignDisplay
+ * @stable ICU 60
+ */
+ Derived sign(UNumberSignDisplay style) const &;
+
+ /**
+ * Overload of sign() for use on an rvalue reference.
+ *
+ * @param style
+ * The sign display strategy to use when rendering numbers.
+ * @return The fluent chain.
+ * @see #sign
+ * @stable ICU 62
+ */
+ Derived sign(UNumberSignDisplay style) &&;
+
+ /**
+ * Sets the decimal separator display strategy. This affects integer numbers with no fraction part. Most common
+ * values:
+ *
+ * <ul>
+ * <li>Auto: "1"
+ * <li>Always: "1."
+ * </ul>
+ *
+ * <p>
+ * Pass an element from the {@link UNumberDecimalSeparatorDisplay} enum to this setter. For example:
+ *
+ * <pre>
+ * NumberFormatter::with().decimal(UNumberDecimalSeparatorDisplay::UNUM_DECIMAL_SEPARATOR_ALWAYS)
+ * </pre>
+ *
+ * <p>
+ * The default is AUTO decimal separator display.
+ *
+ * @param style
+ * The decimal separator display strategy to use when rendering numbers.
+ * @return The fluent chain
+ * @see UNumberDecimalSeparatorDisplay
+ * @stable ICU 60
+ */
+ Derived decimal(UNumberDecimalSeparatorDisplay style) const &;
+
+ /**
+ * Overload of decimal() for use on an rvalue reference.
+ *
+ * @param style
+ * The decimal separator display strategy to use when rendering numbers.
+ * @return The fluent chain.
+ * @see #decimal
+ * @stable ICU 62
+ */
+ Derived decimal(UNumberDecimalSeparatorDisplay style) &&;
+
+ /**
+ * Sets a scale (multiplier) to be used to scale the number by an arbitrary amount before formatting.
+ * Most common values:
+ *
+ * <ul>
+ * <li>Multiply by 100: useful for percentages.
+ * <li>Multiply by an arbitrary value: useful for unit conversions.
+ * </ul>
+ *
+ * <p>
+ * Pass an element from a {@link Scale} factory method to this setter. For example:
+ *
+ * <pre>
+ * NumberFormatter::with().scale(Scale::powerOfTen(2))
+ * </pre>
+ *
+ * <p>
+ * The default is to not apply any multiplier.
+ *
+ * @param scale
+ * The scale to apply when rendering numbers.
+ * @return The fluent chain
+ * @stable ICU 62
+ */
+ Derived scale(const Scale &scale) const &;
+
+ /**
+ * Overload of scale() for use on an rvalue reference.
+ *
+ * @param scale
+ * The scale to apply when rendering numbers.
+ * @return The fluent chain.
+ * @see #scale
+ * @stable ICU 62
+ */
+ Derived scale(const Scale &scale) &&;
+
+#ifndef U_HIDE_INTERNAL_API
+
+ /**
+ * Set the padding strategy. May be added in the future; see #13338.
+ *
+ * @internal ICU 60: This API is ICU internal only.
+ */
+ Derived padding(const impl::Padder &padder) const &;
+
+ /** @internal */
+ Derived padding(const impl::Padder &padder) &&;
+
+ /**
+ * Internal fluent setter to support a custom regulation threshold. A threshold of 1 causes the data structures to
+ * be built right away. A threshold of 0 prevents the data structures from being built.
+ *
+ * @internal ICU 60: This API is ICU internal only.
+ */
+ Derived threshold(int32_t threshold) const &;
+
+ /** @internal */
+ Derived threshold(int32_t threshold) &&;
+
+ /**
+ * Internal fluent setter to overwrite the entire macros object.
+ *
+ * @internal ICU 60: This API is ICU internal only.
+ */
+ Derived macros(const impl::MacroProps& macros) const &;
+
+ /** @internal */
+ Derived macros(const impl::MacroProps& macros) &&;
+
+ /** @internal */
+ Derived macros(impl::MacroProps&& macros) const &;
+
+ /** @internal */
+ Derived macros(impl::MacroProps&& macros) &&;
+
+#endif /* U_HIDE_INTERNAL_API */
+
+ /**
+ * Creates a skeleton string representation of this number formatter. A skeleton string is a
+ * locale-agnostic serialized form of a number formatter.
+ *
+ * Not all options are capable of being represented in the skeleton string; for example, a
+ * DecimalFormatSymbols object. If any such option is encountered, the error code is set to
+ * U_UNSUPPORTED_ERROR.
+ *
+ * The returned skeleton is in normalized form, such that two number formatters with equivalent
+ * behavior should produce the same skeleton.
+ *
+ * @return A number skeleton string with behavior corresponding to this number formatter.
+ * @stable ICU 62
+ */
+ UnicodeString toSkeleton(UErrorCode& status) const;
+
+ /**
+ * Returns the current (Un)LocalizedNumberFormatter as a LocalPointer
+ * wrapping a heap-allocated copy of the current object.
+ *
+ * This is equivalent to new-ing the move constructor with a value object
+ * as the argument.
+ *
+ * @return A wrapped (Un)LocalizedNumberFormatter pointer, or a wrapped
+ * nullptr on failure.
+ * @stable ICU 64
+ */
+ LocalPointer<Derived> clone() const &;
+
+ /**
+ * Overload of clone for use on an rvalue reference.
+ *
+ * @return A wrapped (Un)LocalizedNumberFormatter pointer, or a wrapped
+ * nullptr on failure.
+ * @stable ICU 64
+ */
+ LocalPointer<Derived> clone() &&;
+
+ /**
+ * Sets the UErrorCode if an error occurred in the fluent chain.
+ * Preserves older error codes in the outErrorCode.
+ * @return TRUE if U_FAILURE(outErrorCode)
+ * @stable ICU 60
+ */
+ UBool copyErrorTo(UErrorCode &outErrorCode) const {
+ if (U_FAILURE(outErrorCode)) {
+ // Do not overwrite the older error code
+ return TRUE;
+ }
+ fMacros.copyErrorTo(outErrorCode);
+ return U_FAILURE(outErrorCode);
+ }
+
+ // NOTE: Uses default copy and move constructors.
+
+ private:
+ impl::MacroProps fMacros;
+
+ // Don't construct me directly! Use (Un)LocalizedNumberFormatter.
+ NumberFormatterSettings() = default;
+
+ friend class LocalizedNumberFormatter;
+ friend class UnlocalizedNumberFormatter;
+
+ // Give NumberRangeFormatter access to the MacroProps
+ friend void impl::touchRangeLocales(impl::RangeMacroProps& macros);
+ friend class impl::NumberRangeFormatterImpl;
+};
+
+/**
+ * A NumberFormatter that does not yet have a locale. In order to format numbers, a locale must be specified.
+ *
+ * Instances of this class are immutable and thread-safe.
+ *
+ * @see NumberFormatter
+ * @stable ICU 60
+ */
+class U_I18N_API UnlocalizedNumberFormatter
+ : public NumberFormatterSettings<UnlocalizedNumberFormatter>, public UMemory {
+
+ public:
+ /**
+ * Associate the given locale with the number formatter. The locale is used for picking the appropriate symbols,
+ * formats, and other data for number display.
+ *
+ * @param locale
+ * The locale to use when loading data for number formatting.
+ * @return The fluent chain.
+ * @stable ICU 60
+ */
+ LocalizedNumberFormatter locale(const icu::Locale &locale) const &;
+
+ /**
+ * Overload of locale() for use on an rvalue reference.
+ *
+ * @param locale
+ * The locale to use when loading data for number formatting.
+ * @return The fluent chain.
+ * @see #locale
+ * @stable ICU 62
+ */
+ LocalizedNumberFormatter locale(const icu::Locale &locale) &&;
+
+ /**
+ * Default constructor: puts the formatter into a valid but undefined state.
+ *
+ * @stable ICU 62
+ */
+ UnlocalizedNumberFormatter() = default;
+
+ /**
+ * Returns a copy of this UnlocalizedNumberFormatter.
+ * @stable ICU 60
+ */
+ UnlocalizedNumberFormatter(const UnlocalizedNumberFormatter &other);
+
+ /**
+ * Move constructor:
+ * The source UnlocalizedNumberFormatter will be left in a valid but undefined state.
+ * @stable ICU 62
+ */
+ UnlocalizedNumberFormatter(UnlocalizedNumberFormatter&& src) U_NOEXCEPT;
+
+ /**
+ * Copy assignment operator.
+ * @stable ICU 62
+ */
+ UnlocalizedNumberFormatter& operator=(const UnlocalizedNumberFormatter& other);
+
+ /**
+ * Move assignment operator:
+ * The source UnlocalizedNumberFormatter will be left in a valid but undefined state.
+ * @stable ICU 62
+ */
+ UnlocalizedNumberFormatter& operator=(UnlocalizedNumberFormatter&& src) U_NOEXCEPT;
+
+ private:
+ explicit UnlocalizedNumberFormatter(const NumberFormatterSettings<UnlocalizedNumberFormatter>& other);
+
+ explicit UnlocalizedNumberFormatter(
+ NumberFormatterSettings<UnlocalizedNumberFormatter>&& src) U_NOEXCEPT;
+
+ // To give the fluent setters access to this class's constructor:
+ friend class NumberFormatterSettings<UnlocalizedNumberFormatter>;
+
+ // To give NumberFormatter::with() access to this class's constructor:
+ friend class NumberFormatter;
+};
+
+/**
+ * A NumberFormatter that has a locale associated with it; this means .format() methods are available.
+ *
+ * Instances of this class are immutable and thread-safe.
+ *
+ * @see NumberFormatter
+ * @stable ICU 60
+ */
+class U_I18N_API LocalizedNumberFormatter
+ : public NumberFormatterSettings<LocalizedNumberFormatter>, public UMemory {
+ public:
+ /**
+ * Format the given integer number to a string using the settings specified in the NumberFormatter fluent
+ * setting chain.
+ *
+ * @param value
+ * The number to format.
+ * @param status
+ * Set to an ErrorCode if one occurred in the setter chain or during formatting.
+ * @return A FormattedNumber object; call .toString() to get the string.
+ * @stable ICU 60
+ */
+ FormattedNumber formatInt(int64_t value, UErrorCode &status) const;
+
+ /**
+ * Format the given float or double to a string using the settings specified in the NumberFormatter fluent setting
+ * chain.
+ *
+ * @param value
+ * The number to format.
+ * @param status
+ * Set to an ErrorCode if one occurred in the setter chain or during formatting.
+ * @return A FormattedNumber object; call .toString() to get the string.
+ * @stable ICU 60
+ */
+ FormattedNumber formatDouble(double value, UErrorCode &status) const;
+
+ /**
+ * Format the given decimal number to a string using the settings
+ * specified in the NumberFormatter fluent setting chain.
+ * The syntax of the unformatted number is a "numeric string"
+ * as defined in the Decimal Arithmetic Specification, available at
+ * http://speleotrove.com/decimal
+ *
+ * @param value
+ * The number to format.
+ * @param status
+ * Set to an ErrorCode if one occurred in the setter chain or during formatting.
+ * @return A FormattedNumber object; call .toString() to get the string.
+ * @stable ICU 60
+ */
+ FormattedNumber formatDecimal(StringPiece value, UErrorCode& status) const;
+
+#ifndef U_HIDE_INTERNAL_API
+
+ /** Internal method.
+ * @internal
+ */
+ FormattedNumber formatDecimalQuantity(const impl::DecimalQuantity& dq, UErrorCode& status) const;
+
+ /** Internal method for DecimalFormat compatibility.
+ * @internal
+ */
+ void getAffixImpl(bool isPrefix, bool isNegative, UnicodeString& result, UErrorCode& status) const;
+
+ /**
+ * Internal method for testing.
+ * @internal
+ */
+ const impl::NumberFormatterImpl* getCompiled() const;
+
+ /**
+ * Internal method for testing.
+ * @internal
+ */
+ int32_t getCallCount() const;
+
+#endif /* U_HIDE_INTERNAL_API */
+
+ /**
+ * Creates a representation of this LocalizedNumberFormat as an icu::Format, enabling the use
+ * of this number formatter with APIs that need an object of that type, such as MessageFormat.
+ *
+ * This API is not intended to be used other than for enabling API compatibility. The formatDouble,
+ * formatInt, and formatDecimal methods should normally be used when formatting numbers, not the Format
+ * object returned by this method.
+ *
+ * The caller owns the returned object and must delete it when finished.
+ *
+ * @return A Format wrapping this LocalizedNumberFormatter.
+ * @stable ICU 62
+ */
+ Format* toFormat(UErrorCode& status) const;
+
+ /**
+ * Default constructor: puts the formatter into a valid but undefined state.
+ *
+ * @stable ICU 62
+ */
+ LocalizedNumberFormatter() = default;
+
+ /**
+ * Returns a copy of this LocalizedNumberFormatter.
+ * @stable ICU 60
+ */
+ LocalizedNumberFormatter(const LocalizedNumberFormatter &other);
+
+ /**
+ * Move constructor:
+ * The source LocalizedNumberFormatter will be left in a valid but undefined state.
+ * @stable ICU 62
+ */
+ LocalizedNumberFormatter(LocalizedNumberFormatter&& src) U_NOEXCEPT;
+
+ /**
+ * Copy assignment operator.
+ * @stable ICU 62
+ */
+ LocalizedNumberFormatter& operator=(const LocalizedNumberFormatter& other);
+
+ /**
+ * Move assignment operator:
+ * The source LocalizedNumberFormatter will be left in a valid but undefined state.
+ * @stable ICU 62
+ */
+ LocalizedNumberFormatter& operator=(LocalizedNumberFormatter&& src) U_NOEXCEPT;
+
+#ifndef U_HIDE_INTERNAL_API
+
+ /**
+ * This is the core entrypoint to the number formatting pipeline. It performs self-regulation: a static code path
+ * for the first few calls, and compiling a more efficient data structure if called repeatedly.
+ *
+ * <p>
+ * This function is very hot, being called in every call to the number formatting pipeline.
+ *
+ * @param results
+ * The results object. This method will mutate it to save the results.
+ * @param status
+ * @internal
+ */
+ void formatImpl(impl::UFormattedNumberData *results, UErrorCode &status) const;
+
+#endif /* U_HIDE_INTERNAL_API */
+
+ /**
+ * Destruct this LocalizedNumberFormatter, cleaning up any memory it might own.
+ * @stable ICU 60
+ */
+ ~LocalizedNumberFormatter();
+
+ private:
+ // Note: fCompiled can't be a LocalPointer because impl::NumberFormatterImpl is defined in an internal
+ // header, and LocalPointer needs the full class definition in order to delete the instance.
+ const impl::NumberFormatterImpl* fCompiled {nullptr};
+ char fUnsafeCallCount[8] {}; // internally cast to u_atomic_int32_t
+
+ explicit LocalizedNumberFormatter(const NumberFormatterSettings<LocalizedNumberFormatter>& other);
+
+ explicit LocalizedNumberFormatter(NumberFormatterSettings<LocalizedNumberFormatter>&& src) U_NOEXCEPT;
+
+ LocalizedNumberFormatter(const impl::MacroProps &macros, const Locale &locale);
+
+ LocalizedNumberFormatter(impl::MacroProps &&macros, const Locale &locale);
+
+ void clear();
+
+ void lnfMoveHelper(LocalizedNumberFormatter&& src);
+
+ /**
+ * @return true if the compiled formatter is available.
+ */
+ bool computeCompiled(UErrorCode& status) const;
+
+ // To give the fluent setters access to this class's constructor:
+ friend class NumberFormatterSettings<UnlocalizedNumberFormatter>;
+ friend class NumberFormatterSettings<LocalizedNumberFormatter>;
+
+ // To give UnlocalizedNumberFormatter::locale() access to this class's constructor:
+ friend class UnlocalizedNumberFormatter;
+};
+
+#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
+// Warning 4661.
+#pragma warning(pop)
+#endif
+
+/**
+ * The result of a number formatting operation. This class allows the result to be exported in several data types,
+ * including a UnicodeString and a FieldPositionIterator.
+ *
+ * Instances of this class are immutable and thread-safe.
+ *
+ * @stable ICU 60
+ */
+class U_I18N_API FormattedNumber : public UMemory, public FormattedValue {
+ public:
+
+ /**
+ * Default constructor; makes an empty FormattedNumber.
+ * @stable ICU 64
+ */
+ FormattedNumber()
+ : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
+
+ /**
+ * Move constructor: Leaves the source FormattedNumber in an undefined state.
+ * @stable ICU 62
+ */
+ FormattedNumber(FormattedNumber&& src) U_NOEXCEPT;
+
+ /**
+ * Destruct an instance of FormattedNumber.
+ * @stable ICU 60
+ */
+ virtual ~FormattedNumber() U_OVERRIDE;
+
+ /** Copying not supported; use move constructor instead. */
+ FormattedNumber(const FormattedNumber&) = delete;
+
+ /** Copying not supported; use move assignment instead. */
+ FormattedNumber& operator=(const FormattedNumber&) = delete;
+
+ /**
+ * Move assignment: Leaves the source FormattedNumber in an undefined state.
+ * @stable ICU 62
+ */
+ FormattedNumber& operator=(FormattedNumber&& src) U_NOEXCEPT;
+
+ // Copybrief: this method is older than the parent method
+ /**
+ * @copybrief FormattedValue::toString()
+ *
+ * For more information, see FormattedValue::toString()
+ *
+ * @stable ICU 62
+ */
+ UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
+
+ // Copydoc: this method is new in ICU 64
+ /** @copydoc FormattedValue::toTempString() */
+ UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
+
+ // Copybrief: this method is older than the parent method
+ /**
+ * @copybrief FormattedValue::appendTo()
+ *
+ * For more information, see FormattedValue::appendTo()
+ *
+ * @stable ICU 62
+ */
+ Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
+
+ // Copydoc: this method is new in ICU 64
+ /** @copydoc FormattedValue::nextPosition() */
+ UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Export the formatted number as a "numeric string" conforming to the
+ * syntax defined in the Decimal Arithmetic Specification, available at
+ * http://speleotrove.com/decimal
+ *
+ * This endpoint is useful for obtaining the exact number being printed
+ * after scaling and rounding have been applied by the number formatter.
+ *
+ * Example call site:
+ *
+ * auto decimalNumber = fn.toDecimalNumber<std::string>(status);
+ *
+ * @tparam StringClass A string class compatible with StringByteSink;
+ * for example, std::string.
+ * @param status Set if an error occurs.
+ * @return A StringClass containing the numeric string.
+ * @draft ICU 65
+ */
+ template<typename StringClass>
+ inline StringClass toDecimalNumber(UErrorCode& status) const;
+#endif // U_HIDE_DRAFT_API
+
+#ifndef U_HIDE_INTERNAL_API
+
+ /**
+ * Gets the raw DecimalQuantity for plural rule selection.
+ * @internal
+ */
+ void getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const;
+
+ /**
+ * Populates the mutable builder type FieldPositionIteratorHandler.
+ * @internal
+ */
+ void getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih, UErrorCode& status) const;
+
+#endif /* U_HIDE_INTERNAL_API */
+
+ private:
+ // Can't use LocalPointer because UFormattedNumberData is forward-declared
+ const impl::UFormattedNumberData *fData;
+
+ // Error code for the terminal methods
+ UErrorCode fErrorCode;
+
+ /**
+ * Internal constructor from data type. Adopts the data pointer.
+ * @internal
+ */
+ explicit FormattedNumber(impl::UFormattedNumberData *results)
+ : fData(results), fErrorCode(U_ZERO_ERROR) {}
+
+ explicit FormattedNumber(UErrorCode errorCode)
+ : fData(nullptr), fErrorCode(errorCode) {}
+
+ // TODO(ICU-20775): Propose this as API.
+ void toDecimalNumber(ByteSink& sink, UErrorCode& status) const;
+
+ // To give LocalizedNumberFormatter format methods access to this class's constructor:
+ friend class LocalizedNumberFormatter;
+
+ // To give C API access to internals
+ friend struct impl::UFormattedNumberImpl;
+};
+
+#ifndef U_HIDE_DRAFT_API
+// Note: This is draft ICU 65
+template<typename StringClass>
+StringClass FormattedNumber::toDecimalNumber(UErrorCode& status) const {
+ StringClass result;
+ StringByteSink<StringClass> sink(&result);
+ toDecimalNumber(sink, status);
+ return result;
+}
+#endif // U_HIDE_DRAFT_API
+
+/**
+ * See the main description in numberformatter.h for documentation and examples.
+ *
+ * @stable ICU 60
+ */
+class U_I18N_API NumberFormatter final {
+ public:
+ /**
+ * Call this method at the beginning of a NumberFormatter fluent chain in which the locale is not currently known at
+ * the call site.
+ *
+ * @return An {@link UnlocalizedNumberFormatter}, to be used for chaining.
+ * @stable ICU 60
+ */
+ static UnlocalizedNumberFormatter with();
+
+ /**
+ * Call this method at the beginning of a NumberFormatter fluent chain in which the locale is known at the call
+ * site.
+ *
+ * @param locale
+ * The locale from which to load formats and symbols for number formatting.
+ * @return A {@link LocalizedNumberFormatter}, to be used for chaining.
+ * @stable ICU 60
+ */
+ static LocalizedNumberFormatter withLocale(const Locale &locale);
+
+ /**
+ * Call this method at the beginning of a NumberFormatter fluent chain to create an instance based
+ * on a given number skeleton string.
+ *
+ * It is possible for an error to occur while parsing. See the overload of this method if you are
+ * interested in the location of a possible parse error.
+ *
+ * @param skeleton
+ * The skeleton string off of which to base this NumberFormatter.
+ * @param status
+ * Set to U_NUMBER_SKELETON_SYNTAX_ERROR if the skeleton was invalid.
+ * @return An UnlocalizedNumberFormatter, to be used for chaining.
+ * @stable ICU 62
+ */
+ static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton, UErrorCode& status);
+
+ /**
+ * Call this method at the beginning of a NumberFormatter fluent chain to create an instance based
+ * on a given number skeleton string.
+ *
+ * If an error occurs while parsing the skeleton string, the offset into the skeleton string at
+ * which the error occurred will be saved into the UParseError, if provided.
+ *
+ * @param skeleton
+ * The skeleton string off of which to base this NumberFormatter.
+ * @param perror
+ * A parse error struct populated if an error occurs when parsing.
+ * If no error occurs, perror.offset will be set to -1.
+ * @param status
+ * Set to U_NUMBER_SKELETON_SYNTAX_ERROR if the skeleton was invalid.
+ * @return An UnlocalizedNumberFormatter, to be used for chaining.
+ * @stable ICU 64
+ */
+ static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton,
+ UParseError& perror, UErrorCode& status);
+
+ /**
+ * Use factory methods instead of the constructor to create a NumberFormatter.
+ */
+ NumberFormatter() = delete;
+};
+
+} // namespace number
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
+#endif // __NUMBERFORMATTER_H__
+
diff --git a/contrib/libs/icu/include/unicode/numberrangeformatter.h b/contrib/libs/icu/include/unicode/numberrangeformatter.h
index e72ad60ebd..4d436a7694 100644
--- a/contrib/libs/icu/include/unicode/numberrangeformatter.h
+++ b/contrib/libs/icu/include/unicode/numberrangeformatter.h
@@ -1,866 +1,866 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#ifndef __NUMBERRANGEFORMATTER_H__
-#define __NUMBERRANGEFORMATTER_H__
-
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
-#if !UCONFIG_NO_FORMATTING
-
-#include <atomic>
-#include "unicode/appendable.h"
-#include "unicode/fieldpos.h"
-#include "unicode/formattedvalue.h"
-#include "unicode/fpositer.h"
-#include "unicode/numberformatter.h"
-
-/**
- * \file
- * \brief C++ API: Library for localized formatting of number, currency, and unit ranges.
- *
- * The main entrypoint to the formatting of ranges of numbers, including currencies and other units of measurement.
- * <p>
- * Usage example:
- * <p>
- * <pre>
- * NumberRangeFormatter::with()
- * .identityFallback(UNUM_IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE)
- * .numberFormatterFirst(NumberFormatter::with().adoptUnit(MeasureUnit::createMeter()))
- * .numberFormatterSecond(NumberFormatter::with().adoptUnit(MeasureUnit::createKilometer()))
- * .locale("en-GB")
- * .formatRange(750, 1.2, status)
- * .toString(status);
- * // => "750 m - 1.2 km"
- * </pre>
- * <p>
- * Like NumberFormatter, NumberRangeFormatter instances (i.e., LocalizedNumberRangeFormatter
- * and UnlocalizedNumberRangeFormatter) are immutable and thread-safe. This API is based on the
- * <em>fluent</em> design pattern popularized by libraries such as Google's Guava.
- *
- * @author Shane Carr
- */
-
-
-/**
- * Defines how to merge fields that are identical across the range sign.
- *
- * @stable ICU 63
- */
-typedef enum UNumberRangeCollapse {
- /**
- * Use locale data and heuristics to determine how much of the string to collapse. Could end up collapsing none,
- * some, or all repeated pieces in a locale-sensitive way.
- *
- * The heuristics used for this option are subject to change over time.
- *
- * @stable ICU 63
- */
- UNUM_RANGE_COLLAPSE_AUTO,
-
- /**
- * Do not collapse any part of the number. Example: "3.2 thousand kilograms – 5.3 thousand kilograms"
- *
- * @stable ICU 63
- */
- UNUM_RANGE_COLLAPSE_NONE,
-
- /**
- * Collapse the unit part of the number, but not the notation, if present. Example: "3.2 thousand – 5.3 thousand
- * kilograms"
- *
- * @stable ICU 63
- */
- UNUM_RANGE_COLLAPSE_UNIT,
-
- /**
- * Collapse any field that is equal across the range sign. May introduce ambiguity on the magnitude of the
- * number. Example: "3.2 – 5.3 thousand kilograms"
- *
- * @stable ICU 63
- */
- UNUM_RANGE_COLLAPSE_ALL
-} UNumberRangeCollapse;
-
-/**
- * Defines the behavior when the two numbers in the range are identical after rounding. To programmatically detect
- * when the identity fallback is used, compare the lower and upper BigDecimals via FormattedNumber.
- *
- * @stable ICU 63
- * @see NumberRangeFormatter
- */
-typedef enum UNumberRangeIdentityFallback {
- /**
- * Show the number as a single value rather than a range. Example: "$5"
- *
- * @stable ICU 63
- */
- UNUM_IDENTITY_FALLBACK_SINGLE_VALUE,
-
- /**
- * Show the number using a locale-sensitive approximation pattern. If the numbers were the same before rounding,
- * show the single value. Example: "~$5" or "$5"
- *
- * @stable ICU 63
- */
- UNUM_IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE,
-
- /**
- * Show the number using a locale-sensitive approximation pattern. Use the range pattern always, even if the
- * inputs are the same. Example: "~$5"
- *
- * @stable ICU 63
- */
- UNUM_IDENTITY_FALLBACK_APPROXIMATELY,
-
- /**
- * Show the number as the range of two equal values. Use the range pattern always, even if the inputs are the
- * same. Example (with RangeCollapse.NONE): "$5 – $5"
- *
- * @stable ICU 63
- */
- UNUM_IDENTITY_FALLBACK_RANGE
-} UNumberRangeIdentityFallback;
-
-/**
- * Used in the result class FormattedNumberRange to indicate to the user whether the numbers formatted in the range
- * were equal or not, and whether or not the identity fallback was applied.
- *
- * @stable ICU 63
- * @see NumberRangeFormatter
- */
-typedef enum UNumberRangeIdentityResult {
- /**
- * Used to indicate that the two numbers in the range were equal, even before any rounding rules were applied.
- *
- * @stable ICU 63
- * @see NumberRangeFormatter
- */
- UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING,
-
- /**
- * Used to indicate that the two numbers in the range were equal, but only after rounding rules were applied.
- *
- * @stable ICU 63
- * @see NumberRangeFormatter
- */
- UNUM_IDENTITY_RESULT_EQUAL_AFTER_ROUNDING,
-
- /**
- * Used to indicate that the two numbers in the range were not equal, even after rounding rules were applied.
- *
- * @stable ICU 63
- * @see NumberRangeFormatter
- */
- UNUM_IDENTITY_RESULT_NOT_EQUAL,
-
-#ifndef U_HIDE_INTERNAL_API
- /**
- * The number of entries in this enum.
- * @internal
- */
- UNUM_IDENTITY_RESULT_COUNT
-#endif
-
-} UNumberRangeIdentityResult;
-
-U_NAMESPACE_BEGIN
-
-namespace number { // icu::number
-
-// Forward declarations:
-class UnlocalizedNumberRangeFormatter;
-class LocalizedNumberRangeFormatter;
-class FormattedNumberRange;
-
-namespace impl {
-
-// Forward declarations:
-struct RangeMacroProps;
-class DecimalQuantity;
-class UFormattedNumberRangeData;
-class NumberRangeFormatterImpl;
-
-} // namespace impl
-
-/**
- * \cond
- * Export an explicit template instantiation. See datefmt.h
- * (When building DLLs for Windows this is required.)
- */
-#if U_PLATFORM == U_PF_WINDOWS && !defined(U_IN_DOXYGEN)
-} // namespace icu::number
-U_NAMESPACE_END
-
-template struct U_I18N_API std::atomic< U_NAMESPACE_QUALIFIER number::impl::NumberRangeFormatterImpl*>;
-
-U_NAMESPACE_BEGIN
-namespace number { // icu::number
-#endif
-/** \endcond */
-
-// Other helper classes would go here, but there are none.
-
-namespace impl { // icu::number::impl
-
-// Do not enclose entire MacroProps with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
-/** @internal */
-struct U_I18N_API RangeMacroProps : public UMemory {
- /** @internal */
- UnlocalizedNumberFormatter formatter1; // = NumberFormatter::with();
-
- /** @internal */
- UnlocalizedNumberFormatter formatter2; // = NumberFormatter::with();
-
- /** @internal */
- bool singleFormatter = true;
-
- /** @internal */
- UNumberRangeCollapse collapse = UNUM_RANGE_COLLAPSE_AUTO;
-
- /** @internal */
- UNumberRangeIdentityFallback identityFallback = UNUM_IDENTITY_FALLBACK_APPROXIMATELY;
-
- /** @internal */
- Locale locale;
-
- // NOTE: Uses default copy and move constructors.
-
- /**
- * Check all members for errors.
- * @internal
- */
- bool copyErrorTo(UErrorCode &status) const {
- return formatter1.copyErrorTo(status) || formatter2.copyErrorTo(status);
- }
-};
-
-} // namespace impl
-
-/**
- * An abstract base class for specifying settings related to number formatting. This class is implemented by
- * {@link UnlocalizedNumberRangeFormatter} and {@link LocalizedNumberRangeFormatter}. This class is not intended for
- * public subclassing.
- */
-template<typename Derived>
-class U_I18N_API NumberRangeFormatterSettings {
- public:
- /**
- * Sets the NumberFormatter instance to use for the numbers in the range. The same formatter is applied to both
- * sides of the range.
- * <p>
- * The NumberFormatter instances must not have a locale applied yet; the locale specified on the
- * NumberRangeFormatter will be used.
- *
- * @param formatter
- * The formatter to use for both numbers in the range.
- * @return The fluent chain.
- * @stable ICU 63
- */
- Derived numberFormatterBoth(const UnlocalizedNumberFormatter &formatter) const &;
-
- /**
- * Overload of numberFormatterBoth() for use on an rvalue reference.
- *
- * @param formatter
- * The formatter to use for both numbers in the range.
- * @return The fluent chain.
- * @see #numberFormatterBoth
- * @stable ICU 63
- */
- Derived numberFormatterBoth(const UnlocalizedNumberFormatter &formatter) &&;
-
- /**
- * Overload of numberFormatterBoth() for use on an rvalue reference.
- *
- * @param formatter
- * The formatter to use for both numbers in the range.
- * @return The fluent chain.
- * @see #numberFormatterBoth
- * @stable ICU 63
- */
- Derived numberFormatterBoth(UnlocalizedNumberFormatter &&formatter) const &;
-
- /**
- * Overload of numberFormatterBoth() for use on an rvalue reference.
- *
- * @param formatter
- * The formatter to use for both numbers in the range.
- * @return The fluent chain.
- * @see #numberFormatterBoth
- * @stable ICU 63
- */
- Derived numberFormatterBoth(UnlocalizedNumberFormatter &&formatter) &&;
-
- /**
- * Sets the NumberFormatter instance to use for the first number in the range.
- * <p>
- * The NumberFormatter instances must not have a locale applied yet; the locale specified on the
- * NumberRangeFormatter will be used.
- *
- * @param formatterFirst
- * The formatter to use for the first number in the range.
- * @return The fluent chain.
- * @stable ICU 63
- */
- Derived numberFormatterFirst(const UnlocalizedNumberFormatter &formatterFirst) const &;
-
- /**
- * Overload of numberFormatterFirst() for use on an rvalue reference.
- *
- * @param formatterFirst
- * The formatter to use for the first number in the range.
- * @return The fluent chain.
- * @see #numberFormatterFirst
- * @stable ICU 63
- */
- Derived numberFormatterFirst(const UnlocalizedNumberFormatter &formatterFirst) &&;
-
- /**
- * Overload of numberFormatterFirst() for use on an rvalue reference.
- *
- * @param formatterFirst
- * The formatter to use for the first number in the range.
- * @return The fluent chain.
- * @see #numberFormatterFirst
- * @stable ICU 63
- */
- Derived numberFormatterFirst(UnlocalizedNumberFormatter &&formatterFirst) const &;
-
- /**
- * Overload of numberFormatterFirst() for use on an rvalue reference.
- *
- * @param formatterFirst
- * The formatter to use for the first number in the range.
- * @return The fluent chain.
- * @see #numberFormatterFirst
- * @stable ICU 63
- */
- Derived numberFormatterFirst(UnlocalizedNumberFormatter &&formatterFirst) &&;
-
- /**
- * Sets the NumberFormatter instance to use for the second number in the range.
- * <p>
- * The NumberFormatter instances must not have a locale applied yet; the locale specified on the
- * NumberRangeFormatter will be used.
- *
- * @param formatterSecond
- * The formatter to use for the second number in the range.
- * @return The fluent chain.
- * @stable ICU 63
- */
- Derived numberFormatterSecond(const UnlocalizedNumberFormatter &formatterSecond) const &;
-
- /**
- * Overload of numberFormatterSecond() for use on an rvalue reference.
- *
- * @param formatterSecond
- * The formatter to use for the second number in the range.
- * @return The fluent chain.
- * @see #numberFormatterSecond
- * @stable ICU 63
- */
- Derived numberFormatterSecond(const UnlocalizedNumberFormatter &formatterSecond) &&;
-
- /**
- * Overload of numberFormatterSecond() for use on an rvalue reference.
- *
- * @param formatterSecond
- * The formatter to use for the second number in the range.
- * @return The fluent chain.
- * @see #numberFormatterSecond
- * @stable ICU 63
- */
- Derived numberFormatterSecond(UnlocalizedNumberFormatter &&formatterSecond) const &;
-
- /**
- * Overload of numberFormatterSecond() for use on an rvalue reference.
- *
- * @param formatterSecond
- * The formatter to use for the second number in the range.
- * @return The fluent chain.
- * @see #numberFormatterSecond
- * @stable ICU 63
- */
- Derived numberFormatterSecond(UnlocalizedNumberFormatter &&formatterSecond) &&;
-
- /**
- * Sets the aggressiveness of "collapsing" fields across the range separator. Possible values:
- * <p>
- * <ul>
- * <li>ALL: "3-5K miles"</li>
- * <li>UNIT: "3K - 5K miles"</li>
- * <li>NONE: "3K miles - 5K miles"</li>
- * <li>AUTO: usually UNIT or NONE, depending on the locale and formatter settings</li>
- * </ul>
- * <p>
- * The default value is AUTO.
- *
- * @param collapse
- * The collapsing strategy to use for this range.
- * @return The fluent chain.
- * @stable ICU 63
- */
- Derived collapse(UNumberRangeCollapse collapse) const &;
-
- /**
- * Overload of collapse() for use on an rvalue reference.
- *
- * @param collapse
- * The collapsing strategy to use for this range.
- * @return The fluent chain.
- * @see #collapse
- * @stable ICU 63
- */
- Derived collapse(UNumberRangeCollapse collapse) &&;
-
- /**
- * Sets the behavior when the two sides of the range are the same. This could happen if the same two numbers are
- * passed to the formatRange function, or if different numbers are passed to the function but they become the same
- * after rounding rules are applied. Possible values:
- * <p>
- * <ul>
- * <li>SINGLE_VALUE: "5 miles"</li>
- * <li>APPROXIMATELY_OR_SINGLE_VALUE: "~5 miles" or "5 miles", depending on whether the number was the same before
- * rounding was applied</li>
- * <li>APPROXIMATELY: "~5 miles"</li>
- * <li>RANGE: "5-5 miles" (with collapse=UNIT)</li>
- * </ul>
- * <p>
- * The default value is APPROXIMATELY.
- *
- * @param identityFallback
- * The strategy to use when formatting two numbers that end up being the same.
- * @return The fluent chain.
- * @stable ICU 63
- */
- Derived identityFallback(UNumberRangeIdentityFallback identityFallback) const &;
-
- /**
- * Overload of identityFallback() for use on an rvalue reference.
- *
- * @param identityFallback
- * The strategy to use when formatting two numbers that end up being the same.
- * @return The fluent chain.
- * @see #identityFallback
- * @stable ICU 63
- */
- Derived identityFallback(UNumberRangeIdentityFallback identityFallback) &&;
-
- /**
- * Returns the current (Un)LocalizedNumberRangeFormatter as a LocalPointer
- * wrapping a heap-allocated copy of the current object.
- *
- * This is equivalent to new-ing the move constructor with a value object
- * as the argument.
- *
- * @return A wrapped (Un)LocalizedNumberRangeFormatter pointer, or a wrapped
- * nullptr on failure.
- * @stable ICU 64
- */
- LocalPointer<Derived> clone() const &;
-
- /**
- * Overload of clone for use on an rvalue reference.
- *
- * @return A wrapped (Un)LocalizedNumberRangeFormatter pointer, or a wrapped
- * nullptr on failure.
- * @stable ICU 64
- */
- LocalPointer<Derived> clone() &&;
-
- /**
- * Sets the UErrorCode if an error occurred in the fluent chain.
- * Preserves older error codes in the outErrorCode.
- * @return TRUE if U_FAILURE(outErrorCode)
- * @stable ICU 63
- */
- UBool copyErrorTo(UErrorCode &outErrorCode) const {
- if (U_FAILURE(outErrorCode)) {
- // Do not overwrite the older error code
- return TRUE;
- }
- fMacros.copyErrorTo(outErrorCode);
- return U_FAILURE(outErrorCode);
- }
-
- // NOTE: Uses default copy and move constructors.
-
- private:
- impl::RangeMacroProps fMacros;
-
- // Don't construct me directly! Use (Un)LocalizedNumberFormatter.
- NumberRangeFormatterSettings() = default;
-
- friend class LocalizedNumberRangeFormatter;
- friend class UnlocalizedNumberRangeFormatter;
-};
-
-/**
- * A NumberRangeFormatter that does not yet have a locale. In order to format, a locale must be specified.
- *
- * Instances of this class are immutable and thread-safe.
- *
- * @see NumberRangeFormatter
- * @stable ICU 63
- */
-class U_I18N_API UnlocalizedNumberRangeFormatter
- : public NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>, public UMemory {
-
- public:
- /**
- * Associate the given locale with the number range formatter. The locale is used for picking the
- * appropriate symbols, formats, and other data for number display.
- *
- * @param locale
- * The locale to use when loading data for number formatting.
- * @return The fluent chain.
- * @stable ICU 63
- */
- LocalizedNumberRangeFormatter locale(const icu::Locale &locale) const &;
-
- /**
- * Overload of locale() for use on an rvalue reference.
- *
- * @param locale
- * The locale to use when loading data for number formatting.
- * @return The fluent chain.
- * @see #locale
- * @stable ICU 63
- */
- LocalizedNumberRangeFormatter locale(const icu::Locale &locale) &&;
-
- /**
- * Default constructor: puts the formatter into a valid but undefined state.
- *
- * @stable ICU 63
- */
- UnlocalizedNumberRangeFormatter() = default;
-
- /**
- * Returns a copy of this UnlocalizedNumberRangeFormatter.
- * @stable ICU 63
- */
- UnlocalizedNumberRangeFormatter(const UnlocalizedNumberRangeFormatter &other);
-
- /**
- * Move constructor:
- * The source UnlocalizedNumberRangeFormatter will be left in a valid but undefined state.
- * @stable ICU 63
- */
- UnlocalizedNumberRangeFormatter(UnlocalizedNumberRangeFormatter&& src) U_NOEXCEPT;
-
- /**
- * Copy assignment operator.
- * @stable ICU 63
- */
- UnlocalizedNumberRangeFormatter& operator=(const UnlocalizedNumberRangeFormatter& other);
-
- /**
- * Move assignment operator:
- * The source UnlocalizedNumberRangeFormatter will be left in a valid but undefined state.
- * @stable ICU 63
- */
- UnlocalizedNumberRangeFormatter& operator=(UnlocalizedNumberRangeFormatter&& src) U_NOEXCEPT;
-
- private:
- explicit UnlocalizedNumberRangeFormatter(
- const NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>& other);
-
- explicit UnlocalizedNumberRangeFormatter(
- NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>&& src) U_NOEXCEPT;
-
- // To give the fluent setters access to this class's constructor:
- friend class NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>;
-
- // To give NumberRangeFormatter::with() access to this class's constructor:
- friend class NumberRangeFormatter;
-};
-
-/**
- * A NumberRangeFormatter that has a locale associated with it; this means .formatRange() methods are available.
- *
- * Instances of this class are immutable and thread-safe.
- *
- * @see NumberFormatter
- * @stable ICU 63
- */
-class U_I18N_API LocalizedNumberRangeFormatter
- : public NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>, public UMemory {
- public:
- /**
- * Format the given Formattables to a string using the settings specified in the NumberRangeFormatter fluent setting
- * chain.
- *
- * @param first
- * The first number in the range, usually to the left in LTR locales.
- * @param second
- * The second number in the range, usually to the right in LTR locales.
- * @param status
- * Set if an error occurs while formatting.
- * @return A FormattedNumberRange object; call .toString() to get the string.
- * @stable ICU 63
- */
- FormattedNumberRange formatFormattableRange(
- const Formattable& first, const Formattable& second, UErrorCode& status) const;
-
- /**
- * Default constructor: puts the formatter into a valid but undefined state.
- *
- * @stable ICU 63
- */
- LocalizedNumberRangeFormatter() = default;
-
- /**
- * Returns a copy of this LocalizedNumberRangeFormatter.
- * @stable ICU 63
- */
- LocalizedNumberRangeFormatter(const LocalizedNumberRangeFormatter &other);
-
- /**
- * Move constructor:
- * The source LocalizedNumberRangeFormatter will be left in a valid but undefined state.
- * @stable ICU 63
- */
- LocalizedNumberRangeFormatter(LocalizedNumberRangeFormatter&& src) U_NOEXCEPT;
-
- /**
- * Copy assignment operator.
- * @stable ICU 63
- */
- LocalizedNumberRangeFormatter& operator=(const LocalizedNumberRangeFormatter& other);
-
- /**
- * Move assignment operator:
- * The source LocalizedNumberRangeFormatter will be left in a valid but undefined state.
- * @stable ICU 63
- */
- LocalizedNumberRangeFormatter& operator=(LocalizedNumberRangeFormatter&& src) U_NOEXCEPT;
-
-#ifndef U_HIDE_INTERNAL_API
-
- /**
- * @param results
- * The results object. This method will mutate it to save the results.
- * @param equalBeforeRounding
- * Whether the number was equal before copying it into a DecimalQuantity.
- * Used for determining the identity fallback behavior.
- * @param status
- * Set if an error occurs while formatting.
- * @internal
- */
- void formatImpl(impl::UFormattedNumberRangeData& results, bool equalBeforeRounding,
- UErrorCode& status) const;
-
-#endif /* U_HIDE_INTERNAL_API */
-
- /**
- * Destruct this LocalizedNumberRangeFormatter, cleaning up any memory it might own.
- * @stable ICU 63
- */
- ~LocalizedNumberRangeFormatter();
-
- private:
- std::atomic<impl::NumberRangeFormatterImpl*> fAtomicFormatter = {};
-
- const impl::NumberRangeFormatterImpl* getFormatter(UErrorCode& stauts) const;
-
- explicit LocalizedNumberRangeFormatter(
- const NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>& other);
-
- explicit LocalizedNumberRangeFormatter(
- NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>&& src) U_NOEXCEPT;
-
- LocalizedNumberRangeFormatter(const impl::RangeMacroProps &macros, const Locale &locale);
-
- LocalizedNumberRangeFormatter(impl::RangeMacroProps &&macros, const Locale &locale);
-
- void clear();
-
- // To give the fluent setters access to this class's constructor:
- friend class NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>;
- friend class NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>;
-
- // To give UnlocalizedNumberRangeFormatter::locale() access to this class's constructor:
- friend class UnlocalizedNumberRangeFormatter;
-};
-
-/**
- * The result of a number range formatting operation. This class allows the result to be exported in several data types,
- * including a UnicodeString and a FieldPositionIterator.
- *
- * Instances of this class are immutable and thread-safe.
- *
- * @stable ICU 63
- */
-class U_I18N_API FormattedNumberRange : public UMemory, public FormattedValue {
- public:
- // Copybrief: this method is older than the parent method
- /**
- * @copybrief FormattedValue::toString()
- *
- * For more information, see FormattedValue::toString()
- *
- * @stable ICU 63
- */
- UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
-
- // Copydoc: this method is new in ICU 64
- /** @copydoc FormattedValue::toTempString() */
- UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
-
- // Copybrief: this method is older than the parent method
- /**
- * @copybrief FormattedValue::appendTo()
- *
- * For more information, see FormattedValue::appendTo()
- *
- * @stable ICU 63
- */
- Appendable &appendTo(Appendable &appendable, UErrorCode& status) const U_OVERRIDE;
-
- // Copydoc: this method is new in ICU 64
- /** @copydoc FormattedValue::nextPosition() */
- UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
-
-#ifndef U_HIDE_DRAFT_API
- /**
- * Export the first formatted number as a decimal number. This endpoint
- * is useful for obtaining the exact number being printed after scaling
- * and rounding have been applied by the number range formatting pipeline.
- *
- * The syntax of the unformatted number is a "numeric string"
- * as defined in the Decimal Arithmetic Specification, available at
- * http://speleotrove.com/decimal
- *
- * @return A decimal representation of the first formatted number.
- * @draft ICU 63
- * @see NumberRangeFormatter
- * @see #getSecondDecimal
- */
- UnicodeString getFirstDecimal(UErrorCode& status) const;
-
- /**
- * Export the second formatted number as a decimal number. This endpoint
- * is useful for obtaining the exact number being printed after scaling
- * and rounding have been applied by the number range formatting pipeline.
- *
- * The syntax of the unformatted number is a "numeric string"
- * as defined in the Decimal Arithmetic Specification, available at
- * http://speleotrove.com/decimal
- *
- * @return A decimal representation of the second formatted number.
- * @draft ICU 63
- * @see NumberRangeFormatter
- * @see #getFirstDecimal
- */
- UnicodeString getSecondDecimal(UErrorCode& status) const;
-#endif // U_HIDE_DRAFT_API
-
- /**
- * Returns whether the pair of numbers was successfully formatted as a range or whether an identity fallback was
- * used. For example, if the first and second number were the same either before or after rounding occurred, an
- * identity fallback was used.
- *
- * @return An indication the resulting identity situation in the formatted number range.
- * @stable ICU 63
- * @see UNumberRangeIdentityFallback
- */
- UNumberRangeIdentityResult getIdentityResult(UErrorCode& status) const;
-
- /**
- * Copying not supported; use move constructor instead.
- */
- FormattedNumberRange(const FormattedNumberRange&) = delete;
-
- /**
- * Copying not supported; use move assignment instead.
- */
- FormattedNumberRange& operator=(const FormattedNumberRange&) = delete;
-
- /**
- * Move constructor:
- * Leaves the source FormattedNumberRange in an undefined state.
- * @stable ICU 63
- */
- FormattedNumberRange(FormattedNumberRange&& src) U_NOEXCEPT;
-
- /**
- * Move assignment:
- * Leaves the source FormattedNumberRange in an undefined state.
- * @stable ICU 63
- */
- FormattedNumberRange& operator=(FormattedNumberRange&& src) U_NOEXCEPT;
-
- /**
- * Destruct an instance of FormattedNumberRange, cleaning up any memory it might own.
- * @stable ICU 63
- */
- ~FormattedNumberRange();
-
- private:
- // Can't use LocalPointer because UFormattedNumberRangeData is forward-declared
- const impl::UFormattedNumberRangeData *fData;
-
- // Error code for the terminal methods
- UErrorCode fErrorCode;
-
- /**
- * Internal constructor from data type. Adopts the data pointer.
- */
- explicit FormattedNumberRange(impl::UFormattedNumberRangeData *results)
- : fData(results), fErrorCode(U_ZERO_ERROR) {}
-
- explicit FormattedNumberRange(UErrorCode errorCode)
- : fData(nullptr), fErrorCode(errorCode) {}
-
- void getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih, UErrorCode& status) const;
-
- // To give LocalizedNumberRangeFormatter format methods access to this class's constructor:
- friend class LocalizedNumberRangeFormatter;
-};
-
-/**
- * See the main description in numberrangeformatter.h for documentation and examples.
- *
- * @stable ICU 63
- */
-class U_I18N_API NumberRangeFormatter final {
- public:
- /**
- * Call this method at the beginning of a NumberRangeFormatter fluent chain in which the locale is not currently
- * known at the call site.
- *
- * @return An {@link UnlocalizedNumberRangeFormatter}, to be used for chaining.
- * @stable ICU 63
- */
- static UnlocalizedNumberRangeFormatter with();
-
- /**
- * Call this method at the beginning of a NumberRangeFormatter fluent chain in which the locale is known at the call
- * site.
- *
- * @param locale
- * The locale from which to load formats and symbols for number range formatting.
- * @return A {@link LocalizedNumberRangeFormatter}, to be used for chaining.
- * @stable ICU 63
- */
- static LocalizedNumberRangeFormatter withLocale(const Locale &locale);
-
- /**
- * Use factory methods instead of the constructor to create a NumberFormatter.
- */
- NumberRangeFormatter() = delete;
-};
-
-} // namespace number
-U_NAMESPACE_END
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
-#endif // __NUMBERRANGEFORMATTER_H__
-
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#ifndef __NUMBERRANGEFORMATTER_H__
+#define __NUMBERRANGEFORMATTER_H__
+
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
+#if !UCONFIG_NO_FORMATTING
+
+#include <atomic>
+#include "unicode/appendable.h"
+#include "unicode/fieldpos.h"
+#include "unicode/formattedvalue.h"
+#include "unicode/fpositer.h"
+#include "unicode/numberformatter.h"
+
+/**
+ * \file
+ * \brief C++ API: Library for localized formatting of number, currency, and unit ranges.
+ *
+ * The main entrypoint to the formatting of ranges of numbers, including currencies and other units of measurement.
+ * <p>
+ * Usage example:
+ * <p>
+ * <pre>
+ * NumberRangeFormatter::with()
+ * .identityFallback(UNUM_IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE)
+ * .numberFormatterFirst(NumberFormatter::with().adoptUnit(MeasureUnit::createMeter()))
+ * .numberFormatterSecond(NumberFormatter::with().adoptUnit(MeasureUnit::createKilometer()))
+ * .locale("en-GB")
+ * .formatRange(750, 1.2, status)
+ * .toString(status);
+ * // => "750 m - 1.2 km"
+ * </pre>
+ * <p>
+ * Like NumberFormatter, NumberRangeFormatter instances (i.e., LocalizedNumberRangeFormatter
+ * and UnlocalizedNumberRangeFormatter) are immutable and thread-safe. This API is based on the
+ * <em>fluent</em> design pattern popularized by libraries such as Google's Guava.
+ *
+ * @author Shane Carr
+ */
+
+
+/**
+ * Defines how to merge fields that are identical across the range sign.
+ *
+ * @stable ICU 63
+ */
+typedef enum UNumberRangeCollapse {
+ /**
+ * Use locale data and heuristics to determine how much of the string to collapse. Could end up collapsing none,
+ * some, or all repeated pieces in a locale-sensitive way.
+ *
+ * The heuristics used for this option are subject to change over time.
+ *
+ * @stable ICU 63
+ */
+ UNUM_RANGE_COLLAPSE_AUTO,
+
+ /**
+ * Do not collapse any part of the number. Example: "3.2 thousand kilograms – 5.3 thousand kilograms"
+ *
+ * @stable ICU 63
+ */
+ UNUM_RANGE_COLLAPSE_NONE,
+
+ /**
+ * Collapse the unit part of the number, but not the notation, if present. Example: "3.2 thousand – 5.3 thousand
+ * kilograms"
+ *
+ * @stable ICU 63
+ */
+ UNUM_RANGE_COLLAPSE_UNIT,
+
+ /**
+ * Collapse any field that is equal across the range sign. May introduce ambiguity on the magnitude of the
+ * number. Example: "3.2 – 5.3 thousand kilograms"
+ *
+ * @stable ICU 63
+ */
+ UNUM_RANGE_COLLAPSE_ALL
+} UNumberRangeCollapse;
+
+/**
+ * Defines the behavior when the two numbers in the range are identical after rounding. To programmatically detect
+ * when the identity fallback is used, compare the lower and upper BigDecimals via FormattedNumber.
+ *
+ * @stable ICU 63
+ * @see NumberRangeFormatter
+ */
+typedef enum UNumberRangeIdentityFallback {
+ /**
+ * Show the number as a single value rather than a range. Example: "$5"
+ *
+ * @stable ICU 63
+ */
+ UNUM_IDENTITY_FALLBACK_SINGLE_VALUE,
+
+ /**
+ * Show the number using a locale-sensitive approximation pattern. If the numbers were the same before rounding,
+ * show the single value. Example: "~$5" or "$5"
+ *
+ * @stable ICU 63
+ */
+ UNUM_IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE,
+
+ /**
+ * Show the number using a locale-sensitive approximation pattern. Use the range pattern always, even if the
+ * inputs are the same. Example: "~$5"
+ *
+ * @stable ICU 63
+ */
+ UNUM_IDENTITY_FALLBACK_APPROXIMATELY,
+
+ /**
+ * Show the number as the range of two equal values. Use the range pattern always, even if the inputs are the
+ * same. Example (with RangeCollapse.NONE): "$5 – $5"
+ *
+ * @stable ICU 63
+ */
+ UNUM_IDENTITY_FALLBACK_RANGE
+} UNumberRangeIdentityFallback;
+
+/**
+ * Used in the result class FormattedNumberRange to indicate to the user whether the numbers formatted in the range
+ * were equal or not, and whether or not the identity fallback was applied.
+ *
+ * @stable ICU 63
+ * @see NumberRangeFormatter
+ */
+typedef enum UNumberRangeIdentityResult {
+ /**
+ * Used to indicate that the two numbers in the range were equal, even before any rounding rules were applied.
+ *
+ * @stable ICU 63
+ * @see NumberRangeFormatter
+ */
+ UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING,
+
+ /**
+ * Used to indicate that the two numbers in the range were equal, but only after rounding rules were applied.
+ *
+ * @stable ICU 63
+ * @see NumberRangeFormatter
+ */
+ UNUM_IDENTITY_RESULT_EQUAL_AFTER_ROUNDING,
+
+ /**
+ * Used to indicate that the two numbers in the range were not equal, even after rounding rules were applied.
+ *
+ * @stable ICU 63
+ * @see NumberRangeFormatter
+ */
+ UNUM_IDENTITY_RESULT_NOT_EQUAL,
+
+#ifndef U_HIDE_INTERNAL_API
+ /**
+ * The number of entries in this enum.
+ * @internal
+ */
+ UNUM_IDENTITY_RESULT_COUNT
+#endif
+
+} UNumberRangeIdentityResult;
+
+U_NAMESPACE_BEGIN
+
+namespace number { // icu::number
+
+// Forward declarations:
+class UnlocalizedNumberRangeFormatter;
+class LocalizedNumberRangeFormatter;
+class FormattedNumberRange;
+
+namespace impl {
+
+// Forward declarations:
+struct RangeMacroProps;
+class DecimalQuantity;
+class UFormattedNumberRangeData;
+class NumberRangeFormatterImpl;
+
+} // namespace impl
+
+/**
+ * \cond
+ * Export an explicit template instantiation. See datefmt.h
+ * (When building DLLs for Windows this is required.)
+ */
+#if U_PLATFORM == U_PF_WINDOWS && !defined(U_IN_DOXYGEN)
+} // namespace icu::number
+U_NAMESPACE_END
+
+template struct U_I18N_API std::atomic< U_NAMESPACE_QUALIFIER number::impl::NumberRangeFormatterImpl*>;
+
+U_NAMESPACE_BEGIN
+namespace number { // icu::number
+#endif
+/** \endcond */
+
+// Other helper classes would go here, but there are none.
+
+namespace impl { // icu::number::impl
+
+// Do not enclose entire MacroProps with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
+/** @internal */
+struct U_I18N_API RangeMacroProps : public UMemory {
+ /** @internal */
+ UnlocalizedNumberFormatter formatter1; // = NumberFormatter::with();
+
+ /** @internal */
+ UnlocalizedNumberFormatter formatter2; // = NumberFormatter::with();
+
+ /** @internal */
+ bool singleFormatter = true;
+
+ /** @internal */
+ UNumberRangeCollapse collapse = UNUM_RANGE_COLLAPSE_AUTO;
+
+ /** @internal */
+ UNumberRangeIdentityFallback identityFallback = UNUM_IDENTITY_FALLBACK_APPROXIMATELY;
+
+ /** @internal */
+ Locale locale;
+
+ // NOTE: Uses default copy and move constructors.
+
+ /**
+ * Check all members for errors.
+ * @internal
+ */
+ bool copyErrorTo(UErrorCode &status) const {
+ return formatter1.copyErrorTo(status) || formatter2.copyErrorTo(status);
+ }
+};
+
+} // namespace impl
+
+/**
+ * An abstract base class for specifying settings related to number formatting. This class is implemented by
+ * {@link UnlocalizedNumberRangeFormatter} and {@link LocalizedNumberRangeFormatter}. This class is not intended for
+ * public subclassing.
+ */
+template<typename Derived>
+class U_I18N_API NumberRangeFormatterSettings {
+ public:
+ /**
+ * Sets the NumberFormatter instance to use for the numbers in the range. The same formatter is applied to both
+ * sides of the range.
+ * <p>
+ * The NumberFormatter instances must not have a locale applied yet; the locale specified on the
+ * NumberRangeFormatter will be used.
+ *
+ * @param formatter
+ * The formatter to use for both numbers in the range.
+ * @return The fluent chain.
+ * @stable ICU 63
+ */
+ Derived numberFormatterBoth(const UnlocalizedNumberFormatter &formatter) const &;
+
+ /**
+ * Overload of numberFormatterBoth() for use on an rvalue reference.
+ *
+ * @param formatter
+ * The formatter to use for both numbers in the range.
+ * @return The fluent chain.
+ * @see #numberFormatterBoth
+ * @stable ICU 63
+ */
+ Derived numberFormatterBoth(const UnlocalizedNumberFormatter &formatter) &&;
+
+ /**
+ * Overload of numberFormatterBoth() for use on an rvalue reference.
+ *
+ * @param formatter
+ * The formatter to use for both numbers in the range.
+ * @return The fluent chain.
+ * @see #numberFormatterBoth
+ * @stable ICU 63
+ */
+ Derived numberFormatterBoth(UnlocalizedNumberFormatter &&formatter) const &;
+
+ /**
+ * Overload of numberFormatterBoth() for use on an rvalue reference.
+ *
+ * @param formatter
+ * The formatter to use for both numbers in the range.
+ * @return The fluent chain.
+ * @see #numberFormatterBoth
+ * @stable ICU 63
+ */
+ Derived numberFormatterBoth(UnlocalizedNumberFormatter &&formatter) &&;
+
+ /**
+ * Sets the NumberFormatter instance to use for the first number in the range.
+ * <p>
+ * The NumberFormatter instances must not have a locale applied yet; the locale specified on the
+ * NumberRangeFormatter will be used.
+ *
+ * @param formatterFirst
+ * The formatter to use for the first number in the range.
+ * @return The fluent chain.
+ * @stable ICU 63
+ */
+ Derived numberFormatterFirst(const UnlocalizedNumberFormatter &formatterFirst) const &;
+
+ /**
+ * Overload of numberFormatterFirst() for use on an rvalue reference.
+ *
+ * @param formatterFirst
+ * The formatter to use for the first number in the range.
+ * @return The fluent chain.
+ * @see #numberFormatterFirst
+ * @stable ICU 63
+ */
+ Derived numberFormatterFirst(const UnlocalizedNumberFormatter &formatterFirst) &&;
+
+ /**
+ * Overload of numberFormatterFirst() for use on an rvalue reference.
+ *
+ * @param formatterFirst
+ * The formatter to use for the first number in the range.
+ * @return The fluent chain.
+ * @see #numberFormatterFirst
+ * @stable ICU 63
+ */
+ Derived numberFormatterFirst(UnlocalizedNumberFormatter &&formatterFirst) const &;
+
+ /**
+ * Overload of numberFormatterFirst() for use on an rvalue reference.
+ *
+ * @param formatterFirst
+ * The formatter to use for the first number in the range.
+ * @return The fluent chain.
+ * @see #numberFormatterFirst
+ * @stable ICU 63
+ */
+ Derived numberFormatterFirst(UnlocalizedNumberFormatter &&formatterFirst) &&;
+
+ /**
+ * Sets the NumberFormatter instance to use for the second number in the range.
+ * <p>
+ * The NumberFormatter instances must not have a locale applied yet; the locale specified on the
+ * NumberRangeFormatter will be used.
+ *
+ * @param formatterSecond
+ * The formatter to use for the second number in the range.
+ * @return The fluent chain.
+ * @stable ICU 63
+ */
+ Derived numberFormatterSecond(const UnlocalizedNumberFormatter &formatterSecond) const &;
+
+ /**
+ * Overload of numberFormatterSecond() for use on an rvalue reference.
+ *
+ * @param formatterSecond
+ * The formatter to use for the second number in the range.
+ * @return The fluent chain.
+ * @see #numberFormatterSecond
+ * @stable ICU 63
+ */
+ Derived numberFormatterSecond(const UnlocalizedNumberFormatter &formatterSecond) &&;
+
+ /**
+ * Overload of numberFormatterSecond() for use on an rvalue reference.
+ *
+ * @param formatterSecond
+ * The formatter to use for the second number in the range.
+ * @return The fluent chain.
+ * @see #numberFormatterSecond
+ * @stable ICU 63
+ */
+ Derived numberFormatterSecond(UnlocalizedNumberFormatter &&formatterSecond) const &;
+
+ /**
+ * Overload of numberFormatterSecond() for use on an rvalue reference.
+ *
+ * @param formatterSecond
+ * The formatter to use for the second number in the range.
+ * @return The fluent chain.
+ * @see #numberFormatterSecond
+ * @stable ICU 63
+ */
+ Derived numberFormatterSecond(UnlocalizedNumberFormatter &&formatterSecond) &&;
+
+ /**
+ * Sets the aggressiveness of "collapsing" fields across the range separator. Possible values:
+ * <p>
+ * <ul>
+ * <li>ALL: "3-5K miles"</li>
+ * <li>UNIT: "3K - 5K miles"</li>
+ * <li>NONE: "3K miles - 5K miles"</li>
+ * <li>AUTO: usually UNIT or NONE, depending on the locale and formatter settings</li>
+ * </ul>
+ * <p>
+ * The default value is AUTO.
+ *
+ * @param collapse
+ * The collapsing strategy to use for this range.
+ * @return The fluent chain.
+ * @stable ICU 63
+ */
+ Derived collapse(UNumberRangeCollapse collapse) const &;
+
+ /**
+ * Overload of collapse() for use on an rvalue reference.
+ *
+ * @param collapse
+ * The collapsing strategy to use for this range.
+ * @return The fluent chain.
+ * @see #collapse
+ * @stable ICU 63
+ */
+ Derived collapse(UNumberRangeCollapse collapse) &&;
+
+ /**
+ * Sets the behavior when the two sides of the range are the same. This could happen if the same two numbers are
+ * passed to the formatRange function, or if different numbers are passed to the function but they become the same
+ * after rounding rules are applied. Possible values:
+ * <p>
+ * <ul>
+ * <li>SINGLE_VALUE: "5 miles"</li>
+ * <li>APPROXIMATELY_OR_SINGLE_VALUE: "~5 miles" or "5 miles", depending on whether the number was the same before
+ * rounding was applied</li>
+ * <li>APPROXIMATELY: "~5 miles"</li>
+ * <li>RANGE: "5-5 miles" (with collapse=UNIT)</li>
+ * </ul>
+ * <p>
+ * The default value is APPROXIMATELY.
+ *
+ * @param identityFallback
+ * The strategy to use when formatting two numbers that end up being the same.
+ * @return The fluent chain.
+ * @stable ICU 63
+ */
+ Derived identityFallback(UNumberRangeIdentityFallback identityFallback) const &;
+
+ /**
+ * Overload of identityFallback() for use on an rvalue reference.
+ *
+ * @param identityFallback
+ * The strategy to use when formatting two numbers that end up being the same.
+ * @return The fluent chain.
+ * @see #identityFallback
+ * @stable ICU 63
+ */
+ Derived identityFallback(UNumberRangeIdentityFallback identityFallback) &&;
+
+ /**
+ * Returns the current (Un)LocalizedNumberRangeFormatter as a LocalPointer
+ * wrapping a heap-allocated copy of the current object.
+ *
+ * This is equivalent to new-ing the move constructor with a value object
+ * as the argument.
+ *
+ * @return A wrapped (Un)LocalizedNumberRangeFormatter pointer, or a wrapped
+ * nullptr on failure.
+ * @stable ICU 64
+ */
+ LocalPointer<Derived> clone() const &;
+
+ /**
+ * Overload of clone for use on an rvalue reference.
+ *
+ * @return A wrapped (Un)LocalizedNumberRangeFormatter pointer, or a wrapped
+ * nullptr on failure.
+ * @stable ICU 64
+ */
+ LocalPointer<Derived> clone() &&;
+
+ /**
+ * Sets the UErrorCode if an error occurred in the fluent chain.
+ * Preserves older error codes in the outErrorCode.
+ * @return TRUE if U_FAILURE(outErrorCode)
+ * @stable ICU 63
+ */
+ UBool copyErrorTo(UErrorCode &outErrorCode) const {
+ if (U_FAILURE(outErrorCode)) {
+ // Do not overwrite the older error code
+ return TRUE;
+ }
+ fMacros.copyErrorTo(outErrorCode);
+ return U_FAILURE(outErrorCode);
+ }
+
+ // NOTE: Uses default copy and move constructors.
+
+ private:
+ impl::RangeMacroProps fMacros;
+
+ // Don't construct me directly! Use (Un)LocalizedNumberFormatter.
+ NumberRangeFormatterSettings() = default;
+
+ friend class LocalizedNumberRangeFormatter;
+ friend class UnlocalizedNumberRangeFormatter;
+};
+
+/**
+ * A NumberRangeFormatter that does not yet have a locale. In order to format, a locale must be specified.
+ *
+ * Instances of this class are immutable and thread-safe.
+ *
+ * @see NumberRangeFormatter
+ * @stable ICU 63
+ */
+class U_I18N_API UnlocalizedNumberRangeFormatter
+ : public NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>, public UMemory {
+
+ public:
+ /**
+ * Associate the given locale with the number range formatter. The locale is used for picking the
+ * appropriate symbols, formats, and other data for number display.
+ *
+ * @param locale
+ * The locale to use when loading data for number formatting.
+ * @return The fluent chain.
+ * @stable ICU 63
+ */
+ LocalizedNumberRangeFormatter locale(const icu::Locale &locale) const &;
+
+ /**
+ * Overload of locale() for use on an rvalue reference.
+ *
+ * @param locale
+ * The locale to use when loading data for number formatting.
+ * @return The fluent chain.
+ * @see #locale
+ * @stable ICU 63
+ */
+ LocalizedNumberRangeFormatter locale(const icu::Locale &locale) &&;
+
+ /**
+ * Default constructor: puts the formatter into a valid but undefined state.
+ *
+ * @stable ICU 63
+ */
+ UnlocalizedNumberRangeFormatter() = default;
+
+ /**
+ * Returns a copy of this UnlocalizedNumberRangeFormatter.
+ * @stable ICU 63
+ */
+ UnlocalizedNumberRangeFormatter(const UnlocalizedNumberRangeFormatter &other);
+
+ /**
+ * Move constructor:
+ * The source UnlocalizedNumberRangeFormatter will be left in a valid but undefined state.
+ * @stable ICU 63
+ */
+ UnlocalizedNumberRangeFormatter(UnlocalizedNumberRangeFormatter&& src) U_NOEXCEPT;
+
+ /**
+ * Copy assignment operator.
+ * @stable ICU 63
+ */
+ UnlocalizedNumberRangeFormatter& operator=(const UnlocalizedNumberRangeFormatter& other);
+
+ /**
+ * Move assignment operator:
+ * The source UnlocalizedNumberRangeFormatter will be left in a valid but undefined state.
+ * @stable ICU 63
+ */
+ UnlocalizedNumberRangeFormatter& operator=(UnlocalizedNumberRangeFormatter&& src) U_NOEXCEPT;
+
+ private:
+ explicit UnlocalizedNumberRangeFormatter(
+ const NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>& other);
+
+ explicit UnlocalizedNumberRangeFormatter(
+ NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>&& src) U_NOEXCEPT;
+
+ // To give the fluent setters access to this class's constructor:
+ friend class NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>;
+
+ // To give NumberRangeFormatter::with() access to this class's constructor:
+ friend class NumberRangeFormatter;
+};
+
+/**
+ * A NumberRangeFormatter that has a locale associated with it; this means .formatRange() methods are available.
+ *
+ * Instances of this class are immutable and thread-safe.
+ *
+ * @see NumberFormatter
+ * @stable ICU 63
+ */
+class U_I18N_API LocalizedNumberRangeFormatter
+ : public NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>, public UMemory {
+ public:
+ /**
+ * Format the given Formattables to a string using the settings specified in the NumberRangeFormatter fluent setting
+ * chain.
+ *
+ * @param first
+ * The first number in the range, usually to the left in LTR locales.
+ * @param second
+ * The second number in the range, usually to the right in LTR locales.
+ * @param status
+ * Set if an error occurs while formatting.
+ * @return A FormattedNumberRange object; call .toString() to get the string.
+ * @stable ICU 63
+ */
+ FormattedNumberRange formatFormattableRange(
+ const Formattable& first, const Formattable& second, UErrorCode& status) const;
+
+ /**
+ * Default constructor: puts the formatter into a valid but undefined state.
+ *
+ * @stable ICU 63
+ */
+ LocalizedNumberRangeFormatter() = default;
+
+ /**
+ * Returns a copy of this LocalizedNumberRangeFormatter.
+ * @stable ICU 63
+ */
+ LocalizedNumberRangeFormatter(const LocalizedNumberRangeFormatter &other);
+
+ /**
+ * Move constructor:
+ * The source LocalizedNumberRangeFormatter will be left in a valid but undefined state.
+ * @stable ICU 63
+ */
+ LocalizedNumberRangeFormatter(LocalizedNumberRangeFormatter&& src) U_NOEXCEPT;
+
+ /**
+ * Copy assignment operator.
+ * @stable ICU 63
+ */
+ LocalizedNumberRangeFormatter& operator=(const LocalizedNumberRangeFormatter& other);
+
+ /**
+ * Move assignment operator:
+ * The source LocalizedNumberRangeFormatter will be left in a valid but undefined state.
+ * @stable ICU 63
+ */
+ LocalizedNumberRangeFormatter& operator=(LocalizedNumberRangeFormatter&& src) U_NOEXCEPT;
+
+#ifndef U_HIDE_INTERNAL_API
+
+ /**
+ * @param results
+ * The results object. This method will mutate it to save the results.
+ * @param equalBeforeRounding
+ * Whether the number was equal before copying it into a DecimalQuantity.
+ * Used for determining the identity fallback behavior.
+ * @param status
+ * Set if an error occurs while formatting.
+ * @internal
+ */
+ void formatImpl(impl::UFormattedNumberRangeData& results, bool equalBeforeRounding,
+ UErrorCode& status) const;
+
+#endif /* U_HIDE_INTERNAL_API */
+
+ /**
+ * Destruct this LocalizedNumberRangeFormatter, cleaning up any memory it might own.
+ * @stable ICU 63
+ */
+ ~LocalizedNumberRangeFormatter();
+
+ private:
+ std::atomic<impl::NumberRangeFormatterImpl*> fAtomicFormatter = {};
+
+ const impl::NumberRangeFormatterImpl* getFormatter(UErrorCode& stauts) const;
+
+ explicit LocalizedNumberRangeFormatter(
+ const NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>& other);
+
+ explicit LocalizedNumberRangeFormatter(
+ NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>&& src) U_NOEXCEPT;
+
+ LocalizedNumberRangeFormatter(const impl::RangeMacroProps &macros, const Locale &locale);
+
+ LocalizedNumberRangeFormatter(impl::RangeMacroProps &&macros, const Locale &locale);
+
+ void clear();
+
+ // To give the fluent setters access to this class's constructor:
+ friend class NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>;
+ friend class NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>;
+
+ // To give UnlocalizedNumberRangeFormatter::locale() access to this class's constructor:
+ friend class UnlocalizedNumberRangeFormatter;
+};
+
+/**
+ * The result of a number range formatting operation. This class allows the result to be exported in several data types,
+ * including a UnicodeString and a FieldPositionIterator.
+ *
+ * Instances of this class are immutable and thread-safe.
+ *
+ * @stable ICU 63
+ */
+class U_I18N_API FormattedNumberRange : public UMemory, public FormattedValue {
+ public:
+ // Copybrief: this method is older than the parent method
+ /**
+ * @copybrief FormattedValue::toString()
+ *
+ * For more information, see FormattedValue::toString()
+ *
+ * @stable ICU 63
+ */
+ UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
+
+ // Copydoc: this method is new in ICU 64
+ /** @copydoc FormattedValue::toTempString() */
+ UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
+
+ // Copybrief: this method is older than the parent method
+ /**
+ * @copybrief FormattedValue::appendTo()
+ *
+ * For more information, see FormattedValue::appendTo()
+ *
+ * @stable ICU 63
+ */
+ Appendable &appendTo(Appendable &appendable, UErrorCode& status) const U_OVERRIDE;
+
+ // Copydoc: this method is new in ICU 64
+ /** @copydoc FormattedValue::nextPosition() */
+ UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Export the first formatted number as a decimal number. This endpoint
+ * is useful for obtaining the exact number being printed after scaling
+ * and rounding have been applied by the number range formatting pipeline.
+ *
+ * The syntax of the unformatted number is a "numeric string"
+ * as defined in the Decimal Arithmetic Specification, available at
+ * http://speleotrove.com/decimal
+ *
+ * @return A decimal representation of the first formatted number.
+ * @draft ICU 63
+ * @see NumberRangeFormatter
+ * @see #getSecondDecimal
+ */
+ UnicodeString getFirstDecimal(UErrorCode& status) const;
+
+ /**
+ * Export the second formatted number as a decimal number. This endpoint
+ * is useful for obtaining the exact number being printed after scaling
+ * and rounding have been applied by the number range formatting pipeline.
+ *
+ * The syntax of the unformatted number is a "numeric string"
+ * as defined in the Decimal Arithmetic Specification, available at
+ * http://speleotrove.com/decimal
+ *
+ * @return A decimal representation of the second formatted number.
+ * @draft ICU 63
+ * @see NumberRangeFormatter
+ * @see #getFirstDecimal
+ */
+ UnicodeString getSecondDecimal(UErrorCode& status) const;
+#endif // U_HIDE_DRAFT_API
+
+ /**
+ * Returns whether the pair of numbers was successfully formatted as a range or whether an identity fallback was
+ * used. For example, if the first and second number were the same either before or after rounding occurred, an
+ * identity fallback was used.
+ *
+ * @return An indication the resulting identity situation in the formatted number range.
+ * @stable ICU 63
+ * @see UNumberRangeIdentityFallback
+ */
+ UNumberRangeIdentityResult getIdentityResult(UErrorCode& status) const;
+
+ /**
+ * Copying not supported; use move constructor instead.
+ */
+ FormattedNumberRange(const FormattedNumberRange&) = delete;
+
+ /**
+ * Copying not supported; use move assignment instead.
+ */
+ FormattedNumberRange& operator=(const FormattedNumberRange&) = delete;
+
+ /**
+ * Move constructor:
+ * Leaves the source FormattedNumberRange in an undefined state.
+ * @stable ICU 63
+ */
+ FormattedNumberRange(FormattedNumberRange&& src) U_NOEXCEPT;
+
+ /**
+ * Move assignment:
+ * Leaves the source FormattedNumberRange in an undefined state.
+ * @stable ICU 63
+ */
+ FormattedNumberRange& operator=(FormattedNumberRange&& src) U_NOEXCEPT;
+
+ /**
+ * Destruct an instance of FormattedNumberRange, cleaning up any memory it might own.
+ * @stable ICU 63
+ */
+ ~FormattedNumberRange();
+
+ private:
+ // Can't use LocalPointer because UFormattedNumberRangeData is forward-declared
+ const impl::UFormattedNumberRangeData *fData;
+
+ // Error code for the terminal methods
+ UErrorCode fErrorCode;
+
+ /**
+ * Internal constructor from data type. Adopts the data pointer.
+ */
+ explicit FormattedNumberRange(impl::UFormattedNumberRangeData *results)
+ : fData(results), fErrorCode(U_ZERO_ERROR) {}
+
+ explicit FormattedNumberRange(UErrorCode errorCode)
+ : fData(nullptr), fErrorCode(errorCode) {}
+
+ void getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih, UErrorCode& status) const;
+
+ // To give LocalizedNumberRangeFormatter format methods access to this class's constructor:
+ friend class LocalizedNumberRangeFormatter;
+};
+
+/**
+ * See the main description in numberrangeformatter.h for documentation and examples.
+ *
+ * @stable ICU 63
+ */
+class U_I18N_API NumberRangeFormatter final {
+ public:
+ /**
+ * Call this method at the beginning of a NumberRangeFormatter fluent chain in which the locale is not currently
+ * known at the call site.
+ *
+ * @return An {@link UnlocalizedNumberRangeFormatter}, to be used for chaining.
+ * @stable ICU 63
+ */
+ static UnlocalizedNumberRangeFormatter with();
+
+ /**
+ * Call this method at the beginning of a NumberRangeFormatter fluent chain in which the locale is known at the call
+ * site.
+ *
+ * @param locale
+ * The locale from which to load formats and symbols for number range formatting.
+ * @return A {@link LocalizedNumberRangeFormatter}, to be used for chaining.
+ * @stable ICU 63
+ */
+ static LocalizedNumberRangeFormatter withLocale(const Locale &locale);
+
+ /**
+ * Use factory methods instead of the constructor to create a NumberFormatter.
+ */
+ NumberRangeFormatter() = delete;
+};
+
+} // namespace number
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
+#endif // __NUMBERRANGEFORMATTER_H__
+
diff --git a/contrib/libs/icu/include/unicode/numfmt.h b/contrib/libs/icu/include/unicode/numfmt.h
index 89e878a94d..48a69de7e7 100644
--- a/contrib/libs/icu/include/unicode/numfmt.h
+++ b/contrib/libs/icu/include/unicode/numfmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -26,11 +26,11 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
- * \brief C++ API: Compatibility APIs for number formatting.
+ * \brief C++ API: Compatibility APIs for number formatting.
*/
#if !UCONFIG_NO_FORMATTING
@@ -55,15 +55,15 @@ class StringEnumeration;
#endif
/**
- * <p><strong>IMPORTANT:</strong> New users are strongly encouraged to see if
- * numberformatter.h fits their use case. Although not deprecated, this header
- * is provided for backwards compatibility only.
+ * <p><strong>IMPORTANT:</strong> New users are strongly encouraged to see if
+ * numberformatter.h fits their use case. Although not deprecated, this header
+ * is provided for backwards compatibility only.
*
* Abstract base class for all number formats. Provides interface for
* formatting and parsing a number. Also provides methods for
* determining which locales have number formats, and what their names
* are.
- *
+ *
* \headerfile unicode/numfmt.h "unicode/numfmt.h"
* <P>
* NumberFormat helps you to format and parse numbers for any locale.
@@ -175,33 +175,33 @@ class StringEnumeration;
class U_I18N_API NumberFormat : public Format {
public:
/**
- * Rounding mode.
- *
- * <p>
- * For more detail on rounding modes, see:
- * http://userguide.icu-project.org/formatparse/numbers/rounding-modes
- *
- * @stable ICU 2.4
- */
- enum ERoundingMode {
- kRoundCeiling, /**< Round towards positive infinity */
- kRoundFloor, /**< Round towards negative infinity */
- kRoundDown, /**< Round towards zero */
- kRoundUp, /**< Round away from zero */
- kRoundHalfEven, /**< Round towards the nearest integer, or
- towards the nearest even integer if equidistant */
- kRoundHalfDown, /**< Round towards the nearest integer, or
- towards zero if equidistant */
- kRoundHalfUp, /**< Round towards the nearest integer, or
- away from zero if equidistant */
- /**
- * Return U_FORMAT_INEXACT_ERROR if number does not format exactly.
- * @stable ICU 4.8
- */
- kRoundUnnecessary
- };
-
- /**
+ * Rounding mode.
+ *
+ * <p>
+ * For more detail on rounding modes, see:
+ * http://userguide.icu-project.org/formatparse/numbers/rounding-modes
+ *
+ * @stable ICU 2.4
+ */
+ enum ERoundingMode {
+ kRoundCeiling, /**< Round towards positive infinity */
+ kRoundFloor, /**< Round towards negative infinity */
+ kRoundDown, /**< Round towards zero */
+ kRoundUp, /**< Round away from zero */
+ kRoundHalfEven, /**< Round towards the nearest integer, or
+ towards the nearest even integer if equidistant */
+ kRoundHalfDown, /**< Round towards the nearest integer, or
+ towards zero if equidistant */
+ kRoundHalfUp, /**< Round towards the nearest integer, or
+ away from zero if equidistant */
+ /**
+ * Return U_FORMAT_INEXACT_ERROR if number does not format exactly.
+ * @stable ICU 4.8
+ */
+ kRoundUnnecessary
+ };
+
+ /**
* Alignment Field constants used to construct a FieldPosition object.
* Signifies that the position of the integer part or fraction part of
* a formatted number should be returned.
@@ -239,10 +239,10 @@ public:
kPermillField = UNUM_PERMILL_FIELD,
/** @stable ICU 2.0 */
kSignField = UNUM_SIGN_FIELD,
- /** @stable ICU 64 */
- kMeasureUnitField = UNUM_MEASURE_UNIT_FIELD,
- /** @stable ICU 64 */
- kCompactField = UNUM_COMPACT_FIELD,
+ /** @stable ICU 64 */
+ kMeasureUnitField = UNUM_MEASURE_UNIT_FIELD,
+ /** @stable ICU 64 */
+ kCompactField = UNUM_COMPACT_FIELD,
/**
* These constants are provided for backwards compatibility only.
@@ -261,14 +261,14 @@ public:
virtual ~NumberFormat();
/**
- * Clones this object polymorphically.
- * The caller owns the result and should delete it when done.
- * @return clone, or nullptr if an error occurred
- * @stable ICU 2.0
- */
- virtual NumberFormat* clone() const = 0;
-
- /**
+ * Clones this object polymorphically.
+ * The caller owns the result and should delete it when done.
+ * @return clone, or nullptr if an error occurred
+ * @stable ICU 2.0
+ */
+ virtual NumberFormat* clone() const = 0;
+
+ /**
* Return true if the given Format objects are semantically equal.
* Objects of different subclasses are considered unequal.
* @return true if the given Format objects are semantically equal.
@@ -568,18 +568,18 @@ public:
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
-
-// Can't use #ifndef U_HIDE_INTERNAL_API because these are virtual methods
-
+
+// Can't use #ifndef U_HIDE_INTERNAL_API because these are virtual methods
+
/**
* Format a decimal number.
- * The number is a DecimalQuantity wrapper onto a floating point decimal number.
+ * The number is a DecimalQuantity wrapper onto a floating point decimal number.
* The default implementation in NumberFormat converts the decimal number
* to a double and formats that. Subclasses of NumberFormat that want
* to specifically handle big decimal numbers must override this method.
* class DecimalFormat does so.
*
- * @param number The number, a DecimalQuantity format Decimal Floating Point.
+ * @param number The number, a DecimalQuantity format Decimal Floating Point.
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
* @param posIter On return, can be used to iterate over positions
@@ -588,20 +588,20 @@ public:
* @return Reference to 'appendTo' parameter.
* @internal
*/
- virtual UnicodeString& format(const number::impl::DecimalQuantity &number,
+ virtual UnicodeString& format(const number::impl::DecimalQuantity &number,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
/**
* Format a decimal number.
- * The number is a DecimalQuantity wrapper onto a floating point decimal number.
+ * The number is a DecimalQuantity wrapper onto a floating point decimal number.
* The default implementation in NumberFormat converts the decimal number
* to a double and formats that. Subclasses of NumberFormat that want
* to specifically handle big decimal numbers must override this method.
* class DecimalFormat does so.
*
- * @param number The number, a DecimalQuantity format Decimal Floating Point.
+ * @param number The number, a DecimalQuantity format Decimal Floating Point.
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
* @param pos On input: an alignment field, if desired.
@@ -610,7 +610,7 @@ public:
* @return Reference to 'appendTo' parameter.
* @internal
*/
- virtual UnicodeString& format(const number::impl::DecimalQuantity &number,
+ virtual UnicodeString& format(const number::impl::DecimalQuantity &number,
UnicodeString& appendTo,
FieldPosition& pos,
UErrorCode& status) const;
@@ -647,9 +647,9 @@ public:
* @param result Formattable to be set to the parse result.
* If parse fails, return contents are undefined.
* @param status Output parameter set to a failure error code
- * when a failure occurs. The error code when the
- * string fails to parse is U_INVALID_FORMAT_ERROR,
- * unless overridden by a subclass.
+ * when a failure occurs. The error code when the
+ * string fails to parse is U_INVALID_FORMAT_ERROR,
+ * unless overridden by a subclass.
* @see NumberFormat::isParseIntegerOnly
* @stable ICU 2.0
*/
@@ -723,9 +723,9 @@ public:
/**
* Create a default style NumberFormat for the current default locale.
* The default formatting style is locale dependent.
- * <p>
- * <strong>NOTE:</strong> New users are strongly encouraged to use
- * {@link icu::number::NumberFormatter} instead of NumberFormat.
+ * <p>
+ * <strong>NOTE:</strong> New users are strongly encouraged to use
+ * {@link icu::number::NumberFormatter} instead of NumberFormat.
* @stable ICU 2.0
*/
static NumberFormat* U_EXPORT2 createInstance(UErrorCode&);
@@ -734,9 +734,9 @@ public:
* Create a default style NumberFormat for the specified locale.
* The default formatting style is locale dependent.
* @param inLocale the given locale.
- * <p>
- * <strong>NOTE:</strong> New users are strongly encouraged to use
- * {@link icu::number::NumberFormatter} instead of NumberFormat.
+ * <p>
+ * <strong>NOTE:</strong> New users are strongly encouraged to use
+ * {@link icu::number::NumberFormatter} instead of NumberFormat.
* @stable ICU 2.0
*/
static NumberFormat* U_EXPORT2 createInstance(const Locale& inLocale,
@@ -744,9 +744,9 @@ public:
/**
* Create a specific style NumberFormat for the specified locale.
- * <p>
- * <strong>NOTE:</strong> New users are strongly encouraged to use
- * {@link icu::number::NumberFormatter} instead of NumberFormat.
+ * <p>
+ * <strong>NOTE:</strong> New users are strongly encouraged to use
+ * {@link icu::number::NumberFormatter} instead of NumberFormat.
* @param desiredLocale the given locale.
* @param style the given style.
* @param errorCode Output param filled with success/failure status.
@@ -783,18 +783,18 @@ public:
/**
* Returns a currency format for the current default locale.
- * <p>
- * <strong>NOTE:</strong> New users are strongly encouraged to use
- * {@link icu::number::NumberFormatter} instead of NumberFormat.
+ * <p>
+ * <strong>NOTE:</strong> New users are strongly encouraged to use
+ * {@link icu::number::NumberFormatter} instead of NumberFormat.
* @stable ICU 2.0
*/
static NumberFormat* U_EXPORT2 createCurrencyInstance(UErrorCode&);
/**
* Returns a currency format for the specified locale.
- * <p>
- * <strong>NOTE:</strong> New users are strongly encouraged to use
- * {@link icu::number::NumberFormatter} instead of NumberFormat.
+ * <p>
+ * <strong>NOTE:</strong> New users are strongly encouraged to use
+ * {@link icu::number::NumberFormatter} instead of NumberFormat.
* @param inLocale the given locale.
* @stable ICU 2.0
*/
@@ -803,18 +803,18 @@ public:
/**
* Returns a percentage format for the current default locale.
- * <p>
- * <strong>NOTE:</strong> New users are strongly encouraged to use
- * {@link icu::number::NumberFormatter} instead of NumberFormat.
+ * <p>
+ * <strong>NOTE:</strong> New users are strongly encouraged to use
+ * {@link icu::number::NumberFormatter} instead of NumberFormat.
* @stable ICU 2.0
*/
static NumberFormat* U_EXPORT2 createPercentInstance(UErrorCode&);
/**
* Returns a percentage format for the specified locale.
- * <p>
- * <strong>NOTE:</strong> New users are strongly encouraged to use
- * {@link icu::number::NumberFormatter} instead of NumberFormat.
+ * <p>
+ * <strong>NOTE:</strong> New users are strongly encouraged to use
+ * {@link icu::number::NumberFormatter} instead of NumberFormat.
* @param inLocale the given locale.
* @stable ICU 2.0
*/
@@ -823,18 +823,18 @@ public:
/**
* Returns a scientific format for the current default locale.
- * <p>
- * <strong>NOTE:</strong> New users are strongly encouraged to use
- * {@link icu::number::NumberFormatter} instead of NumberFormat.
+ * <p>
+ * <strong>NOTE:</strong> New users are strongly encouraged to use
+ * {@link icu::number::NumberFormatter} instead of NumberFormat.
* @stable ICU 2.0
*/
static NumberFormat* U_EXPORT2 createScientificInstance(UErrorCode&);
/**
* Returns a scientific format for the specified locale.
- * <p>
- * <strong>NOTE:</strong> New users are strongly encouraged to use
- * {@link icu::number::NumberFormatter} instead of NumberFormat.
+ * <p>
+ * <strong>NOTE:</strong> New users are strongly encouraged to use
+ * {@link icu::number::NumberFormatter} instead of NumberFormat.
* @param inLocale the given locale.
* @stable ICU 2.0
*/
@@ -888,7 +888,7 @@ public:
* Returns true if grouping is used in this format. For example,
* in the English locale, with grouping on, the number 1234567
* might be formatted as "1,234,567". The grouping separator as
- * well as the size of each group is locale dependent and is
+ * well as the size of each group is locale dependent and is
* determined by sub-classes of NumberFormat.
* @see setGroupingUsed
* @stable ICU 2.0
@@ -1005,7 +1005,7 @@ public:
* @param ec input-output error code
* @stable ICU 3.0
*/
- virtual void setCurrency(const char16_t* theCurrency, UErrorCode& ec);
+ virtual void setCurrency(const char16_t* theCurrency, UErrorCode& ec);
/**
* Gets the currency used to display currency
@@ -1014,8 +1014,8 @@ public:
* the currency in use, or a pointer to the empty string.
* @stable ICU 2.6
*/
- const char16_t* getCurrency() const;
-
+ const char16_t* getCurrency() const;
+
/**
* Set a particular UDisplayContext value in the formatter, such as
* UDISPCTX_CAPITALIZATION_FOR_STANDALONE.
@@ -1039,21 +1039,21 @@ public:
*/
virtual UDisplayContext getContext(UDisplayContextType type, UErrorCode& status) const;
- /**
- * Get the rounding mode. This will always return NumberFormat::ERoundingMode::kRoundUnnecessary
- * if the subclass does not support rounding.
- * @return A rounding mode
- * @stable ICU 60
- */
- virtual ERoundingMode getRoundingMode(void) const;
-
- /**
- * Set the rounding mode. If a subclass does not support rounding, this will do nothing.
- * @param roundingMode A rounding mode
- * @stable ICU 60
- */
- virtual void setRoundingMode(ERoundingMode roundingMode);
-
+ /**
+ * Get the rounding mode. This will always return NumberFormat::ERoundingMode::kRoundUnnecessary
+ * if the subclass does not support rounding.
+ * @return A rounding mode
+ * @stable ICU 60
+ */
+ virtual ERoundingMode getRoundingMode(void) const;
+
+ /**
+ * Set the rounding mode. If a subclass does not support rounding, this will do nothing.
+ * @param roundingMode A rounding mode
+ * @stable ICU 60
+ */
+ virtual void setRoundingMode(ERoundingMode roundingMode);
+
public:
/**
@@ -1107,7 +1107,7 @@ protected:
* have a capacity of at least 4
* @internal
*/
- virtual void getEffectiveCurrency(char16_t* result, UErrorCode& ec) const;
+ virtual void getEffectiveCurrency(char16_t* result, UErrorCode& ec) const;
#ifndef U_HIDE_INTERNAL_API
/**
@@ -1154,7 +1154,7 @@ private:
UBool fLenient; // TRUE => lenient parse is enabled
// ISO currency code
- char16_t fCurrency[4];
+ char16_t fCurrency[4];
UDisplayContext fCapitalizationContext;
@@ -1265,7 +1265,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _NUMFMT
//eof
diff --git a/contrib/libs/icu/include/unicode/numsys.h b/contrib/libs/icu/include/unicode/numsys.h
index 1eaf7a1429..7def7032e1 100644
--- a/contrib/libs/icu/include/unicode/numsys.h
+++ b/contrib/libs/icu/include/unicode/numsys.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -20,7 +20,7 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
+#if U_SHOW_CPLUSPLUS_API
/**
* \file
@@ -34,14 +34,14 @@
U_NAMESPACE_BEGIN
-// can't be #ifndef U_HIDE_INTERNAL_API; needed for char[] field size
+// can't be #ifndef U_HIDE_INTERNAL_API; needed for char[] field size
+/**
+ * Size of a numbering system name.
+ * @internal
+ */
+constexpr const size_t kInternalNumSysNameCapacity = 8;
+
/**
- * Size of a numbering system name.
- * @internal
- */
-constexpr const size_t kInternalNumSysNameCapacity = 8;
-
-/**
* Defines numbering systems. A numbering system describes the scheme by which
* numbers are to be presented to the end user. In its simplest form, a numbering
* system describes the set of digit characters that are to be used to display
@@ -74,12 +74,12 @@ public:
NumberingSystem(const NumberingSystem& other);
/**
- * Copy assignment.
- * @stable ICU 4.2
- */
- NumberingSystem& operator=(const NumberingSystem& other) = default;
-
- /**
+ * Copy assignment.
+ * @stable ICU 4.2
+ */
+ NumberingSystem& operator=(const NumberingSystem& other) = default;
+
+ /**
* Destructor.
* @stable ICU 4.2
*/
@@ -112,11 +112,11 @@ public:
/**
* Return a StringEnumeration over all the names of numbering systems known to ICU.
- * The numbering system names will be in alphabetical (invariant) order.
- *
- * The returned StringEnumeration is owned by the caller, who must delete it when
- * finished with it.
- *
+ * The numbering system names will be in alphabetical (invariant) order.
+ *
+ * The returned StringEnumeration is owned by the caller, who must delete it when
+ * finished with it.
+ *
* @stable ICU 4.2
*/
static StringEnumeration * U_EXPORT2 getAvailableNames(UErrorCode& status);
@@ -129,10 +129,10 @@ public:
* default, native, traditional, finance - do not identify specific numbering systems,
* but rather key values that may only be used as part of a locale, which in turn
* defines how they are mapped to a specific numbering system such as "latn" or "hant".
- *
+ *
* @param name The name of the numbering system.
- * @param status ICU status; set to U_UNSUPPORTED_ERROR if numbering system not found.
- * @return The NumberingSystem instance, or nullptr if not found.
+ * @param status ICU status; set to U_UNSUPPORTED_ERROR if numbering system not found.
+ * @return The NumberingSystem instance, or nullptr if not found.
* @stable ICU 4.2
*/
static NumberingSystem* U_EXPORT2 createInstanceByName(const char* name, UErrorCode& status);
@@ -199,13 +199,13 @@ private:
UnicodeString desc;
int32_t radix;
UBool algorithmic;
- char name[kInternalNumSysNameCapacity+1];
+ char name[kInternalNumSysNameCapacity+1];
void setRadix(int32_t radix);
void setAlgorithmic(UBool algorithmic);
- void setDesc(const UnicodeString &desc);
+ void setDesc(const UnicodeString &desc);
void setName(const char* name);
@@ -218,7 +218,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _NUMSYS
//eof
diff --git a/contrib/libs/icu/include/unicode/parseerr.h b/contrib/libs/icu/include/unicode/parseerr.h
index cca8872da6..c23cc273b8 100644
--- a/contrib/libs/icu/include/unicode/parseerr.h
+++ b/contrib/libs/icu/include/unicode/parseerr.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -58,9 +58,9 @@ enum { U_PARSE_CONTEXT_LEN = 16 };
typedef struct UParseError {
/**
- * The line on which the error occurred. If the parser uses this
+ * The line on which the error occurred. If the parser uses this
* field, it sets it to the line number of the source text line on
- * which the error appears, which will be a value >= 1. If the
+ * which the error appears, which will be a value >= 1. If the
* parse does not support line numbers, the value will be <= 0.
* @stable ICU 2.0
*/
diff --git a/contrib/libs/icu/include/unicode/parsepos.h b/contrib/libs/icu/include/unicode/parsepos.h
index cbb9a9a3f4..909d288d48 100644
--- a/contrib/libs/icu/include/unicode/parsepos.h
+++ b/contrib/libs/icu/include/unicode/parsepos.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
* Copyright (C) 1997-2005, International Business Machines Corporation and others. All Rights Reserved.
@@ -19,9 +19,9 @@
#define PARSEPOS_H
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
@@ -93,21 +93,21 @@ public:
* Assignment operator
* @stable ICU 2.0
*/
- inline ParsePosition& operator=(const ParsePosition& copy);
+ inline ParsePosition& operator=(const ParsePosition& copy);
/**
* Equality operator.
* @return TRUE if the two parse positions are equal, FALSE otherwise.
* @stable ICU 2.0
*/
- inline UBool operator==(const ParsePosition& that) const;
+ inline UBool operator==(const ParsePosition& that) const;
/**
* Equality operator.
* @return TRUE if the two parse positions are not equal, FALSE otherwise.
* @stable ICU 2.0
*/
- inline UBool operator!=(const ParsePosition& that) const;
+ inline UBool operator!=(const ParsePosition& that) const;
/**
* Clone this object.
@@ -129,14 +129,14 @@ public:
* @return the current index.
* @stable ICU 2.0
*/
- inline int32_t getIndex(void) const;
+ inline int32_t getIndex(void) const;
/**
* Set the current parse position.
* @param index the new index.
* @stable ICU 2.0
*/
- inline void setIndex(int32_t index);
+ inline void setIndex(int32_t index);
/**
* Set the index at which a parse error occurred. Formatters
@@ -145,14 +145,14 @@ public:
* set.
* @stable ICU 2.0
*/
- inline void setErrorIndex(int32_t ei);
+ inline void setErrorIndex(int32_t ei);
/**
* Retrieve the index at which an error occurred, or -1 if the
* error index has not been set.
* @stable ICU 2.0
*/
- inline int32_t getErrorIndex(void) const;
+ inline int32_t getErrorIndex(void) const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
@@ -232,6 +232,6 @@ ParsePosition::setErrorIndex(int32_t ei)
}
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/platform.h b/contrib/libs/icu/include/unicode/platform.h
index 2bc9706707..2bb2f8b318 100644
--- a/contrib/libs/icu/include/unicode/platform.h
+++ b/contrib/libs/icu/include/unicode/platform.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -38,7 +38,7 @@
* and/or from other macros that are predefined by the compiler
* or defined in standard (POSIX or platform or compiler) headers.
*
- * As a temporary workaround, you can add an explicit \#define for some macros
+ * As a temporary workaround, you can add an explicit \#define for some macros
* before it is first tested, or add an equivalent -D macro definition
* to the compiler's command line.
*
@@ -132,17 +132,17 @@
#define U_PF_BROWSER_NATIVE_CLIENT 4020
/** Android is based on Linux. @internal */
#define U_PF_ANDROID 4050
-/** Fuchsia is a POSIX-ish platform. @internal */
-#define U_PF_FUCHSIA 4100
+/** Fuchsia is a POSIX-ish platform. @internal */
+#define U_PF_FUCHSIA 4100
/* Maximum value for Linux-based platform is 4499 */
-/**
- * Emscripten is a C++ transpiler for the Web that can target asm.js or
- * WebAssembly. It provides some POSIX-compatible wrappers and stubs and
- * some Linux-like functionality, but is not fully compatible with
- * either.
- * @internal
- */
-#define U_PF_EMSCRIPTEN 5010
+/**
+ * Emscripten is a C++ transpiler for the Web that can target asm.js or
+ * WebAssembly. It provides some POSIX-compatible wrappers and stubs and
+ * some Linux-like functionality, but is not fully compatible with
+ * either.
+ * @internal
+ */
+#define U_PF_EMSCRIPTEN 5010
/** z/OS is the successor to OS/390 which was the successor to MVS. @internal */
#define U_PF_OS390 9000
/** "IBM i" is the current name of what used to be i5/OS and earlier OS/400. @internal */
@@ -160,10 +160,10 @@
# define U_PLATFORM U_PF_ANDROID
/* Android wchar_t support depends on the API level. */
# include <android/api-level.h>
-#elif defined(__pnacl__) || defined(__native_client__)
+#elif defined(__pnacl__) || defined(__native_client__)
# define U_PLATFORM U_PF_BROWSER_NATIVE_CLIENT
-#elif defined(__Fuchsia__)
-# define U_PLATFORM U_PF_FUCHSIA
+#elif defined(__Fuchsia__)
+# define U_PLATFORM U_PF_FUCHSIA
#elif defined(linux) || defined(__linux__) || defined(__linux)
# define U_PLATFORM U_PF_LINUX
#elif defined(__APPLE__) && defined(__MACH__)
@@ -200,8 +200,8 @@
# define U_PLATFORM U_PF_OS390
#elif defined(__OS400__) || defined(__TOS_OS400__)
# define U_PLATFORM U_PF_OS400
-#elif defined(__EMSCRIPTEN__)
-# define U_PLATFORM U_PF_EMSCRIPTEN
+#elif defined(__EMSCRIPTEN__)
+# define U_PLATFORM U_PF_EMSCRIPTEN
#else
# define U_PLATFORM U_PF_UNKNOWN
#endif
@@ -217,9 +217,9 @@
# define CYGWINMSVC
#endif
*/
-#ifdef U_IN_DOXYGEN
-# define CYGWINMSVC
-#endif
+#ifdef U_IN_DOXYGEN
+# define CYGWINMSVC
+#endif
/**
* \def U_PLATFORM_USES_ONLY_WIN32_API
@@ -251,18 +251,18 @@
#endif
/**
- * \def U_PLATFORM_HAS_WINUWP_API
- * Defines whether target is intended for Universal Windows Platform API
- * Set to 1 for Windows10 Release Solution Configuration
- * @internal
- */
-#ifdef U_PLATFORM_HAS_WINUWP_API
- /* Use the predefined value. */
-#else
-# define U_PLATFORM_HAS_WINUWP_API 0
-#endif
-
-/**
+ * \def U_PLATFORM_HAS_WINUWP_API
+ * Defines whether target is intended for Universal Windows Platform API
+ * Set to 1 for Windows10 Release Solution Configuration
+ * @internal
+ */
+#ifdef U_PLATFORM_HAS_WINUWP_API
+ /* Use the predefined value. */
+#else
+# define U_PLATFORM_HAS_WINUWP_API 0
+#endif
+
+/**
* \def U_PLATFORM_IMPLEMENTS_POSIX
* Defines whether the platform implements (most of) the POSIX API.
* Set to 1 for Cygwin and most other platforms.
@@ -423,42 +423,42 @@
# define U_HAVE_DEBUG_LOCATION_NEW 0
#endif
-/* Compatibility with compilers other than clang: http://clang.llvm.org/docs/LanguageExtensions.html */
-#ifdef __has_attribute
-# define UPRV_HAS_ATTRIBUTE(x) __has_attribute(x)
-#else
-# define UPRV_HAS_ATTRIBUTE(x) 0
+/* Compatibility with compilers other than clang: http://clang.llvm.org/docs/LanguageExtensions.html */
+#ifdef __has_attribute
+# define UPRV_HAS_ATTRIBUTE(x) __has_attribute(x)
+#else
+# define UPRV_HAS_ATTRIBUTE(x) 0
#endif
-#ifdef __has_cpp_attribute
-# define UPRV_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
-#else
-# define UPRV_HAS_CPP_ATTRIBUTE(x) 0
+#ifdef __has_cpp_attribute
+# define UPRV_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
+#else
+# define UPRV_HAS_CPP_ATTRIBUTE(x) 0
#endif
-#ifdef __has_declspec_attribute
-# define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) __has_declspec_attribute(x)
-#else
-# define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) 0
+#ifdef __has_declspec_attribute
+# define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) __has_declspec_attribute(x)
+#else
+# define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) 0
#endif
-#ifdef __has_builtin
-# define UPRV_HAS_BUILTIN(x) __has_builtin(x)
-#else
-# define UPRV_HAS_BUILTIN(x) 0
+#ifdef __has_builtin
+# define UPRV_HAS_BUILTIN(x) __has_builtin(x)
+#else
+# define UPRV_HAS_BUILTIN(x) 0
+#endif
+#ifdef __has_feature
+# define UPRV_HAS_FEATURE(x) __has_feature(x)
+#else
+# define UPRV_HAS_FEATURE(x) 0
#endif
-#ifdef __has_feature
-# define UPRV_HAS_FEATURE(x) __has_feature(x)
-#else
-# define UPRV_HAS_FEATURE(x) 0
+#ifdef __has_extension
+# define UPRV_HAS_EXTENSION(x) __has_extension(x)
+#else
+# define UPRV_HAS_EXTENSION(x) 0
#endif
-#ifdef __has_extension
-# define UPRV_HAS_EXTENSION(x) __has_extension(x)
-#else
-# define UPRV_HAS_EXTENSION(x) 0
+#ifdef __has_warning
+# define UPRV_HAS_WARNING(x) __has_warning(x)
+#else
+# define UPRV_HAS_WARNING(x) 0
#endif
-#ifdef __has_warning
-# define UPRV_HAS_WARNING(x) __has_warning(x)
-#else
-# define UPRV_HAS_WARNING(x) 0
-#endif
/**
* \def U_MALLOC_ATTR
@@ -476,9 +476,9 @@
* Attribute to specify the size of the allocated buffer for malloc-like functions
* @internal
*/
-#if (defined(__GNUC__) && \
- (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || \
- UPRV_HAS_ATTRIBUTE(alloc_size)
+#if (defined(__GNUC__) && \
+ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || \
+ UPRV_HAS_ATTRIBUTE(alloc_size)
# define U_ALLOC_SIZE_ATTR(X) __attribute__ ((alloc_size(X)))
# define U_ALLOC_SIZE_ATTR2(X,Y) __attribute__ ((alloc_size(X,Y)))
#else
@@ -500,20 +500,20 @@
/* Otherwise use the predefined value. */
#elif !defined(__cplusplus)
# define U_CPLUSPLUS_VERSION 0
-#elif __cplusplus >= 201402L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
+#elif __cplusplus >= 201402L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
# define U_CPLUSPLUS_VERSION 14
-#elif __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L)
+#elif __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L)
# define U_CPLUSPLUS_VERSION 11
#else
// C++98 or C++03
# define U_CPLUSPLUS_VERSION 1
#endif
-#if (U_PLATFORM == U_PF_AIX || U_PLATFORM == U_PF_OS390) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11)
-// add in std::nullptr_t
-namespace std {
- typedef decltype(nullptr) nullptr_t;
-};
+#if (U_PLATFORM == U_PF_AIX || U_PLATFORM == U_PF_OS390) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11)
+// add in std::nullptr_t
+namespace std {
+ typedef decltype(nullptr) nullptr_t;
+};
#endif
/**
@@ -525,7 +525,7 @@ namespace std {
*/
#ifdef U_NOEXCEPT
/* Use the predefined value. */
-#else
+#else
# define U_NOEXCEPT noexcept
#endif
@@ -535,23 +535,23 @@ namespace std {
* http://clang.llvm.org/docs/AttributeReference.html#fallthrough-clang-fallthrough
* @internal
*/
-#ifndef __cplusplus
- // Not for C.
-#elif defined(U_FALLTHROUGH)
- // Use the predefined value.
-#elif defined(__clang__)
- // Test for compiler vs. feature separately.
- // Other compilers might choke on the feature test.
-# if UPRV_HAS_CPP_ATTRIBUTE(clang::fallthrough) || \
- (UPRV_HAS_FEATURE(cxx_attributes) && \
- UPRV_HAS_WARNING("-Wimplicit-fallthrough"))
+#ifndef __cplusplus
+ // Not for C.
+#elif defined(U_FALLTHROUGH)
+ // Use the predefined value.
+#elif defined(__clang__)
+ // Test for compiler vs. feature separately.
+ // Other compilers might choke on the feature test.
+# if UPRV_HAS_CPP_ATTRIBUTE(clang::fallthrough) || \
+ (UPRV_HAS_FEATURE(cxx_attributes) && \
+ UPRV_HAS_WARNING("-Wimplicit-fallthrough"))
# define U_FALLTHROUGH [[clang::fallthrough]]
# endif
-#elif defined(__GNUC__) && (__GNUC__ >= 7)
-# define U_FALLTHROUGH __attribute__((fallthrough))
-#endif
-
-#ifndef U_FALLTHROUGH
+#elif defined(__GNUC__) && (__GNUC__ >= 7)
+# define U_FALLTHROUGH __attribute__((fallthrough))
+#endif
+
+#ifndef U_FALLTHROUGH
# define U_FALLTHROUGH
#endif
@@ -647,8 +647,8 @@ namespace std {
*/
#ifdef U_CHARSET_IS_UTF8
/* Use the predefined value. */
-#elif U_PLATFORM_IS_LINUX_BASED || U_PLATFORM_IS_DARWIN_BASED || \
- U_PLATFORM == U_PF_EMSCRIPTEN
+#elif U_PLATFORM_IS_LINUX_BASED || U_PLATFORM_IS_DARWIN_BASED || \
+ U_PLATFORM == U_PF_EMSCRIPTEN
# define U_CHARSET_IS_UTF8 1
#else
# define U_CHARSET_IS_UTF8 0
@@ -735,7 +735,7 @@ namespace std {
* narrow-character strings are in EBCDIC.
*/
# define U_SIZEOF_WCHAR_T 2
-# else
+# else
/*
* LOCALETYPE(*CLD) or LOCALETYPE(*LOCALE) is specified.
* Wide-character strings are in 16-bit EBCDIC,
@@ -766,14 +766,14 @@ namespace std {
#else
/*
* Notes:
- * Visual Studio 2010 (_MSC_VER==1600) defines char16_t as a typedef
- * and does not support u"abc" string literals.
- * Visual Studio 2015 (_MSC_VER>=1900) and above adds support for
- * both char16_t and u"abc" string literals.
+ * Visual Studio 2010 (_MSC_VER==1600) defines char16_t as a typedef
+ * and does not support u"abc" string literals.
+ * Visual Studio 2015 (_MSC_VER>=1900) and above adds support for
+ * both char16_t and u"abc" string literals.
* gcc 4.4 defines the __CHAR16_TYPE__ macro to a usable type but
* does not support u"abc" string literals.
* C++11 and C11 require support for UTF-16 literals
- * TODO: Fix for plain C. Doesn't work on Mac.
+ * TODO: Fix for plain C. Doesn't work on Mac.
*/
# if U_CPLUSPLUS_VERSION >= 11 || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
# define U_HAVE_CHAR16_T 1
@@ -794,8 +794,8 @@ namespace std {
#elif U_HAVE_CHAR16_T \
|| (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \
|| (defined(__HP_aCC) && __HP_aCC >= 035000) \
- || (defined(__HP_cc) && __HP_cc >= 111106) \
- || (defined(U_IN_DOXYGEN))
+ || (defined(__HP_cc) && __HP_cc >= 111106) \
+ || (defined(U_IN_DOXYGEN))
# define U_DECLARE_UTF16(string) u ## string
#elif U_SIZEOF_WCHAR_T == 2 \
&& (U_CHARSET_FAMILY == 0 || (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400 && defined(__UCS2__)))
@@ -814,9 +814,9 @@ namespace std {
/* Use the predefined value. */
#elif defined(U_STATIC_IMPLEMENTATION)
# define U_EXPORT
-#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(dllexport) && \
- UPRV_HAS_DECLSPEC_ATTRIBUTE(dllimport))
-# define U_EXPORT __declspec(dllexport)
+#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(dllexport) && \
+ UPRV_HAS_DECLSPEC_ATTRIBUTE(dllimport))
+# define U_EXPORT __declspec(dllexport)
#elif defined(__GNUC__)
# define U_EXPORT __attribute__((visibility("default")))
#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \
@@ -828,7 +828,7 @@ namespace std {
# define U_EXPORT
#endif
-/* U_CALLCONV is related to U_EXPORT2 */
+/* U_CALLCONV is related to U_EXPORT2 */
#ifdef U_EXPORT2
/* Use the predefined value. */
#elif defined(_MSC_VER)
@@ -839,8 +839,8 @@ namespace std {
#ifdef U_IMPORT
/* Use the predefined value. */
-#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(dllexport) && \
- UPRV_HAS_DECLSPEC_ATTRIBUTE(dllimport))
+#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(dllexport) && \
+ UPRV_HAS_DECLSPEC_ATTRIBUTE(dllimport))
/* Windows needs to export/import data. */
# define U_IMPORT __declspec(dllimport)
#else
@@ -870,16 +870,16 @@ namespace std {
# define U_CALLCONV U_EXPORT2
#endif
-/**
- * \def U_CALLCONV_FPTR
- * Similar to U_CALLCONV, but only used on function pointers.
- * @internal
- */
-#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus)
-# define U_CALLCONV_FPTR U_CALLCONV
-#else
-# define U_CALLCONV_FPTR
-#endif
+/**
+ * \def U_CALLCONV_FPTR
+ * Similar to U_CALLCONV, but only used on function pointers.
+ * @internal
+ */
+#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus)
+# define U_CALLCONV_FPTR U_CALLCONV
+#else
+# define U_CALLCONV_FPTR
+#endif
/* @} */
-#endif // _PLATFORM_H
+#endif // _PLATFORM_H
diff --git a/contrib/libs/icu/include/unicode/plurfmt.h b/contrib/libs/icu/include/unicode/plurfmt.h
index b1cf49a67f..2c2116586f 100644
--- a/contrib/libs/icu/include/unicode/plurfmt.h
+++ b/contrib/libs/icu/include/unicode/plurfmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -16,8 +16,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: PluralFormat object
@@ -450,7 +450,7 @@ public:
* result and should delete it when done.
* @stable ICU 4.0
*/
- virtual PluralFormat* clone() const;
+ virtual PluralFormat* clone() const;
/**
* Formats a plural message for a number taken from a Formattable object.
@@ -524,7 +524,7 @@ public:
private:
/**
- * @internal (private)
+ * @internal (private)
*/
class U_I18N_API PluralSelector : public UMemory {
public:
@@ -536,7 +536,7 @@ private:
* @param number The number to be plural-formatted.
* @param ec Error code.
* @return The selected PluralFormat keyword.
- * @internal (private)
+ * @internal (private)
*/
virtual UnicodeString select(void *context, double number, UErrorCode& ec) const = 0;
};
@@ -548,7 +548,7 @@ private:
virtual ~PluralSelectorAdapter();
- virtual UnicodeString select(void *context, double number, UErrorCode& /*ec*/) const;
+ virtual UnicodeString select(void *context, double number, UErrorCode& /*ec*/) const;
void reset();
@@ -572,7 +572,7 @@ private:
UnicodeString& format(const Formattable& numberObject, double number,
UnicodeString& appendTo,
FieldPosition& pos,
- UErrorCode& status) const;
+ UErrorCode& status) const;
/**
* Finds the PluralFormat sub-message for the given number, or the "other" sub-message.
@@ -600,7 +600,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _PLURFMT
//eof
diff --git a/contrib/libs/icu/include/unicode/plurrule.h b/contrib/libs/icu/include/unicode/plurrule.h
index 6b1f74a112..408efbcc4a 100644
--- a/contrib/libs/icu/include/unicode/plurrule.h
+++ b/contrib/libs/icu/include/unicode/plurrule.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -20,8 +20,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: PluralRules object
@@ -31,9 +31,9 @@
#include "unicode/format.h"
#include "unicode/upluralrules.h"
-#ifndef U_HIDE_INTERNAL_API
-#include "unicode/numfmt.h"
-#endif /* U_HIDE_INTERNAL_API */
+#ifndef U_HIDE_INTERNAL_API
+#include "unicode/numfmt.h"
+#endif /* U_HIDE_INTERNAL_API */
/**
* Value returned by PluralRules::getUniqueKeywordValue() when there is no
@@ -45,17 +45,17 @@
U_NAMESPACE_BEGIN
class Hashtable;
-class IFixedDecimal;
+class IFixedDecimal;
class RuleChain;
class PluralRuleParser;
class PluralKeywordEnumeration;
class AndConstraint;
class SharedPluralRules;
-namespace number {
-class FormattedNumber;
-}
-
+namespace number {
+class FormattedNumber;
+}
+
/**
* Defines rules for mapping non-negative numeric values onto a small set of
* keywords. Rules are constructed from a text description, consisting
@@ -329,9 +329,9 @@ public:
#endif /* U_HIDE_INTERNAL_API */
/**
- * Given an integer, returns the keyword of the first rule
- * that applies to the number. This function can be used with
- * isKeyword* functions to determine the keyword for default plural rules.
+ * Given an integer, returns the keyword of the first rule
+ * that applies to the number. This function can be used with
+ * isKeyword* functions to determine the keyword for default plural rules.
*
* @param number The number for which the rule has to be determined.
* @return The keyword of the selected rule.
@@ -340,9 +340,9 @@ public:
UnicodeString select(int32_t number) const;
/**
- * Given a floating-point number, returns the keyword of the first rule
- * that applies to the number. This function can be used with
- * isKeyword* functions to determine the keyword for default plural rules.
+ * Given a floating-point number, returns the keyword of the first rule
+ * that applies to the number. This function can be used with
+ * isKeyword* functions to determine the keyword for default plural rules.
*
* @param number The number for which the rule has to be determined.
* @return The keyword of the selected rule.
@@ -350,28 +350,28 @@ public:
*/
UnicodeString select(double number) const;
- /**
- * Given a formatted number, returns the keyword of the first rule
- * that applies to the number. This function can be used with
- * isKeyword* functions to determine the keyword for default plural rules.
- *
- * A FormattedNumber allows you to specify an exponent or trailing zeros,
- * which can affect the plural category. To get a FormattedNumber, see
- * NumberFormatter.
- *
- * @param number The number for which the rule has to be determined.
- * @param status Set if an error occurs while selecting plural keyword.
- * This could happen if the FormattedNumber is invalid.
- * @return The keyword of the selected rule.
- * @stable ICU 64
- */
- UnicodeString select(const number::FormattedNumber& number, UErrorCode& status) const;
-
+ /**
+ * Given a formatted number, returns the keyword of the first rule
+ * that applies to the number. This function can be used with
+ * isKeyword* functions to determine the keyword for default plural rules.
+ *
+ * A FormattedNumber allows you to specify an exponent or trailing zeros,
+ * which can affect the plural category. To get a FormattedNumber, see
+ * NumberFormatter.
+ *
+ * @param number The number for which the rule has to be determined.
+ * @param status Set if an error occurs while selecting plural keyword.
+ * This could happen if the FormattedNumber is invalid.
+ * @return The keyword of the selected rule.
+ * @stable ICU 64
+ */
+ UnicodeString select(const number::FormattedNumber& number, UErrorCode& status) const;
+
#ifndef U_HIDE_INTERNAL_API
/**
* @internal
*/
- UnicodeString select(const IFixedDecimal &number) const;
+ UnicodeString select(const IFixedDecimal &number) const;
#endif /* U_HIDE_INTERNAL_API */
/**
@@ -402,7 +402,7 @@ public:
/**
* Deprecated Function, does not produce useful results.
*
- * Originally intended to return all the values for which select() would return the keyword.
+ * Originally intended to return all the values for which select() would return the keyword.
* If the keyword is unknown, returns no values, but this is not an error. If
* the number of values is unlimited, returns no values and -1 as the
* count.
@@ -520,12 +520,12 @@ private:
UnicodeString getRuleFromResource(const Locale& locale, UPluralType type, UErrorCode& status);
RuleChain *rulesForKeyword(const UnicodeString &keyword) const;
- /**
- * An internal status variable used to indicate that the object is in an 'invalid' state.
- * Used by copy constructor, the assignment operator and the clone method.
- */
- UErrorCode mInternalStatus;
-
+ /**
+ * An internal status variable used to indicate that the object is in an 'invalid' state.
+ * Used by copy constructor, the assignment operator and the clone method.
+ */
+ UErrorCode mInternalStatus;
+
friend class PluralRuleParser;
};
@@ -533,7 +533,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _PLURRULE
//eof
diff --git a/contrib/libs/icu/include/unicode/ptypes.h b/contrib/libs/icu/include/unicode/ptypes.h
index 2c5e9351ec..70324ffee3 100644
--- a/contrib/libs/icu/include/unicode/ptypes.h
+++ b/contrib/libs/icu/include/unicode/ptypes.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -83,7 +83,7 @@ typedef unsigned char uint8_t;
#else /* neither U_HAVE_STDINT_H nor U_HAVE_INTTYPES_H */
-/// \cond
+/// \cond
#if ! U_HAVE_INT8_T
typedef signed char int8_t;
#endif
@@ -123,7 +123,7 @@ typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
#endif
#endif
-/// \endcond
+/// \endcond
#endif /* U_HAVE_STDINT_H / U_HAVE_INTTYPES_H */
diff --git a/contrib/libs/icu/include/unicode/putil.h b/contrib/libs/icu/include/unicode/putil.h
index 10416ecdcb..759b136c13 100644
--- a/contrib/libs/icu/include/unicode/putil.h
+++ b/contrib/libs/icu/include/unicode/putil.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -38,7 +38,7 @@
/**
* Platform utilities isolates the platform dependencies of the
- * library. For each platform which this code is ported to, these
+ * library. For each platform which this code is ported to, these
* functions may have to be re-implemented.
*/
@@ -53,7 +53,7 @@
* The data directory is determined as follows:
* If u_setDataDirectory() has been called, that is it, otherwise
* if the ICU_DATA environment variable is set, use that, otherwise
- * If a data directory was specified at ICU build time
+ * If a data directory was specified at ICU build time
* <code>
* \code
* #define ICU_DATA_DIR "path"
@@ -93,7 +93,7 @@ U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory);
#ifndef U_HIDE_INTERNAL_API
/**
* Return the time zone files override directory, or an empty string if
- * no directory was specified. Certain time zone resources will be preferentially
+ * no directory was specified. Certain time zone resources will be preferentially
* loaded from individual files in this directory.
*
* @return the time zone data override directory.
diff --git a/contrib/libs/icu/include/unicode/rbbi.h b/contrib/libs/icu/include/unicode/rbbi.h
index e35b98f9a0..7825f603a5 100644
--- a/contrib/libs/icu/include/unicode/rbbi.h
+++ b/contrib/libs/icu/include/unicode/rbbi.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
***************************************************************************
@@ -18,8 +18,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: Rule Based Break Iterator
@@ -35,10 +35,10 @@
U_NAMESPACE_BEGIN
/** @internal */
-class LanguageBreakEngine;
+class LanguageBreakEngine;
struct RBBIDataHeader;
class RBBIDataWrapper;
-class UnhandledEngine;
+class UnhandledEngine;
class UStack;
/**
@@ -57,51 +57,51 @@ class U_COMMON_API RuleBasedBreakIterator /*U_FINAL*/ : public BreakIterator {
private:
/**
* The UText through which this BreakIterator accesses the text
- * @internal (private)
+ * @internal (private)
*/
- UText fText;
+ UText fText;
-#ifndef U_HIDE_INTERNAL_API
-public:
-#endif /* U_HIDE_INTERNAL_API */
+#ifndef U_HIDE_INTERNAL_API
+public:
+#endif /* U_HIDE_INTERNAL_API */
/**
- * The rule data for this BreakIterator instance.
- * Not for general use; Public only for testing purposes.
+ * The rule data for this BreakIterator instance.
+ * Not for general use; Public only for testing purposes.
* @internal
*/
RBBIDataWrapper *fData;
-private:
+private:
/**
- * The current position of the iterator. Pinned, 0 < fPosition <= text.length.
- * Never has the value UBRK_DONE (-1).
- */
- int32_t fPosition;
+ * The current position of the iterator. Pinned, 0 < fPosition <= text.length.
+ * Never has the value UBRK_DONE (-1).
+ */
+ int32_t fPosition;
/**
- * TODO:
- */
- int32_t fRuleStatusIndex;
+ * TODO:
+ */
+ int32_t fRuleStatusIndex;
/**
- * Cache of previously determined boundary positions.
+ * Cache of previously determined boundary positions.
*/
- class BreakCache;
- BreakCache *fBreakCache;
+ class BreakCache;
+ BreakCache *fBreakCache;
/**
- * Cache of boundary positions within a region of text that has been
- * sub-divided by dictionary based breaking.
+ * Cache of boundary positions within a region of text that has been
+ * sub-divided by dictionary based breaking.
*/
- class DictionaryCache;
- DictionaryCache *fDictionaryCache;
+ class DictionaryCache;
+ DictionaryCache *fDictionaryCache;
/**
*
* If present, UStack of LanguageBreakEngine objects that might handle
* dictionary characters. Searched from top to bottom to find an object to
* handle a given character.
- * @internal (private)
+ * @internal (private)
*/
UStack *fLanguageBreakEngines;
@@ -109,37 +109,37 @@ private:
*
* If present, the special LanguageBreakEngine used for handling
* characters that are in the dictionary set, but not handled by any
- * LanguageBreakEngine.
- * @internal (private)
+ * LanguageBreakEngine.
+ * @internal (private)
*/
UnhandledEngine *fUnhandledBreakEngine;
/**
- * Counter for the number of characters encountered with the "dictionary"
- * flag set.
- * @internal (private)
- */
- uint32_t fDictionaryCharCount;
-
- /**
- * A character iterator that refers to the same text as the UText, above.
- * Only included for compatibility with old API, which was based on CharacterIterators.
- * Value may be adopted from outside, or one of fSCharIter or fDCharIter, below.
- */
- CharacterIterator *fCharIter;
-
- /**
- * When the input text is provided by a UnicodeString, this will point to
- * a characterIterator that wraps that data. Needed only for the
- * implementation of getText(), a backwards compatibility issue.
- */
- StringCharacterIterator fSCharIter;
-
- /**
- * True when iteration has run off the end, and iterator functions should return UBRK_DONE.
- */
- UBool fDone;
-
+ * Counter for the number of characters encountered with the "dictionary"
+ * flag set.
+ * @internal (private)
+ */
+ uint32_t fDictionaryCharCount;
+
+ /**
+ * A character iterator that refers to the same text as the UText, above.
+ * Only included for compatibility with old API, which was based on CharacterIterators.
+ * Value may be adopted from outside, or one of fSCharIter or fDCharIter, below.
+ */
+ CharacterIterator *fCharIter;
+
+ /**
+ * When the input text is provided by a UnicodeString, this will point to
+ * a characterIterator that wraps that data. Needed only for the
+ * implementation of getText(), a backwards compatibility issue.
+ */
+ StringCharacterIterator fSCharIter;
+
+ /**
+ * True when iteration has run off the end, and iterator functions should return UBRK_DONE.
+ */
+ UBool fDone;
+
//=======================================================================
// constructors
//=======================================================================
@@ -152,11 +152,11 @@ private:
*
* The break iterator adopts the memory, and will
* free it when done.
- * @internal (private)
+ * @internal (private)
*/
RuleBasedBreakIterator(RBBIDataHeader* data, UErrorCode &status);
- /** @internal */
+ /** @internal */
friend class RBBIRuleBuilder;
/** @internal */
friend class BreakIterator;
@@ -190,17 +190,17 @@ public:
UErrorCode &status);
/**
- * Construct a RuleBasedBreakIterator from a set of precompiled binary rules.
+ * Construct a RuleBasedBreakIterator from a set of precompiled binary rules.
* Binary rules are obtained from RulesBasedBreakIterator::getBinaryRules().
* Construction of a break iterator in this way is substantially faster than
- * construction from source rules.
+ * construction from source rules.
*
* Ownership of the storage containing the compiled rules remains with the
* caller of this function. The compiled rules must not be modified or
* deleted during the life of the break iterator.
*
* The compiled rules are not compatible across different major versions of ICU.
- * The compiled rules are compatible only between machines with the same
+ * The compiled rules are compatible only between machines with the same
* byte ordering (little or big endian) and the same base character set family
* (ASCII or EBCDIC).
*
@@ -262,19 +262,19 @@ public:
* @return TRUE if both BreakIterators are not same.
* @stable ICU 2.0
*/
- inline UBool operator!=(const BreakIterator& that) const;
+ inline UBool operator!=(const BreakIterator& that) const;
/**
* Returns a newly-constructed RuleBasedBreakIterator with the same
* behavior, and iterating over the same text, as this one.
* Differs from the copy constructor in that it is polymorphic, and
* will correctly clone (copy) a derived class.
- * clone() is thread safe. Multiple threads may simultaneously
+ * clone() is thread safe. Multiple threads may simultaneously
* clone the same source break iterator.
* @return a newly-constructed RuleBasedBreakIterator
* @stable ICU 2.0
*/
- virtual RuleBasedBreakIterator* clone() const;
+ virtual RuleBasedBreakIterator* clone() const;
/**
* Compute a hash code for this BreakIterator
@@ -434,7 +434,7 @@ public:
virtual int32_t preceding(int32_t offset);
/**
- * Returns true if the specified position is a boundary position. As a side
+ * Returns true if the specified position is a boundary position. As a side
* effect, leaves the iterator pointing to the first boundary position at
* or after "offset".
* @param offset the offset to check.
@@ -444,10 +444,10 @@ public:
virtual UBool isBoundary(int32_t offset);
/**
- * Returns the current iteration position. Note that UBRK_DONE is never
- * returned from this function; if iteration has run to the end of a
- * string, current() will return the length of the string while
- * next() will return UBRK_DONE).
+ * Returns the current iteration position. Note that UBRK_DONE is never
+ * returned from this function; if iteration has run to the end of a
+ * string, current() will return the length of the string while
+ * next() will return UBRK_DONE).
* @return The current iteration position.
* @stable ICU 2.0
*/
@@ -455,8 +455,8 @@ public:
/**
- * Return the status tag from the break rule that determined the boundary at
- * the current iteration position. For break rules that do not specify a
+ * Return the status tag from the break rule that determined the boundary at
+ * the current iteration position. For break rules that do not specify a
* status, a default value of 0 is returned. If more than one break rule
* would cause a boundary to be located at some position in the text,
* the numerically largest of the applicable status values is returned.
@@ -473,14 +473,14 @@ public:
* position from <code>next()</code>, <code>previous()</code>, or
* any other break iterator functions that returns a boundary position.
* <p>
- * Note that <code>getRuleStatus()</code> returns the value corresponding to
- * <code>current()</code> index even after <code>next()</code> has returned DONE.
- * <p>
+ * Note that <code>getRuleStatus()</code> returns the value corresponding to
+ * <code>current()</code> index even after <code>next()</code> has returned DONE.
+ * <p>
* When creating custom break rules, one is free to define whatever
* status values may be convenient for the application.
* <p>
- * @return the status from the break rule that determined the boundary
- * at the current iteration position.
+ * @return the status from the break rule that determined the boundary
+ * at the current iteration position.
*
* @see UWordBreak
* @stable ICU 2.2
@@ -488,8 +488,8 @@ public:
virtual int32_t getRuleStatus() const;
/**
- * Get the status (tag) values from the break rule(s) that determined the boundary
- * at the current iteration position.
+ * Get the status (tag) values from the break rule(s) that determined the boundary
+ * at the current iteration position.
* <p>
* The returned status value(s) are stored into an array provided by the caller.
* The values are stored in sorted (ascending) order.
@@ -500,10 +500,10 @@ public:
* @param fillInVec an array to be filled in with the status values.
* @param capacity the length of the supplied vector. A length of zero causes
* the function to return the number of status values, in the
- * normal way, without attempting to store any values.
+ * normal way, without attempting to store any values.
* @param status receives error codes.
- * @return The number of rule status values from the rules that determined
- * the boundary at the current iteration position.
+ * @return The number of rule status values from the rules that determined
+ * the boundary at the current iteration position.
* In the event of a U_BUFFER_OVERFLOW_ERROR, the return value
* is the total number of status values that were available,
* not the reduced number that were actually returned.
@@ -538,13 +538,13 @@ public:
*/
static UClassID U_EXPORT2 getStaticClassID(void);
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Deprecated functionality. Use clone() instead.
*
* Create a clone (copy) of this break iterator in memory provided
* by the caller. The idea is to increase performance by avoiding
- * a storage allocation. Use of this function is NOT RECOMMENDED.
+ * a storage allocation. Use of this function is NOT RECOMMENDED.
* Performance gains are minimal, and correct buffer management is
* tricky. Use clone() instead.
*
@@ -557,7 +557,7 @@ public:
* storage for the cloned object.
*
* @param status Error status. U_SAFECLONE_ALLOCATED_WARNING will be
- * returned if the provided buffer was too small, and
+ * returned if the provided buffer was too small, and
* the clone was therefore put on the heap.
*
* @return Pointer to the clone object. This may differ from the stackBuffer
@@ -565,10 +565,10 @@ public:
* or if the stackBuffer was too small to hold the clone.
* @deprecated ICU 52. Use clone() instead.
*/
- virtual RuleBasedBreakIterator *createBufferClone(void *stackBuffer,
- int32_t &BufferSize,
- UErrorCode &status);
-#endif // U_FORCE_HIDE_DEPRECATED_API
+ virtual RuleBasedBreakIterator *createBufferClone(void *stackBuffer,
+ int32_t &BufferSize,
+ UErrorCode &status);
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Return the binary form of compiled break rules,
@@ -580,7 +580,7 @@ public:
* The binary data can only be used with the same version of ICU
* and on the same platform type (processor endian-ness)
*
- * @param length Returns the length of the binary data. (Out parameter.)
+ * @param length Returns the length of the binary data. (Out parameter.)
*
* @return A pointer to the binary (compiled) rule data. The storage
* belongs to the RulesBasedBreakIterator object, not the
@@ -624,65 +624,65 @@ private:
/**
* Dumps caches and performs other actions associated with a complete change
* in text or iteration position.
- * @internal (private)
+ * @internal (private)
*/
void reset(void);
/**
* Common initialization function, used by constructors and bufferClone.
- * @internal (private)
+ * @internal (private)
*/
- void init(UErrorCode &status);
+ void init(UErrorCode &status);
/**
- * Iterate backwards from an arbitrary position in the input text using the
- * synthesized Safe Reverse rules.
- * This locates a "Safe Position" from which the forward break rules
- * will operate correctly. A Safe Position is not necessarily a boundary itself.
- *
- * @param fromPosition the position in the input text to begin the iteration.
- * @internal (private)
+ * Iterate backwards from an arbitrary position in the input text using the
+ * synthesized Safe Reverse rules.
+ * This locates a "Safe Position" from which the forward break rules
+ * will operate correctly. A Safe Position is not necessarily a boundary itself.
+ *
+ * @param fromPosition the position in the input text to begin the iteration.
+ * @internal (private)
*/
- int32_t handleSafePrevious(int32_t fromPosition);
+ int32_t handleSafePrevious(int32_t fromPosition);
/**
- * Find a rule-based boundary by running the state machine.
- * Input
- * fPosition, the position in the text to begin from.
- * Output
- * fPosition: the boundary following the starting position.
- * fDictionaryCharCount the number of dictionary characters encountered.
- * If > 0, the segment will be further subdivided
- * fRuleStatusIndex Info from the state table indicating which rules caused the boundary.
- *
- * @internal (private)
+ * Find a rule-based boundary by running the state machine.
+ * Input
+ * fPosition, the position in the text to begin from.
+ * Output
+ * fPosition: the boundary following the starting position.
+ * fDictionaryCharCount the number of dictionary characters encountered.
+ * If > 0, the segment will be further subdivided
+ * fRuleStatusIndex Info from the state table indicating which rules caused the boundary.
+ *
+ * @internal (private)
*/
- int32_t handleNext();
+ int32_t handleNext();
/**
* This function returns the appropriate LanguageBreakEngine for a
* given character c.
* @param c A character in the dictionary set
- * @internal (private)
+ * @internal (private)
*/
const LanguageBreakEngine *getLanguageBreakEngine(UChar32 c);
- public:
-#ifndef U_HIDE_INTERNAL_API
+ public:
+#ifndef U_HIDE_INTERNAL_API
+ /**
+ * Debugging function only.
+ * @internal
+ */
+ void dumpCache();
+
/**
- * Debugging function only.
- * @internal
+ * Debugging function only.
+ * @internal
*/
- void dumpCache();
+ void dumpTables();
- /**
- * Debugging function only.
- * @internal
- */
- void dumpTables();
-
-#endif /* U_HIDE_INTERNAL_API */
+#endif /* U_HIDE_INTERNAL_API */
};
//------------------------------------------------------------------------------
@@ -699,6 +699,6 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/rbnf.h b/contrib/libs/icu/include/unicode/rbnf.h
index 089d6f3eed..62b02324b1 100644
--- a/contrib/libs/icu/include/unicode/rbnf.h
+++ b/contrib/libs/icu/include/unicode/rbnf.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -12,8 +12,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: Rule Based Number Format
@@ -698,7 +698,7 @@ public:
* @return A copy of the object.
* @stable ICU 2.6
*/
- virtual RuleBasedNumberFormat* clone() const;
+ virtual RuleBasedNumberFormat* clone() const;
/**
* Return true if the given Format objects are semantically equal.
@@ -867,30 +867,30 @@ public:
FieldPosition& pos,
UErrorCode& status) const;
-protected:
- /**
- * Format a decimal number.
- * The number is a DigitList wrapper onto a floating point decimal number.
- * The default implementation in NumberFormat converts the decimal number
- * to a double and formats that. Subclasses of NumberFormat that want
- * to specifically handle big decimal numbers must override this method.
- * class DecimalFormat does so.
- *
- * @param number The number, a DigitList format Decimal Floating Point.
- * @param appendTo Output parameter to receive result.
- * Result is appended to existing contents.
- * @param pos On input: an alignment field, if desired.
- * On output: the offsets of the alignment field.
- * @param status Output param filled with success/failure status.
- * @return Reference to 'appendTo' parameter.
- * @internal
- */
- virtual UnicodeString& format(const number::impl::DecimalQuantity &number,
- UnicodeString& appendTo,
- FieldPosition& pos,
- UErrorCode& status) const;
-public:
-
+protected:
+ /**
+ * Format a decimal number.
+ * The number is a DigitList wrapper onto a floating point decimal number.
+ * The default implementation in NumberFormat converts the decimal number
+ * to a double and formats that. Subclasses of NumberFormat that want
+ * to specifically handle big decimal numbers must override this method.
+ * class DecimalFormat does so.
+ *
+ * @param number The number, a DigitList format Decimal Floating Point.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param pos On input: an alignment field, if desired.
+ * On output: the offsets of the alignment field.
+ * @param status Output param filled with success/failure status.
+ * @return Reference to 'appendTo' parameter.
+ * @internal
+ */
+ virtual UnicodeString& format(const number::impl::DecimalQuantity &number,
+ UnicodeString& appendTo,
+ FieldPosition& pos,
+ UErrorCode& status) const;
+public:
+
using NumberFormat::parse;
/**
@@ -989,20 +989,20 @@ public:
*/
virtual void setContext(UDisplayContext value, UErrorCode& status);
- /**
- * Get the rounding mode.
- * @return A rounding mode
- * @stable ICU 60
- */
- virtual ERoundingMode getRoundingMode(void) const;
-
- /**
- * Set the rounding mode.
- * @param roundingMode A rounding mode
- * @stable ICU 60
- */
- virtual void setRoundingMode(ERoundingMode roundingMode);
-
+ /**
+ * Get the rounding mode.
+ * @return A rounding mode
+ * @stable ICU 60
+ */
+ virtual ERoundingMode getRoundingMode(void) const;
+
+ /**
+ * Set the rounding mode.
+ * @param roundingMode A rounding mode
+ * @stable ICU 60
+ */
+ virtual void setRoundingMode(ERoundingMode roundingMode);
+
public:
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
@@ -1069,12 +1069,12 @@ private:
NFRule * initializeDefaultNaNRule(UErrorCode &status);
const NFRule * getDefaultNaNRule() const;
PluralFormat *createPluralFormat(UPluralType pluralType, const UnicodeString &pattern, UErrorCode& status) const;
- UnicodeString& adjustForCapitalizationContext(int32_t startPos, UnicodeString& currentResult, UErrorCode& status) const;
- UnicodeString& format(int64_t number, NFRuleSet *ruleSet, UnicodeString& toAppendTo, UErrorCode& status) const;
- void format(double number, NFRuleSet& rs, UnicodeString& toAppendTo, UErrorCode& status) const;
+ UnicodeString& adjustForCapitalizationContext(int32_t startPos, UnicodeString& currentResult, UErrorCode& status) const;
+ UnicodeString& format(int64_t number, NFRuleSet *ruleSet, UnicodeString& toAppendTo, UErrorCode& status) const;
+ void format(double number, NFRuleSet& rs, UnicodeString& toAppendTo, UErrorCode& status) const;
private:
- NFRuleSet **fRuleSets;
+ NFRuleSet **fRuleSets;
UnicodeString* ruleSetDescriptions;
int32_t numRuleSets;
NFRuleSet *defaultRuleSet;
@@ -1083,7 +1083,7 @@ private:
DecimalFormatSymbols* decimalFormatSymbols;
NFRule *defaultInfinityRule;
NFRule *defaultNaNRule;
- ERoundingMode fRoundingMode;
+ ERoundingMode fRoundingMode;
UBool lenient;
UnicodeString* lenientParseRules;
LocalizationInfo* localizations;
@@ -1115,7 +1115,7 @@ U_NAMESPACE_END
/* U_HAVE_RBNF */
#endif
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
/* RBNF_H */
#endif
diff --git a/contrib/libs/icu/include/unicode/rbtz.h b/contrib/libs/icu/include/unicode/rbtz.h
index 105499d8d3..d66e1f08ec 100644
--- a/contrib/libs/icu/include/unicode/rbtz.h
+++ b/contrib/libs/icu/include/unicode/rbtz.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -11,8 +11,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: Rule based customizable time zone
@@ -123,7 +123,7 @@ public:
* @return A new copy of this TimeZone object.
* @stable ICU 3.8
*/
- virtual RuleBasedTimeZone* clone() const;
+ virtual RuleBasedTimeZone* clone() const;
/**
* Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add
@@ -226,7 +226,7 @@ public:
*/
virtual UBool useDaylightTime(void) const;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Queries if the given date is in daylight savings time in
* this time zone.
@@ -241,7 +241,7 @@ public:
* @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead.
*/
virtual UBool inDaylightTime(UDate date, UErrorCode& status) const;
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Returns true if this zone has the same rule and offset as another zone.
@@ -363,8 +363,8 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // RBTZ_H
//eof
diff --git a/contrib/libs/icu/include/unicode/regex.h b/contrib/libs/icu/include/unicode/regex.h
index a1d16b0480..7f7d152280 100644
--- a/contrib/libs/icu/include/unicode/regex.h
+++ b/contrib/libs/icu/include/unicode/regex.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: regex.h
-* encoding: UTF-8
+* encoding: UTF-8
* indentation:4
*
* created on: 2002oct22
@@ -24,28 +24,28 @@
* \file
* \brief C++ API: Regular Expressions
*
- * The ICU API for processing regular expressions consists of two classes,
- * `RegexPattern` and `RegexMatcher`.
- * `RegexPattern` objects represent a pre-processed, or compiled
+ * The ICU API for processing regular expressions consists of two classes,
+ * `RegexPattern` and `RegexMatcher`.
+ * `RegexPattern` objects represent a pre-processed, or compiled
* regular expression. They are created from a regular expression pattern string,
- * and can be used to create `RegexMatcher` objects for the pattern.
+ * and can be used to create `RegexMatcher` objects for the pattern.
*
- * Class `RegexMatcher` bundles together a regular expression
+ * Class `RegexMatcher` bundles together a regular expression
* pattern and a target string to which the search pattern will be applied.
- * `RegexMatcher` includes API for doing plain find or search
+ * `RegexMatcher` includes API for doing plain find or search
* operations, for search and replace operations, and for obtaining detailed
- * information about bounds of a match.
+ * information about bounds of a match.
*
- * Note that by constructing `RegexMatcher` objects directly from regular
+ * Note that by constructing `RegexMatcher` objects directly from regular
* expression pattern strings application code can be simplified and the explicit
- * need for `RegexPattern` objects can usually be eliminated.
- *
+ * need for `RegexPattern` objects can usually be eliminated.
+ *
*/
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_REGULAR_EXPRESSIONS
#include "unicode/uobject.h"
@@ -66,7 +66,7 @@ class RegexCImpl;
class RegexMatcher;
class RegexPattern;
struct REStackFrame;
-class BreakIterator;
+class BreakIterator;
class UnicodeSet;
class UVector;
class UVector32;
@@ -74,13 +74,13 @@ class UVector64;
/**
- * Class `RegexPattern` represents a compiled regular expression. It includes
+ * Class `RegexPattern` represents a compiled regular expression. It includes
* factory methods for creating a RegexPattern object from the source (string) form
* of a regular expression, methods for creating RegexMatchers that allow the pattern
* to be applied to input text, and a few convenience methods for simple common
* uses of regular expressions.
*
- * Class RegexPattern is not intended to be subclassed.
+ * Class RegexPattern is not intended to be subclassed.
*
* @stable ICU 2.4
*/
@@ -90,7 +90,7 @@ public:
/**
* default constructor. Create a RegexPattern object that refers to no actual
* pattern. Not normally needed; RegexPattern objects are usually
- * created using the factory method `compile()`.
+ * created using the factory method `compile()`.
*
* @stable ICU 2.4
*/
@@ -113,7 +113,7 @@ public:
/**
* Comparison operator. Two RegexPattern objects are considered equal if they
- * were constructed from identical source patterns using the same #URegexpFlag
+ * were constructed from identical source patterns using the same #URegexpFlag
* settings.
* @param that a RegexPattern object to compare with "this".
* @return TRUE if the objects are equivalent.
@@ -123,7 +123,7 @@ public:
/**
* Comparison operator. Two RegexPattern objects are considered equal if they
- * were constructed from identical source patterns using the same #URegexpFlag
+ * were constructed from identical source patterns using the same #URegexpFlag
* settings.
* @param that a RegexPattern object to compare with "this".
* @return TRUE if the objects are different.
@@ -153,16 +153,16 @@ public:
* object. These compile methods, rather than the constructors, are the usual
* way that RegexPattern objects are created.
*
- * Note that RegexPattern objects must not be deleted while RegexMatcher
+ * Note that RegexPattern objects must not be deleted while RegexMatcher
* objects created from the pattern are active. RegexMatchers keep a pointer
* back to their pattern, so premature deletion of the pattern is a
- * catastrophic error.
+ * catastrophic error.
*
- * All #URegexpFlag pattern match mode flags are set to their default values.
+ * All #URegexpFlag pattern match mode flags are set to their default values.
*
- * Note that it is often more convenient to construct a RegexMatcher directly
+ * Note that it is often more convenient to construct a RegexMatcher directly
* from a pattern string rather than separately compiling the pattern and
- * then creating a RegexMatcher object from the pattern.
+ * then creating a RegexMatcher object from the pattern.
*
* @param regex The regular expression to be compiled.
* @param pe Receives the position (line and column nubers) of any error
@@ -181,16 +181,16 @@ public:
* object. These compile methods, rather than the constructors, are the usual
* way that RegexPattern objects are created.
*
- * Note that RegexPattern objects must not be deleted while RegexMatcher
+ * Note that RegexPattern objects must not be deleted while RegexMatcher
* objects created from the pattern are active. RegexMatchers keep a pointer
* back to their pattern, so premature deletion of the pattern is a
- * catastrophic error.
+ * catastrophic error.
*
- * All #URegexpFlag pattern match mode flags are set to their default values.
+ * All #URegexpFlag pattern match mode flags are set to their default values.
*
- * Note that it is often more convenient to construct a RegexMatcher directly
+ * Note that it is often more convenient to construct a RegexMatcher directly
* from a pattern string rather than separately compiling the pattern and
- * then creating a RegexMatcher object from the pattern.
+ * then creating a RegexMatcher object from the pattern.
*
* @param regex The regular expression to be compiled. Note, the text referred
* to by this UText must not be deleted during the lifetime of the
@@ -208,21 +208,21 @@ public:
/**
* Compiles the regular expression in string form into a RegexPattern
- * object using the specified #URegexpFlag match mode flags. These compile methods,
+ * object using the specified #URegexpFlag match mode flags. These compile methods,
* rather than the constructors, are the usual way that RegexPattern objects
* are created.
*
- * Note that RegexPattern objects must not be deleted while RegexMatcher
+ * Note that RegexPattern objects must not be deleted while RegexMatcher
* objects created from the pattern are active. RegexMatchers keep a pointer
* back to their pattern, so premature deletion of the pattern is a
- * catastrophic error.
+ * catastrophic error.
*
- * Note that it is often more convenient to construct a RegexMatcher directly
+ * Note that it is often more convenient to construct a RegexMatcher directly
* from a pattern string instead of than separately compiling the pattern and
- * then creating a RegexMatcher object from the pattern.
+ * then creating a RegexMatcher object from the pattern.
*
* @param regex The regular expression to be compiled.
- * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE.
+ * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE.
* @param pe Receives the position (line and column numbers) of any error
* within the regular expression.)
* @param status A reference to a UErrorCode to receive any errors.
@@ -237,23 +237,23 @@ public:
/**
* Compiles the regular expression in string form into a RegexPattern
- * object using the specified #URegexpFlag match mode flags. These compile methods,
+ * object using the specified #URegexpFlag match mode flags. These compile methods,
* rather than the constructors, are the usual way that RegexPattern objects
* are created.
*
- * Note that RegexPattern objects must not be deleted while RegexMatcher
+ * Note that RegexPattern objects must not be deleted while RegexMatcher
* objects created from the pattern are active. RegexMatchers keep a pointer
* back to their pattern, so premature deletion of the pattern is a
- * catastrophic error.
+ * catastrophic error.
*
- * Note that it is often more convenient to construct a RegexMatcher directly
+ * Note that it is often more convenient to construct a RegexMatcher directly
* from a pattern string instead of than separately compiling the pattern and
- * then creating a RegexMatcher object from the pattern.
+ * then creating a RegexMatcher object from the pattern.
*
* @param regex The regular expression to be compiled. Note, the text referred
* to by this UText must not be deleted during the lifetime of the
* RegexPattern object or any RegexMatcher object created from it.
- * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE.
+ * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE.
* @param pe Receives the position (line and column numbers) of any error
* within the regular expression.)
* @param status A reference to a UErrorCode to receive any errors.
@@ -268,21 +268,21 @@ public:
/**
* Compiles the regular expression in string form into a RegexPattern
- * object using the specified #URegexpFlag match mode flags. These compile methods,
+ * object using the specified #URegexpFlag match mode flags. These compile methods,
* rather than the constructors, are the usual way that RegexPattern objects
* are created.
*
- * Note that RegexPattern objects must not be deleted while RegexMatcher
+ * Note that RegexPattern objects must not be deleted while RegexMatcher
* objects created from the pattern are active. RegexMatchers keep a pointer
* back to their pattern, so premature deletion of the pattern is a
- * catastrophic error.
+ * catastrophic error.
*
- * Note that it is often more convenient to construct a RegexMatcher directly
+ * Note that it is often more convenient to construct a RegexMatcher directly
* from a pattern string instead of than separately compiling the pattern and
- * then creating a RegexMatcher object from the pattern.
+ * then creating a RegexMatcher object from the pattern.
*
* @param regex The regular expression to be compiled.
- * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE.
+ * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE.
* @param status A reference to a UErrorCode to receive any errors.
* @return A regexPattern object for the compiled pattern.
*
@@ -294,23 +294,23 @@ public:
/**
* Compiles the regular expression in string form into a RegexPattern
- * object using the specified #URegexpFlag match mode flags. These compile methods,
+ * object using the specified #URegexpFlag match mode flags. These compile methods,
* rather than the constructors, are the usual way that RegexPattern objects
* are created.
*
- * Note that RegexPattern objects must not be deleted while RegexMatcher
+ * Note that RegexPattern objects must not be deleted while RegexMatcher
* objects created from the pattern are active. RegexMatchers keep a pointer
* back to their pattern, so premature deletion of the pattern is a
- * catastrophic error.
+ * catastrophic error.
*
- * Note that it is often more convenient to construct a RegexMatcher directly
+ * Note that it is often more convenient to construct a RegexMatcher directly
* from a pattern string instead of than separately compiling the pattern and
- * then creating a RegexMatcher object from the pattern.
+ * then creating a RegexMatcher object from the pattern.
*
* @param regex The regular expression to be compiled. Note, the text referred
* to by this UText must not be deleted during the lifetime of the
* RegexPattern object or any RegexMatcher object created from it.
- * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE.
+ * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE.
* @param status A reference to a UErrorCode to receive any errors.
* @return A regexPattern object for the compiled pattern.
*
@@ -321,8 +321,8 @@ public:
UErrorCode &status);
/**
- * Get the #URegexpFlag match mode flags that were used when compiling this pattern.
- * @return the #URegexpFlag match mode flags
+ * Get the #URegexpFlag match mode flags that were used when compiling this pattern.
+ * @return the #URegexpFlag match mode flags
* @stable ICU 2.4
*/
virtual uint32_t flags() const;
@@ -332,7 +332,7 @@ public:
* RegexMatcher can then be used to perform match, find or replace operations
* on the input. Note that a RegexPattern object must not be deleted while
* RegexMatchers created from it still exist and might possibly be used again.
- *
+ *
* The matcher will retain a reference to the supplied input string, and all regexp
* pattern matching operations happen directly on this original string. It is
* critical that the string not be altered or deleted before use by the regular
@@ -350,17 +350,17 @@ public:
private:
/**
* Cause a compilation error if an application accidentally attempts to
- * create a matcher with a (char16_t *) string as input rather than
+ * create a matcher with a (char16_t *) string as input rather than
* a UnicodeString. Avoids a dangling reference to a temporary string.
- *
- * To efficiently work with char16_t *strings, wrap the data in a UnicodeString
+ *
+ * To efficiently work with char16_t *strings, wrap the data in a UnicodeString
* using one of the aliasing constructors, such as
- * `UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);`
+ * `UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);`
* or in a UText, using
- * `utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);`
+ * `utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);`
*
*/
- RegexMatcher *matcher(const char16_t *input,
+ RegexMatcher *matcher(const char16_t *input,
UErrorCode &status) const;
public:
@@ -521,7 +521,7 @@ public:
/**
- * Split a string into fields. Somewhat like %split() from Perl or Java.
+ * Split a string into fields. Somewhat like %split() from Perl or Java.
* Pattern matches identify delimiters that separate the input
* into fields. The input data between the delimiters becomes the
* fields themselves.
@@ -540,7 +540,7 @@ public:
* This behavior differs from Java, which ignores capture groups.
*
* For the best performance on split() operations,
- * `RegexMatcher::split()` is preferable to this function
+ * `RegexMatcher::split()` is preferable to this function
*
* @param input The string to be split into fields. The field delimiters
* match the pattern (in the "this" object)
@@ -629,9 +629,9 @@ private:
//
// Implementation Methods
//
- void init(); // Common initialization, for use by constructors.
- bool initNamedCaptureMap(); // Lazy init for fNamedCaptureMap.
- void zap(); // Common cleanup
+ void init(); // Common initialization, for use by constructors.
+ bool initNamedCaptureMap(); // Lazy init for fNamedCaptureMap.
+ void zap(); // Common cleanup
void dumpOp(int32_t index) const;
@@ -668,7 +668,7 @@ public:
* its matcher() method to create the RegexMatcher objects.
*
* @param regexp The Regular Expression to be compiled.
- * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE.
+ * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE.
* @param status Any errors are reported by setting this UErrorCode variable.
* @stable ICU 2.6
*/
@@ -683,7 +683,7 @@ public:
* its matcher() method to create the RegexMatcher objects.
*
* @param regexp The regular expression to be compiled.
- * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE.
+ * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE.
* @param status Any errors are reported by setting this UErrorCode variable.
*
* @stable ICU 4.6
@@ -697,7 +697,7 @@ public:
* created for the same expression, it will be more efficient to
* separately create and cache a RegexPattern object, and use
* its matcher() method to create the RegexMatcher objects.
- *
+ *
* The matcher will retain a reference to the supplied input string, and all regexp
* pattern matching operations happen directly on the original string. It is
* critical that the string not be altered or deleted before use by the regular
@@ -706,7 +706,7 @@ public:
* @param regexp The Regular Expression to be compiled.
* @param input The string to match. The matcher retains a reference to the
* caller's string; mo copy is made.
- * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE.
+ * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE.
* @param status Any errors are reported by setting this UErrorCode variable.
* @stable ICU 2.6
*/
@@ -720,7 +720,7 @@ public:
* created for the same expression, it will be more efficient to
* separately create and cache a RegexPattern object, and use
* its matcher() method to create the RegexMatcher objects.
- *
+ *
* The matcher will make a shallow clone of the supplied input text, and all regexp
* pattern matching operations happen on this clone. While read-only operations on
* the supplied text are permitted, it is critical that the underlying string not be
@@ -728,7 +728,7 @@ public:
*
* @param regexp The Regular Expression to be compiled.
* @param input The string to match. The matcher retains a shallow clone of the text.
- * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE.
+ * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE.
* @param status Any errors are reported by setting this UErrorCode variable.
*
* @stable ICU 4.6
@@ -739,16 +739,16 @@ public:
private:
/**
* Cause a compilation error if an application accidentally attempts to
- * create a matcher with a (char16_t *) string as input rather than
+ * create a matcher with a (char16_t *) string as input rather than
* a UnicodeString. Avoids a dangling reference to a temporary string.
- *
- * To efficiently work with char16_t *strings, wrap the data in a UnicodeString
+ *
+ * To efficiently work with char16_t *strings, wrap the data in a UnicodeString
* using one of the aliasing constructors, such as
- * `UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);`
+ * `UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);`
* or in a UText, using
- * `utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);`
+ * `utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);`
*/
- RegexMatcher(const UnicodeString &regexp, const char16_t *input,
+ RegexMatcher(const UnicodeString &regexp, const char16_t *input,
uint32_t flags, UErrorCode &status);
public:
@@ -789,8 +789,8 @@ public:
* always starts at the beginning of the input region;
* unlike that function, it does not require that the entire region be matched.
*
- * If the match succeeds then more information can be obtained via the start(),
- * end(), and group() functions.
+ * If the match succeeds then more information can be obtained via the start(),
+ * end(), and group() functions.
*
* @param status A reference to a UErrorCode to receive any errors.
* @return TRUE if there is a match at the start of the input string.
@@ -804,8 +804,8 @@ public:
* The match may be of any length, and is not required to extend to the end
* of the input string. Contrast with match().
*
- * If the match succeeds then more information can be obtained via the start(),
- * end(), and group() functions.
+ * If the match succeeds then more information can be obtained via the start(),
+ * end(), and group() functions.
*
* @param startIndex The input string (native) index at which to begin matching.
* @param status A reference to a UErrorCode to receive any errors.
@@ -819,11 +819,11 @@ public:
* Find the next pattern match in the input string.
* The find begins searching the input at the location following the end of
* the previous match, or at the start of the string if there is no previous match.
- * If a match is found, `start()`, `end()` and `group()`
+ * If a match is found, `start()`, `end()` and `group()`
* will provide more information regarding the match.
- * Note that if the input string is changed by the application,
+ * Note that if the input string is changed by the application,
* use find(startPos, status) instead of find(), because the saved starting
- * position may not be valid with the altered input string.
+ * position may not be valid with the altered input string.
* @return TRUE if a match is found.
* @stable ICU 2.4
*/
@@ -834,12 +834,12 @@ public:
* Find the next pattern match in the input string.
* The find begins searching the input at the location following the end of
* the previous match, or at the start of the string if there is no previous match.
- * If a match is found, `start()`, `end()` and `group()`
+ * If a match is found, `start()`, `end()` and `group()`
* will provide more information regarding the match.
- *
- * Note that if the input string is changed by the application,
- * use find(startPos, status) instead of find(), because the saved starting
- * position may not be valid with the altered input string.
+ *
+ * Note that if the input string is changed by the application,
+ * use find(startPos, status) instead of find(), because the saved starting
+ * position may not be valid with the altered input string.
* @param status A reference to a UErrorCode to receive any errors.
* @return TRUE if a match is found.
* @stable ICU 55
@@ -1069,10 +1069,10 @@ public:
* The effect is to remove any memory of previous matches,
* and to cause subsequent find() operations to begin at
* the specified (native) position in the input string.
- *
+ *
* The matcher's region is reset to its default, which is the entire
* input string.
- *
+ *
* An alternative to this function is to set a match region
* beginning at the desired index.
*
@@ -1147,17 +1147,17 @@ public:
private:
/**
* Cause a compilation error if an application accidentally attempts to
- * reset a matcher with a (char16_t *) string as input rather than
+ * reset a matcher with a (char16_t *) string as input rather than
* a UnicodeString. Avoids a dangling reference to a temporary string.
- *
- * To efficiently work with char16_t *strings, wrap the data in a UnicodeString
+ *
+ * To efficiently work with char16_t *strings, wrap the data in a UnicodeString
* using one of the aliasing constructors, such as
- * `UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);`
+ * `UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);`
* or in a UText, using
- * `utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);`
+ * `utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);`
*
*/
- RegexMatcher &reset(const char16_t *input);
+ RegexMatcher &reset(const char16_t *input);
public:
/**
@@ -1403,15 +1403,15 @@ public:
* the pattern with the replacement string. This is a convenience
* function that provides a complete find-and-replace operation.
*
- * This function first resets this RegexMatcher. It then scans the input string
+ * This function first resets this RegexMatcher. It then scans the input string
* looking for a match of the pattern. Input that is not part
* of the match is appended directly to the result string; the match is replaced
* in the result by the replacement string. The replacement string may contain
- * references to captured groups.
+ * references to captured groups.
*
- * The state of the matcher (the position at which a subsequent find()
+ * The state of the matcher (the position at which a subsequent find()
* would begin) after completing a replaceFirst() is not specified. The
- * RegexMatcher should be reset before doing additional find() operations.
+ * RegexMatcher should be reset before doing additional find() operations.
*
* @param replacement a string containing the replacement text.
* @param status a reference to a UErrorCode to receive any errors.
@@ -1426,15 +1426,15 @@ public:
* the pattern with the replacement string. This is a convenience
* function that provides a complete find-and-replace operation.
*
- * This function first resets this RegexMatcher. It then scans the input string
+ * This function first resets this RegexMatcher. It then scans the input string
* looking for a match of the pattern. Input that is not part
* of the match is appended directly to the result string; the match is replaced
* in the result by the replacement string. The replacement string may contain
- * references to captured groups.
+ * references to captured groups.
*
- * The state of the matcher (the position at which a subsequent find()
+ * The state of the matcher (the position at which a subsequent find()
* would begin) after completing a replaceFirst() is not specified. The
- * RegexMatcher should be reset before doing additional find() operations.
+ * RegexMatcher should be reset before doing additional find() operations.
*
* @param replacement a string containing the replacement text.
* @param dest a mutable UText in which the results are placed.
@@ -1452,13 +1452,13 @@ public:
* Implements a replace operation intended to be used as part of an
* incremental find-and-replace.
*
- * The input string, starting from the end of the previous replacement and ending at
+ * The input string, starting from the end of the previous replacement and ending at
* the start of the current match, is appended to the destination string. Then the
* replacement string is appended to the output string,
- * including handling any substitutions of captured text.
+ * including handling any substitutions of captured text.
*
- * For simple, prepackaged, non-incremental find-and-replace
- * operations, see replaceFirst() or replaceAll().
+ * For simple, prepackaged, non-incremental find-and-replace
+ * operations, see replaceFirst() or replaceAll().
*
* @param dest A UnicodeString to which the results of the find-and-replace are appended.
* @param replacement A UnicodeString that provides the text to be substituted for
@@ -1483,13 +1483,13 @@ public:
* Implements a replace operation intended to be used as part of an
* incremental find-and-replace.
*
- * The input string, starting from the end of the previous replacement and ending at
+ * The input string, starting from the end of the previous replacement and ending at
* the start of the current match, is appended to the destination string. Then the
* replacement string is appended to the output string,
- * including handling any substitutions of captured text.
+ * including handling any substitutions of captured text.
*
- * For simple, prepackaged, non-incremental find-and-replace
- * operations, see replaceFirst() or replaceAll().
+ * For simple, prepackaged, non-incremental find-and-replace
+ * operations, see replaceFirst() or replaceAll().
*
* @param dest A mutable UText to which the results of the find-and-replace are appended.
* Must not be NULL.
@@ -1513,8 +1513,8 @@ public:
/**
* As the final step in a find-and-replace operation, append the remainder
* of the input string, starting at the position following the last appendReplacement(),
- * to the destination string. `appendTail()` is intended to be invoked after one
- * or more invocations of the `RegexMatcher::appendReplacement()`.
+ * to the destination string. `appendTail()` is intended to be invoked after one
+ * or more invocations of the `RegexMatcher::appendReplacement()`.
*
* @param dest A UnicodeString to which the results of the find-and-replace are appended.
* @return the destination string.
@@ -1526,8 +1526,8 @@ public:
/**
* As the final step in a find-and-replace operation, append the remainder
* of the input string, starting at the position following the last appendReplacement(),
- * to the destination string. `appendTail()` is intended to be invoked after one
- * or more invocations of the `RegexMatcher::appendReplacement()`.
+ * to the destination string. `appendTail()` is intended to be invoked after one
+ * or more invocations of the `RegexMatcher::appendReplacement()`.
*
* @param dest A mutable UText to which the results of the find-and-replace are appended.
* Must not be NULL.
@@ -1540,7 +1540,7 @@ public:
/**
- * Split a string into fields. Somewhat like %split() from Perl.
+ * Split a string into fields. Somewhat like %split() from Perl.
* The pattern matches identify delimiters that separate the input
* into fields. The input data between the matches becomes the
* fields themselves.
@@ -1569,7 +1569,7 @@ public:
/**
- * Split a string into fields. Somewhat like %split() from Perl.
+ * Split a string into fields. Somewhat like %split() from Perl.
* The pattern matches identify delimiters that separate the input
* into fields. The input data between the matches becomes the
* fields themselves.
@@ -1604,15 +1604,15 @@ public:
* infinite loop.
* When a limit is set a match operation will fail with an error if the
* limit is exceeded.
- *
+ *
* The units of the limit are steps of the match engine.
* Correspondence with actual processor time will depend on the speed
* of the processor and the details of the specific pattern, but will
* typically be on the order of milliseconds.
- *
+ *
* By default, the matching time is not limited.
*
- *
+ *
* @param limit The limit value, or 0 for no limit.
* @param status A reference to a UErrorCode to receive any errors.
* @stable ICU 4.0
@@ -1630,16 +1630,16 @@ public:
/**
* Set the amount of heap storage available for use by the match backtracking stack.
* The matcher is also reset, discarding any results from previous matches.
- *
+ *
* ICU uses a backtracking regular expression engine, with the backtrack stack
* maintained on the heap. This function sets the limit to the amount of memory
- * that can be used for this purpose. A backtracking stack overflow will
+ * that can be used for this purpose. A backtracking stack overflow will
* result in an error from the match operation that caused it.
- *
+ *
* A limit is desirable because a malicious or poorly designed pattern can use
* excessive memory, potentially crashing the process. A limit is enabled
* by default.
- *
+ *
* @param limit The maximum size, in bytes, of the matching backtrack stack.
* A value of zero means no limit.
* The limit must be greater or equal to zero.
@@ -1774,9 +1774,9 @@ private:
void MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status);
inline void backTrack(int64_t &inputIdx, int32_t &patIdx);
UBool isWordBoundary(int64_t pos); // perform Perl-like \b test
- UBool isUWordBoundary(int64_t pos, UErrorCode &status); // perform RBBI based \b test
- // Find a grapheme cluster boundary using a break iterator. For handling \X in regexes.
- int64_t followingGCBoundary(int64_t pos, UErrorCode &status);
+ UBool isUWordBoundary(int64_t pos, UErrorCode &status); // perform RBBI based \b test
+ // Find a grapheme cluster boundary using a break iterator. For handling \X in regexes.
+ int64_t followingGCBoundary(int64_t pos, UErrorCode &status);
REStackFrame *resetStack();
inline REStackFrame *StateSave(REStackFrame *fp, int64_t savePatIdx, UErrorCode &status);
void IncrementTime(UErrorCode &status);
@@ -1870,13 +1870,13 @@ private:
UErrorCode fDeferredStatus; // Save error state that cannot be immediately
// reported, or that permanently disables this matcher.
- BreakIterator *fWordBreakItr;
- BreakIterator *fGCBreakItr;
+ BreakIterator *fWordBreakItr;
+ BreakIterator *fGCBreakItr;
};
U_NAMESPACE_END
#endif // UCONFIG_NO_REGULAR_EXPRESSIONS
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/region.h b/contrib/libs/icu/include/unicode/region.h
index 2c7322c9e9..9ec8dd4515 100644
--- a/contrib/libs/icu/include/unicode/region.h
+++ b/contrib/libs/icu/include/unicode/region.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -17,11 +17,11 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
-#include "unicode/uregion.h"
+#include "unicode/uregion.h"
#include "unicode/uobject.h"
#include "unicode/uniset.h"
#include "unicode/unistr.h"
@@ -194,7 +194,7 @@ private:
char id[4];
UnicodeString idStr;
int32_t code;
- URegionType fType;
+ URegionType fType;
Region *containingRegion;
UVector *containedRegions;
UVector *preferredValues;
@@ -221,9 +221,9 @@ private:
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // REGION_H
//eof
diff --git a/contrib/libs/icu/include/unicode/reldatefmt.h b/contrib/libs/icu/include/unicode/reldatefmt.h
index 88c870dc9c..d5533bb379 100644
--- a/contrib/libs/icu/include/unicode/reldatefmt.h
+++ b/contrib/libs/icu/include/unicode/reldatefmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************
@@ -15,14 +15,14 @@
#define __RELDATEFMT_H
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
#include "unicode/udisplaycontext.h"
#include "unicode/ureldatefmt.h"
#include "unicode/locid.h"
-#include "unicode/formattedvalue.h"
+#include "unicode/formattedvalue.h"
/**
* \file
@@ -169,32 +169,32 @@ typedef enum UDateAbsoluteUnit {
*/
UDAT_ABSOLUTE_NOW,
- /**
- * Quarter
- * @stable ICU 63
- */
- UDAT_ABSOLUTE_QUARTER,
-
-#ifndef U_HIDE_DRAFT_API
- /**
- * Hour
- * @draft ICU 65
- */
- UDAT_ABSOLUTE_HOUR,
-
- /**
- * Minute
- * @draft ICU 65
- */
- UDAT_ABSOLUTE_MINUTE,
-#endif // U_HIDE_DRAFT_API
-
+ /**
+ * Quarter
+ * @stable ICU 63
+ */
+ UDAT_ABSOLUTE_QUARTER,
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Hour
+ * @draft ICU 65
+ */
+ UDAT_ABSOLUTE_HOUR,
+
+ /**
+ * Minute
+ * @draft ICU 65
+ */
+ UDAT_ABSOLUTE_MINUTE,
+#endif // U_HIDE_DRAFT_API
+
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal UDateAbsoluteUnit value.
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
- UDAT_ABSOLUTE_UNIT_COUNT = UDAT_ABSOLUTE_NOW + 4
+ UDAT_ABSOLUTE_UNIT_COUNT = UDAT_ABSOLUTE_NOW + 4
#endif // U_HIDE_DEPRECATED_API
} UDateAbsoluteUnit;
@@ -254,80 +254,80 @@ typedef enum UDateDirection {
U_NAMESPACE_BEGIN
-class BreakIterator;
+class BreakIterator;
class RelativeDateTimeCacheData;
class SharedNumberFormat;
class SharedPluralRules;
class SharedBreakIterator;
class NumberFormat;
class UnicodeString;
-class FormattedRelativeDateTime;
-class FormattedRelativeDateTimeData;
+class FormattedRelativeDateTime;
+class FormattedRelativeDateTimeData;
+
+/**
+ * An immutable class containing the result of a relative datetime formatting operation.
+ *
+ * Instances of this class are immutable and thread-safe.
+ *
+ * Not intended for public subclassing.
+ *
+ * @stable ICU 64
+ */
+class U_I18N_API FormattedRelativeDateTime : public UMemory, public FormattedValue {
+ public:
+ /**
+ * Default constructor; makes an empty FormattedRelativeDateTime.
+ * @stable ICU 64
+ */
+ FormattedRelativeDateTime() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
+
+ /**
+ * Move constructor: Leaves the source FormattedRelativeDateTime in an undefined state.
+ * @stable ICU 64
+ */
+ FormattedRelativeDateTime(FormattedRelativeDateTime&& src) U_NOEXCEPT;
+
+ /**
+ * Destruct an instance of FormattedRelativeDateTime.
+ * @stable ICU 64
+ */
+ virtual ~FormattedRelativeDateTime() U_OVERRIDE;
+
+ /** Copying not supported; use move constructor instead. */
+ FormattedRelativeDateTime(const FormattedRelativeDateTime&) = delete;
+
+ /** Copying not supported; use move assignment instead. */
+ FormattedRelativeDateTime& operator=(const FormattedRelativeDateTime&) = delete;
+
+ /**
+ * Move assignment: Leaves the source FormattedRelativeDateTime in an undefined state.
+ * @stable ICU 64
+ */
+ FormattedRelativeDateTime& operator=(FormattedRelativeDateTime&& src) U_NOEXCEPT;
+
+ /** @copydoc FormattedValue::toString() */
+ UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
+
+ /** @copydoc FormattedValue::toTempString() */
+ UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
+
+ /** @copydoc FormattedValue::appendTo() */
+ Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
+
+ /** @copydoc FormattedValue::nextPosition() */
+ UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
+
+ private:
+ FormattedRelativeDateTimeData *fData;
+ UErrorCode fErrorCode;
+ explicit FormattedRelativeDateTime(FormattedRelativeDateTimeData *results)
+ : fData(results), fErrorCode(U_ZERO_ERROR) {}
+ explicit FormattedRelativeDateTime(UErrorCode errorCode)
+ : fData(nullptr), fErrorCode(errorCode) {}
+ friend class RelativeDateTimeFormatter;
+};
/**
- * An immutable class containing the result of a relative datetime formatting operation.
- *
- * Instances of this class are immutable and thread-safe.
- *
- * Not intended for public subclassing.
- *
- * @stable ICU 64
- */
-class U_I18N_API FormattedRelativeDateTime : public UMemory, public FormattedValue {
- public:
- /**
- * Default constructor; makes an empty FormattedRelativeDateTime.
- * @stable ICU 64
- */
- FormattedRelativeDateTime() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
-
- /**
- * Move constructor: Leaves the source FormattedRelativeDateTime in an undefined state.
- * @stable ICU 64
- */
- FormattedRelativeDateTime(FormattedRelativeDateTime&& src) U_NOEXCEPT;
-
- /**
- * Destruct an instance of FormattedRelativeDateTime.
- * @stable ICU 64
- */
- virtual ~FormattedRelativeDateTime() U_OVERRIDE;
-
- /** Copying not supported; use move constructor instead. */
- FormattedRelativeDateTime(const FormattedRelativeDateTime&) = delete;
-
- /** Copying not supported; use move assignment instead. */
- FormattedRelativeDateTime& operator=(const FormattedRelativeDateTime&) = delete;
-
- /**
- * Move assignment: Leaves the source FormattedRelativeDateTime in an undefined state.
- * @stable ICU 64
- */
- FormattedRelativeDateTime& operator=(FormattedRelativeDateTime&& src) U_NOEXCEPT;
-
- /** @copydoc FormattedValue::toString() */
- UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
-
- /** @copydoc FormattedValue::toTempString() */
- UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
-
- /** @copydoc FormattedValue::appendTo() */
- Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
-
- /** @copydoc FormattedValue::nextPosition() */
- UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
-
- private:
- FormattedRelativeDateTimeData *fData;
- UErrorCode fErrorCode;
- explicit FormattedRelativeDateTime(FormattedRelativeDateTimeData *results)
- : fData(results), fErrorCode(U_ZERO_ERROR) {}
- explicit FormattedRelativeDateTime(UErrorCode errorCode)
- : fData(nullptr), fErrorCode(errorCode) {}
- friend class RelativeDateTimeFormatter;
-};
-
-/**
* Formats simple relative dates. There are two types of relative dates that
* it handles:
* <ul>
@@ -417,7 +417,7 @@ public:
* @param nfToAdopt Constructed object takes ownership of this pointer.
* It is an error for caller to delete this pointer or change its
* contents after calling this constructor.
- * @param status Any error is returned here.
+ * @param status Any error is returned here.
* @stable ICU 53
*/
RelativeDateTimeFormatter(
@@ -435,7 +435,7 @@ public:
* @param style the format style. The UDAT_RELATIVE bit field has no effect.
* @param capitalizationContext A value from UDisplayContext that pertains to
* capitalization.
- * @param status Any error is returned here.
+ * @param status Any error is returned here.
* @stable ICU 54
*/
RelativeDateTimeFormatter(
@@ -467,10 +467,10 @@ public:
/**
* Formats a relative date with a quantity such as "in 5 days" or
* "3 months ago"
- *
- * This method returns a String. To get more information about the
- * formatting result, use formatToValue().
- *
+ *
+ * This method returns a String. To get more information about the
+ * formatting result, use formatToValue().
+ *
* @param quantity The numerical amount e.g 5. This value is formatted
* according to this object's NumberFormat object.
* @param direction NEXT means a future relative date; LAST means a past
@@ -491,34 +491,34 @@ public:
UErrorCode& status) const;
/**
- * Formats a relative date with a quantity such as "in 5 days" or
- * "3 months ago"
- *
- * This method returns a FormattedRelativeDateTime, which exposes more
- * information than the String returned by format().
- *
- * @param quantity The numerical amount e.g 5. This value is formatted
- * according to this object's NumberFormat object.
- * @param direction NEXT means a future relative date; LAST means a past
- * relative date. If direction is anything else, this method sets
- * status to U_ILLEGAL_ARGUMENT_ERROR.
- * @param unit the unit e.g day? month? year?
- * @param status ICU error code returned here.
- * @return The formatted relative datetime
- * @stable ICU 64
- */
- FormattedRelativeDateTime formatToValue(
- double quantity,
- UDateDirection direction,
- UDateRelativeUnit unit,
- UErrorCode& status) const;
-
- /**
+ * Formats a relative date with a quantity such as "in 5 days" or
+ * "3 months ago"
+ *
+ * This method returns a FormattedRelativeDateTime, which exposes more
+ * information than the String returned by format().
+ *
+ * @param quantity The numerical amount e.g 5. This value is formatted
+ * according to this object's NumberFormat object.
+ * @param direction NEXT means a future relative date; LAST means a past
+ * relative date. If direction is anything else, this method sets
+ * status to U_ILLEGAL_ARGUMENT_ERROR.
+ * @param unit the unit e.g day? month? year?
+ * @param status ICU error code returned here.
+ * @return The formatted relative datetime
+ * @stable ICU 64
+ */
+ FormattedRelativeDateTime formatToValue(
+ double quantity,
+ UDateDirection direction,
+ UDateRelativeUnit unit,
+ UErrorCode& status) const;
+
+ /**
* Formats a relative date without a quantity.
- *
- * This method returns a String. To get more information about the
- * formatting result, use formatToValue().
- *
+ *
+ * This method returns a String. To get more information about the
+ * formatting result, use formatToValue().
+ *
* @param direction NEXT, LAST, THIS, etc.
* @param unit e.g SATURDAY, DAY, MONTH
* @param appendTo The string to which the formatted result will be
@@ -536,32 +536,32 @@ public:
UErrorCode& status) const;
/**
- * Formats a relative date without a quantity.
- *
- * This method returns a FormattedRelativeDateTime, which exposes more
- * information than the String returned by format().
- *
- * If the string is not available in the requested locale, the return
- * value will be empty (calling toString will give an empty string).
- *
- * @param direction NEXT, LAST, THIS, etc.
- * @param unit e.g SATURDAY, DAY, MONTH
- * @param status ICU error code returned here.
- * @return The formatted relative datetime
- * @stable ICU 64
- */
- FormattedRelativeDateTime formatToValue(
- UDateDirection direction,
- UDateAbsoluteUnit unit,
- UErrorCode& status) const;
-
- /**
+ * Formats a relative date without a quantity.
+ *
+ * This method returns a FormattedRelativeDateTime, which exposes more
+ * information than the String returned by format().
+ *
+ * If the string is not available in the requested locale, the return
+ * value will be empty (calling toString will give an empty string).
+ *
+ * @param direction NEXT, LAST, THIS, etc.
+ * @param unit e.g SATURDAY, DAY, MONTH
+ * @param status ICU error code returned here.
+ * @return The formatted relative datetime
+ * @stable ICU 64
+ */
+ FormattedRelativeDateTime formatToValue(
+ UDateDirection direction,
+ UDateAbsoluteUnit unit,
+ UErrorCode& status) const;
+
+ /**
* Format a combination of URelativeDateTimeUnit and numeric offset
* using a numeric style, e.g. "1 week ago", "in 1 week",
* "5 weeks ago", "in 5 weeks".
- *
- * This method returns a String. To get more information about the
- * formatting result, use formatNumericToValue().
+ *
+ * This method returns a String. To get more information about the
+ * formatting result, use formatNumericToValue().
*
* @param offset The signed offset for the specified unit. This
* will be formatted according to this object's
@@ -573,7 +573,7 @@ public:
* appended.
* @param status ICU error code returned here.
* @return appendTo
- * @stable ICU 57
+ * @stable ICU 57
*/
UnicodeString& formatNumeric(
double offset,
@@ -583,37 +583,37 @@ public:
/**
* Format a combination of URelativeDateTimeUnit and numeric offset
- * using a numeric style, e.g. "1 week ago", "in 1 week",
- * "5 weeks ago", "in 5 weeks".
+ * using a numeric style, e.g. "1 week ago", "in 1 week",
+ * "5 weeks ago", "in 5 weeks".
+ *
+ * This method returns a FormattedRelativeDateTime, which exposes more
+ * information than the String returned by formatNumeric().
*
- * This method returns a FormattedRelativeDateTime, which exposes more
- * information than the String returned by formatNumeric().
- *
- * @param offset The signed offset for the specified unit. This
- * will be formatted according to this object's
- * NumberFormat object.
- * @param unit The unit to use when formatting the relative
- * date, e.g. UDAT_REL_UNIT_WEEK,
- * UDAT_REL_UNIT_FRIDAY.
- * @param status ICU error code returned here.
- * @return The formatted relative datetime
- * @stable ICU 64
- */
- FormattedRelativeDateTime formatNumericToValue(
- double offset,
- URelativeDateTimeUnit unit,
- UErrorCode& status) const;
-
- /**
- * Format a combination of URelativeDateTimeUnit and numeric offset
+ * @param offset The signed offset for the specified unit. This
+ * will be formatted according to this object's
+ * NumberFormat object.
+ * @param unit The unit to use when formatting the relative
+ * date, e.g. UDAT_REL_UNIT_WEEK,
+ * UDAT_REL_UNIT_FRIDAY.
+ * @param status ICU error code returned here.
+ * @return The formatted relative datetime
+ * @stable ICU 64
+ */
+ FormattedRelativeDateTime formatNumericToValue(
+ double offset,
+ URelativeDateTimeUnit unit,
+ UErrorCode& status) const;
+
+ /**
+ * Format a combination of URelativeDateTimeUnit and numeric offset
* using a text style if possible, e.g. "last week", "this week",
* "next week", "yesterday", "tomorrow". Falls back to numeric
* style if no appropriate text term is available for the specified
* offset in the object's locale.
*
- * This method returns a String. To get more information about the
- * formatting result, use formatToValue().
- *
+ * This method returns a String. To get more information about the
+ * formatting result, use formatToValue().
+ *
* @param offset The signed offset for the specified unit.
* @param unit The unit to use when formatting the relative
* date, e.g. UDAT_REL_UNIT_WEEK,
@@ -622,7 +622,7 @@ public:
* appended.
* @param status ICU error code returned here.
* @return appendTo
- * @stable ICU 57
+ * @stable ICU 57
*/
UnicodeString& format(
double offset,
@@ -631,29 +631,29 @@ public:
UErrorCode& status) const;
/**
- * Format a combination of URelativeDateTimeUnit and numeric offset
- * using a text style if possible, e.g. "last week", "this week",
- * "next week", "yesterday", "tomorrow". Falls back to numeric
- * style if no appropriate text term is available for the specified
- * offset in the object's locale.
- *
- * This method returns a FormattedRelativeDateTime, which exposes more
- * information than the String returned by format().
- *
- * @param offset The signed offset for the specified unit.
- * @param unit The unit to use when formatting the relative
- * date, e.g. UDAT_REL_UNIT_WEEK,
- * UDAT_REL_UNIT_FRIDAY.
- * @param status ICU error code returned here.
- * @return The formatted relative datetime
- * @stable ICU 64
- */
- FormattedRelativeDateTime formatToValue(
- double offset,
- URelativeDateTimeUnit unit,
- UErrorCode& status) const;
-
- /**
+ * Format a combination of URelativeDateTimeUnit and numeric offset
+ * using a text style if possible, e.g. "last week", "this week",
+ * "next week", "yesterday", "tomorrow". Falls back to numeric
+ * style if no appropriate text term is available for the specified
+ * offset in the object's locale.
+ *
+ * This method returns a FormattedRelativeDateTime, which exposes more
+ * information than the String returned by format().
+ *
+ * @param offset The signed offset for the specified unit.
+ * @param unit The unit to use when formatting the relative
+ * date, e.g. UDAT_REL_UNIT_WEEK,
+ * UDAT_REL_UNIT_FRIDAY.
+ * @param status ICU error code returned here.
+ * @return The formatted relative datetime
+ * @stable ICU 64
+ */
+ FormattedRelativeDateTime formatToValue(
+ double offset,
+ URelativeDateTimeUnit unit,
+ UErrorCode& status) const;
+
+ /**
* Combines a relative date string and a time string in this object's
* locale. This is done with the same date-time separator used for the
* default calendar in this locale.
@@ -704,50 +704,50 @@ private:
NumberFormat *nfToAdopt,
BreakIterator *brkIter,
UErrorCode &status);
- UnicodeString& adjustForContext(UnicodeString &) const;
- UBool checkNoAdjustForContext(UErrorCode& status) const;
-
- template<typename F, typename... Args>
- UnicodeString& doFormat(
- F callback,
- UnicodeString& appendTo,
- UErrorCode& status,
- Args... args) const;
-
- template<typename F, typename... Args>
- FormattedRelativeDateTime doFormatToValue(
- F callback,
- UErrorCode& status,
- Args... args) const;
-
- void formatImpl(
- double quantity,
- UDateDirection direction,
- UDateRelativeUnit unit,
- FormattedRelativeDateTimeData& output,
- UErrorCode& status) const;
- void formatAbsoluteImpl(
- UDateDirection direction,
- UDateAbsoluteUnit unit,
- FormattedRelativeDateTimeData& output,
- UErrorCode& status) const;
- void formatNumericImpl(
- double offset,
- URelativeDateTimeUnit unit,
- FormattedRelativeDateTimeData& output,
- UErrorCode& status) const;
- void formatRelativeImpl(
- double offset,
- URelativeDateTimeUnit unit,
- FormattedRelativeDateTimeData& output,
- UErrorCode& status) const;
+ UnicodeString& adjustForContext(UnicodeString &) const;
+ UBool checkNoAdjustForContext(UErrorCode& status) const;
+
+ template<typename F, typename... Args>
+ UnicodeString& doFormat(
+ F callback,
+ UnicodeString& appendTo,
+ UErrorCode& status,
+ Args... args) const;
+
+ template<typename F, typename... Args>
+ FormattedRelativeDateTime doFormatToValue(
+ F callback,
+ UErrorCode& status,
+ Args... args) const;
+
+ void formatImpl(
+ double quantity,
+ UDateDirection direction,
+ UDateRelativeUnit unit,
+ FormattedRelativeDateTimeData& output,
+ UErrorCode& status) const;
+ void formatAbsoluteImpl(
+ UDateDirection direction,
+ UDateAbsoluteUnit unit,
+ FormattedRelativeDateTimeData& output,
+ UErrorCode& status) const;
+ void formatNumericImpl(
+ double offset,
+ URelativeDateTimeUnit unit,
+ FormattedRelativeDateTimeData& output,
+ UErrorCode& status) const;
+ void formatRelativeImpl(
+ double offset,
+ URelativeDateTimeUnit unit,
+ FormattedRelativeDateTimeData& output,
+ UErrorCode& status) const;
};
U_NAMESPACE_END
#endif /* !UCONFIG_NO_BREAK_ITERATION */
#endif /* !UCONFIG_NO_FORMATTING */
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif /* __RELDATEFMT_H */
diff --git a/contrib/libs/icu/include/unicode/rep.h b/contrib/libs/icu/include/unicode/rep.h
index b79d0a5530..6dd4530647 100644
--- a/contrib/libs/icu/include/unicode/rep.h
+++ b/contrib/libs/icu/include/unicode/rep.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**************************************************************************
@@ -16,10 +16,10 @@
#ifndef REP_H
#define REP_H
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
/**
@@ -97,7 +97,7 @@ public:
* @return 16-bit code unit of text at given offset
* @stable ICU 1.8
*/
- inline char16_t charAt(int32_t offset) const;
+ inline char16_t charAt(int32_t offset) const;
/**
* Returns the 32-bit code point at the given 16-bit offset into
@@ -231,7 +231,7 @@ protected:
* Virtual version of charAt().
* @stable ICU 2.4
*/
- virtual char16_t getCharAt(int32_t offset) const = 0;
+ virtual char16_t getCharAt(int32_t offset) const = 0;
/**
* Virtual version of char32At().
@@ -247,7 +247,7 @@ Replaceable::length() const {
return getLength();
}
-inline char16_t
+inline char16_t
Replaceable::charAt(int32_t offset) const {
return getCharAt(offset);
}
@@ -261,6 +261,6 @@ Replaceable::char32At(int32_t offset) const {
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/resbund.h b/contrib/libs/icu/include/unicode/resbund.h
index cd9b784899..2894067528 100644
--- a/contrib/libs/icu/include/unicode/resbund.h
+++ b/contrib/libs/icu/include/unicode/resbund.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -49,9 +49,9 @@
#define RESBUND_H
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
#include "unicode/ures.h"
#include "unicode/unistr.h"
@@ -135,7 +135,7 @@ public:
ResourceBundle(UErrorCode &err);
/**
- * Standard constructor, constructs a resource bundle for the locale-specific
+ * Standard constructor, constructs a resource bundle for the locale-specific
* bundle in the specified package.
*
* @param packageName The packageName and locale together point to an ICU udata object,
@@ -219,7 +219,7 @@ public:
* could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
* could be a warning
* e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
- * @return a pointer to a zero-terminated char16_t array which lives in a memory mapped/DLL file.
+ * @return a pointer to a zero-terminated char16_t array which lives in a memory mapped/DLL file.
* @stable ICU 2.0
*/
UnicodeString
@@ -492,7 +492,7 @@ private:
};
U_NAMESPACE_END
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/schriter.h b/contrib/libs/icu/include/unicode/schriter.h
index 541d296820..1ca5b70fca 100644
--- a/contrib/libs/icu/include/unicode/schriter.h
+++ b/contrib/libs/icu/include/unicode/schriter.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -21,9 +21,9 @@
#define SCHRITER_H
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/chariter.h"
#include "unicode/uchriter.h"
@@ -72,7 +72,7 @@ public:
* Create an iterator over the UnicodeString referred to by "textStr".
* The UnicodeString object is copied.
* The iteration range begins with the code unit specified by
- * "textBegin" and ends with the code unit BEFORE the code unit specified
+ * "textBegin" and ends with the code unit BEFORE the code unit specified
* by "textEnd". The starting position is specified by "textPos". If
* "textBegin" and "textEnd" don't form a valid range on "text" (i.e.,
* textBegin >= textEnd or either is negative or greater than text.size()),
@@ -133,7 +133,7 @@ public:
* @return the newly cloned object.
* @stable ICU 2.0
*/
- virtual StringCharacterIterator* clone() const;
+ virtual StringCharacterIterator* clone() const;
/**
* Sets the iterator to iterate over the provided string.
@@ -178,7 +178,7 @@ protected:
* @param newTextLength The length of the String
* @stable ICU 2.0
*/
- void setText(const char16_t* newText, int32_t newTextLength);
+ void setText(const char16_t* newText, int32_t newTextLength);
/**
* Copy of the iterated string object.
@@ -189,7 +189,7 @@ protected:
};
U_NAMESPACE_END
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/scientificnumberformatter.h b/contrib/libs/icu/include/unicode/scientificnumberformatter.h
index 49f203fa43..7f860d4f59 100644
--- a/contrib/libs/icu/include/unicode/scientificnumberformatter.h
+++ b/contrib/libs/icu/include/unicode/scientificnumberformatter.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -11,8 +11,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
@@ -159,7 +159,7 @@ public:
class U_I18N_API SuperscriptStyle : public Style {
public:
- virtual SuperscriptStyle *clone() const;
+ virtual SuperscriptStyle *clone() const;
protected:
virtual UnicodeString &format(
const UnicodeString &original,
@@ -177,7 +177,7 @@ public:
: Style(),
fBeginMarkup(beginMarkup),
fEndMarkup(endMarkup) { }
- virtual MarkupStyle *clone() const;
+ virtual MarkupStyle *clone() const;
protected:
virtual UnicodeString &format(
const UnicodeString &original,
@@ -216,7 +216,7 @@ U_NAMESPACE_END
#endif /* !UCONFIG_NO_FORMATTING */
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/search.h b/contrib/libs/icu/include/unicode/search.h
index 43f811b935..2865366a33 100644
--- a/contrib/libs/icu/include/unicode/search.h
+++ b/contrib/libs/icu/include/unicode/search.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -14,8 +14,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: SearchIterator object.
@@ -72,7 +72,7 @@ U_NAMESPACE_BEGIN
* UErrorCode error = U_ZERO_ERROR;
* for (int pos = iter->first(error); pos != USEARCH_DONE;
* pos = iter->next(error)) {
- * printf("Found match at %d pos, length is %d\n", pos, iter.getMatchedLength());
+ * printf("Found match at %d pos, length is %d\n", pos, iter.getMatchedLength());
* }
* </code></pre>
*
@@ -574,7 +574,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_COLLATION */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/selfmt.h b/contrib/libs/icu/include/unicode/selfmt.h
index 3ae0a5717f..9b98f6db7a 100644
--- a/contrib/libs/icu/include/unicode/selfmt.h
+++ b/contrib/libs/icu/include/unicode/selfmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************
* COPYRIGHT:
@@ -18,10 +18,10 @@
#ifndef SELFMT
#define SELFMT
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/messagepattern.h"
#include "unicode/numfmt.h"
@@ -275,7 +275,7 @@ public:
* result and should delete it when done.
* @stable ICU 4.4
*/
- virtual SelectFormat* clone() const;
+ virtual SelectFormat* clone() const;
/**
* Format an object to produce a string.
@@ -368,7 +368,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _SELFMT
//eof
diff --git a/contrib/libs/icu/include/unicode/simpleformatter.h b/contrib/libs/icu/include/unicode/simpleformatter.h
index 88a211ce66..9414bca308 100644
--- a/contrib/libs/icu/include/unicode/simpleformatter.h
+++ b/contrib/libs/icu/include/unicode/simpleformatter.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -17,20 +17,20 @@
*/
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/unistr.h"
U_NAMESPACE_BEGIN
-// Forward declaration:
-namespace number {
-namespace impl {
-class SimpleModifier;
-}
-}
-
+// Forward declaration:
+namespace number {
+namespace impl {
+class SimpleModifier;
+}
+}
+
/**
* Formats simple patterns like "{1} was born in {0}".
* Minimal subset of MessageFormat; fast, simple, minimal dependencies.
@@ -57,15 +57,15 @@ class SimpleModifier;
*
* @see MessageFormat
* @see UMessagePatternApostropheMode
- * @stable ICU 57
+ * @stable ICU 57
*/
class U_COMMON_API SimpleFormatter U_FINAL : public UMemory {
public:
/**
* Default constructor.
- * @stable ICU 57
+ * @stable ICU 57
*/
- SimpleFormatter() : compiledPattern((char16_t)0) {}
+ SimpleFormatter() : compiledPattern((char16_t)0) {}
/**
* Constructs a formatter from the pattern string.
@@ -74,7 +74,7 @@ public:
* @param errorCode ICU error code in/out parameter.
* Must fulfill U_SUCCESS before the function call.
* Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax.
- * @stable ICU 57
+ * @stable ICU 57
*/
SimpleFormatter(const UnicodeString& pattern, UErrorCode &errorCode) {
applyPattern(pattern, errorCode);
@@ -92,7 +92,7 @@ public:
* Must fulfill U_SUCCESS before the function call.
* Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax and
* too few or too many arguments.
- * @stable ICU 57
+ * @stable ICU 57
*/
SimpleFormatter(const UnicodeString& pattern, int32_t min, int32_t max,
UErrorCode &errorCode) {
@@ -101,20 +101,20 @@ public:
/**
* Copy constructor.
- * @stable ICU 57
+ * @stable ICU 57
*/
SimpleFormatter(const SimpleFormatter& other)
: compiledPattern(other.compiledPattern) {}
/**
* Assignment operator.
- * @stable ICU 57
+ * @stable ICU 57
*/
SimpleFormatter &operator=(const SimpleFormatter& other);
/**
* Destructor.
- * @stable ICU 57
+ * @stable ICU 57
*/
~SimpleFormatter();
@@ -126,7 +126,7 @@ public:
* Must fulfill U_SUCCESS before the function call.
* Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax.
* @return TRUE if U_SUCCESS(errorCode).
- * @stable ICU 57
+ * @stable ICU 57
*/
UBool applyPattern(const UnicodeString &pattern, UErrorCode &errorCode) {
return applyPatternMinMaxArguments(pattern, 0, INT32_MAX, errorCode);
@@ -145,14 +145,14 @@ public:
* Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax and
* too few or too many arguments.
* @return TRUE if U_SUCCESS(errorCode).
- * @stable ICU 57
+ * @stable ICU 57
*/
UBool applyPatternMinMaxArguments(const UnicodeString &pattern,
int32_t min, int32_t max, UErrorCode &errorCode);
/**
* @return The max argument number + 1.
- * @stable ICU 57
+ * @stable ICU 57
*/
int32_t getArgumentLimit() const {
return getArgumentLimit(compiledPattern.getBuffer(), compiledPattern.length());
@@ -168,7 +168,7 @@ public:
* @param errorCode ICU error code in/out parameter.
* Must fulfill U_SUCCESS before the function call.
* @return appendTo
- * @stable ICU 57
+ * @stable ICU 57
*/
UnicodeString &format(
const UnicodeString &value0,
@@ -185,7 +185,7 @@ public:
* @param errorCode ICU error code in/out parameter.
* Must fulfill U_SUCCESS before the function call.
* @return appendTo
- * @stable ICU 57
+ * @stable ICU 57
*/
UnicodeString &format(
const UnicodeString &value0,
@@ -204,7 +204,7 @@ public:
* @param errorCode ICU error code in/out parameter.
* Must fulfill U_SUCCESS before the function call.
* @return appendTo
- * @stable ICU 57
+ * @stable ICU 57
*/
UnicodeString &format(
const UnicodeString &value0,
@@ -229,7 +229,7 @@ public:
* @param errorCode ICU error code in/out parameter.
* Must fulfill U_SUCCESS before the function call.
* @return appendTo
- * @stable ICU 57
+ * @stable ICU 57
*/
UnicodeString &formatAndAppend(
const UnicodeString *const *values, int32_t valuesLength,
@@ -255,7 +255,7 @@ public:
* @param errorCode ICU error code in/out parameter.
* Must fulfill U_SUCCESS before the function call.
* @return result
- * @stable ICU 57
+ * @stable ICU 57
*/
UnicodeString &formatAndReplace(
const UnicodeString *const *values, int32_t valuesLength,
@@ -265,41 +265,41 @@ public:
/**
* Returns the pattern text with none of the arguments.
* Like formatting with all-empty string values.
- * @stable ICU 57
+ * @stable ICU 57
*/
UnicodeString getTextWithNoArguments() const {
- return getTextWithNoArguments(
- compiledPattern.getBuffer(),
- compiledPattern.length(),
- nullptr,
- 0);
+ return getTextWithNoArguments(
+ compiledPattern.getBuffer(),
+ compiledPattern.length(),
+ nullptr,
+ 0);
}
-#ifndef U_HIDE_INTERNAL_API
- /**
- * Returns the pattern text with none of the arguments.
- * Like formatting with all-empty string values.
- *
- * TODO(ICU-20406): Replace this with an Iterator interface.
- *
- * @param offsets offsets[i] receives the offset of where {i} was located
- * before it was replaced by an empty string.
- * For example, "a{0}b{1}" produces offset 1 for i=0 and 2 for i=1.
- * Can be nullptr if offsetsLength==0.
- * If there is no {i} in the pattern, then offsets[i] is set to -1.
- * @param offsetsLength The length of the offsets array.
- *
- * @internal
- */
- UnicodeString getTextWithNoArguments(int32_t *offsets, int32_t offsetsLength) const {
- return getTextWithNoArguments(
- compiledPattern.getBuffer(),
- compiledPattern.length(),
- offsets,
- offsetsLength);
- }
-#endif // U_HIDE_INTERNAL_API
-
+#ifndef U_HIDE_INTERNAL_API
+ /**
+ * Returns the pattern text with none of the arguments.
+ * Like formatting with all-empty string values.
+ *
+ * TODO(ICU-20406): Replace this with an Iterator interface.
+ *
+ * @param offsets offsets[i] receives the offset of where {i} was located
+ * before it was replaced by an empty string.
+ * For example, "a{0}b{1}" produces offset 1 for i=0 and 2 for i=1.
+ * Can be nullptr if offsetsLength==0.
+ * If there is no {i} in the pattern, then offsets[i] is set to -1.
+ * @param offsetsLength The length of the offsets array.
+ *
+ * @internal
+ */
+ UnicodeString getTextWithNoArguments(int32_t *offsets, int32_t offsetsLength) const {
+ return getTextWithNoArguments(
+ compiledPattern.getBuffer(),
+ compiledPattern.length(),
+ offsets,
+ offsetsLength);
+ }
+#endif // U_HIDE_INTERNAL_API
+
private:
/**
* Binary representation of the compiled pattern.
@@ -312,30 +312,30 @@ private:
*/
UnicodeString compiledPattern;
- static inline int32_t getArgumentLimit(const char16_t *compiledPattern,
+ static inline int32_t getArgumentLimit(const char16_t *compiledPattern,
int32_t compiledPatternLength) {
return compiledPatternLength == 0 ? 0 : compiledPattern[0];
}
- static UnicodeString getTextWithNoArguments(
- const char16_t *compiledPattern,
- int32_t compiledPatternLength,
- int32_t *offsets,
- int32_t offsetsLength);
+ static UnicodeString getTextWithNoArguments(
+ const char16_t *compiledPattern,
+ int32_t compiledPatternLength,
+ int32_t *offsets,
+ int32_t offsetsLength);
static UnicodeString &format(
- const char16_t *compiledPattern, int32_t compiledPatternLength,
+ const char16_t *compiledPattern, int32_t compiledPatternLength,
const UnicodeString *const *values,
UnicodeString &result, const UnicodeString *resultCopy, UBool forbidResultAsValue,
int32_t *offsets, int32_t offsetsLength,
UErrorCode &errorCode);
-
- // Give access to internals to SimpleModifier for number formatting
- friend class number::impl::SimpleModifier;
+
+ // Give access to internals to SimpleModifier for number formatting
+ friend class number::impl::SimpleModifier;
};
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
+#endif /* U_SHOW_CPLUSPLUS_API */
#endif // __SIMPLEFORMATTER_H__
diff --git a/contrib/libs/icu/include/unicode/simpletz.h b/contrib/libs/icu/include/unicode/simpletz.h
index b7c06635a8..980a1b8c62 100644
--- a/contrib/libs/icu/include/unicode/simpletz.h
+++ b/contrib/libs/icu/include/unicode/simpletz.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -28,8 +28,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: SimpleTimeZone is a concrete subclass of TimeZone.
@@ -649,8 +649,8 @@ public:
* Sets the amount of time in ms that the clock is advanced during DST.
* @param millisSavedDuringDST the number of milliseconds the time is
* advanced with respect to standard time when the daylight savings rules
- * are in effect. Typically one hour (+3600000). The amount could be negative,
- * but not 0.
+ * are in effect. Typically one hour (+3600000). The amount could be negative,
+ * but not 0.
* @param status An UErrorCode to receive the status.
* @stable ICU 2.0
*/
@@ -660,8 +660,8 @@ public:
* Returns the amount of time in ms that the clock is advanced during DST.
* @return the number of milliseconds the time is
* advanced with respect to standard time when the daylight savings rules
- * are in effect. Typically one hour (+3600000). The amount could be negative,
- * but not 0.
+ * are in effect. Typically one hour (+3600000). The amount could be negative,
+ * but not 0.
* @stable ICU 2.0
*/
virtual int32_t getDSTSavings(void) const;
@@ -674,7 +674,7 @@ public:
*/
virtual UBool useDaylightTime(void) const;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Returns true if the given date is within the period when daylight savings time
* is in effect; false otherwise. If the TimeZone doesn't observe daylight savings
@@ -690,7 +690,7 @@ public:
* @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead.
*/
virtual UBool inDaylightTime(UDate date, UErrorCode& status) const;
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Return true if this zone has the same rules and offset as another zone.
@@ -707,7 +707,7 @@ public:
* @return A new copy of this TimeZone object.
* @stable ICU 2.0
*/
- virtual SimpleTimeZone* clone() const;
+ virtual SimpleTimeZone* clone() const;
/**
* Gets the first time zone transition after the base time.
@@ -933,6 +933,6 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _SIMPLETZ
diff --git a/contrib/libs/icu/include/unicode/smpdtfmt.h b/contrib/libs/icu/include/unicode/smpdtfmt.h
index c0b12d801d..b4b0e5fb39 100644
--- a/contrib/libs/icu/include/unicode/smpdtfmt.h
+++ b/contrib/libs/icu/include/unicode/smpdtfmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
* Copyright (C) 1997-2016, International Business Machines Corporation and
@@ -28,8 +28,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: Format and parse dates in a language-independent manner.
@@ -51,12 +51,12 @@ class FieldPositionHandler;
class TimeZoneFormat;
class SharedNumberFormat;
class SimpleDateFormatMutableNFs;
-class DateIntervalFormat;
+class DateIntervalFormat;
+
+namespace number {
+class LocalizedNumberFormatter;
+}
-namespace number {
-class LocalizedNumberFormatter;
-}
-
/**
*
* SimpleDateFormat is a concrete class for formatting and parsing dates in a
@@ -867,7 +867,7 @@ public:
* @return A copy of the object.
* @stable ICU 2.0
*/
- virtual SimpleDateFormat* clone() const;
+ virtual SimpleDateFormat* clone() const;
/**
* Return true if the given Format objects are semantically equal. Objects
@@ -1150,7 +1150,7 @@ public:
* Overrides base class method and
* This method clears per field NumberFormat instances
* previously set by {@see adoptNumberFormat(const UnicodeString&, NumberFormat*, UErrorCode)}
- * @param formatToAdopt the NumbeferFormat used
+ * @param formatToAdopt the NumbeferFormat used
* @stable ICU 54
*/
void adoptNumberFormat(NumberFormat *formatToAdopt);
@@ -1165,7 +1165,7 @@ public:
* Per field NumberFormat can also be cleared in {@see DateFormat::setNumberFormat(const NumberFormat& newNumberFormat)}
*
* @param fields the fields to override(like y)
- * @param formatToAdopt the NumbeferFormat used
+ * @param formatToAdopt the NumbeferFormat used
* @param status Receives a status code, which will be U_ZERO_ERROR
* if the operation succeeds.
* @stable ICU 54
@@ -1177,7 +1177,7 @@ public:
* @param field The UDateFormatField to get
* @stable ICU 54
*/
- const NumberFormat * getNumberFormatForField(char16_t field) const;
+ const NumberFormat * getNumberFormatForField(char16_t field) const;
#ifndef U_HIDE_INTERNAL_API
/**
@@ -1220,7 +1220,7 @@ public:
private:
friend class DateFormat;
- friend class DateIntervalFormat;
+ friend class DateIntervalFormat;
void initializeDefaultCentury(void);
@@ -1270,11 +1270,11 @@ private:
* succeeds.
*/
void subFormat(UnicodeString &appendTo,
- char16_t ch,
+ char16_t ch,
int32_t count,
UDisplayContext capitalizationContext,
int32_t fieldNum,
- char16_t fieldToOutput,
+ char16_t fieldToOutput,
FieldPositionHandler& handler,
Calendar& cal,
UErrorCode& status) const; // in case of illegal argument
@@ -1292,7 +1292,7 @@ private:
* @param minDigits Minimum number of digits the result should have
* @param maxDigits Maximum number of digits the result should have
*/
- void zeroPaddingNumber(const NumberFormat *currentNumberFormat,
+ void zeroPaddingNumber(const NumberFormat *currentNumberFormat,
UnicodeString &appendTo,
int32_t value,
int32_t minDigits,
@@ -1302,7 +1302,7 @@ private:
* Return true if the given format character, occuring count
* times, represents a numeric field.
*/
- static UBool isNumeric(char16_t formatChar, int32_t count);
+ static UBool isNumeric(char16_t formatChar, int32_t count);
/**
* Returns TRUE if the patternOffset is at the start of a numeric field.
@@ -1420,38 +1420,38 @@ private:
* @return the new start position if matching succeeded; a negative number
* indicating matching failure, otherwise.
*/
- int32_t subParse(const UnicodeString& text, int32_t& start, char16_t ch, int32_t count,
+ int32_t subParse(const UnicodeString& text, int32_t& start, char16_t ch, int32_t count,
UBool obeyCount, UBool allowNegative, UBool ambiguousYear[], int32_t& saveHebrewMonth, Calendar& cal,
- int32_t patLoc, MessageFormat * numericLeapMonthFormatter, UTimeZoneFormatTimeType *tzTimeType,
+ int32_t patLoc, MessageFormat * numericLeapMonthFormatter, UTimeZoneFormatTimeType *tzTimeType,
int32_t *dayPeriod=NULL) const;
void parseInt(const UnicodeString& text,
Formattable& number,
ParsePosition& pos,
UBool allowNegative,
- const NumberFormat *fmt) const;
+ const NumberFormat *fmt) const;
void parseInt(const UnicodeString& text,
Formattable& number,
int32_t maxDigits,
ParsePosition& pos,
UBool allowNegative,
- const NumberFormat *fmt) const;
+ const NumberFormat *fmt) const;
int32_t checkIntSuffix(const UnicodeString& text, int32_t start,
int32_t patLoc, UBool isNegative) const;
/**
- * Counts number of digit code points in the specified text.
- *
- * @param text input text
- * @param start start index, inclusive
- * @param end end index, exclusive
- * @return number of digits found in the text in the specified range.
- */
- int32_t countDigits(const UnicodeString& text, int32_t start, int32_t end) const;
-
- /**
+ * Counts number of digit code points in the specified text.
+ *
+ * @param text input text
+ * @param start start index, inclusive
+ * @param end end index, exclusive
+ * @return number of digits found in the text in the specified range.
+ */
+ int32_t countDigits(const UnicodeString& text, int32_t start, int32_t end) const;
+
+ /**
* Translate a pattern, mapping each character in the from string to the
* corresponding character in the to string. Return an error if the original
* pattern contains an unmapped character, or if a quote is unmatched.
@@ -1504,16 +1504,16 @@ private:
int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos) const;
/**
- * Initialize LocalizedNumberFormatter instances used for speedup.
- */
- void initFastNumberFormatters(UErrorCode& status);
-
- /**
- * Delete the LocalizedNumberFormatter instances used for speedup.
- */
- void freeFastNumberFormatters();
-
- /**
+ * Initialize LocalizedNumberFormatter instances used for speedup.
+ */
+ void initFastNumberFormatters(UErrorCode& status);
+
+ /**
+ * Delete the LocalizedNumberFormatter instances used for speedup.
+ */
+ void freeFastNumberFormatters();
+
+ /**
* Initialize NumberFormat instances used for numbering system overrides.
*/
void initNumberFormatters(const Locale &locale,UErrorCode &status);
@@ -1536,7 +1536,7 @@ private:
/**
* Lazy TimeZoneFormat instantiation, semantically const
*/
- TimeZoneFormat *tzFormat(UErrorCode &status) const;
+ TimeZoneFormat *tzFormat(UErrorCode &status) const;
const NumberFormat* getNumberFormatByIndex(UDateFormatField index) const;
@@ -1551,12 +1551,12 @@ private:
/**
* Map calendar field letter into calendar field level.
*/
- static int32_t getLevelFromChar(char16_t ch);
+ static int32_t getLevelFromChar(char16_t ch);
/**
* Tell if a character can be used to define a field in a format string.
*/
- static UBool isSyntaxChar(char16_t ch);
+ static UBool isSyntaxChar(char16_t ch);
/**
* The formatting pattern for this formatter.
@@ -1602,7 +1602,7 @@ private:
UBool fHasMinute;
UBool fHasSecond;
- UBool fHasHanYearChar; // pattern contains the Han year character \u5E74
+ UBool fHasHanYearChar; // pattern contains the Han year character \u5E74
/**
* Sets fHasMinutes and fHasSeconds.
@@ -1630,23 +1630,23 @@ private:
*/
const SharedNumberFormat **fSharedNumberFormatters;
- enum NumberFormatterKey {
- SMPDTFMT_NF_1x10,
- SMPDTFMT_NF_2x10,
- SMPDTFMT_NF_3x10,
- SMPDTFMT_NF_4x10,
- SMPDTFMT_NF_2x2,
- SMPDTFMT_NF_COUNT
- };
-
- /**
- * Number formatters pre-allocated for fast performance on the most common integer lengths.
- */
- const number::LocalizedNumberFormatter* fFastNumberFormatters[SMPDTFMT_NF_COUNT] = {};
-
+ enum NumberFormatterKey {
+ SMPDTFMT_NF_1x10,
+ SMPDTFMT_NF_2x10,
+ SMPDTFMT_NF_3x10,
+ SMPDTFMT_NF_4x10,
+ SMPDTFMT_NF_2x2,
+ SMPDTFMT_NF_COUNT
+ };
+
+ /**
+ * Number formatters pre-allocated for fast performance on the most common integer lengths.
+ */
+ const number::LocalizedNumberFormatter* fFastNumberFormatters[SMPDTFMT_NF_COUNT] = {};
+
UBool fHaveDefaultCentury;
- const BreakIterator* fCapitalizationBrkIter;
+ const BreakIterator* fCapitalizationBrkIter;
};
inline UDate
@@ -1659,7 +1659,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // _SMPDTFMT
//eof
diff --git a/contrib/libs/icu/include/unicode/sortkey.h b/contrib/libs/icu/include/unicode/sortkey.h
index 25c59f82f4..34ed7ee692 100644
--- a/contrib/libs/icu/include/unicode/sortkey.h
+++ b/contrib/libs/icu/include/unicode/sortkey.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************
@@ -25,8 +25,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: Keys for comparing strings multiple times.
@@ -339,6 +339,6 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_COLLATION */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/std_string.h b/contrib/libs/icu/include/unicode/std_string.h
index d4311cadc1..bf87230167 100644
--- a/contrib/libs/icu/include/unicode/std_string.h
+++ b/contrib/libs/icu/include/unicode/std_string.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: std_string.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -27,15 +27,15 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
+#if U_SHOW_CPLUSPLUS_API
-// Workaround for a libstdc++ bug before libstdc++4.6 (2011).
-// https://bugs.llvm.org/show_bug.cgi?id=13364
-#if defined(__GLIBCXX__)
-namespace std { class type_info; }
+// Workaround for a libstdc++ bug before libstdc++4.6 (2011).
+// https://bugs.llvm.org/show_bug.cgi?id=13364
+#if defined(__GLIBCXX__)
+namespace std { class type_info; }
#endif
#include <string>
-#endif /* U_SHOW_CPLUSPLUS_API */
+#endif /* U_SHOW_CPLUSPLUS_API */
#endif // __STD_STRING_H__
diff --git a/contrib/libs/icu/include/unicode/strenum.h b/contrib/libs/icu/include/unicode/strenum.h
index b522c099cd..8601f1f7c4 100644
--- a/contrib/libs/icu/include/unicode/strenum.h
+++ b/contrib/libs/icu/include/unicode/strenum.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -12,10 +12,10 @@
#ifndef STRENUM_H
#define STRENUM_H
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
#include "unicode/unistr.h"
@@ -39,7 +39,7 @@ U_NAMESPACE_BEGIN
* call, so the returned string still might not be 'valid' on
* subsequent use.</p>
*
- * <p>Strings may take the form of const char*, const char16_t*, or const
+ * <p>Strings may take the form of const char*, const char16_t*, or const
* UnicodeString*. The type you get is determine by the variant of
* 'next' that you call. In general the StringEnumeration is
* optimized for one of these types, but all StringEnumerations can
@@ -113,7 +113,7 @@ public:
* <p>If the iterator is out of sync with its service, status is set
* to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.</p>
*
- * <p>If the native service string is a char16_t* string, it is
+ * <p>If the native service string is a char16_t* string, it is
* converted to char* with the invariant converter. If the
* conversion fails (because a character cannot be converted) then
* status is set to U_INVARIANT_CONVERSION_ERROR and the return
@@ -132,7 +132,7 @@ public:
virtual const char* next(int32_t *resultLength, UErrorCode& status);
/**
- * <p>Returns the next element as a NUL-terminated char16_t*. If there
+ * <p>Returns the next element as a NUL-terminated char16_t*. If there
* are no more elements, returns NULL. If the resultLength pointer
* is not NULL, the length of the string (not counting the
* terminating NUL) is returned at that address. If an error
@@ -154,7 +154,7 @@ public:
*
* @stable ICU 2.4
*/
- virtual const char16_t* unext(int32_t *resultLength, UErrorCode& status);
+ virtual const char16_t* unext(int32_t *resultLength, UErrorCode& status);
/**
* <p>Returns the next element a UnicodeString*. If there are no
@@ -275,7 +275,7 @@ protected:
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
/* STRENUM_H */
#endif
diff --git a/contrib/libs/icu/include/unicode/stringoptions.h b/contrib/libs/icu/include/unicode/stringoptions.h
index ec6b6f65d3..7b9f70944f 100644
--- a/contrib/libs/icu/include/unicode/stringoptions.h
+++ b/contrib/libs/icu/include/unicode/stringoptions.h
@@ -1,190 +1,190 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// stringoptions.h
-// created: 2017jun08 Markus W. Scherer
-
-#ifndef __STRINGOPTIONS_H__
-#define __STRINGOPTIONS_H__
-
-#include "unicode/utypes.h"
-
-/**
- * \file
- * \brief C API: Bit set option bit constants for various string and character processing functions.
- */
-
-/**
- * Option value for case folding: Use default mappings defined in CaseFolding.txt.
- *
- * @stable ICU 2.0
- */
-#define U_FOLD_CASE_DEFAULT 0
-
-/**
- * Option value for case folding:
- *
- * Use the modified set of mappings provided in CaseFolding.txt to handle dotted I
- * and dotless i appropriately for Turkic languages (tr, az).
- *
- * Before Unicode 3.2, CaseFolding.txt contains mappings marked with 'I' that
- * are to be included for default mappings and
- * excluded for the Turkic-specific mappings.
- *
- * Unicode 3.2 CaseFolding.txt instead contains mappings marked with 'T' that
- * are to be excluded for default mappings and
- * included for the Turkic-specific mappings.
- *
- * @stable ICU 2.0
- */
-#define U_FOLD_CASE_EXCLUDE_SPECIAL_I 1
-
-/**
- * Titlecase the string as a whole rather than each word.
- * (Titlecase only the character at index 0, possibly adjusted.)
- * Option bits value for titlecasing APIs that take an options bit set.
- *
- * It is an error to specify multiple titlecasing iterator options together,
- * including both an options bit and an explicit BreakIterator.
- *
- * @see U_TITLECASE_ADJUST_TO_CASED
- * @stable ICU 60
- */
-#define U_TITLECASE_WHOLE_STRING 0x20
-
-/**
- * Titlecase sentences rather than words.
- * (Titlecase only the first character of each sentence, possibly adjusted.)
- * Option bits value for titlecasing APIs that take an options bit set.
- *
- * It is an error to specify multiple titlecasing iterator options together,
- * including both an options bit and an explicit BreakIterator.
- *
- * @see U_TITLECASE_ADJUST_TO_CASED
- * @stable ICU 60
- */
-#define U_TITLECASE_SENTENCES 0x40
-
-/**
- * Do not lowercase non-initial parts of words when titlecasing.
- * Option bit for titlecasing APIs that take an options bit set.
- *
- * By default, titlecasing will titlecase the character at each
- * (possibly adjusted) BreakIterator index and
- * lowercase all other characters up to the next iterator index.
- * With this option, the other characters will not be modified.
- *
- * @see U_TITLECASE_ADJUST_TO_CASED
- * @see UnicodeString::toTitle
- * @see CaseMap::toTitle
- * @see ucasemap_setOptions
- * @see ucasemap_toTitle
- * @see ucasemap_utf8ToTitle
- * @stable ICU 3.8
- */
-#define U_TITLECASE_NO_LOWERCASE 0x100
-
-/**
- * Do not adjust the titlecasing BreakIterator indexes;
- * titlecase exactly the characters at breaks from the iterator.
- * Option bit for titlecasing APIs that take an options bit set.
- *
- * By default, titlecasing will take each break iterator index,
- * adjust it to the next relevant character (see U_TITLECASE_ADJUST_TO_CASED),
- * and titlecase that one.
- *
- * Other characters are lowercased.
- *
- * It is an error to specify multiple titlecasing adjustment options together.
- *
- * @see U_TITLECASE_ADJUST_TO_CASED
- * @see U_TITLECASE_NO_LOWERCASE
- * @see UnicodeString::toTitle
- * @see CaseMap::toTitle
- * @see ucasemap_setOptions
- * @see ucasemap_toTitle
- * @see ucasemap_utf8ToTitle
- * @stable ICU 3.8
- */
-#define U_TITLECASE_NO_BREAK_ADJUSTMENT 0x200
-
-/**
- * Adjust each titlecasing BreakIterator index to the next cased character.
- * (See the Unicode Standard, chapter 3, Default Case Conversion, R3 toTitlecase(X).)
- * Option bit for titlecasing APIs that take an options bit set.
- *
- * This used to be the default index adjustment in ICU.
- * Since ICU 60, the default index adjustment is to the next character that is
- * a letter, number, symbol, or private use code point.
- * (Uncased modifier letters are skipped.)
- * The difference in behavior is small for word titlecasing,
- * but the new adjustment is much better for whole-string and sentence titlecasing:
- * It yields "49ers" and "«丰(abc)»" instead of "49Ers" and "«丰(Abc)»".
- *
- * It is an error to specify multiple titlecasing adjustment options together.
- *
- * @see U_TITLECASE_NO_BREAK_ADJUSTMENT
- * @stable ICU 60
- */
-#define U_TITLECASE_ADJUST_TO_CASED 0x400
-
-/**
- * Option for string transformation functions to not first reset the Edits object.
- * Used for example in some case-mapping and normalization functions.
- *
- * @see CaseMap
- * @see Edits
- * @see Normalizer2
- * @stable ICU 60
- */
-#define U_EDITS_NO_RESET 0x2000
-
-/**
- * Omit unchanged text when recording how source substrings
- * relate to changed and unchanged result substrings.
- * Used for example in some case-mapping and normalization functions.
- *
- * @see CaseMap
- * @see Edits
- * @see Normalizer2
- * @stable ICU 60
- */
-#define U_OMIT_UNCHANGED_TEXT 0x4000
-
-/**
- * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc:
- * Compare strings in code point order instead of code unit order.
- * @stable ICU 2.2
- */
-#define U_COMPARE_CODE_POINT_ORDER 0x8000
-
-/**
- * Option bit for unorm_compare:
- * Perform case-insensitive comparison.
- * @stable ICU 2.2
- */
-#define U_COMPARE_IGNORE_CASE 0x10000
-
-/**
- * Option bit for unorm_compare:
- * Both input strings are assumed to fulfill FCD conditions.
- * @stable ICU 2.2
- */
-#define UNORM_INPUT_IS_FCD 0x20000
-
-// Related definitions elsewhere.
-// Options that are not meaningful in the same functions
-// can share the same bits.
-//
-// Public:
-// unicode/unorm.h #define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20
-//
-// Internal: (may change or be removed)
-// ucase.h #define _STRCASECMP_OPTIONS_MASK 0xffff
-// ucase.h #define _FOLD_CASE_OPTIONS_MASK 7
-// ucasemap_imp.h #define U_TITLECASE_ITERATOR_MASK 0xe0
-// ucasemap_imp.h #define U_TITLECASE_ADJUSTMENT_MASK 0x600
-// ustr_imp.h #define _STRNCMP_STYLE 0x1000
-// unormcmp.cpp #define _COMPARE_EQUIV 0x80000
-
-#endif // __STRINGOPTIONS_H__
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// stringoptions.h
+// created: 2017jun08 Markus W. Scherer
+
+#ifndef __STRINGOPTIONS_H__
+#define __STRINGOPTIONS_H__
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C API: Bit set option bit constants for various string and character processing functions.
+ */
+
+/**
+ * Option value for case folding: Use default mappings defined in CaseFolding.txt.
+ *
+ * @stable ICU 2.0
+ */
+#define U_FOLD_CASE_DEFAULT 0
+
+/**
+ * Option value for case folding:
+ *
+ * Use the modified set of mappings provided in CaseFolding.txt to handle dotted I
+ * and dotless i appropriately for Turkic languages (tr, az).
+ *
+ * Before Unicode 3.2, CaseFolding.txt contains mappings marked with 'I' that
+ * are to be included for default mappings and
+ * excluded for the Turkic-specific mappings.
+ *
+ * Unicode 3.2 CaseFolding.txt instead contains mappings marked with 'T' that
+ * are to be excluded for default mappings and
+ * included for the Turkic-specific mappings.
+ *
+ * @stable ICU 2.0
+ */
+#define U_FOLD_CASE_EXCLUDE_SPECIAL_I 1
+
+/**
+ * Titlecase the string as a whole rather than each word.
+ * (Titlecase only the character at index 0, possibly adjusted.)
+ * Option bits value for titlecasing APIs that take an options bit set.
+ *
+ * It is an error to specify multiple titlecasing iterator options together,
+ * including both an options bit and an explicit BreakIterator.
+ *
+ * @see U_TITLECASE_ADJUST_TO_CASED
+ * @stable ICU 60
+ */
+#define U_TITLECASE_WHOLE_STRING 0x20
+
+/**
+ * Titlecase sentences rather than words.
+ * (Titlecase only the first character of each sentence, possibly adjusted.)
+ * Option bits value for titlecasing APIs that take an options bit set.
+ *
+ * It is an error to specify multiple titlecasing iterator options together,
+ * including both an options bit and an explicit BreakIterator.
+ *
+ * @see U_TITLECASE_ADJUST_TO_CASED
+ * @stable ICU 60
+ */
+#define U_TITLECASE_SENTENCES 0x40
+
+/**
+ * Do not lowercase non-initial parts of words when titlecasing.
+ * Option bit for titlecasing APIs that take an options bit set.
+ *
+ * By default, titlecasing will titlecase the character at each
+ * (possibly adjusted) BreakIterator index and
+ * lowercase all other characters up to the next iterator index.
+ * With this option, the other characters will not be modified.
+ *
+ * @see U_TITLECASE_ADJUST_TO_CASED
+ * @see UnicodeString::toTitle
+ * @see CaseMap::toTitle
+ * @see ucasemap_setOptions
+ * @see ucasemap_toTitle
+ * @see ucasemap_utf8ToTitle
+ * @stable ICU 3.8
+ */
+#define U_TITLECASE_NO_LOWERCASE 0x100
+
+/**
+ * Do not adjust the titlecasing BreakIterator indexes;
+ * titlecase exactly the characters at breaks from the iterator.
+ * Option bit for titlecasing APIs that take an options bit set.
+ *
+ * By default, titlecasing will take each break iterator index,
+ * adjust it to the next relevant character (see U_TITLECASE_ADJUST_TO_CASED),
+ * and titlecase that one.
+ *
+ * Other characters are lowercased.
+ *
+ * It is an error to specify multiple titlecasing adjustment options together.
+ *
+ * @see U_TITLECASE_ADJUST_TO_CASED
+ * @see U_TITLECASE_NO_LOWERCASE
+ * @see UnicodeString::toTitle
+ * @see CaseMap::toTitle
+ * @see ucasemap_setOptions
+ * @see ucasemap_toTitle
+ * @see ucasemap_utf8ToTitle
+ * @stable ICU 3.8
+ */
+#define U_TITLECASE_NO_BREAK_ADJUSTMENT 0x200
+
+/**
+ * Adjust each titlecasing BreakIterator index to the next cased character.
+ * (See the Unicode Standard, chapter 3, Default Case Conversion, R3 toTitlecase(X).)
+ * Option bit for titlecasing APIs that take an options bit set.
+ *
+ * This used to be the default index adjustment in ICU.
+ * Since ICU 60, the default index adjustment is to the next character that is
+ * a letter, number, symbol, or private use code point.
+ * (Uncased modifier letters are skipped.)
+ * The difference in behavior is small for word titlecasing,
+ * but the new adjustment is much better for whole-string and sentence titlecasing:
+ * It yields "49ers" and "«丰(abc)»" instead of "49Ers" and "«丰(Abc)»".
+ *
+ * It is an error to specify multiple titlecasing adjustment options together.
+ *
+ * @see U_TITLECASE_NO_BREAK_ADJUSTMENT
+ * @stable ICU 60
+ */
+#define U_TITLECASE_ADJUST_TO_CASED 0x400
+
+/**
+ * Option for string transformation functions to not first reset the Edits object.
+ * Used for example in some case-mapping and normalization functions.
+ *
+ * @see CaseMap
+ * @see Edits
+ * @see Normalizer2
+ * @stable ICU 60
+ */
+#define U_EDITS_NO_RESET 0x2000
+
+/**
+ * Omit unchanged text when recording how source substrings
+ * relate to changed and unchanged result substrings.
+ * Used for example in some case-mapping and normalization functions.
+ *
+ * @see CaseMap
+ * @see Edits
+ * @see Normalizer2
+ * @stable ICU 60
+ */
+#define U_OMIT_UNCHANGED_TEXT 0x4000
+
+/**
+ * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc:
+ * Compare strings in code point order instead of code unit order.
+ * @stable ICU 2.2
+ */
+#define U_COMPARE_CODE_POINT_ORDER 0x8000
+
+/**
+ * Option bit for unorm_compare:
+ * Perform case-insensitive comparison.
+ * @stable ICU 2.2
+ */
+#define U_COMPARE_IGNORE_CASE 0x10000
+
+/**
+ * Option bit for unorm_compare:
+ * Both input strings are assumed to fulfill FCD conditions.
+ * @stable ICU 2.2
+ */
+#define UNORM_INPUT_IS_FCD 0x20000
+
+// Related definitions elsewhere.
+// Options that are not meaningful in the same functions
+// can share the same bits.
+//
+// Public:
+// unicode/unorm.h #define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20
+//
+// Internal: (may change or be removed)
+// ucase.h #define _STRCASECMP_OPTIONS_MASK 0xffff
+// ucase.h #define _FOLD_CASE_OPTIONS_MASK 7
+// ucasemap_imp.h #define U_TITLECASE_ITERATOR_MASK 0xe0
+// ucasemap_imp.h #define U_TITLECASE_ADJUSTMENT_MASK 0x600
+// ustr_imp.h #define _STRNCMP_STYLE 0x1000
+// unormcmp.cpp #define _COMPARE_EQUIV 0x80000
+
+#endif // __STRINGOPTIONS_H__
diff --git a/contrib/libs/icu/include/unicode/stringpiece.h b/contrib/libs/icu/include/unicode/stringpiece.h
index e5a7c56192..52c1e9ebd2 100644
--- a/contrib/libs/icu/include/unicode/stringpiece.h
+++ b/contrib/libs/icu/include/unicode/stringpiece.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
// Copyright (C) 2009-2013, International Business Machines
// Corporation and others. All Rights Reserved.
@@ -28,12 +28,12 @@
*/
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
-#include <cstddef>
-#include <type_traits>
-
+
+#if U_SHOW_CPLUSPLUS_API
+
+#include <cstddef>
+#include <type_traits>
+
#include "unicode/uobject.h"
#include "unicode/std_string.h"
@@ -67,107 +67,107 @@ class U_COMMON_API StringPiece : public UMemory {
* Default constructor, creates an empty StringPiece.
* @stable ICU 4.2
*/
- StringPiece() : ptr_(nullptr), length_(0) { }
-
+ StringPiece() : ptr_(nullptr), length_(0) { }
+
/**
* Constructs from a NUL-terminated const char * pointer.
* @param str a NUL-terminated const char * pointer
* @stable ICU 4.2
*/
StringPiece(const char* str);
-#ifndef U_HIDE_DRAFT_API
-#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN)
+#ifndef U_HIDE_DRAFT_API
+#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN)
+ /**
+ * Constructs from a NUL-terminated const char8_t * pointer.
+ * @param str a NUL-terminated const char8_t * pointer
+ * @draft ICU 67
+ */
+ StringPiece(const char8_t* str) : StringPiece(reinterpret_cast<const char*>(str)) {}
+#endif
+ /**
+ * Constructs an empty StringPiece.
+ * Needed for type disambiguation from multiple other overloads.
+ * @param p nullptr
+ * @draft ICU 67
+ */
+ StringPiece(std::nullptr_t p) : ptr_(p), length_(0) {}
+#endif // U_HIDE_DRAFT_API
+
/**
- * Constructs from a NUL-terminated const char8_t * pointer.
- * @param str a NUL-terminated const char8_t * pointer
- * @draft ICU 67
- */
- StringPiece(const char8_t* str) : StringPiece(reinterpret_cast<const char*>(str)) {}
-#endif
- /**
- * Constructs an empty StringPiece.
- * Needed for type disambiguation from multiple other overloads.
- * @param p nullptr
- * @draft ICU 67
- */
- StringPiece(std::nullptr_t p) : ptr_(p), length_(0) {}
-#endif // U_HIDE_DRAFT_API
-
- /**
* Constructs from a std::string.
* @stable ICU 4.2
*/
StringPiece(const std::string& str)
: ptr_(str.data()), length_(static_cast<int32_t>(str.size())) { }
-#ifndef U_HIDE_DRAFT_API
-#if defined(__cpp_lib_char8_t) || defined(U_IN_DOXYGEN)
- /**
- * Constructs from a std::u8string.
- * @draft ICU 67
- */
- StringPiece(const std::u8string& str)
- : ptr_(reinterpret_cast<const char*>(str.data())),
- length_(static_cast<int32_t>(str.size())) { }
+#ifndef U_HIDE_DRAFT_API
+#if defined(__cpp_lib_char8_t) || defined(U_IN_DOXYGEN)
+ /**
+ * Constructs from a std::u8string.
+ * @draft ICU 67
+ */
+ StringPiece(const std::u8string& str)
+ : ptr_(reinterpret_cast<const char*>(str.data())),
+ length_(static_cast<int32_t>(str.size())) { }
#endif
-#endif // U_HIDE_DRAFT_API
-
-#ifndef U_HIDE_DRAFT_API
+#endif // U_HIDE_DRAFT_API
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Constructs from some other implementation of a string piece class, from any
+ * C++ record type that has these two methods:
+ *
+ * \code{.cpp}
+ *
+ * struct OtherStringPieceClass {
+ * const char* data(); // or const char8_t*
+ * size_t size();
+ * };
+ *
+ * \endcode
+ *
+ * The other string piece class will typically be std::string_view from C++17
+ * or absl::string_view from Abseil.
+ *
+ * Starting with C++20, data() may also return a const char8_t* pointer,
+ * as from std::u8string_view.
+ *
+ * @param str the other string piece
+ * @draft ICU 65
+ */
+ template <typename T,
+ typename = typename std::enable_if<
+ (std::is_same<decltype(T().data()), const char*>::value
+#if defined(__cpp_char8_t)
+ || std::is_same<decltype(T().data()), const char8_t*>::value
+#endif
+ ) &&
+ std::is_same<decltype(T().size()), size_t>::value>::type>
+ StringPiece(T str)
+ : ptr_(reinterpret_cast<const char*>(str.data())),
+ length_(static_cast<int32_t>(str.size())) {}
+#endif // U_HIDE_DRAFT_API
+
/**
- * Constructs from some other implementation of a string piece class, from any
- * C++ record type that has these two methods:
- *
- * \code{.cpp}
- *
- * struct OtherStringPieceClass {
- * const char* data(); // or const char8_t*
- * size_t size();
- * };
- *
- * \endcode
- *
- * The other string piece class will typically be std::string_view from C++17
- * or absl::string_view from Abseil.
- *
- * Starting with C++20, data() may also return a const char8_t* pointer,
- * as from std::u8string_view.
- *
- * @param str the other string piece
- * @draft ICU 65
- */
- template <typename T,
- typename = typename std::enable_if<
- (std::is_same<decltype(T().data()), const char*>::value
-#if defined(__cpp_char8_t)
- || std::is_same<decltype(T().data()), const char8_t*>::value
-#endif
- ) &&
- std::is_same<decltype(T().size()), size_t>::value>::type>
- StringPiece(T str)
- : ptr_(reinterpret_cast<const char*>(str.data())),
- length_(static_cast<int32_t>(str.size())) {}
-#endif // U_HIDE_DRAFT_API
-
- /**
* Constructs from a const char * pointer and a specified length.
* @param offset a const char * pointer (need not be terminated)
* @param len the length of the string; must be non-negative
* @stable ICU 4.2
*/
StringPiece(const char* offset, int32_t len) : ptr_(offset), length_(len) { }
-#ifndef U_HIDE_DRAFT_API
-#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN)
+#ifndef U_HIDE_DRAFT_API
+#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN)
+ /**
+ * Constructs from a const char8_t * pointer and a specified length.
+ * @param str a const char8_t * pointer (need not be terminated)
+ * @param len the length of the string; must be non-negative
+ * @draft ICU 67
+ */
+ StringPiece(const char8_t* str, int32_t len) :
+ StringPiece(reinterpret_cast<const char*>(str), len) {}
+#endif
+#endif // U_HIDE_DRAFT_API
+
/**
- * Constructs from a const char8_t * pointer and a specified length.
- * @param str a const char8_t * pointer (need not be terminated)
- * @param len the length of the string; must be non-negative
- * @draft ICU 67
- */
- StringPiece(const char8_t* str, int32_t len) :
- StringPiece(reinterpret_cast<const char*>(str), len) {}
-#endif
-#endif // U_HIDE_DRAFT_API
-
- /**
* Substring of another StringPiece.
* @param x the other StringPiece
* @param pos start position in x; must be non-negative and <= x.length().
@@ -185,7 +185,7 @@ class U_COMMON_API StringPiece : public UMemory {
StringPiece(const StringPiece& x, int32_t pos, int32_t len);
/**
- * Returns the string pointer. May be nullptr if it is empty.
+ * Returns the string pointer. May be nullptr if it is empty.
*
* data() may return a pointer to a buffer with embedded NULs, and the
* returned buffer may or may not be null terminated. Therefore it is
@@ -218,7 +218,7 @@ class U_COMMON_API StringPiece : public UMemory {
* Sets to an empty string.
* @stable ICU 4.2
*/
- void clear() { ptr_ = nullptr; length_ = 0; }
+ void clear() { ptr_ = nullptr; length_ = 0; }
/**
* Reset the stringpiece to refer to new data.
@@ -235,30 +235,30 @@ class U_COMMON_API StringPiece : public UMemory {
*/
void set(const char* str);
-#ifndef U_HIDE_DRAFT_API
-#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN)
+#ifndef U_HIDE_DRAFT_API
+#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN)
+ /**
+ * Resets the stringpiece to refer to new data.
+ * @param xdata pointer the new string data. Need not be NUL-terminated.
+ * @param len the length of the new data
+ * @draft ICU 67
+ */
+ inline void set(const char8_t* xdata, int32_t len) {
+ set(reinterpret_cast<const char*>(xdata), len);
+ }
+
+ /**
+ * Resets the stringpiece to refer to new data.
+ * @param str a pointer to a NUL-terminated string.
+ * @draft ICU 67
+ */
+ inline void set(const char8_t* str) {
+ set(reinterpret_cast<const char*>(str));
+ }
+#endif
+#endif // U_HIDE_DRAFT_API
+
/**
- * Resets the stringpiece to refer to new data.
- * @param xdata pointer the new string data. Need not be NUL-terminated.
- * @param len the length of the new data
- * @draft ICU 67
- */
- inline void set(const char8_t* xdata, int32_t len) {
- set(reinterpret_cast<const char*>(xdata), len);
- }
-
- /**
- * Resets the stringpiece to refer to new data.
- * @param str a pointer to a NUL-terminated string.
- * @draft ICU 67
- */
- inline void set(const char8_t* str) {
- set(reinterpret_cast<const char*>(str));
- }
-#endif
-#endif // U_HIDE_DRAFT_API
-
- /**
* Removes the first n string units.
* @param n prefix length, must be non-negative and <=length()
* @stable ICU 4.2
@@ -288,27 +288,27 @@ class U_COMMON_API StringPiece : public UMemory {
}
}
-#ifndef U_HIDE_DRAFT_API
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Searches the StringPiece for the given search string (needle);
+ * @param needle The string for which to search.
+ * @param offset Where to start searching within this string (haystack).
+ * @return The offset of needle in haystack, or -1 if not found.
+ * @draft ICU 67
+ */
+ int32_t find(StringPiece needle, int32_t offset);
+
+ /**
+ * Compares this StringPiece with the other StringPiece, with semantics
+ * similar to std::string::compare().
+ * @param other The string to compare to.
+ * @return below zero if this < other; above zero if this > other; 0 if this == other.
+ * @draft ICU 67
+ */
+ int32_t compare(StringPiece other);
+#endif // U_HIDE_DRAFT_API
+
/**
- * Searches the StringPiece for the given search string (needle);
- * @param needle The string for which to search.
- * @param offset Where to start searching within this string (haystack).
- * @return The offset of needle in haystack, or -1 if not found.
- * @draft ICU 67
- */
- int32_t find(StringPiece needle, int32_t offset);
-
- /**
- * Compares this StringPiece with the other StringPiece, with semantics
- * similar to std::string::compare().
- * @param other The string to compare to.
- * @return below zero if this < other; above zero if this > other; 0 if this == other.
- * @draft ICU 67
- */
- int32_t compare(StringPiece other);
-#endif // U_HIDE_DRAFT_API
-
- /**
* Maximum integer, used as a default value for substring methods.
* @stable ICU 4.2
*/
@@ -350,6 +350,6 @@ inline UBool operator!=(const StringPiece& x, const StringPiece& y) {
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __STRINGPIECE_H__
diff --git a/contrib/libs/icu/include/unicode/stringtriebuilder.h b/contrib/libs/icu/include/unicode/stringtriebuilder.h
index 23bb56122a..2c47dd415b 100644
--- a/contrib/libs/icu/include/unicode/stringtriebuilder.h
+++ b/contrib/libs/icu/include/unicode/stringtriebuilder.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: stringtriebuilder.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -18,9 +18,9 @@
#define __STRINGTRIEBUILDER_H__
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
/**
@@ -29,10 +29,10 @@
*/
// Forward declaration.
-/// \cond
+/// \cond
struct UHashtable;
typedef struct UHashtable UHashtable;
-/// \endcond
+/// \endcond
/**
* Build options for BytesTrieBuilder and CharsTrieBuilder.
@@ -69,7 +69,7 @@ class U_COMMON_API StringTrieBuilder : public UObject {
public:
#ifndef U_HIDE_INTERNAL_API
/** @internal */
- static int32_t hashNode(const void *node);
+ static int32_t hashNode(const void *node);
/** @internal */
static UBool equalNodes(const void *left, const void *right);
#endif /* U_HIDE_INTERNAL_API */
@@ -110,7 +110,7 @@ protected:
/** @internal */
virtual int32_t getElementStringLength(int32_t i) const = 0;
/** @internal */
- virtual char16_t getElementUnit(int32_t i, int32_t unitIndex) const = 0;
+ virtual char16_t getElementUnit(int32_t i, int32_t unitIndex) const = 0;
/** @internal */
virtual int32_t getElementValue(int32_t i) const = 0;
@@ -125,7 +125,7 @@ protected:
/** @internal */
virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t unitIndex, int32_t count) const = 0;
/** @internal */
- virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const = 0;
+ virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const = 0;
/** @internal */
virtual UBool matchNodesCanHaveValues() const = 0;
@@ -142,7 +142,7 @@ protected:
/** @internal */
static const int32_t kMaxBranchLinearSubNodeLength=5;
- // Maximum number of nested split-branch levels for a branch on all 2^16 possible char16_t units.
+ // Maximum number of nested split-branch levels for a branch on all 2^16 possible char16_t units.
// log2(2^16/kMaxBranchLinearSubNodeLength) rounded up.
/** @internal */
static const int32_t kMaxSplitBranchLevels=14;
@@ -193,10 +193,10 @@ protected:
// Do not conditionalize the following with #ifndef U_HIDE_INTERNAL_API,
// it is needed for layout of other objects.
- /**
- * @internal
- * \cond
- */
+ /**
+ * @internal
+ * \cond
+ */
class Node : public UObject {
public:
Node(int32_t initialHash) : hash(initialHash), offset(0) {}
@@ -264,7 +264,7 @@ protected:
/** @internal */
class FinalValueNode : public Node {
public:
- FinalValueNode(int32_t v) : Node(0x111111u*37u+v), value(v) {}
+ FinalValueNode(int32_t v) : Node(0x111111u*37u+v), value(v) {}
virtual UBool operator==(const Node &other) const;
virtual void write(StringTrieBuilder &builder);
protected:
@@ -284,7 +284,7 @@ protected:
void setValue(int32_t v) {
hasValue=TRUE;
value=v;
- hash=hash*37u+v;
+ hash=hash*37u+v;
}
protected:
UBool hasValue;
@@ -298,7 +298,7 @@ protected:
class IntermediateValueNode : public ValueNode {
public:
IntermediateValueNode(int32_t v, Node *nextNode)
- : ValueNode(0x222222u*37u+hashCode(nextNode)), next(nextNode) { setValue(v); }
+ : ValueNode(0x222222u*37u+hashCode(nextNode)), next(nextNode) { setValue(v); }
virtual UBool operator==(const Node &other) const;
virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
virtual void write(StringTrieBuilder &builder);
@@ -315,7 +315,7 @@ protected:
class LinearMatchNode : public ValueNode {
public:
LinearMatchNode(int32_t len, Node *nextNode)
- : ValueNode((0x333333u*37u+len)*37u+hashCode(nextNode)),
+ : ValueNode((0x333333u*37u+len)*37u+hashCode(nextNode)),
length(len), next(nextNode) {}
virtual UBool operator==(const Node &other) const;
virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
@@ -346,25 +346,25 @@ protected:
virtual void write(StringTrieBuilder &builder);
// Adds a unit with a final value.
void add(int32_t c, int32_t value) {
- units[length]=(char16_t)c;
+ units[length]=(char16_t)c;
equal[length]=NULL;
values[length]=value;
++length;
- hash=(hash*37u+c)*37u+value;
+ hash=(hash*37u+c)*37u+value;
}
// Adds a unit which leads to another match node.
void add(int32_t c, Node *node) {
- units[length]=(char16_t)c;
+ units[length]=(char16_t)c;
equal[length]=node;
values[length]=0;
++length;
- hash=(hash*37u+c)*37u+hashCode(node);
+ hash=(hash*37u+c)*37u+hashCode(node);
}
protected:
Node *equal[kMaxBranchLinearSubNodeLength]; // NULL means "has final value".
int32_t length;
int32_t values[kMaxBranchLinearSubNodeLength];
- char16_t units[kMaxBranchLinearSubNodeLength];
+ char16_t units[kMaxBranchLinearSubNodeLength];
};
/**
@@ -372,15 +372,15 @@ protected:
*/
class SplitBranchNode : public BranchNode {
public:
- SplitBranchNode(char16_t middleUnit, Node *lessThanNode, Node *greaterOrEqualNode)
- : BranchNode(((0x555555u*37u+middleUnit)*37u+
- hashCode(lessThanNode))*37u+hashCode(greaterOrEqualNode)),
+ SplitBranchNode(char16_t middleUnit, Node *lessThanNode, Node *greaterOrEqualNode)
+ : BranchNode(((0x555555u*37u+middleUnit)*37u+
+ hashCode(lessThanNode))*37u+hashCode(greaterOrEqualNode)),
unit(middleUnit), lessThan(lessThanNode), greaterOrEqual(greaterOrEqualNode) {}
virtual UBool operator==(const Node &other) const;
virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
virtual void write(StringTrieBuilder &builder);
protected:
- char16_t unit;
+ char16_t unit;
Node *lessThan;
Node *greaterOrEqual;
};
@@ -390,7 +390,7 @@ protected:
class BranchHeadNode : public ValueNode {
public:
BranchHeadNode(int32_t len, Node *subNode)
- : ValueNode((0x666666u*37u+len)*37u+hashCode(subNode)),
+ : ValueNode((0x666666u*37u+len)*37u+hashCode(subNode)),
length(len), next(subNode) {}
virtual UBool operator==(const Node &other) const;
virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
@@ -399,9 +399,9 @@ protected:
int32_t length;
Node *next; // A branch sub-node.
};
-
+
#endif /* U_HIDE_INTERNAL_API */
- /// \endcond
+ /// \endcond
/** @internal */
virtual Node *createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t length,
@@ -421,6 +421,6 @@ protected:
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __STRINGTRIEBUILDER_H__
diff --git a/contrib/libs/icu/include/unicode/stsearch.h b/contrib/libs/icu/include/unicode/stsearch.h
index 8274b3328f..fcb5dbf200 100644
--- a/contrib/libs/icu/include/unicode/stsearch.h
+++ b/contrib/libs/icu/include/unicode/stsearch.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -14,8 +14,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: Service for searching text based on RuleBasedCollator.
@@ -121,7 +121,7 @@ U_NAMESPACE_BEGIN
* pos != USEARCH_DONE;
* pos = iter.next(error))
* {
- * printf("Found match at %d pos, length is %d\n", pos, iter.getMatchedLength());
+ * printf("Found match at %d pos, length is %d\n", pos, iter.getMatchedLength());
* }
* </code></pre>
* <p>
@@ -413,7 +413,7 @@ public:
* @return cloned object
* @stable ICU 2.0
*/
- virtual StringSearch * safeClone() const;
+ virtual StringSearch * safeClone() const;
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
@@ -503,7 +503,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_COLLATION */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/symtable.h b/contrib/libs/icu/include/unicode/symtable.h
index e95a259e86..b64d877f97 100644
--- a/contrib/libs/icu/include/unicode/symtable.h
+++ b/contrib/libs/icu/include/unicode/symtable.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -13,9 +13,9 @@
#define SYMTABLE_H
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
/**
@@ -114,6 +114,6 @@ public:
};
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/tblcoll.h b/contrib/libs/icu/include/unicode/tblcoll.h
index a7cfe7d72e..f5dc135bc4 100644
--- a/contrib/libs/icu/include/unicode/tblcoll.h
+++ b/contrib/libs/icu/include/unicode/tblcoll.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -64,8 +64,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_COLLATION
#include "unicode/coll.h"
@@ -230,7 +230,7 @@ public:
* @return a copy of this object, owned by the caller
* @stable ICU 2.0
*/
- virtual RuleBasedCollator* clone() const;
+ virtual RuleBasedCollator* clone() const;
/**
* Creates a collation element iterator for the source string. The caller of
@@ -310,8 +310,8 @@ public:
* than target
* @stable ICU 2.6
*/
- virtual UCollationResult compare(const char16_t* source, int32_t sourceLength,
- const char16_t* target, int32_t targetLength,
+ virtual UCollationResult compare(const char16_t* source, int32_t sourceLength,
+ const char16_t* target, int32_t targetLength,
UErrorCode &status) const;
/**
@@ -379,7 +379,7 @@ public:
* @see CollationKey
* @stable ICU 2.0
*/
- virtual CollationKey& getCollationKey(const char16_t *source,
+ virtual CollationKey& getCollationKey(const char16_t *source,
int32_t sourceLength,
CollationKey& key,
UErrorCode& status) const;
@@ -391,7 +391,7 @@ public:
*/
virtual int32_t hashCode() const;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Gets the locale of the Collator
* @param type can be either requested, valid or actual locale. For more
@@ -403,7 +403,7 @@ public:
* @deprecated ICU 2.8 likely to change in ICU 3.0, based on feedback
*/
virtual Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Gets the tailoring rules for this collator.
@@ -549,7 +549,7 @@ public:
*/
virtual UColReorderCode getMaxVariable() const;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Sets the variable top to the primary weight of the specified string.
*
@@ -557,7 +557,7 @@ public:
* the top of one of the supported reordering groups,
* and it must not be beyond the last of those groups.
* See setMaxVariable().
- * @param varTop one or more (if contraction) char16_ts to which the variable top should be set
+ * @param varTop one or more (if contraction) char16_ts to which the variable top should be set
* @param len length of variable top string. If -1 it is considered to be zero terminated.
* @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br>
* U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction<br>
@@ -566,7 +566,7 @@ public:
* @return variable top primary weight
* @deprecated ICU 53 Call setMaxVariable() instead.
*/
- virtual uint32_t setVariableTop(const char16_t *varTop, int32_t len, UErrorCode &status);
+ virtual uint32_t setVariableTop(const char16_t *varTop, int32_t len, UErrorCode &status);
/**
* Sets the variable top to the primary weight of the specified string.
@@ -575,7 +575,7 @@ public:
* the top of one of the supported reordering groups,
* and it must not be beyond the last of those groups.
* See setMaxVariable().
- * @param varTop a UnicodeString size 1 or more (if contraction) of char16_ts to which the variable top should be set
+ * @param varTop a UnicodeString size 1 or more (if contraction) of char16_ts to which the variable top should be set
* @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br>
* U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction<br>
* U_ILLEGAL_ARGUMENT_ERROR if the variable top is beyond
@@ -597,7 +597,7 @@ public:
* @deprecated ICU 53 Call setMaxVariable() instead.
*/
virtual void setVariableTop(uint32_t varTop, UErrorCode &status);
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Gets the variable top value of a Collator.
@@ -637,7 +637,7 @@ public:
int32_t resultLength) const;
/**
- * Get the sort key as an array of bytes from a char16_t buffer.
+ * Get the sort key as an array of bytes from a char16_t buffer.
*
* Note that sort keys are often less efficient than simply doing comparison.
* For more details, see the ICU User Guide.
@@ -652,7 +652,7 @@ public:
* @return Number of bytes needed for storing the sort key
* @stable ICU 2.2
*/
- virtual int32_t getSortKey(const char16_t *source, int32_t sourceLength,
+ virtual int32_t getSortKey(const char16_t *source, int32_t sourceLength,
uint8_t *result, int32_t resultLength) const;
/**
@@ -827,17 +827,17 @@ private:
void adoptTailoring(CollationTailoring *t, UErrorCode &errorCode);
// Both lengths must be <0 or else both must be >=0.
- UCollationResult doCompare(const char16_t *left, int32_t leftLength,
- const char16_t *right, int32_t rightLength,
+ UCollationResult doCompare(const char16_t *left, int32_t leftLength,
+ const char16_t *right, int32_t rightLength,
UErrorCode &errorCode) const;
UCollationResult doCompare(const uint8_t *left, int32_t leftLength,
const uint8_t *right, int32_t rightLength,
UErrorCode &errorCode) const;
- void writeSortKey(const char16_t *s, int32_t length,
+ void writeSortKey(const char16_t *s, int32_t length,
SortKeyByteSink &sink, UErrorCode &errorCode) const;
- void writeIdenticalLevel(const char16_t *s, const char16_t *limit,
+ void writeIdenticalLevel(const char16_t *s, const char16_t *limit,
SortKeyByteSink &sink, UErrorCode &errorCode) const;
const CollationSettings &getDefaultSettings() const;
@@ -880,7 +880,7 @@ private:
U_NAMESPACE_END
#endif // !UCONFIG_NO_COLLATION
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // TBLCOLL_H
diff --git a/contrib/libs/icu/include/unicode/timezone.h b/contrib/libs/icu/include/unicode/timezone.h
index 0cdc8e196f..433e3b5c46 100644
--- a/contrib/libs/icu/include/unicode/timezone.h
+++ b/contrib/libs/icu/include/unicode/timezone.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*************************************************************************
* Copyright (c) 1997-2016, International Business Machines Corporation
@@ -31,8 +31,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: TimeZone object
@@ -279,25 +279,25 @@ public:
/**
* Creates an instance of TimeZone detected from the current host
- * system configuration. If the host system detection routines fail,
- * or if they specify a TimeZone or TimeZone offset which is not
- * recognized, then the special TimeZone "Etc/Unknown" is returned.
- *
- * Note that ICU4C does not change the default time zone unless
- * `TimeZone::adoptDefault(TimeZone*)` or
- * `TimeZone::setDefault(const TimeZone&)` is explicitly called by a
+ * system configuration. If the host system detection routines fail,
+ * or if they specify a TimeZone or TimeZone offset which is not
+ * recognized, then the special TimeZone "Etc/Unknown" is returned.
+ *
+ * Note that ICU4C does not change the default time zone unless
+ * `TimeZone::adoptDefault(TimeZone*)` or
+ * `TimeZone::setDefault(const TimeZone&)` is explicitly called by a
* user. This method does not update the current ICU's default,
* and may return a different TimeZone from the one returned by
- * `TimeZone::createDefault()`.
+ * `TimeZone::createDefault()`.
+ *
+ * <p>This function is not thread safe.</p>
*
- * <p>This function is not thread safe.</p>
- *
* @return A new instance of TimeZone detected from the current host system
* configuration.
- * @see adoptDefault
- * @see setDefault
- * @see createDefault
- * @see getUnknown
+ * @see adoptDefault
+ * @see setDefault
+ * @see createDefault
+ * @see getUnknown
* @stable ICU 55
*/
static TimeZone* U_EXPORT2 detectHostTimeZone();
@@ -305,14 +305,14 @@ public:
/**
* Creates a new copy of the default TimeZone for this host. Unless the default time
* zone has already been set using adoptDefault() or setDefault(), the default is
- * determined by querying the host system configuration. If the host system detection
- * routines fail, or if they specify a TimeZone or TimeZone offset which is not
- * recognized, then the special TimeZone "Etc/Unknown" is instantiated and made the
- * default.
+ * determined by querying the host system configuration. If the host system detection
+ * routines fail, or if they specify a TimeZone or TimeZone offset which is not
+ * recognized, then the special TimeZone "Etc/Unknown" is instantiated and made the
+ * default.
*
* @return A default TimeZone. Clients are responsible for deleting the time zone
* object returned.
- * @see getUnknown
+ * @see getUnknown
* @stable ICU 2.0
*/
static TimeZone* U_EXPORT2 createDefault(void);
@@ -662,13 +662,13 @@ public:
* If the display name is not available for the locale,
* then this method returns a string in the localized GMT offset format
* such as <code>GMT[+-]HH:mm</code>.
- * @param inDaylight if true, return the daylight savings name.
+ * @param inDaylight if true, return the daylight savings name.
* @param style
* @param result the human-readable name of this time zone in the default locale.
* @return A reference to 'result'.
* @stable ICU 2.0
*/
- UnicodeString& getDisplayName(UBool inDaylight, EDisplayType style, UnicodeString& result) const;
+ UnicodeString& getDisplayName(UBool inDaylight, EDisplayType style, UnicodeString& result) const;
/**
* Returns a name of this time zone suitable for presentation to the user
@@ -676,15 +676,15 @@ public:
* If the display name is not available for the locale,
* then this method returns a string in the localized GMT offset format
* such as <code>GMT[+-]HH:mm</code>.
- * @param inDaylight if true, return the daylight savings name.
+ * @param inDaylight if true, return the daylight savings name.
* @param style
* @param locale the locale in which to supply the display name.
* @param result the human-readable name of this time zone in the given locale
* or in the default locale if the given locale is not recognized.
- * @return A reference to 'result'.
+ * @return A reference to 'result'.
* @stable ICU 2.0
*/
- UnicodeString& getDisplayName(UBool inDaylight, EDisplayType style, const Locale& locale, UnicodeString& result) const;
+ UnicodeString& getDisplayName(UBool inDaylight, EDisplayType style, const Locale& locale, UnicodeString& result) const;
/**
* Queries if this time zone uses daylight savings time.
@@ -722,7 +722,7 @@ public:
*/
virtual UBool useDaylightTime(void) const = 0;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Queries if the given date is in daylight savings time in
* this time zone.
@@ -737,7 +737,7 @@ public:
* @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead.
*/
virtual UBool inDaylightTime(UDate date, UErrorCode& status) const = 0;
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Returns true if this zone has the same rule and offset as another zone.
@@ -756,7 +756,7 @@ public:
* @return A new copy of this TimeZone object.
* @stable ICU 2.0
*/
- virtual TimeZone* clone() const = 0;
+ virtual TimeZone* clone() const = 0;
/**
* Return the class ID for this class. This is useful only for
@@ -872,7 +872,7 @@ private:
* @param id zone id string
* @return the pointer of the ID resource, or NULL.
*/
- static const char16_t* findID(const UnicodeString& id);
+ static const char16_t* findID(const UnicodeString& id);
/**
* Resolve a link in Olson tzdata. When the given id is known and it's not a link,
@@ -882,7 +882,7 @@ private:
* @param id zone id string
* @return the dereferenced zone or NULL
*/
- static const char16_t* dereferOlsonLink(const UnicodeString& id);
+ static const char16_t* dereferOlsonLink(const UnicodeString& id);
/**
* Returns the region code associated with the given zone,
@@ -890,7 +890,7 @@ private:
* @param id zone id string
* @return the region associated with the given zone
*/
- static const char16_t* getRegion(const UnicodeString& id);
+ static const char16_t* getRegion(const UnicodeString& id);
public:
#ifndef U_HIDE_INTERNAL_API
@@ -902,7 +902,7 @@ private:
* @return the region associated with the given zone
* @internal
*/
- static const char16_t* getRegion(const UnicodeString& id, UErrorCode& status);
+ static const char16_t* getRegion(const UnicodeString& id, UErrorCode& status);
#endif /* U_HIDE_INTERNAL_API */
private:
@@ -933,7 +933,7 @@ private:
UErrorCode& status);
/**
- * Returns the normalized custom time zone ID for the given offset fields.
+ * Returns the normalized custom time zone ID for the given offset fields.
* @param hour offset hours
* @param min offset minutes
* @param sec offset seconds
@@ -970,7 +970,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif //_TIMEZONE
//eof
diff --git a/contrib/libs/icu/include/unicode/tmunit.h b/contrib/libs/icu/include/unicode/tmunit.h
index 9aded11aba..2e949ddfbd 100644
--- a/contrib/libs/icu/include/unicode/tmunit.h
+++ b/contrib/libs/icu/include/unicode/tmunit.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -16,10 +16,10 @@
* \brief C++ API: time unit object
*/
-#include "unicode/utypes.h"
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
-#if U_SHOW_CPLUSPLUS_API
-
#include "unicode/measunit.h"
#if !UCONFIG_NO_FORMATTING
@@ -73,7 +73,7 @@ public:
* Override clone.
* @stable ICU 4.2
*/
- virtual TimeUnit* clone() const;
+ virtual TimeUnit* clone() const;
/**
* Copy operator.
@@ -135,8 +135,8 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __TMUNIT_H__
//eof
//
diff --git a/contrib/libs/icu/include/unicode/tmutamt.h b/contrib/libs/icu/include/unicode/tmutamt.h
index c233fabac9..8bcc684d3a 100644
--- a/contrib/libs/icu/include/unicode/tmutamt.h
+++ b/contrib/libs/icu/include/unicode/tmutamt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -16,12 +16,12 @@
* \brief C++ API: time unit amount object.
*/
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
-#if !UCONFIG_NO_FORMATTING
-
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
+#if !UCONFIG_NO_FORMATTING
+
#include "unicode/measure.h"
#include "unicode/tmunit.h"
@@ -87,7 +87,7 @@ public:
* @return a polymorphic clone of this object. The result will have the same class as returned by getDynamicClassID().
* @stable ICU 4.2
*/
- virtual TimeUnitAmount* clone() const;
+ virtual TimeUnitAmount* clone() const;
/**
@@ -169,8 +169,8 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __TMUTAMT_H__
//eof
//
diff --git a/contrib/libs/icu/include/unicode/tmutfmt.h b/contrib/libs/icu/include/unicode/tmutfmt.h
index e183354105..ad871f7c09 100644
--- a/contrib/libs/icu/include/unicode/tmutfmt.h
+++ b/contrib/libs/icu/include/unicode/tmutfmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -18,8 +18,8 @@
*/
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
#include "unicode/unistr.h"
@@ -29,7 +29,7 @@
#include "unicode/numfmt.h"
#include "unicode/plurrule.h"
-#ifndef U_HIDE_DEPRECATED_API
+#ifndef U_HIDE_DEPRECATED_API
/**
* Constants for various styles.
@@ -126,7 +126,7 @@ public:
* @return A copy of the object.
* @deprecated ICU 53
*/
- virtual TimeUnitFormat* clone() const;
+ virtual TimeUnitFormat* clone() const;
/**
* Assignment operator
@@ -246,7 +246,7 @@ U_NAMESPACE_END
#endif /* U_HIDE_DEPRECATED_API */
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __TMUTFMT_H__
//eof
diff --git a/contrib/libs/icu/include/unicode/translit.h b/contrib/libs/icu/include/unicode/translit.h
index 8a67643f44..fe2568d50a 100644
--- a/contrib/libs/icu/include/unicode/translit.h
+++ b/contrib/libs/icu/include/unicode/translit.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -14,13 +14,13 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
- * \file
+ * \file
* \brief C++ API: Tranforms text from one format to another.
*/
-
+
#if !UCONFIG_NO_TRANSLITERATION
#include "unicode/uobject.h"
@@ -78,7 +78,7 @@ class TransliteratorIDParser;
* transliteration. For example, given a string <code>input</code>
* and a transliterator <code>t</code>, the call
*
- * String result = t.transliterate(input);
+ * String result = t.transliterate(input);
*
* will transliterate it and return the result. Other methods allow
* the client to specify a substring to be transliterated and to use
@@ -98,20 +98,20 @@ class TransliteratorIDParser;
* contents of the buffer may show text being modified as each new
* character arrives.
*
- * <p>Consider the simple rule-based Transliterator:
- * <pre>
- * th>{theta}
- * t>{tau}
- * </pre>
+ * <p>Consider the simple rule-based Transliterator:
+ * <pre>
+ * th>{theta}
+ * t>{tau}
+ * </pre>
*
* When the user types 't', nothing will happen, since the
* transliterator is waiting to see if the next character is 'h'. To
* remedy this, we introduce the notion of a cursor, marked by a '|'
* in the output string:
- * <pre>
- * t>|{tau}
- * {tau}h>{theta}
- * </pre>
+ * <pre>
+ * t>|{tau}
+ * {tau}h>{theta}
+ * </pre>
*
* Now when the user types 't', tau appears, and if the next character
* is 'h', the tau changes to a theta. This is accomplished by
@@ -133,7 +133,7 @@ class TransliteratorIDParser;
* which the transliterator last stopped, either because it reached
* the end, or because it required more characters to disambiguate
* between possible inputs. The <code>CURSOR</code> can also be
- * explicitly set by rules in a rule-based Transliterator.
+ * explicitly set by rules in a rule-based Transliterator.
* Any characters before the <code>CURSOR</code> index are frozen;
* future keyboard transliteration calls within this input sequence
* will not change them. New text is inserted at the
@@ -235,255 +235,255 @@ class TransliteratorIDParser;
* if the performance of these methods can be improved over the
* performance obtained by the default implementations in this class.
*
- * <p><b>Rule syntax</b>
- *
- * <p>A set of rules determines how to perform translations.
- * Rules within a rule set are separated by semicolons (';').
- * To include a literal semicolon, prefix it with a backslash ('\').
- * Unicode Pattern_White_Space is ignored.
- * If the first non-blank character on a line is '#',
- * the entire line is ignored as a comment.
- *
- * <p>Each set of rules consists of two groups, one forward, and one
- * reverse. This is a convention that is not enforced; rules for one
- * direction may be omitted, with the result that translations in
- * that direction will not modify the source text. In addition,
- * bidirectional forward-reverse rules may be specified for
- * symmetrical transformations.
- *
- * <p>Note: Another description of the Transliterator rule syntax is available in
- * <a href="https://www.unicode.org/reports/tr35/tr35-general.html#Transform_Rules_Syntax">section
- * Transform Rules Syntax of UTS #35: Unicode LDML</a>.
- * The rules are shown there using arrow symbols ← and → and ↔.
- * ICU supports both those and the equivalent ASCII symbols &lt; and &gt; and &lt;&gt;.
- *
- * <p>Rule statements take one of the following forms:
- *
- * <dl>
- * <dt><code>$alefmadda=\\u0622;</code></dt>
- * <dd><strong>Variable definition.</strong> The name on the
- * left is assigned the text on the right. In this example,
- * after this statement, instances of the left hand name,
- * &quot;<code>$alefmadda</code>&quot;, will be replaced by
- * the Unicode character U+0622. Variable names must begin
- * with a letter and consist only of letters, digits, and
- * underscores. Case is significant. Duplicate names cause
- * an exception to be thrown, that is, variables cannot be
- * redefined. The right hand side may contain well-formed
- * text of any length, including no text at all (&quot;<code>$empty=;</code>&quot;).
- * The right hand side may contain embedded <code>UnicodeSet</code>
- * patterns, for example, &quot;<code>$softvowel=[eiyEIY]</code>&quot;.</dd>
- * <dt><code>ai&gt;$alefmadda;</code></dt>
- * <dd><strong>Forward translation rule.</strong> This rule
- * states that the string on the left will be changed to the
- * string on the right when performing forward
- * transliteration.</dd>
- * <dt><code>ai&lt;$alefmadda;</code></dt>
- * <dd><strong>Reverse translation rule.</strong> This rule
- * states that the string on the right will be changed to
- * the string on the left when performing reverse
- * transliteration.</dd>
- * </dl>
- *
- * <dl>
- * <dt><code>ai&lt;&gt;$alefmadda;</code></dt>
- * <dd><strong>Bidirectional translation rule.</strong> This
- * rule states that the string on the right will be changed
- * to the string on the left when performing forward
- * transliteration, and vice versa when performing reverse
- * transliteration.</dd>
- * </dl>
- *
- * <p>Translation rules consist of a <em>match pattern</em> and an <em>output
- * string</em>. The match pattern consists of literal characters,
- * optionally preceded by context, and optionally followed by
- * context. Context characters, like literal pattern characters,
- * must be matched in the text being transliterated. However, unlike
- * literal pattern characters, they are not replaced by the output
- * text. For example, the pattern &quot;<code>abc{def}</code>&quot;
- * indicates the characters &quot;<code>def</code>&quot; must be
- * preceded by &quot;<code>abc</code>&quot; for a successful match.
- * If there is a successful match, &quot;<code>def</code>&quot; will
- * be replaced, but not &quot;<code>abc</code>&quot;. The final '<code>}</code>'
- * is optional, so &quot;<code>abc{def</code>&quot; is equivalent to
- * &quot;<code>abc{def}</code>&quot;. Another example is &quot;<code>{123}456</code>&quot;
- * (or &quot;<code>123}456</code>&quot;) in which the literal
- * pattern &quot;<code>123</code>&quot; must be followed by &quot;<code>456</code>&quot;.
- *
- * <p>The output string of a forward or reverse rule consists of
- * characters to replace the literal pattern characters. If the
- * output string contains the character '<code>|</code>', this is
- * taken to indicate the location of the <em>cursor</em> after
- * replacement. The cursor is the point in the text at which the
- * next replacement, if any, will be applied. The cursor is usually
- * placed within the replacement text; however, it can actually be
- * placed into the precending or following context by using the
- * special character '@'. Examples:
- *
- * <pre>
- * a {foo} z &gt; | @ bar; # foo -&gt; bar, move cursor before a
- * {foo} xyz &gt; bar @@|; #&nbsp;foo -&gt; bar, cursor between y and z
- * </pre>
- *
- * <p><b>UnicodeSet</b>
- *
- * <p><code>UnicodeSet</code> patterns may appear anywhere that
- * makes sense. They may appear in variable definitions.
- * Contrariwise, <code>UnicodeSet</code> patterns may themselves
- * contain variable references, such as &quot;<code>$a=[a-z];$not_a=[^$a]</code>&quot;,
- * or &quot;<code>$range=a-z;$ll=[$range]</code>&quot;.
- *
- * <p><code>UnicodeSet</code> patterns may also be embedded directly
- * into rule strings. Thus, the following two rules are equivalent:
- *
- * <pre>
- * $vowel=[aeiou]; $vowel&gt;'*'; # One way to do this
- * [aeiou]&gt;'*'; # Another way
- * </pre>
- *
- * <p>See {@link UnicodeSet} for more documentation and examples.
- *
- * <p><b>Segments</b>
- *
- * <p>Segments of the input string can be matched and copied to the
- * output string. This makes certain sets of rules simpler and more
- * general, and makes reordering possible. For example:
- *
- * <pre>
- * ([a-z]) &gt; $1 $1; # double lowercase letters
- * ([:Lu:]) ([:Ll:]) &gt; $2 $1; # reverse order of Lu-Ll pairs
- * </pre>
- *
- * <p>The segment of the input string to be copied is delimited by
- * &quot;<code>(</code>&quot; and &quot;<code>)</code>&quot;. Up to
- * nine segments may be defined. Segments may not overlap. In the
- * output string, &quot;<code>$1</code>&quot; through &quot;<code>$9</code>&quot;
- * represent the input string segments, in left-to-right order of
- * definition.
- *
- * <p><b>Anchors</b>
- *
- * <p>Patterns can be anchored to the beginning or the end of the text. This is done with the
- * special characters '<code>^</code>' and '<code>$</code>'. For example:
- *
- * <pre>
- * ^ a&nbsp;&nbsp; &gt; 'BEG_A'; &nbsp;&nbsp;# match 'a' at start of text
- * &nbsp; a&nbsp;&nbsp; &gt; 'A'; # match other instances of 'a'
- * &nbsp; z $ &gt; 'END_Z'; &nbsp;&nbsp;# match 'z' at end of text
- * &nbsp; z&nbsp;&nbsp; &gt; 'Z';&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # match other instances of 'z'
- * </pre>
- *
- * <p>It is also possible to match the beginning or the end of the text using a <code>UnicodeSet</code>.
- * This is done by including a virtual anchor character '<code>$</code>' at the end of the
- * set pattern. Although this is usually the match chafacter for the end anchor, the set will
- * match either the beginning or the end of the text, depending on its placement. For
- * example:
- *
- * <pre>
- * $x = [a-z$]; &nbsp;&nbsp;# match 'a' through 'z' OR anchor
- * $x 1&nbsp;&nbsp;&nbsp; &gt; 2;&nbsp;&nbsp; # match '1' after a-z or at the start
- * &nbsp;&nbsp; 3 $x &gt; 4; &nbsp;&nbsp;# match '3' before a-z or at the end
- * </pre>
- *
- * <p><b>Example</b>
- *
- * <p>The following example rules illustrate many of the features of
- * the rule language.
- *
- * <table border="0" cellpadding="4">
- * <tr>
- * <td style="vertical-align: top;">Rule 1.</td>
- * <td style="vertical-align: top; write-space: nowrap;"><code>abc{def}&gt;x|y</code></td>
- * </tr>
- * <tr>
- * <td style="vertical-align: top;">Rule 2.</td>
- * <td style="vertical-align: top; write-space: nowrap;"><code>xyz&gt;r</code></td>
- * </tr>
- * <tr>
- * <td style="vertical-align: top;">Rule 3.</td>
- * <td style="vertical-align: top; write-space: nowrap;"><code>yz&gt;q</code></td>
- * </tr>
- * </table>
- *
- * <p>Applying these rules to the string &quot;<code>adefabcdefz</code>&quot;
- * yields the following results:
- *
- * <table border="0" cellpadding="4">
- * <tr>
- * <td style="vertical-align: top; write-space: nowrap;"><code>|adefabcdefz</code></td>
- * <td style="vertical-align: top;">Initial state, no rules match. Advance
- * cursor.</td>
- * </tr>
- * <tr>
- * <td style="vertical-align: top; write-space: nowrap;"><code>a|defabcdefz</code></td>
- * <td style="vertical-align: top;">Still no match. Rule 1 does not match
- * because the preceding context is not present.</td>
- * </tr>
- * <tr>
- * <td style="vertical-align: top; write-space: nowrap;"><code>ad|efabcdefz</code></td>
- * <td style="vertical-align: top;">Still no match. Keep advancing until
- * there is a match...</td>
- * </tr>
- * <tr>
- * <td style="vertical-align: top; write-space: nowrap;"><code>ade|fabcdefz</code></td>
- * <td style="vertical-align: top;">...</td>
- * </tr>
- * <tr>
- * <td style="vertical-align: top; write-space: nowrap;"><code>adef|abcdefz</code></td>
- * <td style="vertical-align: top;">...</td>
- * </tr>
- * <tr>
- * <td style="vertical-align: top; write-space: nowrap;"><code>adefa|bcdefz</code></td>
- * <td style="vertical-align: top;">...</td>
- * </tr>
- * <tr>
- * <td style="vertical-align: top; write-space: nowrap;"><code>adefab|cdefz</code></td>
- * <td style="vertical-align: top;">...</td>
- * </tr>
- * <tr>
- * <td style="vertical-align: top; write-space: nowrap;"><code>adefabc|defz</code></td>
- * <td style="vertical-align: top;">Rule 1 matches; replace &quot;<code>def</code>&quot;
- * with &quot;<code>xy</code>&quot; and back up the cursor
- * to before the '<code>y</code>'.</td>
- * </tr>
- * <tr>
- * <td style="vertical-align: top; write-space: nowrap;"><code>adefabcx|yz</code></td>
- * <td style="vertical-align: top;">Although &quot;<code>xyz</code>&quot; is
- * present, rule 2 does not match because the cursor is
- * before the '<code>y</code>', not before the '<code>x</code>'.
- * Rule 3 does match. Replace &quot;<code>yz</code>&quot;
- * with &quot;<code>q</code>&quot;.</td>
- * </tr>
- * <tr>
- * <td style="vertical-align: top; write-space: nowrap;"><code>adefabcxq|</code></td>
- * <td style="vertical-align: top;">The cursor is at the end;
- * transliteration is complete.</td>
- * </tr>
- * </table>
- *
- * <p>The order of rules is significant. If multiple rules may match
- * at some point, the first matching rule is applied.
- *
- * <p>Forward and reverse rules may have an empty output string.
- * Otherwise, an empty left or right hand side of any statement is a
- * syntax error.
- *
- * <p>Single quotes are used to quote any character other than a
- * digit or letter. To specify a single quote itself, inside or
- * outside of quotes, use two single quotes in a row. For example,
- * the rule &quot;<code>'&gt;'&gt;o''clock</code>&quot; changes the
- * string &quot;<code>&gt;</code>&quot; to the string &quot;<code>o'clock</code>&quot;.
- *
- * <p><b>Notes</b>
- *
- * <p>While a Transliterator is being built from rules, it checks that
- * the rules are added in proper order. For example, if the rule
- * &quot;a&gt;x&quot; is followed by the rule &quot;ab&gt;y&quot;,
- * then the second rule will throw an exception. The reason is that
- * the second rule can never be triggered, since the first rule
- * always matches anything it matches. In other words, the first
- * rule <em>masks</em> the second rule.
- *
+ * <p><b>Rule syntax</b>
+ *
+ * <p>A set of rules determines how to perform translations.
+ * Rules within a rule set are separated by semicolons (';').
+ * To include a literal semicolon, prefix it with a backslash ('\').
+ * Unicode Pattern_White_Space is ignored.
+ * If the first non-blank character on a line is '#',
+ * the entire line is ignored as a comment.
+ *
+ * <p>Each set of rules consists of two groups, one forward, and one
+ * reverse. This is a convention that is not enforced; rules for one
+ * direction may be omitted, with the result that translations in
+ * that direction will not modify the source text. In addition,
+ * bidirectional forward-reverse rules may be specified for
+ * symmetrical transformations.
+ *
+ * <p>Note: Another description of the Transliterator rule syntax is available in
+ * <a href="https://www.unicode.org/reports/tr35/tr35-general.html#Transform_Rules_Syntax">section
+ * Transform Rules Syntax of UTS #35: Unicode LDML</a>.
+ * The rules are shown there using arrow symbols ← and → and ↔.
+ * ICU supports both those and the equivalent ASCII symbols &lt; and &gt; and &lt;&gt;.
+ *
+ * <p>Rule statements take one of the following forms:
+ *
+ * <dl>
+ * <dt><code>$alefmadda=\\u0622;</code></dt>
+ * <dd><strong>Variable definition.</strong> The name on the
+ * left is assigned the text on the right. In this example,
+ * after this statement, instances of the left hand name,
+ * &quot;<code>$alefmadda</code>&quot;, will be replaced by
+ * the Unicode character U+0622. Variable names must begin
+ * with a letter and consist only of letters, digits, and
+ * underscores. Case is significant. Duplicate names cause
+ * an exception to be thrown, that is, variables cannot be
+ * redefined. The right hand side may contain well-formed
+ * text of any length, including no text at all (&quot;<code>$empty=;</code>&quot;).
+ * The right hand side may contain embedded <code>UnicodeSet</code>
+ * patterns, for example, &quot;<code>$softvowel=[eiyEIY]</code>&quot;.</dd>
+ * <dt><code>ai&gt;$alefmadda;</code></dt>
+ * <dd><strong>Forward translation rule.</strong> This rule
+ * states that the string on the left will be changed to the
+ * string on the right when performing forward
+ * transliteration.</dd>
+ * <dt><code>ai&lt;$alefmadda;</code></dt>
+ * <dd><strong>Reverse translation rule.</strong> This rule
+ * states that the string on the right will be changed to
+ * the string on the left when performing reverse
+ * transliteration.</dd>
+ * </dl>
+ *
+ * <dl>
+ * <dt><code>ai&lt;&gt;$alefmadda;</code></dt>
+ * <dd><strong>Bidirectional translation rule.</strong> This
+ * rule states that the string on the right will be changed
+ * to the string on the left when performing forward
+ * transliteration, and vice versa when performing reverse
+ * transliteration.</dd>
+ * </dl>
+ *
+ * <p>Translation rules consist of a <em>match pattern</em> and an <em>output
+ * string</em>. The match pattern consists of literal characters,
+ * optionally preceded by context, and optionally followed by
+ * context. Context characters, like literal pattern characters,
+ * must be matched in the text being transliterated. However, unlike
+ * literal pattern characters, they are not replaced by the output
+ * text. For example, the pattern &quot;<code>abc{def}</code>&quot;
+ * indicates the characters &quot;<code>def</code>&quot; must be
+ * preceded by &quot;<code>abc</code>&quot; for a successful match.
+ * If there is a successful match, &quot;<code>def</code>&quot; will
+ * be replaced, but not &quot;<code>abc</code>&quot;. The final '<code>}</code>'
+ * is optional, so &quot;<code>abc{def</code>&quot; is equivalent to
+ * &quot;<code>abc{def}</code>&quot;. Another example is &quot;<code>{123}456</code>&quot;
+ * (or &quot;<code>123}456</code>&quot;) in which the literal
+ * pattern &quot;<code>123</code>&quot; must be followed by &quot;<code>456</code>&quot;.
+ *
+ * <p>The output string of a forward or reverse rule consists of
+ * characters to replace the literal pattern characters. If the
+ * output string contains the character '<code>|</code>', this is
+ * taken to indicate the location of the <em>cursor</em> after
+ * replacement. The cursor is the point in the text at which the
+ * next replacement, if any, will be applied. The cursor is usually
+ * placed within the replacement text; however, it can actually be
+ * placed into the precending or following context by using the
+ * special character '@'. Examples:
+ *
+ * <pre>
+ * a {foo} z &gt; | @ bar; # foo -&gt; bar, move cursor before a
+ * {foo} xyz &gt; bar @@|; #&nbsp;foo -&gt; bar, cursor between y and z
+ * </pre>
+ *
+ * <p><b>UnicodeSet</b>
+ *
+ * <p><code>UnicodeSet</code> patterns may appear anywhere that
+ * makes sense. They may appear in variable definitions.
+ * Contrariwise, <code>UnicodeSet</code> patterns may themselves
+ * contain variable references, such as &quot;<code>$a=[a-z];$not_a=[^$a]</code>&quot;,
+ * or &quot;<code>$range=a-z;$ll=[$range]</code>&quot;.
+ *
+ * <p><code>UnicodeSet</code> patterns may also be embedded directly
+ * into rule strings. Thus, the following two rules are equivalent:
+ *
+ * <pre>
+ * $vowel=[aeiou]; $vowel&gt;'*'; # One way to do this
+ * [aeiou]&gt;'*'; # Another way
+ * </pre>
+ *
+ * <p>See {@link UnicodeSet} for more documentation and examples.
+ *
+ * <p><b>Segments</b>
+ *
+ * <p>Segments of the input string can be matched and copied to the
+ * output string. This makes certain sets of rules simpler and more
+ * general, and makes reordering possible. For example:
+ *
+ * <pre>
+ * ([a-z]) &gt; $1 $1; # double lowercase letters
+ * ([:Lu:]) ([:Ll:]) &gt; $2 $1; # reverse order of Lu-Ll pairs
+ * </pre>
+ *
+ * <p>The segment of the input string to be copied is delimited by
+ * &quot;<code>(</code>&quot; and &quot;<code>)</code>&quot;. Up to
+ * nine segments may be defined. Segments may not overlap. In the
+ * output string, &quot;<code>$1</code>&quot; through &quot;<code>$9</code>&quot;
+ * represent the input string segments, in left-to-right order of
+ * definition.
+ *
+ * <p><b>Anchors</b>
+ *
+ * <p>Patterns can be anchored to the beginning or the end of the text. This is done with the
+ * special characters '<code>^</code>' and '<code>$</code>'. For example:
+ *
+ * <pre>
+ * ^ a&nbsp;&nbsp; &gt; 'BEG_A'; &nbsp;&nbsp;# match 'a' at start of text
+ * &nbsp; a&nbsp;&nbsp; &gt; 'A'; # match other instances of 'a'
+ * &nbsp; z $ &gt; 'END_Z'; &nbsp;&nbsp;# match 'z' at end of text
+ * &nbsp; z&nbsp;&nbsp; &gt; 'Z';&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # match other instances of 'z'
+ * </pre>
+ *
+ * <p>It is also possible to match the beginning or the end of the text using a <code>UnicodeSet</code>.
+ * This is done by including a virtual anchor character '<code>$</code>' at the end of the
+ * set pattern. Although this is usually the match chafacter for the end anchor, the set will
+ * match either the beginning or the end of the text, depending on its placement. For
+ * example:
+ *
+ * <pre>
+ * $x = [a-z$]; &nbsp;&nbsp;# match 'a' through 'z' OR anchor
+ * $x 1&nbsp;&nbsp;&nbsp; &gt; 2;&nbsp;&nbsp; # match '1' after a-z or at the start
+ * &nbsp;&nbsp; 3 $x &gt; 4; &nbsp;&nbsp;# match '3' before a-z or at the end
+ * </pre>
+ *
+ * <p><b>Example</b>
+ *
+ * <p>The following example rules illustrate many of the features of
+ * the rule language.
+ *
+ * <table border="0" cellpadding="4">
+ * <tr>
+ * <td style="vertical-align: top;">Rule 1.</td>
+ * <td style="vertical-align: top; write-space: nowrap;"><code>abc{def}&gt;x|y</code></td>
+ * </tr>
+ * <tr>
+ * <td style="vertical-align: top;">Rule 2.</td>
+ * <td style="vertical-align: top; write-space: nowrap;"><code>xyz&gt;r</code></td>
+ * </tr>
+ * <tr>
+ * <td style="vertical-align: top;">Rule 3.</td>
+ * <td style="vertical-align: top; write-space: nowrap;"><code>yz&gt;q</code></td>
+ * </tr>
+ * </table>
+ *
+ * <p>Applying these rules to the string &quot;<code>adefabcdefz</code>&quot;
+ * yields the following results:
+ *
+ * <table border="0" cellpadding="4">
+ * <tr>
+ * <td style="vertical-align: top; write-space: nowrap;"><code>|adefabcdefz</code></td>
+ * <td style="vertical-align: top;">Initial state, no rules match. Advance
+ * cursor.</td>
+ * </tr>
+ * <tr>
+ * <td style="vertical-align: top; write-space: nowrap;"><code>a|defabcdefz</code></td>
+ * <td style="vertical-align: top;">Still no match. Rule 1 does not match
+ * because the preceding context is not present.</td>
+ * </tr>
+ * <tr>
+ * <td style="vertical-align: top; write-space: nowrap;"><code>ad|efabcdefz</code></td>
+ * <td style="vertical-align: top;">Still no match. Keep advancing until
+ * there is a match...</td>
+ * </tr>
+ * <tr>
+ * <td style="vertical-align: top; write-space: nowrap;"><code>ade|fabcdefz</code></td>
+ * <td style="vertical-align: top;">...</td>
+ * </tr>
+ * <tr>
+ * <td style="vertical-align: top; write-space: nowrap;"><code>adef|abcdefz</code></td>
+ * <td style="vertical-align: top;">...</td>
+ * </tr>
+ * <tr>
+ * <td style="vertical-align: top; write-space: nowrap;"><code>adefa|bcdefz</code></td>
+ * <td style="vertical-align: top;">...</td>
+ * </tr>
+ * <tr>
+ * <td style="vertical-align: top; write-space: nowrap;"><code>adefab|cdefz</code></td>
+ * <td style="vertical-align: top;">...</td>
+ * </tr>
+ * <tr>
+ * <td style="vertical-align: top; write-space: nowrap;"><code>adefabc|defz</code></td>
+ * <td style="vertical-align: top;">Rule 1 matches; replace &quot;<code>def</code>&quot;
+ * with &quot;<code>xy</code>&quot; and back up the cursor
+ * to before the '<code>y</code>'.</td>
+ * </tr>
+ * <tr>
+ * <td style="vertical-align: top; write-space: nowrap;"><code>adefabcx|yz</code></td>
+ * <td style="vertical-align: top;">Although &quot;<code>xyz</code>&quot; is
+ * present, rule 2 does not match because the cursor is
+ * before the '<code>y</code>', not before the '<code>x</code>'.
+ * Rule 3 does match. Replace &quot;<code>yz</code>&quot;
+ * with &quot;<code>q</code>&quot;.</td>
+ * </tr>
+ * <tr>
+ * <td style="vertical-align: top; write-space: nowrap;"><code>adefabcxq|</code></td>
+ * <td style="vertical-align: top;">The cursor is at the end;
+ * transliteration is complete.</td>
+ * </tr>
+ * </table>
+ *
+ * <p>The order of rules is significant. If multiple rules may match
+ * at some point, the first matching rule is applied.
+ *
+ * <p>Forward and reverse rules may have an empty output string.
+ * Otherwise, an empty left or right hand side of any statement is a
+ * syntax error.
+ *
+ * <p>Single quotes are used to quote any character other than a
+ * digit or letter. To specify a single quote itself, inside or
+ * outside of quotes, use two single quotes in a row. For example,
+ * the rule &quot;<code>'&gt;'&gt;o''clock</code>&quot; changes the
+ * string &quot;<code>&gt;</code>&quot; to the string &quot;<code>o'clock</code>&quot;.
+ *
+ * <p><b>Notes</b>
+ *
+ * <p>While a Transliterator is being built from rules, it checks that
+ * the rules are added in proper order. For example, if the rule
+ * &quot;a&gt;x&quot; is followed by the rule &quot;ab&gt;y&quot;,
+ * then the second rule will throw an exception. The reason is that
+ * the second rule can never be triggered, since the first rule
+ * always matches anything it matches. In other words, the first
+ * rule <em>masks</em> the second rule.
+ *
* @author Alan Liu
* @stable ICU 2.0
*/
@@ -746,9 +746,9 @@ public:
* for details.
* @param text the buffer holding transliterated and
* untransliterated text
- * @param index an array of three integers.
+ * @param index an array of three integers.
* @param status Output param to filled in with a success or an error.
- * @see #transliterate(Replaceable&, UTransPosition&, const UnicodeString&, UErrorCode &) const
+ * @see #transliterate(Replaceable&, UTransPosition&, const UnicodeString&, UErrorCode &) const
* @stable ICU 2.0
*/
virtual void transliterate(Replaceable& text, UTransPosition& index,
@@ -879,7 +879,7 @@ public:
/**
* Transliterate a substring of text, as specified by index, taking filters
* into account. This method is for subclasses that need to delegate to
- * another transliterator.
+ * another transliterator.
* @param text the text to be transliterated
* @param index the position indices
* @param incremental if TRUE, then assume more characters may be inserted
@@ -1093,19 +1093,19 @@ public:
/**
* Returns a <code>Transliterator</code> object constructed from
- * the given rule string. This will be a rule-based Transliterator,
+ * the given rule string. This will be a rule-based Transliterator,
* if the rule string contains only rules, or a
- * compound Transliterator, if it contains ID blocks, or a
- * null Transliterator, if it contains ID blocks which parse as
+ * compound Transliterator, if it contains ID blocks, or a
+ * null Transliterator, if it contains ID blocks which parse as
* empty for the given direction.
- *
+ *
* @param ID the id for the transliterator.
* @param rules rules, separated by ';'
* @param dir either FORWARD or REVERSE.
- * @param parseError Struct to receive information on position
+ * @param parseError Struct to receive information on position
* of error if an error is encountered
* @param status Output param set to success/failure code.
- * @return a newly created Transliterator
+ * @return a newly created Transliterator
* @stable ICU 2.0
*/
static Transliterator* U_EXPORT2 createFromRules(const UnicodeString& ID,
@@ -1568,7 +1568,7 @@ inline int32_t Transliterator::getMaximumContextLength(void) const {
inline void Transliterator::setID(const UnicodeString& id) {
ID = id;
// NUL-terminate the ID string, which is a non-aliased copy.
- ID.append((char16_t)0);
+ ID.append((char16_t)0);
ID.truncate(ID.length()-1);
}
@@ -1590,6 +1590,6 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_TRANSLITERATION */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/tzfmt.h b/contrib/libs/icu/include/unicode/tzfmt.h
index 3f65b853ed..6d3863b1e5 100644
--- a/contrib/libs/icu/include/unicode/tzfmt.h
+++ b/contrib/libs/icu/include/unicode/tzfmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -16,8 +16,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
#include "unicode/format.h"
@@ -239,10 +239,10 @@ typedef enum UTimeZoneFormatParseOption {
*/
UTZFMT_PARSE_OPTION_ALL_STYLES = 0x01,
/**
- * When parsing a time zone display name in \link UTZFMT_STYLE_SPECIFIC_SHORT \endlink,
+ * When parsing a time zone display name in \link UTZFMT_STYLE_SPECIFIC_SHORT \endlink,
* look for the IANA tz database compatible zone abbreviations in addition
- * to the localized names coming from the icu::TimeZoneNames currently
- * used by the icu::TimeZoneFormat.
+ * to the localized names coming from the icu::TimeZoneNames currently
+ * used by the icu::TimeZoneFormat.
* @stable ICU 54
*/
UTZFMT_PARSE_OPTION_TZ_DATABASE_ABBREVIATIONS = 0x02
@@ -307,7 +307,7 @@ public:
* @return A copy of the object
* @stable ICU 50
*/
- virtual TimeZoneFormat* clone() const;
+ virtual TimeZoneFormat* clone() const;
/**
* Creates an instance of <code>TimeZoneFormat</code> for the given locale.
@@ -944,7 +944,7 @@ private:
* @param parsedLen the parsed length, or 0 on failure.
* @return the parsed offset in milliseconds.
*/
- int32_t parseDefaultOffsetFields(const UnicodeString& text, int32_t start, char16_t separator,
+ int32_t parseDefaultOffsetFields(const UnicodeString& text, int32_t start, char16_t separator,
int32_t& parsedLen) const;
/**
@@ -984,7 +984,7 @@ private:
* @param maxFields The maximum fields
* @return The offset string
*/
- static UnicodeString& formatOffsetWithAsciiDigits(int32_t offset, char16_t sep,
+ static UnicodeString& formatOffsetWithAsciiDigits(int32_t offset, char16_t sep,
OffsetFields minFields, OffsetFields maxFields, UnicodeString& result);
/**
@@ -1014,7 +1014,7 @@ private:
* @param maxFields The maximum Fields to be parsed
* @return Parsed offset, 0 or positive number.
*/
- static int32_t parseAsciiOffsetFields(const UnicodeString& text, ParsePosition& pos, char16_t sep,
+ static int32_t parseAsciiOffsetFields(const UnicodeString& text, ParsePosition& pos, char16_t sep,
OffsetFields minFields, OffsetFields maxFields);
/**
@@ -1096,7 +1096,7 @@ private:
U_NAMESPACE_END
#endif /* !UCONFIG_NO_FORMATTING */
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/tznames.h b/contrib/libs/icu/include/unicode/tznames.h
index 5c79345077..860494221d 100644
--- a/contrib/libs/icu/include/unicode/tznames.h
+++ b/contrib/libs/icu/include/unicode/tznames.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -15,8 +15,8 @@
*/
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
#include "unicode/uloc.h"
@@ -293,12 +293,12 @@ public:
virtual UnicodeString& getDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UDate date, UnicodeString& name) const;
/**
- * @internal ICU internal only, for specific users only until proposed publicly.
+ * @internal ICU internal only, for specific users only until proposed publicly.
*/
virtual void loadAllDisplayNames(UErrorCode& status);
/**
- * @internal ICU internal only, for specific users only until proposed publicly.
+ * @internal ICU internal only, for specific users only until proposed publicly.
*/
virtual void getDisplayNames(const UnicodeString& tzID, const UTimeZoneNameType types[], int32_t numTypes, UDate date, UnicodeString dest[], UErrorCode& status) const;
@@ -413,7 +413,7 @@ public:
U_NAMESPACE_END
#endif
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/tzrule.h b/contrib/libs/icu/include/unicode/tzrule.h
index 9d767bbf94..795806d90f 100644
--- a/contrib/libs/icu/include/unicode/tzrule.h
+++ b/contrib/libs/icu/include/unicode/tzrule.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -16,8 +16,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
#include "unicode/uobject.h"
@@ -47,7 +47,7 @@ public:
* @return A copy of the object.
* @stable ICU 3.8
*/
- virtual TimeZoneRule* clone() const = 0;
+ virtual TimeZoneRule* clone() const = 0;
/**
* Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
@@ -231,7 +231,7 @@ public:
* @return A copy of the object.
* @stable ICU 3.8
*/
- virtual InitialTimeZoneRule* clone() const;
+ virtual InitialTimeZoneRule* clone() const;
/**
* Assignment operator.
@@ -442,7 +442,7 @@ public:
* @return A copy of the object.
* @stable ICU 3.8
*/
- virtual AnnualTimeZoneRule* clone() const;
+ virtual AnnualTimeZoneRule* clone() const;
/**
* Assignment operator.
@@ -658,7 +658,7 @@ public:
* @return A copy of the object.
* @stable ICU 3.8
*/
- virtual TimeArrayTimeZoneRule* clone() const;
+ virtual TimeArrayTimeZoneRule* clone() const;
/**
* Assignment operator.
@@ -827,8 +827,8 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // TZRULE_H
//eof
diff --git a/contrib/libs/icu/include/unicode/tztrans.h b/contrib/libs/icu/include/unicode/tztrans.h
index 78a5152c83..217d711eec 100644
--- a/contrib/libs/icu/include/unicode/tztrans.h
+++ b/contrib/libs/icu/include/unicode/tztrans.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -16,8 +16,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
#include "unicode/uobject.h"
@@ -70,7 +70,7 @@ public:
* @return A copy of the object.
* @stable ICU 3.8
*/
- TimeZoneTransition* clone() const;
+ TimeZoneTransition* clone() const;
/**
* Assignment operator.
@@ -194,8 +194,8 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // TZTRANS_H
//eof
diff --git a/contrib/libs/icu/include/unicode/ubidi.h b/contrib/libs/icu/include/unicode/ubidi.h
index 8dd20a529f..f4875c8801 100644
--- a/contrib/libs/icu/include/unicode/ubidi.h
+++ b/contrib/libs/icu/include/unicode/ubidi.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: ubidi.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -323,10 +323,10 @@
* these special values are designed that way. Also, the implementation
* assumes that UBIDI_MAX_EXPLICIT_LEVEL is odd.
*
- * Note: The numeric values of the related constants will not change:
- * They are tied to the use of 7-bit byte values (plus the override bit)
- * and of the UBiDiLevel=uint8_t data type in this API.
- *
+ * Note: The numeric values of the related constants will not change:
+ * They are tied to the use of 7-bit byte values (plus the override bit)
+ * and of the UBiDiLevel=uint8_t data type in this API.
+ *
* @see UBIDI_DEFAULT_LTR
* @see UBIDI_DEFAULT_RTL
* @see UBIDI_LEVEL_OVERRIDE
@@ -390,8 +390,8 @@ typedef uint8_t UBiDiLevel;
/**
* Maximum explicit embedding level.
- * Same as the max_depth value in the
- * <a href="http://www.unicode.org/reports/tr9/#BD2">Unicode Bidirectional Algorithm</a>.
+ * Same as the max_depth value in the
+ * <a href="http://www.unicode.org/reports/tr9/#BD2">Unicode Bidirectional Algorithm</a>.
* (The maximum resolved level can be up to <code>UBIDI_MAX_EXPLICIT_LEVEL+1</code>).
* @stable ICU 2.0
*/
@@ -698,7 +698,7 @@ typedef enum UBiDiReorderingMode {
* @stable ICU 3.6 */
UBIDI_REORDER_DEFAULT = 0,
/** Logical to Visual algorithm which handles numbers in a way which
- * mimics the behavior of Windows XP.
+ * mimics the behavior of Windows XP.
* @stable ICU 3.6 */
UBIDI_REORDER_NUMBERS_SPECIAL,
/** Logical to Visual algorithm grouping numbers with adjacent R characters
@@ -1148,7 +1148,7 @@ ubidi_setContext(UBiDi *pBiDi,
/**
* Perform the Unicode Bidi algorithm. It is defined in the
- * <a href="http://www.unicode.org/unicode/reports/tr9/">Unicode Standard Annex #9</a>,
+ * <a href="http://www.unicode.org/unicode/reports/tr9/">Unicode Standard Annex #9</a>,
* version 13,
* also described in The Unicode Standard, Version 4.0 .<p>
*
@@ -1202,14 +1202,14 @@ ubidi_setContext(UBiDi *pBiDi,
* A level overrides the directional property of its corresponding
* (same index) character if the level has the
* <code>#UBIDI_LEVEL_OVERRIDE</code> bit set.<br><br>
- * Aside from that bit, it must be
+ * Aside from that bit, it must be
* <code>paraLevel<=embeddingLevels[]<=UBIDI_MAX_EXPLICIT_LEVEL</code>,
- * except that level 0 is always allowed.
- * Level 0 for a paragraph separator prevents reordering of paragraphs;
- * this only works reliably if <code>#UBIDI_LEVEL_OVERRIDE</code>
- * is also set for paragraph separators.
- * Level 0 for other characters is treated as a wildcard
- * and is lifted up to the resolved level of the surrounding paragraph.<br><br>
+ * except that level 0 is always allowed.
+ * Level 0 for a paragraph separator prevents reordering of paragraphs;
+ * this only works reliably if <code>#UBIDI_LEVEL_OVERRIDE</code>
+ * is also set for paragraph separators.
+ * Level 0 for other characters is treated as a wildcard
+ * and is lifted up to the resolved level of the surrounding paragraph.<br><br>
* <strong>Caution: </strong>A copy of this pointer, not of the levels,
* will be stored in the <code>UBiDi</code> object;
* the <code>embeddingLevels</code> array must not be
@@ -2002,7 +2002,7 @@ U_CDECL_BEGIN
*
* @return The directional property / Bidi class for the given code point
* <code>c</code> if the default class has been overridden, or
- * <code>u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1</code>
+ * <code>u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1</code>
* if the standard Bidi class value for <code>c</code> is to be used.
* @see ubidi_setClassCallback
* @see ubidi_getClassCallback
@@ -2016,7 +2016,7 @@ U_CDECL_END
/**
* Retrieve the Bidi class for a given code point.
* <p>If a <code>#UBiDiClassCallback</code> callback is defined and returns a
- * value other than <code>u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1</code>,
+ * value other than <code>u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1</code>,
* that value is used; otherwise the default class determination mechanism is invoked.</p>
*
* @param pBiDi is the paragraph <code>UBiDi</code> object.
diff --git a/contrib/libs/icu/include/unicode/ubiditransform.h b/contrib/libs/icu/include/unicode/ubiditransform.h
index 7b20de33a8..5c08ed5df0 100644
--- a/contrib/libs/icu/include/unicode/ubiditransform.h
+++ b/contrib/libs/icu/include/unicode/ubiditransform.h
@@ -1,12 +1,12 @@
/*
******************************************************************************
*
-* © 2016 and later: Unicode, Inc. and others.
+* © 2016 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
*
******************************************************************************
* file name: ubiditransform.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -26,54 +26,54 @@
/**
* \file
* \brief Bidi Transformations
- */
-
-/**
- * `UBiDiOrder` indicates the order of text.
+ */
+
+/**
+ * `UBiDiOrder` indicates the order of text.
*
* This bidi transformation engine supports all possible combinations (4 in
* total) of input and output text order:
- *
- * - <logical input, visual output>: unless the output direction is RTL, this
- * corresponds to a normal operation of the Bidi algorithm as described in the
- * Unicode Technical Report and implemented by `UBiDi` when the
- * reordering mode is set to `UBIDI_REORDER_DEFAULT`. Visual RTL
- * mode is not supported by `UBiDi` and is accomplished through
- * reversing a visual LTR string,
- *
- * - <visual input, logical output>: unless the input direction is RTL, this
- * corresponds to an "inverse bidi algorithm" in `UBiDi` with the
- * reordering mode set to `UBIDI_REORDER_INVERSE_LIKE_DIRECT`.
- * Visual RTL mode is not not supported by `UBiDi` and is
- * accomplished through reversing a visual LTR string,
- *
- * - <logical input, logical output>: if the input and output base directions
- * mismatch, this corresponds to the `UBiDi` implementation with the
- * reordering mode set to `UBIDI_REORDER_RUNS_ONLY`; and if the
- * input and output base directions are identical, the transformation engine
- * will only handle character mirroring and Arabic shaping operations without
- * reordering,
- *
- * - <visual input, visual output>: this reordering mode is not supported by
- * the `UBiDi` engine; it implies character mirroring, Arabic
- * shaping, and - if the input/output base directions mismatch - string
- * reverse operations.
+ *
+ * - <logical input, visual output>: unless the output direction is RTL, this
+ * corresponds to a normal operation of the Bidi algorithm as described in the
+ * Unicode Technical Report and implemented by `UBiDi` when the
+ * reordering mode is set to `UBIDI_REORDER_DEFAULT`. Visual RTL
+ * mode is not supported by `UBiDi` and is accomplished through
+ * reversing a visual LTR string,
+ *
+ * - <visual input, logical output>: unless the input direction is RTL, this
+ * corresponds to an "inverse bidi algorithm" in `UBiDi` with the
+ * reordering mode set to `UBIDI_REORDER_INVERSE_LIKE_DIRECT`.
+ * Visual RTL mode is not not supported by `UBiDi` and is
+ * accomplished through reversing a visual LTR string,
+ *
+ * - <logical input, logical output>: if the input and output base directions
+ * mismatch, this corresponds to the `UBiDi` implementation with the
+ * reordering mode set to `UBIDI_REORDER_RUNS_ONLY`; and if the
+ * input and output base directions are identical, the transformation engine
+ * will only handle character mirroring and Arabic shaping operations without
+ * reordering,
+ *
+ * - <visual input, visual output>: this reordering mode is not supported by
+ * the `UBiDi` engine; it implies character mirroring, Arabic
+ * shaping, and - if the input/output base directions mismatch - string
+ * reverse operations.
* @see ubidi_setInverse
* @see ubidi_setReorderingMode
* @see UBIDI_REORDER_DEFAULT
* @see UBIDI_REORDER_INVERSE_LIKE_DIRECT
* @see UBIDI_REORDER_RUNS_ONLY
- * @stable ICU 58
+ * @stable ICU 58
*/
typedef enum {
/** 0: Constant indicating a logical order.
* This is the default for input text.
- * @stable ICU 58
+ * @stable ICU 58
*/
UBIDI_LOGICAL = 0,
/** 1: Constant indicating a visual order.
* This is a default for output text.
- * @stable ICU 58
+ * @stable ICU 58
*/
UBIDI_VISUAL
} UBiDiOrder;
@@ -86,20 +86,20 @@ typedef enum {
* @see ubidi_setReorderingOptions
* @see ubidi_writeReordered
* @see ubidi_writeReverse
- * @stable ICU 58
+ * @stable ICU 58
*/
typedef enum {
/** 0: Constant indicating that character mirroring should not be
* performed.
* This is the default.
- * @stable ICU 58
+ * @stable ICU 58
*/
UBIDI_MIRRORING_OFF = 0,
/** 1: Constant indicating that character mirroring should be performed.
* This corresponds to calling <code>ubidi_writeReordered</code> or
* <code>ubidi_writeReverse</code> with the
* <code>UBIDI_DO_MIRRORING</code> option bit set.
- * @stable ICU 58
+ * @stable ICU 58
*/
UBIDI_MIRRORING_ON
} UBiDiMirroring;
@@ -107,7 +107,7 @@ typedef enum {
/**
* Forward declaration of the <code>UBiDiTransform</code> structure that stores
* information used by the layout transformation engine.
- * @stable ICU 58
+ * @stable ICU 58
*/
typedef struct UBiDiTransform UBiDiTransform;
@@ -243,9 +243,9 @@ typedef struct UBiDiTransform UBiDiTransform;
* @see UBiDiMirroring
* @see ubidi_setPara
* @see u_shapeArabic
- * @stable ICU 58
+ * @stable ICU 58
*/
-U_STABLE uint32_t U_EXPORT2
+U_STABLE uint32_t U_EXPORT2
ubiditransform_transform(UBiDiTransform *pBiDiTransform,
const UChar *src, int32_t srcLength,
UChar *dest, int32_t destSize,
@@ -289,16 +289,16 @@ ubiditransform_transform(UBiDiTransform *pBiDiTransform,
* <code>ubiditransform_close()</code>.
*
* @return An empty <code>UBiDiTransform</code> object.
- * @stable ICU 58
+ * @stable ICU 58
*/
-U_STABLE UBiDiTransform* U_EXPORT2
+U_STABLE UBiDiTransform* U_EXPORT2
ubiditransform_open(UErrorCode *pErrorCode);
/**
* Deallocates the given <code>UBiDiTransform</code> object.
- * @stable ICU 58
+ * @stable ICU 58
*/
-U_STABLE void U_EXPORT2
+U_STABLE void U_EXPORT2
ubiditransform_close(UBiDiTransform *pBidiTransform);
#if U_SHOW_CPLUSPLUS_API
@@ -312,7 +312,7 @@ U_NAMESPACE_BEGIN
*
* @see LocalPointerBase
* @see LocalPointer
- * @stable ICU 58
+ * @stable ICU 58
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUBiDiTransformPointer, UBiDiTransform, ubiditransform_close);
diff --git a/contrib/libs/icu/include/unicode/ubrk.h b/contrib/libs/icu/include/unicode/ubrk.h
index 453a15638d..73c1553b24 100644
--- a/contrib/libs/icu/include/unicode/ubrk.h
+++ b/contrib/libs/icu/include/unicode/ubrk.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -230,8 +230,8 @@ typedef enum USentenceBreakTag {
* @param locale The locale specifying the text-breaking conventions. Note that
* locale keys such as "lb" and "ss" may be used to modify text break behavior,
* see general discussion of BreakIterator C API.
- * @param text The text to be iterated over. May be null, in which case ubrk_setText() is
- * used to specify the text to be iterated.
+ * @param text The text to be iterated over. May be null, in which case ubrk_setText() is
+ * used to specify the text to be iterated.
* @param textLength The number of characters in text, or -1 if null-terminated.
* @param status A UErrorCode to receive any errors.
* @return A UBreakIterator for the specified locale.
@@ -269,31 +269,31 @@ ubrk_openRules(const UChar *rules,
UErrorCode *status);
/**
- * Open a new UBreakIterator for locating text boundaries using precompiled binary rules.
- * Opening a UBreakIterator this way is substantially faster than using ubrk_openRules.
- * Binary rules may be obtained using ubrk_getBinaryRules. The compiled rules are not
- * compatible across different major versions of ICU, nor across platforms of different
- * endianness or different base character set family (ASCII vs EBCDIC).
- * @param binaryRules A set of compiled binary rules specifying the text breaking
- * conventions. Ownership of the storage containing the compiled
- * rules remains with the caller of this function. The compiled
- * rules must not be modified or deleted during the life of the
- * break iterator.
- * @param rulesLength The length of binaryRules in bytes; must be >= 0.
- * @param text The text to be iterated over. May be null, in which case
- * ubrk_setText() is used to specify the text to be iterated.
- * @param textLength The number of characters in text, or -1 if null-terminated.
- * @param status Pointer to UErrorCode to receive any errors.
- * @return UBreakIterator for the specified rules.
- * @see ubrk_getBinaryRules
- * @stable ICU 59
- */
-U_STABLE UBreakIterator* U_EXPORT2
-ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength,
- const UChar * text, int32_t textLength,
- UErrorCode * status);
-
-/**
+ * Open a new UBreakIterator for locating text boundaries using precompiled binary rules.
+ * Opening a UBreakIterator this way is substantially faster than using ubrk_openRules.
+ * Binary rules may be obtained using ubrk_getBinaryRules. The compiled rules are not
+ * compatible across different major versions of ICU, nor across platforms of different
+ * endianness or different base character set family (ASCII vs EBCDIC).
+ * @param binaryRules A set of compiled binary rules specifying the text breaking
+ * conventions. Ownership of the storage containing the compiled
+ * rules remains with the caller of this function. The compiled
+ * rules must not be modified or deleted during the life of the
+ * break iterator.
+ * @param rulesLength The length of binaryRules in bytes; must be >= 0.
+ * @param text The text to be iterated over. May be null, in which case
+ * ubrk_setText() is used to specify the text to be iterated.
+ * @param textLength The number of characters in text, or -1 if null-terminated.
+ * @param status Pointer to UErrorCode to receive any errors.
+ * @return UBreakIterator for the specified rules.
+ * @see ubrk_getBinaryRules
+ * @stable ICU 59
+ */
+U_STABLE UBreakIterator* U_EXPORT2
+ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength,
+ const UChar * text, int32_t textLength,
+ UErrorCode * status);
+
+/**
* Thread safe cloning operation
* @param bi iterator to be cloned
* @param stackBuffer <em>Deprecated functionality as of ICU 52, use NULL.</em><br>
@@ -507,7 +507,7 @@ ubrk_countAvailable(void);
/**
-* Returns true if the specified position is a boundary position. As a side
+* Returns true if the specified position is a boundary position. As a side
* effect, leaves the iterator pointing to the first boundary position at
* or after "offset".
* @param bi The break iterator to use.
@@ -541,7 +541,7 @@ ubrk_getRuleStatus(UBreakIterator *bi);
* @param fillInVec an array to be filled in with the status values.
* @param capacity the length of the supplied vector. A length of zero causes
* the function to return the number of status values, in the
- * normal way, without attempting to store any values.
+ * normal way, without attempting to store any values.
* @param status receives error codes.
* @return The number of rule status values from rules that determined
* the most recent boundary returned by the break iterator.
@@ -592,37 +592,37 @@ ubrk_refreshUText(UBreakIterator *bi,
UText *text,
UErrorCode *status);
-
-/**
- * Get a compiled binary version of the rules specifying the behavior of a UBreakIterator.
- * The binary rules may be used with ubrk_openBinaryRules to open a new UBreakIterator
- * more quickly than using ubrk_openRules. The compiled rules are not compatible across
- * different major versions of ICU, nor across platforms of different endianness or
- * different base character set family (ASCII vs EBCDIC). Supports preflighting (with
- * binaryRules=NULL and rulesCapacity=0) to get the rules length without copying them to
- * the binaryRules buffer. However, whether preflighting or not, if the actual length
- * is greater than INT32_MAX, then the function returns 0 and sets *status to
- * U_INDEX_OUTOFBOUNDS_ERROR.
-
- * @param bi The break iterator to use.
- * @param binaryRules Buffer to receive the compiled binary rules; set to NULL for
- * preflighting.
- * @param rulesCapacity Capacity (in bytes) of the binaryRules buffer; set to 0 for
- * preflighting. Must be >= 0.
- * @param status Pointer to UErrorCode to receive any errors, such as
- * U_BUFFER_OVERFLOW_ERROR, U_INDEX_OUTOFBOUNDS_ERROR, or
- * U_ILLEGAL_ARGUMENT_ERROR.
- * @return The actual byte length of the binary rules, if <= INT32_MAX;
- * otherwise 0. If not preflighting and this is larger than
- * rulesCapacity, *status will be set to an error.
- * @see ubrk_openBinaryRules
- * @stable ICU 59
- */
-U_STABLE int32_t U_EXPORT2
-ubrk_getBinaryRules(UBreakIterator *bi,
- uint8_t * binaryRules, int32_t rulesCapacity,
- UErrorCode * status);
-
+
+/**
+ * Get a compiled binary version of the rules specifying the behavior of a UBreakIterator.
+ * The binary rules may be used with ubrk_openBinaryRules to open a new UBreakIterator
+ * more quickly than using ubrk_openRules. The compiled rules are not compatible across
+ * different major versions of ICU, nor across platforms of different endianness or
+ * different base character set family (ASCII vs EBCDIC). Supports preflighting (with
+ * binaryRules=NULL and rulesCapacity=0) to get the rules length without copying them to
+ * the binaryRules buffer. However, whether preflighting or not, if the actual length
+ * is greater than INT32_MAX, then the function returns 0 and sets *status to
+ * U_INDEX_OUTOFBOUNDS_ERROR.
+
+ * @param bi The break iterator to use.
+ * @param binaryRules Buffer to receive the compiled binary rules; set to NULL for
+ * preflighting.
+ * @param rulesCapacity Capacity (in bytes) of the binaryRules buffer; set to 0 for
+ * preflighting. Must be >= 0.
+ * @param status Pointer to UErrorCode to receive any errors, such as
+ * U_BUFFER_OVERFLOW_ERROR, U_INDEX_OUTOFBOUNDS_ERROR, or
+ * U_ILLEGAL_ARGUMENT_ERROR.
+ * @return The actual byte length of the binary rules, if <= INT32_MAX;
+ * otherwise 0. If not preflighting and this is larger than
+ * rulesCapacity, *status will be set to an error.
+ * @see ubrk_openBinaryRules
+ * @stable ICU 59
+ */
+U_STABLE int32_t U_EXPORT2
+ubrk_getBinaryRules(UBreakIterator *bi,
+ uint8_t * binaryRules, int32_t rulesCapacity,
+ UErrorCode * status);
+
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
#endif
diff --git a/contrib/libs/icu/include/unicode/ucal.h b/contrib/libs/icu/include/unicode/ucal.h
index 64a8d5dfe6..c198450ba2 100644
--- a/contrib/libs/icu/include/unicode/ucal.h
+++ b/contrib/libs/icu/include/unicode/ucal.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -105,7 +105,7 @@
* <p>
* <strong>Note:</strong> for some non-Gregorian calendars, different
* fields may be necessary for complete disambiguation. For example, a full
- * specification of the historical Arabic astronomical calendar requires year,
+ * specification of the historical Arabic astronomical calendar requires year,
* month, day-of-month <em>and</em> day-of-week in some cases.
*
* <p>
@@ -139,25 +139,25 @@
* For example, subtracting 5 days from the date <code>September 12, 1996</code>
* results in <code>September 7, 1996</code>.
*
- * <p>
- * The Japanese calendar uses a combination of era name and year number.
- * When an emperor of Japan abdicates and a new emperor ascends the throne,
- * a new era is declared and year number is reset to 1. Even if the date of
- * abdication is scheduled ahead of time, the new era name might not be
- * announced until just before the date. In such case, ICU4C may include
- * a start date of future era without actual era name, but not enabled
- * by default. ICU4C users who want to test the behavior of the future era
- * can enable the tentative era by:
- * <ul>
- * <li>Environment variable <code>ICU_ENABLE_TENTATIVE_ERA=true</code>.</li>
- * </ul>
- *
+ * <p>
+ * The Japanese calendar uses a combination of era name and year number.
+ * When an emperor of Japan abdicates and a new emperor ascends the throne,
+ * a new era is declared and year number is reset to 1. Even if the date of
+ * abdication is scheduled ahead of time, the new era name might not be
+ * announced until just before the date. In such case, ICU4C may include
+ * a start date of future era without actual era name, but not enabled
+ * by default. ICU4C users who want to test the behavior of the future era
+ * can enable the tentative era by:
+ * <ul>
+ * <li>Environment variable <code>ICU_ENABLE_TENTATIVE_ERA=true</code>.</li>
+ * </ul>
+ *
* @stable ICU 2.0
*/
/**
* The time zone ID reserved for unknown time zone.
- * It behaves like the GMT/UTC time zone but has the special ID "Etc/Unknown".
+ * It behaves like the GMT/UTC time zone but has the special ID "Etc/Unknown".
* @stable ICU 4.8
*/
#define UCAL_UNKNOWN_ZONE_ID "Etc/Unknown"
@@ -439,15 +439,15 @@ enum UCalendarDateFields {
*/
UCAL_IS_LEAP_MONTH,
- /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
- * it is needed for layout of Calendar, DateFormat, and other objects */
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+ /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
+ * it is needed for layout of Calendar, DateFormat, and other objects */
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* One more than the highest normal UCalendarDateFields value.
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
- UCAL_FIELD_COUNT,
-#endif // U_FORCE_HIDE_DEPRECATED_API
+ UCAL_FIELD_COUNT,
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Field number indicating the
@@ -623,13 +623,13 @@ ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
/**
* Return the default time zone. The default is determined initially
- * by querying the host operating system. If the host system detection
- * routines fail, or if they specify a TimeZone or TimeZone offset
- * which is not recognized, then the special TimeZone "Etc/Unknown"
- * is returned.
- *
- * The default may be changed with `ucal_setDefaultTimeZone()` or with
- * the C++ TimeZone API, `TimeZone::adoptDefault(TimeZone*)`.
+ * by querying the host operating system. If the host system detection
+ * routines fail, or if they specify a TimeZone or TimeZone offset
+ * which is not recognized, then the special TimeZone "Etc/Unknown"
+ * is returned.
+ *
+ * The default may be changed with `ucal_setDefaultTimeZone()` or with
+ * the C++ TimeZone API, `TimeZone::adoptDefault(TimeZone*)`.
*
* @param result A buffer to receive the result, or NULL
*
@@ -639,9 +639,9 @@ ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
*
* @return The result string length, not including the terminating
* null
- *
- * @see #UCAL_UNKNOWN_ZONE_ID
- *
+ *
+ * @see #UCAL_UNKNOWN_ZONE_ID
+ *
* @stable ICU 2.6
*/
U_STABLE int32_t U_EXPORT2
@@ -659,43 +659,43 @@ ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec);
U_STABLE void U_EXPORT2
ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
-#ifndef U_HIDE_DRAFT_API
-
+#ifndef U_HIDE_DRAFT_API
+
/**
- * Return the current host time zone. The host time zone is detected from
- * the current host system configuration by querying the host operating
- * system. If the host system detection routines fail, or if they specify
- * a TimeZone or TimeZone offset which is not recognized, then the special
- * TimeZone "Etc/Unknown" is returned.
- *
- * Note that host time zone and the ICU default time zone can be different.
- *
- * The ICU default time zone does not change once initialized unless modified
- * by calling `ucal_setDefaultTimeZone()` or with the C++ TimeZone API,
- * `TimeZone::adoptDefault(TimeZone*)`.
- *
- * If the host operating system configuration has changed since ICU has
- * initialized then the returned value can be different than the ICU default
- * time zone, even if the default has not changed.
+ * Return the current host time zone. The host time zone is detected from
+ * the current host system configuration by querying the host operating
+ * system. If the host system detection routines fail, or if they specify
+ * a TimeZone or TimeZone offset which is not recognized, then the special
+ * TimeZone "Etc/Unknown" is returned.
*
- * <p>This function is not thread safe.</p>
- *
- * @param result A buffer to receive the result, or NULL
- * @param resultCapacity The capacity of the result buffer
- * @param ec input/output error code
- * @return The result string length, not including the terminating
- * null
- *
- * @see #UCAL_UNKNOWN_ZONE_ID
- *
- * @draft ICU 65
- */
-U_DRAFT int32_t U_EXPORT2
-ucal_getHostTimeZone(UChar *result, int32_t resultCapacity, UErrorCode *ec);
-
-#endif // U_HIDE_DRAFT_API
-
-/**
+ * Note that host time zone and the ICU default time zone can be different.
+ *
+ * The ICU default time zone does not change once initialized unless modified
+ * by calling `ucal_setDefaultTimeZone()` or with the C++ TimeZone API,
+ * `TimeZone::adoptDefault(TimeZone*)`.
+ *
+ * If the host operating system configuration has changed since ICU has
+ * initialized then the returned value can be different than the ICU default
+ * time zone, even if the default has not changed.
+ *
+ * <p>This function is not thread safe.</p>
+ *
+ * @param result A buffer to receive the result, or NULL
+ * @param resultCapacity The capacity of the result buffer
+ * @param ec input/output error code
+ * @return The result string length, not including the terminating
+ * null
+ *
+ * @see #UCAL_UNKNOWN_ZONE_ID
+ *
+ * @draft ICU 65
+ */
+U_DRAFT int32_t U_EXPORT2
+ucal_getHostTimeZone(UChar *result, int32_t resultCapacity, UErrorCode *ec);
+
+#endif // U_HIDE_DRAFT_API
+
+/**
* Return the amount of time in milliseconds that the clock is
* advanced during daylight savings time for the given time zone, or
* zero if the time zone does not observe daylight savings time.
diff --git a/contrib/libs/icu/include/unicode/ucasemap.h b/contrib/libs/icu/include/unicode/ucasemap.h
index 61c788d925..6b253e3d63 100644
--- a/contrib/libs/icu/include/unicode/ucasemap.h
+++ b/contrib/libs/icu/include/unicode/ucasemap.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: ucasemap.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -22,8 +22,8 @@
#define __UCASEMAP_H__
#include "unicode/utypes.h"
-#include "unicode/localpointer.h"
-#include "unicode/stringoptions.h"
+#include "unicode/localpointer.h"
+#include "unicode/stringoptions.h"
#include "unicode/ustring.h"
/**
@@ -202,7 +202,7 @@ ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode
* The standard titlecase iterator for the root locale implements the
* algorithm of Unicode TR 21.
*
- * This function uses only the setText(), first() and next() methods of the
+ * This function uses only the setText(), first() and next() methods of the
* provided break iterator.
*
* The result may be longer or shorter than the original.
@@ -213,7 +213,7 @@ ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode
* @param dest A buffer for the result string. The result will be NUL-terminated if
* the buffer is large enough.
* The contents is undefined in case of failure.
- * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
+ * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
* dest may be NULL and the function will only return the length of the result
* without writing any of the result string.
* @param src The original string.
@@ -232,7 +232,7 @@ ucasemap_toTitle(UCaseMap *csm,
const UChar *src, int32_t srcLength,
UErrorCode *pErrorCode);
-#endif // UCONFIG_NO_BREAK_ITERATION
+#endif // UCONFIG_NO_BREAK_ITERATION
/**
* Lowercase the characters in a UTF-8 string.
diff --git a/contrib/libs/icu/include/unicode/ucat.h b/contrib/libs/icu/include/unicode/ucat.h
index f53ed2291a..4d1ff3f6b2 100644
--- a/contrib/libs/icu/include/unicode/ucat.h
+++ b/contrib/libs/icu/include/unicode/ucat.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/include/unicode/uchar.h b/contrib/libs/icu/include/unicode/uchar.h
index d4e5beaa0f..3b55b2326d 100644
--- a/contrib/libs/icu/include/unicode/uchar.h
+++ b/contrib/libs/icu/include/unicode/uchar.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -26,26 +26,26 @@
#define UCHAR_H
#include "unicode/utypes.h"
-#include "unicode/stringoptions.h"
-#include "unicode/ucpmap.h"
-
-#if !defined(USET_DEFINED) && !defined(U_IN_DOXYGEN)
-
-#define USET_DEFINED
-
-/**
- * USet is the C API type corresponding to C++ class UnicodeSet.
- * It is forward-declared here to avoid including unicode/uset.h file if related
- * APIs are not used.
- *
- * @see ucnv_getUnicodeSet
- * @stable ICU 2.4
- */
-typedef struct USet USet;
-
-#endif
-
-
+#include "unicode/stringoptions.h"
+#include "unicode/ucpmap.h"
+
+#if !defined(USET_DEFINED) && !defined(U_IN_DOXYGEN)
+
+#define USET_DEFINED
+
+/**
+ * USet is the C API type corresponding to C++ class UnicodeSet.
+ * It is forward-declared here to avoid including unicode/uset.h file if related
+ * APIs are not used.
+ *
+ * @see ucnv_getUnicodeSet
+ * @stable ICU 2.4
+ */
+typedef struct USet USet;
+
+#endif
+
+
U_CDECL_BEGIN
/*==========================================================================*/
@@ -60,7 +60,7 @@ U_CDECL_BEGIN
* @see u_getUnicodeVersion
* @stable ICU 2.0
*/
-#define U_UNICODE_VERSION "13.0"
+#define U_UNICODE_VERSION "13.0"
/**
* \file
@@ -79,18 +79,18 @@ U_CDECL_BEGIN
* "About the Unicode Character Database" (http://www.unicode.org/ucd/)
* and the ICU User Guide chapter on Properties (http://icu-project.org/userguide/properties.html).
*
- * Many properties are accessible via generic functions that take a UProperty selector.
- * - u_hasBinaryProperty() returns a binary value (TRUE/FALSE) per property and code point.
- * - u_getIntPropertyValue() returns an integer value per property and code point.
- * For each supported enumerated or catalog property, there is
- * an enum type for all of the property's values, and
- * u_getIntPropertyValue() returns the numeric values of those constants.
- * - u_getBinaryPropertySet() returns a set for each ICU-supported binary property with
- * all code points for which the property is true.
- * - u_getIntPropertyMap() returns a map for each
- * ICU-supported enumerated/catalog/int-valued property which
- * maps all Unicode code points to their values for that property.
- *
+ * Many properties are accessible via generic functions that take a UProperty selector.
+ * - u_hasBinaryProperty() returns a binary value (TRUE/FALSE) per property and code point.
+ * - u_getIntPropertyValue() returns an integer value per property and code point.
+ * For each supported enumerated or catalog property, there is
+ * an enum type for all of the property's values, and
+ * u_getIntPropertyValue() returns the numeric values of those constants.
+ * - u_getBinaryPropertySet() returns a set for each ICU-supported binary property with
+ * all code points for which the property is true.
+ * - u_getIntPropertyMap() returns a map for each
+ * ICU-supported enumerated/catalog/int-valued property which
+ * maps all Unicode code points to their values for that property.
+ *
* Many functions are designed to match java.lang.Character functions.
* See the individual function documentation,
* and see the JDK 1.4 java.lang.Character documentation
@@ -142,11 +142,11 @@ U_CDECL_BEGIN
* Comparison:
* - u_isUWhiteSpace=UCHAR_WHITE_SPACE: Unicode White_Space property;
* most of general categories "Z" (separators) + most whitespace ISO controls
- * (including no-break spaces, but excluding IS1..IS4)
+ * (including no-break spaces, but excluding IS1..IS4)
* - u_isWhitespace: Java isWhitespace; Z + whitespace ISO controls but excluding no-break spaces
* - u_isJavaSpaceChar: Java isSpaceChar; just Z (including no-break spaces)
* - u_isspace: Z + whitespace ISO controls (including no-break spaces)
- * - u_isblank: "horizontal spaces" = TAB + Zs
+ * - u_isblank: "horizontal spaces" = TAB + Zs
*/
/**
@@ -180,9 +180,9 @@ U_CDECL_BEGIN
* The properties APIs are intended to reflect Unicode properties as defined
* in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR).
*
- * For details about the properties see
- * UAX #44: Unicode Character Database (http://www.unicode.org/reports/tr44/).
- *
+ * For details about the properties see
+ * UAX #44: Unicode Character Database (http://www.unicode.org/reports/tr44/).
+ *
* Important: If ICU is built with UCD files from Unicode versions below, e.g., 3.2,
* then properties marked with "new in Unicode 3.2" are not or not fully available.
* Check u_getUnicodeVersion to be sure.
@@ -435,60 +435,60 @@ typedef enum UProperty {
* Binary property Emoji.
* See http://www.unicode.org/reports/tr51/#Emoji_Properties
*
- * @stable ICU 57
+ * @stable ICU 57
*/
UCHAR_EMOJI=57,
/**
* Binary property Emoji_Presentation.
* See http://www.unicode.org/reports/tr51/#Emoji_Properties
*
- * @stable ICU 57
+ * @stable ICU 57
*/
UCHAR_EMOJI_PRESENTATION=58,
/**
* Binary property Emoji_Modifier.
* See http://www.unicode.org/reports/tr51/#Emoji_Properties
*
- * @stable ICU 57
+ * @stable ICU 57
*/
UCHAR_EMOJI_MODIFIER=59,
/**
* Binary property Emoji_Modifier_Base.
* See http://www.unicode.org/reports/tr51/#Emoji_Properties
*
- * @stable ICU 57
+ * @stable ICU 57
*/
UCHAR_EMOJI_MODIFIER_BASE=60,
- /**
- * Binary property Emoji_Component.
- * See http://www.unicode.org/reports/tr51/#Emoji_Properties
- *
- * @stable ICU 60
- */
- UCHAR_EMOJI_COMPONENT=61,
- /**
- * Binary property Regional_Indicator.
- * @stable ICU 60
- */
- UCHAR_REGIONAL_INDICATOR=62,
- /**
- * Binary property Prepended_Concatenation_Mark.
- * @stable ICU 60
- */
- UCHAR_PREPENDED_CONCATENATION_MARK=63,
- /**
- * Binary property Extended_Pictographic.
- * See http://www.unicode.org/reports/tr51/#Emoji_Properties
- *
- * @stable ICU 62
- */
- UCHAR_EXTENDED_PICTOGRAPHIC=64,
+ /**
+ * Binary property Emoji_Component.
+ * See http://www.unicode.org/reports/tr51/#Emoji_Properties
+ *
+ * @stable ICU 60
+ */
+ UCHAR_EMOJI_COMPONENT=61,
+ /**
+ * Binary property Regional_Indicator.
+ * @stable ICU 60
+ */
+ UCHAR_REGIONAL_INDICATOR=62,
+ /**
+ * Binary property Prepended_Concatenation_Mark.
+ * @stable ICU 60
+ */
+ UCHAR_PREPENDED_CONCATENATION_MARK=63,
+ /**
+ * Binary property Extended_Pictographic.
+ * See http://www.unicode.org/reports/tr51/#Emoji_Properties
+ *
+ * @stable ICU 62
+ */
+ UCHAR_EXTENDED_PICTOGRAPHIC=64,
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the last constant for binary Unicode properties.
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
- UCHAR_BINARY_LIMIT,
+ UCHAR_BINARY_LIMIT,
#endif // U_HIDE_DEPRECATED_API
/** Enumerated property Bidi_Class.
@@ -576,34 +576,34 @@ typedef enum UProperty {
(http://www.unicode.org/reports/tr9/)
Returns UBidiPairedBracketType values. @stable ICU 52 */
UCHAR_BIDI_PAIRED_BRACKET_TYPE=0x1015,
- /**
- * Enumerated property Indic_Positional_Category.
- * New in Unicode 6.0 as provisional property Indic_Matra_Category;
- * renamed and changed to informative in Unicode 8.0.
- * See http://www.unicode.org/reports/tr44/#IndicPositionalCategory.txt
- * @stable ICU 63
- */
- UCHAR_INDIC_POSITIONAL_CATEGORY=0x1016,
- /**
- * Enumerated property Indic_Syllabic_Category.
- * New in Unicode 6.0 as provisional; informative since Unicode 8.0.
- * See http://www.unicode.org/reports/tr44/#IndicSyllabicCategory.txt
- * @stable ICU 63
- */
- UCHAR_INDIC_SYLLABIC_CATEGORY=0x1017,
- /**
- * Enumerated property Vertical_Orientation.
- * Used for UAX #50 Unicode Vertical Text Layout (https://www.unicode.org/reports/tr50/).
- * New as a UCD property in Unicode 10.0.
- * @stable ICU 63
- */
- UCHAR_VERTICAL_ORIENTATION=0x1018,
+ /**
+ * Enumerated property Indic_Positional_Category.
+ * New in Unicode 6.0 as provisional property Indic_Matra_Category;
+ * renamed and changed to informative in Unicode 8.0.
+ * See http://www.unicode.org/reports/tr44/#IndicPositionalCategory.txt
+ * @stable ICU 63
+ */
+ UCHAR_INDIC_POSITIONAL_CATEGORY=0x1016,
+ /**
+ * Enumerated property Indic_Syllabic_Category.
+ * New in Unicode 6.0 as provisional; informative since Unicode 8.0.
+ * See http://www.unicode.org/reports/tr44/#IndicSyllabicCategory.txt
+ * @stable ICU 63
+ */
+ UCHAR_INDIC_SYLLABIC_CATEGORY=0x1017,
+ /**
+ * Enumerated property Vertical_Orientation.
+ * Used for UAX #50 Unicode Vertical Text Layout (https://www.unicode.org/reports/tr50/).
+ * New as a UCD property in Unicode 10.0.
+ * @stable ICU 63
+ */
+ UCHAR_VERTICAL_ORIENTATION=0x1018,
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the last constant for enumerated/integer Unicode properties.
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
- UCHAR_INT_LIMIT=0x1019,
+ UCHAR_INT_LIMIT=0x1019,
#endif // U_HIDE_DEPRECATED_API
/** Bitmask property General_Category_Mask.
@@ -1725,88 +1725,88 @@ enum UBlockCode {
/** @stable ICU 58 */
UBLOCK_TANGUT_COMPONENTS = 273, /*[18800]*/
- // New blocks in Unicode 10.0
-
- /** @stable ICU 60 */
- UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_F = 274, /*[2CEB0]*/
- /** @stable ICU 60 */
- UBLOCK_KANA_EXTENDED_A = 275, /*[1B100]*/
- /** @stable ICU 60 */
- UBLOCK_MASARAM_GONDI = 276, /*[11D00]*/
- /** @stable ICU 60 */
- UBLOCK_NUSHU = 277, /*[1B170]*/
- /** @stable ICU 60 */
- UBLOCK_SOYOMBO = 278, /*[11A50]*/
- /** @stable ICU 60 */
- UBLOCK_SYRIAC_SUPPLEMENT = 279, /*[0860]*/
- /** @stable ICU 60 */
- UBLOCK_ZANABAZAR_SQUARE = 280, /*[11A00]*/
-
- // New blocks in Unicode 11.0
-
- /** @stable ICU 62 */
- UBLOCK_CHESS_SYMBOLS = 281, /*[1FA00]*/
- /** @stable ICU 62 */
- UBLOCK_DOGRA = 282, /*[11800]*/
- /** @stable ICU 62 */
- UBLOCK_GEORGIAN_EXTENDED = 283, /*[1C90]*/
- /** @stable ICU 62 */
- UBLOCK_GUNJALA_GONDI = 284, /*[11D60]*/
- /** @stable ICU 62 */
- UBLOCK_HANIFI_ROHINGYA = 285, /*[10D00]*/
- /** @stable ICU 62 */
- UBLOCK_INDIC_SIYAQ_NUMBERS = 286, /*[1EC70]*/
- /** @stable ICU 62 */
- UBLOCK_MAKASAR = 287, /*[11EE0]*/
- /** @stable ICU 62 */
- UBLOCK_MAYAN_NUMERALS = 288, /*[1D2E0]*/
- /** @stable ICU 62 */
- UBLOCK_MEDEFAIDRIN = 289, /*[16E40]*/
- /** @stable ICU 62 */
- UBLOCK_OLD_SOGDIAN = 290, /*[10F00]*/
- /** @stable ICU 62 */
- UBLOCK_SOGDIAN = 291, /*[10F30]*/
-
- // New blocks in Unicode 12.0
-
- /** @stable ICU 64 */
- UBLOCK_EGYPTIAN_HIEROGLYPH_FORMAT_CONTROLS = 292, /*[13430]*/
- /** @stable ICU 64 */
- UBLOCK_ELYMAIC = 293, /*[10FE0]*/
- /** @stable ICU 64 */
- UBLOCK_NANDINAGARI = 294, /*[119A0]*/
- /** @stable ICU 64 */
- UBLOCK_NYIAKENG_PUACHUE_HMONG = 295, /*[1E100]*/
- /** @stable ICU 64 */
- UBLOCK_OTTOMAN_SIYAQ_NUMBERS = 296, /*[1ED00]*/
- /** @stable ICU 64 */
- UBLOCK_SMALL_KANA_EXTENSION = 297, /*[1B130]*/
- /** @stable ICU 64 */
- UBLOCK_SYMBOLS_AND_PICTOGRAPHS_EXTENDED_A = 298, /*[1FA70]*/
- /** @stable ICU 64 */
- UBLOCK_TAMIL_SUPPLEMENT = 299, /*[11FC0]*/
- /** @stable ICU 64 */
- UBLOCK_WANCHO = 300, /*[1E2C0]*/
-
- // New blocks in Unicode 13.0
-
- /** @stable ICU 66 */
- UBLOCK_CHORASMIAN = 301, /*[10FB0]*/
- /** @stable ICU 66 */
- UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_G = 302, /*[30000]*/
- /** @stable ICU 66 */
- UBLOCK_DIVES_AKURU = 303, /*[11900]*/
- /** @stable ICU 66 */
- UBLOCK_KHITAN_SMALL_SCRIPT = 304, /*[18B00]*/
- /** @stable ICU 66 */
- UBLOCK_LISU_SUPPLEMENT = 305, /*[11FB0]*/
- /** @stable ICU 66 */
- UBLOCK_SYMBOLS_FOR_LEGACY_COMPUTING = 306, /*[1FB00]*/
- /** @stable ICU 66 */
- UBLOCK_TANGUT_SUPPLEMENT = 307, /*[18D00]*/
- /** @stable ICU 66 */
- UBLOCK_YEZIDI = 308, /*[10E80]*/
-
+ // New blocks in Unicode 10.0
+
+ /** @stable ICU 60 */
+ UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_F = 274, /*[2CEB0]*/
+ /** @stable ICU 60 */
+ UBLOCK_KANA_EXTENDED_A = 275, /*[1B100]*/
+ /** @stable ICU 60 */
+ UBLOCK_MASARAM_GONDI = 276, /*[11D00]*/
+ /** @stable ICU 60 */
+ UBLOCK_NUSHU = 277, /*[1B170]*/
+ /** @stable ICU 60 */
+ UBLOCK_SOYOMBO = 278, /*[11A50]*/
+ /** @stable ICU 60 */
+ UBLOCK_SYRIAC_SUPPLEMENT = 279, /*[0860]*/
+ /** @stable ICU 60 */
+ UBLOCK_ZANABAZAR_SQUARE = 280, /*[11A00]*/
+
+ // New blocks in Unicode 11.0
+
+ /** @stable ICU 62 */
+ UBLOCK_CHESS_SYMBOLS = 281, /*[1FA00]*/
+ /** @stable ICU 62 */
+ UBLOCK_DOGRA = 282, /*[11800]*/
+ /** @stable ICU 62 */
+ UBLOCK_GEORGIAN_EXTENDED = 283, /*[1C90]*/
+ /** @stable ICU 62 */
+ UBLOCK_GUNJALA_GONDI = 284, /*[11D60]*/
+ /** @stable ICU 62 */
+ UBLOCK_HANIFI_ROHINGYA = 285, /*[10D00]*/
+ /** @stable ICU 62 */
+ UBLOCK_INDIC_SIYAQ_NUMBERS = 286, /*[1EC70]*/
+ /** @stable ICU 62 */
+ UBLOCK_MAKASAR = 287, /*[11EE0]*/
+ /** @stable ICU 62 */
+ UBLOCK_MAYAN_NUMERALS = 288, /*[1D2E0]*/
+ /** @stable ICU 62 */
+ UBLOCK_MEDEFAIDRIN = 289, /*[16E40]*/
+ /** @stable ICU 62 */
+ UBLOCK_OLD_SOGDIAN = 290, /*[10F00]*/
+ /** @stable ICU 62 */
+ UBLOCK_SOGDIAN = 291, /*[10F30]*/
+
+ // New blocks in Unicode 12.0
+
+ /** @stable ICU 64 */
+ UBLOCK_EGYPTIAN_HIEROGLYPH_FORMAT_CONTROLS = 292, /*[13430]*/
+ /** @stable ICU 64 */
+ UBLOCK_ELYMAIC = 293, /*[10FE0]*/
+ /** @stable ICU 64 */
+ UBLOCK_NANDINAGARI = 294, /*[119A0]*/
+ /** @stable ICU 64 */
+ UBLOCK_NYIAKENG_PUACHUE_HMONG = 295, /*[1E100]*/
+ /** @stable ICU 64 */
+ UBLOCK_OTTOMAN_SIYAQ_NUMBERS = 296, /*[1ED00]*/
+ /** @stable ICU 64 */
+ UBLOCK_SMALL_KANA_EXTENSION = 297, /*[1B130]*/
+ /** @stable ICU 64 */
+ UBLOCK_SYMBOLS_AND_PICTOGRAPHS_EXTENDED_A = 298, /*[1FA70]*/
+ /** @stable ICU 64 */
+ UBLOCK_TAMIL_SUPPLEMENT = 299, /*[11FC0]*/
+ /** @stable ICU 64 */
+ UBLOCK_WANCHO = 300, /*[1E2C0]*/
+
+ // New blocks in Unicode 13.0
+
+ /** @stable ICU 66 */
+ UBLOCK_CHORASMIAN = 301, /*[10FB0]*/
+ /** @stable ICU 66 */
+ UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_G = 302, /*[30000]*/
+ /** @stable ICU 66 */
+ UBLOCK_DIVES_AKURU = 303, /*[11900]*/
+ /** @stable ICU 66 */
+ UBLOCK_KHITAN_SMALL_SCRIPT = 304, /*[18B00]*/
+ /** @stable ICU 66 */
+ UBLOCK_LISU_SUPPLEMENT = 305, /*[11FB0]*/
+ /** @stable ICU 66 */
+ UBLOCK_SYMBOLS_FOR_LEGACY_COMPUTING = 306, /*[1FB00]*/
+ /** @stable ICU 66 */
+ UBLOCK_TANGUT_SUPPLEMENT = 307, /*[18D00]*/
+ /** @stable ICU 66 */
+ UBLOCK_YEZIDI = 308, /*[10E80]*/
+
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal UBlockCode value.
@@ -1814,7 +1814,7 @@ enum UBlockCode {
*
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
- UBLOCK_COUNT = 309,
+ UBLOCK_COUNT = 309,
#endif // U_HIDE_DEPRECATED_API
/** @stable ICU 2.0 */
@@ -2090,22 +2090,22 @@ typedef enum UJoiningGroup {
U_JG_AFRICAN_FEH, /**< @stable ICU 58 */
U_JG_AFRICAN_NOON, /**< @stable ICU 58 */
U_JG_AFRICAN_QAF, /**< @stable ICU 58 */
-
- U_JG_MALAYALAM_BHA, /**< @stable ICU 60 */
- U_JG_MALAYALAM_JA, /**< @stable ICU 60 */
- U_JG_MALAYALAM_LLA, /**< @stable ICU 60 */
- U_JG_MALAYALAM_LLLA, /**< @stable ICU 60 */
- U_JG_MALAYALAM_NGA, /**< @stable ICU 60 */
- U_JG_MALAYALAM_NNA, /**< @stable ICU 60 */
- U_JG_MALAYALAM_NNNA, /**< @stable ICU 60 */
- U_JG_MALAYALAM_NYA, /**< @stable ICU 60 */
- U_JG_MALAYALAM_RA, /**< @stable ICU 60 */
- U_JG_MALAYALAM_SSA, /**< @stable ICU 60 */
- U_JG_MALAYALAM_TTA, /**< @stable ICU 60 */
-
- U_JG_HANIFI_ROHINGYA_KINNA_YA, /**< @stable ICU 62 */
- U_JG_HANIFI_ROHINGYA_PA, /**< @stable ICU 62 */
-
+
+ U_JG_MALAYALAM_BHA, /**< @stable ICU 60 */
+ U_JG_MALAYALAM_JA, /**< @stable ICU 60 */
+ U_JG_MALAYALAM_LLA, /**< @stable ICU 60 */
+ U_JG_MALAYALAM_LLLA, /**< @stable ICU 60 */
+ U_JG_MALAYALAM_NGA, /**< @stable ICU 60 */
+ U_JG_MALAYALAM_NNA, /**< @stable ICU 60 */
+ U_JG_MALAYALAM_NNNA, /**< @stable ICU 60 */
+ U_JG_MALAYALAM_NYA, /**< @stable ICU 60 */
+ U_JG_MALAYALAM_RA, /**< @stable ICU 60 */
+ U_JG_MALAYALAM_SSA, /**< @stable ICU 60 */
+ U_JG_MALAYALAM_TTA, /**< @stable ICU 60 */
+
+ U_JG_HANIFI_ROHINGYA_KINNA_YA, /**< @stable ICU 62 */
+ U_JG_HANIFI_ROHINGYA_PA, /**< @stable ICU 62 */
+
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal UJoiningGroup value.
@@ -2156,7 +2156,7 @@ typedef enum UGraphemeClusterBreak {
U_GCB_GLUE_AFTER_ZWJ = 16, /*[GAZ]*/
/** @stable ICU 58 */
U_GCB_ZWJ = 17, /*[ZWJ]*/
-
+
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal UGraphemeClusterBreak value.
@@ -2218,9 +2218,9 @@ typedef enum UWordBreakValues {
U_WB_GLUE_AFTER_ZWJ = 20, /*[GAZ]*/
/** @stable ICU 58 */
U_WB_ZWJ = 21, /*[ZWJ]*/
- /** @stable ICU 62 */
- U_WB_WSEGSPACE = 22, /*[WSEGSPACE]*/
-
+ /** @stable ICU 62 */
+ U_WB_WSEGSPACE = 22, /*[WSEGSPACE]*/
+
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal UWordBreakValues value.
@@ -2228,7 +2228,7 @@ typedef enum UWordBreakValues {
*
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
- U_WB_COUNT = 23
+ U_WB_COUNT = 23
#endif // U_HIDE_DEPRECATED_API
} UWordBreakValues;
@@ -2413,163 +2413,163 @@ typedef enum UHangulSyllableType {
} UHangulSyllableType;
/**
- * Indic Positional Category constants.
- *
- * @see UCHAR_INDIC_POSITIONAL_CATEGORY
- * @stable ICU 63
- */
-typedef enum UIndicPositionalCategory {
- /*
- * Note: UIndicPositionalCategory constants are parsed by preparseucd.py.
- * It matches lines like
- * U_INPC_<Unicode Indic_Positional_Category value name>
- */
-
- /** @stable ICU 63 */
- U_INPC_NA,
- /** @stable ICU 63 */
- U_INPC_BOTTOM,
- /** @stable ICU 63 */
- U_INPC_BOTTOM_AND_LEFT,
- /** @stable ICU 63 */
- U_INPC_BOTTOM_AND_RIGHT,
- /** @stable ICU 63 */
- U_INPC_LEFT,
- /** @stable ICU 63 */
- U_INPC_LEFT_AND_RIGHT,
- /** @stable ICU 63 */
- U_INPC_OVERSTRUCK,
- /** @stable ICU 63 */
- U_INPC_RIGHT,
- /** @stable ICU 63 */
- U_INPC_TOP,
- /** @stable ICU 63 */
- U_INPC_TOP_AND_BOTTOM,
- /** @stable ICU 63 */
- U_INPC_TOP_AND_BOTTOM_AND_RIGHT,
- /** @stable ICU 63 */
- U_INPC_TOP_AND_LEFT,
- /** @stable ICU 63 */
- U_INPC_TOP_AND_LEFT_AND_RIGHT,
- /** @stable ICU 63 */
- U_INPC_TOP_AND_RIGHT,
- /** @stable ICU 63 */
- U_INPC_VISUAL_ORDER_LEFT,
- /** @stable ICU 66 */
- U_INPC_TOP_AND_BOTTOM_AND_LEFT,
-} UIndicPositionalCategory;
-
-/**
- * Indic Syllabic Category constants.
- *
- * @see UCHAR_INDIC_SYLLABIC_CATEGORY
- * @stable ICU 63
- */
-typedef enum UIndicSyllabicCategory {
- /*
- * Note: UIndicSyllabicCategory constants are parsed by preparseucd.py.
- * It matches lines like
- * U_INSC_<Unicode Indic_Syllabic_Category value name>
- */
-
- /** @stable ICU 63 */
- U_INSC_OTHER,
- /** @stable ICU 63 */
- U_INSC_AVAGRAHA,
- /** @stable ICU 63 */
- U_INSC_BINDU,
- /** @stable ICU 63 */
- U_INSC_BRAHMI_JOINING_NUMBER,
- /** @stable ICU 63 */
- U_INSC_CANTILLATION_MARK,
- /** @stable ICU 63 */
- U_INSC_CONSONANT,
- /** @stable ICU 63 */
- U_INSC_CONSONANT_DEAD,
- /** @stable ICU 63 */
- U_INSC_CONSONANT_FINAL,
- /** @stable ICU 63 */
- U_INSC_CONSONANT_HEAD_LETTER,
- /** @stable ICU 63 */
- U_INSC_CONSONANT_INITIAL_POSTFIXED,
- /** @stable ICU 63 */
- U_INSC_CONSONANT_KILLER,
- /** @stable ICU 63 */
- U_INSC_CONSONANT_MEDIAL,
- /** @stable ICU 63 */
- U_INSC_CONSONANT_PLACEHOLDER,
- /** @stable ICU 63 */
- U_INSC_CONSONANT_PRECEDING_REPHA,
- /** @stable ICU 63 */
- U_INSC_CONSONANT_PREFIXED,
- /** @stable ICU 63 */
- U_INSC_CONSONANT_SUBJOINED,
- /** @stable ICU 63 */
- U_INSC_CONSONANT_SUCCEEDING_REPHA,
- /** @stable ICU 63 */
- U_INSC_CONSONANT_WITH_STACKER,
- /** @stable ICU 63 */
- U_INSC_GEMINATION_MARK,
- /** @stable ICU 63 */
- U_INSC_INVISIBLE_STACKER,
- /** @stable ICU 63 */
- U_INSC_JOINER,
- /** @stable ICU 63 */
- U_INSC_MODIFYING_LETTER,
- /** @stable ICU 63 */
- U_INSC_NON_JOINER,
- /** @stable ICU 63 */
- U_INSC_NUKTA,
- /** @stable ICU 63 */
- U_INSC_NUMBER,
- /** @stable ICU 63 */
- U_INSC_NUMBER_JOINER,
- /** @stable ICU 63 */
- U_INSC_PURE_KILLER,
- /** @stable ICU 63 */
- U_INSC_REGISTER_SHIFTER,
- /** @stable ICU 63 */
- U_INSC_SYLLABLE_MODIFIER,
- /** @stable ICU 63 */
- U_INSC_TONE_LETTER,
- /** @stable ICU 63 */
- U_INSC_TONE_MARK,
- /** @stable ICU 63 */
- U_INSC_VIRAMA,
- /** @stable ICU 63 */
- U_INSC_VISARGA,
- /** @stable ICU 63 */
- U_INSC_VOWEL,
- /** @stable ICU 63 */
- U_INSC_VOWEL_DEPENDENT,
- /** @stable ICU 63 */
- U_INSC_VOWEL_INDEPENDENT,
-} UIndicSyllabicCategory;
-
-/**
- * Vertical Orientation constants.
- *
- * @see UCHAR_VERTICAL_ORIENTATION
- * @stable ICU 63
- */
-typedef enum UVerticalOrientation {
- /*
- * Note: UVerticalOrientation constants are parsed by preparseucd.py.
- * It matches lines like
- * U_VO_<Unicode Vertical_Orientation value name>
- */
-
- /** @stable ICU 63 */
- U_VO_ROTATED,
- /** @stable ICU 63 */
- U_VO_TRANSFORMED_ROTATED,
- /** @stable ICU 63 */
- U_VO_TRANSFORMED_UPRIGHT,
- /** @stable ICU 63 */
- U_VO_UPRIGHT,
-} UVerticalOrientation;
-
-/**
+ * Indic Positional Category constants.
+ *
+ * @see UCHAR_INDIC_POSITIONAL_CATEGORY
+ * @stable ICU 63
+ */
+typedef enum UIndicPositionalCategory {
+ /*
+ * Note: UIndicPositionalCategory constants are parsed by preparseucd.py.
+ * It matches lines like
+ * U_INPC_<Unicode Indic_Positional_Category value name>
+ */
+
+ /** @stable ICU 63 */
+ U_INPC_NA,
+ /** @stable ICU 63 */
+ U_INPC_BOTTOM,
+ /** @stable ICU 63 */
+ U_INPC_BOTTOM_AND_LEFT,
+ /** @stable ICU 63 */
+ U_INPC_BOTTOM_AND_RIGHT,
+ /** @stable ICU 63 */
+ U_INPC_LEFT,
+ /** @stable ICU 63 */
+ U_INPC_LEFT_AND_RIGHT,
+ /** @stable ICU 63 */
+ U_INPC_OVERSTRUCK,
+ /** @stable ICU 63 */
+ U_INPC_RIGHT,
+ /** @stable ICU 63 */
+ U_INPC_TOP,
+ /** @stable ICU 63 */
+ U_INPC_TOP_AND_BOTTOM,
+ /** @stable ICU 63 */
+ U_INPC_TOP_AND_BOTTOM_AND_RIGHT,
+ /** @stable ICU 63 */
+ U_INPC_TOP_AND_LEFT,
+ /** @stable ICU 63 */
+ U_INPC_TOP_AND_LEFT_AND_RIGHT,
+ /** @stable ICU 63 */
+ U_INPC_TOP_AND_RIGHT,
+ /** @stable ICU 63 */
+ U_INPC_VISUAL_ORDER_LEFT,
+ /** @stable ICU 66 */
+ U_INPC_TOP_AND_BOTTOM_AND_LEFT,
+} UIndicPositionalCategory;
+
+/**
+ * Indic Syllabic Category constants.
+ *
+ * @see UCHAR_INDIC_SYLLABIC_CATEGORY
+ * @stable ICU 63
+ */
+typedef enum UIndicSyllabicCategory {
+ /*
+ * Note: UIndicSyllabicCategory constants are parsed by preparseucd.py.
+ * It matches lines like
+ * U_INSC_<Unicode Indic_Syllabic_Category value name>
+ */
+
+ /** @stable ICU 63 */
+ U_INSC_OTHER,
+ /** @stable ICU 63 */
+ U_INSC_AVAGRAHA,
+ /** @stable ICU 63 */
+ U_INSC_BINDU,
+ /** @stable ICU 63 */
+ U_INSC_BRAHMI_JOINING_NUMBER,
+ /** @stable ICU 63 */
+ U_INSC_CANTILLATION_MARK,
+ /** @stable ICU 63 */
+ U_INSC_CONSONANT,
+ /** @stable ICU 63 */
+ U_INSC_CONSONANT_DEAD,
+ /** @stable ICU 63 */
+ U_INSC_CONSONANT_FINAL,
+ /** @stable ICU 63 */
+ U_INSC_CONSONANT_HEAD_LETTER,
+ /** @stable ICU 63 */
+ U_INSC_CONSONANT_INITIAL_POSTFIXED,
+ /** @stable ICU 63 */
+ U_INSC_CONSONANT_KILLER,
+ /** @stable ICU 63 */
+ U_INSC_CONSONANT_MEDIAL,
+ /** @stable ICU 63 */
+ U_INSC_CONSONANT_PLACEHOLDER,
+ /** @stable ICU 63 */
+ U_INSC_CONSONANT_PRECEDING_REPHA,
+ /** @stable ICU 63 */
+ U_INSC_CONSONANT_PREFIXED,
+ /** @stable ICU 63 */
+ U_INSC_CONSONANT_SUBJOINED,
+ /** @stable ICU 63 */
+ U_INSC_CONSONANT_SUCCEEDING_REPHA,
+ /** @stable ICU 63 */
+ U_INSC_CONSONANT_WITH_STACKER,
+ /** @stable ICU 63 */
+ U_INSC_GEMINATION_MARK,
+ /** @stable ICU 63 */
+ U_INSC_INVISIBLE_STACKER,
+ /** @stable ICU 63 */
+ U_INSC_JOINER,
+ /** @stable ICU 63 */
+ U_INSC_MODIFYING_LETTER,
+ /** @stable ICU 63 */
+ U_INSC_NON_JOINER,
+ /** @stable ICU 63 */
+ U_INSC_NUKTA,
+ /** @stable ICU 63 */
+ U_INSC_NUMBER,
+ /** @stable ICU 63 */
+ U_INSC_NUMBER_JOINER,
+ /** @stable ICU 63 */
+ U_INSC_PURE_KILLER,
+ /** @stable ICU 63 */
+ U_INSC_REGISTER_SHIFTER,
+ /** @stable ICU 63 */
+ U_INSC_SYLLABLE_MODIFIER,
+ /** @stable ICU 63 */
+ U_INSC_TONE_LETTER,
+ /** @stable ICU 63 */
+ U_INSC_TONE_MARK,
+ /** @stable ICU 63 */
+ U_INSC_VIRAMA,
+ /** @stable ICU 63 */
+ U_INSC_VISARGA,
+ /** @stable ICU 63 */
+ U_INSC_VOWEL,
+ /** @stable ICU 63 */
+ U_INSC_VOWEL_DEPENDENT,
+ /** @stable ICU 63 */
+ U_INSC_VOWEL_INDEPENDENT,
+} UIndicSyllabicCategory;
+
+/**
+ * Vertical Orientation constants.
+ *
+ * @see UCHAR_VERTICAL_ORIENTATION
+ * @stable ICU 63
+ */
+typedef enum UVerticalOrientation {
+ /*
+ * Note: UVerticalOrientation constants are parsed by preparseucd.py.
+ * It matches lines like
+ * U_VO_<Unicode Vertical_Orientation value name>
+ */
+
+ /** @stable ICU 63 */
+ U_VO_ROTATED,
+ /** @stable ICU 63 */
+ U_VO_TRANSFORMED_ROTATED,
+ /** @stable ICU 63 */
+ U_VO_TRANSFORMED_UPRIGHT,
+ /** @stable ICU 63 */
+ U_VO_UPRIGHT,
+} UVerticalOrientation;
+
+/**
* Check a binary Unicode property for a code point.
*
* Unicode, especially in version 3.2, defines many more properties than the
@@ -2591,7 +2591,7 @@ typedef enum UVerticalOrientation {
* does not have data for the property at all, or not for this code point.
*
* @see UProperty
- * @see u_getBinaryPropertySet
+ * @see u_getBinaryPropertySet
* @see u_getIntPropertyValue
* @see u_getUnicodeVersion
* @stable ICU 2.1
@@ -2600,24 +2600,24 @@ U_STABLE UBool U_EXPORT2
u_hasBinaryProperty(UChar32 c, UProperty which);
/**
- * Returns a frozen USet for a binary property.
- * The library retains ownership over the returned object.
- * Sets an error code if the property number is not one for a binary property.
- *
- * The returned set contains all code points for which the property is true.
- *
- * @param property UCHAR_BINARY_START..UCHAR_BINARY_LIMIT-1
- * @param pErrorCode an in/out ICU UErrorCode
- * @return the property as a set
- * @see UProperty
- * @see u_hasBinaryProperty
- * @see Unicode::fromUSet
- * @stable ICU 63
- */
-U_CAPI const USet * U_EXPORT2
-u_getBinaryPropertySet(UProperty property, UErrorCode *pErrorCode);
-
-/**
+ * Returns a frozen USet for a binary property.
+ * The library retains ownership over the returned object.
+ * Sets an error code if the property number is not one for a binary property.
+ *
+ * The returned set contains all code points for which the property is true.
+ *
+ * @param property UCHAR_BINARY_START..UCHAR_BINARY_LIMIT-1
+ * @param pErrorCode an in/out ICU UErrorCode
+ * @return the property as a set
+ * @see UProperty
+ * @see u_hasBinaryProperty
+ * @see Unicode::fromUSet
+ * @stable ICU 63
+ */
+U_CAPI const USet * U_EXPORT2
+u_getBinaryPropertySet(UProperty property, UErrorCode *pErrorCode);
+
+/**
* Check if a code point has the Alphabetic Unicode property.
* Same as u_hasBinaryProperty(c, UCHAR_ALPHABETIC).
* This is different from u_isalpha!
@@ -2717,7 +2717,7 @@ u_isUWhiteSpace(UChar32 c);
* @see u_hasBinaryProperty
* @see u_getIntPropertyMinValue
* @see u_getIntPropertyMaxValue
- * @see u_getIntPropertyMap
+ * @see u_getIntPropertyMap
* @see u_getUnicodeVersion
* @stable ICU 2.2
*/
@@ -2775,24 +2775,24 @@ U_STABLE int32_t U_EXPORT2
u_getIntPropertyMaxValue(UProperty which);
/**
- * Returns an immutable UCPMap for an enumerated/catalog/int-valued property.
- * The library retains ownership over the returned object.
- * Sets an error code if the property number is not one for an "int property".
- *
- * The returned object maps all Unicode code points to their values for that property.
- * For documentation of the integer values see u_getIntPropertyValue().
- *
- * @param property UCHAR_INT_START..UCHAR_INT_LIMIT-1
- * @param pErrorCode an in/out ICU UErrorCode
- * @return the property as a map
- * @see UProperty
- * @see u_getIntPropertyValue
- * @stable ICU 63
- */
-U_CAPI const UCPMap * U_EXPORT2
-u_getIntPropertyMap(UProperty property, UErrorCode *pErrorCode);
-
-/**
+ * Returns an immutable UCPMap for an enumerated/catalog/int-valued property.
+ * The library retains ownership over the returned object.
+ * Sets an error code if the property number is not one for an "int property".
+ *
+ * The returned object maps all Unicode code points to their values for that property.
+ * For documentation of the integer values see u_getIntPropertyValue().
+ *
+ * @param property UCHAR_INT_START..UCHAR_INT_LIMIT-1
+ * @param pErrorCode an in/out ICU UErrorCode
+ * @return the property as a map
+ * @see UProperty
+ * @see u_getIntPropertyValue
+ * @stable ICU 63
+ */
+U_CAPI const UCPMap * U_EXPORT2
+u_getIntPropertyMap(UProperty property, UErrorCode *pErrorCode);
+
+/**
* Get the numeric value for a Unicode code point as defined in the
* Unicode Character Database.
*
@@ -3028,7 +3028,7 @@ u_isgraph(UChar32 c);
*
* same as
*
- * TRUE for U+0009 (TAB) and characters with general category "Zs" (space separators).
+ * TRUE for U+0009 (TAB) and characters with general category "Zs" (space separators).
*
* Note: There are several ICU whitespace functions; please see the uchar.h
* file documentation for a detailed comparison.
@@ -3210,14 +3210,14 @@ U_STABLE UBool U_EXPORT2
u_isprint(UChar32 c);
/**
- * Non-standard: Determines whether the specified code point is a base character.
+ * Non-standard: Determines whether the specified code point is a base character.
* True for general categories "L" (letters), "N" (numbers),
* "Mc" (spacing combining marks), and "Me" (enclosing marks).
*
- * Note that this is different from the Unicode Standard definition in
- * chapter 3.6, conformance clause D51 “Base character”,
- * which defines base characters as the code points with general categories
- * Letter (L), Number (N), Punctuation (P), Symbol (S), or Space Separator (Zs).
+ * Note that this is different from the Unicode Standard definition in
+ * chapter 3.6, conformance clause D51 “Base character”,
+ * which defines base characters as the code points with general categories
+ * Letter (L), Number (N), Punctuation (P), Symbol (S), or Space Separator (Zs).
*
* @param c the code point to be tested
* @return TRUE if the code point is a base character according to this function
diff --git a/contrib/libs/icu/include/unicode/ucharstrie.h b/contrib/libs/icu/include/unicode/ucharstrie.h
index 8a45c44917..d5729d944e 100644
--- a/contrib/libs/icu/include/unicode/ucharstrie.h
+++ b/contrib/libs/icu/include/unicode/ucharstrie.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: ucharstrie.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -24,9 +24,9 @@
*/
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/unistr.h"
#include "unicode/uobject.h"
#include "unicode/ustringtrie.h"
@@ -39,7 +39,7 @@ class UVector32;
/**
* Light-weight, non-const reader class for a UCharsTrie.
- * Traverses a char16_t-serialized data structure with minimal state,
+ * Traverses a char16_t-serialized data structure with minimal state,
* for mapping strings (16-bit-unit sequences) to non-negative integer values.
*
* This class owns the serialized trie data only if it was constructed by
@@ -55,18 +55,18 @@ public:
/**
* Constructs a UCharsTrie reader instance.
*
- * The trieUChars must contain a copy of a char16_t sequence from the UCharsTrieBuilder,
- * starting with the first char16_t of that sequence.
- * The UCharsTrie object will not read more char16_ts than
+ * The trieUChars must contain a copy of a char16_t sequence from the UCharsTrieBuilder,
+ * starting with the first char16_t of that sequence.
+ * The UCharsTrie object will not read more char16_ts than
* the UCharsTrieBuilder generated in the corresponding build() call.
*
* The array is not copied/cloned and must not be modified while
* the UCharsTrie object is in use.
*
- * @param trieUChars The char16_t array that contains the serialized trie.
+ * @param trieUChars The char16_t array that contains the serialized trie.
* @stable ICU 4.8
*/
- UCharsTrie(ConstChar16Ptr trieUChars)
+ UCharsTrie(ConstChar16Ptr trieUChars)
: ownedArray_(NULL), uchars_(trieUChars),
pos_(uchars_), remainingMatchLength_(-1) {}
@@ -78,7 +78,7 @@ public:
/**
* Copy constructor, copies the other trie reader object and its state,
- * but not the char16_t array which will be shared. (Shallow copy.)
+ * but not the char16_t array which will be shared. (Shallow copy.)
* @param other Another UCharsTrie object.
* @stable ICU 4.8
*/
@@ -97,42 +97,42 @@ public:
return *this;
}
-#ifndef U_HIDE_DRAFT_API
+#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
+ */
+ uint64_t getState64() const {
+ return (static_cast<uint64_t>(remainingMatchLength_ + 2) << kState64RemainingShift) |
+ (uint64_t)(pos_ - uchars_);
+ }
+
+ /**
+ * Resets this trie to the saved state.
+ * Unlike resetToState(State), the 64-bit state value
+ * must be from getState64() from the same trie object or
+ * from one initialized the exact same way.
+ * Because of no validation, this method is faster.
+ *
+ * @param state The opaque trie state value from getState64().
+ * @return *this
+ * @see getState64
+ * @see resetToState
+ * @see reset
+ * @draft ICU 65
+ */
+ UCharsTrie &resetToState64(uint64_t state) {
+ remainingMatchLength_ = static_cast<int32_t>(state >> kState64RemainingShift) - 2;
+ pos_ = uchars_ + (state & kState64PosMask);
+ return *this;
+ }
+#endif /* 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
- */
- uint64_t getState64() const {
- return (static_cast<uint64_t>(remainingMatchLength_ + 2) << kState64RemainingShift) |
- (uint64_t)(pos_ - uchars_);
- }
-
- /**
- * Resets this trie to the saved state.
- * Unlike resetToState(State), the 64-bit state value
- * must be from getState64() from the same trie object or
- * from one initialized the exact same way.
- * Because of no validation, this method is faster.
- *
- * @param state The opaque trie state value from getState64().
- * @return *this
- * @see getState64
- * @see resetToState
- * @see reset
- * @draft ICU 65
- */
- UCharsTrie &resetToState64(uint64_t state) {
- remainingMatchLength_ = static_cast<int32_t>(state >> kState64RemainingShift) - 2;
- pos_ = uchars_ + (state & kState64PosMask);
- return *this;
- }
-#endif /* U_HIDE_DRAFT_API */
-
- /**
* UCharsTrie state object, for saving a trie's current state
* and resetting the trie back to this state later.
* @stable ICU 4.8
@@ -147,8 +147,8 @@ public:
private:
friend class UCharsTrie;
- const char16_t *uchars;
- const char16_t *pos;
+ const char16_t *uchars;
+ const char16_t *pos;
int32_t remainingMatchLength;
};
@@ -186,14 +186,14 @@ public:
/**
* Determines whether the string so far matches, whether it has a value,
- * and whether another input char16_t can continue a matching string.
+ * and whether another input char16_t can continue a matching string.
* @return The match/value Result.
* @stable ICU 4.8
*/
UStringTrieResult current() const;
/**
- * Traverses the trie from the initial state for this input char16_t.
+ * Traverses the trie from the initial state for this input char16_t.
* Equivalent to reset().next(uchar).
* @param uchar Input char value. Values below 0 and above 0xffff will never match.
* @return The match/value Result.
@@ -215,7 +215,7 @@ public:
UStringTrieResult firstForCodePoint(UChar32 cp);
/**
- * Traverses the trie from the current state for this input char16_t.
+ * Traverses the trie from the current state for this input char16_t.
* @param uchar Input char value. Values below 0 and above 0xffff will never match.
* @return The match/value Result.
* @stable ICU 4.8
@@ -246,7 +246,7 @@ public:
* @return The match/value Result.
* @stable ICU 4.8
*/
- UStringTrieResult next(ConstChar16Ptr s, int32_t length);
+ UStringTrieResult next(ConstChar16Ptr s, int32_t length);
/**
* Returns a matching string's value if called immediately after
@@ -258,7 +258,7 @@ public:
* @stable ICU 4.8
*/
inline int32_t getValue() const {
- const char16_t *pos=pos_;
+ const char16_t *pos=pos_;
int32_t leadUnit=*pos++;
// U_ASSERT(leadUnit>=kMinValueLead);
return leadUnit&kValueIsFinal ?
@@ -275,16 +275,16 @@ public:
* @stable ICU 4.8
*/
inline UBool hasUniqueValue(int32_t &uniqueValue) const {
- const char16_t *pos=pos_;
+ const char16_t *pos=pos_;
// Skip the rest of a pending linear-match node.
return pos!=NULL && findUniqueValue(pos+remainingMatchLength_+1, FALSE, uniqueValue);
}
/**
- * Finds each char16_t which continues the string from the current state.
- * That is, each char16_t c for which it would be next(c)!=USTRINGTRIE_NO_MATCH now.
- * @param out Each next char16_t is appended to this object.
- * @return the number of char16_ts which continue the string from here
+ * Finds each char16_t which continues the string from the current state.
+ * That is, each char16_t c for which it would be next(c)!=USTRINGTRIE_NO_MATCH now.
+ * @param out Each next char16_t is appended to this object.
+ * @return the number of char16_ts which continue the string from here
* @stable ICU 4.8
*/
int32_t getNextUChars(Appendable &out) const;
@@ -296,8 +296,8 @@ public:
class U_COMMON_API Iterator : public UMemory {
public:
/**
- * Iterates from the root of a char16_t-serialized UCharsTrie.
- * @param trieUChars The trie char16_ts.
+ * Iterates from the root of a char16_t-serialized UCharsTrie.
+ * @param trieUChars The trie char16_ts.
* @param maxStringLength If 0, the iterator returns full strings.
* Otherwise, the iterator returns strings with this maximum length.
* @param errorCode Standard ICU error code. Its input value must
@@ -306,7 +306,7 @@ public:
* function chaining. (See User Guide for details.)
* @stable ICU 4.8
*/
- Iterator(ConstChar16Ptr trieUChars, int32_t maxStringLength, UErrorCode &errorCode);
+ Iterator(ConstChar16Ptr trieUChars, int32_t maxStringLength, UErrorCode &errorCode);
/**
* Iterates from the current state of the specified UCharsTrie.
@@ -374,11 +374,11 @@ public:
return TRUE;
}
- const char16_t *branchNext(const char16_t *pos, int32_t length, UErrorCode &errorCode);
+ const char16_t *branchNext(const char16_t *pos, int32_t length, UErrorCode &errorCode);
- const char16_t *uchars_;
- const char16_t *pos_;
- const char16_t *initialPos_;
+ const char16_t *uchars_;
+ const char16_t *pos_;
+ const char16_t *initialPos_;
int32_t remainingMatchLength_;
int32_t initialRemainingMatchLength_;
UBool skipValue_; // Skip intermediate value which was already delivered.
@@ -406,7 +406,7 @@ private:
* this constructor adopts the builder's array.
* This constructor is only called by the builder.
*/
- UCharsTrie(char16_t *adoptUChars, const char16_t *trieUChars)
+ UCharsTrie(char16_t *adoptUChars, const char16_t *trieUChars)
: ownedArray_(adoptUChars), uchars_(trieUChars),
pos_(uchars_), remainingMatchLength_(-1) {}
@@ -419,7 +419,7 @@ private:
// Reads a compact 32-bit integer.
// pos is already after the leadUnit, and the lead unit has bit 15 reset.
- static inline int32_t readValue(const char16_t *pos, int32_t leadUnit) {
+ static inline int32_t readValue(const char16_t *pos, int32_t leadUnit) {
int32_t value;
if(leadUnit<kMinTwoUnitValueLead) {
value=leadUnit;
@@ -430,7 +430,7 @@ private:
}
return value;
}
- static inline const char16_t *skipValue(const char16_t *pos, int32_t leadUnit) {
+ static inline const char16_t *skipValue(const char16_t *pos, int32_t leadUnit) {
if(leadUnit>=kMinTwoUnitValueLead) {
if(leadUnit<kThreeUnitValueLead) {
++pos;
@@ -440,12 +440,12 @@ private:
}
return pos;
}
- static inline const char16_t *skipValue(const char16_t *pos) {
+ static inline const char16_t *skipValue(const char16_t *pos) {
int32_t leadUnit=*pos++;
return skipValue(pos, leadUnit&0x7fff);
}
- static inline int32_t readNodeValue(const char16_t *pos, int32_t leadUnit) {
+ static inline int32_t readNodeValue(const char16_t *pos, int32_t leadUnit) {
// U_ASSERT(kMinValueLead<=leadUnit && leadUnit<kValueIsFinal);
int32_t value;
if(leadUnit<kMinTwoUnitNodeValueLead) {
@@ -457,7 +457,7 @@ private:
}
return value;
}
- static inline const char16_t *skipNodeValue(const char16_t *pos, int32_t leadUnit) {
+ static inline const char16_t *skipNodeValue(const char16_t *pos, int32_t leadUnit) {
// U_ASSERT(kMinValueLead<=leadUnit && leadUnit<kValueIsFinal);
if(leadUnit>=kMinTwoUnitNodeValueLead) {
if(leadUnit<kThreeUnitNodeValueLead) {
@@ -469,7 +469,7 @@ private:
return pos;
}
- static inline const char16_t *jumpByDelta(const char16_t *pos) {
+ static inline const char16_t *jumpByDelta(const char16_t *pos) {
int32_t delta=*pos++;
if(delta>=kMinTwoUnitDeltaLead) {
if(delta==kThreeUnitDeltaLead) {
@@ -482,7 +482,7 @@ private:
return pos+delta;
}
- static const char16_t *skipDelta(const char16_t *pos) {
+ static const char16_t *skipDelta(const char16_t *pos) {
int32_t delta=*pos++;
if(delta>=kMinTwoUnitDeltaLead) {
if(delta==kThreeUnitDeltaLead) {
@@ -499,28 +499,28 @@ private:
}
// Handles a branch node for both next(uchar) and next(string).
- UStringTrieResult branchNext(const char16_t *pos, int32_t length, int32_t uchar);
+ UStringTrieResult branchNext(const char16_t *pos, int32_t length, int32_t uchar);
// Requires remainingLength_<0.
- UStringTrieResult nextImpl(const char16_t *pos, int32_t uchar);
+ UStringTrieResult nextImpl(const char16_t *pos, int32_t uchar);
// Helper functions for hasUniqueValue().
// Recursively finds a unique value (or whether there is not a unique one)
// from a branch.
- static const char16_t *findUniqueValueFromBranch(const char16_t *pos, int32_t length,
+ static const char16_t *findUniqueValueFromBranch(const char16_t *pos, int32_t length,
UBool haveUniqueValue, int32_t &uniqueValue);
// Recursively finds a unique value (or whether there is not a unique one)
// starting from a position on a node lead unit.
- static UBool findUniqueValue(const char16_t *pos, UBool haveUniqueValue, int32_t &uniqueValue);
+ static UBool findUniqueValue(const char16_t *pos, UBool haveUniqueValue, int32_t &uniqueValue);
// Helper functions for getNextUChars().
// getNextUChars() when pos is on a branch node.
- static void getNextBranchUChars(const char16_t *pos, int32_t length, Appendable &out);
+ static void getNextBranchUChars(const char16_t *pos, int32_t length, Appendable &out);
// UCharsTrie data structure
//
- // The trie consists of a series of char16_t-serialized nodes for incremental
- // Unicode string/char16_t sequence matching. (char16_t=16-bit unsigned integer)
+ // The trie consists of a series of char16_t-serialized nodes for incremental
+ // Unicode string/char16_t sequence matching. (char16_t=16-bit unsigned integer)
// The root node is at the beginning of the trie data.
//
// Types of nodes are distinguished by their node lead unit ranges.
@@ -529,9 +529,9 @@ private:
//
// Node types:
// - Final-value node: Stores a 32-bit integer in a compact, variable-length format.
- // The value is for the string/char16_t sequence so far.
+ // The value is for the string/char16_t sequence so far.
// - Match node, optionally with an intermediate value in a different compact format.
- // The value, if present, is for the string/char16_t sequence so far.
+ // The value, if present, is for the string/char16_t sequence so far.
//
// Aside from the value, which uses the node lead unit's high bits:
//
@@ -598,28 +598,28 @@ private:
static const int32_t kMaxTwoUnitDelta=((kThreeUnitDeltaLead-kMinTwoUnitDeltaLead)<<16)-1; // 0x03feffff
- // For getState64():
- // The remainingMatchLength_ is -1..14=(kMaxLinearMatchLength=0x10)-2
- // so we need at least 5 bits for that.
- // We add 2 to store it as a positive value 1..16=kMaxLinearMatchLength.
- static constexpr int32_t kState64RemainingShift = 59;
- static constexpr uint64_t kState64PosMask = (UINT64_C(1) << kState64RemainingShift) - 1;
+ // For getState64():
+ // The remainingMatchLength_ is -1..14=(kMaxLinearMatchLength=0x10)-2
+ // so we need at least 5 bits for that.
+ // We add 2 to store it as a positive value 1..16=kMaxLinearMatchLength.
+ static constexpr int32_t kState64RemainingShift = 59;
+ static constexpr uint64_t kState64PosMask = (UINT64_C(1) << kState64RemainingShift) - 1;
+
+ char16_t *ownedArray_;
- char16_t *ownedArray_;
-
// Fixed value referencing the UCharsTrie words.
- const char16_t *uchars_;
+ const char16_t *uchars_;
// Iterator variables.
// Pointer to next trie unit to read. NULL if no more matches.
- const char16_t *pos_;
+ const char16_t *pos_;
// Remaining length of a linear-match node, minus 1. Negative if not in such a node.
int32_t remainingMatchLength_;
};
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __UCHARSTRIE_H__
diff --git a/contrib/libs/icu/include/unicode/ucharstriebuilder.h b/contrib/libs/icu/include/unicode/ucharstriebuilder.h
index b8c090194a..540dcc047f 100644
--- a/contrib/libs/icu/include/unicode/ucharstriebuilder.h
+++ b/contrib/libs/icu/include/unicode/ucharstriebuilder.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: ucharstriebuilder.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -18,9 +18,9 @@
#define __UCHARSTRIEBUILDER_H__
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/stringtriebuilder.h"
#include "unicode/ucharstrie.h"
#include "unicode/unistr.h"
@@ -92,21 +92,21 @@ public:
UCharsTrie *build(UStringTrieBuildOption buildOption, UErrorCode &errorCode);
/**
- * Builds a UCharsTrie for the add()ed data and char16_t-serializes it.
+ * Builds a UCharsTrie for the add()ed data and char16_t-serializes it.
* Once built, no further data can be add()ed until clear() is called.
*
* A UCharsTrie cannot be empty. At least one (string, value) pair
* must have been add()ed.
*
* Multiple calls to buildUnicodeString() set the UnicodeStrings to the
- * builder's same char16_t array, without rebuilding.
+ * builder's same char16_t array, without rebuilding.
* If buildUnicodeString() is called after build(), the trie will be
* re-serialized into a new array.
* If build() is called after buildUnicodeString(), the trie object will become
* the owner of the previously returned array.
* After clear() has been called, a new array will be used as well.
* @param buildOption Build option, see UStringTrieBuildOption.
- * @param result A UnicodeString which will be set to the char16_t-serialized
+ * @param result A UnicodeString which will be set to the char16_t-serialized
* UCharsTrie for the add()ed data.
* @param errorCode Standard ICU error code. Its input value must
* pass the U_SUCCESS() test, or else the function returns
@@ -138,14 +138,14 @@ private:
void buildUChars(UStringTrieBuildOption buildOption, UErrorCode &errorCode);
virtual int32_t getElementStringLength(int32_t i) const;
- virtual char16_t getElementUnit(int32_t i, int32_t unitIndex) const;
+ virtual char16_t getElementUnit(int32_t i, int32_t unitIndex) const;
virtual int32_t getElementValue(int32_t i) const;
virtual int32_t getLimitOfLinearMatch(int32_t first, int32_t last, int32_t unitIndex) const;
virtual int32_t countElementUnits(int32_t start, int32_t limit, int32_t unitIndex) const;
virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t unitIndex, int32_t count) const;
- virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const;
+ virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const;
virtual UBool matchNodesCanHaveValues() const { return TRUE; }
@@ -155,11 +155,11 @@ private:
class UCTLinearMatchNode : public LinearMatchNode {
public:
- UCTLinearMatchNode(const char16_t *units, int32_t len, Node *nextNode);
+ UCTLinearMatchNode(const char16_t *units, int32_t len, Node *nextNode);
virtual UBool operator==(const Node &other) const;
virtual void write(StringTrieBuilder &builder);
private:
- const char16_t *s;
+ const char16_t *s;
};
virtual Node *createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t length,
@@ -167,7 +167,7 @@ private:
UBool ensureCapacity(int32_t length);
virtual int32_t write(int32_t unit);
- int32_t write(const char16_t *s, int32_t length);
+ int32_t write(const char16_t *s, int32_t length);
virtual int32_t writeElementUnits(int32_t i, int32_t unitIndex, int32_t length);
virtual int32_t writeValueAndFinal(int32_t i, UBool isFinal);
virtual int32_t writeValueAndType(UBool hasValue, int32_t value, int32_t node);
@@ -178,15 +178,15 @@ private:
int32_t elementsCapacity;
int32_t elementsLength;
- // char16_t serialization of the trie.
+ // char16_t serialization of the trie.
// Grows from the back: ucharsLength measures from the end of the buffer!
- char16_t *uchars;
+ char16_t *uchars;
int32_t ucharsCapacity;
int32_t ucharsLength;
};
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __UCHARSTRIEBUILDER_H__
diff --git a/contrib/libs/icu/include/unicode/uchriter.h b/contrib/libs/icu/include/unicode/uchriter.h
index 883eb5f0e1..a485259b80 100644
--- a/contrib/libs/icu/include/unicode/uchriter.h
+++ b/contrib/libs/icu/include/unicode/uchriter.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -11,25 +11,25 @@
#define UCHRITER_H
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/chariter.h"
/**
* \file
- * \brief C++ API: char16_t Character Iterator
+ * \brief C++ API: char16_t Character Iterator
*/
U_NAMESPACE_BEGIN
/**
* A concrete subclass of CharacterIterator that iterates over the
- * characters (code units or code points) in a char16_t array.
+ * characters (code units or code points) in a char16_t array.
* It's possible not only to create an
- * iterator that iterates over an entire char16_t array, but also to
- * create one that iterates over only a subrange of a char16_t array
- * (iterators over different subranges of the same char16_t array don't
+ * iterator that iterates over an entire char16_t array, but also to
+ * create one that iterates over only a subrange of a char16_t array
+ * (iterators over different subranges of the same char16_t array don't
* compare equal).
* @see CharacterIterator
* @see ForwardCharacterIterator
@@ -38,34 +38,34 @@ U_NAMESPACE_BEGIN
class U_COMMON_API UCharCharacterIterator : public CharacterIterator {
public:
/**
- * Create an iterator over the char16_t array referred to by "textPtr".
+ * Create an iterator over the char16_t array referred to by "textPtr".
* The iteration range is 0 to <code>length-1</code>.
* text is only aliased, not adopted (the
* destructor will not delete it).
- * @param textPtr The char16_t array to be iterated over
- * @param length The length of the char16_t array
+ * @param textPtr The char16_t array to be iterated over
+ * @param length The length of the char16_t array
* @stable ICU 2.0
*/
- UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length);
+ UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length);
/**
- * Create an iterator over the char16_t array referred to by "textPtr".
+ * Create an iterator over the char16_t array referred to by "textPtr".
* The iteration range is 0 to <code>length-1</code>.
* text is only aliased, not adopted (the
* destructor will not delete it).
* The starting
* position is specified by "position". If "position" is outside the valid
* iteration range, the behavior of this object is undefined.
- * @param textPtr The char16_t array to be iteratd over
- * @param length The length of the char16_t array
+ * @param textPtr The char16_t array to be iteratd over
+ * @param length The length of the char16_t array
* @param position The starting position of the iteration
* @stable ICU 2.0
*/
- UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length,
+ UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length,
int32_t position);
/**
- * Create an iterator over the char16_t array referred to by "textPtr".
+ * Create an iterator over the char16_t array referred to by "textPtr".
* The iteration range is 0 to <code>end-1</code>.
* text is only aliased, not adopted (the
* destructor will not delete it).
@@ -73,14 +73,14 @@ public:
* position is specified by "position". If begin and end do not
* form a valid iteration range or "position" is outside the valid
* iteration range, the behavior of this object is undefined.
- * @param textPtr The char16_t array to be iterated over
- * @param length The length of the char16_t array
+ * @param textPtr The char16_t array to be iterated over
+ * @param length The length of the char16_t array
* @param textBegin The begin position of the iteration range
* @param textEnd The end position of the iteration range
* @param position The starting position of the iteration
* @stable ICU 2.0
*/
- UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length,
+ UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length,
int32_t textBegin,
int32_t textEnd,
int32_t position);
@@ -135,7 +135,7 @@ public:
* @return the CharacterIterator newly created
* @stable ICU 2.0
*/
- virtual UCharCharacterIterator* clone() const;
+ virtual UCharCharacterIterator* clone() const;
/**
* Sets the iterator to refer to the first code unit in its
@@ -144,7 +144,7 @@ public:
* @return the first code unit in its iteration range.
* @stable ICU 2.0
*/
- virtual char16_t first(void);
+ virtual char16_t first(void);
/**
* Sets the iterator to refer to the first code unit in its
@@ -154,7 +154,7 @@ public:
* @return the first code unit in its iteration range
* @stable ICU 2.0
*/
- virtual char16_t firstPostInc(void);
+ virtual char16_t firstPostInc(void);
/**
* Sets the iterator to refer to the first code point in its
@@ -184,7 +184,7 @@ public:
* @return the last code unit in its iteration range.
* @stable ICU 2.0
*/
- virtual char16_t last(void);
+ virtual char16_t last(void);
/**
* Sets the iterator to refer to the last code point in its
@@ -203,7 +203,7 @@ public:
* @return the code unit
* @stable ICU 2.0
*/
- virtual char16_t setIndex(int32_t position);
+ virtual char16_t setIndex(int32_t position);
/**
* Sets the iterator to refer to the beginning of the code point
@@ -223,7 +223,7 @@ public:
* @return the code unit the iterator currently refers to.
* @stable ICU 2.0
*/
- virtual char16_t current(void) const;
+ virtual char16_t current(void) const;
/**
* Returns the code point the iterator currently refers to.
@@ -239,7 +239,7 @@ public:
* @return the next code unit in the iteration range.
* @stable ICU 2.0
*/
- virtual char16_t next(void);
+ virtual char16_t next(void);
/**
* Gets the current code unit for returning and advances to the next code unit
@@ -249,7 +249,7 @@ public:
* @return the current code unit.
* @stable ICU 2.0
*/
- virtual char16_t nextPostInc(void);
+ virtual char16_t nextPostInc(void);
/**
* Advances to the next code point in the iteration range (toward
@@ -291,7 +291,7 @@ public:
* @return the previous code unit in the iteration range.
* @stable ICU 2.0
*/
- virtual char16_t previous(void);
+ virtual char16_t previous(void);
/**
* Advances to the previous code point in the iteration range (toward
@@ -337,20 +337,20 @@ public:
* @return the new position
* @stable ICU 2.0
*/
-#ifdef move32
- // One of the system headers right now is sometimes defining a conflicting macro we don't use
-#undef move32
-#endif
+#ifdef move32
+ // One of the system headers right now is sometimes defining a conflicting macro we don't use
+#undef move32
+#endif
virtual int32_t move32(int32_t delta, EOrigin origin);
/**
* Sets the iterator to iterate over a new range of text
* @stable ICU 2.0
*/
- void setText(ConstChar16Ptr newText, int32_t newTextLength);
+ void setText(ConstChar16Ptr newText, int32_t newTextLength);
/**
- * Copies the char16_t array under iteration into the UnicodeString
+ * Copies the char16_t array under iteration into the UnicodeString
* referred to by "result". Even if this iterator iterates across
* only a part of this string, the whole string is copied.
* @param result Receives a copy of the text under iteration.
@@ -382,12 +382,12 @@ protected:
* Protected member text
* @stable ICU 2.0
*/
- const char16_t* text;
+ const char16_t* text;
};
U_NAMESPACE_END
-
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/uclean.h b/contrib/libs/icu/include/unicode/uclean.h
index 322ec9dbd9..7cef6dba68 100644
--- a/contrib/libs/icu/include/unicode/uclean.h
+++ b/contrib/libs/icu/include/unicode/uclean.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
******************************************************************************
* file name: uclean.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -70,7 +70,7 @@ u_init(UErrorCode *status);
* This has the effect of restoring ICU to its initial condition, before
* any of these override functions were installed. Refer to
* u_setMemoryFunctions(), u_setMutexFunctions and
- * utrace_setFunctions(). If ICU is to be reinitialized after
+ * utrace_setFunctions(). If ICU is to be reinitialized after
* calling u_cleanup(), these runtime override functions will need to
* be set up again if they are still required.
* <p>
@@ -101,10 +101,10 @@ u_init(UErrorCode *status);
U_STABLE void U_EXPORT2
u_cleanup(void);
-U_CDECL_BEGIN
+U_CDECL_BEGIN
/**
* Pointer type for a user supplied memory allocation function.
- * @param context user supplied value, obtained from u_setMemoryFunctions().
+ * @param context user supplied value, obtained from u_setMemoryFunctions().
* @param size The number of bytes to be allocated
* @return Pointer to the newly allocated memory, or NULL if the allocation failed.
* @stable ICU 2.8
@@ -113,7 +113,7 @@ U_CDECL_BEGIN
typedef void *U_CALLCONV UMemAllocFn(const void *context, size_t size);
/**
* Pointer type for a user supplied memory re-allocation function.
- * @param context user supplied value, obtained from u_setMemoryFunctions().
+ * @param context user supplied value, obtained from u_setMemoryFunctions().
* @param size The number of bytes to be allocated
* @return Pointer to the newly allocated memory, or NULL if the allocation failed.
* @stable ICU 2.8
@@ -123,7 +123,7 @@ typedef void *U_CALLCONV UMemReallocFn(const void *context, void *mem, size_t si
/**
* Pointer type for a user supplied memory free function. Behavior should be
* similar the standard C library free().
- * @param context user supplied value, obtained from u_setMemoryFunctions().
+ * @param context user supplied value, obtained from u_setMemoryFunctions().
* @param mem Pointer to the memory block to be resized
* @param size The new size for the block
* @return Pointer to the resized memory block, or NULL if the resizing failed.
@@ -149,10 +149,10 @@ typedef void U_CALLCONV UMemFreeFn (const void *context, void *mem);
* @system
*/
U_STABLE void U_EXPORT2
-u_setMemoryFunctions(const void *context, UMemAllocFn * U_CALLCONV_FPTR a, UMemReallocFn * U_CALLCONV_FPTR r, UMemFreeFn * U_CALLCONV_FPTR f,
+u_setMemoryFunctions(const void *context, UMemAllocFn * U_CALLCONV_FPTR a, UMemReallocFn * U_CALLCONV_FPTR r, UMemFreeFn * U_CALLCONV_FPTR f,
UErrorCode *status);
-U_CDECL_END
+U_CDECL_END
#ifndef U_HIDE_DEPRECATED_API
/*********************************************************************************
@@ -173,14 +173,14 @@ U_CDECL_END
*/
typedef void *UMTX;
-U_CDECL_BEGIN
+U_CDECL_BEGIN
/**
* Function Pointer type for a user supplied mutex initialization function.
* The user-supplied function will be called by ICU whenever ICU needs to create a
* new mutex. The function implementation should create a mutex, and store a pointer
* to something that uniquely identifies the mutex into the UMTX that is supplied
- * as a parameter.
- * @param context user supplied value, obtained from u_setMutexFunctions().
+ * as a parameter.
+ * @param context user supplied value, obtained from u_setMutexFunctions().
* @param mutex Receives a pointer that identifies the new mutex.
* The mutex init function must set the UMTX to a non-null value.
* Subsequent calls by ICU to lock, unlock, or destroy a mutex will
@@ -197,13 +197,13 @@ typedef void U_CALLCONV UMtxInitFn (const void *context, UMTX *mutex, UErrorCod
* Function Pointer type for a user supplied mutex functions.
* One of the user-supplied functions with this signature will be called by ICU
* whenever ICU needs to lock, unlock, or destroy a mutex.
- * @param context user supplied value, obtained from u_setMutexFunctions().
+ * @param context user supplied value, obtained from u_setMutexFunctions().
* @param mutex specify the mutex on which to operate.
* @deprecated ICU 52. This function is no longer supported.
* @system
*/
typedef void U_CALLCONV UMtxFn (const void *context, UMTX *mutex);
-U_CDECL_END
+U_CDECL_END
/**
* Set the functions that ICU will use for mutex operations
@@ -229,7 +229,7 @@ u_setMutexFunctions(const void *context, UMtxInitFn *init, UMtxFn *destroy, UMtx
/**
* Pointer type for a user supplied atomic increment or decrement function.
- * @param context user supplied value, obtained from u_setAtomicIncDecFunctions().
+ * @param context user supplied value, obtained from u_setAtomicIncDecFunctions().
* @param p Pointer to a 32 bit int to be incremented or decremented
* @return The value of the variable after the inc or dec operation.
* @deprecated ICU 52. This function is no longer supported.
diff --git a/contrib/libs/icu/include/unicode/ucnv.h b/contrib/libs/icu/include/unicode/ucnv.h
index 4b69f7edcb..ec7c5f350b 100644
--- a/contrib/libs/icu/include/unicode/ucnv.h
+++ b/contrib/libs/icu/include/unicode/ucnv.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -29,7 +29,7 @@
* converter, you can get its properties, set options, convert your data and
* close the converter.</p>
*
- * <p>Since many software programs recognize different converter names for
+ * <p>Since many software programs recognize different converter names for
* different types of converters, there are other functions in this API to
* iterate over the converter aliases. The functions {@link ucnv_getAvailableName() },
* {@link ucnv_getAlias() } and {@link ucnv_getStandardName() } are some of the
@@ -53,17 +53,17 @@
#include "unicode/uenum.h"
#include "unicode/localpointer.h"
-#if !defined(USET_DEFINED) && !defined(U_IN_DOXYGEN)
+#if !defined(USET_DEFINED) && !defined(U_IN_DOXYGEN)
+
+#define USET_DEFINED
-#define USET_DEFINED
-
/**
- * USet is the C API type corresponding to C++ class UnicodeSet.
- * It is forward-declared here to avoid including unicode/uset.h file if related
+ * USet is the C API type corresponding to C++ class UnicodeSet.
+ * It is forward-declared here to avoid including unicode/uset.h file if related
* conversion APIs are not used.
*
* @see ucnv_getUnicodeSet
- * @stable ICU 2.4
+ * @stable ICU 2.4
*/
typedef struct USet USet;
@@ -183,7 +183,7 @@ typedef enum {
/**
* Function pointer for error callback in the codepage to unicode direction.
- * Called when an error has occurred in conversion to unicode, or on open/close of the callback (see reason).
+ * Called when an error has occurred in conversion to unicode, or on open/close of the callback (see reason).
* @param context Pointer to the callback's private data
* @param args Information about the conversion in progress
* @param codeUnits Points to 'length' bytes of the concerned codepage sequence
@@ -206,7 +206,7 @@ typedef void (U_EXPORT2 *UConverterToUCallback) (
/**
* Function pointer for error callback in the unicode to codepage direction.
- * Called when an error has occurred in conversion from unicode, or on open/close of the callback (see reason).
+ * Called when an error has occurred in conversion from unicode, or on open/close of the callback (see reason).
* @param context Pointer to the callback's private data
* @param args Information about the conversion in progress
* @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
@@ -352,7 +352,7 @@ ucnv_compareNames(const char *name1, const char *name2);
* ucnv_getAlias for a complete list that is available.
* If this parameter is NULL, the default converter will be used.
* @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR</TT>
- * @return the created Unicode converter object, or <TT>NULL</TT> if an error occurred
+ * @return the created Unicode converter object, or <TT>NULL</TT> if an error occurred
* @see ucnv_openU
* @see ucnv_openCCSID
* @see ucnv_getAvailableName
@@ -385,7 +385,7 @@ ucnv_open(const char *converterName, UErrorCode *err);
* @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR,
* U_FILE_ACCESS_ERROR</TT>
* @return the created Unicode converter object, or <TT>NULL</TT> if an
- * error occurred
+ * error occurred
* @see ucnv_open
* @see ucnv_openCCSID
* @see ucnv_close
@@ -451,7 +451,7 @@ ucnv_openU(const UChar *name,
* @param platform the platform in which the codepage number exists
* @param err error status <TT>U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR</TT>
* @return the created Unicode converter object, or <TT>NULL</TT> if an error
- * occurred.
+ * occurred.
* @see ucnv_open
* @see ucnv_openU
* @see ucnv_close
@@ -488,7 +488,7 @@ ucnv_openCCSID(int32_t codepage,
* @param packageName name of the package (equivalent to 'path' in udata_open() call)
* @param converterName name of the data item to be used, without suffix.
* @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR</TT>
- * @return the created Unicode converter object, or <TT>NULL</TT> if an error occurred
+ * @return the created Unicode converter object, or <TT>NULL</TT> if an error occurred
* @see udata_open
* @see ucnv_open
* @see ucnv_safeClone
@@ -595,7 +595,7 @@ U_NAMESPACE_END
* stateful, then subChars will be an empty string.
*
* @param converter the Unicode converter
- * @param subChars the substitution characters
+ * @param subChars the substitution characters
* @param len on input the capacity of subChars, on output the number
* of bytes copied to it
* @param err the outgoing error status code.
@@ -831,7 +831,7 @@ ucnv_getMinCharSize(const UConverter *converter);
* name will be filled in.
*
* @param converter the Unicode converter.
- * @param displayLocale is the specific Locale we want to localized for
+ * @param displayLocale is the specific Locale we want to localized for
* @param displayName user provided buffer to be filled in
* @param displayNameCapacity size of displayName Buffer
* @param err error status code
@@ -876,7 +876,7 @@ ucnv_getName(const UConverter *converter, UErrorCode *err);
*
* @param converter the Unicode converter
* @param err the error status code.
- * @return If any error occurs, -1 will be returned otherwise, the codepage number
+ * @return If any error occurs, -1 will be returned otherwise, the codepage number
* will be returned
* @see ucnv_openCCSID
* @see ucnv_getPlatform
diff --git a/contrib/libs/icu/include/unicode/ucnv_cb.h b/contrib/libs/icu/include/unicode/ucnv_cb.h
index c59963d4be..14169ed61c 100644
--- a/contrib/libs/icu/include/unicode/ucnv_cb.h
+++ b/contrib/libs/icu/include/unicode/ucnv_cb.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
diff --git a/contrib/libs/icu/include/unicode/ucnv_err.h b/contrib/libs/icu/include/unicode/ucnv_err.h
index 55511a6838..d234710a8b 100644
--- a/contrib/libs/icu/include/unicode/ucnv_err.h
+++ b/contrib/libs/icu/include/unicode/ucnv_err.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -119,19 +119,19 @@ typedef struct UConverter UConverter;
#define UCNV_ESCAPE_JAVA "J"
/**
* FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to C (\\uXXXX \\UXXXXXXXX)
- * TO_U_CALLBACK_ESCAPE option to escape the character value according to C (\\xXXXX)
+ * TO_U_CALLBACK_ESCAPE option to escape the character value according to C (\\xXXXX)
* @stable ICU 2.0
*/
#define UCNV_ESCAPE_C "C"
/**
* FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Decimal escape \htmlonly(&amp;#DDDD;)\endhtmlonly
- * TO_U_CALLBACK_ESCAPE context option to escape the character value according to XML Decimal escape \htmlonly(&amp;#DDDD;)\endhtmlonly
+ * TO_U_CALLBACK_ESCAPE context option to escape the character value according to XML Decimal escape \htmlonly(&amp;#DDDD;)\endhtmlonly
* @stable ICU 2.0
*/
#define UCNV_ESCAPE_XML_DEC "D"
/**
* FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Hex escape \htmlonly(&amp;#xXXXX;)\endhtmlonly
- * TO_U_CALLBACK_ESCAPE context option to escape the character value according to XML Hex escape \htmlonly(&amp;#xXXXX;)\endhtmlonly
+ * TO_U_CALLBACK_ESCAPE context option to escape the character value according to XML Hex escape \htmlonly(&amp;#xXXXX;)\endhtmlonly
* @stable ICU 2.0
*/
#define UCNV_ESCAPE_XML_HEX "X"
@@ -171,7 +171,7 @@ typedef enum {
code points.
The error code U_INVALID_CHAR_FOUND will be set. */
UCNV_RESET = 3, /**< The callback is called with this reason when a
- 'reset' has occurred. Callback should reset all
+ 'reset' has occurred. Callback should reset all
state. */
UCNV_CLOSE = 4, /**< Called when the converter is closed. The
callback should release any allocated memory.*/
@@ -199,7 +199,7 @@ typedef struct {
const UChar *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */
char *target; /**< Pointer to the target buffer. @stable ICU 2.0 */
const char *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */
- int32_t *offsets; /**< Pointer to the buffer that receives the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */
+ int32_t *offsets; /**< Pointer to the buffer that receives the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */
} UConverterFromUnicodeArgs;
@@ -215,7 +215,7 @@ typedef struct {
const char *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */
UChar *target; /**< Pointer to the target buffer. @stable ICU 2.0 */
const UChar *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */
- int32_t *offsets; /**< Pointer to the buffer that receives the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */
+ int32_t *offsets; /**< Pointer to the buffer that receives the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */
} UConverterToUnicodeArgs;
diff --git a/contrib/libs/icu/include/unicode/ucnvsel.h b/contrib/libs/icu/include/unicode/ucnvsel.h
index dbb56d47f8..d423845ceb 100644
--- a/contrib/libs/icu/include/unicode/ucnvsel.h
+++ b/contrib/libs/icu/include/unicode/ucnvsel.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/include/unicode/ucol.h b/contrib/libs/icu/include/unicode/ucol.h
index 1ce75f9b8b..673af1c55a 100644
--- a/contrib/libs/icu/include/unicode/ucol.h
+++ b/contrib/libs/icu/include/unicode/ucol.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -131,7 +131,7 @@ typedef enum {
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
UCOL_ATTRIBUTE_VALUE_COUNT
-#endif /* U_HIDE_DEPRECATED_API */
+#endif /* U_HIDE_DEPRECATED_API */
} UColAttributeValue;
/**
@@ -204,7 +204,7 @@ typedef enum {
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
UCOL_REORDER_CODE_LIMIT = 0x1005
-#endif /* U_HIDE_DEPRECATED_API */
+#endif /* U_HIDE_DEPRECATED_API */
} UColReorderCode;
/**
@@ -342,15 +342,15 @@ typedef enum {
*/
UCOL_NUMERIC_COLLATION = UCOL_STRENGTH + 2,
- /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
- * it is needed for layout of RuleBasedCollator object. */
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+ /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
+ * it is needed for layout of RuleBasedCollator object. */
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* One more than the highest normal UColAttribute value.
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
UCOL_ATTRIBUTE_COUNT
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
} UColAttribute;
/** Options for retrieving the rule string
@@ -1069,7 +1069,7 @@ typedef enum {
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
UCOL_BOUND_VALUE_COUNT
-#endif /* U_HIDE_DEPRECATED_API */
+#endif /* U_HIDE_DEPRECATED_API */
} UColBoundMode;
/**
@@ -1151,7 +1151,7 @@ ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
* The recommended way to achieve "merged" sorting is by
* concatenating strings with U+FFFE between them.
* The concatenation has the same sort order as the merged sort keys,
- * but merge(getSortKey(str1), getSortKey(str2)) may differ from getSortKey(str1 + '\\uFFFE' + str2).
+ * but merge(getSortKey(str1), getSortKey(str2)) may differ from getSortKey(str1 + '\\uFFFE' + str2).
* Using strings with U+FFFE may yield shorter sort keys.
*
* For details about Sort Key Features see
@@ -1296,7 +1296,7 @@ U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCod
* the top of one of the supported reordering groups,
* and it must not be beyond the last of those groups.
* See ucol_setMaxVariable().
- * @param coll collator to be set
+ * @param coll collator to be set
* @param varTop primary weight, as returned by ucol_setVariableTop or ucol_getVariableTop
* @param status error code
* @see ucol_getVariableTop
diff --git a/contrib/libs/icu/include/unicode/ucoleitr.h b/contrib/libs/icu/include/unicode/ucoleitr.h
index da92cbd82a..85ec8383d7 100644
--- a/contrib/libs/icu/include/unicode/ucoleitr.h
+++ b/contrib/libs/icu/include/unicode/ucoleitr.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -152,7 +152,7 @@ ucol_reset(UCollationElements *elems);
* A single character may contain more than one collation element.
* @param elems The UCollationElements containing the text.
* @param status A pointer to a UErrorCode to receive any errors.
- * @return The next collation elements ordering, otherwise returns UCOL_NULLORDER
+ * @return The next collation elements ordering, otherwise returns UCOL_NULLORDER
* if an error has occured or if the end of string has been reached
* @stable ICU 2.0
*/
@@ -168,7 +168,7 @@ ucol_next(UCollationElements *elems, UErrorCode *status);
* a U_BUFFER_OVERFLOW_ERROR is returned if the internal stack
* buffer has been exhausted.
* @return The previous collation elements ordering, otherwise returns
- * UCOL_NULLORDER if an error has occured or if the start of string has
+ * UCOL_NULLORDER if an error has occured or if the start of string has
* been reached.
* @stable ICU 2.0
*/
diff --git a/contrib/libs/icu/include/unicode/uconfig.h b/contrib/libs/icu/include/unicode/uconfig.h
index 35204c2cd2..bbc232d1ed 100644
--- a/contrib/libs/icu/include/unicode/uconfig.h
+++ b/contrib/libs/icu/include/unicode/uconfig.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: uconfig.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -76,7 +76,7 @@
#endif
/**
- * Determines whether to enable auto cleanup of libraries.
+ * Determines whether to enable auto cleanup of libraries.
* @internal
*/
#ifndef UCLN_NO_AUTO_CLEANUP
@@ -183,7 +183,7 @@
*/
#ifdef U_HAVE_LIB_SUFFIX
/* Use the predefined value. */
-#elif defined(U_LIB_SUFFIX_C_NAME) || defined(U_IN_DOXYGEN)
+#elif defined(U_LIB_SUFFIX_C_NAME) || defined(U_IN_DOXYGEN)
# define U_HAVE_LIB_SUFFIX 1
#endif
@@ -262,8 +262,8 @@
/**
* \def UCONFIG_NO_CONVERSION
- * ICU will not completely build (compiling the tools fails) with this
- * switch turned on.
+ * ICU will not completely build (compiling the tools fails) with this
+ * switch turned on.
* This switch turns off all converters.
*
* You may want to use this together with U_CHARSET_IS_UTF8 defined to 1
@@ -321,9 +321,9 @@
*/
#ifndef UCONFIG_NO_NORMALIZATION
# define UCONFIG_NO_NORMALIZATION 0
-#endif
-
-#if UCONFIG_NO_NORMALIZATION
+#endif
+
+#if UCONFIG_NO_NORMALIZATION
/* common library */
/* ICU 50 CJK dictionary BreakIterator uses normalization */
# define UCONFIG_NO_BREAK_ITERATION 1
@@ -369,18 +369,18 @@
# define UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE UMSGPAT_APOS_DOUBLE_OPTIONAL
#endif
-/**
- * \def UCONFIG_USE_WINDOWS_LCID_MAPPING_API
- * On platforms where U_PLATFORM_HAS_WIN32_API is true, this switch determines
- * if the Windows platform APIs are used for LCID<->Locale Name conversions.
- * Otherwise, only the built-in ICU tables are used.
- *
- * @internal ICU 64
- */
-#ifndef UCONFIG_USE_WINDOWS_LCID_MAPPING_API
-# define UCONFIG_USE_WINDOWS_LCID_MAPPING_API 1
-#endif
-
+/**
+ * \def UCONFIG_USE_WINDOWS_LCID_MAPPING_API
+ * On platforms where U_PLATFORM_HAS_WIN32_API is true, this switch determines
+ * if the Windows platform APIs are used for LCID<->Locale Name conversions.
+ * Otherwise, only the built-in ICU tables are used.
+ *
+ * @internal ICU 64
+ */
+#ifndef UCONFIG_USE_WINDOWS_LCID_MAPPING_API
+# define UCONFIG_USE_WINDOWS_LCID_MAPPING_API 1
+#endif
+
/* i18n library switches ---------------------------------------------------- */
/**
@@ -453,4 +453,4 @@
# define UCONFIG_NO_FILTERED_BREAK_ITERATION 0
#endif
-#endif // __UCONFIG_H__
+#endif // __UCONFIG_H__
diff --git a/contrib/libs/icu/include/unicode/ucpmap.h b/contrib/libs/icu/include/unicode/ucpmap.h
index 32c7ab66cd..31e1365cac 100644
--- a/contrib/libs/icu/include/unicode/ucpmap.h
+++ b/contrib/libs/icu/include/unicode/ucpmap.h
@@ -1,159 +1,159 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// ucpmap.h
-// created: 2018sep03 Markus W. Scherer
-
-#ifndef __UCPMAP_H__
-#define __UCPMAP_H__
-
-#include "unicode/utypes.h"
-
-U_CDECL_BEGIN
-
-/**
- * \file
- *
- * This file defines an abstract map from Unicode code points to integer values.
- *
- * @see UCPMap
- * @see UCPTrie
- * @see UMutableCPTrie
- */
-
-/**
- * Abstract map from Unicode code points (U+0000..U+10FFFF) to integer values.
- *
- * @see UCPTrie
- * @see UMutableCPTrie
- * @stable ICU 63
- */
-typedef struct UCPMap UCPMap;
-
-/**
- * Selectors for how ucpmap_getRange() etc. should report value ranges overlapping with surrogates.
- * Most users should use UCPMAP_RANGE_NORMAL.
- *
- * @see ucpmap_getRange
- * @see ucptrie_getRange
- * @see umutablecptrie_getRange
- * @stable ICU 63
- */
-enum UCPMapRangeOption {
- /**
- * ucpmap_getRange() enumerates all same-value ranges as stored in the map.
- * Most users should use this option.
- * @stable ICU 63
- */
- UCPMAP_RANGE_NORMAL,
- /**
- * ucpmap_getRange() enumerates all same-value ranges as stored in the map,
- * except that lead surrogates (U+D800..U+DBFF) are treated as having the
- * surrogateValue, which is passed to getRange() as a separate parameter.
- * The surrogateValue is not transformed via filter().
- * See U_IS_LEAD(c).
- *
- * Most users should use UCPMAP_RANGE_NORMAL instead.
- *
- * This option is useful for maps that map surrogate code *units* to
- * special values optimized for UTF-16 string processing
- * or for special error behavior for unpaired surrogates,
- * but those values are not to be associated with the lead surrogate code *points*.
- * @stable ICU 63
- */
- UCPMAP_RANGE_FIXED_LEAD_SURROGATES,
- /**
- * ucpmap_getRange() enumerates all same-value ranges as stored in the map,
- * except that all surrogates (U+D800..U+DFFF) are treated as having the
- * surrogateValue, which is passed to getRange() as a separate parameter.
- * The surrogateValue is not transformed via filter().
- * See U_IS_SURROGATE(c).
- *
- * Most users should use UCPMAP_RANGE_NORMAL instead.
- *
- * This option is useful for maps that map surrogate code *units* to
- * special values optimized for UTF-16 string processing
- * or for special error behavior for unpaired surrogates,
- * but those values are not to be associated with the lead surrogate code *points*.
- * @stable ICU 63
- */
- UCPMAP_RANGE_FIXED_ALL_SURROGATES
-};
-#ifndef U_IN_DOXYGEN
-typedef enum UCPMapRangeOption UCPMapRangeOption;
-#endif
-
-/**
- * Returns the value for a code point as stored in the map, with range checking.
- * Returns an implementation-defined error value if c is not in the range 0..U+10FFFF.
- *
- * @param map the map
- * @param c the code point
- * @return the map value,
- * or an implementation-defined error value if the code point is not in the range 0..U+10FFFF
- * @stable ICU 63
- */
-U_CAPI uint32_t U_EXPORT2
-ucpmap_get(const UCPMap *map, UChar32 c);
-
-/**
- * Callback function type: Modifies a map value.
- * Optionally called by ucpmap_getRange()/ucptrie_getRange()/umutablecptrie_getRange().
- * The modified value will be returned by the getRange function.
- *
- * Can be used to ignore some of the value bits,
- * make a filter for one of several values,
- * return a value index computed from the map value, etc.
- *
- * @param context an opaque pointer, as passed into the getRange function
- * @param value a value from the map
- * @return the modified value
- * @stable ICU 63
- */
-typedef uint32_t U_CALLCONV
-UCPMapValueFilter(const void *context, uint32_t value);
-
-/**
- * Returns the last code point such that all those from start to there have the same value.
- * Can be used to efficiently iterate over all same-value ranges in a map.
- * (This is normally faster than iterating over code points and get()ting each value,
- * but much slower than a data structure that stores ranges directly.)
- *
- * If the UCPMapValueFilter function pointer is not NULL, then
- * the value to be delivered is passed through that function, and the return value is the end
- * of the range where all values are modified to the same actual value.
- * The value is unchanged if that function pointer is NULL.
- *
- * Example:
- * \code
- * UChar32 start = 0, end;
- * uint32_t value;
- * while ((end = ucpmap_getRange(map, start, UCPMAP_RANGE_NORMAL, 0,
- * NULL, NULL, &value)) >= 0) {
- * // Work with the range start..end and its value.
- * start = end + 1;
- * }
- * \endcode
- *
- * @param map the map
- * @param start range start
- * @param option defines whether surrogates are treated normally,
- * or as having the surrogateValue; usually UCPMAP_RANGE_NORMAL
- * @param surrogateValue value for surrogates; ignored if option==UCPMAP_RANGE_NORMAL
- * @param filter a pointer to a function that may modify the map data value,
- * or NULL if the values from the map are to be used unmodified
- * @param context an opaque pointer that is passed on to the filter function
- * @param pValue if not NULL, receives the value that every code point start..end has;
- * may have been modified by filter(context, map value)
- * if that function pointer is not NULL
- * @return the range end code point, or -1 if start is not a valid code point
- * @stable ICU 63
- */
-U_CAPI UChar32 U_EXPORT2
-ucpmap_getRange(const UCPMap *map, UChar32 start,
- UCPMapRangeOption option, uint32_t surrogateValue,
- UCPMapValueFilter *filter, const void *context, uint32_t *pValue);
-
-U_CDECL_END
-
-#endif
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// ucpmap.h
+// created: 2018sep03 Markus W. Scherer
+
+#ifndef __UCPMAP_H__
+#define __UCPMAP_H__
+
+#include "unicode/utypes.h"
+
+U_CDECL_BEGIN
+
+/**
+ * \file
+ *
+ * This file defines an abstract map from Unicode code points to integer values.
+ *
+ * @see UCPMap
+ * @see UCPTrie
+ * @see UMutableCPTrie
+ */
+
+/**
+ * Abstract map from Unicode code points (U+0000..U+10FFFF) to integer values.
+ *
+ * @see UCPTrie
+ * @see UMutableCPTrie
+ * @stable ICU 63
+ */
+typedef struct UCPMap UCPMap;
+
+/**
+ * Selectors for how ucpmap_getRange() etc. should report value ranges overlapping with surrogates.
+ * Most users should use UCPMAP_RANGE_NORMAL.
+ *
+ * @see ucpmap_getRange
+ * @see ucptrie_getRange
+ * @see umutablecptrie_getRange
+ * @stable ICU 63
+ */
+enum UCPMapRangeOption {
+ /**
+ * ucpmap_getRange() enumerates all same-value ranges as stored in the map.
+ * Most users should use this option.
+ * @stable ICU 63
+ */
+ UCPMAP_RANGE_NORMAL,
+ /**
+ * ucpmap_getRange() enumerates all same-value ranges as stored in the map,
+ * except that lead surrogates (U+D800..U+DBFF) are treated as having the
+ * surrogateValue, which is passed to getRange() as a separate parameter.
+ * The surrogateValue is not transformed via filter().
+ * See U_IS_LEAD(c).
+ *
+ * Most users should use UCPMAP_RANGE_NORMAL instead.
+ *
+ * This option is useful for maps that map surrogate code *units* to
+ * special values optimized for UTF-16 string processing
+ * or for special error behavior for unpaired surrogates,
+ * but those values are not to be associated with the lead surrogate code *points*.
+ * @stable ICU 63
+ */
+ UCPMAP_RANGE_FIXED_LEAD_SURROGATES,
+ /**
+ * ucpmap_getRange() enumerates all same-value ranges as stored in the map,
+ * except that all surrogates (U+D800..U+DFFF) are treated as having the
+ * surrogateValue, which is passed to getRange() as a separate parameter.
+ * The surrogateValue is not transformed via filter().
+ * See U_IS_SURROGATE(c).
+ *
+ * Most users should use UCPMAP_RANGE_NORMAL instead.
+ *
+ * This option is useful for maps that map surrogate code *units* to
+ * special values optimized for UTF-16 string processing
+ * or for special error behavior for unpaired surrogates,
+ * but those values are not to be associated with the lead surrogate code *points*.
+ * @stable ICU 63
+ */
+ UCPMAP_RANGE_FIXED_ALL_SURROGATES
+};
+#ifndef U_IN_DOXYGEN
+typedef enum UCPMapRangeOption UCPMapRangeOption;
+#endif
+
+/**
+ * Returns the value for a code point as stored in the map, with range checking.
+ * Returns an implementation-defined error value if c is not in the range 0..U+10FFFF.
+ *
+ * @param map the map
+ * @param c the code point
+ * @return the map value,
+ * or an implementation-defined error value if the code point is not in the range 0..U+10FFFF
+ * @stable ICU 63
+ */
+U_CAPI uint32_t U_EXPORT2
+ucpmap_get(const UCPMap *map, UChar32 c);
+
+/**
+ * Callback function type: Modifies a map value.
+ * Optionally called by ucpmap_getRange()/ucptrie_getRange()/umutablecptrie_getRange().
+ * The modified value will be returned by the getRange function.
+ *
+ * Can be used to ignore some of the value bits,
+ * make a filter for one of several values,
+ * return a value index computed from the map value, etc.
+ *
+ * @param context an opaque pointer, as passed into the getRange function
+ * @param value a value from the map
+ * @return the modified value
+ * @stable ICU 63
+ */
+typedef uint32_t U_CALLCONV
+UCPMapValueFilter(const void *context, uint32_t value);
+
+/**
+ * Returns the last code point such that all those from start to there have the same value.
+ * Can be used to efficiently iterate over all same-value ranges in a map.
+ * (This is normally faster than iterating over code points and get()ting each value,
+ * but much slower than a data structure that stores ranges directly.)
+ *
+ * If the UCPMapValueFilter function pointer is not NULL, then
+ * the value to be delivered is passed through that function, and the return value is the end
+ * of the range where all values are modified to the same actual value.
+ * The value is unchanged if that function pointer is NULL.
+ *
+ * Example:
+ * \code
+ * UChar32 start = 0, end;
+ * uint32_t value;
+ * while ((end = ucpmap_getRange(map, start, UCPMAP_RANGE_NORMAL, 0,
+ * NULL, NULL, &value)) >= 0) {
+ * // Work with the range start..end and its value.
+ * start = end + 1;
+ * }
+ * \endcode
+ *
+ * @param map the map
+ * @param start range start
+ * @param option defines whether surrogates are treated normally,
+ * or as having the surrogateValue; usually UCPMAP_RANGE_NORMAL
+ * @param surrogateValue value for surrogates; ignored if option==UCPMAP_RANGE_NORMAL
+ * @param filter a pointer to a function that may modify the map data value,
+ * or NULL if the values from the map are to be used unmodified
+ * @param context an opaque pointer that is passed on to the filter function
+ * @param pValue if not NULL, receives the value that every code point start..end has;
+ * may have been modified by filter(context, map value)
+ * if that function pointer is not NULL
+ * @return the range end code point, or -1 if start is not a valid code point
+ * @stable ICU 63
+ */
+U_CAPI UChar32 U_EXPORT2
+ucpmap_getRange(const UCPMap *map, UChar32 start,
+ UCPMapRangeOption option, uint32_t surrogateValue,
+ UCPMapValueFilter *filter, const void *context, uint32_t *pValue);
+
+U_CDECL_END
+
+#endif
diff --git a/contrib/libs/icu/include/unicode/ucptrie.h b/contrib/libs/icu/include/unicode/ucptrie.h
index 43313bc768..be06a22792 100644
--- a/contrib/libs/icu/include/unicode/ucptrie.h
+++ b/contrib/libs/icu/include/unicode/ucptrie.h
@@ -1,644 +1,644 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// ucptrie.h (modified from utrie2.h)
-// created: 2017dec29 Markus W. Scherer
-
-#ifndef __UCPTRIE_H__
-#define __UCPTRIE_H__
-
-#include "unicode/utypes.h"
-
-#include "unicode/localpointer.h"
-#include "unicode/ucpmap.h"
-#include "unicode/utf8.h"
-
-U_CDECL_BEGIN
-
-/**
- * \file
- *
- * This file defines an immutable Unicode code point trie.
- *
- * @see UCPTrie
- * @see UMutableCPTrie
- */
-
-#ifndef U_IN_DOXYGEN
-/** @internal */
-typedef union UCPTrieData {
- /** @internal */
- const void *ptr0;
- /** @internal */
- const uint16_t *ptr16;
- /** @internal */
- const uint32_t *ptr32;
- /** @internal */
- const uint8_t *ptr8;
-} UCPTrieData;
-#endif
-
-/**
- * Immutable Unicode code point trie structure.
- * Fast, reasonably compact, map from Unicode code points (U+0000..U+10FFFF) to integer values.
- * For details see http://site.icu-project.org/design/struct/utrie
- *
- * Do not access UCPTrie fields directly; use public functions and macros.
- * Functions are easy to use: They support all trie types and value widths.
- *
- * When performance is really important, macros provide faster access.
- * Most macros are specific to either "fast" or "small" tries, see UCPTrieType.
- * There are "fast" macros for special optimized use cases.
- *
- * The macros will return bogus values, or may crash, if used on the wrong type or value width.
- *
- * @see UMutableCPTrie
- * @stable ICU 63
- */
-struct UCPTrie {
-#ifndef U_IN_DOXYGEN
- /** @internal */
- const uint16_t *index;
- /** @internal */
- UCPTrieData data;
-
- /** @internal */
- int32_t indexLength;
- /** @internal */
- int32_t dataLength;
- /** Start of the last range which ends at U+10FFFF. @internal */
- UChar32 highStart;
- /** highStart>>12 @internal */
- uint16_t shifted12HighStart;
-
- /** @internal */
- int8_t type; // UCPTrieType
- /** @internal */
- int8_t valueWidth; // UCPTrieValueWidth
-
- /** padding/reserved @internal */
- uint32_t reserved32;
- /** padding/reserved @internal */
- uint16_t reserved16;
-
- /**
- * Internal index-3 null block offset.
- * Set to an impossibly high value (e.g., 0xffff) if there is no dedicated index-3 null block.
- * @internal
- */
- uint16_t index3NullOffset;
- /**
- * Internal data null block offset, not shifted.
- * Set to an impossibly high value (e.g., 0xfffff) if there is no dedicated data null block.
- * @internal
- */
- int32_t dataNullOffset;
- /** @internal */
- uint32_t nullValue;
-
-#ifdef UCPTRIE_DEBUG
- /** @internal */
- const char *name;
-#endif
-#endif
-};
-#ifndef U_IN_DOXYGEN
-typedef struct UCPTrie UCPTrie;
-#endif
-
-/**
- * Selectors for the type of a UCPTrie.
- * Different trade-offs for size vs. speed.
- *
- * @see umutablecptrie_buildImmutable
- * @see ucptrie_openFromBinary
- * @see ucptrie_getType
- * @stable ICU 63
- */
-enum UCPTrieType {
- /**
- * For ucptrie_openFromBinary() to accept any type.
- * ucptrie_getType() will return the actual type.
- * @stable ICU 63
- */
- UCPTRIE_TYPE_ANY = -1,
- /**
- * Fast/simple/larger BMP data structure. Use functions and "fast" macros.
- * @stable ICU 63
- */
- UCPTRIE_TYPE_FAST,
- /**
- * Small/slower BMP data structure. Use functions and "small" macros.
- * @stable ICU 63
- */
- UCPTRIE_TYPE_SMALL
-};
-#ifndef U_IN_DOXYGEN
-typedef enum UCPTrieType UCPTrieType;
-#endif
-
-/**
- * Selectors for the number of bits in a UCPTrie data value.
- *
- * @see umutablecptrie_buildImmutable
- * @see ucptrie_openFromBinary
- * @see ucptrie_getValueWidth
- * @stable ICU 63
- */
-enum UCPTrieValueWidth {
- /**
- * For ucptrie_openFromBinary() to accept any data value width.
- * ucptrie_getValueWidth() will return the actual data value width.
- * @stable ICU 63
- */
- UCPTRIE_VALUE_BITS_ANY = -1,
- /**
- * The trie stores 16 bits per data value.
- * It returns them as unsigned values 0..0xffff=65535.
- * @stable ICU 63
- */
- UCPTRIE_VALUE_BITS_16,
- /**
- * The trie stores 32 bits per data value.
- * @stable ICU 63
- */
- UCPTRIE_VALUE_BITS_32,
- /**
- * The trie stores 8 bits per data value.
- * It returns them as unsigned values 0..0xff=255.
- * @stable ICU 63
- */
- UCPTRIE_VALUE_BITS_8
-};
-#ifndef U_IN_DOXYGEN
-typedef enum UCPTrieValueWidth UCPTrieValueWidth;
-#endif
-
-/**
- * Opens a trie from its binary form, stored in 32-bit-aligned memory.
- * Inverse of ucptrie_toBinary().
- *
- * The memory must remain valid and unchanged as long as the trie is used.
- * You must ucptrie_close() the trie once you are done using it.
- *
- * @param type selects the trie type; results in an
- * U_INVALID_FORMAT_ERROR if it does not match the binary data;
- * use UCPTRIE_TYPE_ANY to accept any type
- * @param valueWidth selects the number of bits in a data value; results in an
- * U_INVALID_FORMAT_ERROR if it does not match the binary data;
- * use UCPTRIE_VALUE_BITS_ANY to accept any data value width
- * @param data a pointer to 32-bit-aligned memory containing the binary data of a UCPTrie
- * @param length the number of bytes available at data;
- * can be more than necessary
- * @param pActualLength receives the actual number of bytes at data taken up by the trie data;
- * can be NULL
- * @param pErrorCode an in/out ICU UErrorCode
- * @return the trie
- *
- * @see umutablecptrie_open
- * @see umutablecptrie_buildImmutable
- * @see ucptrie_toBinary
- * @stable ICU 63
- */
-U_CAPI UCPTrie * U_EXPORT2
-ucptrie_openFromBinary(UCPTrieType type, UCPTrieValueWidth valueWidth,
- const void *data, int32_t length, int32_t *pActualLength,
- UErrorCode *pErrorCode);
-
-/**
- * Closes a trie and releases associated memory.
- *
- * @param trie the trie
- * @stable ICU 63
- */
-U_CAPI void U_EXPORT2
-ucptrie_close(UCPTrie *trie);
-
-/**
- * Returns the trie type.
- *
- * @param trie the trie
- * @return the trie type
- * @see ucptrie_openFromBinary
- * @see UCPTRIE_TYPE_ANY
- * @stable ICU 63
- */
-U_CAPI UCPTrieType U_EXPORT2
-ucptrie_getType(const UCPTrie *trie);
-
-/**
- * Returns the number of bits in a trie data value.
- *
- * @param trie the trie
- * @return the number of bits in a trie data value
- * @see ucptrie_openFromBinary
- * @see UCPTRIE_VALUE_BITS_ANY
- * @stable ICU 63
- */
-U_CAPI UCPTrieValueWidth U_EXPORT2
-ucptrie_getValueWidth(const UCPTrie *trie);
-
-/**
- * Returns the value for a code point as stored in the trie, with range checking.
- * Returns the trie error value if c is not in the range 0..U+10FFFF.
- *
- * Easier to use than UCPTRIE_FAST_GET() and similar macros but slower.
- * Easier to use because, unlike the macros, this function works on all UCPTrie
- * objects, for all types and value widths.
- *
- * @param trie the trie
- * @param c the code point
- * @return the trie value,
- * or the trie error value if the code point is not in the range 0..U+10FFFF
- * @stable ICU 63
- */
-U_CAPI uint32_t U_EXPORT2
-ucptrie_get(const UCPTrie *trie, UChar32 c);
-
-/**
- * Returns the last code point such that all those from start to there have the same value.
- * Can be used to efficiently iterate over all same-value ranges in a trie.
- * (This is normally faster than iterating over code points and get()ting each value,
- * but much slower than a data structure that stores ranges directly.)
- *
- * If the UCPMapValueFilter function pointer is not NULL, then
- * the value to be delivered is passed through that function, and the return value is the end
- * of the range where all values are modified to the same actual value.
- * The value is unchanged if that function pointer is NULL.
- *
- * Example:
- * \code
- * UChar32 start = 0, end;
- * uint32_t value;
- * while ((end = ucptrie_getRange(trie, start, UCPMAP_RANGE_NORMAL, 0,
- * NULL, NULL, &value)) >= 0) {
- * // Work with the range start..end and its value.
- * start = end + 1;
- * }
- * \endcode
- *
- * @param trie the trie
- * @param start range start
- * @param option defines whether surrogates are treated normally,
- * or as having the surrogateValue; usually UCPMAP_RANGE_NORMAL
- * @param surrogateValue value for surrogates; ignored if option==UCPMAP_RANGE_NORMAL
- * @param filter a pointer to a function that may modify the trie data value,
- * or NULL if the values from the trie are to be used unmodified
- * @param context an opaque pointer that is passed on to the filter function
- * @param pValue if not NULL, receives the value that every code point start..end has;
- * may have been modified by filter(context, trie value)
- * if that function pointer is not NULL
- * @return the range end code point, or -1 if start is not a valid code point
- * @stable ICU 63
- */
-U_CAPI UChar32 U_EXPORT2
-ucptrie_getRange(const UCPTrie *trie, UChar32 start,
- UCPMapRangeOption option, uint32_t surrogateValue,
- UCPMapValueFilter *filter, const void *context, uint32_t *pValue);
-
-/**
- * Writes a memory-mappable form of the trie into 32-bit aligned memory.
- * Inverse of ucptrie_openFromBinary().
- *
- * @param trie the trie
- * @param data a pointer to 32-bit-aligned memory to be filled with the trie data;
- * can be NULL if capacity==0
- * @param capacity the number of bytes available at data, or 0 for pure preflighting
- * @param pErrorCode an in/out ICU UErrorCode;
- * U_BUFFER_OVERFLOW_ERROR if the capacity is too small
- * @return the number of bytes written or (if buffer overflow) needed for the trie
- *
- * @see ucptrie_openFromBinary()
- * @stable ICU 63
- */
-U_CAPI int32_t U_EXPORT2
-ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *pErrorCode);
-
-/**
- * Macro parameter value for a trie with 16-bit data values.
- * Use the name of this macro as a "dataAccess" parameter in other macros.
- * Do not use this macro in any other way.
- *
- * @see UCPTRIE_VALUE_BITS_16
- * @stable ICU 63
- */
-#define UCPTRIE_16(trie, i) ((trie)->data.ptr16[i])
-
-/**
- * Macro parameter value for a trie with 32-bit data values.
- * Use the name of this macro as a "dataAccess" parameter in other macros.
- * Do not use this macro in any other way.
- *
- * @see UCPTRIE_VALUE_BITS_32
- * @stable ICU 63
- */
-#define UCPTRIE_32(trie, i) ((trie)->data.ptr32[i])
-
-/**
- * Macro parameter value for a trie with 8-bit data values.
- * Use the name of this macro as a "dataAccess" parameter in other macros.
- * Do not use this macro in any other way.
- *
- * @see UCPTRIE_VALUE_BITS_8
- * @stable ICU 63
- */
-#define UCPTRIE_8(trie, i) ((trie)->data.ptr8[i])
-
-/**
- * Returns a trie value for a code point, with range checking.
- * Returns the trie error value if c is not in the range 0..U+10FFFF.
- *
- * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST
- * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
- * @param c (UChar32, in) the input code point
- * @return The code point's trie value.
- * @stable ICU 63
- */
-#define UCPTRIE_FAST_GET(trie, dataAccess, c) dataAccess(trie, _UCPTRIE_CP_INDEX(trie, 0xffff, c))
-
-/**
- * Returns a 16-bit trie value for a code point, with range checking.
- * Returns the trie error value if c is not in the range U+0000..U+10FFFF.
- *
- * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_SMALL
- * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
- * @param c (UChar32, in) the input code point
- * @return The code point's trie value.
- * @stable ICU 63
- */
-#define UCPTRIE_SMALL_GET(trie, dataAccess, c) \
- dataAccess(trie, _UCPTRIE_CP_INDEX(trie, UCPTRIE_SMALL_MAX, c))
-
-/**
- * UTF-16: Reads the next code point (UChar32 c, out), post-increments src,
- * and gets a value from the trie.
- * Sets the trie error value if c is an unpaired surrogate.
- *
- * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST
- * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
- * @param src (const UChar *, in/out) the source text pointer
- * @param limit (const UChar *, in) the limit pointer for the text, or NULL if NUL-terminated
- * @param c (UChar32, out) variable for the code point
- * @param result (out) variable for the trie lookup result
- * @stable ICU 63
- */
-#define UCPTRIE_FAST_U16_NEXT(trie, dataAccess, src, limit, c, result) UPRV_BLOCK_MACRO_BEGIN { \
- (c) = *(src)++; \
- int32_t __index; \
- if (!U16_IS_SURROGATE(c)) { \
- __index = _UCPTRIE_FAST_INDEX(trie, c); \
- } else { \
- uint16_t __c2; \
- if (U16_IS_SURROGATE_LEAD(c) && (src) != (limit) && U16_IS_TRAIL(__c2 = *(src))) { \
- ++(src); \
- (c) = U16_GET_SUPPLEMENTARY((c), __c2); \
- __index = _UCPTRIE_SMALL_INDEX(trie, c); \
- } else { \
- __index = (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET; \
- } \
- } \
- (result) = dataAccess(trie, __index); \
-} UPRV_BLOCK_MACRO_END
-
-/**
- * UTF-16: Reads the previous code point (UChar32 c, out), pre-decrements src,
- * and gets a value from the trie.
- * Sets the trie error value if c is an unpaired surrogate.
- *
- * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST
- * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
- * @param start (const UChar *, in) the start pointer for the text
- * @param src (const UChar *, in/out) the source text pointer
- * @param c (UChar32, out) variable for the code point
- * @param result (out) variable for the trie lookup result
- * @stable ICU 63
- */
-#define UCPTRIE_FAST_U16_PREV(trie, dataAccess, start, src, c, result) UPRV_BLOCK_MACRO_BEGIN { \
- (c) = *--(src); \
- int32_t __index; \
- if (!U16_IS_SURROGATE(c)) { \
- __index = _UCPTRIE_FAST_INDEX(trie, c); \
- } else { \
- uint16_t __c2; \
- if (U16_IS_SURROGATE_TRAIL(c) && (src) != (start) && U16_IS_LEAD(__c2 = *((src) - 1))) { \
- --(src); \
- (c) = U16_GET_SUPPLEMENTARY(__c2, (c)); \
- __index = _UCPTRIE_SMALL_INDEX(trie, c); \
- } else { \
- __index = (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET; \
- } \
- } \
- (result) = dataAccess(trie, __index); \
-} UPRV_BLOCK_MACRO_END
-
-/**
- * UTF-8: Post-increments src and gets a value from the trie.
- * Sets the trie error value for an ill-formed byte sequence.
- *
- * Unlike UCPTRIE_FAST_U16_NEXT() this UTF-8 macro does not provide the code point
- * because it would be more work to do so and is often not needed.
- * If the trie value differs from the error value, then the byte sequence is well-formed,
- * and the code point can be assembled without revalidation.
- *
- * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST
- * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
- * @param src (const char *, in/out) the source text pointer
- * @param limit (const char *, in) the limit pointer for the text (must not be NULL)
- * @param result (out) variable for the trie lookup result
- * @stable ICU 63
- */
-#define UCPTRIE_FAST_U8_NEXT(trie, dataAccess, src, limit, result) UPRV_BLOCK_MACRO_BEGIN { \
- int32_t __lead = (uint8_t)*(src)++; \
- if (!U8_IS_SINGLE(__lead)) { \
- uint8_t __t1, __t2, __t3; \
- if ((src) != (limit) && \
- (__lead >= 0xe0 ? \
- __lead < 0xf0 ? /* U+0800..U+FFFF except surrogates */ \
- U8_LEAD3_T1_BITS[__lead &= 0xf] & (1 << ((__t1 = *(src)) >> 5)) && \
- ++(src) != (limit) && (__t2 = *(src) - 0x80) <= 0x3f && \
- (__lead = ((int32_t)(trie)->index[(__lead << 6) + (__t1 & 0x3f)]) + __t2, 1) \
- : /* U+10000..U+10FFFF */ \
- (__lead -= 0xf0) <= 4 && \
- U8_LEAD4_T1_BITS[(__t1 = *(src)) >> 4] & (1 << __lead) && \
- (__lead = (__lead << 6) | (__t1 & 0x3f), ++(src) != (limit)) && \
- (__t2 = *(src) - 0x80) <= 0x3f && \
- ++(src) != (limit) && (__t3 = *(src) - 0x80) <= 0x3f && \
- (__lead = __lead >= (trie)->shifted12HighStart ? \
- (trie)->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET : \
- ucptrie_internalSmallU8Index((trie), __lead, __t2, __t3), 1) \
- : /* U+0080..U+07FF */ \
- __lead >= 0xc2 && (__t1 = *(src) - 0x80) <= 0x3f && \
- (__lead = (int32_t)(trie)->index[__lead & 0x1f] + __t1, 1))) { \
- ++(src); \
- } else { \
- __lead = (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET; /* ill-formed*/ \
- } \
- } \
- (result) = dataAccess(trie, __lead); \
-} UPRV_BLOCK_MACRO_END
-
-/**
- * UTF-8: Pre-decrements src and gets a value from the trie.
- * Sets the trie error value for an ill-formed byte sequence.
- *
- * Unlike UCPTRIE_FAST_U16_PREV() this UTF-8 macro does not provide the code point
- * because it would be more work to do so and is often not needed.
- * If the trie value differs from the error value, then the byte sequence is well-formed,
- * and the code point can be assembled without revalidation.
- *
- * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST
- * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
- * @param start (const char *, in) the start pointer for the text
- * @param src (const char *, in/out) the source text pointer
- * @param result (out) variable for the trie lookup result
- * @stable ICU 63
- */
-#define UCPTRIE_FAST_U8_PREV(trie, dataAccess, start, src, result) UPRV_BLOCK_MACRO_BEGIN { \
- int32_t __index = (uint8_t)*--(src); \
- if (!U8_IS_SINGLE(__index)) { \
- __index = ucptrie_internalU8PrevIndex((trie), __index, (const uint8_t *)(start), \
- (const uint8_t *)(src)); \
- (src) -= __index & 7; \
- __index >>= 3; \
- } \
- (result) = dataAccess(trie, __index); \
-} UPRV_BLOCK_MACRO_END
-
-/**
- * Returns a trie value for an ASCII code point, without range checking.
- *
- * @param trie (const UCPTrie *, in) the trie (of either fast or small type)
- * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
- * @param c (UChar32, in) the input code point; must be U+0000..U+007F
- * @return The ASCII code point's trie value.
- * @stable ICU 63
- */
-#define UCPTRIE_ASCII_GET(trie, dataAccess, c) dataAccess(trie, c)
-
-/**
- * Returns a trie value for a BMP code point (U+0000..U+FFFF), without range checking.
- * Can be used to look up a value for a UTF-16 code unit if other parts of
- * the string processing check for surrogates.
- *
- * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST
- * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
- * @param c (UChar32, in) the input code point, must be U+0000..U+FFFF
- * @return The BMP code point's trie value.
- * @stable ICU 63
- */
-#define UCPTRIE_FAST_BMP_GET(trie, dataAccess, c) dataAccess(trie, _UCPTRIE_FAST_INDEX(trie, c))
-
-/**
- * Returns a trie value for a supplementary code point (U+10000..U+10FFFF),
- * without range checking.
- *
- * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST
- * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
- * @param c (UChar32, in) the input code point, must be U+10000..U+10FFFF
- * @return The supplementary code point's trie value.
- * @stable ICU 63
- */
-#define UCPTRIE_FAST_SUPP_GET(trie, dataAccess, c) dataAccess(trie, _UCPTRIE_SMALL_INDEX(trie, c))
-
-/* Internal definitions ----------------------------------------------------- */
-
-#ifndef U_IN_DOXYGEN
-
-/**
- * Internal implementation constants.
- * These are needed for the API macros, but users should not use these directly.
- * @internal
- */
-enum {
- /** @internal */
- UCPTRIE_FAST_SHIFT = 6,
-
- /** Number of entries in a data block for code points below the fast limit. 64=0x40 @internal */
- UCPTRIE_FAST_DATA_BLOCK_LENGTH = 1 << UCPTRIE_FAST_SHIFT,
-
- /** Mask for getting the lower bits for the in-fast-data-block offset. @internal */
- UCPTRIE_FAST_DATA_MASK = UCPTRIE_FAST_DATA_BLOCK_LENGTH - 1,
-
- /** @internal */
- UCPTRIE_SMALL_MAX = 0xfff,
-
- /**
- * Offset from dataLength (to be subtracted) for fetching the
- * value returned for out-of-range code points and ill-formed UTF-8/16.
- * @internal
- */
- UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET = 1,
- /**
- * Offset from dataLength (to be subtracted) for fetching the
- * value returned for code points highStart..U+10FFFF.
- * @internal
- */
- UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET = 2
-};
-
-/* Internal functions and macros -------------------------------------------- */
-// Do not conditionalize with #ifndef U_HIDE_INTERNAL_API, needed for public API
-
-/** @internal */
-U_INTERNAL int32_t U_EXPORT2
-ucptrie_internalSmallIndex(const UCPTrie *trie, UChar32 c);
-
-/** @internal */
-U_INTERNAL int32_t U_EXPORT2
-ucptrie_internalSmallU8Index(const UCPTrie *trie, int32_t lt1, uint8_t t2, uint8_t t3);
-
-/**
- * Internal function for part of the UCPTRIE_FAST_U8_PREVxx() macro implementations.
- * Do not call directly.
- * @internal
- */
-U_INTERNAL int32_t U_EXPORT2
-ucptrie_internalU8PrevIndex(const UCPTrie *trie, UChar32 c,
- const uint8_t *start, const uint8_t *src);
-
-/** Internal trie getter for a code point below the fast limit. Returns the data index. @internal */
-#define _UCPTRIE_FAST_INDEX(trie, c) \
- ((int32_t)(trie)->index[(c) >> UCPTRIE_FAST_SHIFT] + ((c) & UCPTRIE_FAST_DATA_MASK))
-
-/** Internal trie getter for a code point at or above the fast limit. Returns the data index. @internal */
-#define _UCPTRIE_SMALL_INDEX(trie, c) \
- ((c) >= (trie)->highStart ? \
- (trie)->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET : \
- ucptrie_internalSmallIndex(trie, c))
-
-/**
- * Internal trie getter for a code point, with checking that c is in U+0000..10FFFF.
- * Returns the data index.
- * @internal
- */
-#define _UCPTRIE_CP_INDEX(trie, fastMax, c) \
- ((uint32_t)(c) <= (uint32_t)(fastMax) ? \
- _UCPTRIE_FAST_INDEX(trie, c) : \
- (uint32_t)(c) <= 0x10ffff ? \
- _UCPTRIE_SMALL_INDEX(trie, c) : \
- (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET)
-
-U_CDECL_END
-
-#endif // U_IN_DOXYGEN
-
-#if U_SHOW_CPLUSPLUS_API
-
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUCPTriePointer
- * "Smart pointer" class, closes a UCPTrie via ucptrie_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 63
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUCPTriePointer, UCPTrie, ucptrie_close);
-
-U_NAMESPACE_END
-
-#endif // U_SHOW_CPLUSPLUS_API
-
-#endif
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// ucptrie.h (modified from utrie2.h)
+// created: 2017dec29 Markus W. Scherer
+
+#ifndef __UCPTRIE_H__
+#define __UCPTRIE_H__
+
+#include "unicode/utypes.h"
+
+#include "unicode/localpointer.h"
+#include "unicode/ucpmap.h"
+#include "unicode/utf8.h"
+
+U_CDECL_BEGIN
+
+/**
+ * \file
+ *
+ * This file defines an immutable Unicode code point trie.
+ *
+ * @see UCPTrie
+ * @see UMutableCPTrie
+ */
+
+#ifndef U_IN_DOXYGEN
+/** @internal */
+typedef union UCPTrieData {
+ /** @internal */
+ const void *ptr0;
+ /** @internal */
+ const uint16_t *ptr16;
+ /** @internal */
+ const uint32_t *ptr32;
+ /** @internal */
+ const uint8_t *ptr8;
+} UCPTrieData;
+#endif
+
+/**
+ * Immutable Unicode code point trie structure.
+ * Fast, reasonably compact, map from Unicode code points (U+0000..U+10FFFF) to integer values.
+ * For details see http://site.icu-project.org/design/struct/utrie
+ *
+ * Do not access UCPTrie fields directly; use public functions and macros.
+ * Functions are easy to use: They support all trie types and value widths.
+ *
+ * When performance is really important, macros provide faster access.
+ * Most macros are specific to either "fast" or "small" tries, see UCPTrieType.
+ * There are "fast" macros for special optimized use cases.
+ *
+ * The macros will return bogus values, or may crash, if used on the wrong type or value width.
+ *
+ * @see UMutableCPTrie
+ * @stable ICU 63
+ */
+struct UCPTrie {
+#ifndef U_IN_DOXYGEN
+ /** @internal */
+ const uint16_t *index;
+ /** @internal */
+ UCPTrieData data;
+
+ /** @internal */
+ int32_t indexLength;
+ /** @internal */
+ int32_t dataLength;
+ /** Start of the last range which ends at U+10FFFF. @internal */
+ UChar32 highStart;
+ /** highStart>>12 @internal */
+ uint16_t shifted12HighStart;
+
+ /** @internal */
+ int8_t type; // UCPTrieType
+ /** @internal */
+ int8_t valueWidth; // UCPTrieValueWidth
+
+ /** padding/reserved @internal */
+ uint32_t reserved32;
+ /** padding/reserved @internal */
+ uint16_t reserved16;
+
+ /**
+ * Internal index-3 null block offset.
+ * Set to an impossibly high value (e.g., 0xffff) if there is no dedicated index-3 null block.
+ * @internal
+ */
+ uint16_t index3NullOffset;
+ /**
+ * Internal data null block offset, not shifted.
+ * Set to an impossibly high value (e.g., 0xfffff) if there is no dedicated data null block.
+ * @internal
+ */
+ int32_t dataNullOffset;
+ /** @internal */
+ uint32_t nullValue;
+
+#ifdef UCPTRIE_DEBUG
+ /** @internal */
+ const char *name;
+#endif
+#endif
+};
+#ifndef U_IN_DOXYGEN
+typedef struct UCPTrie UCPTrie;
+#endif
+
+/**
+ * Selectors for the type of a UCPTrie.
+ * Different trade-offs for size vs. speed.
+ *
+ * @see umutablecptrie_buildImmutable
+ * @see ucptrie_openFromBinary
+ * @see ucptrie_getType
+ * @stable ICU 63
+ */
+enum UCPTrieType {
+ /**
+ * For ucptrie_openFromBinary() to accept any type.
+ * ucptrie_getType() will return the actual type.
+ * @stable ICU 63
+ */
+ UCPTRIE_TYPE_ANY = -1,
+ /**
+ * Fast/simple/larger BMP data structure. Use functions and "fast" macros.
+ * @stable ICU 63
+ */
+ UCPTRIE_TYPE_FAST,
+ /**
+ * Small/slower BMP data structure. Use functions and "small" macros.
+ * @stable ICU 63
+ */
+ UCPTRIE_TYPE_SMALL
+};
+#ifndef U_IN_DOXYGEN
+typedef enum UCPTrieType UCPTrieType;
+#endif
+
+/**
+ * Selectors for the number of bits in a UCPTrie data value.
+ *
+ * @see umutablecptrie_buildImmutable
+ * @see ucptrie_openFromBinary
+ * @see ucptrie_getValueWidth
+ * @stable ICU 63
+ */
+enum UCPTrieValueWidth {
+ /**
+ * For ucptrie_openFromBinary() to accept any data value width.
+ * ucptrie_getValueWidth() will return the actual data value width.
+ * @stable ICU 63
+ */
+ UCPTRIE_VALUE_BITS_ANY = -1,
+ /**
+ * The trie stores 16 bits per data value.
+ * It returns them as unsigned values 0..0xffff=65535.
+ * @stable ICU 63
+ */
+ UCPTRIE_VALUE_BITS_16,
+ /**
+ * The trie stores 32 bits per data value.
+ * @stable ICU 63
+ */
+ UCPTRIE_VALUE_BITS_32,
+ /**
+ * The trie stores 8 bits per data value.
+ * It returns them as unsigned values 0..0xff=255.
+ * @stable ICU 63
+ */
+ UCPTRIE_VALUE_BITS_8
+};
+#ifndef U_IN_DOXYGEN
+typedef enum UCPTrieValueWidth UCPTrieValueWidth;
+#endif
+
+/**
+ * Opens a trie from its binary form, stored in 32-bit-aligned memory.
+ * Inverse of ucptrie_toBinary().
+ *
+ * The memory must remain valid and unchanged as long as the trie is used.
+ * You must ucptrie_close() the trie once you are done using it.
+ *
+ * @param type selects the trie type; results in an
+ * U_INVALID_FORMAT_ERROR if it does not match the binary data;
+ * use UCPTRIE_TYPE_ANY to accept any type
+ * @param valueWidth selects the number of bits in a data value; results in an
+ * U_INVALID_FORMAT_ERROR if it does not match the binary data;
+ * use UCPTRIE_VALUE_BITS_ANY to accept any data value width
+ * @param data a pointer to 32-bit-aligned memory containing the binary data of a UCPTrie
+ * @param length the number of bytes available at data;
+ * can be more than necessary
+ * @param pActualLength receives the actual number of bytes at data taken up by the trie data;
+ * can be NULL
+ * @param pErrorCode an in/out ICU UErrorCode
+ * @return the trie
+ *
+ * @see umutablecptrie_open
+ * @see umutablecptrie_buildImmutable
+ * @see ucptrie_toBinary
+ * @stable ICU 63
+ */
+U_CAPI UCPTrie * U_EXPORT2
+ucptrie_openFromBinary(UCPTrieType type, UCPTrieValueWidth valueWidth,
+ const void *data, int32_t length, int32_t *pActualLength,
+ UErrorCode *pErrorCode);
+
+/**
+ * Closes a trie and releases associated memory.
+ *
+ * @param trie the trie
+ * @stable ICU 63
+ */
+U_CAPI void U_EXPORT2
+ucptrie_close(UCPTrie *trie);
+
+/**
+ * Returns the trie type.
+ *
+ * @param trie the trie
+ * @return the trie type
+ * @see ucptrie_openFromBinary
+ * @see UCPTRIE_TYPE_ANY
+ * @stable ICU 63
+ */
+U_CAPI UCPTrieType U_EXPORT2
+ucptrie_getType(const UCPTrie *trie);
+
+/**
+ * Returns the number of bits in a trie data value.
+ *
+ * @param trie the trie
+ * @return the number of bits in a trie data value
+ * @see ucptrie_openFromBinary
+ * @see UCPTRIE_VALUE_BITS_ANY
+ * @stable ICU 63
+ */
+U_CAPI UCPTrieValueWidth U_EXPORT2
+ucptrie_getValueWidth(const UCPTrie *trie);
+
+/**
+ * Returns the value for a code point as stored in the trie, with range checking.
+ * Returns the trie error value if c is not in the range 0..U+10FFFF.
+ *
+ * Easier to use than UCPTRIE_FAST_GET() and similar macros but slower.
+ * Easier to use because, unlike the macros, this function works on all UCPTrie
+ * objects, for all types and value widths.
+ *
+ * @param trie the trie
+ * @param c the code point
+ * @return the trie value,
+ * or the trie error value if the code point is not in the range 0..U+10FFFF
+ * @stable ICU 63
+ */
+U_CAPI uint32_t U_EXPORT2
+ucptrie_get(const UCPTrie *trie, UChar32 c);
+
+/**
+ * Returns the last code point such that all those from start to there have the same value.
+ * Can be used to efficiently iterate over all same-value ranges in a trie.
+ * (This is normally faster than iterating over code points and get()ting each value,
+ * but much slower than a data structure that stores ranges directly.)
+ *
+ * If the UCPMapValueFilter function pointer is not NULL, then
+ * the value to be delivered is passed through that function, and the return value is the end
+ * of the range where all values are modified to the same actual value.
+ * The value is unchanged if that function pointer is NULL.
+ *
+ * Example:
+ * \code
+ * UChar32 start = 0, end;
+ * uint32_t value;
+ * while ((end = ucptrie_getRange(trie, start, UCPMAP_RANGE_NORMAL, 0,
+ * NULL, NULL, &value)) >= 0) {
+ * // Work with the range start..end and its value.
+ * start = end + 1;
+ * }
+ * \endcode
+ *
+ * @param trie the trie
+ * @param start range start
+ * @param option defines whether surrogates are treated normally,
+ * or as having the surrogateValue; usually UCPMAP_RANGE_NORMAL
+ * @param surrogateValue value for surrogates; ignored if option==UCPMAP_RANGE_NORMAL
+ * @param filter a pointer to a function that may modify the trie data value,
+ * or NULL if the values from the trie are to be used unmodified
+ * @param context an opaque pointer that is passed on to the filter function
+ * @param pValue if not NULL, receives the value that every code point start..end has;
+ * may have been modified by filter(context, trie value)
+ * if that function pointer is not NULL
+ * @return the range end code point, or -1 if start is not a valid code point
+ * @stable ICU 63
+ */
+U_CAPI UChar32 U_EXPORT2
+ucptrie_getRange(const UCPTrie *trie, UChar32 start,
+ UCPMapRangeOption option, uint32_t surrogateValue,
+ UCPMapValueFilter *filter, const void *context, uint32_t *pValue);
+
+/**
+ * Writes a memory-mappable form of the trie into 32-bit aligned memory.
+ * Inverse of ucptrie_openFromBinary().
+ *
+ * @param trie the trie
+ * @param data a pointer to 32-bit-aligned memory to be filled with the trie data;
+ * can be NULL if capacity==0
+ * @param capacity the number of bytes available at data, or 0 for pure preflighting
+ * @param pErrorCode an in/out ICU UErrorCode;
+ * U_BUFFER_OVERFLOW_ERROR if the capacity is too small
+ * @return the number of bytes written or (if buffer overflow) needed for the trie
+ *
+ * @see ucptrie_openFromBinary()
+ * @stable ICU 63
+ */
+U_CAPI int32_t U_EXPORT2
+ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *pErrorCode);
+
+/**
+ * Macro parameter value for a trie with 16-bit data values.
+ * Use the name of this macro as a "dataAccess" parameter in other macros.
+ * Do not use this macro in any other way.
+ *
+ * @see UCPTRIE_VALUE_BITS_16
+ * @stable ICU 63
+ */
+#define UCPTRIE_16(trie, i) ((trie)->data.ptr16[i])
+
+/**
+ * Macro parameter value for a trie with 32-bit data values.
+ * Use the name of this macro as a "dataAccess" parameter in other macros.
+ * Do not use this macro in any other way.
+ *
+ * @see UCPTRIE_VALUE_BITS_32
+ * @stable ICU 63
+ */
+#define UCPTRIE_32(trie, i) ((trie)->data.ptr32[i])
+
+/**
+ * Macro parameter value for a trie with 8-bit data values.
+ * Use the name of this macro as a "dataAccess" parameter in other macros.
+ * Do not use this macro in any other way.
+ *
+ * @see UCPTRIE_VALUE_BITS_8
+ * @stable ICU 63
+ */
+#define UCPTRIE_8(trie, i) ((trie)->data.ptr8[i])
+
+/**
+ * Returns a trie value for a code point, with range checking.
+ * Returns the trie error value if c is not in the range 0..U+10FFFF.
+ *
+ * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST
+ * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
+ * @param c (UChar32, in) the input code point
+ * @return The code point's trie value.
+ * @stable ICU 63
+ */
+#define UCPTRIE_FAST_GET(trie, dataAccess, c) dataAccess(trie, _UCPTRIE_CP_INDEX(trie, 0xffff, c))
+
+/**
+ * Returns a 16-bit trie value for a code point, with range checking.
+ * Returns the trie error value if c is not in the range U+0000..U+10FFFF.
+ *
+ * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_SMALL
+ * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
+ * @param c (UChar32, in) the input code point
+ * @return The code point's trie value.
+ * @stable ICU 63
+ */
+#define UCPTRIE_SMALL_GET(trie, dataAccess, c) \
+ dataAccess(trie, _UCPTRIE_CP_INDEX(trie, UCPTRIE_SMALL_MAX, c))
+
+/**
+ * UTF-16: Reads the next code point (UChar32 c, out), post-increments src,
+ * and gets a value from the trie.
+ * Sets the trie error value if c is an unpaired surrogate.
+ *
+ * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST
+ * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
+ * @param src (const UChar *, in/out) the source text pointer
+ * @param limit (const UChar *, in) the limit pointer for the text, or NULL if NUL-terminated
+ * @param c (UChar32, out) variable for the code point
+ * @param result (out) variable for the trie lookup result
+ * @stable ICU 63
+ */
+#define UCPTRIE_FAST_U16_NEXT(trie, dataAccess, src, limit, c, result) UPRV_BLOCK_MACRO_BEGIN { \
+ (c) = *(src)++; \
+ int32_t __index; \
+ if (!U16_IS_SURROGATE(c)) { \
+ __index = _UCPTRIE_FAST_INDEX(trie, c); \
+ } else { \
+ uint16_t __c2; \
+ if (U16_IS_SURROGATE_LEAD(c) && (src) != (limit) && U16_IS_TRAIL(__c2 = *(src))) { \
+ ++(src); \
+ (c) = U16_GET_SUPPLEMENTARY((c), __c2); \
+ __index = _UCPTRIE_SMALL_INDEX(trie, c); \
+ } else { \
+ __index = (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET; \
+ } \
+ } \
+ (result) = dataAccess(trie, __index); \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * UTF-16: Reads the previous code point (UChar32 c, out), pre-decrements src,
+ * and gets a value from the trie.
+ * Sets the trie error value if c is an unpaired surrogate.
+ *
+ * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST
+ * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
+ * @param start (const UChar *, in) the start pointer for the text
+ * @param src (const UChar *, in/out) the source text pointer
+ * @param c (UChar32, out) variable for the code point
+ * @param result (out) variable for the trie lookup result
+ * @stable ICU 63
+ */
+#define UCPTRIE_FAST_U16_PREV(trie, dataAccess, start, src, c, result) UPRV_BLOCK_MACRO_BEGIN { \
+ (c) = *--(src); \
+ int32_t __index; \
+ if (!U16_IS_SURROGATE(c)) { \
+ __index = _UCPTRIE_FAST_INDEX(trie, c); \
+ } else { \
+ uint16_t __c2; \
+ if (U16_IS_SURROGATE_TRAIL(c) && (src) != (start) && U16_IS_LEAD(__c2 = *((src) - 1))) { \
+ --(src); \
+ (c) = U16_GET_SUPPLEMENTARY(__c2, (c)); \
+ __index = _UCPTRIE_SMALL_INDEX(trie, c); \
+ } else { \
+ __index = (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET; \
+ } \
+ } \
+ (result) = dataAccess(trie, __index); \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * UTF-8: Post-increments src and gets a value from the trie.
+ * Sets the trie error value for an ill-formed byte sequence.
+ *
+ * Unlike UCPTRIE_FAST_U16_NEXT() this UTF-8 macro does not provide the code point
+ * because it would be more work to do so and is often not needed.
+ * If the trie value differs from the error value, then the byte sequence is well-formed,
+ * and the code point can be assembled without revalidation.
+ *
+ * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST
+ * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
+ * @param src (const char *, in/out) the source text pointer
+ * @param limit (const char *, in) the limit pointer for the text (must not be NULL)
+ * @param result (out) variable for the trie lookup result
+ * @stable ICU 63
+ */
+#define UCPTRIE_FAST_U8_NEXT(trie, dataAccess, src, limit, result) UPRV_BLOCK_MACRO_BEGIN { \
+ int32_t __lead = (uint8_t)*(src)++; \
+ if (!U8_IS_SINGLE(__lead)) { \
+ uint8_t __t1, __t2, __t3; \
+ if ((src) != (limit) && \
+ (__lead >= 0xe0 ? \
+ __lead < 0xf0 ? /* U+0800..U+FFFF except surrogates */ \
+ U8_LEAD3_T1_BITS[__lead &= 0xf] & (1 << ((__t1 = *(src)) >> 5)) && \
+ ++(src) != (limit) && (__t2 = *(src) - 0x80) <= 0x3f && \
+ (__lead = ((int32_t)(trie)->index[(__lead << 6) + (__t1 & 0x3f)]) + __t2, 1) \
+ : /* U+10000..U+10FFFF */ \
+ (__lead -= 0xf0) <= 4 && \
+ U8_LEAD4_T1_BITS[(__t1 = *(src)) >> 4] & (1 << __lead) && \
+ (__lead = (__lead << 6) | (__t1 & 0x3f), ++(src) != (limit)) && \
+ (__t2 = *(src) - 0x80) <= 0x3f && \
+ ++(src) != (limit) && (__t3 = *(src) - 0x80) <= 0x3f && \
+ (__lead = __lead >= (trie)->shifted12HighStart ? \
+ (trie)->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET : \
+ ucptrie_internalSmallU8Index((trie), __lead, __t2, __t3), 1) \
+ : /* U+0080..U+07FF */ \
+ __lead >= 0xc2 && (__t1 = *(src) - 0x80) <= 0x3f && \
+ (__lead = (int32_t)(trie)->index[__lead & 0x1f] + __t1, 1))) { \
+ ++(src); \
+ } else { \
+ __lead = (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET; /* ill-formed*/ \
+ } \
+ } \
+ (result) = dataAccess(trie, __lead); \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * UTF-8: Pre-decrements src and gets a value from the trie.
+ * Sets the trie error value for an ill-formed byte sequence.
+ *
+ * Unlike UCPTRIE_FAST_U16_PREV() this UTF-8 macro does not provide the code point
+ * because it would be more work to do so and is often not needed.
+ * If the trie value differs from the error value, then the byte sequence is well-formed,
+ * and the code point can be assembled without revalidation.
+ *
+ * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST
+ * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
+ * @param start (const char *, in) the start pointer for the text
+ * @param src (const char *, in/out) the source text pointer
+ * @param result (out) variable for the trie lookup result
+ * @stable ICU 63
+ */
+#define UCPTRIE_FAST_U8_PREV(trie, dataAccess, start, src, result) UPRV_BLOCK_MACRO_BEGIN { \
+ int32_t __index = (uint8_t)*--(src); \
+ if (!U8_IS_SINGLE(__index)) { \
+ __index = ucptrie_internalU8PrevIndex((trie), __index, (const uint8_t *)(start), \
+ (const uint8_t *)(src)); \
+ (src) -= __index & 7; \
+ __index >>= 3; \
+ } \
+ (result) = dataAccess(trie, __index); \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Returns a trie value for an ASCII code point, without range checking.
+ *
+ * @param trie (const UCPTrie *, in) the trie (of either fast or small type)
+ * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
+ * @param c (UChar32, in) the input code point; must be U+0000..U+007F
+ * @return The ASCII code point's trie value.
+ * @stable ICU 63
+ */
+#define UCPTRIE_ASCII_GET(trie, dataAccess, c) dataAccess(trie, c)
+
+/**
+ * Returns a trie value for a BMP code point (U+0000..U+FFFF), without range checking.
+ * Can be used to look up a value for a UTF-16 code unit if other parts of
+ * the string processing check for surrogates.
+ *
+ * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST
+ * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
+ * @param c (UChar32, in) the input code point, must be U+0000..U+FFFF
+ * @return The BMP code point's trie value.
+ * @stable ICU 63
+ */
+#define UCPTRIE_FAST_BMP_GET(trie, dataAccess, c) dataAccess(trie, _UCPTRIE_FAST_INDEX(trie, c))
+
+/**
+ * Returns a trie value for a supplementary code point (U+10000..U+10FFFF),
+ * without range checking.
+ *
+ * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST
+ * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
+ * @param c (UChar32, in) the input code point, must be U+10000..U+10FFFF
+ * @return The supplementary code point's trie value.
+ * @stable ICU 63
+ */
+#define UCPTRIE_FAST_SUPP_GET(trie, dataAccess, c) dataAccess(trie, _UCPTRIE_SMALL_INDEX(trie, c))
+
+/* Internal definitions ----------------------------------------------------- */
+
+#ifndef U_IN_DOXYGEN
+
+/**
+ * Internal implementation constants.
+ * These are needed for the API macros, but users should not use these directly.
+ * @internal
+ */
+enum {
+ /** @internal */
+ UCPTRIE_FAST_SHIFT = 6,
+
+ /** Number of entries in a data block for code points below the fast limit. 64=0x40 @internal */
+ UCPTRIE_FAST_DATA_BLOCK_LENGTH = 1 << UCPTRIE_FAST_SHIFT,
+
+ /** Mask for getting the lower bits for the in-fast-data-block offset. @internal */
+ UCPTRIE_FAST_DATA_MASK = UCPTRIE_FAST_DATA_BLOCK_LENGTH - 1,
+
+ /** @internal */
+ UCPTRIE_SMALL_MAX = 0xfff,
+
+ /**
+ * Offset from dataLength (to be subtracted) for fetching the
+ * value returned for out-of-range code points and ill-formed UTF-8/16.
+ * @internal
+ */
+ UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET = 1,
+ /**
+ * Offset from dataLength (to be subtracted) for fetching the
+ * value returned for code points highStart..U+10FFFF.
+ * @internal
+ */
+ UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET = 2
+};
+
+/* Internal functions and macros -------------------------------------------- */
+// Do not conditionalize with #ifndef U_HIDE_INTERNAL_API, needed for public API
+
+/** @internal */
+U_INTERNAL int32_t U_EXPORT2
+ucptrie_internalSmallIndex(const UCPTrie *trie, UChar32 c);
+
+/** @internal */
+U_INTERNAL int32_t U_EXPORT2
+ucptrie_internalSmallU8Index(const UCPTrie *trie, int32_t lt1, uint8_t t2, uint8_t t3);
+
+/**
+ * Internal function for part of the UCPTRIE_FAST_U8_PREVxx() macro implementations.
+ * Do not call directly.
+ * @internal
+ */
+U_INTERNAL int32_t U_EXPORT2
+ucptrie_internalU8PrevIndex(const UCPTrie *trie, UChar32 c,
+ const uint8_t *start, const uint8_t *src);
+
+/** Internal trie getter for a code point below the fast limit. Returns the data index. @internal */
+#define _UCPTRIE_FAST_INDEX(trie, c) \
+ ((int32_t)(trie)->index[(c) >> UCPTRIE_FAST_SHIFT] + ((c) & UCPTRIE_FAST_DATA_MASK))
+
+/** Internal trie getter for a code point at or above the fast limit. Returns the data index. @internal */
+#define _UCPTRIE_SMALL_INDEX(trie, c) \
+ ((c) >= (trie)->highStart ? \
+ (trie)->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET : \
+ ucptrie_internalSmallIndex(trie, c))
+
+/**
+ * Internal trie getter for a code point, with checking that c is in U+0000..10FFFF.
+ * Returns the data index.
+ * @internal
+ */
+#define _UCPTRIE_CP_INDEX(trie, fastMax, c) \
+ ((uint32_t)(c) <= (uint32_t)(fastMax) ? \
+ _UCPTRIE_FAST_INDEX(trie, c) : \
+ (uint32_t)(c) <= 0x10ffff ? \
+ _UCPTRIE_SMALL_INDEX(trie, c) : \
+ (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET)
+
+U_CDECL_END
+
+#endif // U_IN_DOXYGEN
+
+#if U_SHOW_CPLUSPLUS_API
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \class LocalUCPTriePointer
+ * "Smart pointer" class, closes a UCPTrie via ucptrie_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 63
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUCPTriePointer, UCPTrie, ucptrie_close);
+
+U_NAMESPACE_END
+
+#endif // U_SHOW_CPLUSPLUS_API
+
+#endif
diff --git a/contrib/libs/icu/include/unicode/ucsdet.h b/contrib/libs/icu/include/unicode/ucsdet.h
index b9e91daf20..52ed5ad0ee 100644
--- a/contrib/libs/icu/include/unicode/ucsdet.h
+++ b/contrib/libs/icu/include/unicode/ucsdet.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: ucsdet.h
- * encoding: UTF-8
+ * encoding: UTF-8
* indentation:4
*
* created on: 2005Aug04
@@ -45,10 +45,10 @@
* in a single language, and a minimum of a few hundred bytes worth of plain text
* in the language are needed. The detection process will attempt to
* ignore html or xml style markup that could otherwise obscure the content.
- * <p>
- * An alternative to the ICU Charset Detector is the
- * Compact Encoding Detector, https://github.com/google/compact_enc_det.
- * It often gives more accurate results, especially with short input samples.
+ * <p>
+ * An alternative to the ICU Charset Detector is the
+ * Compact Encoding Detector, https://github.com/google/compact_enc_det.
+ * It often gives more accurate results, especially with short input samples.
*/
@@ -399,7 +399,7 @@ ucsdet_getDetectableCharsets(const UCharsetDetector *ucsd, UErrorCode *status);
/**
* Enable or disable individual charset encoding.
* A name of charset encoding must be included in the names returned by
- * {@link #ucsdet_getAllDetectableCharsets()}.
+ * {@link #ucsdet_getAllDetectableCharsets()}.
*
* @param ucsd a Charset detector.
* @param encoding encoding the name of charset encoding.
diff --git a/contrib/libs/icu/include/unicode/ucurr.h b/contrib/libs/icu/include/unicode/ucurr.h
index b06407c785..f91cc0df7c 100644
--- a/contrib/libs/icu/include/unicode/ucurr.h
+++ b/contrib/libs/icu/include/unicode/ucurr.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -60,7 +60,7 @@ enum UCurrencyUsage {
UCURR_USAGE_COUNT=2
#endif // U_HIDE_DEPRECATED_API
};
-/** Currency Usage used for Decimal Format */
+/** Currency Usage used for Decimal Format */
typedef enum UCurrencyUsage UCurrencyUsage;
/**
@@ -103,17 +103,17 @@ typedef enum UCurrNameStyle {
* currency, such as "US Dollar" for USD.
* @stable ICU 2.6
*/
- UCURR_LONG_NAME,
-
- /**
- * Selector for getName() indicating the narrow currency symbol.
- * The narrow currency symbol is similar to the regular currency
- * symbol, but it always takes the shortest form: for example,
- * "$" instead of "US$" for USD in en-CA.
- *
- * @stable ICU 61
- */
- UCURR_NARROW_SYMBOL_NAME
+ UCURR_LONG_NAME,
+
+ /**
+ * Selector for getName() indicating the narrow currency symbol.
+ * The narrow currency symbol is similar to the regular currency
+ * symbol, but it always takes the shortest form: for example,
+ * "$" instead of "US$" for USD in en-CA.
+ *
+ * @stable ICU 61
+ */
+ UCURR_NARROW_SYMBOL_NAME
} UCurrNameStyle;
#if !UCONFIG_NO_SERVICE
@@ -159,14 +159,14 @@ ucurr_unregister(UCurrRegistryKey key, UErrorCode* status);
* @param currency null-terminated 3-letter ISO 4217 code
* @param locale locale in which to display currency
* @param nameStyle selector for which kind of name to return
- * @param isChoiceFormat always set to FALSE, or can be NULL;
- * display names are static strings;
- * since ICU 4.4, ChoiceFormat patterns are no longer supported
+ * @param isChoiceFormat always set to FALSE, or can be NULL;
+ * display names are static strings;
+ * since ICU 4.4, ChoiceFormat patterns are no longer supported
* @param len fill-in parameter to receive length of result
* @param ec error code
* @return pointer to display string of 'len' UChars. If the resource
* data contains no entry for 'currency', then 'currency' itself is
- * returned.
+ * returned.
* @stable ICU 2.6
*/
U_STABLE const UChar* U_EXPORT2
@@ -183,15 +183,15 @@ ucurr_getName(const UChar* currency,
* currency object in the en_US locale is "US dollar" or "US dollars".
* @param currency null-terminated 3-letter ISO 4217 code
* @param locale locale in which to display currency
- * @param isChoiceFormat always set to FALSE, or can be NULL;
- * display names are static strings;
- * since ICU 4.4, ChoiceFormat patterns are no longer supported
+ * @param isChoiceFormat always set to FALSE, or can be NULL;
+ * display names are static strings;
+ * since ICU 4.4, ChoiceFormat patterns are no longer supported
* @param pluralCount plural count
* @param len fill-in parameter to receive length of result
* @param ec error code
* @return pointer to display string of 'len' UChars. If the resource
* data contains no entry for 'currency', then 'currency' itself is
- * returned.
+ * returned.
* @stable ICU 4.2
*/
U_STABLE const UChar* U_EXPORT2
@@ -206,13 +206,13 @@ ucurr_getPluralName(const UChar* currency,
* Returns the number of the number of fraction digits that should
* be displayed for the given currency.
* This is equivalent to ucurr_getDefaultFractionDigitsForUsage(currency,UCURR_USAGE_STANDARD,ec);
- *
- * Important: The number of fraction digits for a given currency is NOT
- * guaranteed to be constant across versions of ICU or CLDR. For example,
- * do NOT use this value as a mechanism for deciding the magnitude used
- * to store currency values in a database. You should use this value for
- * display purposes only.
- *
+ *
+ * Important: The number of fraction digits for a given currency is NOT
+ * guaranteed to be constant across versions of ICU or CLDR. For example,
+ * do NOT use this value as a mechanism for deciding the magnitude used
+ * to store currency values in a database. You should use this value for
+ * display purposes only.
+ *
* @param currency null-terminated 3-letter ISO 4217 code
* @param ec input-output error code
* @return a non-negative number of fraction digits to be
@@ -226,13 +226,13 @@ ucurr_getDefaultFractionDigits(const UChar* currency,
/**
* Returns the number of the number of fraction digits that should
* be displayed for the given currency with usage.
- *
- * Important: The number of fraction digits for a given currency is NOT
- * guaranteed to be constant across versions of ICU or CLDR. For example,
- * do NOT use this value as a mechanism for deciding the magnitude used
- * to store currency values in a database. You should use this value for
- * display purposes only.
- *
+ *
+ * Important: The number of fraction digits for a given currency is NOT
+ * guaranteed to be constant across versions of ICU or CLDR. For example,
+ * do NOT use this value as a mechanism for deciding the magnitude used
+ * to store currency values in a database. You should use this value for
+ * display purposes only.
+ *
* @param currency null-terminated 3-letter ISO 4217 code
* @param usage enum usage for the currency
* @param ec input-output error code
@@ -321,7 +321,7 @@ typedef enum UCurrCurrencyType {
* Provides a UEnumeration object for listing ISO-4217 codes.
* @param currType You can use one of several UCurrCurrencyType values for this
* variable. You can also | (or) them together to get a specific list of
- * currencies. Most people will want to use the (UCURR_COMMON|UCURR_NON_DEPRECATED) value to
+ * currencies. Most people will want to use the (UCURR_COMMON|UCURR_NON_DEPRECATED) value to
* get a list of current currencies.
* @param pErrorCode Error code
* @stable ICU 3.2
diff --git a/contrib/libs/icu/include/unicode/udat.h b/contrib/libs/icu/include/unicode/udat.h
index 334817f160..cf7a165e70 100644
--- a/contrib/libs/icu/include/unicode/udat.h
+++ b/contrib/libs/icu/include/unicode/udat.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -482,28 +482,28 @@ typedef enum UDateFormatStyle {
#define UDAT_HOUR_TZ "jz"
#endif /* U_HIDE_DEPRECATED_API */
-#ifndef U_HIDE_INTERNAL_API
-/**
- * Constant for Unicode string name of new (in 2019) Japanese calendar era,
- * root/English abbreviated version (ASCII-range characters).
- * @internal
- */
-#define JP_ERA_2019_ROOT "Reiwa"
-/**
- * Constant for Unicode string name of new (in 2019) Japanese calendar era,
- * Japanese abbreviated version (Han, or fullwidth Latin for testing).
- * @internal
- */
-#define JP_ERA_2019_JA "\\u4EE4\\u548C"
-/**
- * Constant for Unicode string name of new (in 2019) Japanese calendar era,
- * root and Japanese narrow version (ASCII-range characters).
- * @internal
- */
-#define JP_ERA_2019_NARROW "R"
-#endif // U_HIDE_INTERNAL_API
-
-/**
+#ifndef U_HIDE_INTERNAL_API
+/**
+ * Constant for Unicode string name of new (in 2019) Japanese calendar era,
+ * root/English abbreviated version (ASCII-range characters).
+ * @internal
+ */
+#define JP_ERA_2019_ROOT "Reiwa"
+/**
+ * Constant for Unicode string name of new (in 2019) Japanese calendar era,
+ * Japanese abbreviated version (Han, or fullwidth Latin for testing).
+ * @internal
+ */
+#define JP_ERA_2019_JA "\\u4EE4\\u548C"
+/**
+ * Constant for Unicode string name of new (in 2019) Japanese calendar era,
+ * root and Japanese narrow version (ASCII-range characters).
+ * @internal
+ */
+#define JP_ERA_2019_NARROW "R"
+#endif // U_HIDE_INTERNAL_API
+
+/**
* FieldPosition and UFieldPosition selectors for format fields
* defined by DateFormat and UDateFormat.
* @stable ICU 3.0
@@ -788,13 +788,13 @@ typedef enum UDateFormatField {
* FieldPosition selector for 'b' field alignment.
* Displays midnight and noon for 12am and 12pm, respectively, if available;
* otherwise fall back to AM / PM.
- * @stable ICU 57
+ * @stable ICU 57
*/
UDAT_AM_PM_MIDNIGHT_NOON_FIELD = 35,
/* FieldPosition selector for 'B' field alignment.
* Displays flexible day periods, such as "in the morning", if available.
- * @stable ICU 57
+ * @stable ICU 57
*/
UDAT_FLEXIBLE_DAY_PERIOD_FIELD = 36,
@@ -816,7 +816,7 @@ typedef enum UDateFormatField {
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
UDAT_FIELD_COUNT = 38
-#endif /* U_HIDE_DEPRECATED_API */
+#endif /* U_HIDE_DEPRECATED_API */
} UDateFormatField;
@@ -838,7 +838,7 @@ typedef enum UDateFormatField {
* of error (e.g., the input field is UDAT_FIELD_COUNT).
* @stable ICU 4.4
*/
-U_CAPI UCalendarDateFields U_EXPORT2
+U_CAPI UCalendarDateFields U_EXPORT2
udat_toCalendarDateField(UDateFormatField field);
@@ -870,7 +870,7 @@ udat_toCalendarDateField(UDateFormatField field);
* an error occurred.
* @stable ICU 2.0
*/
-U_CAPI UDateFormat* U_EXPORT2
+U_CAPI UDateFormat* U_EXPORT2
udat_open(UDateFormatStyle timeStyle,
UDateFormatStyle dateStyle,
const char *locale,
@@ -887,7 +887,7 @@ udat_open(UDateFormatStyle timeStyle,
* @param format The formatter to close.
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_CAPI void U_EXPORT2
udat_close(UDateFormat* format);
@@ -921,15 +921,15 @@ typedef enum UDateFormatBooleanAttribute {
*/
UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH = 3,
- /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
- * it is needed for layout of DateFormat object. */
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+ /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
+ * it is needed for layout of DateFormat object. */
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* One more than the highest normal UDateFormatBooleanAttribute value.
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
UDAT_BOOLEAN_ATTRIBUTE_COUNT = 4
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
} UDateFormatBooleanAttribute;
/**
@@ -942,7 +942,7 @@ typedef enum UDateFormatBooleanAttribute {
* @return The value of attr.
* @stable ICU 53
*/
-U_CAPI UBool U_EXPORT2
+U_CAPI UBool U_EXPORT2
udat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute attr, UErrorCode* status);
/**
@@ -955,41 +955,41 @@ udat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute att
* @param status A pointer to an UErrorCode to receive any errors
* @stable ICU 53
*/
-U_CAPI void U_EXPORT2
+U_CAPI void U_EXPORT2
udat_setBooleanAttribute(UDateFormat *fmt, UDateFormatBooleanAttribute attr, UBool newValue, UErrorCode* status);
-#ifndef U_HIDE_DRAFT_API
-/**
- * Hour Cycle.
- * @draft ICU 67
- */
-typedef enum UDateFormatHourCycle {
- /**
- * Hour in am/pm (0~11)
- * @draft ICU 67
- */
- UDAT_HOUR_CYCLE_11,
-
- /**
- * Hour in am/pm (1~12)
- * @draft ICU 67
- */
- UDAT_HOUR_CYCLE_12,
-
- /**
- * Hour in day (0~23)
- * @draft ICU 67
- */
- UDAT_HOUR_CYCLE_23,
-
- /**
- * Hour in day (1~24)
- * @draft ICU 67
- */
- UDAT_HOUR_CYCLE_24
-} UDateFormatHourCycle;
-#endif /* U_HIDE_DRAFT_API */
-
+#ifndef U_HIDE_DRAFT_API
+/**
+ * Hour Cycle.
+ * @draft ICU 67
+ */
+typedef enum UDateFormatHourCycle {
+ /**
+ * Hour in am/pm (0~11)
+ * @draft ICU 67
+ */
+ UDAT_HOUR_CYCLE_11,
+
+ /**
+ * Hour in am/pm (1~12)
+ * @draft ICU 67
+ */
+ UDAT_HOUR_CYCLE_12,
+
+ /**
+ * Hour in day (0~23)
+ * @draft ICU 67
+ */
+ UDAT_HOUR_CYCLE_23,
+
+ /**
+ * Hour in day (1~24)
+ * @draft ICU 67
+ */
+ UDAT_HOUR_CYCLE_24
+} UDateFormatHourCycle;
+#endif /* U_HIDE_DRAFT_API */
+
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
@@ -1017,7 +1017,7 @@ U_NAMESPACE_END
* @return A pointer to a UDateFormat identical to fmt.
* @stable ICU 2.0
*/
-U_CAPI UDateFormat* U_EXPORT2
+U_CAPI UDateFormat* U_EXPORT2
udat_clone(const UDateFormat *fmt,
UErrorCode *status);
@@ -1039,7 +1039,7 @@ udat_clone(const UDateFormat *fmt,
* @see UFieldPosition
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
udat_format( const UDateFormat* format,
UDate dateToFormat,
UChar* result,
@@ -1069,7 +1069,7 @@ udat_format( const UDateFormat* format,
* @see UFieldPosition
* @stable ICU 55
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
udat_formatCalendar( const UDateFormat* format,
UCalendar* calendar,
UChar* result,
@@ -1104,7 +1104,7 @@ udat_formatCalendar( const UDateFormat* format,
* @see UFieldPositionIterator
* @stable ICU 55
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
udat_formatForFields( const UDateFormat* format,
UDate dateToFormat,
UChar* result,
@@ -1142,7 +1142,7 @@ udat_formatForFields( const UDateFormat* format,
* @see UFieldPositionIterator
* @stable ICU 55
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
udat_formatCalendarForFields( const UDateFormat* format,
UCalendar* calendar,
UChar* result,
@@ -1176,7 +1176,7 @@ udat_formatCalendarForFields( const UDateFormat* format,
* @see udat_format
* @stable ICU 2.0
*/
-U_CAPI UDate U_EXPORT2
+U_CAPI UDate U_EXPORT2
udat_parse(const UDateFormat* format,
const UChar* text,
int32_t textLength,
@@ -1204,7 +1204,7 @@ udat_parse(const UDateFormat* format,
* @see udat_format
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_CAPI void U_EXPORT2
udat_parseCalendar(const UDateFormat* format,
UCalendar* calendar,
const UChar* text,
@@ -1221,7 +1221,7 @@ udat_parseCalendar(const UDateFormat* format,
* @see udat_setLenient
* @stable ICU 2.0
*/
-U_CAPI UBool U_EXPORT2
+U_CAPI UBool U_EXPORT2
udat_isLenient(const UDateFormat* fmt);
/**
@@ -1233,7 +1233,7 @@ udat_isLenient(const UDateFormat* fmt);
* @see dat_isLenient
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_CAPI void U_EXPORT2
udat_setLenient( UDateFormat* fmt,
UBool isLenient);
@@ -1246,7 +1246,7 @@ udat_setLenient( UDateFormat* fmt,
* @see udat_setCalendar
* @stable ICU 2.0
*/
-U_CAPI const UCalendar* U_EXPORT2
+U_CAPI const UCalendar* U_EXPORT2
udat_getCalendar(const UDateFormat* fmt);
/**
@@ -1258,7 +1258,7 @@ udat_getCalendar(const UDateFormat* fmt);
* @see udat_setCalendar
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_CAPI void U_EXPORT2
udat_setCalendar( UDateFormat* fmt,
const UCalendar* calendarToSet);
@@ -1271,7 +1271,7 @@ udat_setCalendar( UDateFormat* fmt,
* @see udat_setNumberFormat
* @stable ICU 2.0
*/
-U_CAPI const UNumberFormat* U_EXPORT2
+U_CAPI const UNumberFormat* U_EXPORT2
udat_getNumberFormat(const UDateFormat* fmt);
/**
@@ -1283,7 +1283,7 @@ udat_getNumberFormat(const UDateFormat* fmt);
* @see udat_setNumberFormatForField
* @stable ICU 54
*/
-U_CAPI const UNumberFormat* U_EXPORT2
+U_CAPI const UNumberFormat* U_EXPORT2
udat_getNumberFormatForField(const UDateFormat* fmt, UChar field);
/**
@@ -1301,7 +1301,7 @@ udat_getNumberFormatForField(const UDateFormat* fmt, UChar field);
* @see udat_getNumberFormatForField
* @stable ICU 54
*/
-U_CAPI void U_EXPORT2
+U_CAPI void U_EXPORT2
udat_adoptNumberFormatForFields( UDateFormat* fmt,
const UChar* fields,
UNumberFormat* numberFormatToSet,
@@ -1318,7 +1318,7 @@ udat_adoptNumberFormatForFields( UDateFormat* fmt,
* @see udat_setNumberFormatForField
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_CAPI void U_EXPORT2
udat_setNumberFormat( UDateFormat* fmt,
const UNumberFormat* numberFormatToSet);
/**
@@ -1330,7 +1330,7 @@ udat_setNumberFormat( UDateFormat* fmt,
* @see udat_getNumberFormat
* @stable ICU 54
*/
-U_CAPI void U_EXPORT2
+U_CAPI void U_EXPORT2
udat_adoptNumberFormat( UDateFormat* fmt,
UNumberFormat* numberFormatToAdopt);
/**
@@ -1342,7 +1342,7 @@ udat_adoptNumberFormat( UDateFormat* fmt,
* @see udat_countAvailable
* @stable ICU 2.0
*/
-U_CAPI const char* U_EXPORT2
+U_CAPI const char* U_EXPORT2
udat_getAvailable(int32_t localeIndex);
/**
@@ -1353,7 +1353,7 @@ udat_getAvailable(int32_t localeIndex);
* @see udat_getAvailable
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
udat_countAvailable(void);
/**
@@ -1366,7 +1366,7 @@ udat_countAvailable(void);
* @see udat_Set2DigitYearStart
* @stable ICU 2.0
*/
-U_CAPI UDate U_EXPORT2
+U_CAPI UDate U_EXPORT2
udat_get2DigitYearStart( const UDateFormat *fmt,
UErrorCode *status);
@@ -1380,7 +1380,7 @@ udat_get2DigitYearStart( const UDateFormat *fmt,
* @see udat_Set2DigitYearStart
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_CAPI void U_EXPORT2
udat_set2DigitYearStart( UDateFormat *fmt,
UDate d,
UErrorCode *status);
@@ -1397,7 +1397,7 @@ udat_set2DigitYearStart( UDateFormat *fmt,
* @see udat_applyPattern
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
udat_toPattern( const UDateFormat *fmt,
UBool localized,
UChar *result,
@@ -1414,7 +1414,7 @@ udat_toPattern( const UDateFormat *fmt,
* @see udat_toPattern
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_CAPI void U_EXPORT2
udat_applyPattern( UDateFormat *format,
UBool localized,
const UChar *pattern,
@@ -1540,7 +1540,7 @@ typedef struct UDateFormatSymbols UDateFormatSymbols;
* @see udat_setSymbols
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
udat_getSymbols(const UDateFormat *fmt,
UDateFormatSymbolType type,
int32_t symbolIndex,
@@ -1560,7 +1560,7 @@ udat_getSymbols(const UDateFormat *fmt,
* @see udat_setSymbols
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
udat_countSymbols( const UDateFormat *fmt,
UDateFormatSymbolType type);
@@ -1579,7 +1579,7 @@ udat_countSymbols( const UDateFormat *fmt,
* @see udat_countSymbols
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_CAPI void U_EXPORT2
udat_setSymbols( UDateFormat *format,
UDateFormatSymbolType type,
int32_t symbolIndex,
@@ -1596,7 +1596,7 @@ udat_setSymbols( UDateFormat *format,
* @return the locale name
* @stable ICU 2.8
*/
-U_CAPI const char* U_EXPORT2
+U_CAPI const char* U_EXPORT2
udat_getLocaleByType(const UDateFormat *fmt,
ULocDataLocaleType type,
UErrorCode* status);
@@ -1609,7 +1609,7 @@ udat_getLocaleByType(const UDateFormat *fmt,
* @param status A pointer to an UErrorCode to receive any errors
* @stable ICU 51
*/
-U_CAPI void U_EXPORT2
+U_CAPI void U_EXPORT2
udat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status);
/**
@@ -1621,7 +1621,7 @@ udat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status);
* @return The UDisplayContextValue for the specified type.
* @stable ICU 53
*/
-U_CAPI UDisplayContext U_EXPORT2
+U_CAPI UDisplayContext U_EXPORT2
udat_getContext(const UDateFormat* fmt, UDisplayContextType type, UErrorCode* status);
#ifndef U_HIDE_INTERNAL_API
diff --git a/contrib/libs/icu/include/unicode/udata.h b/contrib/libs/icu/include/unicode/udata.h
index 61e683f2f6..325ffcf17d 100644
--- a/contrib/libs/icu/include/unicode/udata.h
+++ b/contrib/libs/icu/include/unicode/udata.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: udata.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -415,23 +415,23 @@ udata_setFileAccess(UDataFileAccess access, UErrorCode *status);
U_CDECL_END
-#if U_SHOW_CPLUSPLUS_API
-
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUDataMemoryPointer
- * "Smart pointer" class, closes a UDataMemory via udata_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 4.4
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close);
-
-U_NAMESPACE_END
-
-#endif // U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \class LocalUDataMemoryPointer
+ * "Smart pointer" class, closes a UDataMemory via udata_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 4.4
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close);
+
+U_NAMESPACE_END
+
+#endif // U_SHOW_CPLUSPLUS_API
+
#endif
diff --git a/contrib/libs/icu/include/unicode/udateintervalformat.h b/contrib/libs/icu/include/unicode/udateintervalformat.h
index c3072b4e3b..2f9ec91ad3 100644
--- a/contrib/libs/icu/include/unicode/udateintervalformat.h
+++ b/contrib/libs/icu/include/unicode/udateintervalformat.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************************
@@ -14,10 +14,10 @@
#if !UCONFIG_NO_FORMATTING
-#include "unicode/ucal.h"
+#include "unicode/ucal.h"
#include "unicode/umisc.h"
#include "unicode/localpointer.h"
-#include "unicode/uformattedvalue.h"
+#include "unicode/uformattedvalue.h"
/**
* \file
@@ -83,14 +83,14 @@
struct UDateIntervalFormat;
typedef struct UDateIntervalFormat UDateIntervalFormat; /**< C typedef for struct UDateIntervalFormat. @stable ICU 4.8 */
-struct UFormattedDateInterval;
+struct UFormattedDateInterval;
+/**
+ * Opaque struct to contain the results of a UDateIntervalFormat operation.
+ * @stable ICU 64
+ */
+typedef struct UFormattedDateInterval UFormattedDateInterval;
+
/**
- * Opaque struct to contain the results of a UDateIntervalFormat operation.
- * @stable ICU 64
- */
-typedef struct UFormattedDateInterval UFormattedDateInterval;
-
-/**
* Open a new UDateIntervalFormat object using the predefined rules for a
* given locale plus a specified skeleton.
* @param locale
@@ -131,53 +131,53 @@ udtitvfmt_open(const char* locale,
U_STABLE void U_EXPORT2
udtitvfmt_close(UDateIntervalFormat *formatter);
-/**
- * Creates an object to hold the result of a UDateIntervalFormat
- * operation. The object can be used repeatedly; it is cleared whenever
- * passed to a format function.
- *
- * @param ec Set if an error occurs.
- * @return A pointer needing ownership.
- * @stable ICU 64
- */
-U_CAPI UFormattedDateInterval* U_EXPORT2
-udtitvfmt_openResult(UErrorCode* ec);
+/**
+ * Creates an object to hold the result of a UDateIntervalFormat
+ * operation. The object can be used repeatedly; it is cleared whenever
+ * passed to a format function.
+ *
+ * @param ec Set if an error occurs.
+ * @return A pointer needing ownership.
+ * @stable ICU 64
+ */
+U_CAPI UFormattedDateInterval* U_EXPORT2
+udtitvfmt_openResult(UErrorCode* ec);
+
+/**
+ * Returns a representation of a UFormattedDateInterval as a UFormattedValue,
+ * which can be subsequently passed to any API requiring that type.
+ *
+ * The returned object is owned by the UFormattedDateInterval and is valid
+ * only as long as the UFormattedDateInterval is present and unchanged in memory.
+ *
+ * You can think of this method as a cast between types.
+ *
+ * When calling ufmtval_nextPosition():
+ * The fields are returned from left to right. The special field category
+ * UFIELD_CATEGORY_DATE_INTERVAL_SPAN is used to indicate which datetime
+ * primitives came from which arguments: 0 means fromCalendar, and 1 means
+ * toCalendar. The span category will always occur before the
+ * corresponding fields in UFIELD_CATEGORY_DATE
+ * in the ufmtval_nextPosition() iterator.
+ *
+ * @param uresult The object containing the formatted string.
+ * @param ec Set if an error occurs.
+ * @return A UFormattedValue owned by the input object.
+ * @stable ICU 64
+ */
+U_CAPI const UFormattedValue* U_EXPORT2
+udtitvfmt_resultAsValue(const UFormattedDateInterval* uresult, UErrorCode* ec);
+
+/**
+ * Releases the UFormattedDateInterval created by udtitvfmt_openResult().
+ *
+ * @param uresult The object to release.
+ * @stable ICU 64
+ */
+U_CAPI void U_EXPORT2
+udtitvfmt_closeResult(UFormattedDateInterval* uresult);
+
-/**
- * Returns a representation of a UFormattedDateInterval as a UFormattedValue,
- * which can be subsequently passed to any API requiring that type.
- *
- * The returned object is owned by the UFormattedDateInterval and is valid
- * only as long as the UFormattedDateInterval is present and unchanged in memory.
- *
- * You can think of this method as a cast between types.
- *
- * When calling ufmtval_nextPosition():
- * The fields are returned from left to right. The special field category
- * UFIELD_CATEGORY_DATE_INTERVAL_SPAN is used to indicate which datetime
- * primitives came from which arguments: 0 means fromCalendar, and 1 means
- * toCalendar. The span category will always occur before the
- * corresponding fields in UFIELD_CATEGORY_DATE
- * in the ufmtval_nextPosition() iterator.
- *
- * @param uresult The object containing the formatted string.
- * @param ec Set if an error occurs.
- * @return A UFormattedValue owned by the input object.
- * @stable ICU 64
- */
-U_CAPI const UFormattedValue* U_EXPORT2
-udtitvfmt_resultAsValue(const UFormattedDateInterval* uresult, UErrorCode* ec);
-
-/**
- * Releases the UFormattedDateInterval created by udtitvfmt_openResult().
- *
- * @param uresult The object to release.
- * @stable ICU 64
- */
-U_CAPI void U_EXPORT2
-udtitvfmt_closeResult(UFormattedDateInterval* uresult);
-
-
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
@@ -193,17 +193,17 @@ U_NAMESPACE_BEGIN
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateIntervalFormatPointer, UDateIntervalFormat, udtitvfmt_close);
-/**
- * \class LocalUFormattedDateIntervalPointer
- * "Smart pointer" class, closes a UFormattedDateInterval via udtitvfmt_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 64
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedDateIntervalPointer, UFormattedDateInterval, udtitvfmt_closeResult);
-
+/**
+ * \class LocalUFormattedDateIntervalPointer
+ * "Smart pointer" class, closes a UFormattedDateInterval via udtitvfmt_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 64
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedDateIntervalPointer, UFormattedDateInterval, udtitvfmt_closeResult);
+
U_NAMESPACE_END
#endif
@@ -247,59 +247,59 @@ udtitvfmt_format(const UDateIntervalFormat* formatter,
UFieldPosition* position,
UErrorCode* status);
-
-#ifndef U_HIDE_DRAFT_API
-/**
- * Formats a date/time range using the conventions established for the
- * UDateIntervalFormat object.
- * @param formatter
- * The UDateIntervalFormat object specifying the format conventions.
- * @param fromDate
- * The starting point of the range.
- * @param toDate
- * The ending point of the range.
- * @param result
- * The UFormattedDateInterval to contain the result of the
- * formatting operation.
- * @param status
- * A pointer to a UErrorCode to receive any errors.
- * @draft ICU 67
- */
-U_DRAFT void U_EXPORT2
-udtitvfmt_formatToResult(
- const UDateIntervalFormat* formatter,
- UDate fromDate,
- UDate toDate,
- UFormattedDateInterval* result,
- UErrorCode* status);
-
-/**
- * Formats a date/time range using the conventions established for the
- * UDateIntervalFormat object.
- * @param formatter
- * The UDateIntervalFormat object specifying the format conventions.
- * @param fromCalendar
- * The starting point of the range.
- * @param toCalendar
- * The ending point of the range.
- * @param result
- * The UFormattedDateInterval to contain the result of the
- * formatting operation.
- * @param status
- * A pointer to a UErrorCode to receive any errors.
- * @draft ICU 67
- */
-
-U_DRAFT void U_EXPORT2
-udtitvfmt_formatCalendarToResult(
- const UDateIntervalFormat* formatter,
- UCalendar* fromCalendar,
- UCalendar* toCalendar,
- UFormattedDateInterval* result,
- UErrorCode* status);
-#endif /* U_HIDE_DRAFT_API */
-
-
+
+#ifndef U_HIDE_DRAFT_API
+/**
+ * Formats a date/time range using the conventions established for the
+ * UDateIntervalFormat object.
+ * @param formatter
+ * The UDateIntervalFormat object specifying the format conventions.
+ * @param fromDate
+ * The starting point of the range.
+ * @param toDate
+ * The ending point of the range.
+ * @param result
+ * The UFormattedDateInterval to contain the result of the
+ * formatting operation.
+ * @param status
+ * A pointer to a UErrorCode to receive any errors.
+ * @draft ICU 67
+ */
+U_DRAFT void U_EXPORT2
+udtitvfmt_formatToResult(
+ const UDateIntervalFormat* formatter,
+ UDate fromDate,
+ UDate toDate,
+ UFormattedDateInterval* result,
+ UErrorCode* status);
+
+/**
+ * Formats a date/time range using the conventions established for the
+ * UDateIntervalFormat object.
+ * @param formatter
+ * The UDateIntervalFormat object specifying the format conventions.
+ * @param fromCalendar
+ * The starting point of the range.
+ * @param toCalendar
+ * The ending point of the range.
+ * @param result
+ * The UFormattedDateInterval to contain the result of the
+ * formatting operation.
+ * @param status
+ * A pointer to a UErrorCode to receive any errors.
+ * @draft ICU 67
+ */
+
+U_DRAFT void U_EXPORT2
+udtitvfmt_formatCalendarToResult(
+ const UDateIntervalFormat* formatter,
+ UCalendar* fromCalendar,
+ UCalendar* toCalendar,
+ UFormattedDateInterval* result,
+ UErrorCode* status);
+#endif /* U_HIDE_DRAFT_API */
+
+
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif
diff --git a/contrib/libs/icu/include/unicode/udatpg.h b/contrib/libs/icu/include/unicode/udatpg.h
index c59702cfd4..5abe1472a6 100644
--- a/contrib/libs/icu/include/unicode/udatpg.h
+++ b/contrib/libs/icu/include/unicode/udatpg.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: udatpg.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -20,7 +20,7 @@
#define __UDATPG_H__
#include "unicode/utypes.h"
-#include "unicode/udat.h"
+#include "unicode/udat.h"
#include "unicode/uenum.h"
#include "unicode/localpointer.h"
@@ -87,31 +87,31 @@ typedef enum UDateTimePatternField {
/** @stable ICU 3.8 */
UDATPG_ZONE_FIELD,
- /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
- * it is needed for layout of DateTimePatternGenerator object. */
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+ /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
+ * it is needed for layout of DateTimePatternGenerator object. */
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* One more than the highest normal UDateTimePatternField value.
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
UDATPG_FIELD_COUNT
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
} UDateTimePatternField;
/**
- * Field display name width constants for udatpg_getFieldDisplayName().
- * @stable ICU 61
- */
-typedef enum UDateTimePGDisplayWidth {
- /** @stable ICU 61 */
- UDATPG_WIDE,
- /** @stable ICU 61 */
- UDATPG_ABBREVIATED,
- /** @stable ICU 61 */
- UDATPG_NARROW
-} UDateTimePGDisplayWidth;
-
-/**
+ * Field display name width constants for udatpg_getFieldDisplayName().
+ * @stable ICU 61
+ */
+typedef enum UDateTimePGDisplayWidth {
+ /** @stable ICU 61 */
+ UDATPG_WIDE,
+ /** @stable ICU 61 */
+ UDATPG_ABBREVIATED,
+ /** @stable ICU 61 */
+ UDATPG_NARROW
+} UDateTimePGDisplayWidth;
+
+/**
* Masks to control forcing the length of specified fields in the returned
* pattern to match those in the skeleton (when this would not happen
* otherwise). These may be combined to force the length of multiple fields.
@@ -426,14 +426,14 @@ udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg,
/**
* Getter corresponding to setAppendItemNames. Values below 0 or at or above
- * UDATPG_FIELD_COUNT are illegal arguments. Note: The more general function
- * for getting date/time field display names is udatpg_getFieldDisplayName.
+ * UDATPG_FIELD_COUNT are illegal arguments. Note: The more general function
+ * for getting date/time field display names is udatpg_getFieldDisplayName.
*
* @param dtpg a pointer to UDateTimePatternGenerator.
* @param field UDateTimePatternField, such as UDATPG_ERA_FIELD
* @param pLength A pointer that will receive the length of the name for field.
* @return name for field
- * @see udatpg_getFieldDisplayName
+ * @see udatpg_getFieldDisplayName
* @stable ICU 3.8
*/
U_STABLE const UChar * U_EXPORT2
@@ -442,38 +442,38 @@ udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
int32_t *pLength);
/**
- * The general interface to get a display name for a particular date/time field,
- * in one of several possible display widths.
- *
- * @param dtpg
- * A pointer to the UDateTimePatternGenerator object with the localized
- * display names.
- * @param field
- * The desired UDateTimePatternField, such as UDATPG_ERA_FIELD.
- * @param width
- * The desired UDateTimePGDisplayWidth, such as UDATPG_ABBREVIATED.
- * @param fieldName
- * A pointer to a buffer to receive the NULL-terminated display name. If the name
- * fits into fieldName but cannot be NULL-terminated (length == capacity) then
- * the error code is set to U_STRING_NOT_TERMINATED_WARNING. If the name doesn't
- * fit into fieldName then the error code is set to U_BUFFER_OVERFLOW_ERROR.
- * @param capacity
- * The size of fieldName (in UChars).
- * @param pErrorCode
- * A pointer to a UErrorCode to receive any errors
- * @return
- * The full length of the name; if greater than capacity, fieldName contains a
- * truncated result.
- * @stable ICU 61
- */
-U_STABLE int32_t U_EXPORT2
-udatpg_getFieldDisplayName(const UDateTimePatternGenerator *dtpg,
- UDateTimePatternField field,
- UDateTimePGDisplayWidth width,
- UChar *fieldName, int32_t capacity,
- UErrorCode *pErrorCode);
-
-/**
+ * The general interface to get a display name for a particular date/time field,
+ * in one of several possible display widths.
+ *
+ * @param dtpg
+ * A pointer to the UDateTimePatternGenerator object with the localized
+ * display names.
+ * @param field
+ * The desired UDateTimePatternField, such as UDATPG_ERA_FIELD.
+ * @param width
+ * The desired UDateTimePGDisplayWidth, such as UDATPG_ABBREVIATED.
+ * @param fieldName
+ * A pointer to a buffer to receive the NULL-terminated display name. If the name
+ * fits into fieldName but cannot be NULL-terminated (length == capacity) then
+ * the error code is set to U_STRING_NOT_TERMINATED_WARNING. If the name doesn't
+ * fit into fieldName then the error code is set to U_BUFFER_OVERFLOW_ERROR.
+ * @param capacity
+ * The size of fieldName (in UChars).
+ * @param pErrorCode
+ * A pointer to a UErrorCode to receive any errors
+ * @return
+ * The full length of the name; if greater than capacity, fieldName contains a
+ * truncated result.
+ * @stable ICU 61
+ */
+U_STABLE int32_t U_EXPORT2
+udatpg_getFieldDisplayName(const UDateTimePatternGenerator *dtpg,
+ UDateTimePatternField field,
+ UDateTimePGDisplayWidth width,
+ UChar *fieldName, int32_t capacity,
+ UErrorCode *pErrorCode);
+
+/**
* The DateTimeFormat is a message format pattern used to compose date and
* time patterns. The default pattern in the root locale is "{1} {0}", where
* {1} will be replaced by the date pattern and {0} will be replaced by the
@@ -652,26 +652,26 @@ udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg,
const UChar *skeleton, int32_t skeletonLength,
int32_t *pLength);
-#if !UCONFIG_NO_FORMATTING
-
-#ifndef U_HIDE_DRAFT_API
-/**
- * Return the default hour cycle for a locale. Uses the locale that the
- * UDateTimePatternGenerator was initially created with.
- *
- * Cannot be used on an empty UDateTimePatternGenerator instance.
- *
- * @param dtpg a pointer to UDateTimePatternGenerator.
- * @param pErrorCode a pointer to the UErrorCode which must not indicate a
- * failure before the function call. Set to U_UNSUPPORTED_ERROR
- * if used on an empty instance.
- * @return the default hour cycle.
- * @draft ICU 67
- */
-U_DRAFT UDateFormatHourCycle U_EXPORT2
-udatpg_getDefaultHourCycle(const UDateTimePatternGenerator *dtpg, UErrorCode* pErrorCode);
-#endif /* U_HIDE_DRAFT_API */
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
-
+#if !UCONFIG_NO_FORMATTING
+
+#ifndef U_HIDE_DRAFT_API
+/**
+ * Return the default hour cycle for a locale. Uses the locale that the
+ * UDateTimePatternGenerator was initially created with.
+ *
+ * Cannot be used on an empty UDateTimePatternGenerator instance.
+ *
+ * @param dtpg a pointer to UDateTimePatternGenerator.
+ * @param pErrorCode a pointer to the UErrorCode which must not indicate a
+ * failure before the function call. Set to U_UNSUPPORTED_ERROR
+ * if used on an empty instance.
+ * @return the default hour cycle.
+ * @draft ICU 67
+ */
+U_DRAFT UDateFormatHourCycle U_EXPORT2
+udatpg_getDefaultHourCycle(const UDateTimePatternGenerator *dtpg, UErrorCode* pErrorCode);
+#endif /* U_HIDE_DRAFT_API */
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/udisplaycontext.h b/contrib/libs/icu/include/unicode/udisplaycontext.h
index 269b37407f..398481c681 100644
--- a/contrib/libs/icu/include/unicode/udisplaycontext.h
+++ b/contrib/libs/icu/include/unicode/udisplaycontext.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************************
@@ -47,7 +47,7 @@ enum UDisplayContextType {
/**
* Type to retrieve the substitute handling setting, e.g.
* UDISPCTX_SUBSTITUTE, UDISPCTX_NO_SUBSTITUTE.
- * @stable ICU 58
+ * @stable ICU 58
*/
UDISPCTX_TYPE_SUBSTITUTE_HANDLING = 3
};
@@ -151,13 +151,13 @@ enum UDisplayContext {
* A possible setting for SUBSTITUTE_HANDLING:
* Returns a fallback value (e.g., the input code) when no data is available.
* This is the default value.
- * @stable ICU 58
+ * @stable ICU 58
*/
UDISPCTX_SUBSTITUTE = (UDISPCTX_TYPE_SUBSTITUTE_HANDLING<<8) + 0,
/**
* A possible setting for SUBSTITUTE_HANDLING:
* Returns a null value when no data is available.
- * @stable ICU 58
+ * @stable ICU 58
*/
UDISPCTX_NO_SUBSTITUTE = (UDISPCTX_TYPE_SUBSTITUTE_HANDLING<<8) + 1
diff --git a/contrib/libs/icu/include/unicode/uenum.h b/contrib/libs/icu/include/unicode/uenum.h
index 08f5425bb4..c670eeafb1 100644
--- a/contrib/libs/icu/include/unicode/uenum.h
+++ b/contrib/libs/icu/include/unicode/uenum.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: uenum.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:2
*
@@ -23,9 +23,9 @@
#include "unicode/localpointer.h"
#if U_SHOW_CPLUSPLUS_API
-U_NAMESPACE_BEGIN
-class StringEnumeration;
-U_NAMESPACE_END
+U_NAMESPACE_BEGIN
+class StringEnumeration;
+U_NAMESPACE_END
#endif
/**
diff --git a/contrib/libs/icu/include/unicode/ufieldpositer.h b/contrib/libs/icu/include/unicode/ufieldpositer.h
index 6d8686cc3d..3ae73b6d84 100644
--- a/contrib/libs/icu/include/unicode/ufieldpositer.h
+++ b/contrib/libs/icu/include/unicode/ufieldpositer.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************************
diff --git a/contrib/libs/icu/include/unicode/uformattable.h b/contrib/libs/icu/include/unicode/uformattable.h
index bca50e699c..9ba2a36901 100644
--- a/contrib/libs/icu/include/unicode/uformattable.h
+++ b/contrib/libs/icu/include/unicode/uformattable.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
@@ -57,7 +57,7 @@ typedef enum UFormattableType {
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
UFMT_COUNT
-#endif /* U_HIDE_DEPRECATED_API */
+#endif /* U_HIDE_DEPRECATED_API */
} UFormattableType;
diff --git a/contrib/libs/icu/include/unicode/uformattedvalue.h b/contrib/libs/icu/include/unicode/uformattedvalue.h
index bb3235846e..07f4281f57 100644
--- a/contrib/libs/icu/include/unicode/uformattedvalue.h
+++ b/contrib/libs/icu/include/unicode/uformattedvalue.h
@@ -1,438 +1,438 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#ifndef __UFORMATTEDVALUE_H__
-#define __UFORMATTEDVALUE_H__
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/ufieldpositer.h"
-
-/**
- * \file
- * \brief C API: Abstract operations for localized strings.
- *
- * This file contains declarations for classes that deal with formatted strings. A number
- * of APIs throughout ICU use these classes for expressing their localized output.
- */
-
-
-/**
- * All possible field categories in ICU. Every entry in this enum corresponds
- * to another enum that exists in ICU.
- *
- * In the APIs that take a UFieldCategory, an int32_t type is used. Field
- * categories having any of the top four bits turned on are reserved as
- * private-use for external APIs implementing FormattedValue. This means that
- * categories 2^28 and higher or below zero (with the highest bit turned on)
- * are private-use and will not be used by ICU in the future.
- *
- * @stable ICU 64
- */
-typedef enum UFieldCategory {
- /**
- * For an undefined field category.
- *
- * @stable ICU 64
- */
- UFIELD_CATEGORY_UNDEFINED = 0,
-
- /**
- * For fields in UDateFormatField (udat.h), from ICU 3.0.
- *
- * @stable ICU 64
- */
- UFIELD_CATEGORY_DATE,
-
- /**
- * For fields in UNumberFormatFields (unum.h), from ICU 49.
- *
- * @stable ICU 64
- */
- UFIELD_CATEGORY_NUMBER,
-
- /**
- * For fields in UListFormatterField (ulistformatter.h), from ICU 63.
- *
- * @stable ICU 64
- */
- UFIELD_CATEGORY_LIST,
-
- /**
- * For fields in URelativeDateTimeFormatterField (ureldatefmt.h), from ICU 64.
- *
- * @stable ICU 64
- */
- UFIELD_CATEGORY_RELATIVE_DATETIME,
-
- /**
- * Reserved for possible future fields in UDateIntervalFormatField.
- *
- * @internal
- */
- UFIELD_CATEGORY_DATE_INTERVAL,
-
-#ifndef U_HIDE_INTERNAL_API
- /** @internal */
- UFIELD_CATEGORY_COUNT,
-#endif /* U_HIDE_INTERNAL_API */
-
- /**
- * Category for spans in a list.
- *
- * @stable ICU 64
- */
- UFIELD_CATEGORY_LIST_SPAN = 0x1000 + UFIELD_CATEGORY_LIST,
-
- /**
- * Category for spans in a date interval.
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#ifndef __UFORMATTEDVALUE_H__
+#define __UFORMATTEDVALUE_H__
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/ufieldpositer.h"
+
+/**
+ * \file
+ * \brief C API: Abstract operations for localized strings.
+ *
+ * This file contains declarations for classes that deal with formatted strings. A number
+ * of APIs throughout ICU use these classes for expressing their localized output.
+ */
+
+
+/**
+ * All possible field categories in ICU. Every entry in this enum corresponds
+ * to another enum that exists in ICU.
+ *
+ * In the APIs that take a UFieldCategory, an int32_t type is used. Field
+ * categories having any of the top four bits turned on are reserved as
+ * private-use for external APIs implementing FormattedValue. This means that
+ * categories 2^28 and higher or below zero (with the highest bit turned on)
+ * are private-use and will not be used by ICU in the future.
+ *
+ * @stable ICU 64
+ */
+typedef enum UFieldCategory {
+ /**
+ * For an undefined field category.
*
- * @stable ICU 64
- */
- UFIELD_CATEGORY_DATE_INTERVAL_SPAN = 0x1000 + UFIELD_CATEGORY_DATE_INTERVAL,
-
-} UFieldCategory;
-
-
-struct UConstrainedFieldPosition;
-/**
- * Represents a span of a string containing a given field.
- *
- * This struct differs from UFieldPosition in the following ways:
- *
- * 1. It has information on the field category.
- * 2. It allows you to set constraints to use when iterating over field positions.
- * 3. It is used for the newer FormattedValue APIs.
- *
- * @stable ICU 64
- */
-typedef struct UConstrainedFieldPosition UConstrainedFieldPosition;
-
-
-/**
- * Creates a new UConstrainedFieldPosition.
- *
- * By default, the UConstrainedFieldPosition has no iteration constraints.
- *
- * @param ec Set if an error occurs.
- * @return The new object, or NULL if an error occurs.
- * @stable ICU 64
- */
-U_STABLE UConstrainedFieldPosition* U_EXPORT2
-ucfpos_open(UErrorCode* ec);
-
-
-/**
- * Resets a UConstrainedFieldPosition to its initial state, as if it were newly created.
- *
- * Removes any constraints that may have been set on the instance.
- *
- * @param ucfpos The instance of UConstrainedFieldPosition.
- * @param ec Set if an error occurs.
- * @stable ICU 64
- */
-U_STABLE void U_EXPORT2
-ucfpos_reset(
- UConstrainedFieldPosition* ucfpos,
- UErrorCode* ec);
-
-
-/**
- * Destroys a UConstrainedFieldPosition and releases its memory.
- *
- * @param ucfpos The instance of UConstrainedFieldPosition.
- * @stable ICU 64
- */
-U_STABLE void U_EXPORT2
-ucfpos_close(UConstrainedFieldPosition* ucfpos);
-
-
-/**
- * Sets a constraint on the field category.
- *
- * When this instance of UConstrainedFieldPosition is passed to ufmtval_nextPosition,
- * positions are skipped unless they have the given category.
- *
- * Any previously set constraints are cleared.
- *
- * For example, to loop over only the number-related fields:
- *
- * UConstrainedFieldPosition* ucfpos = ucfpos_open(ec);
- * ucfpos_constrainCategory(ucfpos, UFIELDCATEGORY_NUMBER_FORMAT, ec);
- * while (ufmtval_nextPosition(ufmtval, ucfpos, ec)) {
- * // handle the number-related field position
- * }
- * ucfpos_close(ucfpos);
- *
- * Changing the constraint while in the middle of iterating over a FormattedValue
- * does not generally have well-defined behavior.
- *
- * @param ucfpos The instance of UConstrainedFieldPosition.
- * @param category The field category to fix when iterating.
- * @param ec Set if an error occurs.
- * @stable ICU 64
- */
-U_STABLE void U_EXPORT2
-ucfpos_constrainCategory(
- UConstrainedFieldPosition* ucfpos,
- int32_t category,
- UErrorCode* ec);
-
-
-/**
- * Sets a constraint on the category and field.
- *
- * When this instance of UConstrainedFieldPosition is passed to ufmtval_nextPosition,
- * positions are skipped unless they have the given category and field.
- *
- * Any previously set constraints are cleared.
- *
- * For example, to loop over all grouping separators:
- *
- * UConstrainedFieldPosition* ucfpos = ucfpos_open(ec);
- * ucfpos_constrainField(ucfpos, UFIELDCATEGORY_NUMBER_FORMAT, UNUM_GROUPING_SEPARATOR_FIELD, ec);
- * while (ufmtval_nextPosition(ufmtval, ucfpos, ec)) {
- * // handle the grouping separator position
- * }
- * ucfpos_close(ucfpos);
- *
- * Changing the constraint while in the middle of iterating over a FormattedValue
- * does not generally have well-defined behavior.
- *
- * @param ucfpos The instance of UConstrainedFieldPosition.
- * @param category The field category to fix when iterating.
- * @param field The field to fix when iterating.
- * @param ec Set if an error occurs.
- * @stable ICU 64
- */
-U_STABLE void U_EXPORT2
-ucfpos_constrainField(
- UConstrainedFieldPosition* ucfpos,
- int32_t category,
- int32_t field,
- UErrorCode* ec);
-
-
-/**
- * Gets the field category for the current position.
- *
- * If a category or field constraint was set, this function returns the constrained
- * category. Otherwise, the return value is well-defined only after
- * ufmtval_nextPosition returns TRUE.
- *
- * @param ucfpos The instance of UConstrainedFieldPosition.
- * @param ec Set if an error occurs.
- * @return The field category saved in the instance.
- * @stable ICU 64
- */
-U_STABLE int32_t U_EXPORT2
-ucfpos_getCategory(
- const UConstrainedFieldPosition* ucfpos,
- UErrorCode* ec);
-
-
-/**
- * Gets the field for the current position.
- *
- * If a field constraint was set, this function returns the constrained
- * field. Otherwise, the return value is well-defined only after
- * ufmtval_nextPosition returns TRUE.
- *
- * @param ucfpos The instance of UConstrainedFieldPosition.
- * @param ec Set if an error occurs.
- * @return The field saved in the instance.
- * @stable ICU 64
- */
-U_STABLE int32_t U_EXPORT2
-ucfpos_getField(
- const UConstrainedFieldPosition* ucfpos,
- UErrorCode* ec);
-
-
-/**
- * Gets the INCLUSIVE start and EXCLUSIVE end index stored for the current position.
- *
- * The output values are well-defined only after ufmtval_nextPosition returns TRUE.
- *
- * @param ucfpos The instance of UConstrainedFieldPosition.
- * @param pStart Set to the start index saved in the instance. Ignored if nullptr.
- * @param pLimit Set to the end index saved in the instance. Ignored if nullptr.
- * @param ec Set if an error occurs.
- * @stable ICU 64
- */
-U_STABLE void U_EXPORT2
-ucfpos_getIndexes(
- const UConstrainedFieldPosition* ucfpos,
- int32_t* pStart,
- int32_t* pLimit,
- UErrorCode* ec);
-
-
-/**
- * Gets an int64 that FormattedValue implementations may use for storage.
- *
- * The initial value is zero.
- *
- * Users of FormattedValue should not need to call this method.
- *
- * @param ucfpos The instance of UConstrainedFieldPosition.
- * @param ec Set if an error occurs.
- * @return The current iteration context from ucfpos_setInt64IterationContext.
- * @stable ICU 64
- */
-U_STABLE int64_t U_EXPORT2
-ucfpos_getInt64IterationContext(
- const UConstrainedFieldPosition* ucfpos,
- UErrorCode* ec);
-
-
-/**
- * Sets an int64 that FormattedValue implementations may use for storage.
- *
- * Intended to be used by FormattedValue implementations.
- *
- * @param ucfpos The instance of UConstrainedFieldPosition.
- * @param context The new iteration context.
- * @param ec Set if an error occurs.
- * @stable ICU 64
- */
-U_STABLE void U_EXPORT2
-ucfpos_setInt64IterationContext(
- UConstrainedFieldPosition* ucfpos,
- int64_t context,
- UErrorCode* ec);
-
-
-/**
- * Determines whether a given field should be included given the
- * constraints.
- *
- * Intended to be used by FormattedValue implementations.
- *
- * @param ucfpos The instance of UConstrainedFieldPosition.
- * @param category The category to test.
- * @param field The field to test.
- * @param ec Set if an error occurs.
- * @stable ICU 64
- */
-U_STABLE UBool U_EXPORT2
-ucfpos_matchesField(
- const UConstrainedFieldPosition* ucfpos,
- int32_t category,
- int32_t field,
- UErrorCode* ec);
-
-
-/**
- * Sets new values for the primary public getters.
- *
- * Intended to be used by FormattedValue implementations.
- *
- * It is up to the implementation to ensure that the user-requested
- * constraints are satisfied. This method does not check!
- *
- * @param ucfpos The instance of UConstrainedFieldPosition.
- * @param category The new field category.
- * @param field The new field.
- * @param start The new inclusive start index.
- * @param limit The new exclusive end index.
- * @param ec Set if an error occurs.
- * @stable ICU 64
- */
-U_STABLE void U_EXPORT2
-ucfpos_setState(
- UConstrainedFieldPosition* ucfpos,
- int32_t category,
- int32_t field,
- int32_t start,
- int32_t limit,
- UErrorCode* ec);
-
-
-struct UFormattedValue;
-/**
- * An abstract formatted value: a string with associated field attributes.
- * Many formatters format to types compatible with UFormattedValue.
- *
- * @stable ICU 64
- */
-typedef struct UFormattedValue UFormattedValue;
-
-
-/**
- * Returns a pointer to the formatted string. The pointer is owned by the UFormattedValue. The
- * return value is valid only as long as the UFormattedValue is present and unchanged in memory.
- *
- * The return value is NUL-terminated but could contain internal NULs.
- *
- * @param ufmtval
- * The object containing the formatted string and attributes.
- * @param pLength Output variable for the length of the string. Ignored if NULL.
- * @param ec Set if an error occurs.
- * @return A NUL-terminated char16 string owned by the UFormattedValue.
- * @stable ICU 64
- */
-U_STABLE const UChar* U_EXPORT2
-ufmtval_getString(
- const UFormattedValue* ufmtval,
- int32_t* pLength,
- UErrorCode* ec);
-
-
-/**
- * Iterates over field positions in the UFormattedValue. This lets you determine the position
- * of specific types of substrings, like a month or a decimal separator.
- *
- * To loop over all field positions:
- *
- * UConstrainedFieldPosition* ucfpos = ucfpos_open(ec);
- * while (ufmtval_nextPosition(ufmtval, ucfpos, ec)) {
- * // handle the field position; get information from ucfpos
- * }
- * ucfpos_close(ucfpos);
- *
- * @param ufmtval
- * The object containing the formatted string and attributes.
- * @param ucfpos
- * The object used for iteration state; can provide constraints to iterate over only
- * one specific category or field;
- * see ucfpos_constrainCategory
- * and ucfpos_constrainField.
- * @param ec Set if an error occurs.
- * @return TRUE if another position was found; FALSE otherwise.
- * @stable ICU 64
- */
-U_STABLE UBool U_EXPORT2
-ufmtval_nextPosition(
- const UFormattedValue* ufmtval,
- UConstrainedFieldPosition* ucfpos,
- UErrorCode* ec);
-
-
-#if U_SHOW_CPLUSPLUS_API
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUConstrainedFieldPositionPointer
- * "Smart pointer" class; closes a UConstrainedFieldPosition via ucfpos_close().
- * For most methods see the LocalPointerBase base class.
- *
- * Usage:
- *
- * LocalUConstrainedFieldPositionPointer ucfpos(ucfpos_open(ec));
- * // no need to explicitly call ucfpos_close()
- *
- * @stable ICU 64
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUConstrainedFieldPositionPointer,
- UConstrainedFieldPosition,
- ucfpos_close);
-
-U_NAMESPACE_END
-#endif // U_SHOW_CPLUSPLUS_API
-
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif // __UFORMATTEDVALUE_H__
+ * @stable ICU 64
+ */
+ UFIELD_CATEGORY_UNDEFINED = 0,
+
+ /**
+ * For fields in UDateFormatField (udat.h), from ICU 3.0.
+ *
+ * @stable ICU 64
+ */
+ UFIELD_CATEGORY_DATE,
+
+ /**
+ * For fields in UNumberFormatFields (unum.h), from ICU 49.
+ *
+ * @stable ICU 64
+ */
+ UFIELD_CATEGORY_NUMBER,
+
+ /**
+ * For fields in UListFormatterField (ulistformatter.h), from ICU 63.
+ *
+ * @stable ICU 64
+ */
+ UFIELD_CATEGORY_LIST,
+
+ /**
+ * For fields in URelativeDateTimeFormatterField (ureldatefmt.h), from ICU 64.
+ *
+ * @stable ICU 64
+ */
+ UFIELD_CATEGORY_RELATIVE_DATETIME,
+
+ /**
+ * Reserved for possible future fields in UDateIntervalFormatField.
+ *
+ * @internal
+ */
+ UFIELD_CATEGORY_DATE_INTERVAL,
+
+#ifndef U_HIDE_INTERNAL_API
+ /** @internal */
+ UFIELD_CATEGORY_COUNT,
+#endif /* U_HIDE_INTERNAL_API */
+
+ /**
+ * Category for spans in a list.
+ *
+ * @stable ICU 64
+ */
+ UFIELD_CATEGORY_LIST_SPAN = 0x1000 + UFIELD_CATEGORY_LIST,
+
+ /**
+ * Category for spans in a date interval.
+ *
+ * @stable ICU 64
+ */
+ UFIELD_CATEGORY_DATE_INTERVAL_SPAN = 0x1000 + UFIELD_CATEGORY_DATE_INTERVAL,
+
+} UFieldCategory;
+
+
+struct UConstrainedFieldPosition;
+/**
+ * Represents a span of a string containing a given field.
+ *
+ * This struct differs from UFieldPosition in the following ways:
+ *
+ * 1. It has information on the field category.
+ * 2. It allows you to set constraints to use when iterating over field positions.
+ * 3. It is used for the newer FormattedValue APIs.
+ *
+ * @stable ICU 64
+ */
+typedef struct UConstrainedFieldPosition UConstrainedFieldPosition;
+
+
+/**
+ * Creates a new UConstrainedFieldPosition.
+ *
+ * By default, the UConstrainedFieldPosition has no iteration constraints.
+ *
+ * @param ec Set if an error occurs.
+ * @return The new object, or NULL if an error occurs.
+ * @stable ICU 64
+ */
+U_STABLE UConstrainedFieldPosition* U_EXPORT2
+ucfpos_open(UErrorCode* ec);
+
+
+/**
+ * Resets a UConstrainedFieldPosition to its initial state, as if it were newly created.
+ *
+ * Removes any constraints that may have been set on the instance.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param ec Set if an error occurs.
+ * @stable ICU 64
+ */
+U_STABLE void U_EXPORT2
+ucfpos_reset(
+ UConstrainedFieldPosition* ucfpos,
+ UErrorCode* ec);
+
+
+/**
+ * Destroys a UConstrainedFieldPosition and releases its memory.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @stable ICU 64
+ */
+U_STABLE void U_EXPORT2
+ucfpos_close(UConstrainedFieldPosition* ucfpos);
+
+
+/**
+ * Sets a constraint on the field category.
+ *
+ * When this instance of UConstrainedFieldPosition is passed to ufmtval_nextPosition,
+ * positions are skipped unless they have the given category.
+ *
+ * Any previously set constraints are cleared.
+ *
+ * For example, to loop over only the number-related fields:
+ *
+ * UConstrainedFieldPosition* ucfpos = ucfpos_open(ec);
+ * ucfpos_constrainCategory(ucfpos, UFIELDCATEGORY_NUMBER_FORMAT, ec);
+ * while (ufmtval_nextPosition(ufmtval, ucfpos, ec)) {
+ * // handle the number-related field position
+ * }
+ * ucfpos_close(ucfpos);
+ *
+ * Changing the constraint while in the middle of iterating over a FormattedValue
+ * does not generally have well-defined behavior.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param category The field category to fix when iterating.
+ * @param ec Set if an error occurs.
+ * @stable ICU 64
+ */
+U_STABLE void U_EXPORT2
+ucfpos_constrainCategory(
+ UConstrainedFieldPosition* ucfpos,
+ int32_t category,
+ UErrorCode* ec);
+
+
+/**
+ * Sets a constraint on the category and field.
+ *
+ * When this instance of UConstrainedFieldPosition is passed to ufmtval_nextPosition,
+ * positions are skipped unless they have the given category and field.
+ *
+ * Any previously set constraints are cleared.
+ *
+ * For example, to loop over all grouping separators:
+ *
+ * UConstrainedFieldPosition* ucfpos = ucfpos_open(ec);
+ * ucfpos_constrainField(ucfpos, UFIELDCATEGORY_NUMBER_FORMAT, UNUM_GROUPING_SEPARATOR_FIELD, ec);
+ * while (ufmtval_nextPosition(ufmtval, ucfpos, ec)) {
+ * // handle the grouping separator position
+ * }
+ * ucfpos_close(ucfpos);
+ *
+ * Changing the constraint while in the middle of iterating over a FormattedValue
+ * does not generally have well-defined behavior.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param category The field category to fix when iterating.
+ * @param field The field to fix when iterating.
+ * @param ec Set if an error occurs.
+ * @stable ICU 64
+ */
+U_STABLE void U_EXPORT2
+ucfpos_constrainField(
+ UConstrainedFieldPosition* ucfpos,
+ int32_t category,
+ int32_t field,
+ UErrorCode* ec);
+
+
+/**
+ * Gets the field category for the current position.
+ *
+ * If a category or field constraint was set, this function returns the constrained
+ * category. Otherwise, the return value is well-defined only after
+ * ufmtval_nextPosition returns TRUE.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param ec Set if an error occurs.
+ * @return The field category saved in the instance.
+ * @stable ICU 64
+ */
+U_STABLE int32_t U_EXPORT2
+ucfpos_getCategory(
+ const UConstrainedFieldPosition* ucfpos,
+ UErrorCode* ec);
+
+
+/**
+ * Gets the field for the current position.
+ *
+ * If a field constraint was set, this function returns the constrained
+ * field. Otherwise, the return value is well-defined only after
+ * ufmtval_nextPosition returns TRUE.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param ec Set if an error occurs.
+ * @return The field saved in the instance.
+ * @stable ICU 64
+ */
+U_STABLE int32_t U_EXPORT2
+ucfpos_getField(
+ const UConstrainedFieldPosition* ucfpos,
+ UErrorCode* ec);
+
+
+/**
+ * Gets the INCLUSIVE start and EXCLUSIVE end index stored for the current position.
+ *
+ * The output values are well-defined only after ufmtval_nextPosition returns TRUE.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param pStart Set to the start index saved in the instance. Ignored if nullptr.
+ * @param pLimit Set to the end index saved in the instance. Ignored if nullptr.
+ * @param ec Set if an error occurs.
+ * @stable ICU 64
+ */
+U_STABLE void U_EXPORT2
+ucfpos_getIndexes(
+ const UConstrainedFieldPosition* ucfpos,
+ int32_t* pStart,
+ int32_t* pLimit,
+ UErrorCode* ec);
+
+
+/**
+ * Gets an int64 that FormattedValue implementations may use for storage.
+ *
+ * The initial value is zero.
+ *
+ * Users of FormattedValue should not need to call this method.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param ec Set if an error occurs.
+ * @return The current iteration context from ucfpos_setInt64IterationContext.
+ * @stable ICU 64
+ */
+U_STABLE int64_t U_EXPORT2
+ucfpos_getInt64IterationContext(
+ const UConstrainedFieldPosition* ucfpos,
+ UErrorCode* ec);
+
+
+/**
+ * Sets an int64 that FormattedValue implementations may use for storage.
+ *
+ * Intended to be used by FormattedValue implementations.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param context The new iteration context.
+ * @param ec Set if an error occurs.
+ * @stable ICU 64
+ */
+U_STABLE void U_EXPORT2
+ucfpos_setInt64IterationContext(
+ UConstrainedFieldPosition* ucfpos,
+ int64_t context,
+ UErrorCode* ec);
+
+
+/**
+ * Determines whether a given field should be included given the
+ * constraints.
+ *
+ * Intended to be used by FormattedValue implementations.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param category The category to test.
+ * @param field The field to test.
+ * @param ec Set if an error occurs.
+ * @stable ICU 64
+ */
+U_STABLE UBool U_EXPORT2
+ucfpos_matchesField(
+ const UConstrainedFieldPosition* ucfpos,
+ int32_t category,
+ int32_t field,
+ UErrorCode* ec);
+
+
+/**
+ * Sets new values for the primary public getters.
+ *
+ * Intended to be used by FormattedValue implementations.
+ *
+ * It is up to the implementation to ensure that the user-requested
+ * constraints are satisfied. This method does not check!
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param category The new field category.
+ * @param field The new field.
+ * @param start The new inclusive start index.
+ * @param limit The new exclusive end index.
+ * @param ec Set if an error occurs.
+ * @stable ICU 64
+ */
+U_STABLE void U_EXPORT2
+ucfpos_setState(
+ UConstrainedFieldPosition* ucfpos,
+ int32_t category,
+ int32_t field,
+ int32_t start,
+ int32_t limit,
+ UErrorCode* ec);
+
+
+struct UFormattedValue;
+/**
+ * An abstract formatted value: a string with associated field attributes.
+ * Many formatters format to types compatible with UFormattedValue.
+ *
+ * @stable ICU 64
+ */
+typedef struct UFormattedValue UFormattedValue;
+
+
+/**
+ * Returns a pointer to the formatted string. The pointer is owned by the UFormattedValue. The
+ * return value is valid only as long as the UFormattedValue is present and unchanged in memory.
+ *
+ * The return value is NUL-terminated but could contain internal NULs.
+ *
+ * @param ufmtval
+ * The object containing the formatted string and attributes.
+ * @param pLength Output variable for the length of the string. Ignored if NULL.
+ * @param ec Set if an error occurs.
+ * @return A NUL-terminated char16 string owned by the UFormattedValue.
+ * @stable ICU 64
+ */
+U_STABLE const UChar* U_EXPORT2
+ufmtval_getString(
+ const UFormattedValue* ufmtval,
+ int32_t* pLength,
+ UErrorCode* ec);
+
+
+/**
+ * Iterates over field positions in the UFormattedValue. This lets you determine the position
+ * of specific types of substrings, like a month or a decimal separator.
+ *
+ * To loop over all field positions:
+ *
+ * UConstrainedFieldPosition* ucfpos = ucfpos_open(ec);
+ * while (ufmtval_nextPosition(ufmtval, ucfpos, ec)) {
+ * // handle the field position; get information from ucfpos
+ * }
+ * ucfpos_close(ucfpos);
+ *
+ * @param ufmtval
+ * The object containing the formatted string and attributes.
+ * @param ucfpos
+ * The object used for iteration state; can provide constraints to iterate over only
+ * one specific category or field;
+ * see ucfpos_constrainCategory
+ * and ucfpos_constrainField.
+ * @param ec Set if an error occurs.
+ * @return TRUE if another position was found; FALSE otherwise.
+ * @stable ICU 64
+ */
+U_STABLE UBool U_EXPORT2
+ufmtval_nextPosition(
+ const UFormattedValue* ufmtval,
+ UConstrainedFieldPosition* ucfpos,
+ UErrorCode* ec);
+
+
+#if U_SHOW_CPLUSPLUS_API
+U_NAMESPACE_BEGIN
+
+/**
+ * \class LocalUConstrainedFieldPositionPointer
+ * "Smart pointer" class; closes a UConstrainedFieldPosition via ucfpos_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * Usage:
+ *
+ * LocalUConstrainedFieldPositionPointer ucfpos(ucfpos_open(ec));
+ * // no need to explicitly call ucfpos_close()
+ *
+ * @stable ICU 64
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUConstrainedFieldPositionPointer,
+ UConstrainedFieldPosition,
+ ucfpos_close);
+
+U_NAMESPACE_END
+#endif // U_SHOW_CPLUSPLUS_API
+
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+#endif // __UFORMATTEDVALUE_H__
diff --git a/contrib/libs/icu/include/unicode/ugender.h b/contrib/libs/icu/include/unicode/ugender.h
index 3d5660f18b..903f3dd5de 100644
--- a/contrib/libs/icu/include/unicode/ugender.h
+++ b/contrib/libs/icu/include/unicode/ugender.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************************
@@ -49,7 +49,7 @@ enum UGender {
*/
typedef enum UGender UGender;
-struct UGenderInfo;
+struct UGenderInfo;
/**
* Opaque UGenderInfo object for use in C programs.
* @stable ICU 50
@@ -77,7 +77,7 @@ ugender_getInstance(const char *locale, UErrorCode *status);
* @stable ICU 50
*/
U_STABLE UGender U_EXPORT2
-ugender_getListGender(const UGenderInfo* genderInfo, const UGender *genders, int32_t size, UErrorCode *status);
+ugender_getListGender(const UGenderInfo* genderInfo, const UGender *genders, int32_t size, UErrorCode *status);
#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/include/unicode/uidna.h b/contrib/libs/icu/include/unicode/uidna.h
index 2747f03818..0dafb76201 100644
--- a/contrib/libs/icu/include/unicode/uidna.h
+++ b/contrib/libs/icu/include/unicode/uidna.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: uidna.h
- * encoding: UTF-8
+ * encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/include/unicode/uiter.h b/contrib/libs/icu/include/unicode/uiter.h
index aa4dad732c..11ad75acd5 100644
--- a/contrib/libs/icu/include/unicode/uiter.h
+++ b/contrib/libs/icu/include/unicode/uiter.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: uiter.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/include/unicode/uldnames.h b/contrib/libs/icu/include/unicode/uldnames.h
index 2365a1dd62..3ebffa23db 100644
--- a/contrib/libs/icu/include/unicode/uldnames.h
+++ b/contrib/libs/icu/include/unicode/uldnames.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/include/unicode/ulistformatter.h b/contrib/libs/icu/include/unicode/ulistformatter.h
index b10334240d..2bdf0f81f0 100644
--- a/contrib/libs/icu/include/unicode/ulistformatter.h
+++ b/contrib/libs/icu/include/unicode/ulistformatter.h
@@ -1,334 +1,334 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-*****************************************************************************************
-* Copyright (C) 2015-2016, International Business Machines
-* Corporation and others. All Rights Reserved.
-*****************************************************************************************
-*/
-
-#ifndef ULISTFORMATTER_H
-#define ULISTFORMATTER_H
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/localpointer.h"
-#include "unicode/uformattedvalue.h"
-
-/**
- * \file
- * \brief C API: Format a list in a locale-appropriate way.
- *
- * A UListFormatter is used to format a list of items in a locale-appropriate way,
- * using data from CLDR.
- * Example: Input data ["Alice", "Bob", "Charlie", "Delta"] will be formatted
- * as "Alice, Bob, Charlie, and Delta" in English.
- */
-
-/**
- * Opaque UListFormatter object for use in C
- * @stable ICU 55
- */
-struct UListFormatter;
-typedef struct UListFormatter UListFormatter; /**< C typedef for struct UListFormatter. @stable ICU 55 */
-
-struct UFormattedList;
-/**
- * Opaque struct to contain the results of a UListFormatter operation.
- * @stable ICU 64
- */
-typedef struct UFormattedList UFormattedList;
-
-/**
- * FieldPosition and UFieldPosition selectors for format fields
- * defined by ListFormatter.
- * @stable ICU 63
- */
-typedef enum UListFormatterField {
- /**
- * The literal text in the result which came from the resources.
- * @stable ICU 63
- */
- ULISTFMT_LITERAL_FIELD,
- /**
- * The element text in the result which came from the input strings.
- * @stable ICU 63
- */
- ULISTFMT_ELEMENT_FIELD
-} UListFormatterField;
-
-#ifndef U_HIDE_DRAFT_API
-/**
- * Type of meaning expressed by the list.
- *
- * @draft ICU 67
- */
-typedef enum UListFormatterType {
- /**
- * Conjunction formatting, e.g. "Alice, Bob, Charlie, and Delta".
- *
- * @draft ICU 67
- */
- ULISTFMT_TYPE_AND,
-
- /**
- * Disjunction (or alternative, or simply one of) formatting, e.g.
- * "Alice, Bob, Charlie, or Delta".
- *
- * @draft ICU 67
- */
- ULISTFMT_TYPE_OR,
-
- /**
- * Formatting of a list of values with units, e.g. "5 pounds, 12 ounces".
- *
- * @draft ICU 67
- */
- ULISTFMT_TYPE_UNITS
-} UListFormatterType;
-
-/**
- * Verbosity level of the list patterns.
- *
- * @draft ICU 67
- */
-typedef enum UListFormatterWidth {
- /**
- * Use list formatting with full words (no abbreviations) when possible.
- *
- * @draft ICU 67
- */
- ULISTFMT_WIDTH_WIDE,
-
- /**
- * Use list formatting of typical length.
- * @draft ICU 67
- */
- ULISTFMT_WIDTH_SHORT,
-
- /**
- * Use list formatting of the shortest possible length.
- * @draft ICU 67
- */
- ULISTFMT_WIDTH_NARROW,
-} UListFormatterWidth;
-#endif /* U_HIDE_DRAFT_API */
-
-/**
- * Open a new UListFormatter object using the rules for a given locale.
- * The object will be initialized with AND type and WIDE width.
- *
- * @param locale
- * The locale whose rules should be used; may be NULL for
- * default locale.
- * @param status
- * A pointer to a standard ICU UErrorCode (input/output parameter).
- * Its input value must pass the U_SUCCESS() test, or else the
- * function returns immediately. The caller should check its output
- * value with U_FAILURE(), or use with function chaining (see User
- * Guide for details).
- * @return
- * A pointer to a UListFormatter object for the specified locale,
- * or NULL if an error occurred.
- * @stable ICU 55
- */
-U_CAPI UListFormatter* U_EXPORT2
-ulistfmt_open(const char* locale,
- UErrorCode* status);
-
-#ifndef U_HIDE_DRAFT_API
-/**
- * Open a new UListFormatter object appropriate for the given locale, list type,
- * and style.
- *
- * @param locale
- * The locale whose rules should be used; may be NULL for
- * default locale.
- * @param type
- * The type of list formatting to use.
- * @param width
- * The width of formatting to use.
- * @param status
- * A pointer to a standard ICU UErrorCode (input/output parameter).
- * Its input value must pass the U_SUCCESS() test, or else the
- * function returns immediately. The caller should check its output
- * value with U_FAILURE(), or use with function chaining (see User
- * Guide for details).
- * @return
- * A pointer to a UListFormatter object for the specified locale,
- * or NULL if an error occurred.
- * @draft ICU 67
- */
-U_DRAFT UListFormatter* U_EXPORT2
-ulistfmt_openForType(const char* locale, UListFormatterType type,
- UListFormatterWidth width, UErrorCode* status);
-#endif /* U_HIDE_DRAFT_API */
-
-/**
- * Close a UListFormatter object. Once closed it may no longer be used.
- * @param listfmt
- * The UListFormatter object to close.
- * @stable ICU 55
- */
-U_CAPI void U_EXPORT2
-ulistfmt_close(UListFormatter *listfmt);
-
-/**
- * Creates an object to hold the result of a UListFormatter
- * operation. The object can be used repeatedly; it is cleared whenever
- * passed to a format function.
- *
- * @param ec Set if an error occurs.
- * @return A pointer needing ownership.
- * @stable ICU 64
- */
-U_CAPI UFormattedList* U_EXPORT2
-ulistfmt_openResult(UErrorCode* ec);
-
-/**
- * Returns a representation of a UFormattedList as a UFormattedValue,
- * which can be subsequently passed to any API requiring that type.
- *
- * The returned object is owned by the UFormattedList and is valid
- * only as long as the UFormattedList is present and unchanged in memory.
- *
- * You can think of this method as a cast between types.
- *
- * When calling ufmtval_nextPosition():
- * The fields are returned from start to end. The special field category
- * UFIELD_CATEGORY_LIST_SPAN is used to indicate which argument
- * was inserted at the given position. The span category will
- * always occur before the corresponding instance of UFIELD_CATEGORY_LIST
- * in the ufmtval_nextPosition() iterator.
- *
- * @param uresult The object containing the formatted string.
- * @param ec Set if an error occurs.
- * @return A UFormattedValue owned by the input object.
- * @stable ICU 64
- */
-U_CAPI const UFormattedValue* U_EXPORT2
-ulistfmt_resultAsValue(const UFormattedList* uresult, UErrorCode* ec);
-
-/**
- * Releases the UFormattedList created by ulistfmt_openResult().
- *
- * @param uresult The object to release.
- * @stable ICU 64
- */
-U_CAPI void U_EXPORT2
-ulistfmt_closeResult(UFormattedList* uresult);
-
-
-#if U_SHOW_CPLUSPLUS_API
-
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUListFormatterPointer
- * "Smart pointer" class, closes a UListFormatter via ulistfmt_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 55
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUListFormatterPointer, UListFormatter, ulistfmt_close);
-
-/**
- * \class LocalUFormattedListPointer
- * "Smart pointer" class, closes a UFormattedList via ulistfmt_closeResult().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 64
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedListPointer, UFormattedList, ulistfmt_closeResult);
-
-U_NAMESPACE_END
-
-#endif
-
-/**
- * Formats a list of strings using the conventions established for the
- * UListFormatter object.
- * @param listfmt
- * The UListFormatter object specifying the list conventions.
- * @param strings
- * An array of pointers to UChar strings; the array length is
- * specified by stringCount. Must be non-NULL if stringCount > 0.
- * @param stringLengths
- * An array of string lengths corresponding to the strings[]
- * parameter; any individual length value may be negative to indicate
- * that the corresponding strings[] entry is 0-terminated, or
- * stringLengths itself may be NULL if all of the strings are
- * 0-terminated. If non-NULL, the stringLengths array must have
- * stringCount entries.
- * @param stringCount
- * the number of entries in strings[], and the number of entries
- * in the stringLengths array if it is not NULL. Must be >= 0.
- * @param result
- * A pointer to a buffer to receive the formatted list.
- * @param resultCapacity
- * The maximum size of result.
- * @param status
- * A pointer to a standard ICU UErrorCode (input/output parameter).
- * Its input value must pass the U_SUCCESS() test, or else the
- * function returns immediately. The caller should check its output
- * value with U_FAILURE(), or use with function chaining (see User
- * Guide for details).
- * @return
- * The total buffer size needed; if greater than resultLength, the
- * output was truncated. May be <=0 if unable to determine the
- * total buffer size needed (e.g. for illegal arguments).
- * @stable ICU 55
- */
-U_CAPI int32_t U_EXPORT2
-ulistfmt_format(const UListFormatter* listfmt,
- const UChar* const strings[],
- const int32_t * stringLengths,
- int32_t stringCount,
- UChar* result,
- int32_t resultCapacity,
- UErrorCode* status);
-
-/**
- * Formats a list of strings to a UFormattedList, which exposes more
- * information than the string exported by ulistfmt_format().
- *
- * @param listfmt
- * The UListFormatter object specifying the list conventions.
- * @param strings
- * An array of pointers to UChar strings; the array length is
- * specified by stringCount. Must be non-NULL if stringCount > 0.
- * @param stringLengths
- * An array of string lengths corresponding to the strings[]
- * parameter; any individual length value may be negative to indicate
- * that the corresponding strings[] entry is 0-terminated, or
- * stringLengths itself may be NULL if all of the strings are
- * 0-terminated. If non-NULL, the stringLengths array must have
- * stringCount entries.
- * @param stringCount
- * the number of entries in strings[], and the number of entries
- * in the stringLengths array if it is not NULL. Must be >= 0.
- * @param uresult
- * The object in which to store the result of the list formatting
- * operation. See ulistfmt_openResult().
- * @param status
- * Error code set if an error occurred during formatting.
- * @stable ICU 64
- */
-U_CAPI void U_EXPORT2
-ulistfmt_formatStringsToResult(
- const UListFormatter* listfmt,
- const UChar* const strings[],
- const int32_t * stringLengths,
- int32_t stringCount,
- UFormattedList* uresult,
- UErrorCode* status);
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
-
-#endif
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*****************************************************************************************
+* Copyright (C) 2015-2016, International Business Machines
+* Corporation and others. All Rights Reserved.
+*****************************************************************************************
+*/
+
+#ifndef ULISTFORMATTER_H
+#define ULISTFORMATTER_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/localpointer.h"
+#include "unicode/uformattedvalue.h"
+
+/**
+ * \file
+ * \brief C API: Format a list in a locale-appropriate way.
+ *
+ * A UListFormatter is used to format a list of items in a locale-appropriate way,
+ * using data from CLDR.
+ * Example: Input data ["Alice", "Bob", "Charlie", "Delta"] will be formatted
+ * as "Alice, Bob, Charlie, and Delta" in English.
+ */
+
+/**
+ * Opaque UListFormatter object for use in C
+ * @stable ICU 55
+ */
+struct UListFormatter;
+typedef struct UListFormatter UListFormatter; /**< C typedef for struct UListFormatter. @stable ICU 55 */
+
+struct UFormattedList;
+/**
+ * Opaque struct to contain the results of a UListFormatter operation.
+ * @stable ICU 64
+ */
+typedef struct UFormattedList UFormattedList;
+
+/**
+ * FieldPosition and UFieldPosition selectors for format fields
+ * defined by ListFormatter.
+ * @stable ICU 63
+ */
+typedef enum UListFormatterField {
+ /**
+ * The literal text in the result which came from the resources.
+ * @stable ICU 63
+ */
+ ULISTFMT_LITERAL_FIELD,
+ /**
+ * The element text in the result which came from the input strings.
+ * @stable ICU 63
+ */
+ ULISTFMT_ELEMENT_FIELD
+} UListFormatterField;
+
+#ifndef U_HIDE_DRAFT_API
+/**
+ * Type of meaning expressed by the list.
+ *
+ * @draft ICU 67
+ */
+typedef enum UListFormatterType {
+ /**
+ * Conjunction formatting, e.g. "Alice, Bob, Charlie, and Delta".
+ *
+ * @draft ICU 67
+ */
+ ULISTFMT_TYPE_AND,
+
+ /**
+ * Disjunction (or alternative, or simply one of) formatting, e.g.
+ * "Alice, Bob, Charlie, or Delta".
+ *
+ * @draft ICU 67
+ */
+ ULISTFMT_TYPE_OR,
+
+ /**
+ * Formatting of a list of values with units, e.g. "5 pounds, 12 ounces".
+ *
+ * @draft ICU 67
+ */
+ ULISTFMT_TYPE_UNITS
+} UListFormatterType;
+
+/**
+ * Verbosity level of the list patterns.
+ *
+ * @draft ICU 67
+ */
+typedef enum UListFormatterWidth {
+ /**
+ * Use list formatting with full words (no abbreviations) when possible.
+ *
+ * @draft ICU 67
+ */
+ ULISTFMT_WIDTH_WIDE,
+
+ /**
+ * Use list formatting of typical length.
+ * @draft ICU 67
+ */
+ ULISTFMT_WIDTH_SHORT,
+
+ /**
+ * Use list formatting of the shortest possible length.
+ * @draft ICU 67
+ */
+ ULISTFMT_WIDTH_NARROW,
+} UListFormatterWidth;
+#endif /* U_HIDE_DRAFT_API */
+
+/**
+ * Open a new UListFormatter object using the rules for a given locale.
+ * The object will be initialized with AND type and WIDE width.
+ *
+ * @param locale
+ * The locale whose rules should be used; may be NULL for
+ * default locale.
+ * @param status
+ * A pointer to a standard ICU UErrorCode (input/output parameter).
+ * Its input value must pass the U_SUCCESS() test, or else the
+ * function returns immediately. The caller should check its output
+ * value with U_FAILURE(), or use with function chaining (see User
+ * Guide for details).
+ * @return
+ * A pointer to a UListFormatter object for the specified locale,
+ * or NULL if an error occurred.
+ * @stable ICU 55
+ */
+U_CAPI UListFormatter* U_EXPORT2
+ulistfmt_open(const char* locale,
+ UErrorCode* status);
+
+#ifndef U_HIDE_DRAFT_API
+/**
+ * Open a new UListFormatter object appropriate for the given locale, list type,
+ * and style.
+ *
+ * @param locale
+ * The locale whose rules should be used; may be NULL for
+ * default locale.
+ * @param type
+ * The type of list formatting to use.
+ * @param width
+ * The width of formatting to use.
+ * @param status
+ * A pointer to a standard ICU UErrorCode (input/output parameter).
+ * Its input value must pass the U_SUCCESS() test, or else the
+ * function returns immediately. The caller should check its output
+ * value with U_FAILURE(), or use with function chaining (see User
+ * Guide for details).
+ * @return
+ * A pointer to a UListFormatter object for the specified locale,
+ * or NULL if an error occurred.
+ * @draft ICU 67
+ */
+U_DRAFT UListFormatter* U_EXPORT2
+ulistfmt_openForType(const char* locale, UListFormatterType type,
+ UListFormatterWidth width, UErrorCode* status);
+#endif /* U_HIDE_DRAFT_API */
+
+/**
+ * Close a UListFormatter object. Once closed it may no longer be used.
+ * @param listfmt
+ * The UListFormatter object to close.
+ * @stable ICU 55
+ */
+U_CAPI void U_EXPORT2
+ulistfmt_close(UListFormatter *listfmt);
+
+/**
+ * Creates an object to hold the result of a UListFormatter
+ * operation. The object can be used repeatedly; it is cleared whenever
+ * passed to a format function.
+ *
+ * @param ec Set if an error occurs.
+ * @return A pointer needing ownership.
+ * @stable ICU 64
+ */
+U_CAPI UFormattedList* U_EXPORT2
+ulistfmt_openResult(UErrorCode* ec);
+
+/**
+ * Returns a representation of a UFormattedList as a UFormattedValue,
+ * which can be subsequently passed to any API requiring that type.
+ *
+ * The returned object is owned by the UFormattedList and is valid
+ * only as long as the UFormattedList is present and unchanged in memory.
+ *
+ * You can think of this method as a cast between types.
+ *
+ * When calling ufmtval_nextPosition():
+ * The fields are returned from start to end. The special field category
+ * UFIELD_CATEGORY_LIST_SPAN is used to indicate which argument
+ * was inserted at the given position. The span category will
+ * always occur before the corresponding instance of UFIELD_CATEGORY_LIST
+ * in the ufmtval_nextPosition() iterator.
+ *
+ * @param uresult The object containing the formatted string.
+ * @param ec Set if an error occurs.
+ * @return A UFormattedValue owned by the input object.
+ * @stable ICU 64
+ */
+U_CAPI const UFormattedValue* U_EXPORT2
+ulistfmt_resultAsValue(const UFormattedList* uresult, UErrorCode* ec);
+
+/**
+ * Releases the UFormattedList created by ulistfmt_openResult().
+ *
+ * @param uresult The object to release.
+ * @stable ICU 64
+ */
+U_CAPI void U_EXPORT2
+ulistfmt_closeResult(UFormattedList* uresult);
+
+
+#if U_SHOW_CPLUSPLUS_API
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \class LocalUListFormatterPointer
+ * "Smart pointer" class, closes a UListFormatter via ulistfmt_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 55
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUListFormatterPointer, UListFormatter, ulistfmt_close);
+
+/**
+ * \class LocalUFormattedListPointer
+ * "Smart pointer" class, closes a UFormattedList via ulistfmt_closeResult().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 64
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedListPointer, UFormattedList, ulistfmt_closeResult);
+
+U_NAMESPACE_END
+
+#endif
+
+/**
+ * Formats a list of strings using the conventions established for the
+ * UListFormatter object.
+ * @param listfmt
+ * The UListFormatter object specifying the list conventions.
+ * @param strings
+ * An array of pointers to UChar strings; the array length is
+ * specified by stringCount. Must be non-NULL if stringCount > 0.
+ * @param stringLengths
+ * An array of string lengths corresponding to the strings[]
+ * parameter; any individual length value may be negative to indicate
+ * that the corresponding strings[] entry is 0-terminated, or
+ * stringLengths itself may be NULL if all of the strings are
+ * 0-terminated. If non-NULL, the stringLengths array must have
+ * stringCount entries.
+ * @param stringCount
+ * the number of entries in strings[], and the number of entries
+ * in the stringLengths array if it is not NULL. Must be >= 0.
+ * @param result
+ * A pointer to a buffer to receive the formatted list.
+ * @param resultCapacity
+ * The maximum size of result.
+ * @param status
+ * A pointer to a standard ICU UErrorCode (input/output parameter).
+ * Its input value must pass the U_SUCCESS() test, or else the
+ * function returns immediately. The caller should check its output
+ * value with U_FAILURE(), or use with function chaining (see User
+ * Guide for details).
+ * @return
+ * The total buffer size needed; if greater than resultLength, the
+ * output was truncated. May be <=0 if unable to determine the
+ * total buffer size needed (e.g. for illegal arguments).
+ * @stable ICU 55
+ */
+U_CAPI int32_t U_EXPORT2
+ulistfmt_format(const UListFormatter* listfmt,
+ const UChar* const strings[],
+ const int32_t * stringLengths,
+ int32_t stringCount,
+ UChar* result,
+ int32_t resultCapacity,
+ UErrorCode* status);
+
+/**
+ * Formats a list of strings to a UFormattedList, which exposes more
+ * information than the string exported by ulistfmt_format().
+ *
+ * @param listfmt
+ * The UListFormatter object specifying the list conventions.
+ * @param strings
+ * An array of pointers to UChar strings; the array length is
+ * specified by stringCount. Must be non-NULL if stringCount > 0.
+ * @param stringLengths
+ * An array of string lengths corresponding to the strings[]
+ * parameter; any individual length value may be negative to indicate
+ * that the corresponding strings[] entry is 0-terminated, or
+ * stringLengths itself may be NULL if all of the strings are
+ * 0-terminated. If non-NULL, the stringLengths array must have
+ * stringCount entries.
+ * @param stringCount
+ * the number of entries in strings[], and the number of entries
+ * in the stringLengths array if it is not NULL. Must be >= 0.
+ * @param uresult
+ * The object in which to store the result of the list formatting
+ * operation. See ulistfmt_openResult().
+ * @param status
+ * Error code set if an error occurred during formatting.
+ * @stable ICU 64
+ */
+U_CAPI void U_EXPORT2
+ulistfmt_formatStringsToResult(
+ const UListFormatter* listfmt,
+ const UChar* const strings[],
+ const int32_t * stringLengths,
+ int32_t stringCount,
+ UFormattedList* uresult,
+ UErrorCode* status);
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif
diff --git a/contrib/libs/icu/include/unicode/uloc.h b/contrib/libs/icu/include/unicode/uloc.h
index ae6e2e38ca..d877ce49af 100644
--- a/contrib/libs/icu/include/unicode/uloc.h
+++ b/contrib/libs/icu/include/unicode/uloc.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -61,7 +61,7 @@
* http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt</a>
*
* <P>
- * The second option includes an additional <STRONG>ISO Country
+ * The second option includes an additional <STRONG>ISO Country
* Code.</STRONG> These codes are the upper-case two-letter codes
* as defined by ISO-3166.
* You can find a full list of these codes at a number of sites, such as:
@@ -69,7 +69,7 @@
* http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html</a>
*
* <P>
- * The third option requires another additional information--the
+ * The third option requires another additional information--the
* <STRONG>Variant.</STRONG>
* The Variant codes are vendor and browser-specific.
* For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX.
@@ -157,7 +157,7 @@
* <STRONG>just</STRONG> a mechanism for identifying these services.
*
* <P>
- * Each international service that performs locale-sensitive operations
+ * Each international service that performs locale-sensitive operations
* allows you
* to get all the available objects of that type. You can sift
* through these objects by language, country, or variant,
@@ -539,9 +539,9 @@ uloc_getISO3Country(const char* localeID);
* Gets the Win32 LCID value for the specified locale.
* If the ICU locale is not recognized by Windows, 0 will be returned.
*
- * LCIDs were deprecated with Windows Vista and Microsoft recommends
- * that developers use BCP47 style tags instead (uloc_toLanguageTag).
- *
+ * LCIDs were deprecated with Windows Vista and Microsoft recommends
+ * that developers use BCP47 style tags instead (uloc_toLanguageTag).
+ *
* @param localeID the locale to get the Win32 LCID value with
* @return country the Win32 LCID for localeID
* @stable ICU 2.0
@@ -580,7 +580,7 @@ uloc_getDisplayLanguage(const char* locale,
* if the locale's language code is "en", passing Locale::getFrench() for
* inLocale would result in "", while passing Locale::getGerman()
* for inLocale would result in "". NULL may be used to specify the default.
- * @param script the displayable script for the localeID
+ * @param script the displayable script for the localeID
* @param scriptCapacity the size of the script buffer to store the
* displayable script code with
* @param status error information if retrieving the displayable script code failed
@@ -742,18 +742,18 @@ uloc_getDisplayName(const char* localeID,
/**
- * Gets the specified locale from a list of available locales.
- *
- * This method corresponds to uloc_openAvailableByType called with the
- * ULOC_AVAILABLE_DEFAULT type argument.
- *
- * The return value is a pointer to an item of a locale name array. Both this
- * array and the pointers it contains are owned by ICU and should not be
- * deleted or written through by the caller. The locale name is terminated by
- * a null pointer.
- *
- * @param n the specific locale name index of the available locale list;
- * should not exceed the number returned by uloc_countAvailable.
+ * Gets the specified locale from a list of available locales.
+ *
+ * This method corresponds to uloc_openAvailableByType called with the
+ * ULOC_AVAILABLE_DEFAULT type argument.
+ *
+ * The return value is a pointer to an item of a locale name array. Both this
+ * array and the pointers it contains are owned by ICU and should not be
+ * deleted or written through by the caller. The locale name is terminated by
+ * a null pointer.
+ *
+ * @param n the specific locale name index of the available locale list;
+ * should not exceed the number returned by uloc_countAvailable.
* @return a specified locale name of all available locales
* @stable ICU 2.0
*/
@@ -768,74 +768,74 @@ uloc_getAvailable(int32_t n);
*/
U_STABLE int32_t U_EXPORT2 uloc_countAvailable(void);
-#ifndef U_HIDE_DRAFT_API
-
+#ifndef U_HIDE_DRAFT_API
+
/**
- * Types for uloc_getAvailableByType and uloc_countAvailableByType.
- *
- * @draft ICU 65
- */
-typedef enum ULocAvailableType {
- /**
- * Locales that return data when passed to ICU APIs,
- * but not including legacy or alias locales.
- *
- * @draft ICU 65
- */
- ULOC_AVAILABLE_DEFAULT,
-
- /**
- * Legacy or alias locales that return data when passed to ICU APIs.
- * Examples of supported legacy or alias locales:
- *
- * - iw (alias to he)
- * - mo (alias to ro)
- * - zh_CN (alias to zh_Hans_CN)
- * - sr_BA (alias to sr_Cyrl_BA)
- * - ars (alias to ar_SA)
- *
- * The locales in this set are disjoint from the ones in
- * ULOC_AVAILABLE_DEFAULT. To get both sets at the same time, use
- * ULOC_AVAILABLE_WITH_LEGACY_ALIASES.
- *
- * @draft ICU 65
- */
- ULOC_AVAILABLE_ONLY_LEGACY_ALIASES,
-
- /**
- * The union of the locales in ULOC_AVAILABLE_DEFAULT and
- * ULOC_AVAILABLE_ONLY_LEGACY_ALIAS.
- *
- * @draft ICU 65
- */
- ULOC_AVAILABLE_WITH_LEGACY_ALIASES,
-
-#ifndef U_HIDE_INTERNAL_API
- /**
- * @internal
- */
- ULOC_AVAILABLE_COUNT
-#endif
-} ULocAvailableType;
-
-/**
- * Gets a list of available locales according to the type argument, allowing
- * the user to access different sets of supported locales in ICU.
- *
- * The returned UEnumeration must be closed by the caller.
- *
- * @param type Type choice from ULocAvailableType.
- * @param status Set if an error occurred.
- * @return a UEnumeration owned by the caller, or nullptr on failure.
- * @draft ICU 65
- */
-U_DRAFT UEnumeration* U_EXPORT2
-uloc_openAvailableByType(ULocAvailableType type, UErrorCode* status);
-
-#endif // U_HIDE_DRAFT_API
-
-/**
- *
+ * Types for uloc_getAvailableByType and uloc_countAvailableByType.
+ *
+ * @draft ICU 65
+ */
+typedef enum ULocAvailableType {
+ /**
+ * Locales that return data when passed to ICU APIs,
+ * but not including legacy or alias locales.
+ *
+ * @draft ICU 65
+ */
+ ULOC_AVAILABLE_DEFAULT,
+
+ /**
+ * Legacy or alias locales that return data when passed to ICU APIs.
+ * Examples of supported legacy or alias locales:
+ *
+ * - iw (alias to he)
+ * - mo (alias to ro)
+ * - zh_CN (alias to zh_Hans_CN)
+ * - sr_BA (alias to sr_Cyrl_BA)
+ * - ars (alias to ar_SA)
+ *
+ * The locales in this set are disjoint from the ones in
+ * ULOC_AVAILABLE_DEFAULT. To get both sets at the same time, use
+ * ULOC_AVAILABLE_WITH_LEGACY_ALIASES.
+ *
+ * @draft ICU 65
+ */
+ ULOC_AVAILABLE_ONLY_LEGACY_ALIASES,
+
+ /**
+ * The union of the locales in ULOC_AVAILABLE_DEFAULT and
+ * ULOC_AVAILABLE_ONLY_LEGACY_ALIAS.
+ *
+ * @draft ICU 65
+ */
+ ULOC_AVAILABLE_WITH_LEGACY_ALIASES,
+
+#ifndef U_HIDE_INTERNAL_API
+ /**
+ * @internal
+ */
+ ULOC_AVAILABLE_COUNT
+#endif
+} ULocAvailableType;
+
+/**
+ * Gets a list of available locales according to the type argument, allowing
+ * the user to access different sets of supported locales in ICU.
+ *
+ * The returned UEnumeration must be closed by the caller.
+ *
+ * @param type Type choice from ULocAvailableType.
+ * @param status Set if an error occurred.
+ * @return a UEnumeration owned by the caller, or nullptr on failure.
+ * @draft ICU 65
+ */
+U_DRAFT UEnumeration* U_EXPORT2
+uloc_openAvailableByType(ULocAvailableType type, UErrorCode* status);
+
+#endif // U_HIDE_DRAFT_API
+
+/**
+ *
* Gets a list of all available 2-letter language codes defined in ISO 639,
* plus additional 3-letter codes determined to be useful for locale generation as
* defined by Unicode CLDR. This is a pointer
@@ -927,12 +927,12 @@ uloc_openKeywords(const char* localeID,
* Get the value for a keyword. Locale name does not need to be normalized.
*
* @param localeID locale name containing the keyword ("de_DE@currency=EURO;collation=PHONEBOOK")
- * @param keywordName name of the keyword for which we want the value; must not be
- * NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive.
+ * @param keywordName name of the keyword for which we want the value; must not be
+ * NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive.
* @param buffer receiving buffer
* @param bufferCapacity capacity of receiving buffer
- * @param status containing error code: e.g. buffer not big enough or ill-formed localeID
- * or keywordName parameters.
+ * @param status containing error code: e.g. buffer not big enough or ill-formed localeID
+ * or keywordName parameters.
* @return the length of keyword value
* @stable ICU 2.8
*/
@@ -949,26 +949,26 @@ uloc_getKeywordValue(const char* localeID,
* For removing all keywords, use uloc_getBaseName().
*
* NOTE: Unlike almost every other ICU function which takes a
- * buffer, this function will NOT truncate the output text, and will
- * not update the buffer with unterminated text setting a status of
- * U_STRING_NOT_TERMINATED_WARNING. If a BUFFER_OVERFLOW_ERROR is received,
- * it means a terminated version of the updated locale ID would not fit
- * in the buffer, and the original buffer is untouched. This is done to
- * prevent incorrect or possibly even malformed locales from being generated
- * and used.
- *
- * @param keywordName name of the keyword to be set; must not be
- * NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive.
+ * buffer, this function will NOT truncate the output text, and will
+ * not update the buffer with unterminated text setting a status of
+ * U_STRING_NOT_TERMINATED_WARNING. If a BUFFER_OVERFLOW_ERROR is received,
+ * it means a terminated version of the updated locale ID would not fit
+ * in the buffer, and the original buffer is untouched. This is done to
+ * prevent incorrect or possibly even malformed locales from being generated
+ * and used.
+ *
+ * @param keywordName name of the keyword to be set; must not be
+ * NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive.
* @param keywordValue value of the keyword to be set. If 0-length or
- * NULL, will result in the keyword being removed; no error is given if
- * that keyword does not exist. Otherwise, must consist only of
- * [A-Za-z0-9] and [/_+-].
- * @param buffer input buffer containing well-formed locale ID to be
- * modified.
+ * NULL, will result in the keyword being removed; no error is given if
+ * that keyword does not exist. Otherwise, must consist only of
+ * [A-Za-z0-9] and [/_+-].
+ * @param buffer input buffer containing well-formed locale ID to be
+ * modified.
* @param bufferCapacity capacity of receiving buffer
- * @param status containing error code: e.g. buffer not big enough
- * or ill-formed keywordName or keywordValue parameters, or ill-formed
- * locale ID in buffer on input.
+ * @param status containing error code: e.g. buffer not big enough
+ * or ill-formed keywordName or keywordValue parameters, or ill-formed
+ * locale ID in buffer on input.
* @return the length needed for the buffer
* @see uloc_getKeywordValue
* @stable ICU 3.2
@@ -1034,45 +1034,45 @@ uloc_getLineOrientation(const char* localeId,
UErrorCode *status);
/**
- * Output values which uloc_acceptLanguage() writes to the 'outResult' parameter.
- *
+ * Output values which uloc_acceptLanguage() writes to the 'outResult' parameter.
+ *
* @see uloc_acceptLanguageFromHTTP
* @see uloc_acceptLanguage
* @stable ICU 3.2
*/
typedef enum {
- /**
- * No exact match was found.
- * @stable ICU 3.2
- */
- ULOC_ACCEPT_FAILED = 0,
- /**
- * An exact match was found.
- * @stable ICU 3.2
- */
- ULOC_ACCEPT_VALID = 1,
- /**
- * A fallback was found. For example, the Accept-Language list includes 'ja_JP'
- * and is matched with available locale 'ja'.
- * @stable ICU 3.2
- */
- ULOC_ACCEPT_FALLBACK = 2 /* */
+ /**
+ * No exact match was found.
+ * @stable ICU 3.2
+ */
+ ULOC_ACCEPT_FAILED = 0,
+ /**
+ * An exact match was found.
+ * @stable ICU 3.2
+ */
+ ULOC_ACCEPT_VALID = 1,
+ /**
+ * A fallback was found. For example, the Accept-Language list includes 'ja_JP'
+ * and is matched with available locale 'ja'.
+ * @stable ICU 3.2
+ */
+ ULOC_ACCEPT_FALLBACK = 2 /* */
} UAcceptResult;
/**
* Based on a HTTP header from a web browser and a list of available locales,
* determine an acceptable locale for the user.
- *
- * This is a thin wrapper over C++ class LocaleMatcher.
- *
+ *
+ * This is a thin wrapper over C++ class LocaleMatcher.
+ *
* @param result - buffer to accept the result locale
* @param resultAvailable the size of the result buffer.
* @param outResult - An out parameter that contains the fallback status
* @param httpAcceptLanguage - "Accept-Language:" header as per HTTP.
* @param availableLocales - list of available locales to match
- * @param status 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.)
+ * @param status 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 length needed for the locale.
* @stable ICU 3.2
*/
@@ -1086,18 +1086,18 @@ uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable,
/**
* Based on a list of available locales,
* determine an acceptable locale for the user.
- *
- * This is a thin wrapper over C++ class LocaleMatcher.
- *
+ *
+ * This is a thin wrapper over C++ class LocaleMatcher.
+ *
* @param result - buffer to accept the result locale
* @param resultAvailable the size of the result buffer.
* @param outResult - An out parameter that contains the fallback status
* @param acceptList - list of acceptable languages
* @param acceptListCount - count of acceptList items
* @param availableLocales - list of available locales to match
- * @param status 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.)
+ * @param status 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 length needed for the locale.
* @stable ICU 3.2
*/
diff --git a/contrib/libs/icu/include/unicode/ulocdata.h b/contrib/libs/icu/include/unicode/ulocdata.h
index dc936d31de..de8d8539c6 100644
--- a/contrib/libs/icu/include/unicode/ulocdata.h
+++ b/contrib/libs/icu/include/unicode/ulocdata.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
* *
******************************************************************************
* file name: ulocdata.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -55,7 +55,7 @@ typedef enum ULocaleDataExemplarSetType {
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
ULOCDATA_ES_COUNT=4
-#endif /* U_HIDE_DEPRECATED_API */
+#endif /* U_HIDE_DEPRECATED_API */
} ULocaleDataExemplarSetType;
/** The possible types of delimiters.
@@ -76,7 +76,7 @@ typedef enum ULocaleDataDelimiterType {
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
ULOCDATA_DELIMITER_COUNT = 4
-#endif /* U_HIDE_DEPRECATED_API */
+#endif /* U_HIDE_DEPRECATED_API */
} ULocaleDataDelimiterType;
/**
@@ -207,7 +207,7 @@ typedef enum UMeasurementSystem {
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
UMS_LIMIT
-#endif /* U_HIDE_DEPRECATED_API */
+#endif /* U_HIDE_DEPRECATED_API */
} UMeasurementSystem;
/**
diff --git a/contrib/libs/icu/include/unicode/umachine.h b/contrib/libs/icu/include/unicode/umachine.h
index bebdedb337..5f883b4ba5 100644
--- a/contrib/libs/icu/include/unicode/umachine.h
+++ b/contrib/libs/icu/include/unicode/umachine.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: umachine.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -125,9 +125,9 @@
* May result in an error if it applied to something not an override.
* @internal
*/
-#ifndef U_OVERRIDE
-#define U_OVERRIDE override
-#endif
+#ifndef U_OVERRIDE
+#define U_OVERRIDE override
+#endif
/**
* \def U_FINAL
@@ -136,45 +136,45 @@
* May result in an error if subclasses attempt to override.
* @internal
*/
-#if !defined(U_FINAL) || defined(U_IN_DOXYGEN)
+#if !defined(U_FINAL) || defined(U_IN_DOXYGEN)
#define U_FINAL final
#endif
-
-// Before ICU 65, function-like, multi-statement ICU macros were just defined as
-// series of statements wrapped in { } blocks and the caller could choose to
-// either treat them as if they were actual functions and end the invocation
-// with a trailing ; creating an empty statement after the block or else omit
-// this trailing ; using the knowledge that the macro would expand to { }.
-//
-// But doing so doesn't work well with macros that look like functions and
-// compiler warnings about empty statements (ICU-20601) and ICU 65 therefore
-// switches to the standard solution of wrapping such macros in do { } while.
-//
-// This will however break existing code that depends on being able to invoke
-// these macros without a trailing ; so to be able to remain compatible with
-// such code the wrapper is itself defined as macros so that it's possible to
-// build ICU 65 and later with the old macro behaviour, like this:
-//
-// export CPPFLAGS='-DUPRV_BLOCK_MACRO_BEGIN="" -DUPRV_BLOCK_MACRO_END=""'
-// runConfigureICU ...
-//
-
-/**
- * \def UPRV_BLOCK_MACRO_BEGIN
- * Defined as the "do" keyword by default.
- * @internal
- */
-#ifndef UPRV_BLOCK_MACRO_BEGIN
-#define UPRV_BLOCK_MACRO_BEGIN do
+
+// Before ICU 65, function-like, multi-statement ICU macros were just defined as
+// series of statements wrapped in { } blocks and the caller could choose to
+// either treat them as if they were actual functions and end the invocation
+// with a trailing ; creating an empty statement after the block or else omit
+// this trailing ; using the knowledge that the macro would expand to { }.
+//
+// But doing so doesn't work well with macros that look like functions and
+// compiler warnings about empty statements (ICU-20601) and ICU 65 therefore
+// switches to the standard solution of wrapping such macros in do { } while.
+//
+// This will however break existing code that depends on being able to invoke
+// these macros without a trailing ; so to be able to remain compatible with
+// such code the wrapper is itself defined as macros so that it's possible to
+// build ICU 65 and later with the old macro behaviour, like this:
+//
+// export CPPFLAGS='-DUPRV_BLOCK_MACRO_BEGIN="" -DUPRV_BLOCK_MACRO_END=""'
+// runConfigureICU ...
+//
+
+/**
+ * \def UPRV_BLOCK_MACRO_BEGIN
+ * Defined as the "do" keyword by default.
+ * @internal
+ */
+#ifndef UPRV_BLOCK_MACRO_BEGIN
+#define UPRV_BLOCK_MACRO_BEGIN do
#endif
-
-/**
- * \def UPRV_BLOCK_MACRO_END
- * Defined as "while (FALSE)" by default.
- * @internal
- */
-#ifndef UPRV_BLOCK_MACRO_END
-#define UPRV_BLOCK_MACRO_END while (FALSE)
+
+/**
+ * \def UPRV_BLOCK_MACRO_END
+ * Defined as "while (FALSE)" by default.
+ * @internal
+ */
+#ifndef UPRV_BLOCK_MACRO_END
+#define UPRV_BLOCK_MACRO_END while (FALSE)
#endif
/*==========================================================================*/
@@ -316,96 +316,96 @@ typedef int8_t UBool;
#define U_SIZEOF_UCHAR 2
/**
- * \def U_CHAR16_IS_TYPEDEF
- * If 1, then char16_t is a typedef and not a real type (yet)
- * @internal
- */
-#if (U_PLATFORM == U_PF_AIX) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11)
-// for AIX, uchar.h needs to be included
-# error #include <uchar.h>
-# define U_CHAR16_IS_TYPEDEF 1
-#elif defined(_MSC_VER) && (_MSC_VER < 1900)
-// Versions of Visual Studio/MSVC below 2015 do not support char16_t as a real type,
-// and instead use a typedef. https://msdn.microsoft.com/library/bb531344.aspx
-# define U_CHAR16_IS_TYPEDEF 1
-#else
-# define U_CHAR16_IS_TYPEDEF 0
-#endif
-
-
-/**
+ * \def U_CHAR16_IS_TYPEDEF
+ * If 1, then char16_t is a typedef and not a real type (yet)
+ * @internal
+ */
+#if (U_PLATFORM == U_PF_AIX) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11)
+// for AIX, uchar.h needs to be included
+# error #include <uchar.h>
+# define U_CHAR16_IS_TYPEDEF 1
+#elif defined(_MSC_VER) && (_MSC_VER < 1900)
+// Versions of Visual Studio/MSVC below 2015 do not support char16_t as a real type,
+// and instead use a typedef. https://msdn.microsoft.com/library/bb531344.aspx
+# define U_CHAR16_IS_TYPEDEF 1
+#else
+# define U_CHAR16_IS_TYPEDEF 0
+#endif
+
+
+/**
* \var UChar
*
- * The base type for UTF-16 code units and pointers.
- * Unsigned 16-bit integer.
- * Starting with ICU 59, C++ API uses char16_t directly, while C API continues to use UChar.
+ * The base type for UTF-16 code units and pointers.
+ * Unsigned 16-bit integer.
+ * Starting with ICU 59, C++ API uses char16_t directly, while C API continues to use UChar.
+ *
+ * UChar is configurable by defining the macro UCHAR_TYPE
+ * on the preprocessor or compiler command line:
+ * -DUCHAR_TYPE=uint16_t or -DUCHAR_TYPE=wchar_t (if U_SIZEOF_WCHAR_T==2) etc.
+ * (The UCHAR_TYPE can also be \#defined earlier in this file, for outside the ICU library code.)
+ * This is for transitional use from application code that uses uint16_t or wchar_t for UTF-16.
+ *
+ * The default is UChar=char16_t.
+ *
+ * C++11 defines char16_t as bit-compatible with uint16_t, but as a distinct type.
+ *
+ * In C, char16_t is a simple typedef of uint_least16_t.
+ * ICU requires uint_least16_t=uint16_t for data memory mapping.
+ * On macOS, char16_t is not available because the uchar.h standard header is missing.
*
- * UChar is configurable by defining the macro UCHAR_TYPE
- * on the preprocessor or compiler command line:
- * -DUCHAR_TYPE=uint16_t or -DUCHAR_TYPE=wchar_t (if U_SIZEOF_WCHAR_T==2) etc.
- * (The UCHAR_TYPE can also be \#defined earlier in this file, for outside the ICU library code.)
- * This is for transitional use from application code that uses uint16_t or wchar_t for UTF-16.
- *
- * The default is UChar=char16_t.
- *
- * C++11 defines char16_t as bit-compatible with uint16_t, but as a distinct type.
- *
- * In C, char16_t is a simple typedef of uint_least16_t.
- * ICU requires uint_least16_t=uint16_t for data memory mapping.
- * On macOS, char16_t is not available because the uchar.h standard header is missing.
- *
* @stable ICU 4.4
*/
-
-#if 1
- // #if 1 is normal. UChar defaults to char16_t in C++.
- // For configuration testing of UChar=uint16_t temporarily change this to #if 0.
- // The intltest Makefile #defines UCHAR_TYPE=char16_t,
- // so we only #define it to uint16_t if it is undefined so far.
-#elif !defined(UCHAR_TYPE)
-# define UCHAR_TYPE uint16_t
-#endif
-
-#if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \
- defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION)
- // Inside the ICU library code, never configurable.
- typedef char16_t UChar;
-#elif defined(UCHAR_TYPE)
+
+#if 1
+ // #if 1 is normal. UChar defaults to char16_t in C++.
+ // For configuration testing of UChar=uint16_t temporarily change this to #if 0.
+ // The intltest Makefile #defines UCHAR_TYPE=char16_t,
+ // so we only #define it to uint16_t if it is undefined so far.
+#elif !defined(UCHAR_TYPE)
+# define UCHAR_TYPE uint16_t
+#endif
+
+#if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \
+ defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION)
+ // Inside the ICU library code, never configurable.
+ typedef char16_t UChar;
+#elif defined(UCHAR_TYPE)
typedef UCHAR_TYPE UChar;
-#elif (U_CPLUSPLUS_VERSION >= 11)
- typedef char16_t UChar;
+#elif (U_CPLUSPLUS_VERSION >= 11)
+ typedef char16_t UChar;
#else
typedef uint16_t UChar;
#endif
/**
- * \var OldUChar
- * Default ICU 58 definition of UChar.
- * A base type for UTF-16 code units and pointers.
- * Unsigned 16-bit integer.
- *
- * Define OldUChar to be wchar_t if that is 16 bits wide.
- * If wchar_t is not 16 bits wide, then define UChar to be uint16_t.
- *
- * This makes the definition of OldUChar platform-dependent
- * but allows direct string type compatibility with platforms with
- * 16-bit wchar_t types.
- *
- * This is how UChar was defined in ICU 58, for transition convenience.
- * Exception: ICU 58 UChar was defined to UCHAR_TYPE if that macro was defined.
- * The current UChar responds to UCHAR_TYPE but OldUChar does not.
- *
- * @stable ICU 59
- */
-#if U_SIZEOF_WCHAR_T==2
- typedef wchar_t OldUChar;
-#elif defined(__CHAR16_TYPE__)
- typedef __CHAR16_TYPE__ OldUChar;
-#else
- typedef uint16_t OldUChar;
-#endif
-
-/**
+ * \var OldUChar
+ * Default ICU 58 definition of UChar.
+ * A base type for UTF-16 code units and pointers.
+ * Unsigned 16-bit integer.
+ *
+ * Define OldUChar to be wchar_t if that is 16 bits wide.
+ * If wchar_t is not 16 bits wide, then define UChar to be uint16_t.
+ *
+ * This makes the definition of OldUChar platform-dependent
+ * but allows direct string type compatibility with platforms with
+ * 16-bit wchar_t types.
+ *
+ * This is how UChar was defined in ICU 58, for transition convenience.
+ * Exception: ICU 58 UChar was defined to UCHAR_TYPE if that macro was defined.
+ * The current UChar responds to UCHAR_TYPE but OldUChar does not.
+ *
+ * @stable ICU 59
+ */
+#if U_SIZEOF_WCHAR_T==2
+ typedef wchar_t OldUChar;
+#elif defined(__CHAR16_TYPE__)
+ typedef __CHAR16_TYPE__ OldUChar;
+#else
+ typedef uint16_t OldUChar;
+#endif
+
+/**
* Define UChar32 as a type for single Unicode code points.
* UChar32 is a signed 32-bit integer (same as int32_t).
*
diff --git a/contrib/libs/icu/include/unicode/umisc.h b/contrib/libs/icu/include/unicode/umisc.h
index 9b8c016218..213290b9af 100644
--- a/contrib/libs/icu/include/unicode/umisc.h
+++ b/contrib/libs/icu/include/unicode/umisc.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: umisc.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/include/unicode/umsg.h b/contrib/libs/icu/include/unicode/umsg.h
index 4a4c7435e7..5d235e42e8 100644
--- a/contrib/libs/icu/include/unicode/umsg.h
+++ b/contrib/libs/icu/include/unicode/umsg.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************
* COPYRIGHT:
@@ -8,7 +8,7 @@
********************************************************************
*
* file name: umsg.h
- * encoding: UTF-8
+ * encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/include/unicode/umutablecptrie.h b/contrib/libs/icu/include/unicode/umutablecptrie.h
index 3e1bbdd9f4..f2af36477d 100644
--- a/contrib/libs/icu/include/unicode/umutablecptrie.h
+++ b/contrib/libs/icu/include/unicode/umutablecptrie.h
@@ -1,238 +1,238 @@
-// © 2017 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-// umutablecptrie.h (split out of ucptrie.h)
-// created: 2018jan24 Markus W. Scherer
-
-#ifndef __UMUTABLECPTRIE_H__
-#define __UMUTABLECPTRIE_H__
-
-#include "unicode/utypes.h"
-
-#include "unicode/localpointer.h"
-#include "unicode/ucpmap.h"
-#include "unicode/ucptrie.h"
-#include "unicode/utf8.h"
-
-U_CDECL_BEGIN
-
-/**
- * \file
- *
- * This file defines a mutable Unicode code point trie.
- *
- * @see UCPTrie
- * @see UMutableCPTrie
- */
-
-/**
- * Mutable Unicode code point trie.
- * Fast map from Unicode code points (U+0000..U+10FFFF) to 32-bit integer values.
- * For details see http://site.icu-project.org/design/struct/utrie
- *
- * Setting values (especially ranges) and lookup is fast.
- * The mutable trie is only somewhat space-efficient.
- * It builds a compacted, immutable UCPTrie.
- *
- * This trie can be modified while iterating over its contents.
- * For example, it is possible to merge its values with those from another
- * set of ranges (e.g., another mutable or immutable trie):
- * Iterate over those source ranges; for each of them iterate over this trie;
- * add the source value into the value of each trie range.
- *
- * @see UCPTrie
- * @see umutablecptrie_buildImmutable
- * @stable ICU 63
- */
-typedef struct UMutableCPTrie UMutableCPTrie;
-
-/**
- * Creates a mutable trie that initially maps each Unicode code point to the same value.
- * It uses 32-bit data values until umutablecptrie_buildImmutable() is called.
- * umutablecptrie_buildImmutable() takes a valueWidth parameter which
- * determines the number of bits in the data value in the resulting UCPTrie.
- * You must umutablecptrie_close() the trie once you are done using it.
- *
- * @param initialValue the initial value that is set for all code points
- * @param errorValue the value for out-of-range code points and ill-formed UTF-8/16
- * @param pErrorCode an in/out ICU UErrorCode
- * @return the trie
- * @stable ICU 63
- */
-U_CAPI UMutableCPTrie * U_EXPORT2
-umutablecptrie_open(uint32_t initialValue, uint32_t errorValue, UErrorCode *pErrorCode);
-
-/**
- * Clones a mutable trie.
- * You must umutablecptrie_close() the clone once you are done using it.
- *
- * @param other the trie to clone
- * @param pErrorCode an in/out ICU UErrorCode
- * @return the trie clone
- * @stable ICU 63
- */
-U_CAPI UMutableCPTrie * U_EXPORT2
-umutablecptrie_clone(const UMutableCPTrie *other, UErrorCode *pErrorCode);
-
-/**
- * Closes a mutable trie and releases associated memory.
- *
- * @param trie the trie
- * @stable ICU 63
- */
-U_CAPI void U_EXPORT2
-umutablecptrie_close(UMutableCPTrie *trie);
-
-/**
- * Creates a mutable trie with the same contents as the UCPMap.
- * You must umutablecptrie_close() the mutable trie once you are done using it.
- *
- * @param map the source map
- * @param pErrorCode an in/out ICU UErrorCode
- * @return the mutable trie
- * @stable ICU 63
- */
-U_CAPI UMutableCPTrie * U_EXPORT2
-umutablecptrie_fromUCPMap(const UCPMap *map, UErrorCode *pErrorCode);
-
-/**
- * Creates a mutable trie with the same contents as the immutable one.
- * You must umutablecptrie_close() the mutable trie once you are done using it.
- *
- * @param trie the immutable trie
- * @param pErrorCode an in/out ICU UErrorCode
- * @return the mutable trie
- * @stable ICU 63
- */
-U_CAPI UMutableCPTrie * U_EXPORT2
-umutablecptrie_fromUCPTrie(const UCPTrie *trie, UErrorCode *pErrorCode);
-
-/**
- * Returns the value for a code point as stored in the trie.
- *
- * @param trie the trie
- * @param c the code point
- * @return the value
- * @stable ICU 63
- */
-U_CAPI uint32_t U_EXPORT2
-umutablecptrie_get(const UMutableCPTrie *trie, UChar32 c);
-
-/**
- * Returns the last code point such that all those from start to there have the same value.
- * Can be used to efficiently iterate over all same-value ranges in a trie.
- * (This is normally faster than iterating over code points and get()ting each value,
- * but much slower than a data structure that stores ranges directly.)
- *
- * The trie can be modified between calls to this function.
- *
- * If the UCPMapValueFilter function pointer is not NULL, then
- * the value to be delivered is passed through that function, and the return value is the end
- * of the range where all values are modified to the same actual value.
- * The value is unchanged if that function pointer is NULL.
- *
- * See the same-signature ucptrie_getRange() for a code sample.
- *
- * @param trie the trie
- * @param start range start
- * @param option defines whether surrogates are treated normally,
- * or as having the surrogateValue; usually UCPMAP_RANGE_NORMAL
- * @param surrogateValue value for surrogates; ignored if option==UCPMAP_RANGE_NORMAL
- * @param filter a pointer to a function that may modify the trie data value,
- * or NULL if the values from the trie are to be used unmodified
- * @param context an opaque pointer that is passed on to the filter function
- * @param pValue if not NULL, receives the value that every code point start..end has;
- * may have been modified by filter(context, trie value)
- * if that function pointer is not NULL
- * @return the range end code point, or -1 if start is not a valid code point
- * @stable ICU 63
- */
-U_CAPI UChar32 U_EXPORT2
-umutablecptrie_getRange(const UMutableCPTrie *trie, UChar32 start,
- UCPMapRangeOption option, uint32_t surrogateValue,
- UCPMapValueFilter *filter, const void *context, uint32_t *pValue);
-
-/**
- * Sets a value for a code point.
- *
- * @param trie the trie
- * @param c the code point
- * @param value the value
- * @param pErrorCode an in/out ICU UErrorCode
- * @stable ICU 63
- */
-U_CAPI void U_EXPORT2
-umutablecptrie_set(UMutableCPTrie *trie, UChar32 c, uint32_t value, UErrorCode *pErrorCode);
-
-/**
- * Sets a value for each code point [start..end].
- * Faster and more space-efficient than setting the value for each code point separately.
- *
- * @param trie the trie
- * @param start the first code point to get the value
- * @param end the last code point to get the value (inclusive)
- * @param value the value
- * @param pErrorCode an in/out ICU UErrorCode
- * @stable ICU 63
- */
-U_CAPI void U_EXPORT2
-umutablecptrie_setRange(UMutableCPTrie *trie,
- UChar32 start, UChar32 end,
- uint32_t value, UErrorCode *pErrorCode);
-
-/**
- * Compacts the data and builds an immutable UCPTrie according to the parameters.
- * After this, the mutable trie will be empty.
- *
- * The mutable trie stores 32-bit values until buildImmutable() is called.
- * If values shorter than 32 bits are to be stored in the immutable trie,
- * then the upper bits are discarded.
- * For example, when the mutable trie contains values 0x81, -0x7f, and 0xa581,
- * and the value width is 8 bits, then each of these is stored as 0x81
- * and the immutable trie will return that as an unsigned value.
- * (Some implementations may want to make productive temporary use of the upper bits
- * until buildImmutable() discards them.)
- *
- * Not every possible set of mappings can be built into a UCPTrie,
- * because of limitations resulting from speed and space optimizations.
- * Every Unicode assigned character can be mapped to a unique value.
- * Typical data yields data structures far smaller than the limitations.
- *
- * It is possible to construct extremely unusual mappings that exceed the data structure limits.
- * In such a case this function will fail with a U_INDEX_OUTOFBOUNDS_ERROR.
- *
- * @param trie the trie trie
- * @param type selects the trie type
- * @param valueWidth selects the number of bits in a trie data value; if smaller than 32 bits,
- * then the values stored in the trie will be truncated first
- * @param pErrorCode an in/out ICU UErrorCode
- *
- * @see umutablecptrie_fromUCPTrie
- * @stable ICU 63
- */
-U_CAPI UCPTrie * U_EXPORT2
-umutablecptrie_buildImmutable(UMutableCPTrie *trie, UCPTrieType type, UCPTrieValueWidth valueWidth,
- UErrorCode *pErrorCode);
-
-U_CDECL_END
-
-#if U_SHOW_CPLUSPLUS_API
-
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUMutableCPTriePointer
- * "Smart pointer" class, closes a UMutableCPTrie via umutablecptrie_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 63
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUMutableCPTriePointer, UMutableCPTrie, umutablecptrie_close);
-
-U_NAMESPACE_END
-
-#endif
-
-#endif
+// © 2017 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+// umutablecptrie.h (split out of ucptrie.h)
+// created: 2018jan24 Markus W. Scherer
+
+#ifndef __UMUTABLECPTRIE_H__
+#define __UMUTABLECPTRIE_H__
+
+#include "unicode/utypes.h"
+
+#include "unicode/localpointer.h"
+#include "unicode/ucpmap.h"
+#include "unicode/ucptrie.h"
+#include "unicode/utf8.h"
+
+U_CDECL_BEGIN
+
+/**
+ * \file
+ *
+ * This file defines a mutable Unicode code point trie.
+ *
+ * @see UCPTrie
+ * @see UMutableCPTrie
+ */
+
+/**
+ * Mutable Unicode code point trie.
+ * Fast map from Unicode code points (U+0000..U+10FFFF) to 32-bit integer values.
+ * For details see http://site.icu-project.org/design/struct/utrie
+ *
+ * Setting values (especially ranges) and lookup is fast.
+ * The mutable trie is only somewhat space-efficient.
+ * It builds a compacted, immutable UCPTrie.
+ *
+ * This trie can be modified while iterating over its contents.
+ * For example, it is possible to merge its values with those from another
+ * set of ranges (e.g., another mutable or immutable trie):
+ * Iterate over those source ranges; for each of them iterate over this trie;
+ * add the source value into the value of each trie range.
+ *
+ * @see UCPTrie
+ * @see umutablecptrie_buildImmutable
+ * @stable ICU 63
+ */
+typedef struct UMutableCPTrie UMutableCPTrie;
+
+/**
+ * Creates a mutable trie that initially maps each Unicode code point to the same value.
+ * It uses 32-bit data values until umutablecptrie_buildImmutable() is called.
+ * umutablecptrie_buildImmutable() takes a valueWidth parameter which
+ * determines the number of bits in the data value in the resulting UCPTrie.
+ * You must umutablecptrie_close() the trie once you are done using it.
+ *
+ * @param initialValue the initial value that is set for all code points
+ * @param errorValue the value for out-of-range code points and ill-formed UTF-8/16
+ * @param pErrorCode an in/out ICU UErrorCode
+ * @return the trie
+ * @stable ICU 63
+ */
+U_CAPI UMutableCPTrie * U_EXPORT2
+umutablecptrie_open(uint32_t initialValue, uint32_t errorValue, UErrorCode *pErrorCode);
+
+/**
+ * Clones a mutable trie.
+ * You must umutablecptrie_close() the clone once you are done using it.
+ *
+ * @param other the trie to clone
+ * @param pErrorCode an in/out ICU UErrorCode
+ * @return the trie clone
+ * @stable ICU 63
+ */
+U_CAPI UMutableCPTrie * U_EXPORT2
+umutablecptrie_clone(const UMutableCPTrie *other, UErrorCode *pErrorCode);
+
+/**
+ * Closes a mutable trie and releases associated memory.
+ *
+ * @param trie the trie
+ * @stable ICU 63
+ */
+U_CAPI void U_EXPORT2
+umutablecptrie_close(UMutableCPTrie *trie);
+
+/**
+ * Creates a mutable trie with the same contents as the UCPMap.
+ * You must umutablecptrie_close() the mutable trie once you are done using it.
+ *
+ * @param map the source map
+ * @param pErrorCode an in/out ICU UErrorCode
+ * @return the mutable trie
+ * @stable ICU 63
+ */
+U_CAPI UMutableCPTrie * U_EXPORT2
+umutablecptrie_fromUCPMap(const UCPMap *map, UErrorCode *pErrorCode);
+
+/**
+ * Creates a mutable trie with the same contents as the immutable one.
+ * You must umutablecptrie_close() the mutable trie once you are done using it.
+ *
+ * @param trie the immutable trie
+ * @param pErrorCode an in/out ICU UErrorCode
+ * @return the mutable trie
+ * @stable ICU 63
+ */
+U_CAPI UMutableCPTrie * U_EXPORT2
+umutablecptrie_fromUCPTrie(const UCPTrie *trie, UErrorCode *pErrorCode);
+
+/**
+ * Returns the value for a code point as stored in the trie.
+ *
+ * @param trie the trie
+ * @param c the code point
+ * @return the value
+ * @stable ICU 63
+ */
+U_CAPI uint32_t U_EXPORT2
+umutablecptrie_get(const UMutableCPTrie *trie, UChar32 c);
+
+/**
+ * Returns the last code point such that all those from start to there have the same value.
+ * Can be used to efficiently iterate over all same-value ranges in a trie.
+ * (This is normally faster than iterating over code points and get()ting each value,
+ * but much slower than a data structure that stores ranges directly.)
+ *
+ * The trie can be modified between calls to this function.
+ *
+ * If the UCPMapValueFilter function pointer is not NULL, then
+ * the value to be delivered is passed through that function, and the return value is the end
+ * of the range where all values are modified to the same actual value.
+ * The value is unchanged if that function pointer is NULL.
+ *
+ * See the same-signature ucptrie_getRange() for a code sample.
+ *
+ * @param trie the trie
+ * @param start range start
+ * @param option defines whether surrogates are treated normally,
+ * or as having the surrogateValue; usually UCPMAP_RANGE_NORMAL
+ * @param surrogateValue value for surrogates; ignored if option==UCPMAP_RANGE_NORMAL
+ * @param filter a pointer to a function that may modify the trie data value,
+ * or NULL if the values from the trie are to be used unmodified
+ * @param context an opaque pointer that is passed on to the filter function
+ * @param pValue if not NULL, receives the value that every code point start..end has;
+ * may have been modified by filter(context, trie value)
+ * if that function pointer is not NULL
+ * @return the range end code point, or -1 if start is not a valid code point
+ * @stable ICU 63
+ */
+U_CAPI UChar32 U_EXPORT2
+umutablecptrie_getRange(const UMutableCPTrie *trie, UChar32 start,
+ UCPMapRangeOption option, uint32_t surrogateValue,
+ UCPMapValueFilter *filter, const void *context, uint32_t *pValue);
+
+/**
+ * Sets a value for a code point.
+ *
+ * @param trie the trie
+ * @param c the code point
+ * @param value the value
+ * @param pErrorCode an in/out ICU UErrorCode
+ * @stable ICU 63
+ */
+U_CAPI void U_EXPORT2
+umutablecptrie_set(UMutableCPTrie *trie, UChar32 c, uint32_t value, UErrorCode *pErrorCode);
+
+/**
+ * Sets a value for each code point [start..end].
+ * Faster and more space-efficient than setting the value for each code point separately.
+ *
+ * @param trie the trie
+ * @param start the first code point to get the value
+ * @param end the last code point to get the value (inclusive)
+ * @param value the value
+ * @param pErrorCode an in/out ICU UErrorCode
+ * @stable ICU 63
+ */
+U_CAPI void U_EXPORT2
+umutablecptrie_setRange(UMutableCPTrie *trie,
+ UChar32 start, UChar32 end,
+ uint32_t value, UErrorCode *pErrorCode);
+
+/**
+ * Compacts the data and builds an immutable UCPTrie according to the parameters.
+ * After this, the mutable trie will be empty.
+ *
+ * The mutable trie stores 32-bit values until buildImmutable() is called.
+ * If values shorter than 32 bits are to be stored in the immutable trie,
+ * then the upper bits are discarded.
+ * For example, when the mutable trie contains values 0x81, -0x7f, and 0xa581,
+ * and the value width is 8 bits, then each of these is stored as 0x81
+ * and the immutable trie will return that as an unsigned value.
+ * (Some implementations may want to make productive temporary use of the upper bits
+ * until buildImmutable() discards them.)
+ *
+ * Not every possible set of mappings can be built into a UCPTrie,
+ * because of limitations resulting from speed and space optimizations.
+ * Every Unicode assigned character can be mapped to a unique value.
+ * Typical data yields data structures far smaller than the limitations.
+ *
+ * It is possible to construct extremely unusual mappings that exceed the data structure limits.
+ * In such a case this function will fail with a U_INDEX_OUTOFBOUNDS_ERROR.
+ *
+ * @param trie the trie trie
+ * @param type selects the trie type
+ * @param valueWidth selects the number of bits in a trie data value; if smaller than 32 bits,
+ * then the values stored in the trie will be truncated first
+ * @param pErrorCode an in/out ICU UErrorCode
+ *
+ * @see umutablecptrie_fromUCPTrie
+ * @stable ICU 63
+ */
+U_CAPI UCPTrie * U_EXPORT2
+umutablecptrie_buildImmutable(UMutableCPTrie *trie, UCPTrieType type, UCPTrieValueWidth valueWidth,
+ UErrorCode *pErrorCode);
+
+U_CDECL_END
+
+#if U_SHOW_CPLUSPLUS_API
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \class LocalUMutableCPTriePointer
+ * "Smart pointer" class, closes a UMutableCPTrie via umutablecptrie_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 63
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUMutableCPTriePointer, UMutableCPTrie, umutablecptrie_close);
+
+U_NAMESPACE_END
+
+#endif
+
+#endif
diff --git a/contrib/libs/icu/include/unicode/unifilt.h b/contrib/libs/icu/include/unicode/unifilt.h
index dbbafb3f78..420e1a1905 100644
--- a/contrib/libs/icu/include/unicode/unifilt.h
+++ b/contrib/libs/icu/include/unicode/unifilt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -12,10 +12,10 @@
#ifndef UNIFILT_H
#define UNIFILT_H
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/unifunct.h"
#include "unicode/unimatch.h"
@@ -34,7 +34,7 @@ U_NAMESPACE_BEGIN
* defined range.
* @stable ICU 3.0
*/
-#define U_ETHER ((char16_t)0xFFFF)
+#define U_ETHER ((char16_t)0xFFFF)
/**
*
@@ -72,14 +72,14 @@ public:
virtual ~UnicodeFilter();
/**
- * Clones this object polymorphically.
- * The caller owns the result and should delete it when done.
- * @return clone, or nullptr if an error occurred
- * @stable ICU 2.4
- */
- virtual UnicodeFilter* clone() const = 0;
-
- /**
+ * Clones this object polymorphically.
+ * The caller owns the result and should delete it when done.
+ * @return clone, or nullptr if an error occurred
+ * @stable ICU 2.4
+ */
+ virtual UnicodeFilter* clone() const = 0;
+
+ /**
* Returns <tt>true</tt> for characters that are in the selected
* subset. In other words, if a character is <b>to be
* filtered</b>, then <tt>contains()</tt> returns
@@ -131,6 +131,6 @@ protected:
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/unifunct.h b/contrib/libs/icu/include/unicode/unifunct.h
index 9c5e4ca4a2..7d31af7daf 100644
--- a/contrib/libs/icu/include/unicode/unifunct.h
+++ b/contrib/libs/icu/include/unicode/unifunct.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -13,9 +13,9 @@
#define UNIFUNCT_H
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
/**
@@ -127,6 +127,6 @@ protected:
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/unimatch.h b/contrib/libs/icu/include/unicode/unimatch.h
index e0b2b46f38..5a192b1b42 100644
--- a/contrib/libs/icu/include/unicode/unimatch.h
+++ b/contrib/libs/icu/include/unicode/unimatch.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
* Copyright (C) 2001-2005, International Business Machines Corporation and others. All Rights Reserved.
@@ -17,7 +17,7 @@
* \brief C++ API: Unicode Matcher
*/
-#if U_SHOW_CPLUSPLUS_API
+#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
@@ -163,6 +163,6 @@ public:
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/unirepl.h b/contrib/libs/icu/include/unicode/unirepl.h
index 01fd5d63a1..1ec627abcb 100644
--- a/contrib/libs/icu/include/unicode/unirepl.h
+++ b/contrib/libs/icu/include/unicode/unirepl.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -14,8 +14,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: UnicodeReplacer
@@ -98,6 +98,6 @@ class U_I18N_API UnicodeReplacer /* not : public UObject because this is an inte
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/uniset.h b/contrib/libs/icu/include/unicode/uniset.h
index f1984956c7..9742311003 100644
--- a/contrib/libs/icu/include/unicode/uniset.h
+++ b/contrib/libs/icu/include/unicode/uniset.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
***************************************************************************
@@ -13,11 +13,11 @@
#ifndef UNICODESET_H
#define UNICODESET_H
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
-#include "unicode/ucpmap.h"
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
+#include "unicode/ucpmap.h"
#include "unicode/unifilt.h"
#include "unicode/unistr.h"
#include "unicode/uset.h"
@@ -279,24 +279,24 @@ class RuleCharacterIterator;
* @stable ICU 2.0
*/
class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter {
-private:
- /**
- * Enough for sets with few ranges.
- * For example, White_Space has 10 ranges, list length 21.
- */
- static constexpr int32_t INITIAL_CAPACITY = 25;
- // fFlags constant
- static constexpr uint8_t kIsBogus = 1; // This set is bogus (i.e. not valid)
-
- UChar32* list = stackList; // MUST be terminated with HIGH
- int32_t capacity = INITIAL_CAPACITY; // capacity of list
- int32_t len = 1; // length of list used; 1 <= len <= capacity
- uint8_t fFlags = 0; // Bit flag (see constants above)
-
- BMPSet *bmpSet = nullptr; // The set is frozen iff either bmpSet or stringSpan is not NULL.
- UChar32* buffer = nullptr; // internal buffer, may be NULL
- int32_t bufferCapacity = 0; // capacity of buffer
-
+private:
+ /**
+ * Enough for sets with few ranges.
+ * For example, White_Space has 10 ranges, list length 21.
+ */
+ static constexpr int32_t INITIAL_CAPACITY = 25;
+ // fFlags constant
+ static constexpr uint8_t kIsBogus = 1; // This set is bogus (i.e. not valid)
+
+ UChar32* list = stackList; // MUST be terminated with HIGH
+ int32_t capacity = INITIAL_CAPACITY; // capacity of list
+ int32_t len = 1; // length of list used; 1 <= len <= capacity
+ uint8_t fFlags = 0; // Bit flag (see constants above)
+
+ BMPSet *bmpSet = nullptr; // The set is frozen iff either bmpSet or stringSpan is not NULL.
+ UChar32* buffer = nullptr; // internal buffer, may be NULL
+ int32_t bufferCapacity = 0; // capacity of buffer
+
/**
* The pattern representation of this set. This may not be the
* most economical pattern. It is the pattern supplied to
@@ -306,19 +306,19 @@ private:
* indicating that toPattern() must generate a pattern
* representation from the inversion list.
*/
- char16_t *pat = nullptr;
- int32_t patLen = 0;
-
- UVector* strings = nullptr; // maintained in sorted order
- UnicodeSetStringSpan *stringSpan = nullptr;
-
- /**
- * Initial list array.
- * Avoids some heap allocations, and list is never nullptr.
- * Increases the object size a bit.
- */
- UChar32 stackList[INITIAL_CAPACITY];
-
+ char16_t *pat = nullptr;
+ int32_t patLen = 0;
+
+ UVector* strings = nullptr; // maintained in sorted order
+ UnicodeSetStringSpan *stringSpan = nullptr;
+
+ /**
+ * Initial list array.
+ * Avoids some heap allocations, and list is never nullptr.
+ * Increases the object size a bit.
+ */
+ UChar32 stackList[INITIAL_CAPACITY];
+
public:
/**
* Determine if this object contains a valid set.
@@ -494,7 +494,7 @@ public:
* <tt>true</tt> if the specified set is not equal to this set.
* @stable ICU 2.0
*/
- inline UBool operator!=(const UnicodeSet& o) const;
+ inline UBool operator!=(const UnicodeSet& o) const;
/**
* Returns a copy of this object. All UnicodeFunctor objects have
@@ -505,7 +505,7 @@ public:
* @see cloneAsThawed
* @stable ICU 2.0
*/
- virtual UnicodeSet* clone() const;
+ virtual UnicodeSet* clone() const;
/**
* Returns the hash code value for this set.
@@ -583,7 +583,7 @@ public:
* @see cloneAsThawed
* @stable ICU 3.8
*/
- UnicodeSet *freeze();
+ UnicodeSet *freeze();
/**
* Clone the set and make the clone mutable.
@@ -593,15 +593,15 @@ public:
* @see isFrozen
* @stable ICU 3.8
*/
- UnicodeSet *cloneAsThawed() const;
+ UnicodeSet *cloneAsThawed() const;
//----------------------------------------------------------------
// Public API
//----------------------------------------------------------------
/**
- * Make this object represent the range `start - end`.
- * If `end > start` then this object is set to an empty range.
+ * Make this object represent the range `start - end`.
+ * If `end > start` then this object is set to an empty range.
* A frozen set will not be modified.
*
* @param start first character in the set, inclusive
@@ -906,7 +906,7 @@ public:
* @stable ICU 3.8
* @see USetSpanCondition
*/
- int32_t span(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const;
+ int32_t span(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const;
/**
* Returns the end of the substring of the input string according to the USetSpanCondition.
@@ -939,7 +939,7 @@ public:
* @stable ICU 3.8
* @see USetSpanCondition
*/
- int32_t spanBack(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const;
+ int32_t spanBack(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const;
/**
* Returns the start of the substring of the input string according to the USetSpanCondition.
@@ -1519,7 +1519,7 @@ private:
//----------------------------------------------------------------
UnicodeSet(const UnicodeSet& o, UBool /* asThawed */);
- UnicodeSet& copyFrom(const UnicodeSet& o, UBool asThawed);
+ UnicodeSet& copyFrom(const UnicodeSet& o, UBool asThawed);
//----------------------------------------------------------------
// Implementation: Pattern parsing
@@ -1535,25 +1535,25 @@ private:
UnicodeString& rebuiltPat,
uint32_t options,
UnicodeSet& (UnicodeSet::*caseClosure)(int32_t attribute),
- int32_t depth,
+ int32_t depth,
UErrorCode& ec);
//----------------------------------------------------------------
// Implementation: Utility methods
//----------------------------------------------------------------
- static int32_t nextCapacity(int32_t minCapacity);
+ static int32_t nextCapacity(int32_t minCapacity);
- bool ensureCapacity(int32_t newLen);
+ bool ensureCapacity(int32_t newLen);
+
+ bool ensureBufferCapacity(int32_t newLen);
- bool ensureBufferCapacity(int32_t newLen);
-
void swapBuffers(void);
UBool allocateStrings(UErrorCode &status);
- UBool hasStrings() const;
- int32_t stringsSize() const;
- UBool stringsContains(const UnicodeString &s) const;
+ UBool hasStrings() const;
+ int32_t stringsSize() const;
+ UBool stringsContains(const UnicodeString &s) const;
UnicodeString& _toPattern(UnicodeString& result,
UBool escapeUnprintable) const;
@@ -1652,21 +1652,21 @@ private:
*/
void applyFilter(Filter filter,
void* context,
- const UnicodeSet* inclusions,
+ const UnicodeSet* inclusions,
UErrorCode &status);
- // UCPMap is now stable ICU 63
- void applyIntPropertyValue(const UCPMap *map,
- UCPMapValueFilter *filter, const void *context,
- UErrorCode &errorCode);
-
+ // UCPMap is now stable ICU 63
+ void applyIntPropertyValue(const UCPMap *map,
+ UCPMapValueFilter *filter, const void *context,
+ UErrorCode &errorCode);
+
/**
* Set the new pattern to cache.
*/
- void setPattern(const UnicodeString& newPat) {
- setPattern(newPat.getBuffer(), newPat.length());
- }
- void setPattern(const char16_t *newPat, int32_t newPatLen);
+ void setPattern(const UnicodeString& newPat) {
+ setPattern(newPat.getBuffer(), newPat.length());
+ }
+ void setPattern(const char16_t *newPat, int32_t newPatLen);
/**
* Release existing cached pattern.
*/
@@ -1739,6 +1739,6 @@ inline int32_t UnicodeSet::spanBack(const UnicodeString &s, int32_t limit, USetS
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/unistr.h b/contrib/libs/icu/include/unicode/unistr.h
index a494aad6b3..da79053765 100644
--- a/contrib/libs/icu/include/unicode/unistr.h
+++ b/contrib/libs/icu/include/unicode/unistr.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -29,11 +29,11 @@
*/
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
-#include <cstddef>
-#include "unicode/char16ptr.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
+#include <cstddef>
+#include "unicode/char16ptr.h"
#include "unicode/rep.h"
#include "unicode/std_string.h"
#include "unicode/stringpiece.h"
@@ -49,31 +49,31 @@ U_STABLE int32_t U_EXPORT2
u_strlen(const UChar *s);
#endif
-U_NAMESPACE_BEGIN
+U_NAMESPACE_BEGIN
+
+#if !UCONFIG_NO_BREAK_ITERATION
+class BreakIterator; // unicode/brkiter.h
+#endif
+class Edits;
+
+U_NAMESPACE_END
-#if !UCONFIG_NO_BREAK_ITERATION
-class BreakIterator; // unicode/brkiter.h
-#endif
-class Edits;
-
-U_NAMESPACE_END
-
-// Not #ifndef U_HIDE_INTERNAL_API because UnicodeString needs the UStringCaseMapper.
+// Not #ifndef U_HIDE_INTERNAL_API because UnicodeString needs the UStringCaseMapper.
/**
* Internal string case mapping function type.
- * All error checking must be done.
- * src and dest must not overlap.
+ * All error checking must be done.
+ * src and dest must not overlap.
* @internal
*/
typedef int32_t U_CALLCONV
-UStringCaseMapper(int32_t caseLocale, uint32_t options,
-#if !UCONFIG_NO_BREAK_ITERATION
- icu::BreakIterator *iter,
+UStringCaseMapper(int32_t caseLocale, uint32_t options,
+#if !UCONFIG_NO_BREAK_ITERATION
+ icu::BreakIterator *iter,
#endif
- char16_t *dest, int32_t destCapacity,
- const char16_t *src, int32_t srcLength,
- icu::Edits *edits,
- UErrorCode &errorCode);
+ char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
+ icu::Edits *edits,
+ UErrorCode &errorCode);
U_NAMESPACE_BEGIN
@@ -97,25 +97,25 @@ class UnicodeStringAppendable; // unicode/appendable.h
/**
* Unicode String literals in C++.
- *
- * Note: these macros are not recommended for new code.
- * Prior to the availability of C++11 and u"unicode string literals",
- * these macros were provided for portability and efficiency when
- * initializing UnicodeStrings from literals.
- *
+ *
+ * Note: these macros are not recommended for new code.
+ * Prior to the availability of C++11 and u"unicode string literals",
+ * these macros were provided for portability and efficiency when
+ * initializing UnicodeStrings from literals.
+ *
* They work only for strings that contain "invariant characters", i.e.,
* only latin letters, digits, and some punctuation.
* See utypes.h for details.
*
* The string parameter must be a C string literal.
* The length of the string, not including the terminating
- * `NUL`, must be specified as a constant.
+ * `NUL`, must be specified as a constant.
* @stable ICU 2.0
*/
-#if !U_CHAR16_IS_TYPEDEF
-# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, u ## cs, _length)
+#if !U_CHAR16_IS_TYPEDEF
+# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, u ## cs, _length)
#else
-# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const char16_t*)u ## cs, _length)
+# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const char16_t*)u ## cs, _length)
#endif
/**
@@ -136,7 +136,7 @@ class UnicodeStringAppendable; // unicode/appendable.h
/**
* \def UNISTR_FROM_CHAR_EXPLICIT
* This can be defined to be empty or "explicit".
- * If explicit, then the UnicodeString(char16_t) and UnicodeString(UChar32)
+ * If explicit, then the UnicodeString(char16_t) and UnicodeString(UChar32)
* constructors are marked as explicit, preventing their inadvertent use.
* @stable ICU 49
*/
@@ -153,7 +153,7 @@ class UnicodeStringAppendable; // unicode/appendable.h
/**
* \def UNISTR_FROM_STRING_EXPLICIT
* This can be defined to be empty or "explicit".
- * If explicit, then the UnicodeString(const char *) and UnicodeString(const char16_t *)
+ * If explicit, then the UnicodeString(const char *) and UnicodeString(const char16_t *)
* constructors are marked as explicit, preventing their inadvertent use.
*
* In particular, this helps prevent accidentally depending on ICU conversion code
@@ -187,18 +187,18 @@ class UnicodeStringAppendable; // unicode/appendable.h
* to 4 * sizeof(pointer) (or 3 * sizeof(pointer) for P128 data models),
* to hold the fields for heap-allocated strings.
* Such a minimum size also ensures that the object is easily large enough
- * to hold at least 2 char16_ts, for one supplementary code point (U16_MAX_LENGTH).
+ * to hold at least 2 char16_ts, for one supplementary code point (U16_MAX_LENGTH).
*
* sizeof(UnicodeString) >= 48 should work for all known platforms.
*
* For example, on a 64-bit machine where sizeof(vtable pointer) is 8,
* sizeof(UnicodeString) = 64 would leave space for
* (64 - sizeof(vtable pointer) - 2) / U_SIZEOF_UCHAR = (64 - 8 - 2) / 2 = 27
- * char16_ts stored inside the object.
+ * char16_ts stored inside the object.
*
* The minimum object size on a 64-bit machine would be
* 4 * sizeof(pointer) = 4 * 8 = 32 bytes,
- * and the internal buffer would hold up to 11 char16_ts in that case.
+ * and the internal buffer would hold up to 11 char16_ts in that case.
*
* @see U16_MAX_LENGTH
* @stable ICU 56
@@ -212,9 +212,9 @@ class UnicodeStringAppendable; // unicode/appendable.h
* similar functionality as the Java String and StringBuffer/StringBuilder classes.
* It is a concrete implementation of the abstract class Replaceable (for transliteration).
*
- * The UnicodeString equivalent of std::string’s clear() is remove().
- *
- * A UnicodeString may "alias" an external array of characters
+ * The UnicodeString equivalent of std::string’s clear() is remove().
+ *
+ * A UnicodeString may "alias" an external array of characters
* (that is, point to it, rather than own the array)
* whose lifetime must then at least match the lifetime of the aliasing object.
* This aliasing may be preserved when returning a UnicodeString by value,
@@ -226,35 +226,35 @@ class UnicodeStringAppendable; // unicode/appendable.h
*
* The UnicodeString class is not suitable for subclassing.
*
- * For an overview of Unicode strings in C and C++ see the
- * [User Guide Strings chapter](http://userguide.icu-project.org/strings#TOC-Strings-in-C-C-).
+ * For an overview of Unicode strings in C and C++ see the
+ * [User Guide Strings chapter](http://userguide.icu-project.org/strings#TOC-Strings-in-C-C-).
*
- * In ICU, a Unicode string consists of 16-bit Unicode *code units*.
+ * In ICU, a Unicode string consists of 16-bit Unicode *code units*.
* A Unicode character may be stored with either one code unit
* (the most common case) or with a matched pair of special code units
- * ("surrogates"). The data type for code units is char16_t.
- * For single-character handling, a Unicode character code *point* is a value
- * in the range 0..0x10ffff. ICU uses the UChar32 type for code points.
+ * ("surrogates"). The data type for code units is char16_t.
+ * For single-character handling, a Unicode character code *point* is a value
+ * in the range 0..0x10ffff. ICU uses the UChar32 type for code points.
*
- * Indexes and offsets into and lengths of strings always count code units, not code points.
+ * Indexes and offsets into and lengths of strings always count code units, not code points.
* This is the same as with multi-byte char* strings in traditional string handling.
* Operations on partial strings typically do not test for code point boundaries.
* If necessary, the user needs to take care of such boundaries by testing for the code unit
* values or by using functions like
* UnicodeString::getChar32Start() and UnicodeString::getChar32Limit()
- * (or, in C, the equivalent macros U16_SET_CP_START() and U16_SET_CP_LIMIT(), see utf.h).
+ * (or, in C, the equivalent macros U16_SET_CP_START() and U16_SET_CP_LIMIT(), see utf.h).
*
* UnicodeString methods are more lenient with regard to input parameter values
* than other ICU APIs. In particular:
* - If indexes are out of bounds for a UnicodeString object
- * (< 0 or > length()) then they are "pinned" to the nearest boundary.
- * - If the buffer passed to an insert/append/replace operation is owned by the
- * target object, e.g., calling str.append(str), an extra copy may take place
- * to ensure safety.
- * - If primitive string pointer values (e.g., const char16_t * or char *)
+ * (< 0 or > length()) then they are "pinned" to the nearest boundary.
+ * - If the buffer passed to an insert/append/replace operation is owned by the
+ * target object, e.g., calling str.append(str), an extra copy may take place
+ * to ensure safety.
+ * - If primitive string pointer values (e.g., const char16_t * or char *)
* for input strings are NULL, then those input string parameters are treated
* as if they pointed to an empty string.
- * However, this is *not* the case for char * parameters for charset names
+ * However, this is *not* the case for char * parameters for charset names
* or other IDs.
* - Most UnicodeString methods do not take a UErrorCode parameter because
* there are usually very few opportunities for failure other than a shortage
@@ -278,14 +278,14 @@ class UnicodeStringAppendable; // unicode/appendable.h
* This includes the const UnicodeString & parameters for
* copy construction, assignment, and cloning.
*
- * UnicodeString uses several storage methods.
+ * UnicodeString uses several storage methods.
* String contents can be stored inside the UnicodeString object itself,
* in an allocated and shared buffer, or in an outside buffer that is "aliased".
* Most of this is done transparently, but careful aliasing in particular provides
* significant performance improvements.
* Also, the internal buffer is accessible via special functions.
* For details see the
- * [User Guide Strings chapter](http://userguide.icu-project.org/strings#TOC-Maximizing-Performance-with-the-UnicodeString-Storage-Model).
+ * [User Guide Strings chapter](http://userguide.icu-project.org/strings#TOC-Maximizing-Performance-with-the-UnicodeString-Storage-Model).
*
* @see utf.h
* @see CharacterIterator
@@ -320,7 +320,7 @@ public:
/**
* Equality operator. Performs only bitwise comparison.
* @param text The UnicodeString to compare to this one.
- * @return TRUE if `text` contains the same characters as this one,
+ * @return TRUE if `text` contains the same characters as this one,
* FALSE otherwise.
* @stable ICU 2.0
*/
@@ -329,7 +329,7 @@ public:
/**
* Inequality operator. Performs only bitwise comparison.
* @param text The UnicodeString to compare to this one.
- * @return FALSE if `text` contains the same characters as this one,
+ * @return FALSE if `text` contains the same characters as this one,
* TRUE otherwise.
* @stable ICU 2.0
*/
@@ -339,7 +339,7 @@ public:
* Greater than operator. Performs only bitwise comparison.
* @param text The UnicodeString to compare to this one.
* @return TRUE if the characters in this are bitwise
- * greater than the characters in `text`, FALSE otherwise
+ * greater than the characters in `text`, FALSE otherwise
* @stable ICU 2.0
*/
inline UBool operator> (const UnicodeString& text) const;
@@ -348,7 +348,7 @@ public:
* Less than operator. Performs only bitwise comparison.
* @param text The UnicodeString to compare to this one.
* @return TRUE if the characters in this are bitwise
- * less than the characters in `text`, FALSE otherwise
+ * less than the characters in `text`, FALSE otherwise
* @stable ICU 2.0
*/
inline UBool operator< (const UnicodeString& text) const;
@@ -357,7 +357,7 @@ public:
* Greater than or equal operator. Performs only bitwise comparison.
* @param text The UnicodeString to compare to this one.
* @return TRUE if the characters in this are bitwise
- * greater than or equal to the characters in `text`, FALSE otherwise
+ * greater than or equal to the characters in `text`, FALSE otherwise
* @stable ICU 2.0
*/
inline UBool operator>= (const UnicodeString& text) const;
@@ -366,37 +366,37 @@ public:
* Less than or equal operator. Performs only bitwise comparison.
* @param text The UnicodeString to compare to this one.
* @return TRUE if the characters in this are bitwise
- * less than or equal to the characters in `text`, FALSE otherwise
+ * less than or equal to the characters in `text`, FALSE otherwise
* @stable ICU 2.0
*/
inline UBool operator<= (const UnicodeString& text) const;
/**
* Compare the characters bitwise in this UnicodeString to
- * the characters in `text`.
+ * the characters in `text`.
* @param text The UnicodeString to compare to this one.
* @return The result of bitwise character comparison: 0 if this
- * contains the same characters as `text`, -1 if the characters in
- * this are bitwise less than the characters in `text`, +1 if the
+ * contains the same characters as `text`, -1 if the characters in
+ * this are bitwise less than the characters in `text`, +1 if the
* characters in this are bitwise greater than the characters
- * in `text`.
+ * in `text`.
* @stable ICU 2.0
*/
inline int8_t compare(const UnicodeString& text) const;
/**
* Compare the characters bitwise in the range
- * [`start`, `start + length`) with the characters
- * in the **entire string** `text`.
+ * [`start`, `start + length`) with the characters
+ * in the **entire string** `text`.
* (The parameters "start" and "length" are not applied to the other text "text".)
* @param start the offset at which the compare operation begins
* @param length the number of characters of text to compare.
* @param text the other text to be compared against this string.
* @return The result of bitwise character comparison: 0 if this
- * contains the same characters as `text`, -1 if the characters in
- * this are bitwise less than the characters in `text`, +1 if the
+ * contains the same characters as `text`, -1 if the characters in
+ * this are bitwise less than the characters in `text`, +1 if the
* characters in this are bitwise greater than the characters
- * in `text`.
+ * in `text`.
* @stable ICU 2.0
*/
inline int8_t compare(int32_t start,
@@ -405,19 +405,19 @@ public:
/**
* Compare the characters bitwise in the range
- * [`start`, `start + length`) with the characters
- * in `srcText` in the range
- * [`srcStart`, `srcStart + srcLength`).
+ * [`start`, `start + length`) with the characters
+ * in `srcText` in the range
+ * [`srcStart`, `srcStart + srcLength`).
* @param start the offset at which the compare operation begins
* @param length the number of characters in this to compare.
* @param srcText the text to be compared
- * @param srcStart the offset into `srcText` to start comparison
- * @param srcLength the number of characters in `src` to compare
+ * @param srcStart the offset into `srcText` to start comparison
+ * @param srcLength the number of characters in `src` to compare
* @return The result of bitwise character comparison: 0 if this
- * contains the same characters as `srcText`, -1 if the characters in
- * this are bitwise less than the characters in `srcText`, +1 if the
+ * contains the same characters as `srcText`, -1 if the characters in
+ * this are bitwise less than the characters in `srcText`, +1 if the
* characters in this are bitwise greater than the characters
- * in `srcText`.
+ * in `srcText`.
* @stable ICU 2.0
*/
inline int8_t compare(int32_t start,
@@ -428,75 +428,75 @@ public:
/**
* Compare the characters bitwise in this UnicodeString with the first
- * `srcLength` characters in `srcChars`.
+ * `srcLength` characters in `srcChars`.
* @param srcChars The characters to compare to this UnicodeString.
- * @param srcLength the number of characters in `srcChars` to compare
+ * @param srcLength the number of characters in `srcChars` to compare
* @return The result of bitwise character comparison: 0 if this
- * contains the same characters as `srcChars`, -1 if the characters in
- * this are bitwise less than the characters in `srcChars`, +1 if the
+ * contains the same characters as `srcChars`, -1 if the characters in
+ * this are bitwise less than the characters in `srcChars`, +1 if the
* characters in this are bitwise greater than the characters
- * in `srcChars`.
+ * in `srcChars`.
* @stable ICU 2.0
*/
- inline int8_t compare(ConstChar16Ptr srcChars,
+ inline int8_t compare(ConstChar16Ptr srcChars,
int32_t srcLength) const;
/**
* Compare the characters bitwise in the range
- * [`start`, `start + length`) with the first
- * `length` characters in `srcChars`
+ * [`start`, `start + length`) with the first
+ * `length` characters in `srcChars`
* @param start the offset at which the compare operation begins
* @param length the number of characters to compare.
* @param srcChars the characters to be compared
* @return The result of bitwise character comparison: 0 if this
- * contains the same characters as `srcChars`, -1 if the characters in
- * this are bitwise less than the characters in `srcChars`, +1 if the
+ * contains the same characters as `srcChars`, -1 if the characters in
+ * this are bitwise less than the characters in `srcChars`, +1 if the
* characters in this are bitwise greater than the characters
- * in `srcChars`.
+ * in `srcChars`.
* @stable ICU 2.0
*/
inline int8_t compare(int32_t start,
int32_t length,
- const char16_t *srcChars) const;
+ const char16_t *srcChars) const;
/**
* Compare the characters bitwise in the range
- * [`start`, `start + length`) with the characters
- * in `srcChars` in the range
- * [`srcStart`, `srcStart + srcLength`).
+ * [`start`, `start + length`) with the characters
+ * in `srcChars` in the range
+ * [`srcStart`, `srcStart + srcLength`).
* @param start the offset at which the compare operation begins
* @param length the number of characters in this to compare
* @param srcChars the characters to be compared
- * @param srcStart the offset into `srcChars` to start comparison
- * @param srcLength the number of characters in `srcChars` to compare
+ * @param srcStart the offset into `srcChars` to start comparison
+ * @param srcLength the number of characters in `srcChars` to compare
* @return The result of bitwise character comparison: 0 if this
- * contains the same characters as `srcChars`, -1 if the characters in
- * this are bitwise less than the characters in `srcChars`, +1 if the
+ * contains the same characters as `srcChars`, -1 if the characters in
+ * this are bitwise less than the characters in `srcChars`, +1 if the
* characters in this are bitwise greater than the characters
- * in `srcChars`.
+ * in `srcChars`.
* @stable ICU 2.0
*/
inline int8_t compare(int32_t start,
int32_t length,
- const char16_t *srcChars,
+ const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength) const;
/**
* Compare the characters bitwise in the range
- * [`start`, `limit`) with the characters
- * in `srcText` in the range
- * [`srcStart`, `srcLimit`).
+ * [`start`, `limit`) with the characters
+ * in `srcText` in the range
+ * [`srcStart`, `srcLimit`).
* @param start the offset at which the compare operation begins
* @param limit the offset immediately following the compare operation
* @param srcText the text to be compared
- * @param srcStart the offset into `srcText` to start comparison
- * @param srcLimit the offset into `srcText` to limit comparison
+ * @param srcStart the offset into `srcText` to start comparison
+ * @param srcLimit the offset into `srcText` to limit comparison
* @return The result of bitwise character comparison: 0 if this
- * contains the same characters as `srcText`, -1 if the characters in
- * this are bitwise less than the characters in `srcText`, +1 if the
+ * contains the same characters as `srcText`, -1 if the characters in
+ * this are bitwise less than the characters in `srcText`, +1 if the
* characters in this are bitwise greater than the characters
- * in `srcText`.
+ * in `srcText`.
* @stable ICU 2.0
*/
inline int8_t compareBetween(int32_t start,
@@ -592,7 +592,7 @@ public:
* in code point order
* @stable ICU 2.0
*/
- inline int8_t compareCodePointOrder(ConstChar16Ptr srcChars,
+ inline int8_t compareCodePointOrder(ConstChar16Ptr srcChars,
int32_t srcLength) const;
/**
@@ -616,7 +616,7 @@ public:
*/
inline int8_t compareCodePointOrder(int32_t start,
int32_t length,
- const char16_t *srcChars) const;
+ const char16_t *srcChars) const;
/**
* Compare two Unicode strings in code point order.
@@ -641,7 +641,7 @@ public:
*/
inline int8_t compareCodePointOrder(int32_t start,
int32_t length,
- const char16_t *srcChars,
+ const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength) const;
@@ -765,7 +765,7 @@ public:
* @return A negative, zero, or positive integer indicating the comparison result.
* @stable ICU 2.0
*/
- inline int8_t caseCompare(ConstChar16Ptr srcChars,
+ inline int8_t caseCompare(ConstChar16Ptr srcChars,
int32_t srcLength,
uint32_t options) const;
@@ -791,7 +791,7 @@ public:
*/
inline int8_t caseCompare(int32_t start,
int32_t length,
- const char16_t *srcChars,
+ const char16_t *srcChars,
uint32_t options) const;
/**
@@ -818,7 +818,7 @@ public:
*/
inline int8_t caseCompare(int32_t start,
int32_t length,
- const char16_t *srcChars,
+ const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength,
uint32_t options) const;
@@ -853,21 +853,21 @@ public:
uint32_t options) const;
/**
- * Determine if this starts with the characters in `text`
+ * Determine if this starts with the characters in `text`
* @param text The text to match.
- * @return TRUE if this starts with the characters in `text`,
+ * @return TRUE if this starts with the characters in `text`,
* FALSE otherwise
* @stable ICU 2.0
*/
inline UBool startsWith(const UnicodeString& text) const;
/**
- * Determine if this starts with the characters in `srcText`
- * in the range [`srcStart`, `srcStart + srcLength`).
+ * Determine if this starts with the characters in `srcText`
+ * in the range [`srcStart`, `srcStart + srcLength`).
* @param srcText The text to match.
- * @param srcStart the offset into `srcText` to start matching
- * @param srcLength the number of characters in `srcText` to match
- * @return TRUE if this starts with the characters in `text`,
+ * @param srcStart the offset into `srcText` to start matching
+ * @param srcLength the number of characters in `srcText` to match
+ * @return TRUE if this starts with the characters in `text`,
* FALSE otherwise
* @stable ICU 2.0
*/
@@ -876,45 +876,45 @@ public:
int32_t srcLength) const;
/**
- * Determine if this starts with the characters in `srcChars`
+ * Determine if this starts with the characters in `srcChars`
* @param srcChars The characters to match.
- * @param srcLength the number of characters in `srcChars`
- * @return TRUE if this starts with the characters in `srcChars`,
+ * @param srcLength the number of characters in `srcChars`
+ * @return TRUE if this starts with the characters in `srcChars`,
* FALSE otherwise
* @stable ICU 2.0
*/
- inline UBool startsWith(ConstChar16Ptr srcChars,
+ inline UBool startsWith(ConstChar16Ptr srcChars,
int32_t srcLength) const;
/**
- * Determine if this ends with the characters in `srcChars`
- * in the range [`srcStart`, `srcStart + srcLength`).
+ * Determine if this ends with the characters in `srcChars`
+ * in the range [`srcStart`, `srcStart + srcLength`).
* @param srcChars The characters to match.
- * @param srcStart the offset into `srcText` to start matching
- * @param srcLength the number of characters in `srcChars` to match
- * @return TRUE if this ends with the characters in `srcChars`, FALSE otherwise
+ * @param srcStart the offset into `srcText` to start matching
+ * @param srcLength the number of characters in `srcChars` to match
+ * @return TRUE if this ends with the characters in `srcChars`, FALSE otherwise
* @stable ICU 2.0
*/
- inline UBool startsWith(const char16_t *srcChars,
+ inline UBool startsWith(const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength) const;
/**
- * Determine if this ends with the characters in `text`
+ * Determine if this ends with the characters in `text`
* @param text The text to match.
- * @return TRUE if this ends with the characters in `text`,
+ * @return TRUE if this ends with the characters in `text`,
* FALSE otherwise
* @stable ICU 2.0
*/
inline UBool endsWith(const UnicodeString& text) const;
/**
- * Determine if this ends with the characters in `srcText`
- * in the range [`srcStart`, `srcStart + srcLength`).
+ * Determine if this ends with the characters in `srcText`
+ * in the range [`srcStart`, `srcStart + srcLength`).
* @param srcText The text to match.
- * @param srcStart the offset into `srcText` to start matching
- * @param srcLength the number of characters in `srcText` to match
- * @return TRUE if this ends with the characters in `text`,
+ * @param srcStart the offset into `srcText` to start matching
+ * @param srcLength the number of characters in `srcText` to match
+ * @return TRUE if this ends with the characters in `text`,
* FALSE otherwise
* @stable ICU 2.0
*/
@@ -923,27 +923,27 @@ public:
int32_t srcLength) const;
/**
- * Determine if this ends with the characters in `srcChars`
+ * Determine if this ends with the characters in `srcChars`
* @param srcChars The characters to match.
- * @param srcLength the number of characters in `srcChars`
- * @return TRUE if this ends with the characters in `srcChars`,
+ * @param srcLength the number of characters in `srcChars`
+ * @return TRUE if this ends with the characters in `srcChars`,
* FALSE otherwise
* @stable ICU 2.0
*/
- inline UBool endsWith(ConstChar16Ptr srcChars,
+ inline UBool endsWith(ConstChar16Ptr srcChars,
int32_t srcLength) const;
/**
- * Determine if this ends with the characters in `srcChars`
- * in the range [`srcStart`, `srcStart + srcLength`).
+ * Determine if this ends with the characters in `srcChars`
+ * in the range [`srcStart`, `srcStart + srcLength`).
* @param srcChars The characters to match.
- * @param srcStart the offset into `srcText` to start matching
- * @param srcLength the number of characters in `srcChars` to match
- * @return TRUE if this ends with the characters in `srcChars`,
+ * @param srcStart the offset into `srcText` to start matching
+ * @param srcLength the number of characters in `srcChars` to match
+ * @return TRUE if this ends with the characters in `srcChars`,
* FALSE otherwise
* @stable ICU 2.0
*/
- inline UBool endsWith(const char16_t *srcChars,
+ inline UBool endsWith(const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength) const;
@@ -951,21 +951,21 @@ public:
/* Searching - bitwise only */
/**
- * Locate in this the first occurrence of the characters in `text`,
+ * Locate in this the first occurrence of the characters in `text`,
* using bitwise comparison.
* @param text The text to search for.
- * @return The offset into this of the start of `text`,
+ * @return The offset into this of the start of `text`,
* or -1 if not found.
* @stable ICU 2.0
*/
inline int32_t indexOf(const UnicodeString& text) const;
/**
- * Locate in this the first occurrence of the characters in `text`
- * starting at offset `start`, using bitwise comparison.
+ * Locate in this the first occurrence of the characters in `text`
+ * starting at offset `start`, using bitwise comparison.
* @param text The text to search for.
* @param start The offset at which searching will start.
- * @return The offset into this of the start of `text`,
+ * @return The offset into this of the start of `text`,
* or -1 if not found.
* @stable ICU 2.0
*/
@@ -974,12 +974,12 @@ public:
/**
* Locate in this the first occurrence in the range
- * [`start`, `start + length`) of the characters
- * in `text`, using bitwise comparison.
+ * [`start`, `start + length`) of the characters
+ * in `text`, using bitwise comparison.
* @param text The text to search for.
* @param start The offset at which searching will start.
* @param length The number of characters to search
- * @return The offset into this of the start of `text`,
+ * @return The offset into this of the start of `text`,
* or -1 if not found.
* @stable ICU 2.0
*/
@@ -989,17 +989,17 @@ public:
/**
* Locate in this the first occurrence in the range
- * [`start`, `start + length`) of the characters
- * in `srcText` in the range
- * [`srcStart`, `srcStart + srcLength`),
+ * [`start`, `start + length`) of the characters
+ * in `srcText` in the range
+ * [`srcStart`, `srcStart + srcLength`),
* using bitwise comparison.
* @param srcText The text to search for.
- * @param srcStart the offset into `srcText` at which
+ * @param srcStart the offset into `srcText` at which
* to start matching
- * @param srcLength the number of characters in `srcText` to match
+ * @param srcLength the number of characters in `srcText` to match
* @param start the offset into this at which to start matching
* @param length the number of characters in this to search
- * @return The offset into this of the start of `text`,
+ * @return The offset into this of the start of `text`,
* or -1 if not found.
* @stable ICU 2.0
*/
@@ -1011,123 +1011,123 @@ public:
/**
* Locate in this the first occurrence of the characters in
- * `srcChars`
- * starting at offset `start`, using bitwise comparison.
+ * `srcChars`
+ * starting at offset `start`, using bitwise comparison.
* @param srcChars The text to search for.
- * @param srcLength the number of characters in `srcChars` to match
+ * @param srcLength the number of characters in `srcChars` to match
* @param start the offset into this at which to start matching
- * @return The offset into this of the start of `text`,
+ * @return The offset into this of the start of `text`,
* or -1 if not found.
* @stable ICU 2.0
*/
- inline int32_t indexOf(const char16_t *srcChars,
+ inline int32_t indexOf(const char16_t *srcChars,
int32_t srcLength,
int32_t start) const;
/**
* Locate in this the first occurrence in the range
- * [`start`, `start + length`) of the characters
- * in `srcChars`, using bitwise comparison.
+ * [`start`, `start + length`) of the characters
+ * in `srcChars`, using bitwise comparison.
* @param srcChars The text to search for.
- * @param srcLength the number of characters in `srcChars`
+ * @param srcLength the number of characters in `srcChars`
* @param start The offset at which searching will start.
* @param length The number of characters to search
- * @return The offset into this of the start of `srcChars`,
+ * @return The offset into this of the start of `srcChars`,
* or -1 if not found.
* @stable ICU 2.0
*/
- inline int32_t indexOf(ConstChar16Ptr srcChars,
+ inline int32_t indexOf(ConstChar16Ptr srcChars,
int32_t srcLength,
int32_t start,
int32_t length) const;
/**
* Locate in this the first occurrence in the range
- * [`start`, `start + length`) of the characters
- * in `srcChars` in the range
- * [`srcStart`, `srcStart + srcLength`),
+ * [`start`, `start + length`) of the characters
+ * in `srcChars` in the range
+ * [`srcStart`, `srcStart + srcLength`),
* using bitwise comparison.
* @param srcChars The text to search for.
- * @param srcStart the offset into `srcChars` at which
+ * @param srcStart the offset into `srcChars` at which
* to start matching
- * @param srcLength the number of characters in `srcChars` to match
+ * @param srcLength the number of characters in `srcChars` to match
* @param start the offset into this at which to start matching
* @param length the number of characters in this to search
- * @return The offset into this of the start of `text`,
+ * @return The offset into this of the start of `text`,
* or -1 if not found.
* @stable ICU 2.0
*/
- int32_t indexOf(const char16_t *srcChars,
+ int32_t indexOf(const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength,
int32_t start,
int32_t length) const;
/**
- * Locate in this the first occurrence of the BMP code point `c`,
+ * Locate in this the first occurrence of the BMP code point `c`,
* using bitwise comparison.
* @param c The code unit to search for.
- * @return The offset into this of `c`, or -1 if not found.
+ * @return The offset into this of `c`, or -1 if not found.
* @stable ICU 2.0
*/
- inline int32_t indexOf(char16_t c) const;
+ inline int32_t indexOf(char16_t c) const;
/**
- * Locate in this the first occurrence of the code point `c`,
+ * Locate in this the first occurrence of the code point `c`,
* using bitwise comparison.
*
* @param c The code point to search for.
- * @return The offset into this of `c`, or -1 if not found.
+ * @return The offset into this of `c`, or -1 if not found.
* @stable ICU 2.0
*/
inline int32_t indexOf(UChar32 c) const;
/**
- * Locate in this the first occurrence of the BMP code point `c`,
- * starting at offset `start`, using bitwise comparison.
+ * Locate in this the first occurrence of the BMP code point `c`,
+ * starting at offset `start`, using bitwise comparison.
* @param c The code unit to search for.
* @param start The offset at which searching will start.
- * @return The offset into this of `c`, or -1 if not found.
+ * @return The offset into this of `c`, or -1 if not found.
* @stable ICU 2.0
*/
- inline int32_t indexOf(char16_t c,
+ inline int32_t indexOf(char16_t c,
int32_t start) const;
/**
- * Locate in this the first occurrence of the code point `c`
- * starting at offset `start`, using bitwise comparison.
+ * Locate in this the first occurrence of the code point `c`
+ * starting at offset `start`, using bitwise comparison.
*
* @param c The code point to search for.
* @param start The offset at which searching will start.
- * @return The offset into this of `c`, or -1 if not found.
+ * @return The offset into this of `c`, or -1 if not found.
* @stable ICU 2.0
*/
inline int32_t indexOf(UChar32 c,
int32_t start) const;
/**
- * Locate in this the first occurrence of the BMP code point `c`
- * in the range [`start`, `start + length`),
+ * Locate in this the first occurrence of the BMP code point `c`
+ * in the range [`start`, `start + length`),
* using bitwise comparison.
* @param c The code unit to search for.
* @param start the offset into this at which to start matching
* @param length the number of characters in this to search
- * @return The offset into this of `c`, or -1 if not found.
+ * @return The offset into this of `c`, or -1 if not found.
* @stable ICU 2.0
*/
- inline int32_t indexOf(char16_t c,
+ inline int32_t indexOf(char16_t c,
int32_t start,
int32_t length) const;
/**
- * Locate in this the first occurrence of the code point `c`
- * in the range [`start`, `start + length`),
+ * Locate in this the first occurrence of the code point `c`
+ * in the range [`start`, `start + length`),
* using bitwise comparison.
*
* @param c The code point to search for.
* @param start the offset into this at which to start matching
* @param length the number of characters in this to search
- * @return The offset into this of `c`, or -1 if not found.
+ * @return The offset into this of `c`, or -1 if not found.
* @stable ICU 2.0
*/
inline int32_t indexOf(UChar32 c,
@@ -1135,21 +1135,21 @@ public:
int32_t length) const;
/**
- * Locate in this the last occurrence of the characters in `text`,
+ * Locate in this the last occurrence of the characters in `text`,
* using bitwise comparison.
* @param text The text to search for.
- * @return The offset into this of the start of `text`,
+ * @return The offset into this of the start of `text`,
* or -1 if not found.
* @stable ICU 2.0
*/
inline int32_t lastIndexOf(const UnicodeString& text) const;
/**
- * Locate in this the last occurrence of the characters in `text`
- * starting at offset `start`, using bitwise comparison.
+ * Locate in this the last occurrence of the characters in `text`
+ * starting at offset `start`, using bitwise comparison.
* @param text The text to search for.
* @param start The offset at which searching will start.
- * @return The offset into this of the start of `text`,
+ * @return The offset into this of the start of `text`,
* or -1 if not found.
* @stable ICU 2.0
*/
@@ -1158,12 +1158,12 @@ public:
/**
* Locate in this the last occurrence in the range
- * [`start`, `start + length`) of the characters
- * in `text`, using bitwise comparison.
+ * [`start`, `start + length`) of the characters
+ * in `text`, using bitwise comparison.
* @param text The text to search for.
* @param start The offset at which searching will start.
* @param length The number of characters to search
- * @return The offset into this of the start of `text`,
+ * @return The offset into this of the start of `text`,
* or -1 if not found.
* @stable ICU 2.0
*/
@@ -1173,17 +1173,17 @@ public:
/**
* Locate in this the last occurrence in the range
- * [`start`, `start + length`) of the characters
- * in `srcText` in the range
- * [`srcStart`, `srcStart + srcLength`),
+ * [`start`, `start + length`) of the characters
+ * in `srcText` in the range
+ * [`srcStart`, `srcStart + srcLength`),
* using bitwise comparison.
* @param srcText The text to search for.
- * @param srcStart the offset into `srcText` at which
+ * @param srcStart the offset into `srcText` at which
* to start matching
- * @param srcLength the number of characters in `srcText` to match
+ * @param srcLength the number of characters in `srcText` to match
* @param start the offset into this at which to start matching
* @param length the number of characters in this to search
- * @return The offset into this of the start of `text`,
+ * @return The offset into this of the start of `text`,
* or -1 if not found.
* @stable ICU 2.0
*/
@@ -1194,123 +1194,123 @@ public:
int32_t length) const;
/**
- * Locate in this the last occurrence of the characters in `srcChars`
- * starting at offset `start`, using bitwise comparison.
+ * Locate in this the last occurrence of the characters in `srcChars`
+ * starting at offset `start`, using bitwise comparison.
* @param srcChars The text to search for.
- * @param srcLength the number of characters in `srcChars` to match
+ * @param srcLength the number of characters in `srcChars` to match
* @param start the offset into this at which to start matching
- * @return The offset into this of the start of `text`,
+ * @return The offset into this of the start of `text`,
* or -1 if not found.
* @stable ICU 2.0
*/
- inline int32_t lastIndexOf(const char16_t *srcChars,
+ inline int32_t lastIndexOf(const char16_t *srcChars,
int32_t srcLength,
int32_t start) const;
/**
* Locate in this the last occurrence in the range
- * [`start`, `start + length`) of the characters
- * in `srcChars`, using bitwise comparison.
+ * [`start`, `start + length`) of the characters
+ * in `srcChars`, using bitwise comparison.
* @param srcChars The text to search for.
- * @param srcLength the number of characters in `srcChars`
+ * @param srcLength the number of characters in `srcChars`
* @param start The offset at which searching will start.
* @param length The number of characters to search
- * @return The offset into this of the start of `srcChars`,
+ * @return The offset into this of the start of `srcChars`,
* or -1 if not found.
* @stable ICU 2.0
*/
- inline int32_t lastIndexOf(ConstChar16Ptr srcChars,
+ inline int32_t lastIndexOf(ConstChar16Ptr srcChars,
int32_t srcLength,
int32_t start,
int32_t length) const;
/**
* Locate in this the last occurrence in the range
- * [`start`, `start + length`) of the characters
- * in `srcChars` in the range
- * [`srcStart`, `srcStart + srcLength`),
+ * [`start`, `start + length`) of the characters
+ * in `srcChars` in the range
+ * [`srcStart`, `srcStart + srcLength`),
* using bitwise comparison.
* @param srcChars The text to search for.
- * @param srcStart the offset into `srcChars` at which
+ * @param srcStart the offset into `srcChars` at which
* to start matching
- * @param srcLength the number of characters in `srcChars` to match
+ * @param srcLength the number of characters in `srcChars` to match
* @param start the offset into this at which to start matching
* @param length the number of characters in this to search
- * @return The offset into this of the start of `text`,
+ * @return The offset into this of the start of `text`,
* or -1 if not found.
* @stable ICU 2.0
*/
- int32_t lastIndexOf(const char16_t *srcChars,
+ int32_t lastIndexOf(const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength,
int32_t start,
int32_t length) const;
/**
- * Locate in this the last occurrence of the BMP code point `c`,
+ * Locate in this the last occurrence of the BMP code point `c`,
* using bitwise comparison.
* @param c The code unit to search for.
- * @return The offset into this of `c`, or -1 if not found.
+ * @return The offset into this of `c`, or -1 if not found.
* @stable ICU 2.0
*/
- inline int32_t lastIndexOf(char16_t c) const;
+ inline int32_t lastIndexOf(char16_t c) const;
/**
- * Locate in this the last occurrence of the code point `c`,
+ * Locate in this the last occurrence of the code point `c`,
* using bitwise comparison.
*
* @param c The code point to search for.
- * @return The offset into this of `c`, or -1 if not found.
+ * @return The offset into this of `c`, or -1 if not found.
* @stable ICU 2.0
*/
inline int32_t lastIndexOf(UChar32 c) const;
/**
- * Locate in this the last occurrence of the BMP code point `c`
- * starting at offset `start`, using bitwise comparison.
+ * Locate in this the last occurrence of the BMP code point `c`
+ * starting at offset `start`, using bitwise comparison.
* @param c The code unit to search for.
* @param start The offset at which searching will start.
- * @return The offset into this of `c`, or -1 if not found.
+ * @return The offset into this of `c`, or -1 if not found.
* @stable ICU 2.0
*/
- inline int32_t lastIndexOf(char16_t c,
+ inline int32_t lastIndexOf(char16_t c,
int32_t start) const;
/**
- * Locate in this the last occurrence of the code point `c`
- * starting at offset `start`, using bitwise comparison.
+ * Locate in this the last occurrence of the code point `c`
+ * starting at offset `start`, using bitwise comparison.
*
* @param c The code point to search for.
* @param start The offset at which searching will start.
- * @return The offset into this of `c`, or -1 if not found.
+ * @return The offset into this of `c`, or -1 if not found.
* @stable ICU 2.0
*/
inline int32_t lastIndexOf(UChar32 c,
int32_t start) const;
/**
- * Locate in this the last occurrence of the BMP code point `c`
- * in the range [`start`, `start + length`),
+ * Locate in this the last occurrence of the BMP code point `c`
+ * in the range [`start`, `start + length`),
* using bitwise comparison.
* @param c The code unit to search for.
* @param start the offset into this at which to start matching
* @param length the number of characters in this to search
- * @return The offset into this of `c`, or -1 if not found.
+ * @return The offset into this of `c`, or -1 if not found.
* @stable ICU 2.0
*/
- inline int32_t lastIndexOf(char16_t c,
+ inline int32_t lastIndexOf(char16_t c,
int32_t start,
int32_t length) const;
/**
- * Locate in this the last occurrence of the code point `c`
- * in the range [`start`, `start + length`),
+ * Locate in this the last occurrence of the code point `c`
+ * in the range [`start`, `start + length`),
* using bitwise comparison.
*
* @param c The code point to search for.
* @param start the offset into this at which to start matching
* @param length the number of characters in this to search
- * @return The offset into this of `c`, or -1 if not found.
+ * @return The offset into this of `c`, or -1 if not found.
* @stable ICU 2.0
*/
inline int32_t lastIndexOf(UChar32 c,
@@ -1321,32 +1321,32 @@ public:
/* Character access */
/**
- * Return the code unit at offset `offset`.
+ * Return the code unit at offset `offset`.
* If the offset is not valid (0..length()-1) then U+ffff is returned.
* @param offset a valid offset into the text
- * @return the code unit at offset `offset`
+ * @return the code unit at offset `offset`
* or 0xffff if the offset is not valid for this string
* @stable ICU 2.0
*/
- inline char16_t charAt(int32_t offset) const;
+ inline char16_t charAt(int32_t offset) const;
/**
- * Return the code unit at offset `offset`.
+ * Return the code unit at offset `offset`.
* If the offset is not valid (0..length()-1) then U+ffff is returned.
* @param offset a valid offset into the text
- * @return the code unit at offset `offset`
+ * @return the code unit at offset `offset`
* @stable ICU 2.0
*/
- inline char16_t operator[] (int32_t offset) const;
+ inline char16_t operator[] (int32_t offset) const;
/**
* Return the code point that contains the code unit
- * at offset `offset`.
+ * at offset `offset`.
* If the offset is not valid (0..length()-1) then U+ffff is returned.
* @param offset a valid offset into the text
* that indicates the text offset of any of the code units
* that will be assembled into a code point (21-bit value) and returned
- * @return the code point of text at `offset`
+ * @return the code point of text at `offset`
* or 0xffff if the offset is not valid for this string
* @stable ICU 2.0
*/
@@ -1403,33 +1403,33 @@ public:
* This behaves like CharacterIterator::move32(delta, kCurrent).
*
* Behavior for out-of-bounds indexes:
- * `moveIndex32` pins the input index to 0..length(), i.e.,
+ * `moveIndex32` pins the input index to 0..length(), i.e.,
* if the input index<0 then it is pinned to 0;
* if it is index>length() then it is pinned to length().
- * Afterwards, the index is moved by `delta` code points
+ * Afterwards, the index is moved by `delta` code points
* forward or backward,
* but no further backward than to 0 and no further forward than to length().
* The resulting index return value will be in between 0 and length(), inclusively.
*
* Examples:
- * \code
- * // s has code points 'a' U+10000 'b' U+10ffff U+2029
- * UnicodeString s(u"a\U00010000b\U0010ffff\u2029");
+ * \code
+ * // s has code points 'a' U+10000 'b' U+10ffff U+2029
+ * UnicodeString s(u"a\U00010000b\U0010ffff\u2029");
*
- * // initial index: position of U+10000
- * int32_t index=1;
+ * // initial index: position of U+10000
+ * int32_t index=1;
*
- * // the following examples will all result in index==4, position of U+10ffff
+ * // the following examples will all result in index==4, position of U+10ffff
*
- * // skip 2 code points from some position in the string
- * index=s.moveIndex32(index, 2); // skips U+10000 and 'b'
+ * // skip 2 code points from some position in the string
+ * index=s.moveIndex32(index, 2); // skips U+10000 and 'b'
*
- * // go to the 3rd code point from the start of s (0-based)
- * index=s.moveIndex32(0, 3); // skips 'a', U+10000, and 'b'
+ * // go to the 3rd code point from the start of s (0-based)
+ * index=s.moveIndex32(0, 3); // skips 'a', U+10000, and 'b'
*
- * // go to the next-to-last code point of s
- * index=s.moveIndex32(s.length(), -2); // backward-skips U+2029 and U+10ffff
- * \endcode
+ * // go to the next-to-last code point of s
+ * index=s.moveIndex32(s.length(), -2); // backward-skips U+2029 and U+10ffff
+ * \endcode
*
* @param index input code unit index
* @param delta (signed) code point count to move the index forward or backward
@@ -1443,22 +1443,22 @@ public:
/**
* Copy the characters in the range
- * [`start`, `start + length`) into the array `dst`,
- * beginning at `dstStart`.
- * If the string aliases to `dst` itself as an external buffer,
+ * [`start`, `start + length`) into the array `dst`,
+ * beginning at `dstStart`.
+ * If the string aliases to `dst` itself as an external buffer,
* then extract() will not copy the contents.
*
* @param start offset of first character which will be copied into the array
* @param length the number of characters to extract
- * @param dst array in which to copy characters. The length of `dst`
- * must be at least (`dstStart + length`).
- * @param dstStart the offset in `dst` where the first character
+ * @param dst array in which to copy characters. The length of `dst`
+ * must be at least (`dstStart + length`).
+ * @param dstStart the offset in `dst` where the first character
* will be extracted
* @stable ICU 2.0
*/
inline void extract(int32_t start,
int32_t length,
- Char16Ptr dst,
+ Char16Ptr dst,
int32_t dstStart = 0) const;
/**
@@ -1473,23 +1473,23 @@ public:
* If the string itself does not fit into dest
* (length()>destCapacity) then the error code is set to U_BUFFER_OVERFLOW_ERROR.
*
- * If the string aliases to `dest` itself as an external buffer,
+ * If the string aliases to `dest` itself as an external buffer,
* then extract() will not copy the contents.
*
* @param dest Destination string buffer.
- * @param destCapacity Number of char16_ts available at dest.
+ * @param destCapacity Number of char16_ts available at dest.
* @param errorCode ICU error code.
* @return length()
* @stable ICU 2.0
*/
int32_t
- extract(Char16Ptr dest, int32_t destCapacity,
+ extract(Char16Ptr dest, int32_t destCapacity,
UErrorCode &errorCode) const;
/**
* Copy the characters in the range
- * [`start`, `start + length`) into the UnicodeString
- * `target`.
+ * [`start`, `start + length`) into the UnicodeString
+ * `target`.
* @param start offset of first character which will be copied
* @param length the number of characters to extract
* @param target UnicodeString into which to copy characters.
@@ -1500,24 +1500,24 @@ public:
UnicodeString& target) const;
/**
- * Copy the characters in the range [`start`, `limit`)
- * into the array `dst`, beginning at `dstStart`.
+ * Copy the characters in the range [`start`, `limit`)
+ * into the array `dst`, beginning at `dstStart`.
* @param start offset of first character which will be copied into the array
* @param limit offset immediately following the last character to be copied
- * @param dst array in which to copy characters. The length of `dst`
- * must be at least (`dstStart + (limit - start)`).
- * @param dstStart the offset in `dst` where the first character
+ * @param dst array in which to copy characters. The length of `dst`
+ * must be at least (`dstStart + (limit - start)`).
+ * @param dstStart the offset in `dst` where the first character
* will be extracted
* @stable ICU 2.0
*/
inline void extractBetween(int32_t start,
int32_t limit,
- char16_t *dst,
+ char16_t *dst,
int32_t dstStart = 0) const;
/**
- * Copy the characters in the range [`start`, `limit`)
- * into the UnicodeString `target`. Replaceable API.
+ * Copy the characters in the range [`start`, `limit`)
+ * into the UnicodeString `target`. Replaceable API.
* @param start offset of first character which will be copied
* @param limit offset immediately following the last character to be copied
* @param target UnicodeString into which to copy characters.
@@ -1529,11 +1529,11 @@ public:
/**
* Copy the characters in the range
- * [`start`, `start + startLength`) into an array of characters.
+ * [`start`, `start + startLength`) into an array of characters.
* All characters must be invariant (see utypes.h).
* Use US_INV as the last, signature-distinguishing parameter.
*
- * This function does not write any more than `targetCapacity`
+ * This function does not write any more than `targetCapacity`
* characters but returns the length of the entire output string
* so that one can allocate a larger buffer and call the function again
* if necessary.
@@ -1558,9 +1558,9 @@ public:
/**
* Copy the characters in the range
- * [`start`, `start + length`) into an array of characters
+ * [`start`, `start + length`) into an array of characters
* in the platform's default codepage.
- * This function does not write any more than `targetLength`
+ * This function does not write any more than `targetLength`
* characters but returns the length of the entire output string
* so that one can allocate a larger buffer and call the function again
* if necessary.
@@ -1570,8 +1570,8 @@ public:
* @param startLength the number of characters to extract
* @param target the target buffer for extraction
* @param targetLength the length of the target buffer
- * If `target` is NULL, then the number of bytes required for
- * `target` is returned.
+ * If `target` is NULL, then the number of bytes required for
+ * `target` is returned.
* @return the output string length, not including the terminating NUL
* @stable ICU 2.0
*/
@@ -1586,7 +1586,7 @@ public:
/**
* Copy the characters in the range
- * [`start`, `start + length`) into an array of characters
+ * [`start`, `start + length`) into an array of characters
* in a specified codepage.
* The output string is NUL-terminated.
*
@@ -1600,11 +1600,11 @@ public:
* @param target the target buffer for extraction
* @param codepage the desired codepage for the characters. 0 has
* the special meaning of the default codepage
- * If `codepage` is an empty string (`""`),
+ * If `codepage` is an empty string (`""`),
* then a simple conversion is performed on the codepage-invariant
* subset ("invariant characters") of the platform encoding. See utypes.h.
- * If `target` is NULL, then the number of bytes required for
- * `target` is returned. It is assumed that the target is big enough
+ * If `target` is NULL, then the number of bytes required for
+ * `target` is returned. It is assumed that the target is big enough
* to fit all of the characters.
* @return the output string length, not including the terminating NUL
* @stable ICU 2.0
@@ -1616,9 +1616,9 @@ public:
/**
* Copy the characters in the range
- * [`start`, `start + length`) into an array of characters
+ * [`start`, `start + length`) into an array of characters
* in a specified codepage.
- * This function does not write any more than `targetLength`
+ * This function does not write any more than `targetLength`
* characters but returns the length of the entire output string
* so that one can allocate a larger buffer and call the function again
* if necessary.
@@ -1635,11 +1635,11 @@ public:
* @param targetLength the length of the target buffer
* @param codepage the desired codepage for the characters. 0 has
* the special meaning of the default codepage
- * If `codepage` is an empty string (`""`),
+ * If `codepage` is an empty string (`""`),
* then a simple conversion is performed on the codepage-invariant
* subset ("invariant characters") of the platform encoding. See utypes.h.
- * If `target` is NULL, then the number of bytes required for
- * `target` is returned.
+ * If `target` is NULL, then the number of bytes required for
+ * `target` is returned.
* @return the output string length, not including the terminating NUL
* @stable ICU 2.0
*/
@@ -1726,7 +1726,7 @@ public:
*/
template<typename StringClass>
StringClass &toUTF8String(StringClass &result) const {
- StringByteSink<StringClass> sbs(&result, length());
+ StringByteSink<StringClass> sbs(&result, length());
toUTF8(sbs);
return result;
}
@@ -1752,7 +1752,7 @@ public:
/**
* Return the length of the UnicodeString object.
- * The length is the number of char16_t code units are in the UnicodeString.
+ * The length is the number of char16_t code units are in the UnicodeString.
* If you want the number of code points, please use countChar32().
* @return the length of the UnicodeString object
* @see countChar32
@@ -1761,14 +1761,14 @@ public:
inline int32_t length(void) const;
/**
- * Count Unicode code points in the length char16_t code units of the string.
- * A code point may occupy either one or two char16_t code units.
+ * Count Unicode code points in the length char16_t code units of the string.
+ * A code point may occupy either one or two char16_t code units.
* Counting code points involves reading all code units.
*
* This functions is basically the inverse of moveIndex32().
*
* @param start the index of the first code unit to check
- * @param length the number of char16_t code units to check
+ * @param length the number of char16_t code units to check
* @return the number of code points in the specified code units
* @see length
* @stable ICU 2.0
@@ -1777,7 +1777,7 @@ public:
countChar32(int32_t start=0, int32_t length=INT32_MAX) const;
/**
- * Check if the length char16_t code units of the string
+ * Check if the length char16_t code units of the string
* contain more Unicode code points than a certain number.
* This is more efficient than counting all code points in this part of the string
* and comparing that number with a threshold.
@@ -1785,10 +1785,10 @@ public:
* falls within a certain range, and
* never needs to count more than 'number+1' code points.
* Logically equivalent to (countChar32(start, length)>number).
- * A Unicode code point may occupy either one or two char16_t code units.
+ * A Unicode code point may occupy either one or two char16_t code units.
*
* @param start the index of the first code unit to check (0 for the entire string)
- * @param length the number of char16_t code units to check
+ * @param length the number of char16_t code units to check
* (use INT32_MAX for the entire string; remember that start/length
* values are pinned)
* @param number The number of code points in the (sub)string is compared against
@@ -1814,7 +1814,7 @@ public:
* This is useful together with the getBuffer functions.
* See there for details.
*
- * @return the number of char16_ts available in the internal buffer
+ * @return the number of char16_ts available in the internal buffer
* @see getBuffer
* @stable ICU 2.0
*/
@@ -1852,7 +1852,7 @@ public:
/**
* Assignment operator. Replace the characters in this UnicodeString
- * with the characters from `srcText`.
+ * with the characters from `srcText`.
*
* Starting with ICU 2.4, the assignment operator and the copy constructor
* allocate a new buffer and copy the buffer contents even for readonly aliases.
@@ -1873,7 +1873,7 @@ public:
/**
* Almost the same as the assignment operator.
* Replace the characters in this UnicodeString
- * with the characters from `srcText`.
+ * with the characters from `srcText`.
*
* This function works the same as the assignment operator
* for all strings except for ones that are readonly aliases.
@@ -1898,14 +1898,14 @@ public:
UnicodeString &fastCopyFrom(const UnicodeString &src);
/**
- * Move assignment operator; might leave src in bogus state.
+ * Move assignment operator; might leave src in bogus state.
* This string will have the same contents and state that the source string had.
* The behavior is undefined if *this and src are the same object.
* @param src source string
* @return *this
* @stable ICU 56
*/
- UnicodeString &operator=(UnicodeString &&src) U_NOEXCEPT;
+ UnicodeString &operator=(UnicodeString &&src) U_NOEXCEPT;
/**
* Swap strings.
@@ -1920,23 +1920,23 @@ public:
* @param s2 will get s1's contents and state
* @stable ICU 56
*/
- friend inline void U_EXPORT2
+ friend inline void U_EXPORT2
swap(UnicodeString &s1, UnicodeString &s2) U_NOEXCEPT {
s1.swap(s2);
}
/**
* Assignment operator. Replace the characters in this UnicodeString
- * with the code unit `ch`.
+ * with the code unit `ch`.
* @param ch the code unit to replace
* @return a reference to this
* @stable ICU 2.0
*/
- inline UnicodeString& operator= (char16_t ch);
+ inline UnicodeString& operator= (char16_t ch);
/**
* Assignment operator. Replace the characters in this UnicodeString
- * with the code point `ch`.
+ * with the code point `ch`.
* @param ch the code point to replace
* @return a reference to this
* @stable ICU 2.0
@@ -1945,11 +1945,11 @@ public:
/**
* Set the text in the UnicodeString object to the characters
- * in `srcText` in the range
- * [`srcStart`, `srcText.length()`).
- * `srcText` is not modified.
+ * in `srcText` in the range
+ * [`srcStart`, `srcText.length()`).
+ * `srcText` is not modified.
* @param srcText the source for the new characters
- * @param srcStart the offset into `srcText` where new characters
+ * @param srcStart the offset into `srcText` where new characters
* will be obtained
* @return a reference to this
* @stable ICU 2.2
@@ -1959,13 +1959,13 @@ public:
/**
* Set the text in the UnicodeString object to the characters
- * in `srcText` in the range
- * [`srcStart`, `srcStart + srcLength`).
- * `srcText` is not modified.
+ * in `srcText` in the range
+ * [`srcStart`, `srcStart + srcLength`).
+ * `srcText` is not modified.
* @param srcText the source for the new characters
- * @param srcStart the offset into `srcText` where new characters
+ * @param srcStart the offset into `srcText` where new characters
* will be obtained
- * @param srcLength the number of characters in `srcText` in the
+ * @param srcLength the number of characters in `srcText` in the
* replace string.
* @return a reference to this
* @stable ICU 2.0
@@ -1976,8 +1976,8 @@ public:
/**
* Set the text in the UnicodeString object to the characters in
- * `srcText`.
- * `srcText` is not modified.
+ * `srcText`.
+ * `srcText` is not modified.
* @param srcText the source for the new characters
* @return a reference to this
* @stable ICU 2.0
@@ -1986,37 +1986,37 @@ public:
/**
* Set the characters in the UnicodeString object to the characters
- * in `srcChars`. `srcChars` is not modified.
+ * in `srcChars`. `srcChars` is not modified.
* @param srcChars the source for the new characters
* @param srcLength the number of Unicode characters in srcChars.
* @return a reference to this
* @stable ICU 2.0
*/
- inline UnicodeString& setTo(const char16_t *srcChars,
+ inline UnicodeString& setTo(const char16_t *srcChars,
int32_t srcLength);
/**
* Set the characters in the UnicodeString object to the code unit
- * `srcChar`.
+ * `srcChar`.
* @param srcChar the code unit which becomes the UnicodeString's character
* content
* @return a reference to this
* @stable ICU 2.0
*/
- inline UnicodeString& setTo(char16_t srcChar);
+ inline UnicodeString& setTo(char16_t srcChar);
/**
* Set the characters in the UnicodeString object to the code point
- * `srcChar`.
+ * `srcChar`.
* @param srcChar the code point which becomes the UnicodeString's character
* content
* @return a reference to this
* @stable ICU 2.0
*/
- inline UnicodeString& setTo(UChar32 srcChar);
+ inline UnicodeString& setTo(UChar32 srcChar);
/**
- * Aliasing setTo() function, analogous to the readonly-aliasing char16_t* constructor.
+ * Aliasing setTo() function, analogous to the readonly-aliasing char16_t* constructor.
* The text will be used for the UnicodeString object, but
* it will not be released when the UnicodeString is destroyed.
* This has copy-on-write semantics:
@@ -2029,21 +2029,21 @@ public:
* When using fastCopyFrom(), the text will be aliased again,
* so that both strings then alias the same readonly-text.
*
- * @param isTerminated specifies if `text` is `NUL`-terminated.
- * This must be true if `textLength==-1`.
+ * @param isTerminated specifies if `text` is `NUL`-terminated.
+ * This must be true if `textLength==-1`.
* @param text The characters to alias for the UnicodeString.
- * @param textLength The number of Unicode characters in `text` to alias.
+ * @param textLength The number of Unicode characters in `text` to alias.
* If -1, then this constructor will determine the length
- * by calling `u_strlen()`.
+ * by calling `u_strlen()`.
* @return a reference to this
* @stable ICU 2.0
*/
UnicodeString &setTo(UBool isTerminated,
- ConstChar16Ptr text,
+ ConstChar16Ptr text,
int32_t textLength);
/**
- * Aliasing setTo() function, analogous to the writable-aliasing char16_t* constructor.
+ * Aliasing setTo() function, analogous to the writable-aliasing char16_t* constructor.
* The text will be used for the UnicodeString object, but
* it will not be released when the UnicodeString is destroyed.
* This has write-through semantics:
@@ -2052,16 +2052,16 @@ public:
* a new buffer will be allocated and the contents copied as with regularly
* constructed strings.
* In an assignment to another UnicodeString, the buffer will be copied.
- * The extract(Char16Ptr dst) function detects whether the dst pointer is the same
+ * The extract(Char16Ptr dst) function detects whether the dst pointer is the same
* as the string buffer itself and will in this case not copy the contents.
*
* @param buffer The characters to alias for the UnicodeString.
- * @param buffLength The number of Unicode characters in `buffer` to alias.
- * @param buffCapacity The size of `buffer` in char16_ts.
+ * @param buffLength The number of Unicode characters in `buffer` to alias.
+ * @param buffCapacity The size of `buffer` in char16_ts.
* @return a reference to this
* @stable ICU 2.0
*/
- UnicodeString &setTo(char16_t *buffer,
+ UnicodeString &setTo(char16_t *buffer,
int32_t buffLength,
int32_t buffCapacity);
@@ -2097,7 +2097,7 @@ public:
* s.truncate(0); // set to an empty string (complete truncation), or
* s=UnicodeString(); // assign an empty string, or
* s.setTo((UChar32)-1); // set to a pseudo code point that is out of range, or
- * s.setTo(u"", 0); // set to an empty C Unicode string
+ * s.setTo(u"", 0); // set to an empty C Unicode string
* }
* \endcode
*
@@ -2114,22 +2114,22 @@ public:
* @stable ICU 2.0
*/
UnicodeString& setCharAt(int32_t offset,
- char16_t ch);
+ char16_t ch);
/* Append operations */
/**
- * Append operator. Append the code unit `ch` to the UnicodeString
+ * Append operator. Append the code unit `ch` to the UnicodeString
* object.
* @param ch the code unit to be appended
* @return a reference to this
* @stable ICU 2.0
*/
- inline UnicodeString& operator+= (char16_t ch);
+ inline UnicodeString& operator+= (char16_t ch);
/**
- * Append operator. Append the code point `ch` to the UnicodeString
+ * Append operator. Append the code point `ch` to the UnicodeString
* object.
* @param ch the code point to be appended
* @return a reference to this
@@ -2138,8 +2138,8 @@ public:
inline UnicodeString& operator+= (UChar32 ch);
/**
- * Append operator. Append the characters in `srcText` to the
- * UnicodeString object. `srcText` is not modified.
+ * Append operator. Append the characters in `srcText` to the
+ * UnicodeString object. `srcText` is not modified.
* @param srcText the source for the new characters
* @return a reference to this
* @stable ICU 2.0
@@ -2148,14 +2148,14 @@ public:
/**
* Append the characters
- * in `srcText` in the range
- * [`srcStart`, `srcStart + srcLength`) to the
- * UnicodeString object at offset `start`. `srcText`
+ * in `srcText` in the range
+ * [`srcStart`, `srcStart + srcLength`) to the
+ * UnicodeString object at offset `start`. `srcText`
* is not modified.
* @param srcText the source for the new characters
- * @param srcStart the offset into `srcText` where new characters
+ * @param srcStart the offset into `srcText` where new characters
* will be obtained
- * @param srcLength the number of characters in `srcText` in
+ * @param srcLength the number of characters in `srcText` in
* the append string
* @return a reference to this
* @stable ICU 2.0
@@ -2165,8 +2165,8 @@ public:
int32_t srcLength);
/**
- * Append the characters in `srcText` to the UnicodeString object.
- * `srcText` is not modified.
+ * Append the characters in `srcText` to the UnicodeString object.
+ * `srcText` is not modified.
* @param srcText the source for the new characters
* @return a reference to this
* @stable ICU 2.0
@@ -2174,44 +2174,44 @@ public:
inline UnicodeString& append(const UnicodeString& srcText);
/**
- * Append the characters in `srcChars` in the range
- * [`srcStart`, `srcStart + srcLength`) to the UnicodeString
+ * Append the characters in `srcChars` in the range
+ * [`srcStart`, `srcStart + srcLength`) to the UnicodeString
* object at offset
- * `start`. `srcChars` is not modified.
+ * `start`. `srcChars` is not modified.
* @param srcChars the source for the new characters
- * @param srcStart the offset into `srcChars` where new characters
+ * @param srcStart the offset into `srcChars` where new characters
* will be obtained
- * @param srcLength the number of characters in `srcChars` in
- * the append string; can be -1 if `srcChars` is NUL-terminated
+ * @param srcLength the number of characters in `srcChars` in
+ * the append string; can be -1 if `srcChars` is NUL-terminated
* @return a reference to this
* @stable ICU 2.0
*/
- inline UnicodeString& append(const char16_t *srcChars,
+ inline UnicodeString& append(const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength);
/**
- * Append the characters in `srcChars` to the UnicodeString object
- * at offset `start`. `srcChars` is not modified.
+ * Append the characters in `srcChars` to the UnicodeString object
+ * at offset `start`. `srcChars` is not modified.
* @param srcChars the source for the new characters
- * @param srcLength the number of Unicode characters in `srcChars`;
- * can be -1 if `srcChars` is NUL-terminated
+ * @param srcLength the number of Unicode characters in `srcChars`;
+ * can be -1 if `srcChars` is NUL-terminated
* @return a reference to this
* @stable ICU 2.0
*/
- inline UnicodeString& append(ConstChar16Ptr srcChars,
+ inline UnicodeString& append(ConstChar16Ptr srcChars,
int32_t srcLength);
/**
- * Append the code unit `srcChar` to the UnicodeString object.
+ * Append the code unit `srcChar` to the UnicodeString object.
* @param srcChar the code unit to append
* @return a reference to this
* @stable ICU 2.0
*/
- inline UnicodeString& append(char16_t srcChar);
+ inline UnicodeString& append(char16_t srcChar);
/**
- * Append the code point `srcChar` to the UnicodeString object.
+ * Append the code point `srcChar` to the UnicodeString object.
* @param srcChar the code point to append
* @return a reference to this
* @stable ICU 2.0
@@ -2222,14 +2222,14 @@ public:
/* Insert operations */
/**
- * Insert the characters in `srcText` in the range
- * [`srcStart`, `srcStart + srcLength`) into the UnicodeString
- * object at offset `start`. `srcText` is not modified.
+ * Insert the characters in `srcText` in the range
+ * [`srcStart`, `srcStart + srcLength`) into the UnicodeString
+ * object at offset `start`. `srcText` is not modified.
* @param start the offset where the insertion begins
* @param srcText the source for the new characters
- * @param srcStart the offset into `srcText` where new characters
+ * @param srcStart the offset into `srcText` where new characters
* will be obtained
- * @param srcLength the number of characters in `srcText` in
+ * @param srcLength the number of characters in `srcText` in
* the insert string
* @return a reference to this
* @stable ICU 2.0
@@ -2240,8 +2240,8 @@ public:
int32_t srcLength);
/**
- * Insert the characters in `srcText` into the UnicodeString object
- * at offset `start`. `srcText` is not modified.
+ * Insert the characters in `srcText` into the UnicodeString object
+ * at offset `start`. `srcText` is not modified.
* @param start the offset where the insertion begins
* @param srcText the source for the new characters
* @return a reference to this
@@ -2251,26 +2251,26 @@ public:
const UnicodeString& srcText);
/**
- * Insert the characters in `srcChars` in the range
- * [`srcStart`, `srcStart + srcLength`) into the UnicodeString
- * object at offset `start`. `srcChars` is not modified.
+ * Insert the characters in `srcChars` in the range
+ * [`srcStart`, `srcStart + srcLength`) into the UnicodeString
+ * object at offset `start`. `srcChars` is not modified.
* @param start the offset at which the insertion begins
* @param srcChars the source for the new characters
- * @param srcStart the offset into `srcChars` where new characters
+ * @param srcStart the offset into `srcChars` where new characters
* will be obtained
- * @param srcLength the number of characters in `srcChars`
+ * @param srcLength the number of characters in `srcChars`
* in the insert string
* @return a reference to this
* @stable ICU 2.0
*/
inline UnicodeString& insert(int32_t start,
- const char16_t *srcChars,
+ const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength);
/**
- * Insert the characters in `srcChars` into the UnicodeString object
- * at offset `start`. `srcChars` is not modified.
+ * Insert the characters in `srcChars` into the UnicodeString object
+ * at offset `start`. `srcChars` is not modified.
* @param start the offset where the insertion begins
* @param srcChars the source for the new characters
* @param srcLength the number of Unicode characters in srcChars.
@@ -2278,23 +2278,23 @@ public:
* @stable ICU 2.0
*/
inline UnicodeString& insert(int32_t start,
- ConstChar16Ptr srcChars,
+ ConstChar16Ptr srcChars,
int32_t srcLength);
/**
- * Insert the code unit `srcChar` into the UnicodeString object at
- * offset `start`.
+ * Insert the code unit `srcChar` into the UnicodeString object at
+ * offset `start`.
* @param start the offset at which the insertion occurs
* @param srcChar the code unit to insert
* @return a reference to this
* @stable ICU 2.0
*/
inline UnicodeString& insert(int32_t start,
- char16_t srcChar);
+ char16_t srcChar);
/**
- * Insert the code point `srcChar` into the UnicodeString object at
- * offset `start`.
+ * Insert the code point `srcChar` into the UnicodeString object at
+ * offset `start`.
* @param start the offset at which the insertion occurs
* @param srcChar the code point to insert
* @return a reference to this
@@ -2308,22 +2308,22 @@ public:
/**
* Replace the characters in the range
- * [`start`, `start + length`) with the characters in
- * `srcText` in the range
- * [`srcStart`, `srcStart + srcLength`).
- * `srcText` is not modified.
+ * [`start`, `start + length`) with the characters in
+ * `srcText` in the range
+ * [`srcStart`, `srcStart + srcLength`).
+ * `srcText` is not modified.
* @param start the offset at which the replace operation begins
* @param length the number of characters to replace. The character at
- * `start + length` is not modified.
+ * `start + length` is not modified.
* @param srcText the source for the new characters
- * @param srcStart the offset into `srcText` where new characters
+ * @param srcStart the offset into `srcText` where new characters
* will be obtained
- * @param srcLength the number of characters in `srcText` in
+ * @param srcLength the number of characters in `srcText` in
* the replace string
* @return a reference to this
* @stable ICU 2.0
*/
- inline UnicodeString& replace(int32_t start,
+ inline UnicodeString& replace(int32_t start,
int32_t length,
const UnicodeString& srcText,
int32_t srcStart,
@@ -2331,50 +2331,50 @@ public:
/**
* Replace the characters in the range
- * [`start`, `start + length`)
- * with the characters in `srcText`. `srcText` is
+ * [`start`, `start + length`)
+ * with the characters in `srcText`. `srcText` is
* not modified.
* @param start the offset at which the replace operation begins
* @param length the number of characters to replace. The character at
- * `start + length` is not modified.
+ * `start + length` is not modified.
* @param srcText the source for the new characters
* @return a reference to this
* @stable ICU 2.0
*/
- inline UnicodeString& replace(int32_t start,
+ inline UnicodeString& replace(int32_t start,
int32_t length,
const UnicodeString& srcText);
/**
* Replace the characters in the range
- * [`start`, `start + length`) with the characters in
- * `srcChars` in the range
- * [`srcStart`, `srcStart + srcLength`). `srcChars`
+ * [`start`, `start + length`) with the characters in
+ * `srcChars` in the range
+ * [`srcStart`, `srcStart + srcLength`). `srcChars`
* is not modified.
* @param start the offset at which the replace operation begins
* @param length the number of characters to replace. The character at
- * `start + length` is not modified.
+ * `start + length` is not modified.
* @param srcChars the source for the new characters
- * @param srcStart the offset into `srcChars` where new characters
+ * @param srcStart the offset into `srcChars` where new characters
* will be obtained
- * @param srcLength the number of characters in `srcChars`
+ * @param srcLength the number of characters in `srcChars`
* in the replace string
* @return a reference to this
* @stable ICU 2.0
*/
- inline UnicodeString& replace(int32_t start,
+ inline UnicodeString& replace(int32_t start,
int32_t length,
- const char16_t *srcChars,
+ const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength);
/**
* Replace the characters in the range
- * [`start`, `start + length`) with the characters in
- * `srcChars`. `srcChars` is not modified.
+ * [`start`, `start + length`) with the characters in
+ * `srcChars`. `srcChars` is not modified.
* @param start the offset at which the replace operation begins
* @param length number of characters to replace. The character at
- * `start + length` is not modified.
+ * `start + length` is not modified.
* @param srcChars the source for the new characters
* @param srcLength the number of Unicode characters in srcChars
* @return a reference to this
@@ -2382,31 +2382,31 @@ public:
*/
inline UnicodeString& replace(int32_t start,
int32_t length,
- ConstChar16Ptr srcChars,
+ ConstChar16Ptr srcChars,
int32_t srcLength);
/**
* Replace the characters in the range
- * [`start`, `start + length`) with the code unit
- * `srcChar`.
+ * [`start`, `start + length`) with the code unit
+ * `srcChar`.
* @param start the offset at which the replace operation begins
* @param length the number of characters to replace. The character at
- * `start + length` is not modified.
+ * `start + length` is not modified.
* @param srcChar the new code unit
* @return a reference to this
* @stable ICU 2.0
*/
inline UnicodeString& replace(int32_t start,
int32_t length,
- char16_t srcChar);
+ char16_t srcChar);
/**
* Replace the characters in the range
- * [`start`, `start + length`) with the code point
- * `srcChar`.
+ * [`start`, `start + length`) with the code point
+ * `srcChar`.
* @param start the offset at which the replace operation begins
* @param length the number of characters to replace. The character at
- * `start + length` is not modified.
+ * `start + length` is not modified.
* @param srcChar the new code point
* @return a reference to this
* @stable ICU 2.0
@@ -2414,8 +2414,8 @@ public:
UnicodeString& replace(int32_t start, int32_t length, UChar32 srcChar);
/**
- * Replace the characters in the range [`start`, `limit`)
- * with the characters in `srcText`. `srcText` is not modified.
+ * Replace the characters in the range [`start`, `limit`)
+ * with the characters in `srcText`. `srcText` is not modified.
* @param start the offset at which the replace operation begins
* @param limit the offset immediately following the replace range
* @param srcText the source for the new characters
@@ -2427,16 +2427,16 @@ public:
const UnicodeString& srcText);
/**
- * Replace the characters in the range [`start`, `limit`)
- * with the characters in `srcText` in the range
- * [`srcStart`, `srcLimit`). `srcText` is not modified.
+ * Replace the characters in the range [`start`, `limit`)
+ * with the characters in `srcText` in the range
+ * [`srcStart`, `srcLimit`). `srcText` is not modified.
* @param start the offset at which the replace operation begins
* @param limit the offset immediately following the replace range
* @param srcText the source for the new characters
- * @param srcStart the offset into `srcChars` where new characters
+ * @param srcStart the offset into `srcChars` where new characters
* will be obtained
* @param srcLimit the offset immediately following the range to copy
- * in `srcText`
+ * in `srcText`
* @return a reference to this
* @stable ICU 2.0
*/
@@ -2448,9 +2448,9 @@ public:
/**
* Replace a substring of this object with the given text.
- * @param start the beginning index, inclusive; `0 <= start <= limit`.
- * @param limit the ending index, exclusive; `start <= limit <= length()`.
- * @param text the text to replace characters `start` to `limit - 1`
+ * @param start the beginning index, inclusive; `0 <= start <= limit`.
+ * @param limit the ending index, exclusive; `start <= limit <= length()`.
+ * @param text the text to replace characters `start` to `limit - 1`
* @stable ICU 2.0
*/
virtual void handleReplaceBetween(int32_t start,
@@ -2469,12 +2469,12 @@ public:
* information. This method is used to duplicate or reorder substrings.
* The destination index must not overlap the source range.
*
- * @param start the beginning index, inclusive; `0 <= start <= limit`.
- * @param limit the ending index, exclusive; `start <= limit <= length()`.
+ * @param start the beginning index, inclusive; `0 <= start <= limit`.
+ * @param limit the ending index, exclusive; `start <= limit <= length()`.
* @param dest the destination index. The characters from
- * `start..limit-1` will be copied to `dest`.
- * Implementations of this method may assume that `dest <= start ||
- * dest >= limit`.
+ * `start..limit-1` will be copied to `dest`.
+ * Implementations of this method may assume that `dest <= start ||
+ * dest >= limit`.
* @stable ICU 2.0
*/
virtual void copy(int32_t start, int32_t limit, int32_t dest);
@@ -2495,7 +2495,7 @@ public:
/**
* Replace all occurrences of characters in oldText with characters
* in newText
- * in the range [`start`, `start + length`).
+ * in the range [`start`, `start + length`).
* @param start the start of the range in which replace will performed
* @param length the length of the range in which replace will be performed
* @param oldText the text containing the search text
@@ -2510,18 +2510,18 @@ public:
/**
* Replace all occurrences of characters in oldText in the range
- * [`oldStart`, `oldStart + oldLength`) with the characters
+ * [`oldStart`, `oldStart + oldLength`) with the characters
* in newText in the range
- * [`newStart`, `newStart + newLength`)
- * in the range [`start`, `start + length`).
+ * [`newStart`, `newStart + newLength`)
+ * in the range [`start`, `start + length`).
* @param start the start of the range in which replace will performed
* @param length the length of the range in which replace will be performed
* @param oldText the text containing the search text
- * @param oldStart the start of the search range in `oldText`
- * @param oldLength the length of the search range in `oldText`
+ * @param oldStart the start of the search range in `oldText`
+ * @param oldLength the length of the search range in `oldText`
* @param newText the text containing the replacement text
- * @param newStart the start of the replacement range in `newText`
- * @param newLength the length of the replacement range in `newText`
+ * @param newStart the start of the replacement range in `newText`
+ * @param newLength the length of the replacement range in `newText`
* @return a reference to this
* @stable ICU 2.0
*/
@@ -2538,18 +2538,18 @@ public:
/* Remove operations */
/**
- * Removes all characters from the UnicodeString object and clears the bogus flag.
- * This is the UnicodeString equivalent of std::string’s clear().
- *
+ * Removes all characters from the UnicodeString object and clears the bogus flag.
+ * This is the UnicodeString equivalent of std::string’s clear().
+ *
* @return a reference to this
- * @see setToBogus
+ * @see setToBogus
* @stable ICU 2.0
*/
- inline UnicodeString& remove();
+ inline UnicodeString& remove();
/**
* Remove the characters in the range
- * [`start`, `start + length`) from the UnicodeString object.
+ * [`start`, `start + length`) from the UnicodeString object.
* @param start the offset of the first character to remove
* @param length the number of characters to remove
* @return a reference to this
@@ -2560,7 +2560,7 @@ public:
/**
* Remove the characters in the range
- * [`start`, `limit`) from the UnicodeString object.
+ * [`start`, `limit`) from the UnicodeString object.
* @param start the offset of the first character to remove
* @param limit the offset immediately following the range to remove
* @return a reference to this
@@ -2571,8 +2571,8 @@ public:
/**
* Retain only the characters in the range
- * [`start`, `limit`) from the UnicodeString object.
- * Removes characters before `start` and at and after `limit`.
+ * [`start`, `limit`) from the UnicodeString object.
+ * Removes characters before `start` and at and after `limit`.
* @param start the offset of the first character to retain
* @param limit the offset immediately following the range to retain
* @return a reference to this
@@ -2583,7 +2583,7 @@ public:
/* Length operations */
/**
- * Pad the start of this UnicodeString with the character `padChar`.
+ * Pad the start of this UnicodeString with the character `padChar`.
* If the length of this UnicodeString is less than targetLength,
* length() - targetLength copies of padChar will be added to the
* beginning of this UnicodeString.
@@ -2594,10 +2594,10 @@ public:
* @stable ICU 2.0
*/
UBool padLeading(int32_t targetLength,
- char16_t padChar = 0x0020);
+ char16_t padChar = 0x0020);
/**
- * Pad the end of this UnicodeString with the character `padChar`.
+ * Pad the end of this UnicodeString with the character `padChar`.
* If the length of this UnicodeString is less than targetLength,
* length() - targetLength copies of padChar will be added to the
* end of this UnicodeString.
@@ -2608,10 +2608,10 @@ public:
* @stable ICU 2.0
*/
UBool padTrailing(int32_t targetLength,
- char16_t padChar = 0x0020);
+ char16_t padChar = 0x0020);
/**
- * Truncate this UnicodeString to the `targetLength`.
+ * Truncate this UnicodeString to the `targetLength`.
* @param targetLength the desired length of this UnicodeString.
* @return TRUE if the text was truncated, FALSE otherwise
* @stable ICU 2.0
@@ -2636,7 +2636,7 @@ public:
inline UnicodeString& reverse(void);
/**
- * Reverse the range [`start`, `start + length`) in
+ * Reverse the range [`start`, `start + length`) in
* this UnicodeString.
* @param start the start of the range to reverse
* @param length the number of characters to to reverse
@@ -2763,9 +2763,9 @@ public:
* break iterator is opened.
* Otherwise the provided iterator is set to the string's text.
* @param locale The locale to consider.
- * @param options Options bit set, usually 0. See U_TITLECASE_NO_LOWERCASE,
- * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED,
- * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES.
+ * @param options Options bit set, usually 0. See U_TITLECASE_NO_LOWERCASE,
+ * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED,
+ * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES.
* @param options Options bit set, see ucasemap_open().
* @return A reference to this.
* @stable ICU 3.8
@@ -2795,7 +2795,7 @@ public:
/**
* Get a read/write pointer to the internal buffer.
- * The buffer is guaranteed to be large enough for at least minCapacity char16_ts,
+ * The buffer is guaranteed to be large enough for at least minCapacity char16_ts,
* writable, and is still owned by the UnicodeString object.
* Calls to getBuffer(minCapacity) must not be nested, and
* must be matched with calls to releaseBuffer(newLength).
@@ -2821,22 +2821,22 @@ public:
* If the length() was greater than minCapacity, then any contents after minCapacity
* may be lost.
* The buffer contents is not NUL-terminated by getBuffer().
- * If length() < getCapacity() then you can terminate it by writing a NUL
+ * If length() < getCapacity() then you can terminate it by writing a NUL
* at index length().
* - You must call releaseBuffer(newLength) before and in order to
* return to normal UnicodeString operation.
*
- * @param minCapacity the minimum number of char16_ts that are to be available
+ * @param minCapacity the minimum number of char16_ts that are to be available
* in the buffer, starting at the returned pointer;
* default to the current string capacity if minCapacity==-1
* @return a writable pointer to the internal string buffer,
- * or nullptr if an error occurs (nested calls, out of memory)
+ * or nullptr if an error occurs (nested calls, out of memory)
*
* @see releaseBuffer
* @see getTerminatedBuffer()
* @stable ICU 2.0
*/
- char16_t *getBuffer(int32_t minCapacity);
+ char16_t *getBuffer(int32_t minCapacity);
/**
* Release a read/write buffer on a UnicodeString object with an
@@ -2877,20 +2877,20 @@ public:
*
* The buffer contents is (probably) not NUL-terminated.
* You can check if it is with
- * `(s.length() < s.getCapacity() && buffer[s.length()]==0)`.
+ * `(s.length() < s.getCapacity() && buffer[s.length()]==0)`.
* (See getTerminatedBuffer().)
*
* The buffer may reside in read-only memory. Its contents must not
* be modified.
*
* @return a read-only pointer to the internal string buffer,
- * or nullptr if the string is empty or bogus
+ * or nullptr if the string is empty or bogus
*
* @see getBuffer(int32_t minCapacity)
* @see getTerminatedBuffer()
* @stable ICU 2.0
*/
- inline const char16_t *getBuffer() const;
+ inline const char16_t *getBuffer() const;
/**
* Get a read-only pointer to the internal buffer,
@@ -2925,7 +2925,7 @@ public:
* @see getBuffer()
* @stable ICU 2.2
*/
- const char16_t *getTerminatedBuffer();
+ const char16_t *getTerminatedBuffer();
//========================================
// Constructors
@@ -2937,8 +2937,8 @@ public:
inline UnicodeString();
/**
- * Construct a UnicodeString with capacity to hold `capacity` char16_ts
- * @param capacity the number of char16_ts this UnicodeString should hold
+ * Construct a UnicodeString with capacity to hold `capacity` char16_ts
+ * @param capacity the number of char16_ts this UnicodeString should hold
* before a resize is necessary; if count is greater than 0 and count
* code points c take up more space than capacity, then capacity is adjusted
* accordingly.
@@ -2950,21 +2950,21 @@ public:
UnicodeString(int32_t capacity, UChar32 c, int32_t count);
/**
- * Single char16_t (code unit) constructor.
+ * Single char16_t (code unit) constructor.
*
* It is recommended to mark this constructor "explicit" by
- * `-DUNISTR_FROM_CHAR_EXPLICIT=explicit`
+ * `-DUNISTR_FROM_CHAR_EXPLICIT=explicit`
* on the compiler command line or similar.
* @param ch the character to place in the UnicodeString
* @stable ICU 2.0
*/
- UNISTR_FROM_CHAR_EXPLICIT UnicodeString(char16_t ch);
+ UNISTR_FROM_CHAR_EXPLICIT UnicodeString(char16_t ch);
/**
* Single UChar32 (code point) constructor.
*
* It is recommended to mark this constructor "explicit" by
- * `-DUNISTR_FROM_CHAR_EXPLICIT=explicit`
+ * `-DUNISTR_FROM_CHAR_EXPLICIT=explicit`
* on the compiler command line or similar.
* @param ch the character to place in the UnicodeString
* @stable ICU 2.0
@@ -2972,106 +2972,106 @@ public:
UNISTR_FROM_CHAR_EXPLICIT UnicodeString(UChar32 ch);
/**
- * char16_t* constructor.
+ * char16_t* constructor.
*
* It is recommended to mark this constructor "explicit" by
- * `-DUNISTR_FROM_STRING_EXPLICIT=explicit`
+ * `-DUNISTR_FROM_STRING_EXPLICIT=explicit`
* on the compiler command line or similar.
- * @param text The characters to place in the UnicodeString. `text`
+ * @param text The characters to place in the UnicodeString. `text`
* must be NULL (U+0000) terminated.
* @stable ICU 2.0
*/
- UNISTR_FROM_STRING_EXPLICIT UnicodeString(const char16_t *text);
-
-#if !U_CHAR16_IS_TYPEDEF
- /**
- * uint16_t * constructor.
- * Delegates to UnicodeString(const char16_t *).
- *
- * It is recommended to mark this constructor "explicit" by
- * `-DUNISTR_FROM_STRING_EXPLICIT=explicit`
- * on the compiler command line or similar.
- * @param text NUL-terminated UTF-16 string
- * @stable ICU 59
- */
- UNISTR_FROM_STRING_EXPLICIT UnicodeString(const uint16_t *text) :
- UnicodeString(ConstChar16Ptr(text)) {}
-#endif
-
-#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
- /**
- * wchar_t * constructor.
- * (Only defined if U_SIZEOF_WCHAR_T==2.)
- * Delegates to UnicodeString(const char16_t *).
- *
- * It is recommended to mark this constructor "explicit" by
- * `-DUNISTR_FROM_STRING_EXPLICIT=explicit`
- * on the compiler command line or similar.
- * @param text NUL-terminated UTF-16 string
- * @stable ICU 59
- */
- UNISTR_FROM_STRING_EXPLICIT UnicodeString(const wchar_t *text) :
- UnicodeString(ConstChar16Ptr(text)) {}
-#endif
-
- /**
- * nullptr_t constructor.
- * Effectively the same as the default constructor, makes an empty string object.
- *
- * It is recommended to mark this constructor "explicit" by
- * `-DUNISTR_FROM_STRING_EXPLICIT=explicit`
- * on the compiler command line or similar.
- * @param text nullptr
- * @stable ICU 59
- */
- UNISTR_FROM_STRING_EXPLICIT inline UnicodeString(const std::nullptr_t text);
-
- /**
- * char16_t* constructor.
+ UNISTR_FROM_STRING_EXPLICIT UnicodeString(const char16_t *text);
+
+#if !U_CHAR16_IS_TYPEDEF
+ /**
+ * uint16_t * constructor.
+ * Delegates to UnicodeString(const char16_t *).
+ *
+ * It is recommended to mark this constructor "explicit" by
+ * `-DUNISTR_FROM_STRING_EXPLICIT=explicit`
+ * on the compiler command line or similar.
+ * @param text NUL-terminated UTF-16 string
+ * @stable ICU 59
+ */
+ UNISTR_FROM_STRING_EXPLICIT UnicodeString(const uint16_t *text) :
+ UnicodeString(ConstChar16Ptr(text)) {}
+#endif
+
+#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
+ /**
+ * wchar_t * constructor.
+ * (Only defined if U_SIZEOF_WCHAR_T==2.)
+ * Delegates to UnicodeString(const char16_t *).
+ *
+ * It is recommended to mark this constructor "explicit" by
+ * `-DUNISTR_FROM_STRING_EXPLICIT=explicit`
+ * on the compiler command line or similar.
+ * @param text NUL-terminated UTF-16 string
+ * @stable ICU 59
+ */
+ UNISTR_FROM_STRING_EXPLICIT UnicodeString(const wchar_t *text) :
+ UnicodeString(ConstChar16Ptr(text)) {}
+#endif
+
+ /**
+ * nullptr_t constructor.
+ * Effectively the same as the default constructor, makes an empty string object.
+ *
+ * It is recommended to mark this constructor "explicit" by
+ * `-DUNISTR_FROM_STRING_EXPLICIT=explicit`
+ * on the compiler command line or similar.
+ * @param text nullptr
+ * @stable ICU 59
+ */
+ UNISTR_FROM_STRING_EXPLICIT inline UnicodeString(const std::nullptr_t text);
+
+ /**
+ * char16_t* constructor.
* @param text The characters to place in the UnicodeString.
- * @param textLength The number of Unicode characters in `text`
+ * @param textLength The number of Unicode characters in `text`
* to copy.
* @stable ICU 2.0
*/
- UnicodeString(const char16_t *text,
+ UnicodeString(const char16_t *text,
int32_t textLength);
-#if !U_CHAR16_IS_TYPEDEF
- /**
- * uint16_t * constructor.
- * Delegates to UnicodeString(const char16_t *, int32_t).
- * @param text UTF-16 string
- * @param textLength string length
- * @stable ICU 59
- */
- UnicodeString(const uint16_t *text, int32_t textLength) :
- UnicodeString(ConstChar16Ptr(text), textLength) {}
-#endif
-
-#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
- /**
- * wchar_t * constructor.
- * (Only defined if U_SIZEOF_WCHAR_T==2.)
- * Delegates to UnicodeString(const char16_t *, int32_t).
- * @param text NUL-terminated UTF-16 string
- * @param textLength string length
- * @stable ICU 59
- */
- UnicodeString(const wchar_t *text, int32_t textLength) :
- UnicodeString(ConstChar16Ptr(text), textLength) {}
-#endif
-
- /**
- * nullptr_t constructor.
- * Effectively the same as the default constructor, makes an empty string object.
- * @param text nullptr
- * @param textLength ignored
- * @stable ICU 59
- */
- inline UnicodeString(const std::nullptr_t text, int32_t textLength);
-
- /**
- * Readonly-aliasing char16_t* constructor.
+#if !U_CHAR16_IS_TYPEDEF
+ /**
+ * uint16_t * constructor.
+ * Delegates to UnicodeString(const char16_t *, int32_t).
+ * @param text UTF-16 string
+ * @param textLength string length
+ * @stable ICU 59
+ */
+ UnicodeString(const uint16_t *text, int32_t textLength) :
+ UnicodeString(ConstChar16Ptr(text), textLength) {}
+#endif
+
+#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
+ /**
+ * wchar_t * constructor.
+ * (Only defined if U_SIZEOF_WCHAR_T==2.)
+ * Delegates to UnicodeString(const char16_t *, int32_t).
+ * @param text NUL-terminated UTF-16 string
+ * @param textLength string length
+ * @stable ICU 59
+ */
+ UnicodeString(const wchar_t *text, int32_t textLength) :
+ UnicodeString(ConstChar16Ptr(text), textLength) {}
+#endif
+
+ /**
+ * nullptr_t constructor.
+ * Effectively the same as the default constructor, makes an empty string object.
+ * @param text nullptr
+ * @param textLength ignored
+ * @stable ICU 59
+ */
+ inline UnicodeString(const std::nullptr_t text, int32_t textLength);
+
+ /**
+ * Readonly-aliasing char16_t* constructor.
* The text will be used for the UnicodeString object, but
* it will not be released when the UnicodeString is destroyed.
* This has copy-on-write semantics:
@@ -3084,20 +3084,20 @@ public:
* When using fastCopyFrom(), the text will be aliased again,
* so that both strings then alias the same readonly-text.
*
- * @param isTerminated specifies if `text` is `NUL`-terminated.
- * This must be true if `textLength==-1`.
+ * @param isTerminated specifies if `text` is `NUL`-terminated.
+ * This must be true if `textLength==-1`.
* @param text The characters to alias for the UnicodeString.
- * @param textLength The number of Unicode characters in `text` to alias.
+ * @param textLength The number of Unicode characters in `text` to alias.
* If -1, then this constructor will determine the length
- * by calling `u_strlen()`.
+ * by calling `u_strlen()`.
* @stable ICU 2.0
*/
UnicodeString(UBool isTerminated,
- ConstChar16Ptr text,
+ ConstChar16Ptr text,
int32_t textLength);
/**
- * Writable-aliasing char16_t* constructor.
+ * Writable-aliasing char16_t* constructor.
* The text will be used for the UnicodeString object, but
* it will not be released when the UnicodeString is destroyed.
* This has write-through semantics:
@@ -3106,53 +3106,53 @@ public:
* a new buffer will be allocated and the contents copied as with regularly
* constructed strings.
* In an assignment to another UnicodeString, the buffer will be copied.
- * The extract(Char16Ptr dst) function detects whether the dst pointer is the same
+ * The extract(Char16Ptr dst) function detects whether the dst pointer is the same
* as the string buffer itself and will in this case not copy the contents.
*
* @param buffer The characters to alias for the UnicodeString.
- * @param buffLength The number of Unicode characters in `buffer` to alias.
- * @param buffCapacity The size of `buffer` in char16_ts.
- * @stable ICU 2.0
- */
- UnicodeString(char16_t *buffer, int32_t buffLength, int32_t buffCapacity);
-
-#if !U_CHAR16_IS_TYPEDEF
- /**
- * Writable-aliasing uint16_t * constructor.
- * Delegates to UnicodeString(const char16_t *, int32_t, int32_t).
- * @param buffer writable buffer of/for UTF-16 text
- * @param buffLength length of the current buffer contents
- * @param buffCapacity buffer capacity
- * @stable ICU 59
- */
- UnicodeString(uint16_t *buffer, int32_t buffLength, int32_t buffCapacity) :
- UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {}
-#endif
-
-#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
- /**
- * Writable-aliasing wchar_t * constructor.
- * (Only defined if U_SIZEOF_WCHAR_T==2.)
- * Delegates to UnicodeString(const char16_t *, int32_t, int32_t).
- * @param buffer writable buffer of/for UTF-16 text
- * @param buffLength length of the current buffer contents
- * @param buffCapacity buffer capacity
- * @stable ICU 59
- */
- UnicodeString(wchar_t *buffer, int32_t buffLength, int32_t buffCapacity) :
- UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {}
-#endif
-
- /**
- * Writable-aliasing nullptr_t constructor.
- * Effectively the same as the default constructor, makes an empty string object.
- * @param buffer nullptr
- * @param buffLength ignored
- * @param buffCapacity ignored
- * @stable ICU 59
- */
- inline UnicodeString(std::nullptr_t buffer, int32_t buffLength, int32_t buffCapacity);
-
+ * @param buffLength The number of Unicode characters in `buffer` to alias.
+ * @param buffCapacity The size of `buffer` in char16_ts.
+ * @stable ICU 2.0
+ */
+ UnicodeString(char16_t *buffer, int32_t buffLength, int32_t buffCapacity);
+
+#if !U_CHAR16_IS_TYPEDEF
+ /**
+ * Writable-aliasing uint16_t * constructor.
+ * Delegates to UnicodeString(const char16_t *, int32_t, int32_t).
+ * @param buffer writable buffer of/for UTF-16 text
+ * @param buffLength length of the current buffer contents
+ * @param buffCapacity buffer capacity
+ * @stable ICU 59
+ */
+ UnicodeString(uint16_t *buffer, int32_t buffLength, int32_t buffCapacity) :
+ UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {}
+#endif
+
+#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
+ /**
+ * Writable-aliasing wchar_t * constructor.
+ * (Only defined if U_SIZEOF_WCHAR_T==2.)
+ * Delegates to UnicodeString(const char16_t *, int32_t, int32_t).
+ * @param buffer writable buffer of/for UTF-16 text
+ * @param buffLength length of the current buffer contents
+ * @param buffCapacity buffer capacity
+ * @stable ICU 59
+ */
+ UnicodeString(wchar_t *buffer, int32_t buffLength, int32_t buffCapacity) :
+ UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {}
+#endif
+
+ /**
+ * Writable-aliasing nullptr_t constructor.
+ * Effectively the same as the default constructor, makes an empty string object.
+ * @param buffer nullptr
+ * @param buffLength ignored
+ * @param buffCapacity ignored
+ * @stable ICU 59
+ */
+ inline UnicodeString(std::nullptr_t buffer, int32_t buffLength, int32_t buffCapacity);
+
#if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION
/**
@@ -3166,7 +3166,7 @@ public:
* UNICODE_STRING_SIMPLE.
*
* It is recommended to mark this constructor "explicit" by
- * `-DUNISTR_FROM_STRING_EXPLICIT=explicit`
+ * `-DUNISTR_FROM_STRING_EXPLICIT=explicit`
* on the compiler command line or similar.
* @param codepageData an array of bytes, null-terminated,
* in the platform's default codepage.
@@ -3181,7 +3181,7 @@ public:
* Uses the default converter (and thus depends on the ICU conversion code)
* unless U_CHARSET_IS_UTF8 is set to 1.
* @param codepageData an array of bytes in the platform's default codepage.
- * @param dataLength The number of bytes in `codepageData`.
+ * @param dataLength The number of bytes in `codepageData`.
* @stable ICU 2.0
*/
UnicodeString(const char *codepageData, int32_t dataLength);
@@ -3193,11 +3193,11 @@ public:
/**
* char* constructor.
* @param codepageData an array of bytes, null-terminated
- * @param codepage the encoding of `codepageData`. The special
- * value 0 for `codepage` indicates that the text is in the
+ * @param codepage the encoding of `codepageData`. The special
+ * value 0 for `codepage` indicates that the text is in the
* platform's default codepage.
*
- * If `codepage` is an empty string (`""`),
+ * If `codepage` is an empty string (`""`),
* then a simple conversion is performed on the codepage-invariant
* subset ("invariant characters") of the platform encoding. See utypes.h.
* Recommendation: For invariant-character strings use the constructor
@@ -3212,11 +3212,11 @@ public:
/**
* char* constructor.
* @param codepageData an array of bytes.
- * @param dataLength The number of bytes in `codepageData`.
- * @param codepage the encoding of `codepageData`. The special
- * value 0 for `codepage` indicates that the text is in the
+ * @param dataLength The number of bytes in `codepageData`.
+ * @param codepage the encoding of `codepageData`. The special
+ * value 0 for `codepage` indicates that the text is in the
* platform's default codepage.
- * If `codepage` is an empty string (`""`),
+ * If `codepage` is an empty string (`""`),
* then a simple conversion is performed on the codepage-invariant
* subset ("invariant characters") of the platform encoding. See utypes.h.
* Recommendation: For invariant-character strings use the constructor
@@ -3267,19 +3267,19 @@ public:
*
* For example:
* \code
- * void fn(const char *s) {
- * UnicodeString ustr(s, -1, US_INV);
- * // use ustr ...
- * }
+ * void fn(const char *s) {
+ * UnicodeString ustr(s, -1, US_INV);
+ * // use ustr ...
+ * }
* \endcode
* @param src String using only invariant characters.
- * @param textLength Length of src, or -1 if NUL-terminated.
+ * @param textLength Length of src, or -1 if NUL-terminated.
* @param inv Signature-distinguishing paramater, use US_INV.
*
* @see US_INV
* @stable ICU 3.2
*/
- UnicodeString(const char *src, int32_t textLength, enum EInvariant inv);
+ UnicodeString(const char *src, int32_t textLength, enum EInvariant inv);
/**
@@ -3301,7 +3301,7 @@ public:
UnicodeString(const UnicodeString& that);
/**
- * Move constructor; might leave src in bogus state.
+ * Move constructor; might leave src in bogus state.
* This string will have the same contents and state that the source string had.
* @param src source string
* @stable ICU 56
@@ -3311,7 +3311,7 @@ public:
/**
* 'Substring' constructor from tail of source string.
* @param src The UnicodeString object to copy.
- * @param srcStart The offset into `src` at which to start copying.
+ * @param srcStart The offset into `src` at which to start copying.
* @stable ICU 2.2
*/
UnicodeString(const UnicodeString& src, int32_t srcStart);
@@ -3319,8 +3319,8 @@ public:
/**
* 'Substring' constructor from subrange of source string.
* @param src The UnicodeString object to copy.
- * @param srcStart The offset into `src` at which to start copying.
- * @param srcLength The number of characters from `src` to copy.
+ * @param srcStart The offset into `src` at which to start copying.
+ * @param srcLength The number of characters from `src` to copy.
* @stable ICU 2.2
*/
UnicodeString(const UnicodeString& src, int32_t srcStart, int32_t srcLength);
@@ -3338,7 +3338,7 @@ public:
* @see getDynamicClassID
* @stable ICU 2.6
*/
- virtual UnicodeString *clone() const;
+ virtual UnicodeString *clone() const;
/** Destructor.
* @stable ICU 2.0
@@ -3389,7 +3389,7 @@ public:
*
* \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A,
* \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B,
- * \\" => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C
+ * \\" => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C
*
* Anything else following a backslash is generically escaped. For
* example, "[a\\-z]" returns "[a-z]".
@@ -3462,7 +3462,7 @@ protected:
* UnicodeString::charAt() to be inline again (see jitterbug 709).
* @stable ICU 2.4
*/
- virtual char16_t getCharAt(int32_t offset) const;
+ virtual char16_t getCharAt(int32_t offset) const;
/**
* The change in Replaceable to use virtual getChar32At() allows
@@ -3498,7 +3498,7 @@ private:
int8_t doCompare(int32_t start,
int32_t length,
- const char16_t *srcChars,
+ const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength) const;
@@ -3511,7 +3511,7 @@ private:
int8_t doCompareCodePointOrder(int32_t start,
int32_t length,
- const char16_t *srcChars,
+ const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength) const;
@@ -3526,12 +3526,12 @@ private:
int8_t
doCaseCompare(int32_t start,
int32_t length,
- const char16_t *srcChars,
+ const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength,
uint32_t options) const;
- int32_t doIndexOf(char16_t c,
+ int32_t doIndexOf(char16_t c,
int32_t start,
int32_t length) const;
@@ -3539,7 +3539,7 @@ private:
int32_t start,
int32_t length) const;
- int32_t doLastIndexOf(char16_t c,
+ int32_t doLastIndexOf(char16_t c,
int32_t start,
int32_t length) const;
@@ -3549,14 +3549,14 @@ private:
void doExtract(int32_t start,
int32_t length,
- char16_t *dst,
+ char16_t *dst,
int32_t dstStart) const;
inline void doExtract(int32_t start,
int32_t length,
UnicodeString& target) const;
- inline char16_t doCharAt(int32_t offset) const;
+ inline char16_t doCharAt(int32_t offset) const;
UnicodeString& doReplace(int32_t start,
int32_t length,
@@ -3566,12 +3566,12 @@ private:
UnicodeString& doReplace(int32_t start,
int32_t length,
- const char16_t *srcChars,
+ const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength);
UnicodeString& doAppend(const UnicodeString& src, int32_t srcStart, int32_t srcLength);
- UnicodeString& doAppend(const char16_t *srcChars, int32_t srcStart, int32_t srcLength);
+ UnicodeString& doAppend(const char16_t *srcChars, int32_t srcStart, int32_t srcLength);
UnicodeString& doReverse(int32_t start,
int32_t length);
@@ -3581,8 +3581,8 @@ private:
// get pointer to start of array
// these do not check for kOpenGetBuffer, unlike the public getBuffer() function
- inline char16_t* getArrayStart(void);
- inline const char16_t* getArrayStart(void) const;
+ inline char16_t* getArrayStart(void);
+ inline const char16_t* getArrayStart(void) const;
inline UBool hasShortLength() const;
inline int32_t getShortLength() const;
@@ -3599,7 +3599,7 @@ private:
inline void setShortLength(int32_t len);
inline void setLength(int32_t len);
inline void setToEmpty();
- inline void setArray(char16_t *array, int32_t len, int32_t capacity); // sets length but not flags
+ inline void setArray(char16_t *array, int32_t len, int32_t capacity); // sets length but not flags
// allocate the array; result may be the stack buffer
// sets refCount to 1 if appropriate
@@ -3637,9 +3637,9 @@ private:
* Real constructor for converting from codepage data.
* It assumes that it is called with !fRefCounted.
*
- * If `codepage==0`, then the default converter
+ * If `codepage==0`, then the default converter
* is used for the platform encoding.
- * If `codepage` is an empty string (`""`),
+ * If `codepage` is an empty string (`""`),
* then a simple conversion is performed on the codepage-invariant
* subset ("invariant characters") of the platform encoding. See utypes.h.
*/
@@ -3682,11 +3682,11 @@ private:
* as in ustr_imp.h for ustrcase_map().
*/
UnicodeString &
- caseMap(int32_t caseLocale, uint32_t options,
-#if !UCONFIG_NO_BREAK_ITERATION
- BreakIterator *iter,
-#endif
- UStringCaseMapper *stringCaseMapper);
+ caseMap(int32_t caseLocale, uint32_t options,
+#if !UCONFIG_NO_BREAK_ITERATION
+ BreakIterator *iter,
+#endif
+ UStringCaseMapper *stringCaseMapper);
// ref counting
void addRef(void);
@@ -3777,15 +3777,15 @@ private:
// Each struct of the union must begin with fLengthAndFlags.
struct {
int16_t fLengthAndFlags; // bit fields: see constants above
- char16_t fBuffer[US_STACKBUF_SIZE]; // buffer for short strings
+ char16_t fBuffer[US_STACKBUF_SIZE]; // buffer for short strings
} fStackFields;
struct {
int16_t fLengthAndFlags; // bit fields: see constants above
int32_t fLength; // number of characters in fArray if >127; else undefined
- int32_t fCapacity; // capacity of fArray (in char16_ts)
+ int32_t fCapacity; // capacity of fArray (in char16_ts)
// array pointer last to minimize padding for machines with P128 data model
// or pointer sizes that are not a power of 2
- char16_t *fArray; // the Unicode data
+ char16_t *fArray; // the Unicode data
} fFields;
} fUnion;
};
@@ -3838,13 +3838,13 @@ UnicodeString::pinIndices(int32_t& start,
}
}
-inline char16_t*
+inline char16_t*
UnicodeString::getArrayStart() {
return (fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) ?
fUnion.fStackFields.fBuffer : fUnion.fFields.fArray;
}
-inline const char16_t*
+inline const char16_t*
UnicodeString::getArrayStart() const {
return (fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) ?
fUnion.fStackFields.fBuffer : fUnion.fFields.fArray;
@@ -3859,18 +3859,18 @@ UnicodeString::UnicodeString() {
fUnion.fStackFields.fLengthAndFlags=kShortString;
}
-inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/) {
- fUnion.fStackFields.fLengthAndFlags=kShortString;
-}
-
-inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/, int32_t /*length*/) {
- fUnion.fStackFields.fLengthAndFlags=kShortString;
-}
-
-inline UnicodeString::UnicodeString(std::nullptr_t /*buffer*/, int32_t /*buffLength*/, int32_t /*buffCapacity*/) {
- fUnion.fStackFields.fLengthAndFlags=kShortString;
-}
-
+inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/) {
+ fUnion.fStackFields.fLengthAndFlags=kShortString;
+}
+
+inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/, int32_t /*length*/) {
+ fUnion.fStackFields.fLengthAndFlags=kShortString;
+}
+
+inline UnicodeString::UnicodeString(std::nullptr_t /*buffer*/, int32_t /*buffLength*/, int32_t /*buffCapacity*/) {
+ fUnion.fStackFields.fLengthAndFlags=kShortString;
+}
+
//========================================
// Read-only implementation methods
//========================================
@@ -3917,10 +3917,10 @@ UnicodeString::isBufferWritable() const
(!(fUnion.fFields.fLengthAndFlags&kRefCounted) || refCount()==1));
}
-inline const char16_t *
+inline const char16_t *
UnicodeString::getBuffer() const {
if(fUnion.fFields.fLengthAndFlags&(kIsBogus|kOpenGetBuffer)) {
- return nullptr;
+ return nullptr;
} else if(fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) {
return fUnion.fStackFields.fBuffer;
} else {
@@ -3988,7 +3988,7 @@ UnicodeString::compare(int32_t start,
{ return doCompare(start, _length, srcText, 0, srcText.length()); }
inline int8_t
-UnicodeString::compare(ConstChar16Ptr srcChars,
+UnicodeString::compare(ConstChar16Ptr srcChars,
int32_t srcLength) const
{ return doCompare(0, length(), srcChars, 0, srcLength); }
@@ -4003,13 +4003,13 @@ UnicodeString::compare(int32_t start,
inline int8_t
UnicodeString::compare(int32_t start,
int32_t _length,
- const char16_t *srcChars) const
+ const char16_t *srcChars) const
{ return doCompare(start, _length, srcChars, 0, _length); }
inline int8_t
UnicodeString::compare(int32_t start,
int32_t _length,
- const char16_t *srcChars,
+ const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength) const
{ return doCompare(start, _length, srcChars, srcStart, srcLength); }
@@ -4049,7 +4049,7 @@ UnicodeString::compareCodePointOrder(int32_t start,
{ return doCompareCodePointOrder(start, _length, srcText, 0, srcText.length()); }
inline int8_t
-UnicodeString::compareCodePointOrder(ConstChar16Ptr srcChars,
+UnicodeString::compareCodePointOrder(ConstChar16Ptr srcChars,
int32_t srcLength) const
{ return doCompareCodePointOrder(0, length(), srcChars, 0, srcLength); }
@@ -4064,13 +4064,13 @@ UnicodeString::compareCodePointOrder(int32_t start,
inline int8_t
UnicodeString::compareCodePointOrder(int32_t start,
int32_t _length,
- const char16_t *srcChars) const
+ const char16_t *srcChars) const
{ return doCompareCodePointOrder(start, _length, srcChars, 0, _length); }
inline int8_t
UnicodeString::compareCodePointOrder(int32_t start,
int32_t _length,
- const char16_t *srcChars,
+ const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength) const
{ return doCompareCodePointOrder(start, _length, srcChars, srcStart, srcLength); }
@@ -4114,7 +4114,7 @@ UnicodeString::caseCompare(int32_t start,
}
inline int8_t
-UnicodeString::caseCompare(ConstChar16Ptr srcChars,
+UnicodeString::caseCompare(ConstChar16Ptr srcChars,
int32_t srcLength,
uint32_t options) const {
return doCaseCompare(0, length(), srcChars, 0, srcLength, options);
@@ -4133,7 +4133,7 @@ UnicodeString::caseCompare(int32_t start,
inline int8_t
UnicodeString::caseCompare(int32_t start,
int32_t _length,
- const char16_t *srcChars,
+ const char16_t *srcChars,
uint32_t options) const {
return doCaseCompare(start, _length, srcChars, 0, _length, options);
}
@@ -4141,7 +4141,7 @@ UnicodeString::caseCompare(int32_t start,
inline int8_t
UnicodeString::caseCompare(int32_t start,
int32_t _length,
- const char16_t *srcChars,
+ const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength,
uint32_t options) const {
@@ -4192,7 +4192,7 @@ UnicodeString::indexOf(const UnicodeString& text,
{ return indexOf(text, 0, text.length(), start, _length); }
inline int32_t
-UnicodeString::indexOf(const char16_t *srcChars,
+UnicodeString::indexOf(const char16_t *srcChars,
int32_t srcLength,
int32_t start) const {
pinIndex(start);
@@ -4200,14 +4200,14 @@ UnicodeString::indexOf(const char16_t *srcChars,
}
inline int32_t
-UnicodeString::indexOf(ConstChar16Ptr srcChars,
+UnicodeString::indexOf(ConstChar16Ptr srcChars,
int32_t srcLength,
int32_t start,
int32_t _length) const
{ return indexOf(srcChars, 0, srcLength, start, _length); }
inline int32_t
-UnicodeString::indexOf(char16_t c,
+UnicodeString::indexOf(char16_t c,
int32_t start,
int32_t _length) const
{ return doIndexOf(c, start, _length); }
@@ -4219,7 +4219,7 @@ UnicodeString::indexOf(UChar32 c,
{ return doIndexOf(c, start, _length); }
inline int32_t
-UnicodeString::indexOf(char16_t c) const
+UnicodeString::indexOf(char16_t c) const
{ return doIndexOf(c, 0, length()); }
inline int32_t
@@ -4227,7 +4227,7 @@ UnicodeString::indexOf(UChar32 c) const
{ return indexOf(c, 0, length()); }
inline int32_t
-UnicodeString::indexOf(char16_t c,
+UnicodeString::indexOf(char16_t c,
int32_t start) const {
pinIndex(start);
return doIndexOf(c, start, length() - start);
@@ -4241,14 +4241,14 @@ UnicodeString::indexOf(UChar32 c,
}
inline int32_t
-UnicodeString::lastIndexOf(ConstChar16Ptr srcChars,
+UnicodeString::lastIndexOf(ConstChar16Ptr srcChars,
int32_t srcLength,
int32_t start,
int32_t _length) const
{ return lastIndexOf(srcChars, 0, srcLength, start, _length); }
inline int32_t
-UnicodeString::lastIndexOf(const char16_t *srcChars,
+UnicodeString::lastIndexOf(const char16_t *srcChars,
int32_t srcLength,
int32_t start) const {
pinIndex(start);
@@ -4289,7 +4289,7 @@ UnicodeString::lastIndexOf(const UnicodeString& text) const
{ return lastIndexOf(text, 0, text.length(), 0, length()); }
inline int32_t
-UnicodeString::lastIndexOf(char16_t c,
+UnicodeString::lastIndexOf(char16_t c,
int32_t start,
int32_t _length) const
{ return doLastIndexOf(c, start, _length); }
@@ -4302,7 +4302,7 @@ UnicodeString::lastIndexOf(UChar32 c,
}
inline int32_t
-UnicodeString::lastIndexOf(char16_t c) const
+UnicodeString::lastIndexOf(char16_t c) const
{ return doLastIndexOf(c, 0, length()); }
inline int32_t
@@ -4311,7 +4311,7 @@ UnicodeString::lastIndexOf(UChar32 c) const {
}
inline int32_t
-UnicodeString::lastIndexOf(char16_t c,
+UnicodeString::lastIndexOf(char16_t c,
int32_t start) const {
pinIndex(start);
return doLastIndexOf(c, start, length() - start);
@@ -4335,17 +4335,17 @@ UnicodeString::startsWith(const UnicodeString& srcText,
{ return doCompare(0, srcLength, srcText, srcStart, srcLength) == 0; }
inline UBool
-UnicodeString::startsWith(ConstChar16Ptr srcChars, int32_t srcLength) const {
+UnicodeString::startsWith(ConstChar16Ptr srcChars, int32_t srcLength) const {
if(srcLength < 0) {
- srcLength = u_strlen(toUCharPtr(srcChars));
+ srcLength = u_strlen(toUCharPtr(srcChars));
}
return doCompare(0, srcLength, srcChars, 0, srcLength) == 0;
}
inline UBool
-UnicodeString::startsWith(const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const {
+UnicodeString::startsWith(const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const {
if(srcLength < 0) {
- srcLength = u_strlen(toUCharPtr(srcChars));
+ srcLength = u_strlen(toUCharPtr(srcChars));
}
return doCompare(0, srcLength, srcChars, srcStart, srcLength) == 0;
}
@@ -4365,21 +4365,21 @@ UnicodeString::endsWith(const UnicodeString& srcText,
}
inline UBool
-UnicodeString::endsWith(ConstChar16Ptr srcChars,
+UnicodeString::endsWith(ConstChar16Ptr srcChars,
int32_t srcLength) const {
if(srcLength < 0) {
- srcLength = u_strlen(toUCharPtr(srcChars));
+ srcLength = u_strlen(toUCharPtr(srcChars));
}
return doCompare(length() - srcLength, srcLength,
srcChars, 0, srcLength) == 0;
}
inline UBool
-UnicodeString::endsWith(const char16_t *srcChars,
+UnicodeString::endsWith(const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength) const {
if(srcLength < 0) {
- srcLength = u_strlen(toUCharPtr(srcChars + srcStart));
+ srcLength = u_strlen(toUCharPtr(srcChars + srcStart));
}
return doCompare(length() - srcLength, srcLength,
srcChars, srcStart, srcLength) == 0;
@@ -4405,14 +4405,14 @@ UnicodeString::replace(int32_t start,
inline UnicodeString&
UnicodeString::replace(int32_t start,
int32_t _length,
- ConstChar16Ptr srcChars,
+ ConstChar16Ptr srcChars,
int32_t srcLength)
{ return doReplace(start, _length, srcChars, 0, srcLength); }
inline UnicodeString&
UnicodeString::replace(int32_t start,
int32_t _length,
- const char16_t *srcChars,
+ const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength)
{ return doReplace(start, _length, srcChars, srcStart, srcLength); }
@@ -4420,7 +4420,7 @@ UnicodeString::replace(int32_t start,
inline UnicodeString&
UnicodeString::replace(int32_t start,
int32_t _length,
- char16_t srcChar)
+ char16_t srcChar)
{ return doReplace(start, _length, &srcChar, 0, 1); }
inline UnicodeString&
@@ -4463,7 +4463,7 @@ UnicodeString::doExtract(int32_t start,
inline void
UnicodeString::extract(int32_t start,
int32_t _length,
- Char16Ptr target,
+ Char16Ptr target,
int32_t targetStart) const
{ doExtract(start, _length, target, targetStart); }
@@ -4491,7 +4491,7 @@ UnicodeString::extract(int32_t start,
inline void
UnicodeString::extractBetween(int32_t start,
int32_t limit,
- char16_t *dst,
+ char16_t *dst,
int32_t dstStart) const {
pinIndex(start);
pinIndex(limit);
@@ -4503,7 +4503,7 @@ UnicodeString::tempSubStringBetween(int32_t start, int32_t limit) const {
return tempSubString(start, limit - start);
}
-inline char16_t
+inline char16_t
UnicodeString::doCharAt(int32_t offset) const
{
if((uint32_t)offset < (uint32_t)length()) {
@@ -4513,11 +4513,11 @@ UnicodeString::doCharAt(int32_t offset) const
}
}
-inline char16_t
+inline char16_t
UnicodeString::charAt(int32_t offset) const
{ return doCharAt(offset); }
-inline char16_t
+inline char16_t
UnicodeString::operator[] (int32_t offset) const
{ return doCharAt(offset); }
@@ -4558,14 +4558,14 @@ UnicodeString::setToEmpty() {
}
inline void
-UnicodeString::setArray(char16_t *array, int32_t len, int32_t capacity) {
+UnicodeString::setArray(char16_t *array, int32_t len, int32_t capacity) {
setLength(len);
fUnion.fFields.fArray = array;
fUnion.fFields.fCapacity = capacity;
}
inline UnicodeString&
-UnicodeString::operator= (char16_t ch)
+UnicodeString::operator= (char16_t ch)
{ return doReplace(0, length(), &ch, 0, 1); }
inline UnicodeString&
@@ -4597,7 +4597,7 @@ UnicodeString::setTo(const UnicodeString& srcText)
}
inline UnicodeString&
-UnicodeString::setTo(const char16_t *srcChars,
+UnicodeString::setTo(const char16_t *srcChars,
int32_t srcLength)
{
unBogus();
@@ -4605,7 +4605,7 @@ UnicodeString::setTo(const char16_t *srcChars,
}
inline UnicodeString&
-UnicodeString::setTo(char16_t srcChar)
+UnicodeString::setTo(char16_t srcChar)
{
unBogus();
return doReplace(0, length(), &srcChar, 0, 1);
@@ -4629,22 +4629,22 @@ UnicodeString::append(const UnicodeString& srcText)
{ return doAppend(srcText, 0, srcText.length()); }
inline UnicodeString&
-UnicodeString::append(const char16_t *srcChars,
+UnicodeString::append(const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength)
{ return doAppend(srcChars, srcStart, srcLength); }
inline UnicodeString&
-UnicodeString::append(ConstChar16Ptr srcChars,
+UnicodeString::append(ConstChar16Ptr srcChars,
int32_t srcLength)
{ return doAppend(srcChars, 0, srcLength); }
inline UnicodeString&
-UnicodeString::append(char16_t srcChar)
+UnicodeString::append(char16_t srcChar)
{ return doAppend(&srcChar, 0, 1); }
inline UnicodeString&
-UnicodeString::operator+= (char16_t ch)
+UnicodeString::operator+= (char16_t ch)
{ return doAppend(&ch, 0, 1); }
inline UnicodeString&
@@ -4670,20 +4670,20 @@ UnicodeString::insert(int32_t start,
inline UnicodeString&
UnicodeString::insert(int32_t start,
- const char16_t *srcChars,
+ const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength)
{ return doReplace(start, 0, srcChars, srcStart, srcLength); }
inline UnicodeString&
UnicodeString::insert(int32_t start,
- ConstChar16Ptr srcChars,
+ ConstChar16Ptr srcChars,
int32_t srcLength)
{ return doReplace(start, 0, srcChars, 0, srcLength); }
inline UnicodeString&
UnicodeString::insert(int32_t start,
- char16_t srcChar)
+ char16_t srcChar)
{ return doReplace(start, 0, &srcChar, 0, 1); }
inline UnicodeString&
@@ -4752,6 +4752,6 @@ UnicodeString::reverse(int32_t start,
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/unorm.h b/contrib/libs/icu/include/unicode/unorm.h
index ac6e07a318..09dd366a96 100644
--- a/contrib/libs/icu/include/unicode/unorm.h
+++ b/contrib/libs/icu/include/unicode/unorm.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -131,8 +131,8 @@
// Do not conditionalize the following enum with #ifndef U_HIDE_DEPRECATED_API,
// it is needed for layout of Normalizer object.
-#ifndef U_FORCE_HIDE_DEPRECATED_API
-
+#ifndef U_FORCE_HIDE_DEPRECATED_API
+
/**
* Constants for normalization modes.
* @deprecated ICU 56 Use unorm2.h instead.
@@ -157,8 +157,8 @@ typedef enum {
UNORM_MODE_COUNT
} UNormalizationMode;
-#endif // U_FORCE_HIDE_DEPRECATED_API
-
+#endif // U_FORCE_HIDE_DEPRECATED_API
+
#ifndef U_HIDE_DEPRECATED_API
/**
@@ -214,7 +214,7 @@ enum {
* the output was truncated, and the error code is set to U_BUFFER_OVERFLOW_ERROR.
* @deprecated ICU 56 Use unorm2.h instead.
*/
-U_DEPRECATED int32_t U_EXPORT2
+U_DEPRECATED int32_t U_EXPORT2
unorm_normalize(const UChar *source, int32_t sourceLength,
UNormalizationMode mode, int32_t options,
UChar *result, int32_t resultLength,
@@ -240,7 +240,7 @@ unorm_normalize(const UChar *source, int32_t sourceLength,
* @see unorm_isNormalized
* @deprecated ICU 56 Use unorm2.h instead.
*/
-U_DEPRECATED UNormalizationCheckResult U_EXPORT2
+U_DEPRECATED UNormalizationCheckResult U_EXPORT2
unorm_quickCheck(const UChar *source, int32_t sourcelength,
UNormalizationMode mode,
UErrorCode *status);
@@ -261,7 +261,7 @@ unorm_quickCheck(const UChar *source, int32_t sourcelength,
* @see unorm_isNormalized
* @deprecated ICU 56 Use unorm2.h instead.
*/
-U_DEPRECATED UNormalizationCheckResult U_EXPORT2
+U_DEPRECATED UNormalizationCheckResult U_EXPORT2
unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength,
UNormalizationMode mode, int32_t options,
UErrorCode *pErrorCode);
@@ -287,7 +287,7 @@ unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength,
* @see unorm_quickCheck
* @deprecated ICU 56 Use unorm2.h instead.
*/
-U_DEPRECATED UBool U_EXPORT2
+U_DEPRECATED UBool U_EXPORT2
unorm_isNormalized(const UChar *src, int32_t srcLength,
UNormalizationMode mode,
UErrorCode *pErrorCode);
@@ -309,7 +309,7 @@ unorm_isNormalized(const UChar *src, int32_t srcLength,
* @see unorm_isNormalized
* @deprecated ICU 56 Use unorm2.h instead.
*/
-U_DEPRECATED UBool U_EXPORT2
+U_DEPRECATED UBool U_EXPORT2
unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength,
UNormalizationMode mode, int32_t options,
UErrorCode *pErrorCode);
@@ -387,7 +387,7 @@ unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength,
*
* @deprecated ICU 56 Use unorm2.h instead.
*/
-U_DEPRECATED int32_t U_EXPORT2
+U_DEPRECATED int32_t U_EXPORT2
unorm_next(UCharIterator *src,
UChar *dest, int32_t destCapacity,
UNormalizationMode mode, int32_t options,
@@ -420,7 +420,7 @@ unorm_next(UCharIterator *src,
*
* @deprecated ICU 56 Use unorm2.h instead.
*/
-U_DEPRECATED int32_t U_EXPORT2
+U_DEPRECATED int32_t U_EXPORT2
unorm_previous(UCharIterator *src,
UChar *dest, int32_t destCapacity,
UNormalizationMode mode, int32_t options,
@@ -464,7 +464,7 @@ unorm_previous(UCharIterator *src,
*
* @deprecated ICU 56 Use unorm2.h instead.
*/
-U_DEPRECATED int32_t U_EXPORT2
+U_DEPRECATED int32_t U_EXPORT2
unorm_concatenate(const UChar *left, int32_t leftLength,
const UChar *right, int32_t rightLength,
UChar *dest, int32_t destCapacity,
diff --git a/contrib/libs/icu/include/unicode/unorm2.h b/contrib/libs/icu/include/unicode/unorm2.h
index 0fa7fdbced..a9bd02f256 100644
--- a/contrib/libs/icu/include/unicode/unorm2.h
+++ b/contrib/libs/icu/include/unicode/unorm2.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: unorm2.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -32,7 +32,7 @@
#include "unicode/utypes.h"
#include "unicode/localpointer.h"
-#include "unicode/stringoptions.h"
+#include "unicode/stringoptions.h"
#include "unicode/uset.h"
/**
diff --git a/contrib/libs/icu/include/unicode/unum.h b/contrib/libs/icu/include/unicode/unum.h
index ab4766fd4f..9036f9575d 100644
--- a/contrib/libs/icu/include/unicode/unum.h
+++ b/contrib/libs/icu/include/unicode/unum.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -25,17 +25,17 @@
#include "unicode/parseerr.h"
#include "unicode/uformattable.h"
#include "unicode/udisplaycontext.h"
-#include "unicode/ufieldpositer.h"
+#include "unicode/ufieldpositer.h"
/**
* \file
- * \brief C API: Compatibility APIs for number formatting.
+ * \brief C API: Compatibility APIs for number formatting.
*
* <h2> Number Format C API </h2>
- *
- * <p><strong>IMPORTANT:</strong> New users with are strongly encouraged to
- * see if unumberformatter.h fits their use case. Although not deprecated,
- * this header is provided for backwards compatibility only.
+ *
+ * <p><strong>IMPORTANT:</strong> New users with are strongly encouraged to
+ * see if unumberformatter.h fits their use case. Although not deprecated,
+ * this header is provided for backwards compatibility only.
*
* Number Format C API Provides functions for
* formatting and parsing a number. Also provides methods for
@@ -119,7 +119,7 @@
* <P>
* You can also control the display of numbers with such function as
* unum_getAttributes() and unum_setAttributes(), which let you set the
- * minimum fraction digits, grouping, etc.
+ * minimum fraction digits, grouping, etc.
* @see UNumberFormatAttributes for more details
* <P>
* You can also use forms of the parse and format methods with
@@ -130,7 +130,7 @@
* </ul>
* <p>
* It is also possible to change or set the symbols used for a particular
- * locale like the currency symbol, the grouping separator , monetary separator
+ * locale like the currency symbol, the grouping separator , monetary separator
* etc by making use of functions unum_setSymbols() and unum_getSymbols().
*/
@@ -254,7 +254,7 @@ typedef enum UNumberFormatStyle {
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
UNUM_FORMAT_STYLE_COUNT=17,
-#endif /* U_HIDE_DEPRECATED_API */
+#endif /* U_HIDE_DEPRECATED_API */
/**
* Default format
@@ -268,13 +268,13 @@ typedef enum UNumberFormatStyle {
UNUM_IGNORE = UNUM_PATTERN_DECIMAL
} UNumberFormatStyle;
-/** The possible number format rounding modes.
- *
- * <p>
- * For more detail on rounding modes, see:
- * http://userguide.icu-project.org/formatparse/numbers/rounding-modes
- *
- * @stable ICU 2.0
+/** The possible number format rounding modes.
+ *
+ * <p>
+ * For more detail on rounding modes, see:
+ * http://userguide.icu-project.org/formatparse/numbers/rounding-modes
+ *
+ * @stable ICU 2.0
*/
typedef enum UNumberFormatRoundingMode {
UNUM_ROUND_CEILING,
@@ -336,15 +336,15 @@ enum UCurrencySpacing {
/** @stable ICU 4.8 */
UNUM_CURRENCY_INSERT,
- /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
- * it is needed for layout of DecimalFormatSymbols object. */
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+ /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
+ * it is needed for layout of DecimalFormatSymbols object. */
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* One more than the highest normal UCurrencySpacing value.
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
UNUM_CURRENCY_SPACING_COUNT
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
};
typedef enum UCurrencySpacing UCurrencySpacing; /**< @stable ICU 4.8 */
@@ -377,18 +377,18 @@ typedef enum UNumberFormatFields {
UNUM_PERMILL_FIELD,
/** @stable ICU 49 */
UNUM_SIGN_FIELD,
- /** @stable ICU 64 */
- UNUM_MEASURE_UNIT_FIELD,
- /** @stable ICU 64 */
- UNUM_COMPACT_FIELD,
-
+ /** @stable ICU 64 */
+ UNUM_MEASURE_UNIT_FIELD,
+ /** @stable ICU 64 */
+ UNUM_COMPACT_FIELD,
+
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal UNumberFormatFields value.
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
- UNUM_FIELD_COUNT = UNUM_SIGN_FIELD + 3
-#endif /* U_HIDE_DEPRECATED_API */
+ UNUM_FIELD_COUNT = UNUM_SIGN_FIELD + 3
+#endif /* U_HIDE_DEPRECATED_API */
} UNumberFormatFields;
@@ -407,10 +407,10 @@ typedef enum UNumberFormatFields {
* number format is opened using the given pattern, which must conform
* to the syntax described in DecimalFormat or RuleBasedNumberFormat,
* respectively.
- *
- * <p><strong>NOTE::</strong> New users with are strongly encouraged to
- * use unumf_openForSkeletonAndLocale instead of unum_open.
- *
+ *
+ * <p><strong>NOTE::</strong> New users with are strongly encouraged to
+ * use unumf_openForSkeletonAndLocale instead of unum_open.
+ *
* @param pattern A pattern specifying the format to use.
* This parameter is ignored unless the style is
* UNUM_PATTERN_DECIMAL or UNUM_PATTERN_RULEBASED.
@@ -575,57 +575,57 @@ unum_formatDouble( const UNumberFormat* fmt,
UErrorCode* status);
/**
-* Format a double using a UNumberFormat according to the UNumberFormat's locale,
-* and initialize a UFieldPositionIterator that enumerates the subcomponents of
-* the resulting string.
-*
-* @param format
-* The formatter to use.
-* @param number
-* The number to format.
-* @param result
-* A pointer to a buffer to receive the NULL-terminated formatted
-* number. If the formatted number fits into dest but cannot be
-* NULL-terminated (length == resultLength) then the error code is set
-* to U_STRING_NOT_TERMINATED_WARNING. If the formatted number doesn't
-* fit into result then the error code is set to
-* U_BUFFER_OVERFLOW_ERROR.
-* @param resultLength
-* The maximum size of result.
-* @param fpositer
-* A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open}
-* (may be NULL if field position information is not needed, but in this
-* case it's preferable to use {@link #unum_formatDouble}). Iteration
-* information already present in the UFieldPositionIterator is deleted,
-* and the iterator is reset to apply to the fields in the formatted
-* string created by this function call. The field values and indexes
-* returned by {@link #ufieldpositer_next} represent fields denoted by
-* the UNumberFormatFields enum. Fields are not returned in a guaranteed
-* order. Fields cannot overlap, but they may nest. For example, 1234
-* could format as "1,234" which might consist of a grouping separator
-* field for ',' and an integer field encompassing the entire string.
-* @param status
-* A pointer to an UErrorCode to receive any errors
-* @return
-* The total buffer size needed; if greater than resultLength, the
-* output was truncated.
-* @see unum_formatDouble
-* @see unum_parse
-* @see unum_parseDouble
-* @see UFieldPositionIterator
-* @see UNumberFormatFields
-* @stable ICU 59
-*/
-U_STABLE int32_t U_EXPORT2
-unum_formatDoubleForFields(const UNumberFormat* format,
- double number,
- UChar* result,
- int32_t resultLength,
- UFieldPositionIterator* fpositer,
- UErrorCode* status);
-
-
-/**
+* Format a double using a UNumberFormat according to the UNumberFormat's locale,
+* and initialize a UFieldPositionIterator that enumerates the subcomponents of
+* the resulting string.
+*
+* @param format
+* The formatter to use.
+* @param number
+* The number to format.
+* @param result
+* A pointer to a buffer to receive the NULL-terminated formatted
+* number. If the formatted number fits into dest but cannot be
+* NULL-terminated (length == resultLength) then the error code is set
+* to U_STRING_NOT_TERMINATED_WARNING. If the formatted number doesn't
+* fit into result then the error code is set to
+* U_BUFFER_OVERFLOW_ERROR.
+* @param resultLength
+* The maximum size of result.
+* @param fpositer
+* A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open}
+* (may be NULL if field position information is not needed, but in this
+* case it's preferable to use {@link #unum_formatDouble}). Iteration
+* information already present in the UFieldPositionIterator is deleted,
+* and the iterator is reset to apply to the fields in the formatted
+* string created by this function call. The field values and indexes
+* returned by {@link #ufieldpositer_next} represent fields denoted by
+* the UNumberFormatFields enum. Fields are not returned in a guaranteed
+* order. Fields cannot overlap, but they may nest. For example, 1234
+* could format as "1,234" which might consist of a grouping separator
+* field for ',' and an integer field encompassing the entire string.
+* @param status
+* A pointer to an UErrorCode to receive any errors
+* @return
+* The total buffer size needed; if greater than resultLength, the
+* output was truncated.
+* @see unum_formatDouble
+* @see unum_parse
+* @see unum_parseDouble
+* @see UFieldPositionIterator
+* @see UNumberFormatFields
+* @stable ICU 59
+*/
+U_STABLE int32_t U_EXPORT2
+unum_formatDoubleForFields(const UNumberFormat* format,
+ double number,
+ UChar* result,
+ int32_t resultLength,
+ UFieldPositionIterator* fpositer,
+ UErrorCode* status);
+
+
+/**
* Format a decimal number using a UNumberFormat.
* The number will be formatted according to the UNumberFormat's locale.
* The syntax of the input number is a "numeric string"
@@ -901,7 +901,7 @@ unum_parseToUFormattable(const UNumberFormat* fmt,
* @param localized TRUE if the pattern is localized, FALSE otherwise.
* @param pattern The new pattern
* @param patternLength The length of pattern, or -1 if null-terminated.
- * @param parseError A pointer to UParseError to receive information
+ * @param parseError A pointer to UParseError to receive information
* about errors occurred during parsing, or NULL if no parse error
* information is desired.
* @param status A pointer to an input-output UErrorCode.
@@ -1025,18 +1025,18 @@ typedef enum UNumberFormatAttribute {
* <p>Example: setting the scale to 3, 123 formats as "123,000"
* <p>Example: setting the scale to -4, 123 formats as "0.0123"
*
- * This setting is analogous to getMultiplierScale() and setMultiplierScale() in decimfmt.h.
- *
+ * This setting is analogous to getMultiplierScale() and setMultiplierScale() in decimfmt.h.
+ *
* @stable ICU 51 */
UNUM_SCALE = 21,
-
+
/**
- * Minimum grouping digits; most commonly set to 2 to print "1000" instead of "1,000".
+ * Minimum grouping digits; most commonly set to 2 to print "1000" instead of "1,000".
* See DecimalFormat::getMinimumGroupingDigits().
*
- * For better control over grouping strategies, use UNumberFormatter.
- *
- * @stable ICU 64
+ * For better control over grouping strategies, use UNumberFormatter.
+ *
+ * @stable ICU 64
*/
UNUM_MINIMUM_GROUPING_DIGITS = 22,
@@ -1048,12 +1048,12 @@ typedef enum UNumberFormatAttribute {
*/
UNUM_CURRENCY_USAGE = 23,
-#ifndef U_HIDE_INTERNAL_API
+#ifndef U_HIDE_INTERNAL_API
/** One below the first bitfield-boolean item.
* All items after this one are stored in boolean form.
* @internal */
UNUM_MAX_NONBOOLEAN_ATTRIBUTE = 0x0FFF,
-#endif /* U_HIDE_INTERNAL_API */
+#endif /* U_HIDE_INTERNAL_API */
/** If 1, specifies that if setting the "max integer digits" attribute would truncate a value, set an error status rather than silently truncating.
* For example, formatting the value 1234 with 4 max int digits would succeed, but formatting 12345 would fail. There is no effect on parsing.
@@ -1067,7 +1067,7 @@ typedef enum UNumberFormatAttribute {
* Default: 0 (unset)
* @stable ICU 50
*/
- UNUM_PARSE_NO_EXPONENT = 0x1001,
+ UNUM_PARSE_NO_EXPONENT = 0x1001,
/**
* if this attribute is set to 1, specifies that, if the pattern contains a
@@ -1079,29 +1079,29 @@ typedef enum UNumberFormatAttribute {
*/
UNUM_PARSE_DECIMAL_MARK_REQUIRED = 0x1002,
- /**
- * Parsing: if set to 1, parsing is sensitive to case (lowercase/uppercase).
- *
- * @stable ICU 64
- */
- UNUM_PARSE_CASE_SENSITIVE = 0x1003,
-
- /**
- * Formatting: if set to 1, whether to show the plus sign on non-negative numbers.
- *
- * For better control over sign display, use UNumberFormatter.
- *
- * @stable ICU 64
- */
- UNUM_SIGN_ALWAYS_SHOWN = 0x1004,
-
-#ifndef U_HIDE_INTERNAL_API
- /** Limit of boolean attributes. (value should
- * not depend on U_HIDE conditionals)
+ /**
+ * Parsing: if set to 1, parsing is sensitive to case (lowercase/uppercase).
+ *
+ * @stable ICU 64
+ */
+ UNUM_PARSE_CASE_SENSITIVE = 0x1003,
+
+ /**
+ * Formatting: if set to 1, whether to show the plus sign on non-negative numbers.
+ *
+ * For better control over sign display, use UNumberFormatter.
+ *
+ * @stable ICU 64
+ */
+ UNUM_SIGN_ALWAYS_SHOWN = 0x1004,
+
+#ifndef U_HIDE_INTERNAL_API
+ /** Limit of boolean attributes. (value should
+ * not depend on U_HIDE conditionals)
* @internal */
- UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1005,
-#endif /* U_HIDE_INTERNAL_API */
-
+ UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1005,
+#endif /* U_HIDE_INTERNAL_API */
+
} UNumberFormatAttribute;
/**
@@ -1385,7 +1385,7 @@ typedef enum UNumberFormatSymbol {
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
UNUM_FORMAT_SYMBOL_COUNT = 28
-#endif /* U_HIDE_DEPRECATED_API */
+#endif /* U_HIDE_DEPRECATED_API */
} UNumberFormatSymbol;
/**
diff --git a/contrib/libs/icu/include/unicode/unumberformatter.h b/contrib/libs/icu/include/unicode/unumberformatter.h
index 26a6c1fcb4..af98ba0027 100644
--- a/contrib/libs/icu/include/unicode/unumberformatter.h
+++ b/contrib/libs/icu/include/unicode/unumberformatter.h
@@ -1,705 +1,705 @@
-// © 2018 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-#ifndef __UNUMBERFORMATTER_H__
-#define __UNUMBERFORMATTER_H__
-
-#include "unicode/parseerr.h"
-#include "unicode/ufieldpositer.h"
-#include "unicode/umisc.h"
-#include "unicode/uformattedvalue.h"
-
-
-/**
- * \file
- * \brief C-compatible API for localized number formatting; not recommended for C++.
- *
- * This is the C-compatible version of the NumberFormatter API introduced in ICU 60. C++ users should
- * include unicode/numberformatter.h and use the proper C++ APIs.
- *
- * The C API accepts a number skeleton string for specifying the settings for formatting, which covers a
- * very large subset of all possible number formatting features. For more information on number skeleton
- * strings, see unicode/numberformatter.h.
- *
- * When using UNumberFormatter, which is treated as immutable, the results are exported to a mutable
- * UFormattedNumber object, which you subsequently use for populating your string buffer or iterating over
- * the fields.
- *
- * Example code:
- * <pre>
- * // Setup:
- * UErrorCode ec = U_ZERO_ERROR;
- * UNumberFormatter* uformatter = unumf_openForSkeletonAndLocale(u"precision-integer", -1, "en", &ec);
- * UFormattedNumber* uresult = unumf_openResult(&ec);
- * if (U_FAILURE(ec)) { return; }
- *
- * // Format a double:
- * unumf_formatDouble(uformatter, 5142.3, uresult, &ec);
- * if (U_FAILURE(ec)) { return; }
- *
- * // Export the string to a malloc'd buffer:
- * int32_t len = unumf_resultToString(uresult, NULL, 0, &ec);
- * // at this point, ec == U_BUFFER_OVERFLOW_ERROR
- * ec = U_ZERO_ERROR;
- * UChar* buffer = (UChar*) malloc((len+1)*sizeof(UChar));
- * unumf_resultToString(uresult, buffer, len+1, &ec);
- * if (U_FAILURE(ec)) { return; }
- * // buffer should equal "5,142"
- *
- * // Cleanup:
- * unumf_close(uformatter);
- * unumf_closeResult(uresult);
- * free(buffer);
- * </pre>
- *
- * If you are a C++ user linking against the C libraries, you can use the LocalPointer versions of these
- * APIs. The following example uses LocalPointer with the decimal number and field position APIs:
- *
- * <pre>
- * // Setup:
- * LocalUNumberFormatterPointer uformatter(unumf_openForSkeletonAndLocale(u"percent", -1, "en", &ec));
- * LocalUFormattedNumberPointer uresult(unumf_openResult(&ec));
- * if (U_FAILURE(ec)) { return; }
- *
- * // Format a decimal number:
- * unumf_formatDecimal(uformatter.getAlias(), "9.87E-3", -1, uresult.getAlias(), &ec);
- * if (U_FAILURE(ec)) { return; }
- *
- * // Get the location of the percent sign:
- * UFieldPosition ufpos = {UNUM_PERCENT_FIELD, 0, 0};
- * unumf_resultNextFieldPosition(uresult.getAlias(), &ufpos, &ec);
- * // ufpos should contain beginIndex=7 and endIndex=8 since the string is "0.00987%"
- *
- * // No need to do any cleanup since we are using LocalPointer.
- * </pre>
- */
-
-/**
- * An enum declaring how to render units, including currencies. Example outputs when formatting 123 USD and 123
- * meters in <em>en-CA</em>:
- *
- * <p>
- * <ul>
- * <li>NARROW*: "$123.00" and "123 m"
- * <li>SHORT: "US$ 123.00" and "123 m"
- * <li>FULL_NAME: "123.00 US dollars" and "123 meters"
- * <li>ISO_CODE: "USD 123.00" and undefined behavior
- * <li>HIDDEN: "123.00" and "123"
- * </ul>
- *
- * <p>
- * This enum is similar to {@link UMeasureFormatWidth}.
- *
- * @stable ICU 60
- */
-typedef enum UNumberUnitWidth {
- /**
- * Print an abbreviated version of the unit name. Similar to SHORT, but always use the shortest available
- * abbreviation or symbol. This option can be used when the context hints at the identity of the unit. For more
- * information on the difference between NARROW and SHORT, see SHORT.
- *
- * <p>
- * In CLDR, this option corresponds to the "Narrow" format for measure units and the "¤¤¤¤¤" placeholder for
- * currencies.
- *
- * @stable ICU 60
- */
- UNUM_UNIT_WIDTH_NARROW,
-
- /**
- * Print an abbreviated version of the unit name. Similar to NARROW, but use a slightly wider abbreviation or
- * symbol when there may be ambiguity. This is the default behavior.
- *
- * <p>
- * For example, in <em>es-US</em>, the SHORT form for Fahrenheit is "{0} °F", but the NARROW form is "{0}°",
- * since Fahrenheit is the customary unit for temperature in that locale.
- *
- * <p>
- * In CLDR, this option corresponds to the "Short" format for measure units and the "¤" placeholder for
- * currencies.
- *
- * @stable ICU 60
- */
- UNUM_UNIT_WIDTH_SHORT,
-
- /**
- * Print the full name of the unit, without any abbreviations.
- *
- * <p>
- * In CLDR, this option corresponds to the default format for measure units and the "¤¤¤" placeholder for
- * currencies.
- *
- * @stable ICU 60
- */
- UNUM_UNIT_WIDTH_FULL_NAME,
-
- /**
- * Use the three-digit ISO XXX code in place of the symbol for displaying currencies. The behavior of this
- * option is currently undefined for use with measure units.
- *
- * <p>
- * In CLDR, this option corresponds to the "¤¤" placeholder for currencies.
- *
- * @stable ICU 60
- */
- UNUM_UNIT_WIDTH_ISO_CODE,
-
- /**
- * Format the number according to the specified unit, but do not display the unit. For currencies, apply
- * monetary symbols and formats as with SHORT, but omit the currency symbol. For measure units, the behavior is
- * equivalent to not specifying the unit at all.
- *
- * @stable ICU 60
- */
- UNUM_UNIT_WIDTH_HIDDEN,
-
- /**
- * One more than the highest UNumberUnitWidth value.
- *
- * @internal ICU 60: The numeric value may change over time; see ICU ticket #12420.
- */
- UNUM_UNIT_WIDTH_COUNT
-} UNumberUnitWidth;
-
-/**
- * An enum declaring the strategy for when and how to display grouping separators (i.e., the
- * separator, often a comma or period, after every 2-3 powers of ten). The choices are several
- * pre-built strategies for different use cases that employ locale data whenever possible. Example
- * outputs for 1234 and 1234567 in <em>en-IN</em>:
- *
- * <ul>
- * <li>OFF: 1234 and 12345
- * <li>MIN2: 1234 and 12,34,567
- * <li>AUTO: 1,234 and 12,34,567
- * <li>ON_ALIGNED: 1,234 and 12,34,567
- * <li>THOUSANDS: 1,234 and 1,234,567
- * </ul>
- *
- * <p>
- * The default is AUTO, which displays grouping separators unless the locale data says that grouping
- * is not customary. To force grouping for all numbers greater than 1000 consistently across locales,
- * use ON_ALIGNED. On the other hand, to display grouping less frequently than the default, use MIN2
- * or OFF. See the docs of each option for details.
- *
- * <p>
- * Note: This enum specifies the strategy for grouping sizes. To set which character to use as the
- * grouping separator, use the "symbols" setter.
- *
- * @stable ICU 63
- */
-typedef enum UNumberGroupingStrategy {
- /**
- * Do not display grouping separators in any locale.
- *
- * @stable ICU 61
- */
- UNUM_GROUPING_OFF,
-
- /**
- * Display grouping using locale defaults, except do not show grouping on values smaller than
- * 10000 (such that there is a <em>minimum of two digits</em> before the first separator).
- *
- * <p>
- * Note that locales may restrict grouping separators to be displayed only on 1 million or
- * greater (for example, ee and hu) or disable grouping altogether (for example, bg currency).
- *
- * <p>
- * Locale data is used to determine whether to separate larger numbers into groups of 2
- * (customary in South Asia) or groups of 3 (customary in Europe and the Americas).
- *
- * @stable ICU 61
- */
- UNUM_GROUPING_MIN2,
-
- /**
- * Display grouping using the default strategy for all locales. This is the default behavior.
- *
- * <p>
- * Note that locales may restrict grouping separators to be displayed only on 1 million or
- * greater (for example, ee and hu) or disable grouping altogether (for example, bg currency).
- *
- * <p>
- * Locale data is used to determine whether to separate larger numbers into groups of 2
- * (customary in South Asia) or groups of 3 (customary in Europe and the Americas).
- *
- * @stable ICU 61
- */
- UNUM_GROUPING_AUTO,
-
- /**
- * Always display the grouping separator on values of at least 1000.
- *
- * <p>
- * This option ignores the locale data that restricts or disables grouping, described in MIN2 and
- * AUTO. This option may be useful to normalize the alignment of numbers, such as in a
- * spreadsheet.
- *
- * <p>
- * Locale data is used to determine whether to separate larger numbers into groups of 2
- * (customary in South Asia) or groups of 3 (customary in Europe and the Americas).
- *
- * @stable ICU 61
- */
- UNUM_GROUPING_ON_ALIGNED,
-
- /**
- * Use the Western defaults: groups of 3 and enabled for all numbers 1000 or greater. Do not use
- * locale data for determining the grouping strategy.
- *
- * @stable ICU 61
- */
- UNUM_GROUPING_THOUSANDS
-
-#ifndef U_HIDE_INTERNAL_API
- ,
- /**
- * One more than the highest UNumberGroupingStrategy value.
- *
- * @internal ICU 62: The numeric value may change over time; see ICU ticket #12420.
- */
- UNUM_GROUPING_COUNT
-#endif /* U_HIDE_INTERNAL_API */
-
-} UNumberGroupingStrategy;
-
-/**
- * An enum declaring how to denote positive and negative numbers. Example outputs when formatting
- * 123, 0, and -123 in <em>en-US</em>:
- *
- * <ul>
- * <li>AUTO: "123", "0", and "-123"
- * <li>ALWAYS: "+123", "+0", and "-123"
- * <li>NEVER: "123", "0", and "123"
- * <li>ACCOUNTING: "$123", "$0", and "($123)"
- * <li>ACCOUNTING_ALWAYS: "+$123", "+$0", and "($123)"
- * <li>EXCEPT_ZERO: "+123", "0", and "-123"
- * <li>ACCOUNTING_EXCEPT_ZERO: "+$123", "$0", and "($123)"
- * </ul>
- *
- * <p>
- * The exact format, including the position and the code point of the sign, differ by locale.
- *
- * @stable ICU 60
- */
-typedef enum UNumberSignDisplay {
- /**
- * Show the minus sign on negative numbers, and do not show the sign on positive numbers. This is the default
- * behavior.
- *
- * @stable ICU 60
- */
- UNUM_SIGN_AUTO,
-
- /**
- * Show the minus sign on negative numbers and the plus sign on positive numbers, including zero.
- * To hide the sign on zero, see {@link UNUM_SIGN_EXCEPT_ZERO}.
- *
- * @stable ICU 60
- */
- UNUM_SIGN_ALWAYS,
-
- /**
- * Do not show the sign on positive or negative numbers.
- *
- * @stable ICU 60
- */
- UNUM_SIGN_NEVER,
-
- /**
- * Use the locale-dependent accounting format on negative numbers, and do not show the sign on positive numbers.
- *
- * <p>
- * The accounting format is defined in CLDR and varies by locale; in many Western locales, the format is a pair
- * of parentheses around the number.
- *
- * <p>
- * Note: Since CLDR defines the accounting format in the monetary context only, this option falls back to the
- * AUTO sign display strategy when formatting without a currency unit. This limitation may be lifted in the
- * future.
- *
- * @stable ICU 60
- */
- UNUM_SIGN_ACCOUNTING,
-
- /**
- * Use the locale-dependent accounting format on negative numbers, and show the plus sign on
- * positive numbers, including zero. For more information on the accounting format, see the
- * ACCOUNTING sign display strategy. To hide the sign on zero, see
- * {@link UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO}.
- *
- * @stable ICU 60
- */
- UNUM_SIGN_ACCOUNTING_ALWAYS,
-
- /**
- * Show the minus sign on negative numbers and the plus sign on positive numbers. Do not show a
- * sign on zero, numbers that round to zero, or NaN.
- *
- * @stable ICU 61
- */
- UNUM_SIGN_EXCEPT_ZERO,
-
- /**
- * Use the locale-dependent accounting format on negative numbers, and show the plus sign on
- * positive numbers. Do not show a sign on zero, numbers that round to zero, or NaN. For more
- * information on the accounting format, see the ACCOUNTING sign display strategy.
- *
- * @stable ICU 61
- */
- UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO,
-
- /**
- * One more than the highest UNumberSignDisplay value.
- *
- * @internal ICU 60: The numeric value may change over time; see ICU ticket #12420.
- */
- UNUM_SIGN_COUNT
-} UNumberSignDisplay;
-
-/**
- * An enum declaring how to render the decimal separator.
- *
- * <p>
- * <ul>
- * <li>UNUM_DECIMAL_SEPARATOR_AUTO: "1", "1.1"
- * <li>UNUM_DECIMAL_SEPARATOR_ALWAYS: "1.", "1.1"
- * </ul>
- *
- * @stable ICU 60
- */
-typedef enum UNumberDecimalSeparatorDisplay {
- /**
- * Show the decimal separator when there are one or more digits to display after the separator, and do not show
- * it otherwise. This is the default behavior.
- *
- * @stable ICU 60
- */
- UNUM_DECIMAL_SEPARATOR_AUTO,
-
- /**
- * Always show the decimal separator, even if there are no digits to display after the separator.
- *
- * @stable ICU 60
- */
- UNUM_DECIMAL_SEPARATOR_ALWAYS,
-
- /**
- * One more than the highest UNumberDecimalSeparatorDisplay value.
- *
- * @internal ICU 60: The numeric value may change over time; see ICU ticket #12420.
- */
- UNUM_DECIMAL_SEPARATOR_COUNT
-} UNumberDecimalSeparatorDisplay;
-
-struct UNumberFormatter;
-/**
- * C-compatible version of icu::number::LocalizedNumberFormatter.
- *
- * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
- *
- * @stable ICU 62
- */
-typedef struct UNumberFormatter UNumberFormatter;
-
-struct UFormattedNumber;
-/**
- * C-compatible version of icu::number::FormattedNumber.
- *
- * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
- *
- * @stable ICU 62
- */
-typedef struct UFormattedNumber UFormattedNumber;
-
-
-/**
- * Creates a new UNumberFormatter for the given skeleton string and locale. This is currently the only
- * method for creating a new UNumberFormatter.
- *
- * Objects of type UNumberFormatter returned by this method are threadsafe.
- *
- * For more details on skeleton strings, see the documentation in numberformatter.h. For more details on
- * the usage of this API, see the documentation at the top of unumberformatter.h.
- *
- * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
- *
- * @param skeleton The skeleton string, like u"percent precision-integer"
- * @param skeletonLen The number of UChars in the skeleton string, or -1 if it is NUL-terminated.
- * @param locale The NUL-terminated locale ID.
- * @param ec Set if an error occurs.
- * @stable ICU 62
- */
-U_STABLE UNumberFormatter* U_EXPORT2
-unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const char* locale,
- UErrorCode* ec);
-
-
-/**
- * Like unumf_openForSkeletonAndLocale, but accepts a UParseError, which will be populated with the
- * location of a skeleton syntax error if such a syntax error exists.
- *
- * @param skeleton The skeleton string, like u"percent precision-integer"
- * @param skeletonLen The number of UChars in the skeleton string, or -1 if it is NUL-terminated.
- * @param locale The NUL-terminated locale ID.
- * @param perror A parse error struct populated if an error occurs when parsing. Can be NULL.
- * If no error occurs, perror->offset will be set to -1.
- * @param ec Set if an error occurs.
- * @stable ICU 64
- */
-U_STABLE UNumberFormatter* U_EXPORT2
-unumf_openForSkeletonAndLocaleWithError(
- const UChar* skeleton, int32_t skeletonLen, const char* locale, UParseError* perror, UErrorCode* ec);
-
-
-/**
- * Creates an object to hold the result of a UNumberFormatter
- * operation. The object can be used repeatedly; it is cleared whenever
- * passed to a format function.
- *
- * @param ec Set if an error occurs.
- * @stable ICU 62
- */
-U_STABLE UFormattedNumber* U_EXPORT2
-unumf_openResult(UErrorCode* ec);
-
-
-/**
- * Uses a UNumberFormatter to format an integer to a UFormattedNumber. A string, field position, and other
- * information can be retrieved from the UFormattedNumber.
- *
- * The UNumberFormatter can be shared between threads. Each thread should have its own local
- * UFormattedNumber, however, for storing the result of the formatting operation.
- *
- * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
- *
- * @param uformatter A formatter object created by unumf_openForSkeletonAndLocale or similar.
- * @param value The number to be formatted.
- * @param uresult The object that will be mutated to store the result; see unumf_openResult.
- * @param ec Set if an error occurs.
- * @stable ICU 62
- */
-U_STABLE void U_EXPORT2
-unumf_formatInt(const UNumberFormatter* uformatter, int64_t value, UFormattedNumber* uresult,
- UErrorCode* ec);
-
-
-/**
- * Uses a UNumberFormatter to format a double to a UFormattedNumber. A string, field position, and other
- * information can be retrieved from the UFormattedNumber.
- *
- * The UNumberFormatter can be shared between threads. Each thread should have its own local
- * UFormattedNumber, however, for storing the result of the formatting operation.
- *
- * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
- *
- * @param uformatter A formatter object created by unumf_openForSkeletonAndLocale or similar.
- * @param value The number to be formatted.
- * @param uresult The object that will be mutated to store the result; see unumf_openResult.
- * @param ec Set if an error occurs.
- * @stable ICU 62
- */
-U_STABLE void U_EXPORT2
-unumf_formatDouble(const UNumberFormatter* uformatter, double value, UFormattedNumber* uresult,
- UErrorCode* ec);
-
-
-/**
- * Uses a UNumberFormatter to format a decimal number to a UFormattedNumber. A string, field position, and
- * other information can be retrieved from the UFormattedNumber.
- *
- * The UNumberFormatter can be shared between threads. Each thread should have its own local
- * UFormattedNumber, however, for storing the result of the formatting operation.
- *
- * The syntax of the unformatted number is a "numeric string" as defined in the Decimal Arithmetic
- * Specification, available at http://speleotrove.com/decimal
- *
- * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
- *
- * @param uformatter A formatter object created by unumf_openForSkeletonAndLocale or similar.
- * @param value The numeric string to be formatted.
- * @param valueLen The length of the numeric string, or -1 if it is NUL-terminated.
- * @param uresult The object that will be mutated to store the result; see unumf_openResult.
- * @param ec Set if an error occurs.
- * @stable ICU 62
- */
-U_STABLE void U_EXPORT2
-unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32_t valueLen,
- UFormattedNumber* uresult, UErrorCode* ec);
-
-/**
- * Returns a representation of a UFormattedNumber as a UFormattedValue,
- * which can be subsequently passed to any API requiring that type.
- *
- * The returned object is owned by the UFormattedNumber and is valid
- * only as long as the UFormattedNumber is present and unchanged in memory.
- *
- * You can think of this method as a cast between types.
- *
- * @param uresult The object containing the formatted string.
- * @param ec Set if an error occurs.
- * @return A UFormattedValue owned by the input object.
- * @stable ICU 64
- */
-U_STABLE const UFormattedValue* U_EXPORT2
-unumf_resultAsValue(const UFormattedNumber* uresult, UErrorCode* ec);
-
-
-/**
- * Extracts the result number string out of a UFormattedNumber to a UChar buffer if possible.
- * If bufferCapacity is greater than the required length, a terminating NUL is written.
- * If bufferCapacity is less than the required length, an error code is set.
- *
- * Also see ufmtval_getString, which returns a NUL-terminated string:
- *
- * int32_t len;
- * const UChar* str = ufmtval_getString(unumf_resultAsValue(uresult, &ec), &len, &ec);
- *
- * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
- *
- * @param uresult The object containing the formatted number.
- * @param buffer Where to save the string output.
- * @param bufferCapacity The number of UChars available in the buffer.
- * @param ec Set if an error occurs.
- * @return The required length.
- * @stable ICU 62
- */
-U_STABLE int32_t U_EXPORT2
-unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t bufferCapacity,
- UErrorCode* ec);
-
-
-/**
- * Determines the start and end indices of the next occurrence of the given <em>field</em> in the
- * output string. This allows you to determine the locations of, for example, the integer part,
- * fraction part, or symbols.
- *
- * This is a simpler but less powerful alternative to {@link ufmtval_nextPosition}.
- *
- * If a field occurs just once, calling this method will find that occurrence and return it. If a
- * field occurs multiple times, this method may be called repeatedly with the following pattern:
- *
- * <pre>
- * UFieldPosition ufpos = {UNUM_GROUPING_SEPARATOR_FIELD, 0, 0};
- * while (unumf_resultNextFieldPosition(uresult, ufpos, &ec)) {
- * // do something with ufpos.
- * }
- * </pre>
- *
- * This method is useful if you know which field to query. If you want all available field position
- * information, use unumf_resultGetAllFieldPositions().
- *
- * NOTE: All fields of the UFieldPosition must be initialized before calling this method.
- *
- * @param uresult The object containing the formatted number.
- * @param ufpos
- * Input+output variable. On input, the "field" property determines which field to look up,
- * and the "endIndex" property determines where to begin the search. On output, the
- * "beginIndex" field is set to the beginning of the first occurrence of the field after the
- * input "endIndex", and "endIndex" is set to the end of that occurrence of the field
- * (exclusive index). If a field position is not found, the FieldPosition is not changed and
- * the method returns FALSE.
- * @param ec Set if an error occurs.
- * @stable ICU 62
- */
-U_STABLE UBool U_EXPORT2
-unumf_resultNextFieldPosition(const UFormattedNumber* uresult, UFieldPosition* ufpos, UErrorCode* ec);
-
-
-/**
- * Populates the given iterator with all fields in the formatted output string. This allows you to
- * determine the locations of the integer part, fraction part, and sign.
- *
- * This is an alternative to the more powerful {@link ufmtval_nextPosition} API.
- *
- * If you need information on only one field, use {@link ufmtval_nextPosition} or
- * {@link unumf_resultNextFieldPosition}.
- *
- * @param uresult The object containing the formatted number.
- * @param ufpositer
- * A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open}. Iteration
- * information already present in the UFieldPositionIterator is deleted, and the iterator is reset
- * to apply to the fields in the formatted string created by this function call. The field values
- * and indexes returned by {@link #ufieldpositer_next} represent fields denoted by
- * the UNumberFormatFields enum. Fields are not returned in a guaranteed order. Fields cannot
- * overlap, but they may nest. For example, 1234 could format as "1,234" which might consist of a
- * grouping separator field for ',' and an integer field encompassing the entire string.
- * @param ec Set if an error occurs.
- * @stable ICU 62
- */
-U_STABLE void U_EXPORT2
-unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPositionIterator* ufpositer,
- UErrorCode* ec);
-
-
-// TODO(ICU-20775): Propose this as API.
-// NOTE: This is not currently implemented.
-// U_DRAFT int32_t U_EXPORT2
-// unumf_resultToDecimalNumber(const UFormattedNumber* uresult, char* buffer, int32_t bufferCapacity,
-// UErrorCode* ec);
-
-
-/**
- * Releases the UNumberFormatter created by unumf_openForSkeletonAndLocale().
- *
- * @param uformatter An object created by unumf_openForSkeletonAndLocale().
- * @stable ICU 62
- */
-U_STABLE void U_EXPORT2
-unumf_close(UNumberFormatter* uformatter);
-
-
-/**
- * Releases the UFormattedNumber created by unumf_openResult().
- *
- * @param uresult An object created by unumf_openResult().
- * @stable ICU 62
- */
-U_STABLE void U_EXPORT2
-unumf_closeResult(UFormattedNumber* uresult);
-
-
-#if U_SHOW_CPLUSPLUS_API
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUNumberFormatterPointer
- * "Smart pointer" class; closes a UNumberFormatter via unumf_close().
- * For most methods see the LocalPointerBase base class.
- *
- * Usage:
- * <pre>
- * LocalUNumberFormatterPointer uformatter(unumf_openForSkeletonAndLocale(...));
- * // no need to explicitly call unumf_close()
- * </pre>
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 62
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatterPointer, UNumberFormatter, unumf_close);
-
-/**
- * \class LocalUFormattedNumberPointer
- * "Smart pointer" class; closes a UFormattedNumber via unumf_closeResult().
- * For most methods see the LocalPointerBase base class.
- *
- * Usage:
- * <pre>
- * LocalUFormattedNumberPointer uformatter(unumf_openResult(...));
- * // no need to explicitly call unumf_closeResult()
- * </pre>
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 62
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedNumberPointer, UFormattedNumber, unumf_closeResult);
-
-U_NAMESPACE_END
-#endif // U_SHOW_CPLUSPLUS_API
-
-#endif //__UNUMBERFORMATTER_H__
-#endif /* #if !UCONFIG_NO_FORMATTING */
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef __UNUMBERFORMATTER_H__
+#define __UNUMBERFORMATTER_H__
+
+#include "unicode/parseerr.h"
+#include "unicode/ufieldpositer.h"
+#include "unicode/umisc.h"
+#include "unicode/uformattedvalue.h"
+
+
+/**
+ * \file
+ * \brief C-compatible API for localized number formatting; not recommended for C++.
+ *
+ * This is the C-compatible version of the NumberFormatter API introduced in ICU 60. C++ users should
+ * include unicode/numberformatter.h and use the proper C++ APIs.
+ *
+ * The C API accepts a number skeleton string for specifying the settings for formatting, which covers a
+ * very large subset of all possible number formatting features. For more information on number skeleton
+ * strings, see unicode/numberformatter.h.
+ *
+ * When using UNumberFormatter, which is treated as immutable, the results are exported to a mutable
+ * UFormattedNumber object, which you subsequently use for populating your string buffer or iterating over
+ * the fields.
+ *
+ * Example code:
+ * <pre>
+ * // Setup:
+ * UErrorCode ec = U_ZERO_ERROR;
+ * UNumberFormatter* uformatter = unumf_openForSkeletonAndLocale(u"precision-integer", -1, "en", &ec);
+ * UFormattedNumber* uresult = unumf_openResult(&ec);
+ * if (U_FAILURE(ec)) { return; }
+ *
+ * // Format a double:
+ * unumf_formatDouble(uformatter, 5142.3, uresult, &ec);
+ * if (U_FAILURE(ec)) { return; }
+ *
+ * // Export the string to a malloc'd buffer:
+ * int32_t len = unumf_resultToString(uresult, NULL, 0, &ec);
+ * // at this point, ec == U_BUFFER_OVERFLOW_ERROR
+ * ec = U_ZERO_ERROR;
+ * UChar* buffer = (UChar*) malloc((len+1)*sizeof(UChar));
+ * unumf_resultToString(uresult, buffer, len+1, &ec);
+ * if (U_FAILURE(ec)) { return; }
+ * // buffer should equal "5,142"
+ *
+ * // Cleanup:
+ * unumf_close(uformatter);
+ * unumf_closeResult(uresult);
+ * free(buffer);
+ * </pre>
+ *
+ * If you are a C++ user linking against the C libraries, you can use the LocalPointer versions of these
+ * APIs. The following example uses LocalPointer with the decimal number and field position APIs:
+ *
+ * <pre>
+ * // Setup:
+ * LocalUNumberFormatterPointer uformatter(unumf_openForSkeletonAndLocale(u"percent", -1, "en", &ec));
+ * LocalUFormattedNumberPointer uresult(unumf_openResult(&ec));
+ * if (U_FAILURE(ec)) { return; }
+ *
+ * // Format a decimal number:
+ * unumf_formatDecimal(uformatter.getAlias(), "9.87E-3", -1, uresult.getAlias(), &ec);
+ * if (U_FAILURE(ec)) { return; }
+ *
+ * // Get the location of the percent sign:
+ * UFieldPosition ufpos = {UNUM_PERCENT_FIELD, 0, 0};
+ * unumf_resultNextFieldPosition(uresult.getAlias(), &ufpos, &ec);
+ * // ufpos should contain beginIndex=7 and endIndex=8 since the string is "0.00987%"
+ *
+ * // No need to do any cleanup since we are using LocalPointer.
+ * </pre>
+ */
+
+/**
+ * An enum declaring how to render units, including currencies. Example outputs when formatting 123 USD and 123
+ * meters in <em>en-CA</em>:
+ *
+ * <p>
+ * <ul>
+ * <li>NARROW*: "$123.00" and "123 m"
+ * <li>SHORT: "US$ 123.00" and "123 m"
+ * <li>FULL_NAME: "123.00 US dollars" and "123 meters"
+ * <li>ISO_CODE: "USD 123.00" and undefined behavior
+ * <li>HIDDEN: "123.00" and "123"
+ * </ul>
+ *
+ * <p>
+ * This enum is similar to {@link UMeasureFormatWidth}.
+ *
+ * @stable ICU 60
+ */
+typedef enum UNumberUnitWidth {
+ /**
+ * Print an abbreviated version of the unit name. Similar to SHORT, but always use the shortest available
+ * abbreviation or symbol. This option can be used when the context hints at the identity of the unit. For more
+ * information on the difference between NARROW and SHORT, see SHORT.
+ *
+ * <p>
+ * In CLDR, this option corresponds to the "Narrow" format for measure units and the "¤¤¤¤¤" placeholder for
+ * currencies.
+ *
+ * @stable ICU 60
+ */
+ UNUM_UNIT_WIDTH_NARROW,
+
+ /**
+ * Print an abbreviated version of the unit name. Similar to NARROW, but use a slightly wider abbreviation or
+ * symbol when there may be ambiguity. This is the default behavior.
+ *
+ * <p>
+ * For example, in <em>es-US</em>, the SHORT form for Fahrenheit is "{0} °F", but the NARROW form is "{0}°",
+ * since Fahrenheit is the customary unit for temperature in that locale.
+ *
+ * <p>
+ * In CLDR, this option corresponds to the "Short" format for measure units and the "¤" placeholder for
+ * currencies.
+ *
+ * @stable ICU 60
+ */
+ UNUM_UNIT_WIDTH_SHORT,
+
+ /**
+ * Print the full name of the unit, without any abbreviations.
+ *
+ * <p>
+ * In CLDR, this option corresponds to the default format for measure units and the "¤¤¤" placeholder for
+ * currencies.
+ *
+ * @stable ICU 60
+ */
+ UNUM_UNIT_WIDTH_FULL_NAME,
+
+ /**
+ * Use the three-digit ISO XXX code in place of the symbol for displaying currencies. The behavior of this
+ * option is currently undefined for use with measure units.
+ *
+ * <p>
+ * In CLDR, this option corresponds to the "¤¤" placeholder for currencies.
+ *
+ * @stable ICU 60
+ */
+ UNUM_UNIT_WIDTH_ISO_CODE,
+
+ /**
+ * Format the number according to the specified unit, but do not display the unit. For currencies, apply
+ * monetary symbols and formats as with SHORT, but omit the currency symbol. For measure units, the behavior is
+ * equivalent to not specifying the unit at all.
+ *
+ * @stable ICU 60
+ */
+ UNUM_UNIT_WIDTH_HIDDEN,
+
+ /**
+ * One more than the highest UNumberUnitWidth value.
+ *
+ * @internal ICU 60: The numeric value may change over time; see ICU ticket #12420.
+ */
+ UNUM_UNIT_WIDTH_COUNT
+} UNumberUnitWidth;
+
+/**
+ * An enum declaring the strategy for when and how to display grouping separators (i.e., the
+ * separator, often a comma or period, after every 2-3 powers of ten). The choices are several
+ * pre-built strategies for different use cases that employ locale data whenever possible. Example
+ * outputs for 1234 and 1234567 in <em>en-IN</em>:
+ *
+ * <ul>
+ * <li>OFF: 1234 and 12345
+ * <li>MIN2: 1234 and 12,34,567
+ * <li>AUTO: 1,234 and 12,34,567
+ * <li>ON_ALIGNED: 1,234 and 12,34,567
+ * <li>THOUSANDS: 1,234 and 1,234,567
+ * </ul>
+ *
+ * <p>
+ * The default is AUTO, which displays grouping separators unless the locale data says that grouping
+ * is not customary. To force grouping for all numbers greater than 1000 consistently across locales,
+ * use ON_ALIGNED. On the other hand, to display grouping less frequently than the default, use MIN2
+ * or OFF. See the docs of each option for details.
+ *
+ * <p>
+ * Note: This enum specifies the strategy for grouping sizes. To set which character to use as the
+ * grouping separator, use the "symbols" setter.
+ *
+ * @stable ICU 63
+ */
+typedef enum UNumberGroupingStrategy {
+ /**
+ * Do not display grouping separators in any locale.
+ *
+ * @stable ICU 61
+ */
+ UNUM_GROUPING_OFF,
+
+ /**
+ * Display grouping using locale defaults, except do not show grouping on values smaller than
+ * 10000 (such that there is a <em>minimum of two digits</em> before the first separator).
+ *
+ * <p>
+ * Note that locales may restrict grouping separators to be displayed only on 1 million or
+ * greater (for example, ee and hu) or disable grouping altogether (for example, bg currency).
+ *
+ * <p>
+ * Locale data is used to determine whether to separate larger numbers into groups of 2
+ * (customary in South Asia) or groups of 3 (customary in Europe and the Americas).
+ *
+ * @stable ICU 61
+ */
+ UNUM_GROUPING_MIN2,
+
+ /**
+ * Display grouping using the default strategy for all locales. This is the default behavior.
+ *
+ * <p>
+ * Note that locales may restrict grouping separators to be displayed only on 1 million or
+ * greater (for example, ee and hu) or disable grouping altogether (for example, bg currency).
+ *
+ * <p>
+ * Locale data is used to determine whether to separate larger numbers into groups of 2
+ * (customary in South Asia) or groups of 3 (customary in Europe and the Americas).
+ *
+ * @stable ICU 61
+ */
+ UNUM_GROUPING_AUTO,
+
+ /**
+ * Always display the grouping separator on values of at least 1000.
+ *
+ * <p>
+ * This option ignores the locale data that restricts or disables grouping, described in MIN2 and
+ * AUTO. This option may be useful to normalize the alignment of numbers, such as in a
+ * spreadsheet.
+ *
+ * <p>
+ * Locale data is used to determine whether to separate larger numbers into groups of 2
+ * (customary in South Asia) or groups of 3 (customary in Europe and the Americas).
+ *
+ * @stable ICU 61
+ */
+ UNUM_GROUPING_ON_ALIGNED,
+
+ /**
+ * Use the Western defaults: groups of 3 and enabled for all numbers 1000 or greater. Do not use
+ * locale data for determining the grouping strategy.
+ *
+ * @stable ICU 61
+ */
+ UNUM_GROUPING_THOUSANDS
+
+#ifndef U_HIDE_INTERNAL_API
+ ,
+ /**
+ * One more than the highest UNumberGroupingStrategy value.
+ *
+ * @internal ICU 62: The numeric value may change over time; see ICU ticket #12420.
+ */
+ UNUM_GROUPING_COUNT
+#endif /* U_HIDE_INTERNAL_API */
+
+} UNumberGroupingStrategy;
+
+/**
+ * An enum declaring how to denote positive and negative numbers. Example outputs when formatting
+ * 123, 0, and -123 in <em>en-US</em>:
+ *
+ * <ul>
+ * <li>AUTO: "123", "0", and "-123"
+ * <li>ALWAYS: "+123", "+0", and "-123"
+ * <li>NEVER: "123", "0", and "123"
+ * <li>ACCOUNTING: "$123", "$0", and "($123)"
+ * <li>ACCOUNTING_ALWAYS: "+$123", "+$0", and "($123)"
+ * <li>EXCEPT_ZERO: "+123", "0", and "-123"
+ * <li>ACCOUNTING_EXCEPT_ZERO: "+$123", "$0", and "($123)"
+ * </ul>
+ *
+ * <p>
+ * The exact format, including the position and the code point of the sign, differ by locale.
+ *
+ * @stable ICU 60
+ */
+typedef enum UNumberSignDisplay {
+ /**
+ * Show the minus sign on negative numbers, and do not show the sign on positive numbers. This is the default
+ * behavior.
+ *
+ * @stable ICU 60
+ */
+ UNUM_SIGN_AUTO,
+
+ /**
+ * Show the minus sign on negative numbers and the plus sign on positive numbers, including zero.
+ * To hide the sign on zero, see {@link UNUM_SIGN_EXCEPT_ZERO}.
+ *
+ * @stable ICU 60
+ */
+ UNUM_SIGN_ALWAYS,
+
+ /**
+ * Do not show the sign on positive or negative numbers.
+ *
+ * @stable ICU 60
+ */
+ UNUM_SIGN_NEVER,
+
+ /**
+ * Use the locale-dependent accounting format on negative numbers, and do not show the sign on positive numbers.
+ *
+ * <p>
+ * The accounting format is defined in CLDR and varies by locale; in many Western locales, the format is a pair
+ * of parentheses around the number.
+ *
+ * <p>
+ * Note: Since CLDR defines the accounting format in the monetary context only, this option falls back to the
+ * AUTO sign display strategy when formatting without a currency unit. This limitation may be lifted in the
+ * future.
+ *
+ * @stable ICU 60
+ */
+ UNUM_SIGN_ACCOUNTING,
+
+ /**
+ * Use the locale-dependent accounting format on negative numbers, and show the plus sign on
+ * positive numbers, including zero. For more information on the accounting format, see the
+ * ACCOUNTING sign display strategy. To hide the sign on zero, see
+ * {@link UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO}.
+ *
+ * @stable ICU 60
+ */
+ UNUM_SIGN_ACCOUNTING_ALWAYS,
+
+ /**
+ * Show the minus sign on negative numbers and the plus sign on positive numbers. Do not show a
+ * sign on zero, numbers that round to zero, or NaN.
+ *
+ * @stable ICU 61
+ */
+ UNUM_SIGN_EXCEPT_ZERO,
+
+ /**
+ * Use the locale-dependent accounting format on negative numbers, and show the plus sign on
+ * positive numbers. Do not show a sign on zero, numbers that round to zero, or NaN. For more
+ * information on the accounting format, see the ACCOUNTING sign display strategy.
+ *
+ * @stable ICU 61
+ */
+ UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO,
+
+ /**
+ * One more than the highest UNumberSignDisplay value.
+ *
+ * @internal ICU 60: The numeric value may change over time; see ICU ticket #12420.
+ */
+ UNUM_SIGN_COUNT
+} UNumberSignDisplay;
+
+/**
+ * An enum declaring how to render the decimal separator.
+ *
+ * <p>
+ * <ul>
+ * <li>UNUM_DECIMAL_SEPARATOR_AUTO: "1", "1.1"
+ * <li>UNUM_DECIMAL_SEPARATOR_ALWAYS: "1.", "1.1"
+ * </ul>
+ *
+ * @stable ICU 60
+ */
+typedef enum UNumberDecimalSeparatorDisplay {
+ /**
+ * Show the decimal separator when there are one or more digits to display after the separator, and do not show
+ * it otherwise. This is the default behavior.
+ *
+ * @stable ICU 60
+ */
+ UNUM_DECIMAL_SEPARATOR_AUTO,
+
+ /**
+ * Always show the decimal separator, even if there are no digits to display after the separator.
+ *
+ * @stable ICU 60
+ */
+ UNUM_DECIMAL_SEPARATOR_ALWAYS,
+
+ /**
+ * One more than the highest UNumberDecimalSeparatorDisplay value.
+ *
+ * @internal ICU 60: The numeric value may change over time; see ICU ticket #12420.
+ */
+ UNUM_DECIMAL_SEPARATOR_COUNT
+} UNumberDecimalSeparatorDisplay;
+
+struct UNumberFormatter;
+/**
+ * C-compatible version of icu::number::LocalizedNumberFormatter.
+ *
+ * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
+ *
+ * @stable ICU 62
+ */
+typedef struct UNumberFormatter UNumberFormatter;
+
+struct UFormattedNumber;
+/**
+ * C-compatible version of icu::number::FormattedNumber.
+ *
+ * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
+ *
+ * @stable ICU 62
+ */
+typedef struct UFormattedNumber UFormattedNumber;
+
+
+/**
+ * Creates a new UNumberFormatter for the given skeleton string and locale. This is currently the only
+ * method for creating a new UNumberFormatter.
+ *
+ * Objects of type UNumberFormatter returned by this method are threadsafe.
+ *
+ * For more details on skeleton strings, see the documentation in numberformatter.h. For more details on
+ * the usage of this API, see the documentation at the top of unumberformatter.h.
+ *
+ * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
+ *
+ * @param skeleton The skeleton string, like u"percent precision-integer"
+ * @param skeletonLen The number of UChars in the skeleton string, or -1 if it is NUL-terminated.
+ * @param locale The NUL-terminated locale ID.
+ * @param ec Set if an error occurs.
+ * @stable ICU 62
+ */
+U_STABLE UNumberFormatter* U_EXPORT2
+unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const char* locale,
+ UErrorCode* ec);
+
+
+/**
+ * Like unumf_openForSkeletonAndLocale, but accepts a UParseError, which will be populated with the
+ * location of a skeleton syntax error if such a syntax error exists.
+ *
+ * @param skeleton The skeleton string, like u"percent precision-integer"
+ * @param skeletonLen The number of UChars in the skeleton string, or -1 if it is NUL-terminated.
+ * @param locale The NUL-terminated locale ID.
+ * @param perror A parse error struct populated if an error occurs when parsing. Can be NULL.
+ * If no error occurs, perror->offset will be set to -1.
+ * @param ec Set if an error occurs.
+ * @stable ICU 64
+ */
+U_STABLE UNumberFormatter* U_EXPORT2
+unumf_openForSkeletonAndLocaleWithError(
+ const UChar* skeleton, int32_t skeletonLen, const char* locale, UParseError* perror, UErrorCode* ec);
+
+
+/**
+ * Creates an object to hold the result of a UNumberFormatter
+ * operation. The object can be used repeatedly; it is cleared whenever
+ * passed to a format function.
+ *
+ * @param ec Set if an error occurs.
+ * @stable ICU 62
+ */
+U_STABLE UFormattedNumber* U_EXPORT2
+unumf_openResult(UErrorCode* ec);
+
+
+/**
+ * Uses a UNumberFormatter to format an integer to a UFormattedNumber. A string, field position, and other
+ * information can be retrieved from the UFormattedNumber.
+ *
+ * The UNumberFormatter can be shared between threads. Each thread should have its own local
+ * UFormattedNumber, however, for storing the result of the formatting operation.
+ *
+ * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
+ *
+ * @param uformatter A formatter object created by unumf_openForSkeletonAndLocale or similar.
+ * @param value The number to be formatted.
+ * @param uresult The object that will be mutated to store the result; see unumf_openResult.
+ * @param ec Set if an error occurs.
+ * @stable ICU 62
+ */
+U_STABLE void U_EXPORT2
+unumf_formatInt(const UNumberFormatter* uformatter, int64_t value, UFormattedNumber* uresult,
+ UErrorCode* ec);
+
+
+/**
+ * Uses a UNumberFormatter to format a double to a UFormattedNumber. A string, field position, and other
+ * information can be retrieved from the UFormattedNumber.
+ *
+ * The UNumberFormatter can be shared between threads. Each thread should have its own local
+ * UFormattedNumber, however, for storing the result of the formatting operation.
+ *
+ * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
+ *
+ * @param uformatter A formatter object created by unumf_openForSkeletonAndLocale or similar.
+ * @param value The number to be formatted.
+ * @param uresult The object that will be mutated to store the result; see unumf_openResult.
+ * @param ec Set if an error occurs.
+ * @stable ICU 62
+ */
+U_STABLE void U_EXPORT2
+unumf_formatDouble(const UNumberFormatter* uformatter, double value, UFormattedNumber* uresult,
+ UErrorCode* ec);
+
+
+/**
+ * Uses a UNumberFormatter to format a decimal number to a UFormattedNumber. A string, field position, and
+ * other information can be retrieved from the UFormattedNumber.
+ *
+ * The UNumberFormatter can be shared between threads. Each thread should have its own local
+ * UFormattedNumber, however, for storing the result of the formatting operation.
+ *
+ * The syntax of the unformatted number is a "numeric string" as defined in the Decimal Arithmetic
+ * Specification, available at http://speleotrove.com/decimal
+ *
+ * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
+ *
+ * @param uformatter A formatter object created by unumf_openForSkeletonAndLocale or similar.
+ * @param value The numeric string to be formatted.
+ * @param valueLen The length of the numeric string, or -1 if it is NUL-terminated.
+ * @param uresult The object that will be mutated to store the result; see unumf_openResult.
+ * @param ec Set if an error occurs.
+ * @stable ICU 62
+ */
+U_STABLE void U_EXPORT2
+unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32_t valueLen,
+ UFormattedNumber* uresult, UErrorCode* ec);
+
+/**
+ * Returns a representation of a UFormattedNumber as a UFormattedValue,
+ * which can be subsequently passed to any API requiring that type.
+ *
+ * The returned object is owned by the UFormattedNumber and is valid
+ * only as long as the UFormattedNumber is present and unchanged in memory.
+ *
+ * You can think of this method as a cast between types.
+ *
+ * @param uresult The object containing the formatted string.
+ * @param ec Set if an error occurs.
+ * @return A UFormattedValue owned by the input object.
+ * @stable ICU 64
+ */
+U_STABLE const UFormattedValue* U_EXPORT2
+unumf_resultAsValue(const UFormattedNumber* uresult, UErrorCode* ec);
+
+
+/**
+ * Extracts the result number string out of a UFormattedNumber to a UChar buffer if possible.
+ * If bufferCapacity is greater than the required length, a terminating NUL is written.
+ * If bufferCapacity is less than the required length, an error code is set.
+ *
+ * Also see ufmtval_getString, which returns a NUL-terminated string:
+ *
+ * int32_t len;
+ * const UChar* str = ufmtval_getString(unumf_resultAsValue(uresult, &ec), &len, &ec);
+ *
+ * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
+ *
+ * @param uresult The object containing the formatted number.
+ * @param buffer Where to save the string output.
+ * @param bufferCapacity The number of UChars available in the buffer.
+ * @param ec Set if an error occurs.
+ * @return The required length.
+ * @stable ICU 62
+ */
+U_STABLE int32_t U_EXPORT2
+unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t bufferCapacity,
+ UErrorCode* ec);
+
+
+/**
+ * Determines the start and end indices of the next occurrence of the given <em>field</em> in the
+ * output string. This allows you to determine the locations of, for example, the integer part,
+ * fraction part, or symbols.
+ *
+ * This is a simpler but less powerful alternative to {@link ufmtval_nextPosition}.
+ *
+ * If a field occurs just once, calling this method will find that occurrence and return it. If a
+ * field occurs multiple times, this method may be called repeatedly with the following pattern:
+ *
+ * <pre>
+ * UFieldPosition ufpos = {UNUM_GROUPING_SEPARATOR_FIELD, 0, 0};
+ * while (unumf_resultNextFieldPosition(uresult, ufpos, &ec)) {
+ * // do something with ufpos.
+ * }
+ * </pre>
+ *
+ * This method is useful if you know which field to query. If you want all available field position
+ * information, use unumf_resultGetAllFieldPositions().
+ *
+ * NOTE: All fields of the UFieldPosition must be initialized before calling this method.
+ *
+ * @param uresult The object containing the formatted number.
+ * @param ufpos
+ * Input+output variable. On input, the "field" property determines which field to look up,
+ * and the "endIndex" property determines where to begin the search. On output, the
+ * "beginIndex" field is set to the beginning of the first occurrence of the field after the
+ * input "endIndex", and "endIndex" is set to the end of that occurrence of the field
+ * (exclusive index). If a field position is not found, the FieldPosition is not changed and
+ * the method returns FALSE.
+ * @param ec Set if an error occurs.
+ * @stable ICU 62
+ */
+U_STABLE UBool U_EXPORT2
+unumf_resultNextFieldPosition(const UFormattedNumber* uresult, UFieldPosition* ufpos, UErrorCode* ec);
+
+
+/**
+ * Populates the given iterator with all fields in the formatted output string. This allows you to
+ * determine the locations of the integer part, fraction part, and sign.
+ *
+ * This is an alternative to the more powerful {@link ufmtval_nextPosition} API.
+ *
+ * If you need information on only one field, use {@link ufmtval_nextPosition} or
+ * {@link unumf_resultNextFieldPosition}.
+ *
+ * @param uresult The object containing the formatted number.
+ * @param ufpositer
+ * A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open}. Iteration
+ * information already present in the UFieldPositionIterator is deleted, and the iterator is reset
+ * to apply to the fields in the formatted string created by this function call. The field values
+ * and indexes returned by {@link #ufieldpositer_next} represent fields denoted by
+ * the UNumberFormatFields enum. Fields are not returned in a guaranteed order. Fields cannot
+ * overlap, but they may nest. For example, 1234 could format as "1,234" which might consist of a
+ * grouping separator field for ',' and an integer field encompassing the entire string.
+ * @param ec Set if an error occurs.
+ * @stable ICU 62
+ */
+U_STABLE void U_EXPORT2
+unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPositionIterator* ufpositer,
+ UErrorCode* ec);
+
+
+// TODO(ICU-20775): Propose this as API.
+// NOTE: This is not currently implemented.
+// U_DRAFT int32_t U_EXPORT2
+// unumf_resultToDecimalNumber(const UFormattedNumber* uresult, char* buffer, int32_t bufferCapacity,
+// UErrorCode* ec);
+
+
+/**
+ * Releases the UNumberFormatter created by unumf_openForSkeletonAndLocale().
+ *
+ * @param uformatter An object created by unumf_openForSkeletonAndLocale().
+ * @stable ICU 62
+ */
+U_STABLE void U_EXPORT2
+unumf_close(UNumberFormatter* uformatter);
+
+
+/**
+ * Releases the UFormattedNumber created by unumf_openResult().
+ *
+ * @param uresult An object created by unumf_openResult().
+ * @stable ICU 62
+ */
+U_STABLE void U_EXPORT2
+unumf_closeResult(UFormattedNumber* uresult);
+
+
+#if U_SHOW_CPLUSPLUS_API
+U_NAMESPACE_BEGIN
+
+/**
+ * \class LocalUNumberFormatterPointer
+ * "Smart pointer" class; closes a UNumberFormatter via unumf_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * Usage:
+ * <pre>
+ * LocalUNumberFormatterPointer uformatter(unumf_openForSkeletonAndLocale(...));
+ * // no need to explicitly call unumf_close()
+ * </pre>
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 62
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatterPointer, UNumberFormatter, unumf_close);
+
+/**
+ * \class LocalUFormattedNumberPointer
+ * "Smart pointer" class; closes a UFormattedNumber via unumf_closeResult().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * Usage:
+ * <pre>
+ * LocalUFormattedNumberPointer uformatter(unumf_openResult(...));
+ * // no need to explicitly call unumf_closeResult()
+ * </pre>
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 62
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedNumberPointer, UFormattedNumber, unumf_closeResult);
+
+U_NAMESPACE_END
+#endif // U_SHOW_CPLUSPLUS_API
+
+#endif //__UNUMBERFORMATTER_H__
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/include/unicode/unumsys.h b/contrib/libs/icu/include/unicode/unumsys.h
index 1529290717..1631c234fd 100644
--- a/contrib/libs/icu/include/unicode/unumsys.h
+++ b/contrib/libs/icu/include/unicode/unumsys.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************************
@@ -105,7 +105,7 @@ U_NAMESPACE_END
/**
* Returns an enumeration over the names of all of the predefined numbering systems known
* to ICU.
- * The numbering system names will be in alphabetical (invariant) order.
+ * The numbering system names will be in alphabetical (invariant) order.
* @param status A pointer to a UErrorCode to receive any errors.
* @return A pointer to a UEnumeration that must be closed with uenum_close(),
* or NULL if an error occurred.
diff --git a/contrib/libs/icu/include/unicode/uobject.h b/contrib/libs/icu/include/unicode/uobject.h
index 3eff5aac88..eeb331ce97 100644
--- a/contrib/libs/icu/include/unicode/uobject.h
+++ b/contrib/libs/icu/include/unicode/uobject.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: uobject.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -21,10 +21,10 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
-#include "unicode/platform.h"
-
+#if U_SHOW_CPLUSPLUS_API
+
+#include "unicode/platform.h"
+
/**
* \file
* \brief C++ API: Common ICU base class UObject.
@@ -32,21 +32,21 @@
/**
* \def U_NO_THROW
- * Since ICU 64, use U_NOEXCEPT instead.
- *
- * Previously, define this to define the throw() specification so
+ * Since ICU 64, use U_NOEXCEPT instead.
+ *
+ * Previously, define this to define the throw() specification so
* certain functions do not throw any exceptions
*
- * UMemory operator new methods should have the throw() specification
+ * UMemory operator new methods should have the throw() specification
* appended to them, so that the compiler adds the additional NULL check
* before calling constructors. Without, if <code>operator new</code> returns NULL the
* constructor is still called, and if the constructor references member
* data, (which it typically does), the result is a segmentation violation.
*
- * @stable ICU 4.2. Since ICU 64, Use U_NOEXCEPT instead. See ICU-20422.
+ * @stable ICU 4.2. Since ICU 64, Use U_NOEXCEPT instead. See ICU-20422.
*/
#ifndef U_NO_THROW
-#define U_NO_THROW U_NOEXCEPT
+#define U_NO_THROW U_NOEXCEPT
#endif
/*===========================================================================*/
@@ -131,14 +131,14 @@ public:
* for ICU4C C++ classes
* @stable ICU 2.4
*/
- static void * U_EXPORT2 operator new(size_t size) U_NOEXCEPT;
+ static void * U_EXPORT2 operator new(size_t size) U_NOEXCEPT;
/**
* Override for ICU4C C++ memory management.
* See new().
* @stable ICU 2.4
*/
- static void * U_EXPORT2 operator new[](size_t size) U_NOEXCEPT;
+ static void * U_EXPORT2 operator new[](size_t size) U_NOEXCEPT;
/**
* Override for ICU4C C++ memory management.
@@ -148,14 +148,14 @@ public:
* for ICU4C C++ classes
* @stable ICU 2.4
*/
- static void U_EXPORT2 operator delete(void *p) U_NOEXCEPT;
+ static void U_EXPORT2 operator delete(void *p) U_NOEXCEPT;
/**
* Override for ICU4C C++ memory management.
* See delete().
* @stable ICU 2.4
*/
- static void U_EXPORT2 operator delete[](void *p) U_NOEXCEPT;
+ static void U_EXPORT2 operator delete[](void *p) U_NOEXCEPT;
#if U_HAVE_PLACEMENT_NEW
/**
@@ -163,14 +163,14 @@ public:
* See new().
* @stable ICU 2.6
*/
- static inline void * U_EXPORT2 operator new(size_t, void *ptr) U_NOEXCEPT { return ptr; }
+ static inline void * U_EXPORT2 operator new(size_t, void *ptr) U_NOEXCEPT { return ptr; }
/**
* Override for ICU4C C++ memory management for STL.
* See delete().
* @stable ICU 2.6
*/
- static inline void U_EXPORT2 operator delete(void *, void *) U_NOEXCEPT {}
+ static inline void U_EXPORT2 operator delete(void *, void *) U_NOEXCEPT {}
#endif /* U_HAVE_PLACEMENT_NEW */
#if U_HAVE_DEBUG_LOCATION_NEW
/**
@@ -180,7 +180,7 @@ public:
* @param file The file where the allocation was requested
* @param line The line where the allocation was requested
*/
- static void * U_EXPORT2 operator new(size_t size, const char* file, int line) U_NOEXCEPT;
+ static void * U_EXPORT2 operator new(size_t size, const char* file, int line) U_NOEXCEPT;
/**
* This method provides a matching delete for the MFC debug new
*
@@ -188,7 +188,7 @@ public:
* @param file The file where the allocation was requested
* @param line The line where the allocation was requested
*/
- static void U_EXPORT2 operator delete(void* p, const char* file, int line) U_NOEXCEPT;
+ static void U_EXPORT2 operator delete(void* p, const char* file, int line) U_NOEXCEPT;
#endif /* U_HAVE_DEBUG_LOCATION_NEW */
#endif /* U_OVERRIDE_CXX_ALLOCATION */
@@ -215,7 +215,7 @@ public:
* The clone() function is not available in UObject because it is not
* implemented by all ICU classes.
* Many ICU services provide a clone() function for their class trees,
- * defined on the service's C++ base class
+ * defined on the service's C++ base class
* (which itself is a subclass of UObject).
*
* @stable ICU 2.2
@@ -319,6 +319,6 @@ protected:
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/upluralrules.h b/contrib/libs/icu/include/unicode/upluralrules.h
index b5e77d07a5..9c09dfab8b 100644
--- a/contrib/libs/icu/include/unicode/upluralrules.h
+++ b/contrib/libs/icu/include/unicode/upluralrules.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************************
@@ -15,14 +15,14 @@
#if !UCONFIG_NO_FORMATTING
#include "unicode/localpointer.h"
-#include "unicode/uenum.h"
-#ifndef U_HIDE_INTERNAL_API
-#include "unicode/unum.h"
-#endif /* U_HIDE_INTERNAL_API */
-
-// Forward-declaration
-struct UFormattedNumber;
-
+#include "unicode/uenum.h"
+#ifndef U_HIDE_INTERNAL_API
+#include "unicode/unum.h"
+#endif /* U_HIDE_INTERNAL_API */
+
+// Forward-declaration
+struct UFormattedNumber;
+
/**
* \file
* \brief C API: Plural rules, select plural keywords for numeric values.
@@ -67,7 +67,7 @@ enum UPluralType {
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
UPLURAL_TYPE_COUNT
-#endif /* U_HIDE_DEPRECATED_API */
+#endif /* U_HIDE_DEPRECATED_API */
};
/**
* @stable ICU 50
@@ -90,7 +90,7 @@ typedef struct UPluralRules UPluralRules; /**< C typedef for struct UPluralRule
* @return A UPluralRules for the specified locale, or NULL if an error occurred.
* @stable ICU 4.8
*/
-U_CAPI UPluralRules* U_EXPORT2
+U_CAPI UPluralRules* U_EXPORT2
uplrules_open(const char *locale, UErrorCode *status);
/**
@@ -102,7 +102,7 @@ uplrules_open(const char *locale, UErrorCode *status);
* @return A UPluralRules for the specified locale, or NULL if an error occurred.
* @stable ICU 50
*/
-U_CAPI UPluralRules* U_EXPORT2
+U_CAPI UPluralRules* U_EXPORT2
uplrules_openForType(const char *locale, UPluralType type, UErrorCode *status);
/**
@@ -110,7 +110,7 @@ uplrules_openForType(const char *locale, UPluralType type, UErrorCode *status);
* @param uplrules The UPluralRules object to close.
* @stable ICU 4.8
*/
-U_CAPI void U_EXPORT2
+U_CAPI void U_EXPORT2
uplrules_close(UPluralRules *uplrules);
@@ -135,88 +135,88 @@ U_NAMESPACE_END
/**
- * Given a floating-point number, returns the keyword of the first rule that
+ * Given a floating-point number, returns the keyword of the first rule that
* applies to the number, according to the supplied UPluralRules object.
* @param uplrules The UPluralRules object specifying the rules.
* @param number The number for which the rule has to be determined.
- * @param keyword An output buffer to write the keyword of the rule that
- * applies to number.
- * @param capacity The capacity of the keyword buffer.
+ * @param keyword An output buffer to write the keyword of the rule that
+ * applies to number.
+ * @param capacity The capacity of the keyword buffer.
* @param status A pointer to a UErrorCode to receive any errors.
- * @return The length of the keyword.
+ * @return The length of the keyword.
* @stable ICU 4.8
*/
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
uplrules_select(const UPluralRules *uplrules,
double number,
UChar *keyword, int32_t capacity,
UErrorCode *status);
-/**
- * Given a formatted number, returns the keyword of the first rule
- * that applies to the number, according to the supplied UPluralRules object.
- *
- * A UFormattedNumber allows you to specify an exponent or trailing zeros,
- * which can affect the plural category. To get a UFormattedNumber, see
- * {@link UNumberFormatter}.
- *
- * @param uplrules The UPluralRules object specifying the rules.
- * @param number The formatted number for which the rule has to be determined.
- * @param keyword The destination buffer for the keyword of the rule that
- * applies to number.
- * @param capacity The capacity of the keyword buffer.
- * @param status A pointer to a UErrorCode to receive any errors.
- * @return The length of the keyword.
- * @stable ICU 64
- */
-U_CAPI int32_t U_EXPORT2
-uplrules_selectFormatted(const UPluralRules *uplrules,
- const struct UFormattedNumber* number,
- UChar *keyword, int32_t capacity,
- UErrorCode *status);
-
-#ifndef U_HIDE_INTERNAL_API
-/**
- * Given a number, returns the keyword of the first rule that applies to the
- * number, according to the UPluralRules object and given the number format
- * specified by the UNumberFormat object.
- * Note: This internal preview interface may be removed in the future if
- * an architecturally cleaner solution reaches stable status.
- * @param uplrules The UPluralRules object specifying the rules.
- * @param number The number for which the rule has to be determined.
- * @param fmt The UNumberFormat specifying how the number will be formatted
- * (this can affect the plural form, e.g. "1 dollar" vs "1.0 dollars").
- * If this is NULL, the function behaves like uplrules_select.
- * @param keyword An output buffer to write the keyword of the rule that
- * applies to number.
- * @param capacity The capacity of the keyword buffer.
- * @param status A pointer to a UErrorCode to receive any errors.
- * @return The length of keyword.
- * @internal ICU 59 technology preview, may be removed in the future
- */
-U_INTERNAL int32_t U_EXPORT2
-uplrules_selectWithFormat(const UPluralRules *uplrules,
- double number,
- const UNumberFormat *fmt,
- UChar *keyword, int32_t capacity,
- UErrorCode *status);
-
-#endif /* U_HIDE_INTERNAL_API */
-
-/**
- * Creates a string enumeration of all plural rule keywords used in this
- * UPluralRules object. The rule "other" is always present by default.
- * @param uplrules The UPluralRules object specifying the rules for
- * a given locale.
- * @param status A pointer to a UErrorCode to receive any errors.
- * @return a string enumeration over plural rule keywords, or NULL
- * upon error. The caller is responsible for closing the result.
- * @stable ICU 59
- */
-U_STABLE UEnumeration* U_EXPORT2
-uplrules_getKeywords(const UPluralRules *uplrules,
- UErrorCode *status);
-
+/**
+ * Given a formatted number, returns the keyword of the first rule
+ * that applies to the number, according to the supplied UPluralRules object.
+ *
+ * A UFormattedNumber allows you to specify an exponent or trailing zeros,
+ * which can affect the plural category. To get a UFormattedNumber, see
+ * {@link UNumberFormatter}.
+ *
+ * @param uplrules The UPluralRules object specifying the rules.
+ * @param number The formatted number for which the rule has to be determined.
+ * @param keyword The destination buffer for the keyword of the rule that
+ * applies to number.
+ * @param capacity The capacity of the keyword buffer.
+ * @param status A pointer to a UErrorCode to receive any errors.
+ * @return The length of the keyword.
+ * @stable ICU 64
+ */
+U_CAPI int32_t U_EXPORT2
+uplrules_selectFormatted(const UPluralRules *uplrules,
+ const struct UFormattedNumber* number,
+ UChar *keyword, int32_t capacity,
+ UErrorCode *status);
+
+#ifndef U_HIDE_INTERNAL_API
+/**
+ * Given a number, returns the keyword of the first rule that applies to the
+ * number, according to the UPluralRules object and given the number format
+ * specified by the UNumberFormat object.
+ * Note: This internal preview interface may be removed in the future if
+ * an architecturally cleaner solution reaches stable status.
+ * @param uplrules The UPluralRules object specifying the rules.
+ * @param number The number for which the rule has to be determined.
+ * @param fmt The UNumberFormat specifying how the number will be formatted
+ * (this can affect the plural form, e.g. "1 dollar" vs "1.0 dollars").
+ * If this is NULL, the function behaves like uplrules_select.
+ * @param keyword An output buffer to write the keyword of the rule that
+ * applies to number.
+ * @param capacity The capacity of the keyword buffer.
+ * @param status A pointer to a UErrorCode to receive any errors.
+ * @return The length of keyword.
+ * @internal ICU 59 technology preview, may be removed in the future
+ */
+U_INTERNAL int32_t U_EXPORT2
+uplrules_selectWithFormat(const UPluralRules *uplrules,
+ double number,
+ const UNumberFormat *fmt,
+ UChar *keyword, int32_t capacity,
+ UErrorCode *status);
+
+#endif /* U_HIDE_INTERNAL_API */
+
+/**
+ * Creates a string enumeration of all plural rule keywords used in this
+ * UPluralRules object. The rule "other" is always present by default.
+ * @param uplrules The UPluralRules object specifying the rules for
+ * a given locale.
+ * @param status A pointer to a UErrorCode to receive any errors.
+ * @return a string enumeration over plural rule keywords, or NULL
+ * upon error. The caller is responsible for closing the result.
+ * @stable ICU 59
+ */
+U_STABLE UEnumeration* U_EXPORT2
+uplrules_getKeywords(const UPluralRules *uplrules,
+ UErrorCode *status);
+
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif
diff --git a/contrib/libs/icu/include/unicode/uregex.h b/contrib/libs/icu/include/unicode/uregex.h
index 2023781ed0..131c492a55 100644
--- a/contrib/libs/icu/include/unicode/uregex.h
+++ b/contrib/libs/icu/include/unicode/uregex.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: uregex.h
-* encoding: UTF-8
+* encoding: UTF-8
* indentation:4
*
* created on: 2004mar09
@@ -167,7 +167,7 @@ uregex_openUText(UText *pattern,
UParseError *pe,
UErrorCode *status);
-#if !UCONFIG_NO_CONVERSION
+#if !UCONFIG_NO_CONVERSION
/**
* Open (compile) an ICU regular expression. The resulting regular expression
* handle can then be used to perform various matching operations.
diff --git a/contrib/libs/icu/include/unicode/uregion.h b/contrib/libs/icu/include/unicode/uregion.h
index da68350694..a5de49674b 100644
--- a/contrib/libs/icu/include/unicode/uregion.h
+++ b/contrib/libs/icu/include/unicode/uregion.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************************
@@ -113,7 +113,7 @@ typedef enum URegionType {
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
URGN_LIMIT
-#endif /* U_HIDE_DEPRECATED_API */
+#endif /* U_HIDE_DEPRECATED_API */
} URegionType;
#if !UCONFIG_NO_FORMATTING
diff --git a/contrib/libs/icu/include/unicode/ureldatefmt.h b/contrib/libs/icu/include/unicode/ureldatefmt.h
index fbae5aa122..e2e1974f2d 100644
--- a/contrib/libs/icu/include/unicode/ureldatefmt.h
+++ b/contrib/libs/icu/include/unicode/ureldatefmt.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************************
@@ -17,7 +17,7 @@
#include "unicode/unum.h"
#include "unicode/udisplaycontext.h"
#include "unicode/localpointer.h"
-#include "unicode/uformattedvalue.h"
+#include "unicode/uformattedvalue.h"
/**
* \file
@@ -35,7 +35,7 @@
* for determining which unit to use, such as deciding between "in 7 days"
* and "in 1 week".
*
- * @stable ICU 57
+ * @stable ICU 57
*/
/**
@@ -67,103 +67,103 @@ typedef enum UDateRelativeDateTimeFormatterStyle {
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
UDAT_STYLE_COUNT
-#endif /* U_HIDE_DEPRECATED_API */
+#endif /* U_HIDE_DEPRECATED_API */
} UDateRelativeDateTimeFormatterStyle;
/**
* Represents the unit for formatting a relative date. e.g "in 5 days"
* or "next year"
- * @stable ICU 57
+ * @stable ICU 57
*/
typedef enum URelativeDateTimeUnit {
/**
* Specifies that relative unit is year, e.g. "last year",
* "in 5 years".
- * @stable ICU 57
+ * @stable ICU 57
*/
UDAT_REL_UNIT_YEAR,
/**
* Specifies that relative unit is quarter, e.g. "last quarter",
* "in 5 quarters".
- * @stable ICU 57
+ * @stable ICU 57
*/
UDAT_REL_UNIT_QUARTER,
/**
* Specifies that relative unit is month, e.g. "last month",
* "in 5 months".
- * @stable ICU 57
+ * @stable ICU 57
*/
UDAT_REL_UNIT_MONTH,
/**
* Specifies that relative unit is week, e.g. "last week",
* "in 5 weeks".
- * @stable ICU 57
+ * @stable ICU 57
*/
UDAT_REL_UNIT_WEEK,
/**
* Specifies that relative unit is day, e.g. "yesterday",
* "in 5 days".
- * @stable ICU 57
+ * @stable ICU 57
*/
UDAT_REL_UNIT_DAY,
/**
* Specifies that relative unit is hour, e.g. "1 hour ago",
* "in 5 hours".
- * @stable ICU 57
+ * @stable ICU 57
*/
UDAT_REL_UNIT_HOUR,
/**
* Specifies that relative unit is minute, e.g. "1 minute ago",
* "in 5 minutes".
- * @stable ICU 57
+ * @stable ICU 57
*/
UDAT_REL_UNIT_MINUTE,
/**
* Specifies that relative unit is second, e.g. "1 second ago",
* "in 5 seconds".
- * @stable ICU 57
+ * @stable ICU 57
*/
UDAT_REL_UNIT_SECOND,
/**
* Specifies that relative unit is Sunday, e.g. "last Sunday",
* "this Sunday", "next Sunday", "in 5 Sundays".
- * @stable ICU 57
+ * @stable ICU 57
*/
UDAT_REL_UNIT_SUNDAY,
/**
* Specifies that relative unit is Monday, e.g. "last Monday",
* "this Monday", "next Monday", "in 5 Mondays".
- * @stable ICU 57
+ * @stable ICU 57
*/
UDAT_REL_UNIT_MONDAY,
/**
* Specifies that relative unit is Tuesday, e.g. "last Tuesday",
* "this Tuesday", "next Tuesday", "in 5 Tuesdays".
- * @stable ICU 57
+ * @stable ICU 57
*/
UDAT_REL_UNIT_TUESDAY,
/**
* Specifies that relative unit is Wednesday, e.g. "last Wednesday",
* "this Wednesday", "next Wednesday", "in 5 Wednesdays".
- * @stable ICU 57
+ * @stable ICU 57
*/
UDAT_REL_UNIT_WEDNESDAY,
/**
* Specifies that relative unit is Thursday, e.g. "last Thursday",
* "this Thursday", "next Thursday", "in 5 Thursdays".
- * @stable ICU 57
+ * @stable ICU 57
*/
UDAT_REL_UNIT_THURSDAY,
/**
* Specifies that relative unit is Friday, e.g. "last Friday",
* "this Friday", "next Friday", "in 5 Fridays".
- * @stable ICU 57
+ * @stable ICU 57
*/
UDAT_REL_UNIT_FRIDAY,
/**
* Specifies that relative unit is Saturday, e.g. "last Saturday",
* "this Saturday", "next Saturday", "in 5 Saturdays".
- * @stable ICU 57
+ * @stable ICU 57
*/
UDAT_REL_UNIT_SATURDAY,
#ifndef U_HIDE_DEPRECATED_API
@@ -172,34 +172,34 @@ typedef enum URelativeDateTimeUnit {
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
UDAT_REL_UNIT_COUNT
-#endif /* U_HIDE_DEPRECATED_API */
+#endif /* U_HIDE_DEPRECATED_API */
} URelativeDateTimeUnit;
-/**
- * FieldPosition and UFieldPosition selectors for format fields
- * defined by RelativeDateTimeFormatter.
- * @stable ICU 64
- */
-typedef enum URelativeDateTimeFormatterField {
- /**
- * Represents a literal text string, like "tomorrow" or "days ago".
- * @stable ICU 64
- */
- UDAT_REL_LITERAL_FIELD,
- /**
- * Represents a number quantity, like "3" in "3 days ago".
- * @stable ICU 64
- */
- UDAT_REL_NUMERIC_FIELD,
-} URelativeDateTimeFormatterField;
-
-
+/**
+ * FieldPosition and UFieldPosition selectors for format fields
+ * defined by RelativeDateTimeFormatter.
+ * @stable ICU 64
+ */
+typedef enum URelativeDateTimeFormatterField {
+ /**
+ * Represents a literal text string, like "tomorrow" or "days ago".
+ * @stable ICU 64
+ */
+ UDAT_REL_LITERAL_FIELD,
+ /**
+ * Represents a number quantity, like "3" in "3 days ago".
+ * @stable ICU 64
+ */
+ UDAT_REL_NUMERIC_FIELD,
+} URelativeDateTimeFormatterField;
+
+
/**
* Opaque URelativeDateTimeFormatter object for use in C programs.
- * @stable ICU 57
+ * @stable ICU 57
*/
struct URelativeDateTimeFormatter;
-typedef struct URelativeDateTimeFormatter URelativeDateTimeFormatter; /**< C typedef for struct URelativeDateTimeFormatter. @stable ICU 57 */
+typedef struct URelativeDateTimeFormatter URelativeDateTimeFormatter; /**< C typedef for struct URelativeDateTimeFormatter. @stable ICU 57 */
/**
@@ -232,9 +232,9 @@ typedef struct URelativeDateTimeFormatter URelativeDateTimeFormatter; /**< C ty
* @return
* A pointer to a URelativeDateTimeFormatter object for the specified locale,
* or NULL if an error occurred.
- * @stable ICU 57
+ * @stable ICU 57
*/
-U_STABLE URelativeDateTimeFormatter* U_EXPORT2
+U_STABLE URelativeDateTimeFormatter* U_EXPORT2
ureldatefmt_open( const char* locale,
UNumberFormat* nfToAdopt,
UDateRelativeDateTimeFormatterStyle width,
@@ -245,57 +245,57 @@ ureldatefmt_open( const char* locale,
* Close a URelativeDateTimeFormatter object. Once closed it may no longer be used.
* @param reldatefmt
* The URelativeDateTimeFormatter object to close.
- * @stable ICU 57
+ * @stable ICU 57
*/
-U_STABLE void U_EXPORT2
+U_STABLE void U_EXPORT2
ureldatefmt_close(URelativeDateTimeFormatter *reldatefmt);
-struct UFormattedRelativeDateTime;
-/**
- * Opaque struct to contain the results of a URelativeDateTimeFormatter operation.
- * @stable ICU 64
- */
-typedef struct UFormattedRelativeDateTime UFormattedRelativeDateTime;
-
-/**
- * Creates an object to hold the result of a URelativeDateTimeFormatter
- * operation. The object can be used repeatedly; it is cleared whenever
- * passed to a format function.
- *
- * @param ec Set if an error occurs.
- * @return A pointer needing ownership.
- * @stable ICU 64
- */
-U_STABLE UFormattedRelativeDateTime* U_EXPORT2
-ureldatefmt_openResult(UErrorCode* ec);
-
-/**
- * Returns a representation of a UFormattedRelativeDateTime as a UFormattedValue,
- * which can be subsequently passed to any API requiring that type.
- *
- * The returned object is owned by the UFormattedRelativeDateTime and is valid
- * only as long as the UFormattedRelativeDateTime is present and unchanged in memory.
- *
- * You can think of this method as a cast between types.
- *
- * @param ufrdt The object containing the formatted string.
- * @param ec Set if an error occurs.
- * @return A UFormattedValue owned by the input object.
- * @stable ICU 64
- */
-U_STABLE const UFormattedValue* U_EXPORT2
-ureldatefmt_resultAsValue(const UFormattedRelativeDateTime* ufrdt, UErrorCode* ec);
-
-/**
- * Releases the UFormattedRelativeDateTime created by ureldatefmt_openResult.
- *
- * @param ufrdt The object to release.
- * @stable ICU 64
- */
-U_STABLE void U_EXPORT2
-ureldatefmt_closeResult(UFormattedRelativeDateTime* ufrdt);
-
-
+struct UFormattedRelativeDateTime;
+/**
+ * Opaque struct to contain the results of a URelativeDateTimeFormatter operation.
+ * @stable ICU 64
+ */
+typedef struct UFormattedRelativeDateTime UFormattedRelativeDateTime;
+
+/**
+ * Creates an object to hold the result of a URelativeDateTimeFormatter
+ * operation. The object can be used repeatedly; it is cleared whenever
+ * passed to a format function.
+ *
+ * @param ec Set if an error occurs.
+ * @return A pointer needing ownership.
+ * @stable ICU 64
+ */
+U_STABLE UFormattedRelativeDateTime* U_EXPORT2
+ureldatefmt_openResult(UErrorCode* ec);
+
+/**
+ * Returns a representation of a UFormattedRelativeDateTime as a UFormattedValue,
+ * which can be subsequently passed to any API requiring that type.
+ *
+ * The returned object is owned by the UFormattedRelativeDateTime and is valid
+ * only as long as the UFormattedRelativeDateTime is present and unchanged in memory.
+ *
+ * You can think of this method as a cast between types.
+ *
+ * @param ufrdt The object containing the formatted string.
+ * @param ec Set if an error occurs.
+ * @return A UFormattedValue owned by the input object.
+ * @stable ICU 64
+ */
+U_STABLE const UFormattedValue* U_EXPORT2
+ureldatefmt_resultAsValue(const UFormattedRelativeDateTime* ufrdt, UErrorCode* ec);
+
+/**
+ * Releases the UFormattedRelativeDateTime created by ureldatefmt_openResult.
+ *
+ * @param ufrdt The object to release.
+ * @stable ICU 64
+ */
+U_STABLE void U_EXPORT2
+ureldatefmt_closeResult(UFormattedRelativeDateTime* ufrdt);
+
+
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
@@ -307,21 +307,21 @@ U_NAMESPACE_BEGIN
*
* @see LocalPointerBase
* @see LocalPointer
- * @stable ICU 57
+ * @stable ICU 57
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalURelativeDateTimeFormatterPointer, URelativeDateTimeFormatter, ureldatefmt_close);
-/**
- * \class LocalUFormattedRelativeDateTimePointer
- * "Smart pointer" class, closes a UFormattedRelativeDateTime via ureldatefmt_closeResult().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 64
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedRelativeDateTimePointer, UFormattedRelativeDateTime, ureldatefmt_closeResult);
-
+/**
+ * \class LocalUFormattedRelativeDateTimePointer
+ * "Smart pointer" class, closes a UFormattedRelativeDateTime via ureldatefmt_closeResult().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 64
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedRelativeDateTimePointer, UFormattedRelativeDateTime, ureldatefmt_closeResult);
+
U_NAMESPACE_END
#endif
@@ -352,9 +352,9 @@ U_NAMESPACE_END
* @return
* The length of the formatted result; may be greater
* than resultCapacity, in which case an error is returned.
- * @stable ICU 57
+ * @stable ICU 57
*/
-U_STABLE int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt,
double offset,
URelativeDateTimeUnit unit,
@@ -363,37 +363,37 @@ ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt,
UErrorCode* status);
/**
- * Format a combination of URelativeDateTimeUnit and numeric
- * offset using a numeric style, e.g. "1 week ago", "in 1 week",
- * "5 weeks ago", "in 5 weeks".
- *
- * @param reldatefmt
- * The URelativeDateTimeFormatter object specifying the
- * format conventions.
- * @param offset
- * The signed offset for the specified unit. This will
- * be formatted according to this object's UNumberFormat
- * object.
- * @param unit
- * The unit to use when formatting the relative
- * date, e.g. UDAT_REL_UNIT_WEEK, UDAT_REL_UNIT_FRIDAY.
- * @param result
- * A pointer to a UFormattedRelativeDateTime to populate.
- * @param status
- * A pointer to a UErrorCode to receive any errors. In
- * case of error status, the contents of result are
- * undefined.
- * @stable ICU 64
- */
-U_STABLE void U_EXPORT2
-ureldatefmt_formatNumericToResult(
- const URelativeDateTimeFormatter* reldatefmt,
- double offset,
- URelativeDateTimeUnit unit,
- UFormattedRelativeDateTime* result,
- UErrorCode* status);
-
-/**
+ * Format a combination of URelativeDateTimeUnit and numeric
+ * offset using a numeric style, e.g. "1 week ago", "in 1 week",
+ * "5 weeks ago", "in 5 weeks".
+ *
+ * @param reldatefmt
+ * The URelativeDateTimeFormatter object specifying the
+ * format conventions.
+ * @param offset
+ * The signed offset for the specified unit. This will
+ * be formatted according to this object's UNumberFormat
+ * object.
+ * @param unit
+ * The unit to use when formatting the relative
+ * date, e.g. UDAT_REL_UNIT_WEEK, UDAT_REL_UNIT_FRIDAY.
+ * @param result
+ * A pointer to a UFormattedRelativeDateTime to populate.
+ * @param status
+ * A pointer to a UErrorCode to receive any errors. In
+ * case of error status, the contents of result are
+ * undefined.
+ * @stable ICU 64
+ */
+U_STABLE void U_EXPORT2
+ureldatefmt_formatNumericToResult(
+ const URelativeDateTimeFormatter* reldatefmt,
+ double offset,
+ URelativeDateTimeUnit unit,
+ UFormattedRelativeDateTime* result,
+ UErrorCode* status);
+
+/**
* Format a combination of URelativeDateTimeUnit and numeric offset
* using a text style if possible, e.g. "last week", "this week",
* "next week", "yesterday", "tomorrow". Falls back to numeric
@@ -419,9 +419,9 @@ ureldatefmt_formatNumericToResult(
* @return
* The length of the formatted result; may be greater
* than resultCapacity, in which case an error is returned.
- * @stable ICU 57
+ * @stable ICU 57
*/
-U_STABLE int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt,
double offset,
URelativeDateTimeUnit unit,
@@ -430,40 +430,40 @@ ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt,
UErrorCode* status);
/**
- * Format a combination of URelativeDateTimeUnit and numeric offset
- * using a text style if possible, e.g. "last week", "this week",
- * "next week", "yesterday", "tomorrow". Falls back to numeric
- * style if no appropriate text term is available for the specified
- * offset in the object's locale.
- *
- * This method populates a UFormattedRelativeDateTime, which exposes more
- * information than the string populated by format().
- *
- * @param reldatefmt
- * The URelativeDateTimeFormatter object specifying the
- * format conventions.
- * @param offset
- * The signed offset for the specified unit.
- * @param unit
- * The unit to use when formatting the relative
- * date, e.g. UDAT_REL_UNIT_WEEK, UDAT_REL_UNIT_FRIDAY.
- * @param result
- * A pointer to a UFormattedRelativeDateTime to populate.
- * @param status
- * A pointer to a UErrorCode to receive any errors. In
- * case of error status, the contents of result are
- * undefined.
- * @stable ICU 64
- */
-U_STABLE void U_EXPORT2
-ureldatefmt_formatToResult(
- const URelativeDateTimeFormatter* reldatefmt,
- double offset,
- URelativeDateTimeUnit unit,
- UFormattedRelativeDateTime* result,
- UErrorCode* status);
-
-/**
+ * Format a combination of URelativeDateTimeUnit and numeric offset
+ * using a text style if possible, e.g. "last week", "this week",
+ * "next week", "yesterday", "tomorrow". Falls back to numeric
+ * style if no appropriate text term is available for the specified
+ * offset in the object's locale.
+ *
+ * This method populates a UFormattedRelativeDateTime, which exposes more
+ * information than the string populated by format().
+ *
+ * @param reldatefmt
+ * The URelativeDateTimeFormatter object specifying the
+ * format conventions.
+ * @param offset
+ * The signed offset for the specified unit.
+ * @param unit
+ * The unit to use when formatting the relative
+ * date, e.g. UDAT_REL_UNIT_WEEK, UDAT_REL_UNIT_FRIDAY.
+ * @param result
+ * A pointer to a UFormattedRelativeDateTime to populate.
+ * @param status
+ * A pointer to a UErrorCode to receive any errors. In
+ * case of error status, the contents of result are
+ * undefined.
+ * @stable ICU 64
+ */
+U_STABLE void U_EXPORT2
+ureldatefmt_formatToResult(
+ const URelativeDateTimeFormatter* reldatefmt,
+ double offset,
+ URelativeDateTimeUnit unit,
+ UFormattedRelativeDateTime* result,
+ UErrorCode* status);
+
+/**
* Combines a relative date string and a time string in this object's
* locale. This is done with the same date-time separator used for the
* default calendar in this locale to produce a result such as
@@ -490,9 +490,9 @@ ureldatefmt_formatToResult(
* @return
* The length of the formatted result; may be greater than resultCapacity,
* in which case an error is returned.
- * @stable ICU 57
+ * @stable ICU 57
*/
-U_STABLE int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
ureldatefmt_combineDateAndTime( const URelativeDateTimeFormatter* reldatefmt,
const UChar * relativeDateString,
int32_t relativeDateStringLen,
diff --git a/contrib/libs/icu/include/unicode/urename.h b/contrib/libs/icu/include/unicode/urename.h
index c1e6c01610..30f4b7af39 100644
--- a/contrib/libs/icu/include/unicode/urename.h
+++ b/contrib/libs/icu/include/unicode/urename.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -7,7 +7,7 @@
*******************************************************************************
*
* file name: urename.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -33,9 +33,9 @@
#if !U_DISABLE_RENAMING
-// Disable Renaming for Visual Studio's IntelliSense feature, so that 'Go-to-Definition' (F12) will work.
-#if !(defined(_MSC_VER) && defined(__INTELLISENSE__))
-
+// Disable Renaming for Visual Studio's IntelliSense feature, so that 'Go-to-Definition' (F12) will work.
+#if !(defined(_MSC_VER) && defined(__INTELLISENSE__))
+
/* We need the U_ICU_ENTRY_POINT_RENAME definition. There's a default one in unicode/uvernum.h we can use, but we will give
the platform a chance to define it first.
Normally (if utypes.h or umachine.h was included first) this will not be necessary as it will already be defined.
@@ -103,19 +103,19 @@
#define _UTF16BEData U_ICU_ENTRY_POINT_RENAME(_UTF16BEData)
#define _UTF16Data U_ICU_ENTRY_POINT_RENAME(_UTF16Data)
#define _UTF16LEData U_ICU_ENTRY_POINT_RENAME(_UTF16LEData)
-#define _UTF16v2Data U_ICU_ENTRY_POINT_RENAME(_UTF16v2Data)
+#define _UTF16v2Data U_ICU_ENTRY_POINT_RENAME(_UTF16v2Data)
#define _UTF32BEData U_ICU_ENTRY_POINT_RENAME(_UTF32BEData)
#define _UTF32Data U_ICU_ENTRY_POINT_RENAME(_UTF32Data)
#define _UTF32LEData U_ICU_ENTRY_POINT_RENAME(_UTF32LEData)
#define _UTF7Data U_ICU_ENTRY_POINT_RENAME(_UTF7Data)
#define _UTF8Data U_ICU_ENTRY_POINT_RENAME(_UTF8Data)
-#define _isUnicodeLocaleTypeSubtag U_ICU_ENTRY_POINT_RENAME(_isUnicodeLocaleTypeSubtag)
-#define allowedHourFormatsCleanup U_ICU_ENTRY_POINT_RENAME(allowedHourFormatsCleanup)
+#define _isUnicodeLocaleTypeSubtag U_ICU_ENTRY_POINT_RENAME(_isUnicodeLocaleTypeSubtag)
+#define allowedHourFormatsCleanup U_ICU_ENTRY_POINT_RENAME(allowedHourFormatsCleanup)
#define cmemory_cleanup U_ICU_ENTRY_POINT_RENAME(cmemory_cleanup)
-#define dayPeriodRulesCleanup U_ICU_ENTRY_POINT_RENAME(dayPeriodRulesCleanup)
-#define deleteAllowedHourFormats U_ICU_ENTRY_POINT_RENAME(deleteAllowedHourFormats)
+#define dayPeriodRulesCleanup U_ICU_ENTRY_POINT_RENAME(dayPeriodRulesCleanup)
+#define deleteAllowedHourFormats U_ICU_ENTRY_POINT_RENAME(deleteAllowedHourFormats)
#define gTimeZoneFilesInitOnce U_ICU_ENTRY_POINT_RENAME(gTimeZoneFilesInitOnce)
-#define initNumsysNames U_ICU_ENTRY_POINT_RENAME(initNumsysNames)
+#define initNumsysNames U_ICU_ENTRY_POINT_RENAME(initNumsysNames)
#define izrule_clone U_ICU_ENTRY_POINT_RENAME(izrule_clone)
#define izrule_close U_ICU_ENTRY_POINT_RENAME(izrule_close)
#define izrule_equals U_ICU_ENTRY_POINT_RENAME(izrule_equals)
@@ -134,8 +134,8 @@
#define locale_getKeywordsStart U_ICU_ENTRY_POINT_RENAME(locale_getKeywordsStart)
#define locale_get_default U_ICU_ENTRY_POINT_RENAME(locale_get_default)
#define locale_set_default U_ICU_ENTRY_POINT_RENAME(locale_set_default)
-#define numSysCleanup U_ICU_ENTRY_POINT_RENAME(numSysCleanup)
-#define rbbi_cleanup U_ICU_ENTRY_POINT_RENAME(rbbi_cleanup)
+#define numSysCleanup U_ICU_ENTRY_POINT_RENAME(numSysCleanup)
+#define rbbi_cleanup U_ICU_ENTRY_POINT_RENAME(rbbi_cleanup)
#define pl_addFontRun U_ICU_ENTRY_POINT_RENAME(pl_addFontRun)
#define pl_addLocaleRun U_ICU_ENTRY_POINT_RENAME(pl_addLocaleRun)
#define pl_addValueRun U_ICU_ENTRY_POINT_RENAME(pl_addValueRun)
@@ -193,18 +193,18 @@
#define res_findResource U_ICU_ENTRY_POINT_RENAME(res_findResource)
#define res_getAlias U_ICU_ENTRY_POINT_RENAME(res_getAlias)
#define res_getArrayItem U_ICU_ENTRY_POINT_RENAME(res_getArrayItem)
-#define res_getBinaryNoTrace U_ICU_ENTRY_POINT_RENAME(res_getBinaryNoTrace)
-#define res_getIntVectorNoTrace U_ICU_ENTRY_POINT_RENAME(res_getIntVectorNoTrace)
+#define res_getBinaryNoTrace U_ICU_ENTRY_POINT_RENAME(res_getBinaryNoTrace)
+#define res_getIntVectorNoTrace U_ICU_ENTRY_POINT_RENAME(res_getIntVectorNoTrace)
#define res_getPublicType U_ICU_ENTRY_POINT_RENAME(res_getPublicType)
#define res_getResource U_ICU_ENTRY_POINT_RENAME(res_getResource)
-#define res_getStringNoTrace U_ICU_ENTRY_POINT_RENAME(res_getStringNoTrace)
+#define res_getStringNoTrace U_ICU_ENTRY_POINT_RENAME(res_getStringNoTrace)
#define res_getTableItemByIndex U_ICU_ENTRY_POINT_RENAME(res_getTableItemByIndex)
#define res_getTableItemByKey U_ICU_ENTRY_POINT_RENAME(res_getTableItemByKey)
#define res_load U_ICU_ENTRY_POINT_RENAME(res_load)
#define res_read U_ICU_ENTRY_POINT_RENAME(res_read)
#define res_unload U_ICU_ENTRY_POINT_RENAME(res_unload)
#define u_UCharsToChars U_ICU_ENTRY_POINT_RENAME(u_UCharsToChars)
-#define u_asciiToUpper U_ICU_ENTRY_POINT_RENAME(u_asciiToUpper)
+#define u_asciiToUpper U_ICU_ENTRY_POINT_RENAME(u_asciiToUpper)
#define u_austrcpy U_ICU_ENTRY_POINT_RENAME(u_austrcpy)
#define u_austrncpy U_ICU_ENTRY_POINT_RENAME(u_austrncpy)
#define u_caseInsensitivePrefixMatch U_ICU_ENTRY_POINT_RENAME(u_caseInsensitivePrefixMatch)
@@ -261,14 +261,14 @@
#define u_fstropen U_ICU_ENTRY_POINT_RENAME(u_fstropen)
#define u_fungetc U_ICU_ENTRY_POINT_RENAME(u_fungetc)
#define u_getBidiPairedBracket U_ICU_ENTRY_POINT_RENAME(u_getBidiPairedBracket)
-#define u_getBinaryPropertySet U_ICU_ENTRY_POINT_RENAME(u_getBinaryPropertySet)
+#define u_getBinaryPropertySet U_ICU_ENTRY_POINT_RENAME(u_getBinaryPropertySet)
#define u_getCombiningClass U_ICU_ENTRY_POINT_RENAME(u_getCombiningClass)
#define u_getDataDirectory U_ICU_ENTRY_POINT_RENAME(u_getDataDirectory)
#define u_getDataVersion U_ICU_ENTRY_POINT_RENAME(u_getDataVersion)
#define u_getDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_getDefaultConverter)
#define u_getFC_NFKC_Closure U_ICU_ENTRY_POINT_RENAME(u_getFC_NFKC_Closure)
#define u_getISOComment U_ICU_ENTRY_POINT_RENAME(u_getISOComment)
-#define u_getIntPropertyMap U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMap)
+#define u_getIntPropertyMap U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMap)
#define u_getIntPropertyMaxValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMaxValue)
#define u_getIntPropertyMinValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMinValue)
#define u_getIntPropertyValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyValue)
@@ -489,7 +489,7 @@
#define ubrk_first U_ICU_ENTRY_POINT_RENAME(ubrk_first)
#define ubrk_following U_ICU_ENTRY_POINT_RENAME(ubrk_following)
#define ubrk_getAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_getAvailable)
-#define ubrk_getBinaryRules U_ICU_ENTRY_POINT_RENAME(ubrk_getBinaryRules)
+#define ubrk_getBinaryRules U_ICU_ENTRY_POINT_RENAME(ubrk_getBinaryRules)
#define ubrk_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ubrk_getLocaleByType)
#define ubrk_getRuleStatus U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatus)
#define ubrk_getRuleStatusVec U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatusVec)
@@ -497,7 +497,7 @@
#define ubrk_last U_ICU_ENTRY_POINT_RENAME(ubrk_last)
#define ubrk_next U_ICU_ENTRY_POINT_RENAME(ubrk_next)
#define ubrk_open U_ICU_ENTRY_POINT_RENAME(ubrk_open)
-#define ubrk_openBinaryRules U_ICU_ENTRY_POINT_RENAME(ubrk_openBinaryRules)
+#define ubrk_openBinaryRules U_ICU_ENTRY_POINT_RENAME(ubrk_openBinaryRules)
#define ubrk_openRules U_ICU_ENTRY_POINT_RENAME(ubrk_openRules)
#define ubrk_preceding U_ICU_ENTRY_POINT_RENAME(ubrk_preceding)
#define ubrk_previous U_ICU_ENTRY_POINT_RENAME(ubrk_previous)
@@ -525,7 +525,7 @@
#define ucal_getDefaultTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_getDefaultTimeZone)
#define ucal_getFieldDifference U_ICU_ENTRY_POINT_RENAME(ucal_getFieldDifference)
#define ucal_getGregorianChange U_ICU_ENTRY_POINT_RENAME(ucal_getGregorianChange)
-#define ucal_getHostTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_getHostTimeZone)
+#define ucal_getHostTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_getHostTimeZone)
#define ucal_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucal_getKeywordValuesForLocale)
#define ucal_getLimit U_ICU_ENTRY_POINT_RENAME(ucal_getLimit)
#define ucal_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ucal_getLocaleByType)
@@ -560,7 +560,7 @@
#define ucase_addStringCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addStringCaseClosure)
#define ucase_fold U_ICU_ENTRY_POINT_RENAME(ucase_fold)
#define ucase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ucase_getCaseLocale)
-#define ucase_getTrie U_ICU_ENTRY_POINT_RENAME(ucase_getTrie)
+#define ucase_getTrie U_ICU_ENTRY_POINT_RENAME(ucase_getTrie)
#define ucase_getType U_ICU_ENTRY_POINT_RENAME(ucase_getType)
#define ucase_getTypeOrIgnorable U_ICU_ENTRY_POINT_RENAME(ucase_getTypeOrIgnorable)
#define ucase_hasBinaryProperty U_ICU_ENTRY_POINT_RENAME(ucase_hasBinaryProperty)
@@ -587,18 +587,18 @@
#define ucasemap_utf8ToLower U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToLower)
#define ucasemap_utf8ToTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToTitle)
#define ucasemap_utf8ToUpper U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToUpper)
-#define ucfpos_close U_ICU_ENTRY_POINT_RENAME(ucfpos_close)
-#define ucfpos_constrainCategory U_ICU_ENTRY_POINT_RENAME(ucfpos_constrainCategory)
-#define ucfpos_constrainField U_ICU_ENTRY_POINT_RENAME(ucfpos_constrainField)
-#define ucfpos_getCategory U_ICU_ENTRY_POINT_RENAME(ucfpos_getCategory)
-#define ucfpos_getField U_ICU_ENTRY_POINT_RENAME(ucfpos_getField)
-#define ucfpos_getIndexes U_ICU_ENTRY_POINT_RENAME(ucfpos_getIndexes)
-#define ucfpos_getInt64IterationContext U_ICU_ENTRY_POINT_RENAME(ucfpos_getInt64IterationContext)
-#define ucfpos_matchesField U_ICU_ENTRY_POINT_RENAME(ucfpos_matchesField)
-#define ucfpos_open U_ICU_ENTRY_POINT_RENAME(ucfpos_open)
-#define ucfpos_reset U_ICU_ENTRY_POINT_RENAME(ucfpos_reset)
-#define ucfpos_setInt64IterationContext U_ICU_ENTRY_POINT_RENAME(ucfpos_setInt64IterationContext)
-#define ucfpos_setState U_ICU_ENTRY_POINT_RENAME(ucfpos_setState)
+#define ucfpos_close U_ICU_ENTRY_POINT_RENAME(ucfpos_close)
+#define ucfpos_constrainCategory U_ICU_ENTRY_POINT_RENAME(ucfpos_constrainCategory)
+#define ucfpos_constrainField U_ICU_ENTRY_POINT_RENAME(ucfpos_constrainField)
+#define ucfpos_getCategory U_ICU_ENTRY_POINT_RENAME(ucfpos_getCategory)
+#define ucfpos_getField U_ICU_ENTRY_POINT_RENAME(ucfpos_getField)
+#define ucfpos_getIndexes U_ICU_ENTRY_POINT_RENAME(ucfpos_getIndexes)
+#define ucfpos_getInt64IterationContext U_ICU_ENTRY_POINT_RENAME(ucfpos_getInt64IterationContext)
+#define ucfpos_matchesField U_ICU_ENTRY_POINT_RENAME(ucfpos_matchesField)
+#define ucfpos_open U_ICU_ENTRY_POINT_RENAME(ucfpos_open)
+#define ucfpos_reset U_ICU_ENTRY_POINT_RENAME(ucfpos_reset)
+#define ucfpos_setInt64IterationContext U_ICU_ENTRY_POINT_RENAME(ucfpos_setInt64IterationContext)
+#define ucfpos_setState U_ICU_ENTRY_POINT_RENAME(ucfpos_setState)
#define uchar_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(uchar_addPropertyStarts)
#define uchar_swapNames U_ICU_ENTRY_POINT_RENAME(uchar_swapNames)
#define ucln_cleanupOne U_ICU_ENTRY_POINT_RENAME(ucln_cleanupOne)
@@ -635,7 +635,7 @@
#define ucnv_createConverterFromPackage U_ICU_ENTRY_POINT_RENAME(ucnv_createConverterFromPackage)
#define ucnv_createConverterFromSharedData U_ICU_ENTRY_POINT_RENAME(ucnv_createConverterFromSharedData)
#define ucnv_detectUnicodeSignature U_ICU_ENTRY_POINT_RENAME(ucnv_detectUnicodeSignature)
-#define ucnv_enableCleanup U_ICU_ENTRY_POINT_RENAME(ucnv_enableCleanup)
+#define ucnv_enableCleanup U_ICU_ENTRY_POINT_RENAME(ucnv_enableCleanup)
#define ucnv_extContinueMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extContinueMatchFromU)
#define ucnv_extContinueMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extContinueMatchToU)
#define ucnv_extGetUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_extGetUnicodeSet)
@@ -785,20 +785,20 @@
#define ucol_swap U_ICU_ENTRY_POINT_RENAME(ucol_swap)
#define ucol_swapInverseUCA U_ICU_ENTRY_POINT_RENAME(ucol_swapInverseUCA)
#define ucol_tertiaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_tertiaryOrder)
-#define ucpmap_get U_ICU_ENTRY_POINT_RENAME(ucpmap_get)
-#define ucpmap_getRange U_ICU_ENTRY_POINT_RENAME(ucpmap_getRange)
-#define ucptrie_close U_ICU_ENTRY_POINT_RENAME(ucptrie_close)
-#define ucptrie_get U_ICU_ENTRY_POINT_RENAME(ucptrie_get)
-#define ucptrie_getRange U_ICU_ENTRY_POINT_RENAME(ucptrie_getRange)
-#define ucptrie_getType U_ICU_ENTRY_POINT_RENAME(ucptrie_getType)
-#define ucptrie_getValueWidth U_ICU_ENTRY_POINT_RENAME(ucptrie_getValueWidth)
-#define ucptrie_internalGetRange U_ICU_ENTRY_POINT_RENAME(ucptrie_internalGetRange)
-#define ucptrie_internalSmallIndex U_ICU_ENTRY_POINT_RENAME(ucptrie_internalSmallIndex)
-#define ucptrie_internalSmallU8Index U_ICU_ENTRY_POINT_RENAME(ucptrie_internalSmallU8Index)
-#define ucptrie_internalU8PrevIndex U_ICU_ENTRY_POINT_RENAME(ucptrie_internalU8PrevIndex)
-#define ucptrie_openFromBinary U_ICU_ENTRY_POINT_RENAME(ucptrie_openFromBinary)
-#define ucptrie_swap U_ICU_ENTRY_POINT_RENAME(ucptrie_swap)
-#define ucptrie_toBinary U_ICU_ENTRY_POINT_RENAME(ucptrie_toBinary)
+#define ucpmap_get U_ICU_ENTRY_POINT_RENAME(ucpmap_get)
+#define ucpmap_getRange U_ICU_ENTRY_POINT_RENAME(ucpmap_getRange)
+#define ucptrie_close U_ICU_ENTRY_POINT_RENAME(ucptrie_close)
+#define ucptrie_get U_ICU_ENTRY_POINT_RENAME(ucptrie_get)
+#define ucptrie_getRange U_ICU_ENTRY_POINT_RENAME(ucptrie_getRange)
+#define ucptrie_getType U_ICU_ENTRY_POINT_RENAME(ucptrie_getType)
+#define ucptrie_getValueWidth U_ICU_ENTRY_POINT_RENAME(ucptrie_getValueWidth)
+#define ucptrie_internalGetRange U_ICU_ENTRY_POINT_RENAME(ucptrie_internalGetRange)
+#define ucptrie_internalSmallIndex U_ICU_ENTRY_POINT_RENAME(ucptrie_internalSmallIndex)
+#define ucptrie_internalSmallU8Index U_ICU_ENTRY_POINT_RENAME(ucptrie_internalSmallU8Index)
+#define ucptrie_internalU8PrevIndex U_ICU_ENTRY_POINT_RENAME(ucptrie_internalU8PrevIndex)
+#define ucptrie_openFromBinary U_ICU_ENTRY_POINT_RENAME(ucptrie_openFromBinary)
+#define ucptrie_swap U_ICU_ENTRY_POINT_RENAME(ucptrie_swap)
+#define ucptrie_toBinary U_ICU_ENTRY_POINT_RENAME(ucptrie_toBinary)
#define ucsdet_close U_ICU_ENTRY_POINT_RENAME(ucsdet_close)
#define ucsdet_detect U_ICU_ENTRY_POINT_RENAME(ucsdet_detect)
#define ucsdet_detectAll U_ICU_ENTRY_POINT_RENAME(ucsdet_detectAll)
@@ -898,8 +898,8 @@
#define udatpg_getBestPatternWithOptions U_ICU_ENTRY_POINT_RENAME(udatpg_getBestPatternWithOptions)
#define udatpg_getDateTimeFormat U_ICU_ENTRY_POINT_RENAME(udatpg_getDateTimeFormat)
#define udatpg_getDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_getDecimal)
-#define udatpg_getDefaultHourCycle U_ICU_ENTRY_POINT_RENAME(udatpg_getDefaultHourCycle)
-#define udatpg_getFieldDisplayName U_ICU_ENTRY_POINT_RENAME(udatpg_getFieldDisplayName)
+#define udatpg_getDefaultHourCycle U_ICU_ENTRY_POINT_RENAME(udatpg_getDefaultHourCycle)
+#define udatpg_getFieldDisplayName U_ICU_ENTRY_POINT_RENAME(udatpg_getFieldDisplayName)
#define udatpg_getPatternForSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getPatternForSkeleton)
#define udatpg_getSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getSkeleton)
#define udatpg_open U_ICU_ENTRY_POINT_RENAME(udatpg_open)
@@ -914,13 +914,13 @@
#define udatpg_setDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_setDecimal)
#define udict_swap U_ICU_ENTRY_POINT_RENAME(udict_swap)
#define udtitvfmt_close U_ICU_ENTRY_POINT_RENAME(udtitvfmt_close)
-#define udtitvfmt_closeResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_closeResult)
+#define udtitvfmt_closeResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_closeResult)
#define udtitvfmt_format U_ICU_ENTRY_POINT_RENAME(udtitvfmt_format)
-#define udtitvfmt_formatCalendarToResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_formatCalendarToResult)
-#define udtitvfmt_formatToResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_formatToResult)
+#define udtitvfmt_formatCalendarToResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_formatCalendarToResult)
+#define udtitvfmt_formatToResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_formatToResult)
#define udtitvfmt_open U_ICU_ENTRY_POINT_RENAME(udtitvfmt_open)
-#define udtitvfmt_openResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_openResult)
-#define udtitvfmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(udtitvfmt_resultAsValue)
+#define udtitvfmt_openResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_openResult)
+#define udtitvfmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(udtitvfmt_resultAsValue)
#define uenum_close U_ICU_ENTRY_POINT_RENAME(uenum_close)
#define uenum_count U_ICU_ENTRY_POINT_RENAME(uenum_count)
#define uenum_next U_ICU_ENTRY_POINT_RENAME(uenum_next)
@@ -949,8 +949,8 @@
#define ufmt_getUChars U_ICU_ENTRY_POINT_RENAME(ufmt_getUChars)
#define ufmt_isNumeric U_ICU_ENTRY_POINT_RENAME(ufmt_isNumeric)
#define ufmt_open U_ICU_ENTRY_POINT_RENAME(ufmt_open)
-#define ufmtval_getString U_ICU_ENTRY_POINT_RENAME(ufmtval_getString)
-#define ufmtval_nextPosition U_ICU_ENTRY_POINT_RENAME(ufmtval_nextPosition)
+#define ufmtval_getString U_ICU_ENTRY_POINT_RENAME(ufmtval_getString)
+#define ufmtval_nextPosition U_ICU_ENTRY_POINT_RENAME(ufmtval_nextPosition)
#define ugender_getInstance U_ICU_ENTRY_POINT_RENAME(ugender_getInstance)
#define ugender_getListGender U_ICU_ENTRY_POINT_RENAME(ugender_getListGender)
#define uhash_close U_ICU_ENTRY_POINT_RENAME(uhash_close)
@@ -979,7 +979,7 @@
#define uhash_iget U_ICU_ENTRY_POINT_RENAME(uhash_iget)
#define uhash_igeti U_ICU_ENTRY_POINT_RENAME(uhash_igeti)
#define uhash_init U_ICU_ENTRY_POINT_RENAME(uhash_init)
-#define uhash_initSize U_ICU_ENTRY_POINT_RENAME(uhash_initSize)
+#define uhash_initSize U_ICU_ENTRY_POINT_RENAME(uhash_initSize)
#define uhash_iput U_ICU_ENTRY_POINT_RENAME(uhash_iput)
#define uhash_iputi U_ICU_ENTRY_POINT_RENAME(uhash_iputi)
#define uhash_iremove U_ICU_ENTRY_POINT_RENAME(uhash_iremove)
@@ -1053,13 +1053,13 @@
#define ulist_resetList U_ICU_ENTRY_POINT_RENAME(ulist_resetList)
#define ulist_reset_keyword_values_iterator U_ICU_ENTRY_POINT_RENAME(ulist_reset_keyword_values_iterator)
#define ulistfmt_close U_ICU_ENTRY_POINT_RENAME(ulistfmt_close)
-#define ulistfmt_closeResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_closeResult)
+#define ulistfmt_closeResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_closeResult)
#define ulistfmt_format U_ICU_ENTRY_POINT_RENAME(ulistfmt_format)
-#define ulistfmt_formatStringsToResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_formatStringsToResult)
+#define ulistfmt_formatStringsToResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_formatStringsToResult)
#define ulistfmt_open U_ICU_ENTRY_POINT_RENAME(ulistfmt_open)
-#define ulistfmt_openForType U_ICU_ENTRY_POINT_RENAME(ulistfmt_openForType)
-#define ulistfmt_openResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_openResult)
-#define ulistfmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(ulistfmt_resultAsValue)
+#define ulistfmt_openForType U_ICU_ENTRY_POINT_RENAME(ulistfmt_openForType)
+#define ulistfmt_openResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_openResult)
+#define ulistfmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(ulistfmt_resultAsValue)
#define uloc_acceptLanguage U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguage)
#define uloc_acceptLanguageFromHTTP U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguageFromHTTP)
#define uloc_addLikelySubtags U_ICU_ENTRY_POINT_RENAME(uloc_addLikelySubtags)
@@ -1097,7 +1097,7 @@
#define uloc_getVariant U_ICU_ENTRY_POINT_RENAME(uloc_getVariant)
#define uloc_isRightToLeft U_ICU_ENTRY_POINT_RENAME(uloc_isRightToLeft)
#define uloc_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(uloc_minimizeSubtags)
-#define uloc_openAvailableByType U_ICU_ENTRY_POINT_RENAME(uloc_openAvailableByType)
+#define uloc_openAvailableByType U_ICU_ENTRY_POINT_RENAME(uloc_openAvailableByType)
#define uloc_openKeywordList U_ICU_ENTRY_POINT_RENAME(uloc_openKeywordList)
#define uloc_openKeywords U_ICU_ENTRY_POINT_RENAME(uloc_openKeywords)
#define uloc_setDefault U_ICU_ENTRY_POINT_RENAME(uloc_setDefault)
@@ -1118,33 +1118,33 @@
#define ulocdata_getPaperSize U_ICU_ENTRY_POINT_RENAME(ulocdata_getPaperSize)
#define ulocdata_open U_ICU_ENTRY_POINT_RENAME(ulocdata_open)
#define ulocdata_setNoSubstitute U_ICU_ENTRY_POINT_RENAME(ulocdata_setNoSubstitute)
-#define ulocimp_addLikelySubtags U_ICU_ENTRY_POINT_RENAME(ulocimp_addLikelySubtags)
-#define ulocimp_canonicalize U_ICU_ENTRY_POINT_RENAME(ulocimp_canonicalize)
-#define ulocimp_forLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocimp_forLanguageTag)
-#define ulocimp_getBaseName U_ICU_ENTRY_POINT_RENAME(ulocimp_getBaseName)
+#define ulocimp_addLikelySubtags U_ICU_ENTRY_POINT_RENAME(ulocimp_addLikelySubtags)
+#define ulocimp_canonicalize U_ICU_ENTRY_POINT_RENAME(ulocimp_canonicalize)
+#define ulocimp_forLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocimp_forLanguageTag)
+#define ulocimp_getBaseName U_ICU_ENTRY_POINT_RENAME(ulocimp_getBaseName)
#define ulocimp_getCountry U_ICU_ENTRY_POINT_RENAME(ulocimp_getCountry)
#define ulocimp_getLanguage U_ICU_ENTRY_POINT_RENAME(ulocimp_getLanguage)
-#define ulocimp_getName U_ICU_ENTRY_POINT_RENAME(ulocimp_getName)
+#define ulocimp_getName U_ICU_ENTRY_POINT_RENAME(ulocimp_getName)
#define ulocimp_getRegionForSupplementalData U_ICU_ENTRY_POINT_RENAME(ulocimp_getRegionForSupplementalData)
#define ulocimp_getScript U_ICU_ENTRY_POINT_RENAME(ulocimp_getScript)
-#define ulocimp_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(ulocimp_minimizeSubtags)
+#define ulocimp_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(ulocimp_minimizeSubtags)
#define ulocimp_toBcpKey U_ICU_ENTRY_POINT_RENAME(ulocimp_toBcpKey)
#define ulocimp_toBcpType U_ICU_ENTRY_POINT_RENAME(ulocimp_toBcpType)
-#define ulocimp_toLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocimp_toLanguageTag)
+#define ulocimp_toLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocimp_toLanguageTag)
#define ulocimp_toLegacyKey U_ICU_ENTRY_POINT_RENAME(ulocimp_toLegacyKey)
#define ulocimp_toLegacyType U_ICU_ENTRY_POINT_RENAME(ulocimp_toLegacyType)
-#define ultag_isExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isExtensionSubtags)
-#define ultag_isLanguageSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isLanguageSubtag)
-#define ultag_isPrivateuseValueSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isPrivateuseValueSubtags)
-#define ultag_isRegionSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isRegionSubtag)
-#define ultag_isScriptSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isScriptSubtag)
-#define ultag_isTransformedExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isTransformedExtensionSubtags)
-#define ultag_isUnicodeExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeExtensionSubtags)
-#define ultag_isUnicodeLocaleAttribute U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleAttribute)
-#define ultag_isUnicodeLocaleAttributes U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleAttributes)
+#define ultag_isExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isExtensionSubtags)
+#define ultag_isLanguageSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isLanguageSubtag)
+#define ultag_isPrivateuseValueSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isPrivateuseValueSubtags)
+#define ultag_isRegionSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isRegionSubtag)
+#define ultag_isScriptSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isScriptSubtag)
+#define ultag_isTransformedExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isTransformedExtensionSubtags)
+#define ultag_isUnicodeExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeExtensionSubtags)
+#define ultag_isUnicodeLocaleAttribute U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleAttribute)
+#define ultag_isUnicodeLocaleAttributes U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleAttributes)
#define ultag_isUnicodeLocaleKey U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleKey)
#define ultag_isUnicodeLocaleType U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleType)
-#define ultag_isVariantSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isVariantSubtags)
+#define ultag_isVariantSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isVariantSubtags)
#define umsg_applyPattern U_ICU_ENTRY_POINT_RENAME(umsg_applyPattern)
#define umsg_autoQuoteApostrophe U_ICU_ENTRY_POINT_RENAME(umsg_autoQuoteApostrophe)
#define umsg_clone U_ICU_ENTRY_POINT_RENAME(umsg_clone)
@@ -1159,16 +1159,16 @@
#define umsg_vparse U_ICU_ENTRY_POINT_RENAME(umsg_vparse)
#define umtx_lock U_ICU_ENTRY_POINT_RENAME(umtx_lock)
#define umtx_unlock U_ICU_ENTRY_POINT_RENAME(umtx_unlock)
-#define umutablecptrie_buildImmutable U_ICU_ENTRY_POINT_RENAME(umutablecptrie_buildImmutable)
-#define umutablecptrie_clone U_ICU_ENTRY_POINT_RENAME(umutablecptrie_clone)
-#define umutablecptrie_close U_ICU_ENTRY_POINT_RENAME(umutablecptrie_close)
-#define umutablecptrie_fromUCPMap U_ICU_ENTRY_POINT_RENAME(umutablecptrie_fromUCPMap)
-#define umutablecptrie_fromUCPTrie U_ICU_ENTRY_POINT_RENAME(umutablecptrie_fromUCPTrie)
-#define umutablecptrie_get U_ICU_ENTRY_POINT_RENAME(umutablecptrie_get)
-#define umutablecptrie_getRange U_ICU_ENTRY_POINT_RENAME(umutablecptrie_getRange)
-#define umutablecptrie_open U_ICU_ENTRY_POINT_RENAME(umutablecptrie_open)
-#define umutablecptrie_set U_ICU_ENTRY_POINT_RENAME(umutablecptrie_set)
-#define umutablecptrie_setRange U_ICU_ENTRY_POINT_RENAME(umutablecptrie_setRange)
+#define umutablecptrie_buildImmutable U_ICU_ENTRY_POINT_RENAME(umutablecptrie_buildImmutable)
+#define umutablecptrie_clone U_ICU_ENTRY_POINT_RENAME(umutablecptrie_clone)
+#define umutablecptrie_close U_ICU_ENTRY_POINT_RENAME(umutablecptrie_close)
+#define umutablecptrie_fromUCPMap U_ICU_ENTRY_POINT_RENAME(umutablecptrie_fromUCPMap)
+#define umutablecptrie_fromUCPTrie U_ICU_ENTRY_POINT_RENAME(umutablecptrie_fromUCPTrie)
+#define umutablecptrie_get U_ICU_ENTRY_POINT_RENAME(umutablecptrie_get)
+#define umutablecptrie_getRange U_ICU_ENTRY_POINT_RENAME(umutablecptrie_getRange)
+#define umutablecptrie_open U_ICU_ENTRY_POINT_RENAME(umutablecptrie_open)
+#define umutablecptrie_set U_ICU_ENTRY_POINT_RENAME(umutablecptrie_set)
+#define umutablecptrie_setRange U_ICU_ENTRY_POINT_RENAME(umutablecptrie_setRange)
#define uniset_getUnicode32Instance U_ICU_ENTRY_POINT_RENAME(uniset_getUnicode32Instance)
#define unorm2_append U_ICU_ENTRY_POINT_RENAME(unorm2_append)
#define unorm2_close U_ICU_ENTRY_POINT_RENAME(unorm2_close)
@@ -1211,7 +1211,7 @@
#define unum_formatDecimal U_ICU_ENTRY_POINT_RENAME(unum_formatDecimal)
#define unum_formatDouble U_ICU_ENTRY_POINT_RENAME(unum_formatDouble)
#define unum_formatDoubleCurrency U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleCurrency)
-#define unum_formatDoubleForFields U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleForFields)
+#define unum_formatDoubleForFields U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleForFields)
#define unum_formatInt64 U_ICU_ENTRY_POINT_RENAME(unum_formatInt64)
#define unum_formatUFormattable U_ICU_ENTRY_POINT_RENAME(unum_formatUFormattable)
#define unum_getAttribute U_ICU_ENTRY_POINT_RENAME(unum_getAttribute)
@@ -1234,18 +1234,18 @@
#define unum_setSymbol U_ICU_ENTRY_POINT_RENAME(unum_setSymbol)
#define unum_setTextAttribute U_ICU_ENTRY_POINT_RENAME(unum_setTextAttribute)
#define unum_toPattern U_ICU_ENTRY_POINT_RENAME(unum_toPattern)
-#define unumf_close U_ICU_ENTRY_POINT_RENAME(unumf_close)
-#define unumf_closeResult U_ICU_ENTRY_POINT_RENAME(unumf_closeResult)
-#define unumf_formatDecimal U_ICU_ENTRY_POINT_RENAME(unumf_formatDecimal)
-#define unumf_formatDouble U_ICU_ENTRY_POINT_RENAME(unumf_formatDouble)
-#define unumf_formatInt U_ICU_ENTRY_POINT_RENAME(unumf_formatInt)
-#define unumf_openForSkeletonAndLocale U_ICU_ENTRY_POINT_RENAME(unumf_openForSkeletonAndLocale)
-#define unumf_openForSkeletonAndLocaleWithError U_ICU_ENTRY_POINT_RENAME(unumf_openForSkeletonAndLocaleWithError)
-#define unumf_openResult U_ICU_ENTRY_POINT_RENAME(unumf_openResult)
-#define unumf_resultAsValue U_ICU_ENTRY_POINT_RENAME(unumf_resultAsValue)
-#define unumf_resultGetAllFieldPositions U_ICU_ENTRY_POINT_RENAME(unumf_resultGetAllFieldPositions)
-#define unumf_resultNextFieldPosition U_ICU_ENTRY_POINT_RENAME(unumf_resultNextFieldPosition)
-#define unumf_resultToString U_ICU_ENTRY_POINT_RENAME(unumf_resultToString)
+#define unumf_close U_ICU_ENTRY_POINT_RENAME(unumf_close)
+#define unumf_closeResult U_ICU_ENTRY_POINT_RENAME(unumf_closeResult)
+#define unumf_formatDecimal U_ICU_ENTRY_POINT_RENAME(unumf_formatDecimal)
+#define unumf_formatDouble U_ICU_ENTRY_POINT_RENAME(unumf_formatDouble)
+#define unumf_formatInt U_ICU_ENTRY_POINT_RENAME(unumf_formatInt)
+#define unumf_openForSkeletonAndLocale U_ICU_ENTRY_POINT_RENAME(unumf_openForSkeletonAndLocale)
+#define unumf_openForSkeletonAndLocaleWithError U_ICU_ENTRY_POINT_RENAME(unumf_openForSkeletonAndLocaleWithError)
+#define unumf_openResult U_ICU_ENTRY_POINT_RENAME(unumf_openResult)
+#define unumf_resultAsValue U_ICU_ENTRY_POINT_RENAME(unumf_resultAsValue)
+#define unumf_resultGetAllFieldPositions U_ICU_ENTRY_POINT_RENAME(unumf_resultGetAllFieldPositions)
+#define unumf_resultNextFieldPosition U_ICU_ENTRY_POINT_RENAME(unumf_resultNextFieldPosition)
+#define unumf_resultToString U_ICU_ENTRY_POINT_RENAME(unumf_resultToString)
#define unumsys_close U_ICU_ENTRY_POINT_RENAME(unumsys_close)
#define unumsys_getDescription U_ICU_ENTRY_POINT_RENAME(unumsys_getDescription)
#define unumsys_getName U_ICU_ENTRY_POINT_RENAME(unumsys_getName)
@@ -1255,12 +1255,12 @@
#define unumsys_openAvailableNames U_ICU_ENTRY_POINT_RENAME(unumsys_openAvailableNames)
#define unumsys_openByName U_ICU_ENTRY_POINT_RENAME(unumsys_openByName)
#define uplrules_close U_ICU_ENTRY_POINT_RENAME(uplrules_close)
-#define uplrules_getKeywords U_ICU_ENTRY_POINT_RENAME(uplrules_getKeywords)
+#define uplrules_getKeywords U_ICU_ENTRY_POINT_RENAME(uplrules_getKeywords)
#define uplrules_open U_ICU_ENTRY_POINT_RENAME(uplrules_open)
#define uplrules_openForType U_ICU_ENTRY_POINT_RENAME(uplrules_openForType)
#define uplrules_select U_ICU_ENTRY_POINT_RENAME(uplrules_select)
-#define uplrules_selectFormatted U_ICU_ENTRY_POINT_RENAME(uplrules_selectFormatted)
-#define uplrules_selectWithFormat U_ICU_ENTRY_POINT_RENAME(uplrules_selectWithFormat)
+#define uplrules_selectFormatted U_ICU_ENTRY_POINT_RENAME(uplrules_selectFormatted)
+#define uplrules_selectWithFormat U_ICU_ENTRY_POINT_RENAME(uplrules_selectWithFormat)
#define uplug_closeLibrary U_ICU_ENTRY_POINT_RENAME(uplug_closeLibrary)
#define uplug_findLibrary U_ICU_ENTRY_POINT_RENAME(uplug_findLibrary)
#define uplug_getConfiguration U_ICU_ENTRY_POINT_RENAME(uplug_getConfiguration)
@@ -1284,10 +1284,10 @@
#define uplug_setPlugLevel U_ICU_ENTRY_POINT_RENAME(uplug_setPlugLevel)
#define uplug_setPlugName U_ICU_ENTRY_POINT_RENAME(uplug_setPlugName)
#define uplug_setPlugNoUnload U_ICU_ENTRY_POINT_RENAME(uplug_setPlugNoUnload)
-#define uprops_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(uprops_addPropertyStarts)
+#define uprops_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(uprops_addPropertyStarts)
#define uprops_getSource U_ICU_ENTRY_POINT_RENAME(uprops_getSource)
#define upropsvec_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(upropsvec_addPropertyStarts)
-#define uprv_add32_overflow U_ICU_ENTRY_POINT_RENAME(uprv_add32_overflow)
+#define uprv_add32_overflow U_ICU_ENTRY_POINT_RENAME(uprv_add32_overflow)
#define uprv_aestrncpy U_ICU_ENTRY_POINT_RENAME(uprv_aestrncpy)
#define uprv_asciiFromEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_asciiFromEbcdic)
#define uprv_asciitolower U_ICU_ENTRY_POINT_RENAME(uprv_asciitolower)
@@ -1299,7 +1299,7 @@
#define uprv_compareInvEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdic)
#define uprv_compareInvEbcdicAsAscii U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdicAsAscii)
#define uprv_convertToLCID U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCID)
-#define uprv_convertToLCIDPlatform U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCIDPlatform)
+#define uprv_convertToLCIDPlatform U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCIDPlatform)
#define uprv_convertToPosix U_ICU_ENTRY_POINT_RENAME(uprv_convertToPosix)
#define uprv_copyAscii U_ICU_ENTRY_POINT_RENAME(uprv_copyAscii)
#define uprv_copyEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_copyEbcdic)
@@ -1386,7 +1386,7 @@
#define uprv_dlsym_func U_ICU_ENTRY_POINT_RENAME(uprv_dlsym_func)
#define uprv_eastrncpy U_ICU_ENTRY_POINT_RENAME(uprv_eastrncpy)
#define uprv_ebcdicFromAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicFromAscii)
-#define uprv_ebcdicToAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicToAscii)
+#define uprv_ebcdicToAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicToAscii)
#define uprv_ebcdicToLowercaseAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicToLowercaseAscii)
#define uprv_ebcdictolower U_ICU_ENTRY_POINT_RENAME(uprv_ebcdictolower)
#define uprv_fabs U_ICU_ENTRY_POINT_RENAME(uprv_fabs)
@@ -1406,7 +1406,7 @@
#define uprv_getUTCtime U_ICU_ENTRY_POINT_RENAME(uprv_getUTCtime)
#define uprv_int32Comparator U_ICU_ENTRY_POINT_RENAME(uprv_int32Comparator)
#define uprv_isASCIILetter U_ICU_ENTRY_POINT_RENAME(uprv_isASCIILetter)
-#define uprv_isEbcdicAtSign U_ICU_ENTRY_POINT_RENAME(uprv_isEbcdicAtSign)
+#define uprv_isEbcdicAtSign U_ICU_ENTRY_POINT_RENAME(uprv_isEbcdicAtSign)
#define uprv_isInfinite U_ICU_ENTRY_POINT_RENAME(uprv_isInfinite)
#define uprv_isInvariantString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantString)
#define uprv_isInvariantUString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantUString)
@@ -1422,7 +1422,7 @@
#define uprv_maximumPtr U_ICU_ENTRY_POINT_RENAME(uprv_maximumPtr)
#define uprv_min U_ICU_ENTRY_POINT_RENAME(uprv_min)
#define uprv_modf U_ICU_ENTRY_POINT_RENAME(uprv_modf)
-#define uprv_mul32_overflow U_ICU_ENTRY_POINT_RENAME(uprv_mul32_overflow)
+#define uprv_mul32_overflow U_ICU_ENTRY_POINT_RENAME(uprv_mul32_overflow)
#define uprv_parseCurrency U_ICU_ENTRY_POINT_RENAME(uprv_parseCurrency)
#define uprv_pathIsAbsolute U_ICU_ENTRY_POINT_RENAME(uprv_pathIsAbsolute)
#define uprv_pow U_ICU_ENTRY_POINT_RENAME(uprv_pow)
@@ -1534,15 +1534,15 @@
#define uregion_getRegionFromNumericCode U_ICU_ENTRY_POINT_RENAME(uregion_getRegionFromNumericCode)
#define uregion_getType U_ICU_ENTRY_POINT_RENAME(uregion_getType)
#define ureldatefmt_close U_ICU_ENTRY_POINT_RENAME(ureldatefmt_close)
-#define ureldatefmt_closeResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_closeResult)
+#define ureldatefmt_closeResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_closeResult)
#define ureldatefmt_combineDateAndTime U_ICU_ENTRY_POINT_RENAME(ureldatefmt_combineDateAndTime)
#define ureldatefmt_format U_ICU_ENTRY_POINT_RENAME(ureldatefmt_format)
#define ureldatefmt_formatNumeric U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatNumeric)
-#define ureldatefmt_formatNumericToResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatNumericToResult)
-#define ureldatefmt_formatToResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatToResult)
+#define ureldatefmt_formatNumericToResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatNumericToResult)
+#define ureldatefmt_formatToResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatToResult)
#define ureldatefmt_open U_ICU_ENTRY_POINT_RENAME(ureldatefmt_open)
-#define ureldatefmt_openResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_openResult)
-#define ureldatefmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(ureldatefmt_resultAsValue)
+#define ureldatefmt_openResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_openResult)
+#define ureldatefmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(ureldatefmt_resultAsValue)
#define ures_close U_ICU_ENTRY_POINT_RENAME(ures_close)
#define ures_copyResb U_ICU_ENTRY_POINT_RENAME(ures_copyResb)
#define ures_countArrayItems U_ICU_ENTRY_POINT_RENAME(ures_countArrayItems)
@@ -1574,7 +1574,7 @@
#define ures_getUTF8String U_ICU_ENTRY_POINT_RENAME(ures_getUTF8String)
#define ures_getUTF8StringByIndex U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByIndex)
#define ures_getUTF8StringByKey U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByKey)
-#define ures_getValueWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getValueWithFallback)
+#define ures_getValueWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getValueWithFallback)
#define ures_getVersion U_ICU_ENTRY_POINT_RENAME(ures_getVersion)
#define ures_getVersionByKey U_ICU_ENTRY_POINT_RENAME(ures_getVersionByKey)
#define ures_getVersionNumber U_ICU_ENTRY_POINT_RENAME(ures_getVersionNumber)
@@ -1584,7 +1584,7 @@
#define ures_open U_ICU_ENTRY_POINT_RENAME(ures_open)
#define ures_openAvailableLocales U_ICU_ENTRY_POINT_RENAME(ures_openAvailableLocales)
#define ures_openDirect U_ICU_ENTRY_POINT_RENAME(ures_openDirect)
-#define ures_openDirectFillIn U_ICU_ENTRY_POINT_RENAME(ures_openDirectFillIn)
+#define ures_openDirectFillIn U_ICU_ENTRY_POINT_RENAME(ures_openDirectFillIn)
#define ures_openFillIn U_ICU_ENTRY_POINT_RENAME(ures_openFillIn)
#define ures_openNoDefault U_ICU_ENTRY_POINT_RENAME(ures_openNoDefault)
#define ures_openU U_ICU_ENTRY_POINT_RENAME(ures_openU)
@@ -1741,14 +1741,14 @@
#define ustr_hashCharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashCharsN)
#define ustr_hashICharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashICharsN)
#define ustr_hashUCharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashUCharsN)
-#define ustrcase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ustrcase_getCaseLocale)
-#define ustrcase_getTitleBreakIterator U_ICU_ENTRY_POINT_RENAME(ustrcase_getTitleBreakIterator)
+#define ustrcase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ustrcase_getCaseLocale)
+#define ustrcase_getTitleBreakIterator U_ICU_ENTRY_POINT_RENAME(ustrcase_getTitleBreakIterator)
#define ustrcase_internalFold U_ICU_ENTRY_POINT_RENAME(ustrcase_internalFold)
#define ustrcase_internalToLower U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToLower)
#define ustrcase_internalToTitle U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToTitle)
#define ustrcase_internalToUpper U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToUpper)
#define ustrcase_map U_ICU_ENTRY_POINT_RENAME(ustrcase_map)
-#define ustrcase_mapWithOverlap U_ICU_ENTRY_POINT_RENAME(ustrcase_mapWithOverlap)
+#define ustrcase_mapWithOverlap U_ICU_ENTRY_POINT_RENAME(ustrcase_mapWithOverlap)
#define utext_char32At U_ICU_ENTRY_POINT_RENAME(utext_char32At)
#define utext_clone U_ICU_ENTRY_POINT_RENAME(utext_clone)
#define utext_close U_ICU_ENTRY_POINT_RENAME(utext_close)
@@ -1850,7 +1850,7 @@
#define utrie_set32 U_ICU_ENTRY_POINT_RENAME(utrie_set32)
#define utrie_setRange32 U_ICU_ENTRY_POINT_RENAME(utrie_setRange32)
#define utrie_swap U_ICU_ENTRY_POINT_RENAME(utrie_swap)
-#define utrie_swapAnyVersion U_ICU_ENTRY_POINT_RENAME(utrie_swapAnyVersion)
+#define utrie_swapAnyVersion U_ICU_ENTRY_POINT_RENAME(utrie_swapAnyVersion)
#define utrie_unserialize U_ICU_ENTRY_POINT_RENAME(utrie_unserialize)
#define utrie_unserializeDummy U_ICU_ENTRY_POINT_RENAME(utrie_unserializeDummy)
#define vzone_clone U_ICU_ENTRY_POINT_RENAME(vzone_clone)
@@ -1900,7 +1900,7 @@
#define ztrans_setTime U_ICU_ENTRY_POINT_RENAME(ztrans_setTime)
#define ztrans_setTo U_ICU_ENTRY_POINT_RENAME(ztrans_setTo)
-#endif /* !(defined(_MSC_VER) && defined(__INTELLISENSE__)) */
-#endif /* U_DISABLE_RENAMING */
-#endif /* URENAME_H */
+#endif /* !(defined(_MSC_VER) && defined(__INTELLISENSE__)) */
+#endif /* U_DISABLE_RENAMING */
+#endif /* URENAME_H */
diff --git a/contrib/libs/icu/include/unicode/urep.h b/contrib/libs/icu/include/unicode/urep.h
index 9745fc88a2..932202ddb0 100644
--- a/contrib/libs/icu/include/unicode/urep.h
+++ b/contrib/libs/icu/include/unicode/urep.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/include/unicode/ures.h b/contrib/libs/icu/include/unicode/ures.h
index 4ef7c643b1..839779fada 100644
--- a/contrib/libs/icu/include/unicode/ures.h
+++ b/contrib/libs/icu/include/unicode/ures.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -16,7 +16,7 @@
* 04/04/99 helena Fixed internal header inclusion.
* 04/15/99 Madhu Updated Javadoc
* 06/14/99 stephen Removed functions taking a filename suffix.
-* 07/20/99 stephen Language-independent typedef to void*
+* 07/20/99 stephen Language-independent typedef to void*
* 11/09/99 weiv Added ures_getLocale()
* 06/24/02 weiv Added support for resource sharing
******************************************************************************
@@ -138,7 +138,7 @@ typedef enum {
/**
* Opens a UResourceBundle, from which users can extract strings by using
* their corresponding keys.
- * Note that the caller is responsible of calling <TT>ures_close</TT> on each successfully
+ * Note that the caller is responsible of calling <TT>ures_close</TT> on each successfully
* opened resource bundle.
* @param packageName The packageName and locale together point to an ICU udata object,
* as defined by <code> udata_open( packageName, "res", locale, err) </code>
@@ -301,7 +301,7 @@ ures_getVersion(const UResourceBundle* resB,
* you to query for the real locale of the resource. For example, if you requested
* "en_US_CALIFORNIA" and only "en_US" bundle exists, "en_US" will be returned.
* For subresources, the locale where this resource comes from will be returned.
- * If fallback has occurred, getLocale will reflect this.
+ * If fallback has occurred, getLocale will reflect this.
*
* @param resourceBundle resource bundle in question
* @param status just for catching illegal arguments
@@ -333,19 +333,19 @@ ures_getLocaleByType(const UResourceBundle* resourceBundle,
#ifndef U_HIDE_INTERNAL_API
/**
- * Same as ures_open() but uses the fill-in parameter instead of allocating a new bundle.
- *
+ * Same as ures_open() but uses the fill-in parameter instead of allocating a new bundle.
+ *
* TODO need to revisit usefulness of this function
* and usage model for fillIn parameters without knowing sizeof(UResourceBundle)
- * @param r The existing UResourceBundle to fill in. If NULL then status will be
- * set to U_ILLEGAL_ARGUMENT_ERROR.
+ * @param r The existing UResourceBundle to fill in. If NULL then status will be
+ * set to U_ILLEGAL_ARGUMENT_ERROR.
* @param packageName The packageName and locale together point to an ICU udata object,
* as defined by <code> udata_open( packageName, "res", locale, err) </code>
* or equivalent. Typically, packageName will refer to a (.dat) file, or to
* a package registered with udata_setAppData(). Using a full file or directory
* pathname for packageName is deprecated. If NULL, ICU data will be used.
* @param localeID specifies the locale for which we want to open the resource
- * @param status The error code.
+ * @param status The error code.
* @internal
*/
U_INTERNAL void U_EXPORT2
@@ -580,7 +580,7 @@ ures_hasNext(const UResourceBundle *resourceBundle);
* @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller.
* Alternatively, you can supply a struct to be filled by this function.
* @param status fills in the outgoing error code. You may still get a non NULL result even if an
- * error occurred. Check status instead.
+ * error occurred. Check status instead.
* @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it
* @stable ICU 2.0
*/
@@ -596,7 +596,7 @@ ures_getNextResource(UResourceBundle *resourceBundle,
* @param resourceBundle a resource
* @param len fill in length of the string
* @param key fill in for key associated with this string. NULL if no key
- * @param status fills in the outgoing error code. If an error occurred, we may return NULL, but don't
+ * @param status fills in the outgoing error code. If an error occurred, we may return NULL, but don't
* count on it. Check status instead!
* @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file.
* @stable ICU 2.0
@@ -615,7 +615,7 @@ ures_getNextString(UResourceBundle *resourceBundle,
* @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller.
* Alternatively, you can supply a struct to be filled by this function.
* @param status fills in the outgoing error code. Don't count on NULL being returned if an error has
- * occurred. Check status instead.
+ * occurred. Check status instead.
* @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it
* @stable ICU 2.0
*/
@@ -631,7 +631,7 @@ ures_getByIndex(const UResourceBundle *resourceBundle,
* @param resourceBundle a resource
* @param indexS an index to the wanted string.
* @param len fill in length of the string
- * @param status fills in the outgoing error code. If an error occurred, we may return NULL, but don't
+ * @param status fills in the outgoing error code. If an error occurred, we may return NULL, but don't
* count on it. Check status instead!
* @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file.
* @stable ICU 2.0
@@ -722,7 +722,7 @@ ures_getByKey(const UResourceBundle *resourceBundle,
* @param resB a resource
* @param key a key associated with the wanted string
* @param len fill in length of the string
- * @param status fills in the outgoing error code. If an error occurred, we may return NULL, but don't
+ * @param status fills in the outgoing error code. If an error occurred, we may return NULL, but don't
* count on it. Check status instead!
* @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file.
* @stable ICU 2.0
diff --git a/contrib/libs/icu/include/unicode/uscript.h b/contrib/libs/icu/include/unicode/uscript.h
index df5c6735a5..53d57abed1 100644
--- a/contrib/libs/icu/include/unicode/uscript.h
+++ b/contrib/libs/icu/include/unicode/uscript.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -444,46 +444,46 @@ typedef enum UScriptCode {
/** @stable ICU 58 */
USCRIPT_SYMBOLS_EMOJI = 174,/* Zsye */
- /** @stable ICU 60 */
- USCRIPT_MASARAM_GONDI = 175,/* Gonm */
- /** @stable ICU 60 */
- USCRIPT_SOYOMBO = 176,/* Soyo */
- /** @stable ICU 60 */
- USCRIPT_ZANABAZAR_SQUARE = 177,/* Zanb */
-
- /** @stable ICU 62 */
- USCRIPT_DOGRA = 178,/* Dogr */
- /** @stable ICU 62 */
- USCRIPT_GUNJALA_GONDI = 179,/* Gong */
- /** @stable ICU 62 */
- USCRIPT_MAKASAR = 180,/* Maka */
- /** @stable ICU 62 */
- USCRIPT_MEDEFAIDRIN = 181,/* Medf */
- /** @stable ICU 62 */
- USCRIPT_HANIFI_ROHINGYA = 182,/* Rohg */
- /** @stable ICU 62 */
- USCRIPT_SOGDIAN = 183,/* Sogd */
- /** @stable ICU 62 */
- USCRIPT_OLD_SOGDIAN = 184,/* Sogo */
-
- /** @stable ICU 64 */
- USCRIPT_ELYMAIC = 185,/* Elym */
- /** @stable ICU 64 */
- USCRIPT_NYIAKENG_PUACHUE_HMONG = 186,/* Hmnp */
- /** @stable ICU 64 */
- USCRIPT_NANDINAGARI = 187,/* Nand */
- /** @stable ICU 64 */
- USCRIPT_WANCHO = 188,/* Wcho */
-
- /** @stable ICU 66 */
- USCRIPT_CHORASMIAN = 189,/* Chrs */
- /** @stable ICU 66 */
- USCRIPT_DIVES_AKURU = 190,/* Diak */
- /** @stable ICU 66 */
- USCRIPT_KHITAN_SMALL_SCRIPT = 191,/* Kits */
- /** @stable ICU 66 */
- USCRIPT_YEZIDI = 192,/* Yezi */
-
+ /** @stable ICU 60 */
+ USCRIPT_MASARAM_GONDI = 175,/* Gonm */
+ /** @stable ICU 60 */
+ USCRIPT_SOYOMBO = 176,/* Soyo */
+ /** @stable ICU 60 */
+ USCRIPT_ZANABAZAR_SQUARE = 177,/* Zanb */
+
+ /** @stable ICU 62 */
+ USCRIPT_DOGRA = 178,/* Dogr */
+ /** @stable ICU 62 */
+ USCRIPT_GUNJALA_GONDI = 179,/* Gong */
+ /** @stable ICU 62 */
+ USCRIPT_MAKASAR = 180,/* Maka */
+ /** @stable ICU 62 */
+ USCRIPT_MEDEFAIDRIN = 181,/* Medf */
+ /** @stable ICU 62 */
+ USCRIPT_HANIFI_ROHINGYA = 182,/* Rohg */
+ /** @stable ICU 62 */
+ USCRIPT_SOGDIAN = 183,/* Sogd */
+ /** @stable ICU 62 */
+ USCRIPT_OLD_SOGDIAN = 184,/* Sogo */
+
+ /** @stable ICU 64 */
+ USCRIPT_ELYMAIC = 185,/* Elym */
+ /** @stable ICU 64 */
+ USCRIPT_NYIAKENG_PUACHUE_HMONG = 186,/* Hmnp */
+ /** @stable ICU 64 */
+ USCRIPT_NANDINAGARI = 187,/* Nand */
+ /** @stable ICU 64 */
+ USCRIPT_WANCHO = 188,/* Wcho */
+
+ /** @stable ICU 66 */
+ USCRIPT_CHORASMIAN = 189,/* Chrs */
+ /** @stable ICU 66 */
+ USCRIPT_DIVES_AKURU = 190,/* Diak */
+ /** @stable ICU 66 */
+ USCRIPT_KHITAN_SMALL_SCRIPT = 191,/* Kits */
+ /** @stable ICU 66 */
+ USCRIPT_YEZIDI = 192,/* Yezi */
+
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal UScriptCode value.
@@ -491,7 +491,7 @@ typedef enum UScriptCode {
*
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
- USCRIPT_CODE_LIMIT = 193
+ USCRIPT_CODE_LIMIT = 193
#endif // U_HIDE_DEPRECATED_API
} UScriptCode;
@@ -509,7 +509,7 @@ typedef enum UScriptCode {
* @param nameOrAbbrOrLocale name of the script, as given in
* PropertyValueAliases.txt, or ISO 15924 code or locale
* @param fillIn the UScriptCode buffer to fill in the script code
- * @param capacity the capacity (size) of UScriptCode buffer passed in.
+ * @param capacity the capacity (size) of UScriptCode buffer passed in.
* @param err the error status code.
* @return The number of script codes filled in the buffer passed in
* @stable ICU 2.4
diff --git a/contrib/libs/icu/include/unicode/usearch.h b/contrib/libs/icu/include/unicode/usearch.h
index 3a43a22c64..080528e347 100644
--- a/contrib/libs/icu/include/unicode/usearch.h
+++ b/contrib/libs/icu/include/unicode/usearch.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -24,7 +24,7 @@
* \file
* \brief C API: StringSearch
*
- * C APIs for an engine that provides language-sensitive text searching based
+ * C APIs for an engine that provides language-sensitive text searching based
* on the comparison rules defined in a <tt>UCollator</tt> data struct,
* see <tt>ucol.h</tt>. This ensures that language eccentricity can be
* handled, e.g. for the German collator, characters &szlig; and SS will be matched
@@ -55,7 +55,7 @@
* <p>
* This search has APIs similar to that of other text iteration mechanisms
* such as the break iterators in <tt>ubrk.h</tt>. Using these
- * APIs, it is easy to scan through text looking for all occurrences of
+ * APIs, it is easy to scan through text looking for all occurrences of
* a given pattern. This search iterator allows changing of direction by
* calling a <tt>reset</tt> followed by a <tt>next</tt> or <tt>previous</tt>.
* Though a direction change can occur without calling <tt>reset</tt> first,
@@ -130,7 +130,7 @@
* pos = usearch_next(search, &status))
* {
* printf("Found match at %d pos, length is %d\n", pos,
- * usearch_getMatchedLength(search));
+ * usearch_getMatchedLength(search));
* }
* }
*
@@ -196,7 +196,7 @@ typedef enum {
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
USEARCH_ATTRIBUTE_COUNT = 3
-#endif /* U_HIDE_DEPRECATED_API */
+#endif /* U_HIDE_DEPRECATED_API */
} USearchAttribute;
/**
@@ -257,9 +257,9 @@ typedef enum {
* match an e with the same diacritic or a plain e in the searched text.
*
* This option is similar to "asymmetric search" as described in
- * [UTS #10 Unicode Collation Algorithm](http://www.unicode.org/reports/tr10/#Asymmetric_Search),
- * but also allows unmarked characters in the searched text to match
- * marked or unmarked versions of that character in the pattern.
+ * [UTS #10 Unicode Collation Algorithm](http://www.unicode.org/reports/tr10/#Asymmetric_Search),
+ * but also allows unmarked characters in the searched text to match
+ * marked or unmarked versions of that character in the pattern.
*
* @stable ICU 4.4
*/
@@ -271,7 +271,7 @@ typedef enum {
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
USEARCH_ATTRIBUTE_VALUE_COUNT
-#endif /* U_HIDE_DEPRECATED_API */
+#endif /* U_HIDE_DEPRECATED_API */
} USearchAttributeValue;
/* open and close ------------------------------------------------------ */
@@ -479,7 +479,7 @@ U_STABLE int32_t U_EXPORT2 usearch_getMatchedLength(
* possible. If the buffer fits the matched text exactly, a null-termination
* is not possible, then a U_STRING_NOT_TERMINATED_ERROR set in status.
* Pre-flighting can be either done with length = 0 or the API
-* <tt>usearch_getMatchedLength</tt>.
+* <tt>usearch_getMatchedLength</tt>.
* @param strsrch search iterator data struct
* @param result UChar buffer to store the matched string
* @param resultCapacity length of the result buffer
@@ -766,7 +766,7 @@ U_STABLE void U_EXPORT2 usearch_reset(UStringSearch *strsrch);
#ifndef U_HIDE_INTERNAL_API
/**
* Simple forward search for the pattern, starting at a specified index,
- * and using a default set search options.
+ * and using a default set search options.
*
* This is an experimental function, and is not an official part of the
* ICU API.
@@ -783,7 +783,7 @@ U_STABLE void U_EXPORT2 usearch_reset(UStringSearch *strsrch);
* are part of a combining sequence, as described below.
*
* A match will not include a partial combining sequence. Combining
- * character sequences are considered to be inseparable units,
+ * character sequences are considered to be inseparable units,
* and either match the pattern completely, or are considered to not match
* at all. Thus, for example, an A followed a combining accent mark will
* not be found when searching for a plain (unaccented) A. (unless
@@ -792,7 +792,7 @@ U_STABLE void U_EXPORT2 usearch_reset(UStringSearch *strsrch);
* When beginning a search, the initial starting position, startIdx,
* is assumed to be an acceptable match boundary with respect to
* combining characters. A combining sequence that spans across the
- * starting point will not suppress a match beginning at startIdx.
+ * starting point will not suppress a match beginning at startIdx.
*
* Characters that expand to multiple collation elements
* (German sharp-S becoming 'ss', or the composed forms of accented
@@ -843,7 +843,7 @@ U_INTERNAL UBool U_EXPORT2 usearch_search(UStringSearch *strsrch,
* are part of a combining sequence, as described below.
*
* A match will not include a partial combining sequence. Combining
- * character sequences are considered to be inseparable units,
+ * character sequences are considered to be inseparable units,
* and either match the pattern completely, or are considered to not match
* at all. Thus, for example, an A followed a combining accent mark will
* not be found when searching for a plain (unaccented) A. (unless
@@ -852,7 +852,7 @@ U_INTERNAL UBool U_EXPORT2 usearch_search(UStringSearch *strsrch,
* When beginning a search, the initial starting position, startIdx,
* is assumed to be an acceptable match boundary with respect to
* combining characters. A combining sequence that spans across the
- * starting point will not suppress a match beginning at startIdx.
+ * starting point will not suppress a match beginning at startIdx.
*
* Characters that expand to multiple collation elements
* (German sharp-S becoming 'ss', or the composed forms of accented
diff --git a/contrib/libs/icu/include/unicode/uset.h b/contrib/libs/icu/include/unicode/uset.h
index 1b40980469..18482c10e7 100644
--- a/contrib/libs/icu/include/unicode/uset.h
+++ b/contrib/libs/icu/include/unicode/uset.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: uset.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -33,14 +33,14 @@
#include "unicode/uchar.h"
#include "unicode/localpointer.h"
-#ifndef USET_DEFINED
-
-#ifndef U_IN_DOXYGEN
-#define USET_DEFINED
-#endif
+#ifndef USET_DEFINED
+
+#ifndef U_IN_DOXYGEN
+#define USET_DEFINED
+#endif
/**
- * USet is the C API type corresponding to C++ class UnicodeSet.
- * Use the uset_* API to manipulate. Create with
+ * USet is the C API type corresponding to C++ class UnicodeSet.
+ * Use the uset_* API to manipulate. Create with
* uset_open*, and destroy with uset_close.
* @stable ICU 2.4
*/
diff --git a/contrib/libs/icu/include/unicode/usetiter.h b/contrib/libs/icu/include/unicode/usetiter.h
index 61c6c43580..c6396fd76c 100644
--- a/contrib/libs/icu/include/unicode/usetiter.h
+++ b/contrib/libs/icu/include/unicode/usetiter.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -10,9 +10,9 @@
#define USETITER_H
#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
#include "unicode/unistr.h"
@@ -320,6 +320,6 @@ inline UChar32 UnicodeSetIterator::getCodepointEnd() const {
U_NAMESPACE_END
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/ushape.h b/contrib/libs/icu/include/unicode/ushape.h
index 05857bf255..78b4d027a8 100644
--- a/contrib/libs/icu/include/unicode/ushape.h
+++ b/contrib/libs/icu/include/unicode/ushape.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: ushape.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -93,7 +93,7 @@
* which must not indicate a failure before the function call.
*
* @return The number of UChars written to the destination buffer.
- * If an error occurred, then no output was written, or it may be
+ * If an error occurred, then no output was written, or it may be
* incomplete. If <code>U_BUFFER_OVERFLOW_ERROR</code> is set, then
* the return value indicates the necessary destination buffer size.
* @stable ICU 2.0
diff --git a/contrib/libs/icu/include/unicode/uspoof.h b/contrib/libs/icu/include/unicode/uspoof.h
index acc03f5378..63a13387b0 100644
--- a/contrib/libs/icu/include/unicode/uspoof.h
+++ b/contrib/libs/icu/include/unicode/uspoof.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
***************************************************************************
@@ -6,7 +6,7 @@
* and others. All Rights Reserved.
***************************************************************************
* file name: uspoof.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -353,18 +353,18 @@
* @stable ICU 4.6
*/
-U_CDECL_BEGIN
-
+U_CDECL_BEGIN
+
struct USpoofChecker;
-/**
- * @stable ICU 4.2
- */
+/**
+ * @stable ICU 4.2
+ */
typedef struct USpoofChecker USpoofChecker; /**< typedef for C of USpoofChecker */
struct USpoofCheckResult;
/**
* @see uspoof_openCheckResult
- * @stable ICU 58
+ * @stable ICU 58
*/
typedef struct USpoofCheckResult USpoofCheckResult;
@@ -413,7 +413,7 @@ typedef enum USpoofChecks {
*
* @see uspoof_areConfusable
* @see uspoof_getSkeleton
- * @stable ICU 58
+ * @stable ICU 58
*/
USPOOF_CONFUSABLE = USPOOF_SINGLE_SCRIPT_CONFUSABLE | USPOOF_MIXED_SCRIPT_CONFUSABLE | USPOOF_WHOLE_SCRIPT_CONFUSABLE,
@@ -465,7 +465,7 @@ typedef enum USpoofChecks {
*/
USPOOF_CHAR_LIMIT = 64,
- /**
+ /**
* Check that an identifier does not mix numbers from different numbering systems.
* For more information, see UTS 39 section 5.3.
*
@@ -473,27 +473,27 @@ typedef enum USpoofChecks {
*/
USPOOF_MIXED_NUMBERS = 128,
- /**
- * Check that an identifier does not have a combining character following a character in which that
- * combining character would be hidden; for example 'i' followed by a U+0307 combining dot.
- *
- * More specifically, the following characters are forbidden from preceding a U+0307:
- * <ul>
- * <li>Those with the Soft_Dotted Unicode property (which includes 'i' and 'j')</li>
- * <li>Latin lowercase letter 'l'</li>
- * <li>Dotless 'i' and 'j' ('ı' and 'ȷ', U+0131 and U+0237)</li>
- * <li>Any character whose confusable prototype ends with such a character
- * (Soft_Dotted, 'l', 'ı', or 'ȷ')</li>
- * </ul>
- * In addition, combining characters are allowed between the above characters and U+0307 except those
- * with combining class 0 or combining class "Above" (230, same class as U+0307).
- *
- * This list and the number of combing characters considered by this check may grow over time.
- *
- * @stable ICU 62
- */
- USPOOF_HIDDEN_OVERLAY = 256,
-
+ /**
+ * Check that an identifier does not have a combining character following a character in which that
+ * combining character would be hidden; for example 'i' followed by a U+0307 combining dot.
+ *
+ * More specifically, the following characters are forbidden from preceding a U+0307:
+ * <ul>
+ * <li>Those with the Soft_Dotted Unicode property (which includes 'i' and 'j')</li>
+ * <li>Latin lowercase letter 'l'</li>
+ * <li>Dotless 'i' and 'j' ('ı' and 'ȷ', U+0131 and U+0237)</li>
+ * <li>Any character whose confusable prototype ends with such a character
+ * (Soft_Dotted, 'l', 'ı', or 'ȷ')</li>
+ * </ul>
+ * In addition, combining characters are allowed between the above characters and U+0307 except those
+ * with combining class 0 or combining class "Above" (230, same class as U+0307).
+ *
+ * This list and the number of combing characters considered by this check may grow over time.
+ *
+ * @stable ICU 62
+ */
+ USPOOF_HIDDEN_OVERLAY = 256,
+
/**
* Enable all spoof checks.
*
@@ -986,9 +986,9 @@ uspoof_checkUTF8(const USpoofChecker *sc,
* @see uspoof_openCheckResult
* @see uspoof_check2UTF8
* @see uspoof_check2UnicodeString
- * @stable ICU 58
+ * @stable ICU 58
*/
-U_STABLE int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
uspoof_check2(const USpoofChecker *sc,
const UChar* id, int32_t length,
USpoofCheckResult* checkResult,
@@ -1023,9 +1023,9 @@ uspoof_check2(const USpoofChecker *sc,
* @see uspoof_openCheckResult
* @see uspoof_check2
* @see uspoof_check2UnicodeString
- * @stable ICU 58
+ * @stable ICU 58
*/
-U_STABLE int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
uspoof_check2UTF8(const USpoofChecker *sc,
const char *id, int32_t length,
USpoofCheckResult* checkResult,
@@ -1047,9 +1047,9 @@ uspoof_check2UTF8(const USpoofChecker *sc,
* @see uspoof_check2
* @see uspoof_check2UTF8
* @see uspoof_check2UnicodeString
- * @stable ICU 58
+ * @stable ICU 58
*/
-U_STABLE USpoofCheckResult* U_EXPORT2
+U_STABLE USpoofCheckResult* U_EXPORT2
uspoof_openCheckResult(UErrorCode *status);
/**
@@ -1057,9 +1057,9 @@ uspoof_openCheckResult(UErrorCode *status);
* its implementation.
*
* @param checkResult The instance of USpoofCheckResult to close
- * @stable ICU 58
+ * @stable ICU 58
*/
-U_STABLE void U_EXPORT2
+U_STABLE void U_EXPORT2
uspoof_closeCheckResult(USpoofCheckResult *checkResult);
/**
@@ -1074,9 +1074,9 @@ uspoof_closeCheckResult(USpoofCheckResult *checkResult);
* will be zero if the input string passes all of the
* enabled checks.
* @see uspoof_setChecks
- * @stable ICU 58
+ * @stable ICU 58
*/
-U_STABLE int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
uspoof_getCheckResultChecks(const USpoofCheckResult *checkResult, UErrorCode *status);
/**
@@ -1087,9 +1087,9 @@ uspoof_getCheckResultChecks(const USpoofCheckResult *checkResult, UErrorCode *st
* @param status The error code, set if an error occurred.
* @return The restriction level contained in the USpoofCheckResult
* @see uspoof_setRestrictionLevel
- * @stable ICU 58
+ * @stable ICU 58
*/
-U_STABLE URestrictionLevel U_EXPORT2
+U_STABLE URestrictionLevel U_EXPORT2
uspoof_getCheckResultRestrictionLevel(const USpoofCheckResult *checkResult, UErrorCode *status);
/**
@@ -1101,9 +1101,9 @@ uspoof_getCheckResultRestrictionLevel(const USpoofCheckResult *checkResult, UErr
* @param checkResult The instance of USpoofCheckResult created by {@link uspoof_openCheckResult}
* @return The set of numerics contained in the USpoofCheckResult
* @param status The error code, set if an error occurred.
- * @stable ICU 58
+ * @stable ICU 58
*/
-U_STABLE const USet* U_EXPORT2
+U_STABLE const USet* U_EXPORT2
uspoof_getCheckResultNumerics(const USpoofCheckResult *checkResult, UErrorCode *status);
@@ -1300,244 +1300,244 @@ uspoof_getInclusionSet(UErrorCode *status);
U_STABLE const USet * U_EXPORT2
uspoof_getRecommendedSet(UErrorCode *status);
-/**
- * Serialize the data for a spoof detector into a chunk of memory.
- * The flattened spoof detection tables can later be used to efficiently
- * instantiate a new Spoof Detector.
- *
- * The serialized spoof checker includes only the data compiled from the
- * Unicode data tables by uspoof_openFromSource(); it does not include
- * include any other state or configuration that may have been set.
- *
- * @param sc the Spoof Detector whose data is to be serialized.
- * @param data a pointer to 32-bit-aligned memory to be filled with the data,
- * can be NULL if capacity==0
- * @param capacity the number of bytes available at data,
- * or 0 for preflighting
- * @param status an in/out ICU UErrorCode; possible errors include:
- * - U_BUFFER_OVERFLOW_ERROR if the data storage block is too small for serialization
- * - U_ILLEGAL_ARGUMENT_ERROR the data or capacity parameters are bad
- * @return the number of bytes written or needed for the spoof data
- *
- * @see utrie2_openFromSerialized()
- * @stable ICU 4.2
- */
-U_STABLE int32_t U_EXPORT2
-uspoof_serialize(USpoofChecker *sc,
- void *data, int32_t capacity,
- UErrorCode *status);
-
-U_CDECL_END
-
+/**
+ * Serialize the data for a spoof detector into a chunk of memory.
+ * The flattened spoof detection tables can later be used to efficiently
+ * instantiate a new Spoof Detector.
+ *
+ * The serialized spoof checker includes only the data compiled from the
+ * Unicode data tables by uspoof_openFromSource(); it does not include
+ * include any other state or configuration that may have been set.
+ *
+ * @param sc the Spoof Detector whose data is to be serialized.
+ * @param data a pointer to 32-bit-aligned memory to be filled with the data,
+ * can be NULL if capacity==0
+ * @param capacity the number of bytes available at data,
+ * or 0 for preflighting
+ * @param status an in/out ICU UErrorCode; possible errors include:
+ * - U_BUFFER_OVERFLOW_ERROR if the data storage block is too small for serialization
+ * - U_ILLEGAL_ARGUMENT_ERROR the data or capacity parameters are bad
+ * @return the number of bytes written or needed for the spoof data
+ *
+ * @see utrie2_openFromSerialized()
+ * @stable ICU 4.2
+ */
+U_STABLE int32_t U_EXPORT2
+uspoof_serialize(USpoofChecker *sc,
+ void *data, int32_t capacity,
+ UErrorCode *status);
+
+U_CDECL_END
+
#if U_SHOW_CPLUSPLUS_API
-U_NAMESPACE_BEGIN
-
+U_NAMESPACE_BEGIN
+
+/**
+ * \class LocalUSpoofCheckerPointer
+ * "Smart pointer" class, closes a USpoofChecker via uspoof_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 4.4
+ */
+/**
+ * \cond
+ * Note: Doxygen is giving a bogus warning on this U_DEFINE_LOCAL_OPEN_POINTER.
+ * For now, suppress with a Doxygen cond
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckerPointer, USpoofChecker, uspoof_close);
+/** \endcond */
+
+/**
+ * \class LocalUSpoofCheckResultPointer
+ * "Smart pointer" class, closes a USpoofCheckResult via `uspoof_closeCheckResult()`.
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 58
+ */
+
+/**
+ * \cond
+ * Note: Doxygen is giving a bogus warning on this U_DEFINE_LOCAL_OPEN_POINTER.
+ * For now, suppress with a Doxygen cond
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckResultPointer, USpoofCheckResult, uspoof_closeCheckResult);
+/** \endcond */
+
+U_NAMESPACE_END
+
+/**
+ * Limit the acceptable characters to those specified by a Unicode Set.
+ * Any previously specified character limit is
+ * is replaced by the new settings. This includes limits on
+ * characters that were set with the uspoof_setAllowedLocales() function.
+ *
+ * The USPOOF_CHAR_LIMIT test is automatically enabled for this
+ * USoofChecker by this function.
+ *
+ * @param sc The USpoofChecker
+ * @param chars A Unicode Set containing the list of
+ * characters that are permitted. Ownership of the set
+ * remains with the caller. The incoming set is cloned by
+ * this function, so there are no restrictions on modifying
+ * or deleting the UnicodeSet after calling this function.
+ * @param status The error code, set if this function encounters a problem.
+ * @stable ICU 4.2
+ */
+U_STABLE void U_EXPORT2
+uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const icu::UnicodeSet *chars, UErrorCode *status);
+
+
+/**
+ * Get a UnicodeSet for the characters permitted in an identifier.
+ * This corresponds to the limits imposed by the Set Allowed Characters /
+ * UnicodeSet functions. Limitations imposed by other checks will not be
+ * reflected in the set returned by this function.
+ *
+ * The returned set will be frozen, meaning that it cannot be modified
+ * by the caller.
+ *
+ * Ownership of the returned set remains with the Spoof Detector. The
+ * returned set will become invalid if the spoof detector is closed,
+ * or if a new set of allowed characters is specified.
+ *
+ *
+ * @param sc The USpoofChecker
+ * @param status The error code, set if this function encounters a problem.
+ * @return A UnicodeSet containing the characters that are permitted by
+ * the USPOOF_CHAR_LIMIT test.
+ * @stable ICU 4.2
+ */
+U_STABLE const icu::UnicodeSet * U_EXPORT2
+uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status);
+
+/**
+ * Check the specified string for possible security issues.
+ * The text to be checked will typically be an identifier of some sort.
+ * The set of checks to be performed is specified with uspoof_setChecks().
+ *
+ * \note
+ * Consider using the newer API, {@link uspoof_check2UnicodeString}, instead.
+ * The newer API exposes additional information from the check procedure
+ * and is otherwise identical to this method.
+ *
+ * @param sc The USpoofChecker
+ * @param id A identifier to be checked for possible security issues.
+ * @param position Deprecated in ICU 51. Always returns zero.
+ * Originally, an out parameter for the index of the first
+ * string position that failed a check.
+ * This parameter may be NULL.
+ * @param status The error code, set if an error occurred while attempting to
+ * perform the check.
+ * Spoofing or security issues detected with the input string are
+ * not reported here, but through the function's return value.
+ * @return An integer value with bits set for any potential security
+ * or spoofing issues detected. The bits are defined by
+ * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS)
+ * will be zero if the input string passes all of the
+ * enabled checks.
+ * @see uspoof_check2UnicodeString
+ * @stable ICU 4.2
+ */
+U_STABLE int32_t U_EXPORT2
+uspoof_checkUnicodeString(const USpoofChecker *sc,
+ const icu::UnicodeString &id,
+ int32_t *position,
+ UErrorCode *status);
+
+/**
+ * Check the specified string for possible security issues.
+ * The text to be checked will typically be an identifier of some sort.
+ * The set of checks to be performed is specified with uspoof_setChecks().
+ *
+ * @param sc The USpoofChecker
+ * @param id A identifier to be checked for possible security issues.
+ * @param checkResult An instance of USpoofCheckResult to be filled with
+ * details about the identifier. Can be NULL.
+ * @param status The error code, set if an error occurred while attempting to
+ * perform the check.
+ * Spoofing or security issues detected with the input string are
+ * not reported here, but through the function's return value.
+ * @return An integer value with bits set for any potential security
+ * or spoofing issues detected. The bits are defined by
+ * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS)
+ * will be zero if the input string passes all of the
+ * enabled checks. Any information in this bitmask will be
+ * consistent with the information saved in the optional
+ * checkResult parameter.
+ * @see uspoof_openCheckResult
+ * @see uspoof_check2
+ * @see uspoof_check2UTF8
+ * @stable ICU 58
+ */
+U_STABLE int32_t U_EXPORT2
+uspoof_check2UnicodeString(const USpoofChecker *sc,
+ const icu::UnicodeString &id,
+ USpoofCheckResult* checkResult,
+ UErrorCode *status);
+
+/**
+ * A version of {@link uspoof_areConfusable} accepting UnicodeStrings.
+ *
+ * @param sc The USpoofChecker
+ * @param s1 The first of the two identifiers to be compared for
+ * confusability. The strings are in UTF-8 format.
+ * @param s2 The second of the two identifiers to be compared for
+ * confusability. The strings are in UTF-8 format.
+ * @param status The error code, set if an error occurred while attempting to
+ * perform the check.
+ * Confusability of the identifiers is not reported here,
+ * but through this function's return value.
+ * @return An integer value with bit(s) set corresponding to
+ * the type of confusability found, as defined by
+ * enum USpoofChecks. Zero is returned if the identifiers
+ * are not confusable.
+ *
+ * @stable ICU 4.2
+ *
+ * @see uspoof_areConfusable
+ */
+U_STABLE int32_t U_EXPORT2
+uspoof_areConfusableUnicodeString(const USpoofChecker *sc,
+ const icu::UnicodeString &s1,
+ const icu::UnicodeString &s2,
+ UErrorCode *status);
+
+/**
+ * Get the "skeleton" for an identifier.
+ * Skeletons are a transformation of the input identifier;
+ * Two identifiers are confusable if their skeletons are identical.
+ * See Unicode UAX #39 for additional information.
+ *
+ * Using skeletons directly makes it possible to quickly check
+ * whether an identifier is confusable with any of some large
+ * set of existing identifiers, by creating an efficiently
+ * searchable collection of the skeletons.
+ *
+ * @param sc The USpoofChecker.
+ * @param type Deprecated in ICU 58. You may pass any number.
+ * Originally, controlled which of the Unicode confusable data
+ * tables to use.
+ * @param id The input identifier whose skeleton will be computed.
+ * @param dest The output identifier, to receive the skeleton string.
+ * @param status The error code, set if an error occurred while attempting to
+ * perform the check.
+ * @return A reference to the destination (skeleton) string.
+ *
+ * @stable ICU 4.2
+ */
+U_I18N_API icu::UnicodeString & U_EXPORT2
+uspoof_getSkeletonUnicodeString(const USpoofChecker *sc,
+ uint32_t type,
+ const icu::UnicodeString &id,
+ icu::UnicodeString &dest,
+ UErrorCode *status);
+
/**
- * \class LocalUSpoofCheckerPointer
- * "Smart pointer" class, closes a USpoofChecker via uspoof_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 4.4
- */
-/**
- * \cond
- * Note: Doxygen is giving a bogus warning on this U_DEFINE_LOCAL_OPEN_POINTER.
- * For now, suppress with a Doxygen cond
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckerPointer, USpoofChecker, uspoof_close);
-/** \endcond */
-
-/**
- * \class LocalUSpoofCheckResultPointer
- * "Smart pointer" class, closes a USpoofCheckResult via `uspoof_closeCheckResult()`.
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 58
- */
-
-/**
- * \cond
- * Note: Doxygen is giving a bogus warning on this U_DEFINE_LOCAL_OPEN_POINTER.
- * For now, suppress with a Doxygen cond
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckResultPointer, USpoofCheckResult, uspoof_closeCheckResult);
-/** \endcond */
-
-U_NAMESPACE_END
-
-/**
- * Limit the acceptable characters to those specified by a Unicode Set.
- * Any previously specified character limit is
- * is replaced by the new settings. This includes limits on
- * characters that were set with the uspoof_setAllowedLocales() function.
- *
- * The USPOOF_CHAR_LIMIT test is automatically enabled for this
- * USoofChecker by this function.
- *
- * @param sc The USpoofChecker
- * @param chars A Unicode Set containing the list of
- * characters that are permitted. Ownership of the set
- * remains with the caller. The incoming set is cloned by
- * this function, so there are no restrictions on modifying
- * or deleting the UnicodeSet after calling this function.
- * @param status The error code, set if this function encounters a problem.
- * @stable ICU 4.2
- */
-U_STABLE void U_EXPORT2
-uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const icu::UnicodeSet *chars, UErrorCode *status);
-
-
-/**
- * Get a UnicodeSet for the characters permitted in an identifier.
- * This corresponds to the limits imposed by the Set Allowed Characters /
- * UnicodeSet functions. Limitations imposed by other checks will not be
- * reflected in the set returned by this function.
- *
- * The returned set will be frozen, meaning that it cannot be modified
- * by the caller.
- *
- * Ownership of the returned set remains with the Spoof Detector. The
- * returned set will become invalid if the spoof detector is closed,
- * or if a new set of allowed characters is specified.
- *
- *
- * @param sc The USpoofChecker
- * @param status The error code, set if this function encounters a problem.
- * @return A UnicodeSet containing the characters that are permitted by
- * the USPOOF_CHAR_LIMIT test.
- * @stable ICU 4.2
- */
-U_STABLE const icu::UnicodeSet * U_EXPORT2
-uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status);
-
-/**
- * Check the specified string for possible security issues.
- * The text to be checked will typically be an identifier of some sort.
- * The set of checks to be performed is specified with uspoof_setChecks().
- *
- * \note
- * Consider using the newer API, {@link uspoof_check2UnicodeString}, instead.
- * The newer API exposes additional information from the check procedure
- * and is otherwise identical to this method.
- *
- * @param sc The USpoofChecker
- * @param id A identifier to be checked for possible security issues.
- * @param position Deprecated in ICU 51. Always returns zero.
- * Originally, an out parameter for the index of the first
- * string position that failed a check.
- * This parameter may be NULL.
- * @param status The error code, set if an error occurred while attempting to
- * perform the check.
- * Spoofing or security issues detected with the input string are
- * not reported here, but through the function's return value.
- * @return An integer value with bits set for any potential security
- * or spoofing issues detected. The bits are defined by
- * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS)
- * will be zero if the input string passes all of the
- * enabled checks.
- * @see uspoof_check2UnicodeString
- * @stable ICU 4.2
- */
-U_STABLE int32_t U_EXPORT2
-uspoof_checkUnicodeString(const USpoofChecker *sc,
- const icu::UnicodeString &id,
- int32_t *position,
- UErrorCode *status);
-
-/**
- * Check the specified string for possible security issues.
- * The text to be checked will typically be an identifier of some sort.
- * The set of checks to be performed is specified with uspoof_setChecks().
- *
- * @param sc The USpoofChecker
- * @param id A identifier to be checked for possible security issues.
- * @param checkResult An instance of USpoofCheckResult to be filled with
- * details about the identifier. Can be NULL.
- * @param status The error code, set if an error occurred while attempting to
- * perform the check.
- * Spoofing or security issues detected with the input string are
- * not reported here, but through the function's return value.
- * @return An integer value with bits set for any potential security
- * or spoofing issues detected. The bits are defined by
- * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS)
- * will be zero if the input string passes all of the
- * enabled checks. Any information in this bitmask will be
- * consistent with the information saved in the optional
- * checkResult parameter.
- * @see uspoof_openCheckResult
- * @see uspoof_check2
- * @see uspoof_check2UTF8
- * @stable ICU 58
- */
-U_STABLE int32_t U_EXPORT2
-uspoof_check2UnicodeString(const USpoofChecker *sc,
- const icu::UnicodeString &id,
- USpoofCheckResult* checkResult,
- UErrorCode *status);
-
-/**
- * A version of {@link uspoof_areConfusable} accepting UnicodeStrings.
- *
- * @param sc The USpoofChecker
- * @param s1 The first of the two identifiers to be compared for
- * confusability. The strings are in UTF-8 format.
- * @param s2 The second of the two identifiers to be compared for
- * confusability. The strings are in UTF-8 format.
- * @param status The error code, set if an error occurred while attempting to
- * perform the check.
- * Confusability of the identifiers is not reported here,
- * but through this function's return value.
- * @return An integer value with bit(s) set corresponding to
- * the type of confusability found, as defined by
- * enum USpoofChecks. Zero is returned if the identifiers
- * are not confusable.
- *
- * @stable ICU 4.2
- *
- * @see uspoof_areConfusable
- */
-U_STABLE int32_t U_EXPORT2
-uspoof_areConfusableUnicodeString(const USpoofChecker *sc,
- const icu::UnicodeString &s1,
- const icu::UnicodeString &s2,
- UErrorCode *status);
-
-/**
- * Get the "skeleton" for an identifier.
- * Skeletons are a transformation of the input identifier;
- * Two identifiers are confusable if their skeletons are identical.
- * See Unicode UAX #39 for additional information.
- *
- * Using skeletons directly makes it possible to quickly check
- * whether an identifier is confusable with any of some large
- * set of existing identifiers, by creating an efficiently
- * searchable collection of the skeletons.
- *
- * @param sc The USpoofChecker.
- * @param type Deprecated in ICU 58. You may pass any number.
- * Originally, controlled which of the Unicode confusable data
- * tables to use.
- * @param id The input identifier whose skeleton will be computed.
- * @param dest The output identifier, to receive the skeleton string.
- * @param status The error code, set if an error occurred while attempting to
- * perform the check.
- * @return A reference to the destination (skeleton) string.
- *
- * @stable ICU 4.2
- */
-U_I18N_API icu::UnicodeString & U_EXPORT2
-uspoof_getSkeletonUnicodeString(const USpoofChecker *sc,
- uint32_t type,
- const icu::UnicodeString &id,
- icu::UnicodeString &dest,
- UErrorCode *status);
-
-/**
* Get the set of Candidate Characters for Inclusion in Identifiers, as defined
* in http://unicode.org/Public/security/latest/xidmodifications.txt
* and documented in http://www.unicode.org/reports/tr39/, Unicode Security Mechanisms.
@@ -1569,6 +1569,6 @@ uspoof_getRecommendedUnicodeSet(UErrorCode *status);
#endif /* U_SHOW_CPLUSPLUS_API */
-#endif /* UCONFIG_NO_NORMALIZATION */
+#endif /* UCONFIG_NO_NORMALIZATION */
#endif /* USPOOF_H */
diff --git a/contrib/libs/icu/include/unicode/usprep.h b/contrib/libs/icu/include/unicode/usprep.h
index e3f132e5f9..914eb84871 100644
--- a/contrib/libs/icu/include/unicode/usprep.h
+++ b/contrib/libs/icu/include/unicode/usprep.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: usprep.h
- * encoding: UTF-8
+ * encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -33,14 +33,14 @@
* StringPrep prepares Unicode strings for use in network protocols.
* Profiles of StingPrep are set of rules and data according to with the
* Unicode Strings are prepared. Each profiles contains tables which describe
- * how a code point should be treated. The tables are broadly classified into
+ * how a code point should be treated. The tables are broadly classified into
* <ul>
- * <li> Unassigned Table: Contains code points that are unassigned
+ * <li> Unassigned Table: Contains code points that are unassigned
* in the Unicode Version supported by StringPrep. Currently
* RFC 3454 supports Unicode 3.2. </li>
- * <li> Prohibited Table: Contains code points that are prohibited from
+ * <li> Prohibited Table: Contains code points that are prohibited from
* the output of the StringPrep processing function. </li>
- * <li> Mapping Table: Contains code points that are deleted from the output or case mapped. </li>
+ * <li> Mapping Table: Contains code points that are deleted from the output or case mapped. </li>
* </ul>
*
* The procedure for preparing Unicode strings:
@@ -230,7 +230,7 @@ U_NAMESPACE_END
/**
* Prepare the input buffer for use in applications with the given profile. This operation maps, normalizes(NFKC),
- * checks for prohibited and BiDi characters in the order defined by RFC 3454
+ * checks for prohibited and BiDi characters in the order defined by RFC 3454
* depending on the options specified in the profile.
*
* @param prep The profile to use
diff --git a/contrib/libs/icu/include/unicode/ustdio.h b/contrib/libs/icu/include/unicode/ustdio.h
index d3837bca24..342c2b4604 100644
--- a/contrib/libs/icu/include/unicode/ustdio.h
+++ b/contrib/libs/icu/include/unicode/ustdio.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/include/unicode/ustream.h b/contrib/libs/icu/include/unicode/ustream.h
index 3cf3b901e7..927342cb03 100644
--- a/contrib/libs/icu/include/unicode/ustream.h
+++ b/contrib/libs/icu/include/unicode/ustream.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -17,10 +17,10 @@
#ifndef USTREAM_H
#define USTREAM_H
-#include "unicode/utypes.h"
-
-#if U_SHOW_CPLUSPLUS_API
-
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/unistr.h"
#if !UCONFIG_NO_CONVERSION // not available without conversion
@@ -34,7 +34,7 @@
* C++ I/O stream API.
*/
-#if defined(__GLIBCXX__)
+#if defined(__GLIBCXX__)
namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364
#endif
@@ -64,6 +64,6 @@ U_NAMESPACE_END
/* No operator for UChar because it can conflict with wchar_t */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/contrib/libs/icu/include/unicode/ustring.h b/contrib/libs/icu/include/unicode/ustring.h
index 38429f0970..245b766545 100644
--- a/contrib/libs/icu/include/unicode/ustring.h
+++ b/contrib/libs/icu/include/unicode/ustring.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -403,7 +403,7 @@ u_strspn(const UChar *string, const UChar *matchSet);
* @param saveState The current pointer within the original string,
* which is set by this function. The saveState
* parameter should the address of a local variable of type
- * UChar *. (i.e. defined "UChar *myLocalSaveState" and use
+ * UChar *. (i.e. defined "UChar *myLocalSaveState" and use
* &myLocalSaveState for this parameter).
* @return A pointer to the next token found in src, or NULL
* when there are no more tokens.
@@ -884,7 +884,7 @@ u_memrchr32(const UChar *s, UChar32 c, int32_t count);
* Unicode String literals in C.
* We need one macro to declare a variable for the string
* and to statically preinitialize it if possible,
- * and a second macro to dynamically initialize such a string variable if necessary.
+ * and a second macro to dynamically initialize such a string variable if necessary.
*
* The macros are defined for maximum performance.
* They work only for strings that contain "invariant characters", i.e.,
@@ -895,32 +895,32 @@ u_memrchr32(const UChar *s, UChar32 c, int32_t count);
* parameters.
* The string parameter must be a C string literal.
* The length of the string, not including the terminating
- * `NUL`, must be specified as a constant.
+ * `NUL`, must be specified as a constant.
* The U_STRING_DECL macro should be invoked exactly once for one
* such string variable before it is used.
*
* Usage:
+ *
+ * U_STRING_DECL(ustringVar1, "Quick-Fox 2", 11);
+ * U_STRING_DECL(ustringVar2, "jumps 5%", 8);
+ * static UBool didInit=FALSE;
+ *
+ * int32_t function() {
+ * if(!didInit) {
+ * U_STRING_INIT(ustringVar1, "Quick-Fox 2", 11);
+ * U_STRING_INIT(ustringVar2, "jumps 5%", 8);
+ * didInit=TRUE;
+ * }
+ * return u_strcmp(ustringVar1, ustringVar2);
+ * }
*
- * U_STRING_DECL(ustringVar1, "Quick-Fox 2", 11);
- * U_STRING_DECL(ustringVar2, "jumps 5%", 8);
- * static UBool didInit=FALSE;
- *
- * int32_t function() {
- * if(!didInit) {
- * U_STRING_INIT(ustringVar1, "Quick-Fox 2", 11);
- * U_STRING_INIT(ustringVar2, "jumps 5%", 8);
- * didInit=TRUE;
- * }
- * return u_strcmp(ustringVar1, ustringVar2);
- * }
- *
- * Note that the macros will NOT consistently work if their argument is another #`define`.
- * The following will not work on all platforms, don't use it.
+ * Note that the macros will NOT consistently work if their argument is another #`define`.
+ * The following will not work on all platforms, don't use it.
*
* #define GLUCK "Mr. Gluck"
* U_STRING_DECL(var, GLUCK, 9)
* U_STRING_INIT(var, GLUCK, 9)
- *
+ *
* Instead, use the string literal "Mr. Gluck" as the argument to both macro
* calls.
*
diff --git a/contrib/libs/icu/include/unicode/ustringtrie.h b/contrib/libs/icu/include/unicode/ustringtrie.h
index b45426a5b8..fd85648225 100644
--- a/contrib/libs/icu/include/unicode/ustringtrie.h
+++ b/contrib/libs/icu/include/unicode/ustringtrie.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -6,7 +6,7 @@
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: udicttrie.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/include/unicode/utext.h b/contrib/libs/icu/include/unicode/utext.h
index 14c3245a92..37d71a3172 100644
--- a/contrib/libs/icu/include/unicode/utext.h
+++ b/contrib/libs/icu/include/unicode/utext.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: utext.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -370,7 +370,7 @@ utext_equals(const UText *a, const UText *b);
/*****************************************************************************
*
- * Functions to work with the text represented by a UText wrapper
+ * Functions to work with the text represented by a UText wrapper
*
*****************************************************************************/
@@ -414,7 +414,7 @@ utext_isLengthExpensive(const UText *ut);
*
* The iteration position will be set to the start of the returned code point.
*
- * This function is roughly equivalent to the sequence
+ * This function is roughly equivalent to the sequence
* utext_setNativeIndex(index);
* utext_current32();
* (There is a subtle difference if the index is out of bounds by being less than zero -
@@ -573,7 +573,7 @@ U_STABLE void U_EXPORT2
utext_setNativeIndex(UText *ut, int64_t nativeIndex);
/**
- * Move the iterator position by delta code points. The number of code points
+ * Move the iterator position by delta code points. The number of code points
* is a signed number; a negative delta will move the iterator backwards,
* towards the start of the text.
* <p>
@@ -592,7 +592,7 @@ U_STABLE UBool U_EXPORT2
utext_moveIndex32(UText *ut, int32_t delta);
/**
- * Get the native index of the character preceding the current position.
+ * Get the native index of the character preceding the current position.
* If the iteration position is already at the start of the text, zero
* is returned.
* The value returned is the same as that obtained from the following sequence,
@@ -609,7 +609,7 @@ utext_moveIndex32(UText *ut, int32_t delta);
* native index of the character most recently returned from utext_next().
*
* @param ut the text to be accessed
- * @return the native index of the character preceding the current index position,
+ * @return the native index of the character preceding the current index position,
* or zero if the current position is at the start of the text.
* @stable ICU 3.6
*/
@@ -636,10 +636,10 @@ utext_getPreviousNativeIndex(UText *ut);
* @param ut the UText from which to extract data.
* @param nativeStart the native index of the first character to extract.\
* If the specified index is out of range,
- * it will be pinned to be within 0 <= index <= textLength
+ * it will be pinned to be within 0 <= index <= textLength
* @param nativeLimit the native string index of the position following the last
* character to extract. If the specified index is out of range,
- * it will be pinned to be within 0 <= index <= textLength.
+ * it will be pinned to be within 0 <= index <= textLength.
* nativeLimit must be >= nativeStart.
* @param dest the UChar (UTF-16) buffer into which the extracted text is placed
* @param destCapacity The size, in UChars, of the destination buffer. May be zero
@@ -747,14 +747,14 @@ utext_extract(UText *ut,
*
* @stable ICU 3.8
*/
-#define UTEXT_SETNATIVEINDEX(ut, ix) UPRV_BLOCK_MACRO_BEGIN { \
- int64_t __offset = (ix) - (ut)->chunkNativeStart; \
- if (__offset>=0 && __offset<(int64_t)(ut)->nativeIndexingLimit && (ut)->chunkContents[__offset]<0xdc00) { \
- (ut)->chunkOffset=(int32_t)__offset; \
- } else { \
- utext_setNativeIndex((ut), (ix)); \
- } \
-} UPRV_BLOCK_MACRO_END
+#define UTEXT_SETNATIVEINDEX(ut, ix) UPRV_BLOCK_MACRO_BEGIN { \
+ int64_t __offset = (ix) - (ut)->chunkNativeStart; \
+ if (__offset>=0 && __offset<(int64_t)(ut)->nativeIndexingLimit && (ut)->chunkContents[__offset]<0xdc00) { \
+ (ut)->chunkOffset=(int32_t)__offset; \
+ } else { \
+ utext_setNativeIndex((ut), (ix)); \
+ } \
+} UPRV_BLOCK_MACRO_END
@@ -889,7 +889,7 @@ utext_copy(UText *ut,
* Caution: freezing a UText will disable changes made via the specific
* frozen UText wrapper only; it will not have any effect on the ability to
* directly modify the text by bypassing the UText. Any such backdoor modifications
- * are always an error while UText access is occurring because the underlying
+ * are always an error while UText access is occurring because the underlying
* text can get out of sync with UText's buffering.
* </p>
*
@@ -1037,7 +1037,7 @@ UTextAccess(UText *ut, int64_t nativeIndex, UBool forward);
* be NUL-terminated if there is sufficient space in the destination buffer.
*
* @param ut the UText from which to extract data.
- * @param nativeStart the native index of the first character to extract.
+ * @param nativeStart the native index of the first character to extract.
* @param nativeLimit the native string index of the position following the last
* character to extract.
* @param dest the UChar (UTF-16) buffer into which the extracted text is placed
@@ -1194,7 +1194,7 @@ UTextClose(UText *ut);
struct UTextFuncs {
/**
* (public) Function table size, sizeof(UTextFuncs)
- * Intended for use should the table grow to accommodate added
+ * Intended for use should the table grow to accommodate added
* functions in the future, to allow tests for older format
* function tables that do not contain the extensions.
*
@@ -1328,7 +1328,7 @@ typedef struct UTextFuncs UTextFuncs;
struct UText {
/**
* (private) Magic. Used to help detect when UText functions are handed
- * invalid or uninitialized UText structs.
+ * invalid or uninitialized UText structs.
* utext_openXYZ() functions take an initialized,
* but not necessarily open, UText struct as an
* optional fill-in parameter. This magic field
@@ -1350,7 +1350,7 @@ struct UText {
/**
- * Text provider properties. This set of flags is maintained by the
+ * Text provider properties. This set of flags is maintained by the
* text provider implementation.
* @stable ICU 3.4
*/
@@ -1435,7 +1435,7 @@ struct UText {
void *pExtra;
/**
- * (protected) Pointer to string or text-containing object or similar.
+ * (protected) Pointer to string or text-containing object or similar.
* This is the source of the text that this UText is wrapping, in a format
* that is known to the text provider functions.
* @stable ICU 3.4
@@ -1538,7 +1538,7 @@ struct UText {
U_STABLE UText * U_EXPORT2
utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status);
-// do not use #ifndef U_HIDE_INTERNAL_API around the following!
+// do not use #ifndef U_HIDE_INTERNAL_API around the following!
/**
* @internal
* Value used to help identify correctly initialized UText structs.
@@ -1580,24 +1580,24 @@ enum {
U_CDECL_END
-#if U_SHOW_CPLUSPLUS_API
+#if U_SHOW_CPLUSPLUS_API
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \class LocalUTextPointer
+ * "Smart pointer" class, closes a UText via utext_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 4.4
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUTextPointer, UText, utext_close);
+
+U_NAMESPACE_END
+
+#endif
+
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUTextPointer
- * "Smart pointer" class, closes a UText via utext_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 4.4
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUTextPointer, UText, utext_close);
-
-U_NAMESPACE_END
-
#endif
-
-
-#endif
diff --git a/contrib/libs/icu/include/unicode/utf.h b/contrib/libs/icu/include/unicode/utf.h
index 1ed2172bd8..ef512997f0 100644
--- a/contrib/libs/icu/include/unicode/utf.h
+++ b/contrib/libs/icu/include/unicode/utf.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: utf.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -47,11 +47,11 @@
* but are optimized for the much more frequently occurring BMP code points.
*
* umachine.h defines UChar to be an unsigned 16-bit integer.
- * Since ICU 59, ICU uses char16_t in C++, UChar only in C,
- * and defines UChar=char16_t by default. See the UChar API docs for details.
+ * Since ICU 59, ICU uses char16_t in C++, UChar only in C,
+ * and defines UChar=char16_t by default. See the UChar API docs for details.
*
* UChar32 is defined to be a signed 32-bit integer (int32_t), large enough for a 21-bit
- * Unicode code point (Unicode scalar value, 0..0x10ffff) and U_SENTINEL (-1).
+ * Unicode code point (Unicode scalar value, 0..0x10ffff) and U_SENTINEL (-1).
* Before ICU 2.4, the definition of UChar32 was similarly platform-dependent as
* the definition of UChar. For details see the documentation for UChar32 itself.
*
@@ -60,20 +60,20 @@
* For actual Unicode character properties see uchar.h.
*
* By default, string operations must be done with error checking in case
- * a string is not well-formed UTF-16 or UTF-8.
- *
- * The U16_ macros detect if a surrogate code unit is unpaired
+ * a string is not well-formed UTF-16 or UTF-8.
+ *
+ * The U16_ macros detect if a surrogate code unit is unpaired
* (lead unit without trail unit or vice versa) and just return the unit itself
* as the code point.
*
- * The U8_ macros detect illegal byte sequences and return a negative value.
- * Starting with ICU 60, the observable length of a single illegal byte sequence
- * skipped by one of these macros follows the Unicode 6+ recommendation
- * which is consistent with the W3C Encoding Standard.
- *
- * There are ..._OR_FFFD versions of both U16_ and U8_ macros
- * that return U+FFFD for illegal code unit sequences.
- *
+ * The U8_ macros detect illegal byte sequences and return a negative value.
+ * Starting with ICU 60, the observable length of a single illegal byte sequence
+ * skipped by one of these macros follows the Unicode 6+ recommendation
+ * which is consistent with the W3C Encoding Standard.
+ *
+ * There are ..._OR_FFFD versions of both U16_ and U8_ macros
+ * that return U+FFFD for illegal code unit sequences.
+ *
* The regular "safe" macros require that the initial, passed-in string index
* is within bounds. They only check the index when they read more than one
* code unit. This is usually done with code similar to the following loop:
@@ -97,7 +97,7 @@
* The performance differences are much larger here because UTF-8 provides so
* many opportunities for malformed sequences.
* The unsafe UTF-8 macros are entirely implemented inside the macro definitions
- * and are fast, while the safe UTF-8 macros call functions for some complicated cases.
+ * and are fast, while the safe UTF-8 macros call functions for some complicated cases.
*
* Unlike with UTF-16, malformed sequences cannot be expressed with distinct
* code point values (0..U+10ffff). They are indicated with negative values instead.
@@ -129,7 +129,7 @@
*/
#define U_IS_UNICODE_NONCHAR(c) \
((c)>=0xfdd0 && \
- ((c)<=0xfdef || ((c)&0xfffe)==0xfffe) && (c)<=0x10ffff)
+ ((c)<=0xfdef || ((c)&0xfffe)==0xfffe) && (c)<=0x10ffff)
/**
* Is c a Unicode code point value (0..U+10ffff)
@@ -150,7 +150,7 @@
*/
#define U_IS_UNICODE_CHAR(c) \
((uint32_t)(c)<0xd800 || \
- (0xdfff<(c) && (c)<=0x10ffff && !U_IS_UNICODE_NONCHAR(c)))
+ (0xdfff<(c) && (c)<=0x10ffff && !U_IS_UNICODE_NONCHAR(c)))
/**
* Is this code point a BMP code point (U+0000..U+ffff)?
diff --git a/contrib/libs/icu/include/unicode/utf16.h b/contrib/libs/icu/include/unicode/utf16.h
index 8581b166ba..9fd7d5c8a7 100644
--- a/contrib/libs/icu/include/unicode/utf16.h
+++ b/contrib/libs/icu/include/unicode/utf16.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: utf16.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -163,7 +163,7 @@
* @see U16_GET
* @stable ICU 2.4
*/
-#define U16_GET_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_GET_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[i]; \
if(U16_IS_SURROGATE(c)) { \
if(U16_IS_SURROGATE_LEAD(c)) { \
@@ -172,7 +172,7 @@
(c)=U16_GET_SUPPLEMENTARY((s)[(i)-1], (c)); \
} \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Get a code point from a string at a random-access offset,
@@ -185,8 +185,8 @@
*
* The length can be negative for a NUL-terminated string.
*
- * If the offset points to a single, unpaired surrogate, then
- * c is set to that unpaired surrogate.
+ * If the offset points to a single, unpaired surrogate, then
+ * c is set to that unpaired surrogate.
* Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT.
*
* @param s const UChar * string
@@ -197,7 +197,7 @@
* @see U16_GET_UNSAFE
* @stable ICU 2.4
*/
-#define U16_GET(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_GET(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[i]; \
if(U16_IS_SURROGATE(c)) { \
uint16_t __c2; \
@@ -211,51 +211,51 @@
} \
} \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The offset may point to either the lead or trail surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the adjacent matching surrogate as well.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * If the offset points to a single, unpaired surrogate, then
+ * c is set to U+FFFD.
+ * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT_OR_FFFD.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start<=i<length
+ * @param length string length
+ * @param c output UChar32 variable
+ * @see U16_GET_UNSAFE
+ * @stable ICU 60
+ */
+#define U16_GET_OR_FFFD(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
+ (c)=(s)[i]; \
+ if(U16_IS_SURROGATE(c)) { \
+ uint16_t __c2; \
+ if(U16_IS_SURROGATE_LEAD(c)) { \
+ if((i)+1!=(length) && U16_IS_TRAIL(__c2=(s)[(i)+1])) { \
+ (c)=U16_GET_SUPPLEMENTARY((c), __c2); \
+ } else { \
+ (c)=0xfffd; \
+ } \
+ } else { \
+ if((i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
+ (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
+ } else { \
+ (c)=0xfffd; \
+ } \
+ } \
+ } \
+} UPRV_BLOCK_MACRO_END
-/**
- * Get a code point from a string at a random-access offset,
- * without changing the offset.
- * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
- *
- * The offset may point to either the lead or trail surrogate unit
- * for a supplementary code point, in which case the macro will read
- * the adjacent matching surrogate as well.
- *
- * The length can be negative for a NUL-terminated string.
- *
- * If the offset points to a single, unpaired surrogate, then
- * c is set to U+FFFD.
- * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT_OR_FFFD.
- *
- * @param s const UChar * string
- * @param start starting string offset (usually 0)
- * @param i string offset, must be start<=i<length
- * @param length string length
- * @param c output UChar32 variable
- * @see U16_GET_UNSAFE
- * @stable ICU 60
- */
-#define U16_GET_OR_FFFD(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
- (c)=(s)[i]; \
- if(U16_IS_SURROGATE(c)) { \
- uint16_t __c2; \
- if(U16_IS_SURROGATE_LEAD(c)) { \
- if((i)+1!=(length) && U16_IS_TRAIL(__c2=(s)[(i)+1])) { \
- (c)=U16_GET_SUPPLEMENTARY((c), __c2); \
- } else { \
- (c)=0xfffd; \
- } \
- } else { \
- if((i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
- (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
- } else { \
- (c)=0xfffd; \
- } \
- } \
- } \
-} UPRV_BLOCK_MACRO_END
-
/* definitions with forward iteration --------------------------------------- */
/**
@@ -277,12 +277,12 @@
* @see U16_NEXT
* @stable ICU 2.4
*/
-#define U16_NEXT_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_NEXT_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if(U16_IS_LEAD(c)) { \
(c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)++]); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Get a code point from a string at a code point boundary offset,
@@ -296,7 +296,7 @@
* for a supplementary code point, in which case the macro will read
* the following trail surrogate as well.
* If the offset points to a trail surrogate or
- * to a single, unpaired lead surrogate, then c is set to that unpaired surrogate.
+ * to a single, unpaired lead surrogate, then c is set to that unpaired surrogate.
*
* @param s const UChar * string
* @param i string offset, must be i<length
@@ -305,7 +305,7 @@
* @see U16_NEXT_UNSAFE
* @stable ICU 2.4
*/
-#define U16_NEXT(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_NEXT(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if(U16_IS_LEAD(c)) { \
uint16_t __c2; \
@@ -314,43 +314,43 @@
(c)=U16_GET_SUPPLEMENTARY((c), __c2); \
} \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Get a code point from a string at a code point boundary offset,
+ * and advance the offset to the next code point boundary.
+ * (Post-incrementing forward iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * The offset may point to the lead surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the following trail surrogate as well.
+ * If the offset points to a trail surrogate or
+ * to a single, unpaired lead surrogate, then c is set to U+FFFD.
+ *
+ * @param s const UChar * string
+ * @param i string offset, must be i<length
+ * @param length string length
+ * @param c output UChar32 variable
+ * @see U16_NEXT_UNSAFE
+ * @stable ICU 60
+ */
+#define U16_NEXT_OR_FFFD(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
+ (c)=(s)[(i)++]; \
+ if(U16_IS_SURROGATE(c)) { \
+ uint16_t __c2; \
+ if(U16_IS_SURROGATE_LEAD(c) && (i)!=(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \
+ ++(i); \
+ (c)=U16_GET_SUPPLEMENTARY((c), __c2); \
+ } else { \
+ (c)=0xfffd; \
+ } \
+ } \
+} UPRV_BLOCK_MACRO_END
/**
- * Get a code point from a string at a code point boundary offset,
- * and advance the offset to the next code point boundary.
- * (Post-incrementing forward iteration.)
- * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
- *
- * The length can be negative for a NUL-terminated string.
- *
- * The offset may point to the lead surrogate unit
- * for a supplementary code point, in which case the macro will read
- * the following trail surrogate as well.
- * If the offset points to a trail surrogate or
- * to a single, unpaired lead surrogate, then c is set to U+FFFD.
- *
- * @param s const UChar * string
- * @param i string offset, must be i<length
- * @param length string length
- * @param c output UChar32 variable
- * @see U16_NEXT_UNSAFE
- * @stable ICU 60
- */
-#define U16_NEXT_OR_FFFD(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
- (c)=(s)[(i)++]; \
- if(U16_IS_SURROGATE(c)) { \
- uint16_t __c2; \
- if(U16_IS_SURROGATE_LEAD(c) && (i)!=(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \
- ++(i); \
- (c)=U16_GET_SUPPLEMENTARY((c), __c2); \
- } else { \
- (c)=0xfffd; \
- } \
- } \
-} UPRV_BLOCK_MACRO_END
-
-/**
* Append a code point to a string, overwriting 1 or 2 code units.
* The offset points to the current end of the string contents
* and is advanced (post-increment).
@@ -363,14 +363,14 @@
* @see U16_APPEND
* @stable ICU 2.4
*/
-#define U16_APPEND_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_APPEND_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0xffff) { \
(s)[(i)++]=(uint16_t)(c); \
} else { \
(s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \
(s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Append a code point to a string, overwriting 1 or 2 code units.
@@ -389,7 +389,7 @@
* @see U16_APPEND_UNSAFE
* @stable ICU 2.4
*/
-#define U16_APPEND(s, i, capacity, c, isError) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_APPEND(s, i, capacity, c, isError) UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0xffff) { \
(s)[(i)++]=(uint16_t)(c); \
} else if((uint32_t)(c)<=0x10ffff && (i)+1<(capacity)) { \
@@ -398,7 +398,7 @@
} else /* c>0x10ffff or not enough space */ { \
(isError)=TRUE; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Advance the string offset from one code point boundary to the next.
@@ -410,11 +410,11 @@
* @see U16_FWD_1
* @stable ICU 2.4
*/
-#define U16_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
if(U16_IS_LEAD((s)[(i)++])) { \
++(i); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Advance the string offset from one code point boundary to the next.
@@ -429,11 +429,11 @@
* @see U16_FWD_1_UNSAFE
* @stable ICU 2.4
*/
-#define U16_FWD_1(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_FWD_1(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \
if(U16_IS_LEAD((s)[(i)++]) && (i)!=(length) && U16_IS_TRAIL((s)[i])) { \
++(i); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Advance the string offset from one code point boundary to the n-th next one,
@@ -447,13 +447,13 @@
* @see U16_FWD_N
* @stable ICU 2.4
*/
-#define U16_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
U16_FWD_1_UNSAFE(s, i); \
--__N; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Advance the string offset from one code point boundary to the n-th next one,
@@ -470,13 +470,13 @@
* @see U16_FWD_N_UNSAFE
* @stable ICU 2.4
*/
-#define U16_FWD_N(s, i, length, n) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_FWD_N(s, i, length, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0 && ((i)<(length) || ((length)<0 && (s)[i]!=0))) { \
U16_FWD_1(s, i, length); \
--__N; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Adjust a random-access offset to a code point boundary
@@ -491,11 +491,11 @@
* @see U16_SET_CP_START
* @stable ICU 2.4
*/
-#define U16_SET_CP_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_SET_CP_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
if(U16_IS_TRAIL((s)[i])) { \
--(i); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Adjust a random-access offset to a code point boundary
@@ -511,11 +511,11 @@
* @see U16_SET_CP_START_UNSAFE
* @stable ICU 2.4
*/
-#define U16_SET_CP_START(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_SET_CP_START(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
if(U16_IS_TRAIL((s)[i]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \
--(i); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/* definitions with backward iteration -------------------------------------- */
@@ -539,12 +539,12 @@
* @see U16_PREV
* @stable ICU 2.4
*/
-#define U16_PREV_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_PREV_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if(U16_IS_TRAIL(c)) { \
(c)=U16_GET_SUPPLEMENTARY((s)[--(i)], (c)); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the previous one
@@ -557,7 +557,7 @@
* for a supplementary code point, then the macro will read
* the preceding lead surrogate as well.
* If the offset is behind a lead surrogate or behind a single, unpaired
- * trail surrogate, then c is set to that unpaired surrogate.
+ * trail surrogate, then c is set to that unpaired surrogate.
*
* @param s const UChar * string
* @param start starting string offset (usually 0)
@@ -566,7 +566,7 @@
* @see U16_PREV_UNSAFE
* @stable ICU 2.4
*/
-#define U16_PREV(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_PREV(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if(U16_IS_TRAIL(c)) { \
uint16_t __c2; \
@@ -575,42 +575,42 @@
(c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
} \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a trail surrogate unit
+ * for a supplementary code point, then the macro will read
+ * the preceding lead surrogate as well.
+ * If the offset is behind a lead surrogate or behind a single, unpaired
+ * trail surrogate, then c is set to U+FFFD.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start<i
+ * @param c output UChar32 variable
+ * @see U16_PREV_UNSAFE
+ * @stable ICU 60
+ */
+#define U16_PREV_OR_FFFD(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+ (c)=(s)[--(i)]; \
+ if(U16_IS_SURROGATE(c)) { \
+ uint16_t __c2; \
+ if(U16_IS_SURROGATE_TRAIL(c) && (i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
+ --(i); \
+ (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
+ } else { \
+ (c)=0xfffd; \
+ } \
+ } \
+} UPRV_BLOCK_MACRO_END
/**
- * Move the string offset from one code point boundary to the previous one
- * and get the code point between them.
- * (Pre-decrementing backward iteration.)
- * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
- *
- * The input offset may be the same as the string length.
- * If the offset is behind a trail surrogate unit
- * for a supplementary code point, then the macro will read
- * the preceding lead surrogate as well.
- * If the offset is behind a lead surrogate or behind a single, unpaired
- * trail surrogate, then c is set to U+FFFD.
- *
- * @param s const UChar * string
- * @param start starting string offset (usually 0)
- * @param i string offset, must be start<i
- * @param c output UChar32 variable
- * @see U16_PREV_UNSAFE
- * @stable ICU 60
- */
-#define U16_PREV_OR_FFFD(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \
- (c)=(s)[--(i)]; \
- if(U16_IS_SURROGATE(c)) { \
- uint16_t __c2; \
- if(U16_IS_SURROGATE_TRAIL(c) && (i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
- --(i); \
- (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
- } else { \
- (c)=0xfffd; \
- } \
- } \
-} UPRV_BLOCK_MACRO_END
-
-/**
* Move the string offset from one code point boundary to the previous one.
* (Pre-decrementing backward iteration.)
* The input offset may be the same as the string length.
@@ -621,11 +621,11 @@
* @see U16_BACK_1
* @stable ICU 2.4
*/
-#define U16_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
if(U16_IS_TRAIL((s)[--(i)])) { \
--(i); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the previous one.
@@ -639,11 +639,11 @@
* @see U16_BACK_1_UNSAFE
* @stable ICU 2.4
*/
-#define U16_BACK_1(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_BACK_1(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
if(U16_IS_TRAIL((s)[--(i)]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \
--(i); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the n-th one before it,
@@ -658,13 +658,13 @@
* @see U16_BACK_N
* @stable ICU 2.4
*/
-#define U16_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
U16_BACK_1_UNSAFE(s, i); \
--__N; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the n-th one before it,
@@ -680,13 +680,13 @@
* @see U16_BACK_N_UNSAFE
* @stable ICU 2.4
*/
-#define U16_BACK_N(s, start, i, n) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_BACK_N(s, start, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0 && (i)>(start)) { \
U16_BACK_1(s, start, i); \
--__N; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Adjust a random-access offset to a code point boundary after a code point.
@@ -701,11 +701,11 @@
* @see U16_SET_CP_LIMIT
* @stable ICU 2.4
*/
-#define U16_SET_CP_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_SET_CP_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
if(U16_IS_LEAD((s)[(i)-1])) { \
++(i); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Adjust a random-access offset to a code point boundary after a code point.
@@ -724,10 +724,10 @@
* @see U16_SET_CP_LIMIT_UNSAFE
* @stable ICU 2.4
*/
-#define U16_SET_CP_LIMIT(s, start, i, length) UPRV_BLOCK_MACRO_BEGIN { \
+#define U16_SET_CP_LIMIT(s, start, i, length) UPRV_BLOCK_MACRO_BEGIN { \
if((start)<(i) && ((i)<(length) || (length)<0) && U16_IS_LEAD((s)[(i)-1]) && U16_IS_TRAIL((s)[i])) { \
++(i); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
#endif
diff --git a/contrib/libs/icu/include/unicode/utf32.h b/contrib/libs/icu/include/unicode/utf32.h
index ba3e943ce4..8822c4dd09 100644
--- a/contrib/libs/icu/include/unicode/utf32.h
+++ b/contrib/libs/icu/include/unicode/utf32.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: utf32.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/include/unicode/utf8.h b/contrib/libs/icu/include/unicode/utf8.h
index e91647a63d..4987a00e8e 100644
--- a/contrib/libs/icu/include/unicode/utf8.h
+++ b/contrib/libs/icu/include/unicode/utf8.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: utf8.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -43,8 +43,8 @@
/**
* Counts the trail bytes for a UTF-8 lead byte.
- * Returns 0 for 0..0xc1 as well as for 0xf5..0xff.
- * leadByte might be evaluated multiple times.
+ * Returns 0 for 0..0xc1 as well as for 0xf5..0xff.
+ * leadByte might be evaluated multiple times.
*
* This is internal since it is not meant to be called directly by external clients;
* however it is called by public macros in this file and thus must remain stable.
@@ -53,12 +53,12 @@
* @internal
*/
#define U8_COUNT_TRAIL_BYTES(leadByte) \
- (U8_IS_LEAD(leadByte) ? \
- ((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0)+1 : 0)
+ (U8_IS_LEAD(leadByte) ? \
+ ((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0)+1 : 0)
/**
* Counts the trail bytes for a UTF-8 lead byte of a valid UTF-8 sequence.
- * Returns 0 for 0..0xc1. Undefined for 0xf5..0xff.
+ * Returns 0 for 0..0xc1. Undefined for 0xf5..0xff.
* leadByte might be evaluated multiple times.
*
* This is internal since it is not meant to be called directly by external clients;
@@ -68,7 +68,7 @@
* @internal
*/
#define U8_COUNT_TRAIL_BYTES_UNSAFE(leadByte) \
- (((uint8_t)(leadByte)>=0xc2)+((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0))
+ (((uint8_t)(leadByte)>=0xc2)+((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0))
/**
* Mask a UTF-8 lead byte, leave only the lower bits that form part of the code point value.
@@ -80,40 +80,40 @@
#define U8_MASK_LEAD_BYTE(leadByte, countTrailBytes) ((leadByte)&=(1<<(6-(countTrailBytes)))-1)
/**
- * Internal bit vector for 3-byte UTF-8 validity check, for use in U8_IS_VALID_LEAD3_AND_T1.
- * Each bit indicates whether one lead byte + first trail byte pair starts a valid sequence.
- * Lead byte E0..EF bits 3..0 are used as byte index,
- * first trail byte bits 7..5 are used as bit index into that byte.
- * @see U8_IS_VALID_LEAD3_AND_T1
- * @internal
- */
-#define U8_LEAD3_T1_BITS "\x20\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x10\x30\x30"
-
-/**
- * Internal 3-byte UTF-8 validity check.
- * Non-zero if lead byte E0..EF and first trail byte 00..FF start a valid sequence.
- * @internal
- */
-#define U8_IS_VALID_LEAD3_AND_T1(lead, t1) (U8_LEAD3_T1_BITS[(lead)&0xf]&(1<<((uint8_t)(t1)>>5)))
-
-/**
- * Internal bit vector for 4-byte UTF-8 validity check, for use in U8_IS_VALID_LEAD4_AND_T1.
- * Each bit indicates whether one lead byte + first trail byte pair starts a valid sequence.
- * First trail byte bits 7..4 are used as byte index,
- * lead byte F0..F4 bits 2..0 are used as bit index into that byte.
- * @see U8_IS_VALID_LEAD4_AND_T1
- * @internal
- */
-#define U8_LEAD4_T1_BITS "\x00\x00\x00\x00\x00\x00\x00\x00\x1E\x0F\x0F\x0F\x00\x00\x00\x00"
-
-/**
- * Internal 4-byte UTF-8 validity check.
- * Non-zero if lead byte F0..F4 and first trail byte 00..FF start a valid sequence.
- * @internal
- */
-#define U8_IS_VALID_LEAD4_AND_T1(lead, t1) (U8_LEAD4_T1_BITS[(uint8_t)(t1)>>4]&(1<<((lead)&7)))
-
-/**
+ * Internal bit vector for 3-byte UTF-8 validity check, for use in U8_IS_VALID_LEAD3_AND_T1.
+ * Each bit indicates whether one lead byte + first trail byte pair starts a valid sequence.
+ * Lead byte E0..EF bits 3..0 are used as byte index,
+ * first trail byte bits 7..5 are used as bit index into that byte.
+ * @see U8_IS_VALID_LEAD3_AND_T1
+ * @internal
+ */
+#define U8_LEAD3_T1_BITS "\x20\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x10\x30\x30"
+
+/**
+ * Internal 3-byte UTF-8 validity check.
+ * Non-zero if lead byte E0..EF and first trail byte 00..FF start a valid sequence.
+ * @internal
+ */
+#define U8_IS_VALID_LEAD3_AND_T1(lead, t1) (U8_LEAD3_T1_BITS[(lead)&0xf]&(1<<((uint8_t)(t1)>>5)))
+
+/**
+ * Internal bit vector for 4-byte UTF-8 validity check, for use in U8_IS_VALID_LEAD4_AND_T1.
+ * Each bit indicates whether one lead byte + first trail byte pair starts a valid sequence.
+ * First trail byte bits 7..4 are used as byte index,
+ * lead byte F0..F4 bits 2..0 are used as bit index into that byte.
+ * @see U8_IS_VALID_LEAD4_AND_T1
+ * @internal
+ */
+#define U8_LEAD4_T1_BITS "\x00\x00\x00\x00\x00\x00\x00\x00\x1E\x0F\x0F\x0F\x00\x00\x00\x00"
+
+/**
+ * Internal 4-byte UTF-8 validity check.
+ * Non-zero if lead byte F0..F4 and first trail byte 00..FF start a valid sequence.
+ * @internal
+ */
+#define U8_IS_VALID_LEAD4_AND_T1(lead, t1) (U8_LEAD4_T1_BITS[(uint8_t)(t1)>>4]&(1<<((lead)&7)))
+
+/**
* Function for handling "next code point" with error-checking.
*
* This is internal since it is not meant to be called directly by external clients;
@@ -172,21 +172,21 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
#define U8_IS_SINGLE(c) (((c)&0x80)==0)
/**
- * Is this code unit (byte) a UTF-8 lead byte? (0xC2..0xF4)
+ * Is this code unit (byte) a UTF-8 lead byte? (0xC2..0xF4)
* @param c 8-bit code unit (byte)
* @return TRUE or FALSE
* @stable ICU 2.4
*/
-#define U8_IS_LEAD(c) ((uint8_t)((c)-0xc2)<=0x32)
-// 0x32=0xf4-0xc2
+#define U8_IS_LEAD(c) ((uint8_t)((c)-0xc2)<=0x32)
+// 0x32=0xf4-0xc2
/**
- * Is this code unit (byte) a UTF-8 trail byte? (0x80..0xBF)
+ * Is this code unit (byte) a UTF-8 trail byte? (0x80..0xBF)
* @param c 8-bit code unit (byte)
* @return TRUE or FALSE
* @stable ICU 2.4
*/
-#define U8_IS_TRAIL(c) ((int8_t)(c)<-0x40)
+#define U8_IS_TRAIL(c) ((int8_t)(c)<-0x40)
/**
* How many code units (bytes) are used for the UTF-8 encoding
@@ -229,11 +229,11 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_GET
* @stable ICU 2.4
*/
-#define U8_GET_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define U8_GET_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
int32_t _u8_get_unsafe_index=(int32_t)(i); \
U8_SET_CP_START_UNSAFE(s, _u8_get_unsafe_index); \
U8_NEXT_UNSAFE(s, _u8_get_unsafe_index, c); \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Get a code point from a string at a random-access offset,
@@ -256,11 +256,11 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_GET_UNSAFE
* @stable ICU 2.4
*/
-#define U8_GET(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define U8_GET(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
int32_t _u8_get_index=(i); \
U8_SET_CP_START(s, start, _u8_get_index); \
U8_NEXT(s, _u8_get_index, length, c); \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Get a code point from a string at a random-access offset,
@@ -287,11 +287,11 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_GET
* @stable ICU 51
*/
-#define U8_GET_OR_FFFD(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define U8_GET_OR_FFFD(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
int32_t _u8_get_index=(i); \
U8_SET_CP_START(s, start, _u8_get_index); \
U8_NEXT_OR_FFFD(s, _u8_get_index, length, c); \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/* definitions with forward iteration --------------------------------------- */
@@ -312,9 +312,9 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_NEXT
* @stable ICU 2.4
*/
-#define U8_NEXT_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define U8_NEXT_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(uint8_t)(s)[(i)++]; \
- if(!U8_IS_SINGLE(c)) { \
+ if(!U8_IS_SINGLE(c)) { \
if((c)<0xe0) { \
(c)=(((c)&0x1f)<<6)|((s)[(i)++]&0x3f); \
} else if((c)<0xf0) { \
@@ -326,7 +326,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
(i)+=3; \
} \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Get a code point from a string at a code point boundary offset,
@@ -348,7 +348,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_NEXT_UNSAFE
* @stable ICU 2.4
*/
-#define U8_NEXT(s, i, length, c) U8_INTERNAL_NEXT_OR_SUB(s, i, length, c, U_SENTINEL)
+#define U8_NEXT(s, i, length, c) U8_INTERNAL_NEXT_OR_SUB(s, i, length, c, U_SENTINEL)
/**
* Get a code point from a string at a code point boundary offset,
@@ -374,36 +374,36 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_NEXT
* @stable ICU 51
*/
-#define U8_NEXT_OR_FFFD(s, i, length, c) U8_INTERNAL_NEXT_OR_SUB(s, i, length, c, 0xfffd)
-
-/** @internal */
-#define U8_INTERNAL_NEXT_OR_SUB(s, i, length, c, sub) UPRV_BLOCK_MACRO_BEGIN { \
+#define U8_NEXT_OR_FFFD(s, i, length, c) U8_INTERNAL_NEXT_OR_SUB(s, i, length, c, 0xfffd)
+
+/** @internal */
+#define U8_INTERNAL_NEXT_OR_SUB(s, i, length, c, sub) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(uint8_t)(s)[(i)++]; \
- if(!U8_IS_SINGLE(c)) { \
- uint8_t __t = 0; \
- if((i)!=(length) && \
- /* fetch/validate/assemble all but last trail byte */ \
- ((c)>=0xe0 ? \
- ((c)<0xf0 ? /* U+0800..U+FFFF except surrogates */ \
- U8_LEAD3_T1_BITS[(c)&=0xf]&(1<<((__t=(s)[i])>>5)) && \
- (__t&=0x3f, 1) \
- : /* U+10000..U+10FFFF */ \
- ((c)-=0xf0)<=4 && \
- U8_LEAD4_T1_BITS[(__t=(s)[i])>>4]&(1<<(c)) && \
- ((c)=((c)<<6)|(__t&0x3f), ++(i)!=(length)) && \
- (__t=(s)[i]-0x80)<=0x3f) && \
- /* valid second-to-last trail byte */ \
- ((c)=((c)<<6)|__t, ++(i)!=(length)) \
- : /* U+0080..U+07FF */ \
- (c)>=0xc2 && ((c)&=0x1f, 1)) && \
- /* last trail byte */ \
- (__t=(s)[i]-0x80)<=0x3f && \
- ((c)=((c)<<6)|__t, ++(i), 1)) { \
+ if(!U8_IS_SINGLE(c)) { \
+ uint8_t __t = 0; \
+ if((i)!=(length) && \
+ /* fetch/validate/assemble all but last trail byte */ \
+ ((c)>=0xe0 ? \
+ ((c)<0xf0 ? /* U+0800..U+FFFF except surrogates */ \
+ U8_LEAD3_T1_BITS[(c)&=0xf]&(1<<((__t=(s)[i])>>5)) && \
+ (__t&=0x3f, 1) \
+ : /* U+10000..U+10FFFF */ \
+ ((c)-=0xf0)<=4 && \
+ U8_LEAD4_T1_BITS[(__t=(s)[i])>>4]&(1<<(c)) && \
+ ((c)=((c)<<6)|(__t&0x3f), ++(i)!=(length)) && \
+ (__t=(s)[i]-0x80)<=0x3f) && \
+ /* valid second-to-last trail byte */ \
+ ((c)=((c)<<6)|__t, ++(i)!=(length)) \
+ : /* U+0080..U+07FF */ \
+ (c)>=0xc2 && ((c)&=0x1f, 1)) && \
+ /* last trail byte */ \
+ (__t=(s)[i]-0x80)<=0x3f && \
+ ((c)=((c)<<6)|__t, ++(i), 1)) { \
} else { \
- (c)=(sub); /* ill-formed*/ \
+ (c)=(sub); /* ill-formed*/ \
} \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Append a code point to a string, overwriting 1 to 4 bytes.
@@ -418,25 +418,25 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_APPEND
* @stable ICU 2.4
*/
-#define U8_APPEND_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
- uint32_t __uc=(c); \
- if(__uc<=0x7f) { \
- (s)[(i)++]=(uint8_t)__uc; \
+#define U8_APPEND_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+ uint32_t __uc=(c); \
+ if(__uc<=0x7f) { \
+ (s)[(i)++]=(uint8_t)__uc; \
} else { \
- if(__uc<=0x7ff) { \
- (s)[(i)++]=(uint8_t)((__uc>>6)|0xc0); \
+ if(__uc<=0x7ff) { \
+ (s)[(i)++]=(uint8_t)((__uc>>6)|0xc0); \
} else { \
- if(__uc<=0xffff) { \
- (s)[(i)++]=(uint8_t)((__uc>>12)|0xe0); \
+ if(__uc<=0xffff) { \
+ (s)[(i)++]=(uint8_t)((__uc>>12)|0xe0); \
} else { \
- (s)[(i)++]=(uint8_t)((__uc>>18)|0xf0); \
- (s)[(i)++]=(uint8_t)(((__uc>>12)&0x3f)|0x80); \
+ (s)[(i)++]=(uint8_t)((__uc>>18)|0xf0); \
+ (s)[(i)++]=(uint8_t)(((__uc>>12)&0x3f)|0x80); \
} \
- (s)[(i)++]=(uint8_t)(((__uc>>6)&0x3f)|0x80); \
+ (s)[(i)++]=(uint8_t)(((__uc>>6)&0x3f)|0x80); \
} \
- (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \
+ (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Append a code point to a string, overwriting 1 to 4 bytes.
@@ -455,26 +455,26 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_APPEND_UNSAFE
* @stable ICU 2.4
*/
-#define U8_APPEND(s, i, capacity, c, isError) UPRV_BLOCK_MACRO_BEGIN { \
- uint32_t __uc=(c); \
- if(__uc<=0x7f) { \
- (s)[(i)++]=(uint8_t)__uc; \
- } else if(__uc<=0x7ff && (i)+1<(capacity)) { \
- (s)[(i)++]=(uint8_t)((__uc>>6)|0xc0); \
- (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \
- } else if((__uc<=0xd7ff || (0xe000<=__uc && __uc<=0xffff)) && (i)+2<(capacity)) { \
- (s)[(i)++]=(uint8_t)((__uc>>12)|0xe0); \
- (s)[(i)++]=(uint8_t)(((__uc>>6)&0x3f)|0x80); \
- (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \
- } else if(0xffff<__uc && __uc<=0x10ffff && (i)+3<(capacity)) { \
- (s)[(i)++]=(uint8_t)((__uc>>18)|0xf0); \
- (s)[(i)++]=(uint8_t)(((__uc>>12)&0x3f)|0x80); \
- (s)[(i)++]=(uint8_t)(((__uc>>6)&0x3f)|0x80); \
- (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \
+#define U8_APPEND(s, i, capacity, c, isError) UPRV_BLOCK_MACRO_BEGIN { \
+ uint32_t __uc=(c); \
+ if(__uc<=0x7f) { \
+ (s)[(i)++]=(uint8_t)__uc; \
+ } else if(__uc<=0x7ff && (i)+1<(capacity)) { \
+ (s)[(i)++]=(uint8_t)((__uc>>6)|0xc0); \
+ (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \
+ } else if((__uc<=0xd7ff || (0xe000<=__uc && __uc<=0xffff)) && (i)+2<(capacity)) { \
+ (s)[(i)++]=(uint8_t)((__uc>>12)|0xe0); \
+ (s)[(i)++]=(uint8_t)(((__uc>>6)&0x3f)|0x80); \
+ (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \
+ } else if(0xffff<__uc && __uc<=0x10ffff && (i)+3<(capacity)) { \
+ (s)[(i)++]=(uint8_t)((__uc>>18)|0xf0); \
+ (s)[(i)++]=(uint8_t)(((__uc>>12)&0x3f)|0x80); \
+ (s)[(i)++]=(uint8_t)(((__uc>>6)&0x3f)|0x80); \
+ (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \
} else { \
- (isError)=TRUE; \
+ (isError)=TRUE; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Advance the string offset from one code point boundary to the next.
@@ -486,9 +486,9 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_FWD_1
* @stable ICU 2.4
*/
-#define U8_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
- (i)+=1+U8_COUNT_TRAIL_BYTES_UNSAFE((s)[i]); \
-} UPRV_BLOCK_MACRO_END
+#define U8_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+ (i)+=1+U8_COUNT_TRAIL_BYTES_UNSAFE((s)[i]); \
+} UPRV_BLOCK_MACRO_END
/**
* Advance the string offset from one code point boundary to the next.
@@ -503,28 +503,28 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_FWD_1_UNSAFE
* @stable ICU 2.4
*/
-#define U8_FWD_1(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \
- uint8_t __b=(s)[(i)++]; \
- if(U8_IS_LEAD(__b) && (i)!=(length)) { \
- uint8_t __t1=(s)[i]; \
- if((0xe0<=__b && __b<0xf0)) { \
- if(U8_IS_VALID_LEAD3_AND_T1(__b, __t1) && \
- ++(i)!=(length) && U8_IS_TRAIL((s)[i])) { \
- ++(i); \
- } \
- } else if(__b<0xe0) { \
- if(U8_IS_TRAIL(__t1)) { \
- ++(i); \
- } \
- } else /* c>=0xf0 */ { \
- if(U8_IS_VALID_LEAD4_AND_T1(__b, __t1) && \
- ++(i)!=(length) && U8_IS_TRAIL((s)[i]) && \
- ++(i)!=(length) && U8_IS_TRAIL((s)[i])) { \
- ++(i); \
- } \
+#define U8_FWD_1(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \
+ uint8_t __b=(s)[(i)++]; \
+ if(U8_IS_LEAD(__b) && (i)!=(length)) { \
+ uint8_t __t1=(s)[i]; \
+ if((0xe0<=__b && __b<0xf0)) { \
+ if(U8_IS_VALID_LEAD3_AND_T1(__b, __t1) && \
+ ++(i)!=(length) && U8_IS_TRAIL((s)[i])) { \
+ ++(i); \
+ } \
+ } else if(__b<0xe0) { \
+ if(U8_IS_TRAIL(__t1)) { \
+ ++(i); \
+ } \
+ } else /* c>=0xf0 */ { \
+ if(U8_IS_VALID_LEAD4_AND_T1(__b, __t1) && \
+ ++(i)!=(length) && U8_IS_TRAIL((s)[i]) && \
+ ++(i)!=(length) && U8_IS_TRAIL((s)[i])) { \
+ ++(i); \
+ } \
} \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Advance the string offset from one code point boundary to the n-th next one,
@@ -538,13 +538,13 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_FWD_N
* @stable ICU 2.4
*/
-#define U8_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
+#define U8_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
U8_FWD_1_UNSAFE(s, i); \
--__N; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Advance the string offset from one code point boundary to the n-th next one,
@@ -561,13 +561,13 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_FWD_N_UNSAFE
* @stable ICU 2.4
*/
-#define U8_FWD_N(s, i, length, n) UPRV_BLOCK_MACRO_BEGIN { \
+#define U8_FWD_N(s, i, length, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0 && ((i)<(length) || ((length)<0 && (s)[i]!=0))) { \
U8_FWD_1(s, i, length); \
--__N; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Adjust a random-access offset to a code point boundary
@@ -582,9 +582,9 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_SET_CP_START
* @stable ICU 2.4
*/
-#define U8_SET_CP_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define U8_SET_CP_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
while(U8_IS_TRAIL((s)[i])) { --(i); } \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Adjust a random-access offset to a code point boundary
@@ -592,73 +592,73 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* If the offset points to a UTF-8 trail byte,
* then the offset is moved backward to the corresponding lead byte.
* Otherwise, it is not modified.
- *
+ *
* "Safe" macro, checks for illegal sequences and for string boundaries.
- * Unlike U8_TRUNCATE_IF_INCOMPLETE(), this macro always reads s[i].
+ * Unlike U8_TRUNCATE_IF_INCOMPLETE(), this macro always reads s[i].
*
* @param s const uint8_t * string
* @param start int32_t starting string offset (usually 0)
* @param i int32_t string offset, must be start<=i
* @see U8_SET_CP_START_UNSAFE
- * @see U8_TRUNCATE_IF_INCOMPLETE
+ * @see U8_TRUNCATE_IF_INCOMPLETE
* @stable ICU 2.4
*/
-#define U8_SET_CP_START(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define U8_SET_CP_START(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
if(U8_IS_TRAIL((s)[(i)])) { \
(i)=utf8_back1SafeBody(s, start, (i)); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * If the string ends with a UTF-8 byte sequence that is valid so far
+ * but incomplete, then reduce the length of the string to end before
+ * the lead byte of that incomplete sequence.
+ * For example, if the string ends with E1 80, the length is reduced by 2.
+ *
+ * In all other cases (the string ends with a complete sequence, or it is not
+ * possible for any further trail byte to extend the trailing sequence)
+ * the length remains unchanged.
+ *
+ * Useful for processing text split across multiple buffers
+ * (save the incomplete sequence for later)
+ * and for optimizing iteration
+ * (check for string length only once per character).
+ *
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ * Unlike U8_SET_CP_START(), this macro never reads s[length].
+ *
+ * (In UTF-16, simply check for U16_IS_LEAD(last code unit).)
+ *
+ * @param s const uint8_t * string
+ * @param start int32_t starting string offset (usually 0)
+ * @param length int32_t string length (usually start<=length)
+ * @see U8_SET_CP_START
+ * @stable ICU 61
+ */
+#define U8_TRUNCATE_IF_INCOMPLETE(s, start, length) UPRV_BLOCK_MACRO_BEGIN { \
+ if((length)>(start)) { \
+ uint8_t __b1=s[(length)-1]; \
+ if(U8_IS_SINGLE(__b1)) { \
+ /* common ASCII character */ \
+ } else if(U8_IS_LEAD(__b1)) { \
+ --(length); \
+ } else if(U8_IS_TRAIL(__b1) && ((length)-2)>=(start)) { \
+ uint8_t __b2=s[(length)-2]; \
+ if(0xe0<=__b2 && __b2<=0xf4) { \
+ if(__b2<0xf0 ? U8_IS_VALID_LEAD3_AND_T1(__b2, __b1) : \
+ U8_IS_VALID_LEAD4_AND_T1(__b2, __b1)) { \
+ (length)-=2; \
+ } \
+ } else if(U8_IS_TRAIL(__b2) && ((length)-3)>=(start)) { \
+ uint8_t __b3=s[(length)-3]; \
+ if(0xf0<=__b3 && __b3<=0xf4 && U8_IS_VALID_LEAD4_AND_T1(__b3, __b2)) { \
+ (length)-=3; \
+ } \
+ } \
+ } \
+ } \
+} UPRV_BLOCK_MACRO_END
-/**
- * If the string ends with a UTF-8 byte sequence that is valid so far
- * but incomplete, then reduce the length of the string to end before
- * the lead byte of that incomplete sequence.
- * For example, if the string ends with E1 80, the length is reduced by 2.
- *
- * In all other cases (the string ends with a complete sequence, or it is not
- * possible for any further trail byte to extend the trailing sequence)
- * the length remains unchanged.
- *
- * Useful for processing text split across multiple buffers
- * (save the incomplete sequence for later)
- * and for optimizing iteration
- * (check for string length only once per character).
- *
- * "Safe" macro, checks for illegal sequences and for string boundaries.
- * Unlike U8_SET_CP_START(), this macro never reads s[length].
- *
- * (In UTF-16, simply check for U16_IS_LEAD(last code unit).)
- *
- * @param s const uint8_t * string
- * @param start int32_t starting string offset (usually 0)
- * @param length int32_t string length (usually start<=length)
- * @see U8_SET_CP_START
- * @stable ICU 61
- */
-#define U8_TRUNCATE_IF_INCOMPLETE(s, start, length) UPRV_BLOCK_MACRO_BEGIN { \
- if((length)>(start)) { \
- uint8_t __b1=s[(length)-1]; \
- if(U8_IS_SINGLE(__b1)) { \
- /* common ASCII character */ \
- } else if(U8_IS_LEAD(__b1)) { \
- --(length); \
- } else if(U8_IS_TRAIL(__b1) && ((length)-2)>=(start)) { \
- uint8_t __b2=s[(length)-2]; \
- if(0xe0<=__b2 && __b2<=0xf4) { \
- if(__b2<0xf0 ? U8_IS_VALID_LEAD3_AND_T1(__b2, __b1) : \
- U8_IS_VALID_LEAD4_AND_T1(__b2, __b1)) { \
- (length)-=2; \
- } \
- } else if(U8_IS_TRAIL(__b2) && ((length)-3)>=(start)) { \
- uint8_t __b3=s[(length)-3]; \
- if(0xf0<=__b3 && __b3<=0xf4 && U8_IS_VALID_LEAD4_AND_T1(__b3, __b2)) { \
- (length)-=3; \
- } \
- } \
- } \
- } \
-} UPRV_BLOCK_MACRO_END
-
/* definitions with backward iteration -------------------------------------- */
/**
@@ -680,7 +680,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_PREV
* @stable ICU 2.4
*/
-#define U8_PREV_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define U8_PREV_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(uint8_t)(s)[--(i)]; \
if(U8_IS_TRAIL(c)) { \
uint8_t __b, __count=1, __shift=6; \
@@ -688,7 +688,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
/* c is a trail byte */ \
(c)&=0x3f; \
for(;;) { \
- __b=(s)[--(i)]; \
+ __b=(s)[--(i)]; \
if(__b>=0xc0) { \
U8_MASK_LEAD_BYTE(__b, __count); \
(c)|=(UChar32)__b<<__shift; \
@@ -700,7 +700,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
} \
} \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the previous one
@@ -722,12 +722,12 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_PREV_UNSAFE
* @stable ICU 2.4
*/
-#define U8_PREV(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define U8_PREV(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(uint8_t)(s)[--(i)]; \
- if(!U8_IS_SINGLE(c)) { \
+ if(!U8_IS_SINGLE(c)) { \
(c)=utf8_prevCharSafeBody((const uint8_t *)s, start, &(i), c, -1); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the previous one
@@ -753,12 +753,12 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_PREV
* @stable ICU 51
*/
-#define U8_PREV_OR_FFFD(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define U8_PREV_OR_FFFD(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(uint8_t)(s)[--(i)]; \
- if(!U8_IS_SINGLE(c)) { \
+ if(!U8_IS_SINGLE(c)) { \
(c)=utf8_prevCharSafeBody((const uint8_t *)s, start, &(i), c, -3); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the previous one.
@@ -771,9 +771,9 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_BACK_1
* @stable ICU 2.4
*/
-#define U8_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define U8_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
while(U8_IS_TRAIL((s)[--(i)])) {} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the previous one.
@@ -787,11 +787,11 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_BACK_1_UNSAFE
* @stable ICU 2.4
*/
-#define U8_BACK_1(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define U8_BACK_1(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
if(U8_IS_TRAIL((s)[--(i)])) { \
(i)=utf8_back1SafeBody(s, start, (i)); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the n-th one before it,
@@ -806,13 +806,13 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_BACK_N
* @stable ICU 2.4
*/
-#define U8_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
+#define U8_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
U8_BACK_1_UNSAFE(s, i); \
--__N; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the n-th one before it,
@@ -828,13 +828,13 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_BACK_N_UNSAFE
* @stable ICU 2.4
*/
-#define U8_BACK_N(s, start, i, n) UPRV_BLOCK_MACRO_BEGIN { \
+#define U8_BACK_N(s, start, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0 && (i)>(start)) { \
U8_BACK_1(s, start, i); \
--__N; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Adjust a random-access offset to a code point boundary after a code point.
@@ -849,10 +849,10 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_SET_CP_LIMIT
* @stable ICU 2.4
*/
-#define U8_SET_CP_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define U8_SET_CP_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
U8_BACK_1_UNSAFE(s, i); \
U8_FWD_1_UNSAFE(s, i); \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/**
* Adjust a random-access offset to a code point boundary after a code point.
@@ -871,11 +871,11 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_SET_CP_LIMIT_UNSAFE
* @stable ICU 2.4
*/
-#define U8_SET_CP_LIMIT(s, start, i, length) UPRV_BLOCK_MACRO_BEGIN { \
+#define U8_SET_CP_LIMIT(s, start, i, length) UPRV_BLOCK_MACRO_BEGIN { \
if((start)<(i) && ((i)<(length) || (length)<0)) { \
U8_BACK_1(s, start, i); \
U8_FWD_1(s, i, length); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
#endif
diff --git a/contrib/libs/icu/include/unicode/utf_old.h b/contrib/libs/icu/include/unicode/utf_old.h
index 9d08c3a1f3..b2428e6b31 100644
--- a/contrib/libs/icu/include/unicode/utf_old.h
+++ b/contrib/libs/icu/include/unicode/utf_old.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: utf_old.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -17,9 +17,9 @@
*/
/**
- * \file
+ * \file
* \brief C API: Deprecated macros for Unicode string handling
- *
+ *
* The macros in utf_old.h are all deprecated and their use discouraged.
* Some of the design principles behind the set of UTF macros
* have changed or proved impractical.
@@ -136,7 +136,7 @@
*
* <hr>
*
- * Deprecated ICU 2.4. Use the macros in utf.h, utf16.h, utf8.h instead.
+ * Deprecated ICU 2.4. Use the macros in utf.h, utf16.h, utf8.h instead.
*/
#ifndef __UTF_OLD_H__
@@ -146,23 +146,23 @@
#include "unicode/utf8.h"
#include "unicode/utf16.h"
-/**
- * \def U_HIDE_OBSOLETE_UTF_OLD_H
- *
- * Hides the obsolete definitions in unicode/utf_old.h.
- * Recommended to be set to 1 at compile time to make sure
- * the long-deprecated macros are no longer used.
- *
- * For reasons for the deprecation see the utf_old.h file comments.
- *
- * @internal
- */
-#ifndef U_HIDE_OBSOLETE_UTF_OLD_H
-# define U_HIDE_OBSOLETE_UTF_OLD_H 0
-#endif
-
-#if !defined(U_HIDE_DEPRECATED_API) && !U_HIDE_OBSOLETE_UTF_OLD_H
-
+/**
+ * \def U_HIDE_OBSOLETE_UTF_OLD_H
+ *
+ * Hides the obsolete definitions in unicode/utf_old.h.
+ * Recommended to be set to 1 at compile time to make sure
+ * the long-deprecated macros are no longer used.
+ *
+ * For reasons for the deprecation see the utf_old.h file comments.
+ *
+ * @internal
+ */
+#ifndef U_HIDE_OBSOLETE_UTF_OLD_H
+# define U_HIDE_OBSOLETE_UTF_OLD_H 0
+#endif
+
+#if !defined(U_HIDE_DEPRECATED_API) && !U_HIDE_OBSOLETE_UTF_OLD_H
+
/* Formerly utf.h, part 1 --------------------------------------------------- */
#ifdef U_USE_UTF_DEPRECATES
@@ -280,25 +280,25 @@ typedef int32_t UTextOffset;
/* Formerly utf8.h ---------------------------------------------------------- */
/**
-* \var utf8_countTrailBytes
-* Internal array with numbers of trail bytes for any given byte used in
-* lead byte position.
-*
-* This is internal since it is not meant to be called directly by external clients;
-* however it is called by public macros in this file and thus must remain stable,
-* and should not be hidden when other internal functions are hidden (otherwise
-* public macros would fail to compile).
-* @internal
-*/
-#ifdef U_UTF8_IMPL
-// No forward declaration if compiling utf_impl.cpp, which defines utf8_countTrailBytes.
-#elif defined(U_STATIC_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION)
-U_CFUNC const uint8_t utf8_countTrailBytes[];
-#else
-U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_IMPORT*/
-#endif
-
-/**
+* \var utf8_countTrailBytes
+* Internal array with numbers of trail bytes for any given byte used in
+* lead byte position.
+*
+* This is internal since it is not meant to be called directly by external clients;
+* however it is called by public macros in this file and thus must remain stable,
+* and should not be hidden when other internal functions are hidden (otherwise
+* public macros would fail to compile).
+* @internal
+*/
+#ifdef U_UTF8_IMPL
+// No forward declaration if compiling utf_impl.cpp, which defines utf8_countTrailBytes.
+#elif defined(U_STATIC_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION)
+U_CFUNC const uint8_t utf8_countTrailBytes[];
+#else
+U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_IMPORT*/
+#endif
+
+/**
* Count the trail bytes for a UTF-8 lead byte.
* @deprecated ICU 2.4. Renamed to U8_COUNT_TRAIL_BYTES, see utf_old.h.
*/
@@ -362,21 +362,21 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
#define UTF8_ARRAY_SIZE(size) ((5*(size))/2)
/** @deprecated ICU 2.4. Renamed to U8_GET_UNSAFE, see utf_old.h. */
-#define UTF8_GET_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF8_GET_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
int32_t _utf8_get_char_unsafe_index=(int32_t)(i); \
UTF8_SET_CHAR_START_UNSAFE(s, _utf8_get_char_unsafe_index); \
UTF8_NEXT_CHAR_UNSAFE(s, _utf8_get_char_unsafe_index, c); \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Use U8_GET instead, see utf_old.h. */
-#define UTF8_GET_CHAR_SAFE(s, start, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF8_GET_CHAR_SAFE(s, start, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
int32_t _utf8_get_char_safe_index=(int32_t)(i); \
UTF8_SET_CHAR_START_SAFE(s, start, _utf8_get_char_safe_index); \
UTF8_NEXT_CHAR_SAFE(s, _utf8_get_char_safe_index, length, c, strict); \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_NEXT_UNSAFE, see utf_old.h. */
-#define UTF8_NEXT_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF8_NEXT_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if((uint8_t)((c)-0xc0)<0x35) { \
uint8_t __count=UTF8_COUNT_TRAIL_BYTES(c); \
@@ -393,10 +393,10 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
break; \
} \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_APPEND_UNSAFE, see utf_old.h. */
-#define UTF8_APPEND_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF8_APPEND_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0x7f) { \
(s)[(i)++]=(uint8_t)(c); \
} else { \
@@ -413,29 +413,29 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
} \
(s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_FWD_1_UNSAFE, see utf_old.h. */
-#define UTF8_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF8_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
(i)+=1+UTF8_COUNT_TRAIL_BYTES((s)[i]); \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_FWD_N_UNSAFE, see utf_old.h. */
-#define UTF8_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF8_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
UTF8_FWD_1_UNSAFE(s, i); \
--__N; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_SET_CP_START_UNSAFE, see utf_old.h. */
-#define UTF8_SET_CHAR_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF8_SET_CHAR_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
while(UTF8_IS_TRAIL((s)[i])) { --(i); } \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Use U8_NEXT instead, see utf_old.h. */
-#define UTF8_NEXT_CHAR_SAFE(s, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF8_NEXT_CHAR_SAFE(s, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if((c)>=0x80) { \
if(UTF8_IS_LEAD(c)) { \
@@ -444,16 +444,16 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
(c)=UTF8_ERROR_VALUE_1; \
} \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Use U8_APPEND instead, see utf_old.h. */
-#define UTF8_APPEND_CHAR_SAFE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF8_APPEND_CHAR_SAFE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0x7f) { \
(s)[(i)++]=(uint8_t)(c); \
} else { \
(i)=utf8_appendCharSafeBody(s, (int32_t)(i), (int32_t)(length), c, NULL); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_FWD_1, see utf_old.h. */
#define UTF8_FWD_1_SAFE(s, i, length) U8_FWD_1(s, i, length)
@@ -465,7 +465,7 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
#define UTF8_SET_CHAR_START_SAFE(s, start, i) U8_SET_CP_START(s, start, i)
/** @deprecated ICU 2.4. Renamed to U8_PREV_UNSAFE, see utf_old.h. */
-#define UTF8_PREV_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF8_PREV_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if(UTF8_IS_TRAIL(c)) { \
uint8_t __b, __count=1, __shift=6; \
@@ -485,30 +485,30 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
} \
} \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_BACK_1_UNSAFE, see utf_old.h. */
-#define UTF8_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF8_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
while(UTF8_IS_TRAIL((s)[--(i)])) {} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_BACK_N_UNSAFE, see utf_old.h. */
-#define UTF8_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF8_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
UTF8_BACK_1_UNSAFE(s, i); \
--__N; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_SET_CP_LIMIT_UNSAFE, see utf_old.h. */
-#define UTF8_SET_CHAR_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF8_SET_CHAR_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
UTF8_BACK_1_UNSAFE(s, i); \
UTF8_FWD_1_UNSAFE(s, i); \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Use U8_PREV instead, see utf_old.h. */
-#define UTF8_PREV_CHAR_SAFE(s, start, i, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF8_PREV_CHAR_SAFE(s, start, i, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if((c)>=0x80) { \
if((c)<=0xbf) { \
@@ -517,7 +517,7 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
(c)=UTF8_ERROR_VALUE_1; \
} \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_BACK_1, see utf_old.h. */
#define UTF8_BACK_1_SAFE(s, start, i) U8_BACK_1(s, start, i)
@@ -590,7 +590,7 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
* UTF16_PREV_CHAR[_UNSAFE]() is more efficient for that.
* @deprecated ICU 2.4. Renamed to U16_GET_UNSAFE, see utf_old.h.
*/
-#define UTF16_GET_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF16_GET_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[i]; \
if(UTF_IS_SURROGATE(c)) { \
if(UTF_IS_SURROGATE_FIRST(c)) { \
@@ -599,10 +599,10 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
(c)=UTF16_GET_PAIR_VALUE((s)[(i)-1], (c)); \
} \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Use U16_GET instead, see utf_old.h. */
-#define UTF16_GET_CHAR_SAFE(s, start, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF16_GET_CHAR_SAFE(s, start, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[i]; \
if(UTF_IS_SURROGATE(c)) { \
uint16_t __c2; \
@@ -626,51 +626,51 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
} else if((strict) && !UTF_IS_UNICODE_CHAR(c)) { \
(c)=UTF_ERROR_VALUE; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_NEXT_UNSAFE, see utf_old.h. */
-#define UTF16_NEXT_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF16_NEXT_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if(UTF_IS_FIRST_SURROGATE(c)) { \
(c)=UTF16_GET_PAIR_VALUE((c), (s)[(i)++]); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_APPEND_UNSAFE, see utf_old.h. */
-#define UTF16_APPEND_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF16_APPEND_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0xffff) { \
(s)[(i)++]=(uint16_t)(c); \
} else { \
(s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \
(s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_FWD_1_UNSAFE, see utf_old.h. */
-#define UTF16_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF16_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
if(UTF_IS_FIRST_SURROGATE((s)[(i)++])) { \
++(i); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_FWD_N_UNSAFE, see utf_old.h. */
-#define UTF16_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF16_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
UTF16_FWD_1_UNSAFE(s, i); \
--__N; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_SET_CP_START_UNSAFE, see utf_old.h. */
-#define UTF16_SET_CHAR_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF16_SET_CHAR_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
if(UTF_IS_SECOND_SURROGATE((s)[i])) { \
--(i); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Use U16_NEXT instead, see utf_old.h. */
-#define UTF16_NEXT_CHAR_SAFE(s, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF16_NEXT_CHAR_SAFE(s, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if(UTF_IS_FIRST_SURROGATE(c)) { \
uint16_t __c2; \
@@ -686,10 +686,10 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
/* unmatched second surrogate or other non-character */ \
(c)=UTF_ERROR_VALUE; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Use U16_APPEND instead, see utf_old.h. */
-#define UTF16_APPEND_CHAR_SAFE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF16_APPEND_CHAR_SAFE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0xffff) { \
(s)[(i)++]=(uint16_t)(c); \
} else if((uint32_t)(c)<=0x10ffff) { \
@@ -702,7 +702,7 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
} else /* c>0x10ffff, write error value */ { \
(s)[(i)++]=UTF_ERROR_VALUE; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_FWD_1, see utf_old.h. */
#define UTF16_FWD_1_SAFE(s, i, length) U16_FWD_1(s, i, length)
@@ -714,38 +714,38 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
#define UTF16_SET_CHAR_START_SAFE(s, start, i) U16_SET_CP_START(s, start, i)
/** @deprecated ICU 2.4. Renamed to U16_PREV_UNSAFE, see utf_old.h. */
-#define UTF16_PREV_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF16_PREV_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if(UTF_IS_SECOND_SURROGATE(c)) { \
(c)=UTF16_GET_PAIR_VALUE((s)[--(i)], (c)); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_BACK_1_UNSAFE, see utf_old.h. */
-#define UTF16_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF16_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
if(UTF_IS_SECOND_SURROGATE((s)[--(i)])) { \
--(i); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_BACK_N_UNSAFE, see utf_old.h. */
-#define UTF16_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF16_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
UTF16_BACK_1_UNSAFE(s, i); \
--__N; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_SET_CP_LIMIT_UNSAFE, see utf_old.h. */
-#define UTF16_SET_CHAR_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF16_SET_CHAR_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
if(UTF_IS_FIRST_SURROGATE((s)[(i)-1])) { \
++(i); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Use U16_PREV instead, see utf_old.h. */
-#define UTF16_PREV_CHAR_SAFE(s, start, i, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF16_PREV_CHAR_SAFE(s, start, i, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if(UTF_IS_SECOND_SURROGATE(c)) { \
uint16_t __c2; \
@@ -761,7 +761,7 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
/* unmatched first surrogate or other non-character */ \
(c)=UTF_ERROR_VALUE; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_BACK_1, see utf_old.h. */
#define UTF16_BACK_1_SAFE(s, start, i) U16_BACK_1(s, start, i)
@@ -827,122 +827,122 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
#define UTF32_ARRAY_SIZE(size) (size)
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_GET_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF32_GET_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[i]; \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_GET_CHAR_SAFE(s, start, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF32_GET_CHAR_SAFE(s, start, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[i]; \
if(!UTF32_IS_SAFE(c, strict)) { \
(c)=UTF_ERROR_VALUE; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/* definitions with forward iteration --------------------------------------- */
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_NEXT_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF32_NEXT_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_APPEND_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF32_APPEND_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(s)[(i)++]=(c); \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF32_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
++(i); \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF32_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
(i)+=(n); \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_SET_CHAR_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
-} UPRV_BLOCK_MACRO_END
+#define UTF32_SET_CHAR_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_NEXT_CHAR_SAFE(s, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF32_NEXT_CHAR_SAFE(s, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if(!UTF32_IS_SAFE(c, strict)) { \
(c)=UTF_ERROR_VALUE; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_APPEND_CHAR_SAFE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF32_APPEND_CHAR_SAFE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0x10ffff) { \
(s)[(i)++]=(c); \
} else /* c>0x10ffff, write 0xfffd */ { \
(s)[(i)++]=0xfffd; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_FWD_1_SAFE(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF32_FWD_1_SAFE(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \
++(i); \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_FWD_N_SAFE(s, i, length, n) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF32_FWD_N_SAFE(s, i, length, n) UPRV_BLOCK_MACRO_BEGIN { \
if(((i)+=(n))>(length)) { \
(i)=(length); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_SET_CHAR_START_SAFE(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
-} UPRV_BLOCK_MACRO_END
+#define UTF32_SET_CHAR_START_SAFE(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
+} UPRV_BLOCK_MACRO_END
/* definitions with backward iteration -------------------------------------- */
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_PREV_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF32_PREV_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF32_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
--(i); \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF32_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
(i)-=(n); \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_SET_CHAR_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
-} UPRV_BLOCK_MACRO_END
+#define UTF32_SET_CHAR_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_PREV_CHAR_SAFE(s, start, i, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF32_PREV_CHAR_SAFE(s, start, i, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if(!UTF32_IS_SAFE(c, strict)) { \
(c)=UTF_ERROR_VALUE; \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_BACK_1_SAFE(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF32_BACK_1_SAFE(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
--(i); \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_BACK_N_SAFE(s, start, i, n) UPRV_BLOCK_MACRO_BEGIN { \
+#define UTF32_BACK_N_SAFE(s, start, i, n) UPRV_BLOCK_MACRO_BEGIN { \
(i)-=(n); \
if((i)<(start)) { \
(i)=(start); \
} \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_SET_CHAR_LIMIT_SAFE(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \
-} UPRV_BLOCK_MACRO_END
+#define UTF32_SET_CHAR_LIMIT_SAFE(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \
+} UPRV_BLOCK_MACRO_END
/* Formerly utf.h, part 2 --------------------------------------------------- */
@@ -1196,6 +1196,6 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
*/
#define UTF_SET_CHAR_LIMIT(s, start, i, length) U16_SET_CP_LIMIT(s, start, i, length)
-#endif // !U_HIDE_DEPRECATED_API && !U_HIDE_OBSOLETE_UTF_OLD_H
+#endif // !U_HIDE_DEPRECATED_API && !U_HIDE_OBSOLETE_UTF_OLD_H
#endif
diff --git a/contrib/libs/icu/include/unicode/utmscale.h b/contrib/libs/icu/include/unicode/utmscale.h
index 9a4a9de512..d8b8a2e668 100644
--- a/contrib/libs/icu/include/unicode/utmscale.h
+++ b/contrib/libs/icu/include/unicode/utmscale.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -283,14 +283,14 @@ typedef enum UDateTimeScale {
*/
UDTS_UNIX_MICROSECONDS_TIME,
-#ifndef U_HIDE_DEPRECATED_API
+#ifndef U_HIDE_DEPRECATED_API
/**
* The first unused time scale value. The limit of this enum
- * @deprecated ICU 59 The numeric value may change over time, see ICU ticket #12420.
+ * @deprecated ICU 59 The numeric value may change over time, see ICU ticket #12420.
*/
UDTS_MAX_SCALE
-#endif /* U_HIDE_DEPRECATED_API */
-
+#endif /* U_HIDE_DEPRECATED_API */
+
} UDateTimeScale;
/**
@@ -427,15 +427,15 @@ typedef enum UTimeScaleValue {
#endif /* U_HIDE_INTERNAL_API */
-#ifndef U_HIDE_DEPRECATED_API
+#ifndef U_HIDE_DEPRECATED_API
/**
* The number of time scale values, in other words limit of this enum.
*
* @see utmscale_getTimeScaleValue
- * @deprecated ICU 59 The numeric value may change over time, see ICU ticket #12420.
+ * @deprecated ICU 59 The numeric value may change over time, see ICU ticket #12420.
*/
UTSV_MAX_SCALE_VALUE=11
-#endif /* U_HIDE_DEPRECATED_API */
+#endif /* U_HIDE_DEPRECATED_API */
} UTimeScaleValue;
diff --git a/contrib/libs/icu/include/unicode/utrace.h b/contrib/libs/icu/include/unicode/utrace.h
index 304bc627d0..5b4a0497bf 100644
--- a/contrib/libs/icu/include/unicode/utrace.h
+++ b/contrib/libs/icu/include/unicode/utrace.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -8,7 +8,7 @@
*
*******************************************************************************
* file name: utrace.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -66,7 +66,7 @@ typedef enum UTraceFunctionNumber {
UTRACE_FUNCTION_START=0,
UTRACE_U_INIT=UTRACE_FUNCTION_START,
UTRACE_U_CLEANUP,
-
+
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal collation trace location.
@@ -84,7 +84,7 @@ typedef enum UTraceFunctionNumber {
UTRACE_UCNV_FLUSH_CACHE,
UTRACE_UCNV_LOAD,
UTRACE_UCNV_UNLOAD,
-
+
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal collation trace location.
@@ -103,145 +103,145 @@ typedef enum UTraceFunctionNumber {
UTRACE_UCOL_STRCOLLITER,
UTRACE_UCOL_OPEN_FROM_SHORT_STRING,
UTRACE_UCOL_STRCOLLUTF8, /**< @stable ICU 50 */
-
+
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal collation trace location.
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
- UTRACE_COLLATION_LIMIT,
+ UTRACE_COLLATION_LIMIT,
#endif // U_HIDE_DEPRECATED_API
-
-#ifndef U_HIDE_DRAFT_API
-
- /**
- * The lowest resource/data location.
- * @draft ICU 65
- */
- UTRACE_UDATA_START=0x3000,
-
- /**
- * Indicates that a value was read from a resource bundle. Provides three
- * C-style strings to UTraceData: type, file name, and resource path. The
- * possible types are:
- *
- * - "string" (a string value was accessed)
- * - "binary" (a binary value was accessed)
- * - "intvector" (a integer vector value was accessed)
- * - "int" (a signed integer value was accessed)
- * - "uint" (a unsigned integer value was accessed)
- * - "get" (a path was loaded, but the value was not accessed)
- * - "getalias" (a path was loaded, and an alias was resolved)
- *
- * @draft ICU 65
- */
- UTRACE_UDATA_RESOURCE=UTRACE_UDATA_START,
-
- /**
- * Indicates that a resource bundle was opened.
- *
- * Provides one C-style string to UTraceData: file name.
- * @draft ICU 65
- */
- UTRACE_UDATA_BUNDLE,
-
- /**
- * Indicates that a data file was opened, but not *.res files.
- *
- * Provides one C-style string to UTraceData: file name.
- *
- * @draft ICU 65
- */
- UTRACE_UDATA_DATA_FILE,
-
- /**
- * Indicates that a *.res file was opened.
- *
- * This differs from UTRACE_UDATA_BUNDLE because a res file is typically
- * opened only once per application runtime, but the bundle corresponding
- * to that res file may be opened many times.
- *
- * Provides one C-style string to UTraceData: file name.
- *
- * @draft ICU 65
- */
- UTRACE_UDATA_RES_FILE,
-
-#endif // U_HIDE_DRAFT_API
-
-#ifndef U_HIDE_INTERNAL_API
- /**
- * One more than the highest normal resource/data trace location.
- * @internal The numeric value may change over time, see ICU ticket #12420.
- */
- UTRACE_RES_DATA_LIMIT,
-#endif // U_HIDE_INTERNAL_API
-
-#ifndef U_HIDE_DRAFT_API
- /**
- * The lowest break iterator location.
- * @draft ICU 67
- */
- UTRACE_UBRK_START=0x4000,
-
- /**
- * Indicates that a character instance of break iterator was created.
- *
- * @draft ICU 67
- */
- UTRACE_UBRK_CREATE_CHARACTER = UTRACE_UBRK_START,
-
- /**
- * Indicates that a word instance of break iterator was created.
- *
- * @draft ICU 67
- */
- UTRACE_UBRK_CREATE_WORD,
-
- /**
- * Indicates that a line instance of break iterator was created.
- *
- * Provides one C-style string to UTraceData: the lb value ("",
- * "loose", "strict", or "normal").
- *
- * @draft ICU 67
- */
- UTRACE_UBRK_CREATE_LINE,
-
- /**
- * Indicates that a sentence instance of break iterator was created.
- *
- * @draft ICU 67
- */
- UTRACE_UBRK_CREATE_SENTENCE,
-
- /**
- * Indicates that a title instance of break iterator was created.
- *
- * @draft ICU 67
- */
- UTRACE_UBRK_CREATE_TITLE,
-
- /**
- * Indicates that an internal dictionary break engine was created.
- *
- * Provides one C-style string to UTraceData: the script code of what
- * the break engine cover ("Hani", "Khmr", "Laoo", "Mymr", or "Thai").
- *
- * @draft ICU 67
- */
- UTRACE_UBRK_CREATE_BREAK_ENGINE,
-
-#endif // U_HIDE_DRAFT_API
-
-#ifndef U_HIDE_INTERNAL_API
- /**
- * One more than the highest normal break iterator trace location.
- * @internal The numeric value may change over time, see ICU ticket #12420.
- */
- UTRACE_UBRK_LIMIT,
-#endif // U_HIDE_INTERNAL_API
-
+
+#ifndef U_HIDE_DRAFT_API
+
+ /**
+ * The lowest resource/data location.
+ * @draft ICU 65
+ */
+ UTRACE_UDATA_START=0x3000,
+
+ /**
+ * Indicates that a value was read from a resource bundle. Provides three
+ * C-style strings to UTraceData: type, file name, and resource path. The
+ * possible types are:
+ *
+ * - "string" (a string value was accessed)
+ * - "binary" (a binary value was accessed)
+ * - "intvector" (a integer vector value was accessed)
+ * - "int" (a signed integer value was accessed)
+ * - "uint" (a unsigned integer value was accessed)
+ * - "get" (a path was loaded, but the value was not accessed)
+ * - "getalias" (a path was loaded, and an alias was resolved)
+ *
+ * @draft ICU 65
+ */
+ UTRACE_UDATA_RESOURCE=UTRACE_UDATA_START,
+
+ /**
+ * Indicates that a resource bundle was opened.
+ *
+ * Provides one C-style string to UTraceData: file name.
+ * @draft ICU 65
+ */
+ UTRACE_UDATA_BUNDLE,
+
+ /**
+ * Indicates that a data file was opened, but not *.res files.
+ *
+ * Provides one C-style string to UTraceData: file name.
+ *
+ * @draft ICU 65
+ */
+ UTRACE_UDATA_DATA_FILE,
+
+ /**
+ * Indicates that a *.res file was opened.
+ *
+ * This differs from UTRACE_UDATA_BUNDLE because a res file is typically
+ * opened only once per application runtime, but the bundle corresponding
+ * to that res file may be opened many times.
+ *
+ * Provides one C-style string to UTraceData: file name.
+ *
+ * @draft ICU 65
+ */
+ UTRACE_UDATA_RES_FILE,
+
+#endif // U_HIDE_DRAFT_API
+
+#ifndef U_HIDE_INTERNAL_API
+ /**
+ * One more than the highest normal resource/data trace location.
+ * @internal The numeric value may change over time, see ICU ticket #12420.
+ */
+ UTRACE_RES_DATA_LIMIT,
+#endif // U_HIDE_INTERNAL_API
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * The lowest break iterator location.
+ * @draft ICU 67
+ */
+ UTRACE_UBRK_START=0x4000,
+
+ /**
+ * Indicates that a character instance of break iterator was created.
+ *
+ * @draft ICU 67
+ */
+ UTRACE_UBRK_CREATE_CHARACTER = UTRACE_UBRK_START,
+
+ /**
+ * Indicates that a word instance of break iterator was created.
+ *
+ * @draft ICU 67
+ */
+ UTRACE_UBRK_CREATE_WORD,
+
+ /**
+ * Indicates that a line instance of break iterator was created.
+ *
+ * Provides one C-style string to UTraceData: the lb value ("",
+ * "loose", "strict", or "normal").
+ *
+ * @draft ICU 67
+ */
+ UTRACE_UBRK_CREATE_LINE,
+
+ /**
+ * Indicates that a sentence instance of break iterator was created.
+ *
+ * @draft ICU 67
+ */
+ UTRACE_UBRK_CREATE_SENTENCE,
+
+ /**
+ * Indicates that a title instance of break iterator was created.
+ *
+ * @draft ICU 67
+ */
+ UTRACE_UBRK_CREATE_TITLE,
+
+ /**
+ * Indicates that an internal dictionary break engine was created.
+ *
+ * Provides one C-style string to UTraceData: the script code of what
+ * the break engine cover ("Hani", "Khmr", "Laoo", "Mymr", or "Thai").
+ *
+ * @draft ICU 67
+ */
+ UTRACE_UBRK_CREATE_BREAK_ENGINE,
+
+#endif // U_HIDE_DRAFT_API
+
+#ifndef U_HIDE_INTERNAL_API
+ /**
+ * One more than the highest normal break iterator trace location.
+ * @internal The numeric value may change over time, see ICU ticket #12420.
+ */
+ UTRACE_UBRK_LIMIT,
+#endif // U_HIDE_INTERNAL_API
+
} UTraceFunctionNumber;
/**
@@ -317,7 +317,7 @@ UTraceData(const void *context, int32_t fnNumber, int32_t level,
* tracing functions must themselves filter by checking that the
* current thread is the desired thread.
*
- * @param context an uninterpreted pointer. Whatever is passed in
+ * @param context an uninterpreted pointer. Whatever is passed in
* here will in turn be passed to each of the tracing
* functions UTraceEntry, UTraceExit and UTraceData.
* ICU does not use or alter this pointer.
@@ -454,7 +454,7 @@ utrace_getFunctions(const void **context,
* human readable form. Note that a UTraceData function may choose
* to not format the data; it could, for example, save it in
* in the raw form it was received (more compact), leaving
- * formatting for a later trace analysis tool.
+ * formatting for a later trace analysis tool.
* @param outBuf pointer to a buffer to receive the formatted output. Output
* will be nul terminated if there is space in the buffer -
* if the length of the requested output < the output buffer size.
diff --git a/contrib/libs/icu/include/unicode/utrans.h b/contrib/libs/icu/include/unicode/utrans.h
index 9d39e87a6c..021af498a8 100644
--- a/contrib/libs/icu/include/unicode/utrans.h
+++ b/contrib/libs/icu/include/unicode/utrans.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -142,7 +142,7 @@ typedef struct UTransPosition {
int32_t contextLimit;
/**
- * Beginning index, inclusive, of the text to be transliterated.
+ * Beginning index, inclusive, of the text to be transliterated.
* INPUT/OUTPUT parameter: This parameter is advanced past
* characters that have already been transliterated by a
* transliteration operation.
@@ -151,7 +151,7 @@ typedef struct UTransPosition {
int32_t start;
/**
- * Ending index, exclusive, of the text to be transliterated.
+ * Ending index, exclusive, of the text to be transliterated.
* INPUT/OUTPUT parameter: This parameter is updated to reflect
* changes in the length of the text, but points to the same
* logical position in the text.
@@ -382,14 +382,14 @@ utrans_openIDs(UErrorCode *pErrorCode);
U_STABLE void U_EXPORT2
utrans_trans(const UTransliterator* trans,
UReplaceable* rep,
- const UReplaceableCallbacks* repFunc,
+ const UReplaceableCallbacks* repFunc,
int32_t start,
int32_t* limit,
UErrorCode* status);
/**
* Transliterate the portion of the UReplaceable text buffer that can
- * be transliterated unambiguously. This method is typically called
+ * be transliterated unambiguously. This method is typically called
* after new text has been inserted, e.g. as a result of a keyboard
* event. The transliterator will try to transliterate characters of
* <code>rep</code> between <code>index.cursor</code> and
@@ -433,7 +433,7 @@ utrans_trans(const UTransliterator* trans,
U_STABLE void U_EXPORT2
utrans_transIncremental(const UTransliterator* trans,
UReplaceable* rep,
- const UReplaceableCallbacks* repFunc,
+ const UReplaceableCallbacks* repFunc,
UTransPosition* pos,
UErrorCode* status);
@@ -454,7 +454,7 @@ utrans_transIncremental(const UTransliterator* trans,
* zero-terminated. Upon return, the new length is stored in
* *textLength. If textLength is NULL then the string is assumed to
* be zero-terminated.
- * @param textCapacity the length of the text buffer
+ * @param textCapacity the length of the text buffer
* @param start the beginning index, inclusive; <code>0 <= start <=
* limit</code>.
* @param limit pointer to the ending index, exclusive; <code>start <=
@@ -478,7 +478,7 @@ utrans_transUChars(const UTransliterator* trans,
/**
* Transliterate the portion of the UChar* text buffer that can be
- * transliterated unambiguously. See utrans_transIncremental(). The
+ * transliterated unambiguously. See utrans_transIncremental(). The
* string is passed in in a UChar* buffer. The string is modified in
* place. If the result is longer than textCapacity, it is truncated.
* The actual length of the result is returned in *textLength, if
diff --git a/contrib/libs/icu/include/unicode/utypes.h b/contrib/libs/icu/include/unicode/utypes.h
index a4330d3ae7..8d8f54764e 100644
--- a/contrib/libs/icu/include/unicode/utypes.h
+++ b/contrib/libs/icu/include/unicode/utypes.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -145,7 +145,7 @@
/**
* U_ICU_ENTRY_POINT is the name of the DLL entry point to the ICU data library.
* Defined as a literal, not a string.
- * Tricky Preprocessor use - ## operator replaces macro parameters with the literal string
+ * Tricky Preprocessor use - ## operator replaces macro parameters with the literal string
* from the corresponding macro invocation, _before_ other macro substitutions.
* Need a nested \#defines to get the actual version numbers rather than
* the literal text U_ICU_VERSION_MAJOR_NUM into the name.
@@ -178,12 +178,12 @@
/**
* \def NULL
- * Define NULL if necessary, to nullptr for C++ and to ((void *)0) for C.
+ * Define NULL if necessary, to nullptr for C++ and to ((void *)0) for C.
* @stable ICU 2.0
*/
#ifndef NULL
#ifdef __cplusplus
-#define NULL nullptr
+#define NULL nullptr
#else
#define NULL ((void *)0)
#endif
@@ -290,11 +290,11 @@ typedef double UDate;
* @stable ICU 3.4
*/
-#ifdef U_IN_DOXYGEN
-// This definition is required when generating the API docs.
-#define U_COMBINED_IMPLEMENTATION 1
-#endif
-
+#ifdef U_IN_DOXYGEN
+// This definition is required when generating the API docs.
+#define U_COMBINED_IMPLEMENTATION 1
+#endif
+
#if defined(U_COMBINED_IMPLEMENTATION)
#define U_DATA_API U_EXPORT
#define U_COMMON_API U_EXPORT
@@ -385,28 +385,28 @@ typedef double UDate;
/*===========================================================================*/
/**
- * Standard ICU4C error code type, a substitute for exceptions.
+ * Standard ICU4C error code type, a substitute for exceptions.
+ *
+ * Initialize the UErrorCode with U_ZERO_ERROR, and check for success or
+ * failure using U_SUCCESS() or U_FAILURE():
+ *
+ * UErrorCode errorCode = U_ZERO_ERROR;
+ * // call ICU API that needs an error code parameter.
+ * if (U_FAILURE(errorCode)) {
+ * // An error occurred. Handle it here.
+ * }
+ *
+ * C++ code should use icu::ErrorCode, available in unicode/errorcode.h, or a
+ * suitable subclass.
+ *
+ * For more information, see:
+ * http://icu-project.org/userguide/conventions
+ *
+ * Note: By convention, ICU functions that take a reference (C++) or a pointer
+ * (C) to a UErrorCode first test:
+ *
+ * if (U_FAILURE(errorCode)) { return immediately; }
*
- * Initialize the UErrorCode with U_ZERO_ERROR, and check for success or
- * failure using U_SUCCESS() or U_FAILURE():
- *
- * UErrorCode errorCode = U_ZERO_ERROR;
- * // call ICU API that needs an error code parameter.
- * if (U_FAILURE(errorCode)) {
- * // An error occurred. Handle it here.
- * }
- *
- * C++ code should use icu::ErrorCode, available in unicode/errorcode.h, or a
- * suitable subclass.
- *
- * For more information, see:
- * http://icu-project.org/userguide/conventions
- *
- * Note: By convention, ICU functions that take a reference (C++) or a pointer
- * (C) to a UErrorCode first test:
- *
- * if (U_FAILURE(errorCode)) { return immediately; }
- *
* so that in a chain of such functions the first one that sets an error code
* causes the following ones to not perform any operations.
*
@@ -465,14 +465,14 @@ typedef enum UErrorCode {
U_BUFFER_OVERFLOW_ERROR = 15, /**< A result would not fit in the supplied buffer */
U_UNSUPPORTED_ERROR = 16, /**< Requested operation not supported in current context */
U_RESOURCE_TYPE_MISMATCH = 17, /**< an operation is requested over a resource that does not support it */
- U_ILLEGAL_ESCAPE_SEQUENCE = 18, /**< ISO-2022 illegal escape sequence */
+ U_ILLEGAL_ESCAPE_SEQUENCE = 18, /**< ISO-2022 illegal escape sequence */
U_UNSUPPORTED_ESCAPE_SEQUENCE = 19, /**< ISO-2022 unsupported escape sequence */
U_NO_SPACE_AVAILABLE = 20, /**< No space available for in-buffer expansion for Arabic shaping */
U_CE_NOT_FOUND_ERROR = 21, /**< Currently used only while setting variable top, but can be used generally */
U_PRIMARY_TOO_LONG_ERROR = 22, /**< User tried to set variable top to a primary that is longer than two bytes */
U_STATE_TOO_OLD_ERROR = 23, /**< ICU cannot construct a service from this state, as it is no longer supported */
U_TOO_MANY_ALIASES_ERROR = 24, /**< There are too many aliases in the path to the requested resource.
- It is very possible that a circular alias definition has occurred */
+ It is very possible that a circular alias definition has occurred */
U_ENUM_OUT_OF_SYNC_ERROR = 25, /**< UEnumeration out of sync with underlying collection */
U_INVARIANT_CONVERSION_ERROR = 26, /**< Unable to convert a UChar* string to char* with the invariant converter. */
U_INVALID_STATE_ERROR = 27, /**< Requested operation can not be completed with ICU in its current state */
@@ -518,7 +518,7 @@ typedef enum UErrorCode {
U_MULTIPLE_COMPOUND_FILTERS, /**< More than one compound filter */
U_INVALID_RBT_SYNTAX, /**< A "::id" rule was passed to the RuleBasedTransliterator parser */
U_INVALID_PROPERTY_PATTERN, /**< UNUSED as of ICU 2.4 */
- U_MALFORMED_PRAGMA, /**< A 'use' pragma is invalid */
+ U_MALFORMED_PRAGMA, /**< A 'use' pragma is invalid */
U_UNCLOSED_SEGMENT, /**< A closing ')' is missing */
U_ILLEGAL_CHAR_IN_SEGMENT, /**< UNUSED as of ICU 2.4 */
U_VARIABLE_RANGE_EXHAUSTED, /**< Too many stand-ins generated for the given variable range */
@@ -558,14 +558,14 @@ typedef enum UErrorCode {
U_DEFAULT_KEYWORD_MISSING, /**< Missing DEFAULT rule in plural rules */
U_DECIMAL_NUMBER_SYNTAX_ERROR, /**< Decimal number syntax error */
U_FORMAT_INEXACT_ERROR, /**< Cannot format a number exactly and rounding mode is ROUND_UNNECESSARY @stable ICU 4.8 */
- U_NUMBER_ARG_OUTOFBOUNDS_ERROR, /**< The argument to a NumberFormatter helper method was out of bounds; the bounds are usually 0 to 999. @stable ICU 61 */
- U_NUMBER_SKELETON_SYNTAX_ERROR, /**< The number skeleton passed to C++ NumberFormatter or C UNumberFormatter was invalid or contained a syntax error. @stable ICU 62 */
+ U_NUMBER_ARG_OUTOFBOUNDS_ERROR, /**< The argument to a NumberFormatter helper method was out of bounds; the bounds are usually 0 to 999. @stable ICU 61 */
+ U_NUMBER_SKELETON_SYNTAX_ERROR, /**< The number skeleton passed to C++ NumberFormatter or C UNumberFormatter was invalid or contained a syntax error. @stable ICU 62 */
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal formatting API error code.
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
- U_FMT_PARSE_ERROR_LIMIT = 0x10114,
+ U_FMT_PARSE_ERROR_LIMIT = 0x10114,
#endif // U_HIDE_DEPRECATED_API
/*
@@ -576,7 +576,7 @@ typedef enum UErrorCode {
U_BRK_HEX_DIGITS_EXPECTED, /**< Hex digits expected as part of a escaped char in a rule. */
U_BRK_SEMICOLON_EXPECTED, /**< Missing ';' at the end of a RBBI rule. */
U_BRK_RULE_SYNTAX, /**< Syntax error in RBBI rule. */
- U_BRK_UNCLOSED_SET, /**< UnicodeSet writing an RBBI rule missing a closing ']'. */
+ U_BRK_UNCLOSED_SET, /**< UnicodeSet writing an RBBI rule missing a closing ']'. */
U_BRK_ASSIGN_ERROR, /**< Syntax error in RBBI rule assignment statement. */
U_BRK_VARIABLE_REDFINITION, /**< RBBI rule $Variable redefined. */
U_BRK_MISMATCHED_PAREN, /**< Mis-matched parentheses in an RBBI rule. */
@@ -585,7 +585,7 @@ typedef enum UErrorCode {
U_BRK_INIT_ERROR, /**< Initialization failure. Probable missing ICU Data. */
U_BRK_RULE_EMPTY_SET, /**< Rule contains an empty Unicode Set. */
U_BRK_UNRECOGNIZED_OPTION, /**< !!option in RBBI rules not recognized. */
- U_BRK_MALFORMED_RULE_TAG, /**< The {nnn} tag on a rule is malformed */
+ U_BRK_MALFORMED_RULE_TAG, /**< The {nnn} tag on a rule is malformed */
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal BreakIterator error code.
diff --git a/contrib/libs/icu/include/unicode/uvernum.h b/contrib/libs/icu/include/unicode/uvernum.h
index fdad18ae10..c66776d10b 100644
--- a/contrib/libs/icu/include/unicode/uvernum.h
+++ b/contrib/libs/icu/include/unicode/uvernum.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -7,7 +7,7 @@
*******************************************************************************
*
* file name: uvernum.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -34,11 +34,11 @@
* by running the UNIX makefile target 'update-windows-makefiles' in icu/source.
*
*
- * source/common/common_uwp.vcxproj
+ * source/common/common_uwp.vcxproj
* source/common/common.vcxproj - update 'Output file name' on the link tab so
* that it contains the new major/minor combination
* source/i18n/i18n.vcxproj - same as for the common.vcxproj
- * source/i18n/i18n_uwp.vcxproj - same as for the common_uwp.vcxproj
+ * source/i18n/i18n_uwp.vcxproj - same as for the common_uwp.vcxproj
* source/layoutex/layoutex.vcproj - same
* source/stubdata/stubdata.vcproj - same as for the common.vcxproj
* source/io/io.vcproj - same as for the common.vcxproj
@@ -60,13 +60,13 @@
* This value will change in the subsequent releases of ICU
* @stable ICU 2.4
*/
-#define U_ICU_VERSION_MAJOR_NUM 67
+#define U_ICU_VERSION_MAJOR_NUM 67
/** The current ICU minor version as an integer.
* This value will change in the subsequent releases of ICU
* @stable ICU 2.6
*/
-#define U_ICU_VERSION_MINOR_NUM 1
+#define U_ICU_VERSION_MINOR_NUM 1
/** The current ICU patchlevel version as an integer.
* This value will change in the subsequent releases of ICU
@@ -86,7 +86,7 @@
* This value will change in the subsequent releases of ICU
* @stable ICU 2.6
*/
-#define U_ICU_VERSION_SUFFIX _67
+#define U_ICU_VERSION_SUFFIX _67
/**
* \def U_DEF2_ICU_ENTRY_POINT_RENAME
@@ -103,34 +103,34 @@
* \def U_ICU_ENTRY_POINT_RENAME
* @stable ICU 4.2
*/
-/**
- * Disable the version suffix. Use the custom suffix if exists.
- * \def U_DISABLE_VERSION_SUFFIX
- * @internal
- */
-#ifndef U_DISABLE_VERSION_SUFFIX
-#define U_DISABLE_VERSION_SUFFIX 0
-#endif
+/**
+ * Disable the version suffix. Use the custom suffix if exists.
+ * \def U_DISABLE_VERSION_SUFFIX
+ * @internal
+ */
+#ifndef U_DISABLE_VERSION_SUFFIX
+#define U_DISABLE_VERSION_SUFFIX 0
+#endif
#ifndef U_ICU_ENTRY_POINT_RENAME
#ifdef U_HAVE_LIB_SUFFIX
-# if !U_DISABLE_VERSION_SUFFIX
-# define U_DEF_ICU_ENTRY_POINT_RENAME(x,y,z) x ## y ## z
-# define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y,z) U_DEF_ICU_ENTRY_POINT_RENAME(x,y,z)
-# define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX,U_LIB_SUFFIX_C_NAME)
-# else
-# define U_DEF_ICU_ENTRY_POINT_RENAME(x,y) x ## y
-# define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y) U_DEF_ICU_ENTRY_POINT_RENAME(x,y)
-# define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_LIB_SUFFIX_C_NAME)
-# endif
+# if !U_DISABLE_VERSION_SUFFIX
+# define U_DEF_ICU_ENTRY_POINT_RENAME(x,y,z) x ## y ## z
+# define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y,z) U_DEF_ICU_ENTRY_POINT_RENAME(x,y,z)
+# define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX,U_LIB_SUFFIX_C_NAME)
+# else
+# define U_DEF_ICU_ENTRY_POINT_RENAME(x,y) x ## y
+# define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y) U_DEF_ICU_ENTRY_POINT_RENAME(x,y)
+# define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_LIB_SUFFIX_C_NAME)
+# endif
#else
-# if !U_DISABLE_VERSION_SUFFIX
-# define U_DEF_ICU_ENTRY_POINT_RENAME(x,y) x ## y
-# define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y) U_DEF_ICU_ENTRY_POINT_RENAME(x,y)
-# define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX)
-# else
-# define U_ICU_ENTRY_POINT_RENAME(x) x
-# endif
+# if !U_DISABLE_VERSION_SUFFIX
+# define U_DEF_ICU_ENTRY_POINT_RENAME(x,y) x ## y
+# define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y) U_DEF_ICU_ENTRY_POINT_RENAME(x,y)
+# define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX)
+# else
+# define U_ICU_ENTRY_POINT_RENAME(x) x
+# endif
#endif
#endif
@@ -139,26 +139,26 @@
* This value will change in the subsequent releases of ICU
* @stable ICU 2.4
*/
-#define U_ICU_VERSION "67.1"
+#define U_ICU_VERSION "67.1"
-/**
- * The current ICU library major version number as a string, for library name suffixes.
- * This value will change in subsequent releases of ICU.
- *
- * Until ICU 4.8, this was the combination of the single-digit major and minor ICU version numbers
- * into one string without dots ("48").
- * Since ICU 49, it is the double-digit major ICU version number.
- * See http://userguide.icu-project.org/design#TOC-Version-Numbers-in-ICU
- *
- * @stable ICU 2.6
+/**
+ * The current ICU library major version number as a string, for library name suffixes.
+ * This value will change in subsequent releases of ICU.
+ *
+ * Until ICU 4.8, this was the combination of the single-digit major and minor ICU version numbers
+ * into one string without dots ("48").
+ * Since ICU 49, it is the double-digit major ICU version number.
+ * See http://userguide.icu-project.org/design#TOC-Version-Numbers-in-ICU
+ *
+ * @stable ICU 2.6
*/
-#define U_ICU_VERSION_SHORT "67"
+#define U_ICU_VERSION_SHORT "67"
#ifndef U_HIDE_INTERNAL_API
/** Data version in ICU4C.
* @internal ICU 4.4 Internal Use Only
**/
-#define U_ICU_DATA_VERSION "67.1"
+#define U_ICU_DATA_VERSION "67.1"
#endif /* U_HIDE_INTERNAL_API */
/*===========================================================================
diff --git a/contrib/libs/icu/include/unicode/uversion.h b/contrib/libs/icu/include/unicode/uversion.h
index 2697ccef33..5700f62cbf 100644
--- a/contrib/libs/icu/include/unicode/uversion.h
+++ b/contrib/libs/icu/include/unicode/uversion.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -7,7 +7,7 @@
*******************************************************************************
*
* file name: uversion.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -62,13 +62,13 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
/* C++ namespace if supported. Versioned unless versioning is disabled. */
/*===========================================================================*/
-/* Define C++ namespace symbols. */
-#ifdef __cplusplus
-
+/* Define C++ namespace symbols. */
+#ifdef __cplusplus
+
/**
* \def U_NAMESPACE_BEGIN
- * This is used to begin a declaration of a public ICU C++ API within
- * versioned-ICU-namespace block.
+ * This is used to begin a declaration of a public ICU C++ API within
+ * versioned-ICU-namespace block.
*
* @stable ICU 2.4
*/
@@ -76,7 +76,7 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
/**
* \def U_NAMESPACE_END
* This is used to end a declaration of a public ICU C++ API.
- * It ends the versioned-ICU-namespace block begun by U_NAMESPACE_BEGIN.
+ * It ends the versioned-ICU-namespace block begun by U_NAMESPACE_BEGIN.
*
* @stable ICU 2.4
*/
@@ -107,24 +107,24 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
namespace icu = U_ICU_NAMESPACE;
# endif
-# define U_NAMESPACE_BEGIN namespace U_ICU_NAMESPACE {
-# define U_NAMESPACE_END }
+# define U_NAMESPACE_BEGIN namespace U_ICU_NAMESPACE {
+# define U_NAMESPACE_END }
# define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE;
# define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE::
# ifndef U_USING_ICU_NAMESPACE
-# if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \
- defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || \
- defined(U_LAYOUTEX_IMPLEMENTATION) || defined(U_TOOLUTIL_IMPLEMENTATION)
-# define U_USING_ICU_NAMESPACE 0
-# else
-# define U_USING_ICU_NAMESPACE 0
-# endif
+# if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \
+ defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || \
+ defined(U_LAYOUTEX_IMPLEMENTATION) || defined(U_TOOLUTIL_IMPLEMENTATION)
+# define U_USING_ICU_NAMESPACE 0
+# else
+# define U_USING_ICU_NAMESPACE 0
+# endif
# endif
# if U_USING_ICU_NAMESPACE
U_NAMESPACE_USE
# endif
-#endif /* __cplusplus */
+#endif /* __cplusplus */
/*===========================================================================*/
/* General version helper functions. Definitions in putil.c */
diff --git a/contrib/libs/icu/include/unicode/vtzone.h b/contrib/libs/icu/include/unicode/vtzone.h
index be7b24ebe5..641adec512 100644
--- a/contrib/libs/icu/include/unicode/vtzone.h
+++ b/contrib/libs/icu/include/unicode/vtzone.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -11,8 +11,8 @@
#include "unicode/utypes.h"
-#if U_SHOW_CPLUSPLUS_API
-
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: RFC2445 VTIMEZONE support
@@ -189,7 +189,7 @@ public:
* @return A new copy of this TimeZone object.
* @stable ICU 3.8
*/
- virtual VTimeZone* clone() const;
+ virtual VTimeZone* clone() const;
/**
* Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add
@@ -292,7 +292,7 @@ public:
*/
virtual UBool useDaylightTime(void) const;
-#ifndef U_FORCE_HIDE_DEPRECATED_API
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Queries if the given date is in daylight savings time in
* this time zone.
@@ -307,7 +307,7 @@ public:
* @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead.
*/
virtual UBool inDaylightTime(UDate date, UErrorCode& status) const;
-#endif // U_FORCE_HIDE_DEPRECATED_API
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Returns true if this zone has the same rule and offset as another zone.
@@ -459,7 +459,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
-#endif /* U_SHOW_CPLUSPLUS_API */
-
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // VTZONE_H
//eof
diff --git a/contrib/libs/icu/io/locbund.cpp b/contrib/libs/icu/io/locbund.cpp
index 0f7f52844f..46c97bc043 100644
--- a/contrib/libs/icu/io/locbund.cpp
+++ b/contrib/libs/icu/io/locbund.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -47,7 +47,7 @@ U_CDECL_END
static inline UNumberFormat * copyInvariantFormatter(ULocaleBundle *result, UNumberFormatStyle style) {
U_NAMESPACE_USE
- static UMutex gLock;
+ static UMutex gLock;
Mutex lock(&gLock);
if (result->fNumberFormat[style-1] == NULL) {
if (gPosixNumberFormat[style-1] == NULL) {
diff --git a/contrib/libs/icu/io/locbund.h b/contrib/libs/icu/io/locbund.h
index 2f22fc8a37..5879e28f01 100644
--- a/contrib/libs/icu/io/locbund.h
+++ b/contrib/libs/icu/io/locbund.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
diff --git a/contrib/libs/icu/io/sprintf.cpp b/contrib/libs/icu/io/sprintf.cpp
index 726fd599fd..3a593abb48 100644
--- a/contrib/libs/icu/io/sprintf.cpp
+++ b/contrib/libs/icu/io/sprintf.cpp
@@ -1,262 +1,262 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 2001-2014, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-*
-* File sprintf.c
-*
-* Modification History:
-*
-* Date Name Description
-* 02/08/2001 george Creation. Copied from uprintf.c
-* 03/27/2002 Mark Schneckloth Many fixes regarding alignment, null termination
-* (mschneckloth@atomz.com) and other various problems.
-* 08/07/2003 george Reunify printf implementations
-*******************************************************************************
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION
-
-#include "unicode/ustdio.h"
-#include "unicode/ustring.h"
-#include "unicode/putil.h"
-
-#include "uprintf.h"
-#include "locbund.h"
-
-#include "cmemory.h"
-#include <ctype.h>
-
-/* u_minstrncpy copies the minimum number of code units of (count or output->available) */
-static int32_t
-u_sprintf_write(void *context,
- const UChar *str,
- int32_t count)
-{
- u_localized_print_string *output = (u_localized_print_string *)context;
- int32_t size = ufmt_min(count, output->available);
-
- u_strncpy(output->str + (output->len - output->available), str, size);
- output->available -= size;
- return size;
-}
-
-static int32_t
-u_sprintf_pad_and_justify(void *context,
- const u_printf_spec_info *info,
- const UChar *result,
- int32_t resultLen)
-{
- u_localized_print_string *output = (u_localized_print_string *)context;
- int32_t written = 0;
- int32_t lengthOfResult = resultLen;
-
- resultLen = ufmt_min(resultLen, output->available);
-
- /* pad and justify, if needed */
- if(info->fWidth != -1 && resultLen < info->fWidth) {
- int32_t paddingLeft = info->fWidth - resultLen;
- int32_t outputPos = output->len - output->available;
-
- if (paddingLeft + resultLen > output->available) {
- paddingLeft = output->available - resultLen;
- if (paddingLeft < 0) {
- paddingLeft = 0;
- }
- /* paddingLeft = output->available - resultLen;*/
- }
- written += paddingLeft;
-
- /* left justify */
- if(info->fLeft) {
- written += u_sprintf_write(output, result, resultLen);
- u_memset(&output->str[outputPos + resultLen], info->fPadChar, paddingLeft);
- output->available -= paddingLeft;
- }
- /* right justify */
- else {
- u_memset(&output->str[outputPos], info->fPadChar, paddingLeft);
- output->available -= paddingLeft;
- written += u_sprintf_write(output, result, resultLen);
- }
- }
- /* just write the formatted output */
- else {
- written = u_sprintf_write(output, result, resultLen);
- }
-
- if (written >= 0 && lengthOfResult > written) {
- return lengthOfResult;
- }
-
- return written;
-}
-
-U_CAPI int32_t U_EXPORT2
-u_sprintf(UChar *buffer,
- const char *patternSpecification,
- ... )
-{
- va_list ap;
- int32_t written;
-
- va_start(ap, patternSpecification);
- written = u_vsnprintf(buffer, INT32_MAX, patternSpecification, ap);
- va_end(ap);
-
- return written;
-}
-
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 2001-2014, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+*
+* File sprintf.c
+*
+* Modification History:
+*
+* Date Name Description
+* 02/08/2001 george Creation. Copied from uprintf.c
+* 03/27/2002 Mark Schneckloth Many fixes regarding alignment, null termination
+* (mschneckloth@atomz.com) and other various problems.
+* 08/07/2003 george Reunify printf implementations
+*******************************************************************************
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION
+
+#include "unicode/ustdio.h"
+#include "unicode/ustring.h"
+#include "unicode/putil.h"
+
+#include "uprintf.h"
+#include "locbund.h"
+
+#include "cmemory.h"
+#include <ctype.h>
+
+/* u_minstrncpy copies the minimum number of code units of (count or output->available) */
+static int32_t
+u_sprintf_write(void *context,
+ const UChar *str,
+ int32_t count)
+{
+ u_localized_print_string *output = (u_localized_print_string *)context;
+ int32_t size = ufmt_min(count, output->available);
+
+ u_strncpy(output->str + (output->len - output->available), str, size);
+ output->available -= size;
+ return size;
+}
+
+static int32_t
+u_sprintf_pad_and_justify(void *context,
+ const u_printf_spec_info *info,
+ const UChar *result,
+ int32_t resultLen)
+{
+ u_localized_print_string *output = (u_localized_print_string *)context;
+ int32_t written = 0;
+ int32_t lengthOfResult = resultLen;
+
+ resultLen = ufmt_min(resultLen, output->available);
+
+ /* pad and justify, if needed */
+ if(info->fWidth != -1 && resultLen < info->fWidth) {
+ int32_t paddingLeft = info->fWidth - resultLen;
+ int32_t outputPos = output->len - output->available;
+
+ if (paddingLeft + resultLen > output->available) {
+ paddingLeft = output->available - resultLen;
+ if (paddingLeft < 0) {
+ paddingLeft = 0;
+ }
+ /* paddingLeft = output->available - resultLen;*/
+ }
+ written += paddingLeft;
+
+ /* left justify */
+ if(info->fLeft) {
+ written += u_sprintf_write(output, result, resultLen);
+ u_memset(&output->str[outputPos + resultLen], info->fPadChar, paddingLeft);
+ output->available -= paddingLeft;
+ }
+ /* right justify */
+ else {
+ u_memset(&output->str[outputPos], info->fPadChar, paddingLeft);
+ output->available -= paddingLeft;
+ written += u_sprintf_write(output, result, resultLen);
+ }
+ }
+ /* just write the formatted output */
+ else {
+ written = u_sprintf_write(output, result, resultLen);
+ }
+
+ if (written >= 0 && lengthOfResult > written) {
+ return lengthOfResult;
+ }
+
+ return written;
+}
+
+U_CAPI int32_t U_EXPORT2
+u_sprintf(UChar *buffer,
+ const char *patternSpecification,
+ ... )
+{
+ va_list ap;
+ int32_t written;
+
+ va_start(ap, patternSpecification);
+ written = u_vsnprintf(buffer, INT32_MAX, patternSpecification, ap);
+ va_end(ap);
+
+ return written;
+}
+
+U_CAPI int32_t U_EXPORT2
+u_sprintf_u(UChar *buffer,
+ const UChar *patternSpecification,
+ ... )
+{
+ va_list ap;
+ int32_t written;
+
+ va_start(ap, patternSpecification);
+ written = u_vsnprintf_u(buffer, INT32_MAX, patternSpecification, ap);
+ va_end(ap);
+
+ return written;
+}
+
+U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_vsprintf(UChar *buffer,
+ const char *patternSpecification,
+ va_list ap)
+{
+ return u_vsnprintf(buffer, INT32_MAX, patternSpecification, ap);
+}
+
+U_CAPI int32_t U_EXPORT2
+u_snprintf(UChar *buffer,
+ int32_t count,
+ const char *patternSpecification,
+ ... )
+{
+ va_list ap;
+ int32_t written;
+
+ va_start(ap, patternSpecification);
+ written = u_vsnprintf(buffer, count, patternSpecification, ap);
+ va_end(ap);
+
+ return written;
+}
+
+U_CAPI int32_t U_EXPORT2
+u_snprintf_u(UChar *buffer,
+ int32_t count,
+ const UChar *patternSpecification,
+ ... )
+{
+ va_list ap;
+ int32_t written;
+
+ va_start(ap, patternSpecification);
+ written = u_vsnprintf_u(buffer, count, patternSpecification, ap);
+ va_end(ap);
+
+ return written;
+}
+
+U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_vsnprintf(UChar *buffer,
+ int32_t count,
+ const char *patternSpecification,
+ va_list ap)
+{
+ int32_t written;
+ UChar *pattern;
+ UChar patBuffer[UFMT_DEFAULT_BUFFER_SIZE];
+ int32_t size = (int32_t)strlen(patternSpecification) + 1;
+
+ /* convert from the default codepage to Unicode */
+ if (size >= (int32_t)MAX_UCHAR_BUFFER_SIZE(patBuffer)) {
+ pattern = (UChar *)uprv_malloc(size * sizeof(UChar));
+ if(pattern == 0) {
+ return 0;
+ }
+ }
+ else {
+ pattern = patBuffer;
+ }
+ u_charsToUChars(patternSpecification, pattern, size);
+
+ /* do the work */
+ written = u_vsnprintf_u(buffer, count, pattern, ap);
+
+ /* clean up */
+ if (pattern != patBuffer) {
+ uprv_free(pattern);
+ }
+
+ return written;
+}
+
U_CAPI int32_t U_EXPORT2
-u_sprintf_u(UChar *buffer,
- const UChar *patternSpecification,
- ... )
-{
- va_list ap;
- int32_t written;
-
- va_start(ap, patternSpecification);
- written = u_vsnprintf_u(buffer, INT32_MAX, patternSpecification, ap);
- va_end(ap);
-
- return written;
-}
-
-U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_vsprintf(UChar *buffer,
- const char *patternSpecification,
- va_list ap)
-{
- return u_vsnprintf(buffer, INT32_MAX, patternSpecification, ap);
-}
-
-U_CAPI int32_t U_EXPORT2
-u_snprintf(UChar *buffer,
- int32_t count,
- const char *patternSpecification,
- ... )
-{
- va_list ap;
- int32_t written;
-
- va_start(ap, patternSpecification);
- written = u_vsnprintf(buffer, count, patternSpecification, ap);
- va_end(ap);
-
- return written;
-}
-
-U_CAPI int32_t U_EXPORT2
-u_snprintf_u(UChar *buffer,
- int32_t count,
- const UChar *patternSpecification,
- ... )
-{
- va_list ap;
- int32_t written;
-
- va_start(ap, patternSpecification);
- written = u_vsnprintf_u(buffer, count, patternSpecification, ap);
- va_end(ap);
-
- return written;
-}
-
-U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_vsnprintf(UChar *buffer,
- int32_t count,
- const char *patternSpecification,
- va_list ap)
-{
- int32_t written;
- UChar *pattern;
- UChar patBuffer[UFMT_DEFAULT_BUFFER_SIZE];
- int32_t size = (int32_t)strlen(patternSpecification) + 1;
-
- /* convert from the default codepage to Unicode */
- if (size >= (int32_t)MAX_UCHAR_BUFFER_SIZE(patBuffer)) {
- pattern = (UChar *)uprv_malloc(size * sizeof(UChar));
- if(pattern == 0) {
- return 0;
- }
- }
- else {
- pattern = patBuffer;
- }
- u_charsToUChars(patternSpecification, pattern, size);
-
- /* do the work */
- written = u_vsnprintf_u(buffer, count, pattern, ap);
-
- /* clean up */
- if (pattern != patBuffer) {
- uprv_free(pattern);
- }
-
- return written;
-}
-
-U_CAPI int32_t U_EXPORT2
-u_vsprintf_u(UChar *buffer,
- const UChar *patternSpecification,
- va_list ap)
-{
- return u_vsnprintf_u(buffer, INT32_MAX, patternSpecification, ap);
-}
-
-static const u_printf_stream_handler g_sprintf_stream_handler = {
- u_sprintf_write,
- u_sprintf_pad_and_justify
-};
-
-U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_vsnprintf_u(UChar *buffer,
- int32_t count,
- const UChar *patternSpecification,
- va_list ap)
+u_vsprintf_u(UChar *buffer,
+ const UChar *patternSpecification,
+ va_list ap)
{
- int32_t written = 0; /* haven't written anything yet */
- int32_t result = 0; /* test the return value of u_printf_parse */
-
- u_localized_print_string outStr;
-
- if (count < 0) {
- count = INT32_MAX;
- }
-
- outStr.str = buffer;
- outStr.len = count;
- outStr.available = count;
-
- if(u_locbund_init(&outStr.fBundle, "en_US_POSIX") == 0) {
- return 0;
- }
-
- /* parse and print the whole format string */
- result = u_printf_parse(&g_sprintf_stream_handler, patternSpecification, &outStr, &outStr, &outStr.fBundle, &written, ap);
-
- /* Terminate the buffer, if there's room. */
- if (outStr.available > 0) {
- buffer[outStr.len - outStr.available] = 0x0000;
- }
-
- /* Release the cloned bundle, if we cloned it. */
- u_locbund_close(&outStr.fBundle);
-
- /* parsing error */
- if (result < 0) {
- return result;
- }
- /* return # of UChars written */
- return written;
+ return u_vsnprintf_u(buffer, INT32_MAX, patternSpecification, ap);
}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
-
+
+static const u_printf_stream_handler g_sprintf_stream_handler = {
+ u_sprintf_write,
+ u_sprintf_pad_and_justify
+};
+
+U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_vsnprintf_u(UChar *buffer,
+ int32_t count,
+ const UChar *patternSpecification,
+ va_list ap)
+{
+ int32_t written = 0; /* haven't written anything yet */
+ int32_t result = 0; /* test the return value of u_printf_parse */
+
+ u_localized_print_string outStr;
+
+ if (count < 0) {
+ count = INT32_MAX;
+ }
+
+ outStr.str = buffer;
+ outStr.len = count;
+ outStr.available = count;
+
+ if(u_locbund_init(&outStr.fBundle, "en_US_POSIX") == 0) {
+ return 0;
+ }
+
+ /* parse and print the whole format string */
+ result = u_printf_parse(&g_sprintf_stream_handler, patternSpecification, &outStr, &outStr, &outStr.fBundle, &written, ap);
+
+ /* Terminate the buffer, if there's room. */
+ if (outStr.available > 0) {
+ buffer[outStr.len - outStr.available] = 0x0000;
+ }
+
+ /* Release the cloned bundle, if we cloned it. */
+ u_locbund_close(&outStr.fBundle);
+
+ /* parsing error */
+ if (result < 0) {
+ return result;
+ }
+ /* return # of UChars written */
+ return written;
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
diff --git a/contrib/libs/icu/io/sscanf.cpp b/contrib/libs/icu/io/sscanf.cpp
index 9fac103b07..47c0bace27 100644
--- a/contrib/libs/icu/io/sscanf.cpp
+++ b/contrib/libs/icu/io/sscanf.cpp
@@ -1,130 +1,130 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 2000-2014, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-*
-* File sscanf.c
-*
-* Modification History:
-*
-* Date Name Description
-* 02/08/00 george Creation. Copied from uscanf.c
-******************************************************************************
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION
-
-#include "unicode/putil.h"
-#include "unicode/ustdio.h"
-#include "unicode/ustring.h"
-#include "uscanf.h"
-#include "ufile.h"
-#include "ufmt_cmn.h"
-
-#include "cmemory.h"
-#include "cstring.h"
-
-
-U_CAPI int32_t U_EXPORT2
-u_sscanf(const UChar *buffer,
- const char *patternSpecification,
- ... )
-{
- va_list ap;
- int32_t converted;
-
- va_start(ap, patternSpecification);
- converted = u_vsscanf(buffer, patternSpecification, ap);
- va_end(ap);
-
- return converted;
-}
-
-U_CAPI int32_t U_EXPORT2
-u_sscanf_u(const UChar *buffer,
- const UChar *patternSpecification,
- ... )
-{
- va_list ap;
- int32_t converted;
-
- va_start(ap, patternSpecification);
- converted = u_vsscanf_u(buffer, patternSpecification, ap);
- va_end(ap);
-
- return converted;
-}
-
-U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_vsscanf(const UChar *buffer,
- const char *patternSpecification,
- va_list ap)
-{
- int32_t converted;
- UChar *pattern;
- UChar patBuffer[UFMT_DEFAULT_BUFFER_SIZE];
- int32_t size = (int32_t)uprv_strlen(patternSpecification) + 1;
-
- /* convert from the default codepage to Unicode */
- if (size >= (int32_t)MAX_UCHAR_BUFFER_SIZE(patBuffer)) {
- pattern = (UChar *)uprv_malloc(size * sizeof(UChar));
- if(pattern == 0) {
- return 0;
- }
- }
- else {
- pattern = patBuffer;
- }
- u_charsToUChars(patternSpecification, pattern, size);
-
- /* do the work */
- converted = u_vsscanf_u(buffer, pattern, ap);
-
- /* clean up */
- if (pattern != patBuffer) {
- uprv_free(pattern);
- }
-
- return converted;
-}
-
-U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_vsscanf_u(const UChar *buffer,
- const UChar *patternSpecification,
- va_list ap)
-{
- int32_t converted;
- UFILE inStr;
-
- inStr.fConverter = NULL;
- inStr.fFile = NULL;
- inStr.fOwnFile = FALSE;
-#if !UCONFIG_NO_TRANSLITERATION
- inStr.fTranslit = NULL;
-#endif
- inStr.fUCBuffer[0] = 0;
- inStr.str.fBuffer = (UChar *)buffer;
- inStr.str.fPos = (UChar *)buffer;
- inStr.str.fLimit = buffer + u_strlen(buffer);
-
- if(u_locbund_init(&inStr.str.fBundle, "en_US_POSIX") == 0) {
- return 0;
- }
-
- converted = u_scanf_parse(&inStr, patternSpecification, ap);
-
- u_locbund_close(&inStr.str.fBundle);
-
- /* return # of items converted */
- return converted;
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
-
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 2000-2014, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+*
+* File sscanf.c
+*
+* Modification History:
+*
+* Date Name Description
+* 02/08/00 george Creation. Copied from uscanf.c
+******************************************************************************
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION
+
+#include "unicode/putil.h"
+#include "unicode/ustdio.h"
+#include "unicode/ustring.h"
+#include "uscanf.h"
+#include "ufile.h"
+#include "ufmt_cmn.h"
+
+#include "cmemory.h"
+#include "cstring.h"
+
+
+U_CAPI int32_t U_EXPORT2
+u_sscanf(const UChar *buffer,
+ const char *patternSpecification,
+ ... )
+{
+ va_list ap;
+ int32_t converted;
+
+ va_start(ap, patternSpecification);
+ converted = u_vsscanf(buffer, patternSpecification, ap);
+ va_end(ap);
+
+ return converted;
+}
+
+U_CAPI int32_t U_EXPORT2
+u_sscanf_u(const UChar *buffer,
+ const UChar *patternSpecification,
+ ... )
+{
+ va_list ap;
+ int32_t converted;
+
+ va_start(ap, patternSpecification);
+ converted = u_vsscanf_u(buffer, patternSpecification, ap);
+ va_end(ap);
+
+ return converted;
+}
+
+U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_vsscanf(const UChar *buffer,
+ const char *patternSpecification,
+ va_list ap)
+{
+ int32_t converted;
+ UChar *pattern;
+ UChar patBuffer[UFMT_DEFAULT_BUFFER_SIZE];
+ int32_t size = (int32_t)uprv_strlen(patternSpecification) + 1;
+
+ /* convert from the default codepage to Unicode */
+ if (size >= (int32_t)MAX_UCHAR_BUFFER_SIZE(patBuffer)) {
+ pattern = (UChar *)uprv_malloc(size * sizeof(UChar));
+ if(pattern == 0) {
+ return 0;
+ }
+ }
+ else {
+ pattern = patBuffer;
+ }
+ u_charsToUChars(patternSpecification, pattern, size);
+
+ /* do the work */
+ converted = u_vsscanf_u(buffer, pattern, ap);
+
+ /* clean up */
+ if (pattern != patBuffer) {
+ uprv_free(pattern);
+ }
+
+ return converted;
+}
+
+U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_vsscanf_u(const UChar *buffer,
+ const UChar *patternSpecification,
+ va_list ap)
+{
+ int32_t converted;
+ UFILE inStr;
+
+ inStr.fConverter = NULL;
+ inStr.fFile = NULL;
+ inStr.fOwnFile = FALSE;
+#if !UCONFIG_NO_TRANSLITERATION
+ inStr.fTranslit = NULL;
+#endif
+ inStr.fUCBuffer[0] = 0;
+ inStr.str.fBuffer = (UChar *)buffer;
+ inStr.str.fPos = (UChar *)buffer;
+ inStr.str.fLimit = buffer + u_strlen(buffer);
+
+ if(u_locbund_init(&inStr.str.fBundle, "en_US_POSIX") == 0) {
+ return 0;
+ }
+
+ converted = u_scanf_parse(&inStr, patternSpecification, ap);
+
+ u_locbund_close(&inStr.str.fBundle);
+
+ /* return # of items converted */
+ return converted;
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
diff --git a/contrib/libs/icu/io/ucln_io.cpp b/contrib/libs/icu/io/ucln_io.cpp
index 4dd7d6b0f5..5cd367cfad 100644
--- a/contrib/libs/icu/io/ucln_io.cpp
+++ b/contrib/libs/icu/io/ucln_io.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
* *
******************************************************************************
* file name: ucln_io.cpp
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -16,7 +16,7 @@
* created by: George Rhoten
*/
-#include "unicode/utypes.h"
+#include "unicode/utypes.h"
#include "mutex.h"
#include "ucln.h"
#include "ucln_io.h"
diff --git a/contrib/libs/icu/io/ucln_io.h b/contrib/libs/icu/io/ucln_io.h
index 52207bb686..20dcb88ac7 100644
--- a/contrib/libs/icu/io/ucln_io.h
+++ b/contrib/libs/icu/io/ucln_io.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
* *
******************************************************************************
* file name: ucln_io.h
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/contrib/libs/icu/io/ufile.cpp b/contrib/libs/icu/io/ufile.cpp
index 7d07c10389..1d8c221cdc 100644
--- a/contrib/libs/icu/io/ufile.cpp
+++ b/contrib/libs/icu/io/ufile.cpp
@@ -1,343 +1,343 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 1998-2015, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-*
-* File ufile.cpp
-*
-* Modification History:
-*
-* Date Name Description
-* 11/19/98 stephen Creation.
-* 03/12/99 stephen Modified for new C API.
-* 06/16/99 stephen Changed T_LocaleBundle to u_locbund
-* 07/19/99 stephen Fixed to use ucnv's default codepage.
-******************************************************************************
-*/
-
-#include "unicode/platform.h"
-#if defined(__GNUC__) && !defined(__clang__) && defined(__STRICT_ANSI__)
-// g++, fileno isn't defined if __STRICT_ANSI__ is defined.
-// clang fails to compile the <string> header unless __STRICT_ANSI__ is defined.
-// __GNUC__ is set by both gcc and clang.
-#undef __STRICT_ANSI__
-#endif
-
-#include "locmap.h"
-#include "unicode/ustdio.h"
-
-#if !UCONFIG_NO_CONVERSION
-
-#include <stdlib.h>
-
-#include "ufile.h"
-#include "unicode/uloc.h"
-#include "unicode/ures.h"
-#include "unicode/ucnv.h"
-#include "unicode/ustring.h"
-#include "cstring.h"
-#include "cmemory.h"
-
-#if U_PLATFORM_USES_ONLY_WIN32_API && !defined(fileno)
-/* Windows likes to rename Unix-like functions */
-#define fileno _fileno
-#endif
-
-static UFILE*
-finit_owner(FILE *f,
- const char *locale,
- const char *codepage,
- UBool takeOwnership
- )
-{
- UErrorCode status = U_ZERO_ERROR;
- UFILE *result;
- if(f == NULL) {
- return 0;
- }
- result = (UFILE*) uprv_malloc(sizeof(UFILE));
- if(result == NULL) {
- return 0;
- }
-
- uprv_memset(result, 0, sizeof(UFILE));
- result->fFileno = fileno(f);
- result->fFile = f;
-
- result->str.fBuffer = result->fUCBuffer;
- result->str.fPos = result->fUCBuffer;
- result->str.fLimit = result->fUCBuffer;
-
-#if !UCONFIG_NO_FORMATTING
- /* if locale is 0, use the default */
- if(u_locbund_init(&result->str.fBundle, locale) == 0) {
- /* DO NOT FCLOSE HERE! */
- uprv_free(result);
- return 0;
- }
-#endif
-
- /* If the codepage is not "" use the ucnv_open default behavior */
- if(codepage == NULL || *codepage != '\0') {
- result->fConverter = ucnv_open(codepage, &status);
- }
- /* else result->fConverter is already memset'd to NULL. */
-
- if(U_SUCCESS(status)) {
- result->fOwnFile = takeOwnership;
- }
- else {
-#if !UCONFIG_NO_FORMATTING
- u_locbund_close(&result->str.fBundle);
-#endif
- /* DO NOT fclose here!!!!!! */
- uprv_free(result);
- result = NULL;
- }
-
- return result;
-}
-
-U_CAPI UFILE* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_finit(FILE *f,
- const char *locale,
- const char *codepage)
-{
- return finit_owner(f, locale, codepage, FALSE);
-}
-
-U_CAPI UFILE* U_EXPORT2
-u_fadopt(FILE *f,
- const char *locale,
- const char *codepage)
-{
- return finit_owner(f, locale, codepage, TRUE);
-}
-
-U_CAPI UFILE* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_fopen(const char *filename,
- const char *perm,
- const char *locale,
- const char *codepage)
-{
- UFILE *result;
- FILE *systemFile = fopen(filename, perm);
- if(systemFile == 0) {
- return 0;
- }
-
- result = finit_owner(systemFile, locale, codepage, TRUE);
-
- if (!result) {
- /* Something bad happened.
- Maybe the converter couldn't be opened. */
- fclose(systemFile);
- }
-
- return result; /* not a file leak */
-}
-
-U_CAPI UFILE* U_EXPORT2
-u_fopen_u(const UChar *filename,
- const char *perm,
- const char *locale,
- const char *codepage)
-{
- UFILE *result;
- char buffer[256];
-
- u_austrcpy(buffer, filename);
-
- result = u_fopen(buffer, perm, locale, codepage);
-#if U_PLATFORM_USES_ONLY_WIN32_API
- /* Try Windows API _wfopen if the above fails. */
- if (!result) {
- // TODO: test this code path, including wperm.
- wchar_t wperm[40] = {};
- size_t retVal;
- mbstowcs_s(&retVal, wperm, UPRV_LENGTHOF(wperm), perm, _TRUNCATE);
- FILE *systemFile = _wfopen((const wchar_t *)filename, wperm);
- if (systemFile) {
- result = finit_owner(systemFile, locale, codepage, TRUE);
- }
- if (!result) {
- /* Something bad happened.
- Maybe the converter couldn't be opened. */
- fclose(systemFile);
- }
- }
-#endif
- return result; /* not a file leak */
-}
-
-U_CAPI UFILE* U_EXPORT2
-u_fstropen(UChar *stringBuf,
- int32_t capacity,
- const char *locale)
-{
- UFILE *result;
-
- if (capacity < 0) {
- return NULL;
- }
-
- result = (UFILE*) uprv_malloc(sizeof(UFILE));
- /* Null pointer test */
- if (result == NULL) {
- return NULL; /* Just get out. */
- }
- uprv_memset(result, 0, sizeof(UFILE));
- result->str.fBuffer = stringBuf;
- result->str.fPos = stringBuf;
- result->str.fLimit = stringBuf+capacity;
-
-#if !UCONFIG_NO_FORMATTING
- /* if locale is 0, use the default */
- if(u_locbund_init(&result->str.fBundle, locale) == 0) {
- /* DO NOT FCLOSE HERE! */
- uprv_free(result);
- return 0;
- }
-#endif
-
- return result;
-}
-
-U_CAPI UBool U_EXPORT2
-u_feof(UFILE *f)
-{
- UBool endOfBuffer;
- if (f == NULL) {
- return TRUE;
- }
- endOfBuffer = (UBool)(f->str.fPos >= f->str.fLimit);
- if (f->fFile != NULL) {
- return endOfBuffer && feof(f->fFile);
- }
- return endOfBuffer;
-}
-
-U_CAPI void U_EXPORT2
-u_fflush(UFILE *file)
-{
- ufile_flush_translit(file);
- ufile_flush_io(file);
- if (file->fFile) {
- fflush(file->fFile);
- }
- else if (file->str.fPos < file->str.fLimit) {
- *(file->str.fPos++) = 0;
- }
- /* TODO: flush input */
-}
-
-U_CAPI void
-u_frewind(UFILE *file)
-{
- u_fflush(file);
- ucnv_reset(file->fConverter);
- if (file->fFile) {
- rewind(file->fFile);
- file->str.fLimit = file->fUCBuffer;
- file->str.fPos = file->fUCBuffer;
- }
- else {
- file->str.fPos = file->str.fBuffer;
- }
-}
-
-U_CAPI void U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_fclose(UFILE *file)
-{
- if (file) {
- u_fflush(file);
- ufile_close_translit(file);
-
- if(file->fOwnFile)
- fclose(file->fFile);
-
-#if !UCONFIG_NO_FORMATTING
- u_locbund_close(&file->str.fBundle);
-#endif
-
- ucnv_close(file->fConverter);
- uprv_free(file);
- }
-}
-
-U_CAPI FILE* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_fgetfile( UFILE *f)
-{
- return f->fFile;
-}
-
-#if !UCONFIG_NO_FORMATTING
-
-U_CAPI const char* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_fgetlocale( UFILE *file)
-{
- return file->str.fBundle.fLocale;
-}
-
-U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_fsetlocale(UFILE *file,
- const char *locale)
-{
- u_locbund_close(&file->str.fBundle);
-
- return u_locbund_init(&file->str.fBundle, locale) == 0 ? -1 : 0;
-}
-
-#endif
-
-U_CAPI const char* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_fgetcodepage(UFILE *file)
-{
- UErrorCode status = U_ZERO_ERROR;
- const char *codepage = NULL;
-
- if (file->fConverter) {
- codepage = ucnv_getName(file->fConverter, &status);
- if(U_FAILURE(status))
- return 0;
- }
- return codepage;
-}
-
-U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_fsetcodepage( const char *codepage,
- UFILE *file)
-{
- UErrorCode status = U_ZERO_ERROR;
- int32_t retVal = -1;
-
- /* We use the normal default codepage for this system, and not the one for the locale. */
- if ((file->str.fPos == file->str.fBuffer) && (file->str.fLimit == file->str.fBuffer)) {
- ucnv_close(file->fConverter);
- file->fConverter = ucnv_open(codepage, &status);
- if(U_SUCCESS(status)) {
- retVal = 0;
- }
- }
- return retVal;
-}
-
-
-U_CAPI UConverter * U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_fgetConverter(UFILE *file)
-{
- return file->fConverter;
-}
-#if !UCONFIG_NO_FORMATTING
-U_CAPI const UNumberFormat* U_EXPORT2 u_fgetNumberFormat(UFILE *file)
-{
- return u_locbund_getNumberFormat(&file->str.fBundle, UNUM_DECIMAL);
-}
-#endif
-
-#endif
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 1998-2015, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+*
+* File ufile.cpp
+*
+* Modification History:
+*
+* Date Name Description
+* 11/19/98 stephen Creation.
+* 03/12/99 stephen Modified for new C API.
+* 06/16/99 stephen Changed T_LocaleBundle to u_locbund
+* 07/19/99 stephen Fixed to use ucnv's default codepage.
+******************************************************************************
+*/
+
+#include "unicode/platform.h"
+#if defined(__GNUC__) && !defined(__clang__) && defined(__STRICT_ANSI__)
+// g++, fileno isn't defined if __STRICT_ANSI__ is defined.
+// clang fails to compile the <string> header unless __STRICT_ANSI__ is defined.
+// __GNUC__ is set by both gcc and clang.
+#undef __STRICT_ANSI__
+#endif
+
+#include "locmap.h"
+#include "unicode/ustdio.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include <stdlib.h>
+
+#include "ufile.h"
+#include "unicode/uloc.h"
+#include "unicode/ures.h"
+#include "unicode/ucnv.h"
+#include "unicode/ustring.h"
+#include "cstring.h"
+#include "cmemory.h"
+
+#if U_PLATFORM_USES_ONLY_WIN32_API && !defined(fileno)
+/* Windows likes to rename Unix-like functions */
+#define fileno _fileno
+#endif
+
+static UFILE*
+finit_owner(FILE *f,
+ const char *locale,
+ const char *codepage,
+ UBool takeOwnership
+ )
+{
+ UErrorCode status = U_ZERO_ERROR;
+ UFILE *result;
+ if(f == NULL) {
+ return 0;
+ }
+ result = (UFILE*) uprv_malloc(sizeof(UFILE));
+ if(result == NULL) {
+ return 0;
+ }
+
+ uprv_memset(result, 0, sizeof(UFILE));
+ result->fFileno = fileno(f);
+ result->fFile = f;
+
+ result->str.fBuffer = result->fUCBuffer;
+ result->str.fPos = result->fUCBuffer;
+ result->str.fLimit = result->fUCBuffer;
+
+#if !UCONFIG_NO_FORMATTING
+ /* if locale is 0, use the default */
+ if(u_locbund_init(&result->str.fBundle, locale) == 0) {
+ /* DO NOT FCLOSE HERE! */
+ uprv_free(result);
+ return 0;
+ }
+#endif
+
+ /* If the codepage is not "" use the ucnv_open default behavior */
+ if(codepage == NULL || *codepage != '\0') {
+ result->fConverter = ucnv_open(codepage, &status);
+ }
+ /* else result->fConverter is already memset'd to NULL. */
+
+ if(U_SUCCESS(status)) {
+ result->fOwnFile = takeOwnership;
+ }
+ else {
+#if !UCONFIG_NO_FORMATTING
+ u_locbund_close(&result->str.fBundle);
+#endif
+ /* DO NOT fclose here!!!!!! */
+ uprv_free(result);
+ result = NULL;
+ }
+
+ return result;
+}
+
+U_CAPI UFILE* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_finit(FILE *f,
+ const char *locale,
+ const char *codepage)
+{
+ return finit_owner(f, locale, codepage, FALSE);
+}
+
+U_CAPI UFILE* U_EXPORT2
+u_fadopt(FILE *f,
+ const char *locale,
+ const char *codepage)
+{
+ return finit_owner(f, locale, codepage, TRUE);
+}
+
+U_CAPI UFILE* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_fopen(const char *filename,
+ const char *perm,
+ const char *locale,
+ const char *codepage)
+{
+ UFILE *result;
+ FILE *systemFile = fopen(filename, perm);
+ if(systemFile == 0) {
+ return 0;
+ }
+
+ result = finit_owner(systemFile, locale, codepage, TRUE);
+
+ if (!result) {
+ /* Something bad happened.
+ Maybe the converter couldn't be opened. */
+ fclose(systemFile);
+ }
+
+ return result; /* not a file leak */
+}
+
+U_CAPI UFILE* U_EXPORT2
+u_fopen_u(const UChar *filename,
+ const char *perm,
+ const char *locale,
+ const char *codepage)
+{
+ UFILE *result;
+ char buffer[256];
+
+ u_austrcpy(buffer, filename);
+
+ result = u_fopen(buffer, perm, locale, codepage);
+#if U_PLATFORM_USES_ONLY_WIN32_API
+ /* Try Windows API _wfopen if the above fails. */
+ if (!result) {
+ // TODO: test this code path, including wperm.
+ wchar_t wperm[40] = {};
+ size_t retVal;
+ mbstowcs_s(&retVal, wperm, UPRV_LENGTHOF(wperm), perm, _TRUNCATE);
+ FILE *systemFile = _wfopen((const wchar_t *)filename, wperm);
+ if (systemFile) {
+ result = finit_owner(systemFile, locale, codepage, TRUE);
+ }
+ if (!result) {
+ /* Something bad happened.
+ Maybe the converter couldn't be opened. */
+ fclose(systemFile);
+ }
+ }
+#endif
+ return result; /* not a file leak */
+}
+
+U_CAPI UFILE* U_EXPORT2
+u_fstropen(UChar *stringBuf,
+ int32_t capacity,
+ const char *locale)
+{
+ UFILE *result;
+
+ if (capacity < 0) {
+ return NULL;
+ }
+
+ result = (UFILE*) uprv_malloc(sizeof(UFILE));
+ /* Null pointer test */
+ if (result == NULL) {
+ return NULL; /* Just get out. */
+ }
+ uprv_memset(result, 0, sizeof(UFILE));
+ result->str.fBuffer = stringBuf;
+ result->str.fPos = stringBuf;
+ result->str.fLimit = stringBuf+capacity;
+
+#if !UCONFIG_NO_FORMATTING
+ /* if locale is 0, use the default */
+ if(u_locbund_init(&result->str.fBundle, locale) == 0) {
+ /* DO NOT FCLOSE HERE! */
+ uprv_free(result);
+ return 0;
+ }
+#endif
+
+ return result;
+}
+
+U_CAPI UBool U_EXPORT2
+u_feof(UFILE *f)
+{
+ UBool endOfBuffer;
+ if (f == NULL) {
+ return TRUE;
+ }
+ endOfBuffer = (UBool)(f->str.fPos >= f->str.fLimit);
+ if (f->fFile != NULL) {
+ return endOfBuffer && feof(f->fFile);
+ }
+ return endOfBuffer;
+}
+
+U_CAPI void U_EXPORT2
+u_fflush(UFILE *file)
+{
+ ufile_flush_translit(file);
+ ufile_flush_io(file);
+ if (file->fFile) {
+ fflush(file->fFile);
+ }
+ else if (file->str.fPos < file->str.fLimit) {
+ *(file->str.fPos++) = 0;
+ }
+ /* TODO: flush input */
+}
+
+U_CAPI void
+u_frewind(UFILE *file)
+{
+ u_fflush(file);
+ ucnv_reset(file->fConverter);
+ if (file->fFile) {
+ rewind(file->fFile);
+ file->str.fLimit = file->fUCBuffer;
+ file->str.fPos = file->fUCBuffer;
+ }
+ else {
+ file->str.fPos = file->str.fBuffer;
+ }
+}
+
+U_CAPI void U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_fclose(UFILE *file)
+{
+ if (file) {
+ u_fflush(file);
+ ufile_close_translit(file);
+
+ if(file->fOwnFile)
+ fclose(file->fFile);
+
+#if !UCONFIG_NO_FORMATTING
+ u_locbund_close(&file->str.fBundle);
+#endif
+
+ ucnv_close(file->fConverter);
+ uprv_free(file);
+ }
+}
+
+U_CAPI FILE* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_fgetfile( UFILE *f)
+{
+ return f->fFile;
+}
+
+#if !UCONFIG_NO_FORMATTING
+
+U_CAPI const char* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_fgetlocale( UFILE *file)
+{
+ return file->str.fBundle.fLocale;
+}
+
+U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_fsetlocale(UFILE *file,
+ const char *locale)
+{
+ u_locbund_close(&file->str.fBundle);
+
+ return u_locbund_init(&file->str.fBundle, locale) == 0 ? -1 : 0;
+}
+
+#endif
+
+U_CAPI const char* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_fgetcodepage(UFILE *file)
+{
+ UErrorCode status = U_ZERO_ERROR;
+ const char *codepage = NULL;
+
+ if (file->fConverter) {
+ codepage = ucnv_getName(file->fConverter, &status);
+ if(U_FAILURE(status))
+ return 0;
+ }
+ return codepage;
+}
+
+U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_fsetcodepage( const char *codepage,
+ UFILE *file)
+{
+ UErrorCode status = U_ZERO_ERROR;
+ int32_t retVal = -1;
+
+ /* We use the normal default codepage for this system, and not the one for the locale. */
+ if ((file->str.fPos == file->str.fBuffer) && (file->str.fLimit == file->str.fBuffer)) {
+ ucnv_close(file->fConverter);
+ file->fConverter = ucnv_open(codepage, &status);
+ if(U_SUCCESS(status)) {
+ retVal = 0;
+ }
+ }
+ return retVal;
+}
+
+
+U_CAPI UConverter * U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_fgetConverter(UFILE *file)
+{
+ return file->fConverter;
+}
+#if !UCONFIG_NO_FORMATTING
+U_CAPI const UNumberFormat* U_EXPORT2 u_fgetNumberFormat(UFILE *file)
+{
+ return u_locbund_getNumberFormat(&file->str.fBundle, UNUM_DECIMAL);
+}
+#endif
+
+#endif
diff --git a/contrib/libs/icu/io/ufile.h b/contrib/libs/icu/io/ufile.h
index 498e5689cf..e85208fcd3 100644
--- a/contrib/libs/icu/io/ufile.h
+++ b/contrib/libs/icu/io/ufile.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@@ -25,8 +25,8 @@
#if !UCONFIG_NO_CONVERSION
-#include <stdio.h>
-
+#include <stdio.h>
+
#include "unicode/ucnv.h"
#include "unicode/utrans.h"
#include "locbund.h"
diff --git a/contrib/libs/icu/io/ufmt_cmn.cpp b/contrib/libs/icu/io/ufmt_cmn.cpp
index ad6f4afc75..0b6c18ff96 100644
--- a/contrib/libs/icu/io/ufmt_cmn.cpp
+++ b/contrib/libs/icu/io/ufmt_cmn.cpp
@@ -1,259 +1,259 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 1998-2014, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-*
-* File ufmt_cmn.c
-*
-* Modification History:
-*
-* Date Name Description
-* 12/02/98 stephen Creation.
-* 03/12/99 stephen Modified for new C API.
-* 03/15/99 stephen Added defaultCPToUnicode, unicodeToDefaultCP
-* 07/19/99 stephen Fixed bug in defaultCPToUnicode
-******************************************************************************
-*/
-
-#include "cstring.h"
-#include "cmemory.h"
-#include "ufmt_cmn.h"
-#include "unicode/uchar.h"
-#include "unicode/ucnv.h"
-#include "ustr_cnv.h"
-
-#if !UCONFIG_NO_CONVERSION
-
-
-#define DIGIT_0 0x0030
-#define DIGIT_9 0x0039
-#define LOWERCASE_A 0x0061
-#define UPPERCASE_A 0x0041
-#define LOWERCASE_Z 0x007A
-#define UPPERCASE_Z 0x005A
-
-int
-ufmt_digitvalue(UChar c)
-{
- if( ((c>=DIGIT_0)&&(c<=DIGIT_9)) ||
- ((c>=LOWERCASE_A)&&(c<=LOWERCASE_Z)) ||
- ((c>=UPPERCASE_A)&&(c<=UPPERCASE_Z)) )
- {
- return c - DIGIT_0 - (c >= 0x0041 ? (c >= 0x0061 ? 39 : 7) : 0);
- }
- else
- {
- return -1;
- }
-}
-
-UBool
-ufmt_isdigit(UChar c,
- int32_t radix)
-{
- int digitVal = ufmt_digitvalue(c);
-
- return (UBool)(digitVal < radix && digitVal >= 0);
-}
-
-#define TO_UC_DIGIT(a) a <= 9 ? (DIGIT_0 + a) : (0x0037 + a)
-#define TO_LC_DIGIT(a) a <= 9 ? (DIGIT_0 + a) : (0x0057 + a)
-
-void
-ufmt_64tou(UChar *buffer,
- int32_t *len,
- uint64_t value,
- uint8_t radix,
- UBool uselower,
- int32_t minDigits)
-{
- int32_t length = 0;
- uint32_t digit;
- UChar *left, *right, temp;
-
- do {
- digit = (uint32_t)(value % radix);
- value = value / radix;
- buffer[length++] = (UChar)(uselower ? TO_LC_DIGIT(digit)
- : TO_UC_DIGIT(digit));
- } while(value);
-
- /* pad with zeroes to make it minDigits long */
- if(minDigits != -1 && length < minDigits) {
- while(length < minDigits && length < *len)
- buffer[length++] = DIGIT_0; /*zero padding */
- }
-
- /* reverse the buffer */
- left = buffer;
- right = buffer + length;
- while(left < --right) {
- temp = *left;
- *left++ = *right;
- *right = temp;
- }
-
- *len = length;
-}
-
-void
-ufmt_ptou(UChar *buffer,
- int32_t *len,
- void *value,
- UBool uselower)
-{
- int32_t i;
- int32_t length = 0;
- uint8_t *ptrIdx = (uint8_t *)&value;
-
-#if U_IS_BIG_ENDIAN
- for (i = 0; i < (int32_t)sizeof(void *); i++)
-#else
- for (i = (int32_t)sizeof(void *)-1; i >= 0 ; i--)
-#endif
- {
- uint8_t byteVal = ptrIdx[i];
- uint16_t firstNibble = (uint16_t)(byteVal>>4);
- uint16_t secondNibble = (uint16_t)(byteVal&0xF);
- if (uselower) {
- buffer[length++]=TO_LC_DIGIT(firstNibble);
- buffer[length++]=TO_LC_DIGIT(secondNibble);
- }
- else {
- buffer[length++]=TO_UC_DIGIT(firstNibble);
- buffer[length++]=TO_UC_DIGIT(secondNibble);
- }
- }
-
- *len = length;
-}
-
-int64_t
-ufmt_uto64(const UChar *buffer,
- int32_t *len,
- int8_t radix)
-{
- const UChar *limit;
- int32_t count;
- uint64_t result;
-
-
- /* intialize parameters */
- limit = buffer + *len;
- count = 0;
- result = 0;
-
- /* iterate through buffer */
- while(ufmt_isdigit(*buffer, radix) && buffer < limit) {
-
- /* read the next digit */
- result *= radix;
- result += ufmt_digitvalue(*buffer++);
-
- /* increment our count */
- ++count;
- }
-
- *len = count;
- return static_cast<int64_t>(result);
-}
-
-#define NIBBLE_PER_BYTE 2
-void *
-ufmt_utop(const UChar *buffer,
- int32_t *len)
-{
- int32_t count, resultIdx, incVal, offset;
- /* This union allows the pointer to be written as an array. */
- union {
- void *ptr;
- uint8_t bytes[sizeof(void*)];
- } result;
-
- /* intialize variables */
- count = 0;
- offset = 0;
- result.ptr = NULL;
-
- /* Skip the leading zeros */
- while(buffer[count] == DIGIT_0 || u_isspace(buffer[count])) {
- count++;
- offset++;
- }
-
- /* iterate through buffer, stop when you hit the end */
- while(count < *len && ufmt_isdigit(buffer[count], 16)) {
- /* increment the count consumed */
- ++count;
- }
-
- /* detect overflow */
- if (count - offset > (int32_t)(sizeof(void*)*NIBBLE_PER_BYTE)) {
- offset = count - (int32_t)(sizeof(void*)*NIBBLE_PER_BYTE);
- }
-
- /* Initialize the direction of the input */
-#if U_IS_BIG_ENDIAN
- incVal = -1;
- resultIdx = (int32_t)(sizeof(void*) - 1);
-#else
- incVal = 1;
- resultIdx = 0;
-#endif
- /* Write how much was consumed. */
- *len = count;
- while(--count >= offset) {
- /* Get the first nibble of the byte */
- uint8_t byte = (uint8_t)ufmt_digitvalue(buffer[count]);
-
- if (count > offset) {
- /* Get the second nibble of the byte when available */
- byte = (uint8_t)(byte + (ufmt_digitvalue(buffer[--count]) << 4));
- }
- /* Write the byte into the array */
- result.bytes[resultIdx] = byte;
- resultIdx += incVal;
- }
-
- return result.ptr;
-}
-
-UChar*
-ufmt_defaultCPToUnicode(const char *s, int32_t sSize,
- UChar *target, int32_t tSize)
-{
- UChar *alias;
- UErrorCode status = U_ZERO_ERROR;
- UConverter *defConverter = u_getDefaultConverter(&status);
-
- if(U_FAILURE(status) || defConverter == 0)
- return 0;
-
- if(sSize <= 0) {
- sSize = static_cast<int32_t>(uprv_strlen(s)) + 1;
- }
-
- /* perform the conversion in one swoop */
- if(target != 0) {
-
- alias = target;
- ucnv_toUnicode(defConverter, &alias, alias + tSize, &s, s + sSize - 1,
- NULL, TRUE, &status);
-
-
- /* add the null terminator */
- *alias = 0x0000;
- }
-
- u_releaseDefaultConverter(defConverter);
-
- return target;
-}
-
-
-#endif
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 1998-2014, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+*
+* File ufmt_cmn.c
+*
+* Modification History:
+*
+* Date Name Description
+* 12/02/98 stephen Creation.
+* 03/12/99 stephen Modified for new C API.
+* 03/15/99 stephen Added defaultCPToUnicode, unicodeToDefaultCP
+* 07/19/99 stephen Fixed bug in defaultCPToUnicode
+******************************************************************************
+*/
+
+#include "cstring.h"
+#include "cmemory.h"
+#include "ufmt_cmn.h"
+#include "unicode/uchar.h"
+#include "unicode/ucnv.h"
+#include "ustr_cnv.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+
+#define DIGIT_0 0x0030
+#define DIGIT_9 0x0039
+#define LOWERCASE_A 0x0061
+#define UPPERCASE_A 0x0041
+#define LOWERCASE_Z 0x007A
+#define UPPERCASE_Z 0x005A
+
+int
+ufmt_digitvalue(UChar c)
+{
+ if( ((c>=DIGIT_0)&&(c<=DIGIT_9)) ||
+ ((c>=LOWERCASE_A)&&(c<=LOWERCASE_Z)) ||
+ ((c>=UPPERCASE_A)&&(c<=UPPERCASE_Z)) )
+ {
+ return c - DIGIT_0 - (c >= 0x0041 ? (c >= 0x0061 ? 39 : 7) : 0);
+ }
+ else
+ {
+ return -1;
+ }
+}
+
+UBool
+ufmt_isdigit(UChar c,
+ int32_t radix)
+{
+ int digitVal = ufmt_digitvalue(c);
+
+ return (UBool)(digitVal < radix && digitVal >= 0);
+}
+
+#define TO_UC_DIGIT(a) a <= 9 ? (DIGIT_0 + a) : (0x0037 + a)
+#define TO_LC_DIGIT(a) a <= 9 ? (DIGIT_0 + a) : (0x0057 + a)
+
+void
+ufmt_64tou(UChar *buffer,
+ int32_t *len,
+ uint64_t value,
+ uint8_t radix,
+ UBool uselower,
+ int32_t minDigits)
+{
+ int32_t length = 0;
+ uint32_t digit;
+ UChar *left, *right, temp;
+
+ do {
+ digit = (uint32_t)(value % radix);
+ value = value / radix;
+ buffer[length++] = (UChar)(uselower ? TO_LC_DIGIT(digit)
+ : TO_UC_DIGIT(digit));
+ } while(value);
+
+ /* pad with zeroes to make it minDigits long */
+ if(minDigits != -1 && length < minDigits) {
+ while(length < minDigits && length < *len)
+ buffer[length++] = DIGIT_0; /*zero padding */
+ }
+
+ /* reverse the buffer */
+ left = buffer;
+ right = buffer + length;
+ while(left < --right) {
+ temp = *left;
+ *left++ = *right;
+ *right = temp;
+ }
+
+ *len = length;
+}
+
+void
+ufmt_ptou(UChar *buffer,
+ int32_t *len,
+ void *value,
+ UBool uselower)
+{
+ int32_t i;
+ int32_t length = 0;
+ uint8_t *ptrIdx = (uint8_t *)&value;
+
+#if U_IS_BIG_ENDIAN
+ for (i = 0; i < (int32_t)sizeof(void *); i++)
+#else
+ for (i = (int32_t)sizeof(void *)-1; i >= 0 ; i--)
+#endif
+ {
+ uint8_t byteVal = ptrIdx[i];
+ uint16_t firstNibble = (uint16_t)(byteVal>>4);
+ uint16_t secondNibble = (uint16_t)(byteVal&0xF);
+ if (uselower) {
+ buffer[length++]=TO_LC_DIGIT(firstNibble);
+ buffer[length++]=TO_LC_DIGIT(secondNibble);
+ }
+ else {
+ buffer[length++]=TO_UC_DIGIT(firstNibble);
+ buffer[length++]=TO_UC_DIGIT(secondNibble);
+ }
+ }
+
+ *len = length;
+}
+
+int64_t
+ufmt_uto64(const UChar *buffer,
+ int32_t *len,
+ int8_t radix)
+{
+ const UChar *limit;
+ int32_t count;
+ uint64_t result;
+
+
+ /* intialize parameters */
+ limit = buffer + *len;
+ count = 0;
+ result = 0;
+
+ /* iterate through buffer */
+ while(ufmt_isdigit(*buffer, radix) && buffer < limit) {
+
+ /* read the next digit */
+ result *= radix;
+ result += ufmt_digitvalue(*buffer++);
+
+ /* increment our count */
+ ++count;
+ }
+
+ *len = count;
+ return static_cast<int64_t>(result);
+}
+
+#define NIBBLE_PER_BYTE 2
+void *
+ufmt_utop(const UChar *buffer,
+ int32_t *len)
+{
+ int32_t count, resultIdx, incVal, offset;
+ /* This union allows the pointer to be written as an array. */
+ union {
+ void *ptr;
+ uint8_t bytes[sizeof(void*)];
+ } result;
+
+ /* intialize variables */
+ count = 0;
+ offset = 0;
+ result.ptr = NULL;
+
+ /* Skip the leading zeros */
+ while(buffer[count] == DIGIT_0 || u_isspace(buffer[count])) {
+ count++;
+ offset++;
+ }
+
+ /* iterate through buffer, stop when you hit the end */
+ while(count < *len && ufmt_isdigit(buffer[count], 16)) {
+ /* increment the count consumed */
+ ++count;
+ }
+
+ /* detect overflow */
+ if (count - offset > (int32_t)(sizeof(void*)*NIBBLE_PER_BYTE)) {
+ offset = count - (int32_t)(sizeof(void*)*NIBBLE_PER_BYTE);
+ }
+
+ /* Initialize the direction of the input */
+#if U_IS_BIG_ENDIAN
+ incVal = -1;
+ resultIdx = (int32_t)(sizeof(void*) - 1);
+#else
+ incVal = 1;
+ resultIdx = 0;
+#endif
+ /* Write how much was consumed. */
+ *len = count;
+ while(--count >= offset) {
+ /* Get the first nibble of the byte */
+ uint8_t byte = (uint8_t)ufmt_digitvalue(buffer[count]);
+
+ if (count > offset) {
+ /* Get the second nibble of the byte when available */
+ byte = (uint8_t)(byte + (ufmt_digitvalue(buffer[--count]) << 4));
+ }
+ /* Write the byte into the array */
+ result.bytes[resultIdx] = byte;
+ resultIdx += incVal;
+ }
+
+ return result.ptr;
+}
+
+UChar*
+ufmt_defaultCPToUnicode(const char *s, int32_t sSize,
+ UChar *target, int32_t tSize)
+{
+ UChar *alias;
+ UErrorCode status = U_ZERO_ERROR;
+ UConverter *defConverter = u_getDefaultConverter(&status);
+
+ if(U_FAILURE(status) || defConverter == 0)
+ return 0;
+
+ if(sSize <= 0) {
+ sSize = static_cast<int32_t>(uprv_strlen(s)) + 1;
+ }
+
+ /* perform the conversion in one swoop */
+ if(target != 0) {
+
+ alias = target;
+ ucnv_toUnicode(defConverter, &alias, alias + tSize, &s, s + sSize - 1,
+ NULL, TRUE, &status);
+
+
+ /* add the null terminator */
+ *alias = 0x0000;
+ }
+
+ u_releaseDefaultConverter(defConverter);
+
+ return target;
+}
+
+
+#endif
diff --git a/contrib/libs/icu/io/ufmt_cmn.h b/contrib/libs/icu/io/ufmt_cmn.h
index 12194a5818..33b56a0175 100644
--- a/contrib/libs/icu/io/ufmt_cmn.h
+++ b/contrib/libs/icu/io/ufmt_cmn.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -26,7 +26,7 @@
#include "unicode/utf16.h"
#define UFMT_DEFAULT_BUFFER_SIZE 128
-#define MAX_UCHAR_BUFFER_SIZE(buffer) ((int32_t)(sizeof(buffer)/(U16_MAX_LENGTH*sizeof(UChar))))
+#define MAX_UCHAR_BUFFER_SIZE(buffer) ((int32_t)(sizeof(buffer)/(U16_MAX_LENGTH*sizeof(UChar))))
#define MAX_UCHAR_BUFFER_NEEDED(strLen) ((strLen+1)*U16_MAX_LENGTH*sizeof(UChar))
/**
diff --git a/contrib/libs/icu/io/uprintf.cpp b/contrib/libs/icu/io/uprintf.cpp
index 238588a722..3c9effaada 100644
--- a/contrib/libs/icu/io/uprintf.cpp
+++ b/contrib/libs/icu/io/uprintf.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -183,7 +183,7 @@ u_vfprintf( UFILE *f,
else {
pattern = buffer;
}
- u_charsToUChars(patternSpecification, pattern, static_cast<int32_t>(size));
+ u_charsToUChars(patternSpecification, pattern, static_cast<int32_t>(size));
/* do the work */
count = u_vfprintf_u(f, pattern, ap);
diff --git a/contrib/libs/icu/io/uprintf.h b/contrib/libs/icu/io/uprintf.h
index b1aa4930c7..0fd6066e56 100644
--- a/contrib/libs/icu/io/uprintf.h
+++ b/contrib/libs/icu/io/uprintf.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/io/uprntf_p.cpp b/contrib/libs/icu/io/uprntf_p.cpp
index 497e48e0f5..1fbaf06c95 100644
--- a/contrib/libs/icu/io/uprntf_p.cpp
+++ b/contrib/libs/icu/io/uprntf_p.cpp
@@ -1,1606 +1,1606 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 1998-2016, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-*
-* File uprntf_p.c
-*
-* Modification History:
-*
-* Date Name Description
-* 11/23/98 stephen Creation.
-* 03/12/99 stephen Modified for new C API.
-* 08/07/2003 george Reunify printf implementations
-******************************************************************************
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION
-
-#include "unicode/ustring.h"
-#include "unicode/utf16.h"
-#include "uprintf.h"
-#include "ufmt_cmn.h"
-#include "cmemory.h"
-#include "putilimp.h"
-
-/* ANSI style formatting */
-/* Use US-ASCII characters only for formatting */
-
-/* % */
-#define UFMT_SIMPLE_PERCENT {ufmt_simple_percent, u_printf_simple_percent_handler}
-/* s */
-#define UFMT_STRING {ufmt_string, u_printf_string_handler}
-/* c */
-#define UFMT_CHAR {ufmt_char, u_printf_char_handler}
-/* d, i */
-#define UFMT_INT {ufmt_int, u_printf_integer_handler}
-/* u */
-#define UFMT_UINT {ufmt_int, u_printf_uinteger_handler}
-/* o */
-#define UFMT_OCTAL {ufmt_int, u_printf_octal_handler}
-/* x, X */
-#define UFMT_HEX {ufmt_int, u_printf_hex_handler}
-/* f */
-#define UFMT_DOUBLE {ufmt_double, u_printf_double_handler}
-/* e, E */
-#define UFMT_SCIENTIFIC {ufmt_double, u_printf_scientific_handler}
-/* g, G */
-#define UFMT_SCIDBL {ufmt_double, u_printf_scidbl_handler}
-/* n */
-#define UFMT_COUNT {ufmt_count, u_printf_count_handler}
-
-/* non-ANSI extensions */
-/* Use US-ASCII characters only for formatting */
-
-/* p */
-#define UFMT_POINTER {ufmt_pointer, u_printf_pointer_handler}
-/* V */
-#define UFMT_SPELLOUT {ufmt_double, u_printf_spellout_handler}
-/* P */
-#define UFMT_PERCENT {ufmt_double, u_printf_percent_handler}
-/* C K is old format */
-#define UFMT_UCHAR {ufmt_uchar, u_printf_uchar_handler}
-/* S U is old format */
-#define UFMT_USTRING {ufmt_ustring, u_printf_ustring_handler}
-
-
-#define UFMT_EMPTY {ufmt_empty, NULL}
-
-/**
- * A u_printf handler function.
- * A u_printf handler is responsible for handling a single u_printf
- * format specification, for example 'd' or 's'.
- * @param stream The UFILE to which to write output.
- * @param info A pointer to a <TT>u_printf_spec_info</TT> struct containing
- * information on the format specification.
- * @param args A pointer to the argument data
- * @return The number of Unicode characters written to <TT>stream</TT>.
- */
-typedef int32_t U_EXPORT2
-u_printf_handler(const u_printf_stream_handler *handler,
-
- void *context,
- ULocaleBundle *formatBundle,
- const u_printf_spec_info *info,
- const ufmt_args *args);
-
-typedef struct u_printf_info {
- ufmt_type_info info;
- u_printf_handler *handler;
-} u_printf_info;
-
-/**
- * Struct encapsulating a single uprintf format specification.
- */
-typedef struct u_printf_spec {
- u_printf_spec_info fInfo; /* Information on this spec */
- int32_t fWidthPos; /* Position of width in arg list */
- int32_t fPrecisionPos; /* Position of precision in arg list */
- int32_t fArgPos; /* Position of data in arg list */
-} u_printf_spec;
-
-#define UPRINTF_NUM_FMT_HANDLERS 108
-
-/* We do not use handlers for 0-0x1f */
-#define UPRINTF_BASE_FMT_HANDLERS 0x20
-
-/* buffer size for formatting */
-#define UPRINTF_BUFFER_SIZE 1024
-#define UPRINTF_SYMBOL_BUFFER_SIZE 8
-
-static const UChar gNullStr[] = {0x28, 0x6E, 0x75, 0x6C, 0x6C, 0x29, 0}; /* "(null)" */
-static const UChar gSpaceStr[] = {0x20, 0}; /* " " */
-
-/* Sets the sign of a format based on u_printf_spec_info */
-/* TODO: Is setting the prefix symbol to a positive sign a good idea in all locales? */
-static void
-u_printf_set_sign(UNumberFormat *format,
- const u_printf_spec_info *info,
- UChar *prefixBuffer,
- int32_t *prefixBufLen,
- UErrorCode *status)
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 1998-2016, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+*
+* File uprntf_p.c
+*
+* Modification History:
+*
+* Date Name Description
+* 11/23/98 stephen Creation.
+* 03/12/99 stephen Modified for new C API.
+* 08/07/2003 george Reunify printf implementations
+******************************************************************************
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION
+
+#include "unicode/ustring.h"
+#include "unicode/utf16.h"
+#include "uprintf.h"
+#include "ufmt_cmn.h"
+#include "cmemory.h"
+#include "putilimp.h"
+
+/* ANSI style formatting */
+/* Use US-ASCII characters only for formatting */
+
+/* % */
+#define UFMT_SIMPLE_PERCENT {ufmt_simple_percent, u_printf_simple_percent_handler}
+/* s */
+#define UFMT_STRING {ufmt_string, u_printf_string_handler}
+/* c */
+#define UFMT_CHAR {ufmt_char, u_printf_char_handler}
+/* d, i */
+#define UFMT_INT {ufmt_int, u_printf_integer_handler}
+/* u */
+#define UFMT_UINT {ufmt_int, u_printf_uinteger_handler}
+/* o */
+#define UFMT_OCTAL {ufmt_int, u_printf_octal_handler}
+/* x, X */
+#define UFMT_HEX {ufmt_int, u_printf_hex_handler}
+/* f */
+#define UFMT_DOUBLE {ufmt_double, u_printf_double_handler}
+/* e, E */
+#define UFMT_SCIENTIFIC {ufmt_double, u_printf_scientific_handler}
+/* g, G */
+#define UFMT_SCIDBL {ufmt_double, u_printf_scidbl_handler}
+/* n */
+#define UFMT_COUNT {ufmt_count, u_printf_count_handler}
+
+/* non-ANSI extensions */
+/* Use US-ASCII characters only for formatting */
+
+/* p */
+#define UFMT_POINTER {ufmt_pointer, u_printf_pointer_handler}
+/* V */
+#define UFMT_SPELLOUT {ufmt_double, u_printf_spellout_handler}
+/* P */
+#define UFMT_PERCENT {ufmt_double, u_printf_percent_handler}
+/* C K is old format */
+#define UFMT_UCHAR {ufmt_uchar, u_printf_uchar_handler}
+/* S U is old format */
+#define UFMT_USTRING {ufmt_ustring, u_printf_ustring_handler}
+
+
+#define UFMT_EMPTY {ufmt_empty, NULL}
+
+/**
+ * A u_printf handler function.
+ * A u_printf handler is responsible for handling a single u_printf
+ * format specification, for example 'd' or 's'.
+ * @param stream The UFILE to which to write output.
+ * @param info A pointer to a <TT>u_printf_spec_info</TT> struct containing
+ * information on the format specification.
+ * @param args A pointer to the argument data
+ * @return The number of Unicode characters written to <TT>stream</TT>.
+ */
+typedef int32_t U_EXPORT2
+u_printf_handler(const u_printf_stream_handler *handler,
+
+ void *context,
+ ULocaleBundle *formatBundle,
+ const u_printf_spec_info *info,
+ const ufmt_args *args);
+
+typedef struct u_printf_info {
+ ufmt_type_info info;
+ u_printf_handler *handler;
+} u_printf_info;
+
+/**
+ * Struct encapsulating a single uprintf format specification.
+ */
+typedef struct u_printf_spec {
+ u_printf_spec_info fInfo; /* Information on this spec */
+ int32_t fWidthPos; /* Position of width in arg list */
+ int32_t fPrecisionPos; /* Position of precision in arg list */
+ int32_t fArgPos; /* Position of data in arg list */
+} u_printf_spec;
+
+#define UPRINTF_NUM_FMT_HANDLERS 108
+
+/* We do not use handlers for 0-0x1f */
+#define UPRINTF_BASE_FMT_HANDLERS 0x20
+
+/* buffer size for formatting */
+#define UPRINTF_BUFFER_SIZE 1024
+#define UPRINTF_SYMBOL_BUFFER_SIZE 8
+
+static const UChar gNullStr[] = {0x28, 0x6E, 0x75, 0x6C, 0x6C, 0x29, 0}; /* "(null)" */
+static const UChar gSpaceStr[] = {0x20, 0}; /* " " */
+
+/* Sets the sign of a format based on u_printf_spec_info */
+/* TODO: Is setting the prefix symbol to a positive sign a good idea in all locales? */
+static void
+u_printf_set_sign(UNumberFormat *format,
+ const u_printf_spec_info *info,
+ UChar *prefixBuffer,
+ int32_t *prefixBufLen,
+ UErrorCode *status)
+{
+ if(info->fShowSign) {
+ *prefixBufLen = unum_getTextAttribute(format,
+ UNUM_POSITIVE_PREFIX,
+ prefixBuffer,
+ *prefixBufLen,
+ status);
+ if (info->fSpace) {
+ /* Setting UNUM_PLUS_SIGN_SYMBOL affects the exponent too. */
+ /* unum_setSymbol(format, UNUM_PLUS_SIGN_SYMBOL, gSpaceStr, 1, &status); */
+ unum_setTextAttribute(format, UNUM_POSITIVE_PREFIX, gSpaceStr, 1, status);
+ }
+ else {
+ UChar plusSymbol[UPRINTF_SYMBOL_BUFFER_SIZE];
+ int32_t symbolLen;
+
+ symbolLen = unum_getSymbol(format,
+ UNUM_PLUS_SIGN_SYMBOL,
+ plusSymbol,
+ UPRV_LENGTHOF(plusSymbol),
+ status);
+ unum_setTextAttribute(format,
+ UNUM_POSITIVE_PREFIX,
+ plusSymbol,
+ symbolLen,
+ status);
+ }
+ }
+ else {
+ *prefixBufLen = 0;
+ }
+}
+
+static void
+u_printf_reset_sign(UNumberFormat *format,
+ const u_printf_spec_info *info,
+ UChar *prefixBuffer,
+ int32_t *prefixBufLen,
+ UErrorCode *status)
+{
+ if(info->fShowSign) {
+ unum_setTextAttribute(format,
+ UNUM_POSITIVE_PREFIX,
+ prefixBuffer,
+ *prefixBufLen,
+ status);
+ }
+}
+
+
+/* handle a '%' */
+static int32_t
+u_printf_simple_percent_handler(const u_printf_stream_handler *handler,
+ void *context,
+ ULocaleBundle *formatBundle,
+ const u_printf_spec_info *info,
+ const ufmt_args *args)
+{
+ (void)formatBundle;
+ (void)info;
+ (void)args;
+ static const UChar PERCENT[] = { UP_PERCENT };
+
+ /* put a single '%' onto the output */
+ return handler->write(context, PERCENT, 1);
+}
+
+/* handle 's' */
+static int32_t
+u_printf_string_handler(const u_printf_stream_handler *handler,
+ void *context,
+ ULocaleBundle *formatBundle,
+ const u_printf_spec_info *info,
+ const ufmt_args *args)
+{
+ (void)formatBundle;
+ UChar *s;
+ UChar buffer[UFMT_DEFAULT_BUFFER_SIZE];
+ int32_t len, written;
+ int32_t argSize;
+ const char *arg = (const char*)(args[0].ptrValue);
+
+ /* convert from the default codepage to Unicode */
+ if (arg) {
+ argSize = (int32_t)strlen(arg) + 1;
+ if (argSize >= MAX_UCHAR_BUFFER_SIZE(buffer)) {
+ s = ufmt_defaultCPToUnicode(arg, argSize,
+ (UChar *)uprv_malloc(MAX_UCHAR_BUFFER_NEEDED(argSize)),
+ MAX_UCHAR_BUFFER_NEEDED(argSize));
+ if(s == NULL) {
+ return 0;
+ }
+ }
+ else {
+ s = ufmt_defaultCPToUnicode(arg, argSize, buffer,
+ UPRV_LENGTHOF(buffer));
+ }
+ }
+ else {
+ s = (UChar *)gNullStr;
+ }
+ len = u_strlen(s);
+
+ /* width = minimum # of characters to write */
+ /* precision = maximum # of characters to write */
+ if (info->fPrecision != -1 && info->fPrecision < len) {
+ len = info->fPrecision;
+ }
+
+ written = handler->pad_and_justify(context, info, s, len);
+
+ /* clean up */
+ if (gNullStr != s && buffer != s) {
+ uprv_free(s);
+ }
+
+ return written;
+}
+
+static int32_t
+u_printf_char_handler(const u_printf_stream_handler *handler,
+ void *context,
+ ULocaleBundle *formatBundle,
+ const u_printf_spec_info *info,
+ const ufmt_args *args)
+{
+ (void)formatBundle;
+ UChar s[U16_MAX_LENGTH+1];
+ int32_t len = 1, written;
+ unsigned char arg = (unsigned char)(args[0].int64Value);
+
+ /* convert from default codepage to Unicode */
+ ufmt_defaultCPToUnicode((const char *)&arg, 2, s, UPRV_LENGTHOF(s));
+
+ /* Remember that this may be an MBCS character */
+ if (arg != 0) {
+ len = u_strlen(s);
+ }
+
+ /* width = minimum # of characters to write */
+ /* precision = maximum # of characters to write */
+ /* precision is ignored when handling a char */
+
+ written = handler->pad_and_justify(context, info, s, len);
+
+ return written;
+}
+
+static int32_t
+u_printf_double_handler(const u_printf_stream_handler *handler,
+ void *context,
+ ULocaleBundle *formatBundle,
+ const u_printf_spec_info *info,
+ const ufmt_args *args)
+{
+ double num = (double) (args[0].doubleValue);
+ UNumberFormat *format;
+ UChar result[UPRINTF_BUFFER_SIZE];
+ UChar prefixBuffer[UPRINTF_BUFFER_SIZE];
+ int32_t prefixBufferLen = sizeof(prefixBuffer);
+ int32_t minDecimalDigits;
+ int32_t maxDecimalDigits;
+ int32_t resultLen;
+ UErrorCode status = U_ZERO_ERROR;
+
+ prefixBuffer[0] = 0;
+
+ /* mask off any necessary bits */
+ /* if(! info->fIsLongDouble)
+ num &= DBL_MAX;*/
+
+ /* get the formatter */
+ format = u_locbund_getNumberFormat(formatBundle, UNUM_DECIMAL);
+
+ /* handle error */
+ if(format == 0)
+ return 0;
+
+ /* save the formatter's state */
+ minDecimalDigits = unum_getAttribute(format, UNUM_MIN_FRACTION_DIGITS);
+ maxDecimalDigits = unum_getAttribute(format, UNUM_MAX_FRACTION_DIGITS);
+
+ /* set the appropriate flags and number of decimal digits on the formatter */
+ if(info->fPrecision != -1) {
+ /* set the # of decimal digits */
+ unum_setAttribute(format, UNUM_FRACTION_DIGITS, info->fPrecision);
+ }
+ else if(info->fAlt) {
+ /* '#' means always show decimal point */
+ /* copy of printf behavior on Solaris - '#' shows 6 digits */
+ unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6);
+ }
+ else {
+ /* # of decimal digits is 6 if precision not specified regardless of locale */
+ unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6);
+ }
+
+ /* set whether to show the sign */
+ if (info->fShowSign) {
+ u_printf_set_sign(format, info, prefixBuffer, &prefixBufferLen, &status);
+ }
+
+ /* format the number */
+ resultLen = unum_formatDouble(format, num, result, UPRINTF_BUFFER_SIZE, 0, &status);
+
+ if (U_FAILURE(status)) {
+ resultLen = 0;
+ }
+
+ /* restore the number format */
+ /* TODO: Is this needed? */
+ unum_setAttribute(format, UNUM_MIN_FRACTION_DIGITS, minDecimalDigits);
+ unum_setAttribute(format, UNUM_MAX_FRACTION_DIGITS, maxDecimalDigits);
+
+ if (info->fShowSign) {
+ /* Reset back to original value regardless of what the error was */
+ UErrorCode localStatus = U_ZERO_ERROR;
+ u_printf_reset_sign(format, info, prefixBuffer, &prefixBufferLen, &localStatus);
+ }
+
+ return handler->pad_and_justify(context, info, result, resultLen);
+}
+
+/* HSYS */
+static int32_t
+u_printf_integer_handler(const u_printf_stream_handler *handler,
+ void *context,
+ ULocaleBundle *formatBundle,
+ const u_printf_spec_info *info,
+ const ufmt_args *args)
+{
+ int64_t num = args[0].int64Value;
+ UNumberFormat *format;
+ UChar result[UPRINTF_BUFFER_SIZE];
+ UChar prefixBuffer[UPRINTF_BUFFER_SIZE];
+ int32_t prefixBufferLen = sizeof(prefixBuffer);
+ int32_t minDigits = -1;
+ int32_t resultLen;
+ UErrorCode status = U_ZERO_ERROR;
+
+ prefixBuffer[0] = 0;
+
+ /* mask off any necessary bits */
+ if (info->fIsShort)
+ num = (int16_t)num;
+ else if (!info->fIsLongLong)
+ num = (int32_t)num;
+
+ /* get the formatter */
+ format = u_locbund_getNumberFormat(formatBundle, UNUM_DECIMAL);
+
+ /* handle error */
+ if(format == 0)
+ return 0;
+
+ /* set the appropriate flags on the formatter */
+
+ /* set the minimum integer digits */
+ if(info->fPrecision != -1) {
+ /* set the minimum # of digits */
+ minDigits = unum_getAttribute(format, UNUM_MIN_INTEGER_DIGITS);
+ unum_setAttribute(format, UNUM_MIN_INTEGER_DIGITS, info->fPrecision);
+ }
+
+ /* set whether to show the sign */
+ if(info->fShowSign) {
+ u_printf_set_sign(format, info, prefixBuffer, &prefixBufferLen, &status);
+ }
+
+ /* format the number */
+ resultLen = unum_formatInt64(format, num, result, UPRINTF_BUFFER_SIZE, 0, &status);
+
+ if (U_FAILURE(status)) {
+ resultLen = 0;
+ }
+
+ /* restore the number format */
+ if (minDigits != -1) {
+ unum_setAttribute(format, UNUM_MIN_INTEGER_DIGITS, minDigits);
+ }
+
+ if (info->fShowSign) {
+ /* Reset back to original value regardless of what the error was */
+ UErrorCode localStatus = U_ZERO_ERROR;
+ u_printf_reset_sign(format, info, prefixBuffer, &prefixBufferLen, &localStatus);
+ }
+
+ return handler->pad_and_justify(context, info, result, resultLen);
+}
+
+static int32_t
+u_printf_hex_handler(const u_printf_stream_handler *handler,
+ void *context,
+ ULocaleBundle *formatBundle,
+ const u_printf_spec_info *info,
+ const ufmt_args *args)
+{
+ (void)formatBundle;
+ int64_t num = args[0].int64Value;
+ UChar result[UPRINTF_BUFFER_SIZE];
+ int32_t len = UPRINTF_BUFFER_SIZE;
+
+
+ /* mask off any necessary bits */
+ if (info->fIsShort)
+ num &= UINT16_MAX;
+ else if (!info->fIsLongLong)
+ num &= UINT32_MAX;
+
+ /* format the number, preserving the minimum # of digits */
+ ufmt_64tou(result, &len, num, 16,
+ (UBool)(info->fSpec == 0x0078),
+ (info->fPrecision == -1 && info->fZero) ? info->fWidth : info->fPrecision);
+
+ /* convert to alt form, if desired */
+ if(num != 0 && info->fAlt && len < UPRINTF_BUFFER_SIZE - 2) {
+ /* shift the formatted string right by 2 chars */
+ memmove(result + 2, result, len * sizeof(UChar));
+ result[0] = 0x0030;
+ result[1] = info->fSpec;
+ len += 2;
+ }
+
+ return handler->pad_and_justify(context, info, result, len);
+}
+
+static int32_t
+u_printf_octal_handler(const u_printf_stream_handler *handler,
+ void *context,
+ ULocaleBundle *formatBundle,
+ const u_printf_spec_info *info,
+ const ufmt_args *args)
+{
+ (void)formatBundle;
+ int64_t num = args[0].int64Value;
+ UChar result[UPRINTF_BUFFER_SIZE];
+ int32_t len = UPRINTF_BUFFER_SIZE;
+
+
+ /* mask off any necessary bits */
+ if (info->fIsShort)
+ num &= UINT16_MAX;
+ else if (!info->fIsLongLong)
+ num &= UINT32_MAX;
+
+ /* format the number, preserving the minimum # of digits */
+ ufmt_64tou(result, &len, num, 8,
+ FALSE, /* doesn't matter for octal */
+ info->fPrecision == -1 && info->fZero ? info->fWidth : info->fPrecision);
+
+ /* convert to alt form, if desired */
+ if(info->fAlt && result[0] != 0x0030 && len < UPRINTF_BUFFER_SIZE - 1) {
+ /* shift the formatted string right by 1 char */
+ memmove(result + 1, result, len * sizeof(UChar));
+ result[0] = 0x0030;
+ len += 1;
+ }
+
+ return handler->pad_and_justify(context, info, result, len);
+}
+
+static int32_t
+u_printf_uinteger_handler(const u_printf_stream_handler *handler,
+ void *context,
+ ULocaleBundle *formatBundle,
+ const u_printf_spec_info *info,
+ const ufmt_args *args)
+{
+ int64_t num = args[0].int64Value;
+ UNumberFormat *format;
+ UChar result[UPRINTF_BUFFER_SIZE];
+ int32_t minDigits = -1;
+ int32_t resultLen;
+ UErrorCode status = U_ZERO_ERROR;
+
+ /* TODO: Fix this once uint64_t can be formatted. */
+ if (info->fIsShort)
+ num &= UINT16_MAX;
+ else if (!info->fIsLongLong)
+ num &= UINT32_MAX;
+
+ /* get the formatter */
+ format = u_locbund_getNumberFormat(formatBundle, UNUM_DECIMAL);
+
+ /* handle error */
+ if(format == 0)
+ return 0;
+
+ /* set the appropriate flags on the formatter */
+
+ /* set the minimum integer digits */
+ if(info->fPrecision != -1) {
+ /* set the minimum # of digits */
+ minDigits = unum_getAttribute(format, UNUM_MIN_INTEGER_DIGITS);
+ unum_setAttribute(format, UNUM_MIN_INTEGER_DIGITS, info->fPrecision);
+ }
+
+ /* To mirror other stdio implementations, we ignore the sign argument */
+
+ /* format the number */
+ resultLen = unum_formatInt64(format, num, result, UPRINTF_BUFFER_SIZE, 0, &status);
+
+ if (U_FAILURE(status)) {
+ resultLen = 0;
+ }
+
+ /* restore the number format */
+ if (minDigits != -1) {
+ unum_setAttribute(format, UNUM_MIN_INTEGER_DIGITS, minDigits);
+ }
+
+ return handler->pad_and_justify(context, info, result, resultLen);
+}
+
+static int32_t
+u_printf_pointer_handler(const u_printf_stream_handler *handler,
+ void *context,
+ ULocaleBundle *formatBundle,
+ const u_printf_spec_info *info,
+ const ufmt_args *args)
{
- if(info->fShowSign) {
- *prefixBufLen = unum_getTextAttribute(format,
- UNUM_POSITIVE_PREFIX,
- prefixBuffer,
- *prefixBufLen,
- status);
- if (info->fSpace) {
- /* Setting UNUM_PLUS_SIGN_SYMBOL affects the exponent too. */
- /* unum_setSymbol(format, UNUM_PLUS_SIGN_SYMBOL, gSpaceStr, 1, &status); */
- unum_setTextAttribute(format, UNUM_POSITIVE_PREFIX, gSpaceStr, 1, status);
- }
- else {
- UChar plusSymbol[UPRINTF_SYMBOL_BUFFER_SIZE];
- int32_t symbolLen;
-
- symbolLen = unum_getSymbol(format,
- UNUM_PLUS_SIGN_SYMBOL,
- plusSymbol,
- UPRV_LENGTHOF(plusSymbol),
- status);
- unum_setTextAttribute(format,
- UNUM_POSITIVE_PREFIX,
- plusSymbol,
- symbolLen,
- status);
- }
- }
- else {
- *prefixBufLen = 0;
- }
-}
-
-static void
-u_printf_reset_sign(UNumberFormat *format,
- const u_printf_spec_info *info,
- UChar *prefixBuffer,
- int32_t *prefixBufLen,
- UErrorCode *status)
-{
- if(info->fShowSign) {
- unum_setTextAttribute(format,
- UNUM_POSITIVE_PREFIX,
- prefixBuffer,
- *prefixBufLen,
- status);
- }
-}
-
-
-/* handle a '%' */
-static int32_t
-u_printf_simple_percent_handler(const u_printf_stream_handler *handler,
- void *context,
- ULocaleBundle *formatBundle,
- const u_printf_spec_info *info,
- const ufmt_args *args)
-{
- (void)formatBundle;
- (void)info;
- (void)args;
- static const UChar PERCENT[] = { UP_PERCENT };
-
- /* put a single '%' onto the output */
- return handler->write(context, PERCENT, 1);
-}
-
-/* handle 's' */
-static int32_t
-u_printf_string_handler(const u_printf_stream_handler *handler,
- void *context,
- ULocaleBundle *formatBundle,
- const u_printf_spec_info *info,
- const ufmt_args *args)
-{
- (void)formatBundle;
- UChar *s;
- UChar buffer[UFMT_DEFAULT_BUFFER_SIZE];
- int32_t len, written;
- int32_t argSize;
- const char *arg = (const char*)(args[0].ptrValue);
-
- /* convert from the default codepage to Unicode */
- if (arg) {
- argSize = (int32_t)strlen(arg) + 1;
- if (argSize >= MAX_UCHAR_BUFFER_SIZE(buffer)) {
- s = ufmt_defaultCPToUnicode(arg, argSize,
- (UChar *)uprv_malloc(MAX_UCHAR_BUFFER_NEEDED(argSize)),
- MAX_UCHAR_BUFFER_NEEDED(argSize));
- if(s == NULL) {
- return 0;
- }
- }
- else {
- s = ufmt_defaultCPToUnicode(arg, argSize, buffer,
- UPRV_LENGTHOF(buffer));
- }
- }
- else {
- s = (UChar *)gNullStr;
- }
- len = u_strlen(s);
-
- /* width = minimum # of characters to write */
- /* precision = maximum # of characters to write */
- if (info->fPrecision != -1 && info->fPrecision < len) {
- len = info->fPrecision;
- }
-
- written = handler->pad_and_justify(context, info, s, len);
-
- /* clean up */
- if (gNullStr != s && buffer != s) {
- uprv_free(s);
- }
-
- return written;
-}
-
-static int32_t
-u_printf_char_handler(const u_printf_stream_handler *handler,
- void *context,
- ULocaleBundle *formatBundle,
- const u_printf_spec_info *info,
- const ufmt_args *args)
-{
- (void)formatBundle;
- UChar s[U16_MAX_LENGTH+1];
- int32_t len = 1, written;
- unsigned char arg = (unsigned char)(args[0].int64Value);
-
- /* convert from default codepage to Unicode */
- ufmt_defaultCPToUnicode((const char *)&arg, 2, s, UPRV_LENGTHOF(s));
-
- /* Remember that this may be an MBCS character */
- if (arg != 0) {
- len = u_strlen(s);
- }
-
- /* width = minimum # of characters to write */
- /* precision = maximum # of characters to write */
- /* precision is ignored when handling a char */
-
- written = handler->pad_and_justify(context, info, s, len);
-
- return written;
-}
-
-static int32_t
-u_printf_double_handler(const u_printf_stream_handler *handler,
- void *context,
- ULocaleBundle *formatBundle,
- const u_printf_spec_info *info,
- const ufmt_args *args)
-{
- double num = (double) (args[0].doubleValue);
- UNumberFormat *format;
- UChar result[UPRINTF_BUFFER_SIZE];
- UChar prefixBuffer[UPRINTF_BUFFER_SIZE];
- int32_t prefixBufferLen = sizeof(prefixBuffer);
- int32_t minDecimalDigits;
- int32_t maxDecimalDigits;
- int32_t resultLen;
- UErrorCode status = U_ZERO_ERROR;
-
- prefixBuffer[0] = 0;
-
- /* mask off any necessary bits */
- /* if(! info->fIsLongDouble)
- num &= DBL_MAX;*/
-
- /* get the formatter */
- format = u_locbund_getNumberFormat(formatBundle, UNUM_DECIMAL);
-
- /* handle error */
- if(format == 0)
- return 0;
-
- /* save the formatter's state */
- minDecimalDigits = unum_getAttribute(format, UNUM_MIN_FRACTION_DIGITS);
- maxDecimalDigits = unum_getAttribute(format, UNUM_MAX_FRACTION_DIGITS);
-
- /* set the appropriate flags and number of decimal digits on the formatter */
- if(info->fPrecision != -1) {
- /* set the # of decimal digits */
- unum_setAttribute(format, UNUM_FRACTION_DIGITS, info->fPrecision);
- }
- else if(info->fAlt) {
- /* '#' means always show decimal point */
- /* copy of printf behavior on Solaris - '#' shows 6 digits */
- unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6);
- }
- else {
- /* # of decimal digits is 6 if precision not specified regardless of locale */
- unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6);
- }
-
- /* set whether to show the sign */
- if (info->fShowSign) {
- u_printf_set_sign(format, info, prefixBuffer, &prefixBufferLen, &status);
- }
-
- /* format the number */
- resultLen = unum_formatDouble(format, num, result, UPRINTF_BUFFER_SIZE, 0, &status);
-
- if (U_FAILURE(status)) {
- resultLen = 0;
- }
-
- /* restore the number format */
- /* TODO: Is this needed? */
- unum_setAttribute(format, UNUM_MIN_FRACTION_DIGITS, minDecimalDigits);
- unum_setAttribute(format, UNUM_MAX_FRACTION_DIGITS, maxDecimalDigits);
-
- if (info->fShowSign) {
- /* Reset back to original value regardless of what the error was */
- UErrorCode localStatus = U_ZERO_ERROR;
- u_printf_reset_sign(format, info, prefixBuffer, &prefixBufferLen, &localStatus);
- }
-
- return handler->pad_and_justify(context, info, result, resultLen);
-}
-
-/* HSYS */
-static int32_t
-u_printf_integer_handler(const u_printf_stream_handler *handler,
- void *context,
- ULocaleBundle *formatBundle,
- const u_printf_spec_info *info,
- const ufmt_args *args)
-{
- int64_t num = args[0].int64Value;
- UNumberFormat *format;
- UChar result[UPRINTF_BUFFER_SIZE];
- UChar prefixBuffer[UPRINTF_BUFFER_SIZE];
- int32_t prefixBufferLen = sizeof(prefixBuffer);
- int32_t minDigits = -1;
- int32_t resultLen;
- UErrorCode status = U_ZERO_ERROR;
-
- prefixBuffer[0] = 0;
-
- /* mask off any necessary bits */
- if (info->fIsShort)
- num = (int16_t)num;
- else if (!info->fIsLongLong)
- num = (int32_t)num;
-
- /* get the formatter */
- format = u_locbund_getNumberFormat(formatBundle, UNUM_DECIMAL);
-
- /* handle error */
- if(format == 0)
- return 0;
-
- /* set the appropriate flags on the formatter */
-
- /* set the minimum integer digits */
- if(info->fPrecision != -1) {
- /* set the minimum # of digits */
- minDigits = unum_getAttribute(format, UNUM_MIN_INTEGER_DIGITS);
- unum_setAttribute(format, UNUM_MIN_INTEGER_DIGITS, info->fPrecision);
- }
-
- /* set whether to show the sign */
- if(info->fShowSign) {
- u_printf_set_sign(format, info, prefixBuffer, &prefixBufferLen, &status);
- }
-
- /* format the number */
- resultLen = unum_formatInt64(format, num, result, UPRINTF_BUFFER_SIZE, 0, &status);
-
- if (U_FAILURE(status)) {
- resultLen = 0;
- }
-
- /* restore the number format */
- if (minDigits != -1) {
- unum_setAttribute(format, UNUM_MIN_INTEGER_DIGITS, minDigits);
- }
-
- if (info->fShowSign) {
- /* Reset back to original value regardless of what the error was */
- UErrorCode localStatus = U_ZERO_ERROR;
- u_printf_reset_sign(format, info, prefixBuffer, &prefixBufferLen, &localStatus);
- }
-
- return handler->pad_and_justify(context, info, result, resultLen);
-}
-
-static int32_t
-u_printf_hex_handler(const u_printf_stream_handler *handler,
- void *context,
- ULocaleBundle *formatBundle,
- const u_printf_spec_info *info,
- const ufmt_args *args)
-{
- (void)formatBundle;
- int64_t num = args[0].int64Value;
- UChar result[UPRINTF_BUFFER_SIZE];
- int32_t len = UPRINTF_BUFFER_SIZE;
-
-
- /* mask off any necessary bits */
- if (info->fIsShort)
- num &= UINT16_MAX;
- else if (!info->fIsLongLong)
- num &= UINT32_MAX;
-
- /* format the number, preserving the minimum # of digits */
- ufmt_64tou(result, &len, num, 16,
- (UBool)(info->fSpec == 0x0078),
- (info->fPrecision == -1 && info->fZero) ? info->fWidth : info->fPrecision);
-
- /* convert to alt form, if desired */
- if(num != 0 && info->fAlt && len < UPRINTF_BUFFER_SIZE - 2) {
- /* shift the formatted string right by 2 chars */
- memmove(result + 2, result, len * sizeof(UChar));
- result[0] = 0x0030;
- result[1] = info->fSpec;
- len += 2;
- }
-
- return handler->pad_and_justify(context, info, result, len);
-}
-
-static int32_t
-u_printf_octal_handler(const u_printf_stream_handler *handler,
- void *context,
- ULocaleBundle *formatBundle,
- const u_printf_spec_info *info,
- const ufmt_args *args)
-{
- (void)formatBundle;
- int64_t num = args[0].int64Value;
- UChar result[UPRINTF_BUFFER_SIZE];
- int32_t len = UPRINTF_BUFFER_SIZE;
-
-
- /* mask off any necessary bits */
- if (info->fIsShort)
- num &= UINT16_MAX;
- else if (!info->fIsLongLong)
- num &= UINT32_MAX;
-
- /* format the number, preserving the minimum # of digits */
- ufmt_64tou(result, &len, num, 8,
- FALSE, /* doesn't matter for octal */
- info->fPrecision == -1 && info->fZero ? info->fWidth : info->fPrecision);
-
- /* convert to alt form, if desired */
- if(info->fAlt && result[0] != 0x0030 && len < UPRINTF_BUFFER_SIZE - 1) {
- /* shift the formatted string right by 1 char */
- memmove(result + 1, result, len * sizeof(UChar));
- result[0] = 0x0030;
- len += 1;
- }
-
- return handler->pad_and_justify(context, info, result, len);
-}
-
-static int32_t
-u_printf_uinteger_handler(const u_printf_stream_handler *handler,
- void *context,
- ULocaleBundle *formatBundle,
- const u_printf_spec_info *info,
- const ufmt_args *args)
-{
- int64_t num = args[0].int64Value;
- UNumberFormat *format;
- UChar result[UPRINTF_BUFFER_SIZE];
- int32_t minDigits = -1;
- int32_t resultLen;
- UErrorCode status = U_ZERO_ERROR;
-
- /* TODO: Fix this once uint64_t can be formatted. */
- if (info->fIsShort)
- num &= UINT16_MAX;
- else if (!info->fIsLongLong)
- num &= UINT32_MAX;
-
- /* get the formatter */
- format = u_locbund_getNumberFormat(formatBundle, UNUM_DECIMAL);
-
- /* handle error */
- if(format == 0)
- return 0;
-
- /* set the appropriate flags on the formatter */
-
- /* set the minimum integer digits */
- if(info->fPrecision != -1) {
- /* set the minimum # of digits */
- minDigits = unum_getAttribute(format, UNUM_MIN_INTEGER_DIGITS);
- unum_setAttribute(format, UNUM_MIN_INTEGER_DIGITS, info->fPrecision);
- }
-
- /* To mirror other stdio implementations, we ignore the sign argument */
-
- /* format the number */
- resultLen = unum_formatInt64(format, num, result, UPRINTF_BUFFER_SIZE, 0, &status);
-
- if (U_FAILURE(status)) {
- resultLen = 0;
- }
-
- /* restore the number format */
- if (minDigits != -1) {
- unum_setAttribute(format, UNUM_MIN_INTEGER_DIGITS, minDigits);
- }
-
- return handler->pad_and_justify(context, info, result, resultLen);
-}
-
-static int32_t
-u_printf_pointer_handler(const u_printf_stream_handler *handler,
- void *context,
- ULocaleBundle *formatBundle,
- const u_printf_spec_info *info,
- const ufmt_args *args)
-{
- (void)formatBundle;
- UChar result[UPRINTF_BUFFER_SIZE];
- int32_t len = UPRINTF_BUFFER_SIZE;
-
- /* format the pointer in hex */
- ufmt_ptou(result, &len, args[0].ptrValue, TRUE/*, info->fPrecision*/);
-
- return handler->pad_and_justify(context, info, result, len);
-}
-
-static int32_t
-u_printf_scientific_handler(const u_printf_stream_handler *handler,
- void *context,
- ULocaleBundle *formatBundle,
- const u_printf_spec_info *info,
- const ufmt_args *args)
-{
- double num = (double) (args[0].doubleValue);
- UNumberFormat *format;
- UChar result[UPRINTF_BUFFER_SIZE];
- UChar prefixBuffer[UPRINTF_BUFFER_SIZE];
- int32_t prefixBufferLen = sizeof(prefixBuffer);
- int32_t minDecimalDigits;
- int32_t maxDecimalDigits;
- UErrorCode status = U_ZERO_ERROR;
- UChar srcExpBuf[UPRINTF_SYMBOL_BUFFER_SIZE];
- int32_t srcLen, expLen;
- int32_t resultLen;
- UChar expBuf[UPRINTF_SYMBOL_BUFFER_SIZE];
-
- prefixBuffer[0] = 0;
-
- /* mask off any necessary bits */
- /* if(! info->fIsLongDouble)
- num &= DBL_MAX;*/
-
- /* get the formatter */
- format = u_locbund_getNumberFormat(formatBundle, UNUM_SCIENTIFIC);
-
- /* handle error */
- if(format == 0)
- return 0;
-
- /* set the appropriate flags on the formatter */
-
- srcLen = unum_getSymbol(format,
- UNUM_EXPONENTIAL_SYMBOL,
- srcExpBuf,
- sizeof(srcExpBuf),
- &status);
-
- /* Upper/lower case the e */
- if (info->fSpec == (UChar)0x65 /* e */) {
- expLen = u_strToLower(expBuf, (int32_t)sizeof(expBuf),
- srcExpBuf, srcLen,
- formatBundle->fLocale,
- &status);
- }
- else {
- expLen = u_strToUpper(expBuf, (int32_t)sizeof(expBuf),
- srcExpBuf, srcLen,
- formatBundle->fLocale,
- &status);
- }
-
- unum_setSymbol(format,
- UNUM_EXPONENTIAL_SYMBOL,
- expBuf,
- expLen,
- &status);
-
- /* save the formatter's state */
- minDecimalDigits = unum_getAttribute(format, UNUM_MIN_FRACTION_DIGITS);
- maxDecimalDigits = unum_getAttribute(format, UNUM_MAX_FRACTION_DIGITS);
-
- /* set the appropriate flags and number of decimal digits on the formatter */
- if(info->fPrecision != -1) {
- /* set the # of decimal digits */
- if (info->fOrigSpec == (UChar)0x65 /* e */ || info->fOrigSpec == (UChar)0x45 /* E */) {
- unum_setAttribute(format, UNUM_FRACTION_DIGITS, info->fPrecision);
- }
- else {
- unum_setAttribute(format, UNUM_MIN_FRACTION_DIGITS, 1);
- unum_setAttribute(format, UNUM_MAX_FRACTION_DIGITS, info->fPrecision);
- }
- }
- else if(info->fAlt) {
- /* '#' means always show decimal point */
- /* copy of printf behavior on Solaris - '#' shows 6 digits */
- unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6);
- }
- else {
- /* # of decimal digits is 6 if precision not specified */
- unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6);
- }
-
- /* set whether to show the sign */
- if (info->fShowSign) {
- u_printf_set_sign(format, info, prefixBuffer, &prefixBufferLen, &status);
- }
-
- /* format the number */
- resultLen = unum_formatDouble(format, num, result, UPRINTF_BUFFER_SIZE, 0, &status);
-
- if (U_FAILURE(status)) {
- resultLen = 0;
- }
-
- /* restore the number format */
- /* TODO: Is this needed? */
- unum_setAttribute(format, UNUM_MIN_FRACTION_DIGITS, minDecimalDigits);
- unum_setAttribute(format, UNUM_MAX_FRACTION_DIGITS, maxDecimalDigits);
-
- /* Since we're the only one using the scientific
- format, we don't need to save the old exponent value. */
- /*unum_setSymbol(format,
- UNUM_EXPONENTIAL_SYMBOL,
- srcExpBuf,
- srcLen,
- &status);*/
-
- if (info->fShowSign) {
- /* Reset back to original value regardless of what the error was */
- UErrorCode localStatus = U_ZERO_ERROR;
- u_printf_reset_sign(format, info, prefixBuffer, &prefixBufferLen, &localStatus);
- }
-
- return handler->pad_and_justify(context, info, result, resultLen);
-}
-
-static int32_t
-u_printf_percent_handler(const u_printf_stream_handler *handler,
- void *context,
- ULocaleBundle *formatBundle,
- const u_printf_spec_info *info,
- const ufmt_args *args)
-{
- double num = (double) (args[0].doubleValue);
- UNumberFormat *format;
- UChar result[UPRINTF_BUFFER_SIZE];
- UChar prefixBuffer[UPRINTF_BUFFER_SIZE];
- int32_t prefixBufferLen = sizeof(prefixBuffer);
- int32_t minDecimalDigits;
- int32_t maxDecimalDigits;
- int32_t resultLen;
- UErrorCode status = U_ZERO_ERROR;
-
- prefixBuffer[0] = 0;
-
- /* mask off any necessary bits */
- /* if(! info->fIsLongDouble)
- num &= DBL_MAX;*/
-
- /* get the formatter */
- format = u_locbund_getNumberFormat(formatBundle, UNUM_PERCENT);
-
- /* handle error */
- if(format == 0)
- return 0;
-
- /* save the formatter's state */
- minDecimalDigits = unum_getAttribute(format, UNUM_MIN_FRACTION_DIGITS);
- maxDecimalDigits = unum_getAttribute(format, UNUM_MAX_FRACTION_DIGITS);
-
- /* set the appropriate flags and number of decimal digits on the formatter */
- if(info->fPrecision != -1) {
- /* set the # of decimal digits */
- unum_setAttribute(format, UNUM_FRACTION_DIGITS, info->fPrecision);
- }
- else if(info->fAlt) {
- /* '#' means always show decimal point */
- /* copy of printf behavior on Solaris - '#' shows 6 digits */
- unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6);
- }
- else {
- /* # of decimal digits is 6 if precision not specified */
- unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6);
- }
-
- /* set whether to show the sign */
- if (info->fShowSign) {
- u_printf_set_sign(format, info, prefixBuffer, &prefixBufferLen, &status);
- }
-
- /* format the number */
- resultLen = unum_formatDouble(format, num, result, UPRINTF_BUFFER_SIZE, 0, &status);
-
- if (U_FAILURE(status)) {
- resultLen = 0;
- }
-
- /* restore the number format */
- /* TODO: Is this needed? */
- unum_setAttribute(format, UNUM_MIN_FRACTION_DIGITS, minDecimalDigits);
- unum_setAttribute(format, UNUM_MAX_FRACTION_DIGITS, maxDecimalDigits);
-
- if (info->fShowSign) {
- /* Reset back to original value regardless of what the error was */
- UErrorCode localStatus = U_ZERO_ERROR;
- u_printf_reset_sign(format, info, prefixBuffer, &prefixBufferLen, &localStatus);
- }
-
- return handler->pad_and_justify(context, info, result, resultLen);
-}
-
-static int32_t
-u_printf_ustring_handler(const u_printf_stream_handler *handler,
- void *context,
- ULocaleBundle *formatBundle,
- const u_printf_spec_info *info,
- const ufmt_args *args)
-{
- (void)formatBundle;
- int32_t len, written;
- const UChar *arg = (const UChar*)(args[0].ptrValue);
-
- /* allocate enough space for the buffer */
- if (arg == NULL) {
- arg = gNullStr;
- }
- len = u_strlen(arg);
-
- /* width = minimum # of characters to write */
- /* precision = maximum # of characters to write */
- if (info->fPrecision != -1 && info->fPrecision < len) {
- len = info->fPrecision;
- }
-
- /* determine if the string should be padded */
- written = handler->pad_and_justify(context, info, arg, len);
-
- return written;
-}
-
-static int32_t
-u_printf_uchar_handler(const u_printf_stream_handler *handler,
- void *context,
- ULocaleBundle *formatBundle,
- const u_printf_spec_info *info,
- const ufmt_args *args)
-{
- (void)formatBundle;
- int32_t written = 0;
- UChar arg = (UChar)(args[0].int64Value);
-
- /* width = minimum # of characters to write */
- /* precision = maximum # of characters to write */
- /* precision is ignored when handling a uchar */
-
- /* determine if the string should be padded */
- written = handler->pad_and_justify(context, info, &arg, 1);
-
- return written;
-}
-
-static int32_t
-u_printf_scidbl_handler(const u_printf_stream_handler *handler,
- void *context,
- ULocaleBundle *formatBundle,
- const u_printf_spec_info *info,
- const ufmt_args *args)
-{
- u_printf_spec_info scidbl_info;
- double num = args[0].doubleValue;
- int32_t retVal;
- UNumberFormat *format;
- int32_t maxSigDecimalDigits, significantDigits;
-
- memcpy(&scidbl_info, info, sizeof(u_printf_spec_info));
-
- /* determine whether to use 'd', 'e' or 'f' notation */
- if (scidbl_info.fPrecision == -1 && num == uprv_trunc(num))
- {
- /* use 'f' notation */
- scidbl_info.fSpec = 0x0066;
- scidbl_info.fPrecision = 0;
- /* call the double handler */
- retVal = u_printf_double_handler(handler, context, formatBundle, &scidbl_info, args);
- }
- else if(num < 0.0001 || (scidbl_info.fPrecision < 1 && 1000000.0 <= num)
- || (scidbl_info.fPrecision != -1 && num > uprv_pow10(scidbl_info.fPrecision)))
- {
- /* use 'e' or 'E' notation */
- scidbl_info.fSpec = scidbl_info.fSpec - 2;
- if (scidbl_info.fPrecision == -1) {
- scidbl_info.fPrecision = 5;
- }
- /* call the scientific handler */
- retVal = u_printf_scientific_handler(handler, context, formatBundle, &scidbl_info, args);
- }
- else {
- format = u_locbund_getNumberFormat(formatBundle, UNUM_DECIMAL);
- /* Check for null pointer */
- if (format == NULL) {
- return 0;
- }
- maxSigDecimalDigits = unum_getAttribute(format, UNUM_MAX_SIGNIFICANT_DIGITS);
- significantDigits = scidbl_info.fPrecision;
-
- /* use 'f' notation */
- scidbl_info.fSpec = 0x0066;
- if (significantDigits == -1) {
- significantDigits = 6;
- }
- unum_setAttribute(format, UNUM_SIGNIFICANT_DIGITS_USED, TRUE);
- unum_setAttribute(format, UNUM_MAX_SIGNIFICANT_DIGITS, significantDigits);
- /* call the double handler */
- retVal = u_printf_double_handler(handler, context, formatBundle, &scidbl_info, args);
- unum_setAttribute(format, UNUM_MAX_SIGNIFICANT_DIGITS, maxSigDecimalDigits);
- unum_setAttribute(format, UNUM_SIGNIFICANT_DIGITS_USED, FALSE);
- }
- return retVal;
-}
-
-static int32_t
-u_printf_count_handler(const u_printf_stream_handler *handler,
- void *context,
- ULocaleBundle *formatBundle,
- const u_printf_spec_info *info,
- const ufmt_args *args)
-{
- (void)handler;
- (void)context;
- (void)formatBundle;
- int32_t *count = (int32_t*)(args[0].ptrValue);
-
- /* in the special case of count, the u_printf_spec_info's width */
- /* will contain the # of chars written thus far */
- *count = info->fWidth;
-
- return 0;
-}
-
-static int32_t
-u_printf_spellout_handler(const u_printf_stream_handler *handler,
- void *context,
- ULocaleBundle *formatBundle,
- const u_printf_spec_info *info,
- const ufmt_args *args)
-{
- double num = (double) (args[0].doubleValue);
- UNumberFormat *format;
- UChar result[UPRINTF_BUFFER_SIZE];
- UChar prefixBuffer[UPRINTF_BUFFER_SIZE];
- int32_t prefixBufferLen = sizeof(prefixBuffer);
- int32_t minDecimalDigits;
- int32_t maxDecimalDigits;
- int32_t resultLen;
- UErrorCode status = U_ZERO_ERROR;
-
- prefixBuffer[0] = 0;
-
- /* mask off any necessary bits */
- /* if(! info->fIsLongDouble)
- num &= DBL_MAX;*/
-
- /* get the formatter */
- format = u_locbund_getNumberFormat(formatBundle, UNUM_SPELLOUT);
-
- /* handle error */
- if(format == 0)
- return 0;
-
- /* save the formatter's state */
- minDecimalDigits = unum_getAttribute(format, UNUM_MIN_FRACTION_DIGITS);
- maxDecimalDigits = unum_getAttribute(format, UNUM_MAX_FRACTION_DIGITS);
-
- /* set the appropriate flags and number of decimal digits on the formatter */
- if(info->fPrecision != -1) {
- /* set the # of decimal digits */
- unum_setAttribute(format, UNUM_FRACTION_DIGITS, info->fPrecision);
- }
- else if(info->fAlt) {
- /* '#' means always show decimal point */
- /* copy of printf behavior on Solaris - '#' shows 6 digits */
- unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6);
- }
- else {
- /* # of decimal digits is 6 if precision not specified */
- unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6);
- }
-
- /* set whether to show the sign */
- if (info->fShowSign) {
- u_printf_set_sign(format, info, prefixBuffer, &prefixBufferLen, &status);
- }
-
- /* format the number */
- resultLen = unum_formatDouble(format, num, result, UPRINTF_BUFFER_SIZE, 0, &status);
-
- if (U_FAILURE(status)) {
- resultLen = 0;
- }
-
- /* restore the number format */
- /* TODO: Is this needed? */
- unum_setAttribute(format, UNUM_MIN_FRACTION_DIGITS, minDecimalDigits);
- unum_setAttribute(format, UNUM_MAX_FRACTION_DIGITS, maxDecimalDigits);
-
- if (info->fShowSign) {
- /* Reset back to original value regardless of what the error was */
- UErrorCode localStatus = U_ZERO_ERROR;
- u_printf_reset_sign(format, info, prefixBuffer, &prefixBufferLen, &localStatus);
- }
-
- return handler->pad_and_justify(context, info, result, resultLen);
-}
-
-/* Use US-ASCII characters only for formatting. Most codepages have
- characters 20-7F from Unicode. Using any other codepage specific
- characters will make it very difficult to format the string on
- non-Unicode machines */
-static const u_printf_info g_u_printf_infos[UPRINTF_NUM_FMT_HANDLERS] = {
-/* 0x20 */
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
- UFMT_EMPTY, UFMT_SIMPLE_PERCENT,UFMT_EMPTY, UFMT_EMPTY,
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
-
-/* 0x30 */
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
-
-/* 0x40 */
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_UCHAR,
- UFMT_EMPTY, UFMT_SCIENTIFIC, UFMT_EMPTY, UFMT_SCIDBL,
-#ifdef U_USE_OBSOLETE_IO_FORMATTING
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_UCHAR/*deprecated*/,
-#else
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
-#endif
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
-
-/* 0x50 */
- UFMT_PERCENT, UFMT_EMPTY, UFMT_EMPTY, UFMT_USTRING,
-#ifdef U_USE_OBSOLETE_IO_FORMATTING
- UFMT_EMPTY, UFMT_USTRING/*deprecated*/,UFMT_SPELLOUT, UFMT_EMPTY,
-#else
- UFMT_EMPTY, UFMT_EMPTY, UFMT_SPELLOUT, UFMT_EMPTY,
-#endif
- UFMT_HEX, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
-
-/* 0x60 */
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_CHAR,
- UFMT_INT, UFMT_SCIENTIFIC, UFMT_DOUBLE, UFMT_SCIDBL,
- UFMT_EMPTY, UFMT_INT, UFMT_EMPTY, UFMT_EMPTY,
- UFMT_EMPTY, UFMT_EMPTY, UFMT_COUNT, UFMT_OCTAL,
-
-/* 0x70 */
- UFMT_POINTER, UFMT_EMPTY, UFMT_EMPTY, UFMT_STRING,
- UFMT_EMPTY, UFMT_UINT, UFMT_EMPTY, UFMT_EMPTY,
- UFMT_HEX, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
-};
-
-/* flag characters for uprintf */
-#define FLAG_MINUS 0x002D
-#define FLAG_PLUS 0x002B
-#define FLAG_SPACE 0x0020
-#define FLAG_POUND 0x0023
-#define FLAG_ZERO 0x0030
-#define FLAG_PAREN 0x0028
-
-#define ISFLAG(s) (s) == FLAG_MINUS || \
- (s) == FLAG_PLUS || \
- (s) == FLAG_SPACE || \
- (s) == FLAG_POUND || \
- (s) == FLAG_ZERO || \
- (s) == FLAG_PAREN
-
-/* special characters for uprintf */
-#define SPEC_ASTERISK 0x002A
-#define SPEC_DOLLARSIGN 0x0024
-#define SPEC_PERIOD 0x002E
-#define SPEC_PERCENT 0x0025
-
-/* unicode digits */
-#define DIGIT_ZERO 0x0030
-#define DIGIT_ONE 0x0031
-#define DIGIT_TWO 0x0032
-#define DIGIT_THREE 0x0033
-#define DIGIT_FOUR 0x0034
-#define DIGIT_FIVE 0x0035
-#define DIGIT_SIX 0x0036
-#define DIGIT_SEVEN 0x0037
-#define DIGIT_EIGHT 0x0038
-#define DIGIT_NINE 0x0039
-
-#define ISDIGIT(s) (s) == DIGIT_ZERO || \
- (s) == DIGIT_ONE || \
- (s) == DIGIT_TWO || \
- (s) == DIGIT_THREE || \
- (s) == DIGIT_FOUR || \
- (s) == DIGIT_FIVE || \
- (s) == DIGIT_SIX || \
- (s) == DIGIT_SEVEN || \
- (s) == DIGIT_EIGHT || \
- (s) == DIGIT_NINE
-
-/* u_printf modifiers */
-#define MOD_H 0x0068
-#define MOD_LOWERL 0x006C
-#define MOD_L 0x004C
-
-#define ISMOD(s) (s) == MOD_H || \
- (s) == MOD_LOWERL || \
- (s) == MOD_L
-/* Returns an array of the parsed argument type given in the format string. */
-static ufmt_args* parseArguments(const UChar *alias, va_list ap, UErrorCode *status) {
- ufmt_args *arglist = NULL;
- ufmt_type_info *typelist = NULL;
- UBool *islonglong = NULL;
- int32_t size = 0;
- int32_t pos = 0;
- UChar type;
- uint16_t handlerNum;
- const UChar *aliasStart = alias;
-
- /* get maximum number of arguments */
- for(;;) {
- /* find % */
- while(*alias != UP_PERCENT && *alias != 0x0000) {
- alias++;
- }
-
- if(*alias == 0x0000) {
- break;
- }
-
- alias++;
-
- /* handle the pos number */
- if(ISDIGIT(*alias)) {
-
- /* handle positional parameters */
- if(ISDIGIT(*alias)) {
- pos = (int) (*alias++ - DIGIT_ZERO);
-
- while(ISDIGIT(*alias)) {
- pos *= 10;
- pos += (int) (*alias++ - DIGIT_ZERO);
- }
- }
-
- /* if there is no '$', don't read anything */
- if(*alias != SPEC_DOLLARSIGN) {
- return NULL;
- }
- } else {
- return NULL;
- }
-
- if (pos > size) {
- size = pos;
- }
- }
-
- /* create the parsed argument list */
- typelist = (ufmt_type_info*)uprv_malloc(sizeof(ufmt_type_info) * size);
- islonglong = (UBool*)uprv_malloc(sizeof(UBool) * size);
- arglist = (ufmt_args*)uprv_malloc(sizeof(ufmt_args) * size);
-
- /* If malloc failed, return NULL */
- if (!typelist || !islonglong || !arglist) {
- if (typelist) {
- uprv_free(typelist);
- }
-
- if (islonglong) {
- uprv_free(islonglong);
- }
-
- if (arglist) {
- uprv_free(arglist);
- }
-
- *status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
-
- /* reset alias back to the beginning */
- alias = aliasStart;
-
- for(;;) {
- /* find % */
- while(*alias != UP_PERCENT && *alias != 0x0000) {
- alias++;
- }
-
- if(*alias == 0x0000) {
- break;
- }
-
- alias++;
-
- /* handle positional parameters */
- if(ISDIGIT(*alias)) {
- pos = (int) (*alias++ - DIGIT_ZERO);
-
- while(ISDIGIT(*alias)) {
- pos *= 10;
- pos += (int) (*alias++ - DIGIT_ZERO);
- }
- }
- /* offset position by 1 */
- pos--;
-
- /* skip over everything except for the type */
- while (ISMOD(*alias) || ISFLAG(*alias) || ISDIGIT(*alias) ||
- *alias == SPEC_ASTERISK || *alias == SPEC_PERIOD || *alias == SPEC_DOLLARSIGN) {
- islonglong[pos] = FALSE;
- if (ISMOD(*alias)) {
- alias++;
- if (*alias == MOD_LOWERL) {
- islonglong[pos] = TRUE;
- }
- }
- alias++;
- }
- type = *alias;
-
- /* store the argument type in the correct position of the parsed argument list */
- handlerNum = (uint16_t)(type - UPRINTF_BASE_FMT_HANDLERS);
- if (handlerNum < UPRINTF_NUM_FMT_HANDLERS) {
- typelist[pos] = g_u_printf_infos[ handlerNum ].info;
- } else {
- typelist[pos] = ufmt_empty;
- }
- }
-
- /* store argument in arglist */
- for (pos = 0; pos < size; pos++) {
- switch (typelist[pos]) {
- case ufmt_string:
- case ufmt_ustring:
- case ufmt_pointer:
- arglist[pos].ptrValue = va_arg(ap, void*);
- break;
- case ufmt_char:
- case ufmt_uchar:
- case ufmt_int:
- if (islonglong[pos]) {
- arglist[pos].int64Value = va_arg(ap, int64_t);
- }
- else {
- arglist[pos].int64Value = va_arg(ap, int32_t);
- }
- break;
- case ufmt_float:
- arglist[pos].floatValue = (float) va_arg(ap, double);
- break;
- case ufmt_double:
- arglist[pos].doubleValue = va_arg(ap, double);
- break;
- default:
- /* else args is ignored */
- arglist[pos].ptrValue = NULL;
- break;
- }
- }
-
- uprv_free(typelist);
- uprv_free(islonglong);
-
- return arglist;
-}
-
-/* We parse the argument list in Unicode */
-U_CFUNC int32_t
-u_printf_parse(const u_printf_stream_handler *streamHandler,
- const UChar *fmt,
- void *context,
- u_localized_print_string *locStringContext,
- ULocaleBundle *formatBundle,
- int32_t *written,
- va_list ap)
-{
- uint16_t handlerNum;
- ufmt_args args;
- ufmt_type_info argType;
- u_printf_handler *handler;
- u_printf_spec spec;
- u_printf_spec_info *info = &(spec.fInfo);
-
- const UChar *alias = fmt;
- const UChar *backup;
- const UChar *lastAlias;
- const UChar *orgAlias = fmt;
- /* parsed argument list */
- ufmt_args *arglist = NULL; /* initialized it to avoid compiler warnings */
- UErrorCode status = U_ZERO_ERROR;
- if (!locStringContext || locStringContext->available >= 0) {
- /* get the parsed list of argument types */
- arglist = parseArguments(orgAlias, ap, &status);
-
- /* Return error if parsing failed. */
- if (U_FAILURE(status)) {
- return -1;
- }
- }
-
- /* iterate through the pattern */
- while(!locStringContext || locStringContext->available >= 0) {
-
- /* find the next '%' */
- lastAlias = alias;
- while(*alias != UP_PERCENT && *alias != 0x0000) {
- alias++;
- }
-
- /* write any characters before the '%' */
- if(alias > lastAlias) {
- *written += (streamHandler->write)(context, lastAlias, (int32_t)(alias - lastAlias));
- }
-
- /* break if at end of string */
- if(*alias == 0x0000) {
- break;
- }
-
- /* initialize spec to default values */
- spec.fWidthPos = -1;
- spec.fPrecisionPos = -1;
- spec.fArgPos = -1;
-
- uprv_memset(info, 0, sizeof(*info));
- info->fPrecision = -1;
- info->fWidth = -1;
- info->fPadChar = 0x0020;
-
- /* skip over the initial '%' */
- alias++;
-
- /* Check for positional argument */
- if(ISDIGIT(*alias)) {
-
- /* Save the current position */
- backup = alias;
-
- /* handle positional parameters */
- if(ISDIGIT(*alias)) {
- spec.fArgPos = (int) (*alias++ - DIGIT_ZERO);
-
- while(ISDIGIT(*alias)) {
- spec.fArgPos *= 10;
- spec.fArgPos += (int) (*alias++ - DIGIT_ZERO);
- }
- }
-
- /* if there is no '$', don't read anything */
- if(*alias != SPEC_DOLLARSIGN) {
- spec.fArgPos = -1;
- alias = backup;
- }
- /* munge the '$' */
- else
- alias++;
- }
-
- /* Get any format flags */
- while(ISFLAG(*alias)) {
- switch(*alias++) {
-
- /* left justify */
- case FLAG_MINUS:
- info->fLeft = TRUE;
- break;
-
- /* always show sign */
- case FLAG_PLUS:
- info->fShowSign = TRUE;
- break;
-
- /* use space if no sign present */
- case FLAG_SPACE:
- info->fShowSign = TRUE;
- info->fSpace = TRUE;
- break;
-
- /* use alternate form */
- case FLAG_POUND:
- info->fAlt = TRUE;
- break;
-
- /* pad with leading zeroes */
- case FLAG_ZERO:
- info->fZero = TRUE;
- info->fPadChar = 0x0030;
- break;
-
- /* pad character specified */
- case FLAG_PAREN:
-
- /* TODO test that all four are numbers */
- /* first four characters are hex values for pad char */
- info->fPadChar = (UChar)ufmt_digitvalue(*alias++);
- info->fPadChar = (UChar)((info->fPadChar * 16) + ufmt_digitvalue(*alias++));
- info->fPadChar = (UChar)((info->fPadChar * 16) + ufmt_digitvalue(*alias++));
- info->fPadChar = (UChar)((info->fPadChar * 16) + ufmt_digitvalue(*alias++));
-
- /* final character is ignored */
- alias++;
-
- break;
- }
- }
-
- /* Get the width */
-
- /* width is specified out of line */
- if(*alias == SPEC_ASTERISK) {
-
- info->fWidth = -2;
-
- /* Skip the '*' */
- alias++;
-
- /* Save the current position */
- backup = alias;
-
- /* handle positional parameters */
- if(ISDIGIT(*alias)) {
- spec.fWidthPos = (int) (*alias++ - DIGIT_ZERO);
-
- while(ISDIGIT(*alias)) {
- spec.fWidthPos *= 10;
- spec.fWidthPos += (int) (*alias++ - DIGIT_ZERO);
- }
- }
-
- /* if there is no '$', don't read anything */
- if(*alias != SPEC_DOLLARSIGN) {
- spec.fWidthPos = -1;
- alias = backup;
- }
- /* munge the '$' */
- else
- alias++;
- }
- /* read the width, if present */
- else if(ISDIGIT(*alias)){
- info->fWidth = (int) (*alias++ - DIGIT_ZERO);
-
- while(ISDIGIT(*alias)) {
- info->fWidth *= 10;
- info->fWidth += (int) (*alias++ - DIGIT_ZERO);
- }
- }
-
- /* Get the precision */
-
- if(*alias == SPEC_PERIOD) {
-
- /* eat up the '.' */
- alias++;
-
- /* precision is specified out of line */
- if(*alias == SPEC_ASTERISK) {
-
- info->fPrecision = -2;
-
- /* Skip the '*' */
- alias++;
-
- /* save the current position */
- backup = alias;
-
- /* handle positional parameters */
- if(ISDIGIT(*alias)) {
- spec.fPrecisionPos = (int) (*alias++ - DIGIT_ZERO);
-
- while(ISDIGIT(*alias)) {
- spec.fPrecisionPos *= 10;
- spec.fPrecisionPos += (int) (*alias++ - DIGIT_ZERO);
- }
-
- /* if there is no '$', don't read anything */
- if(*alias != SPEC_DOLLARSIGN) {
- spec.fPrecisionPos = -1;
- alias = backup;
- }
- else {
- /* munge the '$' */
- alias++;
- }
- }
- }
- /* read the precision */
- else if(ISDIGIT(*alias)){
- info->fPrecision = (int) (*alias++ - DIGIT_ZERO);
-
- while(ISDIGIT(*alias)) {
- info->fPrecision *= 10;
- info->fPrecision += (int) (*alias++ - DIGIT_ZERO);
- }
- }
- }
-
- /* Get any modifiers */
- if(ISMOD(*alias)) {
- switch(*alias++) {
-
- /* short */
- case MOD_H:
- info->fIsShort = TRUE;
- break;
-
- /* long or long long */
- case MOD_LOWERL:
- if(*alias == MOD_LOWERL) {
- info->fIsLongLong = TRUE;
- /* skip over the next 'l' */
- alias++;
- }
- else
- info->fIsLong = TRUE;
- break;
-
- /* long double */
- case MOD_L:
- info->fIsLongDouble = TRUE;
- break;
- }
- }
-
- /* finally, get the specifier letter */
- info->fSpec = *alias++;
- info->fOrigSpec = info->fSpec;
-
- /* fill in the precision and width, if specified out of line */
-
- /* width specified out of line */
- if(spec.fInfo.fWidth == -2) {
- if(spec.fWidthPos == -1) {
- /* read the width from the argument list */
- info->fWidth = va_arg(ap, int32_t);
- }
- /* else handle positional parameter */
-
- /* if it's negative, take the absolute value and set left alignment */
- if(info->fWidth < 0) {
- info->fWidth *= -1; /* Make positive */
- info->fLeft = TRUE;
- }
- }
-
- /* precision specified out of line */
- if(info->fPrecision == -2) {
- if(spec.fPrecisionPos == -1) {
- /* read the precision from the argument list */
- info->fPrecision = va_arg(ap, int32_t);
- }
- /* else handle positional parameter */
-
- /* if it's negative, set it to zero */
- if(info->fPrecision < 0)
- info->fPrecision = 0;
- }
-
- handlerNum = (uint16_t)(info->fSpec - UPRINTF_BASE_FMT_HANDLERS);
- if (handlerNum < UPRINTF_NUM_FMT_HANDLERS) {
- /* query the info function for argument information */
- argType = g_u_printf_infos[ handlerNum ].info;
-
- /* goto the correct argument on arg_list if position is specified */
- if (spec.fArgPos > 0) {
- /* offset position by 1 */
- spec.fArgPos--;
- switch(argType) {
- case ufmt_count:
- /* set the spec's width to the # of chars written */
- info->fWidth = *written;
- /* fall through to set the pointer */
- U_FALLTHROUGH;
- case ufmt_string:
- case ufmt_ustring:
- case ufmt_pointer:
- args.ptrValue = arglist[spec.fArgPos].ptrValue;
- break;
- case ufmt_char:
- case ufmt_uchar:
- case ufmt_int:
- args.int64Value = arglist[spec.fArgPos].int64Value;
- break;
- case ufmt_float:
- args.floatValue = arglist[spec.fArgPos].floatValue;
- break;
- case ufmt_double:
- args.doubleValue = arglist[spec.fArgPos].doubleValue;
- break;
- default:
- /* else args is ignored */
- args.ptrValue = NULL;
- break;
- }
- } else { /* no positional argument specified */
- switch(argType) {
- case ufmt_count:
- /* set the spec's width to the # of chars written */
- info->fWidth = *written;
- /* fall through to set the pointer */
- U_FALLTHROUGH;
- case ufmt_string:
- case ufmt_ustring:
- case ufmt_pointer:
- args.ptrValue = va_arg(ap, void*);
- break;
- case ufmt_char:
- case ufmt_uchar:
- case ufmt_int:
- if (info->fIsLongLong) {
- args.int64Value = va_arg(ap, int64_t);
- }
- else {
- args.int64Value = va_arg(ap, int32_t);
+ (void)formatBundle;
+ UChar result[UPRINTF_BUFFER_SIZE];
+ int32_t len = UPRINTF_BUFFER_SIZE;
+
+ /* format the pointer in hex */
+ ufmt_ptou(result, &len, args[0].ptrValue, TRUE/*, info->fPrecision*/);
+
+ return handler->pad_and_justify(context, info, result, len);
+}
+
+static int32_t
+u_printf_scientific_handler(const u_printf_stream_handler *handler,
+ void *context,
+ ULocaleBundle *formatBundle,
+ const u_printf_spec_info *info,
+ const ufmt_args *args)
+{
+ double num = (double) (args[0].doubleValue);
+ UNumberFormat *format;
+ UChar result[UPRINTF_BUFFER_SIZE];
+ UChar prefixBuffer[UPRINTF_BUFFER_SIZE];
+ int32_t prefixBufferLen = sizeof(prefixBuffer);
+ int32_t minDecimalDigits;
+ int32_t maxDecimalDigits;
+ UErrorCode status = U_ZERO_ERROR;
+ UChar srcExpBuf[UPRINTF_SYMBOL_BUFFER_SIZE];
+ int32_t srcLen, expLen;
+ int32_t resultLen;
+ UChar expBuf[UPRINTF_SYMBOL_BUFFER_SIZE];
+
+ prefixBuffer[0] = 0;
+
+ /* mask off any necessary bits */
+ /* if(! info->fIsLongDouble)
+ num &= DBL_MAX;*/
+
+ /* get the formatter */
+ format = u_locbund_getNumberFormat(formatBundle, UNUM_SCIENTIFIC);
+
+ /* handle error */
+ if(format == 0)
+ return 0;
+
+ /* set the appropriate flags on the formatter */
+
+ srcLen = unum_getSymbol(format,
+ UNUM_EXPONENTIAL_SYMBOL,
+ srcExpBuf,
+ sizeof(srcExpBuf),
+ &status);
+
+ /* Upper/lower case the e */
+ if (info->fSpec == (UChar)0x65 /* e */) {
+ expLen = u_strToLower(expBuf, (int32_t)sizeof(expBuf),
+ srcExpBuf, srcLen,
+ formatBundle->fLocale,
+ &status);
+ }
+ else {
+ expLen = u_strToUpper(expBuf, (int32_t)sizeof(expBuf),
+ srcExpBuf, srcLen,
+ formatBundle->fLocale,
+ &status);
+ }
+
+ unum_setSymbol(format,
+ UNUM_EXPONENTIAL_SYMBOL,
+ expBuf,
+ expLen,
+ &status);
+
+ /* save the formatter's state */
+ minDecimalDigits = unum_getAttribute(format, UNUM_MIN_FRACTION_DIGITS);
+ maxDecimalDigits = unum_getAttribute(format, UNUM_MAX_FRACTION_DIGITS);
+
+ /* set the appropriate flags and number of decimal digits on the formatter */
+ if(info->fPrecision != -1) {
+ /* set the # of decimal digits */
+ if (info->fOrigSpec == (UChar)0x65 /* e */ || info->fOrigSpec == (UChar)0x45 /* E */) {
+ unum_setAttribute(format, UNUM_FRACTION_DIGITS, info->fPrecision);
+ }
+ else {
+ unum_setAttribute(format, UNUM_MIN_FRACTION_DIGITS, 1);
+ unum_setAttribute(format, UNUM_MAX_FRACTION_DIGITS, info->fPrecision);
+ }
+ }
+ else if(info->fAlt) {
+ /* '#' means always show decimal point */
+ /* copy of printf behavior on Solaris - '#' shows 6 digits */
+ unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6);
+ }
+ else {
+ /* # of decimal digits is 6 if precision not specified */
+ unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6);
+ }
+
+ /* set whether to show the sign */
+ if (info->fShowSign) {
+ u_printf_set_sign(format, info, prefixBuffer, &prefixBufferLen, &status);
+ }
+
+ /* format the number */
+ resultLen = unum_formatDouble(format, num, result, UPRINTF_BUFFER_SIZE, 0, &status);
+
+ if (U_FAILURE(status)) {
+ resultLen = 0;
+ }
+
+ /* restore the number format */
+ /* TODO: Is this needed? */
+ unum_setAttribute(format, UNUM_MIN_FRACTION_DIGITS, minDecimalDigits);
+ unum_setAttribute(format, UNUM_MAX_FRACTION_DIGITS, maxDecimalDigits);
+
+ /* Since we're the only one using the scientific
+ format, we don't need to save the old exponent value. */
+ /*unum_setSymbol(format,
+ UNUM_EXPONENTIAL_SYMBOL,
+ srcExpBuf,
+ srcLen,
+ &status);*/
+
+ if (info->fShowSign) {
+ /* Reset back to original value regardless of what the error was */
+ UErrorCode localStatus = U_ZERO_ERROR;
+ u_printf_reset_sign(format, info, prefixBuffer, &prefixBufferLen, &localStatus);
+ }
+
+ return handler->pad_and_justify(context, info, result, resultLen);
+}
+
+static int32_t
+u_printf_percent_handler(const u_printf_stream_handler *handler,
+ void *context,
+ ULocaleBundle *formatBundle,
+ const u_printf_spec_info *info,
+ const ufmt_args *args)
+{
+ double num = (double) (args[0].doubleValue);
+ UNumberFormat *format;
+ UChar result[UPRINTF_BUFFER_SIZE];
+ UChar prefixBuffer[UPRINTF_BUFFER_SIZE];
+ int32_t prefixBufferLen = sizeof(prefixBuffer);
+ int32_t minDecimalDigits;
+ int32_t maxDecimalDigits;
+ int32_t resultLen;
+ UErrorCode status = U_ZERO_ERROR;
+
+ prefixBuffer[0] = 0;
+
+ /* mask off any necessary bits */
+ /* if(! info->fIsLongDouble)
+ num &= DBL_MAX;*/
+
+ /* get the formatter */
+ format = u_locbund_getNumberFormat(formatBundle, UNUM_PERCENT);
+
+ /* handle error */
+ if(format == 0)
+ return 0;
+
+ /* save the formatter's state */
+ minDecimalDigits = unum_getAttribute(format, UNUM_MIN_FRACTION_DIGITS);
+ maxDecimalDigits = unum_getAttribute(format, UNUM_MAX_FRACTION_DIGITS);
+
+ /* set the appropriate flags and number of decimal digits on the formatter */
+ if(info->fPrecision != -1) {
+ /* set the # of decimal digits */
+ unum_setAttribute(format, UNUM_FRACTION_DIGITS, info->fPrecision);
+ }
+ else if(info->fAlt) {
+ /* '#' means always show decimal point */
+ /* copy of printf behavior on Solaris - '#' shows 6 digits */
+ unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6);
+ }
+ else {
+ /* # of decimal digits is 6 if precision not specified */
+ unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6);
+ }
+
+ /* set whether to show the sign */
+ if (info->fShowSign) {
+ u_printf_set_sign(format, info, prefixBuffer, &prefixBufferLen, &status);
+ }
+
+ /* format the number */
+ resultLen = unum_formatDouble(format, num, result, UPRINTF_BUFFER_SIZE, 0, &status);
+
+ if (U_FAILURE(status)) {
+ resultLen = 0;
+ }
+
+ /* restore the number format */
+ /* TODO: Is this needed? */
+ unum_setAttribute(format, UNUM_MIN_FRACTION_DIGITS, minDecimalDigits);
+ unum_setAttribute(format, UNUM_MAX_FRACTION_DIGITS, maxDecimalDigits);
+
+ if (info->fShowSign) {
+ /* Reset back to original value regardless of what the error was */
+ UErrorCode localStatus = U_ZERO_ERROR;
+ u_printf_reset_sign(format, info, prefixBuffer, &prefixBufferLen, &localStatus);
+ }
+
+ return handler->pad_and_justify(context, info, result, resultLen);
+}
+
+static int32_t
+u_printf_ustring_handler(const u_printf_stream_handler *handler,
+ void *context,
+ ULocaleBundle *formatBundle,
+ const u_printf_spec_info *info,
+ const ufmt_args *args)
+{
+ (void)formatBundle;
+ int32_t len, written;
+ const UChar *arg = (const UChar*)(args[0].ptrValue);
+
+ /* allocate enough space for the buffer */
+ if (arg == NULL) {
+ arg = gNullStr;
+ }
+ len = u_strlen(arg);
+
+ /* width = minimum # of characters to write */
+ /* precision = maximum # of characters to write */
+ if (info->fPrecision != -1 && info->fPrecision < len) {
+ len = info->fPrecision;
+ }
+
+ /* determine if the string should be padded */
+ written = handler->pad_and_justify(context, info, arg, len);
+
+ return written;
+}
+
+static int32_t
+u_printf_uchar_handler(const u_printf_stream_handler *handler,
+ void *context,
+ ULocaleBundle *formatBundle,
+ const u_printf_spec_info *info,
+ const ufmt_args *args)
+{
+ (void)formatBundle;
+ int32_t written = 0;
+ UChar arg = (UChar)(args[0].int64Value);
+
+ /* width = minimum # of characters to write */
+ /* precision = maximum # of characters to write */
+ /* precision is ignored when handling a uchar */
+
+ /* determine if the string should be padded */
+ written = handler->pad_and_justify(context, info, &arg, 1);
+
+ return written;
+}
+
+static int32_t
+u_printf_scidbl_handler(const u_printf_stream_handler *handler,
+ void *context,
+ ULocaleBundle *formatBundle,
+ const u_printf_spec_info *info,
+ const ufmt_args *args)
+{
+ u_printf_spec_info scidbl_info;
+ double num = args[0].doubleValue;
+ int32_t retVal;
+ UNumberFormat *format;
+ int32_t maxSigDecimalDigits, significantDigits;
+
+ memcpy(&scidbl_info, info, sizeof(u_printf_spec_info));
+
+ /* determine whether to use 'd', 'e' or 'f' notation */
+ if (scidbl_info.fPrecision == -1 && num == uprv_trunc(num))
+ {
+ /* use 'f' notation */
+ scidbl_info.fSpec = 0x0066;
+ scidbl_info.fPrecision = 0;
+ /* call the double handler */
+ retVal = u_printf_double_handler(handler, context, formatBundle, &scidbl_info, args);
+ }
+ else if(num < 0.0001 || (scidbl_info.fPrecision < 1 && 1000000.0 <= num)
+ || (scidbl_info.fPrecision != -1 && num > uprv_pow10(scidbl_info.fPrecision)))
+ {
+ /* use 'e' or 'E' notation */
+ scidbl_info.fSpec = scidbl_info.fSpec - 2;
+ if (scidbl_info.fPrecision == -1) {
+ scidbl_info.fPrecision = 5;
+ }
+ /* call the scientific handler */
+ retVal = u_printf_scientific_handler(handler, context, formatBundle, &scidbl_info, args);
+ }
+ else {
+ format = u_locbund_getNumberFormat(formatBundle, UNUM_DECIMAL);
+ /* Check for null pointer */
+ if (format == NULL) {
+ return 0;
+ }
+ maxSigDecimalDigits = unum_getAttribute(format, UNUM_MAX_SIGNIFICANT_DIGITS);
+ significantDigits = scidbl_info.fPrecision;
+
+ /* use 'f' notation */
+ scidbl_info.fSpec = 0x0066;
+ if (significantDigits == -1) {
+ significantDigits = 6;
+ }
+ unum_setAttribute(format, UNUM_SIGNIFICANT_DIGITS_USED, TRUE);
+ unum_setAttribute(format, UNUM_MAX_SIGNIFICANT_DIGITS, significantDigits);
+ /* call the double handler */
+ retVal = u_printf_double_handler(handler, context, formatBundle, &scidbl_info, args);
+ unum_setAttribute(format, UNUM_MAX_SIGNIFICANT_DIGITS, maxSigDecimalDigits);
+ unum_setAttribute(format, UNUM_SIGNIFICANT_DIGITS_USED, FALSE);
+ }
+ return retVal;
+}
+
+static int32_t
+u_printf_count_handler(const u_printf_stream_handler *handler,
+ void *context,
+ ULocaleBundle *formatBundle,
+ const u_printf_spec_info *info,
+ const ufmt_args *args)
+{
+ (void)handler;
+ (void)context;
+ (void)formatBundle;
+ int32_t *count = (int32_t*)(args[0].ptrValue);
+
+ /* in the special case of count, the u_printf_spec_info's width */
+ /* will contain the # of chars written thus far */
+ *count = info->fWidth;
+
+ return 0;
+}
+
+static int32_t
+u_printf_spellout_handler(const u_printf_stream_handler *handler,
+ void *context,
+ ULocaleBundle *formatBundle,
+ const u_printf_spec_info *info,
+ const ufmt_args *args)
+{
+ double num = (double) (args[0].doubleValue);
+ UNumberFormat *format;
+ UChar result[UPRINTF_BUFFER_SIZE];
+ UChar prefixBuffer[UPRINTF_BUFFER_SIZE];
+ int32_t prefixBufferLen = sizeof(prefixBuffer);
+ int32_t minDecimalDigits;
+ int32_t maxDecimalDigits;
+ int32_t resultLen;
+ UErrorCode status = U_ZERO_ERROR;
+
+ prefixBuffer[0] = 0;
+
+ /* mask off any necessary bits */
+ /* if(! info->fIsLongDouble)
+ num &= DBL_MAX;*/
+
+ /* get the formatter */
+ format = u_locbund_getNumberFormat(formatBundle, UNUM_SPELLOUT);
+
+ /* handle error */
+ if(format == 0)
+ return 0;
+
+ /* save the formatter's state */
+ minDecimalDigits = unum_getAttribute(format, UNUM_MIN_FRACTION_DIGITS);
+ maxDecimalDigits = unum_getAttribute(format, UNUM_MAX_FRACTION_DIGITS);
+
+ /* set the appropriate flags and number of decimal digits on the formatter */
+ if(info->fPrecision != -1) {
+ /* set the # of decimal digits */
+ unum_setAttribute(format, UNUM_FRACTION_DIGITS, info->fPrecision);
+ }
+ else if(info->fAlt) {
+ /* '#' means always show decimal point */
+ /* copy of printf behavior on Solaris - '#' shows 6 digits */
+ unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6);
+ }
+ else {
+ /* # of decimal digits is 6 if precision not specified */
+ unum_setAttribute(format, UNUM_FRACTION_DIGITS, 6);
+ }
+
+ /* set whether to show the sign */
+ if (info->fShowSign) {
+ u_printf_set_sign(format, info, prefixBuffer, &prefixBufferLen, &status);
+ }
+
+ /* format the number */
+ resultLen = unum_formatDouble(format, num, result, UPRINTF_BUFFER_SIZE, 0, &status);
+
+ if (U_FAILURE(status)) {
+ resultLen = 0;
+ }
+
+ /* restore the number format */
+ /* TODO: Is this needed? */
+ unum_setAttribute(format, UNUM_MIN_FRACTION_DIGITS, minDecimalDigits);
+ unum_setAttribute(format, UNUM_MAX_FRACTION_DIGITS, maxDecimalDigits);
+
+ if (info->fShowSign) {
+ /* Reset back to original value regardless of what the error was */
+ UErrorCode localStatus = U_ZERO_ERROR;
+ u_printf_reset_sign(format, info, prefixBuffer, &prefixBufferLen, &localStatus);
+ }
+
+ return handler->pad_and_justify(context, info, result, resultLen);
+}
+
+/* Use US-ASCII characters only for formatting. Most codepages have
+ characters 20-7F from Unicode. Using any other codepage specific
+ characters will make it very difficult to format the string on
+ non-Unicode machines */
+static const u_printf_info g_u_printf_infos[UPRINTF_NUM_FMT_HANDLERS] = {
+/* 0x20 */
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_EMPTY, UFMT_SIMPLE_PERCENT,UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+
+/* 0x30 */
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+
+/* 0x40 */
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_UCHAR,
+ UFMT_EMPTY, UFMT_SCIENTIFIC, UFMT_EMPTY, UFMT_SCIDBL,
+#ifdef U_USE_OBSOLETE_IO_FORMATTING
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_UCHAR/*deprecated*/,
+#else
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+#endif
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+
+/* 0x50 */
+ UFMT_PERCENT, UFMT_EMPTY, UFMT_EMPTY, UFMT_USTRING,
+#ifdef U_USE_OBSOLETE_IO_FORMATTING
+ UFMT_EMPTY, UFMT_USTRING/*deprecated*/,UFMT_SPELLOUT, UFMT_EMPTY,
+#else
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_SPELLOUT, UFMT_EMPTY,
+#endif
+ UFMT_HEX, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+
+/* 0x60 */
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_CHAR,
+ UFMT_INT, UFMT_SCIENTIFIC, UFMT_DOUBLE, UFMT_SCIDBL,
+ UFMT_EMPTY, UFMT_INT, UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_COUNT, UFMT_OCTAL,
+
+/* 0x70 */
+ UFMT_POINTER, UFMT_EMPTY, UFMT_EMPTY, UFMT_STRING,
+ UFMT_EMPTY, UFMT_UINT, UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_HEX, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+};
+
+/* flag characters for uprintf */
+#define FLAG_MINUS 0x002D
+#define FLAG_PLUS 0x002B
+#define FLAG_SPACE 0x0020
+#define FLAG_POUND 0x0023
+#define FLAG_ZERO 0x0030
+#define FLAG_PAREN 0x0028
+
+#define ISFLAG(s) (s) == FLAG_MINUS || \
+ (s) == FLAG_PLUS || \
+ (s) == FLAG_SPACE || \
+ (s) == FLAG_POUND || \
+ (s) == FLAG_ZERO || \
+ (s) == FLAG_PAREN
+
+/* special characters for uprintf */
+#define SPEC_ASTERISK 0x002A
+#define SPEC_DOLLARSIGN 0x0024
+#define SPEC_PERIOD 0x002E
+#define SPEC_PERCENT 0x0025
+
+/* unicode digits */
+#define DIGIT_ZERO 0x0030
+#define DIGIT_ONE 0x0031
+#define DIGIT_TWO 0x0032
+#define DIGIT_THREE 0x0033
+#define DIGIT_FOUR 0x0034
+#define DIGIT_FIVE 0x0035
+#define DIGIT_SIX 0x0036
+#define DIGIT_SEVEN 0x0037
+#define DIGIT_EIGHT 0x0038
+#define DIGIT_NINE 0x0039
+
+#define ISDIGIT(s) (s) == DIGIT_ZERO || \
+ (s) == DIGIT_ONE || \
+ (s) == DIGIT_TWO || \
+ (s) == DIGIT_THREE || \
+ (s) == DIGIT_FOUR || \
+ (s) == DIGIT_FIVE || \
+ (s) == DIGIT_SIX || \
+ (s) == DIGIT_SEVEN || \
+ (s) == DIGIT_EIGHT || \
+ (s) == DIGIT_NINE
+
+/* u_printf modifiers */
+#define MOD_H 0x0068
+#define MOD_LOWERL 0x006C
+#define MOD_L 0x004C
+
+#define ISMOD(s) (s) == MOD_H || \
+ (s) == MOD_LOWERL || \
+ (s) == MOD_L
+/* Returns an array of the parsed argument type given in the format string. */
+static ufmt_args* parseArguments(const UChar *alias, va_list ap, UErrorCode *status) {
+ ufmt_args *arglist = NULL;
+ ufmt_type_info *typelist = NULL;
+ UBool *islonglong = NULL;
+ int32_t size = 0;
+ int32_t pos = 0;
+ UChar type;
+ uint16_t handlerNum;
+ const UChar *aliasStart = alias;
+
+ /* get maximum number of arguments */
+ for(;;) {
+ /* find % */
+ while(*alias != UP_PERCENT && *alias != 0x0000) {
+ alias++;
+ }
+
+ if(*alias == 0x0000) {
+ break;
+ }
+
+ alias++;
+
+ /* handle the pos number */
+ if(ISDIGIT(*alias)) {
+
+ /* handle positional parameters */
+ if(ISDIGIT(*alias)) {
+ pos = (int) (*alias++ - DIGIT_ZERO);
+
+ while(ISDIGIT(*alias)) {
+ pos *= 10;
+ pos += (int) (*alias++ - DIGIT_ZERO);
+ }
+ }
+
+ /* if there is no '$', don't read anything */
+ if(*alias != SPEC_DOLLARSIGN) {
+ return NULL;
+ }
+ } else {
+ return NULL;
+ }
+
+ if (pos > size) {
+ size = pos;
+ }
+ }
+
+ /* create the parsed argument list */
+ typelist = (ufmt_type_info*)uprv_malloc(sizeof(ufmt_type_info) * size);
+ islonglong = (UBool*)uprv_malloc(sizeof(UBool) * size);
+ arglist = (ufmt_args*)uprv_malloc(sizeof(ufmt_args) * size);
+
+ /* If malloc failed, return NULL */
+ if (!typelist || !islonglong || !arglist) {
+ if (typelist) {
+ uprv_free(typelist);
+ }
+
+ if (islonglong) {
+ uprv_free(islonglong);
+ }
+
+ if (arglist) {
+ uprv_free(arglist);
+ }
+
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+
+ /* reset alias back to the beginning */
+ alias = aliasStart;
+
+ for(;;) {
+ /* find % */
+ while(*alias != UP_PERCENT && *alias != 0x0000) {
+ alias++;
+ }
+
+ if(*alias == 0x0000) {
+ break;
+ }
+
+ alias++;
+
+ /* handle positional parameters */
+ if(ISDIGIT(*alias)) {
+ pos = (int) (*alias++ - DIGIT_ZERO);
+
+ while(ISDIGIT(*alias)) {
+ pos *= 10;
+ pos += (int) (*alias++ - DIGIT_ZERO);
+ }
+ }
+ /* offset position by 1 */
+ pos--;
+
+ /* skip over everything except for the type */
+ while (ISMOD(*alias) || ISFLAG(*alias) || ISDIGIT(*alias) ||
+ *alias == SPEC_ASTERISK || *alias == SPEC_PERIOD || *alias == SPEC_DOLLARSIGN) {
+ islonglong[pos] = FALSE;
+ if (ISMOD(*alias)) {
+ alias++;
+ if (*alias == MOD_LOWERL) {
+ islonglong[pos] = TRUE;
}
- break;
- case ufmt_float:
- args.floatValue = (float) va_arg(ap, double);
- break;
- case ufmt_double:
- args.doubleValue = va_arg(ap, double);
- break;
- default:
- /* else args is ignored */
- args.ptrValue = NULL;
- break;
}
- }
-
- /* call the handler function */
- handler = g_u_printf_infos[ handlerNum ].handler;
- if(handler != 0) {
- *written += (*handler)(streamHandler, context, formatBundle, info, &args);
- }
- else {
- /* just echo unknown tags */
- *written += (streamHandler->write)(context, fmt, (int32_t)(alias - lastAlias));
- }
- }
- else {
- /* just echo unknown tags */
- *written += (streamHandler->write)(context, fmt, (int32_t)(alias - lastAlias));
- }
- }
- /* delete parsed argument list */
- if (arglist != NULL) {
- uprv_free(arglist);
- }
- /* return # of characters in this format that have been parsed. */
- return (int32_t)(alias - fmt);
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+ alias++;
+ }
+ type = *alias;
+
+ /* store the argument type in the correct position of the parsed argument list */
+ handlerNum = (uint16_t)(type - UPRINTF_BASE_FMT_HANDLERS);
+ if (handlerNum < UPRINTF_NUM_FMT_HANDLERS) {
+ typelist[pos] = g_u_printf_infos[ handlerNum ].info;
+ } else {
+ typelist[pos] = ufmt_empty;
+ }
+ }
+
+ /* store argument in arglist */
+ for (pos = 0; pos < size; pos++) {
+ switch (typelist[pos]) {
+ case ufmt_string:
+ case ufmt_ustring:
+ case ufmt_pointer:
+ arglist[pos].ptrValue = va_arg(ap, void*);
+ break;
+ case ufmt_char:
+ case ufmt_uchar:
+ case ufmt_int:
+ if (islonglong[pos]) {
+ arglist[pos].int64Value = va_arg(ap, int64_t);
+ }
+ else {
+ arglist[pos].int64Value = va_arg(ap, int32_t);
+ }
+ break;
+ case ufmt_float:
+ arglist[pos].floatValue = (float) va_arg(ap, double);
+ break;
+ case ufmt_double:
+ arglist[pos].doubleValue = va_arg(ap, double);
+ break;
+ default:
+ /* else args is ignored */
+ arglist[pos].ptrValue = NULL;
+ break;
+ }
+ }
+
+ uprv_free(typelist);
+ uprv_free(islonglong);
+
+ return arglist;
+}
+
+/* We parse the argument list in Unicode */
+U_CFUNC int32_t
+u_printf_parse(const u_printf_stream_handler *streamHandler,
+ const UChar *fmt,
+ void *context,
+ u_localized_print_string *locStringContext,
+ ULocaleBundle *formatBundle,
+ int32_t *written,
+ va_list ap)
+{
+ uint16_t handlerNum;
+ ufmt_args args;
+ ufmt_type_info argType;
+ u_printf_handler *handler;
+ u_printf_spec spec;
+ u_printf_spec_info *info = &(spec.fInfo);
+
+ const UChar *alias = fmt;
+ const UChar *backup;
+ const UChar *lastAlias;
+ const UChar *orgAlias = fmt;
+ /* parsed argument list */
+ ufmt_args *arglist = NULL; /* initialized it to avoid compiler warnings */
+ UErrorCode status = U_ZERO_ERROR;
+ if (!locStringContext || locStringContext->available >= 0) {
+ /* get the parsed list of argument types */
+ arglist = parseArguments(orgAlias, ap, &status);
+
+ /* Return error if parsing failed. */
+ if (U_FAILURE(status)) {
+ return -1;
+ }
+ }
+
+ /* iterate through the pattern */
+ while(!locStringContext || locStringContext->available >= 0) {
+
+ /* find the next '%' */
+ lastAlias = alias;
+ while(*alias != UP_PERCENT && *alias != 0x0000) {
+ alias++;
+ }
+
+ /* write any characters before the '%' */
+ if(alias > lastAlias) {
+ *written += (streamHandler->write)(context, lastAlias, (int32_t)(alias - lastAlias));
+ }
+
+ /* break if at end of string */
+ if(*alias == 0x0000) {
+ break;
+ }
+
+ /* initialize spec to default values */
+ spec.fWidthPos = -1;
+ spec.fPrecisionPos = -1;
+ spec.fArgPos = -1;
+
+ uprv_memset(info, 0, sizeof(*info));
+ info->fPrecision = -1;
+ info->fWidth = -1;
+ info->fPadChar = 0x0020;
+
+ /* skip over the initial '%' */
+ alias++;
+
+ /* Check for positional argument */
+ if(ISDIGIT(*alias)) {
+
+ /* Save the current position */
+ backup = alias;
+
+ /* handle positional parameters */
+ if(ISDIGIT(*alias)) {
+ spec.fArgPos = (int) (*alias++ - DIGIT_ZERO);
+
+ while(ISDIGIT(*alias)) {
+ spec.fArgPos *= 10;
+ spec.fArgPos += (int) (*alias++ - DIGIT_ZERO);
+ }
+ }
+
+ /* if there is no '$', don't read anything */
+ if(*alias != SPEC_DOLLARSIGN) {
+ spec.fArgPos = -1;
+ alias = backup;
+ }
+ /* munge the '$' */
+ else
+ alias++;
+ }
+
+ /* Get any format flags */
+ while(ISFLAG(*alias)) {
+ switch(*alias++) {
+
+ /* left justify */
+ case FLAG_MINUS:
+ info->fLeft = TRUE;
+ break;
+
+ /* always show sign */
+ case FLAG_PLUS:
+ info->fShowSign = TRUE;
+ break;
+
+ /* use space if no sign present */
+ case FLAG_SPACE:
+ info->fShowSign = TRUE;
+ info->fSpace = TRUE;
+ break;
+
+ /* use alternate form */
+ case FLAG_POUND:
+ info->fAlt = TRUE;
+ break;
+
+ /* pad with leading zeroes */
+ case FLAG_ZERO:
+ info->fZero = TRUE;
+ info->fPadChar = 0x0030;
+ break;
+
+ /* pad character specified */
+ case FLAG_PAREN:
+
+ /* TODO test that all four are numbers */
+ /* first four characters are hex values for pad char */
+ info->fPadChar = (UChar)ufmt_digitvalue(*alias++);
+ info->fPadChar = (UChar)((info->fPadChar * 16) + ufmt_digitvalue(*alias++));
+ info->fPadChar = (UChar)((info->fPadChar * 16) + ufmt_digitvalue(*alias++));
+ info->fPadChar = (UChar)((info->fPadChar * 16) + ufmt_digitvalue(*alias++));
+
+ /* final character is ignored */
+ alias++;
+
+ break;
+ }
+ }
+
+ /* Get the width */
+
+ /* width is specified out of line */
+ if(*alias == SPEC_ASTERISK) {
+
+ info->fWidth = -2;
+
+ /* Skip the '*' */
+ alias++;
+
+ /* Save the current position */
+ backup = alias;
+
+ /* handle positional parameters */
+ if(ISDIGIT(*alias)) {
+ spec.fWidthPos = (int) (*alias++ - DIGIT_ZERO);
+
+ while(ISDIGIT(*alias)) {
+ spec.fWidthPos *= 10;
+ spec.fWidthPos += (int) (*alias++ - DIGIT_ZERO);
+ }
+ }
+
+ /* if there is no '$', don't read anything */
+ if(*alias != SPEC_DOLLARSIGN) {
+ spec.fWidthPos = -1;
+ alias = backup;
+ }
+ /* munge the '$' */
+ else
+ alias++;
+ }
+ /* read the width, if present */
+ else if(ISDIGIT(*alias)){
+ info->fWidth = (int) (*alias++ - DIGIT_ZERO);
+
+ while(ISDIGIT(*alias)) {
+ info->fWidth *= 10;
+ info->fWidth += (int) (*alias++ - DIGIT_ZERO);
+ }
+ }
+
+ /* Get the precision */
+
+ if(*alias == SPEC_PERIOD) {
+
+ /* eat up the '.' */
+ alias++;
+
+ /* precision is specified out of line */
+ if(*alias == SPEC_ASTERISK) {
+
+ info->fPrecision = -2;
+
+ /* Skip the '*' */
+ alias++;
+
+ /* save the current position */
+ backup = alias;
+
+ /* handle positional parameters */
+ if(ISDIGIT(*alias)) {
+ spec.fPrecisionPos = (int) (*alias++ - DIGIT_ZERO);
+
+ while(ISDIGIT(*alias)) {
+ spec.fPrecisionPos *= 10;
+ spec.fPrecisionPos += (int) (*alias++ - DIGIT_ZERO);
+ }
+
+ /* if there is no '$', don't read anything */
+ if(*alias != SPEC_DOLLARSIGN) {
+ spec.fPrecisionPos = -1;
+ alias = backup;
+ }
+ else {
+ /* munge the '$' */
+ alias++;
+ }
+ }
+ }
+ /* read the precision */
+ else if(ISDIGIT(*alias)){
+ info->fPrecision = (int) (*alias++ - DIGIT_ZERO);
+
+ while(ISDIGIT(*alias)) {
+ info->fPrecision *= 10;
+ info->fPrecision += (int) (*alias++ - DIGIT_ZERO);
+ }
+ }
+ }
+
+ /* Get any modifiers */
+ if(ISMOD(*alias)) {
+ switch(*alias++) {
+
+ /* short */
+ case MOD_H:
+ info->fIsShort = TRUE;
+ break;
+
+ /* long or long long */
+ case MOD_LOWERL:
+ if(*alias == MOD_LOWERL) {
+ info->fIsLongLong = TRUE;
+ /* skip over the next 'l' */
+ alias++;
+ }
+ else
+ info->fIsLong = TRUE;
+ break;
+
+ /* long double */
+ case MOD_L:
+ info->fIsLongDouble = TRUE;
+ break;
+ }
+ }
+
+ /* finally, get the specifier letter */
+ info->fSpec = *alias++;
+ info->fOrigSpec = info->fSpec;
+
+ /* fill in the precision and width, if specified out of line */
+
+ /* width specified out of line */
+ if(spec.fInfo.fWidth == -2) {
+ if(spec.fWidthPos == -1) {
+ /* read the width from the argument list */
+ info->fWidth = va_arg(ap, int32_t);
+ }
+ /* else handle positional parameter */
+
+ /* if it's negative, take the absolute value and set left alignment */
+ if(info->fWidth < 0) {
+ info->fWidth *= -1; /* Make positive */
+ info->fLeft = TRUE;
+ }
+ }
+
+ /* precision specified out of line */
+ if(info->fPrecision == -2) {
+ if(spec.fPrecisionPos == -1) {
+ /* read the precision from the argument list */
+ info->fPrecision = va_arg(ap, int32_t);
+ }
+ /* else handle positional parameter */
+
+ /* if it's negative, set it to zero */
+ if(info->fPrecision < 0)
+ info->fPrecision = 0;
+ }
+
+ handlerNum = (uint16_t)(info->fSpec - UPRINTF_BASE_FMT_HANDLERS);
+ if (handlerNum < UPRINTF_NUM_FMT_HANDLERS) {
+ /* query the info function for argument information */
+ argType = g_u_printf_infos[ handlerNum ].info;
+
+ /* goto the correct argument on arg_list if position is specified */
+ if (spec.fArgPos > 0) {
+ /* offset position by 1 */
+ spec.fArgPos--;
+ switch(argType) {
+ case ufmt_count:
+ /* set the spec's width to the # of chars written */
+ info->fWidth = *written;
+ /* fall through to set the pointer */
+ U_FALLTHROUGH;
+ case ufmt_string:
+ case ufmt_ustring:
+ case ufmt_pointer:
+ args.ptrValue = arglist[spec.fArgPos].ptrValue;
+ break;
+ case ufmt_char:
+ case ufmt_uchar:
+ case ufmt_int:
+ args.int64Value = arglist[spec.fArgPos].int64Value;
+ break;
+ case ufmt_float:
+ args.floatValue = arglist[spec.fArgPos].floatValue;
+ break;
+ case ufmt_double:
+ args.doubleValue = arglist[spec.fArgPos].doubleValue;
+ break;
+ default:
+ /* else args is ignored */
+ args.ptrValue = NULL;
+ break;
+ }
+ } else { /* no positional argument specified */
+ switch(argType) {
+ case ufmt_count:
+ /* set the spec's width to the # of chars written */
+ info->fWidth = *written;
+ /* fall through to set the pointer */
+ U_FALLTHROUGH;
+ case ufmt_string:
+ case ufmt_ustring:
+ case ufmt_pointer:
+ args.ptrValue = va_arg(ap, void*);
+ break;
+ case ufmt_char:
+ case ufmt_uchar:
+ case ufmt_int:
+ if (info->fIsLongLong) {
+ args.int64Value = va_arg(ap, int64_t);
+ }
+ else {
+ args.int64Value = va_arg(ap, int32_t);
+ }
+ break;
+ case ufmt_float:
+ args.floatValue = (float) va_arg(ap, double);
+ break;
+ case ufmt_double:
+ args.doubleValue = va_arg(ap, double);
+ break;
+ default:
+ /* else args is ignored */
+ args.ptrValue = NULL;
+ break;
+ }
+ }
+
+ /* call the handler function */
+ handler = g_u_printf_infos[ handlerNum ].handler;
+ if(handler != 0) {
+ *written += (*handler)(streamHandler, context, formatBundle, info, &args);
+ }
+ else {
+ /* just echo unknown tags */
+ *written += (streamHandler->write)(context, fmt, (int32_t)(alias - lastAlias));
+ }
+ }
+ else {
+ /* just echo unknown tags */
+ *written += (streamHandler->write)(context, fmt, (int32_t)(alias - lastAlias));
+ }
+ }
+ /* delete parsed argument list */
+ if (arglist != NULL) {
+ uprv_free(arglist);
+ }
+ /* return # of characters in this format that have been parsed. */
+ return (int32_t)(alias - fmt);
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/io/uscanf.cpp b/contrib/libs/icu/io/uscanf.cpp
index f5c7c089cb..ce2e47a588 100644
--- a/contrib/libs/icu/io/uscanf.cpp
+++ b/contrib/libs/icu/io/uscanf.cpp
@@ -1,108 +1,108 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 1998-2014, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-*
-* File uscanf.c
-*
-* Modification History:
-*
-* Date Name Description
-* 12/02/98 stephen Creation.
-* 03/13/99 stephen Modified for new C API.
-******************************************************************************
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION
-
-#include "unicode/putil.h"
-#include "unicode/ustdio.h"
-#include "unicode/ustring.h"
-#include "uscanf.h"
-#include "ufile.h"
-#include "ufmt_cmn.h"
-
-#include "cmemory.h"
-#include "cstring.h"
-
-
-U_CAPI int32_t U_EXPORT2
-u_fscanf(UFILE *f,
- const char *patternSpecification,
- ... )
-{
- va_list ap;
- int32_t converted;
-
- va_start(ap, patternSpecification);
- converted = u_vfscanf(f, patternSpecification, ap);
- va_end(ap);
-
- return converted;
-}
-
-U_CAPI int32_t U_EXPORT2
-u_fscanf_u(UFILE *f,
- const UChar *patternSpecification,
- ... )
-{
- va_list ap;
- int32_t converted;
-
- va_start(ap, patternSpecification);
- converted = u_vfscanf_u(f, patternSpecification, ap);
- va_end(ap);
-
- return converted;
-}
-
-U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_vfscanf(UFILE *f,
- const char *patternSpecification,
- va_list ap)
-{
- int32_t converted;
- UChar *pattern;
- UChar patBuffer[UFMT_DEFAULT_BUFFER_SIZE];
- int32_t size = (int32_t)uprv_strlen(patternSpecification) + 1;
-
- /* convert from the default codepage to Unicode */
- if (size >= MAX_UCHAR_BUFFER_SIZE(patBuffer)) {
- pattern = (UChar *)uprv_malloc(size * sizeof(UChar));
- if(pattern == 0) {
- return 0;
- }
- }
- else {
- pattern = patBuffer;
- }
- u_charsToUChars(patternSpecification, pattern, size);
-
- /* do the work */
- converted = u_vfscanf_u(f, pattern, ap);
-
- /* clean up */
- if (pattern != patBuffer) {
- uprv_free(pattern);
- }
-
- return converted;
-}
-
-U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_vfscanf_u(UFILE *f,
- const UChar *patternSpecification,
- va_list ap)
-{
- return u_scanf_parse(f, patternSpecification, ap);
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
-
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+******************************************************************************
+*
+* Copyright (C) 1998-2014, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+*
+* File uscanf.c
+*
+* Modification History:
+*
+* Date Name Description
+* 12/02/98 stephen Creation.
+* 03/13/99 stephen Modified for new C API.
+******************************************************************************
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION
+
+#include "unicode/putil.h"
+#include "unicode/ustdio.h"
+#include "unicode/ustring.h"
+#include "uscanf.h"
+#include "ufile.h"
+#include "ufmt_cmn.h"
+
+#include "cmemory.h"
+#include "cstring.h"
+
+
+U_CAPI int32_t U_EXPORT2
+u_fscanf(UFILE *f,
+ const char *patternSpecification,
+ ... )
+{
+ va_list ap;
+ int32_t converted;
+
+ va_start(ap, patternSpecification);
+ converted = u_vfscanf(f, patternSpecification, ap);
+ va_end(ap);
+
+ return converted;
+}
+
+U_CAPI int32_t U_EXPORT2
+u_fscanf_u(UFILE *f,
+ const UChar *patternSpecification,
+ ... )
+{
+ va_list ap;
+ int32_t converted;
+
+ va_start(ap, patternSpecification);
+ converted = u_vfscanf_u(f, patternSpecification, ap);
+ va_end(ap);
+
+ return converted;
+}
+
+U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_vfscanf(UFILE *f,
+ const char *patternSpecification,
+ va_list ap)
+{
+ int32_t converted;
+ UChar *pattern;
+ UChar patBuffer[UFMT_DEFAULT_BUFFER_SIZE];
+ int32_t size = (int32_t)uprv_strlen(patternSpecification) + 1;
+
+ /* convert from the default codepage to Unicode */
+ if (size >= MAX_UCHAR_BUFFER_SIZE(patBuffer)) {
+ pattern = (UChar *)uprv_malloc(size * sizeof(UChar));
+ if(pattern == 0) {
+ return 0;
+ }
+ }
+ else {
+ pattern = patBuffer;
+ }
+ u_charsToUChars(patternSpecification, pattern, size);
+
+ /* do the work */
+ converted = u_vfscanf_u(f, pattern, ap);
+
+ /* clean up */
+ if (pattern != patBuffer) {
+ uprv_free(pattern);
+ }
+
+ return converted;
+}
+
+U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_vfscanf_u(UFILE *f,
+ const UChar *patternSpecification,
+ va_list ap)
+{
+ return u_scanf_parse(f, patternSpecification, ap);
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
diff --git a/contrib/libs/icu/io/uscanf.h b/contrib/libs/icu/io/uscanf.h
index 1b2ef4906b..ebb8e79188 100644
--- a/contrib/libs/icu/io/uscanf.h
+++ b/contrib/libs/icu/io/uscanf.h
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
diff --git a/contrib/libs/icu/io/uscanf_p.cpp b/contrib/libs/icu/io/uscanf_p.cpp
index 73c4da73dc..6dc1c09dee 100644
--- a/contrib/libs/icu/io/uscanf_p.cpp
+++ b/contrib/libs/icu/io/uscanf_p.cpp
@@ -1,1450 +1,1450 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-*******************************************************************************
-*
-* Copyright (C) 1998-2016, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-*******************************************************************************
-*
-* File uscnnf_p.c
-*
-* Modification History:
-*
-* Date Name Description
-* 12/02/98 stephen Creation.
-* 03/13/99 stephen Modified for new C API.
-*******************************************************************************
-*/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION
-
-#include "unicode/uchar.h"
-#include "unicode/ustring.h"
-#include "unicode/unum.h"
-#include "unicode/udat.h"
-#include "unicode/uset.h"
-#include "uscanf.h"
-#include "ufmt_cmn.h"
-#include "ufile.h"
-#include "locbund.h"
-
-#include "cmemory.h"
-#include "ustr_cnv.h"
-
-/* flag characters for u_scanf */
-#define FLAG_ASTERISK 0x002A
-#define FLAG_PAREN 0x0028
-
-#define ISFLAG(s) (s) == FLAG_ASTERISK || \
- (s) == FLAG_PAREN
-
-/* special characters for u_scanf */
-#define SPEC_DOLLARSIGN 0x0024
-
-/* unicode digits */
-#define DIGIT_ZERO 0x0030
-#define DIGIT_ONE 0x0031
-#define DIGIT_TWO 0x0032
-#define DIGIT_THREE 0x0033
-#define DIGIT_FOUR 0x0034
-#define DIGIT_FIVE 0x0035
-#define DIGIT_SIX 0x0036
-#define DIGIT_SEVEN 0x0037
-#define DIGIT_EIGHT 0x0038
-#define DIGIT_NINE 0x0039
-
-#define ISDIGIT(s) (s) == DIGIT_ZERO || \
- (s) == DIGIT_ONE || \
- (s) == DIGIT_TWO || \
- (s) == DIGIT_THREE || \
- (s) == DIGIT_FOUR || \
- (s) == DIGIT_FIVE || \
- (s) == DIGIT_SIX || \
- (s) == DIGIT_SEVEN || \
- (s) == DIGIT_EIGHT || \
- (s) == DIGIT_NINE
-
-/* u_scanf modifiers */
-#define MOD_H 0x0068
-#define MOD_LOWERL 0x006C
-#define MOD_L 0x004C
-
-#define ISMOD(s) (s) == MOD_H || \
- (s) == MOD_LOWERL || \
- (s) == MOD_L
-
-/**
- * Struct encapsulating a single uscanf format specification.
- */
-typedef struct u_scanf_spec_info {
- int32_t fWidth; /* Width */
-
- UChar fSpec; /* Format specification */
-
- UChar fPadChar; /* Padding character */
-
- UBool fSkipArg; /* TRUE if arg should be skipped */
- UBool fIsLongDouble; /* L flag */
- UBool fIsShort; /* h flag */
- UBool fIsLong; /* l flag */
- UBool fIsLongLong; /* ll flag */
- UBool fIsString; /* TRUE if this is a NULL-terminated string. */
-} u_scanf_spec_info;
-
-
-/**
- * Struct encapsulating a single u_scanf format specification.
- */
-typedef struct u_scanf_spec {
- u_scanf_spec_info fInfo; /* Information on this spec */
- int32_t fArgPos; /* Position of data in arg list */
-} u_scanf_spec;
-
-/**
- * Parse a single u_scanf format specifier in Unicode.
- * @param fmt A pointer to a '%' character in a u_scanf format specification.
- * @param spec A pointer to a <TT>u_scanf_spec</TT> to receive the parsed
- * format specifier.
- * @return The number of characters contained in this specifier.
- */
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+* Copyright (C) 1998-2016, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+*
+* File uscnnf_p.c
+*
+* Modification History:
+*
+* Date Name Description
+* 12/02/98 stephen Creation.
+* 03/13/99 stephen Modified for new C API.
+*******************************************************************************
+*/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION
+
+#include "unicode/uchar.h"
+#include "unicode/ustring.h"
+#include "unicode/unum.h"
+#include "unicode/udat.h"
+#include "unicode/uset.h"
+#include "uscanf.h"
+#include "ufmt_cmn.h"
+#include "ufile.h"
+#include "locbund.h"
+
+#include "cmemory.h"
+#include "ustr_cnv.h"
+
+/* flag characters for u_scanf */
+#define FLAG_ASTERISK 0x002A
+#define FLAG_PAREN 0x0028
+
+#define ISFLAG(s) (s) == FLAG_ASTERISK || \
+ (s) == FLAG_PAREN
+
+/* special characters for u_scanf */
+#define SPEC_DOLLARSIGN 0x0024
+
+/* unicode digits */
+#define DIGIT_ZERO 0x0030
+#define DIGIT_ONE 0x0031
+#define DIGIT_TWO 0x0032
+#define DIGIT_THREE 0x0033
+#define DIGIT_FOUR 0x0034
+#define DIGIT_FIVE 0x0035
+#define DIGIT_SIX 0x0036
+#define DIGIT_SEVEN 0x0037
+#define DIGIT_EIGHT 0x0038
+#define DIGIT_NINE 0x0039
+
+#define ISDIGIT(s) (s) == DIGIT_ZERO || \
+ (s) == DIGIT_ONE || \
+ (s) == DIGIT_TWO || \
+ (s) == DIGIT_THREE || \
+ (s) == DIGIT_FOUR || \
+ (s) == DIGIT_FIVE || \
+ (s) == DIGIT_SIX || \
+ (s) == DIGIT_SEVEN || \
+ (s) == DIGIT_EIGHT || \
+ (s) == DIGIT_NINE
+
+/* u_scanf modifiers */
+#define MOD_H 0x0068
+#define MOD_LOWERL 0x006C
+#define MOD_L 0x004C
+
+#define ISMOD(s) (s) == MOD_H || \
+ (s) == MOD_LOWERL || \
+ (s) == MOD_L
+
+/**
+ * Struct encapsulating a single uscanf format specification.
+ */
+typedef struct u_scanf_spec_info {
+ int32_t fWidth; /* Width */
+
+ UChar fSpec; /* Format specification */
+
+ UChar fPadChar; /* Padding character */
+
+ UBool fSkipArg; /* TRUE if arg should be skipped */
+ UBool fIsLongDouble; /* L flag */
+ UBool fIsShort; /* h flag */
+ UBool fIsLong; /* l flag */
+ UBool fIsLongLong; /* ll flag */
+ UBool fIsString; /* TRUE if this is a NULL-terminated string. */
+} u_scanf_spec_info;
+
+
+/**
+ * Struct encapsulating a single u_scanf format specification.
+ */
+typedef struct u_scanf_spec {
+ u_scanf_spec_info fInfo; /* Information on this spec */
+ int32_t fArgPos; /* Position of data in arg list */
+} u_scanf_spec;
+
+/**
+ * Parse a single u_scanf format specifier in Unicode.
+ * @param fmt A pointer to a '%' character in a u_scanf format specification.
+ * @param spec A pointer to a <TT>u_scanf_spec</TT> to receive the parsed
+ * format specifier.
+ * @return The number of characters contained in this specifier.
+ */
+static int32_t
+u_scanf_parse_spec (const UChar *fmt,
+ u_scanf_spec *spec)
+{
+ const UChar *s = fmt;
+ const UChar *backup;
+ u_scanf_spec_info *info = &(spec->fInfo);
+
+ /* initialize spec to default values */
+ spec->fArgPos = -1;
+
+ info->fWidth = -1;
+ info->fSpec = 0x0000;
+ info->fPadChar = 0x0020;
+ info->fSkipArg = FALSE;
+ info->fIsLongDouble = FALSE;
+ info->fIsShort = FALSE;
+ info->fIsLong = FALSE;
+ info->fIsLongLong = FALSE;
+ info->fIsString = TRUE;
+
+
+ /* skip over the initial '%' */
+ s++;
+
+ /* Check for positional argument */
+ if(ISDIGIT(*s)) {
+
+ /* Save the current position */
+ backup = s;
+
+ /* handle positional parameters */
+ if(ISDIGIT(*s)) {
+ spec->fArgPos = (int) (*s++ - DIGIT_ZERO);
+
+ while(ISDIGIT(*s)) {
+ spec->fArgPos *= 10;
+ spec->fArgPos += (int) (*s++ - DIGIT_ZERO);
+ }
+ }
+
+ /* if there is no '$', don't read anything */
+ if(*s != SPEC_DOLLARSIGN) {
+ spec->fArgPos = -1;
+ s = backup;
+ }
+ /* munge the '$' */
+ else
+ s++;
+ }
+
+ /* Get any format flags */
+ while(ISFLAG(*s)) {
+ switch(*s++) {
+
+ /* skip argument */
+ case FLAG_ASTERISK:
+ info->fSkipArg = TRUE;
+ break;
+
+ /* pad character specified */
+ case FLAG_PAREN:
+
+ /* first four characters are hex values for pad char */
+ info->fPadChar = (UChar)ufmt_digitvalue(*s++);
+ info->fPadChar = (UChar)((info->fPadChar * 16) + ufmt_digitvalue(*s++));
+ info->fPadChar = (UChar)((info->fPadChar * 16) + ufmt_digitvalue(*s++));
+ info->fPadChar = (UChar)((info->fPadChar * 16) + ufmt_digitvalue(*s++));
+
+ /* final character is ignored */
+ s++;
+
+ break;
+ }
+ }
+
+ /* Get the width */
+ if(ISDIGIT(*s)){
+ info->fWidth = (int) (*s++ - DIGIT_ZERO);
+
+ while(ISDIGIT(*s)) {
+ info->fWidth *= 10;
+ info->fWidth += (int) (*s++ - DIGIT_ZERO);
+ }
+ }
+
+ /* Get any modifiers */
+ if(ISMOD(*s)) {
+ switch(*s++) {
+
+ /* short */
+ case MOD_H:
+ info->fIsShort = TRUE;
+ break;
+
+ /* long or long long */
+ case MOD_LOWERL:
+ if(*s == MOD_LOWERL) {
+ info->fIsLongLong = TRUE;
+ /* skip over the next 'l' */
+ s++;
+ }
+ else
+ info->fIsLong = TRUE;
+ break;
+
+ /* long double */
+ case MOD_L:
+ info->fIsLongDouble = TRUE;
+ break;
+ }
+ }
+
+ /* finally, get the specifier letter */
+ info->fSpec = *s++;
+
+ /* return # of characters in this specifier */
+ return (int32_t)(s - fmt);
+}
+
+#define UP_PERCENT 0x0025
+
+
+/* ANSI style formatting */
+/* Use US-ASCII characters only for formatting */
+
+/* % */
+#define UFMT_SIMPLE_PERCENT {ufmt_simple_percent, u_scanf_simple_percent_handler}
+/* s */
+#define UFMT_STRING {ufmt_string, u_scanf_string_handler}
+/* c */
+#define UFMT_CHAR {ufmt_string, u_scanf_char_handler}
+/* d, i */
+#define UFMT_INT {ufmt_int, u_scanf_integer_handler}
+/* u */
+#define UFMT_UINT {ufmt_int, u_scanf_uinteger_handler}
+/* o */
+#define UFMT_OCTAL {ufmt_int, u_scanf_octal_handler}
+/* x, X */
+#define UFMT_HEX {ufmt_int, u_scanf_hex_handler}
+/* f */
+#define UFMT_DOUBLE {ufmt_double, u_scanf_double_handler}
+/* e, E */
+#define UFMT_SCIENTIFIC {ufmt_double, u_scanf_scientific_handler}
+/* g, G */
+#define UFMT_SCIDBL {ufmt_double, u_scanf_scidbl_handler}
+/* n */
+#define UFMT_COUNT {ufmt_count, u_scanf_count_handler}
+/* [ */
+#define UFMT_SCANSET {ufmt_string, u_scanf_scanset_handler}
+
+/* non-ANSI extensions */
+/* Use US-ASCII characters only for formatting */
+
+/* p */
+#define UFMT_POINTER {ufmt_pointer, u_scanf_pointer_handler}
+/* V */
+#define UFMT_SPELLOUT {ufmt_double, u_scanf_spellout_handler}
+/* P */
+#define UFMT_PERCENT {ufmt_double, u_scanf_percent_handler}
+/* C K is old format */
+#define UFMT_UCHAR {ufmt_uchar, u_scanf_uchar_handler}
+/* S U is old format */
+#define UFMT_USTRING {ufmt_ustring, u_scanf_ustring_handler}
+
+
+#define UFMT_EMPTY {ufmt_empty, NULL}
+
+/**
+ * A u_scanf handler function.
+ * A u_scanf handler is responsible for handling a single u_scanf
+ * format specification, for example 'd' or 's'.
+ * @param stream The UFILE to which to write output.
+ * @param info A pointer to a <TT>u_scanf_spec_info</TT> struct containing
+ * information on the format specification.
+ * @param args A pointer to the argument data
+ * @param fmt A pointer to the first character in the format string
+ * following the spec.
+ * @param fmtConsumed On output, set to the number of characters consumed
+ * in <TT>fmt</TT>. Do nothing, if the argument isn't variable width.
+ * @param argConverted The number of arguments converted and assigned, or -1 if an
+ * error occurred.
+ * @return The number of code points consumed during reading.
+ */
+typedef int32_t (*u_scanf_handler) (UFILE *stream,
+ u_scanf_spec_info *info,
+ ufmt_args *args,
+ const UChar *fmt,
+ int32_t *fmtConsumed,
+ int32_t *argConverted);
+
+typedef struct u_scanf_info {
+ ufmt_type_info info;
+ u_scanf_handler handler;
+} u_scanf_info;
+
+#define USCANF_NUM_FMT_HANDLERS 108
+#define USCANF_SYMBOL_BUFFER_SIZE 8
+
+/* We do not use handlers for 0-0x1f */
+#define USCANF_BASE_FMT_HANDLERS 0x20
+
+
+static int32_t
+u_scanf_skip_leading_ws(UFILE *input,
+ UChar pad)
+{
+ UChar c;
+ int32_t count = 0;
+ UBool isNotEOF;
+
+ /* skip all leading ws in the input */
+ while( ((isNotEOF = ufile_getch(input, &c)) == TRUE) && (c == pad || u_isWhitespace(c)) )
+ {
+ count++;
+ }
+
+ /* put the final character back on the input */
+ if(isNotEOF)
+ u_fungetc(c, input);
+
+ return count;
+}
+
+/* TODO: Is always skipping the prefix symbol as a positive sign a good idea in all locales? */
+static int32_t
+u_scanf_skip_leading_positive_sign(UFILE *input,
+ UNumberFormat *format,
+ UErrorCode *status)
+{
+ UChar c;
+ int32_t count = 0;
+ UBool isNotEOF;
+ UChar plusSymbol[USCANF_SYMBOL_BUFFER_SIZE];
+ int32_t symbolLen;
+ UErrorCode localStatus = U_ZERO_ERROR;
+
+ if (U_SUCCESS(*status)) {
+ symbolLen = unum_getSymbol(format,
+ UNUM_PLUS_SIGN_SYMBOL,
+ plusSymbol,
+ UPRV_LENGTHOF(plusSymbol),
+ &localStatus);
+
+ if (U_SUCCESS(localStatus)) {
+ /* skip all leading ws in the input */
+ while( ((isNotEOF = ufile_getch(input, &c)) == TRUE) && (count < symbolLen && c == plusSymbol[count]) )
+ {
+ count++;
+ }
+
+ /* put the final character back on the input */
+ if(isNotEOF) {
+ u_fungetc(c, input);
+ }
+ }
+ }
+
+ return count;
+}
+
static int32_t
-u_scanf_parse_spec (const UChar *fmt,
- u_scanf_spec *spec)
-{
- const UChar *s = fmt;
- const UChar *backup;
- u_scanf_spec_info *info = &(spec->fInfo);
-
- /* initialize spec to default values */
- spec->fArgPos = -1;
-
- info->fWidth = -1;
- info->fSpec = 0x0000;
- info->fPadChar = 0x0020;
- info->fSkipArg = FALSE;
- info->fIsLongDouble = FALSE;
- info->fIsShort = FALSE;
- info->fIsLong = FALSE;
- info->fIsLongLong = FALSE;
- info->fIsString = TRUE;
-
-
- /* skip over the initial '%' */
- s++;
-
- /* Check for positional argument */
- if(ISDIGIT(*s)) {
-
- /* Save the current position */
- backup = s;
-
- /* handle positional parameters */
- if(ISDIGIT(*s)) {
- spec->fArgPos = (int) (*s++ - DIGIT_ZERO);
-
- while(ISDIGIT(*s)) {
- spec->fArgPos *= 10;
- spec->fArgPos += (int) (*s++ - DIGIT_ZERO);
- }
- }
-
- /* if there is no '$', don't read anything */
- if(*s != SPEC_DOLLARSIGN) {
- spec->fArgPos = -1;
- s = backup;
- }
- /* munge the '$' */
- else
- s++;
- }
-
- /* Get any format flags */
- while(ISFLAG(*s)) {
- switch(*s++) {
-
- /* skip argument */
- case FLAG_ASTERISK:
- info->fSkipArg = TRUE;
- break;
-
- /* pad character specified */
- case FLAG_PAREN:
-
- /* first four characters are hex values for pad char */
- info->fPadChar = (UChar)ufmt_digitvalue(*s++);
- info->fPadChar = (UChar)((info->fPadChar * 16) + ufmt_digitvalue(*s++));
- info->fPadChar = (UChar)((info->fPadChar * 16) + ufmt_digitvalue(*s++));
- info->fPadChar = (UChar)((info->fPadChar * 16) + ufmt_digitvalue(*s++));
-
- /* final character is ignored */
- s++;
-
- break;
- }
- }
-
- /* Get the width */
- if(ISDIGIT(*s)){
- info->fWidth = (int) (*s++ - DIGIT_ZERO);
-
- while(ISDIGIT(*s)) {
- info->fWidth *= 10;
- info->fWidth += (int) (*s++ - DIGIT_ZERO);
- }
- }
-
- /* Get any modifiers */
- if(ISMOD(*s)) {
- switch(*s++) {
-
- /* short */
- case MOD_H:
- info->fIsShort = TRUE;
- break;
-
- /* long or long long */
- case MOD_LOWERL:
- if(*s == MOD_LOWERL) {
- info->fIsLongLong = TRUE;
- /* skip over the next 'l' */
- s++;
- }
- else
- info->fIsLong = TRUE;
- break;
-
- /* long double */
- case MOD_L:
- info->fIsLongDouble = TRUE;
- break;
- }
- }
-
- /* finally, get the specifier letter */
- info->fSpec = *s++;
-
- /* return # of characters in this specifier */
- return (int32_t)(s - fmt);
-}
-
-#define UP_PERCENT 0x0025
-
-
-/* ANSI style formatting */
-/* Use US-ASCII characters only for formatting */
-
-/* % */
-#define UFMT_SIMPLE_PERCENT {ufmt_simple_percent, u_scanf_simple_percent_handler}
-/* s */
-#define UFMT_STRING {ufmt_string, u_scanf_string_handler}
-/* c */
-#define UFMT_CHAR {ufmt_string, u_scanf_char_handler}
-/* d, i */
-#define UFMT_INT {ufmt_int, u_scanf_integer_handler}
-/* u */
-#define UFMT_UINT {ufmt_int, u_scanf_uinteger_handler}
-/* o */
-#define UFMT_OCTAL {ufmt_int, u_scanf_octal_handler}
-/* x, X */
-#define UFMT_HEX {ufmt_int, u_scanf_hex_handler}
-/* f */
-#define UFMT_DOUBLE {ufmt_double, u_scanf_double_handler}
-/* e, E */
-#define UFMT_SCIENTIFIC {ufmt_double, u_scanf_scientific_handler}
-/* g, G */
-#define UFMT_SCIDBL {ufmt_double, u_scanf_scidbl_handler}
-/* n */
-#define UFMT_COUNT {ufmt_count, u_scanf_count_handler}
-/* [ */
-#define UFMT_SCANSET {ufmt_string, u_scanf_scanset_handler}
-
-/* non-ANSI extensions */
-/* Use US-ASCII characters only for formatting */
-
-/* p */
-#define UFMT_POINTER {ufmt_pointer, u_scanf_pointer_handler}
-/* V */
-#define UFMT_SPELLOUT {ufmt_double, u_scanf_spellout_handler}
-/* P */
-#define UFMT_PERCENT {ufmt_double, u_scanf_percent_handler}
-/* C K is old format */
-#define UFMT_UCHAR {ufmt_uchar, u_scanf_uchar_handler}
-/* S U is old format */
-#define UFMT_USTRING {ufmt_ustring, u_scanf_ustring_handler}
-
-
-#define UFMT_EMPTY {ufmt_empty, NULL}
-
-/**
- * A u_scanf handler function.
- * A u_scanf handler is responsible for handling a single u_scanf
- * format specification, for example 'd' or 's'.
- * @param stream The UFILE to which to write output.
- * @param info A pointer to a <TT>u_scanf_spec_info</TT> struct containing
- * information on the format specification.
- * @param args A pointer to the argument data
- * @param fmt A pointer to the first character in the format string
- * following the spec.
- * @param fmtConsumed On output, set to the number of characters consumed
- * in <TT>fmt</TT>. Do nothing, if the argument isn't variable width.
- * @param argConverted The number of arguments converted and assigned, or -1 if an
- * error occurred.
- * @return The number of code points consumed during reading.
- */
-typedef int32_t (*u_scanf_handler) (UFILE *stream,
- u_scanf_spec_info *info,
- ufmt_args *args,
- const UChar *fmt,
- int32_t *fmtConsumed,
- int32_t *argConverted);
-
-typedef struct u_scanf_info {
- ufmt_type_info info;
- u_scanf_handler handler;
-} u_scanf_info;
-
-#define USCANF_NUM_FMT_HANDLERS 108
-#define USCANF_SYMBOL_BUFFER_SIZE 8
-
-/* We do not use handlers for 0-0x1f */
-#define USCANF_BASE_FMT_HANDLERS 0x20
-
-
-static int32_t
-u_scanf_skip_leading_ws(UFILE *input,
- UChar pad)
-{
- UChar c;
- int32_t count = 0;
- UBool isNotEOF;
-
- /* skip all leading ws in the input */
- while( ((isNotEOF = ufile_getch(input, &c)) == TRUE) && (c == pad || u_isWhitespace(c)) )
- {
- count++;
- }
-
- /* put the final character back on the input */
- if(isNotEOF)
- u_fungetc(c, input);
-
- return count;
-}
-
-/* TODO: Is always skipping the prefix symbol as a positive sign a good idea in all locales? */
-static int32_t
-u_scanf_skip_leading_positive_sign(UFILE *input,
- UNumberFormat *format,
- UErrorCode *status)
-{
- UChar c;
- int32_t count = 0;
- UBool isNotEOF;
- UChar plusSymbol[USCANF_SYMBOL_BUFFER_SIZE];
- int32_t symbolLen;
- UErrorCode localStatus = U_ZERO_ERROR;
-
- if (U_SUCCESS(*status)) {
- symbolLen = unum_getSymbol(format,
- UNUM_PLUS_SIGN_SYMBOL,
- plusSymbol,
- UPRV_LENGTHOF(plusSymbol),
- &localStatus);
-
- if (U_SUCCESS(localStatus)) {
- /* skip all leading ws in the input */
- while( ((isNotEOF = ufile_getch(input, &c)) == TRUE) && (count < symbolLen && c == plusSymbol[count]) )
- {
- count++;
- }
-
- /* put the final character back on the input */
- if(isNotEOF) {
- u_fungetc(c, input);
- }
- }
- }
-
- return count;
-}
-
-static int32_t
-u_scanf_simple_percent_handler(UFILE *input,
- u_scanf_spec_info *info,
- ufmt_args *args,
- const UChar *fmt,
- int32_t *fmtConsumed,
- int32_t *argConverted)
-{
- (void)info;
- (void)args;
- (void)fmt;
- (void)fmtConsumed;
-
- /* make sure the next character in the input is a percent */
- *argConverted = 0;
- if(u_fgetc(input) != 0x0025) {
- *argConverted = -1;
- }
- return 1;
-}
-
-static int32_t
-u_scanf_count_handler(UFILE *input,
- u_scanf_spec_info *info,
- ufmt_args *args,
- const UChar *fmt,
- int32_t *fmtConsumed,
- int32_t *argConverted)
-{
- (void)input;
- (void)fmt;
- (void)fmtConsumed;
-
- /* in the special case of count, the u_scanf_spec_info's width */
- /* will contain the # of items converted thus far */
- if (!info->fSkipArg) {
- if (info->fIsShort)
- *(int16_t*)(args[0].ptrValue) = (int16_t)(UINT16_MAX & info->fWidth);
- else if (info->fIsLongLong)
- *(int64_t*)(args[0].ptrValue) = info->fWidth;
- else
- *(int32_t*)(args[0].ptrValue) = (int32_t)(UINT32_MAX & info->fWidth);
- }
- *argConverted = 0;
-
- /* we converted 0 args */
- return 0;
-}
-
-static int32_t
-u_scanf_double_handler(UFILE *input,
- u_scanf_spec_info *info,
- ufmt_args *args,
- const UChar *fmt,
- int32_t *fmtConsumed,
- int32_t *argConverted)
-{
- (void)fmt;
- (void)fmtConsumed;
-
- int32_t len;
- double num;
- UNumberFormat *format;
- int32_t parsePos = 0;
- int32_t skipped;
- UErrorCode status = U_ZERO_ERROR;
-
-
- /* skip all ws in the input */
- skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
-
- /* fill the input's internal buffer */
- ufile_fill_uchar_buffer(input);
-
- /* determine the size of the input's buffer */
- len = (int32_t)(input->str.fLimit - input->str.fPos);
-
- /* truncate to the width, if specified */
- if(info->fWidth != -1)
- len = ufmt_min(len, info->fWidth);
-
- /* get the formatter */
- format = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_DECIMAL);
-
- /* handle error */
- if(format == 0)
- return 0;
-
- /* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */
- skipped += u_scanf_skip_leading_positive_sign(input, format, &status);
-
- /* parse the number */
- num = unum_parseDouble(format, input->str.fPos, len, &parsePos, &status);
-
- if (!info->fSkipArg) {
- if (info->fIsLong)
- *(double*)(args[0].ptrValue) = num;
- else if (info->fIsLongDouble)
- *(long double*)(args[0].ptrValue) = num;
- else
- *(float*)(args[0].ptrValue) = (float)num;
- }
-
- /* mask off any necessary bits */
- /* if(! info->fIsLong_double)
- num &= DBL_MAX;*/
-
- /* update the input's position to reflect consumed data */
- input->str.fPos += parsePos;
-
- /* we converted 1 arg */
- *argConverted = !info->fSkipArg;
- return parsePos + skipped;
-}
-
-#define UPRINTF_SYMBOL_BUFFER_SIZE 8
-
-static int32_t
-u_scanf_scientific_handler(UFILE *input,
- u_scanf_spec_info *info,
- ufmt_args *args,
- const UChar *fmt,
- int32_t *fmtConsumed,
- int32_t *argConverted)
-{
- (void)fmt;
- (void)fmtConsumed;
-
- int32_t len;
- double num;
- UNumberFormat *format;
- int32_t parsePos = 0;
- int32_t skipped;
- UErrorCode status = U_ZERO_ERROR;
- UChar srcExpBuf[UPRINTF_SYMBOL_BUFFER_SIZE];
- int32_t srcLen, expLen;
- UChar expBuf[UPRINTF_SYMBOL_BUFFER_SIZE];
-
-
- /* skip all ws in the input */
- skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
-
- /* fill the input's internal buffer */
- ufile_fill_uchar_buffer(input);
-
- /* determine the size of the input's buffer */
- len = (int32_t)(input->str.fLimit - input->str.fPos);
-
- /* truncate to the width, if specified */
- if(info->fWidth != -1)
- len = ufmt_min(len, info->fWidth);
-
- /* get the formatter */
- format = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_SCIENTIFIC);
-
- /* handle error */
- if(format == 0)
- return 0;
-
- /* set the appropriate flags on the formatter */
-
- srcLen = unum_getSymbol(format,
- UNUM_EXPONENTIAL_SYMBOL,
- srcExpBuf,
- sizeof(srcExpBuf),
- &status);
-
- /* Upper/lower case the e */
- if (info->fSpec == (UChar)0x65 /* e */) {
- expLen = u_strToLower(expBuf, (int32_t)sizeof(expBuf),
- srcExpBuf, srcLen,
- input->str.fBundle.fLocale,
- &status);
- }
- else {
- expLen = u_strToUpper(expBuf, (int32_t)sizeof(expBuf),
- srcExpBuf, srcLen,
- input->str.fBundle.fLocale,
- &status);
- }
-
- unum_setSymbol(format,
- UNUM_EXPONENTIAL_SYMBOL,
- expBuf,
- expLen,
- &status);
-
-
-
-
- /* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */
- skipped += u_scanf_skip_leading_positive_sign(input, format, &status);
-
- /* parse the number */
- num = unum_parseDouble(format, input->str.fPos, len, &parsePos, &status);
-
- if (!info->fSkipArg) {
- if (info->fIsLong)
- *(double*)(args[0].ptrValue) = num;
- else if (info->fIsLongDouble)
- *(long double*)(args[0].ptrValue) = num;
- else
- *(float*)(args[0].ptrValue) = (float)num;
- }
-
- /* mask off any necessary bits */
- /* if(! info->fIsLong_double)
- num &= DBL_MAX;*/
-
- /* update the input's position to reflect consumed data */
- input->str.fPos += parsePos;
-
- /* we converted 1 arg */
- *argConverted = !info->fSkipArg;
- return parsePos + skipped;
-}
-
-static int32_t
-u_scanf_scidbl_handler(UFILE *input,
- u_scanf_spec_info *info,
- ufmt_args *args,
- const UChar *fmt,
- int32_t *fmtConsumed,
- int32_t *argConverted)
-{
- (void)fmt;
- (void)fmtConsumed;
-
- int32_t len;
- double num;
- UNumberFormat *scientificFormat, *genericFormat;
- /*int32_t scientificResult, genericResult;*/
- double scientificResult, genericResult;
- int32_t scientificParsePos = 0, genericParsePos = 0, parsePos = 0;
- int32_t skipped;
- UErrorCode scientificStatus = U_ZERO_ERROR;
- UErrorCode genericStatus = U_ZERO_ERROR;
-
-
- /* since we can't determine by scanning the characters whether */
- /* a number was formatted in the 'f' or 'g' styles, parse the */
- /* string with both formatters, and assume whichever one */
- /* parsed the most is the correct formatter to use */
-
-
- /* skip all ws in the input */
- skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
-
- /* fill the input's internal buffer */
- ufile_fill_uchar_buffer(input);
-
- /* determine the size of the input's buffer */
- len = (int32_t)(input->str.fLimit - input->str.fPos);
-
- /* truncate to the width, if specified */
- if(info->fWidth != -1)
- len = ufmt_min(len, info->fWidth);
-
- /* get the formatters */
- scientificFormat = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_SCIENTIFIC);
- genericFormat = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_DECIMAL);
-
- /* handle error */
- if(scientificFormat == 0 || genericFormat == 0)
- return 0;
-
- /* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */
- skipped += u_scanf_skip_leading_positive_sign(input, genericFormat, &genericStatus);
-
- /* parse the number using each format*/
-
- scientificResult = unum_parseDouble(scientificFormat, input->str.fPos, len,
- &scientificParsePos, &scientificStatus);
-
- genericResult = unum_parseDouble(genericFormat, input->str.fPos, len,
- &genericParsePos, &genericStatus);
-
- /* determine which parse made it farther */
- if(scientificParsePos > genericParsePos) {
- /* stash the result in num */
- num = scientificResult;
- /* update the input's position to reflect consumed data */
- parsePos += scientificParsePos;
- }
- else {
- /* stash the result in num */
- num = genericResult;
- /* update the input's position to reflect consumed data */
- parsePos += genericParsePos;
- }
- input->str.fPos += parsePos;
-
- if (!info->fSkipArg) {
- if (info->fIsLong)
- *(double*)(args[0].ptrValue) = num;
- else if (info->fIsLongDouble)
- *(long double*)(args[0].ptrValue) = num;
- else
- *(float*)(args[0].ptrValue) = (float)num;
- }
-
- /* mask off any necessary bits */
- /* if(! info->fIsLong_double)
- num &= DBL_MAX;*/
-
- /* we converted 1 arg */
- *argConverted = !info->fSkipArg;
- return parsePos + skipped;
-}
-
-static int32_t
-u_scanf_integer_handler(UFILE *input,
- u_scanf_spec_info *info,
- ufmt_args *args,
- const UChar *fmt,
- int32_t *fmtConsumed,
- int32_t *argConverted)
-{
- (void)fmt;
- (void)fmtConsumed;
-
- int32_t len;
- void *num = (void*) (args[0].ptrValue);
- UNumberFormat *format;
- int32_t parsePos = 0;
- int32_t skipped;
- UErrorCode status = U_ZERO_ERROR;
- int64_t result;
-
-
- /* skip all ws in the input */
- skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
-
- /* fill the input's internal buffer */
- ufile_fill_uchar_buffer(input);
-
- /* determine the size of the input's buffer */
- len = (int32_t)(input->str.fLimit - input->str.fPos);
-
- /* truncate to the width, if specified */
- if(info->fWidth != -1)
- len = ufmt_min(len, info->fWidth);
-
- /* get the formatter */
- format = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_DECIMAL);
-
- /* handle error */
- if(format == 0)
- return 0;
-
- /* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */
- skipped += u_scanf_skip_leading_positive_sign(input, format, &status);
-
- /* parse the number */
- result = unum_parseInt64(format, input->str.fPos, len, &parsePos, &status);
-
- /* mask off any necessary bits */
- if (!info->fSkipArg) {
- if (info->fIsShort)
- *(int16_t*)num = (int16_t)(UINT16_MAX & result);
- else if (info->fIsLongLong)
- *(int64_t*)num = result;
- else
- *(int32_t*)num = (int32_t)(UINT32_MAX & result);
- }
-
- /* update the input's position to reflect consumed data */
- input->str.fPos += parsePos;
-
- /* we converted 1 arg */
- *argConverted = !info->fSkipArg;
- return parsePos + skipped;
-}
-
-static int32_t
-u_scanf_uinteger_handler(UFILE *input,
- u_scanf_spec_info *info,
- ufmt_args *args,
- const UChar *fmt,
- int32_t *fmtConsumed,
- int32_t *argConverted)
-{
- /* TODO Fix this when Numberformat handles uint64_t */
- return u_scanf_integer_handler(input, info, args, fmt, fmtConsumed, argConverted);
-}
-
-static int32_t
-u_scanf_percent_handler(UFILE *input,
- u_scanf_spec_info *info,
- ufmt_args *args,
- const UChar *fmt,
- int32_t *fmtConsumed,
- int32_t *argConverted)
-{
- (void)fmt;
- (void)fmtConsumed;
-
- int32_t len;
- double num;
- UNumberFormat *format;
- int32_t parsePos = 0;
- UErrorCode status = U_ZERO_ERROR;
-
-
- /* skip all ws in the input */
- u_scanf_skip_leading_ws(input, info->fPadChar);
-
- /* fill the input's internal buffer */
- ufile_fill_uchar_buffer(input);
-
- /* determine the size of the input's buffer */
- len = (int32_t)(input->str.fLimit - input->str.fPos);
-
- /* truncate to the width, if specified */
- if(info->fWidth != -1)
- len = ufmt_min(len, info->fWidth);
-
- /* get the formatter */
- format = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_PERCENT);
-
- /* handle error */
- if(format == 0)
- return 0;
-
- /* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */
- u_scanf_skip_leading_positive_sign(input, format, &status);
-
- /* parse the number */
- num = unum_parseDouble(format, input->str.fPos, len, &parsePos, &status);
-
- if (!info->fSkipArg) {
- *(double*)(args[0].ptrValue) = num;
- }
-
- /* mask off any necessary bits */
- /* if(! info->fIsLong_double)
- num &= DBL_MAX;*/
-
- /* update the input's position to reflect consumed data */
- input->str.fPos += parsePos;
-
- /* we converted 1 arg */
- *argConverted = !info->fSkipArg;
- return parsePos;
-}
-
-static int32_t
-u_scanf_string_handler(UFILE *input,
- u_scanf_spec_info *info,
- ufmt_args *args,
- const UChar *fmt,
- int32_t *fmtConsumed,
- int32_t *argConverted)
-{
- (void)fmt;
- (void)fmtConsumed;
-
- const UChar *source;
- UConverter *conv;
- char *arg = (char*)(args[0].ptrValue);
- char *alias = arg;
- char *limit;
- UErrorCode status = U_ZERO_ERROR;
- int32_t count;
- int32_t skipped = 0;
- UChar c;
- UBool isNotEOF = FALSE;
-
- /* skip all ws in the input */
- if (info->fIsString) {
- skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
- }
-
- /* get the string one character at a time, truncating to the width */
- count = 0;
-
- /* open the default converter */
- conv = u_getDefaultConverter(&status);
-
- if(U_FAILURE(status))
- return -1;
-
- while( (info->fWidth == -1 || count < info->fWidth)
- && ((isNotEOF = ufile_getch(input, &c)) == TRUE)
- && (!info->fIsString || (c != info->fPadChar && !u_isWhitespace(c))))
- {
-
- if (!info->fSkipArg) {
- /* put the character from the input onto the target */
- source = &c;
- /* Since we do this one character at a time, do it this way. */
- if (info->fWidth > 0) {
- limit = alias + info->fWidth - count;
- }
- else {
- limit = alias + ucnv_getMaxCharSize(conv);
- }
-
- /* convert the character to the default codepage */
- ucnv_fromUnicode(conv, &alias, limit, &source, source + 1,
- NULL, TRUE, &status);
-
- if(U_FAILURE(status)) {
- /* clean up */
- u_releaseDefaultConverter(conv);
- return -1;
- }
- }
-
- /* increment the count */
- ++count;
- }
-
- /* put the final character we read back on the input */
- if (!info->fSkipArg) {
- if ((info->fWidth == -1 || count < info->fWidth) && isNotEOF)
- u_fungetc(c, input);
-
- /* add the terminator */
- if (info->fIsString) {
- *alias = 0x00;
- }
- }
-
- /* clean up */
- u_releaseDefaultConverter(conv);
-
- /* we converted 1 arg */
- *argConverted = !info->fSkipArg;
- return count + skipped;
-}
-
-static int32_t
-u_scanf_char_handler(UFILE *input,
- u_scanf_spec_info *info,
- ufmt_args *args,
- const UChar *fmt,
- int32_t *fmtConsumed,
- int32_t *argConverted)
-{
- if (info->fWidth < 0) {
- info->fWidth = 1;
- }
- info->fIsString = FALSE;
- return u_scanf_string_handler(input, info, args, fmt, fmtConsumed, argConverted);
-}
-
-static int32_t
-u_scanf_ustring_handler(UFILE *input,
- u_scanf_spec_info *info,
- ufmt_args *args,
- const UChar *fmt,
- int32_t *fmtConsumed,
- int32_t *argConverted)
-{
- (void)fmt;
- (void)fmtConsumed;
-
- UChar *arg = (UChar*)(args[0].ptrValue);
- UChar *alias = arg;
- int32_t count;
- int32_t skipped = 0;
- UChar c;
- UBool isNotEOF = FALSE;
-
- /* skip all ws in the input */
- if (info->fIsString) {
- skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
- }
-
- /* get the string one character at a time, truncating to the width */
- count = 0;
-
+u_scanf_simple_percent_handler(UFILE *input,
+ u_scanf_spec_info *info,
+ ufmt_args *args,
+ const UChar *fmt,
+ int32_t *fmtConsumed,
+ int32_t *argConverted)
+{
+ (void)info;
+ (void)args;
+ (void)fmt;
+ (void)fmtConsumed;
+
+ /* make sure the next character in the input is a percent */
+ *argConverted = 0;
+ if(u_fgetc(input) != 0x0025) {
+ *argConverted = -1;
+ }
+ return 1;
+}
+
+static int32_t
+u_scanf_count_handler(UFILE *input,
+ u_scanf_spec_info *info,
+ ufmt_args *args,
+ const UChar *fmt,
+ int32_t *fmtConsumed,
+ int32_t *argConverted)
+{
+ (void)input;
+ (void)fmt;
+ (void)fmtConsumed;
+
+ /* in the special case of count, the u_scanf_spec_info's width */
+ /* will contain the # of items converted thus far */
+ if (!info->fSkipArg) {
+ if (info->fIsShort)
+ *(int16_t*)(args[0].ptrValue) = (int16_t)(UINT16_MAX & info->fWidth);
+ else if (info->fIsLongLong)
+ *(int64_t*)(args[0].ptrValue) = info->fWidth;
+ else
+ *(int32_t*)(args[0].ptrValue) = (int32_t)(UINT32_MAX & info->fWidth);
+ }
+ *argConverted = 0;
+
+ /* we converted 0 args */
+ return 0;
+}
+
+static int32_t
+u_scanf_double_handler(UFILE *input,
+ u_scanf_spec_info *info,
+ ufmt_args *args,
+ const UChar *fmt,
+ int32_t *fmtConsumed,
+ int32_t *argConverted)
+{
+ (void)fmt;
+ (void)fmtConsumed;
+
+ int32_t len;
+ double num;
+ UNumberFormat *format;
+ int32_t parsePos = 0;
+ int32_t skipped;
+ UErrorCode status = U_ZERO_ERROR;
+
+
+ /* skip all ws in the input */
+ skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
+
+ /* fill the input's internal buffer */
+ ufile_fill_uchar_buffer(input);
+
+ /* determine the size of the input's buffer */
+ len = (int32_t)(input->str.fLimit - input->str.fPos);
+
+ /* truncate to the width, if specified */
+ if(info->fWidth != -1)
+ len = ufmt_min(len, info->fWidth);
+
+ /* get the formatter */
+ format = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_DECIMAL);
+
+ /* handle error */
+ if(format == 0)
+ return 0;
+
+ /* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */
+ skipped += u_scanf_skip_leading_positive_sign(input, format, &status);
+
+ /* parse the number */
+ num = unum_parseDouble(format, input->str.fPos, len, &parsePos, &status);
+
+ if (!info->fSkipArg) {
+ if (info->fIsLong)
+ *(double*)(args[0].ptrValue) = num;
+ else if (info->fIsLongDouble)
+ *(long double*)(args[0].ptrValue) = num;
+ else
+ *(float*)(args[0].ptrValue) = (float)num;
+ }
+
+ /* mask off any necessary bits */
+ /* if(! info->fIsLong_double)
+ num &= DBL_MAX;*/
+
+ /* update the input's position to reflect consumed data */
+ input->str.fPos += parsePos;
+
+ /* we converted 1 arg */
+ *argConverted = !info->fSkipArg;
+ return parsePos + skipped;
+}
+
+#define UPRINTF_SYMBOL_BUFFER_SIZE 8
+
+static int32_t
+u_scanf_scientific_handler(UFILE *input,
+ u_scanf_spec_info *info,
+ ufmt_args *args,
+ const UChar *fmt,
+ int32_t *fmtConsumed,
+ int32_t *argConverted)
+{
+ (void)fmt;
+ (void)fmtConsumed;
+
+ int32_t len;
+ double num;
+ UNumberFormat *format;
+ int32_t parsePos = 0;
+ int32_t skipped;
+ UErrorCode status = U_ZERO_ERROR;
+ UChar srcExpBuf[UPRINTF_SYMBOL_BUFFER_SIZE];
+ int32_t srcLen, expLen;
+ UChar expBuf[UPRINTF_SYMBOL_BUFFER_SIZE];
+
+
+ /* skip all ws in the input */
+ skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
+
+ /* fill the input's internal buffer */
+ ufile_fill_uchar_buffer(input);
+
+ /* determine the size of the input's buffer */
+ len = (int32_t)(input->str.fLimit - input->str.fPos);
+
+ /* truncate to the width, if specified */
+ if(info->fWidth != -1)
+ len = ufmt_min(len, info->fWidth);
+
+ /* get the formatter */
+ format = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_SCIENTIFIC);
+
+ /* handle error */
+ if(format == 0)
+ return 0;
+
+ /* set the appropriate flags on the formatter */
+
+ srcLen = unum_getSymbol(format,
+ UNUM_EXPONENTIAL_SYMBOL,
+ srcExpBuf,
+ sizeof(srcExpBuf),
+ &status);
+
+ /* Upper/lower case the e */
+ if (info->fSpec == (UChar)0x65 /* e */) {
+ expLen = u_strToLower(expBuf, (int32_t)sizeof(expBuf),
+ srcExpBuf, srcLen,
+ input->str.fBundle.fLocale,
+ &status);
+ }
+ else {
+ expLen = u_strToUpper(expBuf, (int32_t)sizeof(expBuf),
+ srcExpBuf, srcLen,
+ input->str.fBundle.fLocale,
+ &status);
+ }
+
+ unum_setSymbol(format,
+ UNUM_EXPONENTIAL_SYMBOL,
+ expBuf,
+ expLen,
+ &status);
+
+
+
+
+ /* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */
+ skipped += u_scanf_skip_leading_positive_sign(input, format, &status);
+
+ /* parse the number */
+ num = unum_parseDouble(format, input->str.fPos, len, &parsePos, &status);
+
+ if (!info->fSkipArg) {
+ if (info->fIsLong)
+ *(double*)(args[0].ptrValue) = num;
+ else if (info->fIsLongDouble)
+ *(long double*)(args[0].ptrValue) = num;
+ else
+ *(float*)(args[0].ptrValue) = (float)num;
+ }
+
+ /* mask off any necessary bits */
+ /* if(! info->fIsLong_double)
+ num &= DBL_MAX;*/
+
+ /* update the input's position to reflect consumed data */
+ input->str.fPos += parsePos;
+
+ /* we converted 1 arg */
+ *argConverted = !info->fSkipArg;
+ return parsePos + skipped;
+}
+
+static int32_t
+u_scanf_scidbl_handler(UFILE *input,
+ u_scanf_spec_info *info,
+ ufmt_args *args,
+ const UChar *fmt,
+ int32_t *fmtConsumed,
+ int32_t *argConverted)
+{
+ (void)fmt;
+ (void)fmtConsumed;
+
+ int32_t len;
+ double num;
+ UNumberFormat *scientificFormat, *genericFormat;
+ /*int32_t scientificResult, genericResult;*/
+ double scientificResult, genericResult;
+ int32_t scientificParsePos = 0, genericParsePos = 0, parsePos = 0;
+ int32_t skipped;
+ UErrorCode scientificStatus = U_ZERO_ERROR;
+ UErrorCode genericStatus = U_ZERO_ERROR;
+
+
+ /* since we can't determine by scanning the characters whether */
+ /* a number was formatted in the 'f' or 'g' styles, parse the */
+ /* string with both formatters, and assume whichever one */
+ /* parsed the most is the correct formatter to use */
+
+
+ /* skip all ws in the input */
+ skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
+
+ /* fill the input's internal buffer */
+ ufile_fill_uchar_buffer(input);
+
+ /* determine the size of the input's buffer */
+ len = (int32_t)(input->str.fLimit - input->str.fPos);
+
+ /* truncate to the width, if specified */
+ if(info->fWidth != -1)
+ len = ufmt_min(len, info->fWidth);
+
+ /* get the formatters */
+ scientificFormat = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_SCIENTIFIC);
+ genericFormat = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_DECIMAL);
+
+ /* handle error */
+ if(scientificFormat == 0 || genericFormat == 0)
+ return 0;
+
+ /* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */
+ skipped += u_scanf_skip_leading_positive_sign(input, genericFormat, &genericStatus);
+
+ /* parse the number using each format*/
+
+ scientificResult = unum_parseDouble(scientificFormat, input->str.fPos, len,
+ &scientificParsePos, &scientificStatus);
+
+ genericResult = unum_parseDouble(genericFormat, input->str.fPos, len,
+ &genericParsePos, &genericStatus);
+
+ /* determine which parse made it farther */
+ if(scientificParsePos > genericParsePos) {
+ /* stash the result in num */
+ num = scientificResult;
+ /* update the input's position to reflect consumed data */
+ parsePos += scientificParsePos;
+ }
+ else {
+ /* stash the result in num */
+ num = genericResult;
+ /* update the input's position to reflect consumed data */
+ parsePos += genericParsePos;
+ }
+ input->str.fPos += parsePos;
+
+ if (!info->fSkipArg) {
+ if (info->fIsLong)
+ *(double*)(args[0].ptrValue) = num;
+ else if (info->fIsLongDouble)
+ *(long double*)(args[0].ptrValue) = num;
+ else
+ *(float*)(args[0].ptrValue) = (float)num;
+ }
+
+ /* mask off any necessary bits */
+ /* if(! info->fIsLong_double)
+ num &= DBL_MAX;*/
+
+ /* we converted 1 arg */
+ *argConverted = !info->fSkipArg;
+ return parsePos + skipped;
+}
+
+static int32_t
+u_scanf_integer_handler(UFILE *input,
+ u_scanf_spec_info *info,
+ ufmt_args *args,
+ const UChar *fmt,
+ int32_t *fmtConsumed,
+ int32_t *argConverted)
+{
+ (void)fmt;
+ (void)fmtConsumed;
+
+ int32_t len;
+ void *num = (void*) (args[0].ptrValue);
+ UNumberFormat *format;
+ int32_t parsePos = 0;
+ int32_t skipped;
+ UErrorCode status = U_ZERO_ERROR;
+ int64_t result;
+
+
+ /* skip all ws in the input */
+ skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
+
+ /* fill the input's internal buffer */
+ ufile_fill_uchar_buffer(input);
+
+ /* determine the size of the input's buffer */
+ len = (int32_t)(input->str.fLimit - input->str.fPos);
+
+ /* truncate to the width, if specified */
+ if(info->fWidth != -1)
+ len = ufmt_min(len, info->fWidth);
+
+ /* get the formatter */
+ format = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_DECIMAL);
+
+ /* handle error */
+ if(format == 0)
+ return 0;
+
+ /* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */
+ skipped += u_scanf_skip_leading_positive_sign(input, format, &status);
+
+ /* parse the number */
+ result = unum_parseInt64(format, input->str.fPos, len, &parsePos, &status);
+
+ /* mask off any necessary bits */
+ if (!info->fSkipArg) {
+ if (info->fIsShort)
+ *(int16_t*)num = (int16_t)(UINT16_MAX & result);
+ else if (info->fIsLongLong)
+ *(int64_t*)num = result;
+ else
+ *(int32_t*)num = (int32_t)(UINT32_MAX & result);
+ }
+
+ /* update the input's position to reflect consumed data */
+ input->str.fPos += parsePos;
+
+ /* we converted 1 arg */
+ *argConverted = !info->fSkipArg;
+ return parsePos + skipped;
+}
+
+static int32_t
+u_scanf_uinteger_handler(UFILE *input,
+ u_scanf_spec_info *info,
+ ufmt_args *args,
+ const UChar *fmt,
+ int32_t *fmtConsumed,
+ int32_t *argConverted)
+{
+ /* TODO Fix this when Numberformat handles uint64_t */
+ return u_scanf_integer_handler(input, info, args, fmt, fmtConsumed, argConverted);
+}
+
+static int32_t
+u_scanf_percent_handler(UFILE *input,
+ u_scanf_spec_info *info,
+ ufmt_args *args,
+ const UChar *fmt,
+ int32_t *fmtConsumed,
+ int32_t *argConverted)
+{
+ (void)fmt;
+ (void)fmtConsumed;
+
+ int32_t len;
+ double num;
+ UNumberFormat *format;
+ int32_t parsePos = 0;
+ UErrorCode status = U_ZERO_ERROR;
+
+
+ /* skip all ws in the input */
+ u_scanf_skip_leading_ws(input, info->fPadChar);
+
+ /* fill the input's internal buffer */
+ ufile_fill_uchar_buffer(input);
+
+ /* determine the size of the input's buffer */
+ len = (int32_t)(input->str.fLimit - input->str.fPos);
+
+ /* truncate to the width, if specified */
+ if(info->fWidth != -1)
+ len = ufmt_min(len, info->fWidth);
+
+ /* get the formatter */
+ format = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_PERCENT);
+
+ /* handle error */
+ if(format == 0)
+ return 0;
+
+ /* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */
+ u_scanf_skip_leading_positive_sign(input, format, &status);
+
+ /* parse the number */
+ num = unum_parseDouble(format, input->str.fPos, len, &parsePos, &status);
+
+ if (!info->fSkipArg) {
+ *(double*)(args[0].ptrValue) = num;
+ }
+
+ /* mask off any necessary bits */
+ /* if(! info->fIsLong_double)
+ num &= DBL_MAX;*/
+
+ /* update the input's position to reflect consumed data */
+ input->str.fPos += parsePos;
+
+ /* we converted 1 arg */
+ *argConverted = !info->fSkipArg;
+ return parsePos;
+}
+
+static int32_t
+u_scanf_string_handler(UFILE *input,
+ u_scanf_spec_info *info,
+ ufmt_args *args,
+ const UChar *fmt,
+ int32_t *fmtConsumed,
+ int32_t *argConverted)
+{
+ (void)fmt;
+ (void)fmtConsumed;
+
+ const UChar *source;
+ UConverter *conv;
+ char *arg = (char*)(args[0].ptrValue);
+ char *alias = arg;
+ char *limit;
+ UErrorCode status = U_ZERO_ERROR;
+ int32_t count;
+ int32_t skipped = 0;
+ UChar c;
+ UBool isNotEOF = FALSE;
+
+ /* skip all ws in the input */
+ if (info->fIsString) {
+ skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
+ }
+
+ /* get the string one character at a time, truncating to the width */
+ count = 0;
+
+ /* open the default converter */
+ conv = u_getDefaultConverter(&status);
+
+ if(U_FAILURE(status))
+ return -1;
+
while( (info->fWidth == -1 || count < info->fWidth)
- && ((isNotEOF = ufile_getch(input, &c)) == TRUE)
- && (!info->fIsString || (c != info->fPadChar && !u_isWhitespace(c))))
- {
-
- /* put the character from the input onto the target */
- if (!info->fSkipArg) {
- *alias++ = c;
- }
-
- /* increment the count */
- ++count;
- }
-
- /* put the final character we read back on the input */
- if (!info->fSkipArg) {
- if((info->fWidth == -1 || count < info->fWidth) && isNotEOF) {
- u_fungetc(c, input);
- }
-
- /* add the terminator */
- if (info->fIsString) {
- *alias = 0x0000;
- }
- }
-
- /* we converted 1 arg */
- *argConverted = !info->fSkipArg;
- return count + skipped;
-}
-
-static int32_t
-u_scanf_uchar_handler(UFILE *input,
- u_scanf_spec_info *info,
- ufmt_args *args,
- const UChar *fmt,
- int32_t *fmtConsumed,
- int32_t *argConverted)
-{
- if (info->fWidth < 0) {
- info->fWidth = 1;
- }
- info->fIsString = FALSE;
- return u_scanf_ustring_handler(input, info, args, fmt, fmtConsumed, argConverted);
-}
-
-static int32_t
-u_scanf_spellout_handler(UFILE *input,
- u_scanf_spec_info *info,
- ufmt_args *args,
- const UChar *fmt,
- int32_t *fmtConsumed,
- int32_t *argConverted)
-{
- (void)fmt;
- (void)fmtConsumed;
-
- int32_t len;
- double num;
- UNumberFormat *format;
- int32_t parsePos = 0;
- int32_t skipped;
- UErrorCode status = U_ZERO_ERROR;
-
-
- /* skip all ws in the input */
- skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
-
- /* fill the input's internal buffer */
- ufile_fill_uchar_buffer(input);
-
- /* determine the size of the input's buffer */
- len = (int32_t)(input->str.fLimit - input->str.fPos);
-
- /* truncate to the width, if specified */
- if(info->fWidth != -1)
- len = ufmt_min(len, info->fWidth);
-
- /* get the formatter */
- format = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_SPELLOUT);
-
- /* handle error */
- if(format == 0)
- return 0;
-
- /* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */
- /* This is not applicable to RBNF. */
- /*skipped += u_scanf_skip_leading_positive_sign(input, format, &status);*/
-
- /* parse the number */
- num = unum_parseDouble(format, input->str.fPos, len, &parsePos, &status);
-
- if (!info->fSkipArg) {
- *(double*)(args[0].ptrValue) = num;
- }
-
- /* mask off any necessary bits */
- /* if(! info->fIsLong_double)
- num &= DBL_MAX;*/
-
- /* update the input's position to reflect consumed data */
- input->str.fPos += parsePos;
-
- /* we converted 1 arg */
- *argConverted = !info->fSkipArg;
- return parsePos + skipped;
-}
-
-static int32_t
-u_scanf_hex_handler(UFILE *input,
- u_scanf_spec_info *info,
- ufmt_args *args,
- const UChar *fmt,
- int32_t *fmtConsumed,
- int32_t *argConverted)
-{
- (void)fmt;
- (void)fmtConsumed;
-
- int32_t len;
- int32_t skipped;
- void *num = (void*) (args[0].ptrValue);
- int64_t result;
-
- /* skip all ws in the input */
- skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
-
- /* fill the input's internal buffer */
- ufile_fill_uchar_buffer(input);
-
- /* determine the size of the input's buffer */
- len = (int32_t)(input->str.fLimit - input->str.fPos);
-
- /* truncate to the width, if specified */
- if(info->fWidth != -1)
- len = ufmt_min(len, info->fWidth);
-
- /* check for alternate form */
- if( *(input->str.fPos) == 0x0030 &&
- (*(input->str.fPos + 1) == 0x0078 || *(input->str.fPos + 1) == 0x0058) ) {
-
- /* skip the '0' and 'x' or 'X' if present */
- input->str.fPos += 2;
- len -= 2;
- }
-
- /* parse the number */
- result = ufmt_uto64(input->str.fPos, &len, 16);
-
- /* update the input's position to reflect consumed data */
- input->str.fPos += len;
-
- /* mask off any necessary bits */
- if (!info->fSkipArg) {
- if (info->fIsShort)
- *(int16_t*)num = (int16_t)(UINT16_MAX & result);
- else if (info->fIsLongLong)
- *(int64_t*)num = result;
- else
- *(int32_t*)num = (int32_t)(UINT32_MAX & result);
- }
-
- /* we converted 1 arg */
- *argConverted = !info->fSkipArg;
- return len + skipped;
-}
-
-static int32_t
-u_scanf_octal_handler(UFILE *input,
- u_scanf_spec_info *info,
- ufmt_args *args,
- const UChar *fmt,
- int32_t *fmtConsumed,
- int32_t *argConverted)
-{
- (void)fmt;
- (void)fmtConsumed;
-
- int32_t len;
- int32_t skipped;
- void *num = (void*) (args[0].ptrValue);
- int64_t result;
-
- /* skip all ws in the input */
- skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
-
- /* fill the input's internal buffer */
- ufile_fill_uchar_buffer(input);
-
- /* determine the size of the input's buffer */
- len = (int32_t)(input->str.fLimit - input->str.fPos);
-
- /* truncate to the width, if specified */
- if(info->fWidth != -1)
- len = ufmt_min(len, info->fWidth);
-
- /* parse the number */
- result = ufmt_uto64(input->str.fPos, &len, 8);
-
- /* update the input's position to reflect consumed data */
- input->str.fPos += len;
-
- /* mask off any necessary bits */
- if (!info->fSkipArg) {
- if (info->fIsShort)
- *(int16_t*)num = (int16_t)(UINT16_MAX & result);
- else if (info->fIsLongLong)
- *(int64_t*)num = result;
- else
- *(int32_t*)num = (int32_t)(UINT32_MAX & result);
- }
-
- /* we converted 1 arg */
- *argConverted = !info->fSkipArg;
- return len + skipped;
-}
-
-static int32_t
-u_scanf_pointer_handler(UFILE *input,
- u_scanf_spec_info *info,
- ufmt_args *args,
- const UChar *fmt,
- int32_t *fmtConsumed,
- int32_t *argConverted)
-{
- (void)fmt;
- (void)fmtConsumed;
-
- int32_t len;
- int32_t skipped;
- void *result;
- void **p = (void**)(args[0].ptrValue);
-
-
- /* skip all ws in the input */
- skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
-
- /* fill the input's internal buffer */
- ufile_fill_uchar_buffer(input);
-
- /* determine the size of the input's buffer */
- len = (int32_t)(input->str.fLimit - input->str.fPos);
-
- /* truncate to the width, if specified */
- if(info->fWidth != -1) {
- len = ufmt_min(len, info->fWidth);
- }
-
- /* Make sure that we don't consume too much */
- if (len > (int32_t)(sizeof(void*)*2)) {
- len = (int32_t)(sizeof(void*)*2);
- }
-
- /* parse the pointer - assign to temporary value */
- result = ufmt_utop(input->str.fPos, &len);
-
- if (!info->fSkipArg) {
- *p = result;
- }
-
- /* update the input's position to reflect consumed data */
- input->str.fPos += len;
-
- /* we converted 1 arg */
- *argConverted = !info->fSkipArg;
- return len + skipped;
-}
-
-static int32_t
-u_scanf_scanset_handler(UFILE *input,
- u_scanf_spec_info *info,
- ufmt_args *args,
- const UChar *fmt,
- int32_t *fmtConsumed,
- int32_t *argConverted)
-{
- USet *scanset;
- UErrorCode status = U_ZERO_ERROR;
- int32_t chLeft = INT32_MAX;
- UChar32 c;
- UChar *alias = (UChar*) (args[0].ptrValue);
- UBool isNotEOF = FALSE;
- UBool readCharacter = FALSE;
-
- /* Create an empty set */
- scanset = uset_open(0, -1);
-
- /* Back up one to get the [ */
- fmt--;
-
- /* truncate to the width, if specified and alias the target */
- if(info->fWidth >= 0) {
- chLeft = info->fWidth;
- }
-
- /* parse the scanset from the fmt string */
- *fmtConsumed = uset_applyPattern(scanset, fmt, -1, 0, &status);
-
- /* verify that the parse was successful */
- if (U_SUCCESS(status)) {
- c=0;
-
- /* grab characters one at a time and make sure they are in the scanset */
- while(chLeft > 0) {
- if ( ((isNotEOF = ufile_getch32(input, &c)) == TRUE) && uset_contains(scanset, c) ) {
- readCharacter = TRUE;
- if (!info->fSkipArg) {
- int32_t idx = 0;
- UBool isError = FALSE;
-
- U16_APPEND(alias, idx, chLeft, c, isError);
- if (isError) {
- break;
- }
- alias += idx;
- }
- chLeft -= (1 + U_IS_SUPPLEMENTARY(c));
- }
- else {
- /* if the character's not in the scanset, break out */
- break;
- }
- }
-
- /* put the final character we read back on the input */
- if(isNotEOF && chLeft > 0) {
- u_fungetc(c, input);
- }
- }
-
- uset_close(scanset);
-
- /* if we didn't match at least 1 character, fail */
- if(!readCharacter)
- return -1;
- /* otherwise, add the terminator */
- else if (!info->fSkipArg) {
- *alias = 0x00;
- }
-
- /* we converted 1 arg */
- *argConverted = !info->fSkipArg;
- return (info->fWidth >= 0 ? info->fWidth : INT32_MAX) - chLeft;
-}
-
-/* Use US-ASCII characters only for formatting. Most codepages have
- characters 20-7F from Unicode. Using any other codepage specific
- characters will make it very difficult to format the string on
- non-Unicode machines */
-static const u_scanf_info g_u_scanf_infos[USCANF_NUM_FMT_HANDLERS] = {
-/* 0x20 */
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
- UFMT_EMPTY, UFMT_SIMPLE_PERCENT,UFMT_EMPTY, UFMT_EMPTY,
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
-
-/* 0x30 */
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
-
-/* 0x40 */
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_UCHAR,
- UFMT_EMPTY, UFMT_SCIENTIFIC, UFMT_EMPTY, UFMT_SCIDBL,
-#ifdef U_USE_OBSOLETE_IO_FORMATTING
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_UCHAR/*deprecated*/,
-#else
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
-#endif
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
-
-/* 0x50 */
- UFMT_PERCENT, UFMT_EMPTY, UFMT_EMPTY, UFMT_USTRING,
-#ifdef U_USE_OBSOLETE_IO_FORMATTING
- UFMT_EMPTY, UFMT_USTRING/*deprecated*/,UFMT_SPELLOUT, UFMT_EMPTY,
-#else
- UFMT_EMPTY, UFMT_EMPTY, UFMT_SPELLOUT, UFMT_EMPTY,
-#endif
- UFMT_HEX, UFMT_EMPTY, UFMT_EMPTY, UFMT_SCANSET,
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
-
-/* 0x60 */
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_CHAR,
- UFMT_INT, UFMT_SCIENTIFIC, UFMT_DOUBLE, UFMT_SCIDBL,
- UFMT_EMPTY, UFMT_INT, UFMT_EMPTY, UFMT_EMPTY,
- UFMT_EMPTY, UFMT_EMPTY, UFMT_COUNT, UFMT_OCTAL,
-
-/* 0x70 */
- UFMT_POINTER, UFMT_EMPTY, UFMT_EMPTY, UFMT_STRING,
- UFMT_EMPTY, UFMT_UINT, UFMT_EMPTY, UFMT_EMPTY,
- UFMT_HEX, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
- UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
-};
-
-U_CFUNC int32_t
-u_scanf_parse(UFILE *f,
- const UChar *patternSpecification,
- va_list ap)
-{
- const UChar *alias;
- int32_t count, converted, argConsumed, cpConsumed;
- uint16_t handlerNum;
-
- ufmt_args args;
- u_scanf_spec spec;
- ufmt_type_info info;
- u_scanf_handler handler;
-
- /* alias the pattern */
- alias = patternSpecification;
-
- /* haven't converted anything yet */
- argConsumed = 0;
- converted = 0;
- cpConsumed = 0;
-
- /* iterate through the pattern */
- for(;;) {
-
- /* match any characters up to the next '%' */
- while(*alias != UP_PERCENT && *alias != 0x0000 && u_fgetc(f) == *alias) {
- alias++;
- }
-
- /* if we aren't at a '%', or if we're at end of string, break*/
- if(*alias != UP_PERCENT || *alias == 0x0000)
- break;
-
- /* parse the specifier */
- count = u_scanf_parse_spec(alias, &spec);
-
- /* update the pointer in pattern */
- alias += count;
-
- handlerNum = (uint16_t)(spec.fInfo.fSpec - USCANF_BASE_FMT_HANDLERS);
- if (handlerNum < USCANF_NUM_FMT_HANDLERS) {
- /* skip the argument, if necessary */
- /* query the info function for argument information */
- info = g_u_scanf_infos[ handlerNum ].info;
- if (info != ufmt_count && u_feof(f)) {
- break;
- }
- else if(spec.fInfo.fSkipArg) {
- args.ptrValue = NULL;
- }
- else {
- switch(info) {
- case ufmt_count:
- /* set the spec's width to the # of items converted */
- spec.fInfo.fWidth = cpConsumed;
- U_FALLTHROUGH;
- case ufmt_char:
- case ufmt_uchar:
- case ufmt_int:
- case ufmt_string:
- case ufmt_ustring:
- case ufmt_pointer:
- case ufmt_float:
- case ufmt_double:
- args.ptrValue = va_arg(ap, void*);
- break;
-
- default:
- /* else args is ignored */
- args.ptrValue = NULL;
- break;
- }
- }
-
- /* call the handler function */
- handler = g_u_scanf_infos[ handlerNum ].handler;
- if(handler != 0) {
-
- /* reset count to 1 so that += for alias works. */
- count = 1;
-
- cpConsumed += (*handler)(f, &spec.fInfo, &args, alias, &count, &argConsumed);
-
- /* if the handler encountered an error condition, break */
- if(argConsumed < 0) {
- converted = -1;
- break;
- }
-
- /* add to the # of items converted */
- converted += argConsumed;
-
- /* update the pointer in pattern */
- alias += count-1;
- }
- /* else do nothing */
- }
- /* else do nothing */
-
- /* just ignore unknown tags */
- }
-
- /* return # of items converted */
- return converted;
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+ && ((isNotEOF = ufile_getch(input, &c)) == TRUE)
+ && (!info->fIsString || (c != info->fPadChar && !u_isWhitespace(c))))
+ {
+
+ if (!info->fSkipArg) {
+ /* put the character from the input onto the target */
+ source = &c;
+ /* Since we do this one character at a time, do it this way. */
+ if (info->fWidth > 0) {
+ limit = alias + info->fWidth - count;
+ }
+ else {
+ limit = alias + ucnv_getMaxCharSize(conv);
+ }
+
+ /* convert the character to the default codepage */
+ ucnv_fromUnicode(conv, &alias, limit, &source, source + 1,
+ NULL, TRUE, &status);
+
+ if(U_FAILURE(status)) {
+ /* clean up */
+ u_releaseDefaultConverter(conv);
+ return -1;
+ }
+ }
+
+ /* increment the count */
+ ++count;
+ }
+
+ /* put the final character we read back on the input */
+ if (!info->fSkipArg) {
+ if ((info->fWidth == -1 || count < info->fWidth) && isNotEOF)
+ u_fungetc(c, input);
+
+ /* add the terminator */
+ if (info->fIsString) {
+ *alias = 0x00;
+ }
+ }
+
+ /* clean up */
+ u_releaseDefaultConverter(conv);
+
+ /* we converted 1 arg */
+ *argConverted = !info->fSkipArg;
+ return count + skipped;
+}
+
+static int32_t
+u_scanf_char_handler(UFILE *input,
+ u_scanf_spec_info *info,
+ ufmt_args *args,
+ const UChar *fmt,
+ int32_t *fmtConsumed,
+ int32_t *argConverted)
+{
+ if (info->fWidth < 0) {
+ info->fWidth = 1;
+ }
+ info->fIsString = FALSE;
+ return u_scanf_string_handler(input, info, args, fmt, fmtConsumed, argConverted);
+}
+
+static int32_t
+u_scanf_ustring_handler(UFILE *input,
+ u_scanf_spec_info *info,
+ ufmt_args *args,
+ const UChar *fmt,
+ int32_t *fmtConsumed,
+ int32_t *argConverted)
+{
+ (void)fmt;
+ (void)fmtConsumed;
+
+ UChar *arg = (UChar*)(args[0].ptrValue);
+ UChar *alias = arg;
+ int32_t count;
+ int32_t skipped = 0;
+ UChar c;
+ UBool isNotEOF = FALSE;
+
+ /* skip all ws in the input */
+ if (info->fIsString) {
+ skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
+ }
+
+ /* get the string one character at a time, truncating to the width */
+ count = 0;
+
+ while( (info->fWidth == -1 || count < info->fWidth)
+ && ((isNotEOF = ufile_getch(input, &c)) == TRUE)
+ && (!info->fIsString || (c != info->fPadChar && !u_isWhitespace(c))))
+ {
+
+ /* put the character from the input onto the target */
+ if (!info->fSkipArg) {
+ *alias++ = c;
+ }
+
+ /* increment the count */
+ ++count;
+ }
+
+ /* put the final character we read back on the input */
+ if (!info->fSkipArg) {
+ if((info->fWidth == -1 || count < info->fWidth) && isNotEOF) {
+ u_fungetc(c, input);
+ }
+
+ /* add the terminator */
+ if (info->fIsString) {
+ *alias = 0x0000;
+ }
+ }
+
+ /* we converted 1 arg */
+ *argConverted = !info->fSkipArg;
+ return count + skipped;
+}
+
+static int32_t
+u_scanf_uchar_handler(UFILE *input,
+ u_scanf_spec_info *info,
+ ufmt_args *args,
+ const UChar *fmt,
+ int32_t *fmtConsumed,
+ int32_t *argConverted)
+{
+ if (info->fWidth < 0) {
+ info->fWidth = 1;
+ }
+ info->fIsString = FALSE;
+ return u_scanf_ustring_handler(input, info, args, fmt, fmtConsumed, argConverted);
+}
+
+static int32_t
+u_scanf_spellout_handler(UFILE *input,
+ u_scanf_spec_info *info,
+ ufmt_args *args,
+ const UChar *fmt,
+ int32_t *fmtConsumed,
+ int32_t *argConverted)
+{
+ (void)fmt;
+ (void)fmtConsumed;
+
+ int32_t len;
+ double num;
+ UNumberFormat *format;
+ int32_t parsePos = 0;
+ int32_t skipped;
+ UErrorCode status = U_ZERO_ERROR;
+
+
+ /* skip all ws in the input */
+ skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
+
+ /* fill the input's internal buffer */
+ ufile_fill_uchar_buffer(input);
+
+ /* determine the size of the input's buffer */
+ len = (int32_t)(input->str.fLimit - input->str.fPos);
+
+ /* truncate to the width, if specified */
+ if(info->fWidth != -1)
+ len = ufmt_min(len, info->fWidth);
+
+ /* get the formatter */
+ format = u_locbund_getNumberFormat(&input->str.fBundle, UNUM_SPELLOUT);
+
+ /* handle error */
+ if(format == 0)
+ return 0;
+
+ /* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */
+ /* This is not applicable to RBNF. */
+ /*skipped += u_scanf_skip_leading_positive_sign(input, format, &status);*/
+
+ /* parse the number */
+ num = unum_parseDouble(format, input->str.fPos, len, &parsePos, &status);
+
+ if (!info->fSkipArg) {
+ *(double*)(args[0].ptrValue) = num;
+ }
+
+ /* mask off any necessary bits */
+ /* if(! info->fIsLong_double)
+ num &= DBL_MAX;*/
+
+ /* update the input's position to reflect consumed data */
+ input->str.fPos += parsePos;
+
+ /* we converted 1 arg */
+ *argConverted = !info->fSkipArg;
+ return parsePos + skipped;
+}
+
+static int32_t
+u_scanf_hex_handler(UFILE *input,
+ u_scanf_spec_info *info,
+ ufmt_args *args,
+ const UChar *fmt,
+ int32_t *fmtConsumed,
+ int32_t *argConverted)
+{
+ (void)fmt;
+ (void)fmtConsumed;
+
+ int32_t len;
+ int32_t skipped;
+ void *num = (void*) (args[0].ptrValue);
+ int64_t result;
+
+ /* skip all ws in the input */
+ skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
+
+ /* fill the input's internal buffer */
+ ufile_fill_uchar_buffer(input);
+
+ /* determine the size of the input's buffer */
+ len = (int32_t)(input->str.fLimit - input->str.fPos);
+
+ /* truncate to the width, if specified */
+ if(info->fWidth != -1)
+ len = ufmt_min(len, info->fWidth);
+
+ /* check for alternate form */
+ if( *(input->str.fPos) == 0x0030 &&
+ (*(input->str.fPos + 1) == 0x0078 || *(input->str.fPos + 1) == 0x0058) ) {
+
+ /* skip the '0' and 'x' or 'X' if present */
+ input->str.fPos += 2;
+ len -= 2;
+ }
+
+ /* parse the number */
+ result = ufmt_uto64(input->str.fPos, &len, 16);
+
+ /* update the input's position to reflect consumed data */
+ input->str.fPos += len;
+
+ /* mask off any necessary bits */
+ if (!info->fSkipArg) {
+ if (info->fIsShort)
+ *(int16_t*)num = (int16_t)(UINT16_MAX & result);
+ else if (info->fIsLongLong)
+ *(int64_t*)num = result;
+ else
+ *(int32_t*)num = (int32_t)(UINT32_MAX & result);
+ }
+
+ /* we converted 1 arg */
+ *argConverted = !info->fSkipArg;
+ return len + skipped;
+}
+
+static int32_t
+u_scanf_octal_handler(UFILE *input,
+ u_scanf_spec_info *info,
+ ufmt_args *args,
+ const UChar *fmt,
+ int32_t *fmtConsumed,
+ int32_t *argConverted)
+{
+ (void)fmt;
+ (void)fmtConsumed;
+
+ int32_t len;
+ int32_t skipped;
+ void *num = (void*) (args[0].ptrValue);
+ int64_t result;
+
+ /* skip all ws in the input */
+ skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
+
+ /* fill the input's internal buffer */
+ ufile_fill_uchar_buffer(input);
+
+ /* determine the size of the input's buffer */
+ len = (int32_t)(input->str.fLimit - input->str.fPos);
+
+ /* truncate to the width, if specified */
+ if(info->fWidth != -1)
+ len = ufmt_min(len, info->fWidth);
+
+ /* parse the number */
+ result = ufmt_uto64(input->str.fPos, &len, 8);
+
+ /* update the input's position to reflect consumed data */
+ input->str.fPos += len;
+
+ /* mask off any necessary bits */
+ if (!info->fSkipArg) {
+ if (info->fIsShort)
+ *(int16_t*)num = (int16_t)(UINT16_MAX & result);
+ else if (info->fIsLongLong)
+ *(int64_t*)num = result;
+ else
+ *(int32_t*)num = (int32_t)(UINT32_MAX & result);
+ }
+
+ /* we converted 1 arg */
+ *argConverted = !info->fSkipArg;
+ return len + skipped;
+}
+
+static int32_t
+u_scanf_pointer_handler(UFILE *input,
+ u_scanf_spec_info *info,
+ ufmt_args *args,
+ const UChar *fmt,
+ int32_t *fmtConsumed,
+ int32_t *argConverted)
+{
+ (void)fmt;
+ (void)fmtConsumed;
+
+ int32_t len;
+ int32_t skipped;
+ void *result;
+ void **p = (void**)(args[0].ptrValue);
+
+
+ /* skip all ws in the input */
+ skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
+
+ /* fill the input's internal buffer */
+ ufile_fill_uchar_buffer(input);
+
+ /* determine the size of the input's buffer */
+ len = (int32_t)(input->str.fLimit - input->str.fPos);
+
+ /* truncate to the width, if specified */
+ if(info->fWidth != -1) {
+ len = ufmt_min(len, info->fWidth);
+ }
+
+ /* Make sure that we don't consume too much */
+ if (len > (int32_t)(sizeof(void*)*2)) {
+ len = (int32_t)(sizeof(void*)*2);
+ }
+
+ /* parse the pointer - assign to temporary value */
+ result = ufmt_utop(input->str.fPos, &len);
+
+ if (!info->fSkipArg) {
+ *p = result;
+ }
+
+ /* update the input's position to reflect consumed data */
+ input->str.fPos += len;
+
+ /* we converted 1 arg */
+ *argConverted = !info->fSkipArg;
+ return len + skipped;
+}
+
+static int32_t
+u_scanf_scanset_handler(UFILE *input,
+ u_scanf_spec_info *info,
+ ufmt_args *args,
+ const UChar *fmt,
+ int32_t *fmtConsumed,
+ int32_t *argConverted)
+{
+ USet *scanset;
+ UErrorCode status = U_ZERO_ERROR;
+ int32_t chLeft = INT32_MAX;
+ UChar32 c;
+ UChar *alias = (UChar*) (args[0].ptrValue);
+ UBool isNotEOF = FALSE;
+ UBool readCharacter = FALSE;
+
+ /* Create an empty set */
+ scanset = uset_open(0, -1);
+
+ /* Back up one to get the [ */
+ fmt--;
+
+ /* truncate to the width, if specified and alias the target */
+ if(info->fWidth >= 0) {
+ chLeft = info->fWidth;
+ }
+
+ /* parse the scanset from the fmt string */
+ *fmtConsumed = uset_applyPattern(scanset, fmt, -1, 0, &status);
+
+ /* verify that the parse was successful */
+ if (U_SUCCESS(status)) {
+ c=0;
+
+ /* grab characters one at a time and make sure they are in the scanset */
+ while(chLeft > 0) {
+ if ( ((isNotEOF = ufile_getch32(input, &c)) == TRUE) && uset_contains(scanset, c) ) {
+ readCharacter = TRUE;
+ if (!info->fSkipArg) {
+ int32_t idx = 0;
+ UBool isError = FALSE;
+
+ U16_APPEND(alias, idx, chLeft, c, isError);
+ if (isError) {
+ break;
+ }
+ alias += idx;
+ }
+ chLeft -= (1 + U_IS_SUPPLEMENTARY(c));
+ }
+ else {
+ /* if the character's not in the scanset, break out */
+ break;
+ }
+ }
+
+ /* put the final character we read back on the input */
+ if(isNotEOF && chLeft > 0) {
+ u_fungetc(c, input);
+ }
+ }
+
+ uset_close(scanset);
+
+ /* if we didn't match at least 1 character, fail */
+ if(!readCharacter)
+ return -1;
+ /* otherwise, add the terminator */
+ else if (!info->fSkipArg) {
+ *alias = 0x00;
+ }
+
+ /* we converted 1 arg */
+ *argConverted = !info->fSkipArg;
+ return (info->fWidth >= 0 ? info->fWidth : INT32_MAX) - chLeft;
+}
+
+/* Use US-ASCII characters only for formatting. Most codepages have
+ characters 20-7F from Unicode. Using any other codepage specific
+ characters will make it very difficult to format the string on
+ non-Unicode machines */
+static const u_scanf_info g_u_scanf_infos[USCANF_NUM_FMT_HANDLERS] = {
+/* 0x20 */
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_EMPTY, UFMT_SIMPLE_PERCENT,UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+
+/* 0x30 */
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+
+/* 0x40 */
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_UCHAR,
+ UFMT_EMPTY, UFMT_SCIENTIFIC, UFMT_EMPTY, UFMT_SCIDBL,
+#ifdef U_USE_OBSOLETE_IO_FORMATTING
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_UCHAR/*deprecated*/,
+#else
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+#endif
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+
+/* 0x50 */
+ UFMT_PERCENT, UFMT_EMPTY, UFMT_EMPTY, UFMT_USTRING,
+#ifdef U_USE_OBSOLETE_IO_FORMATTING
+ UFMT_EMPTY, UFMT_USTRING/*deprecated*/,UFMT_SPELLOUT, UFMT_EMPTY,
+#else
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_SPELLOUT, UFMT_EMPTY,
+#endif
+ UFMT_HEX, UFMT_EMPTY, UFMT_EMPTY, UFMT_SCANSET,
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+
+/* 0x60 */
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_CHAR,
+ UFMT_INT, UFMT_SCIENTIFIC, UFMT_DOUBLE, UFMT_SCIDBL,
+ UFMT_EMPTY, UFMT_INT, UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_COUNT, UFMT_OCTAL,
+
+/* 0x70 */
+ UFMT_POINTER, UFMT_EMPTY, UFMT_EMPTY, UFMT_STRING,
+ UFMT_EMPTY, UFMT_UINT, UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_HEX, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+ UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY, UFMT_EMPTY,
+};
+
+U_CFUNC int32_t
+u_scanf_parse(UFILE *f,
+ const UChar *patternSpecification,
+ va_list ap)
+{
+ const UChar *alias;
+ int32_t count, converted, argConsumed, cpConsumed;
+ uint16_t handlerNum;
+
+ ufmt_args args;
+ u_scanf_spec spec;
+ ufmt_type_info info;
+ u_scanf_handler handler;
+
+ /* alias the pattern */
+ alias = patternSpecification;
+
+ /* haven't converted anything yet */
+ argConsumed = 0;
+ converted = 0;
+ cpConsumed = 0;
+
+ /* iterate through the pattern */
+ for(;;) {
+
+ /* match any characters up to the next '%' */
+ while(*alias != UP_PERCENT && *alias != 0x0000 && u_fgetc(f) == *alias) {
+ alias++;
+ }
+
+ /* if we aren't at a '%', or if we're at end of string, break*/
+ if(*alias != UP_PERCENT || *alias == 0x0000)
+ break;
+
+ /* parse the specifier */
+ count = u_scanf_parse_spec(alias, &spec);
+
+ /* update the pointer in pattern */
+ alias += count;
+
+ handlerNum = (uint16_t)(spec.fInfo.fSpec - USCANF_BASE_FMT_HANDLERS);
+ if (handlerNum < USCANF_NUM_FMT_HANDLERS) {
+ /* skip the argument, if necessary */
+ /* query the info function for argument information */
+ info = g_u_scanf_infos[ handlerNum ].info;
+ if (info != ufmt_count && u_feof(f)) {
+ break;
+ }
+ else if(spec.fInfo.fSkipArg) {
+ args.ptrValue = NULL;
+ }
+ else {
+ switch(info) {
+ case ufmt_count:
+ /* set the spec's width to the # of items converted */
+ spec.fInfo.fWidth = cpConsumed;
+ U_FALLTHROUGH;
+ case ufmt_char:
+ case ufmt_uchar:
+ case ufmt_int:
+ case ufmt_string:
+ case ufmt_ustring:
+ case ufmt_pointer:
+ case ufmt_float:
+ case ufmt_double:
+ args.ptrValue = va_arg(ap, void*);
+ break;
+
+ default:
+ /* else args is ignored */
+ args.ptrValue = NULL;
+ break;
+ }
+ }
+
+ /* call the handler function */
+ handler = g_u_scanf_infos[ handlerNum ].handler;
+ if(handler != 0) {
+
+ /* reset count to 1 so that += for alias works. */
+ count = 1;
+
+ cpConsumed += (*handler)(f, &spec.fInfo, &args, alias, &count, &argConsumed);
+
+ /* if the handler encountered an error condition, break */
+ if(argConsumed < 0) {
+ converted = -1;
+ break;
+ }
+
+ /* add to the # of items converted */
+ converted += argConsumed;
+
+ /* update the pointer in pattern */
+ alias += count-1;
+ }
+ /* else do nothing */
+ }
+ /* else do nothing */
+
+ /* just ignore unknown tags */
+ }
+
+ /* return # of items converted */
+ return converted;
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/contrib/libs/icu/io/ustdio.cpp b/contrib/libs/icu/io/ustdio.cpp
index 91f0cd2cf2..d6eb5cf9ec 100644
--- a/contrib/libs/icu/io/ustdio.cpp
+++ b/contrib/libs/icu/io/ustdio.cpp
@@ -1,732 +1,732 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
- ******************************************************************************
- *
- * Copyright (C) 1998-2016, International Business Machines
- * Corporation and others. All Rights Reserved.
- *
- ******************************************************************************
- *
- * File ustdio.c
- *
- * Modification History:
- *
- * Date Name Description
- * 11/18/98 stephen Creation.
- * 03/12/99 stephen Modified for new C API.
- * 07/19/99 stephen Fixed read() and gets()
- ******************************************************************************
- */
-
-#include "unicode/ustdio.h"
-
-#if !UCONFIG_NO_CONVERSION
-
-#include "unicode/putil.h"
-#include "cmemory.h"
-#include "cstring.h"
-#include "ufile.h"
-#include "ufmt_cmn.h"
-#include "unicode/ucnv.h"
-#include "unicode/ustring.h"
-
-#include <string.h>
-
-#define DELIM_LF 0x000A
-#define DELIM_VT 0x000B
-#define DELIM_FF 0x000C
-#define DELIM_CR 0x000D
-#define DELIM_NEL 0x0085
-#define DELIM_LS 0x2028
-#define DELIM_PS 0x2029
-
-/* TODO: is this correct for all codepages? Should we just use \n and let the converter handle it? */
-#if U_PLATFORM_USES_ONLY_WIN32_API
-static const UChar DELIMITERS [] = { DELIM_CR, DELIM_LF, 0x0000 };
-static const uint32_t DELIMITERS_LEN = 2;
-/* TODO: Default newline writing should be detected based upon the converter being used. */
-#else
-static const UChar DELIMITERS [] = { DELIM_LF, 0x0000 };
-static const uint32_t DELIMITERS_LEN = 1;
-#endif
-
-#define IS_FIRST_STRING_DELIMITER(c1) \
- (UBool)((DELIM_LF <= (c1) && (c1) <= DELIM_CR) \
- || (c1) == DELIM_NEL \
- || (c1) == DELIM_LS \
- || (c1) == DELIM_PS)
-#define CAN_HAVE_COMBINED_STRING_DELIMITER(c1) (UBool)((c1) == DELIM_CR)
-#define IS_COMBINED_STRING_DELIMITER(c1, c2) \
- (UBool)((c1) == DELIM_CR && (c2) == DELIM_LF)
-
-
-#if !UCONFIG_NO_TRANSLITERATION
-
-U_CAPI UTransliterator* U_EXPORT2
-u_fsettransliterator(UFILE *file, UFileDirection direction,
- UTransliterator *adopt, UErrorCode *status)
-{
- UTransliterator *old = NULL;
-
- if(U_FAILURE(*status))
- {
- return adopt;
- }
-
- if(!file)
- {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return adopt;
- }
-
- if(direction & U_READ)
- {
- /** TODO: implement */
- *status = U_UNSUPPORTED_ERROR;
- return adopt;
- }
-
- if(adopt == NULL) /* they are clearing it */
- {
- if(file->fTranslit != NULL)
- {
- /* TODO: Check side */
- old = file->fTranslit->translit;
- uprv_free(file->fTranslit->buffer);
- file->fTranslit->buffer=NULL;
- uprv_free(file->fTranslit);
- file->fTranslit=NULL;
- }
- }
- else
- {
- if(file->fTranslit == NULL)
- {
- file->fTranslit = (UFILETranslitBuffer*) uprv_malloc(sizeof(UFILETranslitBuffer));
- if(!file->fTranslit)
- {
- *status = U_MEMORY_ALLOCATION_ERROR;
- return adopt;
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+ ******************************************************************************
+ *
+ * Copyright (C) 1998-2016, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ *
+ ******************************************************************************
+ *
+ * File ustdio.c
+ *
+ * Modification History:
+ *
+ * Date Name Description
+ * 11/18/98 stephen Creation.
+ * 03/12/99 stephen Modified for new C API.
+ * 07/19/99 stephen Fixed read() and gets()
+ ******************************************************************************
+ */
+
+#include "unicode/ustdio.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+#include "unicode/putil.h"
+#include "cmemory.h"
+#include "cstring.h"
+#include "ufile.h"
+#include "ufmt_cmn.h"
+#include "unicode/ucnv.h"
+#include "unicode/ustring.h"
+
+#include <string.h>
+
+#define DELIM_LF 0x000A
+#define DELIM_VT 0x000B
+#define DELIM_FF 0x000C
+#define DELIM_CR 0x000D
+#define DELIM_NEL 0x0085
+#define DELIM_LS 0x2028
+#define DELIM_PS 0x2029
+
+/* TODO: is this correct for all codepages? Should we just use \n and let the converter handle it? */
+#if U_PLATFORM_USES_ONLY_WIN32_API
+static const UChar DELIMITERS [] = { DELIM_CR, DELIM_LF, 0x0000 };
+static const uint32_t DELIMITERS_LEN = 2;
+/* TODO: Default newline writing should be detected based upon the converter being used. */
+#else
+static const UChar DELIMITERS [] = { DELIM_LF, 0x0000 };
+static const uint32_t DELIMITERS_LEN = 1;
+#endif
+
+#define IS_FIRST_STRING_DELIMITER(c1) \
+ (UBool)((DELIM_LF <= (c1) && (c1) <= DELIM_CR) \
+ || (c1) == DELIM_NEL \
+ || (c1) == DELIM_LS \
+ || (c1) == DELIM_PS)
+#define CAN_HAVE_COMBINED_STRING_DELIMITER(c1) (UBool)((c1) == DELIM_CR)
+#define IS_COMBINED_STRING_DELIMITER(c1, c2) \
+ (UBool)((c1) == DELIM_CR && (c2) == DELIM_LF)
+
+
+#if !UCONFIG_NO_TRANSLITERATION
+
+U_CAPI UTransliterator* U_EXPORT2
+u_fsettransliterator(UFILE *file, UFileDirection direction,
+ UTransliterator *adopt, UErrorCode *status)
+{
+ UTransliterator *old = NULL;
+
+ if(U_FAILURE(*status))
+ {
+ return adopt;
+ }
+
+ if(!file)
+ {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return adopt;
+ }
+
+ if(direction & U_READ)
+ {
+ /** TODO: implement */
+ *status = U_UNSUPPORTED_ERROR;
+ return adopt;
+ }
+
+ if(adopt == NULL) /* they are clearing it */
+ {
+ if(file->fTranslit != NULL)
+ {
+ /* TODO: Check side */
+ old = file->fTranslit->translit;
+ uprv_free(file->fTranslit->buffer);
+ file->fTranslit->buffer=NULL;
+ uprv_free(file->fTranslit);
+ file->fTranslit=NULL;
+ }
+ }
+ else
+ {
+ if(file->fTranslit == NULL)
+ {
+ file->fTranslit = (UFILETranslitBuffer*) uprv_malloc(sizeof(UFILETranslitBuffer));
+ if(!file->fTranslit)
+ {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return adopt;
+ }
+ file->fTranslit->capacity = 0;
+ file->fTranslit->length = 0;
+ file->fTranslit->pos = 0;
+ file->fTranslit->buffer = NULL;
+ }
+ else
+ {
+ old = file->fTranslit->translit;
+ ufile_flush_translit(file);
+ }
+
+ file->fTranslit->translit = adopt;
+ }
+
+ return old;
+}
+
+static const UChar * u_file_translit(UFILE *f, const UChar *src, int32_t *count, UBool flush)
+{
+ int32_t newlen;
+ int32_t junkCount = 0;
+ int32_t textLength;
+ int32_t textLimit;
+ UTransPosition pos;
+ UErrorCode status = U_ZERO_ERROR;
+
+ if(count == NULL)
+ {
+ count = &junkCount;
+ }
+
+ if ((!f)||(!f->fTranslit)||(!f->fTranslit->translit))
+ {
+ /* fast path */
+ return src;
+ }
+
+ /* First: slide over everything */
+ if(f->fTranslit->length > f->fTranslit->pos)
+ {
+ memmove(f->fTranslit->buffer, f->fTranslit->buffer + f->fTranslit->pos,
+ (f->fTranslit->length - f->fTranslit->pos)*sizeof(UChar));
+ }
+ f->fTranslit->length -= f->fTranslit->pos; /* always */
+ f->fTranslit->pos = 0;
+
+ /* Calculate new buffer size needed */
+ newlen = (*count + f->fTranslit->length) * 4;
+
+ if(newlen > f->fTranslit->capacity)
+ {
+ if(f->fTranslit->buffer == NULL)
+ {
+ f->fTranslit->buffer = (UChar*)uprv_malloc(newlen * sizeof(UChar));
+ }
+ else
+ {
+ f->fTranslit->buffer = (UChar*)uprv_realloc(f->fTranslit->buffer, newlen * sizeof(UChar));
+ }
+ /* Check for malloc/realloc failure. */
+ if (f->fTranslit->buffer == NULL) {
+ return NULL;
+ }
+ f->fTranslit->capacity = newlen;
+ }
+
+ /* Now, copy any data over */
+ u_strncpy(f->fTranslit->buffer + f->fTranslit->length,
+ src,
+ *count);
+ f->fTranslit->length += *count;
+
+ /* Now, translit in place as much as we can */
+ if(flush == FALSE)
+ {
+ textLength = f->fTranslit->length;
+ pos.contextStart = 0;
+ pos.contextLimit = textLength;
+ pos.start = 0;
+ pos.limit = textLength;
+
+ utrans_transIncrementalUChars(f->fTranslit->translit,
+ f->fTranslit->buffer, /* because we shifted */
+ &textLength,
+ f->fTranslit->capacity,
+ &pos,
+ &status);
+
+ /* now: start/limit point to the transliterated text */
+ /* Transliterated is [buffer..pos.start) */
+ *count = pos.start;
+ f->fTranslit->pos = pos.start;
+ f->fTranslit->length = pos.limit;
+
+ return f->fTranslit->buffer;
+ }
+ else
+ {
+ textLength = f->fTranslit->length;
+ textLimit = f->fTranslit->length;
+
+ utrans_transUChars(f->fTranslit->translit,
+ f->fTranslit->buffer,
+ &textLength,
+ f->fTranslit->capacity,
+ 0,
+ &textLimit,
+ &status);
+
+ /* out: converted len */
+ *count = textLimit;
+
+ /* Set pointers to 0 */
+ f->fTranslit->pos = 0;
+ f->fTranslit->length = 0;
+
+ return f->fTranslit->buffer;
+ }
+}
+
+#endif
+
+void
+ufile_flush_translit(UFILE *f)
+{
+#if !UCONFIG_NO_TRANSLITERATION
+ if((!f)||(!f->fTranslit))
+ return;
+#endif
+
+ u_file_write_flush(NULL, 0, f, FALSE, TRUE);
+}
+
+
+void
+ufile_flush_io(UFILE *f)
+{
+ if((!f) || (!f->fFile)) {
+ return; /* skip if no file */
+ }
+
+ u_file_write_flush(NULL, 0, f, TRUE, FALSE);
+}
+
+
+void
+ufile_close_translit(UFILE *f)
+{
+#if !UCONFIG_NO_TRANSLITERATION
+ if((!f)||(!f->fTranslit))
+ return;
+#endif
+
+ ufile_flush_translit(f);
+
+#if !UCONFIG_NO_TRANSLITERATION
+ if(f->fTranslit->translit)
+ utrans_close(f->fTranslit->translit);
+
+ if(f->fTranslit->buffer)
+ {
+ uprv_free(f->fTranslit->buffer);
+ }
+
+ uprv_free(f->fTranslit);
+ f->fTranslit = NULL;
+#endif
+}
+
+
+/* Input/output */
+
+U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_fputs(const UChar *s,
+ UFILE *f)
+{
+ int32_t count = u_file_write(s, u_strlen(s), f);
+ count += u_file_write(DELIMITERS, DELIMITERS_LEN, f);
+ return count;
+}
+
+U_CAPI UChar32 U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_fputc(UChar32 uc,
+ UFILE *f)
+{
+ UChar buf[2];
+ int32_t idx = 0;
+ UBool isError = FALSE;
+
+ U16_APPEND(buf, idx, UPRV_LENGTHOF(buf), uc, isError);
+ if (isError) {
+ return U_EOF;
+ }
+ return u_file_write(buf, idx, f) == idx ? uc : U_EOF;
+}
+
+
+U_CFUNC int32_t U_EXPORT2
+u_file_write_flush(const UChar *chars,
+ int32_t count,
+ UFILE *f,
+ UBool flushIO,
+ UBool flushTranslit)
+{
+ /* Set up conversion parameters */
+ UErrorCode status = U_ZERO_ERROR;
+ const UChar *mySource = chars;
+ const UChar *mySourceBegin;
+ const UChar *mySourceEnd;
+ char charBuffer[UFILE_CHARBUFFER_SIZE];
+ char *myTarget = charBuffer;
+ int32_t written = 0;
+ int32_t numConverted = 0;
+
+ if (count < 0) {
+ count = u_strlen(chars);
+ }
+
+#if !UCONFIG_NO_TRANSLITERATION
+ if((f->fTranslit) && (f->fTranslit->translit))
+ {
+ /* Do the transliteration */
+ mySource = u_file_translit(f, chars, &count, flushTranslit);
+ }
+#endif
+
+ /* Write to a string. */
+ if (!f->fFile) {
+ int32_t charsLeft = (int32_t)(f->str.fLimit - f->str.fPos);
+ if (flushIO && charsLeft > count) {
+ count++;
+ }
+ written = ufmt_min(count, charsLeft);
+ u_strncpy(f->str.fPos, mySource, written);
+ f->str.fPos += written;
+ return written;
+ }
+
+ mySourceEnd = mySource + count;
+
+ /* Perform the conversion in a loop */
+ do {
+ mySourceBegin = mySource; /* beginning location for this loop */
+ status = U_ZERO_ERROR;
+ if(f->fConverter != NULL) { /* We have a valid converter */
+ ucnv_fromUnicode(f->fConverter,
+ &myTarget,
+ charBuffer + UFILE_CHARBUFFER_SIZE,
+ &mySource,
+ mySourceEnd,
+ NULL,
+ flushIO,
+ &status);
+ } else { /*weiv: do the invariant conversion */
+ int32_t convertChars = (int32_t) (mySourceEnd - mySource);
+ if (convertChars > UFILE_CHARBUFFER_SIZE) {
+ convertChars = UFILE_CHARBUFFER_SIZE;
+ status = U_BUFFER_OVERFLOW_ERROR;
}
- file->fTranslit->capacity = 0;
- file->fTranslit->length = 0;
- file->fTranslit->pos = 0;
- file->fTranslit->buffer = NULL;
- }
- else
- {
- old = file->fTranslit->translit;
- ufile_flush_translit(file);
- }
-
- file->fTranslit->translit = adopt;
- }
-
- return old;
-}
-
-static const UChar * u_file_translit(UFILE *f, const UChar *src, int32_t *count, UBool flush)
-{
- int32_t newlen;
- int32_t junkCount = 0;
- int32_t textLength;
- int32_t textLimit;
- UTransPosition pos;
- UErrorCode status = U_ZERO_ERROR;
-
- if(count == NULL)
- {
- count = &junkCount;
- }
-
- if ((!f)||(!f->fTranslit)||(!f->fTranslit->translit))
- {
- /* fast path */
- return src;
- }
-
- /* First: slide over everything */
- if(f->fTranslit->length > f->fTranslit->pos)
- {
- memmove(f->fTranslit->buffer, f->fTranslit->buffer + f->fTranslit->pos,
- (f->fTranslit->length - f->fTranslit->pos)*sizeof(UChar));
- }
- f->fTranslit->length -= f->fTranslit->pos; /* always */
- f->fTranslit->pos = 0;
-
- /* Calculate new buffer size needed */
- newlen = (*count + f->fTranslit->length) * 4;
-
- if(newlen > f->fTranslit->capacity)
- {
- if(f->fTranslit->buffer == NULL)
- {
- f->fTranslit->buffer = (UChar*)uprv_malloc(newlen * sizeof(UChar));
- }
- else
- {
- f->fTranslit->buffer = (UChar*)uprv_realloc(f->fTranslit->buffer, newlen * sizeof(UChar));
- }
- /* Check for malloc/realloc failure. */
- if (f->fTranslit->buffer == NULL) {
- return NULL;
- }
- f->fTranslit->capacity = newlen;
- }
-
- /* Now, copy any data over */
- u_strncpy(f->fTranslit->buffer + f->fTranslit->length,
- src,
- *count);
- f->fTranslit->length += *count;
-
- /* Now, translit in place as much as we can */
- if(flush == FALSE)
- {
- textLength = f->fTranslit->length;
- pos.contextStart = 0;
- pos.contextLimit = textLength;
- pos.start = 0;
- pos.limit = textLength;
-
- utrans_transIncrementalUChars(f->fTranslit->translit,
- f->fTranslit->buffer, /* because we shifted */
- &textLength,
- f->fTranslit->capacity,
- &pos,
- &status);
-
- /* now: start/limit point to the transliterated text */
- /* Transliterated is [buffer..pos.start) */
- *count = pos.start;
- f->fTranslit->pos = pos.start;
- f->fTranslit->length = pos.limit;
-
- return f->fTranslit->buffer;
- }
- else
- {
- textLength = f->fTranslit->length;
- textLimit = f->fTranslit->length;
-
- utrans_transUChars(f->fTranslit->translit,
- f->fTranslit->buffer,
- &textLength,
- f->fTranslit->capacity,
- 0,
- &textLimit,
- &status);
-
- /* out: converted len */
- *count = textLimit;
-
- /* Set pointers to 0 */
- f->fTranslit->pos = 0;
- f->fTranslit->length = 0;
-
- return f->fTranslit->buffer;
- }
-}
-
-#endif
-
-void
-ufile_flush_translit(UFILE *f)
-{
-#if !UCONFIG_NO_TRANSLITERATION
- if((!f)||(!f->fTranslit))
- return;
-#endif
-
- u_file_write_flush(NULL, 0, f, FALSE, TRUE);
-}
-
-
-void
-ufile_flush_io(UFILE *f)
-{
- if((!f) || (!f->fFile)) {
- return; /* skip if no file */
- }
-
- u_file_write_flush(NULL, 0, f, TRUE, FALSE);
-}
-
-
-void
-ufile_close_translit(UFILE *f)
-{
-#if !UCONFIG_NO_TRANSLITERATION
- if((!f)||(!f->fTranslit))
- return;
-#endif
-
- ufile_flush_translit(f);
-
-#if !UCONFIG_NO_TRANSLITERATION
- if(f->fTranslit->translit)
- utrans_close(f->fTranslit->translit);
-
- if(f->fTranslit->buffer)
- {
- uprv_free(f->fTranslit->buffer);
- }
-
- uprv_free(f->fTranslit);
- f->fTranslit = NULL;
-#endif
-}
-
-
-/* Input/output */
-
-U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_fputs(const UChar *s,
- UFILE *f)
-{
- int32_t count = u_file_write(s, u_strlen(s), f);
- count += u_file_write(DELIMITERS, DELIMITERS_LEN, f);
- return count;
-}
-
-U_CAPI UChar32 U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_fputc(UChar32 uc,
- UFILE *f)
-{
- UChar buf[2];
- int32_t idx = 0;
- UBool isError = FALSE;
-
- U16_APPEND(buf, idx, UPRV_LENGTHOF(buf), uc, isError);
- if (isError) {
- return U_EOF;
- }
- return u_file_write(buf, idx, f) == idx ? uc : U_EOF;
-}
-
-
-U_CFUNC int32_t U_EXPORT2
-u_file_write_flush(const UChar *chars,
- int32_t count,
- UFILE *f,
- UBool flushIO,
- UBool flushTranslit)
-{
- /* Set up conversion parameters */
- UErrorCode status = U_ZERO_ERROR;
- const UChar *mySource = chars;
- const UChar *mySourceBegin;
- const UChar *mySourceEnd;
- char charBuffer[UFILE_CHARBUFFER_SIZE];
- char *myTarget = charBuffer;
- int32_t written = 0;
- int32_t numConverted = 0;
-
- if (count < 0) {
- count = u_strlen(chars);
- }
-
-#if !UCONFIG_NO_TRANSLITERATION
- if((f->fTranslit) && (f->fTranslit->translit))
- {
- /* Do the transliteration */
- mySource = u_file_translit(f, chars, &count, flushTranslit);
- }
-#endif
-
- /* Write to a string. */
- if (!f->fFile) {
- int32_t charsLeft = (int32_t)(f->str.fLimit - f->str.fPos);
- if (flushIO && charsLeft > count) {
- count++;
- }
- written = ufmt_min(count, charsLeft);
- u_strncpy(f->str.fPos, mySource, written);
- f->str.fPos += written;
- return written;
- }
-
- mySourceEnd = mySource + count;
-
- /* Perform the conversion in a loop */
- do {
- mySourceBegin = mySource; /* beginning location for this loop */
- status = U_ZERO_ERROR;
- if(f->fConverter != NULL) { /* We have a valid converter */
- ucnv_fromUnicode(f->fConverter,
- &myTarget,
- charBuffer + UFILE_CHARBUFFER_SIZE,
- &mySource,
- mySourceEnd,
- NULL,
- flushIO,
- &status);
- } else { /*weiv: do the invariant conversion */
- int32_t convertChars = (int32_t) (mySourceEnd - mySource);
- if (convertChars > UFILE_CHARBUFFER_SIZE) {
- convertChars = UFILE_CHARBUFFER_SIZE;
- status = U_BUFFER_OVERFLOW_ERROR;
- }
- u_UCharsToChars(mySource, myTarget, convertChars);
- mySource += convertChars;
- myTarget += convertChars;
- }
- numConverted = (int32_t)(myTarget - charBuffer);
-
- if (numConverted > 0) {
- /* write the converted bytes */
- fwrite(charBuffer,
- sizeof(char),
- numConverted,
- f->fFile);
-
- written += (int32_t) (mySource - mySourceBegin);
- }
- myTarget = charBuffer;
- }
- while(status == U_BUFFER_OVERFLOW_ERROR);
-
- /* return # of chars written */
- return written;
-}
-
-U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_file_write( const UChar *chars,
- int32_t count,
- UFILE *f)
-{
- return u_file_write_flush(chars,count,f,FALSE,FALSE);
-}
-
-
-/* private function used for buffering input */
-void
-ufile_fill_uchar_buffer(UFILE *f)
-{
- UErrorCode status;
- const char *mySource;
- const char *mySourceEnd;
- UChar *myTarget;
- int32_t bufferSize;
- int32_t maxCPBytes;
- int32_t bytesRead;
- int32_t availLength;
- int32_t dataSize;
- char charBuffer[UFILE_CHARBUFFER_SIZE];
- u_localized_string *str;
-
- if (f->fFile == NULL) {
- /* There is nothing to do. It's a string. */
- return;
- }
-
- str = &f->str;
- dataSize = (int32_t)(str->fLimit - str->fPos);
- if (f->fFileno == 0 && dataSize > 0) {
- /* Don't read from stdin too many times. There is still some data. */
- return;
- }
-
- /* shift the buffer if it isn't empty */
- if(dataSize != 0) {
- u_memmove(f->fUCBuffer, str->fPos, dataSize); /* not accessing beyond memory */
- }
-
-
- /* record how much buffer space is available */
- availLength = UFILE_UCHARBUFFER_SIZE - dataSize;
-
- /* Determine the # of codepage bytes needed to fill our UChar buffer */
- /* weiv: if converter is NULL, we use invariant converter with charwidth = 1)*/
- maxCPBytes = availLength / (f->fConverter!=NULL?(2*ucnv_getMinCharSize(f->fConverter)):1);
-
- /* Read in the data to convert */
- if (f->fFileno == 0) {
- /* Special case. Read from stdin one line at a time. */
- char *retStr = fgets(charBuffer, ufmt_min(maxCPBytes, UFILE_CHARBUFFER_SIZE), f->fFile);
- bytesRead = (int32_t)(retStr ? uprv_strlen(charBuffer) : 0);
- }
- else {
- /* A normal file */
- bytesRead = (int32_t)fread(charBuffer,
- sizeof(char),
- ufmt_min(maxCPBytes, UFILE_CHARBUFFER_SIZE),
- f->fFile);
- }
-
- /* Set up conversion parameters */
- status = U_ZERO_ERROR;
- mySource = charBuffer;
- mySourceEnd = charBuffer + bytesRead;
- myTarget = f->fUCBuffer + dataSize;
- bufferSize = UFILE_UCHARBUFFER_SIZE;
-
- if(f->fConverter != NULL) { /* We have a valid converter */
- /* Perform the conversion */
- ucnv_toUnicode(f->fConverter,
- &myTarget,
- f->fUCBuffer + bufferSize,
- &mySource,
- mySourceEnd,
- NULL,
- (UBool)(feof(f->fFile) != 0),
- &status);
-
- } else { /*weiv: do the invariant conversion */
- u_charsToUChars(mySource, myTarget, bytesRead);
- myTarget += bytesRead;
- }
-
- /* update the pointers into our array */
- str->fPos = str->fBuffer;
- str->fLimit = myTarget;
-}
-
-U_CAPI UChar* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_fgets(UChar *s,
- int32_t n,
- UFILE *f)
-{
- int32_t dataSize;
- int32_t count;
- UChar *alias;
- const UChar *limit;
- UChar *sItr;
- UChar currDelim = 0;
- u_localized_string *str;
-
- if (n <= 0) {
- /* Caller screwed up. We need to write the null terminatior. */
- return NULL;
- }
-
- /* fill the buffer if needed */
- str = &f->str;
- if (str->fPos >= str->fLimit) {
- ufile_fill_uchar_buffer(f);
- }
-
- /* subtract 1 from n to compensate for the terminator */
- --n;
-
- /* determine the amount of data in the buffer */
- dataSize = (int32_t)(str->fLimit - str->fPos);
-
- /* if 0 characters were left, return 0 */
- if (dataSize == 0)
- return NULL;
-
- /* otherwise, iteratively fill the buffer and copy */
- count = 0;
- sItr = s;
- currDelim = 0;
- while (dataSize > 0 && count < n) {
- alias = str->fPos;
-
- /* Find how much to copy */
- if (dataSize < (n - count)) {
- limit = str->fLimit;
- }
- else {
- limit = alias + (n - count);
- }
-
- if (!currDelim) {
- /* Copy UChars until we find the first occurrence of a delimiter character */
- while (alias < limit && !IS_FIRST_STRING_DELIMITER(*alias)) {
- count++;
- *(sItr++) = *(alias++);
- }
- /* Preserve the newline */
- if (alias < limit && IS_FIRST_STRING_DELIMITER(*alias)) {
- if (CAN_HAVE_COMBINED_STRING_DELIMITER(*alias)) {
- currDelim = *alias;
- }
- else {
- currDelim = 1; /* This isn't a newline, but it's used to say
- that we should break later. We've checked all
- possible newline combinations even across buffer
- boundaries. */
- }
- count++;
- *(sItr++) = *(alias++);
- }
- }
- /* If we have a CRLF combination, preserve that too. */
- if (alias < limit) {
- if (currDelim && IS_COMBINED_STRING_DELIMITER(currDelim, *alias)) {
- count++;
- *(sItr++) = *(alias++);
- }
- currDelim = 1; /* This isn't a newline, but it's used to say
- that we should break later. We've checked all
- possible newline combinations even across buffer
- boundaries. */
- }
-
- /* update the current buffer position */
- str->fPos = alias;
-
- /* if we found a delimiter */
- if (currDelim == 1) {
- /* break out */
- break;
- }
-
- /* refill the buffer */
- ufile_fill_uchar_buffer(f);
-
- /* determine the amount of data in the buffer */
- dataSize = (int32_t)(str->fLimit - str->fPos);
- }
-
- /* add the terminator and return s */
- *sItr = 0x0000;
- return s;
-}
-
-U_CFUNC UBool U_EXPORT2
-ufile_getch(UFILE *f, UChar *ch)
-{
- UBool isValidChar = FALSE;
-
- *ch = U_EOF;
- /* if we have an available character in the buffer, return it */
- if(f->str.fPos < f->str.fLimit){
- *ch = *(f->str.fPos)++;
- isValidChar = TRUE;
- }
- else {
- /* otherwise, fill the buffer and return the next character */
- if(f->str.fPos >= f->str.fLimit) {
- ufile_fill_uchar_buffer(f);
- }
- if(f->str.fPos < f->str.fLimit) {
- *ch = *(f->str.fPos)++;
- isValidChar = TRUE;
- }
- }
- return isValidChar;
-}
-
-U_CAPI UChar U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_fgetc(UFILE *f)
-{
- UChar ch;
- ufile_getch(f, &ch);
- return ch;
-}
-
-U_CFUNC UBool U_EXPORT2
-ufile_getch32(UFILE *f, UChar32 *c32)
-{
- UBool isValidChar = FALSE;
- u_localized_string *str;
-
- *c32 = U_EOF;
-
- /* Fill the buffer if it is empty */
- str = &f->str;
- if (f && str->fPos + 1 >= str->fLimit) {
- ufile_fill_uchar_buffer(f);
- }
-
- /* Get the next character in the buffer */
- if (str->fPos < str->fLimit) {
- *c32 = *(str->fPos)++;
- if (U_IS_LEAD(*c32)) {
- if (str->fPos < str->fLimit) {
- UChar c16 = *(str->fPos)++;
- *c32 = U16_GET_SUPPLEMENTARY(*c32, c16);
- isValidChar = TRUE;
- }
- else {
- *c32 = U_EOF;
- }
- }
- else {
- isValidChar = TRUE;
- }
- }
-
- return isValidChar;
-}
-
-U_CAPI UChar32 U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_fgetcx(UFILE *f)
-{
- UChar32 ch;
- ufile_getch32(f, &ch);
- return ch;
-}
-
-U_CAPI UChar32 U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_fungetc(UChar32 ch,
- UFILE *f)
-{
- u_localized_string *str;
-
- str = &f->str;
-
- /* if we're at the beginning of the buffer, sorry! */
- if (str->fPos == str->fBuffer
- || (U_IS_LEAD(ch) && (str->fPos - 1) == str->fBuffer))
- {
- ch = U_EOF;
- }
- else {
- /* otherwise, put the character back */
- /* Remember, read them back on in the reverse order. */
- if (U_IS_LEAD(ch)) {
- if (*--(str->fPos) != U16_TRAIL(ch)
- || *--(str->fPos) != U16_LEAD(ch))
- {
- ch = U_EOF;
- }
- }
- else if (*--(str->fPos) != ch) {
- ch = U_EOF;
- }
- }
- return ch;
-}
-
-U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
-u_file_read( UChar *chars,
- int32_t count,
- UFILE *f)
-{
- int32_t dataSize;
- int32_t read = 0;
- u_localized_string *str = &f->str;
-
- do {
-
- /* determine the amount of data in the buffer */
- dataSize = (int32_t)(str->fLimit - str->fPos);
- if (dataSize <= 0) {
- /* fill the buffer */
- ufile_fill_uchar_buffer(f);
- dataSize = (int32_t)(str->fLimit - str->fPos);
- }
-
- /* Make sure that we don't read too much */
- if (dataSize > (count - read)) {
- dataSize = count - read;
- }
-
- /* copy the current data in the buffer */
- memcpy(chars + read, str->fPos, dataSize * sizeof(UChar));
-
- /* update number of items read */
- read += dataSize;
-
- /* update the current buffer position */
- str->fPos += dataSize;
- }
- while (dataSize != 0 && read < count);
-
- return read;
-}
-#endif
+ u_UCharsToChars(mySource, myTarget, convertChars);
+ mySource += convertChars;
+ myTarget += convertChars;
+ }
+ numConverted = (int32_t)(myTarget - charBuffer);
+
+ if (numConverted > 0) {
+ /* write the converted bytes */
+ fwrite(charBuffer,
+ sizeof(char),
+ numConverted,
+ f->fFile);
+
+ written += (int32_t) (mySource - mySourceBegin);
+ }
+ myTarget = charBuffer;
+ }
+ while(status == U_BUFFER_OVERFLOW_ERROR);
+
+ /* return # of chars written */
+ return written;
+}
+
+U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_file_write( const UChar *chars,
+ int32_t count,
+ UFILE *f)
+{
+ return u_file_write_flush(chars,count,f,FALSE,FALSE);
+}
+
+
+/* private function used for buffering input */
+void
+ufile_fill_uchar_buffer(UFILE *f)
+{
+ UErrorCode status;
+ const char *mySource;
+ const char *mySourceEnd;
+ UChar *myTarget;
+ int32_t bufferSize;
+ int32_t maxCPBytes;
+ int32_t bytesRead;
+ int32_t availLength;
+ int32_t dataSize;
+ char charBuffer[UFILE_CHARBUFFER_SIZE];
+ u_localized_string *str;
+
+ if (f->fFile == NULL) {
+ /* There is nothing to do. It's a string. */
+ return;
+ }
+
+ str = &f->str;
+ dataSize = (int32_t)(str->fLimit - str->fPos);
+ if (f->fFileno == 0 && dataSize > 0) {
+ /* Don't read from stdin too many times. There is still some data. */
+ return;
+ }
+
+ /* shift the buffer if it isn't empty */
+ if(dataSize != 0) {
+ u_memmove(f->fUCBuffer, str->fPos, dataSize); /* not accessing beyond memory */
+ }
+
+
+ /* record how much buffer space is available */
+ availLength = UFILE_UCHARBUFFER_SIZE - dataSize;
+
+ /* Determine the # of codepage bytes needed to fill our UChar buffer */
+ /* weiv: if converter is NULL, we use invariant converter with charwidth = 1)*/
+ maxCPBytes = availLength / (f->fConverter!=NULL?(2*ucnv_getMinCharSize(f->fConverter)):1);
+
+ /* Read in the data to convert */
+ if (f->fFileno == 0) {
+ /* Special case. Read from stdin one line at a time. */
+ char *retStr = fgets(charBuffer, ufmt_min(maxCPBytes, UFILE_CHARBUFFER_SIZE), f->fFile);
+ bytesRead = (int32_t)(retStr ? uprv_strlen(charBuffer) : 0);
+ }
+ else {
+ /* A normal file */
+ bytesRead = (int32_t)fread(charBuffer,
+ sizeof(char),
+ ufmt_min(maxCPBytes, UFILE_CHARBUFFER_SIZE),
+ f->fFile);
+ }
+
+ /* Set up conversion parameters */
+ status = U_ZERO_ERROR;
+ mySource = charBuffer;
+ mySourceEnd = charBuffer + bytesRead;
+ myTarget = f->fUCBuffer + dataSize;
+ bufferSize = UFILE_UCHARBUFFER_SIZE;
+
+ if(f->fConverter != NULL) { /* We have a valid converter */
+ /* Perform the conversion */
+ ucnv_toUnicode(f->fConverter,
+ &myTarget,
+ f->fUCBuffer + bufferSize,
+ &mySource,
+ mySourceEnd,
+ NULL,
+ (UBool)(feof(f->fFile) != 0),
+ &status);
+
+ } else { /*weiv: do the invariant conversion */
+ u_charsToUChars(mySource, myTarget, bytesRead);
+ myTarget += bytesRead;
+ }
+
+ /* update the pointers into our array */
+ str->fPos = str->fBuffer;
+ str->fLimit = myTarget;
+}
+
+U_CAPI UChar* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_fgets(UChar *s,
+ int32_t n,
+ UFILE *f)
+{
+ int32_t dataSize;
+ int32_t count;
+ UChar *alias;
+ const UChar *limit;
+ UChar *sItr;
+ UChar currDelim = 0;
+ u_localized_string *str;
+
+ if (n <= 0) {
+ /* Caller screwed up. We need to write the null terminatior. */
+ return NULL;
+ }
+
+ /* fill the buffer if needed */
+ str = &f->str;
+ if (str->fPos >= str->fLimit) {
+ ufile_fill_uchar_buffer(f);
+ }
+
+ /* subtract 1 from n to compensate for the terminator */
+ --n;
+
+ /* determine the amount of data in the buffer */
+ dataSize = (int32_t)(str->fLimit - str->fPos);
+
+ /* if 0 characters were left, return 0 */
+ if (dataSize == 0)
+ return NULL;
+
+ /* otherwise, iteratively fill the buffer and copy */
+ count = 0;
+ sItr = s;
+ currDelim = 0;
+ while (dataSize > 0 && count < n) {
+ alias = str->fPos;
+
+ /* Find how much to copy */
+ if (dataSize < (n - count)) {
+ limit = str->fLimit;
+ }
+ else {
+ limit = alias + (n - count);
+ }
+
+ if (!currDelim) {
+ /* Copy UChars until we find the first occurrence of a delimiter character */
+ while (alias < limit && !IS_FIRST_STRING_DELIMITER(*alias)) {
+ count++;
+ *(sItr++) = *(alias++);
+ }
+ /* Preserve the newline */
+ if (alias < limit && IS_FIRST_STRING_DELIMITER(*alias)) {
+ if (CAN_HAVE_COMBINED_STRING_DELIMITER(*alias)) {
+ currDelim = *alias;
+ }
+ else {
+ currDelim = 1; /* This isn't a newline, but it's used to say
+ that we should break later. We've checked all
+ possible newline combinations even across buffer
+ boundaries. */
+ }
+ count++;
+ *(sItr++) = *(alias++);
+ }
+ }
+ /* If we have a CRLF combination, preserve that too. */
+ if (alias < limit) {
+ if (currDelim && IS_COMBINED_STRING_DELIMITER(currDelim, *alias)) {
+ count++;
+ *(sItr++) = *(alias++);
+ }
+ currDelim = 1; /* This isn't a newline, but it's used to say
+ that we should break later. We've checked all
+ possible newline combinations even across buffer
+ boundaries. */
+ }
+
+ /* update the current buffer position */
+ str->fPos = alias;
+
+ /* if we found a delimiter */
+ if (currDelim == 1) {
+ /* break out */
+ break;
+ }
+
+ /* refill the buffer */
+ ufile_fill_uchar_buffer(f);
+
+ /* determine the amount of data in the buffer */
+ dataSize = (int32_t)(str->fLimit - str->fPos);
+ }
+
+ /* add the terminator and return s */
+ *sItr = 0x0000;
+ return s;
+}
+
+U_CFUNC UBool U_EXPORT2
+ufile_getch(UFILE *f, UChar *ch)
+{
+ UBool isValidChar = FALSE;
+
+ *ch = U_EOF;
+ /* if we have an available character in the buffer, return it */
+ if(f->str.fPos < f->str.fLimit){
+ *ch = *(f->str.fPos)++;
+ isValidChar = TRUE;
+ }
+ else {
+ /* otherwise, fill the buffer and return the next character */
+ if(f->str.fPos >= f->str.fLimit) {
+ ufile_fill_uchar_buffer(f);
+ }
+ if(f->str.fPos < f->str.fLimit) {
+ *ch = *(f->str.fPos)++;
+ isValidChar = TRUE;
+ }
+ }
+ return isValidChar;
+}
+
+U_CAPI UChar U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_fgetc(UFILE *f)
+{
+ UChar ch;
+ ufile_getch(f, &ch);
+ return ch;
+}
+
+U_CFUNC UBool U_EXPORT2
+ufile_getch32(UFILE *f, UChar32 *c32)
+{
+ UBool isValidChar = FALSE;
+ u_localized_string *str;
+
+ *c32 = U_EOF;
+
+ /* Fill the buffer if it is empty */
+ str = &f->str;
+ if (f && str->fPos + 1 >= str->fLimit) {
+ ufile_fill_uchar_buffer(f);
+ }
+
+ /* Get the next character in the buffer */
+ if (str->fPos < str->fLimit) {
+ *c32 = *(str->fPos)++;
+ if (U_IS_LEAD(*c32)) {
+ if (str->fPos < str->fLimit) {
+ UChar c16 = *(str->fPos)++;
+ *c32 = U16_GET_SUPPLEMENTARY(*c32, c16);
+ isValidChar = TRUE;
+ }
+ else {
+ *c32 = U_EOF;
+ }
+ }
+ else {
+ isValidChar = TRUE;
+ }
+ }
+
+ return isValidChar;
+}
+
+U_CAPI UChar32 U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_fgetcx(UFILE *f)
+{
+ UChar32 ch;
+ ufile_getch32(f, &ch);
+ return ch;
+}
+
+U_CAPI UChar32 U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_fungetc(UChar32 ch,
+ UFILE *f)
+{
+ u_localized_string *str;
+
+ str = &f->str;
+
+ /* if we're at the beginning of the buffer, sorry! */
+ if (str->fPos == str->fBuffer
+ || (U_IS_LEAD(ch) && (str->fPos - 1) == str->fBuffer))
+ {
+ ch = U_EOF;
+ }
+ else {
+ /* otherwise, put the character back */
+ /* Remember, read them back on in the reverse order. */
+ if (U_IS_LEAD(ch)) {
+ if (*--(str->fPos) != U16_TRAIL(ch)
+ || *--(str->fPos) != U16_LEAD(ch))
+ {
+ ch = U_EOF;
+ }
+ }
+ else if (*--(str->fPos) != ch) {
+ ch = U_EOF;
+ }
+ }
+ return ch;
+}
+
+U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
+u_file_read( UChar *chars,
+ int32_t count,
+ UFILE *f)
+{
+ int32_t dataSize;
+ int32_t read = 0;
+ u_localized_string *str = &f->str;
+
+ do {
+
+ /* determine the amount of data in the buffer */
+ dataSize = (int32_t)(str->fLimit - str->fPos);
+ if (dataSize <= 0) {
+ /* fill the buffer */
+ ufile_fill_uchar_buffer(f);
+ dataSize = (int32_t)(str->fLimit - str->fPos);
+ }
+
+ /* Make sure that we don't read too much */
+ if (dataSize > (count - read)) {
+ dataSize = count - read;
+ }
+
+ /* copy the current data in the buffer */
+ memcpy(chars + read, str->fPos, dataSize * sizeof(UChar));
+
+ /* update number of items read */
+ read += dataSize;
+
+ /* update the current buffer position */
+ str->fPos += dataSize;
+ }
+ while (dataSize != 0 && read < count);
+
+ return read;
+}
+#endif
diff --git a/contrib/libs/icu/io/ustream.cpp b/contrib/libs/icu/io/ustream.cpp
index 8e1d733c65..51676ea0f5 100644
--- a/contrib/libs/icu/io/ustream.cpp
+++ b/contrib/libs/icu/io/ustream.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
@@ -123,7 +123,7 @@ operator>>(STD_ISTREAM& stream, UnicodeString& str)
/* Was the character consumed? */
if (us != uBuffer) {
/* Reminder: ibm-1390 & JISX0213 can output 2 Unicode code points */
- int32_t uBuffSize = static_cast<int32_t>(us-uBuffer);
+ int32_t uBuffSize = static_cast<int32_t>(us-uBuffer);
int32_t uBuffIdx = 0;
while (uBuffIdx < uBuffSize) {
U16_NEXT(uBuffer, uBuffIdx, uBuffSize, ch32);
diff --git a/contrib/libs/icu/license.html b/contrib/libs/icu/license.html
index 1bfee73587..2484672667 100644
--- a/contrib/libs/icu/license.html
+++ b/contrib/libs/icu/license.html
@@ -1,18 +1,18 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
-<title>ICU License - moved to LICENSE</title>
-</head>
-
-<body BGCOLOR="#ffffff">
- <p>
- The ICU license is now in plain text format, see <a href="./LICENSE">LICENSE</a>.
-Update links and software appropriately.
- </p>
- <i>© 2016 and later: Unicode, Inc. and others. License &amp; terms of use: http://www.unicode.org/copyright.html</i>
- <i>© 1995-2016 International Business Machines Corporation and others</i>
-
-</body>
-</html>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+<title>ICU License - moved to LICENSE</title>
+</head>
+
+<body BGCOLOR="#ffffff">
+ <p>
+ The ICU license is now in plain text format, see <a href="./LICENSE">LICENSE</a>.
+Update links and software appropriately.
+ </p>
+ <i>© 2016 and later: Unicode, Inc. and others. License &amp; terms of use: http://www.unicode.org/copyright.html</i>
+ <i>© 1995-2016 International Business Machines Corporation and others</i>
+
+</body>
+</html>
diff --git a/contrib/libs/icu/readme.html b/contrib/libs/icu/readme.html
index 2af79cb7f7..08d52f87b6 100644
--- a/contrib/libs/icu/readme.html
+++ b/contrib/libs/icu/readme.html
@@ -1,1914 +1,1914 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
- <head>
- <title>ReadMe for ICU 67.1</title>
- <meta name="COPYRIGHT" content=
- "Copyright (C) 2016 and later: Unicode, Inc. and others. License &amp; terms of use: http://www.unicode.org/copyright.html"/>
- <!-- meta name="COPYRIGHT" content=
- "Copyright (c) 1997-2016 IBM Corporation and others. All Rights Reserved." / -->
- <meta name="KEYWORDS" content=
- "ICU; International Components for Unicode; ICU4C; what's new; readme; read me; introduction; downloads; downloading; building; installation;" />
- <meta name="DESCRIPTION" content=
- "The introduction to the International Components for Unicode with instructions on building, installation, usage and other information about ICU." />
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <link type="text/css" href="./icu4c.css" rel="stylesheet"/>
- </head>
-
-<!--
- classes to use with the "body" -
- draft - if the release note is itself a draft (May be combined with the other two)
- rc - if the release note is a release candidate
- milestone - if the release note is a milestone release
--->
-
- <body>
- <!-- <body class="rc"> -->
- <p class="only-draft"><b>Note:</b> This is a draft readme.</p>
-
- <h1>
- <span class="only-draft">DRAFT</span>
- International Components for Unicode<br/>
- <span class="only-rc">Release Candidate</span>
- <!-- <span class="only-milestone">(Milestone Release)</span> -->
- <span class="only-milestone">(Preview Release)</span>
- <abbr title="International Components for Unicode">ICU</abbr> 67.1 ReadMe
- </h1>
-
- <!-- Most of the time we shouldn't need to comment/uncomment this paragraph, just change the body class -->
- <!-- <p class="note only-milestone">This is a development milestone release of ICU
- This milestone is intended for those wishing to get an early look at new features and API changes.
- It is not recommended for production use.</p> -->
- <p class="note only-milestone">This is a preview release of ICU.
- It is not recommended for production use.</p>
-
- <!-- Shouldn't need to comment/uncomment this paragraph, just change the body class -->
- <p class="note only-rc">This is a release candidate version of ICU4C.
- It is not recommended for production use.</p>
-
- <p>Last updated: 2020-Mar-25<br/>
- Copyright &copy; 2016 and later: Unicode, Inc. and others. License &amp; terms of use:
- <a href="http://www.unicode.org/copyright.html">http://www.unicode.org/copyright.html</a><br/>
- Copyright &copy; 1997-2016 International Business Machines Corporation and others.
- All Rights Reserved.</p>
- <!-- Remember that there is a copyright at the end too -->
- <hr/>
-
- <h2 class="TOC">Table of Contents</h2>
-
- <ul class="TOC">
- <li><a href="#Introduction">Introduction</a></li>
-
- <li><a href="#GettingStarted">Getting Started</a></li>
-
- <li><a href="#News">What Is New In This Release?</a></li>
-
- <li><a href="#Download">How To Download the Source Code</a></li>
-
- <li><a href="#SourceCode">ICU Source Code Organization</a></li>
-
- <li>
- <a href="#HowToBuild">How To Build And Install ICU</a>
-
- <ul >
- <li><a href="#RecBuild">Recommended Build Options</a></li>
-
- <li><a href="#UserConfig">User-Configurable Settings</a></li>
-
- <li><a href="#HowToBuildWindows">Windows</a></li>
-
- <li><a href="#HowToBuildCygwin">Cygwin</a></li>
-
- <li><a href="#HowToBuildUNIX">UNIX</a></li>
-
- <li><a href="#HowToBuildZOS">z/OS (os/390)</a></li>
-
- <li><a href="#HowToBuildOS400">IBM i family (IBM i, i5/OS, OS/400)</a></li>
-
- <li><a href="#HowToCrossCompileICU">How to Cross Compile ICU</a></li>
- </ul>
- </li>
-
-
- <li><a href="#HowToPackage">How To Package ICU</a></li>
-
- <li>
- <a href="#ImportantNotes">Important Notes About Using ICU</a>
-
- <ul >
- <li><a href="#ImportantNotesMultithreaded">Using ICU in a Multithreaded
- Environment</a></li>
-
- <li><a href="#ImportantNotesWindows">Windows Platform</a></li>
-
- <li><a href="#ImportantNotesUNIX">UNIX Type Platforms</a></li>
- </ul>
- </li>
-
- <li>
- <a href="#PlatformDependencies">Platform Dependencies</a>
-
- <ul >
- <li><a href="#PlatformDependenciesNew">Porting To A New
- Platform</a></li>
-
- <li><a href="#PlatformDependenciesImpl">Platform Dependent
- Implementations</a></li>
- </ul>
- </li>
- </ul>
- <hr />
-
- <h2><a name="Introduction" href="#Introduction" id=
- "Introduction">Introduction</a></h2>
-
- <p>Today's software market is a global one in which it is desirable to
- develop and maintain one application (single source/single binary) that
- supports a wide variety of languages. The International Components for
- Unicode (ICU) libraries provide robust and full-featured Unicode services on
- a wide variety of platforms to help this design goal. The ICU libraries
- provide support for:</p>
-
- <ul>
- <li>The latest version of the Unicode standard</li>
-
- <li>Character set conversions with support for over 220 codepages</li>
-
- <li>Locale data for more than 300 locales</li>
-
- <li>Language sensitive text collation (sorting) and searching based on the
- Unicode Collation Algorithm (=ISO 14651)</li>
-
- <li>Regular expression matching and Unicode sets</li>
-
- <li>Transformations for normalization, upper/lowercase, script
- transliterations (50+ pairs)</li>
-
- <li>Resource bundles for storing and accessing localized information</li>
-
- <li>Date/Number/Message formatting and parsing of culture specific
- input/output formats</li>
-
- <li>Calendar specific date and time manipulation</li>
-
- <li>Text boundary analysis for finding characters, word and sentence
- boundaries</li>
- </ul>
-
- <p>ICU has a sister project ICU4J that extends the internationalization
- capabilities of Java to a level similar to ICU. The ICU C/C++ project is also
- called ICU4C when a distinction is necessary.</p>
-
- <h2><a name="GettingStarted" href="#GettingStarted" id=
- "GettingStarted">Getting started</a></h2>
-
- <p>This document describes how to build and install ICU on your machine. For
- other information about ICU please see the following table of links.<br />
- The ICU homepage also links to related information about writing
- internationalized software.</p>
-
- <table class="docTable" summary="These are some useful links regarding ICU and internationalization in general.">
- <caption>
- Here are some useful links regarding ICU and internationalization in
- general.
- </caption>
-
- <tr>
- <td>ICU, ICU4C &amp; ICU4J Homepage</td>
-
- <td><a href=
- "http://icu-project.org/">http://icu-project.org/</a></td>
- </tr>
-
- <tr>
- <td>FAQ - Frequently Asked Questions about ICU</td>
-
- <td><a href=
- "http://userguide.icu-project.org/icufaq">http://userguide.icu-project.org/icufaq</a></td>
- </tr>
-
- <tr>
- <td>ICU User's Guide</td>
-
- <td><a href=
- "http://userguide.icu-project.org/">http://userguide.icu-project.org/</a></td>
- </tr>
-
- <tr>
- <td>How To Use ICU</td>
-
- <td><a href="http://userguide.icu-project.org/howtouseicu">http://userguide.icu-project.org/howtouseicu</a></td>
- </tr>
-
- <tr>
- <td>Download ICU Releases</td>
-
- <td><a href=
- "http://site.icu-project.org/download">http://site.icu-project.org/download</a></td>
- </tr>
-
- <tr>
- <td>ICU4C API Documentation Online</td>
-
- <td><a href=
- "http://icu-project.org/apiref/icu4c/">http://icu-project.org/apiref/icu4c/</a></td>
- </tr>
-
- <tr>
- <td>Online ICU Demos</td>
-
- <td><a href=
- "http://demo.icu-project.org/icu-bin/icudemos">http://demo.icu-project.org/icu-bin/icudemos</a></td>
- </tr>
-
- <tr>
- <td>Contacts and Bug Reports/Feature Requests</td>
-
- <td><a href=
- "http://site.icu-project.org/contacts">http://site.icu-project.org/contacts</a></td>
- </tr>
- </table>
-
- <p><strong>Important:</strong> Please make sure you understand the <a href=
- "http://source.icu-project.org/repos/icu/trunk/icu4c/LICENSE">Copyright and License Information</a>.</p>
-
-
- <h2><a name="News" href="#News" id="News">What Is New In This Release?</a></h2>
-
- <p>See the <a href="http://site.icu-project.org/download/67">ICU 67 download page</a>
- for more information on this release, including any other changes, bug fixes, known issues,
- changes to supported platforms and build environments,
- and migration issues for existing applications migrating from previous ICU releases.</p>
-
- <p>See the <a href="APIChangeReport.html">API Change Report</a> for a complete list of
- APIs added, removed, or changed in this release.</p>
-
- <p><a name="RecentPreviousChanges" id="RecentPreviousChanges"></a>For
- changes in previous releases, see the
- main <a href="http://site.icu-project.org/download">ICU download page</a>
- with its version-specific subpages.</p>
-
-
- <h2><a name="Download" href="#Download" id="Download">How To Download the
- Source Code</a></h2>
-
- <p>There are two ways to download ICU releases:</p>
-
- <ul>
- <li><strong>Official Release Snapshot:</strong><br />
- If you want to use ICU (as opposed to developing it), you should download
- an official packaged version of the ICU source code. These versions are
- tested more thoroughly than day-to-day development builds of the system,
- and they are packaged in zip and tar files for convenient download. These
- packaged files can be found at <a href=
- "http://site.icu-project.org/download">http://site.icu-project.org/download</a>.<br />
- The packaged snapshots are named <strong>icu-nnnn.zip</strong> or
- <strong>icu-nnnn.tgz</strong>, where nnnn is the version number. The .zip
- file is used for Windows platforms, while the .tgz file is preferred on
- most other platforms.<br />
- Please unzip this file. </li>
-
- <li><strong>GitHub Source Repository:</strong><br />
- If you are interested in developing features, patches, or bug fixes for
- ICU, you should probably be working with the latest version of the ICU
- source code. You will need to clone and checkout the code from our GitHub repository to
- ensure that you have the most recent version of all of the files. See our
- <a href="http://site.icu-project.org/repository">source
- repository</a> for details.</li>
- </ul>
-
- <h2><a name="SourceCode" href="#SourceCode" id="SourceCode">ICU Source Code
- Organization</a></h2>
-
- <p>In the descriptions below, <strong><i>&lt;ICU&gt;</i></strong> is the full
- path name of the ICU directory (the top level directory from the distribution
- archives) in your file system. You can also view the <a href=
- "http://userguide.icu-project.org/design">ICU Architectural
- Design</a> section of the User's Guide to see which libraries you need for
- your software product. You need at least the data (<code>[lib]icudt</code>)
- and the common (<code>[lib]icuuc</code>) libraries in order to use ICU.</p>
-
- <table class="docTable" summary="The following files describe the code drop.">
- <caption>
- The following files describe the code drop.
- </caption>
-
- <tr>
- <th scope="col">File</th>
-
- <th scope="col">Description</th>
- </tr>
-
- <tr>
- <td>readme.html</td>
-
- <td>Describes the International Components for Unicode (this file)</td>
- </tr>
-
- <tr>
- <td>LICENSE</td>
-
- <td>Contains the text of the ICU license</td>
- </tr>
- </table>
-
- <p><br />
- </p>
-
- <table class="docTable" summary=
- "The following directories contain source code and data files.">
- <caption>
- The following directories contain source code and data files.
- </caption>
-
- <tr>
- <th scope="col">Directory</th>
-
- <th scope="col">Description</th>
- </tr>
-
- <tr>
- <td><i>&lt;ICU&gt;</i>/source/<b>common</b>/</td>
-
- <td>The core Unicode and support functionality, such as resource bundles,
- character properties, locales, codepage conversion, normalization,
- Unicode properties, Locale, and UnicodeString.</td>
- </tr>
-
- <tr>
- <td><i>&lt;ICU&gt;</i>/source/<b>i18n</b>/</td>
-
- <td>Modules in i18n are generally the more data-driven, that is to say
- resource bundle driven, components. These deal with higher-level
- internationalization issues such as formatting, collation, text break
- analysis, and transliteration.</td>
- </tr>
-
- <tr>
- <td><i>&lt;ICU&gt;</i>/source/<b>layoutex</b>/</td>
-
- <td>Contains the ICU paragraph layout engine.</td>
- </tr>
-
- <tr>
- <td><i>&lt;ICU&gt;</i>/source/<b>io</b>/</td>
-
- <td>Contains the ICU I/O library.</td>
- </tr>
-
- <tr>
- <td><i>&lt;ICU&gt;</i>/source/<b>data</b>/</td>
-
- <td>
- <p>This directory contains the source data in text format, which is
- compiled into binary form during the ICU build process. It contains
- several subdirectories, in which the data files are grouped by
- function. Note that the build process must be run again after any
- changes are made to this directory.</p>
-
- <p>If some of the following directories are missing, it's probably
- because you got an official download. If you need the data source files
- for customization, then please download the complete ICU source code from <a
- href="http://site.icu-project.org/repository">the ICU repository</a>.</p>
-
- <ul>
- <li><b>in/</b> A directory that contains a pre-built data library for
- ICU. A standard source code package will contain this file without
- several of the following directories. This is to simplify the build
- process for the majority of users and to reduce platform porting
- issues.</li>
-
- <li><b>brkitr/</b> Data files for character, word, sentence, title
- casing and line boundary analysis.</li>
-
- <li><b>coll/</b> Data for collation tailorings. The makefile
- <b>colfiles.mk</b> contains the list of resource bundle files.</li>
-
- <li><b>locales/</b> These .txt files contain ICU language and
- culture-specific localization data. Two special bundles are
- <b>root</b>, which is the fallback data and parent of other bundles,
- and <b>index</b>, which contains a list of installed bundles. The
- makefile <b>resfiles.mk</b> contains the list of resource bundle
- files. Some of the locale data is split out into the type-specific
- directories curr, lang, region, unit, and zone, described below.</li>
-
- <li><b>curr/</b> Locale data for currency symbols and names (including
- plural forms), with its own makefile <b>resfiles.mk</b>.</li>
-
- <li><b>lang/</b> Locale data for names of languages, scripts, and locale
- key names and values, with its own makefile <b>resfiles.mk</b>.</li>
-
- <li><b>region/</b> Locale data for names of regions, with its own
- makefile <b>resfiles.mk</b>.</li>
-
- <li><b>unit/</b> Locale data for measurement unit patterns and names,
- with its own makefile <b>resfiles.mk</b>.</li>
-
- <li><b>zone/</b> Locale data for time zone names, with its own
- makefile <b>resfiles.mk</b>.</li>
-
- <li><b>mappings/</b> Here are the code page converter tables. These
- .ucm files contain mappings to and from Unicode. These are compiled
- into .cnv files. <b>convrtrs.txt</b> is the alias mapping table from
- various converter name formats to ICU internal format and vice versa.
- It produces cnvalias.icu. The makefiles <b>ucmfiles.mk,
- ucmcore.mk,</b> and <b>ucmebcdic.mk</b> contain the list of
- converters to be built.</li>
-
- <li><b>translit/</b> This directory contains transliterator rules as
- resource bundles, a makefile <b>trnsfiles.mk</b> containing the list
- of installed system translitaration files, and as well the special
- bundle <b>translit_index</b> which lists the system transliterator
- aliases.</li>
-
- <li><b>unidata/</b> This directory contains the Unicode data files.
- Please see <a href=
- "http://www.unicode.org/">http://www.unicode.org/</a> for more
- information.</li>
-
- <li><b>misc/</b> The misc directory contains other data files which
- did not fit into the above categories, including time zone
- information, region-specific data, and other data derived from CLDR
- supplemental data.</li>
-
- <li><b>out/</b> This directory contains the assembled memory mapped
- files.</li>
-
- <li><b>out/build/</b> This directory contains intermediate (compiled)
- files, such as .cnv, .res, etc.</li>
- </ul>
-
- <p>If you are creating a special ICU build, you can set the ICU_DATA
- environment variable to the out/ or the out/build/ directories, but
- this is generally discouraged because most people set it incorrectly.
- You can view the <a href=
- "http://userguide.icu-project.org/icudata">ICU Data
- Management</a> section of the ICU User's Guide for details.</p>
- </td>
- </tr>
-
- <tr>
- <td><i>&lt;ICU&gt;</i>/source/test/<b>intltest</b>/</td>
-
- <td>A test suite including all C++ APIs. For information about running
- the test suite, see the build instructions specific to your platform
- later in this document.</td>
- </tr>
-
- <tr>
- <td><i>&lt;ICU&gt;</i>/source/test/<b>cintltst</b>/</td>
-
- <td>A test suite written in C, including all C APIs. For information
- about running the test suite, see the build instructions specific to your
- platform later in this document.</td>
- </tr>
-
- <tr>
- <td><i>&lt;ICU&gt;</i>/source/test/<b>iotest</b>/</td>
-
- <td>A test suite written in C and C++ to test the icuio library. For
- information about running the test suite, see the build instructions
- specific to your platform later in this document.</td>
- </tr>
-
- <tr>
- <td><i>&lt;ICU&gt;</i>/source/test/<b>testdata</b>/</td>
-
- <td>Source text files for data, which are read by the tests. It contains
- the subdirectories <b>out/build/</b> which is used for intermediate
- files, and <b>out/</b> which contains <b>testdata.dat.</b></td>
- </tr>
-
- <tr>
- <td><i>&lt;ICU&gt;</i>/source/<b>tools</b>/</td>
-
- <td>Tools for generating the data files. Data files are generated by
- invoking <i>&lt;ICU&gt;</i>/source/data/build/makedata.bat on Win32 or
- <i>&lt;ICU&gt;</i>/source/make on UNIX.</td>
- </tr>
-
- <tr>
- <td><i>&lt;ICU&gt;</i>/source/<b>samples</b>/</td>
-
- <td>Various sample programs that use ICU</td>
- </tr>
-
- <tr>
- <td><i>&lt;ICU&gt;</i>/source/<b>extra</b>/</td>
-
- <td>Non-supported API additions. Currently, it contains the 'uconv' tool
- to perform codepage conversion on files.</td>
- </tr>
-
- <tr>
- <td><i>&lt;ICU&gt;</i>/<b>packaging</b>/</td>
-
- <td>This directory contain scripts and tools for packaging the final
- ICU build for various release platforms.</td>
- </tr>
-
- <tr>
- <td><i>&lt;ICU&gt;</i>/source/<b>config</b>/</td>
-
- <td>Contains helper makefiles for platform specific build commands. Used
- by 'configure'.</td>
- </tr>
-
- <tr>
- <td><i>&lt;ICU&gt;</i>/source/<b>allinone</b>/</td>
-
- <td>Contains top-level ICU workspace and project files, for instance to
- build all of ICU under one MSVC project.</td>
- </tr>
-
- <tr>
- <td><i>&lt;ICU&gt;</i>/<b>include</b>/</td>
-
- <td>Contains the headers needed for developing software that uses ICU on
- Windows.</td>
- </tr>
-
- <tr>
- <td><i>&lt;ICU&gt;</i>/<b>lib</b>/</td>
-
- <td>Contains the import libraries for linking ICU into your Windows
- application.</td>
- </tr>
-
- <tr>
- <td><i>&lt;ICU&gt;</i>/<b>bin</b>/</td>
-
- <td>Contains the libraries and executables for using ICU on Windows.</td>
- </tr>
- </table>
- <!-- end of ICU structure ==================================== -->
-
- <h2><a name="HowToBuild" href="#HowToBuild" id="HowToBuild">How To Build And
- Install ICU</a></h2>
-
- <h3><a name="RecBuild" href="#RecBuild" id=
- "RecBuild">Recommended Build Options</a></h3>
-
- <p>Depending on the platform and the type of installation,
- we recommend a small number of modifications and build options.
- Note that C99 compatibility is now required.</p>
- <ul>
- <li><b>Namespace (ICU 61 and later):</b>
- Since ICU 61, call sites need to qualify ICU types explicitly,
- for example <code>icu::UnicodeString</code>,
- or do <code>using icu::UnicodeString;</code> where appropriate.
- If your code relies on the "using namespace icu;" that used to be in unicode/uversion.h,
- then you need to update your code.<br />
- You could temporarily (until you have more time to update your code)
- revert to the default "using"
- via <code>-DU_USING_ICU_NAMESPACE=1</code>
- or by modifying unicode/uversion.h:
-<pre>Index: icu4c/source/common/unicode/uversion.h
-===================================================================
---- icu4c/source/common/unicode/uversion.h (revision 40704)
-+++ icu4c/source/common/unicode/uversion.h (working copy)
-@@ -127,7 +127,7 @@
- defined(U_LAYOUTEX_IMPLEMENTATION) || defined(U_TOOLUTIL_IMPLEMENTATION)
- # define U_USING_ICU_NAMESPACE 0
- # else
--# define U_USING_ICU_NAMESPACE 0
-+# define U_USING_ICU_NAMESPACE 1
- # endif
- # endif
- # if U_USING_ICU_NAMESPACE
-</pre>
- </li>
- <li><b>Namespace (ICU 60 and earlier):</b> By default, unicode/uversion.h has
- "using namespace icu;" which defeats much of the purpose of the namespace.
- (This is for historical reasons: Originally, ICU4C did not use namespaces,
- and some compilers did not support them. The default "using" statement
- preserves source code compatibility.)<br />
- You should turn this off
- via <code>-DU_USING_ICU_NAMESPACE=0</code>
- or by modifying unicode/uversion.h:
-<pre>Index: source/common/unicode/uversion.h
-===================================================================
---- source/common/unicode/uversion.h (revision 26606)
-+++ source/common/unicode/uversion.h (working copy)
-@@ -180,7 +180,8 @@
- # define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE::
-
- # ifndef U_USING_ICU_NAMESPACE
--# define U_USING_ICU_NAMESPACE 1
-+ // Set to 0 to force namespace declarations in ICU usage.
-+# define U_USING_ICU_NAMESPACE 0
- # endif
- # if U_USING_ICU_NAMESPACE
- U_NAMESPACE_USE
-</pre>
- ICU call sites then either qualify ICU types explicitly,
- for example <code>icu::UnicodeString</code>,
- or do <code>using icu::UnicodeString;</code> where appropriate.</li>
- <li><b>Hardcode the default charset to UTF-8:</b> On platforms where
- the default charset is always UTF-8,
- like MacOS X and some Linux distributions,
- we recommend hardcoding ICU's default charset to UTF-8.
- This means that some implementation code becomes simpler and faster,
- and statically linked ICU libraries become smaller.
- (See the <a href="http://icu-project.org/apiref/icu4c/platform_8h.html#a0a33e1edf3cd23d9e9c972b63c9f7943">U_CHARSET_IS_UTF8</a>
- API documentation for more details.)<br />
- You can <code>-DU_CHARSET_IS_UTF8=1</code> or
- modify unicode/utypes.h (in ICU 4.8 and below)
- or modify unicode/platform.h (in ICU 49 and higher):
-<pre>Index: source/common/unicode/utypes.h
-===================================================================
---- source/common/unicode/utypes.h (revision 26606)
-+++ source/common/unicode/utypes.h (working copy)
-@@ -160,7 +160,7 @@
- * @see UCONFIG_NO_CONVERSION
- */
- #ifndef U_CHARSET_IS_UTF8
--# define U_CHARSET_IS_UTF8 0
-+# define U_CHARSET_IS_UTF8 1
- #endif
-
- /*===========================================================================*/
-</pre></li>
- <li><b>UnicodeString constructors:</b> The UnicodeString class has
- several single-argument constructors that are not marked "explicit"
- for historical reasons.
- This can lead to inadvertent construction of a <code>UnicodeString</code>
- with a single character by using an integer,
- and it can lead to inadvertent dependency on the conversion framework
- by using a C string literal.<br />
- Beginning with ICU 49, you should do the following:
- <ul>
- <li>Consider marking the from-<code>UChar</code>
- and from-<code>UChar32</code> constructors explicit via
- <code>-DUNISTR_FROM_CHAR_EXPLICIT=explicit</code> or similar.</li>
- <li>Consider marking the from-<code>const char*</code> and
- from-<code>const UChar*</code> constructors explicit via
- <code>-DUNISTR_FROM_STRING_EXPLICIT=explicit</code> or similar.</li>
- </ul>
- Note: The ICU test suites cannot be compiled with these settings.
- </li>
- <li><b>utf.h, utf8.h, utf16.h, utf_old.h:</b>
- By default, utypes.h (and thus almost every public ICU header)
- includes all of these header files.
- Often, none of them are needed, or only one or two of them.
- All of utf_old.h is deprecated or obsolete.<br />
- Beginning with ICU 49,
- you should define <code>U_NO_DEFAULT_INCLUDE_UTF_HEADERS</code> to 1
- (via -D or uconfig.h, as above)
- and include those header files explicitly that you actually need.<br />
- Note: The ICU test suites cannot be compiled with this setting.</li>
- <li><b>utf_old.h:</b>
- All of utf_old.h is deprecated or obsolete.<br />
- Beginning with ICU 60,
- you should define <code>U_HIDE_OBSOLETE_UTF_OLD_H</code> to 1
- (via -D or uconfig.h, as above).
- Use of any of these macros should be replaced as noted
- in the comments for the obsolete macro.<br />
- Note: The ICU test suites <i>can</i> be compiled with this setting.</li>
- <li><b>.dat file:</b> By default, the ICU data is built into
- a shared library (DLL). This is convenient because it requires no
- install-time or runtime configuration,
- but the library is platform-specific and cannot be modified.
- A .dat package file makes the opposite trade-off:
- Platform-portable (except for endianness and charset family, which
- can be changed with the icupkg tool)
- and modifiable (also with the icupkg tool).
- If a path is set, then single data files (e.g., .res files)
- can be copied to that location to provide new locale data
- or conversion tables etc.<br />
- The only drawback with a .dat package file is that the application
- needs to provide ICU with the file system path to the package file
- (e.g., by calling <code>u_setDataDirectory()</code>)
- or with a pointer to the data (<code>udata_setCommonData()</code>)
- before other ICU API calls.
- This is usually easy if ICU is used from an application where
- <code>main()</code> takes care of such initialization.
- It may be hard if ICU is shipped with
- another shared library (such as the Xerces-C++ XML parser)
- which does not control <code>main()</code>.<br />
- See the <a href="http://userguide.icu-project.org/icudata">User Guide ICU Data</a>
- chapter for more details.<br />
- If possible, we recommend building the .dat package.
- Specify <code>--with-data-packaging=archive</code>
- on the configure command line, as in<br />
- <code>runConfigureICU Linux --with-data-packaging=archive</code><br />
- (Read the configure script's output for further instructions.
- On Windows, the Visual Studio build generates both the .dat package
- and the data DLL.)<br />
- Be sure to install and use the tiny stubdata library
- rather than the large data DLL.</li>
- <li><b>Static libraries:</b> It may make sense to build the ICU code
- into static libraries (.a) rather than shared libraries (.so/.dll).
- Static linking reduces the overall size of the binary by removing
- code that is never called.<br />
- Example configure command line:<br />
- <code>runConfigureICU Linux --enable-static --disable-shared</code></li>
- <li><b>Out-of-source build:</b> It is usually desirable to keep the ICU
- source file tree clean and have build output files written to
- a different location. This is called an "out-of-source build".
- Simply invoke the configure script from the target location:
-<pre>~/icu$ git clone export https://github.com/unicode-org/icu.git
-~/icu$ mkdir icu4c-build
-~/icu$ cd icu4c-build
-~/icu/icu4c-build$ ../icu/icu4c/source/runConfigureICU Linux
-~/icu/icu4c-build$ make check</pre><br/>
- (Note: this example shows a relative path to
- <code>runConfigureICU</code>. If you experience difficulty,
- try using an absolute path to <code>runConfigureICU</code>
- instead.)
- </li>
- </ul>
- <h4>ICU as a System-Level Library</h4>
- <p>If ICU is installed as a system-level library, there are further
- opportunities and restrictions to consider.
- For details, see the <em>Using ICU as an Operating System Level Library</em>
- section of the <a href="http://userguide.icu-project.org/design">User Guide ICU Architectural Design</a> chapter.</p>
- <ul>
- <li><b>Data path:</b> For a system-level library, it is best to load
- ICU data from the .dat package file because the file system path
- to the .dat package file can be hardcoded. ICU will automatically set
- the path to the final install location using U_ICU_DATA_DEFAULT_DIR.
- Alternatively, you can set <code>-DICU_DATA_DIR=/path/to/icu/data</code>
- when building the ICU code. (Used by source/common/putil.c.)<br/>
- Consider also setting <code>-DICU_NO_USER_DATA_OVERRIDE</code>
- if you do not want the "ICU_DATA" environment variable to be used.
- (An application can still override the data path via
- <code>u_setDataDirectory()</code> or
- <code>udata_setCommonData()</code>.</li>
- <li><b>Hide draft API:</b> API marked with <code>@draft</code>
- is new and not yet stable. Applications must not rely on unstable
- APIs from a system-level library.
- Define <code>U_HIDE_DRAFT_API</code>, <code>U_HIDE_INTERNAL_API</code>
- and <code>U_HIDE_SYSTEM_API</code>
- by modifying unicode/utypes.h before installing it.</li>
- <li><b>Only C APIs:</b> Applications must not rely on C++ APIs from a
- system-level library because binary C++ compatibility
- across library and compiler versions is very hard to achieve.
- Most ICU C++ APIs are in header files that contain a comment with
- <code>\brief C++ API</code>.
- Consider not installing these header files, or define <code>U_SHOW_CPLUSPLUS_API</code>
- to be <code>0</code> by modifying unicode/utypes.h before installing it.</li>
- <li><b>Disable renaming:</b> By default, ICU library entry point names
- have an ICU version suffix. Turn this off for a system-level installation,
- to enable upgrading ICU without breaking applications. For example:<br />
- <code>runConfigureICU Linux --disable-renaming</code><br />
- The public header files from this configuration must be installed
- for applications to include and get the correct entry point names.</li>
- </ul>
-
- <h3><a name="UserConfig" href="#UserConfig" id="UserConfig">User-Configurable Settings</a></h3>
- <p>ICU4C can be customized via a number of user-configurable settings.
- Many of them are controlled by preprocessor macros which are
- defined in the <code>source/common/unicode/uconfig.h</code> header file.
- Some turn off parts of ICU, for example conversion or collation,
- trading off a smaller library for reduced functionality.
- Other settings are recommended (see previous section)
- but their default values are set for better source code compatibility.</p>
-
- <p>In order to change such user-configurable settings, you can
- either modify the <code>uconfig.h</code> header file by adding
- a specific <code>#define ...</code> for one or more of the macros
- before they are first tested,
- or set the compiler's preprocessor flags (<code>CPPFLAGS</code>) to include
- an equivalent <code>-D</code> macro definition.</p>
-
- <h3><a name="HowToBuildWindows" href="#HowToBuildWindows" id=
- "HowToBuildWindows">How To Build And Install On Windows</a></h3>
-
- <p>Building International Components for Unicode requires:</p>
-
- <ul>
- <li>Microsoft Windows</li>
-
- <li>Microsoft Visual C++ (part of <a href="https://www.visualstudio.com/">Visual Studio</a>) (from either Visual Studio 2015 or Visual Studio 2017)</li>
-
- <li><i><b>Optional:</b></i> A version of the <a href="https://developer.microsoft.com/windows/downloads">Windows 10 SDK</a> (if you want to build the UWP projects)</li>
- </ul>
- <p class="note"><a href="#HowToBuildCygwin">Cygwin</a> is required if using a version of MSVC other than the one
- compatible with the supplied project files or if other compilers are used to build ICU. (e.g. GCC)</p>
-
- <p>The steps are:</p>
-
- <ol>
- <li>Unzip the <tt>icu-XXXX.zip</tt> file into any convenient location.<br/>
- <ul class="no-left-margin">
- <li>You can use the built-in zip functionality of Windows Explorer to do this.
- Right-click on the .zip file and choose the "Extract All" option from the context menu.
- This will open a new window where you can choose the output location to put the files.</li>
- <li>Alternatively, you can use a 3<sup>rd</sup> party GUI tool like 7-Zip or WinZip to do this as well.</li>
- </ul>
- </li>
-
- <li>Be sure that the ICU binary directory, (ex: <i>&lt;ICU&gt;</i><tt>\bin\</tt>), is
- included in the <strong>PATH</strong> environment variable. The tests will
- not work without the location of the ICU DLL files in the path.
- Note that the binary directory name can depend on what architecture you select when you compile ICU.
- For x86 or 32-bit builds, the binary directory is "<tt>bin</tt>". Whereas for x64 or 64-bit builds
- the binary directory is "<tt>bin64</tt>".
- </li>
-
- <li>Open the "<i>&lt;ICU&gt;</i><tt>\source\allinone\allinone.sln</tt>" solution
- file in 'Visual Studio 2017'. (This solution includes all the
- International Components for Unicode libraries, necessary ICU building
- tools, and the test suite projects). Please see the
- <a href="#HowToBuildWindowsCommandLine">command line note below</a> if you want to
- build from the command line instead.</li>
-
- <li>If you are building using 'Visual Studio 2015' instead, or if you are building the UWP projects and you have a different
- version of the Windows 10 SDK installed you will first need to modify the two "<tt>Build.Windows.*.props</tt>" files
- in the "<tt>allinone</tt>" directory before you can open the "allinone" solution file.
- Please see the notes below about <a href="#HowToUseOtherVSVersions">building with other versions of Visual Studio</a> and the
- notes on <a href="#HowToRetargetTheWin10SDK">re-targeting the Windows 10 SDK for the UWP projects</a> for details. Alternatively,
- you can <a href="#HowToSkipBuildingUWP">skip building the UWP projects</a> entirely as well.
- </li>
-
- <li>Set the active platform to "Win32" or "x64" (See <a href="#HowToBuildWindowsPlatform">Windows platform note</a> below)
- and configuration to "Debug" or "Release" (See <a href="#HowToBuildWindowsConfig">Windows configuration note</a> below).</li>
-
- <li>Choose the "Build" menu and select "Rebuild Solution". If you want to
- build the Debug and Release at the same time, see the <a href=
- "#HowToBuildWindowsBatch">batch configuration note</a> below.</li>
-
- <li>Run the tests. They can be run from the command line or from within Visual Studio.
-
- <h4>Running the Tests from the Windows Command Line (cmd)</h4>
- <ul>
- <li>The general syntax is:<br />
- <div class="indent">
- <tt><i>&lt;ICU&gt;</i>\source\allinone\icucheck.bat <i>Platform</i> <i>Configuration</i></tt>
- </div>
- </li>
- <li>So, for example for x86 (32-bit) and Debug, use the following:<br />
- <samp><i>&lt;ICU&gt;</i>\source\allinone\icucheck.bat <b>x86</b> <b>Debug</b></samp>
- For x86 (32-bit) and Release:
- <samp><i>&lt;ICU&gt;</i>\source\allinone\icucheck.bat <b>x86</b> <b>Release</b></samp>
- For x64 (64-bit) and Debug:
- <samp><i>&lt;ICU&gt;</i>\source\allinone\icucheck.bat <b>x64</b> <b>Debug</b></samp>
- For x64 (64-bit) and Release:
- <samp><i>&lt;ICU&gt;</i>\source\allinone\icucheck.bat <b>x64</b> <b>Release</b></samp>
- </li>
- </ul>
-
- <h4>Running the Tests from within Visual Studio</h4>
-
- <ol>
- <li>Run the C++ test suite, "<tt>intltest</tt>". To do this: set the active startup
- project to "intltest", and press Ctrl+F5 to run it. Make sure that it
- passes without any errors.</li>
-
- <li>Run the C test suite, "<tt>cintltst</tt>". To do this: set the active startup
- project to "cintltst", and press Ctrl+F5 to run it. Make sure that it
- passes without any errors.</li>
-
- <li>Run the I/O test suite, "<tt>iotest</tt>". To do this: set the active startup
- project to "iotest", and press Ctrl+F5 to run it. Make sure that it passes
- without any errors.</li>
- </ol>
- </li>
-
- <li>You are now able to develop applications with ICU by using the
- libraries and tools in <tt><i>&lt;ICU&gt;</i>\bin\</tt>. The headers are in
- <tt><i>&lt;ICU&gt;</i>\include\</tt> and the link libraries are in
- <tt><i>&lt;ICU&gt;</i>\lib\</tt>. To install the ICU runtime on a machine, or ship
- it with your application, copy the needed components from
- <tt><i>&lt;ICU&gt;</i>\bin\</tt> to a location on the system PATH or to your
- application directory.</li>
- </ol>
-
- <p><a name="HowToUseOtherVSVersions" id="HowToUseOtherVSVersions">
- <strong>Building with other versions of Visual Studio Note:</strong></a>
- The particular version of the MSVC compiler tool-set (and thus the corresponding version of Visual Studio) that
- is used to compile ICU is determined by the "<tt>PlatformToolset</tt>" property. This property is stored in two
- different shared files that are used to set common configuration settings amongst the various ICU "<tt>*.vcxproj</tt>" project files.
-
- For the non-UWP projects, this setting is in the shared file called "<tt>Build.Windows.ProjectConfiguration.props</tt>" located
- in the "allinone" directory.
-
- For the UWP projects, this setting is in the shared file called "<tt>Build.Windows.UWP.ProjectConfiguration.props</tt>", also
- located in the "allinone" directory.
- <br/>
- The value of <tt>v140</tt> corresponds to the Visual Studio 2015 compiler tool set, whereas the value of
- <tt>v141</tt> corresponds to the Visual Studio 2017 compiler tool set.
-
- <br/>In order to build the non-UWP projects with Visual Studio 2015 you will need to modify the file
- called "<tt>Build.Windows.ProjectConfiguration.props</tt>" to change the value of the <tt>PlatformToolset</tt> property.
-
- Note however that Visual Studio 2017 is required for building the UWP projects.
- </p>
-
- <p>Please consider: Using older versions of the MSVC compiler is generally not recommended due to the improved support for the C++11 standard
- in newer versions of the compiler.</p>
-
- <p><a name="HowToRetargetTheWin10SDK" id="HowToRetargetTheWin10SDK">
- <strong>Re-targeting the Windows 10 SDK for the UWP projects Note:</strong></a>
-
- If the version of the Windows 10 SDK that you have installed does not match the version used by the UWP projects, then you
- will need to "retarget" them to use the version of the SDK that you have installed instead.
-
- There are two ways to do this:
- <ul>
- <li>In Visual Studio you can right-click on the UWP projects in the 'Solution Explorer' and select the
- option 'Retarget Projects' from the context menu. This will open up a window where you can select the
- SDK version to target from a drop-down list of the various SDKs that are installed on the machine.</li>
-
- <li>Alternatively, you can manually edit the shared file called "<tt>Build.Windows.UWP.ProjectConfiguration.props</tt>"
- which is located in the "allinone" directory. You will need to change the of the
- "<tt>WindowsTargetPlatformVersion</tt>" property to the version of the SDK that you would like to use instead.</li>
- </ul>
- </p>
-
- <p><a name="HowToBuildWindowsCommandLine" id=
- "HowToBuildWindowsCommandLine"><strong>Using MSBUILD At The Command Line Note:</strong></a>
- You can build ICU from the command line instead of using the Visual Studio GUI.
-
- Assuming that you have properly installed Visual Studio to support command line building, you
- should have a shortcut for the "Developer Command Prompt" listed in the Start Menu.
- (For Visual Studio 2017 you will need to install the "Desktop development with C++" option).</p>
-
- <ul>
- <li>Open the "Developer Command Prompt" shortcut from the Start Menu. (This will open up a new command line window).</li>
- <li>From within the "Developer Command Prompt" change directory (<tt>cd</tt>) to the ICU source directory.</li>
- <li>You can then use either '<tt>msbuild</tt>' directly, or you can use the '<tt>devenv.com</tt>' command to build ICU.</li>
- <li>Using <tt>MSBUILD</tt>:</li>
- <ul class="no-left-margin">
- <li>To build the 32-bit Debug version, use the following command line:<br/>
- <code>'msbuild source\allinone\allinone.sln /p:Configuration=Debug /p:Platform=Win32'</code>.</li>
- <li>To build the 64-bit Release version, use the following command line:<br/>
- <code>'msbuild source\allinone\allinone.sln /p:Configuration=Release /p:Platform=x64'</code>.</li>
- </ul>
- <li>Using <tt>devenv.com</tt>:</li>
- <ul class="no-left-margin">
- <li>To build the 32-bit Debug version, use the following command line:<br/>
- <code>'devenv.com source\allinone\allinone.sln /build "Debug|Win32"'</code>.</li>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
+ <head>
+ <title>ReadMe for ICU 67.1</title>
+ <meta name="COPYRIGHT" content=
+ "Copyright (C) 2016 and later: Unicode, Inc. and others. License &amp; terms of use: http://www.unicode.org/copyright.html"/>
+ <!-- meta name="COPYRIGHT" content=
+ "Copyright (c) 1997-2016 IBM Corporation and others. All Rights Reserved." / -->
+ <meta name="KEYWORDS" content=
+ "ICU; International Components for Unicode; ICU4C; what's new; readme; read me; introduction; downloads; downloading; building; installation;" />
+ <meta name="DESCRIPTION" content=
+ "The introduction to the International Components for Unicode with instructions on building, installation, usage and other information about ICU." />
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <link type="text/css" href="./icu4c.css" rel="stylesheet"/>
+ </head>
+
+<!--
+ classes to use with the "body" -
+ draft - if the release note is itself a draft (May be combined with the other two)
+ rc - if the release note is a release candidate
+ milestone - if the release note is a milestone release
+-->
+
+ <body>
+ <!-- <body class="rc"> -->
+ <p class="only-draft"><b>Note:</b> This is a draft readme.</p>
+
+ <h1>
+ <span class="only-draft">DRAFT</span>
+ International Components for Unicode<br/>
+ <span class="only-rc">Release Candidate</span>
+ <!-- <span class="only-milestone">(Milestone Release)</span> -->
+ <span class="only-milestone">(Preview Release)</span>
+ <abbr title="International Components for Unicode">ICU</abbr> 67.1 ReadMe
+ </h1>
+
+ <!-- Most of the time we shouldn't need to comment/uncomment this paragraph, just change the body class -->
+ <!-- <p class="note only-milestone">This is a development milestone release of ICU
+ This milestone is intended for those wishing to get an early look at new features and API changes.
+ It is not recommended for production use.</p> -->
+ <p class="note only-milestone">This is a preview release of ICU.
+ It is not recommended for production use.</p>
+
+ <!-- Shouldn't need to comment/uncomment this paragraph, just change the body class -->
+ <p class="note only-rc">This is a release candidate version of ICU4C.
+ It is not recommended for production use.</p>
+
+ <p>Last updated: 2020-Mar-25<br/>
+ Copyright &copy; 2016 and later: Unicode, Inc. and others. License &amp; terms of use:
+ <a href="http://www.unicode.org/copyright.html">http://www.unicode.org/copyright.html</a><br/>
+ Copyright &copy; 1997-2016 International Business Machines Corporation and others.
+ All Rights Reserved.</p>
+ <!-- Remember that there is a copyright at the end too -->
+ <hr/>
+
+ <h2 class="TOC">Table of Contents</h2>
+
+ <ul class="TOC">
+ <li><a href="#Introduction">Introduction</a></li>
+
+ <li><a href="#GettingStarted">Getting Started</a></li>
+
+ <li><a href="#News">What Is New In This Release?</a></li>
+
+ <li><a href="#Download">How To Download the Source Code</a></li>
+
+ <li><a href="#SourceCode">ICU Source Code Organization</a></li>
+
+ <li>
+ <a href="#HowToBuild">How To Build And Install ICU</a>
+
+ <ul >
+ <li><a href="#RecBuild">Recommended Build Options</a></li>
+
+ <li><a href="#UserConfig">User-Configurable Settings</a></li>
+
+ <li><a href="#HowToBuildWindows">Windows</a></li>
+
+ <li><a href="#HowToBuildCygwin">Cygwin</a></li>
+
+ <li><a href="#HowToBuildUNIX">UNIX</a></li>
+
+ <li><a href="#HowToBuildZOS">z/OS (os/390)</a></li>
+
+ <li><a href="#HowToBuildOS400">IBM i family (IBM i, i5/OS, OS/400)</a></li>
+
+ <li><a href="#HowToCrossCompileICU">How to Cross Compile ICU</a></li>
+ </ul>
+ </li>
+
+
+ <li><a href="#HowToPackage">How To Package ICU</a></li>
+
+ <li>
+ <a href="#ImportantNotes">Important Notes About Using ICU</a>
+
+ <ul >
+ <li><a href="#ImportantNotesMultithreaded">Using ICU in a Multithreaded
+ Environment</a></li>
+
+ <li><a href="#ImportantNotesWindows">Windows Platform</a></li>
+
+ <li><a href="#ImportantNotesUNIX">UNIX Type Platforms</a></li>
+ </ul>
+ </li>
+
+ <li>
+ <a href="#PlatformDependencies">Platform Dependencies</a>
+
+ <ul >
+ <li><a href="#PlatformDependenciesNew">Porting To A New
+ Platform</a></li>
+
+ <li><a href="#PlatformDependenciesImpl">Platform Dependent
+ Implementations</a></li>
+ </ul>
+ </li>
+ </ul>
+ <hr />
+
+ <h2><a name="Introduction" href="#Introduction" id=
+ "Introduction">Introduction</a></h2>
+
+ <p>Today's software market is a global one in which it is desirable to
+ develop and maintain one application (single source/single binary) that
+ supports a wide variety of languages. The International Components for
+ Unicode (ICU) libraries provide robust and full-featured Unicode services on
+ a wide variety of platforms to help this design goal. The ICU libraries
+ provide support for:</p>
+
+ <ul>
+ <li>The latest version of the Unicode standard</li>
+
+ <li>Character set conversions with support for over 220 codepages</li>
+
+ <li>Locale data for more than 300 locales</li>
+
+ <li>Language sensitive text collation (sorting) and searching based on the
+ Unicode Collation Algorithm (=ISO 14651)</li>
+
+ <li>Regular expression matching and Unicode sets</li>
+
+ <li>Transformations for normalization, upper/lowercase, script
+ transliterations (50+ pairs)</li>
+
+ <li>Resource bundles for storing and accessing localized information</li>
+
+ <li>Date/Number/Message formatting and parsing of culture specific
+ input/output formats</li>
+
+ <li>Calendar specific date and time manipulation</li>
+
+ <li>Text boundary analysis for finding characters, word and sentence
+ boundaries</li>
+ </ul>
+
+ <p>ICU has a sister project ICU4J that extends the internationalization
+ capabilities of Java to a level similar to ICU. The ICU C/C++ project is also
+ called ICU4C when a distinction is necessary.</p>
+
+ <h2><a name="GettingStarted" href="#GettingStarted" id=
+ "GettingStarted">Getting started</a></h2>
+
+ <p>This document describes how to build and install ICU on your machine. For
+ other information about ICU please see the following table of links.<br />
+ The ICU homepage also links to related information about writing
+ internationalized software.</p>
+
+ <table class="docTable" summary="These are some useful links regarding ICU and internationalization in general.">
+ <caption>
+ Here are some useful links regarding ICU and internationalization in
+ general.
+ </caption>
+
+ <tr>
+ <td>ICU, ICU4C &amp; ICU4J Homepage</td>
+
+ <td><a href=
+ "http://icu-project.org/">http://icu-project.org/</a></td>
+ </tr>
+
+ <tr>
+ <td>FAQ - Frequently Asked Questions about ICU</td>
+
+ <td><a href=
+ "http://userguide.icu-project.org/icufaq">http://userguide.icu-project.org/icufaq</a></td>
+ </tr>
+
+ <tr>
+ <td>ICU User's Guide</td>
+
+ <td><a href=
+ "http://userguide.icu-project.org/">http://userguide.icu-project.org/</a></td>
+ </tr>
+
+ <tr>
+ <td>How To Use ICU</td>
+
+ <td><a href="http://userguide.icu-project.org/howtouseicu">http://userguide.icu-project.org/howtouseicu</a></td>
+ </tr>
+
+ <tr>
+ <td>Download ICU Releases</td>
+
+ <td><a href=
+ "http://site.icu-project.org/download">http://site.icu-project.org/download</a></td>
+ </tr>
+
+ <tr>
+ <td>ICU4C API Documentation Online</td>
+
+ <td><a href=
+ "http://icu-project.org/apiref/icu4c/">http://icu-project.org/apiref/icu4c/</a></td>
+ </tr>
+
+ <tr>
+ <td>Online ICU Demos</td>
+
+ <td><a href=
+ "http://demo.icu-project.org/icu-bin/icudemos">http://demo.icu-project.org/icu-bin/icudemos</a></td>
+ </tr>
+
+ <tr>
+ <td>Contacts and Bug Reports/Feature Requests</td>
+
+ <td><a href=
+ "http://site.icu-project.org/contacts">http://site.icu-project.org/contacts</a></td>
+ </tr>
+ </table>
+
+ <p><strong>Important:</strong> Please make sure you understand the <a href=
+ "http://source.icu-project.org/repos/icu/trunk/icu4c/LICENSE">Copyright and License Information</a>.</p>
+
+
+ <h2><a name="News" href="#News" id="News">What Is New In This Release?</a></h2>
+
+ <p>See the <a href="http://site.icu-project.org/download/67">ICU 67 download page</a>
+ for more information on this release, including any other changes, bug fixes, known issues,
+ changes to supported platforms and build environments,
+ and migration issues for existing applications migrating from previous ICU releases.</p>
+
+ <p>See the <a href="APIChangeReport.html">API Change Report</a> for a complete list of
+ APIs added, removed, or changed in this release.</p>
+
+ <p><a name="RecentPreviousChanges" id="RecentPreviousChanges"></a>For
+ changes in previous releases, see the
+ main <a href="http://site.icu-project.org/download">ICU download page</a>
+ with its version-specific subpages.</p>
+
+
+ <h2><a name="Download" href="#Download" id="Download">How To Download the
+ Source Code</a></h2>
+
+ <p>There are two ways to download ICU releases:</p>
+
+ <ul>
+ <li><strong>Official Release Snapshot:</strong><br />
+ If you want to use ICU (as opposed to developing it), you should download
+ an official packaged version of the ICU source code. These versions are
+ tested more thoroughly than day-to-day development builds of the system,
+ and they are packaged in zip and tar files for convenient download. These
+ packaged files can be found at <a href=
+ "http://site.icu-project.org/download">http://site.icu-project.org/download</a>.<br />
+ The packaged snapshots are named <strong>icu-nnnn.zip</strong> or
+ <strong>icu-nnnn.tgz</strong>, where nnnn is the version number. The .zip
+ file is used for Windows platforms, while the .tgz file is preferred on
+ most other platforms.<br />
+ Please unzip this file. </li>
+
+ <li><strong>GitHub Source Repository:</strong><br />
+ If you are interested in developing features, patches, or bug fixes for
+ ICU, you should probably be working with the latest version of the ICU
+ source code. You will need to clone and checkout the code from our GitHub repository to
+ ensure that you have the most recent version of all of the files. See our
+ <a href="http://site.icu-project.org/repository">source
+ repository</a> for details.</li>
+ </ul>
+
+ <h2><a name="SourceCode" href="#SourceCode" id="SourceCode">ICU Source Code
+ Organization</a></h2>
+
+ <p>In the descriptions below, <strong><i>&lt;ICU&gt;</i></strong> is the full
+ path name of the ICU directory (the top level directory from the distribution
+ archives) in your file system. You can also view the <a href=
+ "http://userguide.icu-project.org/design">ICU Architectural
+ Design</a> section of the User's Guide to see which libraries you need for
+ your software product. You need at least the data (<code>[lib]icudt</code>)
+ and the common (<code>[lib]icuuc</code>) libraries in order to use ICU.</p>
+
+ <table class="docTable" summary="The following files describe the code drop.">
+ <caption>
+ The following files describe the code drop.
+ </caption>
+
+ <tr>
+ <th scope="col">File</th>
+
+ <th scope="col">Description</th>
+ </tr>
+
+ <tr>
+ <td>readme.html</td>
+
+ <td>Describes the International Components for Unicode (this file)</td>
+ </tr>
+
+ <tr>
+ <td>LICENSE</td>
+
+ <td>Contains the text of the ICU license</td>
+ </tr>
+ </table>
+
+ <p><br />
+ </p>
+
+ <table class="docTable" summary=
+ "The following directories contain source code and data files.">
+ <caption>
+ The following directories contain source code and data files.
+ </caption>
+
+ <tr>
+ <th scope="col">Directory</th>
+
+ <th scope="col">Description</th>
+ </tr>
+
+ <tr>
+ <td><i>&lt;ICU&gt;</i>/source/<b>common</b>/</td>
+
+ <td>The core Unicode and support functionality, such as resource bundles,
+ character properties, locales, codepage conversion, normalization,
+ Unicode properties, Locale, and UnicodeString.</td>
+ </tr>
+
+ <tr>
+ <td><i>&lt;ICU&gt;</i>/source/<b>i18n</b>/</td>
+
+ <td>Modules in i18n are generally the more data-driven, that is to say
+ resource bundle driven, components. These deal with higher-level
+ internationalization issues such as formatting, collation, text break
+ analysis, and transliteration.</td>
+ </tr>
+
+ <tr>
+ <td><i>&lt;ICU&gt;</i>/source/<b>layoutex</b>/</td>
+
+ <td>Contains the ICU paragraph layout engine.</td>
+ </tr>
+
+ <tr>
+ <td><i>&lt;ICU&gt;</i>/source/<b>io</b>/</td>
+
+ <td>Contains the ICU I/O library.</td>
+ </tr>
+
+ <tr>
+ <td><i>&lt;ICU&gt;</i>/source/<b>data</b>/</td>
+
+ <td>
+ <p>This directory contains the source data in text format, which is
+ compiled into binary form during the ICU build process. It contains
+ several subdirectories, in which the data files are grouped by
+ function. Note that the build process must be run again after any
+ changes are made to this directory.</p>
+
+ <p>If some of the following directories are missing, it's probably
+ because you got an official download. If you need the data source files
+ for customization, then please download the complete ICU source code from <a
+ href="http://site.icu-project.org/repository">the ICU repository</a>.</p>
+
+ <ul>
+ <li><b>in/</b> A directory that contains a pre-built data library for
+ ICU. A standard source code package will contain this file without
+ several of the following directories. This is to simplify the build
+ process for the majority of users and to reduce platform porting
+ issues.</li>
+
+ <li><b>brkitr/</b> Data files for character, word, sentence, title
+ casing and line boundary analysis.</li>
+
+ <li><b>coll/</b> Data for collation tailorings. The makefile
+ <b>colfiles.mk</b> contains the list of resource bundle files.</li>
+
+ <li><b>locales/</b> These .txt files contain ICU language and
+ culture-specific localization data. Two special bundles are
+ <b>root</b>, which is the fallback data and parent of other bundles,
+ and <b>index</b>, which contains a list of installed bundles. The
+ makefile <b>resfiles.mk</b> contains the list of resource bundle
+ files. Some of the locale data is split out into the type-specific
+ directories curr, lang, region, unit, and zone, described below.</li>
+
+ <li><b>curr/</b> Locale data for currency symbols and names (including
+ plural forms), with its own makefile <b>resfiles.mk</b>.</li>
+
+ <li><b>lang/</b> Locale data for names of languages, scripts, and locale
+ key names and values, with its own makefile <b>resfiles.mk</b>.</li>
+
+ <li><b>region/</b> Locale data for names of regions, with its own
+ makefile <b>resfiles.mk</b>.</li>
+
+ <li><b>unit/</b> Locale data for measurement unit patterns and names,
+ with its own makefile <b>resfiles.mk</b>.</li>
+
+ <li><b>zone/</b> Locale data for time zone names, with its own
+ makefile <b>resfiles.mk</b>.</li>
+
+ <li><b>mappings/</b> Here are the code page converter tables. These
+ .ucm files contain mappings to and from Unicode. These are compiled
+ into .cnv files. <b>convrtrs.txt</b> is the alias mapping table from
+ various converter name formats to ICU internal format and vice versa.
+ It produces cnvalias.icu. The makefiles <b>ucmfiles.mk,
+ ucmcore.mk,</b> and <b>ucmebcdic.mk</b> contain the list of
+ converters to be built.</li>
+
+ <li><b>translit/</b> This directory contains transliterator rules as
+ resource bundles, a makefile <b>trnsfiles.mk</b> containing the list
+ of installed system translitaration files, and as well the special
+ bundle <b>translit_index</b> which lists the system transliterator
+ aliases.</li>
+
+ <li><b>unidata/</b> This directory contains the Unicode data files.
+ Please see <a href=
+ "http://www.unicode.org/">http://www.unicode.org/</a> for more
+ information.</li>
+
+ <li><b>misc/</b> The misc directory contains other data files which
+ did not fit into the above categories, including time zone
+ information, region-specific data, and other data derived from CLDR
+ supplemental data.</li>
+
+ <li><b>out/</b> This directory contains the assembled memory mapped
+ files.</li>
+
+ <li><b>out/build/</b> This directory contains intermediate (compiled)
+ files, such as .cnv, .res, etc.</li>
+ </ul>
+
+ <p>If you are creating a special ICU build, you can set the ICU_DATA
+ environment variable to the out/ or the out/build/ directories, but
+ this is generally discouraged because most people set it incorrectly.
+ You can view the <a href=
+ "http://userguide.icu-project.org/icudata">ICU Data
+ Management</a> section of the ICU User's Guide for details.</p>
+ </td>
+ </tr>
+
+ <tr>
+ <td><i>&lt;ICU&gt;</i>/source/test/<b>intltest</b>/</td>
+
+ <td>A test suite including all C++ APIs. For information about running
+ the test suite, see the build instructions specific to your platform
+ later in this document.</td>
+ </tr>
+
+ <tr>
+ <td><i>&lt;ICU&gt;</i>/source/test/<b>cintltst</b>/</td>
+
+ <td>A test suite written in C, including all C APIs. For information
+ about running the test suite, see the build instructions specific to your
+ platform later in this document.</td>
+ </tr>
+
+ <tr>
+ <td><i>&lt;ICU&gt;</i>/source/test/<b>iotest</b>/</td>
+
+ <td>A test suite written in C and C++ to test the icuio library. For
+ information about running the test suite, see the build instructions
+ specific to your platform later in this document.</td>
+ </tr>
+
+ <tr>
+ <td><i>&lt;ICU&gt;</i>/source/test/<b>testdata</b>/</td>
+
+ <td>Source text files for data, which are read by the tests. It contains
+ the subdirectories <b>out/build/</b> which is used for intermediate
+ files, and <b>out/</b> which contains <b>testdata.dat.</b></td>
+ </tr>
+
+ <tr>
+ <td><i>&lt;ICU&gt;</i>/source/<b>tools</b>/</td>
+
+ <td>Tools for generating the data files. Data files are generated by
+ invoking <i>&lt;ICU&gt;</i>/source/data/build/makedata.bat on Win32 or
+ <i>&lt;ICU&gt;</i>/source/make on UNIX.</td>
+ </tr>
+
+ <tr>
+ <td><i>&lt;ICU&gt;</i>/source/<b>samples</b>/</td>
+
+ <td>Various sample programs that use ICU</td>
+ </tr>
+
+ <tr>
+ <td><i>&lt;ICU&gt;</i>/source/<b>extra</b>/</td>
+
+ <td>Non-supported API additions. Currently, it contains the 'uconv' tool
+ to perform codepage conversion on files.</td>
+ </tr>
+
+ <tr>
+ <td><i>&lt;ICU&gt;</i>/<b>packaging</b>/</td>
+
+ <td>This directory contain scripts and tools for packaging the final
+ ICU build for various release platforms.</td>
+ </tr>
+
+ <tr>
+ <td><i>&lt;ICU&gt;</i>/source/<b>config</b>/</td>
+
+ <td>Contains helper makefiles for platform specific build commands. Used
+ by 'configure'.</td>
+ </tr>
+
+ <tr>
+ <td><i>&lt;ICU&gt;</i>/source/<b>allinone</b>/</td>
+
+ <td>Contains top-level ICU workspace and project files, for instance to
+ build all of ICU under one MSVC project.</td>
+ </tr>
+
+ <tr>
+ <td><i>&lt;ICU&gt;</i>/<b>include</b>/</td>
+
+ <td>Contains the headers needed for developing software that uses ICU on
+ Windows.</td>
+ </tr>
+
+ <tr>
+ <td><i>&lt;ICU&gt;</i>/<b>lib</b>/</td>
+
+ <td>Contains the import libraries for linking ICU into your Windows
+ application.</td>
+ </tr>
+
+ <tr>
+ <td><i>&lt;ICU&gt;</i>/<b>bin</b>/</td>
+
+ <td>Contains the libraries and executables for using ICU on Windows.</td>
+ </tr>
+ </table>
+ <!-- end of ICU structure ==================================== -->
+
+ <h2><a name="HowToBuild" href="#HowToBuild" id="HowToBuild">How To Build And
+ Install ICU</a></h2>
+
+ <h3><a name="RecBuild" href="#RecBuild" id=
+ "RecBuild">Recommended Build Options</a></h3>
+
+ <p>Depending on the platform and the type of installation,
+ we recommend a small number of modifications and build options.
+ Note that C99 compatibility is now required.</p>
+ <ul>
+ <li><b>Namespace (ICU 61 and later):</b>
+ Since ICU 61, call sites need to qualify ICU types explicitly,
+ for example <code>icu::UnicodeString</code>,
+ or do <code>using icu::UnicodeString;</code> where appropriate.
+ If your code relies on the "using namespace icu;" that used to be in unicode/uversion.h,
+ then you need to update your code.<br />
+ You could temporarily (until you have more time to update your code)
+ revert to the default "using"
+ via <code>-DU_USING_ICU_NAMESPACE=1</code>
+ or by modifying unicode/uversion.h:
+<pre>Index: icu4c/source/common/unicode/uversion.h
+===================================================================
+--- icu4c/source/common/unicode/uversion.h (revision 40704)
++++ icu4c/source/common/unicode/uversion.h (working copy)
+@@ -127,7 +127,7 @@
+ defined(U_LAYOUTEX_IMPLEMENTATION) || defined(U_TOOLUTIL_IMPLEMENTATION)
+ # define U_USING_ICU_NAMESPACE 0
+ # else
+-# define U_USING_ICU_NAMESPACE 0
++# define U_USING_ICU_NAMESPACE 1
+ # endif
+ # endif
+ # if U_USING_ICU_NAMESPACE
+</pre>
+ </li>
+ <li><b>Namespace (ICU 60 and earlier):</b> By default, unicode/uversion.h has
+ "using namespace icu;" which defeats much of the purpose of the namespace.
+ (This is for historical reasons: Originally, ICU4C did not use namespaces,
+ and some compilers did not support them. The default "using" statement
+ preserves source code compatibility.)<br />
+ You should turn this off
+ via <code>-DU_USING_ICU_NAMESPACE=0</code>
+ or by modifying unicode/uversion.h:
+<pre>Index: source/common/unicode/uversion.h
+===================================================================
+--- source/common/unicode/uversion.h (revision 26606)
++++ source/common/unicode/uversion.h (working copy)
+@@ -180,7 +180,8 @@
+ # define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE::
+
+ # ifndef U_USING_ICU_NAMESPACE
+-# define U_USING_ICU_NAMESPACE 1
++ // Set to 0 to force namespace declarations in ICU usage.
++# define U_USING_ICU_NAMESPACE 0
+ # endif
+ # if U_USING_ICU_NAMESPACE
+ U_NAMESPACE_USE
+</pre>
+ ICU call sites then either qualify ICU types explicitly,
+ for example <code>icu::UnicodeString</code>,
+ or do <code>using icu::UnicodeString;</code> where appropriate.</li>
+ <li><b>Hardcode the default charset to UTF-8:</b> On platforms where
+ the default charset is always UTF-8,
+ like MacOS X and some Linux distributions,
+ we recommend hardcoding ICU's default charset to UTF-8.
+ This means that some implementation code becomes simpler and faster,
+ and statically linked ICU libraries become smaller.
+ (See the <a href="http://icu-project.org/apiref/icu4c/platform_8h.html#a0a33e1edf3cd23d9e9c972b63c9f7943">U_CHARSET_IS_UTF8</a>
+ API documentation for more details.)<br />
+ You can <code>-DU_CHARSET_IS_UTF8=1</code> or
+ modify unicode/utypes.h (in ICU 4.8 and below)
+ or modify unicode/platform.h (in ICU 49 and higher):
+<pre>Index: source/common/unicode/utypes.h
+===================================================================
+--- source/common/unicode/utypes.h (revision 26606)
++++ source/common/unicode/utypes.h (working copy)
+@@ -160,7 +160,7 @@
+ * @see UCONFIG_NO_CONVERSION
+ */
+ #ifndef U_CHARSET_IS_UTF8
+-# define U_CHARSET_IS_UTF8 0
++# define U_CHARSET_IS_UTF8 1
+ #endif
+
+ /*===========================================================================*/
+</pre></li>
+ <li><b>UnicodeString constructors:</b> The UnicodeString class has
+ several single-argument constructors that are not marked "explicit"
+ for historical reasons.
+ This can lead to inadvertent construction of a <code>UnicodeString</code>
+ with a single character by using an integer,
+ and it can lead to inadvertent dependency on the conversion framework
+ by using a C string literal.<br />
+ Beginning with ICU 49, you should do the following:
+ <ul>
+ <li>Consider marking the from-<code>UChar</code>
+ and from-<code>UChar32</code> constructors explicit via
+ <code>-DUNISTR_FROM_CHAR_EXPLICIT=explicit</code> or similar.</li>
+ <li>Consider marking the from-<code>const char*</code> and
+ from-<code>const UChar*</code> constructors explicit via
+ <code>-DUNISTR_FROM_STRING_EXPLICIT=explicit</code> or similar.</li>
+ </ul>
+ Note: The ICU test suites cannot be compiled with these settings.
+ </li>
+ <li><b>utf.h, utf8.h, utf16.h, utf_old.h:</b>
+ By default, utypes.h (and thus almost every public ICU header)
+ includes all of these header files.
+ Often, none of them are needed, or only one or two of them.
+ All of utf_old.h is deprecated or obsolete.<br />
+ Beginning with ICU 49,
+ you should define <code>U_NO_DEFAULT_INCLUDE_UTF_HEADERS</code> to 1
+ (via -D or uconfig.h, as above)
+ and include those header files explicitly that you actually need.<br />
+ Note: The ICU test suites cannot be compiled with this setting.</li>
+ <li><b>utf_old.h:</b>
+ All of utf_old.h is deprecated or obsolete.<br />
+ Beginning with ICU 60,
+ you should define <code>U_HIDE_OBSOLETE_UTF_OLD_H</code> to 1
+ (via -D or uconfig.h, as above).
+ Use of any of these macros should be replaced as noted
+ in the comments for the obsolete macro.<br />
+ Note: The ICU test suites <i>can</i> be compiled with this setting.</li>
+ <li><b>.dat file:</b> By default, the ICU data is built into
+ a shared library (DLL). This is convenient because it requires no
+ install-time or runtime configuration,
+ but the library is platform-specific and cannot be modified.
+ A .dat package file makes the opposite trade-off:
+ Platform-portable (except for endianness and charset family, which
+ can be changed with the icupkg tool)
+ and modifiable (also with the icupkg tool).
+ If a path is set, then single data files (e.g., .res files)
+ can be copied to that location to provide new locale data
+ or conversion tables etc.<br />
+ The only drawback with a .dat package file is that the application
+ needs to provide ICU with the file system path to the package file
+ (e.g., by calling <code>u_setDataDirectory()</code>)
+ or with a pointer to the data (<code>udata_setCommonData()</code>)
+ before other ICU API calls.
+ This is usually easy if ICU is used from an application where
+ <code>main()</code> takes care of such initialization.
+ It may be hard if ICU is shipped with
+ another shared library (such as the Xerces-C++ XML parser)
+ which does not control <code>main()</code>.<br />
+ See the <a href="http://userguide.icu-project.org/icudata">User Guide ICU Data</a>
+ chapter for more details.<br />
+ If possible, we recommend building the .dat package.
+ Specify <code>--with-data-packaging=archive</code>
+ on the configure command line, as in<br />
+ <code>runConfigureICU Linux --with-data-packaging=archive</code><br />
+ (Read the configure script's output for further instructions.
+ On Windows, the Visual Studio build generates both the .dat package
+ and the data DLL.)<br />
+ Be sure to install and use the tiny stubdata library
+ rather than the large data DLL.</li>
+ <li><b>Static libraries:</b> It may make sense to build the ICU code
+ into static libraries (.a) rather than shared libraries (.so/.dll).
+ Static linking reduces the overall size of the binary by removing
+ code that is never called.<br />
+ Example configure command line:<br />
+ <code>runConfigureICU Linux --enable-static --disable-shared</code></li>
+ <li><b>Out-of-source build:</b> It is usually desirable to keep the ICU
+ source file tree clean and have build output files written to
+ a different location. This is called an "out-of-source build".
+ Simply invoke the configure script from the target location:
+<pre>~/icu$ git clone export https://github.com/unicode-org/icu.git
+~/icu$ mkdir icu4c-build
+~/icu$ cd icu4c-build
+~/icu/icu4c-build$ ../icu/icu4c/source/runConfigureICU Linux
+~/icu/icu4c-build$ make check</pre><br/>
+ (Note: this example shows a relative path to
+ <code>runConfigureICU</code>. If you experience difficulty,
+ try using an absolute path to <code>runConfigureICU</code>
+ instead.)
+ </li>
+ </ul>
+ <h4>ICU as a System-Level Library</h4>
+ <p>If ICU is installed as a system-level library, there are further
+ opportunities and restrictions to consider.
+ For details, see the <em>Using ICU as an Operating System Level Library</em>
+ section of the <a href="http://userguide.icu-project.org/design">User Guide ICU Architectural Design</a> chapter.</p>
+ <ul>
+ <li><b>Data path:</b> For a system-level library, it is best to load
+ ICU data from the .dat package file because the file system path
+ to the .dat package file can be hardcoded. ICU will automatically set
+ the path to the final install location using U_ICU_DATA_DEFAULT_DIR.
+ Alternatively, you can set <code>-DICU_DATA_DIR=/path/to/icu/data</code>
+ when building the ICU code. (Used by source/common/putil.c.)<br/>
+ Consider also setting <code>-DICU_NO_USER_DATA_OVERRIDE</code>
+ if you do not want the "ICU_DATA" environment variable to be used.
+ (An application can still override the data path via
+ <code>u_setDataDirectory()</code> or
+ <code>udata_setCommonData()</code>.</li>
+ <li><b>Hide draft API:</b> API marked with <code>@draft</code>
+ is new and not yet stable. Applications must not rely on unstable
+ APIs from a system-level library.
+ Define <code>U_HIDE_DRAFT_API</code>, <code>U_HIDE_INTERNAL_API</code>
+ and <code>U_HIDE_SYSTEM_API</code>
+ by modifying unicode/utypes.h before installing it.</li>
+ <li><b>Only C APIs:</b> Applications must not rely on C++ APIs from a
+ system-level library because binary C++ compatibility
+ across library and compiler versions is very hard to achieve.
+ Most ICU C++ APIs are in header files that contain a comment with
+ <code>\brief C++ API</code>.
+ Consider not installing these header files, or define <code>U_SHOW_CPLUSPLUS_API</code>
+ to be <code>0</code> by modifying unicode/utypes.h before installing it.</li>
+ <li><b>Disable renaming:</b> By default, ICU library entry point names
+ have an ICU version suffix. Turn this off for a system-level installation,
+ to enable upgrading ICU without breaking applications. For example:<br />
+ <code>runConfigureICU Linux --disable-renaming</code><br />
+ The public header files from this configuration must be installed
+ for applications to include and get the correct entry point names.</li>
+ </ul>
+
+ <h3><a name="UserConfig" href="#UserConfig" id="UserConfig">User-Configurable Settings</a></h3>
+ <p>ICU4C can be customized via a number of user-configurable settings.
+ Many of them are controlled by preprocessor macros which are
+ defined in the <code>source/common/unicode/uconfig.h</code> header file.
+ Some turn off parts of ICU, for example conversion or collation,
+ trading off a smaller library for reduced functionality.
+ Other settings are recommended (see previous section)
+ but their default values are set for better source code compatibility.</p>
+
+ <p>In order to change such user-configurable settings, you can
+ either modify the <code>uconfig.h</code> header file by adding
+ a specific <code>#define ...</code> for one or more of the macros
+ before they are first tested,
+ or set the compiler's preprocessor flags (<code>CPPFLAGS</code>) to include
+ an equivalent <code>-D</code> macro definition.</p>
+
+ <h3><a name="HowToBuildWindows" href="#HowToBuildWindows" id=
+ "HowToBuildWindows">How To Build And Install On Windows</a></h3>
+
+ <p>Building International Components for Unicode requires:</p>
+
+ <ul>
+ <li>Microsoft Windows</li>
+
+ <li>Microsoft Visual C++ (part of <a href="https://www.visualstudio.com/">Visual Studio</a>) (from either Visual Studio 2015 or Visual Studio 2017)</li>
+
+ <li><i><b>Optional:</b></i> A version of the <a href="https://developer.microsoft.com/windows/downloads">Windows 10 SDK</a> (if you want to build the UWP projects)</li>
+ </ul>
+ <p class="note"><a href="#HowToBuildCygwin">Cygwin</a> is required if using a version of MSVC other than the one
+ compatible with the supplied project files or if other compilers are used to build ICU. (e.g. GCC)</p>
+
+ <p>The steps are:</p>
+
+ <ol>
+ <li>Unzip the <tt>icu-XXXX.zip</tt> file into any convenient location.<br/>
+ <ul class="no-left-margin">
+ <li>You can use the built-in zip functionality of Windows Explorer to do this.
+ Right-click on the .zip file and choose the "Extract All" option from the context menu.
+ This will open a new window where you can choose the output location to put the files.</li>
+ <li>Alternatively, you can use a 3<sup>rd</sup> party GUI tool like 7-Zip or WinZip to do this as well.</li>
+ </ul>
+ </li>
+
+ <li>Be sure that the ICU binary directory, (ex: <i>&lt;ICU&gt;</i><tt>\bin\</tt>), is
+ included in the <strong>PATH</strong> environment variable. The tests will
+ not work without the location of the ICU DLL files in the path.
+ Note that the binary directory name can depend on what architecture you select when you compile ICU.
+ For x86 or 32-bit builds, the binary directory is "<tt>bin</tt>". Whereas for x64 or 64-bit builds
+ the binary directory is "<tt>bin64</tt>".
+ </li>
+
+ <li>Open the "<i>&lt;ICU&gt;</i><tt>\source\allinone\allinone.sln</tt>" solution
+ file in 'Visual Studio 2017'. (This solution includes all the
+ International Components for Unicode libraries, necessary ICU building
+ tools, and the test suite projects). Please see the
+ <a href="#HowToBuildWindowsCommandLine">command line note below</a> if you want to
+ build from the command line instead.</li>
+
+ <li>If you are building using 'Visual Studio 2015' instead, or if you are building the UWP projects and you have a different
+ version of the Windows 10 SDK installed you will first need to modify the two "<tt>Build.Windows.*.props</tt>" files
+ in the "<tt>allinone</tt>" directory before you can open the "allinone" solution file.
+ Please see the notes below about <a href="#HowToUseOtherVSVersions">building with other versions of Visual Studio</a> and the
+ notes on <a href="#HowToRetargetTheWin10SDK">re-targeting the Windows 10 SDK for the UWP projects</a> for details. Alternatively,
+ you can <a href="#HowToSkipBuildingUWP">skip building the UWP projects</a> entirely as well.
+ </li>
+
+ <li>Set the active platform to "Win32" or "x64" (See <a href="#HowToBuildWindowsPlatform">Windows platform note</a> below)
+ and configuration to "Debug" or "Release" (See <a href="#HowToBuildWindowsConfig">Windows configuration note</a> below).</li>
+
+ <li>Choose the "Build" menu and select "Rebuild Solution". If you want to
+ build the Debug and Release at the same time, see the <a href=
+ "#HowToBuildWindowsBatch">batch configuration note</a> below.</li>
+
+ <li>Run the tests. They can be run from the command line or from within Visual Studio.
+
+ <h4>Running the Tests from the Windows Command Line (cmd)</h4>
+ <ul>
+ <li>The general syntax is:<br />
+ <div class="indent">
+ <tt><i>&lt;ICU&gt;</i>\source\allinone\icucheck.bat <i>Platform</i> <i>Configuration</i></tt>
+ </div>
+ </li>
+ <li>So, for example for x86 (32-bit) and Debug, use the following:<br />
+ <samp><i>&lt;ICU&gt;</i>\source\allinone\icucheck.bat <b>x86</b> <b>Debug</b></samp>
+ For x86 (32-bit) and Release:
+ <samp><i>&lt;ICU&gt;</i>\source\allinone\icucheck.bat <b>x86</b> <b>Release</b></samp>
+ For x64 (64-bit) and Debug:
+ <samp><i>&lt;ICU&gt;</i>\source\allinone\icucheck.bat <b>x64</b> <b>Debug</b></samp>
+ For x64 (64-bit) and Release:
+ <samp><i>&lt;ICU&gt;</i>\source\allinone\icucheck.bat <b>x64</b> <b>Release</b></samp>
+ </li>
+ </ul>
+
+ <h4>Running the Tests from within Visual Studio</h4>
+
+ <ol>
+ <li>Run the C++ test suite, "<tt>intltest</tt>". To do this: set the active startup
+ project to "intltest", and press Ctrl+F5 to run it. Make sure that it
+ passes without any errors.</li>
+
+ <li>Run the C test suite, "<tt>cintltst</tt>". To do this: set the active startup
+ project to "cintltst", and press Ctrl+F5 to run it. Make sure that it
+ passes without any errors.</li>
+
+ <li>Run the I/O test suite, "<tt>iotest</tt>". To do this: set the active startup
+ project to "iotest", and press Ctrl+F5 to run it. Make sure that it passes
+ without any errors.</li>
+ </ol>
+ </li>
+
+ <li>You are now able to develop applications with ICU by using the
+ libraries and tools in <tt><i>&lt;ICU&gt;</i>\bin\</tt>. The headers are in
+ <tt><i>&lt;ICU&gt;</i>\include\</tt> and the link libraries are in
+ <tt><i>&lt;ICU&gt;</i>\lib\</tt>. To install the ICU runtime on a machine, or ship
+ it with your application, copy the needed components from
+ <tt><i>&lt;ICU&gt;</i>\bin\</tt> to a location on the system PATH or to your
+ application directory.</li>
+ </ol>
+
+ <p><a name="HowToUseOtherVSVersions" id="HowToUseOtherVSVersions">
+ <strong>Building with other versions of Visual Studio Note:</strong></a>
+ The particular version of the MSVC compiler tool-set (and thus the corresponding version of Visual Studio) that
+ is used to compile ICU is determined by the "<tt>PlatformToolset</tt>" property. This property is stored in two
+ different shared files that are used to set common configuration settings amongst the various ICU "<tt>*.vcxproj</tt>" project files.
+
+ For the non-UWP projects, this setting is in the shared file called "<tt>Build.Windows.ProjectConfiguration.props</tt>" located
+ in the "allinone" directory.
+
+ For the UWP projects, this setting is in the shared file called "<tt>Build.Windows.UWP.ProjectConfiguration.props</tt>", also
+ located in the "allinone" directory.
+ <br/>
+ The value of <tt>v140</tt> corresponds to the Visual Studio 2015 compiler tool set, whereas the value of
+ <tt>v141</tt> corresponds to the Visual Studio 2017 compiler tool set.
+
+ <br/>In order to build the non-UWP projects with Visual Studio 2015 you will need to modify the file
+ called "<tt>Build.Windows.ProjectConfiguration.props</tt>" to change the value of the <tt>PlatformToolset</tt> property.
+
+ Note however that Visual Studio 2017 is required for building the UWP projects.
+ </p>
+
+ <p>Please consider: Using older versions of the MSVC compiler is generally not recommended due to the improved support for the C++11 standard
+ in newer versions of the compiler.</p>
+
+ <p><a name="HowToRetargetTheWin10SDK" id="HowToRetargetTheWin10SDK">
+ <strong>Re-targeting the Windows 10 SDK for the UWP projects Note:</strong></a>
+
+ If the version of the Windows 10 SDK that you have installed does not match the version used by the UWP projects, then you
+ will need to "retarget" them to use the version of the SDK that you have installed instead.
+
+ There are two ways to do this:
+ <ul>
+ <li>In Visual Studio you can right-click on the UWP projects in the 'Solution Explorer' and select the
+ option 'Retarget Projects' from the context menu. This will open up a window where you can select the
+ SDK version to target from a drop-down list of the various SDKs that are installed on the machine.</li>
+
+ <li>Alternatively, you can manually edit the shared file called "<tt>Build.Windows.UWP.ProjectConfiguration.props</tt>"
+ which is located in the "allinone" directory. You will need to change the of the
+ "<tt>WindowsTargetPlatformVersion</tt>" property to the version of the SDK that you would like to use instead.</li>
+ </ul>
+ </p>
+
+ <p><a name="HowToBuildWindowsCommandLine" id=
+ "HowToBuildWindowsCommandLine"><strong>Using MSBUILD At The Command Line Note:</strong></a>
+ You can build ICU from the command line instead of using the Visual Studio GUI.
+
+ Assuming that you have properly installed Visual Studio to support command line building, you
+ should have a shortcut for the "Developer Command Prompt" listed in the Start Menu.
+ (For Visual Studio 2017 you will need to install the "Desktop development with C++" option).</p>
+
+ <ul>
+ <li>Open the "Developer Command Prompt" shortcut from the Start Menu. (This will open up a new command line window).</li>
+ <li>From within the "Developer Command Prompt" change directory (<tt>cd</tt>) to the ICU source directory.</li>
+ <li>You can then use either '<tt>msbuild</tt>' directly, or you can use the '<tt>devenv.com</tt>' command to build ICU.</li>
+ <li>Using <tt>MSBUILD</tt>:</li>
+ <ul class="no-left-margin">
+ <li>To build the 32-bit Debug version, use the following command line:<br/>
+ <code>'msbuild source\allinone\allinone.sln /p:Configuration=Debug /p:Platform=Win32'</code>.</li>
<li>To build the 64-bit Release version, use the following command line:<br/>
- <code>'devenv.com source\allinone\allinone.sln /build "Release|x64"'</code>.</li>
- </ul>
- </ul>
-
- <p><a name="HowToSkipBuildingUWP" id=
- "HowToSkipBuildingUWP"><strong>Skipping the UWP Projects on the Command Line Note:</strong></a>
- You can skip (or omit) building the UWP projects on the command line by passing the argument
- '<code>SkipUWP=true</code>' to either MSBUILD or devenv.</p>
-
- <ul>
- <li>For example, using <tt>MSBUILD</tt>:</li>
- <ul class="no-left-margin">
- <li>To skip building the UWP projects with a 32-bit Debug build, use the following command line:<br/>
- <code>'msbuild source\allinone\allinone.sln /p:Configuration=Debug /p:Platform=Win32 /p:SkipUWP=true'</code>.</li>
- <li>To skip building the UWP projects with a 64-bit Release version, use the following command line:<br/>
- <code>'msbuild source\allinone\allinone.sln /p:Configuration=Release /p:Platform=x64 /p:SkipUWP=true'</code>.</li>
- </ul>
- </ul>
-
- <p>You can also use Cygwin with the MSVC compiler to build ICU, and you can refer to the <a href=
- "#HowToBuildCygwin">How To Build And Install On Windows with Cygwin</a>
- section for more details.</p>
-
- <p><a name="HowToBuildWindowsPlatform" id=
- "HowToBuildWindowsPlatform"><strong>Setting Active Platform
- Note:</strong></a> Even though you are able to select "x64" as the active platform, if your operating system is
- not a 64 bit version of Windows, the build will fail. To set the active platform, two different possibilities are:</p>
-
- <ul>
- <li>Choose "Build" menu, select "Configuration Manager...", and select
- "Win32" or "x64" for the Active Platform Solution.</li>
-
- <li>Another way is to select the desired build configuration from "Solution
- Platforms" dropdown menu from the standard toolbar. It will say
- "Win32" or "x64" in the dropdown list.</li>
- </ul>
-
- <p><a name="HowToBuildWindowsConfig" id=
- "HowToBuildWindowsConfig"><strong>Setting Active Configuration
- Note:</strong></a> To set the active configuration, two different
- possibilities are:</p>
-
- <ul>
- <li>Choose "Build" menu, select "Configuration Manager...", and select
- "Release" or "Debug" for the Active Configuration Solution.</li>
-
- <li>Another way is to select the desired build configuration from "Solution
- Configurations" dropdown menu from the standard toolbar. It will say
- "Release" or "Debug" in the dropdown list.</li>
- </ul>
-
- <p><a name="HowToBuildWindowsBatch" id="HowToBuildWindowsBatch"><strong>Batch
- Configuration Note:</strong></a> If you want to build the Win32 and x64 platforms and
- Debug and Release configurations at the same time, choose "Build" menu, and select "Batch
- Build...". Click the "Select All" button, and then click the "Rebuild"
- button.</p>
-
- <h3><a name="HowToBuildCygwin" href="#HowToBuildCygwin" id=
- "HowToBuildCygwin">How To Build And Install On Windows with Cygwin</a></h3>
-
- <p>Building International Components for Unicode with this configuration
- requires:</p>
-
- <ul>
- <li>Microsoft Windows</li>
-
- <li>Microsoft Visual C++ (from Visual Studio 2015 or newer, when gcc isn't used).</li>
-
- <li>
- Cygwin with the following installed:
-
- <ul>
- <li>bash</li>
-
- <li>GNU make</li>
-
- <li>ar</li>
-
- <li>ranlib</li>
-
- <li>man (if you plan to look at the man pages)</li>
- </ul>
- </li>
- </ul>
-
- <p>There are two ways you can build ICU with Cygwin. You can build with gcc
- or Microsoft Visual C++. If you use gcc, the resulting libraries and tools
- will depend on the Cygwin environment. If you use Microsoft Visual C++, the
- resulting libraries and tools do not depend on Cygwin and can be more easily
- distributed to other Windows computers (the generated man pages and shell
- scripts still need Cygwin). To build with gcc, please follow the "<a href=
- "#HowToBuildUNIX">How To Build And Install On UNIX</a>" instructions, while
- you are inside a Cygwin bash shell. To build with Microsoft Visual C++,
- please use the following instructions:</p>
-
- <ol>
- <li>Start the Windows "Command Prompt" window. This is different from the
- gcc build, which requires the Cygwin Bash command prompt. The Microsoft
- Visual C++ compiler will not work with a bash command prompt.</li>
-
- <li>If the computer isn't set up to use Visual C++ from the command line,
- you need to run vcvars32.bat.<br />For example:<br />
- "<tt>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat</tt>"
- can be used for 32-bit builds <strong>or</strong> <br />
- "<tt>C:\Program Files (x86)\Microsoft Visual Studio 14\VC\bin\x86_amd64\vcvarsx86_amd64.bat</tt>"
- can be used for 64-bit builds on Windows x64.</li>
-
- <li>Unzip the icu-XXXX.zip file into any convenient location. Using command
- line zip, type "unzip -a icu-XXXX.zip -d drive:\directory", or just use
- WinZip.</li>
-
- <li>Change directory to "icu/source", which is where you unzipped ICU.</li>
-
- <li>Run "<tt>bash <a href="source/runConfigureICU">./runConfigureICU</a>
- Cygwin/MSVC</tt>" (See <a href="#HowToWindowsConfigureICU">Windows
- configuration note</a> and non-functional configure options below).</li>
-
- <li>Type <tt>"make"</tt> to compile the libraries and all the data files.
- This make command should be GNU make.</li>
-
- <li>Optionally, type <tt>"make check"</tt> to run the test suite, which
- checks for ICU's functionality integrity (See <a href=
- "#HowToTestWithoutGmake">testing note</a> below).</li>
-
- <li>Type <tt>"make install"</tt> to install ICU. If you used the --prefix=
- option on configure or runConfigureICU, ICU will be installed to the
- directory you specified. (See <a href="#HowToInstallICU">installation
- note</a> below).</li>
- </ol>
-
- <p><a name="HowToWindowsConfigureICU" id=
- "HowToWindowsConfigureICU"><strong>Configuring ICU on Windows
- NOTE:</strong></a> </p>
- <p>
- Ensure that the order of the PATH is MSVC, Cygwin, and then other PATHs. The configure
- script needs certain tools in Cygwin (e.g. grep).
- </p>
- <p>
- Also, you may need to run <tt>"dos2unix.exe"</tt> on all of the scripts (e.g. configure)
- in the top source directory of ICU. To avoid this issue, you can download
- the ICU source for Unix platforms (icu-xxx.tgz).
- </p>
- <p>In addition to the Unix <a href=
- "#HowToConfigureICU">configuration note</a> the following configure options
- currently do not work on Windows with Microsoft's compiler. Some options can
- work by manually editing <tt>icu/source/common/unicode/pwin32.h</tt>, but
- manually editing the files is not recommended.</p>
-
- <ul>
- <li><tt>--disable-renaming</tt></li>
-
- <li><tt>--enable-tracing</tt></li>
-
- <li><tt>--enable-rpath</tt></li>
-
- <li><tt>--enable-static</tt> (Requires that U_STATIC_IMPLEMENTATION be
- defined in user code that links against ICU's static libraries.)</li>
-
- <li><tt>--with-data-packaging=files</tt> (The pkgdata tool currently does
- not work in this mode. Manual packaging is required to use this mode.)</li>
- </ul>
-
- <h3><a name="HowToBuildUNIX" href="#HowToBuildUNIX" id="HowToBuildUNIX">How
- To Build And Install On UNIX</a></h3>
-
- <p>Building International Components for Unicode on UNIX requires:</p>
-
- <ul>
- <li>A C++ compiler installed on the target machine (for example: gcc, CC,
- xlC_r, aCC, cxx, etc...).</li>
-
- <li>An ANSI C compiler installed on the target machine (for example:
- cc).</li>
-
- <li>A recent version of GNU make (3.80+).</li>
-
- <li>For a list of z/OS tools please view the <a href="#HowToBuildZOS">z/OS
- build section</a> of this document for further details.</li>
- </ul>
-
- <p>Here are the steps to build ICU:</p>
-
- <ol>
- <li>Decompress the icu-<i>X</i>.<i>Y</i>.tgz (or
- icu-<i>X</i>.<i>Y</i>.tar.gz) file. For example, <samp>gunzip -d &lt; icu-<i>X</i>.<i>Y</i>.tgz | tar xvf -</samp></li>
-
- <li>Change directory to <code>icu/source</code>.
- <samp>cd icu/source</samp>
- </li>
-
- <li>Some files may have the wrong permissions.<samp>chmod +x runConfigureICU configure install-sh</samp></li>
-
- <li>Run the <span style='font-family: monospace;'><a href="source/runConfigureICU">runConfigureICU</a></span>
- script for your platform. (See <a href="#HowToConfigureICU">configuration
- note</a> below).</li>
-
- <li>Now build: <samp>gmake</samp> (or just <code>make</code> if GNU make is the default make on
- your platform) to compile the libraries and all the data files. The proper
- name of the GNU make command is printed at the end of the configuration
- run, as in <tt>"You must use gmake to compile ICU"</tt>.
- <br/>
- Note that the compilation command output may be simplified on your platform. If this is the case, you will see just:
- <tt>gcc ... stubdata.c</tt>
- rather than
- <tt>gcc -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 -D_REENTRANT -I../common -DU_ATTRIBUTE_DEPRECATED= -O2 -Wall -std=c99 -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -c -DPIC -fPIC -o stubdata.o stubdata.c</tt>
- <br/>
- If you need to see the whole compilation line, use <span style='font-family: monospace;'>"gmake VERBOSE=1"</span>. The full compilation line will print if an error occurs.
- </li>
-
- <li>Optionally,<samp>gmake check</samp> will run the test suite, which
- checks for ICU's functionality integrity (See <a href=
- "#HowToTestWithoutGmake">testing note</a> below).</li>
-
- <li>To install, <samp>gmake install</samp> to install ICU. If you used the --prefix=
- option on configure or runConfigureICU, ICU will be installed to the
- directory you specified. (See <a href="#HowToInstallICU">installation
- note</a> below).</li>
- </ol>
-
- <p><a name="HowToConfigureICU" id="HowToConfigureICU"><strong>Configuring ICU
- NOTE:</strong></a> Type <tt>"./runConfigureICU --help"</tt> for help on how
- to run it and a list of supported platforms. You may also want to type
- <tt>"./configure --help"</tt> to print the available configure options that
- you may want to give runConfigureICU. If you are not using the
- runConfigureICU script, or your platform is not supported by the script, you
- may need to set your CC, CXX, CFLAGS and CXXFLAGS environment variables, and
- type <tt>"./configure"</tt>.
- HP-UX users, please see this <a href="#ImportantNotesHPUX">note regarding
- HP-UX multithreaded build issues</a> with newer compilers. Solaris users,
- please see this <a href="#ImportantNotesSolaris">note regarding Solaris
- multithreaded build issues</a>.</p>
-
- <p>ICU is built with strict compiler warnings enabled by default. If this
- causes excessive numbers of warnings on your platform, use the --disable-strict
- option to configure to reduce the warning level.</p>
-
- <p><a name="HowToTestWithoutGmake" id="HowToTestWithoutGmake"><strong>Running
- The Tests From The Command Line NOTE:</strong></a> You may have to set
- certain variables if you with to run test programs individually, that is
- apart from "gmake check". The environment variable <strong>ICU_DATA</strong>
- can be set to the full pathname of the data directory to indicate where the
- locale data files and conversion mapping tables are when you are not using
- the shared library (e.g. by using the .dat archive or the individual data
- files). The trailing "/" is required after the directory name (e.g.
- "$Root/source/data/out/" will work, but the value "$Root/source/data/out" is
- not acceptable). You do not need to set <strong>ICU_DATA</strong> if the
- complete shared data library is in your library path.</p>
-
- <p><a name="HowToInstallICU" id="HowToInstallICU"><strong>Installing ICU
- NOTE:</strong></a> Some platforms use package management tools to control the
- installation and uninstallation of files on the system, as well as the
- integrity of the system configuration. You may want to check if ICU can be
- packaged for your package management tools by looking into the "packaging"
- directory. (Please note that if you are using a snapshot of ICU from Git, it
- is probable that the packaging scripts or related files are not up to date
- with the contents of ICU at this time, so use them with caution).</p>
-
- <h3><a name="HowToBuildZOS" href="#HowToBuildZOS" id="HowToBuildZOS">How To
- Build And Install On z/OS (OS/390)</a></h3>
-
- <p>You can install ICU on z/OS or OS/390 (the previous name of z/OS), but IBM
- tests only the z/OS installation. You install ICU in a z/OS UNIX system
- services file system such as HFS or zFS. On this platform, it is important
- that you understand a few details:</p>
-
- <ul>
- <li>The makedep and GNU make tools are required for building ICU. If it
- is not already installed on your system, it is available at the <a href=
- "http://www-03.ibm.com/servers/eserver/zseries/zos/unix/bpxa1toy.html">z/OS UNIX -
- Tools and Toys</a> site. The PATH environment variable should be updated to
- contain the location of this executable prior to build. Failure to add these
- tools to your PATH will cause ICU build failures or cause pkgdata to fail
- to run.</li>
-
- <li>Since USS does not support using the mmap() function over NFS, it is
- recommended that you build ICU on a local filesystem. Once ICU has been
- built, you should not have this problem while using ICU when the data
- library has been built as a shared library, which is this is the default
- setting.</li>
-
- <li>Encoding considerations: The source code assumes that it is compiled
- with codepage ibm-1047 (to be exact, the UNIX System Services variant of
- it). The pax command converts all of the source code files from ASCII to
- codepage ibm-1047 (USS) EBCDIC. However, some files are binary files and
- must not be converted, or must be converted back to their original state.
- You can use the <a href="as_is/os390/unpax-icu.sh">unpax-icu.sh</a> script
- to do this for you automatically. It will unpackage the tar file and
- convert all the necessary files for you automatically.</li>
-
- <li>z/OS supports both native S/390 hexadecimal floating point and (with
- OS/390 2.6 and later) IEEE 754 binary floating point. This is a compile
- time option. Applications built with IEEE should use ICU DLLs that are
- built with IEEE (and vice versa). The environment variable IEEE390=0 will
- cause the z/OS version of ICU to be built without IEEE floating point
- support and use the native hexadecimal floating point. By default ICU is
- built with IEEE 754 support. Native floating point support is sufficient
- for codepage conversion, resource bundle and UnicodeString operations, but
- the Format APIs require IEEE binary floating point.</li>
-
- <li>z/OS introduced the concept of Extra Performance Linkage (XPLINK) to
- bring performance improvement opportunities to call-intensive C and C++
- applications such as ICU. XPLINK is enabled on a DLL-by-DLL basis, so if
- you are considering using XPLINK in your application that uses ICU, you
- should consider building the XPLINK-enabled version of ICU. You need to
- set ICU's environment variable <code>OS390_XPLINK=1</code> prior to
- invoking the make process to produce binaries that are enabled for
- XPLINK. The XPLINK option, which is available for z/OS 1.2 and later,
- requires the PTF PQ69418 to build XPLINK enabled binaries.</li>
-
- <li>ICU requires XPLINK for the icuio library. If you want to use the
- rest of ICU without XPLINK, then you must use the --disable-icuio
- configure option.</li>
-
- <li>The latest versions of z/OS use <a
- href="https://www.ibm.com/support/knowledgecenter/SSLTBW_2.2.0/com.ibm.zos.v2r2.cbcux01/oebind6.htm">XPLINK
- version (C128) of the C++ standard library</a> by default. You may see <a
- href="https://www.ibm.com/support/knowledgecenter/SSLTBW_2.2.0/com.ibm.zos.v2r2.cbcux01/oebind5.htm">an
- error</a> when running with XPLINK disabled. To avoid this error,
- set the following environment variable or similar:
-
-<pre><samp>export _CXX_PSYSIX="CEE.SCEELIB(C128N)":"CBC.SCLBSID(IOSTREAM,COMPLEX)"</samp></pre>
- </li>
-
- <li>When building ICU data, the heap size may need to be increased with the following
- environment variable:
-
-<pre><samp>export _CEE_RUNOPTS="HEAPPOOLS(ON),HEAP(4M,1M,ANY,FREE,0K,4080)"</samp></pre>
- </li>
-
-
- <li>The rest of the instructions for building and testing ICU on z/OS with
- UNIX System Services are the same as the <a href="#HowToBuildUNIX">How To
- Build And Install On UNIX</a> section.</li>
- </ul>
-
- <h4>z/OS (Batch/PDS) support outside the UNIX system services
- environment</h4>
-
- <p>By default, ICU builds its libraries into the UNIX file system (HFS). In
- addition, there is a z/OS specific environment variable (OS390BATCH) to build
- some libraries into the z/OS native file system. This is useful, for example,
- when your application is externalized via Job Control Language (JCL).</p>
-
- <p>The OS390BATCH environment variable enables non-UNIX support including the
- batch environment. When OS390BATCH is set, the libicui18n<i>XX</i>.dll,
- libicuuc<i>XX</i>.dll, and libicudt<i>XX</i>e.dll binaries are built into
- data sets (the native file system). Turning on OS390BATCH does not turn off
- the normal z/OS UNIX build. This means that the z/OS UNIX (HFS) DLLs will
- always be created.</p>
-
- <p>Two additional environment variables indicate the names of the z/OS data
- sets to use. The LOADMOD environment variable identifies the name of the data
- set that contains the dynamic link libraries (DLLs) and the LOADEXP
- environment variable identifies the name of the data set that contains the
- side decks, which are normally the files with the .x suffix in the UNIX file
- system.</p>
-
- <p>A data set is roughly equivalent to a UNIX or Windows file. For most kinds
- of data sets the operating system maintains record boundaries. UNIX and
- Windows files are byte streams. Two kinds of data sets are PDS and PDSE. Each
- data set of these two types contains a directory. It is like a UNIX
- directory. Each "file" is called a "member". Each member name is limited to
- eight bytes, normally EBCDIC.</p>
-
- <p>Here is an example of some environment variables that you can set prior to
- building ICU:</p>
-<pre>
-<samp>OS390BATCH=1
-LOADMOD=<i>USER</i>.ICU.LOAD
-LOADEXP=<i>USER</i>.ICU.EXP</samp>
-</pre>
-
- <p>The PDS member names for the DLL file names are as follows:</p>
-<pre>
-<samp>IXMI<i>XX</i>IN --&gt; libicui18n<i>XX</i>.dll
-IXMI<i>XX</i>UC --&gt; libicuuc<i>XX</i>.dll
-IXMI<i>XX</i>DA --&gt; libicudt<i>XX</i>e.dll</samp>
-</pre>
-
- <p>You should point the LOADMOD environment variable at a partitioned data
- set extended (PDSE) and point the LOADEXP environment variable at a
- partitioned data set (PDS). The PDSE can be allocated with the following
- attributes:</p>
-<pre>
-<samp>Data Set Name . . . : <i>USER</i>.ICU.LOAD
-Management class. . : <i>**None**</i>
-Storage class . . . : <i>BASE</i>
-Volume serial . . . : <i>TSO007</i>
-Device type . . . . : <i>3390</i>
-Data class. . . . . : <i>LOAD</i>
-Organization . . . : PO
-Record format . . . : U
-Record length . . . : 0
-Block size . . . . : <i>32760</i>
-1st extent cylinders: 1
-Secondary cylinders : 5
-Data set name type : LIBRARY</samp>
-</pre>
-
- <p>The PDS can be allocated with the following attributes:</p>
-<pre>
-<samp>Data Set Name . . . : <i>USER</i>.ICU.EXP
-Management class. . : <i>**None**</i>
-Storage class . . . : <i>BASE</i>
-Volume serial . . . : <i>TSO007</i>
-Device type . . . . : <i>3390</i>
-Data class. . . . . : <i>**None**</i>
-Organization . . . : PO
-Record format . . . : FB
-Record length . . . : 80
-Block size . . . . : <i>3200</i>
-1st extent cylinders: 3
-Secondary cylinders : 3
-Data set name type : PDS</samp>
-</pre>
-
- <h3><a name="HowToBuildOS400" href="#HowToBuildOS400" id=
- "HowToBuildOS400">How To Build And Install On The IBM i Family (IBM i, i5/OS OS/400)</a></h3>
-
- <p>Before you start building ICU, ICU requires the following:</p>
-
- <ul>
- <li>QSHELL interpreter installed (install base option 30, operating system)
- <!--li>QShell Utilities, PRPQ 5799-XEH (not required for V4R5)</li--></li>
-
- <li>ILE C/C++ Compiler installed on the system</li>
-
- <li>The latest IBM tools for Developers for IBM i &mdash;
- <a href='https://www-356.ibm.com/partnerworld/wps/servlet/ContentHandler/pw_com_porting_tools_index'>https://www-356.ibm.com/partnerworld/wps/servlet/ContentHandler/pw_com_porting_tools_index</a>
- <!-- formerly http://www.ibm.com/servers/enable/site/porting/tools/'>http://www.ibm.com/servers/enable/site/porting/tools/</a> -->
- <!-- formerly: http://www.ibm.com/servers/enable/site/porting/iseries/overview/gnu_utilities.html -->
- </li>
- </ul>
-
- <p>The following describes how to setup and build ICU. For background
- information, you should look at the <a href="#HowToBuildUNIX">UNIX build
- instructions</a>.</p>
-
- <ol>
- <li>
- Copy the ICU source .tgz to the IBM i environment, as binary.
- Also, copy the <a href='as_is/os400/unpax-icu.sh'>unpax-icu.sh</a> script into the same directory, as a text file.
- </li>
-
- <li>
- Create target library. This library will be the target for the
- resulting modules, programs and service programs. You will specify this
- library on the OUTPUTDIR environment variable.
-<pre>
-<samp>CRTLIB LIB(<i>libraryname</i>)
-ADDENVVAR ENVVAR(OUTPUTDIR) VALUE('<i>libraryname</i>') REPLACE(*YES) </samp></pre>
- </li>
-
- <li>
- Set up the following environment variables and job characteristics in your build process
-<pre>
-<samp>ADDENVVAR ENVVAR(MAKE) VALUE('gmake') REPLACE(*YES)
-CHGJOB CCSID(37)</samp></pre></li>
-
- <li>Fire up the QSH <i>(all subsequent commands are run inside the qsh session.)</i>
- <pre><samp>qsh</samp></pre>
- </li>
-
- <li>Set up the PATH: <pre><samp>export PATH=/QIBM/ProdData/DeveloperTools/qsh/bin:$PATH:/QOpenSys/usr/bin</samp></pre>
- </li>
-
- <li>Unpack the ICU source code archive:
- <pre><samp>gzip -d icu-<i>X</i>.<i>Y</i>.tgz</samp></pre>
- </li>
-
- <li>Run unpax-icu.sh on the tar file generated from the previous step.
- <pre><samp>unpax-icu.sh icu.tar</samp></pre></li>
-
- <li>Build the program ICULD which ICU will use for linkage.
- <pre><samp>cd icu/as_is/os400
-qsh bldiculd.sh
-cd ../../..</samp></pre>
- </li>
-
- <li>Change into the 'source' directory, and configure ICU. (See <a href="#HowToConfigureICU">configuration
- note</a> for details). Note that --with-data-packaging=archive and setting the --prefix are recommended, building in default (dll) mode is currently not supported.
- <pre><samp>cd icu/source
-./runConfigureICU IBMi --prefix=<i>/path/to/somewhere</i> --with-data-packaging=archive</samp></pre>
-</li>
-
- <li>Build ICU. <i>(Note: Do not use the -j option)</i> <pre><samp>gmake</samp></pre></li>
-
- <li>Test ICU. <pre><samp>gmake check</samp></pre>
- (The <tt> QIBM_MULTI_THREADED=Y</tt> flag will be automatically applied to intltest -
- you can look at the <a href=
- "https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzahw/rzahwceeco.htm">
- iSeries Information Center</a> for more details regarding the running of multiple threads
- on IBM i.)</li>
- </ol>
-
- <!-- cross -->
- <h3><a name="HowToCrossCompileICU" href="#HowToCrossCompileICU" id="HowToCrossCompileICU">How To Cross Compile ICU</a></h3>
- <p>This section will explain how to build ICU on one platform, but to produce binaries intended to run on another. This is commonly known as a cross compile.</p>
- <p>Normally, in the course of a build, ICU needs to run the tools that it builds in order to generate and package data and test-data.In a cross compilation setting, ICU is built on a different system from that which it eventually runs on. An example might be, if you are building for a small/headless system (such as an embedded device), or a system where you can't easily run the ICU command line tools (any non-UNIX-like system).</p>
- <p>To reduce confusion, we will here refer to the "A" and the "B" system.System "A" is the actual system we will be running on- the only requirements on it is are it is able to build ICU from the command line targetting itself (with configure or runConfigureICU), and secondly, that it also contain the correct toolchain for compiling and linking for the resultant platform, referred to as the "B" system.</p>
- <p>The autoconf docs use the term "build" for A, and "host" for B. More details at: <a href="http://www.gnu.org/software/autoconf/manual/html_node/Specifying-Names.html#Specifying-Names">http://www.gnu.org/software/autoconf/manual/html_node/Specifying-Names.html</a></p>
- <p>Three initially-empty directories will be used in this example:</p>
- <table summary="Three directories used in this example" class="docTable">
- <tr>
- <th align="left">/icu</th><td>a copy of the ICU source</td>
- </tr>
- <tr>
- <th align="left">/buildA</th><td>an empty directory, it will contain ICU built for A<br />(MacOSX in this case)</td>
- </tr>
- <tr>
- <th align="left">/buildB</th><td>an empty directory, it will contain ICU built for B<br />(HaikuOS in this case)</td>
- </tr>
- </table>
-
- <ol>
- <li>Check out or unpack the ICU source code into the /icu directory.You will have the directories /icu/source, etc.</li>
- <li>Build ICU in /buildA normally (using runConfigureICU or configure):
-<pre class="samp">cd /buildA
-sh /icu/source/runConfigureICU <strong>MacOSX</strong>
-gnumake
-</pre>
- </li>
- <li>Set PATH or other variables as needed, such as CPPFLAGS.</li>
- <li>Build ICU in /buildB<br />
- <p class="note">"<code>--with-cross-build</code>" takes an absolute path.</p>
-<pre class="samp">cd /buildB
-sh /icu/source/configure --host=<strong>i586-pc-haiku</strong> --with-cross-build=<strong>/buildA</strong>
-gnumake</pre>
- </li>
- <li>Tests and testdata can be built with "gnumake tests".</li>
- </ol>
- <!-- end cross -->
-
- <!-- end build environment -->
-
- <h2><a name="HowToPackage" href="#HowToPackage" id="HowToPackage">How To
- Package ICU</a></h2>
-
- <p>There are many ways that a person can package ICU with their software
- products. Usually only the libraries need to be considered for packaging.</p>
-
- <p>On UNIX, you should use "<tt>gmake install</tt>" to make it easier to
- develop and package ICU. The bin, lib and include directories are needed to
- develop applications that use ICU. These directories will be created relative
- to the "<tt>--prefix=</tt><i>dir</i>" configure option (See the <a href=
- "#HowToBuildUNIX">UNIX build instructions</a>). When ICU is built on Windows,
- a similar directory structure is built.</p>
-
- <p>When changes have been made to the standard ICU distribution, it is
- recommended that at least one of the following guidelines be followed for
- special packaging.</p>
-
- <ol>
- <li>Add a suffix name to the library names. This can be done with the
- --with-library-suffix configure option.</li>
-
- <li>The installation script should install the ICU libraries into the
- application's directory.</li>
- </ol>
-
- <p>Following these guidelines prevents other applications that use a standard
- ICU distribution from conflicting with any libraries that you need. On
- operating systems that do not have a standard C++ ABI (name mangling) for
- compilers, it is recommended to do this special packaging anyway. More
- details on customizing ICU are available in the <a href=
- "http://userguide.icu-project.org/">User's Guide</a>. The <a href=
- "#SourceCode">ICU Source Code Organization</a> section of this readme.html
- gives a more complete description of the libraries.</p>
-
- <table class="docTable" summary=
- "ICU has several libraries for you to use.">
- <caption>
- Here is an example of libraries that are frequently packaged.
- </caption>
-
- <tr>
- <th scope="col">Library Name</th>
-
- <th scope="col">Windows Filename</th>
-
- <th scope="col">Linux Filename</th>
-
- <th scope="col">Comment</th>
- </tr>
-
- <tr>
- <td>Data Library</td>
-
- <td>icudt<i>XY</i>l.dll</td>
-
- <td>libicudata.so.<i>XY</i>.<i>Z</i></td>
-
- <td>Data required by the Common and I18n libraries. There are many ways
- to package and <a href=
- "http://userguide.icu-project.org/icudata">customize this
- data</a>, but by default this is all you need.</td>
- </tr>
-
- <tr>
- <td>Common Library</td>
-
- <td>icuuc<i>XY</i>.dll</td>
-
- <td>libicuuc.so.<i>XY</i>.<i>Z</i></td>
-
- <td>Base library required by all other ICU libraries.</td>
- </tr>
-
- <tr>
- <td>Internationalization (i18n) Library</td>
-
- <td>icuin<i>XY</i>.dll</td>
-
- <td>libicui18n.so.<i>XY</i>.<i>Z</i></td>
-
- <td>A library that contains many locale based internationalization (i18n)
- functions.</td>
- </tr>
-
- <tr>
- <td>Layout Extensions Engine</td>
-
- <td>iculx<i>XY</i>.dll</td>
-
- <td>libiculx.so.<i>XY</i>.<i>Z</i></td>
-
- <td>An optional engine for doing paragraph layout that uses
- parts of ICU.
- HarfBuzz is required.</td>
- </tr>
-
- <tr>
- <td>ICU I/O (Unicode stdio) Library</td>
-
- <td>icuio<i>XY</i>.dll</td>
-
- <td>libicuio.so.<i>XY</i>.<i>Z</i></td>
-
- <td>An optional library that provides a stdio like API with Unicode
- support.</td>
- </tr>
-
- <tr>
- <td>Tool Utility Library</td>
-
- <td>icutu<i>XY</i>.dll</td>
-
- <td>libicutu.so.<i>XY</i>.<i>Z</i></td>
-
- <td>An internal library that contains internal APIs that are only used by
- ICU's tools. If you do not use ICU's tools, you do not need this
- library.</td>
- </tr>
- </table>
-
- <p>Normally only the above ICU libraries need to be considered for packaging.
- The versionless symbolic links to these libraries are only needed for easier
- development. The <i>X</i>, <i>Y</i> and <i>Z</i> parts of the name are the
- version numbers of ICU. For example, ICU 2.0.2 would have the name
- libicuuc.so.20.2 for the common library. The exact format of the library
- names can vary between platforms due to how each platform can handles library
- versioning.</p>
-
- <h2><a name="ImportantNotes" href="#ImportantNotes" id=
- "ImportantNotes">Important Notes About Using ICU</a></h2>
-
- <h3><a name="ImportantNotesMultithreaded" href="#ImportantNotesMultithreaded"
- id="ImportantNotesMultithreaded">Using ICU in a Multithreaded
- Environment</a></h3>
-
- <p>Some versions of ICU require calling the <code>u_init()</code> function
- from <code>uclean.h</code> to ensure that ICU is initialized properly. In
- those ICU versions, <code>u_init()</code> must be called before ICU is used
- from multiple threads. There is no harm in calling <code>u_init()</code> in a
- single-threaded application, on a single-CPU machine, or in other cases where
- <code>u_init()</code> is not required.</p>
-
- <p>In addition to ensuring thread safety, <code>u_init()</code> also attempts
- to load at least one ICU data file. Assuming that all data files are packaged
- together (or are in the same folder in files mode), a failure code from
- <code>u_init()</code> usually means that the data cannot be found. In this
- case, the data may not be installed properly, or the application may have
- failed to call <code>udata_setCommonData()</code> or
- <code>u_setDataDirectory()</code> which specify to ICU where it can find its
- data.</p>
-
- <p>Since <code>u_init()</code> will load only one or two data files, it
- cannot guarantee that all of the data that an application needs is available.
- It cannot check for all data files because the set of files is customizable,
- and some ICU services work without loading any data at all. An application
- should always check for error codes when opening ICU service objects (using
- <code>ucnv_open()</code>, <code>ucol_open()</code>, C++ constructors,
- etc.).</p>
-
- <h4>ICU 3.4 and later</h4>
-
- <p>ICU 3.4 self-initializes properly for multi-threaded use. It achieves this
- without performance penalty by hardcoding the core Unicode properties data,
- at the cost of some flexibility. (For details see Jitterbug 4497.)</p>
-
- <p><code>u_init()</code> can be used to check for data loading. It tries to
- load the converter alias table (<code>cnvalias.icu</code>).</p>
-
- <h4>ICU 2.6..3.2</h4>
-
- <p>These ICU versions require a call to <code>u_init()</code> before
- multi-threaded use. The services that are directly affected are those that
- don't have a service object and need to be fast: normalization and character
- properties.</p>
-
- <p><code>u_init()</code> loads and initializes the data files for
- normalization and character properties (<code>unorm.icu</code> and
- <code>uprops.icu</code>) and can therefore also be used to check for data
- loading.</p>
-
- <h4>ICU 2.4 and earlier</h4>
-
- <p>ICU 2.4 and earlier versions were not prepared for multithreaded use on
- multi-CPU platforms where the CPUs implement weak memory coherency. These
- CPUs include: Power4, Power5, Alpha, Itanium. <code>u_init()</code> was not
- defined yet.</p>
-
- <h4><a name="ImportantNotesHPUX" href="#ImportantNotesHPUX" id=
- "ImportantNotesHPUX">Using ICU in a Multithreaded Environment on
- HP-UX</a></h4>
-
- <p>When ICU is built with aCC on HP-UX, the <a
- href="http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801?ciid=eb08b3f1eee02110b3f1eee02110275d6e10RCRD">-AA</a>
- compiler flag is used. It is required in order to use the latest
- &lt;iostream&gt; API in a thread safe manner. This compiler flag affects the
- version of the C++ library being used. Your applications will also need to
- be compiled with -AA in order to use ICU.</p>
-
- <h4><a name="ImportantNotesSolaris" href="#ImportantNotesSolaris" id=
- "ImportantNotesSolaris">Using ICU in a Multithreaded Environment on
- Solaris</a></h4>
-
- <h5>Linking on Solaris</h5>
-
- <p>In order to avoid synchronization and threading issues, developers are
- <strong>suggested</strong> to strictly follow the compiling and linking
- guidelines for multithreaded applications, specified in the following
- SUn Solaris document available from Oracle. Most notably, pay strict attention to the
- following statements from Sun:</p>
-
- <blockquote>
- <p>To use libthread, specify -lthread before -lc on the ld command line, or
- last on the cc command line.</p>
-
- <p>To use libpthread, specify -lpthread before -lc on the ld command line,
- or last on the cc command line.</p>
- </blockquote>
-
- <p>Failure to do this may cause spurious lock conflicts, recursive mutex
- failure, and deadlock.</p>
-
- <p>Source: "<i>Multithreaded Programming Guide, Compiling and
- Debugging</i>", Sun Microsystems, 2002 <br />
- <a href=
- "https://docs.oracle.com/cd/E19683-01/806-6867/compile-74765/index.html">https://docs.oracle.com/cd/E19683-01/806-6867/compile-74765/index.html</a></p>
-
- <p>Note, a version of that chapter from a 2008 document update covering both Solaris 9
- and Solaris 10 is available here:<br />
- <a href=
- "http://docs.oracle.com/cd/E19253-01/816-5137/compile-94179/index.html">http://docs.oracle.com/cd/E19253-01/816-5137/compile-94179/index.html</a></p>
-
- <h3><a name="ImportantNotesWindows" href="#ImportantNotesWindows" id=
- "ImportantNotesWindows">Windows Platform</a></h3>
-
- <p>If you are building on the Windows platform, it is important that you
- understand a few of the following build details.</p>
-
- <h4>DLL directories and the PATH setting</h4>
-
- <p>As delivered, the International Components for Unicode build as several
- DLLs, which are placed in the "<i>&lt;ICU&gt;</i>\bin64" directory. You must
- add this directory to the PATH environment variable in your system, or any
- executables you build will not be able to access International Components for
- Unicode libraries. Alternatively, you can copy the DLL files into a directory
- already in your PATH, but we do not recommend this. You can wind up with
- multiple copies of the DLL and wind up using the wrong one.</p>
-
- <h4><a name="ImportantNotesWindowsPath" id=
- "ImportantNotesWindowsPath">Changing your PATH</a></h4>
-
- <p><strong>Windows 2000/XP and above</strong>: Use the System Icon in the Control
- Panel. Pick the "Advanced" tab. Select the "Environment Variables..."
- button. Select the variable PATH in the lower box, and select the lower
- "Edit..." button. In the "Variable Value" box, append the string
- ";<i>&lt;ICU&gt;</i>\bin64" to the end of the path string. If there is
- nothing there, just type in "<i>&lt;ICU&gt;</i>\bin64". Click the Set button,
- then the OK button.</p>
-
- <p>Note: When packaging a Windows application for distribution and
- installation on user systems, copies of the ICU DLLs should be included with
- the application, and installed for exclusive use by the application. This is
- the only way to insure that your application is running with the same version
- of ICU, built with exactly the same options, that you developed and tested
- with. Refer to Microsoft's guidelines on the usage of DLLs, or search for the
- phrase "DLL hell" on <a href=
- "http://msdn.microsoft.com/">msdn.microsoft.com</a>.</p>
-
- <h3><a name="ImportantNotesUNIX" href="#ImportantNotesUNIX" id=
- "ImportantNotesUNIX">UNIX Type Platform</a></h3>
-
- <p>If you are building on a UNIX platform, and if you are installing ICU in a
- non-standard location, you may need to add the location of your ICU libraries
- to your <strong>LD_LIBRARY_PATH</strong> or <strong>LIBPATH</strong>
- environment variable (or the equivalent runtime library path environment
- variable for your system). The ICU libraries may not link or load properly
- without doing this.</p>
-
- <p>Note that if you do not want to have to set this variable, you may instead
- use the --enable-rpath option at configuration time. This option will
- instruct the linker to always look for the libraries where they are
- installed. You will need to use the appropriate linker options when linking
- your own applications and libraries against ICU, too. Please refer to your
- system's linker manual for information about runtime paths. The use of rpath
- also means that when building a new version of ICU you should not have an
- older version installed in the same place as the new version's installation
- directory, as the older libraries will used during the build, instead of the
- new ones, likely leading to an incorrectly build ICU. This is the proper
- behavior of rpath.</p>
-
- <h2><a name="PlatformDependencies" href="#PlatformDependencies" id=
- "PlatformDependencies">Platform Dependencies</a></h2>
-
- <h3><a name="PlatformDependenciesNew" href="#PlatformDependenciesNew" id=
- "PlatformDependenciesNew">Porting To A New Platform</a></h3>
-
- <p>If you are using ICU's Makefiles to build ICU on a new platform, there are
- a few places where you will need to add or modify some files. If you need
- more help, you can always ask the <a href=
- "http://site.icu-project.org/contacts">icu-support mailing list</a>. Once
- you have finished porting ICU to a new platform, it is recommended that you
- contribute your changes back to ICU via the icu-support mailing list. This
- will make it easier for everyone to benefit from your work.</p>
-
- <h4>Data For a New Platform</h4>
-
- <p>For some people, it may not be necessary for completely build ICU. Most of
- the makefiles and build targets are for tools that are used for building
- ICU's data, and an application's data (when an application uses ICU resource
- bundles for its data).</p>
-
- <p>Data files can be built on a different platform when both platforms share
- the same endianness and the same charset family. This assertion does not
- include platform dependent DLLs/shared/static libraries. For details see the
- User Guide <a href="http://userguide.icu-project.org/icudata">ICU
- Data</a> chapter.</p>
-
- <p>ICU 3.6 removes the requirement that ICU be completely built in the native
- operating environment. It adds the icupkg tool which can be run on any
- platform to turn binary ICU data files from any one of the three formats into
- any one of the other data formats. This allows a application to use ICU data
- built anywhere to be used for any other target platform.</p>
-
- <p><strong>WARNING!</strong> Building ICU without running the tests is not
- recommended. The tests verify that ICU is safe to use. It is recommended that
- you try to completely port and test ICU before using the libraries for your
- own application.</p>
-
- <h4>Adapting Makefiles For a New Platform</h4>
-
- <p>Try to follow the build steps from the <a href="#HowToBuildUNIX">UNIX</a>
- build instructions. If the configure script fails, then you will need to
- modify some files. Here are the usual steps for porting to a new
- platform:<br />
- </p>
-
- <ol>
- <li>Create an mh file in icu/source/config/. You can use mh-linux or a
- similar mh file as your base configuration.</li>
-
- <li>Modify icu/source/aclocal.m4 to recognize your platform's mh file.</li>
-
- <li>Modify icu/source/configure.in to properly set your <b>platform</b> C
- Macro define.</li>
-
- <li>Run <a href="http://www.gnu.org/software/autoconf/">autoconf</a> in
- icu/source/ without any options. The autoconf tool is standard on most
- Linux systems.</li>
-
- <li>If you have any optimization options that you want to normally use, you
- can modify icu/source/runConfigureICU to specify those options for your
- platform.</li>
-
- <li>Build and test ICU on your platform. It is very important that you run
- the tests. If you don't run the tests, there is no guarentee that you have
- properly ported ICU.</li>
- </ol>
-
- <h3><a name="PlatformDependenciesImpl" href="#PlatformDependenciesImpl" id=
- "PlatformDependenciesImpl">Platform Dependent Implementations</a></h3>
-
- <p>The platform dependencies have been mostly isolated into the following
- files in the common library. This information can be useful if you are
- porting ICU to a new platform.</p>
-
- <ul>
- <li>
- <strong>unicode/platform.h.in</strong> (autoconf'ed platforms)<br />
- <strong>unicode/p<i>XXXX</i>.h</strong> (others: pwin32.h, ppalmos.h,
- ..): Platform-dependent typedefs and defines:<br />
- <br />
-
-
- <ul>
- <li>Generic types like UBool, int8_t, int16_t, int32_t, int64_t,
- uint64_t etc.</li>
-
- <li>U_EXPORT and U_IMPORT for specifying dynamic library import and
- export</li>
-
- <li>String handling support for the char16_t and wchar_t types.</li>
- </ul>
- <br />
- </li>
-
- <li>
- <strong>unicode/putil.h, putil.c</strong>: platform-dependent
- implementations of various functions that are platform dependent:<br />
- <br />
-
-
- <ul>
- <li>uprv_isNaN, uprv_isInfinite, uprv_getNaN and uprv_getInfinity for
- handling special floating point values.</li>
-
- <li>uprv_tzset, uprv_timezone, uprv_tzname and time for getting
- platform specific time and time zone information.</li>
-
- <li>u_getDataDirectory for getting the default data directory.</li>
-
- <li>uprv_getDefaultLocaleID for getting the default locale
- setting.</li>
-
- <li>uprv_getDefaultCodepage for getting the default codepage
- encoding.</li>
- </ul>
- <br />
- </li>
-
- <li>
- <strong>umutex.h, umutex.c</strong>: Code for doing synchronization in
- multithreaded applications. If you wish to use International Components
- for Unicode in a multithreaded application, you must provide a
- synchronization primitive that the classes can use to protect their
- global data against simultaneous modifications. We already supply working
- implementations for many platforms that ICU builds on.<br />
- <br />
- </li>
-
- <li><strong>umapfile.h, umapfile.c</strong>: functions for mapping or
- otherwise reading or loading files into memory. All access by ICU to data
- from files makes use of these functions.<br />
- <br />
- </li>
-
- <li>Using platform specific #ifdef macros are highly discouraged outside of
- the scope of these files. When the source code gets updated in the future,
- these #ifdef's can cause testing problems for your platform.</li>
- </ul>
- <hr />
- <p> Copyright &copy; 2016 and later: Unicode, Inc. and others. License &amp; terms of use:
- <a href="http://www.unicode.org/copyright.html">http://www.unicode.org/copyright.html</a><br/>
- Copyright &copy; 1997-2016 International Business Machines Corporation and others.
- All Rights Reserved.</p>
- </body>
-</html>
+ <code>'msbuild source\allinone\allinone.sln /p:Configuration=Release /p:Platform=x64'</code>.</li>
+ </ul>
+ <li>Using <tt>devenv.com</tt>:</li>
+ <ul class="no-left-margin">
+ <li>To build the 32-bit Debug version, use the following command line:<br/>
+ <code>'devenv.com source\allinone\allinone.sln /build "Debug|Win32"'</code>.</li>
+ <li>To build the 64-bit Release version, use the following command line:<br/>
+ <code>'devenv.com source\allinone\allinone.sln /build "Release|x64"'</code>.</li>
+ </ul>
+ </ul>
+
+ <p><a name="HowToSkipBuildingUWP" id=
+ "HowToSkipBuildingUWP"><strong>Skipping the UWP Projects on the Command Line Note:</strong></a>
+ You can skip (or omit) building the UWP projects on the command line by passing the argument
+ '<code>SkipUWP=true</code>' to either MSBUILD or devenv.</p>
+
+ <ul>
+ <li>For example, using <tt>MSBUILD</tt>:</li>
+ <ul class="no-left-margin">
+ <li>To skip building the UWP projects with a 32-bit Debug build, use the following command line:<br/>
+ <code>'msbuild source\allinone\allinone.sln /p:Configuration=Debug /p:Platform=Win32 /p:SkipUWP=true'</code>.</li>
+ <li>To skip building the UWP projects with a 64-bit Release version, use the following command line:<br/>
+ <code>'msbuild source\allinone\allinone.sln /p:Configuration=Release /p:Platform=x64 /p:SkipUWP=true'</code>.</li>
+ </ul>
+ </ul>
+
+ <p>You can also use Cygwin with the MSVC compiler to build ICU, and you can refer to the <a href=
+ "#HowToBuildCygwin">How To Build And Install On Windows with Cygwin</a>
+ section for more details.</p>
+
+ <p><a name="HowToBuildWindowsPlatform" id=
+ "HowToBuildWindowsPlatform"><strong>Setting Active Platform
+ Note:</strong></a> Even though you are able to select "x64" as the active platform, if your operating system is
+ not a 64 bit version of Windows, the build will fail. To set the active platform, two different possibilities are:</p>
+
+ <ul>
+ <li>Choose "Build" menu, select "Configuration Manager...", and select
+ "Win32" or "x64" for the Active Platform Solution.</li>
+
+ <li>Another way is to select the desired build configuration from "Solution
+ Platforms" dropdown menu from the standard toolbar. It will say
+ "Win32" or "x64" in the dropdown list.</li>
+ </ul>
+
+ <p><a name="HowToBuildWindowsConfig" id=
+ "HowToBuildWindowsConfig"><strong>Setting Active Configuration
+ Note:</strong></a> To set the active configuration, two different
+ possibilities are:</p>
+
+ <ul>
+ <li>Choose "Build" menu, select "Configuration Manager...", and select
+ "Release" or "Debug" for the Active Configuration Solution.</li>
+
+ <li>Another way is to select the desired build configuration from "Solution
+ Configurations" dropdown menu from the standard toolbar. It will say
+ "Release" or "Debug" in the dropdown list.</li>
+ </ul>
+
+ <p><a name="HowToBuildWindowsBatch" id="HowToBuildWindowsBatch"><strong>Batch
+ Configuration Note:</strong></a> If you want to build the Win32 and x64 platforms and
+ Debug and Release configurations at the same time, choose "Build" menu, and select "Batch
+ Build...". Click the "Select All" button, and then click the "Rebuild"
+ button.</p>
+
+ <h3><a name="HowToBuildCygwin" href="#HowToBuildCygwin" id=
+ "HowToBuildCygwin">How To Build And Install On Windows with Cygwin</a></h3>
+
+ <p>Building International Components for Unicode with this configuration
+ requires:</p>
+
+ <ul>
+ <li>Microsoft Windows</li>
+
+ <li>Microsoft Visual C++ (from Visual Studio 2015 or newer, when gcc isn't used).</li>
+
+ <li>
+ Cygwin with the following installed:
+
+ <ul>
+ <li>bash</li>
+
+ <li>GNU make</li>
+
+ <li>ar</li>
+
+ <li>ranlib</li>
+
+ <li>man (if you plan to look at the man pages)</li>
+ </ul>
+ </li>
+ </ul>
+
+ <p>There are two ways you can build ICU with Cygwin. You can build with gcc
+ or Microsoft Visual C++. If you use gcc, the resulting libraries and tools
+ will depend on the Cygwin environment. If you use Microsoft Visual C++, the
+ resulting libraries and tools do not depend on Cygwin and can be more easily
+ distributed to other Windows computers (the generated man pages and shell
+ scripts still need Cygwin). To build with gcc, please follow the "<a href=
+ "#HowToBuildUNIX">How To Build And Install On UNIX</a>" instructions, while
+ you are inside a Cygwin bash shell. To build with Microsoft Visual C++,
+ please use the following instructions:</p>
+
+ <ol>
+ <li>Start the Windows "Command Prompt" window. This is different from the
+ gcc build, which requires the Cygwin Bash command prompt. The Microsoft
+ Visual C++ compiler will not work with a bash command prompt.</li>
+
+ <li>If the computer isn't set up to use Visual C++ from the command line,
+ you need to run vcvars32.bat.<br />For example:<br />
+ "<tt>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat</tt>"
+ can be used for 32-bit builds <strong>or</strong> <br />
+ "<tt>C:\Program Files (x86)\Microsoft Visual Studio 14\VC\bin\x86_amd64\vcvarsx86_amd64.bat</tt>"
+ can be used for 64-bit builds on Windows x64.</li>
+
+ <li>Unzip the icu-XXXX.zip file into any convenient location. Using command
+ line zip, type "unzip -a icu-XXXX.zip -d drive:\directory", or just use
+ WinZip.</li>
+
+ <li>Change directory to "icu/source", which is where you unzipped ICU.</li>
+
+ <li>Run "<tt>bash <a href="source/runConfigureICU">./runConfigureICU</a>
+ Cygwin/MSVC</tt>" (See <a href="#HowToWindowsConfigureICU">Windows
+ configuration note</a> and non-functional configure options below).</li>
+
+ <li>Type <tt>"make"</tt> to compile the libraries and all the data files.
+ This make command should be GNU make.</li>
+
+ <li>Optionally, type <tt>"make check"</tt> to run the test suite, which
+ checks for ICU's functionality integrity (See <a href=
+ "#HowToTestWithoutGmake">testing note</a> below).</li>
+
+ <li>Type <tt>"make install"</tt> to install ICU. If you used the --prefix=
+ option on configure or runConfigureICU, ICU will be installed to the
+ directory you specified. (See <a href="#HowToInstallICU">installation
+ note</a> below).</li>
+ </ol>
+
+ <p><a name="HowToWindowsConfigureICU" id=
+ "HowToWindowsConfigureICU"><strong>Configuring ICU on Windows
+ NOTE:</strong></a> </p>
+ <p>
+ Ensure that the order of the PATH is MSVC, Cygwin, and then other PATHs. The configure
+ script needs certain tools in Cygwin (e.g. grep).
+ </p>
+ <p>
+ Also, you may need to run <tt>"dos2unix.exe"</tt> on all of the scripts (e.g. configure)
+ in the top source directory of ICU. To avoid this issue, you can download
+ the ICU source for Unix platforms (icu-xxx.tgz).
+ </p>
+ <p>In addition to the Unix <a href=
+ "#HowToConfigureICU">configuration note</a> the following configure options
+ currently do not work on Windows with Microsoft's compiler. Some options can
+ work by manually editing <tt>icu/source/common/unicode/pwin32.h</tt>, but
+ manually editing the files is not recommended.</p>
+
+ <ul>
+ <li><tt>--disable-renaming</tt></li>
+
+ <li><tt>--enable-tracing</tt></li>
+
+ <li><tt>--enable-rpath</tt></li>
+
+ <li><tt>--enable-static</tt> (Requires that U_STATIC_IMPLEMENTATION be
+ defined in user code that links against ICU's static libraries.)</li>
+
+ <li><tt>--with-data-packaging=files</tt> (The pkgdata tool currently does
+ not work in this mode. Manual packaging is required to use this mode.)</li>
+ </ul>
+
+ <h3><a name="HowToBuildUNIX" href="#HowToBuildUNIX" id="HowToBuildUNIX">How
+ To Build And Install On UNIX</a></h3>
+
+ <p>Building International Components for Unicode on UNIX requires:</p>
+
+ <ul>
+ <li>A C++ compiler installed on the target machine (for example: gcc, CC,
+ xlC_r, aCC, cxx, etc...).</li>
+
+ <li>An ANSI C compiler installed on the target machine (for example:
+ cc).</li>
+
+ <li>A recent version of GNU make (3.80+).</li>
+
+ <li>For a list of z/OS tools please view the <a href="#HowToBuildZOS">z/OS
+ build section</a> of this document for further details.</li>
+ </ul>
+
+ <p>Here are the steps to build ICU:</p>
+
+ <ol>
+ <li>Decompress the icu-<i>X</i>.<i>Y</i>.tgz (or
+ icu-<i>X</i>.<i>Y</i>.tar.gz) file. For example, <samp>gunzip -d &lt; icu-<i>X</i>.<i>Y</i>.tgz | tar xvf -</samp></li>
+
+ <li>Change directory to <code>icu/source</code>.
+ <samp>cd icu/source</samp>
+ </li>
+
+ <li>Some files may have the wrong permissions.<samp>chmod +x runConfigureICU configure install-sh</samp></li>
+
+ <li>Run the <span style='font-family: monospace;'><a href="source/runConfigureICU">runConfigureICU</a></span>
+ script for your platform. (See <a href="#HowToConfigureICU">configuration
+ note</a> below).</li>
+
+ <li>Now build: <samp>gmake</samp> (or just <code>make</code> if GNU make is the default make on
+ your platform) to compile the libraries and all the data files. The proper
+ name of the GNU make command is printed at the end of the configuration
+ run, as in <tt>"You must use gmake to compile ICU"</tt>.
+ <br/>
+ Note that the compilation command output may be simplified on your platform. If this is the case, you will see just:
+ <tt>gcc ... stubdata.c</tt>
+ rather than
+ <tt>gcc -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 -D_REENTRANT -I../common -DU_ATTRIBUTE_DEPRECATED= -O2 -Wall -std=c99 -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -c -DPIC -fPIC -o stubdata.o stubdata.c</tt>
+ <br/>
+ If you need to see the whole compilation line, use <span style='font-family: monospace;'>"gmake VERBOSE=1"</span>. The full compilation line will print if an error occurs.
+ </li>
+
+ <li>Optionally,<samp>gmake check</samp> will run the test suite, which
+ checks for ICU's functionality integrity (See <a href=
+ "#HowToTestWithoutGmake">testing note</a> below).</li>
+
+ <li>To install, <samp>gmake install</samp> to install ICU. If you used the --prefix=
+ option on configure or runConfigureICU, ICU will be installed to the
+ directory you specified. (See <a href="#HowToInstallICU">installation
+ note</a> below).</li>
+ </ol>
+
+ <p><a name="HowToConfigureICU" id="HowToConfigureICU"><strong>Configuring ICU
+ NOTE:</strong></a> Type <tt>"./runConfigureICU --help"</tt> for help on how
+ to run it and a list of supported platforms. You may also want to type
+ <tt>"./configure --help"</tt> to print the available configure options that
+ you may want to give runConfigureICU. If you are not using the
+ runConfigureICU script, or your platform is not supported by the script, you
+ may need to set your CC, CXX, CFLAGS and CXXFLAGS environment variables, and
+ type <tt>"./configure"</tt>.
+ HP-UX users, please see this <a href="#ImportantNotesHPUX">note regarding
+ HP-UX multithreaded build issues</a> with newer compilers. Solaris users,
+ please see this <a href="#ImportantNotesSolaris">note regarding Solaris
+ multithreaded build issues</a>.</p>
+
+ <p>ICU is built with strict compiler warnings enabled by default. If this
+ causes excessive numbers of warnings on your platform, use the --disable-strict
+ option to configure to reduce the warning level.</p>
+
+ <p><a name="HowToTestWithoutGmake" id="HowToTestWithoutGmake"><strong>Running
+ The Tests From The Command Line NOTE:</strong></a> You may have to set
+ certain variables if you with to run test programs individually, that is
+ apart from "gmake check". The environment variable <strong>ICU_DATA</strong>
+ can be set to the full pathname of the data directory to indicate where the
+ locale data files and conversion mapping tables are when you are not using
+ the shared library (e.g. by using the .dat archive or the individual data
+ files). The trailing "/" is required after the directory name (e.g.
+ "$Root/source/data/out/" will work, but the value "$Root/source/data/out" is
+ not acceptable). You do not need to set <strong>ICU_DATA</strong> if the
+ complete shared data library is in your library path.</p>
+
+ <p><a name="HowToInstallICU" id="HowToInstallICU"><strong>Installing ICU
+ NOTE:</strong></a> Some platforms use package management tools to control the
+ installation and uninstallation of files on the system, as well as the
+ integrity of the system configuration. You may want to check if ICU can be
+ packaged for your package management tools by looking into the "packaging"
+ directory. (Please note that if you are using a snapshot of ICU from Git, it
+ is probable that the packaging scripts or related files are not up to date
+ with the contents of ICU at this time, so use them with caution).</p>
+
+ <h3><a name="HowToBuildZOS" href="#HowToBuildZOS" id="HowToBuildZOS">How To
+ Build And Install On z/OS (OS/390)</a></h3>
+
+ <p>You can install ICU on z/OS or OS/390 (the previous name of z/OS), but IBM
+ tests only the z/OS installation. You install ICU in a z/OS UNIX system
+ services file system such as HFS or zFS. On this platform, it is important
+ that you understand a few details:</p>
+
+ <ul>
+ <li>The makedep and GNU make tools are required for building ICU. If it
+ is not already installed on your system, it is available at the <a href=
+ "http://www-03.ibm.com/servers/eserver/zseries/zos/unix/bpxa1toy.html">z/OS UNIX -
+ Tools and Toys</a> site. The PATH environment variable should be updated to
+ contain the location of this executable prior to build. Failure to add these
+ tools to your PATH will cause ICU build failures or cause pkgdata to fail
+ to run.</li>
+
+ <li>Since USS does not support using the mmap() function over NFS, it is
+ recommended that you build ICU on a local filesystem. Once ICU has been
+ built, you should not have this problem while using ICU when the data
+ library has been built as a shared library, which is this is the default
+ setting.</li>
+
+ <li>Encoding considerations: The source code assumes that it is compiled
+ with codepage ibm-1047 (to be exact, the UNIX System Services variant of
+ it). The pax command converts all of the source code files from ASCII to
+ codepage ibm-1047 (USS) EBCDIC. However, some files are binary files and
+ must not be converted, or must be converted back to their original state.
+ You can use the <a href="as_is/os390/unpax-icu.sh">unpax-icu.sh</a> script
+ to do this for you automatically. It will unpackage the tar file and
+ convert all the necessary files for you automatically.</li>
+
+ <li>z/OS supports both native S/390 hexadecimal floating point and (with
+ OS/390 2.6 and later) IEEE 754 binary floating point. This is a compile
+ time option. Applications built with IEEE should use ICU DLLs that are
+ built with IEEE (and vice versa). The environment variable IEEE390=0 will
+ cause the z/OS version of ICU to be built without IEEE floating point
+ support and use the native hexadecimal floating point. By default ICU is
+ built with IEEE 754 support. Native floating point support is sufficient
+ for codepage conversion, resource bundle and UnicodeString operations, but
+ the Format APIs require IEEE binary floating point.</li>
+
+ <li>z/OS introduced the concept of Extra Performance Linkage (XPLINK) to
+ bring performance improvement opportunities to call-intensive C and C++
+ applications such as ICU. XPLINK is enabled on a DLL-by-DLL basis, so if
+ you are considering using XPLINK in your application that uses ICU, you
+ should consider building the XPLINK-enabled version of ICU. You need to
+ set ICU's environment variable <code>OS390_XPLINK=1</code> prior to
+ invoking the make process to produce binaries that are enabled for
+ XPLINK. The XPLINK option, which is available for z/OS 1.2 and later,
+ requires the PTF PQ69418 to build XPLINK enabled binaries.</li>
+
+ <li>ICU requires XPLINK for the icuio library. If you want to use the
+ rest of ICU without XPLINK, then you must use the --disable-icuio
+ configure option.</li>
+
+ <li>The latest versions of z/OS use <a
+ href="https://www.ibm.com/support/knowledgecenter/SSLTBW_2.2.0/com.ibm.zos.v2r2.cbcux01/oebind6.htm">XPLINK
+ version (C128) of the C++ standard library</a> by default. You may see <a
+ href="https://www.ibm.com/support/knowledgecenter/SSLTBW_2.2.0/com.ibm.zos.v2r2.cbcux01/oebind5.htm">an
+ error</a> when running with XPLINK disabled. To avoid this error,
+ set the following environment variable or similar:
+
+<pre><samp>export _CXX_PSYSIX="CEE.SCEELIB(C128N)":"CBC.SCLBSID(IOSTREAM,COMPLEX)"</samp></pre>
+ </li>
+
+ <li>When building ICU data, the heap size may need to be increased with the following
+ environment variable:
+
+<pre><samp>export _CEE_RUNOPTS="HEAPPOOLS(ON),HEAP(4M,1M,ANY,FREE,0K,4080)"</samp></pre>
+ </li>
+
+
+ <li>The rest of the instructions for building and testing ICU on z/OS with
+ UNIX System Services are the same as the <a href="#HowToBuildUNIX">How To
+ Build And Install On UNIX</a> section.</li>
+ </ul>
+
+ <h4>z/OS (Batch/PDS) support outside the UNIX system services
+ environment</h4>
+
+ <p>By default, ICU builds its libraries into the UNIX file system (HFS). In
+ addition, there is a z/OS specific environment variable (OS390BATCH) to build
+ some libraries into the z/OS native file system. This is useful, for example,
+ when your application is externalized via Job Control Language (JCL).</p>
+
+ <p>The OS390BATCH environment variable enables non-UNIX support including the
+ batch environment. When OS390BATCH is set, the libicui18n<i>XX</i>.dll,
+ libicuuc<i>XX</i>.dll, and libicudt<i>XX</i>e.dll binaries are built into
+ data sets (the native file system). Turning on OS390BATCH does not turn off
+ the normal z/OS UNIX build. This means that the z/OS UNIX (HFS) DLLs will
+ always be created.</p>
+
+ <p>Two additional environment variables indicate the names of the z/OS data
+ sets to use. The LOADMOD environment variable identifies the name of the data
+ set that contains the dynamic link libraries (DLLs) and the LOADEXP
+ environment variable identifies the name of the data set that contains the
+ side decks, which are normally the files with the .x suffix in the UNIX file
+ system.</p>
+
+ <p>A data set is roughly equivalent to a UNIX or Windows file. For most kinds
+ of data sets the operating system maintains record boundaries. UNIX and
+ Windows files are byte streams. Two kinds of data sets are PDS and PDSE. Each
+ data set of these two types contains a directory. It is like a UNIX
+ directory. Each "file" is called a "member". Each member name is limited to
+ eight bytes, normally EBCDIC.</p>
+
+ <p>Here is an example of some environment variables that you can set prior to
+ building ICU:</p>
+<pre>
+<samp>OS390BATCH=1
+LOADMOD=<i>USER</i>.ICU.LOAD
+LOADEXP=<i>USER</i>.ICU.EXP</samp>
+</pre>
+
+ <p>The PDS member names for the DLL file names are as follows:</p>
+<pre>
+<samp>IXMI<i>XX</i>IN --&gt; libicui18n<i>XX</i>.dll
+IXMI<i>XX</i>UC --&gt; libicuuc<i>XX</i>.dll
+IXMI<i>XX</i>DA --&gt; libicudt<i>XX</i>e.dll</samp>
+</pre>
+
+ <p>You should point the LOADMOD environment variable at a partitioned data
+ set extended (PDSE) and point the LOADEXP environment variable at a
+ partitioned data set (PDS). The PDSE can be allocated with the following
+ attributes:</p>
+<pre>
+<samp>Data Set Name . . . : <i>USER</i>.ICU.LOAD
+Management class. . : <i>**None**</i>
+Storage class . . . : <i>BASE</i>
+Volume serial . . . : <i>TSO007</i>
+Device type . . . . : <i>3390</i>
+Data class. . . . . : <i>LOAD</i>
+Organization . . . : PO
+Record format . . . : U
+Record length . . . : 0
+Block size . . . . : <i>32760</i>
+1st extent cylinders: 1
+Secondary cylinders : 5
+Data set name type : LIBRARY</samp>
+</pre>
+
+ <p>The PDS can be allocated with the following attributes:</p>
+<pre>
+<samp>Data Set Name . . . : <i>USER</i>.ICU.EXP
+Management class. . : <i>**None**</i>
+Storage class . . . : <i>BASE</i>
+Volume serial . . . : <i>TSO007</i>
+Device type . . . . : <i>3390</i>
+Data class. . . . . : <i>**None**</i>
+Organization . . . : PO
+Record format . . . : FB
+Record length . . . : 80
+Block size . . . . : <i>3200</i>
+1st extent cylinders: 3
+Secondary cylinders : 3
+Data set name type : PDS</samp>
+</pre>
+
+ <h3><a name="HowToBuildOS400" href="#HowToBuildOS400" id=
+ "HowToBuildOS400">How To Build And Install On The IBM i Family (IBM i, i5/OS OS/400)</a></h3>
+
+ <p>Before you start building ICU, ICU requires the following:</p>
+
+ <ul>
+ <li>QSHELL interpreter installed (install base option 30, operating system)
+ <!--li>QShell Utilities, PRPQ 5799-XEH (not required for V4R5)</li--></li>
+
+ <li>ILE C/C++ Compiler installed on the system</li>
+
+ <li>The latest IBM tools for Developers for IBM i &mdash;
+ <a href='https://www-356.ibm.com/partnerworld/wps/servlet/ContentHandler/pw_com_porting_tools_index'>https://www-356.ibm.com/partnerworld/wps/servlet/ContentHandler/pw_com_porting_tools_index</a>
+ <!-- formerly http://www.ibm.com/servers/enable/site/porting/tools/'>http://www.ibm.com/servers/enable/site/porting/tools/</a> -->
+ <!-- formerly: http://www.ibm.com/servers/enable/site/porting/iseries/overview/gnu_utilities.html -->
+ </li>
+ </ul>
+
+ <p>The following describes how to setup and build ICU. For background
+ information, you should look at the <a href="#HowToBuildUNIX">UNIX build
+ instructions</a>.</p>
+
+ <ol>
+ <li>
+ Copy the ICU source .tgz to the IBM i environment, as binary.
+ Also, copy the <a href='as_is/os400/unpax-icu.sh'>unpax-icu.sh</a> script into the same directory, as a text file.
+ </li>
+
+ <li>
+ Create target library. This library will be the target for the
+ resulting modules, programs and service programs. You will specify this
+ library on the OUTPUTDIR environment variable.
+<pre>
+<samp>CRTLIB LIB(<i>libraryname</i>)
+ADDENVVAR ENVVAR(OUTPUTDIR) VALUE('<i>libraryname</i>') REPLACE(*YES) </samp></pre>
+ </li>
+
+ <li>
+ Set up the following environment variables and job characteristics in your build process
+<pre>
+<samp>ADDENVVAR ENVVAR(MAKE) VALUE('gmake') REPLACE(*YES)
+CHGJOB CCSID(37)</samp></pre></li>
+
+ <li>Fire up the QSH <i>(all subsequent commands are run inside the qsh session.)</i>
+ <pre><samp>qsh</samp></pre>
+ </li>
+
+ <li>Set up the PATH: <pre><samp>export PATH=/QIBM/ProdData/DeveloperTools/qsh/bin:$PATH:/QOpenSys/usr/bin</samp></pre>
+ </li>
+
+ <li>Unpack the ICU source code archive:
+ <pre><samp>gzip -d icu-<i>X</i>.<i>Y</i>.tgz</samp></pre>
+ </li>
+
+ <li>Run unpax-icu.sh on the tar file generated from the previous step.
+ <pre><samp>unpax-icu.sh icu.tar</samp></pre></li>
+
+ <li>Build the program ICULD which ICU will use for linkage.
+ <pre><samp>cd icu/as_is/os400
+qsh bldiculd.sh
+cd ../../..</samp></pre>
+ </li>
+
+ <li>Change into the 'source' directory, and configure ICU. (See <a href="#HowToConfigureICU">configuration
+ note</a> for details). Note that --with-data-packaging=archive and setting the --prefix are recommended, building in default (dll) mode is currently not supported.
+ <pre><samp>cd icu/source
+./runConfigureICU IBMi --prefix=<i>/path/to/somewhere</i> --with-data-packaging=archive</samp></pre>
+</li>
+
+ <li>Build ICU. <i>(Note: Do not use the -j option)</i> <pre><samp>gmake</samp></pre></li>
+
+ <li>Test ICU. <pre><samp>gmake check</samp></pre>
+ (The <tt> QIBM_MULTI_THREADED=Y</tt> flag will be automatically applied to intltest -
+ you can look at the <a href=
+ "https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzahw/rzahwceeco.htm">
+ iSeries Information Center</a> for more details regarding the running of multiple threads
+ on IBM i.)</li>
+ </ol>
+
+ <!-- cross -->
+ <h3><a name="HowToCrossCompileICU" href="#HowToCrossCompileICU" id="HowToCrossCompileICU">How To Cross Compile ICU</a></h3>
+ <p>This section will explain how to build ICU on one platform, but to produce binaries intended to run on another. This is commonly known as a cross compile.</p>
+ <p>Normally, in the course of a build, ICU needs to run the tools that it builds in order to generate and package data and test-data.In a cross compilation setting, ICU is built on a different system from that which it eventually runs on. An example might be, if you are building for a small/headless system (such as an embedded device), or a system where you can't easily run the ICU command line tools (any non-UNIX-like system).</p>
+ <p>To reduce confusion, we will here refer to the "A" and the "B" system.System "A" is the actual system we will be running on- the only requirements on it is are it is able to build ICU from the command line targetting itself (with configure or runConfigureICU), and secondly, that it also contain the correct toolchain for compiling and linking for the resultant platform, referred to as the "B" system.</p>
+ <p>The autoconf docs use the term "build" for A, and "host" for B. More details at: <a href="http://www.gnu.org/software/autoconf/manual/html_node/Specifying-Names.html#Specifying-Names">http://www.gnu.org/software/autoconf/manual/html_node/Specifying-Names.html</a></p>
+ <p>Three initially-empty directories will be used in this example:</p>
+ <table summary="Three directories used in this example" class="docTable">
+ <tr>
+ <th align="left">/icu</th><td>a copy of the ICU source</td>
+ </tr>
+ <tr>
+ <th align="left">/buildA</th><td>an empty directory, it will contain ICU built for A<br />(MacOSX in this case)</td>
+ </tr>
+ <tr>
+ <th align="left">/buildB</th><td>an empty directory, it will contain ICU built for B<br />(HaikuOS in this case)</td>
+ </tr>
+ </table>
+
+ <ol>
+ <li>Check out or unpack the ICU source code into the /icu directory.You will have the directories /icu/source, etc.</li>
+ <li>Build ICU in /buildA normally (using runConfigureICU or configure):
+<pre class="samp">cd /buildA
+sh /icu/source/runConfigureICU <strong>MacOSX</strong>
+gnumake
+</pre>
+ </li>
+ <li>Set PATH or other variables as needed, such as CPPFLAGS.</li>
+ <li>Build ICU in /buildB<br />
+ <p class="note">"<code>--with-cross-build</code>" takes an absolute path.</p>
+<pre class="samp">cd /buildB
+sh /icu/source/configure --host=<strong>i586-pc-haiku</strong> --with-cross-build=<strong>/buildA</strong>
+gnumake</pre>
+ </li>
+ <li>Tests and testdata can be built with "gnumake tests".</li>
+ </ol>
+ <!-- end cross -->
+
+ <!-- end build environment -->
+
+ <h2><a name="HowToPackage" href="#HowToPackage" id="HowToPackage">How To
+ Package ICU</a></h2>
+
+ <p>There are many ways that a person can package ICU with their software
+ products. Usually only the libraries need to be considered for packaging.</p>
+
+ <p>On UNIX, you should use "<tt>gmake install</tt>" to make it easier to
+ develop and package ICU. The bin, lib and include directories are needed to
+ develop applications that use ICU. These directories will be created relative
+ to the "<tt>--prefix=</tt><i>dir</i>" configure option (See the <a href=
+ "#HowToBuildUNIX">UNIX build instructions</a>). When ICU is built on Windows,
+ a similar directory structure is built.</p>
+
+ <p>When changes have been made to the standard ICU distribution, it is
+ recommended that at least one of the following guidelines be followed for
+ special packaging.</p>
+
+ <ol>
+ <li>Add a suffix name to the library names. This can be done with the
+ --with-library-suffix configure option.</li>
+
+ <li>The installation script should install the ICU libraries into the
+ application's directory.</li>
+ </ol>
+
+ <p>Following these guidelines prevents other applications that use a standard
+ ICU distribution from conflicting with any libraries that you need. On
+ operating systems that do not have a standard C++ ABI (name mangling) for
+ compilers, it is recommended to do this special packaging anyway. More
+ details on customizing ICU are available in the <a href=
+ "http://userguide.icu-project.org/">User's Guide</a>. The <a href=
+ "#SourceCode">ICU Source Code Organization</a> section of this readme.html
+ gives a more complete description of the libraries.</p>
+
+ <table class="docTable" summary=
+ "ICU has several libraries for you to use.">
+ <caption>
+ Here is an example of libraries that are frequently packaged.
+ </caption>
+
+ <tr>
+ <th scope="col">Library Name</th>
+
+ <th scope="col">Windows Filename</th>
+
+ <th scope="col">Linux Filename</th>
+
+ <th scope="col">Comment</th>
+ </tr>
+
+ <tr>
+ <td>Data Library</td>
+
+ <td>icudt<i>XY</i>l.dll</td>
+
+ <td>libicudata.so.<i>XY</i>.<i>Z</i></td>
+
+ <td>Data required by the Common and I18n libraries. There are many ways
+ to package and <a href=
+ "http://userguide.icu-project.org/icudata">customize this
+ data</a>, but by default this is all you need.</td>
+ </tr>
+
+ <tr>
+ <td>Common Library</td>
+
+ <td>icuuc<i>XY</i>.dll</td>
+
+ <td>libicuuc.so.<i>XY</i>.<i>Z</i></td>
+
+ <td>Base library required by all other ICU libraries.</td>
+ </tr>
+
+ <tr>
+ <td>Internationalization (i18n) Library</td>
+
+ <td>icuin<i>XY</i>.dll</td>
+
+ <td>libicui18n.so.<i>XY</i>.<i>Z</i></td>
+
+ <td>A library that contains many locale based internationalization (i18n)
+ functions.</td>
+ </tr>
+
+ <tr>
+ <td>Layout Extensions Engine</td>
+
+ <td>iculx<i>XY</i>.dll</td>
+
+ <td>libiculx.so.<i>XY</i>.<i>Z</i></td>
+
+ <td>An optional engine for doing paragraph layout that uses
+ parts of ICU.
+ HarfBuzz is required.</td>
+ </tr>
+
+ <tr>
+ <td>ICU I/O (Unicode stdio) Library</td>
+
+ <td>icuio<i>XY</i>.dll</td>
+
+ <td>libicuio.so.<i>XY</i>.<i>Z</i></td>
+
+ <td>An optional library that provides a stdio like API with Unicode
+ support.</td>
+ </tr>
+
+ <tr>
+ <td>Tool Utility Library</td>
+
+ <td>icutu<i>XY</i>.dll</td>
+
+ <td>libicutu.so.<i>XY</i>.<i>Z</i></td>
+
+ <td>An internal library that contains internal APIs that are only used by
+ ICU's tools. If you do not use ICU's tools, you do not need this
+ library.</td>
+ </tr>
+ </table>
+
+ <p>Normally only the above ICU libraries need to be considered for packaging.
+ The versionless symbolic links to these libraries are only needed for easier
+ development. The <i>X</i>, <i>Y</i> and <i>Z</i> parts of the name are the
+ version numbers of ICU. For example, ICU 2.0.2 would have the name
+ libicuuc.so.20.2 for the common library. The exact format of the library
+ names can vary between platforms due to how each platform can handles library
+ versioning.</p>
+
+ <h2><a name="ImportantNotes" href="#ImportantNotes" id=
+ "ImportantNotes">Important Notes About Using ICU</a></h2>
+
+ <h3><a name="ImportantNotesMultithreaded" href="#ImportantNotesMultithreaded"
+ id="ImportantNotesMultithreaded">Using ICU in a Multithreaded
+ Environment</a></h3>
+
+ <p>Some versions of ICU require calling the <code>u_init()</code> function
+ from <code>uclean.h</code> to ensure that ICU is initialized properly. In
+ those ICU versions, <code>u_init()</code> must be called before ICU is used
+ from multiple threads. There is no harm in calling <code>u_init()</code> in a
+ single-threaded application, on a single-CPU machine, or in other cases where
+ <code>u_init()</code> is not required.</p>
+
+ <p>In addition to ensuring thread safety, <code>u_init()</code> also attempts
+ to load at least one ICU data file. Assuming that all data files are packaged
+ together (or are in the same folder in files mode), a failure code from
+ <code>u_init()</code> usually means that the data cannot be found. In this
+ case, the data may not be installed properly, or the application may have
+ failed to call <code>udata_setCommonData()</code> or
+ <code>u_setDataDirectory()</code> which specify to ICU where it can find its
+ data.</p>
+
+ <p>Since <code>u_init()</code> will load only one or two data files, it
+ cannot guarantee that all of the data that an application needs is available.
+ It cannot check for all data files because the set of files is customizable,
+ and some ICU services work without loading any data at all. An application
+ should always check for error codes when opening ICU service objects (using
+ <code>ucnv_open()</code>, <code>ucol_open()</code>, C++ constructors,
+ etc.).</p>
+
+ <h4>ICU 3.4 and later</h4>
+
+ <p>ICU 3.4 self-initializes properly for multi-threaded use. It achieves this
+ without performance penalty by hardcoding the core Unicode properties data,
+ at the cost of some flexibility. (For details see Jitterbug 4497.)</p>
+
+ <p><code>u_init()</code> can be used to check for data loading. It tries to
+ load the converter alias table (<code>cnvalias.icu</code>).</p>
+
+ <h4>ICU 2.6..3.2</h4>
+
+ <p>These ICU versions require a call to <code>u_init()</code> before
+ multi-threaded use. The services that are directly affected are those that
+ don't have a service object and need to be fast: normalization and character
+ properties.</p>
+
+ <p><code>u_init()</code> loads and initializes the data files for
+ normalization and character properties (<code>unorm.icu</code> and
+ <code>uprops.icu</code>) and can therefore also be used to check for data
+ loading.</p>
+
+ <h4>ICU 2.4 and earlier</h4>
+
+ <p>ICU 2.4 and earlier versions were not prepared for multithreaded use on
+ multi-CPU platforms where the CPUs implement weak memory coherency. These
+ CPUs include: Power4, Power5, Alpha, Itanium. <code>u_init()</code> was not
+ defined yet.</p>
+
+ <h4><a name="ImportantNotesHPUX" href="#ImportantNotesHPUX" id=
+ "ImportantNotesHPUX">Using ICU in a Multithreaded Environment on
+ HP-UX</a></h4>
+
+ <p>When ICU is built with aCC on HP-UX, the <a
+ href="http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801?ciid=eb08b3f1eee02110b3f1eee02110275d6e10RCRD">-AA</a>
+ compiler flag is used. It is required in order to use the latest
+ &lt;iostream&gt; API in a thread safe manner. This compiler flag affects the
+ version of the C++ library being used. Your applications will also need to
+ be compiled with -AA in order to use ICU.</p>
+
+ <h4><a name="ImportantNotesSolaris" href="#ImportantNotesSolaris" id=
+ "ImportantNotesSolaris">Using ICU in a Multithreaded Environment on
+ Solaris</a></h4>
+
+ <h5>Linking on Solaris</h5>
+
+ <p>In order to avoid synchronization and threading issues, developers are
+ <strong>suggested</strong> to strictly follow the compiling and linking
+ guidelines for multithreaded applications, specified in the following
+ SUn Solaris document available from Oracle. Most notably, pay strict attention to the
+ following statements from Sun:</p>
+
+ <blockquote>
+ <p>To use libthread, specify -lthread before -lc on the ld command line, or
+ last on the cc command line.</p>
+
+ <p>To use libpthread, specify -lpthread before -lc on the ld command line,
+ or last on the cc command line.</p>
+ </blockquote>
+
+ <p>Failure to do this may cause spurious lock conflicts, recursive mutex
+ failure, and deadlock.</p>
+
+ <p>Source: "<i>Multithreaded Programming Guide, Compiling and
+ Debugging</i>", Sun Microsystems, 2002 <br />
+ <a href=
+ "https://docs.oracle.com/cd/E19683-01/806-6867/compile-74765/index.html">https://docs.oracle.com/cd/E19683-01/806-6867/compile-74765/index.html</a></p>
+
+ <p>Note, a version of that chapter from a 2008 document update covering both Solaris 9
+ and Solaris 10 is available here:<br />
+ <a href=
+ "http://docs.oracle.com/cd/E19253-01/816-5137/compile-94179/index.html">http://docs.oracle.com/cd/E19253-01/816-5137/compile-94179/index.html</a></p>
+
+ <h3><a name="ImportantNotesWindows" href="#ImportantNotesWindows" id=
+ "ImportantNotesWindows">Windows Platform</a></h3>
+
+ <p>If you are building on the Windows platform, it is important that you
+ understand a few of the following build details.</p>
+
+ <h4>DLL directories and the PATH setting</h4>
+
+ <p>As delivered, the International Components for Unicode build as several
+ DLLs, which are placed in the "<i>&lt;ICU&gt;</i>\bin64" directory. You must
+ add this directory to the PATH environment variable in your system, or any
+ executables you build will not be able to access International Components for
+ Unicode libraries. Alternatively, you can copy the DLL files into a directory
+ already in your PATH, but we do not recommend this. You can wind up with
+ multiple copies of the DLL and wind up using the wrong one.</p>
+
+ <h4><a name="ImportantNotesWindowsPath" id=
+ "ImportantNotesWindowsPath">Changing your PATH</a></h4>
+
+ <p><strong>Windows 2000/XP and above</strong>: Use the System Icon in the Control
+ Panel. Pick the "Advanced" tab. Select the "Environment Variables..."
+ button. Select the variable PATH in the lower box, and select the lower
+ "Edit..." button. In the "Variable Value" box, append the string
+ ";<i>&lt;ICU&gt;</i>\bin64" to the end of the path string. If there is
+ nothing there, just type in "<i>&lt;ICU&gt;</i>\bin64". Click the Set button,
+ then the OK button.</p>
+
+ <p>Note: When packaging a Windows application for distribution and
+ installation on user systems, copies of the ICU DLLs should be included with
+ the application, and installed for exclusive use by the application. This is
+ the only way to insure that your application is running with the same version
+ of ICU, built with exactly the same options, that you developed and tested
+ with. Refer to Microsoft's guidelines on the usage of DLLs, or search for the
+ phrase "DLL hell" on <a href=
+ "http://msdn.microsoft.com/">msdn.microsoft.com</a>.</p>
+
+ <h3><a name="ImportantNotesUNIX" href="#ImportantNotesUNIX" id=
+ "ImportantNotesUNIX">UNIX Type Platform</a></h3>
+
+ <p>If you are building on a UNIX platform, and if you are installing ICU in a
+ non-standard location, you may need to add the location of your ICU libraries
+ to your <strong>LD_LIBRARY_PATH</strong> or <strong>LIBPATH</strong>
+ environment variable (or the equivalent runtime library path environment
+ variable for your system). The ICU libraries may not link or load properly
+ without doing this.</p>
+
+ <p>Note that if you do not want to have to set this variable, you may instead
+ use the --enable-rpath option at configuration time. This option will
+ instruct the linker to always look for the libraries where they are
+ installed. You will need to use the appropriate linker options when linking
+ your own applications and libraries against ICU, too. Please refer to your
+ system's linker manual for information about runtime paths. The use of rpath
+ also means that when building a new version of ICU you should not have an
+ older version installed in the same place as the new version's installation
+ directory, as the older libraries will used during the build, instead of the
+ new ones, likely leading to an incorrectly build ICU. This is the proper
+ behavior of rpath.</p>
+
+ <h2><a name="PlatformDependencies" href="#PlatformDependencies" id=
+ "PlatformDependencies">Platform Dependencies</a></h2>
+
+ <h3><a name="PlatformDependenciesNew" href="#PlatformDependenciesNew" id=
+ "PlatformDependenciesNew">Porting To A New Platform</a></h3>
+
+ <p>If you are using ICU's Makefiles to build ICU on a new platform, there are
+ a few places where you will need to add or modify some files. If you need
+ more help, you can always ask the <a href=
+ "http://site.icu-project.org/contacts">icu-support mailing list</a>. Once
+ you have finished porting ICU to a new platform, it is recommended that you
+ contribute your changes back to ICU via the icu-support mailing list. This
+ will make it easier for everyone to benefit from your work.</p>
+
+ <h4>Data For a New Platform</h4>
+
+ <p>For some people, it may not be necessary for completely build ICU. Most of
+ the makefiles and build targets are for tools that are used for building
+ ICU's data, and an application's data (when an application uses ICU resource
+ bundles for its data).</p>
+
+ <p>Data files can be built on a different platform when both platforms share
+ the same endianness and the same charset family. This assertion does not
+ include platform dependent DLLs/shared/static libraries. For details see the
+ User Guide <a href="http://userguide.icu-project.org/icudata">ICU
+ Data</a> chapter.</p>
+
+ <p>ICU 3.6 removes the requirement that ICU be completely built in the native
+ operating environment. It adds the icupkg tool which can be run on any
+ platform to turn binary ICU data files from any one of the three formats into
+ any one of the other data formats. This allows a application to use ICU data
+ built anywhere to be used for any other target platform.</p>
+
+ <p><strong>WARNING!</strong> Building ICU without running the tests is not
+ recommended. The tests verify that ICU is safe to use. It is recommended that
+ you try to completely port and test ICU before using the libraries for your
+ own application.</p>
+
+ <h4>Adapting Makefiles For a New Platform</h4>
+
+ <p>Try to follow the build steps from the <a href="#HowToBuildUNIX">UNIX</a>
+ build instructions. If the configure script fails, then you will need to
+ modify some files. Here are the usual steps for porting to a new
+ platform:<br />
+ </p>
+
+ <ol>
+ <li>Create an mh file in icu/source/config/. You can use mh-linux or a
+ similar mh file as your base configuration.</li>
+
+ <li>Modify icu/source/aclocal.m4 to recognize your platform's mh file.</li>
+
+ <li>Modify icu/source/configure.in to properly set your <b>platform</b> C
+ Macro define.</li>
+
+ <li>Run <a href="http://www.gnu.org/software/autoconf/">autoconf</a> in
+ icu/source/ without any options. The autoconf tool is standard on most
+ Linux systems.</li>
+
+ <li>If you have any optimization options that you want to normally use, you
+ can modify icu/source/runConfigureICU to specify those options for your
+ platform.</li>
+
+ <li>Build and test ICU on your platform. It is very important that you run
+ the tests. If you don't run the tests, there is no guarentee that you have
+ properly ported ICU.</li>
+ </ol>
+
+ <h3><a name="PlatformDependenciesImpl" href="#PlatformDependenciesImpl" id=
+ "PlatformDependenciesImpl">Platform Dependent Implementations</a></h3>
+
+ <p>The platform dependencies have been mostly isolated into the following
+ files in the common library. This information can be useful if you are
+ porting ICU to a new platform.</p>
+
+ <ul>
+ <li>
+ <strong>unicode/platform.h.in</strong> (autoconf'ed platforms)<br />
+ <strong>unicode/p<i>XXXX</i>.h</strong> (others: pwin32.h, ppalmos.h,
+ ..): Platform-dependent typedefs and defines:<br />
+ <br />
+
+
+ <ul>
+ <li>Generic types like UBool, int8_t, int16_t, int32_t, int64_t,
+ uint64_t etc.</li>
+
+ <li>U_EXPORT and U_IMPORT for specifying dynamic library import and
+ export</li>
+
+ <li>String handling support for the char16_t and wchar_t types.</li>
+ </ul>
+ <br />
+ </li>
+
+ <li>
+ <strong>unicode/putil.h, putil.c</strong>: platform-dependent
+ implementations of various functions that are platform dependent:<br />
+ <br />
+
+
+ <ul>
+ <li>uprv_isNaN, uprv_isInfinite, uprv_getNaN and uprv_getInfinity for
+ handling special floating point values.</li>
+
+ <li>uprv_tzset, uprv_timezone, uprv_tzname and time for getting
+ platform specific time and time zone information.</li>
+
+ <li>u_getDataDirectory for getting the default data directory.</li>
+
+ <li>uprv_getDefaultLocaleID for getting the default locale
+ setting.</li>
+
+ <li>uprv_getDefaultCodepage for getting the default codepage
+ encoding.</li>
+ </ul>
+ <br />
+ </li>
+
+ <li>
+ <strong>umutex.h, umutex.c</strong>: Code for doing synchronization in
+ multithreaded applications. If you wish to use International Components
+ for Unicode in a multithreaded application, you must provide a
+ synchronization primitive that the classes can use to protect their
+ global data against simultaneous modifications. We already supply working
+ implementations for many platforms that ICU builds on.<br />
+ <br />
+ </li>
+
+ <li><strong>umapfile.h, umapfile.c</strong>: functions for mapping or
+ otherwise reading or loading files into memory. All access by ICU to data
+ from files makes use of these functions.<br />
+ <br />
+ </li>
+
+ <li>Using platform specific #ifdef macros are highly discouraged outside of
+ the scope of these files. When the source code gets updated in the future,
+ these #ifdef's can cause testing problems for your platform.</li>
+ </ul>
+ <hr />
+ <p> Copyright &copy; 2016 and later: Unicode, Inc. and others. License &amp; terms of use:
+ <a href="http://www.unicode.org/copyright.html">http://www.unicode.org/copyright.html</a><br/>
+ Copyright &copy; 1997-2016 International Business Machines Corporation and others.
+ All Rights Reserved.</p>
+ </body>
+</html>
diff --git a/contrib/libs/icu/ya.make b/contrib/libs/icu/ya.make
index 0abace0c25..a3555706bf 100644
--- a/contrib/libs/icu/ya.make
+++ b/contrib/libs/icu/ya.make
@@ -4,7 +4,7 @@ LIBRARY()
OWNER(g:cpp-contrib)
-VERSION(67.1)
+VERSION(67.1)
ORIGINAL_SOURCE(https://github.com/unicode-org/icu/releases/download/release-67-1/icu4c-67_1-src.tgz)
@@ -19,27 +19,27 @@ LICENSE(
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
ADDINCL(
- GLOBAL contrib/libs/icu/include
+ GLOBAL contrib/libs/icu/include
contrib/libs/icu/common
contrib/libs/icu/i18n
- contrib/libs/icu/io
+ contrib/libs/icu/io
)
-NO_COMPILER_WARNINGS()
-
-NO_UTIL()
-
+NO_COMPILER_WARNINGS()
+
+NO_UTIL()
+
CFLAGS(
-DU_COMMON_IMPLEMENTATION
-DU_I18N_IMPLEMENTATION
-DU_IO_IMPLEMENTATION
)
-IF (OS_WINDOWS)
+IF (OS_WINDOWS)
CFLAGS(
GLOBAL -DU_STATIC_IMPLEMENTATION
)
-ELSE()
+ELSE()
CFLAGS(
-DU_STATIC_IMPLEMENTATION
)
@@ -52,44 +52,44 @@ SRCS(
common/bmpset.cpp
common/brkeng.cpp
common/brkiter.cpp
- common/bytesinkutil.cpp
+ common/bytesinkutil.cpp
common/bytestream.cpp
common/bytestrie.cpp
common/bytestriebuilder.cpp
common/bytestrieiterator.cpp
common/caniter.cpp
- common/characterproperties.cpp
+ common/characterproperties.cpp
common/chariter.cpp
common/charstr.cpp
- common/cmemory.cpp
+ common/cmemory.cpp
common/cstr.cpp
- common/cstring.cpp
- common/cwchar.cpp
+ common/cstring.cpp
+ common/cwchar.cpp
common/dictbe.cpp
common/dictionarydata.cpp
common/dtintrv.cpp
- common/edits.cpp
+ common/edits.cpp
common/errorcode.cpp
common/filteredbrk.cpp
common/filterednormalizer2.cpp
- common/icudataver.cpp
+ common/icudataver.cpp
common/icuplug.cpp
common/loadednormalizer2impl.cpp
- common/localebuilder.cpp
- common/localematcher.cpp
- common/localeprioritylist.cpp
+ common/localebuilder.cpp
+ common/localematcher.cpp
+ common/localeprioritylist.cpp
common/locavailable.cpp
common/locbased.cpp
common/locdispnames.cpp
- common/locdistance.cpp
+ common/locdistance.cpp
common/locdspnm.cpp
common/locid.cpp
common/loclikely.cpp
- common/loclikelysubtags.cpp
- common/locmap.cpp
+ common/loclikelysubtags.cpp
+ common/locmap.cpp
common/locresdata.cpp
common/locutil.cpp
- common/lsr.cpp
+ common/lsr.cpp
common/messagepattern.cpp
common/normalizer2.cpp
common/normalizer2impl.cpp
@@ -98,11 +98,11 @@ SRCS(
common/patternprops.cpp
common/pluralmap.cpp
common/propname.cpp
- common/propsvec.cpp
+ common/propsvec.cpp
common/punycode.cpp
common/putil.cpp
common/rbbi.cpp
- common/rbbi_cache.cpp
+ common/rbbi_cache.cpp
common/rbbidata.cpp
common/rbbinode.cpp
common/rbbirb.cpp
@@ -113,7 +113,7 @@ SRCS(
common/resbund.cpp
common/resbund_cnv.cpp
common/resource.cpp
- common/restrace.cpp
+ common/restrace.cpp
common/ruleiter.cpp
common/schriter.cpp
common/serv.cpp
@@ -125,70 +125,70 @@ SRCS(
common/servslkf.cpp
common/sharedobject.cpp
common/simpleformatter.cpp
- common/static_unicode_sets.cpp
+ common/static_unicode_sets.cpp
common/stringpiece.cpp
common/stringtriebuilder.cpp
- common/uarrsort.cpp
- common/ubidi.cpp
- common/ubidi_props.cpp
- common/ubidiln.cpp
- common/ubiditransform.cpp
- common/ubidiwrt.cpp
+ common/uarrsort.cpp
+ common/ubidi.cpp
+ common/ubidi_props.cpp
+ common/ubidiln.cpp
+ common/ubiditransform.cpp
+ common/ubidiwrt.cpp
common/ubrk.cpp
common/ucase.cpp
common/ucasemap.cpp
common/ucasemap_titlecase_brkiter.cpp
- common/ucat.cpp
- common/uchar.cpp
+ common/ucat.cpp
+ common/uchar.cpp
common/ucharstrie.cpp
common/ucharstriebuilder.cpp
common/ucharstrieiterator.cpp
common/uchriter.cpp
common/ucln_cmn.cpp
- common/ucmndata.cpp
- common/ucnv.cpp
+ common/ucmndata.cpp
+ common/ucnv.cpp
common/ucnv2022.cpp
common/ucnv_bld.cpp
- common/ucnv_cb.cpp
- common/ucnv_cnv.cpp
- common/ucnv_ct.cpp
- common/ucnv_err.cpp
+ common/ucnv_cb.cpp
+ common/ucnv_cnv.cpp
+ common/ucnv_ct.cpp
+ common/ucnv_err.cpp
common/ucnv_ext.cpp
common/ucnv_io.cpp
- common/ucnv_lmb.cpp
- common/ucnv_set.cpp
- common/ucnv_u16.cpp
- common/ucnv_u32.cpp
- common/ucnv_u7.cpp
- common/ucnv_u8.cpp
+ common/ucnv_lmb.cpp
+ common/ucnv_set.cpp
+ common/ucnv_u16.cpp
+ common/ucnv_u32.cpp
+ common/ucnv_u7.cpp
+ common/ucnv_u8.cpp
common/ucnvbocu.cpp
- common/ucnvdisp.cpp
- common/ucnvhz.cpp
- common/ucnvisci.cpp
- common/ucnvlat1.cpp
+ common/ucnvdisp.cpp
+ common/ucnvhz.cpp
+ common/ucnvisci.cpp
+ common/ucnvlat1.cpp
common/ucnvmbcs.cpp
- common/ucnvscsu.cpp
+ common/ucnvscsu.cpp
common/ucnvsel.cpp
common/ucol_swp.cpp
- common/ucptrie.cpp
+ common/ucptrie.cpp
common/ucurr.cpp
common/udata.cpp
- common/udatamem.cpp
- common/udataswp.cpp
- common/uenum.cpp
- common/uhash.cpp
+ common/udatamem.cpp
+ common/udataswp.cpp
+ common/uenum.cpp
+ common/uhash.cpp
common/uhash_us.cpp
common/uidna.cpp
common/uinit.cpp
- common/uinvchar.cpp
+ common/uinvchar.cpp
common/uiter.cpp
- common/ulist.cpp
+ common/ulist.cpp
common/uloc.cpp
common/uloc_keytype.cpp
- common/uloc_tag.cpp
- common/umapfile.cpp
- common/umath.cpp
- common/umutablecptrie.cpp
+ common/uloc_tag.cpp
+ common/umapfile.cpp
+ common/umath.cpp
+ common/umutablecptrie.cpp
common/umutex.cpp
common/unames.cpp
common/unifiedcache.cpp
@@ -208,11 +208,11 @@ SRCS(
common/unormcmp.cpp
common/uobject.cpp
common/uprops.cpp
- common/ures_cnv.cpp
+ common/ures_cnv.cpp
common/uresbund.cpp
common/uresdata.cpp
- common/usc_impl.cpp
- common/uscript.cpp
+ common/usc_impl.cpp
+ common/uscript.cpp
common/uscript_props.cpp
common/uset.cpp
common/uset_props.cpp
@@ -226,24 +226,24 @@ SRCS(
common/ustrcase.cpp
common/ustrcase_locale.cpp
common/ustrenum.cpp
- common/ustrfmt.cpp
+ common/ustrfmt.cpp
common/ustring.cpp
common/ustrtrns.cpp
common/utext.cpp
- common/utf_impl.cpp
+ common/utf_impl.cpp
common/util.cpp
common/util_props.cpp
- common/utrace.cpp
+ common/utrace.cpp
common/utrie.cpp
common/utrie2.cpp
common/utrie2_builder.cpp
- common/utrie_swap.cpp
+ common/utrie_swap.cpp
common/uts46.cpp
- common/utypes.cpp
+ common/utypes.cpp
common/uvector.cpp
common/uvectr32.cpp
common/uvectr64.cpp
- common/wintz.cpp
+ common/wintz.cpp
i18n/alphaindex.cpp
i18n/anytrans.cpp
i18n/astro.cpp
@@ -296,31 +296,31 @@ SRCS(
i18n/datefmt.cpp
i18n/dayperiodrules.cpp
i18n/dcfmtsym.cpp
- i18n/decContext.cpp
- i18n/decNumber.cpp
+ i18n/decContext.cpp
+ i18n/decNumber.cpp
i18n/decimfmt.cpp
- i18n/double-conversion-bignum-dtoa.cpp
- i18n/double-conversion-bignum.cpp
- i18n/double-conversion-cached-powers.cpp
- i18n/double-conversion-double-to-string.cpp
- i18n/double-conversion-fast-dtoa.cpp
- i18n/double-conversion-string-to-double.cpp
- i18n/double-conversion-strtod.cpp
+ i18n/double-conversion-bignum-dtoa.cpp
+ i18n/double-conversion-bignum.cpp
+ i18n/double-conversion-cached-powers.cpp
+ i18n/double-conversion-double-to-string.cpp
+ i18n/double-conversion-fast-dtoa.cpp
+ i18n/double-conversion-string-to-double.cpp
+ i18n/double-conversion-strtod.cpp
i18n/dtfmtsym.cpp
i18n/dtitvfmt.cpp
i18n/dtitvinf.cpp
i18n/dtptngen.cpp
i18n/dtrule.cpp
- i18n/erarules.cpp
+ i18n/erarules.cpp
i18n/esctrn.cpp
i18n/ethpccal.cpp
i18n/fmtable.cpp
i18n/fmtable_cnv.cpp
i18n/format.cpp
- i18n/formatted_string_builder.cpp
- i18n/formattedval_iterimpl.cpp
- i18n/formattedval_sbimpl.cpp
- i18n/formattedvalue.cpp
+ i18n/formatted_string_builder.cpp
+ i18n/formattedval_iterimpl.cpp
+ i18n/formattedval_sbimpl.cpp
+ i18n/formattedvalue.cpp
i18n/fphdlimp.cpp
i18n/fpositer.cpp
i18n/funcrepl.cpp
@@ -332,10 +332,10 @@ SRCS(
i18n/inputext.cpp
i18n/islamcal.cpp
i18n/japancal.cpp
- i18n/listformatter.cpp
+ i18n/listformatter.cpp
i18n/measfmt.cpp
i18n/measunit.cpp
- i18n/measunit_extra.cpp
+ i18n/measunit_extra.cpp
i18n/measure.cpp
i18n/msgfmt.cpp
i18n/name2uni.cpp
@@ -343,44 +343,44 @@ SRCS(
i18n/nfrule.cpp
i18n/nfsubs.cpp
i18n/nortrans.cpp
- i18n/nounit.cpp
+ i18n/nounit.cpp
i18n/nultrans.cpp
- i18n/number_affixutils.cpp
- i18n/number_asformat.cpp
- i18n/number_capi.cpp
- i18n/number_compact.cpp
- i18n/number_currencysymbols.cpp
- i18n/number_decimalquantity.cpp
- i18n/number_decimfmtprops.cpp
- i18n/number_fluent.cpp
- i18n/number_formatimpl.cpp
- i18n/number_grouping.cpp
- i18n/number_integerwidth.cpp
- i18n/number_longnames.cpp
- i18n/number_mapper.cpp
- i18n/number_modifiers.cpp
- i18n/number_multiplier.cpp
- i18n/number_notation.cpp
- i18n/number_output.cpp
- i18n/number_padding.cpp
- i18n/number_patternmodifier.cpp
- i18n/number_patternstring.cpp
- i18n/number_rounding.cpp
- i18n/number_scientific.cpp
- i18n/number_skeletons.cpp
- i18n/number_utils.cpp
+ i18n/number_affixutils.cpp
+ i18n/number_asformat.cpp
+ i18n/number_capi.cpp
+ i18n/number_compact.cpp
+ i18n/number_currencysymbols.cpp
+ i18n/number_decimalquantity.cpp
+ i18n/number_decimfmtprops.cpp
+ i18n/number_fluent.cpp
+ i18n/number_formatimpl.cpp
+ i18n/number_grouping.cpp
+ i18n/number_integerwidth.cpp
+ i18n/number_longnames.cpp
+ i18n/number_mapper.cpp
+ i18n/number_modifiers.cpp
+ i18n/number_multiplier.cpp
+ i18n/number_notation.cpp
+ i18n/number_output.cpp
+ i18n/number_padding.cpp
+ i18n/number_patternmodifier.cpp
+ i18n/number_patternstring.cpp
+ i18n/number_rounding.cpp
+ i18n/number_scientific.cpp
+ i18n/number_skeletons.cpp
+ i18n/number_utils.cpp
i18n/numfmt.cpp
- i18n/numparse_affixes.cpp
- i18n/numparse_compositions.cpp
- i18n/numparse_currency.cpp
- i18n/numparse_decimal.cpp
- i18n/numparse_impl.cpp
- i18n/numparse_parsednumber.cpp
- i18n/numparse_scientific.cpp
- i18n/numparse_symbols.cpp
- i18n/numparse_validators.cpp
- i18n/numrange_fluent.cpp
- i18n/numrange_impl.cpp
+ i18n/numparse_affixes.cpp
+ i18n/numparse_compositions.cpp
+ i18n/numparse_currency.cpp
+ i18n/numparse_decimal.cpp
+ i18n/numparse_impl.cpp
+ i18n/numparse_parsednumber.cpp
+ i18n/numparse_scientific.cpp
+ i18n/numparse_symbols.cpp
+ i18n/numparse_validators.cpp
+ i18n/numrange_fluent.cpp
+ i18n/numrange_impl.cpp
i18n/numsys.cpp
i18n/olsontz.cpp
i18n/persncal.cpp
@@ -416,7 +416,7 @@ SRCS(
i18n/smpdtfst.cpp
i18n/sortkey.cpp
i18n/standardplural.cpp
- i18n/string_segment.cpp
+ i18n/string_segment.cpp
i18n/strmatch.cpp
i18n/strrepl.cpp
i18n/stsearch.cpp
@@ -449,8 +449,8 @@ SRCS(
i18n/udatpg.cpp
i18n/ufieldpositer.cpp
i18n/uitercollationiterator.cpp
- i18n/ulistformatter.cpp
- i18n/ulocdata.cpp
+ i18n/ulistformatter.cpp
+ i18n/ulocdata.cpp
i18n/umsg.cpp
i18n/unesctrn.cpp
i18n/uni2name.cpp
@@ -467,7 +467,7 @@ SRCS(
i18n/uspoof_impl.cpp
i18n/utf16collationiterator.cpp
i18n/utf8collationiterator.cpp
- i18n/utmscale.cpp
+ i18n/utmscale.cpp
i18n/utrans.cpp
i18n/vtzone.cpp
i18n/vzone.cpp
@@ -478,16 +478,16 @@ SRCS(
i18n/zrule.cpp
i18n/ztrans.cpp
io/locbund.cpp
- io/sprintf.cpp
- io/sscanf.cpp
+ io/sprintf.cpp
+ io/sscanf.cpp
io/ucln_io.cpp
- io/ufile.cpp
- io/ufmt_cmn.cpp
+ io/ufile.cpp
+ io/ufmt_cmn.cpp
io/uprintf.cpp
- io/uprntf_p.cpp
- io/uscanf.cpp
- io/uscanf_p.cpp
- io/ustdio.cpp
+ io/uprntf_p.cpp
+ io/uscanf.cpp
+ io/uscanf_p.cpp
+ io/ustdio.cpp
io/ustream.cpp
)
diff --git a/contrib/libs/nghttp2/AUTHORS b/contrib/libs/nghttp2/AUTHORS
index 22592d6444..a7a9151b8e 100644
--- a/contrib/libs/nghttp2/AUTHORS
+++ b/contrib/libs/nghttp2/AUTHORS
@@ -49,16 +49,16 @@ Etienne Cimon
Fabian Möller
Fabian Wiesel
Gabi Davar
-Gaël PORTAY
-Geoff Hill
+Gaël PORTAY
+Geoff Hill
George Liu
Gitai
Google Inc.
Hajime Fujita
-Jacky Tian
+Jacky Tian
Jacky_Yin
Jacob Champion
-James M Snell
+James M Snell
Jan Kundrát
Jan-E
Janusz Dziemidowicz
@@ -75,7 +75,7 @@ Kenny Peng
Kit Chan
Kyle Schomp
LazyHamster
-Leo Neat
+Leo Neat
Lorenz Nickel
Lucas Pardue
MATSUMOTO Ryosuke
diff --git a/contrib/libs/nghttp2/lib/includes/nghttp2/nghttp2.h b/contrib/libs/nghttp2/lib/includes/nghttp2/nghttp2.h
index 5497369254..04321a652f 100644
--- a/contrib/libs/nghttp2/lib/includes/nghttp2/nghttp2.h
+++ b/contrib/libs/nghttp2/lib/includes/nghttp2/nghttp2.h
@@ -229,13 +229,13 @@ typedef struct {
#define NGHTTP2_CLIENT_MAGIC_LEN 24
/**
- * @macro
- *
- * The default max number of settings per SETTINGS frame
- */
-#define NGHTTP2_DEFAULT_MAX_SETTINGS 32
-
-/**
+ * @macro
+ *
+ * The default max number of settings per SETTINGS frame
+ */
+#define NGHTTP2_DEFAULT_MAX_SETTINGS 32
+
+/**
* @enum
*
* Error codes used in this library. The code range is [-999, -500],
@@ -406,11 +406,11 @@ typedef enum {
*/
NGHTTP2_ERR_SETTINGS_EXPECTED = -536,
/**
- * When a local endpoint receives too many settings entries
- * in a single SETTINGS frame.
- */
- NGHTTP2_ERR_TOO_MANY_SETTINGS = -537,
- /**
+ * When a local endpoint receives too many settings entries
+ * in a single SETTINGS frame.
+ */
+ NGHTTP2_ERR_TOO_MANY_SETTINGS = -537,
+ /**
* The errors < :enum:`nghttp2_error.NGHTTP2_ERR_FATAL` mean that
* the library is under unexpected condition and processing was
* terminated (e.g., out of memory). If application receives this
@@ -2711,17 +2711,17 @@ NGHTTP2_EXTERN void nghttp2_option_set_max_outbound_ack(nghttp2_option *option,
/**
* @function
*
- * This function sets the maximum number of SETTINGS entries per
- * SETTINGS frame that will be accepted. If more than those entries
- * are received, the peer is considered to be misbehaving and session
- * will be closed. The default value is 32.
- */
-NGHTTP2_EXTERN void nghttp2_option_set_max_settings(nghttp2_option *option,
- size_t val);
-
-/**
- * @function
- *
+ * This function sets the maximum number of SETTINGS entries per
+ * SETTINGS frame that will be accepted. If more than those entries
+ * are received, the peer is considered to be misbehaving and session
+ * will be closed. The default value is 32.
+ */
+NGHTTP2_EXTERN void nghttp2_option_set_max_settings(nghttp2_option *option,
+ size_t val);
+
+/**
+ * @function
+ *
* Initializes |*session_ptr| for client use. The all members of
* |callbacks| are copied to |*session_ptr|. Therefore |*session_ptr|
* does not store |callbacks|. The |user_data| is an arbitrary user
diff --git a/contrib/libs/nghttp2/lib/nghttp2_helper.c b/contrib/libs/nghttp2/lib/nghttp2_helper.c
index b531d29829..588e269c34 100644
--- a/contrib/libs/nghttp2/lib/nghttp2_helper.c
+++ b/contrib/libs/nghttp2/lib/nghttp2_helper.c
@@ -334,8 +334,8 @@ const char *nghttp2_strerror(int error_code) {
case NGHTTP2_ERR_FLOODED:
return "Flooding was detected in this HTTP/2 session, and it must be "
"closed";
- case NGHTTP2_ERR_TOO_MANY_SETTINGS:
- return "SETTINGS frame contained more than the maximum allowed entries";
+ case NGHTTP2_ERR_TOO_MANY_SETTINGS:
+ return "SETTINGS frame contained more than the maximum allowed entries";
default:
return "Unknown error code";
}
diff --git a/contrib/libs/nghttp2/lib/nghttp2_option.c b/contrib/libs/nghttp2/lib/nghttp2_option.c
index 358ef908d5..34348e6606 100644
--- a/contrib/libs/nghttp2/lib/nghttp2_option.c
+++ b/contrib/libs/nghttp2/lib/nghttp2_option.c
@@ -121,8 +121,8 @@ void nghttp2_option_set_max_outbound_ack(nghttp2_option *option, size_t val) {
option->opt_set_mask |= NGHTTP2_OPT_MAX_OUTBOUND_ACK;
option->max_outbound_ack = val;
}
-
-void nghttp2_option_set_max_settings(nghttp2_option *option, size_t val) {
- option->opt_set_mask |= NGHTTP2_OPT_MAX_SETTINGS;
- option->max_settings = val;
-}
+
+void nghttp2_option_set_max_settings(nghttp2_option *option, size_t val) {
+ option->opt_set_mask |= NGHTTP2_OPT_MAX_SETTINGS;
+ option->max_settings = val;
+}
diff --git a/contrib/libs/nghttp2/lib/nghttp2_option.h b/contrib/libs/nghttp2/lib/nghttp2_option.h
index 404eeb4319..939729fdcd 100644
--- a/contrib/libs/nghttp2/lib/nghttp2_option.h
+++ b/contrib/libs/nghttp2/lib/nghttp2_option.h
@@ -67,7 +67,7 @@ typedef enum {
NGHTTP2_OPT_MAX_DEFLATE_DYNAMIC_TABLE_SIZE = 1 << 9,
NGHTTP2_OPT_NO_CLOSED_STREAMS = 1 << 10,
NGHTTP2_OPT_MAX_OUTBOUND_ACK = 1 << 11,
- NGHTTP2_OPT_MAX_SETTINGS = 1 << 12,
+ NGHTTP2_OPT_MAX_SETTINGS = 1 << 12,
} nghttp2_option_flag;
/**
@@ -87,10 +87,10 @@ struct nghttp2_option {
*/
size_t max_outbound_ack;
/**
- * NGHTTP2_OPT_MAX_SETTINGS
- */
- size_t max_settings;
- /**
+ * NGHTTP2_OPT_MAX_SETTINGS
+ */
+ size_t max_settings;
+ /**
* Bitwise OR of nghttp2_option_flag to determine that which fields
* are specified.
*/
diff --git a/contrib/libs/nghttp2/lib/nghttp2_session.c b/contrib/libs/nghttp2/lib/nghttp2_session.c
index d2d825dead..36f1179f72 100644
--- a/contrib/libs/nghttp2/lib/nghttp2_session.c
+++ b/contrib/libs/nghttp2/lib/nghttp2_session.c
@@ -458,7 +458,7 @@ static int session_new(nghttp2_session **session_ptr,
(*session_ptr)->max_send_header_block_length = NGHTTP2_MAX_HEADERSLEN;
(*session_ptr)->max_outbound_ack = NGHTTP2_DEFAULT_MAX_OBQ_FLOOD_ITEM;
- (*session_ptr)->max_settings = NGHTTP2_DEFAULT_MAX_SETTINGS;
+ (*session_ptr)->max_settings = NGHTTP2_DEFAULT_MAX_SETTINGS;
if (option) {
if ((option->opt_set_mask & NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE) &&
@@ -522,11 +522,11 @@ static int session_new(nghttp2_session **session_ptr,
if (option->opt_set_mask & NGHTTP2_OPT_MAX_OUTBOUND_ACK) {
(*session_ptr)->max_outbound_ack = option->max_outbound_ack;
}
-
- if ((option->opt_set_mask & NGHTTP2_OPT_MAX_SETTINGS) &&
- option->max_settings) {
- (*session_ptr)->max_settings = option->max_settings;
- }
+
+ if ((option->opt_set_mask & NGHTTP2_OPT_MAX_SETTINGS) &&
+ option->max_settings) {
+ (*session_ptr)->max_settings = option->max_settings;
+ }
}
rv = nghttp2_hd_deflate_init2(&(*session_ptr)->hd_deflater,
@@ -2744,7 +2744,7 @@ static int session_after_frame_sent1(nghttp2_session *session) {
if (session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE) {
rv = session_update_connection_consumed_size(session, 0);
} else {
- rv = nghttp2_session_update_recv_connection_window_size(session, 0);
+ rv = nghttp2_session_update_recv_connection_window_size(session, 0);
}
if (nghttp2_is_fatal(rv)) {
@@ -2770,8 +2770,8 @@ static int session_after_frame_sent1(nghttp2_session *session) {
if (session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE) {
rv = session_update_stream_consumed_size(session, stream, 0);
} else {
- rv =
- nghttp2_session_update_recv_stream_window_size(session, stream, 0, 1);
+ rv =
+ nghttp2_session_update_recv_stream_window_size(session, stream, 0, 1);
}
if (nghttp2_is_fatal(rv)) {
@@ -5027,10 +5027,10 @@ static int adjust_recv_window_size(int32_t *recv_window_size_ptr, size_t delta,
return 0;
}
-int nghttp2_session_update_recv_stream_window_size(nghttp2_session *session,
- nghttp2_stream *stream,
- size_t delta_size,
- int send_window_update) {
+int nghttp2_session_update_recv_stream_window_size(nghttp2_session *session,
+ nghttp2_stream *stream,
+ size_t delta_size,
+ int send_window_update) {
int rv;
rv = adjust_recv_window_size(&stream->recv_window_size, delta_size,
stream->local_window_size);
@@ -5059,8 +5059,8 @@ int nghttp2_session_update_recv_stream_window_size(nghttp2_session *session,
return 0;
}
-int nghttp2_session_update_recv_connection_window_size(nghttp2_session *session,
- size_t delta_size) {
+int nghttp2_session_update_recv_connection_window_size(nghttp2_session *session,
+ size_t delta_size) {
int rv;
rv = adjust_recv_window_size(&session->recv_window_size, delta_size,
session->local_window_size);
@@ -5672,12 +5672,12 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
break;
}
- /* Check the settings flood counter early to be safe */
- if (session->obq_flood_counter_ >= session->max_outbound_ack &&
- !(iframe->frame.hd.flags & NGHTTP2_FLAG_ACK)) {
- return NGHTTP2_ERR_FLOODED;
- }
-
+ /* Check the settings flood counter early to be safe */
+ if (session->obq_flood_counter_ >= session->max_outbound_ack &&
+ !(iframe->frame.hd.flags & NGHTTP2_FLAG_ACK)) {
+ return NGHTTP2_ERR_FLOODED;
+ }
+
iframe->state = NGHTTP2_IB_READ_SETTINGS;
if (iframe->payloadleft) {
@@ -5688,16 +5688,16 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
iframe->max_niv =
iframe->frame.hd.length / NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH + 1;
- if (iframe->max_niv - 1 > session->max_settings) {
- rv = nghttp2_session_terminate_session_with_reason(
- session, NGHTTP2_ENHANCE_YOUR_CALM,
- "SETTINGS: too many setting entries");
- if (nghttp2_is_fatal(rv)) {
- return rv;
- }
- return (ssize_t)inlen;
- }
-
+ if (iframe->max_niv - 1 > session->max_settings) {
+ rv = nghttp2_session_terminate_session_with_reason(
+ session, NGHTTP2_ENHANCE_YOUR_CALM,
+ "SETTINGS: too many setting entries");
+ if (nghttp2_is_fatal(rv)) {
+ return rv;
+ }
+ return (ssize_t)inlen;
+ }
+
iframe->iv = nghttp2_mem_malloc(mem, sizeof(nghttp2_settings_entry) *
iframe->max_niv);
@@ -6465,7 +6465,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
}
/* Pad Length field is subject to flow control */
- rv = nghttp2_session_update_recv_connection_window_size(session, readlen);
+ rv = nghttp2_session_update_recv_connection_window_size(session, readlen);
if (nghttp2_is_fatal(rv)) {
return rv;
}
@@ -6488,7 +6488,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
stream = nghttp2_session_get_stream(session, iframe->frame.hd.stream_id);
if (stream) {
- rv = nghttp2_session_update_recv_stream_window_size(
+ rv = nghttp2_session_update_recv_stream_window_size(
session, stream, readlen,
iframe->payloadleft ||
(iframe->frame.hd.flags & NGHTTP2_FLAG_END_STREAM) == 0);
@@ -6535,8 +6535,8 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
if (readlen > 0) {
ssize_t data_readlen;
- rv = nghttp2_session_update_recv_connection_window_size(session,
- readlen);
+ rv = nghttp2_session_update_recv_connection_window_size(session,
+ readlen);
if (nghttp2_is_fatal(rv)) {
return rv;
}
@@ -6545,7 +6545,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
return (ssize_t)inlen;
}
- rv = nghttp2_session_update_recv_stream_window_size(
+ rv = nghttp2_session_update_recv_stream_window_size(
session, stream, readlen,
iframe->payloadleft ||
(iframe->frame.hd.flags & NGHTTP2_FLAG_END_STREAM) == 0);
@@ -6646,8 +6646,8 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
if (readlen > 0) {
/* Update connection-level flow control window for ignored
DATA frame too */
- rv = nghttp2_session_update_recv_connection_window_size(session,
- readlen);
+ rv = nghttp2_session_update_recv_connection_window_size(session,
+ readlen);
if (nghttp2_is_fatal(rv)) {
return rv;
}
@@ -7467,11 +7467,11 @@ static int nghttp2_session_upgrade_internal(nghttp2_session *session,
if (settings_payloadlen % NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH) {
return NGHTTP2_ERR_INVALID_ARGUMENT;
}
- /* SETTINGS frame contains too many settings */
+ /* SETTINGS frame contains too many settings */
if (settings_payloadlen / NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH >
session->max_settings) {
- return NGHTTP2_ERR_TOO_MANY_SETTINGS;
- }
+ return NGHTTP2_ERR_TOO_MANY_SETTINGS;
+ }
rv = nghttp2_frame_unpack_settings_payload2(&iv, &niv, settings_payload,
settings_payloadlen, mem);
if (rv != 0) {
diff --git a/contrib/libs/nghttp2/lib/nghttp2_session.h b/contrib/libs/nghttp2/lib/nghttp2_session.h
index ddedc9f6fc..07bfbb6c90 100644
--- a/contrib/libs/nghttp2/lib/nghttp2_session.h
+++ b/contrib/libs/nghttp2/lib/nghttp2_session.h
@@ -267,8 +267,8 @@ struct nghttp2_session {
/* The maximum length of header block to send. Calculated by the
same way as nghttp2_hd_deflate_bound() does. */
size_t max_send_header_block_length;
- /* The maximum number of settings accepted per SETTINGS frame. */
- size_t max_settings;
+ /* The maximum number of settings accepted per SETTINGS frame. */
+ size_t max_settings;
/* Next Stream ID. Made unsigned int to detect >= (1 << 31). */
uint32_t next_stream_id;
/* The last stream ID this session initiated. For client session,
@@ -900,36 +900,36 @@ int nghttp2_session_terminate_session_with_reason(nghttp2_session *session,
uint32_t error_code,
const char *reason);
-/*
- * Accumulates received bytes |delta_size| for connection-level flow
- * control and decides whether to send WINDOW_UPDATE to the
- * connection. If NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE is set,
- * WINDOW_UPDATE will not be sent.
- *
- * This function returns 0 if it succeeds, or one of the following
- * negative error codes:
- *
- * NGHTTP2_ERR_NOMEM
- * Out of memory.
- */
-int nghttp2_session_update_recv_connection_window_size(nghttp2_session *session,
- size_t delta_size);
-
-/*
- * Accumulates received bytes |delta_size| for stream-level flow
- * control and decides whether to send WINDOW_UPDATE to that stream.
- * If NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE is set, WINDOW_UPDATE will not
- * be sent.
- *
- * This function returns 0 if it succeeds, or one of the following
- * negative error codes:
- *
- * NGHTTP2_ERR_NOMEM
- * Out of memory.
- */
-int nghttp2_session_update_recv_stream_window_size(nghttp2_session *session,
- nghttp2_stream *stream,
- size_t delta_size,
- int send_window_update);
-
+/*
+ * Accumulates received bytes |delta_size| for connection-level flow
+ * control and decides whether to send WINDOW_UPDATE to the
+ * connection. If NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE is set,
+ * WINDOW_UPDATE will not be sent.
+ *
+ * This function returns 0 if it succeeds, or one of the following
+ * negative error codes:
+ *
+ * NGHTTP2_ERR_NOMEM
+ * Out of memory.
+ */
+int nghttp2_session_update_recv_connection_window_size(nghttp2_session *session,
+ size_t delta_size);
+
+/*
+ * Accumulates received bytes |delta_size| for stream-level flow
+ * control and decides whether to send WINDOW_UPDATE to that stream.
+ * If NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE is set, WINDOW_UPDATE will not
+ * be sent.
+ *
+ * This function returns 0 if it succeeds, or one of the following
+ * negative error codes:
+ *
+ * NGHTTP2_ERR_NOMEM
+ * Out of memory.
+ */
+int nghttp2_session_update_recv_stream_window_size(nghttp2_session *session,
+ nghttp2_stream *stream,
+ size_t delta_size,
+ int send_window_update);
+
#endif /* NGHTTP2_SESSION_H */
diff --git a/contrib/libs/nghttp2/lib/nghttp2_submit.c b/contrib/libs/nghttp2/lib/nghttp2_submit.c
index 8b6e9f739f..744a49cf60 100644
--- a/contrib/libs/nghttp2/lib/nghttp2_submit.c
+++ b/contrib/libs/nghttp2/lib/nghttp2_submit.c
@@ -450,13 +450,13 @@ int nghttp2_session_set_local_window_size(nghttp2_session *session,
if (rv != 0) {
return rv;
}
-
- if (window_size_increment > 0) {
- return nghttp2_session_add_window_update(session, 0, stream_id,
- window_size_increment);
- }
-
- return nghttp2_session_update_recv_connection_window_size(session, 0);
+
+ if (window_size_increment > 0) {
+ return nghttp2_session_add_window_update(session, 0, stream_id,
+ window_size_increment);
+ }
+
+ return nghttp2_session_update_recv_connection_window_size(session, 0);
} else {
stream = nghttp2_session_get_stream(session, stream_id);
@@ -484,13 +484,13 @@ int nghttp2_session_set_local_window_size(nghttp2_session *session,
return rv;
}
- if (window_size_increment > 0) {
- return nghttp2_session_add_window_update(session, 0, stream_id,
- window_size_increment);
- }
-
- return nghttp2_session_update_recv_stream_window_size(session, stream, 0,
- 1);
+ if (window_size_increment > 0) {
+ return nghttp2_session_add_window_update(session, 0, stream_id,
+ window_size_increment);
+ }
+
+ return nghttp2_session_update_recv_stream_window_size(session, stream, 0,
+ 1);
}
return 0;
diff --git a/contrib/libs/ya.make b/contrib/libs/ya.make
index d3eac17719..9c4640fdcf 100644
--- a/contrib/libs/ya.make
+++ b/contrib/libs/ya.make
@@ -237,8 +237,8 @@ RECURSE(
nanosvg/ut
nayuki_md5
nghttp2
- node-addon-api
- nodejs_12
+ node-addon-api
+ nodejs_12
node_nan
nsync
numa